var PHe=Object.defineProperty;var M2e=t=>{throw TypeError(t)};var LHe=(t,e,n)=>e in t?PHe(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var Gn=(t,e,n)=>LHe(t,typeof e!="symbol"?e+"":e,n),zoe=(t,e,n)=>e.has(t)||M2e("Cannot "+n);var er=(t,e,n)=>(zoe(t,e,"read from private field"),n?n.call(t):e.get(t)),ca=(t,e,n)=>e.has(t)?M2e("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),us=(t,e,n,s)=>(zoe(t,e,"write to private field"),s?s.call(t,n):e.set(t,n),n),oi=(t,e,n)=>(zoe(t,e,"access private method"),n);var F6=(t,e,n,s)=>({set _(a){us(t,e,a,n)},get _(){return er(t,e,s)}});function OHe(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 Ax=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Hi(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function C5e(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 M5e={exports:{}},lne={},T5e={exports:{}},Pi={};/** * @license React * react.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var nI=Symbol.for("react.element"),DHe=Symbol.for("react.portal"),RHe=Symbol.for("react.fragment"),FHe=Symbol.for("react.strict_mode"),zHe=Symbol.for("react.profiler"),BHe=Symbol.for("react.provider"),$He=Symbol.for("react.context"),UHe=Symbol.for("react.forward_ref"),qHe=Symbol.for("react.suspense"),VHe=Symbol.for("react.memo"),HHe=Symbol.for("react.lazy"),T2e=Symbol.iterator;function WHe(t){return t===null||typeof t!="object"?null:(t=T2e&&t[T2e]||t["@@iterator"],typeof t=="function"?t:null)}var A5e={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},E5e=Object.assign,I5e={};function VC(t,e,n){this.props=t,this.context=e,this.refs=I5e,this.updater=n||A5e}VC.prototype.isReactComponent={};VC.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")};VC.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function P5e(){}P5e.prototype=VC.prototype;function Bpe(t,e,n){this.props=t,this.context=e,this.refs=I5e,this.updater=n||A5e}var $pe=Bpe.prototype=new P5e;$pe.constructor=Bpe;E5e($pe,VC.prototype);$pe.isPureReactComponent=!0;var A2e=Array.isArray,L5e=Object.prototype.hasOwnProperty,Upe={current:null},O5e={key:!0,ref:!0,__self:!0,__source:!0};function D5e(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)L5e.call(e,s)&&!O5e.hasOwnProperty(s)&&(a[s]=e[s]);var i=arguments.length-2;if(i===1)a.children=n;else if(1>>1,be=ue[Ce];if(0>>1;Cea(Ne,Ae))Bea(Ee,Ne)?(ue[Ce]=Ee,ue[Be]=Ae,Ce=Be):(ue[Ce]=Ne,ue[Le]=Ae,Ce=Le);else if(Bea(Ee,Ae))ue[Ce]=Ee,ue[Be]=Ae,Ce=Be;else break e}}return _e}function a(ue,_e){var Ae=ue.sortIndex-_e.sortIndex;return Ae!==0?Ae:ue.id-_e.id}if(typeof performance=="object"&&typeof performance.now=="function"){var o=performance;t.unstable_now=function(){return o.now()}}else{var l=Date,i=l.now();t.unstable_now=function(){return l.now()-i}}var h=[],p=[],x=1,y=null,b=3,j=!1,C=!1,N=!1,A=typeof setTimeout=="function"?setTimeout:null,E=typeof clearTimeout=="function"?clearTimeout:null,T=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function L(ue){for(var _e=n(p);_e!==null;){if(_e.callback===null)s(p);else if(_e.startTime<=ue)s(p),_e.sortIndex=_e.expirationTime,e(h,_e);else break;_e=n(p)}}function z(ue){if(N=!1,L(ue),!C)if(n(h)!==null)C=!0,ae(F);else{var _e=n(p);_e!==null&&he(z,_e.startTime-ue)}}function F(ue,_e){C=!1,N&&(N=!1,E(Z),Z=-1),j=!0;var Ae=b;try{for(L(_e),y=n(h);y!==null&&(!(y.expirationTime>_e)||ue&&!ie());){var Ce=y.callback;if(typeof Ce=="function"){y.callback=null,b=y.priorityLevel;var be=Ce(y.expirationTime<=_e);_e=t.unstable_now(),typeof be=="function"?y.callback=be:y===n(h)&&s(h),L(_e)}else s(h);y=n(h)}if(y!==null)var me=!0;else{var Le=n(p);Le!==null&&he(z,Le.startTime-_e),me=!1}return me}finally{y=null,b=Ae,j=!1}}var q=!1,H=null,Z=-1,G=5,te=-1;function ie(){return!(t.unstable_now()-teue||125Ce?(ue.sortIndex=Ae,e(p,ue),n(h)===null&&ue===n(p)&&(N?(E(Z),Z=-1):N=!0,he(z,Ae-Ce))):(ue.sortIndex=be,e(h,ue),C||j||(C=!0,ae(F))),ue},t.unstable_shouldYield=ie,t.unstable_wrapCallback=function(ue){var _e=b;return function(){var Ae=b;b=_e;try{return ue.apply(this,arguments)}finally{b=Ae}}}})($5e);B5e.exports=$5e;var nWe=B5e.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 sWe=I,lf=nWe;function Sn(t){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+t,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),fde=Object.prototype.hasOwnProperty,aWe=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,I2e={},P2e={};function iWe(t){return fde.call(P2e,t)?!0:fde.call(I2e,t)?!1:aWe.test(t)?P2e[t]=!0:(I2e[t]=!0,!1)}function oWe(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 lWe(t,e,n,s){if(e===null||typeof e>"u"||oWe(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 Vu(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 zd={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){zd[t]=new Vu(t,0,!1,t,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];zd[e]=new Vu(e,1,!1,t[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(t){zd[t]=new Vu(t,2,!1,t.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){zd[t]=new Vu(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){zd[t]=new Vu(t,3,!1,t.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(t){zd[t]=new Vu(t,3,!0,t,null,!1,!1)});["capture","download"].forEach(function(t){zd[t]=new Vu(t,4,!1,t,null,!1,!1)});["cols","rows","size","span"].forEach(function(t){zd[t]=new Vu(t,6,!1,t,null,!1,!1)});["rowSpan","start"].forEach(function(t){zd[t]=new Vu(t,5,!1,t.toLowerCase(),null,!1,!1)});var Hpe=/[\-:]([a-z])/g;function Wpe(t){return t[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(t){var e=t.replace(Hpe,Wpe);zd[e]=new Vu(e,1,!1,t,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(t){var e=t.replace(Hpe,Wpe);zd[e]=new Vu(e,1,!1,t,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(t){var e=t.replace(Hpe,Wpe);zd[e]=new Vu(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(t){zd[t]=new Vu(t,1,!1,t.toLowerCase(),null,!1,!1)});zd.xlinkHref=new Vu("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(t){zd[t]=new Vu(t,1,!1,t.toLowerCase(),null,!0,!0)});function Gpe(t,e,n,s){var a=zd.hasOwnProperty(e)?zd[e]:null;(a!==null?a.type!==0:s||!(2i||a[l]!==o[i]){var h=` `+a[l].replace(" at new "," at ");return t.displayName&&h.includes("")&&(h=h.replace("",t.displayName)),h}while(1<=l&&0<=i);break}}}finally{Uoe=!1,Error.prepareStackTrace=n}return(t=t?t.displayName||t.name:"")?JM(t):""}function cWe(t){switch(t.tag){case 5:return JM(t.type);case 16:return JM("Lazy");case 13:return JM("Suspense");case 19:return JM("SuspenseList");case 0:case 2:case 15:return t=qoe(t.type,!1),t;case 11:return t=qoe(t.type.render,!1),t;case 1:return t=qoe(t.type,!0),t;default:return""}}function xde(t){if(t==null)return null;if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case N4:return"Fragment";case k4:return"Portal";case pde:return"Profiler";case Kpe:return"StrictMode";case mde:return"Suspense";case gde:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case V5e:return(t.displayName||"Context")+".Consumer";case q5e:return(t._context.displayName||"Context")+".Provider";case Zpe:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case Ype:return e=t.displayName||null,e!==null?e:xde(t.type)||"Memo";case f0:e=t._payload,t=t._init;try{return xde(t(e))}catch{}}return null}function dWe(t){var e=t.type;switch(t.tag){case 24:return"Cache";case 9:return(e.displayName||"Context")+".Consumer";case 10:return(e._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return t=e.render,t=t.displayName||t.name||"",e.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return xde(e);case 8:return e===Kpe?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e}return null}function L1(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function W5e(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function uWe(t){var e=W5e(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 $6(t){t._valueTracker||(t._valueTracker=uWe(t))}function G5e(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var n=e.getValue(),s="";return t&&(s=W5e(t)?t.checked?"true":"false":t.value),t=s,t!==n?(e.setValue(t),!0):!1}function mee(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}function yde(t,e){var n=e.checked;return Bl({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??t._wrapperState.initialChecked})}function O2e(t,e){var n=e.defaultValue==null?"":e.defaultValue,s=e.checked!=null?e.checked:e.defaultChecked;n=L1(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 K5e(t,e){e=e.checked,e!=null&&Gpe(t,"checked",e,!1)}function vde(t,e){K5e(t,e);var n=L1(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,L1(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function D2e(t,e,n){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var s=e.type;if(!(s!=="submit"&&s!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+t._wrapperState.initialValue,n||e===t.value||(t.value=e),t.defaultValue=e}n=t.name,n!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,n!==""&&(t.name=n)}function _de(t,e,n){(e!=="number"||mee(t.ownerDocument)!==t)&&(n==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+n&&(t.defaultValue=""+n))}var eT=Array.isArray;function V4(t,e,n,s){if(t=t.options,e){e={};for(var a=0;a"+e.valueOf().toString()+"",e=U6.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function CA(t,e){if(e){var n=t.firstChild;if(n&&n===t.lastChild&&n.nodeType===3){n.nodeValue=e;return}}t.textContent=e}var pT={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},hWe=["Webkit","ms","Moz","O"];Object.keys(pT).forEach(function(t){hWe.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),pT[e]=pT[t]})});function Q5e(t,e,n){return e==null||typeof e=="boolean"||e===""?"":n||typeof e!="number"||e===0||pT.hasOwnProperty(t)&&pT[t]?(""+e).trim():e+"px"}function J5e(t,e){t=t.style;for(var n in e)if(e.hasOwnProperty(n)){var s=n.indexOf("--")===0,a=Q5e(n,e[n],s);n==="float"&&(n="cssFloat"),s?t.setProperty(n,a):t[n]=a}}var fWe=Bl({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function jde(t,e){if(e){if(fWe[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(Sn(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(Sn(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(Sn(61))}if(e.style!=null&&typeof e.style!="object")throw Error(Sn(62))}}function kde(t,e){if(t.indexOf("-")===-1)return typeof e.is=="string";switch(t){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Nde=null;function Xpe(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var Sde=null,H4=null,W4=null;function z2e(t){if(t=iI(t)){if(typeof Sde!="function")throw Error(Sn(280));var e=t.stateNode;e&&(e=fne(e),Sde(t.stateNode,t.type,e))}}function eMe(t){H4?W4?W4.push(t):W4=[t]:H4=t}function tMe(){if(H4){var t=H4,e=W4;if(W4=H4=null,z2e(t),e)for(t=0;t>>=0,t===0?32:31-(kWe(t)/NWe|0)|0}var q6=64,V6=4194304;function tT(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 vee(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=tT(i):(o&=l,o!==0&&(s=tT(o)))}else l=n&~a,l!==0?s=tT(l):o!==0&&(s=tT(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 sI(t,e,n){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-cm(e),t[e]=n}function TWe(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=gT),K2e=" ",Z2e=!1;function bMe(t,e){switch(t){case"keyup":return nGe.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function wMe(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var S4=!1;function aGe(t,e){switch(t){case"compositionend":return wMe(e);case"keypress":return e.which!==32?null:(Z2e=!0,K2e);case"textInput":return t=e.data,t===K2e&&Z2e?null:t;default:return null}}function iGe(t,e){if(S4)return t==="compositionend"||!ame&&bMe(t,e)?(t=vMe(),aO=rme=U0=null,S4=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1=e)return{node:n,offset:e-t};t=s}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=J2e(n)}}function SMe(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?SMe(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function CMe(){for(var t=window,e=mee();e instanceof t.HTMLIFrameElement;){try{var n=typeof e.contentWindow.location.href=="string"}catch{n=!1}if(n)t=e.contentWindow;else break;e=mee(t.document)}return e}function ime(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e&&(e==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||e==="textarea"||t.contentEditable==="true")}function mGe(t){var e=CMe(),n=t.focusedElem,s=t.selectionRange;if(e!==n&&n&&n.ownerDocument&&SMe(n.ownerDocument.documentElement,n)){if(s!==null&&ime(n)){if(e=s.start,t=s.end,t===void 0&&(t=e),"selectionStart"in n)n.selectionStart=e,n.selectionEnd=Math.min(t,n.value.length);else if(t=(e=n.ownerDocument||document)&&e.defaultView||window,t.getSelection){t=t.getSelection();var a=n.textContent.length,o=Math.min(s.start,a);s=s.end===void 0?o:Math.min(s.end,a),!t.extend&&o>s&&(a=s,s=o,o=a),a=ebe(n,o);var l=ebe(n,s);a&&l&&(t.rangeCount!==1||t.anchorNode!==a.node||t.anchorOffset!==a.offset||t.focusNode!==l.node||t.focusOffset!==l.offset)&&(e=e.createRange(),e.setStart(a.node,a.offset),t.removeAllRanges(),o>s?(t.addRange(e),t.extend(l.node,l.offset)):(e.setEnd(l.node,l.offset),t.addRange(e)))}}for(e=[],t=n;t=t.parentNode;)t.nodeType===1&&e.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,C4=null,Ide=null,yT=null,Pde=!1;function tbe(t,e,n){var s=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Pde||C4==null||C4!==mee(s)||(s=C4,"selectionStart"in s&&ime(s)?s={start:s.selectionStart,end:s.selectionEnd}:(s=(s.ownerDocument&&s.ownerDocument.defaultView||window).getSelection(),s={anchorNode:s.anchorNode,anchorOffset:s.anchorOffset,focusNode:s.focusNode,focusOffset:s.focusOffset}),yT&&PA(yT,s)||(yT=s,s=wee(Ide,"onSelect"),0A4||(t.current=zde[A4],zde[A4]=null,A4--)}function Yo(t,e){A4++,zde[A4]=t.current,t.current=e}var O1={},du=Q1(O1),mh=Q1(!1),Aj=O1;function YS(t,e){var n=t.type.contextTypes;if(!n)return O1;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 gh(t){return t=t.childContextTypes,t!=null}function kee(){ul(mh),ul(du)}function lbe(t,e,n){if(du.current!==O1)throw Error(Sn(168));Yo(du,e),Yo(mh,n)}function DMe(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(Sn(108,dWe(t)||"Unknown",a));return Bl({},n,s)}function Nee(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||O1,Aj=du.current,Yo(du,t),Yo(mh,mh.current),!0}function cbe(t,e,n){var s=t.stateNode;if(!s)throw Error(Sn(169));n?(t=DMe(t,e,Aj),s.__reactInternalMemoizedMergedChildContext=t,ul(mh),ul(du),Yo(du,t)):ul(mh),Yo(mh,n)}var kx=null,pne=!1,nle=!1;function RMe(t){kx===null?kx=[t]:kx.push(t)}function CGe(t){pne=!0,RMe(t)}function J1(){if(!nle&&kx!==null){nle=!0;var t=0,e=So;try{var n=kx;for(So=1;t>=l,a-=l,Ex=1<<32-cm(e)+a|n<Z?(G=H,H=null):G=H.sibling;var te=b(E,H,L[Z],z);if(te===null){H===null&&(H=G);break}t&&H&&te.alternate===null&&e(E,H),T=o(te,T,Z),q===null?F=te:q.sibling=te,q=te,H=G}if(Z===L.length)return n(E,H),kl&&d_(E,Z),F;if(H===null){for(;ZZ?(G=H,H=null):G=H.sibling;var ie=b(E,H,te.value,z);if(ie===null){H===null&&(H=G);break}t&&H&&ie.alternate===null&&e(E,H),T=o(ie,T,Z),q===null?F=ie:q.sibling=ie,q=ie,H=G}if(te.done)return n(E,H),kl&&d_(E,Z),F;if(H===null){for(;!te.done;Z++,te=L.next())te=y(E,te.value,z),te!==null&&(T=o(te,T,Z),q===null?F=te:q.sibling=te,q=te);return kl&&d_(E,Z),F}for(H=s(E,H);!te.done;Z++,te=L.next())te=j(H,E,Z,te.value,z),te!==null&&(t&&te.alternate!==null&&H.delete(te.key===null?Z:te.key),T=o(te,T,Z),q===null?F=te:q.sibling=te,q=te);return t&&H.forEach(function(le){return e(E,le)}),kl&&d_(E,Z),F}function A(E,T,L,z){if(typeof L=="object"&&L!==null&&L.type===N4&&L.key===null&&(L=L.props.children),typeof L=="object"&&L!==null){switch(L.$$typeof){case B6:e:{for(var F=L.key,q=T;q!==null;){if(q.key===F){if(F=L.type,F===N4){if(q.tag===7){n(E,q.sibling),T=a(q,L.props.children),T.return=E,E=T;break e}}else if(q.elementType===F||typeof F=="object"&&F!==null&&F.$$typeof===f0&&hbe(F)===q.type){n(E,q.sibling),T=a(q,L.props),T.ref=kM(E,q,L),T.return=E,E=T;break e}n(E,q);break}else e(E,q);q=q.sibling}L.type===N4?(T=ij(L.props.children,E.mode,z,L.key),T.return=E,E=T):(z=fO(L.type,L.key,L.props,null,E.mode,z),z.ref=kM(E,T,L),z.return=E,E=z)}return l(E);case k4:e:{for(q=L.key;T!==null;){if(T.key===q)if(T.tag===4&&T.stateNode.containerInfo===L.containerInfo&&T.stateNode.implementation===L.implementation){n(E,T.sibling),T=a(T,L.children||[]),T.return=E,E=T;break e}else{n(E,T);break}else e(E,T);T=T.sibling}T=ule(L,E.mode,z),T.return=E,E=T}return l(E);case f0:return q=L._init,A(E,T,q(L._payload),z)}if(eT(L))return C(E,T,L,z);if(vM(L))return N(E,T,L,z);X6(E,L)}return typeof L=="string"&&L!==""||typeof L=="number"?(L=""+L,T!==null&&T.tag===6?(n(E,T.sibling),T=a(T,L),T.return=E,E=T):(n(E,T),T=dle(L,E.mode,z),T.return=E,E=T),l(E)):n(E,T)}return A}var QS=$Me(!0),UMe=$Me(!1),Mee=Q1(null),Tee=null,P4=null,dme=null;function ume(){dme=P4=Tee=null}function hme(t){var e=Mee.current;ul(Mee),t._currentValue=e}function Ude(t,e,n){for(;t!==null;){var s=t.alternate;if((t.childLanes&e)!==e?(t.childLanes|=e,s!==null&&(s.childLanes|=e)):s!==null&&(s.childLanes&e)!==e&&(s.childLanes|=e),t===n)break;t=t.return}}function K4(t,e){Tee=t,dme=P4=null,t=t.dependencies,t!==null&&t.firstContext!==null&&(t.lanes&e&&(hh=!0),t.firstContext=null)}function rp(t){var e=t._currentValue;if(dme!==t)if(t={context:t,memoizedValue:e,next:null},P4===null){if(Tee===null)throw Error(Sn(308));P4=t,Tee.dependencies={lanes:0,firstContext:t}}else P4=P4.next=t;return e}var Dw=null;function fme(t){Dw===null?Dw=[t]:Dw.push(t)}function qMe(t,e,n,s){var a=e.interleaved;return a===null?(n.next=n,fme(e)):(n.next=a.next,a.next=n),e.interleaved=n,ey(t,s)}function ey(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 p0=!1;function pme(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function VMe(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 Fx(t,e){return{eventTime:t,lane:e,tag:0,payload:null,callback:null,next:null}}function r1(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,ey(t,n)}return a=s.interleaved,a===null?(e.next=e,fme(s)):(e.next=a.next,a.next=e),s.interleaved=e,ey(t,n)}function oO(t,e,n){if(e=e.updateQueue,e!==null&&(e=e.shared,(n&4194240)!==0)){var s=e.lanes;s&=t.pendingLanes,n|=s,e.lanes=n,Jpe(t,n)}}function fbe(t,e){var n=t.updateQueue,s=t.alternate;if(s!==null&&(s=s.updateQueue,n===s)){var a=null,o=null;if(n=n.firstBaseUpdate,n!==null){do{var l={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};o===null?a=o=l:o=o.next=l,n=n.next}while(n!==null);o===null?a=o=e:o=o.next=e}else a=o=e;n={baseState:s.baseState,firstBaseUpdate:a,lastBaseUpdate:o,shared:s.shared,effects:s.effects},t.updateQueue=n;return}t=n.lastBaseUpdate,t===null?n.firstBaseUpdate=e:t.next=e,n.lastBaseUpdate=e}function Aee(t,e,n,s){var a=t.updateQueue;p0=!1;var o=a.firstBaseUpdate,l=a.lastBaseUpdate,i=a.shared.pending;if(i!==null){a.shared.pending=null;var h=i,p=h.next;h.next=null,l===null?o=p:l.next=p,l=h;var x=t.alternate;x!==null&&(x=x.updateQueue,i=x.lastBaseUpdate,i!==l&&(i===null?x.firstBaseUpdate=p:i.next=p,x.lastBaseUpdate=h))}if(o!==null){var y=a.baseState;l=0,x=p=h=null,i=o;do{var b=i.lane,j=i.eventTime;if((s&b)===b){x!==null&&(x=x.next={eventTime:j,lane:0,tag:i.tag,payload:i.payload,callback:i.callback,next:null});e:{var C=t,N=i;switch(b=e,j=n,N.tag){case 1:if(C=N.payload,typeof C=="function"){y=C.call(j,y,b);break e}y=C;break e;case 3:C.flags=C.flags&-65537|128;case 0:if(C=N.payload,b=typeof C=="function"?C.call(j,y,b):C,b==null)break e;y=Bl({},y,b);break e;case 2:p0=!0}}i.callback!==null&&i.lane!==0&&(t.flags|=64,b=a.effects,b===null?a.effects=[i]:b.push(i))}else j={eventTime:j,lane:b,tag:i.tag,payload:i.payload,callback:i.callback,next:null},x===null?(p=x=j,h=y):x=x.next=j,l|=b;if(i=i.next,i===null){if(i=a.shared.pending,i===null)break;b=i,i=b.next,b.next=null,a.lastBaseUpdate=b,a.shared.pending=null}}while(!0);if(x===null&&(h=y),a.baseState=h,a.firstBaseUpdate=p,a.lastBaseUpdate=x,e=a.shared.interleaved,e!==null){a=e;do l|=a.lane,a=a.next;while(a!==e)}else o===null&&(a.shared.lanes=0);Pj|=l,t.lanes=l,t.memoizedState=y}}function pbe(t,e,n){if(t=e.effects,e.effects=null,t!==null)for(e=0;en?n:4,t(!0);var s=ale.transition;ale.transition={};try{t(!1),e()}finally{So=n,ale.transition=s}}function oTe(){return np().memoizedState}function EGe(t,e,n){var s=s1(t);if(n={lane:s,action:n,hasEagerState:!1,eagerState:null,next:null},lTe(t))cTe(e,n);else if(n=qMe(t,e,n,s),n!==null){var a=Du();dm(n,t,s,a),dTe(n,e,s)}}function IGe(t,e,n){var s=s1(t),a={lane:s,action:n,hasEagerState:!1,eagerState:null,next:null};if(lTe(t))cTe(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,vm(i,l)){var h=e.interleaved;h===null?(a.next=a,fme(e)):(a.next=h.next,h.next=a),e.interleaved=a;return}}catch{}finally{}n=qMe(t,e,a,s),n!==null&&(a=Du(),dm(n,t,s,a),dTe(n,e,s))}}function lTe(t){var e=t.alternate;return t===Rl||e!==null&&e===Rl}function cTe(t,e){vT=Iee=!0;var n=t.pending;n===null?e.next=e:(e.next=n.next,n.next=e),t.pending=e}function dTe(t,e,n){if(n&4194240){var s=e.lanes;s&=t.pendingLanes,n|=s,e.lanes=n,Jpe(t,n)}}var Pee={readContext:rp,useCallback:Gd,useContext:Gd,useEffect:Gd,useImperativeHandle:Gd,useInsertionEffect:Gd,useLayoutEffect:Gd,useMemo:Gd,useReducer:Gd,useRef:Gd,useState:Gd,useDebugValue:Gd,useDeferredValue:Gd,useTransition:Gd,useMutableSource:Gd,useSyncExternalStore:Gd,useId:Gd,unstable_isNewReconciler:!1},PGe={readContext:rp,useCallback:function(t,e){return Xm().memoizedState=[t,e===void 0?null:e],t},useContext:rp,useEffect:gbe,useImperativeHandle:function(t,e,n){return n=n!=null?n.concat([t]):null,cO(4194308,4,rTe.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=Xm();return e=e===void 0?null:e,t=t(),n.memoizedState=[t,e],t},useReducer:function(t,e,n){var s=Xm();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=EGe.bind(null,Rl,t),[s.memoizedState,t]},useRef:function(t){var e=Xm();return t={current:t},e.memoizedState=t},useState:mbe,useDebugValue:wme,useDeferredValue:function(t){return Xm().memoizedState=t},useTransition:function(){var t=mbe(!1),e=t[0];return t=AGe.bind(null,t[1]),Xm().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,n){var s=Rl,a=Xm();if(kl){if(n===void 0)throw Error(Sn(407));n=n()}else{if(n=e(),ud===null)throw Error(Sn(349));Ij&30||KMe(s,e,n)}a.memoizedState=n;var o={value:n,getSnapshot:e};return a.queue=o,gbe(YMe.bind(null,s,o,t),[t]),s.flags|=2048,$A(9,ZMe.bind(null,s,o,n,e),void 0,null),n},useId:function(){var t=Xm(),e=ud.identifierPrefix;if(kl){var n=Ix,s=Ex;n=(s&~(1<<32-cm(s)-1)).toString(32)+n,e=":"+e+"R"+n,n=zA++,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[ag]=e,t[DA]=s,_Te(t,e,!1,!1),e.stateNode=t;e:{switch(l=kde(n,s),n){case"dialog":il("cancel",t),il("close",t),a=s;break;case"iframe":case"object":case"embed":il("load",t),a=s;break;case"video":case"audio":for(a=0;atC&&(e.flags|=128,s=!0,NM(o,!1),e.lanes=4194304)}else{if(!s)if(t=Eee(l),t!==null){if(e.flags|=128,s=!0,n=t.updateQueue,n!==null&&(e.updateQueue=n,e.flags|=4),NM(o,!0),o.tail===null&&o.tailMode==="hidden"&&!l.alternate&&!kl)return Kd(e),null}else 2*lc()-o.renderingStartTime>tC&&n!==1073741824&&(e.flags|=128,s=!0,NM(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=lc(),e.sibling=null,n=El.current,Yo(El,s?n&1|2:n&1),e):(Kd(e),null);case 22:case 23:return Mme(),s=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==s&&(e.flags|=8192),s&&e.mode&1?$h&1073741824&&(Kd(e),e.subtreeFlags&6&&(e.flags|=8192)):Kd(e),null;case 24:return null;case 25:return null}throw Error(Sn(156,e.tag))}function $Ge(t,e){switch(lme(e),e.tag){case 1:return gh(e.type)&&kee(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return JS(),ul(mh),ul(du),xme(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 5:return gme(e),null;case 13:if(ul(El),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(Sn(340));XS()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return ul(El),null;case 4:return JS(),null;case 10:return hme(e.type._context),null;case 22:case 23:return Mme(),null;case 24:return null;default:return null}}var J6=!1,Qd=!1,UGe=typeof WeakSet=="function"?WeakSet:Set,ys=null;function L4(t,e){var n=t.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(s){Wl(t,e,s)}else n.current=null}function Xde(t,e,n){try{n()}catch(s){Wl(t,e,s)}}var Cbe=!1;function qGe(t,e){if(Lde=_ee,t=CMe(),ime(t)){if("selectionStart"in t)var n={start:t.selectionStart,end:t.selectionEnd};else e:{n=(n=t.ownerDocument)&&n.defaultView||window;var s=n.getSelection&&n.getSelection();if(s&&s.rangeCount!==0){n=s.anchorNode;var a=s.anchorOffset,o=s.focusNode;s=s.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break e}var l=0,i=-1,h=-1,p=0,x=0,y=t,b=null;t:for(;;){for(var j;y!==n||a!==0&&y.nodeType!==3||(i=l+a),y!==o||s!==0&&y.nodeType!==3||(h=l+s),y.nodeType===3&&(l+=y.nodeValue.length),(j=y.firstChild)!==null;)b=y,y=j;for(;;){if(y===t)break t;if(b===n&&++p===a&&(i=l),b===o&&++x===s&&(h=l),(j=y.nextSibling)!==null)break;y=b,b=y.parentNode}y=j}n=i===-1||h===-1?null:{start:i,end:h}}else n=null}n=n||{start:0,end:0}}else n=null;for(Ode={focusedElem:t,selectionRange:n},_ee=!1,ys=e;ys!==null;)if(e=ys,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,ys=t;else for(;ys!==null;){e=ys;try{var C=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(C!==null){var N=C.memoizedProps,A=C.memoizedState,E=e.stateNode,T=E.getSnapshotBeforeUpdate(e.elementType===e.type?N:Hp(e.type,N),A);E.__reactInternalSnapshotBeforeUpdate=T}break;case 3:var L=e.stateNode.containerInfo;L.nodeType===1?L.textContent="":L.nodeType===9&&L.documentElement&&L.removeChild(L.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(Sn(163))}}catch(z){Wl(e,e.return,z)}if(t=e.sibling,t!==null){t.return=e.return,ys=t;break}ys=e.return}return C=Cbe,Cbe=!1,C}function _T(t,e,n){var s=e.updateQueue;if(s=s!==null?s.lastEffect:null,s!==null){var a=s=s.next;do{if((a.tag&t)===t){var o=a.destroy;a.destroy=void 0,o!==void 0&&Xde(e,n,o)}a=a.next}while(a!==s)}}function xne(t,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var n=e=e.next;do{if((n.tag&t)===t){var s=n.create;n.destroy=s()}n=n.next}while(n!==e)}}function Qde(t){var e=t.ref;if(e!==null){var n=t.stateNode;switch(t.tag){case 5:t=n;break;default:t=n}typeof e=="function"?e(t):e.current=t}}function jTe(t){var e=t.alternate;e!==null&&(t.alternate=null,jTe(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[ag],delete e[DA],delete e[Fde],delete e[NGe],delete e[SGe])),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 kTe(t){return t.tag===5||t.tag===3||t.tag===4}function Mbe(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||kTe(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function Jde(t,e,n){var s=t.tag;if(s===5||s===6)t=t.stateNode,e?n.nodeType===8?n.parentNode.insertBefore(t,e):n.insertBefore(t,e):(n.nodeType===8?(e=n.parentNode,e.insertBefore(t,n)):(e=n,e.appendChild(t)),n=n._reactRootContainer,n!=null||e.onclick!==null||(e.onclick=jee));else if(s!==4&&(t=t.child,t!==null))for(Jde(t,e,n),t=t.sibling;t!==null;)Jde(t,e,n),t=t.sibling}function eue(t,e,n){var s=t.tag;if(s===5||s===6)t=t.stateNode,e?n.insertBefore(t,e):n.appendChild(t);else if(s!==4&&(t=t.child,t!==null))for(eue(t,e,n),t=t.sibling;t!==null;)eue(t,e,n),t=t.sibling}var Md=null,Zp=!1;function n0(t,e,n){for(n=n.child;n!==null;)NTe(t,e,n),n=n.sibling}function NTe(t,e,n){if(hg&&typeof hg.onCommitFiberUnmount=="function")try{hg.onCommitFiberUnmount(cne,n)}catch{}switch(n.tag){case 5:Qd||L4(n,e);case 6:var s=Md,a=Zp;Md=null,n0(t,e,n),Md=s,Zp=a,Md!==null&&(Zp?(t=Md,n=n.stateNode,t.nodeType===8?t.parentNode.removeChild(n):t.removeChild(n)):Md.removeChild(n.stateNode));break;case 18:Md!==null&&(Zp?(t=Md,n=n.stateNode,t.nodeType===8?rle(t.parentNode,n):t.nodeType===1&&rle(t,n),EA(t)):rle(Md,n.stateNode));break;case 4:s=Md,a=Zp,Md=n.stateNode.containerInfo,Zp=!0,n0(t,e,n),Md=s,Zp=a;break;case 0:case 11:case 14:case 15:if(!Qd&&(s=n.updateQueue,s!==null&&(s=s.lastEffect,s!==null))){a=s=s.next;do{var o=a,l=o.destroy;o=o.tag,l!==void 0&&(o&2||o&4)&&Xde(n,e,l),a=a.next}while(a!==s)}n0(t,e,n);break;case 1:if(!Qd&&(L4(n,e),s=n.stateNode,typeof s.componentWillUnmount=="function"))try{s.props=n.memoizedProps,s.state=n.memoizedState,s.componentWillUnmount()}catch(i){Wl(n,e,i)}n0(t,e,n);break;case 21:n0(t,e,n);break;case 22:n.mode&1?(Qd=(s=Qd)||n.memoizedState!==null,n0(t,e,n),Qd=s):n0(t,e,n);break;default:n0(t,e,n)}}function Tbe(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var n=t.stateNode;n===null&&(n=t.stateNode=new UGe),e.forEach(function(s){var a=QGe.bind(null,t,s);n.has(s)||(n.add(s),s.then(a,a))})}}function Fp(t,e){var n=e.deletions;if(n!==null)for(var s=0;sa&&(a=l),s&=~o}if(s=a,s=lc()-s,s=(120>s?120:480>s?480:1080>s?1080:1920>s?1920:3e3>s?3e3:4320>s?4320:1960*HGe(s/1960))-s,10t?16:t,q0===null)var s=!1;else{if(t=q0,q0=null,Dee=0,Qi&6)throw Error(Sn(331));var a=Qi;for(Qi|=4,ys=t.current;ys!==null;){var o=ys,l=o.child;if(ys.flags&16){var i=o.deletions;if(i!==null){for(var h=0;hlc()-Sme?aj(t,0):Nme|=n),xh(t,e)}function PTe(t,e){e===0&&(t.mode&1?(e=V6,V6<<=1,!(V6&130023424)&&(V6=4194304)):e=1);var n=Du();t=ey(t,e),t!==null&&(sI(t,e,n),xh(t,n))}function XGe(t){var e=t.memoizedState,n=0;e!==null&&(n=e.retryLane),PTe(t,n)}function QGe(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(Sn(314))}s!==null&&s.delete(e),PTe(t,n)}var LTe;LTe=function(t,e,n){if(t!==null)if(t.memoizedProps!==e.pendingProps||mh.current)hh=!0;else{if(!(t.lanes&n)&&!(e.flags&128))return hh=!1,zGe(t,e,n);hh=!!(t.flags&131072)}else hh=!1,kl&&e.flags&1048576&&FMe(e,Cee,e.index);switch(e.lanes=0,e.tag){case 2:var s=e.type;dO(t,e),t=e.pendingProps;var a=YS(e,du.current);K4(e,n),a=vme(null,e,s,t,a,n);var o=_me();return e.flags|=1,typeof a=="object"&&a!==null&&typeof a.render=="function"&&a.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,gh(s)?(o=!0,Nee(e)):o=!1,e.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,pme(e),a.updater=gne,e.stateNode=a,a._reactInternals=e,Vde(e,s,t,n),e=Gde(null,e,s,!0,o,n)):(e.tag=0,kl&&o&&ome(e),Mu(null,e,a,n),e=e.child),e;case 16:s=e.elementType;e:{switch(dO(t,e),t=e.pendingProps,a=s._init,s=a(s._payload),e.type=s,a=e.tag=eKe(s),t=Hp(s,t),a){case 0:e=Wde(null,e,s,t,n);break e;case 1:e=kbe(null,e,s,t,n);break e;case 11:e=wbe(null,e,s,t,n);break e;case 14:e=jbe(null,e,s,Hp(s.type,t),n);break e}throw Error(Sn(306,s,""))}return e;case 0:return s=e.type,a=e.pendingProps,a=e.elementType===s?a:Hp(s,a),Wde(t,e,s,a,n);case 1:return s=e.type,a=e.pendingProps,a=e.elementType===s?a:Hp(s,a),kbe(t,e,s,a,n);case 3:e:{if(xTe(e),t===null)throw Error(Sn(387));s=e.pendingProps,o=e.memoizedState,a=o.element,VMe(t,e),Aee(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=eC(Error(Sn(423)),e),e=Nbe(t,e,s,n,a);break e}else if(s!==a){a=eC(Error(Sn(424)),e),e=Nbe(t,e,s,n,a);break e}else for(Yh=t1(e.stateNode.containerInfo.firstChild),Xh=e,kl=!0,Jp=null,n=UMe(e,null,s,n),e.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(XS(),s===a){e=ty(t,e,n);break e}Mu(t,e,s,n)}e=e.child}return e;case 5:return HMe(e),t===null&&$de(e),s=e.type,a=e.pendingProps,o=t!==null?t.memoizedProps:null,l=a.children,Dde(s,a)?l=null:o!==null&&Dde(s,o)&&(e.flags|=32),gTe(t,e),Mu(t,e,l,n),e.child;case 6:return t===null&&$de(e),null;case 13:return yTe(t,e,n);case 4:return mme(e,e.stateNode.containerInfo),s=e.pendingProps,t===null?e.child=QS(e,null,s,n):Mu(t,e,s,n),e.child;case 11:return s=e.type,a=e.pendingProps,a=e.elementType===s?a:Hp(s,a),wbe(t,e,s,a,n);case 7:return Mu(t,e,e.pendingProps,n),e.child;case 8:return Mu(t,e,e.pendingProps.children,n),e.child;case 12:return Mu(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,Yo(Mee,s._currentValue),s._currentValue=l,o!==null)if(vm(o.value,l)){if(o.children===a.children&&!mh.current){e=ty(t,e,n);break e}}else for(o=e.child,o!==null&&(o.return=e);o!==null;){var i=o.dependencies;if(i!==null){l=o.child;for(var h=i.firstContext;h!==null;){if(h.context===s){if(o.tag===1){h=Fx(-1,n&-n),h.tag=2;var p=o.updateQueue;if(p!==null){p=p.shared;var x=p.pending;x===null?h.next=h:(h.next=x.next,x.next=h),p.pending=h}}o.lanes|=n,h=o.alternate,h!==null&&(h.lanes|=n),Ude(o.return,n,e),i.lanes|=n;break}h=h.next}}else if(o.tag===10)l=o.type===e.type?null:o.child;else if(o.tag===18){if(l=o.return,l===null)throw Error(Sn(341));l.lanes|=n,i=l.alternate,i!==null&&(i.lanes|=n),Ude(l,n,e),l=o.sibling}else l=o.child;if(l!==null)l.return=o;else for(l=o;l!==null;){if(l===e){l=null;break}if(o=l.sibling,o!==null){o.return=l.return,l=o;break}l=l.return}o=l}Mu(t,e,a.children,n),e=e.child}return e;case 9:return a=e.type,s=e.pendingProps.children,K4(e,n),a=rp(a),s=s(a),e.flags|=1,Mu(t,e,s,n),e.child;case 14:return s=e.type,a=Hp(s,e.pendingProps),a=Hp(s.type,a),jbe(t,e,s,a,n);case 15:return pTe(t,e,e.type,e.pendingProps,n);case 17:return s=e.type,a=e.pendingProps,a=e.elementType===s?a:Hp(s,a),dO(t,e),e.tag=1,gh(s)?(t=!0,Nee(e)):t=!1,K4(e,n),uTe(e,s,a),Vde(e,s,a,n),Gde(null,e,s,!0,t,n);case 19:return vTe(t,e,n);case 22:return mTe(t,e,n)}throw Error(Sn(156,e.tag))};function OTe(t,e){return lMe(t,e)}function JGe(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 Vf(t,e,n,s){return new JGe(t,e,n,s)}function Ame(t){return t=t.prototype,!(!t||!t.isReactComponent)}function eKe(t){if(typeof t=="function")return Ame(t)?1:0;if(t!=null){if(t=t.$$typeof,t===Zpe)return 11;if(t===Ype)return 14}return 2}function a1(t,e){var n=t.alternate;return n===null?(n=Vf(t.tag,e,t.key,t.mode),n.elementType=t.elementType,n.type=t.type,n.stateNode=t.stateNode,n.alternate=t,t.alternate=n):(n.pendingProps=e,n.type=t.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=t.flags&14680064,n.childLanes=t.childLanes,n.lanes=t.lanes,n.child=t.child,n.memoizedProps=t.memoizedProps,n.memoizedState=t.memoizedState,n.updateQueue=t.updateQueue,e=t.dependencies,n.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},n.sibling=t.sibling,n.index=t.index,n.ref=t.ref,n}function fO(t,e,n,s,a,o){var l=2;if(s=t,typeof t=="function")Ame(t)&&(l=1);else if(typeof t=="string")l=5;else e:switch(t){case N4:return ij(n.children,a,o,e);case Kpe:l=8,a|=8;break;case pde:return t=Vf(12,n,e,a|2),t.elementType=pde,t.lanes=o,t;case mde:return t=Vf(13,n,e,a),t.elementType=mde,t.lanes=o,t;case gde:return t=Vf(19,n,e,a),t.elementType=gde,t.lanes=o,t;case H5e:return vne(n,a,o,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case q5e:l=10;break e;case V5e:l=9;break e;case Zpe:l=11;break e;case Ype:l=14;break e;case f0:l=16,s=null;break e}throw Error(Sn(130,t==null?t:typeof t,""))}return e=Vf(l,n,e,a),e.elementType=t,e.type=s,e.lanes=o,e}function ij(t,e,n,s){return t=Vf(7,t,s,e),t.lanes=n,t}function vne(t,e,n,s){return t=Vf(22,t,s,e),t.elementType=H5e,t.lanes=n,t.stateNode={isHidden:!1},t}function dle(t,e,n){return t=Vf(6,t,null,e),t.lanes=n,t}function ule(t,e,n){return e=Vf(4,t.children!==null?t.children:[],t.key,e),e.lanes=n,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function tKe(t,e,n,s,a){this.tag=e,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Hoe(0),this.expirationTimes=Hoe(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Hoe(0),this.identifierPrefix=s,this.onRecoverableError=a,this.mutableSourceEagerHydrationData=null}function Eme(t,e,n,s,a,o,l,i,h){return t=new tKe(t,e,n,i,h),e===1?(e=1,o===!0&&(e|=8)):e=0,o=Vf(3,null,null,e),t.current=o,o.stateNode=t,o.memoizedState={element:s,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},pme(o),t}function rKe(t,e,n){var s=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(zTe)}catch(t){console.error(t)}}zTe(),z5e.exports=hf;var uy=z5e.exports;const Ome=Hi(uy);var BTe,Rbe=uy;BTe=Rbe.createRoot,Rbe.hydrateRoot;const oKe=1,lKe=1e6;let hle=0;function cKe(){return hle=(hle+1)%Number.MAX_SAFE_INTEGER,hle.toString()}const fle=new Map,Fbe=t=>{if(fle.has(t))return;const e=setTimeout(()=>{fle.delete(t),jT({type:"REMOVE_TOAST",toastId:t})},lKe);fle.set(t,e)},dKe=(t,e)=>{switch(e.type){case"ADD_TOAST":return{...t,toasts:[e.toast,...t.toasts].slice(0,oKe)};case"UPDATE_TOAST":return{...t,toasts:t.toasts.map(n=>n.id===e.toast.id?{...n,...e.toast}:n)};case"DISMISS_TOAST":{const{toastId:n}=e;return n?Fbe(n):t.toasts.forEach(s=>{Fbe(s.id)}),{...t,toasts:t.toasts.map(s=>s.id===n||n===void 0?{...s,open:!1}:s)}}case"REMOVE_TOAST":return e.toastId===void 0?{...t,toasts:[]}:{...t,toasts:t.toasts.filter(n=>n.id!==e.toastId)}}},pO=[];let mO={toasts:[]};function jT(t){mO=dKe(mO,t),pO.forEach(e=>{e(mO)})}function ma({...t}){const e=cKe(),n=a=>jT({type:"UPDATE_TOAST",toast:{...a,id:e}}),s=()=>jT({type:"DISMISS_TOAST",toastId:e});return jT({type:"ADD_TOAST",toast:{...t,id:e,open:!0,onOpenChange:a=>{a||s()}}}),{id:e,dismiss:s,update:n}}function fi(){const[t,e]=I.useState(mO);return I.useEffect(()=>(pO.push(e),()=>{const n=pO.indexOf(e);n>-1&&pO.splice(n,1)}),[t]),{...t,toast:ma,dismiss:n=>jT({type:"DISMISS_TOAST",toastId:n})}}function an(t,e,{checkForDefaultPrevented:n=!0}={}){return function(a){if(t==null||t(a),n===!1||!a.defaultPrevented)return e==null?void 0:e(a)}}function zbe(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function ry(...t){return e=>{let n=!1;const s=t.map(a=>{const o=zbe(a,e);return!n&&typeof o=="function"&&(n=!0),o});if(n)return()=>{for(let a=0;a{const{children:l,...i}=o,h=I.useMemo(()=>i,Object.values(i));return r.jsx(n.Provider,{value:h,children:l})};s.displayName=t+"Provider";function a(o){const l=I.useContext(n);if(l)return l;if(e!==void 0)return e;throw new Error(`\`${o}\` must be used within \`${t}\``)}return[s,a]}function tc(t,e=[]){let n=[];function s(o,l){const i=I.createContext(l),h=n.length;n=[...n,l];const p=y=>{var E;const{scope:b,children:j,...C}=y,N=((E=b==null?void 0:b[t])==null?void 0:E[h])||i,A=I.useMemo(()=>C,Object.values(C));return r.jsx(N.Provider,{value:A,children:j})};p.displayName=o+"Provider";function x(y,b){var N;const j=((N=b==null?void 0:b[t])==null?void 0:N[h])||i,C=I.useContext(j);if(C)return C;if(l!==void 0)return l;throw new Error(`\`${y}\` must be used within \`${o}\``)}return[p,x]}const a=()=>{const o=n.map(l=>I.createContext(l));return function(i){const h=(i==null?void 0:i[t])||o;return I.useMemo(()=>({[`__scope${t}`]:{...i,[t]:h}}),[i,h])}};return a.scopeName=t,[s,hKe(a,...e)]}function hKe(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const s=t.map(a=>({useScope:a(),scopeName:a.scopeName}));return function(o){const l=s.reduce((i,{useScope:h,scopeName:p})=>{const y=h(o)[`__scope${p}`];return{...i,...y}},{});return I.useMemo(()=>({[`__scope${e.scopeName}`]:l}),[l])}};return n.scopeName=e.scopeName,n}function D1(t){const e=fKe(t),n=I.forwardRef((s,a)=>{const{children:o,...l}=s,i=I.Children.toArray(o),h=i.find(pKe);if(h){const p=h.props.children,x=i.map(y=>y===h?I.Children.count(p)>1?I.Children.only(null):I.isValidElement(p)?p.props.children:null:y);return r.jsx(e,{...l,ref:a,children:I.isValidElement(p)?I.cloneElement(p,void 0,x):null})}return r.jsx(e,{...l,ref:a,children:o})});return n.displayName=`${t}.Slot`,n}var Dme=D1("Slot");function fKe(t){const e=I.forwardRef((n,s)=>{const{children:a,...o}=n;if(I.isValidElement(a)){const l=gKe(a),i=mKe(o,a.props);return a.type!==I.Fragment&&(i.ref=s?ry(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 $Te=Symbol("radix.slottable");function UTe(t){const e=({children:n})=>r.jsx(r.Fragment,{children:n});return e.displayName=`${t}.Slottable`,e.__radixId=$Te,e}function pKe(t){return I.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===$Te}function mKe(t,e){const n={...e};for(const s in e){const a=t[s],o=e[s];/^on[A-Z]/.test(s)?a&&o?n[s]=(...i)=>{const h=o(...i);return a(...i),h}:a&&(n[s]=a):s==="style"?n[s]={...a,...o}:s==="className"&&(n[s]=[a,o].filter(Boolean).join(" "))}return{...t,...n}}function gKe(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 lI(t){const e=t+"CollectionProvider",[n,s]=tc(e),[a,o]=n(e,{collectionRef:{current:null},itemMap:new Map}),l=N=>{const{scope:A,children:E}=N,T=st.useRef(null),L=st.useRef(new Map).current;return r.jsx(a,{scope:A,itemMap:L,collectionRef:T,children:E})};l.displayName=e;const i=t+"CollectionSlot",h=D1(i),p=st.forwardRef((N,A)=>{const{scope:E,children:T}=N,L=o(i,E),z=ta(A,L.collectionRef);return r.jsx(h,{ref:z,children:T})});p.displayName=i;const x=t+"CollectionItemSlot",y="data-radix-collection-item",b=D1(x),j=st.forwardRef((N,A)=>{const{scope:E,children:T,...L}=N,z=st.useRef(null),F=ta(A,z),q=o(x,E);return st.useEffect(()=>(q.itemMap.set(z,{ref:z,...L}),()=>void q.itemMap.delete(z))),r.jsx(b,{[y]:"",ref:F,children:T})});j.displayName=x;function C(N){const A=o(t+"CollectionConsumer",N);return st.useCallback(()=>{const T=A.collectionRef.current;if(!T)return[];const L=Array.from(T.querySelectorAll(`[${y}]`));return Array.from(A.itemMap.values()).sort((q,H)=>L.indexOf(q.ref.current)-L.indexOf(H.ref.current))},[A.collectionRef,A.itemMap])}return[{Provider:l,Slot:p,ItemSlot:j},C,s]}var xKe=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Rn=xKe.reduce((t,e)=>{const n=D1(`Primitive.${e}`),s=I.forwardRef((a,o)=>{const{asChild:l,...i}=a,h=l?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),r.jsx(h,{...i,ref:o})});return s.displayName=`Primitive.${e}`,{...t,[e]:s}},{});function Rme(t,e){t&&uy.flushSync(()=>t.dispatchEvent(e))}function Xl(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 yKe(t,e=globalThis==null?void 0:globalThis.document){const n=Xl(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 vKe="DismissableLayer",aue="dismissableLayer.update",_Ke="dismissableLayer.pointerDownOutside",bKe="dismissableLayer.focusOutside",Bbe,qTe=I.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),ev=I.forwardRef((t,e)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:s,onPointerDownOutside:a,onFocusOutside:o,onInteractOutside:l,onDismiss:i,...h}=t,p=I.useContext(qTe),[x,y]=I.useState(null),b=(x==null?void 0:x.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,j]=I.useState({}),C=ta(e,H=>y(H)),N=Array.from(p.layers),[A]=[...p.layersWithOutsidePointerEventsDisabled].slice(-1),E=N.indexOf(A),T=x?N.indexOf(x):-1,L=p.layersWithOutsidePointerEventsDisabled.size>0,z=T>=E,F=jKe(H=>{const Z=H.target,G=[...p.branches].some(te=>te.contains(Z));!z||G||(a==null||a(H),l==null||l(H),H.defaultPrevented||i==null||i())},b),q=kKe(H=>{const Z=H.target;[...p.branches].some(te=>te.contains(Z))||(o==null||o(H),l==null||l(H),H.defaultPrevented||i==null||i())},b);return yKe(H=>{T===p.layers.size-1&&(s==null||s(H),!H.defaultPrevented&&i&&(H.preventDefault(),i()))},b),I.useEffect(()=>{if(x)return n&&(p.layersWithOutsidePointerEventsDisabled.size===0&&(Bbe=b.body.style.pointerEvents,b.body.style.pointerEvents="none"),p.layersWithOutsidePointerEventsDisabled.add(x)),p.layers.add(x),$be(),()=>{n&&p.layersWithOutsidePointerEventsDisabled.size===1&&(b.body.style.pointerEvents=Bbe)}},[x,b,n,p]),I.useEffect(()=>()=>{x&&(p.layers.delete(x),p.layersWithOutsidePointerEventsDisabled.delete(x),$be())},[x,p]),I.useEffect(()=>{const H=()=>j({});return document.addEventListener(aue,H),()=>document.removeEventListener(aue,H)},[]),r.jsx(Rn.div,{...h,ref:C,style:{pointerEvents:L?z?"auto":"none":void 0,...t.style},onFocusCapture:an(t.onFocusCapture,q.onFocusCapture),onBlurCapture:an(t.onBlurCapture,q.onBlurCapture),onPointerDownCapture:an(t.onPointerDownCapture,F.onPointerDownCapture)})});ev.displayName=vKe;var wKe="DismissableLayerBranch",VTe=I.forwardRef((t,e)=>{const n=I.useContext(qTe),s=I.useRef(null),a=ta(e,s);return I.useEffect(()=>{const o=s.current;if(o)return n.branches.add(o),()=>{n.branches.delete(o)}},[n.branches]),r.jsx(Rn.div,{...t,ref:a})});VTe.displayName=wKe;function jKe(t,e=globalThis==null?void 0:globalThis.document){const n=Xl(t),s=I.useRef(!1),a=I.useRef(()=>{});return I.useEffect(()=>{const o=i=>{if(i.target&&!s.current){let h=function(){HTe(_Ke,n,p,{discrete:!0})};const p={originalEvent:i};i.pointerType==="touch"?(e.removeEventListener("click",a.current),a.current=h,e.addEventListener("click",a.current,{once:!0})):h()}else e.removeEventListener("click",a.current);s.current=!1},l=window.setTimeout(()=>{e.addEventListener("pointerdown",o)},0);return()=>{window.clearTimeout(l),e.removeEventListener("pointerdown",o),e.removeEventListener("click",a.current)}},[e,n]),{onPointerDownCapture:()=>s.current=!0}}function kKe(t,e=globalThis==null?void 0:globalThis.document){const n=Xl(t),s=I.useRef(!1);return I.useEffect(()=>{const a=o=>{o.target&&!s.current&&HTe(bKe,n,{originalEvent:o},{discrete:!1})};return e.addEventListener("focusin",a),()=>e.removeEventListener("focusin",a)},[e,n]),{onFocusCapture:()=>s.current=!0,onBlurCapture:()=>s.current=!1}}function $be(){const t=new CustomEvent(aue);document.dispatchEvent(t)}function HTe(t,e,n,{discrete:s}){const a=n.originalEvent.target,o=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:n});e&&a.addEventListener(t,e,{once:!0}),s?Rme(a,o):a.dispatchEvent(o)}var NKe=ev,SKe=VTe,Jl=globalThis!=null&&globalThis.document?I.useLayoutEffect:()=>{},CKe="Portal",GC=I.forwardRef((t,e)=>{var i;const{container:n,...s}=t,[a,o]=I.useState(!1);Jl(()=>o(!0),[]);const l=n||a&&((i=globalThis==null?void 0:globalThis.document)==null?void 0:i.body);return l?Ome.createPortal(r.jsx(Rn.div,{...s,ref:e}),l):null});GC.displayName=CKe;function MKe(t,e){return I.useReducer((n,s)=>e[n][s]??n,t)}var gc=t=>{const{present:e,children:n}=t,s=TKe(e),a=typeof n=="function"?n({present:s.isPresent}):I.Children.only(n),o=ta(s.ref,AKe(a));return typeof n=="function"||s.isPresent?I.cloneElement(a,{ref:o}):null};gc.displayName="Presence";function TKe(t){const[e,n]=I.useState(),s=I.useRef(null),a=I.useRef(t),o=I.useRef("none"),l=t?"mounted":"unmounted",[i,h]=MKe(l,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return I.useEffect(()=>{const p=rL(s.current);o.current=i==="mounted"?p:"none"},[i]),Jl(()=>{const p=s.current,x=a.current;if(x!==t){const b=o.current,j=rL(p);t?h("MOUNT"):j==="none"||(p==null?void 0:p.display)==="none"?h("UNMOUNT"):h(x&&b!==j?"ANIMATION_OUT":"UNMOUNT"),a.current=t}},[t,h]),Jl(()=>{if(e){let p;const x=e.ownerDocument.defaultView??window,y=j=>{const N=rL(s.current).includes(j.animationName);if(j.target===e&&N&&(h("ANIMATION_END"),!a.current)){const A=e.style.animationFillMode;e.style.animationFillMode="forwards",p=x.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=A)})}},b=j=>{j.target===e&&(o.current=rL(s.current))};return e.addEventListener("animationstart",b),e.addEventListener("animationcancel",y),e.addEventListener("animationend",y),()=>{x.clearTimeout(p),e.removeEventListener("animationstart",b),e.removeEventListener("animationcancel",y),e.removeEventListener("animationend",y)}}else h("ANIMATION_END")},[e,h]),{isPresent:["mounted","unmountSuspended"].includes(i),ref:I.useCallback(p=>{s.current=p?getComputedStyle(p):null,n(p)},[])}}function rL(t){return(t==null?void 0:t.animationName)||"none"}function AKe(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 EKe=Vpe[" useInsertionEffect ".trim().toString()]||Jl;function Fu({prop:t,defaultProp:e,onChange:n=()=>{},caller:s}){const[a,o,l]=IKe({defaultProp:e,onChange:n}),i=t!==void 0,h=i?t:a;{const x=I.useRef(t!==void 0);I.useEffect(()=>{const y=x.current;y!==i&&console.warn(`${s} is changing from ${y?"controlled":"uncontrolled"} to ${i?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),x.current=i},[i,s])}const p=I.useCallback(x=>{var y;if(i){const b=PKe(x)?x(t):x;b!==t&&((y=l.current)==null||y.call(l,b))}else o(x)},[i,t,o,l]);return[h,p]}function IKe({defaultProp:t,onChange:e}){const[n,s]=I.useState(t),a=I.useRef(n),o=I.useRef(e);return EKe(()=>{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 PKe(t){return typeof t=="function"}var WTe=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"}),LKe="VisuallyHidden",kne=I.forwardRef((t,e)=>r.jsx(Rn.span,{...t,ref:e,style:{...WTe,...t.style}}));kne.displayName=LKe;var OKe=kne,Fme="ToastProvider",[zme,DKe,RKe]=lI("Toast"),[GTe]=tc("Toast",[RKe]),[FKe,Nne]=GTe(Fme),KTe=t=>{const{__scopeToast:e,label:n="Notification",duration:s=5e3,swipeDirection:a="right",swipeThreshold:o=50,children:l}=t,[i,h]=I.useState(null),[p,x]=I.useState(0),y=I.useRef(!1),b=I.useRef(!1);return n.trim()||console.error(`Invalid prop \`label\` supplied to \`${Fme}\`. Expected non-empty \`string\`.`),r.jsx(zme.Provider,{scope:e,children:r.jsx(FKe,{scope:e,label:n,duration:s,swipeDirection:a,swipeThreshold:o,toastCount:p,viewport:i,onViewportChange:h,onToastAdd:I.useCallback(()=>x(j=>j+1),[]),onToastRemove:I.useCallback(()=>x(j=>j-1),[]),isFocusedToastEscapeKeyDownRef:y,isClosePausedRef:b,children:l})})};KTe.displayName=Fme;var ZTe="ToastViewport",zKe=["F8"],iue="toast.viewportPause",oue="toast.viewportResume",YTe=I.forwardRef((t,e)=>{const{__scopeToast:n,hotkey:s=zKe,label:a="Notifications ({hotkey})",...o}=t,l=Nne(ZTe,n),i=DKe(n),h=I.useRef(null),p=I.useRef(null),x=I.useRef(null),y=I.useRef(null),b=ta(e,y,l.onViewportChange),j=s.join("+").replace(/Key/g,"").replace(/Digit/g,""),C=l.toastCount>0;I.useEffect(()=>{const A=E=>{var L;s.length!==0&&s.every(z=>E[z]||E.code===z)&&((L=y.current)==null||L.focus())};return document.addEventListener("keydown",A),()=>document.removeEventListener("keydown",A)},[s]),I.useEffect(()=>{const A=h.current,E=y.current;if(C&&A&&E){const T=()=>{if(!l.isClosePausedRef.current){const q=new CustomEvent(iue);E.dispatchEvent(q),l.isClosePausedRef.current=!0}},L=()=>{if(l.isClosePausedRef.current){const q=new CustomEvent(oue);E.dispatchEvent(q),l.isClosePausedRef.current=!1}},z=q=>{!A.contains(q.relatedTarget)&&L()},F=()=>{A.contains(document.activeElement)||L()};return A.addEventListener("focusin",T),A.addEventListener("focusout",z),A.addEventListener("pointermove",T),A.addEventListener("pointerleave",F),window.addEventListener("blur",T),window.addEventListener("focus",L),()=>{A.removeEventListener("focusin",T),A.removeEventListener("focusout",z),A.removeEventListener("pointermove",T),A.removeEventListener("pointerleave",F),window.removeEventListener("blur",T),window.removeEventListener("focus",L)}}},[C,l.isClosePausedRef]);const N=I.useCallback(({tabbingDirection:A})=>{const T=i().map(L=>{const z=L.ref.current,F=[z,...QKe(z)];return A==="forwards"?F:F.reverse()});return(A==="forwards"?T.reverse():T).flat()},[i]);return I.useEffect(()=>{const A=y.current;if(A){const E=T=>{var F,q,H;const L=T.altKey||T.ctrlKey||T.metaKey;if(T.key==="Tab"&&!L){const Z=document.activeElement,G=T.shiftKey;if(T.target===A&&G){(F=p.current)==null||F.focus();return}const le=N({tabbingDirection:G?"backwards":"forwards"}),ye=le.findIndex(ne=>ne===Z);ple(le.slice(ye+1))?T.preventDefault():G?(q=p.current)==null||q.focus():(H=x.current)==null||H.focus()}};return A.addEventListener("keydown",E),()=>A.removeEventListener("keydown",E)}},[i,N]),r.jsxs(SKe,{ref:h,role:"region","aria-label":a.replace("{hotkey}",j),tabIndex:-1,style:{pointerEvents:C?void 0:"none"},children:[C&&r.jsx(lue,{ref:p,onFocusFromOutsideViewport:()=>{const A=N({tabbingDirection:"forwards"});ple(A)}}),r.jsx(zme.Slot,{scope:n,children:r.jsx(Rn.ol,{tabIndex:-1,...o,ref:b})}),C&&r.jsx(lue,{ref:x,onFocusFromOutsideViewport:()=>{const A=N({tabbingDirection:"backwards"});ple(A)}})]})});YTe.displayName=ZTe;var XTe="ToastFocusProxy",lue=I.forwardRef((t,e)=>{const{__scopeToast:n,onFocusFromOutsideViewport:s,...a}=t,o=Nne(XTe,n);return r.jsx(kne,{"aria-hidden":!0,tabIndex:0,...a,ref:e,style:{position:"fixed"},onFocus:l=>{var p;const i=l.relatedTarget;!((p=o.viewport)!=null&&p.contains(i))&&s()}})});lue.displayName=XTe;var cI="Toast",BKe="toast.swipeStart",$Ke="toast.swipeMove",UKe="toast.swipeCancel",qKe="toast.swipeEnd",QTe=I.forwardRef((t,e)=>{const{forceMount:n,open:s,defaultOpen:a,onOpenChange:o,...l}=t,[i,h]=Fu({prop:s,defaultProp:a??!0,onChange:o,caller:cI});return r.jsx(gc,{present:n||i,children:r.jsx(WKe,{open:i,...l,ref:e,onClose:()=>h(!1),onPause:Xl(t.onPause),onResume:Xl(t.onResume),onSwipeStart:an(t.onSwipeStart,p=>{p.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:an(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:an(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:an(t.onSwipeEnd,p=>{const{x,y}=p.detail.delta;p.currentTarget.setAttribute("data-swipe","end"),p.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),p.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),p.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${x}px`),p.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${y}px`),h(!1)})})})});QTe.displayName=cI;var[VKe,HKe]=GTe(cI,{onClose(){}}),WKe=I.forwardRef((t,e)=>{const{__scopeToast:n,type:s="foreground",duration:a,open:o,onClose:l,onEscapeKeyDown:i,onPause:h,onResume:p,onSwipeStart:x,onSwipeMove:y,onSwipeCancel:b,onSwipeEnd:j,...C}=t,N=Nne(cI,n),[A,E]=I.useState(null),T=ta(e,ne=>E(ne)),L=I.useRef(null),z=I.useRef(null),F=a||N.duration,q=I.useRef(0),H=I.useRef(F),Z=I.useRef(0),{onToastAdd:G,onToastRemove:te}=N,ie=Xl(()=>{var ge;(A==null?void 0:A.contains(document.activeElement))&&((ge=N.viewport)==null||ge.focus()),l()}),le=I.useCallback(ne=>{!ne||ne===1/0||(window.clearTimeout(Z.current),q.current=new Date().getTime(),Z.current=window.setTimeout(ie,ne))},[ie]);I.useEffect(()=>{const ne=N.viewport;if(ne){const ge=()=>{le(H.current),p==null||p()},ae=()=>{const he=new Date().getTime()-q.current;H.current=H.current-he,window.clearTimeout(Z.current),h==null||h()};return ne.addEventListener(iue,ae),ne.addEventListener(oue,ge),()=>{ne.removeEventListener(iue,ae),ne.removeEventListener(oue,ge)}}},[N.viewport,F,h,p,le]),I.useEffect(()=>{o&&!N.isClosePausedRef.current&&le(F)},[o,F,N.isClosePausedRef,le]),I.useEffect(()=>(G(),()=>te()),[G,te]);const ye=I.useMemo(()=>A?aAe(A):null,[A]);return N.viewport?r.jsxs(r.Fragment,{children:[ye&&r.jsx(GKe,{__scopeToast:n,role:"status","aria-live":s==="foreground"?"assertive":"polite","aria-atomic":!0,children:ye}),r.jsx(VKe,{scope:n,onClose:ie,children:uy.createPortal(r.jsx(zme.ItemSlot,{scope:n,children:r.jsx(NKe,{asChild:!0,onEscapeKeyDown:an(i,()=>{N.isFocusedToastEscapeKeyDownRef.current||ie(),N.isFocusedToastEscapeKeyDownRef.current=!1}),children:r.jsx(Rn.li,{role:"status","aria-live":"off","aria-atomic":!0,tabIndex:0,"data-state":o?"open":"closed","data-swipe-direction":N.swipeDirection,...C,ref:T,style:{userSelect:"none",touchAction:"none",...t.style},onKeyDown:an(t.onKeyDown,ne=>{ne.key==="Escape"&&(i==null||i(ne.nativeEvent),ne.nativeEvent.defaultPrevented||(N.isFocusedToastEscapeKeyDownRef.current=!0,ie()))}),onPointerDown:an(t.onPointerDown,ne=>{ne.button===0&&(L.current={x:ne.clientX,y:ne.clientY})}),onPointerMove:an(t.onPointerMove,ne=>{if(!L.current)return;const ge=ne.clientX-L.current.x,ae=ne.clientY-L.current.y,he=!!z.current,ue=["left","right"].includes(N.swipeDirection),_e=["left","up"].includes(N.swipeDirection)?Math.min:Math.max,Ae=ue?_e(0,ge):0,Ce=ue?0:_e(0,ae),be=ne.pointerType==="touch"?10:2,me={x:Ae,y:Ce},Le={originalEvent:ne,delta:me};he?(z.current=me,nL($Ke,y,Le,{discrete:!1})):Ube(me,N.swipeDirection,be)?(z.current=me,nL(BKe,x,Le,{discrete:!1}),ne.target.setPointerCapture(ne.pointerId)):(Math.abs(ge)>be||Math.abs(ae)>be)&&(L.current=null)}),onPointerUp:an(t.onPointerUp,ne=>{const ge=z.current,ae=ne.target;if(ae.hasPointerCapture(ne.pointerId)&&ae.releasePointerCapture(ne.pointerId),z.current=null,L.current=null,ge){const he=ne.currentTarget,ue={originalEvent:ne,delta:ge};Ube(ge,N.swipeDirection,N.swipeThreshold)?nL(qKe,j,ue,{discrete:!0}):nL(UKe,b,ue,{discrete:!0}),he.addEventListener("click",_e=>_e.preventDefault(),{once:!0})}})})})}),N.viewport)})]}):null}),GKe=t=>{const{__scopeToast:e,children:n,...s}=t,a=Nne(cI,e),[o,l]=I.useState(!1),[i,h]=I.useState(!1);return YKe(()=>l(!0)),I.useEffect(()=>{const p=window.setTimeout(()=>h(!0),1e3);return()=>window.clearTimeout(p)},[]),i?null:r.jsx(GC,{asChild:!0,children:r.jsx(kne,{...s,children:o&&r.jsxs(r.Fragment,{children:[a.label," ",n]})})})},KKe="ToastTitle",JTe=I.forwardRef((t,e)=>{const{__scopeToast:n,...s}=t;return r.jsx(Rn.div,{...s,ref:e})});JTe.displayName=KKe;var ZKe="ToastDescription",eAe=I.forwardRef((t,e)=>{const{__scopeToast:n,...s}=t;return r.jsx(Rn.div,{...s,ref:e})});eAe.displayName=ZKe;var tAe="ToastAction",rAe=I.forwardRef((t,e)=>{const{altText:n,...s}=t;return n.trim()?r.jsx(sAe,{altText:n,asChild:!0,children:r.jsx(Bme,{...s,ref:e})}):(console.error(`Invalid prop \`altText\` supplied to \`${tAe}\`. Expected non-empty \`string\`.`),null)});rAe.displayName=tAe;var nAe="ToastClose",Bme=I.forwardRef((t,e)=>{const{__scopeToast:n,...s}=t,a=HKe(nAe,n);return r.jsx(sAe,{asChild:!0,children:r.jsx(Rn.button,{type:"button",...s,ref:e,onClick:an(t.onClick,a.onClose)})})});Bme.displayName=nAe;var sAe=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 aAe(t){const e=[];return Array.from(t.childNodes).forEach(s=>{if(s.nodeType===s.TEXT_NODE&&s.textContent&&e.push(s.textContent),XKe(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(...aAe(s))}}),e}function nL(t,e,n,{discrete:s}){const a=n.originalEvent.currentTarget,o=new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:n});e&&a.addEventListener(t,e,{once:!0}),s?Rme(a,o):a.dispatchEvent(o)}var Ube=(t,e,n=0)=>{const s=Math.abs(t.x),a=Math.abs(t.y),o=s>a;return e==="left"||e==="right"?o&&s>n:!o&&a>n};function YKe(t=()=>{}){const e=Xl(t);Jl(()=>{let n=0,s=0;return n=window.requestAnimationFrame(()=>s=window.requestAnimationFrame(e)),()=>{window.cancelAnimationFrame(n),window.cancelAnimationFrame(s)}},[e])}function XKe(t){return t.nodeType===t.ELEMENT_NODE}function QKe(t){const e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:s=>{const a=s.tagName==="INPUT"&&s.type==="hidden";return s.disabled||s.hidden||a?NodeFilter.FILTER_SKIP:s.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)e.push(n.currentNode);return e}function ple(t){const e=document.activeElement;return t.some(n=>n===e?!0:(n.focus(),document.activeElement!==e))}var JKe=KTe,iAe=YTe,oAe=QTe,lAe=JTe,cAe=eAe,dAe=rAe,uAe=Bme;function hAe(t){var e,n,s="";if(typeof t=="string"||typeof t=="number")s+=t;else if(typeof t=="object")if(Array.isArray(t)){var a=t.length;for(e=0;etypeof t=="boolean"?`${t}`:t===0?"0":t,Vbe=si,KC=(t,e)=>n=>{var s;if((e==null?void 0:e.variants)==null)return Vbe(t,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:a,defaultVariants:o}=e,l=Object.keys(a).map(p=>{const x=n==null?void 0:n[p],y=o==null?void 0:o[p];if(x===null)return null;const b=qbe(x)||qbe(y);return a[p][b]}),i=n&&Object.entries(n).reduce((p,x)=>{let[y,b]=x;return b===void 0||(p[y]=b),p},{}),h=e==null||(s=e.compoundVariants)===null||s===void 0?void 0:s.reduce((p,x)=>{let{class:y,className:b,...j}=x;return Object.entries(j).every(C=>{let[N,A]=C;return Array.isArray(A)?A.includes({...o,...i}[N]):{...o,...i}[N]===A})?[...p,y,b]:p},[]);return Vbe(t,l,h,n==null?void 0:n.class,n==null?void 0:n.className)};/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const eZe=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),fAe=(...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 tZe={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 pAe=I.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:n=2,absoluteStrokeWidth:s,className:a="",children:o,iconNode:l,...i},h)=>I.createElement("svg",{ref:h,...tZe,width:e,height:e,stroke:t,strokeWidth:s?Number(n)*24/Number(e):n,className:fAe("lucide",a),...i},[...l.map(([p,x])=>I.createElement(p,x)),...Array.isArray(o)?o:[o]]));/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const U=(t,e)=>{const n=I.forwardRef(({className:s,...a},o)=>I.createElement(pAe,{ref:o,iconNode:e,className:fAe(`lucide-${eZe(t)}`,s),...a}));return n.displayName=`${t}`,n};/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gO=U("AArrowDown",[["path",{d:"M3.5 13h6",key:"p1my2r"}],["path",{d:"m2 16 4.5-9 4.5 9",key:"ndf0b3"}],["path",{d:"M18 7v9",key:"pknjwm"}],["path",{d:"m14 12 4 4 4-4",key:"buelq4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xO=U("AArrowUp",[["path",{d:"M3.5 13h6",key:"p1my2r"}],["path",{d:"m2 16 4.5-9 4.5 9",key:"ndf0b3"}],["path",{d:"M18 16V7",key:"ty0viw"}],["path",{d:"m14 11 4-4 4 4",key:"1pu57t"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yO=U("ALargeSmall",[["path",{d:"M21 14h-5",key:"1vh23k"}],["path",{d:"M16 16v-3.5a2.5 2.5 0 0 1 5 0V16",key:"1wh10o"}],["path",{d:"M4.5 13h6",key:"dfilno"}],["path",{d:"m3 16 4.5-9 4.5 9",key:"2dxa0e"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vO=U("Accessibility",[["circle",{cx:"16",cy:"4",r:"1",key:"1grugj"}],["path",{d:"m18 19 1-7-6 1",key:"r0i19z"}],["path",{d:"m5 8 3-3 5.5 3-2.36 3.5",key:"9ptxx2"}],["path",{d:"M4.24 14.5a5 5 0 0 0 6.88 6",key:"10kmtu"}],["path",{d:"M13.76 17.5a5 5 0 0 0-6.88-6",key:"2qq6rc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pg=U("Activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _O=U("AirVent",[["path",{d:"M6 12H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2",key:"larmp2"}],["path",{d:"M6 8h12",key:"6g4wlu"}],["path",{d:"M18.3 17.7a2.5 2.5 0 0 1-3.16 3.83 2.53 2.53 0 0 1-1.14-2V12",key:"1bo8pg"}],["path",{d:"M6.6 15.6A2 2 0 1 0 10 17v-5",key:"t9h90c"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bO=U("Airplay",[["path",{d:"M5 17H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2h-1",key:"ns4c3b"}],["path",{d:"m12 15 5 6H7Z",key:"14qnn2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const h_=U("AlarmClockCheck",[["circle",{cx:"12",cy:"13",r:"8",key:"3y4lt7"}],["path",{d:"M5 3 2 6",key:"18tl5t"}],["path",{d:"m22 6-3-3",key:"1opdir"}],["path",{d:"M6.38 18.7 4 21",key:"17xu3x"}],["path",{d:"M17.64 18.67 20 21",key:"kv2oe2"}],["path",{d:"m9 13 2 2 4-4",key:"6343dt"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const f_=U("AlarmClockMinus",[["circle",{cx:"12",cy:"13",r:"8",key:"3y4lt7"}],["path",{d:"M5 3 2 6",key:"18tl5t"}],["path",{d:"m22 6-3-3",key:"1opdir"}],["path",{d:"M6.38 18.7 4 21",key:"17xu3x"}],["path",{d:"M17.64 18.67 20 21",key:"kv2oe2"}],["path",{d:"M9 13h6",key:"1uhe8q"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wO=U("AlarmClockOff",[["path",{d:"M6.87 6.87a8 8 0 1 0 11.26 11.26",key:"3on8tj"}],["path",{d:"M19.9 14.25a8 8 0 0 0-9.15-9.15",key:"15ghsc"}],["path",{d:"m22 6-3-3",key:"1opdir"}],["path",{d:"M6.26 18.67 4 21",key:"yzmioq"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M4 4 2 6",key:"1ycko6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const p_=U("AlarmClockPlus",[["circle",{cx:"12",cy:"13",r:"8",key:"3y4lt7"}],["path",{d:"M5 3 2 6",key:"18tl5t"}],["path",{d:"m22 6-3-3",key:"1opdir"}],["path",{d:"M6.38 18.7 4 21",key:"17xu3x"}],["path",{d:"M17.64 18.67 20 21",key:"kv2oe2"}],["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jO=U("AlarmClock",[["circle",{cx:"12",cy:"13",r:"8",key:"3y4lt7"}],["path",{d:"M12 9v4l2 2",key:"1c63tq"}],["path",{d:"M5 3 2 6",key:"18tl5t"}],["path",{d:"m22 6-3-3",key:"1opdir"}],["path",{d:"M6.38 18.7 4 21",key:"17xu3x"}],["path",{d:"M17.64 18.67 20 21",key:"kv2oe2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kO=U("AlarmSmoke",[["path",{d:"M11 21c0-2.5 2-2.5 2-5",key:"1sicvv"}],["path",{d:"M16 21c0-2.5 2-2.5 2-5",key:"1o3eny"}],["path",{d:"m19 8-.8 3a1.25 1.25 0 0 1-1.2 1H7a1.25 1.25 0 0 1-1.2-1L5 8",key:"1bvca4"}],["path",{d:"M21 3a1 1 0 0 1 1 1v2a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V4a1 1 0 0 1 1-1z",key:"x3qr1j"}],["path",{d:"M6 21c0-2.5 2-2.5 2-5",key:"i3w1gp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const NO=U("Album",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["polyline",{points:"11 3 11 11 14 8 17 11 17 3",key:"1wcwz3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const SO=U("AlignCenterHorizontal",[["path",{d:"M2 12h20",key:"9i4pu4"}],["path",{d:"M10 16v4a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2v-4",key:"11f1s0"}],["path",{d:"M10 8V4a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v4",key:"t14dx9"}],["path",{d:"M20 16v1a2 2 0 0 1-2 2h-2a2 2 0 0 1-2-2v-1",key:"1w07xs"}],["path",{d:"M14 8V7c0-1.1.9-2 2-2h2a2 2 0 0 1 2 2v1",key:"1apec2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const CO=U("AlignCenterVertical",[["path",{d:"M12 2v20",key:"t6zp3m"}],["path",{d:"M8 10H4a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h4",key:"14d6g8"}],["path",{d:"M16 10h4a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2h-4",key:"1e2lrw"}],["path",{d:"M8 20H7a2 2 0 0 1-2-2v-2c0-1.1.9-2 2-2h1",key:"1fkdwx"}],["path",{d:"M16 14h1a2 2 0 0 1 2 2v2a2 2 0 0 1-2 2h-1",key:"1euafb"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Y4=U("AlignCenter",[["path",{d:"M17 12H7",key:"16if0g"}],["path",{d:"M19 18H5",key:"18s9l3"}],["path",{d:"M21 6H3",key:"1jwq7v"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const MO=U("AlignEndHorizontal",[["rect",{width:"6",height:"16",x:"4",y:"2",rx:"2",key:"z5wdxg"}],["rect",{width:"6",height:"9",x:"14",y:"9",rx:"2",key:"um7a8w"}],["path",{d:"M22 22H2",key:"19qnx5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const TO=U("AlignEndVertical",[["rect",{width:"16",height:"6",x:"2",y:"4",rx:"2",key:"10wcwx"}],["rect",{width:"9",height:"6",x:"9",y:"14",rx:"2",key:"4p5bwg"}],["path",{d:"M22 22V2",key:"12ipfv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const AO=U("AlignHorizontalDistributeCenter",[["rect",{width:"6",height:"14",x:"4",y:"5",rx:"2",key:"1wwnby"}],["rect",{width:"6",height:"10",x:"14",y:"7",rx:"2",key:"1fe6j6"}],["path",{d:"M17 22v-5",key:"4b6g73"}],["path",{d:"M17 7V2",key:"hnrr36"}],["path",{d:"M7 22v-3",key:"1r4jpn"}],["path",{d:"M7 5V2",key:"liy1u9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const EO=U("AlignHorizontalDistributeEnd",[["rect",{width:"6",height:"14",x:"4",y:"5",rx:"2",key:"1wwnby"}],["rect",{width:"6",height:"10",x:"14",y:"7",rx:"2",key:"1fe6j6"}],["path",{d:"M10 2v20",key:"uyc634"}],["path",{d:"M20 2v20",key:"1tx262"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const IO=U("AlignHorizontalDistributeStart",[["rect",{width:"6",height:"14",x:"4",y:"5",rx:"2",key:"1wwnby"}],["rect",{width:"6",height:"10",x:"14",y:"7",rx:"2",key:"1fe6j6"}],["path",{d:"M4 2v20",key:"gtpd5x"}],["path",{d:"M14 2v20",key:"tg6bpw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const PO=U("AlignHorizontalJustifyCenter",[["rect",{width:"6",height:"14",x:"2",y:"5",rx:"2",key:"dy24zr"}],["rect",{width:"6",height:"10",x:"16",y:"7",rx:"2",key:"13zkjt"}],["path",{d:"M12 2v20",key:"t6zp3m"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const LO=U("AlignHorizontalJustifyEnd",[["rect",{width:"6",height:"14",x:"2",y:"5",rx:"2",key:"dy24zr"}],["rect",{width:"6",height:"10",x:"12",y:"7",rx:"2",key:"1ht384"}],["path",{d:"M22 2v20",key:"40qfg1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const OO=U("AlignHorizontalJustifyStart",[["rect",{width:"6",height:"14",x:"6",y:"5",rx:"2",key:"hsirpf"}],["rect",{width:"6",height:"10",x:"16",y:"7",rx:"2",key:"13zkjt"}],["path",{d:"M2 2v20",key:"1ivd8o"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const DO=U("AlignHorizontalSpaceAround",[["rect",{width:"6",height:"10",x:"9",y:"7",rx:"2",key:"yn7j0q"}],["path",{d:"M4 22V2",key:"tsjzd3"}],["path",{d:"M20 22V2",key:"1bnhr8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const RO=U("AlignHorizontalSpaceBetween",[["rect",{width:"6",height:"14",x:"3",y:"5",rx:"2",key:"j77dae"}],["rect",{width:"6",height:"10",x:"15",y:"7",rx:"2",key:"bq30hj"}],["path",{d:"M3 2v20",key:"1d2pfg"}],["path",{d:"M21 2v20",key:"p059bm"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const FO=U("AlignJustify",[["path",{d:"M3 12h18",key:"1i2n21"}],["path",{d:"M3 18h18",key:"1h113x"}],["path",{d:"M3 6h18",key:"d0wm0j"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const X4=U("AlignLeft",[["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M17 18H3",key:"1amg6g"}],["path",{d:"M21 6H3",key:"1jwq7v"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Q4=U("AlignRight",[["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M21 18H7",key:"1ygte8"}],["path",{d:"M21 6H3",key:"1jwq7v"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zO=U("AlignStartHorizontal",[["rect",{width:"6",height:"16",x:"4",y:"6",rx:"2",key:"1n4dg1"}],["rect",{width:"6",height:"9",x:"14",y:"6",rx:"2",key:"17khns"}],["path",{d:"M22 2H2",key:"fhrpnj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const BO=U("AlignStartVertical",[["rect",{width:"9",height:"6",x:"6",y:"14",rx:"2",key:"lpm2y7"}],["rect",{width:"16",height:"6",x:"6",y:"4",rx:"2",key:"rdj6ps"}],["path",{d:"M2 2v20",key:"1ivd8o"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $O=U("AlignVerticalDistributeCenter",[["path",{d:"M22 17h-3",key:"1lwga1"}],["path",{d:"M22 7h-5",key:"o2endc"}],["path",{d:"M5 17H2",key:"1gx9xc"}],["path",{d:"M7 7H2",key:"6bq26l"}],["rect",{x:"5",y:"14",width:"14",height:"6",rx:"2",key:"1qrzuf"}],["rect",{x:"7",y:"4",width:"10",height:"6",rx:"2",key:"we8e9z"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const UO=U("AlignVerticalDistributeEnd",[["rect",{width:"14",height:"6",x:"5",y:"14",rx:"2",key:"jmoj9s"}],["rect",{width:"10",height:"6",x:"7",y:"4",rx:"2",key:"aza5on"}],["path",{d:"M2 20h20",key:"owomy5"}],["path",{d:"M2 10h20",key:"1ir3d8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qO=U("AlignVerticalDistributeStart",[["rect",{width:"14",height:"6",x:"5",y:"14",rx:"2",key:"jmoj9s"}],["rect",{width:"10",height:"6",x:"7",y:"4",rx:"2",key:"aza5on"}],["path",{d:"M2 14h20",key:"myj16y"}],["path",{d:"M2 4h20",key:"mda7wb"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const VO=U("AlignVerticalJustifyCenter",[["rect",{width:"14",height:"6",x:"5",y:"16",rx:"2",key:"1i8z2d"}],["rect",{width:"10",height:"6",x:"7",y:"2",rx:"2",key:"ypihtt"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const HO=U("AlignVerticalJustifyEnd",[["rect",{width:"14",height:"6",x:"5",y:"12",rx:"2",key:"4l4tp2"}],["rect",{width:"10",height:"6",x:"7",y:"2",rx:"2",key:"ypihtt"}],["path",{d:"M2 22h20",key:"272qi7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const WO=U("AlignVerticalJustifyStart",[["rect",{width:"14",height:"6",x:"5",y:"16",rx:"2",key:"1i8z2d"}],["rect",{width:"10",height:"6",x:"7",y:"6",rx:"2",key:"13squh"}],["path",{d:"M2 2h20",key:"1ennik"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const GO=U("AlignVerticalSpaceAround",[["rect",{width:"10",height:"6",x:"7",y:"9",rx:"2",key:"b1zbii"}],["path",{d:"M22 20H2",key:"1p1f7z"}],["path",{d:"M22 4H2",key:"1b7qnq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const KO=U("AlignVerticalSpaceBetween",[["rect",{width:"14",height:"6",x:"5",y:"15",rx:"2",key:"1w91an"}],["rect",{width:"10",height:"6",x:"7",y:"3",rx:"2",key:"17wqzy"}],["path",{d:"M2 21h20",key:"1nyx9w"}],["path",{d:"M2 3h20",key:"91anmk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ZO=U("Ambulance",[["path",{d:"M10 10H6",key:"1bsnug"}],["path",{d:"M14 18V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v11a1 1 0 0 0 1 1h2",key:"wrbu53"}],["path",{d:"M19 18h2a1 1 0 0 0 1-1v-3.28a1 1 0 0 0-.684-.948l-1.923-.641a1 1 0 0 1-.578-.502l-1.539-3.076A1 1 0 0 0 16.382 8H14",key:"lrkjwd"}],["path",{d:"M8 8v4",key:"1fwk8c"}],["path",{d:"M9 18h6",key:"x1upvd"}],["circle",{cx:"17",cy:"18",r:"2",key:"332jqn"}],["circle",{cx:"7",cy:"18",r:"2",key:"19iecd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const YO=U("Ampersand",[["path",{d:"M17.5 12c0 4.4-3.6 8-8 8A4.5 4.5 0 0 1 5 15.5c0-6 8-4 8-8.5a3 3 0 1 0-6 0c0 3 2.5 8.5 12 13",key:"1o9ehi"}],["path",{d:"M16 12h3",key:"4uvgyw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const XO=U("Ampersands",[["path",{d:"M10 17c-5-3-7-7-7-9a2 2 0 0 1 4 0c0 2.5-5 2.5-5 6 0 1.7 1.3 3 3 3 2.8 0 5-2.2 5-5",key:"12lh1k"}],["path",{d:"M22 17c-5-3-7-7-7-9a2 2 0 0 1 4 0c0 2.5-5 2.5-5 6 0 1.7 1.3 3 3 3 2.8 0 5-2.2 5-5",key:"173c68"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const QO=U("Amphora",[["path",{d:"M10 2v5.632c0 .424-.272.795-.653.982A6 6 0 0 0 6 14c.006 4 3 7 5 8",key:"1h8rid"}],["path",{d:"M10 5H8a2 2 0 0 0 0 4h.68",key:"3ezsi6"}],["path",{d:"M14 2v5.632c0 .424.272.795.652.982A6 6 0 0 1 18 14c0 4-3 7-5 8",key:"yt6q09"}],["path",{d:"M14 5h2a2 2 0 0 1 0 4h-.68",key:"8f95yk"}],["path",{d:"M18 22H6",key:"mg6kv4"}],["path",{d:"M9 2h6",key:"1jrp98"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const JO=U("Anchor",[["path",{d:"M12 22V8",key:"qkxhtm"}],["path",{d:"M5 12H2a10 10 0 0 0 20 0h-3",key:"1hv3nh"}],["circle",{cx:"12",cy:"5",r:"3",key:"rqqgnr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const e8=U("Angry",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M16 16s-1.5-2-4-2-4 2-4 2",key:"epbg0q"}],["path",{d:"M7.5 8 10 9",key:"olxxln"}],["path",{d:"m14 9 2.5-1",key:"1j6cij"}],["path",{d:"M9 10h.01",key:"qbtxuw"}],["path",{d:"M15 10h.01",key:"1qmjsl"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const t8=U("Annoyed",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 15h8",key:"45n4r"}],["path",{d:"M8 9h2",key:"1g203m"}],["path",{d:"M14 9h2",key:"116p9w"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const r8=U("Antenna",[["path",{d:"M2 12 7 2",key:"117k30"}],["path",{d:"m7 12 5-10",key:"1tvx22"}],["path",{d:"m12 12 5-10",key:"ev1o1a"}],["path",{d:"m17 12 5-10",key:"1e4ti3"}],["path",{d:"M4.5 7h15",key:"vlsxkz"}],["path",{d:"M12 16v6",key:"c8a4gj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const n8=U("Anvil",[["path",{d:"M7 10H6a4 4 0 0 1-4-4 1 1 0 0 1 1-1h4",key:"1hjpb6"}],["path",{d:"M7 5a1 1 0 0 1 1-1h13a1 1 0 0 1 1 1 7 7 0 0 1-7 7H8a1 1 0 0 1-1-1z",key:"1qn45f"}],["path",{d:"M9 12v5",key:"3anwtq"}],["path",{d:"M15 12v5",key:"5xh3zn"}],["path",{d:"M5 20a3 3 0 0 1 3-3h8a3 3 0 0 1 3 3 1 1 0 0 1-1 1H6a1 1 0 0 1-1-1",key:"1fi4x8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const s8=U("Aperture",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m14.31 8 5.74 9.94",key:"1y6ab4"}],["path",{d:"M9.69 8h11.48",key:"1wxppr"}],["path",{d:"m7.38 12 5.74-9.94",key:"1grp0k"}],["path",{d:"M9.69 16 3.95 6.06",key:"libnyf"}],["path",{d:"M14.31 16H2.83",key:"x5fava"}],["path",{d:"m16.62 12-5.74 9.94",key:"1vwawt"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const a8=U("AppWindowMac",[["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["path",{d:"M6 8h.01",key:"x9i8wu"}],["path",{d:"M10 8h.01",key:"1r9ogq"}],["path",{d:"M14 8h.01",key:"1primd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kT=U("AppWindow",[["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}],["path",{d:"M10 4v4",key:"pp8u80"}],["path",{d:"M2 8h20",key:"d11cs7"}],["path",{d:"M6 4v4",key:"1svtjw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const i8=U("Apple",[["path",{d:"M12 20.94c1.5 0 2.75 1.06 4 1.06 3 0 6-8 6-12.22A4.91 4.91 0 0 0 17 5c-2.22 0-4 1.44-5 2-1-.56-2.78-2-5-2a4.9 4.9 0 0 0-5 4.78C2 14 5 22 8 22c1.25 0 2.5-1.06 4-1.06Z",key:"3s7exb"}],["path",{d:"M10 2c1 .5 2 2 2 5",key:"fcco2y"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const o8=U("ArchiveRestore",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h2",key:"tvwodi"}],["path",{d:"M20 8v11a2 2 0 0 1-2 2h-2",key:"1gkqxj"}],["path",{d:"m9 15 3-3 3 3",key:"1pd0qc"}],["path",{d:"M12 12v9",key:"192myk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const l8=U("ArchiveX",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"m9.5 17 5-5",key:"nakeu6"}],["path",{d:"m9.5 12 5 5",key:"1hccrj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const c8=U("Archive",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const d8=U("Armchair",[["path",{d:"M19 9V6a2 2 0 0 0-2-2H7a2 2 0 0 0-2 2v3",key:"irtipd"}],["path",{d:"M3 16a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-5a2 2 0 0 0-4 0v1.5a.5.5 0 0 1-.5.5h-9a.5.5 0 0 1-.5-.5V11a2 2 0 0 0-4 0z",key:"1qyhux"}],["path",{d:"M5 18v2",key:"ppbyun"}],["path",{d:"M19 18v2",key:"gy7782"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const u8=U("ArrowBigDownDash",[["path",{d:"M15 5H9",key:"1tp3ed"}],["path",{d:"M15 9v3h4l-7 7-7-7h4V9z",key:"ncdc4b"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const h8=U("ArrowBigDown",[["path",{d:"M15 6v6h4l-7 7-7-7h4V6h6z",key:"1thax2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const f8=U("ArrowBigLeftDash",[["path",{d:"M19 15V9",key:"1hci5f"}],["path",{d:"M15 15h-3v4l-7-7 7-7v4h3v6z",key:"16tjna"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const p8=U("ArrowBigLeft",[["path",{d:"M18 15h-6v4l-7-7 7-7v4h6v6z",key:"lbrdak"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const m8=U("ArrowBigRightDash",[["path",{d:"M5 9v6",key:"158jrl"}],["path",{d:"M9 9h3V5l7 7-7 7v-4H9V9z",key:"1sg2xn"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const g8=U("ArrowBigRight",[["path",{d:"M6 9h6V5l7 7-7 7v-4H6V9z",key:"7fvt9c"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const x8=U("ArrowBigUpDash",[["path",{d:"M9 19h6",key:"456am0"}],["path",{d:"M9 15v-3H5l7-7 7 7h-4v3H9z",key:"1r2uve"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const y8=U("ArrowBigUp",[["path",{d:"M9 18v-6H5l7-7 7 7h-4v6H9z",key:"1x06kx"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const v8=U("ArrowDown01",[["path",{d:"m3 16 4 4 4-4",key:"1co6wj"}],["path",{d:"M7 20V4",key:"1yoxec"}],["rect",{x:"15",y:"4",width:"4",height:"6",ry:"2",key:"1bwicg"}],["path",{d:"M17 20v-6h-2",key:"1qp1so"}],["path",{d:"M15 20h4",key:"1j968p"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _8=U("ArrowDown10",[["path",{d:"m3 16 4 4 4-4",key:"1co6wj"}],["path",{d:"M7 20V4",key:"1yoxec"}],["path",{d:"M17 10V4h-2",key:"zcsr5x"}],["path",{d:"M15 10h4",key:"id2lce"}],["rect",{x:"15",y:"14",width:"4",height:"6",ry:"2",key:"33xykx"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const m_=U("ArrowDownAZ",[["path",{d:"m3 16 4 4 4-4",key:"1co6wj"}],["path",{d:"M7 20V4",key:"1yoxec"}],["path",{d:"M20 8h-5",key:"1vsyxs"}],["path",{d:"M15 10V6.5a2.5 2.5 0 0 1 5 0V10",key:"ag13bf"}],["path",{d:"M15 14h5l-5 6h5",key:"ur5jdg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const b8=U("ArrowDownFromLine",[["path",{d:"M19 3H5",key:"1236rx"}],["path",{d:"M12 21V7",key:"gj6g52"}],["path",{d:"m6 15 6 6 6-6",key:"h15q88"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const w8=U("ArrowDownLeft",[["path",{d:"M17 7 7 17",key:"15tmo1"}],["path",{d:"M17 17H7V7",key:"1org7z"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const j8=U("ArrowDownNarrowWide",[["path",{d:"m3 16 4 4 4-4",key:"1co6wj"}],["path",{d:"M7 20V4",key:"1yoxec"}],["path",{d:"M11 4h4",key:"6d7r33"}],["path",{d:"M11 8h7",key:"djye34"}],["path",{d:"M11 12h10",key:"1438ji"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const k8=U("ArrowDownRight",[["path",{d:"m7 7 10 10",key:"1fmybs"}],["path",{d:"M17 7v10H7",key:"6fjiku"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const N8=U("ArrowDownToDot",[["path",{d:"M12 2v14",key:"jyx4ut"}],["path",{d:"m19 9-7 7-7-7",key:"1oe3oy"}],["circle",{cx:"12",cy:"21",r:"1",key:"o0uj5v"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const S8=U("ArrowDownToLine",[["path",{d:"M12 17V3",key:"1cwfxf"}],["path",{d:"m6 11 6 6 6-6",key:"12ii2o"}],["path",{d:"M19 21H5",key:"150jfl"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const C8=U("ArrowDownUp",[["path",{d:"m3 16 4 4 4-4",key:"1co6wj"}],["path",{d:"M7 20V4",key:"1yoxec"}],["path",{d:"m21 8-4-4-4 4",key:"1c9v7m"}],["path",{d:"M17 4v16",key:"7dpous"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const g_=U("ArrowDownWideNarrow",[["path",{d:"m3 16 4 4 4-4",key:"1co6wj"}],["path",{d:"M7 20V4",key:"1yoxec"}],["path",{d:"M11 4h10",key:"1w87gc"}],["path",{d:"M11 8h7",key:"djye34"}],["path",{d:"M11 12h4",key:"q8tih4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const x_=U("ArrowDownZA",[["path",{d:"m3 16 4 4 4-4",key:"1co6wj"}],["path",{d:"M7 4v16",key:"1glfcx"}],["path",{d:"M15 4h5l-5 6h5",key:"8asdl1"}],["path",{d:"M15 20v-3.5a2.5 2.5 0 0 1 5 0V20",key:"r6l5cz"}],["path",{d:"M20 18h-5",key:"18j1r2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const i1=U("ArrowDown",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const M8=U("ArrowLeftFromLine",[["path",{d:"m9 6-6 6 6 6",key:"7v63n9"}],["path",{d:"M3 12h14",key:"13k4hi"}],["path",{d:"M21 19V5",key:"b4bplr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const T8=U("ArrowLeftRight",[["path",{d:"M8 3 4 7l4 4",key:"9rb6wj"}],["path",{d:"M4 7h16",key:"6tx8e3"}],["path",{d:"m16 21 4-4-4-4",key:"siv7j2"}],["path",{d:"M20 17H4",key:"h6l3hr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const A8=U("ArrowLeftToLine",[["path",{d:"M3 19V5",key:"rwsyhb"}],["path",{d:"m13 6-6 6 6 6",key:"1yhaz7"}],["path",{d:"M7 12h14",key:"uoisry"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const so=U("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const E8=U("ArrowRightFromLine",[["path",{d:"M3 5v14",key:"1nt18q"}],["path",{d:"M21 12H7",key:"13ipq5"}],["path",{d:"m15 18 6-6-6-6",key:"6tx3qv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const I8=U("ArrowRightLeft",[["path",{d:"m16 3 4 4-4 4",key:"1x1c3m"}],["path",{d:"M20 7H4",key:"zbl0bi"}],["path",{d:"m8 21-4-4 4-4",key:"h9nckh"}],["path",{d:"M4 17h16",key:"g4d7ey"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const P8=U("ArrowRightToLine",[["path",{d:"M17 12H3",key:"8awo09"}],["path",{d:"m11 18 6-6-6-6",key:"8c2y43"}],["path",{d:"M21 5v14",key:"nzette"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dl=U("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const L8=U("ArrowUp01",[["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}],["rect",{x:"15",y:"4",width:"4",height:"6",ry:"2",key:"1bwicg"}],["path",{d:"M17 20v-6h-2",key:"1qp1so"}],["path",{d:"M15 20h4",key:"1j968p"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const O8=U("ArrowUp10",[["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}],["path",{d:"M17 10V4h-2",key:"zcsr5x"}],["path",{d:"M15 10h4",key:"id2lce"}],["rect",{x:"15",y:"14",width:"4",height:"6",ry:"2",key:"33xykx"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const y_=U("ArrowUpAZ",[["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}],["path",{d:"M20 8h-5",key:"1vsyxs"}],["path",{d:"M15 10V6.5a2.5 2.5 0 0 1 5 0V10",key:"ag13bf"}],["path",{d:"M15 14h5l-5 6h5",key:"ur5jdg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zx=U("ArrowUpDown",[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const D8=U("ArrowUpFromDot",[["path",{d:"m5 9 7-7 7 7",key:"1hw5ic"}],["path",{d:"M12 16V2",key:"ywoabb"}],["circle",{cx:"12",cy:"21",r:"1",key:"o0uj5v"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const R8=U("ArrowUpFromLine",[["path",{d:"m18 9-6-6-6 6",key:"kcunyi"}],["path",{d:"M12 3v14",key:"7cf3v8"}],["path",{d:"M5 21h14",key:"11awu3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const F8=U("ArrowUpLeft",[["path",{d:"M7 17V7h10",key:"11bw93"}],["path",{d:"M17 17 7 7",key:"2786uv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const v_=U("ArrowUpNarrowWide",[["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}],["path",{d:"M11 12h4",key:"q8tih4"}],["path",{d:"M11 16h7",key:"uosisv"}],["path",{d:"M11 20h10",key:"jvxblo"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const z8=U("ArrowUpRight",[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const B8=U("ArrowUpToLine",[["path",{d:"M5 3h14",key:"7usisc"}],["path",{d:"m18 13-6-6-6 6",key:"1kf1n9"}],["path",{d:"M12 7v14",key:"1akyts"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $8=U("ArrowUpWideNarrow",[["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}],["path",{d:"M11 12h10",key:"1438ji"}],["path",{d:"M11 16h7",key:"uosisv"}],["path",{d:"M11 20h4",key:"1krc32"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const __=U("ArrowUpZA",[["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}],["path",{d:"M15 4h5l-5 6h5",key:"8asdl1"}],["path",{d:"M15 20v-3.5a2.5 2.5 0 0 1 5 0V20",key:"r6l5cz"}],["path",{d:"M20 18h-5",key:"18j1r2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mg=U("ArrowUp",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const U8=U("ArrowsUpFromLine",[["path",{d:"m4 6 3-3 3 3",key:"9aidw8"}],["path",{d:"M7 17V3",key:"19qxw1"}],["path",{d:"m14 6 3-3 3 3",key:"6iy689"}],["path",{d:"M17 17V3",key:"o0fmgi"}],["path",{d:"M4 21h16",key:"1h09gz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const q8=U("Asterisk",[["path",{d:"M12 6v12",key:"1vza4d"}],["path",{d:"M17.196 9 6.804 15",key:"1ah31z"}],["path",{d:"m6.804 9 10.392 6",key:"1b6pxd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const V8=U("AtSign",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8",key:"7n84p3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const H8=U("Atom",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["path",{d:"M20.2 20.2c2.04-2.03.02-7.36-4.5-11.9-4.54-4.52-9.87-6.54-11.9-4.5-2.04 2.03-.02 7.36 4.5 11.9 4.54 4.52 9.87 6.54 11.9 4.5Z",key:"1l2ple"}],["path",{d:"M15.7 15.7c4.52-4.54 6.54-9.87 4.5-11.9-2.03-2.04-7.36-.02-11.9 4.5-4.52 4.54-6.54 9.87-4.5 11.9 2.03 2.04 7.36.02 11.9-4.5Z",key:"1wam0m"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const W8=U("AudioLines",[["path",{d:"M2 10v3",key:"1fnikh"}],["path",{d:"M6 6v11",key:"11sgs0"}],["path",{d:"M10 3v18",key:"yhl04a"}],["path",{d:"M14 8v7",key:"3a1oy3"}],["path",{d:"M18 5v13",key:"123xd1"}],["path",{d:"M22 10v3",key:"154ddg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const G8=U("AudioWaveform",[["path",{d:"M2 13a2 2 0 0 0 2-2V7a2 2 0 0 1 4 0v13a2 2 0 0 0 4 0V4a2 2 0 0 1 4 0v13a2 2 0 0 0 4 0v-4a2 2 0 0 1 2-2",key:"57tc96"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ol=U("Award",[["path",{d:"m15.477 12.89 1.515 8.526a.5.5 0 0 1-.81.47l-3.58-2.687a1 1 0 0 0-1.197 0l-3.586 2.686a.5.5 0 0 1-.81-.469l1.514-8.526",key:"1yiouv"}],["circle",{cx:"12",cy:"8",r:"6",key:"1vp47v"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const K8=U("Axe",[["path",{d:"m14 12-8.5 8.5a2.12 2.12 0 1 1-3-3L11 9",key:"csbz4o"}],["path",{d:"M15 13 9 7l4-4 6 6h3a8 8 0 0 1-7 7z",key:"113wfo"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const b_=U("Axis3d",[["path",{d:"M4 4v16h16",key:"1s015l"}],["path",{d:"m4 20 7-7",key:"17qe9y"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Z8=U("Baby",[["path",{d:"M9 12h.01",key:"157uk2"}],["path",{d:"M15 12h.01",key:"1k8ypt"}],["path",{d:"M10 16c.5.3 1.2.5 2 .5s1.5-.2 2-.5",key:"1u7htd"}],["path",{d:"M19 6.3a9 9 0 0 1 1.8 3.9 2 2 0 0 1 0 3.6 9 9 0 0 1-17.6 0 2 2 0 0 1 0-3.6A9 9 0 0 1 12 3c2 0 3.5 1.1 3.5 2.5s-.9 2.5-2 2.5c-.8 0-1.5-.4-1.5-1",key:"5yv0yz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Y8=U("Backpack",[["path",{d:"M4 10a4 4 0 0 1 4-4h8a4 4 0 0 1 4 4v10a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2z",key:"1ol0lm"}],["path",{d:"M8 10h8",key:"c7uz4u"}],["path",{d:"M8 18h8",key:"1no2b1"}],["path",{d:"M8 22v-6a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v6",key:"1fr6do"}],["path",{d:"M9 6V4a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v2",key:"donm21"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const X8=U("BadgeAlert",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Q8=U("BadgeCent",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["path",{d:"M12 7v10",key:"jspqdw"}],["path",{d:"M15.4 10a4 4 0 1 0 0 4",key:"2eqtx8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const w_=U("BadgeCheck",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const J8=U("BadgeDollarSign",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["path",{d:"M16 8h-6a2 2 0 1 0 0 4h4a2 2 0 1 1 0 4H8",key:"1h4pet"}],["path",{d:"M12 18V6",key:"zqpxq5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const eD=U("BadgeEuro",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["path",{d:"M7 12h5",key:"gblrwe"}],["path",{d:"M15 9.4a4 4 0 1 0 0 5.2",key:"1makmb"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tD=U("BadgeHelp",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["line",{x1:"12",x2:"12.01",y1:"17",y2:"17",key:"io3f8k"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rD=U("BadgeIndianRupee",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["path",{d:"M8 8h8",key:"1bis0t"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"m13 17-5-1h1a4 4 0 0 0 0-8",key:"nu2bwa"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nD=U("BadgeInfo",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["line",{x1:"12",x2:"12",y1:"16",y2:"12",key:"1y1yb1"}],["line",{x1:"12",x2:"12.01",y1:"8",y2:"8",key:"110wyk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sD=U("BadgeJapaneseYen",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["path",{d:"m9 8 3 3v7",key:"17yadx"}],["path",{d:"m12 11 3-3",key:"p4cfq1"}],["path",{d:"M9 12h6",key:"1c52cq"}],["path",{d:"M9 16h6",key:"8wimt3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const aD=U("BadgeMinus",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const iD=U("BadgePercent",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"M9 9h.01",key:"1q5me6"}],["path",{d:"M15 15h.01",key:"lqbp3k"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oD=U("BadgePlus",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["line",{x1:"12",x2:"12",y1:"8",y2:"16",key:"10p56q"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lD=U("BadgePoundSterling",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["path",{d:"M8 12h4",key:"qz6y1c"}],["path",{d:"M10 16V9.5a2.5 2.5 0 0 1 5 0",key:"3mlbjk"}],["path",{d:"M8 16h7",key:"sbedsn"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cD=U("BadgeRussianRuble",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["path",{d:"M9 16h5",key:"1syiyw"}],["path",{d:"M9 12h5a2 2 0 1 0 0-4h-3v9",key:"1ge9c1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dD=U("BadgeSwissFranc",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["path",{d:"M11 17V8h4",key:"1bfq6y"}],["path",{d:"M11 12h3",key:"2eqnfz"}],["path",{d:"M9 16h4",key:"1skf3a"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uD=U("BadgeX",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["line",{x1:"15",x2:"9",y1:"9",y2:"15",key:"f7djnv"}],["line",{x1:"9",x2:"15",y1:"9",y2:"15",key:"1shsy8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hD=U("Badge",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fD=U("BaggageClaim",[["path",{d:"M22 18H6a2 2 0 0 1-2-2V7a2 2 0 0 0-2-2",key:"4irg2o"}],["path",{d:"M17 14V4a2 2 0 0 0-2-2h-1a2 2 0 0 0-2 2v10",key:"14fcyx"}],["rect",{width:"13",height:"8",x:"8",y:"6",rx:"1",key:"o6oiis"}],["circle",{cx:"18",cy:"20",r:"2",key:"t9985n"}],["circle",{cx:"9",cy:"20",r:"2",key:"e5v82j"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pD=U("Ban",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.9 4.9 14.2 14.2",key:"1m5liu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mD=U("Banana",[["path",{d:"M4 13c3.5-2 8-2 10 2a5.5 5.5 0 0 1 8 5",key:"1cscit"}],["path",{d:"M5.15 17.89c5.52-1.52 8.65-6.89 7-12C11.55 4 11.5 2 13 2c3.22 0 5 5.5 5 8 0 6.5-4.2 12-10.49 12C5.11 22 2 22 2 20c0-1.5 1.14-1.55 3.15-2.11Z",key:"1y1nbv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gD=U("Bandage",[["path",{d:"M10 10.01h.01",key:"1e9xi7"}],["path",{d:"M10 14.01h.01",key:"ac23bv"}],["path",{d:"M14 10.01h.01",key:"2wfrvf"}],["path",{d:"M14 14.01h.01",key:"8tw8yn"}],["path",{d:"M18 6v11.5",key:"dkbidh"}],["path",{d:"M6 6v12",key:"vkc79e"}],["rect",{x:"2",y:"6",width:"20",height:"12",rx:"2",key:"1wpnh2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xD=U("Banknote",[["rect",{width:"20",height:"12",x:"2",y:"6",rx:"2",key:"9lu3g6"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["path",{d:"M6 12h.01M18 12h.01",key:"113zkx"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yD=U("Barcode",[["path",{d:"M3 5v14",key:"1nt18q"}],["path",{d:"M8 5v14",key:"1ybrkv"}],["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"M17 5v14",key:"ycjyhj"}],["path",{d:"M21 5v14",key:"nzette"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vD=U("Baseline",[["path",{d:"M4 20h16",key:"14thso"}],["path",{d:"m6 16 6-12 6 12",key:"1b4byz"}],["path",{d:"M8 12h8",key:"1wcyev"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const o1=U("Bath",[["path",{d:"M10 4 8 6",key:"1rru8s"}],["path",{d:"M17 19v2",key:"ts1sot"}],["path",{d:"M2 12h20",key:"9i4pu4"}],["path",{d:"M7 19v2",key:"12npes"}],["path",{d:"M9 5 7.621 3.621A2.121 2.121 0 0 0 4 5v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-5",key:"14ym8i"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _D=U("BatteryCharging",[["path",{d:"M15 7h1a2 2 0 0 1 2 2v6a2 2 0 0 1-2 2h-2",key:"1sdynx"}],["path",{d:"M6 7H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h1",key:"1gkd3k"}],["path",{d:"m11 7-3 5h4l-3 5",key:"b4a64w"}],["line",{x1:"22",x2:"22",y1:"11",y2:"13",key:"4dh1rd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bD=U("BatteryFull",[["rect",{width:"16",height:"10",x:"2",y:"7",rx:"2",ry:"2",key:"1w10f2"}],["line",{x1:"22",x2:"22",y1:"11",y2:"13",key:"4dh1rd"}],["line",{x1:"6",x2:"6",y1:"11",y2:"13",key:"1wd6dw"}],["line",{x1:"10",x2:"10",y1:"11",y2:"13",key:"haxvl5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"13",key:"c6fn6x"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wD=U("BatteryLow",[["rect",{width:"16",height:"10",x:"2",y:"7",rx:"2",ry:"2",key:"1w10f2"}],["line",{x1:"22",x2:"22",y1:"11",y2:"13",key:"4dh1rd"}],["line",{x1:"6",x2:"6",y1:"11",y2:"13",key:"1wd6dw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jD=U("BatteryMedium",[["rect",{width:"16",height:"10",x:"2",y:"7",rx:"2",ry:"2",key:"1w10f2"}],["line",{x1:"22",x2:"22",y1:"11",y2:"13",key:"4dh1rd"}],["line",{x1:"6",x2:"6",y1:"11",y2:"13",key:"1wd6dw"}],["line",{x1:"10",x2:"10",y1:"11",y2:"13",key:"haxvl5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kD=U("BatteryWarning",[["path",{d:"M10 17h.01",key:"nbq80n"}],["path",{d:"M10 7v6",key:"nne03l"}],["path",{d:"M14 7h2a2 2 0 0 1 2 2v6a2 2 0 0 1-2 2h-2",key:"1x5o8m"}],["path",{d:"M22 11v2",key:"1wo06k"}],["path",{d:"M6 7H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h2",key:"1mdjgh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ND=U("Battery",[["rect",{width:"16",height:"10",x:"2",y:"7",rx:"2",ry:"2",key:"1w10f2"}],["line",{x1:"22",x2:"22",y1:"11",y2:"13",key:"4dh1rd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const SD=U("Beaker",[["path",{d:"M4.5 3h15",key:"c7n0jr"}],["path",{d:"M6 3v16a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V3",key:"m1uhx7"}],["path",{d:"M6 14h12",key:"4cwo0f"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const CD=U("BeanOff",[["path",{d:"M9 9c-.64.64-1.521.954-2.402 1.165A6 6 0 0 0 8 22a13.96 13.96 0 0 0 9.9-4.1",key:"bq3udt"}],["path",{d:"M10.75 5.093A6 6 0 0 1 22 8c0 2.411-.61 4.68-1.683 6.66",key:"17ccse"}],["path",{d:"M5.341 10.62a4 4 0 0 0 6.487 1.208M10.62 5.341a4.015 4.015 0 0 1 2.039 2.04",key:"18zqgq"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const MD=U("Bean",[["path",{d:"M10.165 6.598C9.954 7.478 9.64 8.36 9 9c-.64.64-1.521.954-2.402 1.165A6 6 0 0 0 8 22c7.732 0 14-6.268 14-14a6 6 0 0 0-11.835-1.402Z",key:"1tvzk7"}],["path",{d:"M5.341 10.62a4 4 0 1 0 5.279-5.28",key:"2cyri2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const TD=U("BedDouble",[["path",{d:"M2 20v-8a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v8",key:"1k78r4"}],["path",{d:"M4 10V6a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v4",key:"fb3tl2"}],["path",{d:"M12 4v6",key:"1dcgq2"}],["path",{d:"M2 18h20",key:"ajqnye"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const AD=U("BedSingle",[["path",{d:"M3 20v-8a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v8",key:"1wm6mi"}],["path",{d:"M5 10V6a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v4",key:"4k93s5"}],["path",{d:"M3 18h18",key:"1h113x"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const l1=U("Bed",[["path",{d:"M2 4v16",key:"vw9hq8"}],["path",{d:"M2 8h18a2 2 0 0 1 2 2v10",key:"1dgv2r"}],["path",{d:"M2 17h20",key:"18nfp3"}],["path",{d:"M6 8v9",key:"1yriud"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ED=U("Beef",[["circle",{cx:"12.5",cy:"8.5",r:"2.5",key:"9738u8"}],["path",{d:"M12.5 2a6.5 6.5 0 0 0-6.22 4.6c-1.1 3.13-.78 3.9-3.18 6.08A3 3 0 0 0 5 18c4 0 8.4-1.8 11.4-4.3A6.5 6.5 0 0 0 12.5 2Z",key:"o0f6za"}],["path",{d:"m18.5 6 2.19 4.5a6.48 6.48 0 0 1 .31 2 6.49 6.49 0 0 1-2.6 5.2C15.4 20.2 11 22 7 22a3 3 0 0 1-2.68-1.66L2.4 16.5",key:"k7p6i0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ID=U("BeerOff",[["path",{d:"M13 13v5",key:"igwfh0"}],["path",{d:"M17 11.47V8",key:"16yw0g"}],["path",{d:"M17 11h1a3 3 0 0 1 2.745 4.211",key:"1xbt65"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M5 8v12a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2v-3",key:"c55o3e"}],["path",{d:"M7.536 7.535C6.766 7.649 6.154 8 5.5 8a2.5 2.5 0 0 1-1.768-4.268",key:"1ydug7"}],["path",{d:"M8.727 3.204C9.306 2.767 9.885 2 11 2c1.56 0 2 1.5 3 1.5s1.72-.5 2.5-.5a1 1 0 1 1 0 5c-.78 0-1.5-.5-2.5-.5a3.149 3.149 0 0 0-.842.12",key:"q81o7q"}],["path",{d:"M9 14.6V18",key:"20ek98"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const PD=U("Beer",[["path",{d:"M17 11h1a3 3 0 0 1 0 6h-1",key:"1yp76v"}],["path",{d:"M9 12v6",key:"1u1cab"}],["path",{d:"M13 12v6",key:"1sugkk"}],["path",{d:"M14 7.5c-1 0-1.44.5-3 .5s-2-.5-3-.5-1.72.5-2.5.5a2.5 2.5 0 0 1 0-5c.78 0 1.57.5 2.5.5S9.44 2 11 2s2 1.5 3 1.5 1.72-.5 2.5-.5a2.5 2.5 0 0 1 0 5c-.78 0-1.5-.5-2.5-.5Z",key:"1510fo"}],["path",{d:"M5 8v12a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V8",key:"19jb7n"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const LD=U("BellDot",[["path",{d:"M19.4 14.9C20.2 16.4 21 17 21 17H3s3-2 3-9c0-3.3 2.7-6 6-6 .7 0 1.3.1 1.9.3",key:"xcehk"}],["path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0",key:"qgo35s"}],["circle",{cx:"18",cy:"8",r:"3",key:"1g0gzu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const OD=U("BellElectric",[["path",{d:"M18.8 4A6.3 8.7 0 0 1 20 9",key:"xve1fh"}],["path",{d:"M9 9h.01",key:"1q5me6"}],["circle",{cx:"9",cy:"9",r:"7",key:"p2h5vp"}],["rect",{width:"10",height:"6",x:"4",y:"16",rx:"2",key:"17f3te"}],["path",{d:"M14 19c3 0 4.6-1.6 4.6-1.6",key:"n7odp6"}],["circle",{cx:"20",cy:"16",r:"2",key:"1v9bxh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const DD=U("BellMinus",[["path",{d:"M18.4 12c.8 3.8 2.6 5 2.6 5H3s3-2 3-9c0-3.3 2.7-6 6-6 1.8 0 3.4.8 4.5 2",key:"eck70s"}],["path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0",key:"qgo35s"}],["path",{d:"M15 8h6",key:"8ybuxh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oj=U("BellOff",[["path",{d:"M8.7 3A6 6 0 0 1 18 8a21.3 21.3 0 0 0 .6 5",key:"o7mx20"}],["path",{d:"M17 17H3s3-2 3-9a4.67 4.67 0 0 1 .3-1.7",key:"16f1lm"}],["path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0",key:"qgo35s"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const RD=U("BellPlus",[["path",{d:"M19.3 14.8C20.1 16.4 21 17 21 17H3s3-2 3-9c0-3.3 2.7-6 6-6 1 0 1.9.2 2.8.7",key:"guizqy"}],["path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0",key:"qgo35s"}],["path",{d:"M15 8h6",key:"8ybuxh"}],["path",{d:"M18 5v6",key:"g5ayrv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const FD=U("BellRing",[["path",{d:"M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9",key:"1qo2s2"}],["path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0",key:"qgo35s"}],["path",{d:"M4 2C2.8 3.7 2 5.7 2 8",key:"tap9e0"}],["path",{d:"M22 8c0-2.3-.8-4.3-2-6",key:"5bb3ad"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gg=U("Bell",[["path",{d:"M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9",key:"1qo2s2"}],["path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0",key:"qgo35s"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const j_=U("BetweenHorizontalEnd",[["rect",{width:"13",height:"7",x:"3",y:"3",rx:"1",key:"11xb64"}],["path",{d:"m22 15-3-3 3-3",key:"26chmm"}],["rect",{width:"13",height:"7",x:"3",y:"14",rx:"1",key:"k6ky7n"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const k_=U("BetweenHorizontalStart",[["rect",{width:"13",height:"7",x:"8",y:"3",rx:"1",key:"pkso9a"}],["path",{d:"m2 9 3 3-3 3",key:"1agib5"}],["rect",{width:"13",height:"7",x:"8",y:"14",rx:"1",key:"1q5fc1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zD=U("BetweenVerticalEnd",[["rect",{width:"7",height:"13",x:"3",y:"3",rx:"1",key:"1fdu0f"}],["path",{d:"m9 22 3-3 3 3",key:"17z65a"}],["rect",{width:"7",height:"13",x:"14",y:"3",rx:"1",key:"1squn4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const BD=U("BetweenVerticalStart",[["rect",{width:"7",height:"13",x:"3",y:"8",rx:"1",key:"1fjrkv"}],["path",{d:"m15 2-3 3-3-3",key:"1uh6eb"}],["rect",{width:"7",height:"13",x:"14",y:"8",rx:"1",key:"w3fjg8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $D=U("BicepsFlexed",[["path",{d:"M12.409 13.017A5 5 0 0 1 22 15c0 3.866-4 7-9 7-4.077 0-8.153-.82-10.371-2.462-.426-.316-.631-.832-.62-1.362C2.118 12.723 2.627 2 10 2a3 3 0 0 1 3 3 2 2 0 0 1-2 2c-1.105 0-1.64-.444-2-1",key:"1pmlyh"}],["path",{d:"M15 14a5 5 0 0 0-7.584 2",key:"5rb254"}],["path",{d:"M9.964 6.825C8.019 7.977 9.5 13 8 15",key:"kbvsx9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const UD=U("Bike",[["circle",{cx:"18.5",cy:"17.5",r:"3.5",key:"15x4ox"}],["circle",{cx:"5.5",cy:"17.5",r:"3.5",key:"1noe27"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["path",{d:"M12 17.5V14l-3-3 4-3 2 3h2",key:"1npguv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qD=U("Binary",[["rect",{x:"14",y:"14",width:"4",height:"6",rx:"2",key:"p02svl"}],["rect",{x:"6",y:"4",width:"4",height:"6",rx:"2",key:"xm4xkj"}],["path",{d:"M6 20h4",key:"1i6q5t"}],["path",{d:"M14 10h4",key:"ru81e7"}],["path",{d:"M6 14h2v6",key:"16z9wg"}],["path",{d:"M14 4h2v6",key:"1idq9u"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const VD=U("Binoculars",[["path",{d:"M10 10h4",key:"tcdvrf"}],["path",{d:"M19 7V4a1 1 0 0 0-1-1h-2a1 1 0 0 0-1 1v3",key:"3apit1"}],["path",{d:"M20 21a2 2 0 0 0 2-2v-3.851c0-1.39-2-2.962-2-4.829V8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v11a2 2 0 0 0 2 2z",key:"rhpgnw"}],["path",{d:"M 22 16 L 2 16",key:"14lkq7"}],["path",{d:"M4 21a2 2 0 0 1-2-2v-3.851c0-1.39 2-2.962 2-4.829V8a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v11a2 2 0 0 1-2 2z",key:"104b3k"}],["path",{d:"M9 7V4a1 1 0 0 0-1-1H6a1 1 0 0 0-1 1v3",key:"14fczp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const HD=U("Biohazard",[["circle",{cx:"12",cy:"11.9",r:"2",key:"e8h31w"}],["path",{d:"M6.7 3.4c-.9 2.5 0 5.2 2.2 6.7C6.5 9 3.7 9.6 2 11.6",key:"17bolr"}],["path",{d:"m8.9 10.1 1.4.8",key:"15ezny"}],["path",{d:"M17.3 3.4c.9 2.5 0 5.2-2.2 6.7 2.4-1.2 5.2-.6 6.9 1.5",key:"wtwa5u"}],["path",{d:"m15.1 10.1-1.4.8",key:"1r0b28"}],["path",{d:"M16.7 20.8c-2.6-.4-4.6-2.6-4.7-5.3-.2 2.6-2.1 4.8-4.7 5.2",key:"m7qszh"}],["path",{d:"M12 13.9v1.6",key:"zfyyim"}],["path",{d:"M13.5 5.4c-1-.2-2-.2-3 0",key:"1bi9q0"}],["path",{d:"M17 16.4c.7-.7 1.2-1.6 1.5-2.5",key:"1rhjqw"}],["path",{d:"M5.5 13.9c.3.9.8 1.8 1.5 2.5",key:"8gsud3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const WD=U("Bird",[["path",{d:"M16 7h.01",key:"1kdx03"}],["path",{d:"M3.4 18H12a8 8 0 0 0 8-8V7a4 4 0 0 0-7.28-2.3L2 20",key:"oj1oa8"}],["path",{d:"m20 7 2 .5-2 .5",key:"12nv4d"}],["path",{d:"M10 18v3",key:"1yea0a"}],["path",{d:"M14 17.75V21",key:"1pymcb"}],["path",{d:"M7 18a6 6 0 0 0 3.84-10.61",key:"1npnn0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const GD=U("Bitcoin",[["path",{d:"M11.767 19.089c4.924.868 6.14-6.025 1.216-6.894m-1.216 6.894L5.86 18.047m5.908 1.042-.347 1.97m1.563-8.864c4.924.869 6.14-6.025 1.215-6.893m-1.215 6.893-3.94-.694m5.155-6.2L8.29 4.26m5.908 1.042.348-1.97M7.48 20.364l3.126-17.727",key:"yr8idg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const KD=U("Blend",[["circle",{cx:"9",cy:"9",r:"7",key:"p2h5vp"}],["circle",{cx:"15",cy:"15",r:"7",key:"19ennj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ZD=U("Blinds",[["path",{d:"M3 3h18",key:"o7r712"}],["path",{d:"M20 7H8",key:"gd2fo2"}],["path",{d:"M20 11H8",key:"1ynp89"}],["path",{d:"M10 19h10",key:"19hjk5"}],["path",{d:"M8 15h12",key:"1yqzne"}],["path",{d:"M4 3v14",key:"fggqzn"}],["circle",{cx:"4",cy:"19",r:"2",key:"p3m9r0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const YD=U("Blocks",[["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["path",{d:"M10 21V8a1 1 0 0 0-1-1H4a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-5a1 1 0 0 0-1-1H3",key:"1fpvtg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const XD=U("BluetoothConnected",[["path",{d:"m7 7 10 10-5 5V2l5 5L7 17",key:"1q5490"}],["line",{x1:"18",x2:"21",y1:"12",y2:"12",key:"1rsjjs"}],["line",{x1:"3",x2:"6",y1:"12",y2:"12",key:"11yl8c"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const QD=U("BluetoothOff",[["path",{d:"m17 17-5 5V12l-5 5",key:"v5aci6"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M14.5 9.5 17 7l-5-5v4.5",key:"1kddfz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const JD=U("BluetoothSearching",[["path",{d:"m7 7 10 10-5 5V2l5 5L7 17",key:"1q5490"}],["path",{d:"M20.83 14.83a4 4 0 0 0 0-5.66",key:"k8tn1j"}],["path",{d:"M18 12h.01",key:"yjnet6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const eR=U("Bluetooth",[["path",{d:"m7 7 10 10-5 5V2l5 5L7 17",key:"1q5490"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const J4=U("Bold",[["path",{d:"M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8",key:"mg9rjx"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tR=U("Bolt",[["path",{d:"M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z",key:"yt0hxn"}],["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rR=U("Bomb",[["circle",{cx:"11",cy:"13",r:"9",key:"hd149"}],["path",{d:"M14.35 4.65 16.3 2.7a2.41 2.41 0 0 1 3.4 0l1.6 1.6a2.4 2.4 0 0 1 0 3.4l-1.95 1.95",key:"jp4j1b"}],["path",{d:"m22 2-1.5 1.5",key:"ay92ug"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nR=U("Bone",[["path",{d:"M17 10c.7-.7 1.69 0 2.5 0a2.5 2.5 0 1 0 0-5 .5.5 0 0 1-.5-.5 2.5 2.5 0 1 0-5 0c0 .81.7 1.8 0 2.5l-7 7c-.7.7-1.69 0-2.5 0a2.5 2.5 0 0 0 0 5c.28 0 .5.22.5.5a2.5 2.5 0 1 0 5 0c0-.81-.7-1.8 0-2.5Z",key:"w610uw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sR=U("BookA",[["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}],["path",{d:"m8 13 4-7 4 7",key:"4rari8"}],["path",{d:"M9.1 11h5.7",key:"1gkovt"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const aR=U("BookAudio",[["path",{d:"M12 6v7",key:"1f6ttz"}],["path",{d:"M16 8v3",key:"gejaml"}],["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}],["path",{d:"M8 8v3",key:"1qzp49"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const iR=U("BookCheck",[["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}],["path",{d:"m9 9.5 2 2 4-4",key:"1dth82"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oR=U("BookCopy",[["path",{d:"M2 16V4a2 2 0 0 1 2-2h11",key:"spzkk5"}],["path",{d:"M22 18H11a2 2 0 1 0 0 4h10.5a.5.5 0 0 0 .5-.5v-15a.5.5 0 0 0-.5-.5H11a2 2 0 0 0-2 2v12",key:"1wz07i"}],["path",{d:"M5 14H4a2 2 0 1 0 0 4h1",key:"16gqf9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const N_=U("BookDashed",[["path",{d:"M12 17h2",key:"13u4lk"}],["path",{d:"M12 22h2",key:"kn7ki6"}],["path",{d:"M12 2h2",key:"cvn524"}],["path",{d:"M18 22h1a1 1 0 0 0 1-1",key:"w6gbqz"}],["path",{d:"M18 2h1a1 1 0 0 1 1 1v1",key:"1vpra5"}],["path",{d:"M20 15v2h-2",key:"fph276"}],["path",{d:"M20 8v3",key:"deu0bs"}],["path",{d:"M4 11V9",key:"v3xsx8"}],["path",{d:"M4 19.5V15",key:"6gr39e"}],["path",{d:"M4 5v-.5A2.5 2.5 0 0 1 6.5 2H8",key:"wywhs9"}],["path",{d:"M8 22H6.5a1 1 0 0 1 0-5H8",key:"1cu73q"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lR=U("BookDown",[["path",{d:"M12 13V7",key:"h0r20n"}],["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}],["path",{d:"m9 10 3 3 3-3",key:"zt5b4y"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cR=U("BookHeadphones",[["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}],["path",{d:"M8 12v-2a4 4 0 0 1 8 0v2",key:"1vsqkj"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dR=U("BookHeart",[["path",{d:"M16 8.2A2.22 2.22 0 0 0 13.8 6c-.8 0-1.4.3-1.8.9-.4-.6-1-.9-1.8-.9A2.22 2.22 0 0 0 8 8.2c0 .6.3 1.2.7 1.6A226.652 226.652 0 0 0 12 13a404 404 0 0 0 3.3-3.1 2.413 2.413 0 0 0 .7-1.7",key:"1t75a8"}],["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uR=U("BookImage",[["path",{d:"m20 13.7-2.1-2.1a2 2 0 0 0-2.8 0L9.7 17",key:"q6ojf0"}],["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}],["circle",{cx:"10",cy:"8",r:"2",key:"2qkj4p"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hR=U("BookKey",[["path",{d:"m19 3 1 1",key:"ze14oc"}],["path",{d:"m20 2-4.5 4.5",key:"1sppr8"}],["path",{d:"M20 8v13a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"1ocbpn"}],["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H14",key:"1gfsgw"}],["circle",{cx:"14",cy:"8",r:"2",key:"u49eql"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fR=U("BookLock",[["path",{d:"M18 6V4a2 2 0 1 0-4 0v2",key:"1aquzs"}],["path",{d:"M20 15v6a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"1rkj32"}],["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H10",key:"18wgow"}],["rect",{x:"12",y:"6",width:"8",height:"5",rx:"1",key:"73l30o"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pR=U("BookMarked",[["path",{d:"M10 2v8l3-3 3 3V2",key:"sqw3rj"}],["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mR=U("BookMinus",[["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}],["path",{d:"M9 10h6",key:"9gxzsh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gR=U("BookOpenCheck",[["path",{d:"M12 21V7",key:"gj6g52"}],["path",{d:"m16 12 2 2 4-4",key:"mdajum"}],["path",{d:"M22 6V4a1 1 0 0 0-1-1h-5a4 4 0 0 0-4 4 4 4 0 0 0-4-4H3a1 1 0 0 0-1 1v13a1 1 0 0 0 1 1h6a3 3 0 0 1 3 3 3 3 0 0 1 3-3h6a1 1 0 0 0 1-1v-1.3",key:"8arnkb"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xR=U("BookOpenText",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M16 12h2",key:"7q9ll5"}],["path",{d:"M16 8h2",key:"msurwy"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}],["path",{d:"M6 12h2",key:"32wvfc"}],["path",{d:"M6 8h2",key:"30oboj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const NT=U("BookOpen",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yR=U("BookPlus",[["path",{d:"M12 7v6",key:"lw1j43"}],["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}],["path",{d:"M9 10h6",key:"9gxzsh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vR=U("BookText",[["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}],["path",{d:"M8 11h8",key:"vwpz6n"}],["path",{d:"M8 7h6",key:"1f0q6e"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _R=U("BookType",[["path",{d:"M10 13h4",key:"ytezjc"}],["path",{d:"M12 6v7",key:"1f6ttz"}],["path",{d:"M16 8V6H8v2",key:"x8j6u4"}],["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bR=U("BookUp2",[["path",{d:"M12 13V7",key:"h0r20n"}],["path",{d:"M18 2h1a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"161d7n"}],["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2",key:"1lorq7"}],["path",{d:"m9 10 3-3 3 3",key:"11gsxs"}],["path",{d:"m9 5 3-3 3 3",key:"l8vdw6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wR=U("BookUp",[["path",{d:"M12 13V7",key:"h0r20n"}],["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}],["path",{d:"m9 10 3-3 3 3",key:"11gsxs"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jR=U("BookUser",[["path",{d:"M15 13a3 3 0 1 0-6 0",key:"10j68g"}],["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}],["circle",{cx:"12",cy:"8",r:"2",key:"1822b1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kR=U("BookX",[["path",{d:"m14.5 7-5 5",key:"dy991v"}],["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}],["path",{d:"m9.5 7 5 5",key:"s45iea"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const NR=U("Book",[["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const SR=U("BookmarkCheck",[["path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2Z",key:"169p4p"}],["path",{d:"m9 10 2 2 4-4",key:"1gnqz4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const CR=U("BookmarkMinus",[["path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z",key:"1fy3hk"}],["line",{x1:"15",x2:"9",y1:"10",y2:"10",key:"1gty7f"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ST=U("BookmarkPlus",[["path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z",key:"1fy3hk"}],["line",{x1:"12",x2:"12",y1:"7",y2:"13",key:"1cppfj"}],["line",{x1:"15",x2:"9",y1:"10",y2:"10",key:"1gty7f"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const MR=U("BookmarkX",[["path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2Z",key:"169p4p"}],["path",{d:"m14.5 7.5-5 5",key:"3lb6iw"}],["path",{d:"m9.5 7.5 5 5",key:"ko136h"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const um=U("Bookmark",[["path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z",key:"1fy3hk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const TR=U("BoomBox",[["path",{d:"M4 9V5a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v4",key:"vvzvr1"}],["path",{d:"M8 8v1",key:"xcqmfk"}],["path",{d:"M12 8v1",key:"1rj8u4"}],["path",{d:"M16 8v1",key:"1q12zr"}],["rect",{width:"20",height:"12",x:"2",y:"9",rx:"2",key:"igpb89"}],["circle",{cx:"8",cy:"15",r:"2",key:"fa4a8s"}],["circle",{cx:"16",cy:"15",r:"2",key:"14c3ya"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const AR=U("BotMessageSquare",[["path",{d:"M12 6V2H8",key:"1155em"}],["path",{d:"m8 18-4 4V8a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2Z",key:"w2lp3e"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M9 11v2",key:"1ueba0"}],["path",{d:"M15 11v2",key:"i11awn"}],["path",{d:"M20 12h2",key:"1q8mjw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ER=U("BotOff",[["path",{d:"M13.67 8H18a2 2 0 0 1 2 2v4.33",key:"7az073"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M22 22 2 2",key:"1r8tn9"}],["path",{d:"M8 8H6a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h12a2 2 0 0 0 1.414-.586",key:"s09a7a"}],["path",{d:"M9 13v2",key:"rq6x2g"}],["path",{d:"M9.67 4H12v2.33",key:"110xot"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const eS=U("Bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const IR=U("Box",[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const PR=U("Boxes",[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const S_=U("Braces",[["path",{d:"M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1",key:"ezmyqa"}],["path",{d:"M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1",key:"e1hn23"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const LR=U("Brackets",[["path",{d:"M16 3h3v18h-3",key:"1yor1f"}],["path",{d:"M8 21H5V3h3",key:"1qrfwo"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const OR=U("BrainCircuit",[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M9 13a4.5 4.5 0 0 0 3-4",key:"10igwf"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M12 13h4",key:"1ku699"}],["path",{d:"M12 18h6a2 2 0 0 1 2 2v1",key:"105ag5"}],["path",{d:"M12 8h8",key:"1lhi5i"}],["path",{d:"M16 8V5a2 2 0 0 1 2-2",key:"u6izg6"}],["circle",{cx:"16",cy:"13",r:".5",key:"ry7gng"}],["circle",{cx:"18",cy:"3",r:".5",key:"1aiba7"}],["circle",{cx:"20",cy:"21",r:".5",key:"yhc1fs"}],["circle",{cx:"20",cy:"8",r:".5",key:"1e43v0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const DR=U("BrainCog",[["path",{d:"M12 5a3 3 0 1 0-5.997.142 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588 4 4 0 0 0 7.636 2.106 3.2 3.2 0 0 0 .164-.546c.028-.13.306-.13.335 0a3.2 3.2 0 0 0 .163.546 4 4 0 0 0 7.636-2.106 4 4 0 0 0 .556-6.588 4 4 0 0 0-2.526-5.77A3 3 0 1 0 12 5",key:"1kgmhc"}],["path",{d:"M17.599 6.5a3 3 0 0 0 .399-1.375",key:"tmeiqw"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M19.938 10.5a4 4 0 0 1 .585.396",key:"1qfode"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M19.967 17.484A4 4 0 0 1 18 18",key:"159ez6"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["path",{d:"m15.7 10.4-.9.4",key:"ayzo6p"}],["path",{d:"m9.2 13.2-.9.4",key:"1uzb3g"}],["path",{d:"m13.6 15.7-.4-.9",key:"11ifqf"}],["path",{d:"m10.8 9.2-.4-.9",key:"1pmk2v"}],["path",{d:"m15.7 13.5-.9-.4",key:"7ng02m"}],["path",{d:"m9.2 10.9-.9-.4",key:"1x66zd"}],["path",{d:"m10.5 15.7.4-.9",key:"3js94g"}],["path",{d:"m13.1 9.2.4-.9",key:"18n7mc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const CT=U("Brain",[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z",key:"ep3f8r"}],["path",{d:"M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4",key:"1p4c4q"}],["path",{d:"M17.599 6.5a3 3 0 0 0 .399-1.375",key:"tmeiqw"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M19.938 10.5a4 4 0 0 1 .585.396",key:"1qfode"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M19.967 17.484A4 4 0 0 1 18 18",key:"159ez6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const RR=U("BrickWall",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 9v6",key:"199k2o"}],["path",{d:"M16 15v6",key:"8rj2es"}],["path",{d:"M16 3v6",key:"1j6rpj"}],["path",{d:"M3 15h18",key:"5xshup"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M8 15v6",key:"1stoo3"}],["path",{d:"M8 3v6",key:"vlvjmk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const FR=U("BriefcaseBusiness",[["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M16 6V4a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v2",key:"1ksdt3"}],["path",{d:"M22 13a18.15 18.15 0 0 1-20 0",key:"12hx5q"}],["rect",{width:"20",height:"14",x:"2",y:"6",rx:"2",key:"i6l2r4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zR=U("BriefcaseConveyorBelt",[["path",{d:"M10 20v2",key:"1n8e1g"}],["path",{d:"M14 20v2",key:"1lq872"}],["path",{d:"M18 20v2",key:"10uadw"}],["path",{d:"M21 20H3",key:"kdqkdp"}],["path",{d:"M6 20v2",key:"a9bc87"}],["path",{d:"M8 16V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v12",key:"17n9tx"}],["rect",{x:"4",y:"6",width:"16",height:"10",rx:"2",key:"1097i5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const BR=U("BriefcaseMedical",[["path",{d:"M12 11v4",key:"a6ujw6"}],["path",{d:"M14 13h-4",key:"1pl8zg"}],["path",{d:"M16 6V4a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v2",key:"1ksdt3"}],["path",{d:"M18 6v14",key:"1mu4gy"}],["path",{d:"M6 6v14",key:"1s15cj"}],["rect",{width:"20",height:"14",x:"2",y:"6",rx:"2",key:"i6l2r4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yh=U("Briefcase",[["path",{d:"M16 20V4a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v16",key:"jecpp"}],["rect",{width:"20",height:"14",x:"2",y:"6",rx:"2",key:"i6l2r4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $R=U("BringToFront",[["rect",{x:"8",y:"8",width:"8",height:"8",rx:"2",key:"yj20xf"}],["path",{d:"M4 10a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2",key:"1ltk23"}],["path",{d:"M14 20a2 2 0 0 0 2 2h4a2 2 0 0 0 2-2v-4a2 2 0 0 0-2-2",key:"1q24h9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const UR=U("Brush",[["path",{d:"m9.06 11.9 8.07-8.06a2.85 2.85 0 1 1 4.03 4.03l-8.06 8.08",key:"1styjt"}],["path",{d:"M7.07 14.94c-1.66 0-3 1.35-3 3.02 0 1.33-2.5 1.52-2 2.02 1.08 1.1 2.49 2.02 4 2.02 2.2 0 4-1.8 4-4.04a3.01 3.01 0 0 0-3-3.02z",key:"z0l1mu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qR=U("BugOff",[["path",{d:"M15 7.13V6a3 3 0 0 0-5.14-2.1L8 2",key:"vl8zik"}],["path",{d:"M14.12 3.88 16 2",key:"qol33r"}],["path",{d:"M22 13h-4v-2a4 4 0 0 0-4-4h-1.3",key:"1ou0bd"}],["path",{d:"M20.97 5c0 2.1-1.6 3.8-3.5 4",key:"18gb23"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M7.7 7.7A4 4 0 0 0 6 11v3a6 6 0 0 0 11.13 3.13",key:"1njkjs"}],["path",{d:"M12 20v-8",key:"i3yub9"}],["path",{d:"M6 13H2",key:"82j7cp"}],["path",{d:"M3 21c0-2.1 1.7-3.9 3.8-4",key:"4p0ekp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const VR=U("BugPlay",[["path",{d:"M12.765 21.522a.5.5 0 0 1-.765-.424v-8.196a.5.5 0 0 1 .765-.424l5.878 3.674a1 1 0 0 1 0 1.696z",key:"17shqo"}],["path",{d:"M14.12 3.88 16 2",key:"qol33r"}],["path",{d:"M18 11a4 4 0 0 0-4-4h-4a4 4 0 0 0-4 4v3a6.1 6.1 0 0 0 2 4.5",key:"1tjixy"}],["path",{d:"M20.97 5c0 2.1-1.6 3.8-3.5 4",key:"18gb23"}],["path",{d:"M3 21c0-2.1 1.7-3.9 3.8-4",key:"4p0ekp"}],["path",{d:"M6 13H2",key:"82j7cp"}],["path",{d:"M6.53 9C4.6 8.8 3 7.1 3 5",key:"32zzws"}],["path",{d:"m8 2 1.88 1.88",key:"fmnt4t"}],["path",{d:"M9 7.13v-1a3.003 3.003 0 1 1 6 0v1",key:"d7y7pr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const HR=U("Bug",[["path",{d:"m8 2 1.88 1.88",key:"fmnt4t"}],["path",{d:"M14.12 3.88 16 2",key:"qol33r"}],["path",{d:"M9 7.13v-1a3.003 3.003 0 1 1 6 0v1",key:"d7y7pr"}],["path",{d:"M12 20c-3.3 0-6-2.7-6-6v-3a4 4 0 0 1 4-4h4a4 4 0 0 1 4 4v3c0 3.3-2.7 6-6 6",key:"xs1cw7"}],["path",{d:"M12 20v-9",key:"1qisl0"}],["path",{d:"M6.53 9C4.6 8.8 3 7.1 3 5",key:"32zzws"}],["path",{d:"M6 13H2",key:"82j7cp"}],["path",{d:"M3 21c0-2.1 1.7-3.9 3.8-4",key:"4p0ekp"}],["path",{d:"M20.97 5c0 2.1-1.6 3.8-3.5 4",key:"18gb23"}],["path",{d:"M22 13h-4",key:"1jl80f"}],["path",{d:"M17.2 17c2.1.1 3.8 1.9 3.8 4",key:"k3fwyw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ai=U("Building2",[["path",{d:"M6 22V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v18Z",key:"1b4qmf"}],["path",{d:"M6 12H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h2",key:"i71pzd"}],["path",{d:"M18 9h2a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2h-2",key:"10jefs"}],["path",{d:"M10 6h4",key:"1itunk"}],["path",{d:"M10 10h4",key:"tcdvrf"}],["path",{d:"M10 14h4",key:"kelpxr"}],["path",{d:"M10 18h4",key:"1ulq68"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lj=U("Building",[["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",ry:"2",key:"76otgf"}],["path",{d:"M9 22v-4h6v4",key:"r93iot"}],["path",{d:"M8 6h.01",key:"1dz90k"}],["path",{d:"M16 6h.01",key:"1x0f13"}],["path",{d:"M12 6h.01",key:"1vi96p"}],["path",{d:"M12 10h.01",key:"1nrarc"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M16 10h.01",key:"1m94wz"}],["path",{d:"M16 14h.01",key:"1gbofw"}],["path",{d:"M8 10h.01",key:"19clt8"}],["path",{d:"M8 14h.01",key:"6423bh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const WR=U("BusFront",[["path",{d:"M4 6 2 7",key:"1mqr15"}],["path",{d:"M10 6h4",key:"1itunk"}],["path",{d:"m22 7-2-1",key:"1umjhc"}],["rect",{width:"16",height:"16",x:"4",y:"3",rx:"2",key:"1wxw4b"}],["path",{d:"M4 11h16",key:"mpoxn0"}],["path",{d:"M8 15h.01",key:"a7atzg"}],["path",{d:"M16 15h.01",key:"rnfrdf"}],["path",{d:"M6 19v2",key:"1loha6"}],["path",{d:"M18 21v-2",key:"sqyl04"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const GR=U("Bus",[["path",{d:"M8 6v6",key:"18i7km"}],["path",{d:"M15 6v6",key:"1sg6z9"}],["path",{d:"M2 12h19.6",key:"de5uta"}],["path",{d:"M18 18h3s.5-1.7.8-2.8c.1-.4.2-.8.2-1.2 0-.4-.1-.8-.2-1.2l-1.4-5C20.1 6.8 19.1 6 18 6H4a2 2 0 0 0-2 2v10h3",key:"1wwztk"}],["circle",{cx:"7",cy:"18",r:"2",key:"19iecd"}],["path",{d:"M9 18h5",key:"lrx6i"}],["circle",{cx:"16",cy:"18",r:"2",key:"1v4tcr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const KR=U("CableCar",[["path",{d:"M10 3h.01",key:"lbucoy"}],["path",{d:"M14 2h.01",key:"1k8aa1"}],["path",{d:"m2 9 20-5",key:"1kz0j5"}],["path",{d:"M12 12V6.5",key:"1vbrij"}],["rect",{width:"16",height:"10",x:"4",y:"12",rx:"3",key:"if91er"}],["path",{d:"M9 12v5",key:"3anwtq"}],["path",{d:"M15 12v5",key:"5xh3zn"}],["path",{d:"M4 17h16",key:"g4d7ey"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ZR=U("Cable",[["path",{d:"M17 21v-2a1 1 0 0 1-1-1v-1a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v1a1 1 0 0 1-1 1",key:"10bnsj"}],["path",{d:"M19 15V6.5a1 1 0 0 0-7 0v11a1 1 0 0 1-7 0V9",key:"1eqmu1"}],["path",{d:"M21 21v-2h-4",key:"14zm7j"}],["path",{d:"M3 5h4V3",key:"z442eg"}],["path",{d:"M7 5a1 1 0 0 1 1 1v1a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V6a1 1 0 0 1 1-1V3",key:"ebdjd7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const YR=U("CakeSlice",[["circle",{cx:"9",cy:"7",r:"2",key:"1305pl"}],["path",{d:"M7.2 7.9 3 11v9c0 .6.4 1 1 1h16c.6 0 1-.4 1-1v-9c0-2-3-6-7-8l-3.6 2.6",key:"xle13f"}],["path",{d:"M16 13H3",key:"1wpj08"}],["path",{d:"M16 17H3",key:"3lvfcd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Qh=U("Cake",[["path",{d:"M20 21v-8a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v8",key:"1w3rig"}],["path",{d:"M4 16s.5-1 2-1 2.5 2 4 2 2.5-2 4-2 2.5 2 4 2 2-1 2-1",key:"n2jgmb"}],["path",{d:"M2 21h20",key:"1nyx9w"}],["path",{d:"M7 8v3",key:"1qtyvj"}],["path",{d:"M12 8v3",key:"hwp4zt"}],["path",{d:"M17 8v3",key:"1i6e5u"}],["path",{d:"M7 4h.01",key:"1bh4kh"}],["path",{d:"M12 4h.01",key:"1ujb9j"}],["path",{d:"M17 4h.01",key:"1upcoc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const XR=U("Calculator",[["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",key:"1nb95v"}],["line",{x1:"8",x2:"16",y1:"6",y2:"6",key:"x4nwl0"}],["line",{x1:"16",x2:"16",y1:"14",y2:"18",key:"wjye3r"}],["path",{d:"M16 10h.01",key:"1m94wz"}],["path",{d:"M12 10h.01",key:"1nrarc"}],["path",{d:"M8 10h.01",key:"19clt8"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M8 14h.01",key:"6423bh"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M8 18h.01",key:"lrp35t"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const QR=U("Calendar1",[["path",{d:"M11 14h1v4",key:"fy54vd"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 2v4",key:"1cmpym"}],["rect",{x:"3",y:"4",width:"18",height:"18",rx:"2",key:"12vinp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const JR=U("CalendarArrowDown",[["path",{d:"m14 18 4 4 4-4",key:"1waygx"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M18 14v8",key:"irew45"}],["path",{d:"M21 11.354V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h7.343",key:"bse4f3"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 2v4",key:"1cmpym"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const eF=U("CalendarArrowUp",[["path",{d:"m14 18 4-4 4 4",key:"ftkppy"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M18 22v-8",key:"su0gjh"}],["path",{d:"M21 11.343V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h9",key:"1exg90"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 2v4",key:"1cmpym"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tF=U("CalendarCheck2",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M21 14V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h8",key:"bce9hv"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"m16 20 2 2 4-4",key:"13tcca"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rF=U("CalendarCheck",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"m9 16 2 2 4-4",key:"19s6y9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nF=U("CalendarClock",[["path",{d:"M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5",key:"1osxxc"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M3 10h5",key:"r794hk"}],["path",{d:"M17.5 17.5 16 16.3V14",key:"akvzfd"}],["circle",{cx:"16",cy:"16",r:"6",key:"qoo3c4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sF=U("CalendarCog",[["path",{d:"m15.2 16.9-.9-.4",key:"1r0w5f"}],["path",{d:"m15.2 19.1-.9.4",key:"j188fs"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"m16.9 15.2-.4-.9",key:"699xu"}],["path",{d:"m16.9 20.8-.4.9",key:"dfjc4z"}],["path",{d:"m19.5 14.3-.4.9",key:"1eb35c"}],["path",{d:"m19.5 21.7-.4-.9",key:"1tonu5"}],["path",{d:"M21 10.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h6",key:"11kmuh"}],["path",{d:"m21.7 16.5-.9.4",key:"1knoei"}],["path",{d:"m21.7 19.5-.9-.4",key:"q4dx6b"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 2v4",key:"1cmpym"}],["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hm=U("CalendarDays",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 14h.01",key:"6423bh"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M16 14h.01",key:"1gbofw"}],["path",{d:"M8 18h.01",key:"lrp35t"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M16 18h.01",key:"kzsmim"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const aF=U("CalendarFold",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M21 17V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h11Z",key:"kg77oy"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M15 22v-4a2 2 0 0 1 2-2h4",key:"1gnbqr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const iF=U("CalendarHeart",[["path",{d:"M3 10h18V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h7",key:"136lmk"}],["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M21.29 14.7a2.43 2.43 0 0 0-2.65-.52c-.3.12-.57.3-.8.53l-.34.34-.35-.34a2.43 2.43 0 0 0-2.65-.53c-.3.12-.56.3-.79.53-.95.94-1 2.53.2 3.74L17.5 22l3.6-3.55c1.2-1.21 1.14-2.8.19-3.74Z",key:"1t7hil"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oF=U("CalendarMinus2",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M10 16h4",key:"17e571"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lF=U("CalendarMinus",[["path",{d:"M16 19h6",key:"xwg31i"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M21 15V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h8.5",key:"1scpom"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 2v4",key:"1cmpym"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cF=U("CalendarOff",[["path",{d:"M4.2 4.2A2 2 0 0 0 3 6v14a2 2 0 0 0 2 2h14a2 2 0 0 0 1.82-1.18",key:"16swn3"}],["path",{d:"M21 15.5V6a2 2 0 0 0-2-2H9.5",key:"yhw86o"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M3 10h7",key:"1wap6i"}],["path",{d:"M21 10h-5.5",key:"quycpq"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dF=U("CalendarPlus2",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M10 16h4",key:"17e571"}],["path",{d:"M12 14v4",key:"1thi36"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cj=U("CalendarPlus",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M21 13V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h8",key:"3spt84"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M16 19h6",key:"xwg31i"}],["path",{d:"M19 16v6",key:"tddt3s"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uF=U("CalendarRange",[["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M17 14h-6",key:"bkmgh3"}],["path",{d:"M13 18H7",key:"bb0bb7"}],["path",{d:"M7 14h.01",key:"1qa3f1"}],["path",{d:"M17 18h.01",key:"1bdyru"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hF=U("CalendarSearch",[["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M21 11.75V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h7.25",key:"1jrsq6"}],["path",{d:"m22 22-1.875-1.875",key:"13zax7"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 2v4",key:"1cmpym"}],["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fF=U("CalendarSync",[["path",{d:"M11 10v4h4",key:"172dkj"}],["path",{d:"m11 14 1.535-1.605a5 5 0 0 1 8 1.5",key:"vu0qm5"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"m21 18-1.535 1.605a5 5 0 0 1-8-1.5",key:"1qgeyt"}],["path",{d:"M21 22v-4h-4",key:"hrummi"}],["path",{d:"M21 8.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h4.3",key:"mctw84"}],["path",{d:"M3 10h4",key:"1el30a"}],["path",{d:"M8 2v4",key:"1cmpym"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pF=U("CalendarX2",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M21 13V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h8",key:"3spt84"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"m17 22 5-5",key:"1k6ppv"}],["path",{d:"m17 17 5 5",key:"p7ous7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mF=U("CalendarX",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"m14 14-4 4",key:"rymu2i"}],["path",{d:"m10 14 4 4",key:"3sz06r"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zs=U("Calendar",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gF=U("CameraOff",[["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}],["path",{d:"M7 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16",key:"qmtpty"}],["path",{d:"M9.5 4h5L17 7h3a2 2 0 0 1 2 2v7.5",key:"1ufyfc"}],["path",{d:"M14.121 15.121A3 3 0 1 1 9.88 10.88",key:"11zox6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xg=U("Camera",[["path",{d:"M14.5 4h-5L7 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3l-2.5-3z",key:"1tc9qg"}],["circle",{cx:"12",cy:"13",r:"3",key:"1vg3eu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xF=U("CandyCane",[["path",{d:"M5.7 21a2 2 0 0 1-3.5-2l8.6-14a6 6 0 0 1 10.4 6 2 2 0 1 1-3.464-2 2 2 0 1 0-3.464-2Z",key:"isaq8g"}],["path",{d:"M17.75 7 15 2.1",key:"12x7e8"}],["path",{d:"M10.9 4.8 13 9",key:"100a87"}],["path",{d:"m7.9 9.7 2 4.4",key:"ntfhaj"}],["path",{d:"M4.9 14.7 7 18.9",key:"1x43jy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yF=U("CandyOff",[["path",{d:"m8.5 8.5-1 1a4.95 4.95 0 0 0 7 7l1-1",key:"1ff4ui"}],["path",{d:"M11.843 6.187A4.947 4.947 0 0 1 16.5 7.5a4.947 4.947 0 0 1 1.313 4.657",key:"1sbrv4"}],["path",{d:"M14 16.5V14",key:"1maf8j"}],["path",{d:"M14 6.5v1.843",key:"1a6u6t"}],["path",{d:"M10 10v7.5",key:"80pj65"}],["path",{d:"m16 7 1-5 1.367.683A3 3 0 0 0 19.708 3H21v1.292a3 3 0 0 0 .317 1.341L22 7l-5 1",key:"11a9mt"}],["path",{d:"m8 17-1 5-1.367-.683A3 3 0 0 0 4.292 21H3v-1.292a3 3 0 0 0-.317-1.341L2 17l5-1",key:"3mjmon"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vF=U("Candy",[["path",{d:"m9.5 7.5-2 2a4.95 4.95 0 1 0 7 7l2-2a4.95 4.95 0 1 0-7-7Z",key:"ue6khb"}],["path",{d:"M14 6.5v10",key:"5xnk7c"}],["path",{d:"M10 7.5v10",key:"1uew51"}],["path",{d:"m16 7 1-5 1.37.68A3 3 0 0 0 19.7 3H21v1.3c0 .46.1.92.32 1.33L22 7l-5 1",key:"b9cp6k"}],["path",{d:"m8 17-1 5-1.37-.68A3 3 0 0 0 4.3 21H3v-1.3a3 3 0 0 0-.32-1.33L2 17l5-1",key:"5lney8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _F=U("Cannabis",[["path",{d:"M12 22v-4",key:"1utk9m"}],["path",{d:"M7 12c-1.5 0-4.5 1.5-5 3 3.5 1.5 6 1 6 1-1.5 1.5-2 3.5-2 5 2.5 0 4.5-1.5 6-3 1.5 1.5 3.5 3 6 3 0-1.5-.5-3.5-2-5 0 0 2.5.5 6-1-.5-1.5-3.5-3-5-3 1.5-1 4-4 4-6-2.5 0-5.5 1.5-7 3 0-2.5-.5-5-2-7-1.5 2-2 4.5-2 7-1.5-1.5-4.5-3-7-3 0 2 2.5 5 4 6",key:"1mezod"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bF=U("CaptionsOff",[["path",{d:"M10.5 5H19a2 2 0 0 1 2 2v8.5",key:"jqtk4d"}],["path",{d:"M17 11h-.5",key:"1961ue"}],["path",{d:"M19 19H5a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2",key:"1keqsi"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M7 11h4",key:"1o1z6v"}],["path",{d:"M7 15h2.5",key:"1ina1g"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const C_=U("Captions",[["rect",{width:"18",height:"14",x:"3",y:"5",rx:"2",ry:"2",key:"12ruh7"}],["path",{d:"M7 15h4M15 15h2M7 11h2M13 11h4",key:"1ueiar"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wF=U("CarFront",[["path",{d:"m21 8-2 2-1.5-3.7A2 2 0 0 0 15.646 5H8.4a2 2 0 0 0-1.903 1.257L5 10 3 8",key:"1imjwt"}],["path",{d:"M7 14h.01",key:"1qa3f1"}],["path",{d:"M17 14h.01",key:"7oqj8z"}],["rect",{width:"18",height:"8",x:"3",y:"10",rx:"2",key:"a7itu8"}],["path",{d:"M5 18v2",key:"ppbyun"}],["path",{d:"M19 18v2",key:"gy7782"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jF=U("CarTaxiFront",[["path",{d:"M10 2h4",key:"n1abiw"}],["path",{d:"m21 8-2 2-1.5-3.7A2 2 0 0 0 15.646 5H8.4a2 2 0 0 0-1.903 1.257L5 10 3 8",key:"1imjwt"}],["path",{d:"M7 14h.01",key:"1qa3f1"}],["path",{d:"M17 14h.01",key:"7oqj8z"}],["rect",{width:"18",height:"8",x:"3",y:"10",rx:"2",key:"a7itu8"}],["path",{d:"M5 18v2",key:"ppbyun"}],["path",{d:"M19 18v2",key:"gy7782"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kF=U("Car",[["path",{d:"M19 17h2c.6 0 1-.4 1-1v-3c0-.9-.7-1.7-1.5-1.9C18.7 10.6 16 10 16 10s-1.3-1.4-2.2-2.3c-.5-.4-1.1-.7-1.8-.7H5c-.6 0-1.1.4-1.4.9l-1.4 2.9A3.7 3.7 0 0 0 2 12v4c0 .6.4 1 1 1h2",key:"5owen"}],["circle",{cx:"7",cy:"17",r:"2",key:"u2ysq9"}],["path",{d:"M9 17h6",key:"r8uit2"}],["circle",{cx:"17",cy:"17",r:"2",key:"axvx0g"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const NF=U("Caravan",[["path",{d:"M18 19V9a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v8a2 2 0 0 0 2 2h2",key:"19jm3t"}],["path",{d:"M2 9h3a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1H2",key:"13hakp"}],["path",{d:"M22 17v1a1 1 0 0 1-1 1H10v-9a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v9",key:"1crci8"}],["circle",{cx:"8",cy:"19",r:"2",key:"t8fc5s"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const SF=U("Carrot",[["path",{d:"M2.27 21.7s9.87-3.5 12.73-6.36a4.5 4.5 0 0 0-6.36-6.37C5.77 11.84 2.27 21.7 2.27 21.7zM8.64 14l-2.05-2.04M15.34 15l-2.46-2.46",key:"rfqxbe"}],["path",{d:"M22 9s-1.33-2-3.5-2C16.86 7 15 9 15 9s1.33 2 3.5 2S22 9 22 9z",key:"6b25w4"}],["path",{d:"M15 2s-2 1.33-2 3.5S15 9 15 9s2-1.84 2-3.5C17 3.33 15 2 15 2z",key:"fn65lo"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const CF=U("CaseLower",[["circle",{cx:"7",cy:"12",r:"3",key:"12clwm"}],["path",{d:"M10 9v6",key:"17i7lo"}],["circle",{cx:"17",cy:"12",r:"3",key:"gl7c2s"}],["path",{d:"M14 7v8",key:"dl84cr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const MF=U("CaseSensitive",[["path",{d:"m3 15 4-8 4 8",key:"1vwr6u"}],["path",{d:"M4 13h6",key:"1r9ots"}],["circle",{cx:"18",cy:"12",r:"3",key:"1kchzo"}],["path",{d:"M21 9v6",key:"anns31"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const TF=U("CaseUpper",[["path",{d:"m3 15 4-8 4 8",key:"1vwr6u"}],["path",{d:"M4 13h6",key:"1r9ots"}],["path",{d:"M15 11h4.5a2 2 0 0 1 0 4H15V7h4a2 2 0 0 1 0 4",key:"1sqfas"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const AF=U("CassetteTape",[["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["circle",{cx:"8",cy:"10",r:"2",key:"1xl4ub"}],["path",{d:"M8 12h8",key:"1wcyev"}],["circle",{cx:"16",cy:"10",r:"2",key:"r14t7q"}],["path",{d:"m6 20 .7-2.9A1.4 1.4 0 0 1 8.1 16h7.8a1.4 1.4 0 0 1 1.4 1l.7 3",key:"l01ucn"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const EF=U("Cast",[["path",{d:"M2 8V6a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2h-6",key:"3zrzxg"}],["path",{d:"M2 12a9 9 0 0 1 8 8",key:"g6cvee"}],["path",{d:"M2 16a5 5 0 0 1 4 4",key:"1y1dii"}],["line",{x1:"2",x2:"2.01",y1:"20",y2:"20",key:"xu2jvo"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const IF=U("Castle",[["path",{d:"M22 20v-9H2v9a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2Z",key:"109fe4"}],["path",{d:"M18 11V4H6v7",key:"mon5oj"}],["path",{d:"M15 22v-4a3 3 0 0 0-3-3a3 3 0 0 0-3 3v4",key:"1k4jtn"}],["path",{d:"M22 11V9",key:"3zbp94"}],["path",{d:"M2 11V9",key:"1x5rnq"}],["path",{d:"M6 4V2",key:"1rsq15"}],["path",{d:"M18 4V2",key:"1jsdo1"}],["path",{d:"M10 4V2",key:"75d9ly"}],["path",{d:"M14 4V2",key:"8nj3z6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const PF=U("Cat",[["path",{d:"M12 5c.67 0 1.35.09 2 .26 1.78-2 5.03-2.84 6.42-2.26 1.4.58-.42 7-.42 7 .57 1.07 1 2.24 1 3.44C21 17.9 16.97 21 12 21s-9-3-9-7.56c0-1.25.5-2.4 1-3.44 0 0-1.89-6.42-.5-7 1.39-.58 4.72.23 6.5 2.23A9.04 9.04 0 0 1 12 5Z",key:"x6xyqk"}],["path",{d:"M8 14v.5",key:"1nzgdb"}],["path",{d:"M16 14v.5",key:"1lajdz"}],["path",{d:"M11.25 16.25h1.5L12 17l-.75-.75Z",key:"12kq1m"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const LF=U("Cctv",[["path",{d:"M16.75 12h3.632a1 1 0 0 1 .894 1.447l-2.034 4.069a1 1 0 0 1-1.708.134l-2.124-2.97",key:"ir91b5"}],["path",{d:"M17.106 9.053a1 1 0 0 1 .447 1.341l-3.106 6.211a1 1 0 0 1-1.342.447L3.61 12.3a2.92 2.92 0 0 1-1.3-3.91L3.69 5.6a2.92 2.92 0 0 1 3.92-1.3z",key:"jlp8i1"}],["path",{d:"M2 19h3.76a2 2 0 0 0 1.8-1.1L9 15",key:"19bib8"}],["path",{d:"M2 21v-4",key:"l40lih"}],["path",{d:"M7 9h.01",key:"19b3jx"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const M_=U("ChartArea",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M7 11.207a.5.5 0 0 1 .146-.353l2-2a.5.5 0 0 1 .708 0l3.292 3.292a.5.5 0 0 0 .708 0l4.292-4.292a.5.5 0 0 1 .854.353V16a1 1 0 0 1-1 1H8a1 1 0 0 1-1-1z",key:"q0gr47"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const T_=U("ChartBarBig",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["rect",{x:"7",y:"13",width:"9",height:"4",rx:"1",key:"1iip1u"}],["rect",{x:"7",y:"5",width:"12",height:"4",rx:"1",key:"1anskk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const OF=U("ChartBarDecreasing",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M7 11h8",key:"1feolt"}],["path",{d:"M7 16h3",key:"ur6vzw"}],["path",{d:"M7 6h12",key:"sz5b0d"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const DF=U("ChartBarIncreasing",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M7 11h8",key:"1feolt"}],["path",{d:"M7 16h12",key:"wsnu98"}],["path",{d:"M7 6h3",key:"w9rmul"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const RF=U("ChartBarStacked",[["path",{d:"M11 13v4",key:"vyy2rb"}],["path",{d:"M15 5v4",key:"1gx88a"}],["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["rect",{x:"7",y:"13",width:"9",height:"4",rx:"1",key:"1iip1u"}],["rect",{x:"7",y:"5",width:"12",height:"4",rx:"1",key:"1anskk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const A_=U("ChartBar",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M7 16h8",key:"srdodz"}],["path",{d:"M7 11h12",key:"127s9w"}],["path",{d:"M7 6h3",key:"w9rmul"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const E_=U("ChartCandlestick",[["path",{d:"M9 5v4",key:"14uxtq"}],["rect",{width:"4",height:"6",x:"7",y:"9",rx:"1",key:"f4fvz0"}],["path",{d:"M9 15v2",key:"r5rk32"}],["path",{d:"M17 3v2",key:"1l2re6"}],["rect",{width:"4",height:"8",x:"15",y:"5",rx:"1",key:"z38je5"}],["path",{d:"M17 13v3",key:"5l0wba"}],["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const I_=U("ChartColumnBig",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["rect",{x:"15",y:"5",width:"4",height:"12",rx:"1",key:"q8uenq"}],["rect",{x:"7",y:"8",width:"4",height:"9",rx:"1",key:"sr5ea"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const FF=U("ChartColumnDecreasing",[["path",{d:"M13 17V9",key:"1fwyjl"}],["path",{d:"M18 17v-3",key:"1sqioe"}],["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M8 17V5",key:"1wzmnc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const P_=U("ChartColumnIncreasing",[["path",{d:"M13 17V9",key:"1fwyjl"}],["path",{d:"M18 17V5",key:"sfb6ij"}],["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M8 17v-3",key:"17ska0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zF=U("ChartColumnStacked",[["path",{d:"M11 13H7",key:"t0o9gq"}],["path",{d:"M19 9h-4",key:"rera1j"}],["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["rect",{x:"15",y:"5",width:"4",height:"12",rx:"1",key:"q8uenq"}],["rect",{x:"7",y:"8",width:"4",height:"9",rx:"1",key:"sr5ea"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cc=U("ChartColumn",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const BF=U("ChartGantt",[["path",{d:"M10 6h8",key:"zvc2xc"}],["path",{d:"M12 16h6",key:"yi5mkt"}],["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M8 11h7",key:"wz2hg0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const L_=U("ChartLine",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"m19 9-5 5-4-4-3 3",key:"2osh9i"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $F=U("ChartNetwork",[["path",{d:"m13.11 7.664 1.78 2.672",key:"go2gg9"}],["path",{d:"m14.162 12.788-3.324 1.424",key:"11x848"}],["path",{d:"m20 4-6.06 1.515",key:"1wxxh7"}],["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["circle",{cx:"12",cy:"6",r:"2",key:"1jj5th"}],["circle",{cx:"16",cy:"12",r:"2",key:"4ma0v8"}],["circle",{cx:"9",cy:"15",r:"2",key:"lf2ghp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const UF=U("ChartNoAxesColumnDecreasing",[["path",{d:"M12 20V10",key:"g8npz5"}],["path",{d:"M18 20v-4",key:"8uic4z"}],["path",{d:"M6 20V4",key:"1w1bmo"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const O_=U("ChartNoAxesColumnIncreasing",[["line",{x1:"12",x2:"12",y1:"20",y2:"10",key:"1vz5eb"}],["line",{x1:"18",x2:"18",y1:"20",y2:"4",key:"cun8e5"}],["line",{x1:"6",x2:"6",y1:"20",y2:"16",key:"hq0ia6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const D_=U("ChartNoAxesColumn",[["line",{x1:"18",x2:"18",y1:"20",y2:"10",key:"1xfpm4"}],["line",{x1:"12",x2:"12",y1:"20",y2:"4",key:"be30l9"}],["line",{x1:"6",x2:"6",y1:"20",y2:"14",key:"1r4le6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qF=U("ChartNoAxesCombined",[["path",{d:"M12 16v5",key:"zza2cw"}],["path",{d:"M16 14v7",key:"1g90b9"}],["path",{d:"M20 10v11",key:"1iqoj0"}],["path",{d:"m22 3-8.646 8.646a.5.5 0 0 1-.708 0L9.354 8.354a.5.5 0 0 0-.707 0L2 15",key:"1fw8x9"}],["path",{d:"M4 18v3",key:"1yp0dc"}],["path",{d:"M8 14v7",key:"n3cwzv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const R_=U("ChartNoAxesGantt",[["path",{d:"M8 6h10",key:"9lnwnk"}],["path",{d:"M6 12h9",key:"1g9pqf"}],["path",{d:"M11 18h7",key:"c8dzvl"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const F_=U("ChartPie",[["path",{d:"M21 12c.552 0 1.005-.449.95-.998a10 10 0 0 0-8.953-8.951c-.55-.055-.998.398-.998.95v8a1 1 0 0 0 1 1z",key:"pzmjnu"}],["path",{d:"M21.21 15.89A10 10 0 1 1 8 2.83",key:"k2fpak"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const z_=U("ChartScatter",[["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}],["circle",{cx:"18.5",cy:"5.5",r:".5",fill:"currentColor",key:"lysivs"}],["circle",{cx:"11.5",cy:"11.5",r:".5",fill:"currentColor",key:"byv1b8"}],["circle",{cx:"7.5",cy:"16.5",r:".5",fill:"currentColor",key:"nkw3mc"}],["circle",{cx:"17.5",cy:"14.5",r:".5",fill:"currentColor",key:"1gjh6j"}],["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const VF=U("ChartSpline",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M7 16c.5-2 1.5-7 4-7 2 0 2 3 4 3 2.5 0 4.5-5 5-7",key:"lw07rv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const HF=U("CheckCheck",[["path",{d:"M18 6 7 17l-5-5",key:"116fxf"}],["path",{d:"m22 10-7.5 7.5L13 16",key:"ke71qq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ai=U("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const WF=U("ChefHat",[["path",{d:"M17 21a1 1 0 0 0 1-1v-5.35c0-.457.316-.844.727-1.041a4 4 0 0 0-2.134-7.589 5 5 0 0 0-9.186 0 4 4 0 0 0-2.134 7.588c.411.198.727.585.727 1.041V20a1 1 0 0 0 1 1Z",key:"1qvrer"}],["path",{d:"M6 17h12",key:"1jwigz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const GF=U("Cherry",[["path",{d:"M2 17a5 5 0 0 0 10 0c0-2.76-2.5-5-5-3-2.5-2-5 .24-5 3Z",key:"cvxqlc"}],["path",{d:"M12 17a5 5 0 0 0 10 0c0-2.76-2.5-5-5-3-2.5-2-5 .24-5 3Z",key:"1ostrc"}],["path",{d:"M7 14c3.22-2.91 4.29-8.75 5-12 1.66 2.38 4.94 9 5 12",key:"hqx58h"}],["path",{d:"M22 9c-4.29 0-7.14-2.33-10-7 5.71 0 10 4.67 10 7Z",key:"eykp1o"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Dd=U("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const KF=U("ChevronFirst",[["path",{d:"m17 18-6-6 6-6",key:"1yerx2"}],["path",{d:"M7 6v12",key:"1p53r6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ZF=U("ChevronLast",[["path",{d:"m7 18 6-6-6-6",key:"lwmzdw"}],["path",{d:"M17 6v12",key:"1o0aio"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Tc=U("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Vi=U("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const c1=U("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const YF=U("ChevronsDownUp",[["path",{d:"m7 20 5-5 5 5",key:"13a0gw"}],["path",{d:"m7 4 5 5 5-5",key:"1kwcof"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const XF=U("ChevronsDown",[["path",{d:"m7 6 5 5 5-5",key:"1lc07p"}],["path",{d:"m7 13 5 5 5-5",key:"1d48rs"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const QF=U("ChevronsLeftRightEllipsis",[["path",{d:"m18 8 4 4-4 4",key:"1ak13k"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"M8 12h.01",key:"czm47f"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M16 12h.01",key:"1l6xoz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const JF=U("ChevronsLeftRight",[["path",{d:"m9 7-5 5 5 5",key:"j5w590"}],["path",{d:"m15 7 5 5-5 5",key:"1bl6da"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ez=U("ChevronsLeft",[["path",{d:"m11 17-5-5 5-5",key:"13zhaf"}],["path",{d:"m18 17-5-5 5-5",key:"h8a8et"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tz=U("ChevronsRightLeft",[["path",{d:"m20 17-5-5 5-5",key:"30x0n2"}],["path",{d:"m4 17 5-5-5-5",key:"16spf4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rz=U("ChevronsRight",[["path",{d:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const d1=U("ChevronsUpDown",[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nz=U("ChevronsUp",[["path",{d:"m17 11-5-5-5 5",key:"e8nh98"}],["path",{d:"m17 18-5-5-5 5",key:"2avn1x"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sz=U("Chrome",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["line",{x1:"21.17",x2:"12",y1:"8",y2:"8",key:"a0cw5f"}],["line",{x1:"3.95",x2:"8.54",y1:"6.06",y2:"14",key:"1kftof"}],["line",{x1:"10.88",x2:"15.46",y1:"21.94",y2:"14",key:"1ymyh8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const az=U("Church",[["path",{d:"M10 9h4",key:"u4k05v"}],["path",{d:"M12 7v5",key:"ma6bk"}],["path",{d:"M14 22v-4a2 2 0 0 0-4 0v4",key:"1pdhuj"}],["path",{d:"M18 22V5.618a1 1 0 0 0-.553-.894l-4.553-2.277a2 2 0 0 0-1.788 0L6.553 4.724A1 1 0 0 0 6 5.618V22",key:"1rkokr"}],["path",{d:"m18 7 3.447 1.724a1 1 0 0 1 .553.894V20a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9.618a1 1 0 0 1 .553-.894L6 7",key:"1w6esw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const iz=U("CigaretteOff",[["path",{d:"M12 12H3a1 1 0 0 0-1 1v2a1 1 0 0 0 1 1h13",key:"1gdiyg"}],["path",{d:"M18 8c0-2.5-2-2.5-2-5",key:"1il607"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M21 12a1 1 0 0 1 1 1v2a1 1 0 0 1-.5.866",key:"166zjj"}],["path",{d:"M22 8c0-2.5-2-2.5-2-5",key:"1gah44"}],["path",{d:"M7 12v4",key:"jqww69"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oz=U("Cigarette",[["path",{d:"M17 12H3a1 1 0 0 0-1 1v2a1 1 0 0 0 1 1h14",key:"1mb5g1"}],["path",{d:"M18 8c0-2.5-2-2.5-2-5",key:"1il607"}],["path",{d:"M21 16a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1",key:"1yl5r7"}],["path",{d:"M22 8c0-2.5-2-2.5-2-5",key:"1gah44"}],["path",{d:"M7 12v4",key:"jqww69"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Il=U("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const B_=U("CircleArrowDown",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 8v8",key:"napkw2"}],["path",{d:"m8 12 4 4 4-4",key:"k98ssh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $_=U("CircleArrowLeft",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M16 12H8",key:"1fr5h0"}],["path",{d:"m12 8-4 4 4 4",key:"15vm53"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const U_=U("CircleArrowOutDownLeft",[["path",{d:"M2 12a10 10 0 1 1 10 10",key:"1yn6ov"}],["path",{d:"m2 22 10-10",key:"28ilpk"}],["path",{d:"M8 22H2v-6",key:"sulq54"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const q_=U("CircleArrowOutDownRight",[["path",{d:"M12 22a10 10 0 1 1 10-10",key:"130bv5"}],["path",{d:"M22 22 12 12",key:"131aw7"}],["path",{d:"M22 16v6h-6",key:"1gvm70"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const V_=U("CircleArrowOutUpLeft",[["path",{d:"M2 8V2h6",key:"hiwtdz"}],["path",{d:"m2 2 10 10",key:"1oh8rs"}],["path",{d:"M12 2A10 10 0 1 1 2 12",key:"rrk4fa"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const H_=U("CircleArrowOutUpRight",[["path",{d:"M22 12A10 10 0 1 1 12 2",key:"1fm58d"}],["path",{d:"M22 2 12 12",key:"yg2myt"}],["path",{d:"M16 2h6v6",key:"zan5cs"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const W_=U("CircleArrowRight",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"m12 16 4-4-4-4",key:"1i9zcv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const G_=U("CircleArrowUp",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 12-4-4-4 4",key:"177agl"}],["path",{d:"M12 16V8",key:"1sbj14"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Yi=U("CircleCheckBig",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Xi=U("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const K_=U("CircleChevronDown",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 10-4 4-4-4",key:"894hmk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Z_=U("CircleChevronLeft",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m14 16-4-4 4-4",key:"ojs7w8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Y_=U("CircleChevronRight",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m10 8 4 4-4 4",key:"1wy4r4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const X_=U("CircleChevronUp",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m8 14 4-4 4 4",key:"fy2ptz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lz=U("CircleDashed",[["path",{d:"M10.1 2.182a10 10 0 0 1 3.8 0",key:"5ilxe3"}],["path",{d:"M13.9 21.818a10 10 0 0 1-3.8 0",key:"11zvb9"}],["path",{d:"M17.609 3.721a10 10 0 0 1 2.69 2.7",key:"1iw5b2"}],["path",{d:"M2.182 13.9a10 10 0 0 1 0-3.8",key:"c0bmvh"}],["path",{d:"M20.279 17.609a10 10 0 0 1-2.7 2.69",key:"1ruxm7"}],["path",{d:"M21.818 10.1a10 10 0 0 1 0 3.8",key:"qkgqxc"}],["path",{d:"M3.721 6.391a10 10 0 0 1 2.7-2.69",key:"1mcia2"}],["path",{d:"M6.391 20.279a10 10 0 0 1-2.69-2.7",key:"1fvljs"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Q_=U("CircleDivide",[["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}],["line",{x1:"12",x2:"12",y1:"16",y2:"16",key:"aqc6ln"}],["line",{x1:"12",x2:"12",y1:"8",y2:"8",key:"1mkcni"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cz=U("CircleDollarSign",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M16 8h-6a2 2 0 1 0 0 4h4a2 2 0 1 1 0 4H8",key:"1h4pet"}],["path",{d:"M12 18V6",key:"zqpxq5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dz=U("CircleDotDashed",[["path",{d:"M10.1 2.18a9.93 9.93 0 0 1 3.8 0",key:"1qdqn0"}],["path",{d:"M17.6 3.71a9.95 9.95 0 0 1 2.69 2.7",key:"1bq7p6"}],["path",{d:"M21.82 10.1a9.93 9.93 0 0 1 0 3.8",key:"1rlaqf"}],["path",{d:"M20.29 17.6a9.95 9.95 0 0 1-2.7 2.69",key:"1xk03u"}],["path",{d:"M13.9 21.82a9.94 9.94 0 0 1-3.8 0",key:"l7re25"}],["path",{d:"M6.4 20.29a9.95 9.95 0 0 1-2.69-2.7",key:"1v18p6"}],["path",{d:"M2.18 13.9a9.93 9.93 0 0 1 0-3.8",key:"xdo6bj"}],["path",{d:"M3.71 6.4a9.95 9.95 0 0 1 2.7-2.69",key:"1jjmaz"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uz=U("CircleDot",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hz=U("CircleEllipsis",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M17 12h.01",key:"1m0b6t"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M7 12h.01",key:"eqddd0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fz=U("CircleEqual",[["path",{d:"M7 10h10",key:"1101jm"}],["path",{d:"M7 14h10",key:"1mhdw3"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pz=U("CircleFadingArrowUp",[["path",{d:"M12 2a10 10 0 0 1 7.38 16.75",key:"175t95"}],["path",{d:"m16 12-4-4-4 4",key:"177agl"}],["path",{d:"M12 16V8",key:"1sbj14"}],["path",{d:"M2.5 8.875a10 10 0 0 0-.5 3",key:"1vce0s"}],["path",{d:"M2.83 16a10 10 0 0 0 2.43 3.4",key:"o3fkw4"}],["path",{d:"M4.636 5.235a10 10 0 0 1 .891-.857",key:"1szpfk"}],["path",{d:"M8.644 21.42a10 10 0 0 0 7.631-.38",key:"9yhvd4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mz=U("CircleFadingPlus",[["path",{d:"M12 2a10 10 0 0 1 7.38 16.75",key:"175t95"}],["path",{d:"M12 8v8",key:"napkw2"}],["path",{d:"M16 12H8",key:"1fr5h0"}],["path",{d:"M2.5 8.875a10 10 0 0 0-.5 3",key:"1vce0s"}],["path",{d:"M2.83 16a10 10 0 0 0 2.43 3.4",key:"o3fkw4"}],["path",{d:"M4.636 5.235a10 10 0 0 1 .891-.857",key:"1szpfk"}],["path",{d:"M8.644 21.42a10 10 0 0 0 7.631-.38",key:"9yhvd4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const J_=U("CircleGauge",[["path",{d:"M15.6 2.7a10 10 0 1 0 5.7 5.7",key:"1e0p6d"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["path",{d:"M13.4 10.6 19 5",key:"1kr7tw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Nx=U("CircleHelp",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const e2=U("CircleMinus",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gz=U("CircleOff",[["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M8.35 2.69A10 10 0 0 1 21.3 15.65",key:"1pfsoa"}],["path",{d:"M19.08 19.08A10 10 0 1 1 4.92 4.92",key:"1ablyi"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const t2=U("CircleParkingOff",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m5 5 14 14",key:"11anup"}],["path",{d:"M13 13a3 3 0 1 0 0-6H9v2",key:"uoagbd"}],["path",{d:"M9 17v-2.34",key:"a9qo08"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const r2=U("CircleParking",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9 17V7h4a3 3 0 0 1 0 6H9",key:"1dfk2c"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const n2=U("CirclePause",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"10",x2:"10",y1:"15",y2:"9",key:"c1nkhi"}],["line",{x1:"14",x2:"14",y1:"15",y2:"9",key:"h65svq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const s2=U("CirclePercent",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"M9 9h.01",key:"1q5me6"}],["path",{d:"M15 15h.01",key:"lqbp3k"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Bf=U("CirclePlay",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polygon",{points:"10 8 16 12 10 16 10 8",key:"1cimsy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const a2=U("CirclePlus",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const i2=U("CirclePower",[["path",{d:"M12 7v4",key:"xawao1"}],["path",{d:"M7.998 9.003a5 5 0 1 0 8-.005",key:"1pek45"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const o2=U("CircleSlash2",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M22 2 2 22",key:"y4kqgn"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xz=U("CircleSlash",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"9",x2:"15",y1:"15",y2:"9",key:"1dfufj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const l2=U("CircleStop",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["rect",{x:"9",y:"9",width:"6",height:"6",rx:"1",key:"1ssd4o"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const c2=U("CircleUserRound",[["path",{d:"M18 20a6 6 0 0 0-12 0",key:"1qehca"}],["circle",{cx:"12",cy:"10",r:"4",key:"1h16sb"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const d2=U("CircleUser",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}],["path",{d:"M7 20.662V19a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v1.662",key:"154egf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qc=U("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ru=U("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yz=U("CircuitBoard",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M11 9h4a2 2 0 0 0 2-2V3",key:"1ve2rv"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"M7 21v-4a2 2 0 0 1 2-2h4",key:"1fwkro"}],["circle",{cx:"15",cy:"15",r:"2",key:"3i40o0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vz=U("Citrus",[["path",{d:"M21.66 17.67a1.08 1.08 0 0 1-.04 1.6A12 12 0 0 1 4.73 2.38a1.1 1.1 0 0 1 1.61-.04z",key:"4ite01"}],["path",{d:"M19.65 15.66A8 8 0 0 1 8.35 4.34",key:"1gxipu"}],["path",{d:"m14 10-5.5 5.5",key:"92pfem"}],["path",{d:"M14 17.85V10H6.15",key:"xqmtsk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _z=U("Clapperboard",[["path",{d:"M20.2 6 3 11l-.9-2.4c-.3-1.1.3-2.2 1.3-2.5l13.5-4c1.1-.3 2.2.3 2.5 1.3Z",key:"1tn4o7"}],["path",{d:"m6.2 5.3 3.1 3.9",key:"iuk76l"}],["path",{d:"m12.4 3.4 3.1 4",key:"6hsd6n"}],["path",{d:"M3 11h18v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2Z",key:"ltgou9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const MT=U("ClipboardCheck",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"m9 14 2 2 4-4",key:"df797q"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bz=U("ClipboardCopy",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2",key:"4jdomd"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v4",key:"3hqy98"}],["path",{d:"M21 14H11",key:"1bme5i"}],["path",{d:"m15 10-4 4 4 4",key:"5dvupr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const TT=U("ClipboardList",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"M12 11h4",key:"1jrz19"}],["path",{d:"M12 16h4",key:"n85exb"}],["path",{d:"M8 11h.01",key:"1dfujw"}],["path",{d:"M8 16h.01",key:"18s6g9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wz=U("ClipboardMinus",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"M9 14h6",key:"159ibu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jz=U("ClipboardPaste",[["path",{d:"M15 2H9a1 1 0 0 0-1 1v2c0 .6.4 1 1 1h6c.6 0 1-.4 1-1V3c0-.6-.4-1-1-1Z",key:"1pp7kr"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2M16 4h2a2 2 0 0 1 2 2v2M11 14h10",key:"2ik1ml"}],["path",{d:"m17 10 4 4-4 4",key:"vp2hj1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const u2=U("ClipboardPenLine",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",key:"1oijnt"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-.5",key:"1but9f"}],["path",{d:"M16 4h2a2 2 0 0 1 1.73 1",key:"1p8n7l"}],["path",{d:"M8 18h1",key:"13wk12"}],["path",{d:"M21.378 12.626a1 1 0 0 0-3.004-3.004l-4.01 4.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z",key:"2t3380"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const h2=U("ClipboardPen",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",key:"1oijnt"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-5.5",key:"cereej"}],["path",{d:"M4 13.5V6a2 2 0 0 1 2-2h2",key:"5ua5vh"}],["path",{d:"M13.378 15.626a1 1 0 1 0-3.004-3.004l-5.01 5.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z",key:"1y4qbx"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kz=U("ClipboardPlus",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"M9 14h6",key:"159ibu"}],["path",{d:"M12 17v-6",key:"1y8rbf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Nz=U("ClipboardType",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"M9 12v-1h6v1",key:"iehl6m"}],["path",{d:"M11 17h2",key:"12w5me"}],["path",{d:"M12 11v6",key:"1bwqyc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Sz=U("ClipboardX",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"m15 11-6 6",key:"1toa9n"}],["path",{d:"m9 11 6 6",key:"wlibny"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Cz=U("Clipboard",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Mz=U("Clock1",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 14.5 8",key:"12zbmj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Tz=U("Clock10",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 8 10",key:"atfzqc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Az=U("Clock11",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 9.5 8",key:"l5bg6f"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ez=U("Clock12",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12",key:"1fub01"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Iz=U("Clock2",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 10",key:"1g230d"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Pz=U("Clock3",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16.5 12",key:"1aq6pp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Lz=U("Clock4",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Oz=U("Clock5",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 14.5 16",key:"1pcbox"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Dz=U("Clock6",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 12 16.5",key:"hb2qv6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Rz=U("Clock7",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 9.5 16",key:"ka3394"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Fz=U("Clock8",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 8 14",key:"tmc9b4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zz=U("Clock9",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 7.5 12",key:"1k60p0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Bz=U("ClockAlert",[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["path",{d:"M16 21.16a10 10 0 1 1 5-13.516",key:"cxo92l"}],["path",{d:"M20 11.5v6",key:"2ei3xq"}],["path",{d:"M20 21.5h.01",key:"1r2dzp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $z=U("ClockArrowDown",[["path",{d:"M12.338 21.994A10 10 0 1 1 21.925 13.227",key:"1i7shu"}],["path",{d:"M12 6v6l2 1",key:"19cm8n"}],["path",{d:"m14 18 4 4 4-4",key:"1waygx"}],["path",{d:"M18 14v8",key:"irew45"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Uz=U("ClockArrowUp",[["path",{d:"M13.228 21.925A10 10 0 1 1 21.994 12.338",key:"1fzlyi"}],["path",{d:"M12 6v6l1.562.781",key:"1ujuk9"}],["path",{d:"m14 18 4-4 4 4",key:"ftkppy"}],["path",{d:"M18 22v-8",key:"su0gjh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ya=U("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qz=U("CloudAlert",[["path",{d:"M12 12v4",key:"tww15h"}],["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M17 18h.5a1 1 0 0 0 0-9h-1.79A7 7 0 1 0 7 17.708",key:"xsb5ju"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Vz=U("CloudCog",[["circle",{cx:"12",cy:"17",r:"3",key:"1spfwm"}],["path",{d:"M4.2 15.1A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.2",key:"zaobp"}],["path",{d:"m15.7 18.4-.9-.3",key:"4qxpbn"}],["path",{d:"m9.2 15.9-.9-.3",key:"17q7o2"}],["path",{d:"m10.6 20.7.3-.9",key:"1pf4s2"}],["path",{d:"m13.1 14.2.3-.9",key:"1mnuqm"}],["path",{d:"m13.6 20.7-.4-1",key:"1jpd1m"}],["path",{d:"m10.8 14.3-.4-1",key:"17ugyy"}],["path",{d:"m8.3 18.6 1-.4",key:"s42vdx"}],["path",{d:"m14.7 15.8 1-.4",key:"2wizun"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const f2=U("CloudDownload",[["path",{d:"M12 13v8l-4-4",key:"1f5nwf"}],["path",{d:"m12 21 4-4",key:"1lfcce"}],["path",{d:"M4.393 15.269A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.436 8.284",key:"ui1hmy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Hz=U("CloudDrizzle",[["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"M8 19v1",key:"1dk2by"}],["path",{d:"M8 14v1",key:"84yxot"}],["path",{d:"M16 19v1",key:"v220m7"}],["path",{d:"M16 14v1",key:"g12gj6"}],["path",{d:"M12 21v1",key:"q8vafk"}],["path",{d:"M12 16v1",key:"1mx6rx"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Wz=U("CloudFog",[["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"M16 17H7",key:"pygtm1"}],["path",{d:"M17 21H9",key:"1u2q02"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Gz=U("CloudHail",[["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"M16 14v2",key:"a1is7l"}],["path",{d:"M8 14v2",key:"1e9m6t"}],["path",{d:"M16 20h.01",key:"xwek51"}],["path",{d:"M8 20h.01",key:"1vjney"}],["path",{d:"M12 16v2",key:"z66u1j"}],["path",{d:"M12 22h.01",key:"1urd7a"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Kz=U("CloudLightning",[["path",{d:"M6 16.326A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 .5 8.973",key:"1cez44"}],["path",{d:"m13 12-3 5h4l-3 5",key:"1t22er"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Zz=U("CloudMoonRain",[["path",{d:"M10.188 8.5A6 6 0 0 1 16 4a1 1 0 0 0 6 6 6 6 0 0 1-3 5.197",key:"erj67n"}],["path",{d:"M11 20v2",key:"174qtz"}],["path",{d:"M3 20a5 5 0 1 1 8.9-4H13a3 3 0 0 1 2 5.24",key:"1qmrp3"}],["path",{d:"M7 19v2",key:"12npes"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Yz=U("CloudMoon",[["path",{d:"M10.188 8.5A6 6 0 0 1 16 4a1 1 0 0 0 6 6 6 6 0 0 1-3 5.197",key:"erj67n"}],["path",{d:"M13 16a3 3 0 1 1 0 6H7a5 5 0 1 1 4.9-6Z",key:"p44pc9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Xz=U("CloudOff",[["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M5.782 5.782A7 7 0 0 0 9 19h8.5a4.5 4.5 0 0 0 1.307-.193",key:"yfwify"}],["path",{d:"M21.532 16.5A4.5 4.5 0 0 0 17.5 10h-1.79A7.008 7.008 0 0 0 10 5.07",key:"jlfiyv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Qz=U("CloudRainWind",[["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"m9.2 22 3-7",key:"sb5f6j"}],["path",{d:"m9 13-3 7",key:"500co5"}],["path",{d:"m17 13-3 7",key:"8t2fiy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Jz=U("CloudRain",[["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"M16 14v6",key:"1j4efv"}],["path",{d:"M8 14v6",key:"17c4r9"}],["path",{d:"M12 16v6",key:"c8a4gj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const e7=U("CloudSnow",[["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"M8 15h.01",key:"a7atzg"}],["path",{d:"M8 19h.01",key:"puxtts"}],["path",{d:"M12 17h.01",key:"p32p05"}],["path",{d:"M12 21h.01",key:"h35vbk"}],["path",{d:"M16 15h.01",key:"rnfrdf"}],["path",{d:"M16 19h.01",key:"1vcnzz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const t7=U("CloudSunRain",[["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}],["path",{d:"M15.947 12.65a4 4 0 0 0-5.925-4.128",key:"dpwdj0"}],["path",{d:"M3 20a5 5 0 1 1 8.9-4H13a3 3 0 0 1 2 5.24",key:"1qmrp3"}],["path",{d:"M11 20v2",key:"174qtz"}],["path",{d:"M7 19v2",key:"12npes"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const r7=U("CloudSun",[["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}],["path",{d:"M15.947 12.65a4 4 0 0 0-5.925-4.128",key:"dpwdj0"}],["path",{d:"M13 22H7a5 5 0 1 1 4.9-6H13a3 3 0 0 1 0 6Z",key:"s09mg5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const p2=U("CloudUpload",[["path",{d:"M12 13v8",key:"1l5pq0"}],["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"m8 17 4-4 4 4",key:"1quai1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const n7=U("Cloud",[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const s7=U("Cloudy",[["path",{d:"M17.5 21H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"gqqjvc"}],["path",{d:"M22 10a3 3 0 0 0-3-3h-2.207a5.502 5.502 0 0 0-10.702.5",key:"1p2s76"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Px=U("Clover",[["path",{d:"M16.17 7.83 2 22",key:"t58vo8"}],["path",{d:"M4.02 12a2.827 2.827 0 1 1 3.81-4.17A2.827 2.827 0 1 1 12 4.02a2.827 2.827 0 1 1 4.17 3.81A2.827 2.827 0 1 1 19.98 12a2.827 2.827 0 1 1-3.81 4.17A2.827 2.827 0 1 1 12 19.98a2.827 2.827 0 1 1-4.17-3.81A1 1 0 1 1 4 12",key:"17k36q"}],["path",{d:"m7.83 7.83 8.34 8.34",key:"1d7sxk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const a7=U("Club",[["path",{d:"M17.28 9.05a5.5 5.5 0 1 0-10.56 0A5.5 5.5 0 1 0 12 17.66a5.5 5.5 0 1 0 5.28-8.6Z",key:"27yuqz"}],["path",{d:"M12 17.66L12 22",key:"ogfahf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const m2=U("CodeXml",[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dj=U("Code",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const i7=U("Codepen",[["polygon",{points:"12 2 22 8.5 22 15.5 12 22 2 15.5 2 8.5 12 2",key:"srzb37"}],["line",{x1:"12",x2:"12",y1:"22",y2:"15.5",key:"1t73f2"}],["polyline",{points:"22 8.5 12 15.5 2 8.5",key:"ajlxae"}],["polyline",{points:"2 15.5 12 8.5 22 15.5",key:"susrui"}],["line",{x1:"12",x2:"12",y1:"2",y2:"8.5",key:"2cldga"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const o7=U("Codesandbox",[["path",{d:"M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z",key:"yt0hxn"}],["polyline",{points:"7.5 4.21 12 6.81 16.5 4.21",key:"fabo96"}],["polyline",{points:"7.5 19.79 7.5 14.6 3 12",key:"z377f1"}],["polyline",{points:"21 12 16.5 14.6 16.5 19.79",key:"9nrev1"}],["polyline",{points:"3.27 6.96 12 12.01 20.73 6.96",key:"1180pa"}],["line",{x1:"12",x2:"12",y1:"22.08",y2:"12",key:"3z3uq6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uj=U("Coffee",[["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M14 2v2",key:"6buw04"}],["path",{d:"M16 8a1 1 0 0 1 1 1v8a4 4 0 0 1-4 4H7a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1h14a4 4 0 1 1 0 8h-1",key:"pwadti"}],["path",{d:"M6 2v2",key:"colzsn"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const l7=U("Cog",[["path",{d:"M12 20a8 8 0 1 0 0-16 8 8 0 0 0 0 16Z",key:"sobvz5"}],["path",{d:"M12 14a2 2 0 1 0 0-4 2 2 0 0 0 0 4Z",key:"11i496"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 22v-2",key:"1osdcq"}],["path",{d:"m17 20.66-1-1.73",key:"eq3orb"}],["path",{d:"M11 10.27 7 3.34",key:"16pf9h"}],["path",{d:"m20.66 17-1.73-1",key:"sg0v6f"}],["path",{d:"m3.34 7 1.73 1",key:"1ulond"}],["path",{d:"M14 12h8",key:"4f43i9"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"m20.66 7-1.73 1",key:"1ow05n"}],["path",{d:"m3.34 17 1.73-1",key:"nuk764"}],["path",{d:"m17 3.34-1 1.73",key:"2wel8s"}],["path",{d:"m11 13.73-4 6.93",key:"794ttg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const c7=U("Coins",[["circle",{cx:"8",cy:"8",r:"6",key:"3yglwk"}],["path",{d:"M18.09 10.37A6 6 0 1 1 10.34 18",key:"t5s6rm"}],["path",{d:"M7 6h1v4",key:"1obek4"}],["path",{d:"m16.71 13.88.7.71-2.82 2.82",key:"1rbuyh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const g2=U("Columns2",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const x2=U("Columns3",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"M15 3v18",key:"14nvp0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const d7=U("Columns4",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M7.5 3v18",key:"w0wo6v"}],["path",{d:"M12 3v18",key:"108xh3"}],["path",{d:"M16.5 3v18",key:"10tjh1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const u7=U("Combine",[["path",{d:"M10 18H5a3 3 0 0 1-3-3v-1",key:"ru65g8"}],["path",{d:"M14 2a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2",key:"e30een"}],["path",{d:"M20 2a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2",key:"2ahx8o"}],["path",{d:"m7 21 3-3-3-3",key:"127cv2"}],["rect",{x:"14",y:"14",width:"8",height:"8",rx:"2",key:"1b0bso"}],["rect",{x:"2",y:"2",width:"8",height:"8",rx:"2",key:"1x09vl"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const h7=U("Command",[["path",{d:"M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3",key:"11bfej"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const f7=U("Compass",[["path",{d:"m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z",key:"9ktpf1"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const p7=U("Component",[["path",{d:"M15.536 11.293a1 1 0 0 0 0 1.414l2.376 2.377a1 1 0 0 0 1.414 0l2.377-2.377a1 1 0 0 0 0-1.414l-2.377-2.377a1 1 0 0 0-1.414 0z",key:"1uwlt4"}],["path",{d:"M2.297 11.293a1 1 0 0 0 0 1.414l2.377 2.377a1 1 0 0 0 1.414 0l2.377-2.377a1 1 0 0 0 0-1.414L6.088 8.916a1 1 0 0 0-1.414 0z",key:"10291m"}],["path",{d:"M8.916 17.912a1 1 0 0 0 0 1.415l2.377 2.376a1 1 0 0 0 1.414 0l2.377-2.376a1 1 0 0 0 0-1.415l-2.377-2.376a1 1 0 0 0-1.414 0z",key:"1tqoq1"}],["path",{d:"M8.916 4.674a1 1 0 0 0 0 1.414l2.377 2.376a1 1 0 0 0 1.414 0l2.377-2.376a1 1 0 0 0 0-1.414l-2.377-2.377a1 1 0 0 0-1.414 0z",key:"1x6lto"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const m7=U("Computer",[["rect",{width:"14",height:"8",x:"5",y:"2",rx:"2",key:"wc9tft"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",key:"w68u3i"}],["path",{d:"M6 18h2",key:"rwmk9e"}],["path",{d:"M12 18h6",key:"aqd8w3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const g7=U("ConciergeBell",[["path",{d:"M3 20a1 1 0 0 1-1-1v-1a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v1a1 1 0 0 1-1 1Z",key:"1pvr1r"}],["path",{d:"M20 16a8 8 0 1 0-16 0",key:"1pa543"}],["path",{d:"M12 4v4",key:"1bq03y"}],["path",{d:"M10 4h4",key:"1xpv9s"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const x7=U("Cone",[["path",{d:"m20.9 18.55-8-15.98a1 1 0 0 0-1.8 0l-8 15.98",key:"53pte7"}],["ellipse",{cx:"12",cy:"19",rx:"9",ry:"3",key:"1ji25f"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const y7=U("Construction",[["rect",{x:"2",y:"6",width:"20",height:"8",rx:"1",key:"1estib"}],["path",{d:"M17 14v7",key:"7m2elx"}],["path",{d:"M7 14v7",key:"1cm7wv"}],["path",{d:"M17 3v3",key:"1v4jwn"}],["path",{d:"M7 3v3",key:"7o6guu"}],["path",{d:"M10 14 2.3 6.3",key:"1023jk"}],["path",{d:"m14 6 7.7 7.7",key:"1s8pl2"}],["path",{d:"m8 6 8 8",key:"hl96qh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const y2=U("ContactRound",[["path",{d:"M16 2v2",key:"scm5qe"}],["path",{d:"M17.915 22a6 6 0 0 0-12 0",key:"suqz9p"}],["path",{d:"M8 2v2",key:"pbkmx"}],["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["rect",{x:"3",y:"4",width:"18",height:"18",rx:"2",key:"12vinp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const v7=U("Contact",[["path",{d:"M16 2v2",key:"scm5qe"}],["path",{d:"M7 22v-2a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v2",key:"1waht3"}],["path",{d:"M8 2v2",key:"pbkmx"}],["circle",{cx:"12",cy:"11",r:"3",key:"itu57m"}],["rect",{x:"3",y:"4",width:"18",height:"18",rx:"2",key:"12vinp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _7=U("Container",[["path",{d:"M22 7.7c0-.6-.4-1.2-.8-1.5l-6.3-3.9a1.72 1.72 0 0 0-1.7 0l-10.3 6c-.5.2-.9.8-.9 1.4v6.6c0 .5.4 1.2.8 1.5l6.3 3.9a1.72 1.72 0 0 0 1.7 0l10.3-6c.5-.3.9-1 .9-1.5Z",key:"1t2lqe"}],["path",{d:"M10 21.9V14L2.1 9.1",key:"o7czzq"}],["path",{d:"m10 14 11.9-6.9",key:"zm5e20"}],["path",{d:"M14 19.8v-8.1",key:"159ecu"}],["path",{d:"M18 17.5V9.4",key:"11uown"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const b7=U("Contrast",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 18a6 6 0 0 0 0-12v12z",key:"j4l70d"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const w7=U("Cookie",[["path",{d:"M12 2a10 10 0 1 0 10 10 4 4 0 0 1-5-5 4 4 0 0 1-5-5",key:"laymnq"}],["path",{d:"M8.5 8.5v.01",key:"ue8clq"}],["path",{d:"M16 15.5v.01",key:"14dtrp"}],["path",{d:"M12 12v.01",key:"u5ubse"}],["path",{d:"M11 17v.01",key:"1hyl5a"}],["path",{d:"M7 14v.01",key:"uct60s"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const j7=U("CookingPot",[["path",{d:"M2 12h20",key:"9i4pu4"}],["path",{d:"M20 12v8a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2v-8",key:"u0tga0"}],["path",{d:"m4 8 16-4",key:"16g0ng"}],["path",{d:"m8.86 6.78-.45-1.81a2 2 0 0 1 1.45-2.43l1.94-.48a2 2 0 0 1 2.43 1.46l.45 1.8",key:"12cejc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const k7=U("CopyCheck",[["path",{d:"m12 15 2 2 4-4",key:"2c609p"}],["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const N7=U("CopyMinus",[["line",{x1:"12",x2:"18",y1:"15",y2:"15",key:"1nscbv"}],["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const S7=U("CopyPlus",[["line",{x1:"15",x2:"15",y1:"12",y2:"18",key:"1p7wdc"}],["line",{x1:"12",x2:"18",y1:"15",y2:"15",key:"1nscbv"}],["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const C7=U("CopySlash",[["line",{x1:"12",x2:"18",y1:"18",y2:"12",key:"ebkxgr"}],["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const M7=U("CopyX",[["line",{x1:"12",x2:"18",y1:"12",y2:"18",key:"1rg63v"}],["line",{x1:"12",x2:"18",y1:"18",y2:"12",key:"ebkxgr"}],["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hl=U("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const T7=U("Copyleft",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.17 14.83a4 4 0 1 0 0-5.66",key:"1sveal"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const A7=U("Copyright",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M14.83 14.83a4 4 0 1 1 0-5.66",key:"1i56pz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const E7=U("CornerDownLeft",[["polyline",{points:"9 10 4 15 9 20",key:"r3jprv"}],["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const I7=U("CornerDownRight",[["polyline",{points:"15 10 20 15 15 20",key:"1q7qjw"}],["path",{d:"M4 4v7a4 4 0 0 0 4 4h12",key:"z08zvw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const P7=U("CornerLeftDown",[["polyline",{points:"14 15 9 20 4 15",key:"nkc4i"}],["path",{d:"M20 4h-7a4 4 0 0 0-4 4v12",key:"nbpdq2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const L7=U("CornerLeftUp",[["polyline",{points:"14 9 9 4 4 9",key:"m9oyvo"}],["path",{d:"M20 20h-7a4 4 0 0 1-4-4V4",key:"1blwi3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const O7=U("CornerRightDown",[["polyline",{points:"10 15 15 20 20 15",key:"axus6l"}],["path",{d:"M4 4h7a4 4 0 0 1 4 4v12",key:"wcbgct"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const D7=U("CornerRightUp",[["polyline",{points:"10 9 15 4 20 9",key:"1lr6px"}],["path",{d:"M4 20h7a4 4 0 0 0 4-4V4",key:"1plgdj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const R7=U("CornerUpLeft",[["polyline",{points:"9 14 4 9 9 4",key:"881910"}],["path",{d:"M20 20v-7a4 4 0 0 0-4-4H4",key:"1nkjon"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const F7=U("CornerUpRight",[["polyline",{points:"15 14 20 9 15 4",key:"1tbx3s"}],["path",{d:"M4 20v-7a4 4 0 0 1 4-4h12",key:"1lu4f8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const z7=U("Cpu",[["rect",{width:"16",height:"16",x:"4",y:"4",rx:"2",key:"14l7u7"}],["rect",{width:"6",height:"6",x:"9",y:"9",rx:"1",key:"5aljv4"}],["path",{d:"M15 2v2",key:"13l42r"}],["path",{d:"M15 20v2",key:"15mkzm"}],["path",{d:"M2 15h2",key:"1gxd5l"}],["path",{d:"M2 9h2",key:"1bbxkp"}],["path",{d:"M20 15h2",key:"19e6y8"}],["path",{d:"M20 9h2",key:"19tzq7"}],["path",{d:"M9 2v2",key:"165o2o"}],["path",{d:"M9 20v2",key:"i2bqo8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const B7=U("CreativeCommons",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M10 9.3a2.8 2.8 0 0 0-3.5 1 3.1 3.1 0 0 0 0 3.4 2.7 2.7 0 0 0 3.5 1",key:"1ss3eq"}],["path",{d:"M17 9.3a2.8 2.8 0 0 0-3.5 1 3.1 3.1 0 0 0 0 3.4 2.7 2.7 0 0 0 3.5 1",key:"1od56t"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fm=U("CreditCard",[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $7=U("Croissant",[["path",{d:"m4.6 13.11 5.79-3.21c1.89-1.05 4.79 1.78 3.71 3.71l-3.22 5.81C8.8 23.16.79 15.23 4.6 13.11Z",key:"1ozxlb"}],["path",{d:"m10.5 9.5-1-2.29C9.2 6.48 8.8 6 8 6H4.5C2.79 6 2 6.5 2 8.5a7.71 7.71 0 0 0 2 4.83",key:"ffuyb5"}],["path",{d:"M8 6c0-1.55.24-4-2-4-2 0-2.5 2.17-2.5 4",key:"osnpzi"}],["path",{d:"m14.5 13.5 2.29 1c.73.3 1.21.7 1.21 1.5v3.5c0 1.71-.5 2.5-2.5 2.5a7.71 7.71 0 0 1-4.83-2",key:"1vubaw"}],["path",{d:"M18 16c1.55 0 4-.24 4 2 0 2-2.17 2.5-4 2.5",key:"wxr772"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const U7=U("Crop",[["path",{d:"M6 2v14a2 2 0 0 0 2 2h14",key:"ron5a4"}],["path",{d:"M18 22V8a2 2 0 0 0-2-2H2",key:"7s9ehn"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const q7=U("Cross",[["path",{d:"M4 9a2 2 0 0 0-2 2v2a2 2 0 0 0 2 2h4a1 1 0 0 1 1 1v4a2 2 0 0 0 2 2h2a2 2 0 0 0 2-2v-4a1 1 0 0 1 1-1h4a2 2 0 0 0 2-2v-2a2 2 0 0 0-2-2h-4a1 1 0 0 1-1-1V4a2 2 0 0 0-2-2h-2a2 2 0 0 0-2 2v4a1 1 0 0 1-1 1z",key:"1xbrqy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const V7=U("Crosshair",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"22",x2:"18",y1:"12",y2:"12",key:"l9bcsi"}],["line",{x1:"6",x2:"2",y1:"12",y2:"12",key:"13hhkx"}],["line",{x1:"12",x2:"12",y1:"6",y2:"2",key:"10w3f3"}],["line",{x1:"12",x2:"12",y1:"22",y2:"18",key:"15g9kq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const u1=U("Crown",[["path",{d:"M11.562 3.266a.5.5 0 0 1 .876 0L15.39 8.87a1 1 0 0 0 1.516.294L21.183 5.5a.5.5 0 0 1 .798.519l-2.834 10.246a1 1 0 0 1-.956.734H5.81a1 1 0 0 1-.957-.734L2.02 6.02a.5.5 0 0 1 .798-.519l4.276 3.664a1 1 0 0 0 1.516-.294z",key:"1vdc57"}],["path",{d:"M5 21h14",key:"11awu3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const H7=U("Cuboid",[["path",{d:"m21.12 6.4-6.05-4.06a2 2 0 0 0-2.17-.05L2.95 8.41a2 2 0 0 0-.95 1.7v5.82a2 2 0 0 0 .88 1.66l6.05 4.07a2 2 0 0 0 2.17.05l9.95-6.12a2 2 0 0 0 .95-1.7V8.06a2 2 0 0 0-.88-1.66Z",key:"1u2ovd"}],["path",{d:"M10 22v-8L2.25 9.15",key:"11pn4q"}],["path",{d:"m10 14 11.77-6.87",key:"1kt1wh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const W7=U("CupSoda",[["path",{d:"m6 8 1.75 12.28a2 2 0 0 0 2 1.72h4.54a2 2 0 0 0 2-1.72L18 8",key:"8166m8"}],["path",{d:"M5 8h14",key:"pcz4l3"}],["path",{d:"M7 15a6.47 6.47 0 0 1 5 0 6.47 6.47 0 0 0 5 0",key:"yjz344"}],["path",{d:"m12 8 1-6h2",key:"3ybfa4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const G7=U("Currency",[["circle",{cx:"12",cy:"12",r:"8",key:"46899m"}],["line",{x1:"3",x2:"6",y1:"3",y2:"6",key:"1jkytn"}],["line",{x1:"21",x2:"18",y1:"3",y2:"6",key:"14zfjt"}],["line",{x1:"3",x2:"6",y1:"21",y2:"18",key:"iusuec"}],["line",{x1:"21",x2:"18",y1:"21",y2:"18",key:"yj2dd7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const K7=U("Cylinder",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5v14a9 3 0 0 0 18 0V5",key:"aqi0yr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Z7=U("Dam",[["path",{d:"M11 11.31c1.17.56 1.54 1.69 3.5 1.69 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1",key:"157kva"}],["path",{d:"M11.75 18c.35.5 1.45 1 2.75 1 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1",key:"d7q6m6"}],["path",{d:"M2 10h4",key:"l0bgd4"}],["path",{d:"M2 14h4",key:"1gsvsf"}],["path",{d:"M2 18h4",key:"1bu2t1"}],["path",{d:"M2 6h4",key:"aawbzj"}],["path",{d:"M7 3a1 1 0 0 0-1 1v16a1 1 0 0 0 1 1h4a1 1 0 0 0 1-1L10 4a1 1 0 0 0-1-1z",key:"pr6s65"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Y7=U("DatabaseBackup",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 12a9 3 0 0 0 5 2.69",key:"1ui2ym"}],["path",{d:"M21 9.3V5",key:"6k6cib"}],["path",{d:"M3 5v14a9 3 0 0 0 6.47 2.88",key:"i62tjy"}],["path",{d:"M12 12v4h4",key:"1bxaet"}],["path",{d:"M13 20a5 5 0 0 0 9-3 4.5 4.5 0 0 0-4.5-4.5c-1.33 0-2.54.54-3.41 1.41L12 16",key:"1f4ei9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const X7=U("DatabaseZap",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 15 21.84",key:"14ibmq"}],["path",{d:"M21 5V8",key:"1marbg"}],["path",{d:"M21 12L18 17H22L19 22",key:"zafso"}],["path",{d:"M3 12A9 3 0 0 0 14.59 14.87",key:"1y4wr8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Q7=U("Database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const J7=U("Delete",[["path",{d:"M10 5a2 2 0 0 0-1.344.519l-6.328 5.74a1 1 0 0 0 0 1.481l6.328 5.741A2 2 0 0 0 10 19h10a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2z",key:"1yo7s0"}],["path",{d:"m12 9 6 6",key:"anjzzh"}],["path",{d:"m18 9-6 6",key:"1fp51s"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const e9=U("Dessert",[["circle",{cx:"12",cy:"4",r:"2",key:"muu5ef"}],["path",{d:"M10.2 3.2C5.5 4 2 8.1 2 13a2 2 0 0 0 4 0v-1a2 2 0 0 1 4 0v4a2 2 0 0 0 4 0v-4a2 2 0 0 1 4 0v1a2 2 0 0 0 4 0c0-4.9-3.5-9-8.2-9.8",key:"lfo06j"}],["path",{d:"M3.2 14.8a9 9 0 0 0 17.6 0",key:"12xarc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const t9=U("Diameter",[["circle",{cx:"19",cy:"19",r:"2",key:"17f5cg"}],["circle",{cx:"5",cy:"5",r:"2",key:"1gwv83"}],["path",{d:"M6.48 3.66a10 10 0 0 1 13.86 13.86",key:"xr8kdq"}],["path",{d:"m6.41 6.41 11.18 11.18",key:"uhpjw7"}],["path",{d:"M3.66 6.48a10 10 0 0 0 13.86 13.86",key:"cldpwv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const r9=U("DiamondMinus",[["path",{d:"M2.7 10.3a2.41 2.41 0 0 0 0 3.41l7.59 7.59a2.41 2.41 0 0 0 3.41 0l7.59-7.59a2.41 2.41 0 0 0 0-3.41L13.7 2.71a2.41 2.41 0 0 0-3.41 0z",key:"1ey20j"}],["path",{d:"M8 12h8",key:"1wcyev"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const v2=U("DiamondPercent",[["path",{d:"M2.7 10.3a2.41 2.41 0 0 0 0 3.41l7.59 7.59a2.41 2.41 0 0 0 3.41 0l7.59-7.59a2.41 2.41 0 0 0 0-3.41L13.7 2.71a2.41 2.41 0 0 0-3.41 0Z",key:"1tpxz2"}],["path",{d:"M9.2 9.2h.01",key:"1b7bvt"}],["path",{d:"m14.5 9.5-5 5",key:"17q4r4"}],["path",{d:"M14.7 14.8h.01",key:"17nsh4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const n9=U("DiamondPlus",[["path",{d:"M12 8v8",key:"napkw2"}],["path",{d:"M2.7 10.3a2.41 2.41 0 0 0 0 3.41l7.59 7.59a2.41 2.41 0 0 0 3.41 0l7.59-7.59a2.41 2.41 0 0 0 0-3.41L13.7 2.71a2.41 2.41 0 0 0-3.41 0z",key:"1ey20j"}],["path",{d:"M8 12h8",key:"1wcyev"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const s9=U("Diamond",[["path",{d:"M2.7 10.3a2.41 2.41 0 0 0 0 3.41l7.59 7.59a2.41 2.41 0 0 0 3.41 0l7.59-7.59a2.41 2.41 0 0 0 0-3.41l-7.59-7.59a2.41 2.41 0 0 0-3.41 0Z",key:"1f1r0c"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const a9=U("Dice1",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["path",{d:"M12 12h.01",key:"1mp3jc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const i9=U("Dice2",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["path",{d:"M15 9h.01",key:"x1ddxp"}],["path",{d:"M9 15h.01",key:"fzyn71"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const o9=U("Dice3",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["path",{d:"M16 8h.01",key:"cr5u4v"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M8 16h.01",key:"18s6g9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const l9=U("Dice4",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["path",{d:"M16 8h.01",key:"cr5u4v"}],["path",{d:"M8 8h.01",key:"1e4136"}],["path",{d:"M8 16h.01",key:"18s6g9"}],["path",{d:"M16 16h.01",key:"1f9h7w"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const c9=U("Dice5",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["path",{d:"M16 8h.01",key:"cr5u4v"}],["path",{d:"M8 8h.01",key:"1e4136"}],["path",{d:"M8 16h.01",key:"18s6g9"}],["path",{d:"M16 16h.01",key:"1f9h7w"}],["path",{d:"M12 12h.01",key:"1mp3jc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const d9=U("Dice6",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["path",{d:"M16 8h.01",key:"cr5u4v"}],["path",{d:"M16 12h.01",key:"1l6xoz"}],["path",{d:"M16 16h.01",key:"1f9h7w"}],["path",{d:"M8 8h.01",key:"1e4136"}],["path",{d:"M8 12h.01",key:"czm47f"}],["path",{d:"M8 16h.01",key:"18s6g9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const u9=U("Dices",[["rect",{width:"12",height:"12",x:"2",y:"10",rx:"2",ry:"2",key:"6agr2n"}],["path",{d:"m17.92 14 3.5-3.5a2.24 2.24 0 0 0 0-3l-5-4.92a2.24 2.24 0 0 0-3 0L10 6",key:"1o487t"}],["path",{d:"M6 18h.01",key:"uhywen"}],["path",{d:"M10 14h.01",key:"ssrbsk"}],["path",{d:"M15 6h.01",key:"cblpky"}],["path",{d:"M18 9h.01",key:"2061c0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const h9=U("Diff",[["path",{d:"M12 3v14",key:"7cf3v8"}],["path",{d:"M5 10h14",key:"elsbfy"}],["path",{d:"M5 21h14",key:"11awu3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const f9=U("Disc2",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 12h.01",key:"1mp3jc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const p9=U("Disc3",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M6 12c0-1.7.7-3.2 1.8-4.2",key:"oqkarx"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["path",{d:"M18 12c0 1.7-.7 3.2-1.8 4.2",key:"1eah9h"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const m9=U("DiscAlbum",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["circle",{cx:"12",cy:"12",r:"5",key:"nd82uf"}],["path",{d:"M12 12h.01",key:"1mp3jc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const g9=U("Disc",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const x9=U("Divide",[["circle",{cx:"12",cy:"6",r:"1",key:"1bh7o1"}],["line",{x1:"5",x2:"19",y1:"12",y2:"12",key:"13b5wn"}],["circle",{cx:"12",cy:"18",r:"1",key:"lqb9t5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const y9=U("DnaOff",[["path",{d:"M15 2c-1.35 1.5-2.092 3-2.5 4.5L14 8",key:"1bivrr"}],["path",{d:"m17 6-2.891-2.891",key:"xu6p2f"}],["path",{d:"M2 15c3.333-3 6.667-3 10-3",key:"nxix30"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"m20 9 .891.891",key:"3xwk7g"}],["path",{d:"M22 9c-1.5 1.35-3 2.092-4.5 2.5l-1-1",key:"18cutr"}],["path",{d:"M3.109 14.109 4 15",key:"q76aoh"}],["path",{d:"m6.5 12.5 1 1",key:"cs35ky"}],["path",{d:"m7 18 2.891 2.891",key:"1sisit"}],["path",{d:"M9 22c1.35-1.5 2.092-3 2.5-4.5L10 16",key:"rlvei3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const v9=U("Dna",[["path",{d:"m10 16 1.5 1.5",key:"11lckj"}],["path",{d:"m14 8-1.5-1.5",key:"1ohn8i"}],["path",{d:"M15 2c-1.798 1.998-2.518 3.995-2.807 5.993",key:"80uv8i"}],["path",{d:"m16.5 10.5 1 1",key:"696xn5"}],["path",{d:"m17 6-2.891-2.891",key:"xu6p2f"}],["path",{d:"M2 15c6.667-6 13.333 0 20-6",key:"1pyr53"}],["path",{d:"m20 9 .891.891",key:"3xwk7g"}],["path",{d:"M3.109 14.109 4 15",key:"q76aoh"}],["path",{d:"m6.5 12.5 1 1",key:"cs35ky"}],["path",{d:"m7 18 2.891 2.891",key:"1sisit"}],["path",{d:"M9 22c1.798-1.998 2.518-3.995 2.807-5.993",key:"q3hbxp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _9=U("Dock",[["path",{d:"M2 8h20",key:"d11cs7"}],["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["path",{d:"M6 16h12",key:"u522kt"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const b9=U("Dog",[["path",{d:"M11.25 16.25h1.5L12 17z",key:"w7jh35"}],["path",{d:"M16 14v.5",key:"1lajdz"}],["path",{d:"M4.42 11.247A13.152 13.152 0 0 0 4 14.556C4 18.728 7.582 21 12 21s8-2.272 8-6.444a11.702 11.702 0 0 0-.493-3.309",key:"u7s9ue"}],["path",{d:"M8 14v.5",key:"1nzgdb"}],["path",{d:"M8.5 8.5c-.384 1.05-1.083 2.028-2.344 2.5-1.931.722-3.576-.297-3.656-1-.113-.994 1.177-6.53 4-7 1.923-.321 3.651.845 3.651 2.235A7.497 7.497 0 0 1 14 5.277c0-1.39 1.844-2.598 3.767-2.277 2.823.47 4.113 6.006 4 7-.08.703-1.725 1.722-3.656 1-1.261-.472-1.855-1.45-2.239-2.5",key:"v8hric"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hd=U("DollarSign",[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const w9=U("Donut",[["path",{d:"M20.5 10a2.5 2.5 0 0 1-2.4-3H18a2.95 2.95 0 0 1-2.6-4.4 10 10 0 1 0 6.3 7.1c-.3.2-.8.3-1.2.3",key:"19sr3x"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const j9=U("DoorClosed",[["path",{d:"M18 20V6a2 2 0 0 0-2-2H8a2 2 0 0 0-2 2v14",key:"36qu9e"}],["path",{d:"M2 20h20",key:"owomy5"}],["path",{d:"M14 12v.01",key:"xfcn54"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hj=U("DoorOpen",[["path",{d:"M13 4h3a2 2 0 0 1 2 2v14",key:"hrm0s9"}],["path",{d:"M2 20h3",key:"1gaodv"}],["path",{d:"M13 20h9",key:"s90cdi"}],["path",{d:"M10 12v.01",key:"vx6srw"}],["path",{d:"M13 4.562v16.157a1 1 0 0 1-1.242.97L5 20V5.562a2 2 0 0 1 1.515-1.94l4-1A2 2 0 0 1 13 4.561Z",key:"199qr4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const k9=U("Dot",[["circle",{cx:"12.1",cy:"12.1",r:"1",key:"18d7e5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const no=U("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const N9=U("DraftingCompass",[["path",{d:"m12.99 6.74 1.93 3.44",key:"iwagvd"}],["path",{d:"M19.136 12a10 10 0 0 1-14.271 0",key:"ppmlo4"}],["path",{d:"m21 21-2.16-3.84",key:"vylbct"}],["path",{d:"m3 21 8.02-14.26",key:"1ssaw4"}],["circle",{cx:"12",cy:"5",r:"2",key:"f1ur92"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const S9=U("Drama",[["path",{d:"M10 11h.01",key:"d2at3l"}],["path",{d:"M14 6h.01",key:"k028ub"}],["path",{d:"M18 6h.01",key:"1v4wsw"}],["path",{d:"M6.5 13.1h.01",key:"1748ia"}],["path",{d:"M22 5c0 9-4 12-6 12s-6-3-6-12c0-2 2-3 6-3s6 1 6 3",key:"172yzv"}],["path",{d:"M17.4 9.9c-.8.8-2 .8-2.8 0",key:"1obv0w"}],["path",{d:"M10.1 7.1C9 7.2 7.7 7.7 6 8.6c-3.5 2-4.7 3.9-3.7 5.6 4.5 7.8 9.5 8.4 11.2 7.4.9-.5 1.9-2.1 1.9-4.7",key:"rqjl8i"}],["path",{d:"M9.1 16.5c.3-1.1 1.4-1.7 2.4-1.4",key:"1mr6wy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const C9=U("Dribbble",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M19.13 5.09C15.22 9.14 10 10.44 2.25 10.94",key:"hpej1"}],["path",{d:"M21.75 12.84c-6.62-1.41-12.14 1-16.38 6.32",key:"1tr44o"}],["path",{d:"M8.56 2.75c4.37 6 6 9.42 8 17.72",key:"kbh691"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const M9=U("Drill",[["path",{d:"M10 18a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1H5a3 3 0 0 1-3-3 1 1 0 0 1 1-1z",key:"ioqxb1"}],["path",{d:"M13 10H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a1 1 0 0 1 1 1v6a1 1 0 0 1-1 1l-.81 3.242a1 1 0 0 1-.97.758H8",key:"1rs59n"}],["path",{d:"M14 4h3a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1h-3",key:"105ega"}],["path",{d:"M18 6h4",key:"66u95g"}],["path",{d:"m5 10-2 8",key:"xt2lic"}],["path",{d:"m7 18 2-8",key:"1bzku2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const T9=U("Droplet",[["path",{d:"M12 22a7 7 0 0 0 7-7c0-2-1-3.9-3-5.5s-3.5-4-4-6.5c-.5 2.5-2 4.9-4 6.5C6 11.1 5 13 5 15a7 7 0 0 0 7 7z",key:"c7niix"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const A9=U("Droplets",[["path",{d:"M7 16.3c2.2 0 4-1.83 4-4.05 0-1.16-.57-2.26-1.71-3.19S7.29 6.75 7 5.3c-.29 1.45-1.14 2.84-2.29 3.76S3 11.1 3 12.25c0 2.22 1.8 4.05 4 4.05z",key:"1ptgy4"}],["path",{d:"M12.56 6.6A10.97 10.97 0 0 0 14 3.02c.5 2.5 2 4.9 4 6.5s3 3.5 3 5.5a6.98 6.98 0 0 1-11.91 4.97",key:"1sl1rz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const E9=U("Drum",[["path",{d:"m2 2 8 8",key:"1v6059"}],["path",{d:"m22 2-8 8",key:"173r8a"}],["ellipse",{cx:"12",cy:"9",rx:"10",ry:"5",key:"liohsx"}],["path",{d:"M7 13.4v7.9",key:"1yi6u9"}],["path",{d:"M12 14v8",key:"1tn2tj"}],["path",{d:"M17 13.4v7.9",key:"eqz2v3"}],["path",{d:"M2 9v8a10 5 0 0 0 20 0V9",key:"1750ul"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const I9=U("Drumstick",[["path",{d:"M15.4 15.63a7.875 6 135 1 1 6.23-6.23 4.5 3.43 135 0 0-6.23 6.23",key:"1dtqwm"}],["path",{d:"m8.29 12.71-2.6 2.6a2.5 2.5 0 1 0-1.65 4.65A2.5 2.5 0 1 0 8.7 18.3l2.59-2.59",key:"1oq1fw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const P9=U("Dumbbell",[["path",{d:"M14.4 14.4 9.6 9.6",key:"ic80wn"}],["path",{d:"M18.657 21.485a2 2 0 1 1-2.829-2.828l-1.767 1.768a2 2 0 1 1-2.829-2.829l6.364-6.364a2 2 0 1 1 2.829 2.829l-1.768 1.767a2 2 0 1 1 2.828 2.829z",key:"nnl7wr"}],["path",{d:"m21.5 21.5-1.4-1.4",key:"1f1ice"}],["path",{d:"M3.9 3.9 2.5 2.5",key:"1evmna"}],["path",{d:"M6.404 12.768a2 2 0 1 1-2.829-2.829l1.768-1.767a2 2 0 1 1-2.828-2.829l2.828-2.828a2 2 0 1 1 2.829 2.828l1.767-1.768a2 2 0 1 1 2.829 2.829z",key:"yhosts"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const L9=U("EarOff",[["path",{d:"M6 18.5a3.5 3.5 0 1 0 7 0c0-1.57.92-2.52 2.04-3.46",key:"1qngmn"}],["path",{d:"M6 8.5c0-.75.13-1.47.36-2.14",key:"b06bma"}],["path",{d:"M8.8 3.15A6.5 6.5 0 0 1 19 8.5c0 1.63-.44 2.81-1.09 3.76",key:"g10hsz"}],["path",{d:"M12.5 6A2.5 2.5 0 0 1 15 8.5M10 13a2 2 0 0 0 1.82-1.18",key:"ygzou7"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const O9=U("Ear",[["path",{d:"M6 8.5a6.5 6.5 0 1 1 13 0c0 6-6 6-6 10a3.5 3.5 0 1 1-7 0",key:"1dfaln"}],["path",{d:"M15 8.5a2.5 2.5 0 0 0-5 0v1a2 2 0 1 1 0 4",key:"1qnva7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const D9=U("EarthLock",[["path",{d:"M7 3.34V5a3 3 0 0 0 3 3",key:"w732o8"}],["path",{d:"M11 21.95V18a2 2 0 0 0-2-2 2 2 0 0 1-2-2v-1a2 2 0 0 0-2-2H2.05",key:"f02343"}],["path",{d:"M21.54 15H17a2 2 0 0 0-2 2v4.54",key:"1djwo0"}],["path",{d:"M12 2a10 10 0 1 0 9.54 13",key:"zjsr6q"}],["path",{d:"M20 6V4a2 2 0 1 0-4 0v2",key:"1of5e8"}],["rect",{width:"8",height:"5",x:"14",y:"6",rx:"1",key:"1fmf51"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _2=U("Earth",[["path",{d:"M21.54 15H17a2 2 0 0 0-2 2v4.54",key:"1djwo0"}],["path",{d:"M7 3.34V5a3 3 0 0 0 3 3a2 2 0 0 1 2 2c0 1.1.9 2 2 2a2 2 0 0 0 2-2c0-1.1.9-2 2-2h3.17",key:"1tzkfa"}],["path",{d:"M11 21.95V18a2 2 0 0 0-2-2a2 2 0 0 1-2-2v-1a2 2 0 0 0-2-2H2.05",key:"14pb5j"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const R9=U("Eclipse",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a7 7 0 1 0 10 10",key:"1yuj32"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const F9=U("EggFried",[["circle",{cx:"11.5",cy:"12.5",r:"3.5",key:"1cl1mi"}],["path",{d:"M3 8c0-3.5 2.5-6 6.5-6 5 0 4.83 3 7.5 5s5 2 5 6c0 4.5-2.5 6.5-7 6.5-2.5 0-2.5 2.5-6 2.5s-7-2-7-5.5c0-3 1.5-3 1.5-5C3.5 10 3 9 3 8Z",key:"165ef9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const z9=U("EggOff",[["path",{d:"M6.399 6.399C5.362 8.157 4.65 10.189 4.5 12c-.37 4.43 1.27 9.95 7.5 10 3.256-.026 5.259-1.547 6.375-3.625",key:"6et380"}],["path",{d:"M19.532 13.875A14.07 14.07 0 0 0 19.5 12c-.36-4.34-3.95-9.96-7.5-10-1.04.012-2.082.502-3.046 1.297",key:"gcdc3f"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tS=U("Egg",[["path",{d:"M12 22c6.23-.05 7.87-5.57 7.5-10-.36-4.34-3.95-9.96-7.5-10-3.55.04-7.14 5.66-7.5 10-.37 4.43 1.27 9.95 7.5 10z",key:"1c39pg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Sx=U("EllipsisVertical",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const em=U("Ellipsis",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const B9=U("EqualApproximately",[["path",{d:"M5 15a6.5 6.5 0 0 1 7 0 6.5 6.5 0 0 0 7 0",key:"yrdkhy"}],["path",{d:"M5 9a6.5 6.5 0 0 1 7 0 6.5 6.5 0 0 0 7 0",key:"gzkvyz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $9=U("EqualNot",[["line",{x1:"5",x2:"19",y1:"9",y2:"9",key:"1nwqeh"}],["line",{x1:"5",x2:"19",y1:"15",y2:"15",key:"g8yjpy"}],["line",{x1:"19",x2:"5",y1:"5",y2:"19",key:"1x9vlm"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const U9=U("Equal",[["line",{x1:"5",x2:"19",y1:"9",y2:"9",key:"1nwqeh"}],["line",{x1:"5",x2:"19",y1:"15",y2:"15",key:"g8yjpy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const q9=U("Eraser",[["path",{d:"m7 21-4.3-4.3c-1-1-1-2.5 0-3.4l9.6-9.6c1-1 2.5-1 3.4 0l5.6 5.6c1 1 1 2.5 0 3.4L13 21",key:"182aya"}],["path",{d:"M22 21H7",key:"t4ddhn"}],["path",{d:"m5 11 9 9",key:"1mo9qw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const V9=U("EthernetPort",[["path",{d:"m15 20 3-3h2a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h2l3 3z",key:"rbahqx"}],["path",{d:"M6 8v1",key:"1636ez"}],["path",{d:"M10 8v1",key:"1talb4"}],["path",{d:"M14 8v1",key:"1rsfgr"}],["path",{d:"M18 8v1",key:"gnkwox"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const H9=U("Euro",[["path",{d:"M4 10h12",key:"1y6xl8"}],["path",{d:"M4 14h9",key:"1loblj"}],["path",{d:"M19 6a7.7 7.7 0 0 0-5.2-2A7.9 7.9 0 0 0 6 12c0 4.4 3.5 8 7.8 8 2 0 3.8-.8 5.2-2",key:"1j6lzo"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const W9=U("Expand",[["path",{d:"m21 21-6-6m6 6v-4.8m0 4.8h-4.8",key:"1c15vz"}],["path",{d:"M3 16.2V21m0 0h4.8M3 21l6-6",key:"1fsnz2"}],["path",{d:"M21 7.8V3m0 0h-4.8M21 3l-6 6",key:"hawz9i"}],["path",{d:"M3 7.8V3m0 0h4.8M3 3l6 6",key:"u9ee12"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Fs=U("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const G9=U("EyeClosed",[["path",{d:"m15 18-.722-3.25",key:"1j64jw"}],["path",{d:"M2 8a10.645 10.645 0 0 0 20 0",key:"1e7gxb"}],["path",{d:"m20 15-1.726-2.05",key:"1cnuld"}],["path",{d:"m4 15 1.726-2.05",key:"1dsqqd"}],["path",{d:"m9 18 .722-3.25",key:"ypw2yx"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const h1=U("EyeOff",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Qo=U("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Rd=U("Facebook",[["path",{d:"M18 2h-3a5 5 0 0 0-5 5v3H7v4h3v8h4v-8h3l1-4h-4V7a1 1 0 0 1 1-1h3z",key:"1jg4f8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const K9=U("Factory",[["path",{d:"M2 20a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V8l-7 5V8l-7 5V4a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2Z",key:"159hny"}],["path",{d:"M17 18h1",key:"uldtlt"}],["path",{d:"M12 18h1",key:"s9uhes"}],["path",{d:"M7 18h1",key:"1neino"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Z9=U("Fan",[["path",{d:"M10.827 16.379a6.082 6.082 0 0 1-8.618-7.002l5.412 1.45a6.082 6.082 0 0 1 7.002-8.618l-1.45 5.412a6.082 6.082 0 0 1 8.618 7.002l-5.412-1.45a6.082 6.082 0 0 1-7.002 8.618l1.45-5.412Z",key:"484a7f"}],["path",{d:"M12 12v.01",key:"u5ubse"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Y9=U("FastForward",[["polygon",{points:"13 19 22 12 13 5 13 19",key:"587y9g"}],["polygon",{points:"2 19 11 12 2 5 2 19",key:"3pweh0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const X9=U("Feather",[["path",{d:"M12.67 19a2 2 0 0 0 1.416-.588l6.154-6.172a6 6 0 0 0-8.49-8.49L5.586 9.914A2 2 0 0 0 5 11.328V18a1 1 0 0 0 1 1z",key:"18jl4k"}],["path",{d:"M16 8 2 22",key:"vp34q"}],["path",{d:"M17.5 15H9",key:"1oz8nu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Q9=U("Fence",[["path",{d:"M4 3 2 5v15c0 .6.4 1 1 1h2c.6 0 1-.4 1-1V5Z",key:"1n2rgs"}],["path",{d:"M6 8h4",key:"utf9t1"}],["path",{d:"M6 18h4",key:"12yh4b"}],["path",{d:"m12 3-2 2v15c0 .6.4 1 1 1h2c.6 0 1-.4 1-1V5Z",key:"3ha7mj"}],["path",{d:"M14 8h4",key:"1r8wg2"}],["path",{d:"M14 18h4",key:"1t3kbu"}],["path",{d:"m20 3-2 2v15c0 .6.4 1 1 1h2c.6 0 1-.4 1-1V5Z",key:"dfd4e2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const J9=U("FerrisWheel",[["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m6.8 15-3.5 2",key:"hjy98k"}],["path",{d:"m20.7 7-3.5 2",key:"f08gto"}],["path",{d:"M6.8 9 3.3 7",key:"1aevh4"}],["path",{d:"m20.7 17-3.5-2",key:"1liqo3"}],["path",{d:"m9 22 3-8 3 8",key:"wees03"}],["path",{d:"M8 22h8",key:"rmew8v"}],["path",{d:"M18 18.7a9 9 0 1 0-12 0",key:"dhzg4g"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const eB=U("Figma",[["path",{d:"M5 5.5A3.5 3.5 0 0 1 8.5 2H12v7H8.5A3.5 3.5 0 0 1 5 5.5z",key:"1340ok"}],["path",{d:"M12 2h3.5a3.5 3.5 0 1 1 0 7H12V2z",key:"1hz3m3"}],["path",{d:"M12 12.5a3.5 3.5 0 1 1 7 0 3.5 3.5 0 1 1-7 0z",key:"1oz8n2"}],["path",{d:"M5 19.5A3.5 3.5 0 0 1 8.5 16H12v3.5a3.5 3.5 0 1 1-7 0z",key:"1ff65i"}],["path",{d:"M5 12.5A3.5 3.5 0 0 1 8.5 9H12v7H8.5A3.5 3.5 0 0 1 5 12.5z",key:"pdip6e"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tB=U("FileArchive",[["path",{d:"M10 12v-1",key:"v7bkov"}],["path",{d:"M10 18v-2",key:"1cjy8d"}],["path",{d:"M10 7V6",key:"dljcrl"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M15.5 22H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v16a2 2 0 0 0 .274 1.01",key:"gkbcor"}],["circle",{cx:"10",cy:"20",r:"2",key:"1xzdoj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rB=U("FileAudio2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v2",key:"17k7jt"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["circle",{cx:"3",cy:"17",r:"1",key:"vo6nti"}],["path",{d:"M2 17v-3a4 4 0 0 1 8 0v3",key:"1ggdre"}],["circle",{cx:"9",cy:"17",r:"1",key:"bc1fq4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nB=U("FileAudio",[["path",{d:"M17.5 22h.5a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v3",key:"rslqgf"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M2 19a2 2 0 1 1 4 0v1a2 2 0 1 1-4 0v-4a6 6 0 0 1 12 0v4a2 2 0 1 1-4 0v-1a2 2 0 1 1 4 0",key:"9f7x3i"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const b2=U("FileAxis3d",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m8 18 4-4",key:"12zab0"}],["path",{d:"M8 10v8h8",key:"tlaukw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sB=U("FileBadge2",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m14 12.5 1 5.5-3-1-3 1 1-5.5",key:"14xlky"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const aB=U("FileBadge",[["path",{d:"M12 22h6a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v3",key:"12ixgl"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M5 17a3 3 0 1 0 0-6 3 3 0 0 0 0 6Z",key:"u0c8gj"}],["path",{d:"M7 16.5 8 22l-3-1-3 1 1-5.5",key:"5gm2nr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const iB=U("FileBox",[["path",{d:"M14.5 22H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"16lz6z"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M3 13.1a2 2 0 0 0-1 1.76v3.24a2 2 0 0 0 .97 1.78L6 21.7a2 2 0 0 0 2.03.01L11 19.9a2 2 0 0 0 1-1.76V14.9a2 2 0 0 0-.97-1.78L8 11.3a2 2 0 0 0-2.03-.01Z",key:"99pj1s"}],["path",{d:"M7 17v5",key:"1yj1jh"}],["path",{d:"M11.7 14.2 7 17l-4.7-2.8",key:"1yk8tc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const w2=U("FileChartColumnIncreasing",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M8 18v-2",key:"qcmpov"}],["path",{d:"M12 18v-4",key:"q1q25u"}],["path",{d:"M16 18v-6",key:"15y0np"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const j2=U("FileChartColumn",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M8 18v-1",key:"zg0ygc"}],["path",{d:"M12 18v-6",key:"17g6i2"}],["path",{d:"M16 18v-3",key:"j5jt4h"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const k2=U("FileChartLine",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m16 13-3.5 3.5-2-2L8 17",key:"zz7yod"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const N2=U("FileChartPie",[["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M16 22h2a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v3.5",key:"13ddob"}],["path",{d:"M4.017 11.512a6 6 0 1 0 8.466 8.475",key:"s6vs5t"}],["path",{d:"M9 16a1 1 0 0 1-1-1v-4c0-.552.45-1.008.995-.917a6 6 0 0 1 4.922 4.922c.091.544-.365.995-.917.995z",key:"1dl6s6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oB=U("FileCheck2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m3 15 2 2 4-4",key:"1lhrkk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lB=U("FileCheck",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m9 15 2 2 4-4",key:"1grp1n"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cB=U("FileClock",[["path",{d:"M16 22h2a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v3",key:"37hlfg"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["circle",{cx:"8",cy:"16",r:"6",key:"10v15b"}],["path",{d:"M9.5 17.5 8 16.25V14",key:"1o80t2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dB=U("FileCode2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m5 12-3 3 3 3",key:"oke12k"}],["path",{d:"m9 18 3-3-3-3",key:"112psh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uB=U("FileCode",[["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z",key:"1mlx9k"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const S2=U("FileCog",[["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m3.2 12.9-.9-.4",key:"1i3dj5"}],["path",{d:"m3.2 15.1-.9.4",key:"1fvgj0"}],["path",{d:"M4.677 21.5a2 2 0 0 0 1.313.5H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v2.5",key:"1yo3oz"}],["path",{d:"m4.9 11.2-.4-.9",key:"otmhb9"}],["path",{d:"m4.9 16.8-.4.9",key:"1b8z07"}],["path",{d:"m7.5 10.3-.4.9",key:"11k65u"}],["path",{d:"m7.5 17.7-.4-.9",key:"431x55"}],["path",{d:"m9.7 12.5-.9.4",key:"87sjan"}],["path",{d:"m9.7 15.5-.9-.4",key:"khqm91"}],["circle",{cx:"6",cy:"14",r:"3",key:"a1xfv6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hB=U("FileDiff",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M9 10h6",key:"9gxzsh"}],["path",{d:"M12 13V7",key:"h0r20n"}],["path",{d:"M9 17h6",key:"r8uit2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fB=U("FileDigit",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["rect",{width:"4",height:"6",x:"2",y:"12",rx:"2",key:"jm304g"}],["path",{d:"M10 12h2v6",key:"12zw74"}],["path",{d:"M10 18h4",key:"1ulq68"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pB=U("FileDown",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M12 18v-6",key:"17g6i2"}],["path",{d:"m9 15 3 3 3-3",key:"1npd3o"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mB=U("FileHeart",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v2",key:"17k7jt"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10.29 10.7a2.43 2.43 0 0 0-2.66-.52c-.29.12-.56.3-.78.53l-.35.34-.35-.34a2.43 2.43 0 0 0-2.65-.53c-.3.12-.56.3-.79.53-.95.94-1 2.53.2 3.74L6.5 18l3.6-3.55c1.2-1.21 1.14-2.8.19-3.74Z",key:"1c1fso"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const f1=U("FileImage",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["circle",{cx:"10",cy:"12",r:"2",key:"737tya"}],["path",{d:"m20 17-1.296-1.296a2.41 2.41 0 0 0-3.408 0L9 22",key:"wt3hpn"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gB=U("FileInput",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M2 15h10",key:"jfw4w8"}],["path",{d:"m9 18 3-3-3-3",key:"112psh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xB=U("FileJson2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M4 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1",key:"fq0c9t"}],["path",{d:"M8 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1",key:"4gibmv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yB=U("FileJson",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1",key:"1oajmo"}],["path",{d:"M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1",key:"mpwhp6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vB=U("FileKey2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v6",key:"rc0qvx"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["circle",{cx:"4",cy:"16",r:"2",key:"1ehqvc"}],["path",{d:"m10 10-4.5 4.5",key:"7fwrp6"}],["path",{d:"m9 11 1 1",key:"wa6s5q"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _B=U("FileKey",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["circle",{cx:"10",cy:"16",r:"2",key:"4ckbqe"}],["path",{d:"m16 10-4.5 4.5",key:"7p3ebg"}],["path",{d:"m15 11 1 1",key:"1bsyx3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bB=U("FileLock2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v1",key:"jmtmu2"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["rect",{width:"8",height:"5",x:"2",y:"13",rx:"1",key:"10y5wo"}],["path",{d:"M8 13v-2a2 2 0 1 0-4 0v2",key:"1pdxzg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wB=U("FileLock",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["rect",{width:"8",height:"6",x:"8",y:"12",rx:"1",key:"3yr8at"}],["path",{d:"M10 12v-2a2 2 0 1 1 4 0v2",key:"j4i8d"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jB=U("FileMinus2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M3 15h6",key:"4e2qda"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kB=U("FileMinus",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M9 15h6",key:"cctwl0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const NB=U("FileMusic",[["path",{d:"M10.5 22H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v8.4",key:"1d3kfm"}],["path",{d:"M8 18v-7.7L16 9v7",key:"1oie6o"}],["circle",{cx:"14",cy:"16",r:"2",key:"1bzzi3"}],["circle",{cx:"6",cy:"18",r:"2",key:"1fncim"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const SB=U("FileOutput",[["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M4 7V4a2 2 0 0 1 2-2 2 2 0 0 0-2 2",key:"1vk7w2"}],["path",{d:"M4.063 20.999a2 2 0 0 0 2 1L18 22a2 2 0 0 0 2-2V7l-5-5H6",key:"1jink5"}],["path",{d:"m5 11-3 3",key:"1dgrs4"}],["path",{d:"m5 17-3-3h10",key:"1mvvaf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const C2=U("FilePenLine",[["path",{d:"m18 5-2.414-2.414A2 2 0 0 0 14.172 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2",key:"142zxg"}],["path",{d:"M21.378 12.626a1 1 0 0 0-3.004-3.004l-4.01 4.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z",key:"2t3380"}],["path",{d:"M8 18h1",key:"13wk12"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const M2=U("FilePen",[["path",{d:"M12.5 22H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v9.5",key:"1couwa"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M13.378 15.626a1 1 0 1 0-3.004-3.004l-5.01 5.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z",key:"1y4qbx"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const CB=U("FilePlus2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M3 15h6",key:"4e2qda"}],["path",{d:"M6 12v6",key:"1u72j0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const MB=U("FilePlus",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M9 15h6",key:"cctwl0"}],["path",{d:"M12 18v-6",key:"17g6i2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const TB=U("FileQuestion",[["path",{d:"M12 17h.01",key:"p32p05"}],["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z",key:"1mlx9k"}],["path",{d:"M9.1 9a3 3 0 0 1 5.82 1c0 2-3 3-3 3",key:"mhlwft"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const AB=U("FileScan",[["path",{d:"M20 10V7l-5-5H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h4",key:"1rdf37"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M16 14a2 2 0 0 0-2 2",key:"ceaadl"}],["path",{d:"M20 14a2 2 0 0 1 2 2",key:"1ny6zw"}],["path",{d:"M20 22a2 2 0 0 0 2-2",key:"1l9q4k"}],["path",{d:"M16 22a2 2 0 0 1-2-2",key:"1wqh5n"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const EB=U("FileSearch2",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["circle",{cx:"11.5",cy:"14.5",r:"2.5",key:"1bq0ko"}],["path",{d:"M13.3 16.3 15 18",key:"2quom7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const IB=U("FileSearch",[["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M4.268 21a2 2 0 0 0 1.727 1H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v3",key:"ms7g94"}],["path",{d:"m9 18-1.5-1.5",key:"1j6qii"}],["circle",{cx:"5",cy:"14",r:"3",key:"ufru5t"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const PB=U("FileSliders",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M10 11v2",key:"1s651w"}],["path",{d:"M8 17h8",key:"wh5c61"}],["path",{d:"M14 16v2",key:"12fp5e"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const p1=U("FileSpreadsheet",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M8 13h2",key:"yr2amv"}],["path",{d:"M14 13h2",key:"un5t4a"}],["path",{d:"M8 17h2",key:"2yhykz"}],["path",{d:"M14 17h2",key:"10kma7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const LB=U("FileStack",[["path",{d:"M21 7h-3a2 2 0 0 1-2-2V2",key:"9rb54x"}],["path",{d:"M21 6v6.5c0 .8-.7 1.5-1.5 1.5h-7c-.8 0-1.5-.7-1.5-1.5v-9c0-.8.7-1.5 1.5-1.5H17Z",key:"1059l0"}],["path",{d:"M7 8v8.8c0 .3.2.6.4.8.2.2.5.4.8.4H15",key:"16874u"}],["path",{d:"M3 12v8.8c0 .3.2.6.4.8.2.2.5.4.8.4H11",key:"k2ox98"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const OB=U("FileSymlink",[["path",{d:"m10 18 3-3-3-3",key:"18f6ys"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M4 11V4a2 2 0 0 1 2-2h9l5 5v13a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2v-3a2 2 0 0 1 2-2h7",key:"50q2rw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const DB=U("FileTerminal",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m8 16 2-2-2-2",key:"10vzyd"}],["path",{d:"M12 18h4",key:"1wd2n7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const La=U("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const RB=U("FileType2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M2 13v-1h6v1",key:"1dh9dg"}],["path",{d:"M5 12v6",key:"150t9c"}],["path",{d:"M4 18h2",key:"1xrofg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const FB=U("FileType",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M9 13v-1h6v1",key:"1bb014"}],["path",{d:"M12 12v6",key:"3ahymv"}],["path",{d:"M11 18h2",key:"12mj7e"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zB=U("FileUp",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M12 12v6",key:"3ahymv"}],["path",{d:"m15 15-3-3-3 3",key:"15xj92"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const BB=U("FileUser",[["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M15 18a3 3 0 1 0-6 0",key:"16awa0"}],["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z",key:"1mlx9k"}],["circle",{cx:"12",cy:"13",r:"2",key:"1c1ljs"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $B=U("FileVideo2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["rect",{width:"8",height:"6",x:"2",y:"12",rx:"1",key:"1a6c1e"}],["path",{d:"m10 15.5 4 2.5v-6l-4 2.5",key:"t7cp39"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const UB=U("FileVideo",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m10 11 5 3-5 3v-6Z",key:"7ntvm4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qB=U("FileVolume2",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M8 15h.01",key:"a7atzg"}],["path",{d:"M11.5 13.5a2.5 2.5 0 0 1 0 3",key:"1fccat"}],["path",{d:"M15 12a5 5 0 0 1 0 6",key:"ps46cm"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const VB=U("FileVolume",[["path",{d:"M11 11a5 5 0 0 1 0 6",key:"193qb2"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M4 6.765V4a2 2 0 0 1 2-2h9l5 5v13a2 2 0 0 1-2 2H6a2 2 0 0 1-.93-.23",key:"ifyjnl"}],["path",{d:"M7 10.51a.5.5 0 0 0-.826-.38l-1.893 1.628A1 1 0 0 1 3.63 12H2.5a.5.5 0 0 0-.5.5v3a.5.5 0 0 0 .5.5h1.129a1 1 0 0 1 .652.242l1.893 1.63a.5.5 0 0 0 .826-.38z",key:"mk8rxu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const HB=U("FileWarning",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const WB=U("FileX2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m8 12.5-5 5",key:"b853mi"}],["path",{d:"m3 12.5 5 5",key:"1qls4r"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const GB=U("FileX",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m14.5 12.5-5 5",key:"b62r18"}],["path",{d:"m9.5 12.5 5 5",key:"1rk7el"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const KB=U("File",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ZB=U("Files",[["path",{d:"M20 7h-3a2 2 0 0 1-2-2V2",key:"x099mo"}],["path",{d:"M9 18a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h7l4 4v10a2 2 0 0 1-2 2Z",key:"18t6ie"}],["path",{d:"M3 7.6v12.8A1.6 1.6 0 0 0 4.6 22h9.8",key:"1nja0z"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ad=U("Film",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M7 3v18",key:"bbkbws"}],["path",{d:"M3 7.5h4",key:"zfgn84"}],["path",{d:"M3 12h18",key:"1i2n21"}],["path",{d:"M3 16.5h4",key:"1230mu"}],["path",{d:"M17 3v18",key:"in4fa5"}],["path",{d:"M17 7.5h4",key:"myr1c1"}],["path",{d:"M17 16.5h4",key:"go4c1d"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const YB=U("FilterX",[["path",{d:"M13.013 3H2l8 9.46V19l4 2v-8.54l.9-1.055",key:"1fi1da"}],["path",{d:"m22 3-5 5",key:"12jva0"}],["path",{d:"m17 3 5 5",key:"k36vhe"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const m1=U("Filter",[["polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3",key:"1yg77f"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const XB=U("Fingerprint",[["path",{d:"M12 10a2 2 0 0 0-2 2c0 1.02-.1 2.51-.26 4",key:"1nerag"}],["path",{d:"M14 13.12c0 2.38 0 6.38-1 8.88",key:"o46ks0"}],["path",{d:"M17.29 21.02c.12-.6.43-2.3.5-3.02",key:"ptglia"}],["path",{d:"M2 12a10 10 0 0 1 18-6",key:"ydlgp0"}],["path",{d:"M2 16h.01",key:"1gqxmh"}],["path",{d:"M21.8 16c.2-2 .131-5.354 0-6",key:"drycrb"}],["path",{d:"M5 19.5C5.5 18 6 15 6 12a6 6 0 0 1 .34-2",key:"1tidbn"}],["path",{d:"M8.65 22c.21-.66.45-1.32.57-2",key:"13wd9y"}],["path",{d:"M9 6.8a6 6 0 0 1 9 5.2v2",key:"1fr1j5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const QB=U("FireExtinguisher",[["path",{d:"M15 6.5V3a1 1 0 0 0-1-1h-2a1 1 0 0 0-1 1v3.5",key:"sqyvz"}],["path",{d:"M9 18h8",key:"i7pszb"}],["path",{d:"M18 3h-3",key:"7idoqj"}],["path",{d:"M11 3a6 6 0 0 0-6 6v11",key:"1v5je3"}],["path",{d:"M5 13h4",key:"svpcxo"}],["path",{d:"M17 10a4 4 0 0 0-8 0v10a2 2 0 0 0 2 2h4a2 2 0 0 0 2-2Z",key:"vsjego"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const JB=U("FishOff",[["path",{d:"M18 12.47v.03m0-.5v.47m-.475 5.056A6.744 6.744 0 0 1 15 18c-3.56 0-7.56-2.53-8.5-6 .348-1.28 1.114-2.433 2.121-3.38m3.444-2.088A8.802 8.802 0 0 1 15 6c3.56 0 6.06 2.54 7 6-.309 1.14-.786 2.177-1.413 3.058",key:"1j1hse"}],["path",{d:"M7 10.67C7 8 5.58 5.97 2.73 5.5c-1 1.5-1 5 .23 6.5-1.24 1.5-1.24 5-.23 6.5C5.58 18.03 7 16 7 13.33m7.48-4.372A9.77 9.77 0 0 1 16 6.07m0 11.86a9.77 9.77 0 0 1-1.728-3.618",key:"1q46z8"}],["path",{d:"m16.01 17.93-.23 1.4A2 2 0 0 1 13.8 21H9.5a5.96 5.96 0 0 0 1.49-3.98M8.53 3h5.27a2 2 0 0 1 1.98 1.67l.23 1.4M2 2l20 20",key:"1407gh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const e$=U("FishSymbol",[["path",{d:"M2 16s9-15 20-4C11 23 2 8 2 8",key:"h4oh4o"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const t$=U("Fish",[["path",{d:"M6.5 12c.94-3.46 4.94-6 8.5-6 3.56 0 6.06 2.54 7 6-.94 3.47-3.44 6-7 6s-7.56-2.53-8.5-6Z",key:"15baut"}],["path",{d:"M18 12v.5",key:"18hhni"}],["path",{d:"M16 17.93a9.77 9.77 0 0 1 0-11.86",key:"16dt7o"}],["path",{d:"M7 10.67C7 8 5.58 5.97 2.73 5.5c-1 1.5-1 5 .23 6.5-1.24 1.5-1.24 5-.23 6.5C5.58 18.03 7 16 7 13.33",key:"l9di03"}],["path",{d:"M10.46 7.26C10.2 5.88 9.17 4.24 8 3h5.8a2 2 0 0 1 1.98 1.67l.23 1.4",key:"1kjonw"}],["path",{d:"m16.01 17.93-.23 1.4A2 2 0 0 1 13.8 21H9.5a5.96 5.96 0 0 0 1.49-3.98",key:"1zlm23"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const r$=U("FlagOff",[["path",{d:"M8 2c3 0 5 2 8 2s4-1 4-1v11",key:"9rwyz9"}],["path",{d:"M4 22V4",key:"1plyxx"}],["path",{d:"M4 15s1-1 4-1 5 2 8 2",key:"1myooe"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const n$=U("FlagTriangleLeft",[["path",{d:"M17 22V2L7 7l10 5",key:"1rmf0r"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const s$=U("FlagTriangleRight",[["path",{d:"M7 22V2l10 5-10 5",key:"17n18y"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Bx=U("Flag",[["path",{d:"M4 15s1-1 4-1 5 2 8 2 4-1 4-1V3s-1 1-4 1-5-2-8-2-4 1-4 1z",key:"i9b6wo"}],["line",{x1:"4",x2:"4",y1:"22",y2:"15",key:"1cm3nv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const a$=U("FlameKindling",[["path",{d:"M12 2c1 3 2.5 3.5 3.5 4.5A5 5 0 0 1 17 10a5 5 0 1 1-10 0c0-.3 0-.6.1-.9a2 2 0 1 0 3.3-2C8 4.5 11 2 12 2Z",key:"1ir223"}],["path",{d:"m5 22 14-4",key:"1brv4h"}],["path",{d:"m5 18 14 4",key:"lgyyje"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Jh=U("Flame",[["path",{d:"M8.5 14.5A2.5 2.5 0 0 0 11 12c0-1.38-.5-2-1-3-1.072-2.143-.224-4.054 2-6 .5 2.5 2 4.9 4 6.5 2 1.6 3 3.5 3 5.5a7 7 0 1 1-14 0c0-1.153.433-2.294 1-3a2.5 2.5 0 0 0 2.5 2.5z",key:"96xj49"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const i$=U("FlashlightOff",[["path",{d:"M16 16v4a2 2 0 0 1-2 2h-4a2 2 0 0 1-2-2V10c0-2-2-2-2-4",key:"1r120k"}],["path",{d:"M7 2h11v4c0 2-2 2-2 4v1",key:"dz1920"}],["line",{x1:"11",x2:"18",y1:"6",y2:"6",key:"bi1vpe"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const o$=U("Flashlight",[["path",{d:"M18 6c0 2-2 2-2 4v10a2 2 0 0 1-2 2h-4a2 2 0 0 1-2-2V10c0-2-2-2-2-4V2h12z",key:"1orkel"}],["line",{x1:"6",x2:"18",y1:"6",y2:"6",key:"1z11jq"}],["line",{x1:"12",x2:"12",y1:"12",y2:"12",key:"1f4yc1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const l$=U("FlaskConicalOff",[["path",{d:"M10 10 4.72 20.55a1 1 0 0 0 .9 1.45h12.76a1 1 0 0 0 .9-1.45l-1.272-2.542",key:"59ek9y"}],["path",{d:"M10 2v2.343",key:"15t272"}],["path",{d:"M14 2v6.343",key:"sxr80q"}],["path",{d:"M8.5 2h7",key:"csnxdl"}],["path",{d:"M7 16h9",key:"t5njau"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fj=U("FlaskConical",[["path",{d:"M10 2v7.527a2 2 0 0 1-.211.896L4.72 20.55a1 1 0 0 0 .9 1.45h12.76a1 1 0 0 0 .9-1.45l-5.069-10.127A2 2 0 0 1 14 9.527V2",key:"pzvekw"}],["path",{d:"M8.5 2h7",key:"csnxdl"}],["path",{d:"M7 16h10",key:"wp8him"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const c$=U("FlaskRound",[["path",{d:"M10 2v7.31",key:"5d1hyh"}],["path",{d:"M14 9.3V1.99",key:"14k4l0"}],["path",{d:"M8.5 2h7",key:"csnxdl"}],["path",{d:"M14 9.3a6.5 6.5 0 1 1-4 0",key:"1r8fvy"}],["path",{d:"M5.52 16h12.96",key:"46hh1i"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const d$=U("FlipHorizontal2",[["path",{d:"m3 7 5 5-5 5V7",key:"couhi7"}],["path",{d:"m21 7-5 5 5 5V7",key:"6ouia7"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 14v2",key:"8jcxud"}],["path",{d:"M12 8v2",key:"1woqiv"}],["path",{d:"M12 2v2",key:"tus03m"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const u$=U("FlipHorizontal",[["path",{d:"M8 3H5a2 2 0 0 0-2 2v14c0 1.1.9 2 2 2h3",key:"1i73f7"}],["path",{d:"M16 3h3a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-3",key:"saxlbk"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 14v2",key:"8jcxud"}],["path",{d:"M12 8v2",key:"1woqiv"}],["path",{d:"M12 2v2",key:"tus03m"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const h$=U("FlipVertical2",[["path",{d:"m17 3-5 5-5-5h10",key:"1ftt6x"}],["path",{d:"m17 21-5-5-5 5h10",key:"1m0wmu"}],["path",{d:"M4 12H2",key:"rhcxmi"}],["path",{d:"M10 12H8",key:"s88cx1"}],["path",{d:"M16 12h-2",key:"10asgb"}],["path",{d:"M22 12h-2",key:"14jgyd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const f$=U("FlipVertical",[["path",{d:"M21 8V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v3",key:"14bfxa"}],["path",{d:"M21 16v3a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-3",key:"14rx03"}],["path",{d:"M4 12H2",key:"rhcxmi"}],["path",{d:"M10 12H8",key:"s88cx1"}],["path",{d:"M16 12h-2",key:"10asgb"}],["path",{d:"M22 12h-2",key:"14jgyd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const am=U("Flower2",[["path",{d:"M12 5a3 3 0 1 1 3 3m-3-3a3 3 0 1 0-3 3m3-3v1M9 8a3 3 0 1 0 3 3M9 8h1m5 0a3 3 0 1 1-3 3m3-3h-1m-2 3v-1",key:"3pnvol"}],["circle",{cx:"12",cy:"8",r:"2",key:"1822b1"}],["path",{d:"M12 10v12",key:"6ubwww"}],["path",{d:"M12 22c4.2 0 7-1.667 7-5-4.2 0-7 1.667-7 5Z",key:"9hd38g"}],["path",{d:"M12 22c-4.2 0-7-1.667-7-5 4.2 0 7 1.667 7 5Z",key:"ufn41s"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const p$=U("Flower",[["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["path",{d:"M12 16.5A4.5 4.5 0 1 1 7.5 12 4.5 4.5 0 1 1 12 7.5a4.5 4.5 0 1 1 4.5 4.5 4.5 4.5 0 1 1-4.5 4.5",key:"14wa3c"}],["path",{d:"M12 7.5V9",key:"1oy5b0"}],["path",{d:"M7.5 12H9",key:"eltsq1"}],["path",{d:"M16.5 12H15",key:"vk5kw4"}],["path",{d:"M12 16.5V15",key:"k7eayi"}],["path",{d:"m8 8 1.88 1.88",key:"nxy4qf"}],["path",{d:"M14.12 9.88 16 8",key:"1lst6k"}],["path",{d:"m8 16 1.88-1.88",key:"h2eex1"}],["path",{d:"M14.12 14.12 16 16",key:"uqkrx3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const m$=U("Focus",[["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const g$=U("FoldHorizontal",[["path",{d:"M2 12h6",key:"1wqiqv"}],["path",{d:"M22 12h-6",key:"1eg9hc"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 8v2",key:"1woqiv"}],["path",{d:"M12 14v2",key:"8jcxud"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m19 9-3 3 3 3",key:"12ol22"}],["path",{d:"m5 15 3-3-3-3",key:"1kdhjc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const x$=U("FoldVertical",[["path",{d:"M12 22v-6",key:"6o8u61"}],["path",{d:"M12 8V2",key:"1wkif3"}],["path",{d:"M4 12H2",key:"rhcxmi"}],["path",{d:"M10 12H8",key:"s88cx1"}],["path",{d:"M16 12h-2",key:"10asgb"}],["path",{d:"M22 12h-2",key:"14jgyd"}],["path",{d:"m15 19-3-3-3 3",key:"e37ymu"}],["path",{d:"m15 5-3 3-3-3",key:"19d6lf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const y$=U("FolderArchive",[["circle",{cx:"15",cy:"19",r:"2",key:"u2pros"}],["path",{d:"M20.9 19.8A2 2 0 0 0 22 18V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2h5.1",key:"1jj40k"}],["path",{d:"M15 11v-1",key:"cntcp"}],["path",{d:"M15 17v-2",key:"1279jj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const v$=U("FolderCheck",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}],["path",{d:"m9 13 2 2 4-4",key:"6343dt"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _$=U("FolderClock",[["circle",{cx:"16",cy:"16",r:"6",key:"qoo3c4"}],["path",{d:"M7 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2",key:"1urifu"}],["path",{d:"M16 14v2l1 1",key:"xth2jh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const b$=U("FolderClosed",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}],["path",{d:"M2 10h20",key:"1ir3d8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const w$=U("FolderCode",[["path",{d:"M10 10.5 8 13l2 2.5",key:"m4t9c1"}],["path",{d:"m14 10.5 2 2.5-2 2.5",key:"14w2eb"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2z",key:"1u1bxd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const T2=U("FolderCog",[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["path",{d:"M10.3 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v3.3",key:"1k8050"}],["path",{d:"m21.7 19.4-.9-.3",key:"1qgwi9"}],["path",{d:"m15.2 16.9-.9-.3",key:"1t7mvx"}],["path",{d:"m16.6 21.7.3-.9",key:"1j67ps"}],["path",{d:"m19.1 15.2.3-.9",key:"18r7jp"}],["path",{d:"m19.6 21.7-.4-1",key:"z2vh2"}],["path",{d:"m16.8 15.3-.4-1",key:"1ei7r6"}],["path",{d:"m14.3 19.6 1-.4",key:"11sv9r"}],["path",{d:"m20.7 16.8 1-.4",key:"19m87a"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const j$=U("FolderDot",[["path",{d:"M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.93a2 2 0 0 1-1.66-.9l-.82-1.2A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13c0 1.1.9 2 2 2Z",key:"1fr9dc"}],["circle",{cx:"12",cy:"13",r:"1",key:"49l61u"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const k$=U("FolderDown",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}],["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"m15 13-3 3-3-3",key:"6j2sf0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const N$=U("FolderGit2",[["path",{d:"M9 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v5",key:"1w6njk"}],["circle",{cx:"13",cy:"12",r:"2",key:"1j92g6"}],["path",{d:"M18 19c-2.8 0-5-2.2-5-5v8",key:"pkpw2h"}],["circle",{cx:"20",cy:"19",r:"2",key:"1obnsp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const S$=U("FolderGit",[["circle",{cx:"12",cy:"13",r:"2",key:"1c1ljs"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}],["path",{d:"M14 13h3",key:"1dgedf"}],["path",{d:"M7 13h3",key:"1pygq7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const C$=U("FolderHeart",[["path",{d:"M11 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v1.5",key:"6hud8k"}],["path",{d:"M13.9 17.45c-1.2-1.2-1.14-2.8-.2-3.73a2.43 2.43 0 0 1 3.44 0l.36.34.34-.34a2.43 2.43 0 0 1 3.45-.01c.95.95 1 2.53-.2 3.74L17.5 21Z",key:"wpff58"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const M$=U("FolderInput",[["path",{d:"M2 9V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-1",key:"fm4g5t"}],["path",{d:"M2 13h10",key:"pgb2dq"}],["path",{d:"m9 16 3-3-3-3",key:"6m91ic"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const T$=U("FolderKanban",[["path",{d:"M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.93a2 2 0 0 1-1.66-.9l-.82-1.2A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13c0 1.1.9 2 2 2Z",key:"1fr9dc"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M12 10v2",key:"hh53o1"}],["path",{d:"M16 10v6",key:"1d6xys"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const A$=U("FolderKey",[["circle",{cx:"16",cy:"20",r:"2",key:"1vifvg"}],["path",{d:"M10 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v2",key:"3hgo9p"}],["path",{d:"m22 14-4.5 4.5",key:"1ef6z8"}],["path",{d:"m21 15 1 1",key:"1ejcpy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const E$=U("FolderLock",[["rect",{width:"8",height:"5",x:"14",y:"17",rx:"1",key:"19aais"}],["path",{d:"M10 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v2.5",key:"1w6v7t"}],["path",{d:"M20 17v-2a2 2 0 1 0-4 0v2",key:"pwaxnr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const I$=U("FolderMinus",[["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const P$=U("FolderOpenDot",[["path",{d:"m6 14 1.45-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.55 6a2 2 0 0 1-1.94 1.5H4a2 2 0 0 1-2-2V5c0-1.1.9-2 2-2h3.93a2 2 0 0 1 1.66.9l.82 1.2a2 2 0 0 0 1.66.9H18a2 2 0 0 1 2 2v2",key:"1nmvlm"}],["circle",{cx:"14",cy:"15",r:"1",key:"1gm4qj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $x=U("FolderOpen",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const L$=U("FolderOutput",[["path",{d:"M2 7.5V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-1.5",key:"1yk7aj"}],["path",{d:"M2 13h10",key:"pgb2dq"}],["path",{d:"m5 10-3 3 3 3",key:"1r8ie0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const A2=U("FolderPen",[["path",{d:"M2 11.5V5a2 2 0 0 1 2-2h3.9c.7 0 1.3.3 1.7.9l.8 1.2c.4.6 1 .9 1.7.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2h-9.5",key:"a8xqs0"}],["path",{d:"M11.378 13.626a1 1 0 1 0-3.004-3.004l-5.01 5.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z",key:"1saktj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const O$=U("FolderPlus",[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const D$=U("FolderRoot",[["path",{d:"M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.93a2 2 0 0 1-1.66-.9l-.82-1.2A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13c0 1.1.9 2 2 2Z",key:"1fr9dc"}],["circle",{cx:"12",cy:"13",r:"2",key:"1c1ljs"}],["path",{d:"M12 15v5",key:"11xva1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const R$=U("FolderSearch2",[["circle",{cx:"11.5",cy:"12.5",r:"2.5",key:"1ea5ju"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}],["path",{d:"M13.3 14.3 15 16",key:"1y4v1n"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const F$=U("FolderSearch",[["path",{d:"M10.7 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v4.1",key:"1bw5m7"}],["path",{d:"m21 21-1.9-1.9",key:"1g2n9r"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const z$=U("FolderSymlink",[["path",{d:"M2 9V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-3a2 2 0 0 1 2-2h7",key:"x1c07l"}],["path",{d:"m8 16 3-3-3-3",key:"rlqrt1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const B$=U("FolderSync",[["path",{d:"M9 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v.5",key:"1dkoa9"}],["path",{d:"M12 10v4h4",key:"1czhmt"}],["path",{d:"m12 14 1.535-1.605a5 5 0 0 1 8 1.5",key:"lvuxfi"}],["path",{d:"M22 22v-4h-4",key:"1ewp4q"}],["path",{d:"m22 18-1.535 1.605a5 5 0 0 1-8-1.5",key:"14ync0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $$=U("FolderTree",[["path",{d:"M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"hod4my"}],["path",{d:"M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"w4yl2u"}],["path",{d:"M3 5a2 2 0 0 0 2 2h3",key:"f2jnh7"}],["path",{d:"M3 3v13a2 2 0 0 0 2 2h3",key:"k8epm1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const U$=U("FolderUp",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}],["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"m9 13 3-3 3 3",key:"1pxg3c"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const q$=U("FolderX",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}],["path",{d:"m9.5 10.5 5 5",key:"ra9qjz"}],["path",{d:"m14.5 10.5-5 5",key:"l2rkpq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const V$=U("Folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const H$=U("Folders",[["path",{d:"M20 17a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3.9a2 2 0 0 1-1.69-.9l-.81-1.2a2 2 0 0 0-1.67-.9H8a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2Z",key:"4u7rpt"}],["path",{d:"M2 8v11a2 2 0 0 0 2 2h14",key:"1eicx1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const W$=U("Footprints",[["path",{d:"M4 16v-2.38C4 11.5 2.97 10.5 3 8c.03-2.72 1.49-6 4.5-6C9.37 2 10 3.8 10 5.5c0 3.11-2 5.66-2 8.68V16a2 2 0 1 1-4 0Z",key:"1dudjm"}],["path",{d:"M20 20v-2.38c0-2.12 1.03-3.12 1-5.62-.03-2.72-1.49-6-4.5-6C14.63 6 14 7.8 14 9.5c0 3.11 2 5.66 2 8.68V20a2 2 0 1 0 4 0Z",key:"l2t8xc"}],["path",{d:"M16 17h4",key:"1dejxt"}],["path",{d:"M4 13h4",key:"1bwh8b"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const G$=U("Forklift",[["path",{d:"M12 12H5a2 2 0 0 0-2 2v5",key:"7zsz91"}],["circle",{cx:"13",cy:"19",r:"2",key:"wjnkru"}],["circle",{cx:"5",cy:"19",r:"2",key:"v8kfzx"}],["path",{d:"M8 19h3m5-17v17h6M6 12V7c0-1.1.9-2 2-2h3l5 5",key:"13bk1p"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const K$=U("Forward",[["polyline",{points:"15 17 20 12 15 7",key:"1w3sku"}],["path",{d:"M4 18v-2a4 4 0 0 1 4-4h12",key:"jmiej9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Z$=U("Frame",[["line",{x1:"22",x2:"2",y1:"6",y2:"6",key:"15w7dq"}],["line",{x1:"22",x2:"2",y1:"18",y2:"18",key:"1ip48p"}],["line",{x1:"6",x2:"6",y1:"2",y2:"22",key:"a2lnyx"}],["line",{x1:"18",x2:"18",y1:"2",y2:"22",key:"8vb6jd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Y$=U("Framer",[["path",{d:"M5 16V9h14V2H5l14 14h-7m-7 0 7 7v-7m-7 0h7",key:"1a2nng"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const X$=U("Frown",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M16 16s-1.5-2-4-2-4 2-4 2",key:"epbg0q"}],["line",{x1:"9",x2:"9.01",y1:"9",y2:"9",key:"yxxnd0"}],["line",{x1:"15",x2:"15.01",y1:"9",y2:"9",key:"1p4y9e"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Q$=U("Fuel",[["line",{x1:"3",x2:"15",y1:"22",y2:"22",key:"xegly4"}],["line",{x1:"4",x2:"14",y1:"9",y2:"9",key:"xcnuvu"}],["path",{d:"M14 22V4a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v18",key:"16j0yd"}],["path",{d:"M14 13h2a2 2 0 0 1 2 2v2a2 2 0 0 0 2 2a2 2 0 0 0 2-2V9.83a2 2 0 0 0-.59-1.42L18 5",key:"7cu91f"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const J$=U("Fullscreen",[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}],["rect",{width:"10",height:"8",x:"7",y:"8",rx:"1",key:"vys8me"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const eU=U("GalleryHorizontalEnd",[["path",{d:"M2 7v10",key:"a2pl2d"}],["path",{d:"M6 5v14",key:"1kq3d7"}],["rect",{width:"12",height:"18",x:"10",y:"3",rx:"2",key:"13i7bc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tU=U("GalleryHorizontal",[["path",{d:"M2 3v18",key:"pzttux"}],["rect",{width:"12",height:"18",x:"6",y:"3",rx:"2",key:"btr8bg"}],["path",{d:"M22 3v18",key:"6jf3v"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rU=U("GalleryThumbnails",[["rect",{width:"18",height:"14",x:"3",y:"3",rx:"2",key:"74y24f"}],["path",{d:"M4 21h1",key:"16zlid"}],["path",{d:"M9 21h1",key:"15o7lz"}],["path",{d:"M14 21h1",key:"v9vybs"}],["path",{d:"M19 21h1",key:"edywat"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nU=U("GalleryVerticalEnd",[["path",{d:"M7 2h10",key:"nczekb"}],["path",{d:"M5 6h14",key:"u2x4p"}],["rect",{width:"18",height:"12",x:"3",y:"10",rx:"2",key:"l0tzu3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sU=U("GalleryVertical",[["path",{d:"M3 2h18",key:"15qxfx"}],["rect",{width:"18",height:"12",x:"3",y:"6",rx:"2",key:"1439r6"}],["path",{d:"M3 22h18",key:"8prr45"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const aU=U("Gamepad2",[["line",{x1:"6",x2:"10",y1:"11",y2:"11",key:"1gktln"}],["line",{x1:"8",x2:"8",y1:"9",y2:"13",key:"qnk9ow"}],["line",{x1:"15",x2:"15.01",y1:"12",y2:"12",key:"krot7o"}],["line",{x1:"18",x2:"18.01",y1:"10",y2:"10",key:"1lcuu1"}],["path",{d:"M17.32 5H6.68a4 4 0 0 0-3.978 3.59c-.006.052-.01.101-.017.152C2.604 9.416 2 14.456 2 16a3 3 0 0 0 3 3c1 0 1.5-.5 2-1l1.414-1.414A2 2 0 0 1 9.828 16h4.344a2 2 0 0 1 1.414.586L17 18c.5.5 1 1 2 1a3 3 0 0 0 3-3c0-1.545-.604-6.584-.685-7.258-.007-.05-.011-.1-.017-.151A4 4 0 0 0 17.32 5z",key:"mfqc10"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const iU=U("Gamepad",[["line",{x1:"6",x2:"10",y1:"12",y2:"12",key:"161bw2"}],["line",{x1:"8",x2:"8",y1:"10",y2:"14",key:"1i6ji0"}],["line",{x1:"15",x2:"15.01",y1:"13",y2:"13",key:"dqpgro"}],["line",{x1:"18",x2:"18.01",y1:"11",y2:"11",key:"meh2c"}],["rect",{width:"20",height:"12",x:"2",y:"6",rx:"2",key:"9lu3g6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oU=U("Gauge",[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lU=U("Gavel",[["path",{d:"m14.5 12.5-8 8a2.119 2.119 0 1 1-3-3l8-8",key:"15492f"}],["path",{d:"m16 16 6-6",key:"vzrcl6"}],["path",{d:"m8 8 6-6",key:"18bi4p"}],["path",{d:"m9 7 8 8",key:"5jnvq1"}],["path",{d:"m21 11-8-8",key:"z4y7zo"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cU=U("Gem",[["path",{d:"M6 3h12l4 6-10 13L2 9Z",key:"1pcd5k"}],["path",{d:"M11 3 8 9l4 13 4-13-3-6",key:"1fcu3u"}],["path",{d:"M2 9h20",key:"16fsjt"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pj=U("Ghost",[["path",{d:"M9 10h.01",key:"qbtxuw"}],["path",{d:"M15 10h.01",key:"1qmjsl"}],["path",{d:"M12 2a8 8 0 0 0-8 8v12l3-3 2.5 2.5L12 19l2.5 2.5L17 19l3 3V10a8 8 0 0 0-8-8z",key:"uwwb07"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ki=U("Gift",[["rect",{x:"3",y:"8",width:"18",height:"4",rx:"1",key:"bkv52"}],["path",{d:"M12 8v13",key:"1c76mn"}],["path",{d:"M19 12v7a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2v-7",key:"6wjy6b"}],["path",{d:"M7.5 8a2.5 2.5 0 0 1 0-5A4.8 8 0 0 1 12 8a4.8 8 0 0 1 4.5-5 2.5 2.5 0 0 1 0 5",key:"1ihvrl"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dU=U("GitBranchPlus",[["path",{d:"M6 3v12",key:"qpgusn"}],["path",{d:"M18 9a3 3 0 1 0 0-6 3 3 0 0 0 0 6z",key:"1d02ji"}],["path",{d:"M6 21a3 3 0 1 0 0-6 3 3 0 0 0 0 6z",key:"chk6ph"}],["path",{d:"M15 6a9 9 0 0 0-9 9",key:"or332x"}],["path",{d:"M18 15v6",key:"9wciyi"}],["path",{d:"M21 18h-6",key:"139f0c"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uU=U("GitBranch",[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const E2=U("GitCommitHorizontal",[["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["line",{x1:"3",x2:"9",y1:"12",y2:"12",key:"1dyftd"}],["line",{x1:"15",x2:"21",y1:"12",y2:"12",key:"oup4p8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hU=U("GitCommitVertical",[["path",{d:"M12 3v6",key:"1holv5"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["path",{d:"M12 15v6",key:"a9ows0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fU=U("GitCompareArrows",[["circle",{cx:"5",cy:"6",r:"3",key:"1qnov2"}],["path",{d:"M12 6h5a2 2 0 0 1 2 2v7",key:"1yj91y"}],["path",{d:"m15 9-3-3 3-3",key:"1lwv8l"}],["circle",{cx:"19",cy:"18",r:"3",key:"1qljk2"}],["path",{d:"M12 18H7a2 2 0 0 1-2-2V9",key:"16sdep"}],["path",{d:"m9 15 3 3-3 3",key:"1m3kbl"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pU=U("GitCompare",[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M13 6h3a2 2 0 0 1 2 2v7",key:"1yeb86"}],["path",{d:"M11 18H8a2 2 0 0 1-2-2V9",key:"19pyzm"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mU=U("GitFork",[["circle",{cx:"12",cy:"18",r:"3",key:"1mpf1b"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["path",{d:"M18 9v2c0 .6-.4 1-1 1H7c-.6 0-1-.4-1-1V9",key:"1uq4wg"}],["path",{d:"M12 12v3",key:"158kv8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gU=U("GitGraph",[["circle",{cx:"5",cy:"6",r:"3",key:"1qnov2"}],["path",{d:"M5 9v6",key:"158jrl"}],["circle",{cx:"5",cy:"18",r:"3",key:"104gr9"}],["path",{d:"M12 3v18",key:"108xh3"}],["circle",{cx:"19",cy:"6",r:"3",key:"108a5v"}],["path",{d:"M16 15.7A9 9 0 0 0 19 9",key:"1e3vqb"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xU=U("GitMerge",[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M6 21V9a9 9 0 0 0 9 9",key:"7kw0sc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yU=U("GitPullRequestArrow",[["circle",{cx:"5",cy:"6",r:"3",key:"1qnov2"}],["path",{d:"M5 9v12",key:"ih889a"}],["circle",{cx:"19",cy:"18",r:"3",key:"1qljk2"}],["path",{d:"m15 9-3-3 3-3",key:"1lwv8l"}],["path",{d:"M12 6h5a2 2 0 0 1 2 2v7",key:"1yj91y"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vU=U("GitPullRequestClosed",[["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M6 9v12",key:"1sc30k"}],["path",{d:"m21 3-6 6",key:"16nqsk"}],["path",{d:"m21 9-6-6",key:"9j17rh"}],["path",{d:"M18 11.5V15",key:"65xf6f"}],["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _U=U("GitPullRequestCreateArrow",[["circle",{cx:"5",cy:"6",r:"3",key:"1qnov2"}],["path",{d:"M5 9v12",key:"ih889a"}],["path",{d:"m15 9-3-3 3-3",key:"1lwv8l"}],["path",{d:"M12 6h5a2 2 0 0 1 2 2v3",key:"1rbwk6"}],["path",{d:"M19 15v6",key:"10aioa"}],["path",{d:"M22 18h-6",key:"1d5gi5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bU=U("GitPullRequestCreate",[["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M6 9v12",key:"1sc30k"}],["path",{d:"M13 6h3a2 2 0 0 1 2 2v3",key:"1jb6z3"}],["path",{d:"M18 15v6",key:"9wciyi"}],["path",{d:"M21 18h-6",key:"139f0c"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wU=U("GitPullRequestDraft",[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M18 6V5",key:"1oao2s"}],["path",{d:"M18 11v-1",key:"11c8tz"}],["line",{x1:"6",x2:"6",y1:"9",y2:"21",key:"rroup"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jU=U("GitPullRequest",[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M13 6h3a2 2 0 0 1 2 2v7",key:"1yeb86"}],["line",{x1:"6",x2:"6",y1:"9",y2:"21",key:"rroup"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kU=U("Github",[["path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4",key:"tonef"}],["path",{d:"M9 18c-4.51 2-5-2-7-2",key:"9comsn"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const NU=U("Gitlab",[["path",{d:"m22 13.29-3.33-10a.42.42 0 0 0-.14-.18.38.38 0 0 0-.22-.11.39.39 0 0 0-.23.07.42.42 0 0 0-.14.18l-2.26 6.67H8.32L6.1 3.26a.42.42 0 0 0-.1-.18.38.38 0 0 0-.26-.08.39.39 0 0 0-.23.07.42.42 0 0 0-.14.18L2 13.29a.74.74 0 0 0 .27.83L12 21l9.69-6.88a.71.71 0 0 0 .31-.83Z",key:"148pdi"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const SU=U("GlassWater",[["path",{d:"M5.116 4.104A1 1 0 0 1 6.11 3h11.78a1 1 0 0 1 .994 1.105L17.19 20.21A2 2 0 0 1 15.2 22H8.8a2 2 0 0 1-2-1.79z",key:"p55z4y"}],["path",{d:"M6 12a5 5 0 0 1 6 0 5 5 0 0 0 6 0",key:"mjntcy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const CU=U("Glasses",[["circle",{cx:"6",cy:"15",r:"4",key:"vux9w4"}],["circle",{cx:"18",cy:"15",r:"4",key:"18o8ve"}],["path",{d:"M14 15a2 2 0 0 0-2-2 2 2 0 0 0-2 2",key:"1ag4bs"}],["path",{d:"M2.5 13 5 7c.7-1.3 1.4-2 3-2",key:"1hm1gs"}],["path",{d:"M21.5 13 19 7c-.7-1.3-1.5-2-3-2",key:"1r31ai"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const MU=U("GlobeLock",[["path",{d:"M15.686 15A14.5 14.5 0 0 1 12 22a14.5 14.5 0 0 1 0-20 10 10 0 1 0 9.542 13",key:"qkt0x6"}],["path",{d:"M2 12h8.5",key:"ovaggd"}],["path",{d:"M20 6V4a2 2 0 1 0-4 0v2",key:"1of5e8"}],["rect",{width:"8",height:"5",x:"14",y:"6",rx:"1",key:"1fmf51"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ux=U("Globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const TU=U("Goal",[["path",{d:"M12 13V2l8 4-8 4",key:"5wlwwj"}],["path",{d:"M20.561 10.222a9 9 0 1 1-12.55-5.29",key:"1c0wjv"}],["path",{d:"M8.002 9.997a5 5 0 1 0 8.9 2.02",key:"gb1g7m"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const AU=U("Grab",[["path",{d:"M18 11.5V9a2 2 0 0 0-2-2a2 2 0 0 0-2 2v1.4",key:"edstyy"}],["path",{d:"M14 10V8a2 2 0 0 0-2-2a2 2 0 0 0-2 2v2",key:"19wdwo"}],["path",{d:"M10 9.9V9a2 2 0 0 0-2-2a2 2 0 0 0-2 2v5",key:"1lugqo"}],["path",{d:"M6 14a2 2 0 0 0-2-2a2 2 0 0 0-2 2",key:"1hbeus"}],["path",{d:"M18 11a2 2 0 1 1 4 0v3a8 8 0 0 1-8 8h-4a8 8 0 0 1-8-8 2 2 0 1 1 4 0",key:"1etffm"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const g1=U("GraduationCap",[["path",{d:"M21.42 10.922a1 1 0 0 0-.019-1.838L12.83 5.18a2 2 0 0 0-1.66 0L2.6 9.08a1 1 0 0 0 0 1.832l8.57 3.908a2 2 0 0 0 1.66 0z",key:"j76jl0"}],["path",{d:"M22 10v6",key:"1lu8f3"}],["path",{d:"M6 12.5V16a6 3 0 0 0 12 0v-3.5",key:"1r8lef"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const EU=U("Grape",[["path",{d:"M22 5V2l-5.89 5.89",key:"1eenpo"}],["circle",{cx:"16.6",cy:"15.89",r:"3",key:"xjtalx"}],["circle",{cx:"8.11",cy:"7.4",r:"3",key:"u2fv6i"}],["circle",{cx:"12.35",cy:"11.65",r:"3",key:"i6i8g7"}],["circle",{cx:"13.91",cy:"5.85",r:"3",key:"6ye0dv"}],["circle",{cx:"18.15",cy:"10.09",r:"3",key:"snx9no"}],["circle",{cx:"6.56",cy:"13.2",r:"3",key:"17x4xg"}],["circle",{cx:"10.8",cy:"17.44",r:"3",key:"1hogw9"}],["circle",{cx:"5",cy:"19",r:"3",key:"1sn6vo"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const IU=U("Grid2x2Check",[["path",{d:"M12 3v17a1 1 0 0 1-1 1H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v6a1 1 0 0 1-1 1H3",key:"11za1p"}],["path",{d:"m16 19 2 2 4-4",key:"1b14m6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const I2=U("Grid2x2Plus",[["path",{d:"M12 3v17a1 1 0 0 1-1 1H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v6a1 1 0 0 1-1 1H3",key:"11za1p"}],["path",{d:"M16 19h6",key:"xwg31i"}],["path",{d:"M19 22v-6",key:"qhmiwi"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const PU=U("Grid2x2X",[["path",{d:"M12 3v17a1 1 0 0 1-1 1H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v6a1 1 0 0 1-1 1H3",key:"11za1p"}],["path",{d:"m16 16 5 5",key:"8tpb07"}],["path",{d:"m16 21 5-5",key:"193jll"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const P2=U("Grid2x2",[["path",{d:"M12 3v18",key:"108xh3"}],["path",{d:"M3 12h18",key:"1i2n21"}],["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",key:"h1oib"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Bh=U("Grid3x3",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"M15 3v18",key:"14nvp0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const LU=U("GripHorizontal",[["circle",{cx:"12",cy:"9",r:"1",key:"124mty"}],["circle",{cx:"19",cy:"9",r:"1",key:"1ruzo2"}],["circle",{cx:"5",cy:"9",r:"1",key:"1a8b28"}],["circle",{cx:"12",cy:"15",r:"1",key:"1e56xg"}],["circle",{cx:"19",cy:"15",r:"1",key:"1a92ep"}],["circle",{cx:"5",cy:"15",r:"1",key:"5r1jwy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const x1=U("GripVertical",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const OU=U("Grip",[["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"19",cy:"5",r:"1",key:"w8mnmm"}],["circle",{cx:"5",cy:"5",r:"1",key:"lttvr7"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}],["circle",{cx:"19",cy:"19",r:"1",key:"shf9b7"}],["circle",{cx:"5",cy:"19",r:"1",key:"bfqh0e"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const DU=U("Group",[["path",{d:"M3 7V5c0-1.1.9-2 2-2h2",key:"adw53z"}],["path",{d:"M17 3h2c1.1 0 2 .9 2 2v2",key:"an4l38"}],["path",{d:"M21 17v2c0 1.1-.9 2-2 2h-2",key:"144t0e"}],["path",{d:"M7 21H5c-1.1 0-2-.9-2-2v-2",key:"rtnfgi"}],["rect",{width:"7",height:"5",x:"7",y:"7",rx:"1",key:"1eyiv7"}],["rect",{width:"7",height:"5",x:"10",y:"12",rx:"1",key:"1qlmkx"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const RU=U("Guitar",[["path",{d:"m11.9 12.1 4.514-4.514",key:"109xqo"}],["path",{d:"M20.1 2.3a1 1 0 0 0-1.4 0l-1.114 1.114A2 2 0 0 0 17 4.828v1.344a2 2 0 0 1-.586 1.414A2 2 0 0 1 17.828 7h1.344a2 2 0 0 0 1.414-.586L21.7 5.3a1 1 0 0 0 0-1.4z",key:"txyc8t"}],["path",{d:"m6 16 2 2",key:"16qmzd"}],["path",{d:"M8.2 9.9C8.7 8.8 9.8 8 11 8c2.8 0 5 2.2 5 5 0 1.2-.8 2.3-1.9 2.8l-.9.4A2 2 0 0 0 12 18a4 4 0 0 1-4 4c-3.3 0-6-2.7-6-6a4 4 0 0 1 4-4 2 2 0 0 0 1.8-1.2z",key:"1u8q3z"}],["circle",{cx:"11.5",cy:"12.5",r:".5",fill:"currentColor",key:"16onso"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const FU=U("Ham",[["path",{d:"M13.144 21.144A7.274 10.445 45 1 0 2.856 10.856",key:"1k1t7q"}],["path",{d:"M13.144 21.144A7.274 4.365 45 0 0 2.856 10.856a7.274 4.365 45 0 0 10.288 10.288",key:"153t1g"}],["path",{d:"M16.565 10.435 18.6 8.4a2.501 2.501 0 1 0 1.65-4.65 2.5 2.5 0 1 0-4.66 1.66l-2.024 2.025",key:"gzrt0n"}],["path",{d:"m8.5 16.5-1-1",key:"otr954"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zU=U("Hammer",[["path",{d:"m15 12-8.373 8.373a1 1 0 1 1-3-3L12 9",key:"eefl8a"}],["path",{d:"m18 15 4-4",key:"16gjal"}],["path",{d:"m21.5 11.5-1.914-1.914A2 2 0 0 1 19 8.172V7l-2.26-2.26a6 6 0 0 0-4.202-1.756L9 2.96l.92.82A6.18 6.18 0 0 1 12 8.4V10l2 2h1.172a2 2 0 0 1 1.414.586L18.5 14.5",key:"b7pghm"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const BU=U("HandCoins",[["path",{d:"M11 15h2a2 2 0 1 0 0-4h-3c-.6 0-1.1.2-1.4.6L3 17",key:"geh8rc"}],["path",{d:"m7 21 1.6-1.4c.3-.4.8-.6 1.4-.6h4c1.1 0 2.1-.4 2.8-1.2l4.6-4.4a2 2 0 0 0-2.75-2.91l-4.2 3.9",key:"1fto5m"}],["path",{d:"m2 16 6 6",key:"1pfhp9"}],["circle",{cx:"16",cy:"9",r:"2.9",key:"1n0dlu"}],["circle",{cx:"6",cy:"5",r:"3",key:"151irh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $U=U("HandHeart",[["path",{d:"M11 14h2a2 2 0 1 0 0-4h-3c-.6 0-1.1.2-1.4.6L3 16",key:"1ifwr1"}],["path",{d:"m7 20 1.6-1.4c.3-.4.8-.6 1.4-.6h4c1.1 0 2.1-.4 2.8-1.2l4.6-4.4a2 2 0 0 0-2.75-2.91l-4.2 3.9",key:"17abbs"}],["path",{d:"m2 15 6 6",key:"10dquu"}],["path",{d:"M19.5 8.5c.7-.7 1.5-1.6 1.5-2.7A2.73 2.73 0 0 0 16 4a2.78 2.78 0 0 0-5 1.8c0 1.2.8 2 1.5 2.8L16 12Z",key:"1h3036"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const L2=U("HandHelping",[["path",{d:"M11 12h2a2 2 0 1 0 0-4h-3c-.6 0-1.1.2-1.4.6L3 14",key:"1j4xps"}],["path",{d:"m7 18 1.6-1.4c.3-.4.8-.6 1.4-.6h4c1.1 0 2.1-.4 2.8-1.2l4.6-4.4a2 2 0 0 0-2.75-2.91l-4.2 3.9",key:"uospg8"}],["path",{d:"m2 13 6 6",key:"16e5sb"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const UU=U("HandMetal",[["path",{d:"M18 12.5V10a2 2 0 0 0-2-2a2 2 0 0 0-2 2v1.4",key:"wc6myp"}],["path",{d:"M14 11V9a2 2 0 1 0-4 0v2",key:"94qvcw"}],["path",{d:"M10 10.5V5a2 2 0 1 0-4 0v9",key:"m1ah89"}],["path",{d:"m7 15-1.76-1.76a2 2 0 0 0-2.83 2.82l3.6 3.6C7.5 21.14 9.2 22 12 22h2a8 8 0 0 0 8-8V7a2 2 0 1 0-4 0v5",key:"t1skq1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qU=U("HandPlatter",[["path",{d:"M12 3V2",key:"ar7q03"}],["path",{d:"m15.4 17.4 3.2-2.8a2 2 0 1 1 2.8 2.9l-3.6 3.3c-.7.8-1.7 1.2-2.8 1.2h-4c-1.1 0-2.1-.4-2.8-1.2l-1.302-1.464A1 1 0 0 0 6.151 19H5",key:"n2g93r"}],["path",{d:"M2 14h12a2 2 0 0 1 0 4h-2",key:"1o2jem"}],["path",{d:"M4 10h16",key:"img6z1"}],["path",{d:"M5 10a7 7 0 0 1 14 0",key:"1ega1o"}],["path",{d:"M5 14v6a1 1 0 0 1-1 1H2",key:"1hescx"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const VU=U("Hand",[["path",{d:"M18 11V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2",key:"1fvzgz"}],["path",{d:"M14 10V4a2 2 0 0 0-2-2a2 2 0 0 0-2 2v2",key:"1kc0my"}],["path",{d:"M10 10.5V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2v8",key:"10h0bg"}],["path",{d:"M18 8a2 2 0 1 1 4 0v6a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15",key:"1s1gnw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const HU=U("Handshake",[["path",{d:"m11 17 2 2a1 1 0 1 0 3-3",key:"efffak"}],["path",{d:"m14 14 2.5 2.5a1 1 0 1 0 3-3l-3.88-3.88a3 3 0 0 0-4.24 0l-.88.88a1 1 0 1 1-3-3l2.81-2.81a5.79 5.79 0 0 1 7.06-.87l.47.28a2 2 0 0 0 1.42.25L21 4",key:"9pr0kb"}],["path",{d:"m21 3 1 11h-2",key:"1tisrp"}],["path",{d:"M3 3 2 14l6.5 6.5a1 1 0 1 0 3-3",key:"1uvwmv"}],["path",{d:"M3 4h8",key:"1ep09j"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const WU=U("HardDriveDownload",[["path",{d:"M12 2v8",key:"1q4o3n"}],["path",{d:"m16 6-4 4-4-4",key:"6wukr"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",key:"w68u3i"}],["path",{d:"M6 18h.01",key:"uhywen"}],["path",{d:"M10 18h.01",key:"h775k"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const GU=U("HardDriveUpload",[["path",{d:"m16 6-4-4-4 4",key:"13yo43"}],["path",{d:"M12 2v8",key:"1q4o3n"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",key:"w68u3i"}],["path",{d:"M6 18h.01",key:"uhywen"}],["path",{d:"M10 18h.01",key:"h775k"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const AT=U("HardDrive",[["line",{x1:"22",x2:"2",y1:"12",y2:"12",key:"1y58io"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}],["line",{x1:"6",x2:"6.01",y1:"16",y2:"16",key:"sgf278"}],["line",{x1:"10",x2:"10.01",y1:"16",y2:"16",key:"1l4acy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const KU=U("HardHat",[["path",{d:"M10 10V5a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v5",key:"1p9q5i"}],["path",{d:"M14 6a6 6 0 0 1 6 6v3",key:"1hnv84"}],["path",{d:"M4 15v-3a6 6 0 0 1 6-6",key:"9ciidu"}],["rect",{x:"2",y:"15",width:"20",height:"4",rx:"1",key:"g3x8cw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rS=U("Hash",[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ZU=U("Haze",[["path",{d:"m5.2 6.2 1.4 1.4",key:"17imol"}],["path",{d:"M2 13h2",key:"13gyu8"}],["path",{d:"M20 13h2",key:"16rner"}],["path",{d:"m17.4 7.6 1.4-1.4",key:"t4xlah"}],["path",{d:"M22 17H2",key:"1gtaj3"}],["path",{d:"M22 21H2",key:"1gy6en"}],["path",{d:"M16 13a4 4 0 0 0-8 0",key:"1dyczq"}],["path",{d:"M12 5V2.5",key:"1vytko"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const YU=U("HdmiPort",[["path",{d:"M22 9a1 1 0 0 0-1-1H3a1 1 0 0 0-1 1v4a1 1 0 0 0 1 1h1l2 2h12l2-2h1a1 1 0 0 0 1-1Z",key:"2128wb"}],["path",{d:"M7.5 12h9",key:"1t0ckc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ET=U("Heading1",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"m17 12 3-2v8",key:"1hhhft"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const IT=U("Heading2",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M21 18h-4c0-4 4-3 4-6 0-1.5-2-2.5-4-1",key:"9jr5yi"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const XU=U("Heading3",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M17.5 10.5c1.7-1 3.5 0 3.5 1.5a2 2 0 0 1-2 2",key:"68ncm8"}],["path",{d:"M17 17.5c2 1.5 4 .3 4-1.5a2 2 0 0 0-2-2",key:"1ejuhz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const QU=U("Heading4",[["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M17 10v3a1 1 0 0 0 1 1h3",key:"tj5zdr"}],["path",{d:"M21 10v8",key:"1kdml4"}],["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const JU=U("Heading5",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M17 13v-3h4",key:"1nvgqp"}],["path",{d:"M17 17.7c.4.2.8.3 1.3.3 1.5 0 2.7-1.1 2.7-2.5S19.8 13 18.3 13H17",key:"2nebdn"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const eq=U("Heading6",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["circle",{cx:"19",cy:"16",r:"2",key:"15mx69"}],["path",{d:"M20 10c-2 2-3 3.5-3 6",key:"f35dl0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tq=U("Heading",[["path",{d:"M6 12h12",key:"8npq4p"}],["path",{d:"M6 20V4",key:"1w1bmo"}],["path",{d:"M18 20V4",key:"o2hl4u"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rq=U("HeadphoneOff",[["path",{d:"M21 14h-1.343",key:"1jdnxi"}],["path",{d:"M9.128 3.47A9 9 0 0 1 21 12v3.343",key:"6kipu2"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M20.414 20.414A2 2 0 0 1 19 21h-1a2 2 0 0 1-2-2v-3",key:"9x50f4"}],["path",{d:"M3 14h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-7a9 9 0 0 1 2.636-6.364",key:"1bkxnm"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nq=U("Headphones",[["path",{d:"M3 14h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-7a9 9 0 0 1 18 0v7a2 2 0 0 1-2 2h-1a2 2 0 0 1-2-2v-3a2 2 0 0 1 2-2h3",key:"1xhozi"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sq=U("Headset",[["path",{d:"M3 11h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-5Zm0 0a9 9 0 1 1 18 0m0 0v5a2 2 0 0 1-2 2h-1a2 2 0 0 1-2-2v-3a2 2 0 0 1 2-2h3Z",key:"12oyoe"}],["path",{d:"M21 16v2a4 4 0 0 1-4 4h-5",key:"1x7m43"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const aq=U("HeartCrack",[["path",{d:"M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z",key:"c3ymky"}],["path",{d:"m12 13-1-1 2-2-3-3 2-2",key:"xjdxli"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const iq=U("HeartHandshake",[["path",{d:"M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z",key:"c3ymky"}],["path",{d:"M12 5 9.04 7.96a2.17 2.17 0 0 0 0 3.08c.82.82 2.13.85 3 .07l2.07-1.9a2.82 2.82 0 0 1 3.79 0l2.96 2.66",key:"4oyue0"}],["path",{d:"m18 15-2-2",key:"60u0ii"}],["path",{d:"m15 18-2-2",key:"6p76be"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oq=U("HeartOff",[["line",{x1:"2",y1:"2",x2:"22",y2:"22",key:"1w4vcy"}],["path",{d:"M16.5 16.5 12 21l-7-7c-1.5-1.45-3-3.2-3-5.5a5.5 5.5 0 0 1 2.14-4.35",key:"3mpagl"}],["path",{d:"M8.76 3.1c1.15.22 2.13.78 3.24 1.9 1.5-1.5 2.74-2 4.5-2A5.5 5.5 0 0 1 22 8.5c0 2.12-1.3 3.78-2.67 5.17",key:"1gh3v3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lq=U("HeartPulse",[["path",{d:"M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z",key:"c3ymky"}],["path",{d:"M3.22 12H9.5l.5-1 2 4.5 2-7 1.5 3.5h5.27",key:"1uw2ng"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ci=U("Heart",[["path",{d:"M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z",key:"c3ymky"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cq=U("Heater",[["path",{d:"M11 8c2-3-2-3 0-6",key:"1ldv5m"}],["path",{d:"M15.5 8c2-3-2-3 0-6",key:"1otqoz"}],["path",{d:"M6 10h.01",key:"1lbq93"}],["path",{d:"M6 14h.01",key:"zudwn7"}],["path",{d:"M10 16v-4",key:"1c25yv"}],["path",{d:"M14 16v-4",key:"1dkbt8"}],["path",{d:"M18 16v-4",key:"1yg9me"}],["path",{d:"M20 6a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h3",key:"1ubg90"}],["path",{d:"M5 20v2",key:"1abpe8"}],["path",{d:"M19 20v2",key:"kqn6ft"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dq=U("Hexagon",[["path",{d:"M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z",key:"yt0hxn"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uq=U("Highlighter",[["path",{d:"m9 11-6 6v3h9l3-3",key:"1a3l36"}],["path",{d:"m22 12-4.6 4.6a2 2 0 0 1-2.8 0l-5.2-5.2a2 2 0 0 1 0-2.8L14 4",key:"14a9rk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nS=U("History",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hq=U("HopOff",[["path",{d:"M10.82 16.12c1.69.6 3.91.79 5.18.85.28.01.53-.09.7-.27",key:"qyzcap"}],["path",{d:"M11.14 20.57c.52.24 2.44 1.12 4.08 1.37.46.06.86-.25.9-.71.12-1.52-.3-3.43-.5-4.28",key:"y078lb"}],["path",{d:"M16.13 21.05c1.65.63 3.68.84 4.87.91a.9.9 0 0 0 .7-.26",key:"1utre3"}],["path",{d:"M17.99 5.52a20.83 20.83 0 0 1 3.15 4.5.8.8 0 0 1-.68 1.13c-1.17.1-2.5.02-3.9-.25",key:"17o9hm"}],["path",{d:"M20.57 11.14c.24.52 1.12 2.44 1.37 4.08.04.3-.08.59-.31.75",key:"1d1n4p"}],["path",{d:"M4.93 4.93a10 10 0 0 0-.67 13.4c.35.43.96.4 1.17-.12.69-1.71 1.07-5.07 1.07-6.71 1.34.45 3.1.9 4.88.62a.85.85 0 0 0 .48-.24",key:"9uv3tt"}],["path",{d:"M5.52 17.99c1.05.95 2.91 2.42 4.5 3.15a.8.8 0 0 0 1.13-.68c.2-2.34-.33-5.3-1.57-8.28",key:"1292wz"}],["path",{d:"M8.35 2.68a10 10 0 0 1 9.98 1.58c.43.35.4.96-.12 1.17-1.5.6-4.3.98-6.07 1.05",key:"7ozu9p"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fq=U("Hop",[["path",{d:"M10.82 16.12c1.69.6 3.91.79 5.18.85.55.03 1-.42.97-.97-.06-1.27-.26-3.5-.85-5.18",key:"18lxf1"}],["path",{d:"M11.5 6.5c1.64 0 5-.38 6.71-1.07.52-.2.55-.82.12-1.17A10 10 0 0 0 4.26 18.33c.35.43.96.4 1.17-.12.69-1.71 1.07-5.07 1.07-6.71 1.34.45 3.1.9 4.88.62a.88.88 0 0 0 .73-.74c.3-2.14-.15-3.5-.61-4.88",key:"vtfxrw"}],["path",{d:"M15.62 16.95c.2.85.62 2.76.5 4.28a.77.77 0 0 1-.9.7 16.64 16.64 0 0 1-4.08-1.36",key:"13hl71"}],["path",{d:"M16.13 21.05c1.65.63 3.68.84 4.87.91a.9.9 0 0 0 .96-.96 17.68 17.68 0 0 0-.9-4.87",key:"1sl8oj"}],["path",{d:"M16.94 15.62c.86.2 2.77.62 4.29.5a.77.77 0 0 0 .7-.9 16.64 16.64 0 0 0-1.36-4.08",key:"19c6kt"}],["path",{d:"M17.99 5.52a20.82 20.82 0 0 1 3.15 4.5.8.8 0 0 1-.68 1.13c-2.33.2-5.3-.32-8.27-1.57",key:"85ghs3"}],["path",{d:"M4.93 4.93 3 3a.7.7 0 0 1 0-1",key:"x087yj"}],["path",{d:"M9.58 12.18c1.24 2.98 1.77 5.95 1.57 8.28a.8.8 0 0 1-1.13.68 20.82 20.82 0 0 1-4.5-3.15",key:"11xdqo"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pq=U("Hospital",[["path",{d:"M12 6v4",key:"16clxf"}],["path",{d:"M14 14h-4",key:"esezmu"}],["path",{d:"M14 18h-4",key:"16mqa2"}],["path",{d:"M14 8h-4",key:"z8ypaz"}],["path",{d:"M18 12h2a2 2 0 0 1 2 2v6a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-9a2 2 0 0 1 2-2h2",key:"b1k337"}],["path",{d:"M18 22V4a2 2 0 0 0-2-2H8a2 2 0 0 0-2 2v18",key:"16g51d"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mq=U("Hotel",[["path",{d:"M10 22v-6.57",key:"1wmca3"}],["path",{d:"M12 11h.01",key:"z322tv"}],["path",{d:"M12 7h.01",key:"1ivr5q"}],["path",{d:"M14 15.43V22",key:"1q2vjd"}],["path",{d:"M15 16a5 5 0 0 0-6 0",key:"o9wqvi"}],["path",{d:"M16 11h.01",key:"xkw8gn"}],["path",{d:"M16 7h.01",key:"1kdx03"}],["path",{d:"M8 11h.01",key:"1dfujw"}],["path",{d:"M8 7h.01",key:"1vti4s"}],["rect",{x:"4",y:"2",width:"16",height:"20",rx:"2",key:"1uxh74"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gq=U("Hourglass",[["path",{d:"M5 22h14",key:"ehvnwv"}],["path",{d:"M5 2h14",key:"pdyrp9"}],["path",{d:"M17 22v-4.172a2 2 0 0 0-.586-1.414L12 12l-4.414 4.414A2 2 0 0 0 7 17.828V22",key:"1d314k"}],["path",{d:"M7 2v4.172a2 2 0 0 0 .586 1.414L12 12l4.414-4.414A2 2 0 0 0 17 6.172V2",key:"1vvvr6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xq=U("HousePlug",[["path",{d:"M10 12V8.964",key:"1vll13"}],["path",{d:"M14 12V8.964",key:"1x3qvg"}],["path",{d:"M15 12a1 1 0 0 1 1 1v2a2 2 0 0 1-2 2h-4a2 2 0 0 1-2-2v-2a1 1 0 0 1 1-1z",key:"ppykja"}],["path",{d:"M8.5 21H5a2 2 0 0 1-2-2v-9a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2h-5a2 2 0 0 1-2-2v-2",key:"1gvg2z"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yq=U("HousePlus",[["path",{d:"M13.22 2.416a2 2 0 0 0-2.511.057l-7 5.999A2 2 0 0 0 3 10v9a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7.354",key:"5phn05"}],["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M15 6h6",key:"1jlkvy"}],["path",{d:"M18 3v6",key:"x1uolp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pa=U("House",[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"1d0kgt"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const O2=U("IceCreamBowl",[["path",{d:"M12 17c5 0 8-2.69 8-6H4c0 3.31 3 6 8 6m-4 4h8m-4-3v3M5.14 11a3.5 3.5 0 1 1 6.71 0",key:"1uxfcu"}],["path",{d:"M12.14 11a3.5 3.5 0 1 1 6.71 0",key:"4k3m1s"}],["path",{d:"M15.5 6.5a3.5 3.5 0 1 0-7 0",key:"zmuahr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const D2=U("IceCreamCone",[["path",{d:"m7 11 4.08 10.35a1 1 0 0 0 1.84 0L17 11",key:"1v6356"}],["path",{d:"M17 7A5 5 0 0 0 7 7",key:"151p3v"}],["path",{d:"M17 7a2 2 0 0 1 0 4H7a2 2 0 0 1 0-4",key:"1sdaij"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vq=U("IdCard",[["path",{d:"M16 10h2",key:"8sgtl7"}],["path",{d:"M16 14h2",key:"epxaof"}],["path",{d:"M6.17 15a3 3 0 0 1 5.66 0",key:"n6f512"}],["circle",{cx:"9",cy:"11",r:"2",key:"yxgjnd"}],["rect",{x:"2",y:"5",width:"20",height:"14",rx:"2",key:"qneu4z"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _q=U("ImageDown",[["path",{d:"M10.3 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v10l-3.1-3.1a2 2 0 0 0-2.814.014L6 21",key:"9csbqa"}],["path",{d:"m14 19 3 3v-5.5",key:"9ldu5r"}],["path",{d:"m17 22 3-3",key:"1nkfve"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bq=U("ImageMinus",[["path",{d:"M21 9v10a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7",key:"m87ecr"}],["line",{x1:"16",x2:"22",y1:"5",y2:"5",key:"ez7e4s"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wq=U("ImageOff",[["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}],["path",{d:"M10.41 10.41a2 2 0 1 1-2.83-2.83",key:"1bzlo9"}],["line",{x1:"13.5",x2:"6",y1:"13.5",y2:"21",key:"1q0aeu"}],["line",{x1:"18",x2:"21",y1:"12",y2:"15",key:"5mozeu"}],["path",{d:"M3.59 3.59A1.99 1.99 0 0 0 3 5v14a2 2 0 0 0 2 2h14c.55 0 1.052-.22 1.41-.59",key:"mmje98"}],["path",{d:"M21 15V5a2 2 0 0 0-2-2H9",key:"43el77"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jq=U("ImagePlay",[["path",{d:"m11 16-5 5",key:"j5f7ct"}],["path",{d:"M11 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v6.5",key:"7s81lt"}],["path",{d:"M15.765 22a.5.5 0 0 1-.765-.424V13.38a.5.5 0 0 1 .765-.424l5.878 3.674a1 1 0 0 1 0 1.696z",key:"1omb6s"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sS=U("ImagePlus",[["path",{d:"M16 5h6",key:"1vod17"}],["path",{d:"M19 2v6",key:"4bpg5p"}],["path",{d:"M21 11.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7.5",key:"1ue2ih"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kq=U("ImageUp",[["path",{d:"M10.3 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v10l-3.1-3.1a2 2 0 0 0-2.814.014L6 21",key:"9csbqa"}],["path",{d:"m14 19.5 3-3 3 3",key:"9vmjn0"}],["path",{d:"M17 22v-5.5",key:"1aa6fl"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Nq=U("ImageUpscale",[["path",{d:"M16 3h5v5",key:"1806ms"}],["path",{d:"M17 21h2a2 2 0 0 0 2-2",key:"130fy9"}],["path",{d:"M21 12v3",key:"1wzk3p"}],["path",{d:"m21 3-5 5",key:"1g5oa7"}],["path",{d:"M3 7V5a2 2 0 0 1 2-2",key:"kk3yz1"}],["path",{d:"m5 21 4.144-4.144a1.21 1.21 0 0 1 1.712 0L13 19",key:"fyekpt"}],["path",{d:"M9 3h3",key:"d52fa"}],["rect",{x:"3",y:"11",width:"10",height:"10",rx:"1",key:"1wpmix"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Pl=U("Image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Sq=U("Images",[["path",{d:"M18 22H4a2 2 0 0 1-2-2V6",key:"pblm9e"}],["path",{d:"m22 13-1.296-1.296a2.41 2.41 0 0 0-3.408 0L11 18",key:"nf6bnh"}],["circle",{cx:"12",cy:"8",r:"2",key:"1822b1"}],["rect",{width:"16",height:"16",x:"6",y:"2",rx:"2",key:"12espp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Cq=U("Import",[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m8 11 4 4 4-4",key:"1dohi6"}],["path",{d:"M8 5H4a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2h-4",key:"1ywtjm"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Mq=U("Inbox",[["polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12",key:"o97t9d"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const R2=U("IndentDecrease",[["path",{d:"M21 12H11",key:"wd7e0v"}],["path",{d:"M21 18H11",key:"4wu86t"}],["path",{d:"M21 6H11",key:"6dy1d6"}],["path",{d:"m7 8-4 4 4 4",key:"o5hrat"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const F2=U("IndentIncrease",[["path",{d:"M21 12H11",key:"wd7e0v"}],["path",{d:"M21 18H11",key:"4wu86t"}],["path",{d:"M21 6H11",key:"6dy1d6"}],["path",{d:"m3 8 4 4-4 4",key:"1a3j6y"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Tq=U("IndianRupee",[["path",{d:"M6 3h12",key:"ggurg9"}],["path",{d:"M6 8h12",key:"6g4wlu"}],["path",{d:"m6 13 8.5 8",key:"u1kupk"}],["path",{d:"M6 13h3",key:"wdp6ag"}],["path",{d:"M9 13c6.667 0 6.667-10 0-10",key:"1nkvk2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Aq=U("Infinity",[["path",{d:"M12 12c-2-2.67-4-4-6-4a4 4 0 1 0 0 8c2 0 4-1.33 6-4Zm0 0c2 2.67 4 4 6 4a4 4 0 0 0 0-8c-2 0-4 1.33-6 4Z",key:"1z0uae"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Eq=U("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Iq=U("InspectionPanel",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M7 7h.01",key:"7u93v4"}],["path",{d:"M17 7h.01",key:"14a9sn"}],["path",{d:"M7 17h.01",key:"19xn7k"}],["path",{d:"M17 17h.01",key:"1sd3ek"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lu=U("Instagram",[["rect",{width:"20",height:"20",x:"2",y:"2",rx:"5",ry:"5",key:"2e1cvw"}],["path",{d:"M16 11.37A4 4 0 1 1 12.63 8 4 4 0 0 1 16 11.37z",key:"9exkf1"}],["line",{x1:"17.5",x2:"17.51",y1:"6.5",y2:"6.5",key:"r4j83e"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const aS=U("Italic",[["line",{x1:"19",x2:"10",y1:"4",y2:"4",key:"15jd3p"}],["line",{x1:"14",x2:"5",y1:"20",y2:"20",key:"bu0au3"}],["line",{x1:"15",x2:"9",y1:"4",y2:"20",key:"uljnxc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Pq=U("IterationCcw",[["path",{d:"M20 10c0-4.4-3.6-8-8-8s-8 3.6-8 8 3.6 8 8 8h8",key:"4znkd0"}],["polyline",{points:"16 14 20 18 16 22",key:"11njsm"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Lq=U("IterationCw",[["path",{d:"M4 10c0-4.4 3.6-8 8-8s8 3.6 8 8-3.6 8-8 8H4",key:"tuf4su"}],["polyline",{points:"8 22 4 18 8 14",key:"evkj9s"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Oq=U("JapaneseYen",[["path",{d:"M12 9.5V21m0-11.5L6 3m6 6.5L18 3",key:"2ej80x"}],["path",{d:"M6 15h12",key:"1hwgt5"}],["path",{d:"M6 11h12",key:"wf4gp6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Dq=U("Joystick",[["path",{d:"M21 17a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v2a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-2Z",key:"jg2n2t"}],["path",{d:"M6 15v-2",key:"gd6mvg"}],["path",{d:"M12 15V9",key:"8c7uyn"}],["circle",{cx:"12",cy:"6",r:"3",key:"1gm2ql"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const y1=U("Kanban",[["path",{d:"M6 5v11",key:"mdvv1e"}],["path",{d:"M12 5v6",key:"14ar3b"}],["path",{d:"M18 5v14",key:"7ji314"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mj=U("KeyRound",[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Rq=U("KeySquare",[["path",{d:"M12.4 2.7a2.5 2.5 0 0 1 3.4 0l5.5 5.5a2.5 2.5 0 0 1 0 3.4l-3.7 3.7a2.5 2.5 0 0 1-3.4 0L8.7 9.8a2.5 2.5 0 0 1 0-3.4z",key:"165ttr"}],["path",{d:"m14 7 3 3",key:"1r5n42"}],["path",{d:"m9.4 10.6-6.814 6.814A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814",key:"1ubxi2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ef=U("Key",[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Fq=U("KeyboardMusic",[["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["path",{d:"M6 8h4",key:"utf9t1"}],["path",{d:"M14 8h.01",key:"1primd"}],["path",{d:"M18 8h.01",key:"emo2bl"}],["path",{d:"M2 12h20",key:"9i4pu4"}],["path",{d:"M6 12v4",key:"dy92yo"}],["path",{d:"M10 12v4",key:"1fxnav"}],["path",{d:"M14 12v4",key:"1hft58"}],["path",{d:"M18 12v4",key:"tjjnbz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zq=U("KeyboardOff",[["path",{d:"M 20 4 A2 2 0 0 1 22 6",key:"1g1fkt"}],["path",{d:"M 22 6 L 22 16.41",key:"1qjg3w"}],["path",{d:"M 7 16 L 16 16",key:"n0yqwb"}],["path",{d:"M 9.69 4 L 20 4",key:"kbpcgx"}],["path",{d:"M14 8h.01",key:"1primd"}],["path",{d:"M18 8h.01",key:"emo2bl"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M20 20H4a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2",key:"s23sx2"}],["path",{d:"M6 8h.01",key:"x9i8wu"}],["path",{d:"M8 12h.01",key:"czm47f"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Bq=U("Keyboard",[["path",{d:"M10 8h.01",key:"1r9ogq"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M14 8h.01",key:"1primd"}],["path",{d:"M16 12h.01",key:"1l6xoz"}],["path",{d:"M18 8h.01",key:"emo2bl"}],["path",{d:"M6 8h.01",key:"x9i8wu"}],["path",{d:"M7 16h10",key:"wp8him"}],["path",{d:"M8 12h.01",key:"czm47f"}],["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $q=U("LampCeiling",[["path",{d:"M12 2v5",key:"nd4vlx"}],["path",{d:"M6 7h12l4 9H2l4-9Z",key:"123d64"}],["path",{d:"M9.17 16a3 3 0 1 0 5.66 0",key:"1061mw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Uq=U("LampDesk",[["path",{d:"m14 5-3 3 2 7 8-8-7-2Z",key:"1b0msb"}],["path",{d:"m14 5-3 3-3-3 3-3 3 3Z",key:"1uemms"}],["path",{d:"M9.5 6.5 4 12l3 6",key:"1bx08v"}],["path",{d:"M3 22v-2c0-1.1.9-2 2-2h4a2 2 0 0 1 2 2v2H3Z",key:"wap775"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qq=U("LampFloor",[["path",{d:"M9 2h6l3 7H6l3-7Z",key:"wcx6mj"}],["path",{d:"M12 9v13",key:"3n1su1"}],["path",{d:"M9 22h6",key:"1rlq3v"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Vq=U("LampWallDown",[["path",{d:"M11 13h6l3 7H8l3-7Z",key:"9n3qlo"}],["path",{d:"M14 13V8a2 2 0 0 0-2-2H8",key:"1hu4hb"}],["path",{d:"M4 9h2a2 2 0 0 0 2-2V5a2 2 0 0 0-2-2H4v6Z",key:"s053bc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Hq=U("LampWallUp",[["path",{d:"M11 4h6l3 7H8l3-7Z",key:"11x1ee"}],["path",{d:"M14 11v5a2 2 0 0 1-2 2H8",key:"eutp5o"}],["path",{d:"M4 15h2a2 2 0 0 1 2 2v2a2 2 0 0 1-2 2H4v-6Z",key:"1iuthr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Wq=U("Lamp",[["path",{d:"M8 2h8l4 10H4L8 2Z",key:"9dma5w"}],["path",{d:"M12 12v6",key:"3ahymv"}],["path",{d:"M8 22v-2c0-1.1.9-2 2-2h4a2 2 0 0 1 2 2v2H8Z",key:"mwf4oh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Gq=U("LandPlot",[["path",{d:"m12 8 6-3-6-3v10",key:"mvpnpy"}],["path",{d:"m8 11.99-5.5 3.14a1 1 0 0 0 0 1.74l8.5 4.86a2 2 0 0 0 2 0l8.5-4.86a1 1 0 0 0 0-1.74L16 12",key:"ek95tt"}],["path",{d:"m6.49 12.85 11.02 6.3",key:"1kt42w"}],["path",{d:"M17.51 12.85 6.5 19.15",key:"v55bdg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Kq=U("Landmark",[["line",{x1:"3",x2:"21",y1:"22",y2:"22",key:"j8o0r"}],["line",{x1:"6",x2:"6",y1:"18",y2:"11",key:"10tf0k"}],["line",{x1:"10",x2:"10",y1:"18",y2:"11",key:"54lgf6"}],["line",{x1:"14",x2:"14",y1:"18",y2:"11",key:"380y"}],["line",{x1:"18",x2:"18",y1:"18",y2:"11",key:"1kevvc"}],["polygon",{points:"12 2 20 7 4 7",key:"jkujk7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Zq=U("Languages",[["path",{d:"m5 8 6 6",key:"1wu5hv"}],["path",{d:"m4 14 6-6 2-3",key:"1k1g8d"}],["path",{d:"M2 5h12",key:"or177f"}],["path",{d:"M7 2h1",key:"1t2jsx"}],["path",{d:"m22 22-5-10-5 10",key:"don7ne"}],["path",{d:"M14 18h6",key:"1m8k6r"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Yq=U("LaptopMinimalCheck",[["path",{d:"M2 20h20",key:"owomy5"}],["path",{d:"m9 10 2 2 4-4",key:"1gnqz4"}],["rect",{x:"3",y:"4",width:"18",height:"12",rx:"2",key:"8ur36m"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const z2=U("LaptopMinimal",[["rect",{width:"18",height:"12",x:"3",y:"4",rx:"2",ry:"2",key:"1qhy41"}],["line",{x1:"2",x2:"22",y1:"20",y2:"20",key:"ni3hll"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Xq=U("Laptop",[["path",{d:"M20 16V7a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v9m16 0H4m16 0 1.28 2.55a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45L4 16",key:"tarvll"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Qq=U("LassoSelect",[["path",{d:"M7 22a5 5 0 0 1-2-4",key:"umushi"}],["path",{d:"M7 16.93c.96.43 1.96.74 2.99.91",key:"ybbtv3"}],["path",{d:"M3.34 14A6.8 6.8 0 0 1 2 10c0-4.42 4.48-8 10-8s10 3.58 10 8a7.19 7.19 0 0 1-.33 2",key:"gt5e1w"}],["path",{d:"M5 18a2 2 0 1 0 0-4 2 2 0 0 0 0 4z",key:"bq3ynw"}],["path",{d:"M14.33 22h-.09a.35.35 0 0 1-.24-.32v-10a.34.34 0 0 1 .33-.34c.08 0 .15.03.21.08l7.34 6a.33.33 0 0 1-.21.59h-4.49l-2.57 3.85a.35.35 0 0 1-.28.14z",key:"72q637"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Jq=U("Lasso",[["path",{d:"M7 22a5 5 0 0 1-2-4",key:"umushi"}],["path",{d:"M3.3 14A6.8 6.8 0 0 1 2 10c0-4.4 4.5-8 10-8s10 3.6 10 8-4.5 8-10 8a12 12 0 0 1-5-1",key:"146dds"}],["path",{d:"M5 18a2 2 0 1 0 0-4 2 2 0 0 0 0 4z",key:"bq3ynw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const eV=U("Laugh",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M18 13a6 6 0 0 1-6 5 6 6 0 0 1-6-5h12Z",key:"b2q4dd"}],["line",{x1:"9",x2:"9.01",y1:"9",y2:"9",key:"yxxnd0"}],["line",{x1:"15",x2:"15.01",y1:"9",y2:"9",key:"1p4y9e"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tV=U("Layers2",[["path",{d:"m16.02 12 5.48 3.13a1 1 0 0 1 0 1.74L13 21.74a2 2 0 0 1-2 0l-8.5-4.87a1 1 0 0 1 0-1.74L7.98 12",key:"1cuww1"}],["path",{d:"M13 13.74a2 2 0 0 1-2 0L2.5 8.87a1 1 0 0 1 0-1.74L11 2.26a2 2 0 0 1 2 0l8.5 4.87a1 1 0 0 1 0 1.74Z",key:"pdlvxu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rV=U("Layers3",[["path",{d:"m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z",key:"8b97xw"}],["path",{d:"m6.08 9.5-3.5 1.6a1 1 0 0 0 0 1.81l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9a1 1 0 0 0 0-1.83l-3.5-1.59",key:"1e5n1m"}],["path",{d:"m6.08 14.5-3.5 1.6a1 1 0 0 0 0 1.81l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9a1 1 0 0 0 0-1.83l-3.5-1.59",key:"1iwflc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nV=U("Layers",[["path",{d:"m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z",key:"8b97xw"}],["path",{d:"m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65",key:"dd6zsq"}],["path",{d:"m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65",key:"ep9fru"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gj=U("LayoutDashboard",[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pm=U("LayoutGrid",[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sV=U("LayoutList",[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}],["path",{d:"M14 4h7",key:"3xa0d5"}],["path",{d:"M14 9h7",key:"1icrd9"}],["path",{d:"M14 15h7",key:"1mj8o2"}],["path",{d:"M14 20h7",key:"11slyb"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const aV=U("LayoutPanelLeft",[["rect",{width:"7",height:"18",x:"3",y:"3",rx:"1",key:"2obqm"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const iV=U("LayoutPanelTop",[["rect",{width:"18",height:"7",x:"3",y:"3",rx:"1",key:"f1a2em"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oV=U("LayoutTemplate",[["rect",{width:"18",height:"7",x:"3",y:"3",rx:"1",key:"f1a2em"}],["rect",{width:"9",height:"7",x:"3",y:"14",rx:"1",key:"jqznyg"}],["rect",{width:"5",height:"7",x:"16",y:"14",rx:"1",key:"q5h2i8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lV=U("Leaf",[["path",{d:"M11 20A7 7 0 0 1 9.8 6.1C15.5 5 17 4.48 19 2c1 2 2 4.18 2 8 0 5.5-4.78 10-10 10Z",key:"nnexq3"}],["path",{d:"M2 21c0-3 1.85-5.36 5.08-6C9.5 14.52 12 13 13 12",key:"mt58a7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cV=U("LeafyGreen",[["path",{d:"M2 22c1.25-.987 2.27-1.975 3.9-2.2a5.56 5.56 0 0 1 3.8 1.5 4 4 0 0 0 6.187-2.353 3.5 3.5 0 0 0 3.69-5.116A3.5 3.5 0 0 0 20.95 8 3.5 3.5 0 1 0 16 3.05a3.5 3.5 0 0 0-5.831 1.373 3.5 3.5 0 0 0-5.116 3.69 4 4 0 0 0-2.348 6.155C3.499 15.42 4.409 16.712 4.2 18.1 3.926 19.743 3.014 20.732 2 22",key:"1134nt"}],["path",{d:"M2 22 17 7",key:"1q7jp2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dV=U("Lectern",[["path",{d:"M16 12h3a2 2 0 0 0 1.902-1.38l1.056-3.333A1 1 0 0 0 21 6H3a1 1 0 0 0-.958 1.287l1.056 3.334A2 2 0 0 0 5 12h3",key:"13jjxg"}],["path",{d:"M18 6V3a1 1 0 0 0-1-1h-3",key:"1550fe"}],["rect",{width:"8",height:"12",x:"8",y:"10",rx:"1",key:"qmu8b6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uV=U("LetterText",[["path",{d:"M15 12h6",key:"upa0zy"}],["path",{d:"M15 6h6",key:"1jlkvy"}],["path",{d:"m3 13 3.553-7.724a.5.5 0 0 1 .894 0L11 13",key:"blevx4"}],["path",{d:"M3 18h18",key:"1h113x"}],["path",{d:"M4 11h6",key:"olkgv1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hV=U("LibraryBig",[["rect",{width:"8",height:"18",x:"3",y:"3",rx:"1",key:"oynpb5"}],["path",{d:"M7 3v18",key:"bbkbws"}],["path",{d:"M20.4 18.9c.2.5-.1 1.1-.6 1.3l-1.9.7c-.5.2-1.1-.1-1.3-.6L11.1 5.1c-.2-.5.1-1.1.6-1.3l1.9-.7c.5-.2 1.1.1 1.3.6Z",key:"1qboyk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const iS=U("Library",[["path",{d:"m16 6 4 14",key:"ji33uf"}],["path",{d:"M12 6v14",key:"1n7gus"}],["path",{d:"M8 8v12",key:"1gg7y9"}],["path",{d:"M4 4v16",key:"6qkkli"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oS=U("LifeBuoy",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.93 4.93 4.24 4.24",key:"1ymg45"}],["path",{d:"m14.83 9.17 4.24-4.24",key:"1cb5xl"}],["path",{d:"m14.83 14.83 4.24 4.24",key:"q42g0n"}],["path",{d:"m9.17 14.83-4.24 4.24",key:"bqpfvv"}],["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fV=U("Ligature",[["path",{d:"M8 20V8c0-2.2 1.8-4 4-4 1.5 0 2.8.8 3.5 2",key:"1rtphz"}],["path",{d:"M6 12h4",key:"a4o3ry"}],["path",{d:"M14 12h2v8",key:"c1fccl"}],["path",{d:"M6 20h4",key:"1i6q5t"}],["path",{d:"M14 20h4",key:"lzx1xo"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pV=U("LightbulbOff",[["path",{d:"M16.8 11.2c.8-.9 1.2-2 1.2-3.2a6 6 0 0 0-9.3-5",key:"1fkcox"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M6.3 6.3a4.67 4.67 0 0 0 1.2 5.2c.7.7 1.3 1.5 1.5 2.5",key:"10m8kw"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const v1=U("Lightbulb",[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mV=U("Link2Off",[["path",{d:"M9 17H7A5 5 0 0 1 7 7",key:"10o201"}],["path",{d:"M15 7h2a5 5 0 0 1 4 8",key:"1d3206"}],["line",{x1:"8",x2:"12",y1:"12",y2:"12",key:"rvw6j4"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tf=U("Link2",[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Co=U("Link",[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mm=U("Linkedin",[["path",{d:"M16 8a6 6 0 0 1 6 6v7h-4v-7a2 2 0 0 0-2-2 2 2 0 0 0-2 2v7h-4v-7a6 6 0 0 1 6-6z",key:"c2jq9f"}],["rect",{width:"4",height:"12",x:"2",y:"9",key:"mk3on5"}],["circle",{cx:"4",cy:"4",r:"2",key:"bt5ra8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gV=U("ListCheck",[["path",{d:"M11 18H3",key:"n3j2dh"}],["path",{d:"m15 18 2 2 4-4",key:"1szwhi"}],["path",{d:"M16 12H3",key:"1a2rj7"}],["path",{d:"M16 6H3",key:"1wxfjs"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xV=U("ListChecks",[["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}],["path",{d:"M13 6h8",key:"15sg57"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 18h8",key:"oe0vm4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yV=U("ListCollapse",[["path",{d:"m3 10 2.5-2.5L3 5",key:"i6eama"}],["path",{d:"m3 19 2.5-2.5L3 14",key:"w2gmor"}],["path",{d:"M10 6h11",key:"c7qv1k"}],["path",{d:"M10 12h11",key:"6m4ad9"}],["path",{d:"M10 18h11",key:"11hvi2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vV=U("ListEnd",[["path",{d:"M16 12H3",key:"1a2rj7"}],["path",{d:"M16 6H3",key:"1wxfjs"}],["path",{d:"M10 18H3",key:"13769t"}],["path",{d:"M21 6v10a2 2 0 0 1-2 2h-5",key:"ilrcs8"}],["path",{d:"m16 16-2 2 2 2",key:"kkc6pm"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _V=U("ListFilter",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M7 12h10",key:"b7w52i"}],["path",{d:"M10 18h4",key:"1ulq68"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bV=U("ListMinus",[["path",{d:"M11 12H3",key:"51ecnj"}],["path",{d:"M16 6H3",key:"1wxfjs"}],["path",{d:"M16 18H3",key:"12xzn7"}],["path",{d:"M21 12h-6",key:"bt1uis"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wV=U("ListMusic",[["path",{d:"M21 15V6",key:"h1cx4g"}],["path",{d:"M18.5 18a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5Z",key:"8saifv"}],["path",{d:"M12 12H3",key:"18klou"}],["path",{d:"M16 6H3",key:"1wxfjs"}],["path",{d:"M12 18H3",key:"11ftsu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lS=U("ListOrdered",[["path",{d:"M10 12h11",key:"6m4ad9"}],["path",{d:"M10 18h11",key:"11hvi2"}],["path",{d:"M10 6h11",key:"c7qv1k"}],["path",{d:"M4 10h2",key:"16xx2s"}],["path",{d:"M4 6h1v4",key:"cnovpq"}],["path",{d:"M6 18H4c0-1 2-2 2-3s-1-1.5-2-1",key:"m9a95d"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jV=U("ListPlus",[["path",{d:"M11 12H3",key:"51ecnj"}],["path",{d:"M16 6H3",key:"1wxfjs"}],["path",{d:"M16 18H3",key:"12xzn7"}],["path",{d:"M18 9v6",key:"1twb98"}],["path",{d:"M21 12h-6",key:"bt1uis"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kV=U("ListRestart",[["path",{d:"M21 6H3",key:"1jwq7v"}],["path",{d:"M7 12H3",key:"13ou7f"}],["path",{d:"M7 18H3",key:"1sijw9"}],["path",{d:"M12 18a5 5 0 0 0 9-3 4.5 4.5 0 0 0-4.5-4.5c-1.33 0-2.54.54-3.41 1.41L11 14",key:"qth677"}],["path",{d:"M11 10v4h4",key:"172dkj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const NV=U("ListStart",[["path",{d:"M16 12H3",key:"1a2rj7"}],["path",{d:"M16 18H3",key:"12xzn7"}],["path",{d:"M10 6H3",key:"lf8lx7"}],["path",{d:"M21 18V8a2 2 0 0 0-2-2h-5",key:"1hghli"}],["path",{d:"m16 8-2-2 2-2",key:"160uvd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const SV=U("ListTodo",[["rect",{x:"3",y:"5",width:"6",height:"6",rx:"1",key:"1defrl"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"M13 6h8",key:"15sg57"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 18h8",key:"oe0vm4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const CV=U("ListTree",[["path",{d:"M21 12h-8",key:"1bmf0i"}],["path",{d:"M21 6H8",key:"1pqkrb"}],["path",{d:"M21 18h-8",key:"1tm79t"}],["path",{d:"M3 6v4c0 1.1.9 2 2 2h3",key:"1ywdgy"}],["path",{d:"M3 10v6c0 1.1.9 2 2 2h3",key:"2wc746"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const MV=U("ListVideo",[["path",{d:"M12 12H3",key:"18klou"}],["path",{d:"M16 6H3",key:"1wxfjs"}],["path",{d:"M12 18H3",key:"11ftsu"}],["path",{d:"m16 12 5 3-5 3v-6Z",key:"zpskkp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const TV=U("ListX",[["path",{d:"M11 12H3",key:"51ecnj"}],["path",{d:"M16 6H3",key:"1wxfjs"}],["path",{d:"M16 18H3",key:"12xzn7"}],["path",{d:"m19 10-4 4",key:"1tz659"}],["path",{d:"m15 10 4 4",key:"1n7nei"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Kf=U("List",[["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 18h.01",key:"1tta3j"}],["path",{d:"M3 6h.01",key:"1rqtza"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 18h13",key:"1lx6n3"}],["path",{d:"M8 6h13",key:"ik3vkj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const en=U("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const AV=U("LoaderPinwheel",[["path",{d:"M22 12a1 1 0 0 1-10 0 1 1 0 0 0-10 0",key:"1lzz15"}],["path",{d:"M7 20.7a1 1 0 1 1 5-8.7 1 1 0 1 0 5-8.6",key:"1gnrpi"}],["path",{d:"M7 3.3a1 1 0 1 1 5 8.6 1 1 0 1 0 5 8.6",key:"u9yy5q"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const EV=U("Loader",[["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m16.2 7.8 2.9-2.9",key:"r700ao"}],["path",{d:"M18 12h4",key:"wj9ykh"}],["path",{d:"m16.2 16.2 2.9 2.9",key:"1bxg5t"}],["path",{d:"M12 18v4",key:"jadmvz"}],["path",{d:"m4.9 19.1 2.9-2.9",key:"bwix9q"}],["path",{d:"M2 12h4",key:"j09sii"}],["path",{d:"m4.9 4.9 2.9 2.9",key:"giyufr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const IV=U("LocateFixed",[["line",{x1:"2",x2:"5",y1:"12",y2:"12",key:"bvdh0s"}],["line",{x1:"19",x2:"22",y1:"12",y2:"12",key:"1tbv5k"}],["line",{x1:"12",x2:"12",y1:"2",y2:"5",key:"11lu5j"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}],["circle",{cx:"12",cy:"12",r:"7",key:"fim9np"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const PV=U("LocateOff",[["line",{x1:"2",x2:"5",y1:"12",y2:"12",key:"bvdh0s"}],["line",{x1:"19",x2:"22",y1:"12",y2:"12",key:"1tbv5k"}],["line",{x1:"12",x2:"12",y1:"2",y2:"5",key:"11lu5j"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}],["path",{d:"M7.11 7.11C5.83 8.39 5 10.1 5 12c0 3.87 3.13 7 7 7 1.9 0 3.61-.83 4.89-2.11",key:"1oh7ia"}],["path",{d:"M18.71 13.96c.19-.63.29-1.29.29-1.96 0-3.87-3.13-7-7-7-.67 0-1.33.1-1.96.29",key:"3qdecy"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const PT=U("Locate",[["line",{x1:"2",x2:"5",y1:"12",y2:"12",key:"bvdh0s"}],["line",{x1:"19",x2:"22",y1:"12",y2:"12",key:"1tbv5k"}],["line",{x1:"12",x2:"12",y1:"2",y2:"5",key:"11lu5j"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}],["circle",{cx:"12",cy:"12",r:"7",key:"fim9np"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const B2=U("LockKeyholeOpen",[["circle",{cx:"12",cy:"16",r:"1",key:"1au0dj"}],["rect",{width:"18",height:"12",x:"3",y:"10",rx:"2",key:"l0tzu3"}],["path",{d:"M7 10V7a5 5 0 0 1 9.33-2.5",key:"car5b7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const LV=U("LockKeyhole",[["circle",{cx:"12",cy:"16",r:"1",key:"1au0dj"}],["rect",{x:"3",y:"10",width:"18",height:"12",rx:"2",key:"6s8ecr"}],["path",{d:"M7 10V7a5 5 0 0 1 10 0v3",key:"1pqi11"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $2=U("LockOpen",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 9.9-1",key:"1mm8w8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Zf=U("Lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cS=U("LogIn",[["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}],["polyline",{points:"10 17 15 12 10 7",key:"1ail0h"}],["line",{x1:"15",x2:"3",y1:"12",y2:"12",key:"v6grx8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dS=U("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const OV=U("Logs",[["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 18h8",key:"oe0vm4"}],["path",{d:"M13 6h8",key:"15sg57"}],["path",{d:"M3 12h1",key:"lp3yf2"}],["path",{d:"M3 18h1",key:"1eiwyy"}],["path",{d:"M3 6h1",key:"rgxa97"}],["path",{d:"M8 12h1",key:"1con00"}],["path",{d:"M8 18h1",key:"13wk12"}],["path",{d:"M8 6h1",key:"tn6mkg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const DV=U("Lollipop",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}],["path",{d:"M11 11a2 2 0 0 0 4 0 4 4 0 0 0-8 0 6 6 0 0 0 12 0",key:"107gwy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const RV=U("Luggage",[["path",{d:"M6 20a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2",key:"1m57jg"}],["path",{d:"M8 18V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v14",key:"1l99gc"}],["path",{d:"M10 20h4",key:"ni2waw"}],["circle",{cx:"16",cy:"20",r:"2",key:"1vifvg"}],["circle",{cx:"8",cy:"20",r:"2",key:"ckkr5m"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const FV=U("Magnet",[["path",{d:"m6 15-4-4 6.75-6.77a7.79 7.79 0 0 1 11 11L13 22l-4-4 6.39-6.36a2.14 2.14 0 0 0-3-3L6 15",key:"1i3lhw"}],["path",{d:"m5 8 4 4",key:"j6kj7e"}],["path",{d:"m12 15 4 4",key:"lnac28"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zV=U("MailCheck",[["path",{d:"M22 13V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v12c0 1.1.9 2 2 2h8",key:"12jkf8"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}],["path",{d:"m16 19 2 2 4-4",key:"1b14m6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const BV=U("MailMinus",[["path",{d:"M22 15V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v12c0 1.1.9 2 2 2h8",key:"fuxbkv"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}],["path",{d:"M16 19h6",key:"xwg31i"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $V=U("MailOpen",[["path",{d:"M21.2 8.4c.5.38.8.97.8 1.6v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V10a2 2 0 0 1 .8-1.6l8-6a2 2 0 0 1 2.4 0l8 6Z",key:"1jhwl8"}],["path",{d:"m22 10-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 10",key:"1qfld7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const UV=U("MailPlus",[["path",{d:"M22 13V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v12c0 1.1.9 2 2 2h8",key:"12jkf8"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}],["path",{d:"M19 16v6",key:"tddt3s"}],["path",{d:"M16 19h6",key:"xwg31i"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qV=U("MailQuestion",[["path",{d:"M22 10.5V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v12c0 1.1.9 2 2 2h12.5",key:"e61zoh"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}],["path",{d:"M18 15.28c.2-.4.5-.8.9-1a2.1 2.1 0 0 1 2.6.4c.3.4.5.8.5 1.3 0 1.3-2 2-2 2",key:"7z9rxb"}],["path",{d:"M20 22v.01",key:"12bgn6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const VV=U("MailSearch",[["path",{d:"M22 12.5V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v12c0 1.1.9 2 2 2h7.5",key:"w80f2v"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}],["path",{d:"M18 21a3 3 0 1 0 0-6 3 3 0 0 0 0 6Z",key:"8lzu5m"}],["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["path",{d:"m22 22-1.5-1.5",key:"1x83k4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const HV=U("MailWarning",[["path",{d:"M22 10.5V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v12c0 1.1.9 2 2 2h12.5",key:"e61zoh"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}],["path",{d:"M20 14v4",key:"1hm744"}],["path",{d:"M20 22v.01",key:"12bgn6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const LT=U("MailX",[["path",{d:"M22 13V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v12c0 1.1.9 2 2 2h9",key:"1j9vog"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}],["path",{d:"m17 17 4 4",key:"1b3523"}],["path",{d:"m21 17-4 4",key:"uinynz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const da=U("Mail",[["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const WV=U("Mailbox",[["path",{d:"M22 17a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9.5C2 7 4 5 6.5 5H18c2.2 0 4 1.8 4 4v8Z",key:"1lbycx"}],["polyline",{points:"15,9 18,9 18,11",key:"1pm9c0"}],["path",{d:"M6.5 5C9 5 11 7 11 9.5V17a2 2 0 0 1-2 2",key:"15i455"}],["line",{x1:"6",x2:"7",y1:"10",y2:"10",key:"1e2scm"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const GV=U("Mails",[["rect",{width:"16",height:"13",x:"6",y:"4",rx:"2",key:"1drq3f"}],["path",{d:"m22 7-7.1 3.78c-.57.3-1.23.3-1.8 0L6 7",key:"xn252p"}],["path",{d:"M2 8v11c0 1.1.9 2 2 2h14",key:"n13cji"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const KV=U("MapPinCheckInside",[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["path",{d:"m9 10 2 2 4-4",key:"1gnqz4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ZV=U("MapPinCheck",[["path",{d:"M19.43 12.935c.357-.967.57-1.955.57-2.935a8 8 0 0 0-16 0c0 4.993 5.539 10.193 7.399 11.799a1 1 0 0 0 1.202 0 32.197 32.197 0 0 0 .813-.728",key:"1dq61d"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}],["path",{d:"m16 18 2 2 4-4",key:"1mkfmb"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const YV=U("MapPinHouse",[["path",{d:"M15 22a1 1 0 0 1-1-1v-4a1 1 0 0 1 .445-.832l3-2a1 1 0 0 1 1.11 0l3 2A1 1 0 0 1 22 17v4a1 1 0 0 1-1 1z",key:"1p1rcz"}],["path",{d:"M18 10a8 8 0 0 0-16 0c0 4.993 5.539 10.193 7.399 11.799a1 1 0 0 0 .601.2",key:"mcbcs9"}],["path",{d:"M18 22v-3",key:"1t1ugv"}],["circle",{cx:"10",cy:"10",r:"3",key:"1ns7v1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const XV=U("MapPinMinusInside",[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["path",{d:"M9 10h6",key:"9gxzsh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const QV=U("MapPinMinus",[["path",{d:"M18.977 14C19.6 12.701 20 11.343 20 10a8 8 0 0 0-16 0c0 4.993 5.539 10.193 7.399 11.799a1 1 0 0 0 1.202 0 32 32 0 0 0 .824-.738",key:"11uxia"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}],["path",{d:"M16 18h6",key:"987eiv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const JV=U("MapPinOff",[["path",{d:"M12.75 7.09a3 3 0 0 1 2.16 2.16",key:"1d4wjd"}],["path",{d:"M17.072 17.072c-1.634 2.17-3.527 3.912-4.471 4.727a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 1.432-4.568",key:"12yil7"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M8.475 2.818A8 8 0 0 1 20 10c0 1.183-.31 2.377-.81 3.533",key:"lhrkcz"}],["path",{d:"M9.13 9.13a3 3 0 0 0 3.74 3.74",key:"13wojd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const eH=U("MapPinPlusInside",[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["path",{d:"M12 7v6",key:"lw1j43"}],["path",{d:"M9 10h6",key:"9gxzsh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tH=U("MapPinPlus",[["path",{d:"M19.914 11.105A7.298 7.298 0 0 0 20 10a8 8 0 0 0-16 0c0 4.993 5.539 10.193 7.399 11.799a1 1 0 0 0 1.202 0 32 32 0 0 0 .824-.738",key:"fcdtly"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}],["path",{d:"M16 18h6",key:"987eiv"}],["path",{d:"M19 15v6",key:"10aioa"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rH=U("MapPinXInside",[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["path",{d:"m14.5 7.5-5 5",key:"3lb6iw"}],["path",{d:"m9.5 7.5 5 5",key:"ko136h"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nH=U("MapPinX",[["path",{d:"M19.752 11.901A7.78 7.78 0 0 0 20 10a8 8 0 0 0-16 0c0 4.993 5.539 10.193 7.399 11.799a1 1 0 0 0 1.202 0 19 19 0 0 0 .09-.077",key:"y0ewhp"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}],["path",{d:"m21.5 15.5-5 5",key:"11iqnx"}],["path",{d:"m21.5 20.5-5-5",key:"1bylgx"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fl=U("MapPin",[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sH=U("MapPinned",[["path",{d:"M18 8c0 3.613-3.869 7.429-5.393 8.795a1 1 0 0 1-1.214 0C9.87 15.429 6 11.613 6 8a6 6 0 0 1 12 0",key:"11u0oz"}],["circle",{cx:"12",cy:"8",r:"2",key:"1822b1"}],["path",{d:"M8.714 14h-3.71a1 1 0 0 0-.948.683l-2.004 6A1 1 0 0 0 3 22h18a1 1 0 0 0 .948-1.316l-2-6a1 1 0 0 0-.949-.684h-3.712",key:"q8zwxj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const aH=U("Map",[["path",{d:"M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z",key:"169xi5"}],["path",{d:"M15 5.764v15",key:"1pn4in"}],["path",{d:"M9 3.236v15",key:"1uimfh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const iH=U("Martini",[["path",{d:"M8 22h8",key:"rmew8v"}],["path",{d:"M12 11v11",key:"ur9y6a"}],["path",{d:"m19 3-7 8-7-8Z",key:"1sgpiw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oH=U("Maximize2",[["polyline",{points:"15 3 21 3 21 9",key:"mznyad"}],["polyline",{points:"9 21 3 21 3 15",key:"1avn1i"}],["line",{x1:"21",x2:"14",y1:"3",y2:"10",key:"ota7mn"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lH=U("Maximize",[["path",{d:"M8 3H5a2 2 0 0 0-2 2v3",key:"1dcmit"}],["path",{d:"M21 8V5a2 2 0 0 0-2-2h-3",key:"1e4gt3"}],["path",{d:"M3 16v3a2 2 0 0 0 2 2h3",key:"wsl5sc"}],["path",{d:"M16 21h3a2 2 0 0 0 2-2v-3",key:"18trek"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qx=U("Medal",[["path",{d:"M7.21 15 2.66 7.14a2 2 0 0 1 .13-2.2L4.4 2.8A2 2 0 0 1 6 2h12a2 2 0 0 1 1.6.8l1.6 2.14a2 2 0 0 1 .14 2.2L16.79 15",key:"143lza"}],["path",{d:"M11 12 5.12 2.2",key:"qhuxz6"}],["path",{d:"m13 12 5.88-9.8",key:"hbye0f"}],["path",{d:"M8 7h8",key:"i86dvs"}],["circle",{cx:"12",cy:"17",r:"5",key:"qbz8iq"}],["path",{d:"M12 18v-2h-.5",key:"fawc4q"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cH=U("MegaphoneOff",[["path",{d:"M9.26 9.26 3 11v3l14.14 3.14",key:"3429n"}],["path",{d:"M21 15.34V6l-7.31 2.03",key:"4o1dh8"}],["path",{d:"M11.6 16.8a3 3 0 1 1-5.8-1.6",key:"1yl0tm"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gm=U("Megaphone",[["path",{d:"m3 11 18-5v12L3 14v-3z",key:"n962bs"}],["path",{d:"M11.6 16.8a3 3 0 1 1-5.8-1.6",key:"1yl0tm"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dH=U("Meh",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"8",x2:"16",y1:"15",y2:"15",key:"1xb1d9"}],["line",{x1:"9",x2:"9.01",y1:"9",y2:"9",key:"yxxnd0"}],["line",{x1:"15",x2:"15.01",y1:"9",y2:"9",key:"1p4y9e"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uH=U("MemoryStick",[["path",{d:"M6 19v-3",key:"1nvgqn"}],["path",{d:"M10 19v-3",key:"iu8nkm"}],["path",{d:"M14 19v-3",key:"kcehxu"}],["path",{d:"M18 19v-3",key:"1vh91z"}],["path",{d:"M8 11V9",key:"63erz4"}],["path",{d:"M16 11V9",key:"fru6f3"}],["path",{d:"M12 11V9",key:"ha00sb"}],["path",{d:"M2 15h20",key:"16ne18"}],["path",{d:"M2 7a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v1.1a2 2 0 0 0 0 3.837V17a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-5.1a2 2 0 0 0 0-3.837Z",key:"lhddv3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const OT=U("Menu",[["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}],["line",{x1:"4",x2:"20",y1:"6",y2:"6",key:"1owob3"}],["line",{x1:"4",x2:"20",y1:"18",y2:"18",key:"yk5zj1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hH=U("Merge",[["path",{d:"m8 6 4-4 4 4",key:"ybng9g"}],["path",{d:"M12 2v10.3a4 4 0 0 1-1.172 2.872L4 22",key:"1hyw0i"}],["path",{d:"m20 22-5-5",key:"1m27yz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fH=U("MessageCircleCode",[["path",{d:"M10 9.5 8 12l2 2.5",key:"3mjy60"}],["path",{d:"m14 9.5 2 2.5-2 2.5",key:"1bir2l"}],["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22z",key:"k85zhp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pH=U("MessageCircleDashed",[["path",{d:"M13.5 3.1c-.5 0-1-.1-1.5-.1s-1 .1-1.5.1",key:"16ll65"}],["path",{d:"M19.3 6.8a10.45 10.45 0 0 0-2.1-2.1",key:"1nq77a"}],["path",{d:"M20.9 13.5c.1-.5.1-1 .1-1.5s-.1-1-.1-1.5",key:"1sf7wn"}],["path",{d:"M17.2 19.3a10.45 10.45 0 0 0 2.1-2.1",key:"x1hs5g"}],["path",{d:"M10.5 20.9c.5.1 1 .1 1.5.1s1-.1 1.5-.1",key:"19m18z"}],["path",{d:"M3.5 17.5 2 22l4.5-1.5",key:"1f36qi"}],["path",{d:"M3.1 10.5c0 .5-.1 1-.1 1.5s.1 1 .1 1.5",key:"1vz3ju"}],["path",{d:"M6.8 4.7a10.45 10.45 0 0 0-2.1 2.1",key:"19f9do"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uS=U("MessageCircleHeart",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}],["path",{d:"M15.8 9.2a2.5 2.5 0 0 0-3.5 0l-.3.4-.35-.3a2.42 2.42 0 1 0-3.2 3.6l3.6 3.5 3.6-3.5c1.2-1.2 1.1-2.7.2-3.7",key:"43lnbm"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mH=U("MessageCircleMore",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}],["path",{d:"M8 12h.01",key:"czm47f"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M16 12h.01",key:"1l6xoz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gH=U("MessageCircleOff",[["path",{d:"M20.5 14.9A9 9 0 0 0 9.1 3.5",key:"1iebmn"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M5.6 5.6C3 8.3 2.2 12.5 4 16l-2 6 6-2c3.4 1.8 7.6 1.1 10.3-1.7",key:"1ov8ce"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xH=U("MessageCirclePlus",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const DT=U("MessageCircleQuestion",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yH=U("MessageCircleReply",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}],["path",{d:"m10 15-3-3 3-3",key:"1pgupc"}],["path",{d:"M7 12h7a2 2 0 0 1 2 2v1",key:"1gheu4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vH=U("MessageCircleWarning",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _H=U("MessageCircleX",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Fl=U("MessageCircle",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bH=U("MessageSquareCode",[["path",{d:"M10 7.5 8 10l2 2.5",key:"xb17xw"}],["path",{d:"m14 7.5 2 2.5-2 2.5",key:"5rap1v"}],["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wH=U("MessageSquareDashed",[["path",{d:"M10 17H7l-4 4v-7",key:"1r71xu"}],["path",{d:"M14 17h1",key:"nufu4t"}],["path",{d:"M14 3h1",key:"1ec4yj"}],["path",{d:"M19 3a2 2 0 0 1 2 2",key:"18rm91"}],["path",{d:"M21 14v1a2 2 0 0 1-2 2",key:"29akq3"}],["path",{d:"M21 9v1",key:"mxsmne"}],["path",{d:"M3 9v1",key:"1r0deq"}],["path",{d:"M5 3a2 2 0 0 0-2 2",key:"y57alp"}],["path",{d:"M9 3h1",key:"1yesri"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jH=U("MessageSquareDiff",[["path",{d:"m5 19-2 2V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2",key:"1xuzuj"}],["path",{d:"M9 10h6",key:"9gxzsh"}],["path",{d:"M12 7v6",key:"lw1j43"}],["path",{d:"M9 17h6",key:"r8uit2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kH=U("MessageSquareDot",[["path",{d:"M11.7 3H5a2 2 0 0 0-2 2v16l4-4h12a2 2 0 0 0 2-2v-2.7",key:"uodpkb"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const NH=U("MessageSquareHeart",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}],["path",{d:"M14.8 7.5a1.84 1.84 0 0 0-2.6 0l-.2.3-.3-.3a1.84 1.84 0 1 0-2.4 2.8L12 13l2.7-2.7c.9-.9.8-2.1.1-2.8",key:"1blaws"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const SH=U("MessageSquareLock",[["path",{d:"M19 15v-2a2 2 0 1 0-4 0v2",key:"h3d1vz"}],["path",{d:"M9 17H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v3.5",key:"xsnnhn"}],["rect",{x:"13",y:"15",width:"8",height:"5",rx:"1",key:"1ccwuk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const CH=U("MessageSquareMore",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}],["path",{d:"M8 10h.01",key:"19clt8"}],["path",{d:"M12 10h.01",key:"1nrarc"}],["path",{d:"M16 10h.01",key:"1m94wz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const MH=U("MessageSquareOff",[["path",{d:"M21 15V5a2 2 0 0 0-2-2H9",key:"43el77"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M3.6 3.6c-.4.3-.6.8-.6 1.4v16l4-4h10",key:"pwpm4a"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const TH=U("MessageSquarePlus",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}],["path",{d:"M12 7v6",key:"lw1j43"}],["path",{d:"M9 10h6",key:"9gxzsh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const RT=U("MessageSquareQuote",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}],["path",{d:"M8 12a2 2 0 0 0 2-2V8H8",key:"1jfesj"}],["path",{d:"M14 12a2 2 0 0 0 2-2V8h-2",key:"1dq9mh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const AH=U("MessageSquareReply",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}],["path",{d:"m10 7-3 3 3 3",key:"1eugdv"}],["path",{d:"M17 13v-1a2 2 0 0 0-2-2H7",key:"ernfh3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const EH=U("MessageSquareShare",[["path",{d:"M21 12v3a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h7",key:"tqtdkg"}],["path",{d:"M16 3h5v5",key:"1806ms"}],["path",{d:"m16 8 5-5",key:"15mbrl"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const IH=U("MessageSquareText",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}],["path",{d:"M13 8H7",key:"14i4kc"}],["path",{d:"M17 12H7",key:"16if0g"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const PH=U("MessageSquareWarning",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}],["path",{d:"M12 7v2",key:"stiyo7"}],["path",{d:"M12 13h.01",key:"y0uutt"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const LH=U("MessageSquareX",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}],["path",{d:"m14.5 7.5-5 5",key:"3lb6iw"}],["path",{d:"m9.5 7.5 5 5",key:"ko136h"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Lo=U("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const OH=U("MessagesSquare",[["path",{d:"M14 9a2 2 0 0 1-2 2H6l-4 4V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2z",key:"p1xzt8"}],["path",{d:"M18 9h2a2 2 0 0 1 2 2v11l-4-4h-6a2 2 0 0 1-2-2v-1",key:"1cx29u"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const DH=U("MicOff",[["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}],["path",{d:"M18.89 13.23A7.12 7.12 0 0 0 19 12v-2",key:"80xlxr"}],["path",{d:"M5 10v2a7 7 0 0 0 12 5",key:"p2k8kg"}],["path",{d:"M15 9.34V5a3 3 0 0 0-5.68-1.33",key:"1gzdoj"}],["path",{d:"M9 9v3a3 3 0 0 0 5.12 2.12",key:"r2i35w"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const U2=U("MicVocal",[["path",{d:"m11 7.601-5.994 8.19a1 1 0 0 0 .1 1.298l.817.818a1 1 0 0 0 1.314.087L15.09 12",key:"80a601"}],["path",{d:"M16.5 21.174C15.5 20.5 14.372 20 13 20c-2.058 0-3.928 2.356-6 2-2.072-.356-2.775-3.369-1.5-4.5",key:"j0ngtp"}],["circle",{cx:"16",cy:"7",r:"5",key:"d08jfb"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const FT=U("Mic",[["path",{d:"M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z",key:"131961"}],["path",{d:"M19 10v2a7 7 0 0 1-14 0v-2",key:"1vc78b"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const RH=U("Microchip",[["path",{d:"M18 12h2",key:"quuxs7"}],["path",{d:"M18 16h2",key:"zsn3lv"}],["path",{d:"M18 20h2",key:"9x5y9y"}],["path",{d:"M18 4h2",key:"1luxfb"}],["path",{d:"M18 8h2",key:"nxqzg"}],["path",{d:"M4 12h2",key:"1ltxp0"}],["path",{d:"M4 16h2",key:"8a5zha"}],["path",{d:"M4 20h2",key:"27dk57"}],["path",{d:"M4 4h2",key:"10groj"}],["path",{d:"M4 8h2",key:"18vq6w"}],["path",{d:"M8 2a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2h-1.5c-.276 0-.494.227-.562.495a2 2 0 0 1-3.876 0C9.994 2.227 9.776 2 9.5 2z",key:"1681fp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const FH=U("Microscope",[["path",{d:"M6 18h8",key:"1borvv"}],["path",{d:"M3 22h18",key:"8prr45"}],["path",{d:"M14 22a7 7 0 1 0 0-14h-1",key:"1jwaiy"}],["path",{d:"M9 14h2",key:"197e7h"}],["path",{d:"M9 12a2 2 0 0 1-2-2V6h6v4a2 2 0 0 1-2 2Z",key:"1bmzmy"}],["path",{d:"M12 6V3a1 1 0 0 0-1-1H9a1 1 0 0 0-1 1v3",key:"1drr47"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zH=U("Microwave",[["rect",{width:"20",height:"15",x:"2",y:"4",rx:"2",key:"2no95f"}],["rect",{width:"8",height:"7",x:"6",y:"8",rx:"1",key:"zh9wx"}],["path",{d:"M18 8v7",key:"o5zi4n"}],["path",{d:"M6 19v2",key:"1loha6"}],["path",{d:"M18 19v2",key:"1dawf0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const BH=U("Milestone",[["path",{d:"M12 13v8",key:"1l5pq0"}],["path",{d:"M12 3v3",key:"1n5kay"}],["path",{d:"M4 6a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1h13a2 2 0 0 0 1.152-.365l3.424-2.317a1 1 0 0 0 0-1.635l-3.424-2.318A2 2 0 0 0 17 6z",key:"1btarq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $H=U("MilkOff",[["path",{d:"M8 2h8",key:"1ssgc1"}],["path",{d:"M9 2v1.343M15 2v2.789a4 4 0 0 0 .672 2.219l.656.984a4 4 0 0 1 .672 2.22v1.131M7.8 7.8l-.128.192A4 4 0 0 0 7 10.212V20a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2v-3",key:"y0ejgx"}],["path",{d:"M7 15a6.47 6.47 0 0 1 5 0 6.472 6.472 0 0 0 3.435.435",key:"iaxqsy"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const UH=U("Milk",[["path",{d:"M8 2h8",key:"1ssgc1"}],["path",{d:"M9 2v2.789a4 4 0 0 1-.672 2.219l-.656.984A4 4 0 0 0 7 10.212V20a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2v-9.789a4 4 0 0 0-.672-2.219l-.656-.984A4 4 0 0 1 15 4.788V2",key:"qtp12x"}],["path",{d:"M7 15a6.472 6.472 0 0 1 5 0 6.47 6.47 0 0 0 5 0",key:"ygeh44"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qH=U("Minimize2",[["polyline",{points:"4 14 10 14 10 20",key:"11kfnr"}],["polyline",{points:"20 10 14 10 14 4",key:"rlmsce"}],["line",{x1:"14",x2:"21",y1:"10",y2:"3",key:"o5lafz"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const VH=U("Minimize",[["path",{d:"M8 3v3a2 2 0 0 1-2 2H3",key:"hohbtr"}],["path",{d:"M21 8h-3a2 2 0 0 1-2-2V3",key:"5jw1f3"}],["path",{d:"M3 16h3a2 2 0 0 1 2 2v3",key:"198tvr"}],["path",{d:"M16 21v-3a2 2 0 0 1 2-2h3",key:"ph8mxp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _1=U("Minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const HH=U("MonitorCheck",[["path",{d:"m9 10 2 2 4-4",key:"1gnqz4"}],["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"M8 21h8",key:"1ev6f3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const WH=U("MonitorCog",[["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"m15.2 4.9-.9-.4",key:"12wd2u"}],["path",{d:"m15.2 7.1-.9.4",key:"1r2vl7"}],["path",{d:"m16.9 3.2-.4-.9",key:"3zbo91"}],["path",{d:"m16.9 8.8-.4.9",key:"1qr2dn"}],["path",{d:"m19.5 2.3-.4.9",key:"1rjrkq"}],["path",{d:"m19.5 9.7-.4-.9",key:"heryx5"}],["path",{d:"m21.7 4.5-.9.4",key:"17fqt1"}],["path",{d:"m21.7 7.5-.9-.4",key:"14zyni"}],["path",{d:"M22 13v2a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7",key:"1tnzv8"}],["path",{d:"M8 21h8",key:"1ev6f3"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const GH=U("MonitorDot",[["circle",{cx:"19",cy:"6",r:"3",key:"108a5v"}],["path",{d:"M22 12v3a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h9",key:"1fet9y"}],["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"M8 21h8",key:"1ev6f3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const KH=U("MonitorDown",[["path",{d:"M12 13V7",key:"h0r20n"}],["path",{d:"m15 10-3 3-3-3",key:"lzhmyn"}],["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"M8 21h8",key:"1ev6f3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ZH=U("MonitorOff",[["path",{d:"M17 17H4a2 2 0 0 1-2-2V5c0-1.5 1-2 1-2",key:"k0q8oc"}],["path",{d:"M22 15V5a2 2 0 0 0-2-2H9",key:"cp1ac0"}],["path",{d:"M8 21h8",key:"1ev6f3"}],["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const YH=U("MonitorPause",[["path",{d:"M10 13V7",key:"1u13u9"}],["path",{d:"M14 13V7",key:"1vj9om"}],["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"M8 21h8",key:"1ev6f3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const XH=U("MonitorPlay",[["path",{d:"M10 7.75a.75.75 0 0 1 1.142-.638l3.664 2.249a.75.75 0 0 1 0 1.278l-3.664 2.25a.75.75 0 0 1-1.142-.64z",key:"1pctta"}],["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"M8 21h8",key:"1ev6f3"}],["rect",{x:"2",y:"3",width:"20",height:"14",rx:"2",key:"x3v2xh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const QH=U("MonitorSmartphone",[["path",{d:"M18 8V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h8",key:"10dyio"}],["path",{d:"M10 19v-3.96 3.15",key:"1irgej"}],["path",{d:"M7 19h5",key:"qswx4l"}],["rect",{width:"6",height:"10",x:"16",y:"12",rx:"2",key:"1egngj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const JH=U("MonitorSpeaker",[["path",{d:"M5.5 20H8",key:"1k40s5"}],["path",{d:"M17 9h.01",key:"1j24nn"}],["rect",{width:"10",height:"16",x:"12",y:"4",rx:"2",key:"ixliua"}],["path",{d:"M8 6H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h4",key:"1mp6e1"}],["circle",{cx:"17",cy:"15",r:"1",key:"tqvash"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const eW=U("MonitorStop",[["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"M8 21h8",key:"1ev6f3"}],["rect",{x:"2",y:"3",width:"20",height:"14",rx:"2",key:"x3v2xh"}],["rect",{x:"9",y:"7",width:"6",height:"6",rx:"1",key:"5m2oou"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tW=U("MonitorUp",[["path",{d:"m9 10 3-3 3 3",key:"11gsxs"}],["path",{d:"M12 13V7",key:"h0r20n"}],["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"M8 21h8",key:"1ev6f3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rW=U("MonitorX",[["path",{d:"m14.5 12.5-5-5",key:"1jahn5"}],["path",{d:"m9.5 12.5 5-5",key:"1k2t7b"}],["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"M8 21h8",key:"1ev6f3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xj=U("Monitor",[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nW=U("MoonStar",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9",key:"4ay0iu"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sW=U("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const aW=U("MountainSnow",[["path",{d:"m8 3 4 8 5-5 5 15H2L8 3z",key:"otkl63"}],["path",{d:"M4.14 15.08c2.62-1.57 5.24-1.43 7.86.42 2.74 1.94 5.49 2 8.23.19",key:"1pvmmp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const iW=U("Mountain",[["path",{d:"m8 3 4 8 5-5 5 15H2L8 3z",key:"otkl63"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oW=U("MouseOff",[["path",{d:"M12 6v.343",key:"1gyhex"}],["path",{d:"M18.218 18.218A7 7 0 0 1 5 15V9a7 7 0 0 1 .782-3.218",key:"ukzz01"}],["path",{d:"M19 13.343V9A7 7 0 0 0 8.56 2.902",key:"104jy9"}],["path",{d:"M22 22 2 2",key:"1r8tn9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lW=U("MousePointer2",[["path",{d:"M4.037 4.688a.495.495 0 0 1 .651-.651l16 6.5a.5.5 0 0 1-.063.947l-6.124 1.58a2 2 0 0 0-1.438 1.435l-1.579 6.126a.5.5 0 0 1-.947.063z",key:"edeuup"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cW=U("MousePointerBan",[["path",{d:"M2.034 2.681a.498.498 0 0 1 .647-.647l9 3.5a.5.5 0 0 1-.033.944L8.204 7.545a1 1 0 0 0-.66.66l-1.066 3.443a.5.5 0 0 1-.944.033z",key:"11pp1i"}],["circle",{cx:"16",cy:"16",r:"6",key:"qoo3c4"}],["path",{d:"m11.8 11.8 8.4 8.4",key:"oogvdj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yj=U("MousePointerClick",[["path",{d:"M14 4.1 12 6",key:"ita8i4"}],["path",{d:"m5.1 8-2.9-.8",key:"1go3kf"}],["path",{d:"m6 12-1.9 2",key:"mnht97"}],["path",{d:"M7.2 2.2 8 5.1",key:"1cfko1"}],["path",{d:"M9.037 9.69a.498.498 0 0 1 .653-.653l11 4.5a.5.5 0 0 1-.074.949l-4.349 1.041a1 1 0 0 0-.74.739l-1.04 4.35a.5.5 0 0 1-.95.074z",key:"s0h3yz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dW=U("MousePointer",[["path",{d:"M12.586 12.586 19 19",key:"ea5xo7"}],["path",{d:"M3.688 3.037a.497.497 0 0 0-.651.651l6.5 15.999a.501.501 0 0 0 .947-.062l1.569-6.083a2 2 0 0 1 1.448-1.479l6.124-1.579a.5.5 0 0 0 .063-.947z",key:"277e5u"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uW=U("Mouse",[["rect",{x:"5",y:"2",width:"14",height:"20",rx:"7",key:"11ol66"}],["path",{d:"M12 6v4",key:"16clxf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const q2=U("Move3d",[["path",{d:"M5 3v16h16",key:"1mqmf9"}],["path",{d:"m5 19 6-6",key:"jh6hbb"}],["path",{d:"m2 6 3-3 3 3",key:"tkyvxa"}],["path",{d:"m18 16 3 3-3 3",key:"1d4glt"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hW=U("MoveDiagonal2",[["path",{d:"M19 13v6h-6",key:"1hxl6d"}],["path",{d:"M5 11V5h6",key:"12e2xe"}],["path",{d:"m5 5 14 14",key:"11anup"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fW=U("MoveDiagonal",[["path",{d:"M11 19H5v-6",key:"8awifj"}],["path",{d:"M13 5h6v6",key:"7voy1q"}],["path",{d:"M19 5 5 19",key:"wwaj1z"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pW=U("MoveDownLeft",[["path",{d:"M11 19H5V13",key:"1akmht"}],["path",{d:"M19 5L5 19",key:"72u4yj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mW=U("MoveDownRight",[["path",{d:"M19 13V19H13",key:"10vkzq"}],["path",{d:"M5 5L19 19",key:"5zm2fv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gW=U("MoveDown",[["path",{d:"M8 18L12 22L16 18",key:"cskvfv"}],["path",{d:"M12 2V22",key:"r89rzk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xW=U("MoveHorizontal",[["path",{d:"m18 8 4 4-4 4",key:"1ak13k"}],["path",{d:"M2 12h20",key:"9i4pu4"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yW=U("MoveLeft",[["path",{d:"M6 8L2 12L6 16",key:"kyvwex"}],["path",{d:"M2 12H22",key:"1m8cig"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vW=U("MoveRight",[["path",{d:"M18 8L22 12L18 16",key:"1r0oui"}],["path",{d:"M2 12H22",key:"1m8cig"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _W=U("MoveUpLeft",[["path",{d:"M5 11V5H11",key:"3q78g9"}],["path",{d:"M5 5L19 19",key:"5zm2fv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bW=U("MoveUpRight",[["path",{d:"M13 5H19V11",key:"1n1gyv"}],["path",{d:"M19 5L5 19",key:"72u4yj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wW=U("MoveUp",[["path",{d:"M8 6L12 2L16 6",key:"1yvkyx"}],["path",{d:"M12 2V22",key:"r89rzk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jW=U("MoveVertical",[["path",{d:"M12 2v20",key:"t6zp3m"}],["path",{d:"m8 18 4 4 4-4",key:"bh5tu3"}],["path",{d:"m8 6 4-4 4 4",key:"ybng9g"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kW=U("Move",[["path",{d:"M12 2v20",key:"t6zp3m"}],["path",{d:"m15 19-3 3-3-3",key:"11eu04"}],["path",{d:"m19 9 3 3-3 3",key:"1mg7y2"}],["path",{d:"M2 12h20",key:"9i4pu4"}],["path",{d:"m5 9-3 3 3 3",key:"j64kie"}],["path",{d:"m9 5 3-3 3 3",key:"l8vdw6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const NW=U("Music2",[["circle",{cx:"8",cy:"18",r:"4",key:"1fc0mg"}],["path",{d:"M12 18V2l7 4",key:"g04rme"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const SW=U("Music3",[["circle",{cx:"12",cy:"18",r:"4",key:"m3r9ws"}],["path",{d:"M16 18V2",key:"40x2m5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const CW=U("Music4",[["path",{d:"M9 18V5l12-2v13",key:"1jmyc2"}],["path",{d:"m9 9 12-2",key:"1e64n2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["circle",{cx:"18",cy:"16",r:"3",key:"1hluhg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const MW=U("Music",[["path",{d:"M9 18V5l12-2v13",key:"1jmyc2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["circle",{cx:"18",cy:"16",r:"3",key:"1hluhg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const TW=U("Navigation2Off",[["path",{d:"M9.31 9.31 5 21l7-4 7 4-1.17-3.17",key:"qoq2o2"}],["path",{d:"M14.53 8.88 12 2l-1.17 3.17",key:"k3sjzy"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const AW=U("Navigation2",[["polygon",{points:"12 2 19 21 12 17 5 21 12 2",key:"x8c0qg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const EW=U("NavigationOff",[["path",{d:"M8.43 8.43 3 11l8 2 2 8 2.57-5.43",key:"1vdtb7"}],["path",{d:"M17.39 11.73 22 2l-9.73 4.61",key:"tya3r6"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zT=U("Navigation",[["polygon",{points:"3 11 22 2 13 21 11 13 3 11",key:"1ltx0t"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const IW=U("Network",[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Vx=U("Newspaper",[["path",{d:"M4 22h16a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2H8a2 2 0 0 0-2 2v16a2 2 0 0 1-2 2Zm0 0a2 2 0 0 1-2-2v-9c0-1.1.9-2 2-2h2",key:"7pis2x"}],["path",{d:"M18 14h-8",key:"sponae"}],["path",{d:"M15 18h-5",key:"95g1m2"}],["path",{d:"M10 6h8v4h-8V6Z",key:"smlsk5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const PW=U("Nfc",[["path",{d:"M6 8.32a7.43 7.43 0 0 1 0 7.36",key:"9iaqei"}],["path",{d:"M9.46 6.21a11.76 11.76 0 0 1 0 11.58",key:"1yha7l"}],["path",{d:"M12.91 4.1a15.91 15.91 0 0 1 .01 15.8",key:"4iu2gk"}],["path",{d:"M16.37 2a20.16 20.16 0 0 1 0 20",key:"sap9u2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const LW=U("NotebookPen",[["path",{d:"M13.4 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-7.4",key:"re6nr2"}],["path",{d:"M2 6h4",key:"aawbzj"}],["path",{d:"M2 10h4",key:"l0bgd4"}],["path",{d:"M2 14h4",key:"1gsvsf"}],["path",{d:"M2 18h4",key:"1bu2t1"}],["path",{d:"M21.378 5.626a1 1 0 1 0-3.004-3.004l-5.01 5.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z",key:"pqwjuv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const OW=U("NotebookTabs",[["path",{d:"M2 6h4",key:"aawbzj"}],["path",{d:"M2 10h4",key:"l0bgd4"}],["path",{d:"M2 14h4",key:"1gsvsf"}],["path",{d:"M2 18h4",key:"1bu2t1"}],["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",key:"1nb95v"}],["path",{d:"M15 2v20",key:"dcj49h"}],["path",{d:"M15 7h5",key:"1xj5lc"}],["path",{d:"M15 12h5",key:"w5shd9"}],["path",{d:"M15 17h5",key:"1qaofu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const DW=U("NotebookText",[["path",{d:"M2 6h4",key:"aawbzj"}],["path",{d:"M2 10h4",key:"l0bgd4"}],["path",{d:"M2 14h4",key:"1gsvsf"}],["path",{d:"M2 18h4",key:"1bu2t1"}],["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",key:"1nb95v"}],["path",{d:"M9.5 8h5",key:"11mslq"}],["path",{d:"M9.5 12H16",key:"ktog6x"}],["path",{d:"M9.5 16H14",key:"p1seyn"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const RW=U("Notebook",[["path",{d:"M2 6h4",key:"aawbzj"}],["path",{d:"M2 10h4",key:"l0bgd4"}],["path",{d:"M2 14h4",key:"1gsvsf"}],["path",{d:"M2 18h4",key:"1bu2t1"}],["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",key:"1nb95v"}],["path",{d:"M16 2v20",key:"rotuqe"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const FW=U("NotepadTextDashed",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v2",key:"j91f56"}],["path",{d:"M20 12v2",key:"w8o0tu"}],["path",{d:"M20 18v2a2 2 0 0 1-2 2h-1",key:"1c9ggx"}],["path",{d:"M13 22h-2",key:"191ugt"}],["path",{d:"M7 22H6a2 2 0 0 1-2-2v-2",key:"1rt9px"}],["path",{d:"M4 14v-2",key:"1v0sqh"}],["path",{d:"M4 8V6a2 2 0 0 1 2-2h2",key:"1mwabg"}],["path",{d:"M8 10h6",key:"3oa6kw"}],["path",{d:"M8 14h8",key:"1fgep2"}],["path",{d:"M8 18h5",key:"17enja"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zW=U("NotepadText",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"16",height:"18",x:"4",y:"4",rx:"2",key:"1u9h20"}],["path",{d:"M8 10h6",key:"3oa6kw"}],["path",{d:"M8 14h8",key:"1fgep2"}],["path",{d:"M8 18h5",key:"17enja"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const BW=U("NutOff",[["path",{d:"M12 4V2",key:"1k5q1u"}],["path",{d:"M5 10v4a7.004 7.004 0 0 0 5.277 6.787c.412.104.802.292 1.102.592L12 22l.621-.621c.3-.3.69-.488 1.102-.592a7.01 7.01 0 0 0 4.125-2.939",key:"1xcvy9"}],["path",{d:"M19 10v3.343",key:"163tfc"}],["path",{d:"M12 12c-1.349-.573-1.905-1.005-2.5-2-.546.902-1.048 1.353-2.5 2-1.018-.644-1.46-1.08-2-2-1.028.71-1.69.918-3 1 1.081-1.048 1.757-2.03 2-3 .194-.776.84-1.551 1.79-2.21m11.654 5.997c.887-.457 1.28-.891 1.556-1.787 1.032.916 1.683 1.157 3 1-1.297-1.036-1.758-2.03-2-3-.5-2-4-4-8-4-.74 0-1.461.068-2.15.192",key:"17914v"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $W=U("Nut",[["path",{d:"M12 4V2",key:"1k5q1u"}],["path",{d:"M5 10v4a7.004 7.004 0 0 0 5.277 6.787c.412.104.802.292 1.102.592L12 22l.621-.621c.3-.3.69-.488 1.102-.592A7.003 7.003 0 0 0 19 14v-4",key:"1tgyif"}],["path",{d:"M12 4C8 4 4.5 6 4 8c-.243.97-.919 1.952-2 3 1.31-.082 1.972-.29 3-1 .54.92.982 1.356 2 2 1.452-.647 1.954-1.098 2.5-2 .595.995 1.151 1.427 2.5 2 1.31-.621 1.862-1.058 2.5-2 .629.977 1.162 1.423 2.5 2 1.209-.548 1.68-.967 2-2 1.032.916 1.683 1.157 3 1-1.297-1.036-1.758-2.03-2-3-.5-2-4-4-8-4Z",key:"tnsqj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const V2=U("OctagonAlert",[["path",{d:"M12 16h.01",key:"1drbdi"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M15.312 2a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586l-4.688-4.688A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2z",key:"1fd625"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const UW=U("OctagonMinus",[["path",{d:"M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z",key:"2d38gg"}],["path",{d:"M8 12h8",key:"1wcyev"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const H2=U("OctagonPause",[["path",{d:"M10 15V9",key:"1lckn7"}],["path",{d:"M14 15V9",key:"1muqhk"}],["path",{d:"M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z",key:"2d38gg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const W2=U("OctagonX",[["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z",key:"2d38gg"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qW=U("Octagon",[["path",{d:"M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z",key:"2d38gg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const VW=U("Omega",[["path",{d:"M3 20h4.5a.5.5 0 0 0 .5-.5v-.282a.52.52 0 0 0-.247-.437 8 8 0 1 1 8.494-.001.52.52 0 0 0-.247.438v.282a.5.5 0 0 0 .5.5H21",key:"1x94xo"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const HW=U("Option",[["path",{d:"M3 3h6l6 18h6",key:"ph9rgk"}],["path",{d:"M14 3h7",key:"16f0ms"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const WW=U("Orbit",[["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["circle",{cx:"19",cy:"5",r:"2",key:"mhkx31"}],["circle",{cx:"5",cy:"19",r:"2",key:"v8kfzx"}],["path",{d:"M10.4 21.9a10 10 0 0 0 9.941-15.416",key:"eohfx2"}],["path",{d:"M13.5 2.1a10 10 0 0 0-9.841 15.416",key:"19pvbm"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const GW=U("Origami",[["path",{d:"M12 12V4a1 1 0 0 1 1-1h6.297a1 1 0 0 1 .651 1.759l-4.696 4.025",key:"1bx4vc"}],["path",{d:"m12 21-7.414-7.414A2 2 0 0 1 4 12.172V6.415a1.002 1.002 0 0 1 1.707-.707L20 20.009",key:"1h3km6"}],["path",{d:"m12.214 3.381 8.414 14.966a1 1 0 0 1-.167 1.199l-1.168 1.163a1 1 0 0 1-.706.291H6.351a1 1 0 0 1-.625-.219L3.25 18.8a1 1 0 0 1 .631-1.781l4.165.027",key:"1hj4wg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const KW=U("Package2",[["path",{d:"M3 9h18v10a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V9Z",key:"1ront0"}],["path",{d:"m3 9 2.45-4.9A2 2 0 0 1 7.24 3h9.52a2 2 0 0 1 1.8 1.1L21 9",key:"19h2x1"}],["path",{d:"M12 3v6",key:"1holv5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ZW=U("PackageCheck",[["path",{d:"m16 16 2 2 4-4",key:"gfu2re"}],["path",{d:"M21 10V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l2-1.14",key:"e7tb2h"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["line",{x1:"12",x2:"12",y1:"22",y2:"12",key:"a4e8g8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const YW=U("PackageMinus",[["path",{d:"M16 16h6",key:"100bgy"}],["path",{d:"M21 10V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l2-1.14",key:"e7tb2h"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["line",{x1:"12",x2:"12",y1:"22",y2:"12",key:"a4e8g8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const XW=U("PackageOpen",[["path",{d:"M12 22v-9",key:"x3hkom"}],["path",{d:"M15.17 2.21a1.67 1.67 0 0 1 1.63 0L21 4.57a1.93 1.93 0 0 1 0 3.36L8.82 14.79a1.655 1.655 0 0 1-1.64 0L3 12.43a1.93 1.93 0 0 1 0-3.36z",key:"2ntwy6"}],["path",{d:"M20 13v3.87a2.06 2.06 0 0 1-1.11 1.83l-6 3.08a1.93 1.93 0 0 1-1.78 0l-6-3.08A2.06 2.06 0 0 1 4 16.87V13",key:"1pmm1c"}],["path",{d:"M21 12.43a1.93 1.93 0 0 0 0-3.36L8.83 2.2a1.64 1.64 0 0 0-1.63 0L3 4.57a1.93 1.93 0 0 0 0 3.36l12.18 6.86a1.636 1.636 0 0 0 1.63 0z",key:"12ttoo"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const QW=U("PackagePlus",[["path",{d:"M16 16h6",key:"100bgy"}],["path",{d:"M19 13v6",key:"85cyf1"}],["path",{d:"M21 10V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l2-1.14",key:"e7tb2h"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["line",{x1:"12",x2:"12",y1:"22",y2:"12",key:"a4e8g8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const JW=U("PackageSearch",[["path",{d:"M21 10V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l2-1.14",key:"e7tb2h"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["line",{x1:"12",x2:"12",y1:"22",y2:"12",key:"a4e8g8"}],["circle",{cx:"18.5",cy:"15.5",r:"2.5",key:"b5zd12"}],["path",{d:"M20.27 17.27 22 19",key:"1l4muz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const eG=U("PackageX",[["path",{d:"M21 10V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l2-1.14",key:"e7tb2h"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["line",{x1:"12",x2:"12",y1:"22",y2:"12",key:"a4e8g8"}],["path",{d:"m17 13 5 5m-5 0 5-5",key:"im3w4b"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zl=U("Package",[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["path",{d:"m3.3 7 7.703 4.734a2 2 0 0 0 1.994 0L20.7 7",key:"yx3hmr"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tG=U("PaintBucket",[["path",{d:"m19 11-8-8-8.6 8.6a2 2 0 0 0 0 2.8l5.2 5.2c.8.8 2 .8 2.8 0L19 11Z",key:"irua1i"}],["path",{d:"m5 2 5 5",key:"1lls2c"}],["path",{d:"M2 13h15",key:"1hkzvu"}],["path",{d:"M22 20a2 2 0 1 1-4 0c0-1.6 1.7-2.4 2-4 .3 1.6 2 2.4 2 4Z",key:"xk76lq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rG=U("PaintRoller",[["rect",{width:"16",height:"6",x:"2",y:"2",rx:"2",key:"jcyz7m"}],["path",{d:"M10 16v-2a2 2 0 0 1 2-2h8a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2h-2",key:"1b9h7c"}],["rect",{width:"4",height:"6",x:"8",y:"16",rx:"1",key:"d6e7yl"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const G2=U("PaintbrushVertical",[["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M14 2v4",key:"qmzblu"}],["path",{d:"M17 2a1 1 0 0 1 1 1v9H6V3a1 1 0 0 1 1-1z",key:"ycvu00"}],["path",{d:"M6 12a1 1 0 0 0-1 1v1a2 2 0 0 0 2 2h2a1 1 0 0 1 1 1v2.9a2 2 0 1 0 4 0V17a1 1 0 0 1 1-1h2a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1",key:"iw4wnp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nG=U("Paintbrush",[["path",{d:"m14.622 17.897-10.68-2.913",key:"vj2p1u"}],["path",{d:"M18.376 2.622a1 1 0 1 1 3.002 3.002L17.36 9.643a.5.5 0 0 0 0 .707l.944.944a2.41 2.41 0 0 1 0 3.408l-.944.944a.5.5 0 0 1-.707 0L8.354 7.348a.5.5 0 0 1 0-.707l.944-.944a2.41 2.41 0 0 1 3.408 0l.944.944a.5.5 0 0 0 .707 0z",key:"18tc5c"}],["path",{d:"M9 8c-1.804 2.71-3.97 3.46-6.583 3.948a.507.507 0 0 0-.302.819l7.32 8.883a1 1 0 0 0 1.185.204C12.735 20.405 16 16.792 16 15",key:"ytzfxy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Fd=U("Palette",[["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["path",{d:"M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.926 0 1.648-.746 1.648-1.688 0-.437-.18-.835-.437-1.125-.29-.289-.438-.652-.438-1.125a1.64 1.64 0 0 1 1.668-1.668h1.996c3.051 0 5.555-2.503 5.555-5.554C21.965 6.012 17.461 2 12 2z",key:"12rzf8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sG=U("PanelBottomClose",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 15h18",key:"5xshup"}],["path",{d:"m15 8-3 3-3-3",key:"1oxy1z"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const K2=U("PanelBottomDashed",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M14 15h1",key:"171nev"}],["path",{d:"M19 15h2",key:"1vnucp"}],["path",{d:"M3 15h2",key:"8bym0q"}],["path",{d:"M9 15h1",key:"1tg3ks"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const aG=U("PanelBottomOpen",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 15h18",key:"5xshup"}],["path",{d:"m9 10 3-3 3 3",key:"11gsxs"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const iG=U("PanelBottom",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 15h18",key:"5xshup"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Z2=U("PanelLeftClose",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m16 15-3-3 3-3",key:"14y99z"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Y2=U("PanelLeftDashed",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 14v1",key:"askpd8"}],["path",{d:"M9 19v2",key:"16tejx"}],["path",{d:"M9 3v2",key:"1noubl"}],["path",{d:"M9 9v1",key:"19ebxg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const X2=U("PanelLeftOpen",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m14 9 3 3-3 3",key:"8010ee"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Q2=U("PanelLeft",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oG=U("PanelRightClose",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m8 9 3 3-3 3",key:"12hl5m"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const J2=U("PanelRightDashed",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 14v1",key:"ilsfch"}],["path",{d:"M15 19v2",key:"1fst2f"}],["path",{d:"M15 3v2",key:"z204g4"}],["path",{d:"M15 9v1",key:"z2a8b1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lG=U("PanelRightOpen",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m10 15-3-3 3-3",key:"1pgupc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cG=U("PanelRight",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dG=U("PanelTopClose",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"m9 16 3-3 3 3",key:"1idcnm"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const eb=U("PanelTopDashed",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M14 9h1",key:"l0svgy"}],["path",{d:"M19 9h2",key:"te2zfg"}],["path",{d:"M3 9h2",key:"1h4ldw"}],["path",{d:"M9 9h1",key:"15jzuz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uG=U("PanelTopOpen",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"m15 14-3 3-3-3",key:"g215vf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hG=U("PanelTop",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fG=U("PanelsLeftBottom",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"M9 15h12",key:"5ijen5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pG=U("PanelsRightBottom",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 15h12",key:"1wkqb3"}],["path",{d:"M15 3v18",key:"14nvp0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const m0=U("PanelsTopLeft",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M9 21V9",key:"1oto5p"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mG=U("Paperclip",[["path",{d:"m21.44 11.05-9.19 9.19a6 6 0 0 1-8.49-8.49l8.57-8.57A4 4 0 1 1 18 8.84l-8.59 8.57a2 2 0 0 1-2.83-2.83l8.49-8.48",key:"1u3ebp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gG=U("Parentheses",[["path",{d:"M8 21s-4-3-4-9 4-9 4-9",key:"uto9ud"}],["path",{d:"M16 3s4 3 4 9-4 9-4 9",key:"4w2vsq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xG=U("ParkingMeter",[["path",{d:"M11 15h2",key:"199qp6"}],["path",{d:"M12 12v3",key:"158kv8"}],["path",{d:"M12 19v3",key:"npa21l"}],["path",{d:"M15.282 19a1 1 0 0 0 .948-.68l2.37-6.988a7 7 0 1 0-13.2 0l2.37 6.988a1 1 0 0 0 .948.68z",key:"1jofit"}],["path",{d:"M9 9a3 3 0 1 1 6 0",key:"jdoeu8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ac=U("PartyPopper",[["path",{d:"M5.8 11.3 2 22l10.7-3.79",key:"gwxi1d"}],["path",{d:"M4 3h.01",key:"1vcuye"}],["path",{d:"M22 8h.01",key:"1mrtc2"}],["path",{d:"M15 2h.01",key:"1cjtqr"}],["path",{d:"M22 20h.01",key:"1mrys2"}],["path",{d:"m22 2-2.24.75a2.9 2.9 0 0 0-1.96 3.12c.1.86-.57 1.63-1.45 1.63h-.38c-.86 0-1.6.6-1.76 1.44L14 10",key:"hbicv8"}],["path",{d:"m22 13-.82-.33c-.86-.34-1.82.2-1.98 1.11c-.11.7-.72 1.22-1.43 1.22H17",key:"1i94pl"}],["path",{d:"m11 2 .33.82c.34.86-.2 1.82-1.11 1.98C9.52 4.9 9 5.52 9 6.23V7",key:"1cofks"}],["path",{d:"M11 13c1.93 1.93 2.83 4.17 2 5-.83.83-3.07-.07-5-2-1.93-1.93-2.83-4.17-2-5 .83-.83 3.07.07 5 2Z",key:"4kbmks"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Yf=U("Pause",[["rect",{x:"14",y:"4",width:"4",height:"16",rx:"1",key:"zuxfzm"}],["rect",{x:"6",y:"4",width:"4",height:"16",rx:"1",key:"1okwgv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yG=U("PawPrint",[["circle",{cx:"11",cy:"4",r:"2",key:"vol9p0"}],["circle",{cx:"18",cy:"8",r:"2",key:"17gozi"}],["circle",{cx:"20",cy:"16",r:"2",key:"1v9bxh"}],["path",{d:"M9 10a5 5 0 0 1 5 5v3.5a3.5 3.5 0 0 1-6.84 1.045Q6.52 17.48 4.46 16.84A3.5 3.5 0 0 1 5.5 10Z",key:"1ydw1z"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vG=U("PcCase",[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",key:"1uq1d7"}],["path",{d:"M15 14h.01",key:"1kp3bh"}],["path",{d:"M9 6h6",key:"dgm16u"}],["path",{d:"M9 10h6",key:"9gxzsh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tb=U("PenLine",[["path",{d:"M12 20h9",key:"t2du7b"}],["path",{d:"M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z",key:"1ykcvy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _G=U("PenOff",[["path",{d:"m10 10-6.157 6.162a2 2 0 0 0-.5.833l-1.322 4.36a.5.5 0 0 0 .622.624l4.358-1.323a2 2 0 0 0 .83-.5L14 13.982",key:"bjo8r8"}],["path",{d:"m12.829 7.172 4.359-4.346a1 1 0 1 1 3.986 3.986l-4.353 4.353",key:"16h5ne"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vj=U("PenTool",[["path",{d:"M15.707 21.293a1 1 0 0 1-1.414 0l-1.586-1.586a1 1 0 0 1 0-1.414l5.586-5.586a1 1 0 0 1 1.414 0l1.586 1.586a1 1 0 0 1 0 1.414z",key:"nt11vn"}],["path",{d:"m18 13-1.375-6.874a1 1 0 0 0-.746-.776L3.235 2.028a1 1 0 0 0-1.207 1.207L5.35 15.879a1 1 0 0 0 .776.746L13 18",key:"15qc1e"}],["path",{d:"m2.3 2.3 7.286 7.286",key:"1wuzzi"}],["circle",{cx:"11",cy:"11",r:"2",key:"xmgehs"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const g0=U("Pen",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bG=U("PencilLine",[["path",{d:"M12 20h9",key:"t2du7b"}],["path",{d:"M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z",key:"1ykcvy"}],["path",{d:"m15 5 3 3",key:"1w25hb"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wG=U("PencilOff",[["path",{d:"m10 10-6.157 6.162a2 2 0 0 0-.5.833l-1.322 4.36a.5.5 0 0 0 .622.624l4.358-1.323a2 2 0 0 0 .83-.5L14 13.982",key:"bjo8r8"}],["path",{d:"m12.829 7.172 4.359-4.346a1 1 0 1 1 3.986 3.986l-4.353 4.353",key:"16h5ne"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jG=U("PencilRuler",[["path",{d:"M13 7 8.7 2.7a2.41 2.41 0 0 0-3.4 0L2.7 5.3a2.41 2.41 0 0 0 0 3.4L7 13",key:"orapub"}],["path",{d:"m8 6 2-2",key:"115y1s"}],["path",{d:"m18 16 2-2",key:"ee94s4"}],["path",{d:"m17 11 4.3 4.3c.94.94.94 2.46 0 3.4l-2.6 2.6c-.94.94-2.46.94-3.4 0L11 17",key:"cfq27r"}],["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _i=U("Pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kG=U("Pentagon",[["path",{d:"M10.83 2.38a2 2 0 0 1 2.34 0l8 5.74a2 2 0 0 1 .73 2.25l-3.04 9.26a2 2 0 0 1-1.9 1.37H7.04a2 2 0 0 1-1.9-1.37L2.1 10.37a2 2 0 0 1 .73-2.25z",key:"2hea0t"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hS=U("Percent",[["line",{x1:"19",x2:"5",y1:"5",y2:"19",key:"1x9vlm"}],["circle",{cx:"6.5",cy:"6.5",r:"2.5",key:"4mh3h7"}],["circle",{cx:"17.5",cy:"17.5",r:"2.5",key:"1mdrzq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const NG=U("PersonStanding",[["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["path",{d:"m9 20 3-6 3 6",key:"se2kox"}],["path",{d:"m6 8 6 2 6-2",key:"4o3us4"}],["path",{d:"M12 10v4",key:"1kjpxc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const SG=U("PhilippinePeso",[["path",{d:"M20 11H4",key:"6ut86h"}],["path",{d:"M20 7H4",key:"zbl0bi"}],["path",{d:"M7 21V4a1 1 0 0 1 1-1h4a1 1 0 0 1 0 12H7",key:"1ana5r"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const CG=U("PhoneCall",[["path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z",key:"foiqr5"}],["path",{d:"M14.05 2a9 9 0 0 1 8 7.94",key:"vmijpz"}],["path",{d:"M14.05 6A5 5 0 0 1 18 10",key:"13nbpp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const MG=U("PhoneForwarded",[["polyline",{points:"18 2 22 6 18 10",key:"6vjanh"}],["line",{x1:"14",x2:"22",y1:"6",y2:"6",key:"1jsywh"}],["path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z",key:"foiqr5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const TG=U("PhoneIncoming",[["polyline",{points:"16 2 16 8 22 8",key:"1ygljm"}],["line",{x1:"22",x2:"16",y1:"2",y2:"8",key:"1xzwqn"}],["path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z",key:"foiqr5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const AG=U("PhoneMissed",[["line",{x1:"22",x2:"16",y1:"2",y2:"8",key:"1xzwqn"}],["line",{x1:"16",x2:"22",y1:"2",y2:"8",key:"13zxdn"}],["path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z",key:"foiqr5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const EG=U("PhoneOff",[["path",{d:"M10.68 13.31a16 16 0 0 0 3.41 2.6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7 2 2 0 0 1 1.72 2v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.42 19.42 0 0 1-3.33-2.67m-2.67-3.34a19.79 19.79 0 0 1-3.07-8.63A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91",key:"z86iuo"}],["line",{x1:"22",x2:"2",y1:"2",y2:"22",key:"11kh81"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const IG=U("PhoneOutgoing",[["polyline",{points:"22 8 22 2 16 2",key:"1g204g"}],["line",{x1:"16",x2:"22",y1:"8",y2:"2",key:"1ggias"}],["path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z",key:"foiqr5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bi=U("Phone",[["path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z",key:"foiqr5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const PG=U("Pi",[["line",{x1:"9",x2:"9",y1:"4",y2:"20",key:"ovs5a5"}],["path",{d:"M4 7c0-1.7 1.3-3 3-3h13",key:"10pag4"}],["path",{d:"M18 20c-1.7 0-3-1.3-3-3V4",key:"1gaosr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const LG=U("Piano",[["path",{d:"M18.5 8c-1.4 0-2.6-.8-3.2-2A6.87 6.87 0 0 0 2 9v11a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-8.5C22 9.6 20.4 8 18.5 8",key:"lag0yf"}],["path",{d:"M2 14h20",key:"myj16y"}],["path",{d:"M6 14v4",key:"9ng0ue"}],["path",{d:"M10 14v4",key:"1v8uk5"}],["path",{d:"M14 14v4",key:"1tqops"}],["path",{d:"M18 14v4",key:"18uqwm"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const OG=U("Pickaxe",[["path",{d:"M14.531 12.469 6.619 20.38a1 1 0 1 1-3-3l7.912-7.912",key:"we99rg"}],["path",{d:"M15.686 4.314A12.5 12.5 0 0 0 5.461 2.958 1 1 0 0 0 5.58 4.71a22 22 0 0 1 6.318 3.393",key:"1w6hck"}],["path",{d:"M17.7 3.7a1 1 0 0 0-1.4 0l-4.6 4.6a1 1 0 0 0 0 1.4l2.6 2.6a1 1 0 0 0 1.4 0l4.6-4.6a1 1 0 0 0 0-1.4z",key:"15hgfx"}],["path",{d:"M19.686 8.314a12.501 12.501 0 0 1 1.356 10.225 1 1 0 0 1-1.751-.119 22 22 0 0 0-3.393-6.319",key:"452b4h"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const DG=U("PictureInPicture2",[["path",{d:"M21 9V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v10c0 1.1.9 2 2 2h4",key:"daa4of"}],["rect",{width:"10",height:"7",x:"12",y:"13",rx:"2",key:"1nb8gs"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const RG=U("PictureInPicture",[["path",{d:"M8 4.5v5H3m-1-6 6 6m13 0v-3c0-1.16-.84-2-2-2h-7m-9 9v2c0 1.05.95 2 2 2h3",key:"bcd8fb"}],["rect",{width:"10",height:"7",x:"12",y:"13.5",ry:"2",key:"136fx3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const FG=U("PiggyBank",[["path",{d:"M19 5c-1.5 0-2.8 1.4-3 2-3.5-1.5-11-.3-11 5 0 1.8 0 3 2 4.5V20h4v-2h3v2h4v-4c1-.5 1.7-1 2-2h2v-4h-2c0-1-.5-1.5-1-2V5z",key:"1ivx2i"}],["path",{d:"M2 9v1c0 1.1.9 2 2 2h1",key:"nm575m"}],["path",{d:"M16 11h.01",key:"xkw8gn"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zG=U("PilcrowLeft",[["path",{d:"M14 3v11",key:"mlfb7b"}],["path",{d:"M14 9h-3a3 3 0 0 1 0-6h9",key:"1ulc19"}],["path",{d:"M18 3v11",key:"1phi0r"}],["path",{d:"M22 18H2l4-4",key:"yt65j9"}],["path",{d:"m6 22-4-4",key:"6jgyf5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const BG=U("PilcrowRight",[["path",{d:"M10 3v11",key:"o3l5kj"}],["path",{d:"M10 9H7a1 1 0 0 1 0-6h8",key:"1wb1nc"}],["path",{d:"M14 3v11",key:"mlfb7b"}],["path",{d:"m18 14 4 4H2",key:"4r8io1"}],["path",{d:"m22 18-4 4",key:"1hjjrd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $G=U("Pilcrow",[["path",{d:"M13 4v16",key:"8vvj80"}],["path",{d:"M17 4v16",key:"7dpous"}],["path",{d:"M19 4H9.5a4.5 4.5 0 0 0 0 9H13",key:"sh4n9v"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const UG=U("PillBottle",[["path",{d:"M18 11h-4a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1h4",key:"17ldeb"}],["path",{d:"M6 7v13a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V7",key:"nc37y6"}],["rect",{width:"16",height:"5",x:"4",y:"2",rx:"1",key:"3jeezo"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qG=U("Pill",[["path",{d:"m10.5 20.5 10-10a4.95 4.95 0 1 0-7-7l-10 10a4.95 4.95 0 1 0 7 7Z",key:"wa1lgi"}],["path",{d:"m8.5 8.5 7 7",key:"rvfmvr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const BT=U("PinOff",[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M15 9.34V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H7.89",key:"znwnzq"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M9 9v1.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h11",key:"c9qhm2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const b1=U("Pin",[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z",key:"1nkz8b"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const VG=U("Pipette",[["path",{d:"m2 22 1-1h3l9-9",key:"1sre89"}],["path",{d:"M3 21v-3l9-9",key:"hpe2y6"}],["path",{d:"m15 6 3.4-3.4a2.1 2.1 0 1 1 3 3L18 9l.4.4a2.1 2.1 0 1 1-3 3l-3.8-3.8a2.1 2.1 0 1 1 3-3l.4.4Z",key:"196du1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const HG=U("Pizza",[["path",{d:"m12 14-1 1",key:"11onhr"}],["path",{d:"m13.75 18.25-1.25 1.42",key:"1yisr3"}],["path",{d:"M17.775 5.654a15.68 15.68 0 0 0-12.121 12.12",key:"1qtqk6"}],["path",{d:"M18.8 9.3a1 1 0 0 0 2.1 7.7",key:"fbbbr2"}],["path",{d:"M21.964 20.732a1 1 0 0 1-1.232 1.232l-18-5a1 1 0 0 1-.695-1.232A19.68 19.68 0 0 1 15.732 2.037a1 1 0 0 1 1.232.695z",key:"1hyfdd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const WG=U("PlaneLanding",[["path",{d:"M2 22h20",key:"272qi7"}],["path",{d:"M3.77 10.77 2 9l2-4.5 1.1.55c.55.28.9.84.9 1.45s.35 1.17.9 1.45L8 8.5l3-6 1.05.53a2 2 0 0 1 1.09 1.52l.72 5.4a2 2 0 0 0 1.09 1.52l4.4 2.2c.42.22.78.55 1.01.96l.6 1.03c.49.88-.06 1.98-1.06 2.1l-1.18.15c-.47.06-.95-.02-1.37-.24L4.29 11.15a2 2 0 0 1-.52-.38Z",key:"1ma21e"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const GG=U("PlaneTakeoff",[["path",{d:"M2 22h20",key:"272qi7"}],["path",{d:"M6.36 17.4 4 17l-2-4 1.1-.55a2 2 0 0 1 1.8 0l.17.1a2 2 0 0 0 1.8 0L8 12 5 6l.9-.45a2 2 0 0 1 2.09.2l4.02 3a2 2 0 0 0 2.1.2l4.19-2.06a2.41 2.41 0 0 1 1.73-.17L21 7a1.4 1.4 0 0 1 .87 1.99l-.38.76c-.23.46-.6.84-1.07 1.08L7.58 17.2a2 2 0 0 1-1.22.18Z",key:"fkigj9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const KG=U("Plane",[["path",{d:"M17.8 19.2 16 11l3.5-3.5C21 6 21.5 4 21 3c-1-.5-3 0-4.5 1.5L13 8 4.8 6.2c-.5-.1-.9.1-1.1.5l-.3.5c-.2.5-.1 1 .3 1.3L9 12l-2 3H4l-1 1 3 2 2 3 1-1v-3l3-2 3.5 5.3c.3.4.8.5 1.3.3l.5-.2c.4-.3.6-.7.5-1.2z",key:"1v9wt8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hc=U("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ZG=U("Plug2",[["path",{d:"M9 2v6",key:"17ngun"}],["path",{d:"M15 2v6",key:"s7yy2p"}],["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M5 8h14",key:"pcz4l3"}],["path",{d:"M6 11V8h12v3a6 6 0 1 1-12 0Z",key:"wtfw2c"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rb=U("PlugZap",[["path",{d:"M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z",key:"goz73y"}],["path",{d:"m2 22 3-3",key:"19mgm9"}],["path",{d:"M7.5 13.5 10 11",key:"7xgeeb"}],["path",{d:"M10.5 16.5 13 14",key:"10btkg"}],["path",{d:"m18 3-4 4h6l-4 4",key:"16psg9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const YG=U("Plug",[["path",{d:"M12 22v-5",key:"1ega77"}],["path",{d:"M9 8V2",key:"14iosj"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8Z",key:"osxo6l"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bn=U("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const XG=U("PocketKnife",[["path",{d:"M3 2v1c0 1 2 1 2 2S3 6 3 7s2 1 2 2-2 1-2 2 2 1 2 2",key:"19w3oe"}],["path",{d:"M18 6h.01",key:"1v4wsw"}],["path",{d:"M6 18h.01",key:"uhywen"}],["path",{d:"M20.83 8.83a4 4 0 0 0-5.66-5.66l-12 12a4 4 0 1 0 5.66 5.66Z",key:"6fykxj"}],["path",{d:"M18 11.66V22a4 4 0 0 0 4-4V6",key:"1utzek"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const QG=U("Pocket",[["path",{d:"M4 3h16a2 2 0 0 1 2 2v6a10 10 0 0 1-10 10A10 10 0 0 1 2 11V5a2 2 0 0 1 2-2z",key:"1mz881"}],["polyline",{points:"8 10 12 14 16 10",key:"w4mbv5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const JG=U("Podcast",[["path",{d:"M16.85 18.58a9 9 0 1 0-9.7 0",key:"d71mpg"}],["path",{d:"M8 14a5 5 0 1 1 8 0",key:"fc81rn"}],["circle",{cx:"12",cy:"11",r:"1",key:"1gvufo"}],["path",{d:"M13 17a1 1 0 1 0-2 0l.5 4.5a.5.5 0 1 0 1 0Z",key:"za5kbj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const eK=U("PointerOff",[["path",{d:"M10 4.5V4a2 2 0 0 0-2.41-1.957",key:"jsi14n"}],["path",{d:"M13.9 8.4a2 2 0 0 0-1.26-1.295",key:"hirc7f"}],["path",{d:"M21.7 16.2A8 8 0 0 0 22 14v-3a2 2 0 1 0-4 0v-1a2 2 0 0 0-3.63-1.158",key:"1jxb2e"}],["path",{d:"m7 15-1.8-1.8a2 2 0 0 0-2.79 2.86L6 19.7a7.74 7.74 0 0 0 6 2.3h2a8 8 0 0 0 5.657-2.343",key:"10r7hm"}],["path",{d:"M6 6v8",key:"tv5xkp"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tK=U("Pointer",[["path",{d:"M22 14a8 8 0 0 1-8 8",key:"56vcr3"}],["path",{d:"M18 11v-1a2 2 0 0 0-2-2a2 2 0 0 0-2 2",key:"1agjmk"}],["path",{d:"M14 10V9a2 2 0 0 0-2-2a2 2 0 0 0-2 2v1",key:"wdbh2u"}],["path",{d:"M10 9.5V4a2 2 0 0 0-2-2a2 2 0 0 0-2 2v10",key:"1ibuk9"}],["path",{d:"M18 11a2 2 0 1 1 4 0v3a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15",key:"g6ys72"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rK=U("Popcorn",[["path",{d:"M18 8a2 2 0 0 0 0-4 2 2 0 0 0-4 0 2 2 0 0 0-4 0 2 2 0 0 0-4 0 2 2 0 0 0 0 4",key:"10td1f"}],["path",{d:"M10 22 9 8",key:"yjptiv"}],["path",{d:"m14 22 1-14",key:"8jwc8b"}],["path",{d:"M20 8c.5 0 .9.4.8 1l-2.6 12c-.1.5-.7 1-1.2 1H7c-.6 0-1.1-.4-1.2-1L3.2 9c-.1-.6.3-1 .8-1Z",key:"1qo33t"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nK=U("Popsicle",[["path",{d:"M18.6 14.4c.8-.8.8-2 0-2.8l-8.1-8.1a4.95 4.95 0 1 0-7.1 7.1l8.1 8.1c.9.7 2.1.7 2.9-.1Z",key:"1o68ps"}],["path",{d:"m22 22-5.5-5.5",key:"17o70y"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sK=U("PoundSterling",[["path",{d:"M18 7c0-5.333-8-5.333-8 0",key:"1prm2n"}],["path",{d:"M10 7v14",key:"18tmcs"}],["path",{d:"M6 21h12",key:"4dkmi1"}],["path",{d:"M6 13h10",key:"ybwr4a"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const aK=U("PowerOff",[["path",{d:"M18.36 6.64A9 9 0 0 1 20.77 15",key:"dxknvb"}],["path",{d:"M6.16 6.16a9 9 0 1 0 12.68 12.68",key:"1x7qb5"}],["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const iK=U("Power",[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oK=U("Presentation",[["path",{d:"M2 3h20",key:"91anmk"}],["path",{d:"M21 3v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V3",key:"2k9sn8"}],["path",{d:"m7 21 5-5 5 5",key:"bip4we"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lK=U("PrinterCheck",[["path",{d:"M13.5 22H7a1 1 0 0 1-1-1v-6a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v.5",key:"qeb09x"}],["path",{d:"m16 19 2 2 4-4",key:"1b14m6"}],["path",{d:"M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v2",key:"1md90i"}],["path",{d:"M6 9V3a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v6",key:"1itne7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cK=U("Printer",[["path",{d:"M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2",key:"143wyd"}],["path",{d:"M6 9V3a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v6",key:"1itne7"}],["rect",{x:"6",y:"14",width:"12",height:"8",rx:"1",key:"1ue0tg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dK=U("Projector",[["path",{d:"M5 7 3 5",key:"1yys58"}],["path",{d:"M9 6V3",key:"1ptz9u"}],["path",{d:"m13 7 2-2",key:"1w3vmq"}],["circle",{cx:"9",cy:"13",r:"3",key:"1mma13"}],["path",{d:"M11.83 12H20a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-4a2 2 0 0 1 2-2h2.17",key:"2frwzc"}],["path",{d:"M16 16h2",key:"dnq2od"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uK=U("Proportions",[["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["path",{d:"M12 9v11",key:"1fnkrn"}],["path",{d:"M2 9h13a2 2 0 0 1 2 2v9",key:"11z3ex"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hK=U("Puzzle",[["path",{d:"M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z",key:"w46dr5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fK=U("Pyramid",[["path",{d:"M2.5 16.88a1 1 0 0 1-.32-1.43l9-13.02a1 1 0 0 1 1.64 0l9 13.01a1 1 0 0 1-.32 1.44l-8.51 4.86a2 2 0 0 1-1.98 0Z",key:"aenxs0"}],["path",{d:"M12 2v20",key:"t6zp3m"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $T=U("QrCode",[["rect",{width:"5",height:"5",x:"3",y:"3",rx:"1",key:"1tu5fj"}],["rect",{width:"5",height:"5",x:"16",y:"3",rx:"1",key:"1v8r4q"}],["rect",{width:"5",height:"5",x:"3",y:"16",rx:"1",key:"1x03jg"}],["path",{d:"M21 16h-3a2 2 0 0 0-2 2v3",key:"177gqh"}],["path",{d:"M21 21v.01",key:"ents32"}],["path",{d:"M12 7v3a2 2 0 0 1-2 2H7",key:"8crl2c"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M12 3h.01",key:"n36tog"}],["path",{d:"M12 16v.01",key:"133mhm"}],["path",{d:"M16 12h1",key:"1slzba"}],["path",{d:"M21 12v.01",key:"1lwtk9"}],["path",{d:"M12 21v-1",key:"1880an"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const UT=U("Quote",[["path",{d:"M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"rib7q0"}],["path",{d:"M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"1ymkrd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pK=U("Rabbit",[["path",{d:"M13 16a3 3 0 0 1 2.24 5",key:"1epib5"}],["path",{d:"M18 12h.01",key:"yjnet6"}],["path",{d:"M18 21h-8a4 4 0 0 1-4-4 7 7 0 0 1 7-7h.2L9.6 6.4a1 1 0 1 1 2.8-2.8L15.8 7h.2c3.3 0 6 2.7 6 6v1a2 2 0 0 1-2 2h-1a3 3 0 0 0-3 3",key:"ue9ozu"}],["path",{d:"M20 8.54V4a2 2 0 1 0-4 0v3",key:"49iql8"}],["path",{d:"M7.612 12.524a3 3 0 1 0-1.6 4.3",key:"1e33i0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mK=U("Radar",[["path",{d:"M19.07 4.93A10 10 0 0 0 6.99 3.34",key:"z3du51"}],["path",{d:"M4 6h.01",key:"oypzma"}],["path",{d:"M2.29 9.62A10 10 0 1 0 21.31 8.35",key:"qzzz0"}],["path",{d:"M16.24 7.76A6 6 0 1 0 8.23 16.67",key:"1yjesh"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M17.99 11.66A6 6 0 0 1 15.77 16.67",key:"1u2y91"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["path",{d:"m13.41 10.59 5.66-5.66",key:"mhq4k0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gK=U("Radiation",[["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M7.5 4.2c-.3-.5-.9-.7-1.3-.4C3.9 5.5 2.3 8.1 2 11c-.1.5.4 1 1 1h5c0-1.5.8-2.8 2-3.4-1.1-1.9-2-3.5-2.5-4.4z",key:"wy49g3"}],["path",{d:"M21 12c.6 0 1-.4 1-1-.3-2.9-1.8-5.5-4.1-7.1-.4-.3-1.1-.2-1.3.3-.6.9-1.5 2.5-2.6 4.3 1.2.7 2 2 2 3.5h5z",key:"vklnvr"}],["path",{d:"M7.5 19.8c-.3.5-.1 1.1.4 1.3 2.6 1.2 5.6 1.2 8.2 0 .5-.2.7-.8.4-1.3-.5-.9-1.4-2.5-2.5-4.3-1.2.7-2.8.7-4 0-1.1 1.8-2 3.4-2.5 4.3z",key:"wkdf1o"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xK=U("Radical",[["path",{d:"M3 12h3.28a1 1 0 0 1 .948.684l2.298 7.934a.5.5 0 0 0 .96-.044L13.82 4.771A1 1 0 0 1 14.792 4H21",key:"1mqj8i"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yK=U("RadioReceiver",[["path",{d:"M5 16v2",key:"g5qcv5"}],["path",{d:"M19 16v2",key:"1gbaio"}],["rect",{width:"20",height:"8",x:"2",y:"8",rx:"2",key:"vjsjur"}],["path",{d:"M18 12h.01",key:"yjnet6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vK=U("RadioTower",[["path",{d:"M4.9 16.1C1 12.2 1 5.8 4.9 1.9",key:"s0qx1y"}],["path",{d:"M7.8 4.7a6.14 6.14 0 0 0-.8 7.5",key:"1idnkw"}],["circle",{cx:"12",cy:"9",r:"2",key:"1092wv"}],["path",{d:"M16.2 4.8c2 2 2.26 5.11.8 7.47",key:"ojru2q"}],["path",{d:"M19.1 1.9a9.96 9.96 0 0 1 0 14.1",key:"rhi7fg"}],["path",{d:"M9.5 18h5",key:"mfy3pd"}],["path",{d:"m8 22 4-11 4 11",key:"25yftu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _j=U("Radio",[["path",{d:"M4.9 19.1C1 15.2 1 8.8 4.9 4.9",key:"1vaf9d"}],["path",{d:"M7.8 16.2c-2.3-2.3-2.3-6.1 0-8.5",key:"u1ii0m"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["path",{d:"M16.2 7.8c2.3 2.3 2.3 6.1 0 8.5",key:"1j5fej"}],["path",{d:"M19.1 4.9C23 8.8 23 15.1 19.1 19",key:"10b0cb"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _K=U("Radius",[["path",{d:"M20.34 17.52a10 10 0 1 0-2.82 2.82",key:"fydyku"}],["circle",{cx:"19",cy:"19",r:"2",key:"17f5cg"}],["path",{d:"m13.41 13.41 4.18 4.18",key:"1gqbwc"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bK=U("RailSymbol",[["path",{d:"M5 15h14",key:"m0yey3"}],["path",{d:"M5 9h14",key:"7tsvo6"}],["path",{d:"m14 20-5-5 6-6-5-5",key:"1jo42i"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wK=U("Rainbow",[["path",{d:"M22 17a10 10 0 0 0-20 0",key:"ozegv"}],["path",{d:"M6 17a6 6 0 0 1 12 0",key:"5giftw"}],["path",{d:"M10 17a2 2 0 0 1 4 0",key:"gnsikk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jK=U("Rat",[["path",{d:"M17 5c0-1.7-1.3-3-3-3s-3 1.3-3 3c0 .8.3 1.5.8 2H11c-3.9 0-7 3.1-7 7c0 2.2 1.8 4 4 4",key:"1wq71c"}],["path",{d:"M16.8 3.9c.3-.3.6-.5 1-.7 1.5-.6 3.3.1 3.9 1.6.6 1.5-.1 3.3-1.6 3.9l1.6 2.8c.2.3.2.7.2 1-.2.8-.9 1.2-1.7 1.1 0 0-1.6-.3-2.7-.6H17c-1.7 0-3 1.3-3 3",key:"1crdmb"}],["path",{d:"M13.2 18a3 3 0 0 0-2.2-5",key:"1ol3lk"}],["path",{d:"M13 22H4a2 2 0 0 1 0-4h12",key:"bt3f23"}],["path",{d:"M16 9h.01",key:"1bdo4e"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kK=U("Ratio",[["rect",{width:"12",height:"20",x:"6",y:"2",rx:"2",key:"1oxtiu"}],["rect",{width:"20",height:"12",x:"2",y:"6",rx:"2",key:"9lu3g6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const NK=U("ReceiptCent",[["path",{d:"M4 2v20l2-1 2 1 2-1 2 1 2-1 2 1 2-1 2 1V2l-2 1-2-1-2 1-2-1-2 1-2-1-2 1Z",key:"q3az6g"}],["path",{d:"M12 6.5v11",key:"ecfhkf"}],["path",{d:"M15 9.4a4 4 0 1 0 0 5.2",key:"1makmb"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const SK=U("ReceiptEuro",[["path",{d:"M4 2v20l2-1 2 1 2-1 2 1 2-1 2 1 2-1 2 1V2l-2 1-2-1-2 1-2-1-2 1-2-1-2 1Z",key:"q3az6g"}],["path",{d:"M8 12h5",key:"1g6qi8"}],["path",{d:"M16 9.5a4 4 0 1 0 0 5.2",key:"b2px4r"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const CK=U("ReceiptIndianRupee",[["path",{d:"M4 2v20l2-1 2 1 2-1 2 1 2-1 2 1 2-1 2 1V2l-2 1-2-1-2 1-2-1-2 1-2-1-2 1Z",key:"q3az6g"}],["path",{d:"M8 7h8",key:"i86dvs"}],["path",{d:"M12 17.5 8 15h1a4 4 0 0 0 0-8",key:"grpkl4"}],["path",{d:"M8 11h8",key:"vwpz6n"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const MK=U("ReceiptJapaneseYen",[["path",{d:"M4 2v20l2-1 2 1 2-1 2 1 2-1 2 1 2-1 2 1V2l-2 1-2-1-2 1-2-1-2 1-2-1-2 1Z",key:"q3az6g"}],["path",{d:"m12 10 3-3",key:"1mc12w"}],["path",{d:"m9 7 3 3v7.5",key:"39i0xv"}],["path",{d:"M9 11h6",key:"1fldmi"}],["path",{d:"M9 15h6",key:"cctwl0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const TK=U("ReceiptPoundSterling",[["path",{d:"M4 2v20l2-1 2 1 2-1 2 1 2-1 2 1 2-1 2 1V2l-2 1-2-1-2 1-2-1-2 1-2-1-2 1Z",key:"q3az6g"}],["path",{d:"M8 13h5",key:"1k9z8w"}],["path",{d:"M10 17V9.5a2.5 2.5 0 0 1 5 0",key:"1dzgp0"}],["path",{d:"M8 17h7",key:"8mjdqu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const AK=U("ReceiptRussianRuble",[["path",{d:"M4 2v20l2-1 2 1 2-1 2 1 2-1 2 1 2-1 2 1V2l-2 1-2-1-2 1-2-1-2 1-2-1-2 1Z",key:"q3az6g"}],["path",{d:"M8 15h5",key:"vxg57a"}],["path",{d:"M8 11h5a2 2 0 1 0 0-4h-3v10",key:"1usi5u"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const EK=U("ReceiptSwissFranc",[["path",{d:"M4 2v20l2-1 2 1 2-1 2 1 2-1 2 1 2-1 2 1V2l-2 1-2-1-2 1-2-1-2 1-2-1-2 1Z",key:"q3az6g"}],["path",{d:"M10 17V7h5",key:"k7jq18"}],["path",{d:"M10 11h4",key:"1i0mka"}],["path",{d:"M8 15h5",key:"vxg57a"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const IK=U("ReceiptText",[["path",{d:"M4 2v20l2-1 2 1 2-1 2 1 2-1 2 1 2-1 2 1V2l-2 1-2-1-2 1-2-1-2 1-2-1-2 1Z",key:"q3az6g"}],["path",{d:"M14 8H8",key:"1l3xfs"}],["path",{d:"M16 12H8",key:"1fr5h0"}],["path",{d:"M13 16H8",key:"wsln4y"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const PK=U("Receipt",[["path",{d:"M4 2v20l2-1 2 1 2-1 2 1 2-1 2 1 2-1 2 1V2l-2 1-2-1-2 1-2-1-2 1-2-1-2 1Z",key:"q3az6g"}],["path",{d:"M16 8h-6a2 2 0 1 0 0 4h4a2 2 0 1 1 0 4H8",key:"1h4pet"}],["path",{d:"M12 17.5v-11",key:"1jc1ny"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nb=U("RectangleEllipsis",[["rect",{width:"20",height:"12",x:"2",y:"6",rx:"2",key:"9lu3g6"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M17 12h.01",key:"1m0b6t"}],["path",{d:"M7 12h.01",key:"eqddd0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const LK=U("RectangleHorizontal",[["rect",{width:"20",height:"12",x:"2",y:"6",rx:"2",key:"9lu3g6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const OK=U("RectangleVertical",[["rect",{width:"12",height:"20",x:"6",y:"2",rx:"2",key:"1oxtiu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const DK=U("Recycle",[["path",{d:"M7 19H4.815a1.83 1.83 0 0 1-1.57-.881 1.785 1.785 0 0 1-.004-1.784L7.196 9.5",key:"x6z5xu"}],["path",{d:"M11 19h8.203a1.83 1.83 0 0 0 1.556-.89 1.784 1.784 0 0 0 0-1.775l-1.226-2.12",key:"1x4zh5"}],["path",{d:"m14 16-3 3 3 3",key:"f6jyew"}],["path",{d:"M8.293 13.596 7.196 9.5 3.1 10.598",key:"wf1obh"}],["path",{d:"m9.344 5.811 1.093-1.892A1.83 1.83 0 0 1 11.985 3a1.784 1.784 0 0 1 1.546.888l3.943 6.843",key:"9tzpgr"}],["path",{d:"m13.378 9.633 4.096 1.098 1.097-4.096",key:"1oe83g"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const RK=U("Redo2",[["path",{d:"m15 14 5-5-5-5",key:"12vg1m"}],["path",{d:"M20 9H9.5A5.5 5.5 0 0 0 4 14.5A5.5 5.5 0 0 0 9.5 20H13",key:"6uklza"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const FK=U("RedoDot",[["circle",{cx:"12",cy:"17",r:"1",key:"1ixnty"}],["path",{d:"M21 7v6h-6",key:"3ptur4"}],["path",{d:"M3 17a9 9 0 0 1 9-9 9 9 0 0 1 6 2.3l3 2.7",key:"1kgawr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fS=U("Redo",[["path",{d:"M21 7v6h-6",key:"3ptur4"}],["path",{d:"M3 17a9 9 0 0 1 9-9 9 9 0 0 1 6 2.3l3 2.7",key:"1kgawr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zK=U("RefreshCcwDot",[["path",{d:"M3 2v6h6",key:"18ldww"}],["path",{d:"M21 12A9 9 0 0 0 6 5.3L3 8",key:"1pbrqz"}],["path",{d:"M21 22v-6h-6",key:"usdfbe"}],["path",{d:"M3 12a9 9 0 0 0 15 6.7l3-2.7",key:"1hosoe"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const BK=U("RefreshCcw",[["path",{d:"M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"14sxne"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16",key:"1hlbsb"}],["path",{d:"M16 16h5v5",key:"ccwih5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $K=U("RefreshCwOff",[["path",{d:"M21 8L18.74 5.74A9.75 9.75 0 0 0 12 3C11 3 10.03 3.16 9.13 3.47",key:"1krf6h"}],["path",{d:"M8 16H3v5",key:"1cv678"}],["path",{d:"M3 12C3 9.51 4 7.26 5.64 5.64",key:"ruvoct"}],["path",{d:"m3 16 2.26 2.26A9.75 9.75 0 0 0 12 21c2.49 0 4.74-1 6.36-2.64",key:"19q130"}],["path",{d:"M21 12c0 1-.16 1.97-.47 2.87",key:"4w8emr"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M22 22 2 2",key:"1r8tn9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Gl=U("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const UK=U("Refrigerator",[["path",{d:"M5 6a4 4 0 0 1 4-4h6a4 4 0 0 1 4 4v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6Z",key:"fpq118"}],["path",{d:"M5 10h14",key:"elsbfy"}],["path",{d:"M15 7v6",key:"1nx30x"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qK=U("Regex",[["path",{d:"M17 3v10",key:"15fgeh"}],["path",{d:"m12.67 5.5 8.66 5",key:"1gpheq"}],["path",{d:"m12.67 10.5 8.66-5",key:"1dkfa6"}],["path",{d:"M9 17a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v2a2 2 0 0 0 2 2h2a2 2 0 0 0 2-2v-2z",key:"swwfx4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const VK=U("RemoveFormatting",[["path",{d:"M4 7V4h16v3",key:"9msm58"}],["path",{d:"M5 20h6",key:"1h6pxn"}],["path",{d:"M13 4 8 20",key:"kqq6aj"}],["path",{d:"m15 15 5 5",key:"me55sn"}],["path",{d:"m20 15-5 5",key:"11p7ol"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const HK=U("Repeat1",[["path",{d:"m17 2 4 4-4 4",key:"nntrym"}],["path",{d:"M3 11v-1a4 4 0 0 1 4-4h14",key:"84bu3i"}],["path",{d:"m7 22-4-4 4-4",key:"1wqhfi"}],["path",{d:"M21 13v1a4 4 0 0 1-4 4H3",key:"1rx37r"}],["path",{d:"M11 10h1v4",key:"70cz1p"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const WK=U("Repeat2",[["path",{d:"m2 9 3-3 3 3",key:"1ltn5i"}],["path",{d:"M13 18H7a2 2 0 0 1-2-2V6",key:"1r6tfw"}],["path",{d:"m22 15-3 3-3-3",key:"4rnwn2"}],["path",{d:"M11 6h6a2 2 0 0 1 2 2v10",key:"2f72bc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qT=U("Repeat",[["path",{d:"m17 2 4 4-4 4",key:"nntrym"}],["path",{d:"M3 11v-1a4 4 0 0 1 4-4h14",key:"84bu3i"}],["path",{d:"m7 22-4-4 4-4",key:"1wqhfi"}],["path",{d:"M21 13v1a4 4 0 0 1-4 4H3",key:"1rx37r"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const GK=U("ReplaceAll",[["path",{d:"M14 14a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2",key:"1yyzbs"}],["path",{d:"M14 4a2 2 0 0 1 2-2",key:"1w2hp7"}],["path",{d:"M16 10a2 2 0 0 1-2-2",key:"shjach"}],["path",{d:"M20 14a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2",key:"zfj4xr"}],["path",{d:"M20 2a2 2 0 0 1 2 2",key:"188mtx"}],["path",{d:"M22 8a2 2 0 0 1-2 2",key:"ddf4tu"}],["path",{d:"m3 7 3 3 3-3",key:"x25e72"}],["path",{d:"M6 10V5a 3 3 0 0 1 3-3h1",key:"1ageje"}],["rect",{x:"2",y:"14",width:"8",height:"8",rx:"2",key:"4rksxw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const KK=U("Replace",[["path",{d:"M14 4a2 2 0 0 1 2-2",key:"1w2hp7"}],["path",{d:"M16 10a2 2 0 0 1-2-2",key:"shjach"}],["path",{d:"M20 2a2 2 0 0 1 2 2",key:"188mtx"}],["path",{d:"M22 8a2 2 0 0 1-2 2",key:"ddf4tu"}],["path",{d:"m3 7 3 3 3-3",key:"x25e72"}],["path",{d:"M6 10V5a3 3 0 0 1 3-3h1",key:"3y3t5z"}],["rect",{x:"2",y:"14",width:"8",height:"8",rx:"2",key:"4rksxw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ZK=U("ReplyAll",[["polyline",{points:"7 17 2 12 7 7",key:"t83bqg"}],["polyline",{points:"12 17 7 12 12 7",key:"1g4ajm"}],["path",{d:"M22 18v-2a4 4 0 0 0-4-4H7",key:"1fcyog"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const VT=U("Reply",[["polyline",{points:"9 17 4 12 9 7",key:"hvgpf2"}],["path",{d:"M20 18v-2a4 4 0 0 0-4-4H4",key:"5vmcpk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const YK=U("Rewind",[["polygon",{points:"11 19 2 12 11 5 11 19",key:"14yba5"}],["polygon",{points:"22 19 13 12 22 5 22 19",key:"1pi1cj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const XK=U("Ribbon",[["path",{d:"M12 11.22C11 9.997 10 9 10 8a2 2 0 0 1 4 0c0 1-.998 2.002-2.01 3.22",key:"1rnhq3"}],["path",{d:"m12 18 2.57-3.5",key:"116vt7"}],["path",{d:"M6.243 9.016a7 7 0 0 1 11.507-.009",key:"10dq0b"}],["path",{d:"M9.35 14.53 12 11.22",key:"tdsyp2"}],["path",{d:"M9.35 14.53C7.728 12.246 6 10.221 6 7a6 5 0 0 1 12 0c-.005 3.22-1.778 5.235-3.43 7.5l3.557 4.527a1 1 0 0 1-.203 1.43l-1.894 1.36a1 1 0 0 1-1.384-.215L12 18l-2.679 3.593a1 1 0 0 1-1.39.213l-1.865-1.353a1 1 0 0 1-.203-1.422z",key:"nmifey"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yg=U("Rocket",[["path",{d:"M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09z",key:"m3kijz"}],["path",{d:"m12 15-3-3a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.35 22.35 0 0 1-4 2z",key:"1fmvmk"}],["path",{d:"M9 12H4s.55-3.03 2-4c1.62-1.08 5 0 5 0",key:"1f8sc4"}],["path",{d:"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5",key:"qeys4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const QK=U("RockingChair",[["polyline",{points:"3.5 2 6.5 12.5 18 12.5",key:"y3iy52"}],["line",{x1:"9.5",x2:"5.5",y1:"12.5",y2:"20",key:"19vg5i"}],["line",{x1:"15",x2:"18.5",y1:"12.5",y2:"20",key:"1inpmv"}],["path",{d:"M2.75 18a13 13 0 0 0 18.5 0",key:"1nquas"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const JK=U("RollerCoaster",[["path",{d:"M6 19V5",key:"1r845m"}],["path",{d:"M10 19V6.8",key:"9j2tfs"}],["path",{d:"M14 19v-7.8",key:"10s8qv"}],["path",{d:"M18 5v4",key:"1tajlv"}],["path",{d:"M18 19v-6",key:"ielfq3"}],["path",{d:"M22 19V9",key:"158nzp"}],["path",{d:"M2 19V9a4 4 0 0 1 4-4c2 0 4 1.33 6 4s4 4 6 4a4 4 0 1 0-3-6.65",key:"1930oh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sb=U("Rotate3d",[["path",{d:"M16.466 7.5C15.643 4.237 13.952 2 12 2 9.239 2 7 6.477 7 12s2.239 10 5 10c.342 0 .677-.069 1-.2",key:"10n0gc"}],["path",{d:"m15.194 13.707 3.814 1.86-1.86 3.814",key:"16shm9"}],["path",{d:"M19 15.57c-1.804.885-4.274 1.43-7 1.43-5.523 0-10-2.239-10-5s4.477-5 10-5c4.838 0 8.873 1.718 9.8 4",key:"1lxi77"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const eZ=U("RotateCcwSquare",[["path",{d:"M20 9V7a2 2 0 0 0-2-2h-6",key:"19z8uc"}],["path",{d:"m15 2-3 3 3 3",key:"177bxs"}],["path",{d:"M20 13v5a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2h2",key:"d36hnl"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pS=U("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tZ=U("RotateCwSquare",[["path",{d:"M12 5H6a2 2 0 0 0-2 2v3",key:"l96uqu"}],["path",{d:"m9 8 3-3-3-3",key:"1gzgc3"}],["path",{d:"M4 14v4a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2h-2",key:"1w2k5h"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const HT=U("RotateCw",[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rZ=U("RouteOff",[["circle",{cx:"6",cy:"19",r:"3",key:"1kj8tv"}],["path",{d:"M9 19h8.5c.4 0 .9-.1 1.3-.2",key:"1effex"}],["path",{d:"M5.2 5.2A3.5 3.53 0 0 0 6.5 12H12",key:"k9y2ds"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M21 15.3a3.5 3.5 0 0 0-3.3-3.3",key:"11nlu2"}],["path",{d:"M15 5h-4.3",key:"6537je"}],["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nZ=U("Route",[["circle",{cx:"6",cy:"19",r:"3",key:"1kj8tv"}],["path",{d:"M9 19h8.5a3.5 3.5 0 0 0 0-7h-11a3.5 3.5 0 0 1 0-7H15",key:"1d8sl"}],["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sZ=U("Router",[["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",key:"w68u3i"}],["path",{d:"M6.01 18H6",key:"19vcac"}],["path",{d:"M10.01 18H10",key:"uamcmx"}],["path",{d:"M15 10v4",key:"qjz1xs"}],["path",{d:"M17.84 7.17a4 4 0 0 0-5.66 0",key:"1rif40"}],["path",{d:"M20.66 4.34a8 8 0 0 0-11.31 0",key:"6a5xfq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ab=U("Rows2",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 12h18",key:"1i2n21"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ib=U("Rows3",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M21 9H3",key:"1338ky"}],["path",{d:"M21 15H3",key:"9uk58r"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const aZ=U("Rows4",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M21 7.5H3",key:"1hm9pq"}],["path",{d:"M21 12H3",key:"2avoz0"}],["path",{d:"M21 16.5H3",key:"n7jzkj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const iZ=U("Rss",[["path",{d:"M4 11a9 9 0 0 1 9 9",key:"pv89mb"}],["path",{d:"M4 4a16 16 0 0 1 16 16",key:"k0647b"}],["circle",{cx:"5",cy:"19",r:"1",key:"bfqh0e"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oZ=U("Ruler",[["path",{d:"M21.3 15.3a2.4 2.4 0 0 1 0 3.4l-2.6 2.6a2.4 2.4 0 0 1-3.4 0L2.7 8.7a2.41 2.41 0 0 1 0-3.4l2.6-2.6a2.41 2.41 0 0 1 3.4 0Z",key:"icamh8"}],["path",{d:"m14.5 12.5 2-2",key:"inckbg"}],["path",{d:"m11.5 9.5 2-2",key:"fmmyf7"}],["path",{d:"m8.5 6.5 2-2",key:"vc6u1g"}],["path",{d:"m17.5 15.5 2-2",key:"wo5hmg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lZ=U("RussianRuble",[["path",{d:"M6 11h8a4 4 0 0 0 0-8H9v18",key:"18ai8t"}],["path",{d:"M6 15h8",key:"1y8f6l"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cZ=U("Sailboat",[["path",{d:"M22 18H2a4 4 0 0 0 4 4h12a4 4 0 0 0 4-4Z",key:"1404fh"}],["path",{d:"M21 14 10 2 3 14h18Z",key:"1nzg7v"}],["path",{d:"M10 2v16",key:"1labyt"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dZ=U("Salad",[["path",{d:"M7 21h10",key:"1b0cd5"}],["path",{d:"M12 21a9 9 0 0 0 9-9H3a9 9 0 0 0 9 9Z",key:"4rw317"}],["path",{d:"M11.38 12a2.4 2.4 0 0 1-.4-4.77 2.4 2.4 0 0 1 3.2-2.77 2.4 2.4 0 0 1 3.47-.63 2.4 2.4 0 0 1 3.37 3.37 2.4 2.4 0 0 1-1.1 3.7 2.51 2.51 0 0 1 .03 1.1",key:"10xrj0"}],["path",{d:"m13 12 4-4",key:"1hckqy"}],["path",{d:"M10.9 7.25A3.99 3.99 0 0 0 4 10c0 .73.2 1.41.54 2",key:"1p4srx"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uZ=U("Sandwich",[["path",{d:"m2.37 11.223 8.372-6.777a2 2 0 0 1 2.516 0l8.371 6.777",key:"f1wd0e"}],["path",{d:"M21 15a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1h-5.25",key:"1pfu07"}],["path",{d:"M3 15a1 1 0 0 0-1 1v2a1 1 0 0 0 1 1h9",key:"1oq9qw"}],["path",{d:"m6.67 15 6.13 4.6a2 2 0 0 0 2.8-.4l3.15-4.2",key:"1fnwu5"}],["rect",{width:"20",height:"4",x:"2",y:"11",rx:"1",key:"itshg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hZ=U("SatelliteDish",[["path",{d:"M4 10a7.31 7.31 0 0 0 10 10Z",key:"1fzpp3"}],["path",{d:"m9 15 3-3",key:"88sc13"}],["path",{d:"M17 13a6 6 0 0 0-6-6",key:"15cc6u"}],["path",{d:"M21 13A10 10 0 0 0 11 3",key:"11nf8s"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fZ=U("Satellite",[["path",{d:"M13 7 9 3 5 7l4 4",key:"vyckw6"}],["path",{d:"m17 11 4 4-4 4-4-4",key:"rchckc"}],["path",{d:"m8 12 4 4 6-6-4-4Z",key:"1sshf7"}],["path",{d:"m16 8 3-3",key:"x428zp"}],["path",{d:"M9 21a6 6 0 0 0-6-6",key:"1iajcf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pZ=U("SaveAll",[["path",{d:"M10 2v3a1 1 0 0 0 1 1h5",key:"1xspal"}],["path",{d:"M18 18v-6a1 1 0 0 0-1-1h-6a1 1 0 0 0-1 1v6",key:"1ra60u"}],["path",{d:"M18 22H4a2 2 0 0 1-2-2V6",key:"pblm9e"}],["path",{d:"M8 18a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9.172a2 2 0 0 1 1.414.586l2.828 2.828A2 2 0 0 1 22 6.828V16a2 2 0 0 1-2.01 2z",key:"1yve0x"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mZ=U("SaveOff",[["path",{d:"M13 13H8a1 1 0 0 0-1 1v7",key:"h8g396"}],["path",{d:"M14 8h1",key:"1lfen6"}],["path",{d:"M17 21v-4",key:"1yknxs"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M20.41 20.41A2 2 0 0 1 19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 .59-1.41",key:"1t4vdl"}],["path",{d:"M29.5 11.5s5 5 4 5",key:"zzn4i6"}],["path",{d:"M9 3h6.2a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V15",key:"24cby9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vg=U("Save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ob=U("Scale3d",[["path",{d:"M5 7v11a1 1 0 0 0 1 1h11",key:"13dt1j"}],["path",{d:"M5.293 18.707 11 13",key:"ezgbsx"}],["circle",{cx:"19",cy:"19",r:"2",key:"17f5cg"}],["circle",{cx:"5",cy:"5",r:"2",key:"1gwv83"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gZ=U("Scale",[["path",{d:"m16 16 3-8 3 8c-.87.65-1.92 1-3 1s-2.13-.35-3-1Z",key:"7g6ntu"}],["path",{d:"m2 16 3-8 3 8c-.87.65-1.92 1-3 1s-2.13-.35-3-1Z",key:"ijws7r"}],["path",{d:"M7 21h10",key:"1b0cd5"}],["path",{d:"M12 3v18",key:"108xh3"}],["path",{d:"M3 7h2c2 0 5-1 7-2 2 1 5 2 7 2h2",key:"3gwbw2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xZ=U("Scaling",[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M14 15H9v-5",key:"pi4jk9"}],["path",{d:"M16 3h5v5",key:"1806ms"}],["path",{d:"M21 3 9 15",key:"15kdhq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yZ=U("ScanBarcode",[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}],["path",{d:"M8 7v10",key:"23sfjj"}],["path",{d:"M12 7v10",key:"jspqdw"}],["path",{d:"M17 7v10",key:"578dap"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vZ=U("ScanEye",[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["path",{d:"M18.944 12.33a1 1 0 0 0 0-.66 7.5 7.5 0 0 0-13.888 0 1 1 0 0 0 0 .66 7.5 7.5 0 0 0 13.888 0",key:"11ak4c"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _Z=U("ScanFace",[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}],["path",{d:"M8 14s1.5 2 4 2 4-2 4-2",key:"1y1vjs"}],["path",{d:"M9 9h.01",key:"1q5me6"}],["path",{d:"M15 9h.01",key:"x1ddxp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bZ=U("ScanLine",[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}],["path",{d:"M7 12h10",key:"b7w52i"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wZ=U("ScanQrCode",[["path",{d:"M17 12v4a1 1 0 0 1-1 1h-4",key:"uk4fdo"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M17 8V7",key:"q2g9wo"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M7 17h.01",key:"19xn7k"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}],["rect",{x:"7",y:"7",width:"5",height:"5",rx:"1",key:"m9kyts"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jZ=U("ScanSearch",[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["path",{d:"m16 16-1.9-1.9",key:"1dq9hf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kZ=U("ScanText",[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}],["path",{d:"M7 8h8",key:"1jbsf9"}],["path",{d:"M7 12h10",key:"b7w52i"}],["path",{d:"M7 16h6",key:"1vyc9m"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const NZ=U("Scan",[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const SZ=U("School",[["path",{d:"M14 22v-4a2 2 0 1 0-4 0v4",key:"hhkicm"}],["path",{d:"m18 10 3.447 1.724a1 1 0 0 1 .553.894V20a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-7.382a1 1 0 0 1 .553-.894L6 10",key:"1xqip1"}],["path",{d:"M18 5v17",key:"1sw6gf"}],["path",{d:"m4 6 7.106-3.553a2 2 0 0 1 1.788 0L20 6",key:"9d2mlk"}],["path",{d:"M6 5v17",key:"1xfsm0"}],["circle",{cx:"12",cy:"9",r:"2",key:"1092wv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const CZ=U("ScissorsLineDashed",[["path",{d:"M5.42 9.42 8 12",key:"12pkuq"}],["circle",{cx:"4",cy:"8",r:"2",key:"107mxr"}],["path",{d:"m14 6-8.58 8.58",key:"gvzu5l"}],["circle",{cx:"4",cy:"16",r:"2",key:"1ehqvc"}],["path",{d:"M10.8 14.8 14 18",key:"ax7m9r"}],["path",{d:"M16 12h-2",key:"10asgb"}],["path",{d:"M22 12h-2",key:"14jgyd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const MZ=U("Scissors",[["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M8.12 8.12 12 12",key:"1alkpv"}],["path",{d:"M20 4 8.12 15.88",key:"xgtan2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M14.8 14.8 20 20",key:"ptml3r"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const TZ=U("ScreenShareOff",[["path",{d:"M13 3H4a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-3",key:"i8wdob"}],["path",{d:"M8 21h8",key:"1ev6f3"}],["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"m22 3-5 5",key:"12jva0"}],["path",{d:"m17 3 5 5",key:"k36vhe"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const AZ=U("ScreenShare",[["path",{d:"M13 3H4a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-3",key:"i8wdob"}],["path",{d:"M8 21h8",key:"1ev6f3"}],["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"m17 8 5-5",key:"fqif7o"}],["path",{d:"M17 3h5v5",key:"1o3tu8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const EZ=U("ScrollText",[["path",{d:"M15 12h-5",key:"r7krc0"}],["path",{d:"M15 8h-5",key:"1khuty"}],["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const IZ=U("Scroll",[["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const PZ=U("SearchCheck",[["path",{d:"m8 11 2 2 4-4",key:"1sed1v"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const LZ=U("SearchCode",[["path",{d:"m13 13.5 2-2.5-2-2.5",key:"1rvxrh"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}],["path",{d:"M9 8.5 7 11l2 2.5",key:"6ffwbx"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const OZ=U("SearchSlash",[["path",{d:"m13.5 8.5-5 5",key:"1cs55j"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const DZ=U("SearchX",[["path",{d:"m13.5 8.5-5 5",key:"1cs55j"}],["path",{d:"m8.5 8.5 5 5",key:"a8mexj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wa=U("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const RZ=U("Section",[["path",{d:"M16 5a4 3 0 0 0-8 0c0 4 8 3 8 7a4 3 0 0 1-8 0",key:"vqan6v"}],["path",{d:"M8 19a4 3 0 0 0 8 0c0-4-8-3-8-7a4 3 0 0 1 8 0",key:"wdjd8o"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lb=U("SendHorizontal",[["path",{d:"M3.714 3.048a.498.498 0 0 0-.683.627l2.843 7.627a2 2 0 0 1 0 1.396l-2.842 7.627a.498.498 0 0 0 .682.627l18-8.5a.5.5 0 0 0 0-.904z",key:"117uat"}],["path",{d:"M6 12h16",key:"s4cdu5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const FZ=U("SendToBack",[["rect",{x:"14",y:"14",width:"8",height:"8",rx:"2",key:"1b0bso"}],["rect",{x:"2",y:"2",width:"8",height:"8",rx:"2",key:"1x09vl"}],["path",{d:"M7 14v1a2 2 0 0 0 2 2h1",key:"pao6x6"}],["path",{d:"M14 7h1a2 2 0 0 1 2 2v1",key:"19tdru"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Oo=U("Send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zZ=U("SeparatorHorizontal",[["line",{x1:"3",x2:"21",y1:"12",y2:"12",key:"10d38w"}],["polyline",{points:"8 8 12 4 16 8",key:"zo8t4w"}],["polyline",{points:"16 16 12 20 8 16",key:"1oyrid"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const BZ=U("SeparatorVertical",[["line",{x1:"12",x2:"12",y1:"3",y2:"21",key:"1efggb"}],["polyline",{points:"8 8 4 12 8 16",key:"bnfmv4"}],["polyline",{points:"16 16 20 12 16 8",key:"u90052"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $Z=U("ServerCog",[["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["path",{d:"M4.5 10H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-.5",key:"tn8das"}],["path",{d:"M4.5 14H4a2 2 0 0 0-2 2v4a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-4a2 2 0 0 0-2-2h-.5",key:"1g2pve"}],["path",{d:"M6 6h.01",key:"1utrut"}],["path",{d:"M6 18h.01",key:"uhywen"}],["path",{d:"m15.7 13.4-.9-.3",key:"1jwmzr"}],["path",{d:"m9.2 10.9-.9-.3",key:"qapnim"}],["path",{d:"m10.6 15.7.3-.9",key:"quwk0k"}],["path",{d:"m13.6 15.7-.4-1",key:"cb9xp7"}],["path",{d:"m10.8 9.3-.4-1",key:"1uaiz5"}],["path",{d:"m8.3 13.6 1-.4",key:"s6srou"}],["path",{d:"m14.7 10.8 1-.4",key:"4d31cq"}],["path",{d:"m13.4 8.3-.3.9",key:"1bm987"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const UZ=U("ServerCrash",[["path",{d:"M6 10H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-2",key:"4b9dqc"}],["path",{d:"M6 14H4a2 2 0 0 0-2 2v4a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-4a2 2 0 0 0-2-2h-2",key:"22nnkd"}],["path",{d:"M6 6h.01",key:"1utrut"}],["path",{d:"M6 18h.01",key:"uhywen"}],["path",{d:"m13 6-4 6h6l-4 6",key:"14hqih"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qZ=U("ServerOff",[["path",{d:"M7 2h13a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-5",key:"bt2siv"}],["path",{d:"M10 10 2.5 2.5C2 2 2 2.5 2 5v3a2 2 0 0 0 2 2h6z",key:"1hjrv1"}],["path",{d:"M22 17v-1a2 2 0 0 0-2-2h-1",key:"1iynyr"}],["path",{d:"M4 14a2 2 0 0 0-2 2v4a2 2 0 0 0 2 2h16.5l1-.5.5.5-8-8H4z",key:"161ggg"}],["path",{d:"M6 18h.01",key:"uhywen"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const VZ=U("Server",[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const HZ=U("Settings2",[["path",{d:"M20 7h-9",key:"3s1dr2"}],["path",{d:"M14 17H5",key:"gfn3mx"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fd=U("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const WZ=U("Shapes",[["path",{d:"M8.3 10a.7.7 0 0 1-.626-1.079L11.4 3a.7.7 0 0 1 1.198-.043L16.3 8.9a.7.7 0 0 1-.572 1.1Z",key:"1bo67w"}],["rect",{x:"3",y:"14",width:"7",height:"7",rx:"1",key:"1bkyp8"}],["circle",{cx:"17.5",cy:"17.5",r:"3.5",key:"w3z12y"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fc=U("Share2",[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const WT=U("Share",[["path",{d:"M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8",key:"1b2hhj"}],["polyline",{points:"16 6 12 2 8 6",key:"m901s6"}],["line",{x1:"12",x2:"12",y1:"2",y2:"15",key:"1p0rca"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const GZ=U("Sheet",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["line",{x1:"3",x2:"21",y1:"9",y2:"9",key:"1vqk6q"}],["line",{x1:"3",x2:"21",y1:"15",y2:"15",key:"o2sbyz"}],["line",{x1:"9",x2:"9",y1:"9",y2:"21",key:"1ib60c"}],["line",{x1:"15",x2:"15",y1:"9",y2:"21",key:"1n26ft"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const KZ=U("Shell",[["path",{d:"M14 11a2 2 0 1 1-4 0 4 4 0 0 1 8 0 6 6 0 0 1-12 0 8 8 0 0 1 16 0 10 10 0 1 1-20 0 11.93 11.93 0 0 1 2.42-7.22 2 2 0 1 1 3.16 2.44",key:"1cn552"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ZZ=U("ShieldAlert",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const YZ=U("ShieldBan",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m4.243 5.21 14.39 12.472",key:"1c9a7c"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const GT=U("ShieldCheck",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const XZ=U("ShieldEllipsis",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M8 12h.01",key:"czm47f"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M16 12h.01",key:"1l6xoz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const QZ=U("ShieldHalf",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 22V2",key:"zs6s6o"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const JZ=U("ShieldMinus",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M9 12h6",key:"1c52cq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const eY=U("ShieldOff",[["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M5 5a1 1 0 0 0-1 1v7c0 5 3.5 7.5 7.67 8.94a1 1 0 0 0 .67.01c2.35-.82 4.48-1.97 5.9-3.71",key:"1jlk70"}],["path",{d:"M9.309 3.652A12.252 12.252 0 0 0 11.24 2.28a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1v7a9.784 9.784 0 0 1-.08 1.264",key:"18rp1v"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tY=U("ShieldPlus",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M9 12h6",key:"1c52cq"}],["path",{d:"M12 9v6",key:"199k2o"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rY=U("ShieldQuestion",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M9.1 9a3 3 0 0 1 5.82 1c0 2-3 3-3 3",key:"mhlwft"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cb=U("ShieldX",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m14.5 9.5-5 5",key:"17q4r4"}],["path",{d:"m9.5 9.5 5 5",key:"18nt4w"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rf=U("Shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nY=U("ShipWheel",[["circle",{cx:"12",cy:"12",r:"8",key:"46899m"}],["path",{d:"M12 2v7.5",key:"1e5rl5"}],["path",{d:"m19 5-5.23 5.23",key:"1ezxxf"}],["path",{d:"M22 12h-7.5",key:"le1719"}],["path",{d:"m19 19-5.23-5.23",key:"p3fmgn"}],["path",{d:"M12 14.5V22",key:"dgcmos"}],["path",{d:"M10.23 13.77 5 19",key:"qwopd4"}],["path",{d:"M9.5 12H2",key:"r7bup8"}],["path",{d:"M10.23 10.23 5 5",key:"k2y7lj"}],["circle",{cx:"12",cy:"12",r:"2.5",key:"ix0uyj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sY=U("Ship",[["path",{d:"M12 10.189V14",key:"1p8cqu"}],["path",{d:"M12 2v3",key:"qbqxhf"}],["path",{d:"M19 13V7a2 2 0 0 0-2-2H7a2 2 0 0 0-2 2v6",key:"qpkstq"}],["path",{d:"M19.38 20A11.6 11.6 0 0 0 21 14l-8.188-3.639a2 2 0 0 0-1.624 0L3 14a11.6 11.6 0 0 0 2.81 7.76",key:"7tigtc"}],["path",{d:"M2 21c.6.5 1.2 1 2.5 1 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1s1.2 1 2.5 1c2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1",key:"1924j5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const aY=U("Shirt",[["path",{d:"M20.38 3.46 16 2a4 4 0 0 1-8 0L3.62 3.46a2 2 0 0 0-1.34 2.23l.58 3.47a1 1 0 0 0 .99.84H6v10c0 1.1.9 2 2 2h8a2 2 0 0 0 2-2V10h2.15a1 1 0 0 0 .99-.84l.58-3.47a2 2 0 0 0-1.34-2.23z",key:"1wgbhj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _g=U("ShoppingBag",[["path",{d:"M6 2 3 6v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6l-3-4Z",key:"hou9p0"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M16 10a4 4 0 0 1-8 0",key:"1ltviw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const iY=U("ShoppingBasket",[["path",{d:"m15 11-1 9",key:"5wnq3a"}],["path",{d:"m19 11-4-7",key:"cnml18"}],["path",{d:"M2 11h20",key:"3eubbj"}],["path",{d:"m3.5 11 1.6 7.4a2 2 0 0 0 2 1.6h9.8a2 2 0 0 0 2-1.6l1.7-7.4",key:"yiazzp"}],["path",{d:"M4.5 15.5h15",key:"13mye1"}],["path",{d:"m5 11 4-7",key:"116ra9"}],["path",{d:"m9 11 1 9",key:"1ojof7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fh=U("ShoppingCart",[["circle",{cx:"8",cy:"21",r:"1",key:"jimo8o"}],["circle",{cx:"19",cy:"21",r:"1",key:"13723u"}],["path",{d:"M2.05 2.05h2l2.66 12.42a2 2 0 0 0 2 1.58h9.78a2 2 0 0 0 1.95-1.57l1.65-7.43H5.12",key:"9zh506"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oY=U("Shovel",[["path",{d:"M2 22v-5l5-5 5 5-5 5z",key:"1fh25c"}],["path",{d:"M9.5 14.5 16 8",key:"1smz5x"}],["path",{d:"m17 2 5 5-.5.5a3.53 3.53 0 0 1-5 0s0 0 0 0a3.53 3.53 0 0 1 0-5L17 2",key:"1q8uv5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lY=U("ShowerHead",[["path",{d:"m4 4 2.5 2.5",key:"uv2vmf"}],["path",{d:"M13.5 6.5a4.95 4.95 0 0 0-7 7",key:"frdkwv"}],["path",{d:"M15 5 5 15",key:"1ag8rq"}],["path",{d:"M14 17v.01",key:"eokfpp"}],["path",{d:"M10 16v.01",key:"14uyyl"}],["path",{d:"M13 13v.01",key:"1v1k97"}],["path",{d:"M16 10v.01",key:"5169yg"}],["path",{d:"M11 20v.01",key:"cj92p8"}],["path",{d:"M17 14v.01",key:"11cswd"}],["path",{d:"M20 11v.01",key:"19e0od"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cY=U("Shrink",[["path",{d:"m15 15 6 6m-6-6v4.8m0-4.8h4.8",key:"17vawe"}],["path",{d:"M9 19.8V15m0 0H4.2M9 15l-6 6",key:"chjx8e"}],["path",{d:"M15 4.2V9m0 0h4.8M15 9l6-6",key:"lav6yq"}],["path",{d:"M9 4.2V9m0 0H4.2M9 9 3 3",key:"1pxi2q"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dY=U("Shrub",[["path",{d:"M12 22v-7l-2-2",key:"eqv9mc"}],["path",{d:"M17 8v.8A6 6 0 0 1 13.8 20H10A6.5 6.5 0 0 1 7 8a5 5 0 0 1 10 0Z",key:"ubcgy"}],["path",{d:"m14 14-2 2",key:"847xa2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uY=U("Shuffle",[["path",{d:"m18 14 4 4-4 4",key:"10pe0f"}],["path",{d:"m18 2 4 4-4 4",key:"pucp1d"}],["path",{d:"M2 18h1.973a4 4 0 0 0 3.3-1.7l5.454-8.6a4 4 0 0 1 3.3-1.7H22",key:"1ailkh"}],["path",{d:"M2 6h1.972a4 4 0 0 1 3.6 2.2",key:"km57vx"}],["path",{d:"M22 18h-6.041a4 4 0 0 1-3.3-1.8l-.359-.45",key:"os18l9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hY=U("Sigma",[["path",{d:"M18 7V5a1 1 0 0 0-1-1H6.5a.5.5 0 0 0-.4.8l4.5 6a2 2 0 0 1 0 2.4l-4.5 6a.5.5 0 0 0 .4.8H17a1 1 0 0 0 1-1v-2",key:"wuwx1p"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fY=U("SignalHigh",[["path",{d:"M2 20h.01",key:"4haj6o"}],["path",{d:"M7 20v-4",key:"j294jx"}],["path",{d:"M12 20v-8",key:"i3yub9"}],["path",{d:"M17 20V8",key:"1tkaf5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pY=U("SignalLow",[["path",{d:"M2 20h.01",key:"4haj6o"}],["path",{d:"M7 20v-4",key:"j294jx"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mY=U("SignalMedium",[["path",{d:"M2 20h.01",key:"4haj6o"}],["path",{d:"M7 20v-4",key:"j294jx"}],["path",{d:"M12 20v-8",key:"i3yub9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gY=U("SignalZero",[["path",{d:"M2 20h.01",key:"4haj6o"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xY=U("Signal",[["path",{d:"M2 20h.01",key:"4haj6o"}],["path",{d:"M7 20v-4",key:"j294jx"}],["path",{d:"M12 20v-8",key:"i3yub9"}],["path",{d:"M17 20V8",key:"1tkaf5"}],["path",{d:"M22 4v16",key:"sih9yq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yY=U("Signature",[["path",{d:"m21 17-2.156-1.868A.5.5 0 0 0 18 15.5v.5a1 1 0 0 1-1 1h-2a1 1 0 0 1-1-1c0-2.545-3.991-3.97-8.5-4a1 1 0 0 0 0 5c4.153 0 4.745-11.295 5.708-13.5a2.5 2.5 0 1 1 3.31 3.284",key:"y32ogt"}],["path",{d:"M3 21h18",key:"itz85i"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vY=U("SignpostBig",[["path",{d:"M10 9H4L2 7l2-2h6",key:"1hq7x2"}],["path",{d:"M14 5h6l2 2-2 2h-6",key:"bv62ej"}],["path",{d:"M10 22V4a2 2 0 1 1 4 0v18",key:"eqpcf2"}],["path",{d:"M8 22h8",key:"rmew8v"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _Y=U("Signpost",[["path",{d:"M12 13v8",key:"1l5pq0"}],["path",{d:"M12 3v3",key:"1n5kay"}],["path",{d:"M18 6a2 2 0 0 1 1.387.56l2.307 2.22a1 1 0 0 1 0 1.44l-2.307 2.22A2 2 0 0 1 18 13H6a2 2 0 0 1-1.387-.56l-2.306-2.22a1 1 0 0 1 0-1.44l2.306-2.22A2 2 0 0 1 6 6z",key:"gqqp9m"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bY=U("Siren",[["path",{d:"M7 18v-6a5 5 0 1 1 10 0v6",key:"pcx96s"}],["path",{d:"M5 21a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-1a2 2 0 0 0-2-2H7a2 2 0 0 0-2 2z",key:"1b4s83"}],["path",{d:"M21 12h1",key:"jtio3y"}],["path",{d:"M18.5 4.5 18 5",key:"g5sp9y"}],["path",{d:"M2 12h1",key:"1uaihz"}],["path",{d:"M12 2v1",key:"11qlp1"}],["path",{d:"m4.929 4.929.707.707",key:"1i51kw"}],["path",{d:"M12 12v6",key:"3ahymv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wY=U("SkipBack",[["polygon",{points:"19 20 9 12 19 4 19 20",key:"o2sva"}],["line",{x1:"5",x2:"5",y1:"19",y2:"5",key:"1ocqjk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jY=U("SkipForward",[["polygon",{points:"5 4 15 12 5 20 5 4",key:"16p6eg"}],["line",{x1:"19",x2:"19",y1:"5",y2:"19",key:"futhcm"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kY=U("Skull",[["path",{d:"m12.5 17-.5-1-.5 1h1z",key:"3me087"}],["path",{d:"M15 22a1 1 0 0 0 1-1v-1a2 2 0 0 0 1.56-3.25 8 8 0 1 0-11.12 0A2 2 0 0 0 8 20v1a1 1 0 0 0 1 1z",key:"1o5pge"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const NY=U("Slack",[["rect",{width:"3",height:"8",x:"13",y:"2",rx:"1.5",key:"diqz80"}],["path",{d:"M19 8.5V10h1.5A1.5 1.5 0 1 0 19 8.5",key:"183iwg"}],["rect",{width:"3",height:"8",x:"8",y:"14",rx:"1.5",key:"hqg7r1"}],["path",{d:"M5 15.5V14H3.5A1.5 1.5 0 1 0 5 15.5",key:"76g71w"}],["rect",{width:"8",height:"3",x:"14",y:"13",rx:"1.5",key:"1kmz0a"}],["path",{d:"M15.5 19H14v1.5a1.5 1.5 0 1 0 1.5-1.5",key:"jc4sz0"}],["rect",{width:"8",height:"3",x:"2",y:"8",rx:"1.5",key:"1omvl4"}],["path",{d:"M8.5 5H10V3.5A1.5 1.5 0 1 0 8.5 5",key:"16f3cl"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const SY=U("Slash",[["path",{d:"M22 2 2 22",key:"y4kqgn"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const CY=U("Slice",[["path",{d:"M11 16.586V19a1 1 0 0 1-1 1H2L18.37 3.63a1 1 0 1 1 3 3l-9.663 9.663a1 1 0 0 1-1.414 0L8 14",key:"1sllp5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const KT=U("SlidersHorizontal",[["line",{x1:"21",x2:"14",y1:"4",y2:"4",key:"obuewd"}],["line",{x1:"10",x2:"3",y1:"4",y2:"4",key:"1q6298"}],["line",{x1:"21",x2:"12",y1:"12",y2:"12",key:"1iu8h1"}],["line",{x1:"8",x2:"3",y1:"12",y2:"12",key:"ntss68"}],["line",{x1:"21",x2:"16",y1:"20",y2:"20",key:"14d8ph"}],["line",{x1:"12",x2:"3",y1:"20",y2:"20",key:"m0wm8r"}],["line",{x1:"14",x2:"14",y1:"2",y2:"6",key:"14e1ph"}],["line",{x1:"8",x2:"8",y1:"10",y2:"14",key:"1i6ji0"}],["line",{x1:"16",x2:"16",y1:"18",y2:"22",key:"1lctlv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const db=U("SlidersVertical",[["line",{x1:"4",x2:"4",y1:"21",y2:"14",key:"1p332r"}],["line",{x1:"4",x2:"4",y1:"10",y2:"3",key:"gb41h5"}],["line",{x1:"12",x2:"12",y1:"21",y2:"12",key:"hf2csr"}],["line",{x1:"12",x2:"12",y1:"8",y2:"3",key:"1kfi7u"}],["line",{x1:"20",x2:"20",y1:"21",y2:"16",key:"1lhrwl"}],["line",{x1:"20",x2:"20",y1:"12",y2:"3",key:"16vvfq"}],["line",{x1:"2",x2:"6",y1:"14",y2:"14",key:"1uebub"}],["line",{x1:"10",x2:"14",y1:"8",y2:"8",key:"1yglbp"}],["line",{x1:"18",x2:"22",y1:"16",y2:"16",key:"1jxqpz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const MY=U("SmartphoneCharging",[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12.667 8 10 12h4l-2.667 4",key:"h9lk2d"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const TY=U("SmartphoneNfc",[["rect",{width:"7",height:"12",x:"2",y:"6",rx:"1",key:"5nje8w"}],["path",{d:"M13 8.32a7.43 7.43 0 0 1 0 7.36",key:"1g306n"}],["path",{d:"M16.46 6.21a11.76 11.76 0 0 1 0 11.58",key:"uqvjvo"}],["path",{d:"M19.91 4.1a15.91 15.91 0 0 1 .01 15.8",key:"ujntz3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bg=U("Smartphone",[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const AY=U("SmilePlus",[["path",{d:"M22 11v1a10 10 0 1 1-9-10",key:"ew0xw9"}],["path",{d:"M8 14s1.5 2 4 2 4-2 4-2",key:"1y1vjs"}],["line",{x1:"9",x2:"9.01",y1:"9",y2:"9",key:"yxxnd0"}],["line",{x1:"15",x2:"15.01",y1:"9",y2:"9",key:"1p4y9e"}],["path",{d:"M16 5h6",key:"1vod17"}],["path",{d:"M19 2v6",key:"4bpg5p"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const EY=U("Smile",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 14s1.5 2 4 2 4-2 4-2",key:"1y1vjs"}],["line",{x1:"9",x2:"9.01",y1:"9",y2:"9",key:"yxxnd0"}],["line",{x1:"15",x2:"15.01",y1:"9",y2:"9",key:"1p4y9e"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const IY=U("Snail",[["path",{d:"M2 13a6 6 0 1 0 12 0 4 4 0 1 0-8 0 2 2 0 0 0 4 0",key:"hneq2s"}],["circle",{cx:"10",cy:"13",r:"8",key:"194lz3"}],["path",{d:"M2 21h12c4.4 0 8-3.6 8-8V7a2 2 0 1 0-4 0v6",key:"ixqyt7"}],["path",{d:"M18 3 19.1 5.2",key:"9tjm43"}],["path",{d:"M22 3 20.9 5.2",key:"j3odrs"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const V0=U("Snowflake",[["line",{x1:"2",x2:"22",y1:"12",y2:"12",key:"1dnqot"}],["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"m20 16-4-4 4-4",key:"rquw4f"}],["path",{d:"m4 8 4 4-4 4",key:"12s3z9"}],["path",{d:"m16 4-4 4-4-4",key:"1tumq1"}],["path",{d:"m8 20 4-4 4 4",key:"9p200w"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const PY=U("Sofa",[["path",{d:"M20 9V6a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v3",key:"1dgpiv"}],["path",{d:"M2 16a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-5a2 2 0 0 0-4 0v1.5a.5.5 0 0 1-.5.5h-11a.5.5 0 0 1-.5-.5V11a2 2 0 0 0-4 0z",key:"xacw8m"}],["path",{d:"M4 18v2",key:"jwo5n2"}],["path",{d:"M20 18v2",key:"1ar1qi"}],["path",{d:"M12 4v9",key:"oqhhn3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const LY=U("Soup",[["path",{d:"M12 21a9 9 0 0 0 9-9H3a9 9 0 0 0 9 9Z",key:"4rw317"}],["path",{d:"M7 21h10",key:"1b0cd5"}],["path",{d:"M19.5 12 22 6",key:"shfsr5"}],["path",{d:"M16.25 3c.27.1.8.53.75 1.36-.06.83-.93 1.2-1 2.02-.05.78.34 1.24.73 1.62",key:"rpc6vp"}],["path",{d:"M11.25 3c.27.1.8.53.74 1.36-.05.83-.93 1.2-.98 2.02-.06.78.33 1.24.72 1.62",key:"1lf63m"}],["path",{d:"M6.25 3c.27.1.8.53.75 1.36-.06.83-.93 1.2-1 2.02-.05.78.34 1.24.74 1.62",key:"97tijn"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const OY=U("Space",[["path",{d:"M22 17v1c0 .5-.5 1-1 1H3c-.5 0-1-.5-1-1v-1",key:"lt2kga"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const DY=U("Spade",[["path",{d:"M5 9c-1.5 1.5-3 3.2-3 5.5A5.5 5.5 0 0 0 7.5 20c1.8 0 3-.5 4.5-2 1.5 1.5 2.7 2 4.5 2a5.5 5.5 0 0 0 5.5-5.5c0-2.3-1.5-4-3-5.5l-7-7-7 7Z",key:"40bo9n"}],["path",{d:"M12 18v4",key:"jadmvz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const RY=U("Sparkle",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ms=U("Sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const FY=U("Speaker",[["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",key:"1nb95v"}],["path",{d:"M12 6h.01",key:"1vi96p"}],["circle",{cx:"12",cy:"14",r:"4",key:"1jruaj"}],["path",{d:"M12 14h.01",key:"1etili"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zY=U("Speech",[["path",{d:"M8.8 20v-4.1l1.9.2a2.3 2.3 0 0 0 2.164-2.1V8.3A5.37 5.37 0 0 0 2 8.25c0 2.8.656 3.054 1 4.55a5.77 5.77 0 0 1 .029 2.758L2 20",key:"11atix"}],["path",{d:"M19.8 17.8a7.5 7.5 0 0 0 .003-10.603",key:"yol142"}],["path",{d:"M17 15a3.5 3.5 0 0 0-.025-4.975",key:"ssbmkc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const BY=U("SpellCheck2",[["path",{d:"m6 16 6-12 6 12",key:"1b4byz"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M4 21c1.1 0 1.1-1 2.3-1s1.1 1 2.3 1c1.1 0 1.1-1 2.3-1 1.1 0 1.1 1 2.3 1 1.1 0 1.1-1 2.3-1 1.1 0 1.1 1 2.3 1 1.1 0 1.1-1 2.3-1",key:"8mdmtu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $Y=U("SpellCheck",[["path",{d:"m6 16 6-12 6 12",key:"1b4byz"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"m16 20 2 2 4-4",key:"13tcca"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const UY=U("Spline",[["circle",{cx:"19",cy:"5",r:"2",key:"mhkx31"}],["circle",{cx:"5",cy:"19",r:"2",key:"v8kfzx"}],["path",{d:"M5 17A12 12 0 0 1 17 5",key:"1okkup"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qY=U("Split",[["path",{d:"M16 3h5v5",key:"1806ms"}],["path",{d:"M8 3H3v5",key:"15dfkv"}],["path",{d:"M12 22v-8.3a4 4 0 0 0-1.172-2.872L3 3",key:"1qrqzj"}],["path",{d:"m15 9 6-6",key:"ko1vev"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const VY=U("SprayCan",[["path",{d:"M3 3h.01",key:"159qn6"}],["path",{d:"M7 5h.01",key:"1hq22a"}],["path",{d:"M11 7h.01",key:"1osv80"}],["path",{d:"M3 7h.01",key:"1xzrh3"}],["path",{d:"M7 9h.01",key:"19b3jx"}],["path",{d:"M3 11h.01",key:"1eifu7"}],["rect",{width:"4",height:"4",x:"15",y:"5",key:"mri9e4"}],["path",{d:"m19 9 2 2v10c0 .6-.4 1-1 1h-6c-.6 0-1-.4-1-1V11l2-2",key:"aib6hk"}],["path",{d:"m13 14 8-2",key:"1d7bmk"}],["path",{d:"m13 19 8-2",key:"1y2vml"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const HY=U("Sprout",[["path",{d:"M7 20h10",key:"e6iznv"}],["path",{d:"M10 20c5.5-2.5.8-6.4 3-10",key:"161w41"}],["path",{d:"M9.5 9.4c1.1.8 1.8 2.2 2.3 3.7-2 .4-3.5.4-4.8-.3-1.2-.6-2.3-1.9-3-4.2 2.8-.5 4.4 0 5.5.8z",key:"9gtqwd"}],["path",{d:"M14.1 6a7 7 0 0 0-1.1 4c1.9-.1 3.3-.6 4.3-1.4 1-1 1.6-2.3 1.7-4.6-2.7.1-4 1-4.9 2z",key:"bkxnd2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ub=U("SquareActivity",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M17 12h-2l-2 5-2-10-2 5H7",key:"15hlnc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hb=U("SquareArrowDownLeft",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"m16 8-8 8",key:"166keh"}],["path",{d:"M16 16H8V8",key:"1w2ppm"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fb=U("SquareArrowDownRight",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"m8 8 8 8",key:"1imecy"}],["path",{d:"M16 8v8H8",key:"1lbpgo"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pb=U("SquareArrowDown",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 8v8",key:"napkw2"}],["path",{d:"m8 12 4 4 4-4",key:"k98ssh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mb=U("SquareArrowLeft",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"m12 8-4 4 4 4",key:"15vm53"}],["path",{d:"M16 12H8",key:"1fr5h0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gb=U("SquareArrowOutDownLeft",[["path",{d:"M13 21h6a2 2 0 0 0 2-2V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v6",key:"14qz4y"}],["path",{d:"m3 21 9-9",key:"1jfql5"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xb=U("SquareArrowOutDownRight",[["path",{d:"M21 11V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h6",key:"14rsvq"}],["path",{d:"m21 21-9-9",key:"1et2py"}],["path",{d:"M21 15v6h-6",key:"1jko0i"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yb=U("SquareArrowOutUpLeft",[["path",{d:"M13 3h6a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-6",key:"14mv1t"}],["path",{d:"m3 3 9 9",key:"rks13r"}],["path",{d:"M3 9V3h6",key:"ira0h2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vb=U("SquareArrowOutUpRight",[["path",{d:"M21 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h6",key:"y09zxi"}],["path",{d:"m21 3-9 9",key:"mpx6sq"}],["path",{d:"M15 3h6v6",key:"1q9fwt"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _b=U("SquareArrowRight",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"m12 16 4-4-4-4",key:"1i9zcv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bb=U("SquareArrowUpLeft",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M8 16V8h8",key:"19xb1h"}],["path",{d:"M16 16 8 8",key:"1qdy8n"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wb=U("SquareArrowUpRight",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M8 8h8v8",key:"b65dnt"}],["path",{d:"m8 16 8-8",key:"13b9ih"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jb=U("SquareArrowUp",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"m16 12-4-4-4 4",key:"177agl"}],["path",{d:"M12 16V8",key:"1sbj14"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kb=U("SquareAsterisk",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 8v8",key:"napkw2"}],["path",{d:"m8.5 14 7-4",key:"12hpby"}],["path",{d:"m8.5 10 7 4",key:"wwy2dy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Nb=U("SquareBottomDashedScissors",[["path",{d:"M4 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v16a2 2 0 0 1-2 2",key:"1vzg26"}],["path",{d:"M10 22H8",key:"euku7a"}],["path",{d:"M16 22h-2",key:"18d249"}],["circle",{cx:"8",cy:"8",r:"2",key:"14cg06"}],["path",{d:"M9.414 9.414 12 12",key:"qz4lzr"}],["path",{d:"M14.8 14.8 18 18",key:"11flf1"}],["circle",{cx:"8",cy:"16",r:"2",key:"1acxsx"}],["path",{d:"m18 6-8.586 8.586",key:"11kzk1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ym=U("SquareChartGantt",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 8h7",key:"kbo1nt"}],["path",{d:"M8 12h6",key:"ikassy"}],["path",{d:"M11 16h5",key:"oq65wt"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const x0=U("SquareCheckBig",[["path",{d:"M21 10.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.5",key:"1uzm8b"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Sb=U("SquareCheck",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Cb=U("SquareChevronDown",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"m16 10-4 4-4-4",key:"894hmk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Mb=U("SquareChevronLeft",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"m14 16-4-4 4-4",key:"ojs7w8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Tb=U("SquareChevronRight",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"m10 8 4 4-4 4",key:"1wy4r4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ab=U("SquareChevronUp",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"m8 14 4-4 4 4",key:"fy2ptz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Eb=U("SquareCode",[["path",{d:"M10 9.5 8 12l2 2.5",key:"3mjy60"}],["path",{d:"m14 9.5 2 2.5-2 2.5",key:"1bir2l"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const WY=U("SquareDashedBottomCode",[["path",{d:"M10 9.5 8 12l2 2.5",key:"3mjy60"}],["path",{d:"M14 21h1",key:"v9vybs"}],["path",{d:"m14 9.5 2 2.5-2 2.5",key:"1bir2l"}],["path",{d:"M5 21a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2",key:"as5y1o"}],["path",{d:"M9 21h1",key:"15o7lz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const GY=U("SquareDashedBottom",[["path",{d:"M5 21a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2",key:"as5y1o"}],["path",{d:"M9 21h1",key:"15o7lz"}],["path",{d:"M14 21h1",key:"v9vybs"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ib=U("SquareDashedKanban",[["path",{d:"M8 7v7",key:"1x2jlm"}],["path",{d:"M12 7v4",key:"xawao1"}],["path",{d:"M16 7v9",key:"1hp2iy"}],["path",{d:"M5 3a2 2 0 0 0-2 2",key:"y57alp"}],["path",{d:"M9 3h1",key:"1yesri"}],["path",{d:"M14 3h1",key:"1ec4yj"}],["path",{d:"M19 3a2 2 0 0 1 2 2",key:"18rm91"}],["path",{d:"M21 9v1",key:"mxsmne"}],["path",{d:"M21 14v1",key:"169vum"}],["path",{d:"M21 19a2 2 0 0 1-2 2",key:"1j7049"}],["path",{d:"M14 21h1",key:"v9vybs"}],["path",{d:"M9 21h1",key:"15o7lz"}],["path",{d:"M5 21a2 2 0 0 1-2-2",key:"sbafld"}],["path",{d:"M3 14v1",key:"vnatye"}],["path",{d:"M3 9v1",key:"1r0deq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Pb=U("SquareDashedMousePointer",[["path",{d:"M12.034 12.681a.498.498 0 0 1 .647-.647l9 3.5a.5.5 0 0 1-.033.943l-3.444 1.068a1 1 0 0 0-.66.66l-1.067 3.443a.5.5 0 0 1-.943.033z",key:"xwnzip"}],["path",{d:"M5 3a2 2 0 0 0-2 2",key:"y57alp"}],["path",{d:"M19 3a2 2 0 0 1 2 2",key:"18rm91"}],["path",{d:"M5 21a2 2 0 0 1-2-2",key:"sbafld"}],["path",{d:"M9 3h1",key:"1yesri"}],["path",{d:"M9 21h2",key:"1qve2z"}],["path",{d:"M14 3h1",key:"1ec4yj"}],["path",{d:"M3 9v1",key:"1r0deq"}],["path",{d:"M21 9v2",key:"p14lih"}],["path",{d:"M3 14v1",key:"vnatye"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Lb=U("SquareDashed",[["path",{d:"M5 3a2 2 0 0 0-2 2",key:"y57alp"}],["path",{d:"M19 3a2 2 0 0 1 2 2",key:"18rm91"}],["path",{d:"M21 19a2 2 0 0 1-2 2",key:"1j7049"}],["path",{d:"M5 21a2 2 0 0 1-2-2",key:"sbafld"}],["path",{d:"M9 3h1",key:"1yesri"}],["path",{d:"M9 21h1",key:"15o7lz"}],["path",{d:"M14 3h1",key:"1ec4yj"}],["path",{d:"M14 21h1",key:"v9vybs"}],["path",{d:"M3 9v1",key:"1r0deq"}],["path",{d:"M21 9v1",key:"mxsmne"}],["path",{d:"M3 14v1",key:"vnatye"}],["path",{d:"M21 14v1",key:"169vum"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ob=U("SquareDivide",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}],["line",{x1:"12",x2:"12",y1:"16",y2:"16",key:"aqc6ln"}],["line",{x1:"12",x2:"12",y1:"8",y2:"8",key:"1mkcni"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Db=U("SquareDot",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Rb=U("SquareEqual",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M7 10h10",key:"1101jm"}],["path",{d:"M7 14h10",key:"1mhdw3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Fb=U("SquareFunction",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["path",{d:"M9 17c2 0 2.8-1 2.8-2.8V10c0-2 1-3.3 3.2-3",key:"m1af9g"}],["path",{d:"M9 11.2h5.7",key:"3zgcl2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zb=U("SquareKanban",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M8 7v7",key:"1x2jlm"}],["path",{d:"M12 7v4",key:"xawao1"}],["path",{d:"M16 7v9",key:"1hp2iy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Bb=U("SquareLibrary",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M7 7v10",key:"d5nglc"}],["path",{d:"M11 7v10",key:"pptsnr"}],["path",{d:"m15 7 2 10",key:"1m7qm5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $b=U("SquareM",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M8 16V8l4 4 4-4v8",key:"141u4e"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ub=U("SquareMenu",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M7 8h10",key:"1jw688"}],["path",{d:"M7 12h10",key:"b7w52i"}],["path",{d:"M7 16h10",key:"wp8him"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qb=U("SquareMinus",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M8 12h8",key:"1wcyev"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Vb=U("SquareMousePointer",[["path",{d:"M12.034 12.681a.498.498 0 0 1 .647-.647l9 3.5a.5.5 0 0 1-.033.943l-3.444 1.068a1 1 0 0 0-.66.66l-1.067 3.443a.5.5 0 0 1-.943.033z",key:"xwnzip"}],["path",{d:"M21 11V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h6",key:"14rsvq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Hb=U("SquareParkingOff",[["path",{d:"M3.6 3.6A2 2 0 0 1 5 3h14a2 2 0 0 1 2 2v14a2 2 0 0 1-.59 1.41",key:"9l1ft6"}],["path",{d:"M3 8.7V19a2 2 0 0 0 2 2h10.3",key:"17knke"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M13 13a3 3 0 1 0 0-6H9v2",key:"uoagbd"}],["path",{d:"M9 17v-2.3",key:"1jxgo2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Wb=U("SquareParking",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 17V7h4a3 3 0 0 1 0 6H9",key:"1dfk2c"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ac=U("SquarePen",[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Gb=U("SquarePercent",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"M9 9h.01",key:"1q5me6"}],["path",{d:"M15 15h.01",key:"lqbp3k"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Kb=U("SquarePi",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M7 7h10",key:"udp07y"}],["path",{d:"M10 7v10",key:"i1d9ee"}],["path",{d:"M16 17a2 2 0 0 1-2-2V7",key:"ftwdc7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Zb=U("SquarePilcrow",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 12H9.5a2.5 2.5 0 0 1 0-5H17",key:"1l9586"}],["path",{d:"M12 7v10",key:"jspqdw"}],["path",{d:"M16 7v10",key:"lavkr4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Yb=U("SquarePlay",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"m9 8 6 4-6 4Z",key:"f1r3lt"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Xb=U("SquarePlus",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Qb=U("SquarePower",[["path",{d:"M12 7v4",key:"xawao1"}],["path",{d:"M7.998 9.003a5 5 0 1 0 8-.005",key:"1pek45"}],["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",key:"h1oib"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const KY=U("SquareRadical",[["path",{d:"M7 12h2l2 5 2-10h4",key:"1fxv6h"}],["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",key:"h1oib"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Jb=U("SquareScissors",[["rect",{width:"20",height:"20",x:"2",y:"2",rx:"2",key:"1btzen"}],["circle",{cx:"8",cy:"8",r:"2",key:"14cg06"}],["path",{d:"M9.414 9.414 12 12",key:"qz4lzr"}],["path",{d:"M14.8 14.8 18 18",key:"11flf1"}],["circle",{cx:"8",cy:"16",r:"2",key:"1acxsx"}],["path",{d:"m18 6-8.586 8.586",key:"11kzk1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ew=U("SquareSigma",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M16 8.9V7H8l4 5-4 5h8v-1.9",key:"9nih0i"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tw=U("SquareSlash",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["line",{x1:"9",x2:"15",y1:"15",y2:"9",key:"1dfufj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rw=U("SquareSplitHorizontal",[["path",{d:"M8 19H5c-1 0-2-1-2-2V7c0-1 1-2 2-2h3",key:"lubmu8"}],["path",{d:"M16 5h3c1 0 2 1 2 2v10c0 1-1 2-2 2h-3",key:"1ag34g"}],["line",{x1:"12",x2:"12",y1:"4",y2:"20",key:"1tx1rr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nw=U("SquareSplitVertical",[["path",{d:"M5 8V5c0-1 1-2 2-2h10c1 0 2 1 2 2v3",key:"1pi83i"}],["path",{d:"M19 16v3c0 1-1 2-2 2H7c-1 0-2-1-2-2v-3",key:"ido5k7"}],["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ZY=U("SquareSquare",[["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",key:"h1oib"}],["rect",{x:"8",y:"8",width:"8",height:"8",rx:"1",key:"z9xiuo"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const YY=U("SquareStack",[["path",{d:"M4 10c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h4c1.1 0 2 .9 2 2",key:"4i38lg"}],["path",{d:"M10 16c-1.1 0-2-.9-2-2v-4c0-1.1.9-2 2-2h4c1.1 0 2 .9 2 2",key:"mlte4a"}],["rect",{width:"8",height:"8",x:"14",y:"14",rx:"2",key:"1fa9i4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sw=U("SquareTerminal",[["path",{d:"m7 11 2-2-2-2",key:"1lz0vl"}],["path",{d:"M11 13h4",key:"1p7l4v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const aw=U("SquareUserRound",[["path",{d:"M18 21a6 6 0 0 0-12 0",key:"kaz2du"}],["circle",{cx:"12",cy:"11",r:"4",key:"1gt34v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const iw=U("SquareUser",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}],["path",{d:"M7 21v-2a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v2",key:"1m6ac2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ow=U("SquareX",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wg=U("Square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const XY=U("Squircle",[["path",{d:"M12 3c7.2 0 9 1.8 9 9s-1.8 9-9 9-9-1.8-9-9 1.8-9 9-9",key:"garfkc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const QY=U("Squirrel",[["path",{d:"M15.236 22a3 3 0 0 0-2.2-5",key:"21bitc"}],["path",{d:"M16 20a3 3 0 0 1 3-3h1a2 2 0 0 0 2-2v-2a4 4 0 0 0-4-4V4",key:"oh0fg0"}],["path",{d:"M18 13h.01",key:"9veqaj"}],["path",{d:"M18 6a4 4 0 0 0-4 4 7 7 0 0 0-7 7c0-5 4-5 4-10.5a4.5 4.5 0 1 0-9 0 2.5 2.5 0 0 0 5 0C7 10 3 11 3 17c0 2.8 2.2 5 5 5h10",key:"980v8a"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const JY=U("Stamp",[["path",{d:"M5 22h14",key:"ehvnwv"}],["path",{d:"M19.27 13.73A2.5 2.5 0 0 0 17.5 13h-11A2.5 2.5 0 0 0 4 15.5V17a1 1 0 0 0 1 1h14a1 1 0 0 0 1-1v-1.5c0-.66-.26-1.3-.73-1.77Z",key:"1sy9ra"}],["path",{d:"M14 13V8.5C14 7 15 7 15 5a3 3 0 0 0-3-3c-1.66 0-3 1-3 3s1 2 1 3.5V13",key:"cnxgux"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const eX=U("StarHalf",[["path",{d:"M12 18.338a2.1 2.1 0 0 0-.987.244L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.12 2.12 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.12 2.12 0 0 0 1.597-1.16l2.309-4.679A.53.53 0 0 1 12 2",key:"2ksp49"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tX=U("StarOff",[["path",{d:"M8.34 8.34 2 9.27l5 4.87L5.82 21 12 17.77 18.18 21l-.59-3.43",key:"16m0ql"}],["path",{d:"M18.42 12.76 22 9.27l-6.91-1L12 2l-1.44 2.91",key:"1vt8nq"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vs=U("Star",[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rX=U("StepBack",[["line",{x1:"18",x2:"18",y1:"20",y2:"4",key:"cun8e5"}],["polygon",{points:"14,20 4,12 14,4",key:"ypakod"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nX=U("StepForward",[["line",{x1:"6",x2:"6",y1:"4",y2:"20",key:"fy8qot"}],["polygon",{points:"10,4 20,12 10,20",key:"1mc1pf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sX=U("Stethoscope",[["path",{d:"M11 2v2",key:"1539x4"}],["path",{d:"M5 2v2",key:"1yf1q8"}],["path",{d:"M5 3H4a2 2 0 0 0-2 2v4a6 6 0 0 0 12 0V5a2 2 0 0 0-2-2h-1",key:"rb5t3r"}],["path",{d:"M8 15a6 6 0 0 0 12 0v-3",key:"x18d4x"}],["circle",{cx:"20",cy:"10",r:"2",key:"ts1r5v"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const aX=U("Sticker",[["path",{d:"M15.5 3H5a2 2 0 0 0-2 2v14c0 1.1.9 2 2 2h14a2 2 0 0 0 2-2V8.5L15.5 3Z",key:"1wis1t"}],["path",{d:"M14 3v4a2 2 0 0 0 2 2h4",key:"36rjfy"}],["path",{d:"M8 13h.01",key:"1sbv64"}],["path",{d:"M16 13h.01",key:"wip0gl"}],["path",{d:"M10 16s.8 1 2 1c1.3 0 2-1 2-1",key:"1vvgv3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const iX=U("StickyNote",[["path",{d:"M16 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V8Z",key:"qazsjp"}],["path",{d:"M15 3v4a2 2 0 0 0 2 2h4",key:"40519r"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oX=U("Store",[["path",{d:"m2 7 4.41-4.41A2 2 0 0 1 7.83 2h8.34a2 2 0 0 1 1.42.59L22 7",key:"ztvudi"}],["path",{d:"M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8",key:"1b2hhj"}],["path",{d:"M15 22v-4a2 2 0 0 0-2-2h-2a2 2 0 0 0-2 2v4",key:"2ebpfo"}],["path",{d:"M2 7h20",key:"1fcdvo"}],["path",{d:"M22 7v3a2 2 0 0 1-2 2a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 16 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 12 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 8 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 4 12a2 2 0 0 1-2-2V7",key:"6c3vgh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lX=U("StretchHorizontal",[["rect",{width:"20",height:"6",x:"2",y:"4",rx:"2",key:"qdearl"}],["rect",{width:"20",height:"6",x:"2",y:"14",rx:"2",key:"1xrn6j"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cX=U("StretchVertical",[["rect",{width:"6",height:"20",x:"4",y:"2",rx:"2",key:"19qu7m"}],["rect",{width:"6",height:"20",x:"14",y:"2",rx:"2",key:"24v0nk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dX=U("Strikethrough",[["path",{d:"M16 4H9a3 3 0 0 0-2.83 4",key:"43sutm"}],["path",{d:"M14 12a4 4 0 0 1 0 8H6",key:"nlfj13"}],["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uX=U("Subscript",[["path",{d:"m4 5 8 8",key:"1eunvl"}],["path",{d:"m12 5-8 8",key:"1ah0jp"}],["path",{d:"M20 19h-4c0-1.5.44-2 1.5-2.5S20 15.33 20 14c0-.47-.17-.93-.48-1.29a2.11 2.11 0 0 0-2.62-.44c-.42.24-.74.62-.9 1.07",key:"e8ta8j"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hX=U("SunDim",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 4h.01",key:"1ujb9j"}],["path",{d:"M20 12h.01",key:"1ykeid"}],["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M4 12h.01",key:"158zrr"}],["path",{d:"M17.657 6.343h.01",key:"31pqzk"}],["path",{d:"M17.657 17.657h.01",key:"jehnf4"}],["path",{d:"M6.343 17.657h.01",key:"gdk6ow"}],["path",{d:"M6.343 6.343h.01",key:"1uurf0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fX=U("SunMedium",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 3v1",key:"1asbbs"}],["path",{d:"M12 20v1",key:"1wcdkc"}],["path",{d:"M3 12h1",key:"lp3yf2"}],["path",{d:"M20 12h1",key:"1vloll"}],["path",{d:"m18.364 5.636-.707.707",key:"1hakh0"}],["path",{d:"m6.343 17.657-.707.707",key:"18m9nf"}],["path",{d:"m5.636 5.636.707.707",key:"1xv1c5"}],["path",{d:"m17.657 17.657.707.707",key:"vl76zb"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pX=U("SunMoon",[["path",{d:"M12 8a2.83 2.83 0 0 0 4 4 4 4 0 1 1-4-4",key:"1fu5g2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.9 4.9 1.4 1.4",key:"b9915j"}],["path",{d:"m17.7 17.7 1.4 1.4",key:"qc3ed3"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.3 17.7-1.4 1.4",key:"5gca6"}],["path",{d:"m19.1 4.9-1.4 1.4",key:"wpu9u6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mX=U("SunSnow",[["path",{d:"M10 9a3 3 0 1 0 0 6",key:"6zmtdl"}],["path",{d:"M2 12h1",key:"1uaihz"}],["path",{d:"M14 21V3",key:"1llu3z"}],["path",{d:"M10 4V3",key:"pkzwkn"}],["path",{d:"M10 21v-1",key:"1u8rkd"}],["path",{d:"m3.64 18.36.7-.7",key:"105rm9"}],["path",{d:"m4.34 6.34-.7-.7",key:"d3unjp"}],["path",{d:"M14 12h8",key:"4f43i9"}],["path",{d:"m17 4-3 3",key:"15jcng"}],["path",{d:"m14 17 3 3",key:"6tlq38"}],["path",{d:"m21 15-3-3 3-3",key:"1nlnje"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const w1=U("Sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gX=U("Sunrise",[["path",{d:"M12 2v8",key:"1q4o3n"}],["path",{d:"m4.93 10.93 1.41 1.41",key:"2a7f42"}],["path",{d:"M2 18h2",key:"j10viu"}],["path",{d:"M20 18h2",key:"wocana"}],["path",{d:"m19.07 10.93-1.41 1.41",key:"15zs5n"}],["path",{d:"M22 22H2",key:"19qnx5"}],["path",{d:"m8 6 4-4 4 4",key:"ybng9g"}],["path",{d:"M16 18a4 4 0 0 0-8 0",key:"1lzouq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xX=U("Sunset",[["path",{d:"M12 10V2",key:"16sf7g"}],["path",{d:"m4.93 10.93 1.41 1.41",key:"2a7f42"}],["path",{d:"M2 18h2",key:"j10viu"}],["path",{d:"M20 18h2",key:"wocana"}],["path",{d:"m19.07 10.93-1.41 1.41",key:"15zs5n"}],["path",{d:"M22 22H2",key:"19qnx5"}],["path",{d:"m16 6-4 4-4-4",key:"6wukr"}],["path",{d:"M16 18a4 4 0 0 0-8 0",key:"1lzouq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yX=U("Superscript",[["path",{d:"m4 19 8-8",key:"hr47gm"}],["path",{d:"m12 19-8-8",key:"1dhhmo"}],["path",{d:"M20 12h-4c0-1.5.442-2 1.5-2.5S20 8.334 20 7.002c0-.472-.17-.93-.484-1.29a2.105 2.105 0 0 0-2.617-.436c-.42.239-.738.614-.899 1.06",key:"1dfcux"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vX=U("SwatchBook",[["path",{d:"M11 17a4 4 0 0 1-8 0V5a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2Z",key:"1ldrpk"}],["path",{d:"M16.7 13H19a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2H7",key:"11i5po"}],["path",{d:"M 7 17h.01",key:"1euzgo"}],["path",{d:"m11 8 2.3-2.3a2.4 2.4 0 0 1 3.404.004L18.6 7.6a2.4 2.4 0 0 1 .026 3.434L9.9 19.8",key:"o2gii7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _X=U("SwissFranc",[["path",{d:"M10 21V3h8",key:"br2l0g"}],["path",{d:"M6 16h9",key:"2py0wn"}],["path",{d:"M10 9.5h7",key:"13dmhz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bX=U("SwitchCamera",[["path",{d:"M11 19H4a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2h5",key:"mtk2lu"}],["path",{d:"M13 5h7a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2h-5",key:"120jsl"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["path",{d:"m18 22-3-3 3-3",key:"kgdoj7"}],["path",{d:"m6 2 3 3-3 3",key:"1fnbkv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wX=U("Sword",[["polyline",{points:"14.5 17.5 3 6 3 3 6 3 17.5 14.5",key:"1hfsw2"}],["line",{x1:"13",x2:"19",y1:"19",y2:"13",key:"1vrmhu"}],["line",{x1:"16",x2:"20",y1:"16",y2:"20",key:"1bron3"}],["line",{x1:"19",x2:"21",y1:"21",y2:"19",key:"13pww6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jX=U("Swords",[["polyline",{points:"14.5 17.5 3 6 3 3 6 3 17.5 14.5",key:"1hfsw2"}],["line",{x1:"13",x2:"19",y1:"19",y2:"13",key:"1vrmhu"}],["line",{x1:"16",x2:"20",y1:"16",y2:"20",key:"1bron3"}],["line",{x1:"19",x2:"21",y1:"21",y2:"19",key:"13pww6"}],["polyline",{points:"14.5 6.5 18 3 21 3 21 6 17.5 9.5",key:"hbey2j"}],["line",{x1:"5",x2:"9",y1:"14",y2:"18",key:"1hf58s"}],["line",{x1:"7",x2:"4",y1:"17",y2:"20",key:"pidxm4"}],["line",{x1:"3",x2:"5",y1:"19",y2:"21",key:"1pehsh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kX=U("Syringe",[["path",{d:"m18 2 4 4",key:"22kx64"}],["path",{d:"m17 7 3-3",key:"1w1zoj"}],["path",{d:"M19 9 8.7 19.3c-1 1-2.5 1-3.4 0l-.6-.6c-1-1-1-2.5 0-3.4L15 5",key:"1exhtz"}],["path",{d:"m9 11 4 4",key:"rovt3i"}],["path",{d:"m5 19-3 3",key:"59f2uf"}],["path",{d:"m14 4 6 6",key:"yqp9t2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ZT=U("Table2",[["path",{d:"M9 3H5a2 2 0 0 0-2 2v4m6-6h10a2 2 0 0 1 2 2v4M9 3v18m0 0h10a2 2 0 0 0 2-2V9M9 21H5a2 2 0 0 1-2-2V9m0 0h18",key:"gugj83"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const NX=U("TableCellsMerge",[["path",{d:"M12 21v-6",key:"lihzve"}],["path",{d:"M12 9V3",key:"da5inc"}],["path",{d:"M3 15h18",key:"5xshup"}],["path",{d:"M3 9h18",key:"1pudct"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const SX=U("TableCellsSplit",[["path",{d:"M12 15V9",key:"8c7uyn"}],["path",{d:"M3 15h18",key:"5xshup"}],["path",{d:"M3 9h18",key:"1pudct"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const CX=U("TableColumnsSplit",[["path",{d:"M14 14v2",key:"w2a1xv"}],["path",{d:"M14 20v2",key:"1lq872"}],["path",{d:"M14 2v2",key:"6buw04"}],["path",{d:"M14 8v2",key:"i67w9a"}],["path",{d:"M2 15h8",key:"82wtch"}],["path",{d:"M2 3h6a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H2",key:"up0l64"}],["path",{d:"M2 9h8",key:"yelfik"}],["path",{d:"M22 15h-4",key:"1es58f"}],["path",{d:"M22 3h-2a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h2",key:"pdjoqf"}],["path",{d:"M22 9h-4",key:"1luja7"}],["path",{d:"M5 3v18",key:"14hmio"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const MX=U("TableOfContents",[["path",{d:"M16 12H3",key:"1a2rj7"}],["path",{d:"M16 18H3",key:"12xzn7"}],["path",{d:"M16 6H3",key:"1wxfjs"}],["path",{d:"M21 12h.01",key:"msek7k"}],["path",{d:"M21 18h.01",key:"1e8rq1"}],["path",{d:"M21 6h.01",key:"1koanj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const TX=U("TableProperties",[["path",{d:"M15 3v18",key:"14nvp0"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M21 9H3",key:"1338ky"}],["path",{d:"M21 15H3",key:"9uk58r"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const AX=U("TableRowsSplit",[["path",{d:"M14 10h2",key:"1lstlu"}],["path",{d:"M15 22v-8",key:"1fwwgm"}],["path",{d:"M15 2v4",key:"1044rn"}],["path",{d:"M2 10h2",key:"1r8dkt"}],["path",{d:"M20 10h2",key:"1ug425"}],["path",{d:"M3 19h18",key:"awlh7x"}],["path",{d:"M3 22v-6a2 2 135 0 1 2-2h14a2 2 45 0 1 2 2v6",key:"ibqhof"}],["path",{d:"M3 2v2a2 2 45 0 0 2 2h14a2 2 135 0 0 2-2V2",key:"1uenja"}],["path",{d:"M8 10h2",key:"66od0"}],["path",{d:"M9 22v-8",key:"fmnu31"}],["path",{d:"M9 2v4",key:"j1yeou"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const EX=U("Table",[["path",{d:"M12 3v18",key:"108xh3"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const IX=U("TabletSmartphone",[["rect",{width:"10",height:"14",x:"3",y:"8",rx:"2",key:"1vrsiq"}],["path",{d:"M5 4a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v16a2 2 0 0 1-2 2h-2.4",key:"1j4zmg"}],["path",{d:"M8 18h.01",key:"lrp35t"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const PX=U("Tablet",[["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",ry:"2",key:"76otgf"}],["line",{x1:"12",x2:"12.01",y1:"18",y2:"18",key:"1dp563"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const LX=U("Tablets",[["circle",{cx:"7",cy:"7",r:"5",key:"x29byf"}],["circle",{cx:"17",cy:"17",r:"5",key:"1op1d2"}],["path",{d:"M12 17h10",key:"ls21zv"}],["path",{d:"m3.46 10.54 7.08-7.08",key:"1rehiu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jg=U("Tag",[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const OX=U("Tags",[["path",{d:"m15 5 6.3 6.3a2.4 2.4 0 0 1 0 3.4L17 19",key:"1cbfv1"}],["path",{d:"M9.586 5.586A2 2 0 0 0 8.172 5H3a1 1 0 0 0-1 1v5.172a2 2 0 0 0 .586 1.414L8.29 18.29a2.426 2.426 0 0 0 3.42 0l3.58-3.58a2.426 2.426 0 0 0 0-3.42z",key:"135mg7"}],["circle",{cx:"6.5",cy:"9.5",r:".5",fill:"currentColor",key:"5pm5xn"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const DX=U("Tally1",[["path",{d:"M4 4v16",key:"6qkkli"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const RX=U("Tally2",[["path",{d:"M4 4v16",key:"6qkkli"}],["path",{d:"M9 4v16",key:"81ygyz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const FX=U("Tally3",[["path",{d:"M4 4v16",key:"6qkkli"}],["path",{d:"M9 4v16",key:"81ygyz"}],["path",{d:"M14 4v16",key:"12vmem"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zX=U("Tally4",[["path",{d:"M4 4v16",key:"6qkkli"}],["path",{d:"M9 4v16",key:"81ygyz"}],["path",{d:"M14 4v16",key:"12vmem"}],["path",{d:"M19 4v16",key:"8ij5ei"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const BX=U("Tally5",[["path",{d:"M4 4v16",key:"6qkkli"}],["path",{d:"M9 4v16",key:"81ygyz"}],["path",{d:"M14 4v16",key:"12vmem"}],["path",{d:"M19 4v16",key:"8ij5ei"}],["path",{d:"M22 6 2 18",key:"h9moai"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $X=U("Tangent",[["circle",{cx:"17",cy:"4",r:"2",key:"y5j2s2"}],["path",{d:"M15.59 5.41 5.41 15.59",key:"l0vprr"}],["circle",{cx:"4",cy:"17",r:"2",key:"9p4efm"}],["path",{d:"M12 22s-4-9-1.5-11.5S22 12 22 12",key:"1twk4o"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Hx=U("Target",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"6",key:"1vlfrh"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const UX=U("Telescope",[["path",{d:"m10.065 12.493-6.18 1.318a.934.934 0 0 1-1.108-.702l-.537-2.15a1.07 1.07 0 0 1 .691-1.265l13.504-4.44",key:"k4qptu"}],["path",{d:"m13.56 11.747 4.332-.924",key:"19l80z"}],["path",{d:"m16 21-3.105-6.21",key:"7oh9d"}],["path",{d:"M16.485 5.94a2 2 0 0 1 1.455-2.425l1.09-.272a1 1 0 0 1 1.212.727l1.515 6.06a1 1 0 0 1-.727 1.213l-1.09.272a2 2 0 0 1-2.425-1.455z",key:"m7xp4m"}],["path",{d:"m6.158 8.633 1.114 4.456",key:"74o979"}],["path",{d:"m8 21 3.105-6.21",key:"1fvxut"}],["circle",{cx:"12",cy:"13",r:"2",key:"1c1ljs"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qX=U("TentTree",[["circle",{cx:"4",cy:"4",r:"2",key:"bt5ra8"}],["path",{d:"m14 5 3-3 3 3",key:"1sorif"}],["path",{d:"m14 10 3-3 3 3",key:"1jyi9h"}],["path",{d:"M17 14V2",key:"8ymqnk"}],["path",{d:"M17 14H7l-5 8h20Z",key:"13ar7p"}],["path",{d:"M8 14v8",key:"1ghmqk"}],["path",{d:"m9 14 5 8",key:"13pgi6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const VX=U("Tent",[["path",{d:"M3.5 21 14 3",key:"1szst5"}],["path",{d:"M20.5 21 10 3",key:"1310c3"}],["path",{d:"M15.5 21 12 15l-3.5 6",key:"1ddtfw"}],["path",{d:"M2 21h20",key:"1nyx9w"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const HX=U("Terminal",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lw=U("TestTubeDiagonal",[["path",{d:"M21 7 6.82 21.18a2.83 2.83 0 0 1-3.99-.01a2.83 2.83 0 0 1 0-4L17 3",key:"1ub6xw"}],["path",{d:"m16 2 6 6",key:"1gw87d"}],["path",{d:"M12 16H4",key:"1cjfip"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const WX=U("TestTube",[["path",{d:"M14.5 2v17.5c0 1.4-1.1 2.5-2.5 2.5c-1.4 0-2.5-1.1-2.5-2.5V2",key:"125lnx"}],["path",{d:"M8.5 2h7",key:"csnxdl"}],["path",{d:"M14.5 16h-5",key:"1ox875"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const GX=U("TestTubes",[["path",{d:"M9 2v17.5A2.5 2.5 0 0 1 6.5 22A2.5 2.5 0 0 1 4 19.5V2",key:"1hjrqt"}],["path",{d:"M20 2v17.5a2.5 2.5 0 0 1-2.5 2.5a2.5 2.5 0 0 1-2.5-2.5V2",key:"16lc8n"}],["path",{d:"M3 2h7",key:"7s29d5"}],["path",{d:"M14 2h7",key:"7sicin"}],["path",{d:"M9 16H4",key:"1bfye3"}],["path",{d:"M20 16h-5",key:"ddnjpe"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const KX=U("TextCursorInput",[["path",{d:"M5 4h1a3 3 0 0 1 3 3 3 3 0 0 1 3-3h1",key:"18xjzo"}],["path",{d:"M13 20h-1a3 3 0 0 1-3-3 3 3 0 0 1-3 3H5",key:"fj48gi"}],["path",{d:"M5 16H4a2 2 0 0 1-2-2v-4a2 2 0 0 1 2-2h1",key:"1n9rhb"}],["path",{d:"M13 8h7a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-7",key:"13ksps"}],["path",{d:"M9 7v10",key:"1vc8ob"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ZX=U("TextCursor",[["path",{d:"M17 22h-1a4 4 0 0 1-4-4V6a4 4 0 0 1 4-4h1",key:"uvaxm9"}],["path",{d:"M7 22h1a4 4 0 0 0 4-4v-1",key:"11xy8d"}],["path",{d:"M7 2h1a4 4 0 0 1 4 4v1",key:"1uw06m"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const YX=U("TextQuote",[["path",{d:"M17 6H3",key:"16j9eg"}],["path",{d:"M21 12H8",key:"scolzb"}],["path",{d:"M21 18H8",key:"1wfozv"}],["path",{d:"M3 12v6",key:"fv4c87"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const XX=U("TextSearch",[["path",{d:"M21 6H3",key:"1jwq7v"}],["path",{d:"M10 12H3",key:"1ulcyk"}],["path",{d:"M10 18H3",key:"13769t"}],["circle",{cx:"17",cy:"15",r:"3",key:"1upz2a"}],["path",{d:"m21 19-1.9-1.9",key:"dwi7p8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cw=U("TextSelect",[["path",{d:"M5 3a2 2 0 0 0-2 2",key:"y57alp"}],["path",{d:"M19 3a2 2 0 0 1 2 2",key:"18rm91"}],["path",{d:"M21 19a2 2 0 0 1-2 2",key:"1j7049"}],["path",{d:"M5 21a2 2 0 0 1-2-2",key:"sbafld"}],["path",{d:"M9 3h1",key:"1yesri"}],["path",{d:"M9 21h1",key:"15o7lz"}],["path",{d:"M14 3h1",key:"1ec4yj"}],["path",{d:"M14 21h1",key:"v9vybs"}],["path",{d:"M3 9v1",key:"1r0deq"}],["path",{d:"M21 9v1",key:"mxsmne"}],["path",{d:"M3 14v1",key:"vnatye"}],["path",{d:"M21 14v1",key:"169vum"}],["line",{x1:"7",x2:"15",y1:"8",y2:"8",key:"1758g8"}],["line",{x1:"7",x2:"17",y1:"12",y2:"12",key:"197423"}],["line",{x1:"7",x2:"13",y1:"16",y2:"16",key:"37cgm6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const QX=U("Text",[["path",{d:"M17 6.1H3",key:"wptmhv"}],["path",{d:"M21 12.1H3",key:"1j38uz"}],["path",{d:"M15.1 18H3",key:"1nb16a"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const JX=U("Theater",[["path",{d:"M2 10s3-3 3-8",key:"3xiif0"}],["path",{d:"M22 10s-3-3-3-8",key:"ioaa5q"}],["path",{d:"M10 2c0 4.4-3.6 8-8 8",key:"16fkpi"}],["path",{d:"M14 2c0 4.4 3.6 8 8 8",key:"b9eulq"}],["path",{d:"M2 10s2 2 2 5",key:"1au1lb"}],["path",{d:"M22 10s-2 2-2 5",key:"qi2y5e"}],["path",{d:"M8 15h8",key:"45n4r"}],["path",{d:"M2 22v-1a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v1",key:"1vsc2m"}],["path",{d:"M14 22v-1a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v1",key:"hrha4u"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const eQ=U("ThermometerSnowflake",[["path",{d:"M2 12h10",key:"19562f"}],["path",{d:"M9 4v16",key:"81ygyz"}],["path",{d:"m3 9 3 3-3 3",key:"1sas0l"}],["path",{d:"M12 6 9 9 6 6",key:"pfrgxu"}],["path",{d:"m6 18 3-3 1.5 1.5",key:"1e277p"}],["path",{d:"M20 4v10.54a4 4 0 1 1-4 0V4a2 2 0 0 1 4 0Z",key:"iof6y5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tQ=U("ThermometerSun",[["path",{d:"M12 9a4 4 0 0 0-2 7.5",key:"1jvsq6"}],["path",{d:"M12 3v2",key:"1w22ol"}],["path",{d:"m6.6 18.4-1.4 1.4",key:"w2yidj"}],["path",{d:"M20 4v10.54a4 4 0 1 1-4 0V4a2 2 0 0 1 4 0Z",key:"iof6y5"}],["path",{d:"M4 13H2",key:"118le4"}],["path",{d:"M6.34 7.34 4.93 5.93",key:"1brd51"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rQ=U("Thermometer",[["path",{d:"M14 4v10.54a4 4 0 1 1-4 0V4a2 2 0 0 1 4 0Z",key:"17jzev"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const YT=U("ThumbsDown",[["path",{d:"M17 14V2",key:"8ymqnk"}],["path",{d:"M9 18.12 10 14H4.17a2 2 0 0 1-1.92-2.56l2.33-8A2 2 0 0 1 6.5 2H20a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-2.76a2 2 0 0 0-1.79 1.11L12 22a3.13 3.13 0 0 1-3-3.88Z",key:"m61m77"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pd=U("ThumbsUp",[["path",{d:"M7 10v12",key:"1qc93n"}],["path",{d:"M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z",key:"emmmcr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nQ=U("TicketCheck",[["path",{d:"M2 9a3 3 0 0 1 0 6v2a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-2a3 3 0 0 1 0-6V7a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2Z",key:"qn84l0"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sQ=U("TicketMinus",[["path",{d:"M2 9a3 3 0 0 1 0 6v2a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-2a3 3 0 0 1 0-6V7a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2Z",key:"qn84l0"}],["path",{d:"M9 12h6",key:"1c52cq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const aQ=U("TicketPercent",[["path",{d:"M2 9a3 3 0 1 1 0 6v2a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-2a3 3 0 1 1 0-6V7a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2Z",key:"1l48ns"}],["path",{d:"M9 9h.01",key:"1q5me6"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"M15 15h.01",key:"lqbp3k"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const iQ=U("TicketPlus",[["path",{d:"M2 9a3 3 0 0 1 0 6v2a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-2a3 3 0 0 1 0-6V7a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2Z",key:"qn84l0"}],["path",{d:"M9 12h6",key:"1c52cq"}],["path",{d:"M12 9v6",key:"199k2o"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oQ=U("TicketSlash",[["path",{d:"M2 9a3 3 0 0 1 0 6v2a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-2a3 3 0 0 1 0-6V7a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2Z",key:"qn84l0"}],["path",{d:"m9.5 14.5 5-5",key:"qviqfa"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lQ=U("TicketX",[["path",{d:"M2 9a3 3 0 0 1 0 6v2a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-2a3 3 0 0 1 0-6V7a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2Z",key:"qn84l0"}],["path",{d:"m9.5 14.5 5-5",key:"qviqfa"}],["path",{d:"m9.5 9.5 5 5",key:"18nt4w"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const XT=U("Ticket",[["path",{d:"M2 9a3 3 0 0 1 0 6v2a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-2a3 3 0 0 1 0-6V7a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2Z",key:"qn84l0"}],["path",{d:"M13 5v2",key:"dyzc3o"}],["path",{d:"M13 17v2",key:"1ont0d"}],["path",{d:"M13 11v2",key:"1wjjxi"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cQ=U("TicketsPlane",[["path",{d:"M10.5 17h1.227a2 2 0 0 0 1.345-.52L18 12",key:"16muxl"}],["path",{d:"m12 13.5 3.75.5",key:"1i9qhk"}],["path",{d:"m4.5 8 10.58-5.06a1 1 0 0 1 1.342.488L18.5 8",key:"12lg5p"}],["path",{d:"M6 10V8",key:"1y41hn"}],["path",{d:"M6 14v1",key:"cao2tf"}],["path",{d:"M6 19v2",key:"1loha6"}],["rect",{x:"2",y:"8",width:"20",height:"13",rx:"2",key:"p3bz5l"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dQ=U("Tickets",[["path",{d:"m4.5 8 10.58-5.06a1 1 0 0 1 1.342.488L18.5 8",key:"12lg5p"}],["path",{d:"M6 10V8",key:"1y41hn"}],["path",{d:"M6 14v1",key:"cao2tf"}],["path",{d:"M6 19v2",key:"1loha6"}],["rect",{x:"2",y:"8",width:"20",height:"13",rx:"2",key:"p3bz5l"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uQ=U("TimerOff",[["path",{d:"M10 2h4",key:"n1abiw"}],["path",{d:"M4.6 11a8 8 0 0 0 1.7 8.7 8 8 0 0 0 8.7 1.7",key:"10he05"}],["path",{d:"M7.4 7.4a8 8 0 0 1 10.3 1 8 8 0 0 1 .9 10.2",key:"15f7sh"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M12 12v-2",key:"fwoke6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hQ=U("TimerReset",[["path",{d:"M10 2h4",key:"n1abiw"}],["path",{d:"M12 14v-4",key:"1evpnu"}],["path",{d:"M4 13a8 8 0 0 1 8-7 8 8 0 1 1-5.3 14L4 17.6",key:"1ts96g"}],["path",{d:"M9 17H4v5",key:"8t5av"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fQ=U("Timer",[["line",{x1:"10",x2:"14",y1:"2",y2:"2",key:"14vaq8"}],["line",{x1:"12",x2:"15",y1:"14",y2:"11",key:"17fdiu"}],["circle",{cx:"12",cy:"14",r:"8",key:"1e1u0o"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pQ=U("ToggleLeft",[["rect",{width:"20",height:"12",x:"2",y:"6",rx:"6",ry:"6",key:"f2vt7d"}],["circle",{cx:"8",cy:"12",r:"2",key:"1nvbw3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mQ=U("ToggleRight",[["rect",{width:"20",height:"12",x:"2",y:"6",rx:"6",ry:"6",key:"f2vt7d"}],["circle",{cx:"16",cy:"12",r:"2",key:"4ma0v8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gQ=U("Toilet",[["path",{d:"M7 12h13a1 1 0 0 1 1 1 5 5 0 0 1-5 5h-.598a.5.5 0 0 0-.424.765l1.544 2.47a.5.5 0 0 1-.424.765H5.402a.5.5 0 0 1-.424-.765L7 18",key:"kc4kqr"}],["path",{d:"M8 18a5 5 0 0 1-5-5V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v8",key:"1tqs57"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xQ=U("Tornado",[["path",{d:"M21 4H3",key:"1hwok0"}],["path",{d:"M18 8H6",key:"41n648"}],["path",{d:"M19 12H9",key:"1g4lpz"}],["path",{d:"M16 16h-6",key:"1j5d54"}],["path",{d:"M11 20H9",key:"39obr8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yQ=U("Torus",[["ellipse",{cx:"12",cy:"11",rx:"3",ry:"2",key:"1b2qxu"}],["ellipse",{cx:"12",cy:"12.5",rx:"10",ry:"8.5",key:"h8emeu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vQ=U("TouchpadOff",[["path",{d:"M4 4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h16",key:"lnt0bk"}],["path",{d:"M2 14h12",key:"d8icqz"}],["path",{d:"M22 14h-2",key:"jrx26d"}],["path",{d:"M12 20v-6",key:"1rm09r"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M22 16V6a2 2 0 0 0-2-2H10",key:"11y8e4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _Q=U("Touchpad",[["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["path",{d:"M2 14h20",key:"myj16y"}],["path",{d:"M12 20v-6",key:"1rm09r"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bQ=U("TowerControl",[["path",{d:"M18.2 12.27 20 6H4l1.8 6.27a1 1 0 0 0 .95.73h10.5a1 1 0 0 0 .96-.73Z",key:"1pledb"}],["path",{d:"M8 13v9",key:"hmv0ci"}],["path",{d:"M16 22v-9",key:"ylnf1u"}],["path",{d:"m9 6 1 7",key:"dpdgam"}],["path",{d:"m15 6-1 7",key:"ls7zgu"}],["path",{d:"M12 6V2",key:"1pj48d"}],["path",{d:"M13 2h-2",key:"mj6ths"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wQ=U("ToyBrick",[["rect",{width:"18",height:"12",x:"3",y:"8",rx:"1",key:"158fvp"}],["path",{d:"M10 8V5c0-.6-.4-1-1-1H6a1 1 0 0 0-1 1v3",key:"s0042v"}],["path",{d:"M19 8V5c0-.6-.4-1-1-1h-3a1 1 0 0 0-1 1v3",key:"9wmeh2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jQ=U("Tractor",[["path",{d:"m10 11 11 .9a1 1 0 0 1 .8 1.1l-.665 4.158a1 1 0 0 1-.988.842H20",key:"she1j9"}],["path",{d:"M16 18h-5",key:"bq60fd"}],["path",{d:"M18 5a1 1 0 0 0-1 1v5.573",key:"1kv8ia"}],["path",{d:"M3 4h8.129a1 1 0 0 1 .99.863L13 11.246",key:"1q1ert"}],["path",{d:"M4 11V4",key:"9ft8pt"}],["path",{d:"M7 15h.01",key:"k5ht0j"}],["path",{d:"M8 10.1V4",key:"1jgyzo"}],["circle",{cx:"18",cy:"18",r:"2",key:"1emm8v"}],["circle",{cx:"7",cy:"15",r:"5",key:"ddtuc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kQ=U("TrafficCone",[["path",{d:"M9.3 6.2a4.55 4.55 0 0 0 5.4 0",key:"flyxqv"}],["path",{d:"M7.9 10.7c.9.8 2.4 1.3 4.1 1.3s3.2-.5 4.1-1.3",key:"1nlxxg"}],["path",{d:"M13.9 3.5a1.93 1.93 0 0 0-3.8-.1l-3 10c-.1.2-.1.4-.1.6 0 1.7 2.2 3 5 3s5-1.3 5-3c0-.2 0-.4-.1-.5Z",key:"vz7x1l"}],["path",{d:"m7.5 12.2-4.7 2.7c-.5.3-.8.7-.8 1.1s.3.8.8 1.1l7.6 4.5c.9.5 2.1.5 3 0l7.6-4.5c.7-.3 1-.7 1-1.1s-.3-.8-.8-1.1l-4.7-2.8",key:"1xfzlw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const NQ=U("TrainFrontTunnel",[["path",{d:"M2 22V12a10 10 0 1 1 20 0v10",key:"o0fyp0"}],["path",{d:"M15 6.8v1.4a3 2.8 0 1 1-6 0V6.8",key:"m8q3n9"}],["path",{d:"M10 15h.01",key:"44in9x"}],["path",{d:"M14 15h.01",key:"5mohn5"}],["path",{d:"M10 19a4 4 0 0 1-4-4v-3a6 6 0 1 1 12 0v3a4 4 0 0 1-4 4Z",key:"hckbmu"}],["path",{d:"m9 19-2 3",key:"iij7hm"}],["path",{d:"m15 19 2 3",key:"npx8sa"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const SQ=U("TrainFront",[["path",{d:"M8 3.1V7a4 4 0 0 0 8 0V3.1",key:"1v71zp"}],["path",{d:"m9 15-1-1",key:"1yrq24"}],["path",{d:"m15 15 1-1",key:"1t0d6s"}],["path",{d:"M9 19c-2.8 0-5-2.2-5-5v-4a8 8 0 0 1 16 0v4c0 2.8-2.2 5-5 5Z",key:"1p0hjs"}],["path",{d:"m8 19-2 3",key:"13i0xs"}],["path",{d:"m16 19 2 3",key:"xo31yx"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const CQ=U("TrainTrack",[["path",{d:"M2 17 17 2",key:"18b09t"}],["path",{d:"m2 14 8 8",key:"1gv9hu"}],["path",{d:"m5 11 8 8",key:"189pqp"}],["path",{d:"m8 8 8 8",key:"1imecy"}],["path",{d:"m11 5 8 8",key:"ummqn6"}],["path",{d:"m14 2 8 8",key:"1vk7dn"}],["path",{d:"M7 22 22 7",key:"15mb1i"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dw=U("TramFront",[["rect",{width:"16",height:"16",x:"4",y:"3",rx:"2",key:"1wxw4b"}],["path",{d:"M4 11h16",key:"mpoxn0"}],["path",{d:"M12 3v8",key:"1h2ygw"}],["path",{d:"m8 19-2 3",key:"13i0xs"}],["path",{d:"m18 22-2-3",key:"1p0ohu"}],["path",{d:"M8 15h.01",key:"a7atzg"}],["path",{d:"M16 15h.01",key:"rnfrdf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Vn=U("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const MQ=U("Trash",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const TQ=U("TreeDeciduous",[["path",{d:"M8 19a4 4 0 0 1-2.24-7.32A3.5 3.5 0 0 1 9 6.03V6a3 3 0 1 1 6 0v.04a3.5 3.5 0 0 1 3.24 5.65A4 4 0 0 1 16 19Z",key:"oadzkq"}],["path",{d:"M12 19v3",key:"npa21l"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uw=U("TreePalm",[["path",{d:"M13 8c0-2.76-2.46-5-5.5-5S2 5.24 2 8h2l1-1 1 1h4",key:"foxbe7"}],["path",{d:"M13 7.14A5.82 5.82 0 0 1 16.5 6c3.04 0 5.5 2.24 5.5 5h-3l-1-1-1 1h-3",key:"18arnh"}],["path",{d:"M5.89 9.71c-2.15 2.15-2.3 5.47-.35 7.43l4.24-4.25.7-.7.71-.71 2.12-2.12c-1.95-1.96-5.27-1.8-7.42.35",key:"ywahnh"}],["path",{d:"M11 15.5c.5 2.5-.17 4.5-1 6.5h4c2-5.5-.5-12-1-14",key:"ft0feo"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const j1=U("TreePine",[["path",{d:"m17 14 3 3.3a1 1 0 0 1-.7 1.7H4.7a1 1 0 0 1-.7-1.7L7 14h-.3a1 1 0 0 1-.7-1.7L9 9h-.2A1 1 0 0 1 8 7.3L12 3l4 4.3a1 1 0 0 1-.8 1.7H15l3 3.3a1 1 0 0 1-.7 1.7H17Z",key:"cpyugq"}],["path",{d:"M12 22v-3",key:"kmzjlo"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const AQ=U("Trees",[["path",{d:"M10 10v.2A3 3 0 0 1 8.9 16H5a3 3 0 0 1-1-5.8V10a3 3 0 0 1 6 0Z",key:"1l6gj6"}],["path",{d:"M7 16v6",key:"1a82de"}],["path",{d:"M13 19v3",key:"13sx9i"}],["path",{d:"M12 19h8.3a1 1 0 0 0 .7-1.7L18 14h.3a1 1 0 0 0 .7-1.7L16 9h.2a1 1 0 0 0 .8-1.7L13 3l-1.4 1.5",key:"1sj9kv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const EQ=U("Trello",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["rect",{width:"3",height:"9",x:"7",y:"7",key:"14n3xi"}],["rect",{width:"3",height:"5",x:"14",y:"7",key:"s4azjd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bj=U("TrendingDown",[["polyline",{points:"22 17 13.5 8.5 8.5 13.5 2 7",key:"1r2t7k"}],["polyline",{points:"16 17 22 17 22 11",key:"11uiuu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const IQ=U("TrendingUpDown",[["path",{d:"M14.828 14.828 21 21",key:"ar5fw7"}],["path",{d:"M21 16v5h-5",key:"1ck2sf"}],["path",{d:"m21 3-9 9-4-4-6 6",key:"1h02xo"}],["path",{d:"M21 8V3h-5",key:"1qoq8a"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Xf=U("TrendingUp",[["polyline",{points:"22 7 13.5 15.5 8.5 10.5 2 17",key:"126l90"}],["polyline",{points:"16 7 22 7 22 13",key:"kwv8wd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Vh=U("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const PQ=U("TriangleRight",[["path",{d:"M22 18a2 2 0 0 1-2 2H3c-1.1 0-1.3-.6-.4-1.3L20.4 4.3c.9-.7 1.6-.4 1.6.7Z",key:"183wce"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const LQ=U("Triangle",[["path",{d:"M13.73 4a2 2 0 0 0-3.46 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z",key:"14u9p9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Zi=U("Trophy",[["path",{d:"M6 9H4.5a2.5 2.5 0 0 1 0-5H6",key:"17hqa7"}],["path",{d:"M18 9h1.5a2.5 2.5 0 0 0 0-5H18",key:"lmptdp"}],["path",{d:"M4 22h16",key:"57wxv0"}],["path",{d:"M10 14.66V17c0 .55-.47.98-.97 1.21C7.85 18.75 7 20.24 7 22",key:"1nw9bq"}],["path",{d:"M14 14.66V17c0 .55.47.98.97 1.21C16.15 18.75 17 20.24 17 22",key:"1np0yb"}],["path",{d:"M18 2H6v7a6 6 0 0 0 12 0V2Z",key:"u46fv3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const QT=U("Truck",[["path",{d:"M14 18V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v11a1 1 0 0 0 1 1h2",key:"wrbu53"}],["path",{d:"M15 18H9",key:"1lyqi6"}],["path",{d:"M19 18h2a1 1 0 0 0 1-1v-3.65a1 1 0 0 0-.22-.624l-3.48-4.35A1 1 0 0 0 17.52 8H14",key:"lysw3i"}],["circle",{cx:"17",cy:"18",r:"2",key:"332jqn"}],["circle",{cx:"7",cy:"18",r:"2",key:"19iecd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const OQ=U("Turtle",[["path",{d:"m12 10 2 4v3a1 1 0 0 0 1 1h2a1 1 0 0 0 1-1v-3a8 8 0 1 0-16 0v3a1 1 0 0 0 1 1h2a1 1 0 0 0 1-1v-3l2-4h4Z",key:"1lbbv7"}],["path",{d:"M4.82 7.9 8 10",key:"m9wose"}],["path",{d:"M15.18 7.9 12 10",key:"p8dp2u"}],["path",{d:"M16.93 10H20a2 2 0 0 1 0 4H2",key:"12nsm7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const DQ=U("TvMinimalPlay",[["path",{d:"M10 7.75a.75.75 0 0 1 1.142-.638l3.664 2.249a.75.75 0 0 1 0 1.278l-3.664 2.25a.75.75 0 0 1-1.142-.64z",key:"1pctta"}],["path",{d:"M7 21h10",key:"1b0cd5"}],["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hw=U("TvMinimal",[["path",{d:"M7 21h10",key:"1b0cd5"}],["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const RQ=U("Tv",[["rect",{width:"20",height:"15",x:"2",y:"7",rx:"2",ry:"2",key:"10ag99"}],["polyline",{points:"17 2 12 7 7 2",key:"11pgbg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const FQ=U("Twitch",[["path",{d:"M21 2H3v16h5v4l4-4h5l4-4V2zm-10 9V7m5 4V7",key:"c0yzno"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zQ=U("Twitter",[["path",{d:"M22 4s-.7 2.1-2 3.4c1.6 10-9.4 17.3-18 11.6 2.2.1 4.4-.6 6-2C3 15.5.5 9.6 3 5c2.2 2.6 5.6 4.1 9 4-.9-4.2 4-6.6 7-3.8 1.1 0 3-1.2 3-1.2z",key:"pff0z6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const BQ=U("TypeOutline",[["path",{d:"M14 16.5a.5.5 0 0 0 .5.5h.5a2 2 0 0 1 0 4H9a2 2 0 0 1 0-4h.5a.5.5 0 0 0 .5-.5v-9a.5.5 0 0 0-.5-.5h-3a.5.5 0 0 0-.5.5V8a2 2 0 0 1-4 0V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v3a2 2 0 0 1-4 0v-.5a.5.5 0 0 0-.5-.5h-3a.5.5 0 0 0-.5.5Z",key:"1reda3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $Q=U("Type",[["polyline",{points:"4 7 4 4 20 4 20 7",key:"1nosan"}],["line",{x1:"9",x2:"15",y1:"20",y2:"20",key:"swin9y"}],["line",{x1:"12",x2:"12",y1:"4",y2:"20",key:"1tx1rr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const UQ=U("UmbrellaOff",[["path",{d:"M12 2v1",key:"11qlp1"}],["path",{d:"M15.5 21a1.85 1.85 0 0 1-3.5-1v-8H2a10 10 0 0 1 3.428-6.575",key:"eki10q"}],["path",{d:"M17.5 12H22A10 10 0 0 0 9.004 3.455",key:"n2ayka"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qQ=U("Umbrella",[["path",{d:"M22 12a10.06 10.06 1 0 0-20 0Z",key:"1teyop"}],["path",{d:"M12 12v8a2 2 0 0 0 4 0",key:"ulpmoc"}],["path",{d:"M12 2v1",key:"11qlp1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const VQ=U("Underline",[["path",{d:"M6 4v6a6 6 0 0 0 12 0V4",key:"9kb039"}],["line",{x1:"4",x2:"20",y1:"20",y2:"20",key:"nun2al"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const HQ=U("Undo2",[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const WQ=U("UndoDot",[["path",{d:"M21 17a9 9 0 0 0-15-6.7L3 13",key:"8mp6z9"}],["path",{d:"M3 7v6h6",key:"1v2h90"}],["circle",{cx:"12",cy:"17",r:"1",key:"1ixnty"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mS=U("Undo",[["path",{d:"M3 7v6h6",key:"1v2h90"}],["path",{d:"M21 17a9 9 0 0 0-9-9 9 9 0 0 0-6 2.3L3 13",key:"1r6uu6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const GQ=U("UnfoldHorizontal",[["path",{d:"M16 12h6",key:"15xry1"}],["path",{d:"M8 12H2",key:"1jqql6"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 8v2",key:"1woqiv"}],["path",{d:"M12 14v2",key:"8jcxud"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m19 15 3-3-3-3",key:"wjy7rq"}],["path",{d:"m5 9-3 3 3 3",key:"j64kie"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const KQ=U("UnfoldVertical",[["path",{d:"M12 22v-6",key:"6o8u61"}],["path",{d:"M12 8V2",key:"1wkif3"}],["path",{d:"M4 12H2",key:"rhcxmi"}],["path",{d:"M10 12H8",key:"s88cx1"}],["path",{d:"M16 12h-2",key:"10asgb"}],["path",{d:"M22 12h-2",key:"14jgyd"}],["path",{d:"m15 19-3 3-3-3",key:"11eu04"}],["path",{d:"m15 5-3-3-3 3",key:"itvq4r"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ZQ=U("Ungroup",[["rect",{width:"8",height:"6",x:"5",y:"4",rx:"1",key:"nzclkv"}],["rect",{width:"8",height:"6",x:"11",y:"14",rx:"1",key:"4tytwb"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fw=U("University",[["circle",{cx:"12",cy:"10",r:"1",key:"1gnqs8"}],["path",{d:"M22 20V8h-4l-6-4-6 4H2v12a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2",key:"1qj5sn"}],["path",{d:"M6 17v.01",key:"roodi6"}],["path",{d:"M6 13v.01",key:"67c122"}],["path",{d:"M18 17v.01",key:"12ktxm"}],["path",{d:"M18 13v.01",key:"tn1rt1"}],["path",{d:"M14 22v-5a2 2 0 0 0-2-2a2 2 0 0 0-2 2v5",key:"11g7fi"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const YQ=U("Unlink2",[["path",{d:"M15 7h2a5 5 0 0 1 0 10h-2m-6 0H7A5 5 0 0 1 7 7h2",key:"1re2ne"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const JT=U("Unlink",[["path",{d:"m18.84 12.25 1.72-1.71h-.02a5.004 5.004 0 0 0-.12-7.07 5.006 5.006 0 0 0-6.95 0l-1.72 1.71",key:"yqzxt4"}],["path",{d:"m5.17 11.75-1.71 1.71a5.004 5.004 0 0 0 .12 7.07 5.006 5.006 0 0 0 6.95 0l1.71-1.71",key:"4qinb0"}],["line",{x1:"8",x2:"8",y1:"2",y2:"5",key:"1041cp"}],["line",{x1:"2",x2:"5",y1:"8",y2:"8",key:"14m1p5"}],["line",{x1:"16",x2:"16",y1:"19",y2:"22",key:"rzdirn"}],["line",{x1:"19",x2:"22",y1:"16",y2:"16",key:"ox905f"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const XQ=U("Unplug",[["path",{d:"m19 5 3-3",key:"yk6iyv"}],["path",{d:"m2 22 3-3",key:"19mgm9"}],["path",{d:"M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z",key:"goz73y"}],["path",{d:"M7.5 13.5 10 11",key:"7xgeeb"}],["path",{d:"M10.5 16.5 13 14",key:"10btkg"}],["path",{d:"m12 6 6 6 2.3-2.3a2.4 2.4 0 0 0 0-3.4l-2.6-2.6a2.4 2.4 0 0 0-3.4 0Z",key:"1snsnr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uo=U("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const QQ=U("Usb",[["circle",{cx:"10",cy:"7",r:"1",key:"dypaad"}],["circle",{cx:"4",cy:"20",r:"1",key:"22iqad"}],["path",{d:"M4.7 19.3 19 5",key:"1enqfc"}],["path",{d:"m21 3-3 1 2 2Z",key:"d3ov82"}],["path",{d:"M9.26 7.68 5 12l2 5",key:"1esawj"}],["path",{d:"m10 14 5 2 3.5-3.5",key:"v8oal5"}],["path",{d:"m18 12 1-1 1 1-1 1Z",key:"1bh22v"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wj=U("UserCheck",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["polyline",{points:"16 11 18 13 22 9",key:"1pwet4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const eA=U("UserCog",[["circle",{cx:"18",cy:"15",r:"3",key:"gjjjvw"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M10 15H6a4 4 0 0 0-4 4v2",key:"1nfge6"}],["path",{d:"m21.7 16.4-.9-.3",key:"12j9ji"}],["path",{d:"m15.2 13.9-.9-.3",key:"1fdjdi"}],["path",{d:"m16.6 18.7.3-.9",key:"heedtr"}],["path",{d:"m19.1 12.2.3-.9",key:"1af3ki"}],["path",{d:"m19.6 18.7-.4-1",key:"1x9vze"}],["path",{d:"m16.8 12.3-.4-1",key:"vqeiwj"}],["path",{d:"m14.3 16.6 1-.4",key:"1qlj63"}],["path",{d:"m20.7 13.8 1-.4",key:"1v5t8k"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const JQ=U("UserMinus",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const eJ=U("UserPen",[["path",{d:"M11.5 15H7a4 4 0 0 0-4 4v2",key:"15lzij"}],["path",{d:"M21.378 16.626a1 1 0 0 0-3.004-3.004l-4.01 4.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z",key:"1817ys"}],["circle",{cx:"10",cy:"7",r:"4",key:"e45bow"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nf=U("UserPlus",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pw=U("UserRoundCheck",[["path",{d:"M2 21a8 8 0 0 1 13.292-6",key:"bjp14o"}],["circle",{cx:"10",cy:"8",r:"5",key:"o932ke"}],["path",{d:"m16 19 2 2 4-4",key:"1b14m6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mw=U("UserRoundCog",[["path",{d:"M2 21a8 8 0 0 1 10.434-7.62",key:"1yezr2"}],["circle",{cx:"10",cy:"8",r:"5",key:"o932ke"}],["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["path",{d:"m19.5 14.3-.4.9",key:"1eb35c"}],["path",{d:"m16.9 20.8-.4.9",key:"dfjc4z"}],["path",{d:"m21.7 19.5-.9-.4",key:"q4dx6b"}],["path",{d:"m15.2 16.9-.9-.4",key:"1r0w5f"}],["path",{d:"m21.7 16.5-.9.4",key:"1knoei"}],["path",{d:"m15.2 19.1-.9.4",key:"j188fs"}],["path",{d:"m19.5 21.7-.4-.9",key:"1tonu5"}],["path",{d:"m16.9 15.2-.4-.9",key:"699xu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gw=U("UserRoundMinus",[["path",{d:"M2 21a8 8 0 0 1 13.292-6",key:"bjp14o"}],["circle",{cx:"10",cy:"8",r:"5",key:"o932ke"}],["path",{d:"M22 19h-6",key:"vcuq98"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tJ=U("UserRoundPen",[["path",{d:"M2 21a8 8 0 0 1 10.821-7.487",key:"1c8h7z"}],["path",{d:"M21.378 16.626a1 1 0 0 0-3.004-3.004l-4.01 4.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z",key:"1817ys"}],["circle",{cx:"10",cy:"8",r:"5",key:"o932ke"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xw=U("UserRoundPlus",[["path",{d:"M2 21a8 8 0 0 1 13.292-6",key:"bjp14o"}],["circle",{cx:"10",cy:"8",r:"5",key:"o932ke"}],["path",{d:"M19 16v6",key:"tddt3s"}],["path",{d:"M22 19h-6",key:"vcuq98"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rJ=U("UserRoundSearch",[["circle",{cx:"10",cy:"8",r:"5",key:"o932ke"}],["path",{d:"M2 21a8 8 0 0 1 10.434-7.62",key:"1yezr2"}],["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["path",{d:"m22 22-1.9-1.9",key:"1e5ubv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yw=U("UserRoundX",[["path",{d:"M2 21a8 8 0 0 1 11.873-7",key:"74fkxq"}],["circle",{cx:"10",cy:"8",r:"5",key:"o932ke"}],["path",{d:"m17 17 5 5",key:"p7ous7"}],["path",{d:"m22 17-5 5",key:"gqnmv0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vw=U("UserRound",[["circle",{cx:"12",cy:"8",r:"5",key:"1hypcn"}],["path",{d:"M20 21a8 8 0 0 0-16 0",key:"rfgkzh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nJ=U("UserSearch",[["circle",{cx:"10",cy:"7",r:"4",key:"e45bow"}],["path",{d:"M10.3 15H7a4 4 0 0 0-4 4v2",key:"3bnktk"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["path",{d:"m21 21-1.9-1.9",key:"1g2n9r"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sJ=U("UserX",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"17",x2:"22",y1:"8",y2:"13",key:"3nzzx3"}],["line",{x1:"22",x2:"17",y1:"8",y2:"13",key:"1swrse"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ec=U("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _w=U("UsersRound",[["path",{d:"M18 21a8 8 0 0 0-16 0",key:"3ypg7q"}],["circle",{cx:"10",cy:"8",r:"5",key:"o932ke"}],["path",{d:"M22 20c0-3.37-2-6.5-4-8a5 5 0 0 0-.45-8.3",key:"10s06x"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Bn=U("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bw=U("UtensilsCrossed",[["path",{d:"m16 2-2.3 2.3a3 3 0 0 0 0 4.2l1.8 1.8a3 3 0 0 0 4.2 0L22 8",key:"n7qcjb"}],["path",{d:"M15 15 3.3 3.3a4.2 4.2 0 0 0 0 6l7.3 7.3c.7.7 2 .7 2.8 0L15 15Zm0 0 7 7",key:"d0u48b"}],["path",{d:"m2.1 21.8 6.4-6.3",key:"yn04lh"}],["path",{d:"m19 5-7 7",key:"194lzd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ww=U("Utensils",[["path",{d:"M3 2v7c0 1.1.9 2 2 2h4a2 2 0 0 0 2-2V2",key:"cjf0a3"}],["path",{d:"M7 2v20",key:"1473qp"}],["path",{d:"M21 15V2a5 5 0 0 0-5 5v6c0 1.1.9 2 2 2h3Zm0 0v7",key:"j28e5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const aJ=U("UtilityPole",[["path",{d:"M12 2v20",key:"t6zp3m"}],["path",{d:"M2 5h20",key:"1fs1ex"}],["path",{d:"M3 3v2",key:"9imdir"}],["path",{d:"M7 3v2",key:"n0os7"}],["path",{d:"M17 3v2",key:"1l2re6"}],["path",{d:"M21 3v2",key:"1duuac"}],["path",{d:"m19 5-7 7-7-7",key:"133zxf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tA=U("Variable",[["path",{d:"M8 21s-4-3-4-9 4-9 4-9",key:"uto9ud"}],["path",{d:"M16 3s4 3 4 9-4 9-4 9",key:"4w2vsq"}],["line",{x1:"15",x2:"9",y1:"9",y2:"15",key:"f7djnv"}],["line",{x1:"9",x2:"15",y1:"9",y2:"15",key:"1shsy8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const iJ=U("Vault",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}],["path",{d:"m7.9 7.9 2.7 2.7",key:"hpeyl3"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}],["path",{d:"m13.4 10.6 2.7-2.7",key:"264c1n"}],["circle",{cx:"7.5",cy:"16.5",r:".5",fill:"currentColor",key:"nkw3mc"}],["path",{d:"m7.9 16.1 2.7-2.7",key:"p81g5e"}],["circle",{cx:"16.5",cy:"16.5",r:".5",fill:"currentColor",key:"fubopw"}],["path",{d:"m13.4 13.4 2.7 2.7",key:"abhel3"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oJ=U("Vegan",[["path",{d:"M16 8q6 0 6-6-6 0-6 6",key:"qsyyc4"}],["path",{d:"M17.41 3.59a10 10 0 1 0 3 3",key:"41m9h7"}],["path",{d:"M2 2a26.6 26.6 0 0 1 10 20c.9-6.82 1.5-9.5 4-14",key:"qiv7li"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lJ=U("VenetianMask",[["path",{d:"M18 11c-1.5 0-2.5.5-3 2",key:"1fod00"}],["path",{d:"M4 6a2 2 0 0 0-2 2v4a5 5 0 0 0 5 5 8 8 0 0 1 5 2 8 8 0 0 1 5-2 5 5 0 0 0 5-5V8a2 2 0 0 0-2-2h-3a8 8 0 0 0-5 2 8 8 0 0 0-5-2z",key:"d70hit"}],["path",{d:"M6 11c1.5 0 2.5.5 3 2",key:"136fht"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cJ=U("VibrateOff",[["path",{d:"m2 8 2 2-2 2 2 2-2 2",key:"sv1b1"}],["path",{d:"m22 8-2 2 2 2-2 2 2 2",key:"101i4y"}],["path",{d:"M8 8v10c0 .55.45 1 1 1h6c.55 0 1-.45 1-1v-2",key:"1hbad5"}],["path",{d:"M16 10.34V6c0-.55-.45-1-1-1h-4.34",key:"1x5tf0"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dJ=U("Vibrate",[["path",{d:"m2 8 2 2-2 2 2 2-2 2",key:"sv1b1"}],["path",{d:"m22 8-2 2 2 2-2 2 2 2",key:"101i4y"}],["rect",{width:"8",height:"14",x:"8",y:"5",rx:"1",key:"1oyrl4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uJ=U("VideoOff",[["path",{d:"M10.66 6H14a2 2 0 0 1 2 2v2.5l5.248-3.062A.5.5 0 0 1 22 7.87v8.196",key:"w8jjjt"}],["path",{d:"M16 16a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h2",key:"1xawa7"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Pa=U("Video",[["path",{d:"m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5",key:"ftymec"}],["rect",{x:"2",y:"6",width:"14",height:"12",rx:"2",key:"158x01"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hJ=U("Videotape",[["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["path",{d:"M2 8h20",key:"d11cs7"}],["circle",{cx:"8",cy:"14",r:"2",key:"1k2qr5"}],["path",{d:"M8 12h8",key:"1wcyev"}],["circle",{cx:"16",cy:"14",r:"2",key:"14k7lr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fJ=U("View",[["path",{d:"M21 17v2a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-2",key:"mrq65r"}],["path",{d:"M21 7V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v2",key:"be3xqs"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["path",{d:"M18.944 12.33a1 1 0 0 0 0-.66 7.5 7.5 0 0 0-13.888 0 1 1 0 0 0 0 .66 7.5 7.5 0 0 0 13.888 0",key:"11ak4c"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pJ=U("Voicemail",[["circle",{cx:"6",cy:"12",r:"4",key:"1ehtga"}],["circle",{cx:"18",cy:"12",r:"4",key:"4vafl8"}],["line",{x1:"6",x2:"18",y1:"16",y2:"16",key:"pmt8us"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mJ=U("Volleyball",[["path",{d:"M11.1 7.1a16.55 16.55 0 0 1 10.9 4",key:"2880wi"}],["path",{d:"M12 12a12.6 12.6 0 0 1-8.7 5",key:"113sja"}],["path",{d:"M16.8 13.6a16.55 16.55 0 0 1-9 7.5",key:"1qmsgl"}],["path",{d:"M20.7 17a12.8 12.8 0 0 0-8.7-5 13.3 13.3 0 0 1 0-10",key:"1bmeqp"}],["path",{d:"M6.3 3.8a16.55 16.55 0 0 0 1.9 11.5",key:"iekzv9"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gJ=U("Volume1",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xJ=U("Volume2",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yJ=U("VolumeOff",[["path",{d:"M16 9a5 5 0 0 1 .95 2.293",key:"1fgyg8"}],["path",{d:"M19.364 5.636a9 9 0 0 1 1.889 9.96",key:"l3zxae"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"m7 7-.587.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298V11",key:"1gbwow"}],["path",{d:"M9.828 4.172A.686.686 0 0 1 11 4.657v.686",key:"s2je0y"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vJ=U("VolumeX",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["line",{x1:"22",x2:"16",y1:"9",y2:"15",key:"1ewh16"}],["line",{x1:"16",x2:"22",y1:"9",y2:"15",key:"5ykzw1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _J=U("Volume",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bJ=U("Vote",[["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}],["path",{d:"M5 7c0-1.1.9-2 2-2h10a2 2 0 0 1 2 2v12H5V7Z",key:"1ezoue"}],["path",{d:"M22 19H2",key:"nuriw5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wJ=U("WalletCards",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2",key:"4125el"}],["path",{d:"M3 11h3c.8 0 1.6.3 2.1.9l1.1.9c1.6 1.6 4.1 1.6 5.7 0l1.1-.9c.5-.5 1.3-.9 2.1-.9H21",key:"1dpki6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jw=U("WalletMinimal",[["path",{d:"M17 14h.01",key:"7oqj8z"}],["path",{d:"M7 7h12a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14",key:"u1rqew"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jJ=U("Wallet",[["path",{d:"M19 7V4a1 1 0 0 0-1-1H5a2 2 0 0 0 0 4h15a1 1 0 0 1 1 1v4h-3a2 2 0 0 0 0 4h3a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1",key:"18etb6"}],["path",{d:"M3 5v14a2 2 0 0 0 2 2h15a1 1 0 0 0 1-1v-4",key:"xoc0q4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kJ=U("Wallpaper",[["circle",{cx:"8",cy:"9",r:"2",key:"gjzl9d"}],["path",{d:"m9 17 6.1-6.1a2 2 0 0 1 2.81.01L22 15V5a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2",key:"69xh40"}],["path",{d:"M8 21h8",key:"1ev6f3"}],["path",{d:"M12 17v4",key:"1riwvh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kw=U("WandSparkles",[["path",{d:"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72",key:"ul74o6"}],["path",{d:"m14 7 3 3",key:"1r5n42"}],["path",{d:"M5 6v4",key:"ilb8ba"}],["path",{d:"M19 14v4",key:"blhpug"}],["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M7 8H3",key:"zfb6yr"}],["path",{d:"M21 16h-4",key:"1cnmox"}],["path",{d:"M11 3H9",key:"1obp7u"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const NJ=U("Wand",[["path",{d:"M15 4V2",key:"z1p9b7"}],["path",{d:"M15 16v-2",key:"px0unx"}],["path",{d:"M8 9h2",key:"1g203m"}],["path",{d:"M20 9h2",key:"19tzq7"}],["path",{d:"M17.8 11.8 19 13",key:"yihg8r"}],["path",{d:"M15 9h.01",key:"x1ddxp"}],["path",{d:"M17.8 6.2 19 5",key:"fd4us0"}],["path",{d:"m3 21 9-9",key:"1jfql5"}],["path",{d:"M12.2 6.2 11 5",key:"i3da3b"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const SJ=U("Warehouse",[["path",{d:"M22 8.35V20a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V8.35A2 2 0 0 1 3.26 6.5l8-3.2a2 2 0 0 1 1.48 0l8 3.2A2 2 0 0 1 22 8.35Z",key:"gksnxg"}],["path",{d:"M6 18h12",key:"9pbo8z"}],["path",{d:"M6 14h12",key:"4cwo0f"}],["rect",{width:"12",height:"12",x:"6",y:"10",key:"apd30q"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const CJ=U("WashingMachine",[["path",{d:"M3 6h3",key:"155dbl"}],["path",{d:"M17 6h.01",key:"e2y6kg"}],["rect",{width:"18",height:"20",x:"3",y:"2",rx:"2",key:"od3kk9"}],["circle",{cx:"12",cy:"13",r:"5",key:"nlbqau"}],["path",{d:"M12 18a2.5 2.5 0 0 0 0-5 2.5 2.5 0 0 1 0-5",key:"17lach"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const MJ=U("Watch",[["circle",{cx:"12",cy:"12",r:"6",key:"1vlfrh"}],["polyline",{points:"12 10 12 12 13 13",key:"19dquz"}],["path",{d:"m16.13 7.66-.81-4.05a2 2 0 0 0-2-1.61h-2.68a2 2 0 0 0-2 1.61l-.78 4.05",key:"18k57s"}],["path",{d:"m7.88 16.36.8 4a2 2 0 0 0 2 1.61h2.72a2 2 0 0 0 2-1.61l.81-4.05",key:"16ny36"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const TJ=U("Waves",[["path",{d:"M2 6c.6.5 1.2 1 2.5 1C7 7 7 5 9.5 5c2.6 0 2.4 2 5 2 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1",key:"knzxuh"}],["path",{d:"M2 12c.6.5 1.2 1 2.5 1 2.5 0 2.5-2 5-2 2.6 0 2.4 2 5 2 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1",key:"2jd2cc"}],["path",{d:"M2 18c.6.5 1.2 1 2.5 1 2.5 0 2.5-2 5-2 2.6 0 2.4 2 5 2 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1",key:"rd2r6e"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const AJ=U("Waypoints",[["circle",{cx:"12",cy:"4.5",r:"2.5",key:"r5ysbb"}],["path",{d:"m10.2 6.3-3.9 3.9",key:"1nzqf6"}],["circle",{cx:"4.5",cy:"12",r:"2.5",key:"jydg6v"}],["path",{d:"M7 12h10",key:"b7w52i"}],["circle",{cx:"19.5",cy:"12",r:"2.5",key:"1piiel"}],["path",{d:"m13.8 17.7 3.9-3.9",key:"1wyg1y"}],["circle",{cx:"12",cy:"19.5",r:"2.5",key:"13o1pw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const EJ=U("Webcam",[["circle",{cx:"12",cy:"10",r:"8",key:"1gshiw"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}],["path",{d:"M7 22h10",key:"10w4w3"}],["path",{d:"M12 22v-4",key:"1utk9m"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const IJ=U("WebhookOff",[["path",{d:"M17 17h-5c-1.09-.02-1.94.92-2.5 1.9A3 3 0 1 1 2.57 15",key:"1tvl6x"}],["path",{d:"M9 3.4a4 4 0 0 1 6.52.66",key:"q04jfq"}],["path",{d:"m6 17 3.1-5.8a2.5 2.5 0 0 0 .057-2.05",key:"azowf0"}],["path",{d:"M20.3 20.3a4 4 0 0 1-2.3.7",key:"5joiws"}],["path",{d:"M18.6 13a4 4 0 0 1 3.357 3.414",key:"cangb8"}],["path",{d:"m12 6 .6 1",key:"tpjl1n"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const PJ=U("Webhook",[["path",{d:"M18 16.98h-5.99c-1.1 0-1.95.94-2.48 1.9A4 4 0 0 1 2 17c.01-.7.2-1.4.57-2",key:"q3hayz"}],["path",{d:"m6 17 3.13-5.78c.53-.97.1-2.18-.5-3.1a4 4 0 1 1 6.89-4.06",key:"1go1hn"}],["path",{d:"m12 6 3.13 5.73C15.66 12.7 16.9 13 18 13a4 4 0 0 1 0 8",key:"qlwsc0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const LJ=U("Weight",[["circle",{cx:"12",cy:"5",r:"3",key:"rqqgnr"}],["path",{d:"M6.5 8a2 2 0 0 0-1.905 1.46L2.1 18.5A2 2 0 0 0 4 21h16a2 2 0 0 0 1.925-2.54L19.4 9.5A2 2 0 0 0 17.48 8Z",key:"56o5sh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const OJ=U("WheatOff",[["path",{d:"m2 22 10-10",key:"28ilpk"}],["path",{d:"m16 8-1.17 1.17",key:"1qqm82"}],["path",{d:"M3.47 12.53 5 11l1.53 1.53a3.5 3.5 0 0 1 0 4.94L5 19l-1.53-1.53a3.5 3.5 0 0 1 0-4.94Z",key:"1rdhi6"}],["path",{d:"m8 8-.53.53a3.5 3.5 0 0 0 0 4.94L9 15l1.53-1.53c.55-.55.88-1.25.98-1.97",key:"4wz8re"}],["path",{d:"M10.91 5.26c.15-.26.34-.51.56-.73L13 3l1.53 1.53a3.5 3.5 0 0 1 .28 4.62",key:"rves66"}],["path",{d:"M20 2h2v2a4 4 0 0 1-4 4h-2V6a4 4 0 0 1 4-4Z",key:"19rau1"}],["path",{d:"M11.47 17.47 13 19l-1.53 1.53a3.5 3.5 0 0 1-4.94 0L5 19l1.53-1.53a3.5 3.5 0 0 1 4.94 0Z",key:"tc8ph9"}],["path",{d:"m16 16-.53.53a3.5 3.5 0 0 1-4.94 0L9 15l1.53-1.53a3.49 3.49 0 0 1 1.97-.98",key:"ak46r"}],["path",{d:"M18.74 13.09c.26-.15.51-.34.73-.56L21 11l-1.53-1.53a3.5 3.5 0 0 0-4.62-.28",key:"1tw520"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const DJ=U("Wheat",[["path",{d:"M2 22 16 8",key:"60hf96"}],["path",{d:"M3.47 12.53 5 11l1.53 1.53a3.5 3.5 0 0 1 0 4.94L5 19l-1.53-1.53a3.5 3.5 0 0 1 0-4.94Z",key:"1rdhi6"}],["path",{d:"M7.47 8.53 9 7l1.53 1.53a3.5 3.5 0 0 1 0 4.94L9 15l-1.53-1.53a3.5 3.5 0 0 1 0-4.94Z",key:"1sdzmb"}],["path",{d:"M11.47 4.53 13 3l1.53 1.53a3.5 3.5 0 0 1 0 4.94L13 11l-1.53-1.53a3.5 3.5 0 0 1 0-4.94Z",key:"eoatbi"}],["path",{d:"M20 2h2v2a4 4 0 0 1-4 4h-2V6a4 4 0 0 1 4-4Z",key:"19rau1"}],["path",{d:"M11.47 17.47 13 19l-1.53 1.53a3.5 3.5 0 0 1-4.94 0L5 19l1.53-1.53a3.5 3.5 0 0 1 4.94 0Z",key:"tc8ph9"}],["path",{d:"M15.47 13.47 17 15l-1.53 1.53a3.5 3.5 0 0 1-4.94 0L9 15l1.53-1.53a3.5 3.5 0 0 1 4.94 0Z",key:"2m8kc5"}],["path",{d:"M19.47 9.47 21 11l-1.53 1.53a3.5 3.5 0 0 1-4.94 0L13 11l1.53-1.53a3.5 3.5 0 0 1 4.94 0Z",key:"vex3ng"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const RJ=U("WholeWord",[["circle",{cx:"7",cy:"12",r:"3",key:"12clwm"}],["path",{d:"M10 9v6",key:"17i7lo"}],["circle",{cx:"17",cy:"12",r:"3",key:"gl7c2s"}],["path",{d:"M14 7v8",key:"dl84cr"}],["path",{d:"M22 17v1c0 .5-.5 1-1 1H3c-.5 0-1-.5-1-1v-1",key:"lt2kga"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const FJ=U("WifiHigh",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zJ=U("WifiLow",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const BJ=U("WifiOff",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $J=U("WifiZero",[["path",{d:"M12 20h.01",key:"zekei9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const UJ=U("Wifi",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qJ=U("WindArrowDown",[["path",{d:"M10 2v8",key:"d4bbey"}],["path",{d:"M12.8 21.6A2 2 0 1 0 14 18H2",key:"19kp1d"}],["path",{d:"M17.5 10a2.5 2.5 0 1 1 2 4H2",key:"19kpjc"}],["path",{d:"m6 6 4 4 4-4",key:"k13n16"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const VJ=U("Wind",[["path",{d:"M12.8 19.6A2 2 0 1 0 14 16H2",key:"148xed"}],["path",{d:"M17.5 8a2.5 2.5 0 1 1 2 4H2",key:"1u4tom"}],["path",{d:"M9.8 4.4A2 2 0 1 1 11 8H2",key:"75valh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const HJ=U("WineOff",[["path",{d:"M8 22h8",key:"rmew8v"}],["path",{d:"M7 10h3m7 0h-1.343",key:"v48bem"}],["path",{d:"M12 15v7",key:"t2xh3l"}],["path",{d:"M7.307 7.307A12.33 12.33 0 0 0 7 10a5 5 0 0 0 7.391 4.391M8.638 2.981C8.75 2.668 8.872 2.34 9 2h6c1.5 4 2 6 2 8 0 .407-.05.809-.145 1.198",key:"1ymjlu"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const WJ=U("Wine",[["path",{d:"M8 22h8",key:"rmew8v"}],["path",{d:"M7 10h10",key:"1101jm"}],["path",{d:"M12 15v7",key:"t2xh3l"}],["path",{d:"M12 15a5 5 0 0 0 5-5c0-2-.5-4-2-8H9c-1.5 4-2 6-2 8a5 5 0 0 0 5 5Z",key:"10ffi3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const GJ=U("Workflow",[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2",key:"by2w9f"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4",key:"xkn7yn"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2",key:"1cgmvn"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const KJ=U("Worm",[["path",{d:"m19 12-1.5 3",key:"9bcu4o"}],["path",{d:"M19.63 18.81 22 20",key:"121v98"}],["path",{d:"M6.47 8.23a1.68 1.68 0 0 1 2.44 1.93l-.64 2.08a6.76 6.76 0 0 0 10.16 7.67l.42-.27a1 1 0 1 0-2.73-4.21l-.42.27a1.76 1.76 0 0 1-2.63-1.99l.64-2.08A6.66 6.66 0 0 0 3.94 3.9l-.7.4a1 1 0 1 0 2.55 4.34z",key:"1tij6q"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ZJ=U("WrapText",[["line",{x1:"3",x2:"21",y1:"6",y2:"6",key:"4m8b97"}],["path",{d:"M3 12h15a3 3 0 1 1 0 6h-4",key:"1cl7v7"}],["polyline",{points:"16 16 14 18 16 20",key:"1jznyi"}],["line",{x1:"3",x2:"10",y1:"18",y2:"18",key:"1h33wv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Wx=U("Wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z",key:"cbrjhi"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _s=U("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const YJ=U("Youtube",[["path",{d:"M2.5 17a24.12 24.12 0 0 1 0-10 2 2 0 0 1 1.4-1.4 49.56 49.56 0 0 1 16.2 0A2 2 0 0 1 21.5 7a24.12 24.12 0 0 1 0 10 2 2 0 0 1-1.4 1.4 49.55 49.55 0 0 1-16.2 0A2 2 0 0 1 2.5 17",key:"1q2vi4"}],["path",{d:"m10 15 5-3-5-3z",key:"1jp15x"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const XJ=U("ZapOff",[["path",{d:"M10.513 4.856 13.12 2.17a.5.5 0 0 1 .86.46l-1.377 4.317",key:"193nxd"}],["path",{d:"M15.656 10H20a1 1 0 0 1 .78 1.63l-1.72 1.773",key:"27a7lr"}],["path",{d:"M16.273 16.273 10.88 21.83a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14H4a1 1 0 0 1-.78-1.63l4.507-4.643",key:"1e0qe9"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kg=U("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gS=U("ZoomIn",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xS=U("ZoomOut",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rZe=Object.freeze(Object.defineProperty({__proto__:null,AArrowDown:gO,AArrowUp:xO,ALargeSmall:yO,Accessibility:vO,Activity:pg,AirVent:_O,Airplay:bO,AlarmClock:jO,AlarmClockCheck:h_,AlarmClockMinus:f_,AlarmClockOff:wO,AlarmClockPlus:p_,AlarmSmoke:kO,Album:NO,AlignCenter:Y4,AlignCenterHorizontal:SO,AlignCenterVertical:CO,AlignEndHorizontal:MO,AlignEndVertical:TO,AlignHorizontalDistributeCenter:AO,AlignHorizontalDistributeEnd:EO,AlignHorizontalDistributeStart:IO,AlignHorizontalJustifyCenter:PO,AlignHorizontalJustifyEnd:LO,AlignHorizontalJustifyStart:OO,AlignHorizontalSpaceAround:DO,AlignHorizontalSpaceBetween:RO,AlignJustify:FO,AlignLeft:X4,AlignRight:Q4,AlignStartHorizontal:zO,AlignStartVertical:BO,AlignVerticalDistributeCenter:$O,AlignVerticalDistributeEnd:UO,AlignVerticalDistributeStart:qO,AlignVerticalJustifyCenter:VO,AlignVerticalJustifyEnd:HO,AlignVerticalJustifyStart:WO,AlignVerticalSpaceAround:GO,AlignVerticalSpaceBetween:KO,Ambulance:ZO,Ampersand:YO,Ampersands:XO,Amphora:QO,Anchor:JO,Angry:e8,Annoyed:t8,Antenna:r8,Anvil:n8,Aperture:s8,AppWindow:kT,AppWindowMac:a8,Apple:i8,Archive:c8,ArchiveRestore:o8,ArchiveX:l8,Armchair:d8,ArrowBigDown:h8,ArrowBigDownDash:u8,ArrowBigLeft:p8,ArrowBigLeftDash:f8,ArrowBigRight:g8,ArrowBigRightDash:m8,ArrowBigUp:y8,ArrowBigUpDash:x8,ArrowDown:i1,ArrowDown01:v8,ArrowDown10:_8,ArrowDownAZ:m_,ArrowDownFromLine:b8,ArrowDownLeft:w8,ArrowDownNarrowWide:j8,ArrowDownRight:k8,ArrowDownToDot:N8,ArrowDownToLine:S8,ArrowDownUp:C8,ArrowDownWideNarrow:g_,ArrowDownZA:x_,ArrowLeft:so,ArrowLeftFromLine:M8,ArrowLeftRight:T8,ArrowLeftToLine:A8,ArrowRight:dl,ArrowRightFromLine:E8,ArrowRightLeft:I8,ArrowRightToLine:P8,ArrowUp:mg,ArrowUp01:L8,ArrowUp10:O8,ArrowUpAZ:y_,ArrowUpDown:zx,ArrowUpFromDot:D8,ArrowUpFromLine:R8,ArrowUpLeft:F8,ArrowUpNarrowWide:v_,ArrowUpRight:z8,ArrowUpToLine:B8,ArrowUpWideNarrow:$8,ArrowUpZA:__,ArrowsUpFromLine:U8,Asterisk:q8,AtSign:V8,Atom:H8,AudioLines:W8,AudioWaveform:G8,Award:Ol,Axe:K8,Axis3d:b_,Baby:Z8,Backpack:Y8,Badge:hD,BadgeAlert:X8,BadgeCent:Q8,BadgeCheck:w_,BadgeDollarSign:J8,BadgeEuro:eD,BadgeHelp:tD,BadgeIndianRupee:rD,BadgeInfo:nD,BadgeJapaneseYen:sD,BadgeMinus:aD,BadgePercent:iD,BadgePlus:oD,BadgePoundSterling:lD,BadgeRussianRuble:cD,BadgeSwissFranc:dD,BadgeX:uD,BaggageClaim:fD,Ban:pD,Banana:mD,Bandage:gD,Banknote:xD,Barcode:yD,Baseline:vD,Bath:o1,Battery:ND,BatteryCharging:_D,BatteryFull:bD,BatteryLow:wD,BatteryMedium:jD,BatteryWarning:kD,Beaker:SD,Bean:MD,BeanOff:CD,Bed:l1,BedDouble:TD,BedSingle:AD,Beef:ED,Beer:PD,BeerOff:ID,Bell:gg,BellDot:LD,BellElectric:OD,BellMinus:DD,BellOff:oj,BellPlus:RD,BellRing:FD,BetweenHorizontalEnd:j_,BetweenHorizontalStart:k_,BetweenVerticalEnd:zD,BetweenVerticalStart:BD,BicepsFlexed:$D,Bike:UD,Binary:qD,Binoculars:VD,Biohazard:HD,Bird:WD,Bitcoin:GD,Blend:KD,Blinds:ZD,Blocks:YD,Bluetooth:eR,BluetoothConnected:XD,BluetoothOff:QD,BluetoothSearching:JD,Bold:J4,Bolt:tR,Bomb:rR,Bone:nR,Book:NR,BookA:sR,BookAudio:aR,BookCheck:iR,BookCopy:oR,BookDashed:N_,BookDown:lR,BookHeadphones:cR,BookHeart:dR,BookImage:uR,BookKey:hR,BookLock:fR,BookMarked:pR,BookMinus:mR,BookOpen:NT,BookOpenCheck:gR,BookOpenText:xR,BookPlus:yR,BookText:vR,BookType:_R,BookUp:wR,BookUp2:bR,BookUser:jR,BookX:kR,Bookmark:um,BookmarkCheck:SR,BookmarkMinus:CR,BookmarkPlus:ST,BookmarkX:MR,BoomBox:TR,Bot:eS,BotMessageSquare:AR,BotOff:ER,Box:IR,Boxes:PR,Braces:S_,Brackets:LR,Brain:CT,BrainCircuit:OR,BrainCog:DR,BrickWall:RR,Briefcase:yh,BriefcaseBusiness:FR,BriefcaseConveyorBelt:zR,BriefcaseMedical:BR,BringToFront:$R,Brush:UR,Bug:HR,BugOff:qR,BugPlay:VR,Building:lj,Building2:ai,Bus:GR,BusFront:WR,Cable:ZR,CableCar:KR,Cake:Qh,CakeSlice:YR,Calculator:XR,Calendar:zs,Calendar1:QR,CalendarArrowDown:JR,CalendarArrowUp:eF,CalendarCheck:rF,CalendarCheck2:tF,CalendarClock:nF,CalendarCog:sF,CalendarDays:hm,CalendarFold:aF,CalendarHeart:iF,CalendarMinus:lF,CalendarMinus2:oF,CalendarOff:cF,CalendarPlus:cj,CalendarPlus2:dF,CalendarRange:uF,CalendarSearch:hF,CalendarSync:fF,CalendarX:mF,CalendarX2:pF,Camera:xg,CameraOff:gF,Candy:vF,CandyCane:xF,CandyOff:yF,Cannabis:_F,Captions:C_,CaptionsOff:bF,Car:kF,CarFront:wF,CarTaxiFront:jF,Caravan:NF,Carrot:SF,CaseLower:CF,CaseSensitive:MF,CaseUpper:TF,CassetteTape:AF,Cast:EF,Castle:IF,Cat:PF,Cctv:LF,ChartArea:M_,ChartBar:A_,ChartBarBig:T_,ChartBarDecreasing:OF,ChartBarIncreasing:DF,ChartBarStacked:RF,ChartCandlestick:E_,ChartColumn:cc,ChartColumnBig:I_,ChartColumnDecreasing:FF,ChartColumnIncreasing:P_,ChartColumnStacked:zF,ChartGantt:BF,ChartLine:L_,ChartNetwork:$F,ChartNoAxesColumn:D_,ChartNoAxesColumnDecreasing:UF,ChartNoAxesColumnIncreasing:O_,ChartNoAxesCombined:qF,ChartNoAxesGantt:R_,ChartPie:F_,ChartScatter:z_,ChartSpline:VF,Check:Ai,CheckCheck:HF,ChefHat:WF,Cherry:GF,ChevronDown:Dd,ChevronFirst:KF,ChevronLast:ZF,ChevronLeft:Tc,ChevronRight:Vi,ChevronUp:c1,ChevronsDown:XF,ChevronsDownUp:YF,ChevronsLeft:ez,ChevronsLeftRight:JF,ChevronsLeftRightEllipsis:QF,ChevronsRight:rz,ChevronsRightLeft:tz,ChevronsUp:nz,ChevronsUpDown:d1,Chrome:sz,Church:az,Cigarette:oz,CigaretteOff:iz,Circle:Ru,CircleAlert:Il,CircleArrowDown:B_,CircleArrowLeft:$_,CircleArrowOutDownLeft:U_,CircleArrowOutDownRight:q_,CircleArrowOutUpLeft:V_,CircleArrowOutUpRight:H_,CircleArrowRight:W_,CircleArrowUp:G_,CircleCheck:Xi,CircleCheckBig:Yi,CircleChevronDown:K_,CircleChevronLeft:Z_,CircleChevronRight:Y_,CircleChevronUp:X_,CircleDashed:lz,CircleDivide:Q_,CircleDollarSign:cz,CircleDot:uz,CircleDotDashed:dz,CircleEllipsis:hz,CircleEqual:fz,CircleFadingArrowUp:pz,CircleFadingPlus:mz,CircleGauge:J_,CircleHelp:Nx,CircleMinus:e2,CircleOff:gz,CircleParking:r2,CircleParkingOff:t2,CirclePause:n2,CirclePercent:s2,CirclePlay:Bf,CirclePlus:a2,CirclePower:i2,CircleSlash:xz,CircleSlash2:o2,CircleStop:l2,CircleUser:d2,CircleUserRound:c2,CircleX:qc,CircuitBoard:yz,Citrus:vz,Clapperboard:_z,Clipboard:Cz,ClipboardCheck:MT,ClipboardCopy:bz,ClipboardList:TT,ClipboardMinus:wz,ClipboardPaste:jz,ClipboardPen:h2,ClipboardPenLine:u2,ClipboardPlus:kz,ClipboardType:Nz,ClipboardX:Sz,Clock:Ya,Clock1:Mz,Clock10:Tz,Clock11:Az,Clock12:Ez,Clock2:Iz,Clock3:Pz,Clock4:Lz,Clock5:Oz,Clock6:Dz,Clock7:Rz,Clock8:Fz,Clock9:zz,ClockAlert:Bz,ClockArrowDown:$z,ClockArrowUp:Uz,Cloud:n7,CloudAlert:qz,CloudCog:Vz,CloudDownload:f2,CloudDrizzle:Hz,CloudFog:Wz,CloudHail:Gz,CloudLightning:Kz,CloudMoon:Yz,CloudMoonRain:Zz,CloudOff:Xz,CloudRain:Jz,CloudRainWind:Qz,CloudSnow:e7,CloudSun:r7,CloudSunRain:t7,CloudUpload:p2,Cloudy:s7,Clover:Px,Club:a7,Code:dj,CodeXml:m2,Codepen:i7,Codesandbox:o7,Coffee:uj,Cog:l7,Coins:c7,Columns2:g2,Columns3:x2,Columns4:d7,Combine:u7,Command:h7,Compass:f7,Component:p7,Computer:m7,ConciergeBell:g7,Cone:x7,Construction:y7,Contact:v7,ContactRound:y2,Container:_7,Contrast:b7,Cookie:w7,CookingPot:j7,Copy:hl,CopyCheck:k7,CopyMinus:N7,CopyPlus:S7,CopySlash:C7,CopyX:M7,Copyleft:T7,Copyright:A7,CornerDownLeft:E7,CornerDownRight:I7,CornerLeftDown:P7,CornerLeftUp:L7,CornerRightDown:O7,CornerRightUp:D7,CornerUpLeft:R7,CornerUpRight:F7,Cpu:z7,CreativeCommons:B7,CreditCard:fm,Croissant:$7,Crop:U7,Cross:q7,Crosshair:V7,Crown:u1,Cuboid:H7,CupSoda:W7,Currency:G7,Cylinder:K7,Dam:Z7,Database:Q7,DatabaseBackup:Y7,DatabaseZap:X7,Delete:J7,Dessert:e9,Diameter:t9,Diamond:s9,DiamondMinus:r9,DiamondPercent:v2,DiamondPlus:n9,Dice1:a9,Dice2:i9,Dice3:o9,Dice4:l9,Dice5:c9,Dice6:d9,Dices:u9,Diff:h9,Disc:g9,Disc2:f9,Disc3:p9,DiscAlbum:m9,Divide:x9,Dna:v9,DnaOff:y9,Dock:_9,Dog:b9,DollarSign:hd,Donut:w9,DoorClosed:j9,DoorOpen:hj,Dot:k9,Download:no,DraftingCompass:N9,Drama:S9,Dribbble:C9,Drill:M9,Droplet:T9,Droplets:A9,Drum:E9,Drumstick:I9,Dumbbell:P9,Ear:O9,EarOff:L9,Earth:_2,EarthLock:D9,Eclipse:R9,Egg:tS,EggFried:F9,EggOff:z9,Ellipsis:em,EllipsisVertical:Sx,Equal:U9,EqualApproximately:B9,EqualNot:$9,Eraser:q9,EthernetPort:V9,Euro:H9,Expand:W9,ExternalLink:Fs,Eye:Qo,EyeClosed:G9,EyeOff:h1,Facebook:Rd,Factory:K9,Fan:Z9,FastForward:Y9,Feather:X9,Fence:Q9,FerrisWheel:J9,Figma:eB,File:KB,FileArchive:tB,FileAudio:nB,FileAudio2:rB,FileAxis3d:b2,FileBadge:aB,FileBadge2:sB,FileBox:iB,FileChartColumn:j2,FileChartColumnIncreasing:w2,FileChartLine:k2,FileChartPie:N2,FileCheck:lB,FileCheck2:oB,FileClock:cB,FileCode:uB,FileCode2:dB,FileCog:S2,FileDiff:hB,FileDigit:fB,FileDown:pB,FileHeart:mB,FileImage:f1,FileInput:gB,FileJson:yB,FileJson2:xB,FileKey:_B,FileKey2:vB,FileLock:wB,FileLock2:bB,FileMinus:kB,FileMinus2:jB,FileMusic:NB,FileOutput:SB,FilePen:M2,FilePenLine:C2,FilePlus:MB,FilePlus2:CB,FileQuestion:TB,FileScan:AB,FileSearch:IB,FileSearch2:EB,FileSliders:PB,FileSpreadsheet:p1,FileStack:LB,FileSymlink:OB,FileTerminal:DB,FileText:La,FileType:FB,FileType2:RB,FileUp:zB,FileUser:BB,FileVideo:UB,FileVideo2:$B,FileVolume:VB,FileVolume2:qB,FileWarning:HB,FileX:GB,FileX2:WB,Files:ZB,Film:Ad,Filter:m1,FilterX:YB,Fingerprint:XB,FireExtinguisher:QB,Fish:t$,FishOff:JB,FishSymbol:e$,Flag:Bx,FlagOff:r$,FlagTriangleLeft:n$,FlagTriangleRight:s$,Flame:Jh,FlameKindling:a$,Flashlight:o$,FlashlightOff:i$,FlaskConical:fj,FlaskConicalOff:l$,FlaskRound:c$,FlipHorizontal:u$,FlipHorizontal2:d$,FlipVertical:f$,FlipVertical2:h$,Flower:p$,Flower2:am,Focus:m$,FoldHorizontal:g$,FoldVertical:x$,Folder:V$,FolderArchive:y$,FolderCheck:v$,FolderClock:_$,FolderClosed:b$,FolderCode:w$,FolderCog:T2,FolderDot:j$,FolderDown:k$,FolderGit:S$,FolderGit2:N$,FolderHeart:C$,FolderInput:M$,FolderKanban:T$,FolderKey:A$,FolderLock:E$,FolderMinus:I$,FolderOpen:$x,FolderOpenDot:P$,FolderOutput:L$,FolderPen:A2,FolderPlus:O$,FolderRoot:D$,FolderSearch:F$,FolderSearch2:R$,FolderSymlink:z$,FolderSync:B$,FolderTree:$$,FolderUp:U$,FolderX:q$,Folders:H$,Footprints:W$,Forklift:G$,Forward:K$,Frame:Z$,Framer:Y$,Frown:X$,Fuel:Q$,Fullscreen:J$,GalleryHorizontal:tU,GalleryHorizontalEnd:eU,GalleryThumbnails:rU,GalleryVertical:sU,GalleryVerticalEnd:nU,Gamepad:iU,Gamepad2:aU,Gauge:oU,Gavel:lU,Gem:cU,Ghost:pj,Gift:Ki,GitBranch:uU,GitBranchPlus:dU,GitCommitHorizontal:E2,GitCommitVertical:hU,GitCompare:pU,GitCompareArrows:fU,GitFork:mU,GitGraph:gU,GitMerge:xU,GitPullRequest:jU,GitPullRequestArrow:yU,GitPullRequestClosed:vU,GitPullRequestCreate:bU,GitPullRequestCreateArrow:_U,GitPullRequestDraft:wU,Github:kU,Gitlab:NU,GlassWater:SU,Glasses:CU,Globe:Ux,GlobeLock:MU,Goal:TU,Grab:AU,GraduationCap:g1,Grape:EU,Grid2x2:P2,Grid2x2Check:IU,Grid2x2Plus:I2,Grid2x2X:PU,Grid3x3:Bh,Grip:OU,GripHorizontal:LU,GripVertical:x1,Group:DU,Guitar:RU,Ham:FU,Hammer:zU,Hand:VU,HandCoins:BU,HandHeart:$U,HandHelping:L2,HandMetal:UU,HandPlatter:qU,Handshake:HU,HardDrive:AT,HardDriveDownload:WU,HardDriveUpload:GU,HardHat:KU,Hash:rS,Haze:ZU,HdmiPort:YU,Heading:tq,Heading1:ET,Heading2:IT,Heading3:XU,Heading4:QU,Heading5:JU,Heading6:eq,HeadphoneOff:rq,Headphones:nq,Headset:sq,Heart:ci,HeartCrack:aq,HeartHandshake:iq,HeartOff:oq,HeartPulse:lq,Heater:cq,Hexagon:dq,Highlighter:uq,History:nS,Hop:fq,HopOff:hq,Hospital:pq,Hotel:mq,Hourglass:gq,House:pa,HousePlug:xq,HousePlus:yq,IceCreamBowl:O2,IceCreamCone:D2,IdCard:vq,Image:Pl,ImageDown:_q,ImageMinus:bq,ImageOff:wq,ImagePlay:jq,ImagePlus:sS,ImageUp:kq,ImageUpscale:Nq,Images:Sq,Import:Cq,Inbox:Mq,IndentDecrease:R2,IndentIncrease:F2,IndianRupee:Tq,Infinity:Aq,Info:Eq,InspectionPanel:Iq,Instagram:lu,Italic:aS,IterationCcw:Pq,IterationCw:Lq,JapaneseYen:Oq,Joystick:Dq,Kanban:y1,Key:ef,KeyRound:mj,KeySquare:Rq,Keyboard:Bq,KeyboardMusic:Fq,KeyboardOff:zq,Lamp:Wq,LampCeiling:$q,LampDesk:Uq,LampFloor:qq,LampWallDown:Vq,LampWallUp:Hq,LandPlot:Gq,Landmark:Kq,Languages:Zq,Laptop:Xq,LaptopMinimal:z2,LaptopMinimalCheck:Yq,Lasso:Jq,LassoSelect:Qq,Laugh:eV,Layers:nV,Layers2:tV,Layers3:rV,LayoutDashboard:gj,LayoutGrid:pm,LayoutList:sV,LayoutPanelLeft:aV,LayoutPanelTop:iV,LayoutTemplate:oV,Leaf:lV,LeafyGreen:cV,Lectern:dV,LetterText:uV,Library:iS,LibraryBig:hV,LifeBuoy:oS,Ligature:fV,Lightbulb:v1,LightbulbOff:pV,Link:Co,Link2:tf,Link2Off:mV,Linkedin:mm,List:Kf,ListCheck:gV,ListChecks:xV,ListCollapse:yV,ListEnd:vV,ListFilter:_V,ListMinus:bV,ListMusic:wV,ListOrdered:lS,ListPlus:jV,ListRestart:kV,ListStart:NV,ListTodo:SV,ListTree:CV,ListVideo:MV,ListX:TV,Loader:EV,LoaderCircle:en,LoaderPinwheel:AV,Locate:PT,LocateFixed:IV,LocateOff:PV,Lock:Zf,LockKeyhole:LV,LockKeyholeOpen:B2,LockOpen:$2,LogIn:cS,LogOut:dS,Logs:OV,Lollipop:DV,Luggage:RV,Magnet:FV,Mail:da,MailCheck:zV,MailMinus:BV,MailOpen:$V,MailPlus:UV,MailQuestion:qV,MailSearch:VV,MailWarning:HV,MailX:LT,Mailbox:WV,Mails:GV,Map:aH,MapPin:fl,MapPinCheck:ZV,MapPinCheckInside:KV,MapPinHouse:YV,MapPinMinus:QV,MapPinMinusInside:XV,MapPinOff:JV,MapPinPlus:tH,MapPinPlusInside:eH,MapPinX:nH,MapPinXInside:rH,MapPinned:sH,Martini:iH,Maximize:lH,Maximize2:oH,Medal:qx,Megaphone:gm,MegaphoneOff:cH,Meh:dH,MemoryStick:uH,Menu:OT,Merge:hH,MessageCircle:Fl,MessageCircleCode:fH,MessageCircleDashed:pH,MessageCircleHeart:uS,MessageCircleMore:mH,MessageCircleOff:gH,MessageCirclePlus:xH,MessageCircleQuestion:DT,MessageCircleReply:yH,MessageCircleWarning:vH,MessageCircleX:_H,MessageSquare:Lo,MessageSquareCode:bH,MessageSquareDashed:wH,MessageSquareDiff:jH,MessageSquareDot:kH,MessageSquareHeart:NH,MessageSquareLock:SH,MessageSquareMore:CH,MessageSquareOff:MH,MessageSquarePlus:TH,MessageSquareQuote:RT,MessageSquareReply:AH,MessageSquareShare:EH,MessageSquareText:IH,MessageSquareWarning:PH,MessageSquareX:LH,MessagesSquare:OH,Mic:FT,MicOff:DH,MicVocal:U2,Microchip:RH,Microscope:FH,Microwave:zH,Milestone:BH,Milk:UH,MilkOff:$H,Minimize:VH,Minimize2:qH,Minus:_1,Monitor:xj,MonitorCheck:HH,MonitorCog:WH,MonitorDot:GH,MonitorDown:KH,MonitorOff:ZH,MonitorPause:YH,MonitorPlay:XH,MonitorSmartphone:QH,MonitorSpeaker:JH,MonitorStop:eW,MonitorUp:tW,MonitorX:rW,Moon:sW,MoonStar:nW,Mountain:iW,MountainSnow:aW,Mouse:uW,MouseOff:oW,MousePointer:dW,MousePointer2:lW,MousePointerBan:cW,MousePointerClick:yj,Move:kW,Move3d:q2,MoveDiagonal:fW,MoveDiagonal2:hW,MoveDown:gW,MoveDownLeft:pW,MoveDownRight:mW,MoveHorizontal:xW,MoveLeft:yW,MoveRight:vW,MoveUp:wW,MoveUpLeft:_W,MoveUpRight:bW,MoveVertical:jW,Music:MW,Music2:NW,Music3:SW,Music4:CW,Navigation:zT,Navigation2:AW,Navigation2Off:TW,NavigationOff:EW,Network:IW,Newspaper:Vx,Nfc:PW,Notebook:RW,NotebookPen:LW,NotebookTabs:OW,NotebookText:DW,NotepadText:zW,NotepadTextDashed:FW,Nut:$W,NutOff:BW,Octagon:qW,OctagonAlert:V2,OctagonMinus:UW,OctagonPause:H2,OctagonX:W2,Omega:VW,Option:HW,Orbit:WW,Origami:GW,Package:zl,Package2:KW,PackageCheck:ZW,PackageMinus:YW,PackageOpen:XW,PackagePlus:QW,PackageSearch:JW,PackageX:eG,PaintBucket:tG,PaintRoller:rG,Paintbrush:nG,PaintbrushVertical:G2,Palette:Fd,PanelBottom:iG,PanelBottomClose:sG,PanelBottomDashed:K2,PanelBottomOpen:aG,PanelLeft:Q2,PanelLeftClose:Z2,PanelLeftDashed:Y2,PanelLeftOpen:X2,PanelRight:cG,PanelRightClose:oG,PanelRightDashed:J2,PanelRightOpen:lG,PanelTop:hG,PanelTopClose:dG,PanelTopDashed:eb,PanelTopOpen:uG,PanelsLeftBottom:fG,PanelsRightBottom:pG,PanelsTopLeft:m0,Paperclip:mG,Parentheses:gG,ParkingMeter:xG,PartyPopper:Ac,Pause:Yf,PawPrint:yG,PcCase:vG,Pen:g0,PenLine:tb,PenOff:_G,PenTool:vj,Pencil:_i,PencilLine:bG,PencilOff:wG,PencilRuler:jG,Pentagon:kG,Percent:hS,PersonStanding:NG,PhilippinePeso:SG,Phone:bi,PhoneCall:CG,PhoneForwarded:MG,PhoneIncoming:TG,PhoneMissed:AG,PhoneOff:EG,PhoneOutgoing:IG,Pi:PG,Piano:LG,Pickaxe:OG,PictureInPicture:RG,PictureInPicture2:DG,PiggyBank:FG,Pilcrow:$G,PilcrowLeft:zG,PilcrowRight:BG,Pill:qG,PillBottle:UG,Pin:b1,PinOff:BT,Pipette:VG,Pizza:HG,Plane:KG,PlaneLanding:WG,PlaneTakeoff:GG,Play:hc,Plug:YG,Plug2:ZG,PlugZap:rb,Plus:bn,Pocket:QG,PocketKnife:XG,Podcast:JG,Pointer:tK,PointerOff:eK,Popcorn:rK,Popsicle:nK,PoundSterling:sK,Power:iK,PowerOff:aK,Presentation:oK,Printer:cK,PrinterCheck:lK,Projector:dK,Proportions:uK,Puzzle:hK,Pyramid:fK,QrCode:$T,Quote:UT,Rabbit:pK,Radar:mK,Radiation:gK,Radical:xK,Radio:_j,RadioReceiver:yK,RadioTower:vK,Radius:_K,RailSymbol:bK,Rainbow:wK,Rat:jK,Ratio:kK,Receipt:PK,ReceiptCent:NK,ReceiptEuro:SK,ReceiptIndianRupee:CK,ReceiptJapaneseYen:MK,ReceiptPoundSterling:TK,ReceiptRussianRuble:AK,ReceiptSwissFranc:EK,ReceiptText:IK,RectangleEllipsis:nb,RectangleHorizontal:LK,RectangleVertical:OK,Recycle:DK,Redo:fS,Redo2:RK,RedoDot:FK,RefreshCcw:BK,RefreshCcwDot:zK,RefreshCw:Gl,RefreshCwOff:$K,Refrigerator:UK,Regex:qK,RemoveFormatting:VK,Repeat:qT,Repeat1:HK,Repeat2:WK,Replace:KK,ReplaceAll:GK,Reply:VT,ReplyAll:ZK,Rewind:YK,Ribbon:XK,Rocket:yg,RockingChair:QK,RollerCoaster:JK,Rotate3d:sb,RotateCcw:pS,RotateCcwSquare:eZ,RotateCw:HT,RotateCwSquare:tZ,Route:nZ,RouteOff:rZ,Router:sZ,Rows2:ab,Rows3:ib,Rows4:aZ,Rss:iZ,Ruler:oZ,RussianRuble:lZ,Sailboat:cZ,Salad:dZ,Sandwich:uZ,Satellite:fZ,SatelliteDish:hZ,Save:vg,SaveAll:pZ,SaveOff:mZ,Scale:gZ,Scale3d:ob,Scaling:xZ,Scan:NZ,ScanBarcode:yZ,ScanEye:vZ,ScanFace:_Z,ScanLine:bZ,ScanQrCode:wZ,ScanSearch:jZ,ScanText:kZ,School:SZ,Scissors:MZ,ScissorsLineDashed:CZ,ScreenShare:AZ,ScreenShareOff:TZ,Scroll:IZ,ScrollText:EZ,Search:wa,SearchCheck:PZ,SearchCode:LZ,SearchSlash:OZ,SearchX:DZ,Section:RZ,Send:Oo,SendHorizontal:lb,SendToBack:FZ,SeparatorHorizontal:zZ,SeparatorVertical:BZ,Server:VZ,ServerCog:$Z,ServerCrash:UZ,ServerOff:qZ,Settings:fd,Settings2:HZ,Shapes:WZ,Share:WT,Share2:fc,Sheet:GZ,Shell:KZ,Shield:rf,ShieldAlert:ZZ,ShieldBan:YZ,ShieldCheck:GT,ShieldEllipsis:XZ,ShieldHalf:QZ,ShieldMinus:JZ,ShieldOff:eY,ShieldPlus:tY,ShieldQuestion:rY,ShieldX:cb,Ship:sY,ShipWheel:nY,Shirt:aY,ShoppingBag:_g,ShoppingBasket:iY,ShoppingCart:fh,Shovel:oY,ShowerHead:lY,Shrink:cY,Shrub:dY,Shuffle:uY,Sigma:hY,Signal:xY,SignalHigh:fY,SignalLow:pY,SignalMedium:mY,SignalZero:gY,Signature:yY,Signpost:_Y,SignpostBig:vY,Siren:bY,SkipBack:wY,SkipForward:jY,Skull:kY,Slack:NY,Slash:SY,Slice:CY,SlidersHorizontal:KT,SlidersVertical:db,Smartphone:bg,SmartphoneCharging:MY,SmartphoneNfc:TY,Smile:EY,SmilePlus:AY,Snail:IY,Snowflake:V0,Sofa:PY,Soup:LY,Space:OY,Spade:DY,Sparkle:RY,Sparkles:Ms,Speaker:FY,Speech:zY,SpellCheck:$Y,SpellCheck2:BY,Spline:UY,Split:qY,SprayCan:VY,Sprout:HY,Square:wg,SquareActivity:ub,SquareArrowDown:pb,SquareArrowDownLeft:hb,SquareArrowDownRight:fb,SquareArrowLeft:mb,SquareArrowOutDownLeft:gb,SquareArrowOutDownRight:xb,SquareArrowOutUpLeft:yb,SquareArrowOutUpRight:vb,SquareArrowRight:_b,SquareArrowUp:jb,SquareArrowUpLeft:bb,SquareArrowUpRight:wb,SquareAsterisk:kb,SquareBottomDashedScissors:Nb,SquareChartGantt:Ym,SquareCheck:Sb,SquareCheckBig:x0,SquareChevronDown:Cb,SquareChevronLeft:Mb,SquareChevronRight:Tb,SquareChevronUp:Ab,SquareCode:Eb,SquareDashed:Lb,SquareDashedBottom:GY,SquareDashedBottomCode:WY,SquareDashedKanban:Ib,SquareDashedMousePointer:Pb,SquareDivide:Ob,SquareDot:Db,SquareEqual:Rb,SquareFunction:Fb,SquareKanban:zb,SquareLibrary:Bb,SquareM:$b,SquareMenu:Ub,SquareMinus:qb,SquareMousePointer:Vb,SquareParking:Wb,SquareParkingOff:Hb,SquarePen:ac,SquarePercent:Gb,SquarePi:Kb,SquarePilcrow:Zb,SquarePlay:Yb,SquarePlus:Xb,SquarePower:Qb,SquareRadical:KY,SquareScissors:Jb,SquareSigma:ew,SquareSlash:tw,SquareSplitHorizontal:rw,SquareSplitVertical:nw,SquareSquare:ZY,SquareStack:YY,SquareTerminal:sw,SquareUser:iw,SquareUserRound:aw,SquareX:ow,Squircle:XY,Squirrel:QY,Stamp:JY,Star:vs,StarHalf:eX,StarOff:tX,StepBack:rX,StepForward:nX,Stethoscope:sX,Sticker:aX,StickyNote:iX,Store:oX,StretchHorizontal:lX,StretchVertical:cX,Strikethrough:dX,Subscript:uX,Sun:w1,SunDim:hX,SunMedium:fX,SunMoon:pX,SunSnow:mX,Sunrise:gX,Sunset:xX,Superscript:yX,SwatchBook:vX,SwissFranc:_X,SwitchCamera:bX,Sword:wX,Swords:jX,Syringe:kX,Table:EX,Table2:ZT,TableCellsMerge:NX,TableCellsSplit:SX,TableColumnsSplit:CX,TableOfContents:MX,TableProperties:TX,TableRowsSplit:AX,Tablet:PX,TabletSmartphone:IX,Tablets:LX,Tag:jg,Tags:OX,Tally1:DX,Tally2:RX,Tally3:FX,Tally4:zX,Tally5:BX,Tangent:$X,Target:Hx,Telescope:UX,Tent:VX,TentTree:qX,Terminal:HX,TestTube:WX,TestTubeDiagonal:lw,TestTubes:GX,Text:QX,TextCursor:ZX,TextCursorInput:KX,TextQuote:YX,TextSearch:XX,TextSelect:cw,Theater:JX,Thermometer:rQ,ThermometerSnowflake:eQ,ThermometerSun:tQ,ThumbsDown:YT,ThumbsUp:pd,Ticket:XT,TicketCheck:nQ,TicketMinus:sQ,TicketPercent:aQ,TicketPlus:iQ,TicketSlash:oQ,TicketX:lQ,Tickets:dQ,TicketsPlane:cQ,Timer:fQ,TimerOff:uQ,TimerReset:hQ,ToggleLeft:pQ,ToggleRight:mQ,Toilet:gQ,Tornado:xQ,Torus:yQ,Touchpad:_Q,TouchpadOff:vQ,TowerControl:bQ,ToyBrick:wQ,Tractor:jQ,TrafficCone:kQ,TrainFront:SQ,TrainFrontTunnel:NQ,TrainTrack:CQ,TramFront:dw,Trash:MQ,Trash2:Vn,TreeDeciduous:TQ,TreePalm:uw,TreePine:j1,Trees:AQ,Trello:EQ,TrendingDown:bj,TrendingUp:Xf,TrendingUpDown:IQ,Triangle:LQ,TriangleAlert:Vh,TriangleRight:PQ,Trophy:Zi,Truck:QT,Turtle:OQ,Tv:RQ,TvMinimal:hw,TvMinimalPlay:DQ,Twitch:FQ,Twitter:zQ,Type:$Q,TypeOutline:BQ,Umbrella:qQ,UmbrellaOff:UQ,Underline:VQ,Undo:mS,Undo2:HQ,UndoDot:WQ,UnfoldHorizontal:GQ,UnfoldVertical:KQ,Ungroup:ZQ,University:fw,Unlink:JT,Unlink2:YQ,Unplug:XQ,Upload:uo,Usb:QQ,User:Ec,UserCheck:wj,UserCog:eA,UserMinus:JQ,UserPen:eJ,UserPlus:nf,UserRound:vw,UserRoundCheck:pw,UserRoundCog:mw,UserRoundMinus:gw,UserRoundPen:tJ,UserRoundPlus:xw,UserRoundSearch:rJ,UserRoundX:yw,UserSearch:nJ,UserX:sJ,Users:Bn,UsersRound:_w,Utensils:ww,UtensilsCrossed:bw,UtilityPole:aJ,Variable:tA,Vault:iJ,Vegan:oJ,VenetianMask:lJ,Vibrate:dJ,VibrateOff:cJ,Video:Pa,VideoOff:uJ,Videotape:hJ,View:fJ,Voicemail:pJ,Volleyball:mJ,Volume:_J,Volume1:gJ,Volume2:xJ,VolumeOff:yJ,VolumeX:vJ,Vote:bJ,Wallet:jJ,WalletCards:wJ,WalletMinimal:jw,Wallpaper:kJ,Wand:NJ,WandSparkles:kw,Warehouse:SJ,WashingMachine:CJ,Watch:MJ,Waves:TJ,Waypoints:AJ,Webcam:EJ,Webhook:PJ,WebhookOff:IJ,Weight:LJ,Wheat:DJ,WheatOff:OJ,WholeWord:RJ,Wifi:UJ,WifiHigh:FJ,WifiLow:zJ,WifiOff:BJ,WifiZero:$J,Wind:VJ,WindArrowDown:qJ,Wine:WJ,WineOff:HJ,Workflow:GJ,Worm:KJ,WrapText:ZJ,Wrench:Wx,X:_s,Youtube:YJ,Zap:kg,ZapOff:XJ,ZoomIn:gS,ZoomOut:xS},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 mAe=Object.freeze(Object.defineProperty({__proto__:null,AArrowDown:gO,AArrowDownIcon:gO,AArrowUp:xO,AArrowUpIcon:xO,ALargeSmall:yO,ALargeSmallIcon:yO,Accessibility:vO,AccessibilityIcon:vO,Activity:pg,ActivityIcon:pg,ActivitySquare:ub,ActivitySquareIcon:ub,AirVent:_O,AirVentIcon:_O,Airplay:bO,AirplayIcon:bO,AlarmCheck:h_,AlarmCheckIcon:h_,AlarmClock:jO,AlarmClockCheck:h_,AlarmClockCheckIcon:h_,AlarmClockIcon:jO,AlarmClockMinus:f_,AlarmClockMinusIcon:f_,AlarmClockOff:wO,AlarmClockOffIcon:wO,AlarmClockPlus:p_,AlarmClockPlusIcon:p_,AlarmMinus:f_,AlarmMinusIcon:f_,AlarmPlus:p_,AlarmPlusIcon:p_,AlarmSmoke:kO,AlarmSmokeIcon:kO,Album:NO,AlbumIcon:NO,AlertCircle:Il,AlertCircleIcon:Il,AlertOctagon:V2,AlertOctagonIcon:V2,AlertTriangle:Vh,AlertTriangleIcon:Vh,AlignCenter:Y4,AlignCenterHorizontal:SO,AlignCenterHorizontalIcon:SO,AlignCenterIcon:Y4,AlignCenterVertical:CO,AlignCenterVerticalIcon:CO,AlignEndHorizontal:MO,AlignEndHorizontalIcon:MO,AlignEndVertical:TO,AlignEndVerticalIcon:TO,AlignHorizontalDistributeCenter:AO,AlignHorizontalDistributeCenterIcon:AO,AlignHorizontalDistributeEnd:EO,AlignHorizontalDistributeEndIcon:EO,AlignHorizontalDistributeStart:IO,AlignHorizontalDistributeStartIcon:IO,AlignHorizontalJustifyCenter:PO,AlignHorizontalJustifyCenterIcon:PO,AlignHorizontalJustifyEnd:LO,AlignHorizontalJustifyEndIcon:LO,AlignHorizontalJustifyStart:OO,AlignHorizontalJustifyStartIcon:OO,AlignHorizontalSpaceAround:DO,AlignHorizontalSpaceAroundIcon:DO,AlignHorizontalSpaceBetween:RO,AlignHorizontalSpaceBetweenIcon:RO,AlignJustify:FO,AlignJustifyIcon:FO,AlignLeft:X4,AlignLeftIcon:X4,AlignRight:Q4,AlignRightIcon:Q4,AlignStartHorizontal:zO,AlignStartHorizontalIcon:zO,AlignStartVertical:BO,AlignStartVerticalIcon:BO,AlignVerticalDistributeCenter:$O,AlignVerticalDistributeCenterIcon:$O,AlignVerticalDistributeEnd:UO,AlignVerticalDistributeEndIcon:UO,AlignVerticalDistributeStart:qO,AlignVerticalDistributeStartIcon:qO,AlignVerticalJustifyCenter:VO,AlignVerticalJustifyCenterIcon:VO,AlignVerticalJustifyEnd:HO,AlignVerticalJustifyEndIcon:HO,AlignVerticalJustifyStart:WO,AlignVerticalJustifyStartIcon:WO,AlignVerticalSpaceAround:GO,AlignVerticalSpaceAroundIcon:GO,AlignVerticalSpaceBetween:KO,AlignVerticalSpaceBetweenIcon:KO,Ambulance:ZO,AmbulanceIcon:ZO,Ampersand:YO,AmpersandIcon:YO,Ampersands:XO,AmpersandsIcon:XO,Amphora:QO,AmphoraIcon:QO,Anchor:JO,AnchorIcon:JO,Angry:e8,AngryIcon:e8,Annoyed:t8,AnnoyedIcon:t8,Antenna:r8,AntennaIcon:r8,Anvil:n8,AnvilIcon:n8,Aperture:s8,ApertureIcon:s8,AppWindow:kT,AppWindowIcon:kT,AppWindowMac:a8,AppWindowMacIcon:a8,Apple:i8,AppleIcon:i8,Archive:c8,ArchiveIcon:c8,ArchiveRestore:o8,ArchiveRestoreIcon:o8,ArchiveX:l8,ArchiveXIcon:l8,AreaChart:M_,AreaChartIcon:M_,Armchair:d8,ArmchairIcon:d8,ArrowBigDown:h8,ArrowBigDownDash:u8,ArrowBigDownDashIcon:u8,ArrowBigDownIcon:h8,ArrowBigLeft:p8,ArrowBigLeftDash:f8,ArrowBigLeftDashIcon:f8,ArrowBigLeftIcon:p8,ArrowBigRight:g8,ArrowBigRightDash:m8,ArrowBigRightDashIcon:m8,ArrowBigRightIcon:g8,ArrowBigUp:y8,ArrowBigUpDash:x8,ArrowBigUpDashIcon:x8,ArrowBigUpIcon:y8,ArrowDown:i1,ArrowDown01:v8,ArrowDown01Icon:v8,ArrowDown10:_8,ArrowDown10Icon:_8,ArrowDownAZ:m_,ArrowDownAZIcon:m_,ArrowDownAz:m_,ArrowDownAzIcon:m_,ArrowDownCircle:B_,ArrowDownCircleIcon:B_,ArrowDownFromLine:b8,ArrowDownFromLineIcon:b8,ArrowDownIcon:i1,ArrowDownLeft:w8,ArrowDownLeftFromCircle:U_,ArrowDownLeftFromCircleIcon:U_,ArrowDownLeftFromSquare:gb,ArrowDownLeftFromSquareIcon:gb,ArrowDownLeftIcon:w8,ArrowDownLeftSquare:hb,ArrowDownLeftSquareIcon:hb,ArrowDownNarrowWide:j8,ArrowDownNarrowWideIcon:j8,ArrowDownRight:k8,ArrowDownRightFromCircle:q_,ArrowDownRightFromCircleIcon:q_,ArrowDownRightFromSquare:xb,ArrowDownRightFromSquareIcon:xb,ArrowDownRightIcon:k8,ArrowDownRightSquare:fb,ArrowDownRightSquareIcon:fb,ArrowDownSquare:pb,ArrowDownSquareIcon:pb,ArrowDownToDot:N8,ArrowDownToDotIcon:N8,ArrowDownToLine:S8,ArrowDownToLineIcon:S8,ArrowDownUp:C8,ArrowDownUpIcon:C8,ArrowDownWideNarrow:g_,ArrowDownWideNarrowIcon:g_,ArrowDownZA:x_,ArrowDownZAIcon:x_,ArrowDownZa:x_,ArrowDownZaIcon:x_,ArrowLeft:so,ArrowLeftCircle:$_,ArrowLeftCircleIcon:$_,ArrowLeftFromLine:M8,ArrowLeftFromLineIcon:M8,ArrowLeftIcon:so,ArrowLeftRight:T8,ArrowLeftRightIcon:T8,ArrowLeftSquare:mb,ArrowLeftSquareIcon:mb,ArrowLeftToLine:A8,ArrowLeftToLineIcon:A8,ArrowRight:dl,ArrowRightCircle:W_,ArrowRightCircleIcon:W_,ArrowRightFromLine:E8,ArrowRightFromLineIcon:E8,ArrowRightIcon:dl,ArrowRightLeft:I8,ArrowRightLeftIcon:I8,ArrowRightSquare:_b,ArrowRightSquareIcon:_b,ArrowRightToLine:P8,ArrowRightToLineIcon:P8,ArrowUp:mg,ArrowUp01:L8,ArrowUp01Icon:L8,ArrowUp10:O8,ArrowUp10Icon:O8,ArrowUpAZ:y_,ArrowUpAZIcon:y_,ArrowUpAz:y_,ArrowUpAzIcon:y_,ArrowUpCircle:G_,ArrowUpCircleIcon:G_,ArrowUpDown:zx,ArrowUpDownIcon:zx,ArrowUpFromDot:D8,ArrowUpFromDotIcon:D8,ArrowUpFromLine:R8,ArrowUpFromLineIcon:R8,ArrowUpIcon:mg,ArrowUpLeft:F8,ArrowUpLeftFromCircle:V_,ArrowUpLeftFromCircleIcon:V_,ArrowUpLeftFromSquare:yb,ArrowUpLeftFromSquareIcon:yb,ArrowUpLeftIcon:F8,ArrowUpLeftSquare:bb,ArrowUpLeftSquareIcon:bb,ArrowUpNarrowWide:v_,ArrowUpNarrowWideIcon:v_,ArrowUpRight:z8,ArrowUpRightFromCircle:H_,ArrowUpRightFromCircleIcon:H_,ArrowUpRightFromSquare:vb,ArrowUpRightFromSquareIcon:vb,ArrowUpRightIcon:z8,ArrowUpRightSquare:wb,ArrowUpRightSquareIcon:wb,ArrowUpSquare:jb,ArrowUpSquareIcon:jb,ArrowUpToLine:B8,ArrowUpToLineIcon:B8,ArrowUpWideNarrow:$8,ArrowUpWideNarrowIcon:$8,ArrowUpZA:__,ArrowUpZAIcon:__,ArrowUpZa:__,ArrowUpZaIcon:__,ArrowsUpFromLine:U8,ArrowsUpFromLineIcon:U8,Asterisk:q8,AsteriskIcon:q8,AsteriskSquare:kb,AsteriskSquareIcon:kb,AtSign:V8,AtSignIcon:V8,Atom:H8,AtomIcon:H8,AudioLines:W8,AudioLinesIcon:W8,AudioWaveform:G8,AudioWaveformIcon:G8,Award:Ol,AwardIcon:Ol,Axe:K8,AxeIcon:K8,Axis3D:b_,Axis3DIcon:b_,Axis3d:b_,Axis3dIcon:b_,Baby:Z8,BabyIcon:Z8,Backpack:Y8,BackpackIcon:Y8,Badge:hD,BadgeAlert:X8,BadgeAlertIcon:X8,BadgeCent:Q8,BadgeCentIcon:Q8,BadgeCheck:w_,BadgeCheckIcon:w_,BadgeDollarSign:J8,BadgeDollarSignIcon:J8,BadgeEuro:eD,BadgeEuroIcon:eD,BadgeHelp:tD,BadgeHelpIcon:tD,BadgeIcon:hD,BadgeIndianRupee:rD,BadgeIndianRupeeIcon:rD,BadgeInfo:nD,BadgeInfoIcon:nD,BadgeJapaneseYen:sD,BadgeJapaneseYenIcon:sD,BadgeMinus:aD,BadgeMinusIcon:aD,BadgePercent:iD,BadgePercentIcon:iD,BadgePlus:oD,BadgePlusIcon:oD,BadgePoundSterling:lD,BadgePoundSterlingIcon:lD,BadgeRussianRuble:cD,BadgeRussianRubleIcon:cD,BadgeSwissFranc:dD,BadgeSwissFrancIcon:dD,BadgeX:uD,BadgeXIcon:uD,BaggageClaim:fD,BaggageClaimIcon:fD,Ban:pD,BanIcon:pD,Banana:mD,BananaIcon:mD,Bandage:gD,BandageIcon:gD,Banknote:xD,BanknoteIcon:xD,BarChart:O_,BarChart2:D_,BarChart2Icon:D_,BarChart3:cc,BarChart3Icon:cc,BarChart4:P_,BarChart4Icon:P_,BarChartBig:I_,BarChartBigIcon:I_,BarChartHorizontal:A_,BarChartHorizontalBig:T_,BarChartHorizontalBigIcon:T_,BarChartHorizontalIcon:A_,BarChartIcon:O_,Barcode:yD,BarcodeIcon:yD,Baseline:vD,BaselineIcon:vD,Bath:o1,BathIcon:o1,Battery:ND,BatteryCharging:_D,BatteryChargingIcon:_D,BatteryFull:bD,BatteryFullIcon:bD,BatteryIcon:ND,BatteryLow:wD,BatteryLowIcon:wD,BatteryMedium:jD,BatteryMediumIcon:jD,BatteryWarning:kD,BatteryWarningIcon:kD,Beaker:SD,BeakerIcon:SD,Bean:MD,BeanIcon:MD,BeanOff:CD,BeanOffIcon:CD,Bed:l1,BedDouble:TD,BedDoubleIcon:TD,BedIcon:l1,BedSingle:AD,BedSingleIcon:AD,Beef:ED,BeefIcon:ED,Beer:PD,BeerIcon:PD,BeerOff:ID,BeerOffIcon:ID,Bell:gg,BellDot:LD,BellDotIcon:LD,BellElectric:OD,BellElectricIcon:OD,BellIcon:gg,BellMinus:DD,BellMinusIcon:DD,BellOff:oj,BellOffIcon:oj,BellPlus:RD,BellPlusIcon:RD,BellRing:FD,BellRingIcon:FD,BetweenHorizonalEnd:j_,BetweenHorizonalEndIcon:j_,BetweenHorizonalStart:k_,BetweenHorizonalStartIcon:k_,BetweenHorizontalEnd:j_,BetweenHorizontalEndIcon:j_,BetweenHorizontalStart:k_,BetweenHorizontalStartIcon:k_,BetweenVerticalEnd:zD,BetweenVerticalEndIcon:zD,BetweenVerticalStart:BD,BetweenVerticalStartIcon:BD,BicepsFlexed:$D,BicepsFlexedIcon:$D,Bike:UD,BikeIcon:UD,Binary:qD,BinaryIcon:qD,Binoculars:VD,BinocularsIcon:VD,Biohazard:HD,BiohazardIcon:HD,Bird:WD,BirdIcon:WD,Bitcoin:GD,BitcoinIcon:GD,Blend:KD,BlendIcon:KD,Blinds:ZD,BlindsIcon:ZD,Blocks:YD,BlocksIcon:YD,Bluetooth:eR,BluetoothConnected:XD,BluetoothConnectedIcon:XD,BluetoothIcon:eR,BluetoothOff:QD,BluetoothOffIcon:QD,BluetoothSearching:JD,BluetoothSearchingIcon:JD,Bold:J4,BoldIcon:J4,Bolt:tR,BoltIcon:tR,Bomb:rR,BombIcon:rR,Bone:nR,BoneIcon:nR,Book:NR,BookA:sR,BookAIcon:sR,BookAudio:aR,BookAudioIcon:aR,BookCheck:iR,BookCheckIcon:iR,BookCopy:oR,BookCopyIcon:oR,BookDashed:N_,BookDashedIcon:N_,BookDown:lR,BookDownIcon:lR,BookHeadphones:cR,BookHeadphonesIcon:cR,BookHeart:dR,BookHeartIcon:dR,BookIcon:NR,BookImage:uR,BookImageIcon:uR,BookKey:hR,BookKeyIcon:hR,BookLock:fR,BookLockIcon:fR,BookMarked:pR,BookMarkedIcon:pR,BookMinus:mR,BookMinusIcon:mR,BookOpen:NT,BookOpenCheck:gR,BookOpenCheckIcon:gR,BookOpenIcon:NT,BookOpenText:xR,BookOpenTextIcon:xR,BookPlus:yR,BookPlusIcon:yR,BookTemplate:N_,BookTemplateIcon:N_,BookText:vR,BookTextIcon:vR,BookType:_R,BookTypeIcon:_R,BookUp:wR,BookUp2:bR,BookUp2Icon:bR,BookUpIcon:wR,BookUser:jR,BookUserIcon:jR,BookX:kR,BookXIcon:kR,Bookmark:um,BookmarkCheck:SR,BookmarkCheckIcon:SR,BookmarkIcon:um,BookmarkMinus:CR,BookmarkMinusIcon:CR,BookmarkPlus:ST,BookmarkPlusIcon:ST,BookmarkX:MR,BookmarkXIcon:MR,BoomBox:TR,BoomBoxIcon:TR,Bot:eS,BotIcon:eS,BotMessageSquare:AR,BotMessageSquareIcon:AR,BotOff:ER,BotOffIcon:ER,Box:IR,BoxIcon:IR,BoxSelect:Lb,BoxSelectIcon:Lb,Boxes:PR,BoxesIcon:PR,Braces:S_,BracesIcon:S_,Brackets:LR,BracketsIcon:LR,Brain:CT,BrainCircuit:OR,BrainCircuitIcon:OR,BrainCog:DR,BrainCogIcon:DR,BrainIcon:CT,BrickWall:RR,BrickWallIcon:RR,Briefcase:yh,BriefcaseBusiness:FR,BriefcaseBusinessIcon:FR,BriefcaseConveyorBelt:zR,BriefcaseConveyorBeltIcon:zR,BriefcaseIcon:yh,BriefcaseMedical:BR,BriefcaseMedicalIcon:BR,BringToFront:$R,BringToFrontIcon:$R,Brush:UR,BrushIcon:UR,Bug:HR,BugIcon:HR,BugOff:qR,BugOffIcon:qR,BugPlay:VR,BugPlayIcon:VR,Building:lj,Building2:ai,Building2Icon:ai,BuildingIcon:lj,Bus:GR,BusFront:WR,BusFrontIcon:WR,BusIcon:GR,Cable:ZR,CableCar:KR,CableCarIcon:KR,CableIcon:ZR,Cake:Qh,CakeIcon:Qh,CakeSlice:YR,CakeSliceIcon:YR,Calculator:XR,CalculatorIcon:XR,Calendar:zs,Calendar1:QR,Calendar1Icon:QR,CalendarArrowDown:JR,CalendarArrowDownIcon:JR,CalendarArrowUp:eF,CalendarArrowUpIcon:eF,CalendarCheck:rF,CalendarCheck2:tF,CalendarCheck2Icon:tF,CalendarCheckIcon:rF,CalendarClock:nF,CalendarClockIcon:nF,CalendarCog:sF,CalendarCogIcon:sF,CalendarDays:hm,CalendarDaysIcon:hm,CalendarFold:aF,CalendarFoldIcon:aF,CalendarHeart:iF,CalendarHeartIcon:iF,CalendarIcon:zs,CalendarMinus:lF,CalendarMinus2:oF,CalendarMinus2Icon:oF,CalendarMinusIcon:lF,CalendarOff:cF,CalendarOffIcon:cF,CalendarPlus:cj,CalendarPlus2:dF,CalendarPlus2Icon:dF,CalendarPlusIcon:cj,CalendarRange:uF,CalendarRangeIcon:uF,CalendarSearch:hF,CalendarSearchIcon:hF,CalendarSync:fF,CalendarSyncIcon:fF,CalendarX:mF,CalendarX2:pF,CalendarX2Icon:pF,CalendarXIcon:mF,Camera:xg,CameraIcon:xg,CameraOff:gF,CameraOffIcon:gF,CandlestickChart:E_,CandlestickChartIcon:E_,Candy:vF,CandyCane:xF,CandyCaneIcon:xF,CandyIcon:vF,CandyOff:yF,CandyOffIcon:yF,Cannabis:_F,CannabisIcon:_F,Captions:C_,CaptionsIcon:C_,CaptionsOff:bF,CaptionsOffIcon:bF,Car:kF,CarFront:wF,CarFrontIcon:wF,CarIcon:kF,CarTaxiFront:jF,CarTaxiFrontIcon:jF,Caravan:NF,CaravanIcon:NF,Carrot:SF,CarrotIcon:SF,CaseLower:CF,CaseLowerIcon:CF,CaseSensitive:MF,CaseSensitiveIcon:MF,CaseUpper:TF,CaseUpperIcon:TF,CassetteTape:AF,CassetteTapeIcon:AF,Cast:EF,CastIcon:EF,Castle:IF,CastleIcon:IF,Cat:PF,CatIcon:PF,Cctv:LF,CctvIcon:LF,ChartArea:M_,ChartAreaIcon:M_,ChartBar:A_,ChartBarBig:T_,ChartBarBigIcon:T_,ChartBarDecreasing:OF,ChartBarDecreasingIcon:OF,ChartBarIcon:A_,ChartBarIncreasing:DF,ChartBarIncreasingIcon:DF,ChartBarStacked:RF,ChartBarStackedIcon:RF,ChartCandlestick:E_,ChartCandlestickIcon:E_,ChartColumn:cc,ChartColumnBig:I_,ChartColumnBigIcon:I_,ChartColumnDecreasing:FF,ChartColumnDecreasingIcon:FF,ChartColumnIcon:cc,ChartColumnIncreasing:P_,ChartColumnIncreasingIcon:P_,ChartColumnStacked:zF,ChartColumnStackedIcon:zF,ChartGantt:BF,ChartGanttIcon:BF,ChartLine:L_,ChartLineIcon:L_,ChartNetwork:$F,ChartNetworkIcon:$F,ChartNoAxesColumn:D_,ChartNoAxesColumnDecreasing:UF,ChartNoAxesColumnDecreasingIcon:UF,ChartNoAxesColumnIcon:D_,ChartNoAxesColumnIncreasing:O_,ChartNoAxesColumnIncreasingIcon:O_,ChartNoAxesCombined:qF,ChartNoAxesCombinedIcon:qF,ChartNoAxesGantt:R_,ChartNoAxesGanttIcon:R_,ChartPie:F_,ChartPieIcon:F_,ChartScatter:z_,ChartScatterIcon:z_,ChartSpline:VF,ChartSplineIcon:VF,Check:Ai,CheckCheck:HF,CheckCheckIcon:HF,CheckCircle:Yi,CheckCircle2:Xi,CheckCircle2Icon:Xi,CheckCircleIcon:Yi,CheckIcon:Ai,CheckSquare:x0,CheckSquare2:Sb,CheckSquare2Icon:Sb,CheckSquareIcon:x0,ChefHat:WF,ChefHatIcon:WF,Cherry:GF,CherryIcon:GF,ChevronDown:Dd,ChevronDownCircle:K_,ChevronDownCircleIcon:K_,ChevronDownIcon:Dd,ChevronDownSquare:Cb,ChevronDownSquareIcon:Cb,ChevronFirst:KF,ChevronFirstIcon:KF,ChevronLast:ZF,ChevronLastIcon:ZF,ChevronLeft:Tc,ChevronLeftCircle:Z_,ChevronLeftCircleIcon:Z_,ChevronLeftIcon:Tc,ChevronLeftSquare:Mb,ChevronLeftSquareIcon:Mb,ChevronRight:Vi,ChevronRightCircle:Y_,ChevronRightCircleIcon:Y_,ChevronRightIcon:Vi,ChevronRightSquare:Tb,ChevronRightSquareIcon:Tb,ChevronUp:c1,ChevronUpCircle:X_,ChevronUpCircleIcon:X_,ChevronUpIcon:c1,ChevronUpSquare:Ab,ChevronUpSquareIcon:Ab,ChevronsDown:XF,ChevronsDownIcon:XF,ChevronsDownUp:YF,ChevronsDownUpIcon:YF,ChevronsLeft:ez,ChevronsLeftIcon:ez,ChevronsLeftRight:JF,ChevronsLeftRightEllipsis:QF,ChevronsLeftRightEllipsisIcon:QF,ChevronsLeftRightIcon:JF,ChevronsRight:rz,ChevronsRightIcon:rz,ChevronsRightLeft:tz,ChevronsRightLeftIcon:tz,ChevronsUp:nz,ChevronsUpDown:d1,ChevronsUpDownIcon:d1,ChevronsUpIcon:nz,Chrome:sz,ChromeIcon:sz,Church:az,ChurchIcon:az,Cigarette:oz,CigaretteIcon:oz,CigaretteOff:iz,CigaretteOffIcon:iz,Circle:Ru,CircleAlert:Il,CircleAlertIcon:Il,CircleArrowDown:B_,CircleArrowDownIcon:B_,CircleArrowLeft:$_,CircleArrowLeftIcon:$_,CircleArrowOutDownLeft:U_,CircleArrowOutDownLeftIcon:U_,CircleArrowOutDownRight:q_,CircleArrowOutDownRightIcon:q_,CircleArrowOutUpLeft:V_,CircleArrowOutUpLeftIcon:V_,CircleArrowOutUpRight:H_,CircleArrowOutUpRightIcon:H_,CircleArrowRight:W_,CircleArrowRightIcon:W_,CircleArrowUp:G_,CircleArrowUpIcon:G_,CircleCheck:Xi,CircleCheckBig:Yi,CircleCheckBigIcon:Yi,CircleCheckIcon:Xi,CircleChevronDown:K_,CircleChevronDownIcon:K_,CircleChevronLeft:Z_,CircleChevronLeftIcon:Z_,CircleChevronRight:Y_,CircleChevronRightIcon:Y_,CircleChevronUp:X_,CircleChevronUpIcon:X_,CircleDashed:lz,CircleDashedIcon:lz,CircleDivide:Q_,CircleDivideIcon:Q_,CircleDollarSign:cz,CircleDollarSignIcon:cz,CircleDot:uz,CircleDotDashed:dz,CircleDotDashedIcon:dz,CircleDotIcon:uz,CircleEllipsis:hz,CircleEllipsisIcon:hz,CircleEqual:fz,CircleEqualIcon:fz,CircleFadingArrowUp:pz,CircleFadingArrowUpIcon:pz,CircleFadingPlus:mz,CircleFadingPlusIcon:mz,CircleGauge:J_,CircleGaugeIcon:J_,CircleHelp:Nx,CircleHelpIcon:Nx,CircleIcon:Ru,CircleMinus:e2,CircleMinusIcon:e2,CircleOff:gz,CircleOffIcon:gz,CircleParking:r2,CircleParkingIcon:r2,CircleParkingOff:t2,CircleParkingOffIcon:t2,CirclePause:n2,CirclePauseIcon:n2,CirclePercent:s2,CirclePercentIcon:s2,CirclePlay:Bf,CirclePlayIcon:Bf,CirclePlus:a2,CirclePlusIcon:a2,CirclePower:i2,CirclePowerIcon:i2,CircleSlash:xz,CircleSlash2:o2,CircleSlash2Icon:o2,CircleSlashIcon:xz,CircleSlashed:o2,CircleSlashedIcon:o2,CircleStop:l2,CircleStopIcon:l2,CircleUser:d2,CircleUserIcon:d2,CircleUserRound:c2,CircleUserRoundIcon:c2,CircleX:qc,CircleXIcon:qc,CircuitBoard:yz,CircuitBoardIcon:yz,Citrus:vz,CitrusIcon:vz,Clapperboard:_z,ClapperboardIcon:_z,Clipboard:Cz,ClipboardCheck:MT,ClipboardCheckIcon:MT,ClipboardCopy:bz,ClipboardCopyIcon:bz,ClipboardEdit:h2,ClipboardEditIcon:h2,ClipboardIcon:Cz,ClipboardList:TT,ClipboardListIcon:TT,ClipboardMinus:wz,ClipboardMinusIcon:wz,ClipboardPaste:jz,ClipboardPasteIcon:jz,ClipboardPen:h2,ClipboardPenIcon:h2,ClipboardPenLine:u2,ClipboardPenLineIcon:u2,ClipboardPlus:kz,ClipboardPlusIcon:kz,ClipboardSignature:u2,ClipboardSignatureIcon:u2,ClipboardType:Nz,ClipboardTypeIcon:Nz,ClipboardX:Sz,ClipboardXIcon:Sz,Clock:Ya,Clock1:Mz,Clock10:Tz,Clock10Icon:Tz,Clock11:Az,Clock11Icon:Az,Clock12:Ez,Clock12Icon:Ez,Clock1Icon:Mz,Clock2:Iz,Clock2Icon:Iz,Clock3:Pz,Clock3Icon:Pz,Clock4:Lz,Clock4Icon:Lz,Clock5:Oz,Clock5Icon:Oz,Clock6:Dz,Clock6Icon:Dz,Clock7:Rz,Clock7Icon:Rz,Clock8:Fz,Clock8Icon:Fz,Clock9:zz,Clock9Icon:zz,ClockAlert:Bz,ClockAlertIcon:Bz,ClockArrowDown:$z,ClockArrowDownIcon:$z,ClockArrowUp:Uz,ClockArrowUpIcon:Uz,ClockIcon:Ya,Cloud:n7,CloudAlert:qz,CloudAlertIcon:qz,CloudCog:Vz,CloudCogIcon:Vz,CloudDownload:f2,CloudDownloadIcon:f2,CloudDrizzle:Hz,CloudDrizzleIcon:Hz,CloudFog:Wz,CloudFogIcon:Wz,CloudHail:Gz,CloudHailIcon:Gz,CloudIcon:n7,CloudLightning:Kz,CloudLightningIcon:Kz,CloudMoon:Yz,CloudMoonIcon:Yz,CloudMoonRain:Zz,CloudMoonRainIcon:Zz,CloudOff:Xz,CloudOffIcon:Xz,CloudRain:Jz,CloudRainIcon:Jz,CloudRainWind:Qz,CloudRainWindIcon:Qz,CloudSnow:e7,CloudSnowIcon:e7,CloudSun:r7,CloudSunIcon:r7,CloudSunRain:t7,CloudSunRainIcon:t7,CloudUpload:p2,CloudUploadIcon:p2,Cloudy:s7,CloudyIcon:s7,Clover:Px,CloverIcon:Px,Club:a7,ClubIcon:a7,Code:dj,Code2:m2,Code2Icon:m2,CodeIcon:dj,CodeSquare:Eb,CodeSquareIcon:Eb,CodeXml:m2,CodeXmlIcon:m2,Codepen:i7,CodepenIcon:i7,Codesandbox:o7,CodesandboxIcon:o7,Coffee:uj,CoffeeIcon:uj,Cog:l7,CogIcon:l7,Coins:c7,CoinsIcon:c7,Columns:g2,Columns2:g2,Columns2Icon:g2,Columns3:x2,Columns3Icon:x2,Columns4:d7,Columns4Icon:d7,ColumnsIcon:g2,Combine:u7,CombineIcon:u7,Command:h7,CommandIcon:h7,Compass:f7,CompassIcon:f7,Component:p7,ComponentIcon:p7,Computer:m7,ComputerIcon:m7,ConciergeBell:g7,ConciergeBellIcon:g7,Cone:x7,ConeIcon:x7,Construction:y7,ConstructionIcon:y7,Contact:v7,Contact2:y2,Contact2Icon:y2,ContactIcon:v7,ContactRound:y2,ContactRoundIcon:y2,Container:_7,ContainerIcon:_7,Contrast:b7,ContrastIcon:b7,Cookie:w7,CookieIcon:w7,CookingPot:j7,CookingPotIcon:j7,Copy:hl,CopyCheck:k7,CopyCheckIcon:k7,CopyIcon:hl,CopyMinus:N7,CopyMinusIcon:N7,CopyPlus:S7,CopyPlusIcon:S7,CopySlash:C7,CopySlashIcon:C7,CopyX:M7,CopyXIcon:M7,Copyleft:T7,CopyleftIcon:T7,Copyright:A7,CopyrightIcon:A7,CornerDownLeft:E7,CornerDownLeftIcon:E7,CornerDownRight:I7,CornerDownRightIcon:I7,CornerLeftDown:P7,CornerLeftDownIcon:P7,CornerLeftUp:L7,CornerLeftUpIcon:L7,CornerRightDown:O7,CornerRightDownIcon:O7,CornerRightUp:D7,CornerRightUpIcon:D7,CornerUpLeft:R7,CornerUpLeftIcon:R7,CornerUpRight:F7,CornerUpRightIcon:F7,Cpu:z7,CpuIcon:z7,CreativeCommons:B7,CreativeCommonsIcon:B7,CreditCard:fm,CreditCardIcon:fm,Croissant:$7,CroissantIcon:$7,Crop:U7,CropIcon:U7,Cross:q7,CrossIcon:q7,Crosshair:V7,CrosshairIcon:V7,Crown:u1,CrownIcon:u1,Cuboid:H7,CuboidIcon:H7,CupSoda:W7,CupSodaIcon:W7,CurlyBraces:S_,CurlyBracesIcon:S_,Currency:G7,CurrencyIcon:G7,Cylinder:K7,CylinderIcon:K7,Dam:Z7,DamIcon:Z7,Database:Q7,DatabaseBackup:Y7,DatabaseBackupIcon:Y7,DatabaseIcon:Q7,DatabaseZap:X7,DatabaseZapIcon:X7,Delete:J7,DeleteIcon:J7,Dessert:e9,DessertIcon:e9,Diameter:t9,DiameterIcon:t9,Diamond:s9,DiamondIcon:s9,DiamondMinus:r9,DiamondMinusIcon:r9,DiamondPercent:v2,DiamondPercentIcon:v2,DiamondPlus:n9,DiamondPlusIcon:n9,Dice1:a9,Dice1Icon:a9,Dice2:i9,Dice2Icon:i9,Dice3:o9,Dice3Icon:o9,Dice4:l9,Dice4Icon:l9,Dice5:c9,Dice5Icon:c9,Dice6:d9,Dice6Icon:d9,Dices:u9,DicesIcon:u9,Diff:h9,DiffIcon:h9,Disc:g9,Disc2:f9,Disc2Icon:f9,Disc3:p9,Disc3Icon:p9,DiscAlbum:m9,DiscAlbumIcon:m9,DiscIcon:g9,Divide:x9,DivideCircle:Q_,DivideCircleIcon:Q_,DivideIcon:x9,DivideSquare:Ob,DivideSquareIcon:Ob,Dna:v9,DnaIcon:v9,DnaOff:y9,DnaOffIcon:y9,Dock:_9,DockIcon:_9,Dog:b9,DogIcon:b9,DollarSign:hd,DollarSignIcon:hd,Donut:w9,DonutIcon:w9,DoorClosed:j9,DoorClosedIcon:j9,DoorOpen:hj,DoorOpenIcon:hj,Dot:k9,DotIcon:k9,DotSquare:Db,DotSquareIcon:Db,Download:no,DownloadCloud:f2,DownloadCloudIcon:f2,DownloadIcon:no,DraftingCompass:N9,DraftingCompassIcon:N9,Drama:S9,DramaIcon:S9,Dribbble:C9,DribbbleIcon:C9,Drill:M9,DrillIcon:M9,Droplet:T9,DropletIcon:T9,Droplets:A9,DropletsIcon:A9,Drum:E9,DrumIcon:E9,Drumstick:I9,DrumstickIcon:I9,Dumbbell:P9,DumbbellIcon:P9,Ear:O9,EarIcon:O9,EarOff:L9,EarOffIcon:L9,Earth:_2,EarthIcon:_2,EarthLock:D9,EarthLockIcon:D9,Eclipse:R9,EclipseIcon:R9,Edit:ac,Edit2:g0,Edit2Icon:g0,Edit3:tb,Edit3Icon:tb,EditIcon:ac,Egg:tS,EggFried:F9,EggFriedIcon:F9,EggIcon:tS,EggOff:z9,EggOffIcon:z9,Ellipsis:em,EllipsisIcon:em,EllipsisVertical:Sx,EllipsisVerticalIcon:Sx,Equal:U9,EqualApproximately:B9,EqualApproximatelyIcon:B9,EqualIcon:U9,EqualNot:$9,EqualNotIcon:$9,EqualSquare:Rb,EqualSquareIcon:Rb,Eraser:q9,EraserIcon:q9,EthernetPort:V9,EthernetPortIcon:V9,Euro:H9,EuroIcon:H9,Expand:W9,ExpandIcon:W9,ExternalLink:Fs,ExternalLinkIcon:Fs,Eye:Qo,EyeClosed:G9,EyeClosedIcon:G9,EyeIcon:Qo,EyeOff:h1,EyeOffIcon:h1,Facebook:Rd,FacebookIcon:Rd,Factory:K9,FactoryIcon:K9,Fan:Z9,FanIcon:Z9,FastForward:Y9,FastForwardIcon:Y9,Feather:X9,FeatherIcon:X9,Fence:Q9,FenceIcon:Q9,FerrisWheel:J9,FerrisWheelIcon:J9,Figma:eB,FigmaIcon:eB,File:KB,FileArchive:tB,FileArchiveIcon:tB,FileAudio:nB,FileAudio2:rB,FileAudio2Icon:rB,FileAudioIcon:nB,FileAxis3D:b2,FileAxis3DIcon:b2,FileAxis3d:b2,FileAxis3dIcon:b2,FileBadge:aB,FileBadge2:sB,FileBadge2Icon:sB,FileBadgeIcon:aB,FileBarChart:w2,FileBarChart2:j2,FileBarChart2Icon:j2,FileBarChartIcon:w2,FileBox:iB,FileBoxIcon:iB,FileChartColumn:j2,FileChartColumnIcon:j2,FileChartColumnIncreasing:w2,FileChartColumnIncreasingIcon:w2,FileChartLine:k2,FileChartLineIcon:k2,FileChartPie:N2,FileChartPieIcon:N2,FileCheck:lB,FileCheck2:oB,FileCheck2Icon:oB,FileCheckIcon:lB,FileClock:cB,FileClockIcon:cB,FileCode:uB,FileCode2:dB,FileCode2Icon:dB,FileCodeIcon:uB,FileCog:S2,FileCog2:S2,FileCog2Icon:S2,FileCogIcon:S2,FileDiff:hB,FileDiffIcon:hB,FileDigit:fB,FileDigitIcon:fB,FileDown:pB,FileDownIcon:pB,FileEdit:M2,FileEditIcon:M2,FileHeart:mB,FileHeartIcon:mB,FileIcon:KB,FileImage:f1,FileImageIcon:f1,FileInput:gB,FileInputIcon:gB,FileJson:yB,FileJson2:xB,FileJson2Icon:xB,FileJsonIcon:yB,FileKey:_B,FileKey2:vB,FileKey2Icon:vB,FileKeyIcon:_B,FileLineChart:k2,FileLineChartIcon:k2,FileLock:wB,FileLock2:bB,FileLock2Icon:bB,FileLockIcon:wB,FileMinus:kB,FileMinus2:jB,FileMinus2Icon:jB,FileMinusIcon:kB,FileMusic:NB,FileMusicIcon:NB,FileOutput:SB,FileOutputIcon:SB,FilePen:M2,FilePenIcon:M2,FilePenLine:C2,FilePenLineIcon:C2,FilePieChart:N2,FilePieChartIcon:N2,FilePlus:MB,FilePlus2:CB,FilePlus2Icon:CB,FilePlusIcon:MB,FileQuestion:TB,FileQuestionIcon:TB,FileScan:AB,FileScanIcon:AB,FileSearch:IB,FileSearch2:EB,FileSearch2Icon:EB,FileSearchIcon:IB,FileSignature:C2,FileSignatureIcon:C2,FileSliders:PB,FileSlidersIcon:PB,FileSpreadsheet:p1,FileSpreadsheetIcon:p1,FileStack:LB,FileStackIcon:LB,FileSymlink:OB,FileSymlinkIcon:OB,FileTerminal:DB,FileTerminalIcon:DB,FileText:La,FileTextIcon:La,FileType:FB,FileType2:RB,FileType2Icon:RB,FileTypeIcon:FB,FileUp:zB,FileUpIcon:zB,FileUser:BB,FileUserIcon:BB,FileVideo:UB,FileVideo2:$B,FileVideo2Icon:$B,FileVideoIcon:UB,FileVolume:VB,FileVolume2:qB,FileVolume2Icon:qB,FileVolumeIcon:VB,FileWarning:HB,FileWarningIcon:HB,FileX:GB,FileX2:WB,FileX2Icon:WB,FileXIcon:GB,Files:ZB,FilesIcon:ZB,Film:Ad,FilmIcon:Ad,Filter:m1,FilterIcon:m1,FilterX:YB,FilterXIcon:YB,Fingerprint:XB,FingerprintIcon:XB,FireExtinguisher:QB,FireExtinguisherIcon:QB,Fish:t$,FishIcon:t$,FishOff:JB,FishOffIcon:JB,FishSymbol:e$,FishSymbolIcon:e$,Flag:Bx,FlagIcon:Bx,FlagOff:r$,FlagOffIcon:r$,FlagTriangleLeft:n$,FlagTriangleLeftIcon:n$,FlagTriangleRight:s$,FlagTriangleRightIcon:s$,Flame:Jh,FlameIcon:Jh,FlameKindling:a$,FlameKindlingIcon:a$,Flashlight:o$,FlashlightIcon:o$,FlashlightOff:i$,FlashlightOffIcon:i$,FlaskConical:fj,FlaskConicalIcon:fj,FlaskConicalOff:l$,FlaskConicalOffIcon:l$,FlaskRound:c$,FlaskRoundIcon:c$,FlipHorizontal:u$,FlipHorizontal2:d$,FlipHorizontal2Icon:d$,FlipHorizontalIcon:u$,FlipVertical:f$,FlipVertical2:h$,FlipVertical2Icon:h$,FlipVerticalIcon:f$,Flower:p$,Flower2:am,Flower2Icon:am,FlowerIcon:p$,Focus:m$,FocusIcon:m$,FoldHorizontal:g$,FoldHorizontalIcon:g$,FoldVertical:x$,FoldVerticalIcon:x$,Folder:V$,FolderArchive:y$,FolderArchiveIcon:y$,FolderCheck:v$,FolderCheckIcon:v$,FolderClock:_$,FolderClockIcon:_$,FolderClosed:b$,FolderClosedIcon:b$,FolderCode:w$,FolderCodeIcon:w$,FolderCog:T2,FolderCog2:T2,FolderCog2Icon:T2,FolderCogIcon:T2,FolderDot:j$,FolderDotIcon:j$,FolderDown:k$,FolderDownIcon:k$,FolderEdit:A2,FolderEditIcon:A2,FolderGit:S$,FolderGit2:N$,FolderGit2Icon:N$,FolderGitIcon:S$,FolderHeart:C$,FolderHeartIcon:C$,FolderIcon:V$,FolderInput:M$,FolderInputIcon:M$,FolderKanban:T$,FolderKanbanIcon:T$,FolderKey:A$,FolderKeyIcon:A$,FolderLock:E$,FolderLockIcon:E$,FolderMinus:I$,FolderMinusIcon:I$,FolderOpen:$x,FolderOpenDot:P$,FolderOpenDotIcon:P$,FolderOpenIcon:$x,FolderOutput:L$,FolderOutputIcon:L$,FolderPen:A2,FolderPenIcon:A2,FolderPlus:O$,FolderPlusIcon:O$,FolderRoot:D$,FolderRootIcon:D$,FolderSearch:F$,FolderSearch2:R$,FolderSearch2Icon:R$,FolderSearchIcon:F$,FolderSymlink:z$,FolderSymlinkIcon:z$,FolderSync:B$,FolderSyncIcon:B$,FolderTree:$$,FolderTreeIcon:$$,FolderUp:U$,FolderUpIcon:U$,FolderX:q$,FolderXIcon:q$,Folders:H$,FoldersIcon:H$,Footprints:W$,FootprintsIcon:W$,ForkKnife:ww,ForkKnifeCrossed:bw,ForkKnifeCrossedIcon:bw,ForkKnifeIcon:ww,Forklift:G$,ForkliftIcon:G$,FormInput:nb,FormInputIcon:nb,Forward:K$,ForwardIcon:K$,Frame:Z$,FrameIcon:Z$,Framer:Y$,FramerIcon:Y$,Frown:X$,FrownIcon:X$,Fuel:Q$,FuelIcon:Q$,Fullscreen:J$,FullscreenIcon:J$,FunctionSquare:Fb,FunctionSquareIcon:Fb,GalleryHorizontal:tU,GalleryHorizontalEnd:eU,GalleryHorizontalEndIcon:eU,GalleryHorizontalIcon:tU,GalleryThumbnails:rU,GalleryThumbnailsIcon:rU,GalleryVertical:sU,GalleryVerticalEnd:nU,GalleryVerticalEndIcon:nU,GalleryVerticalIcon:sU,Gamepad:iU,Gamepad2:aU,Gamepad2Icon:aU,GamepadIcon:iU,GanttChart:R_,GanttChartIcon:R_,GanttChartSquare:Ym,GanttChartSquareIcon:Ym,Gauge:oU,GaugeCircle:J_,GaugeCircleIcon:J_,GaugeIcon:oU,Gavel:lU,GavelIcon:lU,Gem:cU,GemIcon:cU,Ghost:pj,GhostIcon:pj,Gift:Ki,GiftIcon:Ki,GitBranch:uU,GitBranchIcon:uU,GitBranchPlus:dU,GitBranchPlusIcon:dU,GitCommit:E2,GitCommitHorizontal:E2,GitCommitHorizontalIcon:E2,GitCommitIcon:E2,GitCommitVertical:hU,GitCommitVerticalIcon:hU,GitCompare:pU,GitCompareArrows:fU,GitCompareArrowsIcon:fU,GitCompareIcon:pU,GitFork:mU,GitForkIcon:mU,GitGraph:gU,GitGraphIcon:gU,GitMerge:xU,GitMergeIcon:xU,GitPullRequest:jU,GitPullRequestArrow:yU,GitPullRequestArrowIcon:yU,GitPullRequestClosed:vU,GitPullRequestClosedIcon:vU,GitPullRequestCreate:bU,GitPullRequestCreateArrow:_U,GitPullRequestCreateArrowIcon:_U,GitPullRequestCreateIcon:bU,GitPullRequestDraft:wU,GitPullRequestDraftIcon:wU,GitPullRequestIcon:jU,Github:kU,GithubIcon:kU,Gitlab:NU,GitlabIcon:NU,GlassWater:SU,GlassWaterIcon:SU,Glasses:CU,GlassesIcon:CU,Globe:Ux,Globe2:_2,Globe2Icon:_2,GlobeIcon:Ux,GlobeLock:MU,GlobeLockIcon:MU,Goal:TU,GoalIcon:TU,Grab:AU,GrabIcon:AU,GraduationCap:g1,GraduationCapIcon:g1,Grape:EU,GrapeIcon:EU,Grid:Bh,Grid2X2:P2,Grid2X2Icon:P2,Grid2X2Plus:I2,Grid2X2PlusIcon:I2,Grid2x2:P2,Grid2x2Check:IU,Grid2x2CheckIcon:IU,Grid2x2Icon:P2,Grid2x2Plus:I2,Grid2x2PlusIcon:I2,Grid2x2X:PU,Grid2x2XIcon:PU,Grid3X3:Bh,Grid3X3Icon:Bh,Grid3x3:Bh,Grid3x3Icon:Bh,GridIcon:Bh,Grip:OU,GripHorizontal:LU,GripHorizontalIcon:LU,GripIcon:OU,GripVertical:x1,GripVerticalIcon:x1,Group:DU,GroupIcon:DU,Guitar:RU,GuitarIcon:RU,Ham:FU,HamIcon:FU,Hammer:zU,HammerIcon:zU,Hand:VU,HandCoins:BU,HandCoinsIcon:BU,HandHeart:$U,HandHeartIcon:$U,HandHelping:L2,HandHelpingIcon:L2,HandIcon:VU,HandMetal:UU,HandMetalIcon:UU,HandPlatter:qU,HandPlatterIcon:qU,Handshake:HU,HandshakeIcon:HU,HardDrive:AT,HardDriveDownload:WU,HardDriveDownloadIcon:WU,HardDriveIcon:AT,HardDriveUpload:GU,HardDriveUploadIcon:GU,HardHat:KU,HardHatIcon:KU,Hash:rS,HashIcon:rS,Haze:ZU,HazeIcon:ZU,HdmiPort:YU,HdmiPortIcon:YU,Heading:tq,Heading1:ET,Heading1Icon:ET,Heading2:IT,Heading2Icon:IT,Heading3:XU,Heading3Icon:XU,Heading4:QU,Heading4Icon:QU,Heading5:JU,Heading5Icon:JU,Heading6:eq,Heading6Icon:eq,HeadingIcon:tq,HeadphoneOff:rq,HeadphoneOffIcon:rq,Headphones:nq,HeadphonesIcon:nq,Headset:sq,HeadsetIcon:sq,Heart:ci,HeartCrack:aq,HeartCrackIcon:aq,HeartHandshake:iq,HeartHandshakeIcon:iq,HeartIcon:ci,HeartOff:oq,HeartOffIcon:oq,HeartPulse:lq,HeartPulseIcon:lq,Heater:cq,HeaterIcon:cq,HelpCircle:Nx,HelpCircleIcon:Nx,HelpingHand:L2,HelpingHandIcon:L2,Hexagon:dq,HexagonIcon:dq,Highlighter:uq,HighlighterIcon:uq,History:nS,HistoryIcon:nS,Home:pa,HomeIcon:pa,Hop:fq,HopIcon:fq,HopOff:hq,HopOffIcon:hq,Hospital:pq,HospitalIcon:pq,Hotel:mq,HotelIcon:mq,Hourglass:gq,HourglassIcon:gq,House:pa,HouseIcon:pa,HousePlug:xq,HousePlugIcon:xq,HousePlus:yq,HousePlusIcon:yq,IceCream:D2,IceCream2:O2,IceCream2Icon:O2,IceCreamBowl:O2,IceCreamBowlIcon:O2,IceCreamCone:D2,IceCreamConeIcon:D2,IceCreamIcon:D2,Icon:pAe,IdCard:vq,IdCardIcon:vq,Image:Pl,ImageDown:_q,ImageDownIcon:_q,ImageIcon:Pl,ImageMinus:bq,ImageMinusIcon:bq,ImageOff:wq,ImageOffIcon:wq,ImagePlay:jq,ImagePlayIcon:jq,ImagePlus:sS,ImagePlusIcon:sS,ImageUp:kq,ImageUpIcon:kq,ImageUpscale:Nq,ImageUpscaleIcon:Nq,Images:Sq,ImagesIcon:Sq,Import:Cq,ImportIcon:Cq,Inbox:Mq,InboxIcon:Mq,Indent:F2,IndentDecrease:R2,IndentDecreaseIcon:R2,IndentIcon:F2,IndentIncrease:F2,IndentIncreaseIcon:F2,IndianRupee:Tq,IndianRupeeIcon:Tq,Infinity:Aq,InfinityIcon:Aq,Info:Eq,InfoIcon:Eq,Inspect:Vb,InspectIcon:Vb,InspectionPanel:Iq,InspectionPanelIcon:Iq,Instagram:lu,InstagramIcon:lu,Italic:aS,ItalicIcon:aS,IterationCcw:Pq,IterationCcwIcon:Pq,IterationCw:Lq,IterationCwIcon:Lq,JapaneseYen:Oq,JapaneseYenIcon:Oq,Joystick:Dq,JoystickIcon:Dq,Kanban:y1,KanbanIcon:y1,KanbanSquare:zb,KanbanSquareDashed:Ib,KanbanSquareDashedIcon:Ib,KanbanSquareIcon:zb,Key:ef,KeyIcon:ef,KeyRound:mj,KeyRoundIcon:mj,KeySquare:Rq,KeySquareIcon:Rq,Keyboard:Bq,KeyboardIcon:Bq,KeyboardMusic:Fq,KeyboardMusicIcon:Fq,KeyboardOff:zq,KeyboardOffIcon:zq,Lamp:Wq,LampCeiling:$q,LampCeilingIcon:$q,LampDesk:Uq,LampDeskIcon:Uq,LampFloor:qq,LampFloorIcon:qq,LampIcon:Wq,LampWallDown:Vq,LampWallDownIcon:Vq,LampWallUp:Hq,LampWallUpIcon:Hq,LandPlot:Gq,LandPlotIcon:Gq,Landmark:Kq,LandmarkIcon:Kq,Languages:Zq,LanguagesIcon:Zq,Laptop:Xq,Laptop2:z2,Laptop2Icon:z2,LaptopIcon:Xq,LaptopMinimal:z2,LaptopMinimalCheck:Yq,LaptopMinimalCheckIcon:Yq,LaptopMinimalIcon:z2,Lasso:Jq,LassoIcon:Jq,LassoSelect:Qq,LassoSelectIcon:Qq,Laugh:eV,LaughIcon:eV,Layers:nV,Layers2:tV,Layers2Icon:tV,Layers3:rV,Layers3Icon:rV,LayersIcon:nV,Layout:m0,LayoutDashboard:gj,LayoutDashboardIcon:gj,LayoutGrid:pm,LayoutGridIcon:pm,LayoutIcon:m0,LayoutList:sV,LayoutListIcon:sV,LayoutPanelLeft:aV,LayoutPanelLeftIcon:aV,LayoutPanelTop:iV,LayoutPanelTopIcon:iV,LayoutTemplate:oV,LayoutTemplateIcon:oV,Leaf:lV,LeafIcon:lV,LeafyGreen:cV,LeafyGreenIcon:cV,Lectern:dV,LecternIcon:dV,LetterText:uV,LetterTextIcon:uV,Library:iS,LibraryBig:hV,LibraryBigIcon:hV,LibraryIcon:iS,LibrarySquare:Bb,LibrarySquareIcon:Bb,LifeBuoy:oS,LifeBuoyIcon:oS,Ligature:fV,LigatureIcon:fV,Lightbulb:v1,LightbulbIcon:v1,LightbulbOff:pV,LightbulbOffIcon:pV,LineChart:L_,LineChartIcon:L_,Link:Co,Link2:tf,Link2Icon:tf,Link2Off:mV,Link2OffIcon:mV,LinkIcon:Co,Linkedin:mm,LinkedinIcon:mm,List:Kf,ListCheck:gV,ListCheckIcon:gV,ListChecks:xV,ListChecksIcon:xV,ListCollapse:yV,ListCollapseIcon:yV,ListEnd:vV,ListEndIcon:vV,ListFilter:_V,ListFilterIcon:_V,ListIcon:Kf,ListMinus:bV,ListMinusIcon:bV,ListMusic:wV,ListMusicIcon:wV,ListOrdered:lS,ListOrderedIcon:lS,ListPlus:jV,ListPlusIcon:jV,ListRestart:kV,ListRestartIcon:kV,ListStart:NV,ListStartIcon:NV,ListTodo:SV,ListTodoIcon:SV,ListTree:CV,ListTreeIcon:CV,ListVideo:MV,ListVideoIcon:MV,ListX:TV,ListXIcon:TV,Loader:EV,Loader2:en,Loader2Icon:en,LoaderCircle:en,LoaderCircleIcon:en,LoaderIcon:EV,LoaderPinwheel:AV,LoaderPinwheelIcon:AV,Locate:PT,LocateFixed:IV,LocateFixedIcon:IV,LocateIcon:PT,LocateOff:PV,LocateOffIcon:PV,Lock:Zf,LockIcon:Zf,LockKeyhole:LV,LockKeyholeIcon:LV,LockKeyholeOpen:B2,LockKeyholeOpenIcon:B2,LockOpen:$2,LockOpenIcon:$2,LogIn:cS,LogInIcon:cS,LogOut:dS,LogOutIcon:dS,Logs:OV,LogsIcon:OV,Lollipop:DV,LollipopIcon:DV,LucideAArrowDown:gO,LucideAArrowUp:xO,LucideALargeSmall:yO,LucideAccessibility:vO,LucideActivity:pg,LucideActivitySquare:ub,LucideAirVent:_O,LucideAirplay:bO,LucideAlarmCheck:h_,LucideAlarmClock:jO,LucideAlarmClockCheck:h_,LucideAlarmClockMinus:f_,LucideAlarmClockOff:wO,LucideAlarmClockPlus:p_,LucideAlarmMinus:f_,LucideAlarmPlus:p_,LucideAlarmSmoke:kO,LucideAlbum:NO,LucideAlertCircle:Il,LucideAlertOctagon:V2,LucideAlertTriangle:Vh,LucideAlignCenter:Y4,LucideAlignCenterHorizontal:SO,LucideAlignCenterVertical:CO,LucideAlignEndHorizontal:MO,LucideAlignEndVertical:TO,LucideAlignHorizontalDistributeCenter:AO,LucideAlignHorizontalDistributeEnd:EO,LucideAlignHorizontalDistributeStart:IO,LucideAlignHorizontalJustifyCenter:PO,LucideAlignHorizontalJustifyEnd:LO,LucideAlignHorizontalJustifyStart:OO,LucideAlignHorizontalSpaceAround:DO,LucideAlignHorizontalSpaceBetween:RO,LucideAlignJustify:FO,LucideAlignLeft:X4,LucideAlignRight:Q4,LucideAlignStartHorizontal:zO,LucideAlignStartVertical:BO,LucideAlignVerticalDistributeCenter:$O,LucideAlignVerticalDistributeEnd:UO,LucideAlignVerticalDistributeStart:qO,LucideAlignVerticalJustifyCenter:VO,LucideAlignVerticalJustifyEnd:HO,LucideAlignVerticalJustifyStart:WO,LucideAlignVerticalSpaceAround:GO,LucideAlignVerticalSpaceBetween:KO,LucideAmbulance:ZO,LucideAmpersand:YO,LucideAmpersands:XO,LucideAmphora:QO,LucideAnchor:JO,LucideAngry:e8,LucideAnnoyed:t8,LucideAntenna:r8,LucideAnvil:n8,LucideAperture:s8,LucideAppWindow:kT,LucideAppWindowMac:a8,LucideApple:i8,LucideArchive:c8,LucideArchiveRestore:o8,LucideArchiveX:l8,LucideAreaChart:M_,LucideArmchair:d8,LucideArrowBigDown:h8,LucideArrowBigDownDash:u8,LucideArrowBigLeft:p8,LucideArrowBigLeftDash:f8,LucideArrowBigRight:g8,LucideArrowBigRightDash:m8,LucideArrowBigUp:y8,LucideArrowBigUpDash:x8,LucideArrowDown:i1,LucideArrowDown01:v8,LucideArrowDown10:_8,LucideArrowDownAZ:m_,LucideArrowDownAz:m_,LucideArrowDownCircle:B_,LucideArrowDownFromLine:b8,LucideArrowDownLeft:w8,LucideArrowDownLeftFromCircle:U_,LucideArrowDownLeftFromSquare:gb,LucideArrowDownLeftSquare:hb,LucideArrowDownNarrowWide:j8,LucideArrowDownRight:k8,LucideArrowDownRightFromCircle:q_,LucideArrowDownRightFromSquare:xb,LucideArrowDownRightSquare:fb,LucideArrowDownSquare:pb,LucideArrowDownToDot:N8,LucideArrowDownToLine:S8,LucideArrowDownUp:C8,LucideArrowDownWideNarrow:g_,LucideArrowDownZA:x_,LucideArrowDownZa:x_,LucideArrowLeft:so,LucideArrowLeftCircle:$_,LucideArrowLeftFromLine:M8,LucideArrowLeftRight:T8,LucideArrowLeftSquare:mb,LucideArrowLeftToLine:A8,LucideArrowRight:dl,LucideArrowRightCircle:W_,LucideArrowRightFromLine:E8,LucideArrowRightLeft:I8,LucideArrowRightSquare:_b,LucideArrowRightToLine:P8,LucideArrowUp:mg,LucideArrowUp01:L8,LucideArrowUp10:O8,LucideArrowUpAZ:y_,LucideArrowUpAz:y_,LucideArrowUpCircle:G_,LucideArrowUpDown:zx,LucideArrowUpFromDot:D8,LucideArrowUpFromLine:R8,LucideArrowUpLeft:F8,LucideArrowUpLeftFromCircle:V_,LucideArrowUpLeftFromSquare:yb,LucideArrowUpLeftSquare:bb,LucideArrowUpNarrowWide:v_,LucideArrowUpRight:z8,LucideArrowUpRightFromCircle:H_,LucideArrowUpRightFromSquare:vb,LucideArrowUpRightSquare:wb,LucideArrowUpSquare:jb,LucideArrowUpToLine:B8,LucideArrowUpWideNarrow:$8,LucideArrowUpZA:__,LucideArrowUpZa:__,LucideArrowsUpFromLine:U8,LucideAsterisk:q8,LucideAsteriskSquare:kb,LucideAtSign:V8,LucideAtom:H8,LucideAudioLines:W8,LucideAudioWaveform:G8,LucideAward:Ol,LucideAxe:K8,LucideAxis3D:b_,LucideAxis3d:b_,LucideBaby:Z8,LucideBackpack:Y8,LucideBadge:hD,LucideBadgeAlert:X8,LucideBadgeCent:Q8,LucideBadgeCheck:w_,LucideBadgeDollarSign:J8,LucideBadgeEuro:eD,LucideBadgeHelp:tD,LucideBadgeIndianRupee:rD,LucideBadgeInfo:nD,LucideBadgeJapaneseYen:sD,LucideBadgeMinus:aD,LucideBadgePercent:iD,LucideBadgePlus:oD,LucideBadgePoundSterling:lD,LucideBadgeRussianRuble:cD,LucideBadgeSwissFranc:dD,LucideBadgeX:uD,LucideBaggageClaim:fD,LucideBan:pD,LucideBanana:mD,LucideBandage:gD,LucideBanknote:xD,LucideBarChart:O_,LucideBarChart2:D_,LucideBarChart3:cc,LucideBarChart4:P_,LucideBarChartBig:I_,LucideBarChartHorizontal:A_,LucideBarChartHorizontalBig:T_,LucideBarcode:yD,LucideBaseline:vD,LucideBath:o1,LucideBattery:ND,LucideBatteryCharging:_D,LucideBatteryFull:bD,LucideBatteryLow:wD,LucideBatteryMedium:jD,LucideBatteryWarning:kD,LucideBeaker:SD,LucideBean:MD,LucideBeanOff:CD,LucideBed:l1,LucideBedDouble:TD,LucideBedSingle:AD,LucideBeef:ED,LucideBeer:PD,LucideBeerOff:ID,LucideBell:gg,LucideBellDot:LD,LucideBellElectric:OD,LucideBellMinus:DD,LucideBellOff:oj,LucideBellPlus:RD,LucideBellRing:FD,LucideBetweenHorizonalEnd:j_,LucideBetweenHorizonalStart:k_,LucideBetweenHorizontalEnd:j_,LucideBetweenHorizontalStart:k_,LucideBetweenVerticalEnd:zD,LucideBetweenVerticalStart:BD,LucideBicepsFlexed:$D,LucideBike:UD,LucideBinary:qD,LucideBinoculars:VD,LucideBiohazard:HD,LucideBird:WD,LucideBitcoin:GD,LucideBlend:KD,LucideBlinds:ZD,LucideBlocks:YD,LucideBluetooth:eR,LucideBluetoothConnected:XD,LucideBluetoothOff:QD,LucideBluetoothSearching:JD,LucideBold:J4,LucideBolt:tR,LucideBomb:rR,LucideBone:nR,LucideBook:NR,LucideBookA:sR,LucideBookAudio:aR,LucideBookCheck:iR,LucideBookCopy:oR,LucideBookDashed:N_,LucideBookDown:lR,LucideBookHeadphones:cR,LucideBookHeart:dR,LucideBookImage:uR,LucideBookKey:hR,LucideBookLock:fR,LucideBookMarked:pR,LucideBookMinus:mR,LucideBookOpen:NT,LucideBookOpenCheck:gR,LucideBookOpenText:xR,LucideBookPlus:yR,LucideBookTemplate:N_,LucideBookText:vR,LucideBookType:_R,LucideBookUp:wR,LucideBookUp2:bR,LucideBookUser:jR,LucideBookX:kR,LucideBookmark:um,LucideBookmarkCheck:SR,LucideBookmarkMinus:CR,LucideBookmarkPlus:ST,LucideBookmarkX:MR,LucideBoomBox:TR,LucideBot:eS,LucideBotMessageSquare:AR,LucideBotOff:ER,LucideBox:IR,LucideBoxSelect:Lb,LucideBoxes:PR,LucideBraces:S_,LucideBrackets:LR,LucideBrain:CT,LucideBrainCircuit:OR,LucideBrainCog:DR,LucideBrickWall:RR,LucideBriefcase:yh,LucideBriefcaseBusiness:FR,LucideBriefcaseConveyorBelt:zR,LucideBriefcaseMedical:BR,LucideBringToFront:$R,LucideBrush:UR,LucideBug:HR,LucideBugOff:qR,LucideBugPlay:VR,LucideBuilding:lj,LucideBuilding2:ai,LucideBus:GR,LucideBusFront:WR,LucideCable:ZR,LucideCableCar:KR,LucideCake:Qh,LucideCakeSlice:YR,LucideCalculator:XR,LucideCalendar:zs,LucideCalendar1:QR,LucideCalendarArrowDown:JR,LucideCalendarArrowUp:eF,LucideCalendarCheck:rF,LucideCalendarCheck2:tF,LucideCalendarClock:nF,LucideCalendarCog:sF,LucideCalendarDays:hm,LucideCalendarFold:aF,LucideCalendarHeart:iF,LucideCalendarMinus:lF,LucideCalendarMinus2:oF,LucideCalendarOff:cF,LucideCalendarPlus:cj,LucideCalendarPlus2:dF,LucideCalendarRange:uF,LucideCalendarSearch:hF,LucideCalendarSync:fF,LucideCalendarX:mF,LucideCalendarX2:pF,LucideCamera:xg,LucideCameraOff:gF,LucideCandlestickChart:E_,LucideCandy:vF,LucideCandyCane:xF,LucideCandyOff:yF,LucideCannabis:_F,LucideCaptions:C_,LucideCaptionsOff:bF,LucideCar:kF,LucideCarFront:wF,LucideCarTaxiFront:jF,LucideCaravan:NF,LucideCarrot:SF,LucideCaseLower:CF,LucideCaseSensitive:MF,LucideCaseUpper:TF,LucideCassetteTape:AF,LucideCast:EF,LucideCastle:IF,LucideCat:PF,LucideCctv:LF,LucideChartArea:M_,LucideChartBar:A_,LucideChartBarBig:T_,LucideChartBarDecreasing:OF,LucideChartBarIncreasing:DF,LucideChartBarStacked:RF,LucideChartCandlestick:E_,LucideChartColumn:cc,LucideChartColumnBig:I_,LucideChartColumnDecreasing:FF,LucideChartColumnIncreasing:P_,LucideChartColumnStacked:zF,LucideChartGantt:BF,LucideChartLine:L_,LucideChartNetwork:$F,LucideChartNoAxesColumn:D_,LucideChartNoAxesColumnDecreasing:UF,LucideChartNoAxesColumnIncreasing:O_,LucideChartNoAxesCombined:qF,LucideChartNoAxesGantt:R_,LucideChartPie:F_,LucideChartScatter:z_,LucideChartSpline:VF,LucideCheck:Ai,LucideCheckCheck:HF,LucideCheckCircle:Yi,LucideCheckCircle2:Xi,LucideCheckSquare:x0,LucideCheckSquare2:Sb,LucideChefHat:WF,LucideCherry:GF,LucideChevronDown:Dd,LucideChevronDownCircle:K_,LucideChevronDownSquare:Cb,LucideChevronFirst:KF,LucideChevronLast:ZF,LucideChevronLeft:Tc,LucideChevronLeftCircle:Z_,LucideChevronLeftSquare:Mb,LucideChevronRight:Vi,LucideChevronRightCircle:Y_,LucideChevronRightSquare:Tb,LucideChevronUp:c1,LucideChevronUpCircle:X_,LucideChevronUpSquare:Ab,LucideChevronsDown:XF,LucideChevronsDownUp:YF,LucideChevronsLeft:ez,LucideChevronsLeftRight:JF,LucideChevronsLeftRightEllipsis:QF,LucideChevronsRight:rz,LucideChevronsRightLeft:tz,LucideChevronsUp:nz,LucideChevronsUpDown:d1,LucideChrome:sz,LucideChurch:az,LucideCigarette:oz,LucideCigaretteOff:iz,LucideCircle:Ru,LucideCircleAlert:Il,LucideCircleArrowDown:B_,LucideCircleArrowLeft:$_,LucideCircleArrowOutDownLeft:U_,LucideCircleArrowOutDownRight:q_,LucideCircleArrowOutUpLeft:V_,LucideCircleArrowOutUpRight:H_,LucideCircleArrowRight:W_,LucideCircleArrowUp:G_,LucideCircleCheck:Xi,LucideCircleCheckBig:Yi,LucideCircleChevronDown:K_,LucideCircleChevronLeft:Z_,LucideCircleChevronRight:Y_,LucideCircleChevronUp:X_,LucideCircleDashed:lz,LucideCircleDivide:Q_,LucideCircleDollarSign:cz,LucideCircleDot:uz,LucideCircleDotDashed:dz,LucideCircleEllipsis:hz,LucideCircleEqual:fz,LucideCircleFadingArrowUp:pz,LucideCircleFadingPlus:mz,LucideCircleGauge:J_,LucideCircleHelp:Nx,LucideCircleMinus:e2,LucideCircleOff:gz,LucideCircleParking:r2,LucideCircleParkingOff:t2,LucideCirclePause:n2,LucideCirclePercent:s2,LucideCirclePlay:Bf,LucideCirclePlus:a2,LucideCirclePower:i2,LucideCircleSlash:xz,LucideCircleSlash2:o2,LucideCircleSlashed:o2,LucideCircleStop:l2,LucideCircleUser:d2,LucideCircleUserRound:c2,LucideCircleX:qc,LucideCircuitBoard:yz,LucideCitrus:vz,LucideClapperboard:_z,LucideClipboard:Cz,LucideClipboardCheck:MT,LucideClipboardCopy:bz,LucideClipboardEdit:h2,LucideClipboardList:TT,LucideClipboardMinus:wz,LucideClipboardPaste:jz,LucideClipboardPen:h2,LucideClipboardPenLine:u2,LucideClipboardPlus:kz,LucideClipboardSignature:u2,LucideClipboardType:Nz,LucideClipboardX:Sz,LucideClock:Ya,LucideClock1:Mz,LucideClock10:Tz,LucideClock11:Az,LucideClock12:Ez,LucideClock2:Iz,LucideClock3:Pz,LucideClock4:Lz,LucideClock5:Oz,LucideClock6:Dz,LucideClock7:Rz,LucideClock8:Fz,LucideClock9:zz,LucideClockAlert:Bz,LucideClockArrowDown:$z,LucideClockArrowUp:Uz,LucideCloud:n7,LucideCloudAlert:qz,LucideCloudCog:Vz,LucideCloudDownload:f2,LucideCloudDrizzle:Hz,LucideCloudFog:Wz,LucideCloudHail:Gz,LucideCloudLightning:Kz,LucideCloudMoon:Yz,LucideCloudMoonRain:Zz,LucideCloudOff:Xz,LucideCloudRain:Jz,LucideCloudRainWind:Qz,LucideCloudSnow:e7,LucideCloudSun:r7,LucideCloudSunRain:t7,LucideCloudUpload:p2,LucideCloudy:s7,LucideClover:Px,LucideClub:a7,LucideCode:dj,LucideCode2:m2,LucideCodeSquare:Eb,LucideCodeXml:m2,LucideCodepen:i7,LucideCodesandbox:o7,LucideCoffee:uj,LucideCog:l7,LucideCoins:c7,LucideColumns:g2,LucideColumns2:g2,LucideColumns3:x2,LucideColumns4:d7,LucideCombine:u7,LucideCommand:h7,LucideCompass:f7,LucideComponent:p7,LucideComputer:m7,LucideConciergeBell:g7,LucideCone:x7,LucideConstruction:y7,LucideContact:v7,LucideContact2:y2,LucideContactRound:y2,LucideContainer:_7,LucideContrast:b7,LucideCookie:w7,LucideCookingPot:j7,LucideCopy:hl,LucideCopyCheck:k7,LucideCopyMinus:N7,LucideCopyPlus:S7,LucideCopySlash:C7,LucideCopyX:M7,LucideCopyleft:T7,LucideCopyright:A7,LucideCornerDownLeft:E7,LucideCornerDownRight:I7,LucideCornerLeftDown:P7,LucideCornerLeftUp:L7,LucideCornerRightDown:O7,LucideCornerRightUp:D7,LucideCornerUpLeft:R7,LucideCornerUpRight:F7,LucideCpu:z7,LucideCreativeCommons:B7,LucideCreditCard:fm,LucideCroissant:$7,LucideCrop:U7,LucideCross:q7,LucideCrosshair:V7,LucideCrown:u1,LucideCuboid:H7,LucideCupSoda:W7,LucideCurlyBraces:S_,LucideCurrency:G7,LucideCylinder:K7,LucideDam:Z7,LucideDatabase:Q7,LucideDatabaseBackup:Y7,LucideDatabaseZap:X7,LucideDelete:J7,LucideDessert:e9,LucideDiameter:t9,LucideDiamond:s9,LucideDiamondMinus:r9,LucideDiamondPercent:v2,LucideDiamondPlus:n9,LucideDice1:a9,LucideDice2:i9,LucideDice3:o9,LucideDice4:l9,LucideDice5:c9,LucideDice6:d9,LucideDices:u9,LucideDiff:h9,LucideDisc:g9,LucideDisc2:f9,LucideDisc3:p9,LucideDiscAlbum:m9,LucideDivide:x9,LucideDivideCircle:Q_,LucideDivideSquare:Ob,LucideDna:v9,LucideDnaOff:y9,LucideDock:_9,LucideDog:b9,LucideDollarSign:hd,LucideDonut:w9,LucideDoorClosed:j9,LucideDoorOpen:hj,LucideDot:k9,LucideDotSquare:Db,LucideDownload:no,LucideDownloadCloud:f2,LucideDraftingCompass:N9,LucideDrama:S9,LucideDribbble:C9,LucideDrill:M9,LucideDroplet:T9,LucideDroplets:A9,LucideDrum:E9,LucideDrumstick:I9,LucideDumbbell:P9,LucideEar:O9,LucideEarOff:L9,LucideEarth:_2,LucideEarthLock:D9,LucideEclipse:R9,LucideEdit:ac,LucideEdit2:g0,LucideEdit3:tb,LucideEgg:tS,LucideEggFried:F9,LucideEggOff:z9,LucideEllipsis:em,LucideEllipsisVertical:Sx,LucideEqual:U9,LucideEqualApproximately:B9,LucideEqualNot:$9,LucideEqualSquare:Rb,LucideEraser:q9,LucideEthernetPort:V9,LucideEuro:H9,LucideExpand:W9,LucideExternalLink:Fs,LucideEye:Qo,LucideEyeClosed:G9,LucideEyeOff:h1,LucideFacebook:Rd,LucideFactory:K9,LucideFan:Z9,LucideFastForward:Y9,LucideFeather:X9,LucideFence:Q9,LucideFerrisWheel:J9,LucideFigma:eB,LucideFile:KB,LucideFileArchive:tB,LucideFileAudio:nB,LucideFileAudio2:rB,LucideFileAxis3D:b2,LucideFileAxis3d:b2,LucideFileBadge:aB,LucideFileBadge2:sB,LucideFileBarChart:w2,LucideFileBarChart2:j2,LucideFileBox:iB,LucideFileChartColumn:j2,LucideFileChartColumnIncreasing:w2,LucideFileChartLine:k2,LucideFileChartPie:N2,LucideFileCheck:lB,LucideFileCheck2:oB,LucideFileClock:cB,LucideFileCode:uB,LucideFileCode2:dB,LucideFileCog:S2,LucideFileCog2:S2,LucideFileDiff:hB,LucideFileDigit:fB,LucideFileDown:pB,LucideFileEdit:M2,LucideFileHeart:mB,LucideFileImage:f1,LucideFileInput:gB,LucideFileJson:yB,LucideFileJson2:xB,LucideFileKey:_B,LucideFileKey2:vB,LucideFileLineChart:k2,LucideFileLock:wB,LucideFileLock2:bB,LucideFileMinus:kB,LucideFileMinus2:jB,LucideFileMusic:NB,LucideFileOutput:SB,LucideFilePen:M2,LucideFilePenLine:C2,LucideFilePieChart:N2,LucideFilePlus:MB,LucideFilePlus2:CB,LucideFileQuestion:TB,LucideFileScan:AB,LucideFileSearch:IB,LucideFileSearch2:EB,LucideFileSignature:C2,LucideFileSliders:PB,LucideFileSpreadsheet:p1,LucideFileStack:LB,LucideFileSymlink:OB,LucideFileTerminal:DB,LucideFileText:La,LucideFileType:FB,LucideFileType2:RB,LucideFileUp:zB,LucideFileUser:BB,LucideFileVideo:UB,LucideFileVideo2:$B,LucideFileVolume:VB,LucideFileVolume2:qB,LucideFileWarning:HB,LucideFileX:GB,LucideFileX2:WB,LucideFiles:ZB,LucideFilm:Ad,LucideFilter:m1,LucideFilterX:YB,LucideFingerprint:XB,LucideFireExtinguisher:QB,LucideFish:t$,LucideFishOff:JB,LucideFishSymbol:e$,LucideFlag:Bx,LucideFlagOff:r$,LucideFlagTriangleLeft:n$,LucideFlagTriangleRight:s$,LucideFlame:Jh,LucideFlameKindling:a$,LucideFlashlight:o$,LucideFlashlightOff:i$,LucideFlaskConical:fj,LucideFlaskConicalOff:l$,LucideFlaskRound:c$,LucideFlipHorizontal:u$,LucideFlipHorizontal2:d$,LucideFlipVertical:f$,LucideFlipVertical2:h$,LucideFlower:p$,LucideFlower2:am,LucideFocus:m$,LucideFoldHorizontal:g$,LucideFoldVertical:x$,LucideFolder:V$,LucideFolderArchive:y$,LucideFolderCheck:v$,LucideFolderClock:_$,LucideFolderClosed:b$,LucideFolderCode:w$,LucideFolderCog:T2,LucideFolderCog2:T2,LucideFolderDot:j$,LucideFolderDown:k$,LucideFolderEdit:A2,LucideFolderGit:S$,LucideFolderGit2:N$,LucideFolderHeart:C$,LucideFolderInput:M$,LucideFolderKanban:T$,LucideFolderKey:A$,LucideFolderLock:E$,LucideFolderMinus:I$,LucideFolderOpen:$x,LucideFolderOpenDot:P$,LucideFolderOutput:L$,LucideFolderPen:A2,LucideFolderPlus:O$,LucideFolderRoot:D$,LucideFolderSearch:F$,LucideFolderSearch2:R$,LucideFolderSymlink:z$,LucideFolderSync:B$,LucideFolderTree:$$,LucideFolderUp:U$,LucideFolderX:q$,LucideFolders:H$,LucideFootprints:W$,LucideForkKnife:ww,LucideForkKnifeCrossed:bw,LucideForklift:G$,LucideFormInput:nb,LucideForward:K$,LucideFrame:Z$,LucideFramer:Y$,LucideFrown:X$,LucideFuel:Q$,LucideFullscreen:J$,LucideFunctionSquare:Fb,LucideGalleryHorizontal:tU,LucideGalleryHorizontalEnd:eU,LucideGalleryThumbnails:rU,LucideGalleryVertical:sU,LucideGalleryVerticalEnd:nU,LucideGamepad:iU,LucideGamepad2:aU,LucideGanttChart:R_,LucideGanttChartSquare:Ym,LucideGauge:oU,LucideGaugeCircle:J_,LucideGavel:lU,LucideGem:cU,LucideGhost:pj,LucideGift:Ki,LucideGitBranch:uU,LucideGitBranchPlus:dU,LucideGitCommit:E2,LucideGitCommitHorizontal:E2,LucideGitCommitVertical:hU,LucideGitCompare:pU,LucideGitCompareArrows:fU,LucideGitFork:mU,LucideGitGraph:gU,LucideGitMerge:xU,LucideGitPullRequest:jU,LucideGitPullRequestArrow:yU,LucideGitPullRequestClosed:vU,LucideGitPullRequestCreate:bU,LucideGitPullRequestCreateArrow:_U,LucideGitPullRequestDraft:wU,LucideGithub:kU,LucideGitlab:NU,LucideGlassWater:SU,LucideGlasses:CU,LucideGlobe:Ux,LucideGlobe2:_2,LucideGlobeLock:MU,LucideGoal:TU,LucideGrab:AU,LucideGraduationCap:g1,LucideGrape:EU,LucideGrid:Bh,LucideGrid2X2:P2,LucideGrid2X2Plus:I2,LucideGrid2x2:P2,LucideGrid2x2Check:IU,LucideGrid2x2Plus:I2,LucideGrid2x2X:PU,LucideGrid3X3:Bh,LucideGrid3x3:Bh,LucideGrip:OU,LucideGripHorizontal:LU,LucideGripVertical:x1,LucideGroup:DU,LucideGuitar:RU,LucideHam:FU,LucideHammer:zU,LucideHand:VU,LucideHandCoins:BU,LucideHandHeart:$U,LucideHandHelping:L2,LucideHandMetal:UU,LucideHandPlatter:qU,LucideHandshake:HU,LucideHardDrive:AT,LucideHardDriveDownload:WU,LucideHardDriveUpload:GU,LucideHardHat:KU,LucideHash:rS,LucideHaze:ZU,LucideHdmiPort:YU,LucideHeading:tq,LucideHeading1:ET,LucideHeading2:IT,LucideHeading3:XU,LucideHeading4:QU,LucideHeading5:JU,LucideHeading6:eq,LucideHeadphoneOff:rq,LucideHeadphones:nq,LucideHeadset:sq,LucideHeart:ci,LucideHeartCrack:aq,LucideHeartHandshake:iq,LucideHeartOff:oq,LucideHeartPulse:lq,LucideHeater:cq,LucideHelpCircle:Nx,LucideHelpingHand:L2,LucideHexagon:dq,LucideHighlighter:uq,LucideHistory:nS,LucideHome:pa,LucideHop:fq,LucideHopOff:hq,LucideHospital:pq,LucideHotel:mq,LucideHourglass:gq,LucideHouse:pa,LucideHousePlug:xq,LucideHousePlus:yq,LucideIceCream:D2,LucideIceCream2:O2,LucideIceCreamBowl:O2,LucideIceCreamCone:D2,LucideIdCard:vq,LucideImage:Pl,LucideImageDown:_q,LucideImageMinus:bq,LucideImageOff:wq,LucideImagePlay:jq,LucideImagePlus:sS,LucideImageUp:kq,LucideImageUpscale:Nq,LucideImages:Sq,LucideImport:Cq,LucideInbox:Mq,LucideIndent:F2,LucideIndentDecrease:R2,LucideIndentIncrease:F2,LucideIndianRupee:Tq,LucideInfinity:Aq,LucideInfo:Eq,LucideInspect:Vb,LucideInspectionPanel:Iq,LucideInstagram:lu,LucideItalic:aS,LucideIterationCcw:Pq,LucideIterationCw:Lq,LucideJapaneseYen:Oq,LucideJoystick:Dq,LucideKanban:y1,LucideKanbanSquare:zb,LucideKanbanSquareDashed:Ib,LucideKey:ef,LucideKeyRound:mj,LucideKeySquare:Rq,LucideKeyboard:Bq,LucideKeyboardMusic:Fq,LucideKeyboardOff:zq,LucideLamp:Wq,LucideLampCeiling:$q,LucideLampDesk:Uq,LucideLampFloor:qq,LucideLampWallDown:Vq,LucideLampWallUp:Hq,LucideLandPlot:Gq,LucideLandmark:Kq,LucideLanguages:Zq,LucideLaptop:Xq,LucideLaptop2:z2,LucideLaptopMinimal:z2,LucideLaptopMinimalCheck:Yq,LucideLasso:Jq,LucideLassoSelect:Qq,LucideLaugh:eV,LucideLayers:nV,LucideLayers2:tV,LucideLayers3:rV,LucideLayout:m0,LucideLayoutDashboard:gj,LucideLayoutGrid:pm,LucideLayoutList:sV,LucideLayoutPanelLeft:aV,LucideLayoutPanelTop:iV,LucideLayoutTemplate:oV,LucideLeaf:lV,LucideLeafyGreen:cV,LucideLectern:dV,LucideLetterText:uV,LucideLibrary:iS,LucideLibraryBig:hV,LucideLibrarySquare:Bb,LucideLifeBuoy:oS,LucideLigature:fV,LucideLightbulb:v1,LucideLightbulbOff:pV,LucideLineChart:L_,LucideLink:Co,LucideLink2:tf,LucideLink2Off:mV,LucideLinkedin:mm,LucideList:Kf,LucideListCheck:gV,LucideListChecks:xV,LucideListCollapse:yV,LucideListEnd:vV,LucideListFilter:_V,LucideListMinus:bV,LucideListMusic:wV,LucideListOrdered:lS,LucideListPlus:jV,LucideListRestart:kV,LucideListStart:NV,LucideListTodo:SV,LucideListTree:CV,LucideListVideo:MV,LucideListX:TV,LucideLoader:EV,LucideLoader2:en,LucideLoaderCircle:en,LucideLoaderPinwheel:AV,LucideLocate:PT,LucideLocateFixed:IV,LucideLocateOff:PV,LucideLock:Zf,LucideLockKeyhole:LV,LucideLockKeyholeOpen:B2,LucideLockOpen:$2,LucideLogIn:cS,LucideLogOut:dS,LucideLogs:OV,LucideLollipop:DV,LucideLuggage:RV,LucideMSquare:$b,LucideMagnet:FV,LucideMail:da,LucideMailCheck:zV,LucideMailMinus:BV,LucideMailOpen:$V,LucideMailPlus:UV,LucideMailQuestion:qV,LucideMailSearch:VV,LucideMailWarning:HV,LucideMailX:LT,LucideMailbox:WV,LucideMails:GV,LucideMap:aH,LucideMapPin:fl,LucideMapPinCheck:ZV,LucideMapPinCheckInside:KV,LucideMapPinHouse:YV,LucideMapPinMinus:QV,LucideMapPinMinusInside:XV,LucideMapPinOff:JV,LucideMapPinPlus:tH,LucideMapPinPlusInside:eH,LucideMapPinX:nH,LucideMapPinXInside:rH,LucideMapPinned:sH,LucideMartini:iH,LucideMaximize:lH,LucideMaximize2:oH,LucideMedal:qx,LucideMegaphone:gm,LucideMegaphoneOff:cH,LucideMeh:dH,LucideMemoryStick:uH,LucideMenu:OT,LucideMenuSquare:Ub,LucideMerge:hH,LucideMessageCircle:Fl,LucideMessageCircleCode:fH,LucideMessageCircleDashed:pH,LucideMessageCircleHeart:uS,LucideMessageCircleMore:mH,LucideMessageCircleOff:gH,LucideMessageCirclePlus:xH,LucideMessageCircleQuestion:DT,LucideMessageCircleReply:yH,LucideMessageCircleWarning:vH,LucideMessageCircleX:_H,LucideMessageSquare:Lo,LucideMessageSquareCode:bH,LucideMessageSquareDashed:wH,LucideMessageSquareDiff:jH,LucideMessageSquareDot:kH,LucideMessageSquareHeart:NH,LucideMessageSquareLock:SH,LucideMessageSquareMore:CH,LucideMessageSquareOff:MH,LucideMessageSquarePlus:TH,LucideMessageSquareQuote:RT,LucideMessageSquareReply:AH,LucideMessageSquareShare:EH,LucideMessageSquareText:IH,LucideMessageSquareWarning:PH,LucideMessageSquareX:LH,LucideMessagesSquare:OH,LucideMic:FT,LucideMic2:U2,LucideMicOff:DH,LucideMicVocal:U2,LucideMicrochip:RH,LucideMicroscope:FH,LucideMicrowave:zH,LucideMilestone:BH,LucideMilk:UH,LucideMilkOff:$H,LucideMinimize:VH,LucideMinimize2:qH,LucideMinus:_1,LucideMinusCircle:e2,LucideMinusSquare:qb,LucideMonitor:xj,LucideMonitorCheck:HH,LucideMonitorCog:WH,LucideMonitorDot:GH,LucideMonitorDown:KH,LucideMonitorOff:ZH,LucideMonitorPause:YH,LucideMonitorPlay:XH,LucideMonitorSmartphone:QH,LucideMonitorSpeaker:JH,LucideMonitorStop:eW,LucideMonitorUp:tW,LucideMonitorX:rW,LucideMoon:sW,LucideMoonStar:nW,LucideMoreHorizontal:em,LucideMoreVertical:Sx,LucideMountain:iW,LucideMountainSnow:aW,LucideMouse:uW,LucideMouseOff:oW,LucideMousePointer:dW,LucideMousePointer2:lW,LucideMousePointerBan:cW,LucideMousePointerClick:yj,LucideMousePointerSquareDashed:Pb,LucideMove:kW,LucideMove3D:q2,LucideMove3d:q2,LucideMoveDiagonal:fW,LucideMoveDiagonal2:hW,LucideMoveDown:gW,LucideMoveDownLeft:pW,LucideMoveDownRight:mW,LucideMoveHorizontal:xW,LucideMoveLeft:yW,LucideMoveRight:vW,LucideMoveUp:wW,LucideMoveUpLeft:_W,LucideMoveUpRight:bW,LucideMoveVertical:jW,LucideMusic:MW,LucideMusic2:NW,LucideMusic3:SW,LucideMusic4:CW,LucideNavigation:zT,LucideNavigation2:AW,LucideNavigation2Off:TW,LucideNavigationOff:EW,LucideNetwork:IW,LucideNewspaper:Vx,LucideNfc:PW,LucideNotebook:RW,LucideNotebookPen:LW,LucideNotebookTabs:OW,LucideNotebookText:DW,LucideNotepadText:zW,LucideNotepadTextDashed:FW,LucideNut:$W,LucideNutOff:BW,LucideOctagon:qW,LucideOctagonAlert:V2,LucideOctagonMinus:UW,LucideOctagonPause:H2,LucideOctagonX:W2,LucideOmega:VW,LucideOption:HW,LucideOrbit:WW,LucideOrigami:GW,LucideOutdent:R2,LucidePackage:zl,LucidePackage2:KW,LucidePackageCheck:ZW,LucidePackageMinus:YW,LucidePackageOpen:XW,LucidePackagePlus:QW,LucidePackageSearch:JW,LucidePackageX:eG,LucidePaintBucket:tG,LucidePaintRoller:rG,LucidePaintbrush:nG,LucidePaintbrush2:G2,LucidePaintbrushVertical:G2,LucidePalette:Fd,LucidePalmtree:uw,LucidePanelBottom:iG,LucidePanelBottomClose:sG,LucidePanelBottomDashed:K2,LucidePanelBottomInactive:K2,LucidePanelBottomOpen:aG,LucidePanelLeft:Q2,LucidePanelLeftClose:Z2,LucidePanelLeftDashed:Y2,LucidePanelLeftInactive:Y2,LucidePanelLeftOpen:X2,LucidePanelRight:cG,LucidePanelRightClose:oG,LucidePanelRightDashed:J2,LucidePanelRightInactive:J2,LucidePanelRightOpen:lG,LucidePanelTop:hG,LucidePanelTopClose:dG,LucidePanelTopDashed:eb,LucidePanelTopInactive:eb,LucidePanelTopOpen:uG,LucidePanelsLeftBottom:fG,LucidePanelsLeftRight:x2,LucidePanelsRightBottom:pG,LucidePanelsTopBottom:ib,LucidePanelsTopLeft:m0,LucidePaperclip:mG,LucideParentheses:gG,LucideParkingCircle:r2,LucideParkingCircleOff:t2,LucideParkingMeter:xG,LucideParkingSquare:Wb,LucideParkingSquareOff:Hb,LucidePartyPopper:Ac,LucidePause:Yf,LucidePauseCircle:n2,LucidePauseOctagon:H2,LucidePawPrint:yG,LucidePcCase:vG,LucidePen:g0,LucidePenBox:ac,LucidePenLine:tb,LucidePenOff:_G,LucidePenSquare:ac,LucidePenTool:vj,LucidePencil:_i,LucidePencilLine:bG,LucidePencilOff:wG,LucidePencilRuler:jG,LucidePentagon:kG,LucidePercent:hS,LucidePercentCircle:s2,LucidePercentDiamond:v2,LucidePercentSquare:Gb,LucidePersonStanding:NG,LucidePhilippinePeso:SG,LucidePhone:bi,LucidePhoneCall:CG,LucidePhoneForwarded:MG,LucidePhoneIncoming:TG,LucidePhoneMissed:AG,LucidePhoneOff:EG,LucidePhoneOutgoing:IG,LucidePi:PG,LucidePiSquare:Kb,LucidePiano:LG,LucidePickaxe:OG,LucidePictureInPicture:RG,LucidePictureInPicture2:DG,LucidePieChart:F_,LucidePiggyBank:FG,LucidePilcrow:$G,LucidePilcrowLeft:zG,LucidePilcrowRight:BG,LucidePilcrowSquare:Zb,LucidePill:qG,LucidePillBottle:UG,LucidePin:b1,LucidePinOff:BT,LucidePipette:VG,LucidePizza:HG,LucidePlane:KG,LucidePlaneLanding:WG,LucidePlaneTakeoff:GG,LucidePlay:hc,LucidePlayCircle:Bf,LucidePlaySquare:Yb,LucidePlug:YG,LucidePlug2:ZG,LucidePlugZap:rb,LucidePlugZap2:rb,LucidePlus:bn,LucidePlusCircle:a2,LucidePlusSquare:Xb,LucidePocket:QG,LucidePocketKnife:XG,LucidePodcast:JG,LucidePointer:tK,LucidePointerOff:eK,LucidePopcorn:rK,LucidePopsicle:nK,LucidePoundSterling:sK,LucidePower:iK,LucidePowerCircle:i2,LucidePowerOff:aK,LucidePowerSquare:Qb,LucidePresentation:oK,LucidePrinter:cK,LucidePrinterCheck:lK,LucideProjector:dK,LucideProportions:uK,LucidePuzzle:hK,LucidePyramid:fK,LucideQrCode:$T,LucideQuote:UT,LucideRabbit:pK,LucideRadar:mK,LucideRadiation:gK,LucideRadical:xK,LucideRadio:_j,LucideRadioReceiver:yK,LucideRadioTower:vK,LucideRadius:_K,LucideRailSymbol:bK,LucideRainbow:wK,LucideRat:jK,LucideRatio:kK,LucideReceipt:PK,LucideReceiptCent:NK,LucideReceiptEuro:SK,LucideReceiptIndianRupee:CK,LucideReceiptJapaneseYen:MK,LucideReceiptPoundSterling:TK,LucideReceiptRussianRuble:AK,LucideReceiptSwissFranc:EK,LucideReceiptText:IK,LucideRectangleEllipsis:nb,LucideRectangleHorizontal:LK,LucideRectangleVertical:OK,LucideRecycle:DK,LucideRedo:fS,LucideRedo2:RK,LucideRedoDot:FK,LucideRefreshCcw:BK,LucideRefreshCcwDot:zK,LucideRefreshCw:Gl,LucideRefreshCwOff:$K,LucideRefrigerator:UK,LucideRegex:qK,LucideRemoveFormatting:VK,LucideRepeat:qT,LucideRepeat1:HK,LucideRepeat2:WK,LucideReplace:KK,LucideReplaceAll:GK,LucideReply:VT,LucideReplyAll:ZK,LucideRewind:YK,LucideRibbon:XK,LucideRocket:yg,LucideRockingChair:QK,LucideRollerCoaster:JK,LucideRotate3D:sb,LucideRotate3d:sb,LucideRotateCcw:pS,LucideRotateCcwSquare:eZ,LucideRotateCw:HT,LucideRotateCwSquare:tZ,LucideRoute:nZ,LucideRouteOff:rZ,LucideRouter:sZ,LucideRows:ab,LucideRows2:ab,LucideRows3:ib,LucideRows4:aZ,LucideRss:iZ,LucideRuler:oZ,LucideRussianRuble:lZ,LucideSailboat:cZ,LucideSalad:dZ,LucideSandwich:uZ,LucideSatellite:fZ,LucideSatelliteDish:hZ,LucideSave:vg,LucideSaveAll:pZ,LucideSaveOff:mZ,LucideScale:gZ,LucideScale3D:ob,LucideScale3d:ob,LucideScaling:xZ,LucideScan:NZ,LucideScanBarcode:yZ,LucideScanEye:vZ,LucideScanFace:_Z,LucideScanLine:bZ,LucideScanQrCode:wZ,LucideScanSearch:jZ,LucideScanText:kZ,LucideScatterChart:z_,LucideSchool:SZ,LucideSchool2:fw,LucideScissors:MZ,LucideScissorsLineDashed:CZ,LucideScissorsSquare:Jb,LucideScissorsSquareDashedBottom:Nb,LucideScreenShare:AZ,LucideScreenShareOff:TZ,LucideScroll:IZ,LucideScrollText:EZ,LucideSearch:wa,LucideSearchCheck:PZ,LucideSearchCode:LZ,LucideSearchSlash:OZ,LucideSearchX:DZ,LucideSection:RZ,LucideSend:Oo,LucideSendHorizonal:lb,LucideSendHorizontal:lb,LucideSendToBack:FZ,LucideSeparatorHorizontal:zZ,LucideSeparatorVertical:BZ,LucideServer:VZ,LucideServerCog:$Z,LucideServerCrash:UZ,LucideServerOff:qZ,LucideSettings:fd,LucideSettings2:HZ,LucideShapes:WZ,LucideShare:WT,LucideShare2:fc,LucideSheet:GZ,LucideShell:KZ,LucideShield:rf,LucideShieldAlert:ZZ,LucideShieldBan:YZ,LucideShieldCheck:GT,LucideShieldClose:cb,LucideShieldEllipsis:XZ,LucideShieldHalf:QZ,LucideShieldMinus:JZ,LucideShieldOff:eY,LucideShieldPlus:tY,LucideShieldQuestion:rY,LucideShieldX:cb,LucideShip:sY,LucideShipWheel:nY,LucideShirt:aY,LucideShoppingBag:_g,LucideShoppingBasket:iY,LucideShoppingCart:fh,LucideShovel:oY,LucideShowerHead:lY,LucideShrink:cY,LucideShrub:dY,LucideShuffle:uY,LucideSidebar:Q2,LucideSidebarClose:Z2,LucideSidebarOpen:X2,LucideSigma:hY,LucideSigmaSquare:ew,LucideSignal:xY,LucideSignalHigh:fY,LucideSignalLow:pY,LucideSignalMedium:mY,LucideSignalZero:gY,LucideSignature:yY,LucideSignpost:_Y,LucideSignpostBig:vY,LucideSiren:bY,LucideSkipBack:wY,LucideSkipForward:jY,LucideSkull:kY,LucideSlack:NY,LucideSlash:SY,LucideSlashSquare:tw,LucideSlice:CY,LucideSliders:db,LucideSlidersHorizontal:KT,LucideSlidersVertical:db,LucideSmartphone:bg,LucideSmartphoneCharging:MY,LucideSmartphoneNfc:TY,LucideSmile:EY,LucideSmilePlus:AY,LucideSnail:IY,LucideSnowflake:V0,LucideSofa:PY,LucideSortAsc:v_,LucideSortDesc:g_,LucideSoup:LY,LucideSpace:OY,LucideSpade:DY,LucideSparkle:RY,LucideSparkles:Ms,LucideSpeaker:FY,LucideSpeech:zY,LucideSpellCheck:$Y,LucideSpellCheck2:BY,LucideSpline:UY,LucideSplit:qY,LucideSplitSquareHorizontal:rw,LucideSplitSquareVertical:nw,LucideSprayCan:VY,LucideSprout:HY,LucideSquare:wg,LucideSquareActivity:ub,LucideSquareArrowDown:pb,LucideSquareArrowDownLeft:hb,LucideSquareArrowDownRight:fb,LucideSquareArrowLeft:mb,LucideSquareArrowOutDownLeft:gb,LucideSquareArrowOutDownRight:xb,LucideSquareArrowOutUpLeft:yb,LucideSquareArrowOutUpRight:vb,LucideSquareArrowRight:_b,LucideSquareArrowUp:jb,LucideSquareArrowUpLeft:bb,LucideSquareArrowUpRight:wb,LucideSquareAsterisk:kb,LucideSquareBottomDashedScissors:Nb,LucideSquareChartGantt:Ym,LucideSquareCheck:Sb,LucideSquareCheckBig:x0,LucideSquareChevronDown:Cb,LucideSquareChevronLeft:Mb,LucideSquareChevronRight:Tb,LucideSquareChevronUp:Ab,LucideSquareCode:Eb,LucideSquareDashed:Lb,LucideSquareDashedBottom:GY,LucideSquareDashedBottomCode:WY,LucideSquareDashedKanban:Ib,LucideSquareDashedMousePointer:Pb,LucideSquareDivide:Ob,LucideSquareDot:Db,LucideSquareEqual:Rb,LucideSquareFunction:Fb,LucideSquareGanttChart:Ym,LucideSquareKanban:zb,LucideSquareLibrary:Bb,LucideSquareM:$b,LucideSquareMenu:Ub,LucideSquareMinus:qb,LucideSquareMousePointer:Vb,LucideSquareParking:Wb,LucideSquareParkingOff:Hb,LucideSquarePen:ac,LucideSquarePercent:Gb,LucideSquarePi:Kb,LucideSquarePilcrow:Zb,LucideSquarePlay:Yb,LucideSquarePlus:Xb,LucideSquarePower:Qb,LucideSquareRadical:KY,LucideSquareScissors:Jb,LucideSquareSigma:ew,LucideSquareSlash:tw,LucideSquareSplitHorizontal:rw,LucideSquareSplitVertical:nw,LucideSquareSquare:ZY,LucideSquareStack:YY,LucideSquareTerminal:sw,LucideSquareUser:iw,LucideSquareUserRound:aw,LucideSquareX:ow,LucideSquircle:XY,LucideSquirrel:QY,LucideStamp:JY,LucideStar:vs,LucideStarHalf:eX,LucideStarOff:tX,LucideStars:Ms,LucideStepBack:rX,LucideStepForward:nX,LucideStethoscope:sX,LucideSticker:aX,LucideStickyNote:iX,LucideStopCircle:l2,LucideStore:oX,LucideStretchHorizontal:lX,LucideStretchVertical:cX,LucideStrikethrough:dX,LucideSubscript:uX,LucideSubtitles:C_,LucideSun:w1,LucideSunDim:hX,LucideSunMedium:fX,LucideSunMoon:pX,LucideSunSnow:mX,LucideSunrise:gX,LucideSunset:xX,LucideSuperscript:yX,LucideSwatchBook:vX,LucideSwissFranc:_X,LucideSwitchCamera:bX,LucideSword:wX,LucideSwords:jX,LucideSyringe:kX,LucideTable:EX,LucideTable2:ZT,LucideTableCellsMerge:NX,LucideTableCellsSplit:SX,LucideTableColumnsSplit:CX,LucideTableOfContents:MX,LucideTableProperties:TX,LucideTableRowsSplit:AX,LucideTablet:PX,LucideTabletSmartphone:IX,LucideTablets:LX,LucideTag:jg,LucideTags:OX,LucideTally1:DX,LucideTally2:RX,LucideTally3:FX,LucideTally4:zX,LucideTally5:BX,LucideTangent:$X,LucideTarget:Hx,LucideTelescope:UX,LucideTent:VX,LucideTentTree:qX,LucideTerminal:HX,LucideTerminalSquare:sw,LucideTestTube:WX,LucideTestTube2:lw,LucideTestTubeDiagonal:lw,LucideTestTubes:GX,LucideText:QX,LucideTextCursor:ZX,LucideTextCursorInput:KX,LucideTextQuote:YX,LucideTextSearch:XX,LucideTextSelect:cw,LucideTextSelection:cw,LucideTheater:JX,LucideThermometer:rQ,LucideThermometerSnowflake:eQ,LucideThermometerSun:tQ,LucideThumbsDown:YT,LucideThumbsUp:pd,LucideTicket:XT,LucideTicketCheck:nQ,LucideTicketMinus:sQ,LucideTicketPercent:aQ,LucideTicketPlus:iQ,LucideTicketSlash:oQ,LucideTicketX:lQ,LucideTickets:dQ,LucideTicketsPlane:cQ,LucideTimer:fQ,LucideTimerOff:uQ,LucideTimerReset:hQ,LucideToggleLeft:pQ,LucideToggleRight:mQ,LucideToilet:gQ,LucideTornado:xQ,LucideTorus:yQ,LucideTouchpad:_Q,LucideTouchpadOff:vQ,LucideTowerControl:bQ,LucideToyBrick:wQ,LucideTractor:jQ,LucideTrafficCone:kQ,LucideTrain:dw,LucideTrainFront:SQ,LucideTrainFrontTunnel:NQ,LucideTrainTrack:CQ,LucideTramFront:dw,LucideTrash:MQ,LucideTrash2:Vn,LucideTreeDeciduous:TQ,LucideTreePalm:uw,LucideTreePine:j1,LucideTrees:AQ,LucideTrello:EQ,LucideTrendingDown:bj,LucideTrendingUp:Xf,LucideTrendingUpDown:IQ,LucideTriangle:LQ,LucideTriangleAlert:Vh,LucideTriangleRight:PQ,LucideTrophy:Zi,LucideTruck:QT,LucideTurtle:OQ,LucideTv:RQ,LucideTv2:hw,LucideTvMinimal:hw,LucideTvMinimalPlay:DQ,LucideTwitch:FQ,LucideTwitter:zQ,LucideType:$Q,LucideTypeOutline:BQ,LucideUmbrella:qQ,LucideUmbrellaOff:UQ,LucideUnderline:VQ,LucideUndo:mS,LucideUndo2:HQ,LucideUndoDot:WQ,LucideUnfoldHorizontal:GQ,LucideUnfoldVertical:KQ,LucideUngroup:ZQ,LucideUniversity:fw,LucideUnlink:JT,LucideUnlink2:YQ,LucideUnlock:$2,LucideUnlockKeyhole:B2,LucideUnplug:XQ,LucideUpload:uo,LucideUploadCloud:p2,LucideUsb:QQ,LucideUser:Ec,LucideUser2:vw,LucideUserCheck:wj,LucideUserCheck2:pw,LucideUserCircle:d2,LucideUserCircle2:c2,LucideUserCog:eA,LucideUserCog2:mw,LucideUserMinus:JQ,LucideUserMinus2:gw,LucideUserPen:eJ,LucideUserPlus:nf,LucideUserPlus2:xw,LucideUserRound:vw,LucideUserRoundCheck:pw,LucideUserRoundCog:mw,LucideUserRoundMinus:gw,LucideUserRoundPen:tJ,LucideUserRoundPlus:xw,LucideUserRoundSearch:rJ,LucideUserRoundX:yw,LucideUserSearch:nJ,LucideUserSquare:iw,LucideUserSquare2:aw,LucideUserX:sJ,LucideUserX2:yw,LucideUsers:Bn,LucideUsers2:_w,LucideUsersRound:_w,LucideUtensils:ww,LucideUtensilsCrossed:bw,LucideUtilityPole:aJ,LucideVariable:tA,LucideVault:iJ,LucideVegan:oJ,LucideVenetianMask:lJ,LucideVerified:w_,LucideVibrate:dJ,LucideVibrateOff:cJ,LucideVideo:Pa,LucideVideoOff:uJ,LucideVideotape:hJ,LucideView:fJ,LucideVoicemail:pJ,LucideVolleyball:mJ,LucideVolume:_J,LucideVolume1:gJ,LucideVolume2:xJ,LucideVolumeOff:yJ,LucideVolumeX:vJ,LucideVote:bJ,LucideWallet:jJ,LucideWallet2:jw,LucideWalletCards:wJ,LucideWalletMinimal:jw,LucideWallpaper:kJ,LucideWand:NJ,LucideWand2:kw,LucideWandSparkles:kw,LucideWarehouse:SJ,LucideWashingMachine:CJ,LucideWatch:MJ,LucideWaves:TJ,LucideWaypoints:AJ,LucideWebcam:EJ,LucideWebhook:PJ,LucideWebhookOff:IJ,LucideWeight:LJ,LucideWheat:DJ,LucideWheatOff:OJ,LucideWholeWord:RJ,LucideWifi:UJ,LucideWifiHigh:FJ,LucideWifiLow:zJ,LucideWifiOff:BJ,LucideWifiZero:$J,LucideWind:VJ,LucideWindArrowDown:qJ,LucideWine:WJ,LucideWineOff:HJ,LucideWorkflow:GJ,LucideWorm:KJ,LucideWrapText:ZJ,LucideWrench:Wx,LucideX:_s,LucideXCircle:qc,LucideXOctagon:W2,LucideXSquare:ow,LucideYoutube:YJ,LucideZap:kg,LucideZapOff:XJ,LucideZoomIn:gS,LucideZoomOut:xS,Luggage:RV,LuggageIcon:RV,MSquare:$b,MSquareIcon:$b,Magnet:FV,MagnetIcon:FV,Mail:da,MailCheck:zV,MailCheckIcon:zV,MailIcon:da,MailMinus:BV,MailMinusIcon:BV,MailOpen:$V,MailOpenIcon:$V,MailPlus:UV,MailPlusIcon:UV,MailQuestion:qV,MailQuestionIcon:qV,MailSearch:VV,MailSearchIcon:VV,MailWarning:HV,MailWarningIcon:HV,MailX:LT,MailXIcon:LT,Mailbox:WV,MailboxIcon:WV,Mails:GV,MailsIcon:GV,Map:aH,MapIcon:aH,MapPin:fl,MapPinCheck:ZV,MapPinCheckIcon:ZV,MapPinCheckInside:KV,MapPinCheckInsideIcon:KV,MapPinHouse:YV,MapPinHouseIcon:YV,MapPinIcon:fl,MapPinMinus:QV,MapPinMinusIcon:QV,MapPinMinusInside:XV,MapPinMinusInsideIcon:XV,MapPinOff:JV,MapPinOffIcon:JV,MapPinPlus:tH,MapPinPlusIcon:tH,MapPinPlusInside:eH,MapPinPlusInsideIcon:eH,MapPinX:nH,MapPinXIcon:nH,MapPinXInside:rH,MapPinXInsideIcon:rH,MapPinned:sH,MapPinnedIcon:sH,Martini:iH,MartiniIcon:iH,Maximize:lH,Maximize2:oH,Maximize2Icon:oH,MaximizeIcon:lH,Medal:qx,MedalIcon:qx,Megaphone:gm,MegaphoneIcon:gm,MegaphoneOff:cH,MegaphoneOffIcon:cH,Meh:dH,MehIcon:dH,MemoryStick:uH,MemoryStickIcon:uH,Menu:OT,MenuIcon:OT,MenuSquare:Ub,MenuSquareIcon:Ub,Merge:hH,MergeIcon:hH,MessageCircle:Fl,MessageCircleCode:fH,MessageCircleCodeIcon:fH,MessageCircleDashed:pH,MessageCircleDashedIcon:pH,MessageCircleHeart:uS,MessageCircleHeartIcon:uS,MessageCircleIcon:Fl,MessageCircleMore:mH,MessageCircleMoreIcon:mH,MessageCircleOff:gH,MessageCircleOffIcon:gH,MessageCirclePlus:xH,MessageCirclePlusIcon:xH,MessageCircleQuestion:DT,MessageCircleQuestionIcon:DT,MessageCircleReply:yH,MessageCircleReplyIcon:yH,MessageCircleWarning:vH,MessageCircleWarningIcon:vH,MessageCircleX:_H,MessageCircleXIcon:_H,MessageSquare:Lo,MessageSquareCode:bH,MessageSquareCodeIcon:bH,MessageSquareDashed:wH,MessageSquareDashedIcon:wH,MessageSquareDiff:jH,MessageSquareDiffIcon:jH,MessageSquareDot:kH,MessageSquareDotIcon:kH,MessageSquareHeart:NH,MessageSquareHeartIcon:NH,MessageSquareIcon:Lo,MessageSquareLock:SH,MessageSquareLockIcon:SH,MessageSquareMore:CH,MessageSquareMoreIcon:CH,MessageSquareOff:MH,MessageSquareOffIcon:MH,MessageSquarePlus:TH,MessageSquarePlusIcon:TH,MessageSquareQuote:RT,MessageSquareQuoteIcon:RT,MessageSquareReply:AH,MessageSquareReplyIcon:AH,MessageSquareShare:EH,MessageSquareShareIcon:EH,MessageSquareText:IH,MessageSquareTextIcon:IH,MessageSquareWarning:PH,MessageSquareWarningIcon:PH,MessageSquareX:LH,MessageSquareXIcon:LH,MessagesSquare:OH,MessagesSquareIcon:OH,Mic:FT,Mic2:U2,Mic2Icon:U2,MicIcon:FT,MicOff:DH,MicOffIcon:DH,MicVocal:U2,MicVocalIcon:U2,Microchip:RH,MicrochipIcon:RH,Microscope:FH,MicroscopeIcon:FH,Microwave:zH,MicrowaveIcon:zH,Milestone:BH,MilestoneIcon:BH,Milk:UH,MilkIcon:UH,MilkOff:$H,MilkOffIcon:$H,Minimize:VH,Minimize2:qH,Minimize2Icon:qH,MinimizeIcon:VH,Minus:_1,MinusCircle:e2,MinusCircleIcon:e2,MinusIcon:_1,MinusSquare:qb,MinusSquareIcon:qb,Monitor:xj,MonitorCheck:HH,MonitorCheckIcon:HH,MonitorCog:WH,MonitorCogIcon:WH,MonitorDot:GH,MonitorDotIcon:GH,MonitorDown:KH,MonitorDownIcon:KH,MonitorIcon:xj,MonitorOff:ZH,MonitorOffIcon:ZH,MonitorPause:YH,MonitorPauseIcon:YH,MonitorPlay:XH,MonitorPlayIcon:XH,MonitorSmartphone:QH,MonitorSmartphoneIcon:QH,MonitorSpeaker:JH,MonitorSpeakerIcon:JH,MonitorStop:eW,MonitorStopIcon:eW,MonitorUp:tW,MonitorUpIcon:tW,MonitorX:rW,MonitorXIcon:rW,Moon:sW,MoonIcon:sW,MoonStar:nW,MoonStarIcon:nW,MoreHorizontal:em,MoreHorizontalIcon:em,MoreVertical:Sx,MoreVerticalIcon:Sx,Mountain:iW,MountainIcon:iW,MountainSnow:aW,MountainSnowIcon:aW,Mouse:uW,MouseIcon:uW,MouseOff:oW,MouseOffIcon:oW,MousePointer:dW,MousePointer2:lW,MousePointer2Icon:lW,MousePointerBan:cW,MousePointerBanIcon:cW,MousePointerClick:yj,MousePointerClickIcon:yj,MousePointerIcon:dW,MousePointerSquareDashed:Pb,MousePointerSquareDashedIcon:Pb,Move:kW,Move3D:q2,Move3DIcon:q2,Move3d:q2,Move3dIcon:q2,MoveDiagonal:fW,MoveDiagonal2:hW,MoveDiagonal2Icon:hW,MoveDiagonalIcon:fW,MoveDown:gW,MoveDownIcon:gW,MoveDownLeft:pW,MoveDownLeftIcon:pW,MoveDownRight:mW,MoveDownRightIcon:mW,MoveHorizontal:xW,MoveHorizontalIcon:xW,MoveIcon:kW,MoveLeft:yW,MoveLeftIcon:yW,MoveRight:vW,MoveRightIcon:vW,MoveUp:wW,MoveUpIcon:wW,MoveUpLeft:_W,MoveUpLeftIcon:_W,MoveUpRight:bW,MoveUpRightIcon:bW,MoveVertical:jW,MoveVerticalIcon:jW,Music:MW,Music2:NW,Music2Icon:NW,Music3:SW,Music3Icon:SW,Music4:CW,Music4Icon:CW,MusicIcon:MW,Navigation:zT,Navigation2:AW,Navigation2Icon:AW,Navigation2Off:TW,Navigation2OffIcon:TW,NavigationIcon:zT,NavigationOff:EW,NavigationOffIcon:EW,Network:IW,NetworkIcon:IW,Newspaper:Vx,NewspaperIcon:Vx,Nfc:PW,NfcIcon:PW,Notebook:RW,NotebookIcon:RW,NotebookPen:LW,NotebookPenIcon:LW,NotebookTabs:OW,NotebookTabsIcon:OW,NotebookText:DW,NotebookTextIcon:DW,NotepadText:zW,NotepadTextDashed:FW,NotepadTextDashedIcon:FW,NotepadTextIcon:zW,Nut:$W,NutIcon:$W,NutOff:BW,NutOffIcon:BW,Octagon:qW,OctagonAlert:V2,OctagonAlertIcon:V2,OctagonIcon:qW,OctagonMinus:UW,OctagonMinusIcon:UW,OctagonPause:H2,OctagonPauseIcon:H2,OctagonX:W2,OctagonXIcon:W2,Omega:VW,OmegaIcon:VW,Option:HW,OptionIcon:HW,Orbit:WW,OrbitIcon:WW,Origami:GW,OrigamiIcon:GW,Outdent:R2,OutdentIcon:R2,Package:zl,Package2:KW,Package2Icon:KW,PackageCheck:ZW,PackageCheckIcon:ZW,PackageIcon:zl,PackageMinus:YW,PackageMinusIcon:YW,PackageOpen:XW,PackageOpenIcon:XW,PackagePlus:QW,PackagePlusIcon:QW,PackageSearch:JW,PackageSearchIcon:JW,PackageX:eG,PackageXIcon:eG,PaintBucket:tG,PaintBucketIcon:tG,PaintRoller:rG,PaintRollerIcon:rG,Paintbrush:nG,Paintbrush2:G2,Paintbrush2Icon:G2,PaintbrushIcon:nG,PaintbrushVertical:G2,PaintbrushVerticalIcon:G2,Palette:Fd,PaletteIcon:Fd,Palmtree:uw,PalmtreeIcon:uw,PanelBottom:iG,PanelBottomClose:sG,PanelBottomCloseIcon:sG,PanelBottomDashed:K2,PanelBottomDashedIcon:K2,PanelBottomIcon:iG,PanelBottomInactive:K2,PanelBottomInactiveIcon:K2,PanelBottomOpen:aG,PanelBottomOpenIcon:aG,PanelLeft:Q2,PanelLeftClose:Z2,PanelLeftCloseIcon:Z2,PanelLeftDashed:Y2,PanelLeftDashedIcon:Y2,PanelLeftIcon:Q2,PanelLeftInactive:Y2,PanelLeftInactiveIcon:Y2,PanelLeftOpen:X2,PanelLeftOpenIcon:X2,PanelRight:cG,PanelRightClose:oG,PanelRightCloseIcon:oG,PanelRightDashed:J2,PanelRightDashedIcon:J2,PanelRightIcon:cG,PanelRightInactive:J2,PanelRightInactiveIcon:J2,PanelRightOpen:lG,PanelRightOpenIcon:lG,PanelTop:hG,PanelTopClose:dG,PanelTopCloseIcon:dG,PanelTopDashed:eb,PanelTopDashedIcon:eb,PanelTopIcon:hG,PanelTopInactive:eb,PanelTopInactiveIcon:eb,PanelTopOpen:uG,PanelTopOpenIcon:uG,PanelsLeftBottom:fG,PanelsLeftBottomIcon:fG,PanelsLeftRight:x2,PanelsLeftRightIcon:x2,PanelsRightBottom:pG,PanelsRightBottomIcon:pG,PanelsTopBottom:ib,PanelsTopBottomIcon:ib,PanelsTopLeft:m0,PanelsTopLeftIcon:m0,Paperclip:mG,PaperclipIcon:mG,Parentheses:gG,ParenthesesIcon:gG,ParkingCircle:r2,ParkingCircleIcon:r2,ParkingCircleOff:t2,ParkingCircleOffIcon:t2,ParkingMeter:xG,ParkingMeterIcon:xG,ParkingSquare:Wb,ParkingSquareIcon:Wb,ParkingSquareOff:Hb,ParkingSquareOffIcon:Hb,PartyPopper:Ac,PartyPopperIcon:Ac,Pause:Yf,PauseCircle:n2,PauseCircleIcon:n2,PauseIcon:Yf,PauseOctagon:H2,PauseOctagonIcon:H2,PawPrint:yG,PawPrintIcon:yG,PcCase:vG,PcCaseIcon:vG,Pen:g0,PenBox:ac,PenBoxIcon:ac,PenIcon:g0,PenLine:tb,PenLineIcon:tb,PenOff:_G,PenOffIcon:_G,PenSquare:ac,PenSquareIcon:ac,PenTool:vj,PenToolIcon:vj,Pencil:_i,PencilIcon:_i,PencilLine:bG,PencilLineIcon:bG,PencilOff:wG,PencilOffIcon:wG,PencilRuler:jG,PencilRulerIcon:jG,Pentagon:kG,PentagonIcon:kG,Percent:hS,PercentCircle:s2,PercentCircleIcon:s2,PercentDiamond:v2,PercentDiamondIcon:v2,PercentIcon:hS,PercentSquare:Gb,PercentSquareIcon:Gb,PersonStanding:NG,PersonStandingIcon:NG,PhilippinePeso:SG,PhilippinePesoIcon:SG,Phone:bi,PhoneCall:CG,PhoneCallIcon:CG,PhoneForwarded:MG,PhoneForwardedIcon:MG,PhoneIcon:bi,PhoneIncoming:TG,PhoneIncomingIcon:TG,PhoneMissed:AG,PhoneMissedIcon:AG,PhoneOff:EG,PhoneOffIcon:EG,PhoneOutgoing:IG,PhoneOutgoingIcon:IG,Pi:PG,PiIcon:PG,PiSquare:Kb,PiSquareIcon:Kb,Piano:LG,PianoIcon:LG,Pickaxe:OG,PickaxeIcon:OG,PictureInPicture:RG,PictureInPicture2:DG,PictureInPicture2Icon:DG,PictureInPictureIcon:RG,PieChart:F_,PieChartIcon:F_,PiggyBank:FG,PiggyBankIcon:FG,Pilcrow:$G,PilcrowIcon:$G,PilcrowLeft:zG,PilcrowLeftIcon:zG,PilcrowRight:BG,PilcrowRightIcon:BG,PilcrowSquare:Zb,PilcrowSquareIcon:Zb,Pill:qG,PillBottle:UG,PillBottleIcon:UG,PillIcon:qG,Pin:b1,PinIcon:b1,PinOff:BT,PinOffIcon:BT,Pipette:VG,PipetteIcon:VG,Pizza:HG,PizzaIcon:HG,Plane:KG,PlaneIcon:KG,PlaneLanding:WG,PlaneLandingIcon:WG,PlaneTakeoff:GG,PlaneTakeoffIcon:GG,Play:hc,PlayCircle:Bf,PlayCircleIcon:Bf,PlayIcon:hc,PlaySquare:Yb,PlaySquareIcon:Yb,Plug:YG,Plug2:ZG,Plug2Icon:ZG,PlugIcon:YG,PlugZap:rb,PlugZap2:rb,PlugZap2Icon:rb,PlugZapIcon:rb,Plus:bn,PlusCircle:a2,PlusCircleIcon:a2,PlusIcon:bn,PlusSquare:Xb,PlusSquareIcon:Xb,Pocket:QG,PocketIcon:QG,PocketKnife:XG,PocketKnifeIcon:XG,Podcast:JG,PodcastIcon:JG,Pointer:tK,PointerIcon:tK,PointerOff:eK,PointerOffIcon:eK,Popcorn:rK,PopcornIcon:rK,Popsicle:nK,PopsicleIcon:nK,PoundSterling:sK,PoundSterlingIcon:sK,Power:iK,PowerCircle:i2,PowerCircleIcon:i2,PowerIcon:iK,PowerOff:aK,PowerOffIcon:aK,PowerSquare:Qb,PowerSquareIcon:Qb,Presentation:oK,PresentationIcon:oK,Printer:cK,PrinterCheck:lK,PrinterCheckIcon:lK,PrinterIcon:cK,Projector:dK,ProjectorIcon:dK,Proportions:uK,ProportionsIcon:uK,Puzzle:hK,PuzzleIcon:hK,Pyramid:fK,PyramidIcon:fK,QrCode:$T,QrCodeIcon:$T,Quote:UT,QuoteIcon:UT,Rabbit:pK,RabbitIcon:pK,Radar:mK,RadarIcon:mK,Radiation:gK,RadiationIcon:gK,Radical:xK,RadicalIcon:xK,Radio:_j,RadioIcon:_j,RadioReceiver:yK,RadioReceiverIcon:yK,RadioTower:vK,RadioTowerIcon:vK,Radius:_K,RadiusIcon:_K,RailSymbol:bK,RailSymbolIcon:bK,Rainbow:wK,RainbowIcon:wK,Rat:jK,RatIcon:jK,Ratio:kK,RatioIcon:kK,Receipt:PK,ReceiptCent:NK,ReceiptCentIcon:NK,ReceiptEuro:SK,ReceiptEuroIcon:SK,ReceiptIcon:PK,ReceiptIndianRupee:CK,ReceiptIndianRupeeIcon:CK,ReceiptJapaneseYen:MK,ReceiptJapaneseYenIcon:MK,ReceiptPoundSterling:TK,ReceiptPoundSterlingIcon:TK,ReceiptRussianRuble:AK,ReceiptRussianRubleIcon:AK,ReceiptSwissFranc:EK,ReceiptSwissFrancIcon:EK,ReceiptText:IK,ReceiptTextIcon:IK,RectangleEllipsis:nb,RectangleEllipsisIcon:nb,RectangleHorizontal:LK,RectangleHorizontalIcon:LK,RectangleVertical:OK,RectangleVerticalIcon:OK,Recycle:DK,RecycleIcon:DK,Redo:fS,Redo2:RK,Redo2Icon:RK,RedoDot:FK,RedoDotIcon:FK,RedoIcon:fS,RefreshCcw:BK,RefreshCcwDot:zK,RefreshCcwDotIcon:zK,RefreshCcwIcon:BK,RefreshCw:Gl,RefreshCwIcon:Gl,RefreshCwOff:$K,RefreshCwOffIcon:$K,Refrigerator:UK,RefrigeratorIcon:UK,Regex:qK,RegexIcon:qK,RemoveFormatting:VK,RemoveFormattingIcon:VK,Repeat:qT,Repeat1:HK,Repeat1Icon:HK,Repeat2:WK,Repeat2Icon:WK,RepeatIcon:qT,Replace:KK,ReplaceAll:GK,ReplaceAllIcon:GK,ReplaceIcon:KK,Reply:VT,ReplyAll:ZK,ReplyAllIcon:ZK,ReplyIcon:VT,Rewind:YK,RewindIcon:YK,Ribbon:XK,RibbonIcon:XK,Rocket:yg,RocketIcon:yg,RockingChair:QK,RockingChairIcon:QK,RollerCoaster:JK,RollerCoasterIcon:JK,Rotate3D:sb,Rotate3DIcon:sb,Rotate3d:sb,Rotate3dIcon:sb,RotateCcw:pS,RotateCcwIcon:pS,RotateCcwSquare:eZ,RotateCcwSquareIcon:eZ,RotateCw:HT,RotateCwIcon:HT,RotateCwSquare:tZ,RotateCwSquareIcon:tZ,Route:nZ,RouteIcon:nZ,RouteOff:rZ,RouteOffIcon:rZ,Router:sZ,RouterIcon:sZ,Rows:ab,Rows2:ab,Rows2Icon:ab,Rows3:ib,Rows3Icon:ib,Rows4:aZ,Rows4Icon:aZ,RowsIcon:ab,Rss:iZ,RssIcon:iZ,Ruler:oZ,RulerIcon:oZ,RussianRuble:lZ,RussianRubleIcon:lZ,Sailboat:cZ,SailboatIcon:cZ,Salad:dZ,SaladIcon:dZ,Sandwich:uZ,SandwichIcon:uZ,Satellite:fZ,SatelliteDish:hZ,SatelliteDishIcon:hZ,SatelliteIcon:fZ,Save:vg,SaveAll:pZ,SaveAllIcon:pZ,SaveIcon:vg,SaveOff:mZ,SaveOffIcon:mZ,Scale:gZ,Scale3D:ob,Scale3DIcon:ob,Scale3d:ob,Scale3dIcon:ob,ScaleIcon:gZ,Scaling:xZ,ScalingIcon:xZ,Scan:NZ,ScanBarcode:yZ,ScanBarcodeIcon:yZ,ScanEye:vZ,ScanEyeIcon:vZ,ScanFace:_Z,ScanFaceIcon:_Z,ScanIcon:NZ,ScanLine:bZ,ScanLineIcon:bZ,ScanQrCode:wZ,ScanQrCodeIcon:wZ,ScanSearch:jZ,ScanSearchIcon:jZ,ScanText:kZ,ScanTextIcon:kZ,ScatterChart:z_,ScatterChartIcon:z_,School:SZ,School2:fw,School2Icon:fw,SchoolIcon:SZ,Scissors:MZ,ScissorsIcon:MZ,ScissorsLineDashed:CZ,ScissorsLineDashedIcon:CZ,ScissorsSquare:Jb,ScissorsSquareDashedBottom:Nb,ScissorsSquareDashedBottomIcon:Nb,ScissorsSquareIcon:Jb,ScreenShare:AZ,ScreenShareIcon:AZ,ScreenShareOff:TZ,ScreenShareOffIcon:TZ,Scroll:IZ,ScrollIcon:IZ,ScrollText:EZ,ScrollTextIcon:EZ,Search:wa,SearchCheck:PZ,SearchCheckIcon:PZ,SearchCode:LZ,SearchCodeIcon:LZ,SearchIcon:wa,SearchSlash:OZ,SearchSlashIcon:OZ,SearchX:DZ,SearchXIcon:DZ,Section:RZ,SectionIcon:RZ,Send:Oo,SendHorizonal:lb,SendHorizonalIcon:lb,SendHorizontal:lb,SendHorizontalIcon:lb,SendIcon:Oo,SendToBack:FZ,SendToBackIcon:FZ,SeparatorHorizontal:zZ,SeparatorHorizontalIcon:zZ,SeparatorVertical:BZ,SeparatorVerticalIcon:BZ,Server:VZ,ServerCog:$Z,ServerCogIcon:$Z,ServerCrash:UZ,ServerCrashIcon:UZ,ServerIcon:VZ,ServerOff:qZ,ServerOffIcon:qZ,Settings:fd,Settings2:HZ,Settings2Icon:HZ,SettingsIcon:fd,Shapes:WZ,ShapesIcon:WZ,Share:WT,Share2:fc,Share2Icon:fc,ShareIcon:WT,Sheet:GZ,SheetIcon:GZ,Shell:KZ,ShellIcon:KZ,Shield:rf,ShieldAlert:ZZ,ShieldAlertIcon:ZZ,ShieldBan:YZ,ShieldBanIcon:YZ,ShieldCheck:GT,ShieldCheckIcon:GT,ShieldClose:cb,ShieldCloseIcon:cb,ShieldEllipsis:XZ,ShieldEllipsisIcon:XZ,ShieldHalf:QZ,ShieldHalfIcon:QZ,ShieldIcon:rf,ShieldMinus:JZ,ShieldMinusIcon:JZ,ShieldOff:eY,ShieldOffIcon:eY,ShieldPlus:tY,ShieldPlusIcon:tY,ShieldQuestion:rY,ShieldQuestionIcon:rY,ShieldX:cb,ShieldXIcon:cb,Ship:sY,ShipIcon:sY,ShipWheel:nY,ShipWheelIcon:nY,Shirt:aY,ShirtIcon:aY,ShoppingBag:_g,ShoppingBagIcon:_g,ShoppingBasket:iY,ShoppingBasketIcon:iY,ShoppingCart:fh,ShoppingCartIcon:fh,Shovel:oY,ShovelIcon:oY,ShowerHead:lY,ShowerHeadIcon:lY,Shrink:cY,ShrinkIcon:cY,Shrub:dY,ShrubIcon:dY,Shuffle:uY,ShuffleIcon:uY,Sidebar:Q2,SidebarClose:Z2,SidebarCloseIcon:Z2,SidebarIcon:Q2,SidebarOpen:X2,SidebarOpenIcon:X2,Sigma:hY,SigmaIcon:hY,SigmaSquare:ew,SigmaSquareIcon:ew,Signal:xY,SignalHigh:fY,SignalHighIcon:fY,SignalIcon:xY,SignalLow:pY,SignalLowIcon:pY,SignalMedium:mY,SignalMediumIcon:mY,SignalZero:gY,SignalZeroIcon:gY,Signature:yY,SignatureIcon:yY,Signpost:_Y,SignpostBig:vY,SignpostBigIcon:vY,SignpostIcon:_Y,Siren:bY,SirenIcon:bY,SkipBack:wY,SkipBackIcon:wY,SkipForward:jY,SkipForwardIcon:jY,Skull:kY,SkullIcon:kY,Slack:NY,SlackIcon:NY,Slash:SY,SlashIcon:SY,SlashSquare:tw,SlashSquareIcon:tw,Slice:CY,SliceIcon:CY,Sliders:db,SlidersHorizontal:KT,SlidersHorizontalIcon:KT,SlidersIcon:db,SlidersVertical:db,SlidersVerticalIcon:db,Smartphone:bg,SmartphoneCharging:MY,SmartphoneChargingIcon:MY,SmartphoneIcon:bg,SmartphoneNfc:TY,SmartphoneNfcIcon:TY,Smile:EY,SmileIcon:EY,SmilePlus:AY,SmilePlusIcon:AY,Snail:IY,SnailIcon:IY,Snowflake:V0,SnowflakeIcon:V0,Sofa:PY,SofaIcon:PY,SortAsc:v_,SortAscIcon:v_,SortDesc:g_,SortDescIcon:g_,Soup:LY,SoupIcon:LY,Space:OY,SpaceIcon:OY,Spade:DY,SpadeIcon:DY,Sparkle:RY,SparkleIcon:RY,Sparkles:Ms,SparklesIcon:Ms,Speaker:FY,SpeakerIcon:FY,Speech:zY,SpeechIcon:zY,SpellCheck:$Y,SpellCheck2:BY,SpellCheck2Icon:BY,SpellCheckIcon:$Y,Spline:UY,SplineIcon:UY,Split:qY,SplitIcon:qY,SplitSquareHorizontal:rw,SplitSquareHorizontalIcon:rw,SplitSquareVertical:nw,SplitSquareVerticalIcon:nw,SprayCan:VY,SprayCanIcon:VY,Sprout:HY,SproutIcon:HY,Square:wg,SquareActivity:ub,SquareActivityIcon:ub,SquareArrowDown:pb,SquareArrowDownIcon:pb,SquareArrowDownLeft:hb,SquareArrowDownLeftIcon:hb,SquareArrowDownRight:fb,SquareArrowDownRightIcon:fb,SquareArrowLeft:mb,SquareArrowLeftIcon:mb,SquareArrowOutDownLeft:gb,SquareArrowOutDownLeftIcon:gb,SquareArrowOutDownRight:xb,SquareArrowOutDownRightIcon:xb,SquareArrowOutUpLeft:yb,SquareArrowOutUpLeftIcon:yb,SquareArrowOutUpRight:vb,SquareArrowOutUpRightIcon:vb,SquareArrowRight:_b,SquareArrowRightIcon:_b,SquareArrowUp:jb,SquareArrowUpIcon:jb,SquareArrowUpLeft:bb,SquareArrowUpLeftIcon:bb,SquareArrowUpRight:wb,SquareArrowUpRightIcon:wb,SquareAsterisk:kb,SquareAsteriskIcon:kb,SquareBottomDashedScissors:Nb,SquareBottomDashedScissorsIcon:Nb,SquareChartGantt:Ym,SquareChartGanttIcon:Ym,SquareCheck:Sb,SquareCheckBig:x0,SquareCheckBigIcon:x0,SquareCheckIcon:Sb,SquareChevronDown:Cb,SquareChevronDownIcon:Cb,SquareChevronLeft:Mb,SquareChevronLeftIcon:Mb,SquareChevronRight:Tb,SquareChevronRightIcon:Tb,SquareChevronUp:Ab,SquareChevronUpIcon:Ab,SquareCode:Eb,SquareCodeIcon:Eb,SquareDashed:Lb,SquareDashedBottom:GY,SquareDashedBottomCode:WY,SquareDashedBottomCodeIcon:WY,SquareDashedBottomIcon:GY,SquareDashedIcon:Lb,SquareDashedKanban:Ib,SquareDashedKanbanIcon:Ib,SquareDashedMousePointer:Pb,SquareDashedMousePointerIcon:Pb,SquareDivide:Ob,SquareDivideIcon:Ob,SquareDot:Db,SquareDotIcon:Db,SquareEqual:Rb,SquareEqualIcon:Rb,SquareFunction:Fb,SquareFunctionIcon:Fb,SquareGanttChart:Ym,SquareGanttChartIcon:Ym,SquareIcon:wg,SquareKanban:zb,SquareKanbanIcon:zb,SquareLibrary:Bb,SquareLibraryIcon:Bb,SquareM:$b,SquareMIcon:$b,SquareMenu:Ub,SquareMenuIcon:Ub,SquareMinus:qb,SquareMinusIcon:qb,SquareMousePointer:Vb,SquareMousePointerIcon:Vb,SquareParking:Wb,SquareParkingIcon:Wb,SquareParkingOff:Hb,SquareParkingOffIcon:Hb,SquarePen:ac,SquarePenIcon:ac,SquarePercent:Gb,SquarePercentIcon:Gb,SquarePi:Kb,SquarePiIcon:Kb,SquarePilcrow:Zb,SquarePilcrowIcon:Zb,SquarePlay:Yb,SquarePlayIcon:Yb,SquarePlus:Xb,SquarePlusIcon:Xb,SquarePower:Qb,SquarePowerIcon:Qb,SquareRadical:KY,SquareRadicalIcon:KY,SquareScissors:Jb,SquareScissorsIcon:Jb,SquareSigma:ew,SquareSigmaIcon:ew,SquareSlash:tw,SquareSlashIcon:tw,SquareSplitHorizontal:rw,SquareSplitHorizontalIcon:rw,SquareSplitVertical:nw,SquareSplitVerticalIcon:nw,SquareSquare:ZY,SquareSquareIcon:ZY,SquareStack:YY,SquareStackIcon:YY,SquareTerminal:sw,SquareTerminalIcon:sw,SquareUser:iw,SquareUserIcon:iw,SquareUserRound:aw,SquareUserRoundIcon:aw,SquareX:ow,SquareXIcon:ow,Squircle:XY,SquircleIcon:XY,Squirrel:QY,SquirrelIcon:QY,Stamp:JY,StampIcon:JY,Star:vs,StarHalf:eX,StarHalfIcon:eX,StarIcon:vs,StarOff:tX,StarOffIcon:tX,Stars:Ms,StarsIcon:Ms,StepBack:rX,StepBackIcon:rX,StepForward:nX,StepForwardIcon:nX,Stethoscope:sX,StethoscopeIcon:sX,Sticker:aX,StickerIcon:aX,StickyNote:iX,StickyNoteIcon:iX,StopCircle:l2,StopCircleIcon:l2,Store:oX,StoreIcon:oX,StretchHorizontal:lX,StretchHorizontalIcon:lX,StretchVertical:cX,StretchVerticalIcon:cX,Strikethrough:dX,StrikethroughIcon:dX,Subscript:uX,SubscriptIcon:uX,Subtitles:C_,SubtitlesIcon:C_,Sun:w1,SunDim:hX,SunDimIcon:hX,SunIcon:w1,SunMedium:fX,SunMediumIcon:fX,SunMoon:pX,SunMoonIcon:pX,SunSnow:mX,SunSnowIcon:mX,Sunrise:gX,SunriseIcon:gX,Sunset:xX,SunsetIcon:xX,Superscript:yX,SuperscriptIcon:yX,SwatchBook:vX,SwatchBookIcon:vX,SwissFranc:_X,SwissFrancIcon:_X,SwitchCamera:bX,SwitchCameraIcon:bX,Sword:wX,SwordIcon:wX,Swords:jX,SwordsIcon:jX,Syringe:kX,SyringeIcon:kX,Table:EX,Table2:ZT,Table2Icon:ZT,TableCellsMerge:NX,TableCellsMergeIcon:NX,TableCellsSplit:SX,TableCellsSplitIcon:SX,TableColumnsSplit:CX,TableColumnsSplitIcon:CX,TableIcon:EX,TableOfContents:MX,TableOfContentsIcon:MX,TableProperties:TX,TablePropertiesIcon:TX,TableRowsSplit:AX,TableRowsSplitIcon:AX,Tablet:PX,TabletIcon:PX,TabletSmartphone:IX,TabletSmartphoneIcon:IX,Tablets:LX,TabletsIcon:LX,Tag:jg,TagIcon:jg,Tags:OX,TagsIcon:OX,Tally1:DX,Tally1Icon:DX,Tally2:RX,Tally2Icon:RX,Tally3:FX,Tally3Icon:FX,Tally4:zX,Tally4Icon:zX,Tally5:BX,Tally5Icon:BX,Tangent:$X,TangentIcon:$X,Target:Hx,TargetIcon:Hx,Telescope:UX,TelescopeIcon:UX,Tent:VX,TentIcon:VX,TentTree:qX,TentTreeIcon:qX,Terminal:HX,TerminalIcon:HX,TerminalSquare:sw,TerminalSquareIcon:sw,TestTube:WX,TestTube2:lw,TestTube2Icon:lw,TestTubeDiagonal:lw,TestTubeDiagonalIcon:lw,TestTubeIcon:WX,TestTubes:GX,TestTubesIcon:GX,Text:QX,TextCursor:ZX,TextCursorIcon:ZX,TextCursorInput:KX,TextCursorInputIcon:KX,TextIcon:QX,TextQuote:YX,TextQuoteIcon:YX,TextSearch:XX,TextSearchIcon:XX,TextSelect:cw,TextSelectIcon:cw,TextSelection:cw,TextSelectionIcon:cw,Theater:JX,TheaterIcon:JX,Thermometer:rQ,ThermometerIcon:rQ,ThermometerSnowflake:eQ,ThermometerSnowflakeIcon:eQ,ThermometerSun:tQ,ThermometerSunIcon:tQ,ThumbsDown:YT,ThumbsDownIcon:YT,ThumbsUp:pd,ThumbsUpIcon:pd,Ticket:XT,TicketCheck:nQ,TicketCheckIcon:nQ,TicketIcon:XT,TicketMinus:sQ,TicketMinusIcon:sQ,TicketPercent:aQ,TicketPercentIcon:aQ,TicketPlus:iQ,TicketPlusIcon:iQ,TicketSlash:oQ,TicketSlashIcon:oQ,TicketX:lQ,TicketXIcon:lQ,Tickets:dQ,TicketsIcon:dQ,TicketsPlane:cQ,TicketsPlaneIcon:cQ,Timer:fQ,TimerIcon:fQ,TimerOff:uQ,TimerOffIcon:uQ,TimerReset:hQ,TimerResetIcon:hQ,ToggleLeft:pQ,ToggleLeftIcon:pQ,ToggleRight:mQ,ToggleRightIcon:mQ,Toilet:gQ,ToiletIcon:gQ,Tornado:xQ,TornadoIcon:xQ,Torus:yQ,TorusIcon:yQ,Touchpad:_Q,TouchpadIcon:_Q,TouchpadOff:vQ,TouchpadOffIcon:vQ,TowerControl:bQ,TowerControlIcon:bQ,ToyBrick:wQ,ToyBrickIcon:wQ,Tractor:jQ,TractorIcon:jQ,TrafficCone:kQ,TrafficConeIcon:kQ,Train:dw,TrainFront:SQ,TrainFrontIcon:SQ,TrainFrontTunnel:NQ,TrainFrontTunnelIcon:NQ,TrainIcon:dw,TrainTrack:CQ,TrainTrackIcon:CQ,TramFront:dw,TramFrontIcon:dw,Trash:MQ,Trash2:Vn,Trash2Icon:Vn,TrashIcon:MQ,TreeDeciduous:TQ,TreeDeciduousIcon:TQ,TreePalm:uw,TreePalmIcon:uw,TreePine:j1,TreePineIcon:j1,Trees:AQ,TreesIcon:AQ,Trello:EQ,TrelloIcon:EQ,TrendingDown:bj,TrendingDownIcon:bj,TrendingUp:Xf,TrendingUpDown:IQ,TrendingUpDownIcon:IQ,TrendingUpIcon:Xf,Triangle:LQ,TriangleAlert:Vh,TriangleAlertIcon:Vh,TriangleIcon:LQ,TriangleRight:PQ,TriangleRightIcon:PQ,Trophy:Zi,TrophyIcon:Zi,Truck:QT,TruckIcon:QT,Turtle:OQ,TurtleIcon:OQ,Tv:RQ,Tv2:hw,Tv2Icon:hw,TvIcon:RQ,TvMinimal:hw,TvMinimalIcon:hw,TvMinimalPlay:DQ,TvMinimalPlayIcon:DQ,Twitch:FQ,TwitchIcon:FQ,Twitter:zQ,TwitterIcon:zQ,Type:$Q,TypeIcon:$Q,TypeOutline:BQ,TypeOutlineIcon:BQ,Umbrella:qQ,UmbrellaIcon:qQ,UmbrellaOff:UQ,UmbrellaOffIcon:UQ,Underline:VQ,UnderlineIcon:VQ,Undo:mS,Undo2:HQ,Undo2Icon:HQ,UndoDot:WQ,UndoDotIcon:WQ,UndoIcon:mS,UnfoldHorizontal:GQ,UnfoldHorizontalIcon:GQ,UnfoldVertical:KQ,UnfoldVerticalIcon:KQ,Ungroup:ZQ,UngroupIcon:ZQ,University:fw,UniversityIcon:fw,Unlink:JT,Unlink2:YQ,Unlink2Icon:YQ,UnlinkIcon:JT,Unlock:$2,UnlockIcon:$2,UnlockKeyhole:B2,UnlockKeyholeIcon:B2,Unplug:XQ,UnplugIcon:XQ,Upload:uo,UploadCloud:p2,UploadCloudIcon:p2,UploadIcon:uo,Usb:QQ,UsbIcon:QQ,User:Ec,User2:vw,User2Icon:vw,UserCheck:wj,UserCheck2:pw,UserCheck2Icon:pw,UserCheckIcon:wj,UserCircle:d2,UserCircle2:c2,UserCircle2Icon:c2,UserCircleIcon:d2,UserCog:eA,UserCog2:mw,UserCog2Icon:mw,UserCogIcon:eA,UserIcon:Ec,UserMinus:JQ,UserMinus2:gw,UserMinus2Icon:gw,UserMinusIcon:JQ,UserPen:eJ,UserPenIcon:eJ,UserPlus:nf,UserPlus2:xw,UserPlus2Icon:xw,UserPlusIcon:nf,UserRound:vw,UserRoundCheck:pw,UserRoundCheckIcon:pw,UserRoundCog:mw,UserRoundCogIcon:mw,UserRoundIcon:vw,UserRoundMinus:gw,UserRoundMinusIcon:gw,UserRoundPen:tJ,UserRoundPenIcon:tJ,UserRoundPlus:xw,UserRoundPlusIcon:xw,UserRoundSearch:rJ,UserRoundSearchIcon:rJ,UserRoundX:yw,UserRoundXIcon:yw,UserSearch:nJ,UserSearchIcon:nJ,UserSquare:iw,UserSquare2:aw,UserSquare2Icon:aw,UserSquareIcon:iw,UserX:sJ,UserX2:yw,UserX2Icon:yw,UserXIcon:sJ,Users:Bn,Users2:_w,Users2Icon:_w,UsersIcon:Bn,UsersRound:_w,UsersRoundIcon:_w,Utensils:ww,UtensilsCrossed:bw,UtensilsCrossedIcon:bw,UtensilsIcon:ww,UtilityPole:aJ,UtilityPoleIcon:aJ,Variable:tA,VariableIcon:tA,Vault:iJ,VaultIcon:iJ,Vegan:oJ,VeganIcon:oJ,VenetianMask:lJ,VenetianMaskIcon:lJ,Verified:w_,VerifiedIcon:w_,Vibrate:dJ,VibrateIcon:dJ,VibrateOff:cJ,VibrateOffIcon:cJ,Video:Pa,VideoIcon:Pa,VideoOff:uJ,VideoOffIcon:uJ,Videotape:hJ,VideotapeIcon:hJ,View:fJ,ViewIcon:fJ,Voicemail:pJ,VoicemailIcon:pJ,Volleyball:mJ,VolleyballIcon:mJ,Volume:_J,Volume1:gJ,Volume1Icon:gJ,Volume2:xJ,Volume2Icon:xJ,VolumeIcon:_J,VolumeOff:yJ,VolumeOffIcon:yJ,VolumeX:vJ,VolumeXIcon:vJ,Vote:bJ,VoteIcon:bJ,Wallet:jJ,Wallet2:jw,Wallet2Icon:jw,WalletCards:wJ,WalletCardsIcon:wJ,WalletIcon:jJ,WalletMinimal:jw,WalletMinimalIcon:jw,Wallpaper:kJ,WallpaperIcon:kJ,Wand:NJ,Wand2:kw,Wand2Icon:kw,WandIcon:NJ,WandSparkles:kw,WandSparklesIcon:kw,Warehouse:SJ,WarehouseIcon:SJ,WashingMachine:CJ,WashingMachineIcon:CJ,Watch:MJ,WatchIcon:MJ,Waves:TJ,WavesIcon:TJ,Waypoints:AJ,WaypointsIcon:AJ,Webcam:EJ,WebcamIcon:EJ,Webhook:PJ,WebhookIcon:PJ,WebhookOff:IJ,WebhookOffIcon:IJ,Weight:LJ,WeightIcon:LJ,Wheat:DJ,WheatIcon:DJ,WheatOff:OJ,WheatOffIcon:OJ,WholeWord:RJ,WholeWordIcon:RJ,Wifi:UJ,WifiHigh:FJ,WifiHighIcon:FJ,WifiIcon:UJ,WifiLow:zJ,WifiLowIcon:zJ,WifiOff:BJ,WifiOffIcon:BJ,WifiZero:$J,WifiZeroIcon:$J,Wind:VJ,WindArrowDown:qJ,WindArrowDownIcon:qJ,WindIcon:VJ,Wine:WJ,WineIcon:WJ,WineOff:HJ,WineOffIcon:HJ,Workflow:GJ,WorkflowIcon:GJ,Worm:KJ,WormIcon:KJ,WrapText:ZJ,WrapTextIcon:ZJ,Wrench:Wx,WrenchIcon:Wx,X:_s,XCircle:qc,XCircleIcon:qc,XIcon:_s,XOctagon:W2,XOctagonIcon:W2,XSquare:ow,XSquareIcon:ow,Youtube:YJ,YoutubeIcon:YJ,Zap:kg,ZapIcon:kg,ZapOff:XJ,ZapOffIcon:XJ,ZoomIn:gS,ZoomInIcon:gS,ZoomOut:xS,ZoomOutIcon:xS,createLucideIcon:U,icons:rZe},Symbol.toStringTag,{value:"Module"})),$me="-",nZe=t=>{const e=aZe(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:s}=t;return{getClassGroupId:l=>{const i=l.split($me);return i[0]===""&&i.length!==1&&i.shift(),gAe(i,e)||sZe(l)},getConflictingClassGroupIds:(l,i)=>{const h=n[l]||[];return i&&s[l]?[...h,...s[l]]:h}}},gAe=(t,e)=>{var l;if(t.length===0)return e.classGroupId;const n=t[0],s=e.nextPart.get(n),a=s?gAe(t.slice(1),s):void 0;if(a)return a;if(e.validators.length===0)return;const o=t.join($me);return(l=e.validators.find(({validator:i})=>i(o)))==null?void 0:l.classGroupId},Hbe=/^\[(.+)\]$/,sZe=t=>{if(Hbe.test(t)){const e=Hbe.exec(t)[1],n=e==null?void 0:e.substring(0,e.indexOf(":"));if(n)return"arbitrary.."+n}},aZe=t=>{const{theme:e,prefix:n}=t,s={nextPart:new Map,validators:[]};return oZe(Object.entries(t.classGroups),n).forEach(([o,l])=>{cue(l,s,o,e)}),s},cue=(t,e,n,s)=>{t.forEach(a=>{if(typeof a=="string"){const o=a===""?e:Wbe(e,a);o.classGroupId=n;return}if(typeof a=="function"){if(iZe(a)){cue(a(s),e,n,s);return}e.validators.push({validator:a,classGroupId:n});return}Object.entries(a).forEach(([o,l])=>{cue(l,Wbe(e,o),n,s)})})},Wbe=(t,e)=>{let n=t;return e.split($me).forEach(s=>{n.nextPart.has(s)||n.nextPart.set(s,{nextPart:new Map,validators:[]}),n=n.nextPart.get(s)}),n},iZe=t=>t.isThemeGetter,oZe=(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,lZe=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)}}},xAe="!",cZe=t=>{const{separator:e,experimentalParseClassName:n}=t,s=e.length===1,a=e[0],o=e.length,l=i=>{const h=[];let p=0,x=0,y;for(let A=0;Ax?y-x:void 0;return{modifiers:h,hasImportantModifier:j,baseClassName:C,maybePostfixModifierPosition:N}};return n?i=>n({className:i,parseClassName:l}):l},dZe=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},uZe=t=>({cache:lZe(t.cacheSize),parseClassName:cZe(t),...nZe(t)}),hZe=/\s+/,fZe=(t,e)=>{const{parseClassName:n,getClassGroupId:s,getConflictingClassGroupIds:a}=e,o=[],l=t.trim().split(hZe);let i="";for(let h=l.length-1;h>=0;h-=1){const p=l[h],{modifiers:x,hasImportantModifier:y,baseClassName:b,maybePostfixModifierPosition:j}=n(p);let C=!!j,N=s(C?b.substring(0,j):b);if(!N){if(!C){i=p+(i.length>0?" "+i:i);continue}if(N=s(b),!N){i=p+(i.length>0?" "+i:i);continue}C=!1}const A=dZe(x).join(":"),E=y?A+xAe:A,T=E+N;if(o.includes(T))continue;o.push(T);const L=a(N,C);for(let z=0;z0?" "+i:i)}return i};function pZe(){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=uZe(p),s=n.cache.get,a=n.cache.set,o=i,i(h)}function i(h){const p=s(h);if(p)return p;const x=fZe(h,n);return a(h,x),x}return function(){return o(pZe.apply(null,arguments))}}const al=t=>{const e=n=>n[t]||[];return e.isThemeGetter=!0,e},vAe=/^\[(?:([a-z-]+):)?(.+)\]$/i,gZe=/^\d+\/\d+$/,xZe=new Set(["px","full","screen"]),yZe=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,vZe=/\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$/,_Ze=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,bZe=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,wZe=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ux=t=>yS(t)||xZe.has(t)||gZe.test(t),s0=t=>ZC(t,"length",AZe),yS=t=>!!t&&!Number.isNaN(Number(t)),mle=t=>ZC(t,"number",yS),CM=t=>!!t&&Number.isInteger(Number(t)),jZe=t=>t.endsWith("%")&&yS(t.slice(0,-1)),ni=t=>vAe.test(t),a0=t=>yZe.test(t),kZe=new Set(["length","size","percentage"]),NZe=t=>ZC(t,kZe,_Ae),SZe=t=>ZC(t,"position",_Ae),CZe=new Set(["image","url"]),MZe=t=>ZC(t,CZe,IZe),TZe=t=>ZC(t,"",EZe),MM=()=>!0,ZC=(t,e,n)=>{const s=vAe.exec(t);return s?s[1]?typeof e=="string"?s[1]===e:e.has(s[1]):n(s[2]):!1},AZe=t=>vZe.test(t)&&!_Ze.test(t),_Ae=()=>!1,EZe=t=>bZe.test(t),IZe=t=>wZe.test(t),PZe=()=>{const t=al("colors"),e=al("spacing"),n=al("blur"),s=al("brightness"),a=al("borderColor"),o=al("borderRadius"),l=al("borderSpacing"),i=al("borderWidth"),h=al("contrast"),p=al("grayscale"),x=al("hueRotate"),y=al("invert"),b=al("gap"),j=al("gradientColorStops"),C=al("gradientColorStopPositions"),N=al("inset"),A=al("margin"),E=al("opacity"),T=al("padding"),L=al("saturate"),z=al("scale"),F=al("sepia"),q=al("skew"),H=al("space"),Z=al("translate"),G=()=>["auto","contain","none"],te=()=>["auto","hidden","clip","visible","scroll"],ie=()=>["auto",ni,e],le=()=>[ni,e],ye=()=>["",ux,s0],ne=()=>["auto",yS,ni],ge=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],ae=()=>["solid","dashed","dotted","double","none"],he=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ue=()=>["start","end","center","between","around","evenly","stretch"],_e=()=>["","0",ni],Ae=()=>["auto","avoid","all","avoid-page","page","left","right","column"],Ce=()=>[yS,ni];return{cacheSize:500,separator:":",theme:{colors:[MM],spacing:[ux,s0],blur:["none","",a0,ni],brightness:Ce(),borderColor:[t],borderRadius:["none","","full",a0,ni],borderSpacing:le(),borderWidth:ye(),contrast:Ce(),grayscale:_e(),hueRotate:Ce(),invert:_e(),gap:le(),gradientColorStops:[t],gradientColorStopPositions:[jZe,s0],inset:ie(),margin:ie(),opacity:Ce(),padding:le(),saturate:Ce(),scale:Ce(),sepia:_e(),skew:Ce(),space:le(),translate:le()},classGroups:{aspect:[{aspect:["auto","square","video",ni]}],container:["container"],columns:[{columns:[a0]}],"break-after":[{"break-after":Ae()}],"break-before":[{"break-before":Ae()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...ge(),ni]}],overflow:[{overflow:te()}],"overflow-x":[{"overflow-x":te()}],"overflow-y":[{"overflow-y":te()}],overscroll:[{overscroll:G()}],"overscroll-x":[{"overscroll-x":G()}],"overscroll-y":[{"overscroll-y":G()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[N]}],"inset-x":[{"inset-x":[N]}],"inset-y":[{"inset-y":[N]}],start:[{start:[N]}],end:[{end:[N]}],top:[{top:[N]}],right:[{right:[N]}],bottom:[{bottom:[N]}],left:[{left:[N]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",CM,ni]}],basis:[{basis:ie()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",ni]}],grow:[{grow:_e()}],shrink:[{shrink:_e()}],order:[{order:["first","last","none",CM,ni]}],"grid-cols":[{"grid-cols":[MM]}],"col-start-end":[{col:["auto",{span:["full",CM,ni]},ni]}],"col-start":[{"col-start":ne()}],"col-end":[{"col-end":ne()}],"grid-rows":[{"grid-rows":[MM]}],"row-start-end":[{row:["auto",{span:[CM,ni]},ni]}],"row-start":[{"row-start":ne()}],"row-end":[{"row-end":ne()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",ni]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",ni]}],gap:[{gap:[b]}],"gap-x":[{"gap-x":[b]}],"gap-y":[{"gap-y":[b]}],"justify-content":[{justify:["normal",...ue()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...ue(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...ue(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[T]}],px:[{px:[T]}],py:[{py:[T]}],ps:[{ps:[T]}],pe:[{pe:[T]}],pt:[{pt:[T]}],pr:[{pr:[T]}],pb:[{pb:[T]}],pl:[{pl:[T]}],m:[{m:[A]}],mx:[{mx:[A]}],my:[{my:[A]}],ms:[{ms:[A]}],me:[{me:[A]}],mt:[{mt:[A]}],mr:[{mr:[A]}],mb:[{mb:[A]}],ml:[{ml:[A]}],"space-x":[{"space-x":[H]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[H]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",ni,e]}],"min-w":[{"min-w":[ni,e,"min","max","fit"]}],"max-w":[{"max-w":[ni,e,"none","full","min","max","fit","prose",{screen:[a0]},a0]}],h:[{h:[ni,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[ni,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[ni,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[ni,e,"auto","min","max","fit"]}],"font-size":[{text:["base",a0,s0]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",mle]}],"font-family":[{font:[MM]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",ni]}],"line-clamp":[{"line-clamp":["none",yS,mle]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",ux,ni]}],"list-image":[{"list-image":["none",ni]}],"list-style-type":[{list:["none","disc","decimal",ni]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[t]}],"placeholder-opacity":[{"placeholder-opacity":[E]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[t]}],"text-opacity":[{"text-opacity":[E]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...ae(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",ux,s0]}],"underline-offset":[{"underline-offset":["auto",ux,ni]}],"text-decoration-color":[{decoration:[t]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:le()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ni]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",ni]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[E]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...ge(),SZe]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",NZe]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},MZe]}],"bg-color":[{bg:[t]}],"gradient-from-pos":[{from:[C]}],"gradient-via-pos":[{via:[C]}],"gradient-to-pos":[{to:[C]}],"gradient-from":[{from:[j]}],"gradient-via":[{via:[j]}],"gradient-to":[{to:[j]}],rounded:[{rounded:[o]}],"rounded-s":[{"rounded-s":[o]}],"rounded-e":[{"rounded-e":[o]}],"rounded-t":[{"rounded-t":[o]}],"rounded-r":[{"rounded-r":[o]}],"rounded-b":[{"rounded-b":[o]}],"rounded-l":[{"rounded-l":[o]}],"rounded-ss":[{"rounded-ss":[o]}],"rounded-se":[{"rounded-se":[o]}],"rounded-ee":[{"rounded-ee":[o]}],"rounded-es":[{"rounded-es":[o]}],"rounded-tl":[{"rounded-tl":[o]}],"rounded-tr":[{"rounded-tr":[o]}],"rounded-br":[{"rounded-br":[o]}],"rounded-bl":[{"rounded-bl":[o]}],"border-w":[{border:[i]}],"border-w-x":[{"border-x":[i]}],"border-w-y":[{"border-y":[i]}],"border-w-s":[{"border-s":[i]}],"border-w-e":[{"border-e":[i]}],"border-w-t":[{"border-t":[i]}],"border-w-r":[{"border-r":[i]}],"border-w-b":[{"border-b":[i]}],"border-w-l":[{"border-l":[i]}],"border-opacity":[{"border-opacity":[E]}],"border-style":[{border:[...ae(),"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:ae()}],"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:["",...ae()]}],"outline-offset":[{"outline-offset":[ux,ni]}],"outline-w":[{outline:[ux,s0]}],"outline-color":[{outline:[t]}],"ring-w":[{ring:ye()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[t]}],"ring-opacity":[{"ring-opacity":[E]}],"ring-offset-w":[{"ring-offset":[ux,s0]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",a0,TZe]}],"shadow-color":[{shadow:[MM]}],opacity:[{opacity:[E]}],"mix-blend":[{"mix-blend":[...he(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":he()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[s]}],contrast:[{contrast:[h]}],"drop-shadow":[{"drop-shadow":["","none",a0,ni]}],grayscale:[{grayscale:[p]}],"hue-rotate":[{"hue-rotate":[x]}],invert:[{invert:[y]}],saturate:[{saturate:[L]}],sepia:[{sepia:[F]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[s]}],"backdrop-contrast":[{"backdrop-contrast":[h]}],"backdrop-grayscale":[{"backdrop-grayscale":[p]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[x]}],"backdrop-invert":[{"backdrop-invert":[y]}],"backdrop-opacity":[{"backdrop-opacity":[E]}],"backdrop-saturate":[{"backdrop-saturate":[L]}],"backdrop-sepia":[{"backdrop-sepia":[F]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[l]}],"border-spacing-x":[{"border-spacing-x":[l]}],"border-spacing-y":[{"border-spacing-y":[l]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",ni]}],duration:[{duration:Ce()}],ease:[{ease:["linear","in","out","in-out",ni]}],delay:[{delay:Ce()}],animate:[{animate:["none","spin","ping","pulse","bounce",ni]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[z]}],"scale-x":[{"scale-x":[z]}],"scale-y":[{"scale-y":[z]}],rotate:[{rotate:[CM,ni]}],"translate-x":[{"translate-x":[Z]}],"translate-y":[{"translate-y":[Z]}],"skew-x":[{"skew-x":[q]}],"skew-y":[{"skew-y":[q]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",ni]}],accent:[{accent:["auto",t]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",ni]}],"caret-color":[{caret:[t]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":le()}],"scroll-mx":[{"scroll-mx":le()}],"scroll-my":[{"scroll-my":le()}],"scroll-ms":[{"scroll-ms":le()}],"scroll-me":[{"scroll-me":le()}],"scroll-mt":[{"scroll-mt":le()}],"scroll-mr":[{"scroll-mr":le()}],"scroll-mb":[{"scroll-mb":le()}],"scroll-ml":[{"scroll-ml":le()}],"scroll-p":[{"scroll-p":le()}],"scroll-px":[{"scroll-px":le()}],"scroll-py":[{"scroll-py":le()}],"scroll-ps":[{"scroll-ps":le()}],"scroll-pe":[{"scroll-pe":le()}],"scroll-pt":[{"scroll-pt":le()}],"scroll-pr":[{"scroll-pr":le()}],"scroll-pb":[{"scroll-pb":le()}],"scroll-pl":[{"scroll-pl":le()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",ni]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[ux,s0,mle]}],stroke:[{stroke:[t,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},LZe=mZe(PZe);function $t(...t){return LZe(si(t))}function Ed(t,e=!1){return e&&t>=1e6?`$${(t/1e6).toFixed(1)}M`:e&&t>=1e3?`$${(t/1e3).toFixed(0)}K`:new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:0,maximumFractionDigits:0}).format(t)}function Gbe(t){const e=new Date(t);return new Intl.DateTimeFormat("en-US",{month:"short",day:"numeric",year:"numeric"}).format(e)}function Sne(t){return t?t.replace(/<[^>]*>/g,""):""}const OZe=JKe,bAe=I.forwardRef(({className:t,...e},n)=>r.jsx(iAe,{ref:n,className:$t("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}));bAe.displayName=iAe.displayName;const DZe=KC("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"}}),wAe=I.forwardRef(({className:t,variant:e,...n},s)=>r.jsx(oAe,{ref:s,className:$t(DZe({variant:e}),t),...n}));wAe.displayName=oAe.displayName;const RZe=I.forwardRef(({className:t,...e},n)=>r.jsx(dAe,{ref:n,className:$t("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}));RZe.displayName=dAe.displayName;const jAe=I.forwardRef(({className:t,...e},n)=>r.jsx(uAe,{ref:n,className:$t("absolute right-2 top-2 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity group-hover:opacity-100 group-[.destructive]:text-red-300 hover:text-foreground group-[.destructive]:hover:text-red-50 focus:opacity-100 focus:outline-none focus:ring-2 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",t),"toast-close":"",...e,children:r.jsx(_s,{className:"h-4 w-4"})}));jAe.displayName=uAe.displayName;const kAe=I.forwardRef(({className:t,...e},n)=>r.jsx(lAe,{ref:n,className:$t("text-sm font-semibold",t),...e}));kAe.displayName=lAe.displayName;const NAe=I.forwardRef(({className:t,...e},n)=>r.jsx(cAe,{ref:n,className:$t("text-sm opacity-90",t),...e}));NAe.displayName=cAe.displayName;function FZe(){const{toasts:t}=fi();return r.jsxs(OZe,{children:[t.map(function({id:e,title:n,description:s,action:a,...o}){return r.jsxs(wAe,{...o,children:[r.jsxs("div",{className:"grid gap-1",children:[n&&r.jsx(kAe,{children:n}),s&&r.jsx(NAe,{children:s})]}),a,r.jsx(jAe,{})]},e)}),r.jsx(bAe,{})]})}var Kbe=["light","dark"],zZe="(prefers-color-scheme: dark)",BZe=I.createContext(void 0),$Ze={setTheme:t=>{},themes:[]},UZe=()=>{var t;return(t=I.useContext(BZe))!=null?t:$Ze};I.memo(({forcedTheme:t,storageKey:e,attribute:n,enableSystem:s,enableColorScheme:a,defaultTheme:o,value:l,attrs:i,nonce:h})=>{let p=o==="system",x=n==="class"?`var d=document.documentElement,c=d.classList;${`c.remove(${i.map(C=>`'${C}'`).join(",")})`};`:`var d=document.documentElement,n='${n}',s='setAttribute';`,y=a?Kbe.includes(o)&&o?`if(e==='light'||e==='dark'||!e)d.style.colorScheme=e||'${o}'`:"if(e==='light'||e==='dark')d.style.colorScheme=e":"",b=(C,N=!1,A=!0)=>{let E=l?l[C]:C,T=N?C+"|| ''":`'${E}'`,L="";return a&&A&&!N&&Kbe.includes(C)&&(L+=`d.style.colorScheme = '${C}';`),n==="class"?N||E?L+=`c.add(${T})`:L+="null":E&&(L+=`d[s](n,${T})`),L},j=t?`!function(){${x}${b(t)}}()`:s?`!function(){try{${x}var e=localStorage.getItem('${e}');if('system'===e||(!e&&${p})){var t='${zZe}',m=window.matchMedia(t);if(m.media!==t||m.matches){${b("dark")}}else{${b("light")}}}else if(e){${l?`var x=${JSON.stringify(l)};`:""}${b(l?"x[e]":"e",!0)}}${p?"":"else{"+b(o,!1,!1)+"}"}${y}}catch(e){}}()`:`!function(){try{${x}var e=localStorage.getItem('${e}');if(e){${l?`var x=${JSON.stringify(l)};`:""}${b(l?"x[e]":"e",!0)}}else{${b(o,!1,!1)};}${y}}catch(t){}}();`;return I.createElement("script",{nonce:h,dangerouslySetInnerHTML:{__html:j}})});var qZe=t=>{switch(t){case"success":return WZe;case"info":return KZe;case"warning":return GZe;case"error":return ZZe;default:return null}},VZe=Array(12).fill(0),HZe=({visible:t,className:e})=>st.createElement("div",{className:["sonner-loading-wrapper",e].filter(Boolean).join(" "),"data-visible":t},st.createElement("div",{className:"sonner-spinner"},VZe.map((n,s)=>st.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${s}`})))),WZe=st.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},st.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),GZe=st.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},st.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),KZe=st.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},st.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),ZZe=st.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},st.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),YZe=st.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},st.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),st.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),XZe=()=>{let[t,e]=st.useState(document.hidden);return st.useEffect(()=>{let n=()=>{e(document.hidden)};return document.addEventListener("visibilitychange",n),()=>window.removeEventListener("visibilitychange",n)},[]),t},due=1,QZe=class{constructor(){this.subscribe=t=>(this.subscribers.push(t),()=>{let e=this.subscribers.indexOf(t);this.subscribers.splice(e,1)}),this.publish=t=>{this.subscribers.forEach(e=>e(t))},this.addToast=t=>{this.publish(t),this.toasts=[...this.toasts,t]},this.create=t=>{var e;let{message:n,...s}=t,a=typeof(t==null?void 0:t.id)=="number"||((e=t.id)==null?void 0:e.length)>0?t.id:due++,o=this.toasts.find(i=>i.id===a),l=t.dismissible===void 0?!0:t.dismissible;return this.dismissedToasts.has(a)&&this.dismissedToasts.delete(a),o?this.toasts=this.toasts.map(i=>i.id===a?(this.publish({...i,...t,id:a,title:n}),{...i,...t,id:a,dismissible:l,title:n}):i):this.addToast({title:n,...s,dismissible:l,id:a}),a},this.dismiss=t=>(this.dismissedToasts.add(t),t||this.toasts.forEach(e=>{this.subscribers.forEach(n=>n({id:e.id,dismiss:!0}))}),this.subscribers.forEach(e=>e({id:t,dismiss:!0})),t),this.message=(t,e)=>this.create({...e,message:t}),this.error=(t,e)=>this.create({...e,message:t,type:"error"}),this.success=(t,e)=>this.create({...e,type:"success",message:t}),this.info=(t,e)=>this.create({...e,type:"info",message:t}),this.warning=(t,e)=>this.create({...e,type:"warning",message:t}),this.loading=(t,e)=>this.create({...e,type:"loading",message:t}),this.promise=(t,e)=>{if(!e)return;let n;e.loading!==void 0&&(n=this.create({...e,promise:t,type:"loading",message:e.loading,description:typeof e.description!="function"?e.description:void 0}));let s=t instanceof Promise?t:t(),a=n!==void 0,o,l=s.then(async h=>{if(o=["resolve",h],st.isValidElement(h))a=!1,this.create({id:n,type:"default",message:h});else if(eYe(h)&&!h.ok){a=!1;let p=typeof e.error=="function"?await e.error(`HTTP error! status: ${h.status}`):e.error,x=typeof e.description=="function"?await e.description(`HTTP error! status: ${h.status}`):e.description;this.create({id:n,type:"error",message:p,description:x})}else if(e.success!==void 0){a=!1;let p=typeof e.success=="function"?await e.success(h):e.success,x=typeof e.description=="function"?await e.description(h):e.description;this.create({id:n,type:"success",message:p,description:x})}}).catch(async h=>{if(o=["reject",h],e.error!==void 0){a=!1;let p=typeof e.error=="function"?await e.error(h):e.error,x=typeof e.description=="function"?await e.description(h):e.description;this.create({id:n,type:"error",message:p,description:x})}}).finally(()=>{var h;a&&(this.dismiss(n),n=void 0),(h=e.finally)==null||h.call(e)}),i=()=>new Promise((h,p)=>l.then(()=>o[0]==="reject"?p(o[1]):h(o[1])).catch(p));return typeof n!="string"&&typeof n!="number"?{unwrap:i}:Object.assign(n,{unwrap:i})},this.custom=(t,e)=>{let n=(e==null?void 0:e.id)||due++;return this.create({jsx:t(n),id:n,...e}),n},this.getActiveToasts=()=>this.toasts.filter(t=>!this.dismissedToasts.has(t.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}},lh=new QZe,JZe=(t,e)=>{let n=(e==null?void 0:e.id)||due++;return lh.addToast({title:t,...e,id:n}),n},eYe=t=>t&&typeof t=="object"&&"ok"in t&&typeof t.ok=="boolean"&&"status"in t&&typeof t.status=="number",tYe=JZe,rYe=()=>lh.toasts,nYe=()=>lh.getActiveToasts(),ze=Object.assign(tYe,{success:lh.success,info:lh.info,warning:lh.warning,error:lh.error,custom:lh.custom,message:lh.message,promise:lh.promise,dismiss:lh.dismiss,loading:lh.loading},{getHistory:rYe,getToasts:nYe});function sYe(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))}sYe(`: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 sL(t){return t.label!==void 0}var aYe=3,iYe="32px",oYe="16px",Zbe=4e3,lYe=356,cYe=14,dYe=20,uYe=200;function zp(...t){return t.filter(Boolean).join(" ")}function hYe(t){let[e,n]=t.split("-"),s=[];return e&&s.push(e),n&&s.push(n),s}var fYe=t=>{var e,n,s,a,o,l,i,h,p,x,y;let{invert:b,toast:j,unstyled:C,interacting:N,setHeights:A,visibleToasts:E,heights:T,index:L,toasts:z,expanded:F,removeToast:q,defaultRichColors:H,closeButton:Z,style:G,cancelButtonStyle:te,actionButtonStyle:ie,className:le="",descriptionClassName:ye="",duration:ne,position:ge,gap:ae,loadingIcon:he,expandByDefault:ue,classNames:_e,icons:Ae,closeButtonAriaLabel:Ce="Close toast",pauseWhenPageIsHidden:be}=t,[me,Le]=st.useState(null),[Ne,Be]=st.useState(null),[Ee,Ue]=st.useState(!1),[Re,je]=st.useState(!1),[et,Te]=st.useState(!1),[Ze,pe]=st.useState(!1),[yt,rt]=st.useState(!1),[at,Me]=st.useState(0),[ft,qe]=st.useState(0),Oe=st.useRef(j.duration||ne||Zbe),Qe=st.useRef(null),nt=st.useRef(null),gt=L===0,mt=L+1<=E,Mt=j.type,wt=j.dismissible!==!1,Qt=j.className||"",Cr=j.descriptionClassName||"",cn=st.useMemo(()=>T.findIndex(Ns=>Ns.toastId===j.id)||0,[T,j.id]),jn=st.useMemo(()=>{var Ns;return(Ns=j.closeButton)!=null?Ns:Z},[j.closeButton,Z]),Xr=st.useMemo(()=>j.duration||ne||Zbe,[j.duration,ne]),Pn=st.useRef(0),js=st.useRef(0),hr=st.useRef(0),xs=st.useRef(null),[ka,xa]=ge.split("-"),zi=st.useMemo(()=>T.reduce((Ns,Fa,Oa)=>Oa>=cn?Ns:Ns+Fa.height,0),[T,cn]),Bi=XZe(),tl=j.invert||b,xo=Mt==="loading";js.current=st.useMemo(()=>cn*ae+zi,[cn,zi]),st.useEffect(()=>{Oe.current=Xr},[Xr]),st.useEffect(()=>{Ue(!0)},[]),st.useEffect(()=>{let Ns=nt.current;if(Ns){let Fa=Ns.getBoundingClientRect().height;return qe(Fa),A(Oa=>[{toastId:j.id,height:Fa,position:j.position},...Oa]),()=>A(Oa=>Oa.filter(Do=>Do.toastId!==j.id))}},[A,j.id]),st.useLayoutEffect(()=>{if(!Ee)return;let Ns=nt.current,Fa=Ns.style.height;Ns.style.height="auto";let Oa=Ns.getBoundingClientRect().height;Ns.style.height=Fa,qe(Oa),A(Do=>Do.find(ir=>ir.toastId===j.id)?Do.map(ir=>ir.toastId===j.id?{...ir,height:Oa}:ir):[{toastId:j.id,height:Oa,position:j.position},...Do])},[Ee,j.title,j.description,A,j.id]);let Hs=st.useCallback(()=>{je(!0),Me(js.current),A(Ns=>Ns.filter(Fa=>Fa.toastId!==j.id)),setTimeout(()=>{q(j)},uYe)},[j,q,A,js]);st.useEffect(()=>{if(j.promise&&Mt==="loading"||j.duration===1/0||j.type==="loading")return;let Ns;return F||N||be&&Bi?(()=>{if(hr.current{var Fa;(Fa=j.onAutoClose)==null||Fa.call(j,j),Hs()},Oe.current)),()=>clearTimeout(Ns)},[F,N,j,Mt,be,Bi,Hs]),st.useEffect(()=>{j.delete&&Hs()},[Hs,j.delete]);function Xa(){var Ns,Fa,Oa;return Ae!=null&&Ae.loading?st.createElement("div",{className:zp(_e==null?void 0:_e.loader,(Ns=j==null?void 0:j.classNames)==null?void 0:Ns.loader,"sonner-loader"),"data-visible":Mt==="loading"},Ae.loading):he?st.createElement("div",{className:zp(_e==null?void 0:_e.loader,(Fa=j==null?void 0:j.classNames)==null?void 0:Fa.loader,"sonner-loader"),"data-visible":Mt==="loading"},he):st.createElement(HZe,{className:zp(_e==null?void 0:_e.loader,(Oa=j==null?void 0:j.classNames)==null?void 0:Oa.loader),visible:Mt==="loading"})}return st.createElement("li",{tabIndex:0,ref:nt,className:zp(le,Qt,_e==null?void 0:_e.toast,(e=j==null?void 0:j.classNames)==null?void 0:e.toast,_e==null?void 0:_e.default,_e==null?void 0:_e[Mt],(n=j==null?void 0:j.classNames)==null?void 0:n[Mt]),"data-sonner-toast":"","data-rich-colors":(s=j.richColors)!=null?s:H,"data-styled":!(j.jsx||j.unstyled||C),"data-mounted":Ee,"data-promise":!!j.promise,"data-swiped":yt,"data-removed":Re,"data-visible":mt,"data-y-position":ka,"data-x-position":xa,"data-index":L,"data-front":gt,"data-swiping":et,"data-dismissible":wt,"data-type":Mt,"data-invert":tl,"data-swipe-out":Ze,"data-swipe-direction":Ne,"data-expanded":!!(F||ue&&Ee),style:{"--index":L,"--toasts-before":L,"--z-index":z.length-L,"--offset":`${Re?at:js.current}px`,"--initial-height":ue?"auto":`${ft}px`,...G,...j.style},onDragEnd:()=>{Te(!1),Le(null),xs.current=null},onPointerDown:Ns=>{xo||!wt||(Qe.current=new Date,Me(js.current),Ns.target.setPointerCapture(Ns.pointerId),Ns.target.tagName!=="BUTTON"&&(Te(!0),xs.current={x:Ns.clientX,y:Ns.clientY}))},onPointerUp:()=>{var Ns,Fa,Oa,Do;if(Ze||!wt)return;xs.current=null;let ir=Number(((Ns=nt.current)==null?void 0:Ns.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),fo=Number(((Fa=nt.current)==null?void 0:Fa.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),pl=new Date().getTime()-((Oa=Qe.current)==null?void 0:Oa.getTime()),To=me==="x"?ir:fo,ss=Math.abs(To)/pl;if(Math.abs(To)>=dYe||ss>.11){Me(js.current),(Do=j.onDismiss)==null||Do.call(j,j),Be(me==="x"?ir>0?"right":"left":fo>0?"down":"up"),Hs(),pe(!0),rt(!1);return}Te(!1),Le(null)},onPointerMove:Ns=>{var Fa,Oa,Do,ir;if(!xs.current||!wt||((Fa=window.getSelection())==null?void 0:Fa.toString().length)>0)return;let fo=Ns.clientY-xs.current.y,pl=Ns.clientX-xs.current.x,To=(Oa=t.swipeDirections)!=null?Oa:hYe(ge);!me&&(Math.abs(pl)>1||Math.abs(fo)>1)&&Le(Math.abs(pl)>Math.abs(fo)?"x":"y");let ss={x:0,y:0};me==="y"?(To.includes("top")||To.includes("bottom"))&&(To.includes("top")&&fo<0||To.includes("bottom")&&fo>0)&&(ss.y=fo):me==="x"&&(To.includes("left")||To.includes("right"))&&(To.includes("left")&&pl<0||To.includes("right")&&pl>0)&&(ss.x=pl),(Math.abs(ss.x)>0||Math.abs(ss.y)>0)&&rt(!0),(Do=nt.current)==null||Do.style.setProperty("--swipe-amount-x",`${ss.x}px`),(ir=nt.current)==null||ir.style.setProperty("--swipe-amount-y",`${ss.y}px`)}},jn&&!j.jsx?st.createElement("button",{"aria-label":Ce,"data-disabled":xo,"data-close-button":!0,onClick:xo||!wt?()=>{}:()=>{var Ns;Hs(),(Ns=j.onDismiss)==null||Ns.call(j,j)},className:zp(_e==null?void 0:_e.closeButton,(a=j==null?void 0:j.classNames)==null?void 0:a.closeButton)},(o=Ae==null?void 0:Ae.close)!=null?o:YZe):null,j.jsx||I.isValidElement(j.title)?j.jsx?j.jsx:typeof j.title=="function"?j.title():j.title:st.createElement(st.Fragment,null,Mt||j.icon||j.promise?st.createElement("div",{"data-icon":"",className:zp(_e==null?void 0:_e.icon,(l=j==null?void 0:j.classNames)==null?void 0:l.icon)},j.promise||j.type==="loading"&&!j.icon?j.icon||Xa():null,j.type!=="loading"?j.icon||(Ae==null?void 0:Ae[Mt])||qZe(Mt):null):null,st.createElement("div",{"data-content":"",className:zp(_e==null?void 0:_e.content,(i=j==null?void 0:j.classNames)==null?void 0:i.content)},st.createElement("div",{"data-title":"",className:zp(_e==null?void 0:_e.title,(h=j==null?void 0:j.classNames)==null?void 0:h.title)},typeof j.title=="function"?j.title():j.title),j.description?st.createElement("div",{"data-description":"",className:zp(ye,Cr,_e==null?void 0:_e.description,(p=j==null?void 0:j.classNames)==null?void 0:p.description)},typeof j.description=="function"?j.description():j.description):null),I.isValidElement(j.cancel)?j.cancel:j.cancel&&sL(j.cancel)?st.createElement("button",{"data-button":!0,"data-cancel":!0,style:j.cancelButtonStyle||te,onClick:Ns=>{var Fa,Oa;sL(j.cancel)&&wt&&((Oa=(Fa=j.cancel).onClick)==null||Oa.call(Fa,Ns),Hs())},className:zp(_e==null?void 0:_e.cancelButton,(x=j==null?void 0:j.classNames)==null?void 0:x.cancelButton)},j.cancel.label):null,I.isValidElement(j.action)?j.action:j.action&&sL(j.action)?st.createElement("button",{"data-button":!0,"data-action":!0,style:j.actionButtonStyle||ie,onClick:Ns=>{var Fa,Oa;sL(j.action)&&((Oa=(Fa=j.action).onClick)==null||Oa.call(Fa,Ns),!Ns.defaultPrevented&&Hs())},className:zp(_e==null?void 0:_e.actionButton,(y=j==null?void 0:j.classNames)==null?void 0:y.actionButton)},j.action.label):null))};function Ybe(){if(typeof window>"u"||typeof document>"u")return"ltr";let t=document.documentElement.getAttribute("dir");return t==="auto"||!t?window.getComputedStyle(document.documentElement).direction:t}function pYe(t,e){let n={};return[t,e].forEach((s,a)=>{let o=a===1,l=o?"--mobile-offset":"--offset",i=o?oYe:iYe;function h(p){["top","right","bottom","left"].forEach(x=>{n[`${l}-${x}`]=typeof p=="number"?`${p}px`:p})}typeof s=="number"||typeof s=="string"?h(s):typeof s=="object"?["top","right","bottom","left"].forEach(p=>{s[p]===void 0?n[`${l}-${p}`]=i:n[`${l}-${p}`]=typeof s[p]=="number"?`${s[p]}px`:s[p]}):h(i)}),n}var mYe=I.forwardRef(function(t,e){let{invert:n,position:s="bottom-right",hotkey:a=["altKey","KeyT"],expand:o,closeButton:l,className:i,offset:h,mobileOffset:p,theme:x="light",richColors:y,duration:b,style:j,visibleToasts:C=aYe,toastOptions:N,dir:A=Ybe(),gap:E=cYe,loadingIcon:T,icons:L,containerAriaLabel:z="Notifications",pauseWhenPageIsHidden:F}=t,[q,H]=st.useState([]),Z=st.useMemo(()=>Array.from(new Set([s].concat(q.filter(be=>be.position).map(be=>be.position)))),[q,s]),[G,te]=st.useState([]),[ie,le]=st.useState(!1),[ye,ne]=st.useState(!1),[ge,ae]=st.useState(x!=="system"?x:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),he=st.useRef(null),ue=a.join("+").replace(/Key/g,"").replace(/Digit/g,""),_e=st.useRef(null),Ae=st.useRef(!1),Ce=st.useCallback(be=>{H(me=>{var Le;return(Le=me.find(Ne=>Ne.id===be.id))!=null&&Le.delete||lh.dismiss(be.id),me.filter(({id:Ne})=>Ne!==be.id)})},[]);return st.useEffect(()=>lh.subscribe(be=>{if(be.dismiss){H(me=>me.map(Le=>Le.id===be.id?{...Le,delete:!0}:Le));return}setTimeout(()=>{Ome.flushSync(()=>{H(me=>{let Le=me.findIndex(Ne=>Ne.id===be.id);return Le!==-1?[...me.slice(0,Le),{...me[Le],...be},...me.slice(Le+1)]:[be,...me]})})})}),[]),st.useEffect(()=>{if(x!=="system"){ae(x);return}if(x==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?ae("dark"):ae("light")),typeof window>"u")return;let be=window.matchMedia("(prefers-color-scheme: dark)");try{be.addEventListener("change",({matches:me})=>{ae(me?"dark":"light")})}catch{be.addListener(({matches:Le})=>{try{ae(Le?"dark":"light")}catch(Ne){console.error(Ne)}})}},[x]),st.useEffect(()=>{q.length<=1&&le(!1)},[q]),st.useEffect(()=>{let be=me=>{var Le,Ne;a.every(Be=>me[Be]||me.code===Be)&&(le(!0),(Le=he.current)==null||Le.focus()),me.code==="Escape"&&(document.activeElement===he.current||(Ne=he.current)!=null&&Ne.contains(document.activeElement))&&le(!1)};return document.addEventListener("keydown",be),()=>document.removeEventListener("keydown",be)},[a]),st.useEffect(()=>{if(he.current)return()=>{_e.current&&(_e.current.focus({preventScroll:!0}),_e.current=null,Ae.current=!1)}},[he.current]),st.createElement("section",{ref:e,"aria-label":`${z} ${ue}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},Z.map((be,me)=>{var Le;let[Ne,Be]=be.split("-");return q.length?st.createElement("ol",{key:be,dir:A==="auto"?Ybe():A,tabIndex:-1,ref:he,className:i,"data-sonner-toaster":!0,"data-theme":ge,"data-y-position":Ne,"data-lifted":ie&&q.length>1&&!o,"data-x-position":Be,style:{"--front-toast-height":`${((Le=G[0])==null?void 0:Le.height)||0}px`,"--width":`${lYe}px`,"--gap":`${E}px`,...j,...pYe(h,p)},onBlur:Ee=>{Ae.current&&!Ee.currentTarget.contains(Ee.relatedTarget)&&(Ae.current=!1,_e.current&&(_e.current.focus({preventScroll:!0}),_e.current=null))},onFocus:Ee=>{Ee.target instanceof HTMLElement&&Ee.target.dataset.dismissible==="false"||Ae.current||(Ae.current=!0,_e.current=Ee.relatedTarget)},onMouseEnter:()=>le(!0),onMouseMove:()=>le(!0),onMouseLeave:()=>{ye||le(!1)},onDragEnd:()=>le(!1),onPointerDown:Ee=>{Ee.target instanceof HTMLElement&&Ee.target.dataset.dismissible==="false"||ne(!0)},onPointerUp:()=>ne(!1)},q.filter(Ee=>!Ee.position&&me===0||Ee.position===be).map((Ee,Ue)=>{var Re,je;return st.createElement(fYe,{key:Ee.id,icons:L,index:Ue,toast:Ee,defaultRichColors:y,duration:(Re=N==null?void 0:N.duration)!=null?Re:b,className:N==null?void 0:N.className,descriptionClassName:N==null?void 0:N.descriptionClassName,invert:n,visibleToasts:C,closeButton:(je=N==null?void 0:N.closeButton)!=null?je:l,interacting:ye,position:be,style:N==null?void 0:N.style,unstyled:N==null?void 0:N.unstyled,classNames:N==null?void 0:N.classNames,cancelButtonStyle:N==null?void 0:N.cancelButtonStyle,actionButtonStyle:N==null?void 0:N.actionButtonStyle,removeToast:Ce,toasts:q.filter(et=>et.position==Ee.position),heights:G.filter(et=>et.position==Ee.position),setHeights:te,expandByDefault:o,gap:E,loadingIcon:T,expanded:ie,pauseWhenPageIsHidden:F,swipeDirections:t.swipeDirections})})):null}))});const gYe=({...t})=>{const{theme:e="system"}=UZe();return r.jsx(mYe,{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 xYe=Vpe[" useId ".trim().toString()]||(()=>{}),yYe=0;function Gc(t){const[e,n]=I.useState(xYe());return Jl(()=>{n(s=>s??String(yYe++))},[t]),e?`radix-${e}`:""}const vYe=["top","right","bottom","left"],R1=Math.min,Hh=Math.max,zee=Math.round,aL=Math.floor,Ng=t=>({x:t,y:t}),_Ye={left:"right",right:"left",bottom:"top",top:"bottom"},bYe={start:"end",end:"start"};function uue(t,e,n){return Hh(t,R1(e,n))}function ny(t,e){return typeof t=="function"?t(e):t}function sy(t){return t.split("-")[0]}function YC(t){return t.split("-")[1]}function Ume(t){return t==="x"?"y":"x"}function qme(t){return t==="y"?"height":"width"}const wYe=new Set(["top","bottom"]);function lg(t){return wYe.has(sy(t))?"y":"x"}function Vme(t){return Ume(lg(t))}function jYe(t,e,n){n===void 0&&(n=!1);const s=YC(t),a=Vme(t),o=qme(a);let l=a==="x"?s===(n?"end":"start")?"right":"left":s==="start"?"bottom":"top";return e.reference[o]>e.floating[o]&&(l=Bee(l)),[l,Bee(l)]}function kYe(t){const e=Bee(t);return[hue(t),e,hue(e)]}function hue(t){return t.replace(/start|end/g,e=>bYe[e])}const Xbe=["left","right"],Qbe=["right","left"],NYe=["top","bottom"],SYe=["bottom","top"];function CYe(t,e,n){switch(t){case"top":case"bottom":return n?e?Qbe:Xbe:e?Xbe:Qbe;case"left":case"right":return e?NYe:SYe;default:return[]}}function MYe(t,e,n,s){const a=YC(t);let o=CYe(sy(t),n==="start",s);return a&&(o=o.map(l=>l+"-"+a),e&&(o=o.concat(o.map(hue)))),o}function Bee(t){return t.replace(/left|right|bottom|top/g,e=>_Ye[e])}function TYe(t){return{top:0,right:0,bottom:0,left:0,...t}}function SAe(t){return typeof t!="number"?TYe(t):{top:t,right:t,bottom:t,left:t}}function $ee(t){const{x:e,y:n,width:s,height:a}=t;return{width:s,height:a,top:n,left:e,right:e+s,bottom:n+a,x:e,y:n}}function Jbe(t,e,n){let{reference:s,floating:a}=t;const o=lg(e),l=Vme(e),i=qme(l),h=sy(e),p=o==="y",x=s.x+s.width/2-a.width/2,y=s.y+s.height/2-a.height/2,b=s[i]/2-a[i]/2;let j;switch(h){case"top":j={x,y:s.y-a.height};break;case"bottom":j={x,y:s.y+s.height};break;case"right":j={x:s.x+s.width,y};break;case"left":j={x:s.x-a.width,y};break;default:j={x:s.x,y:s.y}}switch(YC(e)){case"start":j[l]-=b*(n&&p?-1:1);break;case"end":j[l]+=b*(n&&p?-1:1);break}return j}const AYe=async(t,e,n)=>{const{placement:s="bottom",strategy:a="absolute",middleware:o=[],platform:l}=n,i=o.filter(Boolean),h=await(l.isRTL==null?void 0:l.isRTL(e));let p=await l.getElementRects({reference:t,floating:e,strategy:a}),{x,y}=Jbe(p,s,h),b=s,j={},C=0;for(let N=0;N({name:"arrow",options:t,async fn(e){const{x:n,y:s,placement:a,rects:o,platform:l,elements:i,middlewareData:h}=e,{element:p,padding:x=0}=ny(t,e)||{};if(p==null)return{};const y=SAe(x),b={x:n,y:s},j=Vme(a),C=qme(j),N=await l.getDimensions(p),A=j==="y",E=A?"top":"left",T=A?"bottom":"right",L=A?"clientHeight":"clientWidth",z=o.reference[C]+o.reference[j]-b[j]-o.floating[C],F=b[j]-o.reference[j],q=await(l.getOffsetParent==null?void 0:l.getOffsetParent(p));let H=q?q[L]:0;(!H||!await(l.isElement==null?void 0:l.isElement(q)))&&(H=i.floating[L]||o.floating[C]);const Z=z/2-F/2,G=H/2-N[C]/2-1,te=R1(y[E],G),ie=R1(y[T],G),le=te,ye=H-N[C]-ie,ne=H/2-N[C]/2+Z,ge=uue(le,ne,ye),ae=!h.arrow&&YC(a)!=null&&ne!==ge&&o.reference[C]/2-(nene<=0)){var ie,le;const ne=(((ie=o.flip)==null?void 0:ie.index)||0)+1,ge=H[ne];if(ge&&(!(y==="alignment"?T!==lg(ge):!1)||te.every(ue=>ue.overflows[0]>0&&lg(ue.placement)===T)))return{data:{index:ne,overflows:te},reset:{placement:ge}};let ae=(le=te.filter(he=>he.overflows[0]<=0).sort((he,ue)=>he.overflows[1]-ue.overflows[1])[0])==null?void 0:le.placement;if(!ae)switch(j){case"bestFit":{var ye;const he=(ye=te.filter(ue=>{if(q){const _e=lg(ue.placement);return _e===T||_e==="y"}return!0}).map(ue=>[ue.placement,ue.overflows.filter(_e=>_e>0).reduce((_e,Ae)=>_e+Ae,0)]).sort((ue,_e)=>ue[1]-_e[1])[0])==null?void 0:ye[0];he&&(ae=he);break}case"initialPlacement":ae=i;break}if(a!==ae)return{reset:{placement:ae}}}return{}}}};function ewe(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function twe(t){return vYe.some(e=>t[e]>=0)}const PYe=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n}=e,{strategy:s="referenceHidden",...a}=ny(t,e);switch(s){case"referenceHidden":{const o=await qA(e,{...a,elementContext:"reference"}),l=ewe(o,n.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:twe(l)}}}case"escaped":{const o=await qA(e,{...a,altBoundary:!0}),l=ewe(o,n.floating);return{data:{escapedOffsets:l,escaped:twe(l)}}}default:return{}}}}},CAe=new Set(["left","top"]);async function LYe(t,e){const{placement:n,platform:s,elements:a}=t,o=await(s.isRTL==null?void 0:s.isRTL(a.floating)),l=sy(n),i=YC(n),h=lg(n)==="y",p=CAe.has(l)?-1:1,x=o&&h?-1:1,y=ny(e,t);let{mainAxis:b,crossAxis:j,alignmentAxis:C}=typeof y=="number"?{mainAxis:y,crossAxis:0,alignmentAxis:null}:{mainAxis:y.mainAxis||0,crossAxis:y.crossAxis||0,alignmentAxis:y.alignmentAxis};return i&&typeof C=="number"&&(j=i==="end"?C*-1:C),h?{x:j*x,y:b*p}:{x:b*p,y:j*x}}const OYe=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,s;const{x:a,y:o,placement:l,middlewareData:i}=e,h=await LYe(e,t);return l===((n=i.offset)==null?void 0:n.placement)&&(s=i.arrow)!=null&&s.alignmentOffset?{}:{x:a+h.x,y:o+h.y,data:{...h,placement:l}}}}},DYe=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:s,placement:a}=e,{mainAxis:o=!0,crossAxis:l=!1,limiter:i={fn:A=>{let{x:E,y:T}=A;return{x:E,y:T}}},...h}=ny(t,e),p={x:n,y:s},x=await qA(e,h),y=lg(sy(a)),b=Ume(y);let j=p[b],C=p[y];if(o){const A=b==="y"?"top":"left",E=b==="y"?"bottom":"right",T=j+x[A],L=j-x[E];j=uue(T,j,L)}if(l){const A=y==="y"?"top":"left",E=y==="y"?"bottom":"right",T=C+x[A],L=C-x[E];C=uue(T,C,L)}const N=i.fn({...e,[b]:j,[y]:C});return{...N,data:{x:N.x-n,y:N.y-s,enabled:{[b]:o,[y]:l}}}}}},RYe=function(t){return t===void 0&&(t={}),{options:t,fn(e){const{x:n,y:s,placement:a,rects:o,middlewareData:l}=e,{offset:i=0,mainAxis:h=!0,crossAxis:p=!0}=ny(t,e),x={x:n,y:s},y=lg(a),b=Ume(y);let j=x[b],C=x[y];const N=ny(i,e),A=typeof N=="number"?{mainAxis:N,crossAxis:0}:{mainAxis:0,crossAxis:0,...N};if(h){const L=b==="y"?"height":"width",z=o.reference[b]-o.floating[L]+A.mainAxis,F=o.reference[b]+o.reference[L]-A.mainAxis;jF&&(j=F)}if(p){var E,T;const L=b==="y"?"width":"height",z=CAe.has(sy(a)),F=o.reference[y]-o.floating[L]+(z&&((E=l.offset)==null?void 0:E[y])||0)+(z?0:A.crossAxis),q=o.reference[y]+o.reference[L]+(z?0:((T=l.offset)==null?void 0:T[y])||0)-(z?A.crossAxis:0);Cq&&(C=q)}return{[b]:j,[y]:C}}}},FYe=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var n,s;const{placement:a,rects:o,platform:l,elements:i}=e,{apply:h=()=>{},...p}=ny(t,e),x=await qA(e,p),y=sy(a),b=YC(a),j=lg(a)==="y",{width:C,height:N}=o.floating;let A,E;y==="top"||y==="bottom"?(A=y,E=b===(await(l.isRTL==null?void 0:l.isRTL(i.floating))?"start":"end")?"left":"right"):(E=y,A=b==="end"?"top":"bottom");const T=N-x.top-x.bottom,L=C-x.left-x.right,z=R1(N-x[A],T),F=R1(C-x[E],L),q=!e.middlewareData.shift;let H=z,Z=F;if((n=e.middlewareData.shift)!=null&&n.enabled.x&&(Z=L),(s=e.middlewareData.shift)!=null&&s.enabled.y&&(H=T),q&&!b){const te=Hh(x.left,0),ie=Hh(x.right,0),le=Hh(x.top,0),ye=Hh(x.bottom,0);j?Z=C-2*(te!==0||ie!==0?te+ie:Hh(x.left,x.right)):H=N-2*(le!==0||ye!==0?le+ye:Hh(x.top,x.bottom))}await h({...e,availableWidth:Z,availableHeight:H});const G=await l.getDimensions(i.floating);return C!==G.width||N!==G.height?{reset:{rects:!0}}:{}}}};function Cne(){return typeof window<"u"}function XC(t){return MAe(t)?(t.nodeName||"").toLowerCase():"#document"}function sf(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function Rg(t){var e;return(e=(MAe(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function MAe(t){return Cne()?t instanceof Node||t instanceof sf(t).Node:!1}function _m(t){return Cne()?t instanceof Element||t instanceof sf(t).Element:!1}function Eg(t){return Cne()?t instanceof HTMLElement||t instanceof sf(t).HTMLElement:!1}function rwe(t){return!Cne()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof sf(t).ShadowRoot}const zYe=new Set(["inline","contents"]);function dI(t){const{overflow:e,overflowX:n,overflowY:s,display:a}=bm(t);return/auto|scroll|overlay|hidden|clip/.test(e+s+n)&&!zYe.has(a)}const BYe=new Set(["table","td","th"]);function $Ye(t){return BYe.has(XC(t))}const UYe=[":popover-open",":modal"];function Mne(t){return UYe.some(e=>{try{return t.matches(e)}catch{return!1}})}const qYe=["transform","translate","scale","rotate","perspective"],VYe=["transform","translate","scale","rotate","perspective","filter"],HYe=["paint","layout","strict","content"];function Hme(t){const e=Wme(),n=_m(t)?bm(t):t;return qYe.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)||VYe.some(s=>(n.willChange||"").includes(s))||HYe.some(s=>(n.contain||"").includes(s))}function WYe(t){let e=F1(t);for(;Eg(e)&&!rC(e);){if(Hme(e))return e;if(Mne(e))return null;e=F1(e)}return null}function Wme(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const GYe=new Set(["html","body","#document"]);function rC(t){return GYe.has(XC(t))}function bm(t){return sf(t).getComputedStyle(t)}function Tne(t){return _m(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function F1(t){if(XC(t)==="html")return t;const e=t.assignedSlot||t.parentNode||rwe(t)&&t.host||Rg(t);return rwe(e)?e.host:e}function TAe(t){const e=F1(t);return rC(e)?t.ownerDocument?t.ownerDocument.body:t.body:Eg(e)&&dI(e)?e:TAe(e)}function VA(t,e,n){var s;e===void 0&&(e=[]),n===void 0&&(n=!0);const a=TAe(t),o=a===((s=t.ownerDocument)==null?void 0:s.body),l=sf(a);if(o){const i=fue(l);return e.concat(l,l.visualViewport||[],dI(a)?a:[],i&&n?VA(i):[])}return e.concat(a,VA(a,[],n))}function fue(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function AAe(t){const e=bm(t);let n=parseFloat(e.width)||0,s=parseFloat(e.height)||0;const a=Eg(t),o=a?t.offsetWidth:n,l=a?t.offsetHeight:s,i=zee(n)!==o||zee(s)!==l;return i&&(n=o,s=l),{width:n,height:s,$:i}}function Gme(t){return _m(t)?t:t.contextElement}function vS(t){const e=Gme(t);if(!Eg(e))return Ng(1);const n=e.getBoundingClientRect(),{width:s,height:a,$:o}=AAe(e);let l=(o?zee(n.width):n.width)/s,i=(o?zee(n.height):n.height)/a;return(!l||!Number.isFinite(l))&&(l=1),(!i||!Number.isFinite(i))&&(i=1),{x:l,y:i}}const KYe=Ng(0);function EAe(t){const e=sf(t);return!Wme()||!e.visualViewport?KYe:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function ZYe(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==sf(t)?!1:e}function Oj(t,e,n,s){e===void 0&&(e=!1),n===void 0&&(n=!1);const a=t.getBoundingClientRect(),o=Gme(t);let l=Ng(1);e&&(s?_m(s)&&(l=vS(s)):l=vS(t));const i=ZYe(o,n,s)?EAe(o):Ng(0);let h=(a.left+i.x)/l.x,p=(a.top+i.y)/l.y,x=a.width/l.x,y=a.height/l.y;if(o){const b=sf(o),j=s&&_m(s)?sf(s):s;let C=b,N=fue(C);for(;N&&s&&j!==C;){const A=vS(N),E=N.getBoundingClientRect(),T=bm(N),L=E.left+(N.clientLeft+parseFloat(T.paddingLeft))*A.x,z=E.top+(N.clientTop+parseFloat(T.paddingTop))*A.y;h*=A.x,p*=A.y,x*=A.x,y*=A.y,h+=L,p+=z,C=sf(N),N=fue(C)}}return $ee({width:x,height:y,x:h,y:p})}function Kme(t,e){const n=Tne(t).scrollLeft;return e?e.left+n:Oj(Rg(t)).left+n}function IAe(t,e,n){n===void 0&&(n=!1);const s=t.getBoundingClientRect(),a=s.left+e.scrollLeft-(n?0:Kme(t,s)),o=s.top+e.scrollTop;return{x:a,y:o}}function YYe(t){let{elements:e,rect:n,offsetParent:s,strategy:a}=t;const o=a==="fixed",l=Rg(s),i=e?Mne(e.floating):!1;if(s===l||i&&o)return n;let h={scrollLeft:0,scrollTop:0},p=Ng(1);const x=Ng(0),y=Eg(s);if((y||!y&&!o)&&((XC(s)!=="body"||dI(l))&&(h=Tne(s)),Eg(s))){const j=Oj(s);p=vS(s),x.x=j.x+s.clientLeft,x.y=j.y+s.clientTop}const b=l&&!y&&!o?IAe(l,h,!0):Ng(0);return{width:n.width*p.x,height:n.height*p.y,x:n.x*p.x-h.scrollLeft*p.x+x.x+b.x,y:n.y*p.y-h.scrollTop*p.y+x.y+b.y}}function XYe(t){return Array.from(t.getClientRects())}function QYe(t){const e=Rg(t),n=Tne(t),s=t.ownerDocument.body,a=Hh(e.scrollWidth,e.clientWidth,s.scrollWidth,s.clientWidth),o=Hh(e.scrollHeight,e.clientHeight,s.scrollHeight,s.clientHeight);let l=-n.scrollLeft+Kme(t);const i=-n.scrollTop;return bm(s).direction==="rtl"&&(l+=Hh(e.clientWidth,s.clientWidth)-a),{width:a,height:o,x:l,y:i}}function JYe(t,e){const n=sf(t),s=Rg(t),a=n.visualViewport;let o=s.clientWidth,l=s.clientHeight,i=0,h=0;if(a){o=a.width,l=a.height;const p=Wme();(!p||p&&e==="fixed")&&(i=a.offsetLeft,h=a.offsetTop)}return{width:o,height:l,x:i,y:h}}const eXe=new Set(["absolute","fixed"]);function tXe(t,e){const n=Oj(t,!0,e==="fixed"),s=n.top+t.clientTop,a=n.left+t.clientLeft,o=Eg(t)?vS(t):Ng(1),l=t.clientWidth*o.x,i=t.clientHeight*o.y,h=a*o.x,p=s*o.y;return{width:l,height:i,x:h,y:p}}function nwe(t,e,n){let s;if(e==="viewport")s=JYe(t,n);else if(e==="document")s=QYe(Rg(t));else if(_m(e))s=tXe(e,n);else{const a=EAe(t);s={x:e.x-a.x,y:e.y-a.y,width:e.width,height:e.height}}return $ee(s)}function PAe(t,e){const n=F1(t);return n===e||!_m(n)||rC(n)?!1:bm(n).position==="fixed"||PAe(n,e)}function rXe(t,e){const n=e.get(t);if(n)return n;let s=VA(t,[],!1).filter(i=>_m(i)&&XC(i)!=="body"),a=null;const o=bm(t).position==="fixed";let l=o?F1(t):t;for(;_m(l)&&!rC(l);){const i=bm(l),h=Hme(l);!h&&i.position==="fixed"&&(a=null),(o?!h&&!a:!h&&i.position==="static"&&!!a&&eXe.has(a.position)||dI(l)&&!h&&PAe(t,l))?s=s.filter(x=>x!==l):a=i,l=F1(l)}return e.set(t,s),s}function nXe(t){let{element:e,boundary:n,rootBoundary:s,strategy:a}=t;const l=[...n==="clippingAncestors"?Mne(e)?[]:rXe(e,this._c):[].concat(n),s],i=l[0],h=l.reduce((p,x)=>{const y=nwe(e,x,a);return p.top=Hh(y.top,p.top),p.right=R1(y.right,p.right),p.bottom=R1(y.bottom,p.bottom),p.left=Hh(y.left,p.left),p},nwe(e,i,a));return{width:h.right-h.left,height:h.bottom-h.top,x:h.left,y:h.top}}function sXe(t){const{width:e,height:n}=AAe(t);return{width:e,height:n}}function aXe(t,e,n){const s=Eg(e),a=Rg(e),o=n==="fixed",l=Oj(t,!0,o,e);let i={scrollLeft:0,scrollTop:0};const h=Ng(0);function p(){h.x=Kme(a)}if(s||!s&&!o)if((XC(e)!=="body"||dI(a))&&(i=Tne(e)),s){const j=Oj(e,!0,o,e);h.x=j.x+e.clientLeft,h.y=j.y+e.clientTop}else a&&p();o&&!s&&a&&p();const x=a&&!s&&!o?IAe(a,i):Ng(0),y=l.left+i.scrollLeft-h.x-x.x,b=l.top+i.scrollTop-h.y-x.y;return{x:y,y:b,width:l.width,height:l.height}}function gle(t){return bm(t).position==="static"}function swe(t,e){if(!Eg(t)||bm(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return Rg(t)===n&&(n=n.ownerDocument.body),n}function LAe(t,e){const n=sf(t);if(Mne(t))return n;if(!Eg(t)){let a=F1(t);for(;a&&!rC(a);){if(_m(a)&&!gle(a))return a;a=F1(a)}return n}let s=swe(t,e);for(;s&&$Ye(s)&&gle(s);)s=swe(s,e);return s&&rC(s)&&gle(s)&&!Hme(s)?n:s||WYe(t)||n}const iXe=async function(t){const e=this.getOffsetParent||LAe,n=this.getDimensions,s=await n(t.floating);return{reference:aXe(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:s.width,height:s.height}}};function oXe(t){return bm(t).direction==="rtl"}const lXe={convertOffsetParentRelativeRectToViewportRelativeRect:YYe,getDocumentElement:Rg,getClippingRect:nXe,getOffsetParent:LAe,getElementRects:iXe,getClientRects:XYe,getDimensions:sXe,getScale:vS,isElement:_m,isRTL:oXe};function OAe(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function cXe(t,e){let n=null,s;const a=Rg(t);function o(){var i;clearTimeout(s),(i=n)==null||i.disconnect(),n=null}function l(i,h){i===void 0&&(i=!1),h===void 0&&(h=1),o();const p=t.getBoundingClientRect(),{left:x,top:y,width:b,height:j}=p;if(i||e(),!b||!j)return;const C=aL(y),N=aL(a.clientWidth-(x+b)),A=aL(a.clientHeight-(y+j)),E=aL(x),L={rootMargin:-C+"px "+-N+"px "+-A+"px "+-E+"px",threshold:Hh(0,R1(1,h))||1};let z=!0;function F(q){const H=q[0].intersectionRatio;if(H!==h){if(!z)return l();H?l(!1,H):s=setTimeout(()=>{l(!1,1e-7)},1e3)}H===1&&!OAe(p,t.getBoundingClientRect())&&l(),z=!1}try{n=new IntersectionObserver(F,{...L,root:a.ownerDocument})}catch{n=new IntersectionObserver(F,L)}n.observe(t)}return l(!0),o}function dXe(t,e,n,s){s===void 0&&(s={});const{ancestorScroll:a=!0,ancestorResize:o=!0,elementResize:l=typeof ResizeObserver=="function",layoutShift:i=typeof IntersectionObserver=="function",animationFrame:h=!1}=s,p=Gme(t),x=a||o?[...p?VA(p):[],...VA(e)]:[];x.forEach(E=>{a&&E.addEventListener("scroll",n,{passive:!0}),o&&E.addEventListener("resize",n)});const y=p&&i?cXe(p,n):null;let b=-1,j=null;l&&(j=new ResizeObserver(E=>{let[T]=E;T&&T.target===p&&j&&(j.unobserve(e),cancelAnimationFrame(b),b=requestAnimationFrame(()=>{var L;(L=j)==null||L.observe(e)})),n()}),p&&!h&&j.observe(p),j.observe(e));let C,N=h?Oj(t):null;h&&A();function A(){const E=Oj(t);N&&!OAe(N,E)&&n(),N=E,C=requestAnimationFrame(A)}return n(),()=>{var E;x.forEach(T=>{a&&T.removeEventListener("scroll",n),o&&T.removeEventListener("resize",n)}),y==null||y(),(E=j)==null||E.disconnect(),j=null,h&&cancelAnimationFrame(C)}}const uXe=OYe,hXe=DYe,fXe=IYe,pXe=FYe,mXe=PYe,awe=EYe,gXe=RYe,xXe=(t,e,n)=>{const s=new Map,a={platform:lXe,...n},o={...a.platform,_c:s};return AYe(t,e,{...a,platform:o})};var yXe=typeof document<"u",vXe=function(){},QJ=yXe?I.useLayoutEffect:vXe;function Uee(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(!Uee(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)&&!Uee(t[o],e[o]))return!1}return!0}return t!==t&&e!==e}function DAe(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function iwe(t,e){const n=DAe(t);return Math.round(e*n)/n}function xle(t){const e=I.useRef(t);return QJ(()=>{e.current=t}),e}function _Xe(t){t===void 0&&(t={});const{placement:e="bottom",strategy:n="absolute",middleware:s=[],platform:a,elements:{reference:o,floating:l}={},transform:i=!0,whileElementsMounted:h,open:p}=t,[x,y]=I.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[b,j]=I.useState(s);Uee(b,s)||j(s);const[C,N]=I.useState(null),[A,E]=I.useState(null),T=I.useCallback(ue=>{ue!==q.current&&(q.current=ue,N(ue))},[]),L=I.useCallback(ue=>{ue!==H.current&&(H.current=ue,E(ue))},[]),z=o||C,F=l||A,q=I.useRef(null),H=I.useRef(null),Z=I.useRef(x),G=h!=null,te=xle(h),ie=xle(a),le=xle(p),ye=I.useCallback(()=>{if(!q.current||!H.current)return;const ue={placement:e,strategy:n,middleware:b};ie.current&&(ue.platform=ie.current),xXe(q.current,H.current,ue).then(_e=>{const Ae={..._e,isPositioned:le.current!==!1};ne.current&&!Uee(Z.current,Ae)&&(Z.current=Ae,uy.flushSync(()=>{y(Ae)}))})},[b,e,n,ie,le]);QJ(()=>{p===!1&&Z.current.isPositioned&&(Z.current.isPositioned=!1,y(ue=>({...ue,isPositioned:!1})))},[p]);const ne=I.useRef(!1);QJ(()=>(ne.current=!0,()=>{ne.current=!1}),[]),QJ(()=>{if(z&&(q.current=z),F&&(H.current=F),z&&F){if(te.current)return te.current(z,F,ye);ye()}},[z,F,ye,te,G]);const ge=I.useMemo(()=>({reference:q,floating:H,setReference:T,setFloating:L}),[T,L]),ae=I.useMemo(()=>({reference:z,floating:F}),[z,F]),he=I.useMemo(()=>{const ue={position:n,left:0,top:0};if(!ae.floating)return ue;const _e=iwe(ae.floating,x.x),Ae=iwe(ae.floating,x.y);return i?{...ue,transform:"translate("+_e+"px, "+Ae+"px)",...DAe(ae.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:_e,top:Ae}},[n,i,ae.floating,x.x,x.y]);return I.useMemo(()=>({...x,update:ye,refs:ge,elements:ae,floatingStyles:he}),[x,ye,ge,ae,he])}const bXe=t=>{function e(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:t,fn(n){const{element:s,padding:a}=typeof t=="function"?t(n):t;return s&&e(s)?s.current!=null?awe({element:s.current,padding:a}).fn(n):{}:s?awe({element:s,padding:a}).fn(n):{}}}},wXe=(t,e)=>({...uXe(t),options:[t,e]}),jXe=(t,e)=>({...hXe(t),options:[t,e]}),kXe=(t,e)=>({...gXe(t),options:[t,e]}),NXe=(t,e)=>({...fXe(t),options:[t,e]}),SXe=(t,e)=>({...pXe(t),options:[t,e]}),CXe=(t,e)=>({...mXe(t),options:[t,e]}),MXe=(t,e)=>({...bXe(t),options:[t,e]});var TXe="Arrow",RAe=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"})})});RAe.displayName=TXe;var AXe=RAe;function uI(t){const[e,n]=I.useState(void 0);return Jl(()=>{if(t){n({width:t.offsetWidth,height:t.offsetHeight});const s=new ResizeObserver(a=>{if(!Array.isArray(a)||!a.length)return;const o=a[0];let l,i;if("borderBoxSize"in o){const h=o.borderBoxSize,p=Array.isArray(h)?h[0]:h;l=p.inlineSize,i=p.blockSize}else l=t.offsetWidth,i=t.offsetHeight;n({width:l,height:i})});return s.observe(t,{box:"border-box"}),()=>s.unobserve(t)}else n(void 0)},[t]),e}var Zme="Popper",[FAe,Fg]=tc(Zme),[EXe,zAe]=FAe(Zme),BAe=t=>{const{__scopePopper:e,children:n}=t,[s,a]=I.useState(null);return r.jsx(EXe,{scope:e,anchor:s,onAnchorChange:a,children:n})};BAe.displayName=Zme;var $Ae="PopperAnchor",UAe=I.forwardRef((t,e)=>{const{__scopePopper:n,virtualRef:s,...a}=t,o=zAe($Ae,n),l=I.useRef(null),i=ta(e,l);return I.useEffect(()=>{o.onAnchorChange((s==null?void 0:s.current)||l.current)}),s?null:r.jsx(Rn.div,{...a,ref:i})});UAe.displayName=$Ae;var Yme="PopperContent",[IXe,PXe]=FAe(Yme),qAe=I.forwardRef((t,e)=>{var Ee,Ue,Re,je,et,Te;const{__scopePopper:n,side:s="bottom",sideOffset:a=0,align:o="center",alignOffset:l=0,arrowPadding:i=0,avoidCollisions:h=!0,collisionBoundary:p=[],collisionPadding:x=0,sticky:y="partial",hideWhenDetached:b=!1,updatePositionStrategy:j="optimized",onPlaced:C,...N}=t,A=zAe(Yme,n),[E,T]=I.useState(null),L=ta(e,Ze=>T(Ze)),[z,F]=I.useState(null),q=uI(z),H=(q==null?void 0:q.width)??0,Z=(q==null?void 0:q.height)??0,G=s+(o!=="center"?"-"+o:""),te=typeof x=="number"?x:{top:0,right:0,bottom:0,left:0,...x},ie=Array.isArray(p)?p:[p],le=ie.length>0,ye={padding:te,boundary:ie.filter(OXe),altBoundary:le},{refs:ne,floatingStyles:ge,placement:ae,isPositioned:he,middlewareData:ue}=_Xe({strategy:"fixed",placement:G,whileElementsMounted:(...Ze)=>dXe(...Ze,{animationFrame:j==="always"}),elements:{reference:A.anchor},middleware:[wXe({mainAxis:a+Z,alignmentAxis:l}),h&&jXe({mainAxis:!0,crossAxis:!1,limiter:y==="partial"?kXe():void 0,...ye}),h&&NXe({...ye}),SXe({...ye,apply:({elements:Ze,rects:pe,availableWidth:yt,availableHeight:rt})=>{const{width:at,height:Me}=pe.reference,ft=Ze.floating.style;ft.setProperty("--radix-popper-available-width",`${yt}px`),ft.setProperty("--radix-popper-available-height",`${rt}px`),ft.setProperty("--radix-popper-anchor-width",`${at}px`),ft.setProperty("--radix-popper-anchor-height",`${Me}px`)}}),z&&MXe({element:z,padding:i}),DXe({arrowWidth:H,arrowHeight:Z}),b&&CXe({strategy:"referenceHidden",...ye})]}),[_e,Ae]=WAe(ae),Ce=Xl(C);Jl(()=>{he&&(Ce==null||Ce())},[he,Ce]);const be=(Ee=ue.arrow)==null?void 0:Ee.x,me=(Ue=ue.arrow)==null?void 0:Ue.y,Le=((Re=ue.arrow)==null?void 0:Re.centerOffset)!==0,[Ne,Be]=I.useState();return Jl(()=>{E&&Be(window.getComputedStyle(E).zIndex)},[E]),r.jsx("div",{ref:ne.setFloating,"data-radix-popper-content-wrapper":"",style:{...ge,transform:he?ge.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Ne,"--radix-popper-transform-origin":[(je=ue.transformOrigin)==null?void 0:je.x,(et=ue.transformOrigin)==null?void 0:et.y].join(" "),...((Te=ue.hide)==null?void 0:Te.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:r.jsx(IXe,{scope:n,placedSide:_e,onArrowChange:F,arrowX:be,arrowY:me,shouldHideArrow:Le,children:r.jsx(Rn.div,{"data-side":_e,"data-align":Ae,...N,ref:L,style:{...N.style,animation:he?void 0:"none"}})})})});qAe.displayName=Yme;var VAe="PopperArrow",LXe={top:"bottom",right:"left",bottom:"top",left:"right"},HAe=I.forwardRef(function(e,n){const{__scopePopper:s,...a}=e,o=PXe(VAe,s),l=LXe[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(AXe,{...a,ref:n,style:{...a.style,display:"block"}})})});HAe.displayName=VAe;function OXe(t){return t!==null}var DXe=t=>({name:"transformOrigin",options:t,fn(e){var A,E,T;const{placement:n,rects:s,middlewareData:a}=e,l=((A=a.arrow)==null?void 0:A.centerOffset)!==0,i=l?0:t.arrowWidth,h=l?0:t.arrowHeight,[p,x]=WAe(n),y={start:"0%",center:"50%",end:"100%"}[x],b=(((E=a.arrow)==null?void 0:E.x)??0)+i/2,j=(((T=a.arrow)==null?void 0:T.y)??0)+h/2;let C="",N="";return p==="bottom"?(C=l?y:`${b}px`,N=`${-h}px`):p==="top"?(C=l?y:`${b}px`,N=`${s.floating.height+h}px`):p==="right"?(C=`${-h}px`,N=l?y:`${j}px`):p==="left"&&(C=`${s.floating.width+h}px`,N=l?y:`${j}px`),{data:{x:C,y:N}}}});function WAe(t){const[e,n="center"]=t.split("-");return[e,n]}var hI=BAe,QC=UAe,fI=qAe,pI=HAe,[Ane]=tc("Tooltip",[Fg]),Ene=Fg(),GAe="TooltipProvider",RXe=700,pue="tooltip.open",[FXe,Xme]=Ane(GAe),KAe=t=>{const{__scopeTooltip:e,delayDuration:n=RXe,skipDelayDuration:s=300,disableHoverableContent:a=!1,children:o}=t,l=I.useRef(!0),i=I.useRef(!1),h=I.useRef(0);return I.useEffect(()=>{const p=h.current;return()=>window.clearTimeout(p)},[]),r.jsx(FXe,{scope:e,isOpenDelayedRef:l,delayDuration:n,onOpen:I.useCallback(()=>{window.clearTimeout(h.current),l.current=!1},[]),onClose:I.useCallback(()=>{window.clearTimeout(h.current),h.current=window.setTimeout(()=>l.current=!0,s)},[s]),isPointerInTransitRef:i,onPointerInTransitChange:I.useCallback(p=>{i.current=p},[]),disableHoverableContent:a,children:o})};KAe.displayName=GAe;var HA="Tooltip",[zXe,Ine]=Ane(HA),ZAe=t=>{const{__scopeTooltip:e,children:n,open:s,defaultOpen:a,onOpenChange:o,disableHoverableContent:l,delayDuration:i}=t,h=Xme(HA,t.__scopeTooltip),p=Ene(e),[x,y]=I.useState(null),b=Gc(),j=I.useRef(0),C=l??h.disableHoverableContent,N=i??h.delayDuration,A=I.useRef(!1),[E,T]=Fu({prop:s,defaultProp:a??!1,onChange:H=>{H?(h.onOpen(),document.dispatchEvent(new CustomEvent(pue))):h.onClose(),o==null||o(H)},caller:HA}),L=I.useMemo(()=>E?A.current?"delayed-open":"instant-open":"closed",[E]),z=I.useCallback(()=>{window.clearTimeout(j.current),j.current=0,A.current=!1,T(!0)},[T]),F=I.useCallback(()=>{window.clearTimeout(j.current),j.current=0,T(!1)},[T]),q=I.useCallback(()=>{window.clearTimeout(j.current),j.current=window.setTimeout(()=>{A.current=!0,T(!0),j.current=0},N)},[N,T]);return I.useEffect(()=>()=>{j.current&&(window.clearTimeout(j.current),j.current=0)},[]),r.jsx(hI,{...p,children:r.jsx(zXe,{scope:e,contentId:b,open:E,stateAttribute:L,trigger:x,onTriggerChange:y,onTriggerEnter:I.useCallback(()=>{h.isOpenDelayedRef.current?q():z()},[h.isOpenDelayedRef,q,z]),onTriggerLeave:I.useCallback(()=>{C?F():(window.clearTimeout(j.current),j.current=0)},[F,C]),onOpen:z,onClose:F,disableHoverableContent:C,children:n})})};ZAe.displayName=HA;var mue="TooltipTrigger",YAe=I.forwardRef((t,e)=>{const{__scopeTooltip:n,...s}=t,a=Ine(mue,n),o=Xme(mue,n),l=Ene(n),i=I.useRef(null),h=ta(e,i,a.onTriggerChange),p=I.useRef(!1),x=I.useRef(!1),y=I.useCallback(()=>p.current=!1,[]);return I.useEffect(()=>()=>document.removeEventListener("pointerup",y),[y]),r.jsx(QC,{asChild:!0,...l,children:r.jsx(Rn.button,{"aria-describedby":a.open?a.contentId:void 0,"data-state":a.stateAttribute,...s,ref:h,onPointerMove:an(t.onPointerMove,b=>{b.pointerType!=="touch"&&!x.current&&!o.isPointerInTransitRef.current&&(a.onTriggerEnter(),x.current=!0)}),onPointerLeave:an(t.onPointerLeave,()=>{a.onTriggerLeave(),x.current=!1}),onPointerDown:an(t.onPointerDown,()=>{a.open&&a.onClose(),p.current=!0,document.addEventListener("pointerup",y,{once:!0})}),onFocus:an(t.onFocus,()=>{p.current||a.onOpen()}),onBlur:an(t.onBlur,a.onClose),onClick:an(t.onClick,a.onClose)})})});YAe.displayName=mue;var BXe="TooltipPortal",[kKt,$Xe]=Ane(BXe,{forceMount:void 0}),nC="TooltipContent",XAe=I.forwardRef((t,e)=>{const n=$Xe(nC,t.__scopeTooltip),{forceMount:s=n.forceMount,side:a="top",...o}=t,l=Ine(nC,t.__scopeTooltip);return r.jsx(gc,{present:s||l.open,children:l.disableHoverableContent?r.jsx(QAe,{side:a,...o,ref:e}):r.jsx(UXe,{side:a,...o,ref:e})})}),UXe=I.forwardRef((t,e)=>{const n=Ine(nC,t.__scopeTooltip),s=Xme(nC,t.__scopeTooltip),a=I.useRef(null),o=ta(e,a),[l,i]=I.useState(null),{trigger:h,onClose:p}=n,x=a.current,{onPointerInTransitChange:y}=s,b=I.useCallback(()=>{i(null),y(!1)},[y]),j=I.useCallback((C,N)=>{const A=C.currentTarget,E={x:C.clientX,y:C.clientY},T=GXe(E,A.getBoundingClientRect()),L=KXe(E,T),z=ZXe(N.getBoundingClientRect()),F=XXe([...L,...z]);i(F),y(!0)},[y]);return I.useEffect(()=>()=>b(),[b]),I.useEffect(()=>{if(h&&x){const C=A=>j(A,x),N=A=>j(A,h);return h.addEventListener("pointerleave",C),x.addEventListener("pointerleave",N),()=>{h.removeEventListener("pointerleave",C),x.removeEventListener("pointerleave",N)}}},[h,x,j,b]),I.useEffect(()=>{if(l){const C=N=>{const A=N.target,E={x:N.clientX,y:N.clientY},T=(h==null?void 0:h.contains(A))||(x==null?void 0:x.contains(A)),L=!YXe(E,l);T?b():L&&(b(),p())};return document.addEventListener("pointermove",C),()=>document.removeEventListener("pointermove",C)}},[h,x,l,p,b]),r.jsx(QAe,{...t,ref:o})}),[qXe,VXe]=Ane(HA,{isInside:!1}),HXe=UTe("TooltipContent"),QAe=I.forwardRef((t,e)=>{const{__scopeTooltip:n,children:s,"aria-label":a,onEscapeKeyDown:o,onPointerDownOutside:l,...i}=t,h=Ine(nC,n),p=Ene(n),{onClose:x}=h;return I.useEffect(()=>(document.addEventListener(pue,x),()=>document.removeEventListener(pue,x)),[x]),I.useEffect(()=>{if(h.trigger){const y=b=>{const j=b.target;j!=null&&j.contains(h.trigger)&&x()};return window.addEventListener("scroll",y,{capture:!0}),()=>window.removeEventListener("scroll",y,{capture:!0})}},[h.trigger,x]),r.jsx(ev,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:o,onPointerDownOutside:l,onFocusOutside:y=>y.preventDefault(),onDismiss:x,children:r.jsxs(fI,{"data-state":h.stateAttribute,...p,...i,ref:e,style:{...i.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[r.jsx(HXe,{children:s}),r.jsx(qXe,{scope:n,isInside:!0,children:r.jsx(OKe,{id:h.contentId,role:"tooltip",children:a||s})})]})})});XAe.displayName=nC;var JAe="TooltipArrow",WXe=I.forwardRef((t,e)=>{const{__scopeTooltip:n,...s}=t,a=Ene(n);return VXe(JAe,n).isInside?null:r.jsx(pI,{...a,...s,ref:e})});WXe.displayName=JAe;function GXe(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 KXe(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 ZXe(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 YXe(t,e){const{x:n,y:s}=t;let a=!1;for(let o=0,l=e.length-1;os!=b>s&&n<(y-p)*(s-x)/(b-x)+p&&(a=!a)}return a}function XXe(t){const e=t.slice();return e.sort((n,s)=>n.xs.x?1:n.ys.y?1:0),QXe(e)}function QXe(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 JXe=KAe,eQe=ZAe,tQe=YAe,eEe=XAe;const mI=JXe,Sg=eQe,Cg=tQe,xm=I.forwardRef(({className:t,sideOffset:e=4,...n},s)=>r.jsx(eEe,{ref:s,sideOffset:e,className:$t("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}));xm.displayName=eEe.displayName;var JC=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(){}},Dj=typeof window>"u"||"Deno"in globalThis;function Tu(){}function rQe(t,e){return typeof t=="function"?t(e):t}function gue(t){return typeof t=="number"&&t>=0&&t!==1/0}function tEe(t,e){return Math.max(t+(e||0)-Date.now(),0)}function k1(t,e){return typeof t=="function"?t(e):t}function Df(t,e){return typeof t=="function"?t(e):t}function owe(t,e){const{type:n="all",exact:s,fetchStatus:a,predicate:o,queryKey:l,stale:i}=t;if(l){if(s){if(e.queryHash!==Qme(l,e.options))return!1}else if(!WA(e.queryKey,l))return!1}if(n!=="all"){const h=e.isActive();if(n==="active"&&!h||n==="inactive"&&h)return!1}return!(typeof i=="boolean"&&e.isStale()!==i||a&&a!==e.state.fetchStatus||o&&!o(e))}function lwe(t,e){const{exact:n,status:s,predicate:a,mutationKey:o}=t;if(o){if(!e.options.mutationKey)return!1;if(n){if(Rj(e.options.mutationKey)!==Rj(o))return!1}else if(!WA(e.options.mutationKey,o))return!1}return!(s&&e.state.status!==s||a&&!a(e))}function Qme(t,e){return((e==null?void 0:e.queryKeyHashFn)||Rj)(t)}function Rj(t){return JSON.stringify(t,(e,n)=>xue(n)?Object.keys(n).sort().reduce((s,a)=>(s[a]=n[a],s),{}):n)}function WA(t,e){return t===e?!0:typeof t!=typeof e?!1:t&&e&&typeof t=="object"&&typeof e=="object"?Object.keys(e).every(n=>WA(t[n],e[n])):!1}function rEe(t,e){if(t===e)return t;const n=cwe(t)&&cwe(e);if(n||xue(t)&&xue(e)){const s=n?t:Object.keys(t),a=s.length,o=n?e:Object.keys(e),l=o.length,i=n?[]:{},h=new Set(s);let p=0;for(let x=0;x{setTimeout(e,t)})}function yue(t,e,n){return typeof n.structuralSharing=="function"?n.structuralSharing(t,e):n.structuralSharing!==!1?rEe(t,e):e}function sQe(t,e,n=0){const s=[...t,e];return n&&s.length>n?s.slice(1):s}function aQe(t,e,n=0){const s=[e,...t];return n&&s.length>n?s.slice(0,-1):s}var Jme=Symbol();function nEe(t,e){return!t.queryFn&&(e!=null&&e.initialPromise)?()=>e.initialPromise:!t.queryFn||t.queryFn===Jme?()=>Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)):t.queryFn}function sEe(t,e){return typeof t=="function"?t(...e):!!t}var Zw,I0,RS,x5e,iQe=(x5e=class extends JC{constructor(){super();ca(this,Zw);ca(this,I0);ca(this,RS);us(this,RS,e=>{if(!Dj&&window.addEventListener){const n=()=>e();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){er(this,I0)||this.setEventListener(er(this,RS))}onUnsubscribe(){var e;this.hasListeners()||((e=er(this,I0))==null||e.call(this),us(this,I0,void 0))}setEventListener(e){var n;us(this,RS,e),(n=er(this,I0))==null||n.call(this),us(this,I0,e(s=>{typeof s=="boolean"?this.setFocused(s):this.onFocus()}))}setFocused(e){er(this,Zw)!==e&&(us(this,Zw,e),this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(n=>{n(e)})}isFocused(){var e;return typeof er(this,Zw)=="boolean"?er(this,Zw):((e=globalThis.document)==null?void 0:e.visibilityState)!=="hidden"}},Zw=new WeakMap,I0=new WeakMap,RS=new WeakMap,x5e),ege=new iQe,FS,P0,zS,y5e,oQe=(y5e=class extends JC{constructor(){super();ca(this,FS,!0);ca(this,P0);ca(this,zS);us(this,zS,e=>{if(!Dj&&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,P0)||this.setEventListener(er(this,zS))}onUnsubscribe(){var e;this.hasListeners()||((e=er(this,P0))==null||e.call(this),us(this,P0,void 0))}setEventListener(e){var n;us(this,zS,e),(n=er(this,P0))==null||n.call(this),us(this,P0,e(this.setOnline.bind(this)))}setOnline(e){er(this,FS)!==e&&(us(this,FS,e),this.listeners.forEach(s=>{s(e)}))}isOnline(){return er(this,FS)}},FS=new WeakMap,P0=new WeakMap,zS=new WeakMap,y5e),Vee=new oQe;function vue(){let t,e;const n=new Promise((a,o)=>{t=a,e=o});n.status="pending",n.catch(()=>{});function s(a){Object.assign(n,a),delete n.resolve,delete n.reject}return n.resolve=a=>{s({status:"fulfilled",value:a}),t(a)},n.reject=a=>{s({status:"rejected",reason:a}),e(a)},n}function lQe(t){return Math.min(1e3*2**t,3e4)}function aEe(t){return(t??"online")==="online"?Vee.isOnline():!0}var iEe=class extends Error{constructor(t){super("CancelledError"),this.revert=t==null?void 0:t.revert,this.silent=t==null?void 0:t.silent}};function yle(t){return t instanceof iEe}function oEe(t){let e=!1,n=0,s=!1,a;const o=vue(),l=N=>{var A;s||(b(new iEe(N)),(A=t.abort)==null||A.call(t))},i=()=>{e=!0},h=()=>{e=!1},p=()=>ege.isFocused()&&(t.networkMode==="always"||Vee.isOnline())&&t.canRun(),x=()=>aEe(t.networkMode)&&t.canRun(),y=N=>{var A;s||(s=!0,(A=t.onSuccess)==null||A.call(t,N),a==null||a(),o.resolve(N))},b=N=>{var A;s||(s=!0,(A=t.onError)==null||A.call(t,N),a==null||a(),o.reject(N))},j=()=>new Promise(N=>{var A;a=E=>{(s||p())&&N(E)},(A=t.onPause)==null||A.call(t)}).then(()=>{var N;a=void 0,s||(N=t.onContinue)==null||N.call(t)}),C=()=>{if(s)return;let N;const A=n===0?t.initialPromise:void 0;try{N=A??t.fn()}catch(E){N=Promise.reject(E)}Promise.resolve(N).then(y).catch(E=>{var q;if(s)return;const T=t.retry??(Dj?0:3),L=t.retryDelay??lQe,z=typeof L=="function"?L(n,E):L,F=T===!0||typeof T=="number"&&np()?void 0:j()).then(()=>{e?b(E):C()})})};return{promise:o,cancel:l,continue:()=>(a==null||a(),o),cancelRetry:i,continueRetry:h,canStart:x,start:()=>(x()?C():j().then(C),o)}}var cQe=t=>setTimeout(t,0);function dQe(){let t=[],e=0,n=i=>{i()},s=i=>{i()},a=cQe;const o=i=>{e?t.push(i):a(()=>{n(i)})},l=()=>{const i=t;t=[],i.length&&a(()=>{s(()=>{i.forEach(h=>{n(h)})})})};return{batch:i=>{let h;e++;try{h=i()}finally{e--,e||l()}return h},batchCalls:i=>(...h)=>{o(()=>{i(...h)})},schedule:o,setNotifyFunction:i=>{n=i},setBatchNotifyFunction:i=>{s=i},setScheduler:i=>{a=i}}}var Vc=dQe(),Yw,v5e,lEe=(v5e=class{constructor(){ca(this,Yw)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),gue(this.gcTime)&&us(this,Yw,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(Dj?1/0:5*60*1e3))}clearGcTimeout(){er(this,Yw)&&(clearTimeout(er(this,Yw)),us(this,Yw,void 0))}},Yw=new WeakMap,v5e),BS,Xw,Of,Qw,Zd,JE,Jw,Gp,yx,_5e,uQe=(_5e=class extends lEe{constructor(e){super();ca(this,Gp);ca(this,BS);ca(this,Xw);ca(this,Of);ca(this,Qw);ca(this,Zd);ca(this,JE);ca(this,Jw);us(this,Jw,!1),us(this,JE,e.defaultOptions),this.setOptions(e.options),this.observers=[],us(this,Qw,e.client),us(this,Of,er(this,Qw).getQueryCache()),this.queryKey=e.queryKey,this.queryHash=e.queryHash,us(this,BS,hQe(this.options)),this.state=e.state??er(this,BS),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var e;return(e=er(this,Zd))==null?void 0:e.promise}setOptions(e){this.options={...er(this,JE),...e},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&er(this,Of).remove(this)}setData(e,n){const s=yue(this.state.data,e,this.options);return oi(this,Gp,yx).call(this,{data:s,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),s}setState(e,n){oi(this,Gp,yx).call(this,{type:"setState",state:e,setStateOptions:n})}cancel(e){var s,a;const n=(s=er(this,Zd))==null?void 0:s.promise;return(a=er(this,Zd))==null||a.cancel(e),n?n.then(Tu).catch(Tu):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(er(this,BS))}isActive(){return this.observers.some(e=>Df(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===Jme||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>k1(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:!tEe(this.state.dataUpdatedAt,e)}onFocus(){var n;const e=this.observers.find(s=>s.shouldFetchOnWindowFocus());e==null||e.refetch({cancelRefetch:!1}),(n=er(this,Zd))==null||n.continue()}onOnline(){var n;const e=this.observers.find(s=>s.shouldFetchOnReconnect());e==null||e.refetch({cancelRefetch:!1}),(n=er(this,Zd))==null||n.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),er(this,Of).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,Zd)&&(er(this,Jw)?er(this,Zd).cancel({revert:!0}):er(this,Zd).cancelRetry()),this.scheduleGc()),er(this,Of).notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||oi(this,Gp,yx).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,Zd))return er(this,Zd).continueRetry(),er(this,Zd).promise}if(e&&this.setOptions(e),!this.options.queryFn){const b=this.observers.find(j=>j.options.queryFn);b&&this.setOptions(b.options)}const s=new AbortController,a=b=>{Object.defineProperty(b,"signal",{enumerable:!0,get:()=>(us(this,Jw,!0),s.signal)})},o=()=>{const b=nEe(this.options,n),C=(()=>{const N={client:er(this,Qw),queryKey:this.queryKey,meta:this.meta};return a(N),N})();return us(this,Jw,!1),this.options.persister?this.options.persister(b,C,this):b(C)},i=(()=>{const b={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:er(this,Qw),state:this.state,fetchFn:o};return a(b),b})();(p=this.options.behavior)==null||p.onFetch(i,this),us(this,Xw,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((x=i.fetchOptions)==null?void 0:x.meta))&&oi(this,Gp,yx).call(this,{type:"fetch",meta:(y=i.fetchOptions)==null?void 0:y.meta});const h=b=>{var j,C,N,A;yle(b)&&b.silent||oi(this,Gp,yx).call(this,{type:"error",error:b}),yle(b)||((C=(j=er(this,Of).config).onError)==null||C.call(j,b,this),(A=(N=er(this,Of).config).onSettled)==null||A.call(N,this.state.data,b,this)),this.scheduleGc()};return us(this,Zd,oEe({initialPromise:n==null?void 0:n.initialPromise,fn:i.fetchFn,abort:s.abort.bind(s),onSuccess:b=>{var j,C,N,A;if(b===void 0){h(new Error(`${this.queryHash} data is undefined`));return}try{this.setData(b)}catch(E){h(E);return}(C=(j=er(this,Of).config).onSuccess)==null||C.call(j,b,this),(A=(N=er(this,Of).config).onSettled)==null||A.call(N,b,this.state.error,this),this.scheduleGc()},onError:h,onFail:(b,j)=>{oi(this,Gp,yx).call(this,{type:"failed",failureCount:b,error:j})},onPause:()=>{oi(this,Gp,yx).call(this,{type:"pause"})},onContinue:()=>{oi(this,Gp,yx).call(this,{type:"continue"})},retry:i.options.retry,retryDelay:i.options.retryDelay,networkMode:i.options.networkMode,canRun:()=>!0})),er(this,Zd).start()}},BS=new WeakMap,Xw=new WeakMap,Of=new WeakMap,Qw=new WeakMap,Zd=new WeakMap,JE=new WeakMap,Jw=new WeakMap,Gp=new WeakSet,yx=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,...cEe(s.data,this.options),fetchMeta:e.meta??null};case"success":return us(this,Xw,void 0),{...s,data:e.data,dataUpdateCount:s.dataUpdateCount+1,dataUpdatedAt:e.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const a=e.error;return yle(a)&&a.revert&&er(this,Xw)?{...er(this,Xw),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),Vc.batch(()=>{this.observers.forEach(s=>{s.onQueryUpdate()}),er(this,Of).notify({query:this,type:"updated",action:e})})},_5e);function cEe(t,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:aEe(e.networkMode)?"fetching":"paused",...t===void 0&&{error:null,status:"pending"}}}function hQe(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 rg,b5e,fQe=(b5e=class extends JC{constructor(e={}){super();ca(this,rg);this.config=e,us(this,rg,new Map)}build(e,n,s){const a=n.queryKey,o=n.queryHash??Qme(a,n);let l=this.get(o);return l||(l=new uQe({client:e,queryKey:a,queryHash:o,options:e.defaultQueryOptions(n),state:s,defaultOptions:e.getQueryDefaults(a)}),this.add(l)),l}add(e){er(this,rg).has(e.queryHash)||(er(this,rg).set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const n=er(this,rg).get(e.queryHash);n&&(e.destroy(),n===e&&er(this,rg).delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){Vc.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return er(this,rg).get(e)}getAll(){return[...er(this,rg).values()]}find(e){const n={exact:!0,...e};return this.getAll().find(s=>owe(n,s))}findAll(e={}){const n=this.getAll();return Object.keys(e).length>0?n.filter(s=>owe(e,s)):n}notify(e){Vc.batch(()=>{this.listeners.forEach(n=>{n(e)})})}onFocus(){Vc.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){Vc.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},rg=new WeakMap,b5e),ng,Su,ej,sg,c0,w5e,pQe=(w5e=class extends lEe{constructor(e){super();ca(this,sg);ca(this,ng);ca(this,Su);ca(this,ej);this.mutationId=e.mutationId,us(this,Su,e.mutationCache),us(this,ng,[]),this.state=e.state||dEe(),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,ng).includes(e)||(er(this,ng).push(e),this.clearGcTimeout(),er(this,Su).notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){us(this,ng,er(this,ng).filter(n=>n!==e)),this.scheduleGc(),er(this,Su).notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){er(this,ng).length||(this.state.status==="pending"?this.scheduleGc():er(this,Su).remove(this))}continue(){var e;return((e=er(this,ej))==null?void 0:e.continue())??this.execute(this.state.variables)}async execute(e){var o,l,i,h,p,x,y,b,j,C,N,A,E,T,L,z,F,q,H,Z;const n=()=>{oi(this,sg,c0).call(this,{type:"continue"})};us(this,ej,oEe({fn:()=>this.options.mutationFn?this.options.mutationFn(e):Promise.reject(new Error("No mutationFn found")),onFail:(G,te)=>{oi(this,sg,c0).call(this,{type:"failed",failureCount:G,error:te})},onPause:()=>{oi(this,sg,c0).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>er(this,Su).canRun(this)}));const s=this.state.status==="pending",a=!er(this,ej).canStart();try{if(s)n();else{oi(this,sg,c0).call(this,{type:"pending",variables:e,isPaused:a}),await((l=(o=er(this,Su).config).onMutate)==null?void 0:l.call(o,e,this));const te=await((h=(i=this.options).onMutate)==null?void 0:h.call(i,e));te!==this.state.context&&oi(this,sg,c0).call(this,{type:"pending",context:te,variables:e,isPaused:a})}const G=await er(this,ej).start();return await((x=(p=er(this,Su).config).onSuccess)==null?void 0:x.call(p,G,e,this.state.context,this)),await((b=(y=this.options).onSuccess)==null?void 0:b.call(y,G,e,this.state.context)),await((C=(j=er(this,Su).config).onSettled)==null?void 0:C.call(j,G,null,this.state.variables,this.state.context,this)),await((A=(N=this.options).onSettled)==null?void 0:A.call(N,G,null,e,this.state.context)),oi(this,sg,c0).call(this,{type:"success",data:G}),G}catch(G){try{throw await((T=(E=er(this,Su).config).onError)==null?void 0:T.call(E,G,e,this.state.context,this)),await((z=(L=this.options).onError)==null?void 0:z.call(L,G,e,this.state.context)),await((q=(F=er(this,Su).config).onSettled)==null?void 0:q.call(F,void 0,G,this.state.variables,this.state.context,this)),await((Z=(H=this.options).onSettled)==null?void 0:Z.call(H,void 0,G,e,this.state.context)),G}finally{oi(this,sg,c0).call(this,{type:"error",error:G})}}finally{er(this,Su).runNext(this)}}},ng=new WeakMap,Su=new WeakMap,ej=new WeakMap,sg=new WeakSet,c0=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),Vc.batch(()=>{er(this,ng).forEach(s=>{s.onMutationUpdate(e)}),er(this,Su).notify({mutation:this,type:"updated",action:e})})},w5e);function dEe(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Cx,Kp,eI,j5e,mQe=(j5e=class extends JC{constructor(e={}){super();ca(this,Cx);ca(this,Kp);ca(this,eI);this.config=e,us(this,Cx,new Set),us(this,Kp,new Map),us(this,eI,0)}build(e,n,s){const a=new pQe({mutationCache:this,mutationId:++F6(this,eI)._,options:e.defaultMutationOptions(n),state:s});return this.add(a),a}add(e){er(this,Cx).add(e);const n=iL(e);if(typeof n=="string"){const s=er(this,Kp).get(n);s?s.push(e):er(this,Kp).set(n,[e])}this.notify({type:"added",mutation:e})}remove(e){if(er(this,Cx).delete(e)){const n=iL(e);if(typeof n=="string"){const s=er(this,Kp).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,Kp).delete(n)}}this.notify({type:"removed",mutation:e})}canRun(e){const n=iL(e);if(typeof n=="string"){const s=er(this,Kp).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=iL(e);if(typeof n=="string"){const a=(s=er(this,Kp).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(){Vc.batch(()=>{er(this,Cx).forEach(e=>{this.notify({type:"removed",mutation:e})}),er(this,Cx).clear(),er(this,Kp).clear()})}getAll(){return Array.from(er(this,Cx))}find(e){const n={exact:!0,...e};return this.getAll().find(s=>lwe(n,s))}findAll(e={}){return this.getAll().filter(n=>lwe(e,n))}notify(e){Vc.batch(()=>{this.listeners.forEach(n=>{n(e)})})}resumePausedMutations(){const e=this.getAll().filter(n=>n.state.isPaused);return Vc.batch(()=>Promise.all(e.map(n=>n.continue().catch(Tu))))}},Cx=new WeakMap,Kp=new WeakMap,eI=new WeakMap,j5e);function iL(t){var e;return(e=t.options.scope)==null?void 0:e.id}function Hee(t){return{onFetch:(e,n)=>{var x,y,b,j,C;const s=e.options,a=(b=(y=(x=e.fetchOptions)==null?void 0:x.meta)==null?void 0:y.fetchMore)==null?void 0:b.direction,o=((j=e.state.data)==null?void 0:j.pages)||[],l=((C=e.state.data)==null?void 0:C.pageParams)||[];let i={pages:[],pageParams:[]},h=0;const p=async()=>{let N=!1;const A=L=>{Object.defineProperty(L,"signal",{enumerable:!0,get:()=>(e.signal.aborted?N=!0:e.signal.addEventListener("abort",()=>{N=!0}),e.signal)})},E=nEe(e.options,e.fetchOptions),T=async(L,z,F)=>{if(N)return Promise.reject();if(z==null&&L.pages.length)return Promise.resolve(L);const H=(()=>{const ie={client:e.client,queryKey:e.queryKey,pageParam:z,direction:F?"backward":"forward",meta:e.options.meta};return A(ie),ie})(),Z=await E(H),{maxPages:G}=e.options,te=F?aQe:sQe;return{pages:te(L.pages,Z,G),pageParams:te(L.pageParams,z,G)}};if(a&&o.length){const L=a==="backward",z=L?uEe:_ue,F={pages:o,pageParams:l},q=z(s,F);i=await T(F,q,L)}else{const L=t??o.length;do{const z=h===0?l[0]??s.initialPageParam:_ue(s,i);if(h>0&&z==null)break;i=await T(i,z),h++}while(h{var N,A;return(A=(N=e.options).persister)==null?void 0:A.call(N,p,{client:e.client,queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},n)}:e.fetchFn=p}}}function _ue(t,{pages:e,pageParams:n}){const s=e.length-1;return e.length>0?t.getNextPageParam(e[s],e,n[s],n):void 0}function uEe(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 gQe(t,e){return e?_ue(t,e)!=null:!1}function xQe(t,e){return!e||!t.getPreviousPageParam?!1:uEe(t,e)!=null}var Hl,L0,O0,$S,US,D0,qS,VS,k5e,yQe=(k5e=class{constructor(t={}){ca(this,Hl);ca(this,L0);ca(this,O0);ca(this,$S);ca(this,US);ca(this,D0);ca(this,qS);ca(this,VS);us(this,Hl,t.queryCache||new fQe),us(this,L0,t.mutationCache||new mQe),us(this,O0,t.defaultOptions||{}),us(this,$S,new Map),us(this,US,new Map),us(this,D0,0)}mount(){F6(this,D0)._++,er(this,D0)===1&&(us(this,qS,ege.subscribe(async t=>{t&&(await this.resumePausedMutations(),er(this,Hl).onFocus())})),us(this,VS,Vee.subscribe(async t=>{t&&(await this.resumePausedMutations(),er(this,Hl).onOnline())})))}unmount(){var t,e;F6(this,D0)._--,er(this,D0)===0&&((t=er(this,qS))==null||t.call(this),us(this,qS,void 0),(e=er(this,VS))==null||e.call(this),us(this,VS,void 0))}isFetching(t){return er(this,Hl).findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return er(this,L0).findAll({...t,status:"pending"}).length}getQueryData(t){var n;const e=this.defaultQueryOptions({queryKey:t});return(n=er(this,Hl).get(e.queryHash))==null?void 0:n.state.data}ensureQueryData(t){const e=this.defaultQueryOptions(t),n=er(this,Hl).build(this,e),s=n.state.data;return s===void 0?this.fetchQuery(t):(t.revalidateIfStale&&n.isStaleByTime(k1(e.staleTime,n))&&this.prefetchQuery(e),Promise.resolve(s))}getQueriesData(t){return er(this,Hl).findAll(t).map(({queryKey:e,state:n})=>{const s=n.data;return[e,s]})}setQueryData(t,e,n){const s=this.defaultQueryOptions({queryKey:t}),a=er(this,Hl).get(s.queryHash),o=a==null?void 0:a.state.data,l=rQe(e,o);if(l!==void 0)return er(this,Hl).build(this,s).setData(l,{...n,manual:!0})}setQueriesData(t,e,n){return Vc.batch(()=>er(this,Hl).findAll(t).map(({queryKey:s})=>[s,this.setQueryData(s,e,n)]))}getQueryState(t){var n;const e=this.defaultQueryOptions({queryKey:t});return(n=er(this,Hl).get(e.queryHash))==null?void 0:n.state}removeQueries(t){const e=er(this,Hl);Vc.batch(()=>{e.findAll(t).forEach(n=>{e.remove(n)})})}resetQueries(t,e){const n=er(this,Hl);return Vc.batch(()=>(n.findAll(t).forEach(s=>{s.reset()}),this.refetchQueries({type:"active",...t},e)))}cancelQueries(t,e={}){const n={revert:!0,...e},s=Vc.batch(()=>er(this,Hl).findAll(t).map(a=>a.cancel(n)));return Promise.all(s).then(Tu).catch(Tu)}invalidateQueries(t,e={}){return Vc.batch(()=>(er(this,Hl).findAll(t).forEach(n=>{n.invalidate()}),(t==null?void 0:t.refetchType)==="none"?Promise.resolve():this.refetchQueries({...t,type:(t==null?void 0:t.refetchType)??(t==null?void 0:t.type)??"active"},e)))}refetchQueries(t,e={}){const n={...e,cancelRefetch:e.cancelRefetch??!0},s=Vc.batch(()=>er(this,Hl).findAll(t).filter(a=>!a.isDisabled()&&!a.isStatic()).map(a=>{let o=a.fetch(void 0,n);return n.throwOnError||(o=o.catch(Tu)),a.state.fetchStatus==="paused"?Promise.resolve():o}));return Promise.all(s).then(Tu)}fetchQuery(t){const e=this.defaultQueryOptions(t);e.retry===void 0&&(e.retry=!1);const n=er(this,Hl).build(this,e);return n.isStaleByTime(k1(e.staleTime,n))?n.fetch(e):Promise.resolve(n.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(Tu).catch(Tu)}fetchInfiniteQuery(t){return t.behavior=Hee(t.pages),this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(Tu).catch(Tu)}ensureInfiniteQueryData(t){return t.behavior=Hee(t.pages),this.ensureQueryData(t)}resumePausedMutations(){return Vee.isOnline()?er(this,L0).resumePausedMutations():Promise.resolve()}getQueryCache(){return er(this,Hl)}getMutationCache(){return er(this,L0)}getDefaultOptions(){return er(this,O0)}setDefaultOptions(t){us(this,O0,t)}setQueryDefaults(t,e){er(this,$S).set(Rj(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){const e=[...er(this,$S).values()],n={};return e.forEach(s=>{WA(t,s.queryKey)&&Object.assign(n,s.defaultOptions)}),n}setMutationDefaults(t,e){er(this,US).set(Rj(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){const e=[...er(this,US).values()],n={};return e.forEach(s=>{WA(t,s.mutationKey)&&Object.assign(n,s.defaultOptions)}),n}defaultQueryOptions(t){if(t._defaulted)return t;const e={...er(this,O0).queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=Qme(e.queryKey,e)),e.refetchOnReconnect===void 0&&(e.refetchOnReconnect=e.networkMode!=="always"),e.throwOnError===void 0&&(e.throwOnError=!!e.suspense),!e.networkMode&&e.persister&&(e.networkMode="offlineFirst"),e.queryFn===Jme&&(e.enabled=!1),e}defaultMutationOptions(t){return t!=null&&t._defaulted?t:{...er(this,O0).mutations,...(t==null?void 0:t.mutationKey)&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){er(this,Hl).clear(),er(this,L0).clear()}},Hl=new WeakMap,L0=new WeakMap,O0=new WeakMap,$S=new WeakMap,US=new WeakMap,D0=new WeakMap,qS=new WeakMap,VS=new WeakMap,k5e),ah,qi,tI,Cu,tj,HS,R0,F0,rI,WS,GS,rj,nj,z0,KS,go,nT,bue,wue,jue,kue,Nue,Sue,Cue,fEe,N5e,hEe=(N5e=class extends JC{constructor(e,n){super();ca(this,go);ca(this,ah);ca(this,qi);ca(this,tI);ca(this,Cu);ca(this,tj);ca(this,HS);ca(this,R0);ca(this,F0);ca(this,rI);ca(this,WS);ca(this,GS);ca(this,rj);ca(this,nj);ca(this,z0);ca(this,KS,new Set);this.options=n,us(this,ah,e),us(this,F0,null),us(this,R0,vue()),this.options.experimental_prefetchInRender||er(this,R0).reject(new Error("experimental_prefetchInRender feature flag is not enabled")),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(er(this,qi).addObserver(this),uwe(er(this,qi),this.options)?oi(this,go,nT).call(this):this.updateResult(),oi(this,go,kue).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Mue(er(this,qi),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Mue(er(this,qi),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,oi(this,go,Nue).call(this),oi(this,go,Sue).call(this),er(this,qi).removeObserver(this)}setOptions(e){const n=this.options,s=er(this,qi);if(this.options=er(this,ah).defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Df(this.options.enabled,er(this,qi))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");oi(this,go,Cue).call(this),er(this,qi).setOptions(this.options),n._defaulted&&!qee(this.options,n)&&er(this,ah).getQueryCache().notify({type:"observerOptionsUpdated",query:er(this,qi),observer:this});const a=this.hasListeners();a&&hwe(er(this,qi),s,this.options,n)&&oi(this,go,nT).call(this),this.updateResult(),a&&(er(this,qi)!==s||Df(this.options.enabled,er(this,qi))!==Df(n.enabled,er(this,qi))||k1(this.options.staleTime,er(this,qi))!==k1(n.staleTime,er(this,qi)))&&oi(this,go,bue).call(this);const o=oi(this,go,wue).call(this);a&&(er(this,qi)!==s||Df(this.options.enabled,er(this,qi))!==Df(n.enabled,er(this,qi))||o!==er(this,z0))&&oi(this,go,jue).call(this,o)}getOptimisticResult(e){const n=er(this,ah).getQueryCache().build(er(this,ah),e),s=this.createResult(n,e);return _Qe(this,s)&&(us(this,Cu,s),us(this,HS,this.options),us(this,tj,er(this,qi).state)),s}getCurrentResult(){return er(this,Cu)}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,KS).add(e)}getCurrentQuery(){return er(this,qi)}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const n=er(this,ah).defaultQueryOptions(e),s=er(this,ah).getQueryCache().build(er(this,ah),n);return s.fetch().then(()=>this.createResult(s,n))}fetch(e){return oi(this,go,nT).call(this,{...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),er(this,Cu)))}createResult(e,n){var G;const s=er(this,qi),a=this.options,o=er(this,Cu),l=er(this,tj),i=er(this,HS),p=e!==s?e.state:er(this,tI),{state:x}=e;let y={...x},b=!1,j;if(n._optimisticResults){const te=this.hasListeners(),ie=!te&&uwe(e,n),le=te&&hwe(e,s,n,a);(ie||le)&&(y={...y,...cEe(x.data,e.options)}),n._optimisticResults==="isRestoring"&&(y.fetchStatus="idle")}let{error:C,errorUpdatedAt:N,status:A}=y;j=y.data;let E=!1;if(n.placeholderData!==void 0&&j===void 0&&A==="pending"){let te;o!=null&&o.isPlaceholderData&&n.placeholderData===(i==null?void 0:i.placeholderData)?(te=o.data,E=!0):te=typeof n.placeholderData=="function"?n.placeholderData((G=er(this,GS))==null?void 0:G.state.data,er(this,GS)):n.placeholderData,te!==void 0&&(A="success",j=yue(o==null?void 0:o.data,te,n),b=!0)}if(n.select&&j!==void 0&&!E)if(o&&j===(l==null?void 0:l.data)&&n.select===er(this,rI))j=er(this,WS);else try{us(this,rI,n.select),j=n.select(j),j=yue(o==null?void 0:o.data,j,n),us(this,WS,j),us(this,F0,null)}catch(te){us(this,F0,te)}er(this,F0)&&(C=er(this,F0),j=er(this,WS),N=Date.now(),A="error");const T=y.fetchStatus==="fetching",L=A==="pending",z=A==="error",F=L&&T,q=j!==void 0,Z={status:A,fetchStatus:y.fetchStatus,isPending:L,isSuccess:A==="success",isError:z,isInitialLoading:F,isLoading:F,data:j,dataUpdatedAt:y.dataUpdatedAt,error:C,errorUpdatedAt:N,failureCount:y.fetchFailureCount,failureReason:y.fetchFailureReason,errorUpdateCount:y.errorUpdateCount,isFetched:y.dataUpdateCount>0||y.errorUpdateCount>0,isFetchedAfterMount:y.dataUpdateCount>p.dataUpdateCount||y.errorUpdateCount>p.errorUpdateCount,isFetching:T,isRefetching:T&&!L,isLoadingError:z&&!q,isPaused:y.fetchStatus==="paused",isPlaceholderData:b,isRefetchError:z&&q,isStale:tge(e,n),refetch:this.refetch,promise:er(this,R0),isEnabled:Df(n.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){const te=ye=>{Z.status==="error"?ye.reject(Z.error):Z.data!==void 0&&ye.resolve(Z.data)},ie=()=>{const ye=us(this,R0,Z.promise=vue());te(ye)},le=er(this,R0);switch(le.status){case"pending":e.queryHash===s.queryHash&&te(le);break;case"fulfilled":(Z.status==="error"||Z.data!==le.value)&&ie();break;case"rejected":(Z.status!=="error"||Z.error!==le.reason)&&ie();break}}return Z}updateResult(){const e=er(this,Cu),n=this.createResult(er(this,qi),this.options);if(us(this,tj,er(this,qi).state),us(this,HS,this.options),er(this,tj).data!==void 0&&us(this,GS,er(this,qi)),qee(n,e))return;us(this,Cu,n);const s=()=>{if(!e)return!0;const{notifyOnChangeProps:a}=this.options,o=typeof a=="function"?a():a;if(o==="all"||!o&&!er(this,KS).size)return!0;const l=new Set(o??er(this,KS));return this.options.throwOnError&&l.add("error"),Object.keys(er(this,Cu)).some(i=>{const h=i;return er(this,Cu)[h]!==e[h]&&l.has(h)})};oi(this,go,fEe).call(this,{listeners:s()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&oi(this,go,kue).call(this)}},ah=new WeakMap,qi=new WeakMap,tI=new WeakMap,Cu=new WeakMap,tj=new WeakMap,HS=new WeakMap,R0=new WeakMap,F0=new WeakMap,rI=new WeakMap,WS=new WeakMap,GS=new WeakMap,rj=new WeakMap,nj=new WeakMap,z0=new WeakMap,KS=new WeakMap,go=new WeakSet,nT=function(e){oi(this,go,Cue).call(this);let n=er(this,qi).fetch(this.options,e);return e!=null&&e.throwOnError||(n=n.catch(Tu)),n},bue=function(){oi(this,go,Nue).call(this);const e=k1(this.options.staleTime,er(this,qi));if(Dj||er(this,Cu).isStale||!gue(e))return;const s=tEe(er(this,Cu).dataUpdatedAt,e)+1;us(this,rj,setTimeout(()=>{er(this,Cu).isStale||this.updateResult()},s))},wue=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(er(this,qi)):this.options.refetchInterval)??!1},jue=function(e){oi(this,go,Sue).call(this),us(this,z0,e),!(Dj||Df(this.options.enabled,er(this,qi))===!1||!gue(er(this,z0))||er(this,z0)===0)&&us(this,nj,setInterval(()=>{(this.options.refetchIntervalInBackground||ege.isFocused())&&oi(this,go,nT).call(this)},er(this,z0)))},kue=function(){oi(this,go,bue).call(this),oi(this,go,jue).call(this,oi(this,go,wue).call(this))},Nue=function(){er(this,rj)&&(clearTimeout(er(this,rj)),us(this,rj,void 0))},Sue=function(){er(this,nj)&&(clearInterval(er(this,nj)),us(this,nj,void 0))},Cue=function(){const e=er(this,ah).getQueryCache().build(er(this,ah),this.options);if(e===er(this,qi))return;const n=er(this,qi);us(this,qi,e),us(this,tI,e.state),this.hasListeners()&&(n==null||n.removeObserver(this),e.addObserver(this))},fEe=function(e){Vc.batch(()=>{e.listeners&&this.listeners.forEach(n=>{n(er(this,Cu))}),er(this,ah).getQueryCache().notify({query:er(this,qi),type:"observerResultsUpdated"})})},N5e);function vQe(t,e){return Df(e.enabled,t)!==!1&&t.state.data===void 0&&!(t.state.status==="error"&&e.retryOnMount===!1)}function uwe(t,e){return vQe(t,e)||t.state.data!==void 0&&Mue(t,e,e.refetchOnMount)}function Mue(t,e,n){if(Df(e.enabled,t)!==!1&&k1(e.staleTime,t)!=="static"){const s=typeof n=="function"?n(t):n;return s==="always"||s!==!1&&tge(t,e)}return!1}function hwe(t,e,n,s){return(t!==e||Df(s.enabled,t)===!1)&&(!n.suspense||t.state.status!=="error")&&tge(t,n)}function tge(t,e){return Df(e.enabled,t)!==!1&&t.isStaleByTime(k1(e.staleTime,t))}function _Qe(t,e){return!qee(t.getCurrentResult(),e)}var bQe=class extends hEe{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:Hee()})}getOptimisticResult(t){return t.behavior=Hee(),super.getOptimisticResult(t)}fetchNextPage(t){return this.fetch({...t,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(t){return this.fetch({...t,meta:{fetchMore:{direction:"backward"}}})}createResult(t,e){var C,N;const{state:n}=t,s=super.createResult(t,e),{isFetching:a,isRefetching:o,isError:l,isRefetchError:i}=s,h=(N=(C=n.fetchMeta)==null?void 0:C.fetchMore)==null?void 0:N.direction,p=l&&h==="forward",x=a&&h==="forward",y=l&&h==="backward",b=a&&h==="backward";return{...s,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:gQe(e,n.data),hasPreviousPage:xQe(e,n.data),isFetchNextPageError:p,isFetchingNextPage:x,isFetchPreviousPageError:y,isFetchingPreviousPage:b,isRefetchError:i&&!p&&!y,isRefetching:o&&!x&&!b}}},B0,$0,ih,Mx,Xx,JJ,Tue,S5e,wQe=(S5e=class extends JC{constructor(n,s){super();ca(this,Xx);ca(this,B0);ca(this,$0);ca(this,ih);ca(this,Mx);us(this,B0,n),this.setOptions(s),this.bindMethods(),oi(this,Xx,JJ).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,B0).defaultMutationOptions(n),qee(this.options,s)||er(this,B0).getMutationCache().notify({type:"observerOptionsUpdated",mutation:er(this,ih),observer:this}),s!=null&&s.mutationKey&&this.options.mutationKey&&Rj(s.mutationKey)!==Rj(this.options.mutationKey)?this.reset():((a=er(this,ih))==null?void 0:a.state.status)==="pending"&&er(this,ih).setOptions(this.options)}onUnsubscribe(){var n;this.hasListeners()||(n=er(this,ih))==null||n.removeObserver(this)}onMutationUpdate(n){oi(this,Xx,JJ).call(this),oi(this,Xx,Tue).call(this,n)}getCurrentResult(){return er(this,$0)}reset(){var n;(n=er(this,ih))==null||n.removeObserver(this),us(this,ih,void 0),oi(this,Xx,JJ).call(this),oi(this,Xx,Tue).call(this)}mutate(n,s){var a;return us(this,Mx,s),(a=er(this,ih))==null||a.removeObserver(this),us(this,ih,er(this,B0).getMutationCache().build(er(this,B0),this.options)),er(this,ih).addObserver(this),er(this,ih).execute(n)}},B0=new WeakMap,$0=new WeakMap,ih=new WeakMap,Mx=new WeakMap,Xx=new WeakSet,JJ=function(){var s;const n=((s=er(this,ih))==null?void 0:s.state)??dEe();us(this,$0,{...n,isPending:n.status==="pending",isSuccess:n.status==="success",isError:n.status==="error",isIdle:n.status==="idle",mutate:this.mutate,reset:this.reset})},Tue=function(n){Vc.batch(()=>{var s,a,o,l,i,h,p,x;if(er(this,Mx)&&this.hasListeners()){const y=er(this,$0).variables,b=er(this,$0).context;(n==null?void 0:n.type)==="success"?((a=(s=er(this,Mx)).onSuccess)==null||a.call(s,n.data,y,b),(l=(o=er(this,Mx)).onSettled)==null||l.call(o,n.data,null,y,b)):(n==null?void 0:n.type)==="error"&&((h=(i=er(this,Mx)).onError)==null||h.call(i,n.error,y,b),(x=(p=er(this,Mx)).onSettled)==null||x.call(p,void 0,n.error,y,b))}this.listeners.forEach(y=>{y(er(this,$0))})})},S5e),pEe=I.createContext(void 0),Vr=t=>{const e=I.useContext(pEe);if(!e)throw new Error("No QueryClient set, use QueryClientProvider to set one");return e},jQe=({client:t,children:e})=>(I.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),r.jsx(pEe.Provider,{value:t,children:e})),mEe=I.createContext(!1),kQe=()=>I.useContext(mEe);mEe.Provider;function NQe(){let t=!1;return{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t}}var SQe=I.createContext(NQe()),CQe=()=>I.useContext(SQe),MQe=(t,e)=>{(t.suspense||t.throwOnError||t.experimental_prefetchInRender)&&(e.isReset()||(t.retryOnMount=!1))},TQe=t=>{I.useEffect(()=>{t.clearReset()},[t])},AQe=({result:t,errorResetBoundary:e,throwOnError:n,query:s,suspense:a})=>t.isError&&!e.isReset()&&!t.isFetching&&s&&(a&&t.data===void 0||sEe(n,[t.error,s])),EQe=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))}},IQe=(t,e)=>t.isLoading&&t.isFetching&&!e,PQe=(t,e)=>(t==null?void 0:t.suspense)&&e.isPending,fwe=(t,e,n)=>e.fetchOptimistic(t).catch(()=>{n.clearReset()});function gEe(t,e,n){var y,b,j,C,N;const s=kQe(),a=CQe(),o=Vr(),l=o.defaultQueryOptions(t);(b=(y=o.getDefaultOptions().queries)==null?void 0:y._experimental_beforeQuery)==null||b.call(y,l),l._optimisticResults=s?"isRestoring":"optimistic",EQe(l),MQe(l,a),TQe(a);const i=!o.getQueryCache().get(l.queryHash),[h]=I.useState(()=>new e(o,l)),p=h.getOptimisticResult(l),x=!s&&t.subscribed!==!1;if(I.useSyncExternalStore(I.useCallback(A=>{const E=x?h.subscribe(Vc.batchCalls(A)):Tu;return h.updateResult(),E},[h,x]),()=>h.getCurrentResult(),()=>h.getCurrentResult()),I.useEffect(()=>{h.setOptions(l)},[l,h]),PQe(l,p))throw fwe(l,h,a);if(AQe({result:p,errorResetBoundary:a,throwOnError:l.throwOnError,query:o.getQueryCache().get(l.queryHash),suspense:l.suspense}))throw p.error;if((C=(j=o.getDefaultOptions().queries)==null?void 0:j._experimental_afterQuery)==null||C.call(j,l,p),l.experimental_prefetchInRender&&!Dj&&IQe(p,s)){const A=i?fwe(l,h,a):(N=o.getQueryCache().get(l.queryHash))==null?void 0:N.promise;A==null||A.catch(Tu).finally(()=>{h.updateResult()})}return l.notifyOnChangeProps?p:h.trackResult(p)}function Yt(t,e){return gEe(t,hEe)}function cr(t,e){const n=Vr(),[s]=I.useState(()=>new wQe(n,t));I.useEffect(()=>{s.setOptions(t)},[s,t]);const a=I.useSyncExternalStore(I.useCallback(l=>s.subscribe(Vc.batchCalls(l)),[s]),()=>s.getCurrentResult(),()=>s.getCurrentResult()),o=I.useCallback((l,i)=>{s.mutate(l,i).catch(Tu)},[s]);if(a.error&&sEe(s.options.throwOnError,[a.error]))throw a.error;return{...a,mutate:o,mutateAsync:a.mutate}}function LQe(t,e){return gEe(t,bQe)}/** * @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 GA(){return GA=Object.assign?Object.assign.bind():function(t){for(var e=1;e"u")throw new Error(e)}function xEe(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function DQe(){return Math.random().toString(36).substr(2,8)}function mwe(t,e){return{usr:t.state,key:t.key,idx:e}}function Aue(t,e,n,s){return n===void 0&&(n=null),GA({pathname:typeof t=="string"?t:t.pathname,search:"",hash:""},typeof e=="string"?e3(e):e,{state:n,key:e&&e.key||s||DQe()})}function Wee(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 e3(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 RQe(t,e,n,s){s===void 0&&(s={});let{window:a=document.defaultView,v5Compat:o=!1}=s,l=a.history,i=H0.Pop,h=null,p=x();p==null&&(p=0,l.replaceState(GA({},l.state,{idx:p}),""));function x(){return(l.state||{idx:null}).idx}function y(){i=H0.Pop;let A=x(),E=A==null?null:A-p;p=A,h&&h({action:i,location:N.location,delta:E})}function b(A,E){i=H0.Push;let T=Aue(N.location,A,E);p=x()+1;let L=mwe(T,p),z=N.createHref(T);try{l.pushState(L,"",z)}catch(F){if(F instanceof DOMException&&F.name==="DataCloneError")throw F;a.location.assign(z)}o&&h&&h({action:i,location:N.location,delta:1})}function j(A,E){i=H0.Replace;let T=Aue(N.location,A,E);p=x();let L=mwe(T,p),z=N.createHref(T);l.replaceState(L,"",z),o&&h&&h({action:i,location:N.location,delta:0})}function C(A){let E=a.location.origin!=="null"?a.location.origin:a.location.href,T=typeof A=="string"?A:Wee(A);return T=T.replace(/ $/,"%20"),pc(E,"No window.location.(origin|href) available to create URL for href: "+T),new URL(T,E)}let N={get action(){return i},get location(){return t(a,l)},listen(A){if(h)throw new Error("A history only accepts one active listener");return a.addEventListener(pwe,y),h=A,()=>{a.removeEventListener(pwe,y),h=null}},createHref(A){return e(a,A)},createURL:C,encodeLocation(A){let E=C(A);return{pathname:E.pathname,search:E.search,hash:E.hash}},push:b,replace:j,go(A){return l.go(A)}};return N}var gwe;(function(t){t.data="data",t.deferred="deferred",t.redirect="redirect",t.error="error"})(gwe||(gwe={}));function FQe(t,e,n){return n===void 0&&(n="/"),zQe(t,e,n)}function zQe(t,e,n,s){let a=typeof e=="string"?e3(e):e,o=rge(a.pathname||"/",n);if(o==null)return null;let l=yEe(t);BQe(l);let i=null;for(let h=0;i==null&&h{let h={relativePath:i===void 0?o.path||"":i,caseSensitive:o.caseSensitive===!0,childrenIndex:l,route:o};h.relativePath.startsWith("/")&&(pc(h.relativePath.startsWith(s),'Absolute route path "'+h.relativePath+'" nested under path '+('"'+s+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),h.relativePath=h.relativePath.slice(s.length));let p=N1([s,h.relativePath]),x=n.concat(h);o.children&&o.children.length>0&&(pc(o.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+p+'".')),yEe(o.children,e,x,p)),!(o.path==null&&!o.index)&&e.push({path:p,score:GQe(p,o.index),routesMeta:x})};return t.forEach((o,l)=>{var i;if(o.path===""||!((i=o.path)!=null&&i.includes("?")))a(o,l);else for(let h of vEe(o.path))a(o,l,h)}),e}function vEe(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=vEe(s.join("/")),i=[];return i.push(...l.map(h=>h===""?o:[o,h].join("/"))),a&&i.push(...l),i.map(h=>t.startsWith("/")&&h===""?"/":h)}function BQe(t){t.sort((e,n)=>e.score!==n.score?n.score-e.score:KQe(e.routesMeta.map(s=>s.childrenIndex),n.routesMeta.map(s=>s.childrenIndex)))}const $Qe=/^:[\w-]+$/,UQe=3,qQe=2,VQe=1,HQe=10,WQe=-2,xwe=t=>t==="*";function GQe(t,e){let n=t.split("/"),s=n.length;return n.some(xwe)&&(s+=WQe),e&&(s+=qQe),n.filter(a=>!xwe(a)).reduce((a,o)=>a+($Qe.test(o)?UQe:o===""?VQe:HQe),s)}function KQe(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 ZQe(t,e,n){let{routesMeta:s}=t,a={},o="/",l=[];for(let i=0;i{let{paramName:b,isOptional:j}=x;if(b==="*"){let N=i[y]||"";l=o.slice(0,o.length-N.length).replace(/(.)\/+$/,"$1")}const C=i[y];return j&&!C?p[b]=void 0:p[b]=(C||"").replace(/%2F/g,"/"),p},{}),pathname:o,pathnameBase:l,pattern:t}}function XQe(t,e,n){e===void 0&&(e=!1),n===void 0&&(n=!0),xEe(t==="*"||!t.endsWith("*")||t.endsWith("/*"),'Route path "'+t+'" will be treated as if it were '+('"'+t.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+t.replace(/\*$/,"/*")+'".'));let s=[],a="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(l,i,h)=>(s.push({paramName:i,isOptional:h!=null}),h?"/?([^\\/]+)?":"/([^\\/]+)"));return t.endsWith("*")?(s.push({paramName:"*"}),a+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?a+="\\/*$":t!==""&&t!=="/"&&(a+="(?:(?=\\/|$))"),[new RegExp(a,e?void 0:"i"),s]}function QQe(t){try{return t.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return xEe(!1,'The URL path "'+t+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+e+").")),t}}function rge(t,e){if(e==="/")return t;if(!t.toLowerCase().startsWith(e.toLowerCase()))return null;let n=e.endsWith("/")?e.length-1:e.length,s=t.charAt(n);return s&&s!=="/"?null:t.slice(n)||"/"}function JQe(t,e){e===void 0&&(e="/");let{pathname:n,search:s="",hash:a=""}=typeof t=="string"?e3(t):t;return{pathname:n?n.startsWith("/")?n:eJe(n,e):e,search:nJe(s),hash:sJe(a)}}function eJe(t,e){let n=e.replace(/\/+$/,"").split("/");return t.split("/").forEach(a=>{a===".."?n.length>1&&n.pop():a!=="."&&n.push(a)}),n.length>1?n.join("/"):"/"}function vle(t,e,n,s){return"Cannot include a '"+t+"' character in a manually specified "+("`to."+e+"` field ["+JSON.stringify(s)+"]. Please separate it out to the ")+("`to."+n+"` field. Alternatively you may provide the full path as ")+'a string in and the router will parse it for you.'}function tJe(t){return t.filter((e,n)=>n===0||e.route.path&&e.route.path.length>0)}function nge(t,e){let n=tJe(t);return e?n.map((s,a)=>a===n.length-1?s.pathname:s.pathnameBase):n.map(s=>s.pathnameBase)}function sge(t,e,n,s){s===void 0&&(s=!1);let a;typeof t=="string"?a=e3(t):(a=GA({},t),pc(!a.pathname||!a.pathname.includes("?"),vle("?","pathname","search",a)),pc(!a.pathname||!a.pathname.includes("#"),vle("#","pathname","hash",a)),pc(!a.search||!a.search.includes("#"),vle("#","search","hash",a)));let o=t===""||a.pathname==="",l=o?"/":a.pathname,i;if(l==null)i=n;else{let y=e.length-1;if(!s&&l.startsWith("..")){let b=l.split("/");for(;b[0]==="..";)b.shift(),y-=1;a.pathname=b.join("/")}i=y>=0?e[y]:"/"}let h=JQe(a,i),p=l&&l!=="/"&&l.endsWith("/"),x=(o||l===".")&&n.endsWith("/");return!h.pathname.endsWith("/")&&(p||x)&&(h.pathname+="/"),h}const N1=t=>t.join("/").replace(/\/\/+/g,"/"),rJe=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),nJe=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,sJe=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t;function aJe(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}const _Ee=["post","put","patch","delete"];new Set(_Ee);const iJe=["get",..._Ee];new Set(iJe);/** * 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 KA(){return KA=Object.assign?Object.assign.bind():function(t){for(var e=1;e{i.current=!0}),I.useCallback(function(p,x){if(x===void 0&&(x={}),!i.current)return;if(typeof p=="number"){s.go(p);return}let y=sge(p,JSON.parse(l),o,x.relative==="path");t==null&&e!=="/"&&(y.pathname=y.pathname==="/"?e:N1([e,y.pathname])),(x.replace?s.replace:s.push)(y,x.state,x)},[e,s,l,o,t])}const dJe=I.createContext(null);function uJe(t){let e=I.useContext(zg).outlet;return e&&I.createElement(dJe.Provider,{value:t},e)}function Zc(){let{matches:t}=I.useContext(zg),e=t[t.length-1];return e?e.params:{}}function jEe(t,e){let{relative:n}=e===void 0?{}:e,{future:s}=I.useContext(tv),{matches:a}=I.useContext(zg),{pathname:o}=jm(),l=JSON.stringify(nge(a,s.v7_relativeSplatPath));return I.useMemo(()=>sge(t,JSON.parse(l),o,n==="path"),[t,l,o,n])}function hJe(t,e){return fJe(t,e)}function fJe(t,e,n,s){t3()||pc(!1);let{navigator:a}=I.useContext(tv),{matches:o}=I.useContext(zg),l=o[o.length-1],i=l?l.params:{};l&&l.pathname;let h=l?l.pathnameBase:"/";l&&l.route;let p=jm(),x;if(e){var y;let A=typeof e=="string"?e3(e):e;h==="/"||(y=A.pathname)!=null&&y.startsWith(h)||pc(!1),x=A}else x=p;let b=x.pathname||"/",j=b;if(h!=="/"){let A=h.replace(/^\//,"").split("/");j="/"+b.replace(/^\//,"").split("/").slice(A.length).join("/")}let C=FQe(t,{pathname:j}),N=yJe(C&&C.map(A=>Object.assign({},A,{params:Object.assign({},i,A.params),pathname:N1([h,a.encodeLocation?a.encodeLocation(A.pathname).pathname:A.pathname]),pathnameBase:A.pathnameBase==="/"?h:N1([h,a.encodeLocation?a.encodeLocation(A.pathnameBase).pathname:A.pathnameBase])})),o,n,s);return e&&N?I.createElement(Pne.Provider,{value:{location:KA({pathname:"/",search:"",hash:"",state:null,key:"default"},x),navigationType:H0.Pop}},N):N}function pJe(){let t=wJe(),e=aJe(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 mJe=I.createElement(pJe,null);class gJe 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(zg.Provider,{value:this.props.routeContext},I.createElement(bEe.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function xJe(t){let{routeContext:e,match:n,children:s}=t,a=I.useContext(age);return a&&a.static&&a.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(a.staticContext._deepestRenderedBoundaryId=n.route.id),I.createElement(zg.Provider,{value:e},s)}function yJe(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||pc(!1),l=l.slice(0,Math.min(l.length,x+1))}let h=!1,p=-1;if(n&&s&&s.v7_partialHydration)for(let x=0;x=0?l=l.slice(0,p+1):l=[l[0]];break}}}return l.reduceRight((x,y,b)=>{let j,C=!1,N=null,A=null;n&&(j=i&&y.route.id?i[y.route.id]:void 0,N=y.route.errorElement||mJe,h&&(p<0&&b===0?(kJe("route-fallback"),C=!0,A=null):p===b&&(C=!0,A=y.route.hydrateFallbackElement||null)));let E=e.concat(l.slice(0,b+1)),T=()=>{let L;return j?L=N:C?L=A:y.route.Component?L=I.createElement(y.route.Component,null):y.route.element?L=y.route.element:L=x,I.createElement(xJe,{match:y,routeContext:{outlet:x,matches:E,isDataRoute:n!=null},children:L})};return n&&(y.route.ErrorBoundary||y.route.errorElement||b===0)?I.createElement(gJe,{location:n.location,revalidation:n.revalidation,component:N,error:j,children:T(),routeContext:{outlet:null,matches:E,isDataRoute:!0}}):T()},null)}var kEe=function(t){return t.UseBlocker="useBlocker",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t}(kEe||{}),NEe=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}(NEe||{});function vJe(t){let e=I.useContext(age);return e||pc(!1),e}function _Je(t){let e=I.useContext(oJe);return e||pc(!1),e}function bJe(t){let e=I.useContext(zg);return e||pc(!1),e}function SEe(t){let e=bJe(),n=e.matches[e.matches.length-1];return n.route.id||pc(!1),n.route.id}function wJe(){var t;let e=I.useContext(bEe),n=_Je(),s=SEe();return e!==void 0?e:(t=n.errors)==null?void 0:t[s]}function jJe(){let{router:t}=vJe(kEe.UseNavigateStable),e=SEe(NEe.UseNavigateStable),n=I.useRef(!1);return wEe(()=>{n.current=!0}),I.useCallback(function(a,o){o===void 0&&(o={}),n.current&&(typeof a=="number"?t.navigate(a):t.navigate(a,KA({fromRouteId:e},o)))},[t,e])}const ywe={};function kJe(t,e,n){ywe[t]||(ywe[t]=!0)}function NJe(t,e){t==null||t.v7_startTransition,t==null||t.v7_relativeSplatPath}function _le(t){let{to:e,replace:n,state:s,relative:a}=t;t3()||pc(!1);let{future:o,static:l}=I.useContext(tv),{matches:i}=I.useContext(zg),{pathname:h}=jm(),p=rs(),x=sge(e,nge(i,o.v7_relativeSplatPath),h,a==="path"),y=JSON.stringify(x);return I.useEffect(()=>p(JSON.parse(y),{replace:n,state:s,relative:a}),[p,y,a,n,s]),null}function SJe(t){return uJe(t.context)}function sn(t){pc(!1)}function CJe(t){let{basename:e="/",children:n=null,location:s,navigationType:a=H0.Pop,navigator:o,static:l=!1,future:i}=t;t3()&&pc(!1);let h=e.replace(/^\/*/,"/"),p=I.useMemo(()=>({basename:h,navigator:o,static:l,future:KA({v7_relativeSplatPath:!1},i)}),[h,i,o,l]);typeof s=="string"&&(s=e3(s));let{pathname:x="/",search:y="",hash:b="",state:j=null,key:C="default"}=s,N=I.useMemo(()=>{let A=rge(x,h);return A==null?null:{location:{pathname:A,search:y,hash:b,state:j,key:C},navigationType:a}},[h,x,y,b,j,C,a]);return N==null?null:I.createElement(tv.Provider,{value:p},I.createElement(Pne.Provider,{children:n,value:N}))}function MJe(t){let{children:e,location:n}=t;return hJe(Eue(e),n)}new Promise(()=>{});function Eue(t,e){e===void 0&&(e=[]);let n=[];return I.Children.forEach(t,(s,a)=>{if(!I.isValidElement(s))return;let o=[...e,a];if(s.type===I.Fragment){n.push.apply(n,Eue(s.props.children,o));return}s.type!==sn&&pc(!1),!s.props.index||!s.props.children||pc(!1);let l={id:s.props.id||o.join("-"),caseSensitive:s.props.caseSensitive,element:s.props.element,Component:s.props.Component,index:s.props.index,path:s.props.path,loader:s.props.loader,action:s.props.action,errorElement:s.props.errorElement,ErrorBoundary:s.props.ErrorBoundary,hasErrorBoundary:s.props.ErrorBoundary!=null||s.props.errorElement!=null,shouldRevalidate:s.props.shouldRevalidate,handle:s.props.handle,lazy:s.props.lazy};s.props.children&&(l.children=Eue(s.props.children,o)),n.push(l)}),n}/** * React Router DOM v6.30.1 * * Copyright (c) Remix Software Inc. * * This source code is licensed under the MIT license found in the * LICENSE.md file in the root directory of this source tree. * * @license MIT */function Iue(){return Iue=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0)&&(n[a]=t[a]);return n}function AJe(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function EJe(t,e){return t.button===0&&(!e||e==="_self")&&!AJe(t)}function Pue(t){return t===void 0&&(t=""),new URLSearchParams(typeof t=="string"||Array.isArray(t)||t instanceof URLSearchParams?t:Object.keys(t).reduce((e,n)=>{let s=t[n];return e.concat(Array.isArray(s)?s.map(a=>[n,a]):[[n,s]])},[]))}function IJe(t,e){let n=Pue(t);return e&&e.forEach((s,a)=>{n.has(a)||e.getAll(a).forEach(o=>{n.append(a,o)})}),n}const PJe=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],LJe="6";try{window.__reactRouterVersion=LJe}catch{}const OJe="startTransition",vwe=Vpe[OJe];function DJe(t){let{basename:e,children:n,future:s,window:a}=t,o=I.useRef();o.current==null&&(o.current=OQe({window:a,v5Compat:!0}));let l=o.current,[i,h]=I.useState({action:l.action,location:l.location}),{v7_startTransition:p}=s||{},x=I.useCallback(y=>{p&&vwe?vwe(()=>h(y)):h(y)},[h,p]);return I.useLayoutEffect(()=>l.listen(x),[l,x]),I.useEffect(()=>NJe(s),[s]),I.createElement(CJe,{basename:e,children:n,location:i.location,navigationType:i.action,navigator:l,future:s})}const RJe=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",FJe=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,co=I.forwardRef(function(e,n){let{onClick:s,relative:a,reloadDocument:o,replace:l,state:i,target:h,to:p,preventScrollReset:x,viewTransition:y}=e,b=TJe(e,PJe),{basename:j}=I.useContext(tv),C,N=!1;if(typeof p=="string"&&FJe.test(p)&&(C=p,RJe))try{let L=new URL(window.location.href),z=p.startsWith("//")?new URL(L.protocol+p):new URL(p),F=rge(z.pathname,j);z.origin===L.origin&&F!=null?p=F+z.search+z.hash:N=!0}catch{}let A=lJe(p,{relative:a}),E=zJe(p,{replace:l,state:i,target:h,preventScrollReset:x,relative:a,viewTransition:y});function T(L){s&&s(L),L.defaultPrevented||E(L)}return I.createElement("a",Iue({},b,{href:C||A,onClick:N||o?s:T,ref:n,target:h}))});var _we;(function(t){t.UseScrollRestoration="useScrollRestoration",t.UseSubmit="useSubmit",t.UseSubmitFetcher="useSubmitFetcher",t.UseFetcher="useFetcher",t.useViewTransitionState="useViewTransitionState"})(_we||(_we={}));var bwe;(function(t){t.UseFetcher="useFetcher",t.UseFetchers="useFetchers",t.UseScrollRestoration="useScrollRestoration"})(bwe||(bwe={}));function zJe(t,e){let{target:n,replace:s,state:a,preventScrollReset:o,relative:l,viewTransition:i}=e===void 0?{}:e,h=rs(),p=jm(),x=jEe(t,{relative:l});return I.useCallback(y=>{if(EJe(y,n)){y.preventDefault();let b=s!==void 0?s:Wee(p)===Wee(x);h(t,{replace:b,state:a,preventScrollReset:o,relative:l,viewTransition:i})}},[p,h,x,s,a,n,t,o,l,i])}function $d(t){let e=I.useRef(Pue(t)),n=I.useRef(!1),s=jm(),a=I.useMemo(()=>IJe(s.search,n.current?null:e.current),[s.search]),o=rs(),l=I.useCallback((i,h)=>{const p=Pue(typeof i=="function"?i(a):i);n.current=!0,o("?"+p,h)},[o,a]);return[a,l]}var BJe=typeof Element<"u",$Je=typeof Map=="function",UJe=typeof Set=="function",qJe=typeof ArrayBuffer=="function"&&!!ArrayBuffer.isView;function eee(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(!eee(t[s],e[s]))return!1;return!0}var o;if($Je&&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(!eee(s.value[1],e.get(s.value[0])))return!1;return!0}if(UJe&&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(qJe&&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(BJe&&t instanceof Element)return!1;for(s=n;s--!==0;)if(!((a[s]==="_owner"||a[s]==="__v"||a[s]==="__o")&&t.$$typeof)&&!eee(t[a[s]],e[a[s]]))return!1;return!0}return t!==t&&e!==e}var VJe=function(e,n){try{return eee(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 HJe=Hi(VJe);var WJe=function(t,e,n,s,a,o,l,i){if(!t){var h;if(e===void 0)h=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var p=[n,s,a,o,l,i],x=0;h=new Error(e.replace(/%s/g,function(){return p[x++]})),h.name="Invariant Violation"}throw h.framesToPop=1,h}},GJe=WJe;const wwe=Hi(GJe);var KJe=function(e,n,s,a){var o=s?s.call(a,e,n):void 0;if(o!==void 0)return!!o;if(e===n)return!0;if(typeof e!="object"||!e||typeof n!="object"||!n)return!1;var l=Object.keys(e),i=Object.keys(n);if(l.length!==i.length)return!1;for(var h=Object.prototype.hasOwnProperty.bind(n),p=0;p(t.BASE="base",t.BODY="body",t.HEAD="head",t.HTML="html",t.LINK="link",t.META="meta",t.NOSCRIPT="noscript",t.SCRIPT="script",t.STYLE="style",t.TITLE="title",t.FRAGMENT="Symbol(react.fragment)",t))(CEe||{}),ble={link:{rel:["amphtml","canonical","alternate"]},script:{type:["application/ld+json"]},meta:{charset:"",name:["generator","robots","description"],property:["og:type","og:title","og:url","og:image","og:image:alt","og:description","twitter:url","twitter:title","twitter:description","twitter:image","twitter:image:alt","twitter:card","twitter:site"]}},jwe=Object.values(CEe),ige={accesskey:"accessKey",charset:"charSet",class:"className",contenteditable:"contentEditable",contextmenu:"contextMenu","http-equiv":"httpEquiv",itemprop:"itemProp",tabindex:"tabIndex"},YJe=Object.entries(ige).reduce((t,[e,n])=>(t[n]=e,t),{}),im="data-rh",_S={DEFAULT_TITLE:"defaultTitle",DEFER:"defer",ENCODE_SPECIAL_CHARACTERS:"encodeSpecialCharacters",ON_CHANGE_CLIENT_STATE:"onChangeClientState",TITLE_TEMPLATE:"titleTemplate",PRIORITIZE_SEO_TAGS:"prioritizeSeoTags"},bS=(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},XJe=t=>{let e=bS(t,"title");const n=bS(t,_S.TITLE_TEMPLATE);if(Array.isArray(e)&&(e=e.join("")),n&&e)return n.replace(/%s/g,()=>e);const s=bS(t,_S.DEFAULT_TITLE);return e||s||void 0},QJe=t=>bS(t,_S.ON_CHANGE_CLIENT_STATE)||(()=>{}),wle=(t,e)=>e.filter(n=>typeof n[t]<"u").map(n=>n[t]).reduce((n,s)=>({...n,...s}),{}),JJe=(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),TM=(t,e,n)=>{const s={};return n.filter(a=>Array.isArray(a[t])?!0:(typeof a[t]<"u"&&eet(`Helmet: ${t} should be of type "Array". Instead found type "${typeof a[t]}"`),!1)).map(a=>a[t]).reverse().reduce((a,o)=>{const l={};o.filter(h=>{let p;const x=Object.keys(h);for(let b=0;ba.push(h));const i=Object.keys(l);for(let h=0;h{if(Array.isArray(t)&&t.length){for(let n=0;n({baseTag:JJe(["href"],t),bodyAttributes:wle("bodyAttributes",t),defer:bS(t,_S.DEFER),encode:bS(t,_S.ENCODE_SPECIAL_CHARACTERS),htmlAttributes:wle("htmlAttributes",t),linkTags:TM("link",["rel","href"],t),metaTags:TM("meta",["name","charset","http-equiv","property","itemprop"],t),noscriptTags:TM("noscript",["innerHTML"],t),onChangeClientState:QJe(t),scriptTags:TM("script",["src","innerHTML"],t),styleTags:TM("style",["cssText"],t),title:XJe(t),titleAttributes:wle("titleAttributes",t),prioritizeSeoTags:tet(t,_S.PRIORITIZE_SEO_TAGS)}),MEe=t=>Array.isArray(t)?t.join(""):t,net=(t,e)=>{const n=Object.keys(t);for(let s=0;sArray.isArray(t)?t.reduce((n,s)=>(net(s,e)?n.priority.push(s):n.default.push(s),n),{priority:[],default:[]}):{default:t,priority:[]},kwe=(t,e)=>({...t,[e]:void 0}),set=["noscript","script","style"],Lue=(t,e=!0)=>e===!1?String(t):String(t).replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'"),TEe=t=>Object.keys(t).reduce((e,n)=>{const s=typeof t[n]<"u"?`${n}="${t[n]}"`:`${n}`;return e?`${e} ${s}`:s},""),aet=(t,e,n,s)=>{const a=TEe(n),o=MEe(e);return a?`<${t} ${im}="true" ${a}>${Lue(o,s)}`:`<${t} ${im}="true">${Lue(o,s)}`},iet=(t,e,n=!0)=>e.reduce((s,a)=>{const o=a,l=Object.keys(o).filter(p=>!(p==="innerHTML"||p==="cssText")).reduce((p,x)=>{const y=typeof o[x]>"u"?x:`${x}="${Lue(o[x],n)}"`;return p?`${p} ${y}`:y},""),i=o.innerHTML||o.cssText||"",h=set.indexOf(t)===-1;return`${s}<${t} ${im}="true" ${l}${h?"/>":`>${i}`}`},""),AEe=(t,e={})=>Object.keys(t).reduce((n,s)=>{const a=ige[s];return n[a||s]=t[s],n},e),oet=(t,e,n)=>{const s={key:e,[im]:!0},a=AEe(n,s);return[st.createElement("title",a,e)]},tee=(t,e)=>e.map((n,s)=>{const a={key:s,[im]:!0};return Object.keys(n).forEach(o=>{const i=ige[o]||o;if(i==="innerHTML"||i==="cssText"){const h=n.innerHTML||n.cssText;a.dangerouslySetInnerHTML={__html:h}}else a[i]=n[o]}),st.createElement(t,a)}),Lf=(t,e,n=!0)=>{switch(t){case"title":return{toComponent:()=>oet(t,e.title,e.titleAttributes),toString:()=>aet(t,e.title,e.titleAttributes,n)};case"bodyAttributes":case"htmlAttributes":return{toComponent:()=>AEe(e),toString:()=>TEe(e)};default:return{toComponent:()=>tee(t,e),toString:()=>iet(t,e,n)}}},cet=({metaTags:t,linkTags:e,scriptTags:n,encode:s})=>{const a=jle(t,ble.meta),o=jle(e,ble.link),l=jle(n,ble.script);return{priorityMethods:{toComponent:()=>[...tee("meta",a.priority),...tee("link",o.priority),...tee("script",l.priority)],toString:()=>`${Lf("meta",a.priority,s)} ${Lf("link",o.priority,s)} ${Lf("script",l.priority,s)}`},metaTags:a.default,linkTags:o.default,scriptTags:l.default}},det=t=>{const{baseTag:e,bodyAttributes:n,encode:s=!0,htmlAttributes:a,noscriptTags:o,styleTags:l,title:i="",titleAttributes:h,prioritizeSeoTags:p}=t;let{linkTags:x,metaTags:y,scriptTags:b}=t,j={toComponent:()=>{},toString:()=>""};return p&&({priorityMethods:j,linkTags:x,metaTags:y,scriptTags:b}=cet(t)),{priority:j,base:Lf("base",e,s),bodyAttributes:Lf("bodyAttributes",n,s),htmlAttributes:Lf("htmlAttributes",a,s),link:Lf("link",x,s),meta:Lf("meta",y,s),noscript:Lf("noscript",o,s),script:Lf("script",b,s),style:Lf("style",l,s),title:Lf("title",{title:i,titleAttributes:h},s)}},Oue=det,oL=[],EEe=!!(typeof window<"u"&&window.document&&window.document.createElement),Due=class{constructor(t,e){Gn(this,"instances",[]);Gn(this,"canUseDOM",EEe);Gn(this,"context");Gn(this,"value",{setHelmet:t=>{this.context.helmet=t},helmetInstances:{get:()=>this.canUseDOM?oL:this.instances,add:t=>{(this.canUseDOM?oL:this.instances).push(t)},remove:t=>{const e=(this.canUseDOM?oL:this.instances).indexOf(t);(this.canUseDOM?oL:this.instances).splice(e,1)}}});this.context=t,this.canUseDOM=e||!1,e||(t.helmet=Oue({baseTag:[],bodyAttributes:{},htmlAttributes:{},linkTags:[],metaTags:[],noscriptTags:[],scriptTags:[],styleTags:[],title:"",titleAttributes:{}}))}},uet={},IEe=st.createContext(uet),sj,PEe=(sj=class extends I.Component{constructor(n){super(n);Gn(this,"helmetData");this.helmetData=new Due(this.props.context||{},sj.canUseDOM)}render(){return st.createElement(IEe.Provider,{value:this.helmetData.value},this.props.children)}},Gn(sj,"canUseDOM",EEe),sj),ZN=(t,e)=>{const n=document.head||document.querySelector("head"),s=n.querySelectorAll(`${t}[${im}]`),a=[].slice.call(s),o=[];let l;return e&&e.length&&e.forEach(i=>{const h=document.createElement(t);for(const p in i)if(Object.prototype.hasOwnProperty.call(i,p))if(p==="innerHTML")h.innerHTML=i.innerHTML;else if(p==="cssText")h.styleSheet?h.styleSheet.cssText=i.cssText:h.appendChild(document.createTextNode(i.cssText));else{const x=p,y=typeof i[x]>"u"?"":i[x];h.setAttribute(p,y)}h.setAttribute(im,"true"),a.some((p,x)=>(l=x,h.isEqualNode(p)))?a.splice(l,1):o.push(h)}),a.forEach(i=>{var h;return(h=i.parentNode)==null?void 0:h.removeChild(i)}),o.forEach(i=>n.appendChild(i)),{oldTags:a,newTags:o}},Rue=(t,e)=>{const n=document.getElementsByTagName(t)[0];if(!n)return;const s=n.getAttribute(im),a=s?s.split(","):[],o=[...a],l=Object.keys(e);for(const i of l){const h=e[i]||"";n.getAttribute(i)!==h&&n.setAttribute(i,h),a.indexOf(i)===-1&&a.push(i);const p=o.indexOf(i);p!==-1&&o.splice(p,1)}for(let i=o.length-1;i>=0;i-=1)n.removeAttribute(o[i]);a.length===o.length?n.removeAttribute(im):n.getAttribute(im)!==l.join(",")&&n.setAttribute(im,l.join(","))},het=(t,e)=>{typeof t<"u"&&document.title!==t&&(document.title=MEe(t)),Rue("title",e)},Nwe=(t,e)=>{const{baseTag:n,bodyAttributes:s,htmlAttributes:a,linkTags:o,metaTags:l,noscriptTags:i,onChangeClientState:h,scriptTags:p,styleTags:x,title:y,titleAttributes:b}=t;Rue("body",s),Rue("html",a),het(y,b);const j={baseTag:ZN("base",n),linkTags:ZN("link",o),metaTags:ZN("meta",l),noscriptTags:ZN("noscript",i),scriptTags:ZN("script",p),styleTags:ZN("style",x)},C={},N={};Object.keys(j).forEach(A=>{const{newTags:E,oldTags:T}=j[A];E.length&&(C[A]=E),T.length&&(N[A]=j[A].oldTags)}),e&&e(),h(t,C,N)},AM=null,fet=t=>{AM&&cancelAnimationFrame(AM),t.defer?AM=requestAnimationFrame(()=>{Nwe(t,()=>{AM=null})}):(Nwe(t),AM=null)},pet=fet,Swe=class extends I.Component{constructor(){super(...arguments);Gn(this,"rendered",!1)}shouldComponentUpdate(e){return!ZJe(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=ret(e.get().map(o=>{const l={...o.props};return delete l.context,l}));PEe.canUseDOM?pet(a):Oue&&(s=Oue(a)),n(s)}init(){if(this.rendered)return;this.rendered=!0;const{helmetInstances:e}=this.props.context;e.add(this),this.emitChange()}render(){return this.init(),null}},hde,km=(hde=class extends I.Component{shouldComponentUpdate(t){return!HJe(kwe(this.props,"helmetData"),kwe(t,"helmetData"))}mapNestedChildrenToProps(t,e){if(!e)return null;switch(t.type){case"script":case"noscript":return{innerHTML:e};case"style":return{cssText:e};default:throw new Error(`<${t.type} /> elements are self-closing and can not contain children. Refer to our API for more information.`)}}flattenArrayTypeChildren(t,e,n,s){return{...e,[t.type]:[...e[t.type]||[],{...n,...this.mapNestedChildrenToProps(t,s)}]}}mapObjectTypeChildren(t,e,n,s){switch(t.type){case"title":return{...e,[t.type]:s,titleAttributes:{...n}};case"body":return{...e,bodyAttributes:{...n}};case"html":return{...e,htmlAttributes:{...n}};default:return{...e,[t.type]:{...n}}}}mapArrayTypeChildrenToProps(t,e){let n={...e};return Object.keys(t).forEach(s=>{n={...n,[s]:t[s]}}),n}warnOnInvalidChildren(t,e){return wwe(jwe.some(n=>t.type===n),typeof t.type=="function"?"You may be attempting to nest components within each other, which is not allowed. Refer to our API for more information.":`Only elements types ${jwe.join(", ")} are allowed. Helmet does not support rendering <${t.type}> elements. Refer to our API for more information.`),wwe(!e||typeof e=="string"||Array.isArray(e)&&!e.some(n=>typeof n!="string"),`Helmet expects a string as a child of <${t.type}>. Did you forget to wrap your children in braces? ( <${t.type}>{\`\`} ) Refer to our API for more information.`),!0}mapChildrenToProps(t,e){let n={};return st.Children.forEach(t,s=>{if(!s||!s.props)return;const{children:a,...o}=s.props,l=Object.keys(o).reduce((h,p)=>(h[YJe[p]||p]=o[p],h),{});let{type:i}=s;switch(typeof i=="symbol"?i=i.toString():this.warnOnInvalidChildren(s,a),i){case"Symbol(react.fragment)":e=this.mapChildrenToProps(a,e);break;case"link":case"meta":case"noscript":case"script":case"style":n=this.flattenArrayTypeChildren(s,n,l,a);break;default:e=this.mapObjectTypeChildren(s,e,l,a);break}}),this.mapArrayTypeChildrenToProps(n,e)}render(){const{children:t,...e}=this.props;let n={...e},{helmetData:s}=e;if(t&&(n=this.mapChildrenToProps(t,n)),s&&!(s instanceof Due)){const a=s;s=new Due(a.context,!0),delete n.helmetData}return s?st.createElement(Swe,{...n,context:s.value}):st.createElement(IEe.Consumer,null,a=>st.createElement(Swe,{...n,context:a}))}},Gn(hde,"defaultProps",{defer:!0,encodeSpecialCharacters:!0,prioritizeSeoTags:!1}),hde),Fue=function(t,e){return Fue=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,s){n.__proto__=s}||function(n,s){for(var a in s)Object.prototype.hasOwnProperty.call(s,a)&&(n[a]=s[a])},Fue(t,e)};function LEe(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");Fue(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}var $f=function(){return $f=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 DEe(t,e){return function(n,s){e(n,s,t)}}function REe(t,e,n,s,a,o){function l(E){if(E!==void 0&&typeof E!="function")throw new TypeError("Function expected");return E}for(var i=s.kind,h=i==="getter"?"get":i==="setter"?"set":"value",p=!e&&t?s.static?t:t.prototype:null,x=e||(p?Object.getOwnPropertyDescriptor(p,s.name):{}),y,b=!1,j=n.length-1;j>=0;j--){var C={};for(var N in s)C[N]=N==="access"?{}:s[N];for(var N in s.access)C.access[N]=s.access[N];C.addInitializer=function(E){if(b)throw new TypeError("Cannot add initializers after decoration has completed");o.push(l(E||null))};var A=(0,n[j])(i==="accessor"?{get:x.get,set:x.set}:x[h],C);if(i==="accessor"){if(A===void 0)continue;if(A===null||typeof A!="object")throw new TypeError("Object expected");(y=l(A.get))&&(x.get=y),(y=l(A.set))&&(x.set=y),(y=l(A.init))&&a.unshift(y)}else(y=l(A))&&(i==="field"?a.unshift(y):x[h]=y)}p&&Object.defineProperty(p,s.name,x),b=!0}function FEe(t,e,n){for(var s=arguments.length>2,a=0;a0&&o[o.length-1])&&(p[0]===6||p[0]===2)){n=0;continue}if(p[0]===3&&(!o||p[1]>o[0]&&p[1]=t.length&&(t=void 0),{value:t&&t[s++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function oge(t,e){var n=typeof Symbol=="function"&&t[Symbol.iterator];if(!n)return t;var s=n.call(t),a,o=[],l;try{for(;(e===void 0||e-- >0)&&!(a=s.next()).done;)o.push(a.value)}catch(i){l={error:i}}finally{try{a&&!a.done&&(n=s.return)&&n.call(s)}finally{if(l)throw l.error}}return o}function VEe(){for(var t=[],e=0;e1||h(j,N)})},C&&(a[j]=C(a[j])))}function h(j,C){try{p(s[j](C))}catch(N){b(o[0][3],N)}}function p(j){j.value instanceof sC?Promise.resolve(j.value.v).then(x,y):b(o[0][2],j)}function x(j){h("next",j)}function y(j){h("throw",j)}function b(j,C){j(C),o.shift(),o.length&&h(o[0][0],o[0][1])}}function GEe(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:sC(t[a](l)),done:!1}:o?o(l):l}:o}}function KEe(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 Gee=="function"?Gee(t):t[Symbol.iterator](),n={},s("next"),s("throw"),s("return"),n[Symbol.asyncIterator]=function(){return this},n);function s(o){n[o]=t[o]&&function(l){return new Promise(function(i,h){l=t[o](l),a(i,h,l.done,l.value)})}}function a(o,l,i,h){Promise.resolve(h).then(function(p){o({value:p,done:i})},l)}}function ZEe(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}var met=Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e},zue=function(t){return zue=Object.getOwnPropertyNames||function(e){var n=[];for(var s in e)Object.prototype.hasOwnProperty.call(e,s)&&(n[n.length]=s);return n},zue(t)};function YEe(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var n=zue(t),s=0;s0){document.getElementsByTagName("link");const l=document.querySelector("meta[property=csp-nonce]"),i=(l==null?void 0:l.nonce)||(l==null?void 0:l.getAttribute("nonce"));a=Promise.allSettled(n.map(h=>{if(h=_et(h),h in Cwe)return;Cwe[h]=!0;const p=h.endsWith(".css"),x=p?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${h}"]${x}`))return;const y=document.createElement("link");if(y.rel=p?"stylesheet":vet,p||(y.as="script"),y.crossOrigin="",y.href=h,i&&y.setAttribute("nonce",i),document.head.appendChild(y),p)return new Promise((b,j)=>{y.addEventListener("load",b),y.addEventListener("error",()=>j(new Error(`Unable to preload CSS for ${h}`)))})}))}function o(l){const i=new Event("vite:preloadError",{cancelable:!0});if(i.payload=l,window.dispatchEvent(i),!i.defaultPrevented)throw l}return a.then(l=>{for(const i of l||[])i.status==="rejected"&&o(i.reason);return e().catch(o)})},bet=t=>{let e;return t?e=t:typeof fetch>"u"?e=(...n)=>r3(async()=>{const{default:s}=await Promise.resolve().then(()=>ak);return{default:s}},void 0).then(({default:s})=>s(...n)):e=fetch,(...n)=>e(...n)};class cge extends Error{constructor(e,n="FunctionsError",s){super(e),this.name=n,this.context=s}}class Mwe extends cge{constructor(e){super("Failed to send a request to the Edge Function","FunctionsFetchError",e)}}class Twe extends cge{constructor(e){super("Relay Error invoking the Edge Function","FunctionsRelayError",e)}}class Awe extends cge{constructor(e){super("Edge Function returned a non-2xx status code","FunctionsHttpError",e)}}var Bue;(function(t){t.Any="any",t.ApNortheast1="ap-northeast-1",t.ApNortheast2="ap-northeast-2",t.ApSouth1="ap-south-1",t.ApSoutheast1="ap-southeast-1",t.ApSoutheast2="ap-southeast-2",t.CaCentral1="ca-central-1",t.EuCentral1="eu-central-1",t.EuWest1="eu-west-1",t.EuWest2="eu-west-2",t.EuWest3="eu-west-3",t.SaEast1="sa-east-1",t.UsEast1="us-east-1",t.UsWest1="us-west-1",t.UsWest2="us-west-2"})(Bue||(Bue={}));class wet{constructor(e,{headers:n={},customFetch:s,region:a=Bue.Any}={}){this.url=e,this.headers=n,this.region=a,this.fetch=bet(s)}setAuth(e){this.headers.Authorization=`Bearer ${e}`}invoke(e){return Is(this,arguments,void 0,function*(n,s={}){var a;try{const{headers:o,method:l,body:i,signal:h}=s;let p={},{region:x}=s;x||(x=this.region);const y=new URL(`${this.url}/${n}`);x&&x!=="any"&&(p["x-region"]=x,y.searchParams.set("forceFunctionRegion",x));let b;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",b=i):typeof i=="string"?(p["Content-Type"]="text/plain",b=i):typeof FormData<"u"&&i instanceof FormData?b=i:(p["Content-Type"]="application/json",b=JSON.stringify(i)):b=i;const j=yield this.fetch(y.toString(),{method:l||"POST",headers:Object.assign(Object.assign(Object.assign({},p),this.headers),o),body:b,signal:h}).catch(E=>{throw E.name==="AbortError"?E:new Mwe(E)}),C=j.headers.get("x-relay-error");if(C&&C==="true")throw new Twe(j);if(!j.ok)throw new Awe(j);let N=((a=j.headers.get("Content-Type"))!==null&&a!==void 0?a:"text/plain").split(";")[0].trim(),A;return N==="application/json"?A=yield j.json():N==="application/octet-stream"||N==="application/pdf"?A=yield j.blob():N==="text/event-stream"?A=j:N==="multipart/form-data"?A=yield j.formData():A=yield j.text(),{data:A,error:null,response:j}}catch(o){return o instanceof Error&&o.name==="AbortError"?{data:null,error:new Mwe(o)}:{data:null,error:o,response:o instanceof Awe||o instanceof Twe?o.context:void 0}}})}}var dh={};const n3=C5e(yet);var lL={},cL={},dL={},uL={},hL={},jet=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")},aC=jet();const ket=aC.fetch,sIe=aC.fetch.bind(aC),aIe=aC.Headers,Net=aC.Request,Cet=aC.Response,ak=Object.freeze(Object.defineProperty({__proto__:null,Headers:aIe,Request:Net,Response:Cet,default:sIe,fetch:ket},Symbol.toStringTag,{value:"Module"})),Met=C5e(ak);var fL={},Ewe;function iIe(){if(Ewe)return fL;Ewe=1,Object.defineProperty(fL,"__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 fL.default=t,fL}var Iwe;function oIe(){if(Iwe)return hL;Iwe=1,Object.defineProperty(hL,"__esModule",{value:!0});const t=n3,e=t.__importDefault(Met),n=t.__importDefault(iIe());class s{constructor(o){var l,i;this.shouldThrowOnError=!1,this.method=o.method,this.url=o.url,this.headers=new Headers(o.headers),this.schema=o.schema,this.body=o.body,this.shouldThrowOnError=(l=o.shouldThrowOnError)!==null&&l!==void 0?l:!1,this.signal=o.signal,this.isMaybeSingle=(i=o.isMaybeSingle)!==null&&i!==void 0?i:!1,o.fetch?this.fetch=o.fetch:typeof fetch>"u"?this.fetch=e.default:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(o,l){return this.headers=new Headers(this.headers),this.headers.set(o,l),this}then(o,l){this.schema===void 0||(["GET","HEAD"].includes(this.method)?this.headers.set("Accept-Profile",this.schema):this.headers.set("Content-Profile",this.schema)),this.method!=="GET"&&this.method!=="HEAD"&&this.headers.set("Content-Type","application/json");const i=this.fetch;let h=i(this.url.toString(),{method:this.method,headers:this.headers,body:JSON.stringify(this.body),signal:this.signal}).then(async p=>{var x,y,b,j;let C=null,N=null,A=null,E=p.status,T=p.statusText;if(p.ok){if(this.method!=="HEAD"){const q=await p.text();q===""||(this.headers.get("Accept")==="text/csv"||this.headers.get("Accept")&&(!((x=this.headers.get("Accept"))===null||x===void 0)&&x.includes("application/vnd.pgrst.plan+text"))?N=q:N=JSON.parse(q))}const z=(y=this.headers.get("Prefer"))===null||y===void 0?void 0:y.match(/count=(exact|planned|estimated)/),F=(b=p.headers.get("content-range"))===null||b===void 0?void 0:b.split("/");z&&F&&F.length>1&&(A=parseInt(F[1])),this.isMaybeSingle&&this.method==="GET"&&Array.isArray(N)&&(N.length>1?(C={code:"PGRST116",details:`Results contain ${N.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},N=null,A=null,E=406,T="Not Acceptable"):N.length===1?N=N[0]:N=null)}else{const z=await p.text();try{C=JSON.parse(z),Array.isArray(C)&&p.status===404&&(N=[],C=null,E=200,T="OK")}catch{p.status===404&&z===""?(E=204,T="No Content"):C={message:z}}if(C&&this.isMaybeSingle&&(!((j=C==null?void 0:C.details)===null||j===void 0)&&j.includes("0 rows"))&&(C=null,E=200,T="OK"),C&&this.shouldThrowOnError)throw new n.default(C)}return{error:C,data:N,count:A,status:E,statusText:T}});return this.shouldThrowOnError||(h=h.catch(p=>{var x,y,b;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:`${(b=p==null?void 0:p.code)!==null&&b!==void 0?b:""}`},data:null,count:null,status:0,statusText:""}})),h.then(o,l)}returns(){return this}overrideTypes(){return this}}return hL.default=s,hL}var Pwe;function lIe(){if(Pwe)return uL;Pwe=1,Object.defineProperty(uL,"__esModule",{value:!0});const e=n3.__importDefault(oIe());class n extends e.default{select(a){let o=!1;const l=(a??"*").split("").map(i=>/\s/.test(i)&&!o?"":(i==='"'&&(o=!o),i)).join("");return this.url.searchParams.set("select",l),this.headers.append("Prefer","return=representation"),this}order(a,{ascending:o=!0,nullsFirst:l,foreignTable:i,referencedTable:h=i}={}){const p=h?`${h}.order`:"order",x=this.url.searchParams.get(p);return this.url.searchParams.set(p,`${x?`${x},`:""}${a}.${o?"asc":"desc"}${l===void 0?"":l?".nullsfirst":".nullslast"}`),this}limit(a,{foreignTable:o,referencedTable:l=o}={}){const i=typeof l>"u"?"limit":`${l}.limit`;return this.url.searchParams.set(i,`${a}`),this}range(a,o,{foreignTable:l,referencedTable:i=l}={}){const h=typeof i>"u"?"offset":`${i}.offset`,p=typeof i>"u"?"limit":`${i}.limit`;return this.url.searchParams.set(h,`${a}`),this.url.searchParams.set(p,`${o-a+1}`),this}abortSignal(a){return this.signal=a,this}single(){return this.headers.set("Accept","application/vnd.pgrst.object+json"),this}maybeSingle(){return this.method==="GET"?this.headers.set("Accept","application/json"):this.headers.set("Accept","application/vnd.pgrst.object+json"),this.isMaybeSingle=!0,this}csv(){return this.headers.set("Accept","text/csv"),this}geojson(){return this.headers.set("Accept","application/geo+json"),this}explain({analyze:a=!1,verbose:o=!1,settings:l=!1,buffers:i=!1,wal:h=!1,format:p="text"}={}){var x;const y=[a?"analyze":null,o?"verbose":null,l?"settings":null,i?"buffers":null,h?"wal":null].filter(Boolean).join("|"),b=(x=this.headers.get("Accept"))!==null&&x!==void 0?x:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${p}; for="${b}"; 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 uL.default=n,uL}var Lwe;function dge(){if(Lwe)return dL;Lwe=1,Object.defineProperty(dL,"__esModule",{value:!0});const e=n3.__importDefault(lIe()),n=new RegExp("[,()]");class s extends e.default{eq(o,l){return this.url.searchParams.append(o,`eq.${l}`),this}neq(o,l){return this.url.searchParams.append(o,`neq.${l}`),this}gt(o,l){return this.url.searchParams.append(o,`gt.${l}`),this}gte(o,l){return this.url.searchParams.append(o,`gte.${l}`),this}lt(o,l){return this.url.searchParams.append(o,`lt.${l}`),this}lte(o,l){return this.url.searchParams.append(o,`lte.${l}`),this}like(o,l){return this.url.searchParams.append(o,`like.${l}`),this}likeAllOf(o,l){return this.url.searchParams.append(o,`like(all).{${l.join(",")}}`),this}likeAnyOf(o,l){return this.url.searchParams.append(o,`like(any).{${l.join(",")}}`),this}ilike(o,l){return this.url.searchParams.append(o,`ilike.${l}`),this}ilikeAllOf(o,l){return this.url.searchParams.append(o,`ilike(all).{${l.join(",")}}`),this}ilikeAnyOf(o,l){return this.url.searchParams.append(o,`ilike(any).{${l.join(",")}}`),this}is(o,l){return this.url.searchParams.append(o,`is.${l}`),this}in(o,l){const i=Array.from(new Set(l)).map(h=>typeof h=="string"&&n.test(h)?`"${h}"`:`${h}`).join(",");return this.url.searchParams.append(o,`in.(${i})`),this}contains(o,l){return typeof l=="string"?this.url.searchParams.append(o,`cs.${l}`):Array.isArray(l)?this.url.searchParams.append(o,`cs.{${l.join(",")}}`):this.url.searchParams.append(o,`cs.${JSON.stringify(l)}`),this}containedBy(o,l){return typeof l=="string"?this.url.searchParams.append(o,`cd.${l}`):Array.isArray(l)?this.url.searchParams.append(o,`cd.{${l.join(",")}}`):this.url.searchParams.append(o,`cd.${JSON.stringify(l)}`),this}rangeGt(o,l){return this.url.searchParams.append(o,`sr.${l}`),this}rangeGte(o,l){return this.url.searchParams.append(o,`nxl.${l}`),this}rangeLt(o,l){return this.url.searchParams.append(o,`sl.${l}`),this}rangeLte(o,l){return this.url.searchParams.append(o,`nxr.${l}`),this}rangeAdjacent(o,l){return this.url.searchParams.append(o,`adj.${l}`),this}overlaps(o,l){return typeof l=="string"?this.url.searchParams.append(o,`ov.${l}`):this.url.searchParams.append(o,`ov.{${l.join(",")}}`),this}textSearch(o,l,{config:i,type:h}={}){let p="";h==="plain"?p="pl":h==="phrase"?p="ph":h==="websearch"&&(p="w");const x=i===void 0?"":`(${i})`;return this.url.searchParams.append(o,`${p}fts${x}.${l}`),this}match(o){return Object.entries(o).forEach(([l,i])=>{this.url.searchParams.append(l,`eq.${i}`)}),this}not(o,l,i){return this.url.searchParams.append(o,`not.${l}.${i}`),this}or(o,{foreignTable:l,referencedTable:i=l}={}){const h=i?`${i}.or`:"or";return this.url.searchParams.append(h,`(${o})`),this}filter(o,l,i){return this.url.searchParams.append(o,`${l}.${i}`),this}}return dL.default=s,dL}var Owe;function cIe(){if(Owe)return cL;Owe=1,Object.defineProperty(cL,"__esModule",{value:!0});const e=n3.__importDefault(dge());class n{constructor(a,{headers:o={},schema:l,fetch:i}){this.url=a,this.headers=new Headers(o),this.schema=l,this.fetch=i}select(a,o){const{head:l=!1,count:i}=o??{},h=l?"HEAD":"GET";let p=!1;const x=(a??"*").split("").map(y=>/\s/.test(y)&&!p?"":(y==='"'&&(p=!p),y)).join("");return this.url.searchParams.set("select",x),i&&this.headers.append("Prefer",`count=${i}`),new e.default({method:h,url:this.url,headers:this.headers,schema:this.schema,fetch:this.fetch})}insert(a,{count:o,defaultToNull:l=!0}={}){var i;const h="POST";if(o&&this.headers.append("Prefer",`count=${o}`),l||this.headers.append("Prefer","missing=default"),Array.isArray(a)){const p=a.reduce((x,y)=>x.concat(Object.keys(y)),[]);if(p.length>0){const x=[...new Set(p)].map(y=>`"${y}"`);this.url.searchParams.set("columns",x.join(","))}}return new e.default({method:h,url:this.url,headers:this.headers,schema:this.schema,body:a,fetch:(i=this.fetch)!==null&&i!==void 0?i:fetch})}upsert(a,{onConflict:o,ignoreDuplicates:l=!1,count:i,defaultToNull:h=!0}={}){var p;const x="POST";if(this.headers.append("Prefer",`resolution=${l?"ignore":"merge"}-duplicates`),o!==void 0&&this.url.searchParams.set("on_conflict",o),i&&this.headers.append("Prefer",`count=${i}`),h||this.headers.append("Prefer","missing=default"),Array.isArray(a)){const y=a.reduce((b,j)=>b.concat(Object.keys(j)),[]);if(y.length>0){const b=[...new Set(y)].map(j=>`"${j}"`);this.url.searchParams.set("columns",b.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 cL.default=n,cL}var Dwe;function Tet(){if(Dwe)return lL;Dwe=1,Object.defineProperty(lL,"__esModule",{value:!0});const t=n3,e=t.__importDefault(cIe()),n=t.__importDefault(dge());class s{constructor(o,{headers:l={},schema:i,fetch:h}={}){this.url=o,this.headers=new Headers(l),this.schemaName=i,this.fetch=h}from(o){const l=new URL(`${this.url}/${o}`);return new e.default(l,{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch})}schema(o){return new s(this.url,{headers:this.headers,schema:o,fetch:this.fetch})}rpc(o,l={},{head:i=!1,get:h=!1,count:p}={}){var x;let y;const b=new URL(`${this.url}/rpc/${o}`);let j;i||h?(y=i?"HEAD":"GET",Object.entries(l).filter(([N,A])=>A!==void 0).map(([N,A])=>[N,Array.isArray(A)?`{${A.join(",")}}`:`${A}`]).forEach(([N,A])=>{b.searchParams.append(N,A)})):(y="POST",j=l);const C=new Headers(this.headers);return p&&C.set("Prefer",`count=${p}`),new n.default({method:y,url:b,headers:C,schema:this.schemaName,body:j,fetch:(x=this.fetch)!==null&&x!==void 0?x:fetch})}}return lL.default=s,lL}Object.defineProperty(dh,"__esModule",{value:!0});var dIe=dh.PostgrestError=_Ie=dh.PostgrestBuilder=yIe=dh.PostgrestTransformBuilder=gIe=dh.PostgrestFilterBuilder=pIe=dh.PostgrestQueryBuilder=hIe=dh.PostgrestClient=void 0;const s3=n3,uIe=s3.__importDefault(Tet());var hIe=dh.PostgrestClient=uIe.default;const fIe=s3.__importDefault(cIe());var pIe=dh.PostgrestQueryBuilder=fIe.default;const mIe=s3.__importDefault(dge());var gIe=dh.PostgrestFilterBuilder=mIe.default;const xIe=s3.__importDefault(lIe());var yIe=dh.PostgrestTransformBuilder=xIe.default;const vIe=s3.__importDefault(oIe());var _Ie=dh.PostgrestBuilder=vIe.default;const bIe=s3.__importDefault(iIe());dIe=dh.PostgrestError=bIe.default;var wIe=dh.default={PostgrestClient:uIe.default,PostgrestQueryBuilder:fIe.default,PostgrestFilterBuilder:mIe.default,PostgrestTransformBuilder:xIe.default,PostgrestBuilder:vIe.default,PostgrestError:bIe.default};const Aet=Object.freeze(Object.defineProperty({__proto__:null,get PostgrestBuilder(){return _Ie},get PostgrestClient(){return hIe},get PostgrestError(){return dIe},get PostgrestFilterBuilder(){return gIe},get PostgrestQueryBuilder(){return pIe},get PostgrestTransformBuilder(){return yIe},default:wIe},Symbol.toStringTag,{value:"Module"})),{PostgrestClient:Eet,PostgrestQueryBuilder:SKt,PostgrestFilterBuilder:CKt,PostgrestTransformBuilder:MKt,PostgrestBuilder:TKt,PostgrestError:AKt}=wIe||Aet;class Iet{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 Pet="2.78.0",Let=`realtime-js/${Pet}`,Oet="1.0.0",$ue=1e4,Det=1e3,Ret=100;var rA;(function(t){t[t.connecting=0]="connecting",t[t.open=1]="open",t[t.closing=2]="closing",t[t.closed=3]="closed"})(rA||(rA={}));var zc;(function(t){t.closed="closed",t.errored="errored",t.joined="joined",t.joining="joining",t.leaving="leaving"})(zc||(zc={}));var Yp;(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"})(Yp||(Yp={}));var Uue;(function(t){t.websocket="websocket"})(Uue||(Uue={}));var Aw;(function(t){t.Connecting="connecting",t.Open="open",t.Closing="closing",t.Closed="closed"})(Aw||(Aw={}));class Fet{constructor(){this.HEADER_LENGTH=1}decode(e,n){return e.constructor===ArrayBuffer?n(this._binaryDecode(e)):n(typeof e=="string"?JSON.parse(e):{})}_binaryDecode(e){const n=new DataView(e),s=new TextDecoder;return this._decodeBroadcast(e,n,s)}_decodeBroadcast(e,n,s){const a=n.getUint8(1),o=n.getUint8(2);let l=this.HEADER_LENGTH+2;const i=s.decode(e.slice(l,l+a));l=l+a;const h=s.decode(e.slice(l,l+o));l=l+o;const p=JSON.parse(s.decode(e.slice(l,e.byteLength)));return{ref:null,topic:i,event:h,payload:p}}}class jIe{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 Go;(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"})(Go||(Go={}));const Rwe=(t,e,n={})=>{var s;const a=(s=n.skipTypes)!==null&&s!==void 0?s:[];return e?Object.keys(e).reduce((o,l)=>(o[l]=zet(l,t,e,a),o),{}):{}},zet=(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)?kIe(o,l):que(l)},kIe=(t,e)=>{if(t.charAt(0)==="_"){const n=t.slice(1,t.length);return qet(e,n)}switch(t){case Go.bool:return Bet(e);case Go.float4:case Go.float8:case Go.int2:case Go.int4:case Go.int8:case Go.numeric:case Go.oid:return $et(e);case Go.json:case Go.jsonb:return Uet(e);case Go.timestamp:return Vet(e);case Go.abstime:case Go.date:case Go.daterange:case Go.int4range:case Go.int8range:case Go.money:case Go.reltime:case Go.text:case Go.time:case Go.timestamptz:case Go.timetz:case Go.tsrange:case Go.tstzrange:return que(e);default:return que(e)}},que=t=>t,Bet=t=>{switch(t){case"t":return!0;case"f":return!1;default:return t}},$et=t=>{if(typeof t=="string"){const e=parseFloat(t);if(!Number.isNaN(e))return e}return t},Uet=t=>{if(typeof t=="string")try{return JSON.parse(t)}catch(e){return console.log(`JSON parse error: ${e}`),t}return t},qet=(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=>kIe(e,i))}return t},Vet=t=>typeof t=="string"?t.replace(" ","T"):t,NIe=t=>{const e=new URL(t);return e.protocol=e.protocol.replace(/^ws/i,"http"),e.pathname=e.pathname.replace(/\/+$/,"").replace(/\/socket\/websocket$/i,"").replace(/\/socket$/i,"").replace(/\/websocket$/i,""),e.pathname===""||e.pathname==="/"?e.pathname="/api/broadcast":e.pathname=e.pathname+"/api/broadcast",e.href};class kle{constructor(e,n,s={},a=$ue){this.channel=e,this.event=n,this.payload=s,this.timeout=a,this.sent=!1,this.timeoutTimer=void 0,this.ref="",this.receivedResp=null,this.recHooks=[],this.refEvent=null}resend(e){this.timeout=e,this._cancelRefEvent(),this.ref="",this.refEvent=null,this.receivedResp=null,this.sent=!1,this.send()}send(){this._hasReceived("timeout")||(this.startTimeout(),this.sent=!0,this.channel.socket.push({topic:this.channel.topic,event:this.event,payload:this.payload,ref:this.ref,join_ref:this.channel._joinRef()}))}updatePayload(e){this.payload=Object.assign(Object.assign({},this.payload),e)}receive(e,n){var s;return this._hasReceived(e)&&n((s=this.receivedResp)===null||s===void 0?void 0:s.response),this.recHooks.push({status:e,callback:n}),this}startTimeout(){if(this.timeoutTimer)return;this.ref=this.channel.socket._makeRef(),this.refEvent=this.channel._replyEventName(this.ref);const e=n=>{this._cancelRefEvent(),this._cancelTimeout(),this.receivedResp=n,this._matchReceive(n)};this.channel._on(this.refEvent,{},e),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}trigger(e,n){this.refEvent&&this.channel._trigger(this.refEvent,{status:e,response:n})}destroy(){this._cancelRefEvent(),this._cancelTimeout()}_cancelRefEvent(){this.refEvent&&this.channel._off(this.refEvent,{})}_cancelTimeout(){clearTimeout(this.timeoutTimer),this.timeoutTimer=void 0}_matchReceive({status:e,response:n}){this.recHooks.filter(s=>s.status===e).forEach(s=>s.callback(n))}_hasReceived(e){return this.receivedResp&&this.receivedResp.status===e}}var Fwe;(function(t){t.SYNC="sync",t.JOIN="join",t.LEAVE="leave"})(Fwe||(Fwe={}));class nA{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=nA.syncState(this.state,a,o,l),this.pendingDiffs.forEach(h=>{this.state=nA.syncDiff(this.state,h,o,l)}),this.pendingDiffs=[],i()}),this.channel._on(s.diff,{},a=>{const{onJoin:o,onLeave:l,onSync:i}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(a):(this.state=nA.syncDiff(this.state,a,o,l),i())}),this.onJoin((a,o,l)=>{this.channel._trigger("presence",{event:"join",key:a,currentPresences:o,newPresences:l})}),this.onLeave((a,o,l)=>{this.channel._trigger("presence",{event:"leave",key:a,currentPresences:o,leftPresences:l})}),this.onSync(()=>{this.channel._trigger("presence",{event:"sync"})})}static syncState(e,n,s,a){const o=this.cloneDeep(e),l=this.transformState(n),i={},h={};return this.map(o,(p,x)=>{l[p]||(h[p]=x)}),this.map(l,(p,x)=>{const y=o[p];if(y){const b=x.map(A=>A.presence_ref),j=y.map(A=>A.presence_ref),C=x.filter(A=>j.indexOf(A.presence_ref)<0),N=y.filter(A=>b.indexOf(A.presence_ref)<0);C.length>0&&(i[p]=C),N.length>0&&(h[p]=N)}else i[p]=x}),this.syncDiff(o,{joins:i,leaves:h},s,a)}static syncDiff(e,n,s,a){const{joins:o,leaves:l}={joins:this.transformState(n.joins),leaves:this.transformState(n.leaves)};return s||(s=()=>{}),a||(a=()=>{}),this.map(o,(i,h)=>{var p;const x=(p=e[i])!==null&&p!==void 0?p:[];if(e[i]=this.cloneDeep(h),x.length>0){const y=e[i].map(j=>j.presence_ref),b=x.filter(j=>y.indexOf(j.presence_ref)<0);e[i].unshift(...b)}s(i,x,h)}),this.map(l,(i,h)=>{let p=e[i];if(!p)return;const x=h.map(y=>y.presence_ref);p=p.filter(y=>x.indexOf(y.presence_ref)<0),e[i]=p,a(i,p,h),p.length===0&&delete e[i]}),e}static map(e,n){return Object.getOwnPropertyNames(e).map(s=>n(s,e[s]))}static transformState(e){return e=this.cloneDeep(e),Object.getOwnPropertyNames(e).reduce((n,s)=>{const a=e[s];return"metas"in a?n[s]=a.metas.map(o=>(o.presence_ref=o.phx_ref,delete o.phx_ref,delete o.phx_ref_prev,o)):n[s]=a,n},{})}static cloneDeep(e){return JSON.parse(JSON.stringify(e))}onJoin(e){this.caller.onJoin=e}onLeave(e){this.caller.onLeave=e}onSync(e){this.caller.onSync=e}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel._joinRef()}}var zwe;(function(t){t.ALL="*",t.INSERT="INSERT",t.UPDATE="UPDATE",t.DELETE="DELETE"})(zwe||(zwe={}));var sA;(function(t){t.BROADCAST="broadcast",t.PRESENCE="presence",t.POSTGRES_CHANGES="postgres_changes",t.SYSTEM="system"})(sA||(sA={}));var bx;(function(t){t.SUBSCRIBED="SUBSCRIBED",t.TIMED_OUT="TIMED_OUT",t.CLOSED="CLOSED",t.CHANNEL_ERROR="CHANNEL_ERROR"})(bx||(bx={}));class uge{constructor(e,n={config:{}},s){var a,o;if(this.topic=e,this.params=n,this.socket=s,this.bindings={},this.state=zc.closed,this.joinedOnce=!1,this.pushBuffer=[],this.subTopic=e.replace(/^realtime:/i,""),this.params.config=Object.assign({broadcast:{ack:!1,self:!1},presence:{key:"",enabled:!1},private:!1},n.config),this.timeout=this.socket.timeout,this.joinPush=new kle(this,Yp.join,this.params,this.timeout),this.rejoinTimer=new jIe(()=>this._rejoinUntilConnected(),this.socket.reconnectAfterMs),this.joinPush.receive("ok",()=>{this.state=zc.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=zc.closed,this.socket._remove(this)}),this._onError(l=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,l),this.state=zc.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("timeout",()=>{this._isJoining()&&(this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),this.state=zc.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("error",l=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,l),this.state=zc.errored,this.rejoinTimer.scheduleTimeout())}),this._on(Yp.reply,{},(l,i)=>{this._trigger(this._replyEventName(i),l)}),this.presence=new nA(this),this.broadcastEndpointURL=NIe(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==zc.closed){const{config:{broadcast:l,presence:i,private:h}}=this.params,p=(a=(s=this.bindings.postgres_changes)===null||s===void 0?void 0:s.map(j=>j.filter))!==null&&a!==void 0?a:[],x=!!this.bindings[sA.PRESENCE]&&this.bindings[sA.PRESENCE].length>0||((o=this.params.config.presence)===null||o===void 0?void 0:o.enabled)===!0,y={},b={broadcast:l,presence:Object.assign(Object.assign({},i),{enabled:x}),postgres_changes:p,private:h};this.socket.accessTokenValue&&(y.access_token=this.socket.accessTokenValue),this._onError(j=>e==null?void 0:e(bx.CHANNEL_ERROR,j)),this._onClose(()=>e==null?void 0:e(bx.CLOSED)),this.updateJoinPayload(Object.assign({config:b},y)),this.joinedOnce=!0,this._rejoin(n),this.joinPush.receive("ok",async({postgres_changes:j})=>{var C;if(this.socket.setAuth(),j===void 0){e==null||e(bx.SUBSCRIBED);return}else{const N=this.bindings.postgres_changes,A=(C=N==null?void 0:N.length)!==null&&C!==void 0?C:0,E=[];for(let T=0;T{this.state=zc.errored,e==null||e(bx.CHANNEL_ERROR,new Error(JSON.stringify(Object.values(j).join(", ")||"error")))}).receive("timeout",()=>{e==null||e(bx.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===zc.joined&&e===sA.PRESENCE&&(this.socket.log("channel",`resubscribe to ${this.topic} due to change in presence callbacks on joined channel`),this.unsubscribe().then(()=>this.subscribe())),this._on(e,n,s)}async httpSend(e,n,s={}){var a;const o=this.socket.accessTokenValue?`Bearer ${this.socket.accessTokenValue}`:"";if(n==null)return Promise.reject("Payload is required for httpSend()");const l={method:"POST",headers:{Authorization:o,apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"},body:JSON.stringify({messages:[{topic:this.subTopic,event:e,payload:n,private:this.private}]})},i=await this._fetchWithTimeout(this.broadcastEndpointURL,l,(a=s.timeout)!==null&&a!==void 0?a:this.timeout);if(i.status===202)return{success:!0};let h=i.statusText;try{const p=await i.json();h=p.error||p.message||h}catch{}return Promise.reject(new Error(h))}async send(e,n={}){var s,a;if(!this._canPush()&&e.type==="broadcast"){console.warn("Realtime send() is automatically falling back to REST API. This behavior will be deprecated in the future. Please use httpSend() explicitly for REST delivery.");const{event:o,payload:l}=e,h={method:"POST",headers:{Authorization:this.socket.accessTokenValue?`Bearer ${this.socket.accessTokenValue}`:"",apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"},body:JSON.stringify({messages:[{topic:this.subTopic,event:o,payload:l,private:this.private}]})};try{const p=await this._fetchWithTimeout(this.broadcastEndpointURL,h,(s=n.timeout)!==null&&s!==void 0?s:this.timeout);return await((a=p.body)===null||a===void 0?void 0:a.cancel()),p.ok?"ok":"error"}catch(p){return p.name==="AbortError"?"timed out":"error"}}else return new Promise(o=>{var l,i,h;const p=this._push(e.type,e,n.timeout||this.timeout);e.type==="broadcast"&&!(!((h=(i=(l=this.params)===null||l===void 0?void 0:l.config)===null||i===void 0?void 0:i.broadcast)===null||h===void 0)&&h.ack)&&o("ok"),p.receive("ok",()=>o("ok")),p.receive("error",()=>o("error")),p.receive("timeout",()=>o("timed out"))})}updateJoinPayload(e){this.joinPush.updatePayload(e)}unsubscribe(e=this.timeout){this.state=zc.leaving;const n=()=>{this.socket.log("channel",`leave ${this.topic}`),this._trigger(Yp.close,"leave",this._joinRef())};this.joinPush.destroy();let s=null;return new Promise(a=>{s=new kle(this,Yp.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=zc.closed,this.bindings={}}async _fetchWithTimeout(e,n,s){const a=new AbortController,o=setTimeout(()=>a.abort(),s),l=await this.socket.fetch(e,Object.assign(Object.assign({},n),{signal:a.signal}));return clearTimeout(o),l}_push(e,n,s=this.timeout){if(!this.joinedOnce)throw`tried to push '${e}' to '${this.topic}' before joining. Use channel.subscribe() before pushing events`;let a=new kle(this,e,n,s);return this._canPush()?a.send():this._addToPushBuffer(a),a}_addToPushBuffer(e){if(e.startTimeout(),this.pushBuffer.push(e),this.pushBuffer.length>Ret){const n=this.pushBuffer.shift();n&&(n.destroy(),this.socket.log("channel",`discarded push due to buffer overflow: ${n.event}`,n.payload))}}_onMessage(e,n,s){return n}_isMember(e){return this.topic===e}_joinRef(){return this.joinPush.ref}_trigger(e,n,s){var a,o;const l=e.toLocaleLowerCase(),{close:i,error:h,leave:p,join:x}=Yp;if(s&&[i,h,p,x].indexOf(l)>=0&&s!==this._joinRef())return;let b=this._onMessage(l,n,s);if(n&&!b)throw"channel onMessage callbacks must return the payload, modified or unmodified";["insert","update","delete"].includes(l)?(a=this.bindings.postgres_changes)===null||a===void 0||a.filter(j=>{var C,N,A;return((C=j.filter)===null||C===void 0?void 0:C.event)==="*"||((A=(N=j.filter)===null||N===void 0?void 0:N.event)===null||A===void 0?void 0:A.toLocaleLowerCase())===l}).map(j=>j.callback(b,s)):(o=this.bindings[l])===null||o===void 0||o.filter(j=>{var C,N,A,E,T,L;if(["broadcast","presence","postgres_changes"].includes(l))if("id"in j){const z=j.id,F=(C=j.filter)===null||C===void 0?void 0:C.event;return z&&((N=n.ids)===null||N===void 0?void 0:N.includes(z))&&(F==="*"||(F==null?void 0:F.toLocaleLowerCase())===((A=n.data)===null||A===void 0?void 0:A.type.toLocaleLowerCase()))}else{const z=(T=(E=j==null?void 0:j.filter)===null||E===void 0?void 0:E.event)===null||T===void 0?void 0:T.toLocaleLowerCase();return z==="*"||z===((L=n==null?void 0:n.event)===null||L===void 0?void 0:L.toLocaleLowerCase())}else return j.type.toLocaleLowerCase()===l}).map(j=>{if(typeof b=="object"&&"ids"in b){const C=b.data,{schema:N,table:A,commit_timestamp:E,type:T,errors:L}=C;b=Object.assign(Object.assign({},{schema:N,table:A,commit_timestamp:E,eventType:T,new:{},old:{},errors:L}),this._getPayloadRecords(C))}j.callback(b,s)})}_isClosed(){return this.state===zc.closed}_isJoined(){return this.state===zc.joined}_isJoining(){return this.state===zc.joining}_isLeaving(){return this.state===zc.leaving}_replyEventName(e){return`chan_reply_${e}`}_on(e,n,s){const a=e.toLocaleLowerCase(),o={type:a,filter:n,callback:s};return this.bindings[a]?this.bindings[a].push(o):this.bindings[a]=[o],this}_off(e,n){const s=e.toLocaleLowerCase();return this.bindings[s]&&(this.bindings[s]=this.bindings[s].filter(a=>{var o;return!(((o=a.type)===null||o===void 0?void 0:o.toLocaleLowerCase())===s&&uge.isEqual(a.filter,n))})),this}static isEqual(e,n){if(Object.keys(e).length!==Object.keys(n).length)return!1;for(const s in e)if(e[s]!==n[s])return!1;return!0}_rejoinUntilConnected(){this.rejoinTimer.scheduleTimeout(),this.socket.isConnected()&&this._rejoin()}_onClose(e){this._on(Yp.close,{},e)}_onError(e){this._on(Yp.error,{},n=>e(n))}_canPush(){return this.socket.isConnected()&&this._isJoined()}_rejoin(e=this.timeout){this._isLeaving()||(this.socket._leaveOpenTopic(this.topic),this.state=zc.joining,this.joinPush.resend(e))}_getPayloadRecords(e){const n={new:{},old:{}};return(e.type==="INSERT"||e.type==="UPDATE")&&(n.new=Rwe(e.columns,e.record)),(e.type==="UPDATE"||e.type==="DELETE")&&(n.old=Rwe(e.columns,e.old_record)),n}}const Nle=()=>{},pL={HEARTBEAT_INTERVAL:25e3,RECONNECT_DELAY:10,HEARTBEAT_TIMEOUT_FALLBACK:100},Het=[1e3,2e3,5e3,1e4],Wet=1e4,Get=` addEventListener("message", (e) => { if (e.data.event === "start") { setInterval(() => postMessage({ event: "keepAlive" }), e.data.interval); } });`;class Ket{constructor(e,n){var s;if(this.accessTokenValue=null,this.apiKey=null,this.channels=new Array,this.endPoint="",this.httpEndpoint="",this.headers={},this.params={},this.timeout=$ue,this.transport=null,this.heartbeatIntervalMs=pL.HEARTBEAT_INTERVAL,this.heartbeatTimer=void 0,this.pendingHeartbeatRef=null,this.heartbeatCallback=Nle,this.ref=0,this.reconnectTimer=null,this.logger=Nle,this.conn=null,this.sendBuffer=[],this.serializer=new Fet,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)=>r3(async()=>{const{default:i}=await Promise.resolve().then(()=>ak);return{default:i}},void 0).then(({default:i})=>i(...l)).catch(i=>{throw new Error(`Failed to load @supabase/node-fetch: ${i.message}. This is required for HTTP requests in Node.js environments without native fetch.`)}):o=fetch,(...l)=>o(...l)},!(!((s=n==null?void 0:n.params)===null||s===void 0)&&s.apikey))throw new Error("API key is required to connect to Realtime");this.apiKey=n.params.apikey,this.endPoint=`${e}/${Uue.websocket}`,this.httpEndpoint=NIe(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=Iet.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:Oet}))}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 rA.connecting:return Aw.Connecting;case rA.open:return Aw.Open;case rA.closing:return Aw.Closing;default:return Aw.Closed}}isConnected(){return this.connectionState()===Aw.Open}isConnecting(){return this._connectionState==="connecting"}isDisconnecting(){return this._connectionState==="disconnecting"}channel(e,n={config:{}}){const s=`realtime:${e}`,a=this.getChannels().find(o=>o.topic===s);if(a)return a;{const o=new uge(`realtime:${e}`,n,this);return this.channels.push(o),o}}push(e){const{topic:n,event:s,payload:a,ref:o}=e,l=()=>{this.encode(e,i=>{var h;(h=this.conn)===null||h===void 0||h.send(i)})};this.log("push",`${n} ${s} (${o})`,a),this.isConnected()?l():this.sendBuffer.push(l)}async setAuth(e=null){this._authPromise=this._performAuth(e);try{await this._authPromise}finally{this._authPromise=null}}async sendHeartbeat(){var e;if(!this.isConnected()){try{this.heartbeatCallback("disconnected")}catch(n){this.log("error","error in heartbeat callback",n)}return}if(this.pendingHeartbeatRef){this.pendingHeartbeatRef=null,this.log("transport","heartbeat timeout. Attempting to re-establish connection");try{this.heartbeatCallback("timeout")}catch(n){this.log("error","error in heartbeat callback",n)}this._wasManualDisconnect=!1,(e=this.conn)===null||e===void 0||e.close(Det,"heartbeat timeout"),setTimeout(()=>{var n;this.isConnected()||(n=this.reconnectTimer)===null||n===void 0||n.scheduleTimeout()},pL.HEARTBEAT_TIMEOUT_FALLBACK);return}this.pendingHeartbeatRef=this._makeRef(),this.push({topic:"phoenix",event:"heartbeat",payload:{},ref:this.pendingHeartbeatRef});try{this.heartbeatCallback("sent")}catch(n){this.log("error","error in heartbeat callback",n)}this._setAuthSafely("heartbeat")}onHeartbeat(e){this.heartbeatCallback=e}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(e=>e()),this.sendBuffer=[])}_makeRef(){let e=this.ref+1;return e===this.ref?this.ref=0:this.ref=e,this.ref.toString()}_leaveOpenTopic(e){let n=this.channels.find(s=>s.topic===e&&(s._isJoined()||s._isJoining()));n&&(this.log("transport",`leaving duplicate topic "${e}"`),n.unsubscribe())}_remove(e){this.channels=this.channels.filter(n=>n.topic!==e.topic)}_onConnMessage(e){this.decode(e.data,n=>{if(n.topic==="phoenix"&&n.event==="phx_reply")try{this.heartbeatCallback(n.payload.status==="ok"?"ok":"error")}catch(p){this.log("error","error in heartbeat callback",p)}n.ref&&n.ref===this.pendingHeartbeatRef&&(this.pendingHeartbeatRef=null);const{topic:s,event:a,payload:o,ref:l}=n,i=l?`(${l})`:"",h=o.status||"";this.log("receive",`${h} ${s} ${a} ${i}`.trim(),o),this.channels.filter(p=>p._isMember(s)).forEach(p=>p._trigger(a,o,l)),this._triggerStateCallbacks("message",n)})}_clearTimer(e){var n;e==="heartbeat"&&this.heartbeatTimer?(clearInterval(this.heartbeatTimer),this.heartbeatTimer=void 0):e==="reconnect"&&((n=this.reconnectTimer)===null||n===void 0||n.reset())}_clearAllTimers(){this._clearTimer("heartbeat"),this._clearTimer("reconnect")}_setupConnectionHandlers(){this.conn&&("binaryType"in this.conn&&(this.conn.binaryType="arraybuffer"),this.conn.onopen=()=>this._onConnOpen(),this.conn.onerror=e=>this._onConnError(e),this.conn.onmessage=e=>this._onConnMessage(e),this.conn.onclose=e=>this._onConnClose(e))}_teardownConnection(){this.conn&&(this.conn.onopen=null,this.conn.onerror=null,this.conn.onmessage=null,this.conn.onclose=null,this.conn=null),this._clearAllTimers(),this.channels.forEach(e=>e.teardown())}_onConnOpen(){this._setConnectionState("connected"),this.log("transport",`connected to ${this.endpointURL()}`),this.flushSendBuffer(),this._clearTimer("reconnect"),this.worker?this.workerRef||this._startWorkerHeartbeat():this._startHeartbeat(),this._triggerStateCallbacks("open")}_startHeartbeat(){this.heartbeatTimer&&clearInterval(this.heartbeatTimer),this.heartbeatTimer=setInterval(()=>this.sendHeartbeat(),this.heartbeatIntervalMs)}_startWorkerHeartbeat(){this.workerUrl?this.log("worker",`starting worker for from ${this.workerUrl}`):this.log("worker","starting default worker");const e=this._workerObjectUrl(this.workerUrl);this.workerRef=new Worker(e),this.workerRef.onerror=n=>{this.log("worker","worker error",n.message),this.workerRef.terminate()},this.workerRef.onmessage=n=>{n.data.event==="keepAlive"&&this.sendHeartbeat()},this.workerRef.postMessage({event:"start",interval:this.heartbeatIntervalMs})}_onConnClose(e){var n;this._setConnectionState("disconnected"),this.log("transport","close",e),this._triggerChanError(),this._clearTimer("heartbeat"),this._wasManualDisconnect||(n=this.reconnectTimer)===null||n===void 0||n.scheduleTimeout(),this._triggerStateCallbacks("close",e)}_onConnError(e){this._setConnectionState("disconnected"),this.log("transport",`${e}`),this._triggerChanError(),this._triggerStateCallbacks("error",e)}_triggerChanError(){this.channels.forEach(e=>e._trigger(Yp.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([Get],{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:Let};n&&s.updateJoinPayload(a),s.joinedOnce&&s._isJoined()&&s._push(Yp.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 jIe(async()=>{setTimeout(async()=>{await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()},pL.RECONNECT_DELAY)},this.reconnectAfterMs)}_initializeOptions(e){var n,s,a,o,l,i,h,p,x;if(this.transport=(n=e==null?void 0:e.transport)!==null&&n!==void 0?n:null,this.timeout=(s=e==null?void 0:e.timeout)!==null&&s!==void 0?s:$ue,this.heartbeatIntervalMs=(a=e==null?void 0:e.heartbeatIntervalMs)!==null&&a!==void 0?a:pL.HEARTBEAT_INTERVAL,this.worker=(o=e==null?void 0:e.worker)!==null&&o!==void 0?o:!1,this.accessToken=(l=e==null?void 0:e.accessToken)!==null&&l!==void 0?l:null,this.heartbeatCallback=(i=e==null?void 0:e.heartbeatCallback)!==null&&i!==void 0?i:Nle,e!=null&&e.params&&(this.params=e.params),e!=null&&e.logger&&(this.logger=e.logger),(e!=null&&e.logLevel||e!=null&&e.log_level)&&(this.logLevel=e.logLevel||e.log_level,this.params=Object.assign(Object.assign({},this.params),{log_level:this.logLevel})),this.reconnectAfterMs=(h=e==null?void 0:e.reconnectAfterMs)!==null&&h!==void 0?h:y=>Het[y-1]||Wet,this.encode=(p=e==null?void 0:e.encode)!==null&&p!==void 0?p:(y,b)=>b(JSON.stringify(y)),this.decode=(x=e==null?void 0:e.decode)!==null&&x!==void 0?x:this.serializer.decode.bind(this.serializer),this.worker){if(typeof window<"u"&&!window.Worker)throw new Error("Web Worker is not supported");this.workerUrl=e==null?void 0:e.workerUrl}}}class hge extends Error{constructor(e){super(e),this.__isStorageError=!0,this.name="StorageError"}}function Al(t){return typeof t=="object"&&t!==null&&"__isStorageError"in t}class Zet extends hge{constructor(e,n,s){super(e),this.name="StorageApiError",this.status=n,this.statusCode=s}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}}class Vue extends hge{constructor(e,n){super(e),this.name="StorageUnknownError",this.originalError=n}}const fge=t=>{let e;return t?e=t:typeof fetch>"u"?e=(...n)=>r3(async()=>{const{default:s}=await Promise.resolve().then(()=>ak);return{default:s}},void 0).then(({default:s})=>s(...n)):e=fetch,(...n)=>e(...n)},Yet=()=>Is(void 0,void 0,void 0,function*(){return typeof Response>"u"?(yield r3(()=>Promise.resolve().then(()=>ak),void 0)).Response:Response}),Hue=t=>{if(Array.isArray(t))return t.map(n=>Hue(n));if(typeof t=="function"||t!==Object(t))return t;const e={};return Object.entries(t).forEach(([n,s])=>{const a=n.replace(/([-_][a-z])/gi,o=>o.toUpperCase().replace(/[-_]/g,""));e[a]=Hue(s)}),e},Xet=t=>{if(typeof t!="object"||t===null)return!1;const e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},Sle=t=>{var e;return t.msg||t.message||t.error_description||(typeof t.error=="string"?t.error:(e=t.error)===null||e===void 0?void 0:e.message)||JSON.stringify(t)},Qet=(t,e,n)=>Is(void 0,void 0,void 0,function*(){const s=yield Yet();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 Zet(Sle(a),o,l))}).catch(a=>{e(new Vue(Sle(a),a))}):e(new Vue(Sle(t),t))}),Jet=(t,e,n,s)=>{const a={method:t,headers:(e==null?void 0:e.headers)||{}};return t==="GET"||!s?a:(Xet(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 gI(t,e,n,s,a,o){return Is(this,void 0,void 0,function*(){return new Promise((l,i)=>{t(n,Jet(e,s,a,o)).then(h=>{if(!h.ok)throw h;return s!=null&&s.noResolveJson?h:h.json()}).then(h=>l(h)).catch(h=>Qet(h,i,s))})})}function ZA(t,e,n,s){return Is(this,void 0,void 0,function*(){return gI(t,"GET",e,n,s)})}function Wp(t,e,n,s,a){return Is(this,void 0,void 0,function*(){return gI(t,"POST",e,s,a,n)})}function Wue(t,e,n,s,a){return Is(this,void 0,void 0,function*(){return gI(t,"PUT",e,s,a,n)})}function ett(t,e,n,s){return Is(this,void 0,void 0,function*(){return gI(t,"HEAD",e,Object.assign(Object.assign({},n),{noResolveJson:!0}),s)})}function pge(t,e,n,s,a){return Is(this,void 0,void 0,function*(){return gI(t,"DELETE",e,s,a,n)})}class ttt{constructor(e,n){this.downloadFn=e,this.shouldThrowOnError=n}then(e,n){return this.execute().then(e,n)}execute(){return Is(this,void 0,void 0,function*(){try{return{data:(yield this.downloadFn()).body,error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(Al(e))return{data:null,error:e};throw e}})}}var SIe;class rtt{constructor(e,n){this.downloadFn=e,this.shouldThrowOnError=n,this[SIe]="BlobDownloadBuilder",this.promise=null}asStream(){return new ttt(this.downloadFn,this.shouldThrowOnError)}then(e,n){return this.getPromise().then(e,n)}catch(e){return this.getPromise().catch(e)}finally(e){return this.getPromise().finally(e)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}execute(){return Is(this,void 0,void 0,function*(){try{return{data:yield(yield this.downloadFn()).blob(),error:null}}catch(e){if(this.shouldThrowOnError)throw e;if(Al(e))return{data:null,error:e};throw e}})}}SIe=Symbol.toStringTag;const ntt={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},Bwe={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};class stt{constructor(e,n={},s,a){this.shouldThrowOnError=!1,this.url=e,this.headers=n,this.bucketId=s,this.fetch=fge(a)}throwOnError(){return this.shouldThrowOnError=!0,this}uploadOrUpdate(e,n,s,a){return Is(this,void 0,void 0,function*(){try{let o;const l=Object.assign(Object.assign({},Bwe),a);let i=Object.assign(Object.assign({},this.headers),e==="POST"&&{"x-upsert":String(l.upsert)});const h=l.metadata;typeof Blob<"u"&&s instanceof Blob?(o=new FormData,o.append("cacheControl",l.cacheControl),h&&o.append("metadata",this.encodeMetadata(h)),o.append("",s)):typeof FormData<"u"&&s instanceof FormData?(o=s,o.append("cacheControl",l.cacheControl),h&&o.append("metadata",this.encodeMetadata(h))):(o=s,i["cache-control"]=`max-age=${l.cacheControl}`,i["content-type"]=l.contentType,h&&(i["x-metadata"]=this.toBase64(this.encodeMetadata(h)))),a!=null&&a.headers&&(i=Object.assign(Object.assign({},i),a.headers));const p=this._removeEmptyFolders(n),x=this._getFinalPath(p),y=yield(e=="PUT"?Wue:Wp)(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(Al(o))return{data:null,error:o};throw o}})}upload(e,n,s){return Is(this,void 0,void 0,function*(){return this.uploadOrUpdate("POST",e,n,s)})}uploadToSignedUrl(e,n,s,a){return Is(this,void 0,void 0,function*(){const o=this._removeEmptyFolders(e),l=this._getFinalPath(o),i=new URL(this.url+`/object/upload/sign/${l}`);i.searchParams.set("token",n);try{let h;const p=Object.assign({upsert:Bwe.upsert},a),x=Object.assign(Object.assign({},this.headers),{"x-upsert":String(p.upsert)});typeof Blob<"u"&&s instanceof Blob?(h=new FormData,h.append("cacheControl",p.cacheControl),h.append("",s)):typeof FormData<"u"&&s instanceof FormData?(h=s,h.append("cacheControl",p.cacheControl)):(h=s,x["cache-control"]=`max-age=${p.cacheControl}`,x["content-type"]=p.contentType);const y=yield Wue(this.fetch,i.toString(),h,{headers:x});return{data:{path:o,fullPath:y.Key},error:null}}catch(h){if(this.shouldThrowOnError)throw h;if(Al(h))return{data:null,error:h};throw h}})}createSignedUploadUrl(e,n){return Is(this,void 0,void 0,function*(){try{let s=this._getFinalPath(e);const a=Object.assign({},this.headers);n!=null&&n.upsert&&(a["x-upsert"]="true");const o=yield Wp(this.fetch,`${this.url}/object/upload/sign/${s}`,{},{headers:a}),l=new URL(this.url+o.url),i=l.searchParams.get("token");if(!i)throw new hge("No token returned by API");return{data:{signedUrl:l.toString(),path:e,token:i},error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(Al(s))return{data:null,error:s};throw s}})}update(e,n,s){return Is(this,void 0,void 0,function*(){return this.uploadOrUpdate("PUT",e,n,s)})}move(e,n,s){return Is(this,void 0,void 0,function*(){try{return{data:yield Wp(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(Al(a))return{data:null,error:a};throw a}})}copy(e,n,s){return Is(this,void 0,void 0,function*(){try{return{data:{path:(yield Wp(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(Al(a))return{data:null,error:a};throw a}})}createSignedUrl(e,n,s){return Is(this,void 0,void 0,function*(){try{let a=this._getFinalPath(e),o=yield Wp(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(Al(a))return{data:null,error:a};throw a}})}createSignedUrls(e,n,s){return Is(this,void 0,void 0,function*(){try{const a=yield Wp(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(Al(a))return{data:null,error:a};throw a}})}download(e,n){const a=typeof(n==null?void 0:n.transform)<"u"?"render/image/authenticated":"object",o=this.transformOptsToQueryString((n==null?void 0:n.transform)||{}),l=o?`?${o}`:"",i=this._getFinalPath(e),h=()=>ZA(this.fetch,`${this.url}/${a}/${i}${l}`,{headers:this.headers,noResolveJson:!0});return new rtt(h,this.shouldThrowOnError)}info(e){return Is(this,void 0,void 0,function*(){const n=this._getFinalPath(e);try{const s=yield ZA(this.fetch,`${this.url}/object/info/${n}`,{headers:this.headers});return{data:Hue(s),error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(Al(s))return{data:null,error:s};throw s}})}exists(e){return Is(this,void 0,void 0,function*(){const n=this._getFinalPath(e);try{return yield ett(this.fetch,`${this.url}/object/${n}`,{headers:this.headers}),{data:!0,error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(Al(s)&&s instanceof Vue){const a=s.originalError;if([400,404].includes(a==null?void 0:a.status))return{data:!1,error:s}}throw s}})}getPublicUrl(e,n){const s=this._getFinalPath(e),a=[],o=n!=null&&n.download?`download=${n.download===!0?"":n.download}`:"";o!==""&&a.push(o);const i=typeof(n==null?void 0:n.transform)<"u"?"render/image":"object",h=this.transformOptsToQueryString((n==null?void 0:n.transform)||{});h!==""&&a.push(h);let p=a.join("&");return p!==""&&(p=`?${p}`),{data:{publicUrl:encodeURI(`${this.url}/${i}/public/${s}${p}`)}}}remove(e){return Is(this,void 0,void 0,function*(){try{return{data:yield pge(this.fetch,`${this.url}/object/${this.bucketId}`,{prefixes:e},{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Al(n))return{data:null,error:n};throw n}})}list(e,n,s){return Is(this,void 0,void 0,function*(){try{const a=Object.assign(Object.assign(Object.assign({},ntt),n),{prefix:e||""});return{data:yield Wp(this.fetch,`${this.url}/object/list/${this.bucketId}`,a,{headers:this.headers},s),error:null}}catch(a){if(this.shouldThrowOnError)throw a;if(Al(a))return{data:null,error:a};throw a}})}listV2(e,n){return Is(this,void 0,void 0,function*(){try{const s=Object.assign({},e);return{data:yield Wp(this.fetch,`${this.url}/object/list-v2/${this.bucketId}`,s,{headers:this.headers},n),error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(Al(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 CIe="2.78.0",MIe={"X-Client-Info":`storage-js/${CIe}`};class att{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({},MIe),n),this.fetch=fge(s)}throwOnError(){return this.shouldThrowOnError=!0,this}listBuckets(e){return Is(this,void 0,void 0,function*(){try{const n=this.listBucketOptionsToQueryString(e);return{data:yield ZA(this.fetch,`${this.url}/bucket${n}`,{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Al(n))return{data:null,error:n};throw n}})}getBucket(e){return Is(this,void 0,void 0,function*(){try{return{data:yield ZA(this.fetch,`${this.url}/bucket/${e}`,{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Al(n))return{data:null,error:n};throw n}})}createBucket(e){return Is(this,arguments,void 0,function*(n,s={public:!1}){try{return{data:yield Wp(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(Al(a))return{data:null,error:a};throw a}})}updateBucket(e,n){return Is(this,void 0,void 0,function*(){try{return{data:yield Wue(this.fetch,`${this.url}/bucket/${e}`,{id:e,name:e,public:n.public,file_size_limit:n.fileSizeLimit,allowed_mime_types:n.allowedMimeTypes},{headers:this.headers}),error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(Al(s))return{data:null,error:s};throw s}})}emptyBucket(e){return Is(this,void 0,void 0,function*(){try{return{data:yield Wp(this.fetch,`${this.url}/bucket/${e}/empty`,{},{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Al(n))return{data:null,error:n};throw n}})}deleteBucket(e){return Is(this,void 0,void 0,function*(){try{return{data:yield pge(this.fetch,`${this.url}/bucket/${e}`,{},{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Al(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 itt{constructor(e,n={},s){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},MIe),n),this.fetch=fge(s)}throwOnError(){return this.shouldThrowOnError=!0,this}createBucket(e){return Is(this,void 0,void 0,function*(){try{return{data:yield Wp(this.fetch,`${this.url}/bucket`,{name:e},{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Al(n))return{data:null,error:n};throw n}})}listBuckets(e){return Is(this,void 0,void 0,function*(){try{const n=new URLSearchParams;(e==null?void 0:e.limit)!==void 0&&n.set("limit",e.limit.toString()),(e==null?void 0:e.offset)!==void 0&&n.set("offset",e.offset.toString()),e!=null&&e.sortColumn&&n.set("sortColumn",e.sortColumn),e!=null&&e.sortOrder&&n.set("sortOrder",e.sortOrder),e!=null&&e.search&&n.set("search",e.search);const s=n.toString(),a=s?`${this.url}/bucket?${s}`:`${this.url}/bucket`;return{data:yield ZA(this.fetch,a,{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Al(n))return{data:null,error:n};throw n}})}deleteBucket(e){return Is(this,void 0,void 0,function*(){try{return{data:yield pge(this.fetch,`${this.url}/bucket/${e}`,{},{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Al(n))return{data:null,error:n};throw n}})}}const mge={"X-Client-Info":`storage-js/${CIe}`,"Content-Type":"application/json"};class TIe extends Error{constructor(e){super(e),this.__isStorageVectorsError=!0,this.name="StorageVectorsError"}}function Wh(t){return typeof t=="object"&&t!==null&&"__isStorageVectorsError"in t}class Cle extends TIe{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 ott extends TIe{constructor(e,n){super(e),this.name="StorageVectorsUnknownError",this.originalError=n}}var $we;(function(t){t.InternalError="InternalError",t.S3VectorConflictException="S3VectorConflictException",t.S3VectorNotFoundException="S3VectorNotFoundException",t.S3VectorBucketNotEmpty="S3VectorBucketNotEmpty",t.S3VectorMaxBucketsExceeded="S3VectorMaxBucketsExceeded",t.S3VectorMaxIndexesExceeded="S3VectorMaxIndexesExceeded"})($we||($we={}));const gge=t=>{let e;return t?e=t:typeof fetch>"u"?e=(...n)=>r3(async()=>{const{default:s}=await Promise.resolve().then(()=>ak);return{default:s}},void 0).then(({default:s})=>s(...n)):e=fetch,(...n)=>e(...n)},ltt=t=>{if(typeof t!="object"||t===null)return!1;const e=Object.getPrototypeOf(t);return(e===null||e===Object.prototype||Object.getPrototypeOf(e)===null)&&!(Symbol.toStringTag in t)&&!(Symbol.iterator in t)},Uwe=t=>t.msg||t.message||t.error_description||t.error||JSON.stringify(t),ctt=(t,e,n)=>Is(void 0,void 0,void 0,function*(){if(t&&typeof t=="object"&&"status"in t&&"ok"in t&&typeof t.status=="number"&&!(n!=null&&n.noResolveJson)){const a=t.status||500,o=t;if(typeof o.json=="function")o.json().then(l=>{const i=(l==null?void 0:l.statusCode)||(l==null?void 0:l.code)||a+"";e(new Cle(Uwe(l),a,i))}).catch(()=>{const l=a+"",i=o.statusText||`HTTP ${a} error`;e(new Cle(i,a,l))});else{const l=a+"",i=o.statusText||`HTTP ${a} error`;e(new Cle(i,a,l))}}else e(new ott(Uwe(t),t))}),dtt=(t,e,n,s)=>{const a={method:t,headers:(e==null?void 0:e.headers)||{}};return s?(ltt(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 utt(t,e,n,s,a,o){return Is(this,void 0,void 0,function*(){return new Promise((l,i)=>{t(n,dtt(e,s,a,o)).then(h=>{if(!h.ok)throw h;if(s!=null&&s.noResolveJson)return h;const p=h.headers.get("content-type");return!p||!p.includes("application/json")?{}:h.json()}).then(h=>l(h)).catch(h=>ctt(h,i,s))})})}function Gh(t,e,n,s,a){return Is(this,void 0,void 0,function*(){return utt(t,"POST",e,s,a,n)})}class htt{constructor(e,n={},s){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},mge),n),this.fetch=gge(s)}throwOnError(){return this.shouldThrowOnError=!0,this}createIndex(e){return Is(this,void 0,void 0,function*(){try{return{data:(yield Gh(this.fetch,`${this.url}/CreateIndex`,e,{headers:this.headers}))||{},error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Wh(n))return{data:null,error:n};throw n}})}getIndex(e,n){return Is(this,void 0,void 0,function*(){try{return{data:yield Gh(this.fetch,`${this.url}/GetIndex`,{vectorBucketName:e,indexName:n},{headers:this.headers}),error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(Wh(s))return{data:null,error:s};throw s}})}listIndexes(e){return Is(this,void 0,void 0,function*(){try{return{data:yield Gh(this.fetch,`${this.url}/ListIndexes`,e,{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Wh(n))return{data:null,error:n};throw n}})}deleteIndex(e,n){return Is(this,void 0,void 0,function*(){try{return{data:(yield Gh(this.fetch,`${this.url}/DeleteIndex`,{vectorBucketName:e,indexName:n},{headers:this.headers}))||{},error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(Wh(s))return{data:null,error:s};throw s}})}}class ftt{constructor(e,n={},s){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},mge),n),this.fetch=gge(s)}throwOnError(){return this.shouldThrowOnError=!0,this}putVectors(e){return Is(this,void 0,void 0,function*(){try{if(e.vectors.length<1||e.vectors.length>500)throw new Error("Vector batch size must be between 1 and 500 items");return{data:(yield Gh(this.fetch,`${this.url}/PutVectors`,e,{headers:this.headers}))||{},error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Wh(n))return{data:null,error:n};throw n}})}getVectors(e){return Is(this,void 0,void 0,function*(){try{return{data:yield Gh(this.fetch,`${this.url}/GetVectors`,e,{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Wh(n))return{data:null,error:n};throw n}})}listVectors(e){return Is(this,void 0,void 0,function*(){try{if(e.segmentCount!==void 0){if(e.segmentCount<1||e.segmentCount>16)throw new Error("segmentCount must be between 1 and 16");if(e.segmentIndex!==void 0&&(e.segmentIndex<0||e.segmentIndex>=e.segmentCount))throw new Error(`segmentIndex must be between 0 and ${e.segmentCount-1}`)}return{data:yield Gh(this.fetch,`${this.url}/ListVectors`,e,{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Wh(n))return{data:null,error:n};throw n}})}queryVectors(e){return Is(this,void 0,void 0,function*(){try{return{data:yield Gh(this.fetch,`${this.url}/QueryVectors`,e,{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Wh(n))return{data:null,error:n};throw n}})}deleteVectors(e){return Is(this,void 0,void 0,function*(){try{if(e.keys.length<1||e.keys.length>500)throw new Error("Keys batch size must be between 1 and 500 items");return{data:(yield Gh(this.fetch,`${this.url}/DeleteVectors`,e,{headers:this.headers}))||{},error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Wh(n))return{data:null,error:n};throw n}})}}class ptt{constructor(e,n={},s){this.shouldThrowOnError=!1,this.url=e.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},mge),n),this.fetch=gge(s)}throwOnError(){return this.shouldThrowOnError=!0,this}createBucket(e){return Is(this,void 0,void 0,function*(){try{return{data:(yield Gh(this.fetch,`${this.url}/CreateVectorBucket`,{vectorBucketName:e},{headers:this.headers}))||{},error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Wh(n))return{data:null,error:n};throw n}})}getBucket(e){return Is(this,void 0,void 0,function*(){try{return{data:yield Gh(this.fetch,`${this.url}/GetVectorBucket`,{vectorBucketName:e},{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Wh(n))return{data:null,error:n};throw n}})}listBuckets(){return Is(this,arguments,void 0,function*(e={}){try{return{data:yield Gh(this.fetch,`${this.url}/ListVectorBuckets`,e,{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Wh(n))return{data:null,error:n};throw n}})}deleteBucket(e){return Is(this,void 0,void 0,function*(){try{return{data:(yield Gh(this.fetch,`${this.url}/DeleteVectorBucket`,{vectorBucketName:e},{headers:this.headers}))||{},error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Wh(n))return{data:null,error:n};throw n}})}}class mtt extends ptt{constructor(e,n={}){super(e,n.headers||{},n.fetch)}from(e){return new gtt(this.url,this.headers,e,this.fetch)}}class gtt extends htt{constructor(e,n,s,a){super(e,n,a),this.vectorBucketName=s}createIndex(e){const n=Object.create(null,{createIndex:{get:()=>super.createIndex}});return Is(this,void 0,void 0,function*(){return n.createIndex.call(this,Object.assign(Object.assign({},e),{vectorBucketName:this.vectorBucketName}))})}listIndexes(){const e=Object.create(null,{listIndexes:{get:()=>super.listIndexes}});return Is(this,arguments,void 0,function*(n={}){return e.listIndexes.call(this,Object.assign(Object.assign({},n),{vectorBucketName:this.vectorBucketName}))})}getIndex(e){const n=Object.create(null,{getIndex:{get:()=>super.getIndex}});return Is(this,void 0,void 0,function*(){return n.getIndex.call(this,this.vectorBucketName,e)})}deleteIndex(e){const n=Object.create(null,{deleteIndex:{get:()=>super.deleteIndex}});return Is(this,void 0,void 0,function*(){return n.deleteIndex.call(this,this.vectorBucketName,e)})}index(e){return new xtt(this.url,this.headers,this.vectorBucketName,e,this.fetch)}}class xtt extends ftt{constructor(e,n,s,a,o){super(e,n,o),this.vectorBucketName=s,this.indexName=a}putVectors(e){const n=Object.create(null,{putVectors:{get:()=>super.putVectors}});return Is(this,void 0,void 0,function*(){return n.putVectors.call(this,Object.assign(Object.assign({},e),{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))})}getVectors(e){const n=Object.create(null,{getVectors:{get:()=>super.getVectors}});return Is(this,void 0,void 0,function*(){return n.getVectors.call(this,Object.assign(Object.assign({},e),{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))})}listVectors(){const e=Object.create(null,{listVectors:{get:()=>super.listVectors}});return Is(this,arguments,void 0,function*(n={}){return e.listVectors.call(this,Object.assign(Object.assign({},n),{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))})}queryVectors(e){const n=Object.create(null,{queryVectors:{get:()=>super.queryVectors}});return Is(this,void 0,void 0,function*(){return n.queryVectors.call(this,Object.assign(Object.assign({},e),{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))})}deleteVectors(e){const n=Object.create(null,{deleteVectors:{get:()=>super.deleteVectors}});return Is(this,void 0,void 0,function*(){return n.deleteVectors.call(this,Object.assign(Object.assign({},e),{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))})}}class ytt extends att{constructor(e,n={},s,a){super(e,n,s,a)}from(e){return new stt(this.url,this.headers,e,this.fetch)}get vectors(){return new mtt(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new itt(this.url+"/iceberg",this.headers,this.fetch)}}const vtt="2.78.0";let sT="";typeof Deno<"u"?sT="deno":typeof document<"u"?sT="web":typeof navigator<"u"&&navigator.product==="ReactNative"?sT="react-native":sT="node";const _tt={"X-Client-Info":`supabase-js-${sT}/${vtt}`},btt={headers:_tt},wtt={schema:"public"},jtt={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},ktt={},Ntt=t=>{let e;return t?e=t:typeof fetch>"u"?e=sIe:e=fetch,(...n)=>e(...n)},Stt=()=>typeof Headers>"u"?aIe:Headers,Ctt=(t,e,n)=>{const s=Ntt(n),a=Stt();return async(o,l)=>{var i;const h=(i=await e())!==null&&i!==void 0?i:t;let p=new a(l==null?void 0:l.headers);return p.has("apikey")||p.set("apikey",t),p.has("Authorization")||p.set("Authorization",`Bearer ${h}`),s(o,Object.assign(Object.assign({},l),{headers:p}))}};function Mtt(t){return t.endsWith("/")?t:t+"/"}function Ttt(t,e){var n,s;const{db:a,auth:o,realtime:l,global:i}=t,{db:h,auth:p,realtime:x,global:y}=e,b={db:Object.assign(Object.assign({},h),a),auth:Object.assign(Object.assign({},p),o),realtime:Object.assign(Object.assign({},x),l),storage:{},global:Object.assign(Object.assign(Object.assign({},y),i),{headers:Object.assign(Object.assign({},(n=y==null?void 0:y.headers)!==null&&n!==void 0?n:{}),(s=i==null?void 0:i.headers)!==null&&s!==void 0?s:{})}),accessToken:async()=>""};return t.accessToken?b.accessToken=t.accessToken:delete b.accessToken,b}function Att(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(Mtt(e))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}const AIe="2.78.0",g4=30*1e3,Gue=3,Mle=Gue*g4,Ett="http://localhost:9999",Itt="supabase.auth.token",Ptt={"X-Client-Info":`gotrue-js/${AIe}`},Kue="X-Supabase-Api-Version",EIe={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},Ltt=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,Ott=10*60*1e3;class YA extends Error{constructor(e,n,s){super(e),this.__isAuthError=!0,this.name="AuthError",this.status=n,this.code=s}}function Js(t){return typeof t=="object"&&t!==null&&"__isAuthError"in t}class Dtt extends YA{constructor(e,n,s){super(e,n,s),this.name="AuthApiError",this.status=n,this.code=s}}function Rtt(t){return Js(t)&&t.name==="AuthApiError"}class Ew extends YA{constructor(e,n){super(e),this.name="AuthUnknownError",this.originalError=n}}class nv extends YA{constructor(e,n,s,a){super(e,s,a),this.name=n,this.status=s}}class $p extends nv{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}function Ftt(t){return Js(t)&&t.name==="AuthSessionMissingError"}class YN extends nv{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}}class mL extends nv{constructor(e){super(e,"AuthInvalidCredentialsError",400,void 0)}}class gL extends nv{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 ztt(t){return Js(t)&&t.name==="AuthImplicitGrantRedirectError"}class qwe extends nv{constructor(e,n=null){super(e,"AuthPKCEGrantCodeExchangeError",500,void 0),this.details=null,this.details=n}toJSON(){return{name:this.name,message:this.message,status:this.status,details:this.details}}}class Zue extends nv{constructor(e,n){super(e,"AuthRetryableFetchError",n,void 0)}}function Tle(t){return Js(t)&&t.name==="AuthRetryableFetchError"}class Vwe extends nv{constructor(e,n,s){super(e,"AuthWeakPasswordError",n,"weak_password"),this.reasons=s}}class Yue extends nv{constructor(e){super(e,"AuthInvalidJwtError",400,"invalid_jwt")}}const Kee="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),Hwe=` \r=`.split(""),Btt=(()=>{const t=new Array(128);for(let e=0;e=6;){const s=e.queue>>e.queuedBits-6&63;n(Kee[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(Kee[s]),e.queuedBits-=6}}function IIe(t,e,n){const s=Btt[t];if(s>-1)for(e.queue=e.queue<<6|s,e.queuedBits+=6;e.queuedBits>=8;)n(e.queue>>e.queuedBits-8&255),e.queuedBits-=8;else{if(s===-2)return;throw new Error(`Invalid Base64-URL character "${String.fromCharCode(t)}"`)}}function Gwe(t){const e=[],n=l=>{e.push(String.fromCodePoint(l))},s={utf8seq:0,codepoint:0},a={queue:0,queuedBits:0},o=l=>{qtt(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 Utt(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}$tt(s,e)}}function qtt(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 wS(t){const e=[],n={queue:0,queuedBits:0},s=a=>{e.push(a)};for(let a=0;ae.push(n)),new Uint8Array(e)}function Fw(t){const e=[],n={queue:0,queuedBits:0},s=a=>{e.push(a)};return t.forEach(a=>Wwe(a,n,s)),Wwe(null,n,s),e.join("")}function Htt(t){return Math.round(Date.now()/1e3)+t}function Wtt(){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 Nu=()=>typeof window<"u"&&typeof document<"u",n_={tested:!1,writable:!1},PIe=()=>{if(!Nu())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(n_.tested)return n_.writable;const t=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(t,t),globalThis.localStorage.removeItem(t),n_.tested=!0,n_.writable=!0}catch{n_.tested=!0,n_.writable=!1}return n_.writable};function Gtt(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 LIe=t=>{let e;return t?e=t:typeof fetch>"u"?e=(...n)=>r3(async()=>{const{default:s}=await Promise.resolve().then(()=>ak);return{default:s}},void 0).then(({default:s})=>s(...n)):e=fetch,(...n)=>e(...n)},Ktt=t=>typeof t=="object"&&t!==null&&"status"in t&&"ok"in t&&"json"in t&&typeof t.json=="function",x4=async(t,e,n)=>{await t.setItem(e,JSON.stringify(n))},s_=async(t,e)=>{const n=await t.getItem(e);if(!n)return null;try{return JSON.parse(n)}catch{return n}},i0=async(t,e)=>{await t.removeItem(e)};class One{constructor(){this.promise=new One.promiseConstructor((e,n)=>{this.resolve=e,this.reject=n})}}One.promiseConstructor=Promise;function Ale(t){const e=t.split(".");if(e.length!==3)throw new Yue("Invalid JWT structure");for(let s=0;s{setTimeout(()=>e(null),t)})}function Ytt(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 Xtt(t){return("0"+t.toString(16)).substr(-2)}function Qtt(){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,Xtt).join("")}async function Jtt(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 ert(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 Jtt(t);return btoa(n).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function XN(t,e,n=!1){const s=Qtt();let a=s;n&&(a+="/PASSWORD_RECOVERY"),await x4(t,`${e}-code-verifier`,a);const o=await ert(s);return[o,s===o?"plain":"s256"]}const trt=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function rrt(t){const e=t.headers.get(Kue);if(!e||!e.match(trt))return null;try{return new Date(`${e}T00:00:00.0Z`)}catch{return null}}function nrt(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 srt(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 art=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function QN(t){if(!art.test(t))throw new Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function Ele(){const t={};return new Proxy(t,{get:(e,n)=>{if(n==="__isUserNotAvailableProxy")return!0;if(typeof n=="symbol"){const s=n.toString();if(s==="Symbol(Symbol.toPrimitive)"||s==="Symbol(Symbol.toStringTag)"||s==="Symbol(util.inspect.custom)")return}throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Accessing the "${n}" property of the session object is not supported. Please use getUser() instead.`)},set:(e,n)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Setting the "${n}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)},deleteProperty:(e,n)=>{throw new Error(`@supabase/auth-js: client was created with userStorage option and there was no user stored in the user storage. Deleting the "${n}" property of the session object is not supported. Please use getUser() to fetch a user object you can manipulate.`)}})}function irt(t,e){return new Proxy(t,{get:(n,s,a)=>{if(s==="__isInsecureUserWarningProxy")return!0;if(typeof s=="symbol"){const o=s.toString();if(o==="Symbol(Symbol.toPrimitive)"||o==="Symbol(Symbol.toStringTag)"||o==="Symbol(util.inspect.custom)"||o==="Symbol(nodejs.util.inspect.custom)")return Reflect.get(n,s,a)}return!e.value&&typeof s=="string"&&(console.warn("Using the user object as returned from supabase.auth.getSession() or from some supabase.auth.onAuthStateChange() events could be insecure! This value comes directly from the storage medium (usually cookies on the server) and may not be authentic. Use supabase.auth.getUser() instead which authenticates the data by contacting the Supabase Auth server."),e.value=!0),Reflect.get(n,s,a)}})}function Kwe(t){return JSON.parse(JSON.stringify(t))}const Nw=t=>t.msg||t.message||t.error_description||t.error||JSON.stringify(t),ort=[502,503,504];async function Zwe(t){var e;if(!Ktt(t))throw new Zue(Nw(t),0);if(ort.includes(t.status))throw new Zue(Nw(t),t.status);let n;try{n=await t.json()}catch(o){throw new Ew(Nw(o),o)}let s;const a=rrt(t);if(a&&a.getTime()>=EIe["2024-01-01"].timestamp&&typeof n=="object"&&n&&typeof n.code=="string"?s=n.code:typeof n=="object"&&n&&typeof n.error_code=="string"&&(s=n.error_code),s){if(s==="weak_password")throw new Vwe(Nw(n),t.status,((e=n.weak_password)===null||e===void 0?void 0:e.reasons)||[]);if(s==="session_not_found")throw new $p}else if(typeof n=="object"&&n&&typeof n.weak_password=="object"&&n.weak_password&&Array.isArray(n.weak_password.reasons)&&n.weak_password.reasons.length&&n.weak_password.reasons.reduce((o,l)=>o&&typeof l=="string",!0))throw new Vwe(Nw(n),t.status,n.weak_password.reasons);throw new Dtt(Nw(n),t.status||500,s)}const lrt=(t,e,n,s)=>{const a={method:t,headers:(e==null?void 0:e.headers)||{}};return t==="GET"?a:(a.headers=Object.assign({"Content-Type":"application/json;charset=UTF-8"},e==null?void 0:e.headers),a.body=JSON.stringify(s),Object.assign(Object.assign({},a),n))};async function Aa(t,e,n,s){var a;const o=Object.assign({},s==null?void 0:s.headers);o[Kue]||(o[Kue]=EIe["2024-01-01"].name),s!=null&&s.jwt&&(o.Authorization=`Bearer ${s.jwt}`);const l=(a=s==null?void 0:s.query)!==null&&a!==void 0?a:{};s!=null&&s.redirectTo&&(l.redirect_to=s.redirectTo);const i=Object.keys(l).length?"?"+new URLSearchParams(l).toString():"",h=await crt(t,e,n+i,{headers:o,noResolveJson:s==null?void 0:s.noResolveJson},{},s==null?void 0:s.body);return s!=null&&s.xform?s==null?void 0:s.xform(h):{data:Object.assign({},h),error:null}}async function crt(t,e,n,s,a,o){const l=lrt(e,s,a,o);let i;try{i=await t(n,Object.assign({},l))}catch(h){throw console.error(h),new Zue(Nw(h),0)}if(i.ok||await Zwe(i),s!=null&&s.noResolveJson)return i;try{return await i.json()}catch(h){await Zwe(h)}}function Up(t){var e;let n=null;hrt(t)&&(n=Object.assign({},t),t.expires_at||(n.expires_at=Htt(t.expires_in)));const s=(e=t.user)!==null&&e!==void 0?e:t;return{data:{session:n,user:s},error:null}}function Ywe(t){const e=Up(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 M0(t){var e;return{data:{user:(e=t.user)!==null&&e!==void 0?e:t},error:null}}function drt(t){return{data:t,error:null}}function urt(t){const{action_link:e,email_otp:n,hashed_token:s,redirect_to:a,verification_type:o}=t,l=rv(t,["action_link","email_otp","hashed_token","redirect_to","verification_type"]),i={action_link:e,email_otp:n,hashed_token:s,redirect_to:a,verification_type:o},h=Object.assign({},l);return{data:{properties:i,user:h},error:null}}function Xwe(t){return t}function hrt(t){return t.access_token&&t.refresh_token&&t.expires_in}const Ile=["global","local","others"];class frt{constructor({url:e="",headers:n={},fetch:s}){this.url=e,this.headers=n,this.fetch=LIe(s),this.mfa={listFactors:this._listFactors.bind(this),deleteFactor:this._deleteFactor.bind(this)},this.oauth={listClients:this._listOAuthClients.bind(this),createClient:this._createOAuthClient.bind(this),getClient:this._getOAuthClient.bind(this),updateClient:this._updateOAuthClient.bind(this),deleteClient:this._deleteOAuthClient.bind(this),regenerateClientSecret:this._regenerateOAuthClientSecret.bind(this)}}async signOut(e,n=Ile[0]){if(Ile.indexOf(n)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${Ile.join(", ")}`);try{return await Aa(this.fetch,"POST",`${this.url}/logout?scope=${n}`,{headers:this.headers,jwt:e,noResolveJson:!0}),{data:null,error:null}}catch(s){if(Js(s))return{data:null,error:s};throw s}}async inviteUserByEmail(e,n={}){try{return await Aa(this.fetch,"POST",`${this.url}/invite`,{body:{email:e,data:n.data},headers:this.headers,redirectTo:n.redirectTo,xform:M0})}catch(s){if(Js(s))return{data:{user:null},error:s};throw s}}async generateLink(e){try{const{options:n}=e,s=rv(e,["options"]),a=Object.assign(Object.assign({},s),n);return"newEmail"in s&&(a.new_email=s==null?void 0:s.newEmail,delete a.newEmail),await Aa(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:a,headers:this.headers,xform:urt,redirectTo:n==null?void 0:n.redirectTo})}catch(n){if(Js(n))return{data:{properties:null,user:null},error:n};throw n}}async createUser(e){try{return await Aa(this.fetch,"POST",`${this.url}/admin/users`,{body:e,headers:this.headers,xform:M0})}catch(n){if(Js(n))return{data:{user:null},error:n};throw n}}async listUsers(e){var n,s,a,o,l,i,h;try{const p={nextPage:null,lastPage:0,total:0},x=await Aa(this.fetch,"GET",`${this.url}/admin/users`,{headers:this.headers,noResolveJson:!0,query:{page:(s=(n=e==null?void 0:e.page)===null||n===void 0?void 0:n.toString())!==null&&s!==void 0?s:"",per_page:(o=(a=e==null?void 0:e.perPage)===null||a===void 0?void 0:a.toString())!==null&&o!==void 0?o:""},xform:Xwe});if(x.error)throw x.error;const y=await x.json(),b=(l=x.headers.get("x-total-count"))!==null&&l!==void 0?l:0,j=(h=(i=x.headers.get("link"))===null||i===void 0?void 0:i.split(","))!==null&&h!==void 0?h:[];return j.length>0&&(j.forEach(C=>{const N=parseInt(C.split(";")[0].split("=")[1].substring(0,1)),A=JSON.parse(C.split(";")[1].split("=")[1]);p[`${A}Page`]=N}),p.total=parseInt(b)),{data:Object.assign(Object.assign({},y),p),error:null}}catch(p){if(Js(p))return{data:{users:[]},error:p};throw p}}async getUserById(e){QN(e);try{return await Aa(this.fetch,"GET",`${this.url}/admin/users/${e}`,{headers:this.headers,xform:M0})}catch(n){if(Js(n))return{data:{user:null},error:n};throw n}}async updateUserById(e,n){QN(e);try{return await Aa(this.fetch,"PUT",`${this.url}/admin/users/${e}`,{body:n,headers:this.headers,xform:M0})}catch(s){if(Js(s))return{data:{user:null},error:s};throw s}}async deleteUser(e,n=!1){QN(e);try{return await Aa(this.fetch,"DELETE",`${this.url}/admin/users/${e}`,{headers:this.headers,body:{should_soft_delete:n},xform:M0})}catch(s){if(Js(s))return{data:{user:null},error:s};throw s}}async _listFactors(e){QN(e.userId);try{const{data:n,error:s}=await Aa(this.fetch,"GET",`${this.url}/admin/users/${e.userId}/factors`,{headers:this.headers,xform:a=>({data:{factors:a},error:null})});return{data:n,error:s}}catch(n){if(Js(n))return{data:null,error:n};throw n}}async _deleteFactor(e){QN(e.userId),QN(e.id);try{return{data:await Aa(this.fetch,"DELETE",`${this.url}/admin/users/${e.userId}/factors/${e.id}`,{headers:this.headers}),error:null}}catch(n){if(Js(n))return{data:null,error:n};throw n}}async _listOAuthClients(e){var n,s,a,o,l,i,h;try{const p={nextPage:null,lastPage:0,total:0},x=await Aa(this.fetch,"GET",`${this.url}/admin/oauth/clients`,{headers:this.headers,noResolveJson:!0,query:{page:(s=(n=e==null?void 0:e.page)===null||n===void 0?void 0:n.toString())!==null&&s!==void 0?s:"",per_page:(o=(a=e==null?void 0:e.perPage)===null||a===void 0?void 0:a.toString())!==null&&o!==void 0?o:""},xform:Xwe});if(x.error)throw x.error;const y=await x.json(),b=(l=x.headers.get("x-total-count"))!==null&&l!==void 0?l:0,j=(h=(i=x.headers.get("link"))===null||i===void 0?void 0:i.split(","))!==null&&h!==void 0?h:[];return j.length>0&&(j.forEach(C=>{const N=parseInt(C.split(";")[0].split("=")[1].substring(0,1)),A=JSON.parse(C.split(";")[1].split("=")[1]);p[`${A}Page`]=N}),p.total=parseInt(b)),{data:Object.assign(Object.assign({},y),p),error:null}}catch(p){if(Js(p))return{data:{clients:[]},error:p};throw p}}async _createOAuthClient(e){try{return await Aa(this.fetch,"POST",`${this.url}/admin/oauth/clients`,{body:e,headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(Js(n))return{data:null,error:n};throw n}}async _getOAuthClient(e){try{return await Aa(this.fetch,"GET",`${this.url}/admin/oauth/clients/${e}`,{headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(Js(n))return{data:null,error:n};throw n}}async _updateOAuthClient(e,n){try{return await Aa(this.fetch,"PUT",`${this.url}/admin/oauth/clients/${e}`,{body:n,headers:this.headers,xform:s=>({data:s,error:null})})}catch(s){if(Js(s))return{data:null,error:s};throw s}}async _deleteOAuthClient(e){try{return await Aa(this.fetch,"DELETE",`${this.url}/admin/oauth/clients/${e}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(n){if(Js(n))return{data:null,error:n};throw n}}async _regenerateOAuthClientSecret(e){try{return await Aa(this.fetch,"POST",`${this.url}/admin/oauth/clients/${e}/regenerate_secret`,{headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(Js(n))return{data:null,error:n};throw n}}}function Qwe(t={}){return{getItem:e=>t[e]||null,setItem:(e,n)=>{t[e]=n},removeItem:e=>{delete t[e]}}}const JN={debug:!!(globalThis&&PIe()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug")==="true")};class OIe extends Error{constructor(e){super(e),this.isAcquireTimeout=!0}}class prt extends OIe{}async function mrt(t,e,n){JN.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",t,e);const s=new globalThis.AbortController;return e>0&&setTimeout(()=>{s.abort(),JN.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){JN.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquired",t,a.name);try{return await n()}finally{JN.debug&&console.log("@supabase/gotrue-js: navigatorLock: released",t,a.name)}}else{if(e===0)throw JN.debug&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",t),new prt(`Acquiring an exclusive Navigator LockManager lock "${t}" immediately failed`);if(JN.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 grt(){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 DIe(t){if(!/^0x[a-fA-F0-9]{40}$/.test(t))throw new Error(`@supabase/auth-js: Address "${t}" is invalid.`);return t.toLowerCase()}function xrt(t){return parseInt(t,16)}function yrt(t){const e=new TextEncoder().encode(t);return"0x"+Array.from(e,s=>s.toString(16).padStart(2,"0")).join("")}function vrt(t){var e;const{chainId:n,domain:s,expirationTime:a,issuedAt:o=new Date,nonce:l,notBefore:i,requestId:h,resources:p,scheme:x,uri:y,version:b}=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(b!=="1")throw new Error(`@supabase/auth-js: Invalid SIWE message field "version". Version must be '1'. Provided value: ${b}`);if(!((e=t.statement)===null||e===void 0)&&e.includes(` `))throw new Error(`@supabase/auth-js: Invalid SIWE message field "statement". Statement must not include '\\n'. Provided value: ${t.statement}`)}const j=DIe(t.address),C=x?`${x}://${s}`:s,N=t.statement?`${t.statement} `:"",A=`${C} wants you to sign in with your Ethereum account: ${j} ${N}`;let E=`URI: ${y} Version: ${b} Chain ID: ${n}${l?` Nonce: ${l}`:""} Issued At: ${o.toISOString()}`;if(a&&(E+=` Expiration Time: ${a.toISOString()}`),i&&(E+=` Not Before: ${i.toISOString()}`),h&&(E+=` Request ID: ${h}`),p){let T=` Resources:`;for(const L of p){if(!L||typeof L!="string")throw new Error(`@supabase/auth-js: Invalid SIWE message field "resources". Every resource must be a valid string. Provided value: ${L}`);T+=` - ${L}`}E+=T}return`${A} ${E}`}class Nc 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 Zee extends Nc{constructor(e,n){super({code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:n,message:e}),this.name="WebAuthnUnknownError",this.originalError=n}}function _rt({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 Nc({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 Nc({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 Nc({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 Nc({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 Nc({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:t});if(t.name==="NotAllowedError")return new Nc({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 Nc({message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:t}):new Nc({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(RIe(l)){if(o.rp.id!==l)return new Nc({message:`The RP ID "${o.rp.id}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:t})}else return new Nc({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 Nc({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 Nc({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 Nc({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t})}function brt({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 Nc({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:t})}else{if(t.name==="NotAllowedError")return new Nc({message:t.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t});if(t.name==="SecurityError"){const s=window.location.hostname;if(RIe(s)){if(n.rpId!==s)return new Nc({message:`The RP ID "${n.rpId}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:t})}else return new Nc({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:t})}else if(t.name==="UnknownError")return new Nc({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 Nc({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:t})}class wrt{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 jrt=new wrt;function krt(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=rv(t,["challenge","user","excludeCredentials"]),o=wS(e).buffer,l=Object.assign(Object.assign({},n),{id:wS(n.id).buffer}),i=Object.assign(Object.assign({},a),{challenge:o,user:l});if(s&&s.length>0){i.excludeCredentials=new Array(s.length);for(let h=0;h0){o.allowCredentials=new Array(n.length);for(let l=0;la!==null&&typeof a=="object"&&!Array.isArray(a),n=a=>a instanceof ArrayBuffer||ArrayBuffer.isView(a),s={};for(const a of t)if(a)for(const o in a){const l=a[o];if(l!==void 0)if(Array.isArray(l))s[o]=l;else if(n(l))s[o]=l;else if(e(l)){const i=s[o];e(i)?s[o]=Yee(i,l):s[o]=Yee(l)}else s[o]=l}return s}function Irt(t,e){return Yee(Art,t,e||{})}function Prt(t,e){return Yee(Ert,t,e||{})}class Lrt{constructor(e){this.client=e,this.enroll=this._enroll.bind(this),this.challenge=this._challenge.bind(this),this.verify=this._verify.bind(this),this.authenticate=this._authenticate.bind(this),this.register=this._register.bind(this)}async _enroll(e){return this.client.mfa.enroll(Object.assign(Object.assign({},e),{factorType:"webauthn"}))}async _challenge({factorId:e,webauthn:n,friendlyName:s,signal:a},o){try{const{data:l,error:i}=await this.client.mfa.challenge({factorId:e,webauthn:n});if(!l)return{data:null,error:i};const h=a??jrt.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=Irt(l.webauthn.credential_options.publicKey,o==null?void 0:o.create),{data:x,error:y}=await Mrt({publicKey:p,signal:h});return x?{data:{factorId:e,challengeId:l.id,webauthn:{type:l.webauthn.type,credential_response:x}},error:null}:{data:null,error:y}}case"request":{const p=Prt(l.webauthn.credential_options.publicKey,o==null?void 0:o.request),{data:x,error:y}=await Trt(Object.assign(Object.assign({},l.webauthn.credential_options),{publicKey:p,signal:h}));return x?{data:{factorId:e,challengeId:l.id,webauthn:{type:l.webauthn.type,credential_response:x}},error:null}:{data:null,error:y}}}}catch(l){return Js(l)?{data:null,error:l}:{data:null,error:new Ew("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 YA("rpId is required for WebAuthn authentication")};try{if(!Jwe())return{data:null,error:new Ew("Browser does not support WebAuthn",null)};const{data:l,error:i}=await this.challenge({factorId:e,webauthn:{rpId:n,rpOrigins:s},signal:a},{request:o});if(!l)return{data:null,error:i};const{webauthn:h}=l;return this._verify({factorId:e,challengeId:l.challengeId,webauthn:{type:h.type,rpId:n,rpOrigins:s,credential_response:h.credential_response}})}catch(l){return Js(l)?{data:null,error:l}:{data:null,error:new Ew("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 YA("rpId is required for WebAuthn registration")};try{if(!Jwe())return{data:null,error:new Ew("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(b=>b.factor_type==="webauthn"&&b.friendly_name===e&&b.status!=="unverified")}).then(x=>x?this.client.mfa.unenroll({factorId:x==null?void 0:x.id}):void 0),{data:null,error:i};const{data:h,error:p}=await this._challenge({factorId:l.id,friendlyName:l.friendly_name,webauthn:{rpId:n,rpOrigins:s},signal:a},{create:o});return h?this._verify({factorId:l.id,challengeId:h.challengeId,webauthn:{rpId:n,rpOrigins:s,type:h.webauthn.type,credential_response:h.webauthn.credential_response}}):{data:null,error:p}}catch(l){return Js(l)?{data:null,error:l}:{data:null,error:new Ew("Unexpected error in register",l)}}}}grt();const Ort={url:Ett,storageKey:Itt,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:Ptt,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1};async function eje(t,e,n){return await n()}const e4={};class XA{get jwks(){var e,n;return(n=(e=e4[this.storageKey])===null||e===void 0?void 0:e.jwks)!==null&&n!==void 0?n:{keys:[]}}set jwks(e){e4[this.storageKey]=Object.assign(Object.assign({},e4[this.storageKey]),{jwks:e})}get jwks_cached_at(){var e,n;return(n=(e=e4[this.storageKey])===null||e===void 0?void 0:e.cachedAt)!==null&&n!==void 0?n:Number.MIN_SAFE_INTEGER}set jwks_cached_at(e){e4[this.storageKey]=Object.assign(Object.assign({},e4[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=XA.nextInstanceID,XA.nextInstanceID+=1,this.instanceID>0&&Nu()&&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({},Ort),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 frt({url:a.url,headers:a.headers,fetch:a.fetch}),this.url=a.url,this.headers=a.headers,this.fetch=LIe(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:Nu()&&(!((n=globalThis==null?void 0:globalThis.navigator)===null||n===void 0)&&n.locks)?this.lock=mrt: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 Lrt(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:PIe()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=Qwe(this.memoryStorage)),a.userStorage&&(this.userStorage=a.userStorage)):(this.memoryStorage={},this.storage=Qwe(this.memoryStorage)),Nu()&&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} (${AIe}) ${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=Gtt(window.location.href);let s="none";if(this._isImplicitGrantCallback(n)?s="implicit":await this._isPKCECallback(n)&&(s="pkce"),Nu()&&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),ztt(o)){const h=(e=o.details)===null||e===void 0?void 0:e.code;if(h==="identity_already_exists"||h==="identity_not_found"||h==="single_identity_not_deletable")return{error:o}}return await this._removeSession(),{error:o}}const{session:l,redirectType:i}=a;return this._debug("#_initialize()","detected session in URL",l,"redirect type",i),await this._saveSession(l),setTimeout(async()=>{i==="recovery"?await this._notifyAllSubscribers("PASSWORD_RECOVERY",l):await this._notifyAllSubscribers("SIGNED_IN",l)},0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(n){return Js(n)?{error:n}:{error:new Ew("Unexpected error during initialization",n)}}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(e){var n,s,a;try{const o=await Aa(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{data:(s=(n=e==null?void 0:e.options)===null||n===void 0?void 0:n.data)!==null&&s!==void 0?s:{},gotrue_meta_security:{captcha_token:(a=e==null?void 0:e.options)===null||a===void 0?void 0:a.captchaToken}},xform:Up}),{data:l,error:i}=o;if(i||!l)return{data:{user:null,session:null},error:i};const h=l.session,p=l.user;return l.session&&(await this._saveSession(l.session),await this._notifyAllSubscribers("SIGNED_IN",h)),{data:{user:p,session:h},error:null}}catch(o){if(Js(o))return{data:{user:null,session:null},error:o};throw o}}async signUp(e){var n,s,a;try{let o;if("email"in e){const{email:x,password:y,options:b}=e;let j=null,C=null;this.flowType==="pkce"&&([j,C]=await XN(this.storage,this.storageKey)),o=await Aa(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:b==null?void 0:b.emailRedirectTo,body:{email:x,password:y,data:(n=b==null?void 0:b.data)!==null&&n!==void 0?n:{},gotrue_meta_security:{captcha_token:b==null?void 0:b.captchaToken},code_challenge:j,code_challenge_method:C},xform:Up})}else if("phone"in e){const{phone:x,password:y,options:b}=e;o=await Aa(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:x,password:y,data:(s=b==null?void 0:b.data)!==null&&s!==void 0?s:{},channel:(a=b==null?void 0:b.channel)!==null&&a!==void 0?a:"sms",gotrue_meta_security:{captcha_token:b==null?void 0:b.captchaToken}},xform:Up})}else throw new mL("You must provide either an email or phone number and a password");const{data:l,error:i}=o;if(i||!l)return{data:{user:null,session:null},error:i};const h=l.session,p=l.user;return l.session&&(await this._saveSession(l.session),await this._notifyAllSubscribers("SIGNED_IN",h)),{data:{user:p,session:h},error:null}}catch(o){if(Js(o))return{data:{user:null,session:null},error:o};throw o}}async signInWithPassword(e){try{let n;if("email"in e){const{email:o,password:l,options:i}=e;n=await Aa(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{email:o,password:l,gotrue_meta_security:{captcha_token:i==null?void 0:i.captchaToken}},xform:Ywe})}else if("phone"in e){const{phone:o,password:l,options:i}=e;n=await Aa(this.fetch,"POST",`${this.url}/token?grant_type=password`,{headers:this.headers,body:{phone:o,password:l,gotrue_meta_security:{captcha_token:i==null?void 0:i.captchaToken}},xform:Ywe})}else throw new mL("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 YN}:(s.session&&(await this._saveSession(s.session),await this._notifyAllSubscribers("SIGNED_IN",s.session)),{data:Object.assign({user:s.user,session:s.session},s.weak_password?{weakPassword:s.weak_password}:null),error:a})}catch(n){if(Js(n))return{data:{user:null,session:null},error:n};throw n}}async signInWithOAuth(e){var n,s,a,o;return await this._handleProviderSignIn(e.provider,{redirectTo:(n=e.options)===null||n===void 0?void 0:n.redirectTo,scopes:(s=e.options)===null||s===void 0?void 0:s.scopes,queryParams:(a=e.options)===null||a===void 0?void 0:a.queryParams,skipBrowserRedirect:(o=e.options)===null||o===void 0?void 0:o.skipBrowserRedirect})}async exchangeCodeForSession(e){return await this.initializePromise,this._acquireLock(-1,async()=>this._exchangeCodeForSession(e))}async signInWithWeb3(e){const{chain:n}=e;switch(n){case"ethereum":return await this.signInWithEthereum(e);case"solana":return await this.signInWithSolana(e);default:throw new Error(`@supabase/auth-js: Unsupported chain "${n}"`)}}async signInWithEthereum(e){var n,s,a,o,l,i,h,p,x,y,b;let j,C;if("message"in e)j=e.message,C=e.signature;else{const{chain:N,wallet:A,statement:E,options:T}=e;let L;if(Nu())if(typeof A=="object")L=A;else{const G=window;if("ethereum"in G&&typeof G.ethereum=="object"&&"request"in G.ethereum&&typeof G.ethereum.request=="function")L=G.ethereum;else throw new Error("@supabase/auth-js: No compatible Ethereum wallet interface on the window object (window.ethereum) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'ethereum', wallet: resolvedUserWallet }) instead.")}else{if(typeof A!="object"||!(T!=null&&T.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");L=A}const z=new URL((n=T==null?void 0:T.url)!==null&&n!==void 0?n:window.location.href),F=await L.request({method:"eth_requestAccounts"}).then(G=>G).catch(()=>{throw new Error("@supabase/auth-js: Wallet method eth_requestAccounts is missing or invalid")});if(!F||F.length===0)throw new Error("@supabase/auth-js: No accounts available. Please ensure the wallet is connected.");const q=DIe(F[0]);let H=(s=T==null?void 0:T.signInWithEthereum)===null||s===void 0?void 0:s.chainId;if(!H){const G=await L.request({method:"eth_chainId"});H=xrt(G)}const Z={domain:z.host,address:q,statement:E,uri:z.href,version:"1",chainId:H,nonce:(a=T==null?void 0:T.signInWithEthereum)===null||a===void 0?void 0:a.nonce,issuedAt:(l=(o=T==null?void 0:T.signInWithEthereum)===null||o===void 0?void 0:o.issuedAt)!==null&&l!==void 0?l:new Date,expirationTime:(i=T==null?void 0:T.signInWithEthereum)===null||i===void 0?void 0:i.expirationTime,notBefore:(h=T==null?void 0:T.signInWithEthereum)===null||h===void 0?void 0:h.notBefore,requestId:(p=T==null?void 0:T.signInWithEthereum)===null||p===void 0?void 0:p.requestId,resources:(x=T==null?void 0:T.signInWithEthereum)===null||x===void 0?void 0:x.resources};j=vrt(Z),C=await L.request({method:"personal_sign",params:[yrt(j),q]})}try{const{data:N,error:A}=await Aa(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"ethereum",message:j,signature:C},!((y=e.options)===null||y===void 0)&&y.captchaToken?{gotrue_meta_security:{captcha_token:(b=e.options)===null||b===void 0?void 0:b.captchaToken}}:null),xform:Up});if(A)throw A;return!N||!N.session||!N.user?{data:{user:null,session:null},error:new YN}:(N.session&&(await this._saveSession(N.session),await this._notifyAllSubscribers("SIGNED_IN",N.session)),{data:Object.assign({},N),error:A})}catch(N){if(Js(N))return{data:{user:null,session:null},error:N};throw N}}async signInWithSolana(e){var n,s,a,o,l,i,h,p,x,y,b,j;let C,N;if("message"in e)C=e.message,N=e.signature;else{const{chain:A,wallet:E,statement:T,options:L}=e;let z;if(Nu())if(typeof E=="object")z=E;else{const q=window;if("solana"in q&&typeof q.solana=="object"&&("signIn"in q.solana&&typeof q.solana.signIn=="function"||"signMessage"in q.solana&&typeof q.solana.signMessage=="function"))z=q.solana;else throw new Error("@supabase/auth-js: No compatible Solana wallet interface on the window object (window.solana) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'solana', wallet: resolvedUserWallet }) instead.")}else{if(typeof E!="object"||!(L!=null&&L.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");z=E}const F=new URL((n=L==null?void 0:L.url)!==null&&n!==void 0?n:window.location.href);if("signIn"in z&&z.signIn){const q=await z.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},L==null?void 0:L.signInWithSolana),{version:"1",domain:F.host,uri:F.href}),T?{statement:T}:null));let H;if(Array.isArray(q)&&q[0]&&typeof q[0]=="object")H=q[0];else if(q&&typeof q=="object"&&"signedMessage"in q&&"signature"in q)H=q;else throw new Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");if("signedMessage"in H&&"signature"in H&&(typeof H.signedMessage=="string"||H.signedMessage instanceof Uint8Array)&&H.signature instanceof Uint8Array)C=typeof H.signedMessage=="string"?H.signedMessage:new TextDecoder().decode(H.signedMessage),N=H.signature;else throw new Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields")}else{if(!("signMessage"in z)||typeof z.signMessage!="function"||!("publicKey"in z)||typeof z!="object"||!z.publicKey||!("toBase58"in z.publicKey)||typeof z.publicKey.toBase58!="function")throw new Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");C=[`${F.host} wants you to sign in with your Solana account:`,z.publicKey.toBase58(),...T?["",T,""]:[""],"Version: 1",`URI: ${F.href}`,`Issued At: ${(a=(s=L==null?void 0:L.signInWithSolana)===null||s===void 0?void 0:s.issuedAt)!==null&&a!==void 0?a:new Date().toISOString()}`,...!((o=L==null?void 0:L.signInWithSolana)===null||o===void 0)&&o.notBefore?[`Not Before: ${L.signInWithSolana.notBefore}`]:[],...!((l=L==null?void 0:L.signInWithSolana)===null||l===void 0)&&l.expirationTime?[`Expiration Time: ${L.signInWithSolana.expirationTime}`]:[],...!((i=L==null?void 0:L.signInWithSolana)===null||i===void 0)&&i.chainId?[`Chain ID: ${L.signInWithSolana.chainId}`]:[],...!((h=L==null?void 0:L.signInWithSolana)===null||h===void 0)&&h.nonce?[`Nonce: ${L.signInWithSolana.nonce}`]:[],...!((p=L==null?void 0:L.signInWithSolana)===null||p===void 0)&&p.requestId?[`Request ID: ${L.signInWithSolana.requestId}`]:[],...!((y=(x=L==null?void 0:L.signInWithSolana)===null||x===void 0?void 0:x.resources)===null||y===void 0)&&y.length?["Resources",...L.signInWithSolana.resources.map(H=>`- ${H}`)]:[]].join(` `);const q=await z.signMessage(new TextEncoder().encode(C),"utf8");if(!q||!(q instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");N=q}}try{const{data:A,error:E}=await Aa(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:C,signature:Fw(N)},!((b=e.options)===null||b===void 0)&&b.captchaToken?{gotrue_meta_security:{captcha_token:(j=e.options)===null||j===void 0?void 0:j.captchaToken}}:null),xform:Up});if(E)throw E;return!A||!A.session||!A.user?{data:{user:null,session:null},error:new YN}:(A.session&&(await this._saveSession(A.session),await this._notifyAllSubscribers("SIGNED_IN",A.session)),{data:Object.assign({},A),error:E})}catch(A){if(Js(A))return{data:{user:null,session:null},error:A};throw A}}async _exchangeCodeForSession(e){const n=await s_(this.storage,`${this.storageKey}-code-verifier`),[s,a]=(n??"").split("/");try{const{data:o,error:l}=await Aa(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:e,code_verifier:s},xform:Up});if(await i0(this.storage,`${this.storageKey}-code-verifier`),l)throw l;return!o||!o.session||!o.user?{data:{user:null,session:null,redirectType:null},error:new YN}:(o.session&&(await this._saveSession(o.session),await this._notifyAllSubscribers("SIGNED_IN",o.session)),{data:Object.assign(Object.assign({},o),{redirectType:a??null}),error:l})}catch(o){if(Js(o))return{data:{user:null,session:null,redirectType:null},error:o};throw o}}async signInWithIdToken(e){try{const{options:n,provider:s,token:a,access_token:o,nonce:l}=e,i=await Aa(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,body:{provider:s,id_token:a,access_token:o,nonce:l,gotrue_meta_security:{captcha_token:n==null?void 0:n.captchaToken}},xform:Up}),{data:h,error:p}=i;return p?{data:{user:null,session:null},error:p}:!h||!h.session||!h.user?{data:{user:null,session:null},error:new YN}:(h.session&&(await this._saveSession(h.session),await this._notifyAllSubscribers("SIGNED_IN",h.session)),{data:h,error:p})}catch(n){if(Js(n))return{data:{user:null,session:null},error:n};throw n}}async signInWithOtp(e){var n,s,a,o,l;try{if("email"in e){const{email:i,options:h}=e;let p=null,x=null;this.flowType==="pkce"&&([p,x]=await XN(this.storage,this.storageKey));const{error:y}=await Aa(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:i,data:(n=h==null?void 0:h.data)!==null&&n!==void 0?n:{},create_user:(s=h==null?void 0:h.shouldCreateUser)!==null&&s!==void 0?s:!0,gotrue_meta_security:{captcha_token:h==null?void 0:h.captchaToken},code_challenge:p,code_challenge_method:x},redirectTo:h==null?void 0:h.emailRedirectTo});return{data:{user:null,session:null},error:y}}if("phone"in e){const{phone:i,options:h}=e,{data:p,error:x}=await Aa(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:i,data:(a=h==null?void 0:h.data)!==null&&a!==void 0?a:{},create_user:(o=h==null?void 0:h.shouldCreateUser)!==null&&o!==void 0?o:!0,gotrue_meta_security:{captcha_token:h==null?void 0:h.captchaToken},channel:(l=h==null?void 0:h.channel)!==null&&l!==void 0?l:"sms"}});return{data:{user:null,session:null,messageId:p==null?void 0:p.message_id},error:x}}throw new mL("You must provide either an email or phone number.")}catch(i){if(Js(i))return{data:{user:null,session:null},error:i};throw i}}async verifyOtp(e){var n,s;try{let a,o;"options"in e&&(a=(n=e.options)===null||n===void 0?void 0:n.redirectTo,o=(s=e.options)===null||s===void 0?void 0:s.captchaToken);const{data:l,error:i}=await Aa(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},e),{gotrue_meta_security:{captcha_token:o}}),redirectTo:a,xform:Up});if(i)throw i;if(!l)throw new Error("An error occurred on token verification.");const h=l.session,p=l.user;return h!=null&&h.access_token&&(await this._saveSession(h),await this._notifyAllSubscribers(e.type=="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",h)),{data:{user:p,session:h},error:null}}catch(a){if(Js(a))return{data:{user:null,session:null},error:a};throw a}}async signInWithSSO(e){var n,s,a;try{let o=null,l=null;return this.flowType==="pkce"&&([o,l]=await XN(this.storage,this.storageKey)),await Aa(this.fetch,"POST",`${this.url}/sso`,{body:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},"providerId"in e?{provider_id:e.providerId}:null),"domain"in e?{domain:e.domain}:null),{redirect_to:(s=(n=e.options)===null||n===void 0?void 0:n.redirectTo)!==null&&s!==void 0?s:void 0}),!((a=e==null?void 0:e.options)===null||a===void 0)&&a.captchaToken?{gotrue_meta_security:{captcha_token:e.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:o,code_challenge_method:l}),headers:this.headers,xform:drt})}catch(o){if(Js(o))return{data:null,error:o};throw o}}async reauthenticate(){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._reauthenticate())}async _reauthenticate(){try{return await this._useSession(async e=>{const{data:{session:n},error:s}=e;if(s)throw s;if(!n)throw new $p;const{error:a}=await Aa(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:n.access_token});return{data:{user:null,session:null},error:a}})}catch(e){if(Js(e))return{data:{user:null,session:null},error:e};throw e}}async resend(e){try{const n=`${this.url}/resend`;if("email"in e){const{email:s,type:a,options:o}=e,{error:l}=await Aa(this.fetch,"POST",n,{headers:this.headers,body:{email:s,type:a,gotrue_meta_security:{captcha_token:o==null?void 0:o.captchaToken}},redirectTo:o==null?void 0:o.emailRedirectTo});return{data:{user:null,session:null},error:l}}else if("phone"in e){const{phone:s,type:a,options:o}=e,{data:l,error:i}=await Aa(this.fetch,"POST",n,{headers:this.headers,body:{phone:s,type:a,gotrue_meta_security:{captcha_token:o==null?void 0:o.captchaToken}}});return{data:{user:null,session:null,messageId:l==null?void 0:l.message_id},error:i}}throw new mL("You must provide either an email or phone number and a type")}catch(n){if(Js(n))return{data:{user:null,session:null},error:n};throw n}}async getSession(){return await this.initializePromise,await this._acquireLock(-1,async()=>this._useSession(async n=>n))}async _acquireLock(e,n){this._debug("#_acquireLock","begin",e);try{if(this.lockAcquired){const s=this.pendingInLock.length?this.pendingInLock[this.pendingInLock.length-1]:Promise.resolve(),a=(async()=>(await s,await n()))();return this.pendingInLock.push((async()=>{try{await a}catch{}})()),a}return await this.lock(`lock:${this.storageKey}`,e,async()=>{this._debug("#_acquireLock","lock acquired for storage key",this.storageKey);try{this.lockAcquired=!0;const s=n();for(this.pendingInLock.push((async()=>{try{await s}catch{}})()),await s;this.pendingInLock.length;){const a=[...this.pendingInLock];await Promise.all(a),this.pendingInLock.splice(0,a.length)}return await s}finally{this._debug("#_acquireLock","lock released for storage key",this.storageKey),this.lockAcquired=!1}})}finally{this._debug("#_acquireLock","end")}}async _useSession(e){this._debug("#_useSession","begin");try{const n=await this.__loadSession();return await e(n)}finally{this._debug("#_useSession","end")}}async __loadSession(){this._debug("#__loadSession()","begin"),this.lockAcquired||this._debug("#__loadSession()","used outside of an acquired lock!",new Error().stack);try{let e=null;const n=await s_(this.storage,this.storageKey);if(this._debug("#getSession()","session from storage",n),n!==null&&(this._isValidSession(n)?e=n:(this._debug("#getSession()","session from storage is not valid"),await this._removeSession())),!e)return{data:{session:null},error:null};const s=e.expires_at?e.expires_at*1e3-Date.now()await this._getUser()))}async _getUser(e){try{return e?await Aa(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:e,xform:M0}):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 $p}:await Aa(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:(o=(a=l.session)===null||a===void 0?void 0:a.access_token)!==null&&o!==void 0?o:void 0,xform:M0})})}catch(n){if(Js(n))return Ftt(n)&&(await this._removeSession(),await i0(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 $p;const l=a.session;let i=null,h=null;this.flowType==="pkce"&&e.email!=null&&([i,h]=await XN(this.storage,this.storageKey));const{data:p,error:x}=await Aa(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:n==null?void 0:n.emailRedirectTo,body:Object.assign(Object.assign({},e),{code_challenge:i,code_challenge_method:h}),jwt:l.access_token,xform:M0});if(x)throw x;return l.user=p.user,await this._saveSession(l),await this._notifyAllSubscribers("USER_UPDATED",l),{data:{user:l.user},error:null}})}catch(s){if(Js(s))return{data:{user:null},error:s};throw s}}async setSession(e){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._setSession(e))}async _setSession(e){try{if(!e.access_token||!e.refresh_token)throw new $p;const n=Date.now()/1e3;let s=n,a=!0,o=null;const{payload:l}=Ale(e.access_token);if(l.exp&&(s=l.exp,a=s<=n),a){const{data:i,error:h}=await this._callRefreshToken(e.refresh_token);if(h)return{data:{user:null,session:null},error:h};if(!i)return{data:{user:null,session:null},error:null};o=i}else{const{data:i,error:h}=await this._getUser(e.access_token);if(h)throw h;o={access_token:e.access_token,refresh_token:e.refresh_token,user:i.user,token_type:"bearer",expires_in:s-n,expires_at:s},await this._saveSession(o),await this._notifyAllSubscribers("SIGNED_IN",o)}return{data:{user:o.user,session:o},error:null}}catch(n){if(Js(n))return{data:{session:null,user:null},error:n};throw n}}async refreshSession(e){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._refreshSession(e))}async _refreshSession(e){try{return await this._useSession(async n=>{var s;if(!e){const{data:l,error:i}=n;if(i)throw i;e=(s=l.session)!==null&&s!==void 0?s:void 0}if(!(e!=null&&e.refresh_token))throw new $p;const{data:a,error:o}=await this._callRefreshToken(e.refresh_token);return o?{data:{user:null,session:null},error:o}:a?{data:{user:a.user,session:a},error:null}:{data:{user:null,session:null},error:null}})}catch(n){if(Js(n))return{data:{user:null,session:null},error:n};throw n}}async _getSessionFromURL(e,n){try{if(!Nu())throw new gL("No browser detected.");if(e.error||e.error_description||e.error_code)throw new gL(e.error_description||"Error in URL with unspecified error_description",{error:e.error||"unspecified_error",code:e.error_code||"unspecified_code"});switch(n){case"implicit":if(this.flowType==="pkce")throw new qwe("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new gL("Not a valid implicit grant flow url.");break;default:}if(n==="pkce"){if(this._debug("#_initialize()","begin","is PKCE flow",!0),!e.code)throw new qwe("No code detected.");const{data:T,error:L}=await this._exchangeCodeForSession(e.code);if(L)throw L;const z=new URL(window.location.href);return z.searchParams.delete("code"),window.history.replaceState(window.history.state,"",z.toString()),{data:{session:T.session,redirectType:null},error:null}}const{provider_token:s,provider_refresh_token:a,access_token:o,refresh_token:l,expires_in:i,expires_at:h,token_type:p}=e;if(!o||!i||!l||!p)throw new gL("No session defined in URL");const x=Math.round(Date.now()/1e3),y=parseInt(i);let b=x+y;h&&(b=parseInt(h));const j=b-x;j*1e3<=g4&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${j}s, should have been closer to ${y}s`);const C=b-y;x-C>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",C,b,x):x-C<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew",C,b,x);const{data:N,error:A}=await this._getUser(o);if(A)throw A;const E={provider_token:s,provider_refresh_token:a,access_token:o,expires_in:y,expires_at:b,refresh_token:l,token_type:p,user:N.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),{data:{session:E,redirectType:e.type},error:null}}catch(s){if(Js(s))return{data:{session:null,redirectType:null},error:s};throw s}}_isImplicitGrantCallback(e){return!!(e.access_token||e.error_description)}async _isPKCECallback(e){const n=await s_(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&&!(Rtt(i)&&(i.status===404||i.status===401||i.status===403)))return{error:i}}return e!=="others"&&(await this._removeSession(),await i0(this.storage,`${this.storageKey}-code-verifier`)),{error:null}})}onAuthStateChange(e){const n=Wtt(),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 XN(this.storage,this.storageKey,!0));try{return await Aa(this.fetch,"POST",`${this.url}/recover`,{body:{email:e,code_challenge:s,code_challenge_method:a,gotrue_meta_security:{captcha_token:n.captchaToken}},headers:this.headers,redirectTo:n.redirectTo})}catch(o){if(Js(o))return{data:null,error:o};throw o}}async getUserIdentities(){var e;try{const{data:n,error:s}=await this.getUser();if(s)throw s;return{data:{identities:(e=n.user.identities)!==null&&e!==void 0?e:[]},error:null}}catch(n){if(Js(n))return{data:null,error:n};throw n}}async linkIdentity(e){return"token"in e?this.linkIdentityIdToken(e):this.linkIdentityOAuth(e)}async linkIdentityOAuth(e){var n;try{const{data:s,error:a}=await this._useSession(async o=>{var l,i,h,p,x;const{data:y,error:b}=o;if(b)throw b;const j=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,e.provider,{redirectTo:(l=e.options)===null||l===void 0?void 0:l.redirectTo,scopes:(i=e.options)===null||i===void 0?void 0:i.scopes,queryParams:(h=e.options)===null||h===void 0?void 0:h.queryParams,skipBrowserRedirect:!0});return await Aa(this.fetch,"GET",j,{headers:this.headers,jwt:(x=(p=y.session)===null||p===void 0?void 0:p.access_token)!==null&&x!==void 0?x:void 0})});if(a)throw a;return Nu()&&!(!((n=e.options)===null||n===void 0)&&n.skipBrowserRedirect)&&window.location.assign(s==null?void 0:s.url),{data:{provider:e.provider,url:s==null?void 0:s.url},error:null}}catch(s){if(Js(s))return{data:{provider:e.provider,url:null},error:s};throw s}}async linkIdentityIdToken(e){return await this._useSession(async n=>{var s;try{const{error:a,data:{session:o}}=n;if(a)throw a;const{options:l,provider:i,token:h,access_token:p,nonce:x}=e,y=await Aa(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,jwt:(s=o==null?void 0:o.access_token)!==null&&s!==void 0?s:void 0,body:{provider:i,id_token:h,access_token:p,nonce:x,link_identity:!0,gotrue_meta_security:{captcha_token:l==null?void 0:l.captchaToken}},xform:Up}),{data:b,error:j}=y;return j?{data:{user:null,session:null},error:j}:!b||!b.session||!b.user?{data:{user:null,session:null},error:new YN}:(b.session&&(await this._saveSession(b.session),await this._notifyAllSubscribers("USER_UPDATED",b.session)),{data:b,error:j})}catch(a){if(Js(a))return{data:{user:null,session:null},error:a};throw a}})}async unlinkIdentity(e){try{return await this._useSession(async n=>{var s,a;const{data:o,error:l}=n;if(l)throw l;return await Aa(this.fetch,"DELETE",`${this.url}/user/identities/${e.identity_id}`,{headers:this.headers,jwt:(a=(s=o.session)===null||s===void 0?void 0:s.access_token)!==null&&a!==void 0?a:void 0})})}catch(n){if(Js(n))return{data:null,error:n};throw n}}async _refreshAccessToken(e){const n=`#_refreshAccessToken(${e.substring(0,5)}...)`;this._debug(n,"begin");try{const s=Date.now();return await Ytt(async a=>(a>0&&await Ztt(200*Math.pow(2,a-1)),this._debug(n,"refreshing attempt",a),await Aa(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:e},headers:this.headers,xform:Up})),(a,o)=>{const l=200*Math.pow(2,a);return o&&Tle(o)&&Date.now()+l-s{try{await i.callback(e,n)}catch(h){o.push(h)}});if(await Promise.all(l),o.length>0){for(let i=0;ithis._autoRefreshTokenTick(),g4);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)/g4);this._debug("#_autoRefreshTokenTick()",`access token expires in ${a} ticks, a tick lasts ${g4}ms, refresh threshold is ${Gue} ticks`),a<=Gue&&await this._callRefreshToken(s.refresh_token)})}catch(n){console.error("Auto refresh tick failed with error. This is likely a transient error.",n)}}finally{this._debug("#_autoRefreshTokenTick()","end")}})}catch(e){if(e.isAcquireTimeout||e instanceof OIe)this._debug("auto refresh token tick lock not available");else throw e}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!Nu()||!(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 XN(this.storage,this.storageKey),i=new URLSearchParams({code_challenge:`${encodeURIComponent(o)}`,code_challenge_method:`${encodeURIComponent(l)}`});a.push(i.toString())}if(s!=null&&s.queryParams){const o=new URLSearchParams(s.queryParams);a.push(o.toString())}return s!=null&&s.skipBrowserRedirect&&a.push(`skip_http_redirect=${s.skipBrowserRedirect}`),`${e}?${a.join("&")}`}async _unenroll(e){try{return await this._useSession(async n=>{var s;const{data:a,error:o}=n;return o?{data:null,error:o}:await Aa(this.fetch,"DELETE",`${this.url}/factors/${e.factorId}`,{headers:this.headers,jwt:(s=a==null?void 0:a.session)===null||s===void 0?void 0:s.access_token})})}catch(n){if(Js(n))return{data:null,error:n};throw n}}async _enroll(e){try{return await this._useSession(async n=>{var s,a;const{data:o,error:l}=n;if(l)return{data:null,error:l};const i=Object.assign({friendly_name:e.friendlyName,factor_type:e.factorType},e.factorType==="phone"?{phone:e.phone}:e.factorType==="totp"?{issuer:e.issuer}:{}),{data:h,error:p}=await Aa(this.fetch,"POST",`${this.url}/factors`,{body:i,headers:this.headers,jwt:(s=o==null?void 0:o.session)===null||s===void 0?void 0:s.access_token});return p?{data:null,error:p}:(e.factorType==="totp"&&h.type==="totp"&&(!((a=h==null?void 0:h.totp)===null||a===void 0)&&a.qr_code)&&(h.totp.qr_code=`data:image/svg+xml;utf-8,${h.totp.qr_code}`),{data:h,error:null})})}catch(n){if(Js(n))return{data:null,error:n};throw n}}async _verify(e){return this._acquireLock(-1,async()=>{try{return await this._useSession(async n=>{var s;const{data:a,error:o}=n;if(o)return{data:null,error:o};const l=Object.assign({challenge_id:e.challengeId},"webauthn"in e?{webauthn:Object.assign(Object.assign({},e.webauthn),{credential_response:e.webauthn.type==="create"?Srt(e.webauthn.credential_response):Crt(e.webauthn.credential_response)})}:{code:e.code}),{data:i,error:h}=await Aa(this.fetch,"POST",`${this.url}/factors/${e.factorId}/verify`,{body:l,headers:this.headers,jwt:(s=a==null?void 0:a.session)===null||s===void 0?void 0:s.access_token});return h?{data:null,error:h}:(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+i.expires_in},i)),await this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",i),{data:i,error:h})})}catch(n){if(Js(n))return{data:null,error:n};throw n}})}async _challenge(e){return this._acquireLock(-1,async()=>{try{return await this._useSession(async n=>{var s;const{data:a,error:o}=n;if(o)return{data:null,error:o};const l=await Aa(this.fetch,"POST",`${this.url}/factors/${e.factorId}/challenge`,{body:e,headers:this.headers,jwt:(s=a==null?void 0:a.session)===null||s===void 0?void 0:s.access_token});if(l.error)return l;const{data:i}=l;if(i.type!=="webauthn")return{data:i,error:null};switch(i.webauthn.type){case"create":return{data:Object.assign(Object.assign({},i),{webauthn:Object.assign(Object.assign({},i.webauthn),{credential_options:Object.assign(Object.assign({},i.webauthn.credential_options),{publicKey:krt(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:Nrt(i.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(n){if(Js(n))return{data:null,error:n};throw n}})}async _challengeAndVerify(e){const{data:n,error:s}=await this._challenge({factorId:e.factorId});return s?{data:null,error:s}:await this._verify({factorId:e.factorId,challengeId:n.id,code:e.code})}async _listFactors(){var e;const{data:{user:n},error:s}=await this.getUser();if(s)return{data:null,error:s};const a={all:[],phone:[],totp:[],webauthn:[]};for(const o of(e=n==null?void 0:n.factors)!==null&&e!==void 0?e:[])a.all.push(o),o.status==="verified"&&a[o.factor_type].push(o);return{data:a,error:null}}async _getAuthenticatorAssuranceLevel(){var e,n;const{data:{session:s},error:a}=await this.getSession();if(a)return{data:null,error:a};if(!s)return{data:{currentLevel:null,nextLevel:null,currentAuthenticationMethods:[]},error:null};const{payload:o}=Ale(s.access_token);let l=null;o.aal&&(l=o.aal);let i=l;((n=(e=s.user.factors)===null||e===void 0?void 0:e.filter(x=>x.status==="verified"))!==null&&n!==void 0?n:[]).length>0&&(i="aal2");const p=o.amr||[];return{data:{currentLevel:l,nextLevel:i,currentAuthenticationMethods:p},error:null}}async _getAuthorizationDetails(e){try{return await this._useSession(async n=>{const{data:{session:s},error:a}=n;return a?{data:null,error:a}:s?await Aa(this.fetch,"GET",`${this.url}/oauth/authorizations/${e}`,{headers:this.headers,jwt:s.access_token,xform:o=>({data:o,error:null})}):{data:null,error:new $p}})}catch(n){if(Js(n))return{data:null,error:n};throw n}}async _approveAuthorization(e,n){try{return await this._useSession(async s=>{const{data:{session:a},error:o}=s;if(o)return{data:null,error:o};if(!a)return{data:null,error:new $p};const l=await Aa(this.fetch,"POST",`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:a.access_token,body:{action:"approve"},xform:i=>({data:i,error:null})});return l.data&&l.data.redirect_url&&Nu()&&!(n!=null&&n.skipBrowserRedirect)&&window.location.assign(l.data.redirect_url),l})}catch(s){if(Js(s))return{data:null,error:s};throw s}}async _denyAuthorization(e,n){try{return await this._useSession(async s=>{const{data:{session:a},error:o}=s;if(o)return{data:null,error:o};if(!a)return{data:null,error:new $p};const l=await Aa(this.fetch,"POST",`${this.url}/oauth/authorizations/${e}/consent`,{headers:this.headers,jwt:a.access_token,body:{action:"deny"},xform:i=>({data:i,error:null})});return l.data&&l.data.redirect_url&&Nu()&&!(n!=null&&n.skipBrowserRedirect)&&window.location.assign(l.data.redirect_url),l})}catch(s){if(Js(s))return{data:null,error:s};throw s}}async fetchJwk(e,n={keys:[]}){let s=n.keys.find(i=>i.kid===e);if(s)return s;const a=Date.now();if(s=this.jwks.keys.find(i=>i.kid===e),s&&this.jwks_cached_at+Ott>a)return s;const{data:o,error:l}=await Aa(this.fetch,"GET",`${this.url}/.well-known/jwks.json`,{headers:this.headers});if(l)throw l;return!o.keys||o.keys.length===0||(this.jwks=o,this.jwks_cached_at=a,s=o.keys.find(i=>i.kid===e),!s)?null:s}async getClaims(e,n={}){try{let s=e;if(!s){const{data:j,error:C}=await this.getSession();if(C||!j.session)return{data:null,error:C};s=j.session.access_token}const{header:a,payload:o,signature:l,raw:{header:i,payload:h}}=Ale(s);n!=null&&n.allowExpired||nrt(o.exp);const p=!a.alg||a.alg.startsWith("HS")||!a.kid||!("crypto"in globalThis&&"subtle"in globalThis.crypto)?null:await this.fetchJwk(a.kid,n!=null&&n.keys?{keys:n.keys}:n==null?void 0:n.jwks);if(!p){const{error:j}=await this.getUser(s);if(j)throw j;return{data:{claims:o,header:a,signature:l},error:null}}const x=srt(a.alg),y=await crypto.subtle.importKey("jwk",p,x,!0,["verify"]);if(!await crypto.subtle.verify(x,y,l,Vtt(`${i}.${h}`)))throw new Yue("Invalid JWT signature");return{data:{claims:o,header:a,signature:l},error:null}}catch(s){if(Js(s))return{data:null,error:s};throw s}}}XA.nextInstanceID=0;const Drt=XA;class Rrt extends Drt{constructor(e){super(e)}}class Frt{constructor(e,n,s){var a,o,l;this.supabaseUrl=e,this.supabaseKey=n;const i=Att(e);if(!n)throw new Error("supabaseKey is required.");this.realtimeUrl=new URL("realtime/v1",i),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",i),this.storageUrl=new URL("storage/v1",i),this.functionsUrl=new URL("functions/v1",i);const h=`sb-${i.hostname.split(".")[0]}-auth-token`,p={db:wtt,realtime:ktt,auth:Object.assign(Object.assign({},jtt),{storageKey:h}),global:btt},x=Ttt(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,b)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(b)} is not possible`)}})):this.auth=this._initSupabaseAuthClient((l=x.auth)!==null&&l!==void 0?l:{},this.headers,x.global.fetch),this.fetch=Ctt(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 Eet(new URL("rest/v1",i).href,{headers:this.headers,schema:x.db.schema,fetch:this.fetch}),this.storage=new ytt(this.storageUrl.href,this.headers,this.fetch,s==null?void 0:s.storage),x.accessToken||this._listenForAuthEvents()}get functions(){return new wet(this.functionsUrl.href,{headers:this.headers,customFetch:this.fetch})}from(e){return this.rest.from(e)}schema(e){return this.rest.schema(e)}rpc(e,n={},s={head:!1,get:!1,count:void 0}){return this.rest.rpc(e,n,s)}channel(e,n={config:{}}){return this.realtime.channel(e,n)}getChannels(){return this.realtime.getChannels()}removeChannel(e){return this.realtime.removeChannel(e)}removeAllChannels(){return this.realtime.removeAllChannels()}async _getAccessToken(){var e,n;if(this.accessToken)return await this.accessToken();const{data:s}=await this.auth.getSession();return(n=(e=s.session)===null||e===void 0?void 0:e.access_token)!==null&&n!==void 0?n:this.supabaseKey}_initSupabaseAuthClient({autoRefreshToken:e,persistSession:n,detectSessionInUrl:s,storage:a,userStorage:o,storageKey:l,flowType:i,lock:h,debug:p},x,y){const b={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new Rrt({url:this.authUrl.href,headers:Object.assign(Object.assign({},b),x),storageKey:l,autoRefreshToken:e,persistSession:n,detectSessionInUrl:s,storage:a,userStorage:o,flowType:i,lock:h,debug:p,fetch:y,hasCustomAuthorizationHeader:Object.keys(this.headers).some(j=>j.toLowerCase()==="authorization")})}_initRealtimeClient(e){return new Ket(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 zrt=(t,e,n)=>new Frt(t,e,n);function Brt(){if(typeof window<"u"||typeof process>"u")return!1;const t=process.version;if(t==null)return!1;const e=t.match(/^v(\d+)\./);return e?parseInt(e[1],10)<=18:!1}Brt()&&console.warn("⚠️ Node.js 18 and below are deprecated and will no longer be supported in future versions of @supabase/supabase-js. Please upgrade to Node.js 20 or later. For more information, visit: https://github.com/orgs/supabase/discussions/37217");const $rt="https://relzejiswnotikjgvjhz.supabase.co",Urt="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InJlbHplamlzd25vdGlramd2amh6Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3NjE5NTAzNDQsImV4cCI6MjA3NzUyNjM0NH0.dzIkIr_oFSbFE3oWS0ktIr83iKHHkZxt40Gc7SpC_mM",J=zrt($rt,Urt,{auth:{storage:localStorage,persistSession:!0,autoRefreshToken:!0}}),FIe=I.createContext(void 0),qrt=({children:t})=>{const[e,n]=I.useState(null),[s,a]=I.useState(null),[o,l]=I.useState(!0),[i,h]=I.useState(!1),[p,x]=I.useState(!1),[y,b]=I.useState(null),[j,C]=I.useState([]),[N,A]=I.useState(null),E=rs(),T=async q=>{try{console.log("Checking roles via RPC for user:",q);const[{data:H,error:Z},{data:G,error:te}]=await Promise.all([J.rpc("has_role",{_user_id:q,_role:"admin"}),J.rpc("has_role",{_user_id:q,_role:"brokerage_manager"})]);if(Z||te)console.error("Role RPC errors:",{isAdminError:Z,isBrokerError:te}),h(!1),x(!1);else{const ye=!!H,ne=!!G;console.log("RPC roles result:",{adminValue:ye,brokerValue:ne}),h(ye),x(ne)}const{data:ie,error:le}=await J.from("profiles").select("brokerage_id").eq("id",q).single();if(b(!le&&ie?ie.brokerage_id:null),G){console.log("Fetching managed brokerages for user:",q);const{data:ye,error:ne}=await J.from("brokerage_manager_assignments").select("brokerage_id").eq("user_id",q);if(console.log("Managed brokerage assignments result:",{assignments:ye,assignmentsError:ne}),ne||!ye){console.error("Error fetching managed brokerage assignments:",ne),C([]);return}const ge=Array.from(new Set(ye.map(_e=>_e.brokerage_id).filter(Boolean)));if(ge.length===0){C([]);return}const{data:ae,error:he}=await J.from("brokerages").select("id, name").in("id",ge);if(console.log("Managed brokerages details result:",{brokeragesData:ae,brokeragesError:he}),he||!ae){console.error("Error fetching managed brokerages details:",he),C([]);return}const ue=ae.map(_e=>({id:_e.id,name:_e.name})).sort((_e,Ae)=>ge.indexOf(_e.id)-ge.indexOf(Ae.id));console.log("Parsed managed brokerages:",ue),C(ue),ue.length>0&&!N&&A(ue[0].id)}else console.log("User is not a brokerage manager, skipping managed brokerages fetch"),C([])}catch(H){console.error("Unexpected error in checkRoles:",H),h(!1),x(!1),b(null),C([])}};I.useEffect(()=>{const{data:{subscription:q}}=J.auth.onAuthStateChange((H,Z)=>{console.log("Auth event:",H),a(Z),n((Z==null?void 0:Z.user)??null),H==="PASSWORD_RECOVERY"&&(console.log("Password recovery detected, redirecting to profile"),setTimeout(()=>{E("/profile?reset=true")},100)),Z!=null&&Z.user?setTimeout(()=>{T(Z.user.id)},0):(h(!1),x(!1),b(null),C([]),A(null))});return J.auth.getSession().then(({data:{session:H}})=>{a(H),n((H==null?void 0:H.user)??null),H!=null&&H.user?T(H.user.id).finally(()=>{l(!1)}):l(!1)}),()=>q.unsubscribe()},[]);const L=async(q,H)=>{const{error:Z}=await J.auth.signInWithPassword({email:q,password:H});if(Z)throw ze.error(Z.message),Z;ze.success("Welcome back!"),E("/dashboard")},z=async(q,H,Z)=>{const G=`${window.location.origin}/dashboard`,{error:te}=await J.auth.signUp({email:q,password:H,options:{emailRedirectTo:G,data:{name:Z}}});if(te)throw ze.error(te.message),te;ze.success("Account created! Welcome to LevelUp."),E("/dashboard")},F=async()=>{try{const{data:{session:q}}=await J.auth.getSession();if(q){const{error:H}=await J.auth.signOut();H?H.message==="Auth session missing!"?console.warn("Sign out warning (ignored):",H.message):(console.error("Sign out error:",H),ze.error(H.message)):ze.success("Signed out successfully")}else console.log("No active session found, redirecting to auth");n(null),a(null),h(!1),x(!1),b(null),C([]),A(null),E("/auth")}catch(q){console.error("Unexpected sign out error:",q),E("/auth")}};return r.jsx(FIe.Provider,{value:{user:e,session:s,loading:o,signIn:L,signUp:z,signOut:F,isAdmin:i,isBrokerageManager:p,brokerageId:y,managedBrokerages:j,selectedBrokerageId:N,setSelectedBrokerageId:A},children:t})},Qr=()=>{const t=I.useContext(FIe);if(t===void 0)throw new Error("useAuth must be used within an AuthProvider");return t},zIe=I.createContext(void 0),t4="levelup_admin_session",a_="levelup_impersonation",Vrt=({children:t})=>{const[e,n]=I.useState(!1),[s,a]=I.useState(null),[o,l]=I.useState(!1);I.useEffect(()=>{const p=sessionStorage.getItem(a_);if(p)try{const x=JSON.parse(p);n(!0),a(x)}catch{sessionStorage.removeItem(a_)}},[]);const i=async p=>{l(!0);try{const{data:{session:x}}=await J.auth.getSession();if(!x)return ze.error("No active session found"),!1;const y={access_token:x.access_token,refresh_token:x.refresh_token};sessionStorage.setItem(t4,JSON.stringify(y));const b=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/impersonate-user",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${x.access_token}`},body:JSON.stringify({targetUserId:p})}),j=await b.json();if(!b.ok)throw new Error(j.error||"Failed to impersonate user");const C={id:j.targetUser.id,name:j.targetUser.name,email:j.targetUser.email};sessionStorage.setItem(a_,JSON.stringify(C));const{error:N}=await J.auth.verifyOtp({token_hash:j.token_hash,type:"magiclink"});if(N)throw console.error("Verify OTP error:",N),sessionStorage.removeItem(t4),sessionStorage.removeItem(a_),new Error("Failed to establish impersonation session");return n(!0),a(C),ze.success(`Now viewing as ${C.name}`),window.location.href="/dashboard",!0}catch(x){return console.error("Impersonation error:",x),ze.error(x.message||"Failed to impersonate user"),sessionStorage.removeItem(t4),sessionStorage.removeItem(a_),!1}finally{l(!1)}},h=async()=>{l(!0);try{const p=sessionStorage.getItem(t4);if(!p){await J.auth.signOut(),window.location.href="/auth";return}const x=JSON.parse(p);await J.auth.signOut();const{error:y}=await J.auth.setSession({access_token:x.access_token,refresh_token:x.refresh_token});if(sessionStorage.removeItem(t4),sessionStorage.removeItem(a_),y){console.error("Failed to restore admin session:",y),ze.error("Admin session expired, please sign in again"),window.location.href="/auth";return}n(!1),a(null),ze.success("Returned to admin account"),window.location.href="/admin/members"}catch(p){console.error("Stop impersonation error:",p),ze.error("Failed to restore admin session"),sessionStorage.removeItem(t4),sessionStorage.removeItem(a_),window.location.href="/auth"}finally{l(!1)}};return r.jsx(zIe.Provider,{value:{isImpersonating:e,impersonatedUser:s,startImpersonation:i,stopImpersonation:h,isLoading:o},children:t})},BIe=()=>{const t=I.useContext(zIe);if(t===void 0)throw new Error("useImpersonation must be used within an ImpersonationProvider");return t},QA=KC("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-full text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-full px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),ee=I.forwardRef(({className:t,variant:e,size:n,asChild:s=!1,...a},o)=>{const l=s?Dme:"button";return r.jsx(l,{className:$t(QA({variant:e,size:n,className:t})),ref:o,...a})});ee.displayName="Button";const Hrt=()=>{const{isImpersonating:t,impersonatedUser:e,stopImpersonation:n,isLoading:s}=BIe();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(Vh,{className:"h-5 w-5 flex-shrink-0"}),r.jsxs("span",{className:"font-medium text-sm md:text-base",children:[r.jsx("span",{className:"hidden sm:inline",children:"You are viewing as "}),r.jsx("strong",{children:e.name}),r.jsxs("span",{className:"hidden md:inline text-amber-800",children:[" (",e.email,")"]})]})]}),r.jsx(ee,{size:"sm",variant:"secondary",onClick:n,disabled:s,className:"bg-amber-100 hover:bg-amber-200 text-amber-950 border-0",children:s?r.jsx(en,{className:"h-4 w-4 animate-spin"}):r.jsxs(r.Fragment,{children:[r.jsx(_s,{className:"h-4 w-4 mr-1"}),r.jsx("span",{className:"hidden sm:inline",children:"Exit Impersonation"}),r.jsx("span",{className:"sm:hidden",children:"Exit"})]})})]})})},$Ie=I.createContext(void 0),EM="levelup_acting_as",Wrt=({children:t})=>{const{user:e}=Qr(),[n,s]=I.useState(!1),[a,o]=I.useState([]),[l,i]=I.useState(null),[h,p]=I.useState({}),[x,y]=I.useState(!0);I.useEffect(()=>{if(!(e!=null&&e.id)){s(!1),o([]),i(null),p({}),y(!1);return}(async()=>{y(!0);try{const{data:A}=await J.rpc("has_role",{_user_id:e.id,_role:"assistant"});if(!A){s(!1),o([]),i(null),p({}),y(!1);return}s(!0);const{data:E,error:T}=await J.from("agent_assistant_assignments").select("agent_id, permissions").eq("assistant_id",e.id);if(T||!E||E.length===0){o([]),y(!1);return}const L=E.map(H=>H.agent_id),{data:z}=await J.from("profiles").select("id, name, email, avatar_url").in("id",L),F=(z||[]).map(H=>({id:H.id,name:H.name||H.email||"Unknown",email:H.email||"",avatar_url:H.avatar_url}));o(F);const q=sessionStorage.getItem(EM);if(q){const H=F.find(Z=>Z.id===q);if(H){i(H);const Z=E.find(G=>G.agent_id===q);p((Z==null?void 0:Z.permissions)||{})}else if(F.length>0){i(F[0]);const Z=E.find(G=>G.agent_id===F[0].id);p((Z==null?void 0:Z.permissions)||{}),sessionStorage.setItem(EM,F[0].id)}}else if(F.length>0){i(F[0]);const H=E.find(Z=>Z.agent_id===F[0].id);p((H==null?void 0:H.permissions)||{}),sessionStorage.setItem(EM,F[0].id)}}catch(A){console.error("Error loading assistant data:",A)}finally{y(!1)}})()},[e==null?void 0:e.id]);const b=N=>{i(N),N?(sessionStorage.setItem(EM,N.id),J.from("agent_assistant_assignments").select("permissions").eq("assistant_id",(e==null?void 0:e.id)||"").eq("agent_id",N.id).single().then(({data:A})=>{p((A==null?void 0:A.permissions)||{})})):(sessionStorage.removeItem(EM),p({}))},j=N=>n?h[N]===!0:!0,C=n&&l?l.id:(e==null?void 0:e.id)||null;return r.jsx($Ie.Provider,{value:{isAssistant:n,assignedAgents:a,actingAsAgent:l,setActingAsAgent:b,effectiveUserId:C,permissions:h,hasPermission:j,isLoading:x},children:t})},xge=()=>{const t=I.useContext($Ie);if(t===void 0)throw new Error("useActingAs must be used within an ActingAsProvider");return t},Pc=()=>{const{effectiveUserId:t}=xge();return t};var UIe={exports:{}},qIe={};/** * @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 iC=I;function Grt(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var Krt=typeof Object.is=="function"?Object.is:Grt,Zrt=iC.useState,Yrt=iC.useEffect,Xrt=iC.useLayoutEffect,Qrt=iC.useDebugValue;function Jrt(t,e){var n=e(),s=Zrt({inst:{value:n,getSnapshot:e}}),a=s[0].inst,o=s[1];return Xrt(function(){a.value=n,a.getSnapshot=e,Ple(a)&&o({inst:a})},[t,n,e]),Yrt(function(){return Ple(a)&&o({inst:a}),t(function(){Ple(a)&&o({inst:a})})},[t]),Qrt(n),n}function Ple(t){var e=t.getSnapshot;t=t.value;try{var n=e();return!Krt(t,n)}catch{return!0}}function ent(t,e){return e()}var tnt=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?ent:Jrt;qIe.useSyncExternalStore=iC.useSyncExternalStore!==void 0?iC.useSyncExternalStore:tnt;UIe.exports=qIe;var rnt=UIe.exports;function nnt(){return rnt.useSyncExternalStore(snt,()=>!0,()=>!1)}function snt(){return()=>{}}var yge="Avatar",[ant]=tc(yge),[int,VIe]=ant(yge),HIe=I.forwardRef((t,e)=>{const{__scopeAvatar:n,...s}=t,[a,o]=I.useState("idle");return r.jsx(int,{scope:n,imageLoadingStatus:a,onImageLoadingStatusChange:o,children:r.jsx(Rn.span,{...s,ref:e})})});HIe.displayName=yge;var WIe="AvatarImage",GIe=I.forwardRef((t,e)=>{const{__scopeAvatar:n,src:s,onLoadingStatusChange:a=()=>{},...o}=t,l=VIe(WIe,n),i=ont(s,o),h=Xl(p=>{a(p),l.onImageLoadingStatusChange(p)});return Jl(()=>{i!=="idle"&&h(i)},[i,h]),i==="loaded"?r.jsx(Rn.img,{...o,ref:e,src:s}):null});GIe.displayName=WIe;var KIe="AvatarFallback",ZIe=I.forwardRef((t,e)=>{const{__scopeAvatar:n,delayMs:s,...a}=t,o=VIe(KIe,n),[l,i]=I.useState(s===void 0);return I.useEffect(()=>{if(s!==void 0){const h=window.setTimeout(()=>i(!0),s);return()=>window.clearTimeout(h)}},[s]),l&&o.imageLoadingStatus!=="loaded"?r.jsx(Rn.span,{...a,ref:e}):null});ZIe.displayName=KIe;function tje(t,e){return t?e?(t.src!==e&&(t.src=e),t.complete&&t.naturalWidth>0?"loaded":"loading"):"error":"idle"}function ont(t,{referrerPolicy:e,crossOrigin:n}){const s=nnt(),a=I.useRef(null),o=s?(a.current||(a.current=new window.Image),a.current):null,[l,i]=I.useState(()=>tje(o,t));return Jl(()=>{i(tje(o,t))},[o,t]),Jl(()=>{const h=y=>()=>{i(y)};if(!o)return;const p=h("loaded"),x=h("error");return o.addEventListener("load",p),o.addEventListener("error",x),e&&(o.referrerPolicy=e),typeof n=="string"&&(o.crossOrigin=n),()=>{o.removeEventListener("load",p),o.removeEventListener("error",x)}},[o,n,e]),l}var YIe=HIe,XIe=GIe,QIe=ZIe;const Ks=I.forwardRef(({className:t,...e},n)=>r.jsx(YIe,{ref:n,className:$t("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",t),...e}));Ks.displayName=YIe.displayName;const Ei=I.forwardRef(({className:t,...e},n)=>r.jsx(XIe,{ref:n,className:$t("aspect-square h-full w-full",t),...e}));Ei.displayName=XIe.displayName;const Zs=I.forwardRef(({className:t,...e},n)=>r.jsx(QIe,{ref:n,className:$t("flex h-full w-full items-center justify-center rounded-full bg-muted",t),...e}));Zs.displayName=QIe.displayName;const lnt=KC("inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function Ot({className:t,variant:e,...n}){return r.jsx("div",{className:$t(lnt({variant:e}),t),...n})}var cnt=I.createContext(void 0);function ik(t){const e=I.useContext(cnt);return t||e||"ltr"}var Lle=0;function Dne(){I.useEffect(()=>{const t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??rje()),document.body.insertAdjacentElement("beforeend",t[1]??rje()),Lle++,()=>{Lle===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),Lle--}},[])}function rje(){const t=document.createElement("span");return t.setAttribute("data-radix-focus-guard",""),t.tabIndex=0,t.style.outline="none",t.style.opacity="0",t.style.position="fixed",t.style.pointerEvents="none",t}var Ole="focusScope.autoFocusOnMount",Dle="focusScope.autoFocusOnUnmount",nje={bubbles:!1,cancelable:!0},dnt="FocusScope",xI=I.forwardRef((t,e)=>{const{loop:n=!1,trapped:s=!1,onMountAutoFocus:a,onUnmountAutoFocus:o,...l}=t,[i,h]=I.useState(null),p=Xl(a),x=Xl(o),y=I.useRef(null),b=ta(e,N=>h(N)),j=I.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;I.useEffect(()=>{if(s){let N=function(L){if(j.paused||!i)return;const z=L.target;i.contains(z)?y.current=z:d0(y.current,{select:!0})},A=function(L){if(j.paused||!i)return;const z=L.relatedTarget;z!==null&&(i.contains(z)||d0(y.current,{select:!0}))},E=function(L){if(document.activeElement===document.body)for(const F of L)F.removedNodes.length>0&&d0(i)};document.addEventListener("focusin",N),document.addEventListener("focusout",A);const T=new MutationObserver(E);return i&&T.observe(i,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",N),document.removeEventListener("focusout",A),T.disconnect()}}},[s,i,j.paused]),I.useEffect(()=>{if(i){aje.add(j);const N=document.activeElement;if(!i.contains(N)){const E=new CustomEvent(Ole,nje);i.addEventListener(Ole,p),i.dispatchEvent(E),E.defaultPrevented||(unt(gnt(JIe(i)),{select:!0}),document.activeElement===N&&d0(i))}return()=>{i.removeEventListener(Ole,p),setTimeout(()=>{const E=new CustomEvent(Dle,nje);i.addEventListener(Dle,x),i.dispatchEvent(E),E.defaultPrevented||d0(N??document.body,{select:!0}),i.removeEventListener(Dle,x),aje.remove(j)},0)}}},[i,p,x,j]);const C=I.useCallback(N=>{if(!n&&!s||j.paused)return;const A=N.key==="Tab"&&!N.altKey&&!N.ctrlKey&&!N.metaKey,E=document.activeElement;if(A&&E){const T=N.currentTarget,[L,z]=hnt(T);L&&z?!N.shiftKey&&E===z?(N.preventDefault(),n&&d0(L,{select:!0})):N.shiftKey&&E===L&&(N.preventDefault(),n&&d0(z,{select:!0})):E===T&&N.preventDefault()}},[n,s,j.paused]);return r.jsx(Rn.div,{tabIndex:-1,...l,ref:b,onKeyDown:C})});xI.displayName=dnt;function unt(t,{select:e=!1}={}){const n=document.activeElement;for(const s of t)if(d0(s,{select:e}),document.activeElement!==n)return}function hnt(t){const e=JIe(t),n=sje(e,t),s=sje(e.reverse(),t);return[n,s]}function JIe(t){const e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:s=>{const a=s.tagName==="INPUT"&&s.type==="hidden";return s.disabled||s.hidden||a?NodeFilter.FILTER_SKIP:s.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)e.push(n.currentNode);return e}function sje(t,e){for(const n of t)if(!fnt(n,{upTo:e}))return n}function fnt(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 pnt(t){return t instanceof HTMLInputElement&&"select"in t}function d0(t,{select:e=!1}={}){if(t&&t.focus){const n=document.activeElement;t.focus({preventScroll:!0}),t!==n&&pnt(t)&&e&&t.select()}}var aje=mnt();function mnt(){let t=[];return{add(e){const n=t[0];e!==n&&(n==null||n.pause()),t=ije(t,e),t.unshift(e)},remove(e){var n;t=ije(t,e),(n=t[0])==null||n.resume()}}}function ije(t,e){const n=[...t],s=n.indexOf(e);return s!==-1&&n.splice(s,1),n}function gnt(t){return t.filter(e=>e.tagName!=="A")}var Rle="rovingFocusGroup.onEntryFocus",xnt={bubbles:!1,cancelable:!0},yI="RovingFocusGroup",[Xue,ePe,ynt]=lI(yI),[vnt,a3]=tc(yI,[ynt]),[_nt,bnt]=vnt(yI),tPe=I.forwardRef((t,e)=>r.jsx(Xue.Provider,{scope:t.__scopeRovingFocusGroup,children:r.jsx(Xue.Slot,{scope:t.__scopeRovingFocusGroup,children:r.jsx(wnt,{...t,ref:e})})}));tPe.displayName=yI;var wnt=I.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,orientation:s,loop:a=!1,dir:o,currentTabStopId:l,defaultCurrentTabStopId:i,onCurrentTabStopIdChange:h,onEntryFocus:p,preventScrollOnEntryFocus:x=!1,...y}=t,b=I.useRef(null),j=ta(e,b),C=ik(o),[N,A]=Fu({prop:l,defaultProp:i??null,onChange:h,caller:yI}),[E,T]=I.useState(!1),L=Xl(p),z=ePe(n),F=I.useRef(!1),[q,H]=I.useState(0);return I.useEffect(()=>{const Z=b.current;if(Z)return Z.addEventListener(Rle,L),()=>Z.removeEventListener(Rle,L)},[L]),r.jsx(_nt,{scope:n,orientation:s,dir:C,loop:a,currentTabStopId:N,onItemFocus:I.useCallback(Z=>A(Z),[A]),onItemShiftTab:I.useCallback(()=>T(!0),[]),onFocusableItemAdd:I.useCallback(()=>H(Z=>Z+1),[]),onFocusableItemRemove:I.useCallback(()=>H(Z=>Z-1),[]),children:r.jsx(Rn.div,{tabIndex:E||q===0?-1:0,"data-orientation":s,...y,ref:j,style:{outline:"none",...t.style},onMouseDown:an(t.onMouseDown,()=>{F.current=!0}),onFocus:an(t.onFocus,Z=>{const G=!F.current;if(Z.target===Z.currentTarget&&G&&!E){const te=new CustomEvent(Rle,xnt);if(Z.currentTarget.dispatchEvent(te),!te.defaultPrevented){const ie=z().filter(ae=>ae.focusable),le=ie.find(ae=>ae.active),ye=ie.find(ae=>ae.id===N),ge=[le,ye,...ie].filter(Boolean).map(ae=>ae.ref.current);sPe(ge,x)}}F.current=!1}),onBlur:an(t.onBlur,()=>T(!1))})})}),rPe="RovingFocusGroupItem",nPe=I.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,focusable:s=!0,active:a=!1,tabStopId:o,children:l,...i}=t,h=Gc(),p=o||h,x=bnt(rPe,n),y=x.currentTabStopId===p,b=ePe(n),{onFocusableItemAdd:j,onFocusableItemRemove:C,currentTabStopId:N}=x;return I.useEffect(()=>{if(s)return j(),()=>C()},[s,j,C]),r.jsx(Xue.ItemSlot,{scope:n,id:p,focusable:s,active:a,children:r.jsx(Rn.span,{tabIndex:y?0:-1,"data-orientation":x.orientation,...i,ref:e,onMouseDown:an(t.onMouseDown,A=>{s?x.onItemFocus(p):A.preventDefault()}),onFocus:an(t.onFocus,()=>x.onItemFocus(p)),onKeyDown:an(t.onKeyDown,A=>{if(A.key==="Tab"&&A.shiftKey){x.onItemShiftTab();return}if(A.target!==A.currentTarget)return;const E=Nnt(A,x.orientation,x.dir);if(E!==void 0){if(A.metaKey||A.ctrlKey||A.altKey||A.shiftKey)return;A.preventDefault();let L=b().filter(z=>z.focusable).map(z=>z.ref.current);if(E==="last")L.reverse();else if(E==="prev"||E==="next"){E==="prev"&&L.reverse();const z=L.indexOf(A.currentTarget);L=x.loop?Snt(L,z+1):L.slice(z+1)}setTimeout(()=>sPe(L))}}),children:typeof l=="function"?l({isCurrentTabStop:y,hasTabStop:N!=null}):l})})});nPe.displayName=rPe;var jnt={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function knt(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function Nnt(t,e,n){const s=knt(t.key,n);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(s))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(s)))return jnt[s]}function sPe(t,e=!1){const n=document.activeElement;for(const s of t)if(s===n||(s.focus({preventScroll:e}),document.activeElement!==n))return}function Snt(t,e){return t.map((n,s)=>t[(e+s)%t.length])}var vge=tPe,_ge=nPe,Cnt=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},r4=new WeakMap,xL=new WeakMap,yL={},Fle=0,aPe=function(t){return t&&(t.host||aPe(t.parentNode))},Mnt=function(t,e){return e.map(function(n){if(t.contains(n))return n;var s=aPe(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})},Tnt=function(t,e,n,s){var a=Mnt(e,Array.isArray(t)?t:[t]);yL[n]||(yL[n]=new WeakMap);var o=yL[n],l=[],i=new Set,h=new Set(a),p=function(y){!y||i.has(y)||(i.add(y),p(y.parentNode))};a.forEach(p);var x=function(y){!y||h.has(y)||Array.prototype.forEach.call(y.children,function(b){if(i.has(b))x(b);else try{var j=b.getAttribute(s),C=j!==null&&j!=="false",N=(r4.get(b)||0)+1,A=(o.get(b)||0)+1;r4.set(b,N),o.set(b,A),l.push(b),N===1&&C&&xL.set(b,!0),A===1&&b.setAttribute(n,"true"),C||b.setAttribute(s,"true")}catch(E){console.error("aria-hidden: cannot operate on ",b,E)}})};return x(e),i.clear(),Fle++,function(){l.forEach(function(y){var b=r4.get(y)-1,j=o.get(y)-1;r4.set(y,b),o.set(y,j),b||(xL.has(y)||y.removeAttribute(s),xL.delete(y)),j||y.removeAttribute(n)}),Fle--,Fle||(r4=new WeakMap,r4=new WeakMap,xL=new WeakMap,yL={})}},Rne=function(t,e,n){n===void 0&&(n="data-aria-hidden");var s=Array.from(Array.isArray(t)?t:[t]),a=Cnt(t);return a?(s.push.apply(s,Array.from(a.querySelectorAll("[aria-live]"))),Tnt(s,a,n,"aria-hidden")):function(){return null}},ree="right-scroll-bar-position",nee="width-before-scroll-bar",Ant="with-scroll-bars-hidden",Ent="--removed-body-scroll-bar-size";function zle(t,e){return typeof t=="function"?t(e):t&&(t.current=e),t}function Int(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 Pnt=typeof window<"u"?I.useLayoutEffect:I.useEffect,oje=new WeakMap;function Lnt(t,e){var n=Int(null,function(s){return t.forEach(function(a){return zle(a,s)})});return Pnt(function(){var s=oje.get(n);if(s){var a=new Set(s),o=new Set(t),l=n.current;a.forEach(function(i){o.has(i)||zle(i,null)}),o.forEach(function(i){a.has(i)||zle(i,l)})}oje.set(n,t)},[t]),n}function Ont(t){return t}function Dnt(t,e){e===void 0&&(e=Ont);var n=[],s=!1,a={read:function(){if(s)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:t},useMedium:function(o){var l=e(o,s);return n.push(l),function(){n=n.filter(function(i){return i!==l})}},assignSyncMedium:function(o){for(s=!0;n.length;){var l=n;n=[],l.forEach(o)}n={push:function(i){return o(i)},filter:function(){return n}}},assignMedium:function(o){s=!0;var l=[];if(n.length){var i=n;n=[],i.forEach(o),l=n}var h=function(){var x=l;l=[],x.forEach(o)},p=function(){return Promise.resolve().then(h)};p(),n={push:function(x){l.push(x),p()},filter:function(x){return l=l.filter(x),n}}}};return a}function Rnt(t){t===void 0&&(t={});var e=Dnt(null);return e.options=$f({async:!0,ssr:!1},t),e}var iPe=function(t){var e=t.sideCar,n=rv(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,$f({},n))};iPe.isSideCarExport=!0;function Fnt(t,e){return t.useMedium(e),iPe}var oPe=Rnt(),Ble=function(){},Fne=I.forwardRef(function(t,e){var n=I.useRef(null),s=I.useState({onScrollCapture:Ble,onWheelCapture:Ble,onTouchMoveCapture:Ble}),a=s[0],o=s[1],l=t.forwardProps,i=t.children,h=t.className,p=t.removeScrollBar,x=t.enabled,y=t.shards,b=t.sideCar,j=t.noRelative,C=t.noIsolation,N=t.inert,A=t.allowPinchZoom,E=t.as,T=E===void 0?"div":E,L=t.gapMode,z=rv(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),F=b,q=Lnt([n,e]),H=$f($f({},z),a);return I.createElement(I.Fragment,null,x&&I.createElement(F,{sideCar:oPe,removeScrollBar:p,shards:y,noRelative:j,noIsolation:C,inert:N,setCallbacks:o,allowPinchZoom:!!A,lockRef:n,gapMode:L}),l?I.cloneElement(I.Children.only(i),$f($f({},H),{ref:q})):I.createElement(T,$f({},H,{className:h,ref:q}),i))});Fne.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Fne.classNames={fullWidth:nee,zeroRight:ree};var znt=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function Bnt(){if(!document)return null;var t=document.createElement("style");t.type="text/css";var e=znt();return e&&t.setAttribute("nonce",e),t}function $nt(t,e){t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e))}function Unt(t){var e=document.head||document.getElementsByTagName("head")[0];e.appendChild(t)}var qnt=function(){var t=0,e=null;return{add:function(n){t==0&&(e=Bnt())&&($nt(e,n),Unt(e)),t++},remove:function(){t--,!t&&e&&(e.parentNode&&e.parentNode.removeChild(e),e=null)}}},Vnt=function(){var t=qnt();return function(e,n){I.useEffect(function(){return t.add(e),function(){t.remove()}},[e&&n])}},lPe=function(){var t=Vnt(),e=function(n){var s=n.styles,a=n.dynamic;return t(s,a),null};return e},Hnt={left:0,top:0,right:0,gap:0},$le=function(t){return parseInt(t||"",10)||0},Wnt=function(t){var e=window.getComputedStyle(document.body),n=e[t==="padding"?"paddingLeft":"marginLeft"],s=e[t==="padding"?"paddingTop":"marginTop"],a=e[t==="padding"?"paddingRight":"marginRight"];return[$le(n),$le(s),$le(a)]},Gnt=function(t){if(t===void 0&&(t="margin"),typeof window>"u")return Hnt;var e=Wnt(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])}},Knt=lPe(),jS="data-scroll-locked",Znt=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(Ant,` { overflow: hidden `).concat(s,`; padding-right: `).concat(i,"px ").concat(s,`; } body[`).concat(jS,`] { 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(ree,` { right: `).concat(i,"px ").concat(s,`; } .`).concat(nee,` { margin-right: `).concat(i,"px ").concat(s,`; } .`).concat(ree," .").concat(ree,` { right: 0 `).concat(s,`; } .`).concat(nee," .").concat(nee,` { margin-right: 0 `).concat(s,`; } body[`).concat(jS,`] { `).concat(Ent,": ").concat(i,`px; } `)},lje=function(){var t=parseInt(document.body.getAttribute(jS)||"0",10);return isFinite(t)?t:0},Ynt=function(){I.useEffect(function(){return document.body.setAttribute(jS,(lje()+1).toString()),function(){var t=lje()-1;t<=0?document.body.removeAttribute(jS):document.body.setAttribute(jS,t.toString())}},[])},Xnt=function(t){var e=t.noRelative,n=t.noImportant,s=t.gapMode,a=s===void 0?"margin":s;Ynt();var o=I.useMemo(function(){return Gnt(a)},[a]);return I.createElement(Knt,{styles:Znt(o,!e,a,n?"":"!important")})},Que=!1;if(typeof window<"u")try{var vL=Object.defineProperty({},"passive",{get:function(){return Que=!0,!0}});window.addEventListener("test",vL,vL),window.removeEventListener("test",vL,vL)}catch{Que=!1}var n4=Que?{passive:!1}:!1,Qnt=function(t){return t.tagName==="TEXTAREA"},cPe=function(t,e){if(!(t instanceof Element))return!1;var n=window.getComputedStyle(t);return n[e]!=="hidden"&&!(n.overflowY===n.overflowX&&!Qnt(t)&&n[e]==="visible")},Jnt=function(t){return cPe(t,"overflowY")},est=function(t){return cPe(t,"overflowX")},cje=function(t,e){var n=e.ownerDocument,s=e;do{typeof ShadowRoot<"u"&&s instanceof ShadowRoot&&(s=s.host);var a=dPe(t,s);if(a){var o=uPe(t,s),l=o[1],i=o[2];if(l>i)return!0}s=s.parentNode}while(s&&s!==n.body);return!1},tst=function(t){var e=t.scrollTop,n=t.scrollHeight,s=t.clientHeight;return[e,n,s]},rst=function(t){var e=t.scrollLeft,n=t.scrollWidth,s=t.clientWidth;return[e,n,s]},dPe=function(t,e){return t==="v"?Jnt(e):est(e)},uPe=function(t,e){return t==="v"?tst(e):rst(e)},nst=function(t,e){return t==="h"&&e==="rtl"?-1:1},sst=function(t,e,n,s,a){var o=nst(t,window.getComputedStyle(e).direction),l=o*s,i=n.target,h=e.contains(i),p=!1,x=l>0,y=0,b=0;do{if(!i)break;var j=uPe(t,i),C=j[0],N=j[1],A=j[2],E=N-A-o*C;(C||E)&&dPe(t,i)&&(y+=E,b+=C);var T=i.parentNode;i=T&&T.nodeType===Node.DOCUMENT_FRAGMENT_NODE?T.host:T}while(!h&&i!==document.body||h&&(e.contains(i)||e===i));return(x&&Math.abs(y)<1||!x&&Math.abs(b)<1)&&(p=!0),p},_L=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},dje=function(t){return[t.deltaX,t.deltaY]},uje=function(t){return t&&"current"in t?t.current:t},ast=function(t,e){return t[0]===e[0]&&t[1]===e[1]},ist=function(t){return` .block-interactivity-`.concat(t,` {pointer-events: none;} .allow-interactivity-`).concat(t,` {pointer-events: all;} `)},ost=0,s4=[];function lst(t){var e=I.useRef([]),n=I.useRef([0,0]),s=I.useRef(),a=I.useState(ost++)[0],o=I.useState(lPe)[0],l=I.useRef(t);I.useEffect(function(){l.current=t},[t]),I.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(a));var N=lge([t.lockRef.current],(t.shards||[]).map(uje),!0).filter(Boolean);return N.forEach(function(A){return A.classList.add("allow-interactivity-".concat(a))}),function(){document.body.classList.remove("block-interactivity-".concat(a)),N.forEach(function(A){return A.classList.remove("allow-interactivity-".concat(a))})}}},[t.inert,t.lockRef.current,t.shards]);var i=I.useCallback(function(N,A){if("touches"in N&&N.touches.length===2||N.type==="wheel"&&N.ctrlKey)return!l.current.allowPinchZoom;var E=_L(N),T=n.current,L="deltaX"in N?N.deltaX:T[0]-E[0],z="deltaY"in N?N.deltaY:T[1]-E[1],F,q=N.target,H=Math.abs(L)>Math.abs(z)?"h":"v";if("touches"in N&&H==="h"&&q.type==="range")return!1;var Z=cje(H,q);if(!Z)return!0;if(Z?F=H:(F=H==="v"?"h":"v",Z=cje(H,q)),!Z)return!1;if(!s.current&&"changedTouches"in N&&(L||z)&&(s.current=F),!F)return!0;var G=s.current||F;return sst(G,A,N,G==="h"?L:z)},[]),h=I.useCallback(function(N){var A=N;if(!(!s4.length||s4[s4.length-1]!==o)){var E="deltaY"in A?dje(A):_L(A),T=e.current.filter(function(F){return F.name===A.type&&(F.target===A.target||A.target===F.shadowParent)&&ast(F.delta,E)})[0];if(T&&T.should){A.cancelable&&A.preventDefault();return}if(!T){var L=(l.current.shards||[]).map(uje).filter(Boolean).filter(function(F){return F.contains(A.target)}),z=L.length>0?i(A,L[0]):!l.current.noIsolation;z&&A.cancelable&&A.preventDefault()}}},[]),p=I.useCallback(function(N,A,E,T){var L={name:N,delta:A,target:E,should:T,shadowParent:cst(E)};e.current.push(L),setTimeout(function(){e.current=e.current.filter(function(z){return z!==L})},1)},[]),x=I.useCallback(function(N){n.current=_L(N),s.current=void 0},[]),y=I.useCallback(function(N){p(N.type,dje(N),N.target,i(N,t.lockRef.current))},[]),b=I.useCallback(function(N){p(N.type,_L(N),N.target,i(N,t.lockRef.current))},[]);I.useEffect(function(){return s4.push(o),t.setCallbacks({onScrollCapture:y,onWheelCapture:y,onTouchMoveCapture:b}),document.addEventListener("wheel",h,n4),document.addEventListener("touchmove",h,n4),document.addEventListener("touchstart",x,n4),function(){s4=s4.filter(function(N){return N!==o}),document.removeEventListener("wheel",h,n4),document.removeEventListener("touchmove",h,n4),document.removeEventListener("touchstart",x,n4)}},[]);var j=t.removeScrollBar,C=t.inert;return I.createElement(I.Fragment,null,C?I.createElement(o,{styles:ist(a)}):null,j?I.createElement(Xnt,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function cst(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const dst=Fnt(oPe,lst);var vI=I.forwardRef(function(t,e){return I.createElement(Fne,$f({},t,{ref:e,sideCar:dst}))});vI.classNames=Fne.classNames;var Jue=["Enter"," "],ust=["ArrowDown","PageUp","Home"],hPe=["ArrowUp","PageDown","End"],hst=[...ust,...hPe],fst={ltr:[...Jue,"ArrowRight"],rtl:[...Jue,"ArrowLeft"]},pst={ltr:["ArrowLeft"],rtl:["ArrowRight"]},_I="Menu",[JA,mst,gst]=lI(_I),[ok,fPe]=tc(_I,[gst,Fg,a3]),zne=Fg(),pPe=a3(),[xst,lk]=ok(_I),[yst,bI]=ok(_I),mPe=t=>{const{__scopeMenu:e,open:n=!1,children:s,dir:a,onOpenChange:o,modal:l=!0}=t,i=zne(e),[h,p]=I.useState(null),x=I.useRef(!1),y=Xl(o),b=ik(a);return I.useEffect(()=>{const j=()=>{x.current=!0,document.addEventListener("pointerdown",C,{capture:!0,once:!0}),document.addEventListener("pointermove",C,{capture:!0,once:!0})},C=()=>x.current=!1;return document.addEventListener("keydown",j,{capture:!0}),()=>{document.removeEventListener("keydown",j,{capture:!0}),document.removeEventListener("pointerdown",C,{capture:!0}),document.removeEventListener("pointermove",C,{capture:!0})}},[]),r.jsx(hI,{...i,children:r.jsx(xst,{scope:e,open:n,onOpenChange:y,content:h,onContentChange:p,children:r.jsx(yst,{scope:e,onClose:I.useCallback(()=>y(!1),[y]),isUsingKeyboardRef:x,dir:b,modal:l,children:s})})})};mPe.displayName=_I;var vst="MenuAnchor",bge=I.forwardRef((t,e)=>{const{__scopeMenu:n,...s}=t,a=zne(n);return r.jsx(QC,{...a,...s,ref:e})});bge.displayName=vst;var wge="MenuPortal",[_st,gPe]=ok(wge,{forceMount:void 0}),xPe=t=>{const{__scopeMenu:e,forceMount:n,children:s,container:a}=t,o=lk(wge,e);return r.jsx(_st,{scope:e,forceMount:n,children:r.jsx(gc,{present:n||o.open,children:r.jsx(GC,{asChild:!0,container:a,children:s})})})};xPe.displayName=wge;var Qf="MenuContent",[bst,jge]=ok(Qf),yPe=I.forwardRef((t,e)=>{const n=gPe(Qf,t.__scopeMenu),{forceMount:s=n.forceMount,...a}=t,o=lk(Qf,t.__scopeMenu),l=bI(Qf,t.__scopeMenu);return r.jsx(JA.Provider,{scope:t.__scopeMenu,children:r.jsx(gc,{present:s||o.open,children:r.jsx(JA.Slot,{scope:t.__scopeMenu,children:l.modal?r.jsx(wst,{...a,ref:e}):r.jsx(jst,{...a,ref:e})})})})}),wst=I.forwardRef((t,e)=>{const n=lk(Qf,t.__scopeMenu),s=I.useRef(null),a=ta(e,s);return I.useEffect(()=>{const o=s.current;if(o)return Rne(o)},[]),r.jsx(kge,{...t,ref:a,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:an(t.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),jst=I.forwardRef((t,e)=>{const n=lk(Qf,t.__scopeMenu);return r.jsx(kge,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),kst=D1("MenuContent.ScrollLock"),kge=I.forwardRef((t,e)=>{const{__scopeMenu:n,loop:s=!1,trapFocus:a,onOpenAutoFocus:o,onCloseAutoFocus:l,disableOutsidePointerEvents:i,onEntryFocus:h,onEscapeKeyDown:p,onPointerDownOutside:x,onFocusOutside:y,onInteractOutside:b,onDismiss:j,disableOutsideScroll:C,...N}=t,A=lk(Qf,n),E=bI(Qf,n),T=zne(n),L=pPe(n),z=mst(n),[F,q]=I.useState(null),H=I.useRef(null),Z=ta(e,H,A.onContentChange),G=I.useRef(0),te=I.useRef(""),ie=I.useRef(0),le=I.useRef(null),ye=I.useRef("right"),ne=I.useRef(0),ge=C?vI:I.Fragment,ae=C?{as:kst,allowPinchZoom:!0}:void 0,he=_e=>{var Ee,Ue;const Ae=te.current+_e,Ce=z().filter(Re=>!Re.disabled),be=document.activeElement,me=(Ee=Ce.find(Re=>Re.ref.current===be))==null?void 0:Ee.textValue,Le=Ce.map(Re=>Re.textValue),Ne=Dst(Le,Ae,me),Be=(Ue=Ce.find(Re=>Re.textValue===Ne))==null?void 0:Ue.ref.current;(function Re(je){te.current=je,window.clearTimeout(G.current),je!==""&&(G.current=window.setTimeout(()=>Re(""),1e3))})(Ae),Be&&setTimeout(()=>Be.focus())};I.useEffect(()=>()=>window.clearTimeout(G.current),[]),Dne();const ue=I.useCallback(_e=>{var Ce,be;return ye.current===((Ce=le.current)==null?void 0:Ce.side)&&Fst(_e,(be=le.current)==null?void 0:be.area)},[]);return r.jsx(bst,{scope:n,searchRef:te,onItemEnter:I.useCallback(_e=>{ue(_e)&&_e.preventDefault()},[ue]),onItemLeave:I.useCallback(_e=>{var Ae;ue(_e)||((Ae=H.current)==null||Ae.focus(),q(null))},[ue]),onTriggerLeave:I.useCallback(_e=>{ue(_e)&&_e.preventDefault()},[ue]),pointerGraceTimerRef:ie,onPointerGraceIntentChange:I.useCallback(_e=>{le.current=_e},[]),children:r.jsx(ge,{...ae,children:r.jsx(xI,{asChild:!0,trapped:a,onMountAutoFocus:an(o,_e=>{var Ae;_e.preventDefault(),(Ae=H.current)==null||Ae.focus({preventScroll:!0})}),onUnmountAutoFocus:l,children:r.jsx(ev,{asChild:!0,disableOutsidePointerEvents:i,onEscapeKeyDown:p,onPointerDownOutside:x,onFocusOutside:y,onInteractOutside:b,onDismiss:j,children:r.jsx(vge,{asChild:!0,...L,dir:E.dir,orientation:"vertical",loop:s,currentTabStopId:F,onCurrentTabStopIdChange:q,onEntryFocus:an(h,_e=>{E.isUsingKeyboardRef.current||_e.preventDefault()}),preventScrollOnEntryFocus:!0,children:r.jsx(fI,{role:"menu","aria-orientation":"vertical","data-state":LPe(A.open),"data-radix-menu-content":"",dir:E.dir,...T,...N,ref:Z,style:{outline:"none",...N.style},onKeyDown:an(N.onKeyDown,_e=>{const Ce=_e.target.closest("[data-radix-menu-content]")===_e.currentTarget,be=_e.ctrlKey||_e.altKey||_e.metaKey,me=_e.key.length===1;Ce&&(_e.key==="Tab"&&_e.preventDefault(),!be&&me&&he(_e.key));const Le=H.current;if(_e.target!==Le||!hst.includes(_e.key))return;_e.preventDefault();const Be=z().filter(Ee=>!Ee.disabled).map(Ee=>Ee.ref.current);hPe.includes(_e.key)&&Be.reverse(),Lst(Be)}),onBlur:an(t.onBlur,_e=>{_e.currentTarget.contains(_e.target)||(window.clearTimeout(G.current),te.current="")}),onPointerMove:an(t.onPointerMove,eE(_e=>{const Ae=_e.target,Ce=ne.current!==_e.clientX;if(_e.currentTarget.contains(Ae)&&Ce){const be=_e.clientX>ne.current?"right":"left";ye.current=be,ne.current=_e.clientX}}))})})})})})})});yPe.displayName=Qf;var Nst="MenuGroup",Nge=I.forwardRef((t,e)=>{const{__scopeMenu:n,...s}=t;return r.jsx(Rn.div,{role:"group",...s,ref:e})});Nge.displayName=Nst;var Sst="MenuLabel",vPe=I.forwardRef((t,e)=>{const{__scopeMenu:n,...s}=t;return r.jsx(Rn.div,{...s,ref:e})});vPe.displayName=Sst;var Xee="MenuItem",hje="menu.itemSelect",Bne=I.forwardRef((t,e)=>{const{disabled:n=!1,onSelect:s,...a}=t,o=I.useRef(null),l=bI(Xee,t.__scopeMenu),i=jge(Xee,t.__scopeMenu),h=ta(e,o),p=I.useRef(!1),x=()=>{const y=o.current;if(!n&&y){const b=new CustomEvent(hje,{bubbles:!0,cancelable:!0});y.addEventListener(hje,j=>s==null?void 0:s(j),{once:!0}),Rme(y,b),b.defaultPrevented?p.current=!1:l.onClose()}};return r.jsx(_Pe,{...a,ref:h,disabled:n,onClick:an(t.onClick,x),onPointerDown:y=>{var b;(b=t.onPointerDown)==null||b.call(t,y),p.current=!0},onPointerUp:an(t.onPointerUp,y=>{var b;p.current||(b=y.currentTarget)==null||b.click()}),onKeyDown:an(t.onKeyDown,y=>{const b=i.searchRef.current!=="";n||b&&y.key===" "||Jue.includes(y.key)&&(y.currentTarget.click(),y.preventDefault())})})});Bne.displayName=Xee;var _Pe=I.forwardRef((t,e)=>{const{__scopeMenu:n,disabled:s=!1,textValue:a,...o}=t,l=jge(Xee,n),i=pPe(n),h=I.useRef(null),p=ta(e,h),[x,y]=I.useState(!1),[b,j]=I.useState("");return I.useEffect(()=>{const C=h.current;C&&j((C.textContent??"").trim())},[o.children]),r.jsx(JA.ItemSlot,{scope:n,disabled:s,textValue:a??b,children:r.jsx(_ge,{asChild:!0,...i,focusable:!s,children:r.jsx(Rn.div,{role:"menuitem","data-highlighted":x?"":void 0,"aria-disabled":s||void 0,"data-disabled":s?"":void 0,...o,ref:p,onPointerMove:an(t.onPointerMove,eE(C=>{s?l.onItemLeave(C):(l.onItemEnter(C),C.defaultPrevented||C.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:an(t.onPointerLeave,eE(C=>l.onItemLeave(C))),onFocus:an(t.onFocus,()=>y(!0)),onBlur:an(t.onBlur,()=>y(!1))})})})}),Cst="MenuCheckboxItem",bPe=I.forwardRef((t,e)=>{const{checked:n=!1,onCheckedChange:s,...a}=t;return r.jsx(SPe,{scope:t.__scopeMenu,checked:n,children:r.jsx(Bne,{role:"menuitemcheckbox","aria-checked":Qee(n)?"mixed":n,...a,ref:e,"data-state":Cge(n),onSelect:an(a.onSelect,()=>s==null?void 0:s(Qee(n)?!0:!n),{checkForDefaultPrevented:!1})})})});bPe.displayName=Cst;var wPe="MenuRadioGroup",[Mst,Tst]=ok(wPe,{value:void 0,onValueChange:()=>{}}),jPe=I.forwardRef((t,e)=>{const{value:n,onValueChange:s,...a}=t,o=Xl(s);return r.jsx(Mst,{scope:t.__scopeMenu,value:n,onValueChange:o,children:r.jsx(Nge,{...a,ref:e})})});jPe.displayName=wPe;var kPe="MenuRadioItem",NPe=I.forwardRef((t,e)=>{const{value:n,...s}=t,a=Tst(kPe,t.__scopeMenu),o=n===a.value;return r.jsx(SPe,{scope:t.__scopeMenu,checked:o,children:r.jsx(Bne,{role:"menuitemradio","aria-checked":o,...s,ref:e,"data-state":Cge(o),onSelect:an(s.onSelect,()=>{var l;return(l=a.onValueChange)==null?void 0:l.call(a,n)},{checkForDefaultPrevented:!1})})})});NPe.displayName=kPe;var Sge="MenuItemIndicator",[SPe,Ast]=ok(Sge,{checked:!1}),CPe=I.forwardRef((t,e)=>{const{__scopeMenu:n,forceMount:s,...a}=t,o=Ast(Sge,n);return r.jsx(gc,{present:s||Qee(o.checked)||o.checked===!0,children:r.jsx(Rn.span,{...a,ref:e,"data-state":Cge(o.checked)})})});CPe.displayName=Sge;var Est="MenuSeparator",MPe=I.forwardRef((t,e)=>{const{__scopeMenu:n,...s}=t;return r.jsx(Rn.div,{role:"separator","aria-orientation":"horizontal",...s,ref:e})});MPe.displayName=Est;var Ist="MenuArrow",TPe=I.forwardRef((t,e)=>{const{__scopeMenu:n,...s}=t,a=zne(n);return r.jsx(pI,{...a,...s,ref:e})});TPe.displayName=Ist;var Pst="MenuSub",[EKt,APe]=ok(Pst),aT="MenuSubTrigger",EPe=I.forwardRef((t,e)=>{const n=lk(aT,t.__scopeMenu),s=bI(aT,t.__scopeMenu),a=APe(aT,t.__scopeMenu),o=jge(aT,t.__scopeMenu),l=I.useRef(null),{pointerGraceTimerRef:i,onPointerGraceIntentChange:h}=o,p={__scopeMenu:t.__scopeMenu},x=I.useCallback(()=>{l.current&&window.clearTimeout(l.current),l.current=null},[]);return I.useEffect(()=>x,[x]),I.useEffect(()=>{const y=i.current;return()=>{window.clearTimeout(y),h(null)}},[i,h]),r.jsx(bge,{asChild:!0,...p,children:r.jsx(_Pe,{id:a.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":a.contentId,"data-state":LPe(n.open),...t,ref:ry(e,a.onTriggerChange),onClick:y=>{var b;(b=t.onClick)==null||b.call(t,y),!(t.disabled||y.defaultPrevented)&&(y.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:an(t.onPointerMove,eE(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:an(t.onPointerLeave,eE(y=>{var j,C;x();const b=(j=n.content)==null?void 0:j.getBoundingClientRect();if(b){const N=(C=n.content)==null?void 0:C.dataset.side,A=N==="right",E=A?-5:5,T=b[A?"left":"right"],L=b[A?"right":"left"];o.onPointerGraceIntentChange({area:[{x:y.clientX+E,y:y.clientY},{x:T,y:b.top},{x:L,y:b.top},{x:L,y:b.bottom},{x:T,y:b.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:an(t.onKeyDown,y=>{var j;const b=o.searchRef.current!=="";t.disabled||b&&y.key===" "||fst[s.dir].includes(y.key)&&(n.onOpenChange(!0),(j=n.content)==null||j.focus(),y.preventDefault())})})})});EPe.displayName=aT;var IPe="MenuSubContent",PPe=I.forwardRef((t,e)=>{const n=gPe(Qf,t.__scopeMenu),{forceMount:s=n.forceMount,...a}=t,o=lk(Qf,t.__scopeMenu),l=bI(Qf,t.__scopeMenu),i=APe(IPe,t.__scopeMenu),h=I.useRef(null),p=ta(e,h);return r.jsx(JA.Provider,{scope:t.__scopeMenu,children:r.jsx(gc,{present:s||o.open,children:r.jsx(JA.Slot,{scope:t.__scopeMenu,children:r.jsx(kge,{id:i.contentId,"aria-labelledby":i.triggerId,...a,ref:p,align:"start",side:l.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:x=>{var y;l.isUsingKeyboardRef.current&&((y=h.current)==null||y.focus()),x.preventDefault()},onCloseAutoFocus:x=>x.preventDefault(),onFocusOutside:an(t.onFocusOutside,x=>{x.target!==i.trigger&&o.onOpenChange(!1)}),onEscapeKeyDown:an(t.onEscapeKeyDown,x=>{l.onClose(),x.preventDefault()}),onKeyDown:an(t.onKeyDown,x=>{var j;const y=x.currentTarget.contains(x.target),b=pst[l.dir].includes(x.key);y&&b&&(o.onOpenChange(!1),(j=i.trigger)==null||j.focus(),x.preventDefault())})})})})})});PPe.displayName=IPe;function LPe(t){return t?"open":"closed"}function Qee(t){return t==="indeterminate"}function Cge(t){return Qee(t)?"indeterminate":t?"checked":"unchecked"}function Lst(t){const e=document.activeElement;for(const n of t)if(n===e||(n.focus(),document.activeElement!==e))return}function Ost(t,e){return t.map((n,s)=>t[(e+s)%t.length])}function Dst(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=Ost(t,Math.max(o,0));a.length===1&&(l=l.filter(p=>p!==n));const h=l.find(p=>p.toLowerCase().startsWith(a.toLowerCase()));return h!==n?h:void 0}function Rst(t,e){const{x:n,y:s}=t;let a=!1;for(let o=0,l=e.length-1;os!=b>s&&n<(y-p)*(s-x)/(b-x)+p&&(a=!a)}return a}function Fst(t,e){if(!e)return!1;const n={x:t.clientX,y:t.clientY};return Rst(n,e)}function eE(t){return e=>e.pointerType==="mouse"?t(e):void 0}var zst=mPe,Bst=bge,$st=xPe,Ust=yPe,qst=Nge,Vst=vPe,Hst=Bne,Wst=bPe,Gst=jPe,Kst=NPe,Zst=CPe,Yst=MPe,Xst=TPe,Qst=EPe,Jst=PPe,$ne="DropdownMenu",[eat]=tc($ne,[fPe]),Hu=fPe(),[tat,OPe]=eat($ne),DPe=t=>{const{__scopeDropdownMenu:e,children:n,dir:s,open:a,defaultOpen:o,onOpenChange:l,modal:i=!0}=t,h=Hu(e),p=I.useRef(null),[x,y]=Fu({prop:a,defaultProp:o??!1,onChange:l,caller:$ne});return r.jsx(tat,{scope:e,triggerId:Gc(),triggerRef:p,contentId:Gc(),open:x,onOpenChange:y,onOpenToggle:I.useCallback(()=>y(b=>!b),[y]),modal:i,children:r.jsx(zst,{...h,open:x,onOpenChange:y,dir:s,modal:i,children:n})})};DPe.displayName=$ne;var RPe="DropdownMenuTrigger",FPe=I.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,disabled:s=!1,...a}=t,o=OPe(RPe,n),l=Hu(n);return r.jsx(Bst,{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:ry(e,o.triggerRef),onPointerDown:an(t.onPointerDown,i=>{!s&&i.button===0&&i.ctrlKey===!1&&(o.onOpenToggle(),o.open||i.preventDefault())}),onKeyDown:an(t.onKeyDown,i=>{s||(["Enter"," "].includes(i.key)&&o.onOpenToggle(),i.key==="ArrowDown"&&o.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(i.key)&&i.preventDefault())})})})});FPe.displayName=RPe;var rat="DropdownMenuPortal",zPe=t=>{const{__scopeDropdownMenu:e,...n}=t,s=Hu(e);return r.jsx($st,{...s,...n})};zPe.displayName=rat;var BPe="DropdownMenuContent",$Pe=I.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...s}=t,a=OPe(BPe,n),o=Hu(n),l=I.useRef(!1);return r.jsx(Ust,{id:a.contentId,"aria-labelledby":a.triggerId,...o,...s,ref:e,onCloseAutoFocus:an(t.onCloseAutoFocus,i=>{var h;l.current||(h=a.triggerRef.current)==null||h.focus(),l.current=!1,i.preventDefault()}),onInteractOutside:an(t.onInteractOutside,i=>{const h=i.detail.originalEvent,p=h.button===0&&h.ctrlKey===!0,x=h.button===2||p;(!a.modal||x)&&(l.current=!0)}),style:{...t.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});$Pe.displayName=BPe;var nat="DropdownMenuGroup",sat=I.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...s}=t,a=Hu(n);return r.jsx(qst,{...a,...s,ref:e})});sat.displayName=nat;var aat="DropdownMenuLabel",UPe=I.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...s}=t,a=Hu(n);return r.jsx(Vst,{...a,...s,ref:e})});UPe.displayName=aat;var iat="DropdownMenuItem",qPe=I.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...s}=t,a=Hu(n);return r.jsx(Hst,{...a,...s,ref:e})});qPe.displayName=iat;var oat="DropdownMenuCheckboxItem",VPe=I.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...s}=t,a=Hu(n);return r.jsx(Wst,{...a,...s,ref:e})});VPe.displayName=oat;var lat="DropdownMenuRadioGroup",cat=I.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...s}=t,a=Hu(n);return r.jsx(Gst,{...a,...s,ref:e})});cat.displayName=lat;var dat="DropdownMenuRadioItem",HPe=I.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...s}=t,a=Hu(n);return r.jsx(Kst,{...a,...s,ref:e})});HPe.displayName=dat;var uat="DropdownMenuItemIndicator",WPe=I.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...s}=t,a=Hu(n);return r.jsx(Zst,{...a,...s,ref:e})});WPe.displayName=uat;var hat="DropdownMenuSeparator",GPe=I.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...s}=t,a=Hu(n);return r.jsx(Yst,{...a,...s,ref:e})});GPe.displayName=hat;var fat="DropdownMenuArrow",pat=I.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...s}=t,a=Hu(n);return r.jsx(Xst,{...a,...s,ref:e})});pat.displayName=fat;var mat="DropdownMenuSubTrigger",KPe=I.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...s}=t,a=Hu(n);return r.jsx(Qst,{...a,...s,ref:e})});KPe.displayName=mat;var gat="DropdownMenuSubContent",ZPe=I.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...s}=t,a=Hu(n);return r.jsx(Jst,{...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)"}})});ZPe.displayName=gat;var xat=DPe,yat=FPe,vat=zPe,YPe=$Pe,XPe=UPe,QPe=qPe,JPe=VPe,e6e=HPe,t6e=WPe,r6e=GPe,n6e=KPe,s6e=ZPe;const wh=xat,jh=yat,_at=I.forwardRef(({className:t,inset:e,children:n,...s},a)=>r.jsxs(n6e,{ref:a,className:$t("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[state=open]:bg-accent focus:bg-accent",e&&"pl-8",t),...s,children:[n,r.jsx(Vi,{className:"ml-auto h-4 w-4"})]}));_at.displayName=n6e.displayName;const bat=I.forwardRef(({className:t,...e},n)=>r.jsx(s6e,{ref:n,className:$t("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}));bat.displayName=s6e.displayName;const Wu=I.forwardRef(({className:t,sideOffset:e=4,...n},s)=>r.jsx(vat,{children:r.jsx(YPe,{ref:s,sideOffset:e,className:$t("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})}));Wu.displayName=YPe.displayName;const di=I.forwardRef(({className:t,inset:e,...n},s)=>r.jsx(QPe,{ref:s,className:$t("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50 focus:bg-accent focus:text-accent-foreground",e&&"pl-8",t),...n}));di.displayName=QPe.displayName;const wat=I.forwardRef(({className:t,children:e,checked:n,...s},a)=>r.jsxs(JPe,{ref:a,className:$t("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(t6e,{children:r.jsx(Ai,{className:"h-4 w-4"})})}),e]}));wat.displayName=JPe.displayName;const jat=I.forwardRef(({className:t,children:e,...n},s)=>r.jsxs(e6e,{ref:s,className:$t("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(t6e,{children:r.jsx(Ru,{className:"h-2 w-2 fill-current"})})}),e]}));jat.displayName=e6e.displayName;const ehe=I.forwardRef(({className:t,inset:e,...n},s)=>r.jsx(XPe,{ref:s,className:$t("px-2 py-1.5 text-sm font-semibold",e&&"pl-8",t),...n}));ehe.displayName=XPe.displayName;const Fj=I.forwardRef(({className:t,...e},n)=>r.jsx(r6e,{ref:n,className:$t("-mx-1 my-1 h-px bg-muted",t),...e}));Fj.displayName=r6e.displayName;const kat=()=>{const{isAssistant:t,actingAsAgent:e,assignedAgents:n,setActingAsAgent:s}=xge();if(!(t&&!!e))return null;const o=l=>l.split(" ").map(i=>i[0]).join("").toUpperCase().slice(0,2);return r.jsx("div",{className:"fixed top-0 left-0 right-0 z-[2147483647] bg-primary text-primary-foreground px-4 py-1.5 shadow-lg",style:{height:"40px"},children:r.jsxs("div",{className:"container mx-auto flex items-center justify-between gap-4 h-full",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(Bn,{className:"h-4 w-4 flex-shrink-0"}),r.jsx("span",{className:"font-medium text-sm",children:"Acting as"}),n.length>1?r.jsxs(wh,{children:[r.jsx(jh,{asChild:!0,children:r.jsxs(ee,{variant:"secondary",size:"sm",className:"gap-2 bg-primary-foreground/20 hover:bg-primary-foreground/30 text-primary-foreground border-0",children:[r.jsxs(Ks,{className:"h-5 w-5",children:[r.jsx(Ei,{src:e.avatar_url||void 0}),r.jsx(Zs,{className:"text-[10px] bg-primary-foreground/30",children:o(e.name)})]}),r.jsx("strong",{children:e.name}),r.jsx(Dd,{className:"h-3 w-3"})]})}),r.jsx(Wu,{align:"start",children:n.map(l=>r.jsxs(di,{onClick:()=>s(l),className:"gap-2",children:[r.jsxs(Ks,{className:"h-6 w-6",children:[r.jsx(Ei,{src:l.avatar_url||void 0}),r.jsx(Zs,{className:"text-[10px]",children:o(l.name)})]}),r.jsx("span",{children:l.name}),l.id===e.id&&r.jsx(Ot,{variant:"secondary",className:"ml-auto text-[10px]",children:"Current"})]},l.id))})]}):r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs(Ks,{className:"h-5 w-5",children:[r.jsx(Ei,{src:e.avatar_url||void 0}),r.jsx(Zs,{className:"text-[10px] bg-primary-foreground/30",children:o(e.name)})]}),r.jsx("strong",{children:e.name})]})]}),r.jsx(Ot,{variant:"secondary",className:"bg-primary-foreground/20 text-primary-foreground border-0 text-xs",children:"Assistant Mode"})]})})},Cn=({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(_le,{to:"/dashboard",replace:!0}):n&&!l&&!o?r.jsx(_le,{to:"/dashboard",replace:!0}):r.jsx(r.Fragment,{children:t}):r.jsx(_le,{to:"/auth",replace:!0})};var Mge={};(function t(e,n,s,a){var o=!!(e.Worker&&e.Blob&&e.Promise&&e.OffscreenCanvas&&e.OffscreenCanvasRenderingContext2D&&e.HTMLCanvasElement&&e.HTMLCanvasElement.prototype.transferControlToOffscreen&&e.URL&&e.URL.createObjectURL),l=typeof Path2D=="function"&&typeof DOMMatrix=="function",i=function(){if(!e.OffscreenCanvas)return!1;try{var Ae=new OffscreenCanvas(1,1),Ce=Ae.getContext("2d");Ce.fillRect(0,0,1,1);var be=Ae.transferToImageBitmap();Ce.createPattern(be,"no-repeat")}catch{return!1}return!0}();function h(){}function p(Ae){var Ce=n.exports.Promise,be=Ce!==void 0?Ce:e.Promise;return typeof be=="function"?new be(Ae):(Ae(h,h),null)}var x=function(Ae,Ce){return{transform:function(be){if(Ae)return be;if(Ce.has(be))return Ce.get(be);var me=new OffscreenCanvas(be.width,be.height),Le=me.getContext("2d");return Le.drawImage(be,0,0),Ce.set(be,me),me},clear:function(){Ce.clear()}}}(i,new Map),y=function(){var Ae=Math.floor(16.666666666666668),Ce,be,me={},Le=0;return typeof requestAnimationFrame=="function"&&typeof cancelAnimationFrame=="function"?(Ce=function(Ne){var Be=Math.random();return me[Be]=requestAnimationFrame(function Ee(Ue){Le===Ue||Le+Ae-1{const{data:e,error:n}=await J.from("celebration_queue").select("*").eq("user_id",t.id).is("seen_at",null).order("created_at",{ascending:!0});if(n)throw n;return e},enabled:!!(t!=null&&t.id),refetchOnWindowFocus:!0,staleTime:0})}function Sat(){const t=Vr();return cr({mutationFn:async e=>{const{error:n}=await J.from("celebration_queue").update({seen_at:new Date().toISOString()}).eq("id",e);if(n)throw n},onSuccess:()=>{t.invalidateQueries({queryKey:["celebrations"]})}})}function Cat(){const t=Vr(),{user:e}=Qr();return cr({mutationFn:async n=>{const{error:s}=await J.from("celebration_queue").insert({user_id:n.user_id,celebration_type:n.celebration_type,title:n.title,message:n.message||null,points_amount:n.points_amount||null,created_by:e==null?void 0:e.id});if(s)throw s},onSuccess:()=>{t.invalidateQueries({queryKey:["celebrations"]})}})}var Une="Dialog",[a6e,i6e]=tc(Une),[Mat,Nm]=a6e(Une),o6e=t=>{const{__scopeDialog:e,children:n,open:s,defaultOpen:a,onOpenChange:o,modal:l=!0}=t,i=I.useRef(null),h=I.useRef(null),[p,x]=Fu({prop:s,defaultProp:a??!1,onChange:o,caller:Une});return r.jsx(Mat,{scope:e,triggerRef:i,contentRef:h,contentId:Gc(),titleId:Gc(),descriptionId:Gc(),open:p,onOpenChange:x,onOpenToggle:I.useCallback(()=>x(y=>!y),[x]),modal:l,children:n})};o6e.displayName=Une;var l6e="DialogTrigger",c6e=I.forwardRef((t,e)=>{const{__scopeDialog:n,...s}=t,a=Nm(l6e,n),o=ta(e,a.triggerRef);return r.jsx(Rn.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.contentId,"data-state":Ege(a.open),...s,ref:o,onClick:an(t.onClick,a.onOpenToggle)})});c6e.displayName=l6e;var Tge="DialogPortal",[Tat,d6e]=a6e(Tge,{forceMount:void 0}),u6e=t=>{const{__scopeDialog:e,forceMount:n,children:s,container:a}=t,o=Nm(Tge,e);return r.jsx(Tat,{scope:e,forceMount:n,children:I.Children.map(s,l=>r.jsx(gc,{present:n||o.open,children:r.jsx(GC,{asChild:!0,container:a,children:l})}))})};u6e.displayName=Tge;var Jee="DialogOverlay",h6e=I.forwardRef((t,e)=>{const n=d6e(Jee,t.__scopeDialog),{forceMount:s=n.forceMount,...a}=t,o=Nm(Jee,t.__scopeDialog);return o.modal?r.jsx(gc,{present:s||o.open,children:r.jsx(Eat,{...a,ref:e})}):null});h6e.displayName=Jee;var Aat=D1("DialogOverlay.RemoveScroll"),Eat=I.forwardRef((t,e)=>{const{__scopeDialog:n,...s}=t,a=Nm(Jee,n);return r.jsx(vI,{as:Aat,allowPinchZoom:!0,shards:[a.contentRef],children:r.jsx(Rn.div,{"data-state":Ege(a.open),...s,ref:e,style:{pointerEvents:"auto",...s.style}})})}),zj="DialogContent",f6e=I.forwardRef((t,e)=>{const n=d6e(zj,t.__scopeDialog),{forceMount:s=n.forceMount,...a}=t,o=Nm(zj,t.__scopeDialog);return r.jsx(gc,{present:s||o.open,children:o.modal?r.jsx(Iat,{...a,ref:e}):r.jsx(Pat,{...a,ref:e})})});f6e.displayName=zj;var Iat=I.forwardRef((t,e)=>{const n=Nm(zj,t.__scopeDialog),s=I.useRef(null),a=ta(e,n.contentRef,s);return I.useEffect(()=>{const o=s.current;if(o)return Rne(o)},[]),r.jsx(p6e,{...t,ref:a,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:an(t.onCloseAutoFocus,o=>{var l;o.preventDefault(),(l=n.triggerRef.current)==null||l.focus()}),onPointerDownOutside:an(t.onPointerDownOutside,o=>{const l=o.detail.originalEvent,i=l.button===0&&l.ctrlKey===!0;(l.button===2||i)&&o.preventDefault()}),onFocusOutside:an(t.onFocusOutside,o=>o.preventDefault())})}),Pat=I.forwardRef((t,e)=>{const n=Nm(zj,t.__scopeDialog),s=I.useRef(!1),a=I.useRef(!1);return r.jsx(p6e,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{var l,i;(l=t.onCloseAutoFocus)==null||l.call(t,o),o.defaultPrevented||(s.current||(i=n.triggerRef.current)==null||i.focus(),o.preventDefault()),s.current=!1,a.current=!1},onInteractOutside:o=>{var h,p;(h=t.onInteractOutside)==null||h.call(t,o),o.defaultPrevented||(s.current=!0,o.detail.originalEvent.type==="pointerdown"&&(a.current=!0));const l=o.target;((p=n.triggerRef.current)==null?void 0:p.contains(l))&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&a.current&&o.preventDefault()}})}),p6e=I.forwardRef((t,e)=>{const{__scopeDialog:n,trapFocus:s,onOpenAutoFocus:a,onCloseAutoFocus:o,...l}=t,i=Nm(zj,n),h=I.useRef(null),p=ta(e,h);return Dne(),r.jsxs(r.Fragment,{children:[r.jsx(xI,{asChild:!0,loop:!0,trapped:s,onMountAutoFocus:a,onUnmountAutoFocus:o,children:r.jsx(ev,{role:"dialog",id:i.contentId,"aria-describedby":i.descriptionId,"aria-labelledby":i.titleId,"data-state":Ege(i.open),...l,ref:p,onDismiss:()=>i.onOpenChange(!1)})}),r.jsxs(r.Fragment,{children:[r.jsx(Oat,{titleId:i.titleId}),r.jsx(Rat,{contentRef:h,descriptionId:i.descriptionId})]})]})}),Age="DialogTitle",m6e=I.forwardRef((t,e)=>{const{__scopeDialog:n,...s}=t,a=Nm(Age,n);return r.jsx(Rn.h2,{id:a.titleId,...s,ref:e})});m6e.displayName=Age;var g6e="DialogDescription",x6e=I.forwardRef((t,e)=>{const{__scopeDialog:n,...s}=t,a=Nm(g6e,n);return r.jsx(Rn.p,{id:a.descriptionId,...s,ref:e})});x6e.displayName=g6e;var y6e="DialogClose",v6e=I.forwardRef((t,e)=>{const{__scopeDialog:n,...s}=t,a=Nm(y6e,n);return r.jsx(Rn.button,{type:"button",...s,ref:e,onClick:an(t.onClick,()=>a.onOpenChange(!1))})});v6e.displayName=y6e;function Ege(t){return t?"open":"closed"}var _6e="DialogTitleWarning",[Lat,b6e]=uKe(_6e,{contentName:zj,titleName:Age,docsSlug:"dialog"}),Oat=({titleId:t})=>{const e=b6e(_6e),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},Dat="DialogDescriptionWarning",Rat=({contentRef:t,descriptionId:e})=>{const s=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${b6e(Dat).contentName}}.`;return I.useEffect(()=>{var o;const a=(o=t.current)==null?void 0:o.getAttribute("aria-describedby");e&&a&&(document.getElementById(e)||console.warn(s))},[s,t,e]),null},qne=o6e,Ige=c6e,Vne=u6e,i3=h6e,o3=f6e,wI=m6e,jI=x6e,Hne=v6e;const Fr=qne,zo=Ige,Fat=Vne,w6e=I.forwardRef(({className:t,...e},n)=>r.jsx(i3,{ref:n,className:$t("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}));w6e.displayName=i3.displayName;const Rr=I.forwardRef(({className:t,children:e,...n},s)=>r.jsxs(Fat,{children:[r.jsx(w6e,{}),r.jsxs(o3,{ref:s,className:$t("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",t),...n,children:[e,r.jsxs(Hne,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity data-[state=open]:bg-accent data-[state=open]:text-muted-foreground hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none",children:[r.jsx(_s,{className:"h-4 w-4"}),r.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Rr.displayName=o3.displayName;const qr=({className:t,...e})=>r.jsx("div",{className:$t("flex flex-col space-y-1.5 text-center sm:text-left",t),...e});qr.displayName="DialogHeader";const ea=({className:t,...e})=>r.jsx("div",{className:$t("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...e});ea.displayName="DialogFooter";const $r=I.forwardRef(({className:t,...e},n)=>r.jsx(wI,{ref:n,className:$t("text-lg font-semibold leading-none tracking-tight",t),...e}));$r.displayName=wI.displayName;const Xn=I.forwardRef(({className:t,...e},n)=>r.jsx(jI,{ref:n,className:$t("text-sm text-muted-foreground",t),...e}));Xn.displayName=jI.displayName;const zat={points_earned:Zi,listing_created:pa,deal_closed:hd,custom:vs},pje={points_earned:"from-amber-500 to-orange-500",listing_created:"from-emerald-500 to-teal-500",deal_closed:"from-green-500 to-emerald-500",custom:"from-purple-500 to-pink-500"};function Bat(){const{user:t}=Qr(),e=Vr(),{data:n}=Nat(),s=Sat(),[a,o]=I.useState(null),[l,i]=I.useState(!1),h=I.useCallback(()=>{const j=Date.now()+3e3,C={startVelocity:30,spread:360,ticks:60,zIndex:9999},N=(E,T)=>Math.random()*(T-E)+E,A=setInterval(()=>{const E=j-Date.now();if(E<=0){clearInterval(A);return}const T=50*(E/3e3);fje({...C,particleCount:T,origin:{x:N(.1,.3),y:Math.random()-.2},colors:["#ff6b6b","#feca57","#48dbfb","#ff9ff3","#54a0ff","#5f27cd"]}),fje({...C,particleCount:T,origin:{x:N(.7,.9),y:Math.random()-.2},colors:["#ff6b6b","#feca57","#48dbfb","#ff9ff3","#54a0ff","#5f27cd"]})},250)},[]);I.useEffect(()=>{n&&n.length>0&&!a&&(o(n[0]),i(!0),setTimeout(h,100))},[n,a,h]);const p=async()=>{if(a){const b=a.id;i(!1),o(null),e.setQueryData(["celebrations","pending",t==null?void 0:t.id],j=>(j==null?void 0:j.filter(C=>C.id!==b))??[]),await s.mutateAsync(b)}};if(!a)return null;const x=zat[a.celebration_type]||vs,y=pje[a.celebration_type]||pje.custom;return r.jsx(Fr,{open:l,onOpenChange:b=>!b&&p(),children:r.jsxs(Rr,{className:"sm:max-w-md text-center border-0 overflow-hidden",children:[r.jsx("div",{className:`absolute inset-0 bg-gradient-to-br ${y} opacity-10`}),r.jsxs("div",{className:"relative z-10 py-6",children:[r.jsx("div",{className:"flex justify-center mb-4",children:r.jsx("div",{className:`w-20 h-20 rounded-full bg-gradient-to-br ${y} flex items-center justify-center animate-bounce`,children:r.jsx(x,{className:"w-10 h-10 text-white"})})}),r.jsxs("div",{className:"flex justify-center gap-1 mb-4",children:[r.jsx(Ms,{className:"w-5 h-5 text-yellow-500 animate-pulse"}),r.jsx(Ms,{className:"w-5 h-5 text-yellow-500 animate-pulse delay-75"}),r.jsx(Ms,{className:"w-5 h-5 text-yellow-500 animate-pulse delay-150"})]}),r.jsxs("h2",{className:"text-2xl font-bold mb-2 bg-gradient-to-r from-primary to-secondary bg-clip-text text-transparent",children:["🎉 ",a.title]}),a.points_amount&&a.points_amount>0&&r.jsxs("div",{className:"text-4xl font-bold text-primary mb-2",children:["+",a.points_amount," points!"]}),a.message&&r.jsx("p",{className:"text-muted-foreground mb-6",children:a.message}),r.jsx(ee,{onClick:p,className:"w-full",size:"lg",children:"Awesome! 🙌"}),n&&n.length>1&&r.jsxs("p",{className:"text-sm text-muted-foreground mt-3",children:["+",n.length-1," more celebration",n.length>2?"s":""," waiting"]})]})]})})}const tE="/assets/levelup-logo-color-D3mY9gCJ.png",Pge="/assets/levelup-logo-white-C2RAgAoG.png",$at="/assets/listings-hero-BI9Ki9Dq.jpg",dt=I.forwardRef(({className:t,type:e,...n},s)=>r.jsx("input",{type:e,className:$t("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",t),ref:s,...n}));dt.displayName="Input";function Ir({className:t,...e}){return r.jsx("div",{className:$t("animate-pulse rounded-md bg-muted",t),...e})}function rE(t,[e,n]){return Math.min(n,Math.max(e,t))}function kI(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 Uat=[" ","Enter","ArrowUp","ArrowDown"],qat=[" ","Enter"],Bj="Select",[Wne,Gne,Vat]=lI(Bj),[l3]=tc(Bj,[Vat,Fg]),Kne=Fg(),[Hat,sv]=l3(Bj),[Wat,Gat]=l3(Bj),j6e=t=>{const{__scopeSelect:e,children:n,open:s,defaultOpen:a,onOpenChange:o,value:l,defaultValue:i,onValueChange:h,dir:p,name:x,autoComplete:y,disabled:b,required:j,form:C}=t,N=Kne(e),[A,E]=I.useState(null),[T,L]=I.useState(null),[z,F]=I.useState(!1),q=ik(p),[H,Z]=Fu({prop:s,defaultProp:a??!1,onChange:o,caller:Bj}),[G,te]=Fu({prop:l,defaultProp:i,onChange:h,caller:Bj}),ie=I.useRef(null),le=A?C||!!A.closest("form"):!0,[ye,ne]=I.useState(new Set),ge=Array.from(ye).map(ae=>ae.props.value).join(";");return r.jsx(hI,{...N,children:r.jsxs(Hat,{required:j,scope:e,trigger:A,onTriggerChange:E,valueNode:T,onValueNodeChange:L,valueNodeHasChildren:z,onValueNodeHasChildrenChange:F,contentId:Gc(),value:G,onValueChange:te,open:H,onOpenChange:Z,dir:q,triggerPointerDownPosRef:ie,disabled:b,children:[r.jsx(Wne.Provider,{scope:e,children:r.jsx(Wat,{scope:t.__scopeSelect,onNativeOptionAdd:I.useCallback(ae=>{ne(he=>new Set(he).add(ae))},[]),onNativeOptionRemove:I.useCallback(ae=>{ne(he=>{const ue=new Set(he);return ue.delete(ae),ue})},[]),children:n})}),le?r.jsxs(G6e,{"aria-hidden":!0,required:j,tabIndex:-1,name:x,autoComplete:y,value:G,onChange:ae=>te(ae.target.value),disabled:b,form:C,children:[G===void 0?r.jsx("option",{value:""}):null,Array.from(ye)]},ge):null]})})};j6e.displayName=Bj;var k6e="SelectTrigger",N6e=I.forwardRef((t,e)=>{const{__scopeSelect:n,disabled:s=!1,...a}=t,o=Kne(n),l=sv(k6e,n),i=l.disabled||s,h=ta(e,l.onTriggerChange),p=Gne(n),x=I.useRef("touch"),[y,b,j]=Z6e(N=>{const A=p().filter(L=>!L.disabled),E=A.find(L=>L.value===l.value),T=Y6e(A,N,E);T!==void 0&&l.onValueChange(T.value)}),C=N=>{i||(l.onOpenChange(!0),j()),N&&(l.triggerPointerDownPosRef.current={x:Math.round(N.pageX),y:Math.round(N.pageY)})};return r.jsx(QC,{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":K6e(l.value)?"":void 0,...a,ref:h,onClick:an(a.onClick,N=>{N.currentTarget.focus(),x.current!=="mouse"&&C(N)}),onPointerDown:an(a.onPointerDown,N=>{x.current=N.pointerType;const A=N.target;A.hasPointerCapture(N.pointerId)&&A.releasePointerCapture(N.pointerId),N.button===0&&N.ctrlKey===!1&&N.pointerType==="mouse"&&(C(N),N.preventDefault())}),onKeyDown:an(a.onKeyDown,N=>{const A=y.current!=="";!(N.ctrlKey||N.altKey||N.metaKey)&&N.key.length===1&&b(N.key),!(A&&N.key===" ")&&Uat.includes(N.key)&&(C(),N.preventDefault())})})})});N6e.displayName=k6e;var S6e="SelectValue",C6e=I.forwardRef((t,e)=>{const{__scopeSelect:n,className:s,style:a,children:o,placeholder:l="",...i}=t,h=sv(S6e,n),{onValueNodeHasChildrenChange:p}=h,x=o!==void 0,y=ta(e,h.onValueNodeChange);return Jl(()=>{p(x)},[p,x]),r.jsx(Rn.span,{...i,ref:y,style:{pointerEvents:"none"},children:K6e(h.value)?r.jsx(r.Fragment,{children:l}):o})});C6e.displayName=S6e;var Kat="SelectIcon",M6e=I.forwardRef((t,e)=>{const{__scopeSelect:n,children:s,...a}=t;return r.jsx(Rn.span,{"aria-hidden":!0,...a,ref:e,children:s||"▼"})});M6e.displayName=Kat;var Zat="SelectPortal",T6e=t=>r.jsx(GC,{asChild:!0,...t});T6e.displayName=Zat;var $j="SelectContent",A6e=I.forwardRef((t,e)=>{const n=sv($j,t.__scopeSelect),[s,a]=I.useState();if(Jl(()=>{a(new DocumentFragment)},[]),!n.open){const o=s;return o?uy.createPortal(r.jsx(E6e,{scope:t.__scopeSelect,children:r.jsx(Wne.Slot,{scope:t.__scopeSelect,children:r.jsx("div",{children:t.children})})}),o):null}return r.jsx(I6e,{...t,ref:e})});A6e.displayName=$j;var Vp=10,[E6e,av]=l3($j),Yat="SelectContentImpl",Xat=D1("SelectContent.RemoveScroll"),I6e=I.forwardRef((t,e)=>{const{__scopeSelect:n,position:s="item-aligned",onCloseAutoFocus:a,onEscapeKeyDown:o,onPointerDownOutside:l,side:i,sideOffset:h,align:p,alignOffset:x,arrowPadding:y,collisionBoundary:b,collisionPadding:j,sticky:C,hideWhenDetached:N,avoidCollisions:A,...E}=t,T=sv($j,n),[L,z]=I.useState(null),[F,q]=I.useState(null),H=ta(e,Ee=>z(Ee)),[Z,G]=I.useState(null),[te,ie]=I.useState(null),le=Gne(n),[ye,ne]=I.useState(!1),ge=I.useRef(!1);I.useEffect(()=>{if(L)return Rne(L)},[L]),Dne();const ae=I.useCallback(Ee=>{const[Ue,...Re]=le().map(Te=>Te.ref.current),[je]=Re.slice(-1),et=document.activeElement;for(const Te of Ee)if(Te===et||(Te==null||Te.scrollIntoView({block:"nearest"}),Te===Ue&&F&&(F.scrollTop=0),Te===je&&F&&(F.scrollTop=F.scrollHeight),Te==null||Te.focus(),document.activeElement!==et))return},[le,F]),he=I.useCallback(()=>ae([Z,L]),[ae,Z,L]);I.useEffect(()=>{ye&&he()},[ye,he]);const{onOpenChange:ue,triggerPointerDownPosRef:_e}=T;I.useEffect(()=>{if(L){let Ee={x:0,y:0};const Ue=je=>{var et,Te;Ee={x:Math.abs(Math.round(je.pageX)-(((et=_e.current)==null?void 0:et.x)??0)),y:Math.abs(Math.round(je.pageY)-(((Te=_e.current)==null?void 0:Te.y)??0))}},Re=je=>{Ee.x<=10&&Ee.y<=10?je.preventDefault():L.contains(je.target)||ue(!1),document.removeEventListener("pointermove",Ue),_e.current=null};return _e.current!==null&&(document.addEventListener("pointermove",Ue),document.addEventListener("pointerup",Re,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",Ue),document.removeEventListener("pointerup",Re,{capture:!0})}}},[L,ue,_e]),I.useEffect(()=>{const Ee=()=>ue(!1);return window.addEventListener("blur",Ee),window.addEventListener("resize",Ee),()=>{window.removeEventListener("blur",Ee),window.removeEventListener("resize",Ee)}},[ue]);const[Ae,Ce]=Z6e(Ee=>{const Ue=le().filter(et=>!et.disabled),Re=Ue.find(et=>et.ref.current===document.activeElement),je=Y6e(Ue,Ee,Re);je&&setTimeout(()=>je.ref.current.focus())}),be=I.useCallback((Ee,Ue,Re)=>{const je=!ge.current&&!Re;(T.value!==void 0&&T.value===Ue||je)&&(G(Ee),je&&(ge.current=!0))},[T.value]),me=I.useCallback(()=>L==null?void 0:L.focus(),[L]),Le=I.useCallback((Ee,Ue,Re)=>{const je=!ge.current&&!Re;(T.value!==void 0&&T.value===Ue||je)&&ie(Ee)},[T.value]),Ne=s==="popper"?the:P6e,Be=Ne===the?{side:i,sideOffset:h,align:p,alignOffset:x,arrowPadding:y,collisionBoundary:b,collisionPadding:j,sticky:C,hideWhenDetached:N,avoidCollisions:A}:{};return r.jsx(E6e,{scope:n,content:L,viewport:F,onViewportChange:q,itemRefCallback:be,selectedItem:Z,onItemLeave:me,itemTextRefCallback:Le,focusSelectedItem:he,selectedItemText:te,position:s,isPositioned:ye,searchRef:Ae,children:r.jsx(vI,{as:Xat,allowPinchZoom:!0,children:r.jsx(xI,{asChild:!0,trapped:T.open,onMountAutoFocus:Ee=>{Ee.preventDefault()},onUnmountAutoFocus:an(a,Ee=>{var Ue;(Ue=T.trigger)==null||Ue.focus({preventScroll:!0}),Ee.preventDefault()}),children:r.jsx(ev,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:o,onPointerDownOutside:l,onFocusOutside:Ee=>Ee.preventDefault(),onDismiss:()=>T.onOpenChange(!1),children:r.jsx(Ne,{role:"listbox",id:T.contentId,"data-state":T.open?"open":"closed",dir:T.dir,onContextMenu:Ee=>Ee.preventDefault(),...E,...Be,onPlaced:()=>ne(!0),ref:H,style:{display:"flex",flexDirection:"column",outline:"none",...E.style},onKeyDown:an(E.onKeyDown,Ee=>{const Ue=Ee.ctrlKey||Ee.altKey||Ee.metaKey;if(Ee.key==="Tab"&&Ee.preventDefault(),!Ue&&Ee.key.length===1&&Ce(Ee.key),["ArrowUp","ArrowDown","Home","End"].includes(Ee.key)){let je=le().filter(et=>!et.disabled).map(et=>et.ref.current);if(["ArrowUp","End"].includes(Ee.key)&&(je=je.slice().reverse()),["ArrowUp","ArrowDown"].includes(Ee.key)){const et=Ee.target,Te=je.indexOf(et);je=je.slice(Te+1)}setTimeout(()=>ae(je)),Ee.preventDefault()}})})})})})})});I6e.displayName=Yat;var Qat="SelectItemAlignedPosition",P6e=I.forwardRef((t,e)=>{const{__scopeSelect:n,onPlaced:s,...a}=t,o=sv($j,n),l=av($j,n),[i,h]=I.useState(null),[p,x]=I.useState(null),y=ta(e,H=>x(H)),b=Gne(n),j=I.useRef(!1),C=I.useRef(!0),{viewport:N,selectedItem:A,selectedItemText:E,focusSelectedItem:T}=l,L=I.useCallback(()=>{if(o.trigger&&o.valueNode&&i&&p&&N&&A&&E){const H=o.trigger.getBoundingClientRect(),Z=p.getBoundingClientRect(),G=o.valueNode.getBoundingClientRect(),te=E.getBoundingClientRect();if(o.dir!=="rtl"){const et=te.left-Z.left,Te=G.left-et,Ze=H.left-Te,pe=H.width+Ze,yt=Math.max(pe,Z.width),rt=window.innerWidth-Vp,at=rE(Te,[Vp,Math.max(Vp,rt-yt)]);i.style.minWidth=pe+"px",i.style.left=at+"px"}else{const et=Z.right-te.right,Te=window.innerWidth-G.right-et,Ze=window.innerWidth-H.right-Te,pe=H.width+Ze,yt=Math.max(pe,Z.width),rt=window.innerWidth-Vp,at=rE(Te,[Vp,Math.max(Vp,rt-yt)]);i.style.minWidth=pe+"px",i.style.right=at+"px"}const ie=b(),le=window.innerHeight-Vp*2,ye=N.scrollHeight,ne=window.getComputedStyle(p),ge=parseInt(ne.borderTopWidth,10),ae=parseInt(ne.paddingTop,10),he=parseInt(ne.borderBottomWidth,10),ue=parseInt(ne.paddingBottom,10),_e=ge+ae+ye+ue+he,Ae=Math.min(A.offsetHeight*5,_e),Ce=window.getComputedStyle(N),be=parseInt(Ce.paddingTop,10),me=parseInt(Ce.paddingBottom,10),Le=H.top+H.height/2-Vp,Ne=le-Le,Be=A.offsetHeight/2,Ee=A.offsetTop+Be,Ue=ge+ae+Ee,Re=_e-Ue;if(Ue<=Le){const et=ie.length>0&&A===ie[ie.length-1].ref.current;i.style.bottom="0px";const Te=p.clientHeight-N.offsetTop-N.offsetHeight,Ze=Math.max(Ne,Be+(et?me:0)+Te+he),pe=Ue+Ze;i.style.height=pe+"px"}else{const et=ie.length>0&&A===ie[0].ref.current;i.style.top="0px";const Ze=Math.max(Le,ge+N.offsetTop+(et?be:0)+Be)+Re;i.style.height=Ze+"px",N.scrollTop=Ue-Le+N.offsetTop}i.style.margin=`${Vp}px 0`,i.style.minHeight=Ae+"px",i.style.maxHeight=le+"px",s==null||s(),requestAnimationFrame(()=>j.current=!0)}},[b,o.trigger,o.valueNode,i,p,N,A,E,o.dir,s]);Jl(()=>L(),[L]);const[z,F]=I.useState();Jl(()=>{p&&F(window.getComputedStyle(p).zIndex)},[p]);const q=I.useCallback(H=>{H&&C.current===!0&&(L(),T==null||T(),C.current=!1)},[L,T]);return r.jsx(eit,{scope:n,contentWrapper:i,shouldExpandOnScrollRef:j,onScrollButtonChange:q,children:r.jsx("div",{ref:h,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:z},children:r.jsx(Rn.div,{...a,ref:y,style:{boxSizing:"border-box",maxHeight:"100%",...a.style}})})})});P6e.displayName=Qat;var Jat="SelectPopperPosition",the=I.forwardRef((t,e)=>{const{__scopeSelect:n,align:s="start",collisionPadding:a=Vp,...o}=t,l=Kne(n);return r.jsx(fI,{...l,...o,ref:e,align:s,collisionPadding:a,style:{boxSizing:"border-box",...o.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});the.displayName=Jat;var[eit,Lge]=l3($j,{}),rhe="SelectViewport",L6e=I.forwardRef((t,e)=>{const{__scopeSelect:n,nonce:s,...a}=t,o=av(rhe,n),l=Lge(rhe,n),i=ta(e,o.onViewportChange),h=I.useRef(0);return r.jsxs(r.Fragment,{children:[r.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:s}),r.jsx(Wne.Slot,{scope:n,children:r.jsx(Rn.div,{"data-radix-select-viewport":"",role:"presentation",...a,ref:i,style:{position:"relative",flex:1,overflow:"hidden auto",...a.style},onScroll:an(a.onScroll,p=>{const x=p.currentTarget,{contentWrapper:y,shouldExpandOnScrollRef:b}=l;if(b!=null&&b.current&&y){const j=Math.abs(h.current-x.scrollTop);if(j>0){const C=window.innerHeight-Vp*2,N=parseFloat(y.style.minHeight),A=parseFloat(y.style.height),E=Math.max(N,A);if(E0?z:0,y.style.justifyContent="flex-end")}}}h.current=x.scrollTop})})})]})});L6e.displayName=rhe;var O6e="SelectGroup",[tit,rit]=l3(O6e),nit=I.forwardRef((t,e)=>{const{__scopeSelect:n,...s}=t,a=Gc();return r.jsx(tit,{scope:n,id:a,children:r.jsx(Rn.div,{role:"group","aria-labelledby":a,...s,ref:e})})});nit.displayName=O6e;var D6e="SelectLabel",R6e=I.forwardRef((t,e)=>{const{__scopeSelect:n,...s}=t,a=rit(D6e,n);return r.jsx(Rn.div,{id:a.id,...s,ref:e})});R6e.displayName=D6e;var ete="SelectItem",[sit,F6e]=l3(ete),z6e=I.forwardRef((t,e)=>{const{__scopeSelect:n,value:s,disabled:a=!1,textValue:o,...l}=t,i=sv(ete,n),h=av(ete,n),p=i.value===s,[x,y]=I.useState(o??""),[b,j]=I.useState(!1),C=ta(e,T=>{var L;return(L=h.itemRefCallback)==null?void 0:L.call(h,T,s,a)}),N=Gc(),A=I.useRef("touch"),E=()=>{a||(i.onValueChange(s),i.onOpenChange(!1))};if(s==="")throw new Error("A must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return r.jsx(sit,{scope:n,value:s,disabled:a,textId:N,isSelected:p,onItemTextChange:I.useCallback(T=>{y(L=>L||((T==null?void 0:T.textContent)??"").trim())},[]),children:r.jsx(Wne.ItemSlot,{scope:n,value:s,disabled:a,textValue:x,children:r.jsx(Rn.div,{role:"option","aria-labelledby":N,"data-highlighted":b?"":void 0,"aria-selected":p&&b,"data-state":p?"checked":"unchecked","aria-disabled":a||void 0,"data-disabled":a?"":void 0,tabIndex:a?void 0:-1,...l,ref:C,onFocus:an(l.onFocus,()=>j(!0)),onBlur:an(l.onBlur,()=>j(!1)),onClick:an(l.onClick,()=>{A.current!=="mouse"&&E()}),onPointerUp:an(l.onPointerUp,()=>{A.current==="mouse"&&E()}),onPointerDown:an(l.onPointerDown,T=>{A.current=T.pointerType}),onPointerMove:an(l.onPointerMove,T=>{var L;A.current=T.pointerType,a?(L=h.onItemLeave)==null||L.call(h):A.current==="mouse"&&T.currentTarget.focus({preventScroll:!0})}),onPointerLeave:an(l.onPointerLeave,T=>{var L;T.currentTarget===document.activeElement&&((L=h.onItemLeave)==null||L.call(h))}),onKeyDown:an(l.onKeyDown,T=>{var z;((z=h.searchRef)==null?void 0:z.current)!==""&&T.key===" "||(qat.includes(T.key)&&E(),T.key===" "&&T.preventDefault())})})})})});z6e.displayName=ete;var iT="SelectItemText",B6e=I.forwardRef((t,e)=>{const{__scopeSelect:n,className:s,style:a,...o}=t,l=sv(iT,n),i=av(iT,n),h=F6e(iT,n),p=Gat(iT,n),[x,y]=I.useState(null),b=ta(e,E=>y(E),h.onItemTextChange,E=>{var T;return(T=i.itemTextRefCallback)==null?void 0:T.call(i,E,h.value,h.disabled)}),j=x==null?void 0:x.textContent,C=I.useMemo(()=>r.jsx("option",{value:h.value,disabled:h.disabled,children:j},h.value),[h.disabled,h.value,j]),{onNativeOptionAdd:N,onNativeOptionRemove:A}=p;return Jl(()=>(N(C),()=>A(C)),[N,A,C]),r.jsxs(r.Fragment,{children:[r.jsx(Rn.span,{id:h.textId,...o,ref:b}),h.isSelected&&l.valueNode&&!l.valueNodeHasChildren?uy.createPortal(o.children,l.valueNode):null]})});B6e.displayName=iT;var $6e="SelectItemIndicator",U6e=I.forwardRef((t,e)=>{const{__scopeSelect:n,...s}=t;return F6e($6e,n).isSelected?r.jsx(Rn.span,{"aria-hidden":!0,...s,ref:e}):null});U6e.displayName=$6e;var nhe="SelectScrollUpButton",q6e=I.forwardRef((t,e)=>{const n=av(nhe,t.__scopeSelect),s=Lge(nhe,t.__scopeSelect),[a,o]=I.useState(!1),l=ta(e,s.onScrollButtonChange);return Jl(()=>{if(n.viewport&&n.isPositioned){let i=function(){const p=h.scrollTop>0;o(p)};const h=n.viewport;return i(),h.addEventListener("scroll",i),()=>h.removeEventListener("scroll",i)}},[n.viewport,n.isPositioned]),a?r.jsx(H6e,{...t,ref:l,onAutoScroll:()=>{const{viewport:i,selectedItem:h}=n;i&&h&&(i.scrollTop=i.scrollTop-h.offsetHeight)}}):null});q6e.displayName=nhe;var she="SelectScrollDownButton",V6e=I.forwardRef((t,e)=>{const n=av(she,t.__scopeSelect),s=Lge(she,t.__scopeSelect),[a,o]=I.useState(!1),l=ta(e,s.onScrollButtonChange);return Jl(()=>{if(n.viewport&&n.isPositioned){let i=function(){const p=h.scrollHeight-h.clientHeight,x=Math.ceil(h.scrollTop)h.removeEventListener("scroll",i)}},[n.viewport,n.isPositioned]),a?r.jsx(H6e,{...t,ref:l,onAutoScroll:()=>{const{viewport:i,selectedItem:h}=n;i&&h&&(i.scrollTop=i.scrollTop+h.offsetHeight)}}):null});V6e.displayName=she;var H6e=I.forwardRef((t,e)=>{const{__scopeSelect:n,onAutoScroll:s,...a}=t,o=av("SelectScrollButton",n),l=I.useRef(null),i=Gne(n),h=I.useCallback(()=>{l.current!==null&&(window.clearInterval(l.current),l.current=null)},[]);return I.useEffect(()=>()=>h(),[h]),Jl(()=>{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:an(a.onPointerDown,()=>{l.current===null&&(l.current=window.setInterval(s,50))}),onPointerMove:an(a.onPointerMove,()=>{var p;(p=o.onItemLeave)==null||p.call(o),l.current===null&&(l.current=window.setInterval(s,50))}),onPointerLeave:an(a.onPointerLeave,()=>{h()})})}),ait="SelectSeparator",W6e=I.forwardRef((t,e)=>{const{__scopeSelect:n,...s}=t;return r.jsx(Rn.div,{"aria-hidden":!0,...s,ref:e})});W6e.displayName=ait;var ahe="SelectArrow",iit=I.forwardRef((t,e)=>{const{__scopeSelect:n,...s}=t,a=Kne(n),o=sv(ahe,n),l=av(ahe,n);return o.open&&l.position==="popper"?r.jsx(pI,{...a,...s,ref:e}):null});iit.displayName=ahe;var oit="SelectBubbleInput",G6e=I.forwardRef(({__scopeSelect:t,value:e,...n},s)=>{const a=I.useRef(null),o=ta(s,a),l=kI(e);return I.useEffect(()=>{const i=a.current;if(!i)return;const h=window.HTMLSelectElement.prototype,x=Object.getOwnPropertyDescriptor(h,"value").set;if(l!==e&&x){const y=new Event("change",{bubbles:!0});x.call(i,e),i.dispatchEvent(y)}},[l,e]),r.jsx(Rn.select,{...n,style:{...WTe,...n.style},ref:o,defaultValue:e})});G6e.displayName=oit;function K6e(t){return t===""||t===void 0}function Z6e(t){const e=Xl(t),n=I.useRef(""),s=I.useRef(0),a=I.useCallback(l=>{const i=n.current+l;e(i),function h(p){n.current=p,window.clearTimeout(s.current),p!==""&&(s.current=window.setTimeout(()=>h(""),1e3))}(i)},[e]),o=I.useCallback(()=>{n.current="",window.clearTimeout(s.current)},[]);return I.useEffect(()=>()=>window.clearTimeout(s.current),[]),[n,a,o]}function Y6e(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=lit(t,Math.max(o,0));a.length===1&&(l=l.filter(p=>p!==n));const h=l.find(p=>p.textValue.toLowerCase().startsWith(a.toLowerCase()));return h!==n?h:void 0}function lit(t,e){return t.map((n,s)=>t[(e+s)%t.length])}var cit=j6e,X6e=N6e,dit=C6e,uit=M6e,hit=T6e,Q6e=A6e,fit=L6e,J6e=R6e,eLe=z6e,pit=B6e,mit=U6e,tLe=q6e,rLe=V6e,nLe=W6e;const gn=cit,xn=dit,fn=I.forwardRef(({className:t,children:e,...n},s)=>r.jsxs(X6e,{ref:s,className:$t("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(uit,{asChild:!0,children:r.jsx(Dd,{className:"h-4 w-4 opacity-50"})})]}));fn.displayName=X6e.displayName;const sLe=I.forwardRef(({className:t,...e},n)=>r.jsx(tLe,{ref:n,className:$t("flex cursor-default items-center justify-center py-1",t),...e,children:r.jsx(c1,{className:"h-4 w-4"})}));sLe.displayName=tLe.displayName;const aLe=I.forwardRef(({className:t,...e},n)=>r.jsx(rLe,{ref:n,className:$t("flex cursor-default items-center justify-center py-1",t),...e,children:r.jsx(Dd,{className:"h-4 w-4"})}));aLe.displayName=rLe.displayName;const pn=I.forwardRef(({className:t,children:e,position:n="popper",...s},a)=>r.jsx(hit,{children:r.jsxs(Q6e,{ref:a,className:$t("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(sLe,{}),r.jsx(fit,{className:$t("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:e}),r.jsx(aLe,{})]})}));pn.displayName=Q6e.displayName;const git=I.forwardRef(({className:t,...e},n)=>r.jsx(J6e,{ref:n,className:$t("py-1.5 pl-8 pr-2 text-sm font-semibold",t),...e}));git.displayName=J6e.displayName;const Vt=I.forwardRef(({className:t,children:e,...n},s)=>r.jsxs(eLe,{ref:s,className:$t("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(mit,{children:r.jsx(Ai,{className:"h-4 w-4"})})}),r.jsx(pit,{children:e})]}));Vt.displayName=eLe.displayName;const xit=I.forwardRef(({className:t,...e},n)=>r.jsx(nLe,{ref:n,className:$t("-mx-1 my-1 h-px bg-muted",t),...e}));xit.displayName=nLe.displayName;const yit=t=>Yt({queryKey:["public-listings",t],queryFn:async()=>{let e=J.from("listings").select(` id, slug, agent_id, property_address, city, state, neighborhood, price, property_type, status, bedrooms, bathrooms, square_footage, lot_size, year_built, has_hoa, description, 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}}),iLe=t=>Yt({queryKey:["public-listing",t],queryFn:async()=>{const e=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(t);let n=J.from("listings").select(` id, slug, agent_id, property_address, city, state, neighborhood, price, property_type, status, bedrooms, bathrooms, square_footage, lot_size, year_built, has_hoa, description, agent_notes, agent_notes_public, mls_link, video_link, video_id, 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}),oLe=()=>cr({mutationFn:async({listingId:t,agentId:e,firstName:n,lastName:s,email:a,phone:o,shareToken:l})=>{let i=null,h=null;if(l){const{data:b}=await J.from("listing_shares").select("id, sharing_agent_id").eq("share_token",l).eq("listing_id",t).maybeSingle();b&&(i=b.id,h=b.sharing_agent_id)}const{data:p,error:x}=await J.from("listing_leads").insert({listing_id:t,agent_id:h||e,first_name:n,last_name:s,email:a,phone:o,share_id:i,referred_by_agent_id:h}).select().single();if(x)throw x;const{error:y}=await J.functions.invoke("process-listing-lead",{body:{leadId:p.id}});return y&&console.error("Error processing lead:",y),p}}),vit=()=>cr({mutationFn:async t=>{const{error:e}=await J.rpc("increment_listing_share_click",{p_share_token:t});if(e)throw e}}),_it={active:"bg-emerald-500",coming_soon:"bg-blue-600",price_improvement:"bg-orange-500",under_contract:"bg-purple-500",sold:"bg-gray-500"},mje={active:"Active",coming_soon:"Coming Soon",price_improvement:"Price Improvement",under_contract:"Under Contract",sold:"Sold"},bit={single_family:"Single Family",condo:"Condo",townhouse:"Townhouse",land:"Land",multi_family:"Multi-Family",luxury:"Luxury",commercial:"Commercial",other:"Other"};function lLe(){const[t,e]=I.useState(""),[n,s]=I.useState(!1),[a,o]=I.useState({status:"",propertyType:"",minPrice:"",maxPrice:""}),{data:l,isLoading:i}=yit({city:t||void 0,status:a.status||void 0,propertyType:a.propertyType||void 0,minPrice:a.minPrice?Number(a.minPrice):void 0,maxPrice:a.maxPrice?Number(a.maxPrice):void 0}),h=y=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(y),p=()=>{o({status:"",propertyType:"",minPrice:"",maxPrice:""}),e("")},x=t||a.status||a.propertyType||a.minPrice||a.maxPrice;return r.jsxs(r.Fragment,{children:[r.jsxs(km,{children:[r.jsx("title",{children:"LevelUp Listings - Find Your Dream Home | Real Estate for Sale"}),r.jsx("meta",{name:"description",content:"Browse exclusive property listings from LevelUp real estate agents. Find homes for sale, condos, townhouses, and luxury properties. View photos, prices, and connect with agents."}),r.jsx("link",{rel:"canonical",href:"https://listings.relevelup.com"}),r.jsx("meta",{property:"og:title",content:"LevelUp Listings - Find Your Dream Home"}),r.jsx("meta",{property:"og:description",content:"Browse exclusive property listings from LevelUp real estate agents. Find homes for sale, view photos, and connect with agents."}),r.jsx("meta",{property:"og:type",content:"website"}),r.jsx("meta",{property:"og:url",content:"https://listings.relevelup.com"}),r.jsx("meta",{property:"og:site_name",content:"LevelUp Listings"}),r.jsx("meta",{property:"og:locale",content:"en_US"}),r.jsx("meta",{name:"twitter:card",content:"summary_large_image"}),r.jsx("meta",{name:"twitter:title",content:"LevelUp Listings - Find Your Dream Home"}),r.jsx("meta",{name:"twitter:description",content:"Browse exclusive property listings from LevelUp real estate agents."}),r.jsx("meta",{name:"robots",content:"index, follow"}),r.jsx("meta",{name:"keywords",content:"homes for sale, real estate, property listings, houses, condos, townhouses, luxury homes, LevelUp"}),r.jsx("script",{type:"application/ld+json",children:JSON.stringify({"@context":"https://schema.org","@type":"WebSite",name:"LevelUp Listings",url:"https://listings.relevelup.com",description:"Browse exclusive property listings from LevelUp real estate agents",potentialAction:{"@type":"SearchAction",target:{"@type":"EntryPoint",urlTemplate:"https://listings.relevelup.com?q={search_term_string}"},"query-input":"required name=search_term_string"}})}),r.jsx("script",{type:"application/ld+json",children:JSON.stringify({"@context":"https://schema.org","@type":"RealEstateAgent",name:"LevelUp",url:"https://relevelup.com",logo:"https://listings.relevelup.com/assets/levelup-logo-color.png"})})]}),r.jsxs("div",{className:"min-h-screen bg-gray-50",children:[r.jsx("header",{className:"bg-white border-b border-gray-200 sticky top-0 z-50",children:r.jsx("div",{className:"max-w-7xl mx-auto px-4 py-3",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(co,{to:"/public/listings",className:"flex items-center",children:r.jsx("img",{src:tE,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(${$at})`},children:[r.jsx("div",{className:"absolute inset-0 bg-black/40"}),r.jsxs("div",{className:"relative max-w-7xl mx-auto px-4",children:[r.jsx("h1",{className:"text-4xl md:text-5xl lg:text-6xl font-bold text-white mb-3 text-center drop-shadow-lg",children:"Find Your Perfect Home"}),r.jsx("p",{className:"text-white/90 text-center mb-10 text-lg md:text-xl drop-shadow",children:"Exclusive listings from LevelUp agents"}),r.jsxs("div",{className:"max-w-3xl mx-auto",children:[r.jsxs("div",{className:"flex gap-0 shadow-2xl rounded-lg overflow-hidden",children:[r.jsxs("div",{className:"relative flex-1 bg-white",children:[r.jsx(wa,{className:"absolute left-4 top-1/2 -translate-y-1/2 h-5 w-5 text-gray-400"}),r.jsx(dt,{placeholder:"Enter an address, neighborhood, city, or ZIP code",value:t,onChange:y=>e(y.target.value),className:"pl-12 h-14 md:h-16 text-base md:text-lg border-0 focus-visible:ring-0 rounded-none bg-white"})]}),r.jsx(ee,{className:"h-14 md:h-16 px-6 md:px-8 rounded-none bg-blue-600 hover:bg-blue-700",children:r.jsx(wa,{className:"h-5 w-5 md:h-6 md:w-6"})})]}),r.jsx("div",{className:"flex justify-center mt-6",children:r.jsxs(ee,{variant:"secondary",size:"sm",onClick:()=>s(!n),className:"gap-2 bg-white/90 hover:bg-white text-gray-700 shadow-lg",children:[r.jsx(KT,{className:"h-4 w-4"}),n?"Hide Filters":"More Filters"]})}),n&&r.jsxs("div",{className:"mt-4 p-6 bg-white rounded-lg shadow-xl",children:[r.jsxs("div",{className:"grid sm:grid-cols-2 md:grid-cols-4 gap-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-gray-700 mb-1.5 block",children:"Status"}),r.jsxs(gn,{value:a.status||"all",onValueChange:y=>o({...a,status:y==="all"?"":y}),children:[r.jsx(fn,{className:"bg-white",children:r.jsx(xn,{placeholder:"Any status"})}),r.jsxs(pn,{children:[r.jsx(Vt,{value:"all",children:"Any status"}),Object.entries(mje).map(([y,b])=>r.jsx(Vt,{value:y,children:b},y))]})]})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-gray-700 mb-1.5 block",children:"Property Type"}),r.jsxs(gn,{value:a.propertyType||"all",onValueChange:y=>o({...a,propertyType:y==="all"?"":y}),children:[r.jsx(fn,{className:"bg-white",children:r.jsx(xn,{placeholder:"Any type"})}),r.jsxs(pn,{children:[r.jsx(Vt,{value:"all",children:"Any type"}),Object.entries(bit).map(([y,b])=>r.jsx(Vt,{value:y,children:b},y))]})]})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-gray-700 mb-1.5 block",children:"Min Price"}),r.jsx(dt,{type:"number",placeholder:"No min",value:a.minPrice,onChange:y=>o({...a,minPrice:y.target.value}),className:"bg-white"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-gray-700 mb-1.5 block",children:"Max Price"}),r.jsx(dt,{type:"number",placeholder:"No max",value:a.maxPrice,onChange:y=>o({...a,maxPrice:y.target.value}),className:"bg-white"})]})]}),x&&r.jsx("div",{className:"flex justify-end mt-4",children:r.jsxs(ee,{variant:"ghost",size:"sm",onClick:p,className:"gap-1 text-gray-500",children:[r.jsx(_s,{className:"h-4 w-4"}),"Clear all"]})})]})]})]})]}),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,b)=>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"})]})]},b))}):l&&l.length>0?r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"flex items-center justify-between mb-6",children:r.jsxs("h2",{className:"text-xl font-semibold text-gray-900",children:[l.length," ",l.length===1?"Home":"Homes"," Available"]})}),r.jsx("div",{className:"grid sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-5",children:l.map(y=>{var N,A,E;const b=((N=y.photos)==null?void 0:N.find(T=>T.is_primary))||((A=y.photos)==null?void 0:A[0]),C=window.location.hostname==="listings.relevelup.com"||window.location.hostname.startsWith("listings.")?`/${y.slug||y.id}`:`/public/listing/${y.slug||y.id}`;return r.jsx(co,{to:C,children:r.jsxs("div",{className:"bg-white rounded-lg overflow-hidden shadow-sm hover:shadow-lg transition-shadow cursor-pointer group border border-gray-100",children:[r.jsxs("div",{className:"aspect-[4/3] relative overflow-hidden bg-gray-100",children:[b?r.jsx("img",{src:b.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(pa,{className:"h-12 w-12 text-gray-300"})}),r.jsx(Ot,{className:`absolute top-2 left-2 ${_it[y.status]} text-white border-0 text-xs font-medium px-2 py-0.5`,children:mje[y.status]}),r.jsx("button",{className:"absolute top-2 right-2 p-2 rounded-full bg-white/80 hover:bg-white transition-colors",onClick:T=>T.preventDefault(),children:r.jsx(ci,{className:"h-5 w-5 text-gray-600"})})]}),r.jsxs("div",{className:"p-4",children:[r.jsx("p",{className:"text-xl font-bold text-gray-900 mb-1",children:h(y.price)}),r.jsxs("div",{className:"flex items-center gap-1 text-sm text-gray-700 mb-2",children:[y.bedrooms&&r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"font-semibold",children:y.bedrooms}),r.jsx("span",{className:"text-gray-500",children:"bds"}),r.jsx("span",{className:"text-gray-300 mx-1",children:"|"})]}),y.bathrooms&&r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"font-semibold",children:y.bathrooms}),r.jsx("span",{className:"text-gray-500",children:"ba"}),r.jsx("span",{className:"text-gray-300 mx-1",children:"|"})]}),y.square_footage&&r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"font-semibold",children:y.square_footage.toLocaleString()}),r.jsx("span",{className:"text-gray-500",children:"sqft"})]})]}),y.property_address&&r.jsx("p",{className:"text-sm text-gray-700 truncate",children:y.property_address}),r.jsxs("p",{className:"text-sm text-gray-500 truncate",children:[y.city,", ",y.state]}),y.agent&&r.jsxs("div",{className:"mt-3 pt-3 border-t border-gray-100",children:[r.jsx("p",{className:"text-xs text-gray-500 truncate",children:y.agent.name}),((E=y.agent.brokerage)==null?void 0:E.name)&&r.jsx("p",{className:"text-xs text-gray-400 truncate",children:y.agent.brokerage.name})]})]})]})},y.id)})})]}):r.jsxs("div",{className:"text-center py-16",children:[r.jsx("div",{className:"w-20 h-20 mx-auto mb-4 rounded-full bg-gray-100 flex items-center justify-center",children:r.jsx(pa,{className:"h-10 w-10 text-gray-400"})}),r.jsx("h3",{className:"text-xl font-semibold text-gray-900 mb-2",children:"No listings found"}),r.jsx("p",{className:"text-gray-500 mb-6",children:x?"Try adjusting your search or filters":"Check back soon for new listings"}),x&&r.jsx(ee,{variant:"outline",onClick:p,children:"Clear filters"})]})})}),r.jsx("footer",{className:"bg-gray-900 text-white py-10 mt-auto",children:r.jsx("div",{className:"max-w-7xl mx-auto px-4",children:r.jsxs("div",{className:"flex flex-col md:flex-row items-center justify-between gap-4",children:[r.jsx("div",{className:"flex items-center gap-2",children:r.jsx("img",{src:Pge,alt:"LevelUp",className:"h-6"})}),r.jsxs("p",{className:"text-gray-400 text-sm",children:["© ",new Date().getFullYear()," LevelUp. All rights reserved."]}),r.jsx("a",{href:"https://relevelup.com",target:"_blank",rel:"noopener noreferrer",className:"text-gray-400 hover:text-white text-sm transition-colors",children:"relevelup.com"})]})})})]})]})}const Ye=I.forwardRef(({className:t,...e},n)=>r.jsx("div",{ref:n,className:$t("rounded-lg border bg-card text-card-foreground shadow-sm",t),...e}));Ye.displayName="Card";const Gt=I.forwardRef(({className:t,...e},n)=>r.jsx("div",{ref:n,className:$t("flex flex-col space-y-1.5 p-6",t),...e}));Gt.displayName="CardHeader";const Zt=I.forwardRef(({className:t,...e},n)=>r.jsx("h3",{ref:n,className:$t("text-2xl font-semibold leading-none tracking-tight",t),...e}));Zt.displayName="CardTitle";const Mn=I.forwardRef(({className:t,...e},n)=>r.jsx("p",{ref:n,className:$t("text-sm text-muted-foreground",t),...e}));Mn.displayName="CardDescription";const tt=I.forwardRef(({className:t,...e},n)=>r.jsx("div",{ref:n,className:$t("p-6 pt-0",t),...e}));tt.displayName="CardContent";const aA=I.forwardRef(({className:t,...e},n)=>r.jsx("div",{ref:n,className:$t("flex items-center p-6 pt-0",t),...e}));aA.displayName="CardFooter";var wit="Label",cLe=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())}}));cLe.displayName=wit;var dLe=cLe;const jit=KC("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),He=I.forwardRef(({className:t,...e},n)=>r.jsx(dLe,{ref:n,className:$t(jit(),t),...e}));He.displayName=dLe.displayName;function kit(){const t=jm(),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(lLe,{}):s.startsWith("public/")?null:r.jsx(Nit,{slug:s})}function Nit({slug:t}){return r.jsx(Mit,{slug:t})}const Sit={active:"bg-emerald-500",coming_soon:"bg-sky-500",price_improvement:"bg-orange-500",under_contract:"bg-purple-500",sold:"bg-gray-500"},Cit={active:"Active",coming_soon:"Coming Soon",price_improvement:"Price Improvement",under_contract:"Under Contract",sold:"Sold"},gje={single_family:"Single Family",condo:"Condo",townhouse:"Townhouse",land:"Land",multi_family:"Multi-Family",luxury:"Luxury",commercial:"Commercial",other:"Other"};function Mit({slug:t}){var G,te;const{data:e,isLoading:n}=iLe(t),s=oLe(),[a,o]=I.useState(""),[l,i]=I.useState(""),[h,p]=I.useState(""),[x,y]=I.useState(""),[b,j]=I.useState(!1),[C,N]=I.useState(!1),[A,E]=I.useState(null),T=ie=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(ie),L=async ie=>{if(ie.preventDefault(),!(!a.trim()||!h.trim()||!e)){j(!0);try{await s.mutateAsync({listingId:e.id,agentId:e.agent_id,firstName:a.trim(),lastName:l.trim(),email:h.trim(),phone:x.trim()}),N(!0),ze.success("Thanks! The agent will be in touch soon.")}catch(le){console.error("Lead submission error:",le),ze.error(`Failed to submit: ${le.message||"Please try again"}`)}finally{j(!1)}}},z=(e==null?void 0:e.photos)||[],F=z.find(ie=>ie.is_primary)||z[0],q=()=>{A!==null&&E(A===0?z.length-1:A-1)},H=()=>{A!==null&&E(A===z.length-1?0:A+1)};if(n)return r.jsxs("div",{className:"min-h-screen bg-background",children:[r.jsx("header",{className:"border-b bg-card",children:r.jsx("div",{className:"container mx-auto px-4 py-4",children:r.jsx(Ir,{className:"h-8 w-32"})})}),r.jsxs("div",{className:"container mx-auto px-4 py-8",children:[r.jsx(Ir,{className:"h-10 w-48 mb-6"}),r.jsx(Ir,{className:"aspect-video mb-6"}),r.jsxs("div",{className:"grid md:grid-cols-3 gap-6",children:[r.jsxs("div",{className:"md:col-span-2 space-y-4",children:[r.jsx(Ir,{className:"h-12 w-48"}),r.jsx(Ir,{className:"h-6 w-full"}),r.jsx(Ir,{className:"h-6 w-3/4"})]}),r.jsx(Ir,{className:"h-64"})]})]})]});if(!e)return r.jsxs("div",{className:"min-h-screen bg-background",children:[r.jsx("header",{className:"border-b bg-card",children:r.jsx("div",{className:"container mx-auto px-4 py-4",children:r.jsx("a",{href:"/",className:"flex items-center gap-2",children:r.jsx("img",{src:tE,alt:"LevelUp",className:"h-8"})})})}),r.jsxs("div",{className:"container mx-auto px-4 py-16 text-center",children:[r.jsx(pa,{className:"h-16 w-16 mx-auto text-muted-foreground mb-4"}),r.jsx("h1",{className:"text-2xl font-bold mb-2",children:"Listing Not Found"}),r.jsx("p",{className:"text-muted-foreground mb-4",children:"This listing may no longer be available."}),r.jsx(ee,{asChild:!0,children:r.jsx("a",{href:"/",children:"Browse All Listings"})})]})]});const Z=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(km,{children:[r.jsxs("title",{children:[Z," | LevelUp Listings"]}),r.jsx("meta",{name:"description",content:`${T(e.price)} - ${e.bedrooms||""}BD ${e.bathrooms||""}BA ${e.square_footage?e.square_footage.toLocaleString()+" sqft":""} ${gje[e.property_type]} in ${e.city}, ${e.state}. ${((G=e.description)==null?void 0:G.slice(0,150))||""}`}),r.jsx("meta",{property:"og:title",content:Z}),r.jsx("meta",{property:"og:description",content:`${T(e.price)} - ${e.bedrooms||""}BD ${e.bathrooms||""}BA in ${e.city}, ${e.state}`}),r.jsx("meta",{property:"og:type",content:"website"}),F&&r.jsx("meta",{property:"og:image",content:F.photo_url})]}),r.jsxs("div",{className:"min-h-screen bg-background",children:[r.jsx("header",{className:"border-b bg-card sticky top-0 z-50",children:r.jsx("div",{className:"container mx-auto px-4 py-4",children:r.jsx("div",{className:"flex items-center justify-between",children:r.jsx("a",{href:"/",className:"flex items-center gap-2",children:r.jsx("img",{src:tE,alt:"LevelUp",className:"h-8"})})})})}),r.jsxs("div",{className:"container mx-auto px-4 py-6",children:[r.jsxs("a",{href:"/",className:"inline-flex items-center text-muted-foreground hover:text-foreground mb-6",children:[r.jsx(so,{className:"h-4 w-4 mr-2"}),"Back to Listings"]}),z.length>0&&r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 mb-8",children:[r.jsx("div",{className:"md:col-span-2",children:r.jsx("div",{className:"aspect-[16/10] rounded-lg overflow-hidden bg-muted cursor-pointer",onClick:()=>E(0),children:r.jsx("img",{src:F==null?void 0:F.photo_url,alt:"Primary",className:"w-full h-full object-cover hover:scale-105 transition-transform duration-300"})})}),r.jsx("div",{className:"grid grid-cols-2 gap-2",children:z.slice(1,5).map((ie,le)=>r.jsxs("div",{className:"aspect-square rounded-lg overflow-hidden bg-muted cursor-pointer relative",onClick:()=>E(le+1),children:[r.jsx("img",{src:ie.photo_url,alt:`Photo ${le+2}`,className:"w-full h-full object-cover hover:scale-105 transition-transform duration-300"}),le===3&&z.length>5&&r.jsxs("div",{className:"absolute inset-0 bg-black/60 flex items-center justify-center text-white font-semibold",children:["+",z.length-5," more"]})]},ie.id))})]}),r.jsxs("div",{className:"grid md:grid-cols-3 gap-8",children:[r.jsxs("div",{className:"md:col-span-2 space-y-6",children:[r.jsxs("div",{children:[r.jsx("div",{className:"flex items-center gap-2 mb-3",children:r.jsx(Ot,{className:`${Sit[e.status]} text-white border-0`,children:Cit[e.status]})}),r.jsx("h1",{className:"text-4xl font-bold text-primary mb-2",children:T(e.price)}),e.property_address&&r.jsx("p",{className:"text-xl font-medium",children:e.property_address}),r.jsxs("p",{className:"text-muted-foreground flex items-center gap-1",children:[r.jsx(fl,{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(l1,{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(o1,{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(wg,{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(zs,{className:"h-6 w-6 mx-auto mb-1 text-muted-foreground"}),r.jsx("p",{className:"text-xl font-semibold",children:e.year_built}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Built"})]})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex flex-wrap gap-2",children:[r.jsxs(Ot,{variant:"secondary",children:[r.jsx(ai,{className:"h-3 w-3 mr-1"}),gje[e.property_type]]}),e.lot_size&&r.jsxs(Ot,{variant:"secondary",children:["Lot: ",e.lot_size]}),e.has_hoa&&r.jsx(Ot,{variant:"secondary",children:"HOA"})]}),e.description&&r.jsxs("div",{children:[r.jsx("h2",{className:"text-lg font-semibold mb-2",children:"About This Property"}),r.jsx("p",{className:"text-muted-foreground whitespace-pre-wrap",children:e.description})]}),e.agent_notes&&e.agent_notes_public&&r.jsxs("div",{children:[r.jsx("h2",{className:"text-lg font-semibold mb-2",children:"Agent Notes"}),r.jsx("p",{className:"text-muted-foreground whitespace-pre-wrap",children:e.agent_notes})]}),e.mls_link&&r.jsx(ee,{variant:"outline",asChild:!0,children:r.jsxs("a",{href:e.mls_link,target:"_blank",rel:"noopener noreferrer",children:[r.jsx(Fs,{className:"h-4 w-4 mr-2"}),"View on MLS"]})})]})]}),r.jsxs("div",{className:"space-y-6",children:[e.agent&&r.jsxs(Ye,{children:[r.jsx(Gt,{children:r.jsxs(Zt,{className:"text-lg flex items-center gap-2",children:[r.jsx(Ec,{className:"h-5 w-5"}),"Listing Agent"]})}),r.jsxs(tt,{children:[r.jsx("p",{className:"font-semibold text-lg",children:e.agent.name}),((te=e.agent.brokerage)==null?void 0:te.name)&&r.jsx("p",{className:"text-sm text-muted-foreground",children:e.agent.brokerage.name})]})]}),r.jsxs(Ye,{className:"border-primary",children:[r.jsx(Gt,{children:r.jsx(Zt,{className:"text-lg",children:"Interested in this property?"})}),r.jsx(tt,{children:C?r.jsxs("div",{className:"text-center py-4",children:[r.jsx("div",{className:"h-12 w-12 rounded-full bg-primary/10 flex items-center justify-center mx-auto mb-3",children:r.jsx(da,{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:L,className:"space-y-3",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsxs("div",{children:[r.jsx(He,{htmlFor:"firstName",children:"First Name *"}),r.jsx(dt,{id:"firstName",type:"text",placeholder:"John",value:a,onChange:ie=>o(ie.target.value),required:!0})]}),r.jsxs("div",{children:[r.jsx(He,{htmlFor:"lastName",children:"Last Name"}),r.jsx(dt,{id:"lastName",type:"text",placeholder:"Doe",value:l,onChange:ie=>i(ie.target.value)})]})]}),r.jsxs("div",{children:[r.jsx(He,{htmlFor:"email",children:"Email *"}),r.jsx(dt,{id:"email",type:"email",placeholder:"you@example.com",value:h,onChange:ie=>p(ie.target.value),required:!0})]}),r.jsxs("div",{children:[r.jsx(He,{htmlFor:"phone",children:"Phone"}),r.jsx(dt,{id:"phone",type:"tel",placeholder:"(555) 123-4567",value:x,onChange:ie=>y(ie.target.value)})]}),r.jsx(ee,{type:"submit",className:"w-full",disabled:b,children:b?"Submitting...":"Get More Info"}),r.jsx("p",{className:"text-xs text-muted-foreground text-center",children:"The listing agent will reach out to you directly."})]})})]})]})]})]}),r.jsx(Fr,{open:A!==null,onOpenChange:()=>E(null),children:r.jsxs(Rr,{className:"max-w-5xl p-0 bg-black/95",children:[r.jsx(qr,{className:"sr-only",children:r.jsx($r,{children:"Photo Gallery"})}),r.jsx("button",{onClick:()=>E(null),className:"absolute right-4 top-4 z-50 rounded-full bg-black/50 p-2 text-white hover:bg-black/70",children:r.jsx(_s,{className:"h-5 w-5"})}),A!==null&&z[A]&&r.jsxs("div",{className:"relative",children:[r.jsx("img",{src:z[A].photo_url,alt:`Photo ${A+1}`,className:"w-full max-h-[80vh] object-contain"}),z.length>1&&r.jsxs(r.Fragment,{children:[r.jsx("button",{onClick:q,className:"absolute left-4 top-1/2 -translate-y-1/2 rounded-full bg-black/50 p-2 text-white hover:bg-black/70",children:r.jsx(Tc,{className:"h-6 w-6"})}),r.jsx("button",{onClick:H,className:"absolute right-4 top-1/2 -translate-y-1/2 rounded-full bg-black/50 p-2 text-white hover:bg-black/70",children:r.jsx(Vi,{className:"h-6 w-6"})}),r.jsxs("div",{className:"absolute bottom-4 left-1/2 -translate-x-1/2 text-white bg-black/50 px-3 py-1 rounded-full text-sm",children:[A+1," / ",z.length]})]})]})]})}),r.jsx("footer",{className:"border-t py-8 mt-16",children:r.jsxs("div",{className:"container mx-auto px-4 text-center text-sm text-muted-foreground",children:[r.jsxs("p",{children:["© ",new Date().getFullYear()," LevelUp. All rights reserved."]}),r.jsx("p",{className:"mt-2",children:r.jsx("a",{href:"https://relevelup.com",target:"_blank",rel:"noopener noreferrer",className:"hover:text-foreground",children:"relevelup.com"})})]})})]})]})}function Zne({card:t,variant:e}){const n=t.brokerage_display_name||t.brokerage_logo_url,s=t.team_name||t.team_logo_url;if(!n&&!s)return null;const a={standard:{container:"bg-slate-50 border border-slate-100",text:"text-slate-600",subtext:"text-slate-400"},luxury:{container:"bg-[#1e2636] border border-[#c9a84c]/10",text:"text-[#e2e8f0]",subtext:"text-[#4a5568]"},bold:{container:"bg-gray-50 border border-gray-100",text:"text-[#1a1a2e]",subtext:"text-gray-400"},classic:{container:"bg-white border border-[#d4cfc5] shadow-sm",text:"text-[#1b3a4b]",subtext:"text-[#a0aec0]"}}[e];return r.jsx("div",{className:`rounded-2xl p-4 mb-6 ${a.container}`,children:r.jsxs("div",{className:`flex flex-col items-center gap-3 ${n&&s?"divide-y divide-current/10":""}`,children:[n&&r.jsxs("div",{className:"flex flex-col items-center gap-1.5 w-full",children:[t.brokerage_logo_url&&r.jsx("img",{src:t.brokerage_logo_url,alt:t.brokerage_display_name||"Brokerage",style:{height:`${t.brokerage_logo_size||56}px`},className:"max-w-[280px] object-contain"}),t.brokerage_display_name&&!t.brokerage_logo_url&&r.jsx("p",{className:`text-sm font-medium ${a.text}`,children:t.brokerage_display_name})]}),s&&r.jsxs("div",{className:`flex flex-col items-center gap-1.5 w-full ${n?"pt-3":""}`,children:[t.team_logo_url&&r.jsx("img",{src:t.team_logo_url,alt:t.team_name||"Team",style:{height:`${t.team_logo_size||56}px`},className:"max-w-[280px] object-contain"}),t.team_name&&!t.team_logo_url&&r.jsx("p",{className:`text-sm font-medium ${a.text}`,children:t.team_name})]})]})})}const uLe=t=>Yt({queryKey:["agent-card-public",t],queryFn:async()=>{if(!t)throw new Error("No slug provided");const{data:e,error:n}=await J.from("agent_cards").select("*").eq("slug",t).eq("is_published",!0).single();if(n)throw n;const{data:s}=await J.from("profiles").select("name, email, phone, brokerage_id").eq("id",e.user_id).single();let a=null;if(s!=null&&s.brokerage_id){const{data:l}=await J.from("brokerages").select("name").eq("id",s.brokerage_id).single();a=(l==null?void 0:l.name)||null}let o=null;try{const{data:l}=await J.from("profiles").select("avatar_url").eq("id",e.user_id).single();if(l!=null&&l.avatar_url)o=l.avatar_url;else{const{data:i}=await J.storage.from("avatars").list(`${e.user_id}`);if(i&&i.length>0){const{data:h}=J.storage.from("avatars").getPublicUrl(`${e.user_id}/${i[0].name}`);o=`${h.publicUrl}?t=${Date.now()}`}}}catch{}return{...e,social_links:e.social_links||[],profile:s||{name:null,email:null,phone:null,brokerage_id:null},brokerage_name:e.brokerage_display_name||a,avatar_url:o}},enabled:!!t}),Tit=()=>Yt({queryKey:["agent-cards-admin"],queryFn:async()=>{const{data:t,error:e}=await J.from("agent_cards").select("*").order("created_at",{ascending:!1});if(e)throw e;return t}}),Ait=t=>Yt({queryKey:["agent-card",t],queryFn:async()=>{if(!t)return null;const{data:e,error:n}=await J.from("agent_cards").select("*").eq("user_id",t).maybeSingle();if(n)throw n;return e},enabled:!!t}),hLe=()=>{const t=Vr();return cr({mutationFn:async e=>{const{data:n,error:s}=await J.from("agent_cards").insert(e).select().single();if(s)throw s;return n},onSuccess:()=>{t.invalidateQueries({queryKey:["agent-cards-admin"]}),t.invalidateQueries({queryKey:["agent-card"]}),ze.success("Agent card created")},onError:e=>ze.error(e.message)})},fLe=()=>{const t=Vr();return cr({mutationFn:async({id:e,...n})=>{const{data:s,error:a}=await J.from("agent_cards").update(n).eq("id",e).select().single();if(a)throw a;return s},onSuccess:(e,n)=>{t.invalidateQueries({queryKey:["agent-cards-admin"]}),t.invalidateQueries({queryKey:["agent-card"]}),ze.success("Agent card updated")},onError:e=>ze.error(e.message)})},Ti=async(t,e,n,s)=>{const a=new URLSearchParams(window.location.search);await J.from("agent_card_interactions").insert({card_id:t,interaction_type:e,interaction_detail:n||null,referrer:document.referrer||null,user_agent:navigator.userAgent||null,utm_source:a.get("utm_source")||null,utm_medium:a.get("utm_medium")||null,utm_campaign:a.get("utm_campaign")||null,metadata:{}})},Eit=async(t,e)=>{const{error:n}=await J.from("agent_card_leads").insert({card_id:t,...e});if(n)throw n},pLe=t=>Yt({queryKey:["agent-card-analytics",t],queryFn:async()=>{if(!t)return null;const{data:e,error:n}=await J.from("agent_card_interactions").select("interaction_type, interaction_detail, created_at").eq("card_id",t).order("created_at",{ascending:!1}).limit(500);if(n)throw n;const{data:s,error:a}=await J.from("agent_card_leads").select("*").eq("card_id",t).order("created_at",{ascending:!1});if(a)throw a;const o=(e==null?void 0:e.filter(h=>h.interaction_type==="card_view").length)||0,l=(e==null?void 0:e.filter(h=>h.interaction_type==="button_click").length)||0,i=(e==null?void 0:e.filter(h=>h.interaction_type==="contact_saved").length)||0;return{views:o,clicks:l,saves:i,leads:s||[],interactions:e||[]}},enabled:!!t});function Yne({open:t,onOpenChange:e,cardId:n,type:s,agentName:a}){const[o,l]=I.useState(""),[i,h]=I.useState(""),[p,x]=I.useState(""),[y,b]=I.useState(""),[j,C]=I.useState(""),[N,A]=I.useState(!1),E=async T=>{if(T.preventDefault(),!o.trim()){ze.error("Please enter your name");return}A(!0);try{await Eit(n,{lead_type:s,name:o.trim(),email:i.trim()||void 0,phone:p.trim()||void 0,message:j.trim()||void 0,intent:y||void 0}),Ti(n,"lead_submitted",s),J.functions.invoke("card-lead-notify",{body:{cardId:n,leadType:s,name:o.trim(),email:i.trim()||void 0,phone:p.trim()||void 0,message:j.trim()||void 0,intent:y||void 0}}).catch(L=>console.error("Card lead notify failed:",L)),ze.success(s==="booking"?"Request sent! They'll be in touch soon.":s==="connect"?"Info shared! They'll be in touch soon.":"Referral submitted! Thank you."),e(!1),l(""),h(""),x(""),b(""),C("")}catch{ze.error("Something went wrong. Please try again.")}finally{A(!1)}};return r.jsx(Fr,{open:t,onOpenChange:e,children:r.jsxs(Rr,{className:"sm:max-w-md rounded-2xl",children:[r.jsxs(qr,{children:[r.jsx($r,{children:s==="booking"?"Book a Call":s==="connect"?"Connect with Me":"Refer a Friend"}),r.jsx(Xn,{children:s==="booking"?`Let ${a} know you'd like to connect.`:s==="connect"?`Share your info and ${a} will reach out.`:`Know someone who could use ${a}'s help?`})]}),r.jsxs("form",{onSubmit:E,className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx(He,{htmlFor:"lead-name",children:"Name *"}),r.jsx(dt,{id:"lead-name",value:o,onChange:T=>l(T.target.value),placeholder:"Your name",required:!0})]}),r.jsxs("div",{children:[r.jsx(He,{htmlFor:"lead-phone",children:"Phone"}),r.jsx(dt,{id:"lead-phone",type:"tel",value:p,onChange:T=>x(T.target.value),placeholder:"(555) 123-4567"})]}),r.jsxs("div",{children:[r.jsx(He,{htmlFor:"lead-email",children:"Email"}),r.jsx(dt,{id:"lead-email",type:"email",value:i,onChange:T=>h(T.target.value),placeholder:"you@example.com"})]}),s==="booking"&&r.jsxs("div",{children:[r.jsx(He,{htmlFor:"lead-intent",children:"I'm looking to..."}),r.jsxs(gn,{value:y,onValueChange:b,children:[r.jsx(fn,{children:r.jsx(xn,{placeholder:"Select one"})}),r.jsxs(pn,{children:[r.jsx(Vt,{value:"buy",children:"Buy a home"}),r.jsx(Vt,{value:"sell",children:"Sell my home"}),r.jsx(Vt,{value:"both",children:"Buy & Sell"}),r.jsx(Vt,{value:"other",children:"Something else"})]})]})]}),s!=="connect"&&r.jsxs("div",{children:[r.jsx(He,{htmlFor:"lead-message",children:s==="referral"?"Tell us about them":"Message (optional)"}),r.jsx(dt,{id:"lead-message",value:j,onChange:T=>C(T.target.value),placeholder:s==="referral"?"Their name, phone, situation...":"Anything you'd like us to know"})]}),r.jsx(ee,{type:"submit",className:"w-full rounded-2xl",disabled:N,children:N?"Sending...":"Submit"})]})]})})}const Iit=t=>Yt({queryKey:["card-blocks",t],queryFn:async()=>{if(!t)return[];const{data:e,error:n}=await J.from("card_blocks").select("*").eq("card_id",t).eq("is_visible",!0).order("sort_order",{ascending:!0});if(n)throw n;return e||[]},enabled:!!t}),Pit=t=>Yt({queryKey:["card-blocks-all",t],queryFn:async()=>{if(!t)return[];const{data:e,error:n}=await J.from("card_blocks").select("*").eq("card_id",t).order("sort_order",{ascending:!0});if(n)throw n;return e||[]},enabled:!!t}),Lit=()=>{const t=Vr();return cr({mutationFn:async e=>{const{data:n,error:s}=await J.from("card_blocks").insert(e).select().single();if(s)throw s;return n},onSuccess:(e,n)=>{t.invalidateQueries({queryKey:["card-blocks",n.card_id]}),t.invalidateQueries({queryKey:["card-blocks-all",n.card_id]}),ze.success("Block added")},onError:e=>ze.error(e.message)})},Oit=()=>{const t=Vr();return cr({mutationFn:async({id:e,...n})=>{const{data:s,error:a}=await J.from("card_blocks").update(n).eq("id",e).select().single();if(a)throw a;return s},onSuccess:()=>{t.invalidateQueries({queryKey:["card-blocks"]}),t.invalidateQueries({queryKey:["card-blocks-all"]}),ze.success("Block updated")},onError:e=>ze.error(e.message)})},Dit=()=>{const t=Vr();return cr({mutationFn:async e=>{const{error:n}=await J.from("card_blocks").delete().eq("id",e);if(n)throw n},onSuccess:()=>{t.invalidateQueries({queryKey:["card-blocks"]}),t.invalidateQueries({queryKey:["card-blocks-all"]}),ze.success("Block removed")},onError:e=>ze.error(e.message)})};function Rit(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 Fit(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 zit={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 Bit({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=Fit(n.video_url),o=s||!!a,l=s?Rit(n.video_url):a||n.video_url;return r.jsx("div",{className:zit[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 $it={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 Uit({block:t,variant:e}){const s=t.config.testimonials||[],[a,o]=I.useState(0);if(s.length===0)return null;const l=$it[e],i=s[a];return r.jsxs("div",{className:l.container,children:[r.jsxs("div",{className:l.card,children:[r.jsx(UT,{className:"h-4 w-4 mb-2 opacity-30"}),r.jsxs("p",{className:`${l.quote} mb-3`,children:['"',i.quote,'"']}),r.jsxs("div",{children:[r.jsx("p",{className:l.name,children:i.name}),i.role&&r.jsx("p",{className:l.role,children:i.role})]})]}),s.length>1&&r.jsxs("div",{className:"flex items-center justify-center gap-3 mt-3",children:[r.jsx("button",{onClick:()=>o(h=>(h-1+s.length)%s.length),className:l.nav,children:r.jsx(Tc,{className:"h-4 w-4"})}),r.jsx("div",{className:"flex gap-1.5",children:s.map((h,p)=>r.jsx("div",{className:`h-1.5 w-1.5 rounded-full transition-colors cursor-pointer ${p===a?l.dot:l.dotInactive}`,onClick:()=>o(p)},p))}),r.jsx("button",{onClick:()=>o(h=>(h+1)%s.length),className:l.nav,children:r.jsx(Vi,{className:"h-4 w-4"})})]})]})}const qit={standard:{container:"flex flex-wrap gap-2 mb-6 justify-center",tag:"px-3 py-1.5 text-xs font-medium rounded-full bg-primary/10 text-primary"},luxury:{container:"flex flex-wrap gap-2 mb-6 justify-center",tag:"px-3 py-1.5 text-xs font-medium rounded-full bg-[#c9a84c]/10 text-[#e8d48b] border border-[#c9a84c]/20"},bold:{container:"flex flex-wrap gap-2 mb-6 justify-center",tag:"px-3 py-1.5 text-xs font-black rounded-full bg-[#1a1a2e] text-white uppercase tracking-wide"},classic:{container:"flex flex-wrap gap-2 mb-6 justify-center",tag:"px-3 py-1.5 text-xs font-medium rounded-md bg-[#1b3a4b]/10 text-[#1b3a4b] border border-[#d4cfc5]"}};function Vit({block:t,variant:e}){const s=t.config.tags||[];if(s.length===0)return null;const a=qit[e];return r.jsx("div",{className:a.container,children:s.map((o,l)=>r.jsx("span",{className:a.tag,children:o},l))})}const Hit={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 Wit({block:t,cardId:e,variant:n}){const a=t.config.links||[];if(a.length===0)return null;const o=Hit[n];return r.jsx("div",{className:o.container,children:a.map((l,i)=>r.jsxs("a",{href:l.url,target:"_blank",rel:"noopener noreferrer",onClick:()=>Ti(e,"button_click",`custom_link_${l.label}`),className:o.link,children:[r.jsx("span",{children:l.label}),r.jsx(Fs,{className:`h-4 w-4 ${o.icon}`})]},i))})}const ihe={instagram:{label:"Instagram",icon:"M12 2.163c3.204 0 3.584.012 4.85.07 3.252.148 4.771 1.691 4.919 4.919.058 1.265.069 1.645.069 4.849 0 3.205-.012 3.584-.069 4.849-.149 3.225-1.664 4.771-4.919 4.919-1.266.058-1.644.07-4.85.07-3.204 0-3.584-.012-4.849-.07-3.26-.149-4.771-1.699-4.919-4.92-.058-1.265-.07-1.644-.07-4.849 0-3.204.013-3.583.07-4.849.149-3.227 1.664-4.771 4.919-4.919 1.266-.057 1.645-.069 4.849-.069zM12 0C8.741 0 8.333.014 7.053.072 2.695.272.273 2.69.073 7.052.014 8.333 0 8.741 0 12c0 3.259.014 3.668.072 4.948.2 4.358 2.618 6.78 6.98 6.98C8.333 23.986 8.741 24 12 24c3.259 0 3.668-.014 4.948-.072 4.354-.2 6.782-2.618 6.979-6.98.059-1.28.073-1.689.073-4.948 0-3.259-.014-3.667-.072-4.947-.196-4.354-2.617-6.78-6.979-6.98C15.668.014 15.259 0 12 0zm0 5.838a6.162 6.162 0 100 12.324 6.162 6.162 0 000-12.324zM12 16a4 4 0 110-8 4 4 0 010 8zm6.406-11.845a1.44 1.44 0 100 2.881 1.44 1.44 0 000-2.881z",color:"#E4405F",hoverBg:"hover:bg-[#E4405F]/10"},facebook:{label:"Facebook",icon:"M24 12.073c0-6.627-5.373-12-12-12s-12 5.373-12 12c0 5.99 4.388 10.954 10.125 11.854v-8.385H7.078v-3.47h3.047V9.43c0-3.007 1.792-4.669 4.533-4.669 1.312 0 2.686.235 2.686.235v2.953H15.83c-1.491 0-1.956.925-1.956 1.874v2.25h3.328l-.532 3.47h-2.796v8.385C19.612 23.027 24 18.062 24 12.073z",color:"#1877F2",hoverBg:"hover:bg-[#1877F2]/10"},linkedin:{label:"LinkedIn",icon:"M20.447 20.452h-3.554v-5.569c0-1.328-.027-3.037-1.852-3.037-1.853 0-2.136 1.445-2.136 2.939v5.667H9.351V9h3.414v1.561h.046c.477-.9 1.637-1.85 3.37-1.85 3.601 0 4.267 2.37 4.267 5.455v6.286zM5.337 7.433c-1.144 0-2.063-.926-2.063-2.065 0-1.138.92-2.063 2.063-2.063 1.14 0 2.064.925 2.064 2.063 0 1.139-.925 2.065-2.064 2.065zm1.782 13.019H3.555V9h3.564v11.452zM22.225 0H1.771C.792 0 0 .774 0 1.729v20.542C0 23.227.792 24 1.771 24h20.451C23.2 24 24 23.227 24 22.271V1.729C24 .774 23.2 0 22.222 0h.003z",color:"#0A66C2",hoverBg:"hover:bg-[#0A66C2]/10"},twitter:{label:"X",icon:"M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z",color:"#000000",hoverBg:"hover:bg-black/10"},youtube:{label:"YouTube",icon:"M23.498 6.186a3.016 3.016 0 00-2.122-2.136C19.505 3.545 12 3.545 12 3.545s-7.505 0-9.377.505A3.017 3.017 0 00.502 6.186C0 8.07 0 12 0 12s0 3.93.502 5.814a3.016 3.016 0 002.122 2.136c1.871.505 9.376.505 9.376.505s7.505 0 9.377-.505a3.015 3.015 0 002.122-2.136C24 15.93 24 12 24 12s0-3.93-.502-5.814z M9.545 15.568V8.432L15.818 12z",color:"#FF0000",hoverBg:"hover:bg-[#FF0000]/10"},tiktok:{label:"TikTok",icon:"M12.525.02c1.31-.02 2.61-.01 3.91-.02.08 1.53.63 3.09 1.75 4.17 1.12 1.11 2.7 1.62 4.24 1.79v4.03c-1.44-.05-2.89-.35-4.2-.97-.57-.26-1.1-.59-1.62-.93-.01 2.92.01 5.84-.02 8.75-.08 1.4-.54 2.79-1.35 3.94-1.31 1.92-3.58 3.17-5.91 3.21-1.43.08-2.86-.31-4.08-1.03-2.02-1.19-3.44-3.37-3.65-5.71-.02-.5-.03-1-.01-1.49.18-1.9 1.12-3.72 2.58-4.96 1.66-1.44 3.98-2.13 6.15-1.72.02 1.48-.04 2.96-.04 4.44-.99-.32-2.15-.23-3.02.37-.63.41-1.11 1.04-1.36 1.75-.21.51-.15 1.07-.14 1.61.24 1.64 1.82 3.02 3.5 2.87 1.12-.01 2.19-.66 2.77-1.61.19-.33.4-.67.41-1.06.1-1.79.06-3.57.07-5.36.01-4.03-.01-8.05.02-12.07z",color:"#000000",hoverBg:"hover:bg-black/10"},zillow:{label:"Zillow",icon:"M12 0L1 6v12l11 6 11-6V6L12 0zm0 2.18L21 7.5v9L12 21.82 3 16.5v-9L12 2.18z",color:"#006AFF",hoverBg:"hover:bg-[#006AFF]/10"},realtor:{label:"Realtor",icon:"M12 2L2 7v10l10 5 10-5V7L12 2zm0 2.18l8 4v8l-8 4-8-4v-8l8-4z",color:"#D92228",hoverBg:"hover:bg-[#D92228]/10"}};function Git({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 Kit={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 Zit({block:t,cardId:e,variant:n}){const a=t.config.platforms||[],o=Kit[n];return a.length===0?null:r.jsxs("div",{className:o.container,children:[r.jsx("h3",{className:o.title,children:"Follow Me"}),r.jsx("div",{className:"flex flex-wrap gap-3 justify-center",children:a.map((l,i)=>{const h=ihe[l.platform.toLowerCase()];return!h||!l.url?null:r.jsx("a",{href:l.url,target:"_blank",rel:"noopener noreferrer",onClick:()=>Ti(e,"button_click",`social_${l.platform}`),className:o.linkClass,title:h.label,children:r.jsx(Git,{path:h.icon,color:h.color})},i)})})]})}function Xne({cardId:t,variant:e}){const{data:n}=Iit(t);return!n||n.length===0?null:r.jsx(r.Fragment,{children:n.map(s=>{switch(s.block_type){case"video_intro":return r.jsx(Bit,{block:s,variant:e},s.id);case"testimonials":return r.jsx(Uit,{block:s,variant:e},s.id);case"specialties":return r.jsx(Vit,{block:s,variant:e},s.id);case"custom_links":return r.jsx(Wit,{block:s,cardId:t,variant:e},s.id);case"social_media":return r.jsx(Zit,{block:s,cardId:t,variant:e},s.id);default:return null}})})}async function Yit(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 Xit(t){const e=t.trim().split(/\s+/);if(e.length<=1)return{first:e[0]||"",last:""};const n=e.pop();return{first:e.join(" "),last:n}}async function Qne(t){const{first:e,last:n}=Xit(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 Yit(t.avatarUrl);if(i){const p={"image/jpeg":"JPEG","image/jpg":"JPEG","image/png":"PNG","image/gif":"GIF","image/webp":"JPEG"}[i.mimeType]||"JPEG";s.push(`PHOTO;ENCODING=b;TYPE=${p}:${i.base64}`)}}s.push("END:VCARD");const a=new Blob([s.join(`\r `)],{type:"text/vcard"}),o=URL.createObjectURL(a),l=document.createElement("a");l.href=o,l.download=`${t.name.replace(/\s+/g,"_")}.vcf`,l.click(),URL.revokeObjectURL(o),ze.success("Contact saved!")}function Qit({card:t}){var E;const[e,n]=I.useState(!1),[s,a]=I.useState("booking"),o=((E=t.profile)==null?void 0:E.name)||"Agent",l=o.split(" ").map(T=>T[0]).join("").toUpperCase().slice(0,2),i=(T,L)=>{Ti(t.id,"button_click",T),L()},h=()=>i("call",()=>{var T;(T=t.profile)!=null&&T.phone?window.location.href=`tel:${t.profile.phone}`:ze.error("Phone number not available")}),p=()=>i("text",()=>{var T;(T=t.profile)!=null&&T.phone?window.location.href=`sms:${t.profile.phone}`:ze.error("Phone number not available")}),x=()=>i("email",()=>{var T;(T=t.profile)!=null&&T.email?window.location.href=`mailto:${t.profile.email}`:ze.error("Email not available")}),y=()=>{t.booking_url?i("book",()=>window.open(t.booking_url,"_blank")):(a("booking"),n(!0),Ti(t.id,"button_click","book"))},b=()=>{var T,L;Ti(t.id,"contact_saved"),Qne({name:o,phone:(T=t.profile)==null?void 0:T.phone,email:(L=t.profile)==null?void 0:L.email,brokerage:t.brokerage_name,avatarUrl:t.avatar_url,cardUrl:window.location.href})},j=async()=>{if(Ti(t.id,"share_event"),navigator.share)try{await navigator.share({title:`${o} - Real Estate Agent`,text:t.positioning_statement||`Connect with ${o}`,url:window.location.href})}catch{}else await navigator.clipboard.writeText(window.location.href),ze.success("Link copied!")},C=()=>{a("referral"),n(!0),Ti(t.id,"button_click","refer")},N=()=>{a("connect"),n(!0),Ti(t.id,"button_click","connect")},A={instagram:"📸",facebook:"📘",linkedin:"💼",twitter:"🐦",youtube:"🎬",tiktok:"🎵"};return r.jsxs("div",{className:"min-h-screen bg-gradient-to-b from-slate-50 via-white to-slate-50",children:[r.jsxs("div",{className:"max-w-md mx-auto px-5 py-10",children:[r.jsxs("div",{className:"text-center mb-8",children:[t.show_photo&&r.jsxs(Ks,{className:"h-28 w-28 mx-auto mb-4 ring-4 ring-white shadow-lg",children:[r.jsx(Ei,{src:t.avatar_url||void 0,alt:o}),r.jsx(Zs,{className:"text-2xl font-semibold bg-primary text-primary-foreground",children:l})]}),r.jsx("h1",{className:"text-2xl font-bold text-slate-900 mb-0.5",children:o}),t.title&&r.jsx("p",{className:"text-sm font-medium text-primary mb-1",children:t.title}),t.brokerage_name&&!t.brokerage_logo_url&&r.jsx("p",{className:"text-sm font-medium text-slate-500 mb-1",children:t.brokerage_name}),t.team_name&&!t.team_logo_url&&r.jsx("p",{className:"text-xs font-medium text-slate-400 mb-3",children:t.team_name}),t.positioning_statement&&r.jsxs("p",{className:"text-base text-slate-600 italic leading-relaxed max-w-xs mx-auto",children:['"',t.positioning_statement,'"']})]}),r.jsxs("div",{className:"grid grid-cols-3 gap-3 mb-4",children:[r.jsxs(ee,{onClick:h,className:"flex flex-col items-center gap-1.5 h-auto py-4 bg-primary hover:bg-primary/90 text-primary-foreground rounded-2xl shadow-sm",children:[r.jsx(bi,{className:"h-5 w-5"}),r.jsx("span",{className:"text-xs font-medium",children:"Call"})]}),r.jsxs(ee,{onClick:p,className:"flex flex-col items-center gap-1.5 h-auto py-4 bg-primary hover:bg-primary/90 text-primary-foreground rounded-2xl shadow-sm",children:[r.jsx(Lo,{className:"h-5 w-5"}),r.jsx("span",{className:"text-xs font-medium",children:"Text"})]}),r.jsxs(ee,{onClick:x,className:"flex flex-col items-center gap-1.5 h-auto py-4 bg-primary hover:bg-primary/90 text-primary-foreground rounded-2xl shadow-sm",children:[r.jsx(da,{className:"h-5 w-5"}),r.jsx("span",{className:"text-xs font-medium",children:"Email"})]})]}),r.jsxs(ee,{onClick:y,className:"w-full h-12 text-base font-semibold rounded-2xl shadow-sm mb-6",variant:"outline",children:[r.jsx(zs,{className:"h-5 w-5 mr-2"}),t.custom_cta_label||"Book a Call"]}),t.show_credentials&&t.review_snippet&&r.jsx("div",{className:"flex items-center justify-center gap-4 mb-6 text-sm text-slate-600",children:r.jsxs("div",{className:"text-center flex items-center gap-1",children:[r.jsx(vs,{className:"h-4 w-4 text-amber-500 fill-amber-500"}),r.jsx("span",{className:"font-bold text-slate-900",children:"5.0"})]})}),t.review_snippet&&r.jsx("div",{className:"bg-slate-50 rounded-2xl p-4 mb-6 border border-slate-100",children:r.jsxs("p",{className:"text-sm text-slate-600 italic text-center",children:['"',t.review_snippet,'"']})}),t.show_bio&&t.bio&&r.jsxs("div",{className:"mb-6",children:[r.jsx("h2",{className:"text-sm font-semibold text-slate-800 mb-2",children:"About Me"}),r.jsx("p",{className:"text-sm text-slate-600 leading-relaxed",children:t.bio})]}),r.jsx(Zne,{card:t,variant:"standard"}),r.jsx(Xne,{cardId:t.id,variant:"standard"}),r.jsxs("div",{className:"space-y-2 mb-6",children:[t.show_save_contact&&r.jsxs(ee,{variant:"ghost",onClick:b,className:"w-full justify-start h-12 rounded-2xl text-slate-700 hover:bg-slate-100",children:[r.jsx(no,{className:"h-4 w-4 mr-3 text-primary"}),"Save Contact"]}),t.show_leave_review&&t.review_source_url&&r.jsxs(ee,{variant:"ghost",onClick:()=>{Ti(t.id,"button_click","review"),window.open(t.review_source_url,"_blank")},className:"w-full justify-start h-12 rounded-2xl text-slate-700 hover:bg-slate-100",children:[r.jsx(vs,{className:"h-4 w-4 mr-3 text-amber-500"}),"Leave a Review"]}),t.show_refer_friend&&r.jsxs(ee,{variant:"ghost",onClick:C,className:"w-full justify-start h-12 rounded-2xl text-slate-700 hover:bg-slate-100",children:[r.jsx(Bn,{className:"h-4 w-4 mr-3 text-primary"}),"Refer a Friend"]}),r.jsxs(ee,{variant:"ghost",onClick:N,className:"w-full justify-start h-12 rounded-2xl text-slate-700 hover:bg-slate-100",children:[r.jsx(nf,{className:"h-4 w-4 mr-3 text-primary"}),"Connect with Me"]}),r.jsxs(ee,{variant:"ghost",onClick:j,className:"w-full justify-start h-12 rounded-2xl text-slate-700 hover:bg-slate-100",children:[r.jsx(fc,{className:"h-4 w-4 mr-3 text-primary"}),"Share My Card"]})]}),t.show_social_links&&t.social_links&&t.social_links.length>0&&r.jsx("div",{className:"flex justify-center gap-4 mb-8",children:t.social_links.slice(0,3).map((T,L)=>r.jsx("a",{href:T.url,target:"_blank",rel:"noopener noreferrer",onClick:()=>Ti(t.id,"button_click",`social_${T.platform}`),className:"h-10 w-10 rounded-full bg-slate-100 hover:bg-slate-200 flex items-center justify-center text-lg transition-colors",children:A[T.platform.toLowerCase()]||"🔗"},L))}),r.jsx("div",{className:"text-center",children:r.jsx("p",{className:"text-xs text-slate-400",children:"Powered by LevelUp"})})]}),r.jsx(Yne,{open:e,onOpenChange:n,cardId:t.id,type:s,agentName:o})]})}function Jit({card:t}){var E;const[e,n]=I.useState(!1),[s,a]=I.useState("booking"),o=((E=t.profile)==null?void 0:E.name)||"Agent",l=o.split(" ").map(T=>T[0]).join("").toUpperCase().slice(0,2),i=(T,L)=>{Ti(t.id,"button_click",T),L()},h=()=>i("call",()=>{var T;(T=t.profile)!=null&&T.phone?window.location.href=`tel:${t.profile.phone}`:ze.error("Phone number not available")}),p=()=>i("text",()=>{var T;(T=t.profile)!=null&&T.phone?window.location.href=`sms:${t.profile.phone}`:ze.error("Phone number not available")}),x=()=>i("email",()=>{var T;(T=t.profile)!=null&&T.email?window.location.href=`mailto:${t.profile.email}`:ze.error("Email not available")}),y=()=>{t.booking_url?i("book",()=>window.open(t.booking_url,"_blank")):(a("booking"),n(!0),Ti(t.id,"button_click","book"))},b=()=>{var T,L;Ti(t.id,"contact_saved"),Qne({name:o,phone:(T=t.profile)==null?void 0:T.phone,email:(L=t.profile)==null?void 0:L.email,brokerage:t.brokerage_name,avatarUrl:t.avatar_url,cardUrl:window.location.href})},j=async()=>{if(Ti(t.id,"share_event"),navigator.share)try{await navigator.share({title:`${o} - Real Estate Agent`,text:t.positioning_statement||`Connect with ${o}`,url:window.location.href})}catch{}else await navigator.clipboard.writeText(window.location.href),ze.success("Link copied!")},C=()=>{a("referral"),n(!0),Ti(t.id,"button_click","refer")},N=()=>{a("connect"),n(!0),Ti(t.id,"button_click","connect")},A={instagram:"📸",facebook:"📘",linkedin:"💼",twitter:"🐦",youtube:"🎬",tiktok:"🎵"};return r.jsxs("div",{className:"min-h-screen bg-gradient-to-b from-[#0f1419] via-[#1a1f2e] to-[#0f1419]",children:[r.jsxs("div",{className:"max-w-md mx-auto px-5 py-10",children:[r.jsx("div",{className:"w-16 h-0.5 bg-gradient-to-r from-[#c9a84c] to-[#e8d48b] mx-auto mb-8"}),r.jsxs("div",{className:"text-center mb-8",children:[t.show_photo&&r.jsxs(Ks,{className:"h-32 w-32 mx-auto mb-5 ring-2 ring-[#c9a84c]/40 shadow-2xl",children:[r.jsx(Ei,{src:t.avatar_url||void 0,alt:o}),r.jsx(Zs,{className:"text-2xl font-serif bg-[#c9a84c]/20 text-[#e8d48b]",children:l})]}),r.jsx("h1",{className:"text-2xl font-serif font-bold text-white tracking-wide mb-0.5",children:o}),t.title&&r.jsx("p",{className:"text-sm font-medium text-[#e8d48b] mb-1",children:t.title}),t.brokerage_name&&!t.brokerage_logo_url&&r.jsx("p",{className:"text-sm font-medium text-[#c9a84c] tracking-widest uppercase mb-1",children:t.brokerage_name}),t.team_name&&!t.team_logo_url&&r.jsx("p",{className:"text-xs font-medium text-[#a0aec0] mb-3",children:t.team_name}),t.positioning_statement&&r.jsxs("p",{className:"text-base text-[#a0aec0] italic leading-relaxed max-w-xs mx-auto font-serif",children:['"',t.positioning_statement,'"']})]}),r.jsx("div",{className:"grid grid-cols-3 gap-3 mb-4",children:[{icon:bi,label:"Call",handler:h},{icon:Lo,label:"Text",handler:p},{icon:da,label:"Email",handler:x}].map(({icon:T,label:L,handler:z})=>r.jsxs("button",{onClick:z,className:"flex flex-col items-center gap-1.5 py-4 bg-[#1e2636] hover:bg-[#252d3f] border border-[#c9a84c]/20 rounded-xl transition-colors",children:[r.jsx(T,{className:"h-5 w-5 text-[#c9a84c]"}),r.jsx("span",{className:"text-xs font-medium text-[#e2e8f0]",children:L})]},L))}),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(zs,{className:"h-5 w-5"}),t.custom_cta_label||"Book a Call"]}),t.show_credentials&&t.review_snippet&&r.jsx("div",{className:"flex items-center justify-center gap-4 mb-6 text-sm",children:r.jsxs("div",{className:"text-center flex items-center gap-1",children:[r.jsx(vs,{className:"h-4 w-4 text-[#c9a84c] fill-[#c9a84c]"}),r.jsx("span",{className:"font-bold text-white",children:"5.0"})]})}),t.review_snippet&&r.jsx("div",{className:"bg-[#1e2636] rounded-xl p-4 mb-6 border border-[#c9a84c]/10",children:r.jsxs("p",{className:"text-sm text-[#a0aec0] italic text-center font-serif",children:['"',t.review_snippet,'"']})}),t.show_bio&&t.bio&&r.jsxs("div",{className:"mb-6",children:[r.jsx("h2",{className:"text-sm font-semibold text-[#c9a84c] mb-2 tracking-wide uppercase",children:"About"}),r.jsx("p",{className:"text-sm text-[#a0aec0] leading-relaxed",children:t.bio})]}),r.jsx(Zne,{card:t,variant:"luxury"}),r.jsx(Xne,{cardId:t.id,variant:"luxury"}),r.jsxs("div",{className:"space-y-1 mb-6",children:[t.show_save_contact&&r.jsxs("button",{onClick:b,className:"w-full flex items-center gap-3 h-12 px-4 rounded-xl text-[#e2e8f0] hover:bg-[#1e2636] transition-colors text-sm",children:[r.jsx(no,{className:"h-4 w-4 text-[#c9a84c]"})," Save Contact"]}),t.show_leave_review&&t.review_source_url&&r.jsxs("button",{onClick:()=>{Ti(t.id,"button_click","review"),window.open(t.review_source_url,"_blank")},className:"w-full flex items-center gap-3 h-12 px-4 rounded-xl text-[#e2e8f0] hover:bg-[#1e2636] transition-colors text-sm",children:[r.jsx(vs,{className:"h-4 w-4 text-[#c9a84c]"})," Leave a Review"]}),t.show_refer_friend&&r.jsxs("button",{onClick:C,className:"w-full flex items-center gap-3 h-12 px-4 rounded-xl text-[#e2e8f0] hover:bg-[#1e2636] transition-colors text-sm",children:[r.jsx(Bn,{className:"h-4 w-4 text-[#c9a84c]"})," Refer a Friend"]}),r.jsxs("button",{onClick:N,className:"w-full flex items-center gap-3 h-12 px-4 rounded-xl text-[#e2e8f0] hover:bg-[#1e2636] transition-colors text-sm",children:[r.jsx(nf,{className:"h-4 w-4 text-[#c9a84c]"})," Connect with Me"]}),r.jsxs("button",{onClick:j,className:"w-full flex items-center gap-3 h-12 px-4 rounded-xl text-[#e2e8f0] hover:bg-[#1e2636] transition-colors text-sm",children:[r.jsx(fc,{className:"h-4 w-4 text-[#c9a84c]"})," Share My Card"]})]}),t.show_social_links&&t.social_links&&t.social_links.length>0&&r.jsx("div",{className:"flex justify-center gap-4 mb-8",children:t.social_links.slice(0,3).map((T,L)=>r.jsx("a",{href:T.url,target:"_blank",rel:"noopener noreferrer",onClick:()=>Ti(t.id,"button_click",`social_${T.platform}`),className:"h-10 w-10 rounded-full bg-[#1e2636] border border-[#c9a84c]/20 hover:border-[#c9a84c]/50 flex items-center justify-center text-lg transition-colors",children:A[T.platform.toLowerCase()]||"🔗"},L))}),r.jsx("div",{className:"text-center",children:r.jsx("p",{className:"text-xs text-[#4a5568]",children:"Powered by LevelUp"})})]}),r.jsx(Yne,{open:e,onOpenChange:n,cardId:t.id,type:s,agentName:o})]})}function eot({card:t}){var E;const[e,n]=I.useState(!1),[s,a]=I.useState("booking"),o=((E=t.profile)==null?void 0:E.name)||"Agent",l=o.split(" ").map(T=>T[0]).join("").toUpperCase().slice(0,2),i=(T,L)=>{Ti(t.id,"button_click",T),L()},h=()=>i("call",()=>{var T;(T=t.profile)!=null&&T.phone?window.location.href=`tel:${t.profile.phone}`:ze.error("Phone number not available")}),p=()=>i("text",()=>{var T;(T=t.profile)!=null&&T.phone?window.location.href=`sms:${t.profile.phone}`:ze.error("Phone number not available")}),x=()=>i("email",()=>{var T;(T=t.profile)!=null&&T.email?window.location.href=`mailto:${t.profile.email}`:ze.error("Email not available")}),y=()=>{t.booking_url?i("book",()=>window.open(t.booking_url,"_blank")):(a("booking"),n(!0),Ti(t.id,"button_click","book"))},b=()=>{var T,L;Ti(t.id,"contact_saved"),Qne({name:o,phone:(T=t.profile)==null?void 0:T.phone,email:(L=t.profile)==null?void 0:L.email,brokerage:t.brokerage_name,avatarUrl:t.avatar_url,cardUrl:window.location.href})},j=async()=>{if(Ti(t.id,"share_event"),navigator.share)try{await navigator.share({title:`${o}`,url:window.location.href})}catch{}else await navigator.clipboard.writeText(window.location.href),ze.success("Link copied!")},C=()=>{a("referral"),n(!0),Ti(t.id,"button_click","refer")},N=()=>{a("connect"),n(!0),Ti(t.id,"button_click","connect")},A={instagram:"📸",facebook:"📘",linkedin:"💼",twitter:"🐦",youtube:"🎬",tiktok:"🎵"};return r.jsxs("div",{className:"min-h-screen bg-[#ff5722]",children:[r.jsxs("div",{className:"bg-[#1a1a2e] px-5 pt-10 pb-14 text-center relative",children:[t.show_photo&&r.jsxs(Ks,{className:"h-28 w-28 mx-auto mb-4 ring-4 ring-[#ff5722] shadow-2xl",children:[r.jsx(Ei,{src:t.avatar_url||void 0,alt:o}),r.jsx(Zs,{className:"text-2xl font-black bg-[#ff5722] text-white",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 text-[#ff5722]/80 mb-1",children:t.title}),t.brokerage_name&&!t.brokerage_logo_url&&r.jsx("p",{className:"text-sm font-bold text-[#ff5722] uppercase tracking-wider mb-1",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 text-[#1a1a2e] font-bold text-lg leading-snug mb-6 max-w-xs mx-auto",children:t.positioning_statement}),r.jsx("div",{className:"grid grid-cols-3 gap-3 mb-4",children:[{icon:bi,label:"Call",handler:h},{icon:Lo,label:"Text",handler:p},{icon:da,label:"Email",handler:x}].map(({icon:T,label:L,handler:z})=>r.jsxs("button",{onClick:z,className:"flex flex-col items-center gap-1.5 py-4 bg-[#1a1a2e] hover:bg-[#2a2a4e] text-white rounded-2xl transition-colors font-bold",children:[r.jsx(T,{className:"h-5 w-5"}),r.jsx("span",{className:"text-xs",children:L})]},L))}),r.jsxs("button",{onClick:y,className:"w-full h-14 text-base font-black rounded-2xl mb-6 bg-[#ff5722] hover:bg-[#e64a19] text-white transition-colors flex items-center justify-center gap-2 uppercase tracking-wide",children:[r.jsx(zs,{className:"h-5 w-5"}),t.custom_cta_label||"Book a Call"]}),t.show_credentials&&t.review_snippet&&r.jsx("div",{className:"flex items-center justify-center gap-5 mb-6",children:t.review_snippet&&r.jsxs("div",{className:"text-center flex items-center gap-1",children:[r.jsx(vs,{className:"h-5 w-5 text-[#ff5722] fill-[#ff5722]"}),r.jsx("span",{className:"font-black text-[#1a1a2e] text-2xl",children:"5.0"})]})}),t.review_snippet&&r.jsx("div",{className:"bg-[#fff3e0] rounded-2xl p-4 mb-6",children:r.jsxs("p",{className:"text-sm text-[#1a1a2e] font-medium text-center",children:['"',t.review_snippet,'"']})}),t.show_bio&&t.bio&&r.jsxs("div",{className:"mb-6",children:[r.jsx("h2",{className:"text-xs font-black text-[#ff5722] mb-2 uppercase tracking-wider",children:"About Me"}),r.jsx("p",{className:"text-sm text-gray-600 leading-relaxed",children:t.bio})]}),r.jsx(Zne,{card:t,variant:"bold"}),r.jsx(Xne,{cardId:t.id,variant:"bold"}),r.jsxs("div",{className:"space-y-1 mb-6",children:[t.show_save_contact&&r.jsxs("button",{onClick:b,className:"w-full flex items-center gap-3 h-12 px-4 rounded-2xl text-[#1a1a2e] hover:bg-gray-100 transition-colors text-sm font-bold",children:[r.jsx(no,{className:"h-4 w-4 text-[#ff5722]"})," Save Contact"]}),t.show_leave_review&&t.review_source_url&&r.jsxs("button",{onClick:()=>{Ti(t.id,"button_click","review"),window.open(t.review_source_url,"_blank")},className:"w-full flex items-center gap-3 h-12 px-4 rounded-2xl text-[#1a1a2e] hover:bg-gray-100 transition-colors text-sm font-bold",children:[r.jsx(vs,{className:"h-4 w-4 text-[#ff5722]"})," Leave a Review"]}),t.show_refer_friend&&r.jsxs("button",{onClick:C,className:"w-full flex items-center gap-3 h-12 px-4 rounded-2xl text-[#1a1a2e] hover:bg-gray-100 transition-colors text-sm font-bold",children:[r.jsx(Bn,{className:"h-4 w-4 text-[#ff5722]"})," Refer a Friend"]}),r.jsxs("button",{onClick:N,className:"w-full flex items-center gap-3 h-12 px-4 rounded-2xl text-[#1a1a2e] hover:bg-gray-100 transition-colors text-sm font-bold",children:[r.jsx(nf,{className:"h-4 w-4 text-[#ff5722]"})," Connect with Me"]}),r.jsxs("button",{onClick:j,className:"w-full flex items-center gap-3 h-12 px-4 rounded-2xl text-[#1a1a2e] hover:bg-gray-100 transition-colors text-sm font-bold",children:[r.jsx(fc,{className:"h-4 w-4 text-[#ff5722]"})," 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((T,L)=>r.jsx("a",{href:T.url,target:"_blank",rel:"noopener noreferrer",onClick:()=>Ti(t.id,"button_click",`social_${T.platform}`),className:"h-10 w-10 rounded-full bg-[#1a1a2e] hover:bg-[#2a2a4e] flex items-center justify-center text-lg transition-colors",children:A[T.platform.toLowerCase()]||"🔗"},L))})]}),r.jsx("div",{className:"text-center py-6",children:r.jsx("p",{className:"text-xs text-white/50",children:"Powered by LevelUp"})})]}),r.jsx(Yne,{open:e,onOpenChange:n,cardId:t.id,type:s,agentName:o})]})}function tot({card:t}){var E;const[e,n]=I.useState(!1),[s,a]=I.useState("booking"),o=((E=t.profile)==null?void 0:E.name)||"Agent",l=o.split(" ").map(T=>T[0]).join("").toUpperCase().slice(0,2),i=(T,L)=>{Ti(t.id,"button_click",T),L()},h=()=>i("call",()=>{var T;(T=t.profile)!=null&&T.phone?window.location.href=`tel:${t.profile.phone}`:ze.error("Phone number not available")}),p=()=>i("text",()=>{var T;(T=t.profile)!=null&&T.phone?window.location.href=`sms:${t.profile.phone}`:ze.error("Phone number not available")}),x=()=>i("email",()=>{var T;(T=t.profile)!=null&&T.email?window.location.href=`mailto:${t.profile.email}`:ze.error("Email not available")}),y=()=>{t.booking_url?i("book",()=>window.open(t.booking_url,"_blank")):(a("booking"),n(!0),Ti(t.id,"button_click","book"))},b=()=>{var T,L;Ti(t.id,"contact_saved"),Qne({name:o,phone:(T=t.profile)==null?void 0:T.phone,email:(L=t.profile)==null?void 0:L.email,brokerage:t.brokerage_name,avatarUrl:t.avatar_url,cardUrl:window.location.href})},j=async()=>{if(Ti(t.id,"share_event"),navigator.share)try{await navigator.share({title:`${o}`,url:window.location.href})}catch{}else await navigator.clipboard.writeText(window.location.href),ze.success("Link copied!")},C=()=>{a("referral"),n(!0),Ti(t.id,"button_click","refer")},N=()=>{a("connect"),n(!0),Ti(t.id,"button_click","connect")},A={instagram:"📸",facebook:"📘",linkedin:"💼",twitter:"🐦",youtube:"🎬",tiktok:"🎵"};return r.jsxs("div",{className:"min-h-screen bg-[#f5f1eb]",children:[r.jsx("div",{className:"bg-[#1b3a4b] h-2"}),r.jsxs("div",{className:"max-w-md mx-auto px-5 py-10",children:[r.jsxs("div",{className:"text-center mb-8",children:[t.show_photo&&r.jsxs(Ks,{className:"h-28 w-28 mx-auto mb-4 ring-4 ring-white shadow-lg",children:[r.jsx(Ei,{src:t.avatar_url||void 0,alt:o}),r.jsx(Zs,{className:"text-2xl font-serif bg-[#1b3a4b] text-white",children:l})]}),r.jsx("h1",{className:"text-2xl font-serif font-bold text-[#1b3a4b] mb-0.5",children:o}),t.title&&r.jsx("p",{className:"text-sm font-medium text-[#5a7a6f] mb-1",children:t.title}),t.brokerage_name&&!t.brokerage_logo_url&&r.jsx("p",{className:"text-sm font-medium text-[#5a7a6f] mb-1",children:t.brokerage_name}),t.team_name&&!t.team_logo_url&&r.jsx("p",{className:"text-xs font-medium text-[#a0aec0] mb-3",children:t.team_name}),t.positioning_statement&&r.jsxs("p",{className:"text-base text-[#4a5568] italic leading-relaxed max-w-xs mx-auto font-serif",children:['"',t.positioning_statement,'"']})]}),r.jsx("div",{className:"grid grid-cols-3 gap-3 mb-4",children:[{icon:bi,label:"Call",handler:h},{icon:Lo,label:"Text",handler:p},{icon:da,label:"Email",handler:x}].map(({icon:T,label:L,handler:z})=>r.jsxs("button",{onClick:z,className:"flex flex-col items-center gap-1.5 py-4 bg-white hover:bg-[#e8e3db] border border-[#d4cfc5] rounded-lg transition-colors shadow-sm",children:[r.jsx(T,{className:"h-5 w-5 text-[#1b3a4b]"}),r.jsx("span",{className:"text-xs font-semibold text-[#1b3a4b]",children:L})]},L))}),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(zs,{className:"h-5 w-5"}),t.custom_cta_label||"Book a Call"]}),t.show_credentials&&t.review_snippet&&r.jsx("div",{className:"bg-white rounded-lg border border-[#d4cfc5] p-4 mb-6 shadow-sm",children:r.jsx("div",{className:"flex items-center justify-center gap-6",children:r.jsxs("div",{className:"text-center flex items-center gap-1",children:[r.jsx(vs,{className:"h-4 w-4 text-[#d4a843] fill-[#d4a843]"}),r.jsx("span",{className:"font-bold text-[#1b3a4b] font-serif",children:"5.0"})]})})}),t.review_snippet&&r.jsx("div",{className:"bg-white rounded-lg border border-[#d4cfc5] p-4 mb-6 shadow-sm",children:r.jsxs("p",{className:"text-sm text-[#4a5568] italic text-center font-serif",children:['"',t.review_snippet,'"']})}),t.show_bio&&t.bio&&r.jsxs("div",{className:"mb-6",children:[r.jsx("h2",{className:"text-sm font-semibold text-[#1b3a4b] mb-2 font-serif",children:"About"}),r.jsx("p",{className:"text-sm text-[#4a5568] leading-relaxed",children:t.bio})]}),r.jsx(Zne,{card:t,variant:"classic"}),r.jsx(Xne,{cardId:t.id,variant:"classic"}),r.jsxs("div",{className:"bg-white rounded-lg border border-[#d4cfc5] shadow-sm divide-y divide-[#e8e3db] mb-6",children:[t.show_save_contact&&r.jsxs("button",{onClick:b,className:"w-full flex items-center gap-3 h-12 px-4 text-[#1b3a4b] hover:bg-[#f5f1eb] transition-colors text-sm font-medium",children:[r.jsx(no,{className:"h-4 w-4 text-[#5a7a6f]"})," Save Contact"]}),t.show_leave_review&&t.review_source_url&&r.jsxs("button",{onClick:()=>{Ti(t.id,"button_click","review"),window.open(t.review_source_url,"_blank")},className:"w-full flex items-center gap-3 h-12 px-4 text-[#1b3a4b] hover:bg-[#f5f1eb] transition-colors text-sm font-medium",children:[r.jsx(vs,{className:"h-4 w-4 text-[#d4a843]"})," Leave a Review"]}),t.show_refer_friend&&r.jsxs("button",{onClick:C,className:"w-full flex items-center gap-3 h-12 px-4 text-[#1b3a4b] hover:bg-[#f5f1eb] transition-colors text-sm font-medium",children:[r.jsx(Bn,{className:"h-4 w-4 text-[#5a7a6f]"})," Refer a Friend"]}),r.jsxs("button",{onClick:N,className:"w-full flex items-center gap-3 h-12 px-4 text-[#1b3a4b] hover:bg-[#f5f1eb] transition-colors text-sm font-medium",children:[r.jsx(nf,{className:"h-4 w-4 text-[#5a7a6f]"})," Connect with Me"]}),r.jsxs("button",{onClick:j,className:"w-full flex items-center gap-3 h-12 px-4 text-[#1b3a4b] hover:bg-[#f5f1eb] transition-colors text-sm font-medium",children:[r.jsx(fc,{className:"h-4 w-4 text-[#5a7a6f]"})," Share My Card"]})]}),t.show_social_links&&t.social_links&&t.social_links.length>0&&r.jsx("div",{className:"flex justify-center gap-4 mb-8",children:t.social_links.slice(0,3).map((T,L)=>r.jsx("a",{href:T.url,target:"_blank",rel:"noopener noreferrer",onClick:()=>Ti(t.id,"button_click",`social_${T.platform}`),className:"h-10 w-10 rounded-full bg-white border border-[#d4cfc5] hover:bg-[#e8e3db] flex items-center justify-center text-lg transition-colors shadow-sm",children:A[T.platform.toLowerCase()]||"🔗"},L))}),r.jsx("div",{className:"text-center",children:r.jsx("p",{className:"text-xs text-[#a0aec0]",children:"Powered by LevelUp"})})]}),r.jsx(Yne,{open:e,onOpenChange:n,cardId:t.id,type:s,agentName:o})]})}function Oge({card:t}){switch(t.theme){case"luxury":return r.jsx(Jit,{card:t});case"bold":return r.jsx(eot,{card:t});case"classic":return r.jsx(tot,{card:t});case"standard":default:return r.jsx(Qit,{card:t})}}function rot(){const t=jm();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(not,{slug:e})}function not({slug:t}){return r.jsx(sot,{slug:t})}function sot({slug:t}){var o;const{data:e,isLoading:n,error:s}=uLe(t);if(I.useEffect(()=>{e!=null&&e.id&&Ti(e.id,"card_view")},[e==null?void 0:e.id]),n)return r.jsx("div",{className:"min-h-screen bg-gradient-to-b from-slate-50 to-white flex items-center justify-center",children:r.jsxs("div",{className:"w-full max-w-md mx-auto p-6 space-y-6",children:[r.jsxs("div",{className:"flex flex-col items-center gap-4",children:[r.jsx(Ir,{className:"h-28 w-28 rounded-full"}),r.jsx(Ir,{className:"h-6 w-48"}),r.jsx(Ir,{className:"h-4 w-36"})]}),r.jsx(Ir,{className:"h-12 w-full"}),r.jsx(Ir,{className:"h-12 w-full"})]})});if(s||!e)return r.jsx("div",{className:"min-h-screen bg-gradient-to-b from-slate-50 to-white flex items-center justify-center p-6",children:r.jsxs("div",{className:"text-center",children:[r.jsx("h1",{className:"text-2xl font-bold text-slate-800 mb-2",children:"Card Not Found"}),r.jsx("p",{className:"text-slate-500",children:"This agent card doesn't exist or isn't published yet."})]})});const a=((o=e.profile)==null?void 0:o.name)||"Agent";return r.jsxs(r.Fragment,{children:[r.jsxs(km,{children:[r.jsxs("title",{children:[a," | Real Estate Agent"]}),r.jsx("meta",{name:"description",content:e.positioning_statement||`Connect with ${a}, your trusted real estate professional.`}),r.jsx("meta",{property:"og:title",content:`${a} | Real Estate Agent`}),r.jsx("meta",{property:"og:description",content:e.positioning_statement||`Connect with ${a}`}),e.avatar_url&&r.jsx("meta",{property:"og:image",content:e.avatar_url})]}),r.jsx(Oge,{card:e})]})}const ohe="levelup_affiliate_ref",aot=30,iot=()=>{const[t]=$d();I.useEffect(()=>{const e=t.get("ref");if(e){const n={code:e.toUpperCase(),timestamp:Date.now()};localStorage.setItem(ohe,JSON.stringify(n)),console.log("[Affiliate] Stored referral code:",e)}},[t])},oot=()=>{try{const t=localStorage.getItem(ohe);if(!t)return null;const e=JSON.parse(t),n=aot*24*60*60*1e3;return Date.now()-e.timestamp>n?(localStorage.removeItem(ohe),console.log("[Affiliate] Referral code expired"),null):e.code}catch{return null}},tte="/assets/levelup-logo-header-_ZX7DvlA.png",lot="/assets/scale-your-team-ku4MPatU.png";function cot({open:t,onOpenChange:e}){return r.jsx(Fr,{open:t,onOpenChange:e,children:r.jsxs(Rr,{className:"max-w-3xl max-h-[90vh] overflow-hidden",children:[r.jsx(qr,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"p-2 bg-[#4a6b6d]/10 rounded-lg",children:r.jsx(ai,{className:"h-5 w-5 text-[#4a6b6d]"})}),r.jsxs("div",{children:[r.jsx($r,{children:"Schedule a Brokerage Interest Meeting"}),r.jsx(Xn,{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 ad={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"]}},dot=[{icon:Bf,title:"Academy Training",description:"Access a library of on-demand video training covering lead generation, marketing, technology, and more."},{icon:Fd,title:"300+ Templates",description:"Professional Canva templates for social media, flyers, postcards, and marketing materials."},{icon:zs,title:"Live Events",description:"Weekly live training sessions, workshops, and Q&A events with industry experts."},{icon:Fl,title:"Agent Community",description:"Connect with fellow agents, share wins, ask questions, and network in our private community."},{icon:La,title:"Resource Kits",description:"Downloadable toolkits with scripts, checklists, guides, and everything you need to close more deals."},{icon:Ki,title:"Social Swag",description:"Fresh social media content and designs updated regularly to help you stand out online."}],uot=[{icon:Bn,title:"Contact Management",description:"Organize your sphere into relationship tiers—Top 25, Past Clients, Referral Partners, and more."},{icon:Ms,title:"Smart Touchpoint Plans",description:"Automated action plans that tell you exactly who to contact and how, based on relationship type."},{icon:bi,title:"One-Tap Actions",description:"Call, text, or email contacts directly with pre-written scripts tailored to each relationship."},{icon:Qh,title:"Birthday & Anniversary Alerts",description:"Never miss an important date—get reminders for birthdays and home anniversaries."},{icon:fl,title:"Pop-by Map",description:"See all your contacts on a map and plan efficient pop-by routes in your area."},{icon:cc,title:"Momentum Tracking",description:"Track your touch streaks, weekly goals, and relationship health scores."},{icon:ci,title:"Relationship Health",description:"Visual dashboard showing which contacts need attention based on last touch date."},{icon:kg,title:"Daily Action Cards",description:"Wake up to a prioritized list of exactly who to reach out to today."}],hot=[{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."}],fot=()=>{const{user:t,loading:e}=Qr(),n=rs(),[s]=$d();I.useEffect(()=>{const H=window.location.host==="listings.relevelup.com",Z=window.location.pathname==="/";if(H&&Z){n("/public/listings",{replace:!0});return}},[n]);const[a,o]=I.useState(null),[l,i]=I.useState(null),[h,p]=I.useState(!1),[x,y]=I.useState(""),[b,j]=I.useState(""),[C,N]=I.useState(""),[A,E]=I.useState(!1),[T,L]=I.useState(!1),z=(H,Z=!1)=>{i({tier:H,skipTrial:Z}),p(!0)};iot(),I.useEffect(()=>{const H=window.location.host==="listings.relevelup.com",Z=location.pathname.startsWith("/public/");!e&&t&&!H&&!Z&&n("/dashboard")},[t,e,n,location.pathname]),I.useEffect(()=>{s.get("canceled")==="true"&&ze.error("Checkout was canceled. Feel free to try again when you're ready!")},[s]);const F=async(H,Z=!1)=>{if(!x){ze.error("Please enter your email address");return}if(!b.trim()){ze.error("Please enter your full name");return}E(!0),o(H+(Z?"_direct":""));const G=oot();try{const{data:te,error:ie}=await J.functions.invoke("create-checkout",{body:{tier:H,email:x,name:b.trim(),couponCode:C.trim()||void 0,skipTrial:Z,referralCode:G}});if(ie)throw ie;if(te!=null&&te.url)window.open(te.url,"_blank","noopener,noreferrer"),ze.success("Checkout opened in a new tab");else throw new Error("No checkout URL returned")}catch(te){console.error("Checkout error:",te),ze.error(te.message||"Failed to start checkout. Please try again.")}finally{E(!1),o(null),p(!1),i(null)}},q=()=>{l&&F(l.tier,l.skipTrial)};return e?r.jsx("div",{className:"flex min-h-screen items-center justify-center bg-[#4a6b6d]",children:r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-white border-t-transparent"})}):r.jsxs("div",{className:"min-h-screen bg-background overflow-hidden",children:[r.jsx("nav",{className:"fixed top-0 left-0 right-0 z-50 bg-[#4a6b6d] shadow-md",children:r.jsxs("div",{className:"container mx-auto px-4 py-3 flex items-center justify-between",children:[r.jsx("div",{className:"flex items-center",children:r.jsx("img",{src:tte,alt:"LevelUp",className:"h-8 md:h-10"})}),r.jsxs("div",{className:"flex items-center gap-2 md:gap-4",children:[r.jsx(ee,{variant:"ghost",className:"text-white/90 hover:text-white hover:bg-white/10 hidden sm:inline-flex",onClick:()=>{var H;return(H=document.getElementById("features"))==null?void 0:H.scrollIntoView({behavior:"smooth"})},children:"Features"}),r.jsx(ee,{variant:"ghost",className:"text-white/90 hover:text-white hover:bg-white/10 hidden sm:inline-flex",onClick:()=>{var H;return(H=document.getElementById("pricing"))==null?void 0:H.scrollIntoView({behavior:"smooth"})},children:"Pricing"}),r.jsx(ee,{onClick:()=>n("/auth"),className:"bg-white text-[#4a6b6d] hover:bg-gray-100 font-medium shadow-md",children:"Sign In"})]})]})}),r.jsxs("section",{className:"relative pt-24 pb-20 bg-gradient-to-br from-[#1e3a4c] via-[#2a4f5f] to-[#3d6b6b] overflow-hidden",children:[r.jsx("div",{className:"absolute inset-0 opacity-10",children:r.jsx("div",{className:"absolute inset-0 bg-[url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNjAiIGhlaWdodD0iNjAiIHZpZXdCb3g9IjAgMCA2MCA2MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxnIGZpbGw9IiNmZmZmZmYiIGZpbGwtb3BhY2l0eT0iMC40Ij48cGF0aCBkPSJNMzYgMzRoLTJ2LTRoMnY0em0wLTZ2LTRoLTJ2NGgyem0tNiA2aC0ydi00aDJ2NHptMC02di00aC0ydjRoMnoiLz48L2c+PC9nPjwvc3ZnPg==')]"})}),r.jsx("div",{className:"container mx-auto px-4 relative",children:r.jsxs("div",{className:"max-w-5xl mx-auto text-center space-y-8",children:[r.jsx("div",{className:"flex justify-center mb-8",children:r.jsx("img",{alt:"LevelUp Consulting Group",className:"h-[136px] md:h-[164px] drop-shadow-lg",src:"/lovable-uploads/3a0c7ef9-9e79-411f-a9af-6f2a99e8bd7b.webp"})}),r.jsxs("p",{className:"text-lg text-white/80 max-w-3xl mx-auto leading-relaxed font-sans font-bold md:text-4xl",children:["The tools you need to get it done.",r.jsx("br",{}),r.jsx("em",{children:"The platform you need to keep it going."})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 justify-center items-center pt-4",children:[r.jsxs(ee,{size:"lg",onClick:()=>{var H;return(H=document.getElementById("free-trial"))==null?void 0:H.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(dl,{className:"ml-2 w-5 h-5 group-hover:translate-x-1 transition-transform"})]}),r.jsx(ee,{size:"lg",variant:"outline",onClick:()=>{var H;return(H=document.getElementById("features"))==null?void 0:H.scrollIntoView({behavior:"smooth"})},className:"px-8 py-7 text-lg font-semibold border-2 border-white text-white bg-transparent hover:bg-white hover:text-[#1e3a4c] rounded-full",children:"See What's Included"})]})]})})]}),r.jsx("section",{className:"py-20 bg-background",children:r.jsx("div",{className:"container mx-auto px-4",children:r.jsxs("div",{className:"max-w-4xl mx-auto text-center space-y-8",children:[r.jsx("h2",{className:"text-3xl md:text-5xl leading-tight font-sans font-semibold text-secondary",children:"We help brokerages and agents grow with training, tools, and built-in execution."}),r.jsxs("div",{className:"space-y-2 text-lg text-muted-foreground",children:[r.jsx("p",{children:"Agents get weekly coaching + plug-and-play marketing."}),r.jsx("p",{children:"Brokerages get higher adoption, consistency, and real engagement."})]}),r.jsx("p",{className:"text-2xl md:text-4xl text-[#4a6b6d] pt-4 font-sans font-bold",children:"LEVELUP EQUIPS BOTH TO THRIVE."}),r.jsx("p",{className:"text-lg text-muted-foreground",children:"Learn how we support agents and empower brokerages to grow—together."}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 justify-center pt-4",children:[r.jsxs(ee,{size:"lg",variant:"outline",onClick:()=>{var H;return(H=document.getElementById("brokerage"))==null?void 0:H.scrollIntoView({behavior:"smooth"})},className:"border-[#4a6b6d] text-[#4a6b6d] hover:bg-[#4a6b6d]/5",children:[r.jsx(ai,{className:"mr-2 h-5 w-5"}),"Brokerage Partnership"]}),r.jsxs(ee,{size:"lg",onClick:()=>{var H;return(H=document.getElementById("pricing"))==null?void 0:H.scrollIntoView({behavior:"smooth"})},className:"bg-[#4a6b6d] hover:bg-[#3d5a5c]",children:[r.jsx(Ec,{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:dot.map((H,Z)=>r.jsxs(Ye,{className:"group relative overflow-hidden border hover:border-[#4a6b6d]/50 transition-all duration-300 hover:shadow-lg bg-background",children:[r.jsxs(Gt,{children:[r.jsx("div",{className:"w-14 h-14 rounded-2xl bg-[#4a6b6d]/10 flex items-center justify-center mb-4",children:r.jsx(H.icon,{className:"w-7 h-7 text-[#4a6b6d]"})}),r.jsx(Zt,{className:"text-xl font-sans",children:H.title})]}),r.jsx(tt,{children:r.jsx("p",{className:"text-muted-foreground leading-relaxed",children:H.description})})]},Z))})]})}),r.jsxs("section",{id:"agent-os",className:"py-20 bg-gradient-to-br from-[#4a6b6d] to-[#3d5a5c] relative overflow-hidden",children:[r.jsx("div",{className:"absolute inset-0 opacity-10",children:r.jsx("div",{className:"absolute inset-0 bg-[url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNjAiIGhlaWdodD0iNjAiIHZpZXdCb3g9IjAgMCA2MCA2MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxnIGZpbGw9IiNmZmZmZmYiIGZpbGwtb3BhY2l0eT0iMC40Ij48cGF0aCBkPSJNMzYgMzRoLTJ2LTRoMnY0em0wLTZ2LTRoLTJ2NGgyem0tNiA2aC0ydi00aDJ2NHptMC02di00aC0ydjRoMnoiLz48L2c+PC9nPjwvc3ZnPg==')]"})}),r.jsxs("div",{className:"container mx-auto px-4 relative",children:[r.jsxs("div",{className:"text-center max-w-3xl mx-auto mb-16",children:[r.jsxs("div",{className:"inline-flex items-center gap-2 px-4 py-2 rounded-full bg-white/10 text-white text-sm font-medium mb-6",children:[r.jsx(Ms,{className:"w-4 h-4"}),"Included with Membership"]}),r.jsxs("h2",{className:"text-3xl mb-6 text-white font-sans font-bold md:text-6xl",children:["Meet ",r.jsx("span",{className:"italic",children:"Agent OS"})]}),r.jsx("p",{className:"text-lg text-white/80",children:"Your relationship-first operating system. Never forget a follow-up, track every touchpoint, and turn your sphere into a referral machine."})]}),r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6 max-w-6xl mx-auto",children:uot.map((H,Z)=>r.jsxs(Ye,{className:"group relative overflow-hidden border-0 bg-white/10 backdrop-blur-sm hover:bg-white/20 transition-all duration-300",children:[r.jsxs(Gt,{className:"pb-3",children:[r.jsx("div",{className:"w-12 h-12 rounded-xl bg-white/20 flex items-center justify-center mb-3",children:r.jsx(H.icon,{className:"w-6 h-6 text-white"})}),r.jsx(Zt,{className:"text-lg font-semibold text-white",children:H.title})]}),r.jsx(tt,{children:r.jsx("p",{className:"text-white/70 text-sm leading-relaxed",children:H.description})})]},Z))}),r.jsx("div",{className:"text-center mt-12",children:r.jsxs(ee,{size:"lg",onClick:()=>{var H;return(H=document.getElementById("pricing"))==null?void 0:H.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(dl,{className:"ml-2 w-5 h-5"})]})})]})]}),r.jsx("section",{id:"brokerage",className:"py-20 bg-[#4a6b6d]/5",children:r.jsx("div",{className:"container mx-auto px-4",children:r.jsx("div",{className:"max-w-6xl mx-auto",children:r.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-12 items-center",children:[r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"inline-flex items-center gap-2 px-4 py-2 rounded-full bg-[#4a6b6d]/10 text-[#4a6b6d] text-sm font-medium",children:[r.jsx(ai,{className:"w-4 h-4"}),"For Brokerages"]}),r.jsxs("h2",{className:"text-3xl font-sans font-bold md:text-6xl",children:["Empower Your"," ",r.jsx("span",{className:"italic text-[#4a6b6d]",children:"Entire Team"})]}),r.jsx("p",{className:"text-lg text-muted-foreground",children:"Give every agent on your team access to world-class training and resources. Track performance, streamline onboarding, and watch your brokerage thrive."}),r.jsx("ul",{className:"space-y-4",children:["Dedicated brokerage manager dashboard","Invite and manage agents with one click","Exclusive brokerage-only resources","Team analytics and performance tracking","Simplified agent onboarding","Share resources across your team"].map((H,Z)=>r.jsxs("li",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"w-6 h-6 rounded-full bg-[#4a6b6d]/10 flex items-center justify-center flex-shrink-0",children:r.jsx(Ai,{className:"w-4 h-4 text-[#4a6b6d]"})}),r.jsx("span",{className:"text-foreground",children:H})]},Z))}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 mt-4",children:[r.jsxs(ee,{size:"lg",onClick:()=>{var H;return(H=document.getElementById("pricing"))==null?void 0:H.scrollIntoView({behavior:"smooth"})},className:"bg-[#4a6b6d] hover:bg-[#3d5a5c]",children:["See Brokerage Plans",r.jsx(Vi,{className:"ml-2 w-5 h-5"})]}),r.jsxs(ee,{size:"lg",variant:"outline",onClick:()=>L(!0),className:"border-[#4a6b6d] text-[#4a6b6d] hover:bg-[#4a6b6d]/10",children:[r.jsx(zs,{className:"mr-2 w-5 h-5"}),"Schedule Info Session"]})]})]}),r.jsx("div",{className:"relative hidden md:block",children:r.jsx("img",{src:lot,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:hot.map((H,Z)=>r.jsx(Ye,{className:"bg-muted/30 border-0",children:r.jsxs(tt,{className:"pt-8",children:[r.jsx("div",{className:"flex gap-1 mb-4",children:[1,2,3,4,5].map(G=>r.jsx(vs,{className:"w-5 h-5 fill-yellow-400 text-yellow-400"},G))}),r.jsxs("p",{className:"text-lg mb-6 italic text-muted-foreground",children:['"',H.quote,'"']}),r.jsxs("div",{children:[r.jsx("p",{className:"font-semibold",children:H.name}),r.jsx("p",{className:"text-sm text-muted-foreground",children:H.role})]})]})},Z))})]})}),r.jsxs("section",{id:"free-trial",className:"py-20 bg-gradient-to-br from-[#1e3a4c] via-[#2a4f5f] to-[#3d6b6b] relative overflow-hidden",children:[r.jsx("div",{className:"absolute inset-0 opacity-10",children:r.jsx("div",{className:"absolute inset-0 bg-[url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNjAiIGhlaWdodD0iNjAiIHZpZXdCb3g9IjAgMCA2MCA2MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxnIGZpbGw9IiNmZmZmZmYiIGZpbGwtb3BhY2l0eT0iMC40Ij48cGF0aCBkPSJNMzYgMzRoLTJ2LTRoMnY0em0wLTZ2LTRoLTJ2NGgyem0tNiA2aC0ydi00aDJ2NHptMC02di00aC0ydjRoMnoiLz48L2c+PC9nPjwvc3ZnPg==')]"})}),r.jsx("div",{className:"container mx-auto px-4 relative",children:r.jsxs("div",{className:"max-w-3xl mx-auto text-center space-y-8",children:[r.jsxs("h2",{className:"text-3xl md:text-5xl font-bold text-white",children:["Start Your Free Trial ",r.jsx("span",{className:"italic",children:"Today"})]}),r.jsx("p",{className:"text-lg md:text-xl text-white/80 leading-relaxed",children:"Get instant access to 7 days of trainings, templates, and tools — designed to give you quick wins now and resources you'll keep forever."}),r.jsx("div",{className:"pt-4",children:r.jsxs(ee,{size:"lg",className:"px-12 py-7 text-lg font-semibold bg-white text-[#4a6b6d] hover:bg-white/90 shadow-2xl transition-all hover:scale-105 group rounded-full",onClick:()=>z("individual_agent"),children:["Start Free Trial",r.jsx(dl,{className:"ml-2 w-5 h-5 group-hover:translate-x-1 transition-transform"})]})})]})})]}),r.jsx("section",{id:"pricing",className:"py-20 bg-muted/30",children:r.jsxs("div",{className:"container mx-auto px-4",children:[r.jsxs("div",{className:"text-center mb-16",children:[r.jsxs("h2",{className:"text-3xl mb-6 font-sans md:text-5xl font-bold",children:["Simple, Transparent ",r.jsx("span",{className:"italic text-[#4a6b6d]",children:"Pricing"})]}),r.jsx("p",{className:"text-lg text-muted-foreground max-w-2xl mx-auto",children:"Choose the plan that fits your needs. All plans include everything you need to succeed."})]}),r.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-8 max-w-6xl mx-auto",children:[r.jsxs(Ye,{className:"relative flex flex-col border hover:border-[#4a6b6d]/50 transition-all hover:shadow-xl bg-background",children:[r.jsxs(Gt,{className:"pb-4",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[r.jsx("div",{className:"w-10 h-10 rounded-xl bg-[#4a6b6d]/10 flex items-center justify-center",children:r.jsx(Ec,{className:"w-5 h-5 text-[#4a6b6d]"})}),r.jsx(Zt,{className:"text-xl font-sans",children:ad.individual_agent.name})]}),r.jsxs("div",{className:"flex items-baseline gap-1 mt-4",children:[r.jsx("span",{className:"text-5xl font-bold",children:ad.individual_agent.price}),r.jsx("span",{className:"text-muted-foreground text-lg",children:ad.individual_agent.period})]}),r.jsx(Mn,{className:"text-base mt-2",children:ad.individual_agent.description}),r.jsxs("div",{className:"inline-flex items-center gap-2 px-4 py-2 rounded-full bg-green-500/10 text-green-600 text-sm font-medium mt-4",children:[r.jsx(Ya,{className:"w-4 h-4"}),ad.individual_agent.trial]})]}),r.jsx(tt,{className:"flex-1 pt-0",children:r.jsx("ul",{className:"space-y-3",children:ad.individual_agent.features.map((H,Z)=>r.jsxs("li",{className:"flex items-center gap-3",children:[r.jsx(Ai,{className:"w-5 h-5 text-[#4a6b6d] flex-shrink-0"}),r.jsx("span",{children:H})]},Z))})}),r.jsxs(aA,{className:"flex flex-col gap-3 pt-4",children:[r.jsx(ee,{className:"w-full py-6 text-lg bg-[#4a6b6d] hover:bg-[#3d5a5c]",onClick:()=>z("individual_agent"),children:"Start Free Trial"}),r.jsx(ee,{variant:"outline",className:"w-full rounded-full border-2 border-[#4a6b6d] text-[#4a6b6d] bg-white hover:bg-[#4a6b6d]/5 uppercase text-sm font-medium tracking-wide",onClick:()=>z("individual_agent",!0),children:"Skip Trial, Subscribe Now"})]})]}),r.jsxs(Ye,{className:"relative flex flex-col border-2 border-[#4a6b6d] shadow-2xl scale-105 bg-background",children:[r.jsx("div",{className:"absolute -top-4 left-1/2 -translate-x-1/2 px-6 py-2 bg-[#4a6b6d] text-white text-sm font-semibold rounded-full shadow-lg",children:"Most Popular"}),r.jsxs(Gt,{className:"pb-4 pt-8",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[r.jsx("div",{className:"w-10 h-10 rounded-xl bg-[#4a6b6d]/20 flex items-center justify-center",children:r.jsx(ai,{className:"w-5 h-5 text-[#4a6b6d]"})}),r.jsxs("div",{children:[r.jsx(Zt,{className:"text-xl font-sans",children:ad.brokerage_under_25.name}),r.jsx("span",{className:"text-sm text-muted-foreground",children:ad.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:ad.brokerage_under_25.price}),r.jsx("span",{className:"text-muted-foreground text-lg",children:ad.brokerage_under_25.period})]}),r.jsx(Mn,{className:"text-base mt-2",children:ad.brokerage_under_25.description})]}),r.jsx(tt,{className:"flex-1 pt-0",children:r.jsx("ul",{className:"space-y-3",children:ad.brokerage_under_25.features.map((H,Z)=>r.jsxs("li",{className:"flex items-center gap-3",children:[r.jsx(Ai,{className:"w-5 h-5 text-[#4a6b6d] flex-shrink-0"}),r.jsx("span",{children:H})]},Z))})}),r.jsx(aA,{className:"pt-4",children:r.jsx(ee,{className:"w-full py-6 text-lg shadow-lg bg-[#4a6b6d] hover:bg-[#3d5a5c]",onClick:()=>z("brokerage_under_25"),children:"Get Started"})})]}),r.jsxs(Ye,{className:"relative flex flex-col border hover:border-[#4a6b6d]/50 transition-all hover:shadow-xl bg-background",children:[r.jsxs(Gt,{className:"pb-4",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[r.jsx("div",{className:"w-10 h-10 rounded-xl bg-[#4a6b6d]/10 flex items-center justify-center",children:r.jsx(ai,{className:"w-5 h-5 text-[#4a6b6d]"})}),r.jsxs("div",{children:[r.jsx(Zt,{className:"text-xl font-sans",children:ad.brokerage_over_25.name}),r.jsx("span",{className:"text-sm text-muted-foreground",children:ad.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:ad.brokerage_over_25.price}),r.jsx("span",{className:"text-muted-foreground text-lg",children:ad.brokerage_over_25.period})]}),r.jsx(Mn,{className:"text-base mt-2",children:ad.brokerage_over_25.description})]}),r.jsx(tt,{className:"flex-1 pt-0",children:r.jsx("ul",{className:"space-y-3",children:ad.brokerage_over_25.features.map((H,Z)=>r.jsxs("li",{className:"flex items-center gap-3",children:[r.jsx(Ai,{className:"w-5 h-5 text-[#4a6b6d] flex-shrink-0"}),r.jsx("span",{children:H})]},Z))})}),r.jsx(aA,{className:"pt-4",children:r.jsx(ee,{className:"w-full py-6 text-lg bg-[#4a6b6d] hover:bg-[#3d5a5c]",onClick:()=>z("brokerage_over_25"),children:"Get Started"})})]})]})]})}),r.jsxs("section",{className:"py-20 bg-gradient-to-br from-[#1e3a4c] via-[#2a4f5f] to-[#3d6b6b] relative overflow-hidden",children:[r.jsx("div",{className:"absolute inset-0 opacity-10",children:r.jsx("div",{className:"absolute inset-0 bg-[url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNjAiIGhlaWdodD0iNjAiIHZpZXdCb3g9IjAgMCA2MCA2MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxnIGZpbGw9IiNmZmZmZmYiIGZpbGwtb3BhY2l0eT0iMC40Ij48cGF0aCBkPSJNMzYgMzRoLTJ2LTRoMnY0em0wLTZ2LTRoLTJ2NGgyem0tNiA2aC0ydi00aDJ2NHptMC02di00aC0ydjRoMnoiLz48L2c+PC9nPjwvc3ZnPg==')]"})}),r.jsx("div",{className:"container mx-auto px-4 relative",children:r.jsxs("div",{className:"max-w-4xl mx-auto text-center space-y-8",children:[r.jsx("h2",{className:"text-3xl text-white font-sans md:text-5xl",children:"Ready to Level Up?"}),r.jsx("p",{className:"text-lg text-white/80 max-w-2xl mx-auto",children:"Join thousands of agents who are closing more deals, saving time, and growing their business with LevelUp."}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 justify-center",children:[r.jsxs(ee,{size:"lg",onClick:()=>{var H;return(H=document.getElementById("pricing"))==null?void 0:H.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(dl,{className:"ml-2 w-5 h-5"})]}),r.jsx(ee,{size:"lg",onClick:()=>n("/auth"),className:"px-10 py-7 text-lg font-semibold border-2 border-white text-white bg-transparent hover:bg-white hover:text-[#4a6b6d]",children:"Sign In"})]})]})})]}),r.jsx("footer",{className:"py-12 bg-[#3d5a5c] text-white/80",children:r.jsx("div",{className:"container mx-auto px-4",children:r.jsxs("div",{className:"flex flex-col md:flex-row items-center justify-between gap-4",children:[r.jsx("img",{src:tte,alt:"LevelUp",className:"h-8"}),r.jsxs("p",{className:"text-sm",children:["© ",new Date().getFullYear()," LevelUp. All rights reserved."]}),r.jsxs("div",{className:"flex items-center gap-6",children:[r.jsx("a",{href:"/privacy-policy",className:"text-white/60 hover:text-white transition-colors text-sm",children:"Privacy Policy"}),r.jsx("a",{href:"mailto:support@relevelup.com",className:"text-white/60 hover:text-white transition-colors text-sm",children:"Contact Support"})]})]})})}),r.jsx(cot,{open:T,onOpenChange:L}),r.jsx(Fr,{open:h,onOpenChange:p,children:r.jsxs(Rr,{className:"sm:max-w-md",children:[r.jsxs(qr,{children:[r.jsx($r,{className:"text-xl font-sans font-semibold",children:"Enter your details to get started"}),r.jsx(Xn,{children:(l==null?void 0:l.tier)==="individual_agent"&&!(l!=null&&l.skipTrial)?"Start your 7-day free trial":(l==null?void 0:l.tier)==="individual_agent"?"Subscribe to Individual Agent":(l==null?void 0:l.tier)==="brokerage_under_25"?"Subscribe to Brokerage (Under 25 Agents)":"Subscribe to Brokerage (Over 25 Agents)"})]}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{children:[r.jsxs(He,{htmlFor:"dialog-name",children:["Full Name ",r.jsx("span",{className:"text-red-500",children:"*"})]}),r.jsx(dt,{id:"dialog-name",type:"text",placeholder:"John Smith",value:b,onChange:H=>j(H.target.value),className:"mt-1",required:!0})]}),r.jsxs("div",{children:[r.jsxs(He,{htmlFor:"dialog-email",children:["Email Address ",r.jsx("span",{className:"text-red-500",children:"*"})]}),r.jsx(dt,{id:"dialog-email",type:"email",placeholder:"you@example.com",value:x,onChange:H=>y(H.target.value),className:"mt-1",required:!0})]}),r.jsxs("div",{children:[r.jsxs(He,{htmlFor:"dialog-coupon",children:["Discount Code ",r.jsx("span",{className:"text-muted-foreground",children:"(Optional)"})]}),r.jsx(dt,{id:"dialog-coupon",type:"text",placeholder:"Enter discount code",value:C,onChange:H=>N(H.target.value),className:"mt-1"})]})]}),r.jsx(ee,{className:"w-full py-6 text-lg bg-[#4a6b6d] hover:bg-[#3d5a5c]",onClick:q,disabled:A,children:A?"Loading...":"Continue to Checkout"})]})})]})},pot=()=>r.jsxs(r.Fragment,{children:[r.jsxs(km,{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"})]})]})]})]})})]}),mot=()=>r.jsxs(r.Fragment,{children:[r.jsxs(km,{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"})]})]})]})]})})]}),got=()=>r.jsxs(r.Fragment,{children:[r.jsxs(km,{children:[r.jsx("title",{children:"Data Deletion | LevelUp"}),r.jsx("meta",{name:"description",content:"Data deletion instructions for LevelUp platform"})]}),r.jsx("div",{className:"min-h-screen bg-background py-12 px-4 sm:px-6 lg:px-8",children:r.jsxs("div",{className:"max-w-3xl mx-auto",children:[r.jsx("h1",{className:"text-3xl font-bold text-foreground mb-8",children:"Data Deletion Instructions"}),r.jsxs("div",{className:"prose prose-sm max-w-none text-muted-foreground space-y-6",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Last updated: January 17, 2026"}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"How to Request Data Deletion"}),r.jsx("p",{children:"If you wish to have your data deleted from LevelUp, you can request deletion through one of the following methods:"})]}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"Option 1: Email Request"}),r.jsxs("p",{children:["Send an email to"," ",r.jsx("a",{href:"mailto:support@relevelup.com",className:"text-primary hover:underline",children:"support@relevelup.com"})," ",'with the subject line "Data Deletion Request" and include:']}),r.jsxs("ul",{className:"list-disc pl-6 mt-2 space-y-1",children:[r.jsx("li",{children:"Your full name"}),r.jsx("li",{children:"The email address associated with your account"}),r.jsx("li",{children:"A clear statement requesting deletion of your data"})]})]}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"Option 2: Account Settings"}),r.jsx("p",{children:"If you have an active account, you can request data deletion through your account settings:"}),r.jsxs("ol",{className:"list-decimal pl-6 mt-2 space-y-1",children:[r.jsx("li",{children:"Log in to your LevelUp account"}),r.jsx("li",{children:"Navigate to your Profile settings"}),r.jsx("li",{children:"Contact support through the Support page to request account deletion"})]})]}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"What Data Will Be Deleted"}),r.jsx("p",{children:"Upon a valid deletion request, we will delete:"}),r.jsxs("ul",{className:"list-disc pl-6 mt-2 space-y-1",children:[r.jsx("li",{children:"Your account information (name, email, profile data)"}),r.jsx("li",{children:"Any content you have created or uploaded"}),r.jsx("li",{children:"Your activity history and preferences"}),r.jsx("li",{children:"Connected social media account tokens and data"})]})]}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"Data Retention"}),r.jsx("p",{children:"Some data may be retained for legal or legitimate business purposes, such as:"}),r.jsxs("ul",{className:"list-disc pl-6 mt-2 space-y-1",children:[r.jsx("li",{children:"Transaction records required for financial reporting"}),r.jsx("li",{children:"Data necessary to comply with legal obligations"}),r.jsx("li",{children:"Anonymized or aggregated data that cannot identify you"})]})]}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"Facebook/Instagram Data"}),r.jsx("p",{children:"If you have connected your Facebook or Instagram account to LevelUp, you can also manage your data through Facebook's settings:"}),r.jsxs("ol",{className:"list-decimal pl-6 mt-2 space-y-1",children:[r.jsx("li",{children:"Go to your Facebook Settings & Privacy → Settings"}),r.jsx("li",{children:'Click on "Apps and Websites"'}),r.jsx("li",{children:'Find LevelUp and click "Remove"'}),r.jsx("li",{children:"This will revoke our access to your Facebook/Instagram data"})]})]}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"Processing Time"}),r.jsx("p",{children:"We will process your data deletion request within 30 days of receiving it. You will receive a confirmation email once your data has been deleted."})]}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-xl font-semibold text-foreground mt-8 mb-4",children:"Contact Us"}),r.jsxs("p",{children:["If you have questions about data deletion, please contact us at"," ",r.jsx("a",{href:"mailto:support@relevelup.com",className:"text-primary hover:underline",children:"support@relevelup.com"})]})]})]})]})})]});var ro;(function(t){t.assertEqual=a=>{};function e(a){}t.assertIs=e;function n(a){throw new Error}t.assertNever=n,t.arrayToEnum=a=>{const o={};for(const l of a)o[l]=l;return o},t.getValidEnumValues=a=>{const o=t.objectKeys(a).filter(i=>typeof a[a[i]]!="number"),l={};for(const i of o)l[i]=a[i];return t.objectValues(l)},t.objectValues=a=>t.objectKeys(a).map(function(o){return a[o]}),t.objectKeys=typeof Object.keys=="function"?a=>Object.keys(a):a=>{const o=[];for(const l in a)Object.prototype.hasOwnProperty.call(a,l)&&o.push(l);return o},t.find=(a,o)=>{for(const l of a)if(o(l))return l},t.isInteger=typeof Number.isInteger=="function"?a=>Number.isInteger(a):a=>typeof a=="number"&&Number.isFinite(a)&&Math.floor(a)===a;function s(a,o=" | "){return a.map(l=>typeof l=="string"?`'${l}'`:l).join(o)}t.joinValues=s,t.jsonStringifyReplacer=(a,o)=>typeof o=="bigint"?o.toString():o})(ro||(ro={}));var xje;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(xje||(xje={}));const Cs=ro.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),y0=t=>{switch(typeof t){case"undefined":return Cs.undefined;case"string":return Cs.string;case"number":return Number.isNaN(t)?Cs.nan:Cs.number;case"boolean":return Cs.boolean;case"function":return Cs.function;case"bigint":return Cs.bigint;case"symbol":return Cs.symbol;case"object":return Array.isArray(t)?Cs.array:t===null?Cs.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?Cs.promise:typeof Map<"u"&&t instanceof Map?Cs.map:typeof Set<"u"&&t instanceof Set?Cs.set:typeof Date<"u"&&t instanceof Date?Cs.date:Cs.object;default:return Cs.unknown}},On=ro.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class Ig extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=s=>{this.issues=[...this.issues,s]},this.addIssues=(s=[])=>{this.issues=[...this.issues,...s]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=e}format(e){const n=e||function(o){return o.message},s={_errors:[]},a=o=>{for(const l of o.issues)if(l.code==="invalid_union")l.unionErrors.map(a);else if(l.code==="invalid_return_type")a(l.returnTypeError);else if(l.code==="invalid_arguments")a(l.argumentsError);else if(l.path.length===0)s._errors.push(n(l));else{let i=s,h=0;for(;hn.message){const n={},s=[];for(const a of this.issues)if(a.path.length>0){const o=a.path[0];n[o]=n[o]||[],n[o].push(e(a))}else s.push(e(a));return{formErrors:s,fieldErrors:n}}get formErrors(){return this.flatten()}}Ig.create=t=>new Ig(t);const lhe=(t,e)=>{let n;switch(t.code){case On.invalid_type:t.received===Cs.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case On.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,ro.jsonStringifyReplacer)}`;break;case On.unrecognized_keys:n=`Unrecognized key(s) in object: ${ro.joinValues(t.keys,", ")}`;break;case On.invalid_union:n="Invalid input";break;case On.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${ro.joinValues(t.options)}`;break;case On.invalid_enum_value:n=`Invalid enum value. Expected ${ro.joinValues(t.options)}, received '${t.received}'`;break;case On.invalid_arguments:n="Invalid function arguments";break;case On.invalid_return_type:n="Invalid function return type";break;case On.invalid_date:n="Invalid date";break;case On.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(n=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?n=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?n=`Invalid input: must end with "${t.validation.endsWith}"`:ro.assertNever(t.validation):t.validation!=="regex"?n=`Invalid ${t.validation}`:n="Invalid";break;case On.too_small:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:n="Invalid input";break;case On.too_big:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?n=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:n="Invalid input";break;case On.custom:n="Invalid input";break;case On.invalid_intersection_types:n="Intersection results could not be merged";break;case On.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case On.not_finite:n="Number must be finite";break;default:n=e.defaultError,ro.assertNever(t)}return{message:n}};let xot=lhe;function yot(){return xot}const vot=t=>{const{data:e,path:n,errorMaps:s,issueData:a}=t,o=[...n,...a.path||[]],l={...a,path:o};if(a.message!==void 0)return{...a,path:o,message:a.message};let i="";const h=s.filter(p=>!!p).slice().reverse();for(const p of h)i=p(l,{data:e,defaultError:i}).message;return{...a,path:o,message:i}};function hs(t,e){const n=yot(),s=vot({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===lhe?void 0:lhe].filter(a=>!!a)});t.common.issues.push(s)}class cf{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,n){const s=[];for(const a of n){if(a.status==="aborted")return Ka;a.status==="dirty"&&e.dirty(),s.push(a.value)}return{status:e.value,value:s}}static async mergeObjectAsync(e,n){const s=[];for(const a of n){const o=await a.key,l=await a.value;s.push({key:o,value:l})}return cf.mergeObjectSync(e,s)}static mergeObjectSync(e,n){const s={};for(const a of n){const{key:o,value:l}=a;if(o.status==="aborted"||l.status==="aborted")return Ka;o.status==="dirty"&&e.dirty(),l.status==="dirty"&&e.dirty(),o.value!=="__proto__"&&(typeof l.value<"u"||a.alwaysSet)&&(s[o.value]=l.value)}return{status:e.value,value:s}}}const Ka=Object.freeze({status:"aborted"}),oT=t=>({status:"dirty",value:t}),ap=t=>({status:"valid",value:t}),yje=t=>t.status==="aborted",vje=t=>t.status==="dirty",oC=t=>t.status==="valid",rte=t=>typeof Promise<"u"&&t instanceof Promise;var Rs;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(Rs||(Rs={}));class z1{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 _je=(t,e)=>{if(oC(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 Ig(t.common.issues);return this._error=n,this._error}}};function yi(t){if(!t)return{};const{errorMap:e,invalid_type_error:n,required_error:s,description:a}=t;if(e&&(n||s))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:a}:{errorMap:(l,i)=>{const{message:h}=t;return l.code==="invalid_enum_value"?{message:h??i.defaultError}:typeof i.data>"u"?{message:h??s??i.defaultError}:l.code!=="invalid_type"?{message:i.defaultError}:{message:h??n??i.defaultError}},description:a}}class Ji{get description(){return this._def.description}_getType(e){return y0(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:y0(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new cf,ctx:{common:e.parent.common,data:e.data,parsedType:y0(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const n=this._parse(e);if(rte(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(e){const n=this._parse(e);return Promise.resolve(n)}parse(e,n){const s=this.safeParse(e,n);if(s.success)return s.data;throw s.error}safeParse(e,n){const s={common:{issues:[],async:(n==null?void 0:n.async)??!1,contextualErrorMap:n==null?void 0:n.errorMap},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:y0(e)},a=this._parseSync({data:e,path:s.path,parent:s});return _je(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:y0(e)};if(!this["~standard"].async)try{const o=this._parseSync({data:e,path:[],parent:n});return oC(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=>oC(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:y0(e)},a=this._parse({data:e,path:s.path,parent:s}),o=await(rte(a)?a:Promise.resolve(a));return _je(s,o)}refine(e,n){const s=a=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(a):n;return this._refinement((a,o)=>{const l=e(a),i=()=>o.addIssue({code:On.custom,...s(a)});return typeof Promise<"u"&&l instanceof Promise?l.then(h=>h?!0:(i(),!1)):l?!0:(i(),!1)})}refinement(e,n){return this._refinement((s,a)=>e(s)?!0:(a.addIssue(typeof n=="function"?n(s,a):n),!1))}_refinement(e){return new dC({schema:this,typeName:Za.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:n=>this["~validate"](n)}}optional(){return S1.create(this,this._def)}nullable(){return uC.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Mg.create(this)}promise(){return ite.create(this,this._def)}or(e){return ste.create([this,e],this._def)}and(e){return ate.create(this,e,this._def)}transform(e){return new dC({...yi(this._def),schema:this,typeName:Za.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const n=typeof e=="function"?e:()=>e;return new hhe({...yi(this._def),innerType:this,defaultValue:n,typeName:Za.ZodDefault})}brand(){return new Uot({typeName:Za.ZodBranded,type:this,...yi(this._def)})}catch(e){const n=typeof e=="function"?e:()=>e;return new fhe({...yi(this._def),innerType:this,catchValue:n,typeName:Za.ZodCatch})}describe(e){const n=this.constructor;return new n({...this._def,description:e})}pipe(e){return Dge.create(this,e)}readonly(){return phe.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const _ot=/^c[^\s-]{8,}$/i,bot=/^[0-9a-z]+$/,wot=/^[0-9A-HJKMNP-TV-Z]{26}$/i,jot=/^[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,kot=/^[a-z0-9_-]{21}$/i,Not=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Sot=/^[-+]?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)?)??$/,Cot=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Mot="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Ule;const Tot=/^(?:(?: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])$/,Aot=/^(?:(?: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])$/,Eot=/^(([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]))$/,Iot=/^(([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])$/,Pot=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Lot=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,mLe="((\\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])))",Oot=new RegExp(`^${mLe}$`);function gLe(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 Dot(t){return new RegExp(`^${gLe(t)}$`)}function Rot(t){let e=`${mLe}T${gLe(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 Fot(t,e){return!!((e==="v4"||!e)&&Tot.test(t)||(e==="v6"||!e)&&Eot.test(t))}function zot(t,e){if(!Not.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 Bot(t,e){return!!((e==="v4"||!e)&&Aot.test(t)||(e==="v6"||!e)&&Iot.test(t))}class W0 extends Ji{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==Cs.string){const o=this._getOrReturnCtx(e);return hs(o,{code:On.invalid_type,expected:Cs.string,received:o.parsedType}),Ka}const s=new cf;let a;for(const o of this._def.checks)if(o.kind==="min")e.data.lengtho.value&&(a=this._getOrReturnCtx(e,a),hs(a,{code:On.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),s.dirty());else if(o.kind==="length"){const l=e.data.length>o.value,i=e.data.lengthe.test(a),{validation:n,code:On.invalid_string,...Rs.errToObj(s)})}_addCheck(e){return new W0({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...Rs.errToObj(e)})}url(e){return this._addCheck({kind:"url",...Rs.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...Rs.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...Rs.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...Rs.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...Rs.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...Rs.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...Rs.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...Rs.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...Rs.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...Rs.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...Rs.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...Rs.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,...Rs.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,...Rs.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...Rs.errToObj(e)})}regex(e,n){return this._addCheck({kind:"regex",regex:e,...Rs.errToObj(n)})}includes(e,n){return this._addCheck({kind:"includes",value:e,position:n==null?void 0:n.position,...Rs.errToObj(n==null?void 0:n.message)})}startsWith(e,n){return this._addCheck({kind:"startsWith",value:e,...Rs.errToObj(n)})}endsWith(e,n){return this._addCheck({kind:"endsWith",value:e,...Rs.errToObj(n)})}min(e,n){return this._addCheck({kind:"min",value:e,...Rs.errToObj(n)})}max(e,n){return this._addCheck({kind:"max",value:e,...Rs.errToObj(n)})}length(e,n){return this._addCheck({kind:"length",value:e,...Rs.errToObj(n)})}nonempty(e){return this.min(1,Rs.errToObj(e))}trim(){return new W0({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new W0({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new W0({...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 W0({checks:[],typeName:Za.ZodString,coerce:(t==null?void 0:t.coerce)??!1,...yi(t)});function $ot(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 lC extends Ji{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==Cs.number){const o=this._getOrReturnCtx(e);return hs(o,{code:On.invalid_type,expected:Cs.number,received:o.parsedType}),Ka}let s;const a=new cf;for(const o of this._def.checks)o.kind==="int"?ro.isInteger(e.data)||(s=this._getOrReturnCtx(e,s),hs(s,{code:On.invalid_type,expected:"integer",received:"float",message:o.message}),a.dirty()):o.kind==="min"?(o.inclusive?e.datao.value:e.data>=o.value)&&(s=this._getOrReturnCtx(e,s),hs(s,{code:On.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),a.dirty()):o.kind==="multipleOf"?$ot(e.data,o.value)!==0&&(s=this._getOrReturnCtx(e,s),hs(s,{code:On.not_multiple_of,multipleOf:o.value,message:o.message}),a.dirty()):o.kind==="finite"?Number.isFinite(e.data)||(s=this._getOrReturnCtx(e,s),hs(s,{code:On.not_finite,message:o.message}),a.dirty()):ro.assertNever(o);return{status:a.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,Rs.toString(n))}gt(e,n){return this.setLimit("min",e,!1,Rs.toString(n))}lte(e,n){return this.setLimit("max",e,!0,Rs.toString(n))}lt(e,n){return this.setLimit("max",e,!1,Rs.toString(n))}setLimit(e,n,s,a){return new lC({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:s,message:Rs.toString(a)}]})}_addCheck(e){return new lC({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:Rs.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Rs.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Rs.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Rs.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Rs.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:Rs.toString(n)})}finite(e){return this._addCheck({kind:"finite",message:Rs.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Rs.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Rs.toString(e)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.valuee.kind==="int"||e.kind==="multipleOf"&&ro.isInteger(e.value))}get isFinite(){let e=null,n=null;for(const s of this._def.checks){if(s.kind==="finite"||s.kind==="int"||s.kind==="multipleOf")return!0;s.kind==="min"?(n===null||s.value>n)&&(n=s.value):s.kind==="max"&&(e===null||s.valuenew lC({checks:[],typeName:Za.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...yi(t)});class nE extends Ji{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==Cs.bigint)return this._getInvalidInput(e);let s;const a=new cf;for(const o of this._def.checks)o.kind==="min"?(o.inclusive?e.datao.value:e.data>=o.value)&&(s=this._getOrReturnCtx(e,s),hs(s,{code:On.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),a.dirty()):o.kind==="multipleOf"?e.data%o.value!==BigInt(0)&&(s=this._getOrReturnCtx(e,s),hs(s,{code:On.not_multiple_of,multipleOf:o.value,message:o.message}),a.dirty()):ro.assertNever(o);return{status:a.value,value:e.data}}_getInvalidInput(e){const n=this._getOrReturnCtx(e);return hs(n,{code:On.invalid_type,expected:Cs.bigint,received:n.parsedType}),Ka}gte(e,n){return this.setLimit("min",e,!0,Rs.toString(n))}gt(e,n){return this.setLimit("min",e,!1,Rs.toString(n))}lte(e,n){return this.setLimit("max",e,!0,Rs.toString(n))}lt(e,n){return this.setLimit("max",e,!1,Rs.toString(n))}setLimit(e,n,s,a){return new nE({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:s,message:Rs.toString(a)}]})}_addCheck(e){return new nE({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Rs.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Rs.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Rs.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Rs.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:Rs.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 nE({checks:[],typeName:Za.ZodBigInt,coerce:(t==null?void 0:t.coerce)??!1,...yi(t)});class che extends Ji{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==Cs.boolean){const s=this._getOrReturnCtx(e);return hs(s,{code:On.invalid_type,expected:Cs.boolean,received:s.parsedType}),Ka}return ap(e.data)}}che.create=t=>new che({typeName:Za.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...yi(t)});class nte extends Ji{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==Cs.date){const o=this._getOrReturnCtx(e);return hs(o,{code:On.invalid_type,expected:Cs.date,received:o.parsedType}),Ka}if(Number.isNaN(e.data.getTime())){const o=this._getOrReturnCtx(e);return hs(o,{code:On.invalid_date}),Ka}const s=new cf;let a;for(const o of this._def.checks)o.kind==="min"?e.data.getTime()o.value&&(a=this._getOrReturnCtx(e,a),hs(a,{code:On.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),s.dirty()):ro.assertNever(o);return{status:s.value,value:new Date(e.data.getTime())}}_addCheck(e){return new nte({...this._def,checks:[...this._def.checks,e]})}min(e,n){return this._addCheck({kind:"min",value:e.getTime(),message:Rs.toString(n)})}max(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:Rs.toString(n)})}get minDate(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.valuenew nte({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:Za.ZodDate,...yi(t)});class bje extends Ji{_parse(e){if(this._getType(e)!==Cs.symbol){const s=this._getOrReturnCtx(e);return hs(s,{code:On.invalid_type,expected:Cs.symbol,received:s.parsedType}),Ka}return ap(e.data)}}bje.create=t=>new bje({typeName:Za.ZodSymbol,...yi(t)});class wje extends Ji{_parse(e){if(this._getType(e)!==Cs.undefined){const s=this._getOrReturnCtx(e);return hs(s,{code:On.invalid_type,expected:Cs.undefined,received:s.parsedType}),Ka}return ap(e.data)}}wje.create=t=>new wje({typeName:Za.ZodUndefined,...yi(t)});class jje extends Ji{_parse(e){if(this._getType(e)!==Cs.null){const s=this._getOrReturnCtx(e);return hs(s,{code:On.invalid_type,expected:Cs.null,received:s.parsedType}),Ka}return ap(e.data)}}jje.create=t=>new jje({typeName:Za.ZodNull,...yi(t)});class kje extends Ji{constructor(){super(...arguments),this._any=!0}_parse(e){return ap(e.data)}}kje.create=t=>new kje({typeName:Za.ZodAny,...yi(t)});class Nje extends Ji{constructor(){super(...arguments),this._unknown=!0}_parse(e){return ap(e.data)}}Nje.create=t=>new Nje({typeName:Za.ZodUnknown,...yi(t)});class B1 extends Ji{_parse(e){const n=this._getOrReturnCtx(e);return hs(n,{code:On.invalid_type,expected:Cs.never,received:n.parsedType}),Ka}}B1.create=t=>new B1({typeName:Za.ZodNever,...yi(t)});class Sje extends Ji{_parse(e){if(this._getType(e)!==Cs.undefined){const s=this._getOrReturnCtx(e);return hs(s,{code:On.invalid_type,expected:Cs.void,received:s.parsedType}),Ka}return ap(e.data)}}Sje.create=t=>new Sje({typeName:Za.ZodVoid,...yi(t)});class Mg extends Ji{_parse(e){const{ctx:n,status:s}=this._processInputParams(e),a=this._def;if(n.parsedType!==Cs.array)return hs(n,{code:On.invalid_type,expected:Cs.array,received:n.parsedType}),Ka;if(a.exactLength!==null){const l=n.data.length>a.exactLength.value,i=n.data.lengtha.maxLength.value&&(hs(n,{code:On.too_big,maximum:a.maxLength.value,type:"array",inclusive:!0,exact:!1,message:a.maxLength.message}),s.dirty()),n.common.async)return Promise.all([...n.data].map((l,i)=>a.type._parseAsync(new z1(n,l,n.path,i)))).then(l=>cf.mergeArray(s,l));const o=[...n.data].map((l,i)=>a.type._parseSync(new z1(n,l,n.path,i)));return cf.mergeArray(s,o)}get element(){return this._def.type}min(e,n){return new Mg({...this._def,minLength:{value:e,message:Rs.toString(n)}})}max(e,n){return new Mg({...this._def,maxLength:{value:e,message:Rs.toString(n)}})}length(e,n){return new Mg({...this._def,exactLength:{value:e,message:Rs.toString(n)}})}nonempty(e){return this.min(1,e)}}Mg.create=(t,e)=>new Mg({type:t,minLength:null,maxLength:null,exactLength:null,typeName:Za.ZodArray,...yi(e)});function y4(t){if(t instanceof Sc){const e={};for(const n in t.shape){const s=t.shape[n];e[n]=S1.create(y4(s))}return new Sc({...t._def,shape:()=>e})}else return t instanceof Mg?new Mg({...t._def,type:y4(t.element)}):t instanceof S1?S1.create(y4(t.unwrap())):t instanceof uC?uC.create(y4(t.unwrap())):t instanceof Uj?Uj.create(t.items.map(e=>y4(e))):t}class Sc extends Ji{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),n=ro.objectKeys(e);return this._cached={shape:e,keys:n},this._cached}_parse(e){if(this._getType(e)!==Cs.object){const p=this._getOrReturnCtx(e);return hs(p,{code:On.invalid_type,expected:Cs.object,received:p.parsedType}),Ka}const{status:s,ctx:a}=this._processInputParams(e),{shape:o,keys:l}=this._getCached(),i=[];if(!(this._def.catchall instanceof B1&&this._def.unknownKeys==="strip"))for(const p in a.data)l.includes(p)||i.push(p);const h=[];for(const p of l){const x=o[p],y=a.data[p];h.push({key:{status:"valid",value:p},value:x._parse(new z1(a,y,a.path,p)),alwaysSet:p in a.data})}if(this._def.catchall instanceof B1){const p=this._def.unknownKeys;if(p==="passthrough")for(const x of i)h.push({key:{status:"valid",value:x},value:{status:"valid",value:a.data[x]}});else if(p==="strict")i.length>0&&(hs(a,{code:On.unrecognized_keys,keys:i}),s.dirty());else if(p!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const p=this._def.catchall;for(const x of i){const y=a.data[x];h.push({key:{status:"valid",value:x},value:p._parse(new z1(a,y,a.path,x)),alwaysSet:x in a.data})}}return a.common.async?Promise.resolve().then(async()=>{const p=[];for(const x of h){const y=await x.key,b=await x.value;p.push({key:y,value:b,alwaysSet:x.alwaysSet})}return p}).then(p=>cf.mergeObjectSync(s,p)):cf.mergeObjectSync(s,h)}get shape(){return this._def.shape()}strict(e){return Rs.errToObj,new Sc({...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:Rs.errToObj(e).message??a}:{message:a}}}:{}})}strip(){return new Sc({...this._def,unknownKeys:"strip"})}passthrough(){return new Sc({...this._def,unknownKeys:"passthrough"})}extend(e){return new Sc({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Sc({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:Za.ZodObject})}setKey(e,n){return this.augment({[e]:n})}catchall(e){return new Sc({...this._def,catchall:e})}pick(e){const n={};for(const s of ro.objectKeys(e))e[s]&&this.shape[s]&&(n[s]=this.shape[s]);return new Sc({...this._def,shape:()=>n})}omit(e){const n={};for(const s of ro.objectKeys(this.shape))e[s]||(n[s]=this.shape[s]);return new Sc({...this._def,shape:()=>n})}deepPartial(){return y4(this)}partial(e){const n={};for(const s of ro.objectKeys(this.shape)){const a=this.shape[s];e&&!e[s]?n[s]=a:n[s]=a.optional()}return new Sc({...this._def,shape:()=>n})}required(e){const n={};for(const s of ro.objectKeys(this.shape))if(e&&!e[s])n[s]=this.shape[s];else{let o=this.shape[s];for(;o instanceof S1;)o=o._def.innerType;n[s]=o}return new Sc({...this._def,shape:()=>n})}keyof(){return xLe(ro.objectKeys(this.shape))}}Sc.create=(t,e)=>new Sc({shape:()=>t,unknownKeys:"strip",catchall:B1.create(),typeName:Za.ZodObject,...yi(e)});Sc.strictCreate=(t,e)=>new Sc({shape:()=>t,unknownKeys:"strict",catchall:B1.create(),typeName:Za.ZodObject,...yi(e)});Sc.lazycreate=(t,e)=>new Sc({shape:t,unknownKeys:"strip",catchall:B1.create(),typeName:Za.ZodObject,...yi(e)});class ste extends Ji{_parse(e){const{ctx:n}=this._processInputParams(e),s=this._def.options;function a(o){for(const i of o)if(i.result.status==="valid")return i.result;for(const i of o)if(i.result.status==="dirty")return n.common.issues.push(...i.ctx.common.issues),i.result;const l=o.map(i=>new Ig(i.ctx.common.issues));return hs(n,{code:On.invalid_union,unionErrors:l}),Ka}if(n.common.async)return Promise.all(s.map(async o=>{const l={...n,common:{...n.common,issues:[]},parent:null};return{result:await o._parseAsync({data:n.data,path:n.path,parent:l}),ctx:l}})).then(a);{let o;const l=[];for(const h of s){const p={...n,common:{...n.common,issues:[]},parent:null},x=h._parseSync({data:n.data,path:n.path,parent:p});if(x.status==="valid")return x;x.status==="dirty"&&!o&&(o={result:x,ctx:p}),p.common.issues.length&&l.push(p.common.issues)}if(o)return n.common.issues.push(...o.ctx.common.issues),o.result;const i=l.map(h=>new Ig(h));return hs(n,{code:On.invalid_union,unionErrors:i}),Ka}}get options(){return this._def.options}}ste.create=(t,e)=>new ste({options:t,typeName:Za.ZodUnion,...yi(e)});function dhe(t,e){const n=y0(t),s=y0(e);if(t===e)return{valid:!0,data:t};if(n===Cs.object&&s===Cs.object){const a=ro.objectKeys(e),o=ro.objectKeys(t).filter(i=>a.indexOf(i)!==-1),l={...t,...e};for(const i of o){const h=dhe(t[i],e[i]);if(!h.valid)return{valid:!1};l[i]=h.data}return{valid:!0,data:l}}else if(n===Cs.array&&s===Cs.array){if(t.length!==e.length)return{valid:!1};const a=[];for(let o=0;o{if(yje(o)||yje(l))return Ka;const i=dhe(o.value,l.value);return i.valid?((vje(o)||vje(l))&&n.dirty(),{status:n.value,value:i.data}):(hs(s,{code:On.invalid_intersection_types}),Ka)};return s.common.async?Promise.all([this._def.left._parseAsync({data:s.data,path:s.path,parent:s}),this._def.right._parseAsync({data:s.data,path:s.path,parent:s})]).then(([o,l])=>a(o,l)):a(this._def.left._parseSync({data:s.data,path:s.path,parent:s}),this._def.right._parseSync({data:s.data,path:s.path,parent:s}))}}ate.create=(t,e,n)=>new ate({left:t,right:e,typeName:Za.ZodIntersection,...yi(n)});class Uj extends Ji{_parse(e){const{status:n,ctx:s}=this._processInputParams(e);if(s.parsedType!==Cs.array)return hs(s,{code:On.invalid_type,expected:Cs.array,received:s.parsedType}),Ka;if(s.data.lengththis._def.items.length&&(hs(s,{code:On.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const o=[...s.data].map((l,i)=>{const h=this._def.items[i]||this._def.rest;return h?h._parse(new z1(s,l,s.path,i)):null}).filter(l=>!!l);return s.common.async?Promise.all(o).then(l=>cf.mergeArray(n,l)):cf.mergeArray(n,o)}get items(){return this._def.items}rest(e){return new Uj({...this._def,rest:e})}}Uj.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Uj({items:t,typeName:Za.ZodTuple,rest:null,...yi(e)})};class Cje extends Ji{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:n,ctx:s}=this._processInputParams(e);if(s.parsedType!==Cs.map)return hs(s,{code:On.invalid_type,expected:Cs.map,received:s.parsedType}),Ka;const a=this._def.keyType,o=this._def.valueType,l=[...s.data.entries()].map(([i,h],p)=>({key:a._parse(new z1(s,i,s.path,[p,"key"])),value:o._parse(new z1(s,h,s.path,[p,"value"]))}));if(s.common.async){const i=new Map;return Promise.resolve().then(async()=>{for(const h of l){const p=await h.key,x=await h.value;if(p.status==="aborted"||x.status==="aborted")return Ka;(p.status==="dirty"||x.status==="dirty")&&n.dirty(),i.set(p.value,x.value)}return{status:n.value,value:i}})}else{const i=new Map;for(const h of l){const p=h.key,x=h.value;if(p.status==="aborted"||x.status==="aborted")return Ka;(p.status==="dirty"||x.status==="dirty")&&n.dirty(),i.set(p.value,x.value)}return{status:n.value,value:i}}}}Cje.create=(t,e,n)=>new Cje({valueType:e,keyType:t,typeName:Za.ZodMap,...yi(n)});class sE extends Ji{_parse(e){const{status:n,ctx:s}=this._processInputParams(e);if(s.parsedType!==Cs.set)return hs(s,{code:On.invalid_type,expected:Cs.set,received:s.parsedType}),Ka;const a=this._def;a.minSize!==null&&s.data.sizea.maxSize.value&&(hs(s,{code:On.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),n.dirty());const o=this._def.valueType;function l(h){const p=new Set;for(const x of h){if(x.status==="aborted")return Ka;x.status==="dirty"&&n.dirty(),p.add(x.value)}return{status:n.value,value:p}}const i=[...s.data.values()].map((h,p)=>o._parse(new z1(s,h,s.path,p)));return s.common.async?Promise.all(i).then(h=>l(h)):l(i)}min(e,n){return new sE({...this._def,minSize:{value:e,message:Rs.toString(n)}})}max(e,n){return new sE({...this._def,maxSize:{value:e,message:Rs.toString(n)}})}size(e,n){return this.min(e,n).max(e,n)}nonempty(e){return this.min(1,e)}}sE.create=(t,e)=>new sE({valueType:t,minSize:null,maxSize:null,typeName:Za.ZodSet,...yi(e)});class Mje extends Ji{get schema(){return this._def.getter()}_parse(e){const{ctx:n}=this._processInputParams(e);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}Mje.create=(t,e)=>new Mje({getter:t,typeName:Za.ZodLazy,...yi(e)});class uhe extends Ji{_parse(e){if(e.data!==this._def.value){const n=this._getOrReturnCtx(e);return hs(n,{received:n.data,code:On.invalid_literal,expected:this._def.value}),Ka}return{status:"valid",value:e.data}}get value(){return this._def.value}}uhe.create=(t,e)=>new uhe({value:t,typeName:Za.ZodLiteral,...yi(e)});function xLe(t,e){return new cC({values:t,typeName:Za.ZodEnum,...yi(e)})}class cC extends Ji{_parse(e){if(typeof e.data!="string"){const n=this._getOrReturnCtx(e),s=this._def.values;return hs(n,{expected:ro.joinValues(s),received:n.parsedType,code:On.invalid_type}),Ka}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const n=this._getOrReturnCtx(e),s=this._def.values;return hs(n,{received:n.data,code:On.invalid_enum_value,options:s}),Ka}return ap(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 cC.create(e,{...this._def,...n})}exclude(e,n=this._def){return cC.create(this.options.filter(s=>!e.includes(s)),{...this._def,...n})}}cC.create=xLe;class Tje extends Ji{_parse(e){const n=ro.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(e);if(s.parsedType!==Cs.string&&s.parsedType!==Cs.number){const a=ro.objectValues(n);return hs(s,{expected:ro.joinValues(a),received:s.parsedType,code:On.invalid_type}),Ka}if(this._cache||(this._cache=new Set(ro.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const a=ro.objectValues(n);return hs(s,{received:s.data,code:On.invalid_enum_value,options:a}),Ka}return ap(e.data)}get enum(){return this._def.values}}Tje.create=(t,e)=>new Tje({values:t,typeName:Za.ZodNativeEnum,...yi(e)});class ite extends Ji{unwrap(){return this._def.type}_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==Cs.promise&&n.common.async===!1)return hs(n,{code:On.invalid_type,expected:Cs.promise,received:n.parsedType}),Ka;const s=n.parsedType===Cs.promise?n.data:Promise.resolve(n.data);return ap(s.then(a=>this._def.type.parseAsync(a,{path:n.path,errorMap:n.common.contextualErrorMap})))}}ite.create=(t,e)=>new ite({type:t,typeName:Za.ZodPromise,...yi(e)});class dC extends Ji{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===Za.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:n,ctx:s}=this._processInputParams(e),a=this._def.effect||null,o={addIssue:l=>{hs(s,l),l.fatal?n.abort():n.dirty()},get path(){return s.path}};if(o.addIssue=o.addIssue.bind(o),a.type==="preprocess"){const l=a.transform(s.data,o);if(s.common.async)return Promise.resolve(l).then(async i=>{if(n.value==="aborted")return Ka;const h=await this._def.schema._parseAsync({data:i,path:s.path,parent:s});return h.status==="aborted"?Ka:h.status==="dirty"||n.value==="dirty"?oT(h.value):h});{if(n.value==="aborted")return Ka;const i=this._def.schema._parseSync({data:l,path:s.path,parent:s});return i.status==="aborted"?Ka:i.status==="dirty"||n.value==="dirty"?oT(i.value):i}}if(a.type==="refinement"){const l=i=>{const h=a.refinement(i,o);if(s.common.async)return Promise.resolve(h);if(h instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return i};if(s.common.async===!1){const i=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});return i.status==="aborted"?Ka:(i.status==="dirty"&&n.dirty(),l(i.value),{status:n.value,value:i.value})}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(i=>i.status==="aborted"?Ka:(i.status==="dirty"&&n.dirty(),l(i.value).then(()=>({status:n.value,value:i.value}))))}if(a.type==="transform")if(s.common.async===!1){const l=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(!oC(l))return Ka;const i=a.transform(l.value,o);if(i instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:i}}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(l=>oC(l)?Promise.resolve(a.transform(l.value,o)).then(i=>({status:n.value,value:i})):Ka);ro.assertNever(a)}}dC.create=(t,e,n)=>new dC({schema:t,typeName:Za.ZodEffects,effect:e,...yi(n)});dC.createWithPreprocess=(t,e,n)=>new dC({schema:e,effect:{type:"preprocess",transform:t},typeName:Za.ZodEffects,...yi(n)});class S1 extends Ji{_parse(e){return this._getType(e)===Cs.undefined?ap(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}S1.create=(t,e)=>new S1({innerType:t,typeName:Za.ZodOptional,...yi(e)});class uC extends Ji{_parse(e){return this._getType(e)===Cs.null?ap(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}uC.create=(t,e)=>new uC({innerType:t,typeName:Za.ZodNullable,...yi(e)});class hhe extends Ji{_parse(e){const{ctx:n}=this._processInputParams(e);let s=n.data;return n.parsedType===Cs.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}hhe.create=(t,e)=>new hhe({innerType:t,typeName:Za.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...yi(e)});class fhe extends Ji{_parse(e){const{ctx:n}=this._processInputParams(e),s={...n,common:{...n.common,issues:[]}},a=this._def.innerType._parse({data:s.data,path:s.path,parent:{...s}});return rte(a)?a.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Ig(s.common.issues)},input:s.data})})):{status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new Ig(s.common.issues)},input:s.data})}}removeCatch(){return this._def.innerType}}fhe.create=(t,e)=>new fhe({innerType:t,typeName:Za.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...yi(e)});class Aje extends Ji{_parse(e){if(this._getType(e)!==Cs.nan){const s=this._getOrReturnCtx(e);return hs(s,{code:On.invalid_type,expected:Cs.nan,received:s.parsedType}),Ka}return{status:"valid",value:e.data}}}Aje.create=t=>new Aje({typeName:Za.ZodNaN,...yi(t)});class Uot extends Ji{_parse(e){const{ctx:n}=this._processInputParams(e),s=n.data;return this._def.type._parse({data:s,path:n.path,parent:n})}unwrap(){return this._def.type}}class Dge extends Ji{_parse(e){const{status:n,ctx:s}=this._processInputParams(e);if(s.common.async)return(async()=>{const o=await this._def.in._parseAsync({data:s.data,path:s.path,parent:s});return o.status==="aborted"?Ka:o.status==="dirty"?(n.dirty(),oT(o.value)):this._def.out._parseAsync({data:o.value,path:s.path,parent:s})})();{const a=this._def.in._parseSync({data:s.data,path:s.path,parent:s});return a.status==="aborted"?Ka:a.status==="dirty"?(n.dirty(),{status:"dirty",value:a.value}):this._def.out._parseSync({data:a.value,path:s.path,parent:s})}}static create(e,n){return new Dge({in:e,out:n,typeName:Za.ZodPipeline})}}class phe extends Ji{_parse(e){const n=this._def.innerType._parse(e),s=a=>(oC(a)&&(a.value=Object.freeze(a.value)),a);return rte(n)?n.then(a=>s(a)):s(n)}unwrap(){return this._def.innerType}}phe.create=(t,e)=>new phe({innerType:t,typeName:Za.ZodReadonly,...yi(e)});var Za;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(Za||(Za={}));const ic=W0.create,iA=lC.create,qot=che.create;B1.create;Mg.create;const c3=Sc.create;ste.create;ate.create;Uj.create;const Eje=uhe.create,yLe=cC.create;ite.create;S1.create;uC.create;const Vot="/assets/levelup-logo-horizontal-DEFNc0ms.png",Hot=c3({email:ic().email("Invalid email address"),password:ic().min(6,"Password must be at least 6 characters")}),Wot=()=>{const{signIn:t,user:e}=Qr(),n=rs(),[s,a]=I.useState(!1),[o,l]=I.useState({}),[i,h]=I.useState(""),[p,x]=I.useState(!1),[y,b]=I.useState(!1);I.useEffect(()=>{e&&n("/dashboard")},[e,n]);const j=async N=>{N.preventDefault(),l({}),a(!0);const A=new FormData(N.currentTarget),E=A.get("email"),T=A.get("password");try{Hot.parse({email:E,password:T}),await t(E,T)}catch(L){if(L instanceof Ig){const z={};L.errors.forEach(F=>{F.path[0]&&(z[F.path[0]]=F.message)}),l(z)}}finally{a(!1)}},C=async()=>{if(!i){ze.error("Please enter your email address");return}x(!0);try{const{error:N}=await J.functions.invoke("send-password-reset",{body:{email:i,redirectTo:"https://dashboard.relevelup.com/profile?reset=true"}});if(N)throw N;ze.success("Password reset email sent! Check your inbox."),b(!1),h("")}catch(N){ze.error(N.message||"Failed to send reset email")}finally{x(!1)}};return r.jsxs("div",{className:"min-h-screen relative overflow-hidden",children:[r.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-[#4a6b6d] via-[#3d5a5c] to-[#2a4347]",children:r.jsxs("div",{className:"absolute inset-0 opacity-30",children:[r.jsx("div",{className:"absolute top-0 left-0 w-96 h-96 bg-white/10 rounded-full blur-3xl animate-pulse"}),r.jsx("div",{className:"absolute bottom-0 right-0 w-96 h-96 bg-white/5 rounded-full blur-3xl animate-pulse",style:{animationDelay:"1s"}}),r.jsx("div",{className:"absolute top-1/2 left-1/2 w-64 h-64 bg-white/5 rounded-full blur-3xl animate-pulse",style:{animationDelay:"2s"}})]})}),r.jsxs("div",{className:"relative z-10 flex flex-col min-h-screen",children:[r.jsx("header",{className:"p-6",children:r.jsxs(co,{to:"/",className:"inline-flex items-center gap-2 text-sm text-white/80 hover:text-white transition-colors",children:[r.jsx(so,{className:"h-4 w-4"}),"Back to Home"]})}),r.jsx("div",{className:"flex-1 flex items-center justify-center p-4",children:r.jsxs("div",{className:"w-full max-w-md",children:[r.jsx("div",{className:"flex justify-center mb-8",children:r.jsx("div",{className:"bg-white rounded-xl p-4 shadow-2xl",children:r.jsx("img",{src:Vot,alt:"LevelUp",className:"h-12 w-auto"})})}),r.jsxs(Ye,{className:"border-0 shadow-2xl bg-white/95 backdrop-blur-sm",children:[r.jsxs(Gt,{className:"space-y-1 text-center pb-4",children:[r.jsx(Zt,{className:"text-3xl font-bold text-[#2a4347]",style:{fontFamily:"'Libre Baskerville', serif"},children:"Welcome Back"}),r.jsx(Mn,{className:"text-gray-600",children:"Sign in to access your dashboard"})]}),r.jsx(tt,{children:r.jsxs("form",{onSubmit:j,className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"signin-email",className:"text-gray-700",children:"Email"}),r.jsx(dt,{id:"signin-email",name:"email",type:"email",placeholder:"your@email.com",required:!0,className:"border-gray-300 focus:border-[#4a6b6d] focus:ring-[#4a6b6d]"}),o.email&&r.jsx("p",{className:"text-sm text-red-600",children:o.email})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"signin-password",className:"text-gray-700",children:"Password"}),r.jsx(dt,{id:"signin-password",name:"password",type:"password",required:!0,className:"border-gray-300 focus:border-[#4a6b6d] focus:ring-[#4a6b6d]"}),o.password&&r.jsx("p",{className:"text-sm text-red-600",children:o.password})]}),r.jsx(ee,{type:"submit",className:"w-full bg-[#4a6b6d] hover:bg-[#3d5a5c] text-white font-semibold py-6 text-lg transition-all duration-200 shadow-lg hover:shadow-xl",disabled:s,children:s?"Signing in...":"Sign In"}),r.jsxs(Fr,{open:y,onOpenChange:b,children:[r.jsx(zo,{asChild:!0,children:r.jsx(ee,{variant:"link",className:"w-full text-sm text-[#4a6b6d] hover:text-[#3d5a5c]",children:"Forgot password?"})}),r.jsxs(Rr,{className:"bg-white",children:[r.jsxs(qr,{children:[r.jsx($r,{className:"text-[#2a4347]",style:{fontFamily:"'Libre Baskerville', serif"},children:"Reset Password"}),r.jsx(Xn,{className:"text-gray-600",children:"Enter your email address and we'll send you a link to reset your password."})]}),r.jsxs("div",{className:"space-y-4 pt-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"reset-email",className:"text-gray-700",children:"Email"}),r.jsx(dt,{id:"reset-email",type:"email",placeholder:"your@email.com",value:i,onChange:N=>h(N.target.value),className:"border-gray-300 focus:border-[#4a6b6d] focus:ring-[#4a6b6d]"})]}),r.jsx(ee,{onClick:C,className:"w-full bg-[#4a6b6d] hover:bg-[#3d5a5c] text-white",disabled:p,children:p?"Sending...":"Send Reset Link"})]})]})]})]})})]}),r.jsxs("p",{className:"text-center text-white/70 text-sm mt-6",children:["Don't have an account?"," ",r.jsx(co,{to:"/",className:"text-white hover:underline font-medium",children:"View Plans"})]})]})})]})]})},Got=()=>{const[t]=$d(),e=t.get("tier"),n=e==null?void 0:e.includes("brokerage");return r.jsx("div",{className:"min-h-screen bg-gradient-to-br from-background via-primary/5 to-secondary/10 flex items-center justify-center p-4",children:r.jsxs(Ye,{className:"max-w-lg w-full",children:[r.jsxs(Gt,{className:"text-center",children:[r.jsx("div",{className:"mx-auto w-16 h-16 rounded-full bg-green-500/10 flex items-center justify-center mb-4",children:r.jsx(Yi,{className:"w-10 h-10 text-green-500"})}),r.jsx(Zt,{className:"text-2xl",children:"Welcome to LevelUp!"}),r.jsx(Mn,{className:"text-lg",children:"Your subscription has been activated successfully."})]}),r.jsxs(tt,{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(da,{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."})})]})]})})},vLe=t=>{const[e,n]=I.useState(null),[s,a]=I.useState(!0);return I.useEffect(()=>{if(!t){a(!1);return}(async()=>{try{const{data:i}=await J.storage.from("avatars").list(`${t}`);if(i&&i.length>0){const{data:h}=J.storage.from("avatars").getPublicUrl(`${t}/${i[0].name}`);n(`${h.publicUrl}?t=${Date.now()}`)}else n(null)}catch(i){console.error("Error fetching avatar:",i),n(null)}finally{a(!1)}})()},[t]),{avatarUrl:e,loading:s,refreshAvatar:async()=>{if(t)try{const{data:l}=await J.storage.from("avatars").list(`${t}`);if(l&&l.length>0){const{data:i}=J.storage.from("avatars").getPublicUrl(`${t}/${l[0].name}`);n(`${i.publicUrl}?t=${Date.now()}`)}}catch(l){console.error("Error refreshing avatar:",l)}}}},_Le=async t=>{const e=new Map;return await Promise.all(t.map(async n=>{try{const{data:s}=await J.storage.from("avatars").list(`${n}`);if(s&&s.length>0){const{data:a}=J.storage.from("avatars").getPublicUrl(`${n}/${s[0].name}`);e.set(n,a.publicUrl)}}catch{}})),e},Kot=t=>{const[e,n]=I.useState({isTrial:!1,isExpired:!1,expiresAt:null,daysLeft:null,loading:!0});return I.useEffect(()=>{if(!t){n(a=>({...a,loading:!1}));return}(async()=>{try{const{data:a,error:o}=await J.from("profiles").select("is_trial, trial_expires_at, subscription_status, subscription_end_date").eq("id",t).single();if(o){console.error("Error fetching trial status:",o),n(h=>({...h,loading:!1}));return}const l=(a==null?void 0:a.subscription_status)==="trialing"&&(a==null?void 0:a.subscription_end_date),i=(a==null?void 0:a.is_trial)&&(a==null?void 0:a.trial_expires_at);if(l){const h=new Date().getTime(),p=new Date(a.subscription_end_date).getTime(),x=Math.ceil((p-h)/(1e3*60*60*24)),y=x<=0;n({isTrial:!0,isExpired:y,expiresAt:a.subscription_end_date,daysLeft:y?0:x,loading:!1})}else if(i){const h=new Date().getTime(),p=new Date(a.trial_expires_at).getTime(),x=Math.ceil((p-h)/(1e3*60*60*24)),y=x<=0;n({isTrial:!0,isExpired:y,expiresAt:a.trial_expires_at,daysLeft:y?0:x,loading:!1})}else n({isTrial:!1,isExpired:!1,expiresAt:null,daysLeft:null,loading:!1})}catch(a){console.error("Error in useTrialStatus:",a),n(o=>({...o,loading:!1}))}})()},[t]),e},bLe=()=>{const{data:t,isLoading:e}=Yt({queryKey:["feature-flags"],queryFn:async()=>{const{data:s,error:a}=await J.from("feature_flags").select("*");if(a)throw a;return s}}),n=s=>{if(!t)return!1;const a=t.find(o=>o.key===s);return(a==null?void 0:a.enabled)??!1};return{flags:t,isLoading:e,isFeatureEnabled:n,isAgentOSEnabled:n("agent_os_enabled"),isInnerCircleEnabled:n("innercircle_enabled"),isMarketplaceEnabled:n("marketplace")}},Ije="community_last_seen_post_at";function Zot(){const{user:t}=Qr(),e=jm(),[n,s]=I.useState(0),[a,o]=I.useState(null);I.useEffect(()=>{if(!t)return;const i=localStorage.getItem(`${Ije}_${t.id}`);o(i)},[t]),I.useEffect(()=>{if(!t)return;(async()=>{let h=J.from("community_posts").select("id",{count:"exact",head:!0});a&&(h=h.gt("created_at",a));const{data:p}=await J.from("profiles").select("brokerage_id").eq("id",t.id).single(),{count:x,error:y}=await h;!y&&x!==null&&s(x)})()},[t,a]),I.useEffect(()=>{if(!t)return;const i=J.channel("community-new-posts").on("postgres_changes",{event:"INSERT",schema:"public",table:"community_posts"},async h=>{const p=h.new;if(p.user_id===t.id)return;const x=e.pathname==="/community";x||s(C=>C+1);const{data:y}=await J.from("profiles").select("name").eq("id",p.user_id).single(),b=(y==null?void 0:y.name)||"Someone",j=p.content.length>50?p.content.substring(0,50)+"...":p.content;x||ze("New Community Post",{description:`${b}: ${j}`,action:{label:"View",onClick:()=>{window.location.href="/community"}}})}).subscribe();return()=>{J.removeChannel(i)}},[t,e.pathname]);const l=I.useCallback(()=>{if(!t)return;const i=new Date().toISOString();localStorage.setItem(`${Ije}_${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 Yot(){const{isAdmin:t}=Qr(),{data:e=0}=Yt({queryKey:["wishlist-open-count"],queryFn:async()=>{const{count:n,error:s}=await J.from("wishlist_items").select("*",{count:"exact",head:!0}).eq("status","open");if(s)throw s;return n||0},enabled:t,staleTime:6e4});return{openCount:t?e:0}}const Jne=qne,Rge=Ige,Xot=Vne,wLe=I.forwardRef(({className:t,...e},n)=>r.jsx(i3,{className:$t("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}));wLe.displayName=i3.displayName;const Qot=KC("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"}}),NI=I.forwardRef(({side:t="right",className:e,children:n,...s},a)=>r.jsxs(Xot,{children:[r.jsx(wLe,{}),r.jsxs(o3,{ref:a,className:$t(Qot({side:t}),e),...s,children:[n,r.jsxs(Hne,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity data-[state=open]:bg-secondary hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none",children:[r.jsx(_s,{className:"h-4 w-4"}),r.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));NI.displayName=o3.displayName;const ese=({className:t,...e})=>r.jsx("div",{className:$t("flex flex-col space-y-2 text-center sm:text-left",t),...e});ese.displayName="SheetHeader";const tse=I.forwardRef(({className:t,...e},n)=>r.jsx(wI,{ref:n,className:$t("text-lg font-semibold text-foreground",t),...e}));tse.displayName=wI.displayName;const Jot=I.forwardRef(({className:t,...e},n)=>r.jsx(jI,{ref:n,className:$t("text-sm text-muted-foreground",t),...e}));Jot.displayName=jI.displayName;function elt(t,e){return I.useReducer((n,s)=>e[n][s]??n,t)}var Fge="ScrollArea",[jLe]=tc(Fge),[tlt,ip]=jLe(Fge),kLe=I.forwardRef((t,e)=>{const{__scopeScrollArea:n,type:s="hover",dir:a,scrollHideDelay:o=600,...l}=t,[i,h]=I.useState(null),[p,x]=I.useState(null),[y,b]=I.useState(null),[j,C]=I.useState(null),[N,A]=I.useState(null),[E,T]=I.useState(0),[L,z]=I.useState(0),[F,q]=I.useState(!1),[H,Z]=I.useState(!1),G=ta(e,ie=>h(ie)),te=ik(a);return r.jsx(tlt,{scope:n,type:s,dir:te,scrollHideDelay:o,scrollArea:i,viewport:p,onViewportChange:x,content:y,onContentChange:b,scrollbarX:j,onScrollbarXChange:C,scrollbarXEnabled:F,onScrollbarXEnabledChange:q,scrollbarY:N,onScrollbarYChange:A,scrollbarYEnabled:H,onScrollbarYEnabledChange:Z,onCornerWidthChange:T,onCornerHeightChange:z,children:r.jsx(Rn.div,{dir:te,...l,ref:G,style:{position:"relative","--radix-scroll-area-corner-width":E+"px","--radix-scroll-area-corner-height":L+"px",...t.style}})})});kLe.displayName=Fge;var NLe="ScrollAreaViewport",SLe=I.forwardRef((t,e)=>{const{__scopeScrollArea:n,children:s,nonce:a,...o}=t,l=ip(NLe,n),i=I.useRef(null),h=ta(e,i,l.onViewportChange);return r.jsxs(r.Fragment,{children:[r.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:a}),r.jsx(Rn.div,{"data-radix-scroll-area-viewport":"",...o,ref:h,style:{overflowX:l.scrollbarXEnabled?"scroll":"hidden",overflowY:l.scrollbarYEnabled?"scroll":"hidden",...t.style},children:r.jsx("div",{ref:l.onContentChange,style:{minWidth:"100%",display:"table"},children:s})})]})});SLe.displayName=NLe;var Bg="ScrollAreaScrollbar",zge=I.forwardRef((t,e)=>{const{forceMount:n,...s}=t,a=ip(Bg,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(rlt,{...s,ref:e,forceMount:n}):a.type==="scroll"?r.jsx(nlt,{...s,ref:e,forceMount:n}):a.type==="auto"?r.jsx(CLe,{...s,ref:e,forceMount:n}):a.type==="always"?r.jsx(Bge,{...s,ref:e}):null});zge.displayName=Bg;var rlt=I.forwardRef((t,e)=>{const{forceMount:n,...s}=t,a=ip(Bg,t.__scopeScrollArea),[o,l]=I.useState(!1);return I.useEffect(()=>{const i=a.scrollArea;let h=0;if(i){const p=()=>{window.clearTimeout(h),l(!0)},x=()=>{h=window.setTimeout(()=>l(!1),a.scrollHideDelay)};return i.addEventListener("pointerenter",p),i.addEventListener("pointerleave",x),()=>{window.clearTimeout(h),i.removeEventListener("pointerenter",p),i.removeEventListener("pointerleave",x)}}},[a.scrollArea,a.scrollHideDelay]),r.jsx(gc,{present:n||o,children:r.jsx(CLe,{"data-state":o?"visible":"hidden",...s,ref:e})})}),nlt=I.forwardRef((t,e)=>{const{forceMount:n,...s}=t,a=ip(Bg,t.__scopeScrollArea),o=t.orientation==="horizontal",l=nse(()=>h("SCROLL_END"),100),[i,h]=elt("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return I.useEffect(()=>{if(i==="idle"){const p=window.setTimeout(()=>h("HIDE"),a.scrollHideDelay);return()=>window.clearTimeout(p)}},[i,a.scrollHideDelay,h]),I.useEffect(()=>{const p=a.viewport,x=o?"scrollLeft":"scrollTop";if(p){let y=p[x];const b=()=>{const j=p[x];y!==j&&(h("SCROLL"),l()),y=j};return p.addEventListener("scroll",b),()=>p.removeEventListener("scroll",b)}},[a.viewport,o,h,l]),r.jsx(gc,{present:n||i!=="hidden",children:r.jsx(Bge,{"data-state":i==="hidden"?"hidden":"visible",...s,ref:e,onPointerEnter:an(t.onPointerEnter,()=>h("POINTER_ENTER")),onPointerLeave:an(t.onPointerLeave,()=>h("POINTER_LEAVE"))})})}),CLe=I.forwardRef((t,e)=>{const n=ip(Bg,t.__scopeScrollArea),{forceMount:s,...a}=t,[o,l]=I.useState(!1),i=t.orientation==="horizontal",h=nse(()=>{if(n.viewport){const p=n.viewport.offsetWidth{const{orientation:n="vertical",...s}=t,a=ip(Bg,t.__scopeScrollArea),o=I.useRef(null),l=I.useRef(0),[i,h]=I.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),p=ILe(i.viewport,i.content),x={...s,sizes:i,onSizesChange:h,hasThumb:p>0&&p<1,onThumbChange:b=>o.current=b,onThumbPointerUp:()=>l.current=0,onThumbPointerDown:b=>l.current=b};function y(b,j){return clt(b,l.current,i,j)}return n==="horizontal"?r.jsx(slt,{...x,ref:e,onThumbPositionChange:()=>{if(a.viewport&&o.current){const b=a.viewport.scrollLeft,j=Pje(b,i,a.dir);o.current.style.transform=`translate3d(${j}px, 0, 0)`}},onWheelScroll:b=>{a.viewport&&(a.viewport.scrollLeft=b)},onDragScroll:b=>{a.viewport&&(a.viewport.scrollLeft=y(b,a.dir))}}):n==="vertical"?r.jsx(alt,{...x,ref:e,onThumbPositionChange:()=>{if(a.viewport&&o.current){const b=a.viewport.scrollTop,j=Pje(b,i);o.current.style.transform=`translate3d(0, ${j}px, 0)`}},onWheelScroll:b=>{a.viewport&&(a.viewport.scrollTop=b)},onDragScroll:b=>{a.viewport&&(a.viewport.scrollTop=y(b))}}):null}),slt=I.forwardRef((t,e)=>{const{sizes:n,onSizesChange:s,...a}=t,o=ip(Bg,t.__scopeScrollArea),[l,i]=I.useState(),h=I.useRef(null),p=ta(e,h,o.onScrollbarXChange);return I.useEffect(()=>{h.current&&i(getComputedStyle(h.current))},[h]),r.jsx(TLe,{"data-orientation":"horizontal",...a,ref:p,sizes:n,style:{bottom:0,left:o.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:o.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":rse(n)+"px",...t.style},onThumbPointerDown:x=>t.onThumbPointerDown(x.x),onDragScroll:x=>t.onDragScroll(x.x),onWheelScroll:(x,y)=>{if(o.viewport){const b=o.viewport.scrollLeft+x.deltaX;t.onWheelScroll(b),LLe(b,y)&&x.preventDefault()}},onResize:()=>{h.current&&o.viewport&&l&&s({content:o.viewport.scrollWidth,viewport:o.viewport.offsetWidth,scrollbar:{size:h.current.clientWidth,paddingStart:lte(l.paddingLeft),paddingEnd:lte(l.paddingRight)}})}})}),alt=I.forwardRef((t,e)=>{const{sizes:n,onSizesChange:s,...a}=t,o=ip(Bg,t.__scopeScrollArea),[l,i]=I.useState(),h=I.useRef(null),p=ta(e,h,o.onScrollbarYChange);return I.useEffect(()=>{h.current&&i(getComputedStyle(h.current))},[h]),r.jsx(TLe,{"data-orientation":"vertical",...a,ref:p,sizes:n,style:{top:0,right:o.dir==="ltr"?0:void 0,left:o.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":rse(n)+"px",...t.style},onThumbPointerDown:x=>t.onThumbPointerDown(x.y),onDragScroll:x=>t.onDragScroll(x.y),onWheelScroll:(x,y)=>{if(o.viewport){const b=o.viewport.scrollTop+x.deltaY;t.onWheelScroll(b),LLe(b,y)&&x.preventDefault()}},onResize:()=>{h.current&&o.viewport&&l&&s({content:o.viewport.scrollHeight,viewport:o.viewport.offsetHeight,scrollbar:{size:h.current.clientHeight,paddingStart:lte(l.paddingTop),paddingEnd:lte(l.paddingBottom)}})}})}),[ilt,MLe]=jLe(Bg),TLe=I.forwardRef((t,e)=>{const{__scopeScrollArea:n,sizes:s,hasThumb:a,onThumbChange:o,onThumbPointerUp:l,onThumbPointerDown:i,onThumbPositionChange:h,onDragScroll:p,onWheelScroll:x,onResize:y,...b}=t,j=ip(Bg,n),[C,N]=I.useState(null),A=ta(e,G=>N(G)),E=I.useRef(null),T=I.useRef(""),L=j.viewport,z=s.content-s.viewport,F=Xl(x),q=Xl(h),H=nse(y,10);function Z(G){if(E.current){const te=G.clientX-E.current.left,ie=G.clientY-E.current.top;p({x:te,y:ie})}}return I.useEffect(()=>{const G=te=>{const ie=te.target;(C==null?void 0:C.contains(ie))&&F(te,z)};return document.addEventListener("wheel",G,{passive:!1}),()=>document.removeEventListener("wheel",G,{passive:!1})},[L,C,z,F]),I.useEffect(q,[s,q]),hC(C,H),hC(j.content,H),r.jsx(ilt,{scope:n,scrollbar:C,hasThumb:a,onThumbChange:Xl(o),onThumbPointerUp:Xl(l),onThumbPositionChange:q,onThumbPointerDown:Xl(i),children:r.jsx(Rn.div,{...b,ref:A,style:{position:"absolute",...b.style},onPointerDown:an(t.onPointerDown,G=>{G.button===0&&(G.target.setPointerCapture(G.pointerId),E.current=C.getBoundingClientRect(),T.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",j.viewport&&(j.viewport.style.scrollBehavior="auto"),Z(G))}),onPointerMove:an(t.onPointerMove,Z),onPointerUp:an(t.onPointerUp,G=>{const te=G.target;te.hasPointerCapture(G.pointerId)&&te.releasePointerCapture(G.pointerId),document.body.style.webkitUserSelect=T.current,j.viewport&&(j.viewport.style.scrollBehavior=""),E.current=null})})})}),ote="ScrollAreaThumb",ALe=I.forwardRef((t,e)=>{const{forceMount:n,...s}=t,a=MLe(ote,t.__scopeScrollArea);return r.jsx(gc,{present:n||a.hasThumb,children:r.jsx(olt,{ref:e,...s})})}),olt=I.forwardRef((t,e)=>{const{__scopeScrollArea:n,style:s,...a}=t,o=ip(ote,n),l=MLe(ote,n),{onThumbPositionChange:i}=l,h=ta(e,y=>l.onThumbChange(y)),p=I.useRef(void 0),x=nse(()=>{p.current&&(p.current(),p.current=void 0)},100);return I.useEffect(()=>{const y=o.viewport;if(y){const b=()=>{if(x(),!p.current){const j=dlt(y,i);p.current=j,i()}};return i(),y.addEventListener("scroll",b),()=>y.removeEventListener("scroll",b)}},[o.viewport,x,i]),r.jsx(Rn.div,{"data-state":l.hasThumb?"visible":"hidden",...a,ref:h,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...s},onPointerDownCapture:an(t.onPointerDownCapture,y=>{const j=y.target.getBoundingClientRect(),C=y.clientX-j.left,N=y.clientY-j.top;l.onThumbPointerDown({x:C,y:N})}),onPointerUp:an(t.onPointerUp,l.onThumbPointerUp)})});ALe.displayName=ote;var $ge="ScrollAreaCorner",ELe=I.forwardRef((t,e)=>{const n=ip($ge,t.__scopeScrollArea),s=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&s?r.jsx(llt,{...t,ref:e}):null});ELe.displayName=$ge;var llt=I.forwardRef((t,e)=>{const{__scopeScrollArea:n,...s}=t,a=ip($ge,n),[o,l]=I.useState(0),[i,h]=I.useState(0),p=!!(o&&i);return hC(a.scrollbarX,()=>{var y;const x=((y=a.scrollbarX)==null?void 0:y.offsetHeight)||0;a.onCornerHeightChange(x),h(x)}),hC(a.scrollbarY,()=>{var y;const x=((y=a.scrollbarY)==null?void 0:y.offsetWidth)||0;a.onCornerWidthChange(x),l(x)}),p?r.jsx(Rn.div,{...s,ref:e,style:{width:o,height:i,position:"absolute",right:a.dir==="ltr"?0:void 0,left:a.dir==="rtl"?0:void 0,bottom:0,...t.style}}):null});function lte(t){return t?parseInt(t,10):0}function ILe(t,e){const n=t/e;return isNaN(n)?0:n}function rse(t){const e=ILe(t.viewport,t.content),n=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,s=(t.scrollbar.size-n)*e;return Math.max(s,18)}function clt(t,e,n,s="ltr"){const a=rse(n),o=a/2,l=e||o,i=a-l,h=n.scrollbar.paddingStart+l,p=n.scrollbar.size-n.scrollbar.paddingEnd-i,x=n.content-n.viewport,y=s==="ltr"?[0,x]:[x*-1,0];return PLe([h,p],y)(t)}function Pje(t,e,n="ltr"){const s=rse(e),a=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,o=e.scrollbar.size-a,l=e.content-e.viewport,i=o-s,h=n==="ltr"?[0,l]:[l*-1,0],p=rE(t,h);return PLe([0,l],[0,i])(p)}function PLe(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 LLe(t,e){return t>0&&t{})=>{let n={left:t.scrollLeft,top:t.scrollTop},s=0;return function a(){const o={left:t.scrollLeft,top:t.scrollTop},l=n.left!==o.left,i=n.top!==o.top;(l||i)&&e(),n=o,s=window.requestAnimationFrame(a)}(),()=>window.cancelAnimationFrame(s)};function nse(t,e){const n=Xl(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 hC(t,e){const n=Xl(e);Jl(()=>{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 OLe=kLe,ult=SLe,hlt=ELe;const Jo=I.forwardRef(({className:t,children:e,...n},s)=>r.jsxs(OLe,{ref:s,className:$t("relative overflow-hidden",t),...n,children:[r.jsx(ult,{className:"h-full w-full rounded-[inherit]",children:e}),r.jsx(Uge,{}),r.jsx(hlt,{})]}));Jo.displayName=OLe.displayName;const Uge=I.forwardRef(({className:t,orientation:e="vertical",...n},s)=>r.jsx(zge,{ref:s,orientation:e,className:$t("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(ALe,{className:"relative flex-1 rounded-full bg-border"})}));Uge.displayName=zge.displayName;var sse="Collapsible",[flt]=tc(sse),[plt,qge]=flt(sse),DLe=I.forwardRef((t,e)=>{const{__scopeCollapsible:n,open:s,defaultOpen:a,disabled:o,onOpenChange:l,...i}=t,[h,p]=Fu({prop:s,defaultProp:a??!1,onChange:l,caller:sse});return r.jsx(plt,{scope:n,disabled:o,contentId:Gc(),open:h,onOpenToggle:I.useCallback(()=>p(x=>!x),[p]),children:r.jsx(Rn.div,{"data-state":Hge(h),"data-disabled":o?"":void 0,...i,ref:e})})});DLe.displayName=sse;var RLe="CollapsibleTrigger",FLe=I.forwardRef((t,e)=>{const{__scopeCollapsible:n,...s}=t,a=qge(RLe,n);return r.jsx(Rn.button,{type:"button","aria-controls":a.contentId,"aria-expanded":a.open||!1,"data-state":Hge(a.open),"data-disabled":a.disabled?"":void 0,disabled:a.disabled,...s,ref:e,onClick:an(t.onClick,a.onOpenToggle)})});FLe.displayName=RLe;var Vge="CollapsibleContent",zLe=I.forwardRef((t,e)=>{const{forceMount:n,...s}=t,a=qge(Vge,t.__scopeCollapsible);return r.jsx(gc,{present:n||a.open,children:({present:o})=>r.jsx(mlt,{...s,ref:e,present:o})})});zLe.displayName=Vge;var mlt=I.forwardRef((t,e)=>{const{__scopeCollapsible:n,present:s,children:a,...o}=t,l=qge(Vge,n),[i,h]=I.useState(s),p=I.useRef(null),x=ta(e,p),y=I.useRef(0),b=y.current,j=I.useRef(0),C=j.current,N=l.open||i,A=I.useRef(N),E=I.useRef(void 0);return I.useEffect(()=>{const T=requestAnimationFrame(()=>A.current=!1);return()=>cancelAnimationFrame(T)},[]),Jl(()=>{const T=p.current;if(T){E.current=E.current||{transitionDuration:T.style.transitionDuration,animationName:T.style.animationName},T.style.transitionDuration="0s",T.style.animationName="none";const L=T.getBoundingClientRect();y.current=L.height,j.current=L.width,A.current||(T.style.transitionDuration=E.current.transitionDuration,T.style.animationName=E.current.animationName),h(s)}},[l.open,s]),r.jsx(Rn.div,{"data-state":Hge(l.open),"data-disabled":l.disabled?"":void 0,id:l.contentId,hidden:!N,...o,ref:x,style:{"--radix-collapsible-content-height":b?`${b}px`:void 0,"--radix-collapsible-content-width":C?`${C}px`:void 0,...t.style},children:N&&a})});function Hge(t){return t?"open":"closed"}var glt=DLe;const kS=glt,NS=FLe,SS=zLe,Lje="/assets/levelup-logo-Eif24dqY.png",xlt="/assets/levelup-logo-icon-C-7iromj.png";var SI=t=>t.type==="checkbox",zw=t=>t instanceof Date,Au=t=>t==null;const BLe=t=>typeof t=="object";var mc=t=>!Au(t)&&!Array.isArray(t)&&BLe(t)&&!zw(t),$Le=t=>mc(t)&&t.target?SI(t.target)?t.target.checked:t.target.value:t,ylt=t=>t.substring(0,t.search(/\.\d+(\.|$)/))||t,ULe=(t,e)=>t.has(ylt(e)),vlt=t=>{const e=t.constructor&&t.constructor.prototype;return mc(e)&&e.hasOwnProperty("isPrototypeOf")},Wge=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function Bc(t){let e;const n=Array.isArray(t),s=typeof FileList<"u"?t instanceof FileList:!1;if(t instanceof Date)e=new Date(t);else if(!(Wge&&(t instanceof Blob||s))&&(n||mc(t)))if(e=n?[]:{},!n&&!vlt(t))e=t;else for(const a in t)t.hasOwnProperty(a)&&(e[a]=Bc(t[a]));else return t;return e}var ase=t=>/^\w*$/.test(t),oc=t=>t===void 0,Gge=t=>Array.isArray(t)?t.filter(Boolean):[],Kge=t=>Gge(t.replace(/["|']|\]/g,"").split(/\.|\[/)),Kn=(t,e,n)=>{if(!e||!mc(t))return n;const s=(ase(e)?[e]:Kge(e)).reduce((a,o)=>Au(a)?a:a[o],t);return oc(s)||s===t?oc(t[e])?n:t[e]:s},qh=t=>typeof t=="boolean",wo=(t,e,n)=>{let s=-1;const a=ase(e)?[e]:Kge(e),o=a.length,l=o-1;for(;++sst.useContext(Zge),_lt=t=>{const{children:e,...n}=t;return st.createElement(Zge.Provider,{value:n},e)};var qLe=(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]!==tm.all&&(e._proxyFormState[l]=!s||tm.all),n&&(n[l]=!0),t[l]}});return a};const Yge=typeof window<"u"?st.useLayoutEffect:st.useEffect;function blt(t){const e=ise(),{control:n=e.control,disabled:s,name:a,exact:o}=t||{},[l,i]=st.useState(n._formState),h=st.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return Yge(()=>n._subscribe({name:a,formState:h.current,exact:o,callback:p=>{!s&&i({...n._formState,...p})}}),[a,s,o]),st.useEffect(()=>{h.current.isValid&&n._setValid(!0)},[n]),st.useMemo(()=>qLe(l,n,h.current,!1),[l,n])}var cg=t=>typeof t=="string",VLe=(t,e,n,s,a)=>cg(t)?(s&&e.watch.add(t),Kn(n,t,a)):Array.isArray(t)?t.map(o=>(s&&e.watch.add(o),Kn(n,o))):(s&&(e.watchAll=!0),n),mhe=t=>Au(t)||!BLe(t);function Tx(t,e,n=new WeakSet){if(mhe(t)||mhe(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)||mc(l)&&mc(i)||Array.isArray(l)&&Array.isArray(i)?!Tx(l,i,n):l!==i)return!1}}return!0}function wlt(t){const e=ise(),{control:n=e.control,name:s,defaultValue:a,disabled:o,exact:l,compute:i}=t||{},h=st.useRef(a),p=st.useRef(i),x=st.useRef(void 0);p.current=i;const y=st.useMemo(()=>n._getWatch(s,h.current),[n,s]),[b,j]=st.useState(p.current?p.current(y):y);return Yge(()=>n._subscribe({name:s,formState:{values:!0},exact:l,callback:C=>{if(!o){const N=VLe(s,n._names,C.values||n._formValues,!1,h.current);if(p.current){const A=p.current(N);Tx(A,x.current)||(j(A),x.current=A)}else j(N)}}}),[n,o,s,l]),st.useEffect(()=>n._removeUnmounted()),b}function jlt(t){const e=ise(),{name:n,disabled:s,control:a=e.control,shouldUnregister:o,defaultValue:l}=t,i=ULe(a._names.array,n),h=st.useMemo(()=>Kn(a._formValues,n,Kn(a._defaultValues,n,l)),[a,n,l]),p=wlt({control:a,name:n,defaultValue:h,exact:!0}),x=blt({control:a,name:n,exact:!0}),y=st.useRef(t),b=st.useRef(a.register(n,{...t.rules,value:p,...qh(t.disabled)?{disabled:t.disabled}:{}}));y.current=t;const j=st.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!Kn(x.errors,n)},isDirty:{enumerable:!0,get:()=>!!Kn(x.dirtyFields,n)},isTouched:{enumerable:!0,get:()=>!!Kn(x.touchedFields,n)},isValidating:{enumerable:!0,get:()=>!!Kn(x.validatingFields,n)},error:{enumerable:!0,get:()=>Kn(x.errors,n)}}),[x,n]),C=st.useCallback(T=>b.current.onChange({target:{value:$Le(T),name:n},type:cte.CHANGE}),[n]),N=st.useCallback(()=>b.current.onBlur({target:{value:Kn(a._formValues,n),name:n},type:cte.BLUR}),[n,a._formValues]),A=st.useCallback(T=>{const L=Kn(a._fields,n);L&&T&&(L._f.ref={focus:()=>T.focus&&T.focus(),select:()=>T.select&&T.select(),setCustomValidity:z=>T.setCustomValidity(z),reportValidity:()=>T.reportValidity()})},[a._fields,n]),E=st.useMemo(()=>({name:n,value:p,...qh(s)||x.disabled?{disabled:x.disabled||s}:{},onChange:C,onBlur:N,ref:A}),[n,s,x.disabled,C,N,A,p]);return st.useEffect(()=>{const T=a._options.shouldUnregister||o;a.register(n,{...y.current.rules,...qh(y.current.disabled)?{disabled:y.current.disabled}:{}});const L=(z,F)=>{const q=Kn(a._fields,z);q&&q._f&&(q._f.mount=F)};if(L(n,!0),T){const z=Bc(Kn(a._options.defaultValues,n));wo(a._defaultValues,n,z),oc(Kn(a._formValues,n))&&wo(a._formValues,n,z)}return!i&&a.register(n),()=>{(i?T&&!a._state.action:T)?a.unregister(n):L(n,!1)}},[n,a,i,o]),st.useEffect(()=>{a._setDisabledField({disabled:s,name:n})},[s,n,a]),st.useMemo(()=>({field:E,formState:x,fieldState:j}),[E,x,j])}const klt=t=>t.render(jlt(t));var HLe=(t,e,n,s,a)=>e?{...n[t],types:{...n[t]&&n[t].types?n[t].types:{},[s]:a||!0}}:{},oA=t=>Array.isArray(t)?t:[t],Oje=()=>{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=[]}}},oh=t=>mc(t)&&!Object.keys(t).length,Xge=t=>t.type==="file",rm=t=>typeof t=="function",dte=t=>{if(!Wge)return!1;const e=t?t.ownerDocument:0;return t instanceof(e&&e.defaultView?e.defaultView.HTMLElement:HTMLElement)},WLe=t=>t.type==="select-multiple",Qge=t=>t.type==="radio",Nlt=t=>Qge(t)||SI(t),qle=t=>dte(t)&&t.isConnected;function Slt(t,e){const n=e.slice(0,-1).length;let s=0;for(;s{for(const e in t)if(rm(t[e]))return!0;return!1};function ute(t,e={}){const n=Array.isArray(t);if(mc(t)||n)for(const s in t)Array.isArray(t[s])||mc(t[s])&&!GLe(t[s])?(e[s]=Array.isArray(t[s])?[]:{},ute(t[s],e[s])):Au(t[s])||(e[s]=!0);return e}function KLe(t,e,n){const s=Array.isArray(t);if(mc(t)||s)for(const a in t)Array.isArray(t[a])||mc(t[a])&&!GLe(t[a])?oc(e)||mhe(n[a])?n[a]=Array.isArray(t[a])?ute(t[a],[]):{...ute(t[a])}:KLe(t[a],Au(e)?{}:e[a],n[a]):n[a]=!Tx(t[a],e[a]);return n}var IM=(t,e)=>KLe(t,e,ute(e));const Dje={value:!1,isValid:!1},Rje={value:!0,isValid:!0};var ZLe=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&&!oc(t[0].attributes.value)?oc(t[0].value)||t[0].value===""?Rje:{value:t[0].value,isValid:!0}:Rje:Dje}return Dje},YLe=(t,{valueAsNumber:e,valueAsDate:n,setValueAs:s})=>oc(t)?t:e?t===""?NaN:t&&+t:n&&cg(t)?new Date(t):s?s(t):t;const Fje={isValid:!1,value:null};var XLe=t=>Array.isArray(t)?t.reduce((e,n)=>n&&n.checked&&!n.disabled?{isValid:!0,value:n.value}:e,Fje):Fje;function zje(t){const e=t.ref;return Xge(e)?e.files:Qge(e)?XLe(t.refs).value:WLe(e)?[...e.selectedOptions].map(({value:n})=>n):SI(e)?ZLe(t.refs).value:YLe(oc(e.value)?t.ref.value:e.value,t)}var Mlt=(t,e,n,s)=>{const a={};for(const o of t){const l=Kn(e,o);l&&wo(a,o,l._f)}return{criteriaMode:n,names:[...t],fields:a,shouldUseNativeValidation:s}},hte=t=>t instanceof RegExp,PM=t=>oc(t)?t:hte(t)?t.source:mc(t)?hte(t.value)?t.value.source:t.value:t,Bje=t=>({isOnSubmit:!t||t===tm.onSubmit,isOnBlur:t===tm.onBlur,isOnChange:t===tm.onChange,isOnAll:t===tm.all,isOnTouch:t===tm.onTouched});const $je="AsyncFunction";var Tlt=t=>!!t&&!!t.validate&&!!(rm(t.validate)&&t.validate.constructor.name===$je||mc(t.validate)&&Object.values(t.validate).find(e=>e.constructor.name===$je)),Alt=t=>t.mount&&(t.required||t.min||t.max||t.maxLength||t.minLength||t.pattern||t.validate),Uje=(t,e,n)=>!n&&(e.watchAll||e.watch.has(t)||[...e.watch].some(s=>t.startsWith(s)&&/^\.\w+/.test(t.slice(s.length))));const lA=(t,e,n,s)=>{for(const a of n||Object.keys(t)){const o=Kn(t,a);if(o){const{_f:l,...i}=o;if(l){if(l.refs&&l.refs[0]&&e(l.refs[0],a)&&!s)return!0;if(l.ref&&e(l.ref,l.name)&&!s)return!0;if(lA(i,e))break}else if(mc(i)&&lA(i,e))break}}};function qje(t,e,n){const s=Kn(t,n);if(s||ase(n))return{error:s,name:n};const a=n.split(".");for(;a.length;){const o=a.join("."),l=Kn(e,o),i=Kn(t,o);if(l&&!Array.isArray(l)&&n!==o)return{name:n};if(i&&i.type)return{name:o,error:i};if(i&&i.root&&i.root.type)return{name:`${o}.root`,error:i.root};a.pop()}return{name:n}}var Elt=(t,e,n,s)=>{n(t);const{name:a,...o}=t;return oh(o)||Object.keys(o).length>=Object.keys(e).length||Object.keys(o).find(l=>e[l]===(!s||tm.all))},Ilt=(t,e,n)=>!t||!e||t===e||oA(t).some(s=>s&&(n?s===e:s.startsWith(e)||e.startsWith(s))),Plt=(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,Llt=(t,e)=>!Gge(Kn(t,e)).length&&jc(t,e),Olt=(t,e,n)=>{const s=oA(Kn(t,n));return wo(s,"root",e[n]),wo(t,n,s),t},see=t=>cg(t);function Vje(t,e,n="validate"){if(see(t)||Array.isArray(t)&&t.every(see)||qh(t)&&!t)return{type:n,message:see(t)?t:"",ref:e}}var a4=t=>mc(t)&&!hte(t)?t:{value:t,message:""},Hje=async(t,e,n,s,a,o)=>{const{ref:l,refs:i,required:h,maxLength:p,minLength:x,min:y,max:b,pattern:j,validate:C,name:N,valueAsNumber:A,mount:E}=t._f,T=Kn(n,N);if(!E||e.has(N))return{};const L=i?i[0]:l,z=le=>{a&&L.reportValidity&&(L.setCustomValidity(qh(le)?"":le||""),L.reportValidity())},F={},q=Qge(l),H=SI(l),Z=q||H,G=(A||Xge(l))&&oc(l.value)&&oc(T)||dte(l)&&l.value===""||T===""||Array.isArray(T)&&!T.length,te=HLe.bind(null,N,s,F),ie=(le,ye,ne,ge=hx.maxLength,ae=hx.minLength)=>{const he=le?ye:ne;F[N]={type:le?ge:ae,message:he,ref:l,...te(le?ge:ae,he)}};if(o?!Array.isArray(T)||!T.length:h&&(!Z&&(G||Au(T))||qh(T)&&!T||H&&!ZLe(i).isValid||q&&!XLe(i).isValid)){const{value:le,message:ye}=see(h)?{value:!!h,message:h}:a4(h);if(le&&(F[N]={type:hx.required,message:ye,ref:L,...te(hx.required,ye)},!s))return z(ye),F}if(!G&&(!Au(y)||!Au(b))){let le,ye;const ne=a4(b),ge=a4(y);if(!Au(T)&&!isNaN(T)){const ae=l.valueAsNumber||T&&+T;Au(ne.value)||(le=ae>ne.value),Au(ge.value)||(ye=aenew Date(new Date().toDateString()+" "+Ae),ue=l.type=="time",_e=l.type=="week";cg(ne.value)&&T&&(le=ue?he(T)>he(ne.value):_e?T>ne.value:ae>new Date(ne.value)),cg(ge.value)&&T&&(ye=ue?he(T)+le.value,ge=!Au(ye.value)&&T.length<+ye.value;if((ne||ge)&&(ie(ne,le.message,ye.message),!s))return z(F[N].message),F}if(j&&!G&&cg(T)){const{value:le,message:ye}=a4(j);if(hte(le)&&!T.match(le)&&(F[N]={type:hx.pattern,message:ye,ref:l,...te(hx.pattern,ye)},!s))return z(ye),F}if(C){if(rm(C)){const le=await C(T,n),ye=Vje(le,L);if(ye&&(F[N]={...ye,...te(hx.validate,ye.message)},!s))return z(ye.message),F}else if(mc(C)){let le={};for(const ye in C){if(!oh(le)&&!s)break;const ne=Vje(await C[ye](T,n),L,ye);ne&&(le={...ne,...te(ye,ne.message)},z(ne.message),s&&(F[N]=le))}if(!oh(le)&&(F[N]={ref:L,...le},!s))return F}}return z(!0),F};const Dlt={mode:tm.onSubmit,reValidateMode:tm.onChange,shouldFocusError:!0};function Rlt(t={}){let e={...Dlt,...t},n={submitCount:0,isDirty:!1,isReady:!1,isLoading:rm(e.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1},s={},a=mc(e.defaultValues)||mc(e.values)?Bc(e.defaultValues||e.values)||{}:{},o=e.shouldUnregister?{}:Bc(a),l={action:!1,mount:!1,watch:!1},i={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},h,p=0;const x={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1};let y={...x};const b={array:Oje(),state:Oje()},j=e.criteriaMode===tm.all,C=qe=>Oe=>{clearTimeout(p),p=setTimeout(qe,Oe)},N=async qe=>{if(!e.disabled&&(x.isValid||y.isValid||qe)){const Oe=e.resolver?oh((await H()).errors):await G(s,!0);Oe!==n.isValid&&b.state.next({isValid:Oe})}},A=(qe,Oe)=>{!e.disabled&&(x.isValidating||x.validatingFields||y.isValidating||y.validatingFields)&&((qe||Array.from(i.mount)).forEach(Qe=>{Qe&&(Oe?wo(n.validatingFields,Qe,Oe):jc(n.validatingFields,Qe))}),b.state.next({validatingFields:n.validatingFields,isValidating:!oh(n.validatingFields)}))},E=(qe,Oe=[],Qe,nt,gt=!0,mt=!0)=>{if(nt&&Qe&&!e.disabled){if(l.action=!0,mt&&Array.isArray(Kn(s,qe))){const Mt=Qe(Kn(s,qe),nt.argA,nt.argB);gt&&wo(s,qe,Mt)}if(mt&&Array.isArray(Kn(n.errors,qe))){const Mt=Qe(Kn(n.errors,qe),nt.argA,nt.argB);gt&&wo(n.errors,qe,Mt),Llt(n.errors,qe)}if((x.touchedFields||y.touchedFields)&&mt&&Array.isArray(Kn(n.touchedFields,qe))){const Mt=Qe(Kn(n.touchedFields,qe),nt.argA,nt.argB);gt&&wo(n.touchedFields,qe,Mt)}(x.dirtyFields||y.dirtyFields)&&(n.dirtyFields=IM(a,o)),b.state.next({name:qe,isDirty:ie(qe,Oe),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else wo(o,qe,Oe)},T=(qe,Oe)=>{wo(n.errors,qe,Oe),b.state.next({errors:n.errors})},L=qe=>{n.errors=qe,b.state.next({errors:n.errors,isValid:!1})},z=(qe,Oe,Qe,nt)=>{const gt=Kn(s,qe);if(gt){const mt=Kn(o,qe,oc(Qe)?Kn(a,qe):Qe);oc(mt)||nt&&nt.defaultChecked||Oe?wo(o,qe,Oe?mt:zje(gt._f)):ne(qe,mt),l.mount&&N()}},F=(qe,Oe,Qe,nt,gt)=>{let mt=!1,Mt=!1;const wt={name:qe};if(!e.disabled){if(!Qe||nt){(x.isDirty||y.isDirty)&&(Mt=n.isDirty,n.isDirty=wt.isDirty=ie(),mt=Mt!==wt.isDirty);const Qt=Tx(Kn(a,qe),Oe);Mt=!!Kn(n.dirtyFields,qe),Qt?jc(n.dirtyFields,qe):wo(n.dirtyFields,qe,!0),wt.dirtyFields=n.dirtyFields,mt=mt||(x.dirtyFields||y.dirtyFields)&&Mt!==!Qt}if(Qe){const Qt=Kn(n.touchedFields,qe);Qt||(wo(n.touchedFields,qe,Qe),wt.touchedFields=n.touchedFields,mt=mt||(x.touchedFields||y.touchedFields)&&Qt!==Qe)}mt&>&&b.state.next(wt)}return mt?wt:{}},q=(qe,Oe,Qe,nt)=>{const gt=Kn(n.errors,qe),mt=(x.isValid||y.isValid)&&qh(Oe)&&n.isValid!==Oe;if(e.delayError&&Qe?(h=C(()=>T(qe,Qe)),h(e.delayError)):(clearTimeout(p),h=null,Qe?wo(n.errors,qe,Qe):jc(n.errors,qe)),(Qe?!Tx(gt,Qe):gt)||!oh(nt)||mt){const Mt={...nt,...mt&&qh(Oe)?{isValid:Oe}:{},errors:n.errors,name:qe};n={...n,...Mt},b.state.next(Mt)}},H=async qe=>{A(qe,!0);const Oe=await e.resolver(o,e.context,Mlt(qe||i.mount,s,e.criteriaMode,e.shouldUseNativeValidation));return A(qe),Oe},Z=async qe=>{const{errors:Oe}=await H(qe);if(qe)for(const Qe of qe){const nt=Kn(Oe,Qe);nt?wo(n.errors,Qe,nt):jc(n.errors,Qe)}else n.errors=Oe;return Oe},G=async(qe,Oe,Qe={valid:!0})=>{for(const nt in qe){const gt=qe[nt];if(gt){const{_f:mt,...Mt}=gt;if(mt){const wt=i.array.has(mt.name),Qt=gt._f&&Tlt(gt._f);Qt&&x.validatingFields&&A([nt],!0);const Cr=await Hje(gt,i.disabled,o,j,e.shouldUseNativeValidation&&!Oe,wt);if(Qt&&x.validatingFields&&A([nt]),Cr[mt.name]&&(Qe.valid=!1,Oe))break;!Oe&&(Kn(Cr,mt.name)?wt?Olt(n.errors,Cr,mt.name):wo(n.errors,mt.name,Cr[mt.name]):jc(n.errors,mt.name))}!oh(Mt)&&await G(Mt,Oe,Qe)}}return Qe.valid},te=()=>{for(const qe of i.unMount){const Oe=Kn(s,qe);Oe&&(Oe._f.refs?Oe._f.refs.every(Qe=>!qle(Qe)):!qle(Oe._f.ref))&&Ee(qe)}i.unMount=new Set},ie=(qe,Oe)=>!e.disabled&&(qe&&Oe&&wo(o,qe,Oe),!Tx(Ae(),a)),le=(qe,Oe,Qe)=>VLe(qe,i,{...l.mount?o:oc(Oe)?a:cg(qe)?{[qe]:Oe}:Oe},Qe,Oe),ye=qe=>Gge(Kn(l.mount?o:a,qe,e.shouldUnregister?Kn(a,qe,[]):[])),ne=(qe,Oe,Qe={})=>{const nt=Kn(s,qe);let gt=Oe;if(nt){const mt=nt._f;mt&&(!mt.disabled&&wo(o,qe,YLe(Oe,mt)),gt=dte(mt.ref)&&Au(Oe)?"":Oe,WLe(mt.ref)?[...mt.ref.options].forEach(Mt=>Mt.selected=gt.includes(Mt.value)):mt.refs?SI(mt.ref)?mt.refs.forEach(Mt=>{(!Mt.defaultChecked||!Mt.disabled)&&(Array.isArray(gt)?Mt.checked=!!gt.find(wt=>wt===Mt.value):Mt.checked=gt===Mt.value||!!gt)}):mt.refs.forEach(Mt=>Mt.checked=Mt.value===gt):Xge(mt.ref)?mt.ref.value="":(mt.ref.value=gt,mt.ref.type||b.state.next({name:qe,values:Bc(o)})))}(Qe.shouldDirty||Qe.shouldTouch)&&F(qe,gt,Qe.shouldTouch,Qe.shouldDirty,!0),Qe.shouldValidate&&_e(qe)},ge=(qe,Oe,Qe)=>{for(const nt in Oe){if(!Oe.hasOwnProperty(nt))return;const gt=Oe[nt],mt=qe+"."+nt,Mt=Kn(s,mt);(i.array.has(qe)||mc(gt)||Mt&&!Mt._f)&&!zw(gt)?ge(mt,gt,Qe):ne(mt,gt,Qe)}},ae=(qe,Oe,Qe={})=>{const nt=Kn(s,qe),gt=i.array.has(qe),mt=Bc(Oe);wo(o,qe,mt),gt?(b.array.next({name:qe,values:Bc(o)}),(x.isDirty||x.dirtyFields||y.isDirty||y.dirtyFields)&&Qe.shouldDirty&&b.state.next({name:qe,dirtyFields:IM(a,o),isDirty:ie(qe,mt)})):nt&&!nt._f&&!Au(mt)?ge(qe,mt,Qe):ne(qe,mt,Qe),Uje(qe,i)&&b.state.next({...n,name:qe}),b.state.next({name:l.mount?qe:void 0,values:Bc(o)})},he=async qe=>{l.mount=!0;const Oe=qe.target;let Qe=Oe.name,nt=!0;const gt=Kn(s,Qe),mt=Qt=>{nt=Number.isNaN(Qt)||zw(Qt)&&isNaN(Qt.getTime())||Tx(Qt,Kn(o,Qe,Qt))},Mt=Bje(e.mode),wt=Bje(e.reValidateMode);if(gt){let Qt,Cr;const cn=Oe.type?zje(gt._f):$Le(qe),jn=qe.type===cte.BLUR||qe.type===cte.FOCUS_OUT,Xr=!Alt(gt._f)&&!e.resolver&&!Kn(n.errors,Qe)&&!gt._f.deps||Plt(jn,Kn(n.touchedFields,Qe),n.isSubmitted,wt,Mt),Pn=Uje(Qe,i,jn);wo(o,Qe,cn),jn?(gt._f.onBlur&>._f.onBlur(qe),h&&h(0)):gt._f.onChange&>._f.onChange(qe);const js=F(Qe,cn,jn),hr=!oh(js)||Pn;if(!jn&&b.state.next({name:Qe,type:qe.type,values:Bc(o)}),Xr)return(x.isValid||y.isValid)&&(e.mode==="onBlur"?jn&&N():jn||N()),hr&&b.state.next({name:Qe,...Pn?{}:js});if(!jn&&Pn&&b.state.next({...n}),e.resolver){const{errors:xs}=await H([Qe]);if(mt(cn),nt){const ka=qje(n.errors,s,Qe),xa=qje(xs,s,ka.name||Qe);Qt=xa.error,Qe=xa.name,Cr=oh(xs)}}else A([Qe],!0),Qt=(await Hje(gt,i.disabled,o,j,e.shouldUseNativeValidation))[Qe],A([Qe]),mt(cn),nt&&(Qt?Cr=!1:(x.isValid||y.isValid)&&(Cr=await G(s,!0)));nt&&(gt._f.deps&&_e(gt._f.deps),q(Qe,Cr,Qt,js))}},ue=(qe,Oe)=>{if(Kn(n.errors,Oe)&&qe.focus)return qe.focus(),1},_e=async(qe,Oe={})=>{let Qe,nt;const gt=oA(qe);if(e.resolver){const mt=await Z(oc(qe)?qe:gt);Qe=oh(mt),nt=qe?!gt.some(Mt=>Kn(mt,Mt)):Qe}else qe?(nt=(await Promise.all(gt.map(async mt=>{const Mt=Kn(s,mt);return await G(Mt&&Mt._f?{[mt]:Mt}:Mt)}))).every(Boolean),!(!nt&&!n.isValid)&&N()):nt=Qe=await G(s);return b.state.next({...!cg(qe)||(x.isValid||y.isValid)&&Qe!==n.isValid?{}:{name:qe},...e.resolver||!qe?{isValid:Qe}:{},errors:n.errors}),Oe.shouldFocus&&!nt&&lA(s,ue,qe?gt:i.mount),nt},Ae=qe=>{const Oe={...l.mount?o:a};return oc(qe)?Oe:cg(qe)?Kn(Oe,qe):qe.map(Qe=>Kn(Oe,Qe))},Ce=(qe,Oe)=>({invalid:!!Kn((Oe||n).errors,qe),isDirty:!!Kn((Oe||n).dirtyFields,qe),error:Kn((Oe||n).errors,qe),isValidating:!!Kn(n.validatingFields,qe),isTouched:!!Kn((Oe||n).touchedFields,qe)}),be=qe=>{qe&&oA(qe).forEach(Oe=>jc(n.errors,Oe)),b.state.next({errors:qe?n.errors:{}})},me=(qe,Oe,Qe)=>{const nt=(Kn(s,qe,{_f:{}})._f||{}).ref,gt=Kn(n.errors,qe)||{},{ref:mt,message:Mt,type:wt,...Qt}=gt;wo(n.errors,qe,{...Qt,...Oe,ref:nt}),b.state.next({name:qe,errors:n.errors,isValid:!1}),Qe&&Qe.shouldFocus&&nt&&nt.focus&&nt.focus()},Le=(qe,Oe)=>rm(qe)?b.state.subscribe({next:Qe=>"values"in Qe&&qe(le(void 0,Oe),Qe)}):le(qe,Oe,!0),Ne=qe=>b.state.subscribe({next:Oe=>{Ilt(qe.name,Oe.name,qe.exact)&&Elt(Oe,qe.formState||x,at,qe.reRenderRoot)&&qe.callback({values:{...o},...n,...Oe,defaultValues:a})}}).unsubscribe,Be=qe=>(l.mount=!0,y={...y,...qe.formState},Ne({...qe,formState:y})),Ee=(qe,Oe={})=>{for(const Qe of qe?oA(qe):i.mount)i.mount.delete(Qe),i.array.delete(Qe),Oe.keepValue||(jc(s,Qe),jc(o,Qe)),!Oe.keepError&&jc(n.errors,Qe),!Oe.keepDirty&&jc(n.dirtyFields,Qe),!Oe.keepTouched&&jc(n.touchedFields,Qe),!Oe.keepIsValidating&&jc(n.validatingFields,Qe),!e.shouldUnregister&&!Oe.keepDefaultValue&&jc(a,Qe);b.state.next({values:Bc(o)}),b.state.next({...n,...Oe.keepDirty?{isDirty:ie()}:{}}),!Oe.keepIsValid&&N()},Ue=({disabled:qe,name:Oe})=>{(qh(qe)&&l.mount||qe||i.disabled.has(Oe))&&(qe?i.disabled.add(Oe):i.disabled.delete(Oe))},Re=(qe,Oe={})=>{let Qe=Kn(s,qe);const nt=qh(Oe.disabled)||qh(e.disabled);return wo(s,qe,{...Qe||{},_f:{...Qe&&Qe._f?Qe._f:{ref:{name:qe}},name:qe,mount:!0,...Oe}}),i.mount.add(qe),Qe?Ue({disabled:qh(Oe.disabled)?Oe.disabled:e.disabled,name:qe}):z(qe,!0,Oe.value),{...nt?{disabled:Oe.disabled||e.disabled}:{},...e.progressive?{required:!!Oe.required,min:PM(Oe.min),max:PM(Oe.max),minLength:PM(Oe.minLength),maxLength:PM(Oe.maxLength),pattern:PM(Oe.pattern)}:{},name:qe,onChange:he,onBlur:he,ref:gt=>{if(gt){Re(qe,Oe),Qe=Kn(s,qe);const mt=oc(gt.value)&>.querySelectorAll&>.querySelectorAll("input,select,textarea")[0]||gt,Mt=Nlt(mt),wt=Qe._f.refs||[];if(Mt?wt.find(Qt=>Qt===mt):mt===Qe._f.ref)return;wo(s,qe,{_f:{...Qe._f,...Mt?{refs:[...wt.filter(qle),mt,...Array.isArray(Kn(a,qe))?[{}]:[]],ref:{type:mt.type,name:qe}}:{ref:mt}}}),z(qe,!1,void 0,mt)}else Qe=Kn(s,qe,{}),Qe._f&&(Qe._f.mount=!1),(e.shouldUnregister||Oe.shouldUnregister)&&!(ULe(i.array,qe)&&l.action)&&i.unMount.add(qe)}}},je=()=>e.shouldFocusError&&lA(s,ue,i.mount),et=qe=>{qh(qe)&&(b.state.next({disabled:qe}),lA(s,(Oe,Qe)=>{const nt=Kn(s,Qe);nt&&(Oe.disabled=nt._f.disabled||qe,Array.isArray(nt._f.refs)&&nt._f.refs.forEach(gt=>{gt.disabled=nt._f.disabled||qe}))},0,!1))},Te=(qe,Oe)=>async Qe=>{let nt;Qe&&(Qe.preventDefault&&Qe.preventDefault(),Qe.persist&&Qe.persist());let gt=Bc(o);if(b.state.next({isSubmitting:!0}),e.resolver){const{errors:mt,values:Mt}=await H();n.errors=mt,gt=Bc(Mt)}else await G(s);if(i.disabled.size)for(const mt of i.disabled)jc(gt,mt);if(jc(n.errors,"root"),oh(n.errors)){b.state.next({errors:{}});try{await qe(gt,Qe)}catch(mt){nt=mt}}else Oe&&await Oe({...n.errors},Qe),je(),setTimeout(je);if(b.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:oh(n.errors)&&!nt,submitCount:n.submitCount+1,errors:n.errors}),nt)throw nt},Ze=(qe,Oe={})=>{Kn(s,qe)&&(oc(Oe.defaultValue)?ae(qe,Bc(Kn(a,qe))):(ae(qe,Oe.defaultValue),wo(a,qe,Bc(Oe.defaultValue))),Oe.keepTouched||jc(n.touchedFields,qe),Oe.keepDirty||(jc(n.dirtyFields,qe),n.isDirty=Oe.defaultValue?ie(qe,Bc(Kn(a,qe))):ie()),Oe.keepError||(jc(n.errors,qe),x.isValid&&N()),b.state.next({...n}))},pe=(qe,Oe={})=>{const Qe=qe?Bc(qe):a,nt=Bc(Qe),gt=oh(qe),mt=gt?a:nt;if(Oe.keepDefaultValues||(a=Qe),!Oe.keepValues){if(Oe.keepDirtyValues){const Mt=new Set([...i.mount,...Object.keys(IM(a,o))]);for(const wt of Array.from(Mt))Kn(n.dirtyFields,wt)?wo(mt,wt,Kn(o,wt)):ae(wt,Kn(mt,wt))}else{if(Wge&&oc(qe))for(const Mt of i.mount){const wt=Kn(s,Mt);if(wt&&wt._f){const Qt=Array.isArray(wt._f.refs)?wt._f.refs[0]:wt._f.ref;if(dte(Qt)){const Cr=Qt.closest("form");if(Cr){Cr.reset();break}}}}if(Oe.keepFieldsRef)for(const Mt of i.mount)ae(Mt,Kn(mt,Mt));else s={}}o=e.shouldUnregister?Oe.keepDefaultValues?Bc(a):{}:Bc(mt),b.array.next({values:{...mt}}),b.state.next({values:{...mt}})}i={mount:Oe.keepDirtyValues?i.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},l.mount=!x.isValid||!!Oe.keepIsValid||!!Oe.keepDirtyValues,l.watch=!!e.shouldUnregister,b.state.next({submitCount:Oe.keepSubmitCount?n.submitCount:0,isDirty:gt?!1:Oe.keepDirty?n.isDirty:!!(Oe.keepDefaultValues&&!Tx(qe,a)),isSubmitted:Oe.keepIsSubmitted?n.isSubmitted:!1,dirtyFields:gt?{}:Oe.keepDirtyValues?Oe.keepDefaultValues&&o?IM(a,o):n.dirtyFields:Oe.keepDefaultValues&&qe?IM(a,qe):Oe.keepDirty?n.dirtyFields:{},touchedFields:Oe.keepTouched?n.touchedFields:{},errors:Oe.keepErrors?n.errors:{},isSubmitSuccessful:Oe.keepIsSubmitSuccessful?n.isSubmitSuccessful:!1,isSubmitting:!1})},yt=(qe,Oe)=>pe(rm(qe)?qe(o):qe,Oe),rt=(qe,Oe={})=>{const Qe=Kn(s,qe),nt=Qe&&Qe._f;if(nt){const gt=nt.refs?nt.refs[0]:nt.ref;gt.focus&&(gt.focus(),Oe.shouldSelect&&rm(gt.select)&>.select())}},at=qe=>{n={...n,...qe}},ft={control:{register:Re,unregister:Ee,getFieldState:Ce,handleSubmit:Te,setError:me,_subscribe:Ne,_runSchema:H,_focusError:je,_getWatch:le,_getDirty:ie,_setValid:N,_setFieldArray:E,_setDisabledField:Ue,_setErrors:L,_getFieldArray:ye,_reset:pe,_resetDefaultValues:()=>rm(e.defaultValues)&&e.defaultValues().then(qe=>{yt(qe,e.resetOptions),b.state.next({isLoading:!1})}),_removeUnmounted:te,_disableForm:et,_subjects:b,_proxyFormState:x,get _fields(){return s},get _formValues(){return o},get _state(){return l},set _state(qe){l=qe},get _defaultValues(){return a},get _names(){return i},set _names(qe){i=qe},get _formState(){return n},get _options(){return e},set _options(qe){e={...e,...qe}}},subscribe:Be,trigger:_e,register:Re,handleSubmit:Te,watch:Le,setValue:ae,getValues:Ae,reset:yt,resetField:Ze,clearErrors:be,unregister:Ee,setError:me,setFocus:rt,getFieldState:Ce};return{...ft,formControl:ft}}function ose(t={}){const e=st.useRef(void 0),n=st.useRef(void 0),[s,a]=st.useState({isDirty:!1,isValidating:!1,isLoading:rm(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:rm(t.defaultValues)?void 0:t.defaultValues});if(!e.current)if(t.formControl)e.current={...t.formControl,formState:s},t.defaultValues&&!rm(t.defaultValues)&&t.formControl.reset(t.defaultValues,t.resetOptions);else{const{formControl:l,...i}=Rlt(t);e.current={...i,formState:s}}const o=e.current.control;return o._options=t,Yge(()=>{const l=o._subscribe({formState:o._proxyFormState,callback:()=>a({...o._formState}),reRenderRoot:!0});return a(i=>({...i,isReady:!0})),o._formState.isReady=!0,l},[o]),st.useEffect(()=>o._disableForm(t.disabled),[o,t.disabled]),st.useEffect(()=>{t.mode&&(o._options.mode=t.mode),t.reValidateMode&&(o._options.reValidateMode=t.reValidateMode)},[o,t.mode,t.reValidateMode]),st.useEffect(()=>{t.errors&&(o._setErrors(t.errors),o._focusError())},[o,t.errors]),st.useEffect(()=>{t.shouldUnregister&&o._subjects.state.next({values:o._getWatch()})},[o,t.shouldUnregister]),st.useEffect(()=>{if(o._proxyFormState.isDirty){const l=o._getDirty();l!==s.isDirty&&o._subjects.state.next({isDirty:l})}},[o,s.isDirty]),st.useEffect(()=>{t.values&&!Tx(t.values,n.current)?(o._reset(t.values,{keepFieldsRef:!0,...o._options.resetOptions}),n.current=t.values,a(l=>({...l}))):o._resetDefaultValues()},[o,t.values]),st.useEffect(()=>{o._state.mount||(o._setValid(),o._state.mount=!0),o._state.watch&&(o._state.watch=!1,o._subjects.state.next({...o._formState})),o._removeUnmounted()}),e.current.formState=qLe(s,o),e.current}const Wje=(t,e,n)=>{if(t&&"reportValidity"in t){const s=Kn(n,e);t.setCustomValidity(s&&s.message||""),t.reportValidity()}},QLe=(t,e)=>{for(const n in e.fields){const s=e.fields[n];s&&s.ref&&"reportValidity"in s.ref?Wje(s.ref,n,t):s.refs&&s.refs.forEach(a=>Wje(a,n,t))}},Flt=(t,e)=>{e.shouldUseNativeValidation&&QLe(t,e);const n={};for(const s in t){const a=Kn(e.fields,s),o=Object.assign(t[s]||{},{ref:a&&a.ref});if(zlt(e.names||Object.keys(t),s)){const l=Object.assign({},Kn(n,s));wo(l,"root",o),wo(n,s,l)}else wo(n,s,o)}return n},zlt=(t,e)=>t.some(n=>n.startsWith(e+"."));var Blt=function(t,e){for(var n={};t.length;){var s=t[0],a=s.code,o=s.message,l=s.path.join(".");if(!n[l])if("unionErrors"in s){var i=s.unionErrors[0].errors[0];n[l]={message:i.message,type:i.code}}else n[l]={message:o,type:a};if("unionErrors"in s&&s.unionErrors.forEach(function(x){return x.errors.forEach(function(y){return t.push(y)})}),e){var h=n[l].types,p=h&&h[s.code];n[l]=HLe(l,e,n,a,p?[].concat(p,s.message):s.message)}t.shift()}return n},lse=function(t,e,n){return n===void 0&&(n={}),function(s,a,o){try{return Promise.resolve(function(l,i){try{var h=Promise.resolve(t[n.mode==="sync"?"parse":"parseAsync"](s,e)).then(function(p){return o.shouldUseNativeValidation&&QLe({},o),{errors:{},values:n.raw?s:p}})}catch(p){return i(p)}return h&&h.then?h.then(void 0,i):h}(0,function(l){if(function(i){return Array.isArray(i==null?void 0:i.errors)}(l))return{values:{},errors:Flt(Blt(l.errors,!o.shouldUseNativeValidation&&o.criteriaMode==="all"),o)};throw l}))}catch(l){return Promise.reject(l)}}};const cse=_lt,JLe=I.createContext({}),Tl=({...t})=>r.jsx(JLe.Provider,{value:{name:t.name},children:r.jsx(klt,{...t})}),dse=()=>{const t=I.useContext(JLe),e=I.useContext(eOe),{getFieldState:n,formState:s}=ise(),a=n(t.name,s);if(!t)throw new Error("useFormField should be used within ");const{id:o}=e;return{id:o,name:t.name,formItemId:`${o}-form-item`,formDescriptionId:`${o}-form-item-description`,formMessageId:`${o}-form-item-message`,...a}},eOe=I.createContext({}),bl=I.forwardRef(({className:t,...e},n)=>{const s=I.useId();return r.jsx(eOe.Provider,{value:{id:s},children:r.jsx("div",{ref:n,className:$t("space-y-2",t),...e})})});bl.displayName="FormItem";const wl=I.forwardRef(({className:t,...e},n)=>{const{error:s,formItemId:a}=dse();return r.jsx(He,{ref:n,className:$t(s&&"text-destructive",t),htmlFor:a,...e})});wl.displayName="FormLabel";const jl=I.forwardRef(({...t},e)=>{const{error:n,formItemId:s,formDescriptionId:a,formMessageId:o}=dse();return r.jsx(Dme,{ref:e,id:s,"aria-describedby":n?`${a} ${o}`:`${a}`,"aria-invalid":!!n,...t})});jl.displayName="FormControl";const aee=I.forwardRef(({className:t,...e},n)=>{const{formDescriptionId:s}=dse();return r.jsx("p",{ref:n,id:s,className:$t("text-sm text-muted-foreground",t),...e})});aee.displayName="FormDescription";const Eu=I.forwardRef(({className:t,children:e,...n},s)=>{const{error:a,formMessageId:o}=dse(),l=a?String(a==null?void 0:a.message):e;return l?r.jsx("p",{ref:s,id:o,className:$t("text-sm font-medium text-destructive",t),...n,children:l}):null});Eu.displayName="FormMessage";const ps=I.forwardRef(({className:t,...e},n)=>r.jsx("textarea",{className:$t("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",t),ref:n,...e}));ps.displayName="Textarea";const $lt=c3({category:yLe(["general","technology","crm","marketing"]),subject:ic().min(5,"Subject must be at least 5 characters").max(200),description:ic().min(20,"Please provide more details (at least 20 characters)").max(2e3)}),Ult={general:"General Support",technology:"Technology Support",crm:"CRM Support",marketing:"Marketing Support"};function ghe({trigger:t}){const[e,n]=I.useState(!1),[s,a]=I.useState(!1),{user:o}=Qr(),l=ose({resolver:lse($lt),defaultValues:{category:"general",subject:"",description:""}}),i=async h=>{if(!o){ze.error("You must be logged in to submit a ticket");return}a(!0);try{const{error:p}=await J.from("support_tickets").insert({user_id:o.id,category:h.category,subject:h.subject,description:h.description});if(p)throw p;try{await J.functions.invoke("support-ticket-notify",{body:{category:Ult[h.category],subject:h.subject}})}catch(x){console.log("Notification send attempted:",x)}ze.success("Support ticket submitted successfully!"),l.reset(),n(!1)}catch(p){console.error("Error submitting ticket:",p),ze.error("Failed to submit ticket. Please try again.")}finally{a(!1)}};return r.jsxs(Fr,{open:e,onOpenChange:n,children:[r.jsx(zo,{asChild:!0,children:t||r.jsxs(ee,{variant:"ghost",size:"icon",className:"relative",children:[r.jsx(DT,{className:"h-5 w-5"}),r.jsx("span",{className:"sr-only",children:"Support"})]})}),r.jsxs(Rr,{className:"sm:max-w-[500px]",children:[r.jsxs(qr,{children:[r.jsx($r,{children:"Need Help?"}),r.jsx(Xn,{children:"Submit a support ticket and we'll get back to you as soon as possible."})]}),r.jsxs("div",{className:"flex items-center gap-2 p-3 bg-muted rounded-lg mb-4",children:[r.jsx(bi,{className:"h-4 w-4 text-muted-foreground"}),r.jsxs("span",{className:"text-sm text-muted-foreground",children:["You can also text us at: ",r.jsx("span",{className:"font-medium text-foreground",children:"1-866-527-8668"})]})]}),r.jsx(cse,{...l,children:r.jsxs("form",{onSubmit:l.handleSubmit(i),className:"space-y-4",children:[r.jsx(Tl,{control:l.control,name:"category",render:({field:h})=>r.jsxs(bl,{children:[r.jsx(wl,{children:"Category"}),r.jsxs(gn,{onValueChange:h.onChange,defaultValue:h.value,children:[r.jsx(jl,{children:r.jsx(fn,{children:r.jsx(xn,{placeholder:"Select a category"})})}),r.jsxs(pn,{children:[r.jsx(Vt,{value:"general",children:"General Support"}),r.jsx(Vt,{value:"technology",children:"Technology Support"}),r.jsx(Vt,{value:"crm",children:"CRM Support"}),r.jsx(Vt,{value:"marketing",children:"Marketing Support"})]})]}),r.jsx(Eu,{})]})}),r.jsx(Tl,{control:l.control,name:"subject",render:({field:h})=>r.jsxs(bl,{children:[r.jsx(wl,{children:"Subject"}),r.jsx(jl,{children:r.jsx(dt,{placeholder:"Brief description of your issue",...h})}),r.jsx(Eu,{})]})}),r.jsx(Tl,{control:l.control,name:"description",render:({field:h})=>r.jsxs(bl,{children:[r.jsx(wl,{children:"Description"}),r.jsx(jl,{children:r.jsx(ps,{placeholder:"Please describe your issue in detail...",className:"min-h-[120px]",...h})}),r.jsx(Eu,{})]})}),r.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[r.jsx(ee,{type:"button",variant:"outline",onClick:()=>n(!1),children:"Cancel"}),r.jsx(ee,{type:"submit",disabled:s,children:s?"Submitting...":"Submit Ticket"})]})]})})]})]})}function ws(t){const e=Object.prototype.toString.call(t);return t instanceof Date||typeof t=="object"&&e==="[object Date]"?new t.constructor(+t):typeof t=="number"||e==="[object Number]"||typeof t=="string"||e==="[object String]"?new Date(t):new Date(NaN)}function ko(t,e){return t instanceof Date?new t.constructor(e):new Date(e)}function Kl(t,e){const n=ws(t);return isNaN(e)?ko(t,NaN):(e&&n.setDate(n.getDate()+e),n)}function bh(t,e){const n=ws(t);if(isNaN(e))return ko(t,NaN);if(!e)return n;const s=n.getDate(),a=ko(t,n.getTime());a.setMonth(n.getMonth()+e+1,0);const o=a.getDate();return s>=o?a:(n.setFullYear(a.getFullYear(),a.getMonth(),s),n)}function tOe(t,e){const n=+ws(t);return ko(t,n+e)}const Jge=6048e5,qlt=864e5,rOe=6e4,nOe=36e5,Vlt=1e3,bL=43200,Gje=1440;function Kje(t,e){return tOe(t,e*nOe)}let Hlt={};function iv(){return Hlt}function df(t,e){var i,h,p,x;const n=iv(),s=(e==null?void 0:e.weekStartsOn)??((h=(i=e==null?void 0:e.locale)==null?void 0:i.options)==null?void 0:h.weekStartsOn)??n.weekStartsOn??((x=(p=n.locale)==null?void 0:p.options)==null?void 0:x.weekStartsOn)??0,a=ws(t),o=a.getDay(),l=(o=a.getTime()?n+1:e.getTime()>=l.getTime()?n:n-1}function uf(t){const e=ws(t);return e.setHours(0,0,0,0),e}function $1(t){const e=ws(t),n=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return n.setUTCFullYear(e.getFullYear()),+t-+n}function om(t,e){const n=uf(t),s=uf(e),a=+n-$1(n),o=+s-$1(s);return Math.round((a-o)/qlt)}function Wlt(t){const e=sOe(t),n=ko(t,0);return n.setFullYear(e,0,4),n.setHours(0,0,0,0),ay(n)}function Zje(t,e){return tOe(t,e*rOe)}function Bw(t,e){const n=e*7;return Kl(t,n)}function Glt(t,e){return bh(t,e*12)}function Klt(t){let e;return t.forEach(function(n){const s=ws(n);(e===void 0||e{const s=ws(n);(!e||e>s||isNaN(+s))&&(e=s)}),e||new Date(NaN)}function iee(t,e){const n=ws(t),s=ws(e),a=n.getTime()-s.getTime();return a<0?-1:a>0?1:a}function Ylt(t){return ko(t,Date.now())}function Ql(t,e){const n=uf(t),s=uf(e);return+n==+s}function exe(t){return t instanceof Date||typeof t=="object"&&Object.prototype.toString.call(t)==="[object Date]"}function xhe(t){if(!exe(t)&&typeof t!="number")return!1;const e=ws(t);return!isNaN(Number(e))}function fC(t,e){const n=ws(t),s=ws(e),a=n.getFullYear()-s.getFullYear(),o=n.getMonth()-s.getMonth();return a*12+o}function Xlt(t,e,n){const s=df(t,n),a=df(e,n),o=+s-$1(s),l=+a-$1(a);return Math.round((o-l)/Jge)}function qj(t,e){const n=ws(t),s=ws(e),a=Yje(n,s),o=Math.abs(om(n,s));n.setDate(n.getDate()-a*o);const l=+(Yje(n,s)===-a),i=a*(o-l);return i===0?0:i}function Yje(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 Qlt(t){return e=>{const s=(t?Math[t]:Math.trunc)(e);return s===0?0:s}}function Jlt(t,e){return+ws(t)-+ws(e)}function ect(t){const e=ws(t);return e.setHours(23,59,59,999),e}function use(t){const e=ws(t),n=e.getMonth();return e.setFullYear(e.getFullYear(),n+1,0),e.setHours(23,59,59,999),e}function tct(t){const e=ws(t);return+ect(e)==+use(e)}function rct(t,e){const n=ws(t),s=ws(e),a=iee(n,s),o=Math.abs(fC(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=iee(n,s)===-a;tct(ws(t))&&o===1&&iee(t,s)===1&&(i=!1),l=a*(o-Number(i))}return l===0?0:l}function nct(t,e,n){const s=Jlt(t,e)/1e3;return Qlt(n==null?void 0:n.roundingMethod)(s)}function vh(t){const e=ws(t);return e.setDate(1),e.setHours(0,0,0,0),e}function aOe(t){const e=ws(t),n=ko(t,0);return n.setFullYear(e.getFullYear(),0,1),n.setHours(0,0,0,0),n}function txe(t,e){var i,h,p,x;const n=iv(),s=(e==null?void 0:e.weekStartsOn)??((h=(i=e==null?void 0:e.locale)==null?void 0:i.options)==null?void 0:h.weekStartsOn)??n.weekStartsOn??((x=(p=n.locale)==null?void 0:p.options)==null?void 0:x.weekStartsOn)??0,a=ws(t),o=a.getDay(),l=(o{let s;const a=sct[t];return typeof a=="string"?s=a:e===1?s=a.one:s=a.other.replace("{{count}}",e.toString()),n!=null&&n.addSuffix?n.comparison&&n.comparison>0?"in "+s:s+" ago":s};function Vle(t){return(e={})=>{const n=e.width?String(e.width):t.defaultWidth;return t.formats[n]||t.formats[t.defaultWidth]}}const ict={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},oct={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},lct={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},cct={date:Vle({formats:ict,defaultWidth:"full"}),time:Vle({formats:oct,defaultWidth:"full"}),dateTime:Vle({formats:lct,defaultWidth:"full"})},dct={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},uct=(t,e,n,s)=>dct[t];function LM(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 hct={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},fct={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},pct={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"]},mct={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"]},gct={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"}},xct={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"}},yct=(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"},vct={ordinalNumber:yct,era:LM({values:hct,defaultWidth:"wide"}),quarter:LM({values:fct,defaultWidth:"wide",argumentCallback:t=>t-1}),month:LM({values:pct,defaultWidth:"wide"}),day:LM({values:mct,defaultWidth:"wide"}),dayPeriod:LM({values:gct,defaultWidth:"wide",formattingValues:xct,defaultFormattingWidth:"wide"})};function OM(t){return(e,n={})=>{const s=n.width,a=s&&t.matchPatterns[s]||t.matchPatterns[t.defaultMatchWidth],o=e.match(a);if(!o)return null;const l=o[0],i=s&&t.parsePatterns[s]||t.parsePatterns[t.defaultParseWidth],h=Array.isArray(i)?bct(i,y=>y.test(l)):_ct(i,y=>y.test(l));let p;p=t.valueCallback?t.valueCallback(h):h,p=n.valueCallback?n.valueCallback(p):p;const x=e.slice(l.length);return{value:p,rest:x}}}function _ct(t,e){for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&e(t[n]))return n}function bct(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 jct=/^(\d+)(th|st|nd|rd)?/i,kct=/\d+/i,Nct={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},Sct={any:[/^b/i,/^(a|c)/i]},Cct={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},Mct={any:[/1/i,/2/i,/3/i,/4/i]},Tct={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},Act={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]},Ect={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},Ict={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]},Pct={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},Lct={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}},Oct={ordinalNumber:wct({matchPattern:jct,parsePattern:kct,valueCallback:t=>parseInt(t,10)}),era:OM({matchPatterns:Nct,defaultMatchWidth:"wide",parsePatterns:Sct,defaultParseWidth:"any"}),quarter:OM({matchPatterns:Cct,defaultMatchWidth:"wide",parsePatterns:Mct,defaultParseWidth:"any",valueCallback:t=>t+1}),month:OM({matchPatterns:Tct,defaultMatchWidth:"wide",parsePatterns:Act,defaultParseWidth:"any"}),day:OM({matchPatterns:Ect,defaultMatchWidth:"wide",parsePatterns:Ict,defaultParseWidth:"any"}),dayPeriod:OM({matchPatterns:Pct,defaultMatchWidth:"any",parsePatterns:Lct,defaultParseWidth:"any"})},hse={code:"en-US",formatDistance:act,formatLong:cct,formatRelative:uct,localize:vct,match:Oct,options:{weekStartsOn:0,firstWeekContainsDate:1}};function Dct(t){const e=ws(t);return om(e,aOe(e))+1}function rxe(t){const e=ws(t),n=+ay(e)-+Wlt(e);return Math.round(n/Jge)+1}function nxe(t,e){var x,y,b,j;const n=ws(t),s=n.getFullYear(),a=iv(),o=(e==null?void 0:e.firstWeekContainsDate)??((y=(x=e==null?void 0:e.locale)==null?void 0:x.options)==null?void 0:y.firstWeekContainsDate)??a.firstWeekContainsDate??((j=(b=a.locale)==null?void 0:b.options)==null?void 0:j.firstWeekContainsDate)??1,l=ko(t,0);l.setFullYear(s+1,0,o),l.setHours(0,0,0,0);const i=df(l,e),h=ko(t,0);h.setFullYear(s,0,o),h.setHours(0,0,0,0);const p=df(h,e);return n.getTime()>=i.getTime()?s+1:n.getTime()>=p.getTime()?s:s-1}function Rct(t,e){var i,h,p,x;const n=iv(),s=(e==null?void 0:e.firstWeekContainsDate)??((h=(i=e==null?void 0:e.locale)==null?void 0:i.options)==null?void 0:h.firstWeekContainsDate)??n.firstWeekContainsDate??((x=(p=n.locale)==null?void 0:p.options)==null?void 0:x.firstWeekContainsDate)??1,a=nxe(t,e),o=ko(t,0);return o.setFullYear(a,0,s),o.setHours(0,0,0,0),df(o,e)}function sxe(t,e){const n=ws(t),s=+df(n,e)-+Rct(n,e);return Math.round(s/Jge)+1}function jo(t,e){const n=t<0?"-":"",s=Math.abs(t).toString().padStart(e,"0");return n+s}const o0={y(t,e){const n=t.getFullYear(),s=n>0?n:1-n;return jo(e==="yy"?s%100:s,e.length)},M(t,e){const n=t.getMonth();return e==="M"?String(n+1):jo(n+1,2)},d(t,e){return jo(t.getDate(),e.length)},a(t,e){const n=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];case"aaaa":default:return n==="am"?"a.m.":"p.m."}},h(t,e){return jo(t.getHours()%12||12,e.length)},H(t,e){return jo(t.getHours(),e.length)},m(t,e){return jo(t.getMinutes(),e.length)},s(t,e){return jo(t.getSeconds(),e.length)},S(t,e){const n=e.length,s=t.getMilliseconds(),a=Math.trunc(s*Math.pow(10,n-3));return jo(a,e.length)}},i4={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},Xje={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 o0.y(t,e)},Y:function(t,e,n,s){const a=nxe(t,s),o=a>0?a:1-a;if(e==="YY"){const l=o%100;return jo(l,2)}return e==="Yo"?n.ordinalNumber(o,{unit:"year"}):jo(o,e.length)},R:function(t,e){const n=sOe(t);return jo(n,e.length)},u:function(t,e){const n=t.getFullYear();return jo(n,e.length)},Q:function(t,e,n){const s=Math.ceil((t.getMonth()+1)/3);switch(e){case"Q":return String(s);case"QQ":return jo(s,2);case"Qo":return n.ordinalNumber(s,{unit:"quarter"});case"QQQ":return n.quarter(s,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(s,{width:"narrow",context:"formatting"});case"QQQQ":default:return n.quarter(s,{width:"wide",context:"formatting"})}},q:function(t,e,n){const s=Math.ceil((t.getMonth()+1)/3);switch(e){case"q":return String(s);case"qq":return jo(s,2);case"qo":return n.ordinalNumber(s,{unit:"quarter"});case"qqq":return n.quarter(s,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(s,{width:"narrow",context:"standalone"});case"qqqq":default:return n.quarter(s,{width:"wide",context:"standalone"})}},M:function(t,e,n){const s=t.getMonth();switch(e){case"M":case"MM":return o0.M(t,e);case"Mo":return n.ordinalNumber(s+1,{unit:"month"});case"MMM":return n.month(s,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(s,{width:"narrow",context:"formatting"});case"MMMM":default:return n.month(s,{width:"wide",context:"formatting"})}},L:function(t,e,n){const s=t.getMonth();switch(e){case"L":return String(s+1);case"LL":return jo(s+1,2);case"Lo":return n.ordinalNumber(s+1,{unit:"month"});case"LLL":return n.month(s,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(s,{width:"narrow",context:"standalone"});case"LLLL":default:return n.month(s,{width:"wide",context:"standalone"})}},w:function(t,e,n,s){const a=sxe(t,s);return e==="wo"?n.ordinalNumber(a,{unit:"week"}):jo(a,e.length)},I:function(t,e,n){const s=rxe(t);return e==="Io"?n.ordinalNumber(s,{unit:"week"}):jo(s,e.length)},d:function(t,e,n){return e==="do"?n.ordinalNumber(t.getDate(),{unit:"date"}):o0.d(t,e)},D:function(t,e,n){const s=Dct(t);return e==="Do"?n.ordinalNumber(s,{unit:"dayOfYear"}):jo(s,e.length)},E:function(t,e,n){const s=t.getDay();switch(e){case"E":case"EE":case"EEE":return n.day(s,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(s,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(s,{width:"short",context:"formatting"});case"EEEE":default:return n.day(s,{width:"wide",context:"formatting"})}},e:function(t,e,n,s){const a=t.getDay(),o=(a-s.weekStartsOn+8)%7||7;switch(e){case"e":return String(o);case"ee":return jo(o,2);case"eo":return n.ordinalNumber(o,{unit:"day"});case"eee":return n.day(a,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(a,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(a,{width:"short",context:"formatting"});case"eeee":default:return n.day(a,{width:"wide",context:"formatting"})}},c:function(t,e,n,s){const a=t.getDay(),o=(a-s.weekStartsOn+8)%7||7;switch(e){case"c":return String(o);case"cc":return jo(o,e.length);case"co":return n.ordinalNumber(o,{unit:"day"});case"ccc":return n.day(a,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(a,{width:"narrow",context:"standalone"});case"cccccc":return n.day(a,{width:"short",context:"standalone"});case"cccc":default:return n.day(a,{width:"wide",context:"standalone"})}},i:function(t,e,n){const s=t.getDay(),a=s===0?7:s;switch(e){case"i":return String(a);case"ii":return jo(a,e.length);case"io":return n.ordinalNumber(a,{unit:"day"});case"iii":return n.day(s,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(s,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(s,{width:"short",context:"formatting"});case"iiii":default:return n.day(s,{width:"wide",context:"formatting"})}},a:function(t,e,n){const a=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(a,{width:"narrow",context:"formatting"});case"aaaa":default:return n.dayPeriod(a,{width:"wide",context:"formatting"})}},b:function(t,e,n){const s=t.getHours();let a;switch(s===12?a=i4.noon:s===0?a=i4.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=i4.evening:s>=12?a=i4.afternoon:s>=4?a=i4.morning:a=i4.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 o0.h(t,e)},H:function(t,e,n){return e==="Ho"?n.ordinalNumber(t.getHours(),{unit:"hour"}):o0.H(t,e)},K:function(t,e,n){const s=t.getHours()%12;return e==="Ko"?n.ordinalNumber(s,{unit:"hour"}):jo(s,e.length)},k:function(t,e,n){let s=t.getHours();return s===0&&(s=24),e==="ko"?n.ordinalNumber(s,{unit:"hour"}):jo(s,e.length)},m:function(t,e,n){return e==="mo"?n.ordinalNumber(t.getMinutes(),{unit:"minute"}):o0.m(t,e)},s:function(t,e,n){return e==="so"?n.ordinalNumber(t.getSeconds(),{unit:"second"}):o0.s(t,e)},S:function(t,e){return o0.S(t,e)},X:function(t,e,n){const s=t.getTimezoneOffset();if(s===0)return"Z";switch(e){case"X":return Jje(s);case"XXXX":case"XX":return Sw(s);case"XXXXX":case"XXX":default:return Sw(s,":")}},x:function(t,e,n){const s=t.getTimezoneOffset();switch(e){case"x":return Jje(s);case"xxxx":case"xx":return Sw(s);case"xxxxx":case"xxx":default:return Sw(s,":")}},O:function(t,e,n){const s=t.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+Qje(s,":");case"OOOO":default:return"GMT"+Sw(s,":")}},z:function(t,e,n){const s=t.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+Qje(s,":");case"zzzz":default:return"GMT"+Sw(s,":")}},t:function(t,e,n){const s=Math.trunc(t.getTime()/1e3);return jo(s,e.length)},T:function(t,e,n){const s=t.getTime();return jo(s,e.length)}};function Qje(t,e=""){const n=t>0?"-":"+",s=Math.abs(t),a=Math.trunc(s/60),o=s%60;return o===0?n+String(a):n+String(a)+e+jo(o,2)}function Jje(t,e){return t%60===0?(t>0?"-":"+")+jo(Math.abs(t)/60,2):Sw(t,e)}function Sw(t,e=""){const n=t>0?"-":"+",s=Math.abs(t),a=jo(Math.trunc(s/60),2),o=jo(s%60,2);return n+a+e+o}const eke=(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"})}},oOe=(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"})}},Fct=(t,e)=>{const n=t.match(/(P+)(p+)?/)||[],s=n[1],a=n[2];if(!a)return eke(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}}",eke(s,e)).replace("{{time}}",oOe(a,e))},yhe={p:oOe,P:Fct},zct=/^D+$/,Bct=/^Y+$/,$ct=["D","DD","YY","YYYY"];function lOe(t){return zct.test(t)}function cOe(t){return Bct.test(t)}function vhe(t,e,n){const s=Uct(t,e,n);if(console.warn(s),$ct.includes(t))throw new RangeError(s)}function Uct(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 qct=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Vct=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Hct=/^'([^]*?)'?$/,Wct=/''/g,Gct=/[a-zA-Z]/;function yn(t,e,n){var x,y,b,j,C,N,A,E;const s=iv(),a=(n==null?void 0:n.locale)??s.locale??hse,o=(n==null?void 0:n.firstWeekContainsDate)??((y=(x=n==null?void 0:n.locale)==null?void 0:x.options)==null?void 0:y.firstWeekContainsDate)??s.firstWeekContainsDate??((j=(b=s.locale)==null?void 0:b.options)==null?void 0:j.firstWeekContainsDate)??1,l=(n==null?void 0:n.weekStartsOn)??((N=(C=n==null?void 0:n.locale)==null?void 0:C.options)==null?void 0:N.weekStartsOn)??s.weekStartsOn??((E=(A=s.locale)==null?void 0:A.options)==null?void 0:E.weekStartsOn)??0,i=ws(t);if(!xhe(i))throw new RangeError("Invalid time value");let h=e.match(Vct).map(T=>{const L=T[0];if(L==="p"||L==="P"){const z=yhe[L];return z(T,a.formatLong)}return T}).join("").match(qct).map(T=>{if(T==="''")return{isToken:!1,value:"'"};const L=T[0];if(L==="'")return{isToken:!1,value:Kct(T)};if(Xje[L])return{isToken:!0,value:T};if(L.match(Gct))throw new RangeError("Format string contains an unescaped latin alphabet character `"+L+"`");return{isToken:!1,value:T}});a.localize.preprocessor&&(h=a.localize.preprocessor(i,h));const p={firstWeekContainsDate:o,weekStartsOn:l,locale:a};return h.map(T=>{if(!T.isToken)return T.value;const L=T.value;(!(n!=null&&n.useAdditionalWeekYearTokens)&&cOe(L)||!(n!=null&&n.useAdditionalDayOfYearTokens)&&lOe(L))&&vhe(L,e,String(t));const z=Xje[L[0]];return z(i,L,a.localize,p)}).join("")}function Kct(t){const e=t.match(Hct);return e?e[1].replace(Wct,"'"):t}function Zct(t,e,n){const s=iv(),a=(n==null?void 0:n.locale)??s.locale??hse,o=2520,l=iee(t,e);if(isNaN(l))throw new RangeError("Invalid time value");const i=Object.assign({},n,{addSuffix:n==null?void 0:n.addSuffix,comparison:l});let h,p;l>0?(h=ws(e),p=ws(t)):(h=ws(t),p=ws(e));const x=nct(p,h),y=($1(p)-$1(h))/1e3,b=Math.round((x-y)/60);let j;if(b<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):b===0?a.formatDistance("lessThanXMinutes",1,i):a.formatDistance("xMinutes",b,i);if(b<45)return a.formatDistance("xMinutes",b,i);if(b<90)return a.formatDistance("aboutXHours",1,i);if(bs.getTime()}function fse(t,e){const n=ws(t),s=ws(e);return+n<+s}function rdt(t){return+ws(t)>Date.now()}function ndt(t,e){const n=e instanceof Date?ko(e,0):new e(0);return n.setFullYear(t.getFullYear(),t.getMonth(),t.getDate()),n.setHours(t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()),n}const sdt=10;class dOe{constructor(){Gn(this,"subPriority",0)}validate(e,n){return!0}}class adt extends dOe{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 idt extends dOe{constructor(){super(...arguments);Gn(this,"priority",sdt);Gn(this,"subPriority",-1)}set(n,s){return s.timestampIsSet?n:ko(n,ndt(n,Date))}}class ho{run(e,n,s,a){const o=this.parse(e,n,s,a);return o?{setter:new adt(o.value,this.validate,this.set,this.priority,this.subPriority),rest:o.rest}:null}validate(e,n,s){return!0}}class odt extends ho{constructor(){super(...arguments);Gn(this,"priority",140);Gn(this,"incompatibleTokens",["R","u","t","T"])}parse(n,s,a){switch(s){case"G":case"GG":case"GGG":return a.era(n,{width:"abbreviated"})||a.era(n,{width:"narrow"});case"GGGGG":return a.era(n,{width:"narrow"});case"GGGG":default:return a.era(n,{width:"wide"})||a.era(n,{width:"abbreviated"})||a.era(n,{width:"narrow"})}}set(n,s,a){return s.era=a,n.setFullYear(a,0,1),n.setHours(0,0,0,0),n}}const dc={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}/},ig={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 uc(t,e){return t&&{value:e(t.value),rest:t.rest}}function Ll(t,e){const n=e.match(t);return n?{value:parseInt(n[0],10),rest:e.slice(n[0].length)}:null}function og(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*nOe+o*rOe+l*Vlt),rest:e.slice(n[0].length)}}function uOe(t){return Ll(dc.anyDigitsSigned,t)}function ec(t,e){switch(t){case 1:return Ll(dc.singleDigit,e);case 2:return Ll(dc.twoDigits,e);case 3:return Ll(dc.threeDigits,e);case 4:return Ll(dc.fourDigits,e);default:return Ll(new RegExp("^\\d{1,"+t+"}"),e)}}function pte(t,e){switch(t){case 1:return Ll(dc.singleDigitSigned,e);case 2:return Ll(dc.twoDigitsSigned,e);case 3:return Ll(dc.threeDigitsSigned,e);case 4:return Ll(dc.fourDigitsSigned,e);default:return Ll(new RegExp("^-?\\d{1,"+t+"}"),e)}}function axe(t){switch(t){case"morning":return 4;case"evening":return 17;case"pm":case"noon":case"afternoon":return 12;case"am":case"midnight":case"night":default:return 0}}function hOe(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 fOe(t){return t%400===0||t%4===0&&t%100!==0}class ldt extends ho{constructor(){super(...arguments);Gn(this,"priority",130);Gn(this,"incompatibleTokens",["Y","R","u","w","I","i","e","c","t","T"])}parse(n,s,a){const o=l=>({year:l,isTwoDigitYear:s==="yy"});switch(s){case"y":return uc(ec(4,n),o);case"yo":return uc(a.ordinalNumber(n,{unit:"year"}),o);default:return uc(ec(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=hOe(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 cdt extends ho{constructor(){super(...arguments);Gn(this,"priority",130);Gn(this,"incompatibleTokens",["y","R","u","Q","q","M","L","I","d","D","i","t","T"])}parse(n,s,a){const o=l=>({year:l,isTwoDigitYear:s==="YY"});switch(s){case"Y":return uc(ec(4,n),o);case"Yo":return uc(a.ordinalNumber(n,{unit:"year"}),o);default:return uc(ec(s.length,n),o)}}validate(n,s){return s.isTwoDigitYear||s.year>0}set(n,s,a,o){const l=nxe(n,o);if(a.isTwoDigitYear){const h=hOe(a.year,l);return n.setFullYear(h,0,o.firstWeekContainsDate),n.setHours(0,0,0,0),df(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),df(n,o)}}class ddt extends ho{constructor(){super(...arguments);Gn(this,"priority",130);Gn(this,"incompatibleTokens",["G","y","Y","u","Q","q","M","L","w","d","D","e","c","t","T"])}parse(n,s){return pte(s==="R"?4:s.length,n)}set(n,s,a){const o=ko(n,0);return o.setFullYear(a,0,4),o.setHours(0,0,0,0),ay(o)}}class udt extends ho{constructor(){super(...arguments);Gn(this,"priority",130);Gn(this,"incompatibleTokens",["G","y","Y","R","w","I","i","e","c","t","T"])}parse(n,s){return pte(s==="u"?4:s.length,n)}set(n,s,a){return n.setFullYear(a,0,1),n.setHours(0,0,0,0),n}}class hdt extends ho{constructor(){super(...arguments);Gn(this,"priority",120);Gn(this,"incompatibleTokens",["Y","R","q","M","L","w","I","d","D","i","e","c","t","T"])}parse(n,s,a){switch(s){case"Q":case"QQ":return ec(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 fdt extends ho{constructor(){super(...arguments);Gn(this,"priority",120);Gn(this,"incompatibleTokens",["Y","R","Q","M","L","w","I","d","D","i","e","c","t","T"])}parse(n,s,a){switch(s){case"q":case"qq":return ec(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 pdt extends ho{constructor(){super(...arguments);Gn(this,"incompatibleTokens",["Y","R","q","Q","L","w","I","D","i","e","c","t","T"]);Gn(this,"priority",110)}parse(n,s,a){const o=l=>l-1;switch(s){case"M":return uc(Ll(dc.month,n),o);case"MM":return uc(ec(2,n),o);case"Mo":return uc(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 mdt extends ho{constructor(){super(...arguments);Gn(this,"priority",110);Gn(this,"incompatibleTokens",["Y","R","q","Q","M","w","I","D","i","e","c","t","T"])}parse(n,s,a){const o=l=>l-1;switch(s){case"L":return uc(Ll(dc.month,n),o);case"LL":return uc(ec(2,n),o);case"Lo":return uc(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 gdt(t,e,n){const s=ws(t),a=sxe(s,n)-e;return s.setDate(s.getDate()-a*7),s}class xdt extends ho{constructor(){super(...arguments);Gn(this,"priority",100);Gn(this,"incompatibleTokens",["y","R","u","q","Q","M","L","I","d","D","i","t","T"])}parse(n,s,a){switch(s){case"w":return Ll(dc.week,n);case"wo":return a.ordinalNumber(n,{unit:"week"});default:return ec(s.length,n)}}validate(n,s){return s>=1&&s<=53}set(n,s,a,o){return df(gdt(n,a,o),o)}}function ydt(t,e){const n=ws(t),s=rxe(n)-e;return n.setDate(n.getDate()-s*7),n}class vdt extends ho{constructor(){super(...arguments);Gn(this,"priority",100);Gn(this,"incompatibleTokens",["y","Y","u","q","Q","M","L","w","d","D","e","c","t","T"])}parse(n,s,a){switch(s){case"I":return Ll(dc.week,n);case"Io":return a.ordinalNumber(n,{unit:"week"});default:return ec(s.length,n)}}validate(n,s){return s>=1&&s<=53}set(n,s,a){return ay(ydt(n,a))}}const _dt=[31,28,31,30,31,30,31,31,30,31,30,31],bdt=[31,29,31,30,31,30,31,31,30,31,30,31];class wdt extends ho{constructor(){super(...arguments);Gn(this,"priority",90);Gn(this,"subPriority",1);Gn(this,"incompatibleTokens",["Y","R","q","Q","w","I","D","i","e","c","t","T"])}parse(n,s,a){switch(s){case"d":return Ll(dc.date,n);case"do":return a.ordinalNumber(n,{unit:"date"});default:return ec(s.length,n)}}validate(n,s){const a=n.getFullYear(),o=fOe(a),l=n.getMonth();return o?s>=1&&s<=bdt[l]:s>=1&&s<=_dt[l]}set(n,s,a){return n.setDate(a),n.setHours(0,0,0,0),n}}class jdt extends ho{constructor(){super(...arguments);Gn(this,"priority",90);Gn(this,"subpriority",1);Gn(this,"incompatibleTokens",["Y","R","q","Q","M","L","w","I","d","E","i","e","c","t","T"])}parse(n,s,a){switch(s){case"D":case"DD":return Ll(dc.dayOfYear,n);case"Do":return a.ordinalNumber(n,{unit:"date"});default:return ec(s.length,n)}}validate(n,s){const a=n.getFullYear();return fOe(a)?s>=1&&s<=366:s>=1&&s<=365}set(n,s,a){return n.setMonth(0,a),n.setHours(0,0,0,0),n}}function ixe(t,e,n){var y,b,j,C;const s=iv(),a=(n==null?void 0:n.weekStartsOn)??((b=(y=n==null?void 0:n.locale)==null?void 0:y.options)==null?void 0:b.weekStartsOn)??s.weekStartsOn??((C=(j=s.locale)==null?void 0:j.options)==null?void 0:C.weekStartsOn)??0,o=ws(t),l=o.getDay(),h=(e%7+7)%7,p=7-a,x=e<0||e>6?e-(l+p)%7:(h+p)%7-(l+p)%7;return Kl(o,x)}class kdt extends ho{constructor(){super(...arguments);Gn(this,"priority",90);Gn(this,"incompatibleTokens",["D","i","e","c","t","T"])}parse(n,s,a){switch(s){case"E":case"EE":case"EEE":return a.day(n,{width:"abbreviated",context:"formatting"})||a.day(n,{width:"short",context:"formatting"})||a.day(n,{width:"narrow",context:"formatting"});case"EEEEE":return a.day(n,{width:"narrow",context:"formatting"});case"EEEEEE":return a.day(n,{width:"short",context:"formatting"})||a.day(n,{width:"narrow",context:"formatting"});case"EEEE":default:return a.day(n,{width:"wide",context:"formatting"})||a.day(n,{width:"abbreviated",context:"formatting"})||a.day(n,{width:"short",context:"formatting"})||a.day(n,{width:"narrow",context:"formatting"})}}validate(n,s){return s>=0&&s<=6}set(n,s,a,o){return n=ixe(n,a,o),n.setHours(0,0,0,0),n}}class Ndt extends ho{constructor(){super(...arguments);Gn(this,"priority",90);Gn(this,"incompatibleTokens",["y","R","u","q","Q","M","L","I","d","D","E","i","c","t","T"])}parse(n,s,a,o){const l=i=>{const h=Math.floor((i-1)/7)*7;return(i+o.weekStartsOn+6)%7+h};switch(s){case"e":case"ee":return uc(ec(s.length,n),l);case"eo":return uc(a.ordinalNumber(n,{unit:"day"}),l);case"eee":return a.day(n,{width:"abbreviated",context:"formatting"})||a.day(n,{width:"short",context:"formatting"})||a.day(n,{width:"narrow",context:"formatting"});case"eeeee":return a.day(n,{width:"narrow",context:"formatting"});case"eeeeee":return a.day(n,{width:"short",context:"formatting"})||a.day(n,{width:"narrow",context:"formatting"});case"eeee":default:return a.day(n,{width:"wide",context:"formatting"})||a.day(n,{width:"abbreviated",context:"formatting"})||a.day(n,{width:"short",context:"formatting"})||a.day(n,{width:"narrow",context:"formatting"})}}validate(n,s){return s>=0&&s<=6}set(n,s,a,o){return n=ixe(n,a,o),n.setHours(0,0,0,0),n}}class Sdt extends ho{constructor(){super(...arguments);Gn(this,"priority",90);Gn(this,"incompatibleTokens",["y","R","u","q","Q","M","L","I","d","D","E","i","e","t","T"])}parse(n,s,a,o){const l=i=>{const h=Math.floor((i-1)/7)*7;return(i+o.weekStartsOn+6)%7+h};switch(s){case"c":case"cc":return uc(ec(s.length,n),l);case"co":return uc(a.ordinalNumber(n,{unit:"day"}),l);case"ccc":return a.day(n,{width:"abbreviated",context:"standalone"})||a.day(n,{width:"short",context:"standalone"})||a.day(n,{width:"narrow",context:"standalone"});case"ccccc":return a.day(n,{width:"narrow",context:"standalone"});case"cccccc":return a.day(n,{width:"short",context:"standalone"})||a.day(n,{width:"narrow",context:"standalone"});case"cccc":default:return a.day(n,{width:"wide",context:"standalone"})||a.day(n,{width:"abbreviated",context:"standalone"})||a.day(n,{width:"short",context:"standalone"})||a.day(n,{width:"narrow",context:"standalone"})}}validate(n,s){return s>=0&&s<=6}set(n,s,a,o){return n=ixe(n,a,o),n.setHours(0,0,0,0),n}}function Cdt(t,e){const n=ws(t),s=Qct(n),a=e-s;return Kl(n,a)}class Mdt extends ho{constructor(){super(...arguments);Gn(this,"priority",90);Gn(this,"incompatibleTokens",["y","Y","u","q","Q","M","L","w","d","D","E","e","c","t","T"])}parse(n,s,a){const o=l=>l===0?7:l;switch(s){case"i":case"ii":return ec(s.length,n);case"io":return a.ordinalNumber(n,{unit:"day"});case"iii":return uc(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 uc(a.day(n,{width:"narrow",context:"formatting"}),o);case"iiiiii":return uc(a.day(n,{width:"short",context:"formatting"})||a.day(n,{width:"narrow",context:"formatting"}),o);case"iiii":default:return uc(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=Cdt(n,a),n.setHours(0,0,0,0),n}}class Tdt extends ho{constructor(){super(...arguments);Gn(this,"priority",80);Gn(this,"incompatibleTokens",["b","B","H","k","t","T"])}parse(n,s,a){switch(s){case"a":case"aa":case"aaa":return a.dayPeriod(n,{width:"abbreviated",context:"formatting"})||a.dayPeriod(n,{width:"narrow",context:"formatting"});case"aaaaa":return a.dayPeriod(n,{width:"narrow",context:"formatting"});case"aaaa":default:return a.dayPeriod(n,{width:"wide",context:"formatting"})||a.dayPeriod(n,{width:"abbreviated",context:"formatting"})||a.dayPeriod(n,{width:"narrow",context:"formatting"})}}set(n,s,a){return n.setHours(axe(a),0,0,0),n}}class Adt extends ho{constructor(){super(...arguments);Gn(this,"priority",80);Gn(this,"incompatibleTokens",["a","B","H","k","t","T"])}parse(n,s,a){switch(s){case"b":case"bb":case"bbb":return a.dayPeriod(n,{width:"abbreviated",context:"formatting"})||a.dayPeriod(n,{width:"narrow",context:"formatting"});case"bbbbb":return a.dayPeriod(n,{width:"narrow",context:"formatting"});case"bbbb":default:return a.dayPeriod(n,{width:"wide",context:"formatting"})||a.dayPeriod(n,{width:"abbreviated",context:"formatting"})||a.dayPeriod(n,{width:"narrow",context:"formatting"})}}set(n,s,a){return n.setHours(axe(a),0,0,0),n}}class Edt extends ho{constructor(){super(...arguments);Gn(this,"priority",80);Gn(this,"incompatibleTokens",["a","b","t","T"])}parse(n,s,a){switch(s){case"B":case"BB":case"BBB":return a.dayPeriod(n,{width:"abbreviated",context:"formatting"})||a.dayPeriod(n,{width:"narrow",context:"formatting"});case"BBBBB":return a.dayPeriod(n,{width:"narrow",context:"formatting"});case"BBBB":default:return a.dayPeriod(n,{width:"wide",context:"formatting"})||a.dayPeriod(n,{width:"abbreviated",context:"formatting"})||a.dayPeriod(n,{width:"narrow",context:"formatting"})}}set(n,s,a){return n.setHours(axe(a),0,0,0),n}}class Idt extends ho{constructor(){super(...arguments);Gn(this,"priority",70);Gn(this,"incompatibleTokens",["H","K","k","t","T"])}parse(n,s,a){switch(s){case"h":return Ll(dc.hour12h,n);case"ho":return a.ordinalNumber(n,{unit:"hour"});default:return ec(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 Pdt extends ho{constructor(){super(...arguments);Gn(this,"priority",70);Gn(this,"incompatibleTokens",["a","b","h","K","k","t","T"])}parse(n,s,a){switch(s){case"H":return Ll(dc.hour23h,n);case"Ho":return a.ordinalNumber(n,{unit:"hour"});default:return ec(s.length,n)}}validate(n,s){return s>=0&&s<=23}set(n,s,a){return n.setHours(a,0,0,0),n}}class Ldt extends ho{constructor(){super(...arguments);Gn(this,"priority",70);Gn(this,"incompatibleTokens",["h","H","k","t","T"])}parse(n,s,a){switch(s){case"K":return Ll(dc.hour11h,n);case"Ko":return a.ordinalNumber(n,{unit:"hour"});default:return ec(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 Odt extends ho{constructor(){super(...arguments);Gn(this,"priority",70);Gn(this,"incompatibleTokens",["a","b","h","H","K","t","T"])}parse(n,s,a){switch(s){case"k":return Ll(dc.hour24h,n);case"ko":return a.ordinalNumber(n,{unit:"hour"});default:return ec(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 Ddt extends ho{constructor(){super(...arguments);Gn(this,"priority",60);Gn(this,"incompatibleTokens",["t","T"])}parse(n,s,a){switch(s){case"m":return Ll(dc.minute,n);case"mo":return a.ordinalNumber(n,{unit:"minute"});default:return ec(s.length,n)}}validate(n,s){return s>=0&&s<=59}set(n,s,a){return n.setMinutes(a,0,0),n}}class Rdt extends ho{constructor(){super(...arguments);Gn(this,"priority",50);Gn(this,"incompatibleTokens",["t","T"])}parse(n,s,a){switch(s){case"s":return Ll(dc.second,n);case"so":return a.ordinalNumber(n,{unit:"second"});default:return ec(s.length,n)}}validate(n,s){return s>=0&&s<=59}set(n,s,a){return n.setSeconds(a,0),n}}class Fdt extends ho{constructor(){super(...arguments);Gn(this,"priority",30);Gn(this,"incompatibleTokens",["t","T"])}parse(n,s){const a=o=>Math.trunc(o*Math.pow(10,-s.length+3));return uc(ec(s.length,n),a)}set(n,s,a){return n.setMilliseconds(a),n}}class zdt extends ho{constructor(){super(...arguments);Gn(this,"priority",10);Gn(this,"incompatibleTokens",["t","T","x"])}parse(n,s){switch(s){case"X":return og(ig.basicOptionalMinutes,n);case"XX":return og(ig.basic,n);case"XXXX":return og(ig.basicOptionalSeconds,n);case"XXXXX":return og(ig.extendedOptionalSeconds,n);case"XXX":default:return og(ig.extended,n)}}set(n,s,a){return s.timestampIsSet?n:ko(n,n.getTime()-$1(n)-a)}}class Bdt extends ho{constructor(){super(...arguments);Gn(this,"priority",10);Gn(this,"incompatibleTokens",["t","T","X"])}parse(n,s){switch(s){case"x":return og(ig.basicOptionalMinutes,n);case"xx":return og(ig.basic,n);case"xxxx":return og(ig.basicOptionalSeconds,n);case"xxxxx":return og(ig.extendedOptionalSeconds,n);case"xxx":default:return og(ig.extended,n)}}set(n,s,a){return s.timestampIsSet?n:ko(n,n.getTime()-$1(n)-a)}}class $dt extends ho{constructor(){super(...arguments);Gn(this,"priority",40);Gn(this,"incompatibleTokens","*")}parse(n){return uOe(n)}set(n,s,a){return[ko(n,a*1e3),{timestampIsSet:!0}]}}class Udt extends ho{constructor(){super(...arguments);Gn(this,"priority",20);Gn(this,"incompatibleTokens","*")}parse(n){return uOe(n)}set(n,s,a){return[ko(n,a),{timestampIsSet:!0}]}}const qdt={G:new odt,y:new ldt,Y:new cdt,R:new ddt,u:new udt,Q:new hdt,q:new fdt,M:new pdt,L:new mdt,w:new xdt,I:new vdt,d:new wdt,D:new jdt,E:new kdt,e:new Ndt,c:new Sdt,i:new Mdt,a:new Tdt,b:new Adt,B:new Edt,h:new Idt,H:new Pdt,K:new Ldt,k:new Odt,m:new Ddt,s:new Rdt,S:new Fdt,X:new zdt,x:new Bdt,t:new $dt,T:new Udt},Vdt=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Hdt=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Wdt=/^'([^]*?)'?$/,Gdt=/''/g,Kdt=/\S/,Zdt=/[a-zA-Z]/;function oxe(t,e,n,s){var N,A,E,T;const a=Xct(),o=a.locale??hse,l=a.firstWeekContainsDate??((A=(N=a.locale)==null?void 0:N.options)==null?void 0:A.firstWeekContainsDate)??1,i=a.weekStartsOn??((T=(E=a.locale)==null?void 0:E.options)==null?void 0:T.weekStartsOn)??0;if(e==="")return t===""?ws(n):ko(n,NaN);const h={firstWeekContainsDate:l,weekStartsOn:i,locale:o},p=[new idt],x=e.match(Hdt).map(L=>{const z=L[0];if(z in yhe){const F=yhe[z];return F(L,o.formatLong)}return L}).join("").match(Vdt),y=[];for(let L of x){cOe(L)&&vhe(L,e,t),lOe(L)&&vhe(L,e,t);const z=L[0],F=qdt[z];if(F){const{incompatibleTokens:q}=F;if(Array.isArray(q)){const Z=y.find(G=>q.includes(G.token)||G.token===z);if(Z)throw new RangeError(`The format string mustn't contain \`${Z.fullToken}\` and \`${L}\` at the same time`)}else if(F.incompatibleTokens==="*"&&y.length>0)throw new RangeError(`The format string mustn't contain \`${L}\` and any other token at the same time`);y.push({token:z,fullToken:L});const H=F.run(t,L,o.match,h);if(!H)return ko(n,NaN);p.push(H.setter),t=H.rest}else{if(z.match(Zdt))throw new RangeError("Format string contains an unescaped latin alphabet character `"+z+"`");if(L==="''"?L="'":z==="'"&&(L=Ydt(L)),t.indexOf(L)===0)t=t.slice(L.length);else return ko(n,NaN)}}if(t.length>0&&Kdt.test(t))return ko(n,NaN);const b=p.map(L=>L.priority).sort((L,z)=>z-L).filter((L,z,F)=>F.indexOf(L)===z).map(L=>p.filter(z=>z.priority===L).sort((z,F)=>F.subPriority-z.subPriority)).map(L=>L[0]);let j=ws(n);if(isNaN(j.getTime()))return ko(n,NaN);const C={};for(const L of b){if(!L.validate(j,h))return ko(n,NaN);const z=L.set(j,C,h);Array.isArray(z)?(j=z[0],Object.assign(C,z[1])):j=z}return ko(n,j)}function Ydt(t){return t.match(Wdt)[1].replace(Gdt,"'")}function Xdt(t){return+ws(t)o-l);return n>=s&&n<=a}function Hle(t,e){return Kl(t,-e)}function Wle(t,e){const n=ws(t),s=n.getFullYear(),a=n.getDate(),o=ko(t,0);o.setFullYear(s,e,15),o.setHours(0,0,0,0);const l=Yct(o);return n.setMonth(e,Math.min(a,l)),n}function pOe(t,e){const n=ws(t);return n.setHours(e),n}function mOe(t,e){const n=ws(t);return n.setMinutes(e),n}function mte(t,e){const n=ws(t);return isNaN(+n)?ko(t,NaN):(n.setFullYear(e),n)}function Jdt(t,e){return bh(t,-12)}const eut=()=>{const{user:t}=Qr(),e=rs(),[n,s]=I.useState([]),[a,o]=I.useState(0),[l,i]=I.useState(!1),[h,p]=I.useState(null);I.useEffect(()=>{if(!t)return;const C=`notification_last_read_${t.id}`;let N=h;if(!N){const T=localStorage.getItem(C);T&&(N=T,p(T))}(async()=>{const{data:T,error:L}=await J.from("push_notifications").select("*").order("created_at",{ascending:!1}).limit(20);if(!L&&T){s(T);const z=N?new Date(N):null,F=T.filter(q=>z?new Date(q.created_at)>z:!0);o(F.length)}})();const E=J.channel("push-notifications").on("postgres_changes",{event:"INSERT",schema:"public",table:"push_notifications"},T=>{const L=T.new;s(F=>[L,...F].slice(0,20));const z=N?new Date(N):null;(!z||new Date(L.created_at)>z)&&o(F=>F+1),Notification.permission==="granted"&&new Notification(L.title,{body:L.body,icon:"/favicon.ico"})}).subscribe();return()=>{J.removeChannel(E)}},[t,h]);const x=C=>{const N=C.toLowerCase();return N.includes("community")||N.includes("post")?Lo:N.includes("academy")||N.includes("video")?Pa:N.includes("template")?Fd:N.includes("event")?zs:N.includes("newsletter")?Vx:N.includes("brokerage")?yh:N.includes("swag")||N.includes("social")?Ki:N.includes("toolbox")||N.includes("tool")?Wx:N.includes("brief")?Ms:Lo},y=C=>{i(!1),C.url&&C.url!=="/"&&e(C.url)},b=()=>{if(!t)return;const C=new Date().toISOString(),N=`notification_last_read_${t.id}`;localStorage.setItem(N,C),p(C),o(0)},j=C=>{i(C),C&&a>0&&b()};return r.jsxs(wh,{open:l,onOpenChange:j,children:[r.jsx(jh,{asChild:!0,children:r.jsxs(ee,{variant:"ghost",size:"icon",className:"relative",children:[r.jsx(gg,{className:"h-5 w-5"}),a>0&&r.jsx(Ot,{variant:"destructive",className:"absolute -top-1 -right-1 h-5 w-5 flex items-center justify-center p-0 text-xs",children:a>9?"9+":a})]})}),r.jsxs(Wu,{align:"end",className:"w-80",children:[r.jsxs("div",{className:"flex items-center justify-between px-3 py-2 border-b",children:[r.jsx("span",{className:"font-semibold",children:"Notifications"}),n.length>0&&r.jsx(ee,{variant:"ghost",size:"sm",className:"text-xs h-6",onClick:b,children:"Mark all read"})]}),r.jsx(Jo,{className:"h-[300px]",children:n.length===0?r.jsx("div",{className:"p-4 text-center text-muted-foreground text-sm",children:"No notifications yet"}):n.map(C=>{const N=x(C.title);return r.jsxs(di,{className:"group flex items-start gap-3 p-3 cursor-pointer data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground",onClick:()=>y(C),children:[r.jsx("div",{className:"flex-shrink-0 mt-0.5",children:r.jsx(N,{className:"h-4 w-4 text-primary"})}),r.jsxs("div",{className:"flex flex-col gap-1 min-w-0",children:[r.jsx("span",{className:"font-medium text-sm",children:C.title}),r.jsx("span",{className:"text-xs text-muted-foreground line-clamp-2 group-data-[highlighted]:text-accent-foreground/80",children:C.body}),r.jsx("span",{className:"text-xs text-muted-foreground group-data-[highlighted]:text-accent-foreground/80",children:cu(new Date(C.created_at),{addSuffix:!0})})]})]},C.id)})})]})]})};var nke=1,tut=.9,rut=.8,nut=.17,Gle=.1,Kle=.999,sut=.9999,aut=.99,iut=/[\\\/_+.#"@\[\(\{&]/,out=/[\\\/_+.#"@\[\(\{&]/g,lut=/[\s-]/,gOe=/[\s-]/g;function _he(t,e,n,s,a,o,l){if(o===e.length)return a===t.length?nke:aut;var i=`${a},${o}`;if(l[i]!==void 0)return l[i];for(var h=s.charAt(o),p=n.indexOf(h,a),x=0,y,b,j,C;p>=0;)y=_he(t,e,n,s,p+1,o+1,l),y>x&&(p===a?y*=nke:iut.test(t.charAt(p-1))?(y*=rut,j=t.slice(a,p-1).match(out),j&&a>0&&(y*=Math.pow(Kle,j.length))):lut.test(t.charAt(p-1))?(y*=tut,C=t.slice(a,p-1).match(gOe),C&&a>0&&(y*=Math.pow(Kle,C.length))):(y*=nut,a>0&&(y*=Math.pow(Kle,p-a))),t.charAt(p)!==e.charAt(o)&&(y*=sut)),(yy&&(y=b*Gle)),y>x&&(x=y),p=n.indexOf(h,p+1);return l[i]=x,x}function ske(t){return t.toLowerCase().replace(gOe," ")}function cut(t,e,n){return t=n&&n.length>0?`${t+" "+n.join(" ")}`:t,_he(t,e,ske(t),ske(e),0,0,{})}var DM='[cmdk-group=""]',Zle='[cmdk-group-items=""]',dut='[cmdk-group-heading=""]',xOe='[cmdk-item=""]',ake=`${xOe}:not([aria-disabled="true"])`,bhe="cmdk-item-select",v4="data-value",uut=(t,e,n)=>cut(t,e,n),yOe=I.createContext(void 0),CI=()=>I.useContext(yOe),vOe=I.createContext(void 0),cxe=()=>I.useContext(vOe),_Oe=I.createContext(void 0),bOe=I.forwardRef((t,e)=>{let n=_4(()=>{var be,me;return{search:"",value:(me=(be=t.value)!=null?be:t.defaultValue)!=null?me:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),s=_4(()=>new Set),a=_4(()=>new Map),o=_4(()=>new Map),l=_4(()=>new Set),i=wOe(t),{label:h,children:p,value:x,onValueChange:y,filter:b,shouldFilter:j,loop:C,disablePointerSelection:N=!1,vimBindings:A=!0,...E}=t,T=Gc(),L=Gc(),z=Gc(),F=I.useRef(null),q=wut();Vj(()=>{if(x!==void 0){let be=x.trim();n.current.value=be,H.emit()}},[x]),Vj(()=>{q(6,ye)},[]);let H=I.useMemo(()=>({subscribe:be=>(l.current.add(be),()=>l.current.delete(be)),snapshot:()=>n.current,setState:(be,me,Le)=>{var Ne,Be,Ee,Ue;if(!Object.is(n.current[be],me)){if(n.current[be]=me,be==="search")le(),te(),q(1,ie);else if(be==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let Re=document.getElementById(z);Re?Re.focus():(Ne=document.getElementById(T))==null||Ne.focus()}if(q(7,()=>{var Re;n.current.selectedItemId=(Re=ne())==null?void 0:Re.id,H.emit()}),Le||q(5,ye),((Be=i.current)==null?void 0:Be.value)!==void 0){let Re=me??"";(Ue=(Ee=i.current).onValueChange)==null||Ue.call(Ee,Re);return}}H.emit()}},emit:()=>{l.current.forEach(be=>be())}}),[]),Z=I.useMemo(()=>({value:(be,me,Le)=>{var Ne;me!==((Ne=o.current.get(be))==null?void 0:Ne.value)&&(o.current.set(be,{value:me,keywords:Le}),n.current.filtered.items.set(be,G(me,Le)),q(2,()=>{te(),H.emit()}))},item:(be,me)=>(s.current.add(be),me&&(a.current.has(me)?a.current.get(me).add(be):a.current.set(me,new Set([be]))),q(3,()=>{le(),te(),n.current.value||ie(),H.emit()}),()=>{o.current.delete(be),s.current.delete(be),n.current.filtered.items.delete(be);let Le=ne();q(4,()=>{le(),(Le==null?void 0:Le.getAttribute("id"))===be&&ie(),H.emit()})}),group:be=>(a.current.has(be)||a.current.set(be,new Set),()=>{o.current.delete(be),a.current.delete(be)}),filter:()=>i.current.shouldFilter,label:h||t["aria-label"],getDisablePointerSelection:()=>i.current.disablePointerSelection,listId:T,inputId:z,labelId:L,listInnerRef:F}),[]);function G(be,me){var Le,Ne;let Be=(Ne=(Le=i.current)==null?void 0:Le.filter)!=null?Ne:uut;return be?Be(be,n.current.search,me):0}function te(){if(!n.current.search||i.current.shouldFilter===!1)return;let be=n.current.filtered.items,me=[];n.current.filtered.groups.forEach(Ne=>{let Be=a.current.get(Ne),Ee=0;Be.forEach(Ue=>{let Re=be.get(Ue);Ee=Math.max(Re,Ee)}),me.push([Ne,Ee])});let Le=F.current;ge().sort((Ne,Be)=>{var Ee,Ue;let Re=Ne.getAttribute("id"),je=Be.getAttribute("id");return((Ee=be.get(je))!=null?Ee:0)-((Ue=be.get(Re))!=null?Ue:0)}).forEach(Ne=>{let Be=Ne.closest(Zle);Be?Be.appendChild(Ne.parentElement===Be?Ne:Ne.closest(`${Zle} > *`)):Le.appendChild(Ne.parentElement===Le?Ne:Ne.closest(`${Zle} > *`))}),me.sort((Ne,Be)=>Be[1]-Ne[1]).forEach(Ne=>{var Be;let Ee=(Be=F.current)==null?void 0:Be.querySelector(`${DM}[${v4}="${encodeURIComponent(Ne[0])}"]`);Ee==null||Ee.parentElement.appendChild(Ee)})}function ie(){let be=ge().find(Le=>Le.getAttribute("aria-disabled")!=="true"),me=be==null?void 0:be.getAttribute(v4);H.setState("value",me||void 0)}function le(){var be,me,Le,Ne;if(!n.current.search||i.current.shouldFilter===!1){n.current.filtered.count=s.current.size;return}n.current.filtered.groups=new Set;let Be=0;for(let Ee of s.current){let Ue=(me=(be=o.current.get(Ee))==null?void 0:be.value)!=null?me:"",Re=(Ne=(Le=o.current.get(Ee))==null?void 0:Le.keywords)!=null?Ne:[],je=G(Ue,Re);n.current.filtered.items.set(Ee,je),je>0&&Be++}for(let[Ee,Ue]of a.current)for(let Re of Ue)if(n.current.filtered.items.get(Re)>0){n.current.filtered.groups.add(Ee);break}n.current.filtered.count=Be}function ye(){var be,me,Le;let Ne=ne();Ne&&(((be=Ne.parentElement)==null?void 0:be.firstChild)===Ne&&((Le=(me=Ne.closest(DM))==null?void 0:me.querySelector(dut))==null||Le.scrollIntoView({block:"nearest"})),Ne.scrollIntoView({block:"nearest"}))}function ne(){var be;return(be=F.current)==null?void 0:be.querySelector(`${xOe}[aria-selected="true"]`)}function ge(){var be;return Array.from(((be=F.current)==null?void 0:be.querySelectorAll(ake))||[])}function ae(be){let me=ge()[be];me&&H.setState("value",me.getAttribute(v4))}function he(be){var me;let Le=ne(),Ne=ge(),Be=Ne.findIndex(Ue=>Ue===Le),Ee=Ne[Be+be];(me=i.current)!=null&&me.loop&&(Ee=Be+be<0?Ne[Ne.length-1]:Be+be===Ne.length?Ne[0]:Ne[Be+be]),Ee&&H.setState("value",Ee.getAttribute(v4))}function ue(be){let me=ne(),Le=me==null?void 0:me.closest(DM),Ne;for(;Le&&!Ne;)Le=be>0?_ut(Le,DM):but(Le,DM),Ne=Le==null?void 0:Le.querySelector(ake);Ne?H.setState("value",Ne.getAttribute(v4)):he(be)}let _e=()=>ae(ge().length-1),Ae=be=>{be.preventDefault(),be.metaKey?_e():be.altKey?ue(1):he(1)},Ce=be=>{be.preventDefault(),be.metaKey?ae(0):be.altKey?ue(-1):he(-1)};return I.createElement(Rn.div,{ref:e,tabIndex:-1,...E,"cmdk-root":"",onKeyDown:be=>{var me;(me=E.onKeyDown)==null||me.call(E,be);let Le=be.nativeEvent.isComposing||be.keyCode===229;if(!(be.defaultPrevented||Le))switch(be.key){case"n":case"j":{A&&be.ctrlKey&&Ae(be);break}case"ArrowDown":{Ae(be);break}case"p":case"k":{A&&be.ctrlKey&&Ce(be);break}case"ArrowUp":{Ce(be);break}case"Home":{be.preventDefault(),ae(0);break}case"End":{be.preventDefault(),_e();break}case"Enter":{be.preventDefault();let Ne=ne();if(Ne){let Be=new Event(bhe);Ne.dispatchEvent(Be)}}}}},I.createElement("label",{"cmdk-label":"",htmlFor:Z.inputId,id:Z.labelId,style:kut},h),pse(t,be=>I.createElement(vOe.Provider,{value:H},I.createElement(yOe.Provider,{value:Z},be))))}),hut=I.forwardRef((t,e)=>{var n,s;let a=Gc(),o=I.useRef(null),l=I.useContext(_Oe),i=CI(),h=wOe(t),p=(s=(n=h.current)==null?void 0:n.forceMount)!=null?s:l==null?void 0:l.forceMount;Vj(()=>{if(!p)return i.item(a,l==null?void 0:l.id)},[p]);let x=jOe(a,o,[t.value,t.children,o],t.keywords),y=cxe(),b=U1(q=>q.value&&q.value===x.current),j=U1(q=>p||i.filter()===!1?!0:q.search?q.filtered.items.get(a)>0:!0);I.useEffect(()=>{let q=o.current;if(!(!q||t.disabled))return q.addEventListener(bhe,C),()=>q.removeEventListener(bhe,C)},[j,t.onSelect,t.disabled]);function C(){var q,H;N(),(H=(q=h.current).onSelect)==null||H.call(q,x.current)}function N(){y.setState("value",x.current,!0)}if(!j)return null;let{disabled:A,value:E,onSelect:T,forceMount:L,keywords:z,...F}=t;return I.createElement(Rn.div,{ref:ry(o,e),...F,id:a,"cmdk-item":"",role:"option","aria-disabled":!!A,"aria-selected":!!b,"data-disabled":!!A,"data-selected":!!b,onPointerMove:A||i.getDisablePointerSelection()?void 0:N,onClick:A?void 0:C},t.children)}),fut=I.forwardRef((t,e)=>{let{heading:n,children:s,forceMount:a,...o}=t,l=Gc(),i=I.useRef(null),h=I.useRef(null),p=Gc(),x=CI(),y=U1(j=>a||x.filter()===!1?!0:j.search?j.filtered.groups.has(l):!0);Vj(()=>x.group(l),[]),jOe(l,i,[t.value,t.heading,h]);let b=I.useMemo(()=>({id:l,forceMount:a}),[a]);return I.createElement(Rn.div,{ref:ry(i,e),...o,"cmdk-group":"",role:"presentation",hidden:y?void 0:!0},n&&I.createElement("div",{ref:h,"cmdk-group-heading":"","aria-hidden":!0,id:p},n),pse(t,j=>I.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?p:void 0},I.createElement(_Oe.Provider,{value:b},j))))}),put=I.forwardRef((t,e)=>{let{alwaysRender:n,...s}=t,a=I.useRef(null),o=U1(l=>!l.search);return!n&&!o?null:I.createElement(Rn.div,{ref:ry(a,e),...s,"cmdk-separator":"",role:"separator"})}),mut=I.forwardRef((t,e)=>{let{onValueChange:n,...s}=t,a=t.value!=null,o=cxe(),l=U1(p=>p.search),i=U1(p=>p.selectedItemId),h=CI();return I.useEffect(()=>{t.value!=null&&o.setState("search",t.value)},[t.value]),I.createElement(Rn.input,{ref:e,...s,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":h.listId,"aria-labelledby":h.labelId,"aria-activedescendant":i,id:h.inputId,type:"text",value:a?t.value:l,onChange:p=>{a||o.setState("search",p.target.value),n==null||n(p.target.value)}})}),gut=I.forwardRef((t,e)=>{let{children:n,label:s="Suggestions",...a}=t,o=I.useRef(null),l=I.useRef(null),i=U1(p=>p.selectedItemId),h=CI();return I.useEffect(()=>{if(l.current&&o.current){let p=l.current,x=o.current,y,b=new ResizeObserver(()=>{y=requestAnimationFrame(()=>{let j=p.offsetHeight;x.style.setProperty("--cmdk-list-height",j.toFixed(1)+"px")})});return b.observe(p),()=>{cancelAnimationFrame(y),b.unobserve(p)}}},[]),I.createElement(Rn.div,{ref:ry(o,e),...a,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":i,"aria-label":s,id:h.listId},pse(t,p=>I.createElement("div",{ref:ry(l,h.listInnerRef),"cmdk-list-sizer":""},p)))}),xut=I.forwardRef((t,e)=>{let{open:n,onOpenChange:s,overlayClassName:a,contentClassName:o,container:l,...i}=t;return I.createElement(qne,{open:n,onOpenChange:s},I.createElement(Vne,{container:l},I.createElement(i3,{"cmdk-overlay":"",className:a}),I.createElement(o3,{"aria-label":t.label,"cmdk-dialog":"",className:o},I.createElement(bOe,{ref:e,...i}))))}),yut=I.forwardRef((t,e)=>U1(n=>n.filtered.count===0)?I.createElement(Rn.div,{ref:e,...t,"cmdk-empty":"",role:"presentation"}):null),vut=I.forwardRef((t,e)=>{let{progress:n,children:s,label:a="Loading...",...o}=t;return I.createElement(Rn.div,{ref:e,...o,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":a},pse(t,l=>I.createElement("div",{"aria-hidden":!0},l)))}),kh=Object.assign(bOe,{List:gut,Item:hut,Input:mut,Group:fut,Separator:put,Dialog:xut,Empty:yut,Loading:vut});function _ut(t,e){let n=t.nextElementSibling;for(;n;){if(n.matches(e))return n;n=n.nextElementSibling}}function but(t,e){let n=t.previousElementSibling;for(;n;){if(n.matches(e))return n;n=n.previousElementSibling}}function wOe(t){let e=I.useRef(t);return Vj(()=>{e.current=t}),e}var Vj=typeof window>"u"?I.useEffect:I.useLayoutEffect;function _4(t){let e=I.useRef();return e.current===void 0&&(e.current=t()),e}function U1(t){let e=cxe(),n=()=>t(e.snapshot());return I.useSyncExternalStore(e.subscribe,n,n)}function jOe(t,e,n,s=[]){let a=I.useRef(),o=CI();return Vj(()=>{var l;let i=(()=>{var p;for(let x of n){if(typeof x=="string")return x.trim();if(typeof x=="object"&&"current"in x)return x.current?(p=x.current.textContent)==null?void 0:p.trim():a.current}})(),h=s.map(p=>p.trim());o.value(t,i,h),(l=e.current)==null||l.setAttribute(v4,i),a.current=i}),a}var wut=()=>{let[t,e]=I.useState(),n=_4(()=>new Map);return Vj(()=>{n.current.forEach(s=>s()),n.current=new Map},[t]),(s,a)=>{n.current.set(s,a),e({})}};function jut(t){let e=t.type;return typeof e=="function"?e(t.props):"render"in e?e.render(t.props):t}function pse({asChild:t,children:e},n){return t&&I.isValidElement(e)?I.cloneElement(jut(e),{ref:e.ref},n(e.props.children)):n(e)}var kut={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const q1=I.forwardRef(({className:t,...e},n)=>r.jsx(kh,{ref:n,className:$t("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",t),...e}));q1.displayName=kh.displayName;const Nut=({children:t,...e})=>r.jsx(Fr,{...e,children:r.jsx(Rr,{className:"overflow-hidden p-0 shadow-lg",children:r.jsx(q1,{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})})}),V1=I.forwardRef(({className:t,...e},n)=>r.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[r.jsx(wa,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),r.jsx(kh.Input,{ref:n,className:$t("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})]}));V1.displayName=kh.Input.displayName;const H1=I.forwardRef(({className:t,...e},n)=>r.jsx(kh.List,{ref:n,className:$t("max-h-[300px] overflow-y-auto overflow-x-hidden",t),...e}));H1.displayName=kh.List.displayName;const W1=I.forwardRef((t,e)=>r.jsx(kh.Empty,{ref:e,className:"py-6 text-center text-sm",...t}));W1.displayName=kh.Empty.displayName;const G1=I.forwardRef(({className:t,...e},n)=>r.jsx(kh.Group,{ref:n,className:$t("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}));G1.displayName=kh.Group.displayName;const Sut=I.forwardRef(({className:t,...e},n)=>r.jsx(kh.Separator,{ref:n,className:$t("-mx-1 h-px bg-border",t),...e}));Sut.displayName=kh.Separator.displayName;const K1=I.forwardRef(({className:t,...e},n)=>r.jsx(kh.Item,{ref:n,className:$t("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}));K1.displayName=kh.Item.displayName;const Cut={event:{label:"Events",icon:hm,color:"bg-blue-500/10 text-blue-600"},template:{label:"Templates",icon:Fd,color:"bg-purple-500/10 text-purple-600"},academy:{label:"Academy",icon:g1,color:"bg-amber-500/10 text-amber-600"},toolbox:{label:"Toolbox",icon:Wx,color:"bg-green-500/10 text-green-600"},"social-swag":{label:"Social Swag",icon:Ms,color:"bg-fuchsia-500/10 text-fuchsia-600"}},ike=()=>{const[t,e]=I.useState(!1),[n,s]=I.useState(""),[a,o]=I.useState([]),[l,i]=I.useState(!1),h=rs();I.useEffect(()=>{const b=j=>{j.key==="k"&&(j.metaKey||j.ctrlKey)&&(j.preventDefault(),e(C=>!C))};return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[]);const p=I.useCallback(async b=>{if(!b.trim()){o([]);return}i(!0);const j=`%${b}%`;try{const[C,N,A,E,T]=await Promise.all([J.from("events").select("id, title, description, event_date").eq("is_published",!0).or(`title.ilike.${j},description.ilike.${j}`).limit(5),J.from("canva_templates").select("id, name, description, publish_date").or(`name.ilike.${j},description.ilike.${j}`).limit(5),J.from("academy_videos").select("id, title, description, publish_date").eq("is_published",!0).or(`title.ilike.${j},description.ilike.${j}`).limit(5),J.from("resource_kits").select("id, name, description, publish_date").eq("is_published",!0).or(`name.ilike.${j},description.ilike.${j}`).limit(5),J.from("social_swag").select("id, title, description, publish_date").eq("is_published",!0).or(`title.ilike.${j},description.ilike.${j}`).limit(5)]),L=[];C.data&&C.data.forEach(z=>{L.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=>{L.push({id:z.id,title:z.name,description:z.description,type:"template",date:z.publish_date,path:`/templates/${z.id}`})}),A.data&&A.data.forEach(z=>{L.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=>{L.push({id:z.id,title:z.name,description:z.description,type:"toolbox",date:z.publish_date,path:`/toolbox/${z.id}`})}),T.data&&T.data.forEach(z=>{L.push({id:z.id,title:z.title,description:z.description,type:"social-swag",date:z.publish_date,path:`/social-swag/${z.id}`})}),o(L)}catch(C){console.error("Search error:",C)}finally{i(!1)}},[]);I.useEffect(()=>{const b=setTimeout(()=>{p(n)},300);return()=>clearTimeout(b)},[n,p]);const x=b=>{e(!1),s(""),h(b)},y=a.reduce((b,j)=>(b[j.type]||(b[j.type]=[]),b[j.type].push(j),b),{});return r.jsxs(r.Fragment,{children:[r.jsxs(ee,{variant:"outline",className:"relative h-9 w-9 p-0 xl:h-9 xl:w-60 xl:justify-start xl:px-3 xl:py-2",onClick:()=>e(!0),children:[r.jsx(wa,{className:"h-4 w-4 xl:mr-2"}),r.jsx("span",{className:"hidden xl:inline-flex text-muted-foreground text-sm",children:"Search..."}),r.jsxs("kbd",{className:"pointer-events-none absolute right-1.5 top-1.5 hidden h-6 select-none items-center gap-1 rounded border bg-muted px-1.5 font-mono text-[10px] font-medium opacity-100 xl:flex",children:[r.jsx("span",{className:"text-xs",children:"⌘"}),"K"]})]}),r.jsxs(Nut,{open:t,onOpenChange:e,children:[r.jsx(V1,{placeholder:"Search events, templates, academy, toolbox, social swag...",value:n,onValueChange:s}),r.jsxs(H1,{children:[l&&r.jsx("div",{className:"py-6 text-center text-sm text-muted-foreground",children:"Searching..."}),!l&&n&&a.length===0&&r.jsxs(W1,{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(([b,j])=>{const C=Cut[b],N=C.icon;return r.jsx(G1,{heading:C.label,children:j.map(A=>r.jsxs(K1,{value:`${A.type}-${A.id}-${A.title}`,onSelect:()=>x(A.path),className:"flex items-start gap-3 py-3 cursor-pointer",children:[r.jsx("div",{className:`p-2 rounded-md ${C.color}`,children:r.jsx(N,{className:"h-4 w-4"})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("div",{className:"font-medium truncate",children:A.title}),A.description&&r.jsx("div",{className:"text-sm text-muted-foreground truncate group-data-[selected=true]:text-primary-foreground/80",children:A.description})]}),r.jsxs("div",{className:"flex flex-col items-end gap-1 shrink-0",children:[r.jsx(Ot,{variant:"secondary",className:"text-xs",children:C.label}),r.jsx("span",{className:"text-xs text-muted-foreground",children:cu(new Date(A.date),{addSuffix:!0})})]})]},`${A.type}-${A.id}`))},b)})]})]})]})},Mut=({expiresAt:t,className:e,showUpgradeButton:n=!0})=>{const[s,a]=I.useState(null),o=rs();if(I.useEffect(()=>{const p=()=>{const y=new Date().getTime(),j=new Date(t).getTime()-y;if(j<=0){a({days:0,hours:0,minutes:0});return}const C=Math.floor(j/(1e3*60*60*24)),N=Math.floor(j%(1e3*60*60*24)/(1e3*60*60)),A=Math.floor(j%(1e3*60*60)/(1e3*60));a({days:C,hours:N,minutes:A})};p();const x=setInterval(p,6e4);return()=>clearInterval(x)},[t]),!s)return null;const l=s.days===0&&s.hours===0&&s.minutes===0,i=s.days<=1,h=s.days<=3&&!i;return l?r.jsxs("div",{className:$t("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(Vh,{className:"h-4 w-4 text-destructive"}),r.jsx("span",{className:"text-sm font-medium text-destructive",children:"Your free trial has expired"})]}),n&&r.jsxs(ee,{size:"sm",onClick:()=>o("/subscription"),className:"bg-primary hover:bg-primary/90 text-xs h-7 px-3",children:[r.jsx(Ms,{className:"h-3 w-3 mr-1"}),"Upgrade Now"]})]}):r.jsxs("div",{className:$t("flex items-center justify-between gap-3 px-4 py-2 rounded-lg border transition-colors",i?"bg-destructive/10 border-destructive/20":h?"bg-amber-500/10 border-amber-500/20":"bg-primary/10 border-primary/20",e),children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(Ya,{className:$t("h-4 w-4",i?"text-destructive":h?"text-amber-500":"text-primary")}),r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx("span",{className:$t("text-sm font-medium",i?"text-destructive":h?"text-amber-600":"text-primary"),children:"Free Trial:"}),r.jsxs("div",{className:"flex items-center gap-1",children:[s.days>0&&r.jsxs("span",{className:$t("text-sm font-bold",i?"text-destructive":h?"text-amber-600":"text-primary"),children:[s.days,"d"]}),r.jsxs("span",{className:$t("text-sm font-bold",i?"text-destructive":h?"text-amber-600":"text-primary"),children:[s.hours,"h"]}),r.jsxs("span",{className:$t("text-sm font-bold",i?"text-destructive":h?"text-amber-600":"text-primary"),children:[s.minutes,"m"]}),r.jsx("span",{className:$t("text-xs",i?"text-destructive/70":h?"text-amber-600/70":"text-primary/70"),children:"remaining"})]})]})]}),n&&r.jsxs(ee,{size:"sm",onClick:()=>o("/subscription"),variant:i?"destructive":h?"default":"outline",className:$t("text-xs h-7 px-3",h&&"bg-amber-500 hover:bg-amber-600 text-white"),children:[r.jsx(Ms,{className:"h-3 w-3 mr-1"}),"Upgrade"]})]})},Tut=()=>{const t=rs();return r.jsx("div",{className:"fixed inset-0 bg-background/95 backdrop-blur-sm z-50 flex items-center justify-center p-4 overflow-y-auto",children:r.jsxs(Ye,{className:"w-full max-w-2xl shadow-2xl border-destructive/20 my-8",children:[r.jsxs(Gt,{className:"text-center pb-2",children:[r.jsx("div",{className:"mx-auto mb-4 h-16 w-16 rounded-full bg-destructive/10 flex items-center justify-center",children:r.jsx(Vh,{className:"h-8 w-8 text-destructive"})}),r.jsx(Zt,{className:"text-2xl",children:"Your Free Trial Has Ended"}),r.jsx(Mn,{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(tt,{className:"space-y-6",children:[r.jsxs("div",{className:"grid sm:grid-cols-2 gap-4",children:[r.jsx(Ye,{className:"border-2 border-primary/20 hover:border-primary/50 transition-colors cursor-pointer",onClick:()=>t("/subscription"),children:r.jsxs(tt,{className:"p-5 text-center",children:[r.jsx("div",{className:"mx-auto mb-3 h-12 w-12 rounded-full bg-primary/10 flex items-center justify-center",children:r.jsx(Bn,{className:"h-6 w-6 text-primary"})}),r.jsx("h3",{className:"font-semibold text-lg mb-1",children:"Individual Agent"}),r.jsxs("p",{className:"text-2xl font-bold text-primary mb-2",children:["$39",r.jsx("span",{className:"text-sm font-normal text-muted-foreground",children:"/mo"})]}),r.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"Perfect for solo agents ready to level up"}),r.jsxs(ee,{className:"w-full",onClick:e=>{e.stopPropagation(),t("/subscription")},children:[r.jsx(Ms,{className:"h-4 w-4 mr-2"}),"Choose Individual"]})]})}),r.jsx(Ye,{className:"border-2 border-amber-500/20 hover:border-amber-500/50 transition-colors cursor-pointer",onClick:()=>t("/subscription"),children:r.jsxs(tt,{className:"p-5 text-center",children:[r.jsx("div",{className:"mx-auto mb-3 h-12 w-12 rounded-full bg-amber-500/10 flex items-center justify-center",children:r.jsx(ai,{className:"h-6 w-6 text-amber-600"})}),r.jsx("h3",{className:"font-semibold text-lg mb-1",children:"Brokerage"}),r.jsxs("p",{className:"text-2xl font-bold text-amber-600 mb-2",children:["$299",r.jsx("span",{className:"text-sm font-normal text-muted-foreground",children:"/mo"})]}),r.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"For teams and brokerages"}),r.jsxs(ee,{variant:"outline",className:"w-full border-amber-500 text-amber-600 hover:bg-amber-50",onClick:e=>{e.stopPropagation(),t("/subscription")},children:[r.jsx(ai,{className:"h-4 w-4 mr-2"}),"Choose Brokerage"]})]})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("p",{className:"text-sm text-muted-foreground text-center",children:"With a full membership, you'll get:"}),r.jsxs("ul",{className:"text-sm space-y-1 text-muted-foreground grid sm:grid-cols-2 gap-x-4",children:[r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-primary",children:"✓"})," Unlimited access to all marketing templates"]}),r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-primary",children:"✓"})," Complete Academy training library"]}),r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-primary",children:"✓"})," AI-powered tools and resources"]}),r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-primary",children:"✓"})," Community forums and support"]}),r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-primary",children:"✓"})," Exclusive member events and workshops"]}),r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-primary",children:"✓"})," Deal pipeline & scorecard tracking"]})]})]}),r.jsxs("div",{className:"bg-muted/50 rounded-lg p-4 space-y-3",children:[r.jsx("p",{className:"text-sm font-medium text-center",children:"Questions? Contact us:"}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 justify-center",children:[r.jsxs("a",{href:"tel:1-866-527-8668",className:"flex items-center justify-center gap-2 text-primary hover:underline",children:[r.jsx(bi,{className:"h-4 w-4"}),r.jsx("span",{children:"1-866-527-8668"})]}),r.jsxs("a",{href:"mailto:support@relevelup.com",className:"flex items-center justify-center gap-2 text-primary hover:underline",children:[r.jsx(da,{className:"h-4 w-4"}),r.jsx("span",{children:"support@relevelup.com"})]})]})]})]})]})})},Aut=({hasUnseenBrief:t,onClick:e,className:n})=>r.jsxs(Sg,{children:[r.jsx(Cg,{asChild:!0,children:r.jsxs(ee,{variant:"ghost",size:"icon",onClick:e,className:$t("relative transition-colors",t&&"text-primary hover:text-primary",n),children:[r.jsx(gm,{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(xm,{children:r.jsx("p",{children:"The LevelUp Brief"})})]});var mse="Checkbox",[Eut]=tc(mse),[Iut,dxe]=Eut(mse);function Put(t){const{__scopeCheckbox:e,checked:n,children:s,defaultChecked:a,disabled:o,form:l,name:i,onCheckedChange:h,required:p,value:x="on",internal_do_not_use_render:y}=t,[b,j]=Fu({prop:n,defaultProp:a??!1,onChange:h,caller:mse}),[C,N]=I.useState(null),[A,E]=I.useState(null),T=I.useRef(!1),L=C?!!l||!!C.closest("form"):!0,z={checked:b,disabled:o,setChecked:j,control:C,setControl:N,name:i,form:l,value:x,hasConsumerStoppedPropagationRef:T,required:p,defaultChecked:C1(a)?!1:a,isFormControl:L,bubbleInput:A,setBubbleInput:E};return r.jsx(Iut,{scope:e,...z,children:Lut(y)?y(z):s})}var kOe="CheckboxTrigger",NOe=I.forwardRef(({__scopeCheckbox:t,onKeyDown:e,onClick:n,...s},a)=>{const{control:o,value:l,disabled:i,checked:h,required:p,setControl:x,setChecked:y,hasConsumerStoppedPropagationRef:b,isFormControl:j,bubbleInput:C}=dxe(kOe,t),N=ta(a,x),A=I.useRef(h);return I.useEffect(()=>{const E=o==null?void 0:o.form;if(E){const T=()=>y(A.current);return E.addEventListener("reset",T),()=>E.removeEventListener("reset",T)}},[o,y]),r.jsx(Rn.button,{type:"button",role:"checkbox","aria-checked":C1(h)?"mixed":h,"aria-required":p,"data-state":AOe(h),"data-disabled":i?"":void 0,disabled:i,value:l,...s,ref:N,onKeyDown:an(e,E=>{E.key==="Enter"&&E.preventDefault()}),onClick:an(n,E=>{y(T=>C1(T)?!0:!T),C&&j&&(b.current=E.isPropagationStopped(),b.current||E.stopPropagation())})})});NOe.displayName=kOe;var uxe=I.forwardRef((t,e)=>{const{__scopeCheckbox:n,name:s,checked:a,defaultChecked:o,required:l,disabled:i,value:h,onCheckedChange:p,form:x,...y}=t;return r.jsx(Put,{__scopeCheckbox:n,checked:a,defaultChecked:o,disabled:i,required:l,onCheckedChange:p,name:s,form:x,value:h,internal_do_not_use_render:({isFormControl:b})=>r.jsxs(r.Fragment,{children:[r.jsx(NOe,{...y,ref:e,__scopeCheckbox:n}),b&&r.jsx(TOe,{__scopeCheckbox:n})]})})});uxe.displayName=mse;var SOe="CheckboxIndicator",COe=I.forwardRef((t,e)=>{const{__scopeCheckbox:n,forceMount:s,...a}=t,o=dxe(SOe,n);return r.jsx(gc,{present:s||C1(o.checked)||o.checked===!0,children:r.jsx(Rn.span,{"data-state":AOe(o.checked),"data-disabled":o.disabled?"":void 0,...a,ref:e,style:{pointerEvents:"none",...t.style}})})});COe.displayName=SOe;var MOe="CheckboxBubbleInput",TOe=I.forwardRef(({__scopeCheckbox:t,...e},n)=>{const{control:s,hasConsumerStoppedPropagationRef:a,checked:o,defaultChecked:l,required:i,disabled:h,name:p,value:x,form:y,bubbleInput:b,setBubbleInput:j}=dxe(MOe,t),C=ta(n,j),N=kI(o),A=uI(s);I.useEffect(()=>{const T=b;if(!T)return;const L=window.HTMLInputElement.prototype,F=Object.getOwnPropertyDescriptor(L,"checked").set,q=!a.current;if(N!==o&&F){const H=new Event("click",{bubbles:q});T.indeterminate=C1(o),F.call(T,C1(o)?!1:o),T.dispatchEvent(H)}},[b,N,o,a]);const E=I.useRef(C1(o)?!1:o);return r.jsx(Rn.input,{type:"checkbox","aria-hidden":!0,defaultChecked:l??E.current,required:i,disabled:h,name:p,value:x,form:y,...e,tabIndex:-1,ref:C,style:{...e.style,...A,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});TOe.displayName=MOe;function Lut(t){return typeof t=="function"}function C1(t){return t==="indeterminate"}function AOe(t){return C1(t)?"indeterminate":t?"checked":"unchecked"}const Dl=I.forwardRef(({className:t,...e},n)=>r.jsx(uxe,{ref:n,className:$t("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(COe,{className:$t("flex items-center justify-center text-current"),children:r.jsx(Ai,{className:"h-4 w-4"})})}));Dl.displayName=uxe.displayName;var hxe="Radio",[Out,EOe]=tc(hxe),[Dut,Rut]=Out(hxe),IOe=I.forwardRef((t,e)=>{const{__scopeRadio:n,name:s,checked:a=!1,required:o,disabled:l,value:i="on",onCheck:h,form:p,...x}=t,[y,b]=I.useState(null),j=ta(e,A=>b(A)),C=I.useRef(!1),N=y?p||!!y.closest("form"):!0;return r.jsxs(Dut,{scope:n,checked:a,disabled:l,children:[r.jsx(Rn.button,{type:"button",role:"radio","aria-checked":a,"data-state":DOe(a),"data-disabled":l?"":void 0,disabled:l,value:i,...x,ref:j,onClick:an(t.onClick,A=>{a||h==null||h(),N&&(C.current=A.isPropagationStopped(),C.current||A.stopPropagation())})}),N&&r.jsx(OOe,{control:y,bubbles:!C.current,name:s,value:i,checked:a,required:o,disabled:l,form:p,style:{transform:"translateX(-100%)"}})]})});IOe.displayName=hxe;var POe="RadioIndicator",LOe=I.forwardRef((t,e)=>{const{__scopeRadio:n,forceMount:s,...a}=t,o=Rut(POe,n);return r.jsx(gc,{present:s||o.checked,children:r.jsx(Rn.span,{"data-state":DOe(o.checked),"data-disabled":o.disabled?"":void 0,...a,ref:e})})});LOe.displayName=POe;var Fut="RadioBubbleInput",OOe=I.forwardRef(({__scopeRadio:t,control:e,checked:n,bubbles:s=!0,...a},o)=>{const l=I.useRef(null),i=ta(l,o),h=kI(n),p=uI(e);return I.useEffect(()=>{const x=l.current;if(!x)return;const y=window.HTMLInputElement.prototype,j=Object.getOwnPropertyDescriptor(y,"checked").set;if(h!==n&&j){const C=new Event("click",{bubbles:s});j.call(x,n),x.dispatchEvent(C)}},[h,n,s]),r.jsx(Rn.input,{type:"radio","aria-hidden":!0,defaultChecked:n,...a,tabIndex:-1,ref:i,style:{...a.style,...p,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});OOe.displayName=Fut;function DOe(t){return t?"checked":"unchecked"}var zut=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],gse="RadioGroup",[But]=tc(gse,[a3,EOe]),ROe=a3(),FOe=EOe(),[$ut,Uut]=But(gse),zOe=I.forwardRef((t,e)=>{const{__scopeRadioGroup:n,name:s,defaultValue:a,value:o,required:l=!1,disabled:i=!1,orientation:h,dir:p,loop:x=!0,onValueChange:y,...b}=t,j=ROe(n),C=ik(p),[N,A]=Fu({prop:o,defaultProp:a??null,onChange:y,caller:gse});return r.jsx($ut,{scope:n,name:s,required:l,disabled:i,value:N,onValueChange:A,children:r.jsx(vge,{asChild:!0,...j,orientation:h,dir:C,loop:x,children:r.jsx(Rn.div,{role:"radiogroup","aria-required":l,"aria-orientation":h,"data-disabled":i?"":void 0,dir:C,...b,ref:e})})})});zOe.displayName=gse;var BOe="RadioGroupItem",$Oe=I.forwardRef((t,e)=>{const{__scopeRadioGroup:n,disabled:s,...a}=t,o=Uut(BOe,n),l=o.disabled||s,i=ROe(n),h=FOe(n),p=I.useRef(null),x=ta(e,p),y=o.value===a.value,b=I.useRef(!1);return I.useEffect(()=>{const j=N=>{zut.includes(N.key)&&(b.current=!0)},C=()=>b.current=!1;return document.addEventListener("keydown",j),document.addEventListener("keyup",C),()=>{document.removeEventListener("keydown",j),document.removeEventListener("keyup",C)}},[]),r.jsx(_ge,{asChild:!0,...i,focusable:!l,active:y,children:r.jsx(IOe,{disabled:l,required:o.required,checked:y,...h,...a,name:o.name,ref:x,onCheck:()=>o.onValueChange(a.value),onKeyDown:an(j=>{j.key==="Enter"&&j.preventDefault()}),onFocus:an(a.onFocus,()=>{var j;b.current&&((j=p.current)==null||j.click())})})})});$Oe.displayName=BOe;var qut="RadioGroupIndicator",UOe=I.forwardRef((t,e)=>{const{__scopeRadioGroup:n,...s}=t,a=FOe(n);return r.jsx(LOe,{...a,...s,ref:e})});UOe.displayName=qut;var qOe=zOe,VOe=$Oe,Vut=UOe;const HOe=I.forwardRef(({className:t,...e},n)=>r.jsx(qOe,{className:$t("grid gap-2",t),...e,ref:n}));HOe.displayName=qOe.displayName;const WOe=I.forwardRef(({className:t,...e},n)=>r.jsx(VOe,{ref:n,className:$t("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(Vut,{className:"flex items-center justify-center",children:r.jsx(Ru,{className:"h-2.5 w-2.5 fill-current text-current"})})}));WOe.displayName=VOe.displayName;const Hut=({brief:t,open:e,onClose:n,onDismiss:s})=>{const{user:a}=Qr(),[o,l]=I.useState({}),[i,h]=I.useState({}),[p,x]=I.useState([]);I.useEffect(()=>{e&&a&&t.polls.length>0&&y()},[e,a,t.polls]);const y=async()=>{if(!a)return;const A=t.polls.map(T=>T.id),{data:E}=await J.from("levelup_brief_poll_responses").select("poll_id, option_id").eq("user_id",a.id).in("poll_id",A);if(E){const T={};E.forEach(L=>{T[L.poll_id]||(T[L.poll_id]=[]),T[L.poll_id].push(L.option_id)}),h(T)}},b=(A,E)=>{l(T=>({...T,[A]:E}))},j=(A,E,T)=>{l(L=>{const z=L[A]||[];return T?{...L,[A]:[...z,E]}:{...L,[A]:z.filter(F=>F!==E)}})},C=async A=>{if(!a)return;const E=o[A];if(!E||Array.isArray(E)&&E.length===0){ze.error("Please select an option");return}x(T=>[...T,A]);try{await J.from("levelup_brief_poll_responses").delete().eq("poll_id",A).eq("user_id",a.id);const T=Array.isArray(E)?E:[E],L=T.map(F=>({poll_id:A,option_id:F,user_id:a.id})),{error:z}=await J.from("levelup_brief_poll_responses").insert(L);if(z)throw z;h(F=>({...F,[A]:T})),ze.success("Response submitted!")}catch(T){console.error("Error submitting poll response:",T),ze.error("Failed to submit response")}finally{x(T=>T.filter(L=>L!==A))}},N=A=>(A.includes("mediadelivery.net")||A.includes("bunny"),A);return r.jsx(Fr,{open:e,onOpenChange:A=>!A&&n(),children:r.jsxs(Rr,{className:"max-w-2xl max-h-[90vh] p-0 overflow-hidden [&>button]:hidden",children:[r.jsxs("div",{className:"bg-gradient-to-r from-primary to-primary/80 p-4 pr-12 text-primary-foreground relative",children:[r.jsx("button",{onClick:n,className:"absolute top-3 right-3 p-1.5 rounded-full bg-white/30 hover:bg-white/50 transition-colors","aria-label":"Close",children:r.jsx(_s,{className:"h-5 w-5 text-white"})}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"p-2 bg-white/20 rounded-lg",children:r.jsx(gm,{className:"h-6 w-6"})}),r.jsxs("div",{children:[r.jsx(Ot,{variant:"secondary",className:"mb-1 bg-white/20 text-white border-0",children:"The LevelUp Brief"}),r.jsx($r,{className:"text-xl font-bold text-white",children:t.brief.title})]})]})]}),r.jsx(Jo,{className:"max-h-[calc(90vh-240px)]",children:r.jsxs("div",{className:"p-6 space-y-6",children:[t.brief.description&&r.jsx("div",{className:"text-muted-foreground prose prose-sm max-w-none",dangerouslySetInnerHTML:{__html:t.brief.description}}),t.brief.video_url&&r.jsx("div",{className:"relative w-full aspect-video rounded-lg overflow-hidden bg-muted",children:r.jsx("iframe",{src:N(t.brief.video_url),className:"absolute inset-0 w-full h-full",allow:"autoplay; fullscreen; picture-in-picture",allowFullScreen:!0})}),t.brief.graphic_url&&!t.brief.video_url&&r.jsx("div",{className:"rounded-lg overflow-hidden bg-muted",children:t.brief.graphic_link_url?r.jsx("a",{href:t.brief.graphic_link_url,target:"_blank",rel:"noopener noreferrer",className:"block",children:r.jsx("img",{src:t.brief.graphic_url,alt:"Brief graphic",className:"w-full object-contain cursor-pointer hover:opacity-90 transition-opacity"})}):r.jsx("img",{src:t.brief.graphic_url,alt:"Brief graphic",className:"w-full object-contain"})}),t.links.length>0&&r.jsxs("div",{className:"space-y-3",children:[r.jsx("h4",{className:"font-semibold text-foreground",children:"Quick Links"}),r.jsx("div",{className:"flex flex-wrap gap-2",children:t.links.map(A=>r.jsxs(ee,{variant:"outline",size:"sm",onClick:()=>window.open(A.url,"_blank"),className:"gap-2",children:[r.jsx(Fs,{className:"h-4 w-4"}),A.title]},A.id))})]}),t.polls.map(A=>{var L,z;const E=((L=i[A.id])==null?void 0:L.length)>0,T=p.includes(A.id);return r.jsxs("div",{className:"space-y-3 p-4 bg-muted/50 rounded-lg border",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("h4",{className:"font-semibold text-foreground",children:A.question}),E&&r.jsxs(Ot,{variant:"secondary",className:"gap-1",children:[r.jsx(Xi,{className:"h-3 w-3"}),"Responded"]})]}),A.poll_type==="single"?r.jsx(HOe,{value:o[A.id]||((z=i[A.id])==null?void 0:z[0])||"",onValueChange:F=>b(A.id,F),className:"space-y-2",children:A.options.map(F=>r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(WOe,{value:F.id,id:F.id}),r.jsx(He,{htmlFor:F.id,className:"cursor-pointer",children:F.option_text})]},F.id))}):r.jsx("div",{className:"space-y-2",children:A.options.map(F=>{const H=(o[A.id]||i[A.id]||[]).includes(F.id);return r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(Dl,{id:F.id,checked:H,onCheckedChange:Z=>j(A.id,F.id,Z)}),r.jsx(He,{htmlFor:F.id,className:"cursor-pointer",children:F.option_text})]},F.id)})}),r.jsx(ee,{size:"sm",onClick:()=>C(A.id),disabled:T,children:T?"Submitting...":E?"Update Response":"Submit"})]},A.id)})]})}),r.jsxs("div",{className:"p-4 pb-[calc(1rem+env(safe-area-inset-bottom))] border-t bg-muted/30 flex flex-col items-center gap-2 sticky bottom-0 z-10",children:[r.jsx(ee,{onClick:n,className:"w-full max-w-xs",children:"Got it!"}),r.jsx(ee,{variant:"ghost",size:"sm",onClick:s,children:"Don't show again"})]})]})})},Wut=()=>{const{user:t}=Qr(),[e,n]=I.useState(null),[s,a]=I.useState(!1),[o,l]=I.useState(!0),[i,h]=I.useState(!1),p=I.useCallback(async()=>{if(!t){l(!1);return}try{const{data:C,error:N}=await J.from("levelup_briefs").select("*").eq("is_published",!0).lte("publish_date",new Date().toISOString()).order("publish_date",{ascending:!1}).limit(1).single();if(N||!C){l(!1);return}const{data:A}=await J.from("levelup_brief_views").select("*").eq("brief_id",C.id).eq("user_id",t.id).maybeSingle(),[E,T]=await Promise.all([J.from("levelup_brief_links").select("*").eq("brief_id",C.id).order("sort_order"),J.from("levelup_brief_polls").select("*").eq("brief_id",C.id).order("sort_order")]),L=[];if(T.data)for(const H of T.data){const{data:Z}=await J.from("levelup_brief_poll_options").select("*").eq("poll_id",H.id).order("sort_order");L.push({...H,options:Z||[]})}const z={brief:C,links:E.data||[],polls:L};n(z);const F=!!A,q=(A==null?void 0:A.dismissed_at)!==null;if(!F)a(!0),h(!0);else if(C.show_frequency==="every_login"&&!q)a(!0),h(!0);else if(C.show_frequency==="daily"){const H=new Date(A.viewed_at);(new Date().getTime()-H.getTime())/(1e3*60*60)>=24&&!q&&(a(!0),h(!0))}else h(!q)}catch(C){console.error("Error fetching brief:",C)}finally{l(!1)}},[t]);I.useEffect(()=>{p()},[p]);const x=async()=>{if(!(!t||!e))try{const{data:C}=await J.from("levelup_brief_views").select("id").eq("brief_id",e.brief.id).eq("user_id",t.id).maybeSingle();C?await J.from("levelup_brief_views").update({viewed_at:new Date().toISOString()}).eq("id",C.id):await J.from("levelup_brief_views").insert({brief_id:e.brief.id,user_id:t.id})}catch(C){console.error("Error marking brief as viewed:",C)}};return{currentBrief:e,shouldShowPopup:s,hasUnseenBrief:i,loading:o,openBrief:()=>{a(!0)},closeBrief:()=>{a(!1),x()},dismissBrief:async()=>{if(!(!t||!e))try{const{data:C}=await J.from("levelup_brief_views").select("id").eq("brief_id",e.brief.id).eq("user_id",t.id).maybeSingle();C?await J.from("levelup_brief_views").update({dismissed_at:new Date().toISOString()}).eq("id",C.id):await J.from("levelup_brief_views").insert({brief_id:e.brief.id,user_id:t.id,dismissed_at:new Date().toISOString()}),a(!1),h(!1)}catch(C){console.error("Error dismissing brief:",C)}},refetch:p}};function Gut(){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 b=j=>{j.preventDefault(),o(j)};return window.addEventListener("beforeinstallprompt",b),()=>{window.removeEventListener("beforeinstallprompt",b)}},[]);const l=()=>{localStorage.setItem("install-banner-dismissed","true"),e(!1)},i=async()=>{if(a){await a.prompt();const{outcome:h}=await a.userChoice;h==="accepted"&&l(),o(null)}};return t?r.jsx("div",{className:"fixed bottom-0 left-0 right-0 z-50 p-4 bg-primary text-primary-foreground shadow-lg animate-in slide-in-from-bottom duration-300",children:r.jsxs("div",{className:"flex items-center justify-between gap-3",children:[r.jsxs("div",{className:"flex items-center gap-3 flex-1 min-w-0",children:[r.jsx("div",{className:"flex-shrink-0 p-2 bg-primary-foreground/10 rounded-full",children:r.jsx(no,{className:"h-5 w-5"})}),r.jsxs("div",{className:"min-w-0",children:[r.jsx("p",{className:"font-medium text-sm",children:"Add LevelUp to your home screen"}),n?r.jsxs("p",{className:"text-xs opacity-80 flex items-center gap-1",children:["Tap ",r.jsx(WT,{className:"h-3 w-3 inline"}),' then "Add to Home Screen"']}):r.jsx("p",{className:"text-xs opacity-80",children:"Quick access anytime"})]})]}),r.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[!n&&a&&r.jsx(ee,{size:"sm",variant:"secondary",onClick:i,className:"text-xs",children:"Install"}),r.jsx("button",{onClick:l,className:"p-1.5 hover:bg-primary-foreground/10 rounded-full transition-colors","aria-label":"Dismiss",children:r.jsx(_s,{className:"h-4 w-4"})})]})]})}):null}const Kut=({children:t,onRefresh:e})=>{const[n,s]=I.useState(!1),[a,o]=I.useState(0),[l,i]=I.useState(!1),h=I.useRef(null),p=I.useRef(0),x=Vr(),y=80,b=120,j=I.useCallback(T=>{const L=h.current;L&&L.scrollTop<=0&&(p.current=T.touches[0].clientY,s(!0))},[]),C=I.useCallback(T=>{if(!n||l)return;const L=h.current;if(!L||L.scrollTop>0){s(!1),o(0);return}const F=T.touches[0].clientY-p.current;if(F>0){const H=Math.min(F*.5,b);o(H),H>10&&T.preventDefault()}},[n,l]),N=I.useCallback(async()=>{if(n)if(s(!1),a>=y&&!l){i(!0),o(y);try{e?await e():await x.invalidateQueries()}catch(T){console.error("Refresh failed:",T)}finally{i(!1),o(0)}}else o(0)},[n,a,l,e,x]),A=Math.min(a/y,1),E=A*180;return r.jsxs("div",{ref:h,className:"h-full overflow-auto",onTouchStart:j,onTouchMove:C,onTouchEnd:N,children:[r.jsx("div",{className:"flex justify-center items-center overflow-hidden transition-all duration-200 ease-out",style:{height:a>0?a:0,opacity:A},children:r.jsx("div",{className:`p-2 rounded-full bg-primary/10 ${l?"animate-spin":""}`,style:{transform:l?void 0:`rotate(${E}deg)`,transition:l?void 0:"transform 0.1s ease-out"},children:r.jsx(Gl,{className:"h-5 w-5 text-primary"})})}),r.jsx("div",{style:{transform:a>0?`translateY(${Math.max(0,a-60)}px)`:void 0,transition:n?void 0:"transform 0.2s ease-out"},children:t})]})},GOe=()=>{const{user:t}=Qr(),[e,n]=I.useState(!1),[s,a]=I.useState(!1),[o,l]=I.useState(0),[i,h]=I.useState(!0);I.useEffect(()=>{(async()=>{if(!t){h(!1);return}try{const{data:j}=await J.from("membership_reviews").select("id").eq("user_id",t.id).maybeSingle();if(j){a(!0),n(!1),h(!1);return}const{data:C}=await J.from("profiles").select("login_count").eq("id",t.id).single(),N=(C==null?void 0:C.login_count)||0;l(N);const A=sessionStorage.getItem("review-prompt-dismissed");n(N>=4&&!A)}catch(j){console.error("Error checking review eligibility:",j)}finally{h(!1)}})()},[t]);const p=I.useCallback(()=>{sessionStorage.setItem("review-prompt-dismissed","true"),n(!1)},[]),x=I.useCallback(async(b,j)=>{if(!t)return{success:!1,error:"Not authenticated"};try{const{error:C}=await J.from("membership_reviews").insert({user_id:t.id,rating:b,review_text:j});if(C)throw C;const{data:N,error:A}=await J.from("agent_attendance_stats").select("total_points, spendable_points").eq("user_id",t.id).maybeSingle();A&&console.error("Error fetching current stats:",A);const E=(N==null?void 0:N.spendable_points)||0,T=(N==null?void 0:N.total_points)||0,L=E+25,z=T+25,{error:F}=await J.from("agent_attendance_stats").upsert({user_id:t.id,total_points:z,spendable_points:L,updated_at:new Date().toISOString()},{onConflict:"user_id"});F&&console.error("Error upserting attendance stats:",F);const{error:q}=await J.from("agent_points").insert({user_id:t.id,points:25,reason:"Left a membership review"});return q&&console.error("Error logging points:",q),a(!0),n(!1),{success:!0,pointsAwarded:25}}catch(C){return console.error("Error submitting review:",C),{success:!1,error:C.message}}},[t]),y=I.useCallback(async()=>{if(t)try{await J.from("membership_reviews").update({posted_to_google:!0}).eq("user_id",t.id)}catch(b){console.error("Error updating Google review status:",b)}},[t]);return{shouldShowPrompt:e,hasSubmittedReview:s,loginCount:o,isLoading:i,dismissPrompt:p,submitReview:x,markPostedToGoogle:y}},Zut="https://search.google.com/local/writereview?placeid=ChIJM73ERQD1QogRPxupMFObuck&source=g.page.m.ia._&laa=nmx-review-solicitation-ia2",Yut=()=>{const{shouldShowPrompt:t,isLoading:e,dismissPrompt:n,submitReview:s,markPostedToGoogle:a}=GOe(),[o,l]=I.useState(!1),[i,h]=I.useState("review"),[p,x]=I.useState(0),[y,b]=I.useState(0),[j,C]=I.useState(""),[N,A]=I.useState(!1),[E,T]=I.useState(!1);if(e||!t&&!E)return null;const L=async()=>{if(p===0){ma({title:"Please select a rating",variant:"destructive"});return}A(!0);const q=await s(p,j);A(!1),q.success?(T(!0),ma({title:"Thank you for your feedback!",description:"Your review helps us improve."}),h("google")):ma({title:"Error submitting review",description:q.error,variant:"destructive"})},z=async q=>{q&&(await navigator.clipboard.writeText(j||`${p} star rating for LevelUp!`),ma({title:"Review copied!",description:"Paste it on Google Reviews."}),await a(),window.open(Zut,"_blank")),l(!1),n()},F=()=>{l(!1),n()};return r.jsxs(r.Fragment,{children:[r.jsxs("button",{onClick:()=>l(!0),className:"fixed bottom-20 left-1/2 -translate-x-1/2 z-40 flex items-center gap-2 rounded-full bg-primary/90 px-3 py-2 text-xs text-primary-foreground shadow-lg backdrop-blur-sm transition-all hover:bg-primary hover:scale-105 md:bottom-6",children:[r.jsx(vs,{className:"h-3.5 w-3.5 fill-current"}),r.jsx("span",{className:"hidden sm:inline",children:"Leave a Review"})]}),r.jsx(Fr,{open:o,onOpenChange:F,children:r.jsx(Rr,{className:"sm:max-w-md",children:i==="review"?r.jsxs(r.Fragment,{children:[r.jsxs(qr,{children:[r.jsx($r,{className:"text-center",children:"How are you enjoying LevelUp?"}),r.jsx(Xn,{className:"text-center",children:"Your feedback helps us improve the experience for all members."})]}),r.jsxs("div",{className:"space-y-6 py-4",children:[r.jsx("div",{className:"flex justify-center gap-1",children:[1,2,3,4,5].map(q=>r.jsx("button",{type:"button",onClick:()=>x(q),onMouseEnter:()=>b(q),onMouseLeave:()=>b(0),className:"p-1 transition-transform hover:scale-110",children:r.jsx(vs,{className:$t("h-8 w-8 transition-colors",(y||p)>=q?"fill-yellow-400 text-yellow-400":"text-muted-foreground")})},q))}),r.jsx(ps,{placeholder:"Tell us about your experience (optional)",value:j,onChange:q=>C(q.target.value),rows:4,className:"resize-none"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(ee,{variant:"outline",onClick:F,className:"flex-1",children:"Maybe Later"}),r.jsx(ee,{onClick:L,disabled:N||p===0,className:"flex-1",children:N?"Submitting...":"Submit Review"})]})]})]}):r.jsxs(r.Fragment,{children:[r.jsxs(qr,{children:[r.jsx($r,{className:"text-center",children:"🎉 Thank you!"}),r.jsx(Xn,{className:"text-center",children:"Would you mind sharing your review on Google? It really helps other agents discover LevelUp!"})]}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsx("p",{className:"text-center text-sm text-muted-foreground",children:"We'll copy your review so you can easily paste it."}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(ee,{variant:"outline",onClick:()=>z(!1),className:"flex-1",children:"No Thanks"}),r.jsx(ee,{onClick:()=>z(!0),className:"flex-1",children:"Yes, Open Google"})]})]})]})})})]})};function Xut(t){const e="=".repeat((4-t.length%4)%4),n=(t+e).replace(/-/g,"+").replace(/_/g,"/"),s=window.atob(n),a=new Uint8Array(s.length);for(let o=0;o{if(!y){l(!1);return}(async()=>{try{const{data:N,error:A}=await J.functions.invoke("get-vapid-public-key",{body:{}});if(A)throw A;const E=N==null?void 0:N.vapidPublicKey;if(!E)throw new Error("Missing VAPID public key");x(E);const T=await navigator.serviceWorker.register("/push-sw.js");h(T),n(Notification.permission);const L=await T.pushManager.getSubscription();a(!!L)}catch(N){console.error("Error initializing push notifications:",N)}finally{l(!1)}})()},[y]);const b=I.useCallback(async()=>{if(!y||!i||!t)return console.error("Push notifications not supported or user not logged in"),!1;if(!p)return ze.error("Push notifications are not ready yet. Please try again in a moment."),!1;try{l(!0);const C=await i.pushManager.getSubscription();if(C){try{await C.unsubscribe()}catch(z){console.warn("Failed to unsubscribe existing push subscription:",z)}const{error:L}=await J.from("push_subscriptions").delete().eq("user_id",t.id);L&&console.warn("Failed to cleanup push_subscriptions rows:",L)}if(Notification.permission!=="granted"){const L=await Notification.requestPermission();if(n(L),L!=="granted")return L==="denied"?ze.error("Notifications blocked. Please enable them in your browser settings (click the lock icon in the address bar)."):ze.error("Notification permission was dismissed. Please try again."),!1}const N=Xut(p);let A;try{A=await i.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:N})}catch(L){console.error("PushManager.subscribe() failed:",L);const z=(L==null?void 0:L.message)||String(L);return z.includes("permission")?ze.error("Push permission denied. Check your browser notification settings."):z.includes("key")||z.includes("VAPID")?ze.error("Push configuration error. Please contact support."):z.includes("AbortError")?ze.error("Push subscription was cancelled. Please try again."):ze.error(`Failed to subscribe: ${z}`),!1}const E=A.toJSON(),{error:T}=await J.from("push_subscriptions").upsert({user_id:t.id,endpoint:E.endpoint,p256dh_key:E.keys.p256dh,auth_key:E.keys.auth},{onConflict:"user_id,endpoint"});if(T)throw console.error("Error saving subscription:",T),ze.error("Failed to save notification preferences. Please try again."),T;return a(!0),ze.success("Push notifications enabled!"),!0}catch(C){if(console.error("Error subscribing to push notifications:",C),!(C instanceof Error&&C.message.includes("toast"))){const N=C instanceof Error?C.message:"Unknown error";ze.error("Failed to enable push notifications: "+N)}return!1}finally{l(!1)}},[y,i,t,p]),j=I.useCallback(async()=>{if(!i||!t)return!1;try{l(!0);const C=await i.pushManager.getSubscription();return C&&await C.unsubscribe(),await J.from("push_subscriptions").delete().eq("user_id",t.id),a(!1),ze.success("Push notifications disabled"),!0}catch(C){console.error("Error unsubscribing:",C);const N=C instanceof Error?C.message:"Unknown error";return ze.error("Failed to disable push notifications: "+N),!1}finally{l(!1)}},[i,t]);return{isSupported:y,permission:e,isSubscribed:s,isLoading:o,vapidPublicKey:p,subscribe:b,unsubscribe:j}}const oke="push_notification_prompt_dismissed",Qut=()=>{const{user:t}=Qr(),{isSupported:e,isSubscribed:n,isLoading:s,subscribe:a}=KOe(),[o,l]=I.useState(!1),[i,h]=I.useState(!1);I.useEffect(()=>{if(!t||!e||n||s||localStorage.getItem(`${oke}_${t.id}`))return;const b=setTimeout(()=>{l(!0)},2e3);return()=>clearTimeout(b)},[t,e,n,s]);const p=async()=>{h(!0);const y=await a();h(!1),y&&l(!1)},x=()=>{t&&localStorage.setItem(`${oke}_${t.id}`,"true"),l(!1)};return!e||n?null:r.jsx(Fr,{open:o,onOpenChange:y=>!y&&x(),children:r.jsxs(Rr,{className:"sm:max-w-md",children:[r.jsxs(qr,{children:[r.jsx("div",{className:"mx-auto mb-4 flex h-12 w-12 items-center justify-center rounded-full bg-primary/10",children:r.jsx(gg,{className:"h-6 w-6 text-primary"})}),r.jsx($r,{className:"text-center",children:"Stay in the Loop!"}),r.jsx(Xn,{className:"text-center",children:"Enable push notifications to get alerted when:"})]}),r.jsxs("ul",{className:"my-4 space-y-2 text-sm text-muted-foreground",children:[r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-primary",children:"•"})," New events go live"]}),r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-primary",children:"•"})," Fresh templates are added"]}),r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-primary",children:"•"})," New toolbox resources drop"]}),r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-primary",children:"•"})," Social swag updates"]}),r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-primary",children:"•"})," New newsletters arrive"]}),r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-primary",children:"•"})," Posts in your community groups"]})]}),r.jsxs("div",{className:"flex flex-col gap-2",children:[r.jsx(ee,{onClick:p,disabled:i,className:"w-full",children:i?"Enabling...":"Enable Notifications"}),r.jsx(ee,{variant:"ghost",onClick:x,className:"w-full",children:"Not Now"})]}),r.jsx("p",{className:"text-center text-xs text-muted-foreground",children:"You can always change this in your Profile settings."})]})})},lke=t=>{let e;const n=new Set,s=(p,x)=>{const y=typeof p=="function"?p(e):p;if(!Object.is(y,e)){const b=e;e=x??(typeof y!="object"||y===null)?y:Object.assign({},e,y),n.forEach(j=>j(e,b))}},a=()=>e,i={setState:s,getState:a,getInitialState:()=>h,subscribe:p=>(n.add(p),()=>n.delete(p))},h=e=t(s,a,i);return i},Jut=t=>t?lke(t):lke,eht=t=>t;function tht(t,e=eht){const n=st.useSyncExternalStore(t.subscribe,st.useCallback(()=>e(t.getState()),[t,e]),st.useCallback(()=>e(t.getInitialState()),[t,e]));return st.useDebugValue(n),n}const rht=t=>{const e=Jut(t),n=s=>tht(e,s);return Object.assign(n,e),n},nht=t=>rht;function sht(t,e){let n;try{n=t()}catch{return}return{getItem:a=>{var o;const l=h=>h===null?null:JSON.parse(h,void 0),i=(o=n.getItem(a))!=null?o:null;return i instanceof Promise?i.then(l):l(i)},setItem:(a,o)=>n.setItem(a,JSON.stringify(o,void 0)),removeItem:a=>n.removeItem(a)}}const whe=t=>e=>{try{const n=t(e);return n instanceof Promise?n:{then(s){return whe(s)(n)},catch(s){return this}}}catch(n){return{then(s){return this},catch(s){return whe(s)(n)}}}},aht=(t,e)=>(n,s,a)=>{let o={storage:sht(()=>localStorage),partialize:N=>N,version:0,merge:(N,A)=>({...A,...N}),...e},l=!1;const i=new Set,h=new Set;let p=o.storage;if(!p)return t((...N)=>{console.warn(`[zustand persist middleware] Unable to update item '${o.name}', the given storage is currently unavailable.`),n(...N)},s,a);const x=()=>{const N=o.partialize({...s()});return p.setItem(o.name,{state:N,version:o.version})},y=a.setState;a.setState=(N,A)=>(y(N,A),x());const b=t((...N)=>(n(...N),x()),s,a);a.getInitialState=()=>b;let j;const C=()=>{var N,A;if(!p)return;l=!1,i.forEach(T=>{var L;return T((L=s())!=null?L:b)});const E=((A=o.onRehydrateStorage)==null?void 0:A.call(o,(N=s())!=null?N:b))||void 0;return whe(p.getItem.bind(p))(o.name).then(T=>{if(T)if(typeof T.version=="number"&&T.version!==o.version){if(o.migrate){const L=o.migrate(T.state,T.version);return L instanceof Promise?L.then(z=>[!0,z]):[!0,L]}console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,T.state];return[!1,void 0]}).then(T=>{var L;const[z,F]=T;if(j=o.merge(F,(L=s())!=null?L:b),n(j,!0),z)return x()}).then(()=>{E==null||E(j,void 0),j=s(),l=!0,h.forEach(T=>T(j))}).catch(T=>{E==null||E(void 0,T)})};return a.persist={setOptions:N=>{o={...o,...N},N.storage&&(p=N.storage)},clearStorage:()=>{p==null||p.removeItem(o.name)},getOptions:()=>o,rehydrate:()=>C(),hasHydrated:()=>l,onHydrate:N=>(i.add(N),()=>{i.delete(N)}),onFinishHydration:N=>(h.add(N),()=>{h.delete(N)})},o.skipHydration||C(),j||b},iht=aht,xse=nht()(iht((t,e)=>({cartItems:[],addToCart:(n,s,a=1,o)=>{t(l=>{const i=l.cartItems.findIndex(h=>{var p;return h.product.id===n.id&&((p=h.variant)==null?void 0:p.id)===(s==null?void 0:s.id)});if(i>=0){const h=[...l.cartItems];return h[i].quantity+=a,o&&(h[i].artworkUrl=o),{cartItems:h}}return{cartItems:[...l.cartItems,{product:n,variant:s,quantity:a,artworkUrl:o}]}})},removeFromCart:(n,s)=>{t(a=>({cartItems:a.cartItems.filter(o=>{var l;return!(o.product.id===n&&((l=o.variant)==null?void 0:l.id)===s)})}))},updateQuantity:(n,s,a)=>{t(o=>({cartItems:o.cartItems.map(l=>{var i;return l.product.id===n&&((i=l.variant)==null?void 0:i.id)===s?{...l,quantity:Math.max(1,a)}:l})}))},updateArtwork:(n,s,a)=>{t(o=>({cartItems:o.cartItems.map(l=>{var i;return l.product.id===n&&((i=l.variant)==null?void 0:i.id)===s?{...l,artworkUrl:a}:l})}))},clearCart:()=>t({cartItems:[]}),getItemPrice:n=>{const s=Number(n.product.base_price),a=n.variant?Number(n.variant.price_adjustment):0;return s+a},getSubtotal:()=>{const{cartItems:n,getItemPrice:s}=e();return n.reduce((a,o)=>a+s(o)*o.quantity,0)},getShippingTotal:()=>{const{cartItems:n}=e();return n.reduce((s,a)=>s+Number(a.product.shipping_fee)*a.quantity,0)},getTotal:()=>{const{getSubtotal:n,getShippingTotal:s}=e();return n()+s()}}),{name:"marketplace-cart",partialize:t=>({cartItems:t.cartItems})})),ZOe=I.createContext({onlineUsers:[],totalOnline:0}),oht=async t=>{try{const{data:e}=await J.storage.from("avatars").list(`${t}`);if(e&&e.length>0){const{data:n}=J.storage.from("avatars").getPublicUrl(`${t}/${e[0].name}`);return n.publicUrl}}catch{}},lht=({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=J.channel("app-presence",{config:{presence:{key:e.id}}});return p.on("presence",{event:"sync"},()=>{const x=p.presenceState(),y=[];Object.entries(x).forEach(([b,j])=>{if(j&&j.length>0){const C=j[0];y.push({id:b,name:C.name||"Unknown",avatarUrl:C.avatarUrl,brokerageId:C.brokerageId,onlineSince:C.onlineSince})}}),o(y)}).on("presence",{event:"join"},()=>{}).on("presence",{event:"leave"},()=>{}).subscribe(async x=>{var y;if(x==="SUBSCRIBED"){const{data:b}=await J.from("profiles").select("name, brokerage_id").eq("id",e.id).single(),j=await oht(e.id);await p.track({name:(b==null?void 0:b.name)||((y=e.email)==null?void 0:y.split("@")[0])||"User",avatarUrl:j,brokerageId:b==null?void 0:b.brokerage_id,onlineSince:new Date().toISOString()})}}),i(p),()=>{p.unsubscribe()}},[e]);const h=a.filter(p=>p.id===(e==null?void 0:e.id)?!1:!!(s||n&&p.brokerageId===n||!n&&!p.brokerageId));return r.jsx(ZOe.Provider,{value:{onlineUsers:h,totalOnline:a.length},children:t})},YOe=()=>I.useContext(ZOe),cke="dashboard-sidebar-collapsed",Lr=({children:t,title:e})=>{var me,Le,Ne;const{user:n,signOut:s,isAdmin:a,isBrokerageManager:o,brokerageId:l}=Qr(),{isAssistant:i,actingAsAgent:h}=xge(),x=i&&!!h?40:0,{avatarUrl:y}=vLe(n==null?void 0:n.id),{isTrial:b,isExpired:j,expiresAt:C}=Kot(n==null?void 0:n.id),{isMarketplaceEnabled:N}=bLe(),{currentBrief:A,shouldShowPopup:E,hasUnseenBrief:T,openBrief:L,closeBrief:z,dismissBrief:F}=Wut(),{unreadCount:q}=Zot(),{openCount:H}=Yot(),G=xse(Be=>Be.cartItems).reduce((Be,Ee)=>Be+Ee.quantity,0),te=rs(),ie=jm(),[le,ye]=I.useState(()=>typeof window<"u"?localStorage.getItem(cke)==="true":!1);I.useEffect(()=>{localStorage.setItem(cke,String(le))},[le]);const[ne,ge]=I.useState({agentos:!0,tools:!0,marketing:!0,learning:!0,community:!0,help:!1}),ae=Be=>{ge(Ee=>({...Ee,[Be]:!Ee[Be]}))},he=Be=>Be.split(" ").map(Ee=>Ee[0]).join("").toUpperCase().slice(0,2),ue=Be=>ie.pathname===Be,_e=Be=>Be.some(Ee=>ie.pathname===Ee),Ae=({path:Be,icon:Ee,label:Ue,badgeCount:Re})=>{const je=r.jsxs(ee,{variant:"ghost",size:"sm",className:$t("text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground relative",ue(Be)&&"bg-sidebar-accent text-sidebar-accent-foreground",le?"w-10 h-10 p-0 justify-center":"w-full justify-start gap-2"),onClick:()=>te(Be),children:[r.jsxs("div",{className:"relative",children:[r.jsx(Ee,{className:"h-4 w-4 shrink-0"}),le&&Re!=null&&Re>0&&r.jsx("span",{className:"absolute -top-1 -right-1 h-2 w-2 rounded-full bg-destructive"})]}),!le&&Ue,!le&&Re!=null&&Re>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:Re>9?"9+":Re})]});return le?r.jsxs(Sg,{delayDuration:0,children:[r.jsx(Cg,{asChild:!0,children:je}),r.jsxs(xm,{side:"right",className:"flex items-center gap-2",children:[Ue,Re!=null&&Re>0&&r.jsx("span",{className:"flex h-5 w-5 items-center justify-center rounded-full bg-destructive text-destructive-foreground text-xs",children:Re>9?"9+":Re})]})]}):je},Ce=({id:Be,label:Ee,icon:Ue,children:Re,activePaths:je,showBetaBadge:et,defaultPath:Te,badgeCount:Ze})=>{if(le){const pe=Te||je[0];return r.jsxs(Sg,{delayDuration:0,children:[r.jsx(Cg,{asChild:!0,children:r.jsx(ee,{variant:"ghost",size:"sm",className:$t("w-10 h-10 p-0 justify-center text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground relative",_e(je)&&"text-primary"),onClick:()=>te(pe),children:r.jsxs("div",{className:"relative",children:[r.jsx(Ue,{className:"h-4 w-4"}),Ze!=null&&Ze>0&&r.jsx("span",{className:"absolute -top-1 -right-1 h-2 w-2 rounded-full bg-destructive"})]})})}),r.jsxs(xm,{side:"right",className:"flex items-center gap-2",children:[Ee,et&&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"}),Ze!=null&&Ze>0&&r.jsx("span",{className:"flex h-5 w-5 items-center justify-center rounded-full bg-destructive text-destructive-foreground text-xs",children:Ze>9?"9+":Ze})]})]})}return r.jsxs(kS,{open:ne[Be],onOpenChange:()=>ae(Be),children:[r.jsx(NS,{asChild:!0,children:r.jsxs(ee,{variant:"ghost",size:"sm",className:$t("w-full justify-between gap-2 text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",_e(je)&&"text-primary"),children:[r.jsxs("span",{className:"flex items-center gap-2 font-semibold text-[15px]",children:[r.jsx(Ue,{className:"h-4 w-4"}),Ee,et&&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:[Ze!=null&&Ze>0&&r.jsx("span",{className:"flex h-5 w-5 items-center justify-center rounded-full bg-destructive text-destructive-foreground text-xs",children:Ze>9?"9+":Ze}),r.jsx(Dd,{className:$t("h-4 w-4 transition-transform duration-200",ne[Be]&&"rotate-180")})]})]})}),r.jsx(SS,{className:"pl-4 space-y-1 mt-1",children:Re})]})},be=({isMobile:Be=!1})=>{const Ee=Be?!1:le;return r.jsxs("div",{className:"flex flex-col h-full",children:[r.jsxs("div",{className:$t("p-3 border-b border-sidebar-border",Ee?"flex flex-col items-center gap-2":"flex items-center justify-between"),children:[Ee?r.jsx("img",{src:xlt,alt:"LevelUp",className:"h-8 w-auto"}):r.jsx("img",{src:Lje,alt:"LevelUp",className:"h-8 w-auto"}),!Be&&r.jsxs(Sg,{delayDuration:0,children:[r.jsx(Cg,{asChild:!0,children:r.jsx(ee,{variant:"ghost",size:"icon",className:"h-8 w-8 shrink-0",onClick:()=>ye(!Ee),children:r.jsx(Tc,{className:$t("h-4 w-4 transition-transform duration-300",Ee&&"rotate-180")})})}),r.jsx(xm,{side:"right",children:Ee?"Expand sidebar":"Collapse sidebar"})]})]}),r.jsx(Jo,{className:"flex-1",children:r.jsxs("nav",{className:$t("p-3 space-y-1",Ee&&"flex flex-col items-center"),children:[r.jsx(Ae,{path:"/dashboard",icon:gj,label:"Dashboard"}),r.jsx(Ae,{path:"/events",icon:hm,label:"Events"}),r.jsxs(Ce,{id:"agentos",label:"Agent OS",icon:eS,activePaths:["/mission-control","/mission-control/contacts","/mission-control/plans","/mission-control/popbys","/mission-control/video-library","/mission-control/scorecard","/mission-control/listings","/mission-control/pipeline"],showBetaBadge:!0,defaultPath:"/mission-control",children:[r.jsx(Ae,{path:"/mission-control",icon:ci,label:"Mission Control"}),r.jsx(Ae,{path:"/mission-control/contacts",icon:Bn,label:"Contacts"}),r.jsx(Ae,{path:"/mission-control/plans",icon:hm,label:"TouchPlans"}),r.jsx(Ae,{path:"/mission-control/pipeline",icon:y1,label:"Deal Pipeline"}),r.jsx(Ae,{path:"/mission-control/popbys",icon:Ki,label:"Popbys"}),r.jsx(Ae,{path:"/mission-control/video-library",icon:Pa,label:"Video Library"}),r.jsx(Ae,{path:"/mission-control/scorecard",icon:cc,label:"Scorecard"}),r.jsx(Ae,{path:"/mission-control/listings",icon:ai,label:"Listing Exchange"})]}),r.jsxs(Ce,{id:"tools",label:"Tools",icon:Bh,activePaths:["/apps","/ai-toolkit","/mission-control/my-card"],defaultPath:"/apps",children:[r.jsx(Ae,{path:"/apps",icon:Bh,label:"Apps"}),!Ee&&r.jsxs(ee,{variant:"ghost",size:"sm",className:$t("w-full justify-start gap-2 text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",ue("/mission-control/my-card")&&"bg-sidebar-accent text-sidebar-accent-foreground"),onClick:()=>te("/mission-control/my-card"),children:[r.jsx(fm,{className:"h-4 w-4"}),"Digital Card",r.jsx("span",{className:"ml-auto text-[9px] font-bold uppercase tracking-wide px-1.5 py-0.5 rounded-full bg-destructive text-destructive-foreground",children:"New"})]}),Ee&&r.jsx(Ae,{path:"/mission-control/my-card",icon:fm,label:"Digital Card"})]}),r.jsxs(Ce,{id:"marketing",label:"Marketing",icon:gm,activePaths:["/templates","/social-swag-2","/newsletters"],defaultPath:"/templates",children:[r.jsx(Ae,{path:"/templates",icon:Fd,label:"Templates"}),!Ee&&r.jsxs(ee,{variant:"ghost",size:"sm",className:$t("w-full justify-start gap-2 text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",ue("/social-swag-2")&&"bg-sidebar-accent text-sidebar-accent-foreground"),onClick:()=>te("/social-swag-2"),children:[r.jsx(bg,{className:"h-4 w-4"}),"Social Swag",r.jsx("span",{className:"ml-auto text-[9px] font-bold uppercase tracking-wide px-1.5 py-0.5 rounded-full bg-destructive text-destructive-foreground",children:"New"})]}),Ee&&r.jsx(Ae,{path:"/social-swag-2",icon:bg,label:"Social Swag"}),r.jsx(Ae,{path:"/newsletters",icon:Vx,label:"Newsletters"})]}),r.jsxs(Ce,{id:"learning",label:"Learning",icon:NT,activePaths:["/academy","/toolbox"],defaultPath:"/academy",children:[r.jsx(Ae,{path:"/academy",icon:g1,label:"Academy"}),r.jsx(Ae,{path:"/toolbox",icon:Wx,label:"Toolbox"})]}),r.jsxs(Ce,{id:"community",label:"Community",icon:Lo,activePaths:["/community","/wishlist"],defaultPath:"/community",badgeCount:q,children:[r.jsx(Ae,{path:"/community",icon:Bn,label:"Community",badgeCount:q}),r.jsx(Ae,{path:"/wishlist",icon:v1,label:"Wishlist",badgeCount:H}),!Ee&&r.jsxs(ee,{variant:"ghost",size:"sm",className:"w-full justify-start gap-2 text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",onClick:()=>window.open("https://www.facebook.com/share/g/1CC6thti2V/","_blank"),children:[r.jsx(Fs,{className:"h-4 w-4"}),"Facebook Group"]})]}),r.jsxs(Ce,{id:"goods",label:"The Goods",icon:fh,activePaths:["/marketplace","/reward-store"],defaultPath:"/reward-store",children:[N&&!Ee&&r.jsxs(ee,{variant:"ghost",size:"sm",className:$t("w-full justify-start gap-2 text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",ie.pathname.startsWith("/marketplace")&&"bg-sidebar-accent text-sidebar-accent-foreground"),onClick:()=>te("/marketplace"),children:[r.jsx(fh,{className:"h-4 w-4"}),"Marketplace",r.jsx("span",{className:"ml-auto text-[9px] font-bold uppercase tracking-wide px-1.5 py-0.5 rounded-full bg-primary text-primary-foreground",children:"New"})]}),N&&Ee&&r.jsx(Ae,{path:"/marketplace",icon:fh,label:"Marketplace"}),r.jsx(Ae,{path:"/reward-store",icon:Zi,label:"Reward Store"})]}),r.jsxs(Ce,{id:"help",label:"Help & Services",icon:Nx,activePaths:["/support","/additional-services"],defaultPath:"/support",children:[r.jsx(Ae,{path:"/support",icon:oS,label:"Support"}),r.jsx(Ae,{path:"/additional-services",icon:Ms,label:"Additional Services"})]}),a&&r.jsxs(r.Fragment,{children:[!Ee&&r.jsx("div",{className:"pt-3 pb-1",children:r.jsx("p",{className:"px-2 text-xs font-semibold text-muted-foreground uppercase tracking-wider",children:"Admin"})}),Ee?r.jsx("div",{className:"pt-3 border-t border-sidebar-border mt-3 space-y-1",children:r.jsx(Ae,{path:"/admin",icon:Zf,label:"Admin Dashboard"})}):r.jsxs(ee,{variant:"ghost",size:"sm",className:$t("w-full justify-start gap-2 text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",ie.pathname==="/admin"&&"bg-sidebar-accent text-sidebar-accent-foreground"),onClick:()=>te("/admin"),children:[r.jsx(Zf,{className:"h-4 w-4"}),"Admin Dashboard"]})]}),(l||o)&&!a&&r.jsxs(r.Fragment,{children:[!Ee&&r.jsx("div",{className:"pt-3 pb-1",children:r.jsx("p",{className:"px-2 text-xs font-semibold text-muted-foreground uppercase tracking-wider",children:"My Brokerage"})}),Ee?r.jsxs("div",{className:"border-t border-sidebar-border mt-3 pt-3 space-y-1",children:[l&&r.jsx(Ae,{path:"/my-brokerage",icon:ai,label:"My Brokerage"}),o&&r.jsxs(r.Fragment,{children:[r.jsx(Ae,{path:"/brokerage/dashboard",icon:fd,label:"Manage Brokerages"}),r.jsx(Ae,{path:"/brokerage-resources",icon:yh,label:"Brokerage Resources"})]})]}):r.jsxs(r.Fragment,{children:[l&&r.jsxs(ee,{variant:"ghost",size:"sm",className:$t("w-full justify-start gap-2 text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",ue("/my-brokerage")&&"bg-sidebar-accent text-sidebar-accent-foreground"),onClick:()=>te("/my-brokerage"),children:[r.jsx(ai,{className:"h-4 w-4"}),"My Brokerage"]}),o&&r.jsxs(r.Fragment,{children:[r.jsxs(ee,{variant:"ghost",size:"sm",className:$t("w-full justify-start gap-2 text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",ue("/brokerage/dashboard")&&"bg-sidebar-accent text-sidebar-accent-foreground"),onClick:()=>te("/brokerage/dashboard"),children:[r.jsx(fd,{className:"h-4 w-4"}),"Manage Brokerages"]}),r.jsxs(ee,{variant:"ghost",size:"sm",className:$t("w-full justify-start gap-2 text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",ue("/brokerage-resources")&&"bg-sidebar-accent text-sidebar-accent-foreground"),onClick:()=>te("/brokerage-resources"),children:[r.jsx(yh,{className:"h-4 w-4"}),"Brokerage Resources"]})]})]})]})]})}),r.jsxs("div",{className:"p-3 border-t border-sidebar-border md:hidden",children:[r.jsxs(ee,{variant:"ghost",size:"sm",className:$t("w-full justify-start gap-2 text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",ue("/profile")&&"bg-sidebar-accent text-sidebar-accent-foreground"),onClick:()=>te("/profile"),children:[r.jsx(Ec,{className:"h-4 w-4"}),"Profile"]}),r.jsxs(ee,{variant:"ghost",size:"sm",className:"w-full justify-start gap-2 text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",onClick:s,children:[r.jsx(dS,{className:"h-4 w-4"}),"Sign Out"]})]})]})};return r.jsx(lht,{children:r.jsx(mI,{children:r.jsxs("div",{className:"min-h-screen bg-background flex",children:[b&&j&&r.jsx(Tut,{}),typeof document<"u"&&uy.createPortal(r.jsx("aside",{className:$t("hidden md:flex flex-col bg-card border-r border-border fixed left-0 z-[2147483647] isolate !pointer-events-auto transition-[width] duration-300",le?"w-16":"w-52"),style:{top:`${x}px`,height:`calc(100vh - ${x}px)`},children:r.jsx(be,{})}),document.body),r.jsxs("div",{className:$t("flex-1 flex flex-col overflow-hidden transition-all duration-300",le?"md:ml-16":"md:ml-52"),style:{height:`calc(100vh - ${x}px)`,marginTop:`${x}px`},children:[r.jsx("header",{className:"sticky top-0 z-40 bg-card border-b border-border flex-shrink-0",children:r.jsxs("div",{className:"flex items-center justify-between px-6 py-3",children:[r.jsxs(Jne,{children:[r.jsx(Rge,{asChild:!0,children:r.jsx(ee,{variant:"ghost",size:"icon",className:"md:hidden",children:r.jsx(OT,{className:"h-5 w-5"})})}),r.jsx(NI,{side:"left",className:"w-52 p-0 bg-card",children:r.jsx(be,{isMobile:!0})})]}),r.jsx("div",{className:"flex-1 md:hidden",children:r.jsx("img",{src:Lje,alt:"LevelUp",className:"h-8 w-auto"})}),r.jsx("div",{className:"hidden md:flex flex-1 justify-center",children:r.jsx(ike,{})}),r.jsxs("div",{className:"flex items-center gap-3 ml-auto",children:[b&&!j&&C&&r.jsx(Mut,{expiresAt:C,className:"hidden lg:flex"}),r.jsx("div",{className:"md:hidden",children:r.jsx(ike,{})}),A&&r.jsx(Aut,{hasUnseenBrief:T,onClick:L}),N&&r.jsxs(ee,{variant:"ghost",size:"icon",className:"relative",onClick:()=>te("/marketplace/cart"),children:[r.jsx(fh,{className:"h-5 w-5"}),G>0&&r.jsx("span",{className:"absolute -top-1 -right-1 h-5 w-5 rounded-full bg-primary text-primary-foreground text-xs font-medium flex items-center justify-center",children:G>99?"99+":G})]}),r.jsx(eut,{}),r.jsx(ghe,{}),r.jsxs("span",{className:"hidden sm:block text-sm font-medium text-foreground",children:["Hello, ",((Le=(me=n==null?void 0:n.user_metadata)==null?void 0:me.name)==null?void 0:Le.split(" ")[0])||"User","!"]}),r.jsxs(wh,{children:[r.jsx(jh,{asChild:!0,children:r.jsx("button",{className:"focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 rounded-full",children:r.jsxs(Ks,{className:"h-9 w-9 cursor-pointer hover:opacity-80 transition-opacity",children:[r.jsx(Ei,{src:y||void 0}),r.jsx(Zs,{className:"bg-primary text-primary-foreground font-medium text-sm",children:he(((Ne=n==null?void 0:n.user_metadata)==null?void 0:Ne.name)||(n==null?void 0:n.email)||"U")})]})})}),r.jsxs(Wu,{align:"end",className:"w-48",children:[r.jsxs(di,{onClick:()=>te("/profile"),className:"cursor-pointer",children:[r.jsx(Ec,{className:"h-4 w-4 mr-2"}),"Profile"]}),r.jsx(Fj,{}),r.jsxs(di,{onClick:s,className:"cursor-pointer text-destructive focus:text-destructive",children:[r.jsx(dS,{className:"h-4 w-4 mr-2"}),"Sign Out"]})]})]})]})]})}),r.jsx(Kut,{children:r.jsx("main",{className:"p-4 sm:p-6 lg:p-8 overflow-x-hidden",children:t})}),A&&r.jsx(Hut,{brief:A,open:E,onClose:z,onDismiss:F}),r.jsx(Gut,{}),r.jsx(Yut,{}),r.jsx(Qut,{})]})]})})})},cht=()=>{const{user:t}=Qr(),[e,n]=I.useState(!1),[s,a]=I.useState(null),[o,l]=I.useState(""),i=async y=>{var b;if(!(t!=null&&t.email)){ze.error("Please sign in to upgrade");return}n(!0),a(y);try{const{data:j,error:C}=await J.functions.invoke("create-checkout",{body:{tier:y,email:t.email,name:((b=t.user_metadata)==null?void 0:b.full_name)||t.email,couponCode:o.trim()||void 0,skipTrial:!0}});if(C)throw C;if(j!=null&&j.url)window.open(j.url,"_blank","noopener,noreferrer"),ze.success("Checkout opened in a new tab");else throw new Error("No checkout URL returned")}catch(j){console.error("Checkout error:",j),ze.error(j.message||"Failed to start checkout. Please try again.")}finally{n(!1),a(null)}},h=["Unlimited access to all marketing templates","Complete Academy training library","AI-powered tools and resources","Community forums and support","Exclusive member events and workshops","Deal pipeline & scorecard tracking","Listing exchange access","Social media content library"],p=["Everything in Individual plan","Up to 25 agent seats","Brokerage admin dashboard","Team performance analytics","Custom branding options","Priority support","Agent onboarding tools","Brokerage-wide announcements"],x=["Everything in Brokerage plan","Unlimited agent seats","Dedicated account manager","Advanced analytics & reporting","White-label options","API access","Custom integrations","Enterprise-level support"];return r.jsx(Lr,{children:r.jsxs("div",{className:"container max-w-6xl py-8 px-4",children:[r.jsxs("div",{className:"text-center mb-8",children:[r.jsx("h1",{className:"text-3xl font-bold mb-2",children:"Upgrade Your Membership"}),r.jsx("p",{className:"text-muted-foreground text-lg",children:"Choose the plan that's right for you and unlock the full power of LevelUp"})]}),r.jsxs("div",{className:"max-w-md mx-auto mb-8",children:[r.jsx(He,{htmlFor:"coupon",className:"text-sm font-medium",children:"Have a discount code?"}),r.jsx(dt,{id:"coupon",placeholder:"Enter discount code",value:o,onChange:y=>l(y.target.value),className:"mt-1"})]}),r.jsxs("div",{className:"grid md:grid-cols-3 gap-6 mb-8",children:[r.jsxs(Ye,{className:"border-2 border-primary/20 hover:border-primary/50 transition-colors relative overflow-hidden",children:[r.jsx("div",{className:"absolute top-0 right-0 bg-primary text-primary-foreground text-xs px-3 py-1 rounded-bl-lg font-medium",children:"Popular"}),r.jsxs(Gt,{className:"text-center pb-2",children:[r.jsx("div",{className:"mx-auto mb-3 h-14 w-14 rounded-full bg-primary/10 flex items-center justify-center",children:r.jsx(Bn,{className:"h-7 w-7 text-primary"})}),r.jsx(Zt,{className:"text-xl",children:"Individual Agent"}),r.jsx(Mn,{children:"Perfect for solo agents ready to level up"})]}),r.jsxs(tt,{className:"space-y-6",children:[r.jsxs("div",{className:"text-center",children:[r.jsx("span",{className:"text-4xl font-bold text-primary",children:"$39"}),r.jsx("span",{className:"text-muted-foreground",children:"/month"})]}),r.jsx("ul",{className:"space-y-2",children:h.map((y,b)=>r.jsxs("li",{className:"flex items-start gap-2 text-sm",children:[r.jsx(Ai,{className:"h-4 w-4 text-primary mt-0.5 shrink-0"}),r.jsx("span",{children:y})]},b))}),r.jsxs(ee,{className:"w-full",size:"lg",onClick:()=>i("individual_agent"),disabled:e,children:[e&&s==="individual_agent"?r.jsx(en,{className:"h-4 w-4 mr-2 animate-spin"}):r.jsx(Ms,{className:"h-4 w-4 mr-2"}),"Get Started"]})]})]}),r.jsxs(Ye,{className:"border-2 border-amber-500/20 hover:border-amber-500/50 transition-colors",children:[r.jsxs(Gt,{className:"text-center pb-2",children:[r.jsx("div",{className:"mx-auto mb-3 h-14 w-14 rounded-full bg-amber-500/10 flex items-center justify-center",children:r.jsx(ai,{className:"h-7 w-7 text-amber-600"})}),r.jsx(Zt,{className:"text-xl",children:"Brokerage"}),r.jsx(Mn,{children:"For teams and brokerages up to 25 agents"})]}),r.jsxs(tt,{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,b)=>r.jsxs("li",{className:"flex items-start gap-2 text-sm",children:[r.jsx(Ai,{className:"h-4 w-4 text-amber-600 mt-0.5 shrink-0"}),r.jsx("span",{children:y})]},b))}),r.jsxs(ee,{variant:"outline",className:"w-full border-amber-500 text-amber-600 hover:bg-amber-50",size:"lg",onClick:()=>i("brokerage_under_25"),disabled:e,children:[e&&s==="brokerage_under_25"?r.jsx(en,{className:"h-4 w-4 mr-2 animate-spin"}):r.jsx(ai,{className:"h-4 w-4 mr-2"}),"Get Started"]})]})]}),r.jsxs(Ye,{className:"border-2 border-purple-500/20 hover:border-purple-500/50 transition-colors",children:[r.jsxs(Gt,{className:"text-center pb-2",children:[r.jsx("div",{className:"mx-auto mb-3 h-14 w-14 rounded-full bg-purple-500/10 flex items-center justify-center",children:r.jsx(ai,{className:"h-7 w-7 text-purple-600"})}),r.jsx(Zt,{className:"text-xl",children:"Brokerage 25+"}),r.jsx(Mn,{children:"For larger brokerages with 25+ agents"})]}),r.jsxs(tt,{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,b)=>r.jsxs("li",{className:"flex items-start gap-2 text-sm",children:[r.jsx(Ai,{className:"h-4 w-4 text-purple-600 mt-0.5 shrink-0"}),r.jsx("span",{children:y})]},b))}),r.jsxs(ee,{variant:"outline",className:"w-full border-purple-500 text-purple-600 hover:bg-purple-50",size:"lg",onClick:()=>i("brokerage_over_25"),disabled:e,children:[e&&s==="brokerage_over_25"?r.jsx(en,{className:"h-4 w-4 mr-2 animate-spin"}):r.jsx(ai,{className:"h-4 w-4 mr-2"}),"Get Started"]})]})]})]}),r.jsx(Ye,{className:"bg-muted/50",children:r.jsxs(tt,{className:"py-6",children:[r.jsx("p",{className:"text-center font-medium mb-4",children:"Questions? We're here to help!"}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 justify-center",children:[r.jsxs("a",{href:"tel:1-866-527-8668",className:"flex items-center justify-center gap-2 text-primary hover:underline",children:[r.jsx(bi,{className:"h-4 w-4"}),r.jsx("span",{children:"1-866-527-8668"})]}),r.jsxs("a",{href:"mailto:support@relevelup.com",className:"flex items-center justify-center gap-2 text-primary hover:underline",children:[r.jsx(da,{className:"h-4 w-4"}),r.jsx("span",{children:"support@relevelup.com"})]})]})]})})]})})},dht=()=>{const{user:t,loading:e,isBrokerageManager:n,brokerageId:s}=Qr(),a=rs(),[o,l]=I.useState(""),[i,h]=I.useState(!1),[p,x]=I.useState(!1);I.useEffect(()=>{!e&&!t&&a("/auth")},[t,e,a]),I.useEffect(()=>{!e&&t&&s&&a("/profile?setup=true")},[t,e,s,a]);const y=async()=>{if(!o.trim()){ze.error("Please enter a brokerage name");return}const{data:b}=await J.auth.getSession(),j=b.session;if(!t||!j){ze.error("Please sign in again to create your brokerage."),a("/auth");return}h(!0);try{console.log("[SetupBrokerage] Creating brokerage…",{hasUser:!!t,hasSession:!!j,userId:t==null?void 0:t.id});const{data:C,error:N}=await J.functions.invoke("create-brokerage",{body:{name:o.trim()}});if(console.log("[SetupBrokerage] create-brokerage response",{data:C,error:N}),N)throw N;if(!(C!=null&&C.ok))throw new Error((C==null?void 0:C.error)||"Failed to create brokerage");h(!1),x(!0),ze.success("Brokerage created! Setting up your account..."),setTimeout(()=>{a("/profile?setup=true")},2e3)}catch(C){console.error("Error creating brokerage:",C),ze.error(C.message||"Failed to create brokerage"),h(!1)}};return e?r.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background",children:r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})}):p?r.jsx("div",{className:"min-h-screen bg-gradient-to-br from-background via-primary/5 to-secondary/10 flex items-center justify-center p-4",children:r.jsxs(Ye,{className:"max-w-lg w-full",children:[r.jsxs(Gt,{className:"text-center",children:[r.jsx("div",{className:"mx-auto w-16 h-16 rounded-full bg-primary/10 flex items-center justify-center mb-4",children:r.jsx(en,{className:"w-10 h-10 text-primary animate-spin"})}),r.jsx(Zt,{className:"text-2xl",children:"Setting Up Your Brokerage"}),r.jsx(Mn,{className:"text-lg",children:"We're assigning you as the brokerage manager and preparing your dashboard..."})]}),r.jsxs(tt,{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-center gap-2 text-muted-foreground",children:[r.jsx(Yi,{className:"w-5 h-5 text-green-500"}),r.jsx("span",{children:"Brokerage created"})]}),r.jsxs("div",{className:"flex items-center justify-center gap-2 text-muted-foreground",children:[r.jsx(en,{className:"w-5 h-5 animate-spin text-primary"}),r.jsx("span",{children:"Assigning you as manager..."})]}),r.jsx("p",{className:"text-center text-sm text-muted-foreground mt-4",children:"You'll be redirected to complete your profile setup in a moment."})]})]})}):r.jsx("div",{className:"min-h-screen bg-gradient-to-br from-background via-primary/5 to-secondary/10 flex items-center justify-center p-4",children:r.jsxs(Ye,{className:"max-w-lg w-full",children:[r.jsxs(Gt,{className:"text-center",children:[r.jsx("div",{className:"mx-auto w-16 h-16 rounded-full bg-primary/10 flex items-center justify-center mb-4",children:r.jsx(ai,{className:"w-10 h-10 text-primary"})}),r.jsx(Zt,{className:"text-2xl",children:"Set Up Your Brokerage"}),r.jsx(Mn,{className:"text-lg",children:"Create your brokerage to start managing your team"})]}),r.jsxs(tt,{className:"space-y-6",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"brokerage-name",children:"Brokerage Name"}),r.jsx(dt,{id:"brokerage-name",placeholder:"Enter your brokerage name",value:o,onChange:b=>l(b.target.value),onKeyDown:b=>b.key==="Enter"&&y()}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"This is how your brokerage will appear to your agents"})]}),r.jsxs("div",{className:"p-4 rounded-lg bg-muted/50 space-y-3",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2",children:[r.jsx(Bn,{className:"w-4 h-4 text-primary"}),"What you can do as a Brokerage Manager:"]}),r.jsxs("ul",{className:"space-y-2 text-sm text-muted-foreground",children:[r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx(Yi,{className:"w-4 h-4 text-green-500"}),"Invite agents to join your brokerage"]}),r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx(Yi,{className:"w-4 h-4 text-green-500"}),"Access exclusive brokerage resources"]}),r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx(Yi,{className:"w-4 h-4 text-green-500"}),"Track your team's activity and engagement"]}),r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx(Yi,{className:"w-4 h-4 text-green-500"}),"Share resources with your agents"]})]})]}),r.jsxs(ee,{onClick:y,className:"w-full",disabled:i||!o.trim(),children:[i?"Creating...":"Create Brokerage",r.jsx(dl,{className:"w-4 h-4 ml-2"})]})]})]})})},dke=()=>{const t=rs(),[e,n]=I.useState("verifying"),[s,a]=I.useState("");I.useEffect(()=>{(async()=>{try{const{data:{session:i},error:h}=await J.auth.getSession();if(h)throw h;if(i!=null&&i.user){const{data:p}=await J.from("profiles").select("login_count").eq("id",i.user.id).single();if(((p==null?void 0:p.login_count)||0)>1){console.log("Account already claimed, redirecting to dashboard"),n("already_claimed");return}console.log("User logged in successfully:",i.user.email),n("success");try{await J.functions.invoke("trial-claim-hook",{body:{userId:i.user.id}})}catch(x){console.log("Trial claim hook (non-critical):",x)}setTimeout(()=>{t("/profile?setup=true")},1500)}else setTimeout(()=>{n("already_claimed")},2e3)}catch(i){console.error("Claim error:",i),n("already_claimed")}})()},[t]);const o=()=>{window.location.href="https://dashboard.relevelup.com/auth"};return r.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background p-4",children:r.jsxs(Ye,{className:"w-full max-w-md",children:[r.jsxs(Gt,{className:"space-y-1 text-center",children:[r.jsxs("div",{className:"mx-auto mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-primary/10",children:[e==="verifying"&&r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"}),e==="success"&&r.jsx("svg",{className:"h-8 w-8 text-primary",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})}),e==="already_claimed"&&r.jsx("svg",{className:"h-8 w-8 text-primary",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"})}),e==="error"&&r.jsx("svg",{className:"h-8 w-8 text-destructive",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]}),r.jsxs(Zt,{className:"text-2xl",children:[e==="verifying"&&"Claiming Your Account...",e==="success"&&"Account Claimed!",e==="already_claimed"&&"Account Already Claimed",e==="error"&&"Claim Failed"]}),r.jsxs(Mn,{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(tt,{children:r.jsx(ee,{onClick:o,className:"w-full",children:"Go to Login"})})]})})},uht=()=>{const t=rs(),[e]=$d(),[n,s]=I.useState(e.get("code")||""),[a,o]=I.useState(""),[l,i]=I.useState(""),[h,p]=I.useState(""),[x,y]=I.useState(!1),[b,j]=I.useState(!1),[C,N]=I.useState(!1),[A,E]=I.useState(!1),[T,L]=I.useState(null),[z,F]=I.useState(null),[q,H]=I.useState(null),[Z,G]=I.useState(null);I.useEffect(()=>{const ye=e.get("code");ye&&(s(ye),te(ye))},[e]);const te=async ye=>{N(!0);const{data:ne,error:ge}=await J.from("invite_codes").select("id, code, max_uses, uses_count, expires_at, is_active, brokerage_id, trial_days").eq("code",ye.toUpperCase().trim()).single();if(ge||!ne){ze.error("Invalid invite code"),N(!1);return}if(!ne.is_active){ze.error("This invite code is no longer active"),N(!1);return}if(ne.max_uses&&ne.uses_count>=ne.max_uses){ze.error("This invite code has reached its maximum uses"),N(!1);return}if(ne.expires_at&&new Date(ne.expires_at){ye.preventDefault(),te(n)},le=async ye=>{var ne;if(ye.preventDefault(),!h.trim()){ze.error("Please enter your name");return}if(l.length<6){ze.error("Password must be at least 6 characters");return}j(!0);try{const ge=`${window.location.origin}/`,{data:ae,error:he}=await J.auth.signUp({email:a.trim(),password:l,options:{emailRedirectTo:ge,data:{name:h.trim()}}});if(he){he.message.includes("already registered")?ze.error("This email is already registered. Please sign in instead."):ze.error(he.message);return}ae.user&&(await J.rpc("add_default_signup_tag",{user_id:ae.user.id}),z?await J.functions.invoke("assign-brokerage",{body:{userId:ae.user.id,brokerageId:z}}):Z?await J.functions.invoke("assign-brokerage",{body:{userId:ae.user.id,trialDays:Z}}):await J.functions.invoke("assign-brokerage",{body:{userId:ae.user.id,grandfathered:!0}}),T&&await J.from("invite_codes").update({uses_count:((ne=(await J.from("invite_codes").select("uses_count").eq("id",T).single()).data)==null?void 0:ne.uses_count)+1}).eq("id",T),ze.success("Account created! You can now access the dashboard."),t("/dashboard"))}catch(ge){console.error("Signup error:",ge),ze.error("An unexpected error occurred")}finally{j(!1)}};return r.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background p-4",children:r.jsxs(Ye,{className:"w-full max-w-md",children:[r.jsxs(Gt,{className:"text-center",children:[r.jsx(Zt,{className:"text-2xl font-bold text-primary",children:q?`Join ${q}`:"Join LevelUp"}),r.jsx(Mn,{children:A?q?`Create your account to join ${q}`:"Create your account to get started":"Enter your invite code to continue"})]}),r.jsx(tt,{children:A?r.jsxs("form",{onSubmit:le,className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"name",children:"Full Name"}),r.jsx(dt,{id:"name",type:"text",placeholder:"John Doe",value:h,onChange:ye=>p(ye.target.value),required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"email",children:"Email"}),r.jsx(dt,{id:"email",type:"email",placeholder:"you@example.com",value:a,onChange:ye=>o(ye.target.value),required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"password",children:"Password"}),r.jsxs("div",{className:"relative",children:[r.jsx(dt,{id:"password",type:x?"text":"password",placeholder:"••••••••",value:l,onChange:ye=>i(ye.target.value),required:!0,minLength:6}),r.jsx("button",{type:"button",className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",onClick:()=>y(!x),children:x?r.jsx(h1,{className:"h-4 w-4"}):r.jsx(Qo,{className:"h-4 w-4"})})]})]}),r.jsx(ee,{type:"submit",className:"w-full",disabled:b,children:b?r.jsxs(r.Fragment,{children:[r.jsx(en,{className:"mr-2 h-4 w-4 animate-spin"}),"Creating Account..."]}):"Create Account"})]}):r.jsxs("form",{onSubmit:ie,className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"inviteCode",children:"Invite Code"}),r.jsx(dt,{id:"inviteCode",type:"text",placeholder:"Enter your invite code",value:n,onChange:ye=>s(ye.target.value),required:!0,autoFocus:!0})]}),r.jsx(ee,{type:"submit",className:"w-full",disabled:C,children:C?r.jsxs(r.Fragment,{children:[r.jsx(en,{className:"mr-2 h-4 w-4 animate-spin"}),"Verifying..."]}):"Verify Code"})]})})]})})},hht="/assets/testimonial-avatar-1-BsCQFauB.jpg",fht="/assets/testimonial-avatar-2-B6VPVc2t.jpg",pht="/assets/testimonial-avatar-3-GuEFwYUE.jpg",mht="/assets/testimonial-avatar-4-98iKMtkB.jpg",ght="/assets/testimonial-avatar-5-ZsZfyxMX.jpg",xht=[hht,fht,pht,mht,ght],yht=c3({name:ic().trim().min(2,"Name must be at least 2 characters").max(100),email:ic().trim().email("Please enter a valid email address").max(255),phone:ic().trim().min(10,"Please enter a valid phone number").max(20).optional().or(Eje("")),brokerage:ic().trim().max(200).optional().or(Eje(""))}),vht=[{icon:Bf,title:"Academy Training",description:"Access a library of on-demand video training covering lead generation, marketing, technology, and more."},{icon:Fd,title:"300+ Templates",description:"Professional Canva templates for social media, flyers, postcards, and marketing materials."},{icon:zs,title:"Live Events",description:"Weekly live training sessions, workshops, and Q&A events with industry experts."},{icon:Fl,title:"Agent Community",description:"Connect with fellow agents, share wins, ask questions, and network in our private community."},{icon:La,title:"Resource Kits",description:"Downloadable toolkits with scripts, checklists, guides, and everything you need to close more deals."},{icon:Ki,title:"Social Swag",description:"Fresh social media content and designs updated regularly to help you stand out online."}],_ht=[{icon:Bn,title:"Contact Management",description:"Organize your sphere into relationship tiers—Top 25, Past Clients, Referral Partners, and more."},{icon:Ms,title:"Smart TouchPlans",description:"Automated action plans that tell you exactly who to contact and how, based on relationship type."},{icon:bi,title:"One-Tap Actions",description:"Call, text, or email contacts directly with pre-written scripts tailored to each relationship."},{icon:Qh,title:"Birthday Alerts",description:"Never miss an important date—get reminders for birthdays and home anniversaries."},{icon:fl,title:"Pop-by Map",description:"See all your contacts on a map and plan efficient pop-by routes in your area."},{icon:cc,title:"Momentum Tracking",description:"Track your touch streaks, weekly goals, and relationship health scores."},{icon:ci,title:"Relationship Health",description:"Visual dashboard showing which contacts need attention based on last touch date."},{icon:kg,title:"Daily Action Cards",description:"Wake up to a prioritized list of exactly who to reach out to today."}],bht=[{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."}],wht=()=>{const t=rs(),[e,n]=I.useState(!1),[s,a]=I.useState({name:"",email:"",phone:"",brokerage:""}),[o,l]=I.useState({}),i=async h=>{var x,y;h.preventDefault(),l({});const p=yht.safeParse(s);if(!p.success){const b={};p.error.errors.forEach(j=>{j.path[0]&&(b[j.path[0]]=j.message)}),l(b);return}n(!0);try{const{data:b,error:j}=await J.functions.invoke("create-trial-signup",{body:{name:s.name.trim(),email:s.email.trim().toLowerCase(),phone:((x=s.phone)==null?void 0:x.trim())||void 0,brokerage:((y=s.brokerage)==null?void 0:y.trim())||void 0}});if(j){console.error("Trial signup error:",j),ze.error(j.message||"Something went wrong. Please try again.");return}if(b!=null&&b.error){ze.error(b.error);return}ze.success("🎉 Welcome aboard! Check your email to claim your account."),t("/trial/success")}catch(b){console.error("Trial signup error:",b),ze.error("Something went wrong. Please try again.")}finally{n(!1)}};return r.jsxs(r.Fragment,{children:[r.jsxs(km,{children:[r.jsx("title",{children:"Start Your Free 7-Day Trial | LevelUp Dashboard"}),r.jsx("meta",{name:"description",content:"Take LevelUp for a free 7-day test drive. No credit card required. The all-in-one platform for real estate agents and brokerages."}),r.jsx("meta",{property:"og:title",content:"Start Your Free 7-Day Trial | LevelUp"}),r.jsx("meta",{property:"og:description",content:"Take LevelUp for a free 7-day test drive. No credit card required."}),r.jsx("meta",{property:"og:type",content:"website"})]}),r.jsxs("div",{className:"min-h-screen bg-background overflow-hidden",children:[r.jsx("nav",{className:"fixed top-0 left-0 right-0 z-50 bg-[#4a6b6d] shadow-md",children:r.jsxs("div",{className:"container mx-auto px-4 py-3 flex items-center justify-between",children:[r.jsx("div",{className:"flex items-center",children:r.jsx("img",{src:tte,alt:"LevelUp",className:"h-8 md:h-10"})}),r.jsxs("div",{className:"flex items-center gap-2 md:gap-4",children:[r.jsx(ee,{variant:"ghost",className:"text-white/90 hover:text-white hover:bg-white/10 hidden sm:inline-flex",onClick:()=>{var h;return(h=document.getElementById("features"))==null?void 0:h.scrollIntoView({behavior:"smooth"})},children:"Features"}),r.jsx(ee,{onClick:()=>t("/auth"),className:"bg-white text-[#4a6b6d] hover:bg-gray-100 font-medium shadow-md",children:"Sign In"})]})]})}),r.jsxs("section",{className:"relative pt-24 pb-20 bg-gradient-to-br from-[#1e3a4c] via-[#2a4f5f] to-[#3d6b6b] overflow-hidden",children:[r.jsx("div",{className:"absolute inset-0 opacity-10",children:r.jsx("div",{className:"absolute inset-0 bg-[url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNjAiIGhlaWdodD0iNjAiIHZpZXdCb3g9IjAgMCA2MCA2MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxnIGZpbGw9IiNmZmZmZmYiIGZpbGwtb3BhY2l0eT0iMC40Ij48cGF0aCBkPSJNMzYgMzRoLTJ2LTRoMnY0em0wLTZ2LTRoLTJ2NGgyem0tNiA2aC0ydi00aDJ2NHptMC02di00aC0ydjRoMnoiLz48L2c+PC9nPjwvc3ZnPg==')]"})}),r.jsx("div",{className:"container mx-auto px-4 relative",children:r.jsxs("div",{className:"grid lg:grid-cols-2 gap-12 items-center",children:[r.jsxs("div",{className:"space-y-8 text-center lg:text-left",children:[r.jsx("div",{className:"flex justify-center lg:justify-start",children:r.jsx("img",{alt:"LevelUp Consulting Group",className:"h-24 md:h-32 drop-shadow-lg",src:"/lovable-uploads/3a0c7ef9-9e79-411f-a9af-6f2a99e8bd7b.webp"})}),r.jsxs("div",{className:"inline-flex items-center gap-2 px-4 py-2 rounded-full bg-white/10 text-white text-sm font-medium",children:[r.jsx(Ms,{className:"h-4 w-4 text-yellow-400"}),r.jsx("span",{children:"7-Day Free Trial • No Credit Card Required"})]}),r.jsxs("h1",{className:"text-3xl md:text-4xl lg:text-5xl font-bold text-white leading-tight font-sans",children:["Take LevelUp for a"," ",r.jsx("span",{className:"italic",children:"Free Test Drive"})]}),r.jsxs("p",{className:"text-lg md:text-xl text-white/80 max-w-xl mx-auto lg:mx-0 font-sans",children:["The tools you need to get it done.",r.jsx("br",{}),r.jsx("em",{children:"The platform you need to keep it going."})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 justify-center lg:justify-start",children:[r.jsxs("div",{className:"flex items-center gap-2 text-white/80",children:[r.jsx(Xi,{className:"h-5 w-5 text-green-400"}),r.jsx("span",{children:"No credit card required"})]}),r.jsxs("div",{className:"flex items-center gap-2 text-white/80",children:[r.jsx(Xi,{className:"h-5 w-5 text-green-400"}),r.jsx("span",{children:"Full access to all features"})]})]}),r.jsxs("div",{className:"flex items-center gap-4 justify-center lg:justify-start pt-4",children:[r.jsx("div",{className:"flex -space-x-3",children:xht.map((h,p)=>r.jsx("img",{src:h,alt:`Agent ${p+1}`,className:"w-10 h-10 rounded-full border-2 border-white/20 object-cover"},p))}),r.jsxs("div",{children:[r.jsx("div",{className:"flex gap-0.5",children:[1,2,3,4,5].map(h=>r.jsx(vs,{className:"h-4 w-4 fill-yellow-400 text-yellow-400"},h))}),r.jsx("p",{className:"text-sm text-white/60",children:"Trusted by 3,000+ agents"})]})]})]}),r.jsx("div",{className:"lg:pl-8",children:r.jsx(Ye,{className:"bg-white shadow-2xl border-0",children:r.jsxs(tt,{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(yg,{className:"h-8 w-8 text-white"})}),r.jsx("h2",{className:"text-2xl font-bold text-foreground font-sans",children:"Start Your Free Trial"}),r.jsx("p",{className:"text-muted-foreground mt-2",children:"Get instant access • No credit card needed"})]}),r.jsxs("form",{onSubmit:i,className:"space-y-5",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"name",children:"Full Name *"}),r.jsx(dt,{id:"name",type:"text",placeholder:"John Smith",value:s.name,onChange:h=>a({...s,name:h.target.value}),required:!0}),o.name&&r.jsx("p",{className:"text-sm text-destructive",children:o.name})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"email",children:"Email Address *"}),r.jsx(dt,{id:"email",type:"email",placeholder:"john@example.com",value:s.email,onChange:h=>a({...s,email:h.target.value}),required:!0}),o.email&&r.jsx("p",{className:"text-sm text-destructive",children:o.email})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"phone",children:"Phone Number"}),r.jsx(dt,{id:"phone",type:"tel",placeholder:"(555) 123-4567",value:s.phone,onChange:h=>a({...s,phone:h.target.value})}),o.phone&&r.jsx("p",{className:"text-sm text-destructive",children:o.phone})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"brokerage",children:"Brokerage Name"}),r.jsx(dt,{id:"brokerage",type:"text",placeholder:"Your brokerage or team name",value:s.brokerage,onChange:h=>a({...s,brokerage:h.target.value})}),o.brokerage&&r.jsx("p",{className:"text-sm text-destructive",children:o.brokerage})]}),r.jsx(ee,{type:"submit",className:"w-full h-12 text-lg font-semibold bg-[#4a6b6d] hover:bg-[#3d5a5c]",disabled:e,children:e?r.jsxs(r.Fragment,{children:[r.jsx(en,{className:"mr-2 h-5 w-5 animate-spin"}),"Creating Your Account..."]}):r.jsxs(r.Fragment,{children:["Start My Free Trial",r.jsx(dl,{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:vht.map((h,p)=>r.jsxs(Ye,{className:"group relative overflow-hidden border hover:border-[#4a6b6d]/50 transition-all duration-300 hover:shadow-lg bg-background",children:[r.jsxs(Gt,{children:[r.jsx("div",{className:"w-14 h-14 rounded-2xl bg-[#4a6b6d]/10 flex items-center justify-center mb-4",children:r.jsx(h.icon,{className:"w-7 h-7 text-[#4a6b6d]"})}),r.jsx(Zt,{className:"text-xl font-sans",children:h.title})]}),r.jsx(tt,{children:r.jsx("p",{className:"text-muted-foreground leading-relaxed",children:h.description})})]},p))})]})}),r.jsxs("section",{className:"py-20 bg-gradient-to-br from-[#4a6b6d] to-[#3d5a5c] relative overflow-hidden",children:[r.jsx("div",{className:"absolute inset-0 opacity-10",children:r.jsx("div",{className:"absolute inset-0 bg-[url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNjAiIGhlaWdodD0iNjAiIHZpZXdCb3g9IjAgMCA2MCA2MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxnIGZpbGw9IiNmZmZmZmYiIGZpbGwtb3BhY2l0eT0iMC40Ij48cGF0aCBkPSJNMzYgMzRoLTJ2LTRoMnY0em0wLTZ2LTRoLTJ2NGgyem0tNiA2aC0ydi00aDJ2NHptMC02di00aC0ydjRoMnoiLz48L2c+PC9nPjwvc3ZnPg==')]"})}),r.jsxs("div",{className:"container mx-auto px-4 relative",children:[r.jsxs("div",{className:"text-center max-w-3xl mx-auto mb-16",children:[r.jsxs("div",{className:"inline-flex items-center gap-2 px-4 py-2 rounded-full bg-white/10 text-white text-sm font-medium mb-6",children:[r.jsx(Ms,{className:"w-4 h-4"}),"Included with Your Trial"]}),r.jsxs("h2",{className:"text-3xl mb-6 text-white font-sans font-bold md:text-6xl",children:["Meet ",r.jsx("span",{className:"italic",children:"Agent OS"})]}),r.jsx("p",{className:"text-lg text-white/80",children:"Your relationship-first operating system. Never forget a follow-up, track every touchpoint, and turn your sphere into a referral machine."})]}),r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6 max-w-6xl mx-auto",children:_ht.map((h,p)=>r.jsxs(Ye,{className:"group relative overflow-hidden border-0 bg-white/10 backdrop-blur-sm hover:bg-white/20 transition-all duration-300",children:[r.jsxs(Gt,{className:"pb-3",children:[r.jsx("div",{className:"w-12 h-12 rounded-xl bg-white/20 flex items-center justify-center mb-3",children:r.jsx(h.icon,{className:"w-6 h-6 text-white"})}),r.jsx(Zt,{className:"text-lg font-semibold text-white",children:h.title})]}),r.jsx(tt,{children:r.jsx("p",{className:"text-white/70 text-sm leading-relaxed",children:h.description})})]},p))})]})]}),r.jsx("section",{className:"py-20 bg-background",children:r.jsxs("div",{className:"container mx-auto px-4",children:[r.jsxs("div",{className:"text-center mb-16",children:[r.jsx("h2",{className:"text-3xl md:text-4xl font-bold mb-4 font-sans",children:"Loved by Top Producers"}),r.jsx("p",{className:"text-lg text-muted-foreground",children:"See what agents are saying about LevelUp"})]}),r.jsx("div",{className:"grid md:grid-cols-3 gap-8 max-w-5xl mx-auto",children:bht.map((h,p)=>r.jsx(Ye,{className:"border hover:shadow-lg transition-shadow",children:r.jsxs(tt,{className:"p-6",children:[r.jsx("div",{className:"flex gap-1 mb-4",children:[1,2,3,4,5].map(x=>r.jsx(vs,{className:"h-4 w-4 fill-yellow-400 text-yellow-400"},x))}),r.jsxs("p",{className:"text-muted-foreground mb-4 italic",children:['"',h.quote,'"']}),r.jsxs("div",{children:[r.jsx("p",{className:"font-semibold",children:h.name}),r.jsx("p",{className:"text-sm text-muted-foreground",children:h.role})]})]})},p))})]})}),r.jsx("section",{className:"py-16 bg-muted/30",children:r.jsx("div",{className:"container mx-auto px-4",children:r.jsxs("div",{className:"flex flex-wrap justify-center gap-8 md:gap-16",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"w-12 h-12 rounded-full bg-[#4a6b6d]/10 flex items-center justify-center",children:r.jsx(rf,{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(kg,{className:"h-6 w-6 text-[#4a6b6d]"})}),r.jsxs("div",{children:[r.jsx("p",{className:"font-semibold",children:"Fast Setup"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Start in 2 minutes"})]})]}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"w-12 h-12 rounded-full bg-[#4a6b6d]/10 flex items-center justify-center",children:r.jsx(Bn,{className:"h-6 w-6 text-[#4a6b6d]"})}),r.jsxs("div",{children:[r.jsx("p",{className:"font-semibold",children:"Expert Support"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Real estate pros"})]})]})]})})}),r.jsx("section",{id:"free-trial",className:"py-20 bg-background",children:r.jsx("div",{className:"container mx-auto px-4",children:r.jsxs(Ye,{className:"bg-gradient-to-br from-[#1e3a4c] via-[#2a4f5f] to-[#3d6b6b] border-0 shadow-2xl overflow-hidden relative",children:[r.jsx("div",{className:"absolute inset-0 opacity-10",children:r.jsx("div",{className:"absolute inset-0 bg-[url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNjAiIGhlaWdodD0iNjAiIHZpZXdCb3g9IjAgMCA2MCA2MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxnIGZpbGw9IiNmZmZmZmYiIGZpbGwtb3BhY2l0eT0iMC40Ij48cGF0aCBkPSJNMzYgMzRoLTJ2LTRoMnY0em0wLTZ2LTRoLTJ2NGgyem0tNiA2aC0ydi00aDJ2NHptMC02di00aC0ydjRoMnoiLz48L2c+PC9nPjwvc3ZnPg==')]"})}),r.jsxs(tt,{className:"p-12 text-center relative",children:[r.jsx("h2",{className:"text-3xl md:text-4xl font-bold text-white mb-4 font-sans",children:"Ready to Level Up Your Business?"}),r.jsx("p",{className:"text-xl text-white/80 mb-8 max-w-2xl mx-auto",children:"Join thousands of successful agents. Start your free 7-day trial today."}),r.jsxs(ee,{onClick:()=>window.scrollTo({top:0,behavior:"smooth"}),size:"lg",className:"h-14 px-8 text-lg font-semibold bg-white text-[#1e3a4c] hover:bg-white/90 shadow-2xl transition-all hover:scale-105 rounded-full",children:["Start Your Free Trial Now",r.jsx(dl,{className:"ml-2 h-5 w-5"})]})]})]})})}),r.jsx("footer",{className:"bg-[#1e3a4c] py-12",children:r.jsx("div",{className:"container mx-auto px-4",children:r.jsxs("div",{className:"flex flex-col md:flex-row justify-between items-center gap-6",children:[r.jsx("img",{src:Pge,alt:"LevelUp",className:"h-8"}),r.jsxs("div",{className:"flex gap-6 text-sm text-white/60",children:[r.jsx("a",{href:"/privacy-policy",className:"hover:text-white transition-colors",children:"Privacy Policy"}),r.jsx("a",{href:"/terms-of-service",className:"hover:text-white transition-colors",children:"Terms of Service"})]}),r.jsx("p",{className:"text-sm text-white/40",children:"© 2025 LevelUp Consulting Group. All rights reserved."})]})})})]})]})},jht=()=>{const t=rs();return r.jsxs(r.Fragment,{children:[r.jsx(km,{children:r.jsx("title",{children:"Welcome to LevelUp! | Check Your Email"})}),r.jsxs("div",{className:"min-h-screen bg-background flex flex-col",children:[r.jsx("nav",{className:"fixed top-0 left-0 right-0 z-50 bg-[#4a6b6d] shadow-md",children:r.jsxs("div",{className:"container mx-auto px-4 py-3 flex items-center justify-between",children:[r.jsx("div",{className:"flex items-center",children:r.jsx("img",{src:tte,alt:"LevelUp",className:"h-8 md:h-10"})}),r.jsx(ee,{onClick:()=>t("/auth"),className:"bg-white text-[#4a6b6d] hover:bg-gray-100 font-medium shadow-md",children:"Sign In"})]})}),r.jsxs("section",{className:"relative pt-24 pb-12 bg-gradient-to-br from-[#1e3a4c] via-[#2a4f5f] to-[#3d6b6b] overflow-hidden flex-1 flex items-center",children:[r.jsx("div",{className:"absolute inset-0 opacity-10",children:r.jsx("div",{className:"absolute inset-0 bg-[url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNjAiIGhlaWdodD0iNjAiIHZpZXdCb3g9IjAgMCA2MCA2MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxnIGZpbGw9IiNmZmZmZmYiIGZpbGwtb3BhY2l0eT0iMC40Ij48cGF0aCBkPSJNMzYgMzRoLTJ2LTRoMnY0em0wLTZ2LTRoLTJ2NGgyem0tNiA2aC0ydi00aDJ2NHptMC02di00aC0ydjRoMnoiLz48L2c+PC9nPjwvc3ZnPg==')]"})}),r.jsx("div",{className:"container mx-auto px-4 relative",children:r.jsx("div",{className:"flex justify-center",children:r.jsx(Ye,{className:"max-w-lg w-full bg-white shadow-2xl border-0",children:r.jsxs(tt,{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(Ac,{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(da,{className:"h-6 w-6 text-[#4a6b6d]"})}),r.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"Check Your Inbox"})]}),r.jsx("p",{className:"text-muted-foreground",children:"We just sent you a magic link to claim your account and set up your password. Click the link in your email to get started!"})]}),r.jsxs("div",{className:"text-left space-y-3 mb-8",children:[r.jsx("p",{className:"text-sm text-muted-foreground font-medium uppercase tracking-wide",children:"What happens next:"}),r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("div",{className:"w-6 h-6 rounded-full bg-[#4a6b6d] flex items-center justify-center flex-shrink-0 mt-0.5",children:r.jsx("span",{className:"text-xs font-bold text-white",children:"1"})}),r.jsx("p",{className:"text-foreground",children:"Check your email for the welcome message"})]}),r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("div",{className:"w-6 h-6 rounded-full bg-[#4a6b6d] flex items-center justify-center flex-shrink-0 mt-0.5",children:r.jsx("span",{className:"text-xs font-bold text-white",children:"2"})}),r.jsx("p",{className:"text-foreground",children:'Click "Claim Your Account" to set your password'})]}),r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("div",{className:"w-6 h-6 rounded-full bg-[#4a6b6d] flex items-center justify-center flex-shrink-0 mt-0.5",children:r.jsx("span",{className:"text-xs font-bold text-white",children:"3"})}),r.jsx("p",{className:"text-foreground",children:"Start exploring all the features!"})]})]}),r.jsxs("p",{className:"text-sm text-muted-foreground mb-6",children:["Didn't receive the email? Check your spam folder or"," ",r.jsx("button",{onClick:()=>t("/trial"),className:"text-[#4a6b6d] hover:underline font-medium",children:"try again"})]}),r.jsxs(ee,{onClick:()=>t("/auth"),className:"bg-[#4a6b6d] hover:bg-[#3d5a5c]",children:["Go to Sign In",r.jsx(dl,{className:"ml-2 h-4 w-4"})]})]})})})})]}),r.jsx("footer",{className:"bg-[#1e3a4c] py-8",children:r.jsx("div",{className:"container mx-auto px-4",children:r.jsxs("div",{className:"flex flex-col md:flex-row justify-between items-center gap-4",children:[r.jsx("img",{src:Pge,alt:"LevelUp",className:"h-8"}),r.jsxs("p",{className:"text-sm text-white/40",children:["© ",new Date().getFullYear()," LevelUp Consulting Group. All rights reserved."]})]})})})]})]})},kht=c3({viewerName:ic().min(1,"Name is required").max(100,"Name must be less than 100 characters"),viewerEmail:ic().email("Please enter a valid email").max(255,"Email must be less than 255 characters"),viewerPhone:ic().max(20,"Phone must be less than 20 characters").optional(),message:ic().min(1,"Message is required").max(1e3,"Message must be less than 1000 characters")});function Nht({shareToken:t,agentName:e,hasContact:n}){const[s,a]=I.useState(!1),[o,l]=I.useState(!1),[i,h]=I.useState(null),p=ose({resolver:lse(kht),defaultValues:{viewerName:"",viewerEmail:"",viewerPhone:"",message:""}}),x=async y=>{a(!0),h(null);try{const{data:b,error:j}=await J.functions.invoke("video-reply-notify",{body:{shareToken:t,viewerName:y.viewerName,viewerEmail:y.viewerEmail,viewerPhone:y.viewerPhone||void 0,message:y.message}});if(j)throw new Error(j.message);if(!(b!=null&&b.success))throw new Error((b==null?void 0:b.error)||"Failed to send reply");l(!0)}catch(b){console.error("Failed to submit reply:",b),h(b.message||"Something went wrong. Please try again.")}finally{a(!1)}};return o?r.jsx(Ye,{className:"border-2 border-primary/20 bg-gradient-to-br from-primary/5 to-primary/10",children:r.jsxs(tt,{className:"py-8 text-center",children:[r.jsx("div",{className:"inline-flex items-center justify-center w-16 h-16 rounded-full bg-primary/20 mb-4",children:r.jsx(Xi,{className:"h-8 w-8 text-primary"})}),r.jsx("h3",{className:"text-xl font-semibold mb-2",children:"Message Sent!"}),r.jsxs("p",{className:"text-muted-foreground",children:[e?`${e} will`:"They'll"," get back to you soon."]})]})}):r.jsxs(Ye,{children:[r.jsxs(Gt,{className:"pb-4",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[r.jsx(Fl,{className:"h-5 w-5 text-primary"}),r.jsx(Zt,{className:"text-lg",children:"Reply to this video"})]}),r.jsx(Mn,{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(tt,{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(Tl,{control:p.control,name:"viewerName",render:({field:y})=>r.jsxs(bl,{children:[r.jsx(wl,{children:"Your Name *"}),r.jsx(jl,{children:r.jsx(dt,{placeholder:"John Smith",...y})}),r.jsx(Eu,{})]})}),r.jsx(Tl,{control:p.control,name:"viewerEmail",render:({field:y})=>r.jsxs(bl,{children:[r.jsx(wl,{children:"Email *"}),r.jsx(jl,{children:r.jsx(dt,{type:"email",placeholder:"john@example.com",...y})}),r.jsx(Eu,{})]})})]}),!n&&r.jsx(Tl,{control:p.control,name:"viewerPhone",render:({field:y})=>r.jsxs(bl,{children:[r.jsx(wl,{children:"Phone (optional)"}),r.jsx(jl,{children:r.jsx(dt,{type:"tel",placeholder:"(555) 123-4567",...y})}),r.jsx(Eu,{})]})}),r.jsx(Tl,{control:p.control,name:"message",render:({field:y})=>r.jsxs(bl,{children:[r.jsx(wl,{children:"Message *"}),r.jsx(jl,{children:r.jsx(ps,{placeholder:n?"Thanks for the video! I had a question about...":"I'm interested in learning more about...",className:"min-h-[100px] resize-none",...y})}),r.jsx(Eu,{})]})}),i&&r.jsx("p",{className:"text-sm text-destructive",children:i}),r.jsx(ee,{type:"submit",className:"w-full gap-2",disabled:s,children:s?r.jsxs(r.Fragment,{children:[r.jsx(en,{className:"h-4 w-4 animate-spin"}),"Sending..."]}):r.jsxs(r.Fragment,{children:[r.jsx(Oo,{className:"h-4 w-4"}),"Send Message"]})})]})})})]})}const Sht=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsxs("div",{className:"absolute inset-0 opacity-[0.08]",children:[r.jsx("div",{className:"absolute top-0 left-0 right-0 h-[8%] bg-red-600"}),r.jsx("div",{className:"absolute top-[16%] left-0 right-0 h-[8%] bg-red-600"}),r.jsx("div",{className:"absolute top-[32%] left-0 right-0 h-[8%] bg-red-600"}),r.jsx("div",{className:"absolute top-[48%] left-0 right-0 h-[8%] bg-red-600"}),r.jsx("div",{className:"absolute top-[64%] left-0 right-0 h-[8%] bg-red-600"}),r.jsx("div",{className:"absolute top-[80%] left-0 right-0 h-[8%] bg-red-600"})]}),r.jsx("div",{className:"absolute top-0 left-0 w-[35%] h-[45%] bg-blue-900/10 rounded-br-3xl"}),r.jsx(vs,{className:"absolute top-[5%] left-[8%] w-6 h-6 text-blue-600/30 fill-blue-600/20"}),r.jsx(vs,{className:"absolute top-[15%] left-[20%] w-4 h-4 text-blue-600/25 fill-blue-600/15"}),r.jsx(vs,{className:"absolute top-[8%] left-[28%] w-5 h-5 text-blue-600/30 fill-blue-600/20"}),r.jsx(vs,{className:"absolute top-[25%] left-[12%] w-4 h-4 text-blue-600/20 fill-blue-600/10"}),r.jsx(vs,{className:"absolute top-[20%] right-[15%] w-5 h-5 text-red-500/25 fill-red-500/15 animate-pulse"}),r.jsx(Bx,{className:"absolute bottom-[20%] right-[10%] w-12 h-12 text-blue-600/15 rotate-12"})]}),Cht=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-red-500/5 via-transparent to-blue-500/5"}),r.jsxs("div",{className:"absolute top-[10%] left-[15%] w-32 h-32",children:[r.jsx("div",{className:"absolute inset-0 rounded-full border-2 border-red-400/20 animate-ping",style:{animationDuration:"3s"}}),r.jsx(Ms,{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-8 h-8 text-red-400/40"})]}),r.jsxs("div",{className:"absolute top-[5%] right-[20%] w-24 h-24",children:[r.jsx("div",{className:"absolute inset-0 rounded-full border-2 border-blue-400/20 animate-ping",style:{animationDuration:"4s",animationDelay:"1s"}}),r.jsx(vs,{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-6 h-6 text-blue-400/40 fill-blue-400/20"})]}),r.jsxs("div",{className:"absolute top-[20%] left-[50%] w-20 h-20",children:[r.jsx("div",{className:"absolute inset-0 rounded-full border border-white/10 animate-ping",style:{animationDuration:"3.5s",animationDelay:"0.5s"}}),r.jsx(Ms,{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-5 h-5 text-amber-400/40"})]}),r.jsx(vs,{className:"absolute bottom-[25%] left-[10%] w-6 h-6 text-blue-500/25 fill-blue-500/15 animate-pulse"}),r.jsx(vs,{className:"absolute bottom-[15%] right-[15%] w-5 h-5 text-red-500/25 fill-red-500/15 animate-pulse",style:{animationDelay:"0.5s"}}),r.jsx(Bx,{className:"absolute top-[8%] left-[5%] w-10 h-10 text-red-500/20 rotate-12"})]}),Mht=()=>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(am,{className:"w-20 h-20 text-pink-400 rotate-12"})}),r.jsx("div",{className:"absolute top-[2%] right-[8%] opacity-15",children:r.jsx(am,{className:"w-16 h-16 text-rose-400 -rotate-12"})}),r.jsx("div",{className:"absolute bottom-[15%] left-[8%] opacity-15",children:r.jsx(am,{className:"w-14 h-14 text-purple-400 rotate-45"})}),r.jsx("div",{className:"absolute bottom-[20%] right-[5%] opacity-20",children:r.jsx(am,{className:"w-16 h-16 text-pink-300 -rotate-6"})}),r.jsx(ci,{className:"absolute top-[15%] left-[30%] w-5 h-5 text-rose-300/40 fill-rose-300/20 animate-pulse"}),r.jsx(ci,{className:"absolute top-[25%] right-[25%] w-4 h-4 text-pink-300/40 fill-pink-300/20 animate-pulse",style:{animationDelay:"0.3s"}}),r.jsx(ci,{className:"absolute top-[10%] left-[60%] w-4 h-4 text-rose-400/30 fill-rose-400/15 animate-pulse",style:{animationDelay:"0.6s"}}),r.jsx("div",{className:"absolute top-[8%] left-[45%] w-8 h-8 rounded-full bg-pink-300/10 blur-sm"}),r.jsx("div",{className:"absolute bottom-[25%] right-[30%] w-6 h-6 rounded-full bg-rose-300/10 blur-sm"})]}),Tht=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-blue-900/5 via-slate-800/3 to-indigo-900/5"}),r.jsx("div",{className:"absolute top-[5%] right-[10%] opacity-15",children:r.jsxs("div",{className:"w-12 h-24 relative",children:[r.jsx("div",{className:"absolute top-0 left-1/2 -translate-x-1/2 w-10 h-3 bg-blue-600 rounded-full"}),r.jsx("div",{className:"absolute top-2 left-1/2 -translate-x-1/2 w-0 h-0 border-l-[20px] border-r-[20px] border-t-[60px] border-l-transparent border-r-transparent border-t-blue-500"})]})}),r.jsx(Ol,{className:"absolute top-[8%] left-[12%] w-12 h-12 text-blue-600/15"}),r.jsx(vs,{className:"absolute top-[15%] left-[22%] w-5 h-5 text-amber-500/25 fill-amber-500/15"}),r.jsx(Ol,{className:"absolute bottom-[20%] right-[8%] w-14 h-14 text-indigo-500/12"}),r.jsx("div",{className:"absolute top-[3%] left-[40%] opacity-12",children:r.jsxs("div",{className:"flex gap-1",children:[r.jsx("div",{className:"w-10 h-5 bg-slate-700 rounded-full rounded-tr-none rotate-6"}),r.jsx("div",{className:"w-10 h-5 bg-slate-700 rounded-full rounded-tl-none -rotate-6"})]})}),r.jsx(vs,{className:"absolute bottom-[25%] left-[15%] w-6 h-6 text-blue-500/20 fill-blue-500/10 animate-pulse"}),r.jsx(vs,{className:"absolute top-[20%] right-[22%] w-5 h-5 text-indigo-400/20 fill-indigo-400/10 animate-pulse",style:{animationDelay:"0.5s"}})]}),Aht=()=>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(am,{className:"absolute top-[20%] left-[32%] w-7 h-7 text-purple-400/30"}),r.jsx(am,{className:"absolute top-[12%] right-[28%] w-6 h-6 text-pink-400/30"}),r.jsx(tS,{className:"absolute top-[18%] left-[52%] w-5 h-5 text-sky-400/35"})]}),Eht=()=>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(pj,{className:"absolute top-[5%] left-[10%] w-16 h-16 text-orange-400/25"}),r.jsx(pj,{className:"absolute top-[10%] right-[12%] w-12 h-12 text-purple-400/20 animate-pulse"}),r.jsxs("div",{className:"absolute bottom-[18%] left-[8%]",children:[r.jsx("div",{className:"w-14 h-12 rounded-full bg-orange-500/20"}),r.jsx("div",{className:"absolute -top-2 left-1/2 -translate-x-1/2 w-2 h-4 bg-green-600/25 rounded-t-full"})]}),r.jsxs("div",{className:"absolute bottom-[22%] right-[12%]",children:[r.jsx("div",{className:"w-12 h-10 rounded-full bg-orange-400/15"}),r.jsx("div",{className:"absolute -top-1.5 left-1/2 -translate-x-1/2 w-1.5 h-3 bg-green-600/20 rounded-t-full"})]}),r.jsx("div",{className:"absolute top-[15%] left-[40%] opacity-20",children:r.jsx("svg",{viewBox:"0 0 24 12",className:"w-10 h-5 text-slate-800 fill-current",children:r.jsx("path",{d:"M12 6c-2-4-6-6-12-6 4 2 6 4 6 6s-2 4-6 6c6 0 10-2 12-6zm0 0c2-4 6-6 12-6-4 2-6 4-6 6s2 4 6 6c-6 0-10-2-12-6z"})})}),r.jsx(Ms,{className:"absolute top-[8%] left-[55%] w-6 h-6 text-purple-400/35 animate-pulse"}),r.jsx(Ms,{className:"absolute bottom-[28%] right-[25%] w-5 h-5 text-orange-400/30 animate-pulse",style:{animationDelay:"0.5s"}})]}),Iht=()=>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(j1,{className:"absolute bottom-[8%] left-[5%] w-20 h-20 text-green-600/18"}),r.jsx(j1,{className:"absolute bottom-[12%] right-[8%] w-16 h-16 text-emerald-600/15"}),r.jsx(j1,{className:"absolute bottom-[10%] left-[28%] w-12 h-12 text-green-500/12"}),r.jsx(V0,{className:"absolute top-[5%] left-[15%] w-10 h-10 text-sky-300/30 animate-pulse"}),r.jsx(V0,{className:"absolute top-[10%] right-[20%] w-8 h-8 text-blue-300/25 animate-pulse",style:{animationDelay:"0.3s"}}),r.jsx(V0,{className:"absolute top-[18%] left-[45%] w-6 h-6 text-sky-200/25 animate-pulse",style:{animationDelay:"0.6s"}}),r.jsx(V0,{className:"absolute top-[8%] left-[70%] w-8 h-8 text-blue-200/20 animate-pulse",style:{animationDelay:"0.9s"}}),r.jsx("div",{className:"absolute top-[12%] left-[10%] w-5 h-5 rounded-full bg-red-500/25"}),r.jsx("div",{className:"absolute top-[15%] right-[15%] w-4 h-4 rounded-full bg-amber-400/25"}),r.jsx("div",{className:"absolute top-[20%] left-[55%] w-4 h-4 rounded-full bg-green-500/20"}),r.jsx(vs,{className:"absolute top-[3%] left-[50%] -translate-x-1/2 w-10 h-10 text-amber-400/35 fill-amber-400/25"})]}),Pht=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-orange-900/10 via-amber-800/6 to-red-900/10"}),r.jsx("div",{className:"absolute top-[5%] left-[10%] w-10 h-8 rounded-full bg-orange-500/25 rotate-45"}),r.jsx("div",{className:"absolute top-[10%] right-[15%] w-8 h-6 rounded-full bg-red-500/20 -rotate-12"}),r.jsx("div",{className:"absolute top-[15%] left-[35%] w-7 h-5 rounded-full bg-amber-500/22 rotate-30"}),r.jsx("div",{className:"absolute bottom-[18%] left-[12%] w-10 h-7 rounded-full bg-yellow-600/18 -rotate-45"}),r.jsx("div",{className:"absolute bottom-[22%] right-[10%] w-9 h-6 rounded-full bg-orange-600/15 rotate-12"}),r.jsxs("div",{className:"absolute bottom-[12%] left-[50%] -translate-x-1/2",children:[r.jsx("div",{className:"w-16 h-14 rounded-full bg-orange-400/15"}),r.jsx("div",{className:"absolute -top-2 left-1/2 -translate-x-1/2 w-2 h-5 bg-green-600/18 rounded-t-full"})]}),r.jsx(ci,{className:"absolute top-[8%] left-[55%] w-6 h-6 text-red-400/22 fill-red-400/12"}),r.jsx(ci,{className:"absolute top-[20%] right-[25%] w-5 h-5 text-orange-400/22 fill-orange-400/12"})]}),Lht=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-yellow-900/8 via-amber-900/4 to-purple-900/8"}),r.jsx(vs,{className:"absolute top-[5%] left-[15%] w-12 h-12 text-yellow-400/35 fill-yellow-400/25 animate-pulse"}),r.jsx(vs,{className:"absolute top-[8%] right-[12%] w-10 h-10 text-amber-400/30 fill-amber-400/20 animate-pulse",style:{animationDelay:"0.3s"}}),r.jsx(vs,{className:"absolute top-[15%] left-[40%] w-7 h-7 text-yellow-300/25 fill-yellow-300/15 animate-pulse",style:{animationDelay:"0.6s"}}),r.jsx(vs,{className:"absolute top-[12%] right-[35%] w-8 h-8 text-amber-300/28 fill-amber-300/18 animate-pulse",style:{animationDelay:"0.9s"}}),r.jsx("div",{className:"absolute top-[20%] left-[25%] w-4 h-4 rounded-full bg-pink-400/30"}),r.jsx("div",{className:"absolute top-[18%] right-[30%] w-3 h-3 rounded-full bg-sky-400/30"}),r.jsx("div",{className:"absolute top-[25%] left-[60%] w-2.5 h-2.5 rounded-full bg-emerald-400/30"}),r.jsx("div",{className:"absolute top-[22%] right-[42%] w-3 h-3 rounded-full bg-purple-400/30"}),r.jsx(Ms,{className:"absolute top-[3%] left-[50%] w-10 h-10 text-yellow-400/40"}),r.jsx(Ac,{className:"absolute bottom-[18%] left-[10%] w-12 h-12 text-purple-400/18 rotate-12"}),r.jsx(Ac,{className:"absolute bottom-[20%] right-[12%] w-10 h-10 text-amber-400/15 -rotate-12"})]}),Oht=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-blue-900/10 via-indigo-900/6 to-sky-900/10"}),r.jsxs("div",{className:"absolute bottom-[12%] left-1/2 -translate-x-1/2 flex items-end gap-3",children:[r.jsx("div",{className:"w-2 h-14 bg-blue-400/18 rounded-full"}),r.jsx("div",{className:"w-2 h-12 bg-blue-300/15 rounded-full"}),r.jsx("div",{className:"w-2 h-16 bg-blue-400/20 rounded-full"}),r.jsx("div",{className:"w-2.5 h-20 bg-blue-500/22 rounded-full"})," ",r.jsx("div",{className:"w-2 h-16 bg-blue-400/20 rounded-full"}),r.jsx("div",{className:"w-2 h-12 bg-blue-300/15 rounded-full"}),r.jsx("div",{className:"w-2 h-14 bg-blue-400/18 rounded-full"})]}),r.jsx("div",{className:"absolute bottom-[38%] left-[calc(50%-42px)] w-3 h-4 bg-yellow-400/30 rounded-full blur-sm"}),r.jsx("div",{className:"absolute bottom-[35%] left-[calc(50%-28px)] w-2.5 h-3 bg-yellow-300/25 rounded-full blur-sm"}),r.jsx("div",{className:"absolute bottom-[40%] left-[calc(50%-14px)] w-3 h-4 bg-amber-400/30 rounded-full blur-sm"}),r.jsx("div",{className:"absolute bottom-[45%] left-1/2 -translate-x-1/2 w-4 h-5 bg-yellow-400/35 rounded-full blur-sm"}),r.jsx(vs,{className:"absolute top-[8%] left-[50%] -translate-x-1/2 w-14 h-14 text-yellow-400/28 fill-yellow-400/18"}),r.jsx(Ms,{className:"absolute top-[5%] left-[20%] w-7 h-7 text-blue-400/35"}),r.jsx(Ms,{className:"absolute top-[10%] right-[18%] w-6 h-6 text-sky-400/30"})]}),Dht=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-green-900/12 via-emerald-900/6 to-teal-900/10"}),r.jsx(Px,{className:"absolute top-[5%] left-[10%] w-16 h-16 text-green-500/25"}),r.jsx(Px,{className:"absolute top-[8%] right-[12%] w-12 h-12 text-emerald-500/20"}),r.jsx(Px,{className:"absolute bottom-[18%] left-[12%] w-14 h-14 text-green-400/22"}),r.jsx(Px,{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"})]})]})]}),Rht=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-blue-900/10 via-indigo-900/6 to-sky-900/10"}),r.jsx("div",{className:"absolute top-[8%] left-[12%] w-16 h-16 rounded-full border-4 border-blue-500/18"}),r.jsx("div",{className:"absolute top-[10%] right-[10%] w-14 h-14 rounded-full border-4 border-indigo-500/15"}),r.jsx("div",{className:"absolute bottom-[18%] left-[18%] w-12 h-12 rounded-full border-3 border-sky-500/12"}),r.jsx(vs,{className:"absolute top-[5%] left-[42%] w-10 h-10 text-amber-400/30 fill-amber-400/20"}),r.jsx(vs,{className:"absolute top-[15%] right-[25%] w-7 h-7 text-yellow-400/25 fill-yellow-400/15"}),r.jsx(Ol,{className:"absolute bottom-[20%] right-[12%] w-12 h-12 text-blue-500/18"}),r.jsx(Ol,{className:"absolute top-[18%] left-[28%] w-8 h-8 text-indigo-400/15"}),r.jsx(Bx,{className:"absolute top-[8%] left-[60%] w-10 h-10 text-indigo-400/18"})]}),Fht=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-amber-900/6 via-rose-900/6 to-purple-900/6"}),r.jsx(Qh,{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(Ac,{className:"absolute top-[8%] left-[45%] w-10 h-10 text-purple-400/22 rotate-12"}),r.jsx(Ki,{className:"absolute bottom-[18%] right-[15%] w-12 h-12 text-rose-400/18"})]}),zht=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-rose-900/12 via-pink-900/8 to-red-900/12"}),r.jsx(ci,{className:"absolute top-[5%] left-[10%] w-16 h-16 text-rose-400/28 fill-rose-400/18"}),r.jsx(ci,{className:"absolute top-[8%] right-[12%] w-14 h-14 text-pink-400/25 fill-pink-400/15"}),r.jsx(ci,{className:"absolute bottom-[15%] left-[12%] w-12 h-12 text-red-400/22 fill-red-400/12"}),r.jsx(ci,{className:"absolute bottom-[18%] right-[10%] w-13 h-13 text-rose-300/25 fill-rose-300/15"}),r.jsx(ci,{className:"absolute top-[15%] left-[30%] w-6 h-6 text-pink-300/35 fill-pink-300/20 animate-pulse"}),r.jsx(ci,{className:"absolute top-[20%] right-[35%] w-5 h-5 text-rose-300/35 fill-rose-300/20 animate-pulse",style:{animationDelay:"0.3s"}}),r.jsx(ci,{className:"absolute top-[12%] left-[55%] w-5 h-5 text-red-300/30 fill-red-300/15 animate-pulse",style:{animationDelay:"0.6s"}}),r.jsx(ci,{className:"absolute top-[25%] right-[25%] w-4 h-4 text-pink-400/30 fill-pink-400/15 animate-pulse",style:{animationDelay:"0.9s"}}),r.jsx("div",{className:"absolute top-[18%] left-[45%] w-8 h-8 rounded-full bg-rose-300/18 blur-sm"}),r.jsx("div",{className:"absolute bottom-[25%] right-[40%] w-6 h-6 rounded-full bg-pink-300/15 blur-sm"})]}),Bht=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-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(w1,{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(w1,{className:"absolute top-[15%] left-[18%] w-10 h-10 text-yellow-400/30"}),r.jsx(Ms,{className:"absolute top-[10%] left-[42%] w-7 h-7 text-amber-400/35"}),r.jsx(w1,{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"})]}),$ht=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-teal-900/10 via-cyan-900/6 to-emerald-900/10"}),r.jsx(pa,{className:"absolute top-[8%] left-[10%] w-14 h-14 text-teal-500/22"}),r.jsx(pa,{className:"absolute bottom-[15%] right-[8%] w-16 h-16 text-emerald-500/18"}),r.jsx(ef,{className:"absolute top-[12%] right-[18%] w-10 h-10 text-amber-400/25"}),r.jsx(ef,{className:"absolute bottom-[22%] left-[22%] w-8 h-8 text-yellow-400/22"}),r.jsx(ci,{className:"absolute top-[18%] left-[40%] w-6 h-6 text-rose-400/22 fill-rose-400/12"}),r.jsx(ci,{className:"absolute top-[22%] right-[35%] w-5 h-5 text-teal-400/20 fill-teal-400/10"}),r.jsx(Ms,{className:"absolute top-[5%] left-[55%] w-8 h-8 text-teal-400/30"}),r.jsx(Ac,{className:"absolute bottom-[20%] left-[48%] w-10 h-10 text-cyan-400/18 rotate-12"})]}),Uht=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-emerald-900/10 via-teal-900/6 to-cyan-900/10"}),r.jsx(Ac,{className:"absolute top-[5%] left-[12%] w-14 h-14 text-emerald-400/25 rotate-12"}),r.jsx(Ac,{className:"absolute top-[8%] right-[10%] w-12 h-12 text-teal-400/22 -rotate-12"}),r.jsx(ef,{className:"absolute bottom-[18%] left-[18%] w-12 h-12 text-amber-400/25"}),r.jsx(pa,{className:"absolute bottom-[15%] right-[12%] w-14 h-14 text-teal-500/18"}),r.jsx(Ms,{className:"absolute top-[15%] left-[42%] w-10 h-10 text-emerald-400/35"}),r.jsx(Ms,{className:"absolute top-[20%] right-[32%] w-7 h-7 text-cyan-400/30"}),r.jsx("div",{className:"absolute top-[25%] left-[55%] w-3 h-3 bg-amber-400/30 rounded-full"}),r.jsx("div",{className:"absolute top-[22%] right-[42%] w-2.5 h-2.5 bg-teal-400/30 rounded-full"}),r.jsx("div",{className:"absolute top-[28%] left-[35%] w-2 h-2 bg-emerald-400/30 rounded-full"})]}),qht=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-amber-900/10 via-yellow-900/6 to-orange-900/10"}),r.jsx(ef,{className:"absolute bottom-[12%] left-[50%] -translate-x-1/2 w-24 h-24 text-amber-400/25 rotate-45"}),r.jsx(ef,{className:"absolute top-[10%] left-[12%] w-10 h-10 text-yellow-400/30"}),r.jsx(ef,{className:"absolute top-[12%] right-[15%] w-9 h-9 text-amber-300/25"}),r.jsx(pa,{className:"absolute top-[8%] left-[42%] w-12 h-12 text-teal-500/18"}),r.jsx(Ac,{className:"absolute bottom-[22%] right-[18%] w-12 h-12 text-orange-400/18 rotate-12"}),r.jsx(Ms,{className:"absolute top-[5%] right-[35%] w-8 h-8 text-yellow-400/35"}),r.jsx(vs,{className:"absolute top-[18%] left-[28%] w-6 h-6 text-amber-400/25 fill-amber-400/15"})]}),Vht=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx("div",{className:"absolute inset-0 bg-gradient-to-br from-teal-900/10 via-emerald-900/6 to-green-900/10"}),r.jsx(pa,{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(ef,{className:"absolute top-[10%] right-[12%] w-10 h-10 text-amber-400/28"}),r.jsx(ci,{className:"absolute top-[8%] left-[18%] w-8 h-8 text-rose-400/25 fill-rose-400/15"}),r.jsx(Ms,{className:"absolute top-[12%] left-[45%] w-8 h-8 text-teal-400/30"}),r.jsx(hj,{className:"absolute top-[15%] right-[28%] w-10 h-10 text-emerald-400/20"})]}),uke=()=>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"})]}),Hht=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx(ci,{className:"absolute top-6 left-[12%] w-4 h-4 text-rose-300/50 fill-rose-300/30 animate-pulse"}),r.jsx(ci,{className:"absolute top-10 right-[18%] w-3 h-3 text-pink-300/50 fill-pink-300/30 animate-pulse delay-150"}),r.jsx(ci,{className:"absolute top-4 left-[40%] w-2.5 h-2.5 text-rose-400/40 fill-rose-400/20 animate-pulse delay-300"}),r.jsx(ci,{className:"absolute top-14 right-[35%] w-3.5 h-3.5 text-pink-300/40 fill-pink-300/20 animate-pulse delay-200"})]}),Wht=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx(hj,{className:"absolute top-5 left-[10%] w-4 h-4 text-blue-400/50 animate-pulse"}),r.jsx(Ms,{className:"absolute top-10 right-[15%] w-3 h-3 text-amber-400/50 animate-pulse delay-100"}),r.jsx(pa,{className:"absolute top-8 left-[38%] w-3 h-3 text-teal-300/40 animate-pulse delay-200"})]}),Ght=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx(uj,{className:"absolute top-5 left-[12%] w-4 h-4 text-amber-500/50 animate-pulse"}),r.jsx(uS,{className:"absolute top-10 right-[15%] w-3 h-3 text-rose-400/50 animate-pulse delay-100"}),r.jsx(uj,{className:"absolute top-8 left-[40%] w-3 h-3 text-amber-400/40 animate-pulse delay-200"})]}),RM=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx(Ms,{className:"absolute top-5 left-[10%] w-4 h-4 text-emerald-400/50 animate-pulse"}),r.jsx(Ac,{className:"absolute top-10 right-[12%] w-5 h-5 text-amber-400/50 animate-pulse delay-150"}),r.jsx(Ms,{className:"absolute top-8 left-[45%] w-3 h-3 text-sky-400/40 animate-pulse delay-300"})]}),hke=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx(pa,{className:"absolute top-6 left-[12%] w-4 h-4 text-teal-400/40 animate-pulse"}),r.jsx(Ms,{className:"absolute top-10 right-[15%] w-3 h-3 text-emerald-400/50 animate-pulse delay-100"}),r.jsx(pa,{className:"absolute top-4 right-[40%] w-3 h-3 text-cyan-400/30 animate-pulse delay-200"})]}),jhe=[{id:"default",name:"Classic",description:"Clean, professional look for any occasion",icon:r.jsx(Ms,{className:"h-5 w-5"}),category:"general",headerText:()=>"Video Message",subText:"A personal video just for you",gradientClasses:"from-background to-muted/30",accentColor:"primary"},{id:"thank_you",name:"Thank You",description:"Express your gratitude",icon:r.jsx(ci,{className:"h-5 w-5"}),category:"general",headerText:t=>t?`Thank You, ${t}!`:"Thank You!",subText:"Your support means the world to me",gradientClasses:"from-rose-50/70 via-pink-50/50 to-red-50/40 dark:from-rose-950/30 dark:via-pink-950/20 dark:to-red-950/20",accentColor:"rose",decorativeElement:r.jsx(Hht,{})},{id:"thinking_of_you",name:"Thinking of You",description:"Let them know they're on your mind",icon:r.jsx(CT,{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(RM,{})},{id:"check_in",name:"Check-in",description:"Touch base with your contacts",icon:r.jsx(uj,{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(Ght,{})},{id:"market_update",name:"Market Update",description:"Share real estate market insights",icon:r.jsx(cc,{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(RM,{})},{id:"congratulations",name:"Congratulations",description:"Celebrate their achievements",icon:r.jsx(Ol,{className:"h-5 w-5"}),category:"general",headerText:t=>t?`Congratulations, ${t}!`:"Congratulations!",subText:"So proud of your accomplishment",gradientClasses:"from-amber-50/70 via-yellow-50/50 to-orange-50/40 dark:from-amber-950/30 dark:via-yellow-950/20 dark:to-orange-950/20",accentColor:"amber",decorativeElement:r.jsx(uke,{})},{id:"welcome_neighborhood",name:"Welcome to the Neighborhood",description:"Greet new neighbors",icon:r.jsx(fl,{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(uS,{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(RM,{})},{id:"birthday",name:"Birthday",description:"Celebrate their special day",icon:r.jsx(Qh,{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(Fht,{})},{id:"valentines_day",name:"Valentine's Day",description:"Show appreciation on this special day",icon:r.jsx(ci,{className:"h-5 w-5"}),category:"holidays",headerText:t=>t?`Happy Valentine's Day, ${t}!`:"Happy Valentine's Day!",subText:"A heartfelt message from your real estate professional",gradientClasses:"from-rose-50/80 via-pink-50/60 to-red-50/40 dark:from-rose-950/30 dark:via-pink-950/20 dark:to-red-950/20",accentColor:"rose",decorativeElement:r.jsx(zht,{})},{id:"groundhog_day",name:"Groundhog Day",description:"A fun seasonal greeting",icon:r.jsx(w1,{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(Bht,{})},{id:"new_years",name:"New Year's Day",description:"Ring in the new year",icon:r.jsx(vs,{className:"h-5 w-5"}),category:"holidays",headerText:t=>t?`Happy New Year, ${t}!`:"Happy New Year!",subText:"Wishing you a year full of success and happiness",gradientClasses:"from-yellow-50/70 via-amber-50/50 to-orange-50/40 dark:from-yellow-950/30 dark:via-amber-950/20 dark:to-orange-950/20",accentColor:"yellow",decorativeElement:r.jsx(Lht,{})},{id:"easter",name:"Easter",description:"Celebrate the spring season",icon:r.jsx(tS,{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(Aht,{})},{id:"mothers_day",name:"Mother's Day",description:"Celebrate the amazing moms",icon:r.jsx(am,{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(Mht,{})},{id:"fathers_day",name:"Father's Day",description:"Celebrate the amazing dads",icon:r.jsx(Ol,{className:"h-5 w-5"}),category:"holidays",headerText:t=>t?`Happy Father's Day, ${t}!`:"Happy Father's Day!",subText:"Celebrating the wonderful fathers in our lives",gradientClasses:"from-blue-50/70 via-sky-50/50 to-indigo-50/40 dark:from-blue-950/30 dark:via-sky-950/20 dark:to-indigo-950/20",accentColor:"blue",decorativeElement:r.jsx(Tht,{})},{id:"memorial_day",name:"Memorial Day",description:"Honor those who served",icon:r.jsx(Bx,{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(Sht,{})},{id:"independence_day",name:"4th of July",description:"Celebrate Independence Day",icon:r.jsx(Jh,{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(Cht,{})},{id:"labor_day",name:"Labor Day",description:"Celebrate the workers",icon:r.jsx(Ol,{className:"h-5 w-5"}),category:"holidays",headerText:t=>t?`Happy Labor Day, ${t}!`:"Happy Labor Day!",subText:"Celebrating the hard work that builds our communities",gradientClasses:"from-blue-50/70 via-indigo-50/50 to-sky-50/40 dark:from-blue-950/30 dark:via-indigo-950/20 dark:to-sky-950/20",accentColor:"blue",decorativeElement:r.jsx(Rht,{})},{id:"halloween",name:"Halloween",description:"Spooky seasonal greetings",icon:r.jsx(pj,{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(Eht,{})},{id:"thanksgiving",name:"Thanksgiving",description:"Express gratitude this season",icon:r.jsx(ci,{className:"h-5 w-5"}),category:"holidays",headerText:t=>t?`Happy Thanksgiving, ${t}!`:"Happy Thanksgiving!",subText:"Grateful for you and your friendship",gradientClasses:"from-orange-50/70 via-amber-50/50 to-red-50/40 dark:from-orange-950/30 dark:via-amber-950/20 dark:to-red-950/20",accentColor:"orange",decorativeElement:r.jsx(Pht,{})},{id:"christmas",name:"Christmas",description:"Spread holiday cheer",icon:r.jsx(j1,{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(Iht,{})},{id:"hanukkah",name:"Hanukkah",description:"Celebrate the Festival of Lights",icon:r.jsx(Ms,{className:"h-5 w-5"}),category:"holidays",headerText:t=>t?`Happy Hanukkah, ${t}!`:"Happy Hanukkah!",subText:"Wishing you eight nights of light and joy",gradientClasses:"from-blue-50/70 via-indigo-50/50 to-sky-50/40 dark:from-blue-950/30 dark:via-indigo-950/20 dark:to-sky-950/20",accentColor:"blue",decorativeElement:r.jsx(Oht,{})},{id:"st_patricks_day",name:"St. Patrick's Day",description:"Celebrate the luck of the Irish",icon:r.jsx(Px,{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(Dht,{})},{id:"home_anniversary",name:"Home Anniversary",description:"Celebrate their home ownership milestone",icon:r.jsx(pa,{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($ht,{})},{id:"under_contract",name:"Under Contract",description:"Celebrate this exciting milestone",icon:r.jsx(Ac,{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(Uht,{})},{id:"just_listed",name:"Just Listed",description:"Announce a new listing",icon:r.jsx(zs,{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(hd,{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(RM,{})},{id:"price_reduction",name:"Price Reduction",description:"Notify about a price change",icon:r.jsx(bj,{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(hj,{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(Wht,{})},{id:"closing_day",name:"Closing Day",description:"Celebrate their closing day",icon:r.jsx(ef,{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(qht,{})},{id:"move_in_day",name:"Move-in Day",description:"Welcome them to their new home",icon:r.jsx(pa,{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(Vht,{})},{id:"offer_accepted",name:"Offer Accepted",description:"Celebrate their accepted offer",icon:r.jsx(pd,{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(RM,{})},{id:"pre_approval",name:"Pre-Approval Congrats",description:"Congratulate on pre-approval",icon:r.jsx(Ol,{className:"h-5 w-5"}),category:"transactional",headerText:t=>t?`Congratulations, ${t}!`:"Congratulations!",subText:"You're pre-approved and ready to find your dream home",gradientClasses:"from-violet-50/70 via-purple-50/50 to-indigo-50/40 dark:from-violet-950/30 dark:via-purple-950/20 dark:to-indigo-950/20",accentColor:"violet",decorativeElement:r.jsx(uke,{})}],Kht=[{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 Zht(t){return jhe.filter(e=>e.category===t)}function CS(t){return jhe.find(e=>e.id===t)||jhe[0]}function Yht(){const{shareToken:t}=Zc(),[e,n]=I.useState(null),[s,a]=I.useState(null),[o,l]=I.useState(null),[i,h]=I.useState(!0),[p,x]=I.useState(null),[y,b]=I.useState(!0);I.useEffect(()=>{const q=()=>{['[id*="lc_text_widget"]','[class*="lc-text-widget"]','[id*="chat-widget"]','[class*="chat-widget"]','iframe[src*="widgets.leadconnectorhq"]','iframe[src*="msgsndr"]',"[data-chat-widget]"].forEach(te=>{document.querySelectorAll(te).forEach(ie=>{ie.style.display="none"})})};q();const H=[setTimeout(q,500),setTimeout(q,1500),setTimeout(q,3e3)],Z=new MutationObserver(q);return Z.observe(document.body,{childList:!0,subtree:!0}),()=>{H.forEach(clearTimeout),Z.disconnect()}},[]),I.useEffect(()=>{(async()=>{if(!t){x("Invalid share link"),h(!1);return}const{data:H,error:Z}=await J.from("agent_videos").select("id, title, playback_url, thumbnail_url, preview_url, duration_seconds, share_token, owner_user_id, contact_id, page_template, recipient_name").eq("share_token",t).eq("is_deleted",!1).single();if(Z||!H){x("Video not found or has been removed"),h(!1);return}n(H);try{await J.rpc("log_video_view",{p_video_id:H.id,p_user_agent:navigator.userAgent,p_referrer:document.referrer||null})}catch(G){console.warn("Failed to log video view:",G)}if(H.owner_user_id){const{data:G}=await J.from("profiles").select("id, name, email, phone").eq("id",H.owner_user_id).single();if(G){a(G);try{const{data:te}=await J.storage.from("avatars").list(`${H.owner_user_id}`);if(te&&te.length>0){const{data:ie}=J.storage.from("avatars").getPublicUrl(`${H.owner_user_id}/${te[0].name}`);l(ie.publicUrl)}}catch{}}}h(!1)})()},[t]);const j=q=>{if(!q)return"0:00";const H=Math.floor(q/60),Z=q%60;return`${H}:${Z.toString().padStart(2,"0")}`},C=q=>q.includes("iframe.mediadelivery.net/play/")?q.replace("/play/","/embed/")+"?autoplay=true&responsive=true":q,N=q=>{if(!q)return"?";const H=q.split(" ");return H.length>=2?`${H[0][0]}${H[1][0]}`.toUpperCase():q.substring(0,2).toUpperCase()},A=CS((e==null?void 0:e.page_template)||"default"),E=(e==null?void 0:e.recipient_name)||null,T=A.headerText(E),z=`https://dashboard.relevelup.com/share/video/${t}`;if(i)return r.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:r.jsx(en,{className:"h-8 w-8 animate-spin text-primary"})});if(p||!e)return r.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center p-4",children:r.jsx(Ye,{className:"max-w-md w-full",children:r.jsxs(tt,{className:"py-12 text-center",children:[r.jsx(Pa,{className:"h-12 w-12 mx-auto text-muted-foreground mb-4"}),r.jsx("h2",{className:"text-xl font-semibold mb-2",children:"Video Not Found"}),r.jsx("p",{className:"text-muted-foreground",children:p||"This video is no longer available."})]})})});const F=A.id!=="default";return r.jsxs(r.Fragment,{children:[r.jsxs(km,{children:[r.jsx("title",{children:T}),r.jsx("meta",{name:"description",content:A.subText}),r.jsx("meta",{property:"og:title",content:T}),r.jsx("meta",{property:"og:description",content:A.subText}),r.jsx("meta",{property:"og:type",content:"video.other"}),r.jsx("meta",{property:"og:url",content:z}),e.preview_url&&r.jsx("meta",{property:"og:image",content:e.preview_url}),!e.preview_url&&e.thumbnail_url&&r.jsx("meta",{property:"og:image",content:e.thumbnail_url}),e.playback_url&&r.jsxs(r.Fragment,{children:[r.jsx("meta",{property:"og:video",content:e.playback_url}),r.jsx("meta",{property:"og:video:type",content:"text/html"}),r.jsx("meta",{property:"og:video:width",content:"1280"}),r.jsx("meta",{property:"og:video:height",content:"720"})]}),r.jsx("meta",{name:"twitter:card",content:"player"}),r.jsx("meta",{name:"twitter:title",content:T}),r.jsx("meta",{name:"twitter:description",content:A.subText}),e.preview_url&&r.jsx("meta",{name:"twitter:image",content:e.preview_url}),e.playback_url&&r.jsxs(r.Fragment,{children:[r.jsx("meta",{name:"twitter:player",content:e.playback_url}),r.jsx("meta",{name:"twitter:player:width",content:"1280"}),r.jsx("meta",{name:"twitter:player:height",content:"720"})]})]}),r.jsxs("div",{className:$t("min-h-screen flex items-center justify-center p-4 bg-gradient-to-b relative",A.gradientClasses),children:[F&&A.decorativeElement,r.jsxs("div",{className:"max-w-2xl w-full space-y-6 relative z-10",children:[F&&r.jsxs("div",{className:"text-center py-4 animate-fade-in",children:[r.jsx("div",{className:"flex justify-center mb-3",children:r.jsx("div",{className:$t("w-14 h-14 rounded-full flex items-center justify-center shadow-sm",A.accentColor==="primary"&&"bg-primary/10 text-primary",A.accentColor==="amber"&&"bg-amber-100 text-amber-600 dark:bg-amber-900/50 dark:text-amber-400",A.accentColor==="teal"&&"bg-teal-100 text-teal-600 dark:bg-teal-900/50 dark:text-teal-400",A.accentColor==="rose"&&"bg-rose-100 text-rose-600 dark:bg-rose-900/50 dark:text-rose-400",A.accentColor==="emerald"&&"bg-emerald-100 text-emerald-600 dark:bg-emerald-900/50 dark:text-emerald-400",A.accentColor==="yellow"&&"bg-yellow-100 text-yellow-600 dark:bg-yellow-900/50 dark:text-yellow-400",A.accentColor==="pink"&&"bg-pink-100 text-pink-600 dark:bg-pink-900/50 dark:text-pink-400",A.accentColor==="blue"&&"bg-blue-100 text-blue-600 dark:bg-blue-900/50 dark:text-blue-400",A.accentColor==="red"&&"bg-red-100 text-red-600 dark:bg-red-900/50 dark:text-red-400",A.accentColor==="orange"&&"bg-orange-100 text-orange-600 dark:bg-orange-900/50 dark:text-orange-400",A.accentColor==="green"&&"bg-green-100 text-green-600 dark:bg-green-900/50 dark:text-green-400",A.accentColor==="violet"&&"bg-violet-100 text-violet-600 dark:bg-violet-900/50 dark:text-violet-400",A.accentColor==="sky"&&"bg-sky-100 text-sky-600 dark:bg-sky-900/50 dark:text-sky-400"),children:r.jsx("div",{className:"scale-150",children:A.icon})})}),r.jsx("h1",{className:"text-2xl sm:text-3xl font-bold mb-2",children:T}),r.jsx("p",{className:"text-muted-foreground",children:A.subText})]}),s&&r.jsxs("div",{className:"flex items-center gap-4 p-4 bg-card/90 backdrop-blur-sm rounded-lg border shadow-sm",children:[r.jsxs(Ks,{className:"h-14 w-14 border-2 border-primary/20",children:[r.jsx(Ei,{src:o||void 0,alt:s.name||"Agent"}),r.jsx(Zs,{className:"bg-primary/10 text-primary font-semibold",children:N(s.name)})]}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:F?"A special video from":"A personal video from"}),r.jsx("h2",{className:"text-lg font-semibold truncate",children:s.name||"Your Agent"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Your Real Estate Professional"})]}),r.jsxs("div",{className:"flex gap-2 shrink-0",children:[s.phone&&r.jsx(ee,{variant:"outline",size:"icon",asChild:!0,className:"h-10 w-10",children:r.jsx("a",{href:`tel:${s.phone}`,"aria-label":"Call agent",children:r.jsx(bi,{className:"h-4 w-4"})})}),s.email&&r.jsx(ee,{variant:"outline",size:"icon",asChild:!0,className:"h-10 w-10",children:r.jsx("a",{href:`mailto:${s.email}`,"aria-label":"Email agent",children:r.jsx(da,{className:"h-4 w-4"})})})]})]}),r.jsx(Ye,{className:"overflow-hidden shadow-lg",children:y&&e.playback_url?r.jsx("div",{className:"relative w-full",style:{paddingBottom:"56.25%"},children:r.jsx("iframe",{src:C(e.playback_url),title:e.title||"Video message",className:"absolute top-0 left-0 w-full h-full",style:{border:0},allow:"accelerometer; gyroscope; autoplay; encrypted-media; picture-in-picture",allowFullScreen:!0})}):r.jsxs("div",{className:"relative aspect-video bg-muted cursor-pointer group",onClick:()=>b(!0),children:[e.preview_url||e.thumbnail_url?r.jsx("img",{src:e.preview_url||e.thumbnail_url||"",alt:e.title?`${e.title} video preview`:"Video message preview",className:"w-full h-full object-cover",onError:q=>{var Z;q.currentTarget.style.display="none";const H=(Z=q.currentTarget.parentElement)==null?void 0:Z.querySelector(".video-fallback");H&&(H.style.display="flex")}}):null,r.jsx("div",{className:"video-fallback w-full h-full items-center justify-center bg-gradient-to-br from-primary/20 to-primary/5",style:{display:e.preview_url||e.thumbnail_url?"none":"flex"},children:r.jsx(Pa,{className:"h-16 w-16 text-primary/50"})}),r.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/30 group-hover:bg-black/40 transition-colors",children:r.jsx("div",{className:"w-20 h-20 rounded-full bg-white/90 flex items-center justify-center shadow-lg transform group-hover:scale-105 transition-transform",children:r.jsx(hc,{className:"h-10 w-10 text-primary ml-1"})})}),e.duration_seconds&&r.jsx("div",{className:"absolute bottom-3 right-3 bg-black/70 text-white text-sm px-2 py-1 rounded",children:j(e.duration_seconds)})]})}),!F&&r.jsxs("div",{className:"text-center",children:[r.jsx("h1",{className:"text-2xl font-bold",children:e.title||"Video Message"}),r.jsx("p",{className:"text-muted-foreground mt-2",children:y?"Enjoy the video!":"Click to play the video"})]}),!y&&r.jsx("div",{className:"flex justify-center",children:r.jsxs(ee,{size:"lg",onClick:()=>b(!0),className:"gap-2",children:[r.jsx(hc,{className:"h-5 w-5"}),"Watch Video"]})}),r.jsx(Nht,{shareToken:t,agentName:(s==null?void 0:s.name)||null,hasContact:!!e.contact_id})]})]})]})}function Xht(){return I.useEffect(()=>(document.body.classList.add("video-landing-page"),()=>{document.body.classList.remove("video-landing-page")}),[]),r.jsx(SJe,{})}function Qht(){const{token:t}=Zc();return I.useEffect(()=>{if(!t)return;const e=`https://relzejiswnotikjgvjhz.supabase.co/functions/v1/video-og-image?token=${t}`;window.location.replace(e)},[t]),r.jsx("main",{className:"min-h-screen bg-background flex items-center justify-center",children:r.jsxs("div",{className:"flex items-center gap-3 text-muted-foreground",children:[r.jsx(en,{className:"h-5 w-5 animate-spin"}),r.jsx("span",{children:"Loading video preview…"})]})})}const Jht={active:"bg-emerald-500",coming_soon:"bg-sky-500",price_improvement:"bg-orange-500",under_contract:"bg-purple-500",sold:"bg-gray-500"},eft={active:"Active",coming_soon:"Coming Soon",price_improvement:"Price Improvement",under_contract:"Under Contract",sold:"Sold"},o4={single_family:"Single Family",condo:"Condo",townhouse:"Townhouse",land:"Land",multi_family:"Multi-Family",luxury:"Luxury",commercial:"Commercial",other:"Other"};function tft(){var ne,ge,ae,he;const{slugOrId:t}=Zc(),[e]=$d(),{data:n,isLoading:s}=iLe(t||""),a=oLe(),o=vit(),l=e.get("ref"),[i,h]=I.useState(""),[p,x]=I.useState(""),[y,b]=I.useState(""),[j,C]=I.useState(""),[N,A]=I.useState(!1),[E,T]=I.useState(!1),[L,z]=I.useState(null),[F,q]=I.useState(!1);I.useEffect(()=>{l&&o.mutate(l)},[l]);const H=ue=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(ue),Z=async ue=>{if(ue.preventDefault(),!(!i.trim()||!y.trim()||!n)){A(!0);try{await a.mutateAsync({listingId:n.id,agentId:n.agent_id,firstName:i.trim(),lastName:p.trim(),email:y.trim(),phone:j.trim(),shareToken:l}),T(!0),ze.success("Thanks! The agent will be in touch soon.")}catch(_e){console.error("Lead submission error:",_e),ze.error(`Failed to submit: ${_e.message||"Please try again"}`)}finally{A(!1)}}},G=(n==null?void 0:n.photos)||[],te=G.find(ue=>ue.is_primary)||G[0],ie=()=>{L!==null&&z(L===0?G.length-1:L-1)},le=()=>{L!==null&&z(L===G.length-1?0:L+1)};if(s)return r.jsxs("div",{className:"min-h-screen bg-background",children:[r.jsx("header",{className:"border-b bg-card",children:r.jsx("div",{className:"container mx-auto px-4 py-4",children:r.jsx(Ir,{className:"h-8 w-32"})})}),r.jsxs("div",{className:"container mx-auto px-4 py-8",children:[r.jsx(Ir,{className:"h-10 w-48 mb-6"}),r.jsx(Ir,{className:"aspect-video mb-6"}),r.jsxs("div",{className:"grid md:grid-cols-3 gap-6",children:[r.jsxs("div",{className:"md:col-span-2 space-y-4",children:[r.jsx(Ir,{className:"h-12 w-48"}),r.jsx(Ir,{className:"h-6 w-full"}),r.jsx(Ir,{className:"h-6 w-3/4"})]}),r.jsx(Ir,{className:"h-64"})]})]})]});if(!n)return r.jsxs("div",{className:"min-h-screen bg-background",children:[r.jsx("header",{className:"border-b bg-card",children:r.jsx("div",{className:"container mx-auto px-4 py-4",children:r.jsx(co,{to:"/public/listings",className:"flex items-center gap-2",children:r.jsx("img",{src:tE,alt:"LevelUp",className:"h-8"})})})}),r.jsxs("div",{className:"container mx-auto px-4 py-16 text-center",children:[r.jsx(pa,{className:"h-16 w-16 mx-auto text-muted-foreground mb-4"}),r.jsx("h1",{className:"text-2xl font-bold mb-2",children:"Listing Not Found"}),r.jsx("p",{className:"text-muted-foreground mb-4",children:"This listing may no longer be available."}),r.jsx(ee,{asChild:!0,children:r.jsx(co,{to:"/public/listings",children:"Browse All Listings"})})]})]});const ye=n.property_address?`${n.property_address} - ${n.city}, ${n.state}`:`${n.city}, ${n.state} Home for Sale`;return r.jsxs(r.Fragment,{children:[r.jsxs(km,{children:[r.jsxs("title",{children:[ye," | LevelUp Listings"]}),r.jsx("meta",{name:"description",content:`${H(n.price)} - ${n.bedrooms||""}BD ${n.bathrooms||""}BA ${n.square_footage?n.square_footage.toLocaleString()+" sqft":""} ${o4[n.property_type]} in ${n.city}, ${n.state}. ${((ne=n.description)==null?void 0:ne.slice(0,150))||""}`}),r.jsx("link",{rel:"canonical",href:`https://listings.relevelup.com/${n.slug||n.id}`}),r.jsx("meta",{property:"og:title",content:ye}),r.jsx("meta",{property:"og:description",content:`${H(n.price)} - ${n.bedrooms||""}BD ${n.bathrooms||""}BA ${o4[n.property_type]} in ${n.city}, ${n.state}. View photos, details, and contact the listing agent.`}),r.jsx("meta",{property:"og:type",content:"website"}),r.jsx("meta",{property:"og:url",content:`https://listings.relevelup.com/${n.slug||n.id}`}),te&&r.jsx("meta",{property:"og:image",content:te.photo_url}),te&&r.jsx("meta",{property:"og:image:alt",content:`${n.property_address||n.city} - ${o4[n.property_type]} for sale`}),r.jsx("meta",{property:"og:site_name",content:"LevelUp Listings"}),r.jsx("meta",{property:"og:locale",content:"en_US"}),r.jsx("meta",{name:"twitter:card",content:"summary_large_image"}),r.jsx("meta",{name:"twitter:title",content:ye}),r.jsx("meta",{name:"twitter:description",content:`${H(n.price)} - ${n.bedrooms||""}BD ${n.bathrooms||""}BA in ${n.city}, ${n.state}`}),te&&r.jsx("meta",{name:"twitter:image",content:te.photo_url}),r.jsx("meta",{name:"robots",content:"index, follow"}),r.jsx("meta",{name:"geo.region",content:`US-${n.state}`}),r.jsx("meta",{name:"geo.placename",content:n.city}),r.jsx("script",{type:"application/ld+json",children:JSON.stringify({"@context":"https://schema.org","@type":"RealEstateListing",name:n.property_address||`${n.city}, ${n.state} Home`,description:n.description||`${o4[n.property_type]} for sale in ${n.city}, ${n.state}`,url:`https://listings.relevelup.com/${n.slug||n.id}`,datePosted:n.created_at,image:G.map(ue=>ue.photo_url),address:{"@type":"PostalAddress",streetAddress:n.property_address||void 0,addressLocality:n.city,addressRegion:n.state,addressCountry:"US"},geo:n.neighborhood?{"@type":"GeoCoordinates",name:n.neighborhood}:void 0,offers:{"@type":"Offer",price:n.price,priceCurrency:"USD",availability:n.status==="sold"?"https://schema.org/SoldOut":n.status==="under_contract"?"https://schema.org/LimitedAvailability":"https://schema.org/InStock"},numberOfRooms:n.bedrooms||void 0,numberOfBathroomsTotal:n.bathrooms||void 0,floorSize:n.square_footage?{"@type":"QuantitativeValue",value:n.square_footage,unitCode:"FTK"}:void 0,yearBuilt:n.year_built||void 0,broker:n.agent?{"@type":"RealEstateAgent",name:n.agent.name,email:n.agent.email,worksFor:(ge=n.agent.brokerage)!=null&&ge.name?{"@type":"RealEstateAgent",name:n.agent.brokerage.name}:void 0}:void 0})})]}),r.jsxs("div",{className:"min-h-screen bg-background",children:[r.jsx("header",{className:"border-b bg-card sticky top-0 z-50",children:r.jsx("div",{className:"container mx-auto px-4 py-4",children:r.jsx("div",{className:"flex items-center justify-between",children:r.jsx(co,{to:"/public/listings",className:"flex items-center gap-2",children:r.jsx("img",{src:tE,alt:"LevelUp",className:"h-8"})})})})}),r.jsxs("div",{className:"container mx-auto px-4 py-6",children:[r.jsxs(co,{to:"/public/listings",className:"inline-flex items-center text-muted-foreground hover:text-foreground mb-6",children:[r.jsx(so,{className:"h-4 w-4 mr-2"}),"Back to Listings"]}),G.length>0&&r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4 mb-8",children:[r.jsx("div",{className:"md:col-span-2",children:r.jsx("div",{className:"aspect-[16/10] rounded-lg overflow-hidden bg-muted cursor-pointer",onClick:()=>z(0),children:r.jsx("img",{src:te==null?void 0:te.photo_url,alt:`${n.property_address||n.city+", "+n.state} - ${o4[n.property_type]} main photo`,className:"w-full h-full object-cover hover:scale-105 transition-transform duration-300"})})}),r.jsx("div",{className:"grid grid-cols-2 gap-2",children:G.slice(1,5).map((ue,_e)=>r.jsxs("div",{className:"aspect-square rounded-lg overflow-hidden bg-muted cursor-pointer relative",onClick:()=>z(_e+1),children:[r.jsx("img",{src:ue.photo_url,alt:`${n.property_address||n.city} - Photo ${_e+2} of ${G.length}`,className:"w-full h-full object-cover hover:scale-105 transition-transform duration-300"}),_e===3&&G.length>5&&r.jsxs("div",{className:"absolute inset-0 bg-black/60 flex items-center justify-center text-white font-semibold",children:["+",G.length-5," more"]})]},ue.id))})]}),r.jsxs("div",{className:"grid md:grid-cols-3 gap-8",children:[r.jsxs("div",{className:"md:col-span-2 space-y-6",children:[r.jsxs("div",{children:[r.jsx("div",{className:"flex items-center gap-2 mb-3",children:r.jsx(Ot,{className:`${Jht[n.status]} text-white border-0`,children:eft[n.status]})}),r.jsx("h1",{className:"text-4xl font-bold text-primary mb-2",children:H(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(fl,{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(l1,{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(o1,{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(wg,{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(zs,{className:"h-6 w-6 mx-auto mb-1 text-muted-foreground"}),r.jsx("p",{className:"text-xl font-semibold",children:n.year_built}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Built"})]})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex flex-wrap gap-2",children:[r.jsxs(Ot,{variant:"secondary",children:[r.jsx(ai,{className:"h-3 w-3 mr-1"}),o4[n.property_type]]}),n.lot_size&&r.jsxs(Ot,{variant:"secondary",children:["Lot: ",n.lot_size]}),n.has_hoa&&r.jsx(Ot,{variant:"secondary",children:"HOA"})]}),n.description&&r.jsxs("div",{children:[r.jsx("h2",{className:"text-lg font-semibold mb-2",children:"About This Property"}),r.jsx("p",{className:"text-muted-foreground whitespace-pre-wrap",children:n.description})]}),n.agent_notes&&n.agent_notes_public&&r.jsxs("div",{children:[r.jsx("h2",{className:"text-lg font-semibold mb-2",children:"Agent Notes"}),r.jsx("p",{className:"text-muted-foreground whitespace-pre-wrap",children:n.agent_notes})]}),n.mls_link&&r.jsx(ee,{variant:"outline",asChild:!0,children:r.jsxs("a",{href:n.mls_link,target:"_blank",rel:"noopener noreferrer",children:[r.jsx(Fs,{className:"h-4 w-4 mr-2"}),"View on MLS"]})})]})]}),r.jsxs("div",{className:"space-y-6",children:[n.video&&n.video.playback_url&&r.jsx(Ye,{className:"overflow-hidden bg-gradient-to-br from-primary/5 to-primary/10 border-primary/20",children:r.jsxs(tt,{className:"p-0",children:[r.jsxs("div",{className:"relative aspect-video bg-muted cursor-pointer group",onClick:()=>q(!0),children:[n.video.thumbnail_url?r.jsx("img",{src:n.video.thumbnail_url,alt:"Video thumbnail",className:"w-full h-full object-cover"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center bg-gradient-to-br from-primary/20 to-primary/30",children:r.jsx(Pa,{className:"h-12 w-12 text-primary"})}),r.jsx("div",{className:"absolute inset-0 bg-black/30 group-hover:bg-black/40 transition-colors flex items-center justify-center",children:r.jsx("div",{className:"h-16 w-16 rounded-full bg-white/90 group-hover:bg-white flex items-center justify-center transition-colors shadow-lg",children:r.jsx(hc,{className:"h-8 w-8 text-primary fill-primary ml-1"})})})]}),r.jsxs("div",{className:"p-4",children:[r.jsxs(ee,{onClick:()=>q(!0),className:"w-full gap-2",size:"lg",children:[r.jsx(hc,{className:"h-4 w-4"}),"Watch Video Tour"]}),n.video.title&&r.jsx("p",{className:"text-xs text-muted-foreground mt-2 text-center truncate",children:n.video.title})]})]})}),n.agent&&r.jsxs(Ye,{children:[r.jsx(Gt,{children:r.jsxs(Zt,{className:"text-lg flex items-center gap-2",children:[r.jsx(Ec,{className:"h-5 w-5"}),"Listing Agent"]})}),r.jsxs(tt,{children:[r.jsx("p",{className:"font-semibold text-lg",children:n.agent.name}),((ae=n.agent.brokerage)==null?void 0:ae.name)&&r.jsx("p",{className:"text-sm text-muted-foreground",children:n.agent.brokerage.name})]})]}),r.jsxs(Ye,{className:"border-primary",children:[r.jsx(Gt,{children:r.jsx(Zt,{className:"text-lg",children:"Interested in this property?"})}),r.jsx(tt,{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(da,{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:Z,className:"space-y-3",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsxs("div",{children:[r.jsx(He,{htmlFor:"firstName",children:"First Name *"}),r.jsx(dt,{id:"firstName",type:"text",placeholder:"John",value:i,onChange:ue=>h(ue.target.value),required:!0})]}),r.jsxs("div",{children:[r.jsx(He,{htmlFor:"lastName",children:"Last Name"}),r.jsx(dt,{id:"lastName",type:"text",placeholder:"Doe",value:p,onChange:ue=>x(ue.target.value)})]})]}),r.jsxs("div",{children:[r.jsx(He,{htmlFor:"email",children:"Email *"}),r.jsx(dt,{id:"email",type:"email",placeholder:"you@example.com",value:y,onChange:ue=>b(ue.target.value),required:!0})]}),r.jsxs("div",{children:[r.jsx(He,{htmlFor:"phone",children:"Phone"}),r.jsx(dt,{id:"phone",type:"tel",placeholder:"(555) 123-4567",value:j,onChange:ue=>C(ue.target.value)})]}),r.jsx(ee,{type:"submit",className:"w-full",disabled:N,children:N?"Submitting...":"Get More Info"}),r.jsx("p",{className:"text-xs text-muted-foreground text-center",children:"The listing agent will reach out to you directly."})]})})]})]})]})]}),r.jsx(Fr,{open:L!==null,onOpenChange:()=>z(null),children:r.jsxs(Rr,{className:"max-w-5xl p-0 bg-black/95",children:[r.jsx(qr,{className:"sr-only",children:r.jsx($r,{children:"Photo Gallery"})}),r.jsx("button",{onClick:()=>z(null),className:"absolute right-4 top-4 z-50 rounded-full bg-black/50 p-2 text-white hover:bg-black/70",children:r.jsx(_s,{className:"h-5 w-5"})}),L!==null&&G[L]&&r.jsxs("div",{className:"relative",children:[r.jsx("img",{src:G[L].photo_url,alt:`Photo ${L+1}`,className:"w-full max-h-[80vh] object-contain"}),G.length>1&&r.jsxs(r.Fragment,{children:[r.jsx("button",{onClick:ie,className:"absolute left-4 top-1/2 -translate-y-1/2 rounded-full bg-black/50 p-2 text-white hover:bg-black/70",children:r.jsx(Tc,{className:"h-6 w-6"})}),r.jsx("button",{onClick:le,className:"absolute right-4 top-1/2 -translate-y-1/2 rounded-full bg-black/50 p-2 text-white hover:bg-black/70",children:r.jsx(Vi,{className:"h-6 w-6"})}),r.jsxs("div",{className:"absolute bottom-4 left-1/2 -translate-x-1/2 text-white bg-black/50 px-3 py-1 rounded-full text-sm",children:[L+1," / ",G.length]})]})]})]})}),r.jsx(Fr,{open:F,onOpenChange:q,children:r.jsxs(Rr,{className:"max-w-4xl p-0 bg-black overflow-hidden",children:[r.jsx(qr,{className:"sr-only",children:r.jsx($r,{children:"Video Tour"})}),r.jsx("button",{onClick:()=>q(!1),className:"absolute right-4 top-4 z-50 rounded-full bg-black/50 p-2 text-white hover:bg-black/70",children:r.jsx(_s,{className:"h-5 w-5"})}),((he=n==null?void 0:n.video)==null?void 0:he.playback_url)&&r.jsx("div",{className:"aspect-video w-full",children:r.jsx("iframe",{src:n.video.playback_url,className:"w-full h-full",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0})})]})}),r.jsx("footer",{className:"border-t py-8 mt-16",children:r.jsxs("div",{className:"container mx-auto px-4 text-center text-sm text-muted-foreground",children:[r.jsxs("p",{children:["© ",new Date().getFullYear()," LevelUp. All rights reserved."]}),r.jsx("p",{className:"mt-2",children:r.jsx("a",{href:"https://relevelup.com",target:"_blank",rel:"noopener noreferrer",className:"hover:text-foreground",children:"relevelup.com"})})]})})]})]})}function rft(){var o;const{slug:t}=Zc(),{data:e,isLoading:n,error:s}=uLe(t);if(I.useEffect(()=>(document.body.classList.add("agent-card-page"),()=>{document.body.classList.remove("agent-card-page")}),[]),I.useEffect(()=>{e!=null&&e.id&&Ti(e.id,"card_view")},[e==null?void 0:e.id]),n)return r.jsx("div",{className:"min-h-screen bg-gradient-to-b from-slate-50 to-white flex items-center justify-center",children:r.jsxs("div",{className:"w-full max-w-md mx-auto p-6 space-y-6",children:[r.jsxs("div",{className:"flex flex-col items-center gap-4",children:[r.jsx(Ir,{className:"h-28 w-28 rounded-full"}),r.jsx(Ir,{className:"h-6 w-48"}),r.jsx(Ir,{className:"h-4 w-36"})]}),r.jsx(Ir,{className:"h-12 w-full"}),r.jsx(Ir,{className:"h-12 w-full"})]})});if(s||!e)return r.jsx("div",{className:"min-h-screen bg-gradient-to-b from-slate-50 to-white flex items-center justify-center p-6",children:r.jsxs("div",{className:"text-center",children:[r.jsx("h1",{className:"text-2xl font-bold text-slate-800 mb-2",children:"Card Not Found"}),r.jsx("p",{className:"text-slate-500",children:"This agent card doesn't exist or isn't published yet."})]})});const a=((o=e.profile)==null?void 0:o.name)||"Agent";return r.jsxs(r.Fragment,{children:[r.jsxs(km,{children:[r.jsxs("title",{children:[a," | Real Estate Agent"]}),r.jsx("meta",{name:"description",content:e.positioning_statement||`Connect with ${a}, your trusted real estate professional.`}),r.jsx("meta",{property:"og:title",content:`${a} | Real Estate Agent`}),r.jsx("meta",{property:"og:description",content:e.positioning_statement||`Connect with ${a}`}),e.avatar_url&&r.jsx("meta",{property:"og:image",content:e.avatar_url})]}),r.jsx(Oge,{card:e})]})}function FM({banners:t,autoPlayInterval:e=5e3,className:n}){const[s,a]=I.useState(0),[o,l]=I.useState(!1),i=I.useCallback(()=>{a(y=>(y+1)%t.length)},[t.length]),h=I.useCallback(()=>{a(y=>(y-1+t.length)%t.length)},[t.length]),p=I.useCallback(y=>{a(y)},[]);if(I.useEffect(()=>{if(t.length<=1||o)return;const y=setInterval(i,e);return()=>clearInterval(y)},[t.length,o,e,i]),!t||t.length===0)return null;const x=t[s];return r.jsxs("div",{className:$t("relative w-full overflow-hidden rounded-xl",n),onMouseEnter:()=>l(!0),onMouseLeave:()=>l(!1),children:[r.jsxs("div",{className:"relative aspect-[21/9] md:aspect-[3/1] w-full",children:[r.jsxs("div",{className:"absolute inset-0 transition-opacity duration-500",children:[r.jsx("img",{src:x.image_url,alt:x.title,className:"w-full h-full object-cover"}),r.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-black/70 via-black/20 to-transparent"})]}),r.jsxs("div",{className:"absolute bottom-0 left-0 right-0 p-6 md:p-8 text-white",children:[r.jsx("h2",{className:"text-xl md:text-3xl font-bold mb-2 drop-shadow-lg",children:x.title}),x.description&&r.jsx("p",{className:"text-sm md:text-base text-white/90 mb-4 max-w-2xl drop-shadow",children:x.description}),x.link_url&&r.jsx("a",{href:x.link_url,target:"_blank",rel:"noopener noreferrer",className:"inline-block",children:r.jsx(ee,{variant:"secondary",className:"bg-white/90 hover:bg-white text-foreground font-semibold",children:x.link_text||"Learn More"})})]}),t.length>1&&r.jsxs(r.Fragment,{children:[r.jsx(ee,{variant:"ghost",size:"icon",className:$t("absolute left-2 top-1/2 -translate-y-1/2 bg-black/30 hover:bg-black/50 text-white rounded-full","opacity-0 transition-opacity",o&&"opacity-100"),onClick:h,children:r.jsx(Tc,{className:"h-6 w-6"})}),r.jsx(ee,{variant:"ghost",size:"icon",className:$t("absolute right-2 top-1/2 -translate-y-1/2 bg-black/30 hover:bg-black/50 text-white rounded-full","opacity-0 transition-opacity",o&&"opacity-100"),onClick:i,children:r.jsx(Vi,{className:"h-6 w-6"})})]})]}),t.length>1&&r.jsx("div",{className:"absolute bottom-3 left-1/2 -translate-x-1/2 flex gap-2",children:t.map((y,b)=>r.jsx("button",{onClick:()=>p(b),className:$t("w-2 h-2 rounded-full transition-all duration-300",b===s?"bg-white w-6":"bg-white/50 hover:bg-white/70"),"aria-label":`Go to slide ${b+1}`},b))})]})}function nft(t){return"EST"}function aE(t){const n=new Intl.DateTimeFormat("en-US",{hour:"numeric",minute:"2-digit",hour12:!0,timeZone:"America/New_York"}).format(t),s=nft();return`${n} ${s}`}function MS(t){const e=new Date,n=new Date(t),s=Zje(n,-15),a=Zje(n,30);return e>a?"ended":rke(e,{start:n,end:a})?"live":rke(e,{start:s,end:n})?"starting_soon":"upcoming"}function fxe(t){const e=MS(t);return e==="starting_soon"||e==="live"}const fke=fxe,sft=({events:t,registrations:e,onNavigateToEvents:n})=>{const[s,a]=I.useState(new Date);I.useEffect(()=>{const j=setInterval(()=>{a(new Date)},3e4);return()=>clearInterval(j)},[]);const o=t.filter(j=>fxe(j.event_date));if(o.length===0)return null;const l=o[0],i=MS(l.event_date),h=e.find(j=>j.event_id===l.id),p=(h==null?void 0:h.zoom_join_url)||l.zoom_link,x=!!h,y=i==="live",b=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 ${b.container} border`,children:[r.jsx("div",{className:`absolute inset-0 bg-gradient-to-r ${b.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 ${b.indicator} opacity-75`}),r.jsx("span",{className:`relative flex h-3 w-3 rounded-full ${b.indicator}`})]}),r.jsx("div",{className:`flex items-center gap-2 ${b.text} font-bold text-sm uppercase tracking-wider`,children:y?r.jsxs(r.Fragment,{children:[r.jsx(_j,{className:"h-4 w-4"}),"Live Now"]}):r.jsxs(r.Fragment,{children:[r.jsx(Ya,{className:"h-4 w-4"}),"Starting Soon"]})})]}),r.jsxs("div",{className:"flex-1",children:[r.jsx("h3",{className:"font-semibold text-lg text-foreground line-clamp-1",children:l.title}),r.jsx("p",{className:"text-sm text-muted-foreground",children:y?`Started at ${aE(new Date(l.event_date))}`:`Starts at ${aE(new Date(l.event_date))}`})]}),r.jsx("div",{className:"flex items-center gap-2",children:x?r.jsxs(ee,{onClick:()=>window.open(p,"_blank"),className:`${b.button} text-white gap-2`,children:[r.jsx(Fs,{className:"h-4 w-4"}),y?"Join Now":"Join When Live"]}):r.jsxs(ee,{variant:"outline",onClick:n,className:`${b.outlineButton} gap-2`,children:[r.jsx(Bn,{className:"h-4 w-4"}),"Register & Join"]})})]})})]})};var pxe="Progress",mxe=100,[aft]=tc(pxe),[ift,oft]=aft(pxe),XOe=I.forwardRef((t,e)=>{const{__scopeProgress:n,value:s=null,max:a,getValueLabel:o=lft,...l}=t;(a||a===0)&&!pke(a)&&console.error(cft(`${a}`,"Progress"));const i=pke(a)?a:mxe;s!==null&&!mke(s,i)&&console.error(dft(`${s}`,"Progress"));const h=mke(s,i)?s:null,p=gte(h)?o(h,i):void 0;return r.jsx(ift,{scope:n,value:h,max:i,children:r.jsx(Rn.div,{"aria-valuemax":i,"aria-valuemin":0,"aria-valuenow":gte(h)?h:void 0,"aria-valuetext":p,role:"progressbar","data-state":e8e(h,i),"data-value":h??void 0,"data-max":i,...l,ref:e})})});XOe.displayName=pxe;var QOe="ProgressIndicator",JOe=I.forwardRef((t,e)=>{const{__scopeProgress:n,...s}=t,a=oft(QOe,n);return r.jsx(Rn.div,{"data-state":e8e(a.value,a.max),"data-value":a.value??void 0,"data-max":a.max,...s,ref:e})});JOe.displayName=QOe;function lft(t,e){return`${Math.round(t/e*100)}%`}function e8e(t,e){return t==null?"indeterminate":t===e?"complete":"loading"}function gte(t){return typeof t=="number"}function pke(t){return gte(t)&&!isNaN(t)&&t>0}function mke(t,e){return gte(t)&&!isNaN(t)&&t<=e&&t>=0}function cft(t,e){return`Invalid prop \`max\` of value \`${t}\` supplied to \`${e}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${mxe}\`.`}function dft(t,e){return`Invalid prop \`value\` of value \`${t}\` supplied to \`${e}\`. The \`value\` prop must be: - a positive number - less than the value passed to \`max\` (or ${mxe} if no \`max\` prop is set) - \`null\` or \`undefined\` if the progress is indeterminate. Defaulting to \`null\`.`}var t8e=XOe,uft=JOe;const Kc=I.forwardRef(({className:t,value:e,...n},s)=>r.jsx(t8e,{ref:s,className:$t("relative h-4 w-full overflow-hidden rounded-full bg-secondary",t),...n,children:r.jsx(uft,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(e||0)}%)`}})}));Kc.displayName=t8e.displayName;function hft(){const{user:t,isBrokerageManager:e}=Qr(),[n,s]=I.useState([]),[a,o]=I.useState([]),[l,i]=I.useState(!1),[h,p]=I.useState(!0),x=e?"brokerage_manager":"agent";I.useEffect(()=>{if(!(t!=null&&t.id)){p(!1);return}y()},[t==null?void 0:t.id,x]);const y=async()=>{if(t!=null&&t.id)try{const{data:z,error:F}=await J.from("onboarding_checklist_items").select("*").eq("target_role",x).eq("is_active",!0).order("sort_order");if(F)throw F;const{data:q,error:H}=await J.from("onboarding_checklist_progress").select("item_id, completed_at").eq("user_id",t.id);if(H)throw H;const{data:Z,error:G}=await J.from("onboarding_checklist_dismissed").select("id").eq("user_id",t.id).maybeSingle();if(G)throw G;s(z||[]),o(q||[]),i(!!Z),z&&z.length>0&&await b(z,q||[])}catch(z){console.error("Error fetching checklist data:",z)}finally{p(!1)}},b=async(z,F)=>{var Ee,Ue;if(!(t!=null&&t.id))return;const q=F.map(Re=>Re.item_id),H=z.filter(Re=>!q.includes(Re.id));if(H.length===0)return;const[Z,G,te,ie,le,ye,ne,ge,ae,he,ue,_e,Ae,Ce]=await Promise.all([J.from("profiles").select("brokerage_id").eq("id",t.id).maybeSingle(),J.from("resource_shares").select("id",{count:"exact",head:!0}).eq("sender_id",t.id),J.from("community_posts").select("id",{count:"exact",head:!0}).eq("user_id",t.id),J.from("event_registrations").select("id",{count:"exact",head:!0}).eq("user_id",t.id),J.from("content_engagement_logs").select("id",{count:"exact",head:!0}).eq("user_id",t.id).eq("resource_type","template"),J.from("content_engagement_logs").select("id",{count:"exact",head:!0}).eq("user_id",t.id).eq("resource_type","academy_video"),J.from("content_engagement_logs").select("id",{count:"exact",head:!0}).eq("user_id",t.id).eq("resource_type","toolbox"),J.from("activity_logs").select("id",{count:"exact",head:!0}).eq("user_id",t.id),J.from("innercircle_contacts").select("id",{count:"exact",head:!0}).eq("owner_user_id",t.id),J.from("agent_videos").select("id",{count:"exact",head:!0}).eq("owner_user_id",t.id),J.from("contact_touch_logs").select("id",{count:"exact",head:!0}).eq("owner_user_id",t.id),J.from("scorecard_transactions").select("id",{count:"exact",head:!0}).eq("owner_user_id",t.id),J.from("listings").select("id",{count:"exact",head:!0}).eq("agent_id",t.id),J.from("innercircle_contacts").select("id").eq("owner_user_id",t.id)]),be={},me=(Ee=Z.data)==null?void 0:Ee.brokerage_id;be.share_resource=(G.count||0)>0,be.post_community=(te.count||0)>0,be.register_event=(ie.count||0)>0,be.view_template=(le.count||0)>0,be.watch_academy=(ye.count||0)>0,be.use_toolbox=(ne.count||0)>0,be.launch_app=(ge.count||0)>0,be.add_contact=(ae.count||0)>0,be.create_video=(he.count||0)>0,be.complete_touch=(ue.count||0)>0,be.add_transaction=(_e.count||0)>0,be.add_listing=(Ae.count||0)>0;const Le=((Ue=Ce.data)==null?void 0:Ue.map(Re=>Re.id))||[],Ne=[];me?Ne.push(J.from("profiles").select("id").eq("brokerage_id",me).neq("id",t.id).then(Re=>{var je;be.add_agent=(((je=Re.data)==null?void 0:je.length)||0)>0})):be.add_agent=!1,Le.length>0?(Ne.push(J.from("contact_plan_cycles").select("id",{count:"exact",head:!0}).in("contact_id",Le).then(Re=>{be.add_plan=(Re.count||0)>0})),Ne.push(J.from("contact_popby_settings").select("id",{count:"exact",head:!0}).in("contact_id",Le).then(Re=>{be.schedule_popby=(Re.count||0)>0}))):(be.add_plan=!1,be.schedule_popby=!1),await Promise.all(Ne);const Be=H.filter(Re=>be[Re.action_type]);if(Be.length>0){const Re=Be.map(et=>({user_id:t.id,item_id:et.id})),{error:je}=await J.from("onboarding_checklist_progress").upsert(Re,{onConflict:"user_id,item_id",ignoreDuplicates:!0});if(!je){const et=Be.map(Te=>({item_id:Te.id,completed_at:new Date().toISOString()}));o(Te=>[...Te,...et])}}},j=async z=>{if(t!=null&&t.id)try{const{error:F}=await J.from("onboarding_checklist_progress").insert({user_id:t.id,item_id:z});if(F)throw F;o(q=>[...q,{item_id:z,completed_at:new Date().toISOString()}])}catch(F){console.error("Error marking item complete:",F)}},C=async()=>{if(t!=null&&t.id)try{const{error:z}=await J.from("onboarding_checklist_dismissed").insert({user_id:t.id});if(z)throw z;i(!0)}catch(z){console.error("Error dismissing checklist:",z)}},N=a.length,A=n.length,E=A>0&&N>=A,T=A>0?N/A*100:0;return{items:n,progress:a,isDismissed:l,loading:h,completedCount:N,totalCount:A,isComplete:E,progressPercentage:T,isItemComplete:z=>a.some(F=>F.item_id===z),markComplete:j,dismiss:C,refetch:y}}const fft={add_agent:r.jsx(Bn,{className:"h-4 w-4"}),share_resource:r.jsx(fc,{className:"h-4 w-4"}),post_community:r.jsx(Lo,{className:"h-4 w-4"}),register_event:r.jsx(zs,{className:"h-4 w-4"}),view_template:r.jsx(m0,{className:"h-4 w-4"}),watch_academy:r.jsx(g1,{className:"h-4 w-4"}),use_toolbox:r.jsx(Wx,{className:"h-4 w-4"}),launch_app:r.jsx(kT,{className:"h-4 w-4"})};function pft(){const{items:t,isDismissed:e,loading:n,completedCount:s,totalCount:a,isComplete:o,progressPercentage:l,isItemComplete:i,markComplete:h,dismiss:p}=hft(),[x,y]=I.useState(!0);return n||e||a===0||o?null:r.jsxs(Ye,{className:"mb-6 border-primary/20 bg-gradient-to-r from-primary/5 to-transparent",children:[r.jsxs(Gt,{className:"pb-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"p-2 bg-primary/10 rounded-lg",children:r.jsx(yg,{className:"h-5 w-5 text-primary"})}),r.jsxs("div",{children:[r.jsx(Zt,{className:"text-lg",children:"Get Started with LevelUp"}),r.jsx("p",{className:"text-sm text-muted-foreground mt-0.5",children:"Complete these steps to make the most of your membership"})]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>y(!x),className:"h-8 w-8 p-0",children:x?r.jsx(c1,{className:"h-4 w-4"}):r.jsx(Dd,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"sm",onClick:p,className:"h-8 w-8 p-0 text-muted-foreground hover:text-foreground",children:r.jsx(_s,{className:"h-4 w-4"})})]})]}),r.jsxs("div",{className:"mt-4",children:[r.jsxs("div",{className:"flex items-center justify-between text-sm mb-2",children:[r.jsx("span",{className:"text-muted-foreground",children:"Progress"}),r.jsxs("span",{className:"font-medium",children:[s," of ",a," complete"]})]}),r.jsx(Kc,{value:l,className:"h-2"})]})]}),x&&r.jsx(tt,{className:"pt-0",children:r.jsx("div",{className:"space-y-3",children:t.map(b=>{const j=i(b.id);return r.jsxs("div",{className:$t("flex items-start gap-3 p-3 rounded-lg transition-colors",j?"bg-muted/50":"bg-background hover:bg-muted/30 cursor-pointer"),onClick:()=>!j&&h(b.id),children:[r.jsx("div",{className:"mt-0.5",children:j?r.jsx(Xi,{className:"h-5 w-5 text-primary"}):r.jsx(Ru,{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:fft[b.action_type]||r.jsx(Ru,{className:"h-4 w-4"})}),r.jsx("span",{className:$t("font-medium",j&&"line-through text-muted-foreground"),children:b.title})]}),b.description&&r.jsx("p",{className:$t("text-sm text-muted-foreground mt-1",j&&"line-through"),children:b.description})]})]},b.id)})})})]})}const Sm=()=>Yt({queryKey:["relationship-types"],queryFn:async()=>{const{data:t,error:e}=await J.from("relationship_types").select("*").order("sort_order");if(e)throw e;return t}}),op=t=>{const e=Pc(),n=1e3,s=async a=>{const o=[];let l=0;for(;;){const{data:i,error:h}=await a.range(l,l+n-1);if(h)throw h;const p=i??[];if(o.push(...p),p.length{let a=J.from("innercircle_contacts").select(` *, tags:innercircle_contact_tags( id, contact_id, relationship_type_id, relationship_type:relationship_types(*) ) `).order("created_at",{ascending:!1}).order("first_name");return await s(a)},enabled:!!e})},mft=t=>Yt({queryKey:["innercircle-contact",t],queryFn:async()=>{const{data:e,error:n}=await J.from("innercircle_contacts").select(` *, tags:innercircle_contact_tags( id, contact_id, relationship_type_id, relationship_type:relationship_types(*) ) `).eq("id",t).maybeSingle();if(n)throw n;return e},enabled:!!t}),r8e=()=>{const t=Pc();return Yt({queryKey:["innercircle-contact-counts",t],queryFn:async()=>{const{data:e,error:n}=await J.from("innercircle_contacts").select(` id, tags:innercircle_contact_tags(relationship_type_id) `);if(n)throw n;const s={};return e==null||e.forEach(a=>{var o;(o=a.tags)==null||o.forEach(l=>{s[l.relationship_type_id]=(s[l.relationship_type_id]||0)+1})}),s},enabled:!!t})},gxe=()=>{const t=Vr(),e=Pc();return cr({mutationFn:async n=>{const{tagIds:s,...a}=n,o={...a,birthday:a.birthday||null,home_anniversary:a.home_anniversary||null,owner_user_id:e},{data:l,error:i}=await J.from("innercircle_contacts").insert(o).select().single();if(i)throw i;if(s&&s.length>0){const{error:h}=await J.from("innercircle_contact_tags").insert(s.map(p=>({contact_id:l.id,relationship_type_id:p})));if(h)throw h}return l},onSuccess:()=>{t.invalidateQueries({queryKey:["innercircle-contacts"]}),t.invalidateQueries({queryKey:["innercircle-contact-counts"]}),ma({title:"Contact created successfully"})},onError:n=>{ma({title:"Error creating contact",description:n.message,variant:"destructive"})}})},n8e=()=>{const t=Vr();return cr({mutationFn:async({id:e,...n})=>{const{tagIds:s,tags:a,...o}=n,l={...o,birthday:o.birthday||null,home_anniversary:o.home_anniversary||null},{data:i,error:h}=await J.from("innercircle_contacts").update(l).eq("id",e).select().single();if(h)throw h;if(s!==void 0&&(await J.from("innercircle_contact_tags").delete().eq("contact_id",e),s.length>0)){const{error:p}=await J.from("innercircle_contact_tags").insert(s.map(x=>({contact_id:e,relationship_type_id:x})));if(p)throw p}return i},onSuccess:()=>{t.invalidateQueries({queryKey:["innercircle-contacts"]}),t.invalidateQueries({queryKey:["innercircle-contact"]}),t.invalidateQueries({queryKey:["innercircle-contact-counts"]}),ma({title:"Contact updated successfully"})},onError:e=>{ma({title:"Error updating contact",description:e.message,variant:"destructive"})}})},xxe=()=>{const t=Vr();return cr({mutationFn:async e=>{const{error:n}=await J.from("innercircle_contacts").delete().eq("id",e);if(n)throw n},onSuccess:()=>{t.invalidateQueries({queryKey:["innercircle-contacts"]}),t.invalidateQueries({queryKey:["innercircle-contact-counts"]}),ma({title:"Contact deleted successfully"})},onError:e=>{ma({title:"Error deleting contact",description:e.message,variant:"destructive"})}})},yxe=()=>Yt({queryKey:["action-types"],queryFn:async()=>{const{data:t,error:e}=await J.from("action_types").select("*").order("sort_order");if(e)throw e;return t}}),gft=t=>Yt({queryKey:["action-scripts",t],queryFn:async()=>{let e=J.from("action_scripts").select("*, action_type:action_types(*)");const{data:n,error:s}=await e;if(s)throw s;return n}}),xft=()=>Yt({queryKey:["touchpoint-plans"],queryFn:async()=>{const{data:t,error:e}=await J.from("touchpoint_plans").select(` *, items:touchpoint_plan_items( *, action_type:action_types(*), default_script:action_scripts(*) ) `).order("name");if(e)throw e;return t}}),yft=()=>{const t=Vr(),e=Pc();return cr({mutationFn:async({name:n,description:s})=>{const{data:a,error:o}=await J.from("touchpoint_plans").insert({name:n,description:s,owner_user_id:e,active:!0,is_template:!1}).select().single();if(o)throw o;return a},onSuccess:()=>{t.invalidateQueries({queryKey:["touchpoint-plans"]}),ma({title:"Plan created successfully"})},onError:n=>{ma({title:"Error creating plan",description:n.message,variant:"destructive"})}})},vft=()=>{const t=Vr(),e=Pc();return cr({mutationFn:async({sourcePlanId:n,newName:s})=>{const{data:a,error:o}=await J.from("touchpoint_plans").select(` *, items:touchpoint_plan_items(*) `).eq("id",n).single();if(o)throw o;if(!a)throw new Error("Source plan not found");const{data:l,error:i}=await J.from("touchpoint_plans").insert({name:s,description:a.description,owner_user_id:e,active:!0,is_template:!1}).select().single();if(i)throw i;if(a.items&&a.items.length>0){const h=a.items.map(x=>({plan_id:l.id,month_number:x.month_number,action_type_id:x.action_type_id,default_script_id:x.default_script_id,notes:x.notes})),{error:p}=await J.from("touchpoint_plan_items").insert(h);if(p)throw p}return l},onSuccess:()=>{t.invalidateQueries({queryKey:["touchpoint-plans"]}),ma({title:"Plan duplicated successfully",description:"You can now edit your copy of this plan."})},onError:n=>{ma({title:"Error duplicating plan",description:n.message,variant:"destructive"})}})},_ft=()=>{const t=Vr();return cr({mutationFn:async({id:e,name:n,description:s})=>{const{data:a,error:o}=await J.from("touchpoint_plans").update({name:n,description:s}).eq("id",e).select().single();if(o)throw o;return a},onSuccess:()=>{t.invalidateQueries({queryKey:["touchpoint-plans"]}),ma({title:"Plan updated successfully"})}})},bft=()=>{const t=Vr();return cr({mutationFn:async e=>{const{error:n}=await J.from("touchpoint_plans").delete().eq("id",e);if(n)throw n},onSuccess:()=>{t.invalidateQueries({queryKey:["touchpoint-plans"]}),ma({title:"Plan deleted successfully"})}})},wft=()=>{const t=Vr();return cr({mutationFn:async({planId:e,items:n})=>{if(await J.from("touchpoint_plan_items").delete().eq("plan_id",e),n.length>0){const{error:s}=await J.from("touchpoint_plan_items").insert(n.map(a=>({plan_id:e,month_number:a.month_number,action_type_id:a.action_type_id,default_script_id:a.default_script_id||null,notes:a.notes})));if(s)throw s}},onSuccess:()=>{t.invalidateQueries({queryKey:["touchpoint-plans"]}),ma({title:"Plan schedule updated"})}})},jft=()=>{const t=Vr();return cr({mutationFn:async({actionTypeId:e,title:n,scriptBody:s,emailSubject:a,tone:o})=>{const{data:l,error:i}=await J.from("action_scripts").insert({action_type_id:e,title:n,script_body:s,email_subject:a||null,tone:o||null,active:!0}).select().single();if(i)throw i;return l},onSuccess:()=>{t.invalidateQueries({queryKey:["action-scripts"]}),ma({title:"Script created successfully"})},onError:e=>{ma({title:"Error creating script",description:e.message,variant:"destructive"})}})},kft=()=>{const t=Pc();return Yt({queryKey:["user-plan-enrollments",t],queryFn:async()=>{const{data:e,error:n}=await J.from("user_plan_enrollments").select(` *, plan:touchpoint_plans(*), relationship_type:relationship_types(*) `);if(n)throw n;return e},enabled:!!t})},Nft=()=>{const t=Vr(),e=Pc();return cr({mutationFn:async({planId:n,relationshipTypeId:s,active:a})=>{const{data:o}=await J.from("user_plan_enrollments").select("id").eq("plan_id",n).eq("relationship_type_id",s).maybeSingle();if(o){const{error:l}=await J.from("user_plan_enrollments").update({active:a}).eq("id",o.id);if(l)throw l}else if(a){const{error:l}=await J.from("user_plan_enrollments").insert({owner_user_id:e,plan_id:n,relationship_type_id:s,active:!0,start_date:new Date().toISOString().split("T")[0]});if(l)throw l}},onSuccess:()=>{t.invalidateQueries({queryKey:["user-plan-enrollments"]}),ma({title:"Plan enrollment updated"})}})},yse=(t=7)=>{const e=Pc();return Yt({queryKey:["contact-touch-logs",e,t],queryFn:async()=>{const n=new Date;n.setDate(n.getDate()-t);const{data:s,error:a}=await J.from("contact_touch_logs").select(` *, contact:innercircle_contacts(*), action_type:action_types(*) `).gte("completed_at",n.toISOString()).order("completed_at",{ascending:!1});if(a)throw a;return s},enabled:!!e})},s8e=()=>{const t=Pc();return Yt({queryKey:["contacts-last-touch",t],queryFn:async()=>{const{data:e,error:n}=await J.from("contact_touch_logs").select("contact_id, completed_at").order("completed_at",{ascending:!1});if(n)throw n;const s={};return e==null||e.forEach(a=>{s[a.contact_id]||(s[a.contact_id]=a.completed_at)}),s},enabled:!!t})},Sft=(t=90)=>{const{data:e}=op(),{data:n}=s8e();if(!e||!n)return{contacts:[],count:0};const s=new Date;s.setDate(s.getDate()-t);const a=e.filter(o=>{const l=n[o.id];return l?new Date(l){const t=Vr(),e=Pc();return cr({mutationFn:async({contactId:n,actionTypeId:s,scriptUsedId:a,notes:o})=>{const{data:l,error:i}=await J.from("contact_touch_logs").insert({owner_user_id:e,contact_id:n,action_type_id:s,script_used_id:a,notes:o,completed_at:new Date().toISOString()}).select().single();if(i)throw i;return l},onSuccess:()=>{t.invalidateQueries({queryKey:["contact-touch-logs"]}),t.invalidateQueries({queryKey:["contacts-last-touch"]}),t.invalidateQueries({queryKey:["today-actions"]}),ma({title:"Action completed!"})}})},i8e="agentos_weekly_touch_goal",gke=20,xte=()=>{if(typeof window>"u")return gke;const t=localStorage.getItem(i8e);if(t){const e=parseInt(t,10);if(!isNaN(e)&&e>0)return e}return gke},o8e=t=>{localStorage.setItem(i8e,t.toString())},l8e=()=>{const{data:t}=yse(7),e=new Date;e.setHours(0,0,0,0);const n=new Date(e);n.setDate(e.getDate()-e.getDay());const s=(t==null?void 0:t.filter(l=>new Date(l.completed_at)>=n).length)||0;let a=0;if(t&&t.length>0){const l=new Set(t.map(h=>new Date(h.completed_at).toDateString()));let i=new Date(e);for(;l.has(i.toDateString());)a++,i.setDate(i.getDate()-1)}const o=xte();return{actionsThisWeek:s,weeklyGoal:o,streak:a,progress:Math.min(s/o*100,100)}},Cft=()=>{const t=Pc();return Yt({queryKey:["contact-plan-cycles",t],queryFn:async()=>{const{data:e,error:n}=await J.from("contact_plan_cycles").select(` *, contact:innercircle_contacts(*), plan:touchpoint_plans( *, items:touchpoint_plan_items( *, action_type:action_types(*), default_script:action_scripts(*) ) ) `);if(n)throw n;return e},enabled:!!t})},Mft=()=>{const t=Vr();return Pc(),cr({mutationFn:async()=>{const{data:e}=await J.from("user_plan_enrollments").select("*").eq("active",!0);if(!e||e.length===0)return;const{data:n}=await J.from("innercircle_contacts").select(` id, tags:innercircle_contact_tags(relationship_type_id) `);if(!n)return;const{data:s}=await J.from("contact_plan_cycles").select("contact_id, plan_id"),a=new Set((s==null?void 0:s.map(l=>`${l.contact_id}-${l.plan_id}`))||[]),o=[];for(const l of n)for(const i of l.tags||[]){const h=e.find(p=>p.relationship_type_id===i.relationship_type_id);h&&!a.has(`${l.id}-${h.plan_id}`)&&o.push({contact_id:l.id,plan_id:h.plan_id,relationship_type_id:i.relationship_type_id})}if(o.length>0){const{error:l}=await J.from("contact_plan_cycles").insert(o);if(l)throw l}return o.length},onSuccess:e=>{t.invalidateQueries({queryKey:["contact-plan-cycles"]}),e&&e>0&&ma({title:`${e} contact(s) enrolled in plans`})}})},c8e=()=>{const t=Pc(),{data:e}=Cft(),{data:n}=yse(30);return Yt({queryKey:["today-actions",t,e==null?void 0:e.length,n==null?void 0:n.length],queryFn:async()=>{var b;if(!e||e.length===0)return[];const s=new Date,a=[],o=new Date(s.getFullYear(),s.getMonth(),1),l=new Set((n==null?void 0:n.filter(j=>new Date(j.completed_at)>=o).map(j=>`${j.contact_id}-${j.action_type_id}`))||[]);for(const j of e){if(!((b=j.plan)!=null&&b.items)||j.plan.items.length===0||!j.contact)continue;const C=new Date(j.cycle_start_date),A=Math.floor((s.getTime()-C.getTime())/(30.44*24*60*60*1e3))%12+1,E=j.plan.items.find(T=>T.month_number===A);if(E&&E.action_type){const T=`${j.contact_id}-${E.action_type_id}`;if(!l.has(T)){const{data:L}=await J.from("relationship_types").select("name").eq("id",j.relationship_type_id).single();a.push({contact:j.contact,actionType:E.action_type,script:E.default_script||void 0,planName:j.plan.name,relationshipTypeName:(L==null?void 0:L.name)||"",monthNumber:A})}}}const i=5,h=s.getDate(),p=a.sort((j,C)=>j.contact.first_name.localeCompare(C.contact.first_name)),x=(h-1)%Math.max(1,p.length);return[...p.slice(x),...p.slice(0,x)].slice(0,i)},enabled:!!t&&!!e})};function Tft(){const t=rs(),{data:e,isLoading:n}=c8e(),{data:s}=op(),a=l8e(),[o,l]=I.useState(xte()),[i,h]=I.useState(""),[p,x]=I.useState(!1);I.useEffect(()=>{l(xte())},[]);const y=()=>{const q=parseInt(i,10);if(isNaN(q)||q<1){ma({title:"Invalid goal",description:"Please enter a number greater than 0",variant:"destructive"});return}l(q),o8e(q),x(!1),ma({title:"Goal updated",description:`Weekly touch goal set to ${q}`})},b=()=>{h(o.toString()),x(!0)},j=uf(new Date),C=Kl(j,7),N=q=>{if(!q)return null;const H=new Date(q);return new Date(j.getFullYear(),H.getMonth(),H.getDate())},A=(s==null?void 0:s.map(q=>{const H=N(q.birthday),Z=N(q.home_anniversary),G=[];return H&&H>=j&&H<=C&&G.push({contact:q,type:"birthday",date:H,isToday:Ql(H,j)}),Z&&Z>=j&&Z<=C&&G.push({contact:q,type:"anniversary",date:Z,isToday:Ql(Z,j)}),G}).flat().sort((q,H)=>q.date.getTime()-H.date.getTime()).slice(0,3))||[],E=(s==null?void 0:s.filter(q=>{const H=N(q.birthday),Z=N(q.home_anniversary);return H&&Ql(H,j)||Z&&Ql(Z,j)}).length)||0,T=(e==null?void 0:e.length)||0,L=E+T,z=(a==null?void 0:a.actionsThisWeek)||0,F=(a==null?void 0:a.streak)||0;return n?r.jsx(Ye,{className:"bg-gradient-to-br from-primary/5 via-primary/10 to-primary/5 border-primary/20",children:r.jsx(tt,{className:"p-4",children:r.jsxs("div",{className:"animate-pulse flex items-center gap-4",children:[r.jsx("div",{className:"h-12 w-12 bg-primary/20 rounded-lg"}),r.jsxs("div",{className:"flex-1 space-y-2",children:[r.jsx("div",{className:"h-4 bg-primary/20 rounded w-1/3"}),r.jsx("div",{className:"h-3 bg-primary/10 rounded w-1/2"})]})]})})}):r.jsxs(Ye,{className:"bg-gradient-to-br from-primary/5 via-primary/10 to-primary/5 border-primary/20",children:[r.jsxs(Gt,{className:"pb-2",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs(Zt,{className:"text-lg flex items-center gap-2",children:[r.jsx(Bn,{className:"h-5 w-5 text-primary"}),"Agent OS"]}),r.jsx("div",{className:"flex items-center gap-2",children:F>0&&r.jsxs(Ot,{variant:"secondary",className:"gap-1 bg-orange-500/10 text-orange-600 border-orange-200",children:[r.jsx(Jh,{className:"h-3 w-3"}),F," day streak"]})})]}),r.jsxs("p",{className:"text-sm text-muted-foreground",children:[L>0?r.jsxs(r.Fragment,{children:[r.jsxs("span",{className:"text-primary font-medium",children:[L," 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(tt,{className:"space-y-4",children:[r.jsxs("div",{className:"flex flex-wrap gap-2",children:[r.jsxs(ee,{size:"sm",variant:"outline",className:"gap-1.5",onClick:q=>{q.stopPropagation(),t("/mission-control/contacts?new=true")},children:[r.jsx(nf,{className:"h-3.5 w-3.5"}),"Add Contact"]}),r.jsxs(ee,{size:"sm",variant:"outline",className:"gap-1.5",onClick:q=>{q.stopPropagation(),t("/mission-control")},children:[r.jsx(bi,{className:"h-3.5 w-3.5"}),"Log Touch"]}),r.jsxs(ee,{size:"sm",variant:"outline",className:"gap-1.5 border-emerald-200 text-emerald-700 hover:bg-emerald-50 hover:text-emerald-800",onClick:q=>{q.stopPropagation(),t("/mission-control/video/record")},children:[r.jsx(Pa,{className:"h-3.5 w-3.5"}),"Quick Video"]}),r.jsxs(ee,{size:"sm",variant:"outline",className:"gap-1.5",onClick:q=>{q.stopPropagation(),t("/mission-control/popbys")},children:[r.jsx(fl,{className:"h-3.5 w-3.5"}),"Pop-by Map"]}),r.jsxs(ee,{size:"sm",variant:"outline",className:"gap-1.5 border-purple-200 text-purple-700 hover:bg-purple-50 hover:text-purple-800",onClick:q=>{q.stopPropagation(),t("/mission-control/pipeline")},children:[r.jsx(y1,{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(Hx,{className:"h-4 w-4 text-primary"}),r.jsx("span",{className:"text-sm font-medium",children:"Weekly Goal"}),r.jsxs(Fr,{open:p,onOpenChange:x,children:[r.jsx(zo,{asChild:!0,children:r.jsx("button",{onClick:b,className:"p-0.5 rounded hover:bg-muted transition-colors","aria-label":"Edit weekly goal",children:r.jsx(fd,{className:"h-3.5 w-3.5 text-muted-foreground hover:text-primary"})})}),r.jsxs(Rr,{className:"sm:max-w-[360px]",children:[r.jsxs(qr,{children:[r.jsx($r,{children:"Set Weekly Goal"}),r.jsx(Xn,{children:"How many touches do you want to complete each week?"})]}),r.jsxs("div",{className:"space-y-4 pt-2",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"weekly-goal",children:"Weekly touch goal"}),r.jsx(dt,{id:"weekly-goal",type:"number",min:"1",value:i,onChange:q=>h(q.target.value),placeholder:"20",onKeyDown:q=>{q.key==="Enter"&&y()}})]}),r.jsx(ee,{onClick:y,className:"w-full",children:"Save Goal"})]})]})]})]}),r.jsxs("span",{className:"text-sm",children:[r.jsx("span",{className:"font-medium text-primary",children:z}),r.jsxs("span",{className:"text-muted-foreground",children:[" / ",o," touches"]})]})]}),r.jsx(Kc,{value:Math.min(z/o*100,100),className:"h-2 bg-muted [&>div]:bg-primary"}),z>=o&&r.jsxs("p",{className:"text-xs text-emerald-600 mt-1.5 flex items-center gap-1",children:[r.jsx("span",{children:"🎉"})," Goal achieved! Keep the momentum going."]}),z0&&r.jsxs("p",{className:"text-xs text-muted-foreground mt-1.5",children:[o-z," more to hit your weekly goal"]})]}),A.length>0&&r.jsxs("div",{className:"pt-3 border-t border-border/50",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[r.jsx(Qh,{className:"h-4 w-4 text-pink-500"}),r.jsx("span",{className:"text-sm font-medium",children:"Upcoming Milestones"})]}),r.jsx("div",{className:"space-y-2",children:A.map((q,H)=>r.jsxs("div",{className:`flex items-center justify-between p-2 rounded-lg cursor-pointer transition-colors ${q.isToday?"bg-pink-500/10 hover:bg-pink-500/15":"bg-muted/50 hover:bg-muted"}`,onClick:Z=>{Z.stopPropagation(),t(`/mission-control/contacts/${q.contact.id}`)},children:[r.jsxs("div",{className:"flex items-center gap-2",children:[q.type==="birthday"?r.jsx(Qh,{className:"h-3.5 w-3.5 text-pink-500"}):r.jsx(pa,{className:"h-3.5 w-3.5 text-blue-500"}),r.jsxs("span",{className:"text-sm",children:[q.contact.first_name," ",q.contact.last_name]}),q.isToday&&r.jsx(Ot,{variant:"secondary",className:"text-[10px] px-1.5 py-0 bg-pink-500/20 text-pink-600",children:"Today!"})]}),r.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[r.jsx("span",{children:q.isToday?q.type==="birthday"?"🎂":"🏠":yn(q.date,"EEE, MMM d")}),r.jsx(Vi,{className:"h-3 w-3"})]})]},`${q.contact.id}-${q.type}-${H}`))})]}),r.jsxs(ee,{variant:"ghost",size:"sm",className:"w-full gap-1 text-muted-foreground hover:text-primary",onClick:()=>t("/mission-control"),children:["Open Agent OS",r.jsx(dl,{className:"h-4 w-4"})]})]})]})}const d8e=()=>Yt({queryKey:["listing-exchange-enabled"],queryFn:async()=>{const{data:t,error:e}=await J.from("feature_flags").select("enabled").eq("key","listing_exchange_enabled").maybeSingle();if(e)throw e;return(t==null?void 0:t.enabled)??!1}}),u8e=t=>{const{user:e,brokerageId:n}=Qr();return Yt({queryKey:["listings",t,n],queryFn:async()=>{let s=J.from("listings").select(` *, photos:listing_photos(*), agent:profiles!listings_agent_id_fkey(id, name, email, brokerage_id, brokerage:brokerages(name)) `).eq("is_approved",!0).eq("is_public",!0);t!=null&&t.status&&(s=s.eq("status",t.status)),t!=null&&t.propertyType&&(s=s.eq("property_type",t.propertyType)),t!=null&&t.city&&(s=s.ilike("city",`%${t.city}%`)),t!=null&&t.minPrice&&(s=s.gte("price",t.minPrice)),t!=null&&t.maxPrice&&(s=s.lte("price",t.maxPrice)),t!=null&&t.openToReferrals&&(s=s.eq("open_to_referrals",!0));const{data:a,error:o}=await s;if(o)throw o;let l=a||[];if(n){const{data:i}=await J.from("profiles").select("id").eq("brokerage_id",n);if(i&&i.length>0){const h=i.map(y=>y.id);let p=J.from("listings").select(` *, photos:listing_photos(*), agent:profiles!listings_agent_id_fkey(id, name, email, brokerage_id, brokerage:brokerages(name)) `).eq("is_approved",!0).eq("share_with_brokerage",!0).eq("is_public",!1).in("agent_id",h);t!=null&&t.status&&(p=p.eq("status",t.status)),t!=null&&t.propertyType&&(p=p.eq("property_type",t.propertyType)),t!=null&&t.city&&(p=p.ilike("city",`%${t.city}%`)),t!=null&&t.minPrice&&(p=p.gte("price",t.minPrice)),t!=null&&t.maxPrice&&(p=p.lte("price",t.maxPrice)),t!=null&&t.openToReferrals&&(p=p.eq("open_to_referrals",!0));const{data:x}=await p;if(x){const y=new Set(l.map(j=>j.id)),b=x.filter(j=>!y.has(j.id));l=[...l,...b]}}}switch(t==null?void 0:t.sortBy){case"updated":l.sort((i,h)=>new Date(h.updated_at).getTime()-new Date(i.updated_at).getTime());break;case"price_asc":l.sort((i,h)=>i.price-h.price);break;case"price_desc":l.sort((i,h)=>h.price-i.price);break;default:l.sort((i,h)=>new Date(h.created_at).getTime()-new Date(i.created_at).getTime())}return l}})},h8e=()=>{const{user:t}=Qr();return Yt({queryKey:["my-listings",t==null?void 0:t.id],queryFn:async()=>{if(!t)return[];const{data:e,error:n}=await J.from("listings").select(` *, photos:listing_photos(*) `).eq("agent_id",t.id).order("created_at",{ascending:!1});if(n)throw n;return e},enabled:!!t})},f8e=t=>{const{user:e}=Qr();return Yt({queryKey:["listing",t],queryFn:async()=>{const{data:n,error:s}=await J.from("listings").select(` *, photos:listing_photos(*), agent:profiles!listings_agent_id_fkey(id, name, email, brokerage_id, brokerage:brokerages(name)), video:agent_videos!listings_video_id_fkey(id, playback_url, thumbnail_url, title, duration_seconds) `).eq("id",t).single();if(s)throw s;return e&&await J.from("listing_views").insert({listing_id:t,viewer_id:e.id}),n},enabled:!!t})},Aft=()=>{const t=Vr(),{user:e}=Qr();return cr({mutationFn:async n=>{if(!e)throw new Error("Not authenticated");const{data:s,error:a}=await J.from("listings").insert({...n,agent_id:e.id}).select().single();if(a)throw a;return s},onSuccess:()=>{t.invalidateQueries({queryKey:["listings"]}),t.invalidateQueries({queryKey:["my-listings"]})}})},Eft=()=>{const t=Vr();return cr({mutationFn:async({agentId:e,...n})=>{const{data:s,error:a}=await J.from("listings").insert({...n,agent_id:e}).select().single();if(a)throw a;return s},onSuccess:()=>{t.invalidateQueries({queryKey:["listings"]}),t.invalidateQueries({queryKey:["my-listings"]}),t.invalidateQueries({queryKey:["brokerage-listings"]})}})},Ift=()=>{const t=Vr();return cr({mutationFn:async({id:e,...n})=>{const{data:s,error:a}=await J.from("listings").update(n).eq("id",e).select().single();if(a)throw a;return s},onSuccess:e=>{t.invalidateQueries({queryKey:["listings"]}),t.invalidateQueries({queryKey:["my-listings"]}),t.invalidateQueries({queryKey:["listing",e.id]})}})},p8e=()=>{const t=Vr();return cr({mutationFn:async e=>{const{error:n}=await J.from("listings").delete().eq("id",e);if(n)throw n},onSuccess:()=>{t.invalidateQueries({queryKey:["listings"]}),t.invalidateQueries({queryKey:["my-listings"]})}})},Pft=()=>{const t=Vr();return cr({mutationFn:async({listingId:e,photoUrl:n,isPrimary:s=!1})=>{const{data:a,error:o}=await J.from("listing_photos").insert({listing_id:e,photo_url:n,is_primary:s}).select().single();if(o)throw o;return a},onSuccess:e=>{t.invalidateQueries({queryKey:["listing",e.listing_id]}),t.invalidateQueries({queryKey:["my-listings"]})}})},Lft=()=>{const t=Vr();return cr({mutationFn:async({photoId:e,listingId:n})=>{const{error:s}=await J.from("listing_photos").delete().eq("id",e);if(s)throw s;return n},onSuccess:e=>{t.invalidateQueries({queryKey:["listing",e]}),t.invalidateQueries({queryKey:["my-listings"]})}})},Oft=()=>{const{user:t}=Qr();return Yt({queryKey:["saved-listings",t==null?void 0:t.id],queryFn:async()=>{if(!t)return[];const{data:e,error:n}=await J.from("listing_saves").select(` *, listing:listings( *, photos:listing_photos(*), agent:profiles!listings_agent_id_fkey(id, name, email, brokerage_id) ) `).eq("agent_id",t.id);if(n)throw n;return e},enabled:!!t})},m8e=()=>{const t=Vr(),{user:e}=Qr();return cr({mutationFn:async n=>{if(!e)throw new Error("Not authenticated");const{data:s}=await J.from("listing_saves").select("id").eq("listing_id",n).eq("agent_id",e.id).maybeSingle();return s?(await J.from("listing_saves").delete().eq("id",s.id),{saved:!1}):(await J.from("listing_saves").insert({listing_id:n,agent_id:e.id}),{saved:!0})},onSuccess:()=>{t.invalidateQueries({queryKey:["saved-listings"]}),t.invalidateQueries({queryKey:["listings"]})}})},g8e=t=>{const{user:e}=Qr();return Yt({queryKey:["listing-saved",t,e==null?void 0:e.id],queryFn:async()=>{if(!e)return!1;const{data:n}=await J.from("listing_saves").select("id").eq("listing_id",t).eq("agent_id",e.id).maybeSingle();return!!n},enabled:!!e&&!!t})},Dft=()=>{const t=Vr(),{user:e}=Qr();return cr({mutationFn:async n=>{if(!e)throw new Error("Not authenticated");const{data:s}=await J.from("listing_follows").select("id").eq("listing_id",n).eq("agent_id",e.id).maybeSingle();return s?(await J.from("listing_follows").delete().eq("id",s.id),{following:!1}):(await J.from("listing_follows").insert({listing_id:n,agent_id:e.id}),{following:!0})},onSuccess:()=>{t.invalidateQueries({queryKey:["listing-following"]})}})},Rft=t=>{const{user:e}=Qr();return Yt({queryKey:["listing-following",t,e==null?void 0:e.id],queryFn:async()=>{if(!e)return!1;const{data:n}=await J.from("listing_follows").select("id").eq("listing_id",t).eq("agent_id",e.id).maybeSingle();return!!n},enabled:!!e&&!!t})},Fft=()=>{const{user:t}=Qr();return cr({mutationFn:async({listingId:e,shareType:n})=>{if(!t)throw new Error("Not authenticated");const{error:s}=await J.from("listing_shares").insert({listing_id:e,sharing_agent_id:t.id,share_type:n});if(s)throw s}})},zft=()=>{const{user:t}=Qr();return Yt({queryKey:["my-referrals",t==null?void 0:t.id],queryFn:async()=>{if(!t)return{sent:[],received:[]};const[e,n]=await Promise.all([J.from("listing_referrals").select(` *, listing:listings(*,photos:listing_photos(*)) `).eq("sender_agent_id",t.id).order("created_at",{ascending:!1}),J.from("listing_referrals").select(` *, sender:profiles!listing_referrals_sender_agent_id_fkey(id, name, email), listing:listings(*,photos:listing_photos(*)) `).eq("listing_agent_id",t.id).order("created_at",{ascending:!1})]);return{sent:e.data||[],received:n.data||[]}},enabled:!!t})},Bft=()=>{const t=Vr(),{user:e}=Qr();return cr({mutationFn:async({listingId:n,listingAgentId:s,buyerName:a,buyerType:o,notes:l})=>{if(!e)throw new Error("Not authenticated");const{data:i,error:h}=await J.from("listing_referrals").insert({listing_id:n,sender_agent_id:e.id,listing_agent_id:s,buyer_name:a,buyer_type:o,notes:l}).select().single();if(h)throw h;return i},onSuccess:()=>{t.invalidateQueries({queryKey:["my-referrals"]})}})},$ft=()=>Yt({queryKey:["listing-leaderboard"],queryFn:async()=>{const{data:t}=await J.from("listing_shares").select("sharing_agent_id, profiles!listing_shares_agent_id_fkey(name)").order("created_at",{ascending:!1}),e=new Map;t==null||t.forEach(l=>{var p;const i=l.sharing_agent_id;if(!i)return;const h=e.get(i);h?h.count++:e.set(i,{name:((p=l.profiles)==null?void 0:p.name)||"Unknown",count:1})});const n=Array.from(e.entries()).map(([l,i])=>({agentId:l,...i})).sort((l,i)=>i.count-l.count).slice(0,10),{data:s}=await J.from("listings").select("agent_id, agent:profiles!listings_agent_id_fkey(name)").eq("is_approved",!0),a=new Map;s==null||s.forEach(l=>{var h;const i=a.get(l.agent_id);i?i.count++:a.set(l.agent_id,{name:((h=l.agent)==null?void 0:h.name)||"Unknown",count:1})});const o=Array.from(a.entries()).map(([l,i])=>({agentId:l,...i})).sort((l,i)=>i.count-l.count).slice(0,10);return{topSharers:n,topListers:o}}}),Uft=()=>{const{user:t,brokerageId:e}=Qr();return Yt({queryKey:["brokerage-listings",e],queryFn:async()=>{if(!t||!e)return[];const{data:n}=await J.from("profiles").select("id").eq("brokerage_id",e);if(!n||n.length===0)return[];const s=n.map(l=>l.id),{data:a,error:o}=await J.from("listings").select(` *, photos:listing_photos(*), agent:profiles!listings_agent_id_fkey(id, name, email, brokerage_id, brokerage:brokerages(name)) `).in("agent_id",s).eq("is_approved",!0).order("created_at",{ascending:!1});if(o)throw o;return a},enabled:!!t&&!!e})},qft=({className:t,variant:e="default"})=>r.jsx(Ot,{variant:"outline",className:$t("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"}),Vft={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"},Hft={coming_soon:"Coming Soon",active:"Active",under_contract:"Under Contract",sold:"Sold",withdrawn:"Withdrawn"};function Wft(t){return t>=1e6?`$${(t/1e6).toFixed(1)}M`:`$${(t/1e3).toFixed(0)}K`}function Gft(){const t=rs(),{data:e,isLoading:n}=d8e(),{data:s,isLoading:a}=u8e({status:void 0,propertyType:void 0,sortBy:"newest"}),o=(s==null?void 0:s.filter(x=>x.is_approved&&x.is_public))||[],l=o.filter(x=>x.is_featured),i=o.filter(x=>!x.is_featured),h=[...l,...i].slice(0,6),p=n||a;return!p&&!e?null:p?r.jsx(Ye,{className:"bg-gradient-to-br from-emerald-500/5 via-emerald-500/10 to-emerald-500/5 border-emerald-500/20",children:r.jsx(tt,{className:"p-4",children:r.jsxs("div",{className:"animate-pulse flex items-center gap-4",children:[r.jsx("div",{className:"h-12 w-12 bg-emerald-500/20 rounded-lg"}),r.jsxs("div",{className:"flex-1 space-y-2",children:[r.jsx("div",{className:"h-4 bg-emerald-500/20 rounded w-1/3"}),r.jsx("div",{className:"h-3 bg-emerald-500/10 rounded w-1/2"})]})]})})}):r.jsxs("section",{className:"mb-10",children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("h3",{className:"text-lg font-semibold text-foreground",children:"Listing Exchange"}),r.jsx(qft,{})]}),r.jsxs(ee,{variant:"ghost",size:"sm",onClick:()=>t("/mission-control/listings"),className:"gap-1 text-muted-foreground hover:text-foreground",children:["View All ",r.jsx(dl,{className:"h-4 w-4"})]})]}),h.length===0?r.jsx(Ye,{className:"bg-muted/30 border-dashed",children:r.jsx(tt,{className:"flex items-center justify-center py-8",children:r.jsxs("div",{className:"text-center",children:[r.jsx(pa,{className:"h-8 w-8 text-muted-foreground/50 mx-auto mb-2"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"No listings available yet"}),r.jsx(ee,{variant:"link",size:"sm",onClick:()=>t("/mission-control/listings/new"),className:"mt-2",children:"Add the first listing"})]})})}):r.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-6 gap-3",children:h.map(x=>{var b,j;const y=((b=x.photos)==null?void 0:b.find(C=>C.is_primary))||((j=x.photos)==null?void 0:j[0]);return r.jsxs("div",{onClick:()=>t(`/mission-control/listings/${x.id}`),className:"group cursor-pointer bg-card rounded-xl border border-border overflow-hidden transition-all duration-200 hover:shadow-lg hover:border-primary/30",children:[r.jsxs("div",{className:"aspect-[4/3] bg-muted/50 overflow-hidden relative",children:[y!=null&&y.photo_url?r.jsx("img",{src:y.photo_url,alt:`${x.city}, ${x.state}`,className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-300"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center",children:r.jsx(pa,{className:"h-8 w-8 text-muted-foreground/50"})}),x.is_featured&&r.jsx("div",{className:"absolute top-1.5 left-1.5",children:r.jsxs(Ot,{className:"gap-1 bg-amber-500 text-white border-0 text-[10px] px-1.5 py-0.5",children:[r.jsx(vs,{className:"h-2.5 w-2.5 fill-current"}),"Featured"]})}),r.jsx("div",{className:"absolute top-1.5 right-1.5",children:r.jsx(Ot,{className:`text-[10px] px-1.5 py-0.5 ${Vft[x.status]}`,children:Hft[x.status]})})]}),r.jsxs("div",{className:"p-2",children:[r.jsx("p",{className:"font-bold text-sm text-foreground",children:Wft(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 x8e(t=10,e){return Yt({queryKey:["event-leaderboard",t,e],queryFn:async()=>{const{data:n}=await J.from("user_roles").select("user_id").eq("role","admin"),s=new Set((n==null?void 0:n.map(b=>b.user_id))||[]);let a=null;if(e){const{data:b}=await J.from("profiles").select("id").eq("brokerage_id",e);a=new Set((b==null?void 0:b.map(j=>j.id))||[])}const{data:o,error:l}=await J.from("agent_attendance_stats").select("user_id, total_points, total_events_attended, current_streak").order("total_points",{ascending:!1}).limit(t+s.size+50);if(l)throw l;if(!o||o.length===0)return[];let i=o.filter(b=>!s.has(b.user_id));a&&(i=i.filter(b=>a.has(b.user_id)));const h=i.slice(0,t),p=h.map(b=>b.user_id),{data:x}=await J.from("profiles").select("id, name").in("id",p),y=new Map((x==null?void 0:x.map(b=>[b.id,{name:b.name}]))||[]);return h.map(b=>({user_id:b.user_id,total_points:b.total_points,total_events_attended:b.total_events_attended,current_streak:b.current_streak,profile:y.get(b.user_id)||null}))}})}function y8e(t){return Yt({queryKey:["user-attendance-stats",t],queryFn:async()=>{if(!t)return null;const{data:e,error:n}=await J.from("agent_attendance_stats").select("*").eq("user_id",t).single();if(n&&n.code!=="PGRST116")throw n;return e},enabled:!!t})}function v8e(t){return Yt({queryKey:["user-badges",t],queryFn:async()=>{if(!t)return[];const{data:e,error:n}=await J.from("agent_badges").select("*").eq("user_id",t).order("earned_at",{ascending:!1});if(n)throw n;return e},enabled:!!t})}function _8e(t,e){return Yt({queryKey:["user-rank",t,e],queryFn:async()=>{if(!t)return null;const{data:n}=await J.from("agent_attendance_stats").select("total_points").eq("user_id",t).single();if(!n)return null;const{data:s}=await J.from("user_roles").select("user_id").eq("role","admin"),a=new Set((s==null?void 0:s.map(h=>h.user_id))||[]),{data:o,error:l}=await J.from("agent_attendance_stats").select("user_id, total_points").gt("total_points",n.total_points);if(l)throw l;let i=(o==null?void 0:o.filter(h=>!a.has(h.user_id)))||[];if(e){const{data:h}=await J.from("profiles").select("id").eq("brokerage_id",e),p=new Set((h==null?void 0:h.map(x=>x.id))||[]);i=i.filter(x=>p.has(x.user_id))}return i.length+1},enabled:!!t})}function Kft(){const{user:t,brokerageId:e,isAdmin:n}=Qr();rs();const s=!!e,[a,o]=I.useState("brokerage"),l=()=>{if(n)return null;if(s)return a==="global"?null:e},{data:i,isLoading:h}=x8e(5,l()),{data:p}=y8e(t==null?void 0:t.id),{data:x}=_8e(t==null?void 0:t.id,l()),{data:y}=v8e(t==null?void 0:t.id),b=n||s,j=()=>n?"Agent Leaderboard":s?a==="global"?"All LevelUp":"My Brokerage":"My Points";if(h)return r.jsxs(Ye,{children:[r.jsx(Gt,{className:"pb-2",children:r.jsxs(Zt,{className:"text-base flex items-center gap-2",children:[r.jsx(Zi,{className:"h-4 w-4 text-yellow-500"}),j()]})}),r.jsx(tt,{children:r.jsx("div",{className:"space-y-2",children:[...Array(b?5:3)].map((N,A)=>r.jsx(Ir,{className:"h-10 w-full"},A))})})]});const C=N=>N===0?r.jsx(Zi,{className:"h-4 w-4 text-yellow-500 mx-auto"}):N===1?r.jsx("span",{className:"text-sm font-medium text-gray-400",children:"2"}):N===2?r.jsx("span",{className:"text-sm font-medium text-amber-600",children:"3"}):r.jsx("span",{className:"text-sm font-medium text-muted-foreground",children:N+1});if(b){const N=(i==null?void 0:i.slice(0,5))||[];return r.jsxs(Ye,{children:[r.jsxs(Gt,{className:"pb-2",children:[r.jsxs(Zt,{className:"text-base flex items-center gap-2",children:[r.jsx(Zi,{className:"h-4 w-4 text-yellow-500"}),j()]}),!n&&s&&r.jsxs("div",{className:"flex gap-1 mt-2",children:[r.jsx(ee,{variant:a==="brokerage"?"default":"outline",size:"sm",className:"text-xs h-7 flex-1",onClick:()=>o("brokerage"),children:"My Brokerage"}),r.jsx(ee,{variant:a==="global"?"default":"outline",size:"sm",className:"text-xs h-7 flex-1",onClick:()=>o("global"),children:"All LevelUp"})]})]}),r.jsxs(tt,{children:[!n&&p&&r.jsx("div",{className:"mb-3 p-2 rounded-lg bg-primary/5 border border-primary/10",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-sm text-muted-foreground",children:"Your Rank:"}),r.jsxs("span",{className:"font-bold text-primary",children:["#",x||"-"]})]}),r.jsxs("div",{className:"flex items-center gap-3 text-sm",children:[r.jsxs("span",{children:[r.jsx("strong",{className:"text-primary",children:p.total_points})," pts"]}),r.jsxs("span",{children:[r.jsx("strong",{children:p.total_events_attended})," events"]})]})]})}),r.jsxs("div",{className:"space-y-2",children:[N.map((A,E)=>{var T,L,z;return r.jsxs("div",{className:`flex items-center gap-2 p-2 rounded-lg ${A.user_id===(t==null?void 0:t.id)?"bg-primary/10 border border-primary/20":E===0?"bg-yellow-500/10":""}`,children:[r.jsx("div",{className:"w-5 text-center",children:C(E)}),r.jsx(Ks,{className:"h-6 w-6",children:r.jsx(Zs,{className:"text-xs",children:((L=(T=A.profile)==null?void 0:T.name)==null?void 0:L.charAt(0))||"?"})}),r.jsx("span",{className:"flex-1 text-sm font-medium truncate",children:((z=A.profile)==null?void 0:z.name)||"Unknown"}),r.jsx("span",{className:"text-sm font-bold text-primary",children:A.total_points})]},A.user_id)}),N.length===0&&r.jsx("div",{className:"text-center text-muted-foreground py-2 text-sm",children:"No data yet"})]}),r.jsxs(co,{to:"/reward-store",className:"mt-3 flex items-center justify-center gap-2 p-2 rounded-lg bg-primary/5 hover:bg-primary/10 transition-colors text-sm font-medium text-primary",children:[r.jsx(Ki,{className:"h-4 w-4"}),"Spend Points in Reward Store",r.jsx(Vi,{className:"h-4 w-4"})]})]})]})}return r.jsxs(Ye,{children:[r.jsx(Gt,{className:"pb-2",children:r.jsxs(Zt,{className:"text-base flex items-center gap-2",children:[r.jsx(Zi,{className:"h-4 w-4 text-yellow-500"}),"My Points"]})}),r.jsx(tt,{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(Jh,{className:"h-4 w-4 text-orange-500"}),r.jsx("span",{className:"text-sm font-medium",children:"Current Streak"})]}),r.jsxs("span",{className:"font-bold text-orange-500",children:[p.current_streak," 🔥"]})]}),y&&y.length>0&&r.jsxs("div",{className:"pt-2 border-t",children:[r.jsxs("div",{className:"flex items-center gap-1 mb-2",children:[r.jsx(Ol,{className:"h-3 w-3 text-muted-foreground"}),r.jsx("span",{className:"text-xs text-muted-foreground",children:"Badges"})]}),r.jsxs("div",{className:"flex flex-wrap gap-1",children:[y.slice(0,4).map(N=>r.jsx("span",{className:"text-xs px-2 py-1 rounded-full bg-yellow-500/10 text-yellow-600 border border-yellow-500/20",children:N.badge_name},N.id)),y.length>4&&r.jsxs("span",{className:"text-xs text-muted-foreground px-2 py-1",children:["+",y.length-4," more"]})]})]}),r.jsxs(co,{to:"/reward-store",className:"mt-3 flex items-center justify-center gap-2 p-2 rounded-lg bg-primary/5 hover:bg-primary/10 transition-colors text-sm font-medium text-primary",children:[r.jsx(Ki,{className:"h-4 w-4"}),"Spend Points in Reward Store",r.jsx(Vi,{className:"h-4 w-4"})]})]}):r.jsxs("div",{className:"text-center text-muted-foreground py-4 text-sm",children:[r.jsx(vs,{className:"h-8 w-8 mx-auto mb-2 text-muted-foreground/50"}),r.jsx("p",{children:"Attend events to earn points!"}),r.jsxs(co,{to:"/reward-store",className:"mt-3 inline-flex items-center gap-2 p-2 rounded-lg bg-primary/5 hover:bg-primary/10 transition-colors text-sm font-medium text-primary",children:[r.jsx(Ki,{className:"h-4 w-4"}),"Visit Reward Store",r.jsx(Vi,{className:"h-4 w-4"})]})]})})]})}const vse=()=>Yt({queryKey:["lead-sources"],queryFn:async()=>{const{data:t,error:e}=await J.from("lead_sources").select("*").eq("is_active",!0).order("sort_order");if(e)throw e;return t}}),Zft=()=>{const t=Vr(),{user:e}=Qr();return cr({mutationFn:async n=>{const{data:s,error:a}=await J.from("lead_sources").insert({name:n,owner_user_id:e==null?void 0:e.id,sort_order:100}).select().single();if(a)throw a;return s},onSuccess:()=>{t.invalidateQueries({queryKey:["lead-sources"]}),ze.success("Lead source added")},onError:n=>{ze.error("Failed to add lead source"),console.error(n)}})},vxe=(t,e)=>{const{user:n,isAdmin:s}=Qr(),a=s&&e?e:n==null?void 0:n.id;return Yt({queryKey:["scorecard-transactions",t,a],queryFn:async()=>{let o=J.from("scorecard_transactions").select(` *, lead_source:lead_sources(id, name), client_type:relationship_types(id, name), contact:innercircle_contacts(id, first_name, last_name) `).eq("owner_user_id",a).order("close_date",{ascending:!1});t&&(o=o.gte("close_date",`${t}-01-01`).lte("close_date",`${t}-12-31`));const{data:l,error:i}=await o;if(i)throw i;return l},enabled:!!a})},b8e=t=>{const{user:e,isAdmin:n}=Qr(),s=n&&t?t:e==null?void 0:e.id;return Yt({queryKey:["scorecard-transactions-all",s],queryFn:async()=>{const{data:a,error:o}=await J.from("scorecard_transactions").select(` *, lead_source:lead_sources(id, name), client_type:relationship_types(id, name), contact:innercircle_contacts(id, first_name, last_name) `).eq("owner_user_id",s).order("close_date",{ascending:!1});if(o)throw o;return a},enabled:!!s})},_se=()=>{const t=Vr(),{user:e}=Qr();return cr({mutationFn:async n=>{const{data:s,error:a}=await J.from("scorecard_transactions").insert({...n,owner_user_id:e.id}).select().single();if(a)throw a;return s},onSuccess:()=>{t.invalidateQueries({queryKey:["scorecard-transactions"]}),t.invalidateQueries({queryKey:["scorecard-transactions-all"]}),ze.success("Transaction added")},onError:n=>{ze.error("Failed to add transaction"),console.error(n)}})},Yft=()=>{const t=Vr();return cr({mutationFn:async({id:e,...n})=>{const{data:s,error:a}=await J.from("scorecard_transactions").update(n).eq("id",e).select().single();if(a)throw a;return s},onSuccess:()=>{t.invalidateQueries({queryKey:["scorecard-transactions"]}),t.invalidateQueries({queryKey:["scorecard-transactions-all"]}),ze.success("Transaction updated")},onError:e=>{ze.error("Failed to update transaction"),console.error(e)}})},Xft=()=>{const t=Vr();return cr({mutationFn:async e=>{const{error:n}=await J.from("scorecard_transactions").delete().eq("id",e);if(n)throw n},onSuccess:()=>{t.invalidateQueries({queryKey:["scorecard-transactions"]}),t.invalidateQueries({queryKey:["scorecard-transactions-all"]}),ze.success("Transaction deleted")},onError:e=>{ze.error("Failed to delete transaction"),console.error(e)}})},w8e=(t,e)=>{const{user:n,isAdmin:s}=Qr(),a=s&&e?e:n==null?void 0:n.id;return Yt({queryKey:["scorecard-goals",t,a],queryFn:async()=>{const{data:o,error:l}=await J.from("scorecard_goals").select("*").eq("owner_user_id",a).eq("year",t).maybeSingle();if(l)throw l;return o},enabled:!!a})},Qft=()=>{const t=Vr(),{user:e}=Qr();return cr({mutationFn:async n=>{const{data:s,error:a}=await J.from("scorecard_goals").upsert({...n,owner_user_id:e.id},{onConflict:"owner_user_id,year"}).select().single();if(a)throw a;return s},onSuccess:(n,s)=>{t.invalidateQueries({queryKey:["scorecard-goals",s.year]}),ze.success("Goals saved")},onError:n=>{ze.error("Failed to save goals"),console.error(n)}})},bse=()=>{const{user:t}=Qr();return Yt({queryKey:["scorecard-settings",t==null?void 0:t.id],queryFn:async()=>{const{data:e,error:n}=await J.from("scorecard_settings").select("*").eq("user_id",t.id).maybeSingle();if(n)throw n;return e},enabled:!!(t!=null&&t.id)})},Jft=()=>{const t=Vr(),{user:e}=Qr();return cr({mutationFn:async n=>{const{data:s,error:a}=await J.from("scorecard_settings").upsert({...n,user_id:e.id},{onConflict:"user_id"}).select().single();if(a)throw a;return s},onSuccess:()=>{t.invalidateQueries({queryKey:["scorecard-settings"]}),ze.success("Settings saved")},onError:n=>{ze.error("Failed to save settings"),console.error(n)}})},j8e=(t,e)=>{const{data:n,isLoading:s}=vxe(t,e),{data:a,isLoading:o}=b8e(e),{data:l}=bse(),i=(l==null?void 0:l.show_commission)??!0,h=p=>{if(!p||p.length===0)return{totalTransactions:0,buyerCount:0,sellerCount:0,totalVolume:0,averagePrice:0,totalCommission:0,topLeadSource:null,transactionsByMonth:[],leadSourceBreakdown:[]};const x=p.filter(z=>z.transaction_type==="buyer").length,y=p.filter(z=>z.transaction_type==="seller").length,b=p.reduce((z,F)=>z+Number(F.sale_price),0),j=p.reduce((z,F)=>z+(Number(F.commission_amount)||0),0),C={};p.forEach(z=>{var q;const F=((q=z.lead_source)==null?void 0:q.name)||"Unknown";C[F]=(C[F]||0)+1});const N=Object.entries(C).map(([z,F])=>({name:z,count:F})).sort((z,F)=>F.count-z.count),A=N[0]||null,E={};p.forEach(z=>{const F=new Date(z.close_date).toLocaleString("default",{month:"short"});E[F]=(E[F]||0)+1});const L=["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:b,averagePrice:p.length>0?b/p.length:0,totalCommission:i?j:0,topLeadSource:A,transactionsByMonth:L,leadSourceBreakdown:N}};return{yearStats:h(n),lifetimeStats:h(a),isLoading:s||o,showCommission:i}},ept=()=>{const{isAdmin:t}=Qr();return Yt({queryKey:["agents-with-transactions"],queryFn:async()=>{const{data:e,error:n}=await J.from("scorecard_transactions").select("owner_user_id").order("owner_user_id");if(n)throw n;const s=[...new Set(e.map(l=>l.owner_user_id))],{data:a,error:o}=await J.from("profiles").select("id, name, email").in("id",s);if(o)throw o;return a},enabled:t})},v0={recency:40,touchpoints:30,transactions:20},xke={warm:70,cooling:40};function tpt(t){return t===null?0:t<=14?v0.recency:t<=30?v0.recency*.85:t<=60?v0.recency*.65:t<=90?v0.recency*.4:t<=180?v0.recency*.2:v0.recency*.05}function rpt(t){const e=Math.min(t/12,1);return Math.round(v0.touchpoints*e)}function npt(t){return t?v0.transactions:0}function spt(){return 0}function apt(t){return t>=xke.warm?"warm":t>=xke.cooling?"cooling":"at-risk"}function _xe(){const{data:t,isLoading:e}=op(),{data:n}=s8e(),{data:s}=yse(365),{data:a}=b8e(),o=I.useMemo(()=>{if(!t)return[];const i=new Date,h=Jdt(i),p={};s==null||s.forEach(y=>{new Date(y.completed_at)>=h&&(p[y.contact_id]=(p[y.contact_id]||0)+1)});const x=new Set((a==null?void 0:a.filter(y=>y.contact_id).map(y=>y.contact_id))||[]);return t.map(y=>{const b=(n==null?void 0:n[y.id])||null,j=b?qj(i,new Date(b)):null,C=p[y.id]||0,N=x.has(y.id),A=tpt(j),E=rpt(C),T=npt(N),L=spt(),z=Math.round(A+E+T+L),F={score:z,status:apt(z),breakdown:{recency:Math.round(A),touchpoints:Math.round(E),transactions:Math.round(T),referrals:Math.round(L)},lastTouchDate:b,daysSinceTouch:j,touchCountLast12Months:C,hasTransaction:N};return{...y,relationshipScore:F}})},[t,n,s,a]),l=I.useMemo(()=>{const i=o.filter(b=>b.relationshipScore.status==="warm").length,h=o.filter(b=>b.relationshipScore.status==="cooling").length,p=o.filter(b=>b.relationshipScore.status==="at-risk").length,x=o.length,y=x>0?Math.round(o.reduce((b,j)=>b+j.relationshipScore.score,0)/x):0;return{warm:i,cooling:h,atRisk:p,total:x,averageScore:y}},[o]);return{contactsWithScores:o,stats:l,isLoading:e}}function k8e(){const t=rs(),{stats:e,contactsWithScores:n,isLoading:s}=_xe();if(s)return r.jsxs(Ye,{children:[r.jsx(Gt,{className:"pb-2",children:r.jsx(Ir,{className:"h-5 w-40"})}),r.jsxs(tt,{className:"space-y-4",children:[r.jsx(Ir,{className:"h-20 w-full"}),r.jsx(Ir,{className:"h-16 w-full"})]})]});if(e.total===0)return r.jsxs(Ye,{children:[r.jsx(Gt,{className:"pb-2",children:r.jsxs(Zt,{className:"text-lg flex items-center gap-2",children:[r.jsx(Bn,{className:"h-5 w-5"}),"Relationship Health"]})}),r.jsxs(tt,{children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Add contacts to see your relationship health scores."}),r.jsx(ee,{variant:"outline",size:"sm",className:"mt-3",onClick:()=>t("/mission-control/contacts?new=true"),children:"Add Your First Contact"})]})]});const a=Math.round(e.warm/e.total*100),o=Math.round(e.cooling/e.total*100),l=Math.round(e.atRisk/e.total*100),i=n.filter(h=>h.relationshipScore.status==="at-risk").sort((h,p)=>h.relationshipScore.score-p.relationshipScore.score).slice(0,3);return r.jsxs(Ye,{children:[r.jsxs(Gt,{className:"pb-2",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs(Zt,{className:"text-lg flex items-center gap-2",children:[r.jsx(Xf,{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(tt,{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(Kc,{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(Kc,{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(Kc,{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(bj,{className:"h-4 w-4 text-red-500"}),r.jsx("span",{className:"text-sm font-medium",children:"Needs Attention"})]}),r.jsx("div",{className:"space-y-2",children:i.map(h=>r.jsxs("div",{className:"flex items-center justify-between p-2 rounded-lg bg-red-500/5 hover:bg-red-500/10 cursor-pointer transition-colors",onClick:()=>t(`/mission-control/contacts/${h.id}`),children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"h-2 w-2 rounded-full bg-red-500"}),r.jsxs("span",{className:"text-sm",children:[h.first_name," ",h.last_name]})]}),r.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[r.jsx("span",{children:h.relationshipScore.daysSinceTouch===null?"Never":`${h.relationshipScore.daysSinceTouch}d`}),r.jsx(Vi,{className:"h-3 w-3"})]})]},h.id))})]}),r.jsxs(ee,{variant:"outline",size:"sm",className:"w-full",onClick:()=>t("/mission-control/contacts?filter=at-risk"),children:["View All At-Risk Contacts",r.jsx(Vi,{className:"h-4 w-4 ml-1"})]})]})]})}const ipt=()=>{var ne,ge;const{user:t,isAdmin:e}=Qr(),n=rs(),[s,a]=I.useState([]),[o,l]=I.useState([]),[i,h]=I.useState([]),[p,x]=I.useState([]),[y,b]=I.useState([]),[j,C]=I.useState([]),[N,A]=I.useState(new Set),[E,T]=I.useState([]),[L,z]=I.useState([]),[F,q]=I.useState([]),[H,Z]=I.useState(!0);I.useEffect(()=>{G()},[t]);const G=async()=>{var ae,he,ue,_e;try{const[Ae,Ce,be,me,Le,Ne,Be,Ee,Ue,Re]=await Promise.all([J.from("user_tags").select("tag").eq("user_id",t==null?void 0:t.id),J.from("app_tiles").select("*").order("name"),J.from("user_favorites").select("app_id").eq("user_id",t==null?void 0:t.id),J.from("events").select("*").order("event_date",{ascending:!0}),J.from("event_registrations").select("event_id, zoom_join_url").eq("user_id",t==null?void 0:t.id),J.from("canva_templates").select("id, name, preview_image_url, publish_date").order("publish_date",{ascending:!1}).limit(4),J.from("resource_kits").select("id, name, description, featured_image_url, publish_date").eq("is_published",!0).order("publish_date",{ascending:!1}).limit(4),J.from("academy_videos").select("id, title, description, thumbnail_url, duration, publish_date").eq("is_published",!0).order("publish_date",{ascending:!1}).limit(4),J.from("additional_services").select("id, name, description, preview_image_url, signup_link_url, publish_date").eq("is_published",!0).order("publish_date",{ascending:!1}).limit(4),J.from("dashboard_banners").select("id, title, description, image_url, link_url, link_text, placement, section_after").eq("is_active",!0).order("sort_order")]),je=((ae=Ae.data)==null?void 0:ae.map(rt=>rt.tag))||[],et=new Set(((he=be.data)==null?void 0:he.map(rt=>rt.app_id))||[]);A(et);const Ze=(((ue=Ce.data)==null?void 0:ue.filter(rt=>!rt.required_tags||rt.required_tags.length===0?!0:rt.required_tags.some(at=>je.includes(at))))||[]).sort((rt,at)=>rt.name==="LevelUp Members Portal"?-1:at.name==="LevelUp Members Portal"?1:0);a(Ze.slice(0,6));const pe=((_e=me.data)==null?void 0:_e.filter(rt=>MS(rt.event_date)!=="ended"))||[];l(pe.slice(0,4)),T(Le.data||[]),h(Ne.data||[]),x(Be.data||[]),b(Ee.data||[]),C(Ue.data||[]);const yt=Re.data||[];z(yt.filter(rt=>rt.placement==="top")),q(yt.filter(rt=>rt.placement==="between"))}catch(Ae){console.error("Error loading dashboard:",Ae),ze.error("Failed to load dashboard data")}finally{Z(!1)}},te=async ae=>{var ue;const he=window.open("about:blank","_blank");try{await J.from("activity_logs").insert({user_id:t==null?void 0:t.id,app_id:ae.app_id,app_name:ae.name,user_agent:navigator.userAgent});const{data:_e,error:Ae}=await J.functions.invoke("sso-launch",{body:{app_id:ae.app_id}});if(Ae)throw Ae;_e!=null&&_e.redirect_url?he&&!he.closed?(he.location.href=_e.redirect_url,(ue=he.focus)==null||ue.call(he)):window.location.assign(_e.redirect_url):(he==null||he.close(),ze.error("Launch link unavailable"))}catch(_e){he==null||he.close(),console.error("Error launching app:",_e),ze.error("Failed to launch app")}},ie=ae=>E==null?void 0:E.some(he=>he.event_id===ae),le=ae=>{const he=E==null?void 0:E.find(ue=>ue.event_id===ae);return he==null?void 0:he.zoom_join_url};if(H)return r.jsx(Lr,{title:"Dashboard",children:r.jsx("div",{className:"flex items-center justify-center py-16",children:r.jsxs("div",{className:"text-center",children:[r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent mx-auto mb-4"}),r.jsx("p",{className:"text-muted-foreground",children:"Loading your dashboard..."})]})})});const ye=ae=>F.filter(he=>he.section_after===ae);return r.jsxs(Lr,{title:"Dashboard",children:[r.jsx(sft,{events:o,registrations:E,onNavigateToEvents:()=>n("/events")}),L.length>0&&r.jsx("div",{className:"mb-8",children:r.jsx(FM,{banners:L})}),r.jsx(pft,{}),r.jsxs("div",{className:"mb-6",children:[r.jsxs("h2",{className:"text-2xl font-bold text-foreground",children:["Welcome back, ",((ge=(ne=t==null?void 0:t.user_metadata)==null?void 0:ne.name)==null?void 0:ge.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(Tft,{}),r.jsx(k8e,{}),r.jsx(Kft,{})]}),r.jsxs("section",{className:"mb-10",children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsx("h3",{className:"text-lg font-semibold text-foreground",children:"Upcoming Events"}),r.jsxs(ee,{variant:"ghost",size:"sm",onClick:()=>n("/events"),className:"gap-1 text-muted-foreground hover:text-foreground",children:["View All ",r.jsx(dl,{className:"h-4 w-4"})]})]}),o.length===0?r.jsx(Ye,{className:"bg-muted/30 border-dashed",children:r.jsx(tt,{className:"flex items-center justify-center py-8",children:r.jsxs("div",{className:"text-center",children:[r.jsx(zs,{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(ae=>{const he=ie(ae.id),ue=le(ae.id)||ae.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 ${fke(ae.event_date)?"bg-red-500/5 border-l-2 border-l-red-500":""}`,onClick:()=>n("/events"),children:[fke(ae.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(_j,{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(ae.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(ae.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:ae.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(ae.event_date))," at ",aE(new Date(ae.event_date))]})]}),r.jsx("div",{className:"hidden sm:flex flex-shrink-0",children:he?r.jsxs(ee,{size:"sm",variant:"default",className:"gap-1",onClick:_e=>{_e.stopPropagation(),window.open(ue,"_blank")},children:[r.jsx(Fs,{className:"h-3.5 w-3.5"}),"Join"]}):r.jsxs("div",{className:"flex items-center gap-1 text-muted-foreground group-hover:text-primary transition-colors",children:[r.jsx("span",{className:"text-sm",children:"Register"}),r.jsx(Vi,{className:"h-4 w-4"})]})})]},ae.id)})})]}),ye("events").length>0&&r.jsx("div",{className:"mb-10",children:r.jsx(FM,{banners:ye("events")})}),r.jsxs("section",{className:"mb-10",children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsx("h3",{className:"text-lg font-semibold text-foreground",children:"Academy Videos"}),r.jsxs(ee,{variant:"ghost",size:"sm",onClick:()=>n("/academy"),className:"gap-1 text-muted-foreground hover:text-foreground",children:["View All ",r.jsx(dl,{className:"h-4 w-4"})]})]}),y.length===0?r.jsx(Ye,{className:"bg-muted/30 border-dashed",children:r.jsx(tt,{className:"flex items-center justify-center py-8",children:r.jsxs("div",{className:"text-center",children:[r.jsx(Bf,{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(ae=>r.jsxs("div",{onClick:()=>n(`/academy/${ae.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:[ae.thumbnail_url?r.jsx("img",{src:ae.thumbnail_url,alt:ae.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(Bf,{className:"h-8 w-8 text-muted-foreground/50"})}),ae.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:ae.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:ae.title})})]},ae.id))})]}),ye("academy").length>0&&r.jsx("div",{className:"mb-10",children:r.jsx(FM,{banners:ye("academy")})}),r.jsxs("section",{className:"mb-10",children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsx("h3",{className:"text-lg font-semibold text-foreground",children:"Resource Kits"}),r.jsxs(ee,{variant:"ghost",size:"sm",onClick:()=>n("/toolbox"),className:"gap-1 text-muted-foreground hover:text-foreground",children:["View All ",r.jsx(dl,{className:"h-4 w-4"})]})]}),p.length===0?r.jsx(Ye,{className:"bg-muted/30 border-dashed",children:r.jsx(tt,{className:"flex items-center justify-center py-8",children:r.jsxs("div",{className:"text-center",children:[r.jsx($x,{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(ae=>r.jsxs("div",{onClick:()=>n(`/toolbox/${ae.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:ae.featured_image_url?r.jsx("img",{src:ae.featured_image_url,alt:ae.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($x,{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:ae.name})})]},ae.id))})]}),ye("toolbox").length>0&&r.jsx("div",{className:"mb-10",children:r.jsx(FM,{banners:ye("toolbox")})}),r.jsxs("section",{className:"mb-10",children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsx("h3",{className:"text-lg font-semibold text-foreground",children:"New Templates"}),r.jsxs(ee,{variant:"ghost",size:"sm",onClick:()=>n("/templates"),className:"gap-1 text-muted-foreground hover:text-foreground",children:["View All ",r.jsx(dl,{className:"h-4 w-4"})]})]}),i.length===0?r.jsx(Ye,{className:"bg-muted/30 border-dashed",children:r.jsx(tt,{className:"flex items-center justify-center py-8",children:r.jsxs("div",{className:"text-center",children:[r.jsx(f1,{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(ae=>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:ae.preview_image_url?r.jsx("img",{src:ae.preview_image_url,alt:ae.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(f1,{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:ae.name})})]},ae.id))})]}),ye("templates").length>0&&r.jsx("div",{className:"mb-10",children:r.jsx(FM,{banners:ye("templates")})}),r.jsx("div",{className:"mb-10",children:r.jsx(Gft,{})}),r.jsxs("section",{children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsx("h3",{className:"text-lg font-semibold text-foreground",children:"Your Apps"}),r.jsxs(ee,{variant:"ghost",size:"sm",onClick:()=>n("/apps"),className:"gap-1 text-muted-foreground hover:text-foreground",children:["View All ",r.jsx(dl,{className:"h-4 w-4"})]})]}),s.length===0?r.jsx(Ye,{className:"bg-muted/30 border-dashed",children:r.jsx(tt,{className:"flex items-center justify-center py-12",children:r.jsxs("div",{className:"text-center",children:[r.jsx(um,{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(ae=>{const he=N.has(ae.id);return r.jsxs("div",{onClick:()=>te(ae),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:ae.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:ae.name}),r.jsx("p",{className:"text-sm text-muted-foreground mt-1 line-clamp-2",children:ae.description})]}),he&&r.jsx(um,{className:"h-5 w-5 text-primary fill-current flex-shrink-0"})]},ae.id)})})]}),r.jsxs("section",{className:"mt-10",children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsx("h3",{className:"text-lg font-semibold text-foreground",children:"Additional Services"}),r.jsxs(ee,{variant:"ghost",size:"sm",onClick:()=>n("/additional-services"),className:"gap-1 text-muted-foreground hover:text-foreground",children:["View All ",r.jsx(dl,{className:"h-4 w-4"})]})]}),j.length===0?r.jsx(Ye,{className:"bg-muted/30 border-dashed",children:r.jsx(tt,{className:"flex items-center justify-center py-8",children:r.jsxs("div",{className:"text-center",children:[r.jsx(Ms,{className:"h-8 w-8 text-muted-foreground/50 mx-auto mb-2"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"No additional services available"})]})})}):r.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:j.map(ae=>r.jsxs("div",{onClick:()=>window.open(ae.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:ae.preview_image_url?r.jsx("img",{src:ae.preview_image_url,alt:ae.name,className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-300"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center",children:r.jsx(Ms,{className:"h-8 w-8 text-muted-foreground/50"})})}),r.jsxs("div",{className:"p-3",children:[r.jsx("h4",{className:"font-medium text-sm text-foreground truncate group-hover:text-primary transition-colors",children:ae.name}),ae.description&&r.jsx("p",{className:"text-xs text-muted-foreground mt-1 line-clamp-2",children:ae.description})]})]},ae.id))})]})]})};var wse="Switch",[opt]=tc(wse),[lpt,cpt]=opt(wse),N8e=I.forwardRef((t,e)=>{const{__scopeSwitch:n,name:s,checked:a,defaultChecked:o,required:l,disabled:i,value:h="on",onCheckedChange:p,form:x,...y}=t,[b,j]=I.useState(null),C=ta(e,L=>j(L)),N=I.useRef(!1),A=b?x||!!b.closest("form"):!0,[E,T]=Fu({prop:a,defaultProp:o??!1,onChange:p,caller:wse});return r.jsxs(lpt,{scope:n,checked:E,disabled:i,children:[r.jsx(Rn.button,{type:"button",role:"switch","aria-checked":E,"aria-required":l,"data-state":T8e(E),"data-disabled":i?"":void 0,disabled:i,value:h,...y,ref:C,onClick:an(t.onClick,L=>{T(z=>!z),A&&(N.current=L.isPropagationStopped(),N.current||L.stopPropagation())})}),A&&r.jsx(M8e,{control:b,bubbles:!N.current,name:s,value:h,checked:E,required:l,disabled:i,form:x,style:{transform:"translateX(-100%)"}})]})});N8e.displayName=wse;var S8e="SwitchThumb",C8e=I.forwardRef((t,e)=>{const{__scopeSwitch:n,...s}=t,a=cpt(S8e,n);return r.jsx(Rn.span,{"data-state":T8e(a.checked),"data-disabled":a.disabled?"":void 0,...s,ref:e})});C8e.displayName=S8e;var dpt="SwitchBubbleInput",M8e=I.forwardRef(({__scopeSwitch:t,control:e,checked:n,bubbles:s=!0,...a},o)=>{const l=I.useRef(null),i=ta(l,o),h=kI(n),p=uI(e);return I.useEffect(()=>{const x=l.current;if(!x)return;const y=window.HTMLInputElement.prototype,j=Object.getOwnPropertyDescriptor(y,"checked").set;if(h!==n&&j){const C=new Event("click",{bubbles:s});j.call(x,n),x.dispatchEvent(C)}},[h,n,s]),r.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...a,tabIndex:-1,ref:i,style:{...a.style,...p,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});M8e.displayName=dpt;function T8e(t){return t?"checked":"unchecked"}var A8e=N8e,upt=C8e;const Ps=I.forwardRef(({className:t,...e},n)=>r.jsx(A8e,{className:$t("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(upt,{className:$t("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})}));Ps.displayName=A8e.displayName;var E8e="AlertDialog",[hpt]=tc(E8e,[i6e]),hy=i6e(),I8e=t=>{const{__scopeAlertDialog:e,...n}=t,s=hy(e);return r.jsx(qne,{...s,...n,modal:!0})};I8e.displayName=E8e;var fpt="AlertDialogTrigger",P8e=I.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...s}=t,a=hy(n);return r.jsx(Ige,{...a,...s,ref:e})});P8e.displayName=fpt;var ppt="AlertDialogPortal",L8e=t=>{const{__scopeAlertDialog:e,...n}=t,s=hy(e);return r.jsx(Vne,{...s,...n})};L8e.displayName=ppt;var mpt="AlertDialogOverlay",O8e=I.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...s}=t,a=hy(n);return r.jsx(i3,{...a,...s,ref:e})});O8e.displayName=mpt;var TS="AlertDialogContent",[gpt,xpt]=hpt(TS),ypt=UTe("AlertDialogContent"),D8e=I.forwardRef((t,e)=>{const{__scopeAlertDialog:n,children:s,...a}=t,o=hy(n),l=I.useRef(null),i=ta(e,l),h=I.useRef(null);return r.jsx(Lat,{contentName:TS,titleName:R8e,docsSlug:"alert-dialog",children:r.jsx(gpt,{scope:n,cancelRef:h,children:r.jsxs(o3,{role:"alertdialog",...o,...a,ref:i,onOpenAutoFocus:an(a.onOpenAutoFocus,p=>{var x;p.preventDefault(),(x=h.current)==null||x.focus({preventScroll:!0})}),onPointerDownOutside:p=>p.preventDefault(),onInteractOutside:p=>p.preventDefault(),children:[r.jsx(ypt,{children:s}),r.jsx(_pt,{contentRef:l})]})})})});D8e.displayName=TS;var R8e="AlertDialogTitle",F8e=I.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...s}=t,a=hy(n);return r.jsx(wI,{...a,...s,ref:e})});F8e.displayName=R8e;var z8e="AlertDialogDescription",B8e=I.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...s}=t,a=hy(n);return r.jsx(jI,{...a,...s,ref:e})});B8e.displayName=z8e;var vpt="AlertDialogAction",$8e=I.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...s}=t,a=hy(n);return r.jsx(Hne,{...a,...s,ref:e})});$8e.displayName=vpt;var U8e="AlertDialogCancel",q8e=I.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...s}=t,{cancelRef:a}=xpt(U8e,n),o=hy(n),l=ta(e,a);return r.jsx(Hne,{...o,...s,ref:l})});q8e.displayName=U8e;var _pt=({contentRef:t})=>{const e=`\`${TS}\` requires a description for the component to be accessible for screen reader users. You can add a description to the \`${TS}\` by passing a \`${z8e}\` 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 \`${TS}\`. 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},bpt=I8e,wpt=P8e,jpt=L8e,V8e=O8e,H8e=D8e,W8e=$8e,G8e=q8e,K8e=F8e,Z8e=B8e;const Iu=bpt,G0=wpt,kpt=jpt,Y8e=I.forwardRef(({className:t,...e},n)=>r.jsx(V8e,{className:$t("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}));Y8e.displayName=V8e.displayName;const tu=I.forwardRef(({className:t,...e},n)=>r.jsxs(kpt,{children:[r.jsx(Y8e,{}),r.jsx(H8e,{ref:n,className:$t("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})]}));tu.displayName=H8e.displayName;const ru=({className:t,...e})=>r.jsx("div",{className:$t("flex flex-col space-y-2 text-center sm:text-left",t),...e});ru.displayName="AlertDialogHeader";const nu=({className:t,...e})=>r.jsx("div",{className:$t("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...e});nu.displayName="AlertDialogFooter";const su=I.forwardRef(({className:t,...e},n)=>r.jsx(K8e,{ref:n,className:$t("text-lg font-semibold",t),...e}));su.displayName=K8e.displayName;const au=I.forwardRef(({className:t,...e},n)=>r.jsx(Z8e,{ref:n,className:$t("text-sm text-muted-foreground",t),...e}));au.displayName=Z8e.displayName;const Ld=I.forwardRef(({className:t,...e},n)=>r.jsx(W8e,{ref:n,className:$t(QA(),t),...e}));Ld.displayName=W8e.displayName;const iu=I.forwardRef(({className:t,...e},n)=>r.jsx(G8e,{ref:n,className:$t(QA({variant:"outline"}),"mt-2 sm:mt-0",t),...e}));iu.displayName=G8e.displayName;const Npt=[{key:"contacts",label:"Contacts",icon:bi,description:"View, add, and edit contacts"},{key:"pipeline",label:"Deal Pipeline",icon:gj,description:"View, add, and move deals"},{key:"videos",label:"Videos",icon:Pa,description:"View and upload videos"},{key:"listings",label:"Listings",icon:pa,description:"View, create, and edit listings"},{key:"scorecard",label:"Scorecard",icon:TT,description:"View and add transactions"},{key:"popbys",label:"Pop-bys",icon:fl,description:"View and log pop-bys"}];function Spt(){var F;const{user:t}=Qr(),[e,n]=I.useState([]),[s,a]=I.useState(!0),[o,l]=I.useState(!1),[i,h]=I.useState(!1),[p,x]=I.useState(null),[y,b]=I.useState({email:"",name:"",password:""}),[j,C]=I.useState(!1),[N,A]=I.useState(null);I.useEffect(()=>{t&&E()},[t]);const E=async()=>{if(t){a(!0);try{const{data:q,error:H}=await J.from("agent_assistant_assignments").select("id, assistant_id, permissions, created_at").eq("agent_id",t.id);if(H)throw H;if(q&&q.length>0){const Z=q.map(ie=>ie.assistant_id),{data:G}=await J.from("profiles").select("id, name, email").in("id",Z),te=q.map(ie=>{const le=G==null?void 0:G.find(ye=>ye.id===ie.assistant_id);return{...ie,permissions:ie.permissions,assistant_profile:le?{name:le.name||"",email:le.email||""}:void 0}});n(te)}else n([])}catch(q){console.error("Error loading assistants:",q)}finally{a(!1)}}},T=async()=>{if(!t||!y.email.trim()||!y.name.trim()||!y.password.trim()){ze.error("Please fill in all fields");return}if(y.password.length<6){ze.error("Password must be at least 6 characters");return}if(e.length>=1){ze.error("You can only have 1 assistant");return}C(!0);try{const{data:{session:q}}=await J.auth.getSession();if(!q)throw new Error("Not authenticated");const H=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/create-user",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${q.access_token}`},body:JSON.stringify({email:y.email.trim(),password:y.password,name:y.name.trim(),purpose:"assistant"})}),Z=await H.json();if(!H.ok)throw new Error(Z.error||"Failed to create assistant account");const G=Z.userId||Z.id;if(!G)throw new Error("No user ID returned");const te=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/manage-user-roles",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${q.access_token}`},body:JSON.stringify({userId:G,role:"assistant",action:"add",agentId:t.id})}),ie=await te.json();if(!te.ok)throw new Error(ie.error||"Failed to assign assistant role");const{error:le}=await J.from("agent_assistant_assignments").insert({agent_id:t.id,assistant_id:G,permissions:{contacts:!0,pipeline:!0,videos:!1,listings:!1,scorecard:!1,popbys:!1}});if(le)throw le;ze.success(`Assistant account created for ${y.name.trim()}`),l(!1),b({email:"",name:"",password:""}),E()}catch(q){console.error("Error adding assistant:",q),ze.error(q.message||"Failed to add assistant")}finally{C(!1)}},L=async()=>{if(!(!p||!t))try{const{data:{session:q}}=await J.auth.getSession();if(!q)throw new Error("Not authenticated");const{error:H}=await J.from("agent_assistant_assignments").delete().eq("id",p.id);if(H)throw H;const{data:Z}=await J.from("agent_assistant_assignments").select("id").eq("assistant_id",p.assistant_id);(!Z||Z.length===0)&&await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/manage-user-roles",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${q.access_token}`},body:JSON.stringify({userId:p.assistant_id,role:"assistant",action:"remove"})}),ze.success("Assistant removed"),h(!1),x(null),E()}catch(q){console.error("Error removing assistant:",q),ze.error(q.message||"Failed to remove assistant")}},z=async(q,H,Z)=>{A(q);try{const G=e.find(le=>le.id===q);if(!G)return;const te={...G.permissions,[H]:Z},{error:ie}=await J.from("agent_assistant_assignments").update({permissions:te}).eq("id",q);if(ie)throw ie;n(le=>le.map(ye=>ye.id===q?{...ye,permissions:te}:ye))}catch(G){console.error("Error updating permissions:",G),ze.error("Failed to update permissions")}finally{A(null)}};return s?r.jsxs(Ye,{children:[r.jsx(Gt,{children:r.jsxs(Zt,{className:"flex items-center gap-2",children:[r.jsx(Bn,{className:"h-5 w-5"}),"My Assistant"]})}),r.jsx(tt,{children:r.jsx("div",{className:"flex items-center justify-center py-4",children:r.jsx(en,{className:"h-6 w-6 animate-spin text-muted-foreground"})})})]}):r.jsxs(r.Fragment,{children:[r.jsxs(Ye,{children:[r.jsx(Gt,{children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsxs(Zt,{className:"flex items-center gap-2",children:[r.jsx(Bn,{className:"h-5 w-5"}),"My Assistant"]}),r.jsx(Mn,{children:"Add an assistant to help manage your Agent OS"})]}),e.length===0&&r.jsxs(ee,{size:"sm",onClick:()=>l(!0),children:[r.jsx(bn,{className:"h-4 w-4 mr-1"}),"Add Assistant"]})]})}),r.jsx(tt,{children:e.length===0?r.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:"No assistant assigned. Add one to help manage your contacts, deals, and more."}):r.jsx("div",{className:"space-y-4",children:e.map(q=>{var H,Z,G,te;return r.jsxs("div",{className:"border rounded-lg p-4 space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(Ks,{className:"h-10 w-10",children:r.jsx(Zs,{children:((Z=(H=q.assistant_profile)==null?void 0:H.name)==null?void 0:Z.split(" ").map(ie=>ie[0]).join("").toUpperCase())||"A"})}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:((G=q.assistant_profile)==null?void 0:G.name)||"Unknown"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:((te=q.assistant_profile)==null?void 0:te.email)||""})]}),r.jsxs(Ot,{variant:"secondary",className:"ml-2",children:[r.jsx(rf,{className:"h-3 w-3 mr-1"}),"Assistant"]})]}),r.jsx(ee,{variant:"ghost",size:"sm",className:"text-destructive hover:text-destructive",onClick:()=>{x(q),h(!0)},children:r.jsx(Vn,{className:"h-4 w-4"})})]}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium mb-3",children:"Permissions"}),r.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:Npt.map(ie=>{const le=ie.icon;return r.jsxs("div",{className:"flex items-center justify-between p-2 rounded-md border",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(le,{className:"h-4 w-4 text-muted-foreground"}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium",children:ie.label}),r.jsx("p",{className:"text-xs text-muted-foreground",children:ie.description})]})]}),r.jsx(Ps,{checked:q.permissions[ie.key]||!1,onCheckedChange:ye=>z(q.id,ie.key,ye),disabled:N===q.id})]},ie.key)})})]})]},q.id)})})})]}),r.jsx(Fr,{open:o,onOpenChange:l,children:r.jsxs(Rr,{children:[r.jsxs(qr,{children:[r.jsx($r,{children:"Add Assistant"}),r.jsx(Xn,{children:"Create an account for your assistant. They'll be able to manage the features you enable below."})]}),r.jsxs("div",{className:"space-y-4 py-2",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"assistant-name",children:"Name"}),r.jsx(dt,{id:"assistant-name",value:y.name,onChange:q=>b({...y,name:q.target.value}),placeholder:"Assistant's full name"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"assistant-email",children:"Email"}),r.jsx(dt,{id:"assistant-email",type:"email",value:y.email,onChange:q=>b({...y,email:q.target.value}),placeholder:"assistant@email.com"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"assistant-password",children:"Temporary Password"}),r.jsx(dt,{id:"assistant-password",type:"password",value:y.password,onChange:q=>b({...y,password:q.target.value}),placeholder:"Min 6 characters"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Your assistant can change this after their first login."})]})]}),r.jsxs(ea,{children:[r.jsx(ee,{variant:"outline",onClick:()=>l(!1),children:"Cancel"}),r.jsxs(ee,{onClick:T,disabled:j,children:[j&&r.jsx(en,{className:"h-4 w-4 mr-2 animate-spin"}),"Create Assistant"]})]})]})}),r.jsx(Iu,{open:i,onOpenChange:h,children:r.jsxs(tu,{children:[r.jsxs(ru,{children:[r.jsx(su,{children:"Remove Assistant?"}),r.jsxs(au,{children:["This will remove ",(F=p==null?void 0:p.assistant_profile)==null?void 0:F.name,"'s access to your Agent OS. Their account will remain active but they won't be able to manage your data."]})]}),r.jsxs(nu,{children:[r.jsx(iu,{children:"Cancel"}),r.jsx(Ld,{onClick:L,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Remove"})]})]})})]})}var Cpt=Object.defineProperty,Mpt=(t,e,n)=>e in t?Cpt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,_l=(t,e,n)=>Mpt(t,typeof e!="symbol"?e+"":e,n);const yte={x:0,y:0,width:0,height:0,unit:"px"},l4=(t,e,n)=>Math.min(Math.max(t,e),n),Tpt=(...t)=>t.filter(e=>e&&typeof e=="string").join(" "),yke=(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 Apt(t,e,n,s){const a=Qm(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==="%"?_0(a,n,s):a}function Ept(t,e,n){const s=Qm(t,e,n);return s.x=(e-s.width)/2,s.y=(n-s.height)/2,t.unit==="%"?_0(s,e,n):s}function _0(t,e,n){return t.unit==="%"?{...yte,...t,unit:"%"}:{unit:"%",x:t.x?t.x/e*100:0,y:t.y?t.y/n*100:0,width:t.width?t.width/e*100:0,height:t.height?t.height/n*100:0}}function Qm(t,e,n){return t.unit?t.unit==="px"?{...yte,...t,unit:"px"}:{unit:"px",x:t.x?t.x*e/100:0,y:t.y?t.y*n/100:0,width:t.width?t.width*e/100:0,height:t.height?t.height*n/100:0}:{...yte,...t,unit:"px"}}function vke(t,e,n,s,a,o=0,l=0,i=s,h=a){const p={...t};let x=Math.min(o,s),y=Math.min(l,a),b=Math.min(i,s),j=Math.min(h,a);e&&(e>1?(x=l?l*e:x,y=x/e,b=i*e):(y=o?o/e:y,x=y*e,j=h/e)),p.y<0&&(p.height=Math.max(p.height+p.y,y),p.y=0),p.x<0&&(p.width=Math.max(p.width+p.x,x),p.x=0);const C=s-(p.x+p.width);C<0&&(p.x=Math.min(p.x,s-x),p.width+=C);const N=a-(p.y+p.height);if(N<0&&(p.y=Math.min(p.y,a-y),p.height+=N),p.widthb&&((n==="sw"||n=="nw")&&(p.x-=b-p.width),p.width=b),p.height>j&&((n==="nw"||n=="ne")&&(p.y-=j-p.height),p.height=j),e){const A=p.width/p.height;if(Ae){const E=Math.max(p.height*e,x);(n==="sw"||n=="nw")&&(p.x-=E-p.width),p.width=E}}return p}function Ipt(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 c4={capture:!0,passive:!1};let Ppt=0;const u0=class qp extends I.PureComponent{constructor(){super(...arguments),_l(this,"docMoveBound",!1),_l(this,"mouseDownOnCrop",!1),_l(this,"dragStarted",!1),_l(this,"evData",{startClientX:0,startClientY:0,startCropX:0,startCropY:0,clientX:0,clientY:0,isResize:!0}),_l(this,"componentRef",I.createRef()),_l(this,"mediaRef",I.createRef()),_l(this,"resizeObserver"),_l(this,"initChangeCalled",!1),_l(this,"instanceId",`rc-${Ppt++}`),_l(this,"state",{cropIsActive:!1,newCropIsBeingDrawn:!1}),_l(this,"onCropPointerDown",e=>{const{crop:n,disabled:s}=this.props,a=this.getBox();if(!n)return;const o=Qm(n,a.width,a.height);if(s)return;e.cancelable&&e.preventDefault(),this.bindDocMove(),this.componentRef.current.focus({preventScroll:!0});const l=e.target.dataset.ord,i=!!l;let h=e.clientX,p=e.clientY,x=o.x,y=o.y;if(l){const b=e.clientX-a.x,j=e.clientY-a.y;let C=0,N=0;l==="ne"||l=="e"?(C=b-(o.x+o.width),N=j-o.y,x=o.x,y=o.y+o.height):l==="se"||l==="s"?(C=b-(o.x+o.width),N=j-(o.y+o.height),x=o.x,y=o.y):l==="sw"||l=="w"?(C=b-o.x,N=j-(o.y+o.height),x=o.x+o.width,y=o.y):(l==="nw"||l=="n")&&(C=b-o.x,N=j-o.y,x=o.x+o.width,y=o.y+o.height),h=x+a.x+C,p=y+a.y+N}this.evData={startClientX:h,startClientY:p,startCropX:x,startCropY:y,clientX:e.clientX,clientY:e.clientY,isResize:i,ord:l},this.mouseDownOnCrop=!0,this.setState({cropIsActive:!0})}),_l(this,"onComponentPointerDown",e=>{const{crop:n,disabled:s,locked:a,keepSelection:o,onChange:l}=this.props,i=this.getBox();if(s||a||o&&n)return;e.cancelable&&e.preventDefault(),this.bindDocMove(),this.componentRef.current.focus({preventScroll:!0});const h=e.clientX-i.x,p=e.clientY-i.y,x={unit:"px",x:h,y:p,width:0,height:0};this.evData={startClientX:e.clientX,startClientY:e.clientY,startCropX:h,startCropY:p,clientX:e.clientX,clientY:e.clientY,isResize:!0},this.mouseDownOnCrop=!0,l(Qm(x,i.width,i.height),_0(x,i.width,i.height)),this.setState({cropIsActive:!0,newCropIsBeingDrawn:!0})}),_l(this,"onDocPointerMove",e=>{const{crop:n,disabled:s,onChange:a,onDragStart:o}=this.props,l=this.getBox();if(s||!n||!this.mouseDownOnCrop)return;e.cancelable&&e.preventDefault(),this.dragStarted||(this.dragStarted=!0,o&&o(e));const{evData:i}=this;i.clientX=e.clientX,i.clientY=e.clientY;let h;i.isResize?h=this.resizeCrop():h=this.dragCrop(),yke(n,h)||a(Qm(h,l.width,l.height),_0(h,l.width,l.height))}),_l(this,"onComponentKeyDown",e=>{const{crop:n,disabled:s,onChange:a,onComplete:o}=this.props;if(s)return;const l=e.key;let i=!1;if(!n)return;const h=this.getBox(),p=this.makePixelCrop(h),x=(navigator.platform.match("Mac")?e.metaKey:e.ctrlKey)?qp.nudgeStepLarge:e.shiftKey?qp.nudgeStepMedium:qp.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=l4(p.x,0,h.width-p.width),p.y=l4(p.y,0,h.height-p.height);const y=Qm(p,h.width,h.height),b=_0(p,h.width,h.height);a(y,b),o&&o(y,b)}}),_l(this,"onHandlerKeyDown",(e,n)=>{const{aspect:s=0,crop:a,disabled:o,minWidth:l=0,minHeight:i=0,maxWidth:h,maxHeight:p,onChange:x,onComplete:y}=this.props,b=this.getBox();if(o||!a)return;if(e.key==="ArrowUp"||e.key==="ArrowDown"||e.key==="ArrowLeft"||e.key==="ArrowRight")e.stopPropagation(),e.preventDefault();else return;const j=(navigator.platform.match("Mac")?e.metaKey:e.ctrlKey)?qp.nudgeStepLarge:e.shiftKey?qp.nudgeStepMedium:qp.nudgeStep,C=Qm(a,b.width,b.height),N=Ipt(C,e.key,j,n),A=vke(N,s,n,b.width,b.height,l,i,h,p);if(!yke(a,A)){const E=_0(A,b.width,b.height);x(A,E),y&&y(A,E)}}),_l(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(Qm(n,l.width,l.height),_0(n,l.width,l.height)),this.setState({cropIsActive:!1,newCropIsBeingDrawn:!1}))}),_l(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(Qm(n,a,o),_0(n,a,o))}}componentWillUnmount(){this.resizeObserver&&this.resizeObserver.disconnect(),this.unbindDocMove()}bindDocMove(){this.docMoveBound||(this.document.addEventListener("pointermove",this.onDocPointerMove,c4),this.document.addEventListener("pointerup",this.onDocPointerDone,c4),this.document.addEventListener("pointercancel",this.onDocPointerDone,c4),this.docMoveBound=!0)}unbindDocMove(){this.docMoveBound&&(this.document.removeEventListener("pointermove",this.onDocPointerMove,c4),this.document.removeEventListener("pointerup",this.onDocPointerDone,c4),this.document.removeEventListener("pointercancel",this.onDocPointerDone,c4),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=l4(e.startCropX+a,0,n.width-s.width),s.y=l4(e.startCropY+o,0,n.height-s.height),s}getPointRegion(e,n,s,a){const{evData:o}=this,l=o.clientX-e.x,i=o.clientY-e.y;let h;a&&n?h=n==="nw"||n==="n"||n==="ne":h=i1?o?[o,o/n]:[l*n,l]:l?[l*n,l]:[o,o/n]}resizeCrop(){const{evData:e}=this,{aspect:n=0,maxWidth:s,maxHeight:a}=this.props,o=this.getBox(),[l,i]=this.resolveMinDimensions(o,n,this.props.minWidth,this.props.minHeight);let h=this.makePixelCrop(o);const p=this.getPointRegion(o,e.ord,l,i),x=e.ord||p;let y=e.clientX-e.startClientX,b=e.clientY-e.startClientY;(l&&x==="nw"||x==="w"||x==="sw")&&(y=Math.min(y,-l)),(i&&x==="nw"||x==="n"||x==="ne")&&(b=Math.min(b,-i));const j={unit:"px",x:0,y:0,width:0,height:0};p==="ne"?(j.x=e.startCropX,j.width=y,n?(j.height=j.width/n,j.y=e.startCropY-j.height):(j.height=Math.abs(b),j.y=e.startCropY-j.height)):p==="se"?(j.x=e.startCropX,j.y=e.startCropY,j.width=y,n?j.height=j.width/n:j.height=b):p==="sw"?(j.x=e.startCropX+y,j.y=e.startCropY,j.width=Math.abs(y),n?j.height=j.width/n:j.height=b):p==="nw"&&(j.x=e.startCropX+y,j.width=Math.abs(y),n?(j.height=j.width/n,j.y=e.startCropY-j.height):(j.height=Math.abs(b),j.y=e.startCropY+b));const C=vke(j,n,p,o.width,o.height,l,i,s,a);return n||qp.xyOrds.indexOf(x)>-1?h=C:qp.xOrds.indexOf(x)>-1?(h.x=C.x,h.width=C.width):qp.yOrds.indexOf(x)>-1&&(h.y=C.y,h.height=C.height),h.x=l4(h.x,0,o.width-h.width),h.y=l4(h.y,0,o.height-h.height),h}renderCropSelection(){const{ariaLabels:e=qp.defaultProps.ariaLabels,disabled:n,locked:s,renderSelectionAddon:a,ruleOfThirds:o,crop:l}=this.props,i=this.getCropStyle();if(l)return st.createElement("div",{style:i,className:"ReactCrop__crop-selection",onPointerDown:this.onCropPointerDown,"aria-label":e.cropArea,tabIndex:0,onKeyDown:this.onComponentKeyDown,role:"group"},!n&&!s&&st.createElement("div",{className:"ReactCrop__drag-elements",onFocus:this.onDragFocus},st.createElement("div",{className:"ReactCrop__drag-bar ord-n","data-ord":"n"}),st.createElement("div",{className:"ReactCrop__drag-bar ord-e","data-ord":"e"}),st.createElement("div",{className:"ReactCrop__drag-bar ord-s","data-ord":"s"}),st.createElement("div",{className:"ReactCrop__drag-bar ord-w","data-ord":"w"}),st.createElement("div",{className:"ReactCrop__drag-handle ord-nw","data-ord":"nw",tabIndex:0,"aria-label":e.nwDragHandle,onKeyDown:h=>this.onHandlerKeyDown(h,"nw"),role:"button"}),st.createElement("div",{className:"ReactCrop__drag-handle ord-n","data-ord":"n",tabIndex:0,"aria-label":e.nDragHandle,onKeyDown:h=>this.onHandlerKeyDown(h,"n"),role:"button"}),st.createElement("div",{className:"ReactCrop__drag-handle ord-ne","data-ord":"ne",tabIndex:0,"aria-label":e.neDragHandle,onKeyDown:h=>this.onHandlerKeyDown(h,"ne"),role:"button"}),st.createElement("div",{className:"ReactCrop__drag-handle ord-e","data-ord":"e",tabIndex:0,"aria-label":e.eDragHandle,onKeyDown:h=>this.onHandlerKeyDown(h,"e"),role:"button"}),st.createElement("div",{className:"ReactCrop__drag-handle ord-se","data-ord":"se",tabIndex:0,"aria-label":e.seDragHandle,onKeyDown:h=>this.onHandlerKeyDown(h,"se"),role:"button"}),st.createElement("div",{className:"ReactCrop__drag-handle ord-s","data-ord":"s",tabIndex:0,"aria-label":e.sDragHandle,onKeyDown:h=>this.onHandlerKeyDown(h,"s"),role:"button"}),st.createElement("div",{className:"ReactCrop__drag-handle ord-sw","data-ord":"sw",tabIndex:0,"aria-label":e.swDragHandle,onKeyDown:h=>this.onHandlerKeyDown(h,"sw"),role:"button"}),st.createElement("div",{className:"ReactCrop__drag-handle ord-w","data-ord":"w",tabIndex:0,"aria-label":e.wDragHandle,onKeyDown:h=>this.onHandlerKeyDown(h,"w"),role:"button"})),a&&st.createElement("div",{className:"ReactCrop__selection-addon",onPointerDown:h=>h.stopPropagation()},a(this.state)),o&&st.createElement(st.Fragment,null,st.createElement("div",{className:"ReactCrop__rule-of-thirds-hz"}),st.createElement("div",{className:"ReactCrop__rule-of-thirds-vt"})))}makePixelCrop(e){const n={...yte,...this.props.crop||{}};return Qm(n,e.width,e.height)}render(){const{aspect:e,children:n,circularCrop:s,className:a,crop:o,disabled:l,locked:i,style:h,ruleOfThirds:p}=this.props,{cropIsActive:x,newCropIsBeingDrawn:y}=this.state,b=o?this.renderCropSelection():null,j=Tpt("ReactCrop",a,x&&"ReactCrop--active",l&&"ReactCrop--disabled",i&&"ReactCrop--locked",y&&"ReactCrop--new-crop",o&&e&&"ReactCrop--fixed-aspect",o&&s&&"ReactCrop--circular-crop",o&&p&&"ReactCrop--rule-of-thirds",!this.dragStarted&&o&&!o.width&&!o.height&&"ReactCrop--invisible-crop",s&&"ReactCrop--no-animate");return st.createElement("div",{ref:this.componentRef,className:j,style:h},st.createElement("div",{ref:this.mediaRef,className:"ReactCrop__child-wrapper",onPointerDown:this.onComponentPointerDown},n),o?st.createElement("svg",{className:"ReactCrop__crop-mask",width:"100%",height:"100%"},st.createElement("defs",null,st.createElement("mask",{id:`hole-${this.instanceId}`},st.createElement("rect",{width:"100%",height:"100%",fill:"white"}),s?st.createElement("ellipse",{cx:`${o.x+o.width/2}${o.unit}`,cy:`${o.y+o.height/2}${o.unit}`,rx:`${o.width/2}${o.unit}`,ry:`${o.height/2}${o.unit}`,fill:"black"}):st.createElement("rect",{x:`${o.x}${o.unit}`,y:`${o.y}${o.unit}`,width:`${o.width}${o.unit}`,height:`${o.height}${o.unit}`,fill:"black"}))),st.createElement("rect",{fill:"black",fillOpacity:.5,width:"100%",height:"100%",mask:`url(#hole-${this.instanceId})`})):void 0,b)}};_l(u0,"xOrds",["e","w"]),_l(u0,"yOrds",["n","s"]),_l(u0,"xyOrds",["nw","ne","se","sw"]),_l(u0,"nudgeStep",1),_l(u0,"nudgeStepMedium",10),_l(u0,"nudgeStepLarge",100),_l(u0,"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 Lpt=u0;var X8e=["PageUp","PageDown"],Q8e=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],J8e={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},d3="Slider",[khe,Opt,Dpt]=lI(d3),[eDe]=tc(d3,[Dpt]),[Rpt,jse]=eDe(d3),tDe=I.forwardRef((t,e)=>{const{name:n,min:s=0,max:a=100,step:o=1,orientation:l="horizontal",disabled:i=!1,minStepsBetweenThumbs:h=0,defaultValue:p=[s],value:x,onValueChange:y=()=>{},onValueCommit:b=()=>{},inverted:j=!1,form:C,...N}=t,A=I.useRef(new Set),E=I.useRef(0),L=l==="horizontal"?Fpt:zpt,[z=[],F]=Fu({prop:x,defaultProp:p,onChange:ie=>{var ye;(ye=[...A.current][E.current])==null||ye.focus(),y(ie)}}),q=I.useRef(z);function H(ie){const le=Vpt(z,ie);te(ie,le)}function Z(ie){te(ie,E.current)}function G(){const ie=q.current[E.current];z[E.current]!==ie&&b(z)}function te(ie,le,{commit:ye}={commit:!1}){const ne=Kpt(o),ge=Zpt(Math.round((ie-s)/o)*o+s,ne),ae=rE(ge,[s,a]);F((he=[])=>{const ue=Upt(he,ae,le);if(Gpt(ue,h*o)){E.current=ue.indexOf(ae);const _e=String(ue)!==String(he);return _e&&ye&&b(ue),_e?ue:he}else return he})}return r.jsx(Rpt,{scope:t.__scopeSlider,name:n,disabled:i,min:s,max:a,valueIndexToChangeRef:E,thumbs:A.current,values:z,orientation:l,form:C,children:r.jsx(khe.Provider,{scope:t.__scopeSlider,children:r.jsx(khe.Slot,{scope:t.__scopeSlider,children:r.jsx(L,{"aria-disabled":i,"data-disabled":i?"":void 0,...N,ref:e,onPointerDown:an(N.onPointerDown,()=>{i||(q.current=z)}),min:s,max:a,inverted:j,onSlideStart:i?void 0:H,onSlideMove:i?void 0:Z,onSlideEnd:i?void 0:G,onHomeKeyDown:()=>!i&&te(s,0,{commit:!0}),onEndKeyDown:()=>!i&&te(a,z.length-1,{commit:!0}),onStepKeyDown:({event:ie,direction:le})=>{if(!i){const ge=X8e.includes(ie.key)||ie.shiftKey&&Q8e.includes(ie.key)?10:1,ae=E.current,he=z[ae],ue=o*ge*le;te(he+ue,ae,{commit:!0})}}})})})})});tDe.displayName=d3;var[rDe,nDe]=eDe(d3,{startEdge:"left",endEdge:"right",size:"width",direction:1}),Fpt=I.forwardRef((t,e)=>{const{min:n,max:s,dir:a,inverted:o,onSlideStart:l,onSlideMove:i,onSlideEnd:h,onStepKeyDown:p,...x}=t,[y,b]=I.useState(null),j=ta(e,L=>b(L)),C=I.useRef(void 0),N=ik(a),A=N==="ltr",E=A&&!o||!A&&o;function T(L){const z=C.current||y.getBoundingClientRect(),F=[0,z.width],H=bxe(F,E?[n,s]:[s,n]);return C.current=z,H(L-z.left)}return r.jsx(rDe,{scope:t.__scopeSlider,startEdge:E?"left":"right",endEdge:E?"right":"left",direction:E?1:-1,size:"width",children:r.jsx(sDe,{dir:N,"data-orientation":"horizontal",...x,ref:j,style:{...x.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:L=>{const z=T(L.clientX);l==null||l(z)},onSlideMove:L=>{const z=T(L.clientX);i==null||i(z)},onSlideEnd:()=>{C.current=void 0,h==null||h()},onStepKeyDown:L=>{const F=J8e[E?"from-left":"from-right"].includes(L.key);p==null||p({event:L,direction:F?-1:1})}})})}),zpt=I.forwardRef((t,e)=>{const{min:n,max:s,inverted:a,onSlideStart:o,onSlideMove:l,onSlideEnd:i,onStepKeyDown:h,...p}=t,x=I.useRef(null),y=ta(e,x),b=I.useRef(void 0),j=!a;function C(N){const A=b.current||x.current.getBoundingClientRect(),E=[0,A.height],L=bxe(E,j?[s,n]:[n,s]);return b.current=A,L(N-A.top)}return r.jsx(rDe,{scope:t.__scopeSlider,startEdge:j?"bottom":"top",endEdge:j?"top":"bottom",size:"height",direction:j?1:-1,children:r.jsx(sDe,{"data-orientation":"vertical",...p,ref:y,style:{...p.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:N=>{const A=C(N.clientY);o==null||o(A)},onSlideMove:N=>{const A=C(N.clientY);l==null||l(A)},onSlideEnd:()=>{b.current=void 0,i==null||i()},onStepKeyDown:N=>{const E=J8e[j?"from-bottom":"from-top"].includes(N.key);h==null||h({event:N,direction:E?-1:1})}})})}),sDe=I.forwardRef((t,e)=>{const{__scopeSlider:n,onSlideStart:s,onSlideMove:a,onSlideEnd:o,onHomeKeyDown:l,onEndKeyDown:i,onStepKeyDown:h,...p}=t,x=jse(d3,n);return r.jsx(Rn.span,{...p,ref:e,onKeyDown:an(t.onKeyDown,y=>{y.key==="Home"?(l(y),y.preventDefault()):y.key==="End"?(i(y),y.preventDefault()):X8e.concat(Q8e).includes(y.key)&&(h(y),y.preventDefault())}),onPointerDown:an(t.onPointerDown,y=>{const b=y.target;b.setPointerCapture(y.pointerId),y.preventDefault(),x.thumbs.has(b)?b.focus():s(y)}),onPointerMove:an(t.onPointerMove,y=>{y.target.hasPointerCapture(y.pointerId)&&a(y)}),onPointerUp:an(t.onPointerUp,y=>{const b=y.target;b.hasPointerCapture(y.pointerId)&&(b.releasePointerCapture(y.pointerId),o(y))})})}),aDe="SliderTrack",iDe=I.forwardRef((t,e)=>{const{__scopeSlider:n,...s}=t,a=jse(aDe,n);return r.jsx(Rn.span,{"data-disabled":a.disabled?"":void 0,"data-orientation":a.orientation,...s,ref:e})});iDe.displayName=aDe;var Nhe="SliderRange",oDe=I.forwardRef((t,e)=>{const{__scopeSlider:n,...s}=t,a=jse(Nhe,n),o=nDe(Nhe,n),l=I.useRef(null),i=ta(e,l),h=a.values.length,p=a.values.map(b=>dDe(b,a.min,a.max)),x=h>1?Math.min(...p):0,y=100-Math.max(...p);return r.jsx(Rn.span,{"data-orientation":a.orientation,"data-disabled":a.disabled?"":void 0,...s,ref:i,style:{...t.style,[o.startEdge]:x+"%",[o.endEdge]:y+"%"}})});oDe.displayName=Nhe;var She="SliderThumb",lDe=I.forwardRef((t,e)=>{const n=Opt(t.__scopeSlider),[s,a]=I.useState(null),o=ta(e,i=>a(i)),l=I.useMemo(()=>s?n().findIndex(i=>i.ref.current===s):-1,[n,s]);return r.jsx(Bpt,{...t,ref:o,index:l})}),Bpt=I.forwardRef((t,e)=>{const{__scopeSlider:n,index:s,name:a,...o}=t,l=jse(She,n),i=nDe(She,n),[h,p]=I.useState(null),x=ta(e,T=>p(T)),y=h?l.form||!!h.closest("form"):!0,b=uI(h),j=l.values[s],C=j===void 0?0:dDe(j,l.min,l.max),N=qpt(s,l.values.length),A=b==null?void 0:b[i.size],E=A?Hpt(A,C,i.direction):0;return I.useEffect(()=>{if(h)return l.thumbs.add(h),()=>{l.thumbs.delete(h)}},[h,l.thumbs]),r.jsxs("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[i.startEdge]:`calc(${C}% + ${E}px)`},children:[r.jsx(khe.ItemSlot,{scope:t.__scopeSlider,children:r.jsx(Rn.span,{role:"slider","aria-label":t["aria-label"]||N,"aria-valuemin":l.min,"aria-valuenow":j,"aria-valuemax":l.max,"aria-orientation":l.orientation,"data-orientation":l.orientation,"data-disabled":l.disabled?"":void 0,tabIndex:l.disabled?void 0:0,...o,ref:x,style:j===void 0?{display:"none"}:t.style,onFocus:an(t.onFocus,()=>{l.valueIndexToChangeRef.current=s})})}),y&&r.jsx(cDe,{name:a??(l.name?l.name+(l.values.length>1?"[]":""):void 0),form:l.form,value:j},s)]})});lDe.displayName=She;var $pt="RadioBubbleInput",cDe=I.forwardRef(({__scopeSlider:t,value:e,...n},s)=>{const a=I.useRef(null),o=ta(a,s),l=kI(e);return I.useEffect(()=>{const i=a.current;if(!i)return;const h=window.HTMLInputElement.prototype,x=Object.getOwnPropertyDescriptor(h,"value").set;if(l!==e&&x){const y=new Event("input",{bubbles:!0});x.call(i,e),i.dispatchEvent(y)}},[l,e]),r.jsx(Rn.input,{style:{display:"none"},...n,ref:o,defaultValue:e})});cDe.displayName=$pt;function Upt(t=[],e,n){const s=[...t];return s[n]=e,s.sort((a,o)=>a-o)}function dDe(t,e,n){const o=100/(n-e)*(t-e);return rE(o,[0,100])}function qpt(t,e){return e>2?`Value ${t+1} of ${e}`:e===2?["Minimum","Maximum"][t]:void 0}function Vpt(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 Hpt(t,e,n){const s=t/2,o=bxe([0,50],[0,s]);return(s-o(e)*n)*n}function Wpt(t){return t.slice(0,-1).map((e,n)=>t[n+1]-e)}function Gpt(t,e){if(e>0){const n=Wpt(t);return Math.min(...n)>=e}return!0}function bxe(t,e){return n=>{if(t[0]===t[1]||e[0]===e[1])return e[0];const s=(e[1]-e[0])/(t[1]-t[0]);return e[0]+s*(n-t[0])}}function Kpt(t){return(String(t).split(".")[1]||"").length}function Zpt(t,e){const n=Math.pow(10,e);return Math.round(t*n)/n}var uDe=tDe,Ypt=iDe,Xpt=oDe,Qpt=lDe;const lm=I.forwardRef(({className:t,...e},n)=>r.jsxs(uDe,{ref:n,className:$t("relative flex w-full touch-none select-none items-center",t),...e,children:[r.jsx(Ypt,{className:"relative h-2 w-full grow overflow-hidden rounded-full bg-secondary",children:r.jsx(Xpt,{className:"absolute h-full bg-primary"})}),r.jsx(Qpt,{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"})]}));lm.displayName=uDe.displayName;function Jpt(t,e,n){return Ept(Apt({unit:"%",width:90},n,t,e),t,e)}const wxe=({open:t,onClose:e,imageSrc:n,onCropComplete:s,aspectRatio:a=1})=>{const o=I.useRef(null),[l,i]=I.useState(),[h,p]=I.useState(),[x,y]=I.useState(1),[b,j]=I.useState(0),C=I.useCallback(E=>{const{width:T,height:L}=E.currentTarget;i(Jpt(T,L,a))},[a]),N=I.useCallback(async()=>{const E=o.current;if(!E||!h)return;const T=document.createElement("canvas"),L=T.getContext("2d");if(!L)return;const z=E.naturalWidth/E.width,F=E.naturalHeight/E.height,q=400;T.width=q,T.height=q,L.imageSmoothingQuality="high";const H=h.x*z,Z=h.y*F,G=h.width*z,te=h.height*F,ie=b*Math.PI/180,le=T.width/2,ye=T.height/2;return L.save(),L.translate(le,ye),L.rotate(ie),L.scale(x,x),L.translate(-le,-ye),L.drawImage(E,H,Z,G,te,0,0,q,q),L.restore(),new Promise((ne,ge)=>{T.toBlob(ae=>{ae?ne(ae):ge(new Error("Canvas is empty"))},"image/jpeg",.95)})},[h,x,b]),A=async()=>{try{const E=await N();E&&(s(E),e())}catch(E){console.error("Error cropping image:",E)}};return r.jsx(Fr,{open:t,onOpenChange:e,children:r.jsxs(Rr,{className:"max-w-lg",children:[r.jsx(qr,{children:r.jsx($r,{children:"Crop Your Photo"})}),r.jsxs("div",{className:"space-y-4",children:[r.jsx("div",{className:"relative max-h-[400px] overflow-hidden rounded-lg bg-muted flex items-center justify-center",children:r.jsx(Lpt,{crop:l,onChange:(E,T)=>i(T),onComplete:E=>p(E),aspect:a,circularCrop:!0,className:"max-h-[400px]",children:r.jsx("img",{ref:o,src:n,alt:"Crop preview",style:{transform:`scale(${x}) rotate(${b}deg)`,maxHeight:"400px",width:"auto"},onLoad:C})})}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(xS,{className:"h-4 w-4 text-muted-foreground"}),r.jsx(lm,{value:[x],min:.5,max:3,step:.1,onValueChange:([E])=>y(E),className:"flex-1"}),r.jsx(gS,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(HT,{className:"h-4 w-4 text-muted-foreground"}),r.jsx(lm,{value:[b],min:-180,max:180,step:1,onValueChange:([E])=>j(E),className:"flex-1"}),r.jsxs("span",{className:"text-sm text-muted-foreground w-12",children:[b,"°"]})]})]})]}),r.jsxs(ea,{children:[r.jsx(ee,{variant:"outline",onClick:e,children:"Cancel"}),r.jsx(ee,{onClick:A,children:"Save Photo"})]})]})})},emt=()=>{const{user:t}=Qr(),{toast:e}=fi(),[n,s]=I.useState(!1),[a,o]=I.useState(!1),[l,i]=I.useState(null);I.useEffect(()=>{t&&h()},[t]);const h=async()=>{s(!0);try{const{data:y}=await J.from("profiles").select("subscription_status, subscription_product_id, subscription_end_date, is_grandfathered").eq("id",t==null?void 0:t.id).single();y&&i({status:y.subscription_status||"none",productId:y.subscription_product_id,endDate:y.subscription_end_date,isGrandfathered:y.is_grandfathered||!1})}catch(y){console.error("Error loading subscription:",y)}finally{s(!1)}},p=async()=>{o(!0);try{const{data:{session:y}}=await J.auth.getSession();if(!y)throw new Error("Not authenticated");const{data:b,error:j}=await J.functions.invoke("customer-portal",{headers:{Authorization:`Bearer ${y.access_token}`}});if(j)throw j;b!=null&&b.url&&window.open(b.url,"_blank")}catch(y){console.error("Error opening customer portal:",y),e({title:"Error",description:y.message||"Failed to open billing portal",variant:"destructive"})}finally{o(!1)}},x=()=>{if(l!=null&&l.isGrandfathered)return r.jsx(Ot,{className:"bg-amber-500",children:"Grandfathered"});switch(l==null?void 0:l.status){case"active":return r.jsx(Ot,{className:"bg-green-500",children:"Active"});case"trialing":return r.jsx(Ot,{className:"bg-blue-500",children:"Trial"});case"past_due":return r.jsx(Ot,{variant:"destructive",children:"Past Due"});case"canceled":return r.jsx(Ot,{variant:"secondary",children:"Canceled"});default:return r.jsx(Ot,{variant:"outline",children:"No Subscription"})}};return n?r.jsxs(Ye,{children:[r.jsx(Gt,{children:r.jsxs(Zt,{className:"flex items-center gap-2",children:[r.jsx(fm,{className:"h-5 w-5"}),"Subscription"]})}),r.jsx(tt,{children:r.jsx("div",{className:"flex items-center justify-center py-4",children:r.jsx(en,{className:"h-6 w-6 animate-spin text-muted-foreground"})})})]}):r.jsxs(Ye,{children:[r.jsxs(Gt,{children:[r.jsxs(Zt,{className:"flex items-center gap-2",children:[r.jsx(fm,{className:"h-5 w-5"}),"Subscription"]}),r.jsx(Mn,{children:"Manage your subscription and billing"})]}),r.jsxs(tt,{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:"Status"}),r.jsx("div",{className:"mt-1",children:x()})]}),(l==null?void 0:l.endDate)&&l.status==="active"&&r.jsxs("div",{className:"text-right",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Next billing date"}),r.jsx("p",{className:"font-medium",children:new Date(l.endDate).toLocaleDateString()})]})]}),l!=null&&l.isGrandfathered?r.jsx("p",{className:"text-sm text-muted-foreground",children:"Your account was upgraded from LevelUp 1.0. To update/manage your subscription please reach out to support."}):(l==null?void 0:l.status)==="active"||(l==null?void 0:l.status)==="trialing"?r.jsxs(r.Fragment,{children:[(l==null?void 0:l.status)==="trialing"&&(l==null?void 0:l.endDate)&&r.jsxs("p",{className:"text-sm text-muted-foreground mb-3",children:["Your trial ends on ",new Date(l.endDate).toLocaleDateString(),". After the trial, you'll be charged automatically."]}),r.jsxs(ee,{onClick:p,variant:"outline",disabled:a,children:[a?r.jsx(en,{className:"mr-2 h-4 w-4 animate-spin"}):r.jsx(Fs,{className:"mr-2 h-4 w-4"}),"Manage Billing"]})]}):r.jsx("p",{className:"text-sm text-muted-foreground",children:"You don't have an active subscription."})]})]})},tmt=()=>{const{user:t}=Qr(),e=rs(),{toast:n}=fi(),[s]=$d(),a=s.get("setup")==="true",o=s.get("reset")==="true",{isSupported:l,isSubscribed:i,isLoading:h,subscribe:p,unsubscribe:x}=KOe(),[y,b]=I.useState(!1),[j,C]=I.useState(""),[N,A]=I.useState(!1),[E,T]=I.useState(!1),[L,z]=I.useState(""),[F,q]=I.useState({name:"",email:"",title:"",bio:"",areas_served:"",years_experience:"",instagram_url:"",facebook_url:"",linkedin_url:""}),[H,Z]=I.useState(!1),[G,te]=I.useState(!1),[ie,le]=I.useState({newPassword:"",confirmPassword:""});I.useEffect(()=>{t&&ye()},[t]),I.useEffect(()=>{o&&t&&setTimeout(()=>{var ue;(ue=document.getElementById("change-password-section"))==null||ue.scrollIntoView({behavior:"smooth",block:"center"})},500)},[o,t]);const ye=async()=>{var ue,_e,Ae;if(!(t!=null&&t.id)){console.log("No user ID available yet");return}try{console.log("Loading profile for user:",t.id);const{data:Ce,error:be}=await J.from("profiles").select("name, email, digest_opt_out, title, bio, areas_served, years_experience, instagram_url, facebook_url, linkedin_url").eq("id",t.id).maybeSingle();if(be)throw console.error("Profile query error:",be),be;Ce?(console.log("Profile loaded successfully:",Ce),q({name:Ce.name||"",email:Ce.email||"",title:Ce.title||"",bio:Ce.bio||"",areas_served:Ce.areas_served||"",years_experience:((ue=Ce.years_experience)==null?void 0:ue.toString())||"",instagram_url:Ce.instagram_url||"",facebook_url:Ce.facebook_url||"",linkedin_url:Ce.linkedin_url||""}),Z(Ce.digest_opt_out||!1)):(console.warn("No profile found for user"),q({name:((_e=t.user_metadata)==null?void 0:_e.name)||((Ae=t.email)==null?void 0:Ae.split("@")[0])||"",email:t.email||"",title:"",bio:"",areas_served:"",years_experience:"",instagram_url:"",facebook_url:"",linkedin_url:""}));const{data:me}=await J.storage.from("avatars").list(`${t.id}`);if(me&&me.length>0){const{data:Le}=J.storage.from("avatars").getPublicUrl(`${t.id}/${me[0].name}`);C(Le.publicUrl)}}catch(Ce){console.error("Error loading profile:",Ce),n({title:"Error",description:Ce.message||"Failed to load profile",variant:"destructive"})}},ne=ue=>{var Ce;const _e=(Ce=ue.target.files)==null?void 0:Ce[0];if(!_e)return;const Ae=new FileReader;Ae.onloadend=()=>{z(Ae.result),T(!0)},Ae.readAsDataURL(_e),ue.target.value=""},ge=async ue=>{if(t){A(!0);try{const{data:_e}=await J.storage.from("avatars").list(`${t.id}`);_e&&_e.length>0&&await J.storage.from("avatars").remove(_e.map(Le=>`${t.id}/${Le.name}`));const Ce=`${t.id}/avatar.jpg`,{error:be}=await J.storage.from("avatars").upload(Ce,ue,{upsert:!0,contentType:"image/jpeg"});if(be)throw be;const{data:me}=J.storage.from("avatars").getPublicUrl(Ce);C(`${me.publicUrl}?t=${Date.now()}`),n({title:"Success",description:"Profile photo updated successfully"})}catch(_e){console.error("Error uploading avatar:",_e),n({title:"Error",description:_e.message||"Failed to upload photo",variant:"destructive"})}finally{A(!1)}}},ae=async()=>{if(!F.name.trim()||!F.email.trim()){n({title:"Error",description:"Name and email are required",variant:"destructive"});return}b(!0);try{const{error:ue}=await J.from("profiles").update({name:F.name.trim(),email:F.email.trim(),title:F.title.trim()||null,bio:F.bio.trim()||null,areas_served:F.areas_served.trim()||null,years_experience:F.years_experience?parseInt(F.years_experience):null,instagram_url:F.instagram_url.trim()||null,facebook_url:F.facebook_url.trim()||null,linkedin_url:F.linkedin_url.trim()||null}).eq("id",t==null?void 0:t.id);if(ue)throw ue;n({title:"Success",description:"Profile updated successfully"})}catch(ue){console.error("Error updating profile:",ue),n({title:"Error",description:ue.message||"Failed to update profile",variant:"destructive"})}finally{b(!1)}},he=async()=>{if(!ie.newPassword){n({title:"Error",description:"Please enter a new password",variant:"destructive"});return}if(ie.newPassword.length<6){n({title:"Error",description:"Password must be at least 6 characters",variant:"destructive"});return}if(ie.newPassword!==ie.confirmPassword){n({title:"Error",description:"Passwords do not match",variant:"destructive"});return}b(!0);try{const{error:ue}=await J.auth.updateUser({password:ie.newPassword});if(ue)throw ue;n({title:"Success",description:"Password updated successfully"}),le({newPassword:"",confirmPassword:""}),a&&setTimeout(()=>e("/dashboard"),1e3)}catch(ue){console.error("Error updating password:",ue),n({title:"Error",description:ue.message||"Failed to update password",variant:"destructive"})}finally{b(!1)}};return r.jsx(Lr,{title:a?"Complete Your Profile":o?"Reset Your Password":"Profile Settings",description:a?"Welcome! Please complete your profile setup":o?"Please set a new password for your account":"Manage your account information and password",children:r.jsxs("div",{className:"mx-auto max-w-4xl",children:[!a&&!o&&r.jsx("div",{className:"mb-6",children:r.jsxs(ee,{variant:"outline",onClick:()=>{var ue;(ue=document.getElementById("change-password-section"))==null||ue.scrollIntoView({behavior:"smooth",block:"center"})},className:"gap-2",children:[r.jsx(mj,{className:"h-4 w-4"}),"Change Password"]})}),r.jsxs("div",{className:"space-y-6",children:[r.jsxs(Ye,{children:[r.jsxs(Gt,{children:[r.jsx(Zt,{children:"Profile Photo"}),r.jsx(Mn,{children:"Upload a professional photo for your profile"})]}),r.jsxs(tt,{className:"flex items-center gap-6",children:[r.jsxs(Ks,{className:"h-24 w-24",children:[r.jsx(Ei,{src:j}),r.jsx(Zs,{className:"text-2xl",children:F.name.split(" ").map(ue=>ue[0]).join("").toUpperCase()||"U"})]}),r.jsxs("div",{className:"flex-1",children:[r.jsx("input",{type:"file",id:"avatar-upload",accept:"image/*",className:"hidden",onChange:ne,disabled:N}),r.jsxs(ee,{variant:"outline",onClick:()=>{var ue;return(ue=document.getElementById("avatar-upload"))==null?void 0:ue.click()},disabled:N,children:[r.jsx(uo,{className:"mr-2 h-4 w-4"}),N?"Uploading...":"Upload Photo"]}),r.jsx("p",{className:"text-sm text-muted-foreground mt-2",children:"Upload an image and crop it to your liking."})]})]})]}),r.jsxs(Ye,{children:[r.jsxs(Gt,{children:[r.jsx(Zt,{children:"Personal Information"}),r.jsx(Mn,{children:"Update your profile details"})]}),r.jsxs(tt,{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"name",children:"Name"}),r.jsx(dt,{id:"name",value:F.name,onChange:ue=>q({...F,name:ue.target.value}),maxLength:100})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"email",children:"Email"}),r.jsx(dt,{id:"email",type:"email",value:F.email,onChange:ue=>q({...F,email:ue.target.value}),maxLength:255})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"title",children:"Job Title"}),r.jsx(dt,{id:"title",value:F.title,onChange:ue=>q({...F,title:ue.target.value}),placeholder:"e.g., Broker Associate, Team Lead",maxLength:100})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"bio",children:"Bio"}),r.jsx(dt,{id:"bio",value:F.bio,onChange:ue=>q({...F,bio:ue.target.value}),placeholder:"A short description about yourself",maxLength:500})]}),r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"areas_served",children:"Areas Served"}),r.jsx(dt,{id:"areas_served",value:F.areas_served,onChange:ue=>q({...F,areas_served:ue.target.value}),placeholder:"e.g., Downtown, Suburbs"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"years_experience",children:"Years Experience"}),r.jsx(dt,{id:"years_experience",type:"number",min:"0",value:F.years_experience,onChange:ue=>q({...F,years_experience:ue.target.value}),placeholder:"e.g., 5"})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Social Links"}),r.jsxs("div",{className:"grid grid-cols-1 gap-3",children:[r.jsx(dt,{value:F.linkedin_url,onChange:ue=>q({...F,linkedin_url:ue.target.value}),placeholder:"LinkedIn URL"}),r.jsx(dt,{value:F.instagram_url,onChange:ue=>q({...F,instagram_url:ue.target.value}),placeholder:"Instagram URL"}),r.jsx(dt,{value:F.facebook_url,onChange:ue=>q({...F,facebook_url:ue.target.value}),placeholder:"Facebook URL"})]})]}),r.jsxs(ee,{onClick:ae,disabled:y,children:[r.jsx(vg,{className:"mr-2 h-4 w-4"}),"Save Changes"]})]})]}),r.jsxs(Ye,{id:"change-password-section",children:[r.jsxs(Gt,{children:[r.jsx(Zt,{children:a?"Set Your Password":"Change Password"}),r.jsx(Mn,{children:a?"Create a secure password for your account":"Update your password to keep your account secure"})]}),r.jsxs(tt,{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"newPassword",children:"New Password"}),r.jsx(dt,{id:"newPassword",type:"password",value:ie.newPassword,onChange:ue=>le({...ie,newPassword:ue.target.value}),placeholder:"Min 6 characters"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"confirmPassword",children:"Confirm Password"}),r.jsx(dt,{id:"confirmPassword",type:"password",value:ie.confirmPassword,onChange:ue=>le({...ie,confirmPassword:ue.target.value}),placeholder:"Re-enter your new password"})]}),r.jsxs(ee,{onClick:he,disabled:y,children:[r.jsx(vg,{className:"mr-2 h-4 w-4"}),a?"Complete Setup":"Update Password"]}),a&&r.jsx(ee,{variant:"outline",onClick:()=>e("/dashboard"),className:"ml-2",children:"Skip for Now"})]})]}),r.jsxs(Ye,{children:[r.jsxs(Gt,{children:[r.jsxs(Zt,{className:"flex items-center gap-2",children:[i?r.jsx(gg,{className:"h-5 w-5"}):r.jsx(oj,{className:"h-5 w-5"}),"Push Notifications"]}),r.jsx(Mn,{children:"Receive browser notifications when new content is added"})]}),r.jsx(tt,{children:l?r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:i?"Notifications enabled":"Notifications disabled"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:i?"You'll receive notifications about new templates, videos, and events":"Enable to get notified about new content"})]}),r.jsx(Ps,{checked:i,onCheckedChange:ue=>{ue?p():x()},disabled:h})]}):r.jsxs("div",{className:"text-sm text-muted-foreground space-y-2",children:[r.jsx("p",{children:"Push notifications are not supported in this browser."}),r.jsxs("p",{className:"text-xs",children:[r.jsx("strong",{children:"Desktop:"})," Use Chrome, Firefox, or Edge.",r.jsx("br",{}),r.jsx("strong",{children:"iPhone/iPad:"}),' Open this site in Safari, tap the Share button, then "Add to Home Screen". Push notifications will work from the installed app.']})]})})]}),r.jsxs(Ye,{children:[r.jsxs(Gt,{children:[r.jsxs(Zt,{className:"flex items-center gap-2",children:[H?r.jsx(LT,{className:"h-5 w-5"}):r.jsx(da,{className:"h-5 w-5"}),"Email Preferences"]}),r.jsx(Mn,{children:"Manage your email subscription settings"})]}),r.jsx(tt,{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:H?"You won't receive weekly digest emails":"Receive a weekly summary of new content, events, and your progress"})]}),r.jsx(Ps,{checked:!H,onCheckedChange:async ue=>{te(!0);try{const{error:_e}=await J.from("profiles").update({digest_opt_out:!ue}).eq("id",t==null?void 0:t.id);if(_e)throw _e;Z(!ue),n({title:ue?"Subscribed":"Unsubscribed",description:ue?"You will now receive weekly digest emails":"You will no longer receive weekly digest emails"})}catch(_e){n({title:"Error",description:_e.message||"Failed to update preference",variant:"destructive"})}finally{te(!1)}},disabled:G})]})})]}),r.jsx(Spt,{}),r.jsx(emt,{})]}),r.jsx(wxe,{open:E,onClose:()=>T(!1),imageSrc:L,onCropComplete:ge,aspectRatio:1})]})})};var rmt="AspectRatio",hDe=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}})})});hDe.displayName=rmt;var nmt=hDe;const smt=nmt;function amt(){const{user:t}=Qr(),e=Vr(),[n,s]=I.useState(!1),[a,o]=I.useState(!1),{data:l,isLoading:i}=Yt({queryKey:["calendar-token",t==null?void 0:t.id],queryFn:async()=>{const{data:C,error:N}=await J.from("profiles").select("calendar_token").eq("id",t==null?void 0:t.id).single();if(N)throw N;return C},enabled:!!t&&a}),h=cr({mutationFn:async()=>{const C=new Uint8Array(12);crypto.getRandomValues(C);const N=btoa(String.fromCharCode(...C)).replace(/\+/g,"x").replace(/\//g,"y").replace(/=/g,"").substring(0,16),{error:A}=await J.from("profiles").update({calendar_token:N}).eq("id",t==null?void 0:t.id);if(A)throw A;return N},onSuccess:()=>{e.invalidateQueries({queryKey:["calendar-token",t==null?void 0:t.id]}),ze.success("Calendar subscription URL generated!")},onError:C=>{ze.error("Failed to generate calendar URL: "+C.message)}}),p=l!=null&&l.calendar_token?`https://dashboard.relevelup.com/api/calendar/${l.calendar_token}.ics`:null,x=async()=>{p&&(await navigator.clipboard.writeText(p),s(!0),ze.success("Calendar URL copied to clipboard!"),setTimeout(()=>s(!1),2e3))},y=()=>{p&&(window.location.href=p.replace("https://","webcal://"))},b=()=>{if(p){const C=p.replace("https://","webcal://"),N=`https://calendar.google.com/calendar/r?cid=${encodeURIComponent(C)}`;window.open(N,"_blank")}},j=()=>{if(p){const C=`https://outlook.live.com/calendar/0/addfromweb?url=${encodeURIComponent(p)}&name=Level%20Up%20Events`;window.open(C,"_blank")}};return r.jsxs(Fr,{open:a,onOpenChange:o,children:[r.jsx(zo,{asChild:!0,children:r.jsxs(ee,{variant:"outline",className:"gap-2",children:[r.jsx(zs,{className:"h-4 w-4"}),"Subscribe to Calendar"]})}),r.jsxs(Rr,{className:"sm:max-w-md",children:[r.jsxs(qr,{children:[r.jsxs($r,{className:"flex items-center gap-2",children:[r.jsx(zs,{className:"h-5 w-5 text-primary"}),"Subscribe to Events Calendar"]}),r.jsx(Xn,{children:"Add all Level Up events to your personal calendar. Events will sync automatically and update when we add or change events."})]}),r.jsx("div",{className:"space-y-4 py-4",children:i?r.jsx("div",{className:"flex items-center justify-center py-8",children:r.jsx(en,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):p?r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx("label",{className:"text-sm font-medium",children:"Your Calendar URL"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(dt,{value:p,readOnly:!0,className:"text-xs font-mono"}),r.jsx(ee,{variant:"outline",size:"icon",onClick:x,children:n?r.jsx(Ai,{className:"h-4 w-4 text-green-500"}):r.jsx(hl,{className:"h-4 w-4"})})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx("label",{className:"text-sm font-medium",children:"Quick Add"}),r.jsxs("div",{className:"grid gap-2",children:[r.jsxs(ee,{variant:"outline",className:"w-full justify-start gap-2",onClick:y,children:[r.jsx("svg",{className:"h-4 w-4",viewBox:"0 0 24 24",fill:"currentColor",children:r.jsx("path",{d:"M18.71 19.5c-.83 1.24-1.71 2.45-3.05 2.47-1.34.03-1.77-.79-3.29-.79-1.53 0-2 .77-3.27.82-1.31.05-2.3-1.32-3.14-2.53C4.25 17 2.94 12.45 4.7 9.39c.87-1.52 2.43-2.48 4.12-2.51 1.28-.02 2.5.87 3.29.87.78 0 2.26-1.07 3.81-.91.65.03 2.47.26 3.64 1.98-.09.06-2.17 1.28-2.15 3.81.03 3.02 2.65 4.03 2.68 4.04-.03.07-.42 1.44-1.38 2.83M13 3.5c.73-.83 1.94-1.46 2.94-1.5.13 1.17-.34 2.35-1.04 3.19-.69.85-1.83 1.51-2.95 1.42-.15-1.15.41-2.35 1.05-3.11z"})}),"Add to Apple Calendar",r.jsx(Fs,{className:"h-3 w-3 ml-auto opacity-50"})]}),r.jsxs(ee,{variant:"outline",className:"w-full justify-start gap-2",onClick:b,children:[r.jsxs("svg",{className:"h-4 w-4",viewBox:"0 0 24 24",fill:"currentColor",children:[r.jsx("path",{d:"M19.5 22h-15A2.5 2.5 0 0 1 2 19.5v-15A2.5 2.5 0 0 1 4.5 2H9v2H4.5a.5.5 0 0 0-.5.5v15a.5.5 0 0 0 .5.5h15a.5.5 0 0 0 .5-.5V15h2v4.5a2.5 2.5 0 0 1-2.5 2.5z"}),r.jsx("path",{d:"M12 2v8.5a1.5 1.5 0 0 0 1.5 1.5H22V2h-10z",fill:"#4285F4"}),r.jsx("path",{d:"M12 12V2H4.5A2.5 2.5 0 0 0 2 4.5V12h10z",fill:"#34A853"}),r.jsx("path",{d:"M2 12v7.5A2.5 2.5 0 0 0 4.5 22H12v-10H2z",fill:"#FBBC05"}),r.jsx("path",{d:"M12 22h7.5a2.5 2.5 0 0 0 2.5-2.5V12h-10v10z",fill:"#EA4335"})]}),"Add to Google Calendar",r.jsx(Fs,{className:"h-3 w-3 ml-auto opacity-50"})]}),r.jsxs(ee,{variant:"outline",className:"w-full justify-start gap-2",onClick:j,children:[r.jsx("svg",{className:"h-4 w-4",viewBox:"0 0 24 24",fill:"currentColor",children:r.jsx("path",{d:"M7.88 12.04q0 .45-.11.87-.1.41-.33.74-.22.33-.58.52-.37.2-.87.2t-.85-.2q-.35-.21-.57-.55-.22-.33-.33-.75-.1-.42-.1-.86t.1-.87q.1-.43.34-.76.22-.34.59-.54.36-.2.87-.2t.86.2q.35.21.57.55.22.34.31.77.1.43.1.88zM24 12v9.38q0 .46-.33.8-.33.32-.8.32H7.13q-.46 0-.8-.33-.32-.33-.32-.8V18H1q-.41 0-.7-.3-.3-.29-.3-.7V7q0-.41.3-.7Q.58 6 1 6h6.5V2.55q0-.44.3-.75.3-.3.75-.3h12.9q.44 0 .75.3.3.3.3.75V12zm-6-8.25v3h3v-3zm0 4.5v3h3v-3zm0 4.5v1.83l3.05-1.83zm-5.25-9v3h3.75v-3zm0 4.5v3h3.75v-3zm0 4.5v2.03l2.41 1.5 1.34-.81v-2.72zM9 3.75V6h2l.13.01.12.04v-2.3zM5.98 15.98q.9 0 1.6-.3.7-.32 1.19-.86.48-.55.73-1.28.25-.74.25-1.61 0-.83-.25-1.55-.24-.71-.71-1.24t-1.15-.83q-.68-.3-1.55-.3-.92 0-1.64.3-.71.3-1.2.85-.5.54-.75 1.3-.25.74-.25 1.63 0 .85.26 1.56.26.72.74 1.23.48.52 1.17.81.69.3 1.56.3zM7.5 21h12.39L12 16.08V17q0 .41-.3.7-.29.3-.7.3H7.5zm15-.13v-7.24l-5.9 3.54Z"})}),"Add to Outlook",r.jsx(Fs,{className:"h-3 w-3 ml-auto opacity-50"})]})]})]}),r.jsx("p",{className:"text-xs text-muted-foreground text-center pt-2",children:"Events sync automatically. If your membership expires, the calendar will show as empty."})]}):r.jsxs("div",{className:"text-center space-y-4",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Generate your personal calendar subscription URL to get started."}),r.jsx(ee,{onClick:()=>h.mutate(),disabled:h.isPending,className:"w-full",children:h.isPending?r.jsxs(r.Fragment,{children:[r.jsx(en,{className:"h-4 w-4 mr-2 animate-spin"}),"Generating..."]}):r.jsxs(r.Fragment,{children:[r.jsx(zs,{className:"h-4 w-4 mr-2"}),"Generate Calendar URL"]})})]})})]})]})}var kse="Tabs",[imt]=tc(kse,[a3]),fDe=a3(),[omt,jxe]=imt(kse),pDe=I.forwardRef((t,e)=>{const{__scopeTabs:n,value:s,onValueChange:a,defaultValue:o,orientation:l="horizontal",dir:i,activationMode:h="automatic",...p}=t,x=ik(i),[y,b]=Fu({prop:s,onChange:a,defaultProp:o??"",caller:kse});return r.jsx(omt,{scope:n,baseId:Gc(),value:y,onValueChange:b,orientation:l,dir:x,activationMode:h,children:r.jsx(Rn.div,{dir:x,"data-orientation":l,...p,ref:e})})});pDe.displayName=kse;var mDe="TabsList",gDe=I.forwardRef((t,e)=>{const{__scopeTabs:n,loop:s=!0,...a}=t,o=jxe(mDe,n),l=fDe(n);return r.jsx(vge,{asChild:!0,...l,orientation:o.orientation,dir:o.dir,loop:s,children:r.jsx(Rn.div,{role:"tablist","aria-orientation":o.orientation,...a,ref:e})})});gDe.displayName=mDe;var xDe="TabsTrigger",yDe=I.forwardRef((t,e)=>{const{__scopeTabs:n,value:s,disabled:a=!1,...o}=t,l=jxe(xDe,n),i=fDe(n),h=bDe(l.baseId,s),p=wDe(l.baseId,s),x=s===l.value;return r.jsx(_ge,{asChild:!0,...i,focusable:!a,active:x,children:r.jsx(Rn.button,{type:"button",role:"tab","aria-selected":x,"aria-controls":p,"data-state":x?"active":"inactive","data-disabled":a?"":void 0,disabled:a,id:h,...o,ref:e,onMouseDown:an(t.onMouseDown,y=>{!a&&y.button===0&&y.ctrlKey===!1?l.onValueChange(s):y.preventDefault()}),onKeyDown:an(t.onKeyDown,y=>{[" ","Enter"].includes(y.key)&&l.onValueChange(s)}),onFocus:an(t.onFocus,()=>{const y=l.activationMode!=="manual";!x&&!a&&y&&l.onValueChange(s)})})})});yDe.displayName=xDe;var vDe="TabsContent",_De=I.forwardRef((t,e)=>{const{__scopeTabs:n,value:s,forceMount:a,children:o,...l}=t,i=jxe(vDe,n),h=bDe(i.baseId,s),p=wDe(i.baseId,s),x=s===i.value,y=I.useRef(x);return I.useEffect(()=>{const b=requestAnimationFrame(()=>y.current=!1);return()=>cancelAnimationFrame(b)},[]),r.jsx(gc,{present:a||x,children:({present:b})=>r.jsx(Rn.div,{"data-state":x?"active":"inactive","data-orientation":i.orientation,role:"tabpanel","aria-labelledby":h,hidden:!b,id:p,tabIndex:0,...l,ref:e,style:{...t.style,animationDuration:y.current?"0s":void 0},children:b&&o})})});_De.displayName=vDe;function bDe(t,e){return`${t}-trigger-${e}`}function wDe(t,e){return`${t}-content-${e}`}var lmt=pDe,jDe=gDe,kDe=yDe,NDe=_De;const Ii=lmt,wi=I.forwardRef(({className:t,...e},n)=>r.jsx(jDe,{ref:n,className:$t("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",t),...e}));wi.displayName=jDe.displayName;const ln=I.forwardRef(({className:t,...e},n)=>r.jsx(kDe,{ref:n,className:$t("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}));ln.displayName=kDe.displayName;const An=I.forwardRef(({className:t,...e},n)=>r.jsx(NDe,{ref:n,className:$t("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",t),...e}));An.displayName=NDe.displayName;const cmt={first_timer:vs,regular:qx,dedicated:Ol,veteran:Zi,streak_master:Jh,century:Zi},dmt={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 _ke(t){return t===1?r.jsx(Zi,{className:"h-5 w-5 text-yellow-500"}):t===2?r.jsx(qx,{className:"h-5 w-5 text-gray-400"}):t===3?r.jsx(Ol,{className:"h-5 w-5 text-amber-600"}):r.jsx("span",{className:"w-5 text-center text-sm font-medium text-muted-foreground",children:t})}function SDe({showUserStats:t=!0,compact:e=!1,brokerageId:n,title:s="Event Leaderboard"}){const{user:a}=Qr(),{data:o,isLoading:l}=x8e(e?5:10,n),{data:i}=y8e(a==null?void 0:a.id),{data:h}=_8e(a==null?void 0:a.id),{data:p}=v8e(a==null?void 0:a.id);return l?r.jsxs(Ye,{children:[r.jsx(Gt,{children:r.jsxs(Zt,{className:"flex items-center gap-2",children:[r.jsx(Zi,{className:"h-5 w-5 text-yellow-500"}),s]})}),r.jsx(tt,{children:r.jsx("div",{className:"space-y-3",children:[...Array(5)].map((x,y)=>r.jsx(Ir,{className:"h-12 w-full"},y))})})]}):r.jsxs(Ye,{children:[r.jsx(Gt,{className:"pb-3",children:r.jsxs(Zt,{className:"flex items-center gap-2",children:[r.jsx(Zi,{className:"h-5 w-5 text-yellow-500"}),s]})}),r.jsxs(tt,{children:[t&&i&&r.jsxs("div",{className:"mb-4 p-3 rounded-lg bg-primary/5 border border-primary/10",children:[r.jsxs("div",{className:"flex items-center justify-between mb-2",children:[r.jsx("span",{className:"text-sm font-medium",children:"Your Stats"}),h&&r.jsxs(Ot,{variant:"secondary",className:"text-xs",children:["Rank #",h]})]}),r.jsxs("div",{className:"grid grid-cols-3 gap-2 text-center",children:[r.jsxs("div",{children:[r.jsx("div",{className:"text-lg font-bold text-primary",children:i.total_points}),r.jsx("div",{className:"text-xs text-muted-foreground",children:"Points"})]}),r.jsxs("div",{children:[r.jsx("div",{className:"text-lg font-bold",children:i.total_events_attended}),r.jsx("div",{className:"text-xs text-muted-foreground",children:"Events"})]}),r.jsxs("div",{className:"flex items-center justify-center gap-1",children:[r.jsx(Jh,{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=cmt[x.badge_type]||vs;return r.jsxs(Ot,{variant:"outline",className:`text-xs ${dmt[x.badge_type]||""}`,title:x.badge_description||"",children:[r.jsx(y,{className:"h-3 w-3 mr-1"}),x.badge_name]},x.id)}),p.length>4&&r.jsxs(Ot,{variant:"outline",className:"text-xs",children:["+",p.length-4," more"]})]})]}),r.jsxs(Ii,{defaultValue:"points",className:"w-full",children:[r.jsxs(wi,{className:"w-full mb-3",children:[r.jsx(ln,{value:"points",className:"flex-1",children:"By Points"}),r.jsx(ln,{value:"events",className:"flex-1",children:"By Events"})]}),r.jsx(An,{value:"points",className:"mt-0",children:r.jsxs("div",{className:"space-y-2",children:[o==null?void 0:o.map((x,y)=>{var b,j,C;return r.jsxs("div",{className:`flex items-center gap-3 p-2 rounded-lg ${x.user_id===(a==null?void 0:a.id)?"bg-primary/5 border border-primary/10":""} ${y===0?"bg-yellow-500/5":""}`,children:[r.jsx("div",{className:"w-6 flex justify-center",children:_ke(y+1)}),r.jsx(Ks,{className:"h-8 w-8",children:r.jsx(Zs,{className:"text-xs",children:((j=(b=x.profile)==null?void 0:b.name)==null?void 0:j.charAt(0))||"?"})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"font-medium text-sm truncate",children:[((C=x.profile)==null?void 0:C.name)||"Unknown",x.user_id===(a==null?void 0:a.id)&&r.jsx("span",{className:"text-xs text-muted-foreground ml-1",children:"(You)"})]}),r.jsxs("div",{className:"text-xs text-muted-foreground",children:[x.total_events_attended," events"]})]}),r.jsxs("div",{className:"text-right",children:[r.jsx("div",{className:"font-bold text-primary",children:x.total_points}),r.jsx("div",{className:"text-xs text-muted-foreground",children:"pts"})]})]},x.user_id)}),(!o||o.length===0)&&r.jsx("div",{className:"text-center text-muted-foreground py-4 text-sm",children:"No attendance data yet. Attend an event to get on the leaderboard!"})]})}),r.jsx(An,{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 b,j,C;return r.jsxs("div",{className:`flex items-center gap-3 p-2 rounded-lg ${x.user_id===(a==null?void 0:a.id)?"bg-primary/5 border border-primary/10":""} ${y===0?"bg-yellow-500/5":""}`,children:[r.jsx("div",{className:"w-6 flex justify-center",children:_ke(y+1)}),r.jsx(Ks,{className:"h-8 w-8",children:r.jsx(Zs,{className:"text-xs",children:((j=(b=x.profile)==null?void 0:b.name)==null?void 0:j.charAt(0))||"?"})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"font-medium text-sm truncate",children:[((C=x.profile)==null?void 0:C.name)||"Unknown",x.user_id===(a==null?void 0:a.id)&&r.jsx("span",{className:"text-xs text-muted-foreground ml-1",children:"(You)"})]}),r.jsxs("div",{className:"text-xs text-muted-foreground",children:[x.total_points," points"]})]}),r.jsxs("div",{className:"text-right",children:[r.jsx("div",{className:"font-bold",children:x.total_events_attended}),r.jsx("div",{className:"text-xs text-muted-foreground",children:"events"})]})]},x.user_id)})})})]})]})]})}function umt(){const t=rs(),{user:e,isAdmin:n}=Qr(),s=Vr(),{data:a,isLoading:o}=Yt({queryKey:["public-events"],queryFn:async()=>{const{data:N,error:A}=await J.from("events").select("*").order("event_date",{ascending:!0});if(A)throw A;return N}}),{data:l}=Yt({queryKey:["my-registrations"],queryFn:async()=>{if(!e)return[];const{data:N,error:A}=await J.from("event_registrations").select("event_id, zoom_join_url").eq("user_id",e.id);if(A)throw A;return N},enabled:!!e}),{data:i}=Yt({queryKey:["event-registration-counts"],queryFn:async()=>{const{data:N,error:A}=await J.from("event_registrations").select("event_id");if(A)throw A;const E={};return N.forEach(T=>{E[T.event_id]=(E[T.event_id]||0)+1}),E}}),h=cr({mutationFn:async N=>{const{data:A,error:E}=await J.functions.invoke("zoom-register",{body:{event_id:N}});if(E)throw E;if(A!=null&&A.error)throw new Error(A.error);return A},onSuccess:N=>{s.invalidateQueries({queryKey:["my-registrations"]}),s.invalidateQueries({queryKey:["event-registration-counts"]}),N!=null&&N.join_url?ze.success("Successfully registered! You'll receive a Zoom confirmation email."):ze.success("Successfully registered for the event!")},onError:N=>{ze.error("Failed to register: "+N.message)}}),p=cr({mutationFn:async N=>{const{data:A,error:E}=await J.functions.invoke("zoom-unregister",{body:{event_id:N}});if(E)throw E;if(A!=null&&A.error)throw new Error(A.error);return A},onSuccess:()=>{s.invalidateQueries({queryKey:["my-registrations"]}),s.invalidateQueries({queryKey:["event-registration-counts"]}),ze.success("Registration cancelled and removed from Zoom")},onError:N=>{ze.error("Failed to cancel: "+N.message)}}),x=N=>l==null?void 0:l.some(A=>A.event_id===N),y=N=>{const A=l==null?void 0:l.find(E=>E.event_id===N);return A==null?void 0:A.zoom_join_url},b=N=>N.capacity?((i==null?void 0:i[N.id])||0)>=N.capacity:!1,j=(a==null?void 0:a.filter(N=>MS(N.event_date)!=="ended"))||[],C=(a==null?void 0:a.filter(N=>MS(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(amt,{}),n&&r.jsx(ee,{variant:"outline",onClick:()=>t("/admin/events"),children:"Manage Events"})]})]}),r.jsxs("div",{className:`grid grid-cols-1 ${n?"lg:grid-cols-3":""} gap-6`,children:[r.jsxs("div",{className:n?"lg:col-span-2":"",children:[o?r.jsx("div",{className:"text-center py-12 text-muted-foreground",children:"Loading events..."}):j.length===0?r.jsx(Ye,{className:"text-center py-12",children:r.jsx(tt,{children:r.jsx("p",{className:"text-muted-foreground",children:"No upcoming events at the moment. Check back soon!"})})}):r.jsx("div",{className:"grid gap-6 md:grid-cols-2",children:j.map(N=>{const A=MS(N.event_date),E=fxe(N.event_date),T=A==="live",L=A==="starting_soon";return r.jsxs(Ye,{className:`flex flex-col overflow-hidden cursor-pointer hover:shadow-lg transition-all ${T?"border-red-500 ring-2 ring-red-500/20":L?"border-amber-500 ring-2 ring-amber-500/20":"hover:border-primary/50"}`,onClick:()=>t(`/events/${N.id}`),children:[E&&r.jsxs("div",{className:`${T?"bg-red-500":"bg-amber-500"} text-white px-3 py-1.5 flex items-center gap-2 text-sm font-medium`,children:[r.jsxs("span",{className:"relative flex h-2 w-2",children:[r.jsx("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-white opacity-75"}),r.jsx("span",{className:"relative inline-flex rounded-full h-2 w-2 bg-white"})]}),T?r.jsxs(r.Fragment,{children:[r.jsx(_j,{className:"h-3.5 w-3.5"}),"LIVE NOW"]}):r.jsxs(r.Fragment,{children:[r.jsx(Ya,{className:"h-3.5 w-3.5"}),"STARTING SOON"]})]}),N.image_url&&r.jsx(smt,{ratio:3/2,className:"overflow-hidden",children:r.jsx("img",{src:N.image_url,alt:N.title,className:"w-full h-full object-cover group-hover:scale-105 transition-transform"})}),r.jsxs(Gt,{children:[r.jsx(Zt,{className:"line-clamp-2",children:N.title}),N.description&&r.jsx(Mn,{className:"line-clamp-2",children:N.description.replace(/<[^>]*>/g,"")})]}),r.jsxs(tt,{className:"flex-1 space-y-2",children:[r.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[r.jsx(zs,{className:"h-4 w-4"}),new Intl.DateTimeFormat("en-US",{weekday:"long",year:"numeric",month:"long",day:"numeric",timeZone:"America/New_York"}).format(new Date(N.event_date))]}),r.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[r.jsx(Ya,{className:"h-4 w-4"}),aE(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(aA,{className:"flex gap-2",onClick:z=>z.stopPropagation(),children:x(N.id)?r.jsxs(r.Fragment,{children:[r.jsxs(ee,{variant:"outline",className:"flex-1",onClick:()=>p.mutate(N.id),disabled:p.isPending,children:[r.jsx(_s,{className:"h-4 w-4 mr-2"}),"Cancel"]}),r.jsxs(ee,{className:"flex-1",onClick:()=>window.open(y(N.id)||N.zoom_link,"_blank"),children:[r.jsx(Fs,{className:"h-4 w-4 mr-2"}),"Join Zoom"]})]}):r.jsx(ee,{className:"w-full",onClick:()=>h.mutate(N.id),disabled:h.isPending||b(N),children:b(N)?"Event Full":r.jsxs(r.Fragment,{children:[r.jsx(Ai,{className:"h-4 w-4 mr-2"}),"Register"]})})})]},N.id)})}),C.length>0&&r.jsxs("div",{className:"mt-12",children:[r.jsx("h3",{className:"text-xl font-semibold mb-4 text-muted-foreground",children:"Past Events"}),r.jsx("div",{className:"grid gap-4 md:grid-cols-2",children:C.map(N=>r.jsx(Ye,{className:"opacity-60 cursor-pointer hover:opacity-80 transition-opacity",onClick:()=>t(`/events/${N.id}`),children:r.jsxs(Gt,{children:[r.jsx(Zt,{className:"text-base line-clamp-1",children:N.title}),r.jsx(Mn,{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(SDe,{showUserStats:!0})})]})]})})}const Yle=[{value:"all",label:"All Roles",icon:Bn},{value:"brokerage_manager",label:"Brokerage Managers",icon:eA},{value:"admin",label:"Admins",icon:rf}];function hmt({open:t,onOpenChange:e,resourceType:n,resourceId:s,resourceTitle:a}){var je,et;const{user:o,isAdmin:l,isBrokerageManager:i}=Qr(),[h,p]=I.useState([]),[x,y]=I.useState([]),[b,j]=I.useState([]),[C,N]=I.useState([]),[A,E]=I.useState(""),[T,L]=I.useState(""),[z,F]=I.useState(""),[q,H]=I.useState(!1),[Z,G]=I.useState(!1),[te,ie]=I.useState("agents"),[le,ye]=I.useState("all"),[ne,ge]=I.useState({}),ae=l||i;I.useEffect(()=>{t&&o&&(l?he():ue())},[t,o,l]),I.useEffect(()=>{t||(j([]),N([]),E(""),L(""),F(""),ie("agents"),ye("all"))},[t]);const he=async()=>{if(o){H(!0);try{const{data:Te,error:Ze}=await J.from("brokerages").select("id, name").order("name");if(Ze)throw Ze;const pe=1e3,yt={};let rt=0,at=!0;for(;at;){const{data:qe,error:Oe}=await J.from("profiles").select("brokerage_id").range(rt*pe,(rt+1)*pe-1);if(Oe)throw Oe;qe==null||qe.forEach(Qe=>{Qe.brokerage_id&&(yt[Qe.brokerage_id]=(yt[Qe.brokerage_id]||0)+1)}),at=(qe==null?void 0:qe.length)===pe,rt++}y((Te==null?void 0:Te.map(qe=>({...qe,agent_count:yt[qe.id]||0})))||[]);const Me=[];for(rt=0,at=!0;at;){const{data:qe,error:Oe}=await J.from("profiles").select("id, name, email, brokerage_id, brokerages(name)").neq("id",o.id).order("name").range(rt*pe,(rt+1)*pe-1);if(Oe)throw Oe;qe&&Me.push(...qe),at=(qe==null?void 0:qe.length)===pe,rt++}const ft={};for(rt=0,at=!0;at;){const{data:qe,error:Oe}=await J.from("user_roles").select("user_id, role").range(rt*pe,(rt+1)*pe-1);if(Oe)throw Oe;qe==null||qe.forEach(Qe=>{ft[Qe.user_id]||(ft[Qe.user_id]=[]),ft[Qe.user_id].push(Qe.role)}),at=(qe==null?void 0:qe.length)===pe,rt++}ge(ft),p(Me.map(qe=>{var Oe;return{id:qe.id,name:qe.name,email:qe.email,brokerage_name:((Oe=qe.brokerages)==null?void 0:Oe.name)||"No Brokerage",roles:ft[qe.id]||[]}}))}catch(Te){console.error("Error loading data:",Te),ze.error("Failed to load agents and brokerages")}finally{H(!1)}}},ue=async()=>{if(o){H(!0);try{const{data:Te}=await J.from("profiles").select("brokerage_id").eq("id",o.id).single();if(!(Te!=null&&Te.brokerage_id)){ze.error("You must be part of a brokerage to share resources"),e(!1);return}const{data:Ze,error:pe}=await J.from("profiles").select("id, name, email").eq("brokerage_id",Te.brokerage_id).neq("id",o.id).order("name");if(pe)throw pe;p(Ze||[])}catch(Te){console.error("Error loading agents:",Te),ze.error("Failed to load agents")}finally{H(!1)}}},_e=h.filter(Te=>{var pe;const Ze=Te.name.toLowerCase().includes(A.toLowerCase())||Te.email.toLowerCase().includes(A.toLowerCase())||((pe=Te.brokerage_name)==null?void 0:pe.toLowerCase().includes(A.toLowerCase()));if(l&&le!=="all"){const yt=ne[Te.id]||[];return Ze&&yt.includes(le)}return Ze}),Ae=x.filter(Te=>Te.name.toLowerCase().includes(T.toLowerCase())),Ce=()=>{b.length===_e.length?j([]):j(_e.map(Te=>Te.id))},be=()=>{C.length===Ae.length?N([]):N(Ae.map(Te=>Te.id))},me=Te=>{if(!ae){j([Te]);return}j(Ze=>Ze.includes(Te)?Ze.filter(pe=>pe!==Te):[...Ze,Te])},Le=Te=>{N(Ze=>Ze.includes(Te)?Ze.filter(pe=>pe!==Te):[...Ze,Te])},Ne=async()=>{if(!(b.length>0||C.length>0)){ze.error("Please select at least one agent or brokerage to share with");return}G(!0);try{const{data:Ze,error:pe}=await J.functions.invoke("send-share-notification",{body:{recipientIds:b,brokerageIds:C,resourceType:n,resourceId:s,resourceTitle:a,message:z.trim()||void 0}});if(pe)throw pe;const yt=(Ze==null?void 0:Ze.sharesCreated)||b.length;ze.success(`Shared with ${yt} agent${yt!==1?"s":""}`),e(!1)}catch(Ze){console.error("Error sharing resource:",Ze),ze.error("Failed to share resource")}finally{G(!1)}},Be=Te=>Te.split(" ").map(Ze=>Ze[0]).join("").toUpperCase().slice(0,2),Ee=Te=>{const Ze=ne[Te]||[];return Ze.includes("admin")?r.jsx(Ot,{variant:"secondary",className:"text-[10px] px-1.5 py-0",children:"Admin"}):Ze.includes("brokerage_manager")?r.jsx(Ot,{variant:"outline",className:"text-[10px] px-1.5 py-0",children:"Manager"}):null},Ue=b.length+C.length,Re=le!=="all"?_e.length:null;return r.jsx(Fr,{open:t,onOpenChange:e,children:r.jsxs(Rr,{className:"sm:max-w-lg max-h-[90vh] overflow-hidden flex flex-col",children:[r.jsxs(qr,{className:"flex-shrink-0",children:[r.jsxs($r,{className:"flex items-center gap-2",children:[r.jsx(Oo,{className:"h-5 w-5 text-primary"}),"Share Resource"]}),r.jsxs(Xn,{className:"line-clamp-2",children:['Share "',a,'" with ',l?"agents or brokerages":"agents in your brokerage"]})]}),r.jsxs("div",{className:"flex-1 overflow-hidden flex flex-col space-y-4",children:[l?r.jsxs(Ii,{value:te,onValueChange:ie,className:"flex-1 flex flex-col overflow-hidden",children:[r.jsxs(wi,{className:"grid w-full grid-cols-2 flex-shrink-0",children:[r.jsxs(ln,{value:"agents",className:"flex items-center gap-2",children:[r.jsx(Bn,{className:"h-4 w-4"}),r.jsx("span",{children:"Agents"}),b.length>0&&r.jsx(Ot,{variant:"default",className:"h-5 min-w-5 px-1.5 text-xs",children:b.length})]}),r.jsxs(ln,{value:"brokerages",className:"flex items-center gap-2",children:[r.jsx(ai,{className:"h-4 w-4"}),r.jsx("span",{children:"Brokerages"}),C.length>0&&r.jsx(Ot,{variant:"default",className:"h-5 min-w-5 px-1.5 text-xs",children:C.length})]})]}),r.jsxs(An,{value:"agents",className:"flex-1 flex flex-col space-y-3 mt-3 overflow-hidden",children:[r.jsxs("div",{className:"flex gap-2 flex-shrink-0",children:[r.jsxs("div",{className:"relative flex-1",children:[r.jsx(wa,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(dt,{placeholder:"Search by name, email, or brokerage...",value:A,onChange:Te=>E(Te.target.value),className:"pl-9"})]}),r.jsxs(gn,{value:le,onValueChange:ye,children:[r.jsxs(fn,{className:"w-[180px]",children:[r.jsx(m1,{className:"h-4 w-4 mr-2 text-muted-foreground"}),r.jsx(xn,{placeholder:"Filter by role"})]}),r.jsx(pn,{children:Yle.map(Te=>r.jsx(Vt,{value:Te.value,children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Te.icon,{className:"h-4 w-4"}),r.jsx("span",{children:Te.label})]})},Te.value))})]})]}),r.jsxs("div",{className:"flex items-center justify-between px-1 flex-shrink-0",children:[r.jsxs(ee,{variant:"ghost",size:"sm",onClick:Ce,className:"text-xs h-8",disabled:_e.length===0,children:[r.jsx(Bn,{className:"h-3.5 w-3.5 mr-1.5"}),b.length===_e.length&&_e.length>0?"Deselect All":"Select All"]}),r.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[Re!==null&&r.jsxs("span",{className:"text-primary font-medium",children:[Re," ",(je=Yle.find(Te=>Te.value===le))==null?void 0:je.label]}),r.jsxs("span",{className:"font-medium",children:[b.length," selected"]})]})]}),r.jsx(Jo,{className:"h-[300px] border rounded-lg",children:q?r.jsx("div",{className:"flex items-center justify-center h-[200px]",children:r.jsx(en,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):_e.length===0?r.jsxs("div",{className:"flex flex-col items-center justify-center h-[200px] text-muted-foreground",children:[r.jsx(Bn,{className:"h-8 w-8 mb-2 opacity-50"}),r.jsx("p",{className:"text-sm",children:le!=="all"?`No ${(et=Yle.find(Te=>Te.value===le))==null?void 0:et.label.toLowerCase()} found`:"No agents found"})]}):r.jsx("div",{className:"p-2 space-y-1",children:_e.map(Te=>r.jsxs("div",{className:`flex items-center gap-3 p-2.5 rounded-lg cursor-pointer hover:bg-accent/50 transition-colors ${b.includes(Te.id)?"bg-accent":""}`,onClick:()=>me(Te.id),children:[r.jsx(Dl,{checked:b.includes(Te.id),onCheckedChange:()=>me(Te.id),className:"flex-shrink-0"}),r.jsx(Ks,{className:"h-9 w-9 flex-shrink-0",children:r.jsx(Zs,{className:"text-xs bg-primary/10 text-primary",children:Be(Te.name)})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("p",{className:"text-sm font-medium truncate",children:Te.name}),Ee(Te.id)]}),r.jsxs("p",{className:"text-xs text-muted-foreground truncate",children:[Te.email,Te.brokerage_name&&r.jsxs("span",{className:"ml-1 opacity-75",children:["• ",Te.brokerage_name]})]})]})]},Te.id))})})]}),r.jsxs(An,{value:"brokerages",className:"flex-1 flex flex-col space-y-3 mt-3 overflow-hidden",children:[r.jsxs("div",{className:"relative flex-shrink-0",children:[r.jsx(wa,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(dt,{placeholder:"Search brokerages...",value:T,onChange:Te=>L(Te.target.value),className:"pl-9"})]}),r.jsxs("div",{className:"flex items-center justify-between px-1 flex-shrink-0",children:[r.jsxs(ee,{variant:"ghost",size:"sm",onClick:be,className:"text-xs h-8",disabled:Ae.length===0,children:[r.jsx(ai,{className:"h-3.5 w-3.5 mr-1.5"}),C.length===Ae.length&&Ae.length>0?"Deselect All":"Select All"]}),r.jsxs("span",{className:"text-xs text-muted-foreground font-medium",children:[C.length," selected"]})]}),r.jsx("p",{className:"text-xs text-muted-foreground px-1 flex-shrink-0",children:"Selecting a brokerage will send to all agents in that brokerage."}),r.jsx(Jo,{className:"h-[250px] border rounded-lg",children:q?r.jsx("div",{className:"flex items-center justify-center h-[180px]",children:r.jsx(en,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):Ae.length===0?r.jsxs("div",{className:"flex flex-col items-center justify-center h-[180px] text-muted-foreground",children:[r.jsx(ai,{className:"h-8 w-8 mb-2 opacity-50"}),r.jsx("p",{className:"text-sm",children:"No brokerages found"})]}):r.jsx("div",{className:"p-2 space-y-1",children:Ae.map(Te=>r.jsxs("div",{className:`flex items-center gap-3 p-2.5 rounded-lg cursor-pointer hover:bg-accent/50 transition-colors ${C.includes(Te.id)?"bg-accent":""}`,onClick:()=>Le(Te.id),children:[r.jsx(Dl,{checked:C.includes(Te.id),onCheckedChange:()=>Le(Te.id),className:"flex-shrink-0"}),r.jsx("div",{className:"h-9 w-9 rounded-lg bg-primary/10 flex items-center justify-center flex-shrink-0",children:r.jsx(ai,{className:"h-4 w-4 text-primary"})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"text-sm font-medium truncate",children:Te.name}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[Te.agent_count," agent",Te.agent_count!==1?"s":""]})]})]},Te.id))})})]})]}):r.jsxs("div",{className:"flex-1 flex flex-col space-y-3 overflow-hidden",children:[r.jsxs("div",{className:"relative flex-shrink-0",children:[r.jsx(wa,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(dt,{placeholder:"Search agents...",value:A,onChange:Te=>E(Te.target.value),className:"pl-9"})]}),ae&&r.jsxs("div",{className:"flex items-center justify-between px-1 flex-shrink-0",children:[r.jsxs(ee,{variant:"ghost",size:"sm",onClick:Ce,className:"text-xs h-8",disabled:_e.length===0,children:[r.jsx(Bn,{className:"h-3.5 w-3.5 mr-1.5"}),b.length===_e.length&&_e.length>0?"Deselect All":"Select All"]}),r.jsxs("span",{className:"text-xs text-muted-foreground font-medium",children:[b.length," selected"]})]}),r.jsx(Jo,{className:"h-[300px] border rounded-lg",children:q?r.jsx("div",{className:"flex items-center justify-center h-[200px]",children:r.jsx(en,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):_e.length===0?r.jsxs("div",{className:"flex flex-col items-center justify-center h-[200px] text-muted-foreground",children:[r.jsx(Bn,{className:"h-8 w-8 mb-2 opacity-50"}),r.jsx("p",{className:"text-sm",children:"No agents found"})]}):r.jsx("div",{className:"p-2 space-y-1",children:_e.map(Te=>r.jsxs("div",{className:`flex items-center gap-3 p-2.5 rounded-lg cursor-pointer hover:bg-accent/50 transition-colors ${b.includes(Te.id)?"bg-accent":""}`,onClick:()=>me(Te.id),children:[r.jsx(Dl,{checked:b.includes(Te.id),onCheckedChange:()=>me(Te.id),className:"flex-shrink-0"}),r.jsx(Ks,{className:"h-9 w-9 flex-shrink-0",children:r.jsx(Zs,{className:"text-xs bg-primary/10 text-primary",children:Be(Te.name)})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"text-sm font-medium truncate",children:Te.name}),r.jsx("p",{className:"text-xs text-muted-foreground truncate",children:Te.email})]})]},Te.id))})})]}),r.jsxs("div",{className:"space-y-2 flex-shrink-0",children:[r.jsx(He,{htmlFor:"message",className:"text-sm font-medium",children:"Add a message (optional)"}),r.jsx(ps,{id:"message",placeholder:"I thought you might find this useful...",value:z,onChange:Te=>F(Te.target.value),rows:2,className:"resize-none"})]}),r.jsxs("div",{className:"flex justify-end gap-2 pt-2 flex-shrink-0",children:[r.jsx(ee,{variant:"outline",onClick:()=>e(!1),children:"Cancel"}),r.jsx(ee,{onClick:Ne,disabled:Ue===0||Z,children:Z?r.jsxs(r.Fragment,{children:[r.jsx(en,{className:"h-4 w-4 mr-2 animate-spin"}),"Sharing..."]}):r.jsxs(r.Fragment,{children:[r.jsx(Oo,{className:"h-4 w-4 mr-2"}),"Share"]})})]})]})]})})}function u3({resourceType:t,resourceId:e,resourceTitle:n,variant:s="outline",size:a="sm",className:o=""}){const[l,i]=I.useState(!1),{user:h}=Qr();return h?r.jsxs(r.Fragment,{children:[r.jsxs(ee,{variant:s,size:a,onClick:()=>i(!0),className:o,children:[r.jsx(fc,{className:"h-4 w-4 mr-2"}),"Share"]}),r.jsx(hmt,{open:l,onOpenChange:i,resourceType:t,resourceId:e,resourceTitle:n})]}):null}function fmt(){const{eventId:t}=Zc(),e=rs(),{user:n}=Qr(),[s,a]=I.useState(null),[o,l]=I.useState(null),[i,h]=I.useState(0),[p,x]=I.useState(!0),[y,b]=I.useState(!1);I.useEffect(()=>{t&&j()},[t,n]);const j=async()=>{try{const{data:L,error:z}=await J.from("events").select("*").eq("id",t).single();if(z)throw z;a(L);const{count:F}=await J.from("event_registrations").select("*",{count:"exact",head:!0}).eq("event_id",t);if(h(F||0),n){const{data:q}=await J.from("event_registrations").select("id, zoom_join_url").eq("event_id",t).eq("user_id",n.id).maybeSingle();l(q)}}catch(L){console.error("Error loading event:",L),ze.error("Failed to load event"),e("/events")}finally{x(!1)}},C=async()=>{if(!(!n||!s)){b(!0);try{if(o){const{error:L}=await J.functions.invoke("zoom-unregister",{body:{event_id:s.id}});if(L)throw L;ze.success("Successfully cancelled registration"),l(null),h(z=>z-1)}else{const{data:L,error:z}=await J.functions.invoke("zoom-register",{body:{event_id:s.id}});if(z)throw z;ze.success("Successfully registered for event!"),l({id:L.registration_id,zoom_join_url:L.zoom_join_url}),h(F=>F+1)}}catch(L){console.error("Registration error:",L),ze.error(o?"Failed to cancel registration":"Failed to register for event")}finally{b(!1)}}},N=L=>{var z,F,q;if(L.includes("iframe.mediadelivery.net")||L.includes("video.bunnycdn.com")){const H=L.match(/embed\/(\d+)\/([a-f0-9-]+)/);if(H)return`https://iframe.mediadelivery.net/embed/${H[1]}/${H[2]}?autoplay=false&preload=true`}if(L.includes("youtube.com")||L.includes("youtu.be")){const H=L.includes("youtu.be")?(z=L.split("youtu.be/")[1])==null?void 0:z.split("?")[0]:(F=L.split("v=")[1])==null?void 0:F.split("&")[0];if(H)return`https://www.youtube.com/embed/${H}`}if(L.includes("vimeo.com")){const H=(q=L.split("vimeo.com/")[1])==null?void 0:q.split("?")[0];if(H)return`https://player.vimeo.com/video/${H}`}return L};if(p)return r.jsx(Lr,{title:"Event",children:r.jsx("div",{className:"flex items-center justify-center py-16",children:r.jsxs("div",{className:"text-center",children:[r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent mx-auto mb-4"}),r.jsx("p",{className:"text-muted-foreground",children:"Loading event..."})]})})});if(!s)return r.jsx(Lr,{title:"Event Not Found",children:r.jsxs("div",{className:"text-center py-16",children:[r.jsx("p",{className:"text-muted-foreground",children:"Event not found"}),r.jsx(ee,{onClick:()=>e("/events"),className:"mt-4",children:"Back to Events"})]})});const A=Xdt(new Date(s.event_date)),E=s.capacity&&i>=s.capacity,T=(o==null?void 0:o.zoom_join_url)||s.zoom_link;return r.jsx(Lr,{title:s.title,children:r.jsxs("div",{className:"max-w-4xl mx-auto",children:[r.jsxs(ee,{variant:"ghost",className:"mb-6 gap-2",onClick:()=>e("/events"),children:[r.jsx(so,{className:"h-4 w-4"}),"Back to Events"]}),s.image_url&&r.jsxs("div",{className:"relative aspect-video rounded-xl overflow-hidden mb-6",children:[r.jsx("img",{src:s.image_url,alt:s.title,className:"w-full h-full object-cover"}),A&&r.jsx("div",{className:"absolute inset-0 bg-black/50 flex items-center justify-center",children:r.jsx(Ot,{variant:"secondary",className:"text-lg px-4 py-2",children:"Event Ended"})})]}),r.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[r.jsxs("div",{className:"lg:col-span-2 space-y-6",children:[r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-start justify-between gap-4 mb-4",children:[r.jsx("h1",{className:"text-3xl font-bold text-foreground",children:s.title}),r.jsx(u3,{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(Bf,{className:"h-5 w-5"}),"Event Preview"]}),r.jsx("div",{className:"relative w-full aspect-video rounded-xl overflow-hidden border bg-muted",children:r.jsx("iframe",{src:N(s.video_url),className:"absolute inset-0 w-full h-full",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0,title:"Event Preview Video"})})]})]}),r.jsx("div",{className:"space-y-4",children:r.jsx(Ye,{children:r.jsxs(tt,{className:"p-6 space-y-4",children:[r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx(zs,{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:aE(new Date(s.event_date))})]})]}),s.capacity&&r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx(Bn,{className:"h-5 w-5 text-primary mt-0.5"}),r.jsxs("div",{children:[r.jsxs("p",{className:"font-medium",children:[i," / ",s.capacity]}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Registered"})]})]}),o&&r.jsxs("div",{className:"flex items-center gap-2 p-3 bg-green-500/10 rounded-lg",children:[r.jsx(Yi,{className:"h-5 w-5 text-green-600"}),r.jsx("span",{className:"text-sm font-medium text-green-700",children:"You're registered!"})]}),r.jsxs("div",{className:"space-y-2 pt-2",children:[!A&&r.jsx(r.Fragment,{children:o?r.jsxs(r.Fragment,{children:[r.jsxs(ee,{className:"w-full gap-2",onClick:()=>window.open(T,"_blank"),children:[r.jsx(Fs,{className:"h-4 w-4"}),"Join Event"]}),r.jsxs(ee,{variant:"outline",className:"w-full",onClick:C,disabled:y,children:[y?r.jsx(en,{className:"h-4 w-4 animate-spin mr-2"}):null,"Cancel Registration"]})]}):r.jsx(ee,{className:"w-full gap-2",onClick:C,disabled:y||(E??!1),children:y?r.jsx(en,{className:"h-4 w-4 animate-spin"}):E?"Event Full":"Register Now"})}),A&&o&&r.jsxs(ee,{variant:"outline",className:"w-full gap-2",onClick:()=>window.open(s.zoom_link,"_blank"),children:[r.jsx(Fs,{className:"h-4 w-4"}),"View Recording"]})]})]})})})]})]})})}const pmt=()=>{const{user:t,isAdmin:e}=Qr(),n=rs(),[s,a]=I.useState([]),[o,l]=I.useState(!0),[i,h]=I.useState(""),[p,x]=I.useState("all"),[y,b]=I.useState(new Set);I.useEffect(()=>{j()},[t]);const j=async()=>{try{const{data:T}=await J.from("user_tags").select("tag").eq("user_id",t==null?void 0:t.id),L=(T==null?void 0:T.map(te=>te.tag))||[],{data:z,error:F}=await J.from("app_tiles").select("*").order("name");if(F)throw F;const{data:q}=await J.from("user_favorites").select("app_id").eq("user_id",t==null?void 0:t.id),H=new Set((q==null?void 0:q.map(te=>te.app_id))||[]);b(H);const G=((z==null?void 0:z.filter(te=>!te.required_tags||te.required_tags.length===0?!0:te.required_tags.some(ie=>L.includes(ie))))||[]).sort((te,ie)=>te.name==="LevelUp Members Portal"?-1:ie.name==="LevelUp Members Portal"?1:0);a(G)}catch(T){console.error("Error loading apps:",T),ze.error("Failed to load apps")}finally{l(!1)}},C=async T=>{var z;const L=window.open("about:blank","_blank");try{const{data:F,error:q}=await J.auth.getSession();if(q||!F.session){L==null||L.close(),ze.error("Session expired. Please refresh the page and try again.");return}const H=F.session.access_token;await J.from("activity_logs").insert({user_id:t==null?void 0:t.id,app_id:T.app_id,app_name:T.name,user_agent:navigator.userAgent});const{data:Z,error:G}=await J.functions.invoke("sso-launch",{body:{app_id:T.app_id},headers:{Authorization:`Bearer ${H}`}});if(G)throw G;Z!=null&&Z.redirect_url?L&&!L.closed?(L.location.href=Z.redirect_url,(z=L.focus)==null||z.call(L)):window.location.assign(Z.redirect_url):(L==null||L.close(),ze.error("Launch link unavailable"))}catch(F){L==null||L.close(),console.error("Error launching app:",F),ze.error("Failed to launch app. Please try again.")}},N=async(T,L)=>{T.stopPropagation();const z=y.has(L);try{if(z){const{error:F}=await J.from("user_favorites").delete().eq("user_id",t==null?void 0:t.id).eq("app_id",L);if(F)throw F;b(q=>{const H=new Set(q);return H.delete(L),H}),ze.success("Removed from favorites")}else{const{error:F}=await J.from("user_favorites").insert({user_id:t==null?void 0:t.id,app_id:L});if(F)throw F;b(q=>new Set(q).add(L)),ze.success("Added to favorites")}}catch(F){console.error("Error toggling favorite:",F),ze.error("Failed to update favorites")}},A=s.filter(T=>{var z;const L=T.name.toLowerCase().includes(i.toLowerCase())||((z=T.description)==null?void 0:z.toLowerCase().includes(i.toLowerCase()));return p==="favorites"?L&&y.has(T.id):L}),E=[{id:"all",label:"All"},{id:"favorites",label:"Favorites"}];return o?r.jsx(Lr,{title:"Apps",children:r.jsx("div",{className:"flex items-center justify-center py-16",children:r.jsxs("div",{className:"text-center",children:[r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent mx-auto mb-4"}),r.jsx("p",{className:"text-muted-foreground",children:"Loading apps..."})]})})}):r.jsxs(Lr,{title:"Apps",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4 mb-6",children:[r.jsx("h2",{className:"text-2xl font-bold text-foreground",children:"Apps"}),r.jsxs("div",{className:"relative max-w-sm w-full",children:[r.jsx(wa,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(dt,{placeholder:"Search apps...",className:"pl-10 bg-muted/50 border-0 focus-visible:ring-1",value:i,onChange:T=>h(T.target.value)})]})]}),r.jsx("div",{className:"flex gap-6 border-b border-border mb-8",children:E.map(T=>r.jsxs("button",{onClick:()=>x(T.id),className:$t("pb-3 text-sm font-medium transition-colors relative",p===T.id?"text-primary":"text-muted-foreground hover:text-foreground"),children:[T.label,p===T.id&&r.jsx("span",{className:"absolute bottom-0 left-0 right-0 h-0.5 bg-primary"})]},T.id))}),A.length===0?r.jsx("div",{className:"flex flex-col items-center justify-center py-16 bg-card rounded-xl border border-border",children:p==="favorites"?r.jsxs(r.Fragment,{children:[r.jsx(um,{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(Zf,{className:"h-12 w-12 text-muted-foreground mb-4"}),r.jsx("p",{className:"text-lg font-medium mb-2 text-foreground",children:"No apps available"}),r.jsx("p",{className:"text-sm text-muted-foreground text-center max-w-md",children:e?"Get started by adding apps in the admin panel":"Contact your administrator to get access to apps"}),e&&r.jsx(ee,{className:"mt-4",onClick:()=>n("/admin/apps"),children:"Add Apps"})]})}):r.jsx("div",{className:"grid gap-4 md:grid-cols-2 xl:grid-cols-3",children:A.map(T=>{const L=y.has(T.id),z=T.name.toLowerCase().includes("agent review")||T.app_id==="agent_review";return r.jsxs("div",{className:"group flex flex-col p-5 bg-card rounded-xl border border-border transition-all duration-200 hover:shadow-lg hover:border-primary/30",children:[r.jsxs("div",{className:"flex items-start gap-4 cursor-pointer",onClick:()=>C(T),children:[r.jsx("div",{className:"flex-shrink-0 w-14 h-14 rounded-xl bg-primary/10 flex items-center justify-center text-3xl",children:T.icon}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("h3",{className:"font-semibold text-foreground group-hover:text-primary transition-colors truncate",children:T.name}),r.jsx("p",{className:"text-sm text-muted-foreground mt-1 line-clamp-2",children:T.description})]}),r.jsx("button",{className:$t("flex-shrink-0 p-1 transition-colors",L?"text-primary":"text-muted-foreground/50 hover:text-primary"),onClick:F=>N(F,T.id),children:r.jsx(um,{className:$t("h-5 w-5",L&&"fill-current")})})]}),z&&r.jsx("a",{href:"https://forms.gle/vXnrzgSnPbw7CKPV6",target:"_blank",rel:"noopener noreferrer",onClick:F=>F.stopPropagation(),className:"mt-3 text-sm text-primary hover:underline flex items-center gap-1",children:"Create your account with this link →"})]},T.id)})})]})},mmt=()=>{const t=rs(),[e,n]=I.useState(""),[s,a]=I.useState("all"),[o,l]=I.useState("all"),[i,h]=I.useState("grid"),{data:p=[]}=Yt({queryKey:["template-categories"],queryFn:async()=>{const{data:E,error:T}=await J.from("template_categories").select("*").order("name");if(T)throw T;return E}}),{data:x=[]}=Yt({queryKey:["template-types"],queryFn:async()=>{const{data:E,error:T}=await J.from("template_types").select("*").order("name");if(T)throw T;return E}}),{data:y=[],isLoading:b}=Yt({queryKey:["canva-templates"],queryFn:async()=>{const{data:E,error:T}=await J.from("canva_templates").select(` *, category:template_categories(id, name), type:template_types(id, name) `).order("publish_date",{ascending:!1});if(T)throw T;const{data:L,error:z}=await J.from("template_links").select("*").order("sort_order");if(z)throw z;const{data:F}=await J.from("template_likes").select("template_id"),{data:q}=await J.from("template_comments").select("template_id"),H=new Map;F==null||F.forEach(te=>{H.set(te.template_id,(H.get(te.template_id)||0)+1)});const Z=new Map;return q==null||q.forEach(te=>{Z.set(te.template_id,(Z.get(te.template_id)||0)+1)}),(E||[]).map(te=>({...te,links:(L||[]).filter(ie=>ie.template_id===te.id)||[],likesCount:H.get(te.id)||0,commentsCount:Z.get(te.id)||0}))}}),j=y.filter(E=>{var F;const T=E.name.toLowerCase().includes(e.toLowerCase())||((F=E.description)==null?void 0:F.toLowerCase().includes(e.toLowerCase())),L=s==="all"||E.category_id===s,z=o==="all"||E.type_id===o;return T&&L&&z}),C=()=>{n(""),a("all"),l("all")},N=e||s!=="all"||o!=="all",A=E=>{t(`/templates/${E}`)};return r.jsx(Lr,{title:"Canva Templates",children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"font-bold text-foreground text-5xl",children:"Canva Templates"}),r.jsx("p",{className:"text-muted-foreground mt-1",children:"Browse and use our collection of professionally designed templates"})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[r.jsxs("div",{className:"relative flex-1 max-w-sm",children:[r.jsx(wa,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(dt,{placeholder:"Search templates...",value:e,onChange:E=>n(E.target.value),className:"pl-9"})]}),r.jsxs(gn,{value:s,onValueChange:a,children:[r.jsx(fn,{className:"w-full sm:w-48",children:r.jsx(xn,{placeholder:"All Categories"})}),r.jsxs(pn,{children:[r.jsx(Vt,{value:"all",children:"All Categories"}),p.map(E=>r.jsx(Vt,{value:E.id,children:E.name},E.id))]})]}),r.jsxs(gn,{value:o,onValueChange:l,children:[r.jsx(fn,{className:"w-full sm:w-48",children:r.jsx(xn,{placeholder:"All Types"})}),r.jsxs(pn,{children:[r.jsx(Vt,{value:"all",children:"All Types"}),x.map(E=>r.jsx(Vt,{value:E.id,children:E.name},E.id))]})]}),r.jsxs("div",{className:"flex gap-2",children:[N&&r.jsx(ee,{variant:"outline",size:"sm",onClick:C,children:"Clear Filters"}),r.jsxs("div",{className:"flex gap-1",children:[r.jsx(ee,{variant:i==="grid"?"secondary":"outline",size:"icon",onClick:()=>h("grid"),className:"rounded-full",children:r.jsx(pm,{className:"h-4 w-4"})}),r.jsx(ee,{variant:i==="list"?"secondary":"outline",size:"icon",onClick:()=>h("list"),className:"rounded-full",children:r.jsx(Kf,{className:"h-4 w-4"})})]})]})]}),r.jsxs("div",{className:"text-sm text-muted-foreground",children:[j.length," template",j.length!==1?"s":""," found"]}),b&&r.jsx("div",{className:i==="grid"?"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6":"space-y-4",children:[...Array(8)].map((E,T)=>r.jsx(Ye,{children:r.jsxs(tt,{className:"p-4",children:[r.jsx(Ir,{className:"aspect-[4/3] w-full rounded-lg mb-4"}),r.jsx(Ir,{className:"h-5 w-3/4 mb-2"}),r.jsx(Ir,{className:"h-4 w-full mb-4"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(Ir,{className:"h-5 w-16"}),r.jsx(Ir,{className:"h-5 w-20"})]})]})},T))}),!b&&j.length===0&&r.jsxs("div",{className:"text-center py-12",children:[r.jsx("div",{className:"text-muted-foreground mb-4",children:N?"No templates match your filters":"No templates available yet"}),N&&r.jsx(ee,{variant:"outline",onClick:C,children:"Clear Filters"})]}),!b&&j.length>0&&r.jsx("div",{className:i==="grid"?"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6":"space-y-4",children:j.map(E=>r.jsxs(Ye,{className:`group overflow-hidden hover:shadow-lg transition-all duration-200 cursor-pointer ${i==="list"?"flex flex-row":""}`,onClick:()=>A(E.id),children:[r.jsxs("div",{className:`relative overflow-hidden bg-muted ${i==="list"?"w-48 shrink-0":"aspect-[3/2]"}`,children:[E.preview_image_url?r.jsx("img",{src:E.preview_image_url,alt:E.name,className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-300"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center text-muted-foreground",children:"No Preview"}),E.links.length>1&&r.jsx("div",{className:"absolute top-2 right-2",children:r.jsxs(Ot,{variant:"secondary",className:"gap-1 bg-background/90 backdrop-blur-sm !text-secondary",children:[r.jsx(Co,{className:"h-3 w-3"}),E.links.length]})})]}),r.jsxs(tt,{className:`p-4 flex flex-col ${i==="list"?"flex-1":""}`,children:[r.jsx("h3",{className:"font-semibold text-foreground line-clamp-1 mb-1",children:E.name}),E.description&&r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 mb-3 flex-1",children:Sne(E.description)}),r.jsxs("div",{className:"flex flex-wrap gap-2 mb-3",children:[E.category&&r.jsx(Ot,{variant:"secondary",className:"text-xs",children:E.category.name}),E.type&&r.jsx(Ot,{variant:"outline",className:"text-xs",children:E.type.name})]}),r.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground mb-3",children:[r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(pd,{className:"h-3.5 w-3.5"}),E.likesCount]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Fl,{className:"h-3.5 w-3.5"}),E.commentsCount]})]}),r.jsxs(ee,{size:"sm",className:"w-full gap-2",onClick:T=>{T.stopPropagation(),A(E.id)},children:[r.jsx(Fs,{className:"h-4 w-4"}),"View Template"]})]})]},E.id))})]})})};var gmt="Separator",bke="horizontal",xmt=["horizontal","vertical"],CDe=I.forwardRef((t,e)=>{const{decorative:n,orientation:s=bke,...a}=t,o=ymt(s)?s:bke,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})});CDe.displayName=gmt;function ymt(t){return xmt.includes(t)}var MDe=CDe;const ou=I.forwardRef(({className:t,orientation:e="horizontal",decorative:n=!0,...s},a)=>r.jsx(MDe,{ref:a,decorative:n,orientation:e,className:$t("shrink-0 bg-border",e==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",t),...s}));ou.displayName=MDe.displayName;const MI=()=>({trackEngagement:I.useCallback(async(e,n,s,a="view")=>{try{const{data:{user:o}}=await J.auth.getUser();if(!o)return;await J.from("content_engagement_logs").insert({user_id:o.id,resource_type:e,resource_id:n,resource_title:s,action_type:a})}catch(o){console.error("Error tracking engagement:",o)}},[])}),vmt=()=>{const{templateId:t}=Zc(),{user:e,isAdmin:n}=Qr(),{toast:s}=fi(),a=Vr(),{trackEngagement:o}=MI(),[l,i]=I.useState(""),{data:h,isLoading:p}=Yt({queryKey:["template-detail",t],queryFn:async()=>{const{data:T,error:L}=await J.from("canva_templates").select(` *, category:template_categories(id, name), type:template_types(id, name) `).eq("id",t).single();if(L)throw L;const{data:z}=await J.from("template_links").select("*").eq("template_id",t).order("sort_order"),{data:F}=await J.from("template_guides").select("*").eq("template_id",t).order("sort_order");return{...T,links:z||[],guides:F||[]}},enabled:!!t});I.useEffect(()=>{h&&o("template",h.id,h.name,"view")},[h==null?void 0:h.id]);const{data:x=[]}=Yt({queryKey:["template-likes",t],queryFn:async()=>{const{data:T,error:L}=await J.from("template_likes").select("*").eq("template_id",t);if(L)throw L;return T},enabled:!!t}),{data:y=[]}=Yt({queryKey:["template-comments",t],queryFn:async()=>{const{data:T,error:L}=await J.from("template_comments").select("*").eq("template_id",t).order("created_at",{ascending:!1});if(L)throw L;const z=[...new Set(T.map(H=>H.user_id))],{data:F}=await J.from("profiles").select("id, name").in("id",z),q=new Map((F==null?void 0:F.map(H=>[H.id,H.name]))||[]);return T.map(H=>({...H,user_name:q.get(H.user_id)||"Unknown User"}))},enabled:!!t}),b=cr({mutationFn:async T=>{const{error:L}=await J.from("template_comments").insert({template_id:t,user_id:e.id,content:T});if(L)throw L},onSuccess:()=>{a.invalidateQueries({queryKey:["template-comments",t]}),i(""),s({title:"Comment added!"})},onError:T=>{s({title:"Error adding comment",description:T.message,variant:"destructive"})}}),j=cr({mutationFn:async T=>{const{error:L}=await J.from("template_comments").delete().eq("id",T);if(L)throw L},onSuccess:()=>{a.invalidateQueries({queryKey:["template-comments",t]}),s({title:"Comment deleted"})}}),C=cr({mutationFn:async()=>{const T=x.find(L=>L.user_id===(e==null?void 0:e.id));if(T){const{error:L}=await J.from("template_likes").delete().eq("id",T.id);if(L)throw L}else{const{error:L}=await J.from("template_likes").insert({template_id:t,user_id:e.id});if(L)throw L}},onSuccess:()=>{a.invalidateQueries({queryKey:["template-likes",t]})}}),N=x.some(T=>T.user_id===(e==null?void 0:e.id)),A=T=>T.split(" ").map(L=>L[0]).join("").toUpperCase().slice(0,2),E=T=>{T.preventDefault(),!(!l.trim()||!e)&&b.mutate(l.trim())};return p?r.jsx(Lr,{title:"Templates",children:r.jsx("div",{className:"flex justify-center py-12",children:r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})})}):h?r.jsx(Lr,{title:h.name,children:r.jsxs("div",{className:"space-y-6 max-w-5xl mx-auto",children:[r.jsx(ee,{variant:"ghost",size:"sm",asChild:!0,className:"gap-2",children:r.jsxs(co,{to:"/templates",children:[r.jsx(so,{className:"h-4 w-4"}),"Back to Templates"]})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx("h1",{className:"text-2xl font-bold text-foreground",children:h.name}),r.jsxs("div",{className:"flex flex-wrap gap-2",children:[h.category&&r.jsx(Ot,{variant:"secondary",children:h.category.name}),h.type&&r.jsx(Ot,{variant:"outline",children:h.type.name})]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[n&&r.jsx(ee,{variant:"outline",className:"gap-2 rounded-full",asChild:!0,children:r.jsxs(co,{to:`/admin/templates?edit=${h.id}`,children:[r.jsx(_i,{className:"h-4 w-4"}),r.jsx("span",{children:"Edit"})]})}),r.jsx(u3,{resourceType:"template",resourceId:h.id,resourceTitle:h.name,size:"default",className:"rounded-full"}),r.jsxs(ee,{variant:N?"default":"outline",className:"gap-2 rounded-full",onClick:()=>C.mutate(),disabled:!e||C.isPending,children:[r.jsx(pd,{className:`h-4 w-4 ${N?"fill-current":""}`}),x.length," ",x.length===1?"Like":"Likes"]})]})]}),h.description&&r.jsx("div",{className:"text-muted-foreground prose prose-sm max-w-none dark:prose-invert [&>p]:mb-4 [&>p:last-child]:mb-0 whitespace-pre-line",dangerouslySetInnerHTML:{__html:h.description}})]}),r.jsx(Ye,{children:r.jsxs(tt,{className:"pt-6",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 mb-4",children:[r.jsx(Co,{className:"h-4 w-4"}),h.links.length===1?"Template Link":"Template Links"]}),r.jsx("div",{className:"grid gap-2",children:h.links.map(T=>r.jsxs(ee,{variant:"outline",className:"w-full justify-between gap-2 h-auto py-3",onClick:()=>{o("template",h.id,h.name,"click_canva"),window.open(T.canva_share_link,"_blank")},children:[r.jsx("span",{className:"font-medium",children:T.title}),r.jsx(Fs,{className:"h-4 w-4 text-muted-foreground"})]},T.id))})]})}),h.video_url&&r.jsx(Ye,{children:r.jsx(tt,{className:"pt-6",children:r.jsx("div",{className:"aspect-video w-full rounded-lg overflow-hidden",children:r.jsx("iframe",{src:h.video_url,className:"w-full h-full",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0})})})}),h.guides&&h.guides.length>0&&r.jsx(Ye,{children:r.jsxs(tt,{className:"pt-6",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 mb-4",children:[r.jsx(La,{className:"h-4 w-4"}),"Guide Files"]}),r.jsx("div",{className:"grid gap-2",children:h.guides.map(T=>r.jsxs(ee,{variant:"outline",className:"w-full justify-between gap-2 h-auto py-3",onClick:()=>{o("template",h.id,h.name,"click_pdf"),window.open(T.file_url,"_blank")},children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(La,{className:"h-4 w-4 text-muted-foreground"}),r.jsx("span",{className:"font-medium",children:T.name}),T.file_size&&r.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",(T.file_size/1024).toFixed(0)," KB)"]})]}),r.jsx(no,{className:"h-4 w-4 text-muted-foreground"})]},T.id))})]})}),r.jsx(ou,{}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 text-lg",children:[r.jsx(Fl,{className:"h-5 w-5"}),"Comments (",y.length,")"]}),e?r.jsxs("form",{onSubmit:E,className:"flex gap-2",children:[r.jsx(ps,{placeholder:"Add a comment...",value:l,onChange:T=>i(T.target.value),className:"min-h-[80px] resize-none flex-1"}),r.jsx(ee,{type:"submit",size:"icon",className:"h-10 w-10",disabled:!l.trim()||b.isPending,children:r.jsx(Oo,{className:"h-4 w-4"})})]}):r.jsx("p",{className:"text-sm text-muted-foreground",children:"Log in to add a comment"}),r.jsx("div",{className:"space-y-4",children:y.length===0?r.jsx(Ye,{children:r.jsx(tt,{className:"py-8 text-center",children:r.jsx("p",{className:"text-muted-foreground",children:"No comments yet. Be the first to share your thoughts!"})})}):y.map(T=>r.jsx(Ye,{children:r.jsx(tt,{className:"pt-4 pb-4",children:r.jsxs("div",{className:"flex gap-3",children:[r.jsx(Ks,{className:"h-10 w-10 flex-shrink-0",children:r.jsx(Zs,{className:"text-sm",children:A(T.user_name||"U")})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[r.jsx("span",{className:"font-medium",children:T.user_name}),r.jsx("span",{className:"text-sm text-muted-foreground",children:cu(new Date(T.created_at),{addSuffix:!0})}),T.user_id===(e==null?void 0:e.id)&&r.jsx(ee,{variant:"ghost",size:"icon",className:"h-6 w-6 ml-auto",onClick:()=>j.mutate(T.id),children:r.jsx(Vn,{className:"h-3 w-3 text-muted-foreground"})})]}),r.jsx("p",{className:"text-sm whitespace-pre-wrap",children:T.content})]})]})})},T.id))})]})]})}):r.jsx(Lr,{title:"Templates",children:r.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[r.jsx(Co,{className:"h-12 w-12 text-muted-foreground mb-4"}),r.jsx("h3",{className:"text-lg font-semibold",children:"Template not found"}),r.jsx("p",{className:"text-muted-foreground mt-1",children:"This template may have been removed or is not available."}),r.jsx(ee,{asChild:!0,className:"mt-4",children:r.jsx(co,{to:"/templates",children:"Back to Templates"})})]})})},_mt=()=>{const{user:t}=Qr(),[e,n]=I.useState(""),[s,a]=I.useState("all"),{data:o=[]}=Yt({queryKey:["academy-categories"],queryFn:async()=>{const{data:b,error:j}=await J.from("academy_categories").select("*").order("sort_order",{ascending:!0});if(j)throw j;return b}}),{data:l=[],isLoading:i}=Yt({queryKey:["academy-videos"],queryFn:async()=>{const{data:b,error:j}=await J.from("academy_videos").select(` *, category:academy_categories(id, name) `).eq("is_published",!0).order("publish_date",{ascending:!1});if(j)throw j;const{data:C,error:N}=await J.from("academy_resources").select("*").order("sort_order");if(N)throw N;return b.map(E=>({...E,resources:(C==null?void 0:C.filter(T=>T.video_id===E.id))||[]}))}}),{data:h=[]}=Yt({queryKey:["academy-video-likes"],queryFn:async()=>{const{data:b,error:j}=await J.from("academy_video_likes").select("video_id, user_id");if(j)throw j;return b}}),p=l.filter(b=>{var N;const j=e===""||b.title.toLowerCase().includes(e.toLowerCase())||((N=b.description)==null?void 0:N.toLowerCase().includes(e.toLowerCase())),C=s==="all"||b.category_id===s;return j&&C}),x=b=>h.filter(j=>j.video_id===b).length,y=b=>h.some(j=>j.video_id===b&&j.user_id===(t==null?void 0:t.id));return r.jsx(Lr,{title:"Academy",children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-5xl font-bold text-foreground",children:"Academy"}),r.jsx("p",{className:"text-muted-foreground mt-1",children:"On-demand training videos and resources"})]}),r.jsx("div",{className:"flex flex-col sm:flex-row gap-4",children:r.jsxs("div",{className:"relative flex-1",children:[r.jsx(wa,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(dt,{placeholder:"Search videos...",value:e,onChange:b=>n(b.target.value),className:"pl-10"})]})}),r.jsx(Ii,{value:s,onValueChange:a,children:r.jsxs(wi,{className:"w-full justify-start flex-wrap h-auto gap-2 bg-transparent p-0",children:[r.jsx(ln,{value:"all",className:"data-[state=active]:bg-primary data-[state=active]:text-primary-foreground",children:"All Videos"}),o.map(b=>r.jsx(ln,{value:b.id,className:"data-[state=active]:bg-primary data-[state=active]:text-primary-foreground",children:b.name},b.id))]})}),i?r.jsx("div",{className:"flex justify-center py-12",children:r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})}):p.length===0?r.jsx(Ye,{children:r.jsxs(tt,{className:"flex flex-col items-center justify-center py-12 text-center",children:[r.jsx(Pa,{className:"h-12 w-12 text-muted-foreground mb-4"}),r.jsx("h3",{className:"text-lg font-semibold",children:"No videos found"}),r.jsx("p",{className:"text-muted-foreground mt-1",children:e?"Try adjusting your search terms":"Check back soon for new content"})]})}):r.jsx("div",{className:"grid gap-6 sm:grid-cols-2 lg:grid-cols-3",children:p.map(b=>r.jsx(co,{to:`/academy/${b.id}`,children:r.jsxs(Ye,{className:"overflow-hidden cursor-pointer hover:shadow-lg transition-shadow group h-full",children:[r.jsxs("div",{className:"relative aspect-video bg-muted",children:[b.thumbnail_url?r.jsx("img",{src:b.thumbnail_url,alt:b.title,className:"w-full h-full object-cover"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center",children:r.jsx(Pa,{className:"h-12 w-12 text-muted-foreground"})}),r.jsx("div",{className:"absolute inset-0 bg-black/40 opacity-0 group-hover:opacity-100 transition-opacity flex items-center justify-center",children:r.jsx("div",{className:"w-16 h-16 rounded-full bg-primary/90 flex items-center justify-center",children:r.jsx(hc,{className:"h-8 w-8 text-primary-foreground ml-1"})})}),b.duration&&r.jsxs("div",{className:"absolute bottom-2 right-2 bg-black/70 text-white text-xs px-2 py-1 rounded flex items-center gap-1",children:[r.jsx(Ya,{className:"h-3 w-3"}),b.duration]})]}),r.jsxs(Gt,{className:"pb-2",children:[r.jsx("div",{className:"flex items-start justify-between gap-2",children:r.jsx(Zt,{className:"text-lg line-clamp-2",children:b.title})}),b.category&&r.jsx(Ot,{variant:"secondary",className:"w-fit",children:b.category.name})]}),r.jsxs(tt,{className:"pt-0",children:[b.description&&r.jsx(Mn,{className:"line-clamp-2",children:b.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(pd,{className:`h-4 w-4 ${y(b.id)?"fill-primary text-primary":""}`}),x(b.id)]}),b.resources&&b.resources.length>0&&r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(La,{className:"h-4 w-4"}),b.resources.length]})]})]})]})},b.id))})]})})},bmt=(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},wmt=()=>{const{videoId:t}=Zc();rs();const{user:e}=Qr(),{toast:n}=fi(),s=Vr(),{trackEngagement:a}=MI(),[o,l]=I.useState(""),{data:i,isLoading:h}=Yt({queryKey:["academy-video",t],queryFn:async()=>{const{data:T,error:L}=await J.from("academy_videos").select(` *, category:academy_categories(id, name) `).eq("id",t).eq("is_published",!0).single();if(L)throw L;const{data:z}=await J.from("academy_resources").select("*").eq("video_id",t).order("sort_order");return{...T,resources:z||[]}},enabled:!!t});I.useEffect(()=>{i&&a("academy_video",i.id,i.title,"view")},[i==null?void 0:i.id]);const{data:p=[]}=Yt({queryKey:["academy-video-likes",t],queryFn:async()=>{const{data:T,error:L}=await J.from("academy_video_likes").select("*").eq("video_id",t);if(L)throw L;return T},enabled:!!t}),{data:x=[]}=Yt({queryKey:["academy-video-comments",t],queryFn:async()=>{const{data:T,error:L}=await J.from("academy_video_comments").select("*").eq("video_id",t).order("created_at",{ascending:!1});if(L)throw L;const z=[...new Set(T.map(H=>H.user_id))],{data:F}=await J.from("profiles").select("id, name").in("id",z),q=new Map((F==null?void 0:F.map(H=>[H.id,H.name]))||[]);return T.map(H=>({...H,user_name:q.get(H.user_id)||"Unknown User"}))},enabled:!!t}),y=cr({mutationFn:async T=>{const{error:L}=await J.from("academy_video_comments").insert({video_id:t,user_id:e.id,content:T});if(L)throw L},onSuccess:()=>{s.invalidateQueries({queryKey:["academy-video-comments",t]}),l(""),n({title:"Comment added!"})},onError:T=>{n({title:"Error adding comment",description:T.message,variant:"destructive"})}}),b=cr({mutationFn:async T=>{const{error:L}=await J.from("academy_video_comments").delete().eq("id",T);if(L)throw L},onSuccess:()=>{s.invalidateQueries({queryKey:["academy-video-comments",t]}),n({title:"Comment deleted"})}}),j=cr({mutationFn:async()=>{const T=p.find(L=>L.user_id===(e==null?void 0:e.id));if(T){const{error:L}=await J.from("academy_video_likes").delete().eq("id",T.id);if(L)throw L}else{const{error:L}=await J.from("academy_video_likes").insert({video_id:t,user_id:e.id});if(L)throw L}},onSuccess:()=>{s.invalidateQueries({queryKey:["academy-video-likes",t]})}}),C=p.some(T=>T.user_id===(e==null?void 0:e.id)),N=T=>{switch(T==null?void 0:T.toLowerCase()){case"pdf":return"📄";case"pptx":case"ppt":return"📊";case"xlsx":case"xls":return"📈";case"docx":case"doc":return"📝";case"zip":return"📦";default:return"📁"}},A=T=>T.split(" ").map(L=>L[0]).join("").toUpperCase().slice(0,2),E=T=>{T.preventDefault(),!(!o.trim()||!e)&&y.mutate(o.trim())};return h?r.jsx(Lr,{title:"Academy",children:r.jsx("div",{className:"flex justify-center py-12",children:r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})})}):i?r.jsx(Lr,{title:i.title,children:r.jsxs("div",{className:"space-y-6 max-w-5xl mx-auto",children:[r.jsx(ee,{variant:"ghost",size:"sm",asChild:!0,className:"gap-2",children:r.jsxs(co,{to:"/academy",children:[r.jsx(so,{className:"h-4 w-4"}),"Back to Academy"]})}),r.jsx("div",{className:"relative w-full rounded-lg overflow-hidden bg-black",style:{paddingTop:"56.25%"},children:["youtube","vimeo","loom","bunny_stream"].includes(i.video_type)?r.jsx("iframe",{src:bmt(i.video_url,i.video_type),loading:"lazy",style:{border:0,position:"absolute",top:0,left:0,height:"100%",width:"100%"},allow:"accelerometer; gyroscope; autoplay; encrypted-media; picture-in-picture",allowFullScreen:!0}):r.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center text-white gap-4",children:[r.jsx(Pa,{className:"h-16 w-16 opacity-50"}),r.jsx(ee,{variant:"secondary",asChild:!0,children:r.jsxs("a",{href:i.video_url,target:"_blank",rel:"noopener noreferrer",className:"gap-2",children:[r.jsx(Fs,{className:"h-4 w-4"}),"Open Video"]})})]})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx("h1",{className:"text-2xl font-bold text-foreground",children:i.title}),i.category&&r.jsx(Ot,{variant:"secondary",children:i.category.name})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(u3,{resourceType:"academy_video",resourceId:i.id,resourceTitle:i.title}),r.jsxs(ee,{variant:C?"default":"outline",className:"gap-2 w-fit",onClick:()=>j.mutate(),disabled:!e||j.isPending,children:[r.jsx(pd,{className:`h-4 w-4 ${C?"fill-current":""}`}),p.length," ",p.length===1?"Like":"Likes"]})]})]}),i.description&&r.jsx("div",{className:"text-muted-foreground prose prose-sm max-w-none dark:prose-invert",dangerouslySetInnerHTML:{__html:i.description}})]}),i.resources&&i.resources.length>0&&r.jsx(Ye,{children:r.jsxs(tt,{className:"pt-6",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 mb-4",children:[r.jsx(La,{className:"h-4 w-4"}),"Resources"]}),r.jsx("div",{className:"grid gap-2",children:i.resources.map(T=>r.jsxs("a",{href:T.file_url,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-3 p-3 rounded-lg border hover:bg-muted transition-colors",children:[r.jsx("span",{className:"text-2xl",children:N(T.file_type)}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"font-medium truncate",children:T.title}),r.jsx("p",{className:"text-xs text-muted-foreground uppercase",children:T.file_type})]}),r.jsx(no,{className:"h-4 w-4 text-muted-foreground"})]},T.id))})]})}),r.jsx(ou,{}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 text-lg",children:[r.jsx(Fl,{className:"h-5 w-5"}),"Comments (",x.length,")"]}),e?r.jsxs("form",{onSubmit:E,className:"flex gap-2",children:[r.jsx(ps,{placeholder:"Add a comment...",value:o,onChange:T=>l(T.target.value),className:"min-h-[80px] resize-none flex-1"}),r.jsx(ee,{type:"submit",size:"icon",className:"h-10 w-10",disabled:!o.trim()||y.isPending,children:r.jsx(Oo,{className:"h-4 w-4"})})]}):r.jsx("p",{className:"text-sm text-muted-foreground",children:"Log in to add a comment"}),r.jsx("div",{className:"space-y-4",children:x.length===0?r.jsx(Ye,{children:r.jsx(tt,{className:"py-8 text-center",children:r.jsx("p",{className:"text-muted-foreground",children:"No comments yet. Be the first to share your thoughts!"})})}):x.map(T=>r.jsx(Ye,{children:r.jsx(tt,{className:"pt-4 pb-4",children:r.jsxs("div",{className:"flex gap-3",children:[r.jsx(Ks,{className:"h-10 w-10 flex-shrink-0",children:r.jsx(Zs,{className:"text-sm",children:A(T.user_name||"U")})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[r.jsx("span",{className:"font-medium",children:T.user_name}),r.jsx("span",{className:"text-sm text-muted-foreground",children:cu(new Date(T.created_at),{addSuffix:!0})}),T.user_id===(e==null?void 0:e.id)&&r.jsx(ee,{variant:"ghost",size:"icon",className:"h-6 w-6 ml-auto",onClick:()=>b.mutate(T.id),children:r.jsx(Vn,{className:"h-3 w-3 text-muted-foreground"})})]}),r.jsx("p",{className:"text-sm whitespace-pre-wrap",children:T.content})]})]})})},T.id))})]})]})}):r.jsx(Lr,{title:"Academy",children:r.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[r.jsx(Pa,{className:"h-12 w-12 text-muted-foreground mb-4"}),r.jsx("h3",{className:"text-lg font-semibold",children:"Video not found"}),r.jsx("p",{className:"text-muted-foreground mt-1",children:"This video may have been removed or is not available."}),r.jsx(ee,{asChild:!0,className:"mt-4",children:r.jsx(co,{to:"/academy",children:"Back to Academy"})})]})})};function jmt(){const t=rs(),[e,n]=I.useState(""),{data:s,isLoading:a}=Yt({queryKey:["resource-kits-published"],queryFn:async()=>{const{data:j,error:C}=await J.from("resource_kits").select("*").eq("is_published",!0).order("publish_date",{ascending:!1});if(C)throw C;return j}}),{data:o}=Yt({queryKey:["resource-kit-files-all"],queryFn:async()=>{const{data:j,error:C}=await J.from("resource_kit_files").select("*").order("sort_order",{ascending:!0});if(C)throw C;return j}}),{data:l}=Yt({queryKey:["resource-kit-likes-all"],queryFn:async()=>{const{data:j,error:C}=await J.from("resource_kit_likes").select("kit_id");if(C)throw C;return j}}),{data:i}=Yt({queryKey:["resource-kit-comments-all"],queryFn:async()=>{const{data:j,error:C}=await J.from("resource_kit_comments").select("kit_id");if(C)throw C;return j}}),h=s==null?void 0:s.filter(j=>{var C;return j.name.toLowerCase().includes(e.toLowerCase())||((C=j.description)==null?void 0:C.toLowerCase().includes(e.toLowerCase()))}),p=j=>(o==null?void 0:o.filter(C=>C.kit_id===j))||[],x=j=>(l==null?void 0:l.filter(C=>C.kit_id===j).length)||0,y=j=>(i==null?void 0:i.filter(C=>C.kit_id===j).length)||0,b=j=>{t(`/toolbox/${j}`)};return r.jsx(Lr,{title:"Toolbox",description:"Download resource kits and tools to help grow your business",children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-5xl font-bold text-foreground",children:"Toolbox"}),r.jsx("p",{className:"text-muted-foreground mt-1",children:"Download resource kits and tools to help grow your business"})]}),r.jsxs("div",{className:"relative max-w-md",children:[r.jsx(wa,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(dt,{placeholder:"Search resource kits...",value:e,onChange:j=>n(j.target.value),className:"pl-10"})]}),!a&&r.jsxs("p",{className:"text-sm text-muted-foreground",children:[(h==null?void 0:h.length)||0," resource kit",(h==null?void 0:h.length)!==1?"s":""," available"]}),a?r.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6",children:[...Array(8)].map((j,C)=>r.jsx(Ye,{children:r.jsxs(tt,{className:"p-4",children:[r.jsx(Ir,{className:"aspect-[4/3] w-full rounded-lg mb-4"}),r.jsx(Ir,{className:"h-5 w-3/4 mb-2"}),r.jsx(Ir,{className:"h-4 w-full mb-4"}),r.jsx(Ir,{className:"h-4 w-2/3"})]})},C))}):(h==null?void 0:h.length)===0?r.jsxs(Ye,{className:"p-12 text-center",children:[r.jsx(zl,{className:"h-12 w-12 mx-auto text-muted-foreground mb-4"}),r.jsx("h3",{className:"text-lg font-medium mb-2",children:"No resource kits found"}),r.jsx("p",{className:"text-muted-foreground",children:e?"Try adjusting your search terms":"Check back later for new resources"})]}):r.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6",children:h==null?void 0:h.map(j=>{const C=p(j.id).length,N=x(j.id),A=y(j.id);return r.jsxs(Ye,{className:"group overflow-hidden cursor-pointer hover:shadow-lg transition-all duration-200",onClick:()=>b(j.id),children:[r.jsx("div",{className:"relative overflow-hidden bg-muted aspect-[3/2]",children:j.featured_image_url?r.jsx("img",{src:j.featured_image_url,alt:j.name,className:"w-full h-full object-contain group-hover:scale-105 transition-transform duration-300"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center",children:r.jsx(zl,{className:"h-16 w-16 text-muted-foreground"})})}),r.jsxs(tt,{className:"p-4",children:[r.jsx("h3",{className:"font-semibold text-foreground line-clamp-1 mb-1",children:j.name}),j.description&&r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 mb-3",children:Sne(j.description)}),r.jsxs("div",{className:"flex items-center justify-between text-sm text-muted-foreground",children:[r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(La,{className:"h-4 w-4"}),C," file",C!==1?"s":""]}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(pd,{className:"h-3.5 w-3.5"}),N]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Fl,{className:"h-3.5 w-3.5"}),A]})]})]})]})]},j.id)})})]})})}const kmt=()=>{const{kitId:t}=Zc(),{user:e,isAdmin:n}=Qr(),{toast:s}=fi(),a=Vr(),{trackEngagement:o}=MI(),[l,i]=I.useState(""),{data:h,isLoading:p}=Yt({queryKey:["resource-kit-detail",t],queryFn:async()=>{const{data:L,error:z}=await J.from("resource_kits").select("*").eq("id",t).eq("is_published",!0).single();if(z)throw z;const{data:F}=await J.from("resource_kit_files").select("*").eq("kit_id",t).order("sort_order"),{data:q}=await J.from("resource_kit_links").select("*").eq("kit_id",t).order("sort_order");return{...L,files:F||[],links:q||[]}},enabled:!!t});I.useEffect(()=>{h&&o("toolbox",h.id,h.name,"view")},[h==null?void 0:h.id]);const{data:x=[]}=Yt({queryKey:["resource-kit-likes",t],queryFn:async()=>{const{data:L,error:z}=await J.from("resource_kit_likes").select("*").eq("kit_id",t);if(z)throw z;return L},enabled:!!t}),{data:y=[]}=Yt({queryKey:["resource-kit-comments",t],queryFn:async()=>{const{data:L,error:z}=await J.from("resource_kit_comments").select("*").eq("kit_id",t).order("created_at",{ascending:!1});if(z)throw z;const F=[...new Set(L.map(Z=>Z.user_id))],{data:q}=await J.from("profiles").select("id, name").in("id",F),H=new Map((q==null?void 0:q.map(Z=>[Z.id,Z.name]))||[]);return L.map(Z=>({...Z,user_name:H.get(Z.user_id)||"Unknown User"}))},enabled:!!t}),b=cr({mutationFn:async L=>{const{error:z}=await J.from("resource_kit_comments").insert({kit_id:t,user_id:e.id,content:L});if(z)throw z},onSuccess:()=>{a.invalidateQueries({queryKey:["resource-kit-comments",t]}),i(""),s({title:"Comment added!"})},onError:L=>{s({title:"Error adding comment",description:L.message,variant:"destructive"})}}),j=cr({mutationFn:async L=>{const{error:z}=await J.from("resource_kit_comments").delete().eq("id",L);if(z)throw z},onSuccess:()=>{a.invalidateQueries({queryKey:["resource-kit-comments",t]}),s({title:"Comment deleted"})}}),C=cr({mutationFn:async()=>{const L=x.find(z=>z.user_id===(e==null?void 0:e.id));if(L){const{error:z}=await J.from("resource_kit_likes").delete().eq("id",L.id);if(z)throw z}else{const{error:z}=await J.from("resource_kit_likes").insert({kit_id:t,user_id:e.id});if(z)throw z}},onSuccess:()=>{a.invalidateQueries({queryKey:["resource-kit-likes",t]})}}),N=x.some(L=>L.user_id===(e==null?void 0:e.id)),A=L=>L.split(" ").map(z=>z[0]).join("").toUpperCase().slice(0,2),E=L=>L?L<1024?L+" B":L<1024*1024?(L/1024).toFixed(1)+" KB":(L/(1024*1024)).toFixed(1)+" MB":"",T=L=>{L.preventDefault(),!(!l.trim()||!e)&&b.mutate(l.trim())};return p?r.jsx(Lr,{title:"Toolbox",children:r.jsx("div",{className:"flex justify-center py-12",children:r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})})}):h?r.jsx(Lr,{title:h.name,children:r.jsxs("div",{className:"space-y-6 max-w-5xl mx-auto",children:[r.jsx(ee,{variant:"ghost",size:"sm",asChild:!0,className:"gap-2",children:r.jsxs(co,{to:"/toolbox",children:[r.jsx(so,{className:"h-4 w-4"}),"Back to Toolbox"]})}),h.featured_image_url&&r.jsx("div",{className:"relative w-full rounded-lg overflow-hidden bg-muted",children:r.jsx("img",{src:h.featured_image_url,alt:h.name,className:"w-full max-h-[400px] object-cover"})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4",children:[r.jsx("div",{className:"space-y-2",children:r.jsx("h1",{className:"text-2xl font-bold text-foreground",children:h.name})}),r.jsxs("div",{className:"flex items-center gap-2",children:[n&&r.jsx(ee,{variant:"outline",className:"gap-2 rounded-full",asChild:!0,children:r.jsxs(co,{to:`/admin/toolbox?edit=${h.id}`,children:[r.jsx(_i,{className:"h-4 w-4"}),r.jsx("span",{children:"Edit"})]})}),r.jsx(u3,{resourceType:"resource_kit",resourceId:h.id,resourceTitle:h.name,size:"default",className:"rounded-full"}),r.jsxs(ee,{variant:N?"default":"outline",className:"gap-2 rounded-full",onClick:()=>C.mutate(),disabled:!e||C.isPending,children:[r.jsx(pd,{className:`h-4 w-4 ${N?"fill-current":""}`}),x.length," ",x.length===1?"Like":"Likes"]})]})]}),h.description&&r.jsx("div",{className:"text-muted-foreground prose prose-sm max-w-none dark:prose-invert",dangerouslySetInnerHTML:{__html:h.description}})]}),h.files&&h.files.length>0&&r.jsx(Ye,{children:r.jsxs(tt,{className:"pt-6",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 mb-4",children:[r.jsx(La,{className:"h-4 w-4"}),"Included Resources (",h.files.length,")"]}),r.jsx("div",{className:"grid gap-2",children:h.files.map(L=>r.jsxs("a",{href:L.file_url,target:"_blank",rel:"noopener noreferrer",onClick:()=>o("toolbox",h.id,h.name,"click_pdf"),className:"flex items-center justify-between p-3 rounded-lg border hover:bg-muted transition-colors group",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"p-2 rounded-md bg-primary/10",children:r.jsx(La,{className:"h-4 w-4 text-primary"})}),r.jsxs("div",{children:[r.jsx("div",{className:"font-medium text-sm",children:L.name}),L.file_size&&r.jsx("div",{className:"text-xs text-muted-foreground",children:E(L.file_size)})]})]}),r.jsx(no,{className:"h-4 w-4 text-muted-foreground group-hover:text-primary transition-colors"})]},L.id))})]})}),h.links&&h.links.length>0&&r.jsx(Ye,{children:r.jsxs(tt,{className:"pt-6",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 mb-4",children:[r.jsx(Fs,{className:"h-4 w-4"}),"Canva Templates (",h.links.length,")"]}),r.jsx("div",{className:"grid gap-2",children:h.links.map(L=>r.jsxs("a",{href:L.canva_share_link,target:"_blank",rel:"noopener noreferrer",onClick:()=>o("toolbox",h.id,h.name,"click_canva"),className:"flex items-center justify-between p-3 rounded-lg border hover:bg-muted transition-colors group",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"p-2 rounded-md bg-purple-500/10",children:r.jsx(Fs,{className:"h-4 w-4 text-purple-600"})}),r.jsx("div",{className:"font-medium text-sm",children:L.title})]}),r.jsx("span",{className:"text-xs text-muted-foreground group-hover:text-primary transition-colors",children:"Open in Canva"})]},L.id))})]})}),r.jsx(ou,{}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 text-lg",children:[r.jsx(Fl,{className:"h-5 w-5"}),"Comments (",y.length,")"]}),e?r.jsxs("form",{onSubmit:T,className:"flex gap-2",children:[r.jsx(ps,{placeholder:"Add a comment...",value:l,onChange:L=>i(L.target.value),className:"min-h-[80px] resize-none flex-1"}),r.jsx(ee,{type:"submit",size:"icon",className:"h-10 w-10",disabled:!l.trim()||b.isPending,children:r.jsx(Oo,{className:"h-4 w-4"})})]}):r.jsx("p",{className:"text-sm text-muted-foreground",children:"Log in to add a comment"}),r.jsx("div",{className:"space-y-4",children:y.length===0?r.jsx(Ye,{children:r.jsx(tt,{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(L=>r.jsx(Ye,{children:r.jsx(tt,{className:"pt-4 pb-4",children:r.jsxs("div",{className:"flex gap-3",children:[r.jsx(Ks,{className:"h-10 w-10 flex-shrink-0",children:r.jsx(Zs,{className:"text-sm",children:A(L.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:L.user_name}),r.jsx("span",{className:"text-sm text-muted-foreground",children:cu(new Date(L.created_at),{addSuffix:!0})}),L.user_id===(e==null?void 0:e.id)&&r.jsx(ee,{variant:"ghost",size:"icon",className:"h-6 w-6 ml-auto",onClick:()=>j.mutate(L.id),children:r.jsx(Vn,{className:"h-3 w-3 text-muted-foreground"})})]}),r.jsx("p",{className:"text-sm whitespace-pre-wrap",children:L.content})]})]})})},L.id))})]})]})}):r.jsx(Lr,{title:"Toolbox",children:r.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[r.jsx(zl,{className:"h-12 w-12 text-muted-foreground mb-4"}),r.jsx("h3",{className:"text-lg font-semibold",children:"Resource kit not found"}),r.jsx("p",{className:"text-muted-foreground mt-1",children:"This resource kit may have been removed or is not available."}),r.jsx(ee,{asChild:!0,className:"mt-4",children:r.jsx(co,{to:"/toolbox",children:"Back to Toolbox"})})]})})},Nmt=()=>{const t=rs(),[e,n]=I.useState(""),[s,a]=I.useState("grid"),{data:o=[],isLoading:l}=Yt({queryKey:["social-swag"],queryFn:async()=>{const{data:p,error:x}=await J.from("social_swag").select("*").eq("is_published",!0).order("publish_date",{ascending:!1});if(x)throw x;const{data:y,error:b}=await J.from("social_swag_links").select("*").order("sort_order");if(b)throw b;const{data:j}=await J.from("social_swag_likes").select("swag_id"),{data:C}=await J.from("social_swag_comments").select("swag_id"),N=new Map;j==null||j.forEach(T=>{N.set(T.swag_id,(N.get(T.swag_id)||0)+1)});const A=new Map;return C==null||C.forEach(T=>{A.set(T.swag_id,(A.get(T.swag_id)||0)+1)}),(p||[]).map(T=>({...T,links:(y||[]).filter(L=>L.swag_id===T.id)||[],likesCount:N.get(T.id)||0,commentsCount:A.get(T.id)||0}))}}),i=o.filter(p=>{var y;return p.title.toLowerCase().includes(e.toLowerCase())||((y=p.description)==null?void 0:y.toLowerCase().includes(e.toLowerCase()))}),h=p=>{t(`/social-swag/${p}`)};return r.jsx(Lr,{title:"Social Swag",children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold text-foreground",children:"Social Swag"}),r.jsx("p",{className:"text-muted-foreground mt-1",children:"Browse our collection of social media content and graphics"})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[r.jsxs("div",{className:"relative flex-1 max-w-sm",children:[r.jsx(wa,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(dt,{placeholder:"Search social swag...",value:e,onChange:p=>n(p.target.value),className:"pl-9"})]}),r.jsxs("div",{className:"flex gap-2",children:[e&&r.jsx(ee,{variant:"outline",size:"sm",onClick:()=>n(""),children:"Clear"}),r.jsxs("div",{className:"flex gap-1",children:[r.jsx(ee,{variant:s==="grid"?"secondary":"outline",size:"icon",onClick:()=>a("grid"),className:"rounded-full",children:r.jsx(pm,{className:"h-4 w-4"})}),r.jsx(ee,{variant:s==="list"?"secondary":"outline",size:"icon",onClick:()=>a("list"),className:"rounded-full",children:r.jsx(Kf,{className:"h-4 w-4"})})]})]})]}),r.jsxs("div",{className:"text-sm text-muted-foreground",children:[i.length," item",i.length!==1?"s":""," found"]}),l&&r.jsx("div",{className:s==="grid"?"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6":"space-y-4",children:[...Array(8)].map((p,x)=>r.jsx(Ye,{children:r.jsxs(tt,{className:"p-4",children:[r.jsx(Ir,{className:"aspect-[4/3] w-full rounded-lg mb-4"}),r.jsx(Ir,{className:"h-5 w-3/4 mb-2"}),r.jsx(Ir,{className:"h-4 w-full mb-4"})]})},x))}),!l&&i.length===0&&r.jsxs("div",{className:"text-center py-12",children:[r.jsx("div",{className:"text-muted-foreground mb-4",children:e?"No items match your search":"No social swag available yet"}),e&&r.jsx(ee,{variant:"outline",onClick:()=>n(""),children:"Clear Search"})]}),!l&&i.length>0&&r.jsx("div",{className:s==="grid"?"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6":"space-y-4",children:i.map(p=>r.jsxs(Ye,{className:`group overflow-hidden hover:shadow-lg transition-all duration-200 cursor-pointer ${s==="list"?"flex flex-row":""}`,onClick:()=>h(p.id),children:[r.jsxs("div",{className:`relative overflow-hidden bg-muted ${s==="list"?"w-48 shrink-0":"aspect-[3/2]"}`,children:[p.preview_image_url?r.jsx("img",{src:p.preview_image_url,alt:p.title,className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-300"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center text-muted-foreground",children:"No Preview"}),p.links.length>1&&r.jsx("div",{className:"absolute top-2 right-2",children:r.jsxs(Ot,{variant:"secondary",className:"gap-1 bg-background/90 backdrop-blur-sm",children:[r.jsx(Co,{className:"h-3 w-3"}),p.links.length]})})]}),r.jsxs(tt,{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(pd,{className:"h-3.5 w-3.5"}),p.likesCount]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Fl,{className:"h-3.5 w-3.5"}),p.commentsCount]})]}),r.jsxs(ee,{size:"sm",className:"w-full gap-2",onClick:x=>{x.stopPropagation(),h(p.id)},children:[r.jsx(Fs,{className:"h-4 w-4"}),"View Details"]})]})]},p.id))})]})})};var Ea=function(){return Ea=Object.assign||function(e){for(var n,s=1,a=arguments.length;s1&&(h||!p),y=e>1&&(p||!h),b=function(){s&&o(s)},j=function(){a&&o(a)};return r.jsx(sgt,{displayMonth:t.displayMonth,hideNext:x,hidePrevious:y,nextMonth:a,previousMonth:s,onPreviousClick:b,onNextClick:j})}function agt(t){var e,n=el(),s=n.classNames,a=n.disableNavigation,o=n.styles,l=n.captionLayout,i=n.components,h=(e=i==null?void 0:i.CaptionLabel)!==null&&e!==void 0?e:EDe,p;return a?p=r.jsx(h,{id:t.id,displayMonth:t.displayMonth}):l==="dropdown"?p=r.jsx(wke,{displayMonth:t.displayMonth,id:t.id}):l==="dropdown-buttons"?p=r.jsxs(r.Fragment,{children:[r.jsx(wke,{displayMonth:t.displayMonth,displayIndex:t.displayIndex,id:t.id}),r.jsx(jke,{displayMonth:t.displayMonth,displayIndex:t.displayIndex,id:t.id})]}):p=r.jsxs(r.Fragment,{children:[r.jsx(h,{id:t.id,displayMonth:t.displayMonth,displayIndex:t.displayIndex}),r.jsx(jke,{displayMonth:t.displayMonth,id:t.id})]}),r.jsx("div",{className:s.caption,style:o.caption,children:p})}function igt(t){var e=el(),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 ogt(t,e,n){for(var s=n?ay(new Date):df(new Date,{locale:t,weekStartsOn:e}),a=[],o=0;o<7;o++){var l=Kl(s,o);a.push(l)}return a}function lgt(){var t=el(),e=t.classNames,n=t.styles,s=t.showWeekNumber,a=t.locale,o=t.weekStartsOn,l=t.ISOWeek,i=t.formatters.formatWeekdayName,h=t.labels.labelWeekday,p=ogt(a,o,l);return r.jsxs("tr",{style:n.head_row,className:e.head_row,children:[s&&r.jsx("td",{style:n.head_cell,className:e.head_cell}),p.map(function(x,y){return r.jsx("th",{scope:"col",className:e.head_cell,style:n.head_cell,"aria-label":h(x,{locale:a}),children:i(x,{locale:a})},y)})]})}function cgt(){var t,e=el(),n=e.classNames,s=e.styles,a=e.components,o=(t=a==null?void 0:a.HeadRow)!==null&&t!==void 0?t:lgt;return r.jsx("thead",{style:s.head,className:n.head,children:r.jsx(o,{})})}function dgt(t){var e=el(),n=e.locale,s=e.formatters.formatDay;return r.jsx(r.Fragment,{children:s(t.date,{locale:n})})}var kxe=I.createContext(void 0);function ugt(t){if(!TI(t.initialProps)){var e={selected:void 0,modifiers:{disabled:[]}};return r.jsx(kxe.Provider,{value:e,children:t.children})}return r.jsx(hgt,{initialProps:t.initialProps,children:t.children})}function hgt(t){var e=t.initialProps,n=t.children,s=e.selected,a=e.min,o=e.max,l=function(p,x,y){var b,j;(b=e.onDayClick)===null||b===void 0||b.call(e,p,x,y);var C=!!(x.selected&&a&&(s==null?void 0:s.length)===a);if(!C){var N=!!(!x.selected&&o&&(s==null?void 0:s.length)===o);if(!N){var A=s?TDe([],s):[];if(x.selected){var E=A.findIndex(function(T){return Ql(p,T)});A.splice(E,1)}else A.push(p);(j=e.onSelect)===null||j===void 0||j.call(e,A,p,x,y)}}},i={disabled:[]};s&&i.disabled.push(function(p){var x=o&&s.length>o-1,y=s.some(function(b){return Ql(b,p)});return!!(x&&!y)});var h={selected:s,onDayClick:l,modifiers:i};return r.jsx(kxe.Provider,{value:h,children:n})}function Nxe(){var t=I.useContext(kxe);if(!t)throw new Error("useSelectMultiple must be used within a SelectMultipleProvider");return t}function fgt(t,e){var n=e||{},s=n.from,a=n.to;return s&&a?Ql(a,t)&&Ql(s,t)?void 0:Ql(a,t)?{from:a,to:void 0}:Ql(s,t)?void 0:fte(s,t)?{from:t,to:a}:{from:s,to:t}:a?fte(t,a)?{from:a,to:t}:{from:t,to:a}:s?fse(t,s)?{from:t,to:s}:{from:s,to:t}:{from:t,to:void 0}}var Sxe=I.createContext(void 0);function pgt(t){if(!AI(t.initialProps)){var e={selected:void 0,modifiers:{range_start:[],range_end:[],range_middle:[],disabled:[]}};return r.jsx(Sxe.Provider,{value:e,children:t.children})}return r.jsx(mgt,{initialProps:t.initialProps,children:t.children})}function mgt(t){var e=t.initialProps,n=t.children,s=e.selected,a=s||{},o=a.from,l=a.to,i=e.min,h=e.max,p=function(j,C,N){var A,E;(A=e.onDayClick)===null||A===void 0||A.call(e,j,C,N);var T=fgt(j,s);(E=e.onSelect)===null||E===void 0||E.call(e,T,j,C,N)},x={range_start:[],range_end:[],range_middle:[],disabled:[]};if(o?(x.range_start=[o],l?(x.range_end=[l],Ql(o,l)||(x.range_middle=[{after:o,before:l}])):x.range_end=[o]):l&&(x.range_start=[l],x.range_end=[l]),i&&(o&&!l&&x.disabled.push({after:Hle(o,i-1),before:Kl(o,i-1)}),o&&l&&x.disabled.push({after:o,before:Kl(o,i-1)}),!o&&l&&x.disabled.push({after:Hle(l,i-1),before:Kl(l,i-1)})),h){if(o&&!l&&(x.disabled.push({before:Kl(o,-h+1)}),x.disabled.push({after:Kl(o,h-1)})),o&&l){var y=om(l,o)+1,b=h-y;x.disabled.push({before:Hle(o,b)}),x.disabled.push({after:Kl(l,b)})}!o&&l&&(x.disabled.push({before:Kl(l,-h+1)}),x.disabled.push({after:Kl(l,h-1)}))}return r.jsx(Sxe.Provider,{value:{selected:s,onDayClick:p,modifiers:x},children:n})}function Cxe(){var t=I.useContext(Sxe);if(!t)throw new Error("useSelectRange must be used within a SelectRangeProvider");return t}function oee(t){return Array.isArray(t)?TDe([],t):t!==void 0?[t]:[]}function ggt(t){var e={};return Object.entries(t).forEach(function(n){var s=n[0],a=n[1];e[s]=oee(a)}),e}var wm;(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"})(wm||(wm={}));var xgt=wm.Selected,fx=wm.Disabled,ygt=wm.Hidden,vgt=wm.Today,Xle=wm.RangeEnd,Qle=wm.RangeMiddle,Jle=wm.RangeStart,_gt=wm.Outside;function bgt(t,e,n){var s,a=(s={},s[xgt]=oee(t.selected),s[fx]=oee(t.disabled),s[ygt]=oee(t.hidden),s[vgt]=[t.today],s[Xle]=[],s[Qle]=[],s[Jle]=[],s[_gt]=[],s);return t.fromDate&&a[fx].push({before:t.fromDate}),t.toDate&&a[fx].push({after:t.toDate}),TI(t)?a[fx]=a[fx].concat(e.modifiers[fx]):AI(t)&&(a[fx]=a[fx].concat(n.modifiers[fx]),a[Jle]=n.modifiers[Jle],a[Qle]=n.modifiers[Qle],a[Xle]=n.modifiers[Xle]),a}var LDe=I.createContext(void 0);function wgt(t){var e=el(),n=Nxe(),s=Cxe(),a=bgt(e,n,s),o=ggt(e.modifiers),l=Ea(Ea({},a),o);return r.jsx(LDe.Provider,{value:l,children:t.children})}function ODe(){var t=I.useContext(LDe);if(!t)throw new Error("useModifiers must be used within a ModifiersProvider");return t}function jgt(t){return!!(t&&typeof t=="object"&&"before"in t&&"after"in t)}function kgt(t){return!!(t&&typeof t=="object"&&"from"in t)}function Ngt(t){return!!(t&&typeof t=="object"&&"after"in t)}function Sgt(t){return!!(t&&typeof t=="object"&&"before"in t)}function Cgt(t){return!!(t&&typeof t=="object"&&"dayOfWeek"in t)}function Mgt(t,e){var n,s=e.from,a=e.to;if(s&&a){var o=om(a,s)<0;o&&(n=[a,s],s=n[0],a=n[1]);var l=om(t,s)>=0&&om(a,t)>=0;return l}return a?Ql(a,t):s?Ql(s,t):!1}function Tgt(t){return exe(t)}function Agt(t){return Array.isArray(t)&&t.every(exe)}function Egt(t,e){return e.some(function(n){if(typeof n=="boolean")return n;if(Tgt(n))return Ql(t,n);if(Agt(n))return n.includes(t);if(kgt(n))return Mgt(t,n);if(Cgt(n))return n.dayOfWeek.includes(t.getDay());if(jgt(n)){var s=om(n.before,t),a=om(n.after,t),o=s>0,l=a<0,i=fte(n.before,n.after);return i?l&&o:o||l}return Ngt(n)?om(t,n.after)>0:Sgt(n)?om(n.before,t)>0:typeof n=="function"?n(t):!1})}function Mxe(t,e,n){var s=Object.keys(e).reduce(function(o,l){var i=e[l];return Egt(t,i)&&o.push(l),o},[]),a={};return s.forEach(function(o){return a[o]=!0}),n&&!lxe(t,n)&&(a.outside=!0),a}function Igt(t,e){for(var n=vh(t[0]),s=use(t[t.length-1]),a,o,l=n;l<=s;){var i=Mxe(l,e),h=!i.disabled&&!i.hidden;if(!h){l=Kl(l,1);continue}if(i.selected)return l;i.today&&!o&&(o=l),a||(a=l),l=Kl(l,1)}return o||a}var Pgt=365;function DDe(t,e){var n=e.moveBy,s=e.direction,a=e.context,o=e.modifiers,l=e.retry,i=l===void 0?{count:0,lastFocused:t}:l,h=a.weekStartsOn,p=a.fromDate,x=a.toDate,y=a.locale,b={day:Kl,week:Bw,month:bh,year:Glt,startOfWeek:function(A){return a.ISOWeek?ay(A):df(A,{locale:y,weekStartsOn:h})},endOfWeek:function(A){return a.ISOWeek?iOe(A):txe(A,{locale:y,weekStartsOn:h})}},j=b[n](t,s==="after"?1:-1);s==="before"&&p?j=Klt([p,j]):s==="after"&&x&&(j=Zlt([x,j]));var C=!0;if(o){var N=Mxe(j,o);C=!N.disabled&&!N.hidden}return C?j:i.count>Pgt?i.lastFocused:DDe(j,{moveBy:n,direction:s,context:a,modifiers:o,retry:Ea(Ea({},i),{count:i.count+1})})}var RDe=I.createContext(void 0);function Lgt(t){var e=EI(),n=ODe(),s=I.useState(),a=s[0],o=s[1],l=I.useState(),i=l[0],h=l[1],p=Igt(e.displayMonths,n),x=a??(i&&e.isDateDisplayed(i))?i:p,y=function(){h(a),o(void 0)},b=function(A){o(A)},j=el(),C=function(A,E){if(a){var T=DDe(a,{moveBy:A,direction:E,context:j,modifiers:n});Ql(a,T)||(e.goToDate(T,a),b(T))}},N={focusedDay:a,focusTarget:x,blur:y,focus:b,focusDayAfter:function(){return C("day","after")},focusDayBefore:function(){return C("day","before")},focusWeekAfter:function(){return C("week","after")},focusWeekBefore:function(){return C("week","before")},focusMonthBefore:function(){return C("month","before")},focusMonthAfter:function(){return C("month","after")},focusYearBefore:function(){return C("year","before")},focusYearAfter:function(){return C("year","after")},focusStartOfWeek:function(){return C("startOfWeek","before")},focusEndOfWeek:function(){return C("endOfWeek","after")}};return r.jsx(RDe.Provider,{value:N,children:t.children})}function Txe(){var t=I.useContext(RDe);if(!t)throw new Error("useFocusContext must be used within a FocusProvider");return t}function Ogt(t,e){var n=ODe(),s=Mxe(t,n,e);return s}var Axe=I.createContext(void 0);function Dgt(t){if(!Nse(t.initialProps)){var e={selected:void 0};return r.jsx(Axe.Provider,{value:e,children:t.children})}return r.jsx(Rgt,{initialProps:t.initialProps,children:t.children})}function Rgt(t){var e=t.initialProps,n=t.children,s=function(o,l,i){var h,p,x;if((h=e.onDayClick)===null||h===void 0||h.call(e,o,l,i),l.selected&&!e.required){(p=e.onSelect)===null||p===void 0||p.call(e,void 0,o,l,i);return}(x=e.onSelect)===null||x===void 0||x.call(e,o,o,l,i)},a={selected:e.selected,onDayClick:s};return r.jsx(Axe.Provider,{value:a,children:n})}function FDe(){var t=I.useContext(Axe);if(!t)throw new Error("useSelectSingle must be used within a SelectSingleProvider");return t}function Fgt(t,e){var n=el(),s=FDe(),a=Nxe(),o=Cxe(),l=Txe(),i=l.focusDayAfter,h=l.focusDayBefore,p=l.focusWeekAfter,x=l.focusWeekBefore,y=l.blur,b=l.focus,j=l.focusMonthBefore,C=l.focusMonthAfter,N=l.focusYearBefore,A=l.focusYearAfter,E=l.focusStartOfWeek,T=l.focusEndOfWeek,L=function(he){var ue,_e,Ae,Ce;Nse(n)?(ue=s.onDayClick)===null||ue===void 0||ue.call(s,t,e,he):TI(n)?(_e=a.onDayClick)===null||_e===void 0||_e.call(a,t,e,he):AI(n)?(Ae=o.onDayClick)===null||Ae===void 0||Ae.call(o,t,e,he):(Ce=n.onDayClick)===null||Ce===void 0||Ce.call(n,t,e,he)},z=function(he){var ue;b(t),(ue=n.onDayFocus)===null||ue===void 0||ue.call(n,t,e,he)},F=function(he){var ue;y(),(ue=n.onDayBlur)===null||ue===void 0||ue.call(n,t,e,he)},q=function(he){var ue;(ue=n.onDayMouseEnter)===null||ue===void 0||ue.call(n,t,e,he)},H=function(he){var ue;(ue=n.onDayMouseLeave)===null||ue===void 0||ue.call(n,t,e,he)},Z=function(he){var ue;(ue=n.onDayPointerEnter)===null||ue===void 0||ue.call(n,t,e,he)},G=function(he){var ue;(ue=n.onDayPointerLeave)===null||ue===void 0||ue.call(n,t,e,he)},te=function(he){var ue;(ue=n.onDayTouchCancel)===null||ue===void 0||ue.call(n,t,e,he)},ie=function(he){var ue;(ue=n.onDayTouchEnd)===null||ue===void 0||ue.call(n,t,e,he)},le=function(he){var ue;(ue=n.onDayTouchMove)===null||ue===void 0||ue.call(n,t,e,he)},ye=function(he){var ue;(ue=n.onDayTouchStart)===null||ue===void 0||ue.call(n,t,e,he)},ne=function(he){var ue;(ue=n.onDayKeyUp)===null||ue===void 0||ue.call(n,t,e,he)},ge=function(he){var ue;switch(he.key){case"ArrowLeft":he.preventDefault(),he.stopPropagation(),n.dir==="rtl"?i():h();break;case"ArrowRight":he.preventDefault(),he.stopPropagation(),n.dir==="rtl"?h():i();break;case"ArrowDown":he.preventDefault(),he.stopPropagation(),p();break;case"ArrowUp":he.preventDefault(),he.stopPropagation(),x();break;case"PageUp":he.preventDefault(),he.stopPropagation(),he.shiftKey?N():j();break;case"PageDown":he.preventDefault(),he.stopPropagation(),he.shiftKey?A():C();break;case"Home":he.preventDefault(),he.stopPropagation(),E();break;case"End":he.preventDefault(),he.stopPropagation(),T();break}(ue=n.onDayKeyDown)===null||ue===void 0||ue.call(n,t,e,he)},ae={onClick:L,onFocus:z,onBlur:F,onKeyDown:ge,onKeyUp:ne,onMouseEnter:q,onMouseLeave:H,onPointerEnter:Z,onPointerLeave:G,onTouchCancel:te,onTouchEnd:ie,onTouchMove:le,onTouchStart:ye};return ae}function zgt(){var t=el(),e=FDe(),n=Nxe(),s=Cxe(),a=Nse(t)?e.selected:TI(t)?n.selected:AI(t)?s.selected:void 0;return a}function Bgt(t){return Object.values(wm).includes(t)}function $gt(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(Bgt(s)){var o=t.classNames["day_".concat(s)];o&&n.push(o)}}),n}function Ugt(t,e){var n=Ea({},t.styles.day);return Object.keys(e).forEach(function(s){var a;n=Ea(Ea({},n),(a=t.modifiersStyles)===null||a===void 0?void 0:a[s])}),n}function qgt(t,e,n){var s,a,o,l=el(),i=Txe(),h=Ogt(t,e),p=Fgt(t,h),x=zgt(),y=!!(l.onDayClick||l.mode!=="default");I.useEffect(function(){var q;h.outside||i.focusedDay&&y&&Ql(i.focusedDay,t)&&((q=n.current)===null||q===void 0||q.focus())},[i.focusedDay,t,n,y,h.outside]);var b=$gt(l,h).join(" "),j=Ugt(l,h),C=!!(h.outside&&!l.showOutsideDays||h.hidden),N=(o=(a=l.components)===null||a===void 0?void 0:a.DayContent)!==null&&o!==void 0?o:dgt,A=r.jsx(N,{date:t,displayMonth:e,activeModifiers:h}),E={style:j,className:b,children:A,role:"gridcell"},T=i.focusTarget&&Ql(i.focusTarget,t)&&!h.outside,L=i.focusedDay&&Ql(i.focusedDay,t),z=Ea(Ea(Ea({},E),(s={disabled:h.disabled,role:"gridcell"},s["aria-selected"]=h.selected,s.tabIndex=L||T?0:-1,s)),p),F={isButton:y,isHidden:C,activeModifiers:h,selectedDays:x,buttonProps:z,divProps:E};return F}function Vgt(t){var e=I.useRef(null),n=qgt(t.date,t.displayMonth,e);return n.isHidden?r.jsx("div",{role:"gridcell"}):n.isButton?r.jsx(vte,Ea({name:"day",ref:e},n.buttonProps)):r.jsx("div",Ea({},n.divProps))}function Hgt(t){var e=t.number,n=t.dates,s=el(),a=s.onWeekNumberClick,o=s.styles,l=s.classNames,i=s.locale,h=s.labels.labelWeekNumber,p=s.formatters.formatWeekNumber,x=p(Number(e),{locale:i});if(!a)return r.jsx("span",{className:l.weeknumber,style:o.weeknumber,children:x});var y=h(Number(e),{locale:i}),b=function(j){a(e,n,j)};return r.jsx(vte,{name:"week-number","aria-label":y,className:l.weeknumber,style:o.weeknumber,onClick:b,children:x})}function Wgt(t){var e,n,s=el(),a=s.styles,o=s.classNames,l=s.showWeekNumber,i=s.components,h=(e=i==null?void 0:i.Day)!==null&&e!==void 0?e:Vgt,p=(n=i==null?void 0:i.WeekNumber)!==null&&n!==void 0?n:Hgt,x;return l&&(x=r.jsx("td",{className:o.cell,style:a.cell,children:r.jsx(p,{number:t.weekNumber,dates:t.dates})})),r.jsxs("tr",{className:o.row,style:a.row,children:[x,t.dates.map(function(y){return r.jsx("td",{className:o.cell,style:a.cell,role:"presentation",children:r.jsx(h,{displayMonth:t.displayMonth,date:y})},Jct(y))})]})}function kke(t,e,n){for(var s=n!=null&&n.ISOWeek?iOe(e):txe(e,n),a=n!=null&&n.ISOWeek?ay(t):df(t,n),o=om(s,a),l=[],i=0;i<=o;i++)l.push(Kl(a,i));var h=l.reduce(function(p,x){var y=n!=null&&n.ISOWeek?rxe(x):sxe(x,n),b=p.find(function(j){return j.weekNumber===y});return b?(b.dates.push(x),p):(p.push({weekNumber:y,dates:[x]}),p)},[]);return h}function Ggt(t,e){var n=kke(vh(t),use(t),e);if(e!=null&&e.useFixedWeeks){var s=tdt(t,e);if(s<6){var a=n[n.length-1],o=a.dates[a.dates.length-1],l=Bw(o,6-s),i=kke(Bw(o,1),l,e);n.push.apply(n,i)}}return n}function Kgt(t){var e,n,s,a=el(),o=a.locale,l=a.classNames,i=a.styles,h=a.hideHead,p=a.fixedWeeks,x=a.components,y=a.weekStartsOn,b=a.firstWeekContainsDate,j=a.ISOWeek,C=Ggt(t.displayMonth,{useFixedWeeks:!!p,ISOWeek:j,locale:o,weekStartsOn:y,firstWeekContainsDate:b}),N=(e=x==null?void 0:x.Head)!==null&&e!==void 0?e:cgt,A=(n=x==null?void 0:x.Row)!==null&&n!==void 0?n:Wgt,E=(s=x==null?void 0:x.Footer)!==null&&s!==void 0?s:igt;return r.jsxs("table",{id:t.id,className:l.table,style:i.table,role:"grid","aria-labelledby":t["aria-labelledby"],children:[!h&&r.jsx(N,{}),r.jsx("tbody",{className:l.tbody,style:i.tbody,children:C.map(function(T){return r.jsx(A,{displayMonth:t.displayMonth,dates:T.dates,weekNumber:T.weekNumber},T.weekNumber)})}),r.jsx(E,{displayMonth:t.displayMonth})]})}function Zgt(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}var Ygt=Zgt()?I.useLayoutEffect:I.useEffect,ece=!1,Xgt=0;function Nke(){return"react-day-picker-".concat(++Xgt)}function Qgt(t){var e,n=t??(ece?Nke():null),s=I.useState(n),a=s[0],o=s[1];return Ygt(function(){a===null&&o(Nke())},[]),I.useEffect(function(){ece===!1&&(ece=!0)},[]),(e=t??a)!==null&&e!==void 0?e:void 0}function Jgt(t){var e,n,s=el(),a=s.dir,o=s.classNames,l=s.styles,i=s.components,h=EI().displayMonths,p=Qgt(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],b=l.month,j=t.displayIndex===0,C=t.displayIndex===h.length-1,N=!j&&!C;a==="rtl"&&(e=[j,C],C=e[0],j=e[1]),j&&(y.push(o.caption_start),b=Ea(Ea({},b),l.caption_start)),C&&(y.push(o.caption_end),b=Ea(Ea({},b),l.caption_end)),N&&(y.push(o.caption_between),b=Ea(Ea({},b),l.caption_between));var A=(n=i==null?void 0:i.Caption)!==null&&n!==void 0?n:agt;return r.jsxs("div",{className:y.join(" "),style:b,children:[r.jsx(A,{id:p,displayMonth:t.displayMonth,displayIndex:t.displayIndex}),r.jsx(Kgt,{id:x,"aria-labelledby":p,displayMonth:t.displayMonth})]},t.displayIndex)}function ext(t){var e=el(),n=e.classNames,s=e.styles;return r.jsx("div",{className:n.months,style:s.months,children:t.children})}function txt(t){var e,n,s=t.initialProps,a=el(),o=Txe(),l=EI(),i=I.useState(!1),h=i[0],p=i[1];I.useEffect(function(){a.initialFocus&&o.focusTarget&&(h||(o.focus(o.focusTarget),p(!0)))},[a.initialFocus,h,o.focus,o.focusTarget,o]);var x=[a.classNames.root,a.className];a.numberOfMonths>1&&x.push(a.classNames.multiple_months),a.showWeekNumber&&x.push(a.classNames.with_weeknumber);var y=Ea(Ea({},a.styles.root),a.style),b=Object.keys(s).filter(function(C){return C.startsWith("data-")}).reduce(function(C,N){var A;return Ea(Ea({},C),(A={},A[N]=s[N],A))},{}),j=(n=(e=s.components)===null||e===void 0?void 0:e.Months)!==null&&n!==void 0?n:ext;return r.jsx("div",Ea({className:x.join(" "),style:y,dir:a.dir,id:a.id,nonce:s.nonce,title:s.title,lang:s.lang},b,{children:r.jsx(j,{children:l.displayMonths.map(function(C,N){return r.jsx(Jgt,{displayIndex:N,displayMonth:C},N)})})}))}function rxt(t){var e=t.children,n=Smt(t,["children"]);return r.jsx(Hmt,{initialProps:n,children:r.jsx(tgt,{children:r.jsx(Dgt,{initialProps:n,children:r.jsx(ugt,{initialProps:n,children:r.jsx(pgt,{initialProps:n,children:r.jsx(wgt,{children:r.jsx(Lgt,{children:e})})})})})})})}function nxt(t){return r.jsx(rxt,Ea({},t,{children:r.jsx(txt,{initialProps:t})}))}function Z1({className:t,classNames:e,showOutsideDays:n=!0,...s}){return r.jsx(nxt,{showOutsideDays:n,className:$t("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:$t(QA({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:$t(QA({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(Tc,{className:"h-4 w-4"}),IconRight:({...a})=>r.jsx(Vi,{className:"h-4 w-4"})},...s})}Z1.displayName="Calendar";var Sse="Popover",[zDe]=tc(Sse,[Fg]),II=Fg(),[sxt,ov]=zDe(Sse),BDe=t=>{const{__scopePopover:e,children:n,open:s,defaultOpen:a,onOpenChange:o,modal:l=!1}=t,i=II(e),h=I.useRef(null),[p,x]=I.useState(!1),[y,b]=Fu({prop:s,defaultProp:a??!1,onChange:o,caller:Sse});return r.jsx(hI,{...i,children:r.jsx(sxt,{scope:e,contentId:Gc(),triggerRef:h,open:y,onOpenChange:b,onOpenToggle:I.useCallback(()=>b(j=>!j),[b]),hasCustomAnchor:p,onCustomAnchorAdd:I.useCallback(()=>x(!0),[]),onCustomAnchorRemove:I.useCallback(()=>x(!1),[]),modal:l,children:n})})};BDe.displayName=Sse;var $De="PopoverAnchor",axt=I.forwardRef((t,e)=>{const{__scopePopover:n,...s}=t,a=ov($De,n),o=II(n),{onCustomAnchorAdd:l,onCustomAnchorRemove:i}=a;return I.useEffect(()=>(l(),()=>i()),[l,i]),r.jsx(QC,{...o,...s,ref:e})});axt.displayName=$De;var UDe="PopoverTrigger",qDe=I.forwardRef((t,e)=>{const{__scopePopover:n,...s}=t,a=ov(UDe,n),o=II(n),l=ta(e,a.triggerRef),i=r.jsx(Rn.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.contentId,"data-state":KDe(a.open),...s,ref:l,onClick:an(t.onClick,a.onOpenToggle)});return a.hasCustomAnchor?i:r.jsx(QC,{asChild:!0,...o,children:i})});qDe.displayName=UDe;var Exe="PopoverPortal",[ixt,oxt]=zDe(Exe,{forceMount:void 0}),VDe=t=>{const{__scopePopover:e,forceMount:n,children:s,container:a}=t,o=ov(Exe,e);return r.jsx(ixt,{scope:e,forceMount:n,children:r.jsx(gc,{present:n||o.open,children:r.jsx(GC,{asChild:!0,container:a,children:s})})})};VDe.displayName=Exe;var pC="PopoverContent",HDe=I.forwardRef((t,e)=>{const n=oxt(pC,t.__scopePopover),{forceMount:s=n.forceMount,...a}=t,o=ov(pC,t.__scopePopover);return r.jsx(gc,{present:s||o.open,children:o.modal?r.jsx(cxt,{...a,ref:e}):r.jsx(dxt,{...a,ref:e})})});HDe.displayName=pC;var lxt=D1("PopoverContent.RemoveScroll"),cxt=I.forwardRef((t,e)=>{const n=ov(pC,t.__scopePopover),s=I.useRef(null),a=ta(e,s),o=I.useRef(!1);return I.useEffect(()=>{const l=s.current;if(l)return Rne(l)},[]),r.jsx(vI,{as:lxt,allowPinchZoom:!0,children:r.jsx(WDe,{...t,ref:a,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:an(t.onCloseAutoFocus,l=>{var i;l.preventDefault(),o.current||(i=n.triggerRef.current)==null||i.focus()}),onPointerDownOutside:an(t.onPointerDownOutside,l=>{const i=l.detail.originalEvent,h=i.button===0&&i.ctrlKey===!0,p=i.button===2||h;o.current=p},{checkForDefaultPrevented:!1}),onFocusOutside:an(t.onFocusOutside,l=>l.preventDefault(),{checkForDefaultPrevented:!1})})})}),dxt=I.forwardRef((t,e)=>{const n=ov(pC,t.__scopePopover),s=I.useRef(!1),a=I.useRef(!1);return r.jsx(WDe,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{var l,i;(l=t.onCloseAutoFocus)==null||l.call(t,o),o.defaultPrevented||(s.current||(i=n.triggerRef.current)==null||i.focus(),o.preventDefault()),s.current=!1,a.current=!1},onInteractOutside:o=>{var h,p;(h=t.onInteractOutside)==null||h.call(t,o),o.defaultPrevented||(s.current=!0,o.detail.originalEvent.type==="pointerdown"&&(a.current=!0));const l=o.target;((p=n.triggerRef.current)==null?void 0:p.contains(l))&&o.preventDefault(),o.detail.originalEvent.type==="focusin"&&a.current&&o.preventDefault()}})}),WDe=I.forwardRef((t,e)=>{const{__scopePopover:n,trapFocus:s,onOpenAutoFocus:a,onCloseAutoFocus:o,disableOutsidePointerEvents:l,onEscapeKeyDown:i,onPointerDownOutside:h,onFocusOutside:p,onInteractOutside:x,...y}=t,b=ov(pC,n),j=II(n);return Dne(),r.jsx(xI,{asChild:!0,loop:!0,trapped:s,onMountAutoFocus:a,onUnmountAutoFocus:o,children:r.jsx(ev,{asChild:!0,disableOutsidePointerEvents:l,onInteractOutside:x,onEscapeKeyDown:i,onPointerDownOutside:h,onFocusOutside:p,onDismiss:()=>b.onOpenChange(!1),children:r.jsx(fI,{"data-state":KDe(b.open),role:"dialog",id:b.contentId,...j,...y,ref:e,style:{...y.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),GDe="PopoverClose",uxt=I.forwardRef((t,e)=>{const{__scopePopover:n,...s}=t,a=ov(GDe,n);return r.jsx(Rn.button,{type:"button",...s,ref:e,onClick:an(t.onClick,()=>a.onOpenChange(!1))})});uxt.displayName=GDe;var hxt="PopoverArrow",fxt=I.forwardRef((t,e)=>{const{__scopePopover:n,...s}=t,a=II(n);return r.jsx(pI,{...a,...s,ref:e})});fxt.displayName=hxt;function KDe(t){return t?"open":"closed"}var pxt=BDe,mxt=qDe,gxt=VDe,ZDe=HDe;const zu=pxt,Bu=mxt,uu=I.forwardRef(({className:t,align:e="center",sideOffset:n=4,...s},a)=>r.jsx(gxt,{children:r.jsx(ZDe,{ref:a,align:e,sideOffset:n,className:$t("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})}));uu.displayName=ZDe.displayName;const xxt=KC("relative w-full rounded-lg border p-4 [&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"}},defaultVariants:{variant:"default"}}),Ixe=I.forwardRef(({className:t,variant:e,...n},s)=>r.jsx("div",{ref:s,role:"alert",className:$t(xxt({variant:e}),t),...n}));Ixe.displayName="Alert";const yxt=I.forwardRef(({className:t,...e},n)=>r.jsx("h5",{ref:n,className:$t("mb-1 font-medium leading-none tracking-tight",t),...e}));yxt.displayName="AlertTitle";const Pxe=I.forwardRef(({className:t,...e},n)=>r.jsx("div",{ref:n,className:$t("text-sm [&_p]:leading-relaxed",t),...e}));Pxe.displayName="AlertDescription";function vxt({open:t,onOpenChange:e,imageUrl:n,imageId:s,defaultCaption:a="",swagItemId:o,reelId:l}){const i=Vr(),[h,p]=I.useState(a),[x,y]=I.useState([]),[b,j]=I.useState(null),[C,N]=I.useState("now"),[A,E]=I.useState(Kje(tke(new Date),1)),[T,L]=I.useState("12"),[z,F]=I.useState("00"),[q,H]=I.useState("PM");I.useEffect(()=>{if(t){p(a),N("now"),y([]);const me=Kje(tke(new Date),1);E(me);const Le=me.getHours();L(String(Le>12?Le-12:Le===0?12:Le)),F("00"),H(Le>=12?"PM":"AM")}},[t,a]);const Z=()=>{if(!A)return null;let me=parseInt(T);const Le=parseInt(z);return q==="PM"&&me!==12&&(me+=12),q==="AM"&&me===12&&(me=0),mOe(pOe(A,me),Le)},{data:G,isLoading:te}=Yt({queryKey:["social-accounts-for-post"],queryFn:async()=>{const{data:{user:me}}=await J.auth.getUser();if(!me)return[];const{data:Le,error:Ne}=await J.from("social_accounts").select("*").eq("user_id",me.id).eq("is_active",!0).order("platform",{ascending:!0});if(Ne)throw Ne;return console.log("Fetched social accounts for posting:",Le),Le},enabled:t,staleTime:0}),ie=cr({mutationFn:async({accountId:me,platform:Le})=>{j(me);const{data:Ne,error:Be}=await J.functions.invoke("social-post",{body:{platform:Le,accountId:me,imageUrl:n,caption:h}});if(Be)throw Be;if(Ne!=null&&Ne.error)throw new Error(Ne.error);return Ne},onSuccess:me=>{const Le=me.platform==="facebook"?"Facebook":me.platform==="instagram"?"Instagram":me.platform==="linkedin"?"LinkedIn":"Google Business";ze.success(`Posted to ${Le}!`)},onError:me=>{ze.error(`Failed to post: ${me.message}`)},onSettled:()=>{j(null)}}),le=cr({mutationFn:async({accountId:me,platform:Le,scheduledFor:Ne})=>{const{data:{user:Be}}=await J.auth.getUser();if(!Be)throw new Error("Not authenticated");const{error:Ee}=await J.from("scheduled_posts").insert({user_id:Be.id,social_account_id:me,platform:Le,image_url:n,caption:h,swag_item_id:o||null,reel_id:l||null,scheduled_for:Ne.toISOString(),status:"scheduled"});if(Ee)throw Ee;return{platform:Le}},onSuccess:me=>{const Le=me.platform==="facebook"?"Facebook":me.platform==="instagram"?"Instagram":"LinkedIn";ze.success(`Post scheduled for ${Le}!`)},onError:me=>{ze.error(`Failed to schedule: ${me.message}`)}}),ye=async()=>{if(x.length===0){ze.error("Please select at least one account");return}if(C==="schedule"){const me=Z();if(!me||me<=new Date){ze.error("Please select a future date and time");return}for(const Le of x){const Ne=G==null?void 0:G.find(Be=>Be.id===Le);Ne&&await le.mutateAsync({accountId:Le,platform:Ne.platform,scheduledFor:me})}i.invalidateQueries({queryKey:["scheduled-posts"]}),ze.success(`${x.length} post(s) scheduled for ${yn(me,"PPp")}`)}else for(const me of x){const Le=G==null?void 0:G.find(Ne=>Ne.id===me);Le&&await ie.mutateAsync({accountId:me,platform:Le.platform})}i.invalidateQueries({queryKey:["scheduled-posts"]}),p(""),y([]),e(!1)},ne=me=>{y(Le=>Le.includes(me)?Le.filter(Ne=>Ne!==me):[...Le,me])},ge=(G==null?void 0:G.filter(me=>me.platform==="facebook"))||[],ae=(G==null?void 0:G.filter(me=>me.platform==="instagram"))||[],he=(G==null?void 0:G.filter(me=>me.platform==="linkedin"))||[],ue=(G==null?void 0:G.filter(me=>me.platform==="google_business"))||[],_e=((G==null?void 0:G.length)||0)>0,Ae=ie.isPending||le.isPending,Ce=Array.from({length:12},(me,Le)=>String(Le+1)),be=["00","15","30","45"];return r.jsx(Fr,{open:t,onOpenChange:e,children:r.jsxs(Rr,{className:"sm:max-w-lg max-h-[90vh] overflow-y-auto",children:[r.jsxs(qr,{children:[r.jsx($r,{children:"Create Social Post"}),r.jsx(Xn,{children:"Share this image to your connected social accounts"})]}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsx("div",{className:"aspect-square w-full max-w-[200px] mx-auto overflow-hidden rounded-lg border",children:r.jsx("img",{src:n,alt:"Post preview",className:"h-full w-full object-cover"})}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"caption",children:"Caption"}),r.jsx(ps,{id:"caption",placeholder:"Write a caption for your post...",value:h,onChange:me=>p(me.target.value),rows:3}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[h.length,"/2200 characters"]})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsx(He,{children:"Publish Time"}),r.jsxs("div",{className:"flex items-center gap-1 p-1 bg-muted rounded-lg",children:[r.jsx("button",{type:"button",onClick:()=>N("now"),className:$t("flex-1 px-4 py-2 rounded-md text-sm font-medium transition-all",C==="now"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"Post Now"}),r.jsx("button",{type:"button",onClick:()=>N("schedule"),className:$t("flex-1 px-4 py-2 rounded-md text-sm font-medium transition-all",C==="schedule"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"Schedule"})]})]}),C==="schedule"&&r.jsxs("div",{className:"space-y-3 p-4 border rounded-lg bg-muted/30",children:[r.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium",children:[r.jsx(Ya,{className:"h-4 w-4"}),"Schedule for"]}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[r.jsxs(zu,{children:[r.jsx(Bu,{asChild:!0,children:r.jsxs(ee,{variant:"outline",className:$t("justify-start text-left font-normal flex-1",!A&&"text-muted-foreground"),children:[r.jsx(zs,{className:"mr-2 h-4 w-4"}),A?yn(A,"PPP"):r.jsx("span",{children:"Pick a date"})]})}),r.jsx(uu,{className:"w-auto p-0",align:"start",children:r.jsx(Z1,{mode:"single",selected:A,onSelect:E,disabled:me=>mer.jsx(Vt,{value:me,children:me},me))})]}),r.jsx("span",{className:"text-muted-foreground",children:":"}),r.jsxs(gn,{value:z,onValueChange:F,children:[r.jsx(fn,{className:"w-[70px]",children:r.jsx(xn,{})}),r.jsx(pn,{children:be.map(me=>r.jsx(Vt,{value:me,children:me},me))})]}),r.jsxs(gn,{value:q,onValueChange:me=>H(me),children:[r.jsx(fn,{className:"w-[70px]",children:r.jsx(xn,{})}),r.jsxs(pn,{children:[r.jsx(Vt,{value:"AM",children:"AM"}),r.jsx(Vt,{value:"PM",children:"PM"})]})]})]})]}),A&&r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Post will be published on ",yn(Z()||new Date,"PPP 'at' p")]})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsx(He,{children:"Post to"}),te&&r.jsx("div",{className:"flex items-center justify-center py-4",children:r.jsx(en,{className:"h-6 w-6 animate-spin"})}),!te&&!_e&&r.jsxs(Ixe,{children:[r.jsx(Il,{className:"h-4 w-4"}),r.jsxs(Pxe,{className:"flex flex-col gap-2",children:[r.jsx("span",{children:"No social accounts connected yet."}),r.jsxs(co,{to:"/social-connections",className:"inline-flex items-center gap-1.5 text-primary hover:underline font-medium",children:[r.jsx(fd,{className:"h-3.5 w-3.5"}),"Connect your Facebook, Instagram & LinkedIn"]})]})]}),ge.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(Rd,{className:"h-4 w-4 text-blue-600"})," Facebook"]}),ge.map(me=>r.jsxs("label",{className:"flex items-center gap-3 rounded-lg border p-3 cursor-pointer hover:bg-muted/50 transition-colors",children:[r.jsx(Dl,{checked:x.includes(me.id),onCheckedChange:()=>ne(me.id),disabled:b===me.id}),r.jsxs(Ks,{className:"h-8 w-8",children:[r.jsx(Ei,{src:me.profile_picture_url||""}),r.jsx(Zs,{children:r.jsx(Rd,{className:"h-4 w-4"})})]}),r.jsx("span",{className:"flex-1 text-sm font-medium",children:me.page_name||me.platform_username}),b===me.id&&r.jsx(en,{className:"h-4 w-4 animate-spin"})]},me.id))]}),ae.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(lu,{className:"h-4 w-4 text-pink-600"})," Instagram"]}),ae.map(me=>r.jsxs("label",{className:"flex items-center gap-3 rounded-lg border p-3 cursor-pointer hover:bg-muted/50 transition-colors",children:[r.jsx(Dl,{checked:x.includes(me.id),onCheckedChange:()=>ne(me.id),disabled:b===me.id}),r.jsxs(Ks,{className:"h-8 w-8",children:[r.jsx(Ei,{src:me.profile_picture_url||""}),r.jsx(Zs,{children:r.jsx(lu,{className:"h-4 w-4"})})]}),r.jsxs("span",{className:"flex-1 text-sm font-medium",children:["@",me.platform_username]}),b===me.id&&r.jsx(en,{className:"h-4 w-4 animate-spin"})]},me.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(mm,{className:"h-4 w-4 text-blue-700"})," LinkedIn"]}),he.map(me=>r.jsxs("label",{className:"flex items-center gap-3 rounded-lg border p-3 cursor-pointer hover:bg-muted/50 transition-colors",children:[r.jsx(Dl,{checked:x.includes(me.id),onCheckedChange:()=>ne(me.id),disabled:b===me.id}),r.jsxs(Ks,{className:"h-8 w-8",children:[r.jsx(Ei,{src:me.profile_picture_url||""}),r.jsx(Zs,{children:r.jsx(mm,{className:"h-4 w-4"})})]}),r.jsx("span",{className:"flex-1 text-sm font-medium",children:me.platform_username}),b===me.id&&r.jsx(en,{className:"h-4 w-4 animate-spin"})]},me.id))]}),ue.length>0&&r.jsxs("div",{className:"space-y-2",children:[r.jsxs("p",{className:"text-sm font-medium text-muted-foreground flex items-center gap-2",children:[r.jsx(fl,{className:"h-4 w-4 text-red-600"})," Google Business"]}),ue.map(me=>r.jsxs("label",{className:"flex items-center gap-3 rounded-lg border p-3 cursor-pointer hover:bg-muted/50 transition-colors",children:[r.jsx(Dl,{checked:x.includes(me.id),onCheckedChange:()=>ne(me.id),disabled:b===me.id}),r.jsxs(Ks,{className:"h-8 w-8",children:[r.jsx(Ei,{src:me.profile_picture_url||""}),r.jsx(Zs,{children:r.jsx(fl,{className:"h-4 w-4"})})]}),r.jsx("span",{className:"flex-1 text-sm font-medium",children:me.page_name||me.platform_username}),b===me.id&&r.jsx(en,{className:"h-4 w-4 animate-spin"})]},me.id))]})]})]}),r.jsxs(ea,{children:[r.jsx(ee,{variant:"outline",onClick:()=>e(!1),children:"Cancel"}),r.jsxs(ee,{onClick:ye,disabled:x.length===0||Ae,className:"gap-2",children:[Ae?r.jsx(en,{className:"h-4 w-4 animate-spin"}):C==="schedule"?r.jsx(zs,{className:"h-4 w-4"}):r.jsx(Oo,{className:"h-4 w-4"}),C==="schedule"?`Schedule ${x.length} post${x.length!==1?"s":""}`:`Post to ${x.length} account${x.length!==1?"s":""}`]})]})]})})}function _xt(){const t=Vr(),[e,n]=I.useState(void 0),[s,a]=I.useState("all"),[o,l]=I.useState(null),[i,h]=I.useState(""),[p,x]=I.useState(void 0),[y,b]=I.useState("12"),[j,C]=I.useState("00"),[N,A]=I.useState("PM"),{data:E=[],isLoading:T}=Yt({queryKey:["scheduled-posts"],queryFn:async()=>{const{data:ue,error:_e}=await J.from("scheduled_posts").select(` *, social_accounts ( page_name, platform_username, profile_picture_url ) `).order("scheduled_for",{ascending:!1});if(_e)throw _e;return ue}}),L=E.filter(ue=>{if(s!=="all"&&ue.status!==s)return!1;if(e&&ue.scheduled_for){const _e=new Date(ue.scheduled_for);if(!Ql(_e,e))return!1}return!0}),z=E.filter(ue=>ue.scheduled_for).map(ue=>uf(new Date(ue.scheduled_for))),F=cr({mutationFn:async ue=>{const{error:_e}=await J.from("scheduled_posts").update({caption:ue.caption,scheduled_for:ue.scheduled_for}).eq("id",ue.id);if(_e)throw _e},onSuccess:()=>{ze.success("Post updated!"),t.invalidateQueries({queryKey:["scheduled-posts"]}),l(null)},onError:ue=>{ze.error(`Failed to update: ${ue.message}`)}}),q=cr({mutationFn:async ue=>{const{error:_e}=await J.from("scheduled_posts").update({status:"cancelled"}).eq("id",ue);if(_e)throw _e},onSuccess:()=>{ze.success("Post cancelled"),t.invalidateQueries({queryKey:["scheduled-posts"]})},onError:ue=>{ze.error(`Failed to cancel: ${ue.message}`)}}),H=cr({mutationFn:async ue=>{const{error:_e}=await J.from("scheduled_posts").delete().eq("id",ue);if(_e)throw _e},onSuccess:()=>{ze.success("Post deleted"),t.invalidateQueries({queryKey:["scheduled-posts"]})},onError:ue=>{ze.error(`Failed to delete: ${ue.message}`)}}),Z=cr({mutationFn:async ue=>{const{data:_e,error:Ae}=await J.functions.invoke("social-post",{body:{platform:ue.platform,accountId:ue.social_account_id,imageUrl:ue.image_url,caption:ue.caption}});if(Ae)throw Ae;if(_e!=null&&_e.error)throw new Error(_e.error);return await J.from("scheduled_posts").update({status:"posted",posted_at:new Date().toISOString(),post_id:_e.postId}).eq("id",ue.id),_e},onSuccess:ue=>{const _e=ue.platform==="facebook"?"Facebook":ue.platform==="instagram"?"Instagram":"LinkedIn";ze.success(`Posted to ${_e}!`),t.invalidateQueries({queryKey:["scheduled-posts"]})},onError:ue=>{ze.error(`Failed to post: ${ue.message}`)}}),G=ue=>{if(l(ue),h(ue.caption||""),ue.scheduled_for){const _e=new Date(ue.scheduled_for);x(_e);const Ae=_e.getHours();b(String(Ae>12?Ae-12:Ae===0?12:Ae)),C(String(_e.getMinutes()).padStart(2,"0")),A(Ae>=12?"PM":"AM")}},te=()=>{if(!o||!p)return;let ue=parseInt(y);const _e=parseInt(j);N==="PM"&&ue!==12&&(ue+=12),N==="AM"&&ue===12&&(ue=0);const Ae=mOe(pOe(p,ue),_e);F.mutate({id:o.id,caption:i,scheduled_for:Ae.toISOString()})},ie=ue=>{switch(ue){case"facebook":return r.jsx(Rd,{className:"h-4 w-4 text-blue-600"});case"instagram":return r.jsx(lu,{className:"h-4 w-4 text-pink-600"});case"linkedin":return r.jsx(mm,{className:"h-4 w-4 text-blue-700"});default:return null}},le=ue=>{switch(ue){case"scheduled":return r.jsxs(Ot,{variant:"secondary",className:"gap-1",children:[r.jsx(Ya,{className:"h-3 w-3"}),"Scheduled"]});case"posted":return r.jsxs(Ot,{variant:"default",className:"gap-1 bg-green-600",children:[r.jsx(Yi,{className:"h-3 w-3"}),"Posted"]});case"failed":return r.jsxs(Ot,{variant:"destructive",className:"gap-1",children:[r.jsx(qc,{className:"h-3 w-3"}),"Failed"]});case"cancelled":return r.jsxs(Ot,{variant:"outline",className:"gap-1 text-muted-foreground",children:[r.jsx(Il,{className:"h-3 w-3"}),"Cancelled"]});default:return r.jsx(Ot,{variant:"outline",children:ue})}},ye=Array.from({length:12},(ue,_e)=>String(_e+1)),ne=["00","15","30","45"],ge=E.filter(ue=>ue.status==="scheduled").length,ae=E.filter(ue=>ue.status==="posted").length,he=E.filter(ue=>ue.status==="scheduled"&&ue.scheduled_for&&rdt(new Date(ue.scheduled_for))).length;return r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[r.jsxs(Ye,{className:"p-4",children:[r.jsx("div",{className:"text-2xl font-bold",children:ge}),r.jsx("div",{className:"text-sm text-muted-foreground",children:"Scheduled"})]}),r.jsxs(Ye,{className:"p-4",children:[r.jsx("div",{className:"text-2xl font-bold",children:he}),r.jsx("div",{className:"text-sm text-muted-foreground",children:"Upcoming"})]}),r.jsxs(Ye,{className:"p-4",children:[r.jsx("div",{className:"text-2xl font-bold",children:ae}),r.jsx("div",{className:"text-sm text-muted-foreground",children:"Posted"})]}),r.jsxs(Ye,{className:"p-4",children:[r.jsx("div",{className:"text-2xl font-bold",children:E.length}),r.jsx("div",{className:"text-sm text-muted-foreground",children:"Total"})]})]}),r.jsxs("div",{className:"flex flex-col lg:flex-row gap-6",children:[r.jsxs(Ye,{className:"p-4",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[r.jsx(hm,{className:"h-5 w-5"}),r.jsx("h3",{className:"font-semibold",children:"Calendar"})]}),r.jsx(Z1,{mode:"single",selected:e,onSelect:n,className:$t("pointer-events-auto"),modifiers:{hasPost:z},modifiersStyles:{hasPost:{fontWeight:"bold",backgroundColor:"hsl(var(--primary) / 0.1)",borderRadius:"50%"}}}),e&&r.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>n(void 0),className:"w-full mt-2",children:"Clear date filter"})]}),r.jsxs("div",{className:"flex-1 space-y-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(m1,{className:"h-4 w-4 text-muted-foreground"}),r.jsx("div",{className:"flex flex-wrap gap-1",children:["all","scheduled","posted","failed","cancelled"].map(ue=>r.jsx(ee,{variant:s===ue?"default":"outline",size:"sm",onClick:()=>a(ue),className:"capitalize",children:ue},ue))})]}),T&&r.jsx("div",{className:"flex items-center justify-center py-12",children:r.jsx(en,{className:"h-8 w-8 animate-spin text-muted-foreground"})}),!T&&L.length===0&&r.jsxs(Ye,{className:"p-8 text-center",children:[r.jsx(zs,{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 ${yn(e,"PPP")}`:"Schedule a post from Social Swag to get started!"})]}),r.jsx("div",{className:"space-y-4",children:L.map(ue=>{var _e,Ae;return r.jsx(Ye,{className:"overflow-hidden",children:r.jsxs("div",{className:"flex flex-col sm:flex-row",children:[r.jsx("div",{className:"sm:w-32 h-32 sm:h-auto bg-muted flex-shrink-0",children:r.jsx("img",{src:ue.image_url,alt:"Post preview",className:"w-full h-full object-cover"})}),r.jsxs(tt,{className:"flex-1 p-4",children:[r.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-2 mb-2",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[ie(ue.platform),r.jsx("span",{className:"font-medium",children:((_e=ue.social_accounts)==null?void 0:_e.page_name)||((Ae=ue.social_accounts)==null?void 0:Ae.platform_username)||"Unknown"}),le(ue.status)]}),r.jsxs("div",{className:"flex items-center gap-1",children:[ue.status==="scheduled"&&r.jsxs(mI,{children:[r.jsxs(Sg,{children:[r.jsx(Cg,{asChild:!0,children:r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>G(ue),children:r.jsx(_i,{className:"h-4 w-4"})})}),r.jsx(xm,{children:"Edit post"})]}),r.jsxs(Sg,{children:[r.jsx(Cg,{asChild:!0,children:r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>Z.mutate(ue),disabled:Z.isPending,children:Z.isPending?r.jsx(en,{className:"h-4 w-4 animate-spin"}):r.jsx(Oo,{className:"h-4 w-4"})})}),r.jsx(xm,{children:"Post now"})]}),r.jsxs(Iu,{children:[r.jsx(G0,{asChild:!0,children:r.jsx(ee,{variant:"ghost",size:"icon",className:"text-destructive",children:r.jsx(Vn,{className:"h-4 w-4"})})}),r.jsxs(tu,{children:[r.jsxs(ru,{children:[r.jsx(su,{children:"Cancel this scheduled post?"}),r.jsx(au,{children:"This will cancel the post. You can delete it entirely or keep it in your history."})]}),r.jsxs(nu,{children:[r.jsx(iu,{children:"Keep"}),r.jsx(Ld,{onClick:()=>q.mutate(ue.id),className:"bg-amber-600 hover:bg-amber-700",children:"Cancel Post"}),r.jsx(Ld,{onClick:()=>H.mutate(ue.id),className:"bg-destructive hover:bg-destructive/90",children:"Delete"})]})]})]})]}),(ue.status==="posted"||ue.status==="cancelled"||ue.status==="failed")&&r.jsxs(Iu,{children:[r.jsx(G0,{asChild:!0,children:r.jsx(ee,{variant:"ghost",size:"icon",className:"text-destructive",children:r.jsx(Vn,{className:"h-4 w-4"})})}),r.jsxs(tu,{children:[r.jsxs(ru,{children:[r.jsx(su,{children:"Delete this post?"}),r.jsx(au,{children:"This will permanently remove this post from your history."})]}),r.jsxs(nu,{children:[r.jsx(iu,{children:"Cancel"}),r.jsx(Ld,{onClick:()=>H.mutate(ue.id),className:"bg-destructive hover:bg-destructive/90",children:"Delete"})]})]})]})]})]}),ue.caption&&r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 mb-2",children:ue.caption}),r.jsxs("div",{className:"text-xs text-muted-foreground flex items-center gap-1",children:[r.jsx(Ya,{className:"h-3 w-3"}),ue.status==="posted"&&ue.posted_at?`Posted ${yn(new Date(ue.posted_at),"PPp")}`:ue.scheduled_for?`Scheduled for ${yn(new Date(ue.scheduled_for),"PPp")}`:"Not scheduled"]}),ue.status==="failed"&&ue.error_message&&r.jsxs("p",{className:"text-xs text-destructive mt-2",children:["Error: ",ue.error_message]})]})]})},ue.id)})})]})]}),r.jsx(Fr,{open:!!o,onOpenChange:ue=>!ue&&l(null),children:r.jsxs(Rr,{className:"max-w-lg",children:[r.jsxs(qr,{children:[r.jsx($r,{children:"Edit Scheduled Post"}),r.jsx(Xn,{children:"Update the caption or reschedule this post"})]}),o&&r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsx("div",{className:"aspect-square w-32 mx-auto overflow-hidden rounded-lg border",children:r.jsx("img",{src:o.image_url,alt:"Post preview",className:"h-full w-full object-cover"})}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Caption"}),r.jsx(ps,{value:i,onChange:ue=>h(ue.target.value),rows:3})]}),r.jsxs("div",{className:"space-y-3 p-4 border rounded-lg",children:[r.jsx(He,{children:"Schedule for"}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[r.jsxs(zu,{children:[r.jsx(Bu,{asChild:!0,children:r.jsxs(ee,{variant:"outline",className:$t("justify-start text-left font-normal flex-1",!p&&"text-muted-foreground"),children:[r.jsx(zs,{className:"mr-2 h-4 w-4"}),p?yn(p,"PPP"):"Pick a date"]})}),r.jsx(uu,{className:"w-auto p-0",align:"start",children:r.jsx(Z1,{mode:"single",selected:p,onSelect:x,disabled:ue=>uer.jsx(Vt,{value:ue,children:ue},ue))})]}),r.jsx("span",{className:"text-muted-foreground",children:":"}),r.jsxs(gn,{value:j,onValueChange:C,children:[r.jsx(fn,{className:"w-[70px]",children:r.jsx(xn,{})}),r.jsx(pn,{children:ne.map(ue=>r.jsx(Vt,{value:ue,children:ue},ue))})]}),r.jsxs(gn,{value:N,onValueChange:ue=>A(ue),children:[r.jsx(fn,{className:"w-[70px]",children:r.jsx(xn,{})}),r.jsxs(pn,{children:[r.jsx(Vt,{value:"AM",children:"AM"}),r.jsx(Vt,{value:"PM",children:"PM"})]})]})]})]})]})]}),r.jsxs(ea,{children:[r.jsx(ee,{variant:"outline",onClick:()=>l(null),children:"Cancel"}),r.jsxs(ee,{onClick:te,disabled:F.isPending,children:[F.isPending?r.jsx(en,{className:"h-4 w-4 animate-spin mr-2"}):null,"Save Changes"]})]})]})})]})}function wL(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 YDe={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 wL=="function"&&wL;if(!x&&y)return y(p,!0);if(i)return i(p,!0);var b=new Error("Cannot find module '"+p+"'");throw b.code="MODULE_NOT_FOUND",b}var j=a[p]={exports:{}};s[p][0].call(j.exports,function(C){var N=s[p][1][C];return l(N||C)},j,j.exports,n,s,a,o)}return a[p].exports}for(var i=typeof wL=="function"&&wL,h=0;h>2,j=(3&p)<<4|x>>4,C=1>6:64,N=2>4,x=(15&b)<<4|(j=i.indexOf(h.charAt(N++)))>>2,y=(3&j)<<6|(C=i.indexOf(h.charAt(N++))),T[A++]=p,j!==64&&(T[A++]=x),C!==64&&(T[A++]=y);return T}},{"./support":30,"./utils":32}],2:[function(n,s,a){var o=n("./external"),l=n("./stream/DataWorker"),i=n("./stream/Crc32Probe"),h=n("./stream/DataLengthProbe");function p(x,y,b,j,C){this.compressedSize=x,this.uncompressedSize=y,this.crc32=b,this.compression=j,this.compressedContent=C}p.prototype={getContentWorker:function(){var x=new l(o.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new h("data_length")),y=this;return x.on("end",function(){if(this.streamInfo.data_length!==y.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),x},getCompressedWorker:function(){return new l(o.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},p.createWorkerFrom=function(x,y,b){return x.pipe(new i).pipe(new h("uncompressedSize")).pipe(y.compressWorker(b)).pipe(new h("compressedSize")).withStreamInfo("compression",y)},s.exports=p},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(n,s,a){var o=n("./stream/GenericWorker");a.STORE={magic:"\0\0",compressWorker:function(){return new o("STORE compression")},uncompressWorker:function(){return new o("STORE decompression")}},a.DEFLATE=n("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(n,s,a){var o=n("./utils"),l=function(){for(var i,h=[],p=0;p<256;p++){i=p;for(var x=0;x<8;x++)i=1&i?3988292384^i>>>1:i>>>1;h[p]=i}return h}();s.exports=function(i,h){return i!==void 0&&i.length?o.getTypeOf(i)!=="string"?function(p,x,y,b){var j=l,C=b+y;p^=-1;for(var N=b;N>>8^j[255&(p^x[N])];return-1^p}(0|h,i,i.length,0):function(p,x,y,b){var j=l,C=b+y;p^=-1;for(var N=b;N>>8^j[255&(p^x.charCodeAt(N))];return-1^p}(0|h,i,i.length,0):0}},{"./utils":32}],5:[function(n,s,a){a.base64=!1,a.binary=!1,a.dir=!1,a.createFolders=!0,a.date=null,a.compression=null,a.compressionOptions=null,a.comment=null,a.unixPermissions=null,a.dosPermissions=null},{}],6:[function(n,s,a){var o=null;o=typeof Promise<"u"?Promise:n("lie"),s.exports={Promise:o}},{lie:37}],7:[function(n,s,a){var o=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",l=n("pako"),i=n("./utils"),h=n("./stream/GenericWorker"),p=o?"uint8array":"array";function x(y,b){h.call(this,"FlateWorker/"+y),this._pako=null,this._pakoAction=y,this._pakoOptions=b,this.meta={}}a.magic="\b\0",i.inherits(x,h),x.prototype.processChunk=function(y){this.meta=y.meta,this._pako===null&&this._createPako(),this._pako.push(i.transformTo(p,y.data),!1)},x.prototype.flush=function(){h.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},x.prototype.cleanUp=function(){h.prototype.cleanUp.call(this),this._pako=null},x.prototype._createPako=function(){this._pako=new l[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var y=this;this._pako.onData=function(b){y.push({data:b,meta:y.meta})}},a.compressWorker=function(y){return new x("Deflate",y)},a.uncompressWorker=function(){return new x("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(n,s,a){function o(j,C){var N,A="";for(N=0;N>>=8;return A}function l(j,C,N,A,E,T){var L,z,F=j.file,q=j.compression,H=T!==p.utf8encode,Z=i.transformTo("string",T(F.name)),G=i.transformTo("string",p.utf8encode(F.name)),te=F.comment,ie=i.transformTo("string",T(te)),le=i.transformTo("string",p.utf8encode(te)),ye=G.length!==F.name.length,ne=le.length!==te.length,ge="",ae="",he="",ue=F.dir,_e=F.date,Ae={crc32:0,compressedSize:0,uncompressedSize:0};C&&!N||(Ae.crc32=j.crc32,Ae.compressedSize=j.compressedSize,Ae.uncompressedSize=j.uncompressedSize);var Ce=0;C&&(Ce|=8),H||!ye&&!ne||(Ce|=2048);var be=0,me=0;ue&&(be|=16),E==="UNIX"?(me=798,be|=function(Ne,Be){var Ee=Ne;return Ne||(Ee=Be?16893:33204),(65535&Ee)<<16}(F.unixPermissions,ue)):(me=20,be|=function(Ne){return 63&(Ne||0)}(F.dosPermissions)),L=_e.getUTCHours(),L<<=6,L|=_e.getUTCMinutes(),L<<=5,L|=_e.getUTCSeconds()/2,z=_e.getUTCFullYear()-1980,z<<=4,z|=_e.getUTCMonth()+1,z<<=5,z|=_e.getUTCDate(),ye&&(ae=o(1,1)+o(x(Z),4)+G,ge+="up"+o(ae.length,2)+ae),ne&&(he=o(1,1)+o(x(ie),4)+le,ge+="uc"+o(he.length,2)+he);var Le="";return Le+=` \0`,Le+=o(Ce,2),Le+=q.magic,Le+=o(L,2),Le+=o(z,2),Le+=o(Ae.crc32,4),Le+=o(Ae.compressedSize,4),Le+=o(Ae.uncompressedSize,4),Le+=o(Z.length,2),Le+=o(ge.length,2),{fileRecord:y.LOCAL_FILE_HEADER+Le+Z+ge,dirRecord:y.CENTRAL_FILE_HEADER+o(me,2)+Le+o(ie.length,2)+"\0\0\0\0"+o(be,4)+o(A,4)+Z+ge+ie}}var i=n("../utils"),h=n("../stream/GenericWorker"),p=n("../utf8"),x=n("../crc32"),y=n("../signature");function b(j,C,N,A){h.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=C,this.zipPlatform=N,this.encodeFileName=A,this.streamFiles=j,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}i.inherits(b,h),b.prototype.push=function(j){var C=j.meta.percent||0,N=this.entriesCount,A=this._sources.length;this.accumulate?this.contentBuffer.push(j):(this.bytesWritten+=j.data.length,h.prototype.push.call(this,{data:j.data,meta:{currentFile:this.currentFile,percent:N?(C+100*(N-A-1))/N:100}}))},b.prototype.openedSource=function(j){this.currentSourceOffset=this.bytesWritten,this.currentFile=j.file.name;var C=this.streamFiles&&!j.file.dir;if(C){var N=l(j,C,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:N.fileRecord,meta:{percent:0}})}else this.accumulate=!0},b.prototype.closedSource=function(j){this.accumulate=!1;var C=this.streamFiles&&!j.file.dir,N=l(j,C,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(N.dirRecord),C)this.push({data:function(A){return y.DATA_DESCRIPTOR+o(A.crc32,4)+o(A.compressedSize,4)+o(A.uncompressedSize,4)}(j),meta:{percent:100}});else for(this.push({data:N.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},b.prototype.flush=function(){for(var j=this.bytesWritten,C=0;C=this.index;h--)p=(p<<8)+this.byteAt(h);return this.index+=i,p},readString:function(i){return o.transformTo("string",this.readData(i))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var i=this.readInt(4);return new Date(Date.UTC(1980+(i>>25&127),(i>>21&15)-1,i>>16&31,i>>11&31,i>>5&63,(31&i)<<1))}},s.exports=l},{"../utils":32}],19:[function(n,s,a){var o=n("./Uint8ArrayReader");function l(i){o.call(this,i)}n("../utils").inherits(l,o),l.prototype.readData=function(i){this.checkOffset(i);var h=this.data.slice(this.zero+this.index,this.zero+this.index+i);return this.index+=i,h},s.exports=l},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(n,s,a){var o=n("./DataReader");function l(i){o.call(this,i)}n("../utils").inherits(l,o),l.prototype.byteAt=function(i){return this.data.charCodeAt(this.zero+i)},l.prototype.lastIndexOfSignature=function(i){return this.data.lastIndexOf(i)-this.zero},l.prototype.readAndCheckSignature=function(i){return i===this.readData(4)},l.prototype.readData=function(i){this.checkOffset(i);var h=this.data.slice(this.zero+this.index,this.zero+this.index+i);return this.index+=i,h},s.exports=l},{"../utils":32,"./DataReader":18}],21:[function(n,s,a){var o=n("./ArrayReader");function l(i){o.call(this,i)}n("../utils").inherits(l,o),l.prototype.readData=function(i){if(this.checkOffset(i),i===0)return new Uint8Array(0);var h=this.data.subarray(this.zero+this.index,this.zero+this.index+i);return this.index+=i,h},s.exports=l},{"../utils":32,"./ArrayReader":17}],22:[function(n,s,a){var o=n("../utils"),l=n("../support"),i=n("./ArrayReader"),h=n("./StringReader"),p=n("./NodeBufferReader"),x=n("./Uint8ArrayReader");s.exports=function(y){var b=o.getTypeOf(y);return o.checkSupport(b),b!=="string"||l.uint8array?b==="nodebuffer"?new p(y):l.uint8array?new x(o.transformTo("uint8array",y)):new i(o.transformTo("array",y)):new h(y)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(n,s,a){a.LOCAL_FILE_HEADER="PK",a.CENTRAL_FILE_HEADER="PK",a.CENTRAL_DIRECTORY_END="PK",a.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",a.ZIP64_CENTRAL_DIRECTORY_END="PK",a.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(n,s,a){var o=n("./GenericWorker"),l=n("../utils");function i(h){o.call(this,"ConvertWorker to "+h),this.destType=h}l.inherits(i,o),i.prototype.processChunk=function(h){this.push({data:l.transformTo(this.destType,h.data),meta:h.meta})},s.exports=i},{"../utils":32,"./GenericWorker":28}],25:[function(n,s,a){var o=n("./GenericWorker"),l=n("../crc32");function i(){o.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}n("../utils").inherits(i,o),i.prototype.processChunk=function(h){this.streamInfo.crc32=l(h.data,this.streamInfo.crc32||0),this.push(h)},s.exports=i},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(n,s,a){var o=n("../utils"),l=n("./GenericWorker");function i(h){l.call(this,"DataLengthProbe for "+h),this.propName=h,this.withStreamInfo(h,0)}o.inherits(i,l),i.prototype.processChunk=function(h){if(h){var p=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=p+h.data.length}l.prototype.processChunk.call(this,h)},s.exports=i},{"../utils":32,"./GenericWorker":28}],27:[function(n,s,a){var o=n("../utils"),l=n("./GenericWorker");function i(h){l.call(this,"DataWorker");var p=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,h.then(function(x){p.dataIsReady=!0,p.data=x,p.max=x&&x.length||0,p.type=o.getTypeOf(x),p.isPaused||p._tickAndRepeat()},function(x){p.error(x)})}o.inherits(i,l),i.prototype.cleanUp=function(){l.prototype.cleanUp.call(this),this.data=null},i.prototype.resume=function(){return!!l.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,o.delay(this._tickAndRepeat,[],this)),!0)},i.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(o.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},i.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var h=null,p=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":h=this.data.substring(this.index,p);break;case"uint8array":h=this.data.subarray(this.index,p);break;case"array":case"nodebuffer":h=this.data.slice(this.index,p)}return this.index=p,this.push({data:h,meta:{percent:this.max?this.index/this.max*100:0}})},s.exports=i},{"../utils":32,"./GenericWorker":28}],28:[function(n,s,a){function o(l){this.name=l||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}o.prototype={push:function(l){this.emit("data",l)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(l){this.emit("error",l)}return!0},error:function(l){return!this.isFinished&&(this.isPaused?this.generatedError=l:(this.isFinished=!0,this.emit("error",l),this.previous&&this.previous.error(l),this.cleanUp()),!0)},on:function(l,i){return this._listeners[l].push(i),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(l,i){if(this._listeners[l])for(var h=0;h "+l:l}},s.exports=o},{}],29:[function(n,s,a){var o=n("../utils"),l=n("./ConvertWorker"),i=n("./GenericWorker"),h=n("../base64"),p=n("../support"),x=n("../external"),y=null;if(p.nodestream)try{y=n("../nodejs/NodejsStreamOutputAdapter")}catch{}function b(C,N){return new x.Promise(function(A,E){var T=[],L=C._internalType,z=C._outputType,F=C._mimeType;C.on("data",function(q,H){T.push(q),N&&N(H)}).on("error",function(q){T=[],E(q)}).on("end",function(){try{var q=function(H,Z,G){switch(H){case"blob":return o.newBlob(o.transformTo("arraybuffer",Z),G);case"base64":return h.encode(Z);default:return o.transformTo(H,Z)}}(z,function(H,Z){var G,te=0,ie=null,le=0;for(G=0;G"u")a.blob=!1;else{var o=new ArrayBuffer(0);try{a.blob=new Blob([o],{type:"application/zip"}).size===0}catch{try{var l=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);l.append(o),a.blob=l.getBlob("application/zip").size===0}catch{a.blob=!1}}}try{a.nodestream=!!n("readable-stream").Readable}catch{a.nodestream=!1}},{"readable-stream":16}],31:[function(n,s,a){for(var o=n("./utils"),l=n("./support"),i=n("./nodejsUtils"),h=n("./stream/GenericWorker"),p=new Array(256),x=0;x<256;x++)p[x]=252<=x?6:248<=x?5:240<=x?4:224<=x?3:192<=x?2:1;p[254]=p[254]=1;function y(){h.call(this,"utf-8 decode"),this.leftOver=null}function b(){h.call(this,"utf-8 encode")}a.utf8encode=function(j){return l.nodebuffer?i.newBufferFrom(j,"utf-8"):function(C){var N,A,E,T,L,z=C.length,F=0;for(T=0;T>>6:(A<65536?N[L++]=224|A>>>12:(N[L++]=240|A>>>18,N[L++]=128|A>>>12&63),N[L++]=128|A>>>6&63),N[L++]=128|63&A);return N}(j)},a.utf8decode=function(j){return l.nodebuffer?o.transformTo("nodebuffer",j).toString("utf-8"):function(C){var N,A,E,T,L=C.length,z=new Array(2*L);for(N=A=0;N>10&1023,z[A++]=56320|1023&E)}return z.length!==A&&(z.subarray?z=z.subarray(0,A):z.length=A),o.applyFromCharCode(z)}(j=o.transformTo(l.uint8array?"uint8array":"array",j))},o.inherits(y,h),y.prototype.processChunk=function(j){var C=o.transformTo(l.uint8array?"uint8array":"array",j.data);if(this.leftOver&&this.leftOver.length){if(l.uint8array){var N=C;(C=new Uint8Array(N.length+this.leftOver.length)).set(this.leftOver,0),C.set(N,this.leftOver.length)}else C=this.leftOver.concat(C);this.leftOver=null}var A=function(T,L){var z;for((L=L||T.length)>T.length&&(L=T.length),z=L-1;0<=z&&(192&T[z])==128;)z--;return z<0||z===0?L:z+p[T[z]]>L?z:L}(C),E=C;A!==C.length&&(l.uint8array?(E=C.subarray(0,A),this.leftOver=C.subarray(A,C.length)):(E=C.slice(0,A),this.leftOver=C.slice(A,C.length))),this.push({data:a.utf8decode(E),meta:j.meta})},y.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:a.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},a.Utf8DecodeWorker=y,o.inherits(b,h),b.prototype.processChunk=function(j){this.push({data:a.utf8encode(j.data),meta:j.meta})},a.Utf8EncodeWorker=b},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(n,s,a){var o=n("./support"),l=n("./base64"),i=n("./nodejsUtils"),h=n("./external");function p(N){return N}function x(N,A){for(var E=0;E>8;this.dir=!!(16&this.externalFileAttributes),j==0&&(this.dosPermissions=63&this.externalFileAttributes),j==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var j=o(this.extraFields[1].value);this.uncompressedSize===l.MAX_VALUE_32BITS&&(this.uncompressedSize=j.readInt(8)),this.compressedSize===l.MAX_VALUE_32BITS&&(this.compressedSize=j.readInt(8)),this.localHeaderOffset===l.MAX_VALUE_32BITS&&(this.localHeaderOffset=j.readInt(8)),this.diskNumberStart===l.MAX_VALUE_32BITS&&(this.diskNumberStart=j.readInt(4))}},readExtraFields:function(j){var C,N,A,E=j.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});j.index+4>>6:(j<65536?b[A++]=224|j>>>12:(b[A++]=240|j>>>18,b[A++]=128|j>>>12&63),b[A++]=128|j>>>6&63),b[A++]=128|63&j);return b},a.buf2binstring=function(y){return x(y,y.length)},a.binstring2buf=function(y){for(var b=new o.Buf8(y.length),j=0,C=b.length;j>10&1023,T[C++]=56320|1023&N)}return x(T,C)},a.utf8border=function(y,b){var j;for((b=b||y.length)>y.length&&(b=y.length),j=b-1;0<=j&&(192&y[j])==128;)j--;return j<0||j===0?b:j+h[y[j]]>b?j:b}},{"./common":41}],43:[function(n,s,a){s.exports=function(o,l,i,h){for(var p=65535&o|0,x=o>>>16&65535|0,y=0;i!==0;){for(i-=y=2e3>>1:l>>>1;i[h]=l}return i}();s.exports=function(l,i,h,p){var x=o,y=p+h;l^=-1;for(var b=p;b>>8^x[255&(l^i[b])];return-1^l}},{}],46:[function(n,s,a){var o,l=n("../utils/common"),i=n("./trees"),h=n("./adler32"),p=n("./crc32"),x=n("./messages"),y=0,b=4,j=0,C=-2,N=-1,A=4,E=2,T=8,L=9,z=286,F=30,q=19,H=2*z+1,Z=15,G=3,te=258,ie=te+G+1,le=42,ye=113,ne=1,ge=2,ae=3,he=4;function ue(pe,yt){return pe.msg=x[yt],yt}function _e(pe){return(pe<<1)-(4pe.avail_out&&(rt=pe.avail_out),rt!==0&&(l.arraySet(pe.output,yt.pending_buf,yt.pending_out,rt,pe.next_out),pe.next_out+=rt,yt.pending_out+=rt,pe.total_out+=rt,pe.avail_out-=rt,yt.pending-=rt,yt.pending===0&&(yt.pending_out=0))}function be(pe,yt){i._tr_flush_block(pe,0<=pe.block_start?pe.block_start:-1,pe.strstart-pe.block_start,yt),pe.block_start=pe.strstart,Ce(pe.strm)}function me(pe,yt){pe.pending_buf[pe.pending++]=yt}function Le(pe,yt){pe.pending_buf[pe.pending++]=yt>>>8&255,pe.pending_buf[pe.pending++]=255&yt}function Ne(pe,yt){var rt,at,Me=pe.max_chain_length,ft=pe.strstart,qe=pe.prev_length,Oe=pe.nice_match,Qe=pe.strstart>pe.w_size-ie?pe.strstart-(pe.w_size-ie):0,nt=pe.window,gt=pe.w_mask,mt=pe.prev,Mt=pe.strstart+te,wt=nt[ft+qe-1],Qt=nt[ft+qe];pe.prev_length>=pe.good_match&&(Me>>=2),Oe>pe.lookahead&&(Oe=pe.lookahead);do if(nt[(rt=yt)+qe]===Qt&&nt[rt+qe-1]===wt&&nt[rt]===nt[ft]&&nt[++rt]===nt[ft+1]){ft+=2,rt++;do;while(nt[++ft]===nt[++rt]&&nt[++ft]===nt[++rt]&&nt[++ft]===nt[++rt]&&nt[++ft]===nt[++rt]&&nt[++ft]===nt[++rt]&&nt[++ft]===nt[++rt]&&nt[++ft]===nt[++rt]&&nt[++ft]===nt[++rt]&&ftQe&&--Me!=0);return qe<=pe.lookahead?qe:pe.lookahead}function Be(pe){var yt,rt,at,Me,ft,qe,Oe,Qe,nt,gt,mt=pe.w_size;do{if(Me=pe.window_size-pe.lookahead-pe.strstart,pe.strstart>=mt+(mt-ie)){for(l.arraySet(pe.window,pe.window,mt,mt,0),pe.match_start-=mt,pe.strstart-=mt,pe.block_start-=mt,yt=rt=pe.hash_size;at=pe.head[--yt],pe.head[yt]=mt<=at?at-mt:0,--rt;);for(yt=rt=mt;at=pe.prev[--yt],pe.prev[yt]=mt<=at?at-mt:0,--rt;);Me+=mt}if(pe.strm.avail_in===0)break;if(qe=pe.strm,Oe=pe.window,Qe=pe.strstart+pe.lookahead,nt=Me,gt=void 0,gt=qe.avail_in,nt=G)for(ft=pe.strstart-pe.insert,pe.ins_h=pe.window[ft],pe.ins_h=(pe.ins_h<=G&&(pe.ins_h=(pe.ins_h<=G)if(at=i._tr_tally(pe,pe.strstart-pe.match_start,pe.match_length-G),pe.lookahead-=pe.match_length,pe.match_length<=pe.max_lazy_match&&pe.lookahead>=G){for(pe.match_length--;pe.strstart++,pe.ins_h=(pe.ins_h<=G&&(pe.ins_h=(pe.ins_h<=G&&pe.match_length<=pe.prev_length){for(Me=pe.strstart+pe.lookahead-G,at=i._tr_tally(pe,pe.strstart-1-pe.prev_match,pe.prev_length-G),pe.lookahead-=pe.prev_length-1,pe.prev_length-=2;++pe.strstart<=Me&&(pe.ins_h=(pe.ins_h<pe.pending_buf_size-5&&(rt=pe.pending_buf_size-5);;){if(pe.lookahead<=1){if(Be(pe),pe.lookahead===0&&yt===y)return ne;if(pe.lookahead===0)break}pe.strstart+=pe.lookahead,pe.lookahead=0;var at=pe.block_start+rt;if((pe.strstart===0||pe.strstart>=at)&&(pe.lookahead=pe.strstart-at,pe.strstart=at,be(pe,!1),pe.strm.avail_out===0)||pe.strstart-pe.block_start>=pe.w_size-ie&&(be(pe,!1),pe.strm.avail_out===0))return ne}return pe.insert=0,yt===b?(be(pe,!0),pe.strm.avail_out===0?ae:he):(pe.strstart>pe.block_start&&(be(pe,!1),pe.strm.avail_out),ne)}),new Re(4,4,8,4,Ee),new Re(4,5,16,8,Ee),new Re(4,6,32,32,Ee),new Re(4,4,16,16,Ue),new Re(8,16,32,32,Ue),new Re(8,16,128,128,Ue),new Re(8,32,128,256,Ue),new Re(32,128,258,1024,Ue),new Re(32,258,258,4096,Ue)],a.deflateInit=function(pe,yt){return Ze(pe,yt,T,15,8,0)},a.deflateInit2=Ze,a.deflateReset=Te,a.deflateResetKeep=et,a.deflateSetHeader=function(pe,yt){return pe&&pe.state?pe.state.wrap!==2?C:(pe.state.gzhead=yt,j):C},a.deflate=function(pe,yt){var rt,at,Me,ft;if(!pe||!pe.state||5>8&255),me(at,at.gzhead.time>>16&255),me(at,at.gzhead.time>>24&255),me(at,at.level===9?2:2<=at.strategy||at.level<2?4:0),me(at,255&at.gzhead.os),at.gzhead.extra&&at.gzhead.extra.length&&(me(at,255&at.gzhead.extra.length),me(at,at.gzhead.extra.length>>8&255)),at.gzhead.hcrc&&(pe.adler=p(pe.adler,at.pending_buf,at.pending,0)),at.gzindex=0,at.status=69):(me(at,0),me(at,0),me(at,0),me(at,0),me(at,0),me(at,at.level===9?2:2<=at.strategy||at.level<2?4:0),me(at,3),at.status=ye);else{var qe=T+(at.w_bits-8<<4)<<8;qe|=(2<=at.strategy||at.level<2?0:at.level<6?1:at.level===6?2:3)<<6,at.strstart!==0&&(qe|=32),qe+=31-qe%31,at.status=ye,Le(at,qe),at.strstart!==0&&(Le(at,pe.adler>>>16),Le(at,65535&pe.adler)),pe.adler=1}if(at.status===69)if(at.gzhead.extra){for(Me=at.pending;at.gzindex<(65535&at.gzhead.extra.length)&&(at.pending!==at.pending_buf_size||(at.gzhead.hcrc&&at.pending>Me&&(pe.adler=p(pe.adler,at.pending_buf,at.pending-Me,Me)),Ce(pe),Me=at.pending,at.pending!==at.pending_buf_size));)me(at,255&at.gzhead.extra[at.gzindex]),at.gzindex++;at.gzhead.hcrc&&at.pending>Me&&(pe.adler=p(pe.adler,at.pending_buf,at.pending-Me,Me)),at.gzindex===at.gzhead.extra.length&&(at.gzindex=0,at.status=73)}else at.status=73;if(at.status===73)if(at.gzhead.name){Me=at.pending;do{if(at.pending===at.pending_buf_size&&(at.gzhead.hcrc&&at.pending>Me&&(pe.adler=p(pe.adler,at.pending_buf,at.pending-Me,Me)),Ce(pe),Me=at.pending,at.pending===at.pending_buf_size)){ft=1;break}ft=at.gzindexMe&&(pe.adler=p(pe.adler,at.pending_buf,at.pending-Me,Me)),ft===0&&(at.gzindex=0,at.status=91)}else at.status=91;if(at.status===91)if(at.gzhead.comment){Me=at.pending;do{if(at.pending===at.pending_buf_size&&(at.gzhead.hcrc&&at.pending>Me&&(pe.adler=p(pe.adler,at.pending_buf,at.pending-Me,Me)),Ce(pe),Me=at.pending,at.pending===at.pending_buf_size)){ft=1;break}ft=at.gzindexMe&&(pe.adler=p(pe.adler,at.pending_buf,at.pending-Me,Me)),ft===0&&(at.status=103)}else at.status=103;if(at.status===103&&(at.gzhead.hcrc?(at.pending+2>at.pending_buf_size&&Ce(pe),at.pending+2<=at.pending_buf_size&&(me(at,255&pe.adler),me(at,pe.adler>>8&255),pe.adler=0,at.status=ye)):at.status=ye),at.pending!==0){if(Ce(pe),pe.avail_out===0)return at.last_flush=-1,j}else if(pe.avail_in===0&&_e(yt)<=_e(rt)&&yt!==b)return ue(pe,-5);if(at.status===666&&pe.avail_in!==0)return ue(pe,-5);if(pe.avail_in!==0||at.lookahead!==0||yt!==y&&at.status!==666){var Oe=at.strategy===2?function(Qe,nt){for(var gt;;){if(Qe.lookahead===0&&(Be(Qe),Qe.lookahead===0)){if(nt===y)return ne;break}if(Qe.match_length=0,gt=i._tr_tally(Qe,0,Qe.window[Qe.strstart]),Qe.lookahead--,Qe.strstart++,gt&&(be(Qe,!1),Qe.strm.avail_out===0))return ne}return Qe.insert=0,nt===b?(be(Qe,!0),Qe.strm.avail_out===0?ae:he):Qe.last_lit&&(be(Qe,!1),Qe.strm.avail_out===0)?ne:ge}(at,yt):at.strategy===3?function(Qe,nt){for(var gt,mt,Mt,wt,Qt=Qe.window;;){if(Qe.lookahead<=te){if(Be(Qe),Qe.lookahead<=te&&nt===y)return ne;if(Qe.lookahead===0)break}if(Qe.match_length=0,Qe.lookahead>=G&&0Qe.lookahead&&(Qe.match_length=Qe.lookahead)}if(Qe.match_length>=G?(gt=i._tr_tally(Qe,1,Qe.match_length-G),Qe.lookahead-=Qe.match_length,Qe.strstart+=Qe.match_length,Qe.match_length=0):(gt=i._tr_tally(Qe,0,Qe.window[Qe.strstart]),Qe.lookahead--,Qe.strstart++),gt&&(be(Qe,!1),Qe.strm.avail_out===0))return ne}return Qe.insert=0,nt===b?(be(Qe,!0),Qe.strm.avail_out===0?ae:he):Qe.last_lit&&(be(Qe,!1),Qe.strm.avail_out===0)?ne:ge}(at,yt):o[at.level].func(at,yt);if(Oe!==ae&&Oe!==he||(at.status=666),Oe===ne||Oe===ae)return pe.avail_out===0&&(at.last_flush=-1),j;if(Oe===ge&&(yt===1?i._tr_align(at):yt!==5&&(i._tr_stored_block(at,0,0,!1),yt===3&&(Ae(at.head),at.lookahead===0&&(at.strstart=0,at.block_start=0,at.insert=0))),Ce(pe),pe.avail_out===0))return at.last_flush=-1,j}return yt!==b?j:at.wrap<=0?1:(at.wrap===2?(me(at,255&pe.adler),me(at,pe.adler>>8&255),me(at,pe.adler>>16&255),me(at,pe.adler>>24&255),me(at,255&pe.total_in),me(at,pe.total_in>>8&255),me(at,pe.total_in>>16&255),me(at,pe.total_in>>24&255)):(Le(at,pe.adler>>>16),Le(at,65535&pe.adler)),Ce(pe),0=rt.w_size&&(ft===0&&(Ae(rt.head),rt.strstart=0,rt.block_start=0,rt.insert=0),nt=new l.Buf8(rt.w_size),l.arraySet(nt,yt,gt-rt.w_size,rt.w_size,0),yt=nt,gt=rt.w_size),qe=pe.avail_in,Oe=pe.next_in,Qe=pe.input,pe.avail_in=gt,pe.next_in=0,pe.input=yt,Be(rt);rt.lookahead>=G;){for(at=rt.strstart,Me=rt.lookahead-(G-1);rt.ins_h=(rt.ins_h<>>=G=Z>>>24,L-=G,(G=Z>>>16&255)===0)ge[x++]=65535&Z;else{if(!(16&G)){if(!(64&G)){Z=z[(65535&Z)+(T&(1<>>=G,L-=G),L<15&&(T+=ne[h++]<>>=G=Z>>>24,L-=G,!(16&(G=Z>>>16&255))){if(!(64&G)){Z=F[(65535&Z)+(T&(1<>>=G,L-=G,(G=x-y)>3,T&=(1<<(L-=te<<3))-1,o.next_in=h,o.next_out=x,o.avail_in=h>>24&255)+(le>>>8&65280)+((65280&le)<<8)+((255&le)<<24)}function T(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new o.Buf16(320),this.work=new o.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function L(le){var ye;return le&&le.state?(ye=le.state,le.total_in=le.total_out=ye.total=0,le.msg="",ye.wrap&&(le.adler=1&ye.wrap),ye.mode=C,ye.last=0,ye.havedict=0,ye.dmax=32768,ye.head=null,ye.hold=0,ye.bits=0,ye.lencode=ye.lendyn=new o.Buf32(N),ye.distcode=ye.distdyn=new o.Buf32(A),ye.sane=1,ye.back=-1,b):j}function z(le){var ye;return le&&le.state?((ye=le.state).wsize=0,ye.whave=0,ye.wnext=0,L(le)):j}function F(le,ye){var ne,ge;return le&&le.state?(ge=le.state,ye<0?(ne=0,ye=-ye):(ne=1+(ye>>4),ye<48&&(ye&=15)),ye&&(ye<8||15=he.wsize?(o.arraySet(he.window,ye,ne-he.wsize,he.wsize,0),he.wnext=0,he.whave=he.wsize):(ge<(ae=he.wsize-he.wnext)&&(ae=ge),o.arraySet(he.window,ye,ne-ge,ae,he.wnext),(ge-=ae)?(o.arraySet(he.window,ye,ne-ge,ge,0),he.wnext=ge,he.whave=he.wsize):(he.wnext+=ae,he.wnext===he.wsize&&(he.wnext=0),he.whave>>8&255,ne.check=i(ne.check,ft,2,0),be=Ce=0,ne.mode=2;break}if(ne.flags=0,ne.head&&(ne.head.done=!1),!(1&ne.wrap)||(((255&Ce)<<8)+(Ce>>8))%31){le.msg="incorrect header check",ne.mode=30;break}if((15&Ce)!=8){le.msg="unknown compression method",ne.mode=30;break}if(be-=4,pe=8+(15&(Ce>>>=4)),ne.wbits===0)ne.wbits=pe;else if(pe>ne.wbits){le.msg="invalid window size",ne.mode=30;break}ne.dmax=1<>8&1),512&ne.flags&&(ft[0]=255&Ce,ft[1]=Ce>>>8&255,ne.check=i(ne.check,ft,2,0)),be=Ce=0,ne.mode=3;case 3:for(;be<32;){if(_e===0)break e;_e--,Ce+=ge[he++]<>>8&255,ft[2]=Ce>>>16&255,ft[3]=Ce>>>24&255,ne.check=i(ne.check,ft,4,0)),be=Ce=0,ne.mode=4;case 4:for(;be<16;){if(_e===0)break e;_e--,Ce+=ge[he++]<>8),512&ne.flags&&(ft[0]=255&Ce,ft[1]=Ce>>>8&255,ne.check=i(ne.check,ft,2,0)),be=Ce=0,ne.mode=5;case 5:if(1024&ne.flags){for(;be<16;){if(_e===0)break e;_e--,Ce+=ge[he++]<>>8&255,ne.check=i(ne.check,ft,2,0)),be=Ce=0}else ne.head&&(ne.head.extra=null);ne.mode=6;case 6:if(1024&ne.flags&&(_e<(Ne=ne.length)&&(Ne=_e),Ne&&(ne.head&&(pe=ne.head.extra_len-ne.length,ne.head.extra||(ne.head.extra=new Array(ne.head.extra_len)),o.arraySet(ne.head.extra,ge,he,Ne,pe)),512&ne.flags&&(ne.check=i(ne.check,ge,Ne,he)),_e-=Ne,he+=Ne,ne.length-=Ne),ne.length))break e;ne.length=0,ne.mode=7;case 7:if(2048&ne.flags){if(_e===0)break e;for(Ne=0;pe=ge[he+Ne++],ne.head&&pe&&ne.length<65536&&(ne.head.name+=String.fromCharCode(pe)),pe&&Ne<_e;);if(512&ne.flags&&(ne.check=i(ne.check,ge,Ne,he)),_e-=Ne,he+=Ne,pe)break e}else ne.head&&(ne.head.name=null);ne.length=0,ne.mode=8;case 8:if(4096&ne.flags){if(_e===0)break e;for(Ne=0;pe=ge[he+Ne++],ne.head&&pe&&ne.length<65536&&(ne.head.comment+=String.fromCharCode(pe)),pe&&Ne<_e;);if(512&ne.flags&&(ne.check=i(ne.check,ge,Ne,he)),_e-=Ne,he+=Ne,pe)break e}else ne.head&&(ne.head.comment=null);ne.mode=9;case 9:if(512&ne.flags){for(;be<16;){if(_e===0)break e;_e--,Ce+=ge[he++]<>9&1,ne.head.done=!0),le.adler=ne.check=0,ne.mode=12;break;case 10:for(;be<32;){if(_e===0)break e;_e--,Ce+=ge[he++]<>>=7&be,be-=7&be,ne.mode=27;break}for(;be<3;){if(_e===0)break e;_e--,Ce+=ge[he++]<>>=1)){case 0:ne.mode=14;break;case 1:if(te(ne),ne.mode=20,ye!==6)break;Ce>>>=2,be-=2;break e;case 2:ne.mode=17;break;case 3:le.msg="invalid block type",ne.mode=30}Ce>>>=2,be-=2;break;case 14:for(Ce>>>=7&be,be-=7&be;be<32;){if(_e===0)break e;_e--,Ce+=ge[he++]<>>16^65535)){le.msg="invalid stored block lengths",ne.mode=30;break}if(ne.length=65535&Ce,be=Ce=0,ne.mode=15,ye===6)break e;case 15:ne.mode=16;case 16:if(Ne=ne.length){if(_e>>=5,be-=5,ne.ndist=1+(31&Ce),Ce>>>=5,be-=5,ne.ncode=4+(15&Ce),Ce>>>=4,be-=4,286>>=3,be-=3}for(;ne.have<19;)ne.lens[qe[ne.have++]]=0;if(ne.lencode=ne.lendyn,ne.lenbits=7,rt={bits:ne.lenbits},yt=p(0,ne.lens,0,19,ne.lencode,0,ne.work,rt),ne.lenbits=rt.bits,yt){le.msg="invalid code lengths set",ne.mode=30;break}ne.have=0,ne.mode=19;case 19:for(;ne.have>>16&255,je=65535&Me,!((Ue=Me>>>24)<=be);){if(_e===0)break e;_e--,Ce+=ge[he++]<>>=Ue,be-=Ue,ne.lens[ne.have++]=je;else{if(je===16){for(at=Ue+2;be>>=Ue,be-=Ue,ne.have===0){le.msg="invalid bit length repeat",ne.mode=30;break}pe=ne.lens[ne.have-1],Ne=3+(3&Ce),Ce>>>=2,be-=2}else if(je===17){for(at=Ue+3;be>>=Ue)),Ce>>>=3,be-=3}else{for(at=Ue+7;be>>=Ue)),Ce>>>=7,be-=7}if(ne.have+Ne>ne.nlen+ne.ndist){le.msg="invalid bit length repeat",ne.mode=30;break}for(;Ne--;)ne.lens[ne.have++]=pe}}if(ne.mode===30)break;if(ne.lens[256]===0){le.msg="invalid code -- missing end-of-block",ne.mode=30;break}if(ne.lenbits=9,rt={bits:ne.lenbits},yt=p(x,ne.lens,0,ne.nlen,ne.lencode,0,ne.work,rt),ne.lenbits=rt.bits,yt){le.msg="invalid literal/lengths set",ne.mode=30;break}if(ne.distbits=6,ne.distcode=ne.distdyn,rt={bits:ne.distbits},yt=p(y,ne.lens,ne.nlen,ne.ndist,ne.distcode,0,ne.work,rt),ne.distbits=rt.bits,yt){le.msg="invalid distances set",ne.mode=30;break}if(ne.mode=20,ye===6)break e;case 20:ne.mode=21;case 21:if(6<=_e&&258<=Ae){le.next_out=ue,le.avail_out=Ae,le.next_in=he,le.avail_in=_e,ne.hold=Ce,ne.bits=be,h(le,Le),ue=le.next_out,ae=le.output,Ae=le.avail_out,he=le.next_in,ge=le.input,_e=le.avail_in,Ce=ne.hold,be=ne.bits,ne.mode===12&&(ne.back=-1);break}for(ne.back=0;Re=(Me=ne.lencode[Ce&(1<>>16&255,je=65535&Me,!((Ue=Me>>>24)<=be);){if(_e===0)break e;_e--,Ce+=ge[he++]<>et)])>>>16&255,je=65535&Me,!(et+(Ue=Me>>>24)<=be);){if(_e===0)break e;_e--,Ce+=ge[he++]<>>=et,be-=et,ne.back+=et}if(Ce>>>=Ue,be-=Ue,ne.back+=Ue,ne.length=je,Re===0){ne.mode=26;break}if(32&Re){ne.back=-1,ne.mode=12;break}if(64&Re){le.msg="invalid literal/length code",ne.mode=30;break}ne.extra=15&Re,ne.mode=22;case 22:if(ne.extra){for(at=ne.extra;be>>=ne.extra,be-=ne.extra,ne.back+=ne.extra}ne.was=ne.length,ne.mode=23;case 23:for(;Re=(Me=ne.distcode[Ce&(1<>>16&255,je=65535&Me,!((Ue=Me>>>24)<=be);){if(_e===0)break e;_e--,Ce+=ge[he++]<>et)])>>>16&255,je=65535&Me,!(et+(Ue=Me>>>24)<=be);){if(_e===0)break e;_e--,Ce+=ge[he++]<>>=et,be-=et,ne.back+=et}if(Ce>>>=Ue,be-=Ue,ne.back+=Ue,64&Re){le.msg="invalid distance code",ne.mode=30;break}ne.offset=je,ne.extra=15&Re,ne.mode=24;case 24:if(ne.extra){for(at=ne.extra;be>>=ne.extra,be-=ne.extra,ne.back+=ne.extra}if(ne.offset>ne.dmax){le.msg="invalid distance too far back",ne.mode=30;break}ne.mode=25;case 25:if(Ae===0)break e;if(Ne=Le-Ae,ne.offset>Ne){if((Ne=ne.offset-Ne)>ne.whave&&ne.sane){le.msg="invalid distance too far back",ne.mode=30;break}Be=Ne>ne.wnext?(Ne-=ne.wnext,ne.wsize-Ne):ne.wnext-Ne,Ne>ne.length&&(Ne=ne.length),Ee=ne.window}else Ee=ae,Be=ue-ne.offset,Ne=ne.length;for(AeH?(G=Be[Ee+A[ye]],be[me+A[ye]]):(G=96,0),T=1<>ue)+(L-=T)]=Z<<24|G<<16|te|0,L!==0;);for(T=1<>=1;if(T!==0?(Ce&=T-1,Ce+=T):Ce=0,ye++,--Le[le]==0){if(le===ge)break;le=y[b+A[ye]]}if(ae>>7)]}function me(Me,ft){Me.pending_buf[Me.pending++]=255&ft,Me.pending_buf[Me.pending++]=ft>>>8&255}function Le(Me,ft,qe){Me.bi_valid>E-qe?(Me.bi_buf|=ft<>E-Me.bi_valid,Me.bi_valid+=qe-E):(Me.bi_buf|=ft<>>=1,qe<<=1,0<--ft;);return qe>>>1}function Ee(Me,ft,qe){var Oe,Qe,nt=new Array(A+1),gt=0;for(Oe=1;Oe<=A;Oe++)nt[Oe]=gt=gt+qe[Oe-1]<<1;for(Qe=0;Qe<=ft;Qe++){var mt=Me[2*Qe+1];mt!==0&&(Me[2*Qe]=Be(nt[mt]++,mt))}}function Ue(Me){var ft;for(ft=0;ft>1;1<=qe;qe--)et(Me,nt,qe);for(Qe=Mt;qe=Me.heap[1],Me.heap[1]=Me.heap[Me.heap_len--],et(Me,nt,1),Oe=Me.heap[1],Me.heap[--Me.heap_max]=qe,Me.heap[--Me.heap_max]=Oe,nt[2*Qe]=nt[2*qe]+nt[2*Oe],Me.depth[Qe]=(Me.depth[qe]>=Me.depth[Oe]?Me.depth[qe]:Me.depth[Oe])+1,nt[2*qe+1]=nt[2*Oe+1]=Qe,Me.heap[1]=Qe++,et(Me,nt,1),2<=Me.heap_len;);Me.heap[--Me.heap_max]=Me.heap[1],function(Qt,Cr){var cn,jn,Xr,Pn,js,hr,xs=Cr.dyn_tree,ka=Cr.max_code,xa=Cr.stat_desc.static_tree,zi=Cr.stat_desc.has_stree,Bi=Cr.stat_desc.extra_bits,tl=Cr.stat_desc.extra_base,xo=Cr.stat_desc.max_length,Hs=0;for(Pn=0;Pn<=A;Pn++)Qt.bl_count[Pn]=0;for(xs[2*Qt.heap[Qt.heap_max]+1]=0,cn=Qt.heap_max+1;cn>=7;Qe>>=1)if(1&wt&&mt.dyn_ltree[2*Mt]!==0)return l;if(mt.dyn_ltree[18]!==0||mt.dyn_ltree[20]!==0||mt.dyn_ltree[26]!==0)return i;for(Mt=32;Mt>>3,(nt=Me.static_len+3+7>>>3)<=Qe&&(Qe=nt)):Qe=nt=qe+5,qe+4<=Qe&&ft!==-1?at(Me,ft,qe,Oe):Me.strategy===4||nt===Qe?(Le(Me,2+(Oe?1:0),3),Te(Me,ie,le)):(Le(Me,4+(Oe?1:0),3),function(mt,Mt,wt,Qt){var Cr;for(Le(mt,Mt-257,5),Le(mt,wt-1,5),Le(mt,Qt-4,4),Cr=0;Cr>>8&255,Me.pending_buf[Me.d_buf+2*Me.last_lit+1]=255&ft,Me.pending_buf[Me.l_buf+Me.last_lit]=255&qe,Me.last_lit++,ft===0?Me.dyn_ltree[2*qe]++:(Me.matches++,ft--,Me.dyn_ltree[2*(ne[qe]+y+1)]++,Me.dyn_dtree[2*be(ft)]++),Me.last_lit===Me.lit_bufsize-1},a._tr_align=function(Me){Le(Me,2,3),Ne(Me,L,ie),function(ft){ft.bi_valid===16?(me(ft,ft.bi_buf),ft.bi_buf=0,ft.bi_valid=0):8<=ft.bi_valid&&(ft.pending_buf[ft.pending++]=255&ft.bi_buf,ft.bi_buf>>=8,ft.bi_valid-=8)}(Me)}},{"../utils/common":41}],53:[function(n,s,a){s.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(n,s,a){(function(o){(function(l,i){if(!l.setImmediate){var h,p,x,y,b=1,j={},C=!1,N=l.document,A=Object.getPrototypeOf&&Object.getPrototypeOf(l);A=A&&A.setTimeout?A:l,h={}.toString.call(l.process)==="[object process]"?function(z){process.nextTick(function(){T(z)})}:function(){if(l.postMessage&&!l.importScripts){var z=!0,F=l.onmessage;return l.onmessage=function(){z=!1},l.postMessage("","*"),l.onmessage=F,z}}()?(y="setImmediate$"+Math.random()+"$",l.addEventListener?l.addEventListener("message",L,!1):l.attachEvent("onmessage",L),function(z){l.postMessage(y+z,"*")}):l.MessageChannel?((x=new MessageChannel).port1.onmessage=function(z){T(z.data)},function(z){x.port2.postMessage(z)}):N&&"onreadystatechange"in N.createElement("script")?(p=N.documentElement,function(z){var F=N.createElement("script");F.onreadystatechange=function(){T(z),F.onreadystatechange=null,p.removeChild(F),F=null},p.appendChild(F)}):function(z){setTimeout(T,0,z)},A.setImmediate=function(z){typeof z!="function"&&(z=new Function(""+z));for(var F=new Array(arguments.length-1),q=0;q"u"?o===void 0?this:o:self)}).call(this,typeof Ax<"u"?Ax:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(YDe);var bxt=YDe.exports;const wxt=Hi(bxt),jxt=()=>{const{isAdmin:t}=Qr(),[e,n]=I.useState(null),[s,a]=I.useState(null),[o,l]=I.useState("all"),[i,h]=I.useState(new Set),[p,x]=I.useState(!1),[y,b]=I.useState(!1),[j,C]=I.useState("images"),[N,A]=I.useState(null),{data:E=[],isLoading:T}=Yt({queryKey:["social-swag-2"],queryFn:async()=>{const{data:_e,error:Ae}=await J.from("social_swag_2").select("*").order("month",{ascending:!1}).order("sort_order");if(Ae)throw Ae;return _e}}),{data:L=[]}=Yt({queryKey:["social-swag-2-months"],queryFn:async()=>{const{data:_e,error:Ae}=await J.from("social_swag_2_months").select("*").order("month",{ascending:!1});if(Ae)throw Ae;return _e}}),{data:z=[]}=Yt({queryKey:["social-swag-2-reels"],queryFn:async()=>{const{data:_e,error:Ae}=await J.from("social_swag_2_reels").select("*").order("month",{ascending:!1});if(Ae)throw Ae;return _e}}),{data:F=[]}=Yt({queryKey:["my-social-accounts-count"],queryFn:async()=>{const{data:_e,error:Ae}=await J.from("social_accounts").select("id, platform").eq("is_active",!0);if(Ae)throw Ae;return _e||[]}}),q=F.length>0,H=I.useMemo(()=>o==="all"?null:z.find(_e=>_e.month===o)||null,[o,z]),Z=I.useMemo(()=>[...new Set(E.map(Ae=>Ae.month))].sort((Ae,Ce)=>Ce.localeCompare(Ae)),[E]);I.useEffect(()=>{Z.length>0&&o==="all"&&l(Z[0])},[Z,o]);const G=_e=>{try{const Ae=oxe(_e,"yyyy-MM",new Date);return yn(Ae,"MMMM yyyy")}catch{return _e}},te=I.useMemo(()=>o==="all"?E:E.filter(_e=>_e.month===o),[o,E]),ie=I.useMemo(()=>{var _e;return o==="all"?null:((_e=L.find(Ae=>Ae.month===o))==null?void 0:_e.canva_link)||null},[o,L]),le=async _e=>{try{await navigator.clipboard.writeText(_e),ze.success("Caption copied to clipboard!")}catch{ze.error("Failed to copy caption")}},ye=async(_e,Ae)=>{try{const be=await(await fetch(_e)).blob(),me=/iPhone|iPad|iPod|Android/i.test(navigator.userAgent),Le=navigator.canShare&&navigator.canShare({files:[new File([be],"test.jpg",{type:"image/jpeg"})]});if(me&&Le){const Ne=new File([be],`social-swag-${Ae}.jpg`,{type:"image/jpeg"});await navigator.share({files:[Ne],title:"Social Swag Image"}),ze.success("Image ready to save!")}else{const Ne=window.URL.createObjectURL(be),Be=document.createElement("a");Be.href=Ne,Be.download=`social-swag-${Ae}.jpg`,document.body.appendChild(Be),Be.click(),document.body.removeChild(Be),window.URL.revokeObjectURL(Ne),ze.success("Image downloaded!")}}catch(Ce){Ce.name!=="AbortError"&&ze.error("Failed to download image")}},ne=_e=>{h(Ae=>{const Ce=new Set(Ae);return Ce.has(_e)?Ce.delete(_e):Ce.add(_e),Ce})},ge=()=>{h(new Set(te.map(_e=>_e.id)))},ae=()=>{h(new Set),x(!1)},he=async()=>{const _e=te.filter(Ae=>i.has(Ae.id));if(_e.length===0){ze.error("No images selected");return}b(!0),ze.info(`Preparing ${_e.length} images for download...`);try{const Ae=new wxt,Ce=[..._e].sort((Be,Ee)=>Be.sort_order-Ee.sort_order);for(let Be=0;Be{p?ne(_e.id):n(_e)};return r.jsx(Lr,{title:"Social Swag 2.0",children:r.jsxs("div",{className:"space-y-8",children:[r.jsxs("div",{className:"relative overflow-hidden rounded-2xl bg-gradient-to-br from-primary via-primary/80 to-info p-8 text-primary-foreground",children:[r.jsx("div",{className:"absolute inset-0 bg-[url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNjAiIGhlaWdodD0iNjAiIHZpZXdCb3g9IjAgMCA2MCA2MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxnIGZpbGw9IiNmZmYiIGZpbGwtb3BhY2l0eT0iMC4xIj48cGF0aCBkPSJNMzYgMzRjMC0yIDItNCAyLTRzMiAyIDIgNC0yIDQtMiA0LTItMi0yLTR6Ii8+PC9nPjwvZz48L3N2Zz4=')] opacity-30"}),r.jsxs("div",{className:"relative",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-3 mb-4",children:[r.jsxs(Ot,{variant:"secondary",className:"bg-white/20 text-white border-0 backdrop-blur-sm",children:[r.jsx(Ms,{className:"h-3 w-3 mr-1"}),"New content monthly"]}),r.jsxs(Ot,{variant:"secondary",className:"bg-white/20 text-white border-0 backdrop-blur-sm",children:[r.jsx(Pl,{className:"h-3 w-3 mr-1"}),E.length," images"]})]}),r.jsx("h1",{className:"text-3xl md:text-4xl font-bold mb-3",children:"Social Swag 📸"}),r.jsx("p",{className:"text-lg text-primary-foreground/90 max-w-2xl",children:"Ready-to-post social media images delivered to you monthly. Just download, copy the caption, and share with your audience!"})]})]}),t?r.jsxs(Ii,{defaultValue:"gallery",className:"space-y-6",children:[r.jsxs(wi,{className:"grid w-full max-w-md grid-cols-2",children:[r.jsxs(ln,{value:"gallery",className:"gap-2",children:[r.jsx(Pl,{className:"h-4 w-4"}),"Gallery"]}),r.jsxs(ln,{value:"scheduled",className:"gap-2",children:[r.jsx(hm,{className:"h-4 w-4"}),"Scheduled"]})]}),r.jsxs(An,{value:"gallery",className:"space-y-6",children:[t?q?r.jsx(Ye,{className:"border rounded-xl",children:r.jsx(tt,{className:"p-6",children:r.jsxs("div",{className:"flex items-start gap-4",children:[r.jsx("div",{className:"p-3 rounded-full bg-muted text-2xl",children:"📸"}),r.jsxs("div",{className:"flex-1",children:[r.jsx("h3",{className:"font-semibold text-foreground mb-1",children:"Ready to post!"}),r.jsx("p",{className:"text-muted-foreground",children:'Click any image and use "Create Post" to share directly to your connected accounts.'})]}),r.jsx(ee,{variant:"outline",size:"sm",asChild:!0,className:"gap-2",children:r.jsx(co,{to:"/social-connections",children:"Manage Accounts"})})]})})}):r.jsx(Ye,{className:"border-2 border-dashed border-primary/30 bg-gradient-to-r from-pink-500/5 via-purple-500/5 to-blue-500/5 rounded-xl",children:r.jsx(tt,{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(Rd,{className:"h-5 w-5 text-blue-600"})}),r.jsx("div",{className:"p-2 rounded-full bg-pink-500/10",children:r.jsx(lu,{className:"h-5 w-5 text-pink-600"})})]}),r.jsxs("div",{className:"flex-1",children:[r.jsx("h3",{className:"font-semibold text-foreground mb-1",children:"Post directly to social media"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Connect your Facebook & Instagram accounts to post images with one click!"})]}),r.jsx(ee,{asChild:!0,className:"gap-2 bg-gradient-to-r from-pink-500 via-purple-500 to-blue-500 hover:from-pink-600 hover:via-purple-600 hover:to-blue-600",children:r.jsxs(co,{to:"/social-connections",children:[r.jsx(tf,{className:"h-4 w-4"}),"Connect Accounts"]})})]})})}):r.jsx(Ye,{className:"border-2 border-dashed border-muted-foreground/20 bg-muted/30 rounded-xl",children:r.jsx(tt,{className:"p-6",children:r.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:"p-2 rounded-full bg-muted",children:r.jsx(Ya,{className:"h-5 w-5 text-muted-foreground"})}),r.jsx("div",{className:"p-2 rounded-full bg-blue-500/10",children:r.jsx(Rd,{className:"h-5 w-5 text-blue-400"})}),r.jsx("div",{className:"p-2 rounded-full bg-pink-500/10",children:r.jsx(lu,{className:"h-5 w-5 text-pink-400"})})]}),r.jsxs("div",{className:"flex-1",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[r.jsx("h3",{className:"font-semibold text-foreground",children:"Post directly to social media"}),r.jsx(Ot,{variant:"secondary",className:"text-xs",children:"Coming Soon"})]}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Soon you'll be able to connect your Facebook & Instagram accounts to post images with one click!"})]})]})})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-3",children:[r.jsx("div",{className:"flex flex-wrap gap-2",children:Z.map(_e=>r.jsx("button",{onClick:()=>l(_e),className:$t("px-4 py-2 rounded-full text-sm font-medium transition-all",o===_e?"bg-primary text-primary-foreground shadow-sm":"bg-muted text-muted-foreground hover:text-foreground"),children:G(_e)},_e))}),o!=="all"&&(ie?r.jsxs("a",{href:ie,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-2 text-sm text-muted-foreground hover:text-foreground transition-colors",children:[r.jsx("span",{className:"text-base",children:"🎨"}),"Edit ",G(o)," Images in Canva"]}):r.jsxs("span",{className:"inline-flex items-center gap-2 text-sm text-muted-foreground/50",children:[r.jsx("span",{className:"text-base",children:"🎨"}),"Edit ",G(o)," Images in Canva"]}))]}),r.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[r.jsxs("div",{className:"flex items-center gap-1 p-1 bg-muted rounded-full",children:[r.jsxs("button",{onClick:()=>{C("images"),ae()},className:$t("flex items-center gap-2 px-4 py-2 rounded-full text-sm font-medium transition-all",j==="images"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:[r.jsx(Pl,{className:"h-4 w-4"}),"Images"]}),r.jsxs("button",{onClick:()=>{C("reels"),ae()},className:$t("flex items-center gap-2 px-4 py-2 rounded-full text-sm font-medium transition-all",j==="reels"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:[r.jsx(Ad,{className:"h-4 w-4"}),"Reels"]})]}),j==="images"&&r.jsx("div",{className:"flex flex-wrap items-center gap-3",children:p?r.jsxs(r.Fragment,{children:[r.jsxs(ee,{variant:"outline",size:"sm",onClick:ge,className:"gap-2",children:["Select All (",te.length,")"]}),r.jsxs(ee,{variant:"outline",size:"sm",onClick:ae,className:"gap-2",children:[r.jsx(_s,{className:"h-4 w-4"}),"Cancel"]}),i.size>0&&r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsxs(ee,{size:"sm",onClick:he,disabled:y,className:"gap-2",children:[r.jsx(no,{className:"h-4 w-4"}),y?"Downloading...":`Download ${i.size} Selected`]}),r.jsx("span",{className:"text-xs text-muted-foreground hidden sm:inline",children:"Please ensure your browser allows downloads from the LevelUp Dashboard."})]})]}):r.jsxs(ee,{variant:"outline",size:"sm",onClick:()=>x(!0),className:"gap-2",children:[r.jsx(Ai,{className:"h-4 w-4"}),"Select Images"]})})]}),T&&r.jsx("div",{className:"text-center py-12 text-muted-foreground",children:"Loading..."}),!T&&j==="images"&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4",children:te.map(_e=>{const Ae=i.has(_e.id);return r.jsx(Ye,{className:$t("group cursor-pointer overflow-hidden border-0 shadow-md hover:shadow-xl transition-all duration-300 rounded-2xl",p&&Ae&&"ring-2 ring-primary ring-offset-2"),onClick:()=>ue(_e),children:r.jsxs("div",{className:"relative aspect-[4/5] overflow-hidden",children:[r.jsx("img",{src:_e.image_url,alt:"Social swag",className:"w-full h-full object-cover transition-transform duration-300 group-hover:scale-110"}),p&&r.jsx("div",{className:$t("absolute top-2 right-2 w-6 h-6 rounded-full border-2 flex items-center justify-center transition-all",Ae?"bg-primary border-primary text-primary-foreground":"bg-white/80 border-muted-foreground/50"),children:Ae&&r.jsx(Ai,{className:"h-4 w-4"})}),!p&&r.jsx("div",{className:"absolute inset-0 bg-black/0 group-hover:bg-black/40 transition-colors duration-300 flex items-center justify-center",children:r.jsx("span",{className:"text-white font-medium opacity-0 group-hover:opacity-100 transition-opacity duration-300 bg-primary px-4 py-2 rounded-full text-sm",children:"View Details"})})]})},_e.id)})}),te.length===0&&r.jsxs("div",{className:"text-center py-12",children:[r.jsx(Pl,{className:"h-12 w-12 text-muted-foreground/50 mx-auto mb-4"}),r.jsx("p",{className:"text-muted-foreground",children:"No images available for this month yet."})]})]}),!T&&j==="reels"&&r.jsx(r.Fragment,{children:H?r.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 xl:grid-cols-6 gap-4",children:r.jsx(Ye,{className:"group overflow-hidden rounded-2xl cursor-pointer transition-all duration-300 hover:shadow-xl hover:scale-[1.02]",onClick:()=>a(H),children:r.jsxs("div",{className:"relative aspect-[9/16] overflow-hidden",children:[r.jsx("img",{src:H.image_url,alt:"Reel preview",className:"w-full h-full object-cover transition-transform duration-300 group-hover:scale-105"}),r.jsx("div",{className:"absolute top-2 left-2",children:r.jsxs(Ot,{variant:"secondary",className:"bg-black/50 text-white border-0 backdrop-blur-sm text-xs",children:[r.jsx(Ad,{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(Ad,{className:"h-12 w-12 text-muted-foreground/50 mx-auto mb-4"}),r.jsx("p",{className:"text-muted-foreground",children:"No reel available for this month yet."})]})})]}),r.jsx(Fr,{open:!!e,onOpenChange:()=>n(null),children:r.jsx(Rr,{className:"max-w-4xl max-h-[90vh] overflow-hidden p-0",children:r.jsx("div",{className:"max-h-[90vh] overflow-y-auto touch-pan-y",style:{WebkitOverflowScrolling:"touch"},children:e&&r.jsxs("div",{className:"flex flex-col md:flex-row",children:[r.jsx("div",{className:"md:w-1/2 bg-muted",children:r.jsx("div",{className:"aspect-[4/5]",children:r.jsx("img",{src:e.image_url,alt:"Social swag",className:"w-full h-full object-cover"})})}),r.jsxs("div",{className:"md:w-1/2 p-6 flex flex-col",children:[r.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground mb-4",children:[r.jsx(zs,{className:"h-4 w-4"}),yn(new Date(e.created_at),"MMMM d, yyyy")]}),r.jsxs("div",{className:"flex-1 min-h-0",children:[r.jsx("h4",{className:"text-sm font-medium text-foreground mb-2",children:"Caption"}),r.jsx("div",{className:"bg-muted/50 rounded-lg p-4 max-h-64 overflow-y-auto",children:r.jsx("p",{className:"text-sm text-foreground whitespace-pre-wrap",children:e.caption})})]}),r.jsxs("div",{className:"flex flex-col gap-3 mt-6",children:[t&&r.jsxs(ee,{onClick:()=>{A({imageUrl:e.image_url,imageId:e.id,caption:e.caption})},className:"w-full gap-2 bg-gradient-to-r from-pink-500 via-purple-500 to-blue-500 hover:from-pink-600 hover:via-purple-600 hover:to-blue-600 text-white",children:[r.jsx(Oo,{className:"h-4 w-4"}),"Create Post"]}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[r.jsxs(ee,{variant:"outline",onClick:()=>le(e.caption),className:"flex-1 gap-2",children:[r.jsx(hl,{className:"h-4 w-4"}),"Copy Caption"]}),r.jsxs(ee,{variant:"outline",onClick:()=>ye(e.image_url,e.id),className:"flex-1 gap-2",children:[r.jsx(no,{className:"h-4 w-4"}),"Download"]})]})]})]})]})})})}),r.jsx(Fr,{open:!!s,onOpenChange:()=>a(null),children:r.jsx(Rr,{className:"max-w-4xl max-h-[90vh] overflow-hidden p-0",children:r.jsx("div",{className:"max-h-[90vh] overflow-y-auto touch-pan-y",style:{WebkitOverflowScrolling:"touch"},children:s&&r.jsxs("div",{className:"flex flex-col md:flex-row",children:[r.jsx("div",{className:"md:w-1/2 bg-black flex items-center justify-center",children:r.jsx("div",{className:"aspect-[9/16] max-h-[70vh]",children:r.jsx("img",{src:s.image_url,alt:"Reel preview",className:"w-full h-full object-contain"})})}),r.jsxs("div",{className:"md:w-1/2 p-6 flex flex-col",children:[r.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground mb-4",children:[r.jsx(Ad,{className:"h-4 w-4"}),"Monthly Reel"]}),s.caption&&r.jsxs("div",{className:"flex-1 min-h-0",children:[r.jsx("h4",{className:"text-sm font-medium text-foreground mb-2",children:"Caption"}),r.jsx("div",{className:"bg-muted/50 rounded-lg p-4 max-h-64 overflow-y-auto",children:r.jsx("p",{className:"text-sm text-foreground whitespace-pre-wrap",children:s.caption})})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 mt-6",children:[s.caption&&r.jsxs(ee,{onClick:()=>le(s.caption||""),className:"flex-1 gap-2",children:[r.jsx(hl,{className:"h-4 w-4"}),"Copy Caption"]}),s.canva_link&&r.jsxs(ee,{variant:"outline",onClick:()=>window.open(s.canva_link,"_blank"),className:"flex-1 gap-2",children:[r.jsx(Fs,{className:"h-4 w-4"}),"Open in Canva"]})]})]})]})})})}),r.jsx(vxt,{open:!!N,onOpenChange:_e=>!_e&&A(null),imageUrl:(N==null?void 0:N.imageUrl)||"",imageId:(N==null?void 0:N.imageId)||"",defaultCaption:(N==null?void 0:N.caption)||"",swagItemId:N==null?void 0:N.imageId})]}),r.jsx(An,{value:"scheduled",children:r.jsx(_xt,{})})]}):r.jsxs("div",{className:"space-y-6",children:[r.jsx(Ye,{className:"border-2 border-dashed border-muted-foreground/20 bg-muted/30 rounded-xl",children:r.jsx(tt,{className:"p-6",children:r.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:"p-2 rounded-full bg-muted",children:r.jsx(Ya,{className:"h-5 w-5 text-muted-foreground"})}),r.jsx("div",{className:"p-2 rounded-full bg-blue-500/10",children:r.jsx(Rd,{className:"h-5 w-5 text-blue-400"})}),r.jsx("div",{className:"p-2 rounded-full bg-pink-500/10",children:r.jsx(lu,{className:"h-5 w-5 text-pink-400"})})]}),r.jsxs("div",{className:"flex-1",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[r.jsx("h3",{className:"font-semibold text-foreground",children:"Post directly to social media"}),r.jsx(Ot,{variant:"secondary",className:"text-xs",children:"Coming Soon"})]}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Soon you'll be able to connect your Facebook & Instagram accounts to post images with one click!"})]})]})})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-3",children:[r.jsx("div",{className:"flex flex-wrap gap-2",children:Z.map(_e=>r.jsx("button",{onClick:()=>l(_e),className:$t("px-4 py-2 rounded-full text-sm font-medium transition-all",o===_e?"bg-primary text-primary-foreground shadow-sm":"bg-muted text-muted-foreground hover:text-foreground"),children:G(_e)},_e))}),o!=="all"&&(ie?r.jsxs("a",{href:ie,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-2 text-sm text-muted-foreground hover:text-foreground transition-colors",children:[r.jsx("span",{className:"text-base",children:"🎨"}),"Edit ",G(o)," Images in Canva"]}):r.jsxs("span",{className:"inline-flex items-center gap-2 text-sm text-muted-foreground/50",children:[r.jsx("span",{className:"text-base",children:"🎨"}),"Edit ",G(o)," Images in Canva"]}))]}),r.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[r.jsxs("div",{className:"flex items-center gap-1 p-1 bg-muted rounded-full",children:[r.jsxs("button",{onClick:()=>{C("images"),ae()},className:$t("flex items-center gap-2 px-4 py-2 rounded-full text-sm font-medium transition-all",j==="images"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:[r.jsx(Pl,{className:"h-4 w-4"}),"Images"]}),r.jsxs("button",{onClick:()=>{C("reels"),ae()},className:$t("flex items-center gap-2 px-4 py-2 rounded-full text-sm font-medium transition-all",j==="reels"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:[r.jsx(Ad,{className:"h-4 w-4"}),"Reels"]})]}),j==="images"&&r.jsx("div",{className:"flex flex-wrap items-center gap-3",children:p?r.jsxs(r.Fragment,{children:[r.jsxs(ee,{variant:"outline",size:"sm",onClick:ge,className:"gap-2",children:["Select All (",te.length,")"]}),r.jsxs(ee,{variant:"outline",size:"sm",onClick:ae,className:"gap-2",children:[r.jsx(_s,{className:"h-4 w-4"}),"Cancel"]}),i.size>0&&r.jsxs(ee,{size:"sm",onClick:he,disabled:y,className:"gap-2",children:[r.jsx(no,{className:"h-4 w-4"}),y?"Downloading...":`Download ${i.size} Selected`]})]}):r.jsxs(ee,{variant:"outline",size:"sm",onClick:()=>x(!0),className:"gap-2",children:[r.jsx(Ai,{className:"h-4 w-4"}),"Select Images"]})})]}),T&&r.jsx("div",{className:"text-center py-12 text-muted-foreground",children:"Loading..."}),!T&&j==="images"&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4",children:te.map(_e=>{const Ae=i.has(_e.id);return r.jsx(Ye,{className:$t("group cursor-pointer overflow-hidden border-0 shadow-md hover:shadow-xl transition-all duration-300 rounded-2xl",p&&Ae&&"ring-2 ring-primary ring-offset-2"),onClick:()=>ue(_e),children:r.jsxs("div",{className:"relative aspect-[4/5] overflow-hidden",children:[r.jsx("img",{src:_e.image_url,alt:"Social swag",className:"w-full h-full object-cover transition-transform duration-300 group-hover:scale-110"}),p&&r.jsx("div",{className:$t("absolute top-2 right-2 w-6 h-6 rounded-full border-2 flex items-center justify-center transition-all",Ae?"bg-primary border-primary text-primary-foreground":"bg-white/80 border-muted-foreground/50"),children:Ae&&r.jsx(Ai,{className:"h-4 w-4"})}),!p&&r.jsx("div",{className:"absolute inset-0 bg-black/0 group-hover:bg-black/40 transition-colors duration-300 flex items-center justify-center",children:r.jsx("span",{className:"text-white font-medium opacity-0 group-hover:opacity-100 transition-opacity duration-300 bg-primary px-4 py-2 rounded-full text-sm",children:"View Details"})})]})},_e.id)})}),te.length===0&&r.jsxs("div",{className:"text-center py-12",children:[r.jsx(Pl,{className:"h-12 w-12 text-muted-foreground/50 mx-auto mb-4"}),r.jsx("p",{className:"text-muted-foreground",children:"No images available for this month yet."})]})]}),!T&&j==="reels"&&r.jsx(r.Fragment,{children:H?r.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 xl:grid-cols-6 gap-4",children:r.jsx(Ye,{className:"group overflow-hidden rounded-2xl cursor-pointer transition-all duration-300 hover:shadow-xl hover:scale-[1.02]",onClick:()=>a(H),children:r.jsxs("div",{className:"relative aspect-[9/16] overflow-hidden",children:[r.jsx("img",{src:H.image_url,alt:"Reel preview",className:"w-full h-full object-cover transition-transform duration-300 group-hover:scale-105"}),r.jsx("div",{className:"absolute top-2 left-2",children:r.jsxs(Ot,{variant:"secondary",className:"bg-black/50 text-white border-0 backdrop-blur-sm text-xs",children:[r.jsx(Ad,{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(Ad,{className:"h-12 w-12 text-muted-foreground/50 mx-auto mb-4"}),r.jsx("p",{className:"text-muted-foreground",children:"No reel available for this month yet."})]})})]}),r.jsx(Fr,{open:!!e,onOpenChange:()=>n(null),children:r.jsx(Rr,{className:"max-w-4xl max-h-[90vh] overflow-hidden p-0",children:r.jsx("div",{className:"max-h-[90vh] overflow-y-auto touch-pan-y",style:{WebkitOverflowScrolling:"touch"},children:e&&r.jsxs("div",{className:"flex flex-col md:flex-row",children:[r.jsx("div",{className:"md:w-1/2 bg-muted",children:r.jsx("div",{className:"aspect-[4/5]",children:r.jsx("img",{src:e.image_url,alt:"Social swag",className:"w-full h-full object-cover"})})}),r.jsxs("div",{className:"md:w-1/2 p-6 flex flex-col",children:[r.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground mb-4",children:[r.jsx(zs,{className:"h-4 w-4"}),yn(new Date(e.created_at),"MMMM d, yyyy")]}),r.jsxs("div",{className:"flex-1 min-h-0",children:[r.jsx("h4",{className:"text-sm font-medium text-foreground mb-2",children:"Caption"}),r.jsx("div",{className:"bg-muted/50 rounded-lg p-4 max-h-64 overflow-y-auto",children:r.jsx("p",{className:"text-sm text-foreground whitespace-pre-wrap",children:e.caption})})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 mt-6",children:[r.jsxs(ee,{variant:"outline",onClick:()=>le(e.caption),className:"flex-1 gap-2",children:[r.jsx(hl,{className:"h-4 w-4"}),"Copy Caption"]}),r.jsxs(ee,{variant:"outline",onClick:()=>ye(e.image_url,e.id),className:"flex-1 gap-2",children:[r.jsx(no,{className:"h-4 w-4"}),"Download"]})]})]})]})})})}),r.jsx(Fr,{open:!!s,onOpenChange:()=>a(null),children:r.jsx(Rr,{className:"max-w-4xl max-h-[90vh] overflow-hidden p-0",children:r.jsx("div",{className:"max-h-[90vh] overflow-y-auto touch-pan-y",style:{WebkitOverflowScrolling:"touch"},children:s&&r.jsxs("div",{className:"flex flex-col md:flex-row",children:[r.jsx("div",{className:"md:w-1/2 bg-black flex items-center justify-center",children:r.jsx("div",{className:"aspect-[9/16] max-h-[70vh]",children:r.jsx("img",{src:s.image_url,alt:"Reel preview",className:"w-full h-full object-contain"})})}),r.jsxs("div",{className:"md:w-1/2 p-6 flex flex-col",children:[r.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground mb-4",children:[r.jsx(Ad,{className:"h-4 w-4"}),"Monthly Reel"]}),s.caption&&r.jsxs("div",{className:"flex-1 min-h-0",children:[r.jsx("h4",{className:"text-sm font-medium text-foreground mb-2",children:"Caption"}),r.jsx("div",{className:"bg-muted/50 rounded-lg p-4 max-h-64 overflow-y-auto",children:r.jsx("p",{className:"text-sm text-foreground whitespace-pre-wrap",children:s.caption})})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 mt-6",children:[s.caption&&r.jsxs(ee,{onClick:()=>le(s.caption||""),className:"flex-1 gap-2",children:[r.jsx(hl,{className:"h-4 w-4"}),"Copy Caption"]}),s.canva_link&&r.jsxs(ee,{variant:"outline",onClick:()=>window.open(s.canva_link,"_blank"),className:"flex-1 gap-2",children:[r.jsx(Fs,{className:"h-4 w-4"}),"Open in Canva"]})]})]})]})})})})]})]})})},kxt=()=>{const{swagId:t}=Zc(),{user:e}=Qr(),{toast:n}=fi(),s=Vr(),{trackEngagement:a}=MI(),[o,l]=I.useState(""),{data:i,isLoading:h}=Yt({queryKey:["social-swag-detail",t],queryFn:async()=>{const{data:E,error:T}=await J.from("social_swag").select("*").eq("id",t).single();if(T)throw T;const{data:L}=await J.from("social_swag_links").select("*").eq("swag_id",t).order("sort_order");return{...E,links:L||[]}},enabled:!!t});I.useEffect(()=>{i&&a("social_swag",i.id,i.title,"view")},[i==null?void 0:i.id]);const{data:p=[]}=Yt({queryKey:["social-swag-likes",t],queryFn:async()=>{const{data:E,error:T}=await J.from("social_swag_likes").select("*").eq("swag_id",t);if(T)throw T;return E},enabled:!!t}),{data:x=[]}=Yt({queryKey:["social-swag-comments",t],queryFn:async()=>{const{data:E,error:T}=await J.from("social_swag_comments").select("*").eq("swag_id",t).order("created_at",{ascending:!1});if(T)throw T;const L=[...new Set(E.map(q=>q.user_id))],{data:z}=await J.from("profiles").select("id, name").in("id",L),F=new Map((z==null?void 0:z.map(q=>[q.id,q.name]))||[]);return E.map(q=>({...q,user_name:F.get(q.user_id)||"Unknown User"}))},enabled:!!t}),y=cr({mutationFn:async E=>{const{error:T}=await J.from("social_swag_comments").insert({swag_id:t,user_id:e.id,content:E});if(T)throw T},onSuccess:()=>{s.invalidateQueries({queryKey:["social-swag-comments",t]}),l(""),n({title:"Comment added!"})},onError:E=>{n({title:"Error adding comment",description:E.message,variant:"destructive"})}}),b=cr({mutationFn:async E=>{const{error:T}=await J.from("social_swag_comments").delete().eq("id",E);if(T)throw T},onSuccess:()=>{s.invalidateQueries({queryKey:["social-swag-comments",t]}),n({title:"Comment deleted"})}}),j=cr({mutationFn:async()=>{const E=p.find(T=>T.user_id===(e==null?void 0:e.id));if(E){const{error:T}=await J.from("social_swag_likes").delete().eq("id",E.id);if(T)throw T}else{const{error:T}=await J.from("social_swag_likes").insert({swag_id:t,user_id:e.id});if(T)throw T}},onSuccess:()=>{s.invalidateQueries({queryKey:["social-swag-likes",t]})}}),C=p.some(E=>E.user_id===(e==null?void 0:e.id)),N=E=>E.split(" ").map(T=>T[0]).join("").toUpperCase().slice(0,2),A=E=>{E.preventDefault(),!(!o.trim()||!e)&&y.mutate(o.trim())};return h?r.jsx(Lr,{title:"Social Swag",children:r.jsx("div",{className:"flex justify-center py-12",children:r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})})}):i?r.jsx(Lr,{title:i.title,children:r.jsxs("div",{className:"space-y-6 max-w-5xl mx-auto",children:[r.jsx(ee,{variant:"ghost",size:"sm",asChild:!0,className:"gap-2",children:r.jsxs(co,{to:"/social-swag",children:[r.jsx(so,{className:"h-4 w-4"}),"Back to Social Swag"]})}),i.preview_image_url&&r.jsx("div",{className:"relative w-full rounded-lg overflow-hidden bg-muted",children:r.jsx("img",{src:i.preview_image_url,alt:i.title,className:"w-full max-h-[500px] object-contain"})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4",children:[r.jsx("div",{className:"space-y-2",children:r.jsx("h1",{className:"text-2xl font-bold text-foreground",children:i.title})}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(u3,{resourceType:"social_swag",resourceId:i.id,resourceTitle:i.title}),r.jsxs(ee,{variant:C?"default":"outline",className:"gap-2 w-fit",onClick:()=>j.mutate(),disabled:!e||j.isPending,children:[r.jsx(pd,{className:`h-4 w-4 ${C?"fill-current":""}`}),p.length," ",p.length===1?"Like":"Likes"]})]})]}),i.description&&r.jsx("div",{className:"text-muted-foreground prose prose-sm max-w-none dark:prose-invert",dangerouslySetInnerHTML:{__html:i.description}})]}),i.links.length>0&&r.jsx(Ye,{children:r.jsxs(tt,{className:"pt-6",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 mb-4",children:[r.jsx(Co,{className:"h-4 w-4"}),i.links.length===1?"Canva Link":"Canva Links"]}),r.jsx("div",{className:"grid gap-2",children:i.links.map(E=>r.jsxs(ee,{variant:"outline",className:"w-full justify-between gap-2 h-auto py-3",onClick:()=>{a("social_swag",i.id,i.title,"click_canva"),window.open(E.canva_share_link,"_blank")},children:[r.jsx("span",{className:"font-medium",children:E.title}),r.jsx(Fs,{className:"h-4 w-4 text-muted-foreground"})]},E.id))})]})}),r.jsx(ou,{}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 text-lg",children:[r.jsx(Fl,{className:"h-5 w-5"}),"Comments (",x.length,")"]}),e?r.jsxs("form",{onSubmit:A,className:"flex gap-2",children:[r.jsx(ps,{placeholder:"Add a comment...",value:o,onChange:E=>l(E.target.value),className:"min-h-[80px] resize-none flex-1"}),r.jsx(ee,{type:"submit",size:"icon",className:"h-10 w-10",disabled:!o.trim()||y.isPending,children:r.jsx(Oo,{className:"h-4 w-4"})})]}):r.jsx("p",{className:"text-sm text-muted-foreground",children:"Log in to add a comment"}),r.jsx("div",{className:"space-y-4",children:x.length===0?r.jsx(Ye,{children:r.jsx(tt,{className:"py-8 text-center",children:r.jsx("p",{className:"text-muted-foreground",children:"No comments yet. Be the first to share your thoughts!"})})}):x.map(E=>r.jsx(Ye,{children:r.jsx(tt,{className:"pt-4 pb-4",children:r.jsxs("div",{className:"flex gap-3",children:[r.jsx(Ks,{className:"h-10 w-10 flex-shrink-0",children:r.jsx(Zs,{className:"text-sm",children:N(E.user_name||"U")})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[r.jsx("span",{className:"font-medium",children:E.user_name}),r.jsx("span",{className:"text-sm text-muted-foreground",children:cu(new Date(E.created_at),{addSuffix:!0})}),E.user_id===(e==null?void 0:e.id)&&r.jsx(ee,{variant:"ghost",size:"icon",className:"h-6 w-6 ml-auto",onClick:()=>b.mutate(E.id),children:r.jsx(Vn,{className:"h-3 w-3 text-muted-foreground"})})]}),r.jsx("p",{className:"text-sm whitespace-pre-wrap",children:E.content})]})]})})},E.id))})]})]})}):r.jsx(Lr,{title:"Social Swag",children:r.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[r.jsx(Co,{className:"h-12 w-12 text-muted-foreground mb-4"}),r.jsx("h3",{className:"text-lg font-semibold",children:"Item not found"}),r.jsx("p",{className:"text-muted-foreground mt-1",children:"This item may have been removed or is not available."}),r.jsx(ee,{asChild:!0,className:"mt-4",children:r.jsx(co,{to:"/social-swag",children:"Back to Social Swag"})})]})})},Nxt=({categories:t,privateGroups:e,selectedFilter:n,onFilterChange:s,onlineUsers:a})=>{const[o,l]=I.useState(!0),[i,h]=I.useState(!0),[p,x]=I.useState(!0),y=b=>b.split(" ").map(j=>j[0]).join("").toUpperCase().slice(0,2);return r.jsx("aside",{className:"w-64 shrink-0 hidden lg:block relative z-0",children:r.jsx("div",{className:"sticky top-4 space-y-4 max-h-[calc(100vh-8rem)] overflow-y-auto overscroll-contain",children:r.jsxs("div",{className:"space-y-2 pr-4",children:[r.jsxs(ee,{variant:n==="all"?"secondary":"ghost",className:"w-full justify-start",onClick:()=>s("all"),children:[r.jsx(rS,{className:"h-4 w-4 mr-2"}),"All Posts"]}),r.jsxs(kS,{open:o,onOpenChange:l,children:[r.jsx(NS,{asChild:!0,children:r.jsxs(ee,{variant:"ghost",className:"w-full justify-between text-muted-foreground hover:text-foreground",children:[r.jsx("span",{className:"text-xs font-semibold uppercase tracking-wider",children:"Categories"}),o?r.jsx(Dd,{className:"h-4 w-4"}):r.jsx(Vi,{className:"h-4 w-4"})]})}),r.jsx(SS,{className:"space-y-1 pl-2",children:t.map(b=>r.jsxs(ee,{variant:n===b.id?"secondary":"ghost",size:"sm",className:"w-full justify-start h-9",onClick:()=>s(b.id),children:[r.jsx("span",{className:"mr-2",children:b.icon||"📂"}),r.jsx("span",{className:"truncate",children:b.name})]},b.id))})]}),e.length>0&&r.jsxs(kS,{open:i,onOpenChange:h,children:[r.jsx(NS,{asChild:!0,children:r.jsxs(ee,{variant:"ghost",className:"w-full justify-between text-muted-foreground hover:text-foreground",children:[r.jsxs("span",{className:"text-xs font-semibold uppercase tracking-wider flex items-center gap-1",children:[r.jsx(Zf,{className:"h-3 w-3"}),"Your Groups"]}),i?r.jsx(Dd,{className:"h-4 w-4"}):r.jsx(Vi,{className:"h-4 w-4"})]})}),r.jsx(SS,{className:"space-y-1 pl-2",children:e.map(b=>r.jsxs(ee,{variant:n===`group:${b.id}`?"secondary":"ghost",size:"sm",className:"w-full justify-start h-9",onClick:()=>s(`group:${b.id}`),children:[r.jsx("span",{className:"mr-2",children:b.icon||"🔒"}),r.jsx("span",{className:"truncate",children:b.name})]},b.id))})]}),r.jsxs(kS,{open:p,onOpenChange:x,children:[r.jsx(NS,{asChild:!0,children:r.jsxs(ee,{variant:"ghost",className:"w-full justify-between text-muted-foreground hover:text-foreground",children:[r.jsxs("span",{className:"text-xs font-semibold uppercase tracking-wider flex items-center gap-1",children:[r.jsx(Bn,{className:"h-3 w-3"}),"Online Now",a.length>0&&r.jsx("span",{className:"ml-1 bg-green-500 text-white text-xs rounded-full px-1.5 py-0.5 min-w-[20px] text-center",children:a.length})]}),p?r.jsx(Dd,{className:"h-4 w-4"}):r.jsx(Vi,{className:"h-4 w-4"})]})}),r.jsx(SS,{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(b=>r.jsxs("div",{className:"flex items-center gap-2 py-1.5 px-2 rounded-md hover:bg-muted transition-colors",children:[r.jsxs("div",{className:"relative",children:[r.jsxs(Ks,{className:"h-7 w-7",children:[r.jsx(Ei,{src:b.avatarUrl}),r.jsx(Zs,{className:"text-xs",children:y(b.name)})]}),r.jsx(Ru,{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:b.name})]},b.id))})]})]})})})},Sxt=({categories:t,privateGroups:e,selectedFilter:n,onFilterChange:s,onlineUsers:a})=>{const[o,l]=I.useState(!1),i=p=>p.split(" ").map(x=>x[0]).join("").toUpperCase().slice(0,2),h=()=>{if(n==="all")return"All Posts";if(n.startsWith("group:")){const x=n.replace("group:",""),y=e.find(b=>b.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(wh,{children:[r.jsx(jh,{asChild:!0,children:r.jsxs(ee,{variant:"outline",className:"flex-1 justify-between",children:[r.jsx("span",{className:"truncate",children:h()}),r.jsx(Dd,{className:"h-4 w-4 ml-2 shrink-0"})]})}),r.jsxs(Wu,{className:"w-56 bg-background border",children:[r.jsxs(di,{onClick:()=>s("all"),children:[r.jsx(rS,{className:"h-4 w-4 mr-2"}),"All Posts"]}),r.jsx(Fj,{}),r.jsx(ehe,{className:"text-xs text-muted-foreground",children:"Categories"}),t.map(p=>r.jsxs(di,{onClick:()=>s(p.id),children:[r.jsx("span",{className:"mr-2",children:p.icon||"📂"}),p.name]},p.id)),e.length>0&&r.jsxs(r.Fragment,{children:[r.jsx(Fj,{}),r.jsxs(ehe,{className:"text-xs text-muted-foreground flex items-center gap-1",children:[r.jsx(Zf,{className:"h-3 w-3"}),"Your Groups"]}),e.map(p=>r.jsxs(di,{onClick:()=>s(`group:${p.id}`),children:[r.jsx("span",{className:"mr-2",children:p.icon||"🔒"}),p.name]},p.id))]})]})]}),r.jsxs(Jne,{open:o,onOpenChange:l,children:[r.jsx(Rge,{asChild:!0,children:r.jsxs(ee,{variant:"outline",size:"icon",className:"relative",children:[r.jsx(Bn,{className:"h-4 w-4"}),a.length>0&&r.jsx("span",{className:"absolute -top-1 -right-1 bg-green-500 text-white text-xs rounded-full h-4 w-4 flex items-center justify-center",children:a.length})]})}),r.jsxs(NI,{children:[r.jsx(ese,{children:r.jsxs(tse,{className:"flex items-center gap-2",children:[r.jsx(Bn,{className:"h-5 w-5"}),"Online Now (",a.length,")"]})}),r.jsx(Jo,{className:"h-[calc(100vh-8rem)] mt-4",children:a.length===0?r.jsx("p",{className:"text-sm text-muted-foreground text-center py-8",children:"No one else online right now"}):r.jsx("div",{className:"space-y-2",children:a.map(p=>r.jsxs("div",{className:"flex items-center gap-3 py-2 px-3 rounded-lg hover:bg-muted transition-colors",children:[r.jsxs("div",{className:"relative",children:[r.jsxs(Ks,{className:"h-10 w-10",children:[r.jsx(Ei,{src:p.avatarUrl}),r.jsx(Zs,{children:i(p.name)})]}),r.jsx(Ru,{className:"h-3 w-3 fill-green-500 text-green-500 absolute -bottom-0.5 -right-0.5"})]}),r.jsx("span",{className:"font-medium",children:p.name})]},p.id))})})]})]})]})};var tce,Cse="HoverCard",[XDe]=tc(Cse,[Fg]),Mse=Fg(),[Cxt,Lxe]=XDe(Cse),QDe=t=>{const{__scopeHoverCard:e,children:n,open:s,defaultOpen:a,onOpenChange:o,openDelay:l=700,closeDelay:i=300}=t,h=Mse(e),p=I.useRef(0),x=I.useRef(0),y=I.useRef(!1),b=I.useRef(!1),[j,C]=Fu({prop:s,defaultProp:a??!1,onChange:o,caller:Cse}),N=I.useCallback(()=>{clearTimeout(x.current),p.current=window.setTimeout(()=>C(!0),l)},[l,C]),A=I.useCallback(()=>{clearTimeout(p.current),!y.current&&!b.current&&(x.current=window.setTimeout(()=>C(!1),i))},[i,C]),E=I.useCallback(()=>C(!1),[C]);return I.useEffect(()=>()=>{clearTimeout(p.current),clearTimeout(x.current)},[]),r.jsx(Cxt,{scope:e,open:j,onOpenChange:C,onOpen:N,onClose:A,onDismiss:E,hasSelectionRef:y,isPointerDownOnContentRef:b,children:r.jsx(hI,{...h,children:n})})};QDe.displayName=Cse;var JDe="HoverCardTrigger",eRe=I.forwardRef((t,e)=>{const{__scopeHoverCard:n,...s}=t,a=Lxe(JDe,n),o=Mse(n);return r.jsx(QC,{asChild:!0,...o,children:r.jsx(Rn.a,{"data-state":a.open?"open":"closed",...s,ref:e,onPointerEnter:an(t.onPointerEnter,bte(a.onOpen)),onPointerLeave:an(t.onPointerLeave,bte(a.onClose)),onFocus:an(t.onFocus,a.onOpen),onBlur:an(t.onBlur,a.onClose),onTouchStart:an(t.onTouchStart,l=>l.preventDefault())})})});eRe.displayName=JDe;var Mxt="HoverCardPortal",[IKt,Txt]=XDe(Mxt,{forceMount:void 0}),_te="HoverCardContent",tRe=I.forwardRef((t,e)=>{const n=Txt(_te,t.__scopeHoverCard),{forceMount:s=n.forceMount,...a}=t,o=Lxe(_te,t.__scopeHoverCard);return r.jsx(gc,{present:s||o.open,children:r.jsx(Axt,{"data-state":o.open?"open":"closed",...a,onPointerEnter:an(t.onPointerEnter,bte(o.onOpen)),onPointerLeave:an(t.onPointerLeave,bte(o.onClose)),ref:e})})});tRe.displayName=_te;var Axt=I.forwardRef((t,e)=>{const{__scopeHoverCard:n,onEscapeKeyDown:s,onPointerDownOutside:a,onFocusOutside:o,onInteractOutside:l,...i}=t,h=Lxe(_te,n),p=Mse(n),x=I.useRef(null),y=ta(e,x),[b,j]=I.useState(!1);return I.useEffect(()=>{if(b){const C=document.body;return tce=C.style.userSelect||C.style.webkitUserSelect,C.style.userSelect="none",C.style.webkitUserSelect="none",()=>{C.style.userSelect=tce,C.style.webkitUserSelect=tce}}},[b]),I.useEffect(()=>{if(x.current){const C=()=>{j(!1),h.isPointerDownOnContentRef.current=!1,setTimeout(()=>{var A;((A=document.getSelection())==null?void 0:A.toString())!==""&&(h.hasSelectionRef.current=!0)})};return document.addEventListener("pointerup",C),()=>{document.removeEventListener("pointerup",C),h.hasSelectionRef.current=!1,h.isPointerDownOnContentRef.current=!1}}},[h.isPointerDownOnContentRef,h.hasSelectionRef]),I.useEffect(()=>{x.current&&Pxt(x.current).forEach(N=>N.setAttribute("tabindex","-1"))}),r.jsx(ev,{asChild:!0,disableOutsidePointerEvents:!1,onInteractOutside:l,onEscapeKeyDown:s,onPointerDownOutside:a,onFocusOutside:an(o,C=>{C.preventDefault()}),onDismiss:h.onDismiss,children:r.jsx(fI,{...p,...i,onPointerDown:an(i.onPointerDown,C=>{C.currentTarget.contains(C.target)&&j(!0),h.hasSelectionRef.current=!1,h.isPointerDownOnContentRef.current=!0}),ref:y,style:{...i.style,userSelect:b?"text":void 0,WebkitUserSelect:b?"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)"}})})}),Ext="HoverCardArrow",Ixt=I.forwardRef((t,e)=>{const{__scopeHoverCard:n,...s}=t,a=Mse(n);return r.jsx(pI,{...a,...s,ref:e})});Ixt.displayName=Ext;function bte(t){return e=>e.pointerType==="touch"?void 0:t()}function Pxt(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 Lxt=QDe,Oxt=eRe,rRe=tRe;const Dxt=Lxt,Rxt=Oxt,nRe=I.forwardRef(({className:t,align:e="center",sideOffset:n=4,...s},a)=>r.jsx(rRe,{ref:a,align:e,sideOffset:n,className:$t("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}));nRe.displayName=rRe.displayName;const Fxt=[{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"}],zxt=t=>t.split(" ").map(e=>e[0]).join("").toUpperCase().slice(0,2),sRe=({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(Dxt,{openDelay:200,closeDelay:100,children:[r.jsx(Rxt,{asChild:!0,children:r.jsx("div",{className:"cursor-pointer",children:e})}),r.jsx(nRe,{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=Fxt.find(l=>l.type===s);return r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[r.jsx("span",{className:"text-lg",children:o==null?void 0:o.emoji}),r.jsxs("span",{className:"text-sm font-medium text-foreground",children:[o==null?void 0:o.label," (",a.length,")"]})]}),r.jsxs("div",{className:"space-y-1.5",children:[a.slice(0,10).map(l=>r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs(Ks,{className:"h-6 w-6",children:[r.jsx(Ei,{src:l.user_avatar||void 0}),r.jsx(Zs,{className:"text-[10px]",children:zxt(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 Bxt({images:t,initialIndex:e=0,open:n,onOpenChange:s}){const[a,o]=I.useState(e),[l,i]=I.useState(!1);I.useEffect(()=>{n&&(o(e),i(!1))},[n,e]);const h=()=>{o(b=>b>0?b-1:t.length-1),i(!1)},p=()=>{o(b=>b{n&&(b.key==="ArrowLeft"&&h(),b.key==="ArrowRight"&&p(),b.key==="Escape"&&s(!1))},[n,t.length]);I.useEffect(()=>(window.addEventListener("keydown",x),()=>window.removeEventListener("keydown",x)),[x]);const y=t[a];return r.jsx(Fr,{open:n,onOpenChange:s,children:r.jsxs(Rr,{className:"max-w-[95vw] max-h-[95vh] w-auto h-auto p-0 border-none bg-black/95 overflow-hidden",children:[r.jsx(ee,{variant:"ghost",size:"icon",className:"absolute top-2 right-2 z-50 text-white hover:bg-white/20 h-10 w-10",onClick:()=>s(!1),children:r.jsx(_s,{className:"h-6 w-6"})}),t.length>1&&r.jsxs(r.Fragment,{children:[r.jsx(ee,{variant:"ghost",size:"icon",className:"absolute left-2 top-1/2 -translate-y-1/2 z-50 text-white hover:bg-white/20 h-12 w-12",onClick:h,children:r.jsx(Tc,{className:"h-8 w-8"})}),r.jsx(ee,{variant:"ghost",size:"icon",className:"absolute right-2 top-1/2 -translate-y-1/2 z-50 text-white hover:bg-white/20 h-12 w-12",onClick:p,children:r.jsx(Vi,{className:"h-8 w-8"})})]}),t.length>1&&r.jsxs("div",{className:"absolute bottom-4 left-1/2 -translate-x-1/2 z-50 text-white text-sm bg-black/50 px-3 py-1 rounded-full",children:[a+1," / ",t.length]}),(y==null?void 0:y.type)==="image"&&r.jsx(ee,{variant:"ghost",size:"icon",className:"absolute top-2 left-2 z-50 text-white hover:bg-white/20 h-10 w-10",onClick:()=>i(!l),children:l?r.jsx(xS,{className:"h-5 w-5"}):r.jsx(gS,{className:"h-5 w-5"})}),r.jsx("div",{className:$t("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:b=>b.stopPropagation()}):r.jsx("img",{src:y==null?void 0:y.url,alt:"",className:$t("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((b,j)=>r.jsx("button",{onClick:()=>{o(j),i(!1)},className:$t("w-12 h-12 rounded overflow-hidden flex-shrink-0 border-2 transition-all",a===j?"border-white":"border-transparent opacity-60 hover:opacity-100"),children:b.type==="video"?r.jsx("video",{src:b.url,className:"w-full h-full object-cover"}):r.jsx("img",{src:b.url,alt:"",className:"w-full h-full object-cover"})},j))})]})})}const jL=[{type:"like",emoji:"👍",label:"Like"},{type:"love",emoji:"❤️",label:"Love"}],$xt=({commentId:t,reactions:e,currentUserId:n})=>{var p,x;const s=Vr(),[a,o]=I.useState(!1),l=e.find(y=>y.user_id===n),i=cr({mutationFn:async y=>{l?l.reaction_type===y?await J.from("community_comment_reactions").delete().eq("id",l.id):await J.from("community_comment_reactions").update({reaction_type:y}).eq("id",l.id):await J.from("community_comment_reactions").insert({comment_id:t,user_id:n,reaction_type:y})},onSuccess:()=>{s.invalidateQueries({queryKey:["community-posts"]}),o(!1)}}),h={};return e.forEach(y=>{h[y.reaction_type]=(h[y.reaction_type]||0)+1}),r.jsxs("div",{className:"flex items-center gap-2",children:[e.length>0&&r.jsx(sRe,{reactions:e,children:r.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors",children:[r.jsx("div",{className:"flex -space-x-0.5",children:Object.keys(h).slice(0,2).map(y=>{var b;return r.jsx("span",{className:"text-sm",children:(b=jL.find(j=>j.type===y))==null?void 0:b.emoji},y)})}),r.jsx("span",{children:e.length})]})}),n&&r.jsxs(zu,{open:a,onOpenChange:o,children:[r.jsx(Bu,{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(ci,{className:"h-3 w-3"}),"Like"]})})}),r.jsx(uu,{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 Oxe({content:t,className:e}){const n=/([@#])\[([^\]]+)\]\(([^)]+)\)|(https?:\/\/[^\s<>]+)/g,s=[];let a=0,o,l=0;for(;(o=n.exec(t))!==null;){if(o.index>a&&s.push(t.substring(a,o.index)),o[1]){const i=o[1],h=o[2],p=o[3],x=i==="#";s.push(r.jsx(co,{to:x?`/templates/${p}`:`/profile?user=${p}`,className:$t("font-medium hover:underline",x?"text-white bg-[#2a4c64] px-1.5 py-0.5 rounded":"text-primary"),onClick:y=>y.stopPropagation(),children:x?h:`@${h}`},`mention-${l++}`))}else if(o[4]){const i=o[4],h=i.replace(/[.,;:!?)]+$/,""),p=i.slice(h.length);let x;try{const y=new URL(h);x=y.hostname+(y.pathname!=="/"?y.pathname.slice(0,20)+(y.pathname.length>20?"...":""):"")}catch{x=h.length>40?h.slice(0,40)+"...":h}s.push(r.jsx("a",{href:h,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline break-all",onClick:y=>y.stopPropagation(),children:x},`url-${l++}`)),p&&s.push(p)}a=o.index+o[0].length}return ar.jsx(I.Fragment,{children:i},h))})}function wte({value:t,onChange:e,placeholder:n="What's on your mind? Use @ to mention someone",className:s,minHeight:a="80px",onMentionsChange:o,onTemplatesChange:l,onKeyDown:i,mentionFormat:h="encoded",enableTemplateMentions:p=!1}){const x=I.useRef(null),y=I.useRef(null),[b,j]=I.useState(!1),[C,N]=I.useState("user"),[A,E]=I.useState(""),[T,L]=I.useState(null),[z,F]=I.useState(0),[q,H]=I.useState({top:0,left:0,width:0}),Z=I.useRef(new Map),G=I.useRef(new Map),te=be=>{if(h==="plain"){const Be=[];return Z.current.forEach((Ue,Re)=>{be.includes(`@${Re}`)&&Be.push(Ue)}),[...new Set(Be)]}const me=/@\[([^\]]+)\]\(([^)]+)\)/g,Le=[];let Ne;for(;(Ne=me.exec(be))!==null;)Le.push(Ne[2]);return[...new Set(Le)]},ie=be=>{if(h==="plain"){const Be=[];return G.current.forEach((Ue,Re)=>{be.includes(`#${Re}`)&&Be.push(Ue)}),[...new Set(Be)]}const me=/#\[([^\]]+)\]\(([^)]+)\)/g,Le=[];let Ne;for(;(Ne=me.exec(be))!==null;)Le.push(Ne[2]);return[...new Set(Le)]};I.useEffect(()=>{if(o){const be=te(t);o(be)}if(l){const be=ie(t);l(be)}},[t,o,l,h]);const{data:le=[],isLoading:ye}=Yt({queryKey:["mention-users",A],queryFn:async()=>{const be=J.from("profiles").select("id, name").limit(8),me=A.length>=1?be.ilike("name",`%${A}%`):be.order("name"),{data:Le,error:Ne}=await me;if(Ne)throw Ne;const Be=Le.map(Ue=>Ue.id),Ee=await _Le(Be);return Le.map(Ue=>({id:Ue.id,name:Ue.name||"Unknown",avatar_url:Ee.get(Ue.id)}))},enabled:b&&C==="user",staleTime:3e4}),{data:ne=[],isLoading:ge}=Yt({queryKey:["mention-templates",A],queryFn:async()=>{let be=J.from("canva_templates").select("id, name, preview_image_url").lte("publish_date",new Date().toISOString()).order("publish_date",{ascending:!1}).limit(8);A.length>=1&&(be=be.ilike("name",`%${A}%`));const{data:me,error:Le}=await be;if(Le)throw Le;return me||[]},enabled:b&&C==="template"&&p,staleTime:3e4}),ae=C==="user"?ye:ge,he=C==="user"?le:ne,ue=be=>be.split(" ").map(me=>me[0]).join("").toUpperCase().slice(0,2),_e=be=>{const me=be.target.value,Le=be.target.selectionStart;e(me);const Ne=me.substring(0,Le),Be=Ne.lastIndexOf("@"),Ee=p?Ne.lastIndexOf("#"):-1;let Ue=-1,Re="user";if(Be>Ee?(Ue=Be,Re="user"):Ee>Be&&p&&(Ue=Ee,Re="template"),Ue!==-1){const je=Ne.substring(Ue+1),et=je.includes(" "),Te=je.includes(` `);if(!et&&!Te&&je.length<=30){L(Ue),E(je),N(Re),j(!0),F(0);return}}j(!1),L(null)},Ae=be=>{if(T===null)return;const me=t.substring(0,T),Le=t.substring(T+A.length+1),Ne=C==="user"?"@":"#",Be=h==="plain"?`${Ne}${be.name} `:`${Ne}[${be.name}](${be.id}) `;h==="plain"&&(C==="user"?Z.current.set(be.name,be.id):G.current.set(be.name,be.id));const Ee=me+Be+Le;e(Ee),j(!1),L(null),E(""),setTimeout(()=>{if(x.current){const Ue=me.length+Be.length;x.current.focus(),x.current.setSelectionRange(Ue,Ue)}},0)},Ce=be=>{if(!(!b||he.length===0))switch(be.key){case"ArrowDown":be.preventDefault(),F(me=>(me+1)%he.length);break;case"ArrowUp":be.preventDefault(),F(me=>(me-1+he.length)%he.length);break;case"Enter":he[z]&&(be.preventDefault(),Ae(he[z]));break;case"Escape":be.preventDefault(),j(!1);break;case"Tab":he[z]&&(be.preventDefault(),Ae(he[z]));break}};return I.useEffect(()=>{const be=me=>{y.current&&!y.current.contains(me.target)&&x.current&&!x.current.contains(me.target)&&j(!1)};return document.addEventListener("mousedown",be),()=>document.removeEventListener("mousedown",be)},[]),I.useEffect(()=>{if(!b)return;const be=()=>{const me=x.current;if(!me)return;const Le=me.getBoundingClientRect();H({top:Le.bottom+4,left:Le.left,width:Le.width})};return be(),window.addEventListener("resize",be),window.addEventListener("scroll",be,!0),()=>{window.removeEventListener("resize",be),window.removeEventListener("scroll",be,!0)}},[b,t]),r.jsxs("div",{className:"relative flex-1",children:[r.jsx(ps,{ref:x,value:t,onChange:_e,onKeyDown:be=>{Ce(be),be.defaultPrevented||i==null||i(be)},placeholder:n,className:$t("resize-none",s),style:{minHeight:a}}),b&&uy.createPortal(r.jsxs("div",{ref:y,className:"fixed z-[1000] max-h-[220px] overflow-hidden rounded-lg border bg-popover shadow-lg",style:{top:q.top,left:q.left,width:q.width,maxWidth:"320px"},children:[r.jsx("div",{className:"px-3 py-1.5 text-xs font-medium text-muted-foreground border-b bg-muted/30",children:C==="user"?"👤 Mention a person":"📋 Link a template"}),ae?r.jsx("div",{className:"px-3 py-2 text-sm text-muted-foreground",children:"Searching..."}):he.length===0?r.jsx("div",{className:"px-3 py-2 text-sm text-muted-foreground",children:A.length<1?`Type to search ${C==="user"?"people":"templates"}...`:`No ${C==="user"?"users":"templates"} found`}):r.jsx("ul",{className:"py-1 max-h-[180px] overflow-y-auto",children:he.map((be,me)=>r.jsx("li",{className:$t("flex items-center gap-2 px-3 py-2 cursor-pointer transition-colors",me===z?"bg-accent":"hover:bg-accent/50"),onClick:()=>Ae(be),onMouseEnter:()=>F(me),children:C==="user"?r.jsxs(r.Fragment,{children:[r.jsxs(Ks,{className:"h-6 w-6",children:[r.jsx(Ei,{src:be.avatar_url}),r.jsx(Zs,{className:"text-xs",children:ue(be.name)})]}),r.jsx("span",{className:"text-sm font-medium truncate",children:be.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:be.preview_image_url?r.jsx("img",{src:be.preview_image_url,alt:"",className:"w-full h-full object-cover"}):r.jsx(Fd,{className:"h-4 w-4 text-muted-foreground"})}),r.jsx("span",{className:"text-sm font-medium truncate",children:be.name})]})},be.id))})]}),document.body)]})}function Uxt(t){const e=/#\[([^\]]+)\]\(([^)]+)\)/g,n=[];let s;for(;(s=e.exec(t))!==null;)n.push(s[2]);return[...new Set(n)]}const Ske=t=>t.split(" ").map(e=>e[0]).join("").toUpperCase().slice(0,2);function aRe({comment:t,postId:e,currentUserId:n,currentUserAvatar:s,currentUserEmail:a,canModerate:o,depth:l=0}){const i=Vr(),[h,p]=I.useState(!1),[x,y]=I.useState(""),[b,j]=I.useState([]),C=cr({mutationFn:async({content:T,parentCommentId:L})=>{const{data:z,error:F}=await J.from("community_comments").insert({post_id:e,user_id:n,content:T,parent_comment_id:L}).select("id").single();if(F)throw F;const q=b;if(q.length>0&&z){const H=q.filter(Z=>Z!==n).map(Z=>({comment_id:z.id,mentioned_user_id:Z,mentioned_by_user_id:n}));H.length>0&&await J.from("community_comment_mentions").insert(H)}},onSuccess:()=>{i.invalidateQueries({queryKey:["community-posts"]}),y(""),j([]),p(!1)}}),N=cr({mutationFn:async T=>{const{error:L}=await J.from("community_comments").delete().eq("id",T);if(L)throw L},onSuccess:()=>i.invalidateQueries({queryKey:["community-posts"]})}),A=()=>{x.trim()&&C.mutate({content:x,parentCommentId:t.id})};return r.jsxs("div",{className:l>0?"ml-8 border-l-2 border-muted pl-3":"",children:[r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(Ks,{className:"h-8 w-8 shrink-0",children:[r.jsx(Ei,{src:t.user_avatar||void 0}),r.jsx(Zs,{className:"text-xs",children:Ske(t.user_name||"U")})]}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"bg-muted rounded-lg px-3 py-2",children:[r.jsx("div",{className:"font-medium text-sm",children:t.user_name}),r.jsx(Oxe,{content:t.content,className:"text-sm break-words"})]}),r.jsxs("div",{className:"flex items-center gap-3 mt-1 text-xs text-muted-foreground flex-wrap",children:[r.jsx("span",{children:cu(new Date(t.created_at),{addSuffix:!0})}),r.jsx($xt,{commentId:t.id,reactions:t.reactions,currentUserId:n}),n&&l<2&&r.jsxs("button",{onClick:()=>p(!h),className:"hover:text-primary flex items-center gap-1",children:[r.jsx(VT,{className:"h-3 w-3"}),"Reply"]}),(t.user_id===n||o)&&r.jsx("button",{onClick:()=>N.mutate(t.id),className:"hover:text-destructive",children:t.user_id!==n?"Remove":"Delete"})]}),h&&n&&r.jsxs("div",{className:"flex gap-2 mt-2",children:[r.jsxs(Ks,{className:"h-6 w-6 shrink-0 mt-1",children:[r.jsx(Ei,{src:s||void 0}),r.jsx(Zs,{className:"text-xs",children:Ske((a==null?void 0:a.split("@")[0])||"U")})]}),r.jsxs("div",{className:"flex-1 flex gap-2 items-start",children:[r.jsx(wte,{placeholder:`Reply to ${t.user_name}...`,value:x,onChange:y,onMentionsChange:j,mentionFormat:"plain",className:"text-sm min-h-0 py-1.5",minHeight:"32px"}),r.jsx(ee,{size:"sm",variant:"ghost",onClick:A,disabled:!x.trim()||C.isPending,className:"h-8 px-2 mt-0.5",children:r.jsx(Oo,{className:"h-3 w-3"})})]})]})]})]}),t.replies&&t.replies.length>0&&r.jsx("div",{className:"mt-2 space-y-2",children:t.replies.map(T=>r.jsx(aRe,{comment:T,postId:e,currentUserId:n,currentUserAvatar:s,currentUserEmail:a,canModerate:o,depth:l+1},T.id))})]})}const kL=[{type:"like",emoji:"👍",label:"Like"},{type:"love",emoji:"❤️",label:"Love"},{type:"laugh",emoji:"😂",label:"Haha"},{type:"wow",emoji:"😮",label:"Wow"},{type:"sad",emoji:"😢",label:"Sad"},{type:"angry",emoji:"😠",label:"Angry"}],qxt=()=>{const{user:t,isBrokerageManager:e,managedBrokerages:n,isAdmin:s}=Qr(),{avatarUrl:a}=vLe(t==null?void 0:t.id),{onlineUsers:o}=YOe(),{toast:l}=fi(),i=Vr(),h=I.useRef(null),[p,x]=I.useState("all"),[y,b]=I.useState(""),[j,C]=I.useState(""),[N,A]=I.useState(""),[E,T]=I.useState([]),[L,z]=I.useState([]),[F,q]=I.useState(""),[H,Z]=I.useState(!1),[G,te]=I.useState(null),[ie,le]=I.useState(""),[ye,ne]=I.useState(new Set),[ge,ae]=I.useState({}),[he,ue]=I.useState({}),[_e,Ae]=I.useState([]),[Ce,be]=I.useState([]),[me,Le]=I.useState({open:!1,images:[],index:0});I.useEffect(()=>{if(p.startsWith("group:")){const wt=p.replace("group:","");A(wt),C("")}else p!=="all"?(C(p),A("")):(C(""),A(""))},[p]);const{data:Ne=[]}=Yt({queryKey:["community-categories"],queryFn:async()=>{const{data:wt,error:Qt}=await J.from("community_categories").select("*").order("sort_order");if(Qt)throw Qt;return wt}}),{data:Be=[]}=Yt({queryKey:["community-private-groups"],queryFn:async()=>{const{data:wt,error:Qt}=await J.from("community_private_groups").select("id, name, description, icon, brokerage_id, sort_order").order("sort_order");if(Qt)throw Qt;return wt}}),Ee=20,{data:Ue,isLoading:Re,hasNextPage:je,fetchNextPage:et,isFetchingNextPage:Te}=LQe({queryKey:["community-posts",p],initialPageParam:0,queryFn:async({pageParam:wt})=>{var Ie;const Qt=wt*Ee,Cr=Qt+Ee;let cn=J.from("community_posts").select("*").order("is_pinned",{ascending:!1}).order("pinned_at",{ascending:!1,nullsFirst:!1}).order("created_at",{ascending:!1}).range(Qt,Cr);if(p.startsWith("group:")){const Ge=p.replace("group:","");cn=cn.eq("private_group_id",Ge)}else p==="all"||(cn=cn.eq("category_id",p).is("private_group_id",null));const{data:jn,error:Xr}=await cn;if(Xr)throw Xr;const Pn=((jn==null?void 0:jn.length)||0)>Ee,js=(jn||[]).slice(0,Ee);if(js.length===0)return{posts:[],hasMore:!1,nextPage:wt+1};const hr=js.map(Ge=>Ge.id),xs=[...new Set(js.filter(Ge=>Ge.category_id).map(Ge=>Ge.category_id))].filter(Boolean),[ka,xa,zi,Bi,tl]=await Promise.all([xs.length?J.from("community_categories").select("*").in("id",xs):Promise.resolve({data:[]}),J.from("community_post_media").select("*").in("post_id",hr).order("sort_order"),J.from("community_reactions").select("*").in("post_id",hr),J.from("community_comments").select("*").in("post_id",hr).order("created_at",{ascending:!0}),J.from("community_post_resources").select("*").in("post_id",hr)]),xo=ka==null?void 0:ka.data,Hs=xa==null?void 0:xa.data,Xa=zi==null?void 0:zi.data,Ns=Bi==null?void 0:Bi.data,Fa=tl==null?void 0:tl.data,Oa=(Ns||[]).map(Ge=>Ge.id),[Do,ir]=await Promise.all([Oa.length?J.from("community_comment_reactions").select("*").in("comment_id",Oa):Promise.resolve({data:[]}),(()=>{const Ge=(Fa||[]).filter(kt=>kt.resource_type==="template").map(kt=>kt.resource_id);return Ge.length===0?Promise.resolve({data:[]}):J.from("canva_templates").select("id, name, preview_image_url").in("id",Ge)})()]),fo=(Do==null?void 0:Do.data)||[],pl=(ir==null?void 0:ir.data)||[],To=new Map(pl.map(Ge=>[Ge.id,{name:Ge.name,preview_image_url:Ge.preview_image_url}])),ss=Array.from(new Set([...js.map(Ge=>Ge.user_id),...(Xa||[]).map(Ge=>Ge.user_id),...(Ns||[]).map(Ge=>Ge.user_id),...fo.map(Ge=>Ge.user_id)])),[yo,pu]=await Promise.all([ss.length?J.from("profiles").select("id, name").in("id",ss):Promise.resolve({data:[]}),_Le(ss)]),$l=new Map(((Ie=yo==null?void 0:yo.data)==null?void 0:Ie.map(Ge=>[Ge.id,Ge.name]))||[]),mu=new Map((xo||[]).map(Ge=>[Ge.id,Ge])),Je=Ge=>{const kt=new Map,vt=[];return Ge.forEach(At=>{kt.set(At.id,{...At,user_name:$l.get(At.user_id)||"Unknown User",user_avatar:pu.get(At.user_id),reactions:fo.filter(zt=>zt.comment_id===At.id).map(zt=>({...zt,user_name:$l.get(zt.user_id)||"Unknown User",user_avatar:pu.get(zt.user_id)})),replies:[]})}),Ge.forEach(At=>{const zt=kt.get(At.id);if(At.parent_comment_id&&kt.has(At.parent_comment_id)){const Pt=kt.get(At.parent_comment_id);Pt.replies=Pt.replies||[],Pt.replies.push(zt)}else vt.push(zt)}),vt};return{posts:js.map(Ge=>{const kt=(Fa||[]).filter(vt=>vt.post_id===Ge.id).map(vt=>{let At="",zt=null;if(vt.resource_type==="template"){const Pt=To.get(vt.resource_id);At=(Pt==null?void 0:Pt.name)||"Unknown Template",zt=(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:zt}});return{...Ge,user_name:$l.get(Ge.user_id)||"Unknown User",user_avatar:pu.get(Ge.user_id),category:Ge.category_id?mu.get(Ge.category_id):null,media:(Hs||[]).filter(vt=>vt.post_id===Ge.id),reactions:((Xa||[]).filter(vt=>vt.post_id===Ge.id)||[]).map(vt=>({...vt,user_name:$l.get(vt.user_id)||"Unknown User",user_avatar:pu.get(vt.user_id)})),comments:Je((Ns||[]).filter(vt=>vt.post_id===Ge.id)),resources:kt}}),hasMore:Pn,nextPage:wt+1}},getNextPageParam:wt=>wt.hasMore?wt.nextPage:void 0}),Ze=I.useMemo(()=>(Ue==null?void 0:Ue.pages.flatMap(wt=>wt.posts))??[],[Ue]),pe=cr({mutationFn:async()=>{Z(!0);const{data:wt,error:Qt}=await J.from("community_posts").insert({user_id:t.id,category_id:N?null:j||null,private_group_id:N||null,content:y,link_url:F||null}).select().single();if(Qt)throw Qt;for(let cn=0;cn0){const cn=_e.filter(jn=>jn!==t.id).map(jn=>({post_id:wt.id,mentioned_user_id:jn,mentioned_by_user_id:t.id}));cn.length>0&&await J.from("community_post_mentions").insert(cn)}const Cr=Uxt(y);if(Cr.length>0){const cn=Cr.map(jn=>({post_id:wt.id,resource_type:"template",resource_id:jn}));await J.from("community_post_resources").insert(cn)}return wt},onSuccess:async wt=>{var Qt;i.invalidateQueries({queryKey:["community-posts"]}),b(""),Ae([]),be([]),C(""),A(""),T([]),z([]),q(""),l({title:"Post created!"});try{const Cr=((Qt=t==null?void 0:t.user_metadata)==null?void 0:Qt.name)||"Someone",cn=y.length>50?y.substring(0,50)+"...":y;await J.functions.invoke("send-push-notification",{body:{title:"New Community Post",body:`${Cr}: ${cn}`,url:"/community"}})}catch(Cr){console.error("Failed to send push notification:",Cr)}},onError:wt=>{l({title:"Error creating post",description:wt.message,variant:"destructive"})},onSettled:()=>Z(!1)}),yt=cr({mutationFn:async({postId:wt,content:Qt})=>{const{error:Cr}=await J.from("community_posts").update({content:Qt}).eq("id",wt);if(Cr)throw Cr},onSuccess:()=>{i.invalidateQueries({queryKey:["community-posts"]}),te(null),le(""),l({title:"Post updated!"})}}),rt=cr({mutationFn:async wt=>{const{error:Qt}=await J.from("community_posts").delete().eq("id",wt);if(Qt)throw Qt},onSuccess:()=>{i.invalidateQueries({queryKey:["community-posts"]}),l({title:"Post deleted"})}}),at=cr({mutationFn:async({postId:wt,isPinned:Qt})=>{const{error:Cr}=await J.from("community_posts").update({is_pinned:!Qt,pinned_at:Qt?null:new Date().toISOString(),pinned_by:Qt?null:t==null?void 0:t.id}).eq("id",wt);if(Cr)throw Cr},onSuccess:(wt,{isPinned:Qt})=>{i.invalidateQueries({queryKey:["community-posts"]}),l({title:Qt?"Post unpinned":"Post pinned to top"})}}),Me=cr({mutationFn:async({postId:wt,reactionType:Qt})=>{var cn;const Cr=(cn=Ze.find(jn=>jn.id===wt))==null?void 0:cn.reactions.find(jn=>jn.user_id===(t==null?void 0:t.id));Cr?Cr.reaction_type===Qt?await J.from("community_reactions").delete().eq("id",Cr.id):await J.from("community_reactions").update({reaction_type:Qt}).eq("id",Cr.id):await J.from("community_reactions").insert({post_id:wt,user_id:t.id,reaction_type:Qt})},onSuccess:()=>i.invalidateQueries({queryKey:["community-posts"]})}),ft=cr({mutationFn:async({postId:wt,content:Qt})=>{const{data:Cr,error:cn}=await J.from("community_comments").insert({post_id:wt,user_id:t.id,content:Qt}).select("id").single();if(cn)throw cn;const jn=he[wt]||[];if(jn.length>0&&Cr){const Xr=jn.filter(Pn=>Pn!==t.id).map(Pn=>({comment_id:Cr.id,mentioned_user_id:Pn,mentioned_by_user_id:t.id}));Xr.length>0&&await J.from("community_comment_mentions").insert(Xr)}},onSuccess:(wt,{postId:Qt})=>{i.invalidateQueries({queryKey:["community-posts"]}),ae(Cr=>({...Cr,[Qt]:""})),ue(Cr=>({...Cr,[Qt]:[]}))}});cr({mutationFn:async wt=>{const{error:Qt}=await J.from("community_comments").delete().eq("id",wt);if(Qt)throw Qt},onSuccess:()=>i.invalidateQueries({queryKey:["community-posts"]})});const qe=wt=>{const Qt=Array.from(wt.target.files||[]);if(Qt.length+E.length>10){l({title:"Maximum 10 files allowed",variant:"destructive"});return}T(Cr=>[...Cr,...Qt]),Qt.forEach(Cr=>{const cn=new FileReader;cn.onloadend=()=>{z(jn=>[...jn,cn.result])},cn.readAsDataURL(Cr)})},Oe=wt=>{T(Qt=>Qt.filter((Cr,cn)=>cn!==wt)),z(Qt=>Qt.filter((Cr,cn)=>cn!==wt))},Qe=wt=>wt.split(" ").map(Qt=>Qt[0]).join("").toUpperCase().slice(0,2),nt=wt=>{const Qt={};return wt.forEach(Cr=>{Qt[Cr.reaction_type]=(Qt[Cr.reaction_type]||0)+1}),Qt},gt=wt=>{var Qt;return(Qt=wt.find(Cr=>Cr.user_id===(t==null?void 0:t.id)))==null?void 0:Qt.reaction_type},mt=wt=>wt.reduce((Qt,Cr)=>Qt+1+(Cr.replies?mt(Cr.replies):0),0),Mt=wt=>{if(s)return!0;if(!e||!wt.private_group_id)return!1;const Qt=Be.find(Cr=>Cr.id===wt.private_group_id);return Qt!=null&&Qt.brokerage_id?n.some(Cr=>Cr.id===Qt.brokerage_id):!1};return r.jsx(Lr,{title:"Community",children:r.jsxs("div",{className:"flex gap-6 w-full isolate z-0",children:[r.jsx(Nxt,{categories:Ne,privateGroups:Be,selectedFilter:p,onFilterChange:x,onlineUsers:o}),r.jsxs("div",{className:"flex-1 min-w-0 max-w-2xl mx-auto lg:mx-0 space-y-6",children:[r.jsxs("div",{className:"px-1",children:[r.jsx("h1",{className:"text-4xl lg:text-5xl font-bold text-foreground",children:"Community"}),r.jsx("p",{className:"text-muted-foreground mt-1",children:"Connect and share with fellow agents"})]}),r.jsx(Sxt,{categories:Ne,privateGroups:Be,selectedFilter:p,onFilterChange:x,onlineUsers:o}),r.jsx(Ye,{children:r.jsx(tt,{className:"pt-6",children:r.jsxs("div",{className:"flex gap-3",children:[r.jsxs(Ks,{className:"h-10 w-10",children:[r.jsx(Ei,{src:a||void 0}),r.jsx(Zs,{children:t!=null&&t.email?Qe(t.email.split("@")[0]):"U"})]}),r.jsxs("div",{className:"flex-1 space-y-3",children:[r.jsx(wte,{placeholder:s?"What's on your mind? Use @ to mention someone, # to link a template":"What's on your mind? Use @ to mention someone",value:y,onChange:b,onMentionsChange:Ae,onTemplatesChange:be,mentionFormat:"encoded",minHeight:"80px",enableTemplateMentions:s}),L.length>0&&r.jsx("div",{className:"grid grid-cols-3 gap-2",children:L.map((wt,Qt)=>{var Cr;return r.jsxs("div",{className:"relative aspect-square rounded-lg overflow-hidden bg-muted",children:[(Cr=E[Qt])!=null&&Cr.type.startsWith("video/")?r.jsx("video",{src:wt,className:"w-full h-full object-cover"}):r.jsx("img",{src:wt,alt:"",className:"w-full h-full object-cover"}),r.jsx(ee,{variant:"destructive",size:"icon",className:"absolute top-1 right-1 h-6 w-6",onClick:()=>Oe(Qt),children:r.jsx(_s,{className:"h-3 w-3"})})]},Qt)})}),F&&r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Co,{className:"h-4 w-4 text-muted-foreground"}),r.jsx(dt,{value:F,onChange:wt=>q(wt.target.value),placeholder:"https://...",className:"flex-1"}),r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>q(""),children:r.jsx(_s,{className:"h-4 w-4"})})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3",children:[r.jsxs("div",{className:"flex gap-1 flex-wrap",children:[r.jsx("input",{type:"file",ref:h,onChange:qe,accept:"image/*,video/*",multiple:!0,className:"hidden"}),r.jsxs(ee,{variant:"ghost",size:"sm",onClick:()=>{var wt;return(wt=h.current)==null?void 0:wt.click()},children:[r.jsx(Pl,{className:"h-4 w-4 mr-1"}),"Photo"]}),r.jsxs(ee,{variant:"ghost",size:"sm",onClick:()=>{var wt;return(wt=h.current)==null?void 0:wt.click()},children:[r.jsx(Pa,{className:"h-4 w-4 mr-1"}),"Video"]}),r.jsxs(ee,{variant:"ghost",size:"sm",onClick:()=>q("https://"),children:[r.jsx(Co,{className:"h-4 w-4 mr-1"}),"Link"]})]}),r.jsxs("div",{className:"flex items-center gap-2 w-full sm:w-auto justify-end",children:[Be.length>0?r.jsxs(gn,{value:N||j||"none",onValueChange:wt=>{wt==="none"?(C(""),A("")):wt.startsWith("group:")?(A(wt.replace("group:","")),C("")):(C(wt),A(""))},children:[r.jsx(fn,{className:"w-[130px] sm:w-[160px] h-8 text-xs sm:text-sm",children:r.jsx(xn,{placeholder:"Select..."})}),r.jsxs(pn,{children:[r.jsx(Vt,{value:"none",children:"No category"}),Ne.map(wt=>r.jsxs(Vt,{value:wt.id,children:[wt.icon," ",wt.name]},wt.id)),Be.length>0&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"px-2 py-1 text-xs font-semibold text-muted-foreground border-t mt-1 pt-1",children:"🔒 Private Groups"}),Be.map(wt=>r.jsxs(Vt,{value:`group:${wt.id}`,children:[wt.icon||"🔒"," ",wt.name]},wt.id))]})]})]}):r.jsxs(gn,{value:j,onValueChange:C,children:[r.jsx(fn,{className:"w-[110px] sm:w-[140px] h-8 text-xs sm:text-sm",children:r.jsx(xn,{placeholder:"Category"})}),r.jsx(pn,{children:Ne.map(wt=>r.jsxs(Vt,{value:wt.id,children:[wt.icon," ",wt.name]},wt.id))})]}),r.jsxs(ee,{size:"sm",onClick:()=>pe.mutate(),disabled:!y.trim()||H,children:[r.jsx(Oo,{className:"h-4 w-4 mr-1"}),"Post"]})]})]})]})]})})}),Re?r.jsx("div",{className:"space-y-4",children:[...Array(3)].map((wt,Qt)=>r.jsx(Ye,{children:r.jsx(tt,{className:"pt-6",children:r.jsxs("div",{className:"flex gap-3",children:[r.jsx(Ir,{className:"h-10 w-10 rounded-full"}),r.jsxs("div",{className:"flex-1 space-y-2",children:[r.jsx(Ir,{className:"h-4 w-32"}),r.jsx(Ir,{className:"h-4 w-full"}),r.jsx(Ir,{className:"h-4 w-3/4"})]})]})})},Qt))}):Ze.length===0?r.jsx(Ye,{children:r.jsxs(tt,{className:"py-12 text-center",children:[r.jsx(Fl,{className:"h-12 w-12 mx-auto text-muted-foreground mb-4"}),r.jsx("h3",{className:"font-semibold mb-2",children:"No posts yet"}),r.jsx("p",{className:"text-muted-foreground",children:"Be the first to start a conversation!"})]})}):r.jsxs("div",{className:"space-y-4",children:[Ze.map(wt=>{var Qt,Cr,cn,jn;return r.jsx(Ye,{children:r.jsxs(tt,{className:"pt-6",children:[r.jsxs("div",{className:"flex items-start justify-between mb-3",children:[r.jsxs("div",{className:"flex gap-3 min-w-0",children:[r.jsxs(Ks,{className:"h-10 w-10",children:[r.jsx(Ei,{src:wt.user_avatar||void 0}),r.jsx(Zs,{children:Qe(wt.user_name||"U")})]}),r.jsxs("div",{className:"min-w-0",children:[r.jsx("div",{className:"font-semibold break-words",children:wt.user_name}),r.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-sm text-muted-foreground",children:[r.jsx("span",{children:cu(new Date(wt.created_at),{addSuffix:!0})}),wt.category&&r.jsxs(r.Fragment,{children:[r.jsx("span",{children:"•"}),r.jsxs(Ot,{variant:"secondary",className:"text-xs",children:[wt.category.icon," ",wt.category.name]})]})]})]})]}),(wt.user_id===(t==null?void 0:t.id)||Mt(wt))&&r.jsxs(wh,{children:[r.jsx(jh,{asChild:!0,children:r.jsx(ee,{variant:"ghost",size:"icon",className:"h-8 w-8",children:r.jsx(em,{className:"h-4 w-4"})})}),r.jsxs(Wu,{align:"end",children:[Mt(wt)&&wt.private_group_id&&r.jsx(di,{onClick:()=>at.mutate({postId:wt.id,isPinned:wt.is_pinned}),children:wt.is_pinned?r.jsxs(r.Fragment,{children:[r.jsx(BT,{className:"h-4 w-4 mr-2"}),"Unpin Post"]}):r.jsxs(r.Fragment,{children:[r.jsx(b1,{className:"h-4 w-4 mr-2"}),"Pin to Top"]})}),wt.user_id===(t==null?void 0:t.id)&&r.jsxs(di,{onClick:()=>{te(wt),le(wt.content)},children:[r.jsx(_i,{className:"h-4 w-4 mr-2"}),"Edit"]}),r.jsxs(di,{className:"text-destructive",onClick:()=>rt.mutate(wt.id),children:[r.jsx(Vn,{className:"h-4 w-4 mr-2"}),wt.user_id!==(t==null?void 0:t.id)?"Remove (Moderate)":"Delete"]})]})]})]}),wt.is_pinned&&r.jsxs("div",{className:"flex items-center gap-2 mb-2 text-sm text-primary",children:[r.jsx(b1,{className:"h-4 w-4"}),r.jsx("span",{className:"font-medium",children:"Pinned"})]}),r.jsx("div",{className:"mb-3",children:r.jsx(Oxe,{content:wt.content})}),wt.media.length>0&&r.jsx("div",{className:`grid gap-2 mb-3 ${wt.media.length===1?"grid-cols-1":wt.media.length===2?"grid-cols-2":wt.media.length===3?"grid-cols-3":"grid-cols-2"}`,children:wt.media.slice(0,4).map((Xr,Pn)=>{const js=Pn===3&&wt.media.length>4,hr=wt.media.length-4;return r.jsxs("div",{className:`relative rounded-lg overflow-hidden bg-muted cursor-pointer group ${wt.media.length===1?"max-h-[500px]":wt.media.length===2?"aspect-[4/3]":"aspect-square"}`,onClick:()=>Le({open:!0,images:wt.media.map(xs=>({url:xs.media_url,type:xs.media_type==="video"?"video":"image"})),index:Pn}),children:[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"})})})}),js&&r.jsx("div",{className:"absolute inset-0 bg-black/60 flex items-center justify-center",children:r.jsxs("span",{className:"text-white text-2xl font-bold",children:["+",hr]})})]},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(Co,{className:"h-4 w-4 flex-shrink-0"}),r.jsx("span",{className:"truncate",children:wt.link_url})]})})]}),wt.reactions.length>0&&r.jsx(sRe,{reactions:wt.reactions,children:r.jsxs("div",{className:"flex items-center gap-2 mb-3 text-sm text-muted-foreground hover:text-foreground transition-colors cursor-pointer",children:[r.jsx("div",{className:"flex -space-x-1",children:Object.entries(nt(wt.reactions)).slice(0,3).map(([Xr])=>{var Pn;return r.jsx("span",{className:"text-base",children:(Pn=kL.find(js=>js.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(zu,{children:[r.jsx(Bu,{asChild:!0,children:r.jsxs(ee,{variant:"ghost",size:"sm",className:"flex-1",children:[gt(wt.reactions)?r.jsx("span",{className:"mr-1",children:(Qt=kL.find(Xr=>Xr.type===gt(wt.reactions)))==null?void 0:Qt.emoji}):r.jsx(pd,{className:"h-4 w-4 mr-1"}),gt(wt.reactions)?(Cr=kL.find(Xr=>Xr.type===gt(wt.reactions)))==null?void 0:Cr.label:"Like"]})}),r.jsx(uu,{className:"w-auto p-2",side:"top",children:r.jsx("div",{className:"flex gap-1",children:kL.map(Xr=>r.jsx("button",{onClick:()=>Me.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(ee,{variant:"ghost",size:"sm",className:"flex-1",onClick:()=>ne(Xr=>{const Pn=new Set(Xr);return Pn.has(wt.id)?Pn.delete(wt.id):Pn.add(wt.id),Pn}),children:[r.jsx(Fl,{className:"h-4 w-4 mr-1"}),(()=>{const Xr=mt(wt.comments);return Xr>0?`Comment (${Xr})`:"Comment"})()]})]}),ye.has(wt.id)&&r.jsxs("div",{className:"space-y-3 mt-3",children:[wt.comments.map(Xr=>r.jsx(aRe,{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(Ks,{className:"h-8 w-8",children:[r.jsx(Ei,{src:a||void 0}),r.jsx(Zs,{className:"text-xs",children:Qe(((cn=t.email)==null?void 0:cn.split("@")[0])||"U")})]}),r.jsxs("div",{className:"flex-1 flex gap-2",children:[r.jsx(wte,{placeholder:"Write a comment... (use @ to mention)",value:ge[wt.id]||"",onChange:Xr=>ae(Pn=>({...Pn,[wt.id]:Xr})),onMentionsChange:Xr=>ue(Pn=>({...Pn,[wt.id]:Xr})),mentionFormat:"plain",onKeyDown:Xr=>{var Pn;Xr.defaultPrevented||Xr.key==="Enter"&&!Xr.shiftKey&&((Pn=ge[wt.id])!=null&&Pn.trim())&&(Xr.preventDefault(),ft.mutate({postId:wt.id,content:ge[wt.id]}))},className:"text-sm min-h-0 py-1.5",minHeight:"32px"}),r.jsx(ee,{size:"sm",variant:"ghost",onClick:()=>{var Xr;(Xr=ge[wt.id])!=null&&Xr.trim()&&ft.mutate({postId:wt.id,content:ge[wt.id]})},disabled:!((jn=ge[wt.id])!=null&&jn.trim()),className:"h-8 px-2 mt-0.5",children:r.jsx(Oo,{className:"h-4 w-4"})})]})]})]})]})},wt.id)}),je&&r.jsx("div",{className:"flex justify-center pt-2",children:r.jsx(ee,{variant:"outline",onClick:()=>et(),disabled:Te,children:Te?"Loading…":"Load more posts"})})]}),r.jsx(Fr,{open:!!G,onOpenChange:()=>te(null),children:r.jsxs(Rr,{children:[r.jsx(qr,{children:r.jsx($r,{children:"Edit Post"})}),r.jsx(ps,{value:ie,onChange:wt=>le(wt.target.value),className:"min-h-[120px]"}),r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(ee,{variant:"outline",onClick:()=>te(null),children:"Cancel"}),r.jsx(ee,{onClick:()=>{G&&yt.mutate({postId:G.id,content:ie})},disabled:!ie.trim(),children:"Save Changes"})]})]})}),r.jsx(Bxt,{images:me.images,initialIndex:me.index,open:me.open,onOpenChange:wt=>Le(Qt=>({...Qt,open:wt}))})]})]})})},d4={open:{label:"Open",icon:Ya,color:"bg-yellow-500"},in_progress:{label:"In Progress",icon:Fl,color:"bg-blue-500"},resolved:{label:"Resolved",icon:Yi,color:"bg-green-500"},closed:{label:"Closed",icon:qc,color:"bg-muted-foreground"}},Cke={general:"General Support",technology:"Technology Support",crm:"CRM Support",marketing:"Marketing Support"};function Vxt(){const{user:t}=Qr(),e=Vr(),[n,s]=I.useState(null),[a,o]=I.useState(""),{data:l=[],isLoading:i}=Yt({queryKey:["support-tickets"],queryFn:async()=>{const{data:y,error:b}=await J.from("support_tickets").select("*").eq("user_id",t==null?void 0:t.id).order("created_at",{ascending:!1});if(b)throw b;return y},enabled:!!t}),{data:h=[]}=Yt({queryKey:["ticket-replies",n==null?void 0:n.id],queryFn:async()=>{if(!n)return[];const{data:y,error:b}=await J.from("support_ticket_replies").select("*, profiles(name)").eq("ticket_id",n.id).order("created_at",{ascending:!0});if(b)throw b;return y},enabled:!!n}),p=cr({mutationFn:async y=>{if(!n||!t)throw new Error("Missing data");const{error:b}=await J.from("support_ticket_replies").insert({ticket_id:n.id,user_id:t.id,content:y,is_admin_reply:!1});if(b)throw b},onSuccess:()=>{e.invalidateQueries({queryKey:["ticket-replies",n==null?void 0:n.id]}),o(""),ze.success("Reply sent!")},onError:()=>{ze.error("Failed to send reply")}}),x=()=>{a.trim()&&p.mutate(a)};if(n){const y=d4[n.status].icon;return r.jsx(Lr,{children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>s(null),children:r.jsx(so,{className:"h-5 w-5"})}),r.jsxs("div",{className:"flex-1",children:[r.jsx("h1",{className:"text-2xl font-bold",children:n.subject}),r.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[r.jsx(Ot,{variant:"secondary",children:Cke[n.category]}),r.jsxs(Ot,{className:d4[n.status].color,children:[r.jsx(y,{className:"h-3 w-3 mr-1"}),d4[n.status].label]})]})]})]}),r.jsxs(Ye,{children:[r.jsx(Gt,{children:r.jsxs(Mn,{children:["Created on ",yn(new Date(n.created_at),"MMM d, yyyy 'at' h:mm a")]})}),r.jsx(tt,{children:r.jsx("p",{className:"text-muted-foreground whitespace-pre-wrap",children:n.description})})]}),r.jsxs(Ye,{children:[r.jsx(Gt,{children:r.jsx(Zt,{className:"text-lg",children:"Conversation"})}),r.jsxs(tt,{children:[r.jsx(Jo,{className:"h-[300px] pr-4",children:h.length===0?r.jsx("p",{className:"text-muted-foreground text-center py-8",children:"No replies yet"}):r.jsx("div",{className:"space-y-4",children:h.map(b=>{var j;return r.jsxs("div",{className:`p-4 rounded-lg ${b.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:b.is_admin_reply?"Support Team":((j=b.profiles)==null?void 0:j.name)||"You"}),r.jsx("span",{className:"text-xs text-muted-foreground",children:yn(new Date(b.created_at),"MMM d, h:mm a")})]}),r.jsx("p",{className:"text-sm whitespace-pre-wrap",children:b.content})]},b.id)})})}),n.status!=="closed"&&r.jsxs(r.Fragment,{children:[r.jsx(ou,{className:"my-4"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(ps,{placeholder:"Type your reply...",value:a,onChange:b=>o(b.target.value),className:"min-h-[80px]"}),r.jsx(ee,{onClick:x,disabled:!a.trim()||p.isPending,className:"self-end",children:r.jsx(Oo,{className:"h-4 w-4"})})]})]})]})]})]})})}return r.jsx(Lr,{children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Ye,{className:"bg-gradient-to-br from-primary/10 via-primary/5 to-background border-primary/20",children:r.jsx(tt,{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(Nx,{className:"h-8 w-8 text-primary"})}),r.jsxs("div",{className:"flex-1",children:[r.jsx("h1",{className:"text-2xl font-bold mb-2",children:"Need Help?"}),r.jsx("p",{className:"text-muted-foreground mb-4",children:"Submit a support ticket and our team will get back to you as soon as possible."}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[r.jsx(ghe,{trigger:r.jsxs(ee,{size:"lg",className:"gap-2",children:[r.jsx(bn,{className:"h-5 w-5"}),"Submit a Ticket"]})}),r.jsxs("div",{className:"flex items-center gap-2 px-4 py-2 bg-muted rounded-lg",children:[r.jsx(bi,{className:"h-4 w-4 text-muted-foreground"}),r.jsxs("span",{className:"text-sm text-muted-foreground",children:["Or text us: ",r.jsx("span",{className:"font-semibold text-foreground",children:"1-866-527-8668"})]})]})]})]})]})})}),r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsx("h2",{className:"text-lg font-semibold",children:"Your Tickets"}),r.jsx(ghe,{trigger:r.jsxs(ee,{variant:"outline",size:"sm",className:"gap-2",children:[r.jsx(bn,{className:"h-4 w-4"}),"New Ticket"]})})]}),i?r.jsx("div",{className:"text-center py-12 text-muted-foreground",children:"Loading tickets..."}):l.length===0?r.jsx(Ye,{className:"border-dashed",children:r.jsxs(tt,{className:"text-center py-12",children:[r.jsx(Fl,{className:"h-12 w-12 mx-auto text-muted-foreground mb-4"}),r.jsx("h3",{className:"text-lg font-medium mb-2",children:"No tickets yet"}),r.jsx("p",{className:"text-muted-foreground",children:"You haven't submitted any support tickets. Use the button above to get started!"})]})}):r.jsx("div",{className:"space-y-3",children:l.map(y=>{const b=d4[y.status].icon;return r.jsx(Ye,{className:"cursor-pointer hover:bg-muted/50 transition-colors",onClick:()=>s(y),children:r.jsx(tt,{className:"p-4",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("h3",{className:"font-medium truncate",children:y.subject}),r.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[r.jsx(Ot,{variant:"outline",className:"text-xs",children:Cke[y.category]}),r.jsx("span",{className:"text-xs text-muted-foreground",children:yn(new Date(y.created_at),"MMM d, yyyy")})]})]}),r.jsxs(Ot,{className:d4[y.status].color,children:[r.jsx(b,{className:"h-3 w-3 mr-1"}),d4[y.status].label]})]})})},y.id)})})]})})}function Hxt({open:t,onOpenChange:e}){return r.jsx(Fr,{open:t,onOpenChange:e,children:r.jsxs(Rr,{className:"max-w-3xl max-h-[90vh] overflow-hidden",children:[r.jsx(qr,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"p-2 bg-primary/10 rounded-lg",children:r.jsx(zs,{className:"h-5 w-5 text-primary"})}),r.jsxs("div",{children:[r.jsx($r,{children:"Schedule Agent Onboarding"}),r.jsx(Xn,{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 Wxt({open:t,onOpenChange:e}){const{brokerageId:n}=Qr(),[s,a]=I.useState(""),[o,l]=I.useState([]),[i,h]=I.useState(!1),{data:p,isLoading:x}=Yt({queryKey:["brokerage-agents-for-onboarding",n],queryFn:async()=>{if(!n)return[];const{data:N,error:A}=await J.from("profiles").select("id, name, email").eq("brokerage_id",n).order("name",{ascending:!0});if(A)throw A;return N},enabled:t&&!!n}),y=p==null?void 0:p.filter(N=>N.name.toLowerCase().includes(s.toLowerCase())||N.email.toLowerCase().includes(s.toLowerCase())),b=N=>{l(A=>A.includes(N)?A.filter(E=>E!==N):[...A,N])},j=async()=>{if(o.length===0){ze.error("Please select at least one agent");return}h(!0);try{const{data:N,error:A}=await J.functions.invoke("send-onboarding-link",{body:{agentIds:o}});if(A)throw A;ze.success(`Onboarding link sent to ${o.length} agent${o.length>1?"s":""}`),l([]),e(!1)}catch(N){console.error("Error sending onboarding link:",N),ze.error(N.message||"Failed to send onboarding link")}finally{h(!1)}},C=N=>{N||(l([]),a("")),e(N)};return r.jsx(Fr,{open:t,onOpenChange:C,children:r.jsxs(Rr,{className:"max-w-md",children:[r.jsx(qr,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"p-2 bg-primary/10 rounded-lg",children:r.jsx(Oo,{className:"h-5 w-5 text-primary"})}),r.jsxs("div",{children:[r.jsx($r,{children:"Send Onboarding Link"}),r.jsx(Xn,{children:"Select agents to receive the onboarding booking link"})]})]})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"relative",children:[r.jsx(wa,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(dt,{placeholder:"Search agents...",value:s,onChange:N=>a(N.target.value),className:"pl-10"})]}),x?r.jsx("div",{className:"flex items-center justify-center py-8",children:r.jsx(en,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):(y==null?void 0:y.length)===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(Bn,{className:"h-8 w-8 mx-auto mb-2 opacity-50"}),r.jsx("p",{children:"No agents found"})]}):r.jsx(Jo,{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:()=>b(N.id),children:[r.jsx(Dl,{checked:o.includes(N.id),onCheckedChange:()=>b(N.id)}),r.jsx(Ks,{className:"h-8 w-8",children:r.jsx(Zs,{className:"text-xs",children:N.name.split(" ").map(A=>A[0]).join("").toUpperCase()})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"text-sm font-medium truncate",children:N.name}),r.jsx("p",{className:"text-xs text-muted-foreground truncate",children:N.email})]})]},N.id))})}),o.length>0&&r.jsxs("p",{className:"text-sm text-muted-foreground",children:[o.length," agent",o.length>1?"s":""," selected"]})]}),r.jsxs(ea,{children:[r.jsx(ee,{variant:"outline",onClick:()=>C(!1),children:"Cancel"}),r.jsx(ee,{onClick:j,disabled:o.length===0||i,children:i?r.jsxs(r.Fragment,{children:[r.jsx(en,{className:"h-4 w-4 mr-2 animate-spin"}),"Sending..."]}):r.jsxs(r.Fragment,{children:[r.jsx(Oo,{className:"h-4 w-4 mr-2"}),"Send Link"]})})]})]})})}function Gxt(){const[t,e]=I.useState(!1),[n,s]=I.useState(!1);return r.jsxs(r.Fragment,{children:[r.jsxs(Ye,{className:"mb-8",children:[r.jsx(Gt,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"p-2 bg-primary/10 rounded-lg",children:r.jsx(Bn,{className:"h-6 w-6 text-primary"})}),r.jsxs("div",{children:[r.jsx(Zt,{children:"Agent Onboarding"}),r.jsx(Mn,{children:"Schedule onboarding sessions for yourself or your agents"})]})]})}),r.jsx(tt,{children:r.jsxs("div",{className:"flex flex-wrap gap-4",children:[r.jsxs(ee,{onClick:()=>e(!0),className:"flex items-center gap-2",children:[r.jsx(zs,{className:"h-4 w-4"}),"Schedule Agent Onboarding"]}),r.jsxs(ee,{variant:"outline",onClick:()=>s(!0),className:"flex items-center gap-2",children:[r.jsx(Oo,{className:"h-4 w-4"}),"Send New Agent Onboarding Link"]})]})})]}),r.jsx(Hxt,{open:t,onOpenChange:e}),r.jsx(Wxt,{open:n,onOpenChange:s})]})}function Kxt({open:t,onOpenChange:e}){return r.jsx(Fr,{open:t,onOpenChange:e,children:r.jsxs(Rr,{className:"max-w-3xl max-h-[90vh] overflow-hidden",children:[r.jsx(qr,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"p-2 bg-primary/10 rounded-lg",children:r.jsx(yg,{className:"h-5 w-5 text-primary"})}),r.jsxs("div",{children:[r.jsx($r,{children:"Schedule Launch Meeting"}),r.jsx(Xn,{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 Zxt(){const[t,e]=I.useState(!1);return r.jsxs(r.Fragment,{children:[r.jsxs(Ye,{className:"mb-8",children:[r.jsx(Gt,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"p-2 bg-primary/10 rounded-lg",children:r.jsx(yg,{className:"h-6 w-6 text-primary"})}),r.jsxs("div",{children:[r.jsx(Zt,{children:"Launch or ReLaunch Meeting"}),r.jsx(Mn,{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(tt,{children:r.jsxs(ee,{onClick:()=>e(!0),className:"flex items-center gap-2",children:[r.jsx(yg,{className:"h-4 w-4"}),"Schedule Launch Meeting"]})})]}),r.jsx(Kxt,{open:t,onOpenChange:e})]})}function Yxt(){const t=rs(),[e,n]=I.useState(""),[s,a]=I.useState(null),{data:o,isLoading:l}=Yt({queryKey:["brokerage-resources-published"],queryFn:async()=>{const{data:N,error:A}=await J.from("brokerage_resources").select("*").eq("is_published",!0).order("publish_date",{ascending:!1});if(A)throw A;return N}}),{data:i}=Yt({queryKey:["brokerage-resource-categories"],queryFn:async()=>{const{data:N,error:A}=await J.from("brokerage_resource_categories").select("*").order("sort_order",{ascending:!0});if(A)throw A;return N}}),{data:h}=Yt({queryKey:["brokerage-resource-pdfs-all"],queryFn:async()=>{const{data:N,error:A}=await J.from("brokerage_resource_pdfs").select("resource_id");if(A)throw A;return N}}),{data:p}=Yt({queryKey:["brokerage-resource-videos-all"],queryFn:async()=>{const{data:N,error:A}=await J.from("brokerage_resource_videos").select("resource_id");if(A)throw A;return N}}),{data:x}=Yt({queryKey:["brokerage-resource-links-all"],queryFn:async()=>{const{data:N,error:A}=await J.from("brokerage_resource_links").select("resource_id");if(A)throw A;return N}}),y=o==null?void 0:o.filter(N=>{var T;const A=N.title.toLowerCase().includes(e.toLowerCase())||((T=N.description)==null?void 0:T.toLowerCase().includes(e.toLowerCase())),E=!s||N.category_id===s;return A&&E}),b=i==null?void 0:i.filter(N=>o==null?void 0:o.some(A=>A.category_id===N.id)),j=N=>{const A=(h==null?void 0:h.filter(L=>L.resource_id===N).length)||0,E=(p==null?void 0:p.filter(L=>L.resource_id===N).length)||0,T=(x==null?void 0:x.filter(L=>L.resource_id===N).length)||0;return{pdfCount:A,videoCount:E,linkCount:T}},C=N=>{t(`/brokerage-resources/${N}`)};return r.jsx(Lr,{title:"Brokerage Resources",description:"Access exclusive resources for brokerage managers",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Gxt,{}),r.jsx(Zxt,{}),r.jsxs("div",{className:"relative max-w-md",children:[r.jsx(wa,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(dt,{placeholder:"Search resources...",value:e,onChange:N=>n(N.target.value),className:"pl-10"})]}),b&&b.length>0&&r.jsxs("div",{className:"flex flex-wrap gap-2",children:[r.jsx(Ot,{variant:s===null?"default":"outline",className:"cursor-pointer",onClick:()=>a(null),children:"All"}),b.map(N=>r.jsx(Ot,{variant:s===N.id?"default":"outline",className:"cursor-pointer",onClick:()=>a(N.id),children:N.name},N.id))]}),!l&&r.jsxs("p",{className:"text-sm text-muted-foreground",children:[(y==null?void 0:y.length)||0," resource",(y==null?void 0:y.length)!==1?"s":""," available"]}),l?r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:[...Array(6)].map((N,A)=>r.jsxs(Ye,{children:[r.jsx(Ir,{className:"h-40 w-full"}),r.jsx(Gt,{children:r.jsx(Ir,{className:"h-5 w-3/4"})}),r.jsxs(tt,{children:[r.jsx(Ir,{className:"h-4 w-full mb-2"}),r.jsx(Ir,{className:"h-4 w-2/3"})]})]},A))}):(y==null?void 0:y.length)===0?r.jsxs(Ye,{className:"p-12 text-center",children:[r.jsx(yh,{className:"h-12 w-12 mx-auto text-muted-foreground mb-4"}),r.jsx("h3",{className:"text-lg font-medium mb-2",children:"No resources found"}),r.jsx("p",{className:"text-muted-foreground",children:e||s?"Try adjusting your filters":"Check back later for new resources"})]}):r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:y==null?void 0:y.map(N=>{const{pdfCount:A,videoCount:E,linkCount:T}=j(N.id),L=i==null?void 0:i.find(z=>z.id===N.category_id);return r.jsxs(Ye,{className:"overflow-hidden cursor-pointer hover:shadow-lg transition-shadow",onClick:()=>C(N.id),children:[N.preview_image_url?r.jsx("img",{src:N.preview_image_url,alt:N.title,className:"w-full h-40 object-cover"}):r.jsx("div",{className:"w-full h-40 bg-muted flex items-center justify-center",children:r.jsx(yh,{className:"h-16 w-16 text-muted-foreground"})}),r.jsx(Gt,{className:"pb-2",children:r.jsxs("div",{className:"flex items-start justify-between gap-2",children:[r.jsx(Zt,{className:"text-lg line-clamp-1",children:N.title}),L&&r.jsx(Ot,{variant:"secondary",className:"shrink-0 text-xs",children:L.name})]})}),r.jsxs(tt,{children:[N.description&&r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 mb-3",children:N.description}),r.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[A>0&&r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(La,{className:"h-4 w-4"}),A]}),E>0&&r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Pa,{className:"h-4 w-4"}),E]}),T>0&&r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Co,{className:"h-4 w-4"}),T]})]})]})]},N.id)})})]})})}const Xxt=()=>{const{resourceId:t}=Zc(),{data:e,isLoading:n}=Yt({queryKey:["brokerage-resource-detail",t],queryFn:async()=>{const{data:a,error:o}=await J.from("brokerage_resources").select("*").eq("id",t).eq("is_published",!0).single();if(o)throw o;const{data:l}=await J.from("brokerage_resource_pdfs").select("*").eq("resource_id",t).order("sort_order"),{data:i}=await J.from("brokerage_resource_videos").select("*").eq("resource_id",t).order("sort_order"),{data:h}=await J.from("brokerage_resource_links").select("*").eq("resource_id",t).order("sort_order");return{...a,pdfs:l||[],videos:i||[],links:h||[]}},enabled:!!t}),s=a=>a?a<1024?a+" B":a<1024*1024?(a/1024).toFixed(1)+" KB":(a/(1024*1024)).toFixed(1)+" MB":"";return n?r.jsx(Lr,{title:"Brokerage Resources",children:r.jsx("div",{className:"flex justify-center py-12",children:r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})})}):e?r.jsx(Lr,{title:e.title,children:r.jsxs("div",{className:"space-y-6 max-w-5xl mx-auto",children:[r.jsx(ee,{variant:"ghost",size:"sm",asChild:!0,className:"gap-2",children:r.jsxs(co,{to:"/brokerage-resources",children:[r.jsx(so,{className:"h-4 w-4"}),"Back to Resources"]})}),e.preview_image_url&&r.jsx("div",{className:"relative w-full rounded-lg overflow-hidden bg-muted",children:r.jsx("img",{src:e.preview_image_url,alt:e.title,className:"w-full max-h-[400px] object-cover"})}),r.jsxs("div",{className:"space-y-4",children:[r.jsx("h1",{className:"text-2xl font-bold text-foreground",children:e.title}),e.description&&r.jsx("div",{className:"text-muted-foreground prose prose-sm max-w-none dark:prose-invert",dangerouslySetInnerHTML:{__html:e.description}})]}),e.videos&&e.videos.length>0&&r.jsx(Ye,{children:r.jsxs(tt,{className:"pt-6",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 mb-4",children:[r.jsx(Pa,{className:"h-4 w-4"}),"Videos (",e.videos.length,")"]}),r.jsx("div",{className:"space-y-4",children:e.videos.map(a=>r.jsxs("div",{className:"space-y-2",children:[r.jsx("h4",{className:"font-medium",children:a.title}),r.jsx("div",{className:"relative w-full",style:{paddingTop:"56.25%"},children:r.jsx("iframe",{src:a.video_url,className:"absolute top-0 left-0 w-full h-full rounded-lg border",allow:"accelerometer; gyroscope; autoplay; encrypted-media; picture-in-picture",allowFullScreen:!0})})]},a.id))})]})}),e.pdfs&&e.pdfs.length>0&&r.jsx(Ye,{children:r.jsxs(tt,{className:"pt-6",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 mb-4",children:[r.jsx(La,{className:"h-4 w-4"}),"Documents (",e.pdfs.length,")"]}),r.jsx("div",{className:"grid gap-2",children:e.pdfs.map(a=>r.jsxs("a",{href:a.file_url,target:"_blank",rel:"noopener noreferrer",className:"flex items-center justify-between p-3 rounded-lg border hover:bg-muted transition-colors group",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"p-2 rounded-md bg-primary/10",children:r.jsx(La,{className:"h-4 w-4 text-primary"})}),r.jsxs("div",{children:[r.jsx("div",{className:"font-medium text-sm",children:a.name}),a.file_size&&r.jsx("div",{className:"text-xs text-muted-foreground",children:s(a.file_size)})]})]}),r.jsx(no,{className:"h-4 w-4 text-muted-foreground group-hover:text-primary transition-colors"})]},a.id))})]})}),e.links&&e.links.length>0&&r.jsx(Ye,{children:r.jsxs(tt,{className:"pt-6",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 mb-4",children:[r.jsx(Fs,{className:"h-4 w-4"}),"Canva Templates (",e.links.length,")"]}),r.jsx("div",{className:"grid gap-2",children:e.links.map(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(Fs,{className:"h-4 w-4 text-primary"})}),r.jsx("div",{className:"font-medium text-sm",children:a.title})]}),r.jsx(Fs,{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(yh,{className:"h-12 w-12 text-muted-foreground mb-4"}),r.jsx("h3",{className:"text-lg font-semibold",children:"Resource not found"}),r.jsx("p",{className:"text-muted-foreground mt-1",children:"This resource may have been removed or is not available."}),r.jsx(ee,{asChild:!0,className:"mt-4",children:r.jsx(co,{to:"/brokerage-resources",children:"Back to Resources"})})]})})};function Qxt(){const{onlineUsers:t,totalOnline:e}=YOe();return r.jsxs(Ye,{children:[r.jsx(Gt,{className:"pb-3",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs(Zt,{className:"text-base flex items-center gap-2",children:[r.jsx(Bn,{className:"h-4 w-4"}),"Online Now"]}),r.jsxs(Ot,{variant:"secondary",className:"bg-green-100 text-green-700",children:[r.jsx(Ru,{className:"h-2 w-2 fill-green-500 text-green-500 mr-1"}),e," online"]})]})}),r.jsx(tt,{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(Jo,{className:"h-[300px] pr-4",children:r.jsx("div",{className:"space-y-3",children:t.map(n=>{var s;return r.jsxs("div",{className:"flex items-center gap-3 p-2 rounded-lg hover:bg-muted/50 transition-colors",children:[r.jsxs("div",{className:"relative",children:[r.jsxs(Ks,{className:"h-9 w-9",children:[r.jsx(Ei,{src:n.avatarUrl,alt:n.name}),r.jsx(Zs,{className:"text-xs",children:(s=n.name)==null?void 0:s.split(" ").map(a=>a[0]).join("").slice(0,2).toUpperCase()})]}),r.jsx("span",{className:"absolute bottom-0 right-0 h-2.5 w-2.5 rounded-full bg-green-500 ring-2 ring-background"})]}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"text-sm font-medium truncate",children:n.name}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Online ",cu(new Date(n.onlineSince),{addSuffix:!1})]})]})]},n.id)})})})})]})}const Mke={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:XT,path:"/admin/invite-codes",color:"bg-amber-500/10 text-amber-600"},{title:"Subscriptions",description:"Track and manage user subscriptions",icon:fm,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:jg,path:"/admin/discounts",color:"bg-red-500/10 text-red-600"},{title:"Referral Program",description:"Track brokerage referrals and discounts",icon:fc,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:Fd,path:"/admin/templates",color:"bg-pink-500/10 text-pink-600"},{title:"Manage Academy",description:"Upload videos and training content",icon:g1,path:"/admin/academy",color:"bg-indigo-500/10 text-indigo-600"},{title:"Manage Toolbox",description:"Create and manage resource kits",icon:Wx,path:"/admin/toolbox",color:"bg-orange-500/10 text-orange-600"},{title:"Social Swag",description:"Manage social media content and links",icon:Ms,path:"/admin/social-swag",color:"bg-fuchsia-500/10 text-fuchsia-600"},{title:"Social Swag 2.0",description:"New monthly social media images",icon:Ms,path:"/admin/social-swag-2",color:"bg-cyan-500/10 text-cyan-600"},{title:"Newsletters",description:"Manage monthly newsletter templates",icon:Vx,path:"/admin/newsletters",color:"bg-violet-500/10 text-violet-600"},{title:"Manage Events",description:"Create and publish events with Zoom integration",icon:hm,path:"/admin/events",color:"bg-green-500/10 text-green-600"},{title:"Additional Services",description:"Manage additional service offerings",icon:yh,path:"/admin/additional-services",color:"bg-lime-500/10 text-lime-600"},{title:"Brokerage Resources",description:"Manage resources for brokerage managers",icon:yh,path:"/admin/brokerage-resources",color:"bg-slate-500/10 text-slate-600"}]},platform:{label:"Platform",sections:[{title:"Dashboard Management",description:"Configure banners and dashboard modules",icon:gj,path:"/admin/dashboard-management",color:"bg-teal-500/10 text-teal-600"},{title:"Manage Apps",description:"Configure app tiles and access requirements",icon:Bh,path:"/admin/apps",color:"bg-purple-500/10 text-purple-600"},{title:"Email Templates",description:"Customize system email templates",icon:da,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:gm,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:MT,path:"/admin/onboarding-checklist",color:"bg-emerald-500/10 text-emerald-600"},{title:"Marketplace",description:"Manage store categories, products, and orders",icon:_g,path:"/admin/marketplace",color:"bg-gradient-to-br from-orange-500/20 to-amber-500/10 text-orange-600"},{title:"Reward Store",description:"Manage reward items agents can redeem with points",icon:Ki,path:"/admin/reward-store",color:"bg-purple-500/10 text-purple-600"},{title:"Agent Points",description:"View agent points, leaderboard, and award bonus points",icon:Zi,path:"/admin/agent-points",color:"bg-amber-500/10 text-amber-600"},{title:"Integrations",description:"Connect Facebook & Instagram for social posting",icon:tf,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:gm,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:Lo,path:"/admin/community",color:"bg-cyan-500/10 text-cyan-600"},{title:"Support Tickets",description:"View and respond to agent support requests",icon:oS,path:"/admin/support-tickets",color:"bg-rose-500/10 text-rose-600"},{title:"Wishlist",description:"Review and manage community feature requests",icon:v1,path:"/admin/wishlist",color:"bg-yellow-500/10 text-yellow-600"},{title:"Membership Reviews",description:"View member feedback and ratings",icon:vs,path:"/admin/membership-reviews",color:"bg-amber-500/10 text-amber-600"},{title:"Weekly Digest",description:"Configure automated weekly email digests",icon:da,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:cc,path:"/admin/analytics",color:"bg-emerald-500/10 text-emerald-600"}]},"agent-os":{label:"Agent OS",sections:[{title:"Agent OS Control Center",description:"Manage InnerCircle feature: relationship types, action types, scripts, plans & feature flags",icon:ci,path:"/admin/agent-os",color:"bg-gradient-to-br from-rose-500/20 to-pink-500/10 text-rose-600"},{title:"Listing Exchange",description:"Approve, feature, and moderate community listings",icon:pa,path:"/admin/listing-exchange",color:"bg-gradient-to-br from-blue-500/20 to-sky-500/10 text-blue-600"}]}};function Jxt(){const t=rs();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(Qxt,{})})]}),r.jsxs(Ii,{defaultValue:"users",className:"w-full",children:[r.jsx(wi,{className:"w-full justify-start flex-wrap h-auto gap-1 bg-muted/50 p-1",children:Object.entries(Mke).map(([e,n])=>r.jsx(ln,{value:e,className:"data-[state=active]:bg-background",children:n.label},e))}),Object.entries(Mke).map(([e,n])=>r.jsx(An,{value:e,className:"mt-6",children:r.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4",children:n.sections.map(s=>r.jsxs(Ye,{className:"cursor-pointer hover:shadow-md transition-all hover:border-primary/50 group",onClick:()=>t(s.path),children:[r.jsxs(Gt,{className:"pb-3",children:[r.jsx("div",{className:`w-10 h-10 rounded-lg flex items-center justify-center ${s.color} mb-2 group-hover:scale-110 transition-transform`,children:r.jsx(s.icon,{className:"h-5 w-5"})}),r.jsx(Zt,{className:"text-base",children:s.title})]}),r.jsx(tt,{className:"pt-0",children:r.jsx(Mn,{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:$t("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:$t("[&_tr]:border-b",t),...e}));qs.displayName="TableHeader";const Vs=I.forwardRef(({className:t,...e},n)=>r.jsx("tbody",{ref:n,className:$t("[&_tr:last-child]:border-0",t),...e}));Vs.displayName="TableBody";const eyt=I.forwardRef(({className:t,...e},n)=>r.jsx("tfoot",{ref:n,className:$t("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",t),...e}));eyt.displayName="TableFooter";const Ar=I.forwardRef(({className:t,...e},n)=>r.jsx("tr",{ref:n,className:$t("border-b transition-colors data-[state=selected]:bg-muted hover:bg-muted/50",t),...e}));Ar.displayName="TableRow";const It=I.forwardRef(({className:t,...e},n)=>r.jsx("th",{ref:n,className:$t("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",t),...e}));It.displayName="TableHead";const Nt=I.forwardRef(({className:t,...e},n)=>r.jsx("td",{ref:n,className:$t("p-4 align-middle [&:has([role=checkbox])]:pr-0",t),...e}));Nt.displayName="TableCell";const tyt=I.forwardRef(({className:t,...e},n)=>r.jsx("caption",{ref:n,className:$t("mt-4 text-sm text-muted-foreground",t),...e}));tyt.displayName="TableCaption";const ryt=()=>{const{isAdmin:t}=Qr(),e=rs(),[n,s]=I.useState([]),[a,o]=I.useState(!0),[l,i]=I.useState(!1),[h,p]=I.useState(null);I.useEffect(()=>{if(!t){e("/dashboard");return}x()},[t]);const x=async()=>{try{const{data:N,error:A}=await J.from("app_tiles").select("*").order("name");if(A)throw A;s(N||[])}catch(N){console.error("Error loading apps:",N),ze.error("Failed to load apps")}finally{o(!1)}},y=async N=>{N.preventDefault();const A=new FormData(N.currentTarget),E={name:A.get("name"),description:A.get("description"),icon:A.get("icon"),app_id:A.get("app_id"),target_url:A.get("target_url"),required_tags:A.get("required_tags").split(",").map(T=>T.trim()).filter(Boolean)};try{if(h){const{error:T}=await J.from("app_tiles").update(E).eq("id",h.id);if(T)throw T;ze.success("App updated successfully")}else{const{error:T}=await J.from("app_tiles").insert([E]);if(T)throw T;ze.success("App created successfully")}i(!1),p(null),x()}catch(T){console.error("Error saving app:",T),ze.error("Failed to save app")}},b=async N=>{if(confirm("Are you sure you want to delete this app?"))try{const{error:A}=await J.from("app_tiles").delete().eq("id",N);if(A)throw A;ze.success("App deleted successfully"),x()}catch(A){console.error("Error deleting app:",A),ze.error("Failed to delete app")}},j=N=>{p(N),i(!0)},C=()=>{p(null),i(!0)};return a?r.jsx("div",{className:"flex items-center justify-center min-h-screen",children:"Loading..."}):r.jsxs("div",{className:"min-h-screen bg-background",children:[r.jsx("header",{className:"border-b bg-card",children:r.jsx("div",{className:"container mx-auto px-4 py-4",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsxs(ee,{variant:"ghost",size:"sm",onClick:()=>e("/dashboard"),children:[r.jsx(so,{className:"h-4 w-4 mr-2"}),"Back"]}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold",children:"Manage Apps"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Create and configure application tiles"})]})]}),r.jsxs(Fr,{open:l,onOpenChange:i,children:[r.jsx(zo,{asChild:!0,children:r.jsxs(ee,{onClick:C,children:[r.jsx(bn,{className:"mr-2 h-4 w-4"}),"Add App"]})}),r.jsxs(Rr,{className:"max-w-2xl",children:[r.jsxs(qr,{children:[r.jsx($r,{children:h?"Edit App":"Create New App"}),r.jsx(Xn,{children:"Configure the application tile settings"})]}),r.jsxs("form",{onSubmit:y,className:"space-y-4",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"name",children:"App Name"}),r.jsx(dt,{id:"name",name:"name",defaultValue:h==null?void 0:h.name,required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"app_id",children:"App ID"}),r.jsx(dt,{id:"app_id",name:"app_id",defaultValue:h==null?void 0:h.app_id,placeholder:"agent_connect",required:!0})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"description",children:"Description"}),r.jsx(ps,{id:"description",name:"description",defaultValue:h==null?void 0:h.description})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"icon",children:"Icon (emoji)"}),r.jsx(dt,{id:"icon",name:"icon",defaultValue:h==null?void 0:h.icon,placeholder:"🚀",required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"target_url",children:"Target URL"}),r.jsx(dt,{id:"target_url",name:"target_url",type:"url",defaultValue:h==null?void 0:h.target_url,required:!0})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"required_tags",children:"Required Tags (comma-separated)"}),r.jsx(dt,{id:"required_tags",name:"required_tags",defaultValue:h==null?void 0:h.required_tags.join(", "),placeholder:"levelup-member, agent-connect"})]}),r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(ee,{type:"button",variant:"outline",onClick:()=>i(!1),children:"Cancel"}),r.jsx(ee,{type:"submit",children:h?"Update":"Create"})]})]})]})]})]})})}),r.jsx("div",{className:"container mx-auto px-4 py-8",children:r.jsxs(Ye,{children:[r.jsxs(Gt,{children:[r.jsx(Zt,{children:"Application Tiles"}),r.jsx(Mn,{children:"Manage the apps that appear on the member dashboard"})]}),r.jsx(tt,{children:n.length===0?r.jsxs("div",{className:"text-center py-12",children:[r.jsx("p",{className:"text-muted-foreground mb-4",children:"No apps configured yet"}),r.jsxs(ee,{onClick:C,children:[r.jsx(bn,{className:"mr-2 h-4 w-4"}),"Create First App"]})]}):r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Ar,{children:[r.jsx(It,{children:"Icon"}),r.jsx(It,{children:"Name"}),r.jsx(It,{children:"App ID"}),r.jsx(It,{children:"Target URL"}),r.jsx(It,{children:"Tags"}),r.jsx(It,{className:"text-right",children:"Actions"})]})}),r.jsx(Vs,{children:n.map(N=>r.jsxs(Ar,{children:[r.jsx(Nt,{className:"text-2xl",children:N.icon}),r.jsx(Nt,{className:"font-medium",children:N.name}),r.jsx(Nt,{className:"font-mono text-sm",children:N.app_id}),r.jsx(Nt,{className:"text-sm text-muted-foreground max-w-xs truncate",children:N.target_url}),r.jsx(Nt,{children:r.jsx("div",{className:"flex flex-wrap gap-1",children:N.required_tags.map(A=>r.jsx("span",{className:"text-xs bg-secondary text-secondary-foreground px-2 py-1 rounded",children:A},A))})}),r.jsx(Nt,{className:"text-right",children:r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(ee,{size:"sm",variant:"ghost",onClick:()=>j(N),children:r.jsx(_i,{className:"h-4 w-4"})}),r.jsx(ee,{size:"sm",variant:"ghost",onClick:()=>b(N.id),children:r.jsx(Vn,{className:"h-4 w-4"})})]})})]},N.id))})]})})]})})]})};function Gu({title:t,description:e,children:n}){return r.jsxs("div",{className:"space-y-4",children:[r.jsx(co,{to:"/admin",children:r.jsxs(ee,{variant:"ghost",size:"sm",className:"gap-2 text-muted-foreground hover:text-foreground",children:[r.jsx(so,{className:"h-4 w-4"}),"Back to Admin Dashboard"]})}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold",children:t}),e&&r.jsx("p",{className:"text-muted-foreground",children:e})]}),n]})]})}const Tke=({expiresAt:t,className:e})=>{const n=new Date().getTime(),s=new Date(t).getTime(),a=Math.ceil((s-n)/(1e3*60*60*24));return a<=0?r.jsxs(Ot,{variant:"destructive",className:$t("gap-1",e),children:[r.jsx(Vh,{className:"h-3 w-3"}),"Trial Expired"]}):a<=1?r.jsxs(Ot,{variant:"destructive",className:$t("gap-1",e),children:[r.jsx(Ya,{className:"h-3 w-3"}),"Trial: <1 day left"]}):a<=3?r.jsxs(Ot,{className:$t("gap-1 bg-amber-500 hover:bg-amber-600",e),children:[r.jsx(Ya,{className:"h-3 w-3"}),"Trial: ",a," days left"]}):r.jsxs(Ot,{variant:"secondary",className:$t("gap-1",e),children:[r.jsx(Ya,{className:"h-3 w-3"}),"Trial: ",a," days left"]})},iRe=({open:t,onOpenChange:e,brokerages:n,fixedBrokerageId:s,onSuccess:a})=>{const{toast:o}=fi(),l=I.useRef(null),[i,h]=I.useState([]),[p,x]=I.useState(""),[y,b]=I.useState(!1),[j,C]=I.useState("upload"),[N,A]=I.useState(null),E=()=>{h([]),x(""),C("upload"),A(null),l.current&&(l.current.value="")},T=()=>{E(),e(!1)},L=Z=>{const G=Z.split(` `).map(ne=>ne.trim()).filter(ne=>ne);if(G.length===0)return[];const te=G[0].toLowerCase(),le=te.includes("first")||te.includes("last")||te.includes("email")||te.includes("name")||te.includes("phone")||te.includes("sms")||te.includes("consent")?G.slice(1):G,ye=[];for(const ne of le){const ae=(ne.includes(" ")?ne.split(" "):ne.split(",")).map(he=>he.trim().replace(/^["']|["']$/g,""));if(ae.length>=2){let he="",ue="",_e="",Ae="",Ce;if(ae.length===2){const Le=ae[0].split(" ");he=Le[0]||"",ue=Le.slice(1).join(" ")||"",_e=ae[1]}else if(ae.length===3)he=ae[0],ue=ae[1],_e=ae[2];else if(ae.length===4)he=ae[0],ue=ae[1],_e=ae[2],Ae=ae[3];else if(ae.length>=5){he=ae[0],ue=ae[1],_e=ae[2],Ae=ae[3];const Le=ae[4].toLowerCase();Ce=Le==="true"||Le==="yes"||Le==="1"||Le==="y"}const me=/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(_e);ye.push({firstName:he.trim(),lastName:ue.trim(),email:_e.trim().toLowerCase(),phone:Ae.trim()||void 0,smsConsent:Ce,isValid:me&&he.trim().length>0,error:me?he.trim()?void 0:"Missing name":"Invalid email"})}}return ye},z=Z=>{var ie;const G=(ie=Z.target.files)==null?void 0:ie[0];if(!G)return;const te=new FileReader;te.onload=le=>{var ge;const ye=(ge=le.target)==null?void 0:ge.result,ne=L(ye);if(ne.length===0){o({title:"No data found",description:"The CSV file appears to be empty or in an unsupported format.",variant:"destructive"});return}h(ne),C("preview")},te.readAsText(G)},F=async()=>{const Z=i.filter(te=>te.isValid);if(Z.length===0){o({title:"No valid users",description:"There are no valid users to import.",variant:"destructive"});return}const G=s||p||null;b(!0);try{const{data:{session:te}}=await J.auth.getSession(),ie=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/bulk-create-users",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${te==null?void 0:te.access_token}`},body:JSON.stringify({users:Z.map(ye=>({firstName:ye.firstName,lastName:ye.lastName,email:ye.email,phone:ye.phone,smsConsent:ye.smsConsent})),brokerageId:G})}),le=await ie.json();if(!ie.ok)throw new Error(le.error||"Failed to import users");A(le),C("result"),le.created>0&&a(),o({title:"Import Complete",description:`${le.created} user(s) created successfully.${le.failed>0?` ${le.failed} failed.`:""}`})}catch(te){console.error("Import error:",te),o({title:"Import Failed",description:te.message||"Failed to import users",variant:"destructive"})}finally{b(!1)}},q=i.filter(Z=>Z.isValid).length,H=i.filter(Z=>!Z.isValid).length;return r.jsx(Fr,{open:t,onOpenChange:T,children:r.jsxs(Rr,{className:"max-w-2xl max-h-[85vh] overflow-hidden flex flex-col",children:[r.jsxs(qr,{children:[r.jsxs($r,{className:"flex items-center gap-2",children:[r.jsx(p1,{className:"h-5 w-5"}),"Import Agents from CSV"]}),r.jsx(Xn,{children:"Upload a CSV file with agent information. Each row should contain First Name, Last Name, and Email."})]}),j==="upload"&&r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{className:"border-2 border-dashed rounded-lg p-8 text-center",children:[r.jsx("input",{type:"file",accept:".csv,.txt",ref:l,onChange:z,className:"hidden"}),r.jsx(uo,{className:"h-10 w-10 mx-auto text-muted-foreground mb-4"}),r.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"Click to upload or drag and drop a CSV file"}),r.jsx(ee,{onClick:()=>{var Z;return(Z=l.current)==null?void 0:Z.click()},children:"Select CSV File"})]}),r.jsxs("div",{className:"bg-muted/50 rounded-lg p-4 text-sm",children:[r.jsx("p",{className:"font-medium mb-2",children:"Expected CSV Format:"}),r.jsxs("code",{className:"text-xs block bg-background p-2 rounded",children:["First Name, Last Name, Email, Phone, SMS Consent",r.jsx("br",{}),"John, Doe, john@example.com, 555-123-4567, yes",r.jsx("br",{}),"Jane, Smith, jane@example.com, 555-987-6543, true"]}),r.jsx("p",{className:"text-muted-foreground mt-2 text-xs",children:"Phone and SMS Consent columns are optional. SMS Consent accepts: yes/no, true/false, 1/0, y/n."})]})]}),j==="preview"&&r.jsxs("div",{className:"flex-1 overflow-hidden flex flex-col space-y-4",children:[!s&&n&&n.length>0&&r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Assign to Brokerage (optional)"}),r.jsxs(gn,{value:p||"none",onValueChange:Z=>x(Z==="none"?"":Z),children:[r.jsx(fn,{children:r.jsx(xn,{placeholder:"Select a brokerage..."})}),r.jsxs(pn,{children:[r.jsx(Vt,{value:"none",children:"No brokerage"}),n.map(Z=>r.jsx(Vt,{value:Z.id,children:Z.name},Z.id))]})]})]}),r.jsxs("div",{className:"flex items-center gap-4 text-sm",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Xi,{className:"h-4 w-4 text-green-500"}),r.jsxs("span",{children:[q," valid"]})]}),H>0&&r.jsxs("div",{className:"flex items-center gap-2 text-destructive",children:[r.jsx(Il,{className:"h-4 w-4"}),r.jsxs("span",{children:[H," invalid"]})]})]}),r.jsxs("div",{className:"flex-1 overflow-auto border rounded-lg",children:[r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Ar,{className:"bg-muted/30",children:[r.jsx(It,{children:"First Name"}),r.jsx(It,{children:"Last Name"}),r.jsx(It,{children:"Email"}),r.jsx(It,{children:"Phone"}),r.jsx(It,{children:"SMS"}),r.jsx(It,{children:"Status"})]})}),r.jsx(Vs,{children:i.slice(0,100).map((Z,G)=>r.jsxs(Ar,{children:[r.jsx(Nt,{children:Z.firstName}),r.jsx(Nt,{children:Z.lastName}),r.jsx(Nt,{children:Z.email}),r.jsx(Nt,{className:"text-muted-foreground",children:Z.phone||"-"}),r.jsx(Nt,{className:"text-muted-foreground",children:Z.smsConsent===!0?"✓":Z.smsConsent===!1?"✗":"-"}),r.jsx(Nt,{children:Z.isValid?r.jsx(Ot,{variant:"default",className:"bg-green-500/10 text-green-600",children:"Valid"}):r.jsx(Ot,{variant:"destructive",children:Z.error||"Invalid"})})]},G))})]}),i.length>100&&r.jsxs("p",{className:"text-sm text-muted-foreground text-center py-2",children:["Showing first 100 of ",i.length," users"]})]})]}),j==="result"&&N&&r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{className:"text-center",children:[r.jsx(Xi,{className:"h-12 w-12 mx-auto text-green-500 mb-4"}),r.jsx("h3",{className:"text-lg font-semibold",children:"Import Complete"}),r.jsxs("p",{className:"text-muted-foreground mt-2",children:[N.created," agent(s) created and invited"]}),N.failed>0&&r.jsxs("p",{className:"text-destructive mt-1",children:[N.failed," failed to create"]})]}),N.errors.length>0&&r.jsxs("div",{className:"bg-destructive/10 border border-destructive/20 rounded-lg p-4 max-h-40 overflow-auto",children:[r.jsx("p",{className:"font-medium text-destructive text-sm mb-2",children:"Errors:"}),r.jsxs("ul",{className:"text-sm text-muted-foreground space-y-1",children:[N.errors.slice(0,10).map((Z,G)=>r.jsxs("li",{children:["• ",Z]},G)),N.errors.length>10&&r.jsxs("li",{children:["...and ",N.errors.length-10," more"]})]})]})]}),r.jsxs(ea,{children:[j==="upload"&&r.jsx(ee,{variant:"outline",onClick:T,children:"Cancel"}),j==="preview"&&r.jsxs(r.Fragment,{children:[r.jsx(ee,{variant:"outline",onClick:E,children:"Back"}),r.jsx(ee,{onClick:F,disabled:y||q===0,children:y?r.jsxs(r.Fragment,{children:[r.jsx(en,{className:"mr-2 h-4 w-4 animate-spin"}),"Importing..."]}):`Import ${q} Agent${q!==1?"s":""}`})]}),j==="result"&&r.jsx(ee,{onClick:T,children:"Done"})]})]})})},nyt=[{type:"custom",title:"Great job!",message:"Keep up the amazing work!",icon:vs},{type:"custom",title:"You're on fire!",message:"Your dedication is inspiring!",icon:Zi},{type:"custom",title:"Congratulations!",message:"You earned this celebration!",icon:Ac}];function oRe({open:t,onOpenChange:e,userId:n,userName:s}){const[a,o]=I.useState("custom"),[l,i]=I.useState(""),[h,p]=I.useState(""),x=Cat(),y=j=>{o(j.type),i(j.title),p(j.message)},b=async j=>{if(j.preventDefault(),!l.trim()){ma({title:"Title required",description:"Please enter a celebration title",variant:"destructive"});return}try{await x.mutateAsync({user_id:n,celebration_type:a,title:l.trim(),message:h.trim()||void 0}),ma({title:"Celebration sent! 🎉",description:`${s} will see confetti on their next visit!`}),e(!1),i(""),p(""),o("custom")}catch{ma({title:"Error",description:"Failed to send celebration",variant:"destructive"})}};return r.jsx(Fr,{open:t,onOpenChange:e,children:r.jsxs(Rr,{className:"sm:max-w-md",children:[r.jsxs(qr,{children:[r.jsxs($r,{className:"flex items-center gap-2",children:[r.jsx(Ac,{className:"h-5 w-5 text-primary"}),"Send Celebration to ",s]}),r.jsx(Xn,{children:"They'll see confetti and this message next time they log in!"})]}),r.jsxs("div",{className:"mb-4",children:[r.jsx(He,{className:"text-sm text-muted-foreground mb-2 block",children:"Quick presets:"}),r.jsx("div",{className:"flex gap-2 flex-wrap",children:nyt.map((j,C)=>r.jsxs(ee,{variant:"outline",size:"sm",onClick:()=>y(j),className:"text-xs",children:[r.jsx(j.icon,{className:"h-3 w-3 mr-1"}),j.title]},C))})]}),r.jsxs("form",{onSubmit:b,className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx(He,{htmlFor:"type",children:"Celebration Type"}),r.jsxs(gn,{value:a,onValueChange:j=>o(j),children:[r.jsx(fn,{children:r.jsx(xn,{})}),r.jsxs(pn,{children:[r.jsx(Vt,{value:"custom",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(vs,{className:"h-4 w-4"})," Custom"]})}),r.jsx(Vt,{value:"points_earned",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Zi,{className:"h-4 w-4"})," Points Earned"]})}),r.jsx(Vt,{value:"listing_created",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(pa,{className:"h-4 w-4"})," Listing Created"]})}),r.jsx(Vt,{value:"deal_closed",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(hd,{className:"h-4 w-4"})," Deal Closed"]})})]})]})]}),r.jsxs("div",{children:[r.jsx(He,{htmlFor:"title",children:"Title *"}),r.jsx(dt,{id:"title",value:l,onChange:j=>i(j.target.value),placeholder:"e.g., Congratulations!",maxLength:100})]}),r.jsxs("div",{children:[r.jsx(He,{htmlFor:"message",children:"Message (optional)"}),r.jsx(ps,{id:"message",value:h,onChange:j=>p(j.target.value),placeholder:"Add a personal message...",rows:3,maxLength:500})]}),r.jsxs("div",{className:"flex gap-2 justify-end",children:[r.jsx(ee,{type:"button",variant:"outline",onClick:()=>e(!1),children:"Cancel"}),r.jsxs(ee,{type:"submit",disabled:x.isPending,children:[r.jsx(Ac,{className:"h-4 w-4 mr-2"}),x.isPending?"Sending...":"Send Celebration"]})]})]})]})})}const rce={points_earned:{label:"Points Earned",icon:Zi,color:"bg-yellow-500"},listing_created:{label:"Listing Created",icon:pa,color:"bg-blue-500"},deal_closed:{label:"Deal Closed",icon:hd,color:"bg-green-500"},custom:{label:"Custom",icon:Ms,color:"bg-purple-500"}};function syt(){const[t,e]=I.useState(""),[n,s]=I.useState("all"),[a,o]=I.useState("all"),{data:l=[],isLoading:i}=Yt({queryKey:["admin-celebrations"],queryFn:async()=>{const{data:x,error:y}=await J.from("celebration_queue").select("*").order("created_at",{ascending:!1}).limit(500);if(y)throw y;const b=[...new Set([...x.map(N=>N.user_id),...x.map(N=>N.created_by).filter(Boolean)])],{data:j}=await J.from("profiles").select("id, name, email").in("id",b),C=new Map((j==null?void 0:j.map(N=>[N.id,N]))||[]);return x.map(N=>{var A,E,T;return{...N,user_name:((A=C.get(N.user_id))==null?void 0:A.name)||"Unknown",user_email:((E=C.get(N.user_id))==null?void 0:E.email)||"",creator_name:N.created_by?((T=C.get(N.created_by))==null?void 0:T.name)||"System":"Auto-triggered"}})}}),h=l.filter(x=>{var C,N;const y=((C=x.user_name)==null?void 0:C.toLowerCase().includes(t.toLowerCase()))||((N=x.user_email)==null?void 0:N.toLowerCase().includes(t.toLowerCase()))||x.title.toLowerCase().includes(t.toLowerCase()),b=n==="all"||x.celebration_type===n,j=a==="all"||a==="seen"&&x.seen_at||a==="unseen"&&!x.seen_at;return y&&b&&j}),p={total:l.length,seen:l.filter(x=>x.seen_at).length,unseen:l.filter(x=>!x.seen_at).length,byType:Object.keys(rce).reduce((x,y)=>(x[y]=l.filter(b=>b.celebration_type===y).length,x),{})};return i?r.jsx("div",{className:"flex items-center justify-center py-12",children:r.jsx(en,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"grid gap-4 md:grid-cols-4",children:[r.jsxs(Ye,{children:[r.jsx(Gt,{className:"pb-2",children:r.jsx(Zt,{className:"text-sm font-medium",children:"Total Celebrations"})}),r.jsx(tt,{children:r.jsx("div",{className:"text-2xl font-bold",children:p.total})})]}),r.jsxs(Ye,{children:[r.jsx(Gt,{className:"pb-2",children:r.jsx(Zt,{className:"text-sm font-medium text-green-600",children:"Seen"})}),r.jsx(tt,{children:r.jsx("div",{className:"text-2xl font-bold text-green-600",children:p.seen})})]}),r.jsxs(Ye,{children:[r.jsx(Gt,{className:"pb-2",children:r.jsx(Zt,{className:"text-sm font-medium text-orange-600",children:"Pending"})}),r.jsx(tt,{children:r.jsx("div",{className:"text-2xl font-bold text-orange-600",children:p.unseen})})]}),r.jsxs(Ye,{children:[r.jsx(Gt,{className:"pb-2",children:r.jsx(Zt,{className:"text-sm font-medium text-purple-600",children:"Custom Sent"})}),r.jsx(tt,{children:r.jsx("div",{className:"text-2xl font-bold text-purple-600",children:p.byType.custom||0})})]})]}),r.jsxs(Ye,{children:[r.jsxs(Gt,{children:[r.jsxs(Zt,{className:"flex items-center gap-2",children:[r.jsx(Ac,{className:"h-5 w-5"}),"Celebration History"]}),r.jsx(Mn,{children:"View all celebrations awarded to agents"})]}),r.jsxs(tt,{className:"space-y-4",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[r.jsxs("div",{className:"relative flex-1",children:[r.jsx(wa,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(dt,{placeholder:"Search by agent name, email, or title...",value:t,onChange:x=>e(x.target.value),className:"pl-9"})]}),r.jsxs(gn,{value:n,onValueChange:s,children:[r.jsx(fn,{className:"w-[180px]",children:r.jsx(xn,{placeholder:"Filter by type"})}),r.jsxs(pn,{children:[r.jsx(Vt,{value:"all",children:"All Types"}),Object.entries(rce).map(([x,y])=>r.jsx(Vt,{value:x,children:y.label},x))]})]}),r.jsxs(gn,{value:a,onValueChange:o,children:[r.jsx(fn,{className:"w-[140px]",children:r.jsx(xn,{placeholder:"Status"})}),r.jsxs(pn,{children:[r.jsx(Vt,{value:"all",children:"All Status"}),r.jsx(Vt,{value:"seen",children:"Seen"}),r.jsx(Vt,{value:"unseen",children:"Pending"})]})]})]}),r.jsx("div",{className:"rounded-md border",children:r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Ar,{children:[r.jsx(It,{children:"Type"}),r.jsx(It,{children:"Agent"}),r.jsx(It,{children:"Title"}),r.jsx(It,{children:"Points"}),r.jsx(It,{children:"Created By"}),r.jsx(It,{children:"Created"}),r.jsx(It,{children:"Status"})]})}),r.jsx(Vs,{children:h.length===0?r.jsx(Ar,{children:r.jsx(Nt,{colSpan:7,className:"text-center py-8 text-muted-foreground",children:"No celebrations found"})}):h.map(x=>{const y=rce[x.celebration_type],b=y.icon;return r.jsxs(Ar,{children:[r.jsx(Nt,{children:r.jsxs(Ot,{variant:"outline",className:"gap-1",children:[r.jsx(b,{className:"h-3 w-3"}),y.label]})}),r.jsx(Nt,{children:r.jsxs("div",{children:[r.jsx("div",{className:"font-medium",children:x.user_name}),r.jsx("div",{className:"text-xs text-muted-foreground",children:x.user_email})]})}),r.jsx(Nt,{children:r.jsxs("div",{children:[r.jsx("div",{className:"font-medium",children:x.title}),x.message&&r.jsx("div",{className:"text-xs text-muted-foreground truncate max-w-[200px]",children:x.message})]})}),r.jsx(Nt,{children:x.points_amount?r.jsxs(Ot,{variant:"secondary",children:["+",x.points_amount]}):r.jsx("span",{className:"text-muted-foreground",children:"-"})}),r.jsx(Nt,{children:r.jsx("span",{className:"text-sm text-muted-foreground",children:x.creator_name})}),r.jsx(Nt,{children:r.jsx("span",{className:"text-sm text-muted-foreground",children:yn(new Date(x.created_at),"MMM d, yyyy h:mm a")})}),r.jsx(Nt,{children:x.seen_at?r.jsx(Ot,{variant:"outline",className:"bg-green-50 text-green-700 border-green-200",children:"Seen"}):r.jsx(Ot,{variant:"outline",className:"bg-orange-50 text-orange-700 border-orange-200",children:"Pending"})})]},x.id)})})]})}),h.length>0&&r.jsxs("p",{className:"text-sm text-muted-foreground text-right",children:["Showing ",h.length," of ",l.length," celebrations"]})]})]})]})}const ayt=()=>{const t=rs(),{user:e,isAdmin:n}=Qr(),{startImpersonation:s,isLoading:a}=BIe(),{toast:o}=fi(),[l,i]=I.useState([]),[h,p]=I.useState([]),[x,y]=I.useState([]),[b,j]=I.useState({}),[C,N]=I.useState(!0),[A,E]=I.useState({}),[T,L]=I.useState(!1),[z,F]=I.useState({email:"",name:"",password:"",brokerage_id:"",role:"user",phone:"",trial_days:""}),[q,H]=I.useState(!1),[Z,G]=I.useState(""),[te,ie]=I.useState(1),[le,ye]=I.useState(50),[ne,ge]=I.useState("all"),[ae,he]=I.useState("all"),[ue,_e]=I.useState("all"),[Ae,Ce]=I.useState("all"),[be,me]=I.useState(!1),[Le,Ne]=I.useState(!1),[Be,Ee]=I.useState(null),[Ue,Re]=I.useState(null),[je,et]=I.useState(!1),[Te,Ze]=I.useState({name:"",email:"",brokerage_id:"",phone:""}),[pe,yt]=I.useState(null),[rt,at]=I.useState(!1),[Me,ft]=I.useState(""),[qe,Oe]=I.useState(!1),[Qe,nt]=I.useState(!1),[gt,mt]=I.useState(null),[Mt,wt]=I.useState(""),[Qt,Cr]=I.useState(!1),[cn,jn]=I.useState(!1),[Xr,Pn]=I.useState(null),[js,hr]=I.useState(!1),[xs,ka]=I.useState(!1),[xa,zi]=I.useState(null),[Bi,tl]=I.useState(""),[xo,Hs]=I.useState(!1),[Xa,Ns]=I.useState({email:"",name:"",password:"",phone:""}),[Fa,Oa]=I.useState(!1),[Do,ir]=I.useState(!1),[fo,pl]=I.useState(""),[To,ss]=I.useState(!1),[yo,pu]=I.useState(!1),[$l,mu]=I.useState(""),[Je,xe]=I.useState(new Set),[Ie,Ge]=I.useState(!1),[kt,vt]=I.useState(!1),[At,zt]=I.useState(null),[Pt,Ut]=I.useState(!1),[fr,ar]=I.useState(null),[Wr,wn]=I.useState([]),[Ur,Jn]=I.useState([]),[es,Zn]=I.useState(!1),[Ls,Li]=I.useState({});I.useEffect(()=>{!e||!n||(ua(),vo())},[e,n]);const po=async()=>{try{const{data:jt,error:gr}=await J.from("brokerage_manager_assignments").select("user_id, brokerage_id");if(gr)throw gr;const Pr={};for(const Hn of jt??[])Pr[Hn.brokerage_id]||(Pr[Hn.brokerage_id]=[]),Pr[Hn.brokerage_id].push(Hn.user_id);j(Pr)}catch(jt){console.error("Error loading brokerage manager assignments:",jt)}},ua=async()=>{try{N(!0);const{data:jt,error:gr}=await J.functions.invoke("get-user-details");if(gr)throw gr;const Pr=jt.users||[];i(Pr),y(jt.brokerages||[]),await po();const Hn=Pr.filter(ts=>ts.roles.includes("assistant"));if(Hn.length>0){const ts=Hn.map(ra=>ra.id),{data:Na}=await J.from("agent_assistant_assignments").select("agent_id, assistant_id").in("assistant_id",ts);if(Na&&Na.length>0){const ra=[...new Set(Na.map(fp=>fp.agent_id))],{data:pi}=await J.from("profiles").select("id, name, email").in("id",ra),gl={};for(const fp of Na){const pp=pi==null?void 0:pi.find(Vd=>Vd.id===fp.agent_id);pp&&(gl[fp.assistant_id]={agent_name:pp.name||"",agent_email:pp.email||""})}Li(gl)}}}catch(jt){console.error("Error loading members:",jt),o({title:"Error",description:"Failed to load members",variant:"destructive"})}finally{N(!1)}},vo=async()=>{try{const{data:jt,error:gr}=await J.from("app_tiles").select("id, name, icon, app_id, required_tags").order("name");if(gr)throw gr;p(jt||[])}catch(jt){console.error("Error loading apps:",jt),o({title:"Error",description:"Failed to load apps",variant:"destructive"})}},ji=async jt=>{if(!Te.name.trim()||!Te.email.trim()){o({title:"Error",description:"Name and email are required",variant:"destructive"});return}if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(Te.email)){o({title:"Error",description:"Please enter a valid email address",variant:"destructive"});return}try{const{error:Pr}=await J.from("profiles").update({name:Te.name.trim(),email:Te.email.trim(),brokerage_id:Te.brokerage_id||null,phone:Te.phone.trim()||null}).eq("id",jt);if(Pr)throw Pr;o({title:"Success",description:"Member details updated successfully"}),Ee(null),ua()}catch(Pr){console.error("Error updating member:",Pr),o({title:"Error",description:Pr.message||"Failed to update member",variant:"destructive"})}},Ws=async jt=>{try{const{data:{session:gr}}=await J.auth.getSession(),Pr=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/resend-welcome-email",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${gr==null?void 0:gr.access_token}`},body:JSON.stringify({userId:jt})}),Hn=await Pr.json();if(!Pr.ok)throw new Error(Hn.error||"Failed to resend welcome email");o({title:"Success",description:"Welcome email sent successfully"})}catch(gr){console.error("Error resending welcome email:",gr),o({title:"Error",description:gr.message||"Failed to resend welcome email",variant:"destructive"})}},ki=async(jt,gr)=>{try{const{error:Pr}=await J.functions.invoke("send-password-reset",{body:{email:jt,redirectTo:window.location.origin}});if(Pr)throw Pr;o({title:"Password Reset Sent",description:`Password reset email sent to ${gr}`})}catch(Pr){console.error("Error sending password reset:",Pr),o({title:"Error",description:Pr.message||"Failed to send password reset email",variant:"destructive"})}},za=async(jt,gr)=>{if(confirm(`Are you sure you want to delete ${gr}? This action cannot be undone.`))try{const{data:{session:Pr}}=await J.auth.getSession(),Hn=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/delete-user",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${Pr==null?void 0:Pr.access_token}`},body:JSON.stringify({userId:jt})}),ts=await Hn.json();if(!Hn.ok)throw new Error(ts.error||"Failed to delete user");o({title:"Success",description:"User deleted successfully"}),ua()}catch(Pr){console.error("Error deleting user:",Pr),o({title:"Error",description:Pr.message||"Failed to delete user",variant:"destructive"})}},Ss=async()=>{if(!z.email||!z.name||!z.password){o({title:"Error",description:"Please fill in all fields",variant:"destructive"});return}if(z.role==="brokerage_manager"&&!z.brokerage_id){o({title:"Error",description:"Please select a brokerage for this manager",variant:"destructive"});return}L(!0);try{const{data:{session:jt}}=await J.auth.getSession(),gr=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/create-user",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${jt==null?void 0:jt.access_token}`},body:JSON.stringify(z)}),Pr=await gr.json();if(!gr.ok)throw new Error(Pr.error||"Failed to create user");if(z.role&&z.role!=="user"&&Pr.userId){const Hn=z.role==="brokerage_manager"?z.brokerage_id:void 0;await Ni(Pr.userId,z.role,"add",Hn)}o({title:"Success",description:`User ${z.email} created successfully`}),F({email:"",name:"",password:"",brokerage_id:"",role:"user",phone:"",trial_days:""}),H(!1),ua()}catch(jt){console.error("Error creating user:",jt),o({title:"Error",description:jt.message||"Failed to create user",variant:"destructive"})}finally{L(!1)}},Ni=async(jt,gr,Pr,Hn)=>{try{const{data:{session:ts}}=await J.auth.getSession(),Na={userId:jt,role:gr,action:Pr};if(gr==="brokerage_manager"){if(!Hn){o({title:"Error",description:"Please choose a brokerage for this manager assignment",variant:"destructive"});return}Na.brokerageId=Hn}const ra=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/manage-user-roles",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${ts==null?void 0:ts.access_token}`},body:JSON.stringify(Na)}),pi=await ra.json();if(!ra.ok)throw new Error(pi.error||"Failed to manage user role");o({title:"Success",description:`Role ${Pr==="add"?"added":"removed"} successfully`}),ua()}catch(ts){console.error("Error managing user role:",ts),o({title:"Error",description:ts.message||"Failed to manage user role",variant:"destructive"})}},ml=(jt,gr)=>gr.length===0?!0:gr.some(Pr=>jt.includes(Pr)),Sl=async(jt,gr,Pr)=>{const Hn=`${jt}-${gr.id}`;yt(Hn);try{if(Pr){const ts=l.find(ra=>ra.id===jt),Na=gr.required_tags.filter(ra=>ts==null?void 0:ts.tags.includes(ra));for(const ra of Na){const{error:pi}=await J.from("user_tags").delete().eq("user_id",jt).eq("tag",ra);if(pi)throw pi}o({title:"Access Removed",description:`Removed access to ${gr.name}`})}else if(gr.required_tags.length>0){const{error:ts}=await J.from("user_tags").insert({user_id:jt,tag:gr.required_tags[0]});if(ts)throw ts;o({title:"Access Granted",description:`Granted access to ${gr.name}`})}await ua()}catch(ts){console.error("Error toggling access:",ts),o({title:"Error",description:ts.message||"Failed to update access",variant:"destructive"})}finally{yt(null)}},Lc=async()=>{const jt=Me.trim();if(!jt){o({title:"Error",description:"Brokerage name is required",variant:"destructive"});return}if(jt.length>100){o({title:"Error",description:"Brokerage name must be less than 100 characters",variant:"destructive"});return}if(x.find(Pr=>Pr.name.toLowerCase()===jt.toLowerCase())){o({title:"Error",description:"A brokerage with this name already exists",variant:"destructive"});return}Oe(!0);try{const{error:Pr}=await J.from("brokerages").insert({name:jt});if(Pr)throw Pr;o({title:"Success",description:`Brokerage "${jt}" created successfully`}),ft(""),at(!1),ua()}catch(Pr){console.error("Error creating brokerage:",Pr),o({title:"Error",description:Pr.message||"Failed to create brokerage",variant:"destructive"})}finally{Oe(!1)}},mf=jt=>{mt(jt),wt(jt.name),nt(!0)},Bo=()=>{mt(null),wt(""),nt(!1)},_d=async()=>{if(!gt)return;const jt=Mt.trim();if(!jt){o({title:"Error",description:"Brokerage name is required",variant:"destructive"});return}if(jt.length>100){o({title:"Error",description:"Brokerage name must be less than 100 characters",variant:"destructive"});return}Cr(!0);try{const{error:gr}=await J.from("brokerages").update({name:jt}).eq("id",gt.id);if(gr)throw gr;o({title:"Success",description:"Brokerage updated successfully"}),Bo(),ua()}catch(gr){console.error("Error updating brokerage:",gr),o({title:"Error",description:gr.message||"Failed to update brokerage",variant:"destructive"})}finally{Cr(!1)}},rc=async(jt,gr)=>{var Pr;if(!gr||typeof gr!="string"){o({title:"Error",description:"Please select a brokerage first",variant:"destructive"});return}try{const Hn={userId:jt,role:"brokerage_manager",action:"add",brokerageId:gr};console.debug("[assignManagerToBrokerage] payload",Hn);const{data:{session:ts}}=await J.auth.getSession(),Na=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/manage-user-roles",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${ts==null?void 0:ts.access_token}`},body:JSON.stringify(Hn)}),ra=await Na.json();if(!Na.ok&&!((Pr=ra.error)!=null&&Pr.includes("duplicate")))throw new Error(ra.error||"Failed to add role");o({title:"Success",description:"Manager assigned to brokerage"}),await ua()}catch(Hn){console.error("Error assigning manager:",Hn),o({title:"Error",description:Hn.message||"Failed to assign manager",variant:"destructive"})}},Ku=jt=>{Pn(jt),jn(!0)},$o=async()=>{if(Xr){hr(!0);try{const jt=l.filter(Hn=>Hn.brokerage_id===Xr.id),{data:{session:gr}}=await J.auth.getSession();for(const Hn of jt){const ts=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/delete-user",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${gr==null?void 0:gr.access_token}`},body:JSON.stringify({userId:Hn.id})});if(!ts.ok){const Na=await ts.json();console.error(`Failed to delete user ${Hn.email}:`,Na.error)}}const{error:Pr}=await J.from("brokerages").delete().eq("id",Xr.id);if(Pr)throw Pr;o({title:"Success",description:`Brokerage "${Xr.name}" and ${jt.length} member(s) deleted`}),jn(!1),Pn(null),ua()}catch(jt){console.error("Error deleting brokerage:",jt),o({title:"Error",description:jt.message||"Failed to delete brokerage",variant:"destructive"})}finally{hr(!1)}}},dp=jt=>{zi(jt),tl(""),ka(!0)},Tm=()=>{zi(null),tl(""),ka(!1)},yy=async jt=>{try{const{error:gr}=await J.from("profiles").update({brokerage_id:null}).eq("id",jt);if(gr)throw gr;o({title:"Success",description:"User removed from brokerage"}),ua()}catch(gr){console.error("Error removing user from brokerage:",gr),o({title:"Error",description:gr.message||"Failed to remove user",variant:"destructive"})}},vy=async(jt,gr)=>{try{const{error:Pr}=await J.from("profiles").update({brokerage_id:gr}).eq("id",jt);if(Pr)throw Pr;o({title:"Success",description:"User added to brokerage"}),ua()}catch(Pr){console.error("Error adding user to brokerage:",Pr),o({title:"Error",description:Pr.message||"Failed to add user",variant:"destructive"})}},_y=async()=>{if(!xa||!Xa.email||!Xa.name||!Xa.password){o({title:"Error",description:"Please fill in all fields",variant:"destructive"});return}Oa(!0);try{const{data:{session:jt}}=await J.auth.getSession(),gr=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/create-user",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${jt==null?void 0:jt.access_token}`},body:JSON.stringify({...Xa,brokerage_id:xa.id,role:"user"})}),Pr=await gr.json();if(!gr.ok)throw new Error(Pr.error||"Failed to create agent");o({title:"Success",description:`Agent ${Xa.email} created successfully`}),Ns({email:"",name:"",password:"",phone:""}),Hs(!1),ua()}catch(jt){console.error("Error creating agent:",jt),o({title:"Error",description:jt.message||"Failed to create agent",variant:"destructive"})}finally{Oa(!1)}},Sh=jt=>l.filter(gr=>gr.brokerage_id===jt),gu=jt=>{const gr=Sh(jt);if(!Bi)return gr;const Pr=Bi.toLowerCase();return gr.filter(Hn=>Hn.name.toLowerCase().includes(Pr)||Hn.email.toLowerCase().includes(Pr))},Oc=jt=>l.filter(gr=>gr.brokerage_id!==jt),qd=l.filter(jt=>{var gr;if(Z){const Pr=Z.toLowerCase();if(!(jt.name.toLowerCase().includes(Pr)||jt.email.toLowerCase().includes(Pr)||((gr=jt.brokerage_name)==null?void 0:gr.toLowerCase().includes(Pr))))return!1}return!(ne==="claimed"&&!jt.claimed||ne==="unclaimed"&&jt.claimed||ae!=="all"&&!jt.roles.includes(ae)||ue==="trial"&&!jt.is_trial||ue==="non-trial"&&jt.is_trial||Ae==="none"&&jt.brokerage_id||Ae!=="all"&&Ae!=="none"&&jt.brokerage_id!==Ae)}),Dc=qd.length,_o=Math.ceil(Dc/le),bd=(te-1)*le,Zu=bd+le,xc=qd.slice(bd,Zu),by=jt=>{G(jt),ie(1)},up=jt=>{ye(jt),ie(1)},hp=(jt,gr)=>{jt(gr),ie(1)},wy=async(jt,gr)=>{me(!0);try{const Pr=l.find(ra=>ra.id===jt);if(!Pr)return;const Hn=Pr.trial_expires_at?new Date(Pr.trial_expires_at):new Date,ts=new Date(Hn.getTime()+gr*24*60*60*1e3),{error:Na}=await J.from("profiles").update({trial_expires_at:ts.toISOString()}).eq("id",jt);if(Na)throw Na;o({title:"Trial Extended",description:`Trial extended by ${gr} days`}),ua()}catch(Pr){console.error("Error extending trial:",Pr),o({title:"Error",description:Pr.message||"Failed to extend trial",variant:"destructive"})}finally{me(!1)}},qg=async jt=>{Ne(!0);try{const{error:gr}=await J.from("profiles").update({is_trial:!1,trial_expires_at:null,trial_started_at:null,trial_claimed_at:null}).eq("id",jt);if(gr)throw gr;o({title:"Account Converted",description:"User has been converted to a full account"}),ua(),Ch()}catch(gr){console.error("Error converting trial:",gr),o({title:"Error",description:gr.message||"Failed to convert account",variant:"destructive"})}finally{Ne(!1)}},Xc=async jt=>{Zn(!0);try{const{data:gr}=await J.from("agent_assistant_assignments").select("id, assistant_id, permissions").eq("agent_id",jt);if(gr&&gr.length>0){const Hn=gr.map(Na=>Na.assistant_id),{data:ts}=await J.from("profiles").select("id, name, email").in("id",Hn);wn(gr.map(Na=>{const ra=ts==null?void 0:ts.find(pi=>pi.id===Na.assistant_id);return{id:Na.id,assistant_id:Na.assistant_id,assistant_name:(ra==null?void 0:ra.name)||"Unknown",assistant_email:(ra==null?void 0:ra.email)||"",permissions:Na.permissions||{}}}))}else wn([]);const{data:Pr}=await J.from("agent_assistant_assignments").select("id, agent_id, permissions").eq("assistant_id",jt);if(Pr&&Pr.length>0){const Hn=Pr.map(Na=>Na.agent_id),{data:ts}=await J.from("profiles").select("id, name, email").in("id",Hn);Jn(Pr.map(Na=>{const ra=ts==null?void 0:ts.find(pi=>pi.id===Na.agent_id);return{id:Na.id,agent_id:Na.agent_id,agent_name:(ra==null?void 0:ra.name)||"Unknown",agent_email:(ra==null?void 0:ra.email)||"",permissions:Na.permissions||{}}}))}else Jn([])}catch(gr){console.error("Error loading assistant data:",gr)}finally{Zn(!1)}},Vg=jt=>{Re(jt),Ze({name:jt.name,email:jt.email,brokerage_id:jt.brokerage_id||"",phone:jt.phone||""}),et(!0),Xc(jt.id)},Ch=()=>{Re(null),et(!1),Ze({name:"",email:"",brokerage_id:"",phone:""})},Mh=async()=>{Ue&&(await ji(Ue.id),Ch())},C3=jt=>{xe(gr=>{const Pr=new Set(gr);return Pr.has(jt)?Pr.delete(jt):Pr.add(jt),Pr})},mk=()=>{if(Je.size===xc.length&&xc.every(jt=>Je.has(jt.id))){const jt=new Set(Je);xc.forEach(gr=>jt.delete(gr.id)),xe(jt)}else{const jt=new Set(Je);xc.forEach(gr=>jt.add(gr.id)),xe(jt)}},gf=()=>{xe(new Set)},Ys=async()=>{if(Je.size===0)return;Ge(!0);let jt=0,gr=0;try{const{data:{session:Pr}}=await J.auth.getSession();for(const Hn of Je)try{(await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/resend-welcome-email",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${Pr==null?void 0:Pr.access_token}`},body:JSON.stringify({userId:Hn})})).ok?jt++:gr++}catch{gr++}o({title:"Bulk Email Complete",description:`Sent ${jt} emails${gr>0?`, ${gr} failed`:""}`}),gf()}catch(Pr){o({title:"Error",description:Pr.message||"Failed to send emails",variant:"destructive"})}finally{Ge(!1)}},jy=async()=>{if(Je.size===0)return;Ge(!0);let jt=0,gr=0;try{const{data:{session:Pr}}=await J.auth.getSession();for(const Hn of Je)try{(await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/send-password-reset",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${Pr==null?void 0:Pr.access_token}`},body:JSON.stringify({userId:Hn})})).ok?jt++:gr++}catch{gr++}o({title:"Bulk Password Reset Complete",description:`Sent ${jt} reset emails${gr>0?`, ${gr} failed`:""}`}),gf()}catch(Pr){o({title:"Error",description:Pr.message||"Failed to send password reset emails",variant:"destructive"})}finally{Ge(!1)}},mv=async()=>{if(Je.size===0)return;const jt=l.filter(ts=>Je.has(ts.id)).map(ts=>ts.name).slice(0,5).join(", "),gr=Je.size>5?` and ${Je.size-5} more`:"";if(!confirm(`Are you sure you want to delete ${Je.size} users (${jt}${gr})? This action cannot be undone.`))return;Ge(!0);let Pr=0,Hn=0;try{const{data:{session:ts}}=await J.auth.getSession();for(const Na of Je)try{(await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/delete-user",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${ts==null?void 0:ts.access_token}`},body:JSON.stringify({userId:Na})})).ok?Pr++:Hn++}catch{Hn++}o({title:"Bulk Delete Complete",description:`Deleted ${Pr} users${Hn>0?`, ${Hn} failed`:""}`}),gf(),ua()}catch(ts){o({title:"Error",description:ts.message||"Failed to delete users",variant:"destructive"})}finally{Ge(!1)}},gk=async()=>{vt(!0);try{const{data:{session:jt}}=await J.auth.getSession(),gr=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/ghl-phone-sync",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${jt==null?void 0:jt.access_token}`}});if(!gr.ok){const Hn=await gr.json();throw new Error(Hn.error||"Failed to sync phones")}const Pr=await gr.json();o({title:"Phone Sync Complete",description:`Pulled ${Pr.summary.pulledFromGHL} from GHL, pushed ${Pr.summary.pushedToGHL} to GHL, ${Pr.summary.alreadySynced} already synced`}),ua()}catch(jt){o({title:"Error",description:jt.message||"Failed to sync phones with GHL",variant:"destructive"})}finally{vt(!1)}},xk=async(jt,gr)=>{zt(jt);try{const{data:{session:Pr}}=await J.auth.getSession(),{data:Hn}=await J.from("profiles").select("phone").eq("id",jt).single(),ts=(Hn==null?void 0:Hn.phone)||"",Na=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/ghl-tag-sync",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${Pr==null?void 0:Pr.access_token}`},body:JSON.stringify({email:gr,action:"update",phone:ts||void 0})});if(!Na.ok){const pi=await Na.json();throw new Error(pi.error||"Failed to sync with GHL")}const ra=await fetch(`https://services.leadconnectorhq.com/contacts/lookup?locationId=&email=${encodeURIComponent(gr)}`,{method:"GET",headers:{"Content-Type":"application/json"}});o({title:"Phone Synced",description:ts?`Phone ${ts} synced to GHL`:"Sync attempted - run bulk sync to pull phone from GHL"}),ua()}catch(Pr){o({title:"Error",description:Pr.message||"Failed to sync phone",variant:"destructive"})}finally{zt(null)}},Th=async jt=>{await s(jt)},Hg=()=>{if(Je.size===0){o({title:"No members selected",description:"Please select members to export",variant:"destructive"});return}const jt=l.filter(pi=>Je.has(pi.id)),gr=["Name","Email","Phone","Brokerage","Roles","Status","Created At"],Pr=jt.map(pi=>[pi.name,pi.email,pi.phone||"",pi.brokerage_name||"",pi.roles.join("; "),pi.claimed?"Claimed":"Unclaimed",new Date(pi.created_at).toLocaleDateString()]),Hn=[gr.join(","),...Pr.map(pi=>pi.map(gl=>`"${(gl||"").replace(/"/g,'""')}"`).join(","))].join(` `),ts=new Blob([Hn],{type:"text/csv"}),Na=URL.createObjectURL(ts),ra=document.createElement("a");ra.href=Na,ra.download=`members-export-${new Date().toISOString().split("T")[0]}.csv`,ra.click(),URL.revokeObjectURL(Na),o({title:"Export complete",description:`Exported ${jt.length} member(s)`})};return C?r.jsx(Lr,{title:"Members",children:r.jsx("div",{className:"flex items-center justify-center py-20",children:r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})})}):r.jsxs(Lr,{title:"Members",children:[r.jsxs("div",{className:"space-y-6",children:[r.jsx(Gu,{title:"Member Management",description:"Manage users, roles, and permissions"}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("div",{}),r.jsxs("div",{className:"flex flex-wrap gap-2",children:[r.jsxs(ee,{size:"sm",variant:"outline",onClick:gk,disabled:kt,children:[kt?r.jsx(en,{className:"mr-2 h-4 w-4 animate-spin"}):r.jsx(bi,{className:"mr-2 h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline",children:kt?"Syncing...":"Sync Phones with GHL"}),r.jsx("span",{className:"sm:hidden",children:kt?"Syncing...":"Sync GHL"})]}),r.jsxs(ee,{size:"sm",variant:"outline",onClick:()=>ir(!0),children:[r.jsx(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(Fr,{open:q,onOpenChange:H,children:[r.jsx(zo,{asChild:!0,children:r.jsxs(ee,{size:"sm",children:[r.jsx(nf,{className:"mr-2 h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline",children:"Add Member"}),r.jsx("span",{className:"sm:hidden",children:"Add"})]})}),r.jsxs(Rr,{children:[r.jsxs(qr,{children:[r.jsx($r,{children:"Create New User"}),r.jsx(Xn,{children:"Add a new user to the system. They'll be able to sign in immediately."})]}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"name",children:"Name"}),r.jsx(dt,{id:"name",placeholder:"John Doe",value:z.name,onChange:jt=>F({...z,name:jt.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"email",children:"Email"}),r.jsx(dt,{id:"email",type:"email",placeholder:"john@example.com",value:z.email,onChange:jt=>F({...z,email:jt.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"password",children:"Password"}),r.jsx(dt,{id:"password",type:"password",placeholder:"Min 6 characters",value:z.password,onChange:jt=>F({...z,password:jt.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"phone",children:"Phone (optional)"}),r.jsx(dt,{id:"phone",type:"tel",placeholder:"555-123-4567",value:z.phone,onChange:jt=>F({...z,phone:jt.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs(He,{htmlFor:"brokerage",children:["Brokerage",z.role==="brokerage_manager"?" (required)":""]}),r.jsxs(gn,{value:z.brokerage_id||"none",onValueChange:jt=>F({...z,brokerage_id:jt==="none"?"":jt}),children:[r.jsx(fn,{id:"brokerage",children:r.jsx(xn,{placeholder:z.role==="brokerage_manager"?"Select brokerage":"Select brokerage (optional)"})}),r.jsxs(pn,{children:[r.jsx(Vt,{value:"none",children:"None"}),x.map(jt=>r.jsx(Vt,{value:jt.id,children:jt.name},jt.id))]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"role",children:"Role"}),r.jsxs(gn,{value:z.role,onValueChange:jt=>F({...z,role:jt}),children:[r.jsx(fn,{id:"role",children:r.jsx(xn,{placeholder:"Select role"})}),r.jsxs(pn,{children:[r.jsx(Vt,{value:"user",children:"User"}),r.jsx(Vt,{value:"moderator",children:"Moderator"}),r.jsx(Vt,{value:"brokerage_manager",children:"Brokerage Manager"}),r.jsx(Vt,{value:"admin",children:"Admin"})]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"trial_days",children:"Trial Period (optional)"}),r.jsxs(gn,{value:z.trial_days||"none",onValueChange:jt=>F({...z,trial_days:jt==="none"?"":jt}),children:[r.jsx(fn,{id:"trial_days",children:r.jsx(xn,{placeholder:"No trial (full access)"})}),r.jsxs(pn,{children:[r.jsx(Vt,{value:"none",children:"No trial (full access)"}),r.jsx(Vt,{value:"7",children:"7-day trial"}),r.jsx(Vt,{value:"30",children:"30-day trial"}),r.jsx(Vt,{value:"60",children:"60-day trial"}),r.jsx(Vt,{value:"90",children:"90-day trial"}),r.jsx(Vt,{value:"365",children:"1-year trial"})]})]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Trial accounts don't require a credit card. Access expires after the trial period."})]})]}),r.jsxs(ea,{children:[r.jsx(ee,{variant:"outline",onClick:()=>H(!1),children:"Cancel"}),r.jsx(ee,{onClick:Ss,disabled:T,children:T?"Creating...":"Create User"})]})]})]})]})]}),r.jsxs(Ii,{defaultValue:"members",className:"space-y-6",children:[r.jsxs(wi,{children:[r.jsx(ln,{value:"members",children:"Members"}),r.jsx(ln,{value:"brokerages",children:"Brokerages"}),r.jsx(ln,{value:"access",children:"Access Matrix"}),r.jsx(ln,{value:"celebrations",children:"Celebrations"})]}),r.jsxs(An,{value:"members",className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[r.jsxs("div",{className:"relative flex-1 min-w-[200px] max-w-md",children:[r.jsx(wa,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(dt,{placeholder:"Search members...",value:Z,onChange:jt=>by(jt.target.value),className:"pl-10 h-9"})]}),r.jsxs(gn,{value:ne,onValueChange:jt=>hp(ge,jt),children:[r.jsx(fn,{className:"w-[130px] h-9",children:r.jsx(xn,{})}),r.jsxs(pn,{children:[r.jsx(Vt,{value:"all",children:"All Status"}),r.jsx(Vt,{value:"claimed",children:"Active"}),r.jsx(Vt,{value:"unclaimed",children:"Pending"})]})]}),r.jsxs(gn,{value:ae,onValueChange:jt=>hp(he,jt),children:[r.jsx(fn,{className:"w-[130px] h-9",children:r.jsx(xn,{})}),r.jsxs(pn,{children:[r.jsx(Vt,{value:"all",children:"All Roles"}),r.jsx(Vt,{value:"admin",children:"Admin"}),r.jsx(Vt,{value:"brokerage_manager",children:"Manager"}),r.jsx(Vt,{value:"assistant",children:"Assistant"}),r.jsx(Vt,{value:"user",children:"User"})]})]}),r.jsxs(gn,{value:ue,onValueChange:jt=>hp(_e,jt),children:[r.jsx(fn,{className:"w-[130px] h-9",children:r.jsx(xn,{})}),r.jsxs(pn,{children:[r.jsx(Vt,{value:"all",children:"All Users"}),r.jsx(Vt,{value:"trial",children:"Trial Only"}),r.jsx(Vt,{value:"non-trial",children:"Full Only"})]})]}),r.jsxs(gn,{value:Ae,onValueChange:jt=>hp(Ce,jt),children:[r.jsx(fn,{className:"w-[150px] h-9",children:r.jsx(xn,{})}),r.jsxs(pn,{children:[r.jsx(Vt,{value:"all",children:"All Brokerages"}),r.jsx(Vt,{value:"none",children:"No Brokerage"}),x.map(jt=>r.jsx(Vt,{value:jt.id,children:jt.name},jt.id))]})]}),(Z||ne!=="all"||ae!=="all"||ue!=="all"||Ae!=="all")&&r.jsxs(ee,{variant:"ghost",size:"sm",className:"h-9",onClick:()=>{G(""),ge("all"),he("all"),_e("all"),Ce("all"),ie(1)},children:[r.jsx(_s,{className:"h-4 w-4 mr-1"}),"Clear"]}),r.jsxs("div",{className:"flex items-center gap-2 ml-auto",children:[r.jsxs("span",{className:"text-sm text-muted-foreground",children:["Showing ",bd+1,"-",Math.min(Zu,Dc)," of ",Dc," members"]}),r.jsxs(gn,{value:le.toString(),onValueChange:jt=>up(Number(jt)),children:[r.jsx(fn,{className:"h-9 w-[110px]",children:r.jsx(xn,{})}),r.jsxs(pn,{children:[r.jsx(Vt,{value:"50",children:"50 / page"}),r.jsx(Vt,{value:"100",children:"100 / page"}),r.jsx(Vt,{value:"250",children:"250 / page"})]})]})]})]}),Je.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(x0,{className:"h-4 w-4 text-primary"}),r.jsxs("span",{className:"text-sm font-medium",children:[Je.size," selected"]})]}),r.jsx("div",{className:"flex-1"}),r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsxs(ee,{size:"sm",variant:"outline",onClick:Ys,disabled:Ie,children:[Ie?r.jsx(en,{className:"h-4 w-4 animate-spin mr-1"}):r.jsx(da,{className:"h-4 w-4 mr-1"}),r.jsx("span",{className:"hidden sm:inline",children:"Resend Invite"}),r.jsx("span",{className:"sm:hidden",children:"Invite"})]}),r.jsxs(ee,{size:"sm",variant:"outline",onClick:jy,disabled:Ie,children:[Ie?r.jsx(en,{className:"h-4 w-4 animate-spin mr-1"}):r.jsx(ef,{className:"h-4 w-4 mr-1"}),r.jsx("span",{className:"hidden sm:inline",children:"Password Reset"}),r.jsx("span",{className:"sm:hidden",children:"Reset"})]}),r.jsxs(ee,{size:"sm",variant:"outline",onClick:Hg,children:[r.jsx(no,{className:"h-4 w-4 mr-1"}),r.jsx("span",{className:"hidden sm:inline",children:"Export"}),r.jsx("span",{className:"sm:hidden",children:"CSV"})]}),r.jsxs(ee,{size:"sm",variant:"destructive",onClick:mv,disabled:Ie,children:[Ie?r.jsx(en,{className:"h-4 w-4 animate-spin mr-1"}):r.jsx(Vn,{className:"h-4 w-4 mr-1"}),r.jsx("span",{className:"hidden sm:inline",children:"Delete"}),r.jsx("span",{className:"sm:hidden",children:"Del"})]}),r.jsx(ee,{size:"sm",variant:"ghost",onClick:gf,disabled:Ie,children:r.jsx(_s,{className:"h-4 w-4"})})]})]}),r.jsx("div",{className:"border rounded-lg bg-card overflow-hidden",children:r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Ar,{className:"bg-muted/30 hover:bg-muted/30",children:[r.jsx(It,{className:"w-[50px]",children:r.jsx(Dl,{checked:xc.length>0&&xc.every(jt=>Je.has(jt.id)),onCheckedChange:mk,"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:xc.length===0?r.jsx(Ar,{children:r.jsx(Nt,{colSpan:7,className:"text-center py-12 text-muted-foreground",children:"No members found"})}):xc.map(jt=>r.jsxs(Ar,{className:`hover:bg-muted/30 ${Je.has(jt.id)?"bg-primary/5":""}`,children:[r.jsx(Nt,{children:r.jsx(Dl,{checked:Je.has(jt.id),onCheckedChange:()=>C3(jt.id),"aria-label":`Select ${jt.name}`})}),r.jsx(Nt,{children:r.jsxs("div",{children:[r.jsx("button",{onClick:()=>Vg(jt),className:"text-primary hover:underline font-medium text-left",children:jt.name}),r.jsx("div",{className:"text-xs text-muted-foreground",children:jt.email})]})}),r.jsx(Nt,{className:"text-muted-foreground",children:jt.brokerage_name||"—"}),r.jsx(Nt,{children:r.jsxs("div",{className:"flex flex-col gap-1",children:[r.jsx(Ot,{variant:jt.claimed?"default":"secondary",className:jt.claimed?"bg-primary text-primary-foreground w-fit":"w-fit",children:jt.claimed?"Active":"Pending"}),jt.is_trial&&jt.trial_expires_at&&r.jsx(Tke,{expiresAt:jt.trial_expires_at,className:"w-fit"})]})}),r.jsx(Nt,{children:r.jsxs("div",{className:"flex items-center gap-1",children:[jt.roles.length>0?r.jsx("span",{className:"text-sm capitalize",children:jt.roles[0]}):r.jsx("span",{className:"text-muted-foreground",children:"—"}),jt.roles.includes("assistant")&&r.jsxs(Ot,{variant:"outline",className:"text-[10px] ml-1",children:["Asst",Ls[jt.id]?` → ${Ls[jt.id].agent_name||Ls[jt.id].agent_email}`:""]})]})}),r.jsx(Nt,{className:"text-muted-foreground",children:jt.last_sign_in_at?new Date(jt.last_sign_in_at).toLocaleDateString():"—"}),r.jsx(Nt,{children:r.jsxs("div",{className:"flex gap-1 justify-end",children:[r.jsx(ee,{size:"icon",variant:"ghost",className:"h-8 w-8 text-yellow-500 hover:text-yellow-600 hover:bg-yellow-50",onClick:()=>{ar(jt),Ut(!0)},title:"Send celebration",children:r.jsx(Ac,{className:"h-4 w-4"})}),r.jsx(ee,{size:"icon",variant:"ghost",className:"h-8 w-8",onClick:()=>Vg(jt),title:"Edit member",children:r.jsx(_i,{className:"h-4 w-4"})}),r.jsx(ee,{size:"icon",variant:"ghost",className:"h-8 w-8",onClick:()=>xk(jt.id,jt.email),disabled:At===jt.id,title:"Sync phone with GHL",children:At===jt.id?r.jsx(en,{className:"h-4 w-4 animate-spin"}):r.jsx(bi,{className:"h-4 w-4"})}),r.jsx(ee,{size:"icon",variant:"ghost",className:"h-8 w-8",onClick:()=>Ws(jt.id),title:"Resend welcome email",children:r.jsx(da,{className:"h-4 w-4"})}),r.jsx(ee,{size:"icon",variant:"ghost",className:"h-8 w-8",onClick:()=>ki(jt.email,jt.name),title:"Send password reset",children:r.jsx(mj,{className:"h-4 w-4"})}),r.jsx(ee,{size:"icon",variant:"ghost",className:"h-8 w-8 text-blue-600 hover:text-blue-700 hover:bg-blue-50",onClick:()=>Th(jt.id),disabled:a||jt.id===(e==null?void 0:e.id),title:jt.id===(e==null?void 0:e.id)?"Cannot impersonate yourself":`Login as ${jt.name}`,children:a?r.jsx(en,{className:"h-4 w-4 animate-spin"}):r.jsx(cS,{className:"h-4 w-4"})}),r.jsx(ee,{size:"icon",variant:"ghost",className:"h-8 w-8 text-destructive hover:text-destructive hover:bg-destructive/10",onClick:()=>za(jt.id,jt.name),title:"Delete user",children:r.jsx(Vn,{className:"h-4 w-4"})})]})})]},jt.id))})]})}),_o>1&&r.jsxs("div",{className:"flex items-center justify-between px-2 py-4",children:[r.jsxs("div",{className:"text-sm text-muted-foreground",children:["Page ",te," of ",_o]}),r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(ee,{variant:"outline",size:"sm",onClick:()=>ie(1),disabled:te===1,children:"First"}),r.jsx(ee,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>ie(jt=>Math.max(1,jt-1)),disabled:te===1,children:r.jsx(Tc,{className:"h-4 w-4"})}),r.jsx("div",{className:"flex items-center gap-1",children:Array.from({length:Math.min(5,_o)},(jt,gr)=>{let Pr;return _o<=5||te<=3?Pr=gr+1:te>=_o-2?Pr=_o-4+gr:Pr=te-2+gr,r.jsx(ee,{variant:te===Pr?"default":"outline",size:"sm",className:"h-8 w-8 p-0",onClick:()=>ie(Pr),children:Pr},Pr)})}),r.jsx(ee,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>ie(jt=>Math.min(_o,jt+1)),disabled:te===_o,children:r.jsx(Vi,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"outline",size:"sm",onClick:()=>ie(_o),disabled:te===_o,children:"Last"})]})]})]}),r.jsx(Fr,{open:je,onOpenChange:et,children:r.jsxs(Rr,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsxs(qr,{children:[r.jsx($r,{children:"Edit Member"}),r.jsx(Xn,{children:"Update member details, roles, and app access"})]}),Ue&&r.jsxs("div",{className:"space-y-6 py-4",children:[r.jsxs("div",{className:"space-y-4",children:[r.jsx("h3",{className:"text-sm font-semibold",children:"Basic Information"}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"edit-name",children:"Name"}),r.jsx(dt,{id:"edit-name",value:Te.name,onChange:jt=>Ze({...Te,name:jt.target.value}),maxLength:100})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"edit-email",children:"Email"}),r.jsx(dt,{id:"edit-email",type:"email",value:Te.email,onChange:jt=>Ze({...Te,email:jt.target.value}),maxLength:255})]})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"edit-phone",children:"Phone"}),r.jsx(dt,{id:"edit-phone",type:"tel",value:Te.phone,onChange:jt=>Ze({...Te,phone:jt.target.value}),placeholder:"555-123-4567"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"edit-brokerage",children:"Brokerage"}),r.jsxs(gn,{value:Te.brokerage_id||"none",onValueChange:jt=>Ze({...Te,brokerage_id:jt==="none"?"":jt}),children:[r.jsx(fn,{id:"edit-brokerage",children:r.jsx(xn,{placeholder:"Select brokerage"})}),r.jsxs(pn,{children:[r.jsx(Vt,{value:"none",children:"None"}),x.map(jt=>r.jsx(Vt,{value:jt.id,children:jt.name},jt.id))]})]})]})]})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsx("h3",{className:"text-sm font-semibold",children:"Roles"}),r.jsxs("div",{className:"flex flex-wrap gap-2",children:[Ue.roles.map(jt=>r.jsxs(Ot,{variant:"default",className:"gap-1",children:[r.jsx(rf,{className:"h-3 w-3"}),jt,jt==="brokerage_manager"?r.jsx("span",{className:"text-xs text-muted-foreground ml-1",children:"(manage in Brokerages tab)"}):r.jsx("button",{onClick:()=>Ni(Ue.id,jt,"remove"),className:"ml-1 rounded-full hover:bg-destructive/20",title:"Remove role",children:r.jsx(_s,{className:"h-3 w-3"})})]},jt)),Ue.roles.length===0&&r.jsx("span",{className:"text-sm text-muted-foreground",children:"No roles assigned"})]}),r.jsxs(gn,{onValueChange:jt=>Ni(Ue.id,jt,"add"),children:[r.jsx(fn,{className:"w-[200px]",children:r.jsx(xn,{placeholder:"Add role..."})}),r.jsxs(pn,{children:[!Ue.roles.includes("admin")&&r.jsx(Vt,{value:"admin",children:"Admin"}),!Ue.roles.includes("user")&&r.jsx(Vt,{value:"user",children:"User"})]})]}),!Ue.roles.includes("brokerage_manager")&&r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"To add as brokerage manager, use Brokerages tab → Manage"})]}),(Wr.length>0||Ur.length>0||Ue.roles.includes("assistant"))&&r.jsxs("div",{className:"space-y-3",children:[r.jsxs("h3",{className:"text-sm font-semibold flex items-center gap-2",children:[r.jsx(Bn,{className:"h-4 w-4"}),"Assistant Relationships"]}),es?r.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[r.jsx(en,{className:"h-4 w-4 animate-spin"}),"Loading..."]}):r.jsxs("div",{className:"space-y-3",children:[Wr.length>0&&r.jsxs("div",{className:"space-y-2",children:[r.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Has assistants:"}),Wr.map(jt=>r.jsxs("div",{className:"p-3 rounded-lg border bg-muted/30 space-y-1",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{className:"text-sm font-medium",children:jt.assistant_name}),r.jsx(Ot,{variant:"outline",className:"text-xs",children:"Assistant"})]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:jt.assistant_email}),r.jsx("div",{className:"flex flex-wrap gap-1 mt-1",children:Object.entries(jt.permissions).filter(([,gr])=>gr).map(([gr])=>r.jsx(Ot,{variant:"secondary",className:"text-[10px] capitalize",children:gr},gr))})]},jt.id))]}),Ur.length>0&&r.jsxs("div",{className:"space-y-2",children:[r.jsx("p",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Assists agents:"}),Ur.map(jt=>r.jsxs("div",{className:"p-3 rounded-lg border bg-muted/30 space-y-1",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{className:"text-sm font-medium",children:jt.agent_name}),r.jsx(Ot,{variant:"outline",className:"text-xs",children:"Agent"})]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:jt.agent_email}),r.jsx("div",{className:"flex flex-wrap gap-1 mt-1",children:Object.entries(jt.permissions).filter(([,gr])=>gr).map(([gr])=>r.jsx(Ot,{variant:"secondary",className:"text-[10px] capitalize",children:gr},gr))})]},jt.id))]})]})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsx("h3",{className:"text-sm font-semibold",children:"App Access"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Toggle which apps this member can access"}),r.jsx("div",{className:"grid gap-3",children:h.map(jt=>{const gr=ml(Ue.tags,jt.required_tags),Pr=`${Ue.id}-${jt.id}`,Hn=pe===Pr,ts=jt.required_tags.length===0;return r.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg border bg-muted/30",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("span",{className:"text-xl",children:jt.icon}),r.jsxs("div",{children:[r.jsx("div",{className:"font-medium text-sm",children:jt.name}),ts&&r.jsx("span",{className:"text-xs text-muted-foreground",children:"Available to all members"})]})]}),r.jsx("div",{className:"flex items-center gap-2",children:Hn?r.jsx(en,{className:"h-4 w-4 animate-spin text-muted-foreground"}):ts?r.jsx(Ot,{variant:"secondary",className:"text-xs",children:"Always On"}):r.jsx(Ps,{checked:gr,onCheckedChange:()=>Sl(Ue.id,jt,gr)})})]},jt.id)})})]}),Ue.is_trial&&r.jsxs("div",{className:"space-y-3 pt-4 border-t",children:[r.jsxs("h3",{className:"text-sm font-semibold flex items-center gap-2",children:[r.jsx(Ya,{className:"h-4 w-4"}),"Trial Status"]}),r.jsxs("div",{className:"p-4 rounded-lg border bg-amber-50 dark:bg-amber-950/20 border-amber-200 dark:border-amber-800",children:[r.jsxs("div",{className:"flex items-center justify-between mb-3",children:[r.jsx("div",{children:Ue.trial_expires_at&&r.jsx(Tke,{expiresAt:Ue.trial_expires_at})}),Ue.trial_expires_at&&r.jsxs("span",{className:"text-sm text-muted-foreground",children:["Expires: ",new Date(Ue.trial_expires_at).toLocaleDateString()]})]}),r.jsxs("div",{className:"flex flex-wrap gap-2",children:[r.jsxs(ee,{size:"sm",variant:"outline",onClick:()=>wy(Ue.id,7),disabled:be,children:[r.jsx(cj,{className:"h-4 w-4 mr-1"}),"+7 Days"]}),r.jsxs(ee,{size:"sm",variant:"outline",onClick:()=>wy(Ue.id,14),disabled:be,children:[r.jsx(cj,{className:"h-4 w-4 mr-1"}),"+14 Days"]}),r.jsxs(ee,{size:"sm",variant:"outline",onClick:()=>wy(Ue.id,30),disabled:be,children:[r.jsx(cj,{className:"h-4 w-4 mr-1"}),"+30 Days"]}),r.jsxs(ee,{size:"sm",variant:"default",onClick:()=>qg(Ue.id),disabled:Le,className:"bg-green-600 hover:bg-green-700",children:[r.jsx(wj,{className:"h-4 w-4 mr-1"}),"Convert to Full Account"]})]}),Ue.trial_started_at&&r.jsxs("div",{className:"mt-3 text-xs text-muted-foreground",children:["Trial started: ",new Date(Ue.trial_started_at).toLocaleDateString(),Ue.trial_claimed_at&&r.jsxs("span",{children:[" • Claimed: ",new Date(Ue.trial_claimed_at).toLocaleDateString()]})]})]})]}),r.jsxs("div",{className:"space-y-2 pt-4 border-t",children:[r.jsx("h3",{className:"text-sm font-semibold",children:"Account Information"}),r.jsxs("div",{className:"text-sm space-y-1 text-muted-foreground",children:[Ue.email_confirmed_at&&r.jsxs("div",{children:["Claimed: ",new Date(Ue.email_confirmed_at).toLocaleString()]}),Ue.last_sign_in_at&&r.jsxs("div",{children:["Last login: ",new Date(Ue.last_sign_in_at).toLocaleString()]}),r.jsxs("div",{children:["Created: ",new Date(Ue.created_at).toLocaleString()]})]})]})]}),r.jsxs(ea,{children:[r.jsx(ee,{variant:"outline",onClick:Ch,children:"Cancel"}),r.jsx(ee,{onClick:Mh,children:"Save Changes"})]})]})}),r.jsxs(An,{value:"access",children:[h.length===0?r.jsx(Ye,{children:r.jsxs(tt,{className:"py-12 text-center",children:[r.jsx("p",{className:"text-muted-foreground mb-4",children:"No apps configured yet"}),r.jsx(ee,{onClick:()=>t("/admin/apps"),children:"Configure Apps"})]})}):r.jsxs(Ye,{children:[r.jsxs(Gt,{children:[r.jsx(Zt,{children:"Member Access Matrix"}),r.jsx(Mn,{children:"Toggle switches to grant or revoke app access for each member"})]}),r.jsxs(tt,{children:[r.jsx("div",{className:"overflow-x-auto",children:r.jsxs("table",{className:"w-full",children:[r.jsx("thead",{children:r.jsxs("tr",{className:"border-b",children:[r.jsx("th",{className:"text-left p-4 font-semibold sticky left-0 bg-card z-10",children:"Member"}),h.map(jt=>r.jsx("th",{className:"text-center p-4 font-semibold min-w-[120px]",children:r.jsxs("div",{className:"flex flex-col items-center gap-1",children:[r.jsx("span",{className:"text-2xl",children:jt.icon}),r.jsx("span",{className:"text-sm",children:jt.name})]})},jt.id))]})}),r.jsxs("tbody",{children:[xc.map(jt=>r.jsxs("tr",{className:"border-b hover:bg-muted/50",children:[r.jsx("td",{className:"p-4 sticky left-0 bg-card z-10",children:r.jsxs("div",{children:[r.jsx("div",{className:"font-medium",children:jt.name}),r.jsx("div",{className:"text-sm text-muted-foreground",children:jt.email})]})}),h.map(gr=>{const Pr=ml(jt.tags,gr.required_tags),Hn=`${jt.id}-${gr.id}`,ts=pe===Hn;return r.jsx("td",{className:"p-4 text-center",children:r.jsx("div",{className:"flex items-center justify-center",children:ts?r.jsx(en,{className:"h-5 w-5 animate-spin text-muted-foreground"}):r.jsx(Ps,{checked:Pr,onCheckedChange:()=>Sl(jt.id,gr,Pr),disabled:gr.required_tags.length===0})})},gr.id)})]},jt.id)),xc.length===0&&r.jsx("tr",{children:r.jsx("td",{colSpan:h.length+1,className:"p-8 text-center text-muted-foreground",children:"No members found"})})]})]})}),_o>1&&r.jsxs("div",{className:"flex items-center justify-between px-2 py-4 border-t",children:[r.jsxs("div",{className:"text-sm text-muted-foreground",children:["Showing ",bd+1,"-",Math.min(Zu,Dc)," of ",Dc," • Page ",te," of ",_o]}),r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(ee,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>ie(jt=>Math.max(1,jt-1)),disabled:te===1,children:r.jsx(Tc,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>ie(jt=>Math.min(_o,jt+1)),disabled:te===_o,children:r.jsx(Vi,{className:"h-4 w-4"})})]})]})]})]}),r.jsx("div",{className:"mt-6",children:r.jsx(ee,{variant:"outline",onClick:()=>t("/admin/apps"),children:"Manage Apps"})})]}),r.jsxs(An,{value:"brokerages",className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between gap-4",children:[r.jsxs("div",{className:"relative flex-1 max-w-sm",children:[r.jsx(wa,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(dt,{placeholder:"Search brokerages...",value:fo,onChange:jt=>pl(jt.target.value),className:"pl-10"})]}),r.jsxs(Fr,{open:rt,onOpenChange:at,children:[r.jsx(zo,{asChild:!0,children:r.jsxs(ee,{size:"sm",children:[r.jsx(ai,{className:"mr-2 h-4 w-4"}),"Add Brokerage"]})}),r.jsxs(Rr,{children:[r.jsxs(qr,{children:[r.jsx($r,{children:"Create New Brokerage"}),r.jsx(Xn,{children:"Add a new brokerage to the system."})]}),r.jsx("div",{className:"space-y-4 py-4",children:r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"brokerage-name",children:"Brokerage Name"}),r.jsx(dt,{id:"brokerage-name",placeholder:"Enter brokerage name",value:Me,onChange:jt=>ft(jt.target.value),maxLength:100})]})}),r.jsxs(ea,{children:[r.jsx(ee,{variant:"outline",onClick:()=>at(!1),children:"Cancel"}),r.jsx(ee,{onClick:Lc,disabled:qe,children:qe?"Creating...":"Create Brokerage"})]})]})]})]}),r.jsx("div",{className:"border rounded-lg bg-card overflow-hidden",children:r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Ar,{className:"bg-muted/30 hover:bg-muted/30",children:[r.jsx(It,{className:"font-semibold",children:"Brokerage Name"}),r.jsx(It,{className:"font-semibold",children:"Manager(s)"}),r.jsx(It,{className:"font-semibold",children:"Agents"}),r.jsx(It,{className:"w-[150px]"})]})}),r.jsx(Vs,{children:(()=>{const jt=x.filter(gr=>gr.name.toLowerCase().includes(fo.toLowerCase()));return jt.length===0?r.jsx(Ar,{children:r.jsx(Nt,{colSpan:4,className:"text-center py-12 text-muted-foreground",children:fo?"No brokerages match your search":"No brokerages found"})}):jt.map(gr=>{const Pr=l.filter(ra=>ra.brokerage_id===gr.id),ts=(b[gr.id]??[]).map(ra=>l.find(pi=>pi.id===ra)).filter(Boolean),Na=Pr.length;return r.jsxs(Ar,{className:"hover:bg-muted/30",children:[r.jsx(Nt,{children:r.jsx("button",{onClick:()=>mf(gr),className:"text-primary hover:underline font-medium",children:gr.name})}),r.jsx(Nt,{children:ts.length>0?r.jsx("div",{className:"flex flex-wrap gap-1",children:ts.map(ra=>r.jsx(Ot,{variant:"secondary",className:"text-xs",children:ra.name},ra.id))}):r.jsx("span",{className:"text-muted-foreground text-sm",children:"No manager"})}),r.jsxs(Nt,{children:[Na," member",Na!==1?"s":""]}),r.jsx(Nt,{children:r.jsxs("div",{className:"flex gap-1 justify-end",children:[r.jsxs(ee,{size:"sm",variant:"outline",className:"h-8",onClick:()=>dp(gr),children:[r.jsx(Bn,{className:"h-4 w-4 mr-1"}),"Manage"]}),r.jsx(ee,{size:"icon",variant:"ghost",className:"h-8 w-8",onClick:()=>mf(gr),title:"Edit brokerage",children:r.jsx(_i,{className:"h-4 w-4"})}),r.jsx(ee,{size:"icon",variant:"ghost",className:"h-8 w-8 text-destructive hover:text-destructive hover:bg-destructive/10",onClick:()=>Ku(gr),title:"Delete brokerage",children:r.jsx(Vn,{className:"h-4 w-4"})})]})})]},gr.id)})})()})]})}),r.jsx(Fr,{open:Qe,onOpenChange:nt,children:r.jsxs(Rr,{className:"max-w-lg",children:[r.jsxs(qr,{children:[r.jsx($r,{children:"Edit Brokerage"}),r.jsx(Xn,{children:"Update brokerage details and manage managers"})]}),gt&&r.jsxs("div",{className:"space-y-6 py-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"edit-brokerage-name",children:"Brokerage Name"}),r.jsx(dt,{id:"edit-brokerage-name",value:Mt,onChange:jt=>wt(jt.target.value),maxLength:100})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsx(He,{children:"Managers"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Click × to remove manager access for this brokerage (keeps them as a member)"}),r.jsx("div",{className:"flex flex-wrap gap-2",children:(()=>{const gr=(b[gt.id]??[]).map(Pr=>l.find(Hn=>Hn.id===Pr)).filter(Boolean);return gr.length===0?r.jsx("span",{className:"text-sm text-muted-foreground",children:"No managers assigned"}):gr.map(Pr=>r.jsxs(Ot,{variant:"default",className:"gap-1",children:[r.jsx(rf,{className:"h-3 w-3"}),Pr.name,r.jsx("button",{onClick:()=>Ni(Pr.id,"brokerage_manager","remove",gt.id),className:"ml-1 rounded-full hover:bg-destructive/20",title:"Remove manager from this brokerage",children:r.jsx(_s,{className:"h-3 w-3"})})]},Pr.id))})()}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{className:"text-sm text-muted-foreground",children:"Assign manager from existing members:"}),r.jsxs(zu,{open:To,onOpenChange:ss,children:[r.jsx(Bu,{asChild:!0,children:r.jsxs(ee,{variant:"outline",role:"combobox","aria-expanded":To,className:"w-full justify-between",children:["Search for a member...",r.jsx(wa,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),r.jsx(uu,{className:"w-full p-0",align:"start",children:r.jsxs(q1,{children:[r.jsx(V1,{placeholder:"Search by name or email..."}),r.jsxs(H1,{className:"max-h-[200px]",children:[r.jsx(W1,{children:"No members found."}),r.jsx(G1,{children:(()=>{const jt=new Set(b[gt.id]??[]);return l.filter(gr=>!jt.has(gr.id)&&(n||gr.brokerage_id===gt.id)).map(gr=>r.jsxs(K1,{value:`${gr.name} ${gr.email}`,onSelect:()=>{rc(gr.id,gt.id),ss(!1)},children:[gr.name," (",gr.email,")"]},gr.id))})()})]})]})})]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Members in this Brokerage"}),r.jsx("div",{className:"max-h-32 overflow-y-auto border rounded p-2",children:l.filter(jt=>jt.brokerage_id===gt.id).length===0?r.jsx("span",{className:"text-sm text-muted-foreground",children:"No members"}):l.filter(jt=>jt.brokerage_id===gt.id).map(jt=>r.jsxs("div",{className:"text-sm py-1 flex items-center justify-between",children:[r.jsx("span",{children:jt.name}),jt.roles.includes("brokerage_manager")&&r.jsx(Ot,{variant:"outline",className:"text-xs",children:"Manager"})]},jt.id))})]})]}),r.jsxs(ea,{children:[r.jsx(ee,{variant:"outline",onClick:Bo,children:"Cancel"}),r.jsx(ee,{onClick:_d,disabled:Qt,children:Qt?"Saving...":"Save Changes"})]})]})}),r.jsx(Fr,{open:cn,onOpenChange:jn,children:r.jsxs(Rr,{children:[r.jsxs(qr,{children:[r.jsx($r,{className:"text-destructive",children:"Delete Brokerage"}),r.jsxs(Xn,{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(jt=>jt.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(ea,{children:[r.jsx(ee,{variant:"outline",onClick:()=>jn(!1),children:"Cancel"}),r.jsx(ee,{variant:"destructive",onClick:$o,disabled:js,children:js?"Deleting...":"Yes, Delete Brokerage"})]})]})}),r.jsx(Fr,{open:xs,onOpenChange:ka,children:r.jsxs(Rr,{className:"max-w-4xl max-h-[85vh] overflow-hidden flex flex-col",children:[r.jsxs(qr,{children:[r.jsxs($r,{className:"flex items-center gap-2",children:[r.jsx(ai,{className:"h-5 w-5"}),"Manage ",xa==null?void 0:xa.name]}),r.jsx(Xn,{children:"Add, remove, or manage users in this brokerage"})]}),xa&&r.jsxs("div",{className:"flex-1 overflow-hidden flex flex-col space-y-4",children:[r.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[r.jsxs("div",{className:"relative flex-1 min-w-[200px]",children:[r.jsx(wa,{className:"absolute left-3 top-1/2 transform -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(dt,{placeholder:"Search members...",value:Bi,onChange:jt=>tl(jt.target.value),className:"pl-10 h-9"})]}),r.jsxs(Fr,{open:xo,onOpenChange:Hs,children:[r.jsx(zo,{asChild:!0,children:r.jsxs(ee,{size:"sm",children:[r.jsx(nf,{className:"h-4 w-4 mr-1"}),"Add New Agent"]})}),r.jsxs(Rr,{children:[r.jsxs(qr,{children:[r.jsx($r,{children:"Add New Agent"}),r.jsxs(Xn,{children:["Create a new agent for ",xa.name]})]}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"agent-name",children:"Name"}),r.jsx(dt,{id:"agent-name",placeholder:"John Doe",value:Xa.name,onChange:jt=>Ns({...Xa,name:jt.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"agent-email",children:"Email"}),r.jsx(dt,{id:"agent-email",type:"email",placeholder:"john@example.com",value:Xa.email,onChange:jt=>Ns({...Xa,email:jt.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"agent-password",children:"Password"}),r.jsx(dt,{id:"agent-password",type:"password",placeholder:"Min 6 characters",value:Xa.password,onChange:jt=>Ns({...Xa,password:jt.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"agent-phone",children:"Phone (optional)"}),r.jsx(dt,{id:"agent-phone",type:"tel",placeholder:"555-123-4567",value:Xa.phone,onChange:jt=>Ns({...Xa,phone:jt.target.value})})]})]}),r.jsxs(ea,{children:[r.jsx(ee,{variant:"outline",onClick:()=>Hs(!1),children:"Cancel"}),r.jsx(ee,{onClick:_y,disabled:Fa,children:Fa?"Creating...":"Create Agent"})]})]})]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(He,{className:"text-sm text-muted-foreground whitespace-nowrap",children:"Add existing user:"}),r.jsxs(zu,{open:yo,onOpenChange:pu,children:[r.jsx(Bu,{asChild:!0,children:r.jsxs(ee,{variant:"outline",role:"combobox","aria-expanded":yo,className:"w-[300px] justify-between",children:["Select a user to add...",r.jsx(wa,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),r.jsx(uu,{className:"w-[300px] p-0",align:"start",children:r.jsxs(q1,{children:[r.jsx(V1,{placeholder:"Search users...",value:$l,onValueChange:mu}),r.jsxs(H1,{children:[r.jsx(W1,{children:"No users found."}),r.jsx(G1,{children:Oc(xa.id).filter(jt=>$l===""||jt.name.toLowerCase().includes($l.toLowerCase())||jt.email.toLowerCase().includes($l.toLowerCase())).map(jt=>r.jsxs(K1,{value:`${jt.name} ${jt.email}`,onSelect:()=>{vy(jt.id,xa.id),pu(!1),mu("")},children:[jt.name," (",jt.email,")"]},jt.id))})]})]})})]})]}),r.jsx("div",{className:"flex-1 overflow-auto border rounded-lg",children:r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Ar,{className:"bg-muted/30 hover:bg-muted/30",children:[r.jsx(It,{className:"font-semibold",children:"Name"}),r.jsx(It,{className:"font-semibold",children:"Email"}),r.jsx(It,{className:"font-semibold",children:"Status"}),r.jsx(It,{className:"font-semibold",children:"Role"}),r.jsx(It,{className:"w-[120px]"})]})}),r.jsx(Vs,{children:gu(xa.id).length===0?r.jsx(Ar,{children:r.jsx(Nt,{colSpan:5,className:"text-center py-8 text-muted-foreground",children:Bi?"No matching members found":"No members in this brokerage"})}):gu(xa.id).map(jt=>r.jsxs(Ar,{className:"hover:bg-muted/30",children:[r.jsx(Nt,{className:"font-medium",children:jt.name}),r.jsx(Nt,{className:"text-muted-foreground",children:jt.email}),r.jsx(Nt,{children:jt.claimed?r.jsx(Ot,{variant:"default",className:"bg-green-500/10 text-green-600 hover:bg-green-500/20",children:"Active"}):r.jsx(Ot,{variant:"secondary",children:"Pending"})}),r.jsx(Nt,{children:jt.roles.includes("brokerage_manager")?r.jsxs(Ot,{variant:"outline",className:"gap-1",children:[r.jsx(rf,{className:"h-3 w-3"}),"Manager"]}):r.jsx("span",{className:"text-muted-foreground text-sm",children:"Agent"})}),r.jsx(Nt,{children:r.jsxs("div",{className:"flex gap-1 justify-end",children:[!jt.claimed&&r.jsx(ee,{size:"icon",variant:"ghost",className:"h-8 w-8",onClick:()=>Ws(jt.id),title:"Resend welcome email",children:r.jsx(da,{className:"h-4 w-4"})}),r.jsx(ee,{size:"icon",variant:"ghost",className:"h-8 w-8",onClick:()=>yy(jt.id),title:"Remove from brokerage",children:r.jsx(_s,{className:"h-4 w-4"})}),r.jsx(ee,{size:"icon",variant:"ghost",className:"h-8 w-8 text-blue-600 hover:text-blue-700 hover:bg-blue-50",onClick:()=>Th(jt.id),disabled:a||jt.id===(e==null?void 0:e.id),title:jt.id===(e==null?void 0:e.id)?"Cannot impersonate yourself":`Login as ${jt.name}`,children:a?r.jsx(en,{className:"h-4 w-4 animate-spin"}):r.jsx(cS,{className:"h-4 w-4"})}),r.jsx(ee,{size:"icon",variant:"ghost",className:"h-8 w-8 text-destructive hover:text-destructive hover:bg-destructive/10",onClick:()=>za(jt.id,jt.name),title:"Delete user",children:r.jsx(Vn,{className:"h-4 w-4"})})]})})]},jt.id))})]})}),r.jsxs("div",{className:"text-sm text-muted-foreground",children:[Sh(xa.id).length," total member",Sh(xa.id).length!==1?"s":""," •",Sh(xa.id).filter(jt=>jt.roles.includes("brokerage_manager")).length," manager",Sh(xa.id).filter(jt=>jt.roles.includes("brokerage_manager")).length!==1?"s":""]})]}),r.jsx(ea,{children:r.jsx(ee,{variant:"outline",onClick:Tm,children:"Close"})})]})})]}),r.jsx(An,{value:"celebrations",children:r.jsx(syt,{})})]})]}),r.jsx(iRe,{open:Do,onOpenChange:ir,brokerages:x,onSuccess:ua}),fr&&r.jsx(oRe,{open:Pt,onOpenChange:jt=>{Ut(jt),jt||ar(null)},userId:fr.id,userName:fr.name})]})},iyt=()=>{const[t,e]=I.useState([]),[n,s]=I.useState(!0),[a,o]=I.useState(!1),[l,i]=I.useState(""),[h,p]=I.useState(""),[x,y]=I.useState(""),[b,j]=I.useState("");I.useEffect(()=>{C()},[]);const C=async()=>{const{data:F,error:q}=await J.from("invite_codes").select("*").order("created_at",{ascending:!1});q?(ze.error("Failed to load invite codes"),console.error(q)):e(F||[]),s(!1)},N=async F=>{if(F.preventDefault(),!l.trim()){ze.error("Please enter a code");return}o(!0);const{error:q}=await J.from("invite_codes").insert({code:l.trim().toUpperCase(),description:h.trim()||null,max_uses:x?parseInt(x):null,trial_days:b?parseInt(b):null});q?q.code==="23505"?ze.error("This code already exists"):(ze.error("Failed to create invite code"),console.error(q)):(ze.success("Invite code created"),i(""),p(""),y(""),j(""),C()),o(!1)},A=async(F,q)=>{const{error:H}=await J.from("invite_codes").update({is_active:!q}).eq("id",F);H?ze.error("Failed to update code"):e(t.map(Z=>Z.id===F?{...Z,is_active:!q}:Z))},E=async F=>{const{error:q}=await J.from("invite_codes").delete().eq("id",F);q?ze.error("Failed to delete code"):(ze.success("Code deleted"),e(t.filter(H=>H.id!==F)))},T="https://dashboard.relevelup.com",L=F=>{const q=`${T}/join?code=${F}`;navigator.clipboard.writeText(q),ze.success("Link copied to clipboard")},z=`${T}/join`;return r.jsx(Lr,{title:"Invite Codes",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Gu,{title:"Invite Codes",description:"Manage signup invite codes"}),r.jsxs(Ye,{children:[r.jsxs(Gt,{children:[r.jsx(Zt,{children:"Create New Code"}),r.jsxs(Mn,{children:["Share link: ",r.jsx("code",{className:"bg-muted px-2 py-1 rounded text-sm",children:z})]})]}),r.jsx(tt,{children:r.jsxs("form",{onSubmit:N,className:"flex flex-wrap gap-4 items-end",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"code",children:"Code"}),r.jsx(dt,{id:"code",placeholder:"WELCOME2024",value:l,onChange:F=>i(F.target.value),className:"w-40"})]}),r.jsxs("div",{className:"space-y-2 flex-1 min-w-[200px]",children:[r.jsx(He,{htmlFor:"description",children:"Description (optional)"}),r.jsx(dt,{id:"description",placeholder:"For marketing campaign",value:h,onChange:F=>p(F.target.value)})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"maxUses",children:"Max Uses"}),r.jsx(dt,{id:"maxUses",type:"number",placeholder:"Unlimited",value:x,onChange:F=>y(F.target.value),className:"w-28"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"trialDays",children:"Trial Days"}),r.jsx(dt,{id:"trialDays",type:"number",placeholder:"None",value:b,onChange:F=>j(F.target.value),className:"w-28"})]}),r.jsxs(ee,{type:"submit",disabled:a,children:[a?r.jsx(en,{className:"h-4 w-4 animate-spin"}):r.jsx(bn,{className:"h-4 w-4 mr-2"}),"Create"]})]})})]}),r.jsxs(Ye,{children:[r.jsx(Gt,{children:r.jsx(Zt,{children:"Active Codes"})}),r.jsx(tt,{children:n?r.jsx("div",{className:"flex justify-center py-8",children:r.jsx(en,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):t.length===0?r.jsx("p",{className:"text-center py-8 text-muted-foreground",children:"No invite codes yet"}):r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Ar,{children:[r.jsx(It,{children:"Code"}),r.jsx(It,{children:"Description"}),r.jsx(It,{children:"Uses"}),r.jsx(It,{children:"Trial"}),r.jsx(It,{children:"Created"}),r.jsx(It,{children:"Active"}),r.jsx(It,{className:"w-24",children:"Actions"})]})}),r.jsx(Vs,{children:t.map(F=>r.jsxs(Ar,{children:[r.jsx(Nt,{className:"font-mono font-medium",children:F.code}),r.jsx(Nt,{className:"text-muted-foreground",children:F.description||"—"}),r.jsxs(Nt,{children:[F.uses_count,F.max_uses&&` / ${F.max_uses}`]}),r.jsx(Nt,{children:F.trial_days?r.jsxs("span",{className:"text-amber-600 dark:text-amber-400 font-medium",children:[F.trial_days," days"]}):r.jsx("span",{className:"text-muted-foreground",children:"—"})}),r.jsx(Nt,{className:"text-muted-foreground",children:yn(new Date(F.created_at),"MMM d, yyyy")}),r.jsx(Nt,{children:r.jsx(Ps,{checked:F.is_active,onCheckedChange:()=>A(F.id,F.is_active)})}),r.jsx(Nt,{children:r.jsxs("div",{className:"flex gap-1",children:[r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>L(F.code),title:"Copy invite link",children:r.jsx(hl,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>E(F.id),className:"text-destructive hover:text-destructive",title:"Delete code",children:r.jsx(Vn,{className:"h-4 w-4"})})]})})]},F.id))})]})})]})]})})};function Td(t){this.content=t}Td.prototype={constructor:Td,find:function(t){for(var e=0;e>1}};Td.from=function(t){if(t instanceof Td)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new Td(e)};function lRe(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=lRe(a.content,o.content,n+1);if(l!=null)return l}n+=a.nodeSize}}function cRe(t,e,n,s){for(let a=t.childCount,o=e.childCount;;){if(a==0||o==0)return a==o?null:{a:n,b:s};let l=t.child(--a),i=e.child(--o),h=l.nodeSize;if(l==i){n-=h,s-=h;continue}if(!l.sameMarkup(i))return{a:n,b:s};if(l.isText&&l.text!=i.text){let p=0,x=Math.min(l.text.length,i.text.length);for(;pe&&s(h,a+i,o||null,l)!==!1&&h.content.size){let x=i+1;h.nodesBetween(Math.max(0,e-x),Math.min(h.content.size,n-x),s,a+x)}i=p}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,s,a){let o="",l=!0;return this.nodesBetween(e,n,(i,h)=>{let p=i.isText?i.text.slice(Math.max(e,h)-h,n-h):i.isLeaf?a?typeof a=="function"?a(i):a:i.type.spec.leafText?i.type.spec.leafText(i):"":"";i.isBlock&&(i.isLeaf&&p||i.isTextblock)&&s&&(l?l=!1:o+=s),o+=p},0),o}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,s=e.firstChild,a=this.content.slice(),o=0;for(n.isText&&n.sameMarkup(s)&&(a[a.length-1]=n.withText(n.text+s.text),o=1);oe)for(let o=0,l=0;le&&((ln)&&(i.isText?i=i.cut(Math.max(0,e-l),Math.min(i.text.length,n-l)):i=i.cut(Math.max(0,e-l-1),Math.min(i.content.size,n-l-1))),s.push(i),a+=i.nodeSize),l=h}return new _n(s,a)}cutByIndex(e,n){return e==n?_n.empty:e==0&&n==this.content.length?this:new _n(this.content.slice(e,n))}replaceChild(e,n){let s=this.content[e];if(s==n)return this;let a=this.content.slice(),o=this.size+n.nodeSize-s.nodeSize;return a[e]=n,new _n(a,o)}addToStart(e){return new _n([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new _n(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;nthis.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,s=0;;n++){let a=this.child(n),o=s+a.nodeSize;if(o>=e)return o==e?NL(n+1,o):NL(n,s);s=o}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return _n.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new _n(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return _n.empty;let n,s=0;for(let a=0;athis.type.rank&&(n||(n=e.slice(0,a)),n.push(this),s=!0),n&&n.push(o)}}return n||(n=e.slice()),s||n.push(this),n}removeFromSet(e){for(let n=0;ns.type.rank-a.type.rank),n}};Ro.none=[];class kte extends Error{}class fs{constructor(e,n,s){this.content=e,this.openStart=n,this.openEnd=s}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let s=uRe(this.content,e+this.openStart,n);return s&&new fs(s,this.openStart,this.openEnd)}removeBetween(e,n){return new fs(dRe(this.content,e+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,n){if(!n)return fs.empty;let s=n.openStart||0,a=n.openEnd||0;if(typeof s!="number"||typeof a!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new fs(_n.fromJSON(e,n.content),s,a)}static maxOpen(e,n=!0){let s=0,a=0;for(let o=e.firstChild;o&&!o.isLeaf&&(n||!o.type.spec.isolating);o=o.firstChild)s++;for(let o=e.lastChild;o&&!o.isLeaf&&(n||!o.type.spec.isolating);o=o.lastChild)a++;return new fs(e,s,a)}}fs.empty=new fs(_n.empty,0,0);function dRe(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(dRe(o.content,e-a-1,n-a-1)))}function uRe(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=uRe(l.content,e-o-1,n,l);return i&&t.replaceChild(a,l.copy(i))}function oyt(t,e,n){if(n.openStart>t.depth)throw new kte("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new kte("Inconsistent open depths");return hRe(t,e,n,0)}function hRe(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 cA(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&&(jj(t.nodeAfter,s),o++));for(let i=o;ia&&Mhe(t,e,a+1),l=s.depth>a&&Mhe(n,s,a+1),i=[];return cA(null,t,a,i),o&&l&&e.index(a)==n.index(a)?(fRe(o,l),jj(kj(o,pRe(t,e,n,s,a+1)),i)):(o&&jj(kj(o,Nte(t,e,a+1)),i),cA(e,n,a,i),l&&jj(kj(l,Nte(n,s,a+1)),i)),cA(s,null,a,i),new _n(i)}function Nte(t,e,n){let s=[];if(cA(null,t,n,s),t.depth>n){let a=Mhe(t,e,n+1);jj(kj(a,Nte(t,e,n+1)),s)}return cA(e,null,n,s),new _n(s)}function lyt(t,e){let n=e.depth-t.openStart,a=e.node(n).copy(t.content);for(let o=n-1;o>=0;o--)a=e.node(o).copy(_n.from(a));return{start:a.resolveNoCache(t.openStart+n),end:a.resolveNoCache(a.content.size-t.openEnd-n)}}class iE{constructor(e,n,s){this.pos=e,this.path=n,this.parentOffset=s,this.depth=n.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,n=this.index(this.depth);if(n==e.childCount)return null;let s=this.pos-this.path[this.path.length-1],a=e.child(n);return s?e.child(n).cut(s):a}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let s=this.path[n*3],a=n==0?0:this.path[n*3-1]+1;for(let o=0;o0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){if(e.pos=0;s--)if(e.pos<=this.end(s)&&(!n||n(this.node(s))))return new Ste(this,e,s);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let s=[],a=0,o=n;for(let l=e;;){let{index:i,offset:h}=l.content.findIndex(o),p=o-h;if(s.push(l,i,a+h),!p||(l=l.child(i),l.isText))break;o=p-1,a+=h+1}return new iE(n,s,o)}static resolveCached(e,n){let s=Ake.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()+")"),mRe(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,s=_n.empty,a=0,o=s.childCount){let l=this.contentMatchAt(e).matchFragment(s,a,o),i=l&&l.matchFragment(this.content,n);if(!i||!i.validEnd)return!1;for(let h=a;hn.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let s;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");s=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,s)}let a=_n.fromJSON(e,n.content),o=e.nodeType(n.type).create(n.attrs,a,s);return o.type.checkAttrs(o.attrs),o}};M1.prototype.text=void 0;class Cte extends M1{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):mRe(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,n){return this.text.slice(e,n)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new Cte(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Cte(this.type,this.attrs,e,this.marks)}cut(e=0,n=this.text.length){return e==0&&n==this.text.length?this:this.withText(this.text.slice(e,n))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function mRe(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class Hj{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let s=new hyt(e,n);if(s.next==null)return Hj.empty;let a=gRe(s);s.next&&s.err("Unexpected trailing text");let o=vyt(yyt(a));return _yt(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(` `)}}Hj.empty=new Hj(!0);class hyt{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 gRe(t){let e=[];do e.push(fyt(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function fyt(t){let e=[];do e.push(pyt(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function pyt(t){let e=xyt(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=myt(t,e);else break;return e}function Eke(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function myt(t,e){let n=Eke(t),s=n;return t.eat(",")&&(t.next!="}"?s=Eke(t):s=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:s,expr:e}}function gyt(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 xyt(t){if(t.eat("(")){let e=gRe(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=gyt(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 yyt(t){let e=[[]];return a(o(t,0),n()),e;function n(){return e.push([])-1}function s(l,i,h){let p={term:h,to:i};return e[l].push(p),p}function a(l,i){l.forEach(h=>h.to=i)}function o(l,i){if(l.type=="choice")return l.exprs.reduce((h,p)=>h.concat(o(p,i)),[]);if(l.type=="seq")for(let h=0;;h++){let p=o(l.exprs[h],i);if(h==l.exprs.length-1)return p;a(p,i=n())}else if(l.type=="star"){let h=n();return s(i,h),a(o(l.expr,h),h),[s(h)]}else if(l.type=="plus"){let h=n();return a(o(l.expr,i),h),a(o(l.expr,h),h),[s(h)]}else{if(l.type=="opt")return[s(i)].concat(o(l.expr,i));if(l.type=="range"){let h=i;for(let p=0;p{t[l].forEach(({term:i,to:h})=>{if(!i)return;let p;for(let x=0;x{p||a.push([i,p=[]]),p.indexOf(x)==-1&&p.push(x)})})});let o=e[s.join(",")]=new Hj(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:vRe(this.attrs,e)}create(e=null,n,s){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new M1(this,this.computeAttrs(e),_n.from(n),Ro.setFrom(s))}createChecked(e=null,n,s){return n=_n.from(n),this.checkContent(n),new M1(this,this.computeAttrs(e),n,Ro.setFrom(s))}createAndFill(e=null,n,s){if(e=this.computeAttrs(e),n=_n.from(n),n.size){let l=this.contentMatch.fillBefore(n);if(!l)return null;n=l.append(n)}let a=this.contentMatch.matchFragment(n),o=a&&a.fillBefore(_n.empty,!0);return o?new M1(this,e,n.append(o),Ro.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 wRe(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 byt(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 wyt{constructor(e,n,s){this.hasDefault=Object.prototype.hasOwnProperty.call(s,"default"),this.default=s.default,this.validate=typeof s.validate=="string"?byt(e,n,s.validate):s.validate}get isRequired(){return!this.hasDefault}}class Tse{constructor(e,n,s,a){this.name=e,this.rank=n,this.schema=s,this.spec=a,this.attrs=bRe(e,a.attrs),this.excluded=null;let o=yRe(this.attrs);this.instance=o?new Ro(this,o):null}create(e=null){return!e&&this.instance?this.instance:new Ro(this,vRe(this.attrs,e))}static compile(e,n){let s=Object.create(null),a=0;return e.forEach((o,l)=>s[o]=new Tse(o,a++,n,l)),s}removeFromSet(e){for(var n=0;n-1}}class jRe{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=Td.from(e.nodes),n.marks=Td.from(e.marks||{}),this.nodes=Pke.compile(this.spec.nodes,this),this.marks=Tse.compile(this.spec.marks,this);let s=Object.create(null);for(let a in this.nodes){if(a in this.marks)throw new RangeError(a+" can not be both a node and a mark");let o=this.nodes[a],l=o.spec.content||"",i=o.spec.marks;if(o.contentMatch=s[l]||(s[l]=Hj.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?Lke(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==""?[]:Lke(this,l.split(" "))}this.nodeFromJSON=a=>M1.fromJSON(this,a),this.markFromJSON=a=>Ro.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 Pke){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(n,s,a)}text(e,n){let s=this.nodes.text;return new Cte(s,s.defaultAttrs,e,Ro.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 Lke(t,e){let n=[];for(let s=0;s-1)&&n.push(l=h)}if(!l)throw new SyntaxError("Unknown mark type: '"+e[s]+"'")}return n}function jyt(t){return t.tag!=null}function kyt(t){return t.style!=null}let dA=class Ahe{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let s=this.matchedStyles=[];n.forEach(a=>{if(jyt(a))this.tags.push(a);else if(kyt(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 Dke(this,n,!1);return s.addAll(e,Ro.none,n.from,n.to),s.finish()}parseSlice(e,n={}){let s=new Dke(this,n,!0);return s.addAll(e,Ro.none,n.from,n.to),fs.maxOpen(s.finish())}matchTag(e,n,s){for(let a=s?this.tags.indexOf(s)+1:0;ae.length&&(i.charCodeAt(e.length)!=61||i.slice(e.length+1)!=n))){if(l.getAttrs){let h=l.getAttrs(n);if(h===!1)continue;l.attrs=h||void 0}return l}}}static schemaRules(e){let n=[];function s(a){let o=a.priority==null?50:a.priority,l=0;for(;l{s(l=Rke(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=Rke(l)),l.node||l.ignore||l.mark||(l.node=a)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new Ahe(e,Ahe.schemaRules(e)))}};const kRe={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},Nyt={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},NRe={ol:!0,ul:!0},oE=1,Ehe=2,uA=4;function Oke(t,e,n){return e!=null?(e?oE:0)|(e==="full"?Ehe:0):t&&t.whitespace=="pre"?oE|Ehe:n&~uA}class SL{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=Ro.none,this.match=o||(l&uA?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(_n.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let s=this.type.contentMatch,a;return(a=s.findWrapping(e.type))?(this.match=s,a):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&oE)){let s=this.content[this.content.length-1],a;if(s&&s.isText&&(a=/[ \t\r\n\u000c]+$/.exec(s.text))){let o=s;s.text.length==a[0].length?this.content.pop():this.content[this.content.length-1]=o.withText(o.text.slice(0,o.text.length-a[0].length))}}let n=_n.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(_n.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!kRe.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class Dke{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=Oke(null,n.preserveWhitespace,0)|(s?uA:0);a?o=new SL(a.type,a.attrs,Ro.none,!0,n.topMatch||a.type.contentMatch,l):s?o=new SL(null,null,Ro.none,!0,null,l):o=new SL(e.schema.topNodeType,null,Ro.none,!0,null,l),this.nodes=[o],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,n){e.nodeType==3?this.addTextNode(e,n):e.nodeType==1&&this.addElement(e,n)}addTextNode(e,n){let s=e.nodeValue,a=this.top,o=a.options&Ehe?"full":this.localPreserveWS||(a.options&oE)>0,{schema:l}=this.parser;if(o==="full"||a.inlineContext(e)||/[^ \t\r\n\u000c]/.test(s)){if(o)if(o==="full")s=s.replace(/\r\n?/g,` `);else if(l.linebreakReplacement&&/[\r\n]/.test(s)&&this.top.findWrapping(l.linebreakReplacement.create())){let i=s.split(/\r?\n|\r/);for(let h=0;h!h.clearMark(p)):n=n.concat(this.parser.schema.marks[h.mark].create(h.attrs)),h.consuming===!1)i=h;else break}}return n}addElementByRule(e,n,s,a){let o,l;if(n.node)if(l=this.parser.schema.nodes[n.node],l.isLeaf)this.insertNode(l.create(n.attrs),s,e.nodeName=="BR")||this.leafFallback(e,s);else{let h=this.enter(l,n.attrs||null,s,n.preserveWhitespace);h&&(o=!0,s=h)}else{let h=this.parser.schema.marks[n.mark];s=s.concat(h.create(n.attrs))}let i=this.top;if(l&&l.isLeaf)this.findInside(e);else if(a)this.addElement(e,s,a);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(h=>this.insertNode(h,s,!1));else{let h=e;typeof n.contentElement=="string"?h=e.querySelector(n.contentElement):typeof n.contentElement=="function"?h=n.contentElement(e):n.contentElement&&(h=n.contentElement),this.findAround(e,h,!0),this.addAll(h,s),this.findAround(e,h,!1)}o&&this.sync(i)&&this.open--}addAll(e,n,s,a){let o=s||0;for(let l=s?e.childNodes[s]:e.firstChild,i=a==null?null:e.childNodes[a];l!=i;l=l.nextSibling,++o)this.findAtPoint(e,o),this.addDOM(l,n);this.findAtPoint(e,o)}findPlace(e,n,s){let a,o;for(let l=this.open,i=0;l>=0;l--){let h=this.nodes[l],p=h.findWrapping(e);if(p&&(!a||a.length>p.length+i)&&(a=p,o=h,!p.length))break;if(h.solid){if(s)break;i+=2}}if(!a)return null;this.sync(o);for(let l=0;l(l.type?l.type.allowsMarkType(p.type):Fke(p.type,e))?(h=p.addToSet(h),!1):!0),this.nodes.push(new SL(e,n,h,a,null,i)),this.open++,s}closeExtra(e=!1){let n=this.nodes.length-1;if(n>this.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let n=this.open;n>=0;n--){if(this.nodes[n]==e)return this.open=n,!0;this.localPreserveWS&&(this.nodes[n].options|=oE)}return!1}get currentPos(){this.closeExtra();let e=0;for(let n=this.open;n>=0;n--){let s=this.nodes[n].content;for(let a=s.length-1;a>=0;a--)e+=s[a].nodeSize;n&&e++}return e}findAtPoint(e,n){if(this.find)for(let s=0;s-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let n=e.split("/"),s=this.options.context,a=!this.isOpen&&(!s||s.parent.type==this.nodes[0].type),o=-(s?s.depth+1:0)+(a?0:1),l=(i,h)=>{for(;i>=0;i--){let p=n[i];if(p==""){if(i==n.length-1||i==0)continue;for(;h>=o;h--)if(l(i-1,h))return!0;return!1}else{let x=h>0||h==0&&a?this.nodes[h].type:s&&h>=o?s.node(h-o).type:null;if(!x||x.name!=p&&!x.isInGroup(p))return!1;h--}}return!0};return l(n.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let n=e.depth;n>=0;n--){let s=e.node(n).contentMatchAt(e.indexAfter(n)).defaultType;if(s&&s.isTextblock&&s.defaultAttrs)return s}for(let n in this.parser.schema.nodes){let s=this.parser.schema.nodes[n];if(s.isTextblock&&s.defaultAttrs)return s}}}function Syt(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let s=e.nodeType==1?e.nodeName.toLowerCase():null;s&&NRe.hasOwnProperty(s)&&n?(n.appendChild(e),e=n):s=="li"?n=e:s&&(n=null)}}function Cyt(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function Rke(t){let e={};for(let n in t)e[n]=t[n];return e}function Fke(t,e){let n=e.schema.nodes;for(let s in n){let a=n[s];if(!a.allowsMarkType(t))continue;let o=[],l=i=>{o.push(i);for(let h=0;h{if(o.length||l.marks.length){let i=0,h=0;for(;i=0;a--){let o=this.serializeMark(e.marks[a],e.isInline,n);o&&((o.contentDOM||o.dom).appendChild(s),s=o.dom)}return s}serializeMark(e,n,s={}){let a=this.marks[e.type.name];return a&&lee(sce(s),a(e,n),null,e.attrs)}static renderSpec(e,n,s=null,a){return lee(e,n,s,a)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new ck(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=zke(e.nodes);return n.text||(n.text=s=>s.text),n}static marksFromSchema(e){return zke(e.marks)}}function zke(t){let e={};for(let n in t){let s=t[n].spec.toDOM;s&&(e[n]=s)}return e}function sce(t){return t.document||window.document}const Bke=new WeakMap;function Myt(t){let e=Bke.get(t);return e===void 0&&Bke.set(t,e=Tyt(t)),e}function Tyt(t){let e=null;function n(s){if(s&&typeof s=="object")if(Array.isArray(s))if(typeof s[0]=="string")e||(e=[]),e.push(s);else for(let a=0;a-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let l=a.indexOf(" ");l>0&&(n=a.slice(0,l),a=a.slice(l+1));let i,h=n?t.createElementNS(n,a):t.createElement(a),p=e[1],x=1;if(p&&typeof p=="object"&&p.nodeType==null&&!Array.isArray(p)){x=2;for(let y in p)if(p[y]!=null){let b=y.indexOf(" ");b>0?h.setAttributeNS(y.slice(0,b),y.slice(b+1),p[y]):y=="style"&&h.style?h.style.cssText=p[y]:h.setAttribute(y,p[y])}}for(let y=x;yx)throw new RangeError("Content hole must be the only child of its parent node");return{dom:h,contentDOM:h}}else{let{dom:j,contentDOM:C}=lee(t,b,n,s);if(h.appendChild(j),C){if(i)throw new RangeError("Multiple content holes");i=C}}}return{dom:h,contentDOM:i}}const SRe=65535,CRe=Math.pow(2,16);function Ayt(t,e){return t+e*CRe}function $ke(t){return t&SRe}function Eyt(t){return(t-(t&SRe))/CRe}const MRe=1,TRe=2,cee=4,ARe=8;class Ihe{constructor(e,n,s){this.pos=e,this.delInfo=n,this.recover=s}get deleted(){return(this.delInfo&ARe)>0}get deletedBefore(){return(this.delInfo&(MRe|cee))>0}get deletedAfter(){return(this.delInfo&(TRe|cee))>0}get deletedAcross(){return(this.delInfo&cee)>0}}class Kh{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&Kh.empty)return Kh.empty}recover(e){let n=0,s=$ke(e);if(!this.inverted)for(let a=0;ae)break;let p=this.ranges[i+o],x=this.ranges[i+l],y=h+p;if(e<=y){let b=p?e==h?-1:e==y?1:n:n,j=h+a+(b<0?0:x);if(s)return j;let C=e==(n<0?h:y)?null:Ayt(i/3,e-h),N=e==h?TRe:e==y?MRe:cee;return(n<0?e!=h:e!=y)&&(N|=ARe),new Ihe(j,N,C)}a+=x-p}return s?e+a:new Ihe(e+a,0,null)}touches(e,n){let s=0,a=$ke(n),o=this.inverted?2:1,l=this.inverted?1:2;for(let i=0;ie)break;let p=this.ranges[i+o],x=h+p;if(e<=x&&i==a*3)return!0;s+=this.ranges[i+l]-p}return!1}forEach(e){let n=this.inverted?2:1,s=this.inverted?1:2;for(let a=0,o=0;a=0;n--){let a=e.getMirror(n);this.appendMap(e._maps[n].invert(),a!=null&&a>n?s-a-1:void 0)}}invert(){let e=new lE;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let s=this.from;so&&h!l.isAtom||!i.type.allowsMarkType(this.mark.type)?l:l.mark(this.mark.addToSet(l.marks)),a),n.openStart,n.openEnd);return Mc.fromReplace(e,this.from,this.to,o)}invert(){return new dg(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 K0(n.pos,s.pos,this.mark)}merge(e){return e instanceof K0&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new K0(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 K0(n.from,n.to,e.markFromJSON(n.mark))}}fu.jsonID("addMark",K0);class dg extends fu{constructor(e,n,s){super(),this.from=e,this.to=n,this.mark=s}apply(e){let n=e.slice(this.from,this.to),s=new fs(Dxe(n.content,a=>a.mark(this.mark.removeFromSet(a.marks)),e),n.openStart,n.openEnd);return Mc.fromReplace(e,this.from,this.to,s)}invert(){return new K0(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 dg(n.pos,s.pos,this.mark)}merge(e){return e instanceof dg&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new dg(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 dg(n.from,n.to,e.markFromJSON(n.mark))}}fu.jsonID("removeMark",dg);class Z0 extends fu{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Mc.fail("No node at mark step's position");let s=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return Mc.fromReplace(e,this.pos,this.pos+1,new fs(_n.from(s),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let s=this.mark.addToSet(n.marks);if(s.length==n.marks.length){for(let a=0;as.pos?null:new md(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 md(n.from,n.to,n.gapFrom,n.gapTo,fs.fromJSON(e,n.slice),n.insert,!!n.structure)}}fu.jsonID("replaceAround",md);function Phe(t,e,n){let s=t.resolve(e),a=n-e,o=s.depth;for(;a>0&&o>0&&s.indexAfter(o)==s.node(o).childCount;)o--,a--;if(a>0){let l=s.node(o).maybeChild(s.indexAfter(o));for(;a>0;){if(!l||l.isLeaf)return!0;l=l.firstChild,a--}}return!1}function Iyt(t,e,n,s){let a=[],o=[],l,i;t.doc.nodesBetween(e,n,(h,p,x)=>{if(!h.isInline)return;let y=h.marks;if(!s.isInSet(y)&&x.type.allowsMarkType(s.type)){let b=Math.max(p,e),j=Math.min(p+h.nodeSize,n),C=s.addToSet(y);for(let N=0;Nt.step(h)),o.forEach(h=>t.step(h))}function Pyt(t,e,n,s){let a=[],o=0;t.doc.nodesBetween(e,n,(l,i)=>{if(!l.isInline)return;o++;let h=null;if(s instanceof Tse){let p=l.marks,x;for(;x=s.isInSet(p);)(h||(h=[])).push(x),p=x.removeFromSet(p)}else s?s.isInSet(l.marks)&&(h=[s]):h=l.marks;if(h&&h.length){let p=Math.min(i+l.nodeSize,n);for(let x=0;xt.step(new dg(l.from,l.to,l.style)))}function Rxe(t,e,n,s=n.contentMatch,a=!0){let o=t.doc.nodeAt(e),l=[],i=e+1;for(let h=0;h=0;h--)t.step(l[h])}function Lyt(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function h3(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let s=t.depth,a=0,o=0;;--s){let l=t.$from.node(s),i=t.$from.index(s)+a,h=t.$to.indexAfter(s)-o;if(sn;C--)N||s.index(C)>0?(N=!0,x=_n.from(s.node(C).copy(x)),y++):h--;let b=_n.empty,j=0;for(let C=o,N=!1;C>n;C--)N||a.after(C+1)=0;l--){if(s.size){let i=n[l].type.contentMatch.matchFragment(s);if(!i||!i.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}s=_n.from(n[l].type.create(n[l].attrs,s))}let a=e.start,o=e.end;t.step(new md(a,o,a,o,new fs(s,0,0),n.length,!0))}function zyt(t,e,n,s,a){if(!s.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let o=t.steps.length;t.doc.nodesBetween(e,n,(l,i)=>{let h=typeof a=="function"?a(l):a;if(l.isTextblock&&!l.hasMarkup(s,h)&&Byt(t.doc,t.mapping.slice(o).map(i),s)){let p=null;if(s.schema.linebreakReplacement){let j=s.whitespace=="pre",C=!!s.contentMatch.matchType(s.schema.linebreakReplacement);j&&!C?p=!1:!j&&C&&(p=!0)}p===!1&&IRe(t,l,i,o),Rxe(t,t.mapping.slice(o).map(i,1),s,void 0,p===null);let x=t.mapping.slice(o),y=x.map(i,1),b=x.map(i+l.nodeSize,1);return t.step(new md(y,b,y+1,b-1,new fs(_n.from(s.create(h,null,l.marks)),0,0),1,!0)),p===!0&&ERe(t,l,i,o),!1}})}function ERe(t,e,n,s){e.forEach((a,o)=>{if(a.isText){let l,i=/\r?\n|\r/g;for(;l=i.exec(a.text);){let h=t.mapping.slice(s).map(n+1+o+l.index);t.replaceWith(h,h+1,e.type.schema.linebreakReplacement.create())}}})}function IRe(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 Byt(t,e,n){let s=t.resolve(e),a=s.index();return s.parent.canReplaceWith(a,a+1,n)}function $yt(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 md(e,e+o.nodeSize,e+1,e+o.nodeSize-1,new fs(_n.from(l),0,0),1,!0))}function Gx(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),b=a.index(p);if(y.type.spec.isolating)return!1;let j=y.content.cutByIndex(b,y.childCount),C=s&&s[x+1];C&&(j=j.replaceChild(0,C.type.create(C.attrs)));let N=s&&s[x]||y;if(!y.canReplace(b+1,y.childCount)||!N.type.validContent(j))return!1}let i=a.indexAfter(o),h=s&&s[0];return a.node(o).canReplaceWith(i,i,h?h.type:a.node(o+1).type)}function Uyt(t,e,n=1,s){let a=t.doc.resolve(e),o=_n.empty,l=_n.empty;for(let i=a.depth,h=a.depth-n,p=n-1;i>h;i--,p--){o=_n.from(a.node(i).copy(o));let x=s&&s[p];l=_n.from(x?x.type.create(x.attrs,l):a.node(i).copy(l))}t.step(new ld(e,e,new fs(o.append(l),n,n),!0))}function lv(t,e){let n=t.resolve(e),s=n.index();return PRe(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(s,s+1)}function qyt(t,e){e.content.size||t.type.compatibleContent(e.type);let n=t.contentMatchAt(t.childCount),{linebreakReplacement:s}=t.type.schema;for(let a=0;a0?(o=s.node(a+1),i++,l=s.node(a).maybeChild(i)):(o=s.node(a).maybeChild(i-1),l=s.node(a+1)),o&&!o.isTextblock&&PRe(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 Vyt(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);IRe(t,x.node(),x.before(),i)}l.inlineContent&&Rxe(t,e+n-1,l,o.node().contentMatchAt(o.index()),s==null);let h=t.mapping.slice(i),p=h.map(e-n);if(t.step(new ld(p,h.map(e+n,-1),fs.empty,!0)),s===!0){let x=t.doc.resolve(p);ERe(t,x.node(),x.before(),t.steps.length)}return t}function Hyt(t,e,n){let s=t.resolve(e);if(s.parent.canReplaceWith(s.index(),s.index(),n))return e;if(s.parentOffset==0)for(let a=s.depth-1;a>=0;a--){let o=s.index(a);if(s.node(a).canReplaceWith(o,o,n))return s.before(a+1);if(o>0)return null}if(s.parentOffset==s.parent.content.size)for(let a=s.depth-1;a>=0;a--){let o=s.indexAfter(a);if(s.node(a).canReplaceWith(o,o,n))return s.after(a+1);if(o=0;l--){let i=l==s.depth?0:s.pos<=(s.start(l+1)+s.end(l+1))/2?-1:1,h=s.index(l)+(i>0?1:0),p=s.node(l),x=!1;if(o==1)x=p.canReplace(h,h,a);else{let y=p.contentMatchAt(h).findWrapping(a.firstChild.type);x=y&&p.canReplaceWith(h,h,y[0])}if(x)return i==0?s.pos:i<0?s.before(l+1):s.after(l+1)}return null}function Ese(t,e,n=e,s=fs.empty){if(e==n&&!s.size)return null;let a=t.resolve(e),o=t.resolve(n);return ORe(a,o,s)?new ld(e,n,s):new Wyt(a,o,s).fit()}function ORe(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class Wyt{constructor(e,n,s){this.$from=e,this.$to=n,this.unplaced=s,this.frontier=[],this.placed=_n.empty;for(let a=0;a<=e.depth;a++){let o=e.node(a);this.frontier.push({type:o.type,match:o.contentMatchAt(e.indexAfter(a))})}for(let a=e.depth;a>0;a--)this.placed=_n.from(e.node(a).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let p=this.findFittable();p?this.placeNodes(p):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,s=this.$from,a=this.close(e<0?this.$to:s.doc.resolve(e));if(!a)return null;let o=this.placed,l=s.depth,i=a.depth;for(;l&&i&&o.childCount==1;)o=o.firstChild.content,l--,i--;let h=new fs(o,l,i);return e>-1?new md(s.pos,e,this.$to.pos,this.$to.end(),h,n):h.size||s.pos!=this.$to.pos?new ld(s.pos,a.pos,h):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,s=0,a=this.unplaced.openEnd;s1&&(a=0),o.type.spec.isolating&&a<=s){e=s;break}n=o.content}for(let n=1;n<=2;n++)for(let s=n==1?e:this.unplaced.openStart;s>=0;s--){let a,o=null;s?(o=ice(this.unplaced.content,s-1).firstChild,a=o.content):a=this.unplaced.content;let l=a.firstChild;for(let i=this.depth;i>=0;i--){let{type:h,match:p}=this.frontier[i],x,y=null;if(n==1&&(l?p.matchType(l.type)||(y=p.fillBefore(_n.from(l),!1)):o&&h.compatibleContent(o.type)))return{sliceDepth:s,frontierDepth:i,parent:o,inject:y};if(n==2&&l&&(x=p.findWrapping(l.type)))return{sliceDepth:s,frontierDepth:i,parent:o,wrap:x};if(o&&p.matchType(o.type))break}}}openMore(){let{content:e,openStart:n,openEnd:s}=this.unplaced,a=ice(e,n);return!a.childCount||a.firstChild.isLeaf?!1:(this.unplaced=new fs(e,n+1,Math.max(s,a.size+n>=e.size-s?n+1:0)),!0)}dropNode(){let{content:e,openStart:n,openEnd:s}=this.unplaced,a=ice(e,n);if(a.childCount<=1&&n>0){let o=e.size-n<=n+a.size;this.unplaced=new fs(lT(e,n-1,1),n-1,o?n-1:s)}else this.unplaced=new fs(lT(e,n,1),n,s)}placeNodes({sliceDepth:e,frontierDepth:n,parent:s,inject:a,wrap:o}){for(;this.depth>n;)this.closeFrontierNode();if(o)for(let N=0;N1||h==0||N.content.size)&&(y=A,x.push(DRe(N.mark(b.allowedMarks(N.marks)),p==1?h:0,p==i.childCount?j:-1)))}let C=p==i.childCount;C||(j=-1),this.placed=cT(this.placed,n,_n.from(x)),this.frontier[n].match=y,C&&j<0&&s&&s.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let N=0,A=i;N1&&a==this.$to.end(--s);)++a;return a}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:s,type:a}=this.frontier[n],o=n=0;i--){let{match:h,type:p}=this.frontier[i],x=oce(e,i,p,h,!0);if(!x||x.childCount)continue e}return{depth:n,fit:l,move:o?e.doc.resolve(e.after(n+1)):e}}}}close(e){let n=this.findCloseLevel(e);if(!n)return null;for(;this.depth>n.depth;)this.closeFrontierNode();n.fit.childCount&&(this.placed=cT(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=cT(this.placed,this.depth,_n.from(e.create(n,s))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(_n.empty,!0);n.childCount&&(this.placed=cT(this.placed,this.frontier.length,n))}}function lT(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(lT(t.firstChild.content,e-1,n)))}function cT(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(cT(t.lastChild.content,e-1,n)))}function ice(t,e){for(let n=0;n1&&(s=s.replaceChild(0,DRe(s.firstChild,e-1,s.childCount==1?n-1:0))),e>0&&(s=t.type.contentMatch.fillBefore(s).append(s),n<=0&&(s=s.append(t.type.contentMatch.matchFragment(s).fillBefore(_n.empty,!0)))),t.copy(s)}function oce(t,e,n,s,a){let o=t.node(e),l=a?t.indexAfter(e):t.index(e);if(l==o.childCount&&!n.compatibleContent(o.type))return null;let i=s.fillBefore(o.content,!0,l);return i&&!Gyt(n,o.content,l)?i:null}function Gyt(t,e,n){for(let s=n;s0;b--,j--){let C=a.node(b).type.spec;if(C.defining||C.definingAsContext||C.isolating)break;l.indexOf(b)>-1?i=b:a.before(b)==j&&l.splice(1,0,-b)}let h=l.indexOf(i),p=[],x=s.openStart;for(let b=s.content,j=0;;j++){let C=b.firstChild;if(p.push(C),j==s.openStart)break;b=C.content}for(let b=x-1;b>=0;b--){let j=p[b],C=Kyt(j.type);if(C&&!j.sameMarkup(a.node(Math.abs(i)-1)))x=b;else if(C||!j.type.isTextblock)break}for(let b=s.openStart;b>=0;b--){let j=(b+x+1)%(s.openStart+1),C=p[j];if(C)for(let N=0;N=0&&(t.replace(e,n,s),!(t.steps.length>y));b--){let j=l[b];j<0||(e=a.before(j),n=o.after(j))}}function RRe(t,e,n,s,a){if(es){let o=a.contentMatchAt(0),l=o.fillBefore(t).append(t);t=l.append(o.matchFragment(l).fillBefore(_n.empty,!0))}return t}function Yyt(t,e,n,s){if(!s.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let a=Hyt(t.doc,e,s.type);a!=null&&(e=n=a)}t.replaceRange(e,n,new fs(_n.from(s),0,0))}function Xyt(t,e,n){let s=t.doc.resolve(e),a=t.doc.resolve(n),o=FRe(s,a);for(let l=0;l0&&(h||s.node(i-1).canReplace(s.index(i-1),a.indexAfter(i-1))))return t.delete(s.before(i),a.after(i))}for(let l=1;l<=s.depth&&l<=a.depth;l++)if(e-s.start(l)==s.depth-l&&n>s.end(l)&&a.end(l)-n!=a.depth-l&&s.start(l-1)==a.start(l-1)&&s.node(l-1).canReplace(s.index(l-1),a.index(l-1)))return t.delete(s.before(l),n);t.delete(e,n)}function FRe(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 AS extends fu{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 Mc.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 Mc.fromReplace(e,this.pos,this.pos+1,new fs(_n.from(a),0,n.isLeaf?0:1))}getMap(){return Kh.empty}invert(e){return new AS(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 AS(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 AS(n.pos,n.attr,n.value)}}fu.jsonID("attr",AS);class cE extends fu{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 Mc.ok(s)}getMap(){return Kh.empty}invert(e){return new cE(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 cE(n.attr,n.value)}}fu.jsonID("docAttr",cE);let mC=class extends Error{};mC=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};mC.prototype=Object.create(Error.prototype);mC.prototype.constructor=mC;mC.prototype.name="TransformError";class zRe{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new lE}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new mC(n.failed);return this}maybeStep(e){let n=e.apply(this.doc);return n.failed||this.addStep(e,n.doc),n}get docChanged(){return this.steps.length>0}addStep(e,n){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=n}replace(e,n=e,s=fs.empty){let a=Ese(this.doc,e,n,s);return a&&this.step(a),this}replaceWith(e,n,s){return this.replace(e,n,new fs(_n.from(s),0,0))}delete(e,n){return this.replace(e,n,fs.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,s){return Zyt(this,e,n,s),this}replaceRangeWith(e,n,s){return Yyt(this,e,n,s),this}deleteRange(e,n){return Xyt(this,e,n),this}lift(e,n){return Oyt(this,e,n),this}join(e,n=1){return Vyt(this,e,n),this}wrap(e,n){return Fyt(this,e,n),this}setBlockType(e,n=e,s,a=null){return zyt(this,e,n,s,a),this}setNodeMarkup(e,n,s=null,a){return $yt(this,e,n,s,a),this}setNodeAttribute(e,n,s){return this.step(new AS(e,n,s)),this}setDocAttribute(e,n){return this.step(new cE(e,n)),this}addNodeMark(e,n){return this.step(new Z0(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 Ro)n.isInSet(s.marks)&&this.step(new Wj(e,n));else{let a=s.marks,o,l=[];for(;o=n.isInSet(a);)l.push(new Wj(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 Uyt(this,e,n,s),this}addMark(e,n,s){return Iyt(this,e,n,s),this}removeMark(e,n,s){return Pyt(this,e,n,s),this}clearIncompatible(e,n,s){return Rxe(this,e,n,s),this}}const lce=Object.create(null);class ui{constructor(e,n,s){this.$anchor=e,this.$head=n,this.ranges=s||[new Qyt(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?b4(e.node(0),e.node(o),e.before(o+1),e.index(o),n,s):b4(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 af(e.node(0))}static atStart(e){return b4(e,e,0,0,1)||new af(e)}static atEnd(e){return b4(e,e,e.content.size,e.childCount,-1)||new af(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let s=lce[n.type];if(!s)throw new RangeError(`No selection type ${n.type} defined`);return s.fromJSON(e,n)}static jsonID(e,n){if(e in lce)throw new RangeError("Duplicate use of selection JSON ID "+e);return lce[e]=n,n.prototype.jsonID=e,n}getBookmark(){return Va.between(this.$anchor,this.$head).getBookmark()}}ui.prototype.visible=!0;class Qyt{constructor(e,n){this.$from=e,this.$to=n}}let qke=!1;function Vke(t){!qke&&!t.parent.inlineContent&&(qke=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class Va extends ui{constructor(e,n=e){Vke(e),Vke(n),super(e,n)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,n){let s=e.resolve(n.map(this.head));if(!s.parent.inlineContent)return ui.near(s);let a=e.resolve(n.map(this.anchor));return new Va(a.parent.inlineContent?a:s,s)}replace(e,n=fs.empty){if(super.replace(e,n),n==fs.empty){let s=this.$from.marksAcross(this.$to);s&&e.ensureMarks(s)}}eq(e){return e instanceof Va&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Ise(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,n){if(typeof n.anchor!="number"||typeof n.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new Va(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,s=n){let a=e.resolve(n);return new this(a,s==n?a:e.resolve(s))}static between(e,n,s){let a=e.pos-n.pos;if((!s||a)&&(s=a>=0?1:-1),!n.parent.inlineContent){let o=ui.findFrom(n,s,!0)||ui.findFrom(n,-s,!0);if(o)n=o.$head;else return ui.near(n,s)}return e.parent.inlineContent||(a==0?e=n:(e=(ui.findFrom(e,-s,!0)||ui.findFrom(e,s,!0)).$anchor,e.pos0?0:1);a>0?l=0;l+=a){let i=e.child(l);if(i.isAtom){if(!o&&aa.isSelectable(i))return aa.create(t,n-(a<0?i.nodeSize:0))}else{let h=b4(t,i,n+a,a<0?i.childCount:0,a,o);if(h)return h}n+=i.nodeSize*a}return null}function Hke(t,e,n){let s=t.steps.length-1;if(s{l==null&&(l=x)}),t.setSelection(ui.near(t.doc.resolve(l),n))}const Wke=1,CL=2,Gke=4;class e0t extends zRe{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|=CL,this}ensureMarks(e){return Ro.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&CL)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~CL,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)||Ro.none))),s.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,n,s){let a=this.doc.type.schema;if(n==null)return e?this.replaceSelectionWith(a.text(e),!0):this.deleteSelection();{if(s==null&&(s=n),!e)return this.deleteRange(n,s);let o=this.storedMarks;if(!o){let l=this.doc.resolve(n);o=s==n?l.marks():l.marksAcross(this.doc.resolve(s))}return this.replaceRangeWith(n,s,a.text(e,o)),!this.selection.empty&&this.selection.to==n+e.length&&this.setSelection(ui.near(this.selection.$to)),this}}setMeta(e,n){return this.meta[typeof e=="string"?e:e.key]=n,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=Gke,this}get scrolledIntoView(){return(this.updated&Gke)>0}}function Kke(t,e){return!e||!t?t:t.bind(e)}class dT{constructor(e,n,s){this.name=e,this.init=Kke(n.init,s),this.apply=Kke(n.apply,s)}}const t0t=[new dT("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new dT("selection",{init(t,e){return t.selection||ui.atStart(e.doc)},apply(t){return t.selection}}),new dT("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,s){return s.selection.$cursor?t.storedMarks:null}}),new dT("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class cce{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=t0t.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 dT(s.key,s.spec.state,s))})}}class D4{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,n=-1){for(let s=0;ss.toJSON())),e&&typeof e=="object")for(let s in e){if(s=="doc"||s=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let a=e[s],o=a.spec.state;o&&o.toJSON&&(n[s]=o.toJSON.call(a,this[a.key]))}return n}static fromJSON(e,n,s){if(!n)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let a=new cce(e.schema,e.plugins),o=new D4(a);return a.fields.forEach(l=>{if(l.name=="doc")o.doc=M1.fromJSON(e.schema,n.doc);else if(l.name=="selection")o.selection=ui.fromJSON(o.doc,n.selection);else if(l.name=="storedMarks")n.storedMarks&&(o.storedMarks=n.storedMarks.map(e.schema.markFromJSON));else{if(s)for(let i in s){let h=s[i],p=h.spec.state;if(h.key==l.name&&p&&p.fromJSON&&Object.prototype.hasOwnProperty.call(n,i)){o[l.name]=p.fromJSON.call(h,e,n[i],o);return}}o[l.name]=l.init(e,o)}}),o}}function BRe(t,e,n){for(let s in t){let a=t[s];a instanceof Function?a=a.bind(e):s=="handleDOMEvents"&&(a=BRe(a,e,{})),n[s]=a}return n}class Ud{constructor(e){this.spec=e,this.props={},e.props&&BRe(e.props,this,this.props),this.key=e.key?e.key.key:$Re("plugin")}getState(e){return e[this.key]}}const dce=Object.create(null);function $Re(t){return t in dce?t+"$"+ ++dce[t]:(dce[t]=0,t+"$")}class pf{constructor(e="key"){this.key=$Re(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const Id=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},gC=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let Lhe=null;const wx=function(t,e,n){let s=Lhe||(Lhe=document.createRange());return s.setEnd(t,n??t.nodeValue.length),s.setStart(t,e||0),s},r0t=function(){Lhe=null},Gj=function(t,e,n,s){return n&&(Zke(t,e,n,s,-1)||Zke(t,e,n,s,1))},n0t=/^(img|br|input|textarea|hr)$/i;function Zke(t,e,n,s,a){for(var o;;){if(t==n&&e==s)return!0;if(e==(a<0?0:Uf(t))){let l=t.parentNode;if(!l||l.nodeType!=1||PI(t)||n0t.test(t.nodeName)||t.contentEditable=="false")return!1;e=Id(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?Uf(t):0}else return!1}}function Uf(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function s0t(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=Uf(t)}else if(t.parentNode&&!PI(t))e=Id(t),t=t.parentNode;else return null}}function a0t(t,e){for(;;){if(t.nodeType==3&&e2),Rf=xC||(Pg?/Mac/.test(Pg.platform):!1),VRe=Pg?/Win/.test(Pg.platform):!1,Lx=/Android \d/.test(cv),LI=!!Yke&&"webkitFontSmoothing"in Yke.documentElement.style,c0t=LI?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function d0t(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 px(t,e){return typeof t=="number"?t:t[e]}function u0t(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 Xke(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=gC(l);continue}let i=l,h=i==o.body,p=h?d0t(o):u0t(i),x=0,y=0;if(e.topp.bottom-px(s,"bottom")&&(y=e.bottom-e.top>p.bottom-p.top?e.top+px(a,"top")-p.top:e.bottom-p.bottom+px(a,"bottom")),e.leftp.right-px(s,"right")&&(x=e.right-p.right+px(a,"right")),x||y)if(h)o.defaultView.scrollBy(x,y);else{let j=i.scrollLeft,C=i.scrollTop;y&&(i.scrollTop+=y),x&&(i.scrollLeft+=x);let N=i.scrollLeft-j,A=i.scrollTop-C;e={left:e.left-N,top:e.top-A,right:e.right-N,bottom:e.bottom-A}}let b=h?"fixed":getComputedStyle(l).position;if(/^(fixed|sticky)$/.test(b))break;l=b=="absolute"?l.offsetParent:gC(l)}}function h0t(t){let e=t.dom.getBoundingClientRect(),n=Math.max(0,e.top),s,a;for(let o=(e.left+e.right)/2,l=n+1;l=n-20){s=i,a=h.top;break}}return{refDOM:s,refTop:a,stack:HRe(t.dom)}}function HRe(t){let e=[],n=t.ownerDocument;for(let s=t;s&&(e.push({dom:s,top:s.scrollTop,left:s.scrollLeft}),t!=n);s=gC(s));return e}function f0t({refDOM:t,refTop:e,stack:n}){let s=t?t.getBoundingClientRect().top:0;WRe(n,s==0?0:s-e)}function WRe(t,e){for(let n=0;n=i){l=Math.max(C.bottom,l),i=Math.min(C.top,i);let N=C.left>e.left?C.left-e.left:C.right=(C.left+C.right)/2?1:0));continue}}else C.top>e.top&&!h&&C.left<=e.left&&C.right>=e.left&&(h=x,p={left:Math.max(C.left,Math.min(C.right,e.left)),top:C.top});!n&&(e.left>=C.right&&e.top>=C.top||e.left>=C.left&&e.top>=C.bottom)&&(o=y+1)}}return!n&&h&&(n=h,a=p,s=0),n&&n.nodeType==3?m0t(n,a):!n||s&&n.nodeType==1?{node:t,offset:o}:GRe(n,a)}function m0t(t,e){let n=t.nodeValue.length,s=document.createRange(),a;for(let o=0;o=(l.left+l.right)/2?1:0)};break}}return s.detach(),a||{node:t,offset:0}}function Bxe(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function g0t(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 y0t(t,e,n,s){let a=-1;for(let o=e,l=!1;o!=t.dom;){let i=t.docView.nearestDesc(o,!0),h;if(!i)return null;if(i.dom.nodeType==1&&(i.node.isBlock&&i.parent||!i.contentDOM)&&((h=i.dom.getBoundingClientRect()).width||h.height)&&(i.node.isBlock&&i.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(i.dom.nodeName)&&(!l&&h.left>s.left||h.top>s.top?a=i.posBefore:(!l&&h.right-1?a:t.docView.posFromDOM(e,n,-1)}function KRe(t,e,n){let s=t.childNodes.length;if(s&&n.tope.top&&a++}let p;LI&&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=y0t(t,s,a,e))}i==null&&(i=x0t(t,l,e));let h=t.docView.nearestDesc(l,!0);return{pos:i,inside:h?h.posAtStart-h.border:-1}}function Qke(t){return t.top=0&&a==s.nodeValue.length?(h--,x=1):n<0?h--:p++,zM(h0(wx(s,h,p),x),x<0)}if(!t.state.doc.resolve(e-(o||0)).parent.inlineContent){if(o==null&&a&&(n<0||a==Uf(s))){let h=s.childNodes[a-1];if(h.nodeType==1)return uce(h.getBoundingClientRect(),!1)}if(o==null&&a=0)}if(o==null&&a&&(n<0||a==Uf(s))){let h=s.childNodes[a-1],p=h.nodeType==3?wx(h,Uf(h)-(l?0:1)):h.nodeType==1&&(h.nodeName!="BR"||!h.nextSibling)?h:null;if(p)return zM(h0(p,1),!1)}if(o==null&&a=0)}function zM(t,e){if(t.width==0)return t;let n=e?t.left:t.right;return{top:t.top,bottom:t.bottom,left:n,right:n}}function uce(t,e){if(t.height==0)return t;let n=e?t.top:t.bottom;return{top:n,bottom:n,left:t.left,right:t.right}}function YRe(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 b0t(t,e,n){let s=e.selection,a=n=="up"?s.$from:s.$to;return YRe(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=ZRe(t,a.pos,1);for(let i=o.firstChild;i;i=i.nextSibling){let h;if(i.nodeType==1)h=i.getClientRects();else if(i.nodeType==3)h=wx(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 w0t=/[\u0590-\u08ac]/;function j0t(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?!w0t.test(s.parent.textContent)||!i.modify?n=="left"||n=="backward"?o:l:YRe(t,e,()=>{let{focusNode:h,focusOffset:p,anchorNode:x,anchorOffset:y}=t.domSelectionRange(),b=i.caretBidiLevel;i.modify("move",n,"character");let j=s.depth?t.docView.domAfterPos(s.before()):t.dom,{focusNode:C,focusOffset:N}=t.domSelectionRange(),A=C&&!j.contains(C.nodeType==1?C:C.parentNode)||h==C&&p==N;try{i.collapse(x,y),h&&(h!=x||p!=y)&&i.extend&&i.extend(h,p)}catch{}return b!=null&&(i.caretBidiLevel=b),A}):s.pos==s.start()||s.pos==s.end()}let Jke=null,eNe=null,tNe=!1;function k0t(t,e,n){return Jke==e&&eNe==n?tNe:(Jke=e,eNe=n,tNe=n=="up"||n=="down"?b0t(t,e,n):j0t(t,e,n))}const ep=0,rNe=1,$w=2,Lg=3;class OI{constructor(e,n,s,a){this.parent=e,this.children=n,this.dom=s,this.contentDOM=a,this.dirty=ep,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;nId(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 QRe){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 XRe&&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?Id(o.dom)+1:0}}else{let o,l=!0;for(;o=s=x&&n<=p-h.border&&h.node&&h.contentDOM&&this.contentDOM.contains(h.contentDOM))return h.parseRange(e,n,x);e=l;for(let y=i;y>0;y--){let b=this.children[y-1];if(b.size&&b.dom.parentNode==this.contentDOM&&!b.emptyChildAt(1)){a=Id(b.dom)+1;break}e-=b.size}a==-1&&(a=0)}if(a>-1&&(p>n||i==this.children.length-1)){n=p;for(let x=i+1;xC&&ln){let C=i;i=h,h=C}let j=document.createRange();j.setEnd(h.node,h.offset),j.setStart(i.node,i.offset),p.removeAllRanges(),p.addRange(j)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,n){for(let s=0,a=0;a=s:es){let i=s+o.border,h=l-o.border;if(e>=i&&n<=h){this.dirty=e==s||n==l?$w:rNe,e==i&&n==h&&(o.contentLost||o.dom.parentNode!=this.contentDOM)?o.dirty=Lg:o.markDirty(e-i,n-i);return}else o.dirty=o.dom==o.contentDOM&&o.dom.parentNode==this.contentDOM&&!o.children.length?$w:Lg}s=l}this.dirty=$w}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let s=e==1?$w:rNe;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==ep&&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 N0t extends OI{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 Kj extends OI{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=ck.renderSpec(document,n.type.spec.toDOM(n,s),null,n.attrs)),new Kj(e,n,l.dom,l.contentDOM||l.dom,l)}parseRule(){return this.dirty&Lg||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Lg&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=ep){let s=this.parent;for(;!s.node;)s=s.parent;s.dirty0&&(o=zhe(o,0,e,s));for(let i=0;i{if(!h)return l;if(h.parent)return h.parent.posBeforeChild(h)},s,a),x=p&&p.dom,y=p&&p.contentDOM;if(n.isText){if(!x)x=document.createTextNode(n.text);else if(x.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else x||({dom:x,contentDOM:y}=ck.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 b=x;return x=tFe(x,s,n),p?h=new S0t(e,n,s,a,x,y||null,b,p,o,l+1):n.isText?new Lse(e,n,s,a,x,b,o):new A1(e,n,s,a,x,y||null,b,o,l+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let n=this.children.length-1;n>=0;n--){let s=this.children[n];if(this.dom.contains(s.dom.parentNode)){e.contentElement=s.dom.parentNode;break}}e.contentElement||(e.getContent=()=>_n.empty)}return e}matchesNode(e,n,s){return this.dirty==ep&&e.eq(this.node)&&Mte(n,this.outerDeco)&&s.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,n){let s=this.node.inlineContent,a=n,o=e.composing?this.localCompositionInfo(e,n):null,l=o&&o.pos>-1?o:null,i=o&&o.pos<0,h=new M0t(this,l&&l.node,e);E0t(this.node,this.innerDeco,(p,x,y)=>{p.spec.marks?h.syncToMarks(p.spec.marks,s,e):p.type.side>=0&&!y&&h.syncToMarks(x==this.node.childCount?Ro.none:this.node.child(x).marks,s,e),h.placeWidget(p,e,a)},(p,x,y,b)=>{h.syncToMarks(p.marks,s,e);let j;h.findNodeMatch(p,x,y,b)||i&&e.state.selection.from>a&&e.state.selection.to-1&&h.updateNodeAt(p,x,y,j,e)||h.updateNextNode(p,x,y,e,b,a)||h.addNode(p,x,y,e,a),a+=p.nodeSize}),h.syncToMarks([],s,e),this.node.isTextblock&&h.addTextblockHacks(),h.destroyRest(),(h.changed||this.dirty==$w)&&(l&&this.protectLocalComposition(e,l),JRe(this.contentDOM,this.children,e),xC&&I0t(this.dom))}localCompositionInfo(e,n){let{from:s,to:a}=e.state.selection;if(!(e.state.selection instanceof Va)||sn+this.node.content.size)return null;let o=e.input.compositionNode;if(!o||!this.dom.contains(o.parentNode))return null;if(this.node.inlineContent){let l=o.nodeValue,i=P0t(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 N0t(this,o,n,a);e.input.compositionNodes.push(l),this.children=zhe(this.children,s,s+a.length,e,l)}update(e,n,s,a){return this.dirty==Lg||!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=ep}updateOuterDeco(e){if(Mte(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,s=this.dom;this.dom=eFe(this.dom,this.nodeDOM,Fhe(this.outerDeco,this.node,n),Fhe(e,this.node,n)),this.dom!=s&&(s.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function nNe(t,e,n,s,a){tFe(s,e,t);let o=new A1(void 0,t,e,n,s,s,s,a,0);return o.contentDOM&&o.updateChildren(a,0),o}class Lse extends A1{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==Lg||this.dirty!=ep&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=ep||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=ep,!0)}inParent(){let e=this.parent.contentDOM;for(let n=this.nodeDOM;n;n=n.parentNode)if(n==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,n,s){return e==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):super.localPosFromDOM(e,n,s)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,n,s){let a=this.node.cut(e,n),o=document.createTextNode(a.text);return new Lse(this.parent,a,this.outerDeco,this.innerDeco,o,o,s)}markDirty(e,n){super.markDirty(e,n),this.dom!=this.nodeDOM&&(e==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=Lg)}get domAtom(){return!1}isText(e){return this.node.text==e}}class QRe extends OI{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==ep&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class S0t extends A1{constructor(e,n,s,a,o,l,i,h,p,x){super(e,n,s,a,o,l,i,p,x),this.spec=h}update(e,n,s,a){if(this.dirty==Lg)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 JRe(t,e,n){let s=t.firstChild,a=!1;for(let o=0;o>1,l=Math.min(o,e.length);for(;a-1)i>this.index&&(this.changed=!0,this.destroyBetween(this.index,i)),this.top=this.top.children[this.index];else{let h=Kj.create(this.top,e[o],n,s);this.top.children.splice(this.index,0,h),this.top=h,this.changed=!0}this.index=0,o++}}findNodeMatch(e,n,s,a){let o=-1,l;if(a>=this.preMatch.index&&(l=this.preMatch.matches[a-this.preMatch.index]).parent==this.top&&l.matchesNode(e,n,s))o=this.top.children.indexOf(l,this.index);else for(let i=this.index,h=Math.min(this.top.children.length,i+5);i0;){let i;for(;;)if(s){let p=n.children[s-1];if(p instanceof Kj)n=p,s=p.children.length;else{i=p,s--;break}}else{if(n==e)break e;s=n.parent.children.indexOf(n),n=n.parent}let h=i.node;if(h){if(h!=t.child(a-1))break;--a,o.set(i,a),l.push(i)}}return{index:a,matched:o,matches:l.reverse()}}function A0t(t,e){return t.type.side-e.type.side}function E0t(t,e,n,s){let a=e.locals(t),o=0;if(a.length==0){for(let p=0;po;)i.push(a[l++]);let C=o+b.nodeSize;if(b.isText){let A=C;l!A.inline):i.slice();s(b,N,e.forChild(o,b),j),o=C}}function I0t(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 P0t(t,e,n,s){for(let a=0,o=0;a=n){if(o>=s&&h.slice(s-e.length-i,s-i)==e)return s-e.length;let p=i=0&&p+e.length+i>=n)return i+p;if(n==s&&h.length>=s+e.length-i&&h.slice(s-i,s-i+e.length)==e)return s}}return-1}function zhe(t,e,n,s,a){let o=[];for(let l=0,i=0;l=n||x<=e?o.push(h):(pn&&o.push(h.slice(n-p,h.size,s)))}return o}function $xe(t,e=null){let n=t.domSelectionRange(),s=t.state.doc;if(!n.focusNode)return null;let a=t.docView.nearestDesc(n.focusNode),o=a&&a.size==0,l=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(l<0)return null;let i=s.resolve(l),h,p;if(Pse(n)){for(h=l;a&&!a.node;)a=a.parent;let y=a.node;if(a&&y.isAtom&&aa.isSelectable(y)&&a.parent&&!(y.isInline&&i0t(n.focusNode,n.focusOffset,a.dom))){let b=a.posBefore;p=new aa(l==b?i:s.resolve(b))}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let y=l,b=l;for(let j=0;j{(n.anchorNode!=s||n.anchorOffset!=a)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!rFe(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function O0t(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom,s=n.nodeName=="IMG";s?e.collapse(n.parentNode,Id(n)+1):e.collapse(n,0),!s&&!t.state.selection.visible&&_h&&T1<=11&&(n.disabled=!0,n.disabled=!1)}function nFe(t,e){if(e instanceof aa){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(lNe(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else lNe(t)}function lNe(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function Uxe(t,e,n,s){return t.someProp("createSelectionBetween",a=>a(t,e,n))||Va.between(e,n,s)}function cNe(t){return t.editable&&!t.hasFocus()?!1:sFe(t)}function sFe(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 D0t(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return Gj(e.node,e.offset,n.anchorNode,n.anchorOffset)}function Bhe(t,e){let{$anchor:n,$head:s}=t.selection,a=e>0?n.max(s):n.min(s),o=a.parent.inlineContent?a.depth?t.doc.resolve(e>0?a.after():a.before()):null:a;return o&&ui.findFrom(o,e)}function b0(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function dNe(t,e,n){let s=t.state.selection;if(s instanceof Va)if(n.indexOf("s")>-1){let{$head:a}=s,o=a.textOffset?null:e<0?a.nodeBefore:a.nodeAfter;if(!o||o.isText||!o.isLeaf)return!1;let l=t.state.doc.resolve(a.pos+o.nodeSize*(e<0?-1:1));return b0(t,new Va(s.$anchor,l))}else if(s.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let a=Bhe(t.state,e);return a&&a instanceof aa?b0(t,a):!1}else if(!(Rf&&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)?b0(t,new aa(e<0?t.state.doc.resolve(a.pos-o.nodeSize):a)):LI?b0(t,new Va(t.state.doc.resolve(e<0?i:i+o.nodeSize))):!1:!1}}else return!1;else{if(s instanceof aa&&s.node.isInline)return b0(t,new Va(e>0?s.$to:s.$from));{let a=Bhe(t.state,e);return a?b0(t,a):!1}}}function Tte(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function fA(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function h4(t,e){return e<0?R0t(t):F0t(t)}function R0t(t){let e=t.domSelectionRange(),n=e.focusNode,s=e.focusOffset;if(!n)return;let a,o,l=!1;for(Jf&&n.nodeType==1&&s0){if(n.nodeType!=1)break;{let i=n.childNodes[s-1];if(fA(i,-1))a=n,o=--s;else if(i.nodeType==3)n=i,s=n.nodeValue.length;else break}}else{if(aFe(n))break;{let i=n.previousSibling;for(;i&&fA(i,-1);)a=n.parentNode,o=Id(i),i=i.previousSibling;if(i)n=i,s=Tte(n);else{if(n=n.parentNode,n==t.dom)break;s=0}}}l?$he(t,n,s):a&&$he(t,a,o)}function F0t(t){let e=t.domSelectionRange(),n=e.focusNode,s=e.focusOffset;if(!n)return;let a=Tte(n),o,l;for(;;)if(s{t.state==a&&Kx(t)},50)}function uNe(t,e){let n=t.state.doc.resolve(e);if(!(dd||VRe)&&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 hNe(t,e,n){let s=t.state.selection;if(s instanceof Va&&!s.empty||n.indexOf("s")>-1||Rf&&n.indexOf("m")>-1)return!1;let{$from:a,$to:o}=s;if(!a.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let l=Bhe(t.state,e);if(l&&l instanceof aa)return b0(t,l)}if(!a.parent.inlineContent){let l=e<0?a:o,i=s instanceof af?ui.near(l,e):ui.findFrom(l,e);return i?b0(t,i):!1}return!1}function fNe(t,e){if(!(t.state.selection instanceof Va))return!0;let{$head:n,$anchor:s,empty:a}=t.state.selection;if(!n.sameParent(s))return!0;if(!a)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let o=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(o&&!o.isText){let l=t.state.tr;return e<0?l.delete(n.pos-o.nodeSize,n.pos):l.delete(n.pos,n.pos+o.nodeSize),t.dispatch(l),!0}return!1}function pNe(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function $0t(t){if(!hu||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;pNe(t,s,"true"),setTimeout(()=>pNe(t,s,"false"),20)}return!1}function U0t(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function q0t(t,e){let n=e.keyCode,s=U0t(e);if(n==8||Rf&&n==72&&s=="c")return fNe(t,-1)||h4(t,-1);if(n==46&&!e.shiftKey||Rf&&n==68&&s=="c")return fNe(t,1)||h4(t,1);if(n==13||n==27)return!0;if(n==37||Rf&&n==66&&s=="c"){let a=n==37?uNe(t,t.state.selection.from)=="ltr"?-1:1:-1;return dNe(t,a,s)||h4(t,a)}else if(n==39||Rf&&n==70&&s=="c"){let a=n==39?uNe(t,t.state.selection.from)=="ltr"?1:-1:1;return dNe(t,a,s)||h4(t,a)}else{if(n==38||Rf&&n==80&&s=="c")return hNe(t,-1,s)||h4(t,-1);if(n==40||Rf&&n==78&&s=="c")return $0t(t)||hNe(t,1,s)||h4(t,1);if(s==(Rf?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function qxe(t,e){t.someProp("transformCopied",j=>{e=j(e,t)});let n=[],{content:s,openStart:a,openEnd:o}=e;for(;a>1&&o>1&&s.childCount==1&&s.firstChild.childCount==1;){a--,o--;let j=s.firstChild;n.push(j.type.name,j.attrs!=j.type.defaultAttrs?j.attrs:null),s=j.content}let l=t.someProp("clipboardSerializer")||ck.fromSchema(t.state.schema),i=uFe(),h=i.createElement("div");h.appendChild(l.serializeFragment(s,{document:i}));let p=h.firstChild,x,y=0;for(;p&&p.nodeType==1&&(x=dFe[p.nodeName.toLowerCase()]);){for(let j=x.length-1;j>=0;j--){let C=i.createElement(x[j]);for(;h.firstChild;)C.appendChild(h.firstChild);h.appendChild(C),y++}p=h.firstChild}p&&p.nodeType==1&&p.setAttribute("data-pm-slice",`${a} ${o}${y?` -${y}`:""} ${JSON.stringify(n)}`);let b=t.someProp("clipboardTextSerializer",j=>j(e,t))||e.content.textBetween(0,e.content.size,` `);return{dom:h,text:b,slice:e}}function iFe(t,e,n,s,a){let o=a.parent.type.spec.code,l,i;if(!n&&!e)return null;let h=!!e&&(s||o||!n);if(h){if(t.someProp("transformPastedText",b=>{e=b(e,o||s,t)}),o)return i=new fs(_n.from(t.state.schema.text(e.replace(/\r\n?/g,` `))),0,0),t.someProp("transformPasted",b=>{i=b(i,t,!0)}),i;let y=t.someProp("clipboardTextParser",b=>b(e,a,s,t));if(y)i=y;else{let b=a.marks(),{schema:j}=t.state,C=ck.fromSchema(j);l=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(N=>{let A=l.appendChild(document.createElement("p"));N&&A.appendChild(C.serializeNode(j.text(N,b)))})}}else t.someProp("transformPastedHTML",y=>{n=y(n,t)}),l=G0t(n),LI&&K0t(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 b=l.firstChild;for(;b&&b.nodeType!=1;)b=b.nextSibling;if(!b)break;l=b}if(i||(i=(t.someProp("clipboardParser")||t.someProp("domParser")||dA.fromSchema(t.state.schema)).parseSlice(l,{preserveWhitespace:!!(h||x),context:a,ruleFromNode(b){return b.nodeName=="BR"&&!b.nextSibling&&b.parentNode&&!V0t.test(b.parentNode.nodeName)?{ignore:!0}:null}})),x)i=Z0t(mNe(i,+x[1],+x[2]),x[4]);else if(i=fs.maxOpen(H0t(i.content,a),!0),i.openStart||i.openEnd){let y=0,b=0;for(let j=i.content.firstChild;y{i=y(i,t,h)}),i}const V0t=/^(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 H0t(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let a=e.node(n).contentMatchAt(e.index(n)),o,l=[];if(t.forEach(i=>{if(!l)return;let h=a.findWrapping(i.type),p;if(!h)return l=null;if(p=l.length&&o.length&&lFe(h,o,i,l[l.length-1],0))l[l.length-1]=p;else{l.length&&(l[l.length-1]=cFe(l[l.length-1],o.length));let x=oFe(i,h);l.push(x),a=a.matchType(x.type),o=h}}),l)return _n.from(l)}return t}function oFe(t,e,n=0){for(let s=e.length-1;s>=n;s--)t=e[s].create(null,_n.from(t));return t}function lFe(t,e,n,s,a){if(a1&&(o=0),a=n&&(i=e<0?l.contentMatchAt(0).fillBefore(i,o<=a).append(i):i.append(l.contentMatchAt(l.childCount).fillBefore(_n.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,l.copy(i))}function mNe(t,e,n){return en})),fce.createHTML(t)):t}function G0t(t){let e=/^(\s*]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=uFe().createElement("div"),s=/<([a-z][^>\s]+)/i.exec(t),a;if((a=s&&dFe[s[1].toLowerCase()])&&(t=a.map(o=>"<"+o+">").join("")+t+a.map(o=>"").reverse().join("")),n.innerHTML=W0t(t),a)for(let o=0;o=0;i-=2){let h=n.nodes[s[i]];if(!h||h.hasRequiredAttrs())break;a=_n.from(h.create(s[i+1],a)),o++,l++}return new fs(a,o,l)}const $u={},Uu={},Y0t={touchstart:!0,touchmove:!0};class X0t{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 Q0t(t){for(let e in $u){let n=$u[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=s=>{e1t(t,s)&&!Vxe(t,s)&&(t.editable||!(s.type in Uu))&&n(t,s)},Y0t[e]?{passive:!0}:void 0)}hu&&t.dom.addEventListener("input",()=>null),qhe(t)}function Y0(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function J0t(t){t.domObserver.stop();for(let e in t.input.eventHandlers)t.dom.removeEventListener(e,t.input.eventHandlers[e]);clearTimeout(t.input.composingTimeout),clearTimeout(t.input.lastIOSEnterFallbackTimeout)}function qhe(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=s=>Vxe(t,s))})}function Vxe(t,e){return t.someProp("handleDOMEvents",n=>{let s=n[e.type];return s?s(t,e)||e.defaultPrevented:!1})}function e1t(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 t1t(t,e){!Vxe(t,e)&&$u[e.type]&&(t.editable||!(e.type in Uu))&&$u[e.type](t,e)}Uu.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!fFe(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(Lx&&dd&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),xC&&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,Iw(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",s=>s(t,n))||q0t(t,n)?n.preventDefault():Y0(t,"key")};Uu.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};Uu.keypress=(t,e)=>{let n=e;if(fFe(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||Rf&&n.metaKey)return;if(t.someProp("handleKeyPress",a=>a(t,n))){n.preventDefault();return}let s=t.state.selection;if(!(s instanceof Va)||!s.$from.sameParent(s.$to)){let a=String.fromCharCode(n.charCode),o=()=>t.state.tr.insertText(a).scrollIntoView();!/[\r\n]/.test(a)&&!t.someProp("handleTextInput",l=>l(t,s.$from.pos,s.$to.pos,a,o))&&t.dispatch(o()),n.preventDefault()}};function Ose(t){return{left:t.clientX,top:t.clientY}}function r1t(t,e){let n=e.x-t.clientX,s=e.y-t.clientY;return n*n+s*s<100}function Hxe(t,e,n,s,a){if(s==-1)return!1;let o=t.state.doc.resolve(s);for(let l=o.depth+1;l>0;l--)if(t.someProp(e,i=>l>o.depth?i(t,n,o.nodeAfter,o.before(l),a,!0):i(t,n,o.node(l),o.before(l),a,!1)))return!0;return!1}function ES(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 n1t(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),s=n.nodeAfter;return s&&s.isAtom&&aa.isSelectable(s)?(ES(t,new aa(n)),!0):!1}function s1t(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?(ES(t,aa.create(t.state.doc,a)),!0):!1}function a1t(t,e,n,s,a){return Hxe(t,"handleClickOn",e,n,s)||t.someProp("handleClick",o=>o(t,e,s))||(a?s1t(t,n):n1t(t,n))}function i1t(t,e,n,s){return Hxe(t,"handleDoubleClickOn",e,n,s)||t.someProp("handleDoubleClick",a=>a(t,e,s))}function o1t(t,e,n,s){return Hxe(t,"handleTripleClickOn",e,n,s)||t.someProp("handleTripleClick",a=>a(t,e,s))||l1t(t,n,s)}function l1t(t,e,n){if(n.button!=0)return!1;let s=t.state.doc;if(e==-1)return s.inlineContent?(ES(t,Va.create(s,0,s.content.size)),!0):!1;let a=s.resolve(e);for(let o=a.depth+1;o>0;o--){let l=o>a.depth?a.nodeAfter:a.node(o),i=a.before(o);if(l.inlineContent)ES(t,Va.create(s,i+1,i+1+l.content.size));else if(aa.isSelectable(l))ES(t,aa.create(s,i));else continue;return!0}}function Wxe(t){return Ate(t)}const hFe=Rf?"metaKey":"ctrlKey";$u.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let s=Wxe(t),a=Date.now(),o="singleClick";a-t.input.lastClick.time<500&&r1t(n,t.input.lastClick)&&!n[hFe]&&t.input.lastClick.button==n.button&&(t.input.lastClick.type=="singleClick"?o="doubleClick":t.input.lastClick.type=="doubleClick"&&(o="tripleClick")),t.input.lastClick={time:a,x:n.clientX,y:n.clientY,type:o,button:n.button};let l=t.posAtCoords(Ose(n));l&&(o=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new c1t(t,l,n,!!s)):(o=="doubleClick"?i1t:o1t)(t,l.pos,l.inside,n)?n.preventDefault():Y0(t,"pointer"))};class c1t{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[hFe],this.allowDefault=s.shiftKey;let o,l;if(n.inside>-1)o=e.state.doc.nodeAt(n.inside),l=n.inside;else{let x=e.state.doc.resolve(n.pos);o=x.parent,l=x.depth?x.before():0}const i=a?null:s.target,h=i?e.docView.nearestDesc(i,!0):null;this.target=h&&h.nodeDOM.nodeType==1?h.nodeDOM:null;let{selection:p}=e.state;(s.button==0&&o.type.spec.draggable&&o.type.spec.selectable!==!1||p instanceof aa&&p.from<=l&&p.to>l)&&(this.mightDrag={node:o,pos:l,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Jf&&!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)),Y0(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(()=>Kx(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let n=this.pos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords(Ose(e))),this.updateAllowDefault(e),this.allowDefault||!n?Y0(this.view,"pointer"):a1t(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||hu&&this.mightDrag&&!this.mightDrag.node.isAtom||dd&&!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)?(ES(this.view,ui.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):Y0(this.view,"pointer")}move(e){this.updateAllowDefault(e),Y0(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)}}$u.touchstart=t=>{t.input.lastTouch=Date.now(),Wxe(t),Y0(t,"pointer")};$u.touchmove=t=>{t.input.lastTouch=Date.now(),Y0(t,"pointer")};$u.contextmenu=t=>Wxe(t);function fFe(t,e){return t.composing?!0:hu&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const d1t=Lx?5e3:-1;Uu.compositionstart=Uu.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof Va&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(s=>s.type.spec.inclusive===!1)||dd&&VRe&&u1t(t)))t.markCursor=t.state.storedMarks||n.marks(),Ate(t,!0),t.markCursor=null;else if(Ate(t,!e.selection.empty),Jf&&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}pFe(t,d1t)};function u1t(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"}Uu.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++,pFe(t,20))};function pFe(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>Ate(t),e))}function mFe(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=f1t());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function h1t(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=s0t(e.focusNode,e.focusOffset),s=a0t(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 f1t(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function Ate(t,e=!1){if(!(Lx&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),mFe(t),e||t.docView&&t.docView.dirty){let n=$xe(t),s=t.state.selection;return n&&!n.eq(s)?t.dispatch(t.state.tr.setSelection(n)):(t.markCursor||e)&&!s.$from.node(s.$from.sharedDepth(s.to)).inlineContent?t.dispatch(t.state.tr.deleteSelection()):t.updateState(t.state),!0}return!1}}function p1t(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 dE=_h&&T1<15||xC&&c0t<604;$u.copy=Uu.cut=(t,e)=>{let n=e,s=t.state.selection,a=n.type=="cut";if(s.empty)return;let o=dE?null:n.clipboardData,l=s.content(),{dom:i,text:h}=qxe(t,l);o?(n.preventDefault(),o.clearData(),o.setData("text/html",i.innerHTML),o.setData("text/plain",h)):p1t(t,i),a&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function m1t(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function g1t(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?uE(t,s.value,null,a,e):uE(t,s.textContent,s.innerHTML,a,e)},50)}function uE(t,e,n,s,a){let o=iFe(t,e,n,s,t.state.selection.$from);if(t.someProp("handlePaste",h=>h(t,a,o||fs.empty)))return!0;if(!o)return!1;let l=m1t(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 gFe(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," "):""}Uu.paste=(t,e)=>{let n=e;if(t.composing&&!Lx)return;let s=dE?null:n.clipboardData,a=t.input.shiftKey&&t.input.lastKeyCode!=45;s&&uE(t,gFe(s),s.getData("text/html"),a,n)?n.preventDefault():g1t(t,n)};class xFe{constructor(e,n,s){this.slice=e,this.move=n,this.node=s}}const x1t=Rf?"altKey":"ctrlKey";function yFe(t,e){let n=t.someProp("dragCopies",s=>!s(e));return n??!e[x1t]}$u.dragstart=(t,e)=>{let n=e,s=t.input.mouseDown;if(s&&s.done(),!n.dataTransfer)return;let a=t.state.selection,o=a.empty?null:t.posAtCoords(Ose(n)),l;if(!(o&&o.pos>=a.from&&o.pos<=(a instanceof aa?a.to-1:a.to))){if(s&&s.mightDrag)l=aa.create(t.state.doc,s.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let y=t.docView.nearestDesc(n.target,!0);y&&y.node.type.spec.draggable&&y!=t.docView&&(l=aa.create(t.state.doc,y.posBefore))}}let i=(l||t.state.selection).content(),{dom:h,text:p,slice:x}=qxe(t,i);(!n.dataTransfer.files.length||!dd||qRe>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(dE?"Text":"text/html",h.innerHTML),n.dataTransfer.effectAllowed="copyMove",dE||n.dataTransfer.setData("text/plain",p),t.dragging=new xFe(x,yFe(t,n),l)};$u.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};Uu.dragover=Uu.dragenter=(t,e)=>e.preventDefault();Uu.drop=(t,e)=>{try{y1t(t,e,t.dragging)}finally{t.dragging=null}};function y1t(t,e,n){if(!e.dataTransfer)return;let s=t.posAtCoords(Ose(e));if(!s)return;let a=t.state.doc.resolve(s.pos),o=n&&n.slice;o?t.someProp("transformPasted",j=>{o=j(o,t,!1)}):o=iFe(t,gFe(e.dataTransfer),dE?null:e.dataTransfer.getData("text/html"),!1,a);let l=!!(n&&yFe(t,e));if(t.someProp("handleDrop",j=>j(t,e,o||fs.empty,l))){e.preventDefault();return}if(!o)return;e.preventDefault();let i=o?LRe(t.state.doc,a.pos,o):a.pos;i==null&&(i=a.pos);let h=t.state.tr;if(l){let{node:j}=n;j?j.replace(h):h.deleteSelection()}let p=h.mapping.map(i),x=o.openStart==0&&o.openEnd==0&&o.content.childCount==1,y=h.doc;if(x?h.replaceRangeWith(p,p,o.content.firstChild):h.replaceRange(p,p,o),h.doc.eq(y))return;let b=h.doc.resolve(p);if(x&&aa.isSelectable(o.content.firstChild)&&b.nodeAfter&&b.nodeAfter.sameMarkup(o.content.firstChild))h.setSelection(new aa(b));else{let j=h.mapping.map(i);h.mapping.maps[h.mapping.maps.length-1].forEach((C,N,A,E)=>j=E),h.setSelection(Uxe(t,b,h.doc.resolve(j)))}t.focus(),t.dispatch(h.setMeta("uiEvent","drop"))}$u.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())&&Kx(t)},20))};$u.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)};$u.beforeinput=(t,e)=>{if(dd&&Lx&&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,Iw(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 Uu)$u[t]=Uu[t];function hE(t,e){if(t==e)return!0;for(let n in t)if(t[n]!==e[n])return!1;for(let n in e)if(!(n in t))return!1;return!0}class Ete{constructor(e,n){this.toDOM=e,this.spec=n||Nj,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 Hf(o-s,o-s,this)}valid(){return!0}eq(e){return this==e||e instanceof Ete&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&hE(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class E1{constructor(e,n){this.attrs=e,this.spec=n||Nj}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 Hf(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==Yd||e.maps.length==0?this:this.mapInner(e,n,0,0,s||Nj)}mapInner(e,n,s,a,o){let l;for(let i=0;i{let p=h+s,x;if(x=_Fe(n,i,p)){for(a||(a=this.children.slice());oi&&y.to=e){this.children[i]==e&&(s=this.children[i+2]);break}let o=e+1,l=o+n.content.size;for(let i=0;io&&h.type instanceof E1){let p=Math.max(o,h.from)-o,x=Math.min(l,h.to)-o;pa.map(e,n,Nj));return T0.from(s)}forChild(e,n){if(n.isLeaf)return Uc.empty;let s=[];for(let a=0;an instanceof Uc)?e:e.reduce((n,s)=>n.concat(s instanceof Uc?s:s.members),[]))}}forEachSet(e){for(let n=0;n{let A=N-C-(j-b);for(let E=0;ET+x-y)continue;let L=i[E]+x-y;j>=L?i[E+1]=b<=L?-2:-1:b>=x&&A&&(i[E]+=A,i[E+1]+=A)}y+=A}),x=n.maps[p].map(x,-1)}let h=!1;for(let p=0;p=s.content.size){h=!0;continue}let b=n.map(t[p+1]+o,-1),j=b-a,{index:C,offset:N}=s.content.findIndex(y),A=s.maybeChild(C);if(A&&N==y&&N+A.nodeSize==j){let E=i[p+2].mapInner(n,A,x+1,t[p]+o+1,l);E!=Yd?(i[p]=y,i[p+1]=j,i[p+2]=E):(i[p+1]=-2,h=!0)}else h=!0}if(h){let p=_1t(i,t,e,n,a,o,l),x=Ite(p,s,0,l);e=x.local;for(let y=0;yn&&l.to{let p=_Fe(t,i,h+n);if(p){o=!0;let x=Ite(p,i,n+h+1,s);x!=Yd&&a.push(h,h+i.nodeSize,x)}});let l=vFe(o?bFe(t):t,-n).sort(Sj);for(let i=0;i0;)e++;t.splice(e,0,n)}function pce(t){let e=[];return t.someProp("decorations",n=>{let s=n(t.state);s&&s!=Yd&&e.push(s)}),t.cursorWrapper&&e.push(Uc.create(t.state.doc,[t.cursorWrapper.deco])),T0.from(e)}const b1t={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},w1t=_h&&T1<=11;class j1t{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 k1t{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new j1t,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()}),w1t&&(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,b1t)),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(cNe(this.view)){if(this.suppressingSelectionUpdates)return Kx(this.view);if(_h&&T1<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&Gj(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=gC(o))n.add(o);for(let o=e.anchorNode;o;o=gC(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)&&cNe(e)&&!this.ignoreSelectionChange(s),o=-1,l=-1,i=!1,h=[];if(e.editable)for(let x=0;xy.nodeName=="BR");if(x.length==2){let[y,b]=x;y.parentNode&&y.parentNode.parentNode==b.parentNode?b.remove():y.remove()}else{let{focusNode:y}=this.currentSelection;for(let b of x){let j=b.parentNode;j&&j.nodeName=="LI"&&(!y||C1t(e,y)!=j)&&b.remove()}}}else if((dd||hu)&&h.some(x=>x.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46)){for(let x of h)if(x.nodeName=="BR"&&x.parentNode){let y=x.nextSibling;y&&y.nodeType==1&&y.contentEditable=="false"&&x.parentNode.removeChild(x)}}let p=null;o<0&&a&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)-1||a)&&(o>-1&&(e.docView.markDirty(o,l),N1t(e)),this.handleDOMChange(o,l,i,h),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(s)||Kx(e),this.currentSelection.set(s))}registerMutation(e,n){if(n.indexOf(e.target)>-1)return null;let s=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(s==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!s||s.ignoreMutation(e))return null;if(e.type=="childList"){for(let x=0;xa;A--){let E=s.childNodes[A-1],T=E.pmViewDesc;if(E.nodeName=="BR"&&!T){o=A;break}if(!T||T.size)break}let y=t.state.doc,b=t.someProp("domParser")||dA.fromSchema(t.state.schema),j=y.resolve(l),C=null,N=b.parse(s,{topNode:j.parent,topMatch:j.parent.contentMatchAt(j.index()),topOpen:!0,from:a,to:o,preserveWhitespace:j.parent.type.whitespace=="pre"?"full":!0,findPositions:p,ruleFromNode:T1t,context:j});if(p&&p[0].pos!=null){let A=p[0].pos,E=p[1]&&p[1].pos;E==null&&(E=A),C={anchor:A+l,head:E+l}}return{doc:N,sel:C,from:l,to:i}}function T1t(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(hu&&/^(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||hu&&/^(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 A1t=/^(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 E1t(t,e,n,s,a){let o=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let H=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,Z=$xe(t,H);if(Z&&!t.state.selection.eq(Z)){if(dd&&Lx&&t.input.lastKeyCode===13&&Date.now()-100te(t,Iw(13,"Enter"))))return;let G=t.state.tr.setSelection(Z);H=="pointer"?G.setMeta("pointer",!0):H=="key"&&G.scrollIntoView(),o&&G.setMeta("composition",o),t.dispatch(G)}return}let l=t.state.doc.resolve(e),i=l.sharedDepth(n);e=l.before(i+1),n=t.state.doc.resolve(n).after(i+1);let h=t.state.selection,p=M1t(t,e,n),x=t.state.doc,y=x.slice(p.from,p.to),b,j;t.input.lastKeyCode===8&&Date.now()-100Date.now()-225||Lx)&&a.some(H=>H.nodeType==1&&!A1t.test(H.nodeName))&&(!C||C.endA>=C.endB)&&t.someProp("handleKeyDown",H=>H(t,Iw(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!C)if(s&&h instanceof Va&&!h.empty&&h.$head.sameParent(h.$anchor)&&!t.composing&&!(p.sel&&p.sel.anchor!=p.sel.head))C={start:h.from,endA:h.to,endB:h.to};else{if(p.sel){let H=bNe(t,t.state.doc,p.sel);if(H&&!H.eq(t.state.selection)){let Z=t.state.tr.setSelection(H);o&&Z.setMeta("composition",o),t.dispatch(Z)}}return}t.state.selection.fromt.state.selection.from&&C.start<=t.state.selection.from+2&&t.state.selection.from>=p.from?C.start=t.state.selection.from:C.endA=t.state.selection.to-2&&t.state.selection.to<=p.to&&(C.endB+=t.state.selection.to-C.endA,C.endA=t.state.selection.to)),_h&&T1<=11&&C.endB==C.start+1&&C.endA==C.start&&C.start>p.from&&p.doc.textBetween(C.start-p.from-1,C.start-p.from+1)=="  "&&(C.start--,C.endA--,C.endB--);let N=p.doc.resolveNoCache(C.start-p.from),A=p.doc.resolveNoCache(C.endB-p.from),E=x.resolve(C.start),T=N.sameParent(A)&&N.parent.inlineContent&&E.end()>=C.endA;if((xC&&t.input.lastIOSEnter>Date.now()-225&&(!T||a.some(H=>H.nodeName=="DIV"||H.nodeName=="P"))||!T&&N.posH(t,Iw(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>C.start&&P1t(x,C.start,C.endA,N,A)&&t.someProp("handleKeyDown",H=>H(t,Iw(8,"Backspace")))){Lx&&dd&&t.domObserver.suppressSelectionUpdates();return}dd&&C.endB==C.start&&(t.input.lastChromeDelete=Date.now()),Lx&&!T&&N.start()!=A.start()&&A.parentOffset==0&&N.depth==A.depth&&p.sel&&p.sel.anchor==p.sel.head&&p.sel.head==C.endA&&(C.endB-=2,A=p.doc.resolveNoCache(C.endB-p.from),setTimeout(()=>{t.someProp("handleKeyDown",function(H){return H(t,Iw(13,"Enter"))})},20));let L=C.start,z=C.endA,F=H=>{let Z=H||t.state.tr.replace(L,z,p.doc.slice(C.start-p.from,C.endB-p.from));if(p.sel){let G=bNe(t,Z.doc,p.sel);G&&!(dd&&t.composing&&G.empty&&(C.start!=C.endB||t.input.lastChromeDeleteKx(t),20));let H=F(t.state.tr.delete(L,z)),Z=x.resolve(C.start).marksAcross(x.resolve(C.endA));Z&&H.ensureMarks(Z),t.dispatch(H)}else if(C.endA==C.endB&&(q=I1t(N.parent.content.cut(N.parentOffset,A.parentOffset),E.parent.content.cut(E.parentOffset,C.endA-E.start())))){let H=F(t.state.tr);q.type=="add"?H.addMark(L,z,q.mark):H.removeMark(L,z,q.mark),t.dispatch(H)}else if(N.parent.child(N.index()).isText&&N.index()==A.index()-(A.textOffset?0:1)){let H=N.parent.textBetween(N.parentOffset,A.parentOffset),Z=()=>F(t.state.tr.insertText(H,L,z));t.someProp("handleTextInput",G=>G(t,L,z,H,Z))||t.dispatch(Z())}else t.dispatch(F());else t.dispatch(F())}function bNe(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:Uxe(t,e.resolve(n.anchor),e.resolve(n.head))}function I1t(t,e){let n=t.firstChild.marks,s=e.firstChild.marks,a=n,o=s,l,i,h;for(let x=0;xx.mark(i.addToSet(x.marks));else if(a.length==0&&o.length==1)i=o[0],l="remove",h=x=>x.mark(i.removeFromSet(x.marks));else return null;let p=[];for(let x=0;xn||mce(l,!0,!1)0&&(e||t.indexAfter(s)==t.node(s).childCount);)s--,a++,e=!1;if(n){let o=t.node(s).maybeChild(t.indexAfter(s));for(;o&&!o.isLeaf;)o=o.firstChild,a++}return a}function L1t(t,e,n,s,a){let o=t.findDiffStart(e,n);if(o==null)return null;let{a:l,b:i}=t.findDiffEnd(e,n+t.size,n+e.size);if(a=="end"){let h=Math.max(0,o-Math.min(l,i));s-=l+h-o}if(l=l?o-s:0;o-=h,o&&o=i?o-s:0;o-=h,o&&o=56320&&e<=57343&&n>=55296&&n<=56319}class wFe{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 X0t,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(CNe),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=NNe(this),kNe(this),this.nodeViews=SNe(this),this.docView=nNe(this.state.doc,jNe(this),pce(this),this.dom,this),this.domObserver=new k1t(this,(s,a,o,l)=>E1t(this,s,a,o,l)),this.domObserver.start(),Q0t(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let n in e)this._props[n]=e[n];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&qhe(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(CNe),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&&(mFe(this),l=!0),this.state=e;let i=a.plugins!=e.plugins||this._props.plugins!=n.plugins;if(i||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let j=SNe(this);D1t(j,this.nodeViews)&&(this.nodeViews=j,o=!0)}(i||n.handleDOMEvents!=this._props.handleDOMEvents)&&qhe(this),this.editable=NNe(this),kNe(this);let h=pce(this),p=jNe(this),x=a.plugins!=e.plugins&&!a.doc.eq(e.doc)?"reset":e.scrollToSelection>a.scrollToSelection?"to selection":"preserve",y=o||!this.docView.matchesNode(e.doc,p,h);(y||!e.selection.eq(a.selection))&&(l=!0);let b=x=="preserve"&&l&&this.dom.style.overflowAnchor==null&&h0t(this);if(l){this.domObserver.stop();let j=y&&(_h||dd)&&!this.composing&&!a.selection.empty&&!e.selection.empty&&O1t(a.selection,e.selection);if(y){let C=dd?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=h1t(this)),(o||!this.docView.update(e.doc,p,h,this))&&(this.docView.updateOuterDeco(p),this.docView.destroy(),this.docView=nNe(e.doc,p,h,this.dom,this)),C&&!this.trackWrites&&(j=!0)}j||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&D0t(this))?Kx(this,j):(nFe(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():b&&f0t(b)}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&&Xke(this,n.getBoundingClientRect(),e)}else Xke(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 xFe(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 v0t(this,e)}coordsAtPos(e,n=1){return ZRe(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 k0t(this,n||this.state,e)}pasteHTML(e,n){return uE(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return uE(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return qxe(this,e)}destroy(){this.docView&&(J0t(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],pce(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,r0t())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return t1t(this,e)}domSelectionRange(){let e=this.domSelection();return e?hu&&this.root.nodeType===11&&o0t(this.dom.ownerDocument)==this.dom&&S1t(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}wFe.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};function jNe(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"),[Hf.node(0,t.state.doc.content.size,e)]}function kNe(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:Hf.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function NNe(t){return!t.someProp("editable",e=>e(t.state)===!1)}function O1t(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 SNe(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 D1t(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 CNe(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 Y1={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},Pte={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},R1t=typeof navigator<"u"&&/Mac/.test(navigator.platform),F1t=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Pd=0;Pd<10;Pd++)Y1[48+Pd]=Y1[96+Pd]=String(Pd);for(var Pd=1;Pd<=24;Pd++)Y1[Pd+111]="F"+Pd;for(var Pd=65;Pd<=90;Pd++)Y1[Pd]=String.fromCharCode(Pd+32),Pte[Pd]=String.fromCharCode(Pd);for(var gce in Y1)Pte.hasOwnProperty(gce)||(Pte[gce]=Y1[gce]);function z1t(t){var e=R1t&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||F1t&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?Pte:Y1)[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 B1t=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),$1t=typeof navigator<"u"&&/Win/.test(navigator.platform);function U1t(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 kFe(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const NFe=(t,e,n)=>{let s=kFe(t,n);if(!s)return!1;let a=Yxe(s);if(!a){let l=s.blockRange(),i=l&&h3(l);return i==null?!1:(e&&e(t.tr.lift(l,i).scrollIntoView()),!0)}let o=a.nodeBefore;if(LFe(t,a,e,-1))return!0;if(s.parent.content.size==0&&(yC(o,"end")||aa.isSelectable(o)))for(let l=s.depth;;l--){let i=Ese(t.doc,s.before(l),s.after(l),fs.empty);if(i&&i.slice.size1)break}return o.isAtom&&a.depth==s.depth-1?(e&&e(t.tr.delete(a.pos-o.nodeSize,a.pos).scrollIntoView()),!0):!1},H1t=(t,e,n)=>{let s=kFe(t,n);if(!s)return!1;let a=Yxe(s);return a?SFe(t,a,e):!1},W1t=(t,e,n)=>{let s=MFe(t,n);if(!s)return!1;let a=Xxe(s);return a?SFe(t,a,e):!1};function SFe(t,e,n){let s=e.nodeBefore,a=s,o=e.pos-1;for(;!a.isTextblock;o--){if(a.type.spec.isolating)return!1;let x=a.lastChild;if(!x)return!1;a=x}let l=e.nodeAfter,i=l,h=e.pos+1;for(;!i.isTextblock;h++){if(i.type.spec.isolating)return!1;let x=i.firstChild;if(!x)return!1;i=x}let p=Ese(t.doc,o,h,fs.empty);if(!p||p.from!=o||p instanceof ld&&p.slice.size>=h-o)return!1;if(n){let x=t.tr.step(p);x.setSelection(Va.create(x.doc,o)),n(x.scrollIntoView())}return!0}function yC(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 CFe=(t,e,n)=>{let{$head:s,empty:a}=t.selection,o=s;if(!a)return!1;if(s.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):s.parentOffset>0)return!1;o=Yxe(s)}let l=o&&o.nodeBefore;return!l||!aa.isSelectable(l)?!1:(e&&e(t.tr.setSelection(aa.create(t.doc,o.pos-l.nodeSize)).scrollIntoView()),!0)};function Yxe(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){if(t.index(e)>0)return t.doc.resolve(t.before(e+1));if(t.node(e).type.spec.isolating)break}return null}function MFe(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset{let s=MFe(t,n);if(!s)return!1;let a=Xxe(s);if(!a)return!1;let o=a.nodeAfter;if(LFe(t,a,e,1))return!0;if(s.parent.content.size==0&&(yC(o,"start")||aa.isSelectable(o))){let l=Ese(t.doc,s.before(),s.after(),fs.empty);if(l&&l.slice.size{let{$head:s,empty:a}=t.selection,o=s;if(!a)return!1;if(s.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):s.parentOffset=0;e--){let n=t.node(e);if(t.index(e)+1{let n=t.selection,s=n instanceof aa,a;if(s){if(n.node.isTextblock||!lv(t.doc,n.from))return!1;a=n.from}else if(a=Ase(t.doc,n.from,-1),a==null)return!1;if(e){let o=t.tr.join(a);s&&o.setSelection(aa.create(o.doc,a-t.doc.resolve(a).nodeBefore.nodeSize)),e(o.scrollIntoView())}return!0},K1t=(t,e)=>{let n=t.selection,s;if(n instanceof aa){if(n.node.isTextblock||!lv(t.doc,n.to))return!1;s=n.to}else if(s=Ase(t.doc,n.to,1),s==null)return!1;return e&&e(t.tr.join(s).scrollIntoView()),!0},Z1t=(t,e)=>{let{$from:n,$to:s}=t.selection,a=n.blockRange(s),o=a&&h3(a);return o==null?!1:(e&&e(t.tr.lift(a,o).scrollIntoView()),!0)},EFe=(t,e)=>{let{$head:n,$anchor:s}=t.selection;return!n.parent.type.spec.code||!n.sameParent(s)?!1:(e&&e(t.tr.insertText(` `).scrollIntoView()),!0)};function Qxe(t){for(let e=0;e{let{$head:n,$anchor:s}=t.selection;if(!n.parent.type.spec.code||!n.sameParent(s))return!1;let a=n.node(-1),o=n.indexAfter(-1),l=Qxe(a.contentMatchAt(o));if(!l||!a.canReplaceWith(o,o,l))return!1;if(e){let i=n.after(),h=t.tr.replaceWith(i,i,l.createAndFill());h.setSelection(ui.near(h.doc.resolve(i),1)),e(h.scrollIntoView())}return!0},IFe=(t,e)=>{let n=t.selection,{$from:s,$to:a}=n;if(n instanceof af||s.parent.inlineContent||a.parent.inlineContent)return!1;let o=Qxe(a.parent.contentMatchAt(a.indexAfter()));if(!o||!o.isTextblock)return!1;if(e){let l=(!s.parentOffset&&a.index(){let{$cursor:n}=t.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let o=n.before();if(Gx(t.doc,o))return e&&e(t.tr.split(o).scrollIntoView()),!0}let s=n.blockRange(),a=s&&h3(s);return a==null?!1:(e&&e(t.tr.lift(s,a).scrollIntoView()),!0)};function X1t(t){return(e,n)=>{let{$from:s,$to:a}=e.selection;if(e.selection instanceof aa&&e.selection.node.isBlock)return!s.parentOffset||!Gx(e.doc,s.pos)?!1:(n&&n(e.tr.split(s.pos).scrollIntoView()),!0);if(!s.depth)return!1;let o=[],l,i,h=!1,p=!1;for(let j=s.depth;;j--)if(s.node(j).isBlock){h=s.end(j)==s.pos+(s.depth-j),p=s.start(j)==s.pos-(s.depth-j),i=Qxe(s.node(j-1).contentMatchAt(s.indexAfter(j-1))),o.unshift(h&&i?{type:i}:null),l=j;break}else{if(j==1)return!1;o.unshift(null)}let x=e.tr;(e.selection instanceof Va||e.selection instanceof af)&&x.deleteSelection();let y=x.mapping.map(s.pos),b=Gx(x.doc,y,o.length,o);if(b||(o[0]=i?{type:i}:null,b=Gx(x.doc,y,o.length,o)),!b)return!1;if(x.split(y,o.length,o),!h&&p&&s.node(l).type!=i){let j=x.mapping.map(s.before(l)),C=x.doc.resolve(j);i&&s.node(l-1).canReplaceWith(C.index(),C.index()+1,i)&&x.setNodeMarkup(x.mapping.map(s.before(l)),i)}return n&&n(x.scrollIntoView()),!0}}const Q1t=X1t(),J1t=(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 evt(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||lv(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function LFe(t,e,n,s){let a=e.nodeBefore,o=e.nodeAfter,l,i,h=a.type.spec.isolating||o.type.spec.isolating;if(!h&&evt(t,e,n))return!0;let p=!h&&e.parent.canReplace(e.index(),e.index()+1);if(p&&(l=(i=a.contentMatchAt(a.childCount)).findWrapping(o.type))&&i.matchType(l[0]||o.type).validEnd){if(n){let j=e.pos+o.nodeSize,C=_n.empty;for(let E=l.length-1;E>=0;E--)C=_n.from(l[E].create(null,C));C=_n.from(a.copy(C));let N=t.tr.step(new md(e.pos-1,j,e.pos,j,new fs(C,1,0),l.length,!0)),A=N.doc.resolve(j+2*l.length);A.nodeAfter&&A.nodeAfter.type==a.type&&lv(N.doc,A.pos)&&N.join(A.pos),n(N.scrollIntoView())}return!0}let x=o.type.spec.isolating||s>0&&h?null:ui.findFrom(e,1),y=x&&x.$from.blockRange(x.$to),b=y&&h3(y);if(b!=null&&b>=e.depth)return n&&n(t.tr.lift(y,b).scrollIntoView()),!0;if(p&&yC(o,"start",!0)&&yC(a,"end")){let j=a,C=[];for(;C.push(j),!j.isTextblock;)j=j.lastChild;let N=o,A=1;for(;!N.isTextblock;N=N.firstChild)A++;if(j.canReplace(j.childCount,j.childCount,N.content)){if(n){let E=_n.empty;for(let L=C.length-1;L>=0;L--)E=_n.from(C[L].copy(E));let T=t.tr.step(new md(e.pos-C.length,e.pos+o.nodeSize,e.pos+A,e.pos+o.nodeSize-A,new fs(E,C.length,0),0,!0));n(T.scrollIntoView())}return!0}}return!1}function OFe(t){return function(e,n){let s=e.selection,a=t<0?s.$from:s.$to,o=a.depth;for(;a.node(o).isInline;){if(!o)return!1;o--}return a.node(o).isTextblock?(n&&n(e.tr.setSelection(Va.create(e.doc,t<0?a.start(o):a.end(o)))),!0):!1}}const tvt=OFe(-1),rvt=OFe(1);function nvt(t,e=null){return function(n,s){let{$from:a,$to:o}=n.selection,l=a.blockRange(o),i=l&&Fxe(l,t,e);return i?(s&&s(n.tr.wrap(l,i).scrollIntoView()),!0):!1}}function MNe(t,e=null){return function(n,s){let a=!1;for(let o=0;o{if(a)return!1;if(!(!h.isTextblock||h.hasMarkup(t,e)))if(h.type==t)a=!0;else{let x=n.doc.resolve(p),y=x.index();a=x.parent.canReplaceWith(y,y+1,t)}})}if(!a)return!1;if(s){let o=n.tr;for(let l=0;l=2&&e.$from.node(e.depth-1).type.compatibleContent(n)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let h=l.resolve(e.start-2);o=new Ste(h,h,e.depth),e.endIndex=0;x--)o=_n.from(n[x].type.create(n[x].attrs,o));t.step(new md(e.start-(s?2:0),e.end,e.start,e.end,new fs(o,0,0),n.length,!0));let l=0;for(let x=0;xl.childCount>0&&l.firstChild.type==t);return o?n?s.node(o.depth-1).type==t?lvt(e,n,t,o):cvt(e,n,o):!0:!1}}function lvt(t,e,n,s){let a=t.tr,o=s.end,l=s.$to.end(s.depth);oN;C--)j-=a.child(C).nodeSize,s.delete(j-1,j+1);let o=s.doc.resolve(n.start),l=o.nodeAfter;if(s.mapping.map(n.end)!=n.start+o.nodeAfter.nodeSize)return!1;let i=n.startIndex==0,h=n.endIndex==a.childCount,p=o.node(-1),x=o.index(-1);if(!p.canReplace(x+(i?0:1),x+1,l.content.append(h?_n.empty:_n.from(a))))return!1;let y=o.pos,b=y+l.nodeSize;return s.step(new md(y-(i?1:0),b+(h?1:0),y+1,b-1,new fs((i?_n.empty:_n.from(a.copy(_n.empty))).append(h?_n.empty:_n.from(a.copy(_n.empty))),i?0:1,h?0:1),i?0:1)),e(s.scrollIntoView()),!0}function dvt(t){return function(e,n){let{$from:s,$to:a}=e.selection,o=s.blockRange(a,p=>p.childCount>0&&p.firstChild.type==t);if(!o)return!1;let l=o.startIndex;if(l==0)return!1;let i=o.parent,h=i.child(l-1);if(h.type!=t)return!1;if(n){let p=h.lastChild&&h.lastChild.type==i.type,x=_n.from(p?t.create():null),y=new fs(_n.from(t.create(null,_n.from(i.type.create(null,x)))),p?3:1,0),b=o.start,j=o.end;n(e.tr.step(new md(b-(p?3:1),j,b,j,y,1,!0)).scrollIntoView())}return!0}}function Dse(t){const{state:e,transaction:n}=t;let{selection:s}=n,{doc:a}=n,{storedMarks:o}=n;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return o},get selection(){return s},get doc(){return a},get tr(){return s=n.selection,a=n.doc,o=n.storedMarks,n}}}class Rse{constructor(e){this.editor=e.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=e.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:e,editor:n,state:s}=this,{view:a}=n,{tr:o}=s,l=this.buildProps(o);return Object.fromEntries(Object.entries(e).map(([i,h])=>[i,(...x)=>{const y=h(...x)(l);return!o.getMeta("preventDispatch")&&!this.hasCustomState&&a.dispatch(o),y}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,n=!0){const{rawCommands:s,editor:a,state:o}=this,{view:l}=a,i=[],h=!!e,p=e||o.tr,x=()=>(!h&&n&&!p.getMeta("preventDispatch")&&!this.hasCustomState&&l.dispatch(p),i.every(b=>b===!0)),y={...Object.fromEntries(Object.entries(s).map(([b,j])=>[b,(...N)=>{const A=this.buildProps(p,n),E=j(...N)(A);return i.push(E),y}])),run:x};return y}createCan(e){const{rawCommands:n,state:s}=this,a=!1,o=e||s.tr,l=this.buildProps(o,a);return{...Object.fromEntries(Object.entries(n).map(([h,p])=>[h,(...x)=>p(...x)({...l,dispatch:void 0})])),chain:()=>this.createChain(o,a)}}buildProps(e,n=!0){const{rawCommands:s,editor:a,state:o}=this,{view:l}=a,i={tr:e,editor:a,view:l,state:Dse({state:o,transaction:e}),dispatch:n?()=>{}:void 0,chain:()=>this.createChain(e,n),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(s).map(([h,p])=>[h,(...x)=>p(...x)(i)]))}};return i}}let uvt=class{constructor(){this.callbacks={}}on(e,n){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(n),this}emit(e,...n){const s=this.callbacks[e];return s&&s.forEach(a=>a.apply(this,n)),this}off(e,n){const s=this.callbacks[e];return s&&(n?this.callbacks[e]=s.filter(a=>a!==n):delete this.callbacks[e]),this}once(e,n){const s=(...a)=>{this.off(e,s),n.apply(this,a)};return this.on(e,s)}removeAllListeners(){this.callbacks={}}};function ks(t,e,n){return t.config[e]===void 0&&t.parent?ks(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?ks(t.parent,e,n):null}):t.config[e]}function Fse(t){const e=t.filter(a=>a.type==="extension"),n=t.filter(a=>a.type==="node"),s=t.filter(a=>a.type==="mark");return{baseExtensions:e,nodeExtensions:n,markExtensions:s}}function DFe(t){const e=[],{nodeExtensions:n,markExtensions:s}=Fse(t),a=[...n,...s],o={default:null,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return t.forEach(l=>{const i={name:l.name,options:l.options,storage:l.storage,extensions:a},h=ks(l,"addGlobalAttributes",i);if(!h)return;h().forEach(x=>{x.types.forEach(y=>{Object.entries(x.attributes).forEach(([b,j])=>{e.push({type:y,name:b,attribute:{...o,...j}})})})})}),a.forEach(l=>{const i={name:l.name,options:l.options,storage:l.storage},h=ks(l,"addAttributes",i);if(!h)return;const p=h();Object.entries(p).forEach(([x,y])=>{const b={...o,...y};typeof(b==null?void 0:b.default)=="function"&&(b.default=b.default()),b!=null&&b.isRequired&&(b==null?void 0:b.default)===void 0&&delete b.default,e.push({type:l.name,name:x,attribute:b})})}),e}function xd(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 yd(...t){return t.filter(e=>!!e).reduce((e,n)=>{const s={...e};return Object.entries(n).forEach(([a,o])=>{if(!s[a]){s[a]=o;return}if(a==="class"){const i=o?String(o).split(" "):[],h=s[a]?s[a].split(" "):[],p=i.filter(x=>!h.includes(x));s[a]=[...h,...p].join(" ")}else if(a==="style"){const i=o?o.split(";").map(x=>x.trim()).filter(Boolean):[],h=s[a]?s[a].split(";").map(x=>x.trim()).filter(Boolean):[],p=new Map;h.forEach(x=>{const[y,b]=x.split(":").map(j=>j.trim());p.set(y,b)}),i.forEach(x=>{const[y,b]=x.split(":").map(j=>j.trim());p.set(y,b)}),s[a]=Array.from(p.entries()).map(([x,y])=>`${x}: ${y}`).join("; ")}else s[a]=o}),s},{})}function Vhe(t,e){return e.filter(n=>n.type===t.type.name).filter(n=>n.attribute.rendered).map(n=>n.attribute.renderHTML?n.attribute.renderHTML(t.attrs)||{}:{[n.name]:t.attrs[n.name]}).reduce((n,s)=>yd(n,s),{})}function RFe(t){return typeof t=="function"}function hi(t,e=void 0,...n){return RFe(t)?e?t.bind(e)(...n):t(...n):t}function hvt(t={}){return Object.keys(t).length===0&&t.constructor===Object}function fvt(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function TNe(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):fvt(n.getAttribute(l.name));return i==null?o:{...o,[l.name]:i}},{});return{...s,...a}}}}function ANe(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&hvt(n)?!1:n!=null))}function pvt(t,e){var n;const s=DFe(t),{nodeExtensions:a,markExtensions:o}=Fse(t),l=(n=a.find(p=>ks(p,"topNode")))===null||n===void 0?void 0:n.name,i=Object.fromEntries(a.map(p=>{const x=s.filter(E=>E.type===p.name),y={name:p.name,options:p.options,storage:p.storage,editor:e},b=t.reduce((E,T)=>{const L=ks(T,"extendNodeSchema",y);return{...E,...L?L(p):{}}},{}),j=ANe({...b,content:hi(ks(p,"content",y)),marks:hi(ks(p,"marks",y)),group:hi(ks(p,"group",y)),inline:hi(ks(p,"inline",y)),atom:hi(ks(p,"atom",y)),selectable:hi(ks(p,"selectable",y)),draggable:hi(ks(p,"draggable",y)),code:hi(ks(p,"code",y)),whitespace:hi(ks(p,"whitespace",y)),linebreakReplacement:hi(ks(p,"linebreakReplacement",y)),defining:hi(ks(p,"defining",y)),isolating:hi(ks(p,"isolating",y)),attrs:Object.fromEntries(x.map(E=>{var T;return[E.name,{default:(T=E==null?void 0:E.attribute)===null||T===void 0?void 0:T.default}]}))}),C=hi(ks(p,"parseHTML",y));C&&(j.parseDOM=C.map(E=>TNe(E,x)));const N=ks(p,"renderHTML",y);N&&(j.toDOM=E=>N({node:E,HTMLAttributes:Vhe(E,x)}));const A=ks(p,"renderText",y);return A&&(j.toText=A),[p.name,j]})),h=Object.fromEntries(o.map(p=>{const x=s.filter(A=>A.type===p.name),y={name:p.name,options:p.options,storage:p.storage,editor:e},b=t.reduce((A,E)=>{const T=ks(E,"extendMarkSchema",y);return{...A,...T?T(p):{}}},{}),j=ANe({...b,inclusive:hi(ks(p,"inclusive",y)),excludes:hi(ks(p,"excludes",y)),group:hi(ks(p,"group",y)),spanning:hi(ks(p,"spanning",y)),code:hi(ks(p,"code",y)),attrs:Object.fromEntries(x.map(A=>{var E;return[A.name,{default:(E=A==null?void 0:A.attribute)===null||E===void 0?void 0:E.default}]}))}),C=hi(ks(p,"parseHTML",y));C&&(j.parseDOM=C.map(A=>TNe(A,x)));const N=ks(p,"renderHTML",y);return N&&(j.toDOM=A=>N({mark:A,HTMLAttributes:Vhe(A,x)})),[p.name,j]}));return new jRe({topNode:l,nodes:i,marks:h})}function yce(t,e){return e.nodes[t]||e.marks[t]||null}function ENe(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function eye(t,e){const n=ck.fromSchema(e).serializeFragment(t),a=document.implementation.createHTMLDocument().createElement("div");return a.appendChild(n),a.innerHTML}const mvt=(t,e=500)=>{let n="";const s=t.parentOffset;return t.parent.nodesBetween(Math.max(0,s-e),s,(a,o,l,i)=>{var h,p;const x=((p=(h=a.type.spec).toText)===null||p===void 0?void 0:p.call(h,{node:a,pos:o,parent:l,index:i}))||a.textContent||"%leaf%";n+=a.isAtom&&!a.isText?x:x.slice(0,Math.max(0,s-o))}),n};function tye(t){return Object.prototype.toString.call(t)==="[object RegExp]"}class zse{constructor(e){this.find=e.find,this.handler=e.handler}}const gvt=(t,e)=>{if(tye(e))return e.exec(t);const n=e(t);if(!n)return null;const s=[n.text];return s.index=n.index,s.input=t,s.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),s.push(n.replaceWith)),s};function ML(t){var e;const{editor:n,from:s,to:a,text:o,rules:l,plugin:i}=t,{view:h}=n;if(h.composing)return!1;const p=h.state.doc.resolve(s);if(p.parent.type.spec.code||!((e=p.nodeBefore||p.nodeAfter)===null||e===void 0)&&e.marks.find(b=>b.type.spec.code))return!1;let x=!1;const y=mvt(p)+o;return l.forEach(b=>{if(x)return;const j=gvt(y,b.find);if(!j)return;const C=h.state.tr,N=Dse({state:h.state,transaction:C}),A={from:s-(j[0].length-o.length),to:a},{commands:E,chain:T,can:L}=new Rse({editor:n,state:N});b.handler({state:N,range:A,match:j,commands:E,chain:T,can:L})===null||!C.steps.length||(C.setMeta(i,{transform:C,from:s,to:a,text:o}),h.dispatch(C),x=!0)}),x}function xvt(t){const{editor:e,rules:n}=t,s=new Ud({state:{init(){return null},apply(a,o,l){const i=a.getMeta(s);if(i)return i;const h=a.getMeta("applyInputRules");return!!h&&setTimeout(()=>{let{text:x}=h;typeof x=="string"?x=x:x=eye(_n.from(x),l.schema);const{from:y}=h,b=y+x.length;ML({editor:e,from:y,to:b,text:x,rules:n,plugin:s})}),a.selectionSet||a.docChanged?null:o}},props:{handleTextInput(a,o,l,i){return ML({editor:e,from:o,to:l,text:i,rules:n,plugin:s})},handleDOMEvents:{compositionend:a=>(setTimeout(()=>{const{$cursor:o}=a.state.selection;o&&ML({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?ML({editor:e,from:l.pos,to:l.pos,text:` `,rules:n,plugin:s}):!1}},isInputRules:!0});return s}function yvt(t){return Object.prototype.toString.call(t).slice(8,-1)}function TL(t){return yvt(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function Bse(t,e){const n={...t};return TL(t)&&TL(e)&&Object.keys(e).forEach(s=>{TL(e[s])&&TL(t[s])?n[s]=Bse(t[s],e[s]):n[s]=e[s]}),n}class Og{constructor(e={}){this.type="mark",this.name="mark",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=hi(ks(this,"addOptions",{name:this.name}))),this.storage=hi(ks(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new Og(e)}configure(e={}){const n=this.extend({...this.config,addOptions:()=>Bse(this.options,e)});return n.name=this.name,n.parent=this.parent,n}extend(e={}){const n=new Og(e);return n.parent=this,this.child=n,n.name=e.name?e.name:n.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`),n.options=hi(ks(n,"addOptions",{name:n.name})),n.storage=hi(ks(n,"addStorage",{name:n.name,options:n.options})),n}static handleExit({editor:e,mark:n}){const{tr:s}=e.state,a=e.state.selection.$from;if(a.pos===a.end()){const l=a.marks();if(!!!l.find(p=>(p==null?void 0:p.type.name)===n.name))return!1;const h=l.find(p=>(p==null?void 0:p.type.name)===n.name);return h&&s.removeStoredMark(h),s.insertText(" ",a.pos),e.view.dispatch(s),!0}return!1}}function vvt(t){return typeof t=="number"}class _vt{constructor(e){this.find=e.find,this.handler=e.handler}}const bvt=(t,e,n)=>{if(tye(e))return[...t.matchAll(e)];const s=e(t,n);return s?s.map(a=>{const o=[a.text];return o.index=a.index,o.input=t,o.data=a.data,a.replaceWith&&(a.text.includes(a.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),o.push(a.replaceWith)),o}):[]};function wvt(t){const{editor:e,state:n,from:s,to:a,rule:o,pasteEvent:l,dropEvent:i}=t,{commands:h,chain:p,can:x}=new Rse({editor:e,state:n}),y=[];return n.doc.nodesBetween(s,a,(j,C)=>{if(!j.isTextblock||j.type.spec.code)return;const N=Math.max(s,C),A=Math.min(a,C+j.content.size),E=j.textBetween(N-C,A-C,void 0,"");bvt(E,o.find,l).forEach(L=>{if(L.index===void 0)return;const z=N+L.index+1,F=z+L[0].length,q={from:n.tr.mapping.map(z),to:n.tr.mapping.map(F)},H=o.handler({state:n,range:q,match:L,commands:h,chain:p,can:x,pasteEvent:l,dropEvent:i});y.push(H)})}),y.every(j=>j!==null)}let AL=null;const jvt=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 kvt(t){const{editor:e,rules:n}=t;let s=null,a=!1,o=!1,l=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,i;try{i=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{i=null}const h=({state:x,from:y,to:b,rule:j,pasteEvt:C})=>{const N=x.tr,A=Dse({state:x,transaction:N});if(!(!wvt({editor:e,state:A,from:Math.max(y-1,0),to:b.b-1,rule:j,pasteEvent:C,dropEvent:i})||!N.steps.length)){try{i=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{i=null}return l=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,N}};return n.map(x=>new Ud({view(y){const b=C=>{var N;s=!((N=y.dom.parentElement)===null||N===void 0)&&N.contains(C.target)?y.dom.parentElement:null,s&&(AL=e)},j=()=>{AL&&(AL=null)};return window.addEventListener("dragstart",b),window.addEventListener("dragend",j),{destroy(){window.removeEventListener("dragstart",b),window.removeEventListener("dragend",j)}}},props:{handleDOMEvents:{drop:(y,b)=>{if(o=s===y.dom.parentElement,i=b,!o){const j=AL;j!=null&&j.isEditable&&setTimeout(()=>{const C=j.state.selection;C&&j.commands.deleteRange({from:C.from,to:C.to})},10)}return!1},paste:(y,b)=>{var j;const C=(j=b.clipboardData)===null||j===void 0?void 0:j.getData("text/html");return l=b,a=!!(C!=null&&C.includes("data-pm-slice")),!1}}},appendTransaction:(y,b,j)=>{const C=y[0],N=C.getMeta("uiEvent")==="paste"&&!a,A=C.getMeta("uiEvent")==="drop"&&!o,E=C.getMeta("applyPasteRules"),T=!!E;if(!N&&!A&&!T)return;if(T){let{text:F}=E;typeof F=="string"?F=F:F=eye(_n.from(F),j.schema);const{from:q}=E,H=q+F.length,Z=jvt(F);return h({rule:x,state:j,from:q,to:{b:H},pasteEvt:Z})}const L=b.doc.content.findDiffStart(j.doc.content),z=b.doc.content.findDiffEnd(j.doc.content);if(!(!vvt(L)||!z||L===z.b))return h({rule:x,state:j,from:L,to:z,pasteEvt:l})}}))}function Nvt(t){const e=t.filter((n,s)=>t.indexOf(n)!==s);return Array.from(new Set(e))}class R4{constructor(e,n){this.splittableMarks=[],this.editor=n,this.extensions=R4.resolve(e),this.schema=pvt(this.extensions,n),this.setupExtensions()}static resolve(e){const n=R4.sort(R4.flatten(e)),s=Nvt(n.map(a=>a.name));return s.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${s.map(a=>`'${a}'`).join(", ")}]. This can lead to issues.`),n}static flatten(e){return e.map(n=>{const s={name:n.name,options:n.options,storage:n.storage},a=ks(n,"addExtensions",s);return a?[n,...this.flatten(a())]:n}).flat(10)}static sort(e){return e.sort((s,a)=>{const o=ks(s,"priority")||100,l=ks(a,"priority")||100;return o>l?-1:o{const s={name:n.name,options:n.options,storage:n.storage,editor:this.editor,type:yce(n.name,this.schema)},a=ks(n,"addCommands",s);return a?{...e,...a()}:e},{})}get plugins(){const{editor:e}=this,n=R4.sort([...this.extensions].reverse()),s=[],a=[],o=n.map(l=>{const i={name:l.name,options:l.options,storage:l.storage,editor:e,type:yce(l.name,this.schema)},h=[],p=ks(l,"addKeyboardShortcuts",i);let x={};if(l.type==="mark"&&ks(l,"exitable",i)&&(x.ArrowRight=()=>Og.handleExit({editor:e,mark:l})),p){const N=Object.fromEntries(Object.entries(p()).map(([A,E])=>[A,()=>E({editor:e})]));x={...x,...N}}const y=V1t(x);h.push(y);const b=ks(l,"addInputRules",i);ENe(l,e.options.enableInputRules)&&b&&s.push(...b());const j=ks(l,"addPasteRules",i);ENe(l,e.options.enablePasteRules)&&j&&a.push(...j());const C=ks(l,"addProseMirrorPlugins",i);if(C){const N=C();h.push(...N)}return h}).flat();return[xvt({editor:e,rules:s}),...kvt({editor:e,rules:a}),...o]}get attributes(){return DFe(this.extensions)}get nodeViews(){const{editor:e}=this,{nodeExtensions:n}=Fse(this.extensions);return Object.fromEntries(n.filter(s=>!!ks(s,"addNodeView")).map(s=>{const a=this.attributes.filter(h=>h.type===s.name),o={name:s.name,options:s.options,storage:s.storage,editor:e,type:xd(s.name,this.schema)},l=ks(s,"addNodeView",o);if(!l)return[];const i=(h,p,x,y,b)=>{const j=Vhe(h,a);return l()({node:h,view:p,getPos:x,decorations:y,innerDecorations:b,editor:e,extension:s,HTMLAttributes:j})};return[s.name,i]}))}setupExtensions(){this.extensions.forEach(e=>{var n;this.editor.extensionStorage[e.name]=e.storage;const s={name:e.name,options:e.options,storage:e.storage,editor:this.editor,type:yce(e.name,this.schema)};e.type==="mark"&&(!((n=hi(ks(e,"keepOnSplit",s)))!==null&&n!==void 0)||n)&&this.splittableMarks.push(e.name);const a=ks(e,"onBeforeCreate",s),o=ks(e,"onCreate",s),l=ks(e,"onUpdate",s),i=ks(e,"onSelectionUpdate",s),h=ks(e,"onTransaction",s),p=ks(e,"onFocus",s),x=ks(e,"onBlur",s),y=ks(e,"onDestroy",s);a&&this.editor.on("beforeCreate",a),o&&this.editor.on("create",o),l&&this.editor.on("update",l),i&&this.editor.on("selectionUpdate",i),h&&this.editor.on("transaction",h),p&&this.editor.on("focus",p),x&&this.editor.on("blur",x),y&&this.editor.on("destroy",y)})}}class Bd{constructor(e={}){this.type="extension",this.name="extension",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=hi(ks(this,"addOptions",{name:this.name}))),this.storage=hi(ks(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new Bd(e)}configure(e={}){const n=this.extend({...this.config,addOptions:()=>Bse(this.options,e)});return n.name=this.name,n.parent=this.parent,n}extend(e={}){const n=new Bd({...this.config,...e});return n.parent=this,this.child=n,n.name=e.name?e.name:n.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`),n.options=hi(ks(n,"addOptions",{name:n.name})),n.storage=hi(ks(n,"addStorage",{name:n.name,options:n.options})),n}}function FFe(t,e,n){const{from:s,to:a}=e,{blockSeparator:o=` `,textSerializers:l={}}=n||{};let i="";return t.nodesBetween(s,a,(h,p,x,y)=>{var b;h.isBlock&&p>s&&(i+=o);const j=l==null?void 0:l[h.type.name];if(j)return x&&(i+=j({node:h,pos:p,parent:x,index:y,range:e})),!1;h.isText&&(i+=(b=h==null?void 0:h.text)===null||b===void 0?void 0:b.slice(Math.max(s,p)-p,a-p))}),i}function zFe(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}const Svt=Bd.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new Ud({key:new pf("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:t}=this,{state:e,schema:n}=t,{doc:s,selection:a}=e,{ranges:o}=a,l=Math.min(...o.map(x=>x.$from.pos)),i=Math.max(...o.map(x=>x.$to.pos)),h=zFe(n);return FFe(s,{from:l,to:i},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:h})}}})]}}),Cvt=()=>({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),Mvt=(t=!1)=>({commands:e})=>e.setContent("",t),Tvt=()=>({state:t,tr:e,dispatch:n})=>{const{selection:s}=e,{ranges:a}=s;return n&&a.forEach(({$from:o,$to:l})=>{t.doc.nodesBetween(o.pos,l.pos,(i,h)=>{if(i.type.isText)return;const{doc:p,mapping:x}=e,y=p.resolve(x.map(h)),b=p.resolve(x.map(h+i.nodeSize)),j=y.blockRange(b);if(!j)return;const C=h3(j);if(i.type.isTextblock){const{defaultType:N}=y.parent.contentMatchAt(y.index());e.setNodeMarkup(j.start,N)}(C||C===0)&&e.lift(j,C)})}),!0},Avt=t=>e=>t(e),Evt=()=>({state:t,dispatch:e})=>IFe(t,e),Ivt=(t,e)=>({editor:n,tr:s})=>{const{state:a}=n,o=a.doc.slice(t.from,t.to);s.deleteRange(t.from,t.to);const l=s.mapping.map(e);return s.insert(l,o.content),s.setSelection(new Va(s.doc.resolve(Math.max(l-1,0)))),!0},Pvt=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,s=n.$anchor.node();if(s.content.size>0)return!1;const a=t.selection.$anchor;for(let o=a.depth;o>0;o-=1)if(a.node(o).type===s.type){if(e){const i=a.before(o),h=a.after(o);t.delete(i,h).scrollIntoView()}return!0}return!1},Lvt=t=>({tr:e,state:n,dispatch:s})=>{const a=xd(t,n.schema),o=e.selection.$anchor;for(let l=o.depth;l>0;l-=1)if(o.node(l).type===a){if(s){const h=o.before(l),p=o.after(l);e.delete(h,p).scrollIntoView()}return!0}return!1},Ovt=t=>({tr:e,dispatch:n})=>{const{from:s,to:a}=t;return n&&e.delete(s,a),!0},Dvt=()=>({state:t,dispatch:e})=>Zxe(t,e),Rvt=()=>({commands:t})=>t.keyboardShortcut("Enter"),Fvt=()=>({state:t,dispatch:e})=>Y1t(t,e);function Lte(t,e,n={strict:!0}){const s=Object.keys(e);return s.length?s.every(a=>n.strict?e[a]===t[a]:tye(e[a])?e[a].test(t[a]):e[a]===t[a]):!0}function BFe(t,e,n={}){return t.find(s=>s.type===e&&Lte(Object.fromEntries(Object.keys(n).map(a=>[a,s.attrs[a]])),n))}function INe(t,e,n={}){return!!BFe(t,e,n)}function rye(t,e,n){var s;if(!t||!e)return;let a=t.parent.childAfter(t.parentOffset);if((!a.node||!a.node.marks.some(x=>x.type===e))&&(a=t.parent.childBefore(t.parentOffset)),!a.node||!a.node.marks.some(x=>x.type===e)||(n=n||((s=a.node.marks[0])===null||s===void 0?void 0:s.attrs),!BFe([...a.node.marks],e,n)))return;let l=a.index,i=t.start()+a.offset,h=l+1,p=i+a.node.nodeSize;for(;l>0&&INe([...t.parent.child(l-1).marks],e,n);)l-=1,i-=t.parent.child(l).nodeSize;for(;h({tr:n,state:s,dispatch:a})=>{const o=dv(t,s.schema),{doc:l,selection:i}=n,{$from:h,from:p,to:x}=i;if(a){const y=rye(h,o,e);if(y&&y.from<=p&&y.to>=x){const b=Va.create(l,y.from,y.to);n.setSelection(b)}}return!0},Bvt=t=>e=>{const n=typeof t=="function"?t(e):t;for(let s=0;s({editor:n,view:s,tr:a,dispatch:o})=>{e={scrollIntoView:!0,...e};const l=()=>{(nye()||$vt())&&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&&!$Fe(n.state.selection))return l(),!0;const i=UFe(a.doc,t)||n.state.selection,h=n.state.selection.eq(i);return o&&(h||a.setSelection(i),h&&a.storedMarks&&a.setStoredMarks(a.storedMarks),l()),!0},qvt=(t,e)=>n=>t.every((s,a)=>e(s,{...n,index:a})),Vvt=(t,e)=>({tr:n,commands:s})=>s.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),qFe=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&&qFe(s)}return t};function EL(t){const e=`${t}`,n=new window.DOMParser().parseFromString(e,"text/html").body;return qFe(n)}function fE(t,e,n){if(t instanceof M1||t instanceof _n)return t;n={slice:!0,parseOptions:{},...n};const s=typeof t=="object"&&t!==null,a=typeof t=="string";if(s)try{if(Array.isArray(t)&&t.length>0)return _n.fromArray(t.map(i=>e.nodeFromJSON(i)));const l=e.nodeFromJSON(t);return n.errorOnInvalidContent&&l.check(),l}catch(o){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:o});return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",o),fE("",e,n)}if(a){if(n.errorOnInvalidContent){let l=!1,i="";const h=new jRe({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?dA.fromSchema(h).parseSlice(EL(t),n.parseOptions):dA.fromSchema(h).parse(EL(t),n.parseOptions),n.errorOnInvalidContent&&l)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${i}`)})}const o=dA.fromSchema(e);return n.slice?o.parseSlice(EL(t),n.parseOptions).content:o.parse(EL(t),n.parseOptions)}return fE("",e,n)}function Hvt(t,e,n){const s=t.steps.length-1;if(s{l===0&&(l=x)}),t.setSelection(ui.near(t.doc.resolve(l),n))}const Wvt=t=>!("type"in t),Gvt=(t,e,n)=>({tr:s,dispatch:a,editor:o})=>{var l;if(a){n={parseOptions:o.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let i;const h=A=>{o.emit("contentError",{editor:o,error:A,disableCollaboration:()=>{o.storage.collaboration&&(o.storage.collaboration.isDisabled=!0)}})},p={preserveWhitespace:"full",...n.parseOptions};if(!n.errorOnInvalidContent&&!o.options.enableContentCheck&&o.options.emitContentError)try{fE(e,o.schema,{parseOptions:p,errorOnInvalidContent:!0})}catch(A){h(A)}try{i=fE(e,o.schema,{parseOptions:p,errorOnInvalidContent:(l=n.errorOnInvalidContent)!==null&&l!==void 0?l:o.options.enableContentCheck})}catch(A){return h(A),!1}let{from:x,to:y}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},b=!0,j=!0;if((Wvt(i)?i:[i]).forEach(A=>{A.check(),b=b?A.isText&&A.marks.length===0:!1,j=j?A.isBlock:!1}),x===y&&j){const{parent:A}=s.doc.resolve(x);A.isTextblock&&!A.type.spec.code&&!A.childCount&&(x-=1,y+=1)}let N;if(b){if(Array.isArray(e))N=e.map(A=>A.text||"").join("");else if(e instanceof _n){let A="";e.forEach(E=>{E.text&&(A+=E.text)}),N=A}else typeof e=="object"&&e&&e.text?N=e.text:N=e;s.insertText(N,x,y)}else N=i,s.replaceWith(x,y,N);n.updateSelection&&Hvt(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},Kvt=()=>({state:t,dispatch:e})=>G1t(t,e),Zvt=()=>({state:t,dispatch:e})=>K1t(t,e),Yvt=()=>({state:t,dispatch:e})=>NFe(t,e),Xvt=()=>({state:t,dispatch:e})=>TFe(t,e),Qvt=()=>({state:t,dispatch:e,tr:n})=>{try{const s=Ase(t.doc,t.selection.$from.pos,-1);return s==null?!1:(n.join(s,2),e&&e(n),!0)}catch{return!1}},Jvt=()=>({state:t,dispatch:e,tr:n})=>{try{const s=Ase(t.doc,t.selection.$from.pos,1);return s==null?!1:(n.join(s,2),e&&e(n),!0)}catch{return!1}},e_t=()=>({state:t,dispatch:e})=>H1t(t,e),t_t=()=>({state:t,dispatch:e})=>W1t(t,e);function VFe(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function r_t(t){const e=t.split(/-(?!$)/);let n=e[e.length-1];n==="Space"&&(n=" ");let s,a,o,l;for(let i=0;i({editor:e,view:n,tr:s,dispatch:a})=>{const o=r_t(t).split(/-(?!$)/),l=o.find(p=>!["Alt","Ctrl","Meta","Shift"].includes(p)),i=new KeyboardEvent("keydown",{key:l==="Space"?" ":l,altKey:o.includes("Alt"),ctrlKey:o.includes("Ctrl"),metaKey:o.includes("Meta"),shiftKey:o.includes("Shift"),bubbles:!0,cancelable:!0}),h=e.captureTransaction(()=>{n.someProp("handleKeyDown",p=>p(n,i))});return h==null||h.steps.forEach(p=>{const x=p.map(s.mapping);x&&a&&s.maybeStep(x)}),!0};function pE(t,e,n={}){const{from:s,to:a,empty:o}=t.selection,l=e?xd(e,t.schema):null,i=[];t.doc.nodesBetween(s,a,(y,b)=>{if(y.isText)return;const j=Math.max(s,b),C=Math.min(a,b+y.nodeSize);i.push({node:y,from:j,to:C})});const h=a-s,p=i.filter(y=>l?l.name===y.node.type.name:!0).filter(y=>Lte(y.node.attrs,n,{strict:!1}));return o?!!p.length:p.reduce((y,b)=>y+b.to-b.from,0)>=h}const s_t=(t,e={})=>({state:n,dispatch:s})=>{const a=xd(t,n.schema);return pE(n,a,e)?Z1t(n,s):!1},a_t=()=>({state:t,dispatch:e})=>PFe(t,e),i_t=t=>({state:e,dispatch:n})=>{const s=xd(t,e.schema);return ovt(s)(e,n)},o_t=()=>({state:t,dispatch:e})=>EFe(t,e);function $se(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function PNe(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 l_t=(t,e)=>({tr:n,state:s,dispatch:a})=>{let o=null,l=null;const i=$se(typeof t=="string"?t:t.name,s.schema);return i?(i==="node"&&(o=xd(t,s.schema)),i==="mark"&&(l=dv(t,s.schema)),a&&n.selection.ranges.forEach(h=>{s.doc.nodesBetween(h.$from.pos,h.$to.pos,(p,x)=>{o&&o===p.type&&n.setNodeMarkup(x,void 0,PNe(p.attrs,e)),l&&p.marks.length&&p.marks.forEach(y=>{l===y.type&&n.addMark(x,x+p.nodeSize,l.create(PNe(y.attrs,e)))})})}),!0):!1},c_t=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),d_t=()=>({tr:t,dispatch:e})=>{if(e){const n=new af(t.doc);t.setSelection(n)}return!0},u_t=()=>({state:t,dispatch:e})=>CFe(t,e),h_t=()=>({state:t,dispatch:e})=>AFe(t,e),f_t=()=>({state:t,dispatch:e})=>J1t(t,e),p_t=()=>({state:t,dispatch:e})=>rvt(t,e),m_t=()=>({state:t,dispatch:e})=>tvt(t,e);function Hhe(t,e,n={},s={}){return fE(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:s.errorOnInvalidContent})}const g_t=(t,e=!1,n={},s={})=>({editor:a,tr:o,dispatch:l,commands:i})=>{var h,p;const{doc:x}=o;if(n.preserveWhitespace!=="full"){const y=Hhe(t,a.schema,n,{errorOnInvalidContent:(h=s.errorOnInvalidContent)!==null&&h!==void 0?h:a.options.enableContentCheck});return l&&o.replaceWith(0,x.content.size,y).setMeta("preventUpdate",!e),!0}return l&&o.setMeta("preventUpdate",!e),i.insertContentAt({from:0,to:x.content.size},t,{parseOptions:n,errorOnInvalidContent:(p=s.errorOnInvalidContent)!==null&&p!==void 0?p:a.options.enableContentCheck})};function HFe(t,e){const n=dv(e,t.schema),{from:s,to:a,empty:o}=t.selection,l=[];o?(t.storedMarks&&l.push(...t.storedMarks),l.push(...t.selection.$head.marks())):t.doc.nodesBetween(s,a,h=>{l.push(...h.marks)});const i=l.find(h=>h.type.name===n.name);return i?{...i.attrs}:{}}function x_t(t,e){const n=new zRe(t);return e.forEach(s=>{s.steps.forEach(a=>{n.step(a)})}),n}function y_t(t){for(let e=0;e{n(a)&&s.push({node:a,pos:o})}),s}function __t(t,e){for(let n=t.depth;n>0;n-=1){const s=t.node(n);if(e(s))return{pos:n>0?t.before(n):0,start:t.start(n),depth:n,node:s}}}function sye(t){return e=>__t(e.$from,t)}function b_t(t,e){const n={from:0,to:t.content.size};return FFe(t,n,e)}function w_t(t,e){const n=xd(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 WFe(t,e){const n=$se(typeof e=="string"?e:e.name,t.schema);return n==="node"?w_t(t,e):n==="mark"?HFe(t,e):{}}function j_t(t,e=JSON.stringify){const n={};return t.filter(s=>{const a=e(s);return Object.prototype.hasOwnProperty.call(n,a)?!1:n[a]=!0})}function k_t(t){const e=j_t(t);return e.length===1?e:e.filter((n,s)=>!e.filter((o,l)=>l!==s).some(o=>n.oldRange.from>=o.oldRange.from&&n.oldRange.to<=o.oldRange.to&&n.newRange.from>=o.newRange.from&&n.newRange.to<=o.newRange.to))}function N_t(t){const{mapping:e,steps:n}=t,s=[];return e.maps.forEach((a,o)=>{const l=[];if(a.ranges.length)a.forEach((i,h)=>{l.push({from:i,to:h})});else{const{from:i,to:h}=n[o];if(i===void 0||h===void 0)return;l.push({from:i,to:h})}l.forEach(({from:i,to:h})=>{const p=e.slice(o).map(i,-1),x=e.slice(o).map(h),y=e.invert().map(p,-1),b=e.invert().map(x);s.push({oldRange:{from:y,to:b},newRange:{from:p,to:x}})})}),k_t(s)}function aye(t,e,n){const s=[];return t===e?n.resolve(t).marks().forEach(a=>{const o=n.resolve(t),l=rye(o,a.type);l&&s.push({mark:a,...l})}):n.nodesBetween(t,e,(a,o)=>{!a||(a==null?void 0:a.nodeSize)===void 0||s.push(...a.marks.map(l=>({from:o,to:o+a.nodeSize,mark:l})))}),s}function dee(t,e,n){return Object.fromEntries(Object.entries(n).filter(([s])=>{const a=t.find(o=>o.type===e&&o.name===s);return a?a.attribute.keepOnSplit:!1}))}function Whe(t,e,n={}){const{empty:s,ranges:a}=t.selection,o=e?dv(e,t.schema):null;if(s)return!!(t.storedMarks||t.selection.$from.marks()).filter(y=>o?o.name===y.type.name:!0).find(y=>Lte(y.attrs,n,{strict:!1}));let l=0;const i=[];if(a.forEach(({$from:y,$to:b})=>{const j=y.pos,C=b.pos;t.doc.nodesBetween(j,C,(N,A)=>{if(!N.isText&&!N.marks.length)return;const E=Math.max(j,A),T=Math.min(C,A+N.nodeSize),L=T-E;l+=L,i.push(...N.marks.map(z=>({mark:z,from:E,to:T})))})}),l===0)return!1;const h=i.filter(y=>o?o.name===y.mark.type.name:!0).filter(y=>Lte(y.mark.attrs,n,{strict:!1})).reduce((y,b)=>y+b.to-b.from,0),p=i.filter(y=>o?y.mark.type!==o&&y.mark.type.excludes(o):!0).reduce((y,b)=>y+b.to-b.from,0);return(h>0?h+p:h)>=l}function S_t(t,e,n={}){if(!e)return pE(t,null,n)||Whe(t,null,n);const s=$se(e,t.schema);return s==="node"?pE(t,e,n):s==="mark"?Whe(t,e,n):!1}function LNe(t,e){const{nodeExtensions:n}=Fse(e),s=n.find(l=>l.name===t);if(!s)return!1;const a={name:s.name,options:s.options,storage:s.storage},o=hi(ks(s,"group",a));return typeof o!="string"?!1:o.split(" ").includes("list")}function iye(t,{checkChildren:e=!0,ignoreWhitespace:n=!1}={}){var s;if(n){if(t.type.name==="hardBreak")return!0;if(t.isText)return/^\s*$/m.test((s=t.text)!==null&&s!==void 0?s:"")}if(t.isText)return!t.text;if(t.isAtom||t.isLeaf)return!1;if(t.content.childCount===0)return!0;if(e){let a=!0;return t.content.forEach(o=>{a!==!1&&(iye(o,{ignoreWhitespace:n,checkChildren:e})||(a=!1))}),a}return!1}function C_t(t){return t instanceof aa}function M_t(t,e,n){var s;const{selection:a}=e;let o=null;if($Fe(a)&&(o=a.$cursor),o){const i=(s=t.storedMarks)!==null&&s!==void 0?s:o.marks();return!!n.isInSet(i)||!i.some(h=>h.type.excludes(n))}const{ranges:l}=a;return l.some(({$from:i,$to:h})=>{let p=i.depth===0?t.doc.inlineContent&&t.doc.type.allowsMarkType(n):!1;return t.doc.nodesBetween(i.pos,h.pos,(x,y,b)=>{if(p)return!1;if(x.isInline){const j=!b||b.type.allowsMarkType(n),C=!!n.isInSet(x.marks)||!x.marks.some(N=>N.type.excludes(n));p=j&&C}return!p}),p})}const T_t=(t,e={})=>({tr:n,state:s,dispatch:a})=>{const{selection:o}=n,{empty:l,ranges:i}=o,h=dv(t,s.schema);if(a)if(l){const p=HFe(s,h);n.addStoredMark(h.create({...p,...e}))}else i.forEach(p=>{const x=p.$from.pos,y=p.$to.pos;s.doc.nodesBetween(x,y,(b,j)=>{const C=Math.max(j,x),N=Math.min(j+b.nodeSize,y);b.marks.find(E=>E.type===h)?b.marks.forEach(E=>{h===E.type&&n.addMark(C,N,h.create({...E.attrs,...e}))}):n.addMark(C,N,h.create(e))})});return M_t(s,n,h)},A_t=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),E_t=(t,e={})=>({state:n,dispatch:s,chain:a})=>{const o=xd(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})=>MNe(o,{...l,...e})(n)?!0:i.clearNodes()).command(({state:i})=>MNe(o,{...l,...e})(i,s)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},I_t=t=>({tr:e,dispatch:n})=>{if(n){const{doc:s}=e,a=qw(t,0,s.content.size),o=aa.create(s,a);e.setSelection(o)}return!0},P_t=t=>({tr:e,dispatch:n})=>{if(n){const{doc:s}=e,{from:a,to:o}=typeof t=="number"?{from:t,to:t}:t,l=Va.atStart(s).from,i=Va.atEnd(s).to,h=qw(a,l,i),p=qw(o,l,i),x=Va.create(s,h,p);e.setSelection(x)}return!0},L_t=t=>({state:e,dispatch:n})=>{const s=xd(t,e.schema);return dvt(s)(e,n)};function ONe(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 O_t=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:s,editor:a})=>{const{selection:o,doc:l}=e,{$from:i,$to:h}=o,p=a.extensionManager.attributes,x=dee(p,i.node().type.name,i.node().attrs);if(o instanceof aa&&o.node.isBlock)return!i.parentOffset||!Gx(l,i.pos)?!1:(s&&(t&&ONe(n,a.extensionManager.splittableMarks),e.split(i.pos).scrollIntoView()),!0);if(!i.parent.isBlock)return!1;const y=h.parentOffset===h.parent.content.size,b=i.depth===0?void 0:y_t(i.node(-1).contentMatchAt(i.indexAfter(-1)));let j=y&&b?[{type:b,attrs:x}]:void 0,C=Gx(e.doc,e.mapping.map(i.pos),1,j);if(!j&&!C&&Gx(e.doc,e.mapping.map(i.pos),1,b?[{type:b}]:void 0)&&(C=!0,j=b?[{type:b,attrs:x}]:void 0),s){if(C&&(o instanceof Va&&e.deleteSelection(),e.split(e.mapping.map(i.pos),1,j),b&&!y&&!i.parentOffset&&i.parent.type!==b)){const N=e.mapping.map(i.before()),A=e.doc.resolve(N);i.node(-1).canReplaceWith(A.index(),A.index()+1,b)&&e.setNodeMarkup(e.mapping.map(i.before()),b)}t&&ONe(n,a.extensionManager.splittableMarks),e.scrollIntoView()}return C},D_t=(t,e={})=>({tr:n,state:s,dispatch:a,editor:o})=>{var l;const i=xd(t,s.schema),{$from:h,$to:p}=s.selection,x=s.selection.node;if(x&&x.isBlock||h.depth<2||!h.sameParent(p))return!1;const y=h.node(-1);if(y.type!==i)return!1;const b=o.extensionManager.attributes;if(h.parent.content.size===0&&h.node(-1).childCount===h.indexAfter(-1)){if(h.depth===2||h.node(-3).type!==i||h.index(-2)!==h.node(-2).childCount-1)return!1;if(a){let E=_n.empty;const T=h.index(-1)?1:h.index(-2)?2:3;for(let Z=h.depth-T;Z>=h.depth-3;Z-=1)E=_n.from(h.node(Z).copy(E));const L=h.indexAfter(-1){if(H>-1)return!1;Z.isTextblock&&Z.content.size===0&&(H=G+1)}),H>-1&&n.setSelection(Va.near(n.doc.resolve(H))),n.scrollIntoView()}return!0}const j=p.pos===h.end()?y.contentMatchAt(0).defaultType:null,C={...dee(b,y.type.name,y.attrs),...e},N={...dee(b,h.node().type.name,h.node().attrs),...e};n.delete(h.pos,p.pos);const A=j?[{type:i,attrs:C},{type:j,attrs:N}]:[{type:i,attrs:C}];if(!Gx(n.doc,h.pos,2))return!1;if(a){const{selection:E,storedMarks:T}=s,{splittableMarks:L}=o.extensionManager,z=T||E.$to.parentOffset&&E.$from.marks();if(n.split(h.pos,2,A).scrollIntoView(),!z||!a)return!0;const F=z.filter(q=>L.includes(q.type.name));n.ensureMarks(F)}return!0},vce=(t,e)=>{const n=sye(l=>l.type===e)(t.selection);if(!n)return!0;const s=t.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(s===void 0)return!0;const a=t.doc.nodeAt(s);return n.node.type===(a==null?void 0:a.type)&&lv(t.doc,n.pos)&&t.join(n.pos),!0},_ce=(t,e)=>{const n=sye(l=>l.type===e)(t.selection);if(!n)return!0;const s=t.doc.resolve(n.start).after(n.depth);if(s===void 0)return!0;const a=t.doc.nodeAt(s);return n.node.type===(a==null?void 0:a.type)&&lv(t.doc,s)&&t.join(s),!0},R_t=(t,e,n,s={})=>({editor:a,tr:o,state:l,dispatch:i,chain:h,commands:p,can:x})=>{const{extensions:y,splittableMarks:b}=a.extensionManager,j=xd(t,l.schema),C=xd(e,l.schema),{selection:N,storedMarks:A}=l,{$from:E,$to:T}=N,L=E.blockRange(T),z=A||N.$to.parentOffset&&N.$from.marks();if(!L)return!1;const F=sye(q=>LNe(q.type.name,y))(N);if(L.depth>=1&&F&&L.depth-F.depth<=1){if(F.node.type===j)return p.liftListItem(C);if(LNe(F.node.type.name,y)&&j.validContent(F.node.content)&&i)return h().command(()=>(o.setNodeMarkup(F.pos,j),!0)).command(()=>vce(o,j)).command(()=>_ce(o,j)).run()}return!n||!z||!i?h().command(()=>x().wrapInList(j,s)?!0:p.clearNodes()).wrapInList(j,s).command(()=>vce(o,j)).command(()=>_ce(o,j)).run():h().command(()=>{const q=x().wrapInList(j,s),H=z.filter(Z=>b.includes(Z.type.name));return o.ensureMarks(H),q?!0:p.clearNodes()}).wrapInList(j,s).command(()=>vce(o,j)).command(()=>_ce(o,j)).run()},F_t=(t,e={},n={})=>({state:s,commands:a})=>{const{extendEmptyMarkRange:o=!1}=n,l=dv(t,s.schema);return Whe(s,l,e)?a.unsetMark(l,{extendEmptyMarkRange:o}):a.setMark(l,e)},z_t=(t,e,n={})=>({state:s,commands:a})=>{const o=xd(t,s.schema),l=xd(e,s.schema),i=pE(s,o,n);let h;return s.selection.$anchor.sameParent(s.selection.$head)&&(h=s.selection.$anchor.parent.attrs),i?a.setNode(l,h):a.setNode(o,{...h,...n})},B_t=(t,e={})=>({state:n,commands:s})=>{const a=xd(t,n.schema);return pE(n,a,e)?s.lift(a):s.wrapIn(a,e)},$_t=()=>({state:t,dispatch:e})=>{const n=t.plugins;for(let s=0;s=0;h-=1)l.step(i.steps[h].invert(i.docs[h]));if(o.text){const h=l.doc.resolve(o.from).marks();l.replaceWith(o.from,o.to,t.schema.text(o.text,h))}else l.delete(o.from,o.to)}return!0}}return!1},U_t=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,{empty:s,ranges:a}=n;return s||e&&a.forEach(o=>{t.removeMark(o.$from.pos,o.$to.pos)}),!0},q_t=(t,e={})=>({tr:n,state:s,dispatch:a})=>{var o;const{extendEmptyMarkRange:l=!1}=e,{selection:i}=n,h=dv(t,s.schema),{$from:p,empty:x,ranges:y}=i;if(!a)return!0;if(x&&l){let{from:b,to:j}=i;const C=(o=p.marks().find(A=>A.type===h))===null||o===void 0?void 0:o.attrs,N=rye(p,h,C);N&&(b=N.from,j=N.to),n.removeMark(b,j,h)}else y.forEach(b=>{n.removeMark(b.$from.pos,b.$to.pos,h)});return n.removeStoredMark(h),!0},V_t=(t,e={})=>({tr:n,state:s,dispatch:a})=>{let o=null,l=null;const i=$se(typeof t=="string"?t:t.name,s.schema);return i?(i==="node"&&(o=xd(t,s.schema)),i==="mark"&&(l=dv(t,s.schema)),a&&n.selection.ranges.forEach(h=>{const p=h.$from.pos,x=h.$to.pos;let y,b,j,C;n.selection.empty?s.doc.nodesBetween(p,x,(N,A)=>{o&&o===N.type&&(j=Math.max(A,p),C=Math.min(A+N.nodeSize,x),y=A,b=N)}):s.doc.nodesBetween(p,x,(N,A)=>{A=p&&A<=x&&(o&&o===N.type&&n.setNodeMarkup(A,void 0,{...N.attrs,...e}),l&&N.marks.length&&N.marks.forEach(E=>{if(l===E.type){const T=Math.max(A,p),L=Math.min(A+N.nodeSize,x);n.addMark(T,L,l.create({...E.attrs,...e}))}}))}),b&&(y!==void 0&&n.setNodeMarkup(y,void 0,{...b.attrs,...e}),l&&b.marks.length&&b.marks.forEach(N=>{l===N.type&&n.addMark(j,C,l.create({...N.attrs,...e}))}))}),!0):!1},H_t=(t,e={})=>({state:n,dispatch:s})=>{const a=xd(t,n.schema);return nvt(a,e)(n,s)},W_t=(t,e={})=>({state:n,dispatch:s})=>{const a=xd(t,n.schema);return svt(a,e)(n,s)};var G_t=Object.freeze({__proto__:null,blur:Cvt,clearContent:Mvt,clearNodes:Tvt,command:Avt,createParagraphNear:Evt,cut:Ivt,deleteCurrentNode:Pvt,deleteNode:Lvt,deleteRange:Ovt,deleteSelection:Dvt,enter:Rvt,exitCode:Fvt,extendMarkRange:zvt,first:Bvt,focus:Uvt,forEach:qvt,insertContent:Vvt,insertContentAt:Gvt,joinBackward:Yvt,joinDown:Zvt,joinForward:Xvt,joinItemBackward:Qvt,joinItemForward:Jvt,joinTextblockBackward:e_t,joinTextblockForward:t_t,joinUp:Kvt,keyboardShortcut:n_t,lift:s_t,liftEmptyBlock:a_t,liftListItem:i_t,newlineInCode:o_t,resetAttributes:l_t,scrollIntoView:c_t,selectAll:d_t,selectNodeBackward:u_t,selectNodeForward:h_t,selectParentNode:f_t,selectTextblockEnd:p_t,selectTextblockStart:m_t,setContent:g_t,setMark:T_t,setMeta:A_t,setNode:E_t,setNodeSelection:I_t,setTextSelection:P_t,sinkListItem:L_t,splitBlock:O_t,splitListItem:D_t,toggleList:R_t,toggleMark:F_t,toggleNode:z_t,toggleWrap:B_t,undoInputRule:$_t,unsetAllMarks:U_t,unsetMark:q_t,updateAttributes:V_t,wrapIn:H_t,wrapInList:W_t});const K_t=Bd.create({name:"commands",addCommands(){return{...G_t}}}),Z_t=Bd.create({name:"drop",addProseMirrorPlugins(){return[new Ud({key:new pf("tiptapDrop"),props:{handleDrop:(t,e,n,s)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:s})}}})]}}),Y_t=Bd.create({name:"editable",addProseMirrorPlugins(){return[new Ud({key:new pf("editable"),props:{editable:()=>this.editor.options.editable}})]}}),X_t=new pf("focusEvents"),Q_t=Bd.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new Ud({key:X_t,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}}}})]}}),J_t=Bd.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first(({commands:l})=>[()=>l.undoInputRule(),()=>l.command(({tr:i})=>{const{selection:h,doc:p}=i,{empty:x,$anchor:y}=h,{pos:b,parent:j}=y,C=y.parent.isTextblock&&b>0?i.doc.resolve(b-1):y,N=C.parent.type.spec.isolating,A=y.pos-y.parentOffset,E=N&&C.parent.childCount===1?A===y.pos:ui.atStart(p).from===b;return!x||!j.type.isTextblock||j.textContent.length||!E||E&&y.parent.type.name==="paragraph"?!1:l.clearNodes()}),()=>l.deleteSelection(),()=>l.joinBackward(),()=>l.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:l})=>[()=>l.deleteSelection(),()=>l.deleteCurrentNode(),()=>l.joinForward(),()=>l.selectNodeForward()]),s={Enter:()=>this.editor.commands.first(({commands:l})=>[()=>l.newlineInCode(),()=>l.createParagraphNear(),()=>l.liftEmptyBlock(),()=>l.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:t,"Mod-Backspace":t,"Shift-Backspace":t,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},a={...s},o={...s,"Ctrl-h":t,"Alt-Backspace":t,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return nye()||VFe()?o:a},addProseMirrorPlugins(){return[new Ud({key:new pf("clearDocument"),appendTransaction:(t,e,n)=>{if(t.some(N=>N.getMeta("composition")))return;const s=t.some(N=>N.docChanged)&&!e.doc.eq(n.doc),a=t.some(N=>N.getMeta("preventClearDocument"));if(!s||a)return;const{empty:o,from:l,to:i}=e.selection,h=ui.atStart(e.doc).from,p=ui.atEnd(e.doc).to;if(o||!(l===h&&i===p)||!iye(n.doc))return;const b=n.tr,j=Dse({state:n,transaction:b}),{commands:C}=new Rse({editor:this.editor,state:j});if(C.clearNodes(),!!b.steps.length)return b}})]}}),e2t=Bd.create({name:"paste",addProseMirrorPlugins(){return[new Ud({key:new pf("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),t2t=Bd.create({name:"tabindex",addProseMirrorPlugins(){return[new Ud({key:new pf("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}});class Pw{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 Pw(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 Pw(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 Pw(e,this.editor)}get children(){const e=[];return this.node.content.forEach((n,s)=>{const a=n.isBlock&&!n.isTextblock,o=n.isAtom&&!n.isText,l=this.pos+s+(o?0:1);if(l<0||l>this.resolvedPos.doc.nodeSize-2)return;const i=this.resolvedPos.doc.resolve(l);if(!a&&i.depth<=this.depth)return;const h=new Pw(i,this.editor,a,a?n:null);a&&(h.actualDepth=this.depth+1),e.push(new Pw(i,this.editor,a,a?n:null))}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,n={}){let s=null,a=this.parent;for(;a&&!s;){if(a.node.type.name===e)if(Object.keys(n).length>0){const o=a.node.attrs,l=Object.keys(n);for(let i=0;i{s&&a.length>0||(l.node.type.name===e&&o.every(h=>n[h]===l.node.attrs[h])&&a.push(l),!(s&&a.length>0)&&(a=a.concat(l.querySelectorAll(e,n,s))))}),a}setAttribute(e){const{tr:n}=this.editor.state;n.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(n)}}const r2t=`.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 n2t(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 s2t extends uvt{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=n2t(r2t,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=RFe(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?[Y_t,Svt.configure({blockSeparator:(n=(e=this.options.coreExtensionOptions)===null||e===void 0?void 0:e.clipboardTextSerializer)===null||n===void 0?void 0:n.blockSeparator}),K_t,Q_t,J_t,t2t,Z_t,e2t].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 R4(a,this)}createCommandManager(){this.commandManager=new Rse({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createView(){var e;let n;try{n=Hhe(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(l){if(!(l instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(l.message))throw l;this.emit("contentError",{editor:this,error:l,disableCollaboration:()=>{this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(i=>i.name!=="collaboration"),this.createExtensionManager()}}),n=Hhe(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}const s=UFe(n,this.options.autofocus);this.view=new wFe(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:D4.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 WFe(this.state,e)}isActive(e,n){const s=typeof e=="string"?e:null,a=typeof e=="string"?n:e;return S_t(this.state,s,a)}getJSON(){return this.state.doc.toJSON()}getHTML(){return eye(this.state.doc.content,this.schema)}getText(e){const{blockSeparator:n=` `,textSerializers:s={}}=e||{};return b_t(this.state.doc,{blockSeparator:n,textSerializers:{...zFe(this.schema),...s}})}get isEmpty(){return iye(this.state.doc)}getCharacterCount(){return console.warn('[tiptap warn]: "editor.getCharacterCount()" is deprecated. Please use "editor.storage.characterCount.characters()" instead.'),this.state.doc.content.size-2}destroy(){if(this.emit("destroy"),this.view){const e=this.view.dom;e&&e.editor&&delete e.editor,this.view.destroy()}this.removeAllListeners()}get isDestroyed(){var e;return!(!((e=this.view)===null||e===void 0)&&e.docView)}$node(e,n){var s;return((s=this.$doc)===null||s===void 0?void 0:s.querySelector(e,n))||null}$nodes(e,n){var s;return((s=this.$doc)===null||s===void 0?void 0:s.querySelectorAll(e,n))||null}$pos(e){const n=this.state.doc.resolve(e);return new Pw(n,this)}get $doc(){return this.$pos(0)}}function vC(t){return new zse({find:t.find,handler:({state:e,range:n,match:s})=>{const a=hi(t.getAttributes,void 0,s);if(a===!1||a===null)return null;const{tr:o}=e,l=s[s.length-1],i=s[0];if(l){const h=i.search(/\S/),p=n.from+i.indexOf(l),x=p+l.length;if(aye(n.from,n.to,e.doc).filter(j=>j.mark.type.excluded.find(N=>N===t.type&&N!==j.mark.type)).filter(j=>j.to>p).length)return null;xn.from&&o.delete(n.from+h,p);const b=n.from+h+l.length;o.addMark(n.from+h,b,t.type.create(a||{})),o.removeStoredMark(t.type)}}})}function a2t(t){return new zse({find:t.find,handler:({state:e,range:n,match:s})=>{const a=hi(t.getAttributes,void 0,s)||{},{tr:o}=e,l=n.from;let i=n.to;const h=t.type.create(a);if(s[1]){const p=s[0].lastIndexOf(s[1]);let x=l+p;x>i?x=i:i=x+s[1].length;const y=s[0][s[0].length-1];o.insertText(y,l+s[0].length-1),o.replaceWith(x,i,h)}else if(s[0]){const p=t.type.isInline?l:l-1;o.insert(p,t.type.create(a)).delete(o.mapping.map(l),o.mapping.map(i))}o.scrollIntoView()}})}function Ghe(t){return new zse({find:t.find,handler:({state:e,range:n,match:s})=>{const a=e.doc.resolve(n.from),o=hi(t.getAttributes,void 0,s)||{};if(!a.node(-1).canReplaceWith(a.index(-1),a.indexAfter(-1),t.type))return null;e.tr.delete(n.from,n.to).setBlockType(n.from,n.from,t.type,o)}})}function mE(t){return new zse({find:t.find,handler:({state:e,range:n,match:s,chain:a})=>{const o=hi(t.getAttributes,void 0,s)||{},l=e.tr.delete(n.from,n.to),h=l.doc.resolve(n.from).blockRange(),p=h&&Fxe(h,t.type,o);if(!p)return null;if(l.wrap(h,p),t.keepMarks&&t.editor){const{selection:y,storedMarks:b}=e,{splittableMarks:j}=t.editor.extensionManager,C=b||y.$to.parentOffset&&y.$from.marks();if(C){const N=C.filter(A=>j.includes(A.type.name));l.ensureMarks(N)}}if(t.keepAttributes){const y=t.type.name==="bulletList"||t.type.name==="orderedList"?"listItem":"taskList";a().updateAttributes(y,o).run()}const x=l.doc.resolve(n.from-1).nodeBefore;x&&x.type===t.type&&lv(l.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(s,x))&&l.join(n.from-1)}})}let Cm=class Khe{constructor(e={}){this.type="node",this.name="node",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=hi(ks(this,"addOptions",{name:this.name}))),this.storage=hi(ks(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new Khe(e)}configure(e={}){const n=this.extend({...this.config,addOptions:()=>Bse(this.options,e)});return n.name=this.name,n.parent=this.parent,n}extend(e={}){const n=new Khe(e);return n.parent=this,this.child=n,n.name=e.name?e.name:n.parent.name,e.defaultOptions&&Object.keys(e.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`),n.options=hi(ks(n,"addOptions",{name:n.name})),n.storage=hi(ks(n,"addStorage",{name:n.name,options:n.options})),n}};function Zj(t){return new _vt({find:t.find,handler:({state:e,range:n,match:s,pasteEvent:a})=>{const o=hi(t.getAttributes,void 0,s,a);if(o===!1||o===null)return null;const{tr:l}=e,i=s[s.length-1],h=s[0];let p=n.to;if(i){const x=h.search(/\S/),y=n.from+h.indexOf(i),b=y+i.length;if(aye(n.from,n.to,e.doc).filter(C=>C.mark.type.excluded.find(A=>A===t.type&&A!==C.mark.type)).filter(C=>C.to>y).length)return null;bn.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 i2t(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 o2t(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var GFe={exports:{}},bce={};/** * @license React * use-sync-external-store-shim.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var DNe;function l2t(){if(DNe)return bce;DNe=1;var t=st;function e(y,b){return y===b&&(y!==0||1/y===1/b)||y!==y&&b!==b}var n=typeof Object.is=="function"?Object.is:e,s=t.useState,a=t.useEffect,o=t.useLayoutEffect,l=t.useDebugValue;function i(y,b){var j=b(),C=s({inst:{value:j,getSnapshot:b}}),N=C[0].inst,A=C[1];return o(function(){N.value=j,N.getSnapshot=b,h(N)&&A({inst:N})},[y,j,b]),a(function(){return h(N)&&A({inst:N}),y(function(){h(N)&&A({inst:N})})},[y]),l(j),j}function h(y){var b=y.getSnapshot;y=y.value;try{var j=b();return!n(y,j)}catch{return!0}}function p(y,b){return b()}var x=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?p:i;return bce.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:x,bce}GFe.exports=l2t();var oye=GFe.exports;const c2t=(...t)=>e=>{t.forEach(n=>{typeof n=="function"?n(e):n&&(n.current=e)})},d2t=({contentComponent:t})=>{const e=oye.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getServerSnapshot);return st.createElement(st.Fragment,null,Object.values(e))};function u2t(){const t=new Set;let e={};return{subscribe(n){return t.add(n),()=>{t.delete(n)}},getSnapshot(){return e},getServerSnapshot(){return e},setRenderer(n,s){e={...e,[n]:Ome.createPortal(s.reactElement,s.element,n)},t.forEach(a=>a())},removeRenderer(n){const s={...e};delete s[n],e=s,t.forEach(a=>a())}}}class h2t extends st.Component{constructor(e){var n;super(e),this.editorContentRef=st.createRef(),this.initialized=!1,this.state={hasContentComponentInitialized:!!(!((n=e.editor)===null||n===void 0)&&n.contentComponent)}}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){const e=this.props.editor;if(e&&!e.isDestroyed&&e.options.element){if(e.contentComponent)return;const n=this.editorContentRef.current;n.append(...e.options.element.childNodes),e.setOptions({element:n}),e.contentComponent=u2t(),this.state.hasContentComponentInitialized||(this.unsubscribeToContentComponent=e.contentComponent.subscribe(()=>{this.setState(s=>s.hasContentComponentInitialized?s:{hasContentComponentInitialized:!0}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent()})),e.createNodeViews(),this.initialized=!0}}componentWillUnmount(){const e=this.props.editor;if(!e||(this.initialized=!1,e.isDestroyed||e.view.setProps({nodeViews:{}}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent(),e.contentComponent=null,!e.options.element.firstChild))return;const n=document.createElement("div");n.append(...e.options.element.childNodes),e.setOptions({element:n})}render(){const{editor:e,innerRef:n,...s}=this.props;return st.createElement(st.Fragment,null,st.createElement("div",{ref:c2t(n,this.editorContentRef),...s}),(e==null?void 0:e.contentComponent)&&st.createElement(d2t,{contentComponent:e.contentComponent}))}}const f2t=I.forwardRef((t,e)=>{const n=st.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[t.editor]);return st.createElement(h2t,{key:n,innerRef:e,...t})}),KFe=st.memo(f2t);var p2t=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},m2t=o2t(p2t),ZFe={exports:{}},wce={};/** * @license React * use-sync-external-store-shim/with-selector.production.min.js * * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */var RNe;function g2t(){if(RNe)return wce;RNe=1;var t=st,e=oye;function n(p,x){return p===x&&(p!==0||1/p===1/x)||p!==p&&x!==x}var s=typeof Object.is=="function"?Object.is:n,a=e.useSyncExternalStore,o=t.useRef,l=t.useEffect,i=t.useMemo,h=t.useDebugValue;return wce.useSyncExternalStoreWithSelector=function(p,x,y,b,j){var C=o(null);if(C.current===null){var N={hasValue:!1,value:null};C.current=N}else N=C.current;C=i(function(){function E(q){if(!T){if(T=!0,L=q,q=b(q),j!==void 0&&N.hasValue){var H=N.value;if(j(H,q))return z=H}return z=q}if(H=z,s(L,q))return H;var Z=b(q);return j!==void 0&&j(H,Z)?H:(L=q,z=Z)}var T=!1,L,z,F=y===void 0?null:y;return[function(){return E(x())},F===null?void 0:function(){return E(F())}]},[x,y,b,j]);var A=a(p,C[0],C[1]);return l(function(){N.hasValue=!0,N.value=A},[A]),h(A),A},wce}ZFe.exports=g2t();var x2t=ZFe.exports;const y2t=typeof window<"u"?I.useLayoutEffect:I.useEffect;class v2t{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 _2t(t){var e;const[n]=I.useState(()=>new v2t(t.editor)),s=x2t.useSyncExternalStoreWithSelector(n.subscribe,n.getSnapshot,n.getServerSnapshot,t.selector,(e=t.equalityFn)!==null&&e!==void 0?e:m2t);return y2t(()=>n.watch(t.editor),[t.editor,n]),I.useDebugValue(s),s}const b2t=!1,Zhe=typeof window>"u",w2t=Zhe||!!(typeof window<"u"&&window.next);class lye{constructor(e){this.editor=null,this.subscriptions=new Set,this.isComponentMounted=!1,this.previousDeps=null,this.instanceId="",this.options=e,this.subscriptions=new Set,this.setEditor(this.getInitialEditor()),this.scheduleDestroy(),this.getEditor=this.getEditor.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.subscribe=this.subscribe.bind(this),this.refreshEditorInstance=this.refreshEditorInstance.bind(this),this.scheduleDestroy=this.scheduleDestroy.bind(this),this.onRender=this.onRender.bind(this),this.createEditor=this.createEditor.bind(this)}setEditor(e){this.editor=e,this.instanceId=Math.random().toString(36).slice(2,9),this.subscriptions.forEach(n=>n())}getInitialEditor(){return this.options.current.immediatelyRender===void 0?Zhe||w2t?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 s2t(e)}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(e){return this.subscriptions.add(e),()=>{this.subscriptions.delete(e)}}static compareOptions(e,n){return Object.keys(e).every(s=>["onCreate","onBeforeCreate","onDestroy","onUpdate","onTransaction","onFocus","onBlur","onSelectionUpdate","onContentError","onDrop","onPaste"].includes(s)?!0:s==="extensions"&&e.extensions&&n.extensions?e.extensions.length!==n.extensions.length?!1:e.extensions.every((a,o)=>{var l;return a===((l=n.extensions)===null||l===void 0?void 0:l[o])}):e[s]===n[s])}onRender(e){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&e.length===0?lye.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(e),()=>{this.isComponentMounted=!1,this.scheduleDestroy()})}refreshEditorInstance(e){if(this.editor&&!this.editor.isDestroyed){if(this.previousDeps===null){this.previousDeps=e;return}if(this.previousDeps.length===e.length&&this.previousDeps.every((s,a)=>s===e[a]))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=e}scheduleDestroy(){const e=this.instanceId,n=this.editor;this.scheduledDestructionTimeout=setTimeout(()=>{if(this.isComponentMounted&&this.instanceId===e){n&&n.setOptions(this.options.current);return}n&&!n.isDestroyed&&(n.destroy(),this.instanceId===e&&this.setEditor(null))},1)}}function YFe(t={},e=[]){const n=I.useRef(t);n.current=t;const[s]=I.useState(()=>new lye(n)),a=oye.useSyncExternalStore(s.subscribe,s.getEditor,s.getServerSnapshot);return I.useDebugValue(a),I.useEffect(s.onRender(e)),_2t({editor:a,selector:({transactionNumber:o})=>t.shouldRerenderOnTransaction===!1?null:t.immediatelyRender&&o===0?0:o+1}),a}const j2t=I.createContext({editor:null});j2t.Consumer;const k2t=I.createContext({onDragStart:void 0}),N2t=()=>I.useContext(k2t);st.forwardRef((t,e)=>{const{onDragStart:n}=N2t(),s=t.as||"div";return st.createElement(s,{...t,ref:e,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...t.style}})});const S2t=/^\s*>\s$/,C2t=Cm.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return["blockquote",yd(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[mE({find:S2t,type:this.type})]}}),M2t=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,T2t=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,A2t=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,E2t=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,I2t=Og.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",yd(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[vC({find:M2t,type:this.type}),vC({find:A2t,type:this.type})]},addPasteRules(){return[Zj({find:T2t,type:this.type}),Zj({find:E2t,type:this.type})]}}),P2t="listItem",FNe="textStyle",zNe=/^\s*([-+*])\s$/,L2t=Cm.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",yd(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(P2t,this.editor.getAttributes(FNe)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=mE({find:zNe,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=mE({find:zNe,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(FNe),editor:this.editor})),[t]}}),O2t=/(^|[^`])`([^`]+)`(?!`)/,D2t=/(^|[^`])`([^`]+)`(?!`)/g,R2t=Og.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:t}){return["code",yd(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[vC({find:O2t,type:this.type})]},addPasteRules(){return[Zj({find:D2t,type:this.type})]}}),F2t=/^```([a-z]+)?[\s\n]$/,z2t=/^~~~([a-z]+)?[\s\n]$/,B2t=Cm.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",yd(this.options.HTMLAttributes,e),["code",{class:t.attrs.language?this.options.languageClassPrefix+t.attrs.language:null},0]]},addCommands(){return{setCodeBlock:t=>({commands:e})=>e.setNode(this.name,t),toggleCodeBlock:t=>({commands:e})=>e.toggleNode(this.name,"paragraph",t)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:t,$anchor:e}=this.editor.state.selection,n=e.pos===1;return!t||e.parent.type.name!==this.name?!1:n||!e.parent.textContent.length?this.editor.commands.clearNodes():!1},Enter:({editor:t})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:e}=t,{selection:n}=e,{$from:s,empty:a}=n;if(!a||s.parent.type!==this.type)return!1;const o=s.parentOffset===s.parent.nodeSize-2,l=s.parent.textContent.endsWith(` `);return!o||!l?!1:t.chain().command(({tr:i})=>(i.delete(s.pos-2,s.pos),!0)).exitCode().run()},ArrowDown:({editor:t})=>{if(!this.options.exitOnArrowDown)return!1;const{state:e}=t,{selection:n,doc:s}=e,{$from:a,empty:o}=n;if(!o||a.parent.type!==this.type||!(a.parentOffset===a.parent.nodeSize-2))return!1;const i=a.after();return i===void 0?!1:s.nodeAt(i)?t.commands.command(({tr:p})=>(p.setSelection(ui.near(s.resolve(i))),!0)):t.commands.exitCode()}}},addInputRules(){return[Ghe({find:F2t,type:this.type,getAttributes:t=>({language:t[1]})}),Ghe({find:z2t,type:this.type,getAttributes:t=>({language:t[1]})})]},addProseMirrorPlugins(){return[new Ud({key:new pf("codeBlockVSCodeHandler"),props:{handlePaste:(t,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;const n=e.clipboardData.getData("text/plain"),s=e.clipboardData.getData("vscode-editor-data"),a=s?JSON.parse(s):void 0,o=a==null?void 0:a.mode;if(!n||!o)return!1;const{tr:l,schema:i}=t.state,h=i.text(n.replace(/\r\n?/g,` `));return l.replaceSelectionWith(this.type.create({language:o},h)),l.selection.$from.parent.type!==this.type&&l.setSelection(Va.near(l.doc.resolve(Math.max(0,l.selection.from-2)))),l.setMeta("paste",!0),t.dispatch(l),!0}}})]}}),$2t=Cm.create({name:"doc",topNode:!0,content:"block+"});function U2t(t={}){return new Ud({view(e){return new q2t(e,t)}})}class q2t{constructor(e,n){var s;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(s=n.width)!==null&&s!==void 0?s:1,this.color=n.color===!1?void 0:n.color||"black",this.class=n.class,this.handlers=["dragover","dragend","drop","dragleave"].map(a=>{let o=l=>{this[a](l)};return e.dom.addEventListener(a,o),{name:a,handler:o}})}destroy(){this.handlers.forEach(({name:e,handler:n})=>this.editorView.dom.removeEventListener(e,n))}update(e,n){this.cursorPos!=null&&n.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),n=!e.parent.inlineContent,s,a=this.editorView.dom,o=a.getBoundingClientRect(),l=o.width/a.offsetWidth,i=o.height/a.offsetHeight;if(n){let y=e.nodeBefore,b=e.nodeAfter;if(y||b){let j=this.editorView.nodeDOM(this.cursorPos-(y?y.nodeSize:0));if(j){let C=j.getBoundingClientRect(),N=y?C.bottom:C.top;y&&b&&(N=(N+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let A=this.width/2*i;s={left:C.left,right:C.right,top:N-A,bottom:N+A}}}}if(!s){let y=this.editorView.coordsAtPos(this.cursorPos),b=this.width/2*l;s={left:y.left-b,right:y.left+b,top:y.top,bottom:y.bottom}}let h=this.editorView.dom.offsetParent;this.element||(this.element=h.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n);let p,x;if(!h||h==document.body&&getComputedStyle(h).position=="static")p=-pageXOffset,x=-pageYOffset;else{let y=h.getBoundingClientRect(),b=y.width/h.offsetWidth,j=y.height/h.offsetHeight;p=y.left-h.scrollLeft*b,x=y.top-h.scrollTop*j}this.element.style.left=(s.left-p)/l+"px",this.element.style.top=(s.top-x)/i+"px",this.element.style.width=(s.right-s.left)/l+"px",this.element.style.height=(s.bottom-s.top)/i+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let n=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),s=n&&n.inside>=0&&this.editorView.state.doc.nodeAt(n.inside),a=s&&s.type.spec.disableDropCursor,o=typeof a=="function"?a(this.editorView,n,e):a;if(n&&!o){let l=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let i=LRe(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 V2t=Bd.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[U2t(this.options)]}});class Yl extends ui{constructor(e){super(e,e)}map(e,n){let s=e.resolve(n.map(this.head));return Yl.valid(s)?new Yl(s):ui.near(s)}content(){return fs.empty}eq(e){return e instanceof Yl&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new Yl(e.resolve(n.pos))}getBookmark(){return new cye(this.anchor)}static valid(e){let n=e.parent;if(n.isTextblock||!H2t(e)||!W2t(e))return!1;let s=n.type.spec.allowGapCursor;if(s!=null)return s;let a=n.contentMatchAt(e.index()).defaultType;return a&&a.isTextblock}static findGapCursorFrom(e,n,s=!1){e:for(;;){if(!s&&Yl.valid(e))return e;let a=e.pos,o=null;for(let l=e.depth;;l--){let i=e.node(l);if(n>0?e.indexAfter(l)0){o=i.child(n>0?e.indexAfter(l):e.index(l)-1);break}else if(l==0)return null;a+=n;let h=e.doc.resolve(a);if(Yl.valid(h))return h}for(;;){let l=n>0?o.firstChild:o.lastChild;if(!l){if(o.isAtom&&!o.isText&&!aa.isSelectable(o)){e=e.doc.resolve(a+o.nodeSize*n),s=!1;continue e}break}o=l,a+=n;let i=e.doc.resolve(a);if(Yl.valid(i))return i}return null}}}Yl.prototype.visible=!1;Yl.findFrom=Yl.findGapCursorFrom;ui.jsonID("gapcursor",Yl);class cye{constructor(e){this.pos=e}map(e){return new cye(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return Yl.valid(n)?new Yl(n):ui.near(n)}}function XFe(t){return t.isAtom||t.spec.isolating||t.spec.createGapCursor}function H2t(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||XFe(a.type))return!0;if(a.inlineContent)return!1}}return!0}function W2t(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||XFe(a.type))return!0;if(a.inlineContent)return!1}}return!0}function G2t(){return new Ud({props:{decorations:X2t,createSelectionBetween(t,e,n){return e.pos==n.pos&&Yl.valid(n)?new Yl(n):null},handleClick:Z2t,handleKeyDown:K2t,handleDOMEvents:{beforeinput:Y2t}}})}const K2t=jFe({ArrowLeft:IL("horiz",-1),ArrowRight:IL("horiz",1),ArrowUp:IL("vert",-1),ArrowDown:IL("vert",1)});function IL(t,e){const n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(s,a,o){let l=s.selection,i=e>0?l.$to:l.$from,h=l.empty;if(l instanceof Va){if(!o.endOfTextblock(n)||i.depth==0)return!1;h=!1,i=s.doc.resolve(e>0?i.after():i.before())}let p=Yl.findGapCursorFrom(i,e,h);return p?(a&&a(s.tr.setSelection(new Yl(p))),!0):!1}}function Z2t(t,e,n){if(!t||!t.editable)return!1;let s=t.state.doc.resolve(e);if(!Yl.valid(s))return!1;let a=t.posAtCoords({left:n.clientX,top:n.clientY});return a&&a.inside>-1&&aa.isSelectable(t.state.doc.nodeAt(a.inside))?!1:(t.dispatch(t.state.tr.setSelection(new Yl(s))),!0)}function Y2t(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof Yl))return!1;let{$from:n}=t.state.selection,s=n.parent.contentMatchAt(n.index()).findWrapping(t.state.schema.nodes.text);if(!s)return!1;let a=_n.empty;for(let l=s.length-1;l>=0;l--)a=_n.from(s[l].createAndFill(null,a));let o=t.state.tr.replace(n.pos,n.pos,new fs(a,0,0));return o.setSelection(Va.near(o.doc.resolve(n.pos+1))),t.dispatch(o),!1}function X2t(t){if(!(t.selection instanceof Yl))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",Uc.create(t.doc,[Hf.widget(t.selection.head,e,{key:"gapcursor"})])}const Q2t=Bd.create({name:"gapCursor",addProseMirrorPlugins(){return[G2t()]},extendNodeSchema(t){var e;const n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=hi(ks(t,"allowGapCursor",n)))!==null&&e!==void 0?e:null}}}),J2t=Cm.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",yd(this.options.HTMLAttributes,t)]},renderText(){return` `},addCommands(){return{setHardBreak:()=>({commands:t,chain:e,state:n,editor:s})=>t.first([()=>t.exitCode(),()=>t.command(()=>{const{selection:a,storedMarks:o}=n;if(a.$from.parent.type.spec.isolating)return!1;const{keepMarks:l}=this.options,{splittableMarks:i}=s.extensionManager,h=o||a.$to.parentOffset&&a.$from.marks();return e().insertContent({type:this.name}).command(({tr:p,dispatch:x})=>{if(x&&h&&l){const y=h.filter(b=>i.includes(b.type.name));p.ensureMarks(y)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),ebt=Cm.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]}`,yd(this.options.HTMLAttributes,e),0]},addCommands(){return{setHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.setNode(this.name,t):!1,toggleHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.toggleNode(this.name,"paragraph",t):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((t,e)=>({...t,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(t=>Ghe({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}});var Ote=200,gd=function(){};gd.prototype.append=function(e){return e.length?(e=gd.from(e),!this.length&&e||e.length=n?gd.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};gd.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};gd.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)};gd.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};gd.from=function(e){return e instanceof gd?e:e&&e.length?new QFe(e):gd.empty};var QFe=function(t){function e(s){t.call(this),this.values=s}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(a,o){return a==0&&o==this.length?this:new e(this.values.slice(a,o))},e.prototype.getInner=function(a){return this.values[a]},e.prototype.forEachInner=function(a,o,l,i){for(var h=o;h=l;h--)if(a(this.values[h],i+h)===!1)return!1},e.prototype.leafAppend=function(a){if(this.length+a.length<=Ote)return new e(this.values.concat(a.flatten()))},e.prototype.leafPrepend=function(a){if(this.length+a.length<=Ote)return new e(a.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e}(gd);gd.empty=new QFe([]);var tbt=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}(gd);const rbt=500;class nm{constructor(e,n){this.items=e,this.eventCount=n}popEvent(e,n){if(this.eventCount==0)return null;let s=this.items.length;for(;;s--)if(this.items.get(s-1).selection){--s;break}let a,o;n&&(a=this.remapping(s,this.items.length),o=a.maps.length);let l=e.tr,i,h,p=[],x=[];return this.items.forEach((y,b)=>{if(!y.step){a||(a=this.remapping(s,b+1),o=a.maps.length),o--,x.push(y);return}if(a){x.push(new Jm(y.map));let j=y.step.map(a.slice(o)),C;j&&l.maybeStep(j).doc&&(C=l.mapping.maps[l.mapping.maps.length-1],p.push(new Jm(C,void 0,void 0,p.length+x.length))),o--,C&&a.appendMap(C,o)}else l.maybeStep(y.step);if(y.selection)return i=a?y.selection.map(a.slice(o)):y.selection,h=new nm(this.items.slice(0,s).append(x.reverse().concat(p)),this.eventCount-1),!1},this.items.length,0),{remaining:h,transform:l,selection:i}}addTransform(e,n,s,a){let o=[],l=this.eventCount,i=this.items,h=!a&&i.length?i.get(i.length-1):null;for(let x=0;xsbt&&(i=nbt(i,p),l-=p),new nm(i.append(o),l)}remapping(e,n){let s=new lE;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 nm(this.items.append(e.map(n=>new Jm(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(b=>{b.selection&&i--},a);let h=n;this.items.forEach(b=>{let j=o.getMirror(--h);if(j==null)return;l=Math.min(l,j);let C=o.maps[j];if(b.step){let N=e.steps[j].invert(e.docs[j]),A=b.selection&&b.selection.map(o.slice(h+1,j));A&&i++,s.push(new Jm(C,N,A))}else s.push(new Jm(C))},a);let p=[];for(let b=n;brbt&&(y=y.compress(this.items.length-s.length)),y}emptyItemCount(){let e=0;return this.items.forEach(n=>{n.step||e++}),e}compress(e=this.items.length){let n=this.remapping(0,e),s=n.maps.length,a=[],o=0;return this.items.forEach((l,i)=>{if(i>=e)a.push(l),l.selection&&o++;else if(l.step){let h=l.step.map(n.slice(s)),p=h&&h.getMap();if(s--,p&&n.appendMap(p,s),h){let x=l.selection&&l.selection.map(n.slice(s));x&&o++;let y=new Jm(p.invert(),h,x),b,j=a.length-1;(b=a.length&&a[j].merge(y))?a[j]=b:a.push(y)}}else l.map&&s--},this.items.length,0),new nm(gd.from(a.reverse()),o)}}nm.empty=new nm(gd.empty,0);function nbt(t,e){let n;return t.forEach((s,a)=>{if(s.selection&&e--==0)return n=a,!1}),t.slice(n)}class Jm{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 Jm(n.getMap().invert(),n,this.selection)}}}class w0{constructor(e,n,s,a,o){this.done=e,this.undone=n,this.prevRanges=s,this.prevTime=a,this.prevComposition=o}}const sbt=20;function abt(t,e,n,s){let a=n.getMeta(Cj),o;if(a)return a.historyState;n.getMeta(lbt)&&(t=new w0(t.done,t.undone,null,0,-1));let l=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(l&&l.getMeta(Cj))return l.getMeta(Cj).redo?new w0(t.done.addTransform(n,void 0,s,uee(e)),t.undone,BNe(n.mapping.maps),t.prevTime,t.prevComposition):new w0(t.done,t.undone.addTransform(n,void 0,s,uee(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(l&&l.getMeta("addToHistory")===!1)){let i=n.getMeta("composition"),h=t.prevTime==0||!l&&t.prevComposition!=i&&(t.prevTime<(n.time||0)-s.newGroupDelay||!ibt(n,t.prevRanges)),p=l?jce(t.prevRanges,n.mapping):BNe(n.mapping.maps);return new w0(t.done.addTransform(n,h?e.selection.getBookmark():void 0,s,uee(e)),nm.empty,p,n.time,i??t.prevComposition)}else return(o=n.getMeta("rebased"))?new w0(t.done.rebased(n,o),t.undone.rebased(n,o),jce(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new w0(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),jce(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function ibt(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 BNe(t){let e=[];for(let n=t.length-1;n>=0&&e.length==0;n--)t[n].forEach((s,a,o,l)=>e.push(o,l));return e}function jce(t,e){if(!t)return null;let n=[];for(let s=0;s{let a=Cj.getState(n);if(!a||(t?a.undone:a.done).eventCount==0)return!1;if(s){let o=obt(a,n,t);o&&s(e?o.scrollIntoView():o)}return!0}}const eze=JFe(!1,!0),tze=JFe(!0,!0),dbt=Bd.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>eze(t,e),redo:()=>({state:t,dispatch:e})=>tze(t,e)}},addProseMirrorPlugins(){return[cbt(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()}}}),ubt=Cm.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{}}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",yd(this.options.HTMLAttributes,t)]},addCommands(){return{setHorizontalRule:()=>({chain:t,state:e})=>{if(!i2t(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}):C_t(n)?o.insertContentAt(a.pos,{type:this.name}):o.insertContent({type:this.name}),o.command(({tr:l,dispatch:i})=>{var h;if(i){const{$to:p}=l.selection,x=p.end();if(p.nodeAfter)p.nodeAfter.isTextblock?l.setSelection(Va.create(l.doc,p.pos+1)):p.nodeAfter.isBlock?l.setSelection(aa.create(l.doc,p.pos)):l.setSelection(Va.create(l.doc,p.pos));else{const y=(h=p.parent.type.contentMatch.defaultType)===null||h===void 0?void 0:h.create();y&&(l.insert(x,y),l.setSelection(Va.create(l.doc,x+1)))}l.scrollIntoView()}return!0}).run()}}},addInputRules(){return[a2t({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),hbt=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,fbt=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,pbt=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,mbt=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,gbt=Og.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",yd(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[vC({find:hbt,type:this.type}),vC({find:pbt,type:this.type})]},addPasteRules(){return[Zj({find:fbt,type:this.type}),Zj({find:mbt,type:this.type})]}}),xbt=Cm.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",yd(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)}}}),ybt="listItem",UNe="textStyle",qNe=/^(\d+)\.\s$/,vbt=Cm.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",yd(this.options.HTMLAttributes,n),0]:["ol",yd(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(ybt,this.editor.getAttributes(UNe)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=mE({find:qNe,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=mE({find:qNe,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(UNe)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),_bt=Cm.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",yd(this.options.HTMLAttributes,t),0]},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),bbt=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,wbt=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,jbt=Og.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",yd(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[vC({find:bbt,type:this.type})]},addPasteRules(){return[Zj({find:wbt,type:this.type})]}}),kbt=Cm.create({name:"text",group:"inline"}),rze=Bd.create({name:"starterKit",addExtensions(){const t=[];return this.options.bold!==!1&&t.push(I2t.configure(this.options.bold)),this.options.blockquote!==!1&&t.push(C2t.configure(this.options.blockquote)),this.options.bulletList!==!1&&t.push(L2t.configure(this.options.bulletList)),this.options.code!==!1&&t.push(R2t.configure(this.options.code)),this.options.codeBlock!==!1&&t.push(B2t.configure(this.options.codeBlock)),this.options.document!==!1&&t.push($2t.configure(this.options.document)),this.options.dropcursor!==!1&&t.push(V2t.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&t.push(Q2t.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&t.push(J2t.configure(this.options.hardBreak)),this.options.heading!==!1&&t.push(ebt.configure(this.options.heading)),this.options.history!==!1&&t.push(dbt.configure(this.options.history)),this.options.horizontalRule!==!1&&t.push(ubt.configure(this.options.horizontalRule)),this.options.italic!==!1&&t.push(gbt.configure(this.options.italic)),this.options.listItem!==!1&&t.push(xbt.configure(this.options.listItem)),this.options.orderedList!==!1&&t.push(vbt.configure(this.options.orderedList)),this.options.paragraph!==!1&&t.push(_bt.configure(this.options.paragraph)),this.options.strike!==!1&&t.push(jbt.configure(this.options.strike)),this.options.text!==!1&&t.push(kbt.configure(this.options.text)),t}}),Nbt="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",Sbt="ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3հայ3ישראל5קום3ابوظبي5رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1컴2삼성2한국2",Yhe="numeric",Xhe="ascii",Qhe="alpha",pA="asciinumeric",uT="alphanumeric",Jhe="domain",nze="emoji",Cbt="scheme",Mbt="slashscheme",Nce="whitespace";function Tbt(t,e){return t in e||(e[t]=[]),e[t]}function Vw(t,e,n){e[Yhe]&&(e[pA]=!0,e[uT]=!0),e[Xhe]&&(e[pA]=!0,e[Qhe]=!0),e[pA]&&(e[uT]=!0),e[Qhe]&&(e[uT]=!0),e[uT]&&(e[Jhe]=!0),e[nze]&&(e[Jhe]=!0);for(const s in e){const a=Tbt(s,n);a.indexOf(t)<0&&a.push(t)}}function Abt(t,e){const n={};for(const s in e)e[s].indexOf(t)>=0&&(n[s]=!0);return n}function uh(t=null){this.j={},this.jr=[],this.jd=null,this.t=t}uh.groups={};uh.prototype={accepts(){return!!this.t},go(t){const e=this,n=e.j[t];if(n)return n;for(let s=0;st.ta(e,n,s,a),ql=(t,e,n,s,a)=>t.tr(e,n,s,a),VNe=(t,e,n,s,a)=>t.ts(e,n,s,a),Nn=(t,e,n,s,a)=>t.tt(e,n,s,a),vx="WORD",efe="UWORD",sze="ASCIINUMERICAL",aze="ALPHANUMERICAL",gE="LOCALHOST",tfe="TLD",rfe="UTLD",hee="SCHEME",j4="SLASH_SCHEME",dye="NUM",nfe="WS",uye="NL",mA="OPENBRACE",gA="CLOSEBRACE",Dte="OPENBRACKET",Rte="CLOSEBRACKET",Fte="OPENPAREN",zte="CLOSEPAREN",Bte="OPENANGLEBRACKET",$te="CLOSEANGLEBRACKET",Ute="FULLWIDTHLEFTPAREN",qte="FULLWIDTHRIGHTPAREN",Vte="LEFTCORNERBRACKET",Hte="RIGHTCORNERBRACKET",Wte="LEFTWHITECORNERBRACKET",Gte="RIGHTWHITECORNERBRACKET",Kte="FULLWIDTHLESSTHAN",Zte="FULLWIDTHGREATERTHAN",Yte="AMPERSAND",Xte="APOSTROPHE",Qte="ASTERISK",j0="AT",Jte="BACKSLASH",ere="BACKTICK",tre="CARET",A0="COLON",hye="COMMA",rre="DOLLAR",eg="DOT",nre="EQUALS",fye="EXCLAMATION",Pf="HYPHEN",xA="PERCENT",sre="PIPE",are="PLUS",ire="POUND",yA="QUERY",pye="QUOTE",ize="FULLWIDTHMIDDLEDOT",mye="SEMI",tg="SLASH",vA="TILDE",ore="UNDERSCORE",oze="EMOJI",lre="SYM";var lze=Object.freeze({__proto__:null,ALPHANUMERICAL:aze,AMPERSAND:Yte,APOSTROPHE:Xte,ASCIINUMERICAL:sze,ASTERISK:Qte,AT:j0,BACKSLASH:Jte,BACKTICK:ere,CARET:tre,CLOSEANGLEBRACKET:$te,CLOSEBRACE:gA,CLOSEBRACKET:Rte,CLOSEPAREN:zte,COLON:A0,COMMA:hye,DOLLAR:rre,DOT:eg,EMOJI:oze,EQUALS:nre,EXCLAMATION:fye,FULLWIDTHGREATERTHAN:Zte,FULLWIDTHLEFTPAREN:Ute,FULLWIDTHLESSTHAN:Kte,FULLWIDTHMIDDLEDOT:ize,FULLWIDTHRIGHTPAREN:qte,HYPHEN:Pf,LEFTCORNERBRACKET:Vte,LEFTWHITECORNERBRACKET:Wte,LOCALHOST:gE,NL:uye,NUM:dye,OPENANGLEBRACKET:Bte,OPENBRACE:mA,OPENBRACKET:Dte,OPENPAREN:Fte,PERCENT:xA,PIPE:sre,PLUS:are,POUND:ire,QUERY:yA,QUOTE:pye,RIGHTCORNERBRACKET:Hte,RIGHTWHITECORNERBRACKET:Gte,SCHEME:hee,SEMI:mye,SLASH:tg,SLASH_SCHEME:j4,SYM:lre,TILDE:vA,TLD:tfe,UNDERSCORE:ore,UTLD:rfe,UWORD:efe,WORD:vx,WS:nfe});const mx=/[a-z]/,BM=new RegExp("\\p{L}","u"),Sce=new RegExp("\\p{Emoji}","u"),gx=/\d/,Cce=/\s/,HNe="\r",Mce=` `,Ebt="️",Ibt="‍",Tce="";let PL=null,LL=null;function Pbt(t=[]){const e={};uh.groups=e;const n=new uh;PL==null&&(PL=WNe(Nbt)),LL==null&&(LL=WNe(Sbt)),Nn(n,"'",Xte),Nn(n,"{",mA),Nn(n,"}",gA),Nn(n,"[",Dte),Nn(n,"]",Rte),Nn(n,"(",Fte),Nn(n,")",zte),Nn(n,"<",Bte),Nn(n,">",$te),Nn(n,"(",Ute),Nn(n,")",qte),Nn(n,"「",Vte),Nn(n,"」",Hte),Nn(n,"『",Wte),Nn(n,"』",Gte),Nn(n,"<",Kte),Nn(n,">",Zte),Nn(n,"&",Yte),Nn(n,"*",Qte),Nn(n,"@",j0),Nn(n,"`",ere),Nn(n,"^",tre),Nn(n,":",A0),Nn(n,",",hye),Nn(n,"$",rre),Nn(n,".",eg),Nn(n,"=",nre),Nn(n,"!",fye),Nn(n,"-",Pf),Nn(n,"%",xA),Nn(n,"|",sre),Nn(n,"+",are),Nn(n,"#",ire),Nn(n,"?",yA),Nn(n,'"',pye),Nn(n,"/",tg),Nn(n,";",mye),Nn(n,"~",vA),Nn(n,"_",ore),Nn(n,"\\",Jte),Nn(n,"・",ize);const s=ql(n,gx,dye,{[Yhe]:!0});ql(s,gx,s);const a=ql(s,mx,sze,{[pA]:!0}),o=ql(s,BM,aze,{[uT]:!0}),l=ql(n,mx,vx,{[Xhe]:!0});ql(l,gx,a),ql(l,mx,l),ql(a,gx,a),ql(a,mx,a);const i=ql(n,BM,efe,{[Qhe]:!0});ql(i,mx),ql(i,gx,o),ql(i,BM,i),ql(o,gx,o),ql(o,mx),ql(o,BM,o);const h=Nn(n,Mce,uye,{[Nce]:!0}),p=Nn(n,HNe,nfe,{[Nce]:!0}),x=ql(n,Cce,nfe,{[Nce]:!0});Nn(n,Tce,x),Nn(p,Mce,h),Nn(p,Tce,x),ql(p,Cce,x),Nn(x,HNe),Nn(x,Mce),ql(x,Cce,x),Nn(x,Tce,x);const y=ql(n,Sce,oze,{[nze]:!0});Nn(y,"#"),ql(y,Sce,y),Nn(y,Ebt,y);const b=Nn(y,Ibt);Nn(b,"#"),ql(b,Sce,y);const j=[[mx,l],[gx,a]],C=[[mx,null],[BM,i],[gx,o]];for(let N=0;NN[0]>A[0]?1:-1);for(let N=0;N=0?T[Jhe]=!0:mx.test(A)?gx.test(A)?T[pA]=!0:T[Xhe]=!0:T[Yhe]=!0,VNe(n,A,A,T)}return VNe(n,"localhost",gE,{ascii:!0}),n.jd=new uh(lre),{start:n,tokens:Object.assign({groups:e},lze)}}function cze(t,e){const n=Lbt(e.replace(/[A-Z]/g,i=>i.toLowerCase())),s=n.length,a=[];let o=0,l=0;for(;l=0&&(y+=n[l].length,b++),p+=n[l].length,o+=n[l].length,l++;o-=y,l-=b,p-=y,a.push({t:x.t,v:e.slice(o-p,o),s:o-p,e:o})}return a}function Lbt(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 l0(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 xE={defaultProtocol:"http",events:null,format:GNe,formatHref:GNe,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function gye(t,e=null){let n=Object.assign({},xE);t&&(n=Object.assign(n,t instanceof gye?t.o:t));const s=n.ignoreTags,a=[];for(let o=0;on?s.substring(0,n)+"…":s},toFormattedHref(t){return t.get("formatHref",this.toHref(t.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(t=xE.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(t),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(t){return{type:this.t,value:this.toFormattedString(t),isLink:this.isLink,href:this.toFormattedHref(t),start:this.startIndex(),end:this.endIndex()}},validate(t){return t.get("validate",this.toString(),this)},render(t){const e=this,n=this.toHref(t.get("defaultProtocol")),s=t.get("formatHref",n,this),a=t.get("tagName",n,e),o=this.toFormattedString(t),l={},i=t.get("className",n,e),h=t.get("target",n,e),p=t.get("rel",n,e),x=t.getObj("attributes",n,e),y=t.getObj("events",n,e);return l.href=s,i&&(l.class=i),h&&(l.target=h),p&&(l.rel=p),x&&Object.assign(l,x),{tagName:a,attributes:l,content:o,eventListeners:y}}};function Use(t,e){class n extends dze{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 KNe=Use("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),ZNe=Use("text"),Obt=Use("nl"),OL=Use("url",{isLink:!0,toHref(t=xE.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==gE&&t[1].t===A0}}),Tf=t=>new uh(t);function Dbt({groups:t}){const e=t.domain.concat([Yte,Qte,j0,Jte,ere,tre,rre,nre,Pf,dye,xA,sre,are,ire,tg,lre,vA,ore]),n=[Xte,A0,hye,eg,fye,xA,yA,pye,mye,Bte,$te,mA,gA,Rte,Dte,Fte,zte,Ute,qte,Vte,Hte,Wte,Gte,Kte,Zte],s=[Yte,Xte,Qte,Jte,ere,tre,rre,nre,Pf,mA,gA,xA,sre,are,ire,yA,tg,lre,vA,ore],a=Tf(),o=Nn(a,vA);li(o,s,o),li(o,t.domain,o);const l=Tf(),i=Tf(),h=Tf();li(a,t.domain,l),li(a,t.scheme,i),li(a,t.slashscheme,h),li(l,s,o),li(l,t.domain,l);const p=Nn(l,j0);Nn(o,j0,p),Nn(i,j0,p),Nn(h,j0,p);const x=Nn(o,eg);li(x,s,o),li(x,t.domain,o);const y=Tf();li(p,t.domain,y),li(y,t.domain,y);const b=Nn(y,eg);li(b,t.domain,y);const j=Tf(KNe);li(b,t.tld,j),li(b,t.utld,j),Nn(p,gE,j);const C=Nn(y,Pf);Nn(C,Pf,C),li(C,t.domain,y),li(j,t.domain,y),Nn(j,eg,b),Nn(j,Pf,C);const N=Nn(j,A0);li(N,t.numeric,KNe);const A=Nn(l,Pf),E=Nn(l,eg);Nn(A,Pf,A),li(A,t.domain,l),li(E,s,o),li(E,t.domain,l);const T=Tf(OL);li(E,t.tld,T),li(E,t.utld,T),li(T,t.domain,l),li(T,s,o),Nn(T,eg,E),Nn(T,Pf,A),Nn(T,j0,p);const L=Nn(T,A0),z=Tf(OL);li(L,t.numeric,z);const F=Tf(OL),q=Tf();li(F,e,F),li(F,n,q),li(q,e,F),li(q,n,q),Nn(T,tg,F),Nn(z,tg,F);const H=Nn(i,A0),Z=Nn(h,A0),G=Nn(Z,tg),te=Nn(G,tg);li(i,t.domain,l),Nn(i,eg,E),Nn(i,Pf,A),li(h,t.domain,l),Nn(h,eg,E),Nn(h,Pf,A),li(H,t.domain,F),Nn(H,tg,F),Nn(H,yA,F),li(te,t.domain,F),li(te,e,F),Nn(te,tg,F);const ie=[[mA,gA],[Dte,Rte],[Fte,zte],[Bte,$te],[Ute,qte],[Vte,Hte],[Wte,Gte],[Kte,Zte]];for(let le=0;le=0&&b++,a++,x++;if(b<0)a-=x,a0&&(o.push(Ace(ZNe,e,l)),l=[]),a-=b,x-=b;const j=y.t,C=n.slice(a-x,a);o.push(Ace(j,e,C))}}return l.length>0&&o.push(Ace(ZNe,e,l)),o}function Ace(t,e,n){const s=n[0].s,a=n[n.length-1].e,o=e.slice(s,a);return new t(o,n)}const Fbt=typeof console<"u"&&console&&console.warn||(()=>{}),zbt="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",ll={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function Bbt(){return uh.groups={},ll.scanner=null,ll.parser=null,ll.tokenQueue=[],ll.pluginQueue=[],ll.customSchemes=[],ll.initialized=!1,ll}function YNe(t,e=!1){if(ll.initialized&&Fbt(`linkifyjs: already initialized - will not register custom scheme "${t}" ${zbt}`),!/^[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`);ll.customSchemes.push([t,e])}function $bt(){ll.scanner=Pbt(ll.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=x_t(n.doc,[...e]);if(N_t(i).forEach(({newRange:p})=>{const x=v_t(s.doc,p,j=>j.isTextblock);let y,b;if(x.length>1)y=x[0],b=s.doc.textBetween(y.pos,y.pos+y.node.nodeSize,void 0," ");else if(x.length){const j=s.doc.textBetween(p.from,p.to," "," ");if(!qbt.test(j))return;y=x[0],b=s.doc.textBetween(y.pos,p.to,void 0," ")}if(y&&b){const j=b.split(Ubt).filter(Boolean);if(j.length<=0)return!1;const C=j[j.length-1],N=y.pos+b.lastIndexOf(C);if(!C)return!1;const A=xye(C).map(E=>E.toObject(t.defaultProtocol));if(!Hbt(A))return!1;A.filter(E=>E.isLink).map(E=>({...E,from:N+E.start+1,to:N+E.end+1})).filter(E=>s.schema.marks.code?!s.doc.rangeHasMark(E.from,E.to,s.schema.marks.code):!0).filter(E=>t.validate(E.value)).filter(E=>t.shouldAutoLink(E.value)).forEach(E=>{aye(E.from,E.to,s.doc).some(T=>T.mark.type===t.type)||l.addMark(E.from,E.to,t.type.create({href:E.href}))})}}),!!l.steps.length)return l}})}function Gbt(t){return new Ud({key:new pf("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(b=>b.nodeName==="A"))return!1;const h=WFe(e.state,t.type.name),p=s.target,x=(a=p==null?void 0:p.href)!==null&&a!==void 0?a:h.href,y=(o=p==null?void 0:p.target)!==null&&o!==void 0?o:h.target;return p&&x?(window.open(x,y),!0):!1}}})}function Kbt(t){return new Ud({key:new pf("handlePasteLink"),props:{handlePaste:(e,n,s)=>{const{state:a}=e,{selection:o}=a,{empty:l}=o;if(l)return!1;let i="";s.content.forEach(p=>{i+=p.textContent});const h=uze(i,{defaultProtocol:t.defaultProtocol}).find(p=>p.isLink&&p.value===i);return!i||!h?!1:t.editor.commands.setMark(t.type,{href:h.href})}}})}function i_(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(Vbt,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}const hze=Og.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"){YNe(t);return}YNe(t.scheme,t.optionalSlashes)})},onDestroy(){Bbt()},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)=>!!i_(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=>!!i_(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=>!!i_(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",yd(this.options.HTMLAttributes,t),0]:["a",yd(this.options.HTMLAttributes,{...t,href:""}),0]},addCommands(){return{setLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:s=>!!i_(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=>!!i_(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[Zj({find:t=>{const e=[];if(t){const{protocols:n,defaultProtocol:s}=this.options,a=uze(t).filter(o=>o.isLink&&this.options.isAllowedUri(o.value,{defaultValidate:l=>!!i_(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(Wbt({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:s=>this.options.isAllowedUri(s,{defaultValidate:a=>!!i_(a,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),this.options.openOnClick===!0&&t.push(Gbt({type:this.type})),this.options.linkOnPaste&&t.push(Kbt({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),t}}),fze=Bd.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")}}}),Zbt=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}`)})},pze=Og.create({name:"textStyle",priority:101,addOptions(){return{HTMLAttributes:{},mergeNestedSpanStyles:!1}},parseHTML(){return[{tag:"span",getAttrs:t=>t.hasAttribute("style")?(this.options.mergeNestedSpanStyles&&Zbt(t),{}):!1}]},renderHTML({HTMLAttributes:t}){return["span",yd(this.options.HTMLAttributes,t),0]},addCommands(){return{removeEmptyTextStyle:()=>({tr:t})=>{const{selection:e}=t;return t.doc.nodesBetween(e.from,e.to,(n,s)=>{if(n.isTextblock)return!0;n.marks.filter(a=>a.type===this.type).some(a=>Object.values(a.attrs).some(o=>!!o))||t.removeMark(s,s+n.nodeSize,this.type)}),!0}}}});function fy({content:t,onChange:e,placeholder:n="Enter content...",minHeight:s="150px"}){const[a,o]=I.useState(!1),[l,i]=I.useState(""),[h,p]=I.useState(!0),x=YFe({extensions:[rze,hze.configure({openOnClick:!1,HTMLAttributes:{class:"text-primary underline"}}),fze.configure({types:["heading","paragraph"]}),pze],content:t,onUpdate:({editor:C})=>{e(C.getHTML())},editorProps:{attributes:{class:"outline-none","data-placeholder":n}}});I.useEffect(()=>{x&&t!==x.getHTML()&&x.commands.setContent(t)},[t,x]);const y=()=>{if(!x)return;const C=x.getAttributes("link").href||"",N=x.getAttributes("link").target;i(C),p(N==="_blank"),o(!0)},b=()=>{x&&(l===""?x.chain().focus().extendMarkRange("link").unsetLink().run():x.chain().focus().extendMarkRange("link").setLink({href:l,target:h?"_blank":null,rel:h?"noopener noreferrer nofollow":null}).run(),o(!1),i(""))},j=()=>{x&&x.chain().focus().extendMarkRange("link").unsetLink().run()};return x?r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"border rounded-lg overflow-hidden",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-0.5 p-2 border-b bg-muted/30",children:[r.jsx(ee,{type:"button",variant:"ghost",size:"sm",onClick:()=>x.chain().focus().toggleHeading({level:1}).run(),className:x.isActive("heading",{level:1})?"bg-muted":"",title:"Heading 1",children:r.jsx(ET,{className:"h-4 w-4"})}),r.jsx(ee,{type:"button",variant:"ghost",size:"sm",onClick:()=>x.chain().focus().toggleHeading({level:2}).run(),className:x.isActive("heading",{level:2})?"bg-muted":"",title:"Heading 2",children:r.jsx(IT,{className:"h-4 w-4"})}),r.jsx("div",{className:"w-px h-6 bg-border mx-1"}),r.jsx(ee,{type:"button",variant:"ghost",size:"sm",onClick:()=>x.chain().focus().toggleBold().run(),className:x.isActive("bold")?"bg-muted":"",title:"Bold",children:r.jsx(J4,{className:"h-4 w-4"})}),r.jsx(ee,{type:"button",variant:"ghost",size:"sm",onClick:()=>x.chain().focus().toggleItalic().run(),className:x.isActive("italic")?"bg-muted":"",title:"Italic",children:r.jsx(aS,{className:"h-4 w-4"})}),r.jsx("div",{className:"w-px h-6 bg-border mx-1"}),r.jsx(ee,{type:"button",variant:"ghost",size:"sm",onClick:()=>x.chain().focus().toggleBulletList().run(),className:x.isActive("bulletList")?"bg-muted":"",title:"Bullet List",children:r.jsx(Kf,{className:"h-4 w-4"})}),r.jsx(ee,{type:"button",variant:"ghost",size:"sm",onClick:()=>x.chain().focus().toggleOrderedList().run(),className:x.isActive("orderedList")?"bg-muted":"",title:"Numbered List",children:r.jsx(lS,{className:"h-4 w-4"})}),r.jsx("div",{className:"w-px h-6 bg-border mx-1"}),r.jsx(ee,{type:"button",variant:"ghost",size:"sm",onClick:()=>x.chain().focus().setTextAlign("left").run(),className:x.isActive({textAlign:"left"})?"bg-muted":"",title:"Align Left",children:r.jsx(X4,{className:"h-4 w-4"})}),r.jsx(ee,{type:"button",variant:"ghost",size:"sm",onClick:()=>x.chain().focus().setTextAlign("center").run(),className:x.isActive({textAlign:"center"})?"bg-muted":"",title:"Align Center",children:r.jsx(Y4,{className:"h-4 w-4"})}),r.jsx(ee,{type:"button",variant:"ghost",size:"sm",onClick:()=>x.chain().focus().setTextAlign("right").run(),className:x.isActive({textAlign:"right"})?"bg-muted":"",title:"Align Right",children:r.jsx(Q4,{className:"h-4 w-4"})}),r.jsx("div",{className:"w-px h-6 bg-border mx-1"}),r.jsx(ee,{type:"button",variant:"ghost",size:"sm",onClick:y,className:x.isActive("link")?"bg-muted":"",title:"Add Link",children:r.jsx(Co,{className:"h-4 w-4"})}),x.isActive("link")&&r.jsx(ee,{type:"button",variant:"ghost",size:"sm",onClick:j,title:"Remove Link",children:r.jsx(Co,{className:"h-4 w-4"})}),r.jsx("div",{className:"w-px h-6 bg-border mx-1"}),r.jsx(ee,{type:"button",variant:"ghost",size:"sm",onClick:()=>x.chain().focus().undo().run(),disabled:!x.can().undo(),title:"Undo",children:r.jsx(mS,{className:"h-4 w-4"})}),r.jsx(ee,{type:"button",variant:"ghost",size:"sm",onClick:()=>x.chain().focus().redo().run(),disabled:!x.can().redo(),title:"Redo",children:r.jsx(fS,{className:"h-4 w-4"})})]}),r.jsx(KFe,{editor:x,className:"prose prose-sm max-w-none p-3 focus:outline-none [&_.ProseMirror]:outline-none",style:{minHeight:s}})]}),r.jsx(Fr,{open:a,onOpenChange:o,children:r.jsxs(Rr,{className:"sm:max-w-md",children:[r.jsx(qr,{children:r.jsx($r,{children:"Insert Link"})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"link-url",children:"URL"}),r.jsx(dt,{id:"link-url",value:l,onChange:C=>i(C.target.value),placeholder:"https://example.com"})]}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(Ps,{id:"link-new-tab",checked:h,onCheckedChange:p}),r.jsx(He,{htmlFor:"link-new-tab",children:"Open in new tab"})]})]}),r.jsxs(ea,{children:[r.jsx(ee,{type:"button",variant:"outline",onClick:()=>o(!1),children:"Cancel"}),r.jsx(ee,{type:"button",onClick:b,children:l?"Apply Link":"Remove Link"})]})]})})]}):null}const qse=async t=>{try{const{data:e,error:n}=await J.from("push_notification_settings").select("is_enabled").eq("setting_key",t).maybeSingle();return n?(console.error("Error checking notification setting:",n),!0):(e==null?void 0:e.is_enabled)??!0}catch(e){return console.error("Error checking notification setting:",e),!0}},DI=async t=>{try{const{data:e,error:n}=await J.functions.invoke("send-push-notification",{body:t});return n?(console.error("Error sending notification:",n),{success:!1,error:n}):(console.log("Notification sent:",e),{success:!0,data:e})}catch(e){return console.error("Error sending notification:",e),{success:!1,error:e}}},Ybt=async(t,e)=>await qse("new_templates")?DI({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}),Xbt=async(t,e)=>DI({title:"New Academy Video",body:`New video added: ${t}`,url:`/academy/${e}`}),Qbt=async(t,e)=>await qse("new_events")?DI({title:"New Event",body:`New event: ${t}`,url:`/events/${e}`}):(console.log("New event notifications are disabled"),{success:!1,skipped:!0}),Jbt=async(t,e)=>await qse("new_toolbox")?DI({title:"New Resource Kit",body:`New resource kit available: ${t}`,url:`/toolbox/${e}`}):(console.log("New toolbox notifications are disabled"),{success:!1,skipped:!0}),sfe=async(t,e)=>await qse("new_social_swag")?DI({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}),DL={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 ewt(){const t=rs(),e=Vr(),[n,s]=I.useState(!1),[a,o]=I.useState(null),[l,i]=I.useState(DL),[h,p]=I.useState(null),[x,y]=I.useState(null),[b,j]=I.useState(!1),C=I.useRef(null),[N,A]=I.useState(!1),[E,T]=I.useState(null),[L,z]=I.useState(!1),[F,q]=I.useState(null),[H,Z]=I.useState(null),[G,te]=I.useState(!0),[ie,le]=I.useState(""),{data:ye,isLoading:ne}=Yt({queryKey:["admin-events"],queryFn:async()=>{const{data:Me,error:ft}=await J.from("events").select("*").order("event_date",{ascending:!0});if(ft)throw ft;return Me}}),{data:ge}=Yt({queryKey:["event-registrations-count"],queryFn:async()=>{const{data:Me,error:ft}=await J.from("event_registrations").select("event_id");if(ft)throw ft;const qe={};return Me.forEach(Oe=>{qe[Oe.event_id]=(qe[Oe.event_id]||0)+1}),qe}}),{data:ae,isLoading:he}=Yt({queryKey:["event-registrations-details",E==null?void 0:E.id],queryFn:async()=>{if(!E)return[];const{data:Me,error:ft}=await J.from("event_registrations").select("id, user_id, registered_at, zoom_join_url, zoom_name, zoom_email").eq("event_id",E.id).order("registered_at",{ascending:!1});if(ft)throw ft;if(!Me||Me.length===0)return[];const qe=Me.map(nt=>nt.user_id).filter(Boolean);let Oe=[];if(qe.length>0){const{data:nt,error:gt}=await J.from("profiles").select("id, name, email").in("id",qe);if(gt)throw gt;Oe=nt||[]}const Qe=new Map((Oe==null?void 0:Oe.map(nt=>[nt.id,nt]))||[]);return Me.map(nt=>({...nt,profiles:nt.user_id&&Qe.get(nt.user_id)||null}))},enabled:!!E}),{data:ue,isLoading:_e}=Yt({queryKey:["event-attendees-details",E==null?void 0:E.id],queryFn:async()=>{if(!E)return[];const{data:Me,error:ft}=await J.from("event_attendees").select("id, user_id, zoom_email, zoom_name, join_time, leave_time, duration_minutes, manually_added, created_at").eq("event_id",E.id).order("created_at",{ascending:!1});if(ft)throw ft;if(!Me||Me.length===0)return[];const qe=Me.map(mt=>mt.user_id).filter(Boolean);let Oe=[];if(qe.length>0){const{data:mt,error:Mt}=await J.from("profiles").select("id, name, email").in("id",qe);if(Mt)throw Mt;Oe=mt||[]}const{data:Qe}=await J.from("agent_points").select("user_id").eq("event_id",E.id),nt=new Set((Qe==null?void 0:Qe.map(mt=>mt.user_id))||[]),gt=new Map((Oe==null?void 0:Oe.map(mt=>[mt.id,mt]))||[]);return Me.map(mt=>({...mt,profiles:mt.user_id&>.get(mt.user_id)||null,points_awarded:mt.user_id?nt.has(mt.user_id):!1}))},enabled:!!E}),Ae=Me=>{T(Me),A(!0)},Ce=cr({mutationFn:async Me=>{const{data:{session:ft}}=await J.auth.getSession();if(!ft)throw new Error("Not authenticated");const qe=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/zoom-sync-registrations",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${ft.access_token}`},body:JSON.stringify({event_id:Me})}),Oe=await qe.json();if(!qe.ok)throw new Error(Oe.error||"Failed to sync");return Oe},onSuccess:Me=>{e.invalidateQueries({queryKey:["event-registrations-details",E==null?void 0:E.id]}),e.invalidateQueries({queryKey:["event-registrations-count"]}),ze.success(Me.message)},onError:Me=>{ze.error("Failed to sync: "+Me.message)}}),be=cr({mutationFn:async Me=>{const{data:{session:ft}}=await J.auth.getSession();if(!ft)throw new Error("Not authenticated");const qe=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/zoom-sync-attendees",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${ft.access_token}`},body:JSON.stringify({event_id:Me})}),Oe=await qe.json();if(!qe.ok)throw new Error(Oe.error||"Failed to sync attendees");return Oe},onSuccess:Me=>{e.invalidateQueries({queryKey:["event-attendees-details",E==null?void 0:E.id]}),e.invalidateQueries({queryKey:["event-leaderboard"]}),e.invalidateQueries({queryKey:["admin-agent-points"]}),Me!=null&&Me.message?ze.success(Me.message):ze.success(`Synced ${Me.synced||0} attendees. ${Me.points_awarded||0} points awarded!`)},onError:Me=>{ze.error("Failed to sync attendees: "+Me.message)}}),me=cr({mutationFn:async({eventId:Me,testMode:ft})=>{const{data:{session:qe}}=await J.auth.getSession();if(!qe)throw new Error("Not authenticated");const Oe=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/send-event-reminder",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${qe.access_token}`},body:JSON.stringify({event_id:Me,test_mode:ft})}),Qe=await Oe.json();if(!Oe.ok)throw new Error(Qe.error||"Failed to send reminders");return Qe},onSuccess:Me=>{Me.test?ze.success(Me.message||"Test email sent!"):ze.success(Me.message||`Reminder emails sent to ${Me.sent} registrants!`)},onError:Me=>{ze.error("Failed to send reminders: "+Me.message)}}),{data:Le}=Yt({queryKey:["all-profiles-for-linking"],queryFn:async()=>{let Me=[],ft=0;const qe=1e3;for(;;){const{data:Oe,error:Qe}=await J.from("profiles").select("id, name, email").order("name",{ascending:!0}).range(ft,ft+qe-1);if(Qe)throw Qe;if(!Oe||Oe.length===0||(Me=[...Me,...Oe],Oe.length{const{error:Qe}=await J.from("event_attendees").update({user_id:ft}).eq("id",Me);if(Qe)throw Qe;if(Oe&&qe){const{error:gt}=await J.from("zoom_email_aliases").upsert({user_id:ft,zoom_email:qe.toLowerCase()},{onConflict:"zoom_email"});gt&&console.error("Failed to save alias:",gt)}const nt=E==null?void 0:E.id;if(nt){const{data:gt}=await J.from("user_roles").select("id").eq("user_id",ft).eq("role","admin").single();if(!gt){const{data:mt}=await J.from("agent_points").select("id").eq("user_id",ft).eq("event_id",nt).single();mt||(await J.rpc("award_attendance_points",{p_user_id:ft,p_event_id:nt,p_points:10,p_reason:"Event Attendance (Manual Link)"}),await J.rpc("check_and_award_badges",{p_user_id:ft}))}}return{userId:ft,zoomEmail:qe,shouldSaveAlias:Oe}},onSuccess:Me=>{e.invalidateQueries({queryKey:["event-attendees-details",E==null?void 0:E.id]}),e.invalidateQueries({queryKey:["event-leaderboard"]}),e.invalidateQueries({queryKey:["admin-agent-points"]});let ft="Attendee linked and points awarded!";Me.shouldSaveAlias&&Me.zoomEmail&&(ft+=` Email "${Me.zoomEmail}" will be auto-matched in the future.`),ze.success(ft),z(!1),q(null),Z(null),le("")},onError:Me=>{ze.error("Failed to link attendee: "+Me.message)}}),Be=Me=>{q(Me),Z(null),te(!0),le(""),z(!0)},Ee=()=>{!F||!H||Ne.mutate({attendeeId:F.id,userId:H,zoomEmail:F.zoom_email,shouldSaveAlias:G})},Ue=(Le==null?void 0:Le.filter(Me=>{var qe,Oe;if(!ie)return!0;const ft=ie.toLowerCase();return((qe=Me.name)==null?void 0:qe.toLowerCase().includes(ft))||((Oe=Me.email)==null?void 0:Oe.toLowerCase().includes(ft))}))||[],Re=async Me=>{const ft=Me.name.split(".").pop(),Oe=`${`${crypto.randomUUID()}.${ft}`}`,{error:Qe}=await J.storage.from("event-images").upload(Oe,Me);if(Qe)throw Qe;const{data:{publicUrl:nt}}=J.storage.from("event-images").getPublicUrl(Oe);return nt},je=Me=>{var qe;const ft=(qe=Me.target.files)==null?void 0:qe[0];if(ft){if(ft.size>5*1024*1024){ze.error("Image must be less than 5MB");return}p(ft),y(URL.createObjectURL(ft))}},et=()=>{p(null),y(null),i({...l,image_url:""}),C.current&&(C.current.value="")},Te=cr({mutationFn:async Me=>{j(!0);let ft=Me.image_url;h&&(ft=await Re(h)||"");const qe=new Date(Me.event_date),[Oe,Qe]=Me.event_time.split(":");qe.setHours(parseInt(Oe),parseInt(Qe));const nt=[new Date(qe)];if(Me.is_recurring&&Me.recurrence_end_date){let wt=new Date(qe);for(;Me.recurrence_pattern==="weekly"?wt=Bw(wt,1):Me.recurrence_pattern==="biweekly"?wt=Bw(wt,2):wt=bh(wt,1),!(wt>Me.recurrence_end_date);)nt.push(new Date(wt))}const gt=nt.map(wt=>({title:Me.title,description:Me.description||null,image_url:ft||null,video_url:Me.video_url||null,event_date:wt.toISOString(),zoom_link:Me.zoom_link,zoom_meeting_id:Me.zoom_meeting_id||null,capacity:Me.capacity?parseInt(Me.capacity):null,is_published:Me.is_published})),{data:mt,error:Mt}=await J.from("events").insert(gt).select();if(Mt)throw Mt;return mt&&mt.length>0&&Qbt(Me.title,mt[0].id),nt.length},onSuccess:Me=>{e.invalidateQueries({queryKey:["admin-events"]}),ze.success(Me>1?`${Me} recurring events created successfully`:"Event created successfully"),s(!1),i(DL),p(null),y(null),j(!1)},onError:Me=>{ze.error("Failed to create event: "+Me.message),j(!1)}}),Ze=cr({mutationFn:async({id:Me,data:ft})=>{j(!0);let qe=ft.image_url;h&&(qe=await Re(h)||"");const Oe=new Date(ft.event_date),[Qe,nt]=ft.event_time.split(":");Oe.setHours(parseInt(Qe),parseInt(nt));const{error:gt}=await J.from("events").update({title:ft.title,description:ft.description||null,image_url:qe||null,video_url:ft.video_url||null,event_date:Oe.toISOString(),zoom_link:ft.zoom_link,zoom_meeting_id:ft.zoom_meeting_id||null,capacity:ft.capacity?parseInt(ft.capacity):null,is_published:ft.is_published}).eq("id",Me);if(gt)throw gt},onSuccess:()=>{e.invalidateQueries({queryKey:["admin-events"]}),ze.success("Event updated successfully"),s(!1),o(null),i(DL),p(null),y(null),j(!1)},onError:Me=>{ze.error("Failed to update event: "+Me.message),j(!1)}}),pe=cr({mutationFn:async Me=>{const{error:ft}=await J.from("events").delete().eq("id",Me);if(ft)throw ft},onSuccess:()=>{e.invalidateQueries({queryKey:["admin-events"]}),ze.success("Event deleted successfully")},onError:Me=>{ze.error("Failed to delete event: "+Me.message)}}),yt=Me=>{var qe;const ft=new Date(Me.event_date);o(Me),i({title:Me.title,description:Me.description||"",image_url:Me.image_url||"",video_url:Me.video_url||"",event_date:ft,event_time:yn(ft,"HH:mm"),zoom_link:Me.zoom_link,zoom_meeting_id:Me.zoom_meeting_id||"",capacity:((qe=Me.capacity)==null?void 0:qe.toString())||"",is_published:Me.is_published,is_recurring:!1,recurrence_pattern:"weekly",recurrence_end_date:void 0}),y(Me.image_url||null),p(null),s(!0)},rt=Me=>{if(Me.preventDefault(),!l.event_date){ze.error("Please select a date");return}if(l.is_recurring&&!l.recurrence_end_date){ze.error("Please select an end date for recurring events");return}a?Ze.mutate({id:a.id,data:l}):Te.mutate(l)},at=()=>{s(!1),o(null),i(DL),p(null),y(null)};return r.jsx("div",{className:"min-h-screen bg-background p-6",children:r.jsxs("div",{className:"max-w-6xl mx-auto",children:[r.jsxs("div",{className:"flex items-center gap-4 mb-6",children:[r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>t("/dashboard"),children:r.jsx(so,{className:"h-5 w-5"})}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold",children:"Event Management"}),r.jsx("p",{className:"text-muted-foreground",children:"Create and manage upcoming events"})]})]}),r.jsxs(Ye,{className:"mb-6",children:[r.jsxs(Gt,{className:"flex flex-row items-center justify-between",children:[r.jsx(Zt,{children:"All Events"}),r.jsxs(Fr,{open:n,onOpenChange:Me=>!Me&&at(),children:[r.jsx(zo,{asChild:!0,children:r.jsxs(ee,{onClick:()=>s(!0),children:[r.jsx(bn,{className:"h-4 w-4 mr-2"}),"Add Event"]})}),r.jsxs(Rr,{className:"max-w-lg max-h-[90vh] overflow-y-auto",children:[r.jsx(qr,{children:r.jsx($r,{children:a?"Edit Event":"Create New Event"})}),r.jsxs("form",{onSubmit:rt,className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"title",children:"Title *"}),r.jsx(dt,{id:"title",value:l.title,onChange:Me=>i({...l,title:Me.target.value}),placeholder:"Event title",required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Description"}),r.jsx(fy,{content:l.description,onChange:Me=>i({...l,description:Me}),placeholder:"Event description",minHeight:"120px"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Event Image"}),r.jsx("input",{type:"file",ref:C,accept:"image/*",onChange:je,className:"hidden"}),x?r.jsxs("div",{className:"relative",children:[r.jsx("img",{src:x,alt:"Event preview",className:"w-full h-32 object-cover rounded-lg border"}),r.jsx(ee,{type:"button",variant:"destructive",size:"icon",className:"absolute top-2 right-2 h-6 w-6",onClick:et,children:r.jsx(_s,{className:"h-4 w-4"})})]}):r.jsxs(ee,{type:"button",variant:"outline",className:"w-full h-32 border-dashed flex flex-col gap-2",onClick:()=>{var Me;return(Me=C.current)==null?void 0:Me.click()},children:[r.jsx(uo,{className:"h-6 w-6"}),r.jsx("span",{className:"text-sm",children:"Click to upload image"})]})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Date *"}),r.jsxs(zu,{children:[r.jsx(Bu,{asChild:!0,children:r.jsxs(ee,{variant:"outline",className:$t("w-full justify-start text-left font-normal",!l.event_date&&"text-muted-foreground"),children:[r.jsx(zs,{className:"mr-2 h-4 w-4"}),l.event_date?yn(l.event_date,"PPP"):"Pick a date"]})}),r.jsx(uu,{className:"w-auto p-0",align:"start",children:r.jsx(Z1,{mode:"single",selected:l.event_date,onSelect:Me=>i({...l,event_date:Me}),initialFocus:!0,className:"p-3 pointer-events-auto"})})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"time",children:"Time *"}),r.jsx(dt,{id:"time",type:"time",value:l.event_time,onChange:Me=>i({...l,event_time:Me.target.value}),required:!0})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"zoom_link",children:"Zoom Link *"}),r.jsx(dt,{id:"zoom_link",value:l.zoom_link,onChange:Me=>i({...l,zoom_link:Me.target.value}),placeholder:"https://zoom.us/j/...",required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"zoom_meeting_id",children:"Zoom Meeting ID (for API registration)"}),r.jsx(dt,{id:"zoom_meeting_id",value:l.zoom_meeting_id,onChange:Me=>i({...l,zoom_meeting_id:Me.target.value}),placeholder:"e.g., 1234567890 (find in Zoom dashboard)"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Optional: Enter the numeric meeting ID for automatic Zoom registration"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"video_url",children:"Promo Video URL (optional)"}),r.jsx(dt,{id:"video_url",value:l.video_url,onChange:Me=>i({...l,video_url:Me.target.value}),placeholder:"YouTube, Vimeo, or Bunny.net embed URL"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Add a preview/promo video for this event"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"capacity",children:"Capacity (optional)"}),r.jsx(dt,{id:"capacity",type:"number",value:l.capacity,onChange:Me=>i({...l,capacity:Me.target.value}),placeholder:"Leave empty for unlimited",min:"1"})]}),!a&&r.jsxs("div",{className:"space-y-3 rounded-lg border p-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(qT,{className:"h-4 w-4 text-muted-foreground"}),r.jsx(He,{htmlFor:"is_recurring",children:"Recurring Event"})]}),r.jsx(Ps,{id:"is_recurring",checked:l.is_recurring,onCheckedChange:Me=>i({...l,is_recurring:Me})})]}),l.is_recurring&&r.jsxs("div",{className:"space-y-3 pt-1",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Frequency"}),r.jsxs(gn,{value:l.recurrence_pattern,onValueChange:Me=>i({...l,recurrence_pattern:Me}),children:[r.jsx(fn,{children:r.jsx(xn,{})}),r.jsxs(pn,{children:[r.jsx(Vt,{value:"weekly",children:"Weekly"}),r.jsx(Vt,{value:"biweekly",children:"Every 2 Weeks"}),r.jsx(Vt,{value:"monthly",children:"Monthly"})]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Repeat Until"}),r.jsxs(zu,{children:[r.jsx(Bu,{asChild:!0,children:r.jsxs(ee,{variant:"outline",className:$t("w-full justify-start text-left font-normal",!l.recurrence_end_date&&"text-muted-foreground"),children:[r.jsx(zs,{className:"mr-2 h-4 w-4"}),l.recurrence_end_date?yn(l.recurrence_end_date,"PPP"):"Pick end date"]})}),r.jsx(uu,{className:"w-auto p-0",align:"start",children:r.jsx(Z1,{mode:"single",selected:l.recurrence_end_date,onSelect:Me=>i({...l,recurrence_end_date:Me}),disabled:Me=>Me<(l.event_date||new Date),initialFocus:!0,className:"p-3 pointer-events-auto"})})]})]}),l.event_date&&l.recurrence_end_date&&r.jsxs("p",{className:"text-xs text-muted-foreground",children:["This will create ",(()=>{let Me=1,ft=new Date(l.event_date);for(;ft=l.recurrence_pattern==="weekly"?Bw(ft,1):l.recurrence_pattern==="biweekly"?Bw(ft,2):bh(ft,1),!(ft>l.recurrence_end_date);)Me++;return Me})()," events with the same Zoom link"]})]})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(He,{htmlFor:"is_published",children:"Published"}),r.jsx(Ps,{id:"is_published",checked:l.is_published,onCheckedChange:Me=>i({...l,is_published:Me})})]}),r.jsxs("div",{className:"flex gap-2 pt-4",children:[r.jsx(ee,{type:"button",variant:"outline",onClick:at,className:"flex-1",children:"Cancel"}),r.jsx(ee,{type:"submit",className:"flex-1",disabled:Te.isPending||Ze.isPending||b,children:b?"Uploading...":a?"Update Event":l.is_recurring&&l.event_date&&l.recurrence_end_date?"Create Recurring Events":"Create Event"})]})]})]})]})]}),r.jsx(tt,{children:ne?r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"Loading events..."}):(ye==null?void 0:ye.length)===0?r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"No events yet. Create your first event!"}):r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Ar,{children:[r.jsx(It,{children:"Title"}),r.jsx(It,{children:"Date & Time"}),r.jsx(It,{children:"Registrations"}),r.jsx(It,{children:"Status"}),r.jsx(It,{className:"text-right",children:"Actions"})]})}),r.jsx(Vs,{children:ye==null?void 0:ye.map(Me=>r.jsxs(Ar,{children:[r.jsx(Nt,{className:"font-medium",children:Me.title}),r.jsx(Nt,{children:yn(new Date(Me.event_date),"PPP p")}),r.jsx(Nt,{children:r.jsxs(ee,{variant:"ghost",size:"sm",className:"gap-1",onClick:()=>Ae(Me),children:[r.jsx(Bn,{className:"h-4 w-4"}),(ge==null?void 0:ge[Me.id])||0,Me.capacity&&` / ${Me.capacity}`]})}),r.jsx(Nt,{children:r.jsx("span",{className:$t("px-2 py-1 rounded-full text-xs font-medium",Me.is_published?"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200":"bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-200"),children:Me.is_published?"Published":"Draft"})}),r.jsx(Nt,{className:"text-right",children:r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>window.open(Me.zoom_link,"_blank"),title:"Open Zoom Link",children:r.jsx(Fs,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>yt(Me),children:r.jsx(_i,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>{confirm("Are you sure you want to delete this event?")&&pe.mutate(Me.id)},children:r.jsx(Vn,{className:"h-4 w-4 text-destructive"})})]})})]},Me.id))})]})})]}),r.jsx(Fr,{open:N,onOpenChange:A,children:r.jsxs(Rr,{className:"max-w-3xl max-h-[80vh] overflow-y-auto",children:[r.jsxs(qr,{children:[r.jsxs($r,{className:"flex items-center gap-2",children:[r.jsx(Bn,{className:"h-5 w-5"}),E==null?void 0:E.title]}),r.jsx(Xn,{children:"View registrations and attendees for this event"})]}),r.jsxs("div",{className:"flex items-center justify-end mb-4 gap-2 flex-wrap",children:[r.jsxs(ee,{variant:"ghost",size:"sm",onClick:()=>me.mutate({eventId:E.id,testMode:!0}),disabled:me.isPending,children:[r.jsx(da,{className:$t("h-4 w-4 mr-2",me.isPending&&"animate-spin")}),"Send Test to Me"]}),r.jsxs(ee,{variant:"outline",size:"sm",onClick:()=>me.mutate({eventId:E.id}),disabled:me.isPending||!(ae!=null&&ae.length),children:[r.jsx(da,{className:$t("h-4 w-4 mr-2",me.isPending&&"animate-spin")}),me.isPending?"Sending...":"Send Reminder to All"]}),(E==null?void 0:E.zoom_meeting_id)&&r.jsxs(r.Fragment,{children:[r.jsxs(ee,{variant:"outline",size:"sm",onClick:()=>Ce.mutate(E.id),disabled:Ce.isPending,children:[r.jsx(Gl,{className:$t("h-4 w-4 mr-2",Ce.isPending&&"animate-spin")}),Ce.isPending?"Syncing...":"Sync Registrations"]}),r.jsxs(ee,{variant:"default",size:"sm",onClick:()=>be.mutate(E.id),disabled:be.isPending,children:[r.jsx(Zi,{className:$t("h-4 w-4 mr-2",be.isPending&&"animate-spin")}),be.isPending?"Syncing...":"Sync Attendees & Award Points"]})]})]}),r.jsxs(Ii,{defaultValue:"registrations",className:"w-full",children:[r.jsxs(wi,{className:"grid w-full grid-cols-2",children:[r.jsxs(ln,{value:"registrations",className:"gap-2",children:[r.jsx(Bn,{className:"h-4 w-4"}),"Registrations (",(ae==null?void 0:ae.length)||0,")"]}),r.jsxs(ln,{value:"attendees",className:"gap-2",children:[r.jsx(Xi,{className:"h-4 w-4"}),"Attendees (",(ue==null?void 0:ue.length)||0,")"]})]}),r.jsx(An,{value:"registrations",className:"mt-4",children:he?r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"Loading registrations..."}):(ae==null?void 0:ae.length)===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx("p",{children:"No registrations yet for this event."}),(E==null?void 0:E.zoom_meeting_id)&&r.jsx("p",{className:"text-xs mt-2",children:'Click "Sync Registrations" to import from Zoom.'})]}):r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Ar,{children:[r.jsx(It,{children:"Name"}),r.jsx(It,{children:"Email"}),r.jsx(It,{children:"Registered"}),r.jsx(It,{children:"Status"})]})}),r.jsx(Vs,{children:ae==null?void 0:ae.map(Me=>{var Qe,nt;const ft=((Qe=Me.profiles)==null?void 0:Qe.name)||Me.zoom_name||"Unknown",qe=((nt=Me.profiles)==null?void 0:nt.email)||Me.zoom_email||null,Oe=!Me.user_id;return r.jsxs(Ar,{children:[r.jsx(Nt,{className:"font-medium",children:r.jsxs("div",{className:"flex items-center gap-2",children:[ft,Oe&&r.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-muted text-muted-foreground",children:"External"})]})}),r.jsx(Nt,{children:qe?r.jsxs("a",{href:`mailto:${qe}`,className:"flex items-center gap-1 text-primary hover:underline",children:[r.jsx(da,{className:"h-3 w-3"}),qe]}):r.jsx("span",{className:"text-muted-foreground",children:"No email"})}),r.jsx(Nt,{className:"text-muted-foreground text-sm",children:yn(new Date(Me.registered_at),"MMM d, yyyy h:mm a")}),r.jsx(Nt,{children:Me.zoom_join_url?r.jsx("span",{className:"inline-flex items-center gap-1 text-xs px-2 py-1 rounded-full bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200",children:"Registered"}):r.jsx("span",{className:"inline-flex items-center gap-1 text-xs px-2 py-1 rounded-full bg-muted text-muted-foreground",children:"Pending"})})]},Me.id)})})]})}),r.jsx(An,{value:"attendees",className:"mt-4",children:_e?r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"Loading attendees..."}):(ue==null?void 0:ue.length)===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx("p",{children:"No attendees recorded yet."}),(E==null?void 0:E.zoom_meeting_id)&&r.jsx("p",{className:"text-xs mt-2",children:'Click "Sync Attendees & Award Points" after the event ends to import actual participants from Zoom.'})]}):r.jsxs(r.Fragment,{children:[(ue==null?void 0:ue.filter(Me=>!Me.user_id).length)>0&&r.jsxs("div",{className:"mb-6 p-4 border border-amber-200 bg-amber-50 dark:border-amber-800 dark:bg-amber-950 rounded-lg",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[r.jsx(Il,{className:"h-4 w-4 text-amber-600 dark:text-amber-400"}),r.jsxs("h4",{className:"font-medium text-amber-800 dark:text-amber-200",children:["Unmatched Attendees (",ue==null?void 0:ue.filter(Me=>!Me.user_id).length,")"]})]}),r.jsx("p",{className:"text-xs text-amber-700 dark:text-amber-300 mb-3",children:"These attendees couldn't be matched to a profile. Link them to award points."}),r.jsx("div",{className:"space-y-2",children:ue==null?void 0:ue.filter(Me=>!Me.user_id).map(Me=>r.jsxs("div",{className:"flex items-center justify-between p-2 bg-background rounded border",children:[r.jsxs("div",{className:"flex flex-col",children:[r.jsx("span",{className:"font-medium text-sm",children:Me.zoom_name||"Unknown"}),r.jsx("span",{className:"text-xs text-muted-foreground",children:Me.zoom_email||"No email"})]}),r.jsxs(ee,{variant:"outline",size:"sm",onClick:()=>Be(Me),className:"gap-1",children:[r.jsx(tf,{className:"h-3 w-3"}),"Link to Profile"]})]},Me.id))})]}),r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Ar,{children:[r.jsx(It,{children:"Name"}),r.jsx(It,{children:"Email"}),r.jsx(It,{children:"Duration"}),r.jsx(It,{children:"Points"})]})}),r.jsx(Vs,{children:ue==null?void 0:ue.filter(Me=>Me.user_id).map(Me=>{var Oe,Qe;const ft=((Oe=Me.profiles)==null?void 0:Oe.name)||Me.zoom_name||"Unknown",qe=((Qe=Me.profiles)==null?void 0:Qe.email)||Me.zoom_email||null;return r.jsxs(Ar,{children:[r.jsx(Nt,{className:"font-medium",children:r.jsxs("div",{className:"flex items-center gap-2",children:[ft,Me.manually_added&&r.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200",children:"Manual"})]})}),r.jsx(Nt,{children:qe?r.jsxs("a",{href:`mailto:${qe}`,className:"flex items-center gap-1 text-primary hover:underline",children:[r.jsx(da,{className:"h-3 w-3"}),qe]}):r.jsx("span",{className:"text-muted-foreground",children:"No email"})}),r.jsx(Nt,{children:Me.duration_minutes?r.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground text-sm",children:[r.jsx(Ya,{className:"h-3 w-3"}),Me.duration_minutes," min"]}):r.jsx("span",{className:"text-muted-foreground text-sm",children:"—"})}),r.jsx(Nt,{children:Me.points_awarded?r.jsxs("span",{className:"inline-flex items-center gap-1 text-xs px-2 py-1 rounded-full bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200",children:[r.jsx(Zi,{className:"h-3 w-3"}),"+10 pts"]}):r.jsx("span",{className:"inline-flex items-center gap-1 text-xs px-2 py-1 rounded-full bg-muted text-muted-foreground",children:"Pending"})})]},Me.id)})})]})]})})]})]})}),r.jsx(Fr,{open:L,onOpenChange:z,children:r.jsxs(Rr,{className:"max-w-md",children:[r.jsxs(qr,{children:[r.jsxs($r,{className:"flex items-center gap-2",children:[r.jsx(tf,{className:"h-5 w-5"}),"Link Attendee to Profile"]}),r.jsx(Xn,{children:"Link this Zoom attendee to an existing member profile to award them points."})]}),F&&r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"p-3 bg-muted rounded-lg",children:[r.jsx("p",{className:"text-sm font-medium",children:F.zoom_name||"Unknown"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:F.zoom_email||"No email"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Search for a profile"}),r.jsxs("div",{className:"relative",children:[r.jsx(wa,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(dt,{placeholder:"Search by name or email...",value:ie,onChange:Me=>le(Me.target.value),className:"pl-9"})]})]}),r.jsx("div",{className:"max-h-48 overflow-y-auto border rounded-md",children:Ue.length===0?r.jsx("div",{className:"p-4 text-center text-sm text-muted-foreground",children:"No profiles found"}):r.jsx("div",{className:"divide-y",children:Ue.slice(0,20).map(Me=>r.jsxs("button",{type:"button",onClick:()=>Z(Me.id),className:$t("w-full p-3 text-left hover:bg-muted/50 transition-colors",H===Me.id&&"bg-primary/10 border-l-2 border-primary"),children:[r.jsx("p",{className:"text-sm font-medium",children:Me.name||"Unnamed"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:Me.email})]},Me.id))})}),F.zoom_email&&r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(Dl,{id:"save-alias",checked:G,onCheckedChange:Me=>te(Me)}),r.jsx("label",{htmlFor:"save-alias",className:"text-sm text-muted-foreground cursor-pointer",children:"Remember this email for future auto-matching"})]}),r.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[r.jsx(ee,{variant:"outline",onClick:()=>z(!1),children:"Cancel"}),r.jsx(ee,{onClick:Ee,disabled:!H||Ne.isPending,children:Ne.isPending?"Linking...":"Link & Award Points"})]})]})]})})]})})}const twt=()=>{const{user:t}=Qr(),{toast:e}=fi(),n=Vr(),[s,a]=$d(),[o,l]=I.useState(!1),[i,h]=I.useState(null),[p,x]=I.useState({name:"",description:"",category_id:"",type_id:"",publish_date:new Date().toISOString().split("T")[0],links:[{title:"",canva_share_link:"",sort_order:0}],guides:[],video_url:""}),[y,b]=I.useState(null),[j,C]=I.useState(0),[N,A]=I.useState(!1),[E,T]=I.useState(null),[L,z]=I.useState(""),[F,q]=I.useState(""),[H,Z]=I.useState(""),[G,te]=I.useState(!1),[ie,le]=I.useState(!1),{data:ye=[]}=Yt({queryKey:["template-categories"],queryFn:async()=>{const{data:Ze,error:pe}=await J.from("template_categories").select("*").order("name");if(pe)throw pe;return Ze}}),{data:ne=[]}=Yt({queryKey:["template-types"],queryFn:async()=>{const{data:Ze,error:pe}=await J.from("template_types").select("*").order("name");if(pe)throw pe;return Ze}}),{data:ge=[],isLoading:ae}=Yt({queryKey:["canva-templates-admin"],queryFn:async()=>{const{data:Ze,error:pe}=await J.from("canva_templates").select(` *, category:template_categories(id, name), type:template_types(id, name) `).order("publish_date",{ascending:!1});if(pe)throw pe;const{data:yt,error:rt}=await J.from("template_links").select("*").order("sort_order");if(rt)throw rt;const{data:at,error:Me}=await J.from("template_guides").select("*").order("sort_order");if(Me)throw Me;return Ze.map(qe=>({...qe,links:(yt==null?void 0:yt.filter(Oe=>Oe.template_id===qe.id))||[],guides:(at==null?void 0:at.filter(Oe=>Oe.template_id===qe.id))||[]}))}});I.useEffect(()=>{const Ze=s.get("edit");if(Ze&&ge.length>0){const pe=ge.find(yt=>yt.id===Ze);pe&&(be(pe),a({},{replace:!0}))}},[ge,s]);const he=cr({mutationFn:async Ze=>{const{data:pe,error:yt}=await J.from("template_categories").insert({name:Ze}).select().single();if(yt)throw yt;return pe},onSuccess:Ze=>{n.invalidateQueries({queryKey:["template-categories"]}),x({...p,category_id:Ze.id}),q(""),te(!1),e({title:"Category added"})},onError:Ze=>{e({title:"Error adding category",description:Ze.message,variant:"destructive"})}}),ue=cr({mutationFn:async Ze=>{const{data:pe,error:yt}=await J.from("template_types").insert({name:Ze}).select().single();if(yt)throw yt;return pe},onSuccess:Ze=>{n.invalidateQueries({queryKey:["template-types"]}),x({...p,type_id:Ze.id}),Z(""),le(!1),e({title:"Type added"})},onError:Ze=>{e({title:"Error adding type",description:Ze.message,variant:"destructive"})}}),_e=cr({mutationFn:async Ze=>{var Me;let pe=Ze.existingImageUrl;if(Ze.image){const ft=Ze.image.name.split(".").pop(),qe=`${Date.now()}-${Math.random().toString(36).substring(7)}.${ft}`,{error:Oe}=await J.storage.from("template-previews").upload(qe,Ze.image);if(Oe)throw Oe;const{data:Qe}=J.storage.from("template-previews").getPublicUrl(qe);pe=Qe.publicUrl}const yt={name:Ze.template.name,description:Ze.template.description||null,category_id:Ze.template.category_id||null,type_id:Ze.template.type_id||null,preview_image_url:pe,video_url:Ze.videoUrl||null,publish_date:Ze.template.publish_date?new Date(Ze.template.publish_date).toISOString():new Date().toISOString(),created_by:t==null?void 0:t.id};let rt=Ze.templateId;if(rt){const{error:ft}=await J.from("canva_templates").update(yt).eq("id",rt);if(ft)throw ft;const{error:qe}=await J.from("template_links").delete().eq("template_id",rt);if(qe)throw qe;const Oe=((Me=Ze.existingGuides)==null?void 0:Me.map(gt=>gt.id).filter(Boolean))||[],Qe=Ze.template.guides.map(gt=>gt.id).filter(Boolean),nt=Oe.filter(gt=>!Qe.includes(gt));nt.length>0&&await J.from("template_guides").delete().in("id",nt)}else{const{data:ft,error:qe}=await J.from("canva_templates").insert(yt).select().single();if(qe)throw qe;rt=ft.id,Ybt(Ze.template.name,ft.id)}const at=Ze.template.links.filter(ft=>ft.title.trim()&&ft.canva_share_link.trim());if(at.length>0){const ft=at.map((Oe,Qe)=>({template_id:rt,title:Oe.title.trim(),canva_share_link:Oe.canva_share_link.trim(),sort_order:Qe})),{error:qe}=await J.from("template_links").insert(ft);if(qe)throw qe}for(let ft=0;ft{n.invalidateQueries({queryKey:["canva-templates-admin"]}),n.invalidateQueries({queryKey:["canva-templates"]}),Ce(),l(!1),e({title:i?"Template updated":"Template created"})},onError:Ze=>{e({title:"Error saving template",description:Ze.message,variant:"destructive"})}}),Ae=cr({mutationFn:async Ze=>{const{error:pe}=await J.from("canva_templates").delete().eq("id",Ze);if(pe)throw pe},onSuccess:()=>{n.invalidateQueries({queryKey:["canva-templates-admin"]}),n.invalidateQueries({queryKey:["canva-templates"]}),e({title:"Template deleted"})},onError:Ze=>{e({title:"Error deleting template",description:Ze.message,variant:"destructive"})}}),Ce=()=>{x({name:"",description:"",category_id:"",type_id:"",publish_date:new Date().toISOString().split("T")[0],links:[{title:"",canva_share_link:"",sort_order:0}],guides:[],video_url:""}),T(null),z(""),h(null),te(!1),le(!1),q(""),Z(""),b(null),C(0),A(!1)},be=Ze=>{var pe;h(Ze),x({name:Ze.name,description:Ze.description||"",category_id:Ze.category_id||"",type_id:Ze.type_id||"",publish_date:Ze.publish_date?new Date(Ze.publish_date).toISOString().split("T")[0]:new Date().toISOString().split("T")[0],links:Ze.links&&Ze.links.length>0?Ze.links.map(yt=>({id:yt.id,title:yt.title,canva_share_link:yt.canva_share_link,sort_order:yt.sort_order})):[{title:"",canva_share_link:"",sort_order:0}],guides:((pe=Ze.guides)==null?void 0:pe.map(yt=>({id:yt.id,name:yt.name,file_url:yt.file_url,file_type:yt.file_type,file_size:yt.file_size,sort_order:yt.sort_order})))||[],video_url:Ze.video_url||""}),z(Ze.preview_image_url||""),b(null),l(!0)},me=Ze=>{var yt;const pe=(yt=Ze.target.files)==null?void 0:yt[0];pe&&(T(pe),z(URL.createObjectURL(pe)))},Le=()=>{x({...p,links:[...p.links,{title:"",canva_share_link:"",sort_order:p.links.length}]})},Ne=Ze=>{if(p.links.length<=1)return;const pe=p.links.filter((yt,rt)=>rt!==Ze);x({...p,links:pe})},Be=(Ze,pe,yt)=>{const rt=[...p.links];rt[Ze]={...rt[Ze],[pe]:yt},x({...p,links:rt})},Ee=Ze=>{const pe=Ze.target.files;if(!pe)return;const yt=Array.from(pe).map((rt,at)=>({name:rt.name.replace(/\.[^/.]+$/,""),file_url:"",file_type:rt.type,file_size:rt.size,sort_order:p.guides.length+at,file:rt}));x({...p,guides:[...p.guides,...yt]}),Ze.target.value=""},Ue=Ze=>{const pe=p.guides.filter((yt,rt)=>rt!==Ze);x({...p,guides:pe})},Re=(Ze,pe)=>{const yt=[...p.guides];yt[Ze]={...yt[Ze],name:pe},x({...p,guides:yt})},je=async()=>{if(!y)return null;A(!0),C(0);try{const{data:Ze,error:pe}=await J.functions.invoke("bunny-upload",{body:{action:"create",title:p.name||y.name}});if(pe)throw new Error(pe.message);const{videoId:yt,libraryId:rt}=Ze,{data:at,error:Me}=await J.functions.invoke("bunny-upload",{body:{action:"upload-url",videoId:yt}});if(Me)throw new Error(Me.message);const ft=new XMLHttpRequest;return await new Promise((Oe,Qe)=>{ft.upload.addEventListener("progress",nt=>{if(nt.lengthComputable){const gt=Math.round(nt.loaded/nt.total*100);C(gt)}}),ft.addEventListener("load",()=>{ft.status>=200&&ft.status<300?Oe():Qe(new Error(`Upload failed with status ${ft.status}`))}),ft.addEventListener("error",()=>Qe(new Error("Upload failed"))),ft.open("PUT",at.uploadUrl),ft.setRequestHeader("AccessKey",at.apiKey),ft.send(y)}),`https://player.mediadelivery.net/embed/${rt}/${yt}`}catch(Ze){return console.error("Bunny upload error:",Ze),e({title:"Video upload failed",description:Ze instanceof Error?Ze.message:"Unknown error",variant:"destructive"}),null}finally{A(!1)}},et=Ze=>{var yt;const pe=(yt=Ze.target.files)==null?void 0:yt[0];pe&&b(pe),Ze.target.value=""},Te=async Ze=>{if(Ze.preventDefault(),!p.name.trim()){e({title:"Please enter a template name",variant:"destructive"});return}if(p.links.filter(rt=>rt.title.trim()&&rt.canva_share_link.trim()).length===0){e({title:"Please add at least one Canva link",variant:"destructive"});return}let yt=p.video_url;if(y){const rt=await je();if(!rt)return;yt=rt}_e.mutate({template:p,image:E,existingImageUrl:(i==null?void 0:i.preview_image_url)||null,templateId:i==null?void 0:i.id,existingGuides:i==null?void 0:i.guides,videoUrl:yt})};return r.jsx(Lr,{title:"Manage Templates",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Gu,{title:"Manage Templates",description:"Create and manage Canva templates"}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[r.jsxs(Ye,{children:[r.jsx(Gt,{className:"pb-2",children:r.jsx(Zt,{className:"text-sm font-medium text-muted-foreground",children:"Total Templates"})}),r.jsx(tt,{children:r.jsx("div",{className:"text-2xl font-bold",children:ge.length})})]}),r.jsxs(Ye,{children:[r.jsx(Gt,{className:"pb-2",children:r.jsx(Zt,{className:"text-sm font-medium text-muted-foreground",children:"Categories"})}),r.jsx(tt,{children:r.jsx("div",{className:"text-2xl font-bold",children:ye.length})})]}),r.jsxs(Ye,{children:[r.jsx(Gt,{className:"pb-2",children:r.jsx(Zt,{className:"text-sm font-medium text-muted-foreground",children:"Template Types"})}),r.jsx(tt,{children:r.jsx("div",{className:"text-2xl font-bold",children:ne.length})})]})]}),r.jsxs(Fr,{open:o,onOpenChange:Ze=>{l(Ze),Ze||Ce()},children:[r.jsx(zo,{asChild:!0,children:r.jsxs(ee,{className:"gap-2",children:[r.jsx(bn,{className:"h-4 w-4"}),"Add Template"]})}),r.jsxs(Rr,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsx(qr,{children:r.jsx($r,{children:i?"Edit Template":"Add New Template"})}),r.jsxs("form",{onSubmit:Te,className:"space-y-6 pt-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"name",children:"Name *"}),r.jsx(dt,{id:"name",value:p.name,onChange:Ze=>x({...p,name:Ze.target.value}),placeholder:"Template name",required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Description"}),r.jsx(fy,{content:p.description,onChange:Ze=>x({...p,description:Ze}),placeholder:"Brief description of the template",minHeight:"120px"})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(He,{children:"Canva Links *"}),r.jsxs(ee,{type:"button",variant:"outline",size:"sm",onClick:Le,className:"gap-1",children:[r.jsx(bn,{className:"h-3 w-3"}),"Add Link"]})]}),r.jsx("div",{className:"space-y-3",children:p.links.map((Ze,pe)=>r.jsxs("div",{className:"flex gap-2 items-start p-3 border rounded-lg bg-muted/30",children:[r.jsxs("div",{className:"flex-1 space-y-2",children:[r.jsx(dt,{value:Ze.title,onChange:yt=>Be(pe,"title",yt.target.value),placeholder:"Link title (e.g., Instagram Post, Story)"}),r.jsx(dt,{value:Ze.canva_share_link,onChange:yt=>Be(pe,"canva_share_link",yt.target.value),placeholder:"https://www.canva.com/design/..."})]}),p.links.length>1&&r.jsx(ee,{type:"button",variant:"ghost",size:"icon",className:"shrink-0 text-muted-foreground hover:text-destructive",onClick:()=>Ne(pe),children:r.jsx(_s,{className:"h-4 w-4"})})]},pe))})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Category"}),G?r.jsxs("div",{className:"flex gap-2",children:[r.jsx(dt,{value:F,onChange:Ze=>q(Ze.target.value),placeholder:"New category name",className:"flex-1"}),r.jsx(ee,{type:"button",size:"sm",onClick:()=>F.trim()&&he.mutate(F.trim()),disabled:he.isPending,children:"Add"}),r.jsx(ee,{type:"button",size:"sm",variant:"ghost",onClick:()=>{te(!1),q("")},children:r.jsx(_s,{className:"h-4 w-4"})})]}):r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(gn,{value:p.category_id,onValueChange:Ze=>x({...p,category_id:Ze}),children:[r.jsx(fn,{className:"flex-1",children:r.jsx(xn,{placeholder:"Select category"})}),r.jsx(pn,{children:ye.map(Ze=>r.jsx(Vt,{value:Ze.id,children:Ze.name},Ze.id))})]}),r.jsx(ee,{type:"button",variant:"outline",size:"icon",onClick:()=>te(!0),children:r.jsx(bn,{className:"h-4 w-4"})})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Template Type"}),ie?r.jsxs("div",{className:"flex gap-2",children:[r.jsx(dt,{value:H,onChange:Ze=>Z(Ze.target.value),placeholder:"New type name",className:"flex-1"}),r.jsx(ee,{type:"button",size:"sm",onClick:()=>H.trim()&&ue.mutate(H.trim()),disabled:ue.isPending,children:"Add"}),r.jsx(ee,{type:"button",size:"sm",variant:"ghost",onClick:()=>{le(!1),Z("")},children:r.jsx(_s,{className:"h-4 w-4"})})]}):r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(gn,{value:p.type_id,onValueChange:Ze=>x({...p,type_id:Ze}),children:[r.jsx(fn,{className:"flex-1",children:r.jsx(xn,{placeholder:"Select type"})}),r.jsx(pn,{children:ne.map(Ze=>r.jsx(Vt,{value:Ze.id,children:Ze.name},Ze.id))})]}),r.jsx(ee,{type:"button",variant:"outline",size:"icon",onClick:()=>le(!0),children:r.jsx(bn,{className:"h-4 w-4"})})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"publish_date",children:"Publish Date"}),r.jsx(dt,{id:"publish_date",type:"date",value:p.publish_date,onChange:Ze=>x({...p,publish_date:Ze.target.value})}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Templates are sorted by publish date (newest first) on the member page"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Preview Image"}),r.jsxs("div",{className:"flex items-start gap-4",children:[L?r.jsxs("div",{className:"relative w-32 h-24 rounded-lg overflow-hidden border bg-muted",children:[r.jsx("img",{src:L,alt:"Preview",className:"w-full h-full object-cover"}),r.jsx(ee,{type:"button",size:"icon",variant:"destructive",className:"absolute top-1 right-1 h-6 w-6",onClick:()=>{T(null),z("")},children:r.jsx(_s,{className:"h-3 w-3"})})]}):r.jsx("div",{className:"w-32 h-24 rounded-lg border-2 border-dashed border-muted-foreground/25 flex items-center justify-center",children:r.jsx(Pl,{className:"h-8 w-8 text-muted-foreground/50"})}),r.jsxs("div",{className:"flex-1",children:[r.jsx(dt,{type:"file",accept:"image/*",onChange:me,className:"cursor-pointer"}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Upload a preview image for this template"})]})]})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsx(He,{children:"Video (Optional)"}),p.video_url&&!y?r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center gap-2 p-3 border rounded-lg bg-muted/30",children:[r.jsx(Pa,{className:"h-5 w-5 text-primary shrink-0"}),r.jsx("span",{className:"text-sm flex-1 truncate",children:"Video uploaded"}),r.jsx(ee,{type:"button",variant:"ghost",size:"sm",onClick:()=>x({...p,video_url:""}),className:"text-destructive hover:text-destructive",children:"Remove"})]}),r.jsx("div",{className:"aspect-video max-w-md rounded-lg overflow-hidden border",children:r.jsx("iframe",{src:p.video_url,className:"w-full h-full",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0})})]}):N?r.jsxs("div",{className:"space-y-2 p-4 border rounded-lg bg-muted/30",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(en,{className:"h-4 w-4 animate-spin"}),r.jsxs("span",{className:"text-sm",children:["Uploading video... ",j,"%"]})]}),r.jsx(Kc,{value:j,className:"h-2"})]}):y?r.jsxs("div",{className:"flex items-center gap-2 p-3 border rounded-lg bg-muted/30",children:[r.jsx(Pa,{className:"h-5 w-5 text-muted-foreground shrink-0"}),r.jsx("span",{className:"text-sm flex-1 truncate",children:y.name}),r.jsxs("span",{className:"text-xs text-muted-foreground shrink-0",children:[(y.size/1024/1024).toFixed(1)," MB"]}),r.jsx(ee,{type:"button",variant:"ghost",size:"icon",className:"shrink-0 text-muted-foreground hover:text-destructive h-8 w-8",onClick:()=>b(null),children:r.jsx(_s,{className:"h-4 w-4"})})]}):r.jsxs("div",{className:"space-y-2",children:[r.jsxs("label",{className:"cursor-pointer",children:[r.jsx(dt,{type:"file",accept:"video/*",onChange:et,className:"hidden"}),r.jsxs("div",{className:"flex items-center justify-center gap-2 p-6 border-2 border-dashed rounded-lg hover:border-primary/50 transition-colors",children:[r.jsx(Pa,{className:"h-8 w-8 text-muted-foreground/50"}),r.jsx("span",{className:"text-sm text-muted-foreground",children:"Click to upload a video"})]})]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Upload a video to embed on the template page (Bunny.net)"})]})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(He,{children:"Guide Files (PDFs)"}),r.jsxs("label",{className:"cursor-pointer",children:[r.jsx(dt,{type:"file",accept:".pdf,.doc,.docx",multiple:!0,onChange:Ee,className:"hidden"}),r.jsx(ee,{type:"button",variant:"outline",size:"sm",className:"gap-1",asChild:!0,children:r.jsxs("span",{children:[r.jsx(uo,{className:"h-3 w-3"}),"Add Files"]})})]})]}),p.guides.length>0?r.jsx("div",{className:"space-y-2",children:p.guides.map((Ze,pe)=>r.jsxs("div",{className:"flex gap-2 items-center p-3 border rounded-lg bg-muted/30",children:[r.jsx(La,{className:"h-5 w-5 text-muted-foreground shrink-0"}),r.jsx(dt,{value:Ze.name,onChange:yt=>Re(pe,yt.target.value),placeholder:"Guide name",className:"flex-1"}),Ze.file_size&&r.jsxs("span",{className:"text-xs text-muted-foreground shrink-0",children:[(Ze.file_size/1024).toFixed(0)," KB"]}),r.jsx(ee,{type:"button",variant:"ghost",size:"icon",className:"shrink-0 text-muted-foreground hover:text-destructive h-8 w-8",onClick:()=>Ue(pe),children:r.jsx(_s,{className:"h-4 w-4"})})]},Ze.id||pe))}):r.jsx("p",{className:"text-sm text-muted-foreground",children:"No guide files added. Upload PDFs to help agents understand how to use this template."})]}),r.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[r.jsx(ee,{type:"button",variant:"outline",onClick:()=>{l(!1),Ce()},children:"Cancel"}),r.jsx(ee,{type:"submit",disabled:_e.isPending,children:_e.isPending?"Saving...":i?"Update":"Create"})]})]})]})]})]}),r.jsx(Ye,{children:r.jsx(tt,{className:"p-0",children:ae?r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"Loading..."}):ge.length===0?r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"No templates yet. Add your first template!"}):r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Ar,{children:[r.jsx(It,{children:"Preview"}),r.jsx(It,{children:"Name"}),r.jsx(It,{children:"Links"}),r.jsx(It,{children:"Category"}),r.jsx(It,{children:"Type"}),r.jsx(It,{children:"Publish Date"}),r.jsx(It,{className:"text-right",children:"Actions"})]})}),r.jsx(Vs,{children:ge.map(Ze=>{var pe,yt,rt,at,Me;return r.jsxs(Ar,{children:[r.jsx(Nt,{children:r.jsx("div",{className:"w-16 h-12 rounded overflow-hidden bg-muted",children:Ze.preview_image_url?r.jsx("img",{src:Ze.preview_image_url,alt:Ze.name,className:"w-full h-full object-cover"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center",children:r.jsx(Pl,{className:"h-4 w-4 text-muted-foreground"})})})}),r.jsx(Nt,{className:"font-medium",children:Ze.name}),r.jsx(Nt,{children:r.jsxs("div",{className:"flex flex-col gap-1",children:[r.jsxs(Ot,{variant:"secondary",children:[((pe=Ze.links)==null?void 0:pe.length)||0," link",(((yt=Ze.links)==null?void 0:yt.length)||0)!==1?"s":""]}),(((rt=Ze.guides)==null?void 0:rt.length)||0)>0&&r.jsxs(Ot,{variant:"outline",className:"gap-1",children:[r.jsx(La,{className:"h-3 w-3"}),(at=Ze.guides)==null?void 0:at.length," guide",(((Me=Ze.guides)==null?void 0:Me.length)||0)!==1?"s":""]})]})}),r.jsx(Nt,{children:Ze.category?r.jsx(Ot,{variant:"secondary",children:Ze.category.name}):r.jsx("span",{className:"text-muted-foreground",children:"-"})}),r.jsx(Nt,{children:Ze.type?r.jsx(Ot,{variant:"outline",children:Ze.type.name}):r.jsx("span",{className:"text-muted-foreground",children:"-"})}),r.jsx(Nt,{className:"text-muted-foreground",children:new Date(Ze.publish_date).toLocaleDateString()}),r.jsx(Nt,{className:"text-right",children:r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(ee,{size:"icon",variant:"ghost",onClick:()=>be(Ze),children:r.jsx(_i,{className:"h-4 w-4"})}),r.jsx(ee,{size:"icon",variant:"ghost",className:"text-destructive hover:text-destructive",onClick:()=>{confirm("Delete this template?")&&Ae.mutate(Ze.id)},children:r.jsx(Vn,{className:"h-4 w-4"})})]})})]},Ze.id)})})]})})})]})})},rwt=[{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"}],nwt=()=>{const{user:t}=Qr(),{toast:e}=fi(),n=Vr(),[s,a]=I.useState(!1),[o,l]=I.useState(null),[i,h]=I.useState({title:"",description:"",video_url:"",video_type:"youtube",duration:"",category_id:"",publish_date:new Date().toISOString().split("T")[0],is_published:!1}),[p,x]=I.useState(null),[y,b]=I.useState(""),[j,C]=I.useState([]),[N,A]=I.useState([]),[E,T]=I.useState([]),[L,z]=I.useState(""),[F,q]=I.useState(!1),[H,Z]=I.useState(null),[G,te]=I.useState(0),[ie,le]=I.useState(!1),[ye,ne]=I.useState(null),{data:ge=[]}=Yt({queryKey:["academy-categories"],queryFn:async()=>{const{data:je,error:et}=await J.from("academy_categories").select("*").order("sort_order",{ascending:!0});if(et)throw et;return je}}),{data:ae=[],isLoading:he}=Yt({queryKey:["academy-videos-admin"],queryFn:async()=>{const{data:je,error:et}=await J.from("academy_videos").select(` *, category:academy_categories(id, name) `).order("publish_date",{ascending:!1});if(et)throw et;const{data:Te,error:Ze}=await J.from("academy_resources").select("*").order("sort_order");if(Ze)throw Ze;return je.map(yt=>({...yt,resources:(Te==null?void 0:Te.filter(rt=>rt.video_id===yt.id))||[]}))}}),ue=cr({mutationFn:async je=>{const{data:et,error:Te}=await J.from("academy_categories").insert({name:je,sort_order:ge.length}).select().single();if(Te)throw Te;return et},onSuccess:je=>{n.invalidateQueries({queryKey:["academy-categories"]}),h({...i,category_id:je.id}),z(""),q(!1),e({title:"Category added"})},onError:je=>{e({title:"Error adding category",description:je.message,variant:"destructive"})}}),_e=cr({mutationFn:async je=>{let et=je.existingThumbnailUrl;if(je.thumbnail){const pe=je.thumbnail.name.split(".").pop(),yt=`thumbnails/${Date.now()}-${Math.random().toString(36).substring(7)}.${pe}`,{error:rt}=await J.storage.from("academy-resources").upload(yt,je.thumbnail);if(rt)throw rt;const{data:at}=J.storage.from("academy-resources").getPublicUrl(yt);et=at.publicUrl}const Te={title:je.video.title,description:je.video.description||null,video_url:je.video.video_url,video_type:je.video.video_type,duration:je.video.duration||null,thumbnail_url:et,category_id:je.video.category_id||null,publish_date:je.video.publish_date?new Date(je.video.publish_date).toISOString():new Date().toISOString(),is_published:je.video.is_published,created_by:t==null?void 0:t.id};let Ze=je.videoId;if(Ze){const{error:pe}=await J.from("academy_videos").update(Te).eq("id",Ze);if(pe)throw pe}else{const{data:pe,error:yt}=await J.from("academy_videos").insert(Te).select().single();if(yt)throw yt;Ze=pe.id,Xbt(je.video.title,pe.id)}if(je.resourcesToDelete.length>0){const{error:pe}=await J.from("academy_resources").delete().in("id",je.resourcesToDelete);if(pe)throw pe}for(let pe=0;pe{n.invalidateQueries({queryKey:["academy-videos-admin"]}),n.invalidateQueries({queryKey:["academy-videos"]}),be(),a(!1),e({title:o?"Video updated":"Video created"})},onError:je=>{e({title:"Error saving video",description:je.message,variant:"destructive"})}}),Ae=cr({mutationFn:async je=>{const{error:et}=await J.from("academy_videos").delete().eq("id",je);if(et)throw et},onSuccess:()=>{n.invalidateQueries({queryKey:["academy-videos-admin"]}),n.invalidateQueries({queryKey:["academy-videos"]}),e({title:"Video deleted"})},onError:je=>{e({title:"Error deleting video",description:je.message,variant:"destructive"})}}),Ce=cr({mutationFn:async({id:je,is_published:et})=>{const{error:Te}=await J.from("academy_videos").update({is_published:et}).eq("id",je);if(Te)throw Te},onSuccess:()=>{n.invalidateQueries({queryKey:["academy-videos-admin"]}),n.invalidateQueries({queryKey:["academy-videos"]})},onError:je=>{e({title:"Error updating video",description:je.message,variant:"destructive"})}}),be=()=>{h({title:"",description:"",video_url:"",video_type:"bunny_stream",duration:"",category_id:"",publish_date:new Date().toISOString().split("T")[0],is_published:!1}),x(null),b(""),C([]),A([]),T([]),l(null),q(!1),z(""),Z(null),te(0),le(!1),ne(null)},me=je=>{l(je),h({title:je.title,description:je.description||"",video_url:je.video_url,video_type:je.video_type,duration:je.duration||"",category_id:je.category_id||"",publish_date:je.publish_date?new Date(je.publish_date).toISOString().split("T")[0]:new Date().toISOString().split("T")[0],is_published:je.is_published}),b(je.thumbnail_url||""),A(je.resources||[]),C([]),T([]),a(!0)},Le=je=>{var Te;const et=(Te=je.target.files)==null?void 0:Te[0];et&&(x(et),b(URL.createObjectURL(et)))},Ne=je=>{const et=je.target.files;if(et){const Te=Array.from(et).map(Ze=>({file:Ze,title:Ze.name.replace(/\.[^/.]+$/,"")}));C([...j,...Te])}je.target.value=""},Be=je=>{C(j.filter((et,Te)=>Te!==je))},Ee=je=>{T([...E,je]),A(N.filter(et=>et.id!==je))},Ue=async()=>{if(!H)return null;le(!0),te(0);try{const{data:je,error:et}=await J.functions.invoke("bunny-upload",{body:{action:"create",title:i.title||H.name}});if(et)throw new Error(et.message);const{videoId:Te,libraryId:Ze}=je;ne(Te);const{data:pe,error:yt}=await J.functions.invoke("bunny-upload",{body:{action:"upload-url",videoId:Te}});if(yt)throw new Error(yt.message);const rt=new XMLHttpRequest;return await new Promise((Me,ft)=>{rt.upload.addEventListener("progress",qe=>{if(qe.lengthComputable){const Oe=Math.round(qe.loaded/qe.total*100);te(Oe)}}),rt.addEventListener("load",()=>{rt.status>=200&&rt.status<300?Me():ft(new Error(`Upload failed with status ${rt.status}`))}),rt.addEventListener("error",()=>ft(new Error("Upload failed"))),rt.open("PUT",pe.uploadUrl),rt.setRequestHeader("AccessKey",pe.apiKey),rt.send(H)}),`https://player.mediadelivery.net/embed/${Ze}/${Te}`}catch(je){return console.error("Bunny upload error:",je),e({title:"Video upload failed",description:je instanceof Error?je.message:"Unknown error",variant:"destructive"}),null}finally{le(!1)}},Re=async je=>{if(je.preventDefault(),!i.title.trim()){e({title:"Please enter a video title",variant:"destructive"});return}let et=i.video_url;if(i.video_type==="bunny_stream"&&H&&!o){const Te=await Ue();if(!Te)return;et=Te}else if(!i.video_url.trim()&&i.video_type!=="bunny_stream"){e({title:"Please enter a video URL",variant:"destructive"});return}else if(i.video_type==="bunny_stream"&&!H&&!i.video_url&&!o){e({title:"Please select a video file to upload",variant:"destructive"});return}_e.mutate({video:{...i,video_url:et},thumbnail:p,existingThumbnailUrl:(o==null?void 0:o.thumbnail_url)||null,videoId:o==null?void 0:o.id,newResources:j,resourcesToDelete:E})};return r.jsx(Lr,{title:"Manage Academy",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Gu,{title:"Manage Academy",description:"Create and manage training videos and resources"}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs(Ye,{children:[r.jsx(Gt,{className:"pb-2",children:r.jsx(Zt,{className:"text-sm font-medium text-muted-foreground",children:"Total Videos"})}),r.jsx(tt,{children:r.jsx("div",{className:"text-2xl font-bold",children:ae.length})})]}),r.jsxs(Ye,{children:[r.jsx(Gt,{className:"pb-2",children:r.jsx(Zt,{className:"text-sm font-medium text-muted-foreground",children:"Published"})}),r.jsx(tt,{children:r.jsx("div",{className:"text-2xl font-bold",children:ae.filter(je=>je.is_published).length})})]})]}),r.jsxs(Fr,{open:s,onOpenChange:je=>{a(je),je||be()},children:[r.jsx(zo,{asChild:!0,children:r.jsxs(ee,{className:"gap-2",children:[r.jsx(bn,{className:"h-4 w-4"}),"Add Video"]})}),r.jsxs(Rr,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsx(qr,{children:r.jsx($r,{children:o?"Edit Video":"Add New Video"})}),r.jsxs("form",{onSubmit:Re,className:"space-y-6 pt-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"title",children:"Title *"}),r.jsx(dt,{id:"title",value:i.title,onChange:je=>h({...i,title:je.target.value}),placeholder:"Video title",required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Description"}),r.jsx(fy,{content:i.description,onChange:je=>h({...i,description:je}),placeholder:"Brief description of the video",minHeight:"120px"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Video Type"}),r.jsxs(gn,{value:i.video_type,onValueChange:je=>{h({...i,video_type:je,video_url:""}),Z(null)},disabled:ie,children:[r.jsx(fn,{children:r.jsx(xn,{})}),r.jsx(pn,{children:rwt.map(je=>r.jsx(Vt,{value:je.value,children:je.label},je.value))})]})]}),i.video_type==="bunny_stream"?r.jsxs("div",{className:"space-y-3",children:[r.jsxs(He,{children:["Upload Video File ",!o&&"*"]}),o&&i.video_url&&r.jsxs("p",{className:"text-sm text-muted-foreground",children:["Current video: ",r.jsx("a",{href:i.video_url,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"View"})]}),!o&&r.jsxs(r.Fragment,{children:[r.jsx(dt,{type:"file",accept:"video/*",onChange:je=>{var Te;const et=(Te=je.target.files)==null?void 0:Te[0];et&&Z(et)},disabled:ie}),H&&r.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[r.jsx(Pa,{className:"h-4 w-4"}),H.name," (",(H.size/(1024*1024)).toFixed(1)," MB)"]}),ie&&r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(en,{className:"h-4 w-4 animate-spin"}),r.jsx("span",{className:"text-sm",children:"Uploading to Bunny.net..."})]}),r.jsx(Kc,{value:G,className:"h-2"}),r.jsxs("p",{className:"text-xs text-muted-foreground text-right",children:[G,"%"]})]})]})]}):r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"video_url",children:"Video URL *"}),r.jsx(dt,{id:"video_url",value:i.video_url,onChange:je=>h({...i,video_url:je.target.value}),placeholder:"https://...",required:!0})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"duration",children:"Duration"}),r.jsx(dt,{id:"duration",value:i.duration,onChange:je=>h({...i,duration:je.target.value}),placeholder:"e.g., 45:30"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"publish_date",children:"Publish Date"}),r.jsx(dt,{id:"publish_date",type:"date",value:i.publish_date,onChange:je=>h({...i,publish_date:je.target.value})})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Category"}),F?r.jsxs("div",{className:"flex gap-2",children:[r.jsx(dt,{value:L,onChange:je=>z(je.target.value),placeholder:"New category name",className:"flex-1"}),r.jsx(ee,{type:"button",size:"sm",onClick:()=>L.trim()&&ue.mutate(L.trim()),disabled:ue.isPending,children:"Add"}),r.jsx(ee,{type:"button",size:"sm",variant:"ghost",onClick:()=>{q(!1),z("")},children:r.jsx(_s,{className:"h-4 w-4"})})]}):r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(gn,{value:i.category_id,onValueChange:je=>h({...i,category_id:je}),children:[r.jsx(fn,{className:"flex-1",children:r.jsx(xn,{placeholder:"Select category"})}),r.jsx(pn,{children:ge.map(je=>r.jsx(Vt,{value:je.id,children:je.name},je.id))})]}),r.jsx(ee,{type:"button",variant:"outline",size:"sm",onClick:()=>q(!0),children:r.jsx(bn,{className:"h-4 w-4"})})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Thumbnail Image"}),r.jsxs("div",{className:"flex items-start gap-4",children:[y&&r.jsx("img",{src:y,alt:"Thumbnail preview",className:"w-32 h-20 object-cover rounded-md border"}),r.jsxs("div",{className:"flex-1",children:[r.jsx(dt,{type:"file",accept:"image/*",onChange:Le,className:"cursor-pointer"}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Recommended: 16:9 aspect ratio"})]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(He,{children:"Resource Files"}),r.jsx(ee,{type:"button",variant:"outline",size:"sm",asChild:!0,children:r.jsxs("label",{className:"cursor-pointer gap-1",children:[r.jsx(uo,{className:"h-3 w-3"}),"Add Files",r.jsx("input",{type:"file",multiple:!0,accept:".pdf,.pptx,.ppt,.xlsx,.xls,.docx,.doc,.zip",onChange:Ne,className:"hidden"})]})})]}),(N.length>0||j.length>0)&&r.jsxs("div",{className:"space-y-2 mt-2",children:[N.map(je=>r.jsxs("div",{className:"flex items-center gap-2 p-2 border rounded-md bg-muted/30",children:[r.jsx(La,{className:"h-4 w-4 text-muted-foreground"}),r.jsx("span",{className:"flex-1 text-sm truncate",children:je.title}),r.jsx(Ot,{variant:"outline",className:"text-xs",children:je.file_type}),r.jsx(ee,{type:"button",variant:"ghost",size:"sm",onClick:()=>Ee(je.id),className:"text-destructive hover:text-destructive",children:r.jsx(_s,{className:"h-4 w-4"})})]},je.id)),j.map((je,et)=>r.jsxs("div",{className:"flex items-center gap-2 p-2 border rounded-md bg-muted/30",children:[r.jsx(La,{className:"h-4 w-4 text-muted-foreground"}),r.jsx(dt,{value:je.title,onChange:Te=>{const Ze=[...j];Ze[et].title=Te.target.value,C(Ze)},className:"flex-1 h-8",placeholder:"Resource title"}),r.jsx(Ot,{variant:"secondary",className:"text-xs",children:"New"}),r.jsx(ee,{type:"button",variant:"ghost",size:"sm",onClick:()=>Be(et),className:"text-destructive hover:text-destructive",children:r.jsx(_s,{className:"h-4 w-4"})})]},et))]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Supported: PDF, PowerPoint, Excel, Word, ZIP"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ps,{id:"is_published",checked:i.is_published,onCheckedChange:je=>h({...i,is_published:je})}),r.jsx(He,{htmlFor:"is_published",children:"Published"})]}),r.jsxs(ea,{children:[r.jsx(ee,{type:"button",variant:"outline",onClick:()=>a(!1),disabled:ie,children:"Cancel"}),r.jsx(ee,{type:"submit",disabled:_e.isPending||ie,children:ie?r.jsxs(r.Fragment,{children:[r.jsx(en,{className:"h-4 w-4 mr-2 animate-spin"}),"Uploading..."]}):_e.isPending?"Saving...":o?"Update Video":"Add Video"})]})]})]})]})]}),r.jsx(Ye,{children:r.jsx(tt,{className:"p-0",children:he?r.jsx("div",{className:"flex justify-center py-8",children:r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})}):ae.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(Pa,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),r.jsx("p",{children:"No videos yet"}),r.jsx("p",{className:"text-sm",children:"Add your first academy video"})]}):r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Ar,{children:[r.jsx(It,{children:"Title"}),r.jsx(It,{children:"Category"}),r.jsx(It,{children:"Duration"}),r.jsx(It,{children:"Resources"}),r.jsx(It,{children:"Publish Date"}),r.jsx(It,{children:"Status"}),r.jsx(It,{className:"w-[120px]",children:"Actions"})]})}),r.jsx(Vs,{children:ae.map(je=>r.jsxs(Ar,{children:[r.jsx(Nt,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[je.thumbnail_url?r.jsx("img",{src:je.thumbnail_url,alt:"",className:"w-16 h-10 object-cover rounded"}):r.jsx("div",{className:"w-16 h-10 bg-muted rounded flex items-center justify-center",children:r.jsx(Pa,{className:"h-4 w-4 text-muted-foreground"})}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:je.title}),r.jsx("p",{className:"text-xs text-muted-foreground capitalize",children:je.video_type.replace("_"," ")})]})]})}),r.jsx(Nt,{children:je.category?r.jsx(Ot,{variant:"outline",children:je.category.name}):r.jsx("span",{className:"text-muted-foreground text-sm",children:"-"})}),r.jsx(Nt,{children:je.duration||"-"}),r.jsx(Nt,{children:je.resources&&je.resources.length>0?r.jsxs(Ot,{variant:"secondary",children:[je.resources.length," file(s)"]}):r.jsx("span",{className:"text-muted-foreground text-sm",children:"-"})}),r.jsx(Nt,{children:new Date(je.publish_date).toLocaleDateString()}),r.jsx(Nt,{children:r.jsx(Ps,{checked:je.is_published,onCheckedChange:et=>Ce.mutate({id:je.id,is_published:et})})}),r.jsx(Nt,{children:r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>me(je),children:r.jsx(_i,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>Ae.mutate(je.id),className:"text-destructive hover:text-destructive",children:r.jsx(Vn,{className:"h-4 w-4"})})]})})]},je.id))})]})})})]})})};function swt(){var Ce,be,me;const t=Vr(),[e,n]=$d(),[s,a]=I.useState(!1),[o,l]=I.useState(null),[i,h]=I.useState({name:"",description:"",publish_date:new Date().toISOString().split("T")[0],is_published:!1}),[p,x]=I.useState(null),[y,b]=I.useState(""),[j,C]=I.useState([]),[N,A]=I.useState([]),[E,T]=I.useState(null),{data:L,isLoading:z}=Yt({queryKey:["resource-kits"],queryFn:async()=>{const{data:Le,error:Ne}=await J.from("resource_kits").select("*").order("publish_date",{ascending:!1});if(Ne)throw Ne;return Le}}),{data:F}=Yt({queryKey:["resource-kit-files"],queryFn:async()=>{const{data:Le,error:Ne}=await J.from("resource_kit_files").select("*").order("sort_order",{ascending:!0});if(Ne)throw Ne;return Le}}),{data:q}=Yt({queryKey:["resource-kit-links"],queryFn:async()=>{const{data:Le,error:Ne}=await J.from("resource_kit_links").select("*").order("sort_order",{ascending:!0});if(Ne)throw Ne;return Le}});I.useEffect(()=>{const Le=e.get("edit");if(Le&&L&&L.length>0&&F&&q){const Ne=L.find(Be=>Be.id===Le);Ne&&(Z(Ne),n({},{replace:!0}))}},[L,F,q,e]);const H=()=>{h({name:"",description:"",publish_date:new Date().toISOString().split("T")[0],is_published:!1}),x(null),b(""),C([]),A([]),l(null)},Z=Le=>{l(Le),h({name:Le.name,description:Le.description||"",publish_date:Le.publish_date.split("T")[0],is_published:Le.is_published}),b(Le.featured_image_url||"");const Ne=(F==null?void 0:F.filter(Ee=>Ee.kit_id===Le.id))||[];C(Ne.map(Ee=>({id:Ee.id,name:Ee.name,file_url:Ee.file_url,file_type:Ee.file_type,file_size:Ee.file_size,sort_order:Ee.sort_order})));const Be=(q==null?void 0:q.filter(Ee=>Ee.kit_id===Le.id))||[];A(Be.map(Ee=>({id:Ee.id,title:Ee.title,canva_share_link:Ee.canva_share_link,sort_order:Ee.sort_order}))),a(!0)},G=Le=>{var Be;const Ne=(Be=Le.target.files)==null?void 0:Be[0];Ne&&(x(Ne),b(URL.createObjectURL(Ne)))},te=()=>{C([...j,{name:"",file_url:"",sort_order:j.length}])},ie=Le=>{C(j.filter((Ne,Be)=>Be!==Le))},le=(Le,Ne,Be)=>{const Ee=[...j];Ee[Le]={...Ee[Le],[Ne]:Be},C(Ee)},ye=()=>{A([...N,{title:"",canva_share_link:"",sort_order:N.length}])},ne=Le=>{A(N.filter((Ne,Be)=>Be!==Le))},ge=(Le,Ne,Be)=>{const Ee=[...N];Ee[Le]={...Ee[Le],[Ne]:Be},A(Ee)},ae=(Le,Ne)=>{var Ee;const Be=(Ee=Ne.target.files)==null?void 0:Ee[0];if(Be){const Ue=[...j],Re=Be.name.replace(/\.[^/.]+$/,"");Ue[Le]={...Ue[Le],file:Be,file_type:Be.type,file_size:Be.size,name:Ue[Le].name||Re},C(Ue)}},he=cr({mutationFn:async()=>{let Le=(o==null?void 0:o.featured_image_url)||null;if(p){const Re=p.name.split(".").pop(),je=`${Date.now()}.${Re}`,{error:et}=await J.storage.from("resource-kits").upload(`featured/${je}`,p);if(et)throw et;const{data:Te}=J.storage.from("resource-kits").getPublicUrl(`featured/${je}`);Le=Te.publicUrl}const Ne={name:i.name,description:i.description||null,featured_image_url:Le,publish_date:i.publish_date,is_published:i.is_published};let Be;const Ee=!o,Ue=(o==null?void 0:o.is_published)||!1;if(o){const{error:Re}=await J.from("resource_kits").update(Ne).eq("id",o.id);if(Re)throw Re;Be=o.id;const je=(F==null?void 0:F.filter(rt=>rt.kit_id===o.id).map(rt=>rt.id))||[],et=j.filter(rt=>rt.id).map(rt=>rt.id),Te=je.filter(rt=>!et.includes(rt));Te.length>0&&await J.from("resource_kit_files").delete().in("id",Te);const Ze=(q==null?void 0:q.filter(rt=>rt.kit_id===o.id).map(rt=>rt.id))||[],pe=N.filter(rt=>rt.id).map(rt=>rt.id),yt=Ze.filter(rt=>!pe.includes(rt));yt.length>0&&await J.from("resource_kit_links").delete().in("id",yt)}else{const{data:Re,error:je}=await J.from("resource_kits").insert(Ne).select().single();if(je)throw je;Be=Re.id}for(let Re=0;Re{t.invalidateQueries({queryKey:["resource-kits"]}),t.invalidateQueries({queryKey:["resource-kit-files"]}),t.invalidateQueries({queryKey:["resource-kit-links"]}),ze.success(o?"Resource kit updated":"Resource kit created"),Le.isPublished&&(Le.isNewKit||!Le.wasPublished)&&Jbt(Le.kitName,Le.kitId),a(!1),H()},onError:Le=>{ze.error("Failed to save resource kit: "+Le.message)}}),ue=cr({mutationFn:async Le=>{const{error:Ne}=await J.from("resource_kits").delete().eq("id",Le);if(Ne)throw Ne},onSuccess:()=>{t.invalidateQueries({queryKey:["resource-kits"]}),t.invalidateQueries({queryKey:["resource-kit-files"]}),ze.success("Resource kit deleted")},onError:Le=>{ze.error("Failed to delete: "+Le.message)}}),_e=Le=>{if(Le.preventDefault(),!i.name){ze.error("Please enter a name");return}he.mutate()},Ae=Le=>(F==null?void 0:F.filter(Ne=>Ne.kit_id===Le).length)||0;return r.jsx(Lr,{title:"Toolbox Management",description:"Create and manage resource kits for agents",children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs(Ye,{children:[r.jsx(Gt,{className:"pb-2",children:r.jsx(Zt,{className:"text-sm font-medium text-muted-foreground",children:"Total Kits"})}),r.jsx(tt,{children:r.jsx("div",{className:"text-2xl font-bold",children:(L==null?void 0:L.length)||0})})]}),r.jsxs(Ye,{children:[r.jsx(Gt,{className:"pb-2",children:r.jsx(Zt,{className:"text-sm font-medium text-muted-foreground",children:"Published"})}),r.jsx(tt,{children:r.jsx("div",{className:"text-2xl font-bold",children:(L==null?void 0:L.filter(Le=>Le.is_published).length)||0})})]})]}),r.jsxs(ee,{onClick:()=>{H(),a(!0)},children:[r.jsx(bn,{className:"h-4 w-4 mr-2"}),"Add Resource Kit"]})]}),r.jsx(Ye,{children:r.jsx(tt,{className:"p-0",children:r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Ar,{children:[r.jsx(It,{children:"Name"}),r.jsx(It,{children:"Files"}),r.jsx(It,{children:"Publish Date"}),r.jsx(It,{children:"Status"}),r.jsx(It,{className:"text-right",children:"Actions"})]})}),r.jsx(Vs,{children:z?r.jsx(Ar,{children:r.jsx(Nt,{colSpan:5,className:"text-center py-8",children:"Loading..."})}):(L==null?void 0:L.length)===0?r.jsx(Ar,{children:r.jsx(Nt,{colSpan:5,className:"text-center py-8 text-muted-foreground",children:"No resource kits yet. Create your first one!"})}):L==null?void 0:L.map(Le=>r.jsxs(Ar,{children:[r.jsx(Nt,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[Le.featured_image_url?r.jsx("img",{src:Le.featured_image_url,alt:Le.name,className:"w-10 h-10 rounded object-cover"}):r.jsx("div",{className:"w-10 h-10 rounded bg-muted flex items-center justify-center",children:r.jsx(zl,{className:"h-5 w-5 text-muted-foreground"})}),r.jsxs("div",{children:[r.jsx("div",{className:"font-medium",children:Le.name}),Le.description&&r.jsx("div",{className:"text-sm text-muted-foreground line-clamp-1",children:Le.description})]})]})}),r.jsx(Nt,{children:r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(La,{className:"h-4 w-4 text-muted-foreground"}),Ae(Le.id)]})}),r.jsx(Nt,{children:yn(new Date(Le.publish_date),"MMM d, yyyy")}),r.jsx(Nt,{children:r.jsx("span",{className:`inline-flex items-center px-2 py-1 rounded-full text-xs font-medium ${Le.is_published?"bg-green-100 text-green-800":"bg-yellow-100 text-yellow-800"}`,children:Le.is_published?"Published":"Draft"})}),r.jsx(Nt,{className:"text-right",children:r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>{const Ne=(F==null?void 0:F.filter(Ee=>Ee.kit_id===Le.id))||[],Be=(q==null?void 0:q.filter(Ee=>Ee.kit_id===Le.id))||[];T({...Le,files:Ne,links:Be})},children:r.jsx(Qo,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>Z(Le),children:r.jsx(_i,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>{confirm("Delete this resource kit?")&&ue.mutate(Le.id)},children:r.jsx(Vn,{className:"h-4 w-4 text-destructive"})})]})})]},Le.id))})]})})}),r.jsx(Fr,{open:s,onOpenChange:a,children:r.jsxs(Rr,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsx(qr,{children:r.jsx($r,{children:o?"Edit Resource Kit":"Add Resource Kit"})}),r.jsxs("form",{onSubmit:_e,className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Featured Image"}),r.jsxs("div",{className:"flex items-center gap-4",children:[y?r.jsx("img",{src:y,alt:"Preview",className:"w-24 h-24 rounded object-cover"}):r.jsx("div",{className:"w-24 h-24 rounded bg-muted flex items-center justify-center",children:r.jsx(zl,{className:"h-8 w-8 text-muted-foreground"})}),r.jsx(dt,{type:"file",accept:"image/*",onChange:G})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"name",children:"Name *"}),r.jsx(dt,{id:"name",value:i.name,onChange:Le=>h({...i,name:Le.target.value}),placeholder:"Resource Kit Name"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Description"}),r.jsx(fy,{content:i.description,onChange:Le=>h({...i,description:Le}),placeholder:"Brief description of this resource kit",minHeight:"120px"})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"publish_date",children:"Publish Date"}),r.jsx(dt,{id:"publish_date",type:"date",value:i.publish_date,onChange:Le=>h({...i,publish_date:Le.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Published"}),r.jsxs("div",{className:"flex items-center space-x-2 pt-2",children:[r.jsx(Ps,{checked:i.is_published,onCheckedChange:Le=>h({...i,is_published:Le})}),r.jsx("span",{className:"text-sm text-muted-foreground",children:i.is_published?"Visible to agents":"Hidden from agents"})]})]})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsx(He,{children:"Resource Files"}),r.jsxs(ee,{type:"button",variant:"outline",size:"sm",onClick:te,children:[r.jsx(bn,{className:"h-4 w-4 mr-1"}),"Add File"]})]}),j.length===0?r.jsx("div",{className:"text-sm text-muted-foreground py-4 text-center border rounded-md border-dashed",children:'No files added yet. Click "Add File" to include resources.'}):r.jsx("div",{className:"space-y-3",children:j.map((Le,Ne)=>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 ",Ne+1]}),r.jsx(ee,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>ie(Ne),children:r.jsx(_s,{className:"h-4 w-4"})})]}),r.jsx(dt,{placeholder:"File name (e.g., Getting Started Guide)",value:Le.name,onChange:Be=>le(Ne,"name",Be.target.value)}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(dt,{type:"file",onChange:Be=>ae(Ne,Be),className:"flex-1"}),Le.file_url&&!Le.file&&r.jsx("a",{href:Le.file_url,target:"_blank",rel:"noopener noreferrer",className:"text-sm text-primary hover:underline whitespace-nowrap",children:"Current file"}),Le.file&&r.jsx("span",{className:"text-sm text-green-600 whitespace-nowrap",children:"New file selected"})]})]},Ne))})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsx(He,{children:"Canva Links"}),r.jsxs(ee,{type:"button",variant:"outline",size:"sm",onClick:ye,children:[r.jsx(bn,{className:"h-4 w-4 mr-1"}),"Add Canva Link"]})]}),N.length===0?r.jsx("div",{className:"text-sm text-muted-foreground py-4 text-center border rounded-md border-dashed",children:'No Canva links added yet. Click "Add Canva Link" to include templates.'}):r.jsx("div",{className:"space-y-3",children:N.map((Le,Ne)=>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 ",Ne+1]}),r.jsx(ee,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>ne(Ne),children:r.jsx(_s,{className:"h-4 w-4"})})]}),r.jsx(dt,{placeholder:"Link title (e.g., Social Media Post Template)",value:Le.title,onChange:Be=>ge(Ne,"title",Be.target.value)}),r.jsx(dt,{placeholder:"Canva share link (e.g., https://www.canva.com/design/...)",value:Le.canva_share_link,onChange:Be=>ge(Ne,"canva_share_link",Be.target.value)})]},Ne))})]}),r.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[r.jsx(ee,{type:"button",variant:"outline",onClick:()=>a(!1),children:"Cancel"}),r.jsx(ee,{type:"submit",disabled:he.isPending,children:he.isPending?"Saving...":o?"Update":"Create"})]})]})]})}),r.jsx(Fr,{open:!!E,onOpenChange:()=>T(null),children:r.jsxs(Rr,{className:"max-w-lg",children:[r.jsx(qr,{children:r.jsx($r,{children:E==null?void 0:E.name})}),r.jsxs("div",{className:"space-y-4",children:[(E==null?void 0:E.featured_image_url)&&r.jsx("img",{src:E.featured_image_url,alt:E.name,className:"w-full h-48 object-cover rounded-lg"}),(E==null?void 0:E.description)&&r.jsx("p",{className:"text-muted-foreground",children:E.description}),r.jsxs("div",{children:[r.jsxs("h4",{className:"font-medium mb-2",children:["Resource Files (",((Ce=E==null?void 0:E.files)==null?void 0:Ce.length)||0,")"]}),((be=E==null?void 0:E.files)==null?void 0:be.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:(me=E==null?void 0:E.files)==null?void 0:me.map(Le=>r.jsxs("a",{href:Le.file_url,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 p-2 rounded-md hover:bg-muted transition-colors",children:[r.jsx(La,{className:"h-4 w-4 text-primary"}),r.jsx("span",{className:"text-sm",children:Le.name})]},Le.id))})]}),(E==null?void 0:E.links)&&E.links.length>0&&r.jsxs("div",{children:[r.jsxs("h4",{className:"font-medium mb-2",children:["Canva Links (",E.links.length,")"]}),r.jsx("div",{className:"space-y-2",children:E.links.map(Le=>r.jsxs("a",{href:Le.canva_share_link,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 p-2 rounded-md hover:bg-muted transition-colors",children:[r.jsx(Co,{className:"h-4 w-4 text-primary"}),r.jsx("span",{className:"text-sm",children:Le.title})]},Le.id))})]})]})]})})]})})}const awt=()=>{const{user:t}=Qr(),{toast:e}=fi(),n=Vr(),[s,a]=I.useState(!1),[o,l]=I.useState(null),[i,h]=I.useState({title:"",description:"",publish_date:new Date().toISOString().split("T")[0],is_published:!1,links:[{title:"",canva_share_link:"",sort_order:0}]}),[p,x]=I.useState(null),[y,b]=I.useState(""),{data:j=[],isLoading:C}=Yt({queryKey:["social-swag-admin"],queryFn:async()=>{const{data:Z,error:G}=await J.from("social_swag").select("*").order("publish_date",{ascending:!1});if(G)throw G;const{data:te,error:ie}=await J.from("social_swag_links").select("*").order("sort_order");if(ie)throw ie;return Z.map(ye=>({...ye,links:(te==null?void 0:te.filter(ne=>ne.swag_id===ye.id))||[]}))}}),N=cr({mutationFn:async Z=>{let G=Z.existingImageUrl;if(Z.image){const ge=Z.image.name.split(".").pop(),ae=`${Date.now()}-${Math.random().toString(36).substring(7)}.${ge}`,{error:he}=await J.storage.from("template-previews").upload(ae,Z.image);if(he)throw he;const{data:ue}=J.storage.from("template-previews").getPublicUrl(ae);G=ue.publicUrl}const te={title:Z.item.title,description:Z.item.description||null,preview_image_url:G,publish_date:Z.item.publish_date?new Date(Z.item.publish_date).toISOString():new Date().toISOString(),is_published:Z.item.is_published,created_by:t==null?void 0:t.id};let ie=Z.itemId;const le=!ie,ye=(o==null?void 0:o.is_published)||!1;if(ie){const{error:ge}=await J.from("social_swag").update(te).eq("id",ie);if(ge)throw ge;await J.from("social_swag_links").delete().eq("swag_id",ie)}else{const{data:ge,error:ae}=await J.from("social_swag").insert(te).select().single();if(ae)throw ae;ie=ge.id}const ne=Z.item.links.filter(ge=>ge.title.trim()&&ge.canva_share_link.trim());if(ne.length>0){const ge=ne.map((he,ue)=>({swag_id:ie,title:he.title.trim(),canva_share_link:he.canva_share_link.trim(),sort_order:ue})),{error:ae}=await J.from("social_swag_links").insert(ge);if(ae)throw ae}return{itemId:ie,itemTitle:Z.item.title,isNewItem:le,wasPublished:ye,isPublished:Z.item.is_published}},onSuccess:Z=>{n.invalidateQueries({queryKey:["social-swag-admin"]}),n.invalidateQueries({queryKey:["social-swag"]}),e({title:o?"Item updated":"Item created"}),Z.isPublished&&(Z.isNewItem||!Z.wasPublished)&&sfe(Z.itemTitle,Z.itemId),a(!1),E()},onError:Z=>{e({title:"Error saving item",description:Z.message,variant:"destructive"})}}),A=cr({mutationFn:async Z=>{const{error:G}=await J.from("social_swag").delete().eq("id",Z);if(G)throw G},onSuccess:()=>{n.invalidateQueries({queryKey:["social-swag-admin"]}),n.invalidateQueries({queryKey:["social-swag"]}),e({title:"Item deleted"})},onError:Z=>{e({title:"Error deleting item",description:Z.message,variant:"destructive"})}}),E=()=>{h({title:"",description:"",publish_date:new Date().toISOString().split("T")[0],is_published:!1,links:[{title:"",canva_share_link:"",sort_order:0}]}),x(null),b(""),l(null)},T=Z=>{l(Z),h({title:Z.title,description:Z.description||"",publish_date:Z.publish_date?new Date(Z.publish_date).toISOString().split("T")[0]:new Date().toISOString().split("T")[0],is_published:Z.is_published,links:Z.links&&Z.links.length>0?Z.links.map(G=>({id:G.id,title:G.title,canva_share_link:G.canva_share_link,sort_order:G.sort_order})):[{title:"",canva_share_link:"",sort_order:0}]}),b(Z.preview_image_url||""),a(!0)},L=Z=>{var te;const G=(te=Z.target.files)==null?void 0:te[0];G&&(x(G),b(URL.createObjectURL(G)))},z=()=>{h({...i,links:[...i.links,{title:"",canva_share_link:"",sort_order:i.links.length}]})},F=Z=>{if(i.links.length<=1)return;const G=i.links.filter((te,ie)=>ie!==Z);h({...i,links:G})},q=(Z,G,te)=>{const ie=[...i.links];ie[Z]={...ie[Z],[G]:te},h({...i,links:ie})},H=Z=>{if(Z.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(Gu,{title:"Manage Social Swag",description:"Create and manage social media content"}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs(Ye,{children:[r.jsx(Gt,{className:"pb-2",children:r.jsx(Zt,{className:"text-sm font-medium text-muted-foreground",children:"Total Items"})}),r.jsx(tt,{children:r.jsx("div",{className:"text-2xl font-bold",children:j.length})})]}),r.jsxs(Ye,{children:[r.jsx(Gt,{className:"pb-2",children:r.jsx(Zt,{className:"text-sm font-medium text-muted-foreground",children:"Published"})}),r.jsx(tt,{children:r.jsx("div",{className:"text-2xl font-bold",children:j.filter(Z=>Z.is_published).length})})]})]}),r.jsxs(Fr,{open:s,onOpenChange:Z=>{a(Z),Z||E()},children:[r.jsx(zo,{asChild:!0,children:r.jsxs(ee,{className:"gap-2",children:[r.jsx(bn,{className:"h-4 w-4"}),"Add Item"]})}),r.jsxs(Rr,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsx(qr,{children:r.jsx($r,{children:o?"Edit Item":"Add New Item"})}),r.jsxs("form",{onSubmit:H,className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"title",children:"Title *"}),r.jsx(dt,{id:"title",value:i.title,onChange:Z=>h({...i,title:Z.target.value}),placeholder:"Enter title"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Description"}),r.jsx(fy,{content:i.description,onChange:Z=>h({...i,description:Z}),placeholder:"Enter description",minHeight:"120px"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"publish_date",children:"Publish Date"}),r.jsx(dt,{id:"publish_date",type:"date",value:i.publish_date,onChange:Z=>h({...i,publish_date:Z.target.value})})]}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(Ps,{id:"is_published",checked:i.is_published,onCheckedChange:Z=>h({...i,is_published:Z})}),r.jsx(He,{htmlFor:"is_published",children:"Published"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Preview Image"}),y?r.jsxs("div",{className:"relative",children:[r.jsx("img",{src:y,alt:"Preview",className:"w-full max-h-48 object-contain rounded-lg border"}),r.jsx(ee,{type:"button",variant:"destructive",size:"icon",className:"absolute top-2 right-2 h-6 w-6",onClick:()=>{x(null),b("")},children:r.jsx(_s,{className:"h-3 w-3"})})]}):r.jsxs("div",{className:"border-2 border-dashed rounded-lg p-4 text-center",children:[r.jsx(Pl,{className:"h-8 w-8 mx-auto text-muted-foreground mb-2"}),r.jsx(dt,{type:"file",accept:"image/*",onChange:L,className:"cursor-pointer"})]})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(He,{children:"Canva Links"}),r.jsxs(ee,{type:"button",variant:"outline",size:"sm",onClick:z,children:[r.jsx(bn,{className:"h-3 w-3 mr-1"}),"Add Link"]})]}),i.links.map((Z,G)=>r.jsx(Ye,{children:r.jsxs(tt,{className:"pt-4 pb-4 space-y-3",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs("span",{className:"text-sm font-medium text-muted-foreground",children:["Link ",G+1]}),i.links.length>1&&r.jsx(ee,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6 ml-auto",onClick:()=>F(G),children:r.jsx(_s,{className:"h-3 w-3"})})]}),r.jsx(dt,{placeholder:"Link title (e.g., Instagram Post)",value:Z.title,onChange:te=>q(G,"title",te.target.value)}),r.jsx(dt,{placeholder:"Canva share link",value:Z.canva_share_link,onChange:te=>q(G,"canva_share_link",te.target.value)})]})},G))]}),r.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[r.jsx(ee,{type:"button",variant:"outline",onClick:()=>a(!1),children:"Cancel"}),r.jsx(ee,{type:"submit",disabled:N.isPending,children:N.isPending?"Saving...":o?"Update":"Create"})]})]})]})]})]}),r.jsx(Ye,{children:r.jsx(tt,{className:"p-0",children:C?r.jsx("div",{className:"flex justify-center py-8",children:r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})}):j.length===0?r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'No items yet. Click "Add Item" to create your first one.'}):r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Ar,{children:[r.jsx(It,{className:"w-16",children:"Preview"}),r.jsx(It,{children:"Title"}),r.jsx(It,{children:"Links"}),r.jsx(It,{children:"Publish Date"}),r.jsx(It,{children:"Status"}),r.jsx(It,{className:"text-right",children:"Actions"})]})}),r.jsx(Vs,{children:j.map(Z=>{var G;return r.jsxs(Ar,{children:[r.jsx(Nt,{children:Z.preview_image_url?r.jsx("img",{src:Z.preview_image_url,alt:"",className:"w-12 h-12 object-cover rounded"}):r.jsx("div",{className:"w-12 h-12 bg-muted rounded flex items-center justify-center",children:r.jsx(Pl,{className:"h-4 w-4 text-muted-foreground"})})}),r.jsx(Nt,{className:"font-medium",children:Z.title}),r.jsxs(Nt,{children:[((G=Z.links)==null?void 0:G.length)||0," links"]}),r.jsx(Nt,{children:new Date(Z.publish_date).toLocaleDateString()}),r.jsx(Nt,{children:r.jsx(Ot,{variant:Z.is_published?"default":"secondary",children:Z.is_published?"Published":"Draft"})}),r.jsx(Nt,{className:"text-right",children:r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>window.open(`/social-swag/${Z.id}`,"_blank"),children:r.jsx(Qo,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>T(Z),children:r.jsx(_i,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>{confirm("Are you sure you want to delete this item?")&&A.mutate(Z.id)},children:r.jsx(Vn,{className:"h-4 w-4"})})]})})]},Z.id)})})]})})})]})})},iwt=()=>{const t=Vr(),[e,n]=I.useState("all"),[s,a]=I.useState(!1),[o,l]=I.useState(yn(new Date,"yyyy-MM")),[i,h]=I.useState([]),[p,x]=I.useState(!1),[y,b]=I.useState(null),[j,C]=I.useState(!1),[N,A]=I.useState(yn(new Date,"yyyy-MM")),[E,T]=I.useState(null),[L,z]=I.useState(""),[F,q]=I.useState(""),[H,Z]=I.useState(""),[G,te]=I.useState(!1),{data:ie=[],isLoading:le}=Yt({queryKey:["admin-social-swag-2"],queryFn:async()=>{const{data:je,error:et}=await J.from("social_swag_2").select("*").order("month",{ascending:!1}).order("sort_order");if(et)throw et;return je}}),{data:ye=[]}=Yt({queryKey:["admin-social-swag-2-months"],queryFn:async()=>{const{data:je,error:et}=await J.from("social_swag_2_months").select("*").order("month",{ascending:!1});if(et)throw et;return je}}),{data:ne=[]}=Yt({queryKey:["admin-social-swag-2-reels"],queryFn:async()=>{const{data:je,error:et}=await J.from("social_swag_2_reels").select("*").order("month",{ascending:!1});if(et)throw et;return je}}),ge=[...new Set(ie.map(je=>je.month))].sort((je,et)=>et.localeCompare(je)),ae=e==="all"?ie:ie.filter(je=>je.month===e),he=je=>{const et=oxe(je,"yyyy-MM",new Date);return yn(et,"MMMM yyyy")},ue=je=>{const Te=Array.from(je.target.files||[]).slice(0,16-i.length).map(Ze=>({file:Ze,preview:URL.createObjectURL(Ze),caption:""}));h(Ze=>[...Ze,...Te].slice(0,16))},_e=je=>{h(et=>{const Te=[...et];return URL.revokeObjectURL(Te[je].preview),Te.splice(je,1),Te})},Ae=(je,et)=>{h(Te=>{const Ze=[...Te];return Ze[je]={...Ze[je],caption:et},Ze})},Ce=async()=>{if(i.length===0){ze.error("Please add at least one image");return}if(i.filter(et=>!et.caption.trim()).length>0){ze.error("Please add captions to all images");return}x(!0);try{for(let et=0;et{const et=je.image_url.split("/social-swag-2/");et[1]&&await J.storage.from("social-swag-2").remove([et[1]]);const{error:Te}=await J.from("social_swag_2").delete().eq("id",je.id);if(Te)throw Te},onSuccess:()=>{ze.success("Image deleted"),t.invalidateQueries({queryKey:["admin-social-swag-2"]})},onError:()=>{ze.error("Failed to delete image")}}),me=cr({mutationFn:async({month:je,link:et})=>{const{error:Te}=await J.from("social_swag_2_months").upsert({month:je,canva_link:et||null},{onConflict:"month"});if(Te)throw Te},onSuccess:()=>{ze.success("Canva link updated"),b(null),t.invalidateQueries({queryKey:["admin-social-swag-2-months"]})},onError:()=>{ze.error("Failed to update Canva link")}}),Le=je=>{var et;return((et=ye.find(Te=>Te.month===je))==null?void 0:et.canva_link)||""},Ne=je=>ne.find(et=>et.month===je)||null,Be=je=>{var Te;const et=(Te=je.target.files)==null?void 0:Te[0];et&&(T(et),z(URL.createObjectURL(et)))},Ee=()=>{L&&URL.revokeObjectURL(L),T(null),z(""),q(""),Z("")},Ue=async()=>{if(!E){ze.error("Please select an image");return}te(!0);try{const je=E.name.split(".").pop(),et=`reels/${N}-${Date.now()}.${je}`,{error:Te}=await J.storage.from("social-swag-2").upload(et,E);if(Te)throw Te;const{data:{publicUrl:Ze}}=J.storage.from("social-swag-2").getPublicUrl(et),{error:pe}=await J.from("social_swag_2_reels").upsert({month:N,image_url:Ze,canva_link:H||null,caption:F||null},{onConflict:"month"});if(pe)throw pe;ze.success("Reel uploaded successfully!"),sfe(`${he(N)} Reel`,"social-swag-2"),Ee(),C(!1),t.invalidateQueries({queryKey:["admin-social-swag-2-reels"]})}catch(je){console.error("Reel upload error:",je),ze.error("Failed to upload reel")}finally{te(!1)}},Re=cr({mutationFn:async je=>{const et=je.image_url.split("/social-swag-2/");et[1]&&await J.storage.from("social-swag-2").remove([et[1]]);const{error:Te}=await J.from("social_swag_2_reels").delete().eq("id",je.id);if(Te)throw Te},onSuccess:()=>{ze.success("Reel deleted"),t.invalidateQueries({queryKey:["admin-social-swag-2-reels"]})},onError:()=>{ze.error("Failed to delete reel")}});return r.jsx(Lr,{title:"Admin - Social Swag 2.0",children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold",children:"Social Swag 2.0"}),r.jsx("p",{className:"text-muted-foreground",children:"Manage monthly social media images and captions"})]}),r.jsxs(Fr,{open:s,onOpenChange:a,children:[r.jsx(zo,{asChild:!0,children:r.jsxs(ee,{className:"gap-2",children:[r.jsx(bn,{className:"h-4 w-4"}),"Upload Images"]})}),r.jsxs(Rr,{className:"max-w-4xl max-h-[90vh] overflow-y-auto",children:[r.jsx(qr,{children:r.jsx($r,{children:"Upload Social Swag Images"})}),r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Month"}),r.jsx(dt,{type:"month",value:o,onChange:je=>l(je.target.value)})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs(He,{children:["Images (",i.length,"/16)"]}),r.jsxs("div",{className:"border-2 border-dashed rounded-lg p-6 text-center",children:[r.jsx("input",{type:"file",accept:"image/*",multiple:!0,onChange:ue,className:"hidden",id:"swag-upload",disabled:i.length>=16}),r.jsxs("label",{htmlFor:"swag-upload",className:"cursor-pointer",children:[r.jsx(uo,{className:"h-8 w-8 mx-auto text-muted-foreground mb-2"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Click to select images (max 16)"})]})]})]}),i.length>0&&r.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:i.map((je,et)=>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:je.preview,alt:`Upload ${et+1}`,className:"w-full h-full object-cover"}),r.jsx(ee,{variant:"destructive",size:"icon",className:"absolute top-1 right-1 h-6 w-6",onClick:()=>_e(et),children:r.jsx(_s,{className:"h-3 w-3"})})]}),r.jsx(ps,{placeholder:"Caption...",value:je.caption,onChange:Te=>Ae(et,Te.target.value),className:"text-xs h-20"})]},et))}),r.jsx(ee,{onClick:Ce,disabled:p||i.length===0,className:"w-full gap-2",children:p?r.jsxs(r.Fragment,{children:[r.jsx(en,{className:"h-4 w-4 animate-spin"}),"Uploading..."]}):r.jsxs(r.Fragment,{children:[r.jsx(uo,{className:"h-4 w-4"}),"Upload ",i.length," Images"]})})]})]})]}),r.jsxs(Fr,{open:j,onOpenChange:je=>{C(je),je||Ee()},children:[r.jsx(zo,{asChild:!0,children:r.jsxs(ee,{variant:"outline",className:"gap-2",children:[r.jsx(Ad,{className:"h-4 w-4"}),"Upload Reel"]})}),r.jsxs(Rr,{className:"max-w-lg max-h-[85vh] overflow-y-auto",children:[r.jsx(qr,{children:r.jsx($r,{children:"Upload Monthly Reel"})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Month"}),r.jsx(dt,{type:"month",value:N,onChange:je=>A(je.target.value)})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Reel Preview Image"}),L?r.jsxs("div",{className:"relative aspect-[9/16] max-w-[120px] mx-auto rounded-lg overflow-hidden bg-muted",children:[r.jsx("img",{src:L,alt:"Reel preview",className:"w-full h-full object-cover"}),r.jsx(ee,{variant:"destructive",size:"icon",className:"absolute top-2 right-2 h-6 w-6",onClick:()=>{URL.revokeObjectURL(L),T(null),z("")},children:r.jsx(_s,{className:"h-3 w-3"})})]}):r.jsxs("div",{className:"border-2 border-dashed rounded-lg p-6 text-center",children:[r.jsx("input",{type:"file",accept:"image/*",onChange:Be,className:"hidden",id:"reel-upload"}),r.jsxs("label",{htmlFor:"reel-upload",className:"cursor-pointer",children:[r.jsx(Ad,{className:"h-8 w-8 mx-auto text-muted-foreground mb-2"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Click to select reel preview image"})]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Canva Download Link"}),r.jsx(dt,{value:H,onChange:je=>Z(je.target.value),placeholder:"https://www.canva.com/..."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Caption"}),r.jsx(ps,{value:F,onChange:je=>q(je.target.value),placeholder:"Enter caption for this reel...",className:"h-24"})]}),r.jsx(ee,{onClick:Ue,disabled:G||!E,className:"w-full gap-2",children:G?r.jsxs(r.Fragment,{children:[r.jsx(en,{className:"h-4 w-4 animate-spin"}),"Uploading..."]}):r.jsxs(r.Fragment,{children:[r.jsx(uo,{className:"h-4 w-4"}),"Upload Reel"]})})]})]})]})]}),r.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[r.jsx(Ye,{children:r.jsxs(tt,{className:"p-4",children:[r.jsx("div",{className:"text-2xl font-bold",children:ie.length}),r.jsx("div",{className:"text-sm text-muted-foreground",children:"Total Images"})]})}),r.jsx(Ye,{children:r.jsxs(tt,{className:"p-4",children:[r.jsx("div",{className:"text-2xl font-bold",children:ge.length}),r.jsx("div",{className:"text-sm text-muted-foreground",children:"Months"})]})})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsx(Ii,{value:e,onValueChange:n,children:r.jsxs(wi,{children:[r.jsx(ln,{value:"all",children:"All"}),ge.map(je=>r.jsx(ln,{value:je,children:he(je)},je))]})}),e!=="all"&&r.jsx(Ye,{children:r.jsx(tt,{className:"p-4",children:r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx(Co,{className:"h-4 w-4 text-muted-foreground"}),r.jsxs("div",{className:"flex-1",children:[r.jsxs(He,{className:"text-sm text-muted-foreground",children:["Canva Edit Link for ",he(e)]}),(y==null?void 0:y.month)===e?r.jsxs("div",{className:"flex gap-2 mt-1",children:[r.jsx(dt,{value:y.link,onChange:je=>b({...y,link:je.target.value}),placeholder:"https://www.canva.com/..."}),r.jsx(ee,{size:"sm",onClick:()=>me.mutate(y),children:"Save"}),r.jsx(ee,{size:"sm",variant:"outline",onClick:()=>b(null),children:"Cancel"})]}):r.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[r.jsx("span",{className:"text-sm",children:Le(e)||"No link set"}),r.jsx(ee,{size:"sm",variant:"outline",onClick:()=>b({month:e,link:Le(e)}),children:"Edit"})]})]})]})})}),e!=="all"&&r.jsx(Ye,{children:r.jsx(tt,{className:"p-4",children:r.jsxs("div",{className:"flex items-start gap-4",children:[r.jsx(Ad,{className:"h-4 w-4 text-muted-foreground mt-1"}),r.jsxs("div",{className:"flex-1",children:[r.jsxs(He,{className:"text-sm text-muted-foreground",children:["Reel for ",he(e)]}),(()=>{const je=Ne(e);return je?r.jsxs("div",{className:"flex items-center gap-4 mt-2",children:[r.jsx("img",{src:je.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:je.caption||"No caption"}),je.canva_link&&r.jsx("a",{href:je.canva_link,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline text-xs",children:"View Canva Link"})]}),r.jsx(ee,{variant:"destructive",size:"sm",onClick:()=>Re.mutate(je),children:r.jsx(Vn,{className:"h-4 w-4"})})]}):r.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"No reel uploaded for this month"})})()]})]})})})]}),le?r.jsx("div",{className:"text-center py-12 text-muted-foreground",children:"Loading..."}):ae.length===0?r.jsxs("div",{className:"text-center py-12",children:[r.jsx(Pl,{className:"h-12 w-12 mx-auto text-muted-foreground/50 mb-4"}),r.jsx("p",{className:"text-muted-foreground",children:"No images yet. Upload some!"})]}):r.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 lg:grid-cols-6 gap-4",children:ae.map(je=>r.jsxs(Ye,{className:"overflow-hidden",children:[r.jsxs("div",{className:"relative aspect-[4/5]",children:[r.jsx("img",{src:je.image_url,alt:"Social swag",className:"w-full h-full object-cover"}),r.jsx(ee,{variant:"destructive",size:"icon",className:"absolute top-2 right-2 h-8 w-8",onClick:()=>be.mutate(je),children:r.jsx(Vn,{className:"h-4 w-4"})})]}),r.jsx(tt,{className:"p-3",children:r.jsx("p",{className:"text-xs text-muted-foreground line-clamp-3",children:je.caption})})]},je.id))})]})})},owt=()=>{const{toast:t}=fi(),e=Vr(),[n,s]=I.useState("categories"),[a,o]=I.useState(!1),[l,i]=I.useState(null),[h,p]=I.useState({name:"",description:"",icon:""}),[x,y]=I.useState(!1),[b,j]=I.useState(null),[C,N]=I.useState({name:"",description:"",icon:""}),[A,E]=I.useState(!1),[T,L]=I.useState(null),[z,F]=I.useState(""),{data:q=[],isLoading:H}=Yt({queryKey:["admin-community-categories"],queryFn:async()=>{const{data:Re,error:je}=await J.from("community_categories").select("*").order("sort_order");if(je)throw je;return Re}}),{data:Z=[],isLoading:G}=Yt({queryKey:["admin-private-groups"],queryFn:async()=>{const{data:Re,error:je}=await J.from("community_private_groups").select("*").order("sort_order");if(je)throw je;return Re}}),{data:te=[]}=Yt({queryKey:["admin-group-members",T==null?void 0:T.id],queryFn:async()=>{if(!T)return[];const{data:Re,error:je}=await J.from("community_private_group_members").select("*").eq("group_id",T.id);if(je)throw je;return Re},enabled:!!T}),{data:ie=[]}=Yt({queryKey:["admin-all-profiles"],queryFn:async()=>{let je=[],et=0,Te=!0;for(;Te;){const{data:Ze,error:pe}=await J.from("profiles").select("id, name, email, brokerage_id").order("name").range(et,et+1e3-1);if(pe)throw pe;Ze&&Ze.length>0?(je=[...je,...Ze],et+=1e3,Te=Ze.length===1e3):Te=!1}return je}}),{data:le=[]}=Yt({queryKey:["admin-all-brokerages"],queryFn:async()=>{const{data:Re,error:je}=await J.from("brokerages").select("*").order("name");if(je)throw je;return Re}}),ye=cr({mutationFn:async Re=>{if(Re.id){const{error:je}=await J.from("community_categories").update({name:Re.name,description:Re.description||null,icon:Re.icon||null}).eq("id",Re.id);if(je)throw je}else{const je=Math.max(...q.map(Te=>Te.sort_order),0),{error:et}=await J.from("community_categories").insert({name:Re.name,description:Re.description||null,icon:Re.icon||null,sort_order:je+1});if(et)throw et}},onSuccess:()=>{e.invalidateQueries({queryKey:["admin-community-categories"]}),o(!1),i(null),p({name:"",description:"",icon:""}),t({title:l?"Category updated!":"Category created!"})},onError:Re=>{t({title:"Error",description:Re.message,variant:"destructive"})}}),ne=cr({mutationFn:async Re=>{const{error:je}=await J.from("community_categories").delete().eq("id",Re);if(je)throw je},onSuccess:()=>{e.invalidateQueries({queryKey:["admin-community-categories"]}),t({title:"Category deleted"})}}),ge=cr({mutationFn:async({id:Re,direction:je})=>{const et=q.findIndex(Te=>Te.id===Re);if(je==="up"&&et>0){const Te=q[et-1],Ze=q[et];await J.from("community_categories").update({sort_order:Ze.sort_order}).eq("id",Te.id),await J.from("community_categories").update({sort_order:Te.sort_order}).eq("id",Ze.id)}else if(je==="down"&&ete.invalidateQueries({queryKey:["admin-community-categories"]})}),ae=cr({mutationFn:async Re=>{if(Re.id){const{error:je}=await J.from("community_private_groups").update({name:Re.name,description:Re.description||null,icon:Re.icon||null}).eq("id",Re.id);if(je)throw je}else{const je=Math.max(...Z.map(Te=>Te.sort_order),0),{error:et}=await J.from("community_private_groups").insert({name:Re.name,description:Re.description||null,icon:Re.icon||null,sort_order:je+1});if(et)throw et}},onSuccess:()=>{e.invalidateQueries({queryKey:["admin-private-groups"]}),y(!1),j(null),N({name:"",description:"",icon:""}),t({title:b?"Private group updated!":"Private group created!"})},onError:Re=>{t({title:"Error",description:Re.message,variant:"destructive"})}}),he=cr({mutationFn:async Re=>{const{error:je}=await J.from("community_private_groups").delete().eq("id",Re);if(je)throw je},onSuccess:()=>{e.invalidateQueries({queryKey:["admin-private-groups"]}),t({title:"Private group deleted"})}}),ue=cr({mutationFn:async({id:Re,direction:je})=>{const et=Z.findIndex(Te=>Te.id===Re);if(je==="up"&&et>0){const Te=Z[et-1],Ze=Z[et];await J.from("community_private_groups").update({sort_order:Ze.sort_order}).eq("id",Te.id),await J.from("community_private_groups").update({sort_order:Te.sort_order}).eq("id",Ze.id)}else if(je==="down"&&ete.invalidateQueries({queryKey:["admin-private-groups"]})}),_e=cr({mutationFn:async({groupId:Re,userId:je,isMember:et})=>{if(et){const{error:Te}=await J.from("community_private_group_members").delete().eq("group_id",Re).eq("user_id",je);if(Te)throw Te}else{const{error:Te}=await J.from("community_private_group_members").insert({group_id:Re,user_id:je});if(Te)throw Te}},onSuccess:()=>{e.invalidateQueries({queryKey:["admin-group-members",T==null?void 0:T.id]})}}),Ae=cr({mutationFn:async({groupId:Re,brokerageId:je,isMember:et})=>{if(et){const{error:Te}=await J.from("community_private_group_members").delete().eq("group_id",Re).eq("brokerage_id",je);if(Te)throw Te}else{const{error:Te}=await J.from("community_private_group_members").insert({group_id:Re,brokerage_id:je});if(Te)throw Te}},onSuccess:()=>{e.invalidateQueries({queryKey:["admin-group-members",T==null?void 0:T.id]})}}),Ce=Re=>{i(Re),p({name:Re.name,description:Re.description||"",icon:Re.icon||""}),o(!0)},be=()=>{i(null),p({name:"",description:"",icon:""}),o(!0)},me=Re=>{j(Re),N({name:Re.name,description:Re.description||"",icon:Re.icon||""}),y(!0)},Le=()=>{j(null),N({name:"",description:"",icon:""}),y(!0)},Ne=Re=>{L(Re),F(""),E(!0)},Be=Re=>te.some(je=>je.user_id===Re),Ee=Re=>te.some(je=>je.brokerage_id===Re),Ue=ie.filter(Re=>Re.name.toLowerCase().includes(z.toLowerCase())||Re.email.toLowerCase().includes(z.toLowerCase()));return r.jsx(Lr,{title:"Community Management",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Gu,{title:"Community Management",description:"Manage categories and private groups for community discussions"}),r.jsxs(Ii,{value:n,onValueChange:s,children:[r.jsxs(wi,{children:[r.jsx(ln,{value:"categories",children:"Public Categories"}),r.jsxs(ln,{value:"private-groups",children:[r.jsx(Zf,{className:"h-4 w-4 mr-1"}),"Private Groups"]})]}),r.jsxs(An,{value:"categories",className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Categories visible to all community members"}),r.jsxs(ee,{onClick:be,children:[r.jsx(bn,{className:"h-4 w-4 mr-2"}),"Add Category"]})]}),r.jsx(Ye,{children:r.jsx(tt,{className:"pt-6",children:r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Ar,{children:[r.jsx(It,{className:"w-[50px]",children:"Order"}),r.jsx(It,{className:"w-[80px]",children:"Icon"}),r.jsx(It,{children:"Name"}),r.jsx(It,{children:"Description"}),r.jsx(It,{className:"w-[100px]",children:"Actions"})]})}),r.jsx(Vs,{children:H?r.jsx(Ar,{children:r.jsx(Nt,{colSpan:5,className:"text-center py-8",children:"Loading..."})}):q.length===0?r.jsx(Ar,{children:r.jsx(Nt,{colSpan:5,className:"text-center py-8 text-muted-foreground",children:"No categories yet. Create your first one!"})}):q.map((Re,je)=>r.jsxs(Ar,{children:[r.jsx(Nt,{children:r.jsxs("div",{className:"flex flex-col gap-1",children:[r.jsx(ee,{variant:"ghost",size:"icon",className:"h-6 w-6",disabled:je===0,onClick:()=>ge.mutate({id:Re.id,direction:"up"}),children:"↑"}),r.jsx(ee,{variant:"ghost",size:"icon",className:"h-6 w-6",disabled:je===q.length-1,onClick:()=>ge.mutate({id:Re.id,direction:"down"}),children:"↓"})]})}),r.jsx(Nt,{className:"text-2xl",children:Re.icon||"📁"}),r.jsx(Nt,{className:"font-medium",children:Re.name}),r.jsx(Nt,{className:"text-muted-foreground",children:Re.description||"—"}),r.jsx(Nt,{children:r.jsxs("div",{className:"flex gap-1",children:[r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>Ce(Re),children:r.jsx(_i,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"icon",className:"text-destructive",onClick:()=>{confirm("Delete this category? Posts will be uncategorized.")&&ne.mutate(Re.id)},children:r.jsx(Vn,{className:"h-4 w-4"})})]})})]},Re.id))})]})})})]}),r.jsxs(An,{value:"private-groups",className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Private groups visible only to assigned members or brokerages"}),r.jsxs("p",{className:"text-xs text-muted-foreground flex items-center gap-1",children:[r.jsx(ai,{className:"h-3 w-3"}),"Brokerage groups are created automatically and sync with brokerage names"]})]}),r.jsxs(ee,{onClick:Le,children:[r.jsx(bn,{className:"h-4 w-4 mr-2"}),"Add Private Group"]})]}),r.jsx(Ye,{children:r.jsx(tt,{className:"pt-6",children:r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Ar,{children:[r.jsx(It,{className:"w-[50px]",children:"Order"}),r.jsx(It,{className:"w-[80px]",children:"Icon"}),r.jsx(It,{children:"Name"}),r.jsx(It,{children:"Description"}),r.jsx(It,{className:"w-[120px]",children:"Members"}),r.jsx(It,{className:"w-[140px]",children:"Actions"})]})}),r.jsx(Vs,{children:G?r.jsx(Ar,{children:r.jsx(Nt,{colSpan:6,className:"text-center py-8",children:"Loading..."})}):Z.length===0?r.jsx(Ar,{children:r.jsx(Nt,{colSpan:6,className:"text-center py-8 text-muted-foreground",children:"No private groups yet. Create your first one!"})}):Z.map((Re,je)=>r.jsxs(Ar,{children:[r.jsx(Nt,{children:r.jsxs("div",{className:"flex flex-col gap-1",children:[r.jsx(ee,{variant:"ghost",size:"icon",className:"h-6 w-6",disabled:je===0,onClick:()=>ue.mutate({id:Re.id,direction:"up"}),children:"↑"}),r.jsx(ee,{variant:"ghost",size:"icon",className:"h-6 w-6",disabled:je===Z.length-1,onClick:()=>ue.mutate({id:Re.id,direction:"down"}),children:"↓"})]})}),r.jsx(Nt,{className:"text-2xl",children:Re.icon||"🔒"}),r.jsx(Nt,{className:"font-medium",children:r.jsxs("div",{className:"flex items-center gap-2",children:[Re.name,Re.brokerage_id?r.jsxs(Ot,{variant:"outline",className:"text-xs bg-blue-50 text-blue-700 border-blue-200",children:[r.jsx(ai,{className:"h-3 w-3 mr-1"}),"Auto-managed"]}):r.jsxs(Ot,{variant:"secondary",className:"text-xs",children:[r.jsx(Zf,{className:"h-3 w-3 mr-1"}),"Private"]})]})}),r.jsx(Nt,{className:"text-muted-foreground",children:Re.description||"—"}),r.jsx(Nt,{children:r.jsxs(ee,{variant:"outline",size:"sm",onClick:()=>Ne(Re),children:[r.jsx(Bn,{className:"h-4 w-4 mr-1"}),"Manage"]})}),r.jsx(Nt,{children:r.jsxs("div",{className:"flex gap-1",children:[!Re.brokerage_id&&r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>me(Re),children:r.jsx(_i,{className:"h-4 w-4"})}),!Re.brokerage_id&&r.jsx(ee,{variant:"ghost",size:"icon",className:"text-destructive",onClick:()=>{confirm("Delete this private group? All posts in this group will be deleted.")&&he.mutate(Re.id)},children:r.jsx(Vn,{className:"h-4 w-4"})}),Re.brokerage_id&&r.jsx("span",{className:"text-xs text-muted-foreground italic",children:"Managed via brokerage"})]})})]},Re.id))})]})})})]})]}),r.jsx(Fr,{open:a,onOpenChange:o,children:r.jsxs(Rr,{children:[r.jsx(qr,{children:r.jsx($r,{children:l?"Edit Category":"Create Category"})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium",children:"Icon (emoji)"}),r.jsx(dt,{value:h.icon,onChange:Re=>p(je=>({...je,icon:Re.target.value})),placeholder:"💬",className:"mt-1"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium",children:"Name *"}),r.jsx(dt,{value:h.name,onChange:Re=>p(je=>({...je,name:Re.target.value})),placeholder:"Category name",className:"mt-1"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium",children:"Description"}),r.jsx(ps,{value:h.description,onChange:Re=>p(je=>({...je,description:Re.target.value})),placeholder:"Brief description of this category",className:"mt-1"})]}),r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(ee,{variant:"outline",onClick:()=>o(!1),children:"Cancel"}),r.jsx(ee,{onClick:()=>ye.mutate({...h,id:l==null?void 0:l.id}),disabled:!h.name.trim(),children:l?"Save Changes":"Create Category"})]})]})]})}),r.jsx(Fr,{open:x,onOpenChange:y,children:r.jsxs(Rr,{children:[r.jsx(qr,{children:r.jsx($r,{children:b?"Edit Private Group":"Create Private Group"})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium",children:"Icon (emoji)"}),r.jsx(dt,{value:C.icon,onChange:Re=>N(je=>({...je,icon:Re.target.value})),placeholder:"🔒",className:"mt-1"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium",children:"Name *"}),r.jsx(dt,{value:C.name,onChange:Re=>N(je=>({...je,name:Re.target.value})),placeholder:"e.g., Pioneers",className:"mt-1"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium",children:"Description"}),r.jsx(ps,{value:C.description,onChange:Re=>N(je=>({...je,description:Re.target.value})),placeholder:"Brief description of this private group",className:"mt-1"})]}),r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(ee,{variant:"outline",onClick:()=>y(!1),children:"Cancel"}),r.jsx(ee,{onClick:()=>ae.mutate({...C,id:b==null?void 0:b.id}),disabled:!C.name.trim(),children:b?"Save Changes":"Create Private Group"})]})]})]})}),r.jsx(Fr,{open:A,onOpenChange:E,children:r.jsxs(Rr,{className:"max-w-2xl",children:[r.jsx(qr,{children:r.jsxs($r,{children:["Manage Members: ",T==null?void 0:T.name]})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs(Ii,{defaultValue:"brokerages",children:[r.jsxs(wi,{className:"w-full",children:[r.jsx(ln,{value:"brokerages",className:"flex-1",children:"By Brokerage"}),r.jsx(ln,{value:"users",className:"flex-1",children:"Individual Users"})]}),r.jsxs(An,{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(Jo,{className:"h-[300px] border rounded-md p-4",children:r.jsxs("div",{className:"space-y-2",children:[le.map(Re=>r.jsxs("div",{className:"flex items-center justify-between p-2 hover:bg-muted rounded-md",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(Dl,{checked:Ee(Re.id),onCheckedChange:()=>{T&&Ae.mutate({groupId:T.id,brokerageId:Re.id,isMember:Ee(Re.id)})}}),r.jsx("span",{className:"font-medium",children:Re.name})]}),r.jsxs(Ot,{variant:"secondary",children:[ie.filter(je=>je.brokerage_id===Re.id).length," agents"]})]},Re.id)),le.length===0&&r.jsx("p",{className:"text-center text-muted-foreground py-4",children:"No brokerages found"})]})})]}),r.jsxs(An,{value:"users",className:"space-y-4",children:[r.jsxs("div",{className:"relative",children:[r.jsx(wa,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(dt,{placeholder:"Search users...",value:z,onChange:Re=>F(Re.target.value),className:"pl-9"})]}),r.jsx(Jo,{className:"h-[300px] border rounded-md p-4",children:r.jsxs("div",{className:"space-y-2",children:[Ue.map(Re=>r.jsx("div",{className:"flex items-center justify-between p-2 hover:bg-muted rounded-md",children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(Dl,{checked:Be(Re.id),onCheckedChange:()=>{T&&_e.mutate({groupId:T.id,userId:Re.id,isMember:Be(Re.id)})}}),r.jsxs("div",{children:[r.jsx("div",{className:"font-medium",children:Re.name}),r.jsx("div",{className:"text-sm text-muted-foreground",children:Re.email})]})]})},Re.id)),Ue.length===0&&r.jsx("p",{className:"text-center text-muted-foreground py-4",children:"No users found"})]})})]})]}),r.jsx("div",{className:"flex justify-end",children:r.jsx(ee,{onClick:()=>E(!1),children:"Done"})})]})]})})]})})},XNe=t=>{switch(t){case"academy_video":return r.jsx(hc,{className:"h-3 w-3"});case"template":return r.jsx(La,{className:"h-3 w-3"});case"toolbox":return r.jsx(zl,{className:"h-3 w-3"});case"newsletter":return r.jsx(Vx,{className:"h-3 w-3"});case"social_swag":return r.jsx(Ms,{className:"h-3 w-3"});default:return r.jsx(Fs,{className:"h-3 w-3"})}},lwt=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}},cwt=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}},dwt=()=>{const{toast:t}=fi(),[e,n]=I.useState([]),[s,a]=I.useState([]),[o,l]=I.useState([]),[i,h]=I.useState(!0),[p,x]=I.useState(""),[y,b]=I.useState(null),[j,C]=I.useState([]),[N,A]=I.useState([]);I.useEffect(()=>{E()},[]);const E=async()=>{try{h(!0);const{data:F,error:q}=await J.from("activity_logs").select(` id, user_id, app_name, launched_at, profiles ( name, email, brokerages ( name ) ) `).order("launched_at",{ascending:!1}).limit(5e3);if(q)throw q;const{data:H,error:Z}=await J.from("content_engagement_logs").select(` id, user_id, resource_type, resource_id, resource_title, action_type, created_at `).order("created_at",{ascending:!1}).limit(5e3);if(Z)throw Z;const G=[...new Set((H==null?void 0:H.map(ae=>ae.user_id))||[])],{data:te}=await J.from("profiles").select(` id, name, email, brokerages ( name ) `).in("id",G),ie=new Map((te==null?void 0:te.map(ae=>[ae.id,ae]))||[]),le=(F==null?void 0:F.map(ae=>{var he,ue,_e,Ae;return{id:ae.id,user_id:ae.user_id,app_name:ae.app_name,launched_at:ae.launched_at,user_name:((he=ae.profiles)==null?void 0:he.name)||"Unknown",user_email:((ue=ae.profiles)==null?void 0:ue.email)||"Unknown",brokerage_name:((Ae=(_e=ae.profiles)==null?void 0:_e.brokerages)==null?void 0:Ae.name)||null}}))||[],ye=(H==null?void 0:H.map(ae=>{var ue;const he=ie.get(ae.user_id);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:(he==null?void 0:he.name)||"Unknown",user_email:(he==null?void 0:he.email)||"Unknown",brokerage_name:((ue=he==null?void 0:he.brokerages)==null?void 0:ue.name)||null}}))||[];n(le),a(ye);const ne=new Map;le.forEach(ae=>{if(!ne.has(ae.user_id))ne.set(ae.user_id,{user_id:ae.user_id,user_name:ae.user_name,user_email:ae.user_email,brokerage_name:ae.brokerage_name,last_activity_type:"app",last_activity_name:ae.app_name,last_activity_at:ae.launched_at,total_app_launches:1,total_content_views:0});else{const he=ne.get(ae.user_id);he.total_app_launches++,new Date(ae.launched_at)>new Date(he.last_activity_at)&&(he.last_activity_type="app",he.last_activity_name=ae.app_name,he.last_activity_at=ae.launched_at)}}),ye.forEach(ae=>{if(!ne.has(ae.user_id))ne.set(ae.user_id,{user_id:ae.user_id,user_name:ae.user_name,user_email:ae.user_email,brokerage_name:ae.brokerage_name,last_activity_type:ae.resource_type,last_activity_name:ae.resource_title,last_activity_at:ae.created_at,total_app_launches:0,total_content_views:1});else{const he=ne.get(ae.user_id);he.total_content_views++,new Date(ae.created_at)>new Date(he.last_activity_at)&&(he.last_activity_type=ae.resource_type,he.last_activity_name=ae.resource_title,he.last_activity_at=ae.created_at)}});const ge=Array.from(ne.values()).sort((ae,he)=>new Date(he.last_activity_at).getTime()-new Date(ae.last_activity_at).getTime());l(ge)}catch(F){console.error("Error loading activity:",F),t({title:"Error",description:"Failed to load activity logs",variant:"destructive"})}finally{h(!1)}},T=F=>{b({id:F.user_id,name:F.user_name,email:F.user_email});const q=e.filter(Z=>Z.user_id===F.user_id),H=s.filter(Z=>Z.user_id===F.user_id);C(q),A(H)},L=()=>{b(null),C([]),A([])},z=o.filter(F=>{var H;if(!p)return!0;const q=p.toLowerCase();return F.user_name.toLowerCase().includes(q)||F.user_email.toLowerCase().includes(q)||((H=F.brokerage_name)==null?void 0:H.toLowerCase().includes(q))});return i?r.jsx(Ye,{children:r.jsx(tt,{className:"flex items-center justify-center py-8",children:r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})})}):r.jsxs(r.Fragment,{children:[r.jsxs(Ye,{children:[r.jsxs(Gt,{children:[r.jsx(Zt,{children:"User Activity"}),r.jsx(Mn,{children:"App launches and content engagement - click to see full history"})]}),r.jsxs(tt,{children:[r.jsx("div",{className:"mb-4",children:r.jsxs("div",{className:"relative",children:[r.jsx(wa,{className:"absolute left-3 top-3 h-4 w-4 text-muted-foreground"}),r.jsx(dt,{placeholder:"Search by name, email, or brokerage...",value:p,onChange:F=>x(F.target.value),className:"pl-9"})]})}),r.jsx("div",{className:"rounded-md border",children:r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Ar,{children:[r.jsx(It,{children:"User"}),r.jsx(It,{children:"Brokerage"}),r.jsx(It,{children:"Last Activity"}),r.jsx(It,{children:"Last Active"}),r.jsx(It,{className:"text-right",children:"Apps"}),r.jsx(It,{className:"text-right",children:"Content"})]})}),r.jsx(Vs,{children:z.length===0?r.jsx(Ar,{children:r.jsx(Nt,{colSpan:6,className:"text-center text-muted-foreground",children:"No activity found"})}):z.map(F=>r.jsxs(Ar,{className:"cursor-pointer hover:bg-muted/50 transition-colors",onClick:()=>T(F),children:[r.jsx(Nt,{children:r.jsxs("div",{children:[r.jsx("div",{className:"font-medium",children:F.user_name}),r.jsx("div",{className:"text-sm text-muted-foreground",children:F.user_email})]})}),r.jsx(Nt,{children:F.brokerage_name?r.jsx(Ot,{variant:"outline",children:F.brokerage_name}):r.jsx("span",{className:"text-muted-foreground text-sm",children:"-"})}),r.jsx(Nt,{children:r.jsx("div",{className:"flex items-center gap-2",children:F.last_activity_type==="app"?r.jsxs(Ot,{variant:"secondary",children:[r.jsx(Fs,{className:"h-3 w-3 mr-1"}),F.last_activity_name]}):r.jsxs(Ot,{variant:"outline",className:"flex items-center gap-1",children:[XNe(F.last_activity_type),r.jsx("span",{className:"max-w-32 truncate",children:F.last_activity_name})]})})}),r.jsx(Nt,{className:"text-sm text-muted-foreground",children:cu(new Date(F.last_activity_at),{addSuffix:!0})}),r.jsx(Nt,{className:"text-right",children:r.jsx(Ot,{variant:"outline",children:F.total_app_launches})}),r.jsx(Nt,{className:"text-right",children:r.jsx(Ot,{variant:"outline",children:F.total_content_views})})]},F.user_id))})]})})]})]}),r.jsx(Fr,{open:!!y,onOpenChange:F=>!F&&L(),children:r.jsxs(Rr,{className:"max-w-3xl max-h-[80vh] overflow-hidden flex flex-col",children:[r.jsxs(qr,{children:[r.jsxs($r,{children:[y==null?void 0:y.name,"'s Activity"]}),r.jsx(Xn,{children:y==null?void 0:y.email})]}),r.jsxs(Ii,{defaultValue:"content",className:"flex-1 overflow-hidden flex flex-col",children:[r.jsxs(wi,{className:"grid w-full grid-cols-2",children:[r.jsxs(ln,{value:"content",children:["Content (",N.length,")"]}),r.jsxs(ln,{value:"apps",children:["App Launches (",j.length,")"]})]}),r.jsx(An,{value:"content",className:"flex-1 overflow-auto mt-4",children:r.jsx("div",{className:"rounded-md border",children:r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Ar,{children:[r.jsx(It,{children:"Type"}),r.jsx(It,{children:"Resource"}),r.jsx(It,{children:"Action"}),r.jsx(It,{children:"Time"})]})}),r.jsx(Vs,{children:N.length===0?r.jsx(Ar,{children:r.jsx(Nt,{colSpan:4,className:"text-center text-muted-foreground",children:"No content engagement"})}):N.map(F=>r.jsxs(Ar,{children:[r.jsx(Nt,{children:r.jsxs(Ot,{variant:"outline",className:"flex items-center gap-1 w-fit",children:[XNe(F.resource_type),lwt(F.resource_type)]})}),r.jsx(Nt,{className:"max-w-48",children:r.jsx("span",{className:"truncate block",children:F.resource_title})}),r.jsx(Nt,{children:r.jsx(Ot,{variant:"secondary",children:cwt(F.action_type)})}),r.jsx(Nt,{className:"text-sm text-muted-foreground",children:cu(new Date(F.created_at),{addSuffix:!0})})]},F.id))})]})})}),r.jsx(An,{value:"apps",className:"flex-1 overflow-auto mt-4",children:r.jsx("div",{className:"rounded-md border",children:r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Ar,{children:[r.jsx(It,{children:"App"}),r.jsx(It,{children:"Time"})]})}),r.jsx(Vs,{children:j.length===0?r.jsx(Ar,{children:r.jsx(Nt,{colSpan:2,className:"text-center text-muted-foreground",children:"No app launches"})}):j.map(F=>r.jsxs(Ar,{children:[r.jsx(Nt,{children:r.jsx(Ot,{variant:"secondary",children:F.app_name})}),r.jsx(Nt,{className:"text-sm text-muted-foreground",children:cu(new Date(F.launched_at),{addSuffix:!0})})]},F.id))})]})})})]})]})})]})},uwt=()=>{const{toast:t}=fi(),[e,n]=I.useState({totalUsers:0,activeUsers:0,pendingUsers:0,totalBrokerages:0,totalLaunches:0,launchesThisWeek:0,launchesThisMonth:0,uniqueActiveThisWeek:0}),[s,a]=I.useState(!0);I.useEffect(()=>{o()},[]);const o=async()=>{try{a(!0);const{count:l}=await J.from("profiles").select("*",{count:"exact",head:!0}),{count:i}=await J.from("profiles").select("*",{count:"exact",head:!0}).not("last_login","is",null),h=(l||0)-(i||0),{count:p}=await J.from("brokerages").select("*",{count:"exact",head:!0}),{count:x}=await J.from("activity_logs").select("*",{count:"exact",head:!0}),y=new Date;y.setDate(y.getDate()-7);const{count:b}=await J.from("activity_logs").select("*",{count:"exact",head:!0}).gte("launched_at",y.toISOString()),j=new Date;j.setMonth(j.getMonth()-1);const{count:C}=await J.from("activity_logs").select("*",{count:"exact",head:!0}).gte("launched_at",j.toISOString()),{data:N}=await J.from("activity_logs").select("user_id").gte("launched_at",y.toISOString()),A=new Set(N==null?void 0:N.map(E=>E.user_id)).size;n({totalUsers:l||0,activeUsers:i||0,pendingUsers:h,totalBrokerages:p||0,totalLaunches:x||0,launchesThisWeek:b||0,launchesThisMonth:C||0,uniqueActiveThisWeek:A})}catch(l){console.error("Error loading analytics:",l),t({title:"Error",description:"Failed to load analytics",variant:"destructive"})}finally{a(!1)}};return s?r.jsx(Ye,{children:r.jsx(tt,{className:"flex items-center justify-center py-8",children:r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})})}):r.jsxs("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-4",children:[r.jsxs(Ye,{children:[r.jsxs(Gt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Zt,{className:"text-sm font-medium",children:"Total Users"}),r.jsx(Bn,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(tt,{children:[r.jsx("div",{className:"text-2xl font-bold",children:e.totalUsers}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[e.activeUsers," active, ",e.pendingUsers," pending"]})]})]}),r.jsxs(Ye,{children:[r.jsxs(Gt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Zt,{className:"text-sm font-medium",children:"Active Users"}),r.jsx(Yi,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(tt,{children:[r.jsx("div",{className:"text-2xl font-bold",children:e.activeUsers}),r.jsx("p",{className:"text-xs text-muted-foreground",children:e.totalUsers>0?`${Math.round(e.activeUsers/e.totalUsers*100)}% of total`:"0% of total"})]})]}),r.jsxs(Ye,{children:[r.jsxs(Gt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Zt,{className:"text-sm font-medium",children:"Pending Invites"}),r.jsx(Ya,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(tt,{children:[r.jsx("div",{className:"text-2xl font-bold",children:e.pendingUsers}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Awaiting setup"})]})]}),r.jsxs(Ye,{children:[r.jsxs(Gt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Zt,{className:"text-sm font-medium",children:"Brokerages"}),r.jsx(ai,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(tt,{children:[r.jsx("div",{className:"text-2xl font-bold",children:e.totalBrokerages}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Total brokerages"})]})]}),r.jsxs(Ye,{children:[r.jsxs(Gt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Zt,{className:"text-sm font-medium",children:"Total App Launches"}),r.jsx(pg,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(tt,{children:[r.jsx("div",{className:"text-2xl font-bold",children:e.totalLaunches}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"All time"})]})]}),r.jsxs(Ye,{children:[r.jsxs(Gt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Zt,{className:"text-sm font-medium",children:"Launches This Week"}),r.jsx(pg,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(tt,{children:[r.jsx("div",{className:"text-2xl font-bold",children:e.launchesThisWeek}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Last 7 days"})]})]}),r.jsxs(Ye,{children:[r.jsxs(Gt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Zt,{className:"text-sm font-medium",children:"Launches This Month"}),r.jsx(pg,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(tt,{children:[r.jsx("div",{className:"text-2xl font-bold",children:e.launchesThisMonth}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Last 30 days"})]})]}),r.jsxs(Ye,{children:[r.jsxs(Gt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Zt,{className:"text-sm font-medium",children:"Active This Week"}),r.jsx(Xf,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(tt,{children:[r.jsx("div",{className:"text-2xl font-bold",children:e.uniqueActiveThisWeek}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Unique users"})]})]})]})},QNe={event:"Event",template:"Template",academy_video:"Academy Video",resource_kit:"Resource Kit",newsletter:"Newsletter",social_swag:"Social Swag"},JNe={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 mze({brokerageOnly:t=!1,brokerageId:e}){const[n,s]=I.useState([]),[a,o]=I.useState(!0),[l,i]=I.useState(""),[h,p]=I.useState("all");I.useEffect(()=>{x()},[e]);const x=async()=>{o(!0);try{let E=[];if(t&&e){const{data:G}=await J.from("profiles").select("id").eq("brokerage_id",e);if(E=(G==null?void 0:G.map(te=>te.id))||[],E.length===0){s([]),o(!1);return}}let T=J.from("resource_shares").select("*").order("created_at",{ascending:!1});t&&E.length>0&&(T=T.or(`sender_id.in.(${E.join(",")}),recipient_id.in.(${E.join(",")})`));const{data:L,error:z}=await T;if(z)throw z;const F=new Set;L==null||L.forEach(G=>{F.add(G.sender_id),F.add(G.recipient_id)});const{data:q}=await J.from("profiles").select("id, name, email").in("id",Array.from(F)),H=new Map((q==null?void 0:q.map(G=>[G.id,G]))||[]),Z=(L==null?void 0:L.map(G=>({...G,sender:H.get(G.sender_id),recipient:H.get(G.recipient_id)})))||[];s(Z)}catch(E){console.error("Error loading shares:",E)}finally{o(!1)}},y=n.filter(E=>{var z,F;const T=l===""||E.resource_title.toLowerCase().includes(l.toLowerCase())||((z=E.sender)==null?void 0:z.name.toLowerCase().includes(l.toLowerCase()))||((F=E.recipient)==null?void 0:F.name.toLowerCase().includes(l.toLowerCase())),L=h==="all"||E.resource_type===h;return T&&L}),b=n.length,j=new Set(n.map(E=>E.sender_id)).size,C=new Set(n.map(E=>E.recipient_id)).size,N=n.length>0?Math.round(n.filter(E=>E.is_read).length/n.length*100):0,A=n.reduce((E,T)=>(E[T.resource_type]=(E[T.resource_type]||0)+1,E),{});return a?r.jsxs("div",{className:"space-y-4",children:[r.jsx("div",{className:"grid gap-4 md:grid-cols-4",children:[...Array(4)].map((E,T)=>r.jsxs(Ye,{children:[r.jsx(Gt,{className:"pb-2",children:r.jsx(Ir,{className:"h-4 w-20"})}),r.jsx(tt,{children:r.jsx(Ir,{className:"h-8 w-16"})})]},T))}),r.jsx(Ye,{children:r.jsx(tt,{className:"p-6",children:r.jsx(Ir,{className:"h-[300px]"})})})]}):r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"grid gap-4 md:grid-cols-4",children:[r.jsxs(Ye,{children:[r.jsxs(Gt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Zt,{className:"text-sm font-medium",children:"Total Shares"}),r.jsx(fc,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsx(tt,{children:r.jsx("div",{className:"text-2xl font-bold",children:b})})]}),r.jsxs(Ye,{children:[r.jsxs(Gt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Zt,{className:"text-sm font-medium",children:"Active Sharers"}),r.jsx(Bn,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsx(tt,{children:r.jsx("div",{className:"text-2xl font-bold",children:j})})]}),r.jsxs(Ye,{children:[r.jsxs(Gt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Zt,{className:"text-sm font-medium",children:"Recipients Reached"}),r.jsx(Xf,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsx(tt,{children:r.jsx("div",{className:"text-2xl font-bold",children:C})})]}),r.jsxs(Ye,{children:[r.jsxs(Gt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Zt,{className:"text-sm font-medium",children:"Read Rate"}),r.jsx(La,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsx(tt,{children:r.jsxs("div",{className:"text-2xl font-bold",children:[N,"%"]})})]})]}),r.jsxs(Ye,{children:[r.jsx(Gt,{children:r.jsx(Zt,{className:"text-sm font-medium",children:"Shares by Resource Type"})}),r.jsx(tt,{children:r.jsxs("div",{className:"flex flex-wrap gap-2",children:[Object.entries(A).map(([E,T])=>r.jsxs(Ot,{variant:"secondary",className:JNe[E],children:[QNe[E],": ",T]},E)),Object.keys(A).length===0&&r.jsx("span",{className:"text-muted-foreground text-sm",children:"No shares yet"})]})})]}),r.jsxs(Ye,{children:[r.jsxs(Gt,{children:[r.jsx(Zt,{children:"Share History"}),r.jsxs(Mn,{children:["All resource shares ",t?"in your brokerage":"across the platform"]})]}),r.jsxs(tt,{children:[r.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 mb-4",children:[r.jsxs("div",{className:"relative flex-1",children:[r.jsx(wa,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(dt,{placeholder:"Search by resource, sender, or recipient...",value:l,onChange:E=>i(E.target.value),className:"pl-9"})]}),r.jsxs(gn,{value:h,onValueChange:p,children:[r.jsx(fn,{className:"w-[180px]",children:r.jsx(xn,{placeholder:"Resource type"})}),r.jsxs(pn,{children:[r.jsx(Vt,{value:"all",children:"All Types"}),r.jsx(Vt,{value:"event",children:"Events"}),r.jsx(Vt,{value:"template",children:"Templates"}),r.jsx(Vt,{value:"academy_video",children:"Academy Videos"}),r.jsx(Vt,{value:"resource_kit",children:"Resource Kits"}),r.jsx(Vt,{value:"newsletter",children:"Newsletters"}),r.jsx(Vt,{value:"social_swag",children:"Social Swag"})]})]})]}),r.jsx(Jo,{className:"h-[400px]",children:r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Ar,{children:[r.jsx(It,{children:"Resource"}),r.jsx(It,{children:"Type"}),r.jsx(It,{children:"Sender"}),r.jsx(It,{children:"Recipient"}),r.jsx(It,{children:"Status"}),r.jsx(It,{children:"Date"})]})}),r.jsx(Vs,{children:y.length===0?r.jsx(Ar,{children:r.jsx(Nt,{colSpan:6,className:"text-center text-muted-foreground py-8",children:"No shares found"})}):y.map(E=>{var T,L;return r.jsxs(Ar,{children:[r.jsx(Nt,{className:"font-medium max-w-[200px] truncate",children:E.resource_title}),r.jsx(Nt,{children:r.jsx(Ot,{variant:"secondary",className:JNe[E.resource_type],children:QNe[E.resource_type]})}),r.jsx(Nt,{children:((T=E.sender)==null?void 0:T.name)||"Unknown"}),r.jsx(Nt,{children:((L=E.recipient)==null?void 0:L.name)||"Unknown"}),r.jsx(Nt,{children:r.jsx(Ot,{variant:E.is_read?"default":"outline",children:E.is_read?"Read":"Unread"})}),r.jsx(Nt,{className:"text-muted-foreground",children:yn(new Date(E.created_at),"MMM d, yyyy")})]},E.id)})})]})})]})]})]})}const hwt=()=>r.jsx(Lr,{title:"Analytics",children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold text-foreground",children:"Analytics & Activity"}),r.jsx("p",{className:"text-muted-foreground mt-1",children:"Platform-wide usage statistics and user activity"})]}),r.jsxs(Ii,{defaultValue:"analytics",className:"space-y-4",children:[r.jsxs(wi,{children:[r.jsx(ln,{value:"analytics",children:"Analytics"}),r.jsx(ln,{value:"activity",children:"Activity"}),r.jsx(ln,{value:"shares",children:"Shares"})]}),r.jsx(An,{value:"analytics",className:"space-y-4",children:r.jsx(uwt,{})}),r.jsx(An,{value:"activity",className:"space-y-4",children:r.jsx(dwt,{})}),r.jsx(An,{value:"shares",className:"space-y-4",children:r.jsx(mze,{})})]})]})});function fwt(){const t=Vr(),[e,n]=I.useState(!1),[s,a]=I.useState(null),[o,l]=I.useState({title:"",description:"",publish_date:new Date().toISOString().split("T")[0],is_published:!1,category_id:""}),[i,h]=I.useState(null),[p,x]=I.useState(""),[y,b]=I.useState([]),[j,C]=I.useState([]),[N,A]=I.useState([]),[E,T]=I.useState(!1),[L,z]=I.useState(null),[F,q]=I.useState(""),{data:H,isLoading:Z}=Yt({queryKey:["brokerage-resources"],queryFn:async()=>{const{data:Te,error:Ze}=await J.from("brokerage_resources").select("*").order("publish_date",{ascending:!1});if(Ze)throw Ze;return Te}}),{data:G}=Yt({queryKey:["brokerage-resource-pdfs"],queryFn:async()=>{const{data:Te,error:Ze}=await J.from("brokerage_resource_pdfs").select("*").order("sort_order",{ascending:!0});if(Ze)throw Ze;return Te}}),{data:te}=Yt({queryKey:["brokerage-resource-videos"],queryFn:async()=>{const{data:Te,error:Ze}=await J.from("brokerage_resource_videos").select("*").order("sort_order",{ascending:!0});if(Ze)throw Ze;return Te}}),{data:ie}=Yt({queryKey:["brokerage-resource-links"],queryFn:async()=>{const{data:Te,error:Ze}=await J.from("brokerage_resource_links").select("*").order("sort_order",{ascending:!0});if(Ze)throw Ze;return Te}}),{data:le,isLoading:ye}=Yt({queryKey:["brokerage-resource-categories"],queryFn:async()=>{const{data:Te,error:Ze}=await J.from("brokerage_resource_categories").select("*").order("sort_order",{ascending:!0});if(Ze)throw Ze;return Te}}),ne=()=>{l({title:"",description:"",publish_date:new Date().toISOString().split("T")[0],is_published:!1,category_id:""}),h(null),x(""),b([]),C([]),A([]),a(null),q("")},ge=Te=>{a(Te),l({title:Te.title,description:Te.description||"",publish_date:Te.publish_date.split("T")[0],is_published:Te.is_published,category_id:Te.category_id||""}),x(Te.preview_image_url||""),q("");const Ze=(G==null?void 0:G.filter(rt=>rt.resource_id===Te.id))||[];b(Ze.map(rt=>({id:rt.id,name:rt.name,file_url:rt.file_url,file_size:rt.file_size,sort_order:rt.sort_order})));const pe=(te==null?void 0:te.filter(rt=>rt.resource_id===Te.id))||[];C(pe.map(rt=>({id:rt.id,title:rt.title,video_url:rt.video_url,sort_order:rt.sort_order})));const yt=(ie==null?void 0:ie.filter(rt=>rt.resource_id===Te.id))||[];A(yt.map(rt=>({id:rt.id,title:rt.title,canva_share_link:rt.canva_share_link,sort_order:rt.sort_order}))),n(!0)},ae=Te=>{var pe;const Ze=(pe=Te.target.files)==null?void 0:pe[0];Ze&&(h(Ze),x(URL.createObjectURL(Ze)))},he=()=>{b([...y,{name:"",file_url:"",sort_order:y.length}])},ue=Te=>{b(y.filter((Ze,pe)=>pe!==Te))},_e=(Te,Ze,pe)=>{const yt=[...y];if(Ze==="file"&&pe instanceof File){const rt=pe.name.replace(/\.[^/.]+$/,"");yt[Te]={...yt[Te],file:pe,file_size:pe.size,name:yt[Te].name||rt}}else yt[Te]={...yt[Te],[Ze]:pe};b(yt)},Ae=()=>{C([...j,{title:"",video_url:"",sort_order:j.length}])},Ce=Te=>{C(j.filter((Ze,pe)=>pe!==Te))},be=(Te,Ze,pe)=>{const yt=[...j];Ze==="file"&&pe instanceof File?yt[Te]={...yt[Te],file:pe}:yt[Te]={...yt[Te],[Ze]:pe},C(yt)},me=()=>{A([...N,{title:"",canva_share_link:"",sort_order:N.length}])},Le=Te=>{A(N.filter((Ze,pe)=>pe!==Te))},Ne=(Te,Ze,pe)=>{const yt=[...N];yt[Te]={...yt[Te],[Ze]:pe},A(yt)},Be=async(Te,Ze)=>{try{const pe=await J.functions.invoke("bunny-upload",{body:{action:"create",title:Te.name}});if(pe.error)throw pe.error;const{videoId:yt,uploadUrl:rt,libraryId:at}=pe.data,Me=await J.functions.invoke("bunny-upload",{body:{action:"upload-url",videoId:yt,libraryId:at}});if(Me.error)throw Me.error;const{uploadUrl:ft,apiKey:qe}=Me.data,Oe=new XMLHttpRequest;return Oe.open("PUT",ft,!0),Oe.setRequestHeader("AccessKey",qe),Oe.upload.onprogress=Qe=>{if(Qe.lengthComputable){const nt=Math.round(Qe.loaded/Qe.total*100),gt=[...j];gt[Ze]={...gt[Ze],uploadProgress:nt},C(gt)}},await new Promise((Qe,nt)=>{Oe.onload=()=>Oe.status>=200&&Oe.status<300?Qe():nt(new Error("Upload failed")),Oe.onerror=()=>nt(new Error("Upload failed")),Oe.send(Te)}),`https://iframe.mediadelivery.net/embed/${at}/${yt}`}catch(pe){throw console.error("Bunny upload error:",pe),pe}},Ee=cr({mutationFn:async Te=>{const{data:Ze,error:pe}=await J.from("brokerage_resource_categories").insert({name:Te,sort_order:(le==null?void 0:le.length)||0}).select().single();if(pe)throw pe;return Ze},onSuccess:Te=>{t.invalidateQueries({queryKey:["brokerage-resource-categories"]}),l({...o,category_id:Te.id}),q(""),ze.success("Category created")},onError:Te=>{ze.error("Failed to create category: "+Te.message)}}),Ue=cr({mutationFn:async()=>{T(!0);let Te=(s==null?void 0:s.preview_image_url)||null;if(i){const yt=i.name.split(".").pop(),rt=`${Date.now()}.${yt}`,{error:at}=await J.storage.from("brokerage-resources").upload(`previews/${rt}`,i);if(at)throw at;const{data:Me}=J.storage.from("brokerage-resources").getPublicUrl(`previews/${rt}`);Te=Me.publicUrl}const Ze={title:o.title,description:o.description||null,preview_image_url:Te,publish_date:o.publish_date,is_published:o.is_published,category_id:o.category_id||null};let pe;if(s){const{error:yt}=await J.from("brokerage_resources").update(Ze).eq("id",s.id);if(yt)throw yt;pe=s.id;const rt=(G==null?void 0:G.filter(mt=>mt.resource_id===s.id).map(mt=>mt.id))||[],at=y.filter(mt=>mt.id).map(mt=>mt.id),Me=rt.filter(mt=>!at.includes(mt));Me.length>0&&await J.from("brokerage_resource_pdfs").delete().in("id",Me);const ft=(te==null?void 0:te.filter(mt=>mt.resource_id===s.id).map(mt=>mt.id))||[],qe=j.filter(mt=>mt.id).map(mt=>mt.id),Oe=ft.filter(mt=>!qe.includes(mt));Oe.length>0&&await J.from("brokerage_resource_videos").delete().in("id",Oe);const Qe=(ie==null?void 0:ie.filter(mt=>mt.resource_id===s.id).map(mt=>mt.id))||[],nt=N.filter(mt=>mt.id).map(mt=>mt.id),gt=Qe.filter(mt=>!nt.includes(mt));gt.length>0&&await J.from("brokerage_resource_links").delete().in("id",gt)}else{const{data:yt,error:rt}=await J.from("brokerage_resources").insert(Ze).select().single();if(rt)throw rt;pe=yt.id}for(let yt=0;yt{t.invalidateQueries({queryKey:["brokerage-resources"]}),t.invalidateQueries({queryKey:["brokerage-resource-pdfs"]}),t.invalidateQueries({queryKey:["brokerage-resource-videos"]}),t.invalidateQueries({queryKey:["brokerage-resource-links"]}),ze.success(s?"Resource updated":"Resource created"),n(!1),ne(),T(!1)},onError:Te=>{ze.error("Failed to save resource: "+Te.message),T(!1)}}),Re=cr({mutationFn:async Te=>{const{error:Ze}=await J.from("brokerage_resources").delete().eq("id",Te);if(Ze)throw Ze},onSuccess:()=>{t.invalidateQueries({queryKey:["brokerage-resources"]}),t.invalidateQueries({queryKey:["brokerage-resource-pdfs"]}),t.invalidateQueries({queryKey:["brokerage-resource-videos"]}),t.invalidateQueries({queryKey:["brokerage-resource-links"]}),ze.success("Resource deleted")},onError:Te=>{ze.error("Failed to delete: "+Te.message)}}),je=Te=>{if(Te.preventDefault(),!o.title){ze.error("Please enter a title");return}Ue.mutate()},et=Te=>{const Ze=(G==null?void 0:G.filter(rt=>rt.resource_id===Te).length)||0,pe=(te==null?void 0:te.filter(rt=>rt.resource_id===Te).length)||0,yt=(ie==null?void 0:ie.filter(rt=>rt.resource_id===Te).length)||0;return{pdfCount:Ze,videoCount:pe,linkCount:yt}};return r.jsx(Lr,{title:"Brokerage Resources Management",description:"Create and manage resources for brokerage managers",children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs(Ye,{children:[r.jsx(Gt,{className:"pb-2",children:r.jsx(Zt,{className:"text-sm font-medium text-muted-foreground",children:"Total Resources"})}),r.jsx(tt,{children:r.jsx("div",{className:"text-2xl font-bold",children:(H==null?void 0:H.length)||0})})]}),r.jsxs(Ye,{children:[r.jsx(Gt,{className:"pb-2",children:r.jsx(Zt,{className:"text-sm font-medium text-muted-foreground",children:"Published"})}),r.jsx(tt,{children:r.jsx("div",{className:"text-2xl font-bold",children:(H==null?void 0:H.filter(Te=>Te.is_published).length)||0})})]})]}),r.jsxs(ee,{onClick:()=>{ne(),n(!0)},children:[r.jsx(bn,{className:"h-4 w-4 mr-2"}),"Add Resource"]})]}),r.jsx(Ye,{children:r.jsx(tt,{className:"p-0",children:r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Ar,{children:[r.jsx(It,{children:"Title"}),r.jsx(It,{children:"Category"}),r.jsx(It,{children:"Content"}),r.jsx(It,{children:"Publish Date"}),r.jsx(It,{children:"Status"}),r.jsx(It,{className:"text-right",children:"Actions"})]})}),r.jsx(Vs,{children:Z?r.jsx(Ar,{children:r.jsx(Nt,{colSpan:6,className:"text-center py-8",children:"Loading..."})}):(H==null?void 0:H.length)===0?r.jsx(Ar,{children:r.jsx(Nt,{colSpan:6,className:"text-center py-8 text-muted-foreground",children:"No brokerage resources yet. Create your first one!"})}):H==null?void 0:H.map(Te=>{const{pdfCount:Ze,videoCount:pe,linkCount:yt}=et(Te.id),rt=le==null?void 0:le.find(at=>at.id===Te.category_id);return r.jsxs(Ar,{children:[r.jsx(Nt,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[Te.preview_image_url?r.jsx("img",{src:Te.preview_image_url,alt:Te.title,className:"w-10 h-10 rounded object-cover"}):r.jsx("div",{className:"w-10 h-10 rounded bg-muted flex items-center justify-center",children:r.jsx(yh,{className:"h-5 w-5 text-muted-foreground"})}),r.jsxs("div",{children:[r.jsx("div",{className:"font-medium",children:Te.title}),Te.description&&r.jsx("div",{className:"text-sm text-muted-foreground line-clamp-1",children:Te.description})]})]})}),r.jsx(Nt,{children:rt?r.jsx("span",{className:"inline-flex items-center px-2 py-1 rounded-full text-xs font-medium bg-muted",children:rt.name}):r.jsx("span",{className:"text-muted-foreground text-sm",children:"—"})}),r.jsx(Nt,{children:r.jsxs("div",{className:"flex items-center gap-3 text-sm text-muted-foreground",children:[r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(La,{className:"h-3.5 w-3.5"}),Ze]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Pa,{className:"h-3.5 w-3.5"}),pe]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Co,{className:"h-3.5 w-3.5"}),yt]})]})}),r.jsx(Nt,{children:yn(new Date(Te.publish_date),"MMM d, yyyy")}),r.jsx(Nt,{children:r.jsx("span",{className:`inline-flex items-center px-2 py-1 rounded-full text-xs font-medium ${Te.is_published?"bg-green-100 text-green-800":"bg-yellow-100 text-yellow-800"}`,children:Te.is_published?"Published":"Draft"})}),r.jsx(Nt,{className:"text-right",children:r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>{const at=(G==null?void 0:G.filter(qe=>qe.resource_id===Te.id))||[],Me=(te==null?void 0:te.filter(qe=>qe.resource_id===Te.id))||[],ft=(ie==null?void 0:ie.filter(qe=>qe.resource_id===Te.id))||[];z({...Te,pdfs:at,videos:Me,links:ft})},children:r.jsx(Qo,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>ge(Te),children:r.jsx(_i,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>{confirm("Delete this resource?")&&Re.mutate(Te.id)},children:r.jsx(Vn,{className:"h-4 w-4 text-destructive"})})]})})]},Te.id)})})]})})}),r.jsx(Fr,{open:e,onOpenChange:n,children:r.jsxs(Rr,{className:"max-w-3xl max-h-[90vh] overflow-y-auto",children:[r.jsx(qr,{children:r.jsx($r,{children:s?"Edit Brokerage Resource":"Add Brokerage Resource"})}),r.jsxs("form",{onSubmit:je,className:"space-y-6",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Preview Image"}),r.jsxs("div",{className:"flex items-center gap-4",children:[p?r.jsx("img",{src:p,alt:"Preview",className:"w-24 h-24 rounded object-cover"}):r.jsx("div",{className:"w-24 h-24 rounded bg-muted flex items-center justify-center",children:r.jsx(yh,{className:"h-8 w-8 text-muted-foreground"})}),r.jsx(dt,{type:"file",accept:"image/*",onChange:ae})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"title",children:"Title *"}),r.jsx(dt,{id:"title",value:o.title,onChange:Te=>l({...o,title:Te.target.value}),placeholder:"Resource Title"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs(He,{className:"flex items-center gap-2",children:[r.jsx(jg,{className:"h-4 w-4"}),"Category"]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(gn,{value:o.category_id,onValueChange:Te=>l({...o,category_id:Te}),children:[r.jsx(fn,{className:"flex-1",children:r.jsx(xn,{placeholder:"Select a category"})}),r.jsx(pn,{children:le==null?void 0:le.map(Te=>r.jsx(Vt,{value:Te.id,children:Te.name},Te.id))})]}),o.category_id&&r.jsx(ee,{type:"button",variant:"ghost",size:"icon",onClick:()=>l({...o,category_id:""}),children:r.jsx(_s,{className:"h-4 w-4"})})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(dt,{placeholder:"Or create new category...",value:F,onChange:Te=>q(Te.target.value),className:"flex-1"}),r.jsxs(ee,{type:"button",variant:"outline",size:"sm",disabled:!F.trim()||Ee.isPending,onClick:()=>Ee.mutate(F.trim()),children:[r.jsx(bn,{className:"h-4 w-4 mr-1"}),"Add"]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Description"}),r.jsx(fy,{content:o.description,onChange:Te=>l({...o,description:Te}),placeholder:"Brief description of this resource",minHeight:"120px"})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"publish_date",children:"Publish Date"}),r.jsx(dt,{id:"publish_date",type:"date",value:o.publish_date,onChange:Te=>l({...o,publish_date:Te.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Published"}),r.jsxs("div",{className:"flex items-center space-x-2 pt-2",children:[r.jsx(Ps,{checked:o.is_published,onCheckedChange:Te=>l({...o,is_published:Te})}),r.jsx("span",{className:"text-sm text-muted-foreground",children:o.is_published?"Visible to brokerage managers":"Hidden from brokerage managers"})]})]})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs(He,{className:"flex items-center gap-2",children:[r.jsx(La,{className:"h-4 w-4"}),"PDF Documents (",y.length,")"]}),r.jsxs(ee,{type:"button",variant:"outline",size:"sm",onClick:he,children:[r.jsx(bn,{className:"h-4 w-4 mr-1"}),"Add PDF"]})]}),y.map((Te,Ze)=>r.jsxs("div",{className:"flex items-center gap-2 p-3 border rounded-lg bg-muted/50",children:[r.jsx(dt,{placeholder:"PDF Name",value:Te.name,onChange:pe=>_e(Ze,"name",pe.target.value),className:"flex-1"}),r.jsx(dt,{type:"file",accept:".pdf",onChange:pe=>{var rt;const yt=(rt=pe.target.files)==null?void 0:rt[0];yt&&_e(Ze,"file",yt)},className:"flex-1"}),Te.file_url&&!Te.file&&r.jsx("span",{className:"text-xs text-muted-foreground",children:"Uploaded"}),r.jsx(ee,{type:"button",variant:"ghost",size:"icon",onClick:()=>ue(Ze),children:r.jsx(_s,{className:"h-4 w-4"})})]},Ze))]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs(He,{className:"flex items-center gap-2",children:[r.jsx(Pa,{className:"h-4 w-4"}),"Videos (",j.length,")"]}),r.jsxs(ee,{type:"button",variant:"outline",size:"sm",onClick:Ae,children:[r.jsx(bn,{className:"h-4 w-4 mr-1"}),"Add Video"]})]}),j.map((Te,Ze)=>r.jsxs("div",{className:"space-y-2 p-3 border rounded-lg bg-muted/50",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(dt,{placeholder:"Video Title",value:Te.title,onChange:pe=>be(Ze,"title",pe.target.value),className:"flex-1"}),r.jsx(ee,{type:"button",variant:"ghost",size:"icon",onClick:()=>Ce(Ze),children:r.jsx(_s,{className:"h-4 w-4"})})]}),r.jsx(dt,{type:"file",accept:"video/*",onChange:pe=>{var rt;const yt=(rt=pe.target.files)==null?void 0:rt[0];yt&&be(Ze,"file",yt)}}),Te.uploadProgress!==void 0&&Te.uploadProgress>0&&r.jsx("div",{className:"w-full bg-muted rounded-full h-2",children:r.jsx("div",{className:"bg-primary h-2 rounded-full transition-all",style:{width:`${Te.uploadProgress}%`}})}),Te.video_url&&!Te.file&&r.jsx("span",{className:"text-xs text-muted-foreground",children:"Video uploaded"})]},Ze))]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs(He,{className:"flex items-center gap-2",children:[r.jsx(Co,{className:"h-4 w-4"}),"Canva Links (",N.length,")"]}),r.jsxs(ee,{type:"button",variant:"outline",size:"sm",onClick:me,children:[r.jsx(bn,{className:"h-4 w-4 mr-1"}),"Add Link"]})]}),N.map((Te,Ze)=>r.jsxs("div",{className:"flex items-center gap-2 p-3 border rounded-lg bg-muted/50",children:[r.jsx(dt,{placeholder:"Link Title",value:Te.title,onChange:pe=>Ne(Ze,"title",pe.target.value),className:"flex-1"}),r.jsx(dt,{placeholder:"Canva Share Link",value:Te.canva_share_link,onChange:pe=>Ne(Ze,"canva_share_link",pe.target.value),className:"flex-1"}),r.jsx(ee,{type:"button",variant:"ghost",size:"icon",onClick:()=>Le(Ze),children:r.jsx(_s,{className:"h-4 w-4"})})]},Ze))]}),r.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[r.jsx(ee,{type:"button",variant:"outline",onClick:()=>n(!1),children:"Cancel"}),r.jsx(ee,{type:"submit",disabled:Ue.isPending||E,children:Ue.isPending||E?"Saving...":s?"Update":"Create"})]})]})]})}),r.jsx(Fr,{open:!!L,onOpenChange:()=>z(null),children:r.jsxs(Rr,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsx(qr,{children:r.jsx($r,{children:L==null?void 0:L.title})}),L&&r.jsxs("div",{className:"space-y-4",children:[L.preview_image_url&&r.jsx("img",{src:L.preview_image_url,alt:L.title,className:"w-full h-48 object-cover rounded-lg"}),L.description&&r.jsx("p",{className:"text-muted-foreground",children:L.description}),L.pdfs&&L.pdfs.length>0&&r.jsxs("div",{children:[r.jsxs("h4",{className:"font-medium mb-2 flex items-center gap-2",children:[r.jsx(La,{className:"h-4 w-4"}),"PDF Documents (",L.pdfs.length,")"]}),r.jsx("div",{className:"space-y-1",children:L.pdfs.map(Te=>r.jsx("a",{href:Te.file_url,target:"_blank",rel:"noopener noreferrer",className:"block p-2 border rounded hover:bg-muted",children:Te.name},Te.id))})]}),L.videos&&L.videos.length>0&&r.jsxs("div",{children:[r.jsxs("h4",{className:"font-medium mb-2 flex items-center gap-2",children:[r.jsx(Pa,{className:"h-4 w-4"}),"Videos (",L.videos.length,")"]}),r.jsx("div",{className:"space-y-2",children:L.videos.map(Te=>r.jsx("div",{className:"p-2 border rounded",children:r.jsx("p",{className:"font-medium text-sm",children:Te.title})},Te.id))})]}),L.links&&L.links.length>0&&r.jsxs("div",{children:[r.jsxs("h4",{className:"font-medium mb-2 flex items-center gap-2",children:[r.jsx(Co,{className:"h-4 w-4"}),"Canva Links (",L.links.length,")"]}),r.jsx("div",{className:"space-y-1",children:L.links.map(Te=>r.jsx("a",{href:Te.canva_share_link,target:"_blank",rel:"noopener noreferrer",className:"block p-2 border rounded hover:bg-muted",children:Te.title},Te.id))})]})]})]})})]})})}const gze=[{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 pwt(){const[t,e]=I.useState([]),[n,s]=I.useState(!0),[a,o]=I.useState(!1),[l,i]=I.useState(!1),[h,p]=I.useState(null),[x,y]=I.useState(!1),[b,j]=I.useState(!1),[C,N]=I.useState(""),[A,E]=I.useState(""),[T,L]=I.useState(""),[z,F]=I.useState(""),[q,H]=I.useState("Learn More"),[Z,G]=I.useState("top"),[te,ie]=I.useState(""),[le,ye]=I.useState(!0),[ne,ge]=I.useState(""),[ae,he]=I.useState("");I.useEffect(()=>{ue()},[]);const ue=async()=>{try{const{data:Ee,error:Ue}=await J.from("dashboard_banners").select("*").order("placement").order("sort_order");if(Ue)throw Ue;e(Ee||[])}catch(Ee){ze.error("Failed to load banners: "+Ee.message)}finally{s(!1)}},_e=()=>{N(""),E(""),L(""),F(""),H("Learn More"),G("top"),ie(""),ye(!0),ge(""),he(""),p(null)},Ae=Ee=>{p(Ee),N(Ee.title),E(Ee.description||""),L(Ee.image_url),F(Ee.link_url||""),H(Ee.link_text||"Learn More"),G(Ee.placement),ie(Ee.section_after||""),ye(Ee.is_active),ge(Ee.start_date?yn(new Date(Ee.start_date),"yyyy-MM-dd'T'HH:mm"):""),he(Ee.end_date?yn(new Date(Ee.end_date),"yyyy-MM-dd'T'HH:mm"):""),o(!0)},Ce=async Ee=>{var Re;const Ue=(Re=Ee.target.files)==null?void 0:Re[0];if(Ue){y(!0);try{const je=Ue.name.split(".").pop(),et=`${Date.now()}.${je}`,{error:Te}=await J.storage.from("banner-images").upload(et,Ue);if(Te)throw Te;const{data:{publicUrl:Ze}}=J.storage.from("banner-images").getPublicUrl(et);L(Ze),ze.success("Image uploaded successfully")}catch(je){ze.error("Failed to upload image: "+je.message)}finally{y(!1)}}},be=async()=>{if(!C.trim()||!T){ze.error("Please fill in required fields (title and image)");return}j(!0);try{const Ee={title:C.trim(),description:A.trim()||null,image_url:T,link_url:z.trim()||null,link_text:q.trim()||"Learn More",placement:Z,section_after:Z==="between"?te:null,is_active:le,start_date:ne?new Date(ne).toISOString():null,end_date:ae?new Date(ae).toISOString():null};if(h){const{error:Ue}=await J.from("dashboard_banners").update(Ee).eq("id",h.id);if(Ue)throw Ue;ze.success("Banner updated successfully")}else{const Ue=t.filter(je=>je.placement===Z).length,{error:Re}=await J.from("dashboard_banners").insert({...Ee,sort_order:Ue});if(Re)throw Re;ze.success("Banner created successfully")}o(!1),_e(),ue()}catch(Ee){ze.error("Failed to save banner: "+Ee.message)}finally{j(!1)}},me=async()=>{if(h)try{const{error:Ee}=await J.from("dashboard_banners").delete().eq("id",h.id);if(Ee)throw Ee;ze.success("Banner deleted successfully"),i(!1),p(null),ue()}catch(Ee){ze.error("Failed to delete banner: "+Ee.message)}},Le=async Ee=>{try{const{error:Ue}=await J.from("dashboard_banners").update({is_active:!Ee.is_active}).eq("id",Ee.id);if(Ue)throw Ue;ze.success(Ee.is_active?"Banner deactivated":"Banner activated"),ue()}catch(Ue){ze.error("Failed to update banner: "+Ue.message)}},Ne=t.filter(Ee=>Ee.placement==="top"),Be=t.filter(Ee=>Ee.placement==="between");return n?r.jsx(Lr,{title:"Dashboard Management",children:r.jsx("div",{className:"flex items-center justify-center h-64",children:r.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary"})})}):r.jsxs(Lr,{title:"Dashboard Management",description:"Configure dashboard modules and banners",children:[r.jsxs("div",{className:"space-y-8",children:[r.jsxs(Ye,{children:[r.jsxs(Gt,{className:"flex flex-row items-center justify-between",children:[r.jsxs("div",{children:[r.jsxs(Zt,{className:"flex items-center gap-2",children:[r.jsx(Pl,{className:"h-5 w-5"}),"Hero Banners (Top of Dashboard)"]}),r.jsx(Mn,{children:"These banners appear in a rotating carousel at the top of the dashboard"})]}),r.jsxs(Fr,{open:a&&Z==="top",onOpenChange:Ee=>{Ee||_e(),o(Ee),Ee&&G("top")},children:[r.jsx(zo,{asChild:!0,children:r.jsxs(ee,{onClick:()=>{_e(),G("top")},children:[r.jsx(bn,{className:"mr-2 h-4 w-4"}),"Add Hero Banner"]})}),r.jsxs(Rr,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsxs(qr,{children:[r.jsxs($r,{children:[h?"Edit":"Create"," Banner"]}),r.jsx(Xn,{children:"Configure the banner's content and display settings"})]}),r.jsx(e4e,{title:C,setTitle:N,description:A,setDescription:E,imageUrl:T,linkUrl:z,setLinkUrl:F,linkText:q,setLinkText:H,placement:Z,setPlacement:G,sectionAfter:te,setSectionAfter:ie,isActive:le,setIsActive:ye,startDate:ne,setStartDate:ge,endDate:ae,setEndDate:he,handleImageUpload:Ce,uploading:x,showPlacementOptions:!1}),r.jsxs(ea,{children:[r.jsx(ee,{variant:"outline",onClick:()=>{o(!1),_e()},children:"Cancel"}),r.jsx(ee,{onClick:be,disabled:b,children:b?"Saving...":h?"Update Banner":"Create Banner"})]})]})]})]}),r.jsx(tt,{children:Ne.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:Ne.map(Ee=>r.jsx(t4e,{banner:Ee,onEdit:()=>Ae(Ee),onDelete:()=>{p(Ee),i(!0)},onToggleActive:()=>Le(Ee)},Ee.id))})})]}),r.jsxs(Ye,{children:[r.jsxs(Gt,{className:"flex flex-row items-center justify-between",children:[r.jsxs("div",{children:[r.jsxs(Zt,{className:"flex items-center gap-2",children:[r.jsx(Pl,{className:"h-5 w-5"}),"Section Banners"]}),r.jsx(Mn,{children:"These banners appear between dashboard content sections"})]}),r.jsxs(Fr,{open:a&&Z==="between",onOpenChange:Ee=>{Ee||_e(),o(Ee),Ee&&G("between")},children:[r.jsx(zo,{asChild:!0,children:r.jsxs(ee,{onClick:()=>{_e(),G("between")},children:[r.jsx(bn,{className:"mr-2 h-4 w-4"}),"Add Section Banner"]})}),r.jsxs(Rr,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsxs(qr,{children:[r.jsxs($r,{children:[h?"Edit":"Create"," Section Banner"]}),r.jsx(Xn,{children:"Configure where this banner appears between sections"})]}),r.jsx(e4e,{title:C,setTitle:N,description:A,setDescription:E,imageUrl:T,linkUrl:z,setLinkUrl:F,linkText:q,setLinkText:H,placement:Z,setPlacement:G,sectionAfter:te,setSectionAfter:ie,isActive:le,setIsActive:ye,startDate:ne,setStartDate:ge,endDate:ae,setEndDate:he,handleImageUpload:Ce,uploading:x,showPlacementOptions:!0}),r.jsxs(ea,{children:[r.jsx(ee,{variant:"outline",onClick:()=>{o(!1),_e()},children:"Cancel"}),r.jsx(ee,{onClick:be,disabled:b,children:b?"Saving...":h?"Update Banner":"Create Banner"})]})]})]})]}),r.jsx(tt,{children:Be.length===0?r.jsx("p",{className:"text-muted-foreground text-center py-8",children:"No section banners yet. Add your first banner above."}):r.jsx("div",{className:"space-y-3",children:Be.map(Ee=>r.jsx(t4e,{banner:Ee,onEdit:()=>Ae(Ee),onDelete:()=>{p(Ee),i(!0)},onToggleActive:()=>Le(Ee),showSection:!0},Ee.id))})})]})]}),r.jsx(Fr,{open:l,onOpenChange:i,children:r.jsxs(Rr,{children:[r.jsxs(qr,{children:[r.jsx($r,{children:"Delete Banner"}),r.jsxs(Xn,{children:['Are you sure you want to delete "',h==null?void 0:h.title,'"? This action cannot be undone.']})]}),r.jsxs(ea,{children:[r.jsx(ee,{variant:"outline",onClick:()=>i(!1),children:"Cancel"}),r.jsx(ee,{variant:"destructive",onClick:me,children:"Delete"})]})]})})]})}function e4e({title:t,setTitle:e,description:n,setDescription:s,imageUrl:a,linkUrl:o,setLinkUrl:l,linkText:i,setLinkText:h,placement:p,setPlacement:x,sectionAfter:y,setSectionAfter:b,isActive:j,setIsActive:C,startDate:N,setStartDate:A,endDate:E,setEndDate:T,handleImageUpload:L,uploading:z,showPlacementOptions:F}){return r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"title",children:"Title *"}),r.jsx(dt,{id:"title",placeholder:"Banner headline...",value:t,onChange:q=>e(q.target.value)})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"description",children:"Description"}),r.jsx(ps,{id:"description",placeholder:"Optional banner description...",value:n,onChange:q=>s(q.target.value),rows:2})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Banner Image *"}),r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx(dt,{type:"file",accept:"image/*",onChange:L,disabled:z,className:"flex-1"}),z&&r.jsx("span",{className:"text-sm text-muted-foreground",children:"Uploading..."})]}),a&&r.jsx("div",{className:"mt-2 relative rounded-lg overflow-hidden border",children:r.jsx("img",{src:a,alt:"Preview",className:"w-full h-40 object-cover"})})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"linkUrl",children:"Link URL (optional)"}),r.jsx(dt,{id:"linkUrl",placeholder:"https://...",value:o,onChange:q=>l(q.target.value)})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"linkText",children:"Button Text"}),r.jsx(dt,{id:"linkText",placeholder:"Learn More",value:i,onChange:q=>h(q.target.value)})]})]}),F&&r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Placement"}),r.jsxs(gn,{value:y,onValueChange:b,children:[r.jsx(fn,{children:r.jsx(xn,{placeholder:"Select section placement..."})}),r.jsx(pn,{children:gze.map(q=>r.jsx(Vt,{value:q.value,children:q.label},q.value))})]})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsxs(He,{htmlFor:"startDate",className:"flex items-center gap-2",children:[r.jsx(zs,{className:"h-4 w-4"}),"Start Date (optional)"]}),r.jsx(dt,{id:"startDate",type:"datetime-local",value:N,onChange:q=>A(q.target.value)})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs(He,{htmlFor:"endDate",className:"flex items-center gap-2",children:[r.jsx(zs,{className:"h-4 w-4"}),"End Date (optional)"]}),r.jsx(dt,{id:"endDate",type:"datetime-local",value:E,onChange:q=>T(q.target.value)})]})]}),r.jsx("div",{className:"flex items-center justify-between pt-2",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ps,{id:"isActive",checked:j,onCheckedChange:C}),r.jsx(He,{htmlFor:"isActive",children:"Active"})]})})]})}function t4e({banner:t,onEdit:e,onDelete:n,onToggleActive:s,showSection:a=!1}){var l;const o=(l=gze.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(x1,{className:"h-5 w-5 text-muted-foreground cursor-grab"}),r.jsx("img",{src:t.image_url,alt:t.title,className:"w-24 h-14 object-cover rounded"}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("h4",{className:"font-medium truncate",children:t.title}),!t.is_active&&r.jsx(Ot,{variant:"secondary",children:"Inactive"}),t.start_date&&new Date(t.start_date)>new Date&&r.jsx(Ot,{variant:"outline",children:"Scheduled"})]}),t.description&&r.jsx("p",{className:"text-sm text-muted-foreground truncate",children:t.description}),a&&o&&r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:o})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[t.link_url&&r.jsx("a",{href:t.link_url,target:"_blank",rel:"noopener noreferrer",children:r.jsx(ee,{variant:"ghost",size:"icon",children:r.jsx(Fs,{className:"h-4 w-4"})})}),r.jsx(ee,{variant:"ghost",size:"icon",onClick:s,children:t.is_active?r.jsx(Qo,{className:"h-4 w-4"}):r.jsx(h1,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"icon",onClick:e,children:r.jsx(_i,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"icon",onClick:n,children:r.jsx(Vn,{className:"h-4 w-4 text-destructive"})})]})]})}const RL={open:{label:"Open",icon:Ya,color:"bg-yellow-500"},in_progress:{label:"In Progress",icon:Fl,color:"bg-blue-500"},resolved:{label:"Resolved",icon:Yi,color:"bg-green-500"},closed:{label:"Closed",icon:qc,color:"bg-muted-foreground"}},r4e={general:"General Support",technology:"Technology Support",crm:"CRM Support",marketing:"Marketing Support"};function mwt(){var q,H;const{user:t}=Qr(),e=Vr(),[n,s]=I.useState(null),[a,o]=I.useState(""),[l,i]=I.useState("all"),[h,p]=I.useState("all"),[x,y]=I.useState(!1),{data:b=[],isLoading:j}=Yt({queryKey:["admin-support-tickets",l,h],queryFn:async()=>{let Z=J.from("support_tickets").select("*, profiles!support_tickets_user_id_fkey(name, email)").order("created_at",{ascending:!1});l!=="all"&&(Z=Z.eq("status",l)),h!=="all"&&(Z=Z.eq("category",h));const{data:G,error:te}=await Z;if(te)throw te;return G}}),{data:C=[]}=Yt({queryKey:["admin-users-notifications"],queryFn:async()=>{const{data:Z,error:G}=await J.from("user_roles").select("user_id").eq("role","admin");if(G)throw G;const te=Z.map(ae=>ae.user_id),{data:ie,error:le}=await J.from("profiles").select("id, name, email").in("id",te);if(le)throw le;const{data:ye,error:ne}=await J.from("support_notification_settings").select("user_id, receive_notifications");if(ne)throw ne;const ge=new Map((ye==null?void 0:ye.map(ae=>[ae.user_id,ae.receive_notifications]))||[]);return ie.map(ae=>({...ae,receives_notifications:ge.get(ae.id)||!1}))}}),{data:N=[]}=Yt({queryKey:["admin-ticket-replies",n==null?void 0:n.id],queryFn:async()=>{if(!n)return[];const{data:Z,error:G}=await J.from("support_ticket_replies").select("*, profiles(name)").eq("ticket_id",n.id).order("created_at",{ascending:!0});if(G)throw G;return Z},enabled:!!n}),A=cr({mutationFn:async({userId:Z,enabled:G})=>{const{data:te}=await J.from("support_notification_settings").select("id").eq("user_id",Z).maybeSingle();if(te){const{error:ie}=await J.from("support_notification_settings").update({receive_notifications:G}).eq("user_id",Z);if(ie)throw ie}else{const{error:ie}=await J.from("support_notification_settings").insert({user_id:Z,receive_notifications:G});if(ie)throw ie}},onSuccess:()=>{e.invalidateQueries({queryKey:["admin-users-notifications"]}),ze.success("Notification settings updated")},onError:()=>{ze.error("Failed to update settings")}}),E=cr({mutationFn:async({ticketId:Z,status:G})=>{const{error:te}=await J.from("support_tickets").update({status:G}).eq("id",Z);if(te)throw te},onSuccess:()=>{e.invalidateQueries({queryKey:["admin-support-tickets"]}),n&&s({...n,status:n.status}),ze.success("Status updated")},onError:()=>{ze.error("Failed to update status")}}),T=cr({mutationFn:async({ticketId:Z,assignedTo:G})=>{const{error:te}=await J.from("support_tickets").update({assigned_to:G}).eq("id",Z);if(te)throw te},onSuccess:()=>{e.invalidateQueries({queryKey:["admin-support-tickets"]}),ze.success("Ticket assigned")},onError:()=>{ze.error("Failed to assign ticket")}}),L=cr({mutationFn:async Z=>{var te,ie;if(!n||!t)throw new Error("Missing data");const{error:G}=await J.from("support_ticket_replies").insert({ticket_id:n.id,user_id:t.id,content:Z,is_admin_reply:!0});if(G)throw G;try{await J.functions.invoke("support-reply-notify",{body:{ticketId:n.id,ticketSubject:n.subject,replyContent:Z,userEmail:(te=n.profiles)==null?void 0:te.email,userName:(ie=n.profiles)==null?void 0:ie.name}})}catch(le){console.error("Failed to send reply notification:",le)}},onSuccess:()=>{e.invalidateQueries({queryKey:["admin-ticket-replies",n==null?void 0:n.id]}),o(""),ze.success("Reply sent!")},onError:()=>{ze.error("Failed to send reply")}}),z=()=>{a.trim()&&L.mutate(a)};I.useEffect(()=>{const Z=J.channel("admin-tickets").on("postgres_changes",{event:"*",schema:"public",table:"support_tickets"},()=>{e.invalidateQueries({queryKey:["admin-support-tickets"]})}).subscribe();return()=>{J.removeChannel(Z)}},[e]);const F=b.filter(Z=>Z.status==="open").length;return n?(RL[n.status].icon,r.jsx(Lr,{children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>s(null),children:r.jsx(so,{className:"h-5 w-5"})}),r.jsxs("div",{className:"flex-1",children:[r.jsx("h1",{className:"text-2xl font-bold",children:n.subject}),r.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[r.jsx(Ot,{variant:"secondary",children:r4e[n.category]}),r.jsxs("span",{className:"text-sm text-muted-foreground",children:["from ",((q=n.profiles)==null?void 0:q.name)||"Unknown"," (",(H=n.profiles)==null?void 0:H.email,")"]})]})]})]}),r.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[r.jsxs(Ye,{children:[r.jsx(Gt,{className:"pb-2",children:r.jsx(Zt,{className:"text-sm",children:"Status"})}),r.jsx(tt,{children:r.jsxs(gn,{value:n.status,onValueChange:Z=>{E.mutate({ticketId:n.id,status:Z}),s({...n,status:Z})},children:[r.jsx(fn,{children:r.jsx(xn,{})}),r.jsxs(pn,{children:[r.jsx(Vt,{value:"open",children:"Open"}),r.jsx(Vt,{value:"in_progress",children:"In Progress"}),r.jsx(Vt,{value:"resolved",children:"Resolved"}),r.jsx(Vt,{value:"closed",children:"Closed"})]})]})})]}),r.jsxs(Ye,{children:[r.jsx(Gt,{className:"pb-2",children:r.jsx(Zt,{className:"text-sm",children:"Assigned To"})}),r.jsx(tt,{children:r.jsxs(gn,{value:n.assigned_to||"unassigned",onValueChange:Z=>{const G=Z==="unassigned"?null:Z;T.mutate({ticketId:n.id,assignedTo:G}),s({...n,assigned_to:G})},children:[r.jsx(fn,{children:r.jsx(xn,{placeholder:"Unassigned"})}),r.jsxs(pn,{children:[r.jsx(Vt,{value:"unassigned",children:"Unassigned"}),C.map(Z=>r.jsx(Vt,{value:Z.id,children:Z.name},Z.id))]})]})})]})]}),r.jsxs(Ye,{children:[r.jsx(Gt,{children:r.jsxs(Mn,{children:["Created on ",yn(new Date(n.created_at),"MMM d, yyyy 'at' h:mm a")]})}),r.jsx(tt,{children:r.jsx("p",{className:"text-muted-foreground whitespace-pre-wrap",children:n.description})})]}),r.jsxs(Ye,{children:[r.jsx(Gt,{children:r.jsx(Zt,{className:"text-lg",children:"Conversation"})}),r.jsxs(tt,{children:[r.jsx(Jo,{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(Z=>{var G,te;return r.jsxs("div",{className:`p-4 rounded-lg ${Z.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:Z.is_admin_reply?`${((G=Z.profiles)==null?void 0:G.name)||"Admin"} (Support)`:((te=Z.profiles)==null?void 0:te.name)||"User"}),r.jsx("span",{className:"text-xs text-muted-foreground",children:yn(new Date(Z.created_at),"MMM d, h:mm a")})]}),r.jsx("p",{className:"text-sm whitespace-pre-wrap",children:Z.content})]},Z.id)})})}),r.jsx(ou,{className:"my-4"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(ps,{placeholder:"Type your reply...",value:a,onChange:Z=>o(Z.target.value),className:"min-h-[80px]"}),r.jsx(ee,{onClick:z,disabled:!a.trim()||L.isPending,className:"self-end",children:r.jsx(Oo,{className:"h-4 w-4"})})]})]})]})]})})):r.jsx(Lr,{children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold",children:"Support Tickets"}),r.jsxs("p",{className:"text-muted-foreground",children:["Manage support requests from agents",F>0&&r.jsxs(Ot,{variant:"destructive",className:"ml-2",children:[F," open"]})]})]}),r.jsxs(Fr,{open:x,onOpenChange:y,children:[r.jsx(zo,{asChild:!0,children:r.jsxs(ee,{variant:"outline",children:[r.jsx(fd,{className:"h-4 w-4 mr-2"}),"Notification Settings"]})}),r.jsxs(Rr,{children:[r.jsxs(qr,{children:[r.jsx($r,{children:"Email Notification Settings"}),r.jsx(Xn,{children:"Choose which admins receive email notifications for new support tickets."})]}),r.jsx("div",{className:"space-y-4 mt-4",children:C.map(Z=>r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(Ec,{className:"h-4 w-4 text-muted-foreground"}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:Z.name}),r.jsx("p",{className:"text-sm text-muted-foreground",children:Z.email})]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[Z.receives_notifications?r.jsx(gg,{className:"h-4 w-4 text-primary"}):r.jsx(oj,{className:"h-4 w-4 text-muted-foreground"}),r.jsx(Ps,{checked:Z.receives_notifications,onCheckedChange:G=>A.mutate({userId:Z.id,enabled:G})})]})]},Z.id))})]})]})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex flex-wrap gap-4 items-center",children:[r.jsx(Ii,{value:l,onValueChange:i,className:"w-auto",children:r.jsxs(wi,{children:[r.jsx(ln,{value:"all",children:"All"}),r.jsx(ln,{value:"open",children:"Open"}),r.jsx(ln,{value:"in_progress",children:"In Progress"}),r.jsx(ln,{value:"resolved",children:"Resolved"}),r.jsx(ln,{value:"closed",children:"Closed"})]})}),r.jsxs(gn,{value:h,onValueChange:p,children:[r.jsx(fn,{className:"w-[180px]",children:r.jsx(xn,{placeholder:"All Categories"})}),r.jsxs(pn,{children:[r.jsx(Vt,{value:"all",children:"All Categories"}),r.jsx(Vt,{value:"general",children:"General Support"}),r.jsx(Vt,{value:"technology",children:"Technology Support"}),r.jsx(Vt,{value:"crm",children:"CRM Support"}),r.jsx(Vt,{value:"marketing",children:"Marketing Support"})]})]})]}),r.jsx("div",{className:"mt-4",children:j?r.jsx("div",{className:"text-center py-12 text-muted-foreground",children:"Loading tickets..."}):b.length===0?r.jsx(Ye,{children:r.jsxs(tt,{className:"text-center py-12",children:[r.jsx(Fl,{className:"h-12 w-12 mx-auto text-muted-foreground mb-4"}),r.jsx("h3",{className:"text-lg font-medium mb-2",children:"No tickets found"}),r.jsx("p",{className:"text-muted-foreground",children:"No support tickets match the current filters."})]})}):r.jsx("div",{className:"space-y-3",children:b.map(Z=>{var te,ie;const G=RL[Z.status].icon;return r.jsx(Ye,{className:"cursor-pointer hover:bg-muted/50 transition-colors",onClick:()=>s(Z),children:r.jsx(tt,{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:Z.subject}),r.jsxs("div",{className:"flex items-center gap-2 mt-1 flex-wrap",children:[r.jsx(Ot,{variant:"outline",className:"text-xs",children:r4e[Z.category]}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:[(te=Z.profiles)==null?void 0:te.name," • ",yn(new Date(Z.created_at),"MMM d, yyyy")]}),Z.assigned_to&&r.jsxs(Ot,{variant:"secondary",className:"text-xs gap-1",children:[r.jsx(Ec,{className:"h-3 w-3"}),((ie=C.find(le=>le.id===Z.assigned_to))==null?void 0:ie.name)||"Assigned"]})]})]}),r.jsxs(Ot,{className:RL[Z.status].color,children:[r.jsx(G,{className:"h-3 w-3 mr-1"}),RL[Z.status].label]})]})})},Z.id)})})})]})]})})}const gwt=Bd.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 xwt({content:t,onChange:e,variables:n}){const s=YFe({extensions:[rze,hze.configure({openOnClick:!1,HTMLAttributes:{class:"text-primary underline"}}),fze.configure({types:["heading","paragraph"]}),pze,gwt],content:t,onUpdate:({editor:l})=>{e(l.getHTML())}});I.useEffect(()=>{s&&t!==s.getHTML()&&s.commands.setContent(t)},[t,s]);const a=l=>{s&&s.chain().focus().insertContent(`{{${l.key}}}`).run()},o=()=>{if(!s)return;const l=s.getAttributes("link").href,i=window.prompt("URL",l);if(i!==null){if(i===""){s.chain().focus().extendMarkRange("link").unsetLink().run();return}s.chain().focus().extendMarkRange("link").setLink({href:i}).run()}};return s?r.jsxs("div",{className:"border rounded-lg overflow-hidden",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-1 p-2 border-b bg-muted/30",children:[r.jsx(ee,{type:"button",variant:"ghost",size:"sm",onClick:()=>s.chain().focus().toggleBold().run(),className:s.isActive("bold")?"bg-muted":"",children:r.jsx(J4,{className:"h-4 w-4"})}),r.jsx(ee,{type:"button",variant:"ghost",size:"sm",onClick:()=>s.chain().focus().toggleItalic().run(),className:s.isActive("italic")?"bg-muted":"",children:r.jsx(aS,{className:"h-4 w-4"})}),r.jsx("div",{className:"w-px h-6 bg-border mx-1"}),r.jsx(ee,{type:"button",variant:"ghost",size:"sm",onClick:()=>s.chain().focus().toggleBulletList().run(),className:s.isActive("bulletList")?"bg-muted":"",children:r.jsx(Kf,{className:"h-4 w-4"})}),r.jsx(ee,{type:"button",variant:"ghost",size:"sm",onClick:()=>s.chain().focus().toggleOrderedList().run(),className:s.isActive("orderedList")?"bg-muted":"",children:r.jsx(lS,{className:"h-4 w-4"})}),r.jsx("div",{className:"w-px h-6 bg-border mx-1"}),r.jsx(ee,{type:"button",variant:"ghost",size:"sm",onClick:()=>s.chain().focus().setTextAlign("left").run(),className:s.isActive({textAlign:"left"})?"bg-muted":"",children:r.jsx(X4,{className:"h-4 w-4"})}),r.jsx(ee,{type:"button",variant:"ghost",size:"sm",onClick:()=>s.chain().focus().setTextAlign("center").run(),className:s.isActive({textAlign:"center"})?"bg-muted":"",children:r.jsx(Y4,{className:"h-4 w-4"})}),r.jsx(ee,{type:"button",variant:"ghost",size:"sm",onClick:()=>s.chain().focus().setTextAlign("right").run(),className:s.isActive({textAlign:"right"})?"bg-muted":"",children:r.jsx(Q4,{className:"h-4 w-4"})}),r.jsx("div",{className:"w-px h-6 bg-border mx-1"}),r.jsx(ee,{type:"button",variant:"ghost",size:"sm",onClick:o,className:s.isActive("link")?"bg-muted":"",children:r.jsx(Co,{className:"h-4 w-4"})}),r.jsx(ee,{type:"button",variant:"ghost",size:"sm",onClick:()=>s.chain().focus().toggleCodeBlock().run(),className:s.isActive("codeBlock")?"bg-muted":"",children:r.jsx(dj,{className:"h-4 w-4"})}),r.jsx("div",{className:"w-px h-6 bg-border mx-1"}),r.jsx(ee,{type:"button",variant:"ghost",size:"sm",onClick:()=>s.chain().focus().undo().run(),disabled:!s.can().undo(),children:r.jsx(mS,{className:"h-4 w-4"})}),r.jsx(ee,{type:"button",variant:"ghost",size:"sm",onClick:()=>s.chain().focus().redo().run(),disabled:!s.can().redo(),children:r.jsx(fS,{className:"h-4 w-4"})}),r.jsx("div",{className:"flex-1"}),n.length>0&&r.jsxs(wh,{children:[r.jsx(jh,{asChild:!0,children:r.jsxs(ee,{type:"button",variant:"outline",size:"sm",className:"gap-2",children:[r.jsx(tA,{className:"h-4 w-4"}),"Insert Variable"]})}),r.jsx(Wu,{align:"end",className:"w-64",children:n.map(l=>r.jsxs(di,{onClick:()=>a(l),className:"flex flex-col items-start",children:[r.jsx("span",{className:"font-medium",children:l.label}),r.jsx("span",{className:"text-xs text-muted-foreground font-mono",children:`{{${l.key}}}`}),l.description&&r.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:l.description})]},l.key))})]})]}),r.jsx(KFe,{editor:s,className:"prose prose-sm max-w-none p-4 min-h-[300px] focus:outline-none [&_.ProseMirror]:outline-none [&_.ProseMirror]:min-h-[280px]"}),n.length>0&&r.jsxs("div",{className:"border-t p-3 bg-muted/20",children:[r.jsx("p",{className:"text-xs text-muted-foreground mb-2",children:"Available variables (click to copy):"}),r.jsx("div",{className:"flex flex-wrap gap-2",children:n.map(l=>r.jsx(Ot,{variant:"secondary",className:"cursor-pointer hover:bg-secondary/80 font-mono text-xs",onClick:()=>{navigator.clipboard.writeText(`{{${l.key}}}`)},children:`{{${l.key}}}`},l.key))})]})]}):null}function ywt(){const t=Vr(),[e,n]=I.useState(null),[s,a]=I.useState(null),[o,l]=I.useState(""),[i,h]=I.useState(""),[p,x]=I.useState(""),[y,b]=I.useState(!0),[j,C]=I.useState("visual"),{data:N,isLoading:A}=Yt({queryKey:["email-templates"],queryFn:async()=>{const{data:F,error:q}=await J.from("email_templates").select("*").order("name");if(q)throw q;return F.map(H=>({...H,available_variables:H.available_variables||[]}))}}),E=cr({mutationFn:async F=>{const{error:q}=await J.from("email_templates").update({subject:F.subject,body_html:F.body_html,description:F.description,is_active:F.is_active}).eq("id",F.id);if(q)throw q},onSuccess:()=>{t.invalidateQueries({queryKey:["email-templates"]}),ze.success("Email template updated successfully"),n(null)},onError:F=>{ze.error("Failed to update template: "+F.message)}}),T=F=>{n(F),l(F.subject),h(F.body_html),x(F.description||""),b(F.is_active),C("visual")},L=()=>{e&&E.mutate({id:e.id,subject:o,body_html:i,description:p,is_active:y})},z=(F,q)=>{let H=F;return q.forEach(Z=>{const G=`{{${Z.key}}}`,te=`[${Z.label}]`;H=H.replace(new RegExp(G.replace(/[{}]/g,"\\$&"),"g"),te)}),H};return e?r.jsxs(Lr,{title:"Edit Email Template",children:[r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsxs(ee,{variant:"ghost",onClick:()=>n(null),children:[r.jsx(so,{className:"h-4 w-4 mr-2"}),"Back to Templates"]}),r.jsx("div",{className:"flex-1"}),r.jsxs(ee,{variant:"outline",onClick:()=>a(e),children:[r.jsx(Qo,{className:"h-4 w-4 mr-2"}),"Preview"]}),r.jsxs(ee,{onClick:L,disabled:E.isPending,children:[r.jsx(vg,{className:"h-4 w-4 mr-2"}),E.isPending?"Saving...":"Save Changes"]})]}),r.jsxs(Ye,{children:[r.jsx(Gt,{children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsxs(Zt,{className:"flex items-center gap-2",children:[r.jsx(da,{className:"h-5 w-5"}),e.name]}),r.jsxs(Mn,{className:"mt-1",children:["Template slug: ",r.jsx("code",{className:"bg-muted px-1 rounded",children:e.slug})]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(He,{htmlFor:"active-toggle",children:"Active"}),r.jsx(Ps,{id:"active-toggle",checked:y,onCheckedChange:b})]})]})}),r.jsxs(tt,{className:"space-y-6",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"description",children:"Description"}),r.jsx(ps,{id:"description",value:p,onChange:F=>x(F.target.value),placeholder:"Brief description of when this email is sent",rows:2})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"subject",children:"Email Subject"}),r.jsx(dt,{id:"subject",value:o,onChange:F=>l(F.target.value),placeholder:"Email subject line"}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:["You can use variables like ","{{name}}"," in the subject"]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(He,{children:"Email Body"}),r.jsx(Ii,{value:j,onValueChange:F=>C(F),children:r.jsxs(wi,{className:"h-8",children:[r.jsxs(ln,{value:"visual",className:"text-xs px-3 h-6",children:[r.jsx(xj,{className:"h-3 w-3 mr-1"}),"Visual"]}),r.jsxs(ln,{value:"html",className:"text-xs px-3 h-6",children:[r.jsx(dj,{className:"h-3 w-3 mr-1"}),"HTML"]})]})})]}),j==="visual"?r.jsx(xwt,{content:i,onChange:h,variables:e.available_variables}):r.jsx(ps,{value:i,onChange:F=>h(F.target.value),className:"font-mono text-sm min-h-[400px]",placeholder:"HTML email body"})]})]})]})]}),r.jsx(Fr,{open:!!s,onOpenChange:()=>a(null),children:r.jsxs(Rr,{className:"max-w-3xl max-h-[90vh] overflow-auto",children:[r.jsxs(qr,{children:[r.jsx($r,{children:"Email Preview"}),r.jsxs(Xn,{children:["Subject: ",o.replace(/\{\{(\w+)\}\}/g,"[$1]")]})]}),r.jsx("div",{className:"border rounded-lg p-4 bg-white",children:r.jsx("div",{dangerouslySetInnerHTML:{__html:z(i,e.available_variables)}})})]})})]}):r.jsx(Lr,{title:"Email Templates",children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold",children:"Email Templates"}),r.jsx("p",{className:"text-muted-foreground mt-1",children:"Manage and customize system email templates"})]}),A?r.jsx("div",{className:"grid gap-4",children:[...Array(4)].map((F,q)=>r.jsx(Ye,{children:r.jsxs(Gt,{children:[r.jsx(Ir,{className:"h-5 w-48"}),r.jsx(Ir,{className:"h-4 w-96"})]})},q))}):r.jsx("div",{className:"grid gap-4",children:N==null?void 0:N.map(F=>r.jsxs(Ye,{className:"hover:shadow-md transition-shadow",children:[r.jsx(Gt,{children:r.jsxs("div",{className:"flex items-start justify-between",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsxs(Zt,{className:"flex items-center gap-2 text-lg",children:[r.jsx(da,{className:"h-5 w-5 text-muted-foreground"}),F.name,!F.is_active&&r.jsx(Ot,{variant:"secondary",children:"Inactive"})]}),r.jsx(Mn,{children:F.description})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs(ee,{variant:"outline",size:"sm",onClick:()=>a(F),children:[r.jsx(Qo,{className:"h-4 w-4 mr-2"}),"Preview"]}),r.jsxs(ee,{size:"sm",onClick:()=>T(F),children:[r.jsx(ac,{className:"h-4 w-4 mr-2"}),"Edit"]})]})]})}),r.jsx(tt,{children:r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[r.jsx("span",{className:"text-muted-foreground",children:"Subject:"}),r.jsx("code",{className:"bg-muted px-2 py-0.5 rounded text-sm",children:F.subject})]}),r.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[r.jsx("span",{className:"text-muted-foreground",children:"Variables:"}),r.jsx("div",{className:"flex flex-wrap gap-1",children:F.available_variables.map(q=>r.jsx(Ot,{variant:"outline",className:"font-mono text-xs",children:`{{${q.key}}}`},q.key))})]})]})})]},F.id))}),r.jsx(Fr,{open:!!s&&!e,onOpenChange:()=>a(null),children:r.jsxs(Rr,{className:"max-w-3xl max-h-[90vh] overflow-auto",children:[r.jsxs(qr,{children:[r.jsxs($r,{children:["Email Preview: ",s==null?void 0:s.name]}),r.jsxs(Xn,{children:["Subject: ",s==null?void 0:s.subject.replace(/\{\{(\w+)\}\}/g,"[$1]")]})]}),s&&r.jsx("div",{className:"border rounded-lg p-4 bg-white",children:r.jsx("div",{dangerouslySetInnerHTML:{__html:z(s.body_html,s.available_variables)}})})]})})]})})}const vwt=({brokerageId:t})=>{var $l,mu;const{toast:e}=fi(),[n,s]=I.useState([]),[a,o]=I.useState(!0),[l,i]=I.useState(""),[h,p]=I.useState("all"),[x,y]=I.useState(new Set),[b,j]=I.useState(!1),[C,N]=I.useState({}),[A,E]=I.useState(!1),[T,L]=I.useState(!1),[z,F]=I.useState({email:"",name:"",password:"",phone:""}),[q,H]=I.useState(!1),[Z,G]=I.useState(null),[te,ie]=I.useState(!1),[le,ye]=I.useState(!1),[ne,ge]=I.useState(!1),[ae,he]=I.useState(""),[ue,_e]=I.useState(!1),[Ae,Ce]=I.useState([]),[be,me]=I.useState(!1),[Le,Ne]=I.useState(!1),[Be,Ee]=I.useState(null),[Ue,Re]=I.useState({name:"",phone:"",email:""}),[je,et]=I.useState(!1),[Te,Ze]=I.useState(!1),[pe,yt]=I.useState(null),[rt,at]=I.useState("asc"),[Me,ft]=I.useState(!1),[qe,Oe]=I.useState(null),[Qe,nt]=I.useState(!1),[gt,mt]=I.useState(null),[Mt,wt]=I.useState(""),[Qt,Cr]=I.useState(!1),[cn,jn]=I.useState(null);I.useEffect(()=>{Pn(),Xr()},[t]);const Xr=async()=>{try{const{data:Je,error:xe}=await J.from("brokerage_manager_assignments").select("user_id").eq("brokerage_id",t);if(xe)throw xe;Ce((Je==null?void 0:Je.map(Ie=>Ie.user_id))||[])}catch(Je){console.error("Error loading brokerage managers:",Je)}},Pn=async()=>{try{o(!0);const{data:Je,error:xe}=await J.functions.invoke("get-brokerage-agents",{body:{brokerageId:t}});if(xe)throw xe;const Ie=Je.agents||[];if(s(Ie),Ie.length>0){const Ge=Ie.map(vt=>vt.id),{data:kt}=await J.from("agent_assistant_assignments").select("agent_id, assistant_id").in("agent_id",Ge);if(kt&&kt.length>0){const vt=kt.map(Pt=>Pt.assistant_id),{data:At}=await J.from("profiles").select("id, name, email").in("id",vt),zt={};for(const Pt of kt){const Ut=At==null?void 0:At.find(fr=>fr.id===Pt.assistant_id);Ut&&(zt[Pt.agent_id]={name:Ut.name||"",email:Ut.email||""})}N(zt)}else N({})}}catch(Je){console.error("Error loading agents:",Je),e({title:"Error",description:"Failed to load agents",variant:"destructive"})}finally{o(!1)}},js=async()=>{if(!z.email||!z.name||!z.password){e({title:"Error",description:"Please fill in all fields",variant:"destructive"});return}L(!0);try{const{data:{session:Je}}=await J.auth.getSession(),xe=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/create-user",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${Je==null?void 0:Je.access_token}`},body:JSON.stringify({...z,brokerageId:t})}),Ie=await xe.json();if(!xe.ok)throw new Error(Ie.error||"Failed to create agent");e({title:"Success",description:`Agent ${z.email} created successfully`}),F({email:"",name:"",password:"",phone:""}),E(!1),Pn()}catch(Je){console.error("Error creating agent:",Je),e({title:"Error",description:Je.message||"Failed to create agent",variant:"destructive"})}finally{L(!1)}},hr=async Je=>{try{const{data:{session:xe}}=await J.auth.getSession(),Ie=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/resend-welcome-email",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${xe==null?void 0:xe.access_token}`},body:JSON.stringify({userId:Je})}),Ge=await Ie.json();if(!Ie.ok)throw new Error(Ge.error||"Failed to resend welcome email");e({title:"Success",description:"Welcome email sent successfully"})}catch(xe){console.error("Error resending welcome email:",xe),e({title:"Error",description:xe.message||"Failed to resend welcome email",variant:"destructive"})}},xs=async(Je,xe)=>{try{const{error:Ie}=await J.functions.invoke("send-password-reset",{body:{email:Je,redirectTo:window.location.origin}});if(Ie)throw Ie;e({title:"Password Reset Sent",description:`Password reset email sent to ${xe}`})}catch(Ie){console.error("Error sending password reset:",Ie),e({title:"Error",description:Ie.message||"Failed to send password reset email",variant:"destructive"})}},ka=Je=>{G(Je),H(!0)},xa=Je=>{Ee(Je),Re({name:Je.name,phone:Je.phone||"",email:Je.email}),Ne(!0)},zi=async()=>{if(!Be)return;if(!Ue.name.trim()){e({title:"Error",description:"Name is required",variant:"destructive"});return}const Je=Ue.email.trim().toLowerCase()!==Be.email.toLowerCase();et(!0);try{if(Je){if(!Ue.email.trim())throw new Error("Email is required");Ze(!0);const{data:{session:Ie}}=await J.auth.getSession(),Ge=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/update-agent-email",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${Ie==null?void 0:Ie.access_token}`},body:JSON.stringify({agentId:Be.id,newEmail:Ue.email.trim(),brokerageId:t})}),kt=await Ge.json();if(Ze(!1),!Ge.ok)throw new Error(kt.error||"Failed to update email")}const{error:xe}=await J.from("profiles").update({name:Ue.name.trim(),phone:Ue.phone.trim()||null}).eq("id",Be.id);if(xe)throw xe;e({title:"Success",description:"Agent profile updated successfully"}),Ne(!1),Ee(null),Pn()}catch(xe){console.error("Error updating agent:",xe),e({title:"Error",description:xe.message||"Failed to update agent",variant:"destructive"})}finally{et(!1),Ze(!1)}},Bi=async()=>{if(!ae){e({title:"Error",description:"Please select an agent to promote",variant:"destructive"});return}_e(!0);try{const{data:{session:Je}}=await J.auth.getSession(),xe=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/manage-user-roles",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${Je==null?void 0:Je.access_token}`},body:JSON.stringify({userId:ae,role:"brokerage_manager",action:"add",brokerageId:t})}),Ie=await xe.json();if(!xe.ok)throw new Error(Ie.error||"Failed to add brokerage manager");e({title:"Success",description:"Brokerage manager added successfully"}),ge(!1),he(""),Xr()}catch(Je){console.error("Error adding brokerage manager:",Je),e({title:"Error",description:Je.message||"Failed to add brokerage manager",variant:"destructive"})}finally{_e(!1)}},tl=async Je=>{try{const{data:{session:xe}}=await J.auth.getSession(),Ie=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/manage-user-roles",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${xe==null?void 0:xe.access_token}`},body:JSON.stringify({userId:Je,role:"brokerage_manager",action:"remove",brokerageId:t})}),Ge=await Ie.json();if(!Ie.ok)throw new Error(Ge.error||"Failed to remove brokerage manager");e({title:"Success",description:"Brokerage manager role removed"}),Xr()}catch(xe){console.error("Error removing brokerage manager:",xe),e({title:"Error",description:xe.message||"Failed to remove brokerage manager",variant:"destructive"})}},xo=Je=>Ae.includes(Je),Hs=Je=>{mt(Je),wt(""),nt(!0)},Xa=async()=>{if(!(!gt||!Mt)){if(Mt.length<6){e({title:"Error",description:"Password must be at least 6 characters",variant:"destructive"});return}Cr(!0);try{const{data:{session:Je}}=await J.auth.getSession(),xe=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/update-agent-email",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${Je==null?void 0:Je.access_token}`},body:JSON.stringify({agentId:gt.id,brokerageId:t,action:"set_password",newPassword:Mt})}),Ie=await xe.json();if(!xe.ok)throw new Error(Ie.error||"Failed to set password");e({title:"Success",description:`Password set for ${gt.name}`}),nt(!1),mt(null),wt("")}catch(Je){console.error("Error setting password:",Je),e({title:"Error",description:Je.message||"Failed to set password",variant:"destructive"})}finally{Cr(!1)}}},Ns=async Je=>{jn(Je.id);try{const{data:{session:xe}}=await J.auth.getSession(),Ie=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/update-agent-email",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${xe==null?void 0:xe.access_token}`},body:JSON.stringify({agentId:Je.id,brokerageId:t,action:"claim_account"})}),Ge=await Ie.json();if(!Ie.ok)throw new Error(Ge.error||"Failed to claim account");e({title:"Success",description:`Account claimed for ${Je.name}`}),Pn()}catch(xe){console.error("Error claiming account:",xe),e({title:"Error",description:xe.message||"Failed to claim account",variant:"destructive"})}finally{jn(null)}},Fa=async()=>{if(Z){ie(!0);try{const{data:{session:Je}}=await J.auth.getSession(),xe=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/remove-agent",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${Je==null?void 0:Je.access_token}`},body:JSON.stringify({userId:Z.id,brokerageId:t})}),Ie=await xe.json();if(!xe.ok)throw new Error(Ie.error||"Failed to remove agent");e({title:"Success",description:`${Z.name} has been removed from your brokerage`}),H(!1),G(null),Pn()}catch(Je){console.error("Error removing agent:",Je),e({title:"Error",description:Je.message||"Failed to remove agent",variant:"destructive"})}finally{ie(!1)}}},Oa=Je=>{const xe=Je.trim().split(" ");return xe.length>1?xe[xe.length-1].toLowerCase():Je.toLowerCase()},Do=Je=>{pe===Je?at(rt==="asc"?"desc":"asc"):(yt(Je),at("asc"))},ir=Je=>pe!==Je?r.jsx(zx,{className:"ml-1 h-4 w-4"}):rt==="asc"?r.jsx(mg,{className:"ml-1 h-4 w-4"}):r.jsx(i1,{className:"ml-1 h-4 w-4"}),fo=n.filter(Je=>{if(h==="active"&&!Je.claimed||h==="pending"&&Je.claimed)return!1;if(!l)return!0;const xe=l.toLowerCase();return Je.name.toLowerCase().includes(xe)||Je.email.toLowerCase().includes(xe)}),pl=[...fo].sort((Je,xe)=>{if(!pe)return 0;let Ie=0;return pe==="name"?Ie=Oa(Je.name).localeCompare(Oa(xe.name)):pe==="status"&&(Ie=Je.claimed===xe.claimed?0:Je.claimed?-1:1),rt==="asc"?Ie:-Ie});fo.filter(Je=>Je.claimed&&!xo(Je.id));const To=Je=>{y(xe=>{const Ie=new Set(xe);return Ie.has(Je)?Ie.delete(Je):Ie.add(Je),Ie})},ss=()=>{x.size===pl.length?y(new Set):y(new Set(pl.map(Je=>Je.id)))},yo=()=>{y(new Set)},pu=async()=>{const Je=Array.from(x);if(Je.length===0)return;j(!0);let xe=0,Ie=0;try{const{data:{session:Ge}}=await J.auth.getSession();for(const kt of Je)try{(await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/resend-welcome-email",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${Ge==null?void 0:Ge.access_token}`},body:JSON.stringify({userId:kt})})).ok?xe++:Ie++}catch{Ie++}xe>0?e({title:"Success",description:`Welcome emails sent to ${xe} agent${xe>1?"s":""}${Ie>0?` (${Ie} failed)`:""}`}):e({title:"Error",description:"Failed to send welcome emails",variant:"destructive"}),yo()}catch(Ge){console.error("Error bulk sending welcome emails:",Ge),e({title:"Error",description:Ge.message||"Failed to send welcome emails",variant:"destructive"})}finally{j(!1)}};return a?r.jsx(Ye,{children:r.jsx(tt,{className:"flex items-center justify-center py-8",children:r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})})}):r.jsxs(r.Fragment,{children:[r.jsxs(Ye,{children:[r.jsx(Gt,{children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Zt,{children:"Agents"}),r.jsx(Mn,{children:"Manage your brokerage's agents"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs(ee,{variant:"outline",onClick:()=>ge(!0),children:[r.jsx(rf,{className:"mr-2 h-4 w-4"}),"Add Brokerage Manager"]}),r.jsxs(ee,{variant:"outline",onClick:()=>ye(!0),children:[r.jsx(p1,{className:"mr-2 h-4 w-4"}),"Import CSV"]}),r.jsxs(ee,{onClick:()=>E(!0),children:[r.jsx(nf,{className:"mr-2 h-4 w-4"}),"Add Agent"]})]})]})}),r.jsxs(tt,{children:[r.jsxs("div",{className:"mb-4 flex flex-col gap-4 sm:flex-row sm:items-center",children:[r.jsxs("div",{className:"relative flex-1",children:[r.jsx(wa,{className:"absolute left-3 top-3 h-4 w-4 text-muted-foreground"}),r.jsx(dt,{placeholder:"Search agents...",value:l,onChange:Je=>i(Je.target.value),className:"pl-9"})]}),r.jsxs(gn,{value:h,onValueChange:Je=>p(Je),children:[r.jsx(fn,{className:"w-[160px]",children:r.jsx(xn,{placeholder:"Filter by status"})}),r.jsxs(pn,{children:[r.jsx(Vt,{value:"all",children:"All Agents"}),r.jsx(Vt,{value:"active",children:"Active"}),r.jsx(Vt,{value:"pending",children:"Pending"})]})]})]}),x.size>0&&r.jsxs("div",{className:"mb-4 flex items-center gap-3 rounded-lg border bg-muted/50 p-3",children:[r.jsxs("span",{className:"text-sm font-medium",children:[x.size," agent",x.size>1?"s":""," selected"]}),r.jsx("div",{className:"flex-1"}),r.jsxs(ee,{size:"sm",variant:"outline",onClick:pu,disabled:b,children:[r.jsx(da,{className:"mr-2 h-4 w-4"}),b?"Sending...":"Resend Welcome Email"]}),r.jsx(ee,{size:"sm",variant:"ghost",onClick:yo,children:"Clear"})]}),r.jsx("div",{className:"rounded-md border",children:r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Ar,{children:[r.jsx(It,{className:"w-[40px]",children:r.jsx(Dl,{checked:pl.length>0&&x.size===pl.length,onCheckedChange:ss,"aria-label":"Select all"})}),r.jsx(It,{children:r.jsxs(ee,{variant:"ghost",size:"sm",className:"-ml-3 h-8 hover:bg-transparent",onClick:()=>Do("name"),children:["Name (Last)",ir("name")]})}),r.jsx(It,{children:"Email"}),r.jsx(It,{children:r.jsxs(ee,{variant:"ghost",size:"sm",className:"-ml-3 h-8 hover:bg-transparent",onClick:()=>Do("status"),children:["Status",ir("status")]})}),r.jsx(It,{children:"Actions"})]})}),r.jsx(Vs,{children:pl.length===0?r.jsx(Ar,{children:r.jsx(Nt,{colSpan:5,className:"text-center text-muted-foreground",children:"No agents found"})}):pl.map(Je=>r.jsxs(Ar,{children:[r.jsx(Nt,{children:r.jsx(Dl,{checked:x.has(Je.id),onCheckedChange:()=>To(Je.id),"aria-label":`Select ${Je.name}`})}),r.jsx(Nt,{className:"font-medium",children:Je.name}),r.jsx(Nt,{children:Je.email}),r.jsx(Nt,{children:r.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[Je.claimed?r.jsx(Ot,{variant:"default",children:"Active"}):r.jsx(Ot,{variant:"secondary",children:"Pending"}),xo(Je.id)&&r.jsxs(Ot,{variant:"outline",className:"border-primary text-primary",children:[r.jsx(GT,{className:"mr-1 h-3 w-3"}),"Manager"]}),C[Je.id]&&r.jsxs(Ot,{variant:"outline",className:"text-xs",children:[r.jsx(Bn,{className:"mr-1 h-3 w-3"}),"Asst: ",C[Je.id].name||C[Je.id].email]})]})}),r.jsx(Nt,{children:r.jsxs("div",{className:"flex items-center gap-1 flex-wrap",children:[r.jsx(ee,{size:"sm",variant:"ghost",onClick:()=>{Oe(Je),ft(!0)},title:"Send celebration",className:"text-yellow-500 hover:text-yellow-600 hover:bg-yellow-50",children:r.jsx(Ac,{className:"h-4 w-4"})}),r.jsx(ee,{size:"sm",variant:"ghost",onClick:()=>xa(Je),title:"Edit agent",children:r.jsx(_i,{className:"h-4 w-4"})}),!Je.claimed&&r.jsxs(r.Fragment,{children:[r.jsx(ee,{size:"sm",variant:"ghost",onClick:()=>hr(Je.id),title:"Resend welcome email",children:r.jsx(da,{className:"h-4 w-4"})}),r.jsx(ee,{size:"sm",variant:"ghost",onClick:()=>Ns(Je),title:"Claim account for agent",disabled:cn===Je.id,className:"text-green-600 hover:text-green-700 hover:bg-green-50",children:r.jsx(wj,{className:"h-4 w-4"})})]}),r.jsx(ee,{size:"sm",variant:"ghost",onClick:()=>Hs(Je),title:"Set password",className:"text-blue-600 hover:text-blue-700 hover:bg-blue-50",children:r.jsx(Zf,{className:"h-4 w-4"})}),r.jsx(ee,{size:"sm",variant:"ghost",onClick:()=>xs(Je.email,Je.name),title:"Send password reset email",children:r.jsx(mj,{className:"h-4 w-4"})}),xo(Je.id)&&r.jsx(ee,{size:"sm",variant:"ghost",onClick:()=>tl(Je.id),title:"Remove manager role",className:"text-orange-500 hover:text-orange-600",children:r.jsx(rf,{className:"h-4 w-4"})}),r.jsx(ee,{size:"sm",variant:"ghost",onClick:()=>ka(Je),className:"text-destructive hover:text-destructive",title:"Remove agent",children:r.jsx(Vn,{className:"h-4 w-4"})})]})})]},Je.id))})]})})]})]}),r.jsx(Fr,{open:A,onOpenChange:E,children:r.jsxs(Rr,{children:[r.jsxs(qr,{children:[r.jsx($r,{children:"Add New Agent"}),r.jsx(Xn,{children:"Create a new agent account. They'll receive an email to set up their account."})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx(He,{htmlFor:"name",children:"Name"}),r.jsx(dt,{id:"name",value:z.name,onChange:Je=>F({...z,name:Je.target.value}),placeholder:"John Doe"})]}),r.jsxs("div",{children:[r.jsx(He,{htmlFor:"email",children:"Email"}),r.jsx(dt,{id:"email",type:"email",value:z.email,onChange:Je=>F({...z,email:Je.target.value}),placeholder:"john@example.com"})]}),r.jsxs("div",{children:[r.jsx(He,{htmlFor:"phone",children:"Phone (optional)"}),r.jsx(dt,{id:"phone",type:"tel",value:z.phone,onChange:Je=>F({...z,phone:Je.target.value}),placeholder:"555-123-4567"})]}),r.jsxs("div",{children:[r.jsx(He,{htmlFor:"password",children:"Temporary Password"}),r.jsx(dt,{id:"password",type:"password",value:z.password,onChange:Je=>F({...z,password:Je.target.value}),placeholder:"Temporary password"})]})]}),r.jsxs(ea,{children:[r.jsx(ee,{variant:"outline",onClick:()=>E(!1),children:"Cancel"}),r.jsx(ee,{onClick:js,disabled:T,children:T?"Creating...":"Create Agent"})]})]})}),r.jsx(Fr,{open:q,onOpenChange:H,children:r.jsxs(Rr,{children:[r.jsxs(qr,{children:[r.jsx($r,{children:"Remove Agent"}),r.jsxs(Xn,{children:["Are you sure you want to remove ",r.jsx("strong",{children:Z==null?void 0:Z.name})," from your brokerage? This will revoke their access to the dashboard."]})]}),r.jsxs(ea,{children:[r.jsx(ee,{variant:"outline",onClick:()=>H(!1),children:"Cancel"}),r.jsx(ee,{variant:"destructive",onClick:Fa,disabled:te,children:te?"Removing...":"Remove Agent"})]})]})}),r.jsx(iRe,{open:le,onOpenChange:ye,fixedBrokerageId:t,onSuccess:Pn}),r.jsx(Fr,{open:ne,onOpenChange:ge,children:r.jsxs(Rr,{children:[r.jsxs(qr,{children:[r.jsx($r,{children:"Add Brokerage Manager"}),r.jsx(Xn,{children:"Promote an existing active agent to brokerage manager. They will be able to manage agents and view analytics."})]}),r.jsx("div",{className:"space-y-4",children:r.jsxs("div",{children:[r.jsx(He,{children:"Select Agent"}),r.jsxs(zu,{open:be,onOpenChange:me,children:[r.jsx(Bu,{asChild:!0,children:r.jsxs(ee,{variant:"outline",role:"combobox","aria-expanded":be,className:"w-full justify-between",children:[ae?(($l=n.find(Je=>Je.id===ae))==null?void 0:$l.name)+" ("+((mu=n.find(Je=>Je.id===ae))==null?void 0:mu.email)+")":"Select an agent to promote...",r.jsx(d1,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),r.jsx(uu,{className:"w-full p-0",align:"start",children:r.jsxs(q1,{children:[r.jsx(V1,{placeholder:"Search by name or email..."}),r.jsxs(H1,{className:"max-h-[200px]",children:[r.jsx(W1,{children:"No eligible agents found."}),r.jsx(G1,{children:n.filter(Je=>!xo(Je.id)).map(Je=>r.jsxs(K1,{value:`${Je.name} ${Je.email}`,onSelect:()=>{he(Je.id),me(!1)},children:[r.jsx(Ai,{className:`mr-2 h-4 w-4 ${ae===Je.id?"opacity-100":"opacity-0"}`}),Je.name," (",Je.email,")"]},Je.id))})]})]})})]}),n.filter(Je=>!xo(Je.id)).length===0&&r.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:"All agents are already brokerage managers."})]})}),r.jsxs(ea,{children:[r.jsx(ee,{variant:"outline",onClick:()=>ge(!1),children:"Cancel"}),r.jsx(ee,{onClick:Bi,disabled:ue||!ae,children:ue?"Adding...":"Add as Manager"})]})]})}),r.jsx(Fr,{open:Le,onOpenChange:Ne,children:r.jsxs(Rr,{children:[r.jsxs(qr,{children:[r.jsx($r,{children:"Edit Agent"}),r.jsxs(Xn,{children:["Update profile information for ",Be==null?void 0:Be.name]})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx(He,{htmlFor:"edit-name",children:"Name"}),r.jsx(dt,{id:"edit-name",value:Ue.name,onChange:Je=>Re({...Ue,name:Je.target.value}),placeholder:"Agent name"})]}),r.jsxs("div",{children:[r.jsx(He,{htmlFor:"edit-email",children:"Email"}),r.jsx(dt,{id:"edit-email",type:"email",value:Ue.email,onChange:Je=>Re({...Ue,email:Je.target.value}),placeholder:"agent@example.com"}),Ue.email.trim().toLowerCase()!==(Be==null?void 0:Be.email.toLowerCase())&&r.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Changing email will update their login credentials"})]}),r.jsxs("div",{children:[r.jsx(He,{htmlFor:"edit-phone",children:"Phone"}),r.jsx(dt,{id:"edit-phone",type:"tel",value:Ue.phone,onChange:Je=>Re({...Ue,phone:Je.target.value}),placeholder:"555-123-4567"})]})]}),r.jsxs(ea,{children:[r.jsx(ee,{variant:"outline",onClick:()=>Ne(!1),children:"Cancel"}),r.jsx(ee,{onClick:zi,disabled:je||Te,children:Te?"Updating email...":je?"Saving...":"Save Changes"})]})]})}),qe&&r.jsx(oRe,{open:Me,onOpenChange:Je=>{ft(Je),Je||Oe(null)},userId:qe.id,userName:qe.name}),r.jsx(Fr,{open:Qe,onOpenChange:nt,children:r.jsxs(Rr,{children:[r.jsxs(qr,{children:[r.jsx($r,{children:"Set Password"}),r.jsxs(Xn,{children:["Set a new password for ",gt==null?void 0:gt.name,". They will be able to log in with this password immediately."]})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx(He,{htmlFor:"new-password",children:"New Password"}),r.jsx(dt,{id:"new-password",type:"password",value:Mt,onChange:Je=>wt(Je.target.value),placeholder:"Enter new password (min 6 characters)"})]}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Make sure to communicate this password to the agent through a secure channel."})]}),r.jsxs(ea,{children:[r.jsx(ee,{variant:"outline",onClick:()=>nt(!1),children:"Cancel"}),r.jsx(ee,{onClick:Xa,disabled:Qt||!Mt||Mt.length<6,children:Qt?"Setting...":"Set Password"})]})]})})]})},_wt={academy_video:"Academy Video",template:"Template",toolbox:"Toolbox Resource",newsletter:"Newsletter",social_swag:"Social Swag",event:"Event"},bwt={view:"Viewed",click_canva:"Opened Canva",click_pdf:"Downloaded PDF",click_video:"Watched Video",click_link:"Clicked Link",register:"Registered"},wwt=t=>{switch(t){case"academy_video":return r.jsx(Pa,{className:"h-4 w-4"});case"template":return r.jsx(La,{className:"h-4 w-4"});case"toolbox":return r.jsx(La,{className:"h-4 w-4"});case"newsletter":return r.jsx(Vx,{className:"h-4 w-4"});case"social_swag":return r.jsx(Ms,{className:"h-4 w-4"});case"event":return r.jsx(zs,{className:"h-4 w-4"});default:return r.jsx(Fs,{className:"h-4 w-4"})}},jwt=({brokerageId:t})=>{const{toast:e}=fi(),[n,s]=I.useState([]),[a,o]=I.useState([]),[l,i]=I.useState([]),[h,p]=I.useState(!0),[x,y]=I.useState(null);I.useEffect(()=>{b()},[t]);const b=async()=>{try{p(!0);const{data:N,error:A}=await J.from("profiles").select("id, name, email").eq("brokerage_id",t);if(A)throw A;const E=N.map(ie=>ie.id),T=new Map(N.map(ie=>[ie.id,ie]));if(E.length===0){s([]),o([]),i([]);return}const{data:L,error:z}=await J.from("activity_logs").select("*").in("user_id",E).order("launched_at",{ascending:!1});if(z)throw z;const F=L.map(ie=>{var le,ye;return{id:ie.id,user_id:ie.user_id,app_name:ie.app_name,launched_at:ie.launched_at,user_name:((le=T.get(ie.user_id))==null?void 0:le.name)||"Unknown",user_email:((ye=T.get(ie.user_id))==null?void 0:ye.email)||"Unknown"}});s(F);const{data:q,error:H}=await J.from("content_engagement_logs").select("*").in("user_id",E).order("created_at",{ascending:!1});if(H)throw H;const Z=(q||[]).map(ie=>{var le,ye;return{id:ie.id,user_id:ie.user_id,resource_type:ie.resource_type,resource_id:ie.resource_id,resource_title:ie.resource_title,action_type:ie.action_type,created_at:ie.created_at,user_name:((le=T.get(ie.user_id))==null?void 0:le.name)||"Unknown",user_email:((ye=T.get(ie.user_id))==null?void 0:ye.email)||"Unknown"}});o(Z);const G=new Map;N.forEach(ie=>{G.set(ie.id,{user_id:ie.id,user_name:ie.name,user_email:ie.email,app_launches:0,content_views:0,last_activity:""})}),F.forEach(ie=>{const le=G.get(ie.user_id);le&&(le.app_launches++,(!le.last_activity||new Date(ie.launched_at)>new Date(le.last_activity))&&(le.last_activity=ie.launched_at))}),Z.forEach(ie=>{const le=G.get(ie.user_id);le&&(le.content_views++,(!le.last_activity||new Date(ie.created_at)>new Date(le.last_activity))&&(le.last_activity=ie.created_at))});const te=Array.from(G.values()).filter(ie=>ie.app_launches>0||ie.content_views>0).sort((ie,le)=>new Date(le.last_activity).getTime()-new Date(ie.last_activity).getTime());i(te)}catch(N){console.error("Error loading activity:",N),e({title:"Error",description:"Failed to load activity logs",variant:"destructive"})}finally{p(!1)}},j=N=>n.filter(A=>A.user_id===N),C=N=>a.filter(A=>A.user_id===N);return h?r.jsx(Ye,{children:r.jsx(tt,{className:"flex items-center justify-center py-8",children:r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})})}):r.jsxs(r.Fragment,{children:[r.jsxs(Ye,{children:[r.jsxs(Gt,{children:[r.jsx(Zt,{children:"Agent Activity"}),r.jsx(Mn,{children:"Track app usage and content engagement - click an agent for details"})]}),r.jsx(tt,{children:r.jsx("div",{className:"rounded-md border",children:r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Ar,{children:[r.jsx(It,{children:"Agent"}),r.jsx(It,{className:"text-center",children:"App Launches"}),r.jsx(It,{className:"text-center",children:"Content Views"}),r.jsx(It,{children:"Last Active"})]})}),r.jsx(Vs,{children:l.length===0?r.jsx(Ar,{children:r.jsx(Nt,{colSpan:4,className:"text-center text-muted-foreground",children:"No activity yet"})}):l.map(N=>r.jsxs(Ar,{className:"cursor-pointer hover:bg-muted/50 transition-colors",onClick:()=>y({id:N.user_id,name:N.user_name,email:N.user_email}),children:[r.jsx(Nt,{children:r.jsxs("div",{children:[r.jsx("div",{className:"font-medium",children:N.user_name}),r.jsx("div",{className:"text-sm text-muted-foreground",children:N.user_email})]})}),r.jsx(Nt,{className:"text-center",children:r.jsxs(Ot,{variant:"outline",className:"gap-1",children:[r.jsx(hc,{className:"h-3 w-3"}),N.app_launches]})}),r.jsx(Nt,{className:"text-center",children:r.jsxs(Ot,{variant:"secondary",className:"gap-1",children:[r.jsx(La,{className:"h-3 w-3"}),N.content_views]})}),r.jsx(Nt,{className:"text-sm text-muted-foreground",children:N.last_activity&&cu(new Date(N.last_activity),{addSuffix:!0})})]},N.user_id))})]})})})]}),r.jsx(Fr,{open:!!x,onOpenChange:N=>!N&&y(null),children:r.jsxs(Rr,{className:"max-w-3xl max-h-[80vh] overflow-hidden flex flex-col",children:[r.jsxs(qr,{children:[r.jsxs($r,{children:[x==null?void 0:x.name,"'s Activity"]}),r.jsx(Xn,{children:x==null?void 0:x.email})]}),r.jsxs(Ii,{defaultValue:"content",className:"flex-1 overflow-hidden flex flex-col",children:[r.jsxs(wi,{className:"grid w-full grid-cols-2",children:[r.jsx(ln,{value:"content",children:"Content Engagement"}),r.jsx(ln,{value:"apps",children:"App Launches"})]}),r.jsx(An,{value:"content",className:"flex-1 overflow-auto",children:r.jsx("div",{className:"rounded-md border",children:r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Ar,{children:[r.jsx(It,{children:"Resource"}),r.jsx(It,{children:"Type"}),r.jsx(It,{children:"Action"}),r.jsx(It,{children:"Time"})]})}),r.jsx(Vs,{children:x&&C(x.id).length===0?r.jsx(Ar,{children:r.jsx(Nt,{colSpan:4,className:"text-center text-muted-foreground",children:"No content engagement yet"})}):x&&C(x.id).map(N=>r.jsxs(Ar,{children:[r.jsx(Nt,{className:"max-w-[200px] truncate font-medium",children:N.resource_title}),r.jsx(Nt,{children:r.jsxs(Ot,{variant:"outline",className:"gap-1",children:[wwt(N.resource_type),_wt[N.resource_type]||N.resource_type]})}),r.jsx(Nt,{children:r.jsx("span",{className:"text-sm text-muted-foreground",children:bwt[N.action_type]||N.action_type})}),r.jsx(Nt,{className:"text-sm text-muted-foreground",children:cu(new Date(N.created_at),{addSuffix:!0})})]},N.id))})]})})}),r.jsx(An,{value:"apps",className:"flex-1 overflow-auto",children:r.jsx("div",{className:"rounded-md border",children:r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Ar,{children:[r.jsx(It,{children:"App"}),r.jsx(It,{children:"Time"})]})}),r.jsx(Vs,{children:x&&j(x.id).length===0?r.jsx(Ar,{children:r.jsx(Nt,{colSpan:2,className:"text-center text-muted-foreground",children:"No app launches yet"})}):x&&j(x.id).map(N=>r.jsxs(Ar,{children:[r.jsx(Nt,{children:r.jsx(Ot,{variant:"outline",children:N.app_name})}),r.jsx(Nt,{className:"text-sm text-muted-foreground",children:cu(new Date(N.launched_at),{addSuffix:!0})})]},N.id))})]})})})]})]})})]})},kwt=({brokerageId:t})=>{const{toast:e}=fi(),[n,s]=I.useState({totalAgents:0,activeAgents:0,pendingAgents:0,totalLaunches:0,launchesThisWeek:0,launchesThisMonth:0}),[a,o]=I.useState(!0);I.useEffect(()=>{l()},[t]);const l=async()=>{try{o(!0);const{data:i,error:h}=await J.from("profiles").select("id").eq("brokerage_id",t);if(h)throw h;const p=i.map(F=>F.id),x=p.length;if(p.length===0){o(!1);return}const{data:y,error:b}=await J.from("profiles").select("id, email").in("id",p);if(b)throw b;const{count:j}=await J.from("profiles").select("*",{count:"exact",head:!0}).eq("brokerage_id",t).not("last_login","is",null),C=j||0,N=x-C,{count:A}=await J.from("activity_logs").select("*",{count:"exact",head:!0}).in("user_id",p),E=new Date;E.setDate(E.getDate()-7);const{count:T}=await J.from("activity_logs").select("*",{count:"exact",head:!0}).in("user_id",p).gte("launched_at",E.toISOString()),L=new Date;L.setMonth(L.getMonth()-1);const{count:z}=await J.from("activity_logs").select("*",{count:"exact",head:!0}).in("user_id",p).gte("launched_at",L.toISOString());s({totalAgents:x,activeAgents:C,pendingAgents:N,totalLaunches:A||0,launchesThisWeek:T||0,launchesThisMonth:z||0})}catch(i){console.error("Error loading analytics:",i),e({title:"Error",description:"Failed to load analytics",variant:"destructive"})}finally{o(!1)}};return a?r.jsx(Ye,{children:r.jsx(tt,{className:"flex items-center justify-center py-8",children:r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})})}):r.jsxs("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:[r.jsxs(Ye,{children:[r.jsxs(Gt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Zt,{className:"text-sm font-medium",children:"Total Agents"}),r.jsx(Bn,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(tt,{children:[r.jsx("div",{className:"text-2xl font-bold",children:n.totalAgents}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[n.activeAgents," active, ",n.pendingAgents," pending"]})]})]}),r.jsxs(Ye,{children:[r.jsxs(Gt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Zt,{className:"text-sm font-medium",children:"Active Agents"}),r.jsx(Yi,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(tt,{children:[r.jsx("div",{className:"text-2xl font-bold",children:n.activeAgents}),r.jsx("p",{className:"text-xs text-muted-foreground",children:n.totalAgents>0?`${Math.round(n.activeAgents/n.totalAgents*100)}% of total`:"0% of total"})]})]}),r.jsxs(Ye,{children:[r.jsxs(Gt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Zt,{className:"text-sm font-medium",children:"Pending Invites"}),r.jsx(Ya,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(tt,{children:[r.jsx("div",{className:"text-2xl font-bold",children:n.pendingAgents}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Awaiting setup"})]})]}),r.jsxs(Ye,{children:[r.jsxs(Gt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Zt,{className:"text-sm font-medium",children:"Total App Launches"}),r.jsx(pg,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(tt,{children:[r.jsx("div",{className:"text-2xl font-bold",children:n.totalLaunches}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"All time"})]})]}),r.jsxs(Ye,{children:[r.jsxs(Gt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Zt,{className:"text-sm font-medium",children:"This Week"}),r.jsx(pg,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(tt,{children:[r.jsx("div",{className:"text-2xl font-bold",children:n.launchesThisWeek}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Last 7 days"})]})]}),r.jsxs(Ye,{children:[r.jsxs(Gt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Zt,{className:"text-sm font-medium",children:"This Month"}),r.jsx(pg,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(tt,{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"})]})]})]})},Nwt=({brokerageId:t})=>{const[e,n]=I.useState([]),[s,a]=I.useState(!0),[o,l]=I.useState(!1),[i,h]=I.useState(!1),[p,x]=I.useState({description:"",maxUses:""});I.useEffect(()=>{y()},[t]);const y=async()=>{try{const{data:E,error:T}=await J.from("invite_codes").select("*").eq("brokerage_id",t).order("created_at",{ascending:!1});if(T)throw T;n(E||[])}catch(E){console.error("Error loading invite codes:",E),ze.error("Failed to load invite links")}finally{a(!1)}},b=()=>Math.random().toString(36).substring(2,8).toUpperCase(),j=async()=>{l(!0);try{const E=b(),{error:T}=await J.from("invite_codes").insert({code:E,description:p.description||null,max_uses:p.maxUses?parseInt(p.maxUses):null,brokerage_id:t,is_active:!0});if(T)throw T;ze.success("Invite link created!"),h(!1),x({description:"",maxUses:""}),y()}catch(E){console.error("Error creating invite code:",E),ze.error("Failed to create invite link")}finally{l(!1)}},C=async E=>{try{const{error:T}=await J.from("invite_codes").delete().eq("id",E);if(T)throw T;ze.success("Invite link deleted"),n(e.filter(L=>L.id!==E))}catch(T){console.error("Error deleting invite code:",T),ze.error("Failed to delete invite link")}},N=async(E,T)=>{try{const{error:L}=await J.from("invite_codes").update({is_active:!T}).eq("id",E);if(L)throw L;n(e.map(z=>z.id===E?{...z,is_active:!T}:z)),ze.success(`Invite link ${T?"deactivated":"activated"}`)}catch(L){console.error("Error toggling invite code:",L),ze.error("Failed to update invite link")}},A=E=>{const T=`${window.location.origin}/join?code=${E}`;navigator.clipboard.writeText(T),ze.success("Link copied to clipboard!")};return s?r.jsx(Ye,{children:r.jsx(tt,{className:"flex items-center justify-center py-8",children:r.jsx(en,{className:"h-6 w-6 animate-spin text-muted-foreground"})})}):r.jsxs(Ye,{children:[r.jsxs(Gt,{className:"flex flex-row items-center justify-between",children:[r.jsxs("div",{children:[r.jsxs(Zt,{className:"flex items-center gap-2",children:[r.jsx(Co,{className:"h-5 w-5"}),"Agent Invite Links"]}),r.jsx(Mn,{children:"Create shareable links for agents to join your brokerage"})]}),r.jsxs(Fr,{open:i,onOpenChange:h,children:[r.jsx(zo,{asChild:!0,children:r.jsxs(ee,{size:"sm",children:[r.jsx(bn,{className:"mr-2 h-4 w-4"}),"Create Link"]})}),r.jsxs(Rr,{children:[r.jsxs(qr,{children:[r.jsx($r,{children:"Create Invite Link"}),r.jsx(Xn,{children:"Create a new invite link for agents to join your brokerage"})]}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"description",children:"Description (optional)"}),r.jsx(dt,{id:"description",placeholder:"e.g., New agent recruiting campaign",value:p.description,onChange:E=>x({...p,description:E.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"maxUses",children:"Max Uses (optional)"}),r.jsx(dt,{id:"maxUses",type:"number",placeholder:"Leave empty for unlimited",value:p.maxUses,onChange:E=>x({...p,maxUses:E.target.value})})]}),r.jsx(ee,{onClick:j,disabled:o,className:"w-full",children:o?r.jsxs(r.Fragment,{children:[r.jsx(en,{className:"mr-2 h-4 w-4 animate-spin"}),"Creating..."]}):"Create Invite Link"})]})]})]})]}),r.jsx(tt,{children:e.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(Co,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),r.jsx("p",{children:"No invite links yet"}),r.jsx("p",{className:"text-sm",children:"Create one to start inviting agents"})]}):r.jsx("div",{className:"space-y-3",children:e.map(E=>r.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg border bg-card",children:[r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("code",{className:"text-sm font-mono bg-muted px-2 py-0.5 rounded",children:E.code}),r.jsx(Ot,{variant:E.is_active?"default":"secondary",children:E.is_active?"Active":"Inactive"})]}),E.description&&r.jsx("p",{className:"text-sm text-muted-foreground mt-1 truncate",children:E.description}),r.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:[E.uses_count," uses",E.max_uses&&` / ${E.max_uses} max`]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>A(E.code),title:"Copy link",children:r.jsx(hl,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>N(E.id,E.is_active),title:E.is_active?"Deactivate":"Activate",children:E.is_active?"Disable":"Enable"}),r.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>C(E.id),className:"text-destructive hover:text-destructive",title:"Delete",children:r.jsx(Vn,{className:"h-4 w-4"})})]})]},E.id))})})]})},Swt=({open:t,onOpenChange:e,referralCode:n,brokerageId:s,senderName:a,brokerageName:o,onInvitesSent:l})=>{const[i,h]=I.useState(""),[p,x]=I.useState([]),[y,b]=I.useState(""),[j,C]=I.useState(!1),N=z=>/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(z),A=()=>{const z=i.trim().toLowerCase();if(z&&N(z)&&!p.includes(z)){if(p.length>=10){ze.error("Maximum 10 emails per invite");return}x([...p,z]),h("")}else z&&!N(z)?ze.error("Please enter a valid email address"):p.includes(z)&&ze.error("Email already added")},E=z=>{x(p.filter(F=>F!==z))},T=z=>{(z.key==="Enter"||z.key===",")&&(z.preventDefault(),A())},L=async()=>{if(p.length===0){ze.error("Please add at least one email address");return}C(!0);try{const{data:z,error:F}=await J.functions.invoke("send-referral-invite",{body:{emails:p,personalMessage:y.trim()||void 0,referralCode:n,brokerageId:s,senderName:a,brokerageName:o}});if(F)throw F;z.successCount===z.totalCount?ze.success(`${z.successCount} invite${z.successCount>1?"s":""} sent successfully!`):ze.warning(`${z.successCount} of ${z.totalCount} invites sent. Some failed.`),x([]),b(""),e(!1),l==null||l()}catch(z){console.error("Error sending invites:",z),ze.error("Failed to send invites. Please try again.")}finally{C(!1)}};return r.jsx(Fr,{open:t,onOpenChange:e,children:r.jsxs(Rr,{className:"sm:max-w-[550px]",children:[r.jsxs(qr,{children:[r.jsxs($r,{className:"flex items-center gap-2",children:[r.jsx(da,{className:"h-5 w-5 text-primary"}),"Invite Broker Friends"]}),r.jsx(Xn,{children:"Send a personalized email invitation to broker owners you know. They'll receive a beautiful email highlighting LevelUp's features."})]}),r.jsxs("div",{className:"bg-gradient-to-r from-primary/10 to-primary/5 border border-primary/20 rounded-lg p-4 flex items-center gap-3",children:[r.jsx("div",{className:"bg-primary/20 rounded-full p-2",children:r.jsx(Ki,{className:"h-5 w-5 text-primary"})}),r.jsxs("div",{children:[r.jsx("p",{className:"font-semibold text-sm",children:"Earn $25/month for each referral!"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"When they sign up and stay for 30 days, you save on your membership forever."})]})]}),r.jsxs("div",{className:"space-y-4 py-2",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"email",children:"Email Addresses (up to 10)"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(dt,{id:"email",type:"email",placeholder:"Enter email and press Enter",value:i,onChange:z=>h(z.target.value),onKeyDown:T,onBlur:A}),r.jsx(ee,{type:"button",variant:"secondary",onClick:A,children:"Add"})]}),p.length>0&&r.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:p.map(z=>r.jsxs(Ot,{variant:"secondary",className:"flex items-center gap-1 pr-1",children:[z,r.jsx("button",{type:"button",onClick:()=>E(z),className:"ml-1 rounded-full p-0.5 hover:bg-muted",children:r.jsx(_s,{className:"h-3 w-3"})})]},z))})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"message",children:"Personal Message (optional)"}),r.jsx(ps,{id:"message",placeholder:"Add a personal note that will appear at the top of the email...",value:y,onChange:z=>b(z.target.value),rows:3,maxLength:500}),r.jsxs("p",{className:"text-xs text-muted-foreground text-right",children:[y.length,"/500 characters"]})]}),r.jsxs("div",{className:"bg-muted/50 rounded-lg p-4 space-y-2",children:[r.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium",children:[r.jsx(Ms,{className:"h-4 w-4 text-primary"}),"What they'll receive:"]}),r.jsxs("ul",{className:"text-xs text-muted-foreground space-y-1",children:[r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"w-1 h-1 rounded-full bg-primary"}),"Beautiful branded email from you"]}),r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"w-1 h-1 rounded-full bg-primary"}),"Your personal message (if added)"]}),r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"w-1 h-1 rounded-full bg-primary"}),"Key LevelUp features for brokerages"]}),r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"w-1 h-1 rounded-full bg-primary"}),"Direct signup link with your referral code"]})]})]})]}),r.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[r.jsx(ee,{variant:"outline",onClick:()=>e(!1),children:"Cancel"}),r.jsx(ee,{onClick:L,disabled:p.length===0||j,children:j?r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"h-4 w-4 animate-spin rounded-full border-2 border-current border-t-transparent mr-2"}),"Sending..."]}):r.jsxs(r.Fragment,{children:[r.jsx(Oo,{className:"h-4 w-4 mr-2"}),"Send ",p.length>0&&`(${p.length})`," Invite",p.length!==1?"s":""]})})]})]})})},Cwt=({brokerageId:t,refreshTrigger:e})=>{const[n,s]=I.useState([]),[a,o]=I.useState(!0);I.useEffect(()=>{l()},[t,e]);const l=async()=>{try{const{data:h,error:p}=await J.from("referral_invites").select("*").eq("referrer_brokerage_id",t).order("sent_at",{ascending:!1}).limit(20);if(p)throw p;s(h||[])}catch(h){console.error("Error fetching invites:",h)}finally{o(!1)}},i=h=>{switch(h){case"signed_up":return r.jsxs(Ot,{className:"bg-green-100 text-green-800 gap-1",children:[r.jsx(Yi,{className:"h-3 w-3"}),"Signed Up"]});case"expired":return r.jsxs(Ot,{variant:"outline",className:"text-muted-foreground gap-1",children:[r.jsx(qc,{className:"h-3 w-3"}),"Expired"]});default:return r.jsxs(Ot,{variant:"secondary",className:"gap-1",children:[r.jsx(Ya,{className:"h-3 w-3"}),"Pending"]})}};return a?r.jsx("div",{className:"flex justify-center py-4",children:r.jsx("div",{className:"h-5 w-5 animate-spin rounded-full border-2 border-primary border-t-transparent"})}):n.length===0?r.jsxs("div",{className:"text-center py-6 text-muted-foreground",children:[r.jsx(da,{className:"h-8 w-8 mx-auto mb-2 opacity-50"}),r.jsx("p",{className:"text-sm",children:"No invites sent yet"}),r.jsx("p",{className:"text-xs",children:"Start inviting broker friends to earn rewards!"})]}):r.jsxs("div",{className:"space-y-2",children:[r.jsx("p",{className:"text-sm font-medium mb-3",children:"Recent Invites"}),n.map(h=>r.jsxs("div",{className:"flex items-center justify-between p-2.5 bg-muted/30 rounded-lg",children:[r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("p",{className:"text-sm font-medium truncate",children:h.recipient_email}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Sent ",yn(new Date(h.sent_at),"MMM d, yyyy")]})]}),i(h.status)]},h.id))]})},Mwt=()=>{const{brokerageId:t,user:e}=Qr(),[n,s]=I.useState(null),[a,o]=I.useState(""),[l,i]=I.useState(""),[h,p]=I.useState([]),[x,y]=I.useState(!0),[b,j]=I.useState(!1),[C,N]=I.useState(0);I.useEffect(()=>{t&&A()},[t]);const A=async()=>{try{const[q,H]=await Promise.all([J.from("brokerages").select("name").eq("id",t).single(),e?J.from("profiles").select("name").eq("id",e.id).single():Promise.resolve({data:null})]);q.data&&o(q.data.name),H.data&&i(H.data.name||"A LevelUp Member");const{data:Z}=await J.from("referral_codes").select("code").eq("brokerage_id",t).single();if(Z)s(Z.code);else{const te=`REF${t==null?void 0:t.slice(0,8).toUpperCase()}`;await J.from("referral_codes").insert({brokerage_id:t,code:te}),s(te)}const{data:G}=await J.from("referrals").select(` *, referred_user:profiles!referred_user_id(name, email), referred_brokerage:brokerages!referred_brokerage_id(name) `).eq("referrer_brokerage_id",t).order("created_at",{ascending:!1});p(G||[])}catch(q){console.error("Error fetching referral data:",q)}finally{y(!1)}},E=()=>{const q=`https://dashboard.relevelup.com/?ref=${n}`;navigator.clipboard.writeText(q),ze.success("Referral link copied to clipboard!")},T=h.filter(q=>q.status==="qualified").length,L=h.filter(q=>q.status==="pending").length,z=T*25,F=Math.max(0,Math.ceil((299-z)/25));return x?null:r.jsxs(r.Fragment,{children:[r.jsxs(Ye,{className:"overflow-hidden",children:[r.jsx("div",{className:"bg-gradient-to-r from-primary/10 via-primary/5 to-background border-b",children:r.jsxs("div",{className:"px-6 py-6",children:[r.jsxs("div",{className:"flex items-center gap-3 mb-2",children:[r.jsx("div",{className:"bg-primary/20 rounded-full p-2",children:r.jsx(Ki,{className:"h-6 w-6 text-primary"})}),r.jsxs("div",{children:[r.jsx("h3",{className:"text-lg font-bold",children:"Referral Rewards Program"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Earn $25/month off your membership for every broker you refer"})]})]}),r.jsx("div",{className:"mt-4 bg-background/80 rounded-lg p-4 border",children:r.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-4",children:[r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsxs("div",{className:"text-center",children:[r.jsxs("p",{className:"text-3xl font-bold text-primary",children:["$",z]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Monthly Savings"})]}),z>0&&r.jsxs("div",{className:"flex items-center gap-1 text-green-600",children:[r.jsx(Yi,{className:"h-4 w-4"}),r.jsx("span",{className:"text-sm font-medium",children:"Active"})]})]}),F>0&&z<299&&r.jsxs("div",{className:"text-right",children:[r.jsxs("p",{className:"text-sm font-medium",children:["Refer ",F," more = ",r.jsx("span",{className:"text-primary",children:"FREE membership!"})]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Your membership could cost $0/month"})]}),z>=299&&r.jsxs("div",{className:"flex items-center gap-2 text-primary",children:[r.jsx(Ms,{className:"h-5 w-5"}),r.jsx("span",{className:"font-bold",children:"FREE Membership Unlocked!"})]})]})})]})}),r.jsxs(tt,{className:"pt-6 space-y-6",children:[r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[r.jsxs(ee,{onClick:()=>j(!0),className:"w-full",size:"lg",children:[r.jsx(da,{className:"h-4 w-4 mr-2"}),"Invite Broker Friends"]}),r.jsxs(ee,{onClick:E,variant:"outline",className:"w-full",size:"lg",children:[r.jsx(hl,{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(hd,{className:"h-5 w-5 mx-auto text-green-600 mb-1"}),r.jsxs("p",{className:"text-2xl font-bold text-green-700 dark:text-green-400",children:["$",z]}),r.jsx("p",{className:"text-xs text-green-600 dark:text-green-500",children:"Monthly Savings"})]}),r.jsxs("div",{className:"text-center p-4 bg-primary/5 rounded-lg border border-primary/20",children:[r.jsx(Bn,{className:"h-5 w-5 mx-auto text-primary mb-1"}),r.jsx("p",{className:"text-2xl font-bold",children:T}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Qualified Referrals"})]}),r.jsxs("div",{className:"text-center p-4 bg-amber-50 dark:bg-amber-950/20 rounded-lg border border-amber-200 dark:border-amber-900",children:[r.jsx(Ya,{className:"h-5 w-5 mx-auto text-amber-600 mb-1"}),r.jsx("p",{className:"text-2xl font-bold text-amber-700 dark:text-amber-400",children:L}),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(Cwt,{brokerageId:t,refreshTrigger:C}),h.length>0&&r.jsxs("div",{className:"space-y-2",children:[r.jsx("p",{className:"text-sm font-medium",children:"Your Referrals"}),h.slice(0,5).map(q=>{var H,Z;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:((H=q.referred_brokerage)==null?void 0:H.name)||((Z=q.referred_user)==null?void 0:Z.email)||"Pending setup"}),r.jsxs(Ot,{variant:q.status==="qualified"?"default":q.status==="pending"?"secondary":"destructive",className:q.status==="qualified"?"bg-green-600":"",children:[q.status==="qualified"&&r.jsx(Yi,{className:"h-3 w-3 mr-1"}),q.status]})]},q.id)})]})]})]}),r.jsx(Swt,{open:b,onOpenChange:j,referralCode:n||"",brokerageId:t||"",senderName:l||"A LevelUp Member",brokerageName:a,onInvitesSent:()=>N(q=>q+1)})]})},Twt=()=>{const{user:t,isBrokerageManager:e,brokerageId:n,isAdmin:s,managedBrokerages:a,selectedBrokerageId:o,setSelectedBrokerageId:l}=Qr(),i=rs(),{toast:h}=fi(),[p,x]=I.useState(""),[y,b]=I.useState(!0),j=o||(a.length>0?a[0].id:n);I.useEffect(()=>{if(!t||!e&&!s){i("/dashboard");return}!o&&a.length>0&&l(a[0].id),j?C():a.length===0&&!n&&b(!1)},[t,e,s,j,i,a,o]);const C=async()=>{if(!j){b(!1);return}try{const{data:N,error:A}=await J.from("brokerages").select("name").eq("id",j).single();if(A)throw A;x(N.name)}catch(N){console.error("Error loading brokerage info:",N),h({title:"Error",description:"Failed to load brokerage information",variant:"destructive"})}finally{b(!1)}};return y?r.jsx(Lr,{title:"Manage Brokerages",description:"Loading brokerage information...",children:r.jsx("div",{className:"flex items-center justify-center py-12",children:r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})})}):j?r.jsx(Lr,{title:p||"Manage Brokerages",description:"Brokerage Management Dashboard",children:r.jsxs("div",{className:"space-y-6",children:[a.length>1&&r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("span",{className:"text-sm text-muted-foreground",children:"Managing:"}),r.jsxs(gn,{value:o||"",onValueChange:l,children:[r.jsxs(fn,{className:"w-[280px]",children:[r.jsx(ai,{className:"mr-2 h-4 w-4"}),r.jsx(xn,{placeholder:"Select brokerage"})]}),r.jsx(pn,{children:a.map(N=>r.jsx(Vt,{value:N.id,children:N.name},N.id))})]})]}),r.jsxs(Ii,{defaultValue:"agents",className:"space-y-4",children:[r.jsxs(wi,{className:"grid w-full grid-cols-3 md:grid-cols-7",children:[r.jsx(ln,{value:"agents",children:"Agents"}),r.jsx(ln,{value:"invite",children:"Invite Links"}),r.jsx(ln,{value:"referrals",children:"Referrals"}),r.jsx(ln,{value:"leaderboard",children:"Leaderboard"}),r.jsx(ln,{value:"activity",children:"Activity"}),r.jsx(ln,{value:"analytics",children:"Analytics"}),r.jsx(ln,{value:"shares",children:"Shares"})]}),r.jsx(An,{value:"agents",className:"space-y-4",children:r.jsx(vwt,{brokerageId:j})}),r.jsx(An,{value:"invite",className:"space-y-4",children:r.jsx(Nwt,{brokerageId:j})}),r.jsx(An,{value:"referrals",className:"space-y-4",children:r.jsx(Mwt,{})}),r.jsx(An,{value:"leaderboard",className:"space-y-4",children:r.jsx(SDe,{brokerageId:j,title:`${p} Event Leaderboard`,showUserStats:!1})}),r.jsx(An,{value:"activity",className:"space-y-4",children:r.jsx(jwt,{brokerageId:j})}),r.jsx(An,{value:"analytics",className:"space-y-4",children:r.jsx(kwt,{brokerageId:j})}),r.jsx(An,{value:"shares",className:"space-y-4",children:r.jsx(mze,{brokerageOnly:!0,brokerageId:j})})]})]})}):r.jsx(Lr,{title:"Manage Brokerages",description:"Brokerage Management",children:r.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[r.jsx(ai,{className:"h-12 w-12 text-muted-foreground mb-4"}),r.jsx("h2",{className:"text-xl font-semibold mb-2",children:"No Brokerage Assigned"}),r.jsx("p",{className:"text-muted-foreground",children:"You don't have any brokerages to manage."})]})})};function Awt({brokerageId:t,canManage:e}){const{user:n}=Qr(),[s,a]=I.useState([]),[o,l]=I.useState(!0),[i,h]=I.useState(!1),[p,x]=I.useState(null),[y,b]=I.useState(null),[j,C]=I.useState(!1),[N,A]=I.useState(""),[E,T]=I.useState(""),[L,z]=I.useState(!1),F=async()=>{try{const{data:te,error:ie}=await J.from("brokerage_announcements").select("*").eq("brokerage_id",t).order("is_pinned",{ascending:!1}).order("pinned_at",{ascending:!1,nullsFirst:!1}).order("created_at",{ascending:!1});if(ie)throw ie;const le=te;if(le&&le.length>0){const ye=[...new Set(le.map(he=>he.created_by))],{data:ne}=await J.from("profiles").select("id, name, avatar_url").in("id",ye),ge=new Map((ne==null?void 0:ne.map(he=>[he.id,he]))||[]),ae=le.map(he=>({...he,author:ge.get(he.created_by)||{name:"Unknown",avatar_url:null}}));a(ae)}else a([])}catch(te){console.error("Error fetching announcements:",te)}finally{l(!1)}};I.useEffect(()=>{F()},[t]);const q=()=>{A(""),T(""),z(!1),x(null)},H=te=>{te?(x(te),A(te.title),T(te.content),z(te.is_pinned)):q(),h(!0)},Z=async()=>{if(!N.trim()||!E.trim()){ze.error("Please fill in all fields");return}C(!0);try{if(p){const{error:te}=await J.from("brokerage_announcements").update({title:N.trim(),content:E.trim(),is_pinned:L,pinned_at:L?new Date().toISOString():null}).eq("id",p.id);if(te)throw te;ze.success("Announcement updated")}else{const{error:te}=await J.from("brokerage_announcements").insert({brokerage_id:t,created_by:n==null?void 0:n.id,title:N.trim(),content:E.trim(),is_pinned:L,pinned_at:L?new Date().toISOString():null});if(te)throw te;ze.success("Announcement created")}h(!1),q(),F()}catch(te){console.error("Error saving announcement:",te),ze.error("Failed to save announcement")}finally{C(!1)}},G=async()=>{if(y)try{const{error:te}=await J.from("brokerage_announcements").delete().eq("id",y);if(te)throw te;ze.success("Announcement deleted"),F()}catch(te){console.error("Error deleting announcement:",te),ze.error("Failed to delete announcement")}finally{b(null)}};return o?r.jsxs(Ye,{children:[r.jsx(Gt,{children:r.jsxs(Zt,{className:"flex items-center gap-2",children:[r.jsx(gm,{className:"h-5 w-5"}),"Announcements"]})}),r.jsx(tt,{children:r.jsx("div",{className:"animate-pulse space-y-3",children:r.jsx("div",{className:"h-20 bg-muted rounded"})})})]}):r.jsxs(r.Fragment,{children:[r.jsxs(Ye,{children:[r.jsxs(Gt,{className:"flex flex-row items-center justify-between space-y-0 pb-4",children:[r.jsxs(Zt,{className:"flex items-center gap-2",children:[r.jsx(gm,{className:"h-5 w-5 text-primary"}),"Announcements"]}),e&&r.jsxs(ee,{size:"sm",onClick:()=>H(),className:"gap-1",children:[r.jsx(bn,{className:"h-4 w-4"}),"New"]})]}),r.jsx(tt,{children:s.length===0?r.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:"No announcements yet"}):r.jsx("div",{className:"space-y-4",children:s.map(te=>{var ie,le,ye,ne;return r.jsx("div",{className:`p-4 rounded-lg border ${te.is_pinned?"bg-primary/5 border-primary/20":"bg-muted/30"}`,children:r.jsxs("div",{className:"flex items-start justify-between gap-2",children:[r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[te.is_pinned&&r.jsx(b1,{className:"h-3.5 w-3.5 text-primary shrink-0"}),r.jsx("h4",{className:"font-semibold truncate",children:te.title})]}),r.jsx("p",{className:"text-sm text-muted-foreground whitespace-pre-wrap",children:te.content}),r.jsxs("div",{className:"flex items-center gap-2 mt-3 text-xs text-muted-foreground",children:[r.jsxs(Ks,{className:"h-5 w-5",children:[r.jsx(Ei,{src:((ie=te.author)==null?void 0:ie.avatar_url)||void 0}),r.jsx(Zs,{className:"text-[10px]",children:((ye=(le=te.author)==null?void 0:le.name)==null?void 0:ye.charAt(0))||"?"})]}),r.jsx("span",{children:(ne=te.author)==null?void 0:ne.name}),r.jsx("span",{children:"•"}),r.jsx("span",{children:yn(new Date(te.created_at),"MMM d, yyyy")})]})]}),e&&r.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[r.jsx(ee,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>H(te),children:r.jsx(_i,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"icon",className:"h-8 w-8 text-destructive hover:text-destructive",onClick:()=>b(te.id),children:r.jsx(Vn,{className:"h-4 w-4"})})]})]})},te.id)})})})]}),r.jsx(Fr,{open:i,onOpenChange:h,children:r.jsxs(Rr,{children:[r.jsx(qr,{children:r.jsx($r,{children:p?"Edit Announcement":"New Announcement"})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"title",children:"Title"}),r.jsx(dt,{id:"title",value:N,onChange:te=>A(te.target.value),placeholder:"Announcement title..."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"content",children:"Content"}),r.jsx(ps,{id:"content",value:E,onChange:te=>T(te.target.value),placeholder:"Write your announcement...",rows:4})]}),r.jsx("div",{className:"flex items-center justify-between",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ps,{id:"pinned",checked:L,onCheckedChange:z}),r.jsxs(He,{htmlFor:"pinned",className:"flex items-center gap-1 cursor-pointer",children:[r.jsx(b1,{className:"h-4 w-4"}),"Pin to top"]})]})}),r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(ee,{variant:"outline",onClick:()=>h(!1),children:"Cancel"}),r.jsx(ee,{onClick:Z,disabled:j,children:j?"Saving...":p?"Update":"Create"})]})]})]})}),r.jsx(Iu,{open:!!y,onOpenChange:()=>b(null),children:r.jsxs(tu,{children:[r.jsxs(ru,{children:[r.jsx(su,{children:"Delete Announcement"}),r.jsx(au,{children:"Are you sure you want to delete this announcement? This action cannot be undone."})]}),r.jsxs(nu,{children:[r.jsx(iu,{children:"Cancel"}),r.jsx(Ld,{onClick:G,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})})]})}function Ewt({brokerageId:t}){const[e,n]=I.useState([]),[s,a]=I.useState(!0),[o,l]=I.useState(""),[i,h]=I.useState(new Set);I.useEffect(()=>{(async()=>{try{const{data:y,error:b}=await J.from("profiles").select("id, name, email, phone, avatar_url, title, bio, areas_served, years_experience, instagram_url, facebook_url, linkedin_url").eq("brokerage_id",t).order("name");if(b)throw b;if(n(y||[]),y&&y.length>0){const j=y.map(N=>N.id),{data:C}=await J.from("agent_assistant_assignments").select("agent_id").in("agent_id",j);C&&h(new Set(C.map(N=>N.agent_id)))}}catch(y){console.error("Error fetching agents:",y)}finally{a(!1)}})()},[t]);const p=e.filter(x=>{var y,b;return x.name.toLowerCase().includes(o.toLowerCase())||x.email.toLowerCase().includes(o.toLowerCase())||((y=x.title)==null?void 0:y.toLowerCase().includes(o.toLowerCase()))||((b=x.areas_served)==null?void 0:b.toLowerCase().includes(o.toLowerCase()))});return s?r.jsxs(Ye,{children:[r.jsx(Gt,{children:r.jsxs(Zt,{className:"flex items-center gap-2",children:[r.jsx(Bn,{className:"h-5 w-5"}),"Agent Roster"]})}),r.jsx(tt,{children:r.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4",children:[1,2,3,4].map(x=>r.jsx("div",{className:"animate-pulse",children:r.jsx("div",{className:"h-48 bg-muted rounded-lg"})},x))})})]}):r.jsxs(Ye,{children:[r.jsxs(Gt,{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4 space-y-0",children:[r.jsxs(Zt,{className:"flex items-center gap-2",children:[r.jsx(Bn,{className:"h-5 w-5 text-primary"}),"Agent Roster",r.jsxs("span",{className:"text-sm font-normal text-muted-foreground",children:["(",e.length,")"]})]}),r.jsxs("div",{className:"relative w-full sm:w-64",children:[r.jsx(wa,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(dt,{placeholder:"Search agents...",value:o,onChange:x=>l(x.target.value),className:"pl-9"})]})]}),r.jsx(tt,{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(Iwt,{agent:x,hasAssistant:i.has(x.id)},x.id))})})]})}function Iwt({agent:t,hasAssistant:e}){const n=t.name.split(" ").map(s=>s[0]).join("").toUpperCase().slice(0,2);return r.jsxs("div",{className:"group relative bg-card border rounded-xl p-4 hover:shadow-md transition-shadow",children:[r.jsxs("div",{className:"flex flex-col items-center text-center mb-3",children:[r.jsxs(Ks,{className:"h-20 w-20 mb-3 ring-2 ring-background shadow-md",children:[r.jsx(Ei,{src:t.avatar_url||void 0,alt:t.name}),r.jsx(Zs,{className:"text-lg bg-primary/10 text-primary",children:n})]}),r.jsx("h3",{className:"font-semibold text-sm leading-tight",children:t.name}),t.title&&r.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:t.title}),e&&r.jsx(Ot,{variant:"outline",className:"text-[10px] mt-1",children:"Has Assistant"})]}),t.bio&&r.jsx("p",{className:"text-xs text-muted-foreground text-center line-clamp-2 mb-3",children:t.bio}),r.jsxs("div",{className:"space-y-1.5 mb-3",children:[t.areas_served&&r.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[r.jsx(fl,{className:"h-3 w-3 shrink-0"}),r.jsx("span",{className:"truncate",children:t.areas_served})]}),t.years_experience&&r.jsxs("p",{className:"text-xs text-muted-foreground text-center",children:[t.years_experience," ",t.years_experience===1?"year":"years"," experience"]})]}),r.jsxs("div",{className:"flex items-center justify-center gap-2",children:[t.phone&&r.jsx(ee,{variant:"outline",size:"icon",className:"h-8 w-8",asChild:!0,children:r.jsx("a",{href:`tel:${t.phone}`,title:`Call ${t.name}`,children:r.jsx(bi,{className:"h-4 w-4"})})}),r.jsx(ee,{variant:"outline",size:"icon",className:"h-8 w-8",asChild:!0,children:r.jsx("a",{href:`mailto:${t.email}`,title:`Email ${t.name}`,children:r.jsx(da,{className:"h-4 w-4"})})}),t.linkedin_url&&r.jsx(ee,{variant:"outline",size:"icon",className:"h-8 w-8",asChild:!0,children:r.jsx("a",{href:t.linkedin_url,target:"_blank",rel:"noopener noreferrer",title:"LinkedIn",children:r.jsx(mm,{className:"h-4 w-4"})})}),t.instagram_url&&r.jsx(ee,{variant:"outline",size:"icon",className:"h-8 w-8",asChild:!0,children:r.jsx("a",{href:t.instagram_url,target:"_blank",rel:"noopener noreferrer",title:"Instagram",children:r.jsx(lu,{className:"h-4 w-4"})})})]})]})}function Pwt({brokerageId:t}){const[e,n]=I.useState([]),[s,a]=I.useState(!0);if(I.useEffect(()=>{(async()=>{try{const{data:h,error:p}=await J.from("profiles").select("id, name, avatar_url").eq("brokerage_id",t);if(p)throw p;if(!h||h.length===0){n([]),a(!1);return}const x=h.map(N=>N.id),{data:y,error:b}=await J.from("agent_attendance_stats").select("user_id, total_points").in("user_id",x).order("total_points",{ascending:!1});if(b)throw b;const j=new Map(h.map(N=>[N.id,N])),C=(y||[]).filter(N=>N.total_points>0).map(N=>{const A=j.get(N.user_id);return{user_id:N.user_id,total_points:N.total_points,name:(A==null?void 0:A.name)||"Unknown",avatar_url:(A==null?void 0:A.avatar_url)||null}});n(C)}catch(h){console.error("Error fetching leaderboard:",h)}finally{a(!1)}})()},[t]),s)return r.jsxs(Ye,{children:[r.jsx(Gt,{children:r.jsxs(Zt,{className:"flex items-center gap-2",children:[r.jsx(Zi,{className:"h-5 w-5"}),"Team Leaderboard"]})}),r.jsx(tt,{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(qx,{className:$t("h-5 w-5",o(i))}):r.jsx("span",{className:"w-5 text-center text-sm text-muted-foreground",children:i});return r.jsxs(Ye,{children:[r.jsx(Gt,{children:r.jsxs(Zt,{className:"flex items-center gap-2",children:[r.jsx(Zi,{className:"h-5 w-5 text-primary"}),"Team Leaderboard"]})}),r.jsx(tt,{children:e.length===0?r.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:"No points earned yet. Attend events to earn points!"}):r.jsx("div",{className:"space-y-2",children:e.slice(0,10).map((i,h)=>{const p=i.name.split(" ").map(y=>y[0]).join("").toUpperCase().slice(0,2),x=h+1;return r.jsxs("div",{className:$t("flex items-center gap-3 p-2 rounded-lg",x<=3&&"bg-muted/50"),children:[r.jsx("div",{className:"w-6 flex justify-center",children:l(x)}),r.jsxs(Ks,{className:"h-8 w-8",children:[r.jsx(Ei,{src:i.avatar_url||void 0}),r.jsx(Zs,{className:"text-xs",children:p})]}),r.jsx("span",{className:"flex-1 text-sm font-medium truncate",children:i.name}),r.jsxs("span",{className:"text-sm font-semibold text-primary",children:[i.total_points.toLocaleString()," pts"]})]},i.user_id)})})})]})}function Lwt({brokerageId:t}){const e=rs(),[n,s]=I.useState([]),[a,o]=I.useState(!0);I.useEffect(()=>{(async()=>{try{const{data:h,error:p}=await J.from("profiles").select("id, name, avatar_url").eq("brokerage_id",t);if(p)throw p;if(!h||h.length===0){s([]),o(!1);return}const x=h.map(N=>N.id),y=new Map(h.map(N=>[N.id,N])),{data:b,error:j}=await J.from("listings").select(` id, slug, property_address, city, price, property_type, agent_id, listing_photos(photo_url) `).in("agent_id",x).eq("status","active").order("created_at",{ascending:!1}).limit(6);if(j)throw j;const C=(b||[]).map(N=>({id:N.id,slug:N.slug,property_address:N.property_address,city:N.city,price:N.price,property_type:N.property_type,agent_id:N.agent_id,agent:y.get(N.agent_id)||null,photos:N.listing_photos||[]}));s(C)}catch(h){console.error("Error fetching listings:",h)}finally{o(!1)}})()},[t]);const l=i=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(i);return a?r.jsxs(Ye,{children:[r.jsx(Gt,{children:r.jsxs(Zt,{className:"flex items-center gap-2",children:[r.jsx(pa,{className:"h-5 w-5"}),"Brokerage Listings"]})}),r.jsx(tt,{children:r.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[1,2].map(i=>r.jsx("div",{className:"animate-pulse",children:r.jsx("div",{className:"h-32 bg-muted rounded-lg"})},i))})})]}):r.jsxs(Ye,{children:[r.jsxs(Gt,{className:"flex flex-row items-center justify-between space-y-0 pb-4",children:[r.jsxs(Zt,{className:"flex items-center gap-2",children:[r.jsx(pa,{className:"h-5 w-5 text-primary"}),"Brokerage Listings"]}),r.jsxs(ee,{size:"sm",variant:"outline",onClick:()=>e("/mission-control/listings"),className:"gap-1",children:[r.jsx(bn,{className:"h-4 w-4"}),"Add Listing"]})]}),r.jsxs(tt,{children:[n.length===0?r.jsxs("div",{className:"text-center py-8",children:[r.jsx(pa,{className:"h-10 w-10 text-muted-foreground mx-auto mb-2"}),r.jsx("p",{className:"text-sm text-muted-foreground mb-3",children:"No active listings from your brokerage yet"}),r.jsxs(ee,{size:"sm",onClick:()=>e("/mission-control/listings/new"),className:"gap-1",children:[r.jsx(bn,{className:"h-4 w-4"}),"Add Your First Listing"]})]}):r.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:n.map(i=>r.jsxs("div",{onClick:()=>window.open(`https://listings.relevelup.com/${i.slug||i.id}`,"_blank"),className:"group cursor-pointer border rounded-lg overflow-hidden hover:shadow-md transition-shadow",children:[r.jsxs("div",{className:"relative h-24 bg-muted",children:[i.photos&&i.photos.length>0?r.jsx("img",{src:i.photos[0].photo_url,alt:i.property_address||"Listing",className:"w-full h-full object-cover"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center",children:r.jsx(pa,{className:"h-8 w-8 text-muted-foreground"})}),r.jsx("div",{className:"absolute top-2 left-2",children:r.jsx("span",{className:"text-[10px] font-medium bg-primary text-primary-foreground px-1.5 py-0.5 rounded uppercase",children:i.property_type.replace("_"," ")})})]}),r.jsxs("div",{className:"p-2.5",children:[r.jsx("p",{className:"font-semibold text-sm text-primary",children:l(i.price)}),r.jsx("p",{className:"text-xs text-muted-foreground truncate mt-0.5",children:i.property_address||"Address not available"}),r.jsx("p",{className:"text-xs text-muted-foreground truncate",children:i.city}),i.agent&&r.jsxs("p",{className:"text-[10px] text-muted-foreground mt-1.5 truncate",children:["Listed by ",i.agent.name]})]})]},i.id))}),n.length>0&&r.jsxs(ee,{variant:"ghost",size:"sm",className:"w-full mt-3",onClick:()=>e("/mission-control/listings"),children:["View All Listings",r.jsx(Fs,{className:"h-3 w-3 ml-1"})]})]})]})}function Owt(){const{user:t,isAdmin:e,isBrokerageManager:n}=Qr(),s=rs(),[a,o]=I.useState(!0),[l,i]=I.useState(null),[h,p]=I.useState(""),[x,y]=I.useState(0),[b,j]=I.useState(!1),[C,N]=I.useState(!1);return I.useEffect(()=>{(async()=>{if(t)try{const{data:E}=await J.from("profiles").select("brokerage_id").eq("id",t.id).maybeSingle();if(!(E!=null&&E.brokerage_id)){o(!1);return}i(E.brokerage_id);const{data:T}=await J.from("brokerages").select("name").eq("id",E.brokerage_id).maybeSingle();T&&p(T.name);const{count:L}=await J.from("profiles").select("id",{count:"exact",head:!0}).eq("brokerage_id",E.brokerage_id);if(y(L||0),e)j(!0),N(!0);else if(n){const{data:z}=await J.from("brokerage_manager_assignments").select("id").eq("user_id",t.id).eq("brokerage_id",E.brokerage_id).maybeSingle();j(!!z),N(!!z)}}catch(E){console.error("Error fetching brokerage info:",E)}finally{o(!1)}})()},[t,e,n]),a?r.jsx(Lr,{title:"My Brokerage",description:"Loading...",children:r.jsx("div",{className:"flex items-center justify-center py-12",children:r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})})}):l?r.jsx(Lr,{title:h||"My Brokerage",description:"Team Hub",children:r.jsxs("div",{className:"space-y-8",children:[r.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-4",children:[r.jsxs("div",{className:"flex items-center gap-2 bg-muted/50 rounded-lg px-4 py-2",children:[r.jsx(Bn,{className:"h-5 w-5 text-primary"}),r.jsxs("span",{className:"font-medium",children:[x," ",x===1?"Agent":"Agents"]})]}),C&&r.jsxs(ee,{onClick:()=>s(`/mission-control/listings/new?brokerage=${l}`),children:[r.jsx(pa,{className:"h-4 w-4 mr-2"}),"Add Listing"]})]}),r.jsx(Awt,{brokerageId:l,canManage:b}),r.jsx(Ewt,{brokerageId:l}),r.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-8",children:[r.jsx(Pwt,{brokerageId:l}),r.jsx(Lwt,{brokerageId:l})]})]})}):r.jsx(Lr,{title:"My Brokerage",description:"Team Hub",children:r.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[r.jsx(ai,{className:"h-12 w-12 text-muted-foreground mb-4"}),r.jsx("h2",{className:"text-xl font-semibold mb-2",children:"No Brokerage Assigned"}),r.jsx("p",{className:"text-muted-foreground",children:"You're not currently part of a brokerage team."})]})})}function Dwt(){const t=rs(),[e,n]=I.useState(""),[s,a]=I.useState("grid"),{data:o,isLoading:l}=Yt({queryKey:["newsletters"],queryFn:async()=>{const{data:L,error:z}=await J.from("newsletter_content").select("*").eq("is_published",!0).order("publish_date",{ascending:!1});if(z)throw z;return L}}),{data:i}=Yt({queryKey:["newsletter-likes-all"],queryFn:async()=>{const{data:L}=await J.from("newsletter_likes").select("newsletter_id");return L||[]}}),{data:h}=Yt({queryKey:["newsletter-comments-all"],queryFn:async()=>{const{data:L}=await J.from("newsletter_comments").select("newsletter_id");return L||[]}}),{data:p}=Yt({queryKey:["newsletter-resource-counts"],queryFn:async()=>{const[L,z,F,q]=await Promise.all([J.from("newsletter_canva_links").select("newsletter_id"),J.from("newsletter_pdfs").select("newsletter_id"),J.from("newsletter_videos").select("newsletter_id"),J.from("newsletter_drive_links").select("newsletter_id")]);return{canva:L.data||[],pdfs:z.data||[],videos:F.data||[],drives:q.data||[]}}}),x=L=>(i==null?void 0:i.filter(z=>z.newsletter_id===L).length)||0,y=L=>(h==null?void 0:h.filter(z=>z.newsletter_id===L).length)||0,b=L=>{var z;return((z=p==null?void 0:p.canva)==null?void 0:z.filter(F=>F.newsletter_id===L).length)||0},j=L=>{var z;return((z=p==null?void 0:p.pdfs)==null?void 0:z.filter(F=>F.newsletter_id===L).length)||0},C=L=>{var z;return((z=p==null?void 0:p.videos)==null?void 0:z.filter(F=>F.newsletter_id===L).length)||0},N=L=>{var z;return((z=p==null?void 0:p.drives)==null?void 0:z.filter(F=>F.newsletter_id===L).length)||0},A=L=>b(L)+j(L)+C(L)+N(L),E=o==null?void 0:o.filter(L=>{var z;return L.title.toLowerCase().includes(e.toLowerCase())||((z=L.description)==null?void 0:z.toLowerCase().includes(e.toLowerCase()))}),T=L=>{t(`/newsletters/${L}`)};return r.jsx(Lr,{title:"Newsletter Content",children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"font-bold text-foreground text-5xl",children:"Newsletter Content"}),r.jsx("p",{className:"text-muted-foreground mt-1",children:"Monthly newsletter templates and resources"})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[r.jsxs("div",{className:"relative flex-1 max-w-sm",children:[r.jsx(wa,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(dt,{placeholder:"Search newsletters...",value:e,onChange:L=>n(L.target.value),className:"pl-9"})]}),r.jsxs("div",{className:"flex gap-2",children:[e&&r.jsx(ee,{variant:"outline",size:"sm",onClick:()=>n(""),children:"Clear"}),r.jsxs("div",{className:"flex gap-1",children:[r.jsx(ee,{variant:s==="grid"?"secondary":"outline",size:"icon",onClick:()=>a("grid"),className:"rounded-full",children:r.jsx(pm,{className:"h-4 w-4"})}),r.jsx(ee,{variant:s==="list"?"secondary":"outline",size:"icon",onClick:()=>a("list"),className:"rounded-full",children:r.jsx(Kf,{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((L,z)=>r.jsx(Ye,{children:r.jsxs(tt,{className:"p-0",children:[r.jsx(Ir,{className:"aspect-[3/2] w-full"}),r.jsxs("div",{className:"p-4 space-y-2",children:[r.jsx(Ir,{className:"h-5 w-3/4"}),r.jsx(Ir,{className:"h-4 w-full"})]})]})},z))}),!l&&(E==null?void 0:E.length)===0&&r.jsxs("div",{className:"text-center py-12",children:[r.jsx(La,{className:"h-12 w-12 mx-auto text-muted-foreground mb-4"}),r.jsx("div",{className:"text-muted-foreground mb-4",children:e?"No newsletters match your search":"No newsletters available yet"}),e&&r.jsx(ee,{variant:"outline",onClick:()=>n(""),children:"Clear Search"})]}),!l&&E&&E.length>0&&r.jsx("div",{className:s==="grid"?"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6":"space-y-3",children:E.map(L=>{const z=A(L.id),F=b(L.id),q=j(L.id),H=C(L.id);return s==="grid"?r.jsxs(Ye,{className:"group overflow-hidden hover:shadow-lg transition-all duration-200 cursor-pointer border-border/50",onClick:()=>T(L.id),children:[r.jsx("div",{className:"relative overflow-hidden bg-muted aspect-[3/2]",children:L.preview_image_url?r.jsx("img",{src:L.preview_image_url,alt:L.title,className:"w-full h-full object-contain group-hover:scale-105 transition-transform duration-300"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center text-muted-foreground",children:r.jsx(La,{className:"h-16 w-16"})})}),r.jsxs(tt,{className:"p-4 space-y-3",children:[r.jsxs("div",{children:[r.jsx("h3",{className:"font-semibold text-foreground line-clamp-1",children:L.title}),r.jsxs("div",{className:"flex items-center gap-1.5 mt-1 text-xs text-muted-foreground",children:[r.jsx(zs,{className:"h-3 w-3"}),yn(new Date(L.publish_date),"MMM d, yyyy")]})]}),L.description&&r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2",children:L.description.replace(/<[^>]*>/g,"")}),z>0&&r.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[F>0&&r.jsxs(Ot,{variant:"secondary",className:"text-xs gap-1 font-normal",children:[r.jsx(Fd,{className:"h-3 w-3"})," ",F," Template",F>1?"s":""]}),q>0&&r.jsxs(Ot,{variant:"secondary",className:"text-xs gap-1 font-normal",children:[r.jsx(no,{className:"h-3 w-3"})," ",q," PDF",q>1?"s":""]}),H>0&&r.jsxs(Ot,{variant:"secondary",className:"text-xs gap-1 font-normal",children:[r.jsx(hc,{className:"h-3 w-3"})," ",H," Video",H>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(pd,{className:"h-3 w-3"})," ",x(L.id)]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Fl,{className:"h-3 w-3"})," ",y(L.id)]})]})]})]},L.id):r.jsx(Ye,{className:"group overflow-hidden hover:shadow-md transition-all duration-200 cursor-pointer border-border/50",onClick:()=>T(L.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:L.preview_image_url?r.jsx("img",{src:L.preview_image_url,alt:L.title,className:"w-full h-full object-contain group-hover:scale-105 transition-transform duration-300"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center text-muted-foreground min-h-[100px]",children:r.jsx(La,{className:"h-10 w-10"})})}),r.jsxs(tt,{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:L.title}),r.jsxs("div",{className:"flex items-center gap-1.5 mt-0.5 text-xs text-muted-foreground",children:[r.jsx(zs,{className:"h-3 w-3"}),yn(new Date(L.publish_date),"MMM d, yyyy")]})]}),L.description&&r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-1",children:L.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(pd,{className:"h-3 w-3"})," ",x(L.id)]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Fl,{className:"h-3 w-3"})," ",y(L.id)]})]})]})]})},L.id)})})]})})}function Rwt({rows:t}){if(!t||t.length===0)return null;const e=t.filter(n=>n.columns.some(s=>s.title||s.description||s.image_url));return e.length===0?null:r.jsx("div",{className:"space-y-6",children:e.map((n,s)=>{const a=n.columns.filter(o=>o.title||o.description||o.image_url);return a.length===0?null:r.jsx("div",{className:"grid gap-4",style:{gridTemplateColumns:`repeat(${a.length}, minmax(0, 1fr))`},children:a.map((o,l)=>r.jsxs(Ye,{className:"overflow-hidden border-border/50",children:[o.image_url&&r.jsx("img",{src:o.image_url,alt:o.title||"",className:"w-full h-40 object-cover"}),r.jsxs(tt,{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 Fwt(){const{id:t}=Zc(),e=rs(),{user:n}=Qr(),{toast:s}=fi(),a=Vr(),{trackEngagement:o}=MI(),[l,i]=I.useState(""),{data:h,isLoading:p}=Yt({queryKey:["newsletter",t],queryFn:async()=>{const{data:F,error:q}=await J.from("newsletter_content").select("*").eq("id",t).single();if(q)throw q;return F},enabled:!!t});I.useEffect(()=>{h&&o("newsletter",h.id,h.title,"view")},[h==null?void 0:h.id]);const{data:x}=Yt({queryKey:["newsletter-drives",t],queryFn:async()=>{const{data:F}=await J.from("newsletter_drive_links").select("*").eq("newsletter_id",t).order("sort_order");return F||[]},enabled:!!t}),{data:y}=Yt({queryKey:["newsletter-pdfs",t],queryFn:async()=>{const{data:F}=await J.from("newsletter_pdfs").select("*").eq("newsletter_id",t).order("sort_order");return F||[]},enabled:!!t}),{data:b}=Yt({queryKey:["newsletter-videos",t],queryFn:async()=>{const{data:F}=await J.from("newsletter_videos").select("*").eq("newsletter_id",t).order("sort_order");return F||[]},enabled:!!t}),{data:j}=Yt({queryKey:["newsletter-canva-links",t],queryFn:async()=>{const{data:F}=await J.from("newsletter_canva_links").select("*").eq("newsletter_id",t).order("sort_order");return F||[]},enabled:!!t}),{data:C}=Yt({queryKey:["newsletter-likes",t],queryFn:async()=>{const{data:F}=await J.from("newsletter_likes").select("*").eq("newsletter_id",t);return F||[]},enabled:!!t}),{data:N}=Yt({queryKey:["newsletter-comments",t],queryFn:async()=>{const{data:F}=await J.from("newsletter_comments").select("*, profiles:user_id(name)").eq("newsletter_id",t).order("created_at",{ascending:!1});return F||[]},enabled:!!t}),A=C==null?void 0:C.some(F=>F.user_id===(n==null?void 0:n.id)),E=cr({mutationFn:async()=>{A?await J.from("newsletter_likes").delete().eq("newsletter_id",t).eq("user_id",n==null?void 0:n.id):await J.from("newsletter_likes").insert({newsletter_id:t,user_id:n==null?void 0:n.id})},onSuccess:()=>{a.invalidateQueries({queryKey:["newsletter-likes",t]})}}),T=cr({mutationFn:async F=>{const{error:q}=await J.from("newsletter_comments").insert({newsletter_id:t,user_id:n==null?void 0:n.id,content:F});if(q)throw q},onSuccess:()=>{a.invalidateQueries({queryKey:["newsletter-comments",t]}),i(""),s({title:"Comment added"})}}),L=cr({mutationFn:async F=>{const{error:q}=await J.from("newsletter_comments").delete().eq("id",F);if(q)throw q},onSuccess:()=>{a.invalidateQueries({queryKey:["newsletter-comments",t]}),s({title:"Comment deleted"})}}),z=F=>{if(F.includes("player.mediadelivery.net")||F.includes("iframe.mediadelivery.net")){const q=F.match(/embed\/(\d+)\/([a-f0-9-]+)/);if(q)return r.jsx("div",{className:"relative w-full pt-[56.25%]",children:r.jsx("iframe",{src:`https://iframe.mediadelivery.net/embed/${q[1]}/${q[2]}?autoplay=false`,className:"absolute inset-0 w-full h-full rounded-lg",allow:"accelerometer; gyroscope; autoplay; encrypted-media; picture-in-picture",allowFullScreen:!0})})}if(F.includes("youtube.com")||F.includes("youtu.be")){const q=F.match(/(?:youtube\.com\/(?:watch\?v=|embed\/)|youtu\.be\/)([^&\s]+)/);if(q)return r.jsx("div",{className:"relative w-full pt-[56.25%]",children:r.jsx("iframe",{src:`https://www.youtube.com/embed/${q[1]}`,className:"absolute inset-0 w-full h-full rounded-lg",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0})})}return r.jsxs("a",{href:F,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 text-primary hover:underline",children:[r.jsx(hc,{className:"h-4 w-4"})," Watch Video"]})};return p?r.jsx(Lr,{title:"",description:"",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Ir,{className:"h-8 w-32"}),r.jsx(Ir,{className:"h-64 w-full"}),r.jsx(Ir,{className:"h-32 w-full"})]})}):h?r.jsx(Lr,{title:"",description:"",children:r.jsxs("div",{className:"max-w-4xl mx-auto space-y-6",children:[r.jsxs(ee,{variant:"ghost",onClick:()=>e("/newsletters"),className:"mb-4",children:[r.jsx(so,{className:"mr-2 h-4 w-4"})," Back to Newsletters"]}),h.preview_image_url&&r.jsx("img",{src:h.preview_image_url,alt:h.title,className:"w-full h-64 md:h-80 object-cover rounded-lg"}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-3xl font-bold",children:h.title}),r.jsx("p",{className:"text-muted-foreground mt-1",children:yn(new Date(h.publish_date),"MMMM d, yyyy")})]}),h.description&&r.jsx("div",{className:"text-lg text-muted-foreground prose prose-sm max-w-none dark:prose-invert [&_p]:mb-4 [&_p:last-child]:mb-0 whitespace-pre-line",dangerouslySetInnerHTML:{__html:h.description}}),r.jsx(Rwt,{rows:h.content_blocks||[]}),r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx(u3,{resourceType:"newsletter",resourceId:h.id,resourceTitle:h.title}),r.jsxs(ee,{variant:A?"default":"outline",size:"sm",onClick:()=>E.mutate(),children:[r.jsx(ci,{className:`h-4 w-4 mr-1 ${A?"fill-current":""}`}),(C==null?void 0:C.length)||0," ",(C==null?void 0:C.length)===1?"Like":"Likes"]})]}),j&&j.length>0&&r.jsxs(Ye,{children:[r.jsx(Gt,{children:r.jsx(Zt,{className:"text-lg",children:"Canva Templates"})}),r.jsx(tt,{className:"space-y-2",children:j.map(F=>r.jsxs("a",{href:F.canva_share_link,target:"_blank",rel:"noopener noreferrer",onClick:()=>o("newsletter",h.id,h.title,"click_canva"),className:"flex items-center gap-3 p-3 rounded-lg hover:bg-muted transition-colors",children:[r.jsx(Fd,{className:"h-5 w-5 text-purple-500"}),r.jsx("span",{className:"font-medium",children:F.title}),r.jsx(Fs,{className:"h-4 w-4 text-muted-foreground ml-auto"})]},F.id))})]}),x&&x.length>0&&r.jsxs(Ye,{children:[r.jsx(Gt,{children:r.jsx(Zt,{className:"text-lg",children:"Google Drive Files"})}),r.jsx(tt,{className:"space-y-2",children:x.map(F=>r.jsxs("a",{href:F.drive_url,target:"_blank",rel:"noopener noreferrer",onClick:()=>o("newsletter",h.id,h.title,"click_link"),className:"flex items-center gap-3 p-3 rounded-lg hover:bg-muted transition-colors",children:[r.jsx(Fs,{className:"h-5 w-5 text-primary"}),r.jsx("span",{className:"font-medium",children:F.title})]},F.id))})]}),y&&y.length>0&&r.jsxs(Ye,{children:[r.jsx(Gt,{children:r.jsx(Zt,{className:"text-lg",children:"PDF Downloads"})}),r.jsx(tt,{className:"space-y-2",children:y.map(F=>r.jsxs("a",{href:F.file_url,target:"_blank",rel:"noopener noreferrer",onClick:()=>o("newsletter",h.id,h.title,"click_pdf"),className:"flex items-center gap-3 p-3 rounded-lg hover:bg-muted transition-colors",children:[r.jsx(La,{className:"h-5 w-5 text-red-500"}),r.jsx("span",{className:"font-medium flex-1",children:F.name}),r.jsx(no,{className:"h-4 w-4 text-muted-foreground"})]},F.id))})]}),b&&b.length>0&&r.jsxs(Ye,{children:[r.jsx(Gt,{children:r.jsx(Zt,{className:"text-lg",children:"Videos"})}),r.jsx(tt,{className:"space-y-6",children:b.map(F=>r.jsxs("div",{className:"space-y-2",children:[r.jsx("h4",{className:"font-medium",children:F.title}),z(F.video_url)]},F.id))})]}),r.jsxs(Ye,{children:[r.jsx(Gt,{children:r.jsxs(Zt,{className:"text-lg",children:["Comments (",(N==null?void 0:N.length)||0,")"]})}),r.jsxs(tt,{className:"space-y-4",children:[r.jsxs("div",{className:"flex gap-3",children:[r.jsx(ps,{placeholder:"Write a comment...",value:l,onChange:F=>i(F.target.value),className:"flex-1"}),r.jsx(ee,{onClick:()=>l.trim()&&T.mutate(l),disabled:!l.trim()||T.isPending,children:r.jsx(Oo,{className:"h-4 w-4"})})]}),r.jsx("div",{className:"space-y-4",children:N==null?void 0:N.map(F=>{var q,H,Z;return r.jsxs("div",{className:"flex gap-3",children:[r.jsx(Ks,{className:"h-8 w-8",children:r.jsx(Zs,{children:((H=(q=F.profiles)==null?void 0:q.name)==null?void 0:H[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:((Z=F.profiles)==null?void 0:Z.name)||"User"}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-xs text-muted-foreground",children:yn(new Date(F.created_at),"MMM d, yyyy")}),F.user_id===(n==null?void 0:n.id)&&r.jsx(ee,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>L.mutate(F.id),children:r.jsx(Vn,{className:"h-3 w-3"})})]})]}),r.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:F.content})]})]},F.id)})})]})]})]})}):r.jsx(Lr,{title:"Not Found",description:"",children:r.jsxs("div",{className:"text-center py-12",children:[r.jsx("p",{className:"text-muted-foreground",children:"Newsletter not found"}),r.jsx(ee,{variant:"link",onClick:()=>e("/newsletters"),children:"Back to Newsletters"})]})})}function zwt({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,b)=>{const j=[...t];j[p]={...j[p],columns:j[p].columns.map((C,N)=>N===x?{...C,[y]:b}:C)},e(j)},i=async(p,x,y)=>{var C;const b=(C=y.target.files)==null?void 0:C[0];if(!b)return;const j=`${p}-${x}`;s(j);try{const N=`content-blocks/${Date.now()}-${b.name}`,{error:A}=await J.storage.from("newsletter-content").upload(N,b);if(!A){const{data:E}=J.storage.from("newsletter-content").getPublicUrl(N);l(p,x,"image_url",E.publicUrl)}}finally{s(null)}},h=(p,x)=>{l(p,x,"image_url","")};return r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(He,{className:"text-base font-medium",children:"Content Blocks (3-Column Rows)"}),r.jsxs(ee,{type:"button",variant:"outline",size:"sm",onClick:a,children:[r.jsx(bn,{className:"mr-1 h-3 w-3"})," Add Row"]})]}),t.length===0&&r.jsx("p",{className:"text-sm text-muted-foreground",children:"No content block rows yet. Add a row to create a 3-column layout."}),t.map((p,x)=>r.jsxs(Ye,{className:"relative",children:[r.jsx(ee,{type:"button",variant:"ghost",size:"icon",className:"absolute top-2 right-2 h-6 w-6 text-muted-foreground hover:text-destructive",onClick:()=>o(x),children:r.jsx(_s,{className:"h-4 w-4"})}),r.jsxs(tt,{className:"p-4 pt-3",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[r.jsx(x1,{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,b)=>{const j=`${x}-${b}`;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 ",b+1]}),y.image_url?r.jsxs("div",{className:"relative group",children:[r.jsx("img",{src:y.image_url,alt:"",className:"w-full h-20 object-cover rounded"}),r.jsx(ee,{type:"button",variant:"destructive",size:"icon",className:"absolute top-1 right-1 h-5 w-5 opacity-0 group-hover:opacity-100 transition-opacity",onClick:()=>h(x,b),children:r.jsx(_s,{className:"h-3 w-3"})})]}):r.jsxs("div",{children:[r.jsx(dt,{type:"file",accept:"image/*",className:"hidden",id:`block-img-${j}`,onChange:C=>i(x,b,C)}),r.jsx(ee,{type:"button",variant:"outline",size:"sm",className:"w-full text-xs h-8",disabled:n===j,asChild:!0,children:r.jsx("label",{htmlFor:`block-img-${j}`,className:"cursor-pointer",children:n===j?"Uploading...":r.jsxs(r.Fragment,{children:[r.jsx(Pl,{className:"h-3 w-3 mr-1"})," Image"]})})})]}),r.jsx(dt,{placeholder:"Title",value:y.title,onChange:C=>l(x,b,"title",C.target.value),className:"h-8 text-sm"}),r.jsx(ps,{placeholder:"Description",value:y.description,onChange:C=>l(x,b,"description",C.target.value),className:"text-sm min-h-[60px] resize-none"})]},b)})})]})]},x))]})}function Bwt(){const{toast:t}=fi(),e=Vr(),[n,s]=I.useState(!1),[a,o]=I.useState(null),[l,i]=I.useState({title:"",description:"",publish_date:yn(new Date,"yyyy-MM-dd'T'HH:mm"),is_published:!1}),[h,p]=I.useState(null),[x,y]=I.useState(null),[b,j]=I.useState([]),[C,N]=I.useState([]),[A,E]=I.useState([]),[T,L]=I.useState([]),[z,F]=I.useState([]),[q,H]=I.useState([]),[Z,G]=I.useState(!1),{data:te,isLoading:ie}=Yt({queryKey:["admin-newsletters"],queryFn:async()=>{const{data:Ne,error:Be}=await J.from("newsletter_content").select("*").order("publish_date",{ascending:!1});if(Be)throw Be;return Ne}}),le=cr({mutationFn:async Ne=>{const{data:Be,error:Ee}=await J.from("newsletter_content").insert({title:Ne.title,description:Ne.description||null,preview_image_url:Ne.preview_image_url,publish_date:Ne.publish_date,is_published:Ne.is_published,content_blocks:Ne.content_blocks}).select().single();if(Ee)throw Ee;return Be},onSuccess:async Ne=>{await ge(Ne.id),e.invalidateQueries({queryKey:["admin-newsletters"]}),t({title:"Newsletter created successfully"}),ue()},onError:Ne=>{t({title:"Error creating newsletter",description:Ne.message,variant:"destructive"})}}),ye=cr({mutationFn:async Ne=>{const{error:Be}=await J.from("newsletter_content").update({title:Ne.title,description:Ne.description||null,preview_image_url:Ne.preview_image_url,publish_date:Ne.publish_date,is_published:Ne.is_published,content_blocks:Ne.content_blocks}).eq("id",Ne.id);if(Be)throw Be;return Ne.id},onSuccess:async Ne=>{await ge(Ne),e.invalidateQueries({queryKey:["admin-newsletters"]}),t({title:"Newsletter updated successfully"}),ue()},onError:Ne=>{t({title:"Error updating newsletter",description:Ne.message,variant:"destructive"})}}),ne=cr({mutationFn:async Ne=>{const{error:Be}=await J.from("newsletter_content").delete().eq("id",Ne);if(Be)throw Be},onSuccess:()=>{e.invalidateQueries({queryKey:["admin-newsletters"]}),t({title:"Newsletter deleted successfully"})},onError:Ne=>{t({title:"Error deleting newsletter",description:Ne.message,variant:"destructive"})}}),ge=async Ne=>{await J.from("newsletter_drive_links").delete().eq("newsletter_id",Ne),await J.from("newsletter_pdfs").delete().eq("newsletter_id",Ne),await J.from("newsletter_videos").delete().eq("newsletter_id",Ne),await J.from("newsletter_canva_links").delete().eq("newsletter_id",Ne);for(const Be of q){const Ee=`${Ne}/${Date.now()}-${Be.file.name}`,{error:Ue}=await J.storage.from("newsletter-content").upload(Ee,Be.file);if(!Ue){const{data:Re}=J.storage.from("newsletter-content").getPublicUrl(Ee);C.push({name:Be.name,file_url:Re.publicUrl,file_size:Be.file.size,sort_order:C.length})}}b.length>0&&await J.from("newsletter_drive_links").insert(b.map((Be,Ee)=>({newsletter_id:Ne,title:Be.title,drive_url:Be.drive_url,sort_order:Ee}))),C.length>0&&await J.from("newsletter_pdfs").insert(C.map((Be,Ee)=>({newsletter_id:Ne,name:Be.name,file_url:Be.file_url,file_size:Be.file_size||null,sort_order:Ee}))),A.length>0&&await J.from("newsletter_videos").insert(A.map((Be,Ee)=>({newsletter_id:Ne,title:Be.title,video_url:Be.video_url,sort_order:Ee}))),T.length>0&&await J.from("newsletter_canva_links").insert(T.map((Be,Ee)=>({newsletter_id:Ne,title:Be.title,canva_share_link:Be.canva_share_link,sort_order:Ee})))},ae=async Ne=>{o(Ne),i({title:Ne.title,description:Ne.description||"",publish_date:yn(new Date(Ne.publish_date),"yyyy-MM-dd'T'HH:mm"),is_published:Ne.is_published}),y(Ne.preview_image_url),F(Ne.content_blocks||[]);const[Be,Ee,Ue,Re]=await Promise.all([J.from("newsletter_drive_links").select("*").eq("newsletter_id",Ne.id).order("sort_order"),J.from("newsletter_pdfs").select("*").eq("newsletter_id",Ne.id).order("sort_order"),J.from("newsletter_videos").select("*").eq("newsletter_id",Ne.id).order("sort_order"),J.from("newsletter_canva_links").select("*").eq("newsletter_id",Ne.id).order("sort_order")]);j(Be.data||[]),N(Ee.data||[]),E(Ue.data||[]),L(Re.data||[]),H([]),s(!0)},he=async Ne=>{const[Be,Ee,Ue,Re]=await Promise.all([J.from("newsletter_drive_links").select("*").eq("newsletter_id",Ne.id).order("sort_order"),J.from("newsletter_pdfs").select("*").eq("newsletter_id",Ne.id).order("sort_order"),J.from("newsletter_videos").select("*").eq("newsletter_id",Ne.id).order("sort_order"),J.from("newsletter_canva_links").select("*").eq("newsletter_id",Ne.id).order("sort_order")]);o(null),i({title:`${Ne.title} (Copy)`,description:Ne.description||"",publish_date:yn(new Date,"yyyy-MM-dd'T'HH:mm"),is_published:!1}),y(Ne.preview_image_url),F(Ne.content_blocks||[]),j((Be.data||[]).map(({id:je,...et})=>et)),N((Ee.data||[]).map(({id:je,...et})=>et)),E((Ue.data||[]).map(({id:je,...et})=>et)),L((Re.data||[]).map(({id:je,...et})=>et)),H([]),s(!0)},ue=()=>{s(!1),o(null),i({title:"",description:"",publish_date:yn(new Date,"yyyy-MM-dd'T'HH:mm"),is_published:!1}),p(null),y(null),j([]),N([]),E([]),L([]),F([]),H([])},_e=async Ne=>{var Ee;const Be=(Ee=Ne.target.files)==null?void 0:Ee[0];Be&&(p(Be),y(URL.createObjectURL(Be)))},Ae=async()=>{if(!l.title){t({title:"Title is required",variant:"destructive"});return}G(!0);let Ne=x;if(h){const Be=`previews/${Date.now()}-${h.name}`,{error:Ee}=await J.storage.from("newsletter-content").upload(Be,h);if(!Ee){const{data:Ue}=J.storage.from("newsletter-content").getPublicUrl(Be);Ne=Ue.publicUrl}}a?ye.mutate({id:a.id,...l,preview_image_url:Ne,content_blocks:z}):le.mutate({...l,preview_image_url:Ne,content_blocks:z}),G(!1)},Ce=()=>j([...b,{title:"",drive_url:"",sort_order:b.length}]),be=()=>E([...A,{title:"",video_url:"",sort_order:A.length}]),me=()=>L([...T,{title:"",canva_share_link:"",sort_order:T.length}]),Le=Ne=>{const Be=Ne.target.files;if(!Be)return;const Ee=Array.from(Be).map(Ue=>({file:Ue,name:Ue.name.replace(/\.[^/.]+$/,"")}));H([...q,...Ee])};return r.jsx(Lr,{title:"Newsletter Content",description:"Manage monthly newsletter templates and resources",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Gu,{title:"Newsletter Content",description:"Manage monthly newsletter templates and resources"}),r.jsxs("div",{className:"flex flex-col sm:flex-row justify-between items-start sm:items-center gap-4",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs(Ye,{children:[r.jsx(Gt,{className:"pb-2",children:r.jsx(Zt,{className:"text-sm font-medium text-muted-foreground",children:"Total"})}),r.jsx(tt,{children:r.jsx("div",{className:"text-2xl font-bold",children:(te==null?void 0:te.length)||0})})]}),r.jsxs(Ye,{children:[r.jsx(Gt,{className:"pb-2",children:r.jsx(Zt,{className:"text-sm font-medium text-muted-foreground",children:"Published"})}),r.jsx(tt,{children:r.jsx("div",{className:"text-2xl font-bold",children:(te==null?void 0:te.filter(Ne=>Ne.is_published).length)||0})})]})]}),r.jsxs(Fr,{open:n,onOpenChange:Ne=>!Ne&&ue(),children:[r.jsx(zo,{asChild:!0,children:r.jsxs(ee,{onClick:()=>s(!0),children:[r.jsx(bn,{className:"mr-2 h-4 w-4"})," Add Newsletter"]})}),r.jsxs(Rr,{className:"max-w-4xl max-h-[90vh] overflow-y-auto",children:[r.jsx(qr,{children:r.jsx($r,{children:a?"Edit Newsletter":"Add Newsletter"})}),r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Title *"}),r.jsx(dt,{value:l.title,onChange:Ne=>i({...l,title:Ne.target.value}),placeholder:"Newsletter title"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Publish Date"}),r.jsx(dt,{type:"datetime-local",value:l.publish_date,onChange:Ne=>i({...l,publish_date:Ne.target.value})})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Description"}),r.jsx(fy,{content:l.description,onChange:Ne=>i({...l,description:Ne}),placeholder:"Newsletter description",minHeight:"120px"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Preview Image"}),r.jsxs("div",{className:"flex items-center gap-4",children:[x&&r.jsxs("div",{className:"relative group",children:[r.jsx("img",{src:x,alt:"Preview",className:"h-20 w-32 object-cover rounded-md"}),r.jsx(ee,{type:"button",variant:"destructive",size:"icon",className:"absolute -top-2 -right-2 h-5 w-5 opacity-0 group-hover:opacity-100 transition-opacity",onClick:()=>{p(null),y(null)},children:r.jsx(_s,{className:"h-3 w-3"})})]}),r.jsxs("div",{children:[r.jsx(dt,{type:"file",accept:"image/*",onChange:_e,className:"hidden",id:"preview-upload"}),r.jsx(ee,{variant:"outline",asChild:!0,children:r.jsxs("label",{htmlFor:"preview-upload",className:"cursor-pointer",children:[r.jsx(uo,{className:"mr-2 h-4 w-4"})," Upload Image"]})})]})]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ps,{checked:l.is_published,onCheckedChange:Ne=>i({...l,is_published:Ne})}),r.jsx(He,{children:"Published"})]}),r.jsx(zwt,{rows:z,onChange:F}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(He,{className:"text-base font-medium",children:"Canva Links"}),r.jsxs(ee,{type:"button",variant:"outline",size:"sm",onClick:me,children:[r.jsx(bn,{className:"mr-1 h-3 w-3"})," Add Canva Link"]})]}),T.map((Ne,Be)=>r.jsxs("div",{className:"flex gap-2 items-center",children:[r.jsx(dt,{placeholder:"Link title",value:Ne.title,onChange:Ee=>{const Ue=[...T];Ue[Be].title=Ee.target.value,L(Ue)},className:"w-1/3"}),r.jsx(dt,{placeholder:"Canva share link",value:Ne.canva_share_link,onChange:Ee=>{const Ue=[...T];Ue[Be].canva_share_link=Ee.target.value,L(Ue)},className:"flex-1"}),r.jsx(ee,{type:"button",variant:"ghost",size:"icon",onClick:()=>L(T.filter((Ee,Ue)=>Ue!==Be)),children:r.jsx(_s,{className:"h-4 w-4"})})]},Be))]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(He,{className:"text-base font-medium",children:"Google Drive Links"}),r.jsxs(ee,{type:"button",variant:"outline",size:"sm",onClick:Ce,children:[r.jsx(bn,{className:"mr-1 h-3 w-3"})," Add Link"]})]}),b.map((Ne,Be)=>r.jsxs("div",{className:"flex gap-2 items-center",children:[r.jsx(dt,{placeholder:"Link title",value:Ne.title,onChange:Ee=>{const Ue=[...b];Ue[Be].title=Ee.target.value,j(Ue)},className:"w-1/3"}),r.jsx(dt,{placeholder:"Google Drive URL",value:Ne.drive_url,onChange:Ee=>{const Ue=[...b];Ue[Be].drive_url=Ee.target.value,j(Ue)},className:"flex-1"}),r.jsx(ee,{type:"button",variant:"ghost",size:"icon",onClick:()=>j(b.filter((Ee,Ue)=>Ue!==Be)),children:r.jsx(_s,{className:"h-4 w-4"})})]},Be))]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(He,{className:"text-base font-medium",children:"PDF Files"}),r.jsxs("div",{children:[r.jsx(dt,{type:"file",accept:".pdf",multiple:!0,onChange:Le,className:"hidden",id:"pdf-upload"}),r.jsx(ee,{variant:"outline",size:"sm",asChild:!0,children:r.jsxs("label",{htmlFor:"pdf-upload",className:"cursor-pointer",children:[r.jsx(uo,{className:"mr-1 h-3 w-3"})," Upload PDF"]})})]})]}),C.map((Ne,Be)=>r.jsxs("div",{className:"flex gap-2 items-center bg-muted/50 p-2 rounded",children:[r.jsx(La,{className:"h-4 w-4 text-muted-foreground"}),r.jsx("span",{className:"flex-1 text-sm",children:Ne.name}),r.jsx(ee,{type:"button",variant:"ghost",size:"icon",onClick:()=>N(C.filter((Ee,Ue)=>Ue!==Be)),children:r.jsx(_s,{className:"h-4 w-4"})})]},`existing-${Be}`)),q.map((Ne,Be)=>r.jsxs("div",{className:"flex gap-2 items-center bg-muted/50 p-2 rounded",children:[r.jsx(La,{className:"h-4 w-4 text-muted-foreground"}),r.jsx(dt,{value:Ne.name,onChange:Ee=>{const Ue=[...q];Ue[Be].name=Ee.target.value,H(Ue)},className:"flex-1 h-8",placeholder:"PDF name"}),r.jsx("span",{className:"text-xs text-muted-foreground",children:"(new)"}),r.jsx(ee,{type:"button",variant:"ghost",size:"icon",onClick:()=>H(q.filter((Ee,Ue)=>Ue!==Be)),children:r.jsx(_s,{className:"h-4 w-4"})})]},`pending-${Be}`))]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(He,{className:"text-base font-medium",children:"Video Links"}),r.jsxs(ee,{type:"button",variant:"outline",size:"sm",onClick:be,children:[r.jsx(bn,{className:"mr-1 h-3 w-3"})," Add Video"]})]}),A.map((Ne,Be)=>r.jsxs("div",{className:"flex gap-2 items-center",children:[r.jsx(dt,{placeholder:"Video title",value:Ne.title,onChange:Ee=>{const Ue=[...A];Ue[Be].title=Ee.target.value,E(Ue)},className:"w-1/3"}),r.jsx(dt,{placeholder:"Video URL",value:Ne.video_url,onChange:Ee=>{const Ue=[...A];Ue[Be].video_url=Ee.target.value,E(Ue)},className:"flex-1"}),r.jsx(ee,{type:"button",variant:"ghost",size:"icon",onClick:()=>E(A.filter((Ee,Ue)=>Ue!==Be)),children:r.jsx(_s,{className:"h-4 w-4"})})]},Be))]}),r.jsxs("div",{className:"flex justify-end gap-2 pt-4 border-t",children:[r.jsx(ee,{variant:"outline",onClick:ue,children:"Cancel"}),r.jsx(ee,{onClick:Ae,disabled:Z||le.isPending||ye.isPending,children:Z?"Uploading...":a?"Update":"Create"})]})]})]})]})]}),r.jsx(Ye,{children:r.jsx(tt,{className:"p-0",children:r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Ar,{children:[r.jsx(It,{children:"Name"}),r.jsx(It,{children:"Publish Date"}),r.jsx(It,{children:"Status"}),r.jsx(It,{className:"text-right",children:"Actions"})]})}),r.jsx(Vs,{children:ie?r.jsx(Ar,{children:r.jsx(Nt,{colSpan:4,className:"text-center py-8",children:"Loading..."})}):(te==null?void 0:te.length)===0?r.jsx(Ar,{children:r.jsx(Nt,{colSpan:4,className:"text-center py-8 text-muted-foreground",children:"No newsletters yet. Create your first one!"})}):te==null?void 0:te.map(Ne=>r.jsxs(Ar,{children:[r.jsx(Nt,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[Ne.preview_image_url?r.jsx("img",{src:Ne.preview_image_url,alt:Ne.title,className:"w-10 h-10 rounded object-cover"}):r.jsx("div",{className:"w-10 h-10 rounded bg-muted flex items-center justify-center",children:r.jsx(La,{className:"h-5 w-5 text-muted-foreground"})}),r.jsxs("div",{children:[r.jsx("div",{className:"font-medium",children:Ne.title}),Ne.description&&r.jsx("div",{className:"text-sm text-muted-foreground line-clamp-1",children:Ne.description.replace(/<[^>]*>/g,"")})]})]})}),r.jsx(Nt,{children:yn(new Date(Ne.publish_date),"MMM d, yyyy")}),r.jsx(Nt,{children:r.jsx("span",{className:`inline-flex items-center px-2 py-1 rounded-full text-xs font-medium ${Ne.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:Ne.is_published?"Published":"Draft"})}),r.jsx(Nt,{className:"text-right",children:r.jsxs("div",{className:"flex justify-end gap-1",children:[r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>ae(Ne),title:"Edit",children:r.jsx(_i,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>he(Ne),title:"Duplicate",children:r.jsx(hl,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"icon",className:"text-destructive hover:text-destructive",title:"Delete",onClick:()=>{confirm("Are you sure you want to delete this newsletter?")&&ne.mutate(Ne.id)},children:r.jsx(Vn,{className:"h-4 w-4"})})]})})]},Ne.id))})]})})})]})})}const n4e={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 $wt(){const{user:t}=Qr(),{toast:e}=fi(),n=rs(),s=Vr(),[a,o]=I.useState(""),[l,i]=I.useState("popular"),[h,p]=I.useState(!1),[x,y]=I.useState(""),[b,j]=I.useState(""),[C,N]=I.useState(!1),{data:A=[],isLoading:E}=Yt({queryKey:["wishlist-items",l,C],queryFn:async()=>{let q=J.from("wishlist_items").select("*");C&&t&&(q=q.eq("user_id",t.id)),l==="latest"?q=q.order("created_at",{ascending:!1}):l==="popular"?q=q.order("vote_count",{ascending:!1}):l==="trending"&&(q=q.order("vote_count",{ascending:!1}));const{data:H,error:Z}=await q;if(Z)throw Z;const G=[...new Set((H==null?void 0:H.map(ae=>ae.user_id))||[])],{data:te}=await J.from("profiles").select("id, name").in("id",G),ie=new Map((te==null?void 0:te.map(ae=>[ae.id,ae]))||[]);let le=[];if(t){const{data:ae}=await J.from("wishlist_votes").select("item_id").eq("user_id",t.id);le=(ae==null?void 0:ae.map(he=>he.item_id))||[]}const ye=(H==null?void 0:H.map(ae=>ae.id))||[],{data:ne}=await J.from("wishlist_comments").select("item_id").in("item_id",ye),ge=new Map;return ne==null||ne.forEach(ae=>{ge.set(ae.item_id,(ge.get(ae.item_id)||0)+1)}),H==null?void 0:H.map(ae=>{const he=ie.get(ae.user_id),ue=(he==null?void 0:he.name)||"Unknown";return{...ae,user_name:ue,user_initials:ue.split(" ").map(_e=>_e[0]).join("").toUpperCase().slice(0,2),has_voted:le.includes(ae.id),comment_count:ge.get(ae.id)||0}})}}),T=cr({mutationFn:async({title:q,description:H})=>{const{error:Z}=await J.from("wishlist_items").insert({user_id:t.id,title:q,description:H});if(Z)throw Z},onSuccess:()=>{s.invalidateQueries({queryKey:["wishlist-items"]}),p(!1),y(""),j(""),e({title:"Idea submitted!",description:"Your idea has been added to the wishlist."})},onError:q=>{e({title:"Error",description:q.message,variant:"destructive"})}}),L=cr({mutationFn:async({itemId:q,hasVoted:H})=>{if(H){const{error:Z}=await J.from("wishlist_votes").delete().eq("item_id",q).eq("user_id",t.id);if(Z)throw Z;return{itemId:q,wasAdded:!1}}else{const{error:Z}=await J.from("wishlist_votes").insert({item_id:q,user_id:t.id});if(Z)throw Z;return{itemId:q,wasAdded:!0}}},onSuccess:async q=>{if(s.invalidateQueries({queryKey:["wishlist-items"]}),q!=null&&q.wasAdded){const H=A.find(G=>G.id===q.itemId),Z=((H==null?void 0:H.vote_count)||0)+1;J.functions.invoke("wishlist-notify",{body:{itemId:q.itemId,voteCount:Z}}).catch(console.error)}},onError:q=>{e({title:"Error",description:q.message,variant:"destructive"})}}),z=A.filter(q=>q.title.toLowerCase().includes(a.toLowerCase())||q.description.toLowerCase().includes(a.toLowerCase())),F=()=>{if(!x.trim()||!b.trim()){e({title:"Error",description:"Please fill in both title and description.",variant:"destructive"});return}T.mutate({title:x.trim(),description:b.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(v1,{className:"h-6 w-6 text-primary"})}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-5xl font-bold",children:"Wishlist"}),r.jsx("p",{className:"text-muted-foreground text-sm",children:"Share ideas and vote on what we build next"})]})]}),r.jsxs(Fr,{open:h,onOpenChange:p,children:[r.jsx(zo,{asChild:!0,children:r.jsxs(ee,{className:"gap-2",children:[r.jsx(bn,{className:"h-4 w-4"}),"Add Idea"]})}),r.jsxs(Rr,{children:[r.jsx(qr,{children:r.jsx($r,{children:"Submit a New Idea"})}),r.jsxs("div",{className:"space-y-4 pt-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"title",children:"Title"}),r.jsx(dt,{id:"title",placeholder:"Give your idea a clear title...",value:x,onChange:q=>y(q.target.value)})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"description",children:"Description"}),r.jsx(ps,{id:"description",placeholder:"Describe your idea in detail. What problem does it solve? How would it help agents?",value:b,onChange:q=>j(q.target.value),rows:4})]}),r.jsx(ee,{onClick:F,className:"w-full",disabled:T.isPending,children:T.isPending?r.jsxs(r.Fragment,{children:[r.jsx(en,{className:"h-4 w-4 mr-2 animate-spin"}),"Submitting..."]}):"Submit Idea"})]})]})]})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 mb-6",children:[r.jsxs("div",{className:"relative flex-1",children:[r.jsx(wa,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(dt,{placeholder:"Search ideas...",value:a,onChange:q=>o(q.target.value),className:"pl-10"})]}),r.jsx("div",{className:"flex gap-2",children:r.jsx(Ii,{value:l,onValueChange:q=>i(q),children:r.jsxs(wi,{children:[r.jsx(ln,{value:"popular",children:"Most Popular"}),r.jsx(ln,{value:"latest",children:"Latest"}),r.jsx(ln,{value:"trending",children:"Trending"})]})})})]}),r.jsx("div",{className:"flex items-center gap-2 mb-4",children:r.jsx(ee,{variant:C?"default":"outline",size:"sm",onClick:()=>N(!C),children:C?"Show All Ideas":"My Ideas"})}),E?r.jsx("div",{className:"flex items-center justify-center py-12",children:r.jsx(en,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):z.length===0?r.jsxs("div",{className:"text-center py-12 bg-muted/30 rounded-lg",children:[r.jsx(v1,{className:"h-12 w-12 text-muted-foreground mx-auto mb-4"}),r.jsx("h3",{className:"text-lg font-medium mb-2",children:"No ideas yet"}),r.jsx("p",{className:"text-muted-foreground mb-4",children:"Be the first to submit an idea!"}),r.jsxs(ee,{onClick:()=>p(!0),children:[r.jsx(bn,{className:"h-4 w-4 mr-2"}),"Add Idea"]})]}):r.jsx("div",{className:"space-y-3",children:z.map(q=>r.jsx("div",{className:"bg-card border rounded-lg p-4 hover:shadow-md transition-shadow cursor-pointer",onClick:()=>n(`/wishlist/${q.id}`),children:r.jsxs("div",{className:"flex items-start gap-4",children:[r.jsxs("button",{onClick:H=>{H.stopPropagation(),L.mutate({itemId:q.id,hasVoted:q.has_voted||!1})},className:$t("flex flex-col items-center justify-center min-w-[50px] py-2 px-3 rounded-lg border transition-colors",q.has_voted?"bg-primary/10 border-primary text-primary":"bg-muted/50 border-border hover:bg-muted"),children:[r.jsx(mg,{className:$t("h-4 w-4",q.has_voted&&"fill-current")}),r.jsx("span",{className:"text-sm font-semibold",children:q.vote_count})]}),r.jsx(Ks,{className:"h-10 w-10 bg-primary/20",children:r.jsx(Zs,{className:"bg-primary/20 text-primary text-sm font-medium",children:q.user_initials})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[r.jsx("h3",{className:"font-semibold text-foreground",children:q.title}),r.jsx(Ot,{className:$t("text-xs",n4e[q.status].color),children:n4e[q.status].label})]}),r.jsx("p",{className:"text-muted-foreground text-sm line-clamp-2",children:q.description}),r.jsxs("div",{className:"flex items-center gap-3 mt-2 text-xs text-muted-foreground",children:[r.jsx("span",{children:q.user_name}),r.jsx("span",{children:"•"}),r.jsx("span",{children:new Date(q.created_at).toLocaleDateString()})]})]}),r.jsxs("div",{className:"flex items-center gap-1 text-muted-foreground",children:[r.jsx(Lo,{className:"h-4 w-4"}),r.jsx("span",{className:"text-sm",children:q.comment_count})]})]})},q.id))})]})})}const s4e={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 Uwt(){const{itemId:t}=Zc(),e=rs(),{user:n}=Qr(),{toast:s}=fi(),a=Vr(),[o,l]=I.useState(""),{data:i=!1}=Yt({queryKey:["user-is-admin",n==null?void 0:n.id],queryFn:async()=>{if(!n)return!1;const{data:A,error:E}=await J.from("user_roles").select("role").eq("user_id",n.id).eq("role","admin").maybeSingle();return!E&&!!A},enabled:!!n}),{data:h,isLoading:p}=Yt({queryKey:["wishlist-item",t],queryFn:async()=>{const{data:A,error:E}=await J.from("wishlist_items").select("*").eq("id",t).single();if(E)throw E;const{data:T}=await J.from("profiles").select("name").eq("id",A.user_id).single();let L=!1;if(n){const{data:z}=await J.from("wishlist_votes").select("id").eq("item_id",t).eq("user_id",n.id).maybeSingle();L=!!z}return{...A,user_name:(T==null?void 0:T.name)||"Unknown",user_initials:((T==null?void 0:T.name)||"U").split(" ").map(z=>z[0]).join("").toUpperCase().slice(0,2),has_voted:L}}}),{data:x=[],isLoading:y}=Yt({queryKey:["wishlist-comments",t],queryFn:async()=>{const{data:A,error:E}=await J.from("wishlist_comments").select("*").eq("item_id",t).order("created_at",{ascending:!0});if(E)throw E;const T=[...new Set((A==null?void 0:A.map(F=>F.user_id))||[])],{data:L}=await J.from("profiles").select("id, name").in("id",T),z=new Map((L==null?void 0:L.map(F=>[F.id,F]))||[]);return A==null?void 0:A.map(F=>{const q=z.get(F.user_id),H=(q==null?void 0:q.name)||"Unknown";return{...F,user_name:H,user_initials:H.split(" ").map(Z=>Z[0]).join("").toUpperCase().slice(0,2)}})}}),b=cr({mutationFn:async A=>{if(A){const{error:E}=await J.from("wishlist_votes").delete().eq("item_id",t).eq("user_id",n.id);if(E)throw E;return{wasAdded:!1}}else{const{error:E}=await J.from("wishlist_votes").insert({item_id:t,user_id:n.id});if(E)throw E;return{wasAdded:!0}}},onSuccess:async A=>{if(a.invalidateQueries({queryKey:["wishlist-item",t]}),a.invalidateQueries({queryKey:["wishlist-items"]}),A!=null&&A.wasAdded&&h){const E=(h.vote_count||0)+1;J.functions.invoke("wishlist-notify",{body:{itemId:t,voteCount:E}}).catch(console.error)}},onError:A=>{s({title:"Error",description:A.message,variant:"destructive"})}}),j=cr({mutationFn:async A=>{const{error:E}=await J.from("wishlist_comments").insert({item_id:t,user_id:n.id,content:A});if(E)throw E},onSuccess:()=>{a.invalidateQueries({queryKey:["wishlist-comments",t]}),l(""),s({title:"Comment added!"})},onError:A=>{s({title:"Error",description:A.message,variant:"destructive"})}}),C=cr({mutationFn:async A=>{const{error:E}=await J.from("wishlist_comments").delete().eq("id",A);if(E)throw E},onSuccess:()=>{a.invalidateQueries({queryKey:["wishlist-comments",t]}),s({title:"Comment deleted"})},onError:A=>{s({title:"Error",description:A.message,variant:"destructive"})}}),N=()=>{o.trim()&&j.mutate(o.trim())};return p?r.jsx(Lr,{title:"Wishlist",children:r.jsxs("div",{className:"max-w-3xl mx-auto",children:[r.jsx(Ir,{className:"h-8 w-32 mb-6"}),r.jsx(Ir,{className:"h-48 w-full mb-6"}),r.jsx(Ir,{className:"h-32 w-full"})]})}):h?r.jsx(Lr,{title:"Wishlist",children:r.jsxs("div",{className:"max-w-3xl mx-auto",children:[r.jsxs(ee,{variant:"ghost",size:"sm",onClick:()=>e("/wishlist"),className:"mb-4",children:[r.jsx(so,{className:"h-4 w-4 mr-2"}),"Back to Wishlist"]}),r.jsx("div",{className:"bg-card border rounded-lg p-6 mb-6",children:r.jsxs("div",{className:"flex items-start gap-4",children:[r.jsxs("button",{onClick:()=>b.mutate(h.has_voted),className:$t("flex flex-col items-center justify-center min-w-[60px] py-3 px-4 rounded-lg border transition-colors",h.has_voted?"bg-primary/10 border-primary text-primary":"bg-muted/50 border-border hover:bg-muted"),children:[r.jsx(mg,{className:$t("h-5 w-5",h.has_voted&&"fill-current")}),r.jsx("span",{className:"text-lg font-bold",children:h.vote_count}),r.jsx("span",{className:"text-xs",children:"votes"})]}),r.jsxs("div",{className:"flex-1",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[r.jsx("h1",{className:"text-xl font-bold",children:h.title}),r.jsx(Ot,{className:$t("text-xs",s4e[h.status].color),children:s4e[h.status].label})]}),r.jsx("p",{className:"text-muted-foreground whitespace-pre-wrap mb-4",children:h.description}),r.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[r.jsx(Ks,{className:"h-6 w-6",children:r.jsx(Zs,{className:"bg-primary/20 text-primary text-xs",children:h.user_initials})}),r.jsx("span",{children:h.user_name}),r.jsx("span",{children:"•"}),r.jsx("span",{children:new Date(h.created_at).toLocaleDateString()})]})]})]})}),r.jsxs("div",{className:"bg-card border rounded-lg p-6",children:[r.jsxs("h2",{className:"text-lg font-semibold mb-4",children:["Comments (",x.length,")"]}),r.jsxs("div",{className:"flex gap-3 mb-6",children:[r.jsx(wte,{placeholder:i?"Share your thoughts... Use # to link templates":"Share your thoughts on this idea...",value:o,onChange:l,minHeight:"60px",mentionFormat:"encoded",enableTemplateMentions:i}),r.jsx(ee,{onClick:N,disabled:!o.trim()||j.isPending,size:"icon",className:"h-auto",children:j.isPending?r.jsx(en,{className:"h-4 w-4 animate-spin"}):r.jsx(Oo,{className:"h-4 w-4"})})]}),y?r.jsx("div",{className:"space-y-4",children:[1,2].map(A=>r.jsx(Ir,{className:"h-20 w-full"},A))}):x.length===0?r.jsx("p",{className:"text-center text-muted-foreground py-8",children:"No comments yet. Be the first to share your thoughts!"}):r.jsx("div",{className:"space-y-4",children:x.map(A=>r.jsxs("div",{className:"flex gap-3 p-3 bg-muted/30 rounded-lg",children:[r.jsx(Ks,{className:"h-8 w-8",children:r.jsx(Zs,{className:"bg-primary/20 text-primary text-xs",children:A.user_initials})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[r.jsx("span",{className:"font-medium text-sm",children:A.user_name}),r.jsx("span",{className:"text-xs text-muted-foreground",children:new Date(A.created_at).toLocaleDateString()})]}),r.jsx(Oxe,{content:A.content,className:"text-sm text-foreground"})]}),(n==null?void 0:n.id)===A.user_id&&r.jsx(ee,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-destructive",onClick:()=>C.mutate(A.id),children:r.jsx(Vn,{className:"h-4 w-4"})})]},A.id))})]})]})}):r.jsx(Lr,{title:"Wishlist",children:r.jsxs("div",{className:"max-w-3xl mx-auto text-center py-12",children:[r.jsx("p",{className:"text-muted-foreground",children:"Item not found"}),r.jsx(ee,{variant:"link",onClick:()=>e("/wishlist"),children:"Go back to Wishlist"})]})})}const a4e={open:{label:"Open",color:"bg-blue-100 text-blue-800"},under_review:{label:"Under Review",color:"bg-yellow-100 text-yellow-800"},planned:{label:"Planned",color:"bg-purple-100 text-purple-800"},in_progress:{label:"In Progress",color:"bg-orange-100 text-orange-800"},launched:{label:"Launched",color:"bg-green-100 text-green-800"},declined:{label:"Declined",color:"bg-gray-100 text-gray-800"}},i4e=["open","under_review","planned","in_progress","launched","declined"];function qwt(){const{toast:t}=fi(),e=rs(),n=Vr(),[s,a]=I.useState(""),[o,l]=I.useState("all"),[i,h]=I.useState(!1),[p,x]=I.useState(null),{data:y=[],isLoading:b}=Yt({queryKey:["admin-wishlist-items"],queryFn:async()=>{const{data:E,error:T}=await J.from("wishlist_items").select("*").order("vote_count",{ascending:!1});if(T)throw T;const L=[...new Set((E==null?void 0:E.map(G=>G.user_id))||[])],{data:z}=await J.from("profiles").select("id, name, email").in("id",L),F=new Map((z==null?void 0:z.map(G=>[G.id,G]))||[]),q=(E==null?void 0:E.map(G=>G.id))||[],{data:H}=await J.from("wishlist_comments").select("item_id").in("item_id",q),Z=new Map;return H==null||H.forEach(G=>{Z.set(G.item_id,(Z.get(G.item_id)||0)+1)}),E==null?void 0:E.map(G=>{const te=F.get(G.user_id);return{...G,user_name:(te==null?void 0:te.name)||"Unknown",user_email:(te==null?void 0:te.email)||"",comment_count:Z.get(G.id)||0}})}}),j=cr({mutationFn:async({itemId:E,status:T})=>{const{error:L}=await J.from("wishlist_items").update({status:T}).eq("id",E);if(L)throw L},onSuccess:()=>{n.invalidateQueries({queryKey:["admin-wishlist-items"]}),t({title:"Status updated!"})},onError:E=>{t({title:"Error",description:E.message,variant:"destructive"})}}),C=cr({mutationFn:async E=>{const{error:T}=await J.from("wishlist_items").delete().eq("id",E);if(T)throw T},onSuccess:()=>{n.invalidateQueries({queryKey:["admin-wishlist-items"]}),h(!1),x(null),t({title:"Item deleted!"})},onError:E=>{t({title:"Error",description:E.message,variant:"destructive"})}}),N=y.filter(E=>{const T=E.title.toLowerCase().includes(s.toLowerCase())||E.description.toLowerCase().includes(s.toLowerCase())||E.user_name.toLowerCase().includes(s.toLowerCase()),L=o==="all"||E.status===o;return T&&L}),A={total:y.length,open:y.filter(E=>E.status==="open").length,inProgress:y.filter(E=>E.status==="in_progress").length,launched:y.filter(E=>E.status==="launched").length,highVotes:y.filter(E=>E.vote_count>=10).length};return r.jsx(Lr,{title:"Admin - Wishlist",children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>e("/admin"),children:r.jsx(so,{className:"h-5 w-5"})}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold",children:"Wishlist Management"}),r.jsx("p",{className:"text-muted-foreground",children:"Review and manage community ideas"})]})]}),r.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-5 gap-4",children:[r.jsxs("div",{className:"bg-card border rounded-lg p-4",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Total Ideas"}),r.jsx("p",{className:"text-2xl font-bold",children:A.total})]}),r.jsxs("div",{className:"bg-card border rounded-lg p-4",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Open"}),r.jsx("p",{className:"text-2xl font-bold text-blue-600",children:A.open})]}),r.jsxs("div",{className:"bg-card border rounded-lg p-4",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"In Progress"}),r.jsx("p",{className:"text-2xl font-bold text-orange-600",children:A.inProgress})]}),r.jsxs("div",{className:"bg-card border rounded-lg p-4",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Launched"}),r.jsx("p",{className:"text-2xl font-bold text-green-600",children:A.launched})]}),r.jsxs("div",{className:"bg-card border rounded-lg p-4",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"10+ Votes"}),r.jsx("p",{className:"text-2xl font-bold text-primary",children:A.highVotes})]})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[r.jsxs("div",{className:"relative flex-1",children:[r.jsx(wa,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(dt,{placeholder:"Search ideas, users...",value:s,onChange:E=>a(E.target.value),className:"pl-10"})]}),r.jsxs(gn,{value:o,onValueChange:E=>l(E),children:[r.jsx(fn,{className:"w-[180px]",children:r.jsx(xn,{placeholder:"Filter by status"})}),r.jsxs(pn,{children:[r.jsx(Vt,{value:"all",children:"All Statuses"}),i4e.map(E=>r.jsx(Vt,{value:E,children:a4e[E].label},E))]})]})]}),b?r.jsx("div",{className:"space-y-2",children:[1,2,3,4,5].map(E=>r.jsx(Ir,{className:"h-16 w-full"},E))}):r.jsx("div",{className:"bg-card border rounded-lg overflow-hidden",children:r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Ar,{children:[r.jsx(It,{className:"w-[60px]",children:"Votes"}),r.jsx(It,{children:"Title"}),r.jsx(It,{className:"hidden md:table-cell",children:"Submitted By"}),r.jsx(It,{className:"hidden sm:table-cell",children:"Comments"}),r.jsx(It,{children:"Status"}),r.jsx(It,{className:"w-[100px]",children:"Actions"})]})}),r.jsx(Vs,{children:N.length===0?r.jsx(Ar,{children:r.jsx(Nt,{colSpan:6,className:"text-center py-8 text-muted-foreground",children:"No items found"})}):N.map(E=>r.jsxs(Ar,{className:$t(E.vote_count>=10&&"bg-primary/5"),children:[r.jsx(Nt,{children:r.jsx(Ot,{variant:E.vote_count>=10?"default":"secondary",children:E.vote_count})}),r.jsx(Nt,{children:r.jsxs("div",{children:[r.jsx("p",{className:"font-medium line-clamp-1",children:E.title}),r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-1",children:E.description})]})}),r.jsx(Nt,{className:"hidden md:table-cell",children:r.jsxs("div",{children:[r.jsx("p",{className:"text-sm",children:E.user_name}),r.jsx("p",{className:"text-xs text-muted-foreground",children:E.user_email})]})}),r.jsx(Nt,{className:"hidden sm:table-cell",children:E.comment_count}),r.jsx(Nt,{children:r.jsxs(gn,{value:E.status,onValueChange:T=>j.mutate({itemId:E.id,status:T}),children:[r.jsx(fn,{className:"w-[140px] h-8",children:r.jsx(xn,{})}),r.jsx(pn,{children:i4e.map(T=>r.jsx(Vt,{value:T,children:a4e[T].label},T))})]})}),r.jsx(Nt,{children:r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>window.open(`/wishlist/${E.id}`,"_blank"),children:r.jsx(Fs,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"icon",className:"text-destructive",onClick:()=>{x(E.id),h(!0)},children:r.jsx(Vn,{className:"h-4 w-4"})})]})})]},E.id))})]})}),r.jsx(Fr,{open:i,onOpenChange:h,children:r.jsxs(Rr,{children:[r.jsx(qr,{children:r.jsx($r,{children:"Delete Wishlist Item"})}),r.jsx("p",{className:"text-muted-foreground",children:"Are you sure you want to delete this idea? This will also delete all votes and comments."}),r.jsxs("div",{className:"flex justify-end gap-2 mt-4",children:[r.jsx(ee,{variant:"outline",onClick:()=>h(!1),children:"Cancel"}),r.jsx(ee,{variant:"destructive",onClick:()=>p&&C.mutate(p),disabled:C.isPending,children:C.isPending?r.jsxs(r.Fragment,{children:[r.jsx(en,{className:"h-4 w-4 mr-2 animate-spin"}),"Deleting..."]}):"Delete"})]})]})})]})})}function Vwt(){const{user:t}=Qr(),[e,n]=I.useState([]),[s,a]=I.useState(!0),[o,l]=I.useState(!1),[i,h]=I.useState(null),[p,x]=I.useState(!1),[y,b]=I.useState(null),[j,C]=I.useState(""),[N,A]=I.useState(""),[E,T]=I.useState(""),[L,z]=I.useState(""),[F,q]=I.useState(""),[H,Z]=I.useState(!1),[G,te]=I.useState(""),[ie,le]=I.useState("once"),[ye,ne]=I.useState([]),[ge,ae]=I.useState([]),[he,ue]=I.useState(!1),[_e,Ae]=I.useState(!1),[Ce,be]=I.useState([]),[me,Le]=I.useState({total:0,dismissed:0});I.useEffect(()=>{Ne()},[]);const Ne=async()=>{const{data:nt,error:gt}=await J.from("levelup_briefs").select("*").order("created_at",{ascending:!1});gt?(ze.error("Failed to fetch briefs"),console.error(gt)):n(nt||[]),a(!1)},Be=()=>{C(""),A(""),T(""),z(""),q(""),Z(!1),te(new Date().toISOString().slice(0,16)),le("once"),ne([]),ae([]),h(null)},Ee=()=>{Be(),l(!0)},Ue=async nt=>{h(nt),C(nt.title),A(nt.description||""),T(nt.video_url||""),z(nt.graphic_url||""),q(nt.graphic_link_url||""),Z(nt.is_published),te(nt.publish_date.slice(0,16)),le(nt.show_frequency);const{data:gt}=await J.from("levelup_brief_links").select("*").eq("brief_id",nt.id).order("sort_order");ne((gt==null?void 0:gt.map(Mt=>({title:Mt.title,url:Mt.url})))||[]);const{data:mt}=await J.from("levelup_brief_polls").select("*").eq("brief_id",nt.id).order("sort_order");if(mt){const Mt=[];for(const wt of mt){const{data:Qt}=await J.from("levelup_brief_poll_options").select("*").eq("poll_id",wt.id).order("sort_order");Mt.push({question:wt.question,poll_type:wt.poll_type,options:(Qt==null?void 0:Qt.map(Cr=>Cr.option_text))||[]})}ae(Mt)}l(!0)},Re=async nt=>{var mt;const gt=(mt=nt.target.files)==null?void 0:mt[0];if(gt){ue(!0);try{const Mt=await J.functions.invoke("bunny-upload",{body:{action:"create",title:gt.name.replace(/\.[^/.]+$/,"")}});if(Mt.error)throw Mt.error;const{videoId:wt,libraryId:Qt}=Mt.data,Cr=await J.functions.invoke("bunny-upload",{body:{action:"upload-url",videoId:wt}});if(Cr.error)throw Cr.error;const{uploadUrl:cn,apiKey:jn}=Cr.data,Xr=new XMLHttpRequest;await new Promise((js,hr)=>{Xr.upload.addEventListener("progress",xs=>{if(xs.lengthComputable){const ka=Math.round(xs.loaded/xs.total*100);console.log("Upload progress:",ka)}}),Xr.addEventListener("load",()=>{Xr.status>=200&&Xr.status<300?js():hr(new Error(`Upload failed with status ${Xr.status}`))}),Xr.addEventListener("error",()=>hr(new Error("Upload failed"))),Xr.open("PUT",cn),Xr.setRequestHeader("AccessKey",jn),Xr.send(gt)});const Pn=`https://player.mediadelivery.net/embed/${Qt}/${wt}`;T(Pn),ze.success("Video uploaded successfully! It may take a few minutes to process.")}catch(Mt){console.error("Upload error:",Mt),ze.error("Failed to upload video")}finally{ue(!1)}}},je=async()=>{if(!j.trim()){ze.error("Title is required");return}try{let nt;if(i){const{error:gt}=await J.from("levelup_briefs").update({title:j,description:N||null,video_url:E||null,graphic_url:L||null,graphic_link_url:F||null,is_published:H,publish_date:G,show_frequency:ie}).eq("id",i.id);if(gt)throw gt;nt=i.id,await J.from("levelup_brief_links").delete().eq("brief_id",nt);const{data:mt}=await J.from("levelup_brief_polls").select("id").eq("brief_id",nt);if(mt)for(const Mt of mt)await J.from("levelup_brief_poll_options").delete().eq("poll_id",Mt.id);await J.from("levelup_brief_polls").delete().eq("brief_id",nt)}else{const{data:gt,error:mt}=await J.from("levelup_briefs").insert({title:j,description:N||null,video_url:E||null,graphic_url:L||null,graphic_link_url:F||null,is_published:H,publish_date:G,show_frequency:ie,created_by:t==null?void 0:t.id}).select().single();if(mt)throw mt;nt=gt.id}if(ye.length>0){const gt=ye.map((mt,Mt)=>({brief_id:nt,title:mt.title,url:mt.url,sort_order:Mt}));await J.from("levelup_brief_links").insert(gt)}for(let gt=0;gt0){const Qt=mt.options.map((Cr,cn)=>({poll_id:Mt.id,option_text:Cr,sort_order:cn}));await J.from("levelup_brief_poll_options").insert(Qt)}}ze.success(i?"Brief updated":"Brief created"),l(!1),Be(),Ne()}catch(nt){console.error("Error saving brief:",nt),ze.error("Failed to save brief")}},et=async nt=>{if(confirm("Are you sure you want to delete this brief?"))try{const{error:gt}=await J.from("levelup_briefs").delete().eq("id",nt);if(gt)throw gt;ze.success("Brief deleted"),Ne()}catch(gt){console.error("Error deleting brief:",gt),ze.error("Failed to delete brief")}},Te=async nt=>{b(nt);const{count:gt}=await J.from("levelup_brief_views").select("*",{count:"exact",head:!0}).eq("brief_id",nt.id),{count:mt}=await J.from("levelup_brief_views").select("*",{count:"exact",head:!0}).eq("brief_id",nt.id).not("dismissed_at","is",null);Le({total:gt||0,dismissed:mt||0});const{data:Mt}=await J.from("levelup_brief_polls").select("*").eq("brief_id",nt.id).order("sort_order");if(Mt){const wt=[];for(const Qt of Mt){const{data:Cr}=await J.from("levelup_brief_poll_options").select("*").eq("poll_id",Qt.id).order("sort_order"),{data:cn}=await J.from("levelup_brief_poll_responses").select("option_id").eq("poll_id",Qt.id),jn={};let Xr=0;Cr&&Cr.forEach(Pn=>{const js=(cn==null?void 0:cn.filter(hr=>hr.option_id===Pn.id).length)||0;jn[Pn.id]=js,Xr+=js}),wt.push({...Qt,options:Cr||[],results:jn,totalResponses:Qt.poll_type==="single"?new Set(cn==null?void 0:cn.map(Pn=>Pn.option_id)).size:Xr})}be(wt)}x(!0)},Ze=()=>{ne([...ye,{title:"",url:""}])},pe=(nt,gt,mt)=>{const Mt=[...ye];Mt[nt][gt]=mt,ne(Mt)},yt=nt=>{ne(ye.filter((gt,mt)=>mt!==nt))},rt=()=>{ae([...ge,{question:"",poll_type:"single",options:["",""]}])},at=(nt,gt)=>{const mt=[...ge];mt[nt].question=gt,ae(mt)},Me=(nt,gt)=>{const mt=[...ge];mt[nt].poll_type=gt,ae(mt)},ft=nt=>{const gt=[...ge];gt[nt].options.push(""),ae(gt)},qe=(nt,gt,mt)=>{const Mt=[...ge];Mt[nt].options[gt]=mt,ae(Mt)},Oe=(nt,gt)=>{const mt=[...ge];mt[nt].options=mt[nt].options.filter((Mt,wt)=>wt!==gt),ae(mt)},Qe=nt=>{ae(ge.filter((gt,mt)=>mt!==nt))};return r.jsxs(Lr,{title:"The LevelUp Brief",children:[r.jsxs("div",{className:"space-y-6",children:[r.jsx(Gu,{title:"The LevelUp Brief",description:"Create engaging popup briefs for your agents",children:r.jsxs(ee,{onClick:Ee,children:[r.jsx(bn,{className:"h-4 w-4 mr-2"}),"Create Brief"]})}),r.jsx(Ye,{children:r.jsx(tt,{className:"p-0",children:r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Ar,{children:[r.jsx(It,{children:"Title"}),r.jsx(It,{children:"Status"}),r.jsx(It,{children:"Frequency"}),r.jsx(It,{children:"Publish Date"}),r.jsx(It,{className:"text-right",children:"Actions"})]})}),r.jsx(Vs,{children:s?r.jsx(Ar,{children:r.jsx(Nt,{colSpan:5,className:"text-center py-8",children:"Loading..."})}):e.length===0?r.jsx(Ar,{children:r.jsx(Nt,{colSpan:5,className:"text-center py-8 text-muted-foreground",children:"No briefs created yet"})}):e.map(nt=>r.jsxs(Ar,{children:[r.jsx(Nt,{className:"font-medium",children:nt.title}),r.jsx(Nt,{children:r.jsx(Ot,{variant:nt.is_published?"default":"secondary",children:nt.is_published?"Published":"Draft"})}),r.jsx(Nt,{className:"capitalize",children:nt.show_frequency.replace("_"," ")}),r.jsx(Nt,{children:yn(new Date(nt.publish_date),"MMM d, yyyy h:mm a")}),r.jsx(Nt,{className:"text-right",children:r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>Te(nt),children:r.jsx(cc,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>Ue(nt),children:r.jsx(ac,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>et(nt.id),children:r.jsx(Vn,{className:"h-4 w-4 text-destructive"})})]})})]},nt.id))})]})})})]}),r.jsx(Fr,{open:o,onOpenChange:l,children:r.jsxs(Rr,{className:"max-w-3xl max-h-[90vh] overflow-y-auto",children:[r.jsx(qr,{children:r.jsx($r,{children:i?"Edit Brief":"Create New Brief"})}),r.jsxs(Ii,{defaultValue:"content",className:"w-full",children:[r.jsxs(wi,{className:"grid w-full grid-cols-4",children:[r.jsx(ln,{value:"content",children:"Content"}),r.jsx(ln,{value:"media",children:"Media"}),r.jsx(ln,{value:"links",children:"Links"}),r.jsx(ln,{value:"polls",children:"Polls"})]}),r.jsxs(An,{value:"content",className:"space-y-4 mt-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Title *"}),r.jsx(dt,{value:j,onChange:nt=>C(nt.target.value),placeholder:"What's happening at LevelUp..."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Description"}),r.jsx(fy,{content:N,onChange:nt=>A(nt),placeholder:"Brief overview for agents...",minHeight:"120px"})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Publish Date"}),r.jsx(dt,{type:"datetime-local",value:G,onChange:nt=>te(nt.target.value)})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Show Frequency"}),r.jsxs(gn,{value:ie,onValueChange:le,children:[r.jsx(fn,{children:r.jsx(xn,{})}),r.jsxs(pn,{children:[r.jsx(Vt,{value:"once",children:"Once (until dismissed)"}),r.jsx(Vt,{value:"every_login",children:"Every login"}),r.jsx(Vt,{value:"daily",children:"Daily"})]})]})]})]}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(Ps,{checked:H,onCheckedChange:Z}),r.jsx(He,{children:"Publish immediately"})]})]}),r.jsxs(An,{value:"media",className:"space-y-6 mt-4",children:[r.jsxs("div",{className:"space-y-4",children:[r.jsx("h4",{className:"font-semibold text-sm text-foreground",children:"Video (optional)"}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Upload Video to Bunny.net"}),r.jsx("div",{className:"flex gap-2",children:r.jsx(dt,{type:"file",accept:"video/*",onChange:Re,disabled:he})}),he&&r.jsx("p",{className:"text-sm text-muted-foreground",children:"Uploading..."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Or paste embed URL"}),r.jsx(dt,{value:E,onChange:nt=>T(nt.target.value),placeholder:"https://iframe.mediadelivery.net/embed/..."})]}),E&&r.jsx("div",{className:"aspect-video rounded-lg overflow-hidden bg-muted",children:r.jsx("iframe",{src:E,className:"w-full h-full",allow:"autoplay; fullscreen",allowFullScreen:!0})})]}),r.jsxs("div",{className:"border-t pt-4 space-y-4",children:[r.jsx("h4",{className:"font-semibold text-sm text-foreground",children:"Graphic / Image (optional)"}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Upload Image"}),r.jsx("div",{className:"flex gap-2",children:r.jsx(dt,{type:"file",accept:"image/*",onChange:async nt=>{var mt;const gt=(mt=nt.target.files)==null?void 0:mt[0];if(gt){Ae(!0);try{const Mt=gt.name.split(".").pop(),wt=`brief-graphics/${Date.now()}.${Mt}`,{error:Qt}=await J.storage.from("banner-images").upload(wt,gt,{upsert:!0});if(Qt)throw Qt;const{data:Cr}=J.storage.from("banner-images").getPublicUrl(wt);z(Cr.publicUrl),ze.success("Image uploaded!")}catch(Mt){console.error(Mt),ze.error("Failed to upload image")}finally{Ae(!1)}}},disabled:_e})}),_e&&r.jsx("p",{className:"text-sm text-muted-foreground",children:"Uploading..."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Or paste Image URL"}),r.jsx(dt,{value:L,onChange:nt=>z(nt.target.value),placeholder:"https://example.com/image.png"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Click-through Link (optional)"}),r.jsx(dt,{value:F,onChange:nt=>q(nt.target.value),placeholder:"https://example.com/landing-page"})]}),L&&r.jsx("div",{className:"rounded-lg overflow-hidden bg-muted border",children:r.jsx("img",{src:L,alt:"Brief graphic preview",className:"w-full object-contain max-h-64"})})]})]}),r.jsxs(An,{value:"links",className:"space-y-4 mt-4",children:[r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsx(He,{children:"Quick Links"}),r.jsxs(ee,{variant:"outline",size:"sm",onClick:Ze,children:[r.jsx(bn,{className:"h-4 w-4 mr-1"}),"Add Link"]})]}),ye.map((nt,gt)=>r.jsxs("div",{className:"flex gap-2 items-start",children:[r.jsx(dt,{value:nt.title,onChange:mt=>pe(gt,"title",mt.target.value),placeholder:"Link title",className:"flex-1"}),r.jsx(dt,{value:nt.url,onChange:mt=>pe(gt,"url",mt.target.value),placeholder:"https://...",className:"flex-[2]"}),r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>yt(gt),children:r.jsx(Vn,{className:"h-4 w-4 text-destructive"})})]},gt)),ye.length===0&&r.jsx("p",{className:"text-muted-foreground text-center py-4",children:"No links added yet"})]}),r.jsxs(An,{value:"polls",className:"space-y-4 mt-4",children:[r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsx(He,{children:"Polls"}),r.jsxs(ee,{variant:"outline",size:"sm",onClick:rt,children:[r.jsx(bn,{className:"h-4 w-4 mr-1"}),"Add Poll"]})]}),ge.map((nt,gt)=>r.jsx(Ye,{className:"p-4",children:r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsx(dt,{value:nt.question,onChange:mt=>at(gt,mt.target.value),placeholder:"Poll question...",className:"flex-1 mr-2"}),r.jsxs(gn,{value:nt.poll_type,onValueChange:mt=>Me(gt,mt),children:[r.jsx(fn,{className:"w-32",children:r.jsx(xn,{})}),r.jsxs(pn,{children:[r.jsx(Vt,{value:"single",children:"Single"}),r.jsx(Vt,{value:"multi",children:"Multi-select"})]})]}),r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>Qe(gt),children:r.jsx(Vn,{className:"h-4 w-4 text-destructive"})})]}),r.jsxs("div",{className:"space-y-2 pl-4",children:[nt.options.map((mt,Mt)=>r.jsxs("div",{className:"flex gap-2",children:[r.jsx(dt,{value:mt,onChange:wt=>qe(gt,Mt,wt.target.value),placeholder:`Option ${Mt+1}`}),nt.options.length>2&&r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>Oe(gt,Mt),children:r.jsx(Vn,{className:"h-4 w-4 text-muted-foreground"})})]},Mt)),r.jsxs(ee,{variant:"ghost",size:"sm",onClick:()=>ft(gt),children:[r.jsx(bn,{className:"h-4 w-4 mr-1"}),"Add Option"]})]})]})},gt)),ge.length===0&&r.jsx("p",{className:"text-muted-foreground text-center py-4",children:"No polls added yet"})]})]}),r.jsxs("div",{className:"flex justify-end gap-2 mt-4",children:[r.jsx(ee,{variant:"outline",onClick:()=>l(!1),children:"Cancel"}),r.jsx(ee,{onClick:je,children:i?"Update Brief":"Create Brief"})]})]})}),r.jsx(Fr,{open:p,onOpenChange:x,children:r.jsxs(Rr,{className:"max-w-2xl",children:[r.jsx(qr,{children:r.jsxs($r,{children:["Results: ",y==null?void 0:y.title]})}),r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs(Ye,{children:[r.jsx(Gt,{className:"pb-2",children:r.jsx(Zt,{className:"text-sm font-medium text-muted-foreground",children:"Total Views"})}),r.jsx(tt,{children:r.jsx("p",{className:"text-2xl font-bold",children:me.total})})]}),r.jsxs(Ye,{children:[r.jsx(Gt,{className:"pb-2",children:r.jsx(Zt,{className:"text-sm font-medium text-muted-foreground",children:"Dismissed"})}),r.jsx(tt,{children:r.jsx("p",{className:"text-2xl font-bold",children:me.dismissed})})]})]}),Ce.length>0?r.jsxs("div",{className:"space-y-4",children:[r.jsx("h3",{className:"font-semibold",children:"Poll Results"}),Ce.map(nt=>r.jsxs(Ye,{className:"p-4",children:[r.jsx("h4",{className:"font-medium mb-3",children:nt.question}),r.jsx("div",{className:"space-y-2",children:nt.options.map(gt=>{const mt=nt.results[gt.id]||0,Mt=nt.totalResponses>0?Math.round(mt/nt.totalResponses*100):0;return r.jsxs("div",{className:"space-y-1",children:[r.jsxs("div",{className:"flex justify-between text-sm",children:[r.jsx("span",{children:gt.option_text}),r.jsxs("span",{className:"text-muted-foreground",children:[mt," (",Mt,"%)"]})]}),r.jsx("div",{className:"h-2 bg-muted rounded-full overflow-hidden",children:r.jsx("div",{className:"h-full bg-primary transition-all",style:{width:`${Mt}%`}})})]},gt.id)})})]},nt.id))]}):r.jsx("p",{className:"text-muted-foreground text-center py-4",children:"No polls in this brief"})]})]})})]})}const Hwt=()=>{const{user:t}=Qr(),{toast:e}=fi(),n=Vr(),[s,a]=I.useState(!1),[o,l]=I.useState(null),[i,h]=I.useState({name:"",description:"",signup_link_url:"",publish_date:new Date().toISOString().split("T")[0],is_published:!1}),[p,x]=I.useState(null),[y,b]=I.useState(""),{data:j=[],isLoading:C}=Yt({queryKey:["additional-services-admin"],queryFn:async()=>{const{data:F,error:q}=await J.from("additional_services").select("*").order("publish_date",{ascending:!1});if(q)throw q;return F}}),N=cr({mutationFn:async F=>{let q=F.existingImageUrl;if(F.image){const Z=F.image.name.split(".").pop(),G=`${Date.now()}-${Math.random().toString(36).substring(7)}.${Z}`,{error:te}=await J.storage.from("service-images").upload(G,F.image);if(te)throw te;const{data:ie}=J.storage.from("service-images").getPublicUrl(G);q=ie.publicUrl}const H={name:F.item.name,description:F.item.description||null,preview_image_url:q,signup_link_url:F.item.signup_link_url,publish_date:F.item.publish_date?new Date(F.item.publish_date).toISOString():new Date().toISOString(),is_published:F.item.is_published,created_by:t==null?void 0:t.id};if(F.itemId){const{error:Z}=await J.from("additional_services").update(H).eq("id",F.itemId);if(Z)throw Z}else{const{error:Z}=await J.from("additional_services").insert(H);if(Z)throw Z}},onSuccess:()=>{n.invalidateQueries({queryKey:["additional-services-admin"]}),n.invalidateQueries({queryKey:["additional-services"]}),e({title:o?"Service updated":"Service created"}),a(!1),E()},onError:F=>{e({title:"Error saving service",description:F.message,variant:"destructive"})}}),A=cr({mutationFn:async F=>{const{error:q}=await J.from("additional_services").delete().eq("id",F);if(q)throw q},onSuccess:()=>{n.invalidateQueries({queryKey:["additional-services-admin"]}),n.invalidateQueries({queryKey:["additional-services"]}),e({title:"Service deleted"})},onError:F=>{e({title:"Error deleting service",description:F.message,variant:"destructive"})}}),E=()=>{h({name:"",description:"",signup_link_url:"",publish_date:new Date().toISOString().split("T")[0],is_published:!1}),x(null),b(""),l(null)},T=F=>{l(F),h({name:F.name,description:F.description||"",signup_link_url:F.signup_link_url,publish_date:F.publish_date?new Date(F.publish_date).toISOString().split("T")[0]:new Date().toISOString().split("T")[0],is_published:F.is_published}),b(F.preview_image_url||""),a(!0)},L=F=>{var H;const q=(H=F.target.files)==null?void 0:H[0];q&&(x(q),b(URL.createObjectURL(q)))},z=F=>{if(F.preventDefault(),!i.name.trim()){e({title:"Name is required",variant:"destructive"});return}if(!i.signup_link_url.trim()){e({title:"Signup link URL is required",variant:"destructive"});return}N.mutate({item:i,image:p,existingImageUrl:(o==null?void 0:o.preview_image_url)||null,itemId:o==null?void 0:o.id})};return r.jsx(Lr,{title:"Manage Additional Services",children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs(Ye,{children:[r.jsx(Gt,{className:"pb-2",children:r.jsx(Zt,{className:"text-sm font-medium text-muted-foreground",children:"Total Services"})}),r.jsx(tt,{children:r.jsx("div",{className:"text-2xl font-bold",children:j.length})})]}),r.jsxs(Ye,{children:[r.jsx(Gt,{className:"pb-2",children:r.jsx(Zt,{className:"text-sm font-medium text-muted-foreground",children:"Published"})}),r.jsx(tt,{children:r.jsx("div",{className:"text-2xl font-bold",children:j.filter(F=>F.is_published).length})})]})]}),r.jsxs(Fr,{open:s,onOpenChange:F=>{a(F),F||E()},children:[r.jsx(zo,{asChild:!0,children:r.jsxs(ee,{className:"gap-2",children:[r.jsx(bn,{className:"h-4 w-4"}),"Add Service"]})}),r.jsxs(Rr,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsx(qr,{children:r.jsx($r,{children:o?"Edit Service":"Add New Service"})}),r.jsxs("form",{onSubmit:z,className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"name",children:"Name *"}),r.jsx(dt,{id:"name",value:i.name,onChange:F=>h({...i,name:F.target.value}),placeholder:"Enter service name"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Description"}),r.jsx(fy,{content:i.description,onChange:F=>h({...i,description:F}),placeholder:"Enter description",minHeight:"120px"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"signup_link_url",children:"Signup Link URL *"}),r.jsx(dt,{id:"signup_link_url",type:"url",value:i.signup_link_url,onChange:F=>h({...i,signup_link_url:F.target.value}),placeholder:"https://example.com/signup"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"publish_date",children:"Publish Date"}),r.jsx(dt,{id:"publish_date",type:"date",value:i.publish_date,onChange:F=>h({...i,publish_date:F.target.value})})]}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(Ps,{id:"is_published",checked:i.is_published,onCheckedChange:F=>h({...i,is_published:F})}),r.jsx(He,{htmlFor:"is_published",children:"Published"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Preview Image"}),y?r.jsxs("div",{className:"relative",children:[r.jsx("img",{src:y,alt:"Preview",className:"w-full max-h-48 object-contain rounded-lg border"}),r.jsx(ee,{type:"button",variant:"destructive",size:"icon",className:"absolute top-2 right-2 h-6 w-6",onClick:()=>{x(null),b("")},children:r.jsx(_s,{className:"h-3 w-3"})})]}):r.jsxs("div",{className:"border-2 border-dashed rounded-lg p-4 text-center",children:[r.jsx(Pl,{className:"h-8 w-8 mx-auto text-muted-foreground mb-2"}),r.jsx(dt,{type:"file",accept:"image/*",onChange:L,className:"cursor-pointer"})]})]}),r.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[r.jsx(ee,{type:"button",variant:"outline",onClick:()=>a(!1),children:"Cancel"}),r.jsx(ee,{type:"submit",disabled:N.isPending,children:N.isPending?"Saving...":o?"Update":"Create"})]})]})]})]})]}),r.jsx(Ye,{children:r.jsx(tt,{className:"p-0",children:C?r.jsx("div",{className:"flex justify-center py-8",children:r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})}):j.length===0?r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:'No services yet. Click "Add Service" to create your first one.'}):r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Ar,{children:[r.jsx(It,{className:"w-16",children:"Preview"}),r.jsx(It,{children:"Name"}),r.jsx(It,{children:"Signup Link"}),r.jsx(It,{children:"Publish Date"}),r.jsx(It,{children:"Status"}),r.jsx(It,{className:"text-right",children:"Actions"})]})}),r.jsx(Vs,{children:j.map(F=>r.jsxs(Ar,{children:[r.jsx(Nt,{children:F.preview_image_url?r.jsx("img",{src:F.preview_image_url,alt:"",className:"w-12 h-12 object-cover rounded"}):r.jsx("div",{className:"w-12 h-12 bg-muted rounded flex items-center justify-center",children:r.jsx(Pl,{className:"h-5 w-5 text-muted-foreground"})})}),r.jsx(Nt,{className:"font-medium",children:F.name}),r.jsx(Nt,{children:r.jsxs("a",{href:F.signup_link_url,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline flex items-center gap-1",children:[r.jsx(Fs,{className:"h-3 w-3"}),"Link"]})}),r.jsx(Nt,{children:new Date(F.publish_date).toLocaleDateString()}),r.jsx(Nt,{children:r.jsx(Ot,{variant:F.is_published?"default":"secondary",children:F.is_published?"Published":"Draft"})}),r.jsx(Nt,{className:"text-right",children:r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>T(F),children:r.jsx(_i,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>{confirm("Are you sure you want to delete this service?")&&A.mutate(F.id)},children:r.jsx(Vn,{className:"h-4 w-4 text-destructive"})})]})})]},F.id))})]})})})]})})};function Wwt(){const{toast:t}=fi(),[e,n]=I.useState([]),[s,a]=I.useState(!0),[o,l]=I.useState(!1),[i,h]=I.useState(!1),[p,x]=I.useState({name:"",promotionCode:"",discountType:"percent",percentOff:"",amountOff:"",duration:"once",durationInMonths:""});I.useEffect(()=>{y()},[]);const y=async()=>{try{const{data:A,error:E}=await J.functions.invoke("stripe-manage-coupons",{body:{action:"list"}});if(E)throw E;n(A.coupons||[])}catch(A){console.error("Error fetching coupons:",A),t({title:"Error",description:"Failed to load coupons",variant:"destructive"})}finally{a(!1)}},b=async()=>{if(!p.name){t({title:"Error",description:"Please enter a coupon name",variant:"destructive"});return}if(p.discountType==="percent"&&!p.percentOff){t({title:"Error",description:"Please enter a percent off value",variant:"destructive"});return}if(p.discountType==="amount"&&!p.amountOff){t({title:"Error",description:"Please enter an amount off value",variant:"destructive"});return}if(p.duration==="repeating"&&!p.durationInMonths){t({title:"Error",description:"Please enter duration in months",variant:"destructive"});return}l(!0);try{const A={action:"create",name:p.name,duration:p.duration,promotion_code:p.promotionCode.trim()||void 0};p.discountType==="percent"?A.percent_off=parseFloat(p.percentOff):(A.amount_off=Math.round(parseFloat(p.amountOff)*100),A.currency="usd"),p.duration==="repeating"&&(A.duration_in_months=parseInt(p.durationInMonths));const{data:E,error:T}=await J.functions.invoke("stripe-manage-coupons",{body:A});if(T)throw T;t({title:"Success",description:"Coupon created successfully"}),h(!1),x({name:"",promotionCode:"",discountType:"percent",percentOff:"",amountOff:"",duration:"once",durationInMonths:""}),y()}catch(A){console.error("Error creating coupon:",A),t({title:"Error",description:A.message||"Failed to create coupon",variant:"destructive"})}finally{l(!1)}},j=async A=>{if(confirm("Are you sure you want to delete this coupon?"))try{const{error:E}=await J.functions.invoke("stripe-manage-coupons",{body:{action:"delete",couponId:A}});if(E)throw E;t({title:"Success",description:"Coupon deleted successfully"}),y()}catch(E){console.error("Error deleting coupon:",E),t({title:"Error",description:E.message||"Failed to delete coupon",variant:"destructive"})}},C=A=>A.percent_off?`${A.percent_off}% off`:A.amount_off?`$${(A.amount_off/100).toFixed(2)} off`:"N/A",N=A=>{switch(A.duration){case"once":return"Once";case"forever":return"Forever";case"repeating":return`${A.duration_in_months} months`;default:return A.duration}};return r.jsx(Lr,{title:"Subscription Discounts",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Gu,{title:"Subscription Discounts",description:"Create and manage discount coupons for subscriptions",children:r.jsxs(Fr,{open:i,onOpenChange:h,children:[r.jsx(zo,{asChild:!0,children:r.jsxs(ee,{children:[r.jsx(bn,{className:"mr-2 h-4 w-4"}),"Create Coupon"]})}),r.jsxs(Rr,{children:[r.jsxs(qr,{children:[r.jsx($r,{children:"Create New Coupon"}),r.jsx(Xn,{children:"Create a discount coupon that can be applied to subscriptions"})]}),r.jsxs("div",{className:"space-y-4 pt-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Promotion Code (what users will type)"}),r.jsx(dt,{placeholder:"e.g., BROKERAGE50",value:p.promotionCode,onChange:A=>x({...p,promotionCode:A.target.value.toUpperCase().replace(/[^A-Z0-9]/g,"")}),className:"font-mono uppercase"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Letters and numbers only. This is the code users enter at checkout."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Coupon Name (internal label)"}),r.jsx(dt,{placeholder:"e.g., 50% Off Brokerage Launch",value:p.name,onChange:A=>x({...p,name:A.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Discount Type"}),r.jsxs(gn,{value:p.discountType,onValueChange:A=>{const E=A==="amount"&&p.duration==="forever"?"once":p.duration;x({...p,discountType:A,duration:E})},children:[r.jsx(fn,{children:r.jsx(xn,{})}),r.jsxs(pn,{children:[r.jsx(Vt,{value:"percent",children:r.jsxs("span",{className:"flex items-center",children:[r.jsx(hS,{className:"mr-2 h-4 w-4"}),"Percentage Off"]})}),r.jsx(Vt,{value:"amount",children:r.jsxs("span",{className:"flex items-center",children:[r.jsx(hd,{className:"mr-2 h-4 w-4"}),"Fixed Amount Off"]})})]})]})]}),p.discountType==="percent"?r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Percent Off"}),r.jsxs("div",{className:"relative",children:[r.jsx(dt,{type:"number",min:"1",max:"100",placeholder:"20",value:p.percentOff,onChange:A=>x({...p,percentOff:A.target.value})}),r.jsx("span",{className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground",children:"%"})]})]}):r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Amount Off (USD)"}),r.jsxs("div",{className:"relative",children:[r.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground",children:"$"}),r.jsx(dt,{type:"number",min:"1",placeholder:"10.00",className:"pl-7",value:p.amountOff,onChange:A=>x({...p,amountOff:A.target.value})})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Duration"}),r.jsxs(gn,{value:p.duration,onValueChange:A=>x({...p,duration:A}),children:[r.jsx(fn,{children:r.jsx(xn,{})}),r.jsxs(pn,{children:[r.jsx(Vt,{value:"once",children:"Once (first payment only)"}),r.jsx(Vt,{value:"repeating",children:"Multiple months"}),r.jsxs(Vt,{value:"forever",disabled:p.discountType==="amount",children:["Forever ",p.discountType==="amount"&&"(% discounts only)"]})]})]}),p.discountType==="amount"&&r.jsx("p",{className:"text-xs text-muted-foreground",children:'Note: "Forever" duration is only available for percentage-based discounts.'})]}),p.duration==="repeating"&&r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Number of Months"}),r.jsx(dt,{type:"number",min:"1",placeholder:"3",value:p.durationInMonths,onChange:A=>x({...p,durationInMonths:A.target.value})})]}),r.jsx(ee,{onClick:b,disabled:o,className:"w-full",children:o?r.jsxs(r.Fragment,{children:[r.jsx(en,{className:"mr-2 h-4 w-4 animate-spin"}),"Creating..."]}):"Create Coupon"})]})]})]})}),r.jsxs(Ye,{children:[r.jsxs(Gt,{children:[r.jsx(Zt,{children:"Active Coupons"}),r.jsx(Mn,{children:"Share coupon codes with users to give them discounts on subscriptions"})]}),r.jsx(tt,{children:s?r.jsx("div",{className:"flex items-center justify-center py-8",children:r.jsx(en,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):e.length===0?r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"No coupons created yet. Create your first coupon to get started."}):r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Ar,{children:[r.jsx(It,{children:"Promo Code"}),r.jsx(It,{children:"Name"}),r.jsx(It,{children:"Discount"}),r.jsx(It,{children:"Duration"}),r.jsx(It,{children:"Redemptions"}),r.jsx(It,{children:"Status"}),r.jsx(It,{className:"text-right",children:"Actions"})]})}),r.jsx(Vs,{children:e.map(A=>{var E;return r.jsxs(Ar,{children:[r.jsx(Nt,{className:"font-mono font-medium",children:((E=A.promotion_codes)==null?void 0:E.length)>0?A.promotion_codes.join(", "):r.jsx("span",{className:"text-muted-foreground text-xs",children:"No promo code"})}),r.jsx(Nt,{children:A.name||"-"}),r.jsx(Nt,{children:C(A)}),r.jsx(Nt,{children:N(A)}),r.jsx(Nt,{children:A.times_redeemed}),r.jsx(Nt,{children:r.jsx(Ot,{variant:A.valid?"default":"secondary",children:A.valid?"Active":"Inactive"})}),r.jsx(Nt,{className:"text-right",children:r.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>j(A.id),children:r.jsx(Vn,{className:"h-4 w-4 text-destructive"})})})]},A.id)})})]})})]}),r.jsxs(Ye,{children:[r.jsx(Gt,{children:r.jsx(Zt,{children:"How to Use Coupons"})}),r.jsxs(tt,{className:"text-sm text-muted-foreground space-y-2",children:[r.jsx("p",{children:"1. Create a coupon above with your desired discount."}),r.jsx("p",{children:'2. Share the coupon code (shown in the "Code" column) with users.'}),r.jsx("p",{children:"3. Users can enter the code during checkout to receive the discount."}),r.jsx("p",{children:"4. Alternatively, you can create a promotion code in Stripe dashboard for public-facing promotions."})]})]})]})})}const Ece={prod_Tc07cYplXUGNkm:{name:"Individual Agent",price:"$39/mo",type:"individual"},prod_Tc08MupgoVySDG:{name:"Brokerage (Under 25)",price:"$299/mo",type:"brokerage"},prod_Tc09N1tJ4RrAFn:{name:"Brokerage (Over 25)",price:"$499/mo",type:"brokerage"}};function Gwt(){const[t,e]=I.useState(""),[n,s]=I.useState("all"),[a,o]=I.useState(null),{data:l,isLoading:i,refetch:h}=Yt({queryKey:["admin-subscriptions"],queryFn:async()=>{const{data:C,error:N}=await J.from("profiles").select(` *, brokerages:brokerage_id (id, name) `).order("created_at",{ascending:!1});if(N)throw N;return C}}),{data:p}=Yt({queryKey:["admin-brokerages-subscriptions"],queryFn:async()=>{const{data:C,error:N}=await J.from("brokerages").select("*").order("name");if(N)throw N;return await Promise.all((C||[]).map(async E=>{const{data:T}=await J.from("profiles").select("id, name, email, subscription_status, subscription_product_id").eq("brokerage_id",E.id),{data:L}=await J.from("user_roles").select("user_id").eq("role","brokerage_manager"),z=(L==null?void 0:L.map(H=>H.user_id))||[],F=(T==null?void 0:T.filter(H=>z.includes(H.id)))||[],q=(T==null?void 0:T.length)||0;return{...E,managers:F,agentCount:q}}))}}),x=C=>{if(C.is_grandfathered)return{status:"Grandfathered",badge:"Legacy",variant:"secondary"};if(C.brokerage_id&&!C.subscription_product_id)return{status:"Brokerage",badge:"Team Member",variant:"outline"};if(C.is_trial&&C.trial_expires_at)return new Date(C.trial_expires_at)>new Date?{status:"Trial",badge:"Active Trial",variant:"default"}:{status:"Trial Expired",badge:"Expired",variant:"destructive"};if(C.subscription_status==="active"||C.subscription_status==="trialing"){const N=Ece[C.subscription_product_id];return{status:(N==null?void 0:N.name)||"Active",badge:C.subscription_status==="trialing"?"Trial":"Active",variant:"default"}}return C.subscription_status==="canceled"||C.subscription_status==="past_due"?{status:"Canceled",badge:"Inactive",variant:"destructive"}:{status:"None",badge:"No Subscription",variant:"outline"}},y=l==null?void 0:l.filter(C=>{var A,E;if(!(((A=C.name)==null?void 0:A.toLowerCase().includes(t.toLowerCase()))||((E=C.email)==null?void 0:E.toLowerCase().includes(t.toLowerCase()))))return!1;switch(x(C),n){case"active":return C.subscription_status==="active";case"trialing":return C.subscription_status==="trialing"||C.is_trial&&new Date(C.trial_expires_at)>new Date;case"grandfathered":return C.is_grandfathered;case"brokerage":return C.brokerage_id&&!C.subscription_product_id&&!C.is_grandfathered;case"expired":return C.subscription_status==="canceled"||C.subscription_status==="past_due"||C.is_trial&&new Date(C.trial_expires_at)<=new Date;case"none":return!C.subscription_status||C.subscription_status==="none";default:return!0}}),b={totalUsers:(l==null?void 0:l.length)||0,activeSubscriptions:(l==null?void 0:l.filter(C=>C.subscription_status==="active").length)||0,trials:(l==null?void 0:l.filter(C=>C.subscription_status==="trialing"||C.is_trial&&new Date(C.trial_expires_at)>new Date).length)||0,grandfathered:(l==null?void 0:l.filter(C=>C.is_grandfathered).length)||0,brokerageMembers:(l==null?void 0:l.filter(C=>C.brokerage_id&&!C.subscription_product_id&&!C.is_grandfathered).length)||0,individualSubscribers:(l==null?void 0:l.filter(C=>C.subscription_status==="active"&&C.subscription_product_id==="prod_Tc07cYplXUGNkm").length)||0,brokerageSubscribers:(l==null?void 0:l.filter(C=>C.subscription_status==="active"&&(C.subscription_product_id==="prod_Tc08MupgoVySDG"||C.subscription_product_id==="prod_Tc09N1tJ4RrAFn")).length)||0},j=C=>{window.open(`https://dashboard.stripe.com/customers/${C}`,"_blank")};return r.jsx(Lr,{title:"Subscription Management",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Gu,{title:"Subscription Management",description:"Track and manage all subscriptions",children:r.jsxs(ee,{onClick:()=>h(),variant:"outline",size:"sm",children:[r.jsx(Gl,{className:"h-4 w-4 mr-2"}),"Refresh"]})}),r.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 lg:grid-cols-7 gap-4",children:[r.jsx(Ye,{children:r.jsxs(tt,{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:b.totalUsers})]})}),r.jsx(Ye,{className:"border-green-500/50",children:r.jsxs(tt,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(fm,{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:b.activeSubscriptions})]})}),r.jsx(Ye,{className:"border-blue-500/50",children:r.jsxs(tt,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ya,{className:"h-4 w-4 text-blue-500"}),r.jsx("span",{className:"text-sm text-muted-foreground",children:"Trials"})]}),r.jsx("p",{className:"text-2xl font-bold mt-1 text-blue-600",children:b.trials})]})}),r.jsx(Ye,{className:"border-purple-500/50",children:r.jsxs(tt,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(u1,{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:b.grandfathered})]})}),r.jsx(Ye,{className:"border-orange-500/50",children:r.jsxs(tt,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(ai,{className:"h-4 w-4 text-orange-500"}),r.jsx("span",{className:"text-sm text-muted-foreground",children:"Brokerage Members"})]}),r.jsx("p",{className:"text-2xl font-bold mt-1 text-orange-600",children:b.brokerageMembers})]})}),r.jsx(Ye,{children:r.jsxs(tt,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(wj,{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:b.individualSubscribers})]})}),r.jsx(Ye,{children:r.jsxs(tt,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(ai,{className:"h-4 w-4 text-muted-foreground"}),r.jsx("span",{className:"text-sm text-muted-foreground",children:"Brokerage Subs"})]}),r.jsx("p",{className:"text-2xl font-bold mt-1",children:b.brokerageSubscribers})]})})]}),r.jsxs(Ii,{defaultValue:"users",className:"space-y-4",children:[r.jsxs(wi,{children:[r.jsx(ln,{value:"users",children:"All Users"}),r.jsx(ln,{value:"brokerages",children:"Brokerages"})]}),r.jsxs(An,{value:"users",className:"space-y-4",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[r.jsxs("div",{className:"relative flex-1",children:[r.jsx(wa,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(dt,{placeholder:"Search by name or email...",value:t,onChange:C=>e(C.target.value),className:"pl-9"})]}),r.jsxs(gn,{value:n,onValueChange:C=>s(C),children:[r.jsx(fn,{className:"w-[200px]",children:r.jsx(xn,{placeholder:"Filter by status"})}),r.jsxs(pn,{children:[r.jsx(Vt,{value:"all",children:"All Users"}),r.jsx(Vt,{value:"active",children:"Active Subscriptions"}),r.jsx(Vt,{value:"trialing",children:"Trials"}),r.jsx(Vt,{value:"grandfathered",children:"Grandfathered"}),r.jsx(Vt,{value:"brokerage",children:"Brokerage Members"}),r.jsx(Vt,{value:"expired",children:"Expired/Canceled"}),r.jsx(Vt,{value:"none",children:"No Subscription"})]})]})]}),r.jsx(Ye,{children:r.jsx(tt,{className:"p-0",children:r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Ar,{children:[r.jsx(It,{children:"User"}),r.jsx(It,{children:"Status"}),r.jsx(It,{children:"Plan"}),r.jsx(It,{children:"Brokerage"}),r.jsx(It,{children:"End Date"}),r.jsx(It,{className:"text-right",children:"Actions"})]})}),r.jsx(Vs,{children:i?r.jsx(Ar,{children:r.jsx(Nt,{colSpan:6,className:"text-center py-8",children:"Loading subscriptions..."})}):(y==null?void 0:y.length)===0?r.jsx(Ar,{children:r.jsx(Nt,{colSpan:6,className:"text-center py-8 text-muted-foreground",children:"No users found"})}):y==null?void 0:y.map(C=>{var E,T;const N=x(C),A=Ece[C.subscription_product_id];return r.jsxs(Ar,{children:[r.jsx(Nt,{children:r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:C.name}),r.jsx("p",{className:"text-sm text-muted-foreground",children:C.email})]})}),r.jsx(Nt,{children:r.jsx(Ot,{variant:N.variant,children:N.badge})}),r.jsx(Nt,{children:r.jsx("span",{className:"text-sm",children:C.is_grandfathered?"Legacy Access":C.brokerage_id&&!C.subscription_product_id?"Brokerage Subscription":(A==null?void 0:A.name)||N.status})}),r.jsx(Nt,{children:(E=C.brokerages)!=null&&E.name?r.jsx("span",{className:"text-sm",children:C.brokerages.name}):r.jsx("span",{className:"text-sm text-muted-foreground",children:"—"})}),r.jsx(Nt,{children:C.subscription_end_date?r.jsx("span",{className:"text-sm",children:yn(new Date(C.subscription_end_date),"MMM d, yyyy")}):C.trial_expires_at?r.jsxs("span",{className:"text-sm text-blue-600",children:["Trial: ",yn(new Date(C.trial_expires_at),"MMM d, yyyy")]}):r.jsx("span",{className:"text-sm text-muted-foreground",children:"—"})}),r.jsx(Nt,{className:"text-right",children:r.jsxs("div",{className:"flex items-center justify-end gap-2",children:[C.stripe_customer_id&&r.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>j(C.stripe_customer_id),children:r.jsx(Fs,{className:"h-4 w-4"})}),r.jsxs(Fr,{children:[r.jsx(zo,{asChild:!0,children:r.jsx(ee,{variant:"outline",size:"sm",onClick:()=>o(C),children:"Details"})}),r.jsxs(Rr,{children:[r.jsxs(qr,{children:[r.jsx($r,{children:"Subscription Details"}),r.jsxs(Xn,{children:[C.name," (",C.email,")"]})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Status"}),r.jsx(Ot,{variant:N.variant,className:"mt-1",children:N.badge})]}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Plan"}),r.jsx("p",{className:"font-medium",children:C.is_grandfathered?"Grandfathered (Legacy)":C.brokerage_id&&!C.subscription_product_id?"Brokerage Subscription":(A==null?void 0:A.name)||"None"})]}),C.brokerage_id&&r.jsxs("div",{children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Brokerage"}),r.jsx("p",{className:"font-medium",children:((T=C.brokerages)==null?void 0:T.name)||"Unknown"})]}),C.subscription_end_date&&r.jsxs("div",{children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Current Period End"}),r.jsx("p",{className:"font-medium",children:yn(new Date(C.subscription_end_date),"MMMM d, yyyy")})]}),C.trial_expires_at&&r.jsxs("div",{children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Trial Expires"}),r.jsx("p",{className:"font-medium",children:yn(new Date(C.trial_expires_at),"MMMM d, yyyy")})]}),C.stripe_customer_id&&r.jsxs("div",{className:"col-span-2",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Stripe Customer ID"}),r.jsx("p",{className:"font-mono text-sm",children:C.stripe_customer_id})]})]}),C.stripe_customer_id&&r.jsxs(ee,{className:"w-full",onClick:()=>j(C.stripe_customer_id),children:[r.jsx(Fs,{className:"h-4 w-4 mr-2"}),"View in Stripe Dashboard"]})]})]})]})]})})]},C.id)})})]})})})]}),r.jsx(An,{value:"brokerages",className:"space-y-4",children:r.jsx("div",{className:"grid gap-4",children:p==null?void 0:p.map(C=>{var A,E;const N=(A=C.managers)==null?void 0:A.some(T=>T.subscription_status==="active"&&(T.subscription_product_id==="prod_Tc08MupgoVySDG"||T.subscription_product_id==="prod_Tc09N1tJ4RrAFn"));return r.jsxs(Ye,{children:[r.jsx(Gt,{className:"pb-3",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"w-10 h-10 rounded-lg bg-primary/10 flex items-center justify-center",children:r.jsx(ai,{className:"h-5 w-5 text-primary"})}),r.jsxs("div",{children:[r.jsx(Zt,{className:"text-lg",children:C.name}),r.jsxs(Mn,{children:[C.agentCount," agents"]})]})]}),r.jsx(Ot,{variant:N?"default":"outline",children:N?"Active Subscription":"No Active Subscription"})]})}),r.jsx(tt,{children:((E=C.managers)==null?void 0:E.length)>0?r.jsxs("div",{className:"space-y-2",children:[r.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"Managers:"}),C.managers.map(T=>{const L=Ece[T.subscription_product_id];return r.jsxs("div",{className:"flex items-center justify-between p-2 rounded-lg bg-muted/50",children:[r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:T.name}),r.jsx("p",{className:"text-sm text-muted-foreground",children:T.email})]}),r.jsx("div",{className:"text-right",children:L?r.jsxs("div",{children:[r.jsx(Ot,{variant:"default",children:L.name}),r.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:L.price})]}):r.jsx(Ot,{variant:"outline",children:"No Subscription"})})]},T.id)})]}):r.jsx("p",{className:"text-sm text-muted-foreground",children:"No managers assigned"})})]},C.id)})})})]})]})})}function Kwt(){const[t,e]=I.useState([]),[n,s]=I.useState(!0),[a,o]=I.useState(""),[l,i]=I.useState("all"),[h,p]=I.useState({total:0,qualified:0,pending:0,cancelled:0,totalDiscounts:0});I.useEffect(()=>{x()},[]);const x=async()=>{try{const{data:C,error:N}=await J.from("referrals").select(` *, referrer_brokerage:brokerages!referrer_brokerage_id(name), referred_brokerage:brokerages!referred_brokerage_id(name), referred_user:profiles!referred_user_id(name, email) `).order("created_at",{ascending:!1});if(N)throw N;e(C||[]);const A=(C==null?void 0:C.filter(L=>L.status==="qualified").length)||0,E=(C==null?void 0:C.filter(L=>L.status==="pending").length)||0,T=(C==null?void 0:C.filter(L=>L.status==="cancelled").length)||0;p({total:(C==null?void 0:C.length)||0,qualified:A,pending:E,cancelled:T,totalDiscounts:A*25})}catch(C){console.error("Error fetching referrals:",C),ze.error("Failed to load referrals")}finally{s(!1)}},y=async()=>{try{ze.loading("Processing qualifications...");const{error:C}=await J.functions.invoke("process-referral-qualifications");if(C)throw C;ze.dismiss(),ze.success("Qualifications processed successfully"),x()}catch(C){ze.dismiss(),console.error("Error processing qualifications:",C),ze.error("Failed to process qualifications")}},b=t.filter(C=>{var E,T,L,z,F,q;const N=((T=(E=C.referrer_brokerage)==null?void 0:E.name)==null?void 0:T.toLowerCase().includes(a.toLowerCase()))||((z=(L=C.referred_brokerage)==null?void 0:L.name)==null?void 0:z.toLowerCase().includes(a.toLowerCase()))||((q=(F=C.referred_user)==null?void 0:F.email)==null?void 0:q.toLowerCase().includes(a.toLowerCase())),A=l==="all"||C.status===l;return N&&A}),j=C=>{switch(C){case"qualified":return r.jsxs(Ot,{className:"bg-green-100 text-green-800",children:[r.jsx(Yi,{className:"h-3 w-3 mr-1"}),"Qualified"]});case"pending":return r.jsxs(Ot,{variant:"secondary",children:[r.jsx(Ya,{className:"h-3 w-3 mr-1"}),"Pending"]});case"cancelled":return r.jsxs(Ot,{variant:"destructive",children:[r.jsx(qc,{className:"h-3 w-3 mr-1"}),"Cancelled"]});default:return r.jsx(Ot,{children:C})}};return r.jsx(Lr,{title:"Referral Program",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Gu,{title:"Referral Program",description:"Track and manage brokerage referrals",children:r.jsxs(ee,{onClick:y,variant:"outline",children:[r.jsx(Gl,{className:"h-4 w-4 mr-2"}),"Process Qualifications"]})}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-5 gap-4",children:[r.jsx(Ye,{children:r.jsx(tt,{className:"pt-6",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Bn,{className:"h-5 w-5 text-muted-foreground"}),r.jsxs("div",{children:[r.jsx("p",{className:"text-2xl font-bold",children:h.total}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Total Referrals"})]})]})})}),r.jsx(Ye,{children:r.jsx(tt,{className:"pt-6",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Yi,{className:"h-5 w-5 text-green-600"}),r.jsxs("div",{children:[r.jsx("p",{className:"text-2xl font-bold",children:h.qualified}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Qualified"})]})]})})}),r.jsx(Ye,{children:r.jsx(tt,{className:"pt-6",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ya,{className:"h-5 w-5 text-amber-600"}),r.jsxs("div",{children:[r.jsx("p",{className:"text-2xl font-bold",children:h.pending}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Pending"})]})]})})}),r.jsx(Ye,{children:r.jsx(tt,{className:"pt-6",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(qc,{className:"h-5 w-5 text-red-600"}),r.jsxs("div",{children:[r.jsx("p",{className:"text-2xl font-bold",children:h.cancelled}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Cancelled"})]})]})})}),r.jsx(Ye,{children:r.jsx(tt,{className:"pt-6",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(hd,{className:"h-5 w-5 text-green-600"}),r.jsxs("div",{children:[r.jsxs("p",{className:"text-2xl font-bold",children:["$",h.totalDiscounts]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Monthly Discounts"})]})]})})})]}),r.jsxs(Ye,{children:[r.jsxs(Gt,{children:[r.jsx(Zt,{children:"All Referrals"}),r.jsx(Mn,{children:"View and manage all referral relationships"})]}),r.jsxs(tt,{children:[r.jsxs("div",{className:"flex gap-4 mb-4",children:[r.jsxs("div",{className:"relative flex-1",children:[r.jsx(wa,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(dt,{placeholder:"Search by brokerage or email...",value:a,onChange:C=>o(C.target.value),className:"pl-10"})]}),r.jsxs(gn,{value:l,onValueChange:i,children:[r.jsx(fn,{className:"w-[180px]",children:r.jsx(xn,{placeholder:"Filter by status"})}),r.jsxs(pn,{children:[r.jsx(Vt,{value:"all",children:"All Statuses"}),r.jsx(Vt,{value:"pending",children:"Pending"}),r.jsx(Vt,{value:"qualified",children:"Qualified"}),r.jsx(Vt,{value:"cancelled",children:"Cancelled"})]})]})]}),n?r.jsx("div",{className:"flex justify-center py-8",children:r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})}):r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Ar,{children:[r.jsx(It,{children:"Referrer"}),r.jsx(It,{children:"Referred"}),r.jsx(It,{children:"Signup Date"}),r.jsx(It,{children:"Status"}),r.jsx(It,{children:"Qualified Date"}),r.jsx(It,{children:"Discount"})]})}),r.jsx(Vs,{children:b.length===0?r.jsx(Ar,{children:r.jsx(Nt,{colSpan:6,className:"text-center text-muted-foreground py-8",children:"No referrals found"})}):b.map(C=>{var N,A,E,T;return r.jsxs(Ar,{children:[r.jsx(Nt,{className:"font-medium",children:((N=C.referrer_brokerage)==null?void 0:N.name)||"Unknown"}),r.jsx(Nt,{children:r.jsxs("div",{children:[r.jsx("p",{children:((A=C.referred_brokerage)==null?void 0:A.name)||((E=C.referred_user)==null?void 0:E.name)||"Pending setup"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:(T=C.referred_user)==null?void 0:T.email})]})}),r.jsx(Nt,{children:yn(new Date(C.signup_date),"MMM d, yyyy")}),r.jsx(Nt,{children:j(C.status)}),r.jsx(Nt,{children:C.qualified_date?yn(new Date(C.qualified_date),"MMM d, yyyy"):"-"}),r.jsx(Nt,{children:C.discount_applied?r.jsx(Ot,{variant:"outline",className:"text-green-600",children:"$25/mo applied"}):r.jsx("span",{className:"text-muted-foreground",children:"-"})})]},C.id)})})]})]})]})]})})}const Ice=[{value:"add_agent",label:"Add Agent"},{value:"share_resource",label:"Share Resource"},{value:"post_community",label:"Post in Community"},{value:"register_event",label:"Register for Event"},{value:"view_template",label:"View Template"},{value:"watch_academy",label:"Watch Academy Video"},{value:"use_toolbox",label:"Use Toolbox"},{value:"launch_app",label:"Launch App"},{value:"add_contact",label:"Add Contact"},{value:"add_plan",label:"Add Touchpoint Plan"},{value:"create_video",label:"Create Video"},{value:"complete_touch",label:"Complete Touch"},{value:"add_transaction",label:"Add Transaction"},{value:"add_listing",label:"Add Listing"},{value:"schedule_popby",label:"Schedule Pop-by"}],Zwt=[{value:"brokerage_manager",label:"Brokerage Manager"},{value:"agent",label:"Agent"}];function Ywt(){const[t,e]=I.useState([]),[n,s]=I.useState(!0),[a,o]=I.useState(!1),[l,i]=I.useState(null),[h,p]=I.useState({title:"",description:"",action_type:"view_template",target_role:"agent",is_active:!0});I.useEffect(()=>{x()},[]);const x=async()=>{try{const{data:T,error:L}=await J.from("onboarding_checklist_items").select("*").order("target_role").order("sort_order");if(L)throw L;e(T||[])}catch(T){console.error("Error fetching checklist items:",T),ze.error("Failed to load checklist items")}finally{s(!1)}},y=()=>{i(null),p({title:"",description:"",action_type:"view_template",target_role:"agent",is_active:!0}),o(!0)},b=T=>{i(T),p({title:T.title,description:T.description||"",action_type:T.action_type,target_role:T.target_role,is_active:T.is_active}),o(!0)},j=async()=>{if(!h.title.trim()){ze.error("Title is required");return}try{if(l){const{error:T}=await J.from("onboarding_checklist_items").update({title:h.title,description:h.description||null,action_type:h.action_type,target_role:h.target_role,is_active:h.is_active}).eq("id",l.id);if(T)throw T;ze.success("Checklist item updated")}else{const T=t.filter(z=>z.target_role===h.target_role).reduce((z,F)=>Math.max(z,F.sort_order),-1),{error:L}=await J.from("onboarding_checklist_items").insert({title:h.title,description:h.description||null,action_type:h.action_type,target_role:h.target_role,is_active:h.is_active,sort_order:T+1});if(L)throw L;ze.success("Checklist item created")}o(!1),x()}catch(T){console.error("Error saving checklist item:",T),ze.error("Failed to save checklist item")}},C=async T=>{if(confirm("Are you sure you want to delete this checklist item?"))try{const{error:L}=await J.from("onboarding_checklist_items").delete().eq("id",T);if(L)throw L;ze.success("Checklist item deleted"),x()}catch(L){console.error("Error deleting checklist item:",L),ze.error("Failed to delete checklist item")}},N=async T=>{try{const{error:L}=await J.from("onboarding_checklist_items").update({is_active:!T.is_active}).eq("id",T.id);if(L)throw L;ze.success(T.is_active?"Item deactivated":"Item activated"),x()}catch(L){console.error("Error toggling item:",L),ze.error("Failed to update item")}},A=t.filter(T=>T.target_role==="brokerage_manager"),E=t.filter(T=>T.target_role==="agent");return r.jsxs(Lr,{title:"Onboarding Checklist",children:[r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("h2",{className:"text-2xl font-bold",children:"Onboarding Checklist"}),r.jsx("p",{className:"text-muted-foreground",children:"Manage checklist items shown to new users on their dashboard"})]}),r.jsxs(ee,{onClick:y,className:"gap-2",children:[r.jsx(bn,{className:"h-4 w-4"}),"Add Item"]})]}),r.jsxs(Ye,{children:[r.jsx(Gt,{children:r.jsxs(Zt,{className:"flex items-center gap-2",children:[r.jsx(Ot,{variant:"secondary",children:"Brokerage Manager"}),"Checklist Items"]})}),r.jsx(tt,{children:A.length===0?r.jsx("p",{className:"text-muted-foreground text-center py-4",children:"No checklist items for brokerage managers"}):r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Ar,{children:[r.jsx(It,{className:"w-12",children:"#"}),r.jsx(It,{children:"Title"}),r.jsx(It,{children:"Action Type"}),r.jsx(It,{children:"Status"}),r.jsx(It,{className:"text-right",children:"Actions"})]})}),r.jsx(Vs,{children:A.map((T,L)=>{var z;return r.jsxs(Ar,{children:[r.jsx(Nt,{className:"text-muted-foreground",children:L+1}),r.jsx(Nt,{children:r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:T.title}),T.description&&r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-1",children:T.description})]})}),r.jsx(Nt,{children:r.jsx(Ot,{variant:"outline",children:((z=Ice.find(F=>F.value===T.action_type))==null?void 0:z.label)||T.action_type})}),r.jsx(Nt,{children:r.jsx(Ps,{checked:T.is_active,onCheckedChange:()=>N(T)})}),r.jsx(Nt,{className:"text-right",children:r.jsxs("div",{className:"flex items-center justify-end gap-2",children:[r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>b(T),children:r.jsx(_i,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>C(T.id),children:r.jsx(Vn,{className:"h-4 w-4 text-destructive"})})]})})]},T.id)})})]})})]}),r.jsxs(Ye,{children:[r.jsx(Gt,{children:r.jsxs(Zt,{className:"flex items-center gap-2",children:[r.jsx(Ot,{variant:"secondary",children:"Agent"}),"Checklist Items"]})}),r.jsx(tt,{children:E.length===0?r.jsx("p",{className:"text-muted-foreground text-center py-4",children:"No checklist items for agents"}):r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Ar,{children:[r.jsx(It,{className:"w-12",children:"#"}),r.jsx(It,{children:"Title"}),r.jsx(It,{children:"Action Type"}),r.jsx(It,{children:"Status"}),r.jsx(It,{className:"text-right",children:"Actions"})]})}),r.jsx(Vs,{children:E.map((T,L)=>{var z;return r.jsxs(Ar,{children:[r.jsx(Nt,{className:"text-muted-foreground",children:L+1}),r.jsx(Nt,{children:r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:T.title}),T.description&&r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-1",children:T.description})]})}),r.jsx(Nt,{children:r.jsx(Ot,{variant:"outline",children:((z=Ice.find(F=>F.value===T.action_type))==null?void 0:z.label)||T.action_type})}),r.jsx(Nt,{children:r.jsx(Ps,{checked:T.is_active,onCheckedChange:()=>N(T)})}),r.jsx(Nt,{className:"text-right",children:r.jsxs("div",{className:"flex items-center justify-end gap-2",children:[r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>b(T),children:r.jsx(_i,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>C(T.id),children:r.jsx(Vn,{className:"h-4 w-4 text-destructive"})})]})})]},T.id)})})]})})]})]}),r.jsx(Fr,{open:a,onOpenChange:o,children:r.jsxs(Rr,{children:[r.jsx(qr,{children:r.jsx($r,{children:l?"Edit Checklist Item":"Add Checklist Item"})}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"title",children:"Title *"}),r.jsx(dt,{id:"title",value:h.title,onChange:T=>p({...h,title:T.target.value}),placeholder:"e.g., Watch your first academy video"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"description",children:"Description"}),r.jsx(ps,{id:"description",value:h.description,onChange:T=>p({...h,description:T.target.value}),placeholder:"Optional description for the checklist item",rows:2})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Target Role"}),r.jsxs(gn,{value:h.target_role,onValueChange:T=>p({...h,target_role:T}),children:[r.jsx(fn,{children:r.jsx(xn,{})}),r.jsx(pn,{children:Zwt.map(T=>r.jsx(Vt,{value:T.value,children:T.label},T.value))})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Action Type"}),r.jsxs(gn,{value:h.action_type,onValueChange:T=>p({...h,action_type:T}),children:[r.jsx(fn,{children:r.jsx(xn,{})}),r.jsx(pn,{children:Ice.map(T=>r.jsx(Vt,{value:T.value,children:T.label},T.value))})]})]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ps,{id:"is_active",checked:h.is_active,onCheckedChange:T=>p({...h,is_active:T})}),r.jsx(He,{htmlFor:"is_active",children:"Active"})]})]}),r.jsxs(ea,{children:[r.jsx(ee,{variant:"outline",onClick:()=>o(!1),children:"Cancel"}),r.jsx(ee,{onClick:j,children:l?"Save Changes":"Create Item"})]})]})})]})}function Xwt(){const[t,e]=I.useState(""),[n,s]=I.useState("all"),[a,o]=I.useState("name"),[l,i]=I.useState("asc"),[h,p]=I.useState(""),[x,y]=I.useState(""),[b,j]=I.useState(""),[C,N]=I.useState(""),{data:A}=Yt({queryKey:["admin-brokerages"],queryFn:async()=>{const{data:G,error:te}=await J.from("brokerages").select("id, name").order("name");if(te)throw te;return G}}),E=async G=>{let ie=[],le=0,ye=!0;for(;ye;){const{data:ne,error:ge}=await G(le,le+1e3-1);if(ge)throw ge;ne&&ne.length>0?(ie=[...ie,...ne],le+=1e3,ye=ne.length===1e3):ye=!1}return ie},{data:T,isLoading:L}=Yt({queryKey:["admin-agent-os-user-stats"],queryFn:async()=>{const G=await E((me,Le)=>J.from("profiles").select("id, name, email, brokerage_id, created_at").range(me,Le)),{data:te}=await J.from("brokerages").select("id, name"),ie=new Map((te==null?void 0:te.map(me=>[me.id,me.name]))||[]),{data:le}=await J.rpc("get_admin_contact_counts"),ye=new Map;le==null||le.forEach(me=>{ye.set(me.owner_user_id,me.contact_count)});const{data:ne}=await J.rpc("get_admin_video_counts"),ge=new Map;ne==null||ne.forEach(me=>{ge.set(me.owner_user_id,me.video_count)});const{data:ae}=await J.rpc("get_admin_popby_counts"),he=new Map;ae==null||ae.forEach(me=>{he.set(me.owner_user_id,me.popby_count)});const{data:ue}=await J.rpc("get_admin_listing_counts"),_e=new Map;ue==null||ue.forEach(me=>{_e.set(me.agent_id,me.listing_count)});const{data:Ae}=await J.rpc("get_admin_deal_counts"),Ce=new Map;return Ae==null||Ae.forEach(me=>{Ce.set(me.owner_user_id,me.deal_count)}),G.map(me=>({id:me.id,name:me.name||"Unknown",email:me.email||"",brokerage_id:me.brokerage_id,brokerage_name:me.brokerage_id&&ie.get(me.brokerage_id)||null,contact_count:ye.get(me.id)||0,video_count:ge.get(me.id)||0,popby_count:he.get(me.id)||0,listing_count:_e.get(me.id)||0,deal_count:Ce.get(me.id)||0,created_at:me.created_at}))}}),z=I.useMemo(()=>{if(!T)return[];let G=T.filter(te=>{const ie=t.toLowerCase(),le=!t||te.name.toLowerCase().includes(ie)||te.email.toLowerCase().includes(ie),ye=n==="all"||n==="none"&&!te.brokerage_id||te.brokerage_id===n,ne=parseInt(h)||0,ge=parseInt(x)||0,ae=parseInt(b)||0,he=parseInt(C)||0,ue=te.contact_count>=ne&&te.video_count>=ge&&te.popby_count>=ae&&te.listing_count>=he;return le&&ye&&ue});return G.sort((te,ie)=>{let le=0;return a==="name"?le=te.name.localeCompare(ie.name):le=te[a]-ie[a],l==="asc"?le:-le}),G},[T,t,n,a,l,h,x,b,C]),F=G=>{a===G?i(l==="asc"?"desc":"asc"):(o(G),i("desc"))},q=()=>{const G=["Name","Email","Brokerage","Contacts","Videos","Popbys","Listings","Deals"],te=z.map(ge=>[ge.name,ge.email,ge.brokerage_name||"None",ge.contact_count,ge.video_count,ge.popby_count,ge.listing_count,ge.deal_count]),ie=[G.join(","),...te.map(ge=>ge.map(ae=>`"${ae}"`).join(","))].join(` `),le=new Blob([ie],{type:"text/csv"}),ye=URL.createObjectURL(le),ne=document.createElement("a");ne.href=ye,ne.download=`agent-os-user-stats-${new Date().toISOString().split("T")[0]}.csv`,ne.click(),URL.revokeObjectURL(ye)},H=I.useMemo(()=>z.length?z.reduce((G,te)=>({contacts:G.contacts+te.contact_count,videos:G.videos+te.video_count,popbys:G.popbys+te.popby_count,listings:G.listings+te.listing_count,deals:G.deals+te.deal_count}),{contacts:0,videos:0,popbys:0,listings:0,deals:0}):{contacts:0,videos:0,popbys:0,listings:0,deals:0},[z]),Z=({field:G,children:te})=>r.jsx(It,{className:"cursor-pointer hover:bg-muted/50 select-none",onClick:()=>F(G),children:r.jsxs("div",{className:"flex items-center gap-1",children:[te,r.jsx(zx,{className:`h-3 w-3 ${a===G?"text-primary":"text-muted-foreground"}`})]})});return r.jsxs(Ye,{children:[r.jsx(Gt,{children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsxs(Zt,{className:"flex items-center gap-2",children:[r.jsx(Bn,{className:"h-5 w-5"}),"User Activity Analytics"]}),r.jsx(Mn,{children:"View all users and their Agent OS usage metrics"})]}),r.jsxs(ee,{variant:"outline",size:"sm",onClick:q,children:[r.jsx(no,{className:"h-4 w-4 mr-2"}),"Export CSV"]})]})}),r.jsxs(tt,{className:"space-y-4",children:[r.jsxs("div",{className:"grid gap-4 md:grid-cols-6",children:[r.jsx("div",{className:"md:col-span-2",children:r.jsxs("div",{className:"relative",children:[r.jsx(wa,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(dt,{placeholder:"Search by name or email...",value:t,onChange:G=>e(G.target.value),className:"pl-9"})]})}),r.jsx("div",{children:r.jsxs(gn,{value:n,onValueChange:s,children:[r.jsxs(fn,{children:[r.jsx(ai,{className:"h-4 w-4 mr-2 text-muted-foreground"}),r.jsx(xn,{placeholder:"Brokerage"})]}),r.jsxs(pn,{children:[r.jsx(Vt,{value:"all",children:"All Brokerages"}),r.jsx(Vt,{value:"none",children:"No Brokerage"}),A==null?void 0:A.map(G=>r.jsx(Vt,{value:G.id,children:G.name},G.id))]})]})}),r.jsx("div",{children:r.jsx(dt,{type:"number",placeholder:"Min contacts",value:h,onChange:G=>p(G.target.value),min:"0"})}),r.jsx("div",{children:r.jsx(dt,{type:"number",placeholder:"Min videos",value:x,onChange:G=>y(G.target.value),min:"0"})}),r.jsx("div",{children:r.jsx(dt,{type:"number",placeholder:"Min popbys",value:b,onChange:G=>j(G.target.value),min:"0"})})]}),r.jsxs("div",{className:"grid gap-4 md:grid-cols-6 text-sm",children:[r.jsxs("div",{className:"bg-muted/50 rounded-lg p-3 text-center",children:[r.jsx("div",{className:"text-2xl font-bold",children:z.length}),r.jsx("div",{className:"text-muted-foreground",children:"Users"})]}),r.jsxs("div",{className:"bg-muted/50 rounded-lg p-3 text-center",children:[r.jsx("div",{className:"text-2xl font-bold",children:H.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:H.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:H.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:H.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:H.deals.toLocaleString()}),r.jsx("div",{className:"text-muted-foreground",children:"Total Deals"})]})]}),L?r.jsx("div",{className:"flex justify-center py-12",children:r.jsx(en,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):r.jsx("div",{className:"rounded-md border",children:r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Ar,{children:[r.jsx(Z,{field:"name",children:"Name"}),r.jsx(It,{children:"Email"}),r.jsx(It,{children:"Brokerage"}),r.jsx(Z,{field:"contact_count",children:"Contacts"}),r.jsx(Z,{field:"video_count",children:"Videos"}),r.jsx(Z,{field:"popby_count",children:"Popbys"}),r.jsx(Z,{field:"listing_count",children:"Listings"}),r.jsx(Z,{field:"deal_count",children:"Deals"})]})}),r.jsx(Vs,{children:z.length===0?r.jsx(Ar,{children:r.jsx(Nt,{colSpan:8,className:"text-center py-8 text-muted-foreground",children:"No users found matching your filters"})}):z.map(G=>r.jsxs(Ar,{children:[r.jsx(Nt,{className:"font-medium",children:G.name}),r.jsx(Nt,{className:"text-muted-foreground",children:G.email}),r.jsx(Nt,{children:G.brokerage_name?r.jsx(Ot,{variant:"secondary",children:G.brokerage_name}):r.jsx("span",{className:"text-muted-foreground",children:"—"})}),r.jsx(Nt,{children:r.jsx(Ot,{variant:G.contact_count>0?"default":"outline",children:G.contact_count})}),r.jsx(Nt,{children:r.jsx(Ot,{variant:G.video_count>0?"default":"outline",children:G.video_count})}),r.jsx(Nt,{children:r.jsx(Ot,{variant:G.popby_count>0?"default":"outline",children:G.popby_count})}),r.jsx(Nt,{children:r.jsx(Ot,{variant:G.listing_count>0?"default":"outline",children:G.listing_count})}),r.jsx(Nt,{children:r.jsx(Ot,{variant:G.deal_count>0?"default":"outline",children:G.deal_count})})]},G.id))})]})})]})]})}function Qwt(){fi(),Vr();const[t,e]=I.useState("user-analytics"),{data:n}=Yt({queryKey:["admin-feature-flags"],queryFn:async()=>{const{data:j,error:C}=await J.from("feature_flags").select("*").order("key");if(C)throw C;return j}}),{data:s,isLoading:a}=Yt({queryKey:["admin-relationship-types"],queryFn:async()=>{const{data:j,error:C}=await J.from("relationship_types").select("*").order("sort_order");if(C)throw C;return j}}),{data:o,isLoading:l}=Yt({queryKey:["admin-action-types"],queryFn:async()=>{const{data:j,error:C}=await J.from("action_types").select("*").order("sort_order");if(C)throw C;return j}}),{data:i,isLoading:h}=Yt({queryKey:["admin-action-scripts"],queryFn:async()=>{const{data:j,error:C}=await J.from("action_scripts").select("*, action_type:action_types(*)");if(C)throw C;return j}}),{data:p,isLoading:x}=Yt({queryKey:["admin-touchpoint-plans"],queryFn:async()=>{const{data:j,error:C}=await J.from("touchpoint_plans").select("*").order("name");if(C)throw C;return j}}),{data:y,isLoading:b}=Yt({queryKey:["admin-popby-items"],queryFn:async()=>{const{data:j,error:C}=await J.from("popby_items").select("*").is("owner_user_id",null).order("name");if(C)throw C;return j}});return r.jsx(Lr,{title:"Agent OS Control Center",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Gu,{title:"Agent OS Control Center",description:"Manage InnerCircle settings, scripts, and touchpoint plans"}),r.jsxs(Ii,{value:t,onValueChange:e,children:[r.jsxs(wi,{className:"grid w-full grid-cols-9",children:[r.jsxs(ln,{value:"user-analytics",className:"gap-2",children:[r.jsx(cc,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline",children:"Users"})]}),r.jsxs(ln,{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(ln,{value:"action-types",className:"gap-2",children:[r.jsx(bi,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline",children:"Actions"})]}),r.jsxs(ln,{value:"scripts",className:"gap-2",children:[r.jsx(La,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline",children:"Scripts"})]}),r.jsxs(ln,{value:"video-scripts",className:"gap-2",children:[r.jsx(Ad,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline",children:"Video Scripts"})]}),r.jsxs(ln,{value:"plans",className:"gap-2",children:[r.jsx(zs,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline",children:"Plans"})]}),r.jsxs(ln,{value:"popbys",className:"gap-2",children:[r.jsx(Ki,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline",children:"Popbys"})]}),r.jsxs(ln,{value:"settings",className:"gap-2",children:[r.jsx(fd,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline",children:"Settings"})]}),r.jsxs(ln,{value:"feature-flags",className:"gap-2",children:[r.jsx(Bx,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline",children:"Flags"})]})]}),r.jsx(An,{value:"user-analytics",className:"mt-6",children:r.jsx(Xwt,{})}),r.jsx(An,{value:"relationship-types",className:"mt-6",children:r.jsx(Jwt,{types:s||[],isLoading:a})}),r.jsx(An,{value:"action-types",className:"mt-6",children:r.jsx(ejt,{types:o||[],isLoading:l})}),r.jsx(An,{value:"scripts",className:"mt-6",children:r.jsx(tjt,{scripts:i||[],actionTypes:o||[],isLoading:h})}),r.jsx(An,{value:"video-scripts",className:"mt-6",children:r.jsx(ajt,{})}),r.jsx(An,{value:"plans",className:"mt-6",children:r.jsx(rjt,{plans:p||[],actionTypes:o||[],scripts:i||[],isLoading:x})}),r.jsx(An,{value:"popbys",className:"mt-6",children:r.jsx(sjt,{items:y||[],isLoading:b})}),r.jsx(An,{value:"settings",className:"mt-6",children:r.jsx(ijt,{})}),r.jsx(An,{value:"feature-flags",className:"mt-6",children:r.jsx(njt,{flags:n||[]})})]})]})})}function Jwt({types:t,isLoading:e}){const{toast:n}=fi(),s=Vr(),[a,o]=I.useState(null),[l,i]=I.useState(!1),h=cr({mutationFn:async x=>{if(x.id){const{error:y}=await J.from("relationship_types").update({name:x.name,description:x.description,icon:x.icon}).eq("id",x.id);if(y)throw y}else{const{error:y}=await J.from("relationship_types").insert([{name:x.name,description:x.description,icon:x.icon,sort_order:t.length}]);if(y)throw y}},onSuccess:()=>{s.invalidateQueries({queryKey:["admin-relationship-types"]}),i(!1),o(null),n({title:"Saved successfully"})},onError:x=>{n({title:"Error",description:x.message,variant:"destructive"})}}),p=async x=>{await J.from("relationship_types").update({active:!x.active}).eq("id",x.id),s.invalidateQueries({queryKey:["admin-relationship-types"]})};return r.jsxs(Ye,{children:[r.jsxs(Gt,{className:"flex flex-row items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Zt,{children:"Relationship Types"}),r.jsx(Mn,{children:"Define the relationship categories for InnerCircle contacts"})]}),r.jsxs(ee,{onClick:()=>{o(null),i(!0)},children:[r.jsx(bn,{className:"h-4 w-4 mr-2"}),"Add Type"]})]}),r.jsx(tt,{children:e?r.jsx("div",{className:"flex justify-center py-8",children:r.jsx(en,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Ar,{children:[r.jsx(It,{className:"w-12"}),r.jsx(It,{children:"Name"}),r.jsx(It,{children:"Description"}),r.jsx(It,{children:"Status"}),r.jsx(It,{className:"w-24",children:"Actions"})]})}),r.jsx(Vs,{children:t.map(x=>r.jsxs(Ar,{children:[r.jsx(Nt,{children:r.jsx(x1,{className:"h-4 w-4 text-muted-foreground cursor-grab"})}),r.jsx(Nt,{className:"font-medium",children:x.name}),r.jsx(Nt,{className:"text-muted-foreground",children:x.description}),r.jsx(Nt,{children:r.jsx(Ps,{checked:x.active,onCheckedChange:()=>p(x)})}),r.jsx(Nt,{children:r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>{o(x),i(!0)},children:r.jsx(_i,{className:"h-4 w-4"})})})]},x.id))})]})}),r.jsx(Fr,{open:l,onOpenChange:i,children:r.jsxs(Rr,{children:[r.jsx(qr,{children:r.jsxs($r,{children:[a?"Edit":"Add"," Relationship Type"]})}),r.jsxs("form",{onSubmit:x=>{x.preventDefault();const y=new FormData(x.currentTarget);h.mutate({id:a==null?void 0:a.id,name:y.get("name"),description:y.get("description"),icon:y.get("icon")})},children:[r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx(He,{htmlFor:"name",children:"Name"}),r.jsx(dt,{id:"name",name:"name",defaultValue:a==null?void 0:a.name,required:!0})]}),r.jsxs("div",{children:[r.jsx(He,{htmlFor:"description",children:"Description"}),r.jsx(ps,{id:"description",name:"description",defaultValue:(a==null?void 0:a.description)||""})]}),r.jsxs("div",{children:[r.jsx(He,{htmlFor:"icon",children:"Icon"}),r.jsx(dt,{id:"icon",name:"icon",defaultValue:(a==null?void 0:a.icon)||"",placeholder:"e.g., star, heart, user"})]})]}),r.jsxs(ea,{className:"mt-4",children:[r.jsx(ee,{type:"button",variant:"outline",onClick:()=>i(!1),children:"Cancel"}),r.jsxs(ee,{type:"submit",disabled:h.isPending,children:[h.isPending&&r.jsx(en,{className:"h-4 w-4 mr-2 animate-spin"}),"Save"]})]})]})]})})]})}function ejt({types:t,isLoading:e}){const{toast:n}=fi(),s=Vr(),[a,o]=I.useState(null),[l,i]=I.useState(!1),h=cr({mutationFn:async x=>{if(x.id){const{error:y}=await J.from("action_types").update({name:x.name,description:x.description,icon:x.icon,color:x.color}).eq("id",x.id);if(y)throw y}else{const{error:y}=await J.from("action_types").insert([{name:x.name,description:x.description,icon:x.icon,color:x.color,sort_order:t.length}]);if(y)throw y}},onSuccess:()=>{s.invalidateQueries({queryKey:["admin-action-types"]}),i(!1),o(null),n({title:"Saved successfully"})},onError:x=>{n({title:"Error",description:x.message,variant:"destructive"})}}),p=async x=>{await J.from("action_types").update({active:!x.active}).eq("id",x.id),s.invalidateQueries({queryKey:["admin-action-types"]})};return r.jsxs(Ye,{children:[r.jsxs(Gt,{className:"flex flex-row items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Zt,{children:"Action Types"}),r.jsx(Mn,{children:"Define the types of touchpoint actions agents can take"})]}),r.jsxs(ee,{onClick:()=>{o(null),i(!0)},children:[r.jsx(bn,{className:"h-4 w-4 mr-2"}),"Add Action"]})]}),r.jsx(tt,{children:e?r.jsx("div",{className:"flex justify-center py-8",children:r.jsx(en,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Ar,{children:[r.jsx(It,{children:"Name"}),r.jsx(It,{children:"Description"}),r.jsx(It,{children:"Color"}),r.jsx(It,{children:"Status"}),r.jsx(It,{className:"w-24",children:"Actions"})]})}),r.jsx(Vs,{children:t.map(x=>r.jsxs(Ar,{children:[r.jsx(Nt,{className:"font-medium",children:x.name}),r.jsx(Nt,{className:"text-muted-foreground",children:x.description}),r.jsx(Nt,{children:x.color&&r.jsx("div",{className:"w-6 h-6 rounded",style:{backgroundColor:x.color}})}),r.jsx(Nt,{children:r.jsx(Ps,{checked:x.active,onCheckedChange:()=>p(x)})}),r.jsx(Nt,{children:r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>{o(x),i(!0)},children:r.jsx(_i,{className:"h-4 w-4"})})})]},x.id))})]})}),r.jsx(Fr,{open:l,onOpenChange:i,children:r.jsxs(Rr,{children:[r.jsx(qr,{children:r.jsxs($r,{children:[a?"Edit":"Add"," Action Type"]})}),r.jsxs("form",{onSubmit:x=>{x.preventDefault();const y=new FormData(x.currentTarget);h.mutate({id:a==null?void 0:a.id,name:y.get("name"),description:y.get("description"),icon:y.get("icon"),color:y.get("color")})},children:[r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx(He,{htmlFor:"name",children:"Name"}),r.jsx(dt,{id:"name",name:"name",defaultValue:a==null?void 0:a.name,required:!0})]}),r.jsxs("div",{children:[r.jsx(He,{htmlFor:"description",children:"Description"}),r.jsx(ps,{id:"description",name:"description",defaultValue:(a==null?void 0:a.description)||""})]}),r.jsxs("div",{children:[r.jsx(He,{htmlFor:"icon",children:"Icon"}),r.jsx(dt,{id:"icon",name:"icon",defaultValue:(a==null?void 0:a.icon)||"",placeholder:"e.g., phone, message"})]}),r.jsxs("div",{children:[r.jsx(He,{htmlFor:"color",children:"Color"}),r.jsx(dt,{id:"color",name:"color",type:"color",defaultValue:(a==null?void 0:a.color)||"#6366f1"})]})]}),r.jsxs(ea,{className:"mt-4",children:[r.jsx(ee,{type:"button",variant:"outline",onClick:()=>i(!1),children:"Cancel"}),r.jsxs(ee,{type:"submit",disabled:h.isPending,children:[h.isPending&&r.jsx(en,{className:"h-4 w-4 mr-2 animate-spin"}),"Save"]})]})]})]})})]})}function tjt({scripts:t,actionTypes:e,isLoading:n}){const{toast:s}=fi(),a=Vr(),[o,l]=I.useState(null),[i,h]=I.useState(!1),p=cr({mutationFn:async y=>{if(y.id){const{error:b}=await J.from("action_scripts").update({title:y.title,action_type_id:y.action_type_id,tone:y.tone,script_body:y.script_body,active:y.active}).eq("id",y.id);if(b)throw b}else{const{error:b}=await J.from("action_scripts").insert([{title:y.title,action_type_id:y.action_type_id,tone:y.tone,script_body:y.script_body,active:!0}]);if(b)throw b}},onSuccess:()=>{a.invalidateQueries({queryKey:["admin-action-scripts"]}),h(!1),l(null),s({title:"Saved successfully"})},onError:y=>{s({title:"Error",description:y.message,variant:"destructive"})}}),x=cr({mutationFn:async y=>{const{error:b}=await J.from("action_scripts").delete().eq("id",y);if(b)throw b},onSuccess:()=>{a.invalidateQueries({queryKey:["admin-action-scripts"]}),s({title:"Deleted successfully"})}});return r.jsxs(Ye,{children:[r.jsxs(Gt,{className:"flex flex-row items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Zt,{children:"Script Library"}),r.jsx(Mn,{children:"Create and manage scripts for each action type"})]}),r.jsxs(ee,{onClick:()=>{l(null),h(!0)},children:[r.jsx(bn,{className:"h-4 w-4 mr-2"}),"Add Script"]})]}),r.jsx(tt,{children:n?r.jsx("div",{className:"flex justify-center py-8",children:r.jsx(en,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Ar,{children:[r.jsx(It,{children:"Title"}),r.jsx(It,{children:"Action Type"}),r.jsx(It,{children:"Tone"}),r.jsx(It,{children:"Status"}),r.jsx(It,{className:"w-24",children:"Actions"})]})}),r.jsx(Vs,{children:t.map(y=>{var b;return r.jsxs(Ar,{children:[r.jsx(Nt,{className:"font-medium",children:y.title}),r.jsx(Nt,{children:r.jsx(Ot,{variant:"outline",children:((b=y.action_type)==null?void 0:b.name)||"Unknown"})}),r.jsx(Nt,{className:"text-muted-foreground",children:y.tone}),r.jsx(Nt,{children:r.jsx(Ot,{variant:y.active?"default":"secondary",children:y.active?"Active":"Inactive"})}),r.jsxs(Nt,{className:"flex gap-1",children:[r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>{l(y),h(!0)},children:r.jsx(_i,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>x.mutate(y.id),children:r.jsx(Vn,{className:"h-4 w-4 text-destructive"})})]})]},y.id)})})]})}),r.jsx(Fr,{open:i,onOpenChange:h,children:r.jsxs(Rr,{className:"max-w-2xl",children:[r.jsx(qr,{children:r.jsxs($r,{children:[o?"Edit":"Add"," Script"]})}),r.jsxs("form",{onSubmit:y=>{y.preventDefault();const b=new FormData(y.currentTarget);p.mutate({id:o==null?void 0:o.id,title:b.get("title"),action_type_id:b.get("action_type_id"),tone:b.get("tone"),script_body:b.get("script_body"),active:!0})},children:[r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx(He,{htmlFor:"title",children:"Title"}),r.jsx(dt,{id:"title",name:"title",defaultValue:o==null?void 0:o.title,required:!0})]}),r.jsxs("div",{children:[r.jsx(He,{htmlFor:"action_type_id",children:"Action Type"}),r.jsxs(gn,{name:"action_type_id",defaultValue:o==null?void 0:o.action_type_id,children:[r.jsx(fn,{children:r.jsx(xn,{placeholder:"Select action type"})}),r.jsx(pn,{children:e.map(y=>r.jsx(Vt,{value:y.id,children:y.name},y.id))})]})]})]}),r.jsxs("div",{children:[r.jsx(He,{htmlFor:"tone",children:"Tone (optional)"}),r.jsx(dt,{id:"tone",name:"tone",defaultValue:(o==null?void 0:o.tone)||"",placeholder:"e.g., Friendly, Professional, Casual"})]}),r.jsxs("div",{children:[r.jsx(He,{htmlFor:"script_body",children:"Script Body"}),r.jsx(ps,{id:"script_body",name:"script_body",defaultValue:o==null?void 0:o.script_body,rows:8,required:!0,placeholder:`Use {{FirstName}}, {{LastName}}, and {{AgentName}} as placeholders. Example: Hey {{FirstName}}, it's {{AgentName}}. I was thinking about you and wanted to check in...`})]})]}),r.jsxs(ea,{className:"mt-4",children:[r.jsx(ee,{type:"button",variant:"outline",onClick:()=>h(!1),children:"Cancel"}),r.jsxs(ee,{type:"submit",disabled:p.isPending,children:[p.isPending&&r.jsx(en,{className:"h-4 w-4 mr-2 animate-spin"}),"Save"]})]})]})]})})]})}function rjt({plans:t,actionTypes:e,scripts:n,isLoading:s}){const{toast:a}=fi(),o=Vr(),[l,i]=I.useState(null),[h,p]=I.useState(!1),[x,y]=I.useState(null),[b,j]=I.useState(!1),[C,N]=I.useState(null),[A,E]=I.useState(null),{data:T}=Yt({queryKey:["plan-items",x],queryFn:async()=>{if(!x)return[];const{data:G,error:te}=await J.from("touchpoint_plan_items").select("*").eq("plan_id",x).order("month_number");if(te)throw te;return G},enabled:!!x}),L=cr({mutationFn:async G=>{if(G.id){const{error:te}=await J.from("touchpoint_plans").update({name:G.name,description:G.description,active:G.active}).eq("id",G.id);if(te)throw te}else{const{error:te}=await J.from("touchpoint_plans").insert([{name:G.name,description:G.description,active:!0}]);if(te)throw te}},onSuccess:()=>{o.invalidateQueries({queryKey:["admin-touchpoint-plans"]}),p(!1),i(null),a({title:"Saved successfully"})},onError:G=>{a({title:"Error",description:G.message,variant:"destructive"})}}),z=cr({mutationFn:async G=>{if(G.id){const{error:te}=await J.from("touchpoint_plan_items").update({action_type_id:G.action_type_id,default_script_id:G.default_script_id,notes:G.notes}).eq("id",G.id);if(te)throw te}else{const{error:te}=await J.from("touchpoint_plan_items").insert([{plan_id:G.plan_id,month_number:G.month_number,action_type_id:G.action_type_id,default_script_id:G.default_script_id,notes:G.notes}]);if(te)throw te}},onSuccess:()=>{o.invalidateQueries({queryKey:["plan-items",x]}),a({title:"Item saved"})}}),F=cr({mutationFn:async G=>{const{error:te}=await J.from("touchpoint_plan_items").delete().eq("id",G);if(te)throw te},onSuccess:()=>{o.invalidateQueries({queryKey:["plan-items",x]})}}),q=cr({mutationFn:async G=>{const{data:te,error:ie}=await J.from("action_scripts").insert([{...G,active:!0}]).select().single();if(ie)throw ie;return te},onSuccess:async G=>{o.invalidateQueries({queryKey:["admin-action-scripts"]}),C&&await z.mutateAsync({id:C.itemId,plan_id:x,month_number:C.month,action_type_id:C.actionTypeId,default_script_id:G.id}),j(!1),N(null),a({title:"Script created and assigned"})},onError:G=>{a({title:"Error",description:G.message,variant:"destructive"})}}),H=(G,te,ie)=>{N({month:G,actionTypeId:te,itemId:ie}),j(!0)},Z=G=>n.find(te=>te.id===G);return r.jsxs("div",{className:"space-y-6",children:[r.jsxs(Ye,{children:[r.jsxs(Gt,{className:"flex flex-row items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Zt,{children:"Touchpoint Plans"}),r.jsx(Mn,{children:"Create annual touchpoint plans that agents can apply to their contacts"})]}),r.jsxs(ee,{onClick:()=>{i(null),p(!0)},children:[r.jsx(bn,{className:"h-4 w-4 mr-2"}),"Add Plan"]})]}),r.jsx(tt,{children:s?r.jsx("div",{className:"flex justify-center py-8",children:r.jsx(en,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):r.jsx("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:t.map(G=>r.jsxs(Ye,{className:`cursor-pointer transition-colors ${x===G.id?"border-primary":""}`,onClick:()=>y(G.id),children:[r.jsx(Gt,{className:"pb-2",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(Zt,{className:"text-base",children:G.name}),r.jsx(ee,{variant:"ghost",size:"icon",onClick:te=>{te.stopPropagation(),i(G),p(!0)},children:r.jsx(_i,{className:"h-4 w-4"})})]})}),r.jsxs(tt,{children:[r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2",children:G.description}),r.jsx(Ot,{variant:G.active?"default":"secondary",className:"mt-2",children:G.active?"Active":"Inactive"})]})]},G.id))})})]}),x&&r.jsxs(Ye,{children:[r.jsxs(Gt,{children:[r.jsx(Zt,{children:"Plan Schedule"}),r.jsx(Mn,{children:"Configure the monthly touchpoint schedule. Select an action type for each month, then assign or create a script."})]}),r.jsx(tt,{children:r.jsx("div",{className:"grid gap-3",children:Array.from({length:12},(G,te)=>te+1).map(G=>{const te=T==null?void 0:T.find(ye=>ye.month_number===G),ie=te!=null&&te.default_script_id?Z(te.default_script_id):null,le=n.filter(ye=>ye.action_type_id===(te==null?void 0:te.action_type_id)&&ye.active);return r.jsxs("div",{className:"p-4 border rounded-lg space-y-3",children:[r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsxs("div",{className:"w-20 font-medium text-sm",children:["Month ",G]}),r.jsxs(gn,{value:(te==null?void 0:te.action_type_id)||"none",onValueChange:ye=>{ye==="none"&&te?F.mutate(te.id):ye!=="none"&&z.mutate({id:te==null?void 0:te.id,plan_id:x,month_number:G,action_type_id:ye,default_script_id:null})},children:[r.jsx(fn,{className:"w-40",children:r.jsx(xn,{placeholder:"No action"})}),r.jsxs(pn,{children:[r.jsx(Vt,{value:"none",children:"No action"}),e.filter(ye=>ye.active).map(ye=>r.jsx(Vt,{value:ye.id,children:r.jsxs("span",{className:"flex items-center gap-2",children:[ye.color&&r.jsx("span",{className:"w-3 h-3 rounded-full",style:{backgroundColor:ye.color}}),ye.name]})},ye.id))]})]}),te&&r.jsxs(r.Fragment,{children:[r.jsxs(gn,{value:te.default_script_id||"none",onValueChange:ye=>{E(null),z.mutate({id:te.id,default_script_id:ye==="none"?null:ye})},children:[r.jsx(fn,{className:"w-56",children:r.jsx(xn,{placeholder:"Select script"})}),r.jsxs(pn,{children:[r.jsx(Vt,{value:"none",children:"No default script"}),le.map(ye=>r.jsxs(Vt,{value:ye.id,children:[ye.title," ",ye.tone&&`(${ye.tone})`]},ye.id))]})]}),r.jsxs(ee,{variant:"outline",size:"sm",onClick:()=>H(G,te.action_type_id,te.id),children:[r.jsx(bn,{className:"h-3 w-3 mr-1"}),"New Script"]}),ie&&r.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>E((A==null?void 0:A.id)===ie.id?null:ie),children:(A==null?void 0:A.id)===ie.id?"Hide":"Preview"})]})]}),A&&(te==null?void 0:te.default_script_id)===A.id&&r.jsxs("div",{className:"ml-24 p-3 bg-muted rounded-lg text-sm",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[r.jsx(Ot,{variant:"outline",children:A.title}),A.tone&&r.jsx(Ot,{variant:"secondary",children:A.tone})]}),r.jsx("p",{className:"text-muted-foreground whitespace-pre-wrap",children:A.script_body})]})]},G)})})})]}),r.jsx(Fr,{open:h,onOpenChange:p,children:r.jsxs(Rr,{children:[r.jsx(qr,{children:r.jsxs($r,{children:[l?"Edit":"Add"," Touchpoint Plan"]})}),r.jsxs("form",{onSubmit:G=>{G.preventDefault();const te=new FormData(G.currentTarget);L.mutate({id:l==null?void 0:l.id,name:te.get("name"),description:te.get("description"),active:!0})},children:[r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx(He,{htmlFor:"name",children:"Name"}),r.jsx(dt,{id:"name",name:"name",defaultValue:l==null?void 0:l.name,required:!0})]}),r.jsxs("div",{children:[r.jsx(He,{htmlFor:"description",children:"Description"}),r.jsx(ps,{id:"description",name:"description",defaultValue:(l==null?void 0:l.description)||"",rows:3})]})]}),r.jsxs(ea,{className:"mt-4",children:[r.jsx(ee,{type:"button",variant:"outline",onClick:()=>p(!1),children:"Cancel"}),r.jsxs(ee,{type:"submit",disabled:L.isPending,children:[L.isPending&&r.jsx(en,{className:"h-4 w-4 mr-2 animate-spin"}),"Save"]})]})]})]})}),r.jsx(Fr,{open:b,onOpenChange:j,children:r.jsxs(Rr,{className:"max-w-2xl",children:[r.jsxs(qr,{children:[r.jsx($r,{children:"Create New Script"}),r.jsxs(Xn,{children:["Create a script for Month ",C==null?void 0:C.month,". Use ","{{FirstName}}",", ","{{LastName}}",", and ","{{AgentName}}"," as placeholders."]})]}),r.jsxs("form",{onSubmit:G=>{G.preventDefault();const te=new FormData(G.currentTarget);q.mutate({title:te.get("title"),action_type_id:C.actionTypeId,tone:te.get("tone"),script_body:te.get("script_body")})},children:[r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx(He,{htmlFor:"script_title",children:"Title"}),r.jsx(dt,{id:"script_title",name:"title",placeholder:"e.g., Warm Check-In",required:!0})]}),r.jsxs("div",{children:[r.jsx(He,{htmlFor:"script_tone",children:"Tone"}),r.jsx(dt,{id:"script_tone",name:"tone",placeholder:"e.g., Friendly, Professional"})]})]}),r.jsxs("div",{children:[r.jsx(He,{htmlFor:"script_body",children:"Script Body"}),r.jsx(ps,{id:"script_body",name:"script_body",rows:6,required:!0,placeholder:"Hey {{FirstName}}, it's {{AgentName}}. I was thinking about you and wanted to check in..."})]})]}),r.jsxs(ea,{className:"mt-4",children:[r.jsx(ee,{type:"button",variant:"outline",onClick:()=>j(!1),children:"Cancel"}),r.jsxs(ee,{type:"submit",disabled:q.isPending,children:[q.isPending&&r.jsx(en,{className:"h-4 w-4 mr-2 animate-spin"}),"Create & Assign"]})]})]})]})})]})}function njt({flags:t}){const{toast:e}=fi(),n=Vr(),s=async(a,o)=>{const{error:l}=await J.from("feature_flags").update({...o,updated_at:new Date().toISOString()}).eq("id",a.id);l?e({title:"Error",description:l.message,variant:"destructive"}):(n.invalidateQueries({queryKey:["admin-feature-flags"]}),e({title:"Flag updated"}))};return r.jsxs(Ye,{children:[r.jsxs(Gt,{children:[r.jsx(Zt,{children:"Feature Flags"}),r.jsx(Mn,{children:"Control which features are enabled for members"})]}),r.jsx(tt,{children:r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Ar,{children:[r.jsx(It,{children:"Flag"}),r.jsx(It,{children:"Status"}),r.jsx(It,{children:"Notes"}),r.jsx(It,{children:"Last Updated"})]})}),r.jsx(Vs,{children:t.map(a=>r.jsxs(Ar,{children:[r.jsx(Nt,{className:"font-mono text-sm",children:a.key}),r.jsx(Nt,{children:r.jsx(Ps,{checked:a.enabled,onCheckedChange:o=>s(a,{enabled:o})})}),r.jsx(Nt,{children:r.jsx(dt,{defaultValue:a.notes||"",placeholder:"Add notes...",className:"max-w-xs",onBlur:o=>{o.target.value!==a.notes&&s(a,{notes:o.target.value})}})}),r.jsx(Nt,{className:"text-muted-foreground text-sm",children:new Date(a.updated_at).toLocaleDateString()})]},a.id))})]})})]})}function sjt({items:t,isLoading:e}){const{toast:n}=fi(),s=Vr(),[a,o]=I.useState(null),[l,i]=I.useState(!1),h=cr({mutationFn:async y=>{if(y.id){const{error:b}=await J.from("popby_items").update({name:y.name,description:y.description}).eq("id",y.id);if(b)throw b}else{const{error:b}=await J.from("popby_items").insert([{name:y.name,description:y.description,owner_user_id:null}]);if(b)throw b}},onSuccess:()=>{s.invalidateQueries({queryKey:["admin-popby-items"]}),s.invalidateQueries({queryKey:["popby-items"]}),i(!1),o(null),n({title:"Saved successfully"})},onError:y=>{n({title:"Error",description:y.message,variant:"destructive"})}}),p=async y=>{await J.from("popby_items").update({is_active:!y.is_active}).eq("id",y.id),s.invalidateQueries({queryKey:["admin-popby-items"]}),s.invalidateQueries({queryKey:["popby-items"]})},x=async y=>{await J.from("popby_items").delete().eq("id",y),s.invalidateQueries({queryKey:["admin-popby-items"]}),s.invalidateQueries({queryKey:["popby-items"]}),n({title:"Deleted successfully"})};return r.jsxs(Ye,{children:[r.jsxs(Gt,{className:"flex flex-row items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Zt,{children:"Popby Ideas"}),r.jsx(Mn,{children:"Manage global popby ideas that all agents can see"})]}),r.jsxs(ee,{onClick:()=>{o(null),i(!0)},children:[r.jsx(bn,{className:"h-4 w-4 mr-2"}),"Add Popby Idea"]})]}),r.jsx(tt,{children:e?r.jsx("div",{className:"flex justify-center py-8",children:r.jsx(en,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):t.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(Ki,{className:"h-12 w-12 mx-auto mb-2 opacity-50"}),r.jsx("p",{children:"No popby ideas yet. Add your first one!"})]}):r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Ar,{children:[r.jsx(It,{children:"Name"}),r.jsx(It,{children:"Description"}),r.jsx(It,{children:"Status"}),r.jsx(It,{className:"w-24",children:"Actions"})]})}),r.jsx(Vs,{children:t.map(y=>r.jsxs(Ar,{children:[r.jsx(Nt,{className:"font-medium",children:y.name}),r.jsx(Nt,{className:"text-muted-foreground",children:y.description}),r.jsx(Nt,{children:r.jsx(Ps,{checked:y.is_active,onCheckedChange:()=>p(y)})}),r.jsx(Nt,{children:r.jsxs("div",{className:"flex gap-1",children:[r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>{o(y),i(!0)},children:r.jsx(_i,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>x(y.id),children:r.jsx(Vn,{className:"h-4 w-4 text-destructive"})})]})})]},y.id))})]})}),r.jsx(Fr,{open:l,onOpenChange:i,children:r.jsxs(Rr,{children:[r.jsx(qr,{children:r.jsxs($r,{children:[a?"Edit":"Add"," Popby Idea"]})}),r.jsxs("form",{onSubmit:y=>{y.preventDefault();const b=new FormData(y.currentTarget);h.mutate({id:a==null?void 0:a.id,name:b.get("name"),description:b.get("description")})},children:[r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx(He,{htmlFor:"name",children:"Name"}),r.jsx(dt,{id:"name",name:"name",defaultValue:a==null?void 0:a.name,required:!0,placeholder:"e.g., Homemade Cookies"})]}),r.jsxs("div",{children:[r.jsx(He,{htmlFor:"description",children:"Description"}),r.jsx(ps,{id:"description",name:"description",defaultValue:(a==null?void 0:a.description)||"",placeholder:"Brief description of the popby idea..."})]})]}),r.jsxs(ea,{className:"mt-4",children:[r.jsx(ee,{type:"button",variant:"outline",onClick:()=>i(!1),children:"Cancel"}),r.jsxs(ee,{type:"submit",disabled:h.isPending,children:[h.isPending&&r.jsx(en,{className:"h-4 w-4 mr-2 animate-spin"}),"Save"]})]})]})]})})]})}function ajt(){var j;const{toast:t}=fi(),e=Vr(),[n,s]=I.useState(null),[a,o]=I.useState(!1),{data:l,isLoading:i}=Yt({queryKey:["admin-video-script-categories"],queryFn:async()=>{const{data:C,error:N}=await J.from("video_script_categories").select("*").order("sort_order");if(N)throw N;return C}}),{data:h,isLoading:p}=Yt({queryKey:["admin-video-scripts"],queryFn:async()=>{const{data:C,error:N}=await J.from("video_scripts").select("*, category:video_script_categories(*)").order("title");if(N)throw N;return C}}),x=cr({mutationFn:async C=>{var N,A;if(C.id){const{error:E}=await J.from("video_scripts").update({title:C.title,script_text:C.script_text,category_id:C.category_id,tags:((N=C.tags)==null?void 0:N.split(",").map(T=>T.trim()).filter(Boolean))||[]}).eq("id",C.id);if(E)throw E}else{const{error:E}=await J.from("video_scripts").insert([{title:C.title,script_text:C.script_text,category_id:C.category_id||null,tags:((A=C.tags)==null?void 0:A.split(",").map(T=>T.trim()).filter(Boolean))||[]}]);if(E)throw E}},onSuccess:()=>{e.invalidateQueries({queryKey:["admin-video-scripts"]}),o(!1),s(null),t({title:"Video script saved!"})},onError:C=>t({title:"Error",description:C.message,variant:"destructive"})}),y=async C=>{await J.from("video_scripts").update({is_active:!C.is_active}).eq("id",C.id),e.invalidateQueries({queryKey:["admin-video-scripts"]})},b=async C=>{confirm("Delete this video script?")&&(await J.from("video_scripts").delete().eq("id",C),e.invalidateQueries({queryKey:["admin-video-scripts"]}),t({title:"Script deleted"}))};return r.jsxs(Ye,{children:[r.jsxs(Gt,{className:"flex flex-row items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Zt,{children:"Video Scripts"}),r.jsx(Mn,{children:"Manage teleprompter scripts for Quick Video Touch"})]}),r.jsxs(ee,{onClick:()=>{s(null),o(!0)},children:[r.jsx(bn,{className:"h-4 w-4 mr-2"}),"Add Script"]})]}),r.jsx(tt,{children:p?r.jsx("div",{className:"flex justify-center py-8",children:r.jsx(en,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Ar,{children:[r.jsx(It,{children:"Title"}),r.jsx(It,{children:"Category"}),r.jsx(It,{children:"Status"}),r.jsx(It,{className:"w-24",children:"Actions"})]})}),r.jsx(Vs,{children:h==null?void 0:h.map(C=>{var N;return r.jsxs(Ar,{children:[r.jsx(Nt,{className:"font-medium",children:C.title}),r.jsx(Nt,{className:"text-muted-foreground",children:((N=C.category)==null?void 0:N.name)||"Uncategorized"}),r.jsx(Nt,{children:r.jsx(Ps,{checked:C.is_active,onCheckedChange:()=>y(C)})}),r.jsxs(Nt,{className:"flex gap-1",children:[r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>{s(C),o(!0)},children:r.jsx(_i,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>b(C.id),children:r.jsx(Vn,{className:"h-4 w-4"})})]})]},C.id)})})]})}),r.jsx(Fr,{open:a,onOpenChange:o,children:r.jsxs(Rr,{className:"max-w-2xl",children:[r.jsx(qr,{children:r.jsxs($r,{children:[n?"Edit":"Add"," Video Script"]})}),r.jsxs("form",{onSubmit:C=>{C.preventDefault();const N=new FormData(C.currentTarget);x.mutate({id:n==null?void 0:n.id,title:N.get("title"),script_text:N.get("script_text"),category_id:N.get("category_id")||null,tags:N.get("tags")})},children:[r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx(He,{htmlFor:"title",children:"Title"}),r.jsx(dt,{id:"title",name:"title",defaultValue:n==null?void 0:n.title,required:!0})]}),r.jsxs("div",{children:[r.jsx(He,{htmlFor:"category_id",children:"Category"}),r.jsxs(gn,{name:"category_id",defaultValue:(n==null?void 0:n.category_id)||"",children:[r.jsx(fn,{children:r.jsx(xn,{placeholder:"Select category"})}),r.jsx(pn,{children:l==null?void 0:l.map(C=>r.jsx(Vt,{value:C.id,children:C.name},C.id))})]})]}),r.jsxs("div",{children:[r.jsx(He,{htmlFor:"script_text",children:"Script Text"}),r.jsx(ps,{id:"script_text",name:"script_text",defaultValue:n==null?void 0:n.script_text,rows:6,required:!0,placeholder:"Enter the teleprompter script..."})]}),r.jsxs("div",{children:[r.jsx(He,{htmlFor:"tags",children:"Tags (comma-separated)"}),r.jsx(dt,{id:"tags",name:"tags",defaultValue:((j=n==null?void 0:n.tags)==null?void 0:j.join(", "))||"",placeholder:"birthday, follow-up, thank-you"})]})]}),r.jsxs(ea,{className:"mt-4",children:[r.jsx(ee,{type:"button",variant:"outline",onClick:()=>o(!1),children:"Cancel"}),r.jsxs(ee,{type:"submit",disabled:x.isPending,children:[x.isPending&&r.jsx(en,{className:"h-4 w-4 mr-2 animate-spin"}),"Save"]})]})]})]})})]})}function ijt(){const{toast:t}=fi(),[e,n]=I.useState(""),[s,a]=I.useState(!0),[o,l]=I.useState(!1);I.useEffect(()=>{(async()=>{a(!0);try{const{data:p}=await J.from("settings").select("value").eq("key","mapbox_public_token").maybeSingle();p!=null&&p.value&&n(p.value)}catch(p){console.error("Error fetching settings:",p)}a(!1)})()},[]);const i=async()=>{l(!0);try{await J.from("settings").upsert({key:"mapbox_public_token",value:e.trim()}),t({title:"Mapbox token saved!"})}catch{t({title:"Error saving token",variant:"destructive"})}l(!1)};return s?r.jsx(Ye,{children:r.jsx(tt,{className:"flex justify-center py-8",children:r.jsx(en,{className:"h-8 w-8 animate-spin text-muted-foreground"})})}):r.jsx("div",{className:"space-y-6",children:r.jsxs(Ye,{children:[r.jsxs(Gt,{children:[r.jsxs(Zt,{className:"flex items-center gap-2",children:[r.jsx(fl,{className:"h-5 w-5"}),"Popby Map Settings"]}),r.jsx(Mn,{children:"Configure the map feature for popbys"})]}),r.jsxs(tt,{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"mapbox-token",children:"Mapbox Public Token"}),r.jsx(dt,{id:"mapbox-token",placeholder:"pk.eyJ1I...",value:e,onChange:h=>n(h.target.value)}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Get your token at"," ",r.jsx("a",{href:"https://mapbox.com/",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"mapbox.com"}),". This token will be used by all agents for the popby map feature."]})]}),r.jsxs(ee,{onClick:i,disabled:o,children:[o&&r.jsx(en,{className:"h-4 w-4 mr-2 animate-spin"}),"Save Token"]}),e&&r.jsx(Ot,{variant:"secondary",className:"ml-2",children:"Token configured"})]})]})})}const ojt=()=>{const[t,e]=I.useState(""),[n,s]=I.useState("grid"),a=rs(),{data:o=[],isLoading:l}=Yt({queryKey:["additional-services"],queryFn:async()=>{const{data:h,error:p}=await J.from("additional_services").select("*").eq("is_published",!0).order("publish_date",{ascending:!1});if(p)throw p;return h}}),i=o.filter(h=>{var x;return h.name.toLowerCase().includes(t.toLowerCase())||((x=h.description)==null?void 0:x.toLowerCase().includes(t.toLowerCase()))});return r.jsx(Lr,{title:"Additional Services",children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold text-foreground",children:"Additional Services"}),r.jsx("p",{className:"text-muted-foreground mt-1",children:"Explore our additional services and offerings"})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[r.jsxs("div",{className:"relative flex-1 max-w-sm",children:[r.jsx(wa,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(dt,{placeholder:"Search services...",value:t,onChange:h=>e(h.target.value),className:"pl-9"})]}),r.jsxs("div",{className:"flex gap-2",children:[t&&r.jsx(ee,{variant:"outline",size:"sm",onClick:()=>e(""),children:"Clear"}),r.jsxs("div",{className:"flex gap-1",children:[r.jsx(ee,{variant:n==="grid"?"secondary":"outline",size:"icon",onClick:()=>s("grid"),className:"rounded-full",children:r.jsx(pm,{className:"h-4 w-4"})}),r.jsx(ee,{variant:n==="list"?"secondary":"outline",size:"icon",onClick:()=>s("list"),className:"rounded-full",children:r.jsx(Kf,{className:"h-4 w-4"})})]})]})]}),r.jsxs("div",{className:"text-sm text-muted-foreground",children:[i.length," service",i.length!==1?"s":""," found"]}),l&&r.jsx("div",{className:n==="grid"?"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6":"space-y-4",children:[...Array(4)].map((h,p)=>r.jsx(Ye,{children:r.jsxs(tt,{className:"p-4",children:[r.jsx(Ir,{className:"aspect-[3/2] w-full rounded-lg mb-4"}),r.jsx(Ir,{className:"h-5 w-3/4 mb-2"}),r.jsx(Ir,{className:"h-4 w-full mb-4"})]})},p))}),!l&&i.length===0&&r.jsxs("div",{className:"text-center py-12",children:[r.jsx("div",{className:"text-muted-foreground mb-4",children:t?"No services match your search":"No additional services available yet"}),t&&r.jsx(ee,{variant:"outline",onClick:()=>e(""),children:"Clear Search"})]}),!l&&i.length>0&&r.jsx("div",{className:n==="grid"?"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6":"space-y-4",children:i.map(h=>r.jsxs(Ye,{className:`group overflow-hidden hover:shadow-lg transition-all duration-200 cursor-pointer ${n==="list"?"flex flex-row":""}`,onClick:()=>a(`/additional-services/${h.id}`),children:[r.jsx("div",{className:`relative overflow-hidden bg-muted ${n==="list"?"w-48 shrink-0":"aspect-[3/2]"}`,children:h.preview_image_url?r.jsx("img",{src:h.preview_image_url,alt:h.name,className:"w-full h-full object-contain group-hover:scale-105 transition-transform duration-300"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center text-muted-foreground",children:r.jsx(Ms,{className:"h-8 w-8"})})}),r.jsxs(tt,{className:`p-4 flex flex-col ${n==="list"?"flex-1":""}`,children:[r.jsx("h3",{className:"font-semibold text-foreground line-clamp-1 mb-1",children:h.name}),h.description&&r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 flex-1",children:Sne(h.description)})]})]},h.id))})]})})},ljt=()=>{const{serviceId:t}=Zc(),e=rs(),{data:n,isLoading:s}=Yt({queryKey:["additional-service",t],queryFn:async()=>{const{data:a,error:o}=await J.from("additional_services").select("*").eq("id",t).eq("is_published",!0).single();if(o)throw o;return a},enabled:!!t});return s?r.jsx(Lr,{title:"Loading...",children:r.jsxs("div",{className:"max-w-4xl mx-auto space-y-6",children:[r.jsx(Ir,{className:"h-8 w-48"}),r.jsx(Ir,{className:"h-64 w-full rounded-lg"}),r.jsx(Ir,{className:"h-24 w-full"})]})}):n?r.jsx(Lr,{title:n.name,children:r.jsxs("div",{className:"max-w-4xl mx-auto space-y-6",children:[r.jsxs(ee,{variant:"ghost",onClick:()=>e("/additional-services"),className:"gap-2",children:[r.jsx(so,{className:"h-4 w-4"}),"Back to Services"]}),r.jsx(Ye,{className:"overflow-hidden",children:r.jsx("div",{className:"relative bg-muted",children:n.preview_image_url?r.jsx("img",{src:n.preview_image_url,alt:n.name,className:"w-full h-auto max-h-[500px] object-contain mx-auto"}):r.jsx("div",{className:"w-full h-64 flex items-center justify-center text-muted-foreground",children:r.jsx(Ms,{className:"h-16 w-16"})})})}),r.jsx(Ye,{children:r.jsxs(tt,{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(zs,{className:"h-4 w-4 mr-1"}),"Published ",yn(new Date(n.publish_date),"MMMM d, yyyy")]})]}),n.description&&r.jsx("div",{className:"prose prose-sm max-w-none text-muted-foreground [&_a]:text-primary [&_a]:underline",dangerouslySetInnerHTML:{__html:n.description}}),r.jsx("div",{className:"pt-4 border-t",children:r.jsxs(ee,{size:"lg",className:"gap-2",onClick:()=>window.open(n.signup_link_url,"_blank"),children:[r.jsx(Fs,{className:"h-5 w-5"}),"Sign Up Now"]})})]})})]})}):r.jsx(Lr,{title:"Not Found",children:r.jsxs("div",{className:"max-w-4xl mx-auto text-center py-12",children:[r.jsx("h2",{className:"text-2xl font-bold text-foreground mb-4",children:"Service Not Found"}),r.jsx("p",{className:"text-muted-foreground mb-6",children:"The service you're looking for doesn't exist or has been removed."}),r.jsxs(ee,{onClick:()=>e("/additional-services"),children:[r.jsx(so,{className:"h-4 w-4 mr-2"}),"Back to Services"]})]})})},$M=[{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 cjt(){const[t,e]=I.useState($M[0].id),n=$M.find(s=>s.id===t)||$M[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(eS,{className:"h-6 w-6 text-primary"})}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold text-foreground",children:"AI Toolkit"}),r.jsx("p",{className:"text-muted-foreground",children:"Powerful AI tools to boost your real estate business"})]})]}),r.jsx("div",{className:"md:hidden",children:r.jsxs(gn,{value:t,onValueChange:e,children:[r.jsx(fn,{className:"w-full",children:r.jsx(xn,{placeholder:"Select a tool"})}),r.jsx(pn,{children:$M.map(s=>r.jsx(Vt,{value:s.id,children:s.name},s.id))})]})}),r.jsx("div",{className:"hidden md:block",children:r.jsx(Ii,{value:t,onValueChange:e,className:"w-full",children:r.jsx(wi,{className:"w-full flex-wrap h-auto gap-1 bg-muted p-1",children:$M.map(s=>r.jsx(ln,{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 o4e="agent-os-onboarding-completed",FL=[{icon:yg,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:kg,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:hm,iconColor:"text-white",bgGradient:"from-emerald-500 via-teal-500 to-cyan-500",title:"Touchpoint Plans",description:"Assign automated touchpoint schedules to your contact groups. Each plan tells you exactly who to reach out to and when—with pre-written scripts to make it easy.",highlights:["Pre-built 12-month plans","Create your own custom plans","Scripts for calls, texts, and emails","Automatic daily action items"]},{icon:Ki,iconColor:"text-white",bgGradient:"from-orange-500 via-amber-500 to-yellow-500",title:"Popbys",description:"Pop-by visits are one of the most powerful ways to stay top-of-mind. Track your gift drop-offs and see who's due for a visit on the map.",highlights:["Track pop-by gift ideas","Set visit frequency by contact type","Log completed pop-bys","Map view for route planning"]},{icon:cc,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"]}],djt=()=>{const[t,e]=I.useState(!1),[n,s]=I.useState(0),[a,o]=I.useState(!1);I.useEffect(()=>{if(!localStorage.getItem(o4e)){const C=setTimeout(()=>e(!0),500);return()=>clearTimeout(C)}},[]);const l=()=>{n{s(n+1),o(!1)},150)):h()},i=()=>{h()},h=()=>{localStorage.setItem(o4e,"true"),e(!1)},p=FL[n],x=p.icon,y=n===FL.length-1,b=j=>{j||h(),e(j)};return r.jsx(Fr,{open:t,onOpenChange:b,children:r.jsxs(Rr,{className:"sm:max-w-lg overflow-hidden p-0 gap-0",children:[r.jsxs("div",{className:`relative bg-gradient-to-br ${p.bgGradient} p-8 pb-12 transition-all duration-500`,children:[r.jsxs("div",{className:"absolute inset-0 overflow-hidden",children:[r.jsx("div",{className:"absolute -top-4 -right-4 w-32 h-32 bg-white/10 rounded-full blur-2xl animate-pulse"}),r.jsx("div",{className:"absolute -bottom-8 -left-8 w-40 h-40 bg-white/10 rounded-full blur-3xl animate-pulse",style:{animationDelay:"1s"}}),r.jsx("div",{className:"absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 w-64 h-64 bg-white/5 rounded-full blur-3xl"})]}),r.jsxs("div",{className:`relative mx-auto flex h-20 w-20 items-center justify-center transition-all duration-300 ${a?"scale-75 opacity-0":"scale-100 opacity-100"}`,children:[r.jsx("div",{className:"absolute inset-0 bg-white/20 rounded-2xl blur-xl"}),r.jsx("div",{className:"relative flex h-20 w-20 items-center justify-center rounded-2xl bg-white/20 backdrop-blur-sm border border-white/30 shadow-2xl",children:r.jsx(x,{className:`h-10 w-10 ${p.iconColor} drop-shadow-lg`})})]}),n===0&&r.jsxs("div",{className:"absolute top-4 right-4 px-3 py-1 rounded-full bg-white/20 backdrop-blur-sm border border-white/30 text-white text-xs font-medium flex items-center gap-1.5",children:[r.jsx(Ms,{className:"h-3 w-3"}),"Beta"]})]}),r.jsxs("div",{className:"p-6 pt-4",children:[r.jsxs(qr,{className:"text-center sm:text-center pb-2",children:[r.jsx($r,{className:`text-2xl font-bold transition-all duration-300 ${a?"translate-y-2 opacity-0":"translate-y-0 opacity-100"}`,children:p.title}),r.jsx(Xn,{className:`text-base pt-2 transition-all duration-300 delay-75 ${a?"translate-y-2 opacity-0":"translate-y-0 opacity-100"}`,children:p.description})]}),p.highlights&&r.jsx("div",{className:`space-y-2.5 py-4 transition-all duration-300 delay-100 ${a?"translate-y-2 opacity-0":"translate-y-0 opacity-100"}`,children:p.highlights.map((j,C)=>r.jsxs("div",{className:"flex items-center gap-3 group",style:{transitionDelay:`${150+C*50}ms`},children:[r.jsx("div",{className:`flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-gradient-to-br ${p.bgGradient} shadow-sm`,children:r.jsx(Ai,{className:"h-3.5 w-3.5 text-white"})}),r.jsx("span",{className:"text-sm text-muted-foreground group-hover:text-foreground transition-colors",children:j})]},C))}),r.jsx("div",{className:"flex justify-center gap-2 py-4",children:FL.map((j,C)=>r.jsx("button",{onClick:()=>{C!==n&&(o(!0),setTimeout(()=>{s(C),o(!1)},150))},className:`h-2 rounded-full transition-all duration-300 ${C===n?"w-8 bg-gradient-to-r "+p.bgGradient:C{const{user:t}=Qr();return Yt({queryKey:["contact-snoozes",t==null?void 0:t.id],queryFn:async()=>{const{data:e,error:n}=await J.from("contact_snoozes").select("*").gte("snoozed_until",new Date().toISOString());if(n)throw n;return e},enabled:!!t})},hjt=()=>{const t=Vr(),{user:e}=Qr();return cr({mutationFn:async({contactId:n,days:s})=>{if(!(e!=null&&e.id))throw new Error("Not authenticated");const a=Kl(new Date,s);await J.from("contact_snoozes").delete().eq("contact_id",n);const{error:o}=await J.from("contact_snoozes").insert({contact_id:n,owner_user_id:e.id,snoozed_until:a.toISOString()});if(o)throw o},onSuccess:()=>{t.invalidateQueries({queryKey:["contact-snoozes"]}),t.invalidateQueries({queryKey:["popby-logs"]}),ma({title:"Touch snoozed!",description:"Contact has been snoozed."})},onError:n=>{ma({title:"Error snoozing contact",description:n.message,variant:"destructive"})}})},fjt=()=>{const t=Vr();return cr({mutationFn:async e=>{const{error:n}=await J.from("contact_snoozes").delete().eq("contact_id",e);if(n)throw n},onSuccess:()=>{t.invalidateQueries({queryKey:["contact-snoozes"]}),ma({title:"Snooze cancelled"})},onError:e=>{ma({title:"Error cancelling snooze",description:e.message,variant:"destructive"})}})},pjt=[{label:"1 week",days:7},{label:"2 weeks",days:14},{label:"1 month",days:30}];function vye({open:t,onOpenChange:e,contactId:n,contactName:s}){const[a,o]=I.useState(null),l=hjt(),i=async()=>{a&&(await l.mutateAsync({contactId:n,days:a}),o(null),e(!1))},h=p=>yn(Kl(new Date,p),"MMM d, yyyy");return r.jsx(Fr,{open:t,onOpenChange:e,children:r.jsxs(Rr,{className:"sm:max-w-md",children:[r.jsxs(qr,{children:[r.jsxs($r,{className:"flex items-center gap-2",children:[r.jsx(Ya,{className:"h-5 w-5"}),"Snooze Touch"]}),r.jsxs(Xn,{children:["Postpone the next scheduled touch for ",s,". Select how long to snooze."]})]}),r.jsx("div",{className:"space-y-3 py-4",children:pjt.map(p=>r.jsxs("button",{type:"button",onClick:()=>o(p.days),className:$t("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(zs,{className:"h-3.5 w-3.5"}),"Until ",h(p.days)]})]},p.days))}),r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(ee,{variant:"outline",onClick:()=>e(!1),children:"Cancel"}),r.jsx(ee,{onClick:i,disabled:!a||l.isPending,children:l.isPending?"Snoozing...":"Snooze Touch"})]})]})})}const mjt={Crown:u1,FileText:La,Users:Bn,Globe:Ux,Star:vs,Phone:bi,MessageSquare:Lo,PenTool:vj,Video:Pa,Gift:Ki};function gjt({actions:t,onMarkComplete:e,onViewScript:n,isLoading:s,buildSmsLink:a,buildEmailLink:o}){const l=rs(),[i,h]=I.useState("name"),[p,x]=I.useState("asc"),[y,b]=I.useState(null),[j,C]=I.useState(""),N=z=>{i===z?x(F=>F==="asc"?"desc":"asc"):(h(z),x("asc"))},A=I.useMemo(()=>[...t].sort((z,F)=>{var H,Z;let q=0;switch(i){case"name":{const G=`${z.contact.first_name} ${z.contact.last_name||""}`.toLowerCase(),te=`${F.contact.first_name} ${F.contact.last_name||""}`.toLowerCase();q=G.localeCompare(te);break}case"relationship_type":q=(z.relationshipTypeName||"").localeCompare(F.relationshipTypeName||"");break;case"action_type":q=(((H=z.actionType)==null?void 0:H.name)||"").localeCompare(((Z=F.actionType)==null?void 0:Z.name)||"");break;case"last_touch":q=(z.monthNumber||0)-(F.monthNumber||0);break}return p==="asc"?q:-q}),[t,i,p]),E=z=>mjt[z||"Phone"]||bi,T=({field:z,children:F})=>r.jsxs(ee,{variant:"ghost",size:"sm",className:"h-8 -ml-3 font-medium",onClick:()=>N(z),children:[F,i===z?p==="asc"?r.jsx(mg,{className:"ml-2 h-4 w-4"}):r.jsx(i1,{className:"ml-2 h-4 w-4"}):r.jsx(zx,{className:"ml-2 h-4 w-4 opacity-50"})]}),L=(z,F,q)=>{b(z),C(`${F} ${q||""}`.trim())};return t.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx("p",{children:"No actions scheduled for today."}),r.jsx("p",{className:"text-sm mt-1",children:"Add contacts and enable touchpoint plans to get started."})]}):r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"border rounded-lg overflow-hidden",children:r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Ar,{className:"bg-muted/50",children:[r.jsx(It,{className:"w-[180px]",children:r.jsx(T,{field:"name",children:"Contact"})}),r.jsx(It,{className:"w-[130px]",children:r.jsx(T,{field:"relationship_type",children:"Type"})}),r.jsx(It,{className:"w-[120px]",children:r.jsx(T,{field:"action_type",children:"Action"})}),r.jsx(It,{className:"w-[130px]",children:"Phone"}),r.jsx(It,{className:"w-[200px]",children:"Quick Actions"})]})}),r.jsx(Vs,{children:A.map((z,F)=>{var ie,le,ye,ne,ge,ae;const q=z.isSpecialDate,H=z.specialDateType,Z=q?H==="birthday"?Qh:pa:E(((ie=z.actionType)==null?void 0:ie.icon)||null),G=z.contact.phone,te=z.contact.email;return r.jsxs(Ar,{className:$t("hover:bg-muted/50 transition-colors",q&&H==="birthday"&&"bg-pink-50/50 dark:bg-pink-950/20",q&&H==="anniversary"&&"bg-purple-50/50 dark:bg-purple-950/20"),children:[r.jsx(Nt,{className:"font-medium",children:r.jsx("div",{children:r.jsxs("button",{onClick:()=>l(`/mission-control/contacts/${z.contact.id}`),className:"truncate max-w-[160px] text-left hover:text-primary hover:underline transition-colors",children:[z.contact.first_name," ",z.contact.last_name]})})}),r.jsx(Nt,{children:z.relationshipTypeName?r.jsx(Ot,{variant:"secondary",className:"text-xs",children:z.relationshipTypeName}):r.jsx("span",{className:"text-muted-foreground text-sm",children:"—"})}),r.jsx(Nt,{children:r.jsx("div",{className:"flex items-center gap-1.5",children:q?r.jsx(Ot,{className:$t("gap-1",H==="birthday"&&"bg-pink-500 hover:bg-pink-600",H==="anniversary"&&"bg-purple-500 hover:bg-purple-600"),children:H==="birthday"?r.jsxs(r.Fragment,{children:[r.jsx(Qh,{className:"h-3 w-3"})," Birthday"]}):r.jsxs(r.Fragment,{children:[r.jsx(pa,{className:"h-3 w-3"})," Anniversary"]})}):r.jsxs(Ot,{variant:"outline",className:"gap-1",children:[r.jsx(Z,{className:"h-3 w-3"}),(le=z.actionType)==null?void 0:le.name]})})}),r.jsx(Nt,{children:G?r.jsx("span",{className:"text-sm font-mono",children:z.contact.phone}):r.jsx("span",{className:"text-muted-foreground text-sm",children:"—"})}),r.jsx(Nt,{children:r.jsxs("div",{className:"flex items-center gap-1",children:[G&&r.jsx("a",{href:`tel:${z.contact.phone}`,className:"p-1.5 rounded bg-primary/10 hover:bg-primary/20 text-primary transition-colors",title:"Call",children:r.jsx(bi,{className:"h-3.5 w-3.5"})}),G&&r.jsx("a",{href:a(z.contact.phone,(ye=z.script)==null?void 0:ye.script_body,z.contact),className:"p-1.5 rounded bg-emerald-500/10 hover:bg-emerald-500/20 text-emerald-600 dark:text-emerald-400 transition-colors",title:"Text",children:r.jsx(Lo,{className:"h-3.5 w-3.5"})}),te&&r.jsx("a",{href:o(z.contact.email,(ne=z.script)==null?void 0:ne.script_body,(ge=z.script)==null?void 0:ge.email_subject,(ae=z.actionType)==null?void 0:ae.name,z.contact),className:"p-1.5 rounded bg-sky-500/10 hover:bg-sky-500/20 text-sky-600 dark:text-sky-400 transition-colors",title:"Email",children:r.jsx(da,{className:"h-3.5 w-3.5"})}),r.jsx(ee,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-foreground",onClick:()=>L(z.contact.id,z.contact.first_name,z.contact.last_name),title:"Snooze",children:r.jsx(Yf,{className:"h-3.5 w-3.5"})}),r.jsxs(ee,{variant:"default",size:"sm",className:"h-7 px-2 text-xs ml-1",onClick:()=>{var he;return e(z.contact.id,z.actionType.id,(he=z.script)==null?void 0:he.id)},disabled:s,children:[r.jsx(Xi,{className:"h-3.5 w-3.5 mr-1"}),"Done"]})]})})]},`${z.contact.id}-${F}`)})})]})}),r.jsx(vye,{open:!!y,onOpenChange:z=>!z&&b(null),contactId:y||"",contactName:j})]})}const l4e={Crown:u1,FileText:La,Users:Bn,Globe:Ux,Star:vs,Phone:bi,MessageSquare:Lo,PenTool:vj,Video:Pa,Gift:Ki},xjt={"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 yjt(){const t=rs(),{user:e}=Qr(),{data:n}=Sm(),{data:s}=r8e(),{data:a}=op(),{data:o}=yxe(),{data:l}=c8e(),i=Mft(),h=l8e(),p=Sft(90),x=a8e(),[y,b]=I.useState(null),[j,C]=I.useState(null),[N,A]=I.useState(!1),[E,T]=I.useState(""),[L,z]=I.useState(!1),[F,q]=I.useState(""),[H,Z]=I.useState(xte()),[G,te]=I.useState("cards"),ie=()=>{const je=parseInt(F,10);if(isNaN(je)||je<1){ma({title:"Invalid goal",description:"Please enter a number greater than 0",variant:"destructive"});return}Z(je),o8e(je),z(!1),ma({title:"Goal updated",description:`Weekly touch goal set to ${je}`})},le=()=>{q(H.toString()),z(!0)};I.useEffect(()=>{(async()=>{if(!(e!=null&&e.id))return;const{data:et}=await J.from("profiles").select("name").eq("id",e.id).single();et!=null&&et.name&&T(et.name.split(" ")[0])})()},[e==null?void 0:e.id]),I.useEffect(()=>{i.mutate()},[]);const ye=uf(new Date),ne=Kl(ye,7),ge=je=>{if(!je)return null;const et=new Date(je);return new Date(ye.getFullYear(),et.getMonth(),et.getDate())},ae=(a==null?void 0:a.filter(je=>{const et=ge(je.birthday),Te=ge(je.home_anniversary);return et&&Ql(et,ye)||Te&&Ql(Te,ye)}))||[],he=(a==null?void 0:a.filter(je=>{if(!je.birthday&&!je.home_anniversary)return!1;const et=Te=>{if(!Te)return!1;const Ze=ge(Te);return Ze?fte(Ze,ye)&&fse(Ze,ne):!1};return et(je.birthday)||et(je.home_anniversary)}).slice(0,5))||[],ue=ae.map(je=>{var pe,yt,rt;const et=ge(je.birthday),Te=et&&Ql(et,ye),Ze=(o==null?void 0:o.find(at=>at.name==="Call"))||(o==null?void 0:o[0]);return{contact:je,actionType:Ze||{id:"special-date",name:Te?"Birthday Call":"Anniversary Call",icon:Te?"Cake":"Home",color:Te?"#EC4899":"#8B5CF6",description:Te?"Wish them happy birthday!":"Celebrate their home anniversary!",active:!0,sort_order:0,created_at:"",updated_at:""},planName:Te?"🎂 Birthday Today!":"🏠 Home Anniversary!",relationshipTypeName:((rt=(yt=(pe=je.tags)==null?void 0:pe[0])==null?void 0:yt.relationship_type)==null?void 0:rt.name)||"",monthNumber:0,isSpecialDate:!0,specialDateType:Te?"birthday":"anniversary"}}),Ae=l!==void 0?l||[]:(a==null?void 0:a.slice(0,5).map((je,et)=>{var Ze,pe,yt;const Te=o==null?void 0:o[et%((o==null?void 0:o.length)||1)];return Te?{contact:je,actionType:Te,planName:"Quick Touch",relationshipTypeName:((yt=(pe=(Ze=je.tags)==null?void 0:Ze[0])==null?void 0:pe.relationship_type)==null?void 0:yt.name)||"",monthNumber:0}:null}).filter(Boolean))||[],Ce=[...ue,...Ae],be=async(je,et,Te)=>{await x.mutateAsync({contactId:je,actionTypeId:et,scriptUsedId:Te}),A(!1),C(null)},me=je=>{je.script?(C(je),A(!0)):be(je.contact.id,je.actionType.id)},Le=je=>l4e[je||"Phone"]||bi,Ne=je=>l4e[je||"Users"]||Bn,Be=(je,et)=>je.replace(/\{\{FirstName\}\}/g,et.first_name).replace(/\{\{LastName\}\}/g,et.last_name||"").replace(/\{\{AgentName\}\}/g,E||"there"),Ee=(je,et)=>({Call:`Thinking of you, ${et}!`,Text:`Quick hello, ${et}`,Email:`Checking in, ${et}`,"Handwritten Note":`A note for ${et}`,Video:`Video message for ${et}`,Gift:`Something special for you, ${et}`})[je]||`Hello ${et}!`,Ue=(je,et,Te)=>{const Ze=`sms:${je}`;if(et&&Te){const pe=Be(et,Te);return`${Ze}?body=${encodeURIComponent(pe)}`}return Ze},Re=(je,et,Te,Ze,pe)=>{const yt=`mailto:${je}`,rt=[];if(pe){const at=Te||Ee(Ze||"Email",pe.first_name);if(rt.push(`subject=${encodeURIComponent(at)}`),et){const Me=Be(et,pe);rt.push(`body=${encodeURIComponent(Me)}`)}}return rt.length>0?`${yt}?${rt.join("&")}`:yt};return r.jsxs(Lr,{title:"Mission Control",description:"Your relationship-first contact system",children:[r.jsxs("div",{className:"space-y-6 overflow-x-hidden",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("h1",{className:"text-2xl font-bold",children:"Mission Control"}),r.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wide px-1.5 py-0.5 rounded border border-amber-500 text-amber-600 dark:text-amber-400 bg-amber-500/10",children:"Beta"})]}),r.jsxs("section",{children:[r.jsx("h2",{className:"text-xl font-semibold mb-4",children:"Your Sphere"}),r.jsx("div",{className:"flex flex-wrap gap-3",children:n==null?void 0:n.filter(je=>je.active).map(je=>{const et=Ne(je.icon),Te=(s==null?void 0:s[je.id])||0,Ze=y===je.id,pe=xjt[je.name]||"bg-secondary text-secondary-foreground";return r.jsxs("button",{onClick:()=>{Ze?(b(null),t("/mission-control/contacts")):(b(je.id),t(`/mission-control/contacts?type=${je.id}`))},className:` flex items-center gap-2 px-4 py-3 rounded-lg border transition-all ${Ze?pe:"bg-card hover:bg-accent"} `,children:[r.jsx(et,{className:"h-5 w-5"}),r.jsxs("div",{className:"text-left",children:[r.jsx("div",{className:"font-medium",children:je.name}),r.jsxs("div",{className:`text-sm ${Ze?"opacity-90":"text-muted-foreground"}`,children:[Te," Contacts"]})]})]},je.id)})})]}),r.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3",children:[r.jsxs(ee,{onClick:()=>t("/mission-control/video/record"),className:"w-full bg-gradient-to-r from-primary to-primary/80",children:[r.jsx(Ad,{className:"h-4 w-4 mr-1"}),"Quick Video"]}),r.jsxs(ee,{onClick:()=>t("/mission-control/contacts"),className:"w-full",variant:"outline",children:["View Contacts",r.jsx(Vi,{className:"h-4 w-4 ml-1"})]}),r.jsx(ee,{variant:"outline",onClick:()=>t("/mission-control/video-library"),className:"w-full",children:"Video Library"}),r.jsx(ee,{variant:"outline",onClick:()=>t("/mission-control/plans"),className:"w-full",children:"Manage Plans"})]}),r.jsxs("section",{children:[r.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[r.jsx("h2",{className:"text-xl font-semibold",children:"Today in Your InnerCircle"}),l!==void 0&&r.jsxs(Ot,{variant:"outline",className:"gap-1",children:[r.jsx(Ms,{className:"h-3 w-3"}),"Plan-based"]}),r.jsxs("div",{className:"ml-auto flex items-center gap-1 border rounded-lg p-0.5",children:[r.jsx(ee,{variant:G==="cards"?"secondary":"ghost",size:"sm",className:"h-7 px-2",onClick:()=>te("cards"),title:"Card view",children:r.jsx(pm,{className:"h-4 w-4"})}),r.jsx(ee,{variant:G==="table"?"secondary":"ghost",size:"sm",className:"h-7 px-2",onClick:()=>te("table"),title:"Table view",children:r.jsx(Kf,{className:"h-4 w-4"})})]})]}),r.jsx(Ye,{children:r.jsx(tt,{className:"p-4",children:Ce.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx("p",{children:"No actions scheduled for today."}),r.jsx("p",{className:"text-sm mt-1",children:"Add contacts and enable touchpoint plans to get started."}),r.jsx(ee,{variant:"outline",className:"mt-4",onClick:()=>t("/mission-control/plans"),children:"Manage Plans"})]}):G==="table"?r.jsx(gjt,{actions:Ce,onMarkComplete:be,onViewScript:me,isLoading:x.isPending,buildSmsLink:Ue,buildEmailLink:Re}):r.jsxs("div",{className:"flex gap-3 overflow-x-auto pb-2",children:[Ce.map((je,et)=>{var ft,qe,Oe,Qe,nt,gt,mt;const Te=je.isSpecialDate,Ze=je.specialDateType,pe=Te?Ze==="birthday"?Qh:pa:Le(((ft=je.actionType)==null?void 0:ft.icon)||null),yt=je.contact.phone,rt=je.contact.email,at=Te?Ze==="birthday"?"#EC4899":"#8B5CF6":((qe=je.actionType)==null?void 0:qe.color)||"#3B82F6",Me=Te?Ze==="birthday"?"🎂 Birthday Today!":"🏠 Home Anniversary!":(Oe=je.actionType)==null?void 0:Oe.name;return r.jsxs("div",{className:`flex-shrink-0 w-[260px] border rounded-lg overflow-hidden ${Te?"ring-2 ring-offset-2":""}`,style:Te?{"--tw-ring-color":at}:void 0,children:[r.jsxs("div",{className:"p-3 text-white flex items-center gap-2",style:{backgroundColor:at},children:[r.jsx(pe,{className:"h-4 w-4"}),r.jsx("span",{className:"font-medium text-sm",children:Me})]}),r.jsxs("div",{className:"p-3 space-y-2",children:[r.jsxs("button",{onClick:()=>t(`/mission-control/contacts/${je.contact.id}`),className:"font-medium text-sm hover:text-primary hover:underline transition-colors text-left",children:[je.contact.first_name," ",je.contact.last_name]}),r.jsxs("div",{className:"flex gap-1.5",children:[yt&&r.jsxs(r.Fragment,{children:[r.jsxs("a",{href:`tel:${je.contact.phone}`,className:"flex-1 flex items-center justify-center gap-1 px-2 py-1.5 bg-primary/10 hover:bg-primary/20 text-primary rounded text-xs font-medium transition-colors",title:"Call",children:[r.jsx(bi,{className:"h-3 w-3"}),"Call"]}),r.jsxs("a",{href:Ue(je.contact.phone,(Qe=je.script)==null?void 0:Qe.script_body,je.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(Lo,{className:"h-3 w-3"}),"Text"]})]}),rt&&r.jsxs("a",{href:Re(je.contact.email,(nt=je.script)==null?void 0:nt.script_body,(gt=je.script)==null?void 0:gt.email_subject,(mt=je.actionType)==null?void 0:mt.name,je.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(da,{className:"h-3 w-3"}),"Email"]})]}),!yt&&!rt&&r.jsx("p",{className:"text-xs text-muted-foreground italic",children:"No contact info"}),r.jsxs("div",{className:"flex gap-1 flex-wrap",children:[je.relationshipTypeName&&r.jsx(Ot,{variant:"secondary",className:"text-xs",children:je.relationshipTypeName}),je.monthNumber>0&&r.jsxs(Ot,{variant:"outline",className:"text-xs",children:["Month ",je.monthNumber]})]}),je.script&&r.jsx(ee,{size:"sm",variant:"outline",className:"w-full",onClick:()=>me(je),children:"View Script"}),r.jsx(ee,{size:"sm",className:"w-full",onClick:()=>{var Mt;return be(je.contact.id,je.actionType.id,(Mt=je.script)==null?void 0:Mt.id)},disabled:x.isPending,children:"Mark Complete"})]})]},je.contact.id+et)}),r.jsx("div",{className:"flex-shrink-0 w-[100px] border rounded-lg flex items-center justify-center",children:r.jsxs(wh,{children:[r.jsx(jh,{asChild:!0,children:r.jsxs(ee,{variant:"ghost",className:"h-full w-full",children:[r.jsx(em,{className:"h-5 w-5 mr-2"}),"More"]})}),r.jsx(Wu,{children:r.jsx(di,{onClick:()=>t("/mission-control/contacts"),children:"View all contacts"})})]})})]})})})]}),r.jsxs("div",{className:"grid md:grid-cols-3 gap-6",children:[r.jsxs(Ye,{className:"md:col-span-2",children:[r.jsx(Gt,{className:"pb-2",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Zt,{className:"text-lg",children:"Momentum"}),r.jsxs(Fr,{open:L,onOpenChange:z,children:[r.jsx(zo,{asChild:!0,children:r.jsx("button",{onClick:le,className:"p-0.5 rounded hover:bg-muted transition-colors","aria-label":"Edit weekly goal",children:r.jsx(fd,{className:"h-4 w-4 text-muted-foreground hover:text-primary"})})}),r.jsxs(Rr,{className:"sm:max-w-[360px]",children:[r.jsxs(qr,{children:[r.jsx($r,{children:"Set Weekly Goal"}),r.jsx(Xn,{children:"How many touches do you want to complete each week?"})]}),r.jsxs("div",{className:"space-y-4 pt-2",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"weekly-goal-ic",children:"Weekly touch goal"}),r.jsx(dt,{id:"weekly-goal-ic",type:"number",min:"1",value:F,onChange:je=>q(je.target.value),placeholder:"20",onKeyDown:je=>{je.key==="Enter"&&ie()}})]}),r.jsx(ee,{onClick:ie,className:"w-full",children:"Save Goal"})]})]})]})]})}),r.jsxs(tt,{className:"space-y-4",children:[r.jsx(Kc,{value:Math.min(h.actionsThisWeek/H*100,100),className:"h-3 w-full max-w-full"}),r.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[r.jsx(Jh,{className:"h-5 w-5 text-orange-500"}),r.jsxs("span",{className:"font-medium",children:[h.actionsThisWeek," / ",H]}),r.jsx("span",{className:"text-muted-foreground",children:"Actions Completed This Week"})]}),h.streak>0&&r.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[r.jsx("span",{className:"text-lg",children:"🔥"}),r.jsx("span",{className:"font-medium",children:"Great Job!"}),r.jsxs("span",{className:"text-muted-foreground",children:["Keep Your Streak Going! (",h.streak," days)"]})]})]})]}),r.jsxs(Ye,{children:[r.jsx(Gt,{className:"pb-2",children:r.jsx(Zt,{className:"text-lg",children:"Upcoming Reminders"})}),r.jsxs(tt,{className:"space-y-3",children:[he.length>0?he.map(je=>{const et=je.birthday,Te=je.home_anniversary;return r.jsxs("div",{className:"flex items-start gap-2 text-sm",children:[et?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:[je.first_name,"'s"]}),r.jsxs("span",{className:"text-muted-foreground",children:[" ",et?"Birthday":"Home Anniversary"]}),r.jsxs("div",{className:"text-xs text-muted-foreground",children:[et&&je.birthday&&yn(new Date(je.birthday),"MMM d"),Te&&je.home_anniversary&&yn(new Date(je.home_anniversary),"MMM d")]})]})]},je.id)}):r.jsx("p",{className:"text-sm text-muted-foreground",children:"No upcoming reminders"}),p.count>0&&r.jsxs("button",{onClick:()=>t("/mission-control/contacts?filter=not-touched-90"),className:"flex items-start gap-2 text-sm pt-2 border-t w-full text-left hover:bg-accent/50 -mx-4 px-4 py-2 rounded-md transition-colors",children:[r.jsx(Ya,{className:"h-4 w-4 text-orange-500 mt-0.5"}),r.jsxs("div",{children:[r.jsxs("span",{className:"font-medium text-orange-600 dark:text-orange-400",children:[p.count," Contact",p.count!==1?"s":""]}),r.jsx("span",{className:"text-muted-foreground",children:" Not Reached in 90+ Days"})]}),r.jsx(Vi,{className:"h-4 w-4 text-muted-foreground ml-auto mt-0.5"})]})]})]}),r.jsx(k8e,{})]})]}),r.jsx(Fr,{open:N,onOpenChange:A,children:r.jsxs(Rr,{className:"max-w-md",children:[r.jsx(qr,{children:r.jsx($r,{className:"flex items-center gap-2",children:j&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:j.actionType.color||"#3B82F6"}}),j.actionType.name," Script"]})})}),j&&j.script&&r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"text-sm text-muted-foreground",children:["For: ",r.jsxs("span",{className:"font-medium text-foreground",children:[j.contact.first_name," ",j.contact.last_name]})]}),r.jsx("div",{className:"bg-muted p-4 rounded-lg",children:r.jsx("p",{className:"whitespace-pre-wrap",children:Be(j.script.script_body,j.contact)})}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(ee,{variant:"outline",className:"flex-1",onClick:()=>A(!1),children:"Close"}),r.jsx(ee,{className:"flex-1",onClick:()=>{var je;return be(j.contact.id,j.actionType.id,(je=j.script)==null?void 0:je.id)},disabled:x.isPending,children:"Mark Complete"})]})]})]})}),r.jsx(djt,{})]})}const xze=()=>{const{user:t}=Qr();return Yt({queryKey:["popby-items",t==null?void 0:t.id],queryFn:async()=>{const{data:e,error:n}=await J.from("popby_items").select("*").or(`owner_user_id.is.null,owner_user_id.eq.${t==null?void 0:t.id}`).eq("is_active",!0).order("name");if(n)throw n;return e},enabled:!!t})},Vse=t=>{const{user:e}=Qr();return Yt({queryKey:["popby-logs",e==null?void 0:e.id,t],queryFn:async()=>{let n=J.from("popby_logs").select("*").order("completed_at",{ascending:!1});if(t){const o=new Date;o.setDate(o.getDate()-t),n=n.gte("completed_at",o.toISOString())}const{data:s,error:a}=await n;if(a)throw a;return s},enabled:!!e})},_ye=()=>{const{user:t}=Qr();return Yt({queryKey:["relationship-type-popby-defaults",t==null?void 0:t.id],queryFn:async()=>{const{data:e,error:n}=await J.from("relationship_type_popby_defaults").select("*");if(n)throw n;return e},enabled:!!t})},yze=()=>{const{user:t}=Qr();return Yt({queryKey:["contact-popby-settings",t==null?void 0:t.id],queryFn:async()=>{const{data:e,error:n}=await J.from("contact_popby_settings").select("*");if(n)throw n;return e},enabled:!!t})},vze=()=>{const{data:t}=op(),{data:e}=Sm(),{data:n}=Vse(),{data:s}=yze(),{data:a}=_ye(),o=new Map;n==null||n.forEach(x=>{const y=o.get(x.contact_id);(!y||new Date(x.completed_at)>new Date(y))&&o.set(x.contact_id,x.completed_at)});const l=new Map;a==null||a.forEach(x=>l.set(x.relationship_type_id,x.frequency_days));const i=new Map;s==null||s.filter(x=>x.is_active).forEach(x=>{i.set(x.contact_id,x.frequency_days)});const h=uf(new Date);return(t||[]).map(x=>{let y=90;if(i.has(x.id))y=i.get(x.id);else if(x.tags&&x.tags.length>0){const A=x.tags.map(E=>l.get(E.relationship_type_id)).filter(E=>E!==void 0);A.length>0&&(y=Math.min(...A))}const b=o.get(x.id)||null,j=b?qj(h,uf(new Date(b))):null,C=j===null||j>=y,N=C&&j!==null?j-y:0;return{...x,lastPopby:b,daysSinceLastPopby:j,frequencyDays:y,isDue:C,daysOverdue:N}}).sort((x,y)=>y.daysOverdue-x.daysOverdue)},_ze=()=>vze().filter(e=>e.isDue),vjt=()=>{const t=Vr(),{user:e}=Qr();return cr({mutationFn:async n=>{const{error:s}=await J.from("popby_items").insert({...n,owner_user_id:e==null?void 0:e.id});if(s)throw s},onSuccess:()=>{t.invalidateQueries({queryKey:["popby-items"]}),ma({title:"Popby item created!"})},onError:n=>{ma({title:"Error creating popby item",description:n.message,variant:"destructive"})}})},bze=()=>{const t=Vr(),{user:e}=Qr();return cr({mutationFn:async n=>{const{error:s}=await J.from("popby_logs").insert({...n,owner_user_id:e==null?void 0:e.id});if(s)throw s},onSuccess:()=>{t.invalidateQueries({queryKey:["popby-logs"]}),ma({title:"Popby logged!"})},onError:n=>{ma({title:"Error logging popby",description:n.message,variant:"destructive"})}})},_jt=()=>{const t=Vr(),{user:e}=Qr();return cr({mutationFn:async n=>{const{error:s}=await J.from("relationship_type_popby_defaults").upsert({...n,owner_user_id:e==null?void 0:e.id},{onConflict:"relationship_type_id,owner_user_id"});if(s)throw s},onSuccess:()=>{t.invalidateQueries({queryKey:["relationship-type-popby-defaults"]}),ma({title:"Frequency updated!"})},onError:n=>{ma({title:"Error updating frequency",description:n.message,variant:"destructive"})}})},bjt=()=>{const{data:t}=Vse(30),e=_ze(),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 wjt(){const{user:t}=Qr();return Yt({queryKey:["contact-touch-logs",t==null?void 0:t.id],queryFn:async()=>{const{data:e,error:n}=await J.from("contact_touch_logs").select("*").order("completed_at",{ascending:!1});if(n)throw n;return e},enabled:!!t})}function wze(t){const{data:e}=wjt(),{data:n}=yze(),{data:s}=_ye(),{data:a}=ujt();return I.useMemo(()=>{const o=a==null?void 0:a.find(A=>A.contact_id===t.id),l=o?new Date(o.snoozed_until):null,i=uf(new Date);if(l&&!fse(l,i))return{nextTouchDate:l,daysUntil:qj(l,i),status:"snoozed",frequencyDays:90,lastTouchDate:null,snoozedUntil:l};const p=((e==null?void 0:e.filter(A=>A.contact_id===t.id))||[]).sort((A,E)=>new Date(E.completed_at).getTime()-new Date(A.completed_at).getTime())[0],x=p?new Date(p.completed_at):null;let y=90;const b=n==null?void 0:n.find(A=>A.contact_id===t.id&&A.is_active);if(b)y=b.frequency_days;else if(t.tags&&t.tags.length>0){const A=t.tags.map(E=>{const T=s==null?void 0:s.find(L=>L.relationship_type_id===E.relationship_type_id);return T==null?void 0:T.frequency_days}).filter(E=>E!==void 0);A.length>0&&(y=Math.min(...A))}if(!x)return{nextTouchDate:null,daysUntil:null,status:"never-touched",frequencyDays:y,lastTouchDate:null,snoozedUntil:null};const j=Kl(uf(x),y),C=qj(j,i);let N;return C<0?N="overdue":C<=7?N="due-soon":N="on-track",{nextTouchDate:j,daysUntil:C,status:N,frequencyDays:y,lastTouchDate:x,snoozedUntil:null}},[t,e,n,s,a])}function afe({contact:t}){const e=wze(t),s=(()=>{switch(e.status){case"overdue":return{variant:"destructive",icon:Il,text:`${Math.abs(e.daysUntil)} days overdue`,className:""};case"due-soon":return{variant:"secondary",icon:Ya,text:e.daysUntil===0?"Due today":`Due in ${e.daysUntil} days`,className:"bg-amber-100 text-amber-800 dark:bg-amber-900/30 dark:text-amber-400"};case"on-track":return{variant:"secondary",icon:Xi,text:`Next touch in ${e.daysUntil} days`,className:"bg-emerald-100 text-emerald-800 dark:bg-emerald-900/30 dark:text-emerald-400"};case"snoozed":return{variant:"secondary",icon:Yf,text:`Snoozed until ${yn(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:zs,text:"Never touched",className:"border-dashed"}}})(),a=s.icon;return r.jsxs(Ot,{variant:s.variant,className:$t("gap-1",s.className),children:[r.jsx(a,{className:"h-3 w-3"}),s.text]})}function jjt({contact:t,onLogTouch:e,onSnooze:n}){const s=wze(t),a=fjt(),[o,l]=I.useState(!1),i=()=>{switch(s.status){case"overdue":return"text-destructive";case"due-soon":return"text-amber-600 dark:text-amber-400";case"on-track":return"text-emerald-600 dark:text-emerald-400";case"snoozed":return"text-slate-600 dark:text-slate-400";case"never-touched":return"text-muted-foreground"}},h=()=>{switch(s.status){case"overdue":return r.jsx(Il,{className:"h-5 w-5 text-destructive"});case"due-soon":return r.jsx(Ya,{className:"h-5 w-5 text-amber-600 dark:text-amber-400"});case"on-track":return r.jsx(Xi,{className:"h-5 w-5 text-emerald-600 dark:text-emerald-400"});case"snoozed":return r.jsx(Yf,{className:"h-5 w-5 text-slate-600 dark:text-slate-400"});case"never-touched":return r.jsx(zs,{className:"h-5 w-5 text-muted-foreground"})}},p=()=>{switch(s.status){case"overdue":return`${Math.abs(s.daysUntil)} days overdue`;case"due-soon":return s.daysUntil===0?"Due today!":`Due in ${s.daysUntil} days`;case"on-track":return`On track - ${s.daysUntil} days remaining`;case"snoozed":return`Snoozed for ${s.daysUntil} more days`;case"never-touched":return"No touches logged yet"}},x=async()=>{await a.mutateAsync(t.id)};return r.jsxs(r.Fragment,{children:[r.jsxs(Ye,{children:[r.jsx(Gt,{className:"pb-2",children:r.jsxs(Zt,{className:"text-sm font-medium flex items-center gap-2",children:[r.jsx(zs,{className:"h-4 w-4"}),"Next Touch"]})}),r.jsxs(tt,{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[h(),r.jsx("span",{className:$t("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:"})," ",yn(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:"})," ",yn(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:"})," ",yn(s.lastTouchDate,"MMM d, yyyy")]}),s.status!=="snoozed"&&r.jsxs("div",{className:"text-xs text-muted-foreground border-t pt-2",children:["Touch frequency: Every ",s.frequencyDays," days"]}),s.status==="snoozed"&&r.jsxs("div",{className:"flex gap-2 pt-1",children:[r.jsxs(ee,{size:"sm",variant:"outline",className:"flex-1",onClick:x,disabled:a.isPending,children:[r.jsx(_s,{className:"h-4 w-4 mr-1"}),"Cancel Snooze"]}),e&&r.jsx(ee,{size:"sm",className:"flex-1",onClick:e,children:"Log Touch"})]}),s.status!=="snoozed"&&r.jsxs("div",{className:"flex gap-2 pt-1",children:[r.jsxs(ee,{size:"sm",variant:"outline",className:"flex-1",onClick:()=>l(!0),children:[r.jsx(Yf,{className:"h-4 w-4 mr-1"}),"Snooze"]}),(s.status==="overdue"||s.status==="due-soon"||s.status==="never-touched")&&e&&r.jsx(ee,{size:"sm",className:"flex-1",variant:s.status==="overdue"?"default":"outline",onClick:e,children:"Log Touch"})]})]})]}),r.jsx(vye,{open:o,onOpenChange:l,contactId:t.id,contactName:`${t.first_name} ${t.last_name||""}`.trim()})]})}const Pce=768;function f3(){const[t,e]=I.useState(void 0);return I.useEffect(()=>{const n=window.matchMedia(`(max-width: ${Pce-1}px)`),s=()=>{e(window.innerWidthn.removeEventListener("change",s)},[]),!!t}const kjt={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"}},Njt={sm:{dot:"h-2 w-2",text:"text-xs",badge:"px-1.5 py-0.5 gap-1"},md:{dot:"h-2.5 w-2.5",text:"text-sm",badge:"px-2 py-1 gap-1.5"},lg:{dot:"h-3 w-3",text:"text-base",badge:"px-3 py-1.5 gap-2"}};function Lce({score:t,showScore:e=!1,showTooltip:n=!0,size:s="sm",className:a}){const o=kjt[t.status],l=Njt[s],i=r.jsxs("div",{className:$t("inline-flex items-center rounded-full font-medium",o.bgLightClass,o.textClass,l.badge,l.text,a),children:[r.jsx("span",{className:$t("rounded-full",o.bgClass,l.dot)}),e?r.jsx("span",{children:t.score}):r.jsx("span",{children:o.label})]});return n?r.jsx(mI,{children:r.jsxs(Sg,{children:[r.jsx(Cg,{asChild:!0,children:i}),r.jsx(xm,{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:$t("font-bold",o.textClass),children:[t.score,"/100"]})]}),r.jsx(Kc,{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 Sjt=[{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}],Cjt=({open:t,onOpenChange:e,relationshipTypes:n,onSuccess:s})=>{const{user:a}=Qr(),{toast:o}=fi(),l=I.useRef(null),[i,h]=I.useState("upload"),[p,x]=I.useState([]),[y,b]=I.useState([]),[j,C]=I.useState({}),[N,A]=I.useState([]),[E,T]=I.useState([]),[L,z]=I.useState(!1),[F,q]=I.useState(null),H=()=>{h("upload"),x([]),b([]),C({}),A([]),T([]),q(null),l.current&&(l.current.value="")},Z=()=>{H(),e(!1)},G=he=>{const ue=he.split(` `).map(be=>be.trim()).filter(be=>be);if(ue.length===0)return{headers:[],data:[]};const _e=be=>{const me=[];let Le="",Ne=!1;for(let Be=0;Be{var Ae;const ue=(Ae=he.target.files)==null?void 0:Ae[0];if(!ue)return;const _e=new FileReader;_e.onload=Ce=>{var Be;const be=(Be=Ce.target)==null?void 0:Be.result,{headers:me,data:Le}=G(be);if(me.length===0){o({title:"No data found",description:"The CSV file appears to be empty.",variant:"destructive"});return}x(me),b(Le);const Ne={};me.forEach(Ee=>{const Ue=Ee.toLowerCase().replace(/[_\s-]/g,"");Ue.includes("firstname")||Ue==="first"?Ne.first_name=Ee:Ue.includes("lastname")||Ue==="last"?Ne.last_name=Ee:Ue.includes("email")?Ne.email=Ee:Ue.includes("phone")||Ue.includes("mobile")||Ue.includes("cell")?Ne.phone=Ee:Ue.includes("address")||Ue.includes("street")?Ne.address=Ee:Ue==="city"?Ne.city=Ee:Ue==="state"||Ue==="province"?Ne.state=Ee:Ue==="zip"||Ue==="zipcode"||Ue==="postalcode"?Ne.zip=Ee:Ue.includes("spouse")&&Ue.includes("email")?Ne.spouse_email=Ee:Ue.includes("spouse")||Ue.includes("partner")?Ne.spouse_name=Ee:Ue.includes("company")||Ue.includes("organization")||Ue.includes("business")?Ne.company_name=Ee:Ue.includes("jobtitle")||Ue.includes("title")||Ue.includes("position")?Ne.job_title=Ee:Ue.includes("birthday")||Ue.includes("dob")||Ue.includes("birthdate")?Ne.birthday=Ee:Ue.includes("anniversary")||Ue.includes("homeanniversary")?Ne.home_anniversary=Ee:(Ue.includes("notes")||Ue.includes("comment"))&&(Ne.notes=Ee)}),C(Ne),h("mapping")},_e.readAsText(ue)},ie=(he,ue)=>{C(_e=>{if(ue==="none"){const{[he]:Ae,...Ce}=_e;return Ce}return{..._e,[he]:ue}})},le=he=>{A(ue=>ue.includes(he)?ue.filter(_e=>_e!==he):[...ue,he])},ye=()=>{const he=y.map(ue=>{const _e=be=>{const me=j[be];if(!me)return"";const Le=p.indexOf(me);return Le>=0?(ue[Le]||"").trim():""},Ae=_e("first_name"),Ce=Ae.length>0;return{first_name:Ae,last_name:_e("last_name"),email:_e("email"),phone:_e("phone"),address:_e("address"),city:_e("city"),state:_e("state"),zip:_e("zip"),spouse_name:_e("spouse_name"),spouse_email:_e("spouse_email"),company_name:_e("company_name"),job_title:_e("job_title"),birthday:_e("birthday"),home_anniversary:_e("home_anniversary"),notes:_e("notes"),isValid:Ce,error:Ce?void 0:"First name is required"}});T(he),h("preview")},ne=async()=>{if(!(a!=null&&a.id))return;const he=E.filter(Ce=>Ce.isValid);if(he.length===0){o({title:"No valid contacts",description:"There are no valid contacts to import.",variant:"destructive"});return}z(!0);let ue=0,_e=0,Ae=0;try{for(const Ce of he)try{let be=null;if(Ce.email){const{data:Le}=await J.from("innercircle_contacts").select("id").eq("owner_user_id",a.id).eq("email",Ce.email).maybeSingle();be=Le}if(!be&&Ce.phone){const{data:Le}=await J.from("innercircle_contacts").select("id").eq("owner_user_id",a.id).eq("phone",Ce.phone).maybeSingle();be=Le}const me={owner_user_id:a.id,first_name:Ce.first_name,last_name:Ce.last_name||null,email:Ce.email||null,phone:Ce.phone||null,address:Ce.address||null,city:Ce.city||null,state:Ce.state||null,zip:Ce.zip||null,spouse_name:Ce.spouse_name||null,spouse_email:Ce.spouse_email||null,company_name:Ce.company_name||null,job_title:Ce.job_title||null,birthday:Ce.birthday||null,home_anniversary:Ce.home_anniversary||null,notes:Ce.notes||null};if(be)await J.from("innercircle_contacts").update(me).eq("id",be.id),_e++;else{const{data:Le}=await J.from("innercircle_contacts").insert(me).select("id").single();Le&&N.length>0&&await J.from("innercircle_contact_tags").insert(N.map(Ne=>({contact_id:Le.id,relationship_type_id:Ne}))),ue++}}catch(be){console.error("Error importing contact:",be),Ae++}q({created:ue,updated:_e,failed:Ae}),h("result"),(ue>0||_e>0)&&s(),o({title:"Import Complete",description:`${ue} created, ${_e} updated${Ae>0?`, ${Ae} failed`:""}.`})}catch(Ce){console.error("Import error:",Ce),o({title:"Import Failed",description:Ce.message||"Failed to import contacts",variant:"destructive"})}finally{z(!1)}},ge=E.filter(he=>he.isValid).length,ae=E.filter(he=>!he.isValid).length;return r.jsx(Fr,{open:t,onOpenChange:Z,children:r.jsxs(Rr,{className:"max-w-3xl max-h-[85vh] overflow-hidden flex flex-col",children:[r.jsxs(qr,{children:[r.jsxs($r,{className:"flex items-center gap-2",children:[r.jsx(p1,{className:"h-5 w-5"}),"Import Contacts from CSV"]}),r.jsx(Xn,{children:"Upload a CSV file with your contacts. You can map columns and select relationship types."})]}),i==="upload"&&r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{className:"border-2 border-dashed rounded-lg p-8 text-center",children:[r.jsx("input",{type:"file",accept:".csv,.txt",ref:l,onChange:te,className:"hidden"}),r.jsx(uo,{className:"h-10 w-10 mx-auto text-muted-foreground mb-4"}),r.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"Click to upload or drag and drop a CSV file"}),r.jsx(ee,{onClick:()=>{var he;return(he=l.current)==null?void 0:he.click()},children:"Select CSV File"})]}),r.jsxs("div",{className:"bg-muted/50 rounded-lg p-4 text-sm",children:[r.jsx("p",{className:"font-medium mb-2",children:"Supported Fields:"}),r.jsx("p",{className:"text-muted-foreground text-xs mb-3",children:"First Name, Last Name, Email, Phone, Street Address, City, State, Zip, Spouse Name, Company, Job Title, Birthday, Home Anniversary, Notes"}),r.jsxs(ee,{variant:"outline",size:"sm",onClick:()=>{const he=`First Name,Last Name,Email,Phone,Street Address,City,State,Zip,Spouse Name,Company,Job Title,Birthday,Home Anniversary,Notes John,Doe,john@example.com,555-123-4567,123 Main St,Austin,TX,78701,Jane Doe,ABC Realty,Real Estate Agent,1985-06-15,2020-03-22,Met at open house`,ue=new Blob([he],{type:"text/csv"}),_e=URL.createObjectURL(ue),Ae=document.createElement("a");Ae.href=_e,Ae.download="contact_import_template.csv",Ae.click(),URL.revokeObjectURL(_e)},children:[r.jsx(no,{className:"h-4 w-4 mr-2"}),"Download Template"]})]})]}),i==="mapping"&&r.jsxs("div",{className:"flex-1 overflow-auto space-y-4 py-4",children:[r.jsxs("div",{className:"space-y-3",children:[r.jsx(He,{className:"text-base font-medium",children:"Map CSV Columns to Contact Fields"}),r.jsx("div",{className:"grid gap-3",children:Sjt.map(he=>r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsxs(He,{className:"w-40 text-sm",children:[he.label,he.required&&r.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),r.jsxs(gn,{value:j[he.key]||"none",onValueChange:ue=>ie(he.key,ue),children:[r.jsx(fn,{className:"w-48",children:r.jsx(xn,{placeholder:"Select column..."})}),r.jsxs(pn,{children:[r.jsx(Vt,{value:"none",children:"-- Not mapped --"}),p.map(ue=>r.jsx(Vt,{value:ue,children:ue},ue))]})]})]},he.key))})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsx(He,{className:"text-base font-medium",children:"Apply Relationship Types (optional)"}),r.jsx("div",{className:"flex flex-wrap gap-2",children:n.map(he=>r.jsx(Ot,{variant:N.includes(he.id)?"default":"outline",className:"cursor-pointer",onClick:()=>le(he.id),children:he.name},he.id))})]}),r.jsx("div",{className:"bg-muted/50 rounded-lg p-3 text-sm",children:r.jsxs("p",{className:"text-muted-foreground",children:["Preview: ",y.length," row(s) found in CSV"]})})]}),i==="preview"&&r.jsxs("div",{className:"flex-1 overflow-hidden flex flex-col space-y-4",children:[r.jsxs("div",{className:"flex items-center gap-4 text-sm",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Xi,{className:"h-4 w-4 text-green-500"}),r.jsxs("span",{children:[ge," valid"]})]}),ae>0&&r.jsxs("div",{className:"flex items-center gap-2 text-destructive",children:[r.jsx(Il,{className:"h-4 w-4"}),r.jsxs("span",{children:[ae," invalid"]})]})]}),r.jsxs("div",{className:"flex-1 overflow-auto border rounded-lg",children:[r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Ar,{className:"bg-muted/30",children:[r.jsx(It,{children:"First Name"}),r.jsx(It,{children:"Last Name"}),r.jsx(It,{children:"Email"}),r.jsx(It,{children:"Phone"}),r.jsx(It,{children:"Status"})]})}),r.jsx(Vs,{children:E.slice(0,100).map((he,ue)=>r.jsxs(Ar,{children:[r.jsx(Nt,{children:he.first_name}),r.jsx(Nt,{children:he.last_name}),r.jsx(Nt,{children:he.email}),r.jsx(Nt,{children:he.phone}),r.jsx(Nt,{children:he.isValid?r.jsx(Ot,{variant:"default",className:"bg-green-500/10 text-green-600",children:"Valid"}):r.jsx(Ot,{variant:"destructive",children:he.error||"Invalid"})})]},ue))})]}),E.length>100&&r.jsxs("p",{className:"text-sm text-muted-foreground text-center py-2",children:["Showing first 100 of ",E.length," contacts"]})]})]}),i==="result"&&F&&r.jsxs("div",{className:"space-y-4 py-4 text-center",children:[r.jsx(Xi,{className:"h-12 w-12 mx-auto text-green-500"}),r.jsx("h3",{className:"text-lg font-semibold",children:"Import Complete"}),r.jsxs("p",{className:"text-muted-foreground",children:[F.created," contact(s) created, ",F.updated," updated"]}),F.failed>0&&r.jsxs("p",{className:"text-destructive",children:[F.failed," failed to import"]})]}),r.jsxs(ea,{children:[i==="upload"&&r.jsx(ee,{variant:"outline",onClick:Z,children:"Cancel"}),i==="mapping"&&r.jsxs(r.Fragment,{children:[r.jsx(ee,{variant:"outline",onClick:H,children:"Back"}),r.jsx(ee,{onClick:ye,disabled:!j.first_name,children:"Continue"})]}),i==="preview"&&r.jsxs(r.Fragment,{children:[r.jsx(ee,{variant:"outline",onClick:()=>h("mapping"),children:"Back"}),r.jsx(ee,{onClick:ne,disabled:L||ge===0,children:L?r.jsxs(r.Fragment,{children:[r.jsx(en,{className:"mr-2 h-4 w-4 animate-spin"}),"Importing..."]}):`Import ${ge} Contact${ge!==1?"s":""}`})]}),i==="result"&&r.jsx(ee,{onClick:Z,children:"Done"})]})]})})};function Mjt(){return"contacts"in navigator&&"ContactsManager"in window}function Tjt(t){const e=[],n=t.split("BEGIN:VCARD").filter(s=>s.trim());for(const s of n){const a=s.split(/\r?\n/);let o="",l="",i="",h="",p="";for(const x of a){const y=x.replace(/^\s+/,"");if(y.startsWith("N:")||y.startsWith("N;")){const j=y.substring(y.indexOf(":")+1).split(";");l=(j[0]||"").trim(),o=(j[1]||"").trim()}if((y.startsWith("FN:")||y.startsWith("FN;"))&&!o){const j=y.substring(y.indexOf(":")+1).trim().split(" ");o=j[0]||"",l=j.slice(1).join(" ")}(y.startsWith("EMAIL")||y.match(/^item\d+\.EMAIL/i))&&!i&&(i=y.substring(y.indexOf(":")+1).trim()),(y.startsWith("TEL")||y.match(/^item\d+\.TEL/i))&&!h&&(h=y.substring(y.indexOf(":")+1).trim()),(y.startsWith("ADR")||y.match(/^item\d+\.ADR/i))&&!p&&(p=y.substring(y.indexOf(":")+1).split(";").map(C=>C.trim()).filter(Boolean).join(", "))}(o||l)&&e.push({first_name:o,last_name:l,email:i,phone:h,address:p})}return e}function Ajt({open:t,onOpenChange:e,onComplete:n}){const{user:s}=Qr(),{data:a}=op(),o=gxe(),l=I.useRef(null),[i,h]=I.useState("choose"),[p,x]=I.useState([]),[y,b]=I.useState(new Set),[j,C]=I.useState(0),[N,A]=I.useState(0),E=Mjt(),T=I.useCallback(ie=>{if(!a)return ie;const le=new Set(a.filter(ne=>ne.email).map(ne=>ne.email.toLowerCase())),ye=new Set(a.filter(ne=>ne.phone).map(ne=>ne.phone.replace(/\D/g,"")));return ie.map(ne=>{var he,ue;const ge=(he=ne.email)==null?void 0:he.toLowerCase(),ae=(ue=ne.phone)==null?void 0:ue.replace(/\D/g,"");return ge&&le.has(ge)?{...ne,isDuplicate:!0,duplicateField:"email"}:ae&&ae.length>=7&&ye.has(ae)?{...ne,isDuplicate:!0,duplicateField:"phone"}:ne})},[a]),L=async()=>{try{const ie=["name","email","tel","address"],le=await navigator.contacts.select(ie,{multiple:!0});if(!le||le.length===0)return;const ye=le.map(ae=>{var _e,Ae,Ce,be;const ue=(((_e=ae.name)==null?void 0:_e[0])||"").split(" ");return{first_name:ue[0]||"",last_name:ue.slice(1).join(" "),email:((Ae=ae.email)==null?void 0:Ae[0])||"",phone:((Ce=ae.tel)==null?void 0:Ce[0])||"",address:(be=ae.address)!=null&&be[0]?[ae.address[0].streetAddress,ae.address[0].city,ae.address[0].region,ae.address[0].postalCode].filter(Boolean).join(", "):""}}),ne=T(ye);x(ne);const ge=new Set;ne.forEach((ae,he)=>{ae.isDuplicate||ge.add(he)}),b(ge),h("preview")}catch(ie){console.error("Contact Picker error:",ie),ma({title:"Could not access contacts",description:"Please try the file upload option instead.",variant:"destructive"})}},z=ie=>{var ne;const le=(ne=ie.target.files)==null?void 0:ne[0];if(!le)return;const ye=new FileReader;ye.onload=ge=>{var Ae;const ae=(Ae=ge.target)==null?void 0:Ae.result,he=Tjt(ae);if(he.length===0){ma({title:"No contacts found",description:"The file didn't contain any valid contacts.",variant:"destructive"});return}const ue=T(he);x(ue);const _e=new Set;ue.forEach((Ce,be)=>{Ce.isDuplicate||_e.add(be)}),b(_e),h("preview")},ye.readAsText(le),l.current&&(l.current.value="")},F=async()=>{const ie=p.filter((ye,ne)=>y.has(ne));if(ie.length===0)return;h("importing");let le=0;for(const ye of ie)try{await o.mutateAsync({first_name:ye.first_name,last_name:ye.last_name||void 0,email:ye.email||void 0,phone:ye.phone||void 0,address:ye.address||void 0}),le++,A(Math.round(le/ie.length*100))}catch(ne){console.error(`Failed to import ${ye.first_name} ${ye.last_name}:`,ne)}C(le),h("done")},q=ie=>{b(le=>{const ye=new Set(le);return ye.has(ie)?ye.delete(ie):ye.add(ie),ye})},H=()=>{y.size===p.length?b(new Set):b(new Set(p.map((ie,le)=>le)))},Z=ie=>{ie||(h("choose"),x([]),b(new Set),C(0),A(0),i==="done"&&n()),e(ie)},G=p.filter(ie=>ie.isDuplicate).length,te=y.size;return r.jsx(Fr,{open:t,onOpenChange:Z,children:r.jsxs(Rr,{className:"sm:max-w-lg max-h-[90vh]",children:[r.jsxs(qr,{children:[r.jsxs($r,{className:"flex items-center gap-2",children:[r.jsx(bg,{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(Xn,{children:"Add contacts from your phone directly into Agent OS."})]}),i==="choose"&&r.jsxs("div",{className:"space-y-4 pt-2",children:[E&&r.jsxs(ee,{onClick:L,className:"w-full h-auto py-4 flex flex-col items-center gap-2",children:[r.jsx(bg,{className:"h-6 w-6"}),r.jsxs("div",{className:"text-center",children:[r.jsx("div",{className:"font-semibold",children:"Select from Phone"}),r.jsx("div",{className:"text-xs opacity-80",children:"Pick contacts directly from your device"})]})]}),r.jsxs("div",{className:"relative",children:[E&&r.jsx("div",{className:"absolute inset-0 flex items-center",children:r.jsx("span",{className:"w-full border-t"})}),E&&r.jsx("div",{className:"relative flex justify-center text-xs uppercase",children:r.jsx("span",{className:"bg-background px-2 text-muted-foreground",children:"or"})})]}),r.jsxs(ee,{variant:E?"outline":"default",onClick:()=>{var ie;return(ie=l.current)==null?void 0:ie.click()},className:"w-full h-auto py-4 flex flex-col items-center gap-2",children:[r.jsx(uo,{className:"h-6 w-6"}),r.jsxs("div",{className:"text-center",children:[r.jsx("div",{className:"font-semibold",children:"Upload Contact File"}),r.jsx("div",{className:"text-xs opacity-80",children:E?"Import a .vcf file exported from your Contacts app":"Export contacts from your phone as a .vcf file, then upload here"})]})]}),r.jsx("input",{ref:l,type:"file",accept:".vcf,.vcard",onChange:z,className:"hidden"}),!E&&r.jsxs("div",{className:"rounded-lg bg-muted p-3 text-sm text-muted-foreground space-y-2",children:[r.jsx("p",{className:"font-medium",children:"How to export contacts:"}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium text-xs",children:"iPhone:"}),r.jsx("p",{className:"text-xs",children:'Open Contacts → select contacts → Share → choose "Export vCard"'})]}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium text-xs",children:"Android:"}),r.jsx("p",{className:"text-xs",children:"Open Contacts → Menu → Export → save as .vcf file"})]})]})]}),i==="preview"&&r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between text-sm",children:[r.jsxs("span",{children:[p.length," contact",p.length!==1?"s":""," found",G>0&&r.jsxs("span",{className:"text-amber-600 ml-1",children:["(",G," already exist)"]})]}),r.jsx(ee,{variant:"ghost",size:"sm",onClick:H,children:y.size===p.length?"Deselect All":"Select All"})]}),r.jsx(Jo,{className:"h-[350px] rounded-md border",children:r.jsx("div",{className:"divide-y",children:p.map((ie,le)=>r.jsxs("div",{className:`flex items-start gap-3 p-3 cursor-pointer hover:bg-accent/50 transition-colors ${ie.isDuplicate?"opacity-60":""}`,onClick:()=>q(le),children:[r.jsx(Dl,{checked:y.has(le),onCheckedChange:()=>q(le),className:"mt-0.5"}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs("span",{className:"font-medium text-sm truncate",children:[ie.first_name," ",ie.last_name]}),ie.isDuplicate&&r.jsxs(Ot,{variant:"secondary",className:"text-[10px] px-1.5 py-0 bg-amber-500/10 text-amber-600 border-amber-200",children:["Exists (",ie.duplicateField,")"]})]}),r.jsxs("div",{className:"text-xs text-muted-foreground space-y-0.5 mt-0.5",children:[ie.phone&&r.jsx("div",{children:ie.phone}),ie.email&&r.jsx("div",{className:"truncate",children:ie.email})]})]})]},le))})}),r.jsxs("div",{className:"flex items-center justify-between pt-2",children:[r.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>h("choose"),children:"Back"}),r.jsxs(ee,{onClick:F,disabled:te===0,children:["Import ",te," Contact",te!==1?"s":""]})]})]}),i==="importing"&&r.jsxs("div",{className:"flex flex-col items-center gap-4 py-8",children:[r.jsx(en,{className:"h-8 w-8 animate-spin text-primary"}),r.jsxs("div",{className:"text-center",children:[r.jsx("p",{className:"font-medium",children:"Importing contacts..."}),r.jsxs("p",{className:"text-sm text-muted-foreground",children:[N,"% complete"]})]}),r.jsx("div",{className:"w-full bg-muted rounded-full h-2",children:r.jsx("div",{className:"bg-primary h-2 rounded-full transition-all",style:{width:`${N}%`}})})]}),i==="done"&&r.jsxs("div",{className:"flex flex-col items-center gap-4 py-8",children:[r.jsx("div",{className:"h-12 w-12 rounded-full bg-emerald-500/10 flex items-center justify-center",children:r.jsx(Ai,{className:"h-6 w-6 text-emerald-600"})}),r.jsxs("div",{className:"text-center",children:[r.jsxs("p",{className:"font-semibold text-lg",children:[j," contact",j!==1?"s":""," imported!"]}),r.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Your contacts are now in Agent OS and ready for touchpoint plans."})]}),r.jsx(ee,{onClick:()=>Z(!1),className:"mt-2",children:"Done"})]})]})})}function Ejt({selectedIds:t,contacts:e,onClearSelection:n}){const{data:s}=Sm(),a=xxe(),o=Vr(),[l,i]=I.useState(!1),h=t.size;if(h===0)return null;const p=async b=>{i(!0);try{const C=Array.from(t).map(A=>({contact_id:A,relationship_type_id:b})),{error:N}=await J.from("innercircle_contact_tags").upsert(C,{onConflict:"contact_id,relationship_type_id",ignoreDuplicates:!0});if(N)throw N;o.invalidateQueries({queryKey:["innercircle-contacts"]}),o.invalidateQueries({queryKey:["innercircle-contact-counts"]}),ma({title:`Assigned type to ${h} contacts`}),n()}catch(j){ma({title:"Error assigning type",description:j.message,variant:"destructive"})}finally{i(!1)}},x=()=>{const b=e.filter(L=>t.has(L.id)),j=["First Name","Last Name","Email","Phone","Address","Birthday","Home Anniversary","Notes","Relationship Types"],C=b.map(L=>{var z;return[L.first_name,L.last_name||"",L.email||"",L.phone||"",L.address||"",L.birthday||"",L.home_anniversary||"",L.notes||"",((z=L.tags)==null?void 0:z.map(F=>{var q;return(q=F.relationship_type)==null?void 0:q.name}).join("; "))||""]}),N=[j.join(","),...C.map(L=>L.map(z=>`"${(z||"").replace(/"/g,'""')}"`).join(","))].join(` `),A=new Blob([N],{type:"text/csv"}),E=URL.createObjectURL(A),T=document.createElement("a");T.href=E,T.download=`contacts-export-${new Date().toISOString().slice(0,10)}.csv`,T.click(),URL.revokeObjectURL(E),ma({title:`Exported ${h} contacts`})},y=async()=>{if(confirm(`Are you sure you want to delete ${h} contacts? This cannot be undone.`)){i(!0);try{const b=Array.from(t);for(const j of b)await a.mutateAsync(j);n()}catch(b){ma({title:"Error deleting contacts",description:b.message,variant:"destructive"})}finally{i(!1)}}};return r.jsxs("div",{className:"flex items-center gap-3 p-3 bg-primary/5 border border-primary/20 rounded-lg",children:[r.jsxs(Ot,{variant:"secondary",className:"font-semibold",children:[h," selected"]}),r.jsxs(gn,{onValueChange:p,disabled:l,children:[r.jsx(fn,{className:"w-[180px] h-8",children:r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx(jg,{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(b=>b.active).map(b=>r.jsx(Vt,{value:b.id,children:b.name},b.id))})]}),r.jsxs(ee,{variant:"outline",size:"sm",onClick:x,disabled:l,children:[r.jsx(no,{className:"h-3.5 w-3.5 mr-1"}),"Export"]}),r.jsxs(ee,{variant:"outline",size:"sm",onClick:y,disabled:l,className:"text-destructive hover:text-destructive",children:[r.jsx(Vn,{className:"h-3.5 w-3.5 mr-1"}),"Delete"]}),r.jsxs(ee,{variant:"ghost",size:"sm",onClick:n,className:"ml-auto",children:[r.jsx(_s,{className:"h-3.5 w-3.5 mr-1"}),"Clear"]})]})}function c4e({contact:t,onEdit:e,onDelete:n,onSnooze:s}){const a=rs(),o=`${t.first_name} ${t.last_name||""}`.trim();return r.jsxs(wh,{children:[r.jsx(jh,{asChild:!0,children:r.jsx(ee,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:l=>l.stopPropagation(),children:r.jsx(em,{className:"h-4 w-4"})})}),r.jsxs(Wu,{align:"end",onClick:l=>l.stopPropagation(),children:[r.jsxs(di,{onClick:()=>a(`/mission-control/contacts/${t.id}?tab=activity&action=log`),children:[r.jsx(bi,{className:"h-4 w-4 mr-2"}),"Log Touch"]}),r.jsxs(di,{onClick:()=>a(`/mission-control/video?contactId=${t.id}`),children:[r.jsx(Pa,{className:"h-4 w-4 mr-2"}),"Send Video"]}),r.jsxs(di,{onClick:()=>a(`/mission-control/popbys?contactId=${t.id}`),children:[r.jsx(fl,{className:"h-4 w-4 mr-2"}),"Schedule Pop-by"]}),r.jsxs(di,{onClick:()=>s(t.id,o),children:[r.jsx(Yf,{className:"h-4 w-4 mr-2"}),"Snooze"]}),r.jsxs(di,{onClick:()=>e(t),children:[r.jsx(_i,{className:"h-4 w-4 mr-2"}),"Edit"]}),r.jsxs(di,{onClick:()=>n(t.id),className:"text-destructive focus:text-destructive",children:[r.jsx(Vn,{className:"h-4 w-4 mr-2"}),"Delete"]})]})]})}function Ijt(){const{user:t}=Qr();return Yt({queryKey:["contact-smart-lists",t==null?void 0:t.id],queryFn:async()=>{const{data:e,error:n}=await J.from("contact_smart_lists").select("*").order("created_at",{ascending:!1});if(n)throw n;return e},enabled:!!t})}function Pjt(){const t=Vr(),{user:e}=Qr();return cr({mutationFn:async({name:n,filters:s,sort_by:a})=>{const{data:o,error:l}=await J.from("contact_smart_lists").insert({owner_user_id:e.id,name:n,filters:s,sort_by:a}).select().single();if(l)throw l;return o},onSuccess:()=>{t.invalidateQueries({queryKey:["contact-smart-lists"]}),ma({title:"Smart list saved"})},onError:n=>{ma({title:"Error saving smart list",description:n.message,variant:"destructive"})}})}function Ljt(){const t=Vr();return cr({mutationFn:async e=>{const{error:n}=await J.from("contact_smart_lists").delete().eq("id",e);if(n)throw n},onSuccess:()=>{t.invalidateQueries({queryKey:["contact-smart-lists"]}),ma({title:"Smart list deleted"})}})}function Ojt({currentFilters:t,currentSortBy:e,onApplySmartList:n}){const{data:s}=Ijt(),a=Pjt(),o=Ljt(),[l,i]=I.useState(!1),[h,p]=I.useState(""),x=t.search||t.type&&t.type!=="all"||t.status&&t.status!=="all",y=async()=>{h.trim()&&(await a.mutateAsync({name:h.trim(),filters:t,sort_by:e}),p(""),i(!1))};return r.jsxs(r.Fragment,{children:[r.jsxs(wh,{children:[r.jsx(jh,{asChild:!0,children:r.jsxs(ee,{variant:"outline",size:"sm",className:"gap-1.5",children:[r.jsx(m1,{className:"h-3.5 w-3.5"}),"Smart Lists",s&&s.length>0&&r.jsx(Ot,{variant:"secondary",className:"h-5 px-1.5 text-[10px]",children:s.length}),r.jsx(Dd,{className:"h-3.5 w-3.5"})]})}),r.jsxs(Wu,{align:"start",className:"w-56",children:[s&&s.length>0?r.jsxs(r.Fragment,{children:[s.map(b=>r.jsxs(di,{className:"flex items-center justify-between group",children:[r.jsx("span",{className:"flex-1 cursor-pointer",onClick:()=>n(b.filters,b.sort_by),children:b.name}),r.jsx(ee,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0 opacity-0 group-hover:opacity-100",onClick:j=>{j.stopPropagation(),o.mutate(b.id)},children:r.jsx(Vn,{className:"h-3 w-3 text-destructive"})})]},b.id)),r.jsx(Fj,{})]}):r.jsx(di,{disabled:!0,className:"text-muted-foreground text-xs",children:"No saved lists yet"}),x&&r.jsxs(di,{onClick:()=>i(!0),children:[r.jsx(ST,{className:"h-4 w-4 mr-2"}),"Save Current Filters"]})]})]}),r.jsx(Fr,{open:l,onOpenChange:i,children:r.jsxs(Rr,{className:"max-w-sm",children:[r.jsx(qr,{children:r.jsx($r,{children:"Save Smart List"})}),r.jsxs("div",{className:"space-y-4",children:[r.jsx(dt,{placeholder:"e.g. Buyers in 40205",value:h,onChange:b=>p(b.target.value),onKeyDown:b=>b.key==="Enter"&&y(),autoFocus:!0}),r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(ee,{variant:"outline",onClick:()=>i(!1),children:"Cancel"}),r.jsx(ee,{onClick:y,disabled:!h.trim()||a.isPending,children:"Save"})]})]})]})})]})}function hT(t){if(!t)return null;try{const e=new Date(t);if(isNaN(e.getTime()))return null;const n=new Date;n.setHours(0,0,0,0);let s=mte(e,n.getFullYear());return s.setHours(0,0,0,0),sn)return null;const a=e==="birthday"?"🎂":"🏡",o=s===0?e==="birthday"?"Birthday today!":"Anniversary today!":s===1?e==="birthday"?"Birthday tomorrow":"Anniversary tomorrow":`${a} in ${s}d`;return{emoji:a,label:o,daysUntil:s}}function u4e({birthday:t,homeAnniversary:e,className:n}){const s=d4e(t,"birthday",7),a=d4e(e,"anniversary",7);return!s&&!a?null:r.jsxs("div",{className:$t("flex flex-wrap gap-1",n),children:[s&&r.jsx(Ot,{variant:"secondary",className:$t("text-[10px] gap-0.5 font-medium",s.daysUntil===0?"bg-pink-100 text-pink-700 dark:bg-pink-900/30 dark:text-pink-400 animate-pulse":"bg-pink-50 text-pink-600 dark:bg-pink-900/20 dark:text-pink-400"),children:s.label}),a&&r.jsx(Ot,{variant:"secondary",className:$t("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 h4e({deal:t}){if(!t||!t.stage)return null;const{stage:e}=t;return r.jsxs(Ot,{variant:"outline",className:"text-[10px] gap-1 font-medium whitespace-nowrap",style:{borderColor:e.color,color:e.color,backgroundColor:`${e.color}10`},children:[r.jsx("span",{className:"h-1.5 w-1.5 rounded-full inline-block",style:{backgroundColor:e.color}}),e.name]})}function Djt(){const t=Pc();return Yt({queryKey:["contact-deals-map",t],queryFn:async()=>{const{data:e,error:n}=await J.from("deal_pipeline").select(` id, deal_name, contact_id, stage:deal_pipeline_stages(id, name, color, icon, is_won_stage, is_lost_stage) `).not("contact_id","is",null);if(n)throw n;const s={};return(e||[]).forEach(a=>{a.contact_id&&!s[a.contact_id]&&(s[a.contact_id]=a)}),s},enabled:!!t})}function Rjt(){const t=rs(),[e]=$d(),{user:n}=Qr(),s=f3(),a=Vr(),o=e.get("type"),l=e.get("filter")??e.get("status"),i=e.get("new")==="true",{contactsWithScores:h,isLoading:p}=_xe(),{data:x}=Sm(),{data:y}=Djt(),b=gxe(),j=n8e(),C=xxe(),[N,A]=I.useState(""),[E,T]=I.useState(o||"all"),[L,z]=I.useState(l||"all"),[F,q]=I.useState("name"),[H,Z]=I.useState(i),[G,te]=I.useState(null),[ie,le]=I.useState(!1),[ye,ne]=I.useState(!1),[ge,ae]=I.useState(null),[he,ue]=I.useState(""),[_e,Ae]=I.useState(new Set),[Ce,be]=I.useState(!1),[me,Le]=I.useState(1),[Ne,Be]=I.useState(50),Ee=I.useCallback(Oe=>{be(!1),Ae(Qe=>{const nt=new Set(Qe);return nt.has(Oe)?nt.delete(Oe):nt.add(Oe),nt})},[]);I.useEffect(()=>{if(!(n!=null&&n.id))return;const Oe=J.channel(`innercircle_contacts_inserts_${n.id}`).on("postgres_changes",{event:"INSERT",schema:"public",table:"innercircle_contacts",filter:`owner_user_id=eq.${n.id}`},()=>{a.invalidateQueries({queryKey:["innercircle-contacts"]}),a.invalidateQueries({queryKey:["innercircle-contact-counts"]})}).subscribe();return()=>{J.removeChannel(Oe)}},[a,n==null?void 0:n.id]),I.useEffect(()=>{l&&z(l)},[l]);const[Ue,Re]=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&&Z(!0)},[i]),I.useEffect(()=>{var Oe;G&&Re({first_name:G.first_name||"",last_name:G.last_name||"",email:G.email||"",phone:G.phone||"",address:G.address||"",city:G.city||"",state:G.state||"",zip_code:G.zip_code||"",birthday:G.birthday||"",home_anniversary:G.home_anniversary||"",spouse_name:G.spouse_name||"",spouse_email:G.spouse_email||"",notes:G.notes||"",tagIds:((Oe=G.tags)==null?void 0:Oe.map(Qe=>Qe.relationship_type_id))||[]})},[G]);const je=I.useMemo(()=>{if(!h)return[];let Oe=h.filter(Qe=>{var mt,Mt,wt;const nt=N===""||`${Qe.first_name} ${Qe.last_name}`.toLowerCase().includes(N.toLowerCase())||((mt=Qe.email)==null?void 0:mt.toLowerCase().includes(N.toLowerCase()))||((Mt=Qe.phone)==null?void 0:Mt.includes(N)),gt=E==="all"||((wt=Qe.tags)==null?void 0:wt.some(Qt=>Qt.relationship_type_id===E));return nt&>});return L==="not-touched-90"?Oe=Oe.filter(Qe=>{const nt=Qe.relationshipScore.daysSinceTouch;return nt===null||nt>90}):L==="at-risk"?Oe=Oe.filter(Qe=>Qe.relationshipScore.status==="at-risk"):L==="cooling"?Oe=Oe.filter(Qe=>Qe.relationshipScore.status==="cooling"):L==="warm"&&(Oe=Oe.filter(Qe=>Qe.relationshipScore.status==="warm")),Oe=[...Oe].sort((Qe,nt)=>{switch(F){case"important-dates":{const gt=hT(Qe.birthday),mt=hT(nt.birthday),Mt=hT(Qe.home_anniversary),wt=hT(nt.home_anniversary),Qt=[gt,Mt].filter(cn=>cn!==null).sort((cn,jn)=>(cn??1/0)-(jn??1/0))[0]??1/0,Cr=[mt,wt].filter(cn=>cn!==null).sort((cn,jn)=>(cn??1/0)-(jn??1/0))[0]??1/0;return Qt-Cr}case"last-touched":{const gt=Qe.relationshipScore.lastTouchDate,mt=nt.relationshipScore.lastTouchDate;return!gt&&!mt?0:gt?mt?new Date(gt).getTime()-new Date(mt).getTime():1:-1}case"next-touch":{const gt=Qe.relationshipScore.daysSinceTouch,mt=nt.relationshipScore.daysSinceTouch;return gt===null&&mt===null?0:gt===null?-1:mt===null?1:mt-gt}case"score":return Qe.relationshipScore.score-nt.relationshipScore.score;case"date-added":{const gt=Qe.created_at,mt=nt.created_at;return!gt&&!mt?0:gt?mt?new Date(mt).getTime()-new Date(gt).getTime():-1:1}case"name":default:{const gt=`${Qe.first_name||""} ${Qe.last_name||""}`.toLowerCase(),mt=`${nt.first_name||""} ${nt.last_name||""}`.toLowerCase();return gt.localeCompare(mt)}}}),Oe},[h,N,E,L,F]),et=je.length,Te=Math.max(1,Math.ceil(et/Ne)),Ze=Math.min(me,Te),pe=I.useMemo(()=>{const Oe=(Ze-1)*Ne;return je.slice(Oe,Oe+Ne)},[je,Ze,Ne]);I.useEffect(()=>{Le(1)},[N,E,L,F]);const yt=I.useCallback(()=>{be(!1),Ae(Oe=>Oe.size>0?new Set:new Set(pe.map(Qe=>Qe.id)))},[pe]),rt=I.useCallback(()=>{be(!0),Ae(new Set(je.map(Oe=>Oe.id)))},[je]),at=I.useCallback((Oe,Qe)=>{A(Oe.search||""),T(Oe.type||"all"),z(Oe.status||"all"),q(Qe||"name")},[]),Me=()=>{Re({first_name:"",last_name:"",email:"",phone:"",address:"",city:"",state:"",zip_code:"",birthday:"",home_anniversary:"",spouse_name:"",spouse_email:"",notes:"",tagIds:[]})},ft=async Oe=>{Oe.preventDefault(),G?(await j.mutateAsync({id:G.id,...Ue}),te(null)):(await b.mutateAsync(Ue),Z(!1)),Me()},qe=async Oe=>{confirm("Are you sure you want to delete this contact?")&&await C.mutateAsync(Oe)};return r.jsx(Lr,{title:"Contacts",description:"Manage your InnerCircle contacts",children:r.jsxs("div",{className:"space-y-6 overflow-x-hidden",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("h1",{className:"text-2xl font-bold",children:"Contacts"}),r.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wide px-1.5 py-0.5 rounded border border-amber-500 text-amber-600 dark:text-amber-400 bg-amber-500/10",children:"Beta"})]}),r.jsx("div",{className:"flex items-center gap-4",children:r.jsxs(ee,{variant:"ghost",size:"sm",onClick:()=>t("/mission-control"),children:[r.jsx(Tc,{className:"h-4 w-4 mr-1"}),"Back"]})}),r.jsx(Ye,{children:r.jsx(tt,{className:"p-4",children:r.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[r.jsxs("div",{className:"relative flex-1",children:[r.jsx(wa,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(dt,{placeholder:"Search by name, email, or phone...",value:N,onChange:Oe=>A(Oe.target.value),className:"pl-9"})]}),r.jsxs(gn,{value:E,onValueChange:T,children:[r.jsx(fn,{className:"w-[160px]",children:r.jsx(xn,{placeholder:"Filter by type"})}),r.jsxs(pn,{children:[r.jsx(Vt,{value:"all",children:"All Types"}),x==null?void 0:x.filter(Oe=>Oe.active).map(Oe=>r.jsx(Vt,{value:Oe.id,children:Oe.name},Oe.id))]})]}),r.jsxs(gn,{value:L,onValueChange:z,children:[r.jsx(fn,{className:"w-[160px]",children:r.jsx(xn,{placeholder:"Filter by status"})}),r.jsxs(pn,{children:[r.jsx(Vt,{value:"all",children:"All Status"}),r.jsx(Vt,{value:"warm",children:"🟢 Warm"}),r.jsx(Vt,{value:"cooling",children:"🟡 Cooling Off"}),r.jsx(Vt,{value:"at-risk",children:"🔴 At Risk"})]})]}),r.jsxs(gn,{value:F,onValueChange:q,children:[r.jsx(fn,{className:"w-[180px]",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(zx,{className:"h-4 w-4 text-muted-foreground"}),r.jsx(xn,{placeholder:"Sort by"})]})}),r.jsxs(pn,{children:[r.jsx(Vt,{value:"name",children:"Name (A-Z)"}),r.jsx(Vt,{value:"important-dates",children:"Important Dates"}),r.jsx(Vt,{value:"last-touched",children:"Last Touched"}),r.jsx(Vt,{value:"next-touch",children:"Next Touch Due"}),r.jsx(Vt,{value:"score",children:"Relationship Score"}),r.jsx(Vt,{value:"date-added",children:"Date Added"})]})]}),r.jsx(Ojt,{currentFilters:{search:N,type:E,status:L},currentSortBy:F,onApplySmartList:at}),r.jsxs(ee,{onClick:()=>Z(!0),children:[r.jsx(bn,{className:"h-4 w-4 mr-1"}),"Add Contact"]}),r.jsxs(ee,{variant:"outline",onClick:()=>le(!0),children:[r.jsx(uo,{className:"h-4 w-4 mr-1"}),"Import CSV"]}),r.jsxs(ee,{variant:"outline",onClick:()=>ne(!0),children:[r.jsx(bg,{className:"h-4 w-4 mr-1"}),"Import from Phone"]})]})})}),r.jsx(Ejt,{selectedIds:_e,contacts:je,onClearSelection:()=>{Ae(new Set),be(!1)}}),_e.size>0&&_e.size===pe.length&&!Ce&&et>Ne&&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 ",pe.length," contacts on this page are selected."]}),r.jsxs(ee,{variant:"link",size:"sm",className:"h-auto p-0 font-semibold",onClick:rt,children:["Select all ",et.toLocaleString()," matching contacts"]})]}),Ce&&r.jsxs("div",{className:"flex items-center justify-center gap-2 p-2 bg-primary/10 border border-primary/30 rounded-lg text-sm font-medium",children:["All ",et.toLocaleString()," matching contacts are selected.",r.jsx(ee,{variant:"link",size:"sm",className:"h-auto p-0",onClick:()=>{Ae(new Set),be(!1)},children:"Clear selection"})]}),s?r.jsx("div",{className:"space-y-3",children:p?r.jsx(Ye,{className:"p-6 text-center text-muted-foreground",children:"Loading contacts..."}):je.length===0?r.jsx(Ye,{className:"p-6 text-center text-muted-foreground",children:N||E!=="all"||L!=="all"?"No contacts match your search":"No contacts yet. Add your first contact!"}):pe.map(Oe=>{var nt;const{relationshipScore:Qe}=Oe;return r.jsx(Ye,{className:"cursor-pointer hover:bg-accent/50 transition-colors",onClick:()=>{const gt=new URLSearchParams;N&>.set("search",N),E!=="all"&>.set("type",E),L!=="all"&>.set("filter",L);const mt=gt.toString();t(`/mission-control/contacts/${Oe.id}${mt?`?${mt}`:""}`)},children:r.jsx(tt,{className:"p-4",children:r.jsxs("div",{className:"flex items-start justify-between",children:[r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[r.jsxs("h3",{className:"font-semibold text-base truncate",children:[Oe.first_name," ",Oe.last_name]}),r.jsx(Vi,{className:"h-4 w-4 text-muted-foreground shrink-0"})]}),r.jsxs("div",{className:"space-y-1 text-sm mb-3",children:[Oe.email&&r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[r.jsx(da,{className:"h-3.5 w-3.5 shrink-0"}),r.jsx("span",{className:"truncate",children:Oe.email})]}),Oe.phone&&r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[r.jsx(bi,{className:"h-3.5 w-3.5 shrink-0"}),r.jsx("span",{children:Oe.phone})]})]}),r.jsxs("div",{className:"flex flex-wrap items-center gap-1 mb-2",children:[r.jsx(Lce,{score:Qe,size:"sm"}),r.jsx(afe,{contact:Oe}),(nt=Oe.tags)==null?void 0:nt.map(gt=>{var mt;return r.jsx(Ot,{variant:"secondary",className:"text-xs",children:(mt=gt.relationship_type)==null?void 0:mt.name},gt.id)}),r.jsx(h4e,{deal:y==null?void 0:y[Oe.id]})]}),r.jsx(u4e,{birthday:Oe.birthday,homeAnniversary:Oe.home_anniversary,className:"mb-2"}),r.jsxs("div",{className:"flex flex-wrap items-center gap-3 text-xs text-muted-foreground",children:[Qe.lastTouchDate?r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(Ya,{className:"h-3 w-3"}),yn(new Date(Qe.lastTouchDate),"MMM d")]}):r.jsx("span",{className:"italic",children:"Never contacted"}),Oe.birthday&&r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(zs,{className:"h-3 w-3"}),yn(new Date(Oe.birthday),"MMM d")]}),Oe.home_anniversary&&r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(pa,{className:"h-3 w-3"}),yn(new Date(Oe.home_anniversary),"MMM d")]})]})]}),r.jsx("div",{className:"ml-2",onClick:gt=>gt.stopPropagation(),children:r.jsx(c4e,{contact:Oe,onEdit:te,onDelete:qe,onSnooze:(gt,mt)=>{ae(gt),ue(mt)}})})]})})},Oe.id)})}):r.jsx(Ye,{children:r.jsx(tt,{className:"p-0 overflow-x-auto",children:r.jsxs(Us,{className:"min-w-[800px]",children:[r.jsx(qs,{children:r.jsxs(Ar,{children:[r.jsx(It,{className:"w-[40px]",children:r.jsx(Dl,{checked:pe.length>0&&pe.every(Oe=>_e.has(Oe.id)),onCheckedChange:()=>yt()})}),r.jsx(It,{children:"Name"}),r.jsx(It,{children:"Status"}),r.jsx(It,{children:"Score"}),r.jsx(It,{children:"Contact Info"}),r.jsx(It,{children:"Types / Pipeline"}),r.jsx(It,{children:"Last Contact"}),r.jsx(It,{children:"Important Dates"}),r.jsx(It,{className:"w-[50px]",children:"Actions"})]})}),r.jsx(Vs,{children:p?r.jsx(Ar,{children:r.jsx(Nt,{colSpan:9,className:"text-center py-8",children:"Loading contacts..."})}):je.length===0?r.jsx(Ar,{children:r.jsx(Nt,{colSpan:9,className:"text-center py-8 text-muted-foreground",children:N||E!=="all"||L!=="all"?"No contacts match your search":"No contacts yet. Add your first contact!"})}):pe.map(Oe=>{var gt;const{relationshipScore:Qe}=Oe,nt=y==null?void 0:y[Oe.id];return r.jsxs(Ar,{className:`cursor-pointer hover:bg-accent/50 ${_e.has(Oe.id)?"bg-accent/30":""}`,onClick:()=>{const mt=new URLSearchParams;N&&mt.set("search",N),E!=="all"&&mt.set("type",E),L!=="all"&&mt.set("status",L);const Mt=mt.toString();t(`/mission-control/contacts/${Oe.id}${Mt?`?${Mt}`:""}`)},children:[r.jsx(Nt,{onClick:mt=>mt.stopPropagation(),children:r.jsx(Dl,{checked:_e.has(Oe.id),onCheckedChange:()=>Ee(Oe.id)})}),r.jsxs(Nt,{className:"font-medium",children:[Oe.first_name," ",Oe.last_name]}),r.jsx(Nt,{children:r.jsxs("div",{className:"flex flex-col gap-1",children:[r.jsx(Lce,{score:Qe,size:"sm"}),r.jsx(afe,{contact:Oe})]})}),r.jsx(Nt,{children:r.jsx(Lce,{score:Qe,size:"sm",showScore:!0})}),r.jsx(Nt,{children:r.jsxs("div",{className:"space-y-1 text-sm",children:[Oe.email&&r.jsxs("div",{className:"flex items-center gap-1 text-muted-foreground",children:[r.jsx(da,{className:"h-3 w-3"}),Oe.email]}),Oe.phone&&r.jsxs("div",{className:"flex items-center gap-1 text-muted-foreground",children:[r.jsx(bi,{className:"h-3 w-3"}),Oe.phone]})]})}),r.jsx(Nt,{children:r.jsxs("div",{className:"flex flex-wrap gap-1",children:[(gt=Oe.tags)==null?void 0:gt.map(mt=>{var Mt;return r.jsx(Ot,{variant:"secondary",className:"text-xs",children:(Mt=mt.relationship_type)==null?void 0:Mt.name},mt.id)}),r.jsx(h4e,{deal:nt})]})}),r.jsx(Nt,{children:r.jsx("div",{className:"text-sm",children:Qe.lastTouchDate?r.jsxs("div",{className:"flex items-center gap-1 text-muted-foreground",children:[r.jsx(Ya,{className:"h-3 w-3"}),yn(new Date(Qe.lastTouchDate),"MMM d, yyyy")]}):r.jsx("span",{className:"text-muted-foreground text-xs italic",children:"Never contacted"})})}),r.jsx(Nt,{children:r.jsxs("div",{className:"space-y-1",children:[r.jsx(u4e,{birthday:Oe.birthday,homeAnniversary:Oe.home_anniversary}),r.jsxs("div",{className:"text-sm text-muted-foreground",children:[Oe.birthday&&r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(zs,{className:"h-3 w-3"}),yn(new Date(Oe.birthday),"MMM d")]}),Oe.home_anniversary&&r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(pa,{className:"h-3 w-3"}),yn(new Date(Oe.home_anniversary),"MMM d")]})]})]})}),r.jsx(Nt,{children:r.jsx(c4e,{contact:Oe,onEdit:te,onDelete:qe,onSnooze:(mt,Mt)=>{ae(mt),ue(Mt)}})})]},Oe.id)})})]})})}),et>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 ",(Ze-1)*Ne+1,"–",Math.min(Ze*Ne,et)," of ",et.toLocaleString()," contacts"]}),r.jsxs(gn,{value:String(Ne),onValueChange:Oe=>{Be(Number(Oe)),Le(1)},children:[r.jsx(fn,{className:"w-[80px] h-8",children:r.jsx(xn,{})}),r.jsxs(pn,{children:[r.jsx(Vt,{value:"50",children:"50"}),r.jsx(Vt,{value:"100",children:"100"}),r.jsx(Vt,{value:"250",children:"250"})]})]}),r.jsx("span",{className:"text-xs",children:"per page"})]}),r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(ee,{variant:"outline",size:"sm",disabled:Ze<=1,onClick:()=>Le(1),children:"First"}),r.jsx(ee,{variant:"outline",size:"sm",disabled:Ze<=1,onClick:()=>Le(Oe=>Oe-1),children:r.jsx(Tc,{className:"h-4 w-4"})}),r.jsxs("span",{className:"px-3 text-sm font-medium",children:["Page ",Ze," of ",Te]}),r.jsx(ee,{variant:"outline",size:"sm",disabled:Ze>=Te,onClick:()=>Le(Oe=>Oe+1),children:r.jsx(Vi,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"outline",size:"sm",disabled:Ze>=Te,onClick:()=>Le(Te),children:"Last"})]})]}),r.jsx(Fr,{open:H||!!G,onOpenChange:Oe=>{Oe||(Z(!1),te(null),Me())},children:r.jsxs(Rr,{className:"max-w-lg max-h-[90vh] overflow-y-auto",children:[r.jsx(qr,{children:r.jsx($r,{children:G?"Edit Contact":"Add Contact"})}),r.jsxs("form",{onSubmit:ft,className:"space-y-4",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx(He,{htmlFor:"first_name",children:"First Name *"}),r.jsx(dt,{id:"first_name",value:Ue.first_name,onChange:Oe=>Re({...Ue,first_name:Oe.target.value}),required:!0})]}),r.jsxs("div",{children:[r.jsx(He,{htmlFor:"last_name",children:"Last Name"}),r.jsx(dt,{id:"last_name",value:Ue.last_name,onChange:Oe=>Re({...Ue,last_name:Oe.target.value})})]})]}),r.jsxs("div",{children:[r.jsx(He,{htmlFor:"email",children:"Email"}),r.jsx(dt,{id:"email",type:"email",value:Ue.email,onChange:Oe=>Re({...Ue,email:Oe.target.value})})]}),r.jsxs("div",{children:[r.jsx(He,{htmlFor:"phone",children:"Phone"}),r.jsx(dt,{id:"phone",value:Ue.phone,onChange:Oe=>Re({...Ue,phone:Oe.target.value})})]}),r.jsxs("div",{children:[r.jsx(He,{htmlFor:"address",children:"Address"}),r.jsx(dt,{id:"address",value:Ue.address,onChange:Oe=>Re({...Ue,address:Oe.target.value}),placeholder:"Street address"})]}),r.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[r.jsxs("div",{children:[r.jsx(He,{htmlFor:"city",children:"City"}),r.jsx(dt,{id:"city",value:Ue.city,onChange:Oe=>Re({...Ue,city:Oe.target.value})})]}),r.jsxs("div",{children:[r.jsx(He,{htmlFor:"state",children:"State"}),r.jsx(dt,{id:"state",value:Ue.state,onChange:Oe=>Re({...Ue,state:Oe.target.value})})]}),r.jsxs("div",{children:[r.jsx(He,{htmlFor:"zip_code",children:"Zip"}),r.jsx(dt,{id:"zip_code",value:Ue.zip_code,onChange:Oe=>Re({...Ue,zip_code:Oe.target.value})})]})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx(He,{htmlFor:"birthday",children:"Birthday"}),r.jsx(dt,{id:"birthday",type:"date",value:Ue.birthday,onChange:Oe=>Re({...Ue,birthday:Oe.target.value})})]}),r.jsxs("div",{children:[r.jsx(He,{htmlFor:"home_anniversary",children:"Home Anniversary"}),r.jsx(dt,{id:"home_anniversary",type:"date",value:Ue.home_anniversary,onChange:Oe=>Re({...Ue,home_anniversary:Oe.target.value})})]})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx(He,{htmlFor:"spouse_name",children:"Spouse/Partner Name"}),r.jsx(dt,{id:"spouse_name",value:Ue.spouse_name,onChange:Oe=>Re({...Ue,spouse_name:Oe.target.value}),placeholder:"Spouse/partner name"})]}),r.jsxs("div",{children:[r.jsx(He,{htmlFor:"spouse_email",children:"Spouse/Partner Email"}),r.jsx(dt,{id:"spouse_email",type:"email",value:Ue.spouse_email,onChange:Oe=>Re({...Ue,spouse_email:Oe.target.value}),placeholder:"Spouse/partner email"})]})]}),r.jsxs("div",{children:[r.jsx(He,{children:"Relationship Types"}),r.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:x==null?void 0:x.filter(Oe=>Oe.active).map(Oe=>r.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[r.jsx(Dl,{checked:Ue.tagIds.includes(Oe.id),onCheckedChange:Qe=>{Re(Qe?{...Ue,tagIds:[...Ue.tagIds,Oe.id]}:{...Ue,tagIds:Ue.tagIds.filter(nt=>nt!==Oe.id)})}}),r.jsx("span",{className:"text-sm",children:Oe.name})]},Oe.id))})]}),r.jsxs("div",{children:[r.jsx(He,{htmlFor:"notes",children:"Notes"}),r.jsx(ps,{id:"notes",value:Ue.notes,onChange:Oe=>Re({...Ue,notes:Oe.target.value}),rows:3})]}),r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(ee,{type:"button",variant:"outline",onClick:()=>{Z(!1),te(null),Me()},children:"Cancel"}),r.jsxs(ee,{type:"submit",disabled:b.isPending||j.isPending,children:[G?"Update":"Create"," Contact"]})]})]})]})}),r.jsx(Cjt,{open:ie,onOpenChange:le,relationshipTypes:(x==null?void 0:x.filter(Oe=>Oe.active))||[],onSuccess:()=>{le(!1)}}),r.jsx(Ajt,{open:ye,onOpenChange:ne,onComplete:()=>ne(!1)}),r.jsx(vye,{open:!!ge,onOpenChange:Oe=>{Oe||ae(null)},contactId:ge||"",contactName:he})]})})}function Fjt(){return Yt({queryKey:["video-script-categories"],queryFn:async()=>{const{data:t,error:e}=await J.from("video_script_categories").select("*").order("sort_order");if(e)throw e;return t}})}function zjt(t){return Yt({queryKey:["video-scripts",t],queryFn:async()=>{let e=J.from("video_scripts").select("*, category:video_script_categories(*)").eq("is_active",!0).order("title");const{data:n,error:s}=await e;if(s)throw s;return n}})}function Bjt(){const{user:t}=Qr();return Yt({queryKey:["user-video-scripts",t==null?void 0:t.id],queryFn:async()=>{if(!(t!=null&&t.id))return[];const{data:e,error:n}=await J.from("user_video_scripts").select("*, category:video_script_categories(*)").eq("owner_user_id",t.id).order("title");if(n)throw n;return e},enabled:!!(t!=null&&t.id)})}function $jt(){const{user:t}=Qr(),e=Vr();return cr({mutationFn:async n=>{if(!(t!=null&&t.id))throw new Error("Not authenticated");const{data:s,error:a}=await J.from("user_video_scripts").insert([{owner_user_id:t.id,source_script_id:n.id,category_id:n.category_id,title:n.title,script_text:n.script_text,tags:n.tags,is_custom:!1}]).select().single();if(a)throw a;return s},onSuccess:()=>{e.invalidateQueries({queryKey:["user-video-scripts"]})}})}function Ujt(t){const{user:e}=Qr();return Yt({queryKey:["agent-videos",e==null?void 0:e.id,t],queryFn:async()=>{if(!(e!=null&&e.id))return[];let n=J.from("agent_videos").select("*, contact:innercircle_contacts(id, first_name, last_name)").eq("owner_user_id",e.id).order("created_at",{ascending:!1});n=n.eq("is_deleted",!1);const{data:s,error:a}=await n;if(a)throw a;return s},enabled:!!(e!=null&&e.id)})}function qjt(t){return Yt({queryKey:["agent-video",t],queryFn:async()=>{const{data:e,error:n}=await J.from("agent_videos").select("*, contact:innercircle_contacts(id, first_name, last_name)").eq("id",t).single();if(n)throw n;return e},enabled:!!t})}function jze(){const{user:t}=Qr(),e=Vr();return cr({mutationFn:async n=>{if(!(t!=null&&t.id))throw new Error("Not authenticated");const{data:s,error:a}=await J.from("agent_videos").insert([{owner_user_id:t.id,contact_id:n.contact_id,bunny_video_id:n.bunny_video_id,playback_url:n.playback_url,thumbnail_url:n.thumbnail_url,preview_url:n.preview_url,duration_seconds:n.duration_seconds,file_size_mb:n.file_size_mb||0,title:n.title,notes:n.notes,task_id:n.task_id,status:n.status||"processing",touch_type:n.touch_type||"video",page_template:"default"}]).select("*, share_token").single();if(a)throw a;return s},onSuccess:()=>{e.invalidateQueries({queryKey:["agent-videos"]}),e.invalidateQueries({queryKey:["storage-usage"]})}})}function Vjt(){const t=Vr();return cr({mutationFn:async({id:e,bunnyVideoId:n,hardDelete:s=!1})=>{if(console.log("Deleting video:",{id:e,bunnyVideoId:n,hardDelete:s}),n){console.log("Calling bunny-upload delete for videoId:",n);const{data:a,error:o}=await J.functions.invoke("bunny-upload",{body:{action:"delete",videoId:n,isAgentVideo:!0}});o?console.error("Failed to delete from Bunny:",o):console.log("Bunny delete response:",a)}else console.warn("No bunnyVideoId provided, skipping Bunny.net deletion");if(s){console.log("Hard deleting from database:",e);const{error:a}=await J.from("agent_videos").delete().eq("id",e);if(a)throw a}else{console.log("Soft deleting from database:",e);const{error:a}=await J.from("agent_videos").update({is_deleted:!0}).eq("id",e);if(a)throw a}console.log("Video deletion complete")},onSuccess:()=>{t.invalidateQueries({queryKey:["agent-videos"]}),t.invalidateQueries({queryKey:["storage-usage"]})}})}function bye(){const{user:t}=Qr();return Yt({queryKey:["storage-usage",t==null?void 0:t.id],queryFn:async()=>{if(!(t!=null&&t.id))return null;const{data:e,error:n}=await J.from("agent_storage_usage").select("*").eq("user_id",t.id).maybeSingle();if(n)throw n;return e||{user_id:t.id,total_storage_mb:0,storage_tier:"basic",max_storage_mb:1024}},enabled:!!(t!=null&&t.id)})}function Hjt(){const{data:t,isLoading:e}=bye(),n=t?t.total_storage_mb0?t.total_storage_mb/t.max_storage_mb*100:0,o=a>=80;return{canRecord:n,remainingMb:s,usagePercent:a,isNearLimit:o,storage:t,isLoading:e}}async function Wjt(t){const{data:e,error:n}=await J.functions.invoke("bunny-upload",{body:{action:"create",title:t,isAgentVideo:!0}});if(n)throw n;return e}async function Gjt(t){const{data:e,error:n}=await J.functions.invoke("bunny-upload",{body:{action:"upload-url",videoId:t,isAgentVideo:!0}});if(n)throw n;return e}async function Kjt(t){const{data:e,error:n}=await J.functions.invoke("bunny-upload",{body:{action:"status",videoId:t,isAgentVideo:!0}});if(n)throw n;return e}function Zjt(){const{user:t}=Qr(),e=Vr();return cr({mutationFn:async({contactId:n,videoId:s,notes:a})=>{if(!(t!=null&&t.id))throw new Error("Not authenticated");const{data:o}=await J.from("action_types").select("id").eq("name","Video").single();if(!o)throw new Error("Video action type not found");const{data:l,error:i}=await J.from("contact_touch_logs").insert([{owner_user_id:t.id,contact_id:n,action_type_id:o.id,notes:a||`Quick Video Touch - Video ID: ${s}`}]).select().single();if(i)throw i;return l},onSuccess:()=>{e.invalidateQueries({queryKey:["contact-touch-logs"]}),e.invalidateQueries({queryKey:["contacts"]})}})}function Yjt(t){return Yt({queryKey:["contact-video-replies",t],queryFn:async()=>{if(!t)return[];const{data:e,error:n}=await J.from("video_replies").select(` *, video:agent_videos(id, title, thumbnail_url, playback_url) `).eq("contact_id",t).order("created_at",{ascending:!1});if(n)throw n;return e},enabled:!!t})}function Xjt({videoId:t}){var l;const{data:e,isLoading:n,error:s}=qjt(t);if(n)return r.jsxs("div",{className:"space-y-4",children:[r.jsx(Ir,{className:"w-full aspect-video rounded-lg"}),r.jsx(Ir,{className:"h-4 w-1/3"})]});if(s||!e||e.is_deleted)return r.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[r.jsx(Vh,{className:"h-12 w-12 text-muted-foreground mb-4"}),r.jsx("h3",{className:"font-medium",children:"Video Unavailable"}),r.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"This video has been deleted or is no longer available."})]});const a=i=>{let h=i;return h.includes("iframe.mediadelivery.net/play/")&&(h=h.replace("/play/","/embed/"),h+=(h.includes("?")?"&":"?")+"autoplay=true&responsive=true"),h},o=(l=e.playback_url)==null?void 0:l.includes("iframe.mediadelivery.net");return r.jsxs("div",{className:"space-y-4",children:[e.playback_url?r.jsx("div",{className:"relative w-full aspect-video bg-black rounded-lg overflow-hidden",children:o?r.jsx("iframe",{src:a(e.playback_url),title:e.title||"Video preview",className:"absolute top-0 left-0 w-full h-full",style:{border:0},allow:"accelerometer; gyroscope; autoplay; encrypted-media; picture-in-picture",allowFullScreen:!0}):r.jsx("video",{src:e.playback_url,controls:!0,autoPlay:!0,className:"absolute top-0 left-0 w-full h-full object-contain"})}):r.jsx("div",{className:"w-full aspect-video bg-muted rounded-lg flex items-center justify-center",children:r.jsx("p",{className:"text-muted-foreground",children:"Video is still processing..."})}),e.title&&r.jsxs("div",{children:[r.jsx("h4",{className:"font-medium",children:e.title}),e.notes&&r.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:e.notes})]})]})}function Qjt(){var Ne,Be;const{contactId:t}=Zc(),e=rs(),[n]=$d(),s=n.get("search")||"",a=n.get("type")||"all",o=n.get("status")||"all",{data:l,isLoading:i}=mft(t||""),{data:h}=Sm(),{data:p}=yxe(),{data:x}=yse(365),{data:y}=Vse(365),{data:b}=Yjt(t),{contactsWithScores:j}=_xe(),C=n8e(),N=xxe(),A=a8e(),[E,T]=I.useState(!1),[L,z]=I.useState({}),[F,q]=I.useState(!1),[H,Z]=I.useState(null),[G,te]=I.useState(""),[ie,le]=I.useState(null),ye=Ee=>{if(!Ee)return null;const Ue=Ee.match(/Video ID:\s*([a-f0-9-]+)/i);return Ue?Ue[1]:null},ne=I.useMemo(()=>{if(!j)return[];let Ee=j.filter(Ue=>{var et,Te,Ze;const Re=s===""||`${Ue.first_name} ${Ue.last_name}`.toLowerCase().includes(s.toLowerCase())||((et=Ue.email)==null?void 0:et.toLowerCase().includes(s.toLowerCase()))||((Te=Ue.phone)==null?void 0:Te.includes(s)),je=a==="all"||((Ze=Ue.tags)==null?void 0:Ze.some(pe=>pe.relationship_type_id===a));return Re&&je});return o==="not-touched-90"?Ee=Ee.filter(Ue=>{const Re=Ue.relationshipScore.daysSinceTouch;return Re===null||Re>90}):o==="at-risk"?Ee=Ee.filter(Ue=>Ue.relationshipScore.status==="at-risk"):o==="cooling"?Ee=Ee.filter(Ue=>Ue.relationshipScore.status==="cooling"):o==="warm"&&(Ee=Ee.filter(Ue=>Ue.relationshipScore.status==="warm")),Ee.map(Ue=>Ue.id)},[j,s,a,o]),ge=ne.indexOf(t||""),ae=ge>0?ne[ge-1]:null,he=ge1&&ge!==-1,_e=Ee=>{const Ue=new URLSearchParams;s&&Ue.set("search",s),a!=="all"&&Ue.set("type",a),o!=="all"&&Ue.set("status",o);const Re=Ue.toString();return`/mission-control/contacts/${Ee}${Re?`?${Re}`:""}`},Ae=I.useMemo(()=>{const Ee=((x==null?void 0:x.filter(Re=>Re.contact_id===t))||[]).map(Re=>{var et,Te;const je=ye(Re.notes);return{id:Re.id,type:"touch",completed_at:Re.completed_at,name:((et=Re.action_type)==null?void 0:et.name)||"Touch",color:((Te=Re.action_type)==null?void 0:Te.color)||"#3B82F6",notes:Re.notes,videoId:je}}),Ue=((y==null?void 0:y.filter(Re=>Re.contact_id===t))||[]).map(Re=>({id:Re.id,type:"popby",completed_at:Re.completed_at,name:"Pop-by",color:"#F97316",notes:Re.notes,videoId:null}));return[...Ee,...Ue].sort((Re,je)=>new Date(je.completed_at).getTime()-new Date(Re.completed_at).getTime())},[x,y,t]),Ce=()=>{var Ee;l&&(z({first_name:l.first_name||"",last_name:l.last_name||"",email:l.email||"",phone:l.phone||"",address:l.address||"",city:l.city||"",state:l.state||"",zip_code:l.zip_code||"",birthday:l.birthday||"",home_anniversary:l.home_anniversary||"",spouse_name:l.spouse_name||"",spouse_email:l.spouse_email||"",company_name:l.company_name||"",job_title:l.job_title||"",notes:l.notes||"",tagIds:((Ee=l.tags)==null?void 0:Ee.map(Ue=>Ue.relationship_type_id))||[]}),T(!0))},be=async()=>{await C.mutateAsync({id:t,...L}),T(!1)},me=async()=>{confirm("Are you sure you want to delete this contact?")&&(await N.mutateAsync(t),e("/mission-control/contacts"))},Le=async()=>{H&&(await A.mutateAsync({contactId:t,actionTypeId:H,notes:G}),q(!1),Z(null),te(""))};return i?r.jsx(Lr,{title:"Contact Details",children:r.jsx("div",{className:"flex items-center justify-center py-12",children:r.jsx("div",{className:"animate-spin h-8 w-8 border-4 border-primary border-t-transparent rounded-full"})})}):l?r.jsx(Lr,{title:`${l.first_name} ${l.last_name||""}`,description:"Contact details and activity",children:r.jsxs("div",{className:"space-y-6 overflow-x-hidden",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs(ee,{variant:"ghost",size:"sm",onClick:()=>e("/mission-control/contacts"),children:[r.jsx(Tc,{className:"h-4 w-4 mr-1"}),"Back to Contacts"]}),ue&&r.jsxs("div",{className:"flex items-center gap-1 ml-2 border-l pl-2",children:[r.jsxs(ee,{variant:"ghost",size:"sm",onClick:()=>ae&&e(_e(ae)),disabled:!ae,className:"px-2",children:[r.jsx(Tc,{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:[ge+1," of ",ne.length]}),r.jsxs(ee,{variant:"ghost",size:"sm",onClick:()=>he&&e(_e(he)),disabled:!he,className:"px-2",children:[r.jsx("span",{className:"sr-only sm:not-sr-only sm:mr-1",children:"Next"}),r.jsx(Vi,{className:"h-4 w-4"})]})]})]}),r.jsxs("div",{className:"flex items-center gap-2 w-full sm:w-auto justify-end flex-wrap",children:[r.jsxs(ee,{variant:"default",onClick:()=>e(`/mission-control/video/record?contact_id=${t}`),className:"bg-gradient-to-r from-primary to-primary/80",children:[r.jsx(Pa,{className:"h-4 w-4 mr-1"}),"Quick Video Touch"]}),r.jsxs(Fr,{open:F,onOpenChange:q,children:[r.jsx(zo,{asChild:!0,children:r.jsxs(ee,{variant:"outline",children:[r.jsx(bn,{className:"h-4 w-4 mr-1"}),"Log Action"]})}),r.jsxs(Rr,{children:[r.jsx(qr,{children:r.jsx($r,{children:"Log an Action"})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx(He,{children:"Action Type"}),r.jsx("div",{className:"grid grid-cols-2 gap-2 mt-2",children:p==null?void 0:p.filter(Ee=>Ee.active).map(Ee=>r.jsxs("button",{onClick:()=>Z(Ee.id),className:` p-3 rounded-lg border text-left transition-all ${H===Ee.id?"border-primary bg-primary/10":"hover:bg-accent"} `,children:[r.jsx("div",{className:"font-medium",children:Ee.name}),r.jsx("div",{className:"text-xs text-muted-foreground",children:Ee.description})]},Ee.id))})]}),r.jsxs("div",{children:[r.jsx(He,{htmlFor:"action-notes",children:"Notes (optional)"}),r.jsx(ps,{id:"action-notes",value:G,onChange:Ee=>te(Ee.target.value),placeholder:"Add any notes about this interaction...",rows:3})]}),r.jsxs(ee,{onClick:Le,disabled:!H||A.isPending,className:"w-full",children:[r.jsx(Ai,{className:"h-4 w-4 mr-1"}),"Complete Action"]})]})]})]}),r.jsxs(ee,{variant:"outline",onClick:Ce,children:[r.jsx(ac,{className:"h-4 w-4 mr-1"}),"Edit"]}),r.jsx(ee,{variant:"destructive",size:"icon",onClick:me,children:r.jsx(Vn,{className:"h-4 w-4"})})]})]}),r.jsx("div",{className:"bg-card border rounded-lg p-4 sm:p-6",children:r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center gap-4",children:[r.jsxs("div",{className:"flex-1",children:[r.jsxs("h1",{className:"text-2xl sm:text-3xl font-bold",children:[l.first_name," ",l.last_name||""]}),r.jsxs("div",{className:"flex flex-wrap items-center gap-3 mt-2 text-muted-foreground",children:[l.email&&r.jsxs("a",{href:`mailto:${l.email}`,className:"flex items-center gap-1 hover:text-primary transition-colors",children:[r.jsx(da,{className:"h-4 w-4"}),r.jsx("span",{className:"text-sm",children:l.email})]}),l.phone&&r.jsxs("a",{href:`tel:${l.phone}`,className:"flex items-center gap-1 hover:text-primary transition-colors",children:[r.jsx(bi,{className:"h-4 w-4"}),r.jsx("span",{className:"text-sm",children:l.phone})]})]})]}),r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsx(afe,{contact:l}),(Ne=l.tags)==null?void 0:Ne.map(Ee=>{const Ue=h==null?void 0:h.find(Re=>Re.id===Ee.relationship_type_id);return Ue?r.jsx(Ot,{variant:"secondary",className:"text-xs",children:Ue.name},Ee.id):null})]})]})}),r.jsxs("div",{className:"grid md:grid-cols-3 gap-6",children:[r.jsxs(Ye,{className:"md:col-span-2",children:[r.jsx(Gt,{children:r.jsx(Zt,{children:"Contact Information"})}),r.jsx(tt,{children:E?r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx(He,{htmlFor:"first_name",children:"First Name"}),r.jsx(dt,{id:"first_name",value:L.first_name,onChange:Ee=>z({...L,first_name:Ee.target.value})})]}),r.jsxs("div",{children:[r.jsx(He,{htmlFor:"last_name",children:"Last Name"}),r.jsx(dt,{id:"last_name",value:L.last_name,onChange:Ee=>z({...L,last_name:Ee.target.value})})]})]}),r.jsxs("div",{children:[r.jsx(He,{htmlFor:"email",children:"Email"}),r.jsx(dt,{id:"email",type:"email",value:L.email,onChange:Ee=>z({...L,email:Ee.target.value})})]}),r.jsxs("div",{children:[r.jsx(He,{htmlFor:"phone",children:"Phone"}),r.jsx(dt,{id:"phone",value:L.phone,onChange:Ee=>z({...L,phone:Ee.target.value})})]}),r.jsxs("div",{children:[r.jsx(He,{htmlFor:"address",children:"Street Address"}),r.jsx(dt,{id:"address",value:L.address,onChange:Ee=>z({...L,address:Ee.target.value}),placeholder:"123 Main St"})]}),r.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-4",children:[r.jsxs("div",{className:"col-span-2",children:[r.jsx(He,{htmlFor:"city",children:"City"}),r.jsx(dt,{id:"city",value:L.city,onChange:Ee=>z({...L,city:Ee.target.value}),placeholder:"City"})]}),r.jsxs("div",{children:[r.jsx(He,{htmlFor:"state",children:"State"}),r.jsx(dt,{id:"state",value:L.state,onChange:Ee=>z({...L,state:Ee.target.value}),placeholder:"TX",maxLength:2})]}),r.jsxs("div",{children:[r.jsx(He,{htmlFor:"zip_code",children:"Zip Code"}),r.jsx(dt,{id:"zip_code",value:L.zip_code,onChange:Ee=>z({...L,zip_code:Ee.target.value}),placeholder:"12345"})]})]}),r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx(He,{htmlFor:"birthday",children:"Birthday"}),r.jsx(dt,{id:"birthday",type:"date",value:L.birthday,onChange:Ee=>z({...L,birthday:Ee.target.value})})]}),r.jsxs("div",{children:[r.jsx(He,{htmlFor:"home_anniversary",children:"Home Anniversary"}),r.jsx(dt,{id:"home_anniversary",type:"date",value:L.home_anniversary,onChange:Ee=>z({...L,home_anniversary:Ee.target.value})})]})]}),r.jsx(ou,{}),r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx(He,{htmlFor:"spouse_name",children:"Spouse/Partner Name"}),r.jsx(dt,{id:"spouse_name",value:L.spouse_name,onChange:Ee=>z({...L,spouse_name:Ee.target.value}),placeholder:"Enter spouse name"})]}),r.jsxs("div",{children:[r.jsx(He,{htmlFor:"spouse_email",children:"Spouse/Partner Email"}),r.jsx(dt,{id:"spouse_email",type:"email",value:L.spouse_email,onChange:Ee=>z({...L,spouse_email:Ee.target.value}),placeholder:"Enter spouse email"})]})]}),r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx(He,{htmlFor:"company_name",children:"Company"}),r.jsx(dt,{id:"company_name",value:L.company_name,onChange:Ee=>z({...L,company_name:Ee.target.value}),placeholder:"Enter company name"})]}),r.jsxs("div",{children:[r.jsx(He,{htmlFor:"job_title",children:"Job Title"}),r.jsx(dt,{id:"job_title",value:L.job_title,onChange:Ee=>z({...L,job_title:Ee.target.value}),placeholder:"Enter job title"})]})]}),r.jsxs("div",{children:[r.jsx(He,{children:"Relationship Types"}),r.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:h==null?void 0:h.filter(Ee=>Ee.active).map(Ee=>{var Ue;return r.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[r.jsx(Dl,{checked:(Ue=L.tagIds)==null?void 0:Ue.includes(Ee.id),onCheckedChange:Re=>{var je;z(Re?{...L,tagIds:[...L.tagIds||[],Ee.id]}:{...L,tagIds:(je=L.tagIds)==null?void 0:je.filter(et=>et!==Ee.id)})}}),r.jsx("span",{className:"text-sm",children:Ee.name})]},Ee.id)})})]}),r.jsxs("div",{children:[r.jsx(He,{htmlFor:"notes",children:"Notes"}),r.jsx(ps,{id:"notes",value:L.notes,onChange:Ee=>z({...L,notes:Ee.target.value}),rows:4})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(ee,{onClick:be,disabled:C.isPending,children:"Save Changes"}),r.jsx(ee,{variant:"outline",onClick:()=>T(!1),children:"Cancel"})]})]}):r.jsxs("div",{className:"space-y-4",children:[Ae.length>0&&r.jsxs("div",{className:"bg-muted/50 rounded-lg p-3 flex items-center gap-2",children:[r.jsx(zs,{className:"h-4 w-4 text-primary"}),r.jsxs("span",{className:"text-sm",children:[r.jsx("span",{className:"font-medium",children:"Last Contacted:"})," ",yn(new Date(Ae[0].completed_at),"MMM d, yyyy")," ","(",Ae[0].name,")"]})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row sm:gap-6 gap-2",children:[l.email&&r.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[r.jsx(da,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),r.jsx("a",{href:`mailto:${l.email}`,className:"text-primary hover:underline truncate",children:l.email})]}),l.phone&&r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(bi,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),r.jsx("a",{href:`tel:${l.phone}`,className:"text-primary hover:underline",children:l.phone})]})]}),(l.address||l.city||l.state||l.zip_code)&&r.jsxs("div",{className:"flex items-start gap-2",children:[r.jsx(fl,{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(zs,{className:"h-4 w-4 text-muted-foreground"}),r.jsxs("span",{children:["Birthday: ",yn(new Date(l.birthday),"MMMM d")]})]}),l.home_anniversary&&r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(pa,{className:"h-4 w-4 text-muted-foreground"}),r.jsxs("span",{children:["Home Anniversary: ",yn(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(ou,{}),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(Ec,{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(da,{className:"h-4 w-4 text-muted-foreground"}),r.jsx("a",{href:`mailto:${l.spouse_email}`,className:"text-primary hover:underline",children:l.spouse_email})]})]}),(l.company_name||l.job_title)&&r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(ai,{className:"h-4 w-4 text-muted-foreground"}),r.jsx("span",{children:l.job_title&&l.company_name?`${l.job_title} at ${l.company_name}`:l.job_title||l.company_name})]})]})]}),r.jsx(ou,{}),r.jsxs("div",{children:[r.jsx("h4",{className:"font-medium mb-2",children:"Relationship Types"}),r.jsx("div",{className:"flex flex-wrap gap-2",children:(Be=l.tags)!=null&&Be.length?l.tags.map(Ee=>{var Ue;return r.jsx(Ot,{variant:"secondary",children:(Ue=Ee.relationship_type)==null?void 0:Ue.name},Ee.id)}):r.jsx("span",{className:"text-sm text-muted-foreground",children:"No relationship types assigned"})})]}),l.notes&&r.jsxs(r.Fragment,{children:[r.jsx(ou,{}),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(jjt,{contact:l,onLogTouch:()=>q(!0)}),r.jsxs(Ye,{children:[r.jsx(Gt,{children:r.jsx(Zt,{children:"Activity Log"})}),r.jsx(tt,{children:Ae.length>0?r.jsx("div",{className:"space-y-4",children:Ae.map(Ee=>{var Ue;return r.jsxs("div",{className:"flex items-start gap-3 pb-3 border-b last:border-0",children:[r.jsx("div",{className:"h-8 w-8 rounded-full flex items-center justify-center text-white text-xs",style:{backgroundColor:Ee.color},children:Ee.type==="popby"?r.jsx(Ki,{className:"h-4 w-4"}):(Ue=Ee.name)==null?void 0:Ue.charAt(0)}),r.jsxs("div",{className:"flex-1",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"font-medium text-sm",children:Ee.name}),Ee.videoId&&r.jsxs(ee,{variant:"ghost",size:"sm",className:"h-6 px-2 text-xs",onClick:()=>le(Ee.videoId),children:[r.jsx(hc,{className:"h-3 w-3 mr-1"}),"Preview"]})]}),r.jsx("div",{className:"text-xs text-muted-foreground",children:yn(new Date(Ee.completed_at),"MMM d, yyyy h:mm a")}),Ee.notes&&!Ee.videoId&&r.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:Ee.notes})]})]},Ee.id)})}):r.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:"No activity logged yet"})})]}),b&&b.length>0&&r.jsxs(Ye,{children:[r.jsx(Gt,{children:r.jsxs(Zt,{className:"flex items-center gap-2",children:[r.jsx(Lo,{className:"h-5 w-5 text-primary"}),"Video Replies"]})}),r.jsx(tt,{children:r.jsx("div",{className:"space-y-4",children:b.map(Ee=>{var Ue,Re;return r.jsxs("div",{className:"flex items-start gap-3 pb-3 border-b last:border-0",children:[(Ue=Ee.video)!=null&&Ue.thumbnail_url?r.jsx("img",{src:Ee.video.thumbnail_url,alt:Ee.video.title||"Video",className:"h-12 w-16 object-cover rounded cursor-pointer hover:opacity-80 transition-opacity",onClick:()=>le(Ee.video_id)}):r.jsx("div",{className:"h-12 w-16 bg-muted rounded flex items-center justify-center cursor-pointer hover:bg-muted/80 transition-colors",onClick:()=>le(Ee.video_id),children:r.jsx(Pa,{className:"h-5 w-5 text-muted-foreground"})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs("span",{className:"font-medium text-sm truncate",children:["Replied to: ",((Re=Ee.video)==null?void 0:Re.title)||"Untitled Video"]}),r.jsxs(ee,{variant:"ghost",size:"sm",className:"h-6 px-2 text-xs flex-shrink-0",onClick:()=>le(Ee.video_id),children:[r.jsx(hc,{className:"h-3 w-3 mr-1"}),"Watch"]})]}),r.jsx("div",{className:"text-xs text-muted-foreground",children:yn(new Date(Ee.created_at),"MMM d, yyyy h:mm a")}),Ee.message&&r.jsxs("p",{className:"text-sm text-muted-foreground mt-1 line-clamp-2",children:['"',Ee.message,'"']})]})]},Ee.id)})})})]})]}),r.jsx(Fr,{open:!!ie,onOpenChange:Ee=>!Ee&&le(null),children:r.jsxs(Rr,{className:"max-w-2xl",children:[r.jsx(qr,{children:r.jsx($r,{children:"Video Preview"})}),ie&&r.jsx(Xjt,{videoId:ie})]})})]})]})}):r.jsx(Lr,{title:"Contact Not Found",children:r.jsxs("div",{className:"text-center py-12",children:[r.jsx("p",{className:"text-muted-foreground mb-4",children:"This contact was not found."}),r.jsx(ee,{onClick:()=>e("/mission-control/contacts"),children:"Back to Contacts"})]})})}const f4e={Crown:u1,FileText:La,Users:Bn,Globe:Ux,Star:vs,Phone:bi,MessageSquare:Lo,PenTool:vj,Video:Pa,Gift:Ki},Oce=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Jjt(){var gt,mt;const t=rs(),{user:e}=Qr(),{data:n}=Sm(),{data:s}=xft(),{data:a}=kft(),{data:o}=r8e(),{data:l}=yxe(),{data:i}=gft(),h=Nft(),p=yft(),x=_ft(),y=bft(),b=wft(),j=jft(),C=vft(),[N,A]=I.useState(null),[E,T]=I.useState(!1),[L,z]=I.useState(null),[F,q]=I.useState(""),[H,Z]=I.useState(""),[G,te]=I.useState([]),[ie,le]=I.useState(null),[ye,ne]=I.useState(null),[ge,ae]=I.useState(!1),[he,ue]=I.useState(""),[_e,Ae]=I.useState(""),[Ce,be]=I.useState(""),[me,Le]=I.useState(""),Ne=(Mt,wt)=>a==null?void 0:a.some(Qt=>Qt.plan_id===Mt&&Qt.relationship_type_id===wt&&Qt.active),Be=Mt=>a==null?void 0:a.find(wt=>wt.relationship_type_id===Mt&&wt.active),Ee=async(Mt,wt)=>{const Qt=Ne(Mt,wt);await h.mutateAsync({planId:Mt,relationshipTypeId:wt,active:!Qt})},Ue=(s==null?void 0:s.filter(Mt=>Mt.active&&!Mt.owner_user_id))||[],Re=(s==null?void 0:s.filter(Mt=>Mt.owner_user_id===(e==null?void 0:e.id)))||[],je=n==null?void 0:n.find(Mt=>Mt.id===N),et=N?Be(N):null,Te=s==null?void 0:s.find(Mt=>Mt.id===(et==null?void 0:et.plan_id)),Ze=async()=>{if(!F.trim())return;const Mt=await p.mutateAsync({name:F,description:H});Mt&&G.length>0&&await b.mutateAsync({planId:Mt.id,items:G}),rt()},pe=async()=>{!F.trim()||!L||(await x.mutateAsync({id:L,name:F,description:H}),await b.mutateAsync({planId:L,items:G}),rt())},yt=Mt=>{var wt;z(Mt.id),q(Mt.name),Z(Mt.description||""),te(((wt=Mt.items)==null?void 0:wt.map(Qt=>({month_number:Qt.month_number,action_type_id:Qt.action_type_id,default_script_id:Qt.default_script_id||void 0,notes:Qt.notes||void 0})))||[]),T(!0)},rt=()=>{T(!1),z(null),q(""),Z(""),te([])},at=(Mt,wt)=>{ne(wt)},Me=(Mt,wt,Qt)=>{te(Cr=>[...Cr.filter(jn=>jn.month_number!==Mt),{month_number:Mt,action_type_id:wt,default_script_id:Qt}]),le(null),ne(null)},ft=Mt=>{te(wt=>wt.filter(Qt=>Qt.month_number!==Mt))},qe=async()=>{if(!he.trim()||!_e.trim()||!ye)return;const Mt=await j.mutateAsync({actionTypeId:ye,title:he,scriptBody:_e,emailSubject:Ce||void 0,tone:me||void 0});Mt&&ie!==null&&Me(ie,ye,Mt.id),ae(!1),ue(""),Ae(""),be(""),Le("")},Oe=ye?i==null?void 0:i.filter(Mt=>Mt.action_type_id===ye&&Mt.active):[],Qe=Mt=>f4e[Mt||"Phone"]||bi,nt=Mt=>f4e[Mt||"Users"]||Bn;return r.jsxs(Lr,{title:"Touchpoint Plans",description:"Assign plans to your contact groups",children:[r.jsxs("div",{className:"space-y-6 overflow-x-hidden",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("h1",{className:"text-2xl font-bold",children:"Touchpoint Plans"}),r.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wide px-1.5 py-0.5 rounded border border-amber-500 text-amber-600 dark:text-amber-400 bg-amber-500/10",children:"Beta"})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3",children:[r.jsxs(ee,{variant:"ghost",size:"sm",onClick:()=>t("/mission-control"),children:[r.jsx(Tc,{className:"h-4 w-4 mr-1"}),"Back"]}),r.jsxs(ee,{onClick:()=>T(!0),className:"w-full sm:w-auto",children:[r.jsx(bn,{className:"h-4 w-4 mr-2"}),"Create Custom Plan"]})]}),r.jsxs("div",{className:"grid lg:grid-cols-3 gap-6",children:[r.jsxs("div",{className:"space-y-3",children:[r.jsx("h3",{className:"font-semibold text-lg",children:"Your Contact Groups"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Select a group to assign a touchpoint plan"}),n==null?void 0:n.filter(Mt=>Mt.active).map(Mt=>{const wt=nt(Mt.icon),Qt=(o==null?void 0:o[Mt.id])||0,Cr=Be(Mt.id),cn=s==null?void 0:s.find(Xr=>Xr.id===(Cr==null?void 0:Cr.plan_id)),jn=N===Mt.id;return r.jsxs("button",{onClick:()=>A(Mt.id),className:` w-full flex items-center gap-3 p-4 rounded-lg border text-left transition-all ${jn?"border-primary bg-primary/5 ring-2 ring-primary":"hover:bg-accent"} `,children:[r.jsx(wt,{className:"h-5 w-5 text-muted-foreground"}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("div",{className:"font-medium",children:Mt.name}),r.jsxs("div",{className:"text-sm text-muted-foreground",children:[Qt," contacts"]})]}),cn?r.jsxs(Ot,{variant:"secondary",className:"text-xs",children:[r.jsx(Yi,{className:"h-3 w-3 mr-1"}),cn.name.split(" ")[0]]}):r.jsx(Ot,{variant:"outline",className:"text-xs text-muted-foreground",children:"No plan"})]},Mt.id)})]}),r.jsx("div",{className:"lg:col-span-2",children:N&&je?r.jsxs(Ye,{children:[r.jsxs(Gt,{children:[r.jsxs(Zt,{className:"flex items-center gap-2",children:[(()=>{const Mt=nt(je.icon);return r.jsx(Mt,{className:"h-5 w-5"})})(),je.name," Touchpoint Plan"]}),r.jsxs(Mn,{children:["Choose a plan for your ",je.name," contacts"]})]}),r.jsxs(tt,{className:"space-y-6",children:[Te&&r.jsxs("div",{className:"p-4 bg-primary/5 rounded-lg border border-primary/20",children:[r.jsxs("div",{className:"flex items-center justify-between mb-3",children:[r.jsxs("div",{children:[r.jsxs("div",{className:"font-medium flex items-center gap-2",children:[r.jsx(Yi,{className:"h-4 w-4 text-green-500"}),"Currently using: ",Te.name]}),Te.description&&r.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:Te.description})]}),r.jsx(ee,{variant:"outline",size:"sm",onClick:()=>Ee(Te.id,N),children:"Disable"})]}),Te.items&&Te.items.length>0&&r.jsxs("div",{className:"mt-4",children:[r.jsxs("div",{className:"text-sm font-medium mb-2 flex items-center gap-2",children:[r.jsx(zs,{className:"h-4 w-4"}),"12-Month Schedule"]}),r.jsx("div",{className:"grid grid-cols-4 sm:grid-cols-6 gap-2",children:Oce.map((Mt,wt)=>{var jn,Xr;const Qt=((jn=Te.items)==null?void 0:jn.filter(Pn=>Pn.month_number===wt+1))||[],Cr=(Xr=Qt[0])==null?void 0:Xr.action_type,cn=Cr?Qe(Cr.icon):null;return r.jsxs("div",{className:` p-2 rounded border text-center ${Qt.length>0?"bg-primary/10 border-primary":"bg-muted"} `,children:[r.jsx("div",{className:"text-xs text-muted-foreground",children:Mt}),cn&&r.jsx(cn,{className:"h-4 w-4 mx-auto mt-1",style:{color:(Cr==null?void 0:Cr.color)||"#3B82F6"}})]},wt)})})]})]}),r.jsxs("div",{children:[r.jsx("h4",{className:"font-medium mb-3",children:Te?"Switch to a Different Plan":"Choose a Plan"}),Ue.length>0&&r.jsxs("div",{className:"space-y-2 mb-4",children:[r.jsx("div",{className:"text-sm text-muted-foreground",children:"Pre-built Templates"}),Ue.map(Mt=>{var Qt;const wt=(Te==null?void 0:Te.id)===Mt.id;return r.jsxs("div",{className:` flex items-center justify-between p-3 rounded-lg border ${wt?"opacity-50":"hover:bg-accent"} `,children:[r.jsxs("div",{children:[r.jsx("div",{className:"font-medium",children:Mt.name}),r.jsxs("div",{className:"text-sm text-muted-foreground",children:[((Qt=Mt.items)==null?void 0:Qt.length)||0," touchpoints/year"]})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(ee,{size:"sm",variant:"ghost",title:"Duplicate as my own plan",disabled:C.isPending,onClick:()=>{const Cr=`${Mt.name} (Copy)`;C.mutate({sourcePlanId:Mt.id,newName:Cr})},children:r.jsx(hl,{className:"h-4 w-4"})}),r.jsx(ee,{size:"sm",variant:wt?"outline":"default",disabled:wt||h.isPending,onClick:()=>Ee(Mt.id,N),children:wt?"Active":"Use This"})]})]},Mt.id)})]}),Re.length>0&&r.jsxs("div",{className:"space-y-2",children:[r.jsx("div",{className:"text-sm text-muted-foreground",children:"My Custom Plans"}),Re.map(Mt=>{var Qt;const wt=(Te==null?void 0:Te.id)===Mt.id;return r.jsxs("div",{className:` flex items-center justify-between p-3 rounded-lg border ${wt?"opacity-50":"hover:bg-accent"} `,children:[r.jsxs("div",{children:[r.jsx("div",{className:"font-medium",children:Mt.name}),r.jsxs("div",{className:"text-sm text-muted-foreground",children:[((Qt=Mt.items)==null?void 0:Qt.length)||0," touchpoints/year"]})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(ee,{size:"sm",variant:"ghost",title:"Edit plan",onClick:()=>yt(Mt),children:r.jsx(g0,{className:"h-4 w-4"})}),r.jsx(ee,{size:"sm",variant:"ghost",title:"Delete plan",onClick:()=>y.mutate(Mt.id),children:r.jsx(Vn,{className:"h-4 w-4 text-destructive"})}),r.jsx(ee,{size:"sm",variant:wt?"outline":"default",disabled:wt||h.isPending,onClick:()=>Ee(Mt.id,N),children:wt?"Active":"Use This"})]})]},Mt.id)})]}),Ue.length===0&&Re.length===0&&r.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:"No plans available. Create a custom plan to get started."})]})]})]}):r.jsx(Ye,{children:r.jsxs(tt,{className:"py-12 text-center text-muted-foreground",children:[r.jsx(zs,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),r.jsx("p",{children:"Select a contact group to view and assign plans"})]})})})]}),r.jsx(Ye,{className:"bg-muted/50",children:r.jsx(tt,{className:"py-4",children:r.jsxs("p",{className:"text-sm text-muted-foreground",children:[r.jsx("strong",{children:"How it works:"})," When you assign a plan to a contact group, those contacts will appear in your daily suggested actions based on the plan's schedule."]})})})]}),r.jsx(Fr,{open:E,onOpenChange:Mt=>{Mt?T(!0):rt()},children:r.jsxs(Rr,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsx(qr,{children:r.jsx($r,{children:L?"Edit Touchpoint Plan":"Create Custom Touchpoint Plan"})}),r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"grid gap-4",children:[r.jsxs("div",{children:[r.jsx(He,{htmlFor:"plan-name",children:"Plan Name"}),r.jsx(dt,{id:"plan-name",value:F,onChange:Mt=>q(Mt.target.value),placeholder:"e.g., My VIP Plan"})]}),r.jsxs("div",{children:[r.jsx(He,{htmlFor:"plan-description",children:"Description (optional)"}),r.jsx(ps,{id:"plan-description",value:H,onChange:Mt=>Z(Mt.target.value),placeholder:"Describe your plan...",rows:2})]})]}),r.jsxs("div",{children:[r.jsx(He,{children:"12-Month Schedule"}),r.jsx("p",{className:"text-sm text-muted-foreground mb-3",children:"Click on a month to add a touchpoint"}),r.jsx("div",{className:"grid grid-cols-6 gap-2",children:Oce.map((Mt,wt)=>{const Qt=wt+1,Cr=G.find(Xr=>Xr.month_number===Qt),cn=Cr?l==null?void 0:l.find(Xr=>Xr.id===Cr.action_type_id):null,jn=cn?Qe(cn.icon):null;return r.jsxs("div",{className:"relative",children:[r.jsxs("button",{type:"button",onClick:()=>le(ie===Qt?null:Qt),className:` w-full p-3 rounded-lg border text-center transition-all ${Cr?"bg-primary/10 border-primary":"bg-muted hover:bg-accent"} ${ie===Qt?"ring-2 ring-primary":""} `,children:[r.jsx("div",{className:"text-xs text-muted-foreground font-medium",children:Mt}),jn?r.jsx(jn,{className:"h-5 w-5 mx-auto mt-1",style:{color:(cn==null?void 0:cn.color)||"#3B82F6"}}):r.jsx(bn,{className:"h-5 w-5 mx-auto mt-1 text-muted-foreground/50"})]}),Cr&&r.jsx("button",{type:"button",onClick:Xr=>{Xr.stopPropagation(),ft(Qt)},className:"absolute -top-1 -right-1 p-1 bg-destructive text-destructive-foreground rounded-full",children:r.jsx(_s,{className:"h-3 w-3"})})]},wt)})}),ie!==null&&!ye&&r.jsxs("div",{className:"mt-4 p-3 bg-muted rounded-lg",children:[r.jsxs("div",{className:"text-sm font-medium mb-2",children:["Step 1: Select action for ",Oce[ie-1],":"]}),r.jsx("div",{className:"flex flex-wrap gap-2",children:l==null?void 0:l.filter(Mt=>Mt.active).map(Mt=>{const wt=Qe(Mt.icon);return r.jsxs("button",{type:"button",onClick:()=>at(ie,Mt.id),className:"flex items-center gap-2 px-3 py-2 rounded-lg border bg-background hover:bg-accent transition-colors",children:[r.jsx(wt,{className:"h-4 w-4",style:{color:Mt.color||"#3B82F6"}}),r.jsx("span",{className:"text-sm",children:Mt.name})]},Mt.id)})})]}),ie!==null&&ye&&r.jsxs("div",{className:"mt-4 p-3 bg-muted rounded-lg space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("div",{className:"text-sm font-medium",children:"Step 2: Select a script (optional)"}),r.jsxs(ee,{variant:"ghost",size:"sm",onClick:()=>ne(null),children:[r.jsx(Tc,{className:"h-4 w-4 mr-1"})," Back"]})]}),r.jsxs("div",{className:"space-y-2 max-h-[300px] overflow-y-auto pr-1",children:[r.jsx("button",{type:"button",onClick:()=>Me(ie,ye),className:"w-full flex items-center gap-3 p-3 rounded-lg border bg-background hover:bg-accent transition-colors text-left",children:r.jsxs("div",{className:"flex-1",children:[r.jsx("div",{className:"font-medium text-sm",children:"No Script"}),r.jsx("div",{className:"text-xs text-muted-foreground",children:"Use without a predefined script"})]})}),Oe==null?void 0:Oe.map(Mt=>r.jsx("button",{type:"button",onClick:()=>Me(ie,ye,Mt.id),className:"w-full flex items-center gap-3 p-3 rounded-lg border bg-background hover:bg-accent transition-colors text-left",children:r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("div",{className:"font-medium text-sm",children:Mt.title}),Mt.tone&&r.jsx(Ot,{variant:"secondary",className:"text-xs mt-1",children:Mt.tone}),r.jsxs("div",{className:"text-xs text-muted-foreground mt-1 line-clamp-2",children:[Mt.script_body.substring(0,100),"..."]})]})},Mt.id)),r.jsxs("button",{type:"button",onClick:()=>ae(!0),className:"w-full flex items-center gap-3 p-3 rounded-lg border border-dashed bg-background hover:bg-accent transition-colors text-left",children:[r.jsx(bn,{className:"h-5 w-5 text-muted-foreground"}),r.jsxs("div",{className:"flex-1",children:[r.jsx("div",{className:"font-medium text-sm",children:"Create Custom Script"}),r.jsx("div",{className:"text-xs text-muted-foreground",children:"Write your own script for this action"})]})]})]})]})]}),G.length>0&&r.jsxs("div",{className:"text-sm text-muted-foreground",children:[G.length," touchpoint",G.length!==1?"s":""," per year"]})]}),r.jsxs(ea,{children:[r.jsx(ee,{variant:"outline",onClick:rt,children:"Cancel"}),r.jsxs(ee,{onClick:L?pe:Ze,disabled:!F.trim()||p.isPending||x.isPending,children:[r.jsx(vg,{className:"h-4 w-4 mr-2"}),L?"Save Changes":"Create Plan"]})]})]})}),r.jsx(Fr,{open:ge,onOpenChange:ae,children:r.jsxs(Rr,{className:"max-w-lg",children:[r.jsx(qr,{children:r.jsx($r,{children:"Create Custom Script"})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx(He,{htmlFor:"script-title",children:"Script Title"}),r.jsx(dt,{id:"script-title",value:he,onChange:Mt=>ue(Mt.target.value),placeholder:"e.g., Friendly Check-in Call"})]}),r.jsxs("div",{children:[r.jsx(He,{htmlFor:"script-tone",children:"Tone (optional)"}),r.jsxs(gn,{value:me,onValueChange:Le,children:[r.jsx(fn,{children:r.jsx(xn,{placeholder:"Select tone..."})}),r.jsxs(pn,{children:[r.jsx(Vt,{value:"friendly",children:"Friendly"}),r.jsx(Vt,{value:"professional",children:"Professional"}),r.jsx(Vt,{value:"casual",children:"Casual"}),r.jsx(Vt,{value:"formal",children:"Formal"})]})]})]}),((mt=(gt=l==null?void 0:l.find(Mt=>Mt.id===ye))==null?void 0:gt.name)==null?void 0:mt.toLowerCase().includes("email"))&&r.jsxs("div",{children:[r.jsx(He,{htmlFor:"script-email-subject",children:"Email Subject"}),r.jsx(dt,{id:"script-email-subject",value:Ce,onChange:Mt=>be(Mt.target.value),placeholder:"e.g., Quick Hello!"})]}),r.jsxs("div",{children:[r.jsx(He,{htmlFor:"script-body",children:"Script Content"}),r.jsx(ps,{id:"script-body",value:_e,onChange:Mt=>Ae(Mt.target.value),placeholder:"Write your script here... You can use {{FirstName}} and {{LastName}} as placeholders.",rows:6}),r.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["Tip: Use ","{{FirstName}}"," and ","{{LastName}}"," as placeholders"]})]})]}),r.jsxs(ea,{children:[r.jsx(ee,{variant:"outline",onClick:()=>ae(!1),children:"Cancel"}),r.jsxs(ee,{onClick:qe,disabled:!he.trim()||!_e.trim()||j.isPending,children:[r.jsx(vg,{className:"h-4 w-4 mr-2"}),"Create & Use Script"]})]})]})})]})}const ekt="0dde5abb-0005-4c8c-a471-30d0cbc9e280",tkt=[{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 rkt(){const t=rs(),e=_ze(),{data:n}=xze(),{data:s}=Sm(),{data:a}=_ye(),{data:o}=Vse(90),{data:l}=op(),i=bjt(),h=bze(),p=vjt(),x=_jt(),{data:y=[],isLoading:b}=Yt({queryKey:["popby-templates"],queryFn:async()=>{const{data:ge,error:ae}=await J.from("canva_templates").select(` *, category:template_categories(id, name), type:template_types(id, name) `).eq("category_id",ekt).order("publish_date",{ascending:!1});if(ae)throw ae;const{data:he}=await J.from("template_likes").select("template_id"),{data:ue}=await J.from("template_comments").select("template_id"),_e=new Map;he==null||he.forEach(Ce=>{_e.set(Ce.template_id,(_e.get(Ce.template_id)||0)+1)});const Ae=new Map;return ue==null||ue.forEach(Ce=>{Ae.set(Ce.template_id,(Ae.get(Ce.template_id)||0)+1)}),(ge||[]).map(Ce=>({...Ce,likesCount:_e.get(Ce.id)||0,commentsCount:Ae.get(Ce.id)||0}))}}),j=ge=>{const ae=l==null?void 0:l.find(he=>he.id===ge);return ae?`${ae.first_name} ${ae.last_name||""}`.trim():"Unknown"},C=ge=>{if(!ge)return null;const ae=n==null?void 0:n.find(he=>he.id===ge);return(ae==null?void 0:ae.name)||null},[N,A]=I.useState(null),[E,T]=I.useState(!1),[L,z]=I.useState(!1),[F,q]=I.useState(!1),[H,Z]=I.useState({popby_item_id:"",notes:""}),[G,te]=I.useState({name:"",description:""}),ie=async()=>{N&&(await h.mutateAsync({contact_id:N.id,popby_item_id:H.popby_item_id||void 0,notes:H.notes||void 0}),T(!1),A(null),Z({popby_item_id:"",notes:""}))},le=async()=>{G.name.trim()&&(await p.mutateAsync({name:G.name.trim(),description:G.description.trim()||void 0}),q(!1),te({name:"",description:""}))},ye=async(ge,ae)=>{await x.mutateAsync({relationship_type_id:ge,frequency_days:parseInt(ae)})},ne=ge=>{var he;const ae=a==null?void 0:a.find(ue=>ue.relationship_type_id===ge);return((he=ae==null?void 0:ae.frequency_days)==null?void 0:he.toString())||"90"};return r.jsx(Lr,{title:"Popbys",description:"Drop off gifts to stay top of mind",children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("h1",{className:"text-2xl font-bold",children:"Popbys"}),r.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wide px-1.5 py-0.5 rounded border border-amber-500 text-amber-600 dark:text-amber-400 bg-amber-500/10",children:"Beta"})]}),r.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[r.jsx(Ye,{children:r.jsxs(tt,{className:"p-4 text-center",children:[r.jsx("div",{className:"text-3xl font-bold text-primary",children:i.thisWeekCount}),r.jsx("div",{className:"text-sm text-muted-foreground",children:"This Week"})]})}),r.jsx(Ye,{children:r.jsxs(tt,{className:"p-4 text-center",children:[r.jsx("div",{className:"text-3xl font-bold text-emerald-500",children:i.thisMonthCount}),r.jsx("div",{className:"text-sm text-muted-foreground",children:"This Month"})]})}),r.jsx(Ye,{children:r.jsxs(tt,{className:"p-4 text-center",children:[r.jsx("div",{className:"text-3xl font-bold text-amber-500",children:i.dueCount}),r.jsx("div",{className:"text-sm text-muted-foreground",children:"Due Now"})]})})]}),r.jsxs("div",{className:"flex gap-2 flex-wrap",children:[r.jsxs(ee,{onClick:()=>t("/mission-control/popbys/map"),children:[r.jsx(fl,{className:"h-4 w-4 mr-2"}),"View Map"]}),r.jsxs(ee,{variant:"outline",onClick:()=>z(!0),children:[r.jsx(fd,{className:"h-4 w-4 mr-2"}),"Frequency Settings"]}),r.jsxs(ee,{variant:"outline",onClick:()=>q(!0),children:[r.jsx(bn,{className:"h-4 w-4 mr-2"}),"Add Popby Idea"]})]}),r.jsxs(Ii,{defaultValue:"due",children:[r.jsxs(wi,{children:[r.jsx(ln,{value:"due",children:"Due for Popby"}),r.jsx(ln,{value:"activity",children:"Recent Activity"}),r.jsx(ln,{value:"library",children:"Popby Library"}),r.jsx(ln,{value:"templates",children:"Popby Templates"})]}),r.jsx(An,{value:"due",className:"space-y-4 mt-4",children:!e||e.length===0?r.jsx(Ye,{children:r.jsxs(tt,{className:"p-8 text-center text-muted-foreground",children:[r.jsx(Ki,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),r.jsx("p",{children:"No contacts due for a popby right now!"}),r.jsx("p",{className:"text-sm mt-1",children:"Great job staying connected."})]})}):r.jsx("div",{className:"space-y-3",children:e.map(ge=>r.jsx(Ye,{className:"hover:shadow-md transition-shadow",children:r.jsx(tt,{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:[ge.first_name," ",ge.last_name]}),ge.daysOverdue>0&&r.jsxs(Ot,{variant:"destructive",className:"text-xs",children:[ge.daysOverdue,"+ days overdue"]}),ge.daysSinceLastPopby===null&&r.jsx(Ot,{variant:"outline",className:"text-xs",children:"Never visited"})]}),r.jsxs("div",{className:"flex items-center gap-4 mt-1 text-sm text-muted-foreground",children:[ge.address&&r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(fl,{className:"h-3 w-3"}),ge.city||ge.address]}),ge.tags&&ge.tags.length>0&&r.jsx("span",{children:ge.tags.map(ae=>{var he;return(he=ae.relationship_type)==null?void 0:he.name}).join(", ")})]}),ge.lastPopby&&r.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["Last popby: ",yn(new Date(ge.lastPopby),"MMM d, yyyy")]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[ge.phone&&r.jsx(ee,{size:"sm",variant:"ghost",asChild:!0,children:r.jsx("a",{href:`tel:${ge.phone}`,children:r.jsx(bi,{className:"h-4 w-4"})})}),r.jsxs(ee,{size:"sm",onClick:()=>{A(ge),T(!0)},children:[r.jsx(Yi,{className:"h-4 w-4 mr-1"}),"Log Popby"]})]})]})})},ge.id))})}),r.jsx(An,{value:"activity",className:"space-y-4 mt-4",children:!o||o.length===0?r.jsx(Ye,{children:r.jsxs(tt,{className:"p-8 text-center text-muted-foreground",children:[r.jsx(Ya,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),r.jsx("p",{children:"No popby activity yet!"}),r.jsx("p",{className:"text-sm mt-1",children:"Start logging popbys to see your history here."})]})}):r.jsxs(Ye,{children:[r.jsx(Gt,{children:r.jsx(Zt,{className:"text-lg",children:"Recent Popby Log"})}),r.jsx(tt,{className:"space-y-3",children:o.map(ge=>r.jsxs("div",{className:"flex items-start gap-3 pb-3 border-b last:border-0 last:pb-0",children:[r.jsx("div",{className:"h-10 w-10 rounded-full bg-orange-500/10 flex items-center justify-center",children:r.jsx(Ki,{className:"h-5 w-5 text-orange-500"})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[r.jsx("span",{className:"font-medium",children:j(ge.contact_id)}),C(ge.popby_item_id)&&r.jsx(Ot,{variant:"secondary",className:"text-xs",children:C(ge.popby_item_id)})]}),r.jsx("div",{className:"text-sm text-muted-foreground",children:yn(new Date(ge.completed_at),"MMM d, yyyy h:mm a")}),ge.notes&&r.jsx("p",{className:"text-sm text-muted-foreground mt-1 line-clamp-2",children:ge.notes})]})]},ge.id))})]})}),r.jsx(An,{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(ge=>r.jsx(Ye,{children:r.jsx(tt,{className:"p-4",children:r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("div",{className:"p-2 bg-primary/10 rounded-lg",children:r.jsx(Ki,{className:"h-5 w-5 text-primary"})}),r.jsxs("div",{className:"flex-1",children:[r.jsx("h3",{className:"font-medium",children:ge.name}),ge.description&&r.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:ge.description}),!ge.owner_user_id&&r.jsx(Ot,{variant:"secondary",className:"mt-2 text-xs",children:"Shared"})]})]})})},ge.id)),r.jsx(Ye,{className:"border-dashed cursor-pointer hover:bg-muted/50 transition-colors",onClick:()=>q(!0),children:r.jsx(tt,{className:"p-4 flex items-center justify-center h-full min-h-[100px]",children:r.jsxs("div",{className:"text-center text-muted-foreground",children:[r.jsx(bn,{className:"h-8 w-8 mx-auto mb-2"}),r.jsx("p",{children:"Add New Popby Idea"})]})})})]})}),r.jsxs(An,{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"]}),b&&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((ge,ae)=>r.jsx(Ye,{children:r.jsxs(tt,{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"})]})]})},ae))}),!b&&y.length===0&&r.jsx(Ye,{children:r.jsxs(tt,{className:"p-8 text-center text-muted-foreground",children:[r.jsx(zl,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),r.jsx("p",{children:"No popby templates available yet!"}),r.jsx("p",{className:"text-sm mt-1",children:"Check back soon for new templates."})]})}),!b&&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(ge=>r.jsxs(Ye,{className:"group overflow-hidden hover:shadow-lg transition-all duration-200 cursor-pointer",onClick:()=>t(`/templates/${ge.id}`),children:[r.jsx("div",{className:"relative overflow-hidden bg-muted aspect-[3/2]",children:ge.preview_image_url?r.jsx("img",{src:ge.preview_image_url,alt:ge.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(tt,{className:"p-4 flex flex-col",children:[r.jsx("h3",{className:"font-semibold text-foreground line-clamp-1 mb-1",children:ge.name}),ge.description&&r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 mb-3 flex-1",children:Sne(ge.description)}),r.jsx("div",{className:"flex flex-wrap gap-2 mb-3",children:r.jsx(Ot,{variant:"secondary",className:"text-xs",children:"PopBys"})}),r.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground mb-3",children:[r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(pd,{className:"h-3.5 w-3.5"}),ge.likesCount]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Fl,{className:"h-3.5 w-3.5"}),ge.commentsCount]})]}),r.jsxs(ee,{size:"sm",className:"w-full gap-2",onClick:ae=>{ae.stopPropagation(),t(`/templates/${ge.id}`)},children:[r.jsx(Fs,{className:"h-4 w-4"}),"View Template"]})]})]},ge.id))})]})]}),r.jsx(Fr,{open:E,onOpenChange:T,children:r.jsxs(Rr,{children:[r.jsx(qr,{children:r.jsxs($r,{children:["Log Popby for ",N==null?void 0:N.first_name," ",N==null?void 0:N.last_name]})}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Popby Item (optional)"}),r.jsxs(gn,{value:H.popby_item_id,onValueChange:ge=>Z(ae=>({...ae,popby_item_id:ge})),children:[r.jsx(fn,{children:r.jsx(xn,{placeholder:"Select a popby item..."})}),r.jsx(pn,{children:n==null?void 0:n.map(ge=>r.jsx(Vt,{value:ge.id,children:ge.name},ge.id))})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Notes (optional)"}),r.jsx(ps,{placeholder:"Any notes about this popby...",value:H.notes,onChange:ge=>Z(ae=>({...ae,notes:ge.target.value}))})]})]}),r.jsxs(ea,{children:[r.jsx(ee,{variant:"outline",onClick:()=>T(!1),children:"Cancel"}),r.jsx(ee,{onClick:ie,disabled:h.isPending,children:"Log Popby"})]})]})}),r.jsx(Fr,{open:L,onOpenChange:z,children:r.jsxs(Rr,{className:"max-w-md",children:[r.jsx(qr,{children:r.jsx($r,{children:"Popby Frequency Settings"})}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Set default popby frequency for each relationship type. You can override these per-contact."}),s==null?void 0:s.map(ge=>r.jsxs("div",{className:"flex items-center justify-between gap-4",children:[r.jsx(He,{className:"font-medium",children:ge.name}),r.jsxs(gn,{value:ne(ge.id),onValueChange:ae=>ye(ge.id,ae),children:[r.jsx(fn,{className:"w-[180px]",children:r.jsx(xn,{})}),r.jsx(pn,{children:tkt.map(ae=>r.jsx(Vt,{value:ae.value,children:ae.label},ae.value))})]})]},ge.id))]}),r.jsx(ea,{children:r.jsx(ee,{onClick:()=>z(!1),children:"Done"})})]})}),r.jsx(Fr,{open:F,onOpenChange:q,children:r.jsxs(Rr,{children:[r.jsx(qr,{children:r.jsx($r,{children:"Add Popby Idea"})}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Name *"}),r.jsx(dt,{placeholder:"e.g., Homemade cookies",value:G.name,onChange:ge=>te(ae=>({...ae,name:ge.target.value}))})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Description"}),r.jsx(ps,{placeholder:"Optional description...",value:G.description,onChange:ge=>te(ae=>({...ae,description:ge.target.value}))})]})]}),r.jsxs(ea,{children:[r.jsx(ee,{variant:"outline",onClick:()=>q(!1),children:"Cancel"}),r.jsx(ee,{onClick:le,disabled:!G.name.trim()||p.isPending,children:"Add Item"})]})]})})]})})}var kze={exports:{}};(function(t,e){(function(n,s){t.exports=s()})(Ax,function(){var n,s,a;function o(i,h){if(!n)n=h;else if(!s)s=h;else{var p="self.onerror = function() { console.error('An error occurred while parsing the WebWorker bundle. This is most likely due to improper transpilation by Babel; please see https://docs.mapbox.com/mapbox-gl-js/guides/install/#transpiling'); }; var sharedChunk = {}; ("+n+")(sharedChunk); ("+s+")(sharedChunk); self.onerror = null;",x={};n(x),a=h(x),typeof window<"u"&&window&&window.URL&&window.URL.createObjectURL&&(a.workerUrl=window.URL.createObjectURL(new Blob([p],{type:"text/javascript"})))}}o(["exports"],function(i){var h=1e-6,p=typeof Float32Array<"u"?Float32Array:Array;function x(f,c){var u=c[0],g=c[1],v=c[2],k=c[3],S=u*k-v*g;return S?(f[0]=k*(S=1/S),f[1]=-g*S,f[2]=-v*S,f[3]=u*S,f):null}function y(){var f=new p(9);return p!=Float32Array&&(f[1]=0,f[2]=0,f[3]=0,f[5]=0,f[6]=0,f[7]=0),f[0]=1,f[4]=1,f[8]=1,f}function b(f,c){var u=c[0],g=c[1],v=c[2],k=c[3],S=c[4],P=c[5],R=c[6],$=c[7],W=c[8];return f[0]=S*W-P*$,f[1]=v*$-g*W,f[2]=g*P-v*S,f[3]=P*R-k*W,f[4]=u*W-v*R,f[5]=v*k-u*P,f[6]=k*$-S*R,f[7]=g*R-u*$,f[8]=u*S-g*k,f}function j(f,c,u){var g=c[0],v=c[1],k=c[2],S=c[3],P=c[4],R=c[5],$=c[6],W=c[7],K=c[8],X=u[0],re=u[1],se=u[2],fe=u[3],Se=u[4],ke=u[5],Fe=u[6],$e=u[7],Ke=u[8];return f[0]=X*g+re*S+se*$,f[1]=X*v+re*P+se*W,f[2]=X*k+re*R+se*K,f[3]=fe*g+Se*S+ke*$,f[4]=fe*v+Se*P+ke*W,f[5]=fe*k+Se*R+ke*K,f[6]=Fe*g+$e*S+Ke*$,f[7]=Fe*v+$e*P+Ke*W,f[8]=Fe*k+$e*R+Ke*K,f}function C(){var f=new p(16);return p!=Float32Array&&(f[1]=0,f[2]=0,f[3]=0,f[4]=0,f[6]=0,f[7]=0,f[8]=0,f[9]=0,f[11]=0,f[12]=0,f[13]=0,f[14]=0),f[0]=1,f[5]=1,f[10]=1,f[15]=1,f}function N(f){var c=new p(16);return c[0]=f[0],c[1]=f[1],c[2]=f[2],c[3]=f[3],c[4]=f[4],c[5]=f[5],c[6]=f[6],c[7]=f[7],c[8]=f[8],c[9]=f[9],c[10]=f[10],c[11]=f[11],c[12]=f[12],c[13]=f[13],c[14]=f[14],c[15]=f[15],c}function A(f){return f[0]=1,f[1]=0,f[2]=0,f[3]=0,f[4]=0,f[5]=1,f[6]=0,f[7]=0,f[8]=0,f[9]=0,f[10]=1,f[11]=0,f[12]=0,f[13]=0,f[14]=0,f[15]=1,f}function E(f,c){var u=c[0],g=c[1],v=c[2],k=c[3],S=c[4],P=c[5],R=c[6],$=c[7],W=c[8],K=c[9],X=c[10],re=c[11],se=c[12],fe=c[13],Se=c[14],ke=c[15],Fe=u*P-g*S,$e=u*R-v*S,Ke=u*$-k*S,ht=g*R-v*P,ot=g*$-k*P,_t=v*$-k*R,Ct=W*fe-K*se,Et=W*Se-X*se,Kt=W*ke-re*se,Rt=K*Se-X*fe,rr=K*ke-re*fe,or=X*ke-re*Se,lr=Fe*or-$e*rr+Ke*Rt+ht*Kt-ot*Et+_t*Ct;return lr?(f[0]=(P*or-R*rr+$*Rt)*(lr=1/lr),f[1]=(v*rr-g*or-k*Rt)*lr,f[2]=(fe*_t-Se*ot+ke*ht)*lr,f[3]=(X*ot-K*_t-re*ht)*lr,f[4]=(R*Kt-S*or-$*Et)*lr,f[5]=(u*or-v*Kt+k*Et)*lr,f[6]=(Se*Ke-se*_t-ke*$e)*lr,f[7]=(W*_t-X*Ke+re*$e)*lr,f[8]=(S*rr-P*Kt+$*Ct)*lr,f[9]=(g*Kt-u*rr-k*Ct)*lr,f[10]=(se*ot-fe*Ke+ke*Fe)*lr,f[11]=(K*Ke-W*ot-re*Fe)*lr,f[12]=(P*Et-S*Rt-R*Ct)*lr,f[13]=(u*Rt-g*Et+v*Ct)*lr,f[14]=(fe*$e-se*ht-Se*Fe)*lr,f[15]=(W*ht-K*$e+X*Fe)*lr,f):null}function T(f,c,u){var g=c[0],v=c[1],k=c[2],S=c[3],P=c[4],R=c[5],$=c[6],W=c[7],K=c[8],X=c[9],re=c[10],se=c[11],fe=c[12],Se=c[13],ke=c[14],Fe=c[15],$e=u[0],Ke=u[1],ht=u[2],ot=u[3];return f[0]=$e*g+Ke*P+ht*K+ot*fe,f[1]=$e*v+Ke*R+ht*X+ot*Se,f[2]=$e*k+Ke*$+ht*re+ot*ke,f[3]=$e*S+Ke*W+ht*se+ot*Fe,f[4]=($e=u[4])*g+(Ke=u[5])*P+(ht=u[6])*K+(ot=u[7])*fe,f[5]=$e*v+Ke*R+ht*X+ot*Se,f[6]=$e*k+Ke*$+ht*re+ot*ke,f[7]=$e*S+Ke*W+ht*se+ot*Fe,f[8]=($e=u[8])*g+(Ke=u[9])*P+(ht=u[10])*K+(ot=u[11])*fe,f[9]=$e*v+Ke*R+ht*X+ot*Se,f[10]=$e*k+Ke*$+ht*re+ot*ke,f[11]=$e*S+Ke*W+ht*se+ot*Fe,f[12]=($e=u[12])*g+(Ke=u[13])*P+(ht=u[14])*K+(ot=u[15])*fe,f[13]=$e*v+Ke*R+ht*X+ot*Se,f[14]=$e*k+Ke*$+ht*re+ot*ke,f[15]=$e*S+Ke*W+ht*se+ot*Fe,f}function L(f,c,u){var g,v,k,S,P,R,$,W,K,X,re,se,fe=u[0],Se=u[1],ke=u[2];return c===f?(f[12]=c[0]*fe+c[4]*Se+c[8]*ke+c[12],f[13]=c[1]*fe+c[5]*Se+c[9]*ke+c[13],f[14]=c[2]*fe+c[6]*Se+c[10]*ke+c[14],f[15]=c[3]*fe+c[7]*Se+c[11]*ke+c[15]):(v=c[1],k=c[2],S=c[3],P=c[4],R=c[5],$=c[6],W=c[7],K=c[8],X=c[9],re=c[10],se=c[11],f[0]=g=c[0],f[1]=v,f[2]=k,f[3]=S,f[4]=P,f[5]=R,f[6]=$,f[7]=W,f[8]=K,f[9]=X,f[10]=re,f[11]=se,f[12]=g*fe+P*Se+K*ke+c[12],f[13]=v*fe+R*Se+X*ke+c[13],f[14]=k*fe+$*Se+re*ke+c[14],f[15]=S*fe+W*Se+se*ke+c[15]),f}function z(f,c,u){var g=u[0],v=u[1],k=u[2];return f[0]=c[0]*g,f[1]=c[1]*g,f[2]=c[2]*g,f[3]=c[3]*g,f[4]=c[4]*v,f[5]=c[5]*v,f[6]=c[6]*v,f[7]=c[7]*v,f[8]=c[8]*k,f[9]=c[9]*k,f[10]=c[10]*k,f[11]=c[11]*k,f[12]=c[12],f[13]=c[13],f[14]=c[14],f[15]=c[15],f}function F(f,c,u){var g=Math.sin(u),v=Math.cos(u),k=c[4],S=c[5],P=c[6],R=c[7],$=c[8],W=c[9],K=c[10],X=c[11];return c!==f&&(f[0]=c[0],f[1]=c[1],f[2]=c[2],f[3]=c[3],f[12]=c[12],f[13]=c[13],f[14]=c[14],f[15]=c[15]),f[4]=k*v+$*g,f[5]=S*v+W*g,f[6]=P*v+K*g,f[7]=R*v+X*g,f[8]=$*v-k*g,f[9]=W*v-S*g,f[10]=K*v-P*g,f[11]=X*v-R*g,f}function q(f,c,u){var g=Math.sin(u),v=Math.cos(u),k=c[0],S=c[1],P=c[2],R=c[3],$=c[8],W=c[9],K=c[10],X=c[11];return c!==f&&(f[4]=c[4],f[5]=c[5],f[6]=c[6],f[7]=c[7],f[12]=c[12],f[13]=c[13],f[14]=c[14],f[15]=c[15]),f[0]=k*v-$*g,f[1]=S*v-W*g,f[2]=P*v-K*g,f[3]=R*v-X*g,f[8]=k*g+$*v,f[9]=S*g+W*v,f[10]=P*g+K*v,f[11]=R*g+X*v,f}function H(f,c,u){var g=Math.sin(u),v=Math.cos(u),k=c[0],S=c[1],P=c[2],R=c[3],$=c[4],W=c[5],K=c[6],X=c[7];return c!==f&&(f[8]=c[8],f[9]=c[9],f[10]=c[10],f[11]=c[11],f[12]=c[12],f[13]=c[13],f[14]=c[14],f[15]=c[15]),f[0]=k*v+$*g,f[1]=S*v+W*g,f[2]=P*v+K*g,f[3]=R*v+X*g,f[4]=$*v-k*g,f[5]=W*v-S*g,f[6]=K*v-P*g,f[7]=X*v-R*g,f}function Z(f,c){return f[0]=c[0],f[1]=0,f[2]=0,f[3]=0,f[4]=0,f[5]=c[1],f[6]=0,f[7]=0,f[8]=0,f[9]=0,f[10]=c[2],f[11]=0,f[12]=0,f[13]=0,f[14]=0,f[15]=1,f}function G(f,c,u){var g,v,k,S=u[0],P=u[1],R=u[2],$=Math.sqrt(S*S+P*P+R*R);return $0&&(k=1/Math.sqrt(k)),f[0]=c[0]*k,f[1]=c[1]*k,f[2]=c[2]*k,f}function je(f,c){return f[0]*c[0]+f[1]*c[1]+f[2]*c[2]}function et(f,c,u){var g=c[0],v=c[1],k=c[2],S=u[0],P=u[1],R=u[2];return f[0]=v*R-k*P,f[1]=k*S-g*R,f[2]=g*P-v*S,f}function Te(f,c,u,g){var v=c[0],k=c[1],S=c[2];return f[0]=v+g*(u[0]-v),f[1]=k+g*(u[1]-k),f[2]=S+g*(u[2]-S),f}function Ze(f,c,u){var g=c[0],v=c[1],k=c[2],S=u[3]*g+u[7]*v+u[11]*k+u[15];return f[0]=(u[0]*g+u[4]*v+u[8]*k+u[12])/(S=S||1),f[1]=(u[1]*g+u[5]*v+u[9]*k+u[13])/S,f[2]=(u[2]*g+u[6]*v+u[10]*k+u[14])/S,f}function pe(f,c,u){var g=c[0],v=c[1],k=c[2];return f[0]=g*u[0]+v*u[3]+k*u[6],f[1]=g*u[1]+v*u[4]+k*u[7],f[2]=g*u[2]+v*u[5]+k*u[8],f}function yt(f,c,u){var g=u[0],v=u[1],k=u[2],S=u[3],P=c[0],R=c[1],$=c[2],W=v*$-k*R,K=k*P-g*$,X=g*R-v*P;return f[0]=P+S*(W+=W)+v*(X+=X)-k*(K+=K),f[1]=R+S*K+k*W-g*X,f[2]=$+S*X+g*K-v*W,f}function rt(f){return f[0]=0,f[1]=0,f[2]=0,f}function at(f,c){return f[0]===c[0]&&f[1]===c[1]&&f[2]===c[2]}var Me=_e,ft=Ae,qe=ge;function Oe(){var f=new p(4);return p!=Float32Array&&(f[0]=0,f[1]=0,f[2]=0,f[3]=0),f}function Qe(f,c,u){return f[0]=c[0]*u,f[1]=c[1]*u,f[2]=c[2]*u,f[3]=c[3]*u,f}function nt(f,c){var u=c[0],g=c[1],v=c[2],k=c[3],S=u*u+g*g+v*v+k*k;return S>0&&(S=1/Math.sqrt(S)),f[0]=u*S,f[1]=g*S,f[2]=v*S,f[3]=k*S,f}function gt(f,c,u){var g=c[0],v=c[1],k=c[2],S=c[3];return f[0]=u[0]*g+u[4]*v+u[8]*k+u[12]*S,f[1]=u[1]*g+u[5]*v+u[9]*k+u[13]*S,f[2]=u[2]*g+u[6]*v+u[10]*k+u[14]*S,f[3]=u[3]*g+u[7]*v+u[11]*k+u[15]*S,f}function mt(){var f=new p(4);return p!=Float32Array&&(f[0]=0,f[1]=0,f[2]=0),f[3]=1,f}function Mt(f){return f[0]=0,f[1]=0,f[2]=0,f[3]=1,f}function wt(f,c,u){u*=.5;var g=c[0],v=c[1],k=c[2],S=c[3],P=Math.sin(u),R=Math.cos(u);return f[0]=g*R+S*P,f[1]=v*R+k*P,f[2]=k*R-v*P,f[3]=S*R-g*P,f}function Qt(f,c,u){u*=.5;var g=c[0],v=c[1],k=c[2],S=c[3],P=Math.sin(u),R=Math.cos(u);return f[0]=g*R-k*P,f[1]=v*R+S*P,f[2]=k*R+g*P,f[3]=S*R-v*P,f}ye(),Oe();var Cr,cn,jn,Xr=nt,Pn=(Cr=ye(),cn=ae(1,0,0),jn=ae(0,1,0),function(f,c,u){var g=je(c,u);return g<-.999999?(et(Cr,cn,c),qe(Cr)<1e-6&&et(Cr,jn,c),Re(Cr,Cr),function(v,k,S){S*=.5;var P=Math.sin(S);v[0]=P*k[0],v[1]=P*k[1],v[2]=P*k[2],v[3]=Math.cos(S)}(f,Cr,Math.PI),f):g>.999999?(f[0]=0,f[1]=0,f[2]=0,f[3]=1,f):(et(Cr,c,u),f[0]=Cr[0],f[1]=Cr[1],f[2]=Cr[2],f[3]=1+g,Xr(f,f))});function js(){var f=new p(2);return p!=Float32Array&&(f[0]=0,f[1]=0),f}function hr(f,c){var u=new p(2);return u[0]=f,u[1]=c,u}function xs(f,c,u){return f[0]=c,f[1]=u,f}function ka(f,c,u){return f[0]=c[0]+u[0],f[1]=c[1]+u[1],f}function xa(f,c,u){return f[0]=c[0]-u[0],f[1]=c[1]-u[1],f}function zi(f,c,u){return f[0]=c[0]*u,f[1]=c[1]*u,f}function Bi(f){var c=f[0],u=f[1];return Math.sqrt(c*c+u*u)}function tl(f,c){var u=c[0],g=c[1],v=u*u+g*g;return v>0&&(v=1/Math.sqrt(v)),f[0]=c[0]*v,f[1]=c[1]*v,f}function xo(f,c){return f[0]*c[0]+f[1]*c[1]}mt(),mt(),y();var Hs,Xa,Ns=xa;function Fa(f){return f&&f.__esModule&&Object.prototype.hasOwnProperty.call(f,"default")?f.default:f}js();var Oa=function(){if(Xa)return Hs;function f(c,u,g,v){this.cx=3*c,this.bx=3*(g-c)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*u,this.by=3*(v-u)-this.cy,this.ay=1-this.cy-this.by,this.p1x=c,this.p1y=u,this.p2x=g,this.p2y=v}return Xa=1,Hs=f,f.prototype={sampleCurveX:function(c){return((this.ax*c+this.bx)*c+this.cx)*c},sampleCurveY:function(c){return((this.ay*c+this.by)*c+this.cy)*c},sampleCurveDerivativeX:function(c){return(3*this.ax*c+2*this.bx)*c+this.cx},solveCurveX:function(c,u){if(u===void 0&&(u=1e-6),c<0)return 0;if(c>1)return 1;for(var g=c,v=0;v<8;v++){var k=this.sampleCurveX(g)-c;if(Math.abs(k)k?P=g:R=g,g=.5*(R-P)+P;return g},solve:function(c,u){return this.sampleCurveY(this.solveCurveX(c,u))}},Hs}(),Do=Fa(Oa);function ir(f,c){this.x=f,this.y=c}function fo(f,c){if(Array.isArray(f)){if(!Array.isArray(c)||f.length!==c.length)return!1;for(let u=0;u=1)return 1;const c=f*f,u=c*f;return 4*(f<.5?u:3*(f-c)+u-.75)}function mu(f,c,u,g){const v=new Do(f,c,u,g);return function(k){return v.solve(k)}}const Je=mu(.25,.1,.25,1);function xe(f,c,u){return Math.min(u,Math.max(c,f))}function Ie(f,c,u){return(u=xe((u-f)/(c-f),0,1))*u*(3-2*u)}function Ge(f,c,u){const g=u-c,v=((f-c)%g+g)%g+c;return v===c?u:v}function kt(f,c,u){if(!f.length)return u(null,[]);let g=f.length;const v=new Array(f.length);let k=null;f.forEach((S,P)=>{c(S,(R,$)=>{R&&(k=R),v[P]=$,--g==0&&u(k,v)})})}let vt=1;function At(){return vt++}function zt(f){return f<=1?1:Math.pow(2,Math.ceil(Math.log2(f)))}function Pt(f,c){f.forEach(u=>{c[u]&&(c[u]=c[u].bind(c))})}function Ut(f,c,u){const g={};for(const v in f)g[v]=c.call(this,f[v],v,f);return g}function fr(f,c,u){const g={};for(const v in f)c.call(this,f[v],v,f)&&(g[v]=f[v]);return g}function ar(f){return Array.isArray(f)?f.map(ar):typeof f=="object"&&f?Ut(f,ar):f}function Wr(f,c){for(let u=0;u=0)return!0;return!1}const wn={};function Ur(f){wn[f]||(typeof console<"u"&&console.warn(f),wn[f]=!0)}function Jn(f,c,u){return(u.y-f.y)*(c.x-f.x)>(c.y-f.y)*(u.x-f.x)}function es(f){let c=0;for(let u,g,v=0,k=f.length,S=k-1;v@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(u,g,v,k)=>{const S=v||k;return c[g]=!S||S.toLowerCase(),""}),c["max-age"]){const u=parseInt(c["max-age"],10);isNaN(u)?delete c["max-age"]:c["max-age"]=u}return c}let po=null;function ua(f,c){return[f[4*c],f[4*c+1],f[4*c+2],f[4*c+3]]}function vo(f,c,u,g){for(;c>1;f[v]>1;f[v]<=g?c=v+1:u=v}return c}function Ws(f){return f>0?1/(1.001-f):1+f}function ki(f){return f>0?1-1/(1.001-f):-f}function za(f,c,u){return(f-c.min)*(u.max-u.min)/(c.max-c.min)+u.min}const Ss={API_URL:"https://api.mapbox.com",get API_URL_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/|\?|$)/i},get API_TILEJSON_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/v[0-9]*\/.*\.json.*$)/i},get API_SPRITE_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/styles\/v[0-9]*\/)(.*\/sprite.*\..*$)/i},get API_FONTS_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/fonts\/v[0-9]*\/)(.*\.pbf.*$)/i},get API_STYLE_REGEX(){return/^((https?:)?\/\/)?([^\/]+\.)?mapbox\.c(n|om)(\/styles\/v[0-9]*\/)(.*$)/i},get API_CDN_URL_REGEX(){return/^((https?:)?\/\/)?api\.mapbox\.c(n|om)(\/mapbox-gl-js\/)(.*$)/i},get EVENTS_URL(){if(!Ss.API_URL)return null;try{const f=new URL(Ss.API_URL);return f.hostname==="api.mapbox.cn"?"https://events.mapbox.cn/events/v2":f.hostname==="api.mapbox.com"?"https://events.mapbox.com/events/v2":null}catch{return null}},SESSION_PATH:"/map-sessions/v1",FEEDBACK_URL:"https://apps.mapbox.com/feedback",TILE_URL_VERSION:"v4",RASTER_URL_PREFIX:"raster/v1",RASTERARRAYS_URL_PREFIX:"rasterarrays/v1",REQUIRE_ACCESS_TOKEN:!0,ACCESS_TOKEN:null,DEFAULT_STYLE:"mapbox://styles/mapbox/standard",MAX_PARALLEL_IMAGE_REQUESTS:16,DRACO_URL:"https://api.mapbox.com/mapbox-gl-js/draco_decoder_gltf_v1.5.6.wasm",MESHOPT_URL:"https://api.mapbox.com/mapbox-gl-js/meshopt_base_v0.20.wasm",MESHOPT_SIMD_URL:"https://api.mapbox.com/mapbox-gl-js/meshopt_simd_v0.20.wasm",BUILDING_GEN_URL:"https://api.mapbox.com/mapbox-gl-js/building-gen/building_gen_v1.2.4.wasm",GLYPHS_URL:"mapbox://fonts/mapbox/{fontstack}/{range}.pbf",TILES3D_URL_PREFIX:"3dtiles/v1"};function Ni(f){return Ss.API_URL_REGEX.test(f)}function ml(f){return Ss.API_SPRITE_REGEX.test(f)}let Sl,Lc,mf,Bo,_d,rc;function Ku(){return Sl==null&&(Sl=self.OffscreenCanvas&&new OffscreenCanvas(1,1).getContext("2d")&&typeof self.createImageBitmap=="function"),Sl}const $o={now:()=>Bo!==void 0?Bo:performance.now(),setNow(f){Bo=f},restoreNow(){Bo=void 0},frame(f){const c=requestAnimationFrame(f);return{cancel:()=>cancelAnimationFrame(c)}},getImageData(f,c=0){const{width:u,height:g}=f;_d||(_d=document.createElement("canvas"));const v=_d.getContext("2d",{willReadFrequently:!0});if(!v)throw new Error("failed to create canvas 2d context");return(u>_d.width||g>_d.height)&&(_d.width=u,_d.height=g),v.clearRect(-c,-c,u+2*c,g+2*c),v.drawImage(f,0,0,u,g),v.getImageData(-c,-c,u+2*c,g+2*c)},resolveURL:f=>(Lc||(Lc=document.createElement("a")),Lc.href=f,Lc.href),get devicePixelRatio(){return window.devicePixelRatio},get prefersReducedMotion(){return!!window.matchMedia&&(mf==null&&(mf=window.matchMedia("(prefers-reduced-motion: reduce)")),mf.matches)},hasCanvasFingerprintNoise(){if(rc!==void 0)return rc;if(!Ku())return rc=!1,!1;const f=new OffscreenCanvas(85,1),c=f.getContext("2d",{willReadFrequently:!0});let u=0;for(let v=0;v0?`?${k}`:""}`}const yy="mapbox-tiles";let vy=500,_y=50;const Sh=["language","worldview","jobid"];let gu,Oc;function qd(){try{return caches}catch{}}function Dc(){const f=qd();f&&gu==null&&(gu=f.open(yy))}let _o=1/0;const bd={supported:!1,testSupport:function(f){!by&&xc&&(up?wy(f):Zu=f)}};let Zu,xc,by=!1,up=!1;const hp=typeof self<"u"?self:{};function wy(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,xc),f.isContextLost())return;bd.supported=!0}catch{}f.deleteTexture(c),by=!0}hp.document&&(xc=hp.document.createElement("img"),xc.onload=function(){Zu&&wy(Zu),Zu=null,up=!0},xc.onerror=function(){by=!0,Zu=null},xc.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");const qg={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(qg);class Xc extends Error{constructor(c,u,g){u===401&&Ni(g)&&(c+=": you may have provided an invalid Mapbox access token. See https://docs.mapbox.com/api/overview/#access-tokens-and-token-scopes"),super(c),this.status=u,this.url=g}toString(){return`${this.name}: ${this.message} (${this.status}): ${this.url}`}}const Vg=Ls()?()=>self.worker.referrer:()=>(location.protocol==="blob:"?parent:self).location.href,Ch=function(f,c){if(!(/^file:/.test(u=f.url)||/^file:/.test(Vg())&&!/^\w+:/.test(u))){if(self.fetch&&self.Request&&self.AbortController&&Request.prototype.hasOwnProperty("signal"))return function(g,v){const k=new AbortController,S=new Request(g.url,{method:g.method||"GET",body:g.body,credentials:g.credentials,headers:g.headers,referrer:Vg(),referrerPolicy:g.referrerPolicy,signal:k.signal});let P=!1,R=!1;const $=(W=S.url).indexOf("sku=")>0&&Ni(W);var W;g.type==="json"&&S.headers.set("Accept","application/json");const K=(re,se,fe)=>{if(R)return;if(re&&re.message!=="SecurityError"&&Ur(re.toString()),se&&fe)return X(se);const Se=Date.now();fetch(S).then(ke=>{if(ke.ok){const Fe=$?ke.clone():null;return X(ke,Fe,Se)}return v(new Xc(ke.statusText,ke.status,g.url))}).catch(ke=>{ke.name!=="AbortError"&&v(new Error(`${ke.message} ${g.url}`))})},X=(re,se,fe)=>{(g.type==="arrayBuffer"?re.arrayBuffer():g.type==="json"?re.json():re.text()).then(Se=>{R||(se&&fe&&function(ke,Fe,$e){if(Dc(),gu==null)return;const Ke=Li(Fe.headers.get("Cache-Control")||"");if(Ke["no-store"])return;const ht={status:Fe.status,statusText:Fe.statusText,headers:new Headers};Fe.headers.forEach((Ct,Et)=>ht.headers.set(Et,Ct)),Ke["max-age"]&&ht.headers.set("Expires",new Date($e+1e3*Ke["max-age"]).toUTCString());const ot=ht.headers.get("Expires");if(!ot||new Date(ot).getTime()-$e<42e4)return;let _t=Tm(ke.url,{persistentParams:Sh});if(Fe.status===206){const Ct=ke.headers.get("Range");if(!Ct)return;ht.status=200,_t=dp(_t,{range:Ct})}(function(Ct,Et){if(Oc===void 0)try{new Response(new ReadableStream),Oc=!0}catch{Oc=!1}Oc?Et(Ct.body):Ct.blob().then(Et).catch(Kt=>Ur(Kt.message))})(Fe,Ct=>{const Et=new Response((Kt=Fe.status)!==200&&Kt!==404&&[101,103,204,205,304].includes(Kt)?null:Ct,ht);var Kt;Dc(),gu!=null&&gu.then(Rt=>Rt.put(_t,Et)).catch(Rt=>Ur(Rt.message))})}(S,se,fe),P=!0,v(null,Se,re.headers))}).catch(Se=>{R||v(new Error(Se.message))})};return $?function(re,se){if(Dc(),gu==null)return se(null);gu.then(fe=>{let Se=Tm(re.url,{persistentParams:Sh});const ke=re.headers.get("Range");ke&&(Se=dp(Se,{range:ke})),fe.match(Se).then(Fe=>{const $e=function(Ke){if(!Ke)return!1;const ht=new Date(Ke.headers.get("Expires")||0),ot=Li(Ke.headers.get("Cache-Control")||"");return Number(ht)>Date.now()&&!ot["no-cache"]}(Fe);fe.delete(Se).catch(se),$e&&fe.put(Se,Fe.clone()).catch(se),se(null,Fe,$e)}).catch(se)}).catch(se)}(S,K):K(null,null),{cancel:()=>{R=!0,P||k.abort()}}}(f,c);if(Ls(self)&&self.worker.actor)return self.worker.actor.send("getResource",f,c,void 0,!0)}var u;return function(g,v){const k=new XMLHttpRequest;k.open(g.method||"GET",g.url,!0),g.type==="arrayBuffer"&&(k.responseType="arraybuffer");for(const S in g.headers)k.setRequestHeader(S,g.headers[S]);return g.type==="json"&&(k.responseType="text",k.setRequestHeader("Accept","application/json")),k.withCredentials=g.credentials==="include",k.onerror=()=>{v(new Error(k.statusText))},k.onload=()=>{if((k.status>=200&&k.status<300||k.status===0)&&k.response!==null){let S=k.response;if(g.type==="json")try{S=JSON.parse(k.response)}catch(R){return v(R)}const P=new Headers;k.getAllResponseHeaders().trim().split(/[\r\n]+/).forEach(R=>{const $=R.split(": "),W=$.shift(),K=$.join(": ");P.append(W,K)}),v(null,S,P)}else v(new Xc(k.statusText,k.status,g.url))},k.send(g.body),{cancel:()=>k.abort()}}(f,c)},Mh=function(f,c){return Ch(Object.assign(f,{type:"arrayBuffer"}),c)};function C3(f){const c=document.createElement("a");return c.href=f,c.protocol===location.protocol&&c.host===location.host}const mk="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";let gf,Ys;gf=[],Ys=0;const jy=function(f,c){if(bd.supported&&(f.headers||(f.headers={}),f.headers.accept="image/webp,*/*"),Ys>=Ss.MAX_PARALLEL_IMAGE_REQUESTS){const k={requestParameters:f,callback:c,cancelled:!1,cancel(){this.cancelled=!0}};return gf.push(k),k}Ys++;let u=!1;const g=()=>{if(!u)for(u=!0,Ys--;gf.length&&Ys{g(),k?c(k):S&&(self.createImageBitmap?function(R,$){const W=new Blob([new Uint8Array(R)],{type:"image/png"});createImageBitmap(W).then(K=>{$(null,K)}).catch(K=>{$(new Error(`Could not load image because of ${K.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))})}(S,(R,$)=>c(R,$,P)):function(R,$){const W=new Image;W.onload=()=>{$(null,W),URL.revokeObjectURL(W.src),W.onload=null,requestAnimationFrame(()=>{W.src=mk})},W.onerror=()=>$(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));const K=new Blob([new Uint8Array(R)],{type:"image/png"});W.src=R.byteLength?URL.createObjectURL(K):mk}(S,(R,$)=>c(R,$,P)))});return{cancel:()=>{v.cancel(),g()}}};var mv,gk,xk,Th={exports:{}},Hg={exports:{}},jt={exports:{}},gr=function(){if(xk)return Th.exports;xk=1;var f=(mv||(mv=1,Hg.exports=function(u,g){var v,k,S,P,R,$,W,K;for(k=u.length-(v=3&u.length),S=g,R=3432918353,$=461845907,K=0;K>>16)*R&65535)<<16)&4294967295)<<15|W>>>17))*$+(((W>>>16)*$&65535)<<16)&4294967295)<<13|S>>>19))+((5*(S>>>16)&65535)<<16)&4294967295))+((58964+(P>>>16)&65535)<<16);switch(W=0,v){case 3:W^=(255&u.charCodeAt(K+2))<<16;case 2:W^=(255&u.charCodeAt(K+1))<<8;case 1:S^=W=(65535&(W=(W=(65535&(W^=255&u.charCodeAt(K)))*R+(((W>>>16)*R&65535)<<16)&4294967295)<<15|W>>>17))*$+(((W>>>16)*$&65535)<<16)&4294967295}return S^=u.length,S=2246822507*(65535&(S^=S>>>16))+((2246822507*(S>>>16)&65535)<<16)&4294967295,S=3266489909*(65535&(S^=S>>>13))+((3266489909*(S>>>16)&65535)<<16)&4294967295,(S^=S>>>16)>>>0}),Hg.exports),c=(gk||(gk=1,jt.exports=function(u,g){for(var v,k=u.length,S=g^k,P=0;k>=4;)v=1540483477*(65535&(v=255&u.charCodeAt(P)|(255&u.charCodeAt(++P))<<8|(255&u.charCodeAt(++P))<<16|(255&u.charCodeAt(++P))<<24))+((1540483477*(v>>>16)&65535)<<16),S=1540483477*(65535&S)+((1540483477*(S>>>16)&65535)<<16)^(v=1540483477*(65535&(v^=v>>>24))+((1540483477*(v>>>16)&65535)<<16)),k-=4,++P;switch(k){case 3:S^=(255&u.charCodeAt(P+2))<<16;case 2:S^=(255&u.charCodeAt(P+1))<<8;case 1:S=1540483477*(65535&(S^=255&u.charCodeAt(P)))+((1540483477*(S>>>16)&65535)<<16)}return S=1540483477*(65535&(S^=S>>>13))+((1540483477*(S>>>16)&65535)<<16),(S^=S>>>15)>>>0}),jt.exports);return Th.exports=f,Th.exports.murmur3=f,Th.exports.murmur2=c,Th.exports}(),Pr=Fa(gr);class Hn{constructor(c,...u){Object.assign(this,u[0]||{}),this.type=c}}class ts extends Hn{constructor(c,u={}){super("error",Object.assign({error:c},u))}}function Na(f,c,u){u[f]&&u[f].indexOf(c)!==-1||(u[f]=u[f]||[],u[f].push(c))}function ra(f,c,u){if(u&&u[f]){const g=u[f].indexOf(c);g!==-1&&u[f].splice(g,1)}}class pi{on(c,u){return this._listeners=this._listeners||{},Na(c,u,this._listeners),this}off(c,u){return ra(c,u,this._listeners),ra(c,u,this._oneTimeListeners),this}once(c,u){return u?(this._oneTimeListeners=this._oneTimeListeners||{},Na(c,u,this._oneTimeListeners),this):new Promise(g=>{this.once(c,g)})}fire(c,u){const g=typeof c=="string"?new Hn(c,u):c,v=g.type;if(this.listens(v)){g.target=this;const k=this._listeners&&this._listeners[v]?this._listeners[v].slice():[];for(const R of k)R.call(this,g);const S=this._oneTimeListeners&&this._oneTimeListeners[v]?this._oneTimeListeners[v].slice():[];for(const R of S)ra(v,R,this._oneTimeListeners),R.call(this,g);const P=this._eventedParent;if(P){const R=typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData;Object.assign(g,R),P.fire(g)}}else g instanceof ts&&console.error(g.error);return this}listens(c){return!!(this._listeners&&this._listeners[c]&&this._listeners[c].length>0||this._oneTimeListeners&&this._oneTimeListeners[c]&&this._oneTimeListeners[c].length>0||this._eventedParent&&this._eventedParent.listens(c))}setEventedParent(c,u){return this._eventedParent=c,this._eventedParentData=u,this}}class gl{constructor(c){typeof c=="string"?this.name=c:(this.name=c.name,this.iconsetId=c.iconsetId)}static from(c){return new gl(c)}static toString(c){return c.iconsetId?`${c.name}${c.iconsetId}`:c.name}static parse(c){const[u,g]=c.split("");return new gl({name:u,iconsetId:g})}static isEqual(c,u){return c.name===u.name&&c.iconsetId===u.iconsetId}toString(){return gl.toString(this)}serialize(){return{name:this.name,iconsetId:this.iconsetId}}}var fp,pp={},Vd=function(){if(fp)return pp;fp=1;var f={transparent:[0,0,0,0],aliceblue:[240,248,255,1],antiquewhite:[250,235,215,1],aqua:[0,255,255,1],aquamarine:[127,255,212,1],azure:[240,255,255,1],beige:[245,245,220,1],bisque:[255,228,196,1],black:[0,0,0,1],blanchedalmond:[255,235,205,1],blue:[0,0,255,1],blueviolet:[138,43,226,1],brown:[165,42,42,1],burlywood:[222,184,135,1],cadetblue:[95,158,160,1],chartreuse:[127,255,0,1],chocolate:[210,105,30,1],coral:[255,127,80,1],cornflowerblue:[100,149,237,1],cornsilk:[255,248,220,1],crimson:[220,20,60,1],cyan:[0,255,255,1],darkblue:[0,0,139,1],darkcyan:[0,139,139,1],darkgoldenrod:[184,134,11,1],darkgray:[169,169,169,1],darkgreen:[0,100,0,1],darkgrey:[169,169,169,1],darkkhaki:[189,183,107,1],darkmagenta:[139,0,139,1],darkolivegreen:[85,107,47,1],darkorange:[255,140,0,1],darkorchid:[153,50,204,1],darkred:[139,0,0,1],darksalmon:[233,150,122,1],darkseagreen:[143,188,143,1],darkslateblue:[72,61,139,1],darkslategray:[47,79,79,1],darkslategrey:[47,79,79,1],darkturquoise:[0,206,209,1],darkviolet:[148,0,211,1],deeppink:[255,20,147,1],deepskyblue:[0,191,255,1],dimgray:[105,105,105,1],dimgrey:[105,105,105,1],dodgerblue:[30,144,255,1],firebrick:[178,34,34,1],floralwhite:[255,250,240,1],forestgreen:[34,139,34,1],fuchsia:[255,0,255,1],gainsboro:[220,220,220,1],ghostwhite:[248,248,255,1],gold:[255,215,0,1],goldenrod:[218,165,32,1],gray:[128,128,128,1],green:[0,128,0,1],greenyellow:[173,255,47,1],grey:[128,128,128,1],honeydew:[240,255,240,1],hotpink:[255,105,180,1],indianred:[205,92,92,1],indigo:[75,0,130,1],ivory:[255,255,240,1],khaki:[240,230,140,1],lavender:[230,230,250,1],lavenderblush:[255,240,245,1],lawngreen:[124,252,0,1],lemonchiffon:[255,250,205,1],lightblue:[173,216,230,1],lightcoral:[240,128,128,1],lightcyan:[224,255,255,1],lightgoldenrodyellow:[250,250,210,1],lightgray:[211,211,211,1],lightgreen:[144,238,144,1],lightgrey:[211,211,211,1],lightpink:[255,182,193,1],lightsalmon:[255,160,122,1],lightseagreen:[32,178,170,1],lightskyblue:[135,206,250,1],lightslategray:[119,136,153,1],lightslategrey:[119,136,153,1],lightsteelblue:[176,196,222,1],lightyellow:[255,255,224,1],lime:[0,255,0,1],limegreen:[50,205,50,1],linen:[250,240,230,1],magenta:[255,0,255,1],maroon:[128,0,0,1],mediumaquamarine:[102,205,170,1],mediumblue:[0,0,205,1],mediumorchid:[186,85,211,1],mediumpurple:[147,112,219,1],mediumseagreen:[60,179,113,1],mediumslateblue:[123,104,238,1],mediumspringgreen:[0,250,154,1],mediumturquoise:[72,209,204,1],mediumvioletred:[199,21,133,1],midnightblue:[25,25,112,1],mintcream:[245,255,250,1],mistyrose:[255,228,225,1],moccasin:[255,228,181,1],navajowhite:[255,222,173,1],navy:[0,0,128,1],oldlace:[253,245,230,1],olive:[128,128,0,1],olivedrab:[107,142,35,1],orange:[255,165,0,1],orangered:[255,69,0,1],orchid:[218,112,214,1],palegoldenrod:[238,232,170,1],palegreen:[152,251,152,1],paleturquoise:[175,238,238,1],palevioletred:[219,112,147,1],papayawhip:[255,239,213,1],peachpuff:[255,218,185,1],peru:[205,133,63,1],pink:[255,192,203,1],plum:[221,160,221,1],powderblue:[176,224,230,1],purple:[128,0,128,1],rebeccapurple:[102,51,153,1],red:[255,0,0,1],rosybrown:[188,143,143,1],royalblue:[65,105,225,1],saddlebrown:[139,69,19,1],salmon:[250,128,114,1],sandybrown:[244,164,96,1],seagreen:[46,139,87,1],seashell:[255,245,238,1],sienna:[160,82,45,1],silver:[192,192,192,1],skyblue:[135,206,235,1],slateblue:[106,90,205,1],slategray:[112,128,144,1],slategrey:[112,128,144,1],snow:[255,250,250,1],springgreen:[0,255,127,1],steelblue:[70,130,180,1],tan:[210,180,140,1],teal:[0,128,128,1],thistle:[216,191,216,1],tomato:[255,99,71,1],turquoise:[64,224,208,1],violet:[238,130,238,1],wheat:[245,222,179,1],white:[255,255,255,1],whitesmoke:[245,245,245,1],yellow:[255,255,0,1],yellowgreen:[154,205,50,1]};function c(k){return(k=Math.round(k))<0?0:k>255?255:k}function u(k){return c(k[k.length-1]==="%"?parseFloat(k)/100*255:parseInt(k))}function g(k){return(S=k[k.length-1]==="%"?parseFloat(k)/100:parseFloat(k))<0?0:S>1?1:S;var S}function v(k,S,P){return P<0?P+=1:P>1&&(P-=1),6*P<1?k+(S-k)*P*6:2*P<1?S:3*P<2?k+(S-k)*(2/3-P)*6:k}try{pp.parseCSSColor=function(k){var S,P=k.replace(/ /g,"").toLowerCase();if(P in f)return f[P].slice();if(P[0]==="#")return P.length===4?(S=parseInt(P.substr(1),16))>=0&&S<=4095?[(3840&S)>>4|(3840&S)>>8,240&S|(240&S)>>4,15&S|(15&S)<<4,1]:null:P.length===7&&(S=parseInt(P.substr(1),16))>=0&&S<=16777215?[(16711680&S)>>16,(65280&S)>>8,255&S,1]:null;var R=P.indexOf("("),$=P.indexOf(")");if(R!==-1&&$+1===P.length){var W=P.substr(0,R),K=P.substr(R+1,$-(R+1)).split(","),X=1;switch(W){case"rgba":if(K.length!==4)return null;X=g(K.pop());case"rgb":return K.length!==3?null:[u(K[0]),u(K[1]),u(K[2]),X];case"hsla":if(K.length!==4)return null;X=g(K.pop());case"hsl":if(K.length!==3)return null;var re=(parseFloat(K[0])%360+360)%360/360,se=g(K[1]),fe=g(K[2]),Se=fe<=.5?fe*(se+1):fe+se-fe*se,ke=2*fe-Se;return[c(255*v(ke,Se,re+1/3)),c(255*v(ke,Se,re)),c(255*v(ke,Se,re-1/3)),X];default:return null}}return null}}catch{}return pp}();class Sa{constructor(c,u,g,v=1){this.r=c,this.g=u,this.b=g,this.a=v}static parse(c){if(!c)return;if(c instanceof Sa)return c;if(typeof c!="string")return;const u=Vd.parseCSSColor(c);return u?new Sa(u[0]/255,u[1]/255,u[2]/255,u[3]):void 0}toString(){const[c,u,g,v]=[this.r,this.g,this.b,this.a];return`rgba(${Math.round(255*c)},${Math.round(255*u)},${Math.round(255*g)},${v})`}toNonPremultipliedRenderColor(c){const{r:u,g,b:v,a:k}=this;return new WI(c,u,g,v,k)}toPremultipliedRenderColor(c){const{r:u,g,b:v,a:k}=this;return new GI(c,u*k,g*k,v*k,k)}clone(){return new Sa(this.r,this.g,this.b,this.a)}}class HI{constructor(c,u,g,v,k,S=!1){if(this.premultiplied=!1,this.premultiplied=S,c){const P=c.image.height,R=P*P;this.premultiplied?(u=k===0?0:u/k*(P-1),g=k===0?0:g/k*(P-1),v=k===0?0:v/k*(P-1)):(u*=P-1,g*=P-1,v*=P-1);const $=Math.floor(u),W=Math.floor(g),K=Math.floor(v),X=Math.ceil(u),re=Math.ceil(g),se=Math.ceil(v),fe=u-$,Se=g-W,ke=v-K,Fe=c.image.data,$e=4*($+W*R+K*P),Ke=4*($+W*R+se*P),ht=4*($+re*R+K*P),ot=4*($+re*R+se*P),_t=4*(X+W*R+K*P),Ct=4*(X+W*R+se*P),Et=4*(X+re*R+K*P),Kt=4*(X+re*R+se*P);if($e<0||Kt>=Fe.length)throw new Error("out of range");this.r=Fn(Fn(Fn(Fe[$e],Fe[Ke],ke),Fn(Fe[ht],Fe[ot],ke),Se),Fn(Fn(Fe[_t],Fe[Ct],ke),Fn(Fe[Et],Fe[Kt],ke),Se),fe)/255*(this.premultiplied?k:1),this.g=Fn(Fn(Fn(Fe[$e+1],Fe[Ke+1],ke),Fn(Fe[ht+1],Fe[ot+1],ke),Se),Fn(Fn(Fe[_t+1],Fe[Ct+1],ke),Fn(Fe[Et+1],Fe[Kt+1],ke),Se),fe)/255*(this.premultiplied?k:1),this.b=Fn(Fn(Fn(Fe[$e+2],Fe[Ke+2],ke),Fn(Fe[ht+2],Fe[ot+2],ke),Se),Fn(Fn(Fe[_t+2],Fe[Ct+2],ke),Fn(Fe[Et+2],Fe[Kt+2],ke),Se),fe)/255*(this.premultiplied?k:1),this.a=k}else this.r=u,this.g=g,this.b=v,this.a=k}toArray(){const{r:c,g:u,b:g,a:v}=this;return[255*c,255*u,255*g,v]}toHslaArray(){let{r:c,g:u,b:g,a:v}=this;if(this.premultiplied){if(v===0)return[0,0,0,0];const se=1/v;c*=se,u*=se,g*=se}const k=Math.min(Math.max(c,0),1),S=Math.min(Math.max(u,0),1),P=Math.min(Math.max(g,0),1),R=Math.min(k,S,P),$=Math.max(k,S,P),W=$-R,K=.5*(R+$);if(W===0)return[0,0,100*K,v];const X=K>.5?W/(2-$-R):W/($+R);let re;switch($){case k:re=60*((S-P)/W+(SFn(g,c[v],u))}Sa.black=new Sa(0,0,0,1),Sa.white=new Sa(1,1,1,1),Sa.transparent=new Sa(0,0,0,0),Sa.red=new Sa(1,0,0,1),Sa.blue=new Sa(0,0,1,1);var gv=Object.freeze({__proto__:null,array:M3,color:function(f,c,u){return new Sa(Fn(f.r,c.r,u),Fn(f.g,c.g,u),Fn(f.b,c.b,u),Fn(f.a,c.a,u))},number:Fn});class Yu extends Error{constructor(c,u){super(u),this.message=u,this.key=c}}class ky{constructor(c,u=[]){this.parent=c,this.bindings={};for(const[g,v]of u)this.bindings[g]=v}concat(c){return new ky(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 Ah={kind:"null"},mn={kind:"number"},Gs={kind:"string"},Da={kind:"boolean"},wd={kind:"color"},xf={kind:"object"},ja={kind:"value"},yk={kind:"collator"},xv={kind:"formatted"},yv={kind:"resolvedImage"};function yc(f,c){return{kind:"array",itemType:f,N:c}}function Ao(f){if(f.kind==="array"){const c=Ao(f.itemType);return typeof f.N=="number"?`array<${c}, ${f.N}>`:f.itemType.kind==="value"?"array":`array<${c}>`}return f.kind}const $ae=[Ah,mn,Gs,Da,wd,xv,xf,yc(ja),yv];function Am(f,c){if(c.kind==="error")return null;if(f.kind==="array"){if(c.kind==="array"&&(c.N===0&&c.itemType.kind==="value"||!Am(f.itemType,c.itemType))&&(typeof f.N!="number"||f.N===c.N))return null}else{if(f.kind===c.kind)return null;if(f.kind==="value"){for(const u of $ae)if(!Am(u,c))return null}}return`Expected ${Ao(f)} but found ${Ao(c)} instead.`}function T3(f,c){return c.some(u=>u.kind===f.kind)}function vv(f,c){return c.some(u=>u==="null"?f===null:u==="array"?Array.isArray(f):u==="object"?f&&!Array.isArray(f)&&typeof f=="object":u===typeof f)}function vk(f,c){return f.kind==="array"&&c.kind==="array"?f.N===c.N&&vk(f.itemType,c.itemType):f.kind===c.kind}class A3{constructor(c,u,g){this.sensitivity=c?u?"variant":"case":u?"accent":"base",this.locale=g,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(c,u){return this.collator.compare(c,u)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class _k{constructor(c,u,g,v,k){this.text=c.normalize?c.normalize():c,this.image=u,this.scale=g,this.fontStack=v,this.textColor=k}}class Qc{constructor(c){this.sections=c}static fromString(c){return new Qc([new _k(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 Qc?c:Qc.fromString(c)}toString(){return this.sections.length===0?"":this.sections.map(c=>c.text).join("")}serialize(){const c=["format"];for(const u of this.sections){if(u.image){const v=u.image.getPrimary().id.toString();c.push(["image",v]);continue}c.push(u.text);const g={};u.fontStack&&(g["text-font"]=["literal",u.fontStack.split(",")]),u.scale&&(g["font-scale"]=u.scale),u.textColor&&(g["text-color"]=["rgba"].concat(u.textColor.toNonPremultipliedRenderColor(null).toArray())),c.push(g)}return c}}class mp{constructor(c,u={}){this.id=gl.from(c),this.params=u.params,this.sx=u.sx||1,this.sy=u.sy||1}toString(){return JSON.stringify(this)}static parse(c){let u,g,v,k;try{({id:u,params:g,sx:v,sy:k}=JSON.parse(c)||{})}catch{return null}return u?new mp(u,{params:g,sx:v,sy:k}):null}scaleSelf(c,u=c){return this.sx*=c,this.sy*=u,this}}class Jc{constructor(c,u,g,v,k=!1){this.primaryId=gl.from(c),this.primaryOptions=u,g&&(this.secondaryId=gl.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 mp(this.primaryId,this.primaryOptions)}hasSecondary(){return!!this.secondaryId}getSecondary(){return this.secondaryId?new mp(this.secondaryId,this.secondaryOptions):null}static from(c){return typeof c=="string"?Jc.build({name:c}):c}static build(c,u,g,v){return!c||typeof c=="object"&&!("name"in c)?null:new Jc(c,g,u,v)}}function Wg(f,c,u,g){return typeof f=="number"&&f>=0&&f<=255&&typeof c=="number"&&c>=0&&c<=255&&typeof u=="number"&&u>=0&&u<=255?g===void 0||typeof g=="number"&&g>=0&&g<=1?null:`Invalid rgba value [${[f,c,u,g].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof g=="number"?[f,c,u,g]:[f,c,u]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function Ny(f){if(f===null||typeof f=="string"||typeof f=="boolean"||typeof f=="number"||f instanceof Sa||f instanceof A3||f instanceof Qc||f instanceof Jc)return!0;if(Array.isArray(f)){for(const c of f)if(!Ny(c))return!1;return!0}if(typeof f=="object"){for(const c in f)if(!Ny(f[c]))return!1;return!0}return!1}function xl(f){if(f===null)return Ah;if(typeof f=="string")return Gs;if(typeof f=="boolean")return Da;if(typeof f=="number")return mn;if(f instanceof Sa)return wd;if(f instanceof A3)return yk;if(f instanceof Qc)return xv;if(f instanceof Jc)return yv;if(Array.isArray(f)){const c=f.length;let u;for(const g of f){const v=xl(g);if(u){if(u===v)continue;u=ja;break}u=v}return yc(u||ja,c)}return xf}function Xu(f){const c=typeof f;return f===null?"":c==="string"||c==="number"||c==="boolean"?String(f):f instanceof Qc||f instanceof Jc||f instanceof Sa?f.toString():JSON.stringify(f)}class gp{constructor(c,u){this.type=c,this.value=u}static parse(c,u){if(c.length!==2)return u.error(`'literal' expression requires exactly one argument, but found ${c.length-1} instead.`);if(!Ny(c[1]))return u.error("invalid value");const g=c[1];let v=xl(g);const k=u.expectedType;return v.kind!=="array"||v.N!==0||!k||k.kind!=="array"||typeof k.N=="number"&&k.N!==0||(v=k),new gp(v,g)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}serialize(){return this.type.kind==="array"||this.type.kind==="object"?["literal",this.value]:this.value instanceof Sa?["rgba"].concat(this.value.toNonPremultipliedRenderColor(null).toArray()):this.value instanceof Qc?this.value.serialize():this.value}}class rl{constructor(c){this.name="ExpressionEvaluationError",this.message=c}toJSON(){return this.message}}const E3={string:Gs,number:mn,boolean:Da,object:xf};class Eh{constructor(c,u){this.type=c,this.args=u}static parse(c,u){if(c.length<2)return u.error("Expected at least one argument.");let g,v=1;const k=c[0];if(k==="array"){let P,R;if(c.length>2){const $=c[1];if(typeof $!="string"||!($ in E3)||$==="object")return u.error('The item type argument of "array" must be one of string, number, boolean',1);P=E3[$],v++}else P=ja;if(c.length>3){if(c[2]!==null&&(typeof c[2]!="number"||c[2]<0||c[2]!==Math.floor(c[2])))return u.error('The length argument to "array" must be a positive integer literal',2);R=c[2],v++}g=yc(P,R)}else g=E3[k];const S=[];for(;vc.outputDefined())}serialize(){const c=this.type,u=[c.kind];if(c.kind==="array"){const g=c.itemType;if(g.kind==="string"||g.kind==="number"||g.kind==="boolean"){u.push(g.kind);const v=c.N;(typeof v=="number"||this.args.length>1)&&u.push(v)}}return u.concat(this.args.map(g=>g.serialize()))}}class yf{constructor(c){this.type=xv,this.sections=c}static parse(c,u){if(c.length<2)return u.error("Expected at least one argument.");const g=c[1];if(!Array.isArray(g)&&typeof g=="object")return u.error("First argument must be an image or text section.");const v=[];let k=!1;for(let S=1;S<=c.length-1;++S){const P=c[S];if(k&&typeof P=="object"&&!Array.isArray(P)){k=!1;let R=null;if(P["font-scale"]&&(R=u.parseObjectValue(P["font-scale"],S,"font-scale",mn),!R))return null;let $=null;if(P["text-font"]&&($=u.parseObjectValue(P["text-font"],S,"text-font",yc(Gs)),!$))return null;let W=null;if(P["text-color"]&&(W=u.parseObjectValue(P["text-color"],S,"text-color",wd),!W))return null;const K=v[v.length-1];K.scale=R,K.font=$,K.textColor=W}else{const R=u.parse(c[S],S,ja);if(!R)return null;const $=R.type.kind;if($!=="string"&&$!=="value"&&$!=="null"&&$!=="resolvedImage")return u.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");k=!0,v.push({content:R,scale:null,font:null,textColor:null})}}return new yf(v)}evaluate(c){return new Qc(this.sections.map(u=>{const g=u.content.evaluate(c);return vk(xl(g),yv)?new _k("",g,null,null,null):new _k(Xu(g),null,u.scale?u.scale.evaluate(c):null,u.font?u.font.evaluate(c).join(","):null,u.textColor?u.textColor.evaluate(c):null)}))}eachChild(c){for(const u of this.sections)c(u.content),u.scale&&c(u.scale),u.font&&c(u.font),u.textColor&&c(u.textColor)}outputDefined(){return!1}serialize(){const c=["format"];for(const u of this.sections){c.push(u.content.serialize());const g={};u.scale&&(g["font-scale"]=u.scale.serialize()),u.font&&(g["text-font"]=u.font.serialize()),u.textColor&&(g["text-color"]=u.textColor.serialize()),c.push(g)}return c}}class as{constructor(c,u,g,v){this._imageWarnHistory={},this.type=yv,this.namePrimary=c,this.nameSecondary=u,g&&(this.paramsPrimary=g.params,this.iconsetIdPrimary=g.iconset?g.iconset.id:void 0),v&&(this.paramsSecondary=v.params,this.iconsetIdSecondary=v.iconset?v.iconset.id:void 0)}static parse(c,u){if(c.length<2)return u.error("Expected two or more arguments.");let g=1;const v=[];function k(){if(ggl.isEqual(S,k)),v.available){const S=v.getSecondary()?v.getSecondary().id:null;S&&(v.available=c.availableImages.some(P=>gl.isEqual(P,S)))}}return v}eachChild(c){if(c(this.namePrimary),this.paramsPrimary)for(const u in this.paramsPrimary)this.paramsPrimary[u]&&c(this.paramsPrimary[u]);if(this.nameSecondary&&(c(this.nameSecondary),this.paramsSecondary))for(const u in this.paramsSecondary)this.paramsSecondary[u]&&c(this.paramsSecondary[u])}outputDefined(){return!1}serializeOptions(c,u){const g={};if(u&&(g.iconset={id:u}),c){g.params={};for(const v in c)c[v]&&(g.params[v]=c[v].serialize())}return Object.keys(g).length>0?g:void 0}serialize(){const c=["image",this.namePrimary.serialize()];if(this.paramsPrimary||this.iconsetIdPrimary){const u=this.serializeOptions(this.paramsPrimary,this.iconsetIdPrimary);u&&c.push(u)}if(this.nameSecondary&&(c.push(this.nameSecondary.serialize()),this.paramsSecondary||this.iconsetIdSecondary)){const u=this.serializeOptions(this.paramsSecondary,this.iconsetIdSecondary);u&&c.push(u)}return c}}function dn(f){return $n(f)?"string":Sy(f)?"number":wk(f)?"boolean":Array.isArray(f)?"array":f===null?"null":bk(f)?"object":typeof f}function bk(f){return f!=null&&!Array.isArray(f)&&typeof f!="function"&&!(f instanceof String||f instanceof Number||f instanceof Boolean)&&typeof f=="object"}function $n(f){return typeof f=="string"||f instanceof String}function Sy(f){return typeof f=="number"||f instanceof Number}function wk(f){return typeof f=="boolean"||f instanceof Boolean}const zn={"to-boolean":Da,"to-color":wd,"to-number":mn,"to-string":Gs};class vf{constructor(c,u){this.type=c,this.args=u}static parse(c,u){if(c.length<2)return u.error("Expected at least one argument.");const g=c[0],v=[];let k=Ah;if(g==="to-array"){if(!Array.isArray(c[1]))return null;const S=c[1].length;if(u.expectedType){if(u.expectedType.kind!=="array")return u.error(`Expected ${u.expectedType.kind} but found array.`);k=yc(u.expectedType.itemType,S)}else{if(!(S>0&&Ny(c[1][0])))return null;k=yc(xl(c[1][0]),S)}for(let P=0;P4?`Invalid rbga value ${JSON.stringify(u)}: expected an array containing either three or four numeric values.`:Wg(u[0],u[1],u[2],u[3]),!g))return new Sa(u[0]/255,u[1]/255,u[2]/255,u[3])}throw new rl(g||`Could not parse color from value '${typeof u=="string"?u:String(JSON.stringify(u))}'`)}if(this.type.kind==="number"){let u=null;for(const g of this.args){if(u=g.evaluate(c),u===null)return 0;const v=Number(u);if(!isNaN(v))return v}throw new rl(`Could not convert ${JSON.stringify(u)} to number.`)}return this.type.kind==="formatted"?Qc.fromString(Xu(this.args[0].evaluate(c))):this.type.kind==="resolvedImage"?Jc.build(Xu(this.args[0].evaluate(c))):this.type.kind==="array"?this.args.map(u=>u.evaluate(c)):Xu(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 yf([{content:this.args[0],scale:null,font:null,textColor:null}]).serialize();if(this.type.kind==="resolvedImage")return new as(this.args[0]).serialize();const c=this.type.kind==="array"?[]:[`to-${this.type.kind}`];return this.eachChild(u=>{c.push(u.serialize())}),c}}const I3=["Unknown","Point","LineString","Polygon"];class jk{constructor(c,u,g){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null,this.featureTileCoord=null,this.featureDistanceData=null,this.scope=c,this.options=u,this.iconImageUseTheme=g}id(){return this.feature&&this.feature.id!==void 0?this.feature.id:null}geometryType(){return this.feature?typeof this.feature.type=="number"?I3[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}measureLight(c){return this.globals.brightness||0}distanceFromCenter(){if(this.featureTileCoord&&this.featureDistanceData){const c=this.featureDistanceData.center,u=this.featureDistanceData.scale,{x:g,y:v}=this.featureTileCoord;return this.featureDistanceData.bearing[0]*(g*u-c[0])+this.featureDistanceData.bearing[1]*(v*u-c[1])}return 0}parseColor(c){let u=this._parseColorCache[c];return u||(u=this._parseColorCache[c]=Sa.parse(c)),u}getConfig(c){return this.options?this.options.get(c):null}}class ed{constructor(c,u,g,v,k){this.name=c,this.type=u,this._evaluate=g,this.args=v,this._overloadIndex=k}evaluate(c){if(!this._evaluate){const u=ed.definitions[this.name];this._evaluate=Array.isArray(u)?u[2]:u.overloads[this._overloadIndex][1]}return this._evaluate(c,this.args)}eachChild(c){this.args.forEach(c)}outputDefined(){return!1}serialize(){return[this.name].concat(this.args.map(c=>c.serialize()))}static parse(c,u){const g=c[0],v=ed.definitions[g];if(!v)return u.error(`Unknown expression "${g}". If you wanted a literal array, use ["literal", [...]].`,0);const k=Array.isArray(v)?v[0]:v.type,S=Array.isArray(v)?[[v[1],v[2]]]:v.overloads,P=[];let R=null,$=-1;for(const[W,K]of S){if(Array.isArray(W)&&W.length!==c.length-1)continue;P.push(W),$++,R=new Ok(u.registry,u.path,null,u.scope,void 0,u._scope,u.options,u.iconImageUseTheme);const X=[];let re=!1;for(let se=1;seX)).map(kk).join(" | "),K=[];for(let X=1;Xu;){if(g-u>600){const R=g-u+1,$=c-u+1,W=Math.log(R),K=.5*Math.exp(2*W/3),X=.5*Math.sqrt(W*K*(R-K)/R)*($-R/2<0?-1:1);Nk(f,c,Math.max(u,Math.floor(c-$*K/R+X)),Math.min(g,Math.floor(c+(R-$)*K/R+X)),v)}const k=f[c];let S=u,P=g;for(Ih(f,u,c),v(f[g],k)>0&&Ih(f,u,g);S0;)P--}v(f[u],k)===0?Ih(f,u,P):(P++,Ih(f,P,g)),P<=c&&(u=P+1),c<=P&&(g=P-1)}}function Ih(f,c,u){const g=f[c];f[c]=f[u],f[u]=g}function P3(f,c){return fc?1:0}function Em(f){let c=0;for(let u,g,v=0,k=f.length,S=k-1;v=c[2]||f[1]<=c[1]||f[3]>=c[3])}function Uae(f,c,u){const g=f[0]-c[0],v=f[1]-c[1],k=f[0]-u[0],S=f[1]-u[1];return g*S-k*v==0&&g*k<=0&&v*S<=0}function Cy(f,c,u=!1){let g=!1;for(let P=0,R=c.length;P(v=f)[1]!=(S=se)[1]>v[1]&&v[0]<(S[0]-k[0])*(v[1]-k[1])/(S[1]-k[1])+k[0]&&(g=!g)}}var v,k,S;return g}function bv(f,c,u,g){const v=g[0]-u[0],k=g[1]-u[1],S=(f[0]-u[0])*k-v*(f[1]-u[1]),P=(c[0]-u[0])*k-v*(c[1]-u[1]);return S>0&&P<0||S<0&&P>0}function wv(f,c,u,g){return(v=[g[0]-u[0],g[1]-u[1]])[0]*(k=[c[0]-f[0],c[1]-f[1]])[1]-v[1]*k[0]!=0&&!(!bv(f,c,u,g)||!bv(u,g,f,c));var v,k}function xp(f){const c=new ir(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),u=new ir(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY);for(const g of f[0])c.x>g.x&&(c.x=g.x),c.y>g.y&&(c.y=g.y),u.xu[2]){const v=.5*g;let k=f[0]-u[0]>v?-g:u[0]-f[0]>v?g:0;k===0&&(k=f[0]-u[2]>v?-g:u[2]-f[0]>v?g:0),f[0]+=k}Qu(c,f)}function XI(f,c,u,g){const v=Math.pow(2,g.z)*Im,k=[g.x*Im,g.y*Im],S=[];if(!f)return S;for(const P of f)for(const R of P){const $=[R.x+k[0],R.y+k[1]];YI($,c,u,v),S.push($)}return S}function Sk(f,c,u,g){const v=Math.pow(2,g.z)*Im,k=[g.x*Im,g.y*Im],S=[];if(!f)return S;for(const R of f){const $=[];for(const W of R){const K=[W.x+k[0],W.y+k[1]];Qu(c,K),$.push(K)}S.push($)}if(c[2]-c[0]<=v/2){(P=c)[0]=P[1]=1/0,P[2]=P[3]=-1/0;for(const R of S)for(const $ of R)YI($,c,u,v)}var P;return S}class Lm{constructor(c,u){this.type=Da,this.geojson=c,this.geometries=u}static parse(c,u){if(c.length!==2)return u.error(`'within' expression requires exactly one argument, but found ${c.length-1} instead.`);if(Ny(c[1])){const g=c[1];if(g.type==="FeatureCollection")for(let v=0;vu)return Ck(k,S,(u-(g-P))/P)}return c[c.length-1]}pointToSegmentDistance(c,u,g){let[v,k]=u,S=xu(g[0]-v)*this.kx,P=(g[1]-k)*this.ky;if(S!==0||P!==0){const R=(xu(c[0]-v)*this.kx*S+(c[1]-k)*this.ky*P)/(S*S+P*P);R>1?(v=g[0],k=g[1]):R>0&&(v+=S/this.kx*R,k+=P/this.ky*R)}return S=xu(c[0]-v)*this.kx,P=(c[1]-k)*this.ky,Math.sqrt(S*S+P*P)}pointOnLine(c,u){let g=1/0,v=c[0][0],k=c[0][1],S=0,P=0;for(let R=0;R1?($=c[R+1][0],W=c[R+1][1]):re>0&&($+=K/this.kx*re,W+=X/this.ky*re)),K=xu(u[0]-$)*this.kx,X=(u[1]-W)*this.ky;const se=K*K+X*X;sek.index||v.index===k.index&&v.t>k.t){const $=v;v=k,k=$}const S=[v.point],P=v.index+1,R=k.index;!D3(g[P],S[0])&&P<=R&&S.push(g[P]);for(let $=P+1;$<=R;$++)S.push(g[$]);return D3(g[R],k.point)||S.push(k.point),S}lineSliceAlong(c,u,g){let v=0;const k=[];for(let S=0;Sc&&k.length===0&&k.push(Ck(P,R,(c-(v-$))/$)),v>=u)return k.push(Ck(P,R,(u-(v-$))/$)),k;v>c&&k.push(R)}return k}bufferPoint(c,u){const g=u/this.ky,v=u/this.kx;return[c[0]-v,c[1]-g,c[0]+v,c[1]+g]}bufferBBox(c,u){const g=u/this.ky,v=u/this.kx;return[c[0]-v,c[1]-g,c[2]+v,c[3]+g]}insideBBox(c,u){return xu(c[0]-u[0])>=0&&xu(c[0]-u[2])<=0&&c[1]>=u[1]&&c[1]<=u[3]}}function D3(f,c){return f[0]===c[0]&&f[1]===c[1]}function Ck(f,c,u){const g=xu(c[0]-f[0]);return[f[0]+g*u,f[1]+(c[1]-f[1])*u]}function xu(f){for(;f<-180;)f+=360;for(;f>180;)f-=360;return f}class Mk{constructor(c=[],u=(g,v)=>gv?1:0){if(this.data=c,this.length=this.data.length,this.compare=u,this.length>0)for(let g=(this.length>>1)-1;g>=0;g--)this._down(g)}push(c){this.data.push(c),this._up(this.length++)}pop(){if(this.length===0)return;const c=this.data[0],u=this.data.pop();return--this.length>0&&(this.data[0]=u,this._down(0)),c}peek(){return this.data[0]}_up(c){const{data:u,compare:g}=this,v=u[c];for(;c>0;){const k=c-1>>1,S=u[k];if(g(v,S)>=0)break;u[c]=S,c=k}u[c]=v}_down(c){const{data:u,compare:g}=this,v=this.length>>1,k=u[c];for(;c=0)break;u[c]=u[S],c=S}u[c]=k}}var Sr=8192;function R3(f,c){return c.dist-f.dist}const Tk=100,Ak=50;function F3(f){const c=[1/0,1/0,-1/0,-1/0];if(c.length!==f.length)return!1;for(let u=0;u=f[0]&&f[1]f[1])return[null,null];const u=kv(f);if(c){if(u===2)return[f,null];const g=Math.floor(u/2);return[[f[0],f[0]+g],[f[0]+g,f[1]]]}{if(u===1)return[f,null];const g=Math.floor(u/2)-1;return[[f[0],f[0]+g],[f[0]+g+1,f[1]]]}}function Gg(f,c){const u=[1/0,1/0,-1/0,-1/0];if(!_f(c,f.length))return u;for(let g=c[0];g<=c[1];++g)Qu(u,f[g]);return u}function Kg(f){const c=[1/0,1/0,-1/0,-1/0];for(let u=0;uc[2]&&(g=f[0]-c[2]),f[1]>c[3]&&(v=f[1]-c[3]),f[3]=g)return g;if(_v(v,k)){if($3(f,c))return 0}else if($3(c,f))return 0;let S=g;for(const P of f)for(let R=0,$=P.length,W=$-1;R<$;W=R++)for(const K of c)for(let X=0,re=K.length,se=re-1;X=k)continue;const W=$.range1;if(kv(W)<=P){if(!_f(W,f.length))return NaN;if(c){const K=Kae(f,W,u,g);if((k=Math.min(k,K))===0)return k}else for(let K=W[0];K<=W[1];++K){const X=Gae(f[K],u,g);if((k=Math.min(k,X))===0)return k}}else{const K=z3(W,c);if(K[0]!==null){const X=Om(Gg(f,K[0]),R,g);X=S)continue;const K=W.range1,X=W.range2;if(kv(K)<=R&&kv(X)<=$){if(!_f(K,f.length)||!_f(X,u.length))return NaN;if(c&&g?S=Math.min(S,Xs(f,K,u,X,v)):c||g?c&&!g?S=Math.min(S,B3(u,X,f,K,v)):!c&&g&&(S=Math.min(S,B3(f,K,u,X,v))):S=Math.min(S,Wae(f,K,u,X,v)),S===0)return S}else{const re=z3(K,c),se=z3(X,g);Si(P,S,v,f,u,re[0],se[0]),Si(P,S,v,f,u,re[0],se[1]),Si(P,S,v,f,u,re[1],se[0]),Si(P,S,v,f,u,re[1],se[1])}}return S}function U3(f,c,u,g,v=1/0){let k=v;const S=Gg(f,[0,f.length-1]);for(const P of u)if(!(k!==1/0&&Om(S,Gg(P,[0,P.length-1]),g)>=k)&&(k=Math.min(k,tP(f,c,P,!0,g,k)),k===0))return k;return k}function Pk(f,c,u,g,v=1/0){let k=v;const S=Gg(f,[0,f.length-1]);for(const P of u){if(k!==1/0&&Om(S,Kg(P),g)>=k)continue;const R=Yae(f,c,P,g,k);if(isNaN(R))return R;if((k=Math.min(k,R))===0)return k}return k}function q3(f){return f==="Point"||f==="MultiPoint"||f==="LineString"||f==="MultiLineString"||f==="Polygon"||f==="MultiPolygon"}class Zg{constructor(c,u){this.type=mn,this.geojson=c,this.geometries=u}static parse(c,u){if(c.length!==2)return u.error(`'distance' expression requires either one argument, but found ' ${c.length-1} instead.`);if(Ny(c[1])){const g=c[1];if(g.type==="FeatureCollection"){for(let v=0;v{c&&!Ay(u)&&(c=!1)}),c}function Nv(f){if(f instanceof ed&&f.name==="feature-state")return!1;let c=!0;return f.eachChild(u=>{c&&!Nv(u)&&(c=!1)}),c}function Ey(f,c){if(f instanceof ed&&c.indexOf(f.name)>=0)return!1;let u=!0;return f.eachChild(g=>{u&&!Ey(g,c)&&(u=!1)}),u}function rP(f,c,u){return[f,c,u].filter(Boolean).join("")}function V3(f,c){switch(f){case"string":return Xu(c);case"number":return+c;case"boolean":return!!c;case"color":return Sa.parse(c);case"formatted":return Qc.fromString(Xu(c));case"resolvedImage":return Jc.build(Xu(c))}return c}function nP(f,c,u,g){return g!==void 0&&(f=g*Math.round(f/g)),c!==void 0&&fu&&(f=u),f}class Iy{constructor(c,u,g,v=!1){this.type=c,this.key=u,this.scope=g,this.featureConstant=v}static parse(c,u){let g=u.expectedType;if(g==null&&(g=ja),c.length<2||c.length>3)return u.error("Invalid number of arguments for 'config' expression.");const v=u.parse(c[1],1);if(!(v instanceof gp))return u.error("Key name of 'config' expression must be a string literal.");let k,S=!0;const P=Xu(v.value);if(c.length>=3){const R=u.parse(c[2],2);if(!(R instanceof gp))return u.error("Scope of 'config' expression must be a string literal.");k=Xu(R.value)}if(u.options){const R=rP(P,k,u._scope),$=u.options.get(R);$&&(S=Ay($.value||$.default))}return new Iy(g,P,k,S)}evaluate(c){const u=rP(this.key,this.scope,c.scope),g=c.getConfig(u);if(!g)return null;const{type:v,value:k,values:S,minValue:P,maxValue:R,stepValue:$}=g,W=g.default.evaluate(c);let K=W;if(k){const X=c.scope;c.scope=(X||"").split("").slice(1).join(""),K=k.evaluate(c),c.scope=X}return v&&(K=V3(v,K)),K===void 0||P===void 0&&R===void 0&&$===void 0||(typeof K=="number"?K=nP(K,P,R,$):Array.isArray(K)&&(K=K.map(X=>typeof X=="number"?nP(X,P,R,$):X))),k!==void 0&&K!==void 0&&S&&!S.includes(K)&&(K=W,v&&(K=V3(v,K))),(v&&v!==this.type||K!==void 0&&!vk(xl(K),this.type))&&(K=V3(this.type.kind,K)),K}eachChild(){}outputDefined(){return!1}serialize(){const c=["config",this.key];return this.scope&&c.concat(this.scope),c}}class Lk{constructor(c,u){this.type=u.type,this.name=c,this.boundExpression=u}static parse(c,u){if(c.length!==2||typeof c[1]!="string")return u.error("'var' expression requires exactly one string literal argument.");const g=c[1];return u.scope.has(g)?new Lk(g,u.scope.get(g)):u.error(`Unknown variable "${g}". Make sure "${g}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(c){return this.boundExpression.evaluate(c)}eachChild(){}outputDefined(){return!1}serialize(){return["var",this.name]}}class Ok{constructor(c,u=[],g,v=new ky,k=[],S,P,R){this.registry=c,this.path=u,this.key=u.map($=>typeof $=="string"?`['${$}']`:`[${$}]`).join(""),this.scope=v,this.errors=k,this.expectedType=g,this._scope=S,this.options=P,this.iconImageUseTheme=R}parse(c,u,g,v,k={}){return u||g?this.concat(u,null,g,v)._parse(c,k):this._parse(c,k)}parseObjectValue(c,u,g,v,k,S={}){return this.concat(u,g,v,k)._parse(c,S)}_parse(c,u){function g(v,k,S){return S==="assert"?new Eh(k,[v]):S==="coerce"?new vf(k,[v]):v}if(c!==null&&typeof c!="string"&&typeof c!="boolean"&&typeof c!="number"||(c=["literal",c]),Array.isArray(c)){if(c.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const v=typeof c[0]=="string"?this.registry[c[0]]:void 0;if(v){let k=v.parse(c,this);if(!k)return null;if(this.expectedType){const S=this.expectedType,P=k.type;if(S.kind!=="string"&&S.kind!=="number"&&S.kind!=="boolean"&&S.kind!=="object"&&S.kind!=="array"||P.kind!=="value")if(S.kind!=="color"&&S.kind!=="formatted"&&S.kind!=="resolvedImage"||P.kind!=="value"&&P.kind!=="string"){if(this.checkSubtype(S,P))return null}else k=g(k,S,u.typeAnnotation||"coerce");else k=g(k,S,u.typeAnnotation||"assert")}if(!(k instanceof gp)&&k.type.kind!=="resolvedImage"&&H3(k)){const S=new jk(this._scope,this.options,this.iconImageUseTheme);try{k=new gp(k.type,k.evaluate(S))}catch(P){return this.error(P.message),null}}return k}return vf.parse(["to-array",c],this)}return this.error(c===void 0?"'undefined' value invalid. Use null instead.":typeof c=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof c} instead.`)}concat(c,u,g,v){let k=typeof c=="number"?this.path.concat(c):this.path;k=typeof u=="string"?k.concat(u):k;const S=v?this.scope.concat(v):this.scope;return new Ok(this.registry,k,g||null,S,this.errors,this._scope,this.options,this.iconImageUseTheme)}error(c,...u){const g=`${this.key}${u.map(v=>`[${v}]`).join("")}`;this.errors.push(new Yu(g,c))}checkSubtype(c,u){const g=Am(c,u);return g&&this.error(g),g}}function H3(f){if(f instanceof Lk)return H3(f.boundExpression);if(f instanceof ed&&f.name==="error"||f instanceof Cl||f instanceof Lm||f instanceof Zg||f instanceof Iy)return!1;const c=f instanceof vf||f instanceof Eh;let u=!0;return f.eachChild(g=>{u=c?u&&H3(g):u&&g instanceof gp}),!!u&&Ay(f)&&Ey(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 Dk(f,c){const u=f.length-1;let g,v,k=0,S=u,P=0;for(;k<=S;)if(P=Math.floor((k+S)/2),g=f[P],v=f[P+1],g<=c){if(P===u||cc))throw new rl("Input is not a number.");S=P-1}return 0}class Sv{constructor(c,u,g){this.type=c,this.input=u,this.labels=[],this.outputs=[];for(const[v,k]of g)this.labels.push(v),this.outputs.push(k)}static parse(c,u){if(c.length-1<4)return u.error(`Expected at least 4 arguments, but found only ${c.length-1}.`);if((c.length-1)%2!=0)return u.error("Expected an even number of arguments.");const g=u.parse(c[1],1,mn);if(!g)return null;const v=[];let k=null;u.expectedType&&u.expectedType.kind!=="value"&&(k=u.expectedType);for(let S=1;S=P)return u.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',$);const K=u.parse(R,W,k);if(!K)return null;k=k||K.type,v.push([P,K])}return new Sv(k,g,v)}evaluate(c){const u=this.labels,g=this.outputs;if(u.length===1)return g[0].evaluate(c);const v=this.input.evaluate(c);if(v<=u[0])return g[0].evaluate(c);const k=u.length;return v>=u[k-1]?g[k-1].evaluate(c):g[Dk(u,v)].evaluate(c)}eachChild(c){c(this.input);for(const u of this.outputs)c(u)}outputDefined(){return this.outputs.every(c=>c.outputDefined())}serialize(){const c=["step",this.input.serialize()];for(let u=0;u0&&c.push(this.labels[u]),c.push(this.outputs[u].serialize());return c}}const sP=.95047,aP=1.08883,iP=4/29,Py=6/29,oP=3*Py*Py,Xae=Py*Py*Py,Qae=Math.PI/180,Jae=180/Math.PI;function W3(f){return f>Xae?Math.pow(f,1/3):f/oP+iP}function G3(f){return f>Py?f*f*f:oP*(f-iP)}function K3(f){return 255*(f<=.0031308?12.92*f:1.055*Math.pow(f,1/2.4)-.055)}function Z3(f){return(f/=255)<=.04045?f/12.92:Math.pow((f+.055)/1.055,2.4)}function lP(f){const c=Z3(f.r),u=Z3(f.g),g=Z3(f.b),v=W3((.4124564*c+.3575761*u+.1804375*g)/sP),k=W3((.2126729*c+.7151522*u+.072175*g)/1);return{l:116*k-16,a:500*(v-k),b:200*(k-W3((.0193339*c+.119192*u+.9503041*g)/aP)),alpha:f.a}}function Rk(f){let c=(f.l+16)/116,u=isNaN(f.a)?c:c+f.a/500,g=isNaN(f.b)?c:c-f.b/200;return c=1*G3(c),u=sP*G3(u),g=aP*G3(g),new Sa(K3(3.2404542*u-1.5371385*c-.4985314*g),K3(-.969266*u+1.8760108*c+.041556*g),K3(.0556434*u-.2040259*c+1.0572252*g),f.alpha)}function Fk(f,c,u){const g=c-f;return f+u*(g>180||g<-180?g-360*Math.round(g/360):g)}const Ly={forward:lP,reverse:Rk,interpolate:function(f,c,u){return{l:Fn(f.l,c.l,u),a:Fn(f.a,c.a,u),b:Fn(f.b,c.b,u),alpha:Fn(f.alpha,c.alpha,u)}}},Cv={forward:function(f){const{l:c,a:u,b:g}=lP(f),v=Math.atan2(g,u)*Jae;return{h:v<0?v+360:v,c:Math.sqrt(u*u+g*g),l:c,alpha:f.a}},reverse:function(f){const c=f.h*Qae,u=f.c;return Rk({l:f.l,a:Math.cos(c)*u,b:Math.sin(c)*u,alpha:f.alpha})},interpolate:function(f,c,u){return{h:Fk(f.h,c.h,u),c:Fn(f.c,c.c,u),l:Fn(f.l,c.l,u),alpha:Fn(f.alpha,c.alpha,u)}}};var cP=Object.freeze({__proto__:null,hcl:Cv,lab:Ly});class yu{constructor(c,u,g,v,k){this.type=c,this.operator=u,this.interpolation=g,this.input=v,this.labels=[],this.outputs=[];for(const[S,P]of k)this.labels.push(S),this.outputs.push(P)}static interpolationFactor(c,u,g,v){let k=0;if(c.name==="exponential")k=zk(u,c.base,g,v);else if(c.name==="linear")k=zk(u,1,g,v);else if(c.name==="cubic-bezier"){const S=c.controlPoints;k=new Do(S[0],S[1],S[2],S[3]).solve(zk(u,1,g,v))}return k}static parse(c,u){let[g,v,k,...S]=c;if(!Array.isArray(v)||v.length===0)return u.error("Expected an interpolation type expression.",1);if(v[0]==="linear")v={name:"linear"};else if(v[0]==="exponential"){const $=v[1];if(typeof $!="number")return u.error("Exponential interpolation requires a numeric base.",1,1);v={name:"exponential",base:$}}else{if(v[0]!=="cubic-bezier")return u.error(`Unknown interpolation type ${String(v[0])}`,1,0);{const $=v.slice(1);if($.length!==4||$.some(W=>typeof W!="number"||W<0||W>1))return u.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);v={name:"cubic-bezier",controlPoints:$}}}if(c.length-1<4)return u.error(`Expected at least 4 arguments, but found only ${c.length-1}.`);if(c.length-1>3&&(c.length-1)%2!=0)return u.error("Expected an even number of arguments.");if(k=u.parse(k,2,mn),!k)return null;const P=[];let R=null;g==="interpolate-hcl"||g==="interpolate-lab"?R=wd:u.expectedType&&u.expectedType.kind!=="value"&&(R=u.expectedType);for(let $=0;$=W)return u.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',X);const se=u.parse(K,re,R);if(!se)return null;R=R||se.type,P.push([W,se])}return R.kind==="number"||R.kind==="color"||R.kind==="array"&&R.itemType.kind==="number"&&typeof R.N=="number"?new yu(R,g,v,k,P):u.error(`Type ${Ao(R)} is not interpolatable.`)}evaluate(c){const u=this.labels,g=this.outputs;if(u.length===1)return g[0].evaluate(c);const v=this.input.evaluate(c);if(v<=u[0])return g[0].evaluate(c);const k=u.length;if(v>=u[k-1])return g[k-1].evaluate(c);const S=Dk(u,v),P=yu.interpolationFactor(this.interpolation,v,u[S],u[S+1]),R=g[S].evaluate(c),$=g[S+1].evaluate(c);return this.operator==="interpolate"?gv[this.type.kind.toLowerCase()](R,$,P):this.operator==="interpolate-hcl"?Cv.reverse(Cv.interpolate(Cv.forward(R),Cv.forward($),P)):Ly.reverse(Ly.interpolate(Ly.forward(R),Ly.forward($),P))}eachChild(c){c(this.input);for(const u of this.outputs)c(u)}outputDefined(){return this.outputs.every(c=>c.outputDefined())}serialize(){let c;c=this.interpolation.name==="linear"?["linear"]:this.interpolation.name==="exponential"?this.interpolation.base===1?["linear"]:["exponential",this.interpolation.base]:["cubic-bezier",...this.interpolation.controlPoints];const u=[this.operator,c,this.input.serialize()];for(let g=0;gAm(v,P.type));return new Mv(S?ja:g,k)}evaluate(c){let u,g=null,v=0;for(const k of this.args){if(v++,g=k.evaluate(c),g&&g instanceof Jc&&!g.available&&(u||(u=g),g=null,v===this.args.length))return u;if(g!==null)break}return g}eachChild(c){this.args.forEach(c)}outputDefined(){return this.args.every(c=>c.outputDefined())}serialize(){const c=["coalesce"];return this.eachChild(u=>{c.push(u.serialize())}),c}}class yp{constructor(c,u){this.type=u.type,this.bindings=[].concat(c),this.result=u}evaluate(c){return this.result.evaluate(c)}eachChild(c){for(const u of this.bindings)c(u[1]);c(this.result)}static parse(c,u){if(c.length<4)return u.error(`Expected at least 3 arguments, but found ${c.length-1} instead.`);const g=[];for(let k=1;k=g.length)throw new rl("Array index out of bounds: index exceeds array size");if(u!==Math.floor(u))throw new rl("Array index must be an integer. Use at-interpolated for fractional indices");return g[u]}eachChild(c){c(this.index),c(this.input)}outputDefined(){return!1}serialize(){return["at",this.index.serialize(),this.input.serialize()]}}class $k{constructor(c,u,g){this.type=c,this.index=u,this.input=g}static parse(c,u){if(c.length!==3)return u.error(`Expected 2 arguments, but found ${c.length-1} instead.`);const g=u.parse(c[1],1,mn),v=u.parse(c[2],2,yc(u.expectedType||ja));return g&&v?new $k(v.type.itemType,g,v):null}evaluate(c){const u=this.index.evaluate(c),g=this.input.evaluate(c);if(u<0)throw new rl(`Array index out of bounds: ${u} < 0.`);if(u>g.length-1)throw new rl(`Array index out of bounds: ${u} > ${g.length-1}.`);if(u===Math.floor(u))return g[u];const v=Math.floor(u),k=Math.ceil(u),S=g[v],P=g[k];if(typeof S!="number"||typeof P!="number")throw new rl(`Cannot interpolate between non-number values at index ${u}.`);const R=u-v;return S*(1-R)+P*R}eachChild(c){c(this.index),c(this.input)}outputDefined(){return!1}serialize(){return["at-interpolated",this.index.serialize(),this.input.serialize()]}}class Y3{constructor(c,u){this.type=Da,this.needle=c,this.haystack=u}static parse(c,u){if(c.length!==3)return u.error(`Expected 2 arguments, but found ${c.length-1} instead.`);const g=u.parse(c[1],1,ja),v=u.parse(c[2],2,ja);return g&&v?T3(g.type,[Da,Gs,mn,Ah,ja])?new Y3(g,v):u.error(`Expected first argument to be of type boolean, string, number or null, but found ${Ao(g.type)} instead`):null}evaluate(c){const u=this.needle.evaluate(c),g=this.haystack.evaluate(c);if(g==null)return!1;if(!vv(u,["boolean","string","number","null"]))throw new rl(`Expected first argument to be of type boolean, string, number or null, but found ${Ao(xl(u))} instead.`);if(!vv(g,["string","array"]))throw new rl(`Expected second argument to be of type array or string, but found ${Ao(xl(g))} instead.`);return g.indexOf(u)>=0}eachChild(c){c(this.needle),c(this.haystack)}outputDefined(){return!0}serialize(){return["in",this.needle.serialize(),this.haystack.serialize()]}}class Oy{constructor(c,u,g){this.type=mn,this.needle=c,this.haystack=u,this.fromIndex=g}static parse(c,u){if(c.length<=2||c.length>=5)return u.error(`Expected 3 or 4 arguments, but found ${c.length-1} instead.`);const g=u.parse(c[1],1,ja),v=u.parse(c[2],2,ja);if(!g||!v)return null;if(!T3(g.type,[Da,Gs,mn,Ah,ja]))return u.error(`Expected first argument to be of type boolean, string, number or null, but found ${Ao(g.type)} instead`);if(c.length===4){const k=u.parse(c[3],3,mn);return k?new Oy(g,v,k):null}return new Oy(g,v)}evaluate(c){const u=this.needle.evaluate(c),g=this.haystack.evaluate(c);if(!vv(u,["boolean","string","number","null"]))throw new rl(`Expected first argument to be of type boolean, string, number or null, but found ${Ao(xl(u))} instead.`);if(!vv(g,["string","array"]))throw new rl(`Expected second argument to be of type array or string, but found ${Ao(xl(g))} instead.`);if(this.fromIndex){const v=this.fromIndex.evaluate(c);return g.indexOf(u,v)}return g.indexOf(u)}eachChild(c){c(this.needle),c(this.haystack),this.fromIndex&&c(this.fromIndex)}outputDefined(){return!1}serialize(){if(this.fromIndex!=null&&this.fromIndex!==void 0){const c=this.fromIndex.serialize();return["index-of",this.needle.serialize(),this.haystack.serialize(),c]}return["index-of",this.needle.serialize(),this.haystack.serialize()]}}class Tv{constructor(c,u,g,v,k,S){this.inputType=c,this.type=u,this.input=g,this.cases=v,this.outputs=k,this.otherwise=S}static parse(c,u){if(c.length<5)return u.error(`Expected at least 4 arguments, but found only ${c.length-1}.`);if(c.length%2!=1)return u.error("Expected an even number of arguments.");let g,v;u.expectedType&&u.expectedType.kind!=="value"&&(v=u.expectedType);const k={},S=[];for(let $=2;$Number.MAX_SAFE_INTEGER)return X.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof se=="number"&&Math.floor(se)!==se)return X.error("Numeric branch labels must be integer values.");if(g){if(X.checkSubtype(g,xl(se)))return null}else g=xl(se);if(k[String(se)]!==void 0)return X.error("Branch labels must be unique.");k[String(se)]=S.length}const re=u.parse(K,$,v);if(!re)return null;v=v||re.type,S.push(re)}const P=u.parse(c[1],1,ja);if(!P)return null;const R=u.parse(c[c.length-1],c.length-1,v);return R?P.type.kind!=="value"&&u.concat(1).checkSubtype(g,P.type)?null:new Tv(g,v,P,k,S,R):null}evaluate(c){const u=this.input.evaluate(c);return(vk(xl(u),this.inputType)&&this.outputs[this.cases[u]]||this.otherwise).evaluate(c)}eachChild(c){c(this.input),this.outputs.forEach(c),c(this.otherwise)}outputDefined(){return this.outputs.every(c=>c.outputDefined())&&this.otherwise.outputDefined()}serialize(){const c=["match",this.input.serialize()],u=Object.keys(this.cases).sort(),g=[],v={};for(const S of u){const P=v[this.cases[S]];P===void 0?(v[this.cases[S]]=g.length,g.push([this.cases[S],[S]])):g[P][1].push(S)}const k=S=>this.inputType.kind==="number"?Number(S):S;for(const[S,P]of g)c.push(P.length===1?k(P[0]):P.map(k)),c.push(this.outputs[S].serialize());return c.push(this.otherwise.serialize()),c}}class Av{constructor(c,u,g){this.type=c,this.branches=u,this.otherwise=g}static parse(c,u){if(c.length<4)return u.error(`Expected at least 3 arguments, but found only ${c.length-1}.`);if(c.length%2!=0)return u.error("Expected an odd number of arguments.");let g;u.expectedType&&u.expectedType.kind!=="value"&&(g=u.expectedType);const v=[];for(let S=1;Su.outputDefined())&&this.otherwise.outputDefined()}serialize(){const c=["case"];return this.eachChild(u=>{c.push(u.serialize())}),c}}class Uk{constructor(c,u,g,v){this.type=c,this.input=u,this.beginIndex=g,this.endIndex=v}static parse(c,u){if(c.length<=2||c.length>=5)return u.error(`Expected 3 or 4 arguments, but found ${c.length-1} instead.`);const g=u.parse(c[1],1,ja),v=u.parse(c[2],2,mn);if(!g||!v)return null;if(!T3(g.type,[yc(ja),Gs,ja]))return u.error(`Expected first argument to be of type array or string, but found ${Ao(g.type)} instead`);if(c.length===4){const k=u.parse(c[3],3,mn);return k?new Uk(g.type,g,v,k):null}return new Uk(g.type,g,v)}evaluate(c){const u=this.input.evaluate(c),g=this.beginIndex.evaluate(c);if(!vv(u,["string","array"]))throw new rl(`Expected first argument to be of type array or string, but found ${Ao(xl(u))} instead.`);if(this.endIndex){const v=this.endIndex.evaluate(c);return u.slice(g,v)}return u.slice(g)}eachChild(c){c(this.input),c(this.beginIndex),this.endIndex&&c(this.endIndex)}outputDefined(){return!1}serialize(){if(this.endIndex!=null&&this.endIndex!==void 0){const c=this.endIndex.serialize();return["slice",this.input.serialize(),this.beginIndex.serialize(),c]}return["slice",this.input.serialize(),this.beginIndex.serialize()]}}class X3{constructor(c,u){this.type=yc(Gs),this.str=c,this.delimiter=u}static parse(c,u){if(c.length!==3)return u.error(`Expected 2 arguments, but found ${c.length-1} instead.`);const g=u.parse(c[1],1,Gs),v=u.parse(c[2],2,Gs);return g&&v?new X3(g,v):void 0}evaluate(c){const u=this.str.evaluate(c),g=this.delimiter.evaluate(c);return u.split(g)}eachChild(c){c(this.str),c(this.delimiter)}outputDefined(){return!1}serialize(){return["split",this.str.serialize(),this.delimiter.serialize()]}}function Q3(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 J3(f,c,u,g){return g.compare(c,u)===0}function Dy(f,c,u){const g=f!=="=="&&f!=="!=";return class Nze{constructor(k,S,P){this.type=Da,this.lhs=k,this.rhs=S,this.collator=P,this.hasUntypedArgument=k.type.kind==="value"||S.type.kind==="value"}static parse(k,S){if(k.length!==3&&k.length!==4)return S.error("Expected two or three arguments.");const P=k[0];let R=S.parse(k[1],1,ja);if(!R)return null;if(!Q3(P,R.type))return S.concat(1).error(`"${P}" comparisons are not supported for type '${Ao(R.type)}'.`);let $=S.parse(k[2],2,ja);if(!$)return null;if(!Q3(P,$.type))return S.concat(2).error(`"${P}" comparisons are not supported for type '${Ao($.type)}'.`);if(R.type.kind!==$.type.kind&&R.type.kind!=="value"&&$.type.kind!=="value")return S.error(`Cannot compare types '${Ao(R.type)}' and '${Ao($.type)}'.`);g&&(R.type.kind==="value"&&$.type.kind!=="value"?R=new Eh($.type,[R]):R.type.kind!=="value"&&$.type.kind==="value"&&($=new Eh(R.type,[$])));let W=null;if(k.length===4){if(R.type.kind!=="string"&&$.type.kind!=="string"&&R.type.kind!=="value"&&$.type.kind!=="value")return S.error("Cannot use collator to compare non-string types.");if(W=S.parse(k[3],3,yk),!W)return null}return new Nze(R,$,W)}evaluate(k){const S=this.lhs.evaluate(k),P=this.rhs.evaluate(k);if(g&&this.hasUntypedArgument){const R=xl(S),$=xl(P);if(R.kind!==$.kind||R.kind!=="string"&&R.kind!=="number")throw new rl(`Expected arguments for "${f}" to be (string, string) or (number, number), but found (${R.kind}, ${$.kind}) instead.`)}if(this.collator&&!g&&this.hasUntypedArgument){const R=xl(S),$=xl(P);if(R.kind!=="string"||$.kind!=="string")return c(k,S,P)}return this.collator?u(k,S,P,this.collator.evaluate(k)):c(k,S,P)}eachChild(k){k(this.lhs),k(this.rhs),this.collator&&k(this.collator)}outputDefined(){return!0}serialize(){const k=[f];return this.eachChild(S=>{k.push(S.serialize())}),k}}}const eie=Dy("==",function(f,c,u){return c===u},J3),tie=Dy("!=",function(f,c,u){return c!==u},function(f,c,u,g){return!J3(0,c,u,g)}),dP=Dy("<",function(f,c,u){return c",function(f,c,u){return c>u},function(f,c,u,g){return g.compare(c,u)>0}),qk=Dy("<=",function(f,c,u){return c<=u},function(f,c,u,g){return g.compare(c,u)<=0}),rie=Dy(">=",function(f,c,u){return c>=u},function(f,c,u,g){return g.compare(c,u)>=0});class Vk{constructor(c,u,g,v,k,S){this.type=Gs,this.number=c,this.locale=u,this.currency=g,this.unit=v,this.minFractionDigits=k,this.maxFractionDigits=S}static parse(c,u){if(c.length!==3)return u.error("Expected two arguments.");const g=u.parse(c[1],1,mn);if(!g)return null;const v=c[2];if(typeof v!="object"||Array.isArray(v))return u.error("NumberFormat options argument must be an object.");let k=null;if(v.locale&&(k=u.parseObjectValue(v.locale,2,"locale",Gs),!k))return null;let S=null;if(v.currency&&(S=u.parseObjectValue(v.currency,2,"currency",Gs),!S))return null;let P=null;if(v.unit&&(P=u.parseObjectValue(v.unit,2,"unit",Gs),!P))return null;let R=null;if(v["min-fraction-digits"]&&(R=u.parseObjectValue(v["min-fraction-digits"],2,"min-fraction-digits",mn),!R))return null;let $=null;return v["max-fraction-digits"]&&($=u.parseObjectValue(v["max-fraction-digits"],2,"max-fraction-digits",mn),!$)?null:new Vk(g,k,S,P,R,$)}evaluate(c){return new Intl.NumberFormat(this.locale?this.locale.evaluate(c):[],{style:(this.currency?"currency":this.unit&&"unit")||"decimal",currency:this.currency?this.currency.evaluate(c):void 0,unit:this.unit?this.unit.evaluate(c):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(c):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(c):void 0}).format(this.number.evaluate(c))}eachChild(c){c(this.number),this.locale&&c(this.locale),this.currency&&c(this.currency),this.unit&&c(this.unit),this.minFractionDigits&&c(this.minFractionDigits),this.maxFractionDigits&&c(this.maxFractionDigits)}outputDefined(){return!1}serialize(){const c={};return this.locale&&(c.locale=this.locale.serialize()),this.currency&&(c.currency=this.currency.serialize()),this.unit&&(c.unit=this.unit.serialize()),this.minFractionDigits&&(c["min-fraction-digits"]=this.minFractionDigits.serialize()),this.maxFractionDigits&&(c["max-fraction-digits"]=this.maxFractionDigits.serialize()),["number-format",this.number.serialize(),c]}}class e5{constructor(c){this.type=mn,this.input=c}static parse(c,u){if(c.length!==2)return u.error(`Expected 1 argument, but found ${c.length-1} instead.`);const g=u.parse(c[1],1);return g?g.type.kind!=="array"&&g.type.kind!=="string"&&g.type.kind!=="value"?u.error(`Expected argument of type string or array, but found ${Ao(g.type)} instead.`):new e5(g):null}evaluate(c){const u=this.input.evaluate(c);if(typeof u=="string"||Array.isArray(u))return u.length;throw new rl(`Expected value to be of type string or array, but found ${Ao(xl(u))} instead.`)}eachChild(c){c(this.input)}outputDefined(){return!1}serialize(){const c=["length"];return this.eachChild(u=>{c.push(u.serialize())}),c}}function hP(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 Ry={"==":eie,"!=":tie,">":uP,"<":dP,">=":rie,"<=":qk,array:Eh,at:Bk,"at-interpolated":$k,boolean:Eh,case:Av,coalesce:Mv,collator:Cl,format:yf,image:as,in:Y3,"index-of":Oy,interpolate:yu,"interpolate-hcl":yu,"interpolate-lab":yu,length:e5,let:yp,literal:gp,match:Tv,number:Eh,"number-format":Vk,object:Eh,slice:Uk,step:Sv,string:Eh,"to-boolean":vf,"to-color":vf,"to-number":vf,"to-string":vf,var:Lk,within:Lm,distance:Zg,config:Iy,split:X3};function t5(f,[c,u,g,v]){c=c.evaluate(f),u=u.evaluate(f),g=g.evaluate(f);const k=v?v.evaluate(f):1,S=Wg(c,u,g,k);if(S)throw new rl(S);return new Sa(c/255,u/255,g/255,k)}function r5(f,[c,u,g,v]){c=c.evaluate(f),u=u.evaluate(f),g=g.evaluate(f);const k=v?v.evaluate(f):1,S=function($,W,K,X){return typeof $=="number"&&$>=0&&$<=360?typeof W=="number"&&W>=0&&W<=100&&typeof K=="number"&&K>=0&&K<=100?X===void 0||typeof X=="number"&&X>=0&&X<=1?null:`Invalid hsla value [${[$,W,K,X].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid hsla value [${(typeof X=="number"?[$,W,K,X]:[$,W,K]).join(", ")}]: 's', and 'l' must be between 0 and 100.`:`Invalid hsla value [${(typeof X=="number"?[$,W,K,X]:[$,W,K]).join(", ")}]: 'h' must be between 0 and 360.`}(c,u,g,k);if(S)throw new rl(S);const P=`hsla(${c}, ${u}%, ${g}%, ${k})`,R=Sa.parse(P);if(!R)throw new rl(`Failed to parse HSLA color: ${P}`);return R}function fP(f,c){return f in c}function n5(f,c){const u=c[f];return u===void 0?null:u}function Rm(f){return{type:f}}function Yg(f){if(f instanceof Iy)return new Set([f.key]);let c=new Set;return f.eachChild(u=>{c=new Set([...c,...Yg(u)])}),c}function Hk(f){if(f instanceof ed&&f.name==="is-active-floor")return!0;let c=!1;return f.eachChild(u=>{!c&&Hk(u)&&(c=!0)}),c}function pP(f){return{result:"success",value:f}}function Fm(f){return{result:"error",value:f}}function s5(f,c){return!!f&&!!f.parameters&&f.parameters.indexOf(c)>-1}function Ev(f){return f["property-type"]==="data-driven"}function mP(f){return s5(f.expression,"measure-light")}function gP(f){return s5(f.expression,"zoom")}function Wk(f){return!!f.expression&&f.expression.interpolated}function Gk(f){return typeof f=="object"&&f!==null&&!Array.isArray(f)}function xP(f){return f}function yP(f,c){const u=c.type==="color",g=f.stops&&typeof f.stops[0][0]=="object",v=g||!(g||f.property!==void 0),k=f.type||(Wk(c)?"exponential":"interval");if(u&&((f=Object.assign({},f)).stops&&(f.stops=f.stops.map($=>[$[0],Sa.parse($[1])])),f.default=Sa.parse(f.default?f.default:c.default)),f.colorSpace&&f.colorSpace!=="rgb"&&!cP[f.colorSpace])throw new Error(`Unknown color space: ${f.colorSpace}`);let S,P,R;if(k==="exponential")S=vP;else if(k==="interval")S=sie;else if(k==="categorical"){S=nie,P=Object.create(null);for(const $ of f.stops)P[$[0]]=$[1];R=typeof f.stops[0][0]}else{if(k!=="identity")throw new Error(`Unknown function type "${k}"`);S=_P}if(g){const $={},W=[];for(let re=0;rere[0]),evaluate:({zoom:re},se)=>vP({stops:K,base:f.base},c,re).evaluate(re,se)}}if(v){const $=k==="exponential"?{name:"exponential",base:f.base!==void 0?f.base:1}:null;return{kind:"camera",interpolationType:$,interpolationFactor:yu.interpolationFactor.bind(void 0,$),zoomStops:f.stops.map(W=>W[0]),evaluate:({zoom:W})=>S(f,c,W,P,R)}}return{kind:"source",evaluate($,W){const K=W&&W.properties?W.properties[f.property]:void 0;return K===void 0?bf(f.default,c.default):S(f,c,K,P,R)}}}function bf(f,c,u){return f!==void 0?f:c!==void 0?c:u!==void 0?u:void 0}function nie(f,c,u,g,v){return bf(typeof u===v?g[u]:void 0,f.default,c.default)}function sie(f,c,u){if(!Sy(u))return bf(f.default,c.default);const g=f.stops.length;if(g===1||u<=f.stops[0][0])return f.stops[0][1];if(u>=f.stops[g-1][0])return f.stops[g-1][1];const v=Dk(f.stops.map(k=>k[0]),u);return f.stops[v][1]}function vP(f,c,u){const g=f.base!==void 0?f.base:1;if(!Sy(u))return bf(f.default,c.default);const v=f.stops.length;if(v===1||u<=f.stops[0][0])return f.stops[0][1];if(u>=f.stops[v-1][0])return f.stops[v-1][1];const k=Dk(f.stops.map(W=>W[0]),u),S=function(W,K,X,re){const se=re-X,fe=W-X;return se===0?0:K===1?fe/se:(Math.pow(K,fe)-1)/(Math.pow(K,se)-1)}(u,g,f.stops[k][0],f.stops[k+1][0]),P=f.stops[k][1],R=f.stops[k+1][1];let $=gv[c.type]||xP;if(f.colorSpace&&f.colorSpace!=="rgb"){const W=cP[f.colorSpace];$=(K,X)=>W.reverse(W.interpolate(W.forward(K),W.forward(X),S))}return typeof P.evaluate=="function"?{evaluate(...W){const K=P.evaluate.apply(void 0,W),X=R.evaluate.apply(void 0,W);if(K!==void 0&&X!==void 0)return $(K,X,S)}}:$(P,R,S)}function _P(f,c,u){return c.type==="color"?u=Sa.parse(u):c.type==="formatted"?u=Qc.fromString(u.toString()):c.type==="resolvedImage"?u=Jc.build(u.toString()):dn(u)===c.type||c.type==="enum"&&c.values[u]||(u=void 0),bf(u,f.default,c.default)}ed.register(Ry,{error:[{kind:"error"},[Gs],(f,[c])=>{throw new rl(c.evaluate(f))}],typeof:[Gs,[ja],(f,[c])=>Ao(xl(c.evaluate(f)))],"to-rgba":[yc(mn,4),[wd],(f,[c])=>c.evaluate(f).toNonPremultipliedRenderColor(null).toArray()],"to-hsla":[yc(mn,4),[wd],(f,[c])=>c.evaluate(f).toNonPremultipliedRenderColor(null).toHslaArray()],rgb:[wd,[mn,mn,mn],t5],rgba:[wd,[mn,mn,mn,mn],t5],hsl:[wd,[mn,mn,mn],r5],hsla:[wd,[mn,mn,mn,mn],r5],has:{type:Da,overloads:[[[Gs],(f,[c])=>fP(c.evaluate(f),f.properties())],[[Gs,xf],(f,[c,u])=>fP(c.evaluate(f),u.evaluate(f))]]},get:{type:ja,overloads:[[[Gs],(f,[c])=>n5(c.evaluate(f),f.properties())],[[Gs,xf],(f,[c,u])=>n5(c.evaluate(f),u.evaluate(f))]]},"feature-state":[ja,[Gs],(f,[c])=>n5(c.evaluate(f),f.featureState||{})],properties:[xf,[],f=>f.properties()],"geometry-type":[Gs,[],f=>f.geometryType()],worldview:[Gs,[],f=>f.globals.worldview||""],"is-active-floor":[Da,Rm(Gs),(f,c)=>{if(!(f.globals.activeFloors&&f.globals.activeFloors.size>0))return!1;const u=f.globals.activeFloors;return c.some(g=>{const v=g.evaluate(f);return u.has(v)})}],id:[ja,[],f=>f.id()],zoom:[mn,[],f=>f.globals.zoom],pitch:[mn,[],f=>f.globals.pitch||0],"distance-from-center":[mn,[],f=>f.distanceFromCenter()],"measure-light":[mn,[Gs],(f,[c])=>f.measureLight(c.evaluate(f))],"heatmap-density":[mn,[],f=>f.globals.heatmapDensity||0],"line-progress":[mn,[],f=>f.globals.lineProgress||0],"raster-value":[mn,[],f=>f.globals.rasterValue||0],"raster-particle-speed":[mn,[],f=>f.globals.rasterParticleSpeed||0],"sky-radial-progress":[mn,[],f=>f.globals.skyRadialProgress||0],accumulated:[ja,[],f=>f.globals.accumulated===void 0?null:f.globals.accumulated],"+":[mn,Rm(mn),(f,c)=>{let u=0;for(const g of c)u+=g.evaluate(f);return u}],"*":[mn,Rm(mn),(f,c)=>{let u=1;for(const g of c)u*=g.evaluate(f);return u}],"-":{type:mn,overloads:[[[mn,mn],(f,[c,u])=>c.evaluate(f)-u.evaluate(f)],[[mn],(f,[c])=>-c.evaluate(f)]]},"/":[mn,[mn,mn],(f,[c,u])=>c.evaluate(f)/u.evaluate(f)],"%":[mn,[mn,mn],(f,[c,u])=>c.evaluate(f)%u.evaluate(f)],ln2:[mn,[],()=>Math.LN2],pi:[mn,[],()=>Math.PI],e:[mn,[],()=>Math.E],"^":[mn,[mn,mn],(f,[c,u])=>Math.pow(c.evaluate(f),u.evaluate(f))],sqrt:[mn,[mn],(f,[c])=>Math.sqrt(c.evaluate(f))],log10:[mn,[mn],(f,[c])=>Math.log(c.evaluate(f))/Math.LN10],ln:[mn,[mn],(f,[c])=>Math.log(c.evaluate(f))],log2:[mn,[mn],(f,[c])=>Math.log2(c.evaluate(f))],sin:[mn,[mn],(f,[c])=>Math.sin(c.evaluate(f))],cos:[mn,[mn],(f,[c])=>Math.cos(c.evaluate(f))],tan:[mn,[mn],(f,[c])=>Math.tan(c.evaluate(f))],asin:[mn,[mn],(f,[c])=>Math.asin(c.evaluate(f))],acos:[mn,[mn],(f,[c])=>Math.acos(c.evaluate(f))],atan:[mn,[mn],(f,[c])=>Math.atan(c.evaluate(f))],min:[mn,Rm(mn),(f,c)=>Math.min(...c.map(u=>u.evaluate(f)))],max:[mn,Rm(mn),(f,c)=>Math.max(...c.map(u=>u.evaluate(f)))],abs:[mn,[mn],(f,[c])=>Math.abs(c.evaluate(f))],round:[mn,[mn],(f,[c])=>{const u=c.evaluate(f);return u<0?-Math.round(-u):Math.round(u)}],floor:[mn,[mn],(f,[c])=>Math.floor(c.evaluate(f))],ceil:[mn,[mn],(f,[c])=>Math.ceil(c.evaluate(f))],"filter-==":[Da,[Gs,ja],(f,[c,u])=>f.properties()[c.value]===u.value],"filter-id-==":[Da,[ja],(f,[c])=>f.id()===c.value],"filter-type-==":[Da,[Gs],(f,[c])=>f.geometryType()===c.value],"filter-<":[Da,[Gs,ja],(f,[c,u])=>{const g=f.properties()[c.value],v=u.value;return typeof g==typeof v&&g{const u=f.id(),g=c.value;return typeof u==typeof g&&u":[Da,[Gs,ja],(f,[c,u])=>{const g=f.properties()[c.value],v=u.value;return typeof g==typeof v&&g>v}],"filter-id->":[Da,[ja],(f,[c])=>{const u=f.id(),g=c.value;return typeof u==typeof g&&u>g}],"filter-<=":[Da,[Gs,ja],(f,[c,u])=>{const g=f.properties()[c.value],v=u.value;return typeof g==typeof v&&g<=v}],"filter-id-<=":[Da,[ja],(f,[c])=>{const u=f.id(),g=c.value;return typeof u==typeof g&&u<=g}],"filter->=":[Da,[Gs,ja],(f,[c,u])=>{const g=f.properties()[c.value],v=u.value;return typeof g==typeof v&&g>=v}],"filter-id->=":[Da,[ja],(f,[c])=>{const u=f.id(),g=c.value;return typeof u==typeof g&&u>=g}],"filter-has":[Da,[ja],(f,[c])=>c.value in f.properties()],"filter-has-id":[Da,[],f=>f.id()!==null&&f.id()!==void 0],"filter-type-in":[Da,[yc(Gs)],(f,[c])=>c.value.indexOf(f.geometryType())>=0],"filter-id-in":[Da,[yc(ja)],(f,[c])=>c.value.indexOf(f.id())>=0],"filter-in-small":[Da,[Gs,yc(ja)],(f,[c,u])=>u.value.indexOf(f.properties()[c.value])>=0],"filter-in-large":[Da,[Gs,yc(ja)],(f,[c,u])=>function(g,v,k,S){for(;k<=S;){const P=k+S>>1;if(v[P]===g)return!0;v[P]>g?S=P-1:k=P+1}return!1}(f.properties()[c.value],u.value,0,u.value.length-1)],all:{type:Da,overloads:[[[Da,Da],(f,[c,u])=>c.evaluate(f)&&u.evaluate(f)],[Rm(Da),(f,c)=>{for(const u of c)if(!u.evaluate(f))return!1;return!0}]]},any:{type:Da,overloads:[[[Da,Da],(f,[c,u])=>c.evaluate(f)||u.evaluate(f)],[Rm(Da),(f,c)=>{for(const u of c)if(u.evaluate(f))return!0;return!1}]]},"!":[Da,[Da],(f,[c])=>!c.evaluate(f)],"is-supported-script":[Da,[Gs],(f,[c])=>{const u=f.globals&&f.globals.isSupportedScript;return!u||u(c.evaluate(f))}],upcase:[Gs,[Gs],(f,[c])=>c.evaluate(f).toUpperCase()],downcase:[Gs,[Gs],(f,[c])=>c.evaluate(f).toLowerCase()],concat:[Gs,Rm(ja),(f,c)=>c.map(u=>Xu(u.evaluate(f))).join("")],"resolved-locale":[Gs,[yk],(f,[c])=>c.evaluate(f).resolvedLocale()],random:[mn,[mn,mn,ja],(f,c)=>{const[u,g,v]=c.map(S=>S.evaluate(f));if(u>g||u===g)return u;let k;if(typeof v=="string")k=function(S){let P=0;if(S.length===0)return P;for(let R=0;RJSON.stringify(K)).join(", ")}, but found ${JSON.stringify(W)} instead.`);return W}catch(W){const K=W;return this._warningHistory[K.message]||(this._warningHistory[K.message]=!0,typeof console<"u"&&console.warn(`Failed to evaluate expression "${JSON.stringify(this.expression.serialize())}". ${K.message}`)),this._defaultValue}}}function Iv(f){return Array.isArray(f)&&f.length>0&&typeof f[0]=="string"&&f[0]in Ry}function zm(f,c,u,g,v){const k=new Ok(Ry,[],c?function(P){const R={color:wd,string:Gs,number:mn,enum:Gs,boolean:Da,formatted:xv,resolvedImage:yv};return P.type==="array"?yc(R[P.value]||ja,P.length):R[P.type]}(c):void 0,void 0,void 0,u,g,v),S=k.parse(f,void 0,void 0,void 0,c&&c.type==="string"?{typeAnnotation:"coerce"}:void 0);return S?pP(new Kk(S,c,u,g,v)):Fm(k.errors)}class Fy{constructor(c,u,g,v){this.kind=c,this._styleExpression=u,this.isLightConstant=g,this.isLineProgressConstant=v,this.isStateDependent=c!=="constant"&&!Nv(u.expression),this.configDependencies=Yg(u.expression),this.isIndoorDependent=Hk(u.expression)}evaluateWithoutErrorHandling(c,u,g,v,k,S){return this._styleExpression.evaluateWithoutErrorHandling(c,u,g,v,k,S)}evaluate(c,u,g,v,k,S,P){return this._styleExpression.evaluate(c,u,g,v,k,S,void 0,void 0,P)}}class Xg{constructor(c,u,g,v,k,S){this.kind=c,this.zoomStops=g,this._styleExpression=u,this.isStateDependent=c!=="camera"&&!Nv(u.expression),this.isIndoorDependent=Hk(u.expression),this.isLightConstant=k,this.isLineProgressConstant=S,this.configDependencies=Yg(u.expression),this.interpolationType=v}evaluateWithoutErrorHandling(c,u,g,v,k,S){return this._styleExpression.evaluateWithoutErrorHandling(c,u,g,v,k,S)}evaluate(c,u,g,v,k,S){return this._styleExpression.evaluate(c,u,g,v,k,S)}interpolationFactor(c,u,g){return this.interpolationType?yu.interpolationFactor(this.interpolationType,c,u,g):0}}function a5(f,c,u,g,v){if((f=zm(f,c,u,g,v)).result==="error")return f;const k=f.value.expression,S=Ay(k);if(!S&&!Ev(c))return Fm([new Yu("","data expressions not supported")]);const P=Ey(k,["zoom","pitch","distance-from-center"]);if(!P&&!gP(c))return Fm([new Yu("","zoom expressions not supported")]);const R=Ey(k,["measure-light"]);if(!R&&!mP(c))return Fm([new Yu("","measure-light expression not supported")]);const $=Ey(k,["line-progress"]);if(!$&&!function(X){return s5(X.expression,"line-progress")}(c))return Fm([new Yu("","line-progress expression not supported")]);const W=c.expression&&c.expression.relaxZoomRestriction,K=Ph(k);return K||P||W?K instanceof Yu?Fm([K]):K instanceof yu&&!Wk(c)?Fm([new Yu("",'"interpolate" expressions cannot be used with this property')]):pP(K?new Xg(S&&$?"camera":"composite",f.value,K.labels,K instanceof yu?K.interpolation:void 0,R,$):new Fy(S&&$?"constant":"source",f.value,R,$)):Fm([new Yu("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression, or in the properties of atmosphere.')])}class Zk{constructor(c,u){this._parameters=c,this._specification=u,Object.assign(this,yP(this._parameters,this._specification))}static deserialize(c){return new Zk(c._parameters,c._specification)}static serialize(c){return{_parameters:c._parameters,_specification:c._specification}}}function Ph(f){let c=null;if(f instanceof yp)c=Ph(f.result);else if(f instanceof Mv){for(const u of f.args)if(c=Ph(u),c)break}else(f instanceof Sv||f instanceof yu)&&f.input instanceof ed&&f.input.name==="zoom"&&(c=f);return c instanceof Yu||f.eachChild(u=>{const g=Ph(u);g instanceof Yu?c=g:c&&g&&c!==g&&(c=new Yu("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),c}var i5,bP,wP=function(){if(bP)return i5;bP=1,i5=c;var f=3;function c(u,g,v){var k=this.cells=[];if(u instanceof ArrayBuffer){this.arrayBuffer=u;var S=new Int32Array(this.arrayBuffer);u=S[0],this.d=(g=S[1])+2*(v=S[2]);for(var P=0;P=X[fe+0]&&k>=X[fe+1])?(R[se]=!0,P.push(K[se])):R[se]=!1}}},c.prototype._forEachCell=function(u,g,v,k,S,P,R,$){for(var W=this._convertToCellCoord(u),K=this._convertToCellCoord(g),X=this._convertToCellCoord(v),re=this._convertToCellCoord(k),se=W;se<=X;se++)for(var fe=K;fe<=re;fe++){var Se=this.d*fe+se;if((!$||$(this._convertFromCellCoord(se),this._convertFromCellCoord(fe),this._convertFromCellCoord(se+1),this._convertFromCellCoord(fe+1)))&&S.call(this,u,g,v,k,Se,P,R,$))return}},c.prototype._convertFromCellCoord=function(u){return(u-this.padding)/this.scale},c.prototype._convertToCellCoord=function(u){return Math.max(0,Math.min(this.d-1,Math.floor(u*this.scale)+this.padding))},c.prototype.toArrayBuffer=function(){if(this.arrayBuffer)return this.arrayBuffer;for(var u=this.cells,g=f+this.cells.length+1+1,v=0,k=0;k=0||(v[k]=vp(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 Bm(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||Pv(f)||f instanceof ImageBitmap||ArrayBuffer.isView(f)||f instanceof ImageData)return f;if(Array.isArray(f))return f.map(Bm);if(typeof f=="object"){const c=f.$name||"Object";if(c==="Map"){const v=f.entries||[],k=new Map;for(let S=0;Sf>=128&&f<=255,Arabic:f=>f>=1536&&f<=1791,"Arabic Supplement":f=>f>=1872&&f<=1919,"Arabic Extended-A":f=>f>=2208&&f<=2303,"Hangul Jamo":f=>f>=4352&&f<=4607,"Unified Canadian Aboriginal Syllabics":f=>f>=5120&&f<=5759,Khmer:f=>f>=6016&&f<=6143,"Unified Canadian Aboriginal Syllabics Extended":f=>f>=6320&&f<=6399,"General Punctuation":f=>f>=8192&&f<=8303,"Letterlike Symbols":f=>f>=8448&&f<=8527,"Number Forms":f=>f>=8528&&f<=8591,"Miscellaneous Technical":f=>f>=8960&&f<=9215,"Control Pictures":f=>f>=9216&&f<=9279,"Optical Character Recognition":f=>f>=9280&&f<=9311,"Enclosed Alphanumerics":f=>f>=9312&&f<=9471,"Geometric Shapes":f=>f>=9632&&f<=9727,"Miscellaneous Symbols":f=>f>=9728&&f<=9983,"Miscellaneous Symbols and Arrows":f=>f>=11008&&f<=11263,"CJK Radicals Supplement":f=>f>=11904&&f<=12031,"Kangxi Radicals":f=>f>=12032&&f<=12255,"Ideographic Description Characters":f=>f>=12272&&f<=12287,"CJK Symbols and Punctuation":f=>f>=12288&&f<=12351,Hiragana:f=>f>=12352&&f<=12447,Katakana:f=>f>=12448&&f<=12543,Bopomofo:f=>f>=12544&&f<=12591,"Hangul Compatibility Jamo":f=>f>=12592&&f<=12687,Kanbun:f=>f>=12688&&f<=12703,"Bopomofo Extended":f=>f>=12704&&f<=12735,"CJK Strokes":f=>f>=12736&&f<=12783,"Katakana Phonetic Extensions":f=>f>=12784&&f<=12799,"Enclosed CJK Letters and Months":f=>f>=12800&&f<=13055,"CJK Compatibility":f=>f>=13056&&f<=13311,"CJK Unified Ideographs Extension A":f=>f>=13312&&f<=19903,"Yijing Hexagram Symbols":f=>f>=19904&&f<=19967,"CJK Unified Ideographs":f=>f>=19968&&f<=40959,"Yi Syllables":f=>f>=40960&&f<=42127,"Yi Radicals":f=>f>=42128&&f<=42191,"Hangul Jamo Extended-A":f=>f>=43360&&f<=43391,"Hangul Syllables":f=>f>=44032&&f<=55215,"Hangul Jamo Extended-B":f=>f>=55216&&f<=55295,"Private Use Area":f=>f>=57344&&f<=63743,"CJK Compatibility Ideographs":f=>f>=63744&&f<=64255,"Arabic Presentation Forms-A":f=>f>=64336&&f<=65023,"Vertical Forms":f=>f>=65040&&f<=65055,"CJK Compatibility Forms":f=>f>=65072&&f<=65103,"Small Form Variants":f=>f>=65104&&f<=65135,"Arabic Presentation Forms-B":f=>f>=65136&&f<=65279,"Halfwidth and Fullwidth Forms":f=>f>=65280&&f<=65519,Osage:f=>f>=66736&&f<=66815,"CJK Unified Ideographs Extension B":f=>f>=131072&&f<=173791};function Lv(f){for(const c of f)if(Yk(c.charCodeAt(0)))return!0;return!1}function o5(f){for(const c of f)if(!jP(c.charCodeAt(0)))return!1;return!0}function jP(f){return!(Tn.Arabic(f)||Tn["Arabic Supplement"](f)||Tn["Arabic Extended-A"](f)||Tn["Arabic Presentation Forms-A"](f)||Tn["Arabic Presentation Forms-B"](f))}function Yk(f){return!(f!==746&&f!==747&&(f<4352||!(Tn["Bopomofo Extended"](f)||Tn.Bopomofo(f)||Tn["CJK Compatibility Forms"](f)&&!(f>=65097&&f<=65103)||Tn["CJK Compatibility Ideographs"](f)||Tn["CJK Compatibility"](f)||Tn["CJK Radicals Supplement"](f)||Tn["CJK Strokes"](f)||!(!Tn["CJK Symbols and Punctuation"](f)||f>=12296&&f<=12305||f>=12308&&f<=12319||f===12336)||Tn["CJK Unified Ideographs Extension A"](f)||Tn["CJK Unified Ideographs"](f)||Tn["Enclosed CJK Letters and Months"](f)||Tn["Hangul Compatibility Jamo"](f)||Tn["Hangul Jamo Extended-A"](f)||Tn["Hangul Jamo Extended-B"](f)||Tn["Hangul Jamo"](f)||Tn["Hangul Syllables"](f)||Tn.Hiragana(f)||Tn["Ideographic Description Characters"](f)||Tn.Kanbun(f)||Tn["Kangxi Radicals"](f)||Tn["Katakana Phonetic Extensions"](f)||Tn.Katakana(f)&&f!==12540||!(!Tn["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)||!(!Tn["Small Form Variants"](f)||f>=65112&&f<=65118||f>=65123&&f<=65126)||Tn["Unified Canadian Aboriginal Syllabics"](f)||Tn["Unified Canadian Aboriginal Syllabics Extended"](f)||Tn["Vertical Forms"](f)||Tn["Yijing Hexagram Symbols"](f)||Tn["Yi Syllables"](f)||Tn["Yi Radicals"](f))))}function Xk(f){return!(Yk(f)||function(c){return!!(Tn["Latin-1 Supplement"](c)&&(c===167||c===169||c===174||c===177||c===188||c===189||c===190||c===215||c===247)||Tn["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)||Tn["Letterlike Symbols"](c)||Tn["Number Forms"](c)||Tn["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)||Tn["Control Pictures"](c)&&c!==9251||Tn["Optical Character Recognition"](c)||Tn["Enclosed Alphanumerics"](c)||Tn["Geometric Shapes"](c)||Tn["Miscellaneous Symbols"](c)&&!(c>=9754&&c<=9759)||Tn["Miscellaneous Symbols and Arrows"](c)&&(c>=11026&&c<=11055||c>=11088&&c<=11097||c>=11192&&c<=11243)||Tn["CJK Symbols and Punctuation"](c)||Tn.Katakana(c)||Tn["Private Use Area"](c)||Tn["CJK Compatibility Forms"](c)||Tn["Small Form Variants"](c)||Tn["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 Qk(f){return Tn.Arabic(f)||Tn["Arabic Supplement"](f)||Tn["Arabic Extended-A"](f)||Tn["Arabic Presentation Forms-A"](f)||Tn["Arabic Presentation Forms-B"](f)}function l5(f){return f>=1424&&f<=2303||Tn["Arabic Presentation Forms-A"](f)||Tn["Arabic Presentation Forms-B"](f)}function _p(f,c){return!(!c&&l5(f)||f>=2304&&f<=3583||f>=3840&&f<=4255||Tn.Khmer(f))}function aie(f){for(const c of f)if(l5(c.charCodeAt(0)))return!0;return!1}const Hd={unavailable:"unavailable",deferred:"deferred",loading:"loading",parsing:"parsing",parsed:"parsed",loaded:"loaded",error:"error"};let c5=null,td=Hd.unavailable,bp=null;const Ov=function(f){f&&typeof f=="string"&&f.indexOf("NetworkError")>-1&&(td=Hd.error),c5&&c5(f)};function Jk(){eN.fire(new Hn("pluginStateChange",{pluginStatus:td,pluginURL:bp}))}const eN=new pi,Dv=function(){return td},kP=function(){if(td!==Hd.deferred||!bp)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");td=Hd.loading,Jk(),bp&&Mh({url:bp},f=>{f?Ov(f):(td=Hd.loaded,Jk())})},wp={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>td===Hd.loaded||wp.applyArabicShaping!=null,isLoading:()=>td===Hd.loading,setState(f){td=f.pluginStatus,bp=f.pluginURL},isParsing:()=>td===Hd.parsing,isParsed:()=>td===Hd.parsed,getPluginURL:()=>bp};class ti{constructor(c,u){this.zoom=c,u?(this.now=u.now,this.fadeDuration=u.fadeDuration,this.transition=u.transition,this.pitch=u.pitch,this.brightness=u.brightness,this.worldview=u.worldview,this.activeFloors=u.activeFloors):(this.now=0,this.fadeDuration=0,this.transition={},this.pitch=0,this.brightness=0)}isSupportedScript(c){return function(u,g){for(const v of u)if(!_p(v.charCodeAt(0),g))return!1;return!0}(c,wp.isLoaded())}}class tN{constructor(c,u,g,v,k){this.property=c,this.value=u,this.expression=function(S,P,R,$,W){if(Gk(S))return new Zk(S,P);if(Iv(S)||Array.isArray(S)&&S.length>0){const K=a5(S,P,R,$,W);if(K.result==="error")throw new Error(K.value.map(X=>`${X.key}: ${X.message}`).join(", "));return K.value}{let K=S;return typeof S=="string"&&P.type==="color"&&(K=Sa.parse(S)),{kind:"constant",configDependencies:new Set,isIndoorDependent:!1,evaluate:()=>K}}}(u===void 0?c.specification.default:u,c.specification,g,v,k)}isIndoorDependent(){return this.expression.isIndoorDependent}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(c,u,g,v){return this.property.possiblyEvaluate(this,c,u,g,v)}}class d5{constructor(c,u,g,v){this.property=c,this.value=new tN(c,void 0,u,g,v)}transitioned(c,u){return new SP(this.property,this.value,u,Object.assign({},c.transition,this.transition),c.now)}untransitioned(){return new SP(this.property,this.value,null,{},0)}}class NP{constructor(c,u,g,v){this._properties=c,this._values=Object.create(c.defaultTransitionablePropertyValues),this._scope=u,this._options=g,this._iconImageUseTheme=v,this._isIndoorDependent=!1,this.configDependencies=new Set}getValue(c){return ar(this._values[c].value.value)}setValue(c,u){this._values.hasOwnProperty(c)||(this._values[c]=new d5(this._values[c].property,this._scope,this._options,this._iconImageUseTheme)),this._values[c].value=new tN(this._values[c].property,u===null?void 0:ar(u),this._scope,this._options,this._iconImageUseTheme),this._values[c].value.expression.configDependencies&&(this.configDependencies=new Set([...this.configDependencies,...this._values[c].value.expression.configDependencies]),this._isIndoorDependent=this._isIndoorDependent||this._values[c].value.isIndoorDependent())}setTransitionOrValue(c,u){u&&(this._options=u);const g=this._properties.properties;if(c)for(const v in c){const k=c[v];if(v.endsWith("-transition")){const S=v.slice(0,-11);g[S]&&this.setTransition(S,k)}else g.hasOwnProperty(v)&&this.setValue(v,k)}}getTransition(c){return ar(this._values[c].transition)}setTransition(c,u){this._values.hasOwnProperty(c)||(this._values[c]=new d5(this._values[c].property)),this._values[c].transition=ar(u)||void 0}serialize(){const c={};for(const u of Object.keys(this._values)){const g=this.getValue(u);g!==void 0&&(c[u]=g);const v=this.getTransition(u);v!==void 0&&(c[`${u}-transition`]=v)}return c}transitioned(c,u){const g=new CP(this._properties);for(const v of Object.keys(this._values))g._values[v]=this._values[v].transitioned(c,u._values[v]);return g}untransitioned(){const c=new CP(this._properties);for(const u of Object.keys(this._values))c._values[u]=this._values[u].untransitioned();return c}isIndoorDependent(){return this._isIndoorDependent}}class SP{constructor(c,u,g,v,k){const S=v.delay||0,P=v.duration||0;k=k||0,this.property=c,this.value=u,this.begin=k+S,this.end=this.begin+P,c.specification.transition&&(v.delay||v.duration)&&(this.prior=g)}possiblyEvaluate(c,u,g){const v=c.now||0,k=this.value.possiblyEvaluate(c,u,g),S=this.prior;if(S){if(v>this.end)return this.prior=null,k;if(this.value.isDataDriven())return this.prior=null,k;if(v":1,">=":1,"<":1,"<=":1,"in":1,"!in":1,"all":1,"any":1,"none":1,"has":1,"!has":1}},"geometry_type":{"type":"enum","values":{"Point":1,"LineString":1,"Polygon":1}},"function":{"expression":{"type":"expression"},"stops":{"type":"array","value":"function_stop"},"base":{"type":"number","default":1,"minimum":0},"property":{"type":"string","default":"$zoom"},"type":{"type":"enum","values":{"identity":1,"exponential":1,"interval":1,"categorical":1},"default":"exponential"},"colorSpace":{"type":"enum","values":{"rgb":1,"lab":1,"hcl":1},"default":"rgb"},"default":{"type":"*"}},"function_stop":{"type":"array","minimum":0,"maximum":24,"value":["number","color"],"length":2},"expression":{"type":"array","value":"*","minimum":1},"fog":{"range":{"type":"array","default":[0.5,10],"minimum":-20,"maximum":20,"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"high-color":{"type":"color","default":"#245cdf","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"space-color":{"type":"color","default":["interpolate",["linear"],["zoom"],4,"#010b19",7,"#367ab9"],"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"horizon-blend":{"type":"number","default":["interpolate",["linear"],["zoom"],4,0.2,7,0.1],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"star-intensity":{"type":"number","default":["interpolate",["linear"],["zoom"],5,0.35,6,0],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vertical-range":{"type":"array","default":[0,0],"minimum":0,"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}}},"snow":{"density":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,0.85],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vignette":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,0.3],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vignette-color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"center-thinning":{"type":"number","default":0.4,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"direction":{"type":"array","default":[0,50],"minimum":0,"maximum":360,"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"flake-size":{"type":"number","default":0.71,"minimum":0,"maximum":5,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true}},"rain":{"density":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,0.5],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"color":{"type":"color","default":["interpolate",["linear"],["measure-light","brightness"],0,"#03113d",0.3,"#a8adbc"],"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"opacity":{"type":"number","default":["interpolate",["linear"],["measure-light","brightness"],0,0.88,1,0.7],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vignette":{"type":"number","default":["interpolate",["linear"],["zoom"],11,0,13,1],"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"vignette-color":{"type":"color","default":["interpolate",["linear"],["measure-light","brightness"],0,"#001736",0.3,"#464646"],"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"use-theme":true,"transition":true},"center-thinning":{"type":"number","default":0.57,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true},"direction":{"type":"array","default":[0,80],"minimum":0,"maximum":360,"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"droplet-size":{"type":"array","default":[2.6,18.2],"minimum":0,"maximum":50,"length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true}},"distortion-strength":{"type":"number","default":0.7,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"],"relaxZoomRestriction":true},"transition":true}},"camera":{"camera-projection":{"type":"enum","values":{"perspective":1,"orthographic":1},"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]},"default":"perspective"}},"colorTheme":{"data":{"type":"string","expression":{}}},"indoor_source":{"sourceId":{"type":"string"},"sourceLayers":{"type":"array","value":"string"}},"indoor":{"*":{"type":"indoor_source"}},"light":{"anchor":{"type":"enum","default":"viewport","values":{"map":1,"viewport":1},"expression":{"parameters":["zoom"]}},"position":{"type":"array","default":[1.15,210,30],"length":3,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"color":{"type":"color","default":"#ffffff","expression":{"interpolated":true,"parameters":["zoom"]},"use-theme":true,"transition":true},"intensity":{"type":"number","default":0.5,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"projection":{"name":{"type":"enum","values":{"albers":1,"equalEarth":1,"equirectangular":1,"lambertConformalConic":1,"mercator":1,"naturalEarth":1,"winkelTripel":1,"globe":1},"default":"mercator"},"center":{"type":"array","length":2,"value":"number","minimum":[-180,-90],"maximum":[180,90]},"parallels":{"type":"array","length":2,"value":"number","minimum":[-90,-90],"maximum":[90,90]}},"terrain":{"source":{"type":"string"},"exaggeration":{"type":"number","default":1,"minimum":0,"maximum":1000,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"paint":["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_building","paint_symbol","paint_raster","paint_raster-particle","paint_hillshade","paint_background","paint_sky","paint_model"],"paint_fill":{"fill-antialias":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]}},"fill-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-outline-color":{"type":"color","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"fill-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"fill-pattern-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-z-offset":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"},"fill-bridge-guard-rail-color":{"type":"color","default":"rgba(241, 236, 225, 255)","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature"]},"property-type":"data-driven"},"fill-tunnel-structure-color":{"type":"color","default":"rgba(241, 236, 225, 255)","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature"]},"property-type":"data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-extrusion-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"fill-extrusion-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"fill-extrusion-pattern-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-extrusion-height":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-height-alignment":{"type":"enum","values":{"terrain":1,"flat":1},"default":"flat"},"fill-extrusion-base-alignment":{"type":"enum","values":{"terrain":1,"flat":1},"default":"terrain"},"fill-extrusion-vertical-gradient":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]}},"fill-extrusion-ambient-occlusion-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-wall-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-ground-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"fill-extrusion-ambient-occlusion-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-flood-light-color":{"type":"color","default":"#ffffff","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-extrusion-flood-light-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"fill-extrusion-flood-light-wall-radius":{"property-type":"data-driven","type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state"]}},"fill-extrusion-flood-light-ground-radius":{"property-type":"data-driven","type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state"]}},"fill-extrusion-flood-light-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-vertical-scale":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"fill-extrusion-rounded-roof":{"type":"boolean","default":true,"expression":{"parameters":["zoom"]}},"fill-extrusion-cutoff-fade-range":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{}},"fill-extrusion-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature-state"]},"property-type":"data-driven"},"fill-extrusion-line-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"fill-extrusion-cast-shadows":{"type":"boolean","default":true}},"paint_building":{"building-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"building-ambient-occlusion-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"parameters":[]},"transition":true},"building-ambient-occlusion-ground-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"building-ambient-occlusion-ground-radius":{"type":"number","default":3,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"building-ambient-occlusion-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"building-vertical-scale":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"building-cast-shadows":{"type":"boolean","default":true},"building-color":{"type":"color","default":"rgba(193, 154, 127, 1)","use-theme":true,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"property-type":"data-driven"},"building-emissive-strength":{"type":"number","default":0,"minimum":0,"maximum":5,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"property-type":"data-driven"},"building-facade-emissive-chance":{"type":"number","default":0.35,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["measure-light","zoom"]}},"building-cutoff-fade-range":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{}},"building-flood-light-color":{"type":"color","default":"#ffffff","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"building-flood-light-intensity":{"type":"number","default":0,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"building-flood-light-ground-attenuation":{"type":"number","default":0.69,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}}},"paint_line":{"line-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"line-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"line-width":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light","line-progress"]},"property-type":"data-driven"},"line-gap-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-offset":{"type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-blur":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"line-dasharray":{"type":"array","value":"number","minimum":0,"expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom","feature"]},"property-type":"data-driven"},"line-pattern-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"line-gradient":{"type":"color","use-theme":true,"expression":{"interpolated":true,"parameters":["line-progress"]}},"line-trim-offset":{"type":"array","value":"number","length":2,"default":[0,0],"minimum":[0,0],"maximum":[1,1]},"line-trim-fade-range":{"type":"array","value":"number","length":2,"default":[0,0],"minimum":[0,0],"maximum":[1,1],"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"line-trim-color":{"type":"color","default":"transparent","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"line-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]},"property-type":"data-driven"},"line-border-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-border-color":{"type":"color","default":"rgba(0, 0, 0, 0)","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-occlusion-opacity":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true}},"paint_circle":{"circle-radius":{"type":"number","default":5,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-blur":{"type":"number","default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"circle-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"circle-pitch-scale":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"circle-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1},"default":"viewport","expression":{"parameters":["zoom"]}},"circle-stroke-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-stroke-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-stroke-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"circle-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}}},"paint_heatmap":{"heatmap-radius":{"type":"number","default":30,"minimum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"heatmap-weight":{"type":"number","default":1,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"heatmap-intensity":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"heatmap-color":{"type":"color","default":["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",0.1,"royalblue",0.3,"cyan",0.5,"lime",0.7,"yellow",1,"red"],"use-theme":true,"expression":{"interpolated":true,"parameters":["heatmap-density"]}},"heatmap-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}}},"paint_symbol":{"icon-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-occlusion-opacity":{"type":"number","minimum":0,"maximum":1,"default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-emissive-strength":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature-state"]},"property-type":"data-driven"},"text-emissive-strength":{"type":"number","default":1,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light","feature-state"]},"property-type":"data-driven"},"icon-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-halo-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-halo-blur":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"icon-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"icon-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"icon-image-cross-fade":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"text-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-occlusion-opacity":{"type":"number","minimum":0,"maximum":1,"default":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"overridable":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-halo-color":{"type":"color","default":"rgba(0, 0, 0, 0)","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-halo-width":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-halo-blur":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature","feature-state","measure-light"]},"property-type":"data-driven"},"text-translate":{"type":"array","value":"number","length":2,"default":[0,0],"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"text-translate-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":["zoom"]}},"icon-color-saturation":{"type":"number","default":0,"minimum":-1,"maximum":1,"expression":{}},"icon-color-contrast":{"type":"number","default":0,"minimum":-1,"maximum":1,"expression":{}},"icon-color-brightness-min":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{}},"icon-color-brightness-max":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{}},"symbol-z-offset":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","feature"]},"property-type":"data-driven"}},"paint_raster":{"raster-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-color":{"type":"color","use-theme":true,"expression":{"interpolated":true,"parameters":["raster-value"]}},"raster-color-mix":{"type":"array","default":[0.2126,0.7152,0.0722,0],"length":4,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-color-range":{"type":"array","length":2,"value":"number","transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-hue-rotate":{"type":"number","default":0,"period":360,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-brightness-min":{"type":"number","default":0,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-brightness-max":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-saturation":{"type":"number","default":0,"minimum":-1,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-contrast":{"type":"number","default":0,"minimum":-1,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-resampling":{"type":"enum","values":{"linear":1,"nearest":1},"default":"linear","expression":{"parameters":["zoom"]}},"raster-fade-duration":{"type":"number","default":300,"minimum":0,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"raster-array-band":{"type":"string"},"raster-elevation":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}}},"paint_raster-particle":{"raster-particle-array-band":{"type":"string"},"raster-particle-count":{"type":"number","default":512,"minimum":1},"raster-particle-color":{"type":"color","use-theme":true,"expression":{"interpolated":true,"parameters":["raster-particle-speed"]}},"raster-particle-max-speed":{"type":"number","default":1,"minimum":1},"raster-particle-speed-factor":{"type":"number","default":0.2,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-particle-fade-opacity-factor":{"type":"number","default":0.98,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"raster-particle-reset-rate-factor":{"type":"number","default":0.8,"minimum":0,"maximum":1},"raster-particle-elevation":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}}},"paint_hillshade":{"hillshade-illumination-direction":{"type":"number","default":335,"minimum":0,"maximum":359,"expression":{"interpolated":true,"parameters":["zoom"]}},"hillshade-illumination-anchor":{"type":"enum","values":{"map":1,"viewport":1},"default":"viewport","expression":{"parameters":["zoom"]}},"hillshade-exaggeration":{"type":"number","default":0.5,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"hillshade-shadow-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"hillshade-highlight-color":{"type":"color","default":"#FFFFFF","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"hillshade-accent-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"hillshade-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}}},"paint_background":{"background-pitch-alignment":{"type":"enum","values":{"map":1,"viewport":1},"default":"map","expression":{"parameters":[]}},"background-color":{"type":"color","default":"#000000","use-theme":true,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}},"background-pattern":{"type":"resolvedImage","expression":{"parameters":["zoom"]}},"background-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}},"background-emissive-strength":{"type":"number","default":0,"minimum":0,"transition":true,"expression":{"interpolated":true,"parameters":["zoom","measure-light"]}}},"paint_sky":{"sky-type":{"type":"enum","values":{"gradient":1,"atmosphere":1},"default":"atmosphere","expression":{"parameters":["zoom"]}},"sky-atmosphere-sun":{"type":"array","value":"number","length":2,"minimum":[0,0],"maximum":[360,180],"expression":{"parameters":["zoom"]}},"sky-atmosphere-sun-intensity":{"type":"number","default":10,"minimum":0,"maximum":100},"sky-gradient-center":{"type":"array","value":"number","default":[0,0],"length":2,"minimum":[0,0],"maximum":[360,180],"expression":{"parameters":["zoom"]}},"sky-gradient-radius":{"type":"number","default":90,"minimum":0,"maximum":180,"expression":{"parameters":["zoom"]}},"sky-gradient":{"type":"color","default":["interpolate",["linear"],["sky-radial-progress"],0.8,"#87ceeb",1,"white"],"use-theme":true,"expression":{"interpolated":true,"parameters":["sky-radial-progress"]}},"sky-atmosphere-halo-color":{"type":"color","default":"white","use-theme":true},"sky-atmosphere-color":{"type":"color","default":"white","use-theme":true},"sky-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["zoom"]}}},"paint_model":{"model-opacity":{"type":"number","default":1,"minimum":0,"maximum":1,"transition":true,"expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"property-type":"data-driven"},"model-rotation":{"type":"array","value":"number","length":3,"default":[0,0,0],"period":360,"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"transition":true},"model-scale":{"type":"array","value":"number","length":3,"default":[1,1,1],"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"transition":true},"model-translation":{"type":"array","value":"number","length":3,"default":[0,0,0],"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","zoom"]},"transition":true},"model-color":{"type":"color","default":"#ffffff","property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light","zoom"]},"use-theme":true,"transition":true},"model-color-mix-intensity":{"type":"number","property-type":"data-driven","default":0,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"transition":true},"model-type":{"type":"enum","values":{"common-3d":1,"location-indicator":1},"default":"common-3d"},"model-cast-shadows":{"type":"boolean","default":true},"model-receive-shadows":{"type":"boolean","default":true},"model-ambient-occlusion-intensity":{"type":"number","default":1,"minimum":0,"maximum":1,"expression":{"interpolated":true,"parameters":["zoom"]},"transition":true},"model-emissive-strength":{"type":"number","property-type":"data-driven","default":0,"minimum":0,"maximum":5,"expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"transition":true},"model-roughness":{"type":"number","default":1,"minimum":0,"maximum":1,"property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state"]},"transition":true},"model-height-based-emissive-strength-multiplier":{"type":"array","default":[1,1,1,1,0],"length":5,"value":"number","property-type":"data-driven","expression":{"interpolated":true,"parameters":["feature","feature-state","measure-light"]},"transition":true},"model-cutoff-fade-range":{"type":"number","default":0,"minimum":0,"maximum":1,"expression":{}},"model-front-cutoff":{"type":"array","value":"number","expression":{"interpolated":true,"parameters":["zoom"]},"length":3,"default":[0,0,1],"minimum":[0,0,0],"maximum":[1,1,1]},"model-elevation-reference":{"type":"enum","values":{"sea":1,"ground":1,"hd-road-markup":1},"default":"ground","expression":{}}},"transition":{"duration":{"type":"number","default":300,"minimum":0},"delay":{"type":"number","default":0,"minimum":0}},"promoteId":{"*":{"type":"*"}}}');function TP(f){return f instanceof Number||f instanceof String||f instanceof Boolean?f.valueOf():f}function rN(f){if(Array.isArray(f))return f.map(rN);if(f instanceof Object&&!(f instanceof Number||f instanceof String||f instanceof Boolean)){const c={};for(const u in f)c[u]=rN(f[u]);return c}return TP(f)}function wf(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(!wf(c)&&typeof c!="boolean")return!1;return!0;default:return!0}}function nN(f,c="",u=null,g="fill"){if(f==null)return{filter:()=>!0,needGeometry:!1,needFeature:!1};wf(f)||(f=sN(f));const v=f;let k=!0;try{k=function(W){if(!By(W))return W;let K=rN(W);return AP(K),K=rx(K),K}(v)}catch{console.warn(`Failed to extract static filter. Filter will continue working, but at higher memory usage and slower framerate. This is most likely a bug, please report this via https://github.com/mapbox/mapbox-gl-js/issues/new?assignees=&labels=&template=Bug_report.md and paste the contents of this message in the report. Thank you! Filter Expression: ${JSON.stringify(v,null,2)} `)}let S=null,P=null;if(g!=="background"&&g!=="sky"&&g!=="slot"){P=Ft[`filter_${g}`];const W=zm(k,P,c,u);if(W.result==="error")throw new Error(W.value.map(K=>`${K.key}: ${K.message}`).join(", "));S=(K,X,re)=>W.value.evaluate(K,X,{},re)}let R=null,$=null;if(k!==v){const W=zm(v,P,c,u);if(W.result==="error")throw new Error(W.value.map(K=>`${K.key}: ${K.message}`).join(", "));R=(K,X,re,se,fe)=>W.value.evaluate(K,X,{},re,void 0,void 0,se,fe),$=!Ay(W.value.expression)}return{filter:S,dynamicFilter:R||void 0,needGeometry:EP(k),needFeature:!!$}}function rx(f){if(!Array.isArray(f))return f;const c=function(u){if(iie.has(u[0])){for(let g=1;grx(u))}function AP(f){let c=!1;const u=[];if(f[0]==="case"){for(let g=1;g",">=","<","<=","to-boolean"]);function oie(f,c){return fc?1:0}function EP(f){if(!Array.isArray(f))return!1;if(f[0]==="within"||f[0]==="distance")return!0;for(let c=1;c"||c==="<="||c===">="?aN(f[1],f[2],c):c==="any"?(u=f.slice(1),["any"].concat(u.map(sN))):c==="all"?["all"].concat(f.slice(1).map(sN)):c==="none"?["all"].concat(f.slice(1).map(sN).map(Rv)):c==="in"?iN(f[1],f.slice(2)):c==="!in"?Rv(iN(f[1],f.slice(2))):c==="has"?oN(f[1]):c!=="!has"||Rv(oN(f[1]));var u}function aN(f,c,u){switch(f){case"$type":return[`filter-type-${u}`,c];case"$id":return[`filter-id-${u}`,c];default:return[`filter-${u}`,f,c]}}function iN(f,c){if(c.length===0)return!1;switch(f){case"$type":return["filter-type-in",["literal",c]];case"$id":return["filter-id-in",["literal",c]];default:return c.length>200&&!c.some(u=>typeof u!=typeof c[0])?["filter-in-large",f,["literal",c.sort(oie)]]:["filter-in-small",f,["literal",c]]}}function oN(f){switch(f){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",f]}}function Rv(f){return["!",f]}const nx="";function Lh(f,c){return c?`${f}${nx}${c}`:f}let IP;const PP=()=>IP||(IP=new Wi({"icon-size":new Er(Ft.layout_symbol["icon-size"]),"icon-image":new Er(Ft.layout_symbol["icon-image"]),"icon-rotate":new Er(Ft.layout_symbol["icon-rotate"]),"icon-offset":new Er(Ft.layout_symbol["icon-offset"]),"text-size":new Er(Ft.layout_symbol["text-size"]),"text-rotate":new Er(Ft.layout_symbol["text-rotate"]),"text-offset":new Er(Ft.layout_symbol["text-offset"])}));class LP{constructor(c,u,g,v,k,S){const P=zm(c,Ft.appearance.condition);if(P.result==="success"&&(this.condition=P.value),this.name=u,g){this.properties=new ex(PP()),this.unevaluatedLayout=new MP(PP(),v,k,S);for(const R in g)this.unevaluatedLayout.setValue(R,g[R])}}isActive(c){return!(this.condition||!c.isHidden||this.name!=="hidden")||this.condition.evaluate(c.globals,c.feature,c.featureState,c.canonical)}getCondition(){return this.condition}getName(){return this.name}getProperty(c){return this.properties.get(c)}getUnevaluatedProperties(){return this.unevaluatedLayout}getUnevaluatedProperty(c){return this.unevaluatedLayout._values[c]}recalculate(c,u,g){this.unevaluatedLayout&&(this.properties=this.unevaluatedLayout.possiblyEvaluate(c,void 0,u,g))}serialize(){const c={};return c.condition=this.condition.expression.serialize(),this.name&&(c.name=this.name),this.unevaluatedLayout&&(c.properties=this.unevaluatedLayout.serialize()),c}hasIconProperties(){const c=this.hasProperty("icon-image"),u=this.hasProperty("icon-size"),g=this.hasProperty("icon-offset"),v=this.hasProperty("icon-rotate");return c||u||g||v}hasTextProperties(){const c=this.hasProperty("text-size"),u=this.hasProperty("text-offset"),g=this.hasProperty("text-rotate");return c||u||g}hasProperty(c){return this.getUnevaluatedProperty(c).value!==void 0}}const OP="-transition",jf=new Set(["fill","line","background","hillshade","raster"]);class rd extends pi{constructor(c,u,g,v,k,S){if(super(),this.id=c.id,this.fqid=Lh(this.id,g),this.type=c.type,this.scope=g,this.lut=v,this.options=k,this.iconImageUseTheme=S,this.appearances=new Array,this._featureFilter={filter:()=>!0,needGeometry:!1,needFeature:!1},this._filterCompiled=!1,this.expressionDependencies={isIndoorDependent:!1,configDependencies:new Set},c.type!=="custom"){if(this.metadata=c.metadata,this.minzoom=c.minzoom,this.maxzoom=c.maxzoom,c.type&&c.type!=="background"&&c.type!=="sky"&&c.type!=="slot"){this.source=c.source,this.sourceLayer=c["source-layer"],this.filter=c.filter;const P=zm(this.filter,Ft[`filter_${c.type}`]);P.result!=="error"&&(this.expressionDependencies.configDependencies=new Set([...this.expressionDependencies.configDependencies,...P.value.configDependencies]),this.expressionDependencies.isIndoorDependent=this.expressionDependencies.isIndoorDependent||P.value.isIndoorDependent)}if(c.slot&&(this.slot=c.slot),c.appearances&&this.setAppearances(c.appearances),u.layout&&(this._unevaluatedLayout=new MP(u.layout,this.scope,k,this.iconImageUseTheme),this.expressionDependencies.configDependencies=new Set([...this.expressionDependencies.configDependencies,...this._unevaluatedLayout.configDependencies]),this.expressionDependencies.isIndoorDependent=this.expressionDependencies.isIndoorDependent||this._unevaluatedLayout.isIndoorDependent()),u.paint){this._transitionablePaint=new NP(u.paint,this.scope,k);for(const P in c.paint)this.setPaintProperty(P,c.paint[P]);for(const P in c.layout)this.setLayoutProperty(P,c.layout[P]);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 ex(u.paint)}}}onAdd(c){}onRemove(c){}isDraped(c){return!this.is3D(!0)&&jf.has(this.type)}getLayoutProperty(c){return c==="visibility"?this.visibility:this._unevaluatedLayout.getValue(c)}setLayoutProperty(c,u){if(this.type==="custom"&&c==="visibility")return void(this.visibility=u);const g=this._unevaluatedLayout;g._properties.properties[c]&&(g.setValue(c,u),this.expressionDependencies.configDependencies=new Set([...this.expressionDependencies.configDependencies,...g.configDependencies]),this.expressionDependencies.isIndoorDependent=this.expressionDependencies.isIndoorDependent||g.isIndoorDependent(),c==="visibility"&&this.possiblyEvaluateVisibility())}setAppearances(c){this.appearances=[],c.forEach(u=>{this.appearances.push(new LP(u.condition,u.name,u.properties,this.scope,this.options,this.iconImageUseTheme))})}possiblyEvaluateVisibility(){this._unevaluatedLayout._values.visibility&&(this.visibility=this._unevaluatedLayout._values.visibility.possiblyEvaluate({zoom:0}))}getPaintProperty(c){return c.endsWith(OP)?this._transitionablePaint.getTransition(c.slice(0,-11)):this._transitionablePaint.getValue(c)}isPaintProperty(c){return!!this._transitionablePaint._properties.properties[c]}setPaintProperty(c,u){const g=this._transitionablePaint,v=g._properties.properties;if(c.endsWith(OP)){const K=c.slice(0,-11);return v[K]&&g.setTransition(K,u||void 0),!1}if(!v[c])return!1;const k=g._values[c],S=k.value.isDataDriven(),P=k.value;g.setValue(c,u),this.expressionDependencies.configDependencies=new Set([...this.expressionDependencies.configDependencies,...g.configDependencies]),this.expressionDependencies.isIndoorDependent=this.expressionDependencies.isIndoorDependent||g.isIndoorDependent(),this._handleSpecialPaintPropertyUpdate(c);const R=g._values[c].value,$=R.isDataDriven(),W=c.endsWith("pattern")||c==="line-dasharray";return $||S||W||this._handleOverridablePaintPropertyUpdate(c,P,R)}_handleSpecialPaintPropertyUpdate(c){}getProgramIds(){return null}getDefaultProgramParams(c,u,g){return null}_handleOverridablePaintPropertyUpdate(c,u,g){return!1}isHidden(c){return!!(this.minzoom&&c=this.maxzoom)||this.visibility==="none"}updateTransitions(c){this._transitioningPaint=this._transitionablePaint.transitioned(c,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(c,u){this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(c,void 0,u,this.iconImageUseTheme)),this.paint=this._transitioningPaint.possiblyEvaluate(c,void 0,u)}serialize(){const c={id:this.id,type:this.type,slot:this.slot,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.appearances.length!==0&&(c.appearances=this.appearances.map(u=>u.serialize())),fr(c,(u,g)=>!(u===void 0||g==="layout"&&!Object.keys(u).length||g==="paint"&&!Object.keys(u).length))}is3D(c){return!1}hasElevation(){return!1}isSky(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}hasShadowPass(){return!1}canCastShadows(){return!1}hasLightBeamPass(){return!1}cutoffRange(){return 0}tileCoverLift(){return 0}resize(){}_clear(){}isStateDependent(){for(const c in this.paint._values){const u=this.paint.get(c);if(u instanceof Jg&&Ev(u.property.specification)&&(u.value.kind==="source"||u.value.kind==="composite")&&u.value.isStateDependent)return!0}for(const c of this.appearances)if(!Nv(c.condition.expression))return!0;return!1}compileFilter(c){this._filterCompiled||(this._featureFilter=nN(this.filter,this.scope,c),this._filterCompiled=!0)}invalidateCompiledFilter(){this._filterCompiled=!1}dynamicFilter(){return this._featureFilter.dynamicFilter}dynamicFilterNeedsFeature(){return this._featureFilter.needFeature}getLayerRenderingStats(){return this._stats}resetLayerRenderingStats(c){this._stats&&(c.renderPass==="shadow"?this._stats.numRenderedVerticesInShadowPass=0:this._stats.numRenderedVerticesInTransparentPass=0)}getAppearances(){return this.appearances}queryRenderedFeatures(c,u,g){return{}}queryRadius(c){}queryIntersectsFeature(c,u,g,v,k,S,P,R,$){}}const DP={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class Fv{constructor(c,u){this._structArray=c,this._pos1=u*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}const lie=new ArrayBuffer(0);class mi{constructor(){this._reallocCount=0,this.capacity=0,this.length=0}static serialize(c,u){return c._trim(),u&&c.arrayBuffer&&u.add(c.arrayBuffer),{length:c.length,arrayBuffer:c.arrayBuffer}}static deserialize(c){const u=Object.create(this.prototype);return u.arrayBuffer=c.arrayBuffer,u.length=c.length,c.arrayBuffer?u.capacity=c.arrayBuffer.byteLength/u.bytesPerElement:(u.capacity=0,u.arrayBuffer=lie),u._refreshViews(),u}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(c){this.reserve(c),this.length=c}reserve(c){if(c>this.capacity){this._reallocCount++,this.capacity=Math.max(c,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const u=this.uint8;this._refreshViews(),u&&this.uint8.set(u)}}reserveForAdditional(c){this.reserve(this.length+c)}_refreshViews(){throw new Error("StructArray#_refreshViews() must be implemented by each concrete StructArray layout")}emplace(...c){throw new Error("StructArray#emplace() must be implemented by each concrete StructArray layout")}emplaceBack(...c){throw new Error("StructArray#emplaceBack() must be implemented by each concrete StructArray layout")}destroy(){this.int8=this.uint8=this.int16=this.uint16=this.int32=this.uint32=this.float32=null,this.arrayBuffer=null}}function Ts(f,c=1){let u=0,g=0;return{members:f.map(v=>{const k=DP[v.type].BYTES_PER_ELEMENT,S=u=RP(u,Math.max(c,k)),P=v.components||1;return g=Math.max(g,k),u+=k*P,{name:v.name,type:v.type,components:P,offset:S}}),size:RP(u,Math.max(g,c)),alignment:c}}function RP(f,c){return Math.ceil(f/c)*c}class $m extends mi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(c,u){const g=this.length;return this.resize(g+1),this.emplace(g,c,u)}emplace(c,u,g){const v=2*c;return this.int16[v+0]=u,this.int16[v+1]=g,c}}$m.prototype.bytesPerElement=4,Yr($m,"StructArrayLayout2i4");class $y extends mi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(c,u,g){const v=this.length;return this.resize(v+1),this.emplace(v,c,u,g)}emplace(c,u,g,v){const k=3*c;return this.int16[k+0]=u,this.int16[k+1]=g,this.int16[k+2]=v,c}}$y.prototype.bytesPerElement=6,Yr($y,"StructArrayLayout3i6");class Uy extends mi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(c,u,g,v){const k=this.length;return this.resize(k+1),this.emplace(k,c,u,g,v)}emplace(c,u,g,v,k){const S=4*c;return this.int16[S+0]=u,this.int16[S+1]=g,this.int16[S+2]=v,this.int16[S+3]=k,c}}Uy.prototype.bytesPerElement=8,Yr(Uy,"StructArrayLayout4i8");class jp extends mi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c){const u=this.length;return this.resize(u+1),this.emplace(u,c)}emplace(c,u){return this.float32[1*c+0]=u,c}}jp.prototype.bytesPerElement=4,Yr(jp,"StructArrayLayout1f4");class u5 extends mi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c,u,g){const v=this.length;return this.resize(v+1),this.emplace(v,c,u,g)}emplace(c,u,g,v){const k=4*c,S=2*c;return this.int16[k+0]=u,this.int16[k+1]=g,this.float32[S+1]=v,c}}u5.prototype.bytesPerElement=8,Yr(u5,"StructArrayLayout2i1f8");class h5 extends mi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(c,u,g){const v=this.length;return this.resize(v+1),this.emplace(v,c,u,g)}emplace(c,u,g,v){const k=4*c;return this.int16[k+0]=u,this.int16[k+1]=g,this.int16[k+2]=v,c}}h5.prototype.bytesPerElement=8,Yr(h5,"StructArrayLayout3i8");class f5 extends mi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(c,u,g,v,k){const S=this.length;return this.resize(S+1),this.emplace(S,c,u,g,v,k)}emplace(c,u,g,v,k,S){const P=5*c;return this.int16[P+0]=u,this.int16[P+1]=g,this.int16[P+2]=v,this.int16[P+3]=k,this.int16[P+4]=S,c}}f5.prototype.bytesPerElement=10,Yr(f5,"StructArrayLayout5i10");class lN extends mi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c,u,g,v,k,S,P){const R=this.length;return this.resize(R+1),this.emplace(R,c,u,g,v,k,S,P)}emplace(c,u,g,v,k,S,P,R){const $=6*c,W=12*c,K=3*c;return this.int16[$+0]=u,this.int16[$+1]=g,this.uint8[W+4]=v,this.uint8[W+5]=k,this.uint8[W+6]=S,this.uint8[W+7]=P,this.float32[K+2]=R,c}}lN.prototype.bytesPerElement=12,Yr(lN,"StructArrayLayout2i4ub1f12");class vu extends mi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c,u,g){const v=this.length;return this.resize(v+1),this.emplace(v,c,u,g)}emplace(c,u,g,v){const k=3*c;return this.float32[k+0]=u,this.float32[k+1]=g,this.float32[k+2]=v,c}}vu.prototype.bytesPerElement=12,Yr(vu,"StructArrayLayout3f12");class jd extends mi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c,u,g,v,k){const S=this.length;return this.resize(S+1),this.emplace(S,c,u,g,v,k)}emplace(c,u,g,v,k,S){const P=6*c,R=3*c;return this.uint16[P+0]=u,this.uint16[P+1]=g,this.uint16[P+2]=v,this.uint16[P+3]=k,this.float32[R+2]=S,c}}jd.prototype.bytesPerElement=12,Yr(jd,"StructArrayLayout4ui1f12");class sx extends mi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(c,u,g,v){const k=this.length;return this.resize(k+1),this.emplace(k,c,u,g,v)}emplace(c,u,g,v,k){const S=4*c;return this.uint16[S+0]=u,this.uint16[S+1]=g,this.uint16[S+2]=v,this.uint16[S+3]=k,c}}sx.prototype.bytesPerElement=8,Yr(sx,"StructArrayLayout4ui8");class cN extends mi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(c,u,g,v,k,S){const P=this.length;return this.resize(P+1),this.emplace(P,c,u,g,v,k,S)}emplace(c,u,g,v,k,S,P){const R=6*c;return this.int16[R+0]=u,this.int16[R+1]=g,this.int16[R+2]=v,this.int16[R+3]=k,this.int16[R+4]=S,this.int16[R+5]=P,c}}cN.prototype.bytesPerElement=12,Yr(cN,"StructArrayLayout6i12");class p5 extends mi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(c,u,g,v,k,S,P,R,$,W,K,X){const re=this.length;return this.resize(re+1),this.emplace(re,c,u,g,v,k,S,P,R,$,W,K,X)}emplace(c,u,g,v,k,S,P,R,$,W,K,X,re){const se=12*c;return this.int16[se+0]=u,this.int16[se+1]=g,this.int16[se+2]=v,this.int16[se+3]=k,this.uint16[se+4]=S,this.uint16[se+5]=P,this.uint16[se+6]=R,this.uint16[se+7]=$,this.int16[se+8]=W,this.int16[se+9]=K,this.int16[se+10]=X,this.int16[se+11]=re,c}}p5.prototype.bytesPerElement=24,Yr(p5,"StructArrayLayout4i4ui4i24");class m5 extends mi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c,u,g,v,k,S){const P=this.length;return this.resize(P+1),this.emplace(P,c,u,g,v,k,S)}emplace(c,u,g,v,k,S,P){const R=10*c,$=5*c;return this.int16[R+0]=u,this.int16[R+1]=g,this.int16[R+2]=v,this.float32[$+2]=k,this.float32[$+3]=S,this.float32[$+4]=P,c}}m5.prototype.bytesPerElement=20,Yr(m5,"StructArrayLayout3i3f20");class Um extends mi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c,u,g,v){const k=this.length;return this.resize(k+1),this.emplace(k,c,u,g,v)}emplace(c,u,g,v,k){const S=4*c;return this.float32[S+0]=u,this.float32[S+1]=g,this.float32[S+2]=v,this.float32[S+3]=k,c}}Um.prototype.bytesPerElement=16,Yr(Um,"StructArrayLayout4f16");class dN extends mi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(c){const u=this.length;return this.resize(u+1),this.emplace(u,c)}emplace(c,u){return this.uint32[1*c+0]=u,c}}dN.prototype.bytesPerElement=4,Yr(dN,"StructArrayLayout1ul4");class _u extends mi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(c,u){const g=this.length;return this.resize(g+1),this.emplace(g,c,u)}emplace(c,u,g){const v=2*c;return this.uint16[v+0]=u,this.uint16[v+1]=g,c}}_u.prototype.bytesPerElement=4,Yr(_u,"StructArrayLayout2ui4");class uN extends mi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(c,u,g,v,k,S,P,R,$,W,K,X,re){const se=this.length;return this.resize(se+1),this.emplace(se,c,u,g,v,k,S,P,R,$,W,K,X,re)}emplace(c,u,g,v,k,S,P,R,$,W,K,X,re,se){const fe=20*c,Se=10*c;return this.int16[fe+0]=u,this.int16[fe+1]=g,this.int16[fe+2]=v,this.int16[fe+3]=k,this.int16[fe+4]=S,this.float32[Se+3]=P,this.float32[Se+4]=R,this.float32[Se+5]=$,this.float32[Se+6]=W,this.int16[fe+14]=K,this.uint32[Se+8]=X,this.uint16[fe+18]=re,this.uint16[fe+19]=se,c}}uN.prototype.bytesPerElement=40,Yr(uN,"StructArrayLayout5i4f1i1ul2ui40");class hN extends mi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(c,u,g,v,k,S,P){const R=this.length;return this.resize(R+1),this.emplace(R,c,u,g,v,k,S,P)}emplace(c,u,g,v,k,S,P,R){const $=8*c;return this.int16[$+0]=u,this.int16[$+1]=g,this.int16[$+2]=v,this.int16[$+4]=k,this.int16[$+5]=S,this.int16[$+6]=P,this.int16[$+7]=R,c}}hN.prototype.bytesPerElement=16,Yr(hN,"StructArrayLayout3i2i2i16");class fN extends mi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(c,u,g,v,k){const S=this.length;return this.resize(S+1),this.emplace(S,c,u,g,v,k)}emplace(c,u,g,v,k,S){const P=4*c,R=8*c;return this.float32[P+0]=u,this.float32[P+1]=g,this.float32[P+2]=v,this.int16[R+6]=k,this.int16[R+7]=S,c}}fN.prototype.bytesPerElement=16,Yr(fN,"StructArrayLayout2f1f2i16");class g5 extends mi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c,u,g,v,k,S){const P=this.length;return this.resize(P+1),this.emplace(P,c,u,g,v,k,S)}emplace(c,u,g,v,k,S,P){const R=20*c,$=5*c;return this.uint8[R+0]=u,this.uint8[R+1]=g,this.float32[$+1]=v,this.float32[$+2]=k,this.float32[$+3]=S,this.float32[$+4]=P,c}}g5.prototype.bytesPerElement=20,Yr(g5,"StructArrayLayout2ub4f20");class Uo extends mi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(c,u,g){const v=this.length;return this.resize(v+1),this.emplace(v,c,u,g)}emplace(c,u,g,v){const k=3*c;return this.uint16[k+0]=u,this.uint16[k+1]=g,this.uint16[k+2]=v,c}}Uo.prototype.bytesPerElement=6,Yr(Uo,"StructArrayLayout3ui6");class qy extends mi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(c,u,g,v,k,S,P,R,$,W,K,X,re,se,fe,Se,ke,Fe,$e,Ke,ht){const ot=this.length;return this.resize(ot+1),this.emplace(ot,c,u,g,v,k,S,P,R,$,W,K,X,re,se,fe,Se,ke,Fe,$e,Ke,ht)}emplace(c,u,g,v,k,S,P,R,$,W,K,X,re,se,fe,Se,ke,Fe,$e,Ke,ht,ot){const _t=30*c,Ct=15*c,Et=60*c;return this.int16[_t+0]=u,this.int16[_t+1]=g,this.int16[_t+2]=v,this.float32[Ct+2]=k,this.float32[Ct+3]=S,this.uint16[_t+8]=P,this.uint16[_t+9]=R,this.uint32[Ct+5]=$,this.uint32[Ct+6]=W,this.uint32[Ct+7]=K,this.uint16[_t+16]=X,this.uint16[_t+17]=re,this.uint16[_t+18]=se,this.float32[Ct+10]=fe,this.float32[Ct+11]=Se,this.uint8[Et+48]=ke,this.uint8[Et+49]=Fe,this.uint8[Et+50]=$e,this.uint32[Ct+13]=Ke,this.int16[_t+28]=ht,this.uint8[Et+58]=ot,c}}qy.prototype.bytesPerElement=60,Yr(qy,"StructArrayLayout3i2f2ui3ul3ui2f3ub1ul1i1ub60");class x5 extends mi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(c,u,g,v,k,S,P,R,$,W,K,X,re,se,fe,Se,ke,Fe,$e,Ke,ht,ot,_t,Ct,Et,Kt,Rt,rr,or,lr,xr,vr,ur){const pr=this.length;return this.resize(pr+1),this.emplace(pr,c,u,g,v,k,S,P,R,$,W,K,X,re,se,fe,Se,ke,Fe,$e,Ke,ht,ot,_t,Ct,Et,Kt,Rt,rr,or,lr,xr,vr,ur)}emplace(c,u,g,v,k,S,P,R,$,W,K,X,re,se,fe,Se,ke,Fe,$e,Ke,ht,ot,_t,Ct,Et,Kt,Rt,rr,or,lr,xr,vr,ur,pr){const tr=20*c,Xt=40*c,mr=80*c;return this.float32[tr+0]=u,this.float32[tr+1]=g,this.int16[Xt+4]=v,this.int16[Xt+5]=k,this.int16[Xt+6]=S,this.int16[Xt+7]=P,this.int16[Xt+8]=R,this.int16[Xt+9]=$,this.int16[Xt+10]=W,this.int16[Xt+11]=K,this.int16[Xt+12]=X,this.uint16[Xt+13]=re,this.uint16[Xt+14]=se,this.uint16[Xt+15]=fe,this.uint16[Xt+16]=Se,this.uint16[Xt+17]=ke,this.uint16[Xt+18]=Fe,this.uint16[Xt+19]=$e,this.uint16[Xt+20]=Ke,this.uint16[Xt+21]=ht,this.uint16[Xt+22]=ot,this.uint16[Xt+23]=_t,this.uint16[Xt+24]=Ct,this.uint16[Xt+25]=Et,this.uint16[Xt+26]=Kt,this.uint16[Xt+27]=Rt,this.uint32[tr+14]=rr,this.float32[tr+15]=or,this.float32[tr+16]=lr,this.float32[tr+17]=xr,this.float32[tr+18]=vr,this.uint8[mr+76]=ur,this.uint16[Xt+39]=pr,c}}x5.prototype.bytesPerElement=80,Yr(x5,"StructArrayLayout2f9i15ui1ul4f1ub1ui80");class y5 extends mi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c,u,g,v,k,S){const P=this.length;return this.resize(P+1),this.emplace(P,c,u,g,v,k,S)}emplace(c,u,g,v,k,S,P){const R=6*c;return this.float32[R+0]=u,this.float32[R+1]=g,this.float32[R+2]=v,this.float32[R+3]=k,this.float32[R+4]=S,this.float32[R+5]=P,c}}y5.prototype.bytesPerElement=24,Yr(y5,"StructArrayLayout6f24");class ax extends mi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c,u,g,v,k){const S=this.length;return this.resize(S+1),this.emplace(S,c,u,g,v,k)}emplace(c,u,g,v,k,S){const P=5*c;return this.float32[P+0]=u,this.float32[P+1]=g,this.float32[P+2]=v,this.float32[P+3]=k,this.float32[P+4]=S,c}}ax.prototype.bytesPerElement=20,Yr(ax,"StructArrayLayout5f20");class v5 extends mi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c,u,g,v,k,S,P){const R=this.length;return this.resize(R+1),this.emplace(R,c,u,g,v,k,S,P)}emplace(c,u,g,v,k,S,P,R){const $=7*c;return this.float32[$+0]=u,this.float32[$+1]=g,this.float32[$+2]=v,this.float32[$+3]=k,this.float32[$+4]=S,this.float32[$+5]=P,this.float32[$+6]=R,c}}v5.prototype.bytesPerElement=28,Yr(v5,"StructArrayLayout7f28");class _5 extends mi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c,u,g,v,k,S,P,R,$,W,K){const X=this.length;return this.resize(X+1),this.emplace(X,c,u,g,v,k,S,P,R,$,W,K)}emplace(c,u,g,v,k,S,P,R,$,W,K,X){const re=11*c;return this.float32[re+0]=u,this.float32[re+1]=g,this.float32[re+2]=v,this.float32[re+3]=k,this.float32[re+4]=S,this.float32[re+5]=P,this.float32[re+6]=R,this.float32[re+7]=$,this.float32[re+8]=W,this.float32[re+9]=K,this.float32[re+10]=X,c}}_5.prototype.bytesPerElement=44,Yr(_5,"StructArrayLayout11f44");class Vy extends mi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c,u,g,v,k,S,P,R,$){const W=this.length;return this.resize(W+1),this.emplace(W,c,u,g,v,k,S,P,R,$)}emplace(c,u,g,v,k,S,P,R,$,W){const K=9*c;return this.float32[K+0]=u,this.float32[K+1]=g,this.float32[K+2]=v,this.float32[K+3]=k,this.float32[K+4]=S,this.float32[K+5]=P,this.float32[K+6]=R,this.float32[K+7]=$,this.float32[K+8]=W,c}}Vy.prototype.bytesPerElement=36,Yr(Vy,"StructArrayLayout9f36");class kf extends mi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c,u){const g=this.length;return this.resize(g+1),this.emplace(g,c,u)}emplace(c,u,g){const v=2*c;return this.float32[v+0]=u,this.float32[v+1]=g,c}}kf.prototype.bytesPerElement=8,Yr(kf,"StructArrayLayout2f8");class kd extends mi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(c,u,g,v){const k=this.length;return this.resize(k+1),this.emplace(k,c,u,g,v)}emplace(c,u,g,v,k){const S=6*c;return this.uint32[3*c+0]=u,this.uint16[S+2]=g,this.uint16[S+3]=v,this.uint16[S+4]=k,c}}kd.prototype.bytesPerElement=12,Yr(kd,"StructArrayLayout1ul3ui12");class qm extends mi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(c){const u=this.length;return this.resize(u+1),this.emplace(u,c)}emplace(c,u){return this.uint16[1*c+0]=u,c}}qm.prototype.bytesPerElement=2,Yr(qm,"StructArrayLayout1ui2");class b5 extends mi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c,u,g,v,k,S,P,R,$,W,K,X,re,se,fe,Se){const ke=this.length;return this.resize(ke+1),this.emplace(ke,c,u,g,v,k,S,P,R,$,W,K,X,re,se,fe,Se)}emplace(c,u,g,v,k,S,P,R,$,W,K,X,re,se,fe,Se,ke){const Fe=16*c;return this.float32[Fe+0]=u,this.float32[Fe+1]=g,this.float32[Fe+2]=v,this.float32[Fe+3]=k,this.float32[Fe+4]=S,this.float32[Fe+5]=P,this.float32[Fe+6]=R,this.float32[Fe+7]=$,this.float32[Fe+8]=W,this.float32[Fe+9]=K,this.float32[Fe+10]=X,this.float32[Fe+11]=re,this.float32[Fe+12]=se,this.float32[Fe+13]=fe,this.float32[Fe+14]=Se,this.float32[Fe+15]=ke,c}}b5.prototype.bytesPerElement=64,Yr(b5,"StructArrayLayout16f64");class pN extends mi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c,u,g,v,k,S,P){const R=this.length;return this.resize(R+1),this.emplace(R,c,u,g,v,k,S,P)}emplace(c,u,g,v,k,S,P,R){const $=10*c,W=5*c;return this.uint16[$+0]=u,this.uint16[$+1]=g,this.uint16[$+2]=v,this.uint16[$+3]=k,this.float32[W+2]=S,this.float32[W+3]=P,this.float32[W+4]=R,c}}pN.prototype.bytesPerElement=20,Yr(pN,"StructArrayLayout4ui3f20");class w5 extends mi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(c){const u=this.length;return this.resize(u+1),this.emplace(u,c)}emplace(c,u){return this.int16[1*c+0]=u,c}}w5.prototype.bytesPerElement=2,Yr(w5,"StructArrayLayout1i2");class mN extends mi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer)}emplaceBack(c){const u=this.length;return this.resize(u+1),this.emplace(u,c)}emplace(c,u){return this.uint8[1*c+0]=u,c}}mN.prototype.bytesPerElement=1,Yr(mN,"StructArrayLayout1ub1");class gN extends Fv{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]}}gN.prototype.size=40;class FP extends uN{get(c){return new gN(this,c)}}Yr(FP,"CollisionBoxArray");class xN extends Fv{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}}xN.prototype.size=60;class zP extends qy{get(c){return new xN(this,c)}}Yr(zP,"PlacedSymbolArray");class BP extends Fv{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]}}BP.prototype.size=80;class j5 extends x5{get(c){return new BP(this,c)}}Yr(j5,"SymbolInstanceArray");class yN extends jp{getoffsetX(c){return this.float32[1*c+0]}}Yr(yN,"GlyphOffsetArray");class $P extends $m{getx(c){return this.int16[2*c+0]}gety(c){return this.int16[2*c+1]}}Yr($P,"SymbolLineVertexArray");class k5 extends Fv{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]}}k5.prototype.size=12;class N5 extends kd{get(c){return new k5(this,c)}}Yr(N5,"FeatureIndexArray");class UP extends _u{geta_centroid_pos0(c){return this.uint16[2*c+0]}geta_centroid_pos1(c){return this.uint16[2*c+1]}}Yr(UP,"FillExtrusionCentroidArray");class vN extends Fv{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]}}vN.prototype.size=6;class zv extends $y{get(c){return new vN(this,c)}}Yr(zv,"FillExtrusionWallArray");const qP=Ts([{name:"a_pos",components:2,type:"Int16"}],4),cie=Ts([{name:"a_circle_z_offset",components:1,type:"Float32"}],4),VP=Ts([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]);class Oi{constructor(c=[]){this.segments=c}_prepareSegment(c,u,g,v){let k=this.segments[this.segments.length-1];return c>Oi.MAX_VERTEX_ARRAY_LENGTH&&Ur(`Max vertices per segment is ${Oi.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${c}`),(!k||k.vertexLength+c>Oi.MAX_VERTEX_ARRAY_LENGTH||k.sortKey!==v)&&(k={vertexOffset:u,primitiveOffset:g,vertexLength:0,primitiveLength:0},v!==void 0&&(k.sortKey=v),this.segments.push(k)),k}prepareSegment(c,u,g,v){return this._prepareSegment(c,u.length,g.length,v)}get(){return this.segments}destroy(){for(const c of this.segments)for(const u in c.vaos)c.vaos[u].destroy()}static simpleSegment(c,u,g,v){return new Oi([{vertexOffset:c,primitiveOffset:u,vertexLength:g,primitiveLength:v,vaos:{},sortKey:0}])}}function _N(f,c){return 256*(f=xe(Math.floor(f),0,255))+xe(Math.floor(c),0,255)}Oi.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,Yr(Oi,"SegmentVector");const die=Ts([{name:"a_pattern",components:4,type:"Uint16"},{name:"a_pixel_ratio",components:1,type:"Float32"}]),uie=Ts([{name:"a_pattern_b",components:4,type:"Uint16"}]),hie=Ts([{name:"a_dash",components:4,type:"Uint16"}]);class Bv{constructor(){this.ids=[],this.uniqueIds=[],this.positions=[],this.indexed=!1}add(c,u,g,v){this.ids.push(S5(c)),this.positions.push(u,g,v)}eachPosition(c,u){const g=S5(c);let v=0,k=this.ids.length-1;for(;v>1;this.ids[S]>=g?k=S:v=S+1}for(;this.ids[v]===g;)u(this.positions[3*v],this.positions[3*v+1],this.positions[3*v+2]),v++}static serialize(c,u){const g=new Float64Array(c.ids),v=new Uint32Array(c.positions);return C5(g,v,0,g.length-1),u&&(u.add(g.buffer),u.add(v.buffer)),{ids:g,positions:v}}static deserialize(c){const u=new Bv;let g;u.ids=c.ids,u.positions=c.positions;for(const v of u.ids)v!==g&&u.uniqueIds.push(v),g=v;return u.indexed=!0,u}}function S5(f){const c=+f;return Number.isSafeInteger(c)?c:Pr(String(f))}function C5(f,c,u,g){for(;u>1];let k=u-1,S=g+1;for(;;){do k++;while(f[k]v);if(k>=S)break;bN(f,k,S),bN(c,3*k,3*S),bN(c,3*k+1,3*S+1),bN(c,3*k+2,3*S+2)}S-u`u_${k}`),this.type=g,this.context=v}setUniform(c,u,g,v,k){const S=v.constantOr(this.value);u.set(c,k,S instanceof Sa?S.toPremultipliedRenderColor(this.lutExpression&&this.lutExpression.kind==="constant"&&this.lutExpression.value==="none"?null:this.context.lut):S)}getBinding(c,u){return this.type==="color"?new Uv(c):new qo(c)}}class Hy{constructor(c,u){this.uniformNames=u.map(g=>`u_${g}`),this.pattern=null,this.patternTransition=null,this.pixelRatio=1}setConstantPatternPositions(c,u){this.pixelRatio=c.pixelRatio||1,this.pattern=c.tl.concat(c.br),this.patternTransition=u?u.tl.concat(u.br):this.pattern}setUniform(c,u,g,v,k){let S=null;k!=="u_pattern"&&k!=="u_dash"||(S=this.pattern),k==="u_pattern_b"&&(S=this.patternTransition),k==="u_pixel_ratio"&&(S=this.pixelRatio),S&&u.set(c,k,S)}getBinding(c,u){return u==="u_pattern"||u==="u_pattern_b"||u==="u_dash"?new jN(c):new qo(c)}}class Np{constructor(c,u,g,v){this.expression=c,this.type=g,this.maxValue=0,this.paintVertexAttributes=u.map(k=>({name:`a_${k}`,type:"Float32",components:g==="color"?2:1,offset:0})),this.paintVertexArray=new v}populatePaintArray(c,u,g,v,k,S,P,R){const $=this.paintVertexArray.length,W=this.expression.kind==="composite"||this.expression.kind==="source"?this.expression.evaluate(new ti(0,{brightness:S,worldview:R}),u,{},k,v,P):this.expression.kind==="constant"&&this.expression.value,K=Vv(this.lutExpression,u,{},v,k,S,P,R);this.paintVertexArray.resize(c),this._setPaintValue($,c,W,K?null:this.context.lut)}updatePaintArray(c,u,g,v,k,S,P,R){const $=this.expression.kind==="composite"||this.expression.kind==="source"?this.expression.evaluate({zoom:0,brightness:P,worldview:R},g,v,void 0,k):this.expression.kind==="constant"&&this.expression.value,W=Vv(this.lutExpression,g,v,k,void 0,P,void 0,R);this._setPaintValue(c,u,$,W?null:this.context.lut)}_setPaintValue(c,u,g,v){if(this.type==="color"){const k=M5(g.toPremultipliedRenderColor(v));for(let S=c;S`u_${P}_t`),this.type=g,this.useIntegerZoom=v,this.context=k,this.maxValue=0,this.paintVertexAttributes=u.map(P=>({name:`a_${P}`,type:"Float32",components:g==="color"?4:2,offset:0})),this.paintVertexArray=new S}populatePaintArray(c,u,g,v,k,S,P,R){const $=this.expression.evaluate(new ti(this.context.zoom,{brightness:S,worldview:R}),u,{},k,v,P),W=this.expression.evaluate(new ti(this.context.zoom+1,{brightness:S,worldview:R}),u,{},k,v,P),K=Vv(this.lutExpression,u,{},v,k,S,P,R),X=this.paintVertexArray.length;this.paintVertexArray.resize(c),this._setPaintValue(X,c,$,W,K?null:this.context.lut)}updatePaintArray(c,u,g,v,k,S,P,R){const $=this.expression.evaluate({zoom:this.context.zoom,brightness:P,worldview:R},g,v,void 0,k),W=this.expression.evaluate({zoom:this.context.zoom+1,brightness:P,worldview:R},g,v,void 0,k),K=Vv(this.lutExpression,g,v,k,void 0,P,void 0,R);this._setPaintValue(c,u,$,W,K?null:this.context.lut)}_setPaintValue(c,u,g,v,k){if(this.type==="color"){const S=M5(g.toPremultipliedRenderColor(k)),P=M5(g.toPremultipliedRenderColor(k));for(let R=c;R!0){this.binders={},this._buffers=[],this.context=u;const v=[];for(const k in c.paint._values){const S=c.paint.get(k);if(k.endsWith("-use-theme")||!g(k)||!(S instanceof Jg&&Ev(S.property.specification)))continue;const P=gie(k,c.type),R=S.value,$=S.property.specification.type,W=!!S.property.useIntegerZoom,K=k==="line-dasharray"||k.endsWith("pattern"),X=c.paint.get(`${k}-use-theme`),re=k==="line-dasharray"&&c.layout.get("line-cap").value.kind!=="constant"||X&&X.value.kind!=="constant";if(R.kind!=="constant"||re)if(R.kind==="source"||re||K){const se=T5(k,$,"source");this.binders[k]=K?new Cp(R,P,$,se,c.id):new Np(R,P,$,se),v.push(`/a_${k}`)}else{const se=T5(k,$,"composite");this.binders[k]=new Sp(R,P,$,W,u,se),v.push(`/z_${k}`)}else this.binders[k]=K?new Hy(R.value,P):new Hv(R.value,P,$,u),v.push(`/u_${k}`);X&&(this.binders[k].lutExpression=X.value)}this.cacheKey=v.sort().join("")}getMaxValue(c){const u=this.binders[c];return u instanceof Np||u instanceof Sp?u.maxValue:0}populatePaintArrays(c,u,g,v,k,S,P,R){for(const $ in this.binders){const W=this.binders[$];W.context=this.context,(W instanceof Np||W instanceof Sp||W instanceof Cp)&&W.populatePaintArray(c,u,g,v,k,S,P,R)}}setConstantPatternPositions(c,u){for(const g in this.binders){const v=this.binders[g];v instanceof Hy&&v.setConstantPatternPositions(c,u)}}getPatternTransitionVertexBuffer(c){const u=this.binders[c];return u instanceof Cp?u.paintTransitionVertexBuffer:null}updatePaintArrays(c,u,g,v,k,S,P,R,$,W){let K=!1;const X=Object.keys(c),re=X.length!==0&&!R,se=re?X:u.uniqueIds;this.context.lut=k.lut;for(const fe in this.binders){const Se=this.binders[fe];if(Se.context=this.context,(Se instanceof Np||Se instanceof Sp||Se instanceof Cp)&&Se.expression&&Se.expression.kind&&Se.expression.kind!=="constant"&&(Se.expression.isStateDependent===!0||Se.expression.isLightConstant===!1)){const ke=k.paint.get(fe);Se.expression=ke.value;for(const Fe of se){const $e=c[Fe.toString()];u.eachPosition(Fe,(Ke,ht,ot)=>{const _t=v.feature(Ke);Se.updatePaintArray(ht,ot,_t,$e,S,P,$,W)})}if(!re)for(const Fe of g.uniqueIds){const $e=c[Fe.toString()];g.eachPosition(Fe,(Ke,ht,ot)=>{const _t=v.feature(Ke);Se.updatePaintArray(ht,ot,_t,$e,S,P,$,W)})}K=!0}}return K}defines(){const c=[];for(const u in this.binders){const g=this.binders[u];(g instanceof Hv||g instanceof Hy)&&c.push(...g.uniformNames.map(v=>`#define HAS_UNIFORM_${v}`))}return c}getPaintVertexBuffers(){return this._buffers}getUniforms(c){const u=[];for(const g in this.binders){const v=this.binders[g];if(v instanceof Hv||v instanceof Hy||v instanceof Sp)for(const k of v.uniformNames)u.push({name:k,property:g,binding:v.getBinding(c,k)})}return u}setUniforms(c,u,g,v,k){for(const{name:S,property:P,binding:R}of g)this.binders[P].setUniform(c,R,k,v.get(P),S)}updatePaintBuffers(){this._buffers=[];for(const c in this.binders){const u=this.binders[c];(u instanceof Np||u instanceof Sp||u instanceof Cp)&&u.paintVertexBuffer&&this._buffers.push(u.paintVertexBuffer),u instanceof Cp&&u.paintTransitionVertexBuffer&&this._buffers.push(u.paintTransitionVertexBuffer)}}upload(c){for(const u in this.binders){const g=this.binders[u];(g instanceof Np||g instanceof Sp||g instanceof Cp)&&g.upload(c)}this.updatePaintBuffers()}destroy(){for(const c in this.binders){const u=this.binders[c];(u instanceof Np||u instanceof Sp||u instanceof Cp)&&u.destroy()}}}class Oh{constructor(c,u,g=()=>!0){this.programConfigurations={};for(const v of c)this.programConfigurations[v.id]=new Vm(v,u,g);this.needsUpload=!1,this._featureMap=new Bv,this._featureMapWithoutIds=new Bv,this._bufferOffset=0,this._idlessCounter=0}populatePaintArrays(c,u,g,v,k,S,P,R,$){for(const W in this.programConfigurations)this.programConfigurations[W].populatePaintArrays(c,u,v,k,S,P,R,$);u.id!==void 0?this._featureMap.add(u.id,g,this._bufferOffset,c):(this._featureMapWithoutIds.add(this._idlessCounter,g,this._bufferOffset,c),this._idlessCounter+=1),this._bufferOffset=c,this.needsUpload=!0}updatePaintArrays(c,u,g,v,k,S,P,R){for(const $ of g)this.needsUpload=this.programConfigurations[$.id].updatePaintArrays(c,this._featureMap,this._featureMapWithoutIds,u,$,v,k,S,P||0,R)||this.needsUpload}get(c){return this.programConfigurations[c]}upload(c){if(this.needsUpload){for(const u in this.programConfigurations)this.programConfigurations[u].upload(c);this.needsUpload=!1}}destroy(){for(const c in this.programConfigurations)this.programConfigurations[c].destroy()}}const mie={"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-occlusion-opacity":["occlusion_opacity"],"icon-occlusion-opacity":["occlusion_opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-emissive-strength":["emissive_strength"],"icon-emissive-strength":["emissive_strength"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"symbol-z-offset":["z_offset"],"line-gap-width":["gapwidth"],"line-pattern":["pattern","pixel_ratio","pattern_b"],"fill-pattern":["pattern","pixel_ratio","pattern_b"],"fill-extrusion-pattern":["pattern","pixel_ratio","pattern_b"],"line-dasharray":["dash"],"fill-bridge-guard-rail-color":["structure_color"],"fill-tunnel-structure-color":["structure_color"]};function gie(f,c){return mie[f]||[f.replace(`${c}-`,"").replace(/-/g,"_")]}const xie={"line-pattern":{source:jd,composite:jd},"fill-pattern":{source:jd,composite:jd},"fill-extrusion-pattern":{source:jd,composite:jd},"line-dasharray":{source:sx,composite:sx}},yie={color:{source:kf,composite:Um},number:{source:jp,composite:kf}};function T5(f,c,u){const g=xie[f];return g&&g[u]||yie[c][u]}Yr(Hv,"ConstantBinder"),Yr(Hy,"PatternConstantBinder"),Yr(Np,"SourceExpressionBinder"),Yr(Cp,"PatternCompositeBinder"),Yr(Sp,"CompositeExpressionBinder"),Yr(Vm,"ProgramConfiguration",{omit:["_buffers"]}),Yr(Oh,"ProgramConfigurationSet");const vc=Sr/Math.PI/2,eh=5,SN=6,vie=16383,Wy=64,A5=[Wy,32,16],th=-vc,rh=vc;function ix(f,c,u,g=vc){return u=ss(u),[f*Math.sin(u)*g,-c*g,f*Math.cos(u)*g]}function Gy(f,c,u){return ix(Math.cos(ss(f)),Math.sin(ss(f)),c,u)}const _=63710088e-1,d=2*Math.PI*_;class m{constructor(c,u){if(isNaN(c)||isNaN(u))throw new Error(`Invalid LngLat object: (${c}, ${u})`);if(this.lng=+c,this.lat=+u,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new m(Ge(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(c){const u=Math.PI/180,g=this.lat*u,v=c.lat*u,k=Math.sin(g)*Math.sin(v)+Math.cos(g)*Math.cos(v)*Math.cos((c.lng-this.lng)*u);return _*Math.acos(Math.min(k,1))}toBounds(c=0){const u=360*c/40075017,g=u/Math.cos(Math.PI/180*this.lat);return new w({lng:this.lng-g,lat:this.lat-u},{lng:this.lng+g,lat:this.lat+u})}toEcef(c){return Gy(this.lat,this.lng,vc+c*vc/_)}static convert(c){if(c instanceof m)return c;if(Array.isArray(c)&&(c.length===2||c.length===3))return new m(Number(c[0]),Number(c[1]));if(!Array.isArray(c)&&typeof c=="object"&&c!==null)return new m(Number("lng"in c?c.lng:c.lon),Number(c.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: , lat: }, an object {lon: , lat: }, or an array of [, ]")}}class w{constructor(c,u){c&&(u?this.setSouthWest(c).setNorthEast(u):Array.isArray(c)&&c.length===4?this.setSouthWest([c[0],c[1]]).setNorthEast([c[2],c[3]]):this.setSouthWest(c[0]).setNorthEast(c[1]))}setNorthEast(c){return this._ne=c instanceof m?new m(c.lng,c.lat):m.convert(c),this}setSouthWest(c){return this._sw=c instanceof m?new m(c.lng,c.lat):m.convert(c),this}extend(c){const u=this._sw,g=this._ne;let v,k;if(c instanceof m)v=c,k=c;else{if(!(c instanceof w))return Array.isArray(c)?c.length===4||c.every(Array.isArray)?this.extend(w.convert(c)):this.extend(m.convert(c)):typeof c=="object"&&c!==null&&c.hasOwnProperty("lat")&&(c.hasOwnProperty("lon")||c.hasOwnProperty("lng"))?this.extend(m.convert(c)):this;if(v=c._sw,k=c._ne,!v||!k)return this}return u||g?(u.lng=Math.min(v.lng,u.lng),u.lat=Math.min(v.lat,u.lat),g.lng=Math.max(k.lng,g.lng),g.lat=Math.max(k.lat,g.lat)):(this._sw=new m(v.lng,v.lat),this._ne=new m(k.lng,k.lat)),this}getCenter(){return new m((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)}getSouthWest(){return this._sw}getNorthEast(){return this._ne}getNorthWest(){return new m(this.getWest(),this.getNorth())}getSouthEast(){return new m(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(c){const{lng:u,lat:g}=m.convert(c);let v=this._sw.lng<=u&&u<=this._ne.lng;return this._sw.lng>this._ne.lng&&(v=this._sw.lng>=u&&u>=this._ne.lng),this._sw.lat<=g&&g<=this._ne.lat&&v}static convert(c){if(c)return c instanceof w?c:new w(c)}}const M=0,O=25.5;function D(f){return d*Math.cos(f*Math.PI/180)}function B(f){return(180+f)/360}function V(f){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+f*Math.PI/360)))/360}function Y(f,c){return f/D(c)}function Q(f){return 360*f-180}function ce(f){return 360/Math.PI*Math.atan(Math.exp((180-360*f)*Math.PI/180))-90}function oe(f,c){return f*D(ce(c))}const de=85.051129;function we(f){return Math.cos(ss(xe(f,-de,de)))}function ve(f,c){const u=xe(c,M,O),g=Math.pow(2,u);return we(f)*d/(512*g)}function De(f){return 1/Math.cos(f*Math.PI/180)}function Pe(f,c=0){const u=Math.exp(Math.PI*(1-(f.y+c/Sr)/(1<=R?(Xe(f,c,u,$,W,k,K,P,R),Xe(f,$,W,g,v,K,S,P,R)):f.push(S)}function We(f,c,u){let g=f[0],v=g.x,k=g.y;c(g);const S=[g];for(let P=1;Pf.x+1||gf.y+1)&&Ur("Geometry exceeds allowed extent, reduce your vector tile buffer size"),f}function St(f,c,u){const g=f.loadGeometry(),v=f.extent,k=Sr/v;if(c&&u&&u.projection.isReprojectedInTileSpace){const S=1<{const re=Q((c.x+X.x/v)/S),se=ce((c.y+X.y/v)/S),fe=W.project(re,se);X.x=(fe.x*P-R)*v,X.y=(fe.y*P-$)*v};for(let X=0;X=v||se.y<0||se.y>=v||(K(se),re.push(se));g[X]=re}}for(const S of g)for(const P of S)it(P,k);return g}function Dt(f,c){return{type:f.type,id:f.id,properties:f.properties,geometry:c?St(f):[]}}class Lt{constructor(c,u,g,v,k){this.properties={},this.extent=g,this.type=0,this.id=void 0,this._pbf=c,this._geometry=-1,this._keys=v,this._values=k,c.readFields(Ht,this,u)}loadGeometry(){const c=this._pbf;c.pos=this._geometry;const u=c.readVarint()+c.pos,g=[];let v,k=1,S=0,P=0,R=0;for(;c.pos>3}if(S--,k===1||k===2)P+=c.readSVarint(),R+=c.readSVarint(),k===1&&(v&&g.push(v),v=[]),v&&v.push(new ir(P,R));else{if(k!==7)throw new Error(`unknown command ${k}`);v&&v.push(v[0].clone())}}return v&&g.push(v),g}bbox(){const c=this._pbf;c.pos=this._geometry;const u=c.readVarint()+c.pos;let g=1,v=0,k=0,S=0,P=1/0,R=-1/0,$=1/0,W=-1/0;for(;c.pos>3}if(v--,g===1||g===2)k+=c.readSVarint(),S+=c.readSVarint(),kR&&(R=k),S<$&&($=S),S>W&&(W=S);else if(g!==7)throw new Error(`unknown command ${g}`)}return[P,$,R,W]}toGeoJSON(c,u,g){const v=this.extent*Math.pow(2,g),k=this.extent*c,S=this.extent*u,P=this.loadGeometry();function R(X){return[360*(X.x+k)/v-180,360/Math.PI*Math.atan(Math.exp((1-2*(X.y+S)/v)*Math.PI))-90]}function $(X){return X.map(R)}let W;if(this.type===1){const X=[];for(const se of P)X.push(se[0]);const re=$(X);W=X.length===1?{type:"Point",coordinates:re[0]}:{type:"MultiPoint",coordinates:re}}else if(this.type===2){const X=P.map($);W=X.length===1?{type:"LineString",coordinates:X[0]}:{type:"MultiLineString",coordinates:X}}else{if(this.type!==3)throw new Error("unknown feature type");{const X=function(se){const fe=se.length;if(fe<=1)return[se];const Se=[];let ke,Fe;for(let $e=0;$e=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[c];const u=this._pbf.readVarint()+this._pbf.pos;return new Lt(this._pbf,u,this.extent,this._keys,this._values)}}function _r(f,c,u){f===15?c.version=u.readVarint():f===1?c.name=u.readString():f===5?c.extent=u.readVarint():f===2?c._features.push(u.pos):f===3?c._keys.push(u.readString()):f===4&&c._values.push(function(g){let v=null;const k=g.readVarint()+g.pos;for(;g.pos>3;v=S===1?g.readString():S===2?g.readFloat():S===3?g.readDouble():S===4?g.readVarint64():S===5?g.readVarint():S===6?g.readSVarint():S===7?g.readBoolean():null}if(v==null)throw new Error("unknown feature value");return v}(u))}class Bt{constructor(c,u){this.layers=c.readFields(Tt,{},u)}}function Tt(f,c,u){if(f===3){const g=new sr(u,u.readVarint()+u.pos);g.length&&(c[g.name]=g)}}const Jt="3d_elevation_id",qt="level";class dr{constructor(){this._valid=!1}reset(c){return this.feature=c,this._valid=!0,this._geometry=c.loadGeometry(),this._geometry.length!==0&&this._geometry[0].length!==0||(this._valid=!1),this}geometry(c,u){return this._valid&&c(u(this._geometry)),this}require(c,u,g){return this.get(c,!0,u,g)}optional(c,u,g){return this.get(c,!1,u,g)}success(){return this._valid}get(c,u,g,v){const k=this.feature.properties.hasOwnProperty(c)?+this.feature.properties[c]:void 0;return this._valid&&k!==void 0&&!Number.isNaN(k)?g(v?v(k):k):u&&(this._valid=!1),this}}class Tr{constructor(c,u){this.featureFunc=c,this.vertexFunc=u}parseFeature(c,u,g){return this.featureFunc(c,u,g)}parseVertex(c,u,g){return this.vertexFunc(c,u,g)}}const Hr=new Tr((f,c,u)=>f.reset(c).require(Jt,g=>{u.id=g}).optional("fixed_height_relative",g=>{u.constantHeight=g},br.decodeRelativeHeight).geometry(g=>{u.bounds=g},xp).success(),(f,c,u)=>f.reset(c).require(Jt,g=>{u.id=g}).require("elevation_idx",g=>{u.idx=g}).require("extent",g=>{u.extent=g}).require("height_relative",g=>{u.height=g},br.decodeRelativeHeight).geometry(g=>{u.position=g},br.getPoint).success()),Nr=new Tr((f,c,u)=>f.reset(c).require(Jt,g=>{u.id=g}).optional("fixed_height",g=>{u.constantHeight=g},br.decodeMetricHeight).geometry(g=>{u.bounds=g},xp).success(),(f,c,u)=>f.reset(c).require(Jt,g=>{u.id=g}).require("elevation_idx",g=>{u.idx=g}).require("extent",g=>{u.extent=g}).require("height",g=>{u.height=g},br.decodeMetricHeight).geometry(g=>{u.position=g},br.getPoint).success());class br{static getPoint(c){return hr(c[0][0].x,c[0][0].y)}static decodeRelativeHeight(c){return 1e-4*c*5}static decodeMetricHeight(c){return 1e-4*c}static getVersionSchema(c){return c?c==="1.0.1"?Nr:void 0:Hr}static parse(c){const u=[],g=[],v=c.length,k=new dr;for(let S=0;S=0);if(k===0)return 0;k!==c.length&&(u=!1)}return u?2:1}function Yn(f,c){for(const u of f.projections){const g=Gr(c,f.points[0],u.axis);if(u.projection[1]g[1])return 0}return 1}function Os(f,c){let u=0;const g=[0,0,0,0];for(let S=0;S=0&&u++;var v,k;return u}class ha{constructor(c,u){this.points=c||new Array(8).fill([0,0,0]),this.planes=u||new Array(6).fill([0,0,0,0]),this.bounds=on.fromPoints(this.points),this.projections=[],this.frustumEdges=[Me([],this.points[2],this.points[3]),Me([],this.points[0],this.points[3]),Me([],this.points[4],this.points[0]),Me([],this.points[5],this.points[1]),Me([],this.points[6],this.points[2]),Me([],this.points[7],this.points[3])];for(const g of this.frustumEdges){const v=[0,-g[2],g[1]],k=[g[2],0,-g[0]];this.projections.push({axis:v,projection:Gr(this.points,this.points[0],v)}),this.projections.push({axis:k,projection:Gr(this.points,this.points[0],k)})}}static fromInvProjectionMatrix(c,u,g,v){const k=Math.pow(2,g),S=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map($=>{const W=gt([],$,c),K=1/W[3]/u*k;return(X=W)[0]=(re=W)[0]*(se=[K,K,v?1/W[3]:K,K])[0],X[1]=re[1]*se[1],X[2]=re[2]*se[2],X[3]=re[3]*se[3],X;var X,re,se}),P=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map($=>{const W=Re([],et([],Me([],S[$[0]],S[$[1]]),Me([],S[$[2]],S[$[1]]))),K=-je(W,S[$[1]]);return W.concat(K)}),R=[];for(let $=0;$$[1]||$[0]>R[1])return 0}return 1}containsPoint(c){for(const u of this.planes){const g=u[3];if(je([u[0],u[1],u[2]],c)+g<0)return!1}return!0}}class on{static fromPoints(c){const u=[1/0,1/0,1/0],g=[-1/0,-1/0,-1/0];for(const v of c)Ce(u,u,v),be(g,g,v);return new on(u,g)}static fromTileIdAndHeight(c,u,g){const v=1<c.max[u]||c.min[u]>this.max[u])return!1;return!0}intersectsAabbXY(c){return!(this.min[0]>c.max[0]||c.min[0]>this.max[0]||this.min[1]>c.max[1]||c.min[1]>this.max[1])}encapsulate(c){for(let u=0;u<3;u++)this.min[u]=Math.min(this.min[u],c.min[u]),this.max[u]=Math.max(this.max[u],c.max[u])}encapsulatePoint(c){for(let u=0;u<3;u++)this.min[u]=Math.min(this.min[u],c[u]),this.max[u]=Math.max(this.max[u],c[u])}closestPoint(c){return[Math.max(Math.min(this.max[0],c[0]),this.min[0]),Math.max(Math.min(this.max[1],c[1]),this.min[1]),Math.max(Math.min(this.max[2],c[2]),this.min[2])]}}Yr(on,"Aabb");class ia{constructor(c,u){this.feature=c,this.metersToTile=u,this.index=0}get(){const c=this.feature.vertices[this.index],u=this.feature.vertexProps[this.index].dir,g=u[1],v=-u[0],k=(c.extent+1)*this.metersToTile;return[new ir(Math.trunc(c.position[0]+g*k),Math.trunc(c.position[1]+v*k)),new ir(Math.trunc(c.position[0]-g*k),Math.trunc(c.position[1]-v*k))]}next(){this.index++}valid(){return this.index{return P.a0?me(R,R,1/$):he(R,0,0,1)}getSafeArea(){return this.safeArea}isTunnel(){return this.heightRange.max<=-5}getClosestEdge(c){if(this.edges.length===0)return;let u=0,g=Number.POSITIVE_INFINITY,v=0;const[k,S,P,R,$,W,K]=this._tmpVec2;xs(K,c.x,c.y);const X=new nn(K,null);for(let re=0;re0?xo(R,P)/Ke:0,ot=xe(ht,0,1),_t=Math.abs((ht-ot)*this.edgeProps[re].len);xa($,K,Se),xs(W,fe[1],-fe[0]);const Ct=_t+Math.abs(xo($,W));Ct=0;--S){const P=this.edges[S].a,R=this.edges[S].b,{position:$,height:W,extent:K}=this.vertices[P],{position:X,height:re,extent:se}=this.vertices[R],fe=this.vertexProps[P].dir,Se=this.vertexProps[R].dir;if(he(u,$[0]/c,$[1]/c,W),he(g,X[0]/c,X[1]/c,re),he(v,fe[1],-fe[0],0),me(v,v,K),he(k,Se[1],-Se[0],0),me(k,k,se),this.distSqLines(ae(u[0]+.5*v[0],u[1]+.5*v[1],u[2]+.5*v[2]),ae(g[0]-.5*k[0],g[1]-.5*k[1],g[2]-.5*k[2]),ae(u[0]-.5*v[0],u[1]-.5*v[1],u[2]-.5*v[2]),ae(g[0]+.5*k[0],g[1]+.5*k[1],g[2]+.5*k[2]))<=.0025000000000000005)continue;const ke=this.vertices.length,Fe=ka(js(),$,X);this.vertices.push({position:zi(Fe,Fe,.5),height:.5*(W+re),extent:.5*(K+se)});const $e=ka(js(),fe,Se);this.vertexProps.push({dir:tl($e,$e)}),this.edges.splice(S,1),this.edgeProps.splice(S,1),this.edges.push({a:P,b:ke}),this.edges.push({a:ke,b:R});const Ke=xa(js(),this.vertices[ke].position,$),ht=Bi(Ke),ot={vec:Ke,dir:zi(js(),Ke,1/ht),len:ht};this.edgeProps.push(ot),this.edgeProps.push(ot)}}distSqLines(c,u,g,v){const k=_e(ye(),u,c),S=_e(ye(),v,g),P=_e(ye(),c,g),R=je(k,k),$=je(k,S),W=je(k,P),K=je(S,S),X=je(S,P),re=R*K-$*$;if(re===0)return Be(Te(k,g,v,je(P,S)/je(S,S)),c);const se=(R*X-$*W)/re;return Be(Te(k,c,u,($*X-W*K)/re),Te(S,g,v,se))}}class ya{static parseFrom(c,u){const g=br.parse(c);if(!g)return[];let{vertices:v,features:k}=g;const S=1/Pe(u);k.sort((W,K)=>W.id-K.id),v.sort((W,K)=>W.id-K.id||W.idx-K.idx),v=v.filter((W,K,X)=>K===X.findIndex(re=>re.id===W.id&&re.idx===W.idx));const P=new Array;let R=0;const $=v.length;for(const W of k){if(W.constantHeight){P.push(new Wn(W.id,W.bounds,W.constantHeight));continue}for(;R!==$&&v[R].idv.id===g)}}class Ra{constructor(c,u){this.zScale=1,this.xOffset=0,this.yOffset=0,c.equals(u)||(this.zScale=Math.pow(2,u.z-c.z),this.xOffset=(c.x*this.zScale-u.x)*Sr,this.yOffset=(c.y*this.zScale-u.y)*Sr)}constantElevation(c,u){if(c.constantHeight!=null)return this.computeBiasedHeight(c.constantHeight,u)}pointElevation(c,u,g){const v=this.constantElevation(u,g);return v??(c.x=c.x*this.zScale+this.xOffset,c.y=c.y*this.zScale+this.yOffset,this.computeBiasedHeight(u.pointElevation(c),g))}computeBiasedHeight(c,u){return u<=0?c:c+u*Ie(0,u,c>=0?c:Math.abs(.5*c))}}Yr(Wn,"ElevationFeature");class Ca{constructor(c){this.zoom=c.zoom,this.overscaling=c.overscaling,this.layers=c.layers,this.layerIds=this.layers.map(u=>u.fqid),this.index=c.index,this.hasPattern=!1,this.projection=c.projection,this.layoutVertexArray=new $m,this.indexArray=new Uo,this.segments=new Oi,this.programConfigurations=new Oh(c.layers,{zoom:c.zoom,lut:c.lut}),this.stateDependentLayerIds=this.layers.filter(u=>u.isStateDependent()).map(u=>u.id),this.elevationMode=this.layers[0].layout.get("circle-elevation-reference"),this.hasElevation=!1,this.elevationMode!=="none"&&(this.elevatedLayoutVertexArray=new jp),this.worldview=c.worldview,this.hasAppearances=null}updateFootprints(c,u){}updateAppearances(c,u,g,v){}populate(c,u,g,v){const k=this.layers[0],S=[];let P=null;k.type==="circle"&&(P=k.layout.get("circle-sort-key"));for(const{feature:$,id:W,index:K,sourceLayerIndex:X}of c){const re=this.layers[0]._featureFilter.needGeometry,se=Dt($,re);if(!this.layers[0]._featureFilter.filter(new ti(this.zoom,{worldview:this.worldview,activeFloors:u.activeFloors}),se,g))continue;const fe=P?P.evaluate(se,{},g):void 0,Se={id:W,properties:$.properties,type:$.type,sourceLayerIndex:X,index:K,geometry:re?se.geometry:St($,g,v),patterns:{},sortKey:fe};S.push(Se)}P&&S.sort(($,W)=>$.sortKey-W.sortKey);let R=null;v.projection.name==="globe"&&(this.globeExtVertexArray=new cN,R=v.projection);for(const $ of S){const{geometry:W,index:K,sourceLayerIndex:X}=$,re=c[K].feature;this.addFeature($,W,K,u.availableImages,g,R,u.brightness,u.elevationFeatures),u.featureIndex.insert(re,W,K,X,this.index)}this.hasElevation||(this.elevatedLayoutVertexArray=void 0)}update(c,u,g,v,k,S,P){this.programConfigurations.updatePaintArrays(c,u,k,g,v,S,P,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,qP.members),this.indexBuffer=c.createIndexBuffer(this.indexArray),this.globeExtVertexArray&&(this.globeExtVertexBuffer=c.createVertexBuffer(this.globeExtVertexArray,VP.members)),this.elevatedLayoutVertexArray&&(this.elevatedLayoutVertexBuffer=c.createVertexBuffer(this.elevatedLayoutVertexArray,cie.members))),this.programConfigurations.upload(c),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.globeExtVertexBuffer&&this.globeExtVertexBuffer.destroy(),this.elevatedLayoutVertexBuffer&&this.elevatedLayoutVertexBuffer.destroy())}addFeature(c,u,g,v,k,S,P,R){let $;this.elevationMode!=="none"&&($=ya.getElevationFeature(c,R));for(const W of u)for(const K of W){const X=K.x,re=K.y;if(X<0||X>=Sr||re<0||re>=Sr)continue;if(S){const Se=S.projectTilePoint(X,re,k),ke=S.upVector(k,X,re);this.addGlobeExtVertex(Se,ke),this.addGlobeExtVertex(Se,ke),this.addGlobeExtVertex(Se,ke),this.addGlobeExtVertex(Se,ke)}const se=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,c.sortKey),fe=se.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 Se=$?$.pointElevation(new ir(X,re)):0;this.hasElevation=this.hasElevation||Se!==0;for(let ke=0;ke<4;ke++)this.elevatedLayoutVertexArray.emplaceBack(Se)}this.indexArray.emplaceBack(fe,fe+1,fe+2),this.indexArray.emplaceBack(fe,fe+2,fe+3),se.vertexLength+=4,se.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,c,g,{},v,k,P,void 0,this.worldview)}addCircleVertex(c,u,g,v){this.layoutVertexArray.emplaceBack(2*c+(g+1)/2,2*u+(v+1)/2)}addGlobeExtVertex(c,u){this.globeExtVertexArray.emplaceBack(c.x,c.y,c.z,u[0]*16384,u[1]*16384,u[2]*16384)}}function sa(f,c){for(let u=0;u1){if(gi(f,c))return!0;for(let g=0;g1?u:u.sub(c)._mult(v)._add(c))}function Di(f,c){let u,g,v,k=!1;for(let S=0;Sc.y!=v.y>c.y&&c.x<(v.x-g.x)*(c.y-g.y)/(v.y-g.y)+g.x&&(k=!k)}return k}function Ha(f,c){let u=!1;for(let g=0,v=f.length-1;gc.y!=S.y>c.y&&c.x<(S.x-k.x)*(c.y-k.y)/(S.y-k.y)+k.x&&(u=!u)}return u}function nd(f,c,u,g,v){for(const S of f)if(c<=S.x&&u<=S.y&&g>=S.x&&v>=S.y)return!0;const k=[new ir(c,u),new ir(c,v),new ir(g,v),new ir(g,u)];if(f.length>2){for(const S of k)if(Ha(f,S))return!0}for(let S=0;Sv.x&&c.x>v.x||f.yv.y&&c.y>v.y)return!1;const k=Jn(f,c,u[0]);return k!==Jn(f,c,u[1])||k!==Jn(f,c,u[2])||k!==Jn(f,c,u[3])}function Vo(f,c,u,g,v,k){let S=c.y-f.y,P=f.x-c.x;if(k=k||0){const R=S*S+P*P;if(R===0)return!0;const $=Math.sqrt(R);S/=$,P/=$}return!((u.x-f.x)*S+(u.y-f.y)*P-k<0||(g.x-f.x)*S+(g.y-f.y)*P-k<0||(v.x-f.x)*S+(v.y-f.y)*P-k<0)}function _c(f,c,u,g,v,k,S){return!(Vo(f,c,g,v,k,S)||Vo(c,u,g,v,k,S)||Vo(u,f,g,v,k,S)||Vo(g,v,f,c,u,S)||Vo(v,k,f,c,u,S)||Vo(k,g,f,c,u,S))}function bc(f,c,u){const g=c.paint.get(f).value;return g.kind==="constant"?g.value:u.programConfigurations.get(c.id).getMaxValue(f)}function Ul(f){return Math.sqrt(f[0]*f[0]+f[1]*f[1])}function bu(f,c,u,g,v){if(!c[0]&&!c[1])return f;const k=ir.convert(c)._mult(v);u==="viewport"&&k._rotate(-g);const S=[];for(let P=0;P>u&&c.y===this.y>>u}url(c,u){const g=function(k,S,P){var R=io(256*k,256*(S=Math.pow(2,P)-S-1),P),$=io(256*(k+1),256*(S+1),P);return R[0]+","+R[1]+","+$[0]+","+$[1]}(this.x,this.y,this.z),v=function(k,S,P){let R,$="";for(let W=k;W>0;W--)R=1<this.canonical.z?new Ui(c,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Ui(c,this.wrap,c,this.canonical.x>>u,this.canonical.y>>u)}calculateScaledKey(c,u=!0){if(this.overscaledZ===c&&u)return this.key;if(c>this.canonical.z)return Ri(this.wrap*+u,c,this.canonical.z,this.canonical.x,this.canonical.y);{const g=this.canonical.z-c;return Ri(this.wrap*+u,c,c,this.canonical.x>>g,this.canonical.y>>g)}}isChildOf(c){if(c.wrap!==this.wrap)return!1;const u=this.canonical.z-c.canonical.z;return c.overscaledZ===0||c.overscaledZ>u&&c.canonical.y===this.canonical.y>>u}children(c){if(this.overscaledZ>=c)return[new Ui(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const u=this.canonical.z+1,g=2*this.canonical.x,v=2*this.canonical.y;return[new Ui(u,this.wrap,u,g,v),new Ui(u,this.wrap,u,g+1,v),new Ui(u,this.wrap,u,g,v+1),new Ui(u,this.wrap,u,g+1,v+1)]}isLessThan(c){return this.wrapc.wrap)&&(this.overscaledZc.overscaledZ)&&(this.canonical.xc.canonical.x)&&this.canonical.y{let c=f.canonical.x-1,u=f.wrap;return c<0&&(c=(1<{let c=f.canonical.x+1,u=f.wrap;return c===1<new Ui(f.overscaledZ,f.wrap,f.canonical.z,f.canonical.x,(f.canonical.y===0?1<new Ui(f.overscaledZ,f.wrap,f.canonical.z,f.canonical.x,f.canonical.y===(1<1?null:function(g,v,k,S){const P=Math.sin(k);return g*(Math.sin((1-S)*k)/P)+v*(Math.sin(S*k)/P)}(f.a[c],f.b[c],f.angle,xe(u,0,1))+f.center[c]}function Rh(f){if(f.z<=1)return Mp[f.z+2*f.y+f.x];const c=_ie(HP(f));return on.fromPoints(c)}function Ap(f,c,u){return me(f,f,1-u),Le(f,f,c,u)}function I0e(f,c,u){for(const g of f)Ze(g,g,c),me(g,g,u)}function P0e(f,c,u,g){const v=c/f.worldSize,k=f.globeMatrix;if(u.z<=1){const Et=Rh(u).getCorners();return I0e(Et,k,v),on.fromPoints(Et)}const S=HP(u,g),P=_ie(S,vc+Sf(f._tileCoverLift));I0e(P,k,v);const R=Number.MAX_VALUE,$=[-R,-R,-R],W=[R,R,R];if(S.contains(f.center)){for(const Rt of P)Ce(W,W,Rt),be($,$,Rt);$[2]=0;const Et=f.point,Kt=[Et.x*v,Et.y*v,0];return Ce(W,W,Kt),be($,$,Kt),new on(W,$)}if(f._tileCoverLift>0){for(const Et of P)Ce(W,W,Et),be($,$,Et);return new on(W,$)}const K=[k[12]*v,k[13]*v,k[14]*v],X=S.getCenter(),re=xe(f.center.lat,-de,de),se=xe(X.lat,-de,de),fe=B(f.center.lng),Se=V(re);let ke=fe-B(X.lng);const Fe=Se-V(se);ke>.5?ke-=1:ke<-.5&&(ke+=1);let $e=0;Math.abs(ke)>Math.abs(Fe)?$e=ke>=0?1:3:($e=Fe>=0?0:2,Le(K,K,[k[4]*v,k[5]*v,k[6]*v],-Math.sin(ss(Fe>=0?S.getSouth():S.getNorth()))*vc));const Ke=P[$e],ht=P[($e+1)%4],ot=new Hm(Ke,ht,K),_t=[Tp(ot,0)||Ke[0],Tp(ot,1)||Ke[1],Tp(ot,2)||Ke[2]],Ct=Yy(f.zoom);if(Ct>0){const Et=function({x:Rt,y:rr,z:or},lr,xr,vr,ur){const pr=1/(1<.5?wr=-1:un<-.5&&(wr=1),tr=((tr+wr)*lr-(vr*=lr))*xr+vr,Xt=((Xt+wr)*lr-vr)*xr+vr,mr=(mr*lr-(ur*=lr))*xr+ur,Mr=(Mr*lr-ur)*xr+ur,[[tr,Mr,0],[Xt,Mr,0],[Xt,mr,0],[tr,mr,0]]}(u,c,f._pixelsPerMercatorPixel,fe,Se);for(let Rt=0;RtMath.PI/2*1.01}const F0e=ss(85),Z$e=Math.cos(F0e),Y$e=Math.sin(F0e),X$e=C(),z0e=f=>{const c=[];return f.paint.get("circle-pitch-alignment")==="map"&&c.push("PITCH_WITH_MAP"),f.paint.get("circle-pitch-scale")==="map"&&c.push("SCALE_WITH_MAP"),c};function B0e(f,c,u,g,v,k,S,P,R){if(k&&f.queryGeometry.isAboveHorizon)return!1;k&&(R*=f.pixelToTileUnitsFactor);const $=f.tileID.canonical,W=u.projection.upVectorScale($,u.center.lat,u.worldSize).metersToTile;for(const K of c)for(const X of K){const re=X.add(P),se=v&&u.elevation?u.elevation.exaggeration()*v.getElevationAt(re.x,re.y,!0):0,fe=u.projection.projectTilePoint(re.x,re.y,$);if(se>0){const $e=u.projection.upVector($,re.x,re.y);fe.x+=$e[0]*W*se,fe.y+=$e[1]*W*se,fe.z+=$e[2]*W*se}const Se=k?re:Q$e(fe.x,fe.y,fe.z,g),ke=k?f.tilespaceRays.map($e=>eUe($e,se)):f.queryGeometry.screenGeometry,Fe=gt([],[fe.x,fe.y,fe.z,1],g);if(!S&&k?R*=Fe[3]/u.cameraToCenterDistance:S&&!k&&(R*=u.cameraToCenterDistance/Fe[3]),k){const $e=ce((X.y/Sr+$.y)/(1<<$.z));R/=u.projection.pixelsPerMeter($e,1)/Y(1,$e)}if(is(ke,Se,R))return!0}return!1}function Q$e(f,c,u,g){const v=gt([],[f,c,u,1],g);return new ir(v[0]/v[3],v[1]/v[3])}const $0e=ae(0,0,0),J$e=ae(0,0,1);function eUe(f,c){const u=ye();return $0e[2]=c,f.intersectsPlane($0e,J$e,u),new ir(u[0],u[1])}class U0e extends Ca{}let q0e,V0e,H0e,W0e;function G0e(f,{width:c,height:u},g,v){if(v){if(v instanceof Uint8ClampedArray)v=new Uint8Array(v.buffer);else if(v.length!==c*u*g)throw new RangeError("mismatched image size")}else v=new Uint8Array(c*u*g);return f.width=c,f.height=u,f.data=v,f}function K0e(f,c,u){const{width:g,height:v}=c;g===f.width&&v===f.height||(kie(f,c,{x:0,y:0},{x:0,y:0},{width:Math.min(f.width,g),height:Math.min(f.height,v)},u,null),f.width=g,f.height=v,f.data=c.data)}function kie(f,c,u,g,v,k,S,P){if(v.width===0||v.height===0)return c;if(v.width>f.width||v.height>f.height||u.x>f.width-v.width||u.y>f.height-v.height)throw new RangeError("out of range source coordinates for image copy");if(v.width>c.width||v.height>c.height||g.x>c.width-v.width||g.y>c.height-v.height)throw new RangeError("out of range destination coordinates for image copy");const R=f.data,$=c.data,W=k===4&&P;for(let K=0;K{c[f.evaluationKey]=R;const $=f.expression.evaluate(c),W=$?$.toNonPremultipliedRenderColor(null):null;W&&(v.data[S+P+0]=Math.floor(255*W.r),v.data[S+P+1]=Math.floor(255*W.g),v.data[S+P+2]=Math.floor(255*W.b),v.data[S+P+3]=Math.floor(255*W.a))};if(f.clips)for(let S=0,P=0;S80*u){P=f[0],R=f[1];let W=P,K=R;for(let X=u;XW&&(W=re),se>K&&(K=se)}$=Math.max(W-P,K-R),$=$!==0?32767/$:0}return P5(k,S,u,P,R,$,0),S}function Y0e(f,c,u,g,v){let k;if(v===function(S,P,R,$){let W=0;for(let K=P,X=R-$;K0)for(let S=c;S=c;S-=g)k=e1e(S/g|0,f[S],f[S+1],k);return k&&MN(k,k.next)&&(D5(k),k=k.next),k}function Kv(f,c){if(!f)return f;c||(c=f);let u,g=f;do if(u=!1,g.steiner||!MN(g,g.next)&&Ml(g.prev,g,g.next)!==0)g=g.next;else{if(D5(g),g=c=g.prev,g===g.next)break;u=!0}while(u||g!==c);return c}function P5(f,c,u,g,v,k,S){if(!f)return;!S&&k&&function(R,$,W,K){let X=R;do X.z===0&&(X.z=Nie(X.x,X.y,$,W,K)),X.prevZ=X.prev,X.nextZ=X.next,X=X.next;while(X!==R);X.prevZ.nextZ=null,X.prevZ=null,function(re){let se,fe=1;do{let Se,ke=re;re=null;let Fe=null;for(se=0;ke;){se++;let $e=ke,Ke=0;for(let ot=0;ot0||ht>0&&$e;)Ke!==0&&(ht===0||!$e||ke.z<=$e.z)?(Se=ke,ke=ke.nextZ,Ke--):(Se=$e,$e=$e.nextZ,ht--),Fe?Fe.nextZ=Se:re=Se,Se.prevZ=Fe,Fe=Se;ke=$e}Fe.nextZ=null,fe*=2}while(se>1)}(X)}(f,g,v,k);let P=f;for(;f.prev!==f.next;){const R=f.prev,$=f.next;if(k?iUe(f,g,v,k):aUe(f))c.push(R.i,f.i,$.i),D5(f),f=$.next,P=$.next;else if((f=$)===P){S?S===1?P5(f=oUe(Kv(f),c),c,u,g,v,k,2):S===2&&lUe(f,c,u,g,v,k):P5(Kv(f),c,u,g,v,k,1);break}}}function aUe(f){const c=f.prev,u=f,g=f.next;if(Ml(c,u,g)>=0)return!1;const v=c.x,k=u.x,S=g.x,P=c.y,R=u.y,$=g.y,W=Math.min(v,k,S),K=Math.min(P,R,$),X=Math.max(v,k,S),re=Math.max(P,R,$);let se=g.next;for(;se!==c;){if(se.x>=W&&se.x<=X&&se.y>=K&&se.y<=re&&L5(v,P,k,R,S,$,se.x,se.y)&&Ml(se.prev,se,se.next)>=0)return!1;se=se.next}return!0}function iUe(f,c,u,g){const v=f.prev,k=f,S=f.next;if(Ml(v,k,S)>=0)return!1;const P=v.x,R=k.x,$=S.x,W=v.y,K=k.y,X=S.y,re=Math.min(P,R,$),se=Math.min(W,K,X),fe=Math.max(P,R,$),Se=Math.max(W,K,X),ke=Nie(re,se,c,u,g),Fe=Nie(fe,Se,c,u,g);let $e=f.prevZ,Ke=f.nextZ;for(;$e&&$e.z>=ke&&Ke&&Ke.z<=Fe;){if($e.x>=re&&$e.x<=fe&&$e.y>=se&&$e.y<=Se&&$e!==v&&$e!==S&&L5(P,W,R,K,$,X,$e.x,$e.y)&&Ml($e.prev,$e,$e.next)>=0||($e=$e.prevZ,Ke.x>=re&&Ke.x<=fe&&Ke.y>=se&&Ke.y<=Se&&Ke!==v&&Ke!==S&&L5(P,W,R,K,$,X,Ke.x,Ke.y)&&Ml(Ke.prev,Ke,Ke.next)>=0))return!1;Ke=Ke.nextZ}for(;$e&&$e.z>=ke;){if($e.x>=re&&$e.x<=fe&&$e.y>=se&&$e.y<=Se&&$e!==v&&$e!==S&&L5(P,W,R,K,$,X,$e.x,$e.y)&&Ml($e.prev,$e,$e.next)>=0)return!1;$e=$e.prevZ}for(;Ke&&Ke.z<=Fe;){if(Ke.x>=re&&Ke.x<=fe&&Ke.y>=se&&Ke.y<=Se&&Ke!==v&&Ke!==S&&L5(P,W,R,K,$,X,Ke.x,Ke.y)&&Ml(Ke.prev,Ke,Ke.next)>=0)return!1;Ke=Ke.nextZ}return!0}function oUe(f,c){let u=f;do{const g=u.prev,v=u.next.next;!MN(g,v)&&Q0e(g,u,u.next,v)&&O5(g,v)&&O5(v,g)&&(c.push(g.i,u.i,v.i),D5(u),D5(u.next),u=f=v),u=u.next}while(u!==f);return Kv(u)}function lUe(f,c,u,g,v,k){let S=f;do{let P=S.next.next;for(;P!==S.prev;){if(S.i!==P.i&&fUe(S,P)){let R=J0e(S,P);return S=Kv(S,S.next),R=Kv(R,R.next),P5(S,c,u,g,v,k,0),void P5(R,c,u,g,v,k,0)}P=P.next}S=S.next}while(S!==f)}function cUe(f,c){let u=f.x-c.x;return u===0&&(u=f.y-c.y,u===0)&&(u=(f.next.y-f.y)/(f.next.x-f.x)-(c.next.y-c.y)/(c.next.x-c.x)),u}function dUe(f,c){const u=function(v,k){let S=k;const P=v.x,R=v.y;let $,W=-1/0;if(MN(v,S))return S;do{if(MN(v,S.next))return S.next;if(R<=S.y&&R>=S.next.y&&S.next.y!==S.y){const fe=S.x+(R-S.y)*(S.next.x-S.x)/(S.next.y-S.y);if(fe<=P&&fe>W&&(W=fe,$=S.x=S.x&&S.x>=X&&P!==S.x&&X0e(R$.x||S.x===$.x&&uUe($,S)))&&($=S,se=fe)}S=S.next}while(S!==K);return $}(f,c);if(!u)return c;const g=J0e(u,f);return Kv(g,g.next),Kv(u,u.next)}function uUe(f,c){return Ml(f.prev,f,c.prev)<0&&Ml(c.next,f,f.next)<0}function Nie(f,c,u,g,v){return(f=1431655765&((f=858993459&((f=252645135&((f=16711935&((f=(f-u)*v|0)|f<<8))|f<<4))|f<<2))|f<<1))|(c=1431655765&((c=858993459&((c=252645135&((c=16711935&((c=(c-g)*v|0)|c<<8))|c<<4))|c<<2))|c<<1))<<1}function hUe(f){let c=f,u=f;do(c.x=(f-S)*(k-P)&&(f-S)*(g-P)>=(u-S)*(c-P)&&(u-S)*(k-P)>=(v-S)*(g-P)}function L5(f,c,u,g,v,k,S,P){return!(f===S&&c===P)&&X0e(f,c,u,g,v,k,S,P)}function fUe(f,c){return f.next.i!==c.i&&f.prev.i!==c.i&&!function(u,g){let v=u;do{if(v.i!==u.i&&v.next.i!==u.i&&v.i!==g.i&&v.next.i!==g.i&&Q0e(v,v.next,u,g))return!0;v=v.next}while(v!==u);return!1}(f,c)&&(O5(f,c)&&O5(c,f)&&function(u,g){let v=u,k=!1;const S=(u.x+g.x)/2,P=(u.y+g.y)/2;do v.y>P!=v.next.y>P&&v.next.y!==v.y&&S<(v.next.x-v.x)*(P-v.y)/(v.next.y-v.y)+v.x&&(k=!k),v=v.next;while(v!==u);return k}(f,c)&&(Ml(f.prev,f,c.prev)||Ml(f,c.prev,c))||MN(f,c)&&Ml(f.prev,f,f.next)>0&&Ml(c.prev,c,c.next)>0)}function Ml(f,c,u){return(c.y-f.y)*(u.x-c.x)-(c.x-f.x)*(u.y-c.y)}function MN(f,c){return f.x===c.x&&f.y===c.y}function Q0e(f,c,u,g){const v=ZP(Ml(f,c,u)),k=ZP(Ml(f,c,g)),S=ZP(Ml(u,g,f)),P=ZP(Ml(u,g,c));return v!==k&&S!==P||!(v!==0||!KP(f,u,c))||!(k!==0||!KP(f,g,c))||!(S!==0||!KP(u,f,g))||!(P!==0||!KP(u,c,g))}function KP(f,c,u){return c.x<=Math.max(f.x,u.x)&&c.x>=Math.min(f.x,u.x)&&c.y<=Math.max(f.y,u.y)&&c.y>=Math.min(f.y,u.y)}function ZP(f){return f>0?1:f<0?-1:0}function O5(f,c){return Ml(f.prev,f,f.next)<0?Ml(f,c,f.next)>=0&&Ml(f,f.prev,c)>=0:Ml(f,c,f.prev)<0||Ml(f,f.next,c)<0}function J0e(f,c){const u=Sie(f.i,f.x,f.y),g=Sie(c.i,c.x,c.y),v=f.next,k=c.prev;return f.next=c,c.prev=f,u.next=v,v.prev=u,g.next=u,u.prev=g,k.next=g,g.prev=k,g}function e1e(f,c,u,g){const v=Sie(f,c,u);return g?(v.next=g.next,v.prev=g,g.next.prev=v,g.next=v):(v.prev=v,v.next=v),v}function D5(f){f.next.prev=f.prev,f.prev.next=f.next,f.prevZ&&(f.prevZ.nextZ=f.nextZ),f.nextZ&&(f.nextZ.prevZ=f.prevZ)}function Sie(f,c,u){return{i:f,x:c,y:u,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function R5(f,c){const u=f.length;if(u<=1)return[f];const g=[];let v,k;for(let S=0;S1)for(let S=0;S=Sr&&u>=Sr}static evaluate(c){if(c.length===0)return new ox;let u=[];for(const R of c)u.push(...R.portals);if(u.length===0)return new ox;for(const R of u){const $=R.va,W=R.vb;(ox.isOnBorder($.x,W.x)||ox.isOnBorder($.y,W.y))&&(R.type="border")}const g=u.filter(R=>R.type!=="unevaluated"),v=u.filter(R=>R.type==="unevaluated");if(v.length===0)return new ox;v.sort((R,$)=>R.hash===$.hash?R.isTunnel===$.isTunnel?0:R.isTunnel?-1:1:R.hash<$.hash?1:-1),u=g.concat(v);let k=g.length,S=k,P=k;do if(S++,S===u.length||u[k].hash!==u[S].hash){if(S-k==2){PR.hash<$.hash?1:-1),{portals:u}}}Yr(ox,"ElevationPortalGraph"),Yr(r1e,"ElevationPolygons");class mUe{constructor(c,u,g){this.outPositions=c,this.outNormals=u,this.outIndices=g,this.vertexLookup=new Map}addVertex(c,u,g){let v=c[2];g!=null&&(v*=g);const k=`${c[0]},${c[1]},${c[2]},${u[0]},${u[1]},${u[2]}`,S=this.vertexLookup.get(k);if(S!=null)return S;const P=this.outPositions.length;this.vertexLookup.set(k,P);const R=Math.trunc(16384*u[0]),$=Math.trunc(16384*u[1]),W=Math.trunc(16384*u[2]);return this.outPositions.emplaceBack(c[0],c[1],v),this.outNormals.emplaceBack(R,$,W),P}addTriangle(c,u,g){this.outIndices.emplaceBack(c,u,g)}addTriangles(c,u,g){if(c.length===0)return;const v=g.length===1,k=ye(),S=ye();for(let P=0;Pk!=="fill-tunnel-structure-color"),this.tunnelProgramConfigurations=new Oh(u,{zoom:g,lut:v},k=>k!=="fill-bridge-guard-rail-color")}addVertices(c,u){const g=this.unevalVertices.length;for(let v=0;v=k.min.x&&K.x<=k.max.x&&K.y>=k.min.y&&K.y<=k.max.y||X.x>=k.min.x&&X.x<=k.max.x&&X.y>=k.min.y&&X.y<=k.max.y||nc(K,X,P))||this.isOnBorder(K.x,X.x)||this.isOnBorder(K.y,X.y))continue;const re=wu.computeEdgeHash(this.unevalVertices[$],this.unevalVertices[W]);let se,fe=this.vertexHashLookup.get(wu.computePosHash(K));fe!=null?se=fe.next:(fe=this.vertexHashLookup.get(wu.computePosHash(X)),se=fe!=null?fe.prev:re),this.unevalEdges.push({polygonIdx:c,a:$,b:W,hash:re,portalHash:se,isTunnel:v,type:"unevaluated",featureInfo:S})}}addPortalCandidates(c,u,g,v,k){if(u.length===0)return;this.portalPolygons.add(c,{geometry:u,zLevel:k});const S=u[0];this.vertexHashLookup.clear();let P=wu.computeEdgeHash(S[S.length-2],S[S.length-1]);for(let R=0;R({vertexOffset:0,primitiveOffset:this.indexArray.length}),g=X=>{X.primitiveLength=this.indexArray.length-X.primitiveOffset},v=new mUe(this.vertexPositions,this.vertexNormals,this.indexArray);this.prepareEdges(c.portals,this.unevalEdges);const k=u(),S=u(),P=u(),R=(X,re)=>{X.sort((fe,Se)=>fe.type===re&&Se.type!==re?-1:fe.type!==re&&Se.type===re?1:0);const se=X.findIndex(fe=>fe.type!==re);return se>=0?se:X.length};let $=0;this.unevalEdges.length>0&&($=R(this.unevalEdges,"none"),this.constructBridgeStructures(v,this.unevalVertices,this.unevalHeights,this.unevalEdges,{min:0,max:$},this.tileToMeters)),g(P);const W=u(),K=u();if(this.unevalEdges.length>0){const X=this.unevalEdges.splice($),re=R(X,"tunnel")+$;this.unevalEdges.push(...X),this.constructTunnelStructures(v,this.unevalVertices,this.unevalHeights,this.unevalEdges,{min:0,max:$},{min:$,max:re})}g(W),v.addTriangles(this.unevalTriangles,this.unevalVertices,this.unevalHeights),g(K),v.addTriangles(this.unevalTunnelTriangles,this.unevalVertices,this.unevalHeights),g(S),v.addTriangles(this.unevalTunnelTriangles,this.unevalVertices,[-.1]),g(k),this.maskSegments=Oi.simpleSegment(0,K.primitiveOffset,0,K.primitiveLength),this.depthSegments=Oi.simpleSegment(0,S.primitiveOffset,0,S.primitiveLength),this.renderableBridgeSegments=Oi.simpleSegment(0,P.primitiveOffset,0,P.primitiveLength),this.renderableTunnelSegments=Oi.simpleSegment(0,W.primitiveOffset,0,W.primitiveLength),this.shadowCasterSegments=Oi.simpleSegment(0,k.primitiveOffset,0,k.primitiveLength)}update(c,u,g,v,k,S,P,R){this.bridgeProgramConfigurations.updatePaintArrays(c,u,k,g,v,S,P,R),this.tunnelProgramConfigurations.updatePaintArrays(c,u,k,g,v,S,P,R)}upload(c){this.vertexBuffer||this.vertexPositions.length===0||this.vertexNormals.length===0||this.indexArray.length===0||(this.vertexBuffer=c.createVertexBuffer(this.vertexPositions,nUe.members),this.vertexBufferNormal=c.createVertexBuffer(this.vertexNormals,sUe.members),this.indexBuffer=c.createIndexBuffer(this.indexArray),this.bridgeProgramConfigurations.upload(c),this.tunnelProgramConfigurations.upload(c))}destroy(){this.vertexBuffer&&(this.vertexBuffer.destroy(),this.vertexBufferNormal.destroy(),this.indexBuffer.destroy()),this.maskSegments&&(this.maskSegments.destroy(),this.depthSegments.destroy(),this.renderableBridgeSegments.destroy(),this.renderableTunnelSegments.destroy(),this.shadowCasterSegments.destroy()),this.bridgeProgramConfigurations.destroy(),this.tunnelProgramConfigurations.destroy()}populatePaintArrays(c,u,g,v,k){const S=(P,R)=>{for(let $=0;$he(xr,u[vr].x,u[vr].y,g[vr]*R),K=ye(),X=ye(),re=ye(),se=ye(),fe=ye(),Se=(xr,vr)=>{const ur=P.get(wu.computePosHash(u[vr])),pr=ur.from,tr=ur.to;if(!pr||!tr)return;W(K,pr),W(X,vr),W(re,tr),rt(se),at(K,X)||(Me(fe,X,K),Re(se,fe)),at(re,X)||(Me(fe,re,X),ue(se,se,Re(fe,fe)));const Xt=qe(se);return Xt>0?me(xr,se,1/Xt):void 0};let ke=Number.POSITIVE_INFINITY;this.sortSubarray(v,k.min,k.max,(xr,vr)=>xr.featureInfo.featureIndex-vr.featureInfo.featureIndex);const Fe=ye(),$e=ye(),Ke=ye(),ht=ye(),ot=ye(),_t=ye(),Ct=ye(),Et=ye(),Kt=ye(),Rt=[ye(),ye(),ye(),ye()],rr=[ye(),ye(),ye(),ye()],or=[{coord:new ir(0,0),height:0},{coord:new ir(0,0),height:0}],lr=(xr,vr)=>xr>vr;for(let xr=k.min;xrke.featureInfo.featureIndex-Fe.featureInfo.featureIndex;this.sortSubarray(v,k.min,k.max,R),this.sortSubarray(v,S.min,S.max,R);const $=ke=>Re(ke,ke),W=[{coord:new ir(0,0),height:0},{coord:new ir(0,0),height:0}],K=(ke,Fe)=>keP.hash===R.hash?R.polygonIdx-P.polygonIdx:R.hash>P.hash?1:-1);let g=0,v=0,k=0,S=u[g].polygonIdx;do v++,(v===u.length||u[g].hash!==u[v].hash)&&((v-g==1||u[v-1].polygonIdx!==S)&&(k$.portalHashW.hash?P++:W.hash>$.portalHash?R++:($.type=W.type,P++)}}}isOnBorder(c,u){return c<=0&&u<=0||c>=Sr&&u>=Sr}addFeatureSection(c,u,g,v){return c!==u&&(u=c,g.push({featureIndex:c,vertexStart:v.getVertexCount()}),v.clearVertexLookup()),u}sortSubarray(c,u,g,v){const k=c.slice(u,g);k.sort(v),c.splice(u,k.length,...k)}static computeEdgeHash(c,u){return(c.y===u.y&&c.x>u.x||c.y>u.y)&&([c,u]=[u,c]),BigInt(wu.computePosHash(c))<<32n|BigInt(wu.computePosHash(u))}static computePosHash(c){return((65535&c.x)<<16|65535&c.y)>>>0}}var n1e,s1e={exports:{}},a1e=(n1e||(n1e=1,function(f){function c(lt,pt){return lt>pt?1:lt0){var hn=yr+Math.floor(Dr/2),vn={key:pt[hn],data:nr[hn],parent:lt};return vn.left=v(vn,pt,nr,yr,hn),vn.right=v(vn,pt,nr,hn+1,Or),vn}return null}function k(lt,pt,nr,yr,Or){if(!(nr>=yr)){for(var Dr=lt[nr+yr>>1],hn=nr-1,vn=yr+1;;){do hn++;while(Or(lt[hn],Dr)<0);do vn--;while(Or(lt[vn],Dr)>0);if(hn>=vn)break;var Qn=lt[hn];lt[hn]=lt[vn],lt[vn]=Qn,Qn=pt[hn],pt[hn]=pt[vn],pt[vn]=Qn}k(lt,pt,nr,vn,Or),k(lt,pt,vn+1,yr,Or)}}u.prototype.rotateLeft=function(lt){var pt=lt.right;pt&&(lt.right=pt.left,pt.left&&(pt.left.parent=lt),pt.parent=lt.parent),lt.parent?lt===lt.parent.left?lt.parent.left=pt:lt.parent.right=pt:this._root=pt,pt&&(pt.left=lt),lt.parent=pt},u.prototype.rotateRight=function(lt){var pt=lt.left;pt&&(lt.left=pt.right,pt.right&&(pt.right.parent=lt),pt.parent=lt.parent),lt.parent?lt===lt.parent.left?lt.parent.left=pt:lt.parent.right=pt:this._root=pt,pt&&(pt.right=lt),lt.parent=pt},u.prototype._splay=function(lt){for(;lt.parent;){var pt=lt.parent;pt.parent?pt.left===lt&&pt.parent.left===pt?(this.rotateRight(pt.parent),this.rotateRight(pt)):pt.right===lt&&pt.parent.right===pt?(this.rotateLeft(pt.parent),this.rotateLeft(pt)):pt.left===lt&&pt.parent.right===pt?(this.rotateRight(pt),this.rotateLeft(pt)):(this.rotateLeft(pt),this.rotateRight(pt)):pt.left===lt?this.rotateRight(pt):this.rotateLeft(pt)}},u.prototype.splay=function(lt){for(var pt,nr,yr,Or,Dr;lt.parent;)(nr=(pt=lt.parent).parent)&&nr.parent?((yr=nr.parent).left===nr?yr.left=lt:yr.right=lt,lt.parent=yr):(lt.parent=null,this._root=lt),Or=lt.left,Dr=lt.right,lt===pt.left?(nr&&(nr.left===pt?(pt.right?(nr.left=pt.right,nr.left.parent=nr):nr.left=null,pt.right=nr,nr.parent=pt):(Or?(nr.right=Or,Or.parent=nr):nr.right=null,lt.left=nr,nr.parent=lt)),Dr?(pt.left=Dr,Dr.parent=pt):pt.left=null,lt.right=pt,pt.parent=lt):(nr&&(nr.right===pt?(pt.left?(nr.right=pt.left,nr.right.parent=nr):nr.right=null,pt.left=nr,nr.parent=pt):(Dr?(nr.left=Dr,Dr.parent=nr):nr.left=null,lt.right=nr,nr.parent=lt)),Or?(pt.right=Or,Or.parent=pt):pt.right=null,lt.left=pt,pt.parent=lt)},u.prototype.replace=function(lt,pt){lt.parent?lt===lt.parent.left?lt.parent.left=pt:lt.parent.right=pt:this._root=pt,pt&&(pt.parent=lt.parent)},u.prototype.minNode=function(lt){if(lt===void 0&&(lt=this._root),lt)for(;lt.left;)lt=lt.left;return lt},u.prototype.maxNode=function(lt){if(lt===void 0&&(lt=this._root),lt)for(;lt.right;)lt=lt.right;return lt},u.prototype.insert=function(lt,pt){var nr=this._root,yr=null,Or=this._compare;if(this._noDuplicates)for(;nr;){if(yr=nr,Or(nr.key,lt)===0)return;nr=Or(nr.key,lt)<0?nr.right:nr.left}else for(;nr;)yr=nr,nr=Or(nr.key,lt)<0?nr.right:nr.left;return nr={key:lt,data:pt,left:null,right:null,parent:yr},yr?Or(yr.key,nr.key)<0?yr.right=nr:yr.left=nr:this._root=nr,this.splay(nr),this._size++,nr},u.prototype.find=function(lt){for(var pt=this._root,nr=this._compare;pt;){var yr=nr(pt.key,lt);if(yr<0)pt=pt.right;else{if(!(yr>0))return pt;pt=pt.left}}return null},u.prototype.contains=function(lt){for(var pt=this._root,nr=this._compare;pt;){var yr=nr(lt,pt.key);if(yr===0)return!0;pt=yr<0?pt.left:pt.right}return!1},u.prototype.remove=function(lt){var pt=this.find(lt);if(!pt)return!1;if(this.splay(pt),pt.left)if(pt.right){var nr=this.minNode(pt.right);nr.parent!==pt&&(this.replace(nr,nr.right),nr.right=pt.right,nr.right.parent=nr),this.replace(pt,nr),nr.left=pt.left,nr.left.parent=nr}else this.replace(pt,pt.left);else this.replace(pt,pt.right);return this._size--,!0},u.prototype.removeNode=function(lt){if(!lt)return!1;if(this.splay(lt),lt.left)if(lt.right){var pt=this.minNode(lt.right);pt.parent!==lt&&(this.replace(pt,pt.right),pt.right=lt.right,pt.right.parent=pt),this.replace(lt,pt),pt.left=lt.left,pt.left.parent=pt}else this.replace(lt,lt.left);else this.replace(lt,lt.right);return this._size--,!0},u.prototype.erase=function(lt){var pt=this.find(lt);if(pt){this.splay(pt);var nr=pt.left,yr=pt.right,Or=null;nr&&(nr.parent=null,Or=this.maxNode(nr),this.splay(Or),this._root=Or),yr&&(nr?Or.right=yr:this._root=yr,yr.parent=Or),this._size--}},u.prototype.pop=function(){var lt=this._root,pt=null;if(lt){for(;lt.left;)lt=lt.left;pt={key:lt.key,data:lt.data},this.remove(lt.key)}return pt},u.prototype.next=function(lt){var pt=lt;if(pt)if(pt.right)for(pt=pt.right;pt&&pt.left;)pt=pt.left;else for(pt=lt.parent;pt&&pt.right===lt;)lt=pt,pt=pt.parent;return pt},u.prototype.prev=function(lt){var pt=lt;if(pt)if(pt.left)for(pt=pt.left;pt&&pt.right;)pt=pt.right;else for(pt=lt.parent;pt&&pt.left===lt;)lt=pt,pt=pt.parent;return pt},u.prototype.forEach=function(lt){for(var pt=this._root,nr=[],yr=!1,Or=0;!yr;)pt?(nr.push(pt),pt=pt.left):nr.length>0?(lt(pt=nr.pop(),Or++),pt=pt.right):yr=!0;return this},u.prototype.range=function(lt,pt,nr,yr){for(var Or=[],Dr=this._compare,hn=this._root;Or.length!==0||hn;)if(hn)Or.push(hn),hn=hn.left;else{if(Dr((hn=Or.pop()).key,pt)>0)break;if(Dr(hn.key,lt)>=0&&nr.call(yr,hn))return this;hn=hn.right}return this},u.prototype.keys=function(){for(var lt=this._root,pt=[],nr=[],yr=!1;!yr;)lt?(pt.push(lt),lt=lt.left):pt.length>0?(lt=pt.pop(),nr.push(lt.key),lt=lt.right):yr=!0;return nr},u.prototype.values=function(){for(var lt=this._root,pt=[],nr=[],yr=!1;!yr;)lt?(pt.push(lt),lt=lt.left):pt.length>0?(lt=pt.pop(),nr.push(lt.data),lt=lt.right):yr=!0;return nr},u.prototype.at=function(lt){for(var pt=this._root,nr=[],yr=!1,Or=0;!yr;)if(pt)nr.push(pt),pt=pt.left;else if(nr.length>0){if(pt=nr.pop(),Or===lt)return pt;Or++,pt=pt.right}else yr=!0;return null},u.prototype.load=function(lt,pt,nr){if(lt===void 0&&(lt=[]),pt===void 0&&(pt=[]),nr===void 0&&(nr=!1),this._size!==0)throw new Error("bulk-load: tree is not empty");var yr=lt.length;return nr&&k(lt,pt,0,yr-1,this._compare),this._root=v(null,lt,pt,0,yr),this._size=yr,this},u.prototype.min=function(){var lt=this.minNode(this._root);return lt?lt.key:null},u.prototype.max=function(){var lt=this.maxNode(this._root);return lt?lt.key:null},u.prototype.isEmpty=function(){return this._root===null},g.size.get=function(){return this._size},u.createTree=function(lt,pt,nr,yr,Or){return new u(nr,Or).load(lt,pt,yr)},Object.defineProperties(u.prototype,g);var S=0,P=1,R=2,$=3,W=0,K=1,X=2,re=3;function se(lt,pt,nr){pt===null?(lt.inOut=!1,lt.otherInOut=!0):(lt.isSubject===pt.isSubject?(lt.inOut=!pt.inOut,lt.otherInOut=pt.otherInOut):(lt.inOut=!pt.otherInOut,lt.otherInOut=pt.isVertical()?!pt.inOut:pt.inOut),pt&&(lt.prevInResult=!fe(pt,nr)||pt.isVertical()?pt.prevInResult:pt));var yr=fe(lt,nr);lt.resultTransition=yr?function(Or,Dr){var hn,vn=!Or.inOut,Qn=!Or.otherInOut;switch(Dr){case W:hn=vn&&Qn;break;case K:hn=vn||Qn;break;case re:hn=vn^Qn;break;case X:hn=Or.isSubject?vn&&!Qn:Qn&&!vn}return hn?1:-1}(lt,nr):0}function fe(lt,pt){switch(lt.type){case S:switch(pt){case W:return!lt.otherInOut;case K:return lt.otherInOut;case X:return lt.isSubject&<.otherInOut||!lt.isSubject&&!lt.otherInOut;case re:return!0}break;case R:return pt===W||pt===K;case $:return pt===X;case P:return!1}return!1}var Se=function(lt,pt,nr,yr,Or){this.left=pt,this.point=lt,this.otherEvent=nr,this.isSubject=yr,this.type=Or||S,this.inOut=!1,this.otherInOut=!1,this.prevInResult=null,this.resultTransition=0,this.otherPos=-1,this.outputContourId=-1,this.isExteriorRing=!0},ke={inResult:{configurable:!0}};function Fe(lt,pt){return lt[0]===pt[0]&<[1]===pt[1]}Se.prototype.isBelow=function(lt){var pt=this.point,nr=this.otherEvent.point;return this.left?(pt[0]-lt[0])*(nr[1]-lt[1])-(nr[0]-lt[0])*(pt[1]-lt[1])>0:(nr[0]-lt[0])*(pt[1]-lt[1])-(pt[0]-lt[0])*(nr[1]-lt[1])>0},Se.prototype.isAbove=function(lt){return!this.isBelow(lt)},Se.prototype.isVertical=function(){return this.point[0]===this.otherEvent.point[0]},ke.inResult.get=function(){return this.resultTransition!==0},Se.prototype.clone=function(){var lt=new Se(this.point,this.left,this.otherEvent,this.isSubject,this.type);return lt.contourId=this.contourId,lt.resultTransition=this.resultTransition,lt.prevInResult=this.prevInResult,lt.isExteriorRing=this.isExteriorRing,lt.inOut=this.inOut,lt.otherInOut=this.otherInOut,lt},Object.defineProperties(Se.prototype,ke);var $e=11102230246251565e-32,Ke=134217729,ht=(3+8*$e)*$e;function ot(lt,pt,nr,yr,Or){var Dr,hn,vn,Qn,cs=pt[0],ms=yr[0],As=0,Ln=0;ms>cs==ms>-cs?(Dr=cs,cs=pt[++As]):(Dr=ms,ms=yr[++Ln]);var Un=0;if(Ascs==ms>-cs?(vn=Dr-((hn=cs+Dr)-cs),cs=pt[++As]):(vn=Dr-((hn=ms+Dr)-ms),ms=yr[++Ln]),Dr=hn,vn!==0&&(Or[Un++]=vn);Ascs==ms>-cs?(vn=Dr-((hn=Dr+cs)-(Qn=hn-Dr))+(cs-Qn),cs=pt[++As]):(vn=Dr-((hn=Dr+ms)-(Qn=hn-Dr))+(ms-Qn),ms=yr[++Ln]),Dr=hn,vn!==0&&(Or[Un++]=vn);for(;As0!=As>0)return Ln;var Un=Math.abs(ms+As);return Math.abs(Ln)>=Ct*Un?Ln:-function(na,oa,la,Ma,Ga,$a,fa){var _a,ds,Bs,Ci,En,Es,qa,Qa,ri,oo,Ja,In,Fi,Ta,xi,Ho,vl,Eo,Io=na-Ga,sl=la-Ga,Sd=oa-$a,ei=Ma-$a;Rt[0]=(xi=(Qa=Io-(qa=(Es=Ke*Io)-(Es-Io)))*(oo=ei-(ri=(Es=Ke*ei)-(Es-ei)))-((Ta=Io*ei)-qa*ri-Qa*ri-qa*oo))-((Ja=xi-(vl=(Qa=Sd-(qa=(Es=Ke*Sd)-(Es-Sd)))*(oo=sl-(ri=(Es=Ke*sl)-(Es-sl)))-((Ho=Sd*sl)-qa*ri-Qa*ri-qa*oo)))+(En=xi-Ja))+(En-vl),Rt[1]=(Fi=Ta-((In=Ta+Ja)-(En=In-Ta))+(Ja-En))-((Ja=Fi-Ho)+(En=Fi-Ja))+(En-Ho),Rt[2]=In-((Eo=In+Ja)-(En=Eo-In))+(Ja-En),Rt[3]=Eo;var to=function(Km,sc){for(var sd=sc[0],ku=1;ku<4;ku++)sd+=sc[ku];return sd}(0,Rt),lo=Et*fa;if(to>=lo||-to>=lo||(_a=na-(Io+(En=na-Io))+(En-Ga),Bs=la-(sl+(En=la-sl))+(En-Ga),ds=oa-(Sd+(En=oa-Sd))+(En-$a),Ci=Ma-(ei+(En=Ma-ei))+(En-$a),_a===0&&ds===0&&Bs===0&&Ci===0)||(lo=Kt*fa+ht*Math.abs(to),(to+=Io*Ci+ei*_a-(Sd*Bs+sl*ds))>=lo||-to>=lo))return to;xr[0]=(xi=(Qa=_a-(qa=(Es=Ke*_a)-(Es-_a)))*(oo=ei-(ri=(Es=Ke*ei)-(Es-ei)))-((Ta=_a*ei)-qa*ri-Qa*ri-qa*oo))-((Ja=xi-(vl=(Qa=ds-(qa=(Es=Ke*ds)-(Es-ds)))*(oo=sl-(ri=(Es=Ke*sl)-(Es-sl)))-((Ho=ds*sl)-qa*ri-Qa*ri-qa*oo)))+(En=xi-Ja))+(En-vl),xr[1]=(Fi=Ta-((In=Ta+Ja)-(En=In-Ta))+(Ja-En))-((Ja=Fi-Ho)+(En=Fi-Ja))+(En-Ho),xr[2]=In-((Eo=In+Ja)-(En=Eo-In))+(Ja-En),xr[3]=Eo;var Wd=ot(4,Rt,4,xr,rr);xr[0]=(xi=(Qa=Io-(qa=(Es=Ke*Io)-(Es-Io)))*(oo=Ci-(ri=(Es=Ke*Ci)-(Es-Ci)))-((Ta=Io*Ci)-qa*ri-Qa*ri-qa*oo))-((Ja=xi-(vl=(Qa=Sd-(qa=(Es=Ke*Sd)-(Es-Sd)))*(oo=Bs-(ri=(Es=Ke*Bs)-(Es-Bs)))-((Ho=Sd*Bs)-qa*ri-Qa*ri-qa*oo)))+(En=xi-Ja))+(En-vl),xr[1]=(Fi=Ta-((In=Ta+Ja)-(En=In-Ta))+(Ja-En))-((Ja=Fi-Ho)+(En=Fi-Ja))+(En-Ho),xr[2]=In-((Eo=In+Ja)-(En=Eo-In))+(Ja-En),xr[3]=Eo;var Wo=ot(Wd,rr,4,xr,or);xr[0]=(xi=(Qa=_a-(qa=(Es=Ke*_a)-(Es-_a)))*(oo=Ci-(ri=(Es=Ke*Ci)-(Es-Ci)))-((Ta=_a*Ci)-qa*ri-Qa*ri-qa*oo))-((Ja=xi-(vl=(Qa=ds-(qa=(Es=Ke*ds)-(Es-ds)))*(oo=Bs-(ri=(Es=Ke*Bs)-(Es-Bs)))-((Ho=ds*Bs)-qa*ri-Qa*ri-qa*oo)))+(En=xi-Ja))+(En-vl),xr[1]=(Fi=Ta-((In=Ta+Ja)-(En=In-Ta))+(Ja-En))-((Ja=Fi-Ho)+(En=Fi-Ja))+(En-Ho),xr[2]=In-((Eo=In+Ja)-(En=Eo-In))+(Ja-En),xr[3]=Eo;var Mf=ot(Wo,or,4,xr,lr);return lr[Mf-1]}(Or,Dr,hn,vn,Qn,cs,Un)}(lt[0],lt[1],pt[0],pt[1],nr[0],nr[1]);return yr>0?-1:yr<0?1:0}function ur(lt,pt){var nr=lt.point,yr=pt.point;return nr[0]>yr[0]?1:nr[0]yr[1]?1:-1:function(Or,Dr,hn,vn){return Or.left!==Dr.left?Or.left?1:-1:vr(hn,Or.otherEvent.point,Dr.otherEvent.point)!==0?Or.isBelow(Dr.otherEvent.point)?-1:1:!Or.isSubject&&Dr.isSubject?1:-1}(lt,pt,nr)}function pr(lt,pt,nr){var yr=new Se(pt,!1,lt,lt.isSubject),Or=new Se(pt,!0,lt.otherEvent,lt.isSubject);return Fe(lt.point,lt.otherEvent.point)&&console.warn("what is that, a collapsed segment?",lt),yr.contourId=Or.contourId=lt.contourId,ur(Or,lt.otherEvent)>0&&(lt.otherEvent.left=!0,Or.left=!1),lt.otherEvent.otherEvent=Or,lt.otherEvent=yr,nr.push(Or),nr.push(yr),nr}function tr(lt,pt){return lt[0]*pt[1]-lt[1]*pt[0]}function Xt(lt,pt){return lt[0]*pt[0]+lt[1]*pt[1]}function mr(lt,pt,nr){var yr=function(Qn,cs,ms,As,Ln){var Un=[cs[0]-Qn[0],cs[1]-Qn[1]],na=[As[0]-ms[0],As[1]-ms[1]];function oa(Es,qa,Qa){return[Es[0]+qa*Qa[0],Es[1]+qa*Qa[1]]}var la=[ms[0]-Qn[0],ms[1]-Qn[1]],Ma=tr(Un,na),Ga=Ma*Ma,$a=Xt(Un,Un);if(Ga>0){var fa=tr(la,na)/Ma;if(fa<0||fa>1)return null;var _a=tr(la,Un)/Ma;return _a<0||_a>1?null:fa===0||fa===1?[oa(Qn,fa,Un)]:_a===0||_a===1?[oa(ms,_a,na)]:[oa(Qn,fa,Un)]}if((Ga=(Ma=tr(la,Un))*Ma)>0)return null;var ds=Xt(Un,la)/$a,Bs=ds+Xt(Un,na)/$a,Ci=Math.min(ds,Bs),En=Math.max(ds,Bs);return Ci<=1&&En>=0?Ci===1?[oa(Qn,Ci>0?Ci:0,Un)]:En===0?[oa(Qn,En<1?En:1,Un)]:[oa(Qn,Ci>0?Ci:0,Un),oa(Qn,En<1?En:1,Un)]:null}(lt.point,lt.otherEvent.point,pt.point,pt.otherEvent.point),Or=yr?yr.length:0;if(Or===0||Or===1&&(Fe(lt.point,pt.point)||Fe(lt.otherEvent.point,pt.otherEvent.point))||Or===2&<.isSubject===pt.isSubject)return 0;if(Or===1)return Fe(lt.point,yr[0])||Fe(lt.otherEvent.point,yr[0])||pr(lt,yr[0],nr),Fe(pt.point,yr[0])||Fe(pt.otherEvent.point,yr[0])||pr(pt,yr[0],nr),1;var Dr=[],hn=!1,vn=!1;return Fe(lt.point,pt.point)?hn=!0:ur(lt,pt)===1?Dr.push(pt,lt):Dr.push(lt,pt),Fe(lt.otherEvent.point,pt.otherEvent.point)?vn=!0:ur(lt.otherEvent,pt.otherEvent)===1?Dr.push(pt.otherEvent,lt.otherEvent):Dr.push(lt.otherEvent,pt.otherEvent),hn&&vn||hn?(pt.type=P,lt.type=pt.inOut===lt.inOut?R:$,hn&&!vn&&pr(Dr[1].otherEvent,Dr[0].point,nr),2):vn?(pr(Dr[0],Dr[1].point,nr),3):Dr[0]!==Dr[3].otherEvent?(pr(Dr[0],Dr[1].point,nr),pr(Dr[1],Dr[2].point,nr),3):(pr(Dr[0],Dr[1].point,nr),pr(Dr[3].otherEvent,Dr[2].point,nr),3)}function Mr(lt,pt){if(lt===pt)return 0;if(vr(lt.point,lt.otherEvent.point,pt.point)!==0||vr(lt.point,lt.otherEvent.point,pt.otherEvent.point)!==0)return Fe(lt.point,pt.point)?lt.isBelow(pt.otherEvent.point)?-1:1:lt.point[0]===pt.point[0]?lt.point[1]pt.contourId?1:-1:ur(lt,pt)===1?1:-1}var wr=function(){this.points=[],this.holeIds=[],this.holeOf=null,this.depth=null};function un(lt,pt,nr,yr){var Or,Dr=lt+1,hn=pt[lt].point,vn=pt.length;for(Dryr;)Dr--;return Dr}wr.prototype.isExterior=function(){return this.holeOf==null};var Br=tn,Kr=tn;function tn(lt,pt){if(!(this instanceof tn))return new tn(lt,pt);if(this.data=lt||[],this.length=this.data.length,this.compare=pt||gs,this.length>0)for(var nr=(this.length>>1)-1;nr>=0;nr--)this._down(nr)}function gs(lt,pt){return ltpt?1:0}tn.prototype={push:function(lt){this.data.push(lt),this.length++,this._up(this.length-1)},pop:function(){if(this.length!==0){var lt=this.data[0];return this.length--,this.length>0&&(this.data[0]=this.data[this.length],this._down(0)),this.data.pop(),lt}},peek:function(){return this.data[0]},_up:function(lt){for(var pt=this.data,nr=this.compare,yr=pt[lt];lt>0;){var Or=lt-1>>1,Dr=pt[Or];if(nr(yr,Dr)>=0)break;pt[lt]=Dr,lt=Or}pt[lt]=yr},_down:function(lt){for(var pt=this.data,nr=this.compare,yr=this.length>>1,Or=pt[lt];lt=0)break;pt[lt]=vn,lt=Dr}pt[lt]=Or}},Br.default=Kr;var jr=Math.max,rn=Math.min,qn=0;function Ds(lt,pt,nr,yr,Or,Dr){var hn,vn,Qn,cs,ms,As;for(hn=0,vn=lt.length-1;hn0?As.left=!0:ms.left=!0;var Ln=Qn[0],Un=Qn[1];Or[0]=rn(Or[0],Ln),Or[1]=rn(Or[1],Un),Or[2]=jr(Or[2],Ln),Or[3]=jr(Or[3],Un),yr.push(ms),yr.push(As)}}var $s=[];function ns(lt,pt,nr){typeof lt[0][0][0]=="number"&&(lt=[lt]),typeof pt[0][0][0]=="number"&&(pt=[pt]);var yr=function(Un,na,oa){var la=null;return Un.length*na.length==0&&(oa===W?la=$s:oa===X?la=Un:oa!==K&&oa!==re||(la=Un.length===0?na:Un)),la}(lt,pt,nr);if(yr)return yr===$s?null:yr;var Or=[1/0,1/0,-1/0,-1/0],Dr=[1/0,1/0,-1/0,-1/0],hn=function(Un,na,oa,la,Ma){var Ga,$a,fa,_a,ds,Bs,Ci=new Br(null,ur);for(fa=0,_a=Un.length;fa<_a;fa++)for(ds=0,Bs=(Ga=Un[fa]).length;dsla[2]||la[0]>oa[2]||oa[1]>la[3]||la[1]>oa[3])&&(Ma===W?Ga=$s:Ma===X?Ga=Un:Ma!==K&&Ma!==re||(Ga=Un.concat(na))),Ga}(lt,pt,Or,Dr,nr))return yr===$s?null:yr;for(var vn=function(Un){var na,oa,la=function(fa){var _a,ds,Bs,Ci,En=[];for(ds=0,Bs=fa.length;ds0){var Ja=Es[oo];if(Ja.holeOf!=null){var In=Ja.holeOf;Es[In].holeIds.push(qa),Qa.holeOf=In,Qa.depth=Es[oo].depth}else Es[oo].holeIds.push(qa),Qa.holeOf=oo,Qa.depth=Es[oo].depth+1}else Qa.holeOf=null,Qa.depth=Es[oo].depth}else Qa.holeOf=null,Qa.depth=0;return Qa}(la[na],Ga,fa),ds=function(En){Ma[En]=!0,En=la.length)&&la[Bs];);Ga.push(_a)}};for(na=0,oa=la.length;naCi||Ga===X&&En.point[0]>la[2])break;if(En.left){fa=$a=ds.insert(En),$a=$a!==(_a=ds.minNode())?ds.prev($a):null,fa=ds.next(fa);var Es=$a?$a.key:null;if(se(En,Es,Ga),fa&&mr(En,fa.key,Un)===2&&(se(En,Es,Ga),se(fa.key,En,Ga)),$a&&mr($a.key,En,Un)===2){var qa=$a;se(Es,(qa=qa!==_a?ds.prev(qa):null)?qa.key:null,Ga),se(En,Es,Ga)}}else fa=$a=ds.find(En=En.otherEvent),$a&&fa&&($a=$a!==_a?ds.prev($a):null,fa=ds.next(fa),ds.remove(En),fa&&$a&&mr($a.key,fa.key,Un))}return Bs}(hn,0,0,Or,Dr,nr)),Qn=[],cs=0;cs * @license MIT * @preserve */function YP(f,c,u,g){const v=[],k=g===0?(S,P,R,$,W,K)=>{S.push(new ir(K,R+(K-P)/($-P)*(W-R)))}:(S,P,R,$,W,K)=>{S.push(new ir(P+(K-R)/(W-R)*($-P),K))};for(const S of f){const P=[];for(const R of S){if(R.length<=2)continue;const $=[];for(let X=0;Xc&&k($,re,se,fe,Se,c):ke>u?Fe=c&&k($,re,se,fe,Se,c),Fe>u&&ke<=u&&k($,re,se,fe,Se,u)}let W=R[R.length-1];const K=g===0?W.x:W.y;K>=c&&K<=u&&$.push(W),$.length&&(W=$[$.length-1],$[0].x===W.x&&$[0].y===W.y||$.push($[0]),P.push($))}P.length&&v.push(P)}return v}function gUe(f,c){const u=Tie(f),g=Tie([c]),v=a1e.intersection(u,g);return v==null?[]:i1e(v)}function xUe(f,c){let g=Tie(f,65536);const v=[];for(;c.valid();c.next()){const[k,S]=c.get(),P=k.x*65536,R=k.y*65536,$=S.x*65536,W=S.y*65536,K=$-P,X=W-R,re=Math.hypot(K,X);if(re===0)continue;const se=Math.trunc(X/re*3),fe=-Math.trunc(K/re*3);v.push([[[P,R],[$,W],[$+se,W+fe],[P+se,R+fe],[P,R]]])}return v.length>0&&(g=a1e.diff(g,v)),i1e(g,1/65536)}function Tie(f,c=1){return[f.map(u=>u.map(g=>[g.x*c,g.y*c]))]}function i1e(f,c=1){return f.map(u=>u.map((g,v)=>{const k=g.map(S=>new ir(S[0]*c,S[1]*c).round());return v>0&&k.reverse(),k}))}class Aie{constructor(c,u){this.layoutVertexArray=new $m,this.indexArray=new Uo,this.lineIndexArray=new _u,this.triangleSegments=new Oi,this.lineSegments=new Oi,this.programConfigurations=new Oh(c.layers,{zoom:c.zoom,lut:c.lut}),this.uploaded=!1,u&&(this.elevatedLayoutVertexArray=new jp)}update(c,u,g,v,k,S,P,R){this.programConfigurations.updatePaintArrays(c,u,k,g,v,S,P,R)}isEmpty(){return this.layoutVertexArray.length===0}needsUpload(){return this.programConfigurations.needsUpload}upload(c){this.uploaded||(this.layoutVertexBuffer=c.createVertexBuffer(this.layoutVertexArray,tUe.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,rUe.members))),this.programConfigurations.upload(c),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.elevatedLayoutVertexBuffer&&this.elevatedLayoutVertexBuffer.destroy(),this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.lineIndexBuffer.destroy(),this.programConfigurations.destroy(),this.triangleSegments.destroy(),this.lineSegments.destroy())}populatePaintArrays(c,u,g,v,k,S,P){this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,c,u,g,v,k,S,void 0,P)}}class Eie{constructor(c){this.zoom=c.zoom,this.pixelRatio=c.pixelRatio,this.overscaling=c.overscaling,this.layers=c.layers,this.layerIds=this.layers.map(u=>u.fqid),this.index=c.index,this.hasPattern=!1,this.patternFeatures=[],this.lut=c.lut,this.bufferData=new Aie(c,!1),this.elevationBufferData=new Aie(c,!0),this.stateDependentLayerIds=this.layers.filter(u=>u.isStateDependent()).map(u=>u.id),this.projection=c.projection,this.elevationMode=this.layers[0].layout.get("fill-elevation-reference"),this.sourceLayerIndex=c.sourceLayerIndex,this.worldview=c.worldview,this.hasAppearances=null}updateFootprints(c,u){}updateAppearances(c,u,g,v){}populate(c,u,g,v){this.hasPattern=Cie("fill",this.layers,this.pixelRatio,u);const k=this.layers[0].layout.get("fill-sort-key"),S=[];for(const{feature:P,id:R,index:$,sourceLayerIndex:W}of c){const K=this.layers[0]._featureFilter.needGeometry,X=Dt(P,K);if(!this.layers[0]._featureFilter.filter(new ti(this.zoom,{worldview:this.worldview,activeFloors:u.activeFloors}),X,g))continue;const re=k?k.evaluate(X,{},g,u.availableImages):void 0,se={id:R,properties:P.properties,type:P.type,sourceLayerIndex:W,index:$,geometry:K?X.geometry:St(P,g,v),patterns:{},sortKey:re};S.push(se)}k&&S.sort((P,R)=>P.sortKey-R.sortKey);for(const P of S){const{geometry:R,index:$,sourceLayerIndex:W}=P;if(this.hasPattern){const K=Mie("fill",this.layers,P,this.zoom,this.pixelRatio,u);this.patternFeatures.push(K)}else this.addFeature(P,R,$,g,{},u.availableImages,u.brightness,u.elevationFeatures);u.featureIndex.insert(c[$].feature,R,$,W,this.index)}}update(c,u,g,v,k,S,P){this.bufferData.update(c,u,g,v,k,S,P,this.worldview),this.elevationBufferData.update(c,u,g,v,k,S,P,this.worldview),this.elevatedStructures&&this.elevatedStructures.update(c,u,g,v,k,S,P,this.worldview)}addFeatures(c,u,g,v,k,S){for(const P of this.patternFeatures)this.addFeature(P,P.geometry,P.index,u,g,v,S,c.elevationFeatures)}isEmpty(){return this.bufferData.isEmpty()&&this.elevationBufferData.isEmpty()}uploadPending(){return!this.uploaded||this.bufferData.needsUpload()||this.elevationBufferData.needsUpload()}upload(c){this.bufferData.upload(c),this.elevationBufferData.upload(c),this.elevatedStructures&&this.elevatedStructures.upload(c)}destroy(){this.bufferData.destroy(),this.elevationBufferData.destroy(),this.elevatedStructures&&this.elevatedStructures.destroy()}addFeature(c,u,g,v,k,S=[],P,R){const $=R5(u,500);this.elevationMode!=="none"?this.addElevatedRoadFeature(c,$,v,g,R):this.addGeometry($,this.bufferData),this.bufferData.populatePaintArrays(c,g,k,S,v,P,this.worldview),this.elevationBufferData.populatePaintArrays(c,g,k,S,v,P,this.worldview)}getUnevaluatedPortalGraph(){return this.elevatedStructures?this.elevatedStructures.unevaluatedPortals:void 0}getElevationPolygons(){return this.elevatedStructures?this.elevatedStructures.portalPolygons:void 0}setEvaluatedPortalGraph(c,u,g,v,k){this.elevatedStructures&&(this.elevatedStructures.construct(c),this.elevatedStructures.populatePaintArrays(u,g,v,k,this.worldview))}addElevatedRoadFeature(c,u,g,v,k){const S=new Array,P=ya.getElevationFeature(c,k);if(!P)return void this.addGeometry(u,this.bufferData);{const $=this.clipPolygonsToTile(u,1);$.length>0&&S.push({polygons:$,elevationFeature:P,elevationTileID:g})}const R={guardRailEnabled:this.layers[0].layout.get("fill-construct-bridge-guard-rail").evaluate(c,{},g),featureIndex:v};for(const $ of S)if($.elevationFeature){if(this.elevationMode==="hd-road-base"){this.elevatedStructures||(this.elevatedStructures=new wu($.elevationTileID,this.layers,this.zoom,this.lut));const K=$.elevationFeature.isTunnel();let X=0;c.properties.hasOwnProperty(qt)&&(X=+c.properties[qt]);for(const re of $.polygons)this.elevatedStructures.addPortalCandidates($.elevationFeature.id,re,K,$.elevationFeature,X)}$.elevationFeature.constantHeight==null&&($.polygons=this.prepareElevatedPolygons($.polygons,$.elevationFeature,$.elevationTileID));const W=new Ra(g,$.elevationTileID);this.addElevatedGeometry($.polygons,W,$.elevationFeature,this.elevationMode==="hd-road-base"?0:.05,v,R)}}addElevatedGeometry(c,u,g,v,k,S){const P={elevation:g,elevationSampler:u,bias:v,index:k,featureInfo:S},[R,$]=this.addGeometry(c,this.elevationBufferData,P);this.elevationBufferData.heightRange==null?this.elevationBufferData.heightRange={min:R,max:$}:(this.elevationBufferData.heightRange.min=Math.min(this.elevationBufferData.heightRange.min,R),this.elevationBufferData.heightRange.max=Math.max(this.elevationBufferData.heightRange.max,$))}addGeometry(c,u,g){let v=Number.POSITIVE_INFINITY,k=Number.NEGATIVE_INFINITY,S=null;g&&(S=g.elevationSampler.constantElevation(g.elevation,g.bias),S!=null&&(v=S,k=S));const P=(R,$,W)=>{if(g!=null)if($.push(R),S!=null)u.elevatedLayoutVertexArray.emplaceBack(S),W.push(S);else{const K=g.elevationSampler.pointElevation(R,g.elevation,g.bias);u.elevatedLayoutVertexArray.emplaceBack(K),W.push(K),v=Math.min(v,K),k=Math.max(k,K)}};for(const R of c){let $=0;for(const $e of R)$+=$e.length;const W=u.triangleSegments.prepareSegment($,u.layoutVertexArray,u.indexArray),K=W.vertexLength,X=[],re=[],se=[],fe=[],Se=[],ke=u.layoutVertexArray.length;for(const $e of R){if($e.length===0)continue;$e!==R[0]&&re.push(X.length/2);const Ke=u.lineSegments.prepareSegment($e.length,u.layoutVertexArray,u.lineIndexArray),ht=Ke.vertexLength;g&&Se.push(u.layoutVertexArray.length-ke),P($e[0],se,fe),u.layoutVertexArray.emplaceBack($e[0].x,$e[0].y),u.lineIndexArray.emplaceBack(ht+$e.length-1,ht),X.push($e[0].x),X.push($e[0].y);for(let ot=1;ot<$e.length;ot++)P($e[ot],se,fe),u.layoutVertexArray.emplaceBack($e[ot].x,$e[ot].y),u.lineIndexArray.emplaceBack(ht+ot-1,ht+ot),X.push($e[ot].x),X.push($e[ot].y);Ke.vertexLength+=$e.length,Ke.primitiveLength+=$e.length}const Fe=CN(X,re);for(let $e=0;$e0&&g&&this.elevationMode==="hd-road-base"){const $e=g.elevation.isTunnel(),Ke=g.elevation.safeArea,ht=this.elevatedStructures.addVertices(se,fe);this.elevatedStructures.addTriangles(Fe,ht,$e);const ot=Se.length;if(ot>0){for(let _t=0;_t=g&&re.max.x<=k&&re.min.y>=v&&re.max.y<=S?R:$).push(X)}if(R.length===c.length)return c;const W=[new ir(g,v),new ir(k,v),new ir(k,S),new ir(g,S),new ir(g,v)],K=R;for(const X of $)K.push(...gUe(X,W));return K}}let o1e,l1e,c1e,d1e;Yr(Eie,"FillBucket",{omit:["layers","patternFeatures"]}),Yr(Aie,"FillBufferData"),Yr(wu,"ElevatedStructures");class XP{constructor(c,u,g,v){if(this.triangleCount=u.length/3,this.min=new ir(0,0),this.max=new ir(0,0),this.xScale=0,this.yScale=0,this.cellsX=0,this.cellsY=0,this.cells=[],this.payload=[],this.triangleCount===0||c.length===0)return;const[k,S]=[c[0].clone(),c[0].clone()];for(let K=1;KK.cellIdx-X.cellIdx||K.triIdx-X.triIdx);let W=0;for(;W<$.length;){const K=$[W].cellIdx,X={start:this.payload.length,len:0};for(;W<$.length&&$[W].cellIdx===K;)++X.len,this.payload.push($[W++].triIdx);this.cells[K]=X}}_lazyInitLookup(){this.lookup||(this.lookup=new Uint8Array(Math.ceil(this.triangleCount/8))),this.lookup.fill(0)}queryPoint(c,u){if(this.triangleCount===0||this.cells.length===0||c.x>this.max.x||this.min.x>c.x||c.y>this.max.y||this.min.y>c.y)return;const g=Wm(c.x-this.min.x,this.xScale,this.cellsX),v=Wm(c.y-this.min.y,this.yScale,this.cellsY),k=this.cells[v*this.cellsX+g];if(k){this._lazyInitLookup();for(let S=0;Sthis.max.x||this.min.x>u.x||c.y>this.max.y||this.min.y>u.y)return;this._lazyInitLookup();const v=Wm(c.x-this.min.x,this.xScale,this.cellsX),k=Wm(u.x-this.min.x,this.xScale,this.cellsX),S=Wm(c.y-this.min.y,this.yScale,this.cellsY),P=Wm(u.y-this.min.y,this.yScale,this.cellsY);for(let R=S;R<=P;R++)for(let $=v;$<=k;$++){const W=this.cells[R*this.cellsX+$];if(W)for(let K=0;Ku.fqid),this.index=c.index,this.hasPattern=!1,this.stateDependentLayerIds=this.layers.filter(u=>u.isStateDependent()).map(u=>u.id),this.footprints=[],this.worldview=c.worldview,this.hasAppearances=null}updateFootprints(c,u){for(const g of this.footprints)u.push({footprint:g,id:c})}updateAppearances(c,u,g,v){}populate(c,u,g,v){const k=[];for(const{feature:S,id:P,index:R,sourceLayerIndex:$}of c){const W=this.layers[0]._featureFilter.needGeometry,K=Dt(S,W);if(!this.layers[0]._featureFilter.filter(new ti(this.zoom,{worldview:this.worldview,activeFloors:u.activeFloors}),K,g))continue;const X={id:P,properties:S.properties,type:S.type,sourceLayerIndex:$,index:R,geometry:W?K.geometry:St(S,g,v),patterns:{}};k.push(X)}for(const S of k){const{geometry:P,index:R,sourceLayerIndex:$}=S;this.addFeature(S,P,R,g,{},u.availableImages,u.brightness),u.featureIndex.insert(c[R].feature,P,R,$,this.index)}}isEmpty(){return this.footprints.length===0}uploadPending(){return!1}upload(c){}update(c,u,g,v,k,S,P){}destroy(){}addFeature(c,u,g,v,k,S=[],P){for(const R of R5(u,2)){const $=[],W=[],K=[],X=new ir(1/0,1/0),re=new ir(-1/0,-1/0);for(const Se of R)if(Se.length!==0){Se!==R[0]&&K.push(W.length/2);for(let ke=0;keS===v)===void 0}(g,f.clipScope)}function QP(f,c){return f.x-c.x||f.y-c.y}function p1e(f,c){return QP(f.min,c.min)===0&&QP(f.max,c.max)===0}function Iie(f,c){return!(f.min.x>c.max.x||f.max.xc.max.y||f.max.ynew ir((R.x+k.x*Sr)*P-S.x*Sr,(R.y+k.y*Sr)*P-S.y*Sr))}return Pie(u,v,f.indices,0,f.indices.length,0,0)}function x1e(f,c,u,g){const v=Math.pow(2,g.z-u.z);return new ir((f+u.x*Sr)*v-g.x*Sr,(c+u.y*Sr)*v-g.y*Sr)}function y1e(f,c){const u=[];c.grid.queryPoint(f,u);const g=c.indices,v=c.vertices;for(let k=0;k0&&(g.length>1&&u.push(g),g=[])}return g.length>1&&u.push(g),u}const Oie=Lt.types,CUe=["fill-extrusion-base","fill-extrusion-height","fill-extrusion-color","fill-extrusion-pattern","fill-extrusion-flood-light-wall-radius","fill-extrusion-line-width","fill-extrusion-emissive-strength"],MUe=["fill-extrusion-flood-light-ground-radius"],TUe=Math.pow(2,13),AUe=Math.pow(2,15)-1,_1e=new ir(0,1),lx=2147483648,b1e=7,w1e=450;function z5(f,c,u,g,v,k,S,P){f.emplaceBack((c<<1)+S,(u<<1)+k,(Math.floor(g*TUe)<<1)+v,Math.round(P))}function B5(f,c,u){f.emplaceBack(c.x*Sr,c.y*Sr,u?1:0)}function e6(f,c,u,g,v,k){f.emplaceBack(c.x,c.y,(u.x<<1)+g,(u.y<<1)+v,k)}function $5(f,c,u){f.emplaceBack(c.x,c.y,c.z,u[0]*16384,u[1]*16384,u[2]*16384)}class j1e{constructor(){this.vertexOffset=0,this.vertexCount=0,this.indexOffset=0,this.indexCount=0}}class k1e{constructor(){this.centroidXY=new ir(0,0),this.vertexArrayOffset=0,this.vertexCount=0,this.groundVertexArrayOffset=0,this.groundVertexCount=0,this.flags=0,this.footprintSegIdx=-1,this.footprintSegLen=0,this.polygonSegIdx=-1,this.polygonSegLen=0,this.min=new ir(Number.MAX_VALUE,Number.MAX_VALUE),this.max=new ir(-Number.MAX_VALUE,-Number.MAX_VALUE),this.height=0,this.buildingId=0}span(){return new ir(this.max.x-this.min.x,this.max.y-this.min.y)}}class N1e{constructor(){this.acc=new ir(0,0),this.accCount=0,this.centroidDataIndex=0}startRing(c,u){c.min.x===Number.MAX_VALUE&&(c.min.x=c.max.x=u.x,c.min.y=c.max.y=u.y)}appendEdge(c,u,g){this.accCount++,this.acc._add(u);let v=!!this.borders;u.xc.max.x&&(c.max.x=u.x,v=!0),u.yc.max.y&&(c.max.y=u.y,v=!0),((u.x===0||u.x===Sr)&&u.x===g.x)!=((u.y===0||u.y===Sr)&&u.y===g.y)&&this.processBorderOverlap(u,g),v&&this.checkBorderIntersection(u,g)}checkBorderIntersection(c,u){u.x<0!=c.x<0&&this.addBorderIntersection(0,Fn(u.y,c.y,(0-u.x)/(c.x-u.x))),u.x>Sr!=c.x>Sr&&this.addBorderIntersection(1,Fn(u.y,c.y,(Sr-u.x)/(c.x-u.x))),u.y<0!=c.y<0&&this.addBorderIntersection(2,Fn(u.x,c.x,(0-u.y)/(c.y-u.y))),u.y>Sr!=c.y>Sr&&this.addBorderIntersection(3,Fn(u.x,c.x,(Sr-u.y)/(c.y-u.y)))}addBorderIntersection(c,u){this.borders||(this.borders=[[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE]]);const g=this.borders[c];ug[1]&&(g[1]=u)}processBorderOverlap(c,u){if(c.x===u.x){if(c.y===u.y)return;const g=c.x===0?0:1;this.addBorderIntersection(g,u.y),this.addBorderIntersection(g,c.y)}else{const g=c.y===0?2:3;this.addBorderIntersection(g,u.x),this.addBorderIntersection(g,c.x)}}centroid(){return this.accCount===0?new ir(0,0):new ir(Math.floor(Math.max(0,this.acc.x)/this.accCount),Math.floor(Math.max(0,this.acc.y)/this.accCount))}intersectsCount(){return this.borders?this.borders.reduce((c,u)=>c+ +(u[0]!==Number.MAX_VALUE),0):0}}function S1e(f,c){const u=f.add(c)._unit(),g=xe(f.x*u.x+f.y*u.y,-1,1);var v,k,S;return v=Math.acos(g),Math.min(4,Math.max(-4,Math.tan(v)))/4*AUe*((k=f).x*(S=c).y-k.y*S.x<0?-1:1)}const EUe=[f=>f.x<0,f=>f.x>Sr,f=>f.y<0,f=>f.y>Sr];function IUe(f,c,u,g){const v=[4];if(g===0)return v;u._mult(g);const k=f.sub(u),S=c.sub(u),P=[f,c,k,S];for(let R=0;R<4;R++)for(const $ of P)if(EUe[R]($)){v.push(R);break}return v}class Die{constructor(c){this.groundRadiusArray=null,this.groundRadiusBuffer=null,this.vertexArray=new f5,this.indexArray=new Uo,this.programConfigurations=new Oh(c.layers,{zoom:c.zoom,lut:c.lut},u=>MUe.includes(u)),this._segments=new Oi,this.hiddenByLandmarkVertexArray=new mN,this._segmentToGroundQuads={},this._segmentToGroundQuads[0]=[],this._segmentToRegionTriCounts={},this._segmentToRegionTriCounts[0]=[0,0,0,0,0],this.regionSegments={},this.regionSegments[4]=new Oi}getDefaultSegment(){return this.regionSegments[4]}hasData(){return this.vertexArray.length!==0}addData(c,u,g,v=!1){const k=c.length;if(k>2){let S=Math.max(0,this._segments.get().length-1);const P=this._segments._prepareSegment(4*k,this.vertexArray.length,2*this._segmentToGroundQuads[S].length);let R;S!==this._segments.get().length-1&&(S++,this._segmentToGroundQuads[S]=[],this._segmentToRegionTriCounts[S]=[0,0,0,0,0]);{const $=c[0],W=c[1];R=S1e($.sub(c[k-1])._perp()._unit(),W.sub($)._perp()._unit())}for(let $=0;$v.region-k.region);for(let g=0;gR+$,0);let P=0;for(let R=0;R<=4;R++){const $=S[R];if($!==0){let W=this.regionSegments[R];W||(W=this.regionSegments[R]=new Oi);const K={vertexOffset:k.vertexOffset,primitiveOffset:k.primitiveOffset+P,vertexLength:k.vertexLength,primitiveLength:$};W.get().push(K)}P+=$}for(let R=0;R0?this.hiddenByLandmarkVertexBuffer=c.createVertexBuffer(this.hiddenByLandmarkVertexArray,jUe.members,!0):this.hiddenByLandmarkVertexBuffer&&this.hiddenByLandmarkVertexBuffer.updateData(this.hiddenByLandmarkVertexArray),this._needsHiddenByLandmarkUpdate=!1)}destroy(){if(this.vertexBuffer){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.hiddenByLandmarkVertexBuffer&&this.hiddenByLandmarkVertexBuffer.destroy(),this.groundRadiusBuffer&&this.groundRadiusBuffer.destroy(),this._segments&&this._segments.destroy(),this.programConfigurations.destroy();for(let c=0;c<=4;c++){const u=this.regionSegments[c];u&&u.destroy()}}}}class t6{constructor(c){this.zoom=c.zoom,this.canonical=c.canonical,this.overscaling=c.overscaling,this.layers=c.layers,this.pixelRatio=c.pixelRatio,this.layerIds=this.layers.map(u=>u.fqid),this.index=c.index,this.hasPattern=!1,this.edgeRadius=0,this.projection=c.projection,this.activeReplacements=[],this.replacementUpdateTime=0,this.centroidData=[],this.footprintIndices=new Uo,this.footprintVertices=new $m,this.footprintSegments=[],this.layoutVertexArray=new Uy,this.centroidVertexArray=new UP,this.wallVertexArray=new zv,this.indexArray=new Uo,this.programConfigurations=new Oh(c.layers,{zoom:c.zoom,lut:c.lut},u=>CUe.includes(u)),this.segments=new Oi,this.stateDependentLayerIds=this.layers.filter(u=>u.isStateDependent()).map(u=>u.id),this.groundEffect=new Die(c),this.maxHeight=0,this.partLookup={},this.triangleSubSegments=[],this.polygonSegments=[],this.worldview=c.worldview,this.hasAppearances=null}updateFootprints(c,u){}updateAppearances(c,u,g,v){}populate(c,u,g,v){this.features=[],this.hasPattern=Cie("fill-extrusion",this.layers,this.pixelRatio,u),this.featuresOnBorder=[],this.borderFeatureIndices=[[],[],[],[]],this.borderDoneWithNeighborZ=[-1,-1,-1,-1],this.selfDEMTileTimestamp=Number.MAX_VALUE,this.borderDEMTileTimestamp=[Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE],this.tileToMeter=Pe(g),this.edgeRadius=this.layers[0].layout.get("fill-extrusion-edge-radius")/this.tileToMeter,this.wallMode=this.layers[0].paint.get("fill-extrusion-line-width").constantOr(1)!==0;for(const{feature:k,id:S,index:P,sourceLayerIndex:R}of c){const $=this.layers[0]._featureFilter.needGeometry,W=Dt(k,$);if(!this.layers[0]._featureFilter.filter(new ti(this.zoom,{worldview:this.worldview,activeFloors:u.activeFloors}),W,g))continue;const K={id:S,sourceLayerIndex:R,index:P,geometry:$?W.geometry:St(k,g,v),properties:k.properties,type:k.type,patterns:{}},X=this.layoutVertexArray.length,re=Oie[K.type]==="Polygon";if(this.hasPattern)this.features.push({featureId:k.id,feature:Mie("fill-extrusion",this.layers,K,this.zoom,this.pixelRatio,u)});else if(this.wallMode)for(const se of K.geometry)for(const fe of v1e(se,re))this.addFeature(k.id,K,[fe],P,g,{},u.availableImages,v,u.brightness);else this.addFeature(k.id,K,K.geometry,P,g,{},u.availableImages,v,u.brightness);u.featureIndex.insert(k,K.geometry,P,R,this.index,X)}this.sortBorders(),this.projection.name==="mercator"&&this.splitToSubtiles(),this.groundEffect.prepareBorderSegments(),this.polygonSegments.length=0}addFeatures(c,u,g,v,k,S){for(const{featureId:P,feature:R}of this.features){const $=Oie[R.type]==="Polygon",{geometry:W}=R;if(this.wallMode)for(const K of W)for(const X of v1e(K,$))this.addFeature(P,R,[X],R.index,u,g,v,k,S);else this.addFeature(P,R,W,R.index,u,g,v,k,S)}this.sortBorders(),this.projection.name==="mercator"&&this.splitToSubtiles()}update(c,u,g,v,k,S,P){this.programConfigurations.updatePaintArrays(c,u,k,g,v,S,P,this.worldview),this.groundEffect.update(c,u,k,g,v,S,P,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,NUe),this.indexBuffer=c.createIndexBuffer(this.indexArray),this.wallVertexBuffer=c.createVertexBuffer(this.wallVertexArray,wUe.members),this.layoutVertexExtArray&&(this.layoutVertexExtBuffer=c.createVertexBuffer(this.layoutVertexExtArray,kUe.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,bUe.members,!0):this.centroidVertexBuffer&&this.centroidVertexBuffer.updateData(this.centroidVertexArray),this.needsCentroidUpdate=!1)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.centroidVertexBuffer&&this.centroidVertexBuffer.destroy(),this.layoutVertexExtBuffer&&this.layoutVertexExtBuffer.destroy(),this.groundEffect.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(c,u,g,v,k,S,P,R,$){const W=this.layers[0].paint.get("fill-extrusion-flood-light-ground-radius").evaluate(u,{})/this.tileToMeter,K=[new ir(0,0),new ir(Sr,Sr)],X=R.projection,re=X.name==="globe",se=this.wallMode||Oie[u.type]==="Polygon",fe=new N1e;fe.centroidDataIndex=this.centroidData.length;const Se=new k1e;Se.buildingId=c,u.properties&&u.properties.hasOwnProperty("building_id")&&(Se.buildingId=u.properties.building_id);const ke=this.layers[0].paint.get("fill-extrusion-base").evaluate(u,{},k)<=0,Fe=this.layers[0].paint.get("fill-extrusion-height").evaluate(u,{},k);let $e;if(Se.height=Fe,Se.vertexArrayOffset=this.layoutVertexArray.length,Se.groundVertexArrayOffset=this.groundEffect.vertexArray.length,re&&!this.layoutVertexExtArray&&(this.layoutVertexExtArray=new cN),this.wallMode){if(re)return void Ur("Non zero fill-extrusion-line-width is not yet supported on globe.");if(g.length!==1)return;$e=function(Rt){const rr=Rt[0].x===Rt[Rt.length-1].x&&Rt[0].y===Rt[Rt.length-1].y;(function(Kr){let tn=0;const gs=Kr.length;for(let jr=0;jr=0})(Rt)||(Rt=Rt.reverse());const lr={geometry:[],joinNormals:[],indices:[]},xr=[],vr=[],ur=[];let pr=Rt.length;for(;pr>=2&&Rt[pr-1].equals(Rt[pr-2]);)pr--;if(pr<(rr?3:2))return lr;let tr,Xt,mr,Mr,wr,un=0;for(;un0;let qn="miter";const Ds=2;qn==="miter"&&jr>Ds&&(qn="bevel"),qn==="bevel"&&(jr>100&&(qn="flipbevel"),jr{const nr=new ir(ns.x,ns.y),yr=new ir(ns.x,ns.y);nr.x+=Ba.x*pt,nr.y+=Ba.y*pt,yr.x-=Ba.x*Math.max(lt,1),yr.y-=Ba.y*Math.max(lt,1),ur.push(Ba),xr.push(nr),vr.push(yr)};if(qn==="miter")tn._mult(jr),$s(tr,tn,0,0);else if(qn==="flipbevel")tn=wr.mult(-1),$s(tr,tn,0,0),$s(tr,tn.mult(-1),0,0);else{const ns=-Math.sqrt(jr*jr-1),Ba=rn?ns:0,lt=rn?0:ns;Xt&&$s(tr,Mr,Ba,lt),mr&&$s(tr,wr,Ba,lt)}}lr.geometry=[...xr,...vr.reverse(),xr[0]],lr.joinNormals=[...ur,...ur.reverse(),ur[ur.length-1]];const Br=lr.geometry.length-1;for(let Kr=0;Kr
Rt<(rr.length-1)/2||Rt===rr.length-1,ht=this.wallMode?[g]:R5(g,500);for(let Rt=ht.length-1;Rt>=0;Rt--){const rr=ht[Rt];(rr.length===0||(ot=rr[0]).every(or=>or.x<=0)||ot.every(or=>or.x>=Sr)||ot.every(or=>or.y<=0)||ot.every(or=>or.y>=Sr))&&ht.splice(Rt,1)}var ot;let _t;if(re)_t=P1e(ht,K,k);else{_t=[];for(const Rt of ht)_t.push({polygon:Rt,bounds:K})}const Ct=se?this.edgeRadius:0,Et=Ct>0&&this.zoom<17,Kt=(Rt,rr)=>{if(Rt.length===0)return!1;const or=Rt[Rt.length-1];return rr.x===or.x&&rr.y===or.y};for(const{polygon:Rt,bounds:rr}of _t){let or=0,lr=0;for(const pr of Rt)se&&!pr[0].equals(pr[pr.length-1])&&pr.push(pr[0]),lr+=se?pr.length-1:pr.length;const xr=this.segments.prepareSegment((se?5:4)*lr,this.layoutVertexArray,this.indexArray);Se.footprintSegIdx<0&&(Se.footprintSegIdx=this.footprintSegments.length),Se.polygonSegIdx<0&&(Se.polygonSegIdx=this.polygonSegments.length);const vr={triangleArrayOffset:this.indexArray.length,triangleCount:0,triangleSegIdx:this.segments.segments.length-1},ur=new j1e;if(ur.vertexOffset=this.footprintVertices.length,ur.indexOffset=3*this.footprintIndices.length,ur.ringIndices=[],se){const pr=[],tr=[];or=xr.vertexLength;for(let mr=0;mr4&&A1e(tr[tr.length-2],tr[0],tr[1]),mr=Ct?PUe(tr[tr.length-2],tr[0],tr[1],Ct):0;const Mr=[];let wr,un,Br;un=tr[1].sub(tr[0])._perp()._unit();let Kr=!0;for(let tn=1,gs=0;tn0?1:0,Ba=jr.dist(rn);if(gs+Ba>32768&&(gs=0),Ct){Br=qn.sub(rn)._perp()._unit();let yr=M1e(jr,rn,qn,C1e(un,Br),Ct);isNaN(yr)&&(yr=0);const Or=rn.sub(jr)._unit();jr=jr.add(Or.mult(mr))._round(),rn=rn.add(Or.mult(-yr))._round(),mr=yr,un=Br,ke&&this.zoom>=17&&(Kt(Mr,jr)||Mr.push(jr),Kt(Mr,rn)||Mr.push(rn))}const lt=xr.vertexLength,pt=tr.length>4&&A1e(jr,rn,qn);let nr=E1e(gs,Xt,Kr);if(z5(this.layoutVertexArray,jr.x,jr.y,$s,ns,0,0,nr),z5(this.layoutVertexArray,jr.x,jr.y,$s,ns,0,1,nr),this.wallMode){const yr=Ke(tn-1,tr),Or=$e.joinNormals[tn-1];B5(this.wallVertexArray,Or,yr),B5(this.wallVertexArray,Or,yr)}if(gs+=Ba,nr=E1e(gs,pt,!Kr),Xt=pt,z5(this.layoutVertexArray,rn.x,rn.y,$s,ns,0,0,nr),z5(this.layoutVertexArray,rn.x,rn.y,$s,ns,0,1,nr),this.wallMode){const yr=Ke(tn,tr),Or=$e.joinNormals[tn];B5(this.wallVertexArray,Or,yr),B5(this.wallVertexArray,Or,yr)}if(xr.vertexLength+=4,this.indexArray.emplaceBack(lt+0,lt+1,lt+2),this.indexArray.emplaceBack(lt+1,lt+3,lt+2),xr.primitiveLength+=2,Ct){const yr=or+(tn===1?tr.length-2:tn-2),Or=tn===1?or:yr+1;if(this.indexArray.emplaceBack(lt+1,yr,lt+3),this.indexArray.emplaceBack(yr,Or,lt+3),xr.primitiveLength+=2,wr===void 0&&(wr=lt),!Rie(qn,tr[tn],rr)){const Dr=tn===tr.length-1?wr:xr.vertexLength;this.indexArray.emplaceBack(lt+2,lt+3,Dr),this.indexArray.emplaceBack(lt+3,Dr+1,Dr),this.indexArray.emplaceBack(lt+3,Or,Dr+1),xr.primitiveLength+=3}Kr=!Kr}if(re){const yr=this.layoutVertexExtArray,Or=X.projectTilePoint(jr.x,jr.y,k),Dr=X.projectTilePoint(rn.x,rn.y,k),hn=X.upVector(k,jr.x,jr.y),vn=X.upVector(k,rn.x,rn.y);$5(yr,Or,hn),$5(yr,Or,hn),$5(yr,Dr,vn),$5(yr,Dr,vn)}}se&&(or+=tr.length-1),ke&&Ct&&this.zoom>=17&&(Mr.length!==0&&Kt(Mr,Mr[0])&&Mr.pop(),this.groundEffect.addData(Mr,rr,W,Ct>0))}this.footprintSegments.push(ur),vr.triangleCount=this.indexArray.length-vr.triangleArrayOffset,this.polygonSegments.push(vr),++Se.footprintSegLen,++Se.polygonSegLen}if(Se.vertexCount=this.layoutVertexArray.length-Se.vertexArrayOffset,Se.groundVertexCount=this.groundEffect.vertexArray.length-Se.groundVertexArrayOffset,Se.vertexCount!==0){if(Se.centroidXY=fe.borders?_1e:this.encodeCentroid(fe,Se),this.centroidData.push(Se),fe.borders){this.featuresOnBorder.push(fe);const Rt=this.featuresOnBorder.length-1;for(let rr=0;rrthis.featuresOnBorder[u].borders[c][0]-this.featuresOnBorder[g].borders[c][0])}splitToSubtiles(){const c=[];for(let P=0;PSr),W=2*$+(+(R.min.x+R.max.x>Sr)^$);for(let K=0;KP.triangleSegmentIdx===R.triangleSegmentIdx?P.subtile-R.subtile:P.triangleSegmentIdx-R.triangleSegmentIdx);let g=0,v=0,k=0;for(const P of c){if(P.triangleSegmentIdx!==g)break;k++}const S=c.length;for(;v!==c.length;){g=c[v].triangleSegmentIdx;let P=0,R=v,$=v;for(let W=R;W0&&this.triangleSubSegments.push({segment:re,min:K,max:X}),R=$;for(let se=R;se[fe[0]*(1-ke[0])+Se[0]*ke[0],fe[1]*(1-ke[1])+Se[1]*ke[1]],re=[],se=[];for(const fe of this.triangleSubSegments){re[0]=fe.min.x/Sr,re[1]=fe.min.y/Sr,se[0]=fe.max.x/Sr,se[1]=fe.max.y/Sr;const Se=X(W,K,re),ke=X(W,K,se);if(new on([Se[0],Se[1],k],[ke[0],ke[1],S]).intersectsPrecise(g)===0){$&&(v.segments.push($),$=void 0);continue}const Fe=fe.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,u){const g=c.centroid(),v=u.span(),k=Math.min(7,Math.round(v.x*this.tileToMeter/10)),S=Math.min(7,Math.round(v.y*this.tileToMeter/10));return new ir(xe(g.x,1,Sr-1)<<3|k,xe(g.y,1,Sr-1)<<3|S)}encodeBorderCentroid(c){if(!c.borders)return new ir(0,0);const u=c.borders,g=Number.MAX_VALUE;if(u[0][0]!==g||u[1][0]!==g){const v=u[0][0]!==g?0:1;return new ir(6|(u[0][0]!==g?0:65528),(u[v][0]+u[v][1])/2<<3|6)}{const v=u[2][0]!==g?2:3;return new ir((u[v][0]+u[v][1])/2<<3|6,6|(u[2][0]!==g?0:65528))}}showCentroid(c){const u=this.centroidData[c.centroidDataIndex];u.flags&=2147483647,u.centroidXY.x=0,u.centroidXY.y=0,this.writeCentroidToBuffer(u)}writeCentroidToBuffer(c){this.groundEffect.updateHiddenByLandmark(c);const u=c.vertexArrayOffset,g=c.vertexCount+c.vertexArrayOffset,v=c.flags&lx?_1e:c.centroidXY,k=this.centroidVertexArray.geta_centroid_pos0(u);if(this.centroidVertexArray.geta_centroid_pos1(u)!==v.y||k!==v.x){for(let S=u;SR.max.x||R.min.x>S.max.x||S.min.y>R.max.y||R.min.y>S.max.y||S.footprint.buildingIds.has(R.buildingId)&&(R.flags|=lx);else for(const R of this.centroidData)if(!(R.flags&lx||S.min.x>R.max.x||R.min.x>S.max.x||S.min.y>R.max.y||R.min.y>S.max.y))for(let $=0;$u!=re>u&&c<(this.footprintVertices.int16[2*(W+S.vertexOffset)+0]-K)*(u-X)/(re-X)+K&&(v=!v)}P=R}}return v}getHeightAtTileCoord(c,u){let g=Number.NEGATIVE_INFINITY,v=!0;const k=4*(c+Sr)*Sr+(u+Sr);if(this.partLookup.hasOwnProperty(k)){const S=this.partLookup[k];return S?{height:S.height,hidden:!!(S.flags&lx)}:void 0}for(const S of this.centroidData)c>S.max.x||S.min.x>c||u>S.max.y||S.min.y>u||S.height<=g||this.footprintContainsPoint(c,u,S)&&(g=S.height,this.partLookup[k]=S,v=!!(S.flags&lx));if(g!==Number.NEGATIVE_INFINITY)return{height:g,hidden:v};this.partLookup[k]=void 0}}function C1e(f,c){const u=f.add(c)._unit();return f.x*u.x+f.y*u.y}function PUe(f,c,u,g){const v=c.sub(f)._perp()._unit(),k=u.sub(c)._perp()._unit();return M1e(f,c,u,C1e(v,k),g)}function M1e(f,c,u,g,v){const k=Math.sqrt(1-g*g);return Math.min(f.dist(c)/3,c.dist(u)/3,v*k/g)}function Rie(f,c,u){return f.xu[1].x&&c.x>u[1].x||f.yu[1].y&&c.y>u[1].y}function T1e(f,c){return f.xc[1].x||f.yc[1].y}function A1e(f,c,u){if(f.x<0||f.x>=Sr||c.x<0||c.x>=Sr||u.x<0||u.x>=Sr)return!1;const g=u.sub(c),v=g.perp(),k=f.sub(c);return(g.x*k.x+g.y*k.y)/Math.sqrt((g.x*g.x+g.y*g.y)*(k.x*k.x+k.y*k.y))>-.866&&v.x*k.x+v.y*k.y<0}function E1e(f,c,u){const g=c?2|f:-3&f;return u?1|g:-2&g}function I1e(){const f=Math.PI/32,c=Math.tan(f),u=_;return u*Math.sqrt(1+2*c*c)-u}function P1e(f,c,u){const g=1<{for(const Ct of ot)se.push({polygon:Ct,bounds:_t})},Se=Math.ceil(Math.log2(W)),ke=Math.ceil(Math.log2(K)),Fe=Se-ke,$e=[];for(let ot=0;ot0?0:1);for(let ot=0;ot_t+1?ht.push({polygons:lr,bounds:vr,depth:_t+1}):fe(lr,vr)}if(xr.length){const vr=[new ir(Ct===0?or:Et.x,Ct===1?or:Et.y),Kt];$e.length>_t+1?ht.push({polygons:xr,bounds:vr,depth:_t+1}):fe(xr,vr)}}return se}(f,c,Math.ceil((k-v)/11.25),Math.ceil((S-P)/11.25),1,(R,$,W)=>{if(R===0)return .5*($+W);{const K=ce((u.y+$/Sr)/g);return(V(.5*(ce((u.y+W/Sr)/g)+K))*g-u.y)*Sr}})}function LUe(f,c,u,g,v,k){const S=Math.pow(2,g.z-v.z);for(let P=0;P=R[S]&&(P=c,R=f),P[S]v&&R1e(P,R,S,v),P[S]k&&R1e(R,P,S,k)}}function r6(f,c,u,g,v,k){const S=[];for(let P=0;P=g&&se.x>=g||(re.x>=g?re=new ir(g,re.y+(g-re.x)/(se.x-re.x)*(se.y-re.y))._round():se.x>=g&&(se=new ir(g,re.y+(g-re.x)/(se.x-re.x)*(se.y-re.y))._round()),re.y>=v&&se.y>=v||(re.y>=v?re=new ir(re.x+(v-re.y)/(se.y-re.y)*(se.x-re.x),v)._round():se.y>=v&&(se=new ir(re.x+(v-re.y)/(se.y-re.y)*(se.x-re.x),v)._round()),$&&re.equals($[$.length-1])||($=[re],S.push($),k&&k.push({progress:{min:Se+z1e(ke,Fe,re)*fe,max:1},parentIndex:P,prevPoint:ke,nextPoint:Fe})),$.push(se),k&&(k[k.length-1].progress.max=Se+z1e(ke,Fe,se)*fe,k[k.length-1].nextPoint=Fe)))))}if(k&&K>0)for(let X=W;X$.t-W.t);let S=0,P=0,R=[];for(g.push(R);S!==f.length;){if(P===k.length){for(;S!==f.length;)R.length!==0&&R[R.length-1].equals(f[S])||R.push(f[S]),S++;break}k[P].t<=S?(R.length!==0&&R[R.length-1].equals(k[P].point)||R.push(k[P].point),Math.trunc(k[P].t),P++):(R.length!==0&&R[R.length-1].equals(f[S])||R.push(f[S]),S++)}}function z1e(f,c,u){return f.x!==c.x?(u.x-f.x)/(c.x-f.x):f.y!==c.y?(u.y-f.y)/(c.y-f.y):0}function U5(f,c){return f.x*c.x+f.y*c.y}function B1e(f,c){if(f.length===1){let u=0;const g=c[u++];let v;for(;!v||g.equals(v);)if(v=c[u++],!v)return 1/0;for(;u{or[0]=lr,or[1]=xr,or[2]=vr,or[3]=1},rr=I1e();re>0&&(re+=rr),se+=rr;for(const or of X){const lr=[],xr=[];for(const vr of or){const ur=vr.x+fe.x,pr=vr.y+fe.y,tr=K.projection.projectTilePoint(ur,pr,ht),Xt=K.projection.upVector(ht,vr.x,vr.y);let mr=re,Mr=se;if(ke){const wr=q1e(ur,pr,re,se,ke,Fe,$e,Ke);mr+=wr.base,Mr+=wr.top}re!==0?Rt(Et,tr.x+Xt[0]*Ct*mr,tr.y+Xt[1]*Ct*mr,tr.z+Xt[2]*Ct*mr):Rt(Et,tr.x,tr.y,tr.z),Rt(Kt,tr.x+Xt[0]*Ct*Mr,tr.y+Xt[1]*Ct*Mr,tr.z+Xt[2]*Ct*Mr),Ze(Et,Et,Se),Ze(Kt,Kt,Se),lr.push(new Zv(Et[0],Et[1],Et[2])),xr.push(new Zv(Kt[0],Kt[1],Kt[2]))}ot.push(lr),_t.push(xr)}return[ot,_t]}(f,c,u,g,v,k,S,P,R,$,W):S?function(K,X,re,se,fe,Se,ke,Fe,$e){const Ke=[],ht=[],ot=[0,0,0,1];for(const _t of K){const Ct=[],Et=[];for(const Kt of _t){const Rt=Kt.x+se.x,rr=Kt.y+se.y,or=q1e(Rt,rr,X,re,Se,ke,Fe,$e);ot[0]=Rt,ot[1]=rr,ot[2]=or.base,ot[3]=1,gt(ot,ot,fe),ot[3]=Math.max(ot[3],1e-5);const lr=new Zv(ot[0]/ot[3],ot[1]/ot[3],ot[2]/ot[3]);ot[0]=Rt,ot[1]=rr,ot[2]=or.top,ot[3]=1,gt(ot,ot,fe),ot[3]=Math.max(ot[3],1e-5);const xr=new Zv(ot[0]/ot[3],ot[1]/ot[3],ot[2]/ot[3]);Ct.push(lr),Et.push(xr)}Ke.push(Ct),ht.push(Et)}return[Ke,ht]}(c,u,g,v,k,S,P,R,$):function(K,X,re,se,fe){const Se=[],ke=[],Fe=fe[8]*X,$e=fe[9]*X,Ke=fe[10]*X,ht=fe[11]*X,ot=fe[8]*re,_t=fe[9]*re,Ct=fe[10]*re,Et=fe[11]*re;for(const Kt of K){const Rt=[],rr=[];for(const or of Kt){const lr=or.x+se.x,xr=or.y+se.y,vr=fe[0]*lr+fe[4]*xr+fe[12],ur=fe[1]*lr+fe[5]*xr+fe[13],pr=fe[2]*lr+fe[6]*xr+fe[14],tr=fe[3]*lr+fe[7]*xr+fe[15],Xt=vr+Fe,mr=ur+$e,Mr=pr+Ke,wr=Math.max(tr+ht,1e-5),un=vr+ot,Br=ur+_t,Kr=pr+Ct,tn=Math.max(tr+Et,1e-5);Rt.push(new Zv(Xt/wr,mr/wr,Mr/wr)),rr.push(new Zv(un/tn,Br/tn,Kr/tn))}Se.push(Rt),ke.push(rr)}return[Se,ke]}(c,u,g,v,k)}function q1e(f,c,u,g,v,k,S,P){const R=S*v.getElevationAt(f,c,!0,!0),$=k[0]!==0,W=$?k[1]===0?S*(k[0]/b1e-w1e):S*function(K,X,re){const se=Math.floor(X[0]/8),fe=Math.floor(X[1]/8),Se=10*(X[0]-8*se),ke=10*(X[1]-8*fe),Fe=K.getElevationAt(se,fe,!0,!0),$e=K.getMeterToDEM(re),Ke=Math.floor(.5*(Se*$e-1)),ht=Math.floor(.5*(ke*$e-1)),ot=K.tileCoordToPixel(se,fe),_t=2*Ke+1,Ct=2*ht+1,Et=function(xr,vr,ur,pr,tr){return[xr.getElevationAtPixel(vr,ur,!0),xr.getElevationAtPixel(vr+tr,ur,!0),xr.getElevationAtPixel(vr,ur+tr,!0),xr.getElevationAtPixel(vr+pr,ur+tr,!0)]}(K,ot.x-Ke,ot.y-ht,_t,Ct),Kt=Math.abs(Et[0]-Et[1]),Rt=Math.abs(Et[2]-Et[3]),rr=Math.abs(Et[0]-Et[2])+Math.abs(Et[1]-Et[3]),or=Math.min(.25,.5*$e*(Kt+Rt)/_t),lr=Math.min(.25,.5*$e*rr/Ct);return Fe+Math.max(or*Se,lr*ke)}(v,k,P):R;return{base:R+(u===0?-1:u),top:$?Math.max(W+g,R+u+2):R+g}}class DUe{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 RUe{constructor(){this.tasks={},this.taskQueue=[],Pt(["process"],this),this.invoker=new DUe(this.process),this.nextId=0}add(c,u){const g=this.nextId++,v=function({type:k,isSymbolTile:S,zoom:P}){return P=P||0,k==="message"?0:k!=="maybePrepare"||S?k!=="parseTile"||S?k==="parseTile"&&S?300-P:k==="maybePrepare"&&S?400-P:500:200-P:100-P}(u);if(v===0){try{c()}finally{}return null}return this.tasks[g]={fn:c,metadata:u,priority:v,id:g},this.taskQueue.push(g),this.invoker.trigger(),{cancel:()=>{delete this.tasks[g]}}}process(){try{if(this.taskQueue=this.taskQueue.filter(g=>!!this.tasks[g]),!this.taskQueue.length)return;const c=this.pick();if(c===null)return;const u=this.tasks[c];if(delete this.tasks[c],this.taskQueue.length&&this.invoker.trigger(),!u)return;u.fn()}finally{}}pick(){let c=null,u=1/0;for(let v=0;v{g&&delete this.callbacks[P],this.target.postMessage({id:P,type:"",targetMapId:v,sourceMapId:this.mapId})}}}receive(c){const u=c.data;if(!u)return;const g=u.id;if(g&&(!u.targetMapId||this.mapId===u.targetMapId))if(u.type===""){const v=this.cancelCallbacks[g];delete this.cancelCallbacks[g],v&&v.cancel()}else if(u.mustQueue||Ls(self)){const v=this.callbacks[g],k=this.scheduler.add(()=>this.processTask(g,u),v&&v.metadata||{type:"message"});k&&(this.cancelCallbacks[g]=k)}else this.processTask(g,u)}processTask(c,u){if(delete this.cancelCallbacks[c],u.type===""){const g=this.callbacks[c];delete this.callbacks[c],g&&(u.error?g(Bm(u.error)):g(null,Bm(u.data)))}else{const g=new Set,v=u.hasCallback?(S,P)=>{this.target.postMessage({id:c,type:"",sourceMapId:this.mapId,error:S?vp(S):null,data:vp(P,g)},g)}:()=>{},k=Bm(u.data);if(this.parent[u.type])this.parent[u.type](u.sourceMapId,k,v);else if(this.parent.getWorkerSource){const S=u.type.split("."),{source:P,scope:R}=k;this.parent.getWorkerSource(u.sourceMapId,S[0],P,R)[S[1]](k,v)}else v(new Error(`Could not find function ${u.type}`))}}remove(){this.scheduler.remove(),this.target.removeEventListener("message",this.receive,!1)}}var q5={workerUrl:"",workerClass:null,workerParams:void 0};const Fie="mapboxgl_preloaded_worker_pool";class Yv{constructor(c){this.active={},this.name=c}acquire(c,u=Yv.workerCount){if(!this.workers)for(this.workers=[];this.workers.length{u.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[Fie]}numActive(){return Object.keys(this.active).length}}Yv.workerCount=2;class TN{constructor(c,u,g="Worker",v=Yv.workerCount){this.workerPool=c,this.actors=[],this.currentActor=0,this.id=At();const k=this.workerPool.acquire(this.id,v);for(let S=0;S{this.ready=!0})}broadcast(c,u,g){kt(this.actors,(v,k)=>{v.send(c,u,k)},g=g||function(){})}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(){this.actors.forEach(c=>{c.remove()}),this.actors=[],this.workerPool.release(this.id)}}let V5,zie;function n6(){return V5||(V5=new Yv),V5}TN.Actor=V1e;const Bie=4096;class FUe{constructor(c){this.module=c,this.memoryStack=this.module.malloc(Bie),this.memoryStackNextFree=this.memoryStack}createIntArray(c){const u=this.memoryStackNextFree;return this.memoryStackNextFree+=c.length*Int32Array.BYTES_PER_ELEMENT,this.memoryStackNextFree-this.memoryStack>Bie?-1:(new Int32Array(this.module.heap32.buffer,u,c.length).set(c),u)}createFloatArray(c){const u=this.memoryStackNextFree;return this.memoryStackNextFree+=c.length*Float32Array.BYTES_PER_ELEMENT,this.memoryStackNextFree-this.memoryStack>Bie?-1:(new Float32Array(this.module.heapF32.buffer,u,c.length).set(c),u)}readStringBuffer(c){let u="";for(;this.module.heapU8[c]!==0;)u+=String.fromCharCode(this.module.heapU8[c]),++c;return u}setStyle(c){const u=c.normalScale;this.module.setStyle(u[0],u[1],u[2],c.tileToMeters)}setAOOptions(c,u){this.module.setAOOptions(c?1:0,u)}setMetricOptions(c,u){this.module.setMetricOptions(c?1:0,u)}setStructuralOptions(c){this.module.setStructuralOptions(c?1:0)}setFacadeOptions(c,u){this.module.setFacadeOptions(c,u?1:0)}setFauxFacadeOptions(c,u,g){this.module.setFauxFacadeOptions(c?1:0,u?1:0,g)}setFacadeClassifierOptions(c){this.module.setFacadeClassifierOptions(c)}generateMesh(c,u){this.memoryStackNextFree=this.memoryStack;for(const P of c){const R=this.createIntArray(P.ringIndices),$=this.createFloatArray(P.coordinates);if(R===-1||$===-1)return`building_gen: Out of stack memory: ${this.memoryStackNextFree-this.memoryStack}/4096`;this.module.addFeature(P.id,P.sourceId,P.minHeight,P.height,P.roofType,$,R,P.ringIndices.length-1)}for(const P of u){let R;R=P.entrances?JSON.parse(P.entrances):[];const $=this.createFloatArray(R),W=this.createFloatArray(P.coordinates);if($===-1||W===-1)return`building_gen: Out of stack memory: ${this.memoryStackNextFree-this.memoryStack}/4096`;this.module.addFacade(P.sourceId,P.crossPerc,P.distanceToRoad,$,R.length,W,P.coordinates.length)}if(!this.module.generateMesh()){const P=this.module.getLastError();return this.readStringBuffer(P)}const g=this.module.getMeshCount(),v=new Array(g);for(let P=0;Pv.arrayBuffer()).then(v=>{c.buffers[u]=v})}function Q1e(f,c){const u=f.json.bufferViews[c];return new Uint8Array(f.buffers[u.buffer],u.byteOffset||0,u.byteLength)}function VUe(f,c,u,g){if(f.uri){const v=X1e(f.uri,g);return fetch(v).then(k=>k.blob()).then(k=>createImageBitmap(k)).then(k=>{c.images[u]=k})}if(f.bufferView!==void 0){const v=Q1e(c,f.bufferView),k=new Blob([v],{type:f.mimeType});return createImageBitmap(k).then(S=>{c.images[u]=S})}}function J1e(f,c=0,u){const g={json:null,images:[],buffers:[]};if(new Uint32Array(f,c,1)[0]===Z1e){const W=new Uint32Array(f,c);let K=2;const X=(W[K++]>>2)-3,re=W[K++]>>2;if(K++,g.json=JSON.parse(Y1e.decode(W.subarray(K,K+re))),K+=re,K{const W=[],K=P&&P.includes(qie),X=P&&P.includes(i6);if(K&&W.push(function(){if(!Ep)return H5??(H5=function(re){let se,fe=null;function Se(){se=new Uint8Array(fe.buffer)}function ke(){throw new Error("Unexpected Draco error.")}const Fe={a:{a:ke,d:function($e,Ke,ht){return se.copyWithin($e,Ke,Ke+ht)},c:function($e){const Ke=se.length,ht=Math.max($e>>>0,Math.ceil(1.2*Ke)),ot=Math.ceil((ht-Ke)/65536);try{return fe.grow(ot),Se(),!0}catch{return!1}},b:ke}};return(WebAssembly.instantiateStreaming?WebAssembly.instantiateStreaming(re,Fe):re.then($e=>$e.arrayBuffer()).then($e=>WebAssembly.instantiate($e,Fe))).then($e=>{const{Rb:Ke,Qb:ht,P:ot,T:_t,X:Ct,Ja:Et,La:Kt,Qa:Rt,Va:rr,Wa:or,eb:lr,jb:xr,f:vr,e:ur,yb:pr,zb:tr,Ab:Xt,Bb:mr,Db:Mr,Gb:wr}=$e.instance.exports;fe=ur;const un=(()=>{let Br=0,Kr=0,tn=0,gs=0;return jr=>{tn&&(Ke(gs),Ke(Br),Kr+=tn,tn=Br=0),Br||(Kr+=128,Br=ht(Kr));const rn=jr.length+7&-8;let qn=Br;rn>=Kr&&(tn=rn,qn=gs=ht(rn));for(let Ds=0;Ds{Ep=re,H5=void 0}))}()),X&&W.push(function(){if(Uie)return;const re=function(se){let fe;const Se=WebAssembly.instantiateStreaming(se,{}).then($e=>{fe=$e.instance,fe.exports.__wasm_call_ctors()}),ke={NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},Fe={ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"};return{ready:Se,supported:!0,decodeGltfBuffer($e,Ke,ht,ot,_t,Ct){(function(Et,Kt,Rt,rr,or,lr,xr){const vr=Et.exports.sbrk,ur=rr+3&-4,pr=vr(ur*or),tr=vr(lr.length),Xt=new Uint8Array(Et.exports.memory.buffer);Xt.set(lr,tr);const mr=Kt(pr,rr,or,tr,lr.length);if(mr===0&&xr&&xr(pr,ur,or),Rt.set(Xt.subarray(pr,pr+rr*or)),vr(pr-vr(0)),mr!==0)throw new Error(`Malformed buffer data: ${mr}`)})(fe,fe.exports[Fe[_t]],$e,Ke,ht,ot,fe.exports[ke[Ct]])}}}(fetch(G1e()));return re.ready.then(()=>{Uie=re})}()),k)for(let re=0;re{if(K&&S)for(const{primitives:re}of S)for(const se of re)$Ue(se,g);if(X&&S&&R)for(const re of R)UUe(re,g);return g})})}function eve(f){return fetch(f).then(c=>c.arrayBuffer()).then(c=>J1e(c,0,f))}function Vie(f){switch(f){case WebGL2RenderingContext.RGBA8:return WebGL2RenderingContext.RGBA;case WebGL2RenderingContext.DEPTH_COMPONENT16:return WebGL2RenderingContext.DEPTH_COMPONENT;case WebGL2RenderingContext.DEPTH24_STENCIL8:return WebGL2RenderingContext.DEPTH_STENCIL;case WebGL2RenderingContext.R8:case WebGL2RenderingContext.R32F:return WebGL2RenderingContext.RED}}function Hie(f){switch(f){case WebGL2RenderingContext.RGBA8:return WebGL2RenderingContext.UNSIGNED_BYTE;case WebGL2RenderingContext.DEPTH_COMPONENT16:return WebGL2RenderingContext.UNSIGNED_SHORT;case WebGL2RenderingContext.DEPTH24_STENCIL8:return WebGL2RenderingContext.UNSIGNED_INT_24_8;case WebGL2RenderingContext.R8:return WebGL2RenderingContext.UNSIGNED_BYTE;case WebGL2RenderingContext.R32F:return WebGL2RenderingContext.FLOAT}}class Wie{constructor(c,u,g,v){this.context=c,this.format=g,this.useMipmap=v&&v.useMipmap,this.texture=c.gl.createTexture(),this.update(u,{premultiply:v&&v.premultiply})}update(c,u){const g=c&&c instanceof HTMLVideoElement&&c.width===0?c.videoWidth:c.width,v=c&&c instanceof HTMLVideoElement&&c.height===0?c.videoHeight:c.height,{context:k}=this,{gl:S}=k,{x:P,y:R}=u&&u.position?u.position:{x:0,y:0},$=P+g,W=R+v;!this.size||this.size[0]===$&&this.size[1]===W||(S.bindTexture(S.TEXTURE_2D,null),S.deleteTexture(this.texture),this.texture=S.createTexture(),this.size=null),S.bindTexture(S.TEXTURE_2D,this.texture),k.pixelStoreUnpackFlipY.set(!1),k.pixelStoreUnpack.set(1),k.pixelStoreUnpackPremultiplyAlpha.set(this.format===S.RGBA8&&(!u||u.premultiply!==!1));const K=c instanceof HTMLImageElement||c instanceof HTMLCanvasElement||c instanceof HTMLVideoElement||c instanceof ImageData||ImageBitmap&&c instanceof ImageBitmap;if(!this.size&&$>0&&W>0){const X=this.useMipmap?Math.floor(Math.log2(Math.max($,W)))+1:1;S.texStorage2D(S.TEXTURE_2D,X,this.format,$,W),this.size=[$,W]}this.size&&(K?S.texSubImage2D(S.TEXTURE_2D,0,P,R,Vie(this.format),Hie(this.format),c):"data"in c&&c.data&&S.texSubImage2D(S.TEXTURE_2D,0,P,R,g,v,Vie(this.format),Hie(this.format),c.data)),this.useMipmap&&S.generateMipmap(S.TEXTURE_2D)}bind(c,u,g=!1){const{context:v}=this,{gl:k}=v;k.bindTexture(k.TEXTURE_2D,this.texture),c!==this.minFilter&&(k.texParameteri(k.TEXTURE_2D,k.TEXTURE_MAG_FILTER,c),k.texParameteri(k.TEXTURE_2D,k.TEXTURE_MIN_FILTER,this.useMipmap&&!g?c===k.NEAREST?k.NEAREST_MIPMAP_NEAREST:k.LINEAR_MIPMAP_LINEAR:c),this.minFilter=c),u!==this.wrapS&&(k.texParameteri(k.TEXTURE_2D,k.TEXTURE_WRAP_S,u),k.texParameteri(k.TEXTURE_2D,k.TEXTURE_WRAP_T,u),this.wrapS=u)}bindExtraParam(c,u,g,v,k){const{context:S}=this,{gl:P}=S;P.bindTexture(P.TEXTURE_2D,this.texture),u!==this.magFilter&&(P.texParameteri(P.TEXTURE_2D,P.TEXTURE_MAG_FILTER,u),this.magFilter=u),c!==this.minFilter&&(P.texParameteri(P.TEXTURE_2D,P.TEXTURE_MIN_FILTER,this.useMipmap?c===P.NEAREST?P.NEAREST_MIPMAP_NEAREST:P.LINEAR_MIPMAP_LINEAR:c),this.minFilter=c),g!==this.wrapS&&(P.texParameteri(P.TEXTURE_2D,P.TEXTURE_WRAP_S,g),this.wrapS=g),v!==this.wrapT&&(P.texParameteri(P.TEXTURE_2D,P.TEXTURE_WRAP_T,v),this.wrapT=v),k!==this.compareMode&&(k?(P.texParameteri(P.TEXTURE_2D,P.TEXTURE_COMPARE_MODE,P.COMPARE_REF_TO_TEXTURE),P.texParameteri(P.TEXTURE_2D,P.TEXTURE_COMPARE_FUNC,k)):P.texParameteri(P.TEXTURE_2D,P.TEXTURE_COMPARE_MODE,P.NONE),this.compareMode=k)}destroy(){const{gl:c}=this.context;c.deleteTexture(this.texture),this.texture=null}}class G5{constructor(c,u){this.context=c,this.texture=u}bind(c,u){const{context:g}=this,{gl:v}=g;v.bindTexture(v.TEXTURE_2D,this.texture),c!==this.minFilter&&(v.texParameteri(v.TEXTURE_2D,v.TEXTURE_MAG_FILTER,c),v.texParameteri(v.TEXTURE_2D,v.TEXTURE_MIN_FILTER,c),this.minFilter=c),u!==this.wrapS&&(v.texParameteri(v.TEXTURE_2D,v.TEXTURE_WRAP_S,u),v.texParameteri(v.TEXTURE_2D,v.TEXTURE_WRAP_T,u),this.wrapS=u)}}const HUe=Ts([{name:"a_pos_3f",components:3,type:"Float32"}]),WUe=Ts([{name:"a_color_3f",components:3,type:"Float32"}]),GUe=Ts([{name:"a_color_4f",components:4,type:"Float32"}]),KUe=Ts([{name:"a_uv_2f",components:2,type:"Float32"}]),ZUe=Ts([{name:"a_normal_3f",components:3,type:"Float32"}]),YUe=Ts([{name:"a_normal_matrix0",components:4,type:"Float32"},{name:"a_normal_matrix1",components:4,type:"Float32"},{name:"a_normal_matrix2",components:4,type:"Float32"},{name:"a_normal_matrix3",components:4,type:"Float32"}]),XUe=Ts([{name:"a_pbr",components:4,type:"Uint16"},{name:"a_heightBasedEmissiveStrength",components:3,type:"Float32"}]);function tve(f,c){const u=o6(f.projection,f.zoom,f.width,f.height),g=function(k,S,P,R,$){const W=new m(P.lng-180*Qy,P.lat),K=new m(P.lng+180*Qy,P.lat),X=k.project(W.lng,W.lat),re=k.project(K.lng,K.lat),se=-Math.atan2(re.y-X.y,re.x-X.x),fe=Ve.fromLngLat(P);fe.y=xe(fe.y,-1+Qy,1-Qy);const Se=fe.toLngLat(),ke=k.project(Se.lng,Se.lat),Fe=Ve.fromLngLat(Se);Fe.x+=Qy;const $e=Fe.toLngLat(),Ke=k.project($e.lng,$e.lat),ht=nve(Ke.x-ke.x,Ke.y-ke.y,se),ot=Ve.fromLngLat(Se);ot.y+=Qy;const _t=ot.toLngLat(),Ct=k.project(_t.lng,_t.lat),Et=nve(Ct.x-ke.x,Ct.y-ke.y,se),Kt=Math.abs(ht.x)/Math.abs(Et.y),Rt=A([]);H(Rt,Rt,-se*(1-($?0:R)));const rr=A([]);return z(rr,rr,[1,1-(1-Kt)*R,1]),rr[4]=-Et.x/Et.y*R,H(rr,rr,se),T(rr,Rt,rr),rr}(f.projection,0,f.center,u,c),v=rve(f);return z(g,g,[v,v,1]),g}function rve(f){const c=f.projection,u=o6(f.projection,f.zoom,f.width,f.height),g=Gie(c,f.center),v=Gie(c,m.convert(c.center));return Math.pow(2,g*u+(1-u)*v)}function o6(f,c,u,g,v=1/0){const k=f.range;if(!k)return 0;const S=Math.min(v,Math.max(u,g)),P=Math.log2(S/1024);return Ie(k[0]+P,k[1]+P,c)}const Qy=1/4e4;function Gie(f,c){const u=xe(c.lat,-de,de),g=new m(c.lng-180*Qy,u),v=new m(c.lng+180*Qy,u),k=f.project(g.lng,u),S=f.project(v.lng,u),P=Ve.fromLngLat(g),R=Ve.fromLngLat(v),$=S.x-k.x,W=S.y-k.y,K=R.x-P.x,X=R.y-P.y,re=Math.sqrt((K*K+X*X)/($*$+W*W));return Math.log2(re)}function nve(f,c,u){const g=Math.cos(u),v=Math.sin(u);return{x:f*g-c*v,y:f*v+c*g}}function sve(f,c,u){A(f),H(f,f,ss(c[2])),F(f,f,ss(c[0])),q(f,f,ss(c[1])),z(f,f,u),T(f,f,[1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,1])}function l6(f,c,u,g,v,k,S,P){const R=[u[0]-c[0],u[1]-c[1],0],$=[g[0]-c[0],g[1]-c[1],0];if(ge(R)<1e-12||ge($)<1e-12)return Mt(f);const W=et([],R,$);Re(W,W),_e($,g,c),R[2]=(k-v)*P,$[2]=(S-v)*P;const K=R;return et(K,R,$),Re(K,K),Pn(f,W,K)}function c6(f,c,u=!1){const g=Yy(c.zoom),v=function(k,S,P){const R=S.worldSize,$=[k[12],k[13],k[14]],W=ce($[1]/R),K=Q($[0]/R),X=A([]),re=Y(1,W)*R,se=Y(1,0)*R*ve(W,S.zoom),fe=1/wie(R);let Se=se*fe;if(P){const Ke=o6(S.projection,S.zoom,S.width,S.height,1024);Se=fe*S.projection.pixelSpaceConversion(S.center.lat,R,Ke)}const ke=Gy(W,K);ue(ke,ke,me([],Re([],ke),re*Se*$[2]));const Fe=function(Ke){const ht=[Ke[0],Ke[1],Ke[2]];let ot=[0,1,0];const _t=et([],ot,ht);return et(ot,ht,_t),Ee(ot)===0&&(ot=[0,1,0],et(_t,ht,ot)),Re(_t,_t),Re(ot,ot),Re(ht,ht),[_t[0],_t[1],_t[2],0,ot[0],ot[1],ot[2],0,ht[0],ht[1],ht[2],0,Ke[0],Ke[1],Ke[2],1]}(ke);z(X,X,[Se,Se,Se*re]),L(X,X,[-$[0],-$[1],-$[2]]);const $e=T([],S.globeMatrix,Fe);return T($e,$e,X),T($e,$e,k),$e}(f,c,u);if(g>0){const k=function(S,P){const R=P.worldSize,$=Y(1,0)*R*ve(P.center.lat,P.zoom)/wie(R),W=Y(1,P.center.lat)*R,K=A([]);q(K,K,ss(P.center.lng)),F(K,K,ss(P.center.lat)),L(K,K,[0,0,vc]),z(K,K,[$,$,$*W]);const X=P.point;return L(K,K,[-X.x,-X.y,0]),T(K,K,S),T(K,P.globeMatrix,K)}(f,c);return function(S,P,R){const $=(se,fe,Se)=>{const ke=ge(se),Fe=ge(fe),$e=Ap(se,fe,Se);return me($e,$e,1/ge($e)*Fn(ke,Fe,Se))},W=$([S[0],S[1],S[2]],[P[0],P[1],P[2]],R),K=$([S[4],S[5],S[6]],[P[4],P[5],P[6]],R),X=$([S[8],S[9],S[10]],[P[8],P[9],P[10]],R),re=Ap([S[12],S[13],S[14]],[P[12],P[13],P[14]],R);return[W[0],W[1],W[2],0,K[0],K[1],K[2],0,X[0],X[1],X[2],0,re[0],re[1],re[2],1]}(v,k,g)}return v}function Kie(f,c,u,g){const v=on.projectAabbCorners(g,u);let k=Number.MAX_VALUE;for(let P=0;P0||Se===0&&se[0]*fe[0]+se[1]*fe[1]>=0&&se[0]*se[0]+se[1]*se[1]>fe[0]*fe[0]+fe[1]*fe[1])&&(W=re)}K=W}while(K!==$);return R.length>0&&R.push(R[0]),R}(v);if(sa(f,S))return k}const Xv=64,PN={CoordinateSpaceTile:1,HasMapboxMeshFeatures:4,HasMeshoptCompression:8};function d6(f,c,u,g,v,k,S,P,R,$=!1){const W=u.zoom,K=u.project(g),X=ve(g.lat,W),re=1/X;A(f),L(f,f,[K.x+S[0]*re,K.y+S[1]*re,S[2]]);let se=1,fe=1;const Se=u.worldSize;if($){if(u.projection.name==="mercator"){let Ke=0;u.elevation&&(Ke=u.elevation.getAtPointOrZero(new Ve(K.x/Se,K.y/Se),0));const ht=gt([],[K.x,K.y,Ke,1],u.projMatrix)[3]/u.cameraToCenterDistance;se=ht,fe=ht*ve(u.center.lat,W)}else if(u.projection.name==="globe"){const Ke=c6(f,u),ht=[0,0,0,1];gt(ht,ht,T([],u.projMatrix,Ke));const ot=ht[3]/u.cameraToCenterDistance,_t=Yy(W),Ct=u.projection.pixelsPerMeter(g.lat,Se)*ve(g.lat,W),Et=u.projection.pixelsPerMeter(u.center.lat,Se)*ve(u.center.lat,W);se=ot/Fn(Ct,we(u.center.lat),_t),fe=ot*X/Ct,se*=Et,fe*=Et}}else se=re;z(f,f,[se,se,fe]);const ke=[...f],Fe=c.orientation,$e=[];if(sve($e,[Fe[0]+(v?v[0]:0),Fe[1]+(v?v[1]:0),Fe[2]+(v?v[2]:0)],k),T(f,ke,$e),P&&u.elevation){let Ke=0;const ht=[];if(R&&u.elevation){Ke=function(_t,Ct,Et,Kt,Rt){const rr=Ct.elevation;if(!rr)return 0;const or=on.projectAabbCorners(Et,Kt),lr=Y(1,Rt.lat)*Ct.worldSize,xr=function(Kr,tn){const gs=[0,0,1],jr=[{corners:[0,1,3,2],dotProductWithUp:0},{corners:[1,5,2,6],dotProductWithUp:0},{corners:[0,4,1,5],dotProductWithUp:0},{corners:[2,6,3,7],dotProductWithUp:0},{corners:[4,7,5,6],dotProductWithUp:0},{corners:[0,3,4,7],dotProductWithUp:0}];for(const rn of jr){const qn=Kr[rn.corners[0]],Ds=Kr[rn.corners[1]],$s=Kr[rn.corners[2]],ns=[Ds[0]-qn[0],Ds[1]-qn[1],tn*(Ds[2]-qn[2])],Ba=et(ns,ns,[$s[0]-qn[0],$s[1]-qn[1],tn*($s[2]-qn[2])]);Re(Ba,Ba),rn.dotProductWithUp=je(Ba,gs)}return jr.sort((rn,qn)=>rn.dotProductWithUp-qn.dotProductWithUp),jr[0].corners}(or,lr),vr=or[xr[0]],ur=or[xr[1]],pr=or[xr[2]],tr=or[xr[3]],Xt=rr.getAtPointOrZero(new Ve(vr[0]/Ct.worldSize,vr[1]/Ct.worldSize),0),mr=rr.getAtPointOrZero(new Ve(ur[0]/Ct.worldSize,ur[1]/Ct.worldSize),0),Mr=rr.getAtPointOrZero(new Ve(pr[0]/Ct.worldSize,pr[1]/Ct.worldSize),0),wr=rr.getAtPointOrZero(new Ve(tr[0]/Ct.worldSize,tr[1]/Ct.worldSize),0),un=(Xt+wr)/2,Br=(mr+Mr)/2;return un>Br?mr=c.gl.NEAREST_MIPMAP_NEAREST}),f.uploaded=!0,f.image=null)}function QUe(f,c,u){f.indexBuffer=c.createIndexBuffer(f.indexArray,!1,!0),f.vertexBuffer=c.createVertexBuffer(f.vertexArray,HUe.members,!1,!0),f.normalArray&&(f.normalBuffer=c.createVertexBuffer(f.normalArray,ZUe.members,!1,!0)),f.texcoordArray&&(f.texcoordBuffer=c.createVertexBuffer(f.texcoordArray,KUe.members,!1,!0)),f.colorArray&&(f.colorBuffer=c.createVertexBuffer(f.colorArray,(f.colorArray.bytesPerElement===12?WUe:GUe).members,!1,!0)),f.featureArray&&(f.pbrBuffer=c.createVertexBuffer(f.featureArray,XUe.members,!0)),f.segments=Oi.simpleSegment(0,0,f.vertexArray.length,f.indexArray.length);const g=f.material;g.pbrMetallicRoughness.baseColorTexture&&K5(g.pbrMetallicRoughness.baseColorTexture,c),g.pbrMetallicRoughness.metallicRoughnessTexture&&K5(g.pbrMetallicRoughness.metallicRoughnessTexture,c),g.normalTexture&&K5(g.normalTexture,c),g.occlusionTexture&&K5(g.occlusionTexture,c,u),g.emissionTexture&&K5(g.emissionTexture,c)}function Zie(f,c,u){if(f.meshes)for(const g of f.meshes)QUe(g,c,u);if(f.children)for(const g of f.children)Zie(g,c,u)}function u6(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)u6(c)}function Yie(f){if(f.meshes)for(const u of f.meshes)u.vertexBuffer&&(u.vertexBuffer.destroy(),u.indexBuffer.destroy(),u.normalBuffer&&u.normalBuffer.destroy(),u.texcoordBuffer&&u.texcoordBuffer.destroy(),u.colorBuffer&&u.colorBuffer.destroy(),u.pbrBuffer&&u.pbrBuffer.destroy(),u.segments.destroy(),u.material&&((c=u.material).pbrMetallicRoughness.baseColorTexture&&c.pbrMetallicRoughness.baseColorTexture.gfxTexture&&c.pbrMetallicRoughness.baseColorTexture.gfxTexture.destroy(),c.pbrMetallicRoughness.metallicRoughnessTexture&&c.pbrMetallicRoughness.metallicRoughnessTexture.gfxTexture&&c.pbrMetallicRoughness.metallicRoughnessTexture.gfxTexture.destroy(),c.normalTexture&&c.normalTexture.gfxTexture&&c.normalTexture.gfxTexture.destroy(),c.emissionTexture&&c.emissionTexture.gfxTexture&&c.emissionTexture.gfxTexture.destroy(),c.occlusionTexture&&c.occlusionTexture.gfxTexture&&c.occlusionTexture.gfxTexture.destroy()));var c;if(f.children)for(const u of f.children)Yie(u)}function Qv(f,c){const u=f.json.bufferViews[c.bufferView],g=a6[c.componentType];return new g(f.buffers[u.buffer],(c.byteOffset||0)+(u.byteOffset||0),c.count*(u.byteStride&&u.byteStride!==W5[c.type]*g.BYTES_PER_ELEMENT?u.byteStride/g.BYTES_PER_ELEMENT:W5[c.type]))}function Xie(f,c,u,g){const v=a6[c.componentType],k=function(W){switch(W){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:return 1}}(v),S=f.json.bufferViews[c.bufferView],P=S.byteStride?S.byteStride/v.BYTES_PER_ELEMENT:W5[c.type],R=u.float32,$=R.length/u.capacity;for(let W=0,K=0;W0){for(let Se=0;Se0){k.texcoordArray=new kf;const X=c.json.accessors[v.TEXCOORD_0];k.texcoordArray.resize(X.count);const re=Qv(c,X);Xie(c,X,k.texcoordArray,re)}if(v._FEATURE_ID_RGBA4444!==void 0){const X=c.json.accessors[v._FEATURE_ID_RGBA4444];c.json.extensionsUsed&&c.json.extensionsUsed.includes("EXT_meshopt_compression")&&(k.featureData=Qv(c,X))}v._FEATURE_RGBA4444!==void 0&&(k.featureData=new Uint32Array(Qv(c,c.json.accessors[v._FEATURE_RGBA4444]).buffer));const K=f.material;return k.material=function(X,re){const{emissiveFactor:se=[0,0,0],alphaMode:fe="OPAQUE",alphaCutoff:Se=.5,normalTexture:ke,occlusionTexture:Fe,emissiveTexture:$e,doubleSided:Ke,name:ht}=X,{baseColorFactor:ot=[1,1,1,1],metallicFactor:_t=1,roughnessFactor:Ct=1,baseColorTexture:Et,metallicRoughnessTexture:Kt}=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:ht,pbrMetallicRoughness:{baseColorFactor:new Sa(...ot),metallicFactor:_t,roughnessFactor:Ct,baseColorTexture:Et?re[Et.index]:void 0,metallicRoughnessTexture:Kt?re[Kt.index]:void 0},doubleSided:Ke,emissiveFactor:new Sa(...se),alphaMode:fe,alphaCutoff:Se,normalTexture:ke?re[ke.index]:void 0,occlusionTexture:Rt,emissionTexture:$e?re[$e.index]:void 0,defined:X.defined===void 0}}(K!==void 0?c.json.materials[K]:{defined:!1},u),k}function ive(f,c,u){const{matrix:g,rotation:v,translation:k,scale:S,mesh:P,extras:R,children:$,name:W}=f,K={};if(K.name=W,K.localMatrix=g||function(X,re,se,fe){var Se=re[0],ke=re[1],Fe=re[2],$e=re[3],Ke=Se+Se,ht=ke+ke,ot=Fe+Fe,_t=Se*Ke,Ct=Se*ht,Et=Se*ot,Kt=ke*ht,Rt=ke*ot,rr=Fe*ot,or=$e*Ke,lr=$e*ht,xr=$e*ot,vr=fe[0],ur=fe[1],pr=fe[2];return X[0]=(1-(Kt+rr))*vr,X[1]=(Ct+xr)*vr,X[2]=(Et-lr)*vr,X[3]=0,X[4]=(Ct-xr)*ur,X[5]=(1-(_t+rr))*ur,X[6]=(Rt+or)*ur,X[7]=0,X[8]=(Et+lr)*pr,X[9]=(Rt-or)*pr,X[10]=(1-(_t+Kt))*pr,X[11]=0,X[12]=se[0],X[13]=se[1],X[14]=se[2],X[15]=1,X}([],v||[0,0,0,1],k||[0,0,0],S||[1,1,1]),K.globalMatrix=N(K.localMatrix),P!==void 0){K.meshes=u[P];const X=K.anchor=[0,0];for(const re of K.meshes){const{min:se,max:fe}=re.aabb;X[0]+=se[0]+fe[0],X[1]+=se[1]+fe[1]}X[0]=Math.floor(X[0]/K.meshes.length/2),X[1]=Math.floor(X[1]/K.meshes.length/2)}if(R&&(R.id&&(K.id=R.id),R.lights&&(K.lights=function(X){if(!X.length)return[];const re=function(Fe){const $e=atob(Fe),Ke=new Uint8Array($e.length);for(let ht=0;ht<$e.length;ht++)Ke[ht]=$e.codePointAt(ht);return Ke}(X),se=[],fe=re.length/24,Se=new Uint16Array(re.buffer),ke=new Float32Array(re.buffer);for(let Fe=0;Fe1&&g[g.length-1].equals(g[0])&&g.pop();let v=0;for(let S=0;S0&&g.reverse();const k=CN(g.flatMap(S=>[S.x,S.y]),[]);return k.length===0?null:{vertices:g,indices:k}}function rqe(f,c){const u=[],g=[];let v=0;const k=[];for(const S of f){v=u.length;const P=S.vertexArray.float32,R=S.indexArray.uint16;for(let $=0;$0&&([g[S+1],g[S+2]]=[g[S+2],g[S+1]])}return{vertices:u,indices:g}}function Qie(f){const c=function(R,$){const W=[],K=WebGL2RenderingContext;if(R.json.textures)for(const X of R.json.textures){const re={magFilter:K.LINEAR,minFilter:K.NEAREST,wrapS:K.REPEAT,wrapT:K.REPEAT};X.sampler!==void 0&&Object.assign(re,R.json.samplers[X.sampler]),W.push({image:$[X.source],sampler:re,uploaded:!1})}return W}(f,f.images),u=function(R,$){const W=[];for(const K of R.json.meshes){const X=[];for(const re of K.primitives)X.push(JUe(re,R,$));W.push(X)}return W}(f,c),{scenes:g,scene:v,nodes:k}=f.json,S=g?g[v||0].nodes:[...k.keys()],P=[];for(const R of S)P.push(ive(k[R],f,u));return function(R,$,W){const K={},X=new Set;for(let re=0;re0){const re=Array.from(X.values()).sort((se,fe)=>se-fe);for(let se=re.length-1;se>=0;se--)R.splice(re[se],1)}}(P,S,f.json.nodes),P}function nqe(f){f.heightmap=new Float32Array(4096),f.heightmap.fill(-1);const c=f.vertexArray.float32,u=f.aabb.min[0]-1,g=f.aabb.min[1]-1,v=Xv/(f.aabb.max[0]-u+2),k=Xv/(f.aabb.max[1]-g+2);for(let S=0;Sf.heightmap[$*Xv+R]&&(f.heightmap[$*Xv+R]=P)}}function ove(f,c,u,g,v){u.reserve(u.length+4*f.length),g.reserve(g.length+10*f.length),v.reserve(v.length+10*f.length);let k=g.length;for(const S of f){const P=Math.min(10,Math.max(4,1.3*S.height))*c,R=[-S.normal[1],S.normal[0],0],$=Math.min(.29,.1*S.width/S.depth),W=S.width-2*S.depth*c*($+.01),K=Le([],S.pos,R,W/2),X=Le([],S.pos,R,-W/2),re=[K[0],K[1],K[2]+S.height],se=[X[0],X[1],X[2]+S.height],fe=Le([],S.normal,R,$);me(fe,fe,P);const Se=Le([],S.normal,R,-$);me(Se,Se,P),ue(fe,K,fe),ue(Se,X,Se),K[2]+=.1,X[2]+=.1,g.emplaceBack(fe[0],fe[1],fe[2]),g.emplaceBack(Se[0],Se[1],Se[2]),g.emplaceBack(K[0],K[1],K[2]),g.emplaceBack(X[0],X[1],X[2]),g.emplaceBack(re[0],re[1],re[2]),g.emplaceBack(se[0],se[1],se[2]),g.emplaceBack(K[0],K[1],K[2]),g.emplaceBack(X[0],X[1],X[2]),g.emplaceBack(fe[0],fe[1],fe[2]),g.emplaceBack(Se[0],Se[1],Se[2]);const ke=W/P/2;v.emplaceBack(-ke-$,-1,ke,.8),v.emplaceBack(ke+$,-1,ke,.8),v.emplaceBack(-ke,0,ke,1.3),v.emplaceBack(ke,0,ke,1.3),v.emplaceBack(ke+$,-.8,ke,.7),v.emplaceBack(ke+$,-.8,ke,.7),v.emplaceBack(0,0,ke,1.3),v.emplaceBack(0,0,ke,1.3),v.emplaceBack(ke+$,-1.2,ke,.8),v.emplaceBack(ke+$,-1.2,ke,.8),u.emplaceBack(6+k,4+k,8+k),u.emplaceBack(7+k,9+k,5+k),u.emplaceBack(0+k,1+k,2+k),u.emplaceBack(1+k,3+k,2+k),k+=10}}function sqe(f,c){const u={};u.indexArray=new Uo,u.vertexArray=new vu,u.colorArray=new Um,ove(f,c,u.indexArray,u.vertexArray,u.colorArray);const g={defined:!0};g.emissiveFactor=Sa.black;const v={};return v.baseColorFactor=Sa.white,g.pbrMetallicRoughness=v,u.material=g,u.aabb=new on([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),u}const lve=Ts([{name:"a_pos_3f",components:3,type:"Float32"}]),aqe=Ts([{name:"a_normal_3",components:3,type:"Int16"}]),iqe=Ts([{name:"a_centroid_3",components:3,type:"Int16"}]),cve=Ts([{name:"a_part_color_emissive",components:2,type:"Uint16"}]),oqe=Ts([{name:"a_faux_facade_color_emissive",components:2,type:"Uint16"}]),lqe=Ts([{name:"a_faux_facade_data",components:4,type:"Uint16"}]),cqe=Ts([{name:"a_faux_facade_vertical_range",components:2,type:"Uint16"}]),dqe=Ts([{name:"a_bloom_attenuation",components:4,type:"Float32"}]),uqe=Ts([{name:"a_flood_light_wall_radius_1i16",components:1,type:"Uint16"}]),dve=Lt.types,h6=32767;function hqe(f,c){const u=Sr+c;for(const g of f)for(const v of g)if(v.x<-c||v.x>u||v.y<-c||v.y>u)return!1;return!0}function fqe(f){switch(f){case"flat":return 3;case"hipped":return 1;case"gabled":return 2;case"parapet":return 0;case"mansard":return 4;case"skillion":return 5;case"pyramidal":return 6;default:throw new Error(`Unknown roof shape: ${f}`)}}class Jie{constructor(){this.layoutVertexArray=new vu,this.layoutAttenuationArray=new Um,this.layoutColorArray=new _u,this.indexArray=new Uo,this.indexArrayForConflation=new Uo,this.segmentsBucket=new Oi}}class eoe{constructor(c){this.layoutFacadePaintArray=null,this.layoutFacadeDataArray=null,this.layoutFacadeVerticalRangeArray=null,this.segmentsBucket=new Oi,this.entranceBloom=new Jie;const u=66560;this.layoutVertexArray=new vu,this.layoutVertexArray.reserve(u),this.layoutNormalArray=new $y,this.layoutNormalArray.reserve(u),this.layoutCentroidArray=new $y,this.layoutCentroidArray.reserve(u),this.layoutColorArray=new _u,this.layoutColorArray.reserve(u),this.layoutFloodLightDataArray=new qm,this.layoutFloodLightDataArray.reserve(u),this.layoutAOArray=new mN,this.layoutAOArray.reserve(u),this.indexArray=new Uo,this.indexArray.reserve(66560),this.indexArrayForConflation=new Uo,this.segmentsBucket=new Oi,this.entranceBloom=new Jie,c&&(this.layoutFacadePaintArray=new _u,this.layoutFacadeDataArray=new sx,this.layoutFacadeVerticalRangeArray=new _u)}reserve(c,u,g){this.layoutVertexArray.reserveForAdditional(c),this.layoutCentroidArray.reserveForAdditional(c),this.layoutFloodLightDataArray.reserveForAdditional(c),this.layoutNormalArray.reserveForAdditional(c),this.layoutAOArray.reserveForAdditional(c),this.layoutColorArray.reserveForAdditional(c),this.indexArray.reserveForAdditional(u),g&&(this.layoutFacadePaintArray.reserveForAdditional(c),this.layoutFacadeDataArray.reserveForAdditional(c),this.layoutFacadeVerticalRangeArray.reserveForAdditional(c))}}class uve{constructor(c){this.colorBufferUploaded=!1,this.maxHeight=0,this.replacementUpdateTime=0,this.activeReplacements=[],this.footprints=[],this.footprintsVertices=new kf,this.footprintsIndices=new qm,this.footprintsMin=new ir(1/0,1/0),this.footprintsMax=new ir(-1/0,-1/0),this.featuresOnBorder=[],this.buildingWithoutFacade=new eoe(!1),this.buildingWithFacade=new eoe(!0),this.indexArrayForConflationUploaded=!1,this.featureFootprintLookup=new Map,this.buildingIds=new Set,this.footprintLookup={},this.zoom=c.zoom,this.canonical=c.canonical,this.layers=c.layers,this.layerIds=this.layers.map(u=>u.fqid),this.index=c.index,this.hasPattern=!1,this.worldview=c.worldview,this.lut=c.lut,this.programConfigurations=new Oh(c.layers,{zoom:c.zoom,lut:c.lut}),this.stateDependentLayerIds=this.layers.filter(u=>u.isStateDependent()).map(u=>u.id),this.projection=c.projection,this.groundEffect=new Die(c),this.groundEffect.groundRadiusArray=new jp,this.hasAppearances=null}updateFootprints(c,u){const g=new XP([],[],1),v={vertices:[],indices:new Uint32Array(0),grid:g,min:this.footprintsMin,max:this.footprintsMax,buildingIds:this.buildingIds};u.push({footprint:v,id:c})}updateAppearances(c,u,g,v){}prepare(){return function(){if(s6!=null||H1e!=null)return null;if(IN!=null)return IN;const c=fetch(Ss.BUILDING_GEN_URL);return IN=function(u){let g,v,k,S,P;function R(){g=new Uint8Array(P.buffer),v=new Int16Array(P.buffer),k=new Int32Array(P.buffer),S=new Float32Array(P.buffer)}function $(){throw new Error("Unexpected BuildingGen error.")}const W=()=>{},K={a:{a:$,f:function(X){const re=g.length,se=Math.max(X>>>0,Math.ceil(1.2*re)),fe=Math.ceil((se-re)/65536);try{return P.grow(fe),R(),!0}catch{return!1}},g:$,b:W,c:W,d:W,e:W}};return(WebAssembly.instantiateStreaming?WebAssembly.instantiateStreaming(u,K):u.then(X=>X.arrayBuffer()).then(X=>WebAssembly.instantiate(X,K))).then(X=>{const re=X.instance.exports;return(0,re.g)(),P=re.f,R(),new FUe({setStyle:re.h,setAOOptions:re.i,setMetricOptions:re.j,setStructuralOptions:re.k,setFacadeOptions:re.l,setFauxFacadeOptions:re.m,setFacadeClassifierOptions:re.n,addFeature:re.o,addFacade:re.p,generateMesh:re.q,getLastError:re.r,getOuterRingLength:re.s,getMeshCount:re.t,getPositionsPtr:re.u,getPositionsLength:re.v,getNormalsPtr:re.w,getNormalsLength:re.x,getAOPtr:re.y,getAOLength:re.z,getUVPtr:re.A,getUVLength:re.B,getFauxFacadePtr:re.C,getFauxFacadeLength:re.D,getIndicesPtr:re.E,getIndicesLength:re.F,getBuildingPart:re.G,getRingCount:re.H,getRingPtr:re.I,getRingLength:re.J,malloc:re.K,free:re.L,heapU8:g,heap16:v,heap32:k,heapF32:S})})}(c).then(u=>(IN=null,s6=u,s6)).catch(u=>{Ur("Could not load building-gen"),IN=null,H1e=u}),IN}()}populate(c,u,g,v){const k=zUe();if(!k)return;const S=Pe(g);this.tileToMeter=S,this.brightness=u.brightness,k.setStyle({normalScale:[1,-1,S],tileToMeters:S}),k.setAOOptions(!1,.3),k.setMetricOptions(!1,16),k.setStructuralOptions(!0),k.setFacadeClassifierOptions(3);const P=new Map,R=new Map;let $=0;for(const{feature:ke}of c){if(dve[ke.type]!=="LineString"){P.set(ke.id,ke.properties.source_id);continue}const Fe=this.layers[0]._featureFilter.needGeometry;if(Fe&&!this.layers[0]._featureFilter.filter(new ti(this.zoom),ke,g))continue;const $e=Dt(ke,Fe);if(!Fe&&!this.layers[0]._featureFilter.filter(new ti(this.zoom),$e,g))continue;const Ke=Fe?$e.geometry:St(ke,g,v),ht=[];for(const Et of Ke)for(const Kt of Et)ht.push(Kt.x),ht.push(Kt.y);const ot={coordinates:ht,crossPerc:ke.properties.cross_perc,distanceToRoad:ke.properties.distance_to_road,entrances:ke.properties.entrances,sourceId:0},_t=ke.properties.source_id;let Ct=R.get(_t);Ct||(Ct=[],R.set(_t,Ct)),Ct.push(ot),++$}this.maxHeight=0;const W=new Array,K=new Set,X=ke=>{ke!=null&&K.add(ke)},re=(ke,Fe)=>{ke!=null&&W.push({buildingId:ke,footprintIndex:Fe})},se=64*(c.length-$),fe=se/2;this.buildingWithFacade.reserve(se,fe,!0),this.buildingWithoutFacade.reserve(2*se,2*fe,!1),this.footprintsIndices.reserve(16*(c.length-$)),this.footprintsVertices.reserve(8*(c.length-$));for(const{feature:ke,id:Fe,index:$e,sourceLayerIndex:Ke}of c){if(dve[ke.type]==="LineString")continue;const ht=this.layers[0]._featureFilter.needGeometry;if(ht&&!this.layers[0]._featureFilter.filter(new ti(this.zoom),ke,g))continue;let ot=null;if(ke.properties&&ke.properties.hasOwnProperty("building_id")&&(ot=ke.properties.building_id,K.has(ot)))continue;const _t=Dt(ke,ht);if(!ht&&!this.layers[0]._featureFilter.filter(new ti(this.zoom),_t,g))continue;const Ct=ht?_t.geometry:St(ke,g,v),Et=R5(Ct,500);let Kt=!1;for(const In of Et)if(In.length!==1){Kt=!0;break}if(Kt){X(ot);continue}if(!hqe(Ct,163)){X(ot);continue}const Rt=this.layers[0],rr=fqe(Rt.layout.get("building-roof-shape").evaluate(ke,{},g)),or=Rt.layout.get("building-base").evaluate(ke,{},g),lr=Rt.layout.get("building-height").evaluate(ke,{},g),xr=Rt.layout.get("building-flood-light-ground-radius").evaluate(ke,{},g),vr=Rt.paint.get("building-ambient-occlusion-intensity"),ur=xr/this.tileToMeter;ke.properties["building-part"]="roof";const pr=Rt.paint.get("building-color").evaluate(ke,{},this.canonical).toPremultipliedRenderColor(this.lut),tr=Rt.paint.get("building-emissive-strength").evaluate(ke,{},this.canonical);ke.properties["building-part"]="wall";const Xt=Rt.paint.get("building-color").evaluate(ke,{},this.canonical).toPremultipliedRenderColor(this.lut),mr=Rt.paint.get("building-emissive-strength").evaluate(ke,{},this.canonical);ke.properties["building-part"]="window";const Mr=Rt.paint.get("building-color").evaluate(ke,{},this.canonical).toPremultipliedRenderColor(this.lut),wr=Rt.paint.get("building-emissive-strength").evaluate(ke,{},this.canonical);ke.properties["building-part"]="door";const un=Rt.paint.get("building-color").evaluate(ke,{},this.canonical).toPremultipliedRenderColor(this.lut),Br=Rt.paint.get("building-emissive-strength").evaluate(ke,{},this.canonical);let Kr=Rt.layout.get("building-flood-light-wall-radius").evaluate(ke,{},g);Kr=xe(Kr,0,2048);const tn=Kr/2048*h6,gs=P.get(Fe),jr=R.get(gs)||[],rn=jr.length!==0&&Rt.layout.get("building-facade").evaluate(ke,{},g);k.setFacadeOptions(4,!0),k.setFauxFacadeOptions(rn,!1,1);let qn=0,Ds=0,$s=0,ns=0,Ba=0,lt=0,pt=0,nr=0,yr=0,Or=0,Dr=0;if(rn){let In=Math.round(Rt.layout.get("building-facade-floors").evaluate(ke,{},g));if(or===0){In=Math.max(1,In-(jr.length>0?1:0));let Ta=4;if(lr>100){const xi=[10,13,15];Ta=xi[ke.id?ke.id%xi.length:0]}else lr<=10&&(Ta=3);k.setFacadeOptions(Ta,!0),Ba=(lr<15?1.3:1.61803)*Ta/S}else Ba=or/S;lt=lr/S,Ba=Math.min(Ba,lt),$s=Rt.layout.get("building-facade-unit-width").evaluate(ke,{},g)/S,ns=(lt-Ba)/In,k.setFauxFacadeOptions(!0,!0,$s);const Fi=Rt.layout.get("building-facade-window").evaluate(ke,{},g);qn=Fi[0],Ds=Fi[1],pt=Math.floor(65535*Math.min(1,Ba/Sr)),nr=Math.floor(65535*Math.min(1,lt/Sr)),yr=Math.floor(255*qn)<<8|Math.floor(255*Ds),Or=Math.floor(65535*Math.min(1,$s/Sr)),Dr=Math.floor(65535*Math.min(1,ns/Sr))}const hn=Array(Et.length),vn={x:1/0,y:1/0},Qn={x:-1/0,y:-1/0},cs={x:0,y:0};let ms=0;for(let In=0;In0){const Ta=[],xi=Array(Fi.length+1);xi[0]=0;for(let Ho=0;HoSr||vn.y<0||Qn.y>Sr)&&this.featuresOnBorder.push({featureId:ke.id,footprintIndex:this.footprints.length});{const In=CN(qa,null,2);this.footprintsIndices.resize(this.footprintsIndices.length+In.length),this.footprintsIndices.uint16.set(In,En),this.buildingIds.add(ot??ke.id),this.footprintsMin.x=Math.min(this.footprintsMin.x,Qa.x),this.footprintsMin.y=Math.min(this.footprintsMin.y,Qa.y),this.footprintsMax.x=Math.max(this.footprintsMax.x,ri.x),this.footprintsMax.y=Math.max(this.footprintsMax.y,ri.y);const Fi={footprintVertexOffset:Es,footprintVertexLength:this.footprintsVertices.length-Es,footprintIndexOffset:En,footprintIndexLength:this.footprintsIndices.length-En,min:Qa,max:ri,hiddenFlags:0,indicesOffset:_a,indicesLength:Ci,bloomIndicesOffset:Ma,bloomIndicesLength:Ga,groundEffectVertexOffset:oo,groundEffectVertexLength:Ja,hasFauxFacade:rn,height:ds,promoteId:Fe,feature:_t,parts:oa,buildingBloom:la},Ta=this.footprints.length;ke.id!==void 0&&this.featureFootprintLookup.set(ke.id,Ta),re(ot,Ta),this.footprints.push(Fi)}this.programConfigurations.populatePaintArrays(Ln.layoutVertexArray.length,ke,$e,{},u.availableImages,g,u.brightness),this.groundEffect.addPaintPropertiesData(ke,$e,{},u.availableImages,g,u.brightness),u.featureIndex.insert(ke,Ct,$e,Ke,this.index,$a)}W.forEach(({buildingId:ke,footprintIndex:Fe})=>{K.has(ke)&&(this.footprints[Fe].hiddenFlags|=4)});const Se=new Set;this.buildingIds.forEach((ke,Fe,$e)=>{K.has(ke)||Se.add(ke)}),this.buildingIds=Se,this.groundEffect.prepareBorderSegments()}update(c,u,g,v,k,S,P){this.programConfigurations.updatePaintArrays(c,u,k,g,v,S,P),this.groundEffect.update(c,u,k,g,v,S,P),this.evaluate(this.layers[0],c),this.colorBufferUploaded=!1}isEmpty(){return this.buildingWithoutFacade.layoutVertexArray.length===0&&this.buildingWithFacade.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload||this.groundEffect.programConfigurations.needsUpload}upload(c){const u=g=>{g.layoutVertexBuffer=c.createVertexBuffer(g.layoutVertexArray,lve.members),g.layoutNormalBuffer=c.createVertexBuffer(g.layoutNormalArray,aqe.members),g.layoutCentroidBuffer=c.createVertexBuffer(g.layoutCentroidArray,iqe.members),g.layoutFloodLightDataBuffer=c.createVertexBuffer(g.layoutFloodLightDataArray,uqe.members),g.layoutFacadeDataArray&&g.layoutFacadeDataArray.length&&(g.layoutFacadeDataBuffer=c.createVertexBuffer(g.layoutFacadeDataArray,lqe.members)),g.layoutFacadeVerticalRangeArray&&g.layoutFacadeVerticalRangeArray.length&&(g.layoutFacadeVerticalRangeBuffer=c.createVertexBuffer(g.layoutFacadeVerticalRangeArray,cqe.members)),g.entranceBloom.layoutVertexArray.length&&(g.entranceBloom.layoutVertexBuffer=c.createVertexBuffer(g.entranceBloom.layoutVertexArray,lve.members),g.entranceBloom.layoutAttenuationBuffer=c.createVertexBuffer(g.entranceBloom.layoutAttenuationArray,dqe.members)),this.uploadUpdatedColorBuffer(c),this.uploadUpdatedIndexBuffer(c)};this.uploaded||(u(this.buildingWithoutFacade),u(this.buildingWithFacade),this.groundEffect.upload(c)),this.groundEffect.uploadPaintProperties(c),this.programConfigurations.upload(c),this.uploaded=!0}destroy(){const c=u=>{u.layoutVertexBuffer&&(u.layoutVertexBuffer.destroy(),u.layoutNormalBuffer.destroy(),u.layoutColorBuffer.destroy(),u.segmentsBucket.destroy(),u.indexBuffer&&u.indexBuffer.destroy(),u.entranceBloom.layoutVertexBuffer&&(u.entranceBloom.layoutVertexBuffer.destroy(),u.entranceBloom.layoutColorBuffer.destroy(),u.entranceBloom.layoutAttenuationBuffer.destroy(),u.entranceBloom.indexBuffer.destroy(),u.entranceBloom.segmentsBucket.destroy()))};c(this.buildingWithoutFacade),c(this.buildingWithFacade),this.groundEffect.destroy(),this.programConfigurations.destroy()}updateFootprintHiddenFlags(c,u,g=!0){let v=!1;const k=g?u:0,S=0|(g?-1:~u);this.groundEffect.hiddenByLandmarkVertexArray.length===0&&this.groundEffect.hiddenByLandmarkVertexArray.resize(this.groundEffect.vertexArray.length);for(const P of c){const R=this.footprints[P],$=R.hiddenFlags&S|k;R.hiddenFlags!==$&&(R.hiddenFlags=$,v=!0,this.groundEffect.updateHiddenByLandmarkRange(R.groundEffectVertexOffset,R.groundEffectVertexLength,R.hiddenFlags!==0))}return v&&(this.indexArrayForConflationUploaded=!1),v}uploadUpdatedIndexBuffer(c){if(this.groundEffect.uploadHiddenByLandmark(c),this.indexArrayForConflationUploaded)return;const u=v=>{v.indexArray.length!==0&&(v.indexArrayForConflation.resize(v.indexArray.length),v.indexArrayForConflation.uint16.set(v.indexArray.uint16),v.entranceBloom.indexArrayForConflation.resize(v.entranceBloom.indexArray.length),v.entranceBloom.indexArrayForConflation.uint16.set(v.entranceBloom.indexArray.uint16))};u(this.buildingWithoutFacade),u(this.buildingWithFacade);for(const v of this.footprints){const k=v.hasFauxFacade?this.buildingWithFacade:this.buildingWithoutFacade,S=v.indicesOffset+v.indicesLength;if(v.hiddenFlags!==0){for(let R=v.indicesOffset;R{v.indexArray.length!==0&&(v.indexBuffer?v.indexBuffer.updateData(v.indexArrayForConflation):v.indexBuffer=c.createIndexBuffer(v.indexArrayForConflation,!0),v.entranceBloom.indexBuffer?v.entranceBloom.indexBuffer.updateData(v.entranceBloom.indexArrayForConflation):v.entranceBloom.indexBuffer=c.createIndexBuffer(v.entranceBloom.indexArrayForConflation,!0))};g(this.buildingWithoutFacade),g(this.buildingWithFacade),this.indexArrayForConflationUploaded=!0}uploadUpdatedColorBuffer(c){const u=g=>{g.layoutColorBuffer?g.layoutColorBuffer.updateData(g.layoutColorArray):g.layoutColorBuffer=c.createVertexBuffer(g.layoutColorArray,cve.members,!0),g.layoutFacadePaintArray&&(g.layoutFacadePaintBuffer?g.layoutFacadePaintBuffer.updateData(g.layoutFacadePaintArray):g.layoutFacadePaintBuffer=c.createVertexBuffer(g.layoutFacadePaintArray,oqe.members,!0)),g.entranceBloom.layoutColorBuffer?g.entranceBloom.layoutColorBuffer.updateData(g.entranceBloom.layoutColorArray):g.entranceBloom.layoutColorBuffer=c.createVertexBuffer(g.entranceBloom.layoutColorArray,cve.members,!0)};u(this.buildingWithoutFacade),u(this.buildingWithFacade),this.colorBufferUploaded=!0}evaluate(c,u){const g=c.paint.get("building-ambient-occlusion-intensity");for(const v of this.footprints){if(4&v.hiddenFlags)continue;const k=u[v.promoteId],S=v.feature;S.properties["building-part"]="roof";const P=c.paint.get("building-color").evaluate(S,k,this.canonical).toPremultipliedRenderColor(this.lut),R=c.paint.get("building-emissive-strength").evaluate(S,k,this.canonical);S.properties["building-part"]="wall";const $=c.paint.get("building-color").evaluate(S,k,this.canonical).toPremultipliedRenderColor(this.lut),W=c.paint.get("building-emissive-strength").evaluate(S,k,this.canonical);S.properties["building-part"]="window";const K=c.paint.get("building-color").evaluate(S,k,this.canonical).toPremultipliedRenderColor(this.lut),X=c.paint.get("building-emissive-strength").evaluate(S,k,this.canonical);S.properties["building-part"]="door";const re=c.paint.get("building-color").evaluate(S,k,this.canonical).toPremultipliedRenderColor(this.lut),se=c.paint.get("building-emissive-strength").evaluate(S,k,this.canonical),fe=v.hasFauxFacade?this.buildingWithFacade:this.buildingWithoutFacade;for(const ke of v.parts){let Fe,$e=P;ke.part===1?($e=P,Fe=R):ke.part===0?($e=$,Fe=W):ke.part===2?($e=K,Fe=X):ke.part===3&&($e=re,Fe=se),Fe=xe(Fe,0,1);for(let Ke=0;KeS.max.x||R.max.xS.max.y||R.max.yP.max.x||P.min.x>c||u>P.max.y||P.min.y>u||P.height<=g||pqe(S,this.footprintsVertices.float32.subarray(2*P.footprintVertexOffset,2*(P.footprintVertexOffset+P.footprintVertexLength)),this.footprintsIndices.uint16.subarray(P.footprintIndexOffset,P.footprintIndexOffset+P.footprintIndexLength))&&(g=P.height,this.footprintLookup[k]=P,v=P.hiddenFlags!==0);if(g!==Number.NEGATIVE_INFINITY)return{height:g,hidden:v};this.footprintLookup[k]=void 0}}function pqe(f,c,u){for(let g=0;g1&&(R=c[++P]);const W=Math.abs($-R.left),K=Math.abs($-R.right),X=Math.min(W,K);let re;const se=k/g*(v+1);if(R.isDash){const fe=v-Math.abs(se);re=Math.sqrt(X*X+fe*fe)}else re=v-Math.sqrt(X*X+se*se);this.image.data[S+$]=Math.max(0,Math.min(255,re+128))}}}addRegularDash(c,u){for(let R=c.length-1;R>=0;--R){const $=c[R],W=c[R+1];$.zeroLength?c.splice(R,1):W&&W.isDash===$.isDash&&(W.left=$.left,c.splice(R,1))}const g=c[0],v=c[c.length-1];g.isDash===v.isDash&&(g.left=v.left-this.width,v.right=g.right+this.width);const k=this.width*this.nextRow;let S=0,P=c[S];for(let R=0;R1&&(P=c[++S]);const $=Math.abs(R-P.left),W=Math.abs(R-P.right),K=Math.min($,W);this.image.data[k+R]=Math.max(0,Math.min(255,(P.isDash?K:-K)+u+128))}}addDash(c,u){const g=this.getKey(c,u);if(this.positions[g])return this.positions[g];const v=u==="round",k=v?7:0,S=2*k+1;if(this.nextRow+S>this.height)return Ur("LineAtlas out of space"),null;c.length===0&&c.push(1);let P=0;for(let W=0;Wu.fqid),this.index=c.index,this.projection=c.projection,this.hasPattern=!1,this.hasCrossSlope=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(u=>{this.gradients[u.id]={}}),this.layoutVertexArray=new lN,this.layoutVertexArray2=new vu,this.patternVertexArray=new vu,this.indexArray=new Uo,this.programConfigurations=new Oh(c.layers,{zoom:c.zoom,lut:c.lut}),this.segments=new Oi,this.maxLineLength=0,this.zOffsetVertexArray=new vu,this.stateDependentLayerIds=this.layers.filter(u=>u.isStateDependent()).map(u=>u.id),this.tessellationStep=c.tessellationStep?c.tessellationStep:Sr/64,this.worldview=c.worldview,this.hasAppearances=null}updateFootprints(c,u){}updateAppearances(c,u,g,v){}populate(c,u,g,v){this.hasPattern=Cie("line",this.layers,this.pixelRatio,u);const k=this.layers[0].layout.get("line-sort-key");this.tileToMeter=Pe(g);const S=this.layers[0].layout.get("line-elevation-reference");if(S==="hd-road-markup")this.elevationType="road";else{const X=this.layers[0].layout.get("line-z-offset"),re=X.isConstant()&&!X.constantOr(0);this.elevationType=S!=="sea"&&S!=="ground"&&re?"none":"offset",this.elevationType==="offset"&&S==="none"&&Ur(`line-elevation-reference: ground is used for the layer ${this.layerIds[0]} because non-zero line-z-offset value was found.`)}const P=this.layers[0].layout.get("line-cross-slope");this.hasCrossSlope=this.elevationType==="offset"&&P!==void 0;const R=[];for(const{feature:X,id:re,index:se,sourceLayerIndex:fe}of c){const Se=this.layers[0]._featureFilter.needGeometry,ke=Dt(X,Se);if(!this.layers[0]._featureFilter.filter(new ti(this.zoom,{worldview:this.worldview,activeFloors:u.activeFloors}),ke,g))continue;const Fe=k?k.evaluate(ke,{},g):void 0,$e={id:re,properties:X.properties,type:X.type,sourceLayerIndex:fe,index:se,geometry:Se?ke.geometry:St(X,g,v),patterns:{},sortKey:Fe};R.push($e)}k&&R.sort((X,re)=>X.sortKey-re.sortKey);const{lineAtlas:$,featureIndex:W}=u,K=this.addConstantDashes($);for(const X of R){const{geometry:re,index:se,sourceLayerIndex:fe}=X;if(K&&this.addFeatureDashes(X,$),this.hasPattern){const Se=Mie("line",this.layers,X,this.zoom,this.pixelRatio,u);this.patternFeatures.push(Se)}else this.addFeature(X,re,se,g,$.positions,u.availableImages,u.brightness,u.elevationFeatures);W.insert(c[se].feature,re,se,fe,this.index)}}addConstantDashes(c){let u=!1;for(const g of this.layers){const v=g.paint.get("line-dasharray").value,k=g.layout.get("line-cap").value;if(v.kind!=="constant"||k.kind!=="constant")u=!0;else{const S=k.value,P=v.value;if(!P)continue;c.addDash(P,S)}}return u}addFeatureDashes(c,u){const g=this.zoom;for(const v of this.layers){const k=v.paint.get("line-dasharray").value,S=v.layout.get("line-cap").value;if(k.kind==="constant"&&S.kind==="constant")continue;let P,R;if(k.kind==="constant"){if(P=k.value,!P)continue}else P=k.evaluate({zoom:g},c);R=S.kind==="constant"?S.value:S.evaluate({zoom:g},c),u.addDash(P,R),c.patterns[v.id]=[u.getKey(P,R)]}}update(c,u,g,v,k,S,P,R){this.programConfigurations.updatePaintArrays(c,u,k,g,v,S,P,R)}addFeatures(c,u,g,v,k,S){for(const P of this.patternFeatures)this.addFeature(P,P.geometry,P.index,u,g,v,S,c.elevationFeatures)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(c){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=c.createVertexBuffer(this.layoutVertexArray2,_qe)),this.patternVertexArray.length!==0&&(this.patternVertexBuffer=c.createVertexBuffer(this.patternVertexArray,wqe)),!this.zOffsetVertexBuffer&&this.zOffsetVertexArray.length>0&&(this.zOffsetVertexBuffer=c.createVertexBuffer(this.zOffsetVertexArray,xqe.members,!0)),this.layoutVertexBuffer=c.createVertexBuffer(this.layoutVertexArray,yqe),this.indexBuffer=c.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(c),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.zOffsetVertexBuffer&&this.zOffsetVertexBuffer.destroy(),this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(c,u){let g,v;if(u&&u>0?(g=`mapbox_clip_start_${u}`,v=`mapbox_clip_end_${u}`):(g="mapbox_clip_start",v="mapbox_clip_end"),c.properties&&c.properties.hasOwnProperty(g)&&c.properties.hasOwnProperty(v))return{start:+c.properties[g],end:+c.properties[v]}}addFeature(c,u,g,v,k,S,P,R){const $=this.layers[0].layout,W=$.get("line-join").evaluate(c,{}),K=$.get("line-cap").evaluate(c,{}),X=$.get("line-miter-limit"),re=$.get("line-round-limit");this.lineClips=this.lineFeatureClips(c),this.lineFeature=c;const se=!(!c.properties||!c.properties.hasOwnProperty("mapbox_line_metrics"))&&c.properties.mapbox_line_metrics;this.zOffsetValue=$.get("line-z-offset").value;const fe=this.layers[0].paint.get("line-width").value;if(fe.kind!=="constant"&&fe.isLineProgressConstant===!1&&(this.variableWidthValue=fe),this.elevationType==="road"){const Se=this.layoutVertexArray.length;if(!this.addElevatedRoadFeature(c,u,v,R,W,K,X,re)){const[ke,Fe]=this.clipRuntimeLinesToTile(u,1);for(let $e=0;$e0?ht.parentIndex:null)}this.fillNonElevatedRoadSegment(Se)}}else for(let Se=0;Se0?Se:null);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,c,g,k,S,v,P,void 0,this.worldview)}computeSegNextDir(c,u){return c.nextPoint.sub(u.at(-2)).unit()}computeSegPrevDir(c,u){return u[1].sub(c.prevPoint).unit()}clipLinesToTile(c,u){return r6(c,-u,-u,Sr+u,Sr+u)}clipRuntimeLinesToTile(c,u){const g=[];return[r6(c,-u,-u,Sr+u,Sr+u,g),g]}addElevatedRoadFeature(c,u,g,v,k,S,P,R){const $=[],W=ya.getElevationFeature(c,v);if(W){const K=this.clipLinesToTile(u,1),X=this.prepareElevatedLines(K,W,g);for(const re of X)$.push({geometry:re,elevation:W,elevationTileID:g,segment:{progress:{min:0,max:1},nextDir:void 0,prevDir:void 0}})}if($.length===0)return!1;for(const K of $){const X=this.layoutVertexArray.length;this.addLine(K.geometry,c,g,k,S,P,R);const re=new Ra(g,K.elevationTileID);if(K.elevation)for(let se=X;se>1,this.layoutVertexArray.int16[6*se+1]>>1),Se=re.pointElevation(fe,K.elevation,.05);this.updateHeightRange(Se),this.zOffsetVertexArray.emplaceBack(Se,0,0)}else this.fillNonElevatedRoadSegment(X)}return!0}prepareElevatedLines(c,u,g){if(u.constantHeight!=null)return c;const v=[],k=1/Pe(g);for(const S of c)OUe(S,new ia(u,k),0,v);return v}fillNonElevatedRoadSegment(c){for(let u=c;u0,X=R&&R.progress.max<1;if(this.lineClips){let Et={min:this.lineClips.start,max:this.lineClips.end},Kt=1;if(R){const or=this.lineClips.end-this.lineClips.start;Et=function(lr,xr,vr){return{min:za(lr.min,xr,vr),max:za(lr.max,xr,vr)}}(R.progress,{min:0,max:1},Et),or>0&&(Kt=(Et.max-Et.min)/or)}const Rt=+u.properties.mapbox_clip_feature_len,rr=+u.properties.mapbox_clip_seg_len;if(Number.isNaN(Rt)||Number.isNaN(rr)){for(let lr=0;lr=2&&c[se-1].equals(c[se-2]);)se--;let fe=0;for(;fe0,tr=this.overscaling<=16?15*Sr/(512*this.overscaling):0;if(Kt&&Rt==="round"){if(xrS&&(Rt="bevel"),Rt==="bevel"&&(xr>2&&(Rt="flipbevel"),xr2*tr){const Mr=ke.sub(ke.sub(Fe)._mult(tr/Xt)._round());this.updateDistance(Fe,Mr),this.addCurrentVertex(Mr,Ke,0,0,Se,Ct),Fe=Mr}this.updateDistance(Fe,ke),or._mult(xr),this.addCurrentVertex(ke,or,0,0,Se,Ct);const mr=ke.dist($e);if(mr>2*tr){const Mr=ke.add($e.sub(ke)._mult(tr/mr)._round());this.updateDistance(ke,Mr),this.addCurrentVertex(Mr,ht,0,0,Se,Ct),ke=Mr}}else or._mult(xr),this.addCurrentVertex(ke,or,0,0,Se,Ct);else if(Rt==="flipbevel"){if(xr>100)or=ht.mult(-1);else{const Xt=xr*Ke.add(ht).mag()/Ke.sub(ht).mag();or._perp()._mult(Xt*(pr?-1:1))}this.addCurrentVertex(ke,or,0,0,Se,Ct),this.addCurrentVertex(ke,or.mult(-1),0,0,Se,Ct)}else if(Rt==="bevel"||Rt==="fakeround"){Ct!=null&&Fe&&this.addCurrentVertex(ke,_t||Ke,-1,-1,Se,Ct);const Xt=ke.dist(Fe)<=2*tr&&Rt!=="bevel",mr=or.mult(pr?1:-1);mr._mult(xr);const Mr=ht.mult(pr?-1:1),wr=Ke.mult(pr?-1:1),un=this.evaluateLineProgressFeatures(this.distance);if(Ct==null&&(this.addHalfVertex(ke,mr.x,mr.y,!1,!pr,0,Se,un),Xt||this.addHalfVertex(ke,mr.x+2*wr.x,mr.y+2*wr.y,!1,pr,0,Se,un)),Rt==="fakeround"){const Br=Math.round(180*vr/Math.PI/20);this.addHalfVertex(ke,wr.x,wr.y,!1,pr,0,Se,un);for(let Kr=0;Kr1){this.lineSoFar=c.w;const fe=(u.x-c.x)/K,Se=(u.y-c.y)/K,ke=(u.z-c.z)/K,Fe=(u.w-c.w)/K;for(let $e=1;$e=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,W),R.primitiveLength++),S?this.e2=W:this.e1=W,$!=null&&this.zOffsetVertexArray.emplaceBack($.zOffset,$.variableWidth,$.variableWidth)}updateScaledDistance(){this.lineClips?(this.scaledDistance=this.distance/this.totalDistance,this.lineSoFar=this.totalFeatureLength*this.lineClips.start+this.distance):this.lineSoFar=this.distance}updateDistance(c,u){this.prevDistance=this.distance,this.distance+=c.dist(u),this.updateScaledDistance()}}function roe(f,c,u){return f.xu||f.yu}let mve,gve;function xve(f,c,u){return c*(Sr/(f.tileSize*Math.pow(2,u-f.tileID.overscaledZ)))}Yr(toe,"LineBucket",{omit:["layers","patternFeatures","currentVertex","currentVertexIsOutside"]});const yve=(f,c,u)=>(1-u)*f+u*c;function vve(f,c){return 1/xve(f,1,c.tileZoom)}function _ve(f,c,u,g){return f.translatePosMatrix(g||c.tileID.projMatrix,c,u.paint.get("line-translate"),u.paint.get("line-translate-anchor"))}const bve=f=>{const c=[];wve(f)&&c.push("RENDER_LINE_DASH"),f.paint.get("line-gradient")&&c.push("RENDER_LINE_GRADIENT");const u=f.paint.get("line-trim-offset");u[0]===0&&u[1]===0||c.push("RENDER_LINE_TRIM_OFFSET"),f.paint.get("line-border-width").constantOr(1)!==0&&c.push("RENDER_LINE_BORDER");const g=f.layout.get("line-join").constantOr("miter")==="none",v=!!f.paint.get("line-pattern").constantOr(1);return g&&v&&c.push("LINE_JOIN_NONE"),c};function wve(f){const c=f.paint.get("line-dasharray").value;return c.kind!=="constant"||c.value}let noe;const jve=()=>noe||(noe={layout:mve||(mve=new Wi({"line-cap":new Er(Ft.layout_line["line-cap"]),"line-join":new Er(Ft.layout_line["line-join"]),"line-miter-limit":new kr(Ft.layout_line["line-miter-limit"]),"line-round-limit":new kr(Ft.layout_line["line-round-limit"]),"line-sort-key":new Er(Ft.layout_line["line-sort-key"]),"line-z-offset":new Er(Ft.layout_line["line-z-offset"]),"line-elevation-reference":new kr(Ft.layout_line["line-elevation-reference"]),"line-cross-slope":new kr(Ft.layout_line["line-cross-slope"]),visibility:new kr(Ft.layout_line.visibility),"line-width-unit":new kr(Ft.layout_line["line-width-unit"])})),paint:gve||(gve=new Wi({"line-opacity":new Er(Ft.paint_line["line-opacity"]),"line-color":new Er(Ft.paint_line["line-color"]),"line-translate":new kr(Ft.paint_line["line-translate"]),"line-translate-anchor":new kr(Ft.paint_line["line-translate-anchor"]),"line-width":new Er(Ft.paint_line["line-width"]),"line-gap-width":new Er(Ft.paint_line["line-gap-width"]),"line-offset":new Er(Ft.paint_line["line-offset"]),"line-blur":new Er(Ft.paint_line["line-blur"]),"line-dasharray":new Er(Ft.paint_line["line-dasharray"]),"line-pattern":new Er(Ft.paint_line["line-pattern"]),"line-pattern-cross-fade":new kr(Ft.paint_line["line-pattern-cross-fade"]),"line-gradient":new tx(Ft.paint_line["line-gradient"]),"line-trim-offset":new kr(Ft.paint_line["line-trim-offset"]),"line-trim-fade-range":new kr(Ft.paint_line["line-trim-fade-range"]),"line-trim-color":new kr(Ft.paint_line["line-trim-color"]),"line-emissive-strength":new Er(Ft.paint_line["line-emissive-strength"]),"line-border-width":new Er(Ft.paint_line["line-border-width"]),"line-border-color":new Er(Ft.paint_line["line-border-color"]),"line-occlusion-opacity":new kr(Ft.paint_line["line-occlusion-opacity"]),"line-color-use-theme":new Er({type:"string",default:"default","property-type":"data-driven"}),"line-gradient-use-theme":new Er({type:"string",default:"default","property-type":"data-driven"}),"line-trim-color-use-theme":new Er({type:"string",default:"default","property-type":"data-driven"}),"line-border-color-use-theme":new Er({type:"string",default:"default","property-type":"data-driven"})}))},noe);class Sqe extends Er{possiblyEvaluate(c,u){return u=new ti(Math.floor(u.zoom),{now:u.now,fadeDuration:u.fadeDuration,transition:u.transition,worldview:u.worldview}),super.possiblyEvaluate(c,u)}evaluate(c,u,g,v){return u=Object.assign({},u,{zoom:Math.floor(u.zoom)}),super.evaluate(c,u,g,v)}}let Z5;function kve(f,c){return c>0?c+2*f:f}const Cqe=Ts([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_tex_size",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),Mqe=Ts([{name:"a_globe_anchor",components:3,type:"Int16"},{name:"a_globe_normal",components:3,type:"Float32"}],4),Tqe=Ts([{name:"a_projected_pos",components:4,type:"Float32"}],4);Ts([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const Aqe=Ts([{name:"a_auto_z_offset",components:1,type:"Float32"}],4),Eqe=Ts([{name:"a_x_axis",components:3,type:"Float32"},{name:"a_y_axis",components:3,type:"Float32"}]),Iqe=Ts([{name:"a_texb",components:2,type:"Uint16"}]),Pqe=Ts([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_elevation_from_sea",components:2,type:"Float32"}]),Lqe=Ts([{name:"a_size_scale",components:1,type:"Float32"},{name:"a_padding",components:2,type:"Float32"},{name:"a_auto_z_offset",components:1,type:"Float32"}]);Ts([{type:"Int16",name:"projectedAnchorX"},{type:"Int16",name:"projectedAnchorY"},{type:"Int16",name:"projectedAnchorZ"},{type:"Int16",name:"tileAnchorX"},{type:"Int16",name:"tileAnchorY"},{type:"Float32",name:"x1"},{type:"Float32",name:"y1"},{type:"Float32",name:"x2"},{type:"Float32",name:"y2"},{type:"Int16",name:"padding"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]);const Nve=Ts([{name:"a_pos",components:3,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),Oqe=Ts([{name:"a_pos_2f",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);Ts([{name:"triangle",components:3,type:"Uint16"}]),Ts([{type:"Int16",name:"projectedAnchorX"},{type:"Int16",name:"projectedAnchorY"},{type:"Int16",name:"projectedAnchorZ"},{type:"Float32",name:"tileAnchorX"},{type:"Float32",name:"tileAnchorY"},{type:"Uint16",name:"glyphStartIndex"},{type:"Uint16",name:"numGlyphs"},{type:"Uint32",name:"vertexStartIndex"},{type:"Uint32",name:"lineStartIndex"},{type:"Uint32",name:"lineLength"},{type:"Uint16",name:"segment"},{type:"Uint16",name:"lowerSize"},{type:"Uint16",name:"upperSize"},{type:"Float32",name:"lineOffsetX"},{type:"Float32",name:"lineOffsetY"},{type:"Uint8",name:"writingMode"},{type:"Uint8",name:"placedOrientation"},{type:"Uint8",name:"hidden"},{type:"Uint32",name:"crossTileID"},{type:"Int16",name:"associatedIconIndex"},{type:"Uint8",name:"flipState"}]),Ts([{type:"Float32",name:"tileAnchorX"},{type:"Float32",name:"tileAnchorY"},{type:"Int16",name:"projectedAnchorX"},{type:"Int16",name:"projectedAnchorY"},{type:"Int16",name:"projectedAnchorZ"},{type:"Int16",name:"rightJustifiedTextSymbolIndex"},{type:"Int16",name:"centerJustifiedTextSymbolIndex"},{type:"Int16",name:"leftJustifiedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Int16",name:"placedIconSymbolIndex"},{type:"Int16",name:"verticalPlacedIconSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"verticalTextBoxStartIndex"},{type:"Uint16",name:"verticalTextBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"verticalIconBoxStartIndex"},{type:"Uint16",name:"verticalIconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint16",name:"numVerticalIconVertices"},{type:"Uint16",name:"useRuntimeCollisionCircles"},{type:"Uint32",name:"crossTileID"},{type:"Float32",components:2,name:"textOffset"},{type:"Float32",name:"collisionCircleDiameter"},{type:"Float32",name:"zOffset"},{type:"Uint8",name:"hasIconTextFit"},{type:"Uint16",name:"elevationFeatureIndex"}]),Ts([{type:"Float32",name:"offsetX"}]),Ts([{type:"Int16",name:"x"},{type:"Int16",name:"y"}]);var yl=24;function Dqe(f,c,u){return f.sections.forEach(g=>{g.text=function(v,k,S){const P=k.layout.get("text-transform").evaluate(S,{});return P==="uppercase"?v=v.toLocaleUpperCase():P==="lowercase"&&(v=v.toLocaleLowerCase()),wp.applyArabicShaping&&(v=wp.applyArabicShaping(v)),v}(g.text,c,u)}),f}const Y5={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂","←":"↑","→":"↓"};function Rqe(f){return f==="︶"||f==="﹈"||f==="︸"||f==="﹄"||f==="﹂"||f==="︾"||f==="︼"||f==="︺"||f==="︘"||f==="﹀"||f==="︐"||f==="︓"||f==="︔"||f==="`"||f===" ̄"||f==="︑"||f==="︒"}function Fqe(f){return f==="︵"||f==="﹇"||f==="︷"||f==="﹃"||f==="﹁"||f==="︽"||f==="︻"||f==="︹"||f==="︗"||f==="︿"}const soe=4294967296,Sve=1/soe,Cve=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");let f6=class{constructor(f=new Uint8Array(16)){this.buf=ArrayBuffer.isView(f)?f:new Uint8Array(f),this.dataView=new DataView(this.buf.buffer),this.pos=0,this.type=0,this.length=this.buf.length}readFields(f,c,u=this.length){for(;this.pos>3,k=this.pos;this.type=7&g,f(v,c,this),this.pos===k&&this.skip(g)}return c}readMessage(f,c){return this.readFields(f,c,this.readVarint()+this.pos)}readFixed32(){const f=this.dataView.getUint32(this.pos,!0);return this.pos+=4,f}readSFixed32(){const f=this.dataView.getInt32(this.pos,!0);return this.pos+=4,f}readFixed64(){const f=this.dataView.getUint32(this.pos,!0)+this.dataView.getUint32(this.pos+4,!0)*soe;return this.pos+=8,f}readSFixed64(){const f=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*soe;return this.pos+=8,f}readFloat(){const f=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,f}readDouble(){const f=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,f}readVarint(f){const c=this.buf;let u,g;return g=c[this.pos++],u=127&g,g<128?u:(g=c[this.pos++],u|=(127&g)<<7,g<128?u:(g=c[this.pos++],u|=(127&g)<<14,g<128?u:(g=c[this.pos++],u|=(127&g)<<21,g<128?u:(g=c[this.pos],u|=(15&g)<<28,function(v,k,S){const P=S.buf;let R,$;if($=P[S.pos++],R=(112&$)>>4,$<128||($=P[S.pos++],R|=(127&$)<<3,$<128)||($=P[S.pos++],R|=(127&$)<<10,$<128)||($=P[S.pos++],R|=(127&$)<<17,$<128)||($=P[S.pos++],R|=(127&$)<<24,$<128)||($=P[S.pos++],R|=(1&$)<<31,$<128))return LN(v,R,k);throw new Error("Expected varint not more than 10 bytes")}(u,f,this)))))}readVarint64(){return this.readVarint(!0)}readSVarint(){const f=this.readVarint();return f%2==1?(f+1)/-2:f/2}readBoolean(){return!!this.readVarint()}readString(){const f=this.readVarint()+this.pos,c=this.pos;return this.pos=f,f-c>=12&&Cve?Cve.decode(this.buf.subarray(c,f)):function(u,g,v){let k="",S=g;for(;S239?4:P>223?3:P>191?2:1;if(S+X>v)break;X===1?P<128&&(K=P):X===2?(R=u[S+1],(192&R)==128&&(K=(31&P)<<6|63&R,K<=127&&(K=null))):X===3?(R=u[S+1],$=u[S+2],(192&R)==128&&(192&$)==128&&(K=(15&P)<<12|(63&R)<<6|63&$,(K<=2047||K>=55296&&K<=57343)&&(K=null))):X===4&&(R=u[S+1],$=u[S+2],W=u[S+3],(192&R)==128&&(192&$)==128&&(192&W)==128&&(K=(15&P)<<18|(63&R)<<12|(63&$)<<6|63&W,(K<=65535||K>=1114112)&&(K=null))),K===null?(K=65533,X=1):K>65535&&(K-=65536,k+=String.fromCharCode(K>>>10&1023|55296),K=56320|1023&K),k+=String.fromCharCode(K),S+=X}return k}(this.buf,c,f)}readBytes(){const f=this.readVarint()+this.pos,c=this.buf.subarray(this.pos,f);return this.pos=f,c}readPackedVarint(f=[],c){const u=this.readPackedEnd();for(;this.pos127;);else if(c===2)this.pos=this.readVarint()+this.pos;else if(c===5)this.pos+=4;else{if(c!==1)throw new Error(`Unimplemented type: ${c}`);this.pos+=8}}writeTag(f,c){this.writeVarint(f<<3|c)}realloc(f){let c=this.length||16;for(;c268435455||f<0?function(c,u){let g,v;if(c>=0?(g=c%4294967296|0,v=c/4294967296|0):(g=~(-c%4294967296),v=~(-c/4294967296),4294967295^g?g=g+1|0:(g=0,v=v+1|0)),c>=18446744073709552e3||c<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");u.realloc(10),function(k,S,P){P.buf[P.pos++]=127&k|128,k>>>=7,P.buf[P.pos++]=127&k|128,k>>>=7,P.buf[P.pos++]=127&k|128,k>>>=7,P.buf[P.pos++]=127&k|128,P.buf[P.pos]=127&(k>>>=7)}(g,0,u),function(k,S){const P=(7&k)<<4;S.buf[S.pos++]|=P|((k>>>=3)?128:0),k&&(S.buf[S.pos++]=127&k|((k>>>=7)?128:0),k&&(S.buf[S.pos++]=127&k|((k>>>=7)?128:0),k&&(S.buf[S.pos++]=127&k|((k>>>=7)?128:0),k&&(S.buf[S.pos++]=127&k|((k>>>=7)?128:0),k&&(S.buf[S.pos++]=127&k)))))}(v,u)}(f,this):(this.realloc(4),this.buf[this.pos++]=127&f|(f>127?128:0),f<=127||(this.buf[this.pos++]=127&(f>>>=7)|(f>127?128:0),f<=127||(this.buf[this.pos++]=127&(f>>>=7)|(f>127?128:0),f<=127||(this.buf[this.pos++]=f>>>7&127))))}writeSVarint(f){this.writeVarint(f<0?2*-f-1:2*f)}writeBoolean(f){this.writeVarint(+f)}writeString(f){f=String(f),this.realloc(4*f.length),this.pos++;const c=this.pos;this.pos=function(g,v,k){for(let S,P,R=0;R55295&&S<57344){if(!P){S>56319||R+1===v.length?(g[k++]=239,g[k++]=191,g[k++]=189):P=S;continue}if(S<56320){g[k++]=239,g[k++]=191,g[k++]=189,P=S;continue}S=P-55296<<10|S-56320|65536,P=null}else P&&(g[k++]=239,g[k++]=191,g[k++]=189,P=null);S<128?g[k++]=S:(S<2048?g[k++]=S>>6|192:(S<65536?g[k++]=S>>12|224:(g[k++]=S>>18|240,g[k++]=S>>12&63|128),g[k++]=S>>6&63|128),g[k++]=63&S|128)}return k}(this.buf,f,this.pos);const u=this.pos-c;u>=128&&Mve(c,u,this),this.pos=c-1,this.writeVarint(u),this.pos+=u}writeFloat(f){this.realloc(4),this.dataView.setFloat32(this.pos,f,!0),this.pos+=4}writeDouble(f){this.realloc(8),this.dataView.setFloat64(this.pos,f,!0),this.pos+=8}writeBytes(f){const c=f.length;this.writeVarint(c),this.realloc(c);for(let u=0;u=128&&Mve(u,g,this),this.pos=u-1,this.writeVarint(g),this.pos+=g}writeMessage(f,c,u){this.writeTag(f,2),this.writeRawMessage(c,u)}writePackedVarint(f,c){c.length&&this.writeMessage(f,zqe,c)}writePackedSVarint(f,c){c.length&&this.writeMessage(f,Bqe,c)}writePackedBoolean(f,c){c.length&&this.writeMessage(f,qqe,c)}writePackedFloat(f,c){c.length&&this.writeMessage(f,$qe,c)}writePackedDouble(f,c){c.length&&this.writeMessage(f,Uqe,c)}writePackedFixed32(f,c){c.length&&this.writeMessage(f,Vqe,c)}writePackedSFixed32(f,c){c.length&&this.writeMessage(f,Hqe,c)}writePackedFixed64(f,c){c.length&&this.writeMessage(f,Wqe,c)}writePackedSFixed64(f,c){c.length&&this.writeMessage(f,Gqe,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 LN(f,c,u){return u?4294967296*c+(f>>>0):4294967296*(c>>>0)+(f>>>0)}function Mve(f,c,u){const g=c<=16383?1:c<=2097151?2:c<=268435455?3:Math.floor(Math.log(c)/(7*Math.LN2));u.realloc(g);for(let v=u.pos-1;v>=f;v--)u.buf[v+g]=u.buf[v]}function zqe(f,c){for(let u=0;u=0&&g>=c&&p6[this.text.charCodeAt(g)];g--)u--;this.text=this.text.substring(c,u),this.sectionIndex=this.sectionIndex.slice(c,u)}substring(c,u){const g=new ON;return g.text=this.text.substring(c,u),g.sectionIndex=this.sectionIndex.slice(c,u),g.sections=this.sections,g}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((c,u)=>Math.max(c,this.sections[u].scale),0)}addTextSection(c,u){this.text+=c.text,this.sections.push(X5.forText(c.scale,c.fontStack||u));const g=this.sections.length-1;for(let v=0;v=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function ioe(f,c,u,g,v,k,S,P,R,$,W,K,X,re,se,fe=1){const Se=ON.fromFeature(f,v,fe);K===ju.vertical&&Se.verticalizePunctuation(X);let ke=[];const Fe=function(_t,Ct,Et,Kt,Rt,rr){if(!_t)return[];const or=[],lr=function(pr,tr,Xt,mr,Mr,wr){let un=0;for(let Br=0;Br=0;let vr=0;for(let pr=0;pr<_t.length();pr++){const tr=_t.getSection(pr),Xt=_t.getCodePoint(pr);if(p6[Xt]||(vr+=Ave(Xt,tr,Kt,Rt,Ct,rr)),pr<_t.length()-1){const mr=!((ur=Xt)<11904||!(Tn["Bopomofo Extended"](ur)||Tn.Bopomofo(ur)||Tn["CJK Compatibility Forms"](ur)||Tn["CJK Compatibility Ideographs"](ur)||Tn["CJK Compatibility"](ur)||Tn["CJK Radicals Supplement"](ur)||Tn["CJK Strokes"](ur)||Tn["CJK Symbols and Punctuation"](ur)||Tn["CJK Unified Ideographs Extension A"](ur)||Tn["CJK Unified Ideographs"](ur)||Tn["Enclosed CJK Letters and Months"](ur)||Tn["Halfwidth and Fullwidth Forms"](ur)||Tn.Hiragana(ur)||Tn["Ideographic Description Characters"](ur)||Tn["Kangxi Radicals"](ur)||Tn["Katakana Phonetic Extensions"](ur)||Tn.Katakana(ur)||Tn["Vertical Forms"](ur)||Tn["Yi Radicals"](ur)||Tn["Yi Syllables"](ur)));(Xqe[Xt]||mr||tr.image)&&or.push(Ive(pr+1,vr,lr,or,Qqe(Xt,_t.getCodePoint(pr+1),mr&&xr),!1))}}var ur;return Pve(Ive(_t.length(),vr,lr,or,0,!0))}(Se,$,k,c,g,re),{processBidirectionalText:$e,processStyledBidirectionalText:Ke}=wp;if($e&&Se.sections.length===1){const _t=$e(Se.toString(),Fe);for(const Ct of _t){const Et=new ON;Et.text=Ct,Et.sections=Se.sections;for(let Kt=0;Kt0&&la>ns&&(ns=la)}else{const na=Et[yr.fontStack];if(!na)continue;na[Dr]&&(Qn=na[Dr]);const oa=Ct[yr.fontStack];if(!oa)continue;const la=oa.glyphs[Dr];if(!la)continue;if(vn=la.metrics,ms=Dr!==8203?yl:0,wr){const Ma=oa.ascender!==void 0?Math.abs(oa.ascender):0,Ga=oa.descender!==void 0?Math.abs(oa.descender):0,$a=(Ma+Ga)*hn;Ba<$a&&(Ba=$a,lt=(Ma-Ga)/2*hn),As=-Ma*hn}else As=(rn-hn)*yl-17}Un?(_t.verticalizable=!0,$s.push({glyph:Dr,image:cs,x:tr,y:Xt+As,vertical:Un,scale:hn,localGlyph:vn.localGlyph,fontStack:yr.fontStack,sectionIndex:Or,metrics:vn,rect:Qn}),tr+=ms*hn+vr):($s.push({glyph:Dr,image:cs,x:tr,y:Xt+As,vertical:Un,scale:hn,localGlyph:vn.localGlyph,fontStack:yr.fontStack,sectionIndex:Or,metrics:vn,rect:Qn}),tr+=vn.advance*hn+vr)}$s.length!==0&&(mr=Math.max(tr-vr,mr),wr?Lve($s,Mr,ns,lt,rr*rn/2):Lve($s,Mr,ns,0,rr/2)),tr=0;const pt=rr*rn+ns;Ds.lineOffset=Math.max(ns,qn),Xt+=pt,++un}var Br;const Kr=Xt,{horizontalAlign:tn,verticalAlign:gs}=ooe(or);(function(jr,rn,qn,Ds,$s,ns){const Ba=(rn-qn)*$s,lt=-ns*Ds;for(const pt of jr)for(const nr of pt.positionedGlyphs)nr.x+=Ba,nr.y+=lt})(_t.positionedLines,Mr,tn,gs,mr,Kr),_t.top+=-gs*Kr,_t.bottom=_t.top+Kr,_t.left+=-tn*mr,_t.right=_t.left+mr,_t.hasBaseline=wr}(ot,c,u,g,ke,S,P,R,K,$,X,se),!function(_t){for(const Ct of _t)if(Ct.positionedGlyphs.length!==0)return!1;return!0}(ht))return ot}const p6={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},Xqe={10:!0,32:!0,38:!0,40:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0};function Ave(f,c,u,g,v,k){if(c.image){const S=g.get(c.image.toString());return S?S.displaySize[0]*c.scale*yl/k+v:0}{const S=u[c.fontStack],P=S&&S.glyphs[f];return P?P.metrics.advance*c.scale+v:0}}function Eve(f,c,u,g){const v=Math.pow(f-c,2);return g?f-u/2;){if(S--,S<0)return!1;P-=f[S].dist(k),k=f[S]}P+=f[S].dist(f[S+1]),S++;const R=[];let $=0;for(;Pg;)$-=R.shift().angleDelta;if($>v)return!1;S++,P+=W.dist(K)}return!0}function zve(f){let c=0;for(let u=0;u$){const se=($-R)/re,fe=Fn(K.x,X.x,se),Se=Fn(K.y,X.y,se),ke=new cx(fe,Se,0,X.angleTo(K),W);return!S||Fve(f,ke,P,S,c)?ke:void 0}R+=re}}function eVe(f,c,u,g,v,k,S,P,R){const $=Bve(g,k,S),W=$ve(g,v),K=W*S,X=f[0].x===0||f[0].x===R||f[0].y===0||f[0].y===R;return c-K=0&&Ke=0&&ht=0&&X+$<=W){const ot=new cx(Ke,ht,0,Fe,se);g&&!Fve(f,ot,k,g,v)||re.push(ot)}}K+=ke}return P||re.length||S||(re=Uve(f,K/2,u,g,v,k,S,!0,R)),re}function qve(f){let c=0,u=0;for(const S of f)c+=S.w*S.h,u=Math.max(u,S.w);f.sort((S,P)=>P.h-S.h);const g=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(c/.95)),u),h:1/0}];let v=0,k=0;for(const S of f)for(let P=g.length-1;P>=0;P--){const R=g[P];if(!(S.w>R.w||S.h>R.h)){if(S.x=R.x,S.y=R.y,k=Math.max(k,S.y+S.h),v=Math.max(v,S.x+S.w),S.w===R.w&&S.h===R.h){const $=g.pop();$&&P1?se-1:se,wc.copy(K.data,$,{x:0,y:0},{x:fe,y:Se},K.data,g),wc.copy(K.data,$,{x:0,y:Fe-se},{x:fe,y:Se-se},{width:ke,height:se},g),wc.copy(K.data,$,{x:0,y:0},{x:fe,y:Se+Fe},{width:ke,height:se},g),wc.copy(K.data,$,{x:ke-se,y:0},{x:fe-se,y:Se},{width:se,height:Fe},g),wc.copy(K.data,$,{x:0,y:0},{x:fe+ke,y:Se},{width:se,height:Fe},g),wc.copy(K.data,$,{x:ke-se,y:Fe-se},{x:fe-se,y:Se-se},{width:se,height:se},g),wc.copy(K.data,$,{x:0,y:Fe-se},{x:fe+ke,y:Se-se},{width:se,height:se},g),wc.copy(K.data,$,{x:0,y:0},{x:fe+ke,y:Se+Fe},{width:se,height:se},g),wc.copy(K.data,$,{x:ke-se,y:0},{x:fe-se,y:Se+Fe},{width:se,height:se},g)}this.lut=g,this.image=$,this.iconPositions=v,this.patternPositions=k}addImages(c,u,g,v){for(const[k,S]of c.entries()){const{bin:P,imagePosition:R,imageVariant:$}=uoe(k,S,g);u.set(k,R),v.push(P),S.hasRenderCallback&&this.haveRenderCallbacks.push($.id)}}patchUpdatedImages(c,u,g){this.haveRenderCallbacks=this.haveRenderCallbacks.filter(v=>c.hasImage(v,g)),c.dispatchRenderCallbacks(this.haveRenderCallbacks,g);for(const v of c.getUpdatedImages(g)){for(const k of this.iconPositions.keys()){const S=mp.parse(k);if(gl.isEqual(S.id,v)){const P=c.getImage(v,g);this.patchUpdatedImage(this.iconPositions.get(k),P,u,null)}}for(const k of this.patternPositions.keys()){const S=mp.parse(k);if(gl.isEqual(S.id,v)){const P=c.getImage(v,g);this.patchUpdatedImage(this.patternPositions.get(k),P,u,this.lut)}}}}patchUpdatedImage(c,u,g,v=null){if(!c||!u||c.version===u.version)return;c.version=u.version;const[k,S]=c.tl,P=c.sdf;if(this.lut||P){const R={width:u.data.width,height:u.data.height},$=new wc(R);wc.copy(u.data,$,{x:0,y:0},{x:0,y:0},R,v,P),g.update($,{position:{x:k,y:S}})}else g.update(u.data,{position:{x:k,y:S}})}}Yr(Q5,"ImagePosition"),Yr(Vve,"ImageAtlas");const J5=1e20;function Hve(f,c,u,g,v,k,S,P,R){for(let $=c;$-1);R++,k[R]=P,S[R]=$,S[R+1]=J5}for(let P=0,R=0;P{let R=this.entries[k];R||(R=this.entries[k]={glyphs:{},requests:{},ranges:{},ascender:void 0,descender:void 0});let $=R.glyphs[S];if($!==void 0)return void P(null,{stack:k,id:S,glyph:$});if($=this._tinySDF(R,k,S),$)return R.glyphs[S]=$,void P(null,{stack:k,id:S,glyph:$});const W=Math.floor(S/256);if(256*W>65535)return Ur("glyphs > 65535 not supported"),void P(null,{stack:k,id:S,glyph:$});if(R.ranges[W])return void P(null,{stack:k,id:S,glyph:$});let K=R.requests[W];K||(K=R.requests[W]=[],FN.loadGlyphRange(k,W,v,this.requestManager,(X,re)=>{if(re){R.ascender=re.ascender,R.descender=re.descender;for(const se in re.glyphs)this._doesCharSupportLocalGlyph(+se)||(R.glyphs[+se]=re.glyphs[+se]);R.ranges[W]=!0}for(const se of K)se(X,re);delete R.requests[W]})),K.push((X,re)=>{X?P(X):re&&P(null,{stack:k,id:S,glyph:re.glyphs[S]||null})})},(k,S)=>{if(k)u(k);else if(S){const P={};for(const{stack:R,id:$,glyph:W}of S)P[R]===void 0&&(P[R]={}),P[R].glyphs===void 0&&(P[R].glyphs={}),P[R].glyphs[$]=W&&{id:W.id,bitmap:W.bitmap.clone(),metrics:W.metrics},P[R].ascender=this.entries[R].ascender,P[R].descender=this.entries[R].descender;u(null,P)}})}_doesCharSupportLocalGlyph(c){return this.localGlyphMode!==hoe.none&&(this.localGlyphMode===hoe.all?!!this.localFontFamily:!!this.localFontFamily&&(Tn["CJK Unified Ideographs"](c)||Tn["Hangul Syllables"](c)||Tn.Hiragana(c)||Tn.Katakana(c)||Tn["CJK Symbols and Punctuation"](c)||Tn["CJK Unified Ideographs Extension A"](c)||Tn["CJK Unified Ideographs Extension B"](c)||Tn.Osage(c)))}_tinySDF(c,u,g){const v=this.localFontFamily;if(!v||!this._doesCharSupportLocalGlyph(g))return;let k=c.tinySDF;if(!k){let fe="400";/bold/i.test(u)?fe="900":/medium/i.test(u)?fe="500":/light/i.test(u)&&(fe="200"),k=c.tinySDF=new FN.TinySDF({fontFamily:v,fontWeight:fe,fontSize:24*Pp,buffer:3*Pp,radius:8*Pp}),k.fontWeight=fe}if(this.localGlyphs[k.fontWeight][g])return this.localGlyphs[k.fontWeight][g];const S=String.fromCodePoint(g),{data:P,width:R,height:$,glyphWidth:W,glyphHeight:K,glyphLeft:X,glyphTop:re,glyphAdvance:se}=k.draw(S);return this.localGlyphs[k.fontWeight][g]={id:g,bitmap:new Xy({width:R,height:$},P),metrics:{width:W/Pp,height:K/Pp,left:X/Pp,top:re/Pp-27,advance:se/Pp,localGlyph:!0}}}}FN.loadGlyphRange=function(f,c,u,g,v){const k=256*c,S=k+255,P=g.transformRequest(g.normalizeGlyphsURL(u).replace("{fontstack}",f).replace("{range}",`${k}-${S}`),qg.Glyphs);Mh(P,(R,$)=>{if(R)v(R);else if($){const W={},K=function(X){return new f6(X).readFields(Kqe,{})}($);for(const X of K.glyphs)W[X.id]=X;v(null,{glyphs:W,ascender:K.ascender,descender:K.descender})}})},FN.TinySDF=class{constructor({fontSize:f=24,buffer:c=3,radius:u=8,cutoff:g=.25,fontFamily:v="sans-serif",fontWeight:k="normal",fontStyle:S="normal",lang:P=null}={}){this.buffer=c,this.cutoff=g,this.radius=u,this.lang=P;const R=this.size=f+4*c,$=this._createCanvas(R),W=this.ctx=$.getContext("2d",{willReadFrequently:!0});W.font=`${S} ${k} ${f}px ${v}`,W.textBaseline="alphabetic",W.textAlign="left",W.fillStyle="black",this.gridOuter=new Float64Array(R*R),this.gridInner=new Float64Array(R*R),this.f=new Float64Array(R),this.z=new Float64Array(R+1),this.v=new Uint16Array(R)}_createCanvas(f){const c=document.createElement("canvas");return c.width=c.height=f,c}draw(f){const{width:c,actualBoundingBoxAscent:u,actualBoundingBoxDescent:g,actualBoundingBoxLeft:v,actualBoundingBoxRight:k}=this.ctx.measureText(f),S=Math.ceil(u),P=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(k-v))),R=Math.min(this.size-this.buffer,S+Math.ceil(g)),$=P+2*this.buffer,W=R+2*this.buffer,K=Math.max($*W,0),X=new Uint8ClampedArray(K),re={data:X,width:$,height:W,glyphWidth:P,glyphHeight:R,glyphTop:S,glyphLeft:0,glyphAdvance:c};if(P===0||R===0)return re;const{ctx:se,buffer:fe,gridInner:Se,gridOuter:ke}=this;this.lang&&(se.lang=this.lang),se.clearRect(fe,fe,P,R),se.fillText(f,fe,fe+S);const Fe=se.getImageData(fe,fe,P,R);ke.fill(J5,0,K),Se.fill(0,0,K);for(let $e=0;$e0?_t*_t:0,Se[ot]=_t<0?_t*_t:0}}Hve(ke,0,0,$,W,$,this.f,this.v,this.z),Hve(Se,fe,fe,P,R,$,this.f,this.v,this.z);for(let $e=0;$e{const xr=x6(Rt.stretch-Fe,$e,W,f.left*v),vr=y6(Rt.fixed-ot,_t,Rt.stretch,se),ur=x6(rr.stretch-Ke,ht,K,f.top*v),pr=y6(rr.fixed-Ct,Et,rr.stretch,fe),tr=x6(or.stretch-Fe,$e,W,f.left*v),Xt=y6(or.fixed-ot,_t,or.stretch,se),mr=x6(lr.stretch-Ke,ht,K,f.top*v),Mr=y6(lr.fixed-Ct,Et,lr.stretch,fe),wr=new ir(xr,ur),un=new ir(tr,ur),Br=new ir(tr,mr),Kr=new ir(xr,mr),tn=new ir(vr/P,pr/P),gs=new ir(Xt/P,Mr/P),jr=c*Math.PI/180;if(jr){const Ba=Math.sin(jr),lt=Math.cos(jr),pt=[lt,-Ba,Ba,lt];wr._matMult(pt),un._matMult(pt),Kr._matMult(pt),Br._matMult(pt)}const rn=Rt.stretch+Rt.fixed,qn=or.stretch+or.fixed,Ds=rr.stretch+rr.fixed,$s=lr.stretch+lr.fixed,ns=f.imageSecondary;return{tl:wr,tr:un,bl:Kr,br:Br,texPrimary:{x:S.paddedRect.x+Gm+rn,y:S.paddedRect.y+Gm+Ds,w:qn-rn,h:$s-Ds},texSecondary:ns?{x:ns.paddedRect.x+Gm+rn,y:ns.paddedRect.y+Gm+Ds,w:qn-rn,h:$s-Ds}:void 0,writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:tn,pixelOffsetBR:gs,minFontScaleX:_t/P/W,minFontScaleY:Et/P/K,isSDF:u}};if(g&&(S.stretchX||S.stretchY)){const Rt=Kve(X,Se,se),rr=Kve(re,ke,fe);for(let or=0;ork)&&(k=se.x),(!re||se.y>S)&&(S=se.y)}const R=Math.min(k-g,S-v);let $=R/2;const W=new Mk([],sVe);if(R===0)return new ir(g,v);for(let re=g;reK.d||!K.d)&&(K=re,u&&console.log("found best %d after %d probes",Math.round(1e4*re.d)/1e4,X)),re.max-K.d<=c||($=re.h/2,W.push(new zN(re.p.x-$,re.p.y-$,$,f)),W.push(new zN(re.p.x+$,re.p.y-$,$,f)),W.push(new zN(re.p.x-$,re.p.y+$,$,f)),W.push(new zN(re.p.x+$,re.p.y+$,$,f)),X+=4)}return u&&(console.log(`num probes: ${X}`),console.log(`best distance: ${K.d}`)),K.p}function sVe(f,c){return c.max-f.max}class zN{constructor(c,u,g,v){this.p=new ir(c,u),this.h=g,this.d=function(k,S){let P=!1,R=1/0;for(let $=0;$k.y!=fe.y>k.y&&k.x<(fe.x-se.x)*(k.y-se.y)/(fe.y-se.y)+se.x&&(P=!P),R=Math.min(R,eo(k,se,fe))}}return(P?1:-1)*Math.sqrt(R)}(this.p,v),this.max=this.d+this.h*Math.SQRT2}}const aVe=Object.keys,poe=Number.POSITIVE_INFINITY,iVe=Math.sqrt(2);function Jy(f,c,u,g,v){const k=loe(f)&&f.collisionPadding?f.collisionPadding:[0,0,0,0],S={top:f.top-k[1],bottom:f.bottom+k[3],left:f.left-k[0],right:f.right+k[2],scaled:!1};return g!==void 0&&function(P,R){P.top*=R,P.bottom*=R,P.left*=R,P.right*=R,P.scaled=!0}(S,g),u&&function(P,R){if(!R)return;const $=ss(R),W=new ir(P.left,P.top),K=new ir(P.right,P.top),X=new ir(P.left,P.bottom),re=new ir(P.right,P.bottom),se=new ir(0,0);W._rotateAround($,se),K._rotateAround($,se),X._rotateAround($,se),re._rotateAround($,se),P.left=Math.min(W.x,K.x,X.x,re.x),P.right=Math.max(W.x,K.x,X.x,re.x),P.top=Math.min(W.y,K.y,X.y,re.y),P.bottom=Math.max(W.y,K.y,X.y,re.y)}(S,u),v&&(S.left+=v[0],S.right+=v[0],S.top+=v[1],S.bottom+=v[1]),c?{top:Math.min(c.top,S.top),bottom:Math.max(c.bottom,S.bottom),left:Math.min(c.left,S.left),right:Math.max(c.right,S.right),scaled:c.scaled||S.scaled}:S}function Yve(f,[c,u]){let g=0,v=0;if(u===poe){c<0&&(c=0);const k=c/iVe;switch(f){case"top-right":case"top-left":v=k-7;break;case"bottom-right":case"bottom-left":v=7-k;break;case"bottom":v=7-c;break;case"top":v=c-7}switch(f){case"top-right":case"bottom-right":g=-k;break;case"top-left":case"bottom-left":g=k;break;case"left":g=c;break;case"right":g=-c}}else{switch(c=Math.abs(c),u=Math.abs(u),f){case"top-right":case"top-left":case"top":v=u-7;break;case"bottom-right":case"bottom-left":case"bottom":v=7-u}switch(f){case"top-right":case"bottom-right":case"right":g=-c;break;case"top-left":case"bottom-left":case"left":g=c}}return[g,v]}function oVe(f,c,u,g,v,k,S,P,R,$,W,K,X,re){const se=f.layers[0],fe=se.appearances;if(fe.length===0)return{iconBBox:null,iconVerticalBBox:null,textBBox:null,textVerticalBBox:null};const Se={iconBBox:null,iconVerticalBBox:null},ke={textBBox:null,textVerticalBBox:null},{baseIconRotate:Fe,baseTextRotate:$e,iconScaleFactor:Ke}=function(ot,_t,Ct){const Et=ot.get("icon-rotate").evaluate(_t,{},Ct),Kt=ot.get("text-rotate").evaluate(_t,{},Ct),[Rt,rr]=ot.get("icon-size-scale-range");return{baseIconRotate:Et,baseTextRotate:Kt,iconScaleFactor:xe(1,Rt,rr)}}(g,v,k);c&&(Se.iconBBox=Jy(c,Se.iconBBox,Fe,S),u)&&(Se.iconVerticalBBox=Jy(u,Se.iconVerticalBBox,Fe+90,S));const ht=_6(K.horizontal);ht&&(ke.textBBox=Jy(ht,ke.textBBox,$e,1,re)),K.vertical&&(ke.textVerticalBBox=Jy(K.vertical,ke.textVerticalBBox,$e+90,1,re));for(const ot of fe)ot.hasIconProperties()&&lVe(Se,f,se,ot,v,k,P,Fe,S,R,c,$,Ke,W),ot.hasTextProperties()&&cVe(ke,se,ot,v,k,re,$e,X,ht,K.vertical);return{iconBBox:Se.iconBBox,iconVerticalBBox:Se.iconVerticalBBox,textBBox:ke.textBBox,textVerticalBBox:ke.textVerticalBBox}}function lVe(f,c,u,g,v,k,S,P,R,$,W,K,X,re){const{appearanceIconOffset:se,appearanceIconRotate:fe,appearanceIconSize:Se}=function(Ke,ht,ot,_t,Ct,Et,Kt,Rt){const rr=Ke.hasProperty("icon-offset")?ht.getAppearanceValueAndResolveTokens(Ke,"icon-offset",ot,_t,[]):null,or=rr&&Array.isArray(rr)?rr:Ct,lr=Ke.hasProperty("icon-rotate")?ht.getAppearanceValueAndResolveTokens(Ke,"icon-rotate",ot,_t,[]):null,xr=typeof lr=="number"?lr:Et,vr=Ke.hasProperty("icon-size")?ht.getAppearanceValueAndResolveTokens(Ke,"icon-size",ot,_t,[]):null;return{appearanceIconOffset:or,appearanceIconRotate:xr,appearanceIconSize:typeof vr=="number"?vr*Rt.iconScaleFactor:Kt}}(g,u,v,k,S,P,R,$);let ke=null,Fe=null,$e=null;g.hasProperty("icon-image")?$e=function(Ke,ht,ot,_t,Ct,Et,Kt){let Rt=null;const rr=ht.getAppearanceValueAndResolveTokens(ot,"icon-image",_t,Ct,[]);if(rr){const or=Ke.getResolvedImageFromTokens(rr),lr=ot.getUnevaluatedProperty("icon-size"),xr=eM(or,DN(Ke.zoom,lr,Ke.worldview),lr,Ct,Ke.zoom,_t,Ke.pixelRatio,Kt,Ke.worldview);Rt=Et.get(xr.iconPrimary.toString())}return Rt}(c,u,g,v,k,K,X):W&&($e=W.imagePrimary),$e&&(ke=m6($e,null,se,re),c.allowVerticalPlacement&&(Fe=m6($e,null,se,re))),ke&&(f.iconBBox=Jy(ke,f.iconBBox,fe,Se)),Fe&&(f.iconVerticalBBox=Jy(Fe,f.iconVerticalBBox,fe+90,Se))}function cVe(f,c,u,g,v,k,S,P,R,$){const{appearanceTextOffset:W,appearanceTextRotate:K,appearanceTextSize:X}=function(se,fe,Se,ke,Fe,$e,Ke){const ht=se.hasProperty("text-offset")?fe.getAppearanceValueAndResolveTokens(se,"text-offset",Se,ke,[]):null,ot=ht&&Array.isArray(ht)?[ht[0]*yl,ht[1]*yl]:Fe,_t=se.hasProperty("text-rotate")?fe.getAppearanceValueAndResolveTokens(se,"text-rotate",Se,ke,[]):null,Ct=typeof _t=="number"?_t:$e,Et=se.hasProperty("text-size")?fe.getAppearanceValueAndResolveTokens(se,"text-size",Se,ke,[]):null;return{appearanceTextOffset:ot,appearanceTextRotate:Ct,appearanceTextSize:typeof Et=="number"?Et:Ke}}(u,c,g,v,k,S,P),re=X/P;R&&(f.textBBox=Jy(R,f.textBBox,K,re,W)),$&&(f.textVerticalBBox=Jy($,f.textVerticalBBox,K+90,re,W))}function v6(f,c,u,g,v,k,S,P,R){if(!c||!c.usvg)return;const $=Rve(g),W=Rve(v),K=k!=="both"&&k!=="width"||!Ove(g)?1:W.width/$.width,X=k!=="both"&&k!=="height"||!Dve(g)?1:W.height/$.height;u.scaleSelf(K,X);const re=u.toString();S.set(re,u),P.set(re,c);const{imagePosition:se}=uoe(re,c,Jv);R.set(re,se)}function Xve(f,c,u,g,v,k,S,P,R){if(!f)return;const $=function(W,K,X,re,se,fe){if(W.kind==="camera")return W.maxSize;if(W.kind==="composite"){const Se=K.possiblyEvaluate(new ti(W.maxZoom,{worldview:fe}),X).evaluate(se,{},X),ke=K.possiblyEvaluate(new ti(W.minZoom,{worldview:fe}),X).evaluate(se,{},X);return Math.max(Se,ke)}return K.possiblyEvaluate(new ti(re,{worldview:fe})).evaluate(se,{},X)}(c,u,g,v,k,R);return f.scaleSelf($*P*S)}function eM(f,c,u,g,v,k,S,P,R){return{iconPrimary:Xve(f.getPrimary(),c,u,g,v,k,S,P,R),iconSecondary:Xve(f.getSecondary(),c,u,g,v,k,S,P,R)}}function dVe(f,c,u){if(!c)return;const g=u.get(f.toString()),v=u.get(c.toString());g&&v&&(g.paddedRect.w===v.paddedRect.w&&g.paddedRect.h===v.paddedRect.h||Ur(`Mismatch in icon variant sizes: ${f.toString()} and ${c.toString()}`),g.usvg!==v.usvg&&Ur(`Mismatch in icon variant image types: ${f.id} and ${c.id}`))}function Qve(f,c,u,g){if(!f)return;const v=c.get(u.toString());if(f.imagePrimary=v,g){const k=c.get(g.toString());f.imageSecondary=k}}function uVe(f,c){for(const u in f.horizontal)Jve(f.horizontal[u],c);Jve(f.vertical,c)}function Jve(f,c){if(f){for(const u of f.positionedLines)for(const g of u.positionedGlyphs)if(g.image!==null){const v=g.image.toString();g.rect=c.get(v).paddedRect}}}function moe(f){switch(f){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function hVe(f,c,u,g,v,k,S,P,R){const $=_6(k.horizontal)||k.vertical,W=u.get("icon-text-fit-padding").evaluate(g,{},v);let K,X=c;return c&&R!=="none"&&(f.allowVerticalPlacement&&k.vertical&&(K=coe(c,k.vertical,R,W,P,S)),$&&(X=coe(c,$,R,W,P,S))),{defaultShapedIcon:X,verticallyShapedIcon:K}}function fVe(f,c,u,g,v,k,S,P,R,$,W,K,X,re,se,fe,Se,ke,Fe,$e,Ke,ht,ot,_t){let Ct=S.textMaxSize.evaluate(c,{},X);Ct===void 0?Ct=P*S.textScaleFactor:Ct*=S.textScaleFactor;const Et=f.layers[0].layout,Kt=yl,Rt=P*S.textScaleFactor/Kt,rr=_6(u.horizontal)||u.vertical;if(Se!=="none"&&f.appearanceFeatureData&&c.index18&&mr>2&&(mr>>=1),Math.max(Sr/(512*mr),1)*Et.get("symbol-spacing")),vr=Et.get("text-padding")*f.tilePixelRatio,ur=Et.get("icon-padding")*f.tilePixelRatio,pr=ss(Et.get("text-max-angle")),tr=Et.get("icon-rotation-alignment")==="map"&&$e!=="point",Xt=xr/2;var mr;f.hasAnyIconTextFit===!1&&Se!=="none"&&(f.hasAnyIconTextFit=!0);const Mr=c.properties?+c.properties[Jt]:null,wr=Mr&&f.elevationFeatureIdToIndex?f.elevationFeatureIdToIndex.get(Mr):65535,un=(Br,Kr,tn)=>{if(Kr.x<0||Kr.x>=Sr||Kr.y<0||Kr.y>=Sr)return;let gs=null;if(or){const{x:jr,y:rn,z:qn}=re.projectTilePoint(Kr.x,Kr.y,tn);gs={anchor:new cx(jr,rn,qn,0,void 0),up:re.upVector(tn,Kr.x,Kr.y)}}(function(jr,rn,qn,Ds,$s,ns,Ba,lt,pt,nr,yr,Or,Dr,hn,vn,Qn,cs,ms,As,Ln,Un,na,oa,la,Ma,Ga,$a,fa,_a,ds,Bs,Ci,En){const Es=jr.addToLineVertexArray(rn,Ds);let qa,Qa,ri,oo,Ja,In,Fi,Ta=0,xi=0,Ho=0,vl=0,Eo=-1,Io=-1;const sl={};let Sd=Pr("");const ei=qn?qn.anchor:rn,to=fa!=="none";let lo=0,Wd=0;if(pt._unevaluatedLayout.getValue("text-radial-offset")===void 0){const sc=pt.layout.get("text-offset").evaluate(Un,{},Ma);lo=sc[0]*yl,Wd=sc[1]*yl}else lo=pt.layout.get("text-radial-offset").evaluate(Un,{},Ma)*yl,Wd=poe;if(jr.allowVerticalPlacement&&$s.vertical){const sc=$s.vertical;if(vn)In=goe(sc),lt&&(Fi=goe(lt));else{const sd=pt.layout.get("text-rotate").evaluate(Un,{},Ma)+90;ri=b6(nr,ei,rn,yr,Or,Dr,sc,hn,sd,Qn,Ci),lt&&(oo=b6(nr,ei,rn,yr,Or,Dr,lt,ms,sd,null,Bs))}}if(ns){const sc=jr.iconSizeData,sd=pt.layout.get("icon-rotate").evaluate(Un,{},Ma),ku=foe(ns,sd,oa,to,na.iconScaleFactor),r0=lt?foe(lt,sd,oa,to,na.iconScaleFactor):void 0;Qa=b6(nr,ei,rn,yr,Or,Dr,ns,ms,sd,null,ds);const WN=function(Rp,yM,y2e,NHe,v2e,_2e,SHe,CHe){const b2e=Rp.layers[0],w2e=b2e.appearances;let GN=yM.length;if(y2e&&(GN=Math.max(GN,y2e.length)),w2e.length===0)return GN;const[MHe,THe]=NHe.get("icon-size-scale-range"),AHe=xe(1,MHe,THe);for(const j2e of w2e){const k2e=j2e.getUnevaluatedProperties();if(k2e._values["icon-image"].value!==void 0){const N2e=b2e.getAppearanceValueAndResolveTokens(j2e,"icon-image",v2e,_2e,[]);if(N2e){const S2e=Rp.getResolvedImageFromTokens(N2e);if(S2e){const C2e=k2e._values["icon-size"],EHe=eM(S2e,DN(Rp.zoom,C2e,Rp.worldview),C2e,_2e,Rp.zoom,v2e,Rp.pixelRatio,AHe,Rp.worldview),IHe=SHe.get(EHe.iconPrimary.toString());GN=Math.max(GN,tVe(IHe,CHe))}}}}return GN}(jr,ku,r0,pt.layout,Un,Ma,jr.iconAtlasPositions,to);Ta=4*WN;let Dp=null;sc.kind==="source"?(Dp=[Ip*pt.layout.get("icon-size").evaluate(Un,{},Ma)*na.iconScaleFactor],Dp[0]>dx&&Ur(`${jr.layerIds[0]}: Value for "icon-size" is >= ${tM}. Reduce your "icon-size".`)):sc.kind==="composite"&&(Dp=[Ip*na.compositeIconSizes[0].evaluate(Un,{},Ma)*na.iconScaleFactor,Ip*na.compositeIconSizes[1].evaluate(Un,{},Ma)*na.iconScaleFactor],(Dp[0]>dx||Dp[1]>dx)&&Ur(`${jr.layerIds[0]}: Value for "icon-size" is >= ${tM}. Reduce your "icon-size".`)),jr.addSymbols(jr.icon,ku,Dp,Ln,As,Un,void 0,qn,rn,Es.lineStartIndex,Es.lineLength,-1,la,Ma,Ga,$a,jr.symbolInstances.length,WN),Eo=jr.icon.placedSymbolArray.length-1,r0&&(xi=4*WN,jr.addSymbols(jr.icon,r0,Dp,Ln,As,Un,ju.vertical,qn,rn,Es.lineStartIndex,Es.lineLength,-1,la,Ma,Ga,$a,jr.symbolInstances.length,WN),Io=jr.icon.placedSymbolArray.length-1)}for(const sc in $s.horizontal){const sd=sc,ku=$s.horizontal[sd];qa||(Sd=Pr(ku.text),vn?Ja=goe(ku):qa=b6(nr,ei,rn,yr,Or,Dr,ku,hn,pt.layout.get("text-rotate").evaluate(Un,{},Ma),Qn,Ci));const r0=ku.positionedLines.length===1;if(Ho+=e_e(jr,qn,rn,ku,Ba,pt,vn,Un,Qn,Es,$s.vertical?ju.horizontal:ju.horizontalOnly,r0?aVe($s.horizontal):[sd],sl,Eo,na,la,Ma,jr.symbolInstances.length,Ga),r0)break}$s.vertical&&(vl+=e_e(jr,qn,rn,$s.vertical,Ba,pt,vn,Un,Qn,Es,ju.vertical,["vertical"],sl,Io,na,la,Ma,jr.symbolInstances.length,Ga));let Wo=-1;const Mf=(sc,sd)=>sc?Math.max(sc,sd):sd;Wo=Mf(Ja,Wo),Wo=Mf(In,Wo),Wo=Mf(Fi,Wo);const Km=Wo>-1?1:0;jr.glyphOffsetArray.length>=65535&&Ur("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),Un.sortKey!==void 0&&jr.addToSortKeyRanges(jr.symbolInstances.length,Un.sortKey),jr.symbolInstances.emplaceBack(rn.x,rn.y,ei.x,ei.y,ei.z,sl.right>=0?sl.right:-1,sl.center>=0?sl.center:-1,sl.left>=0?sl.left:-1,sl.vertical>=0?sl.vertical:-1,Eo,Io,Sd,qa!==void 0?qa:jr.collisionBoxArray.length,qa!==void 0?qa+1:jr.collisionBoxArray.length,ri!==void 0?ri:jr.collisionBoxArray.length,ri!==void 0?ri+1:jr.collisionBoxArray.length,Qa!==void 0?Qa:jr.collisionBoxArray.length,Qa!==void 0?Qa+1:jr.collisionBoxArray.length,oo||jr.collisionBoxArray.length,oo?oo+1:jr.collisionBoxArray.length,yr,Ho,vl,Ta,xi,Km,0,lo,Wd,Wo,0,to?1:0,_a)})(f,Kr,gs,Br,u,g,k,v,f.layers[0],f.collisionBoxArray,c.index,c.sourceLayerIndex,f.index,vr,Fe,$,0,ur,tr,ke,c,S,W,K,X,se,fe,Se,wr,Ke,ht,ot)};if($e==="line")for(const Br of r6(c.geometry,0,0,Sr,Sr)){const Kr=eVe(Br,xr,pr,u.vertical||rr,g,Kt,lr,f.overscaling,Sr);for(const tn of Kr)rr&&pVe(f,rr.text,Xt,tn)||un(Br,tn,X)}else if($e==="line-center"){for(const Br of c.geometry)if(Br.length>1){const Kr=Jqe(Br,pr,u.vertical||rr,g,Kt,lr);Kr&&un(Br,Kr,X)}}else if(c.type==="Polygon")for(const Br of R5(c.geometry,0)){const Kr=nVe(Br,16);un(Br[0],new cx(Kr.x,Kr.y,0,0,void 0),X)}else if(c.type==="LineString")for(const Br of c.geometry)un(Br,new cx(Br[0].x,Br[0].y,0,0,void 0),X);else if(c.type==="Point")for(const Br of c.geometry)for(const Kr of Br)un([Kr],new cx(Kr.x,Kr.y,0,0,void 0),X)}const tM=255,dx=tM*Ip;function e_e(f,c,u,g,v,k,S,P,R,$,W,K,X,re,se,fe,Se,ke,Fe){const $e=function(ot,_t,Ct,Et,Kt,Rt,rr,or){const lr=[];if(_t.positionedLines.length===0)return lr;const xr=Et.layout.get("text-rotate").evaluate(Rt,{})*Math.PI/180,vr=function(mr){const Mr=mr[0],wr=mr[1],un=Mr*wr;return un>0?[Mr,-wr]:un<0?[-Mr,wr]:Mr===0?[wr,Mr]:[wr,-Mr]}(Ct);let ur=Math.abs(_t.top-_t.bottom);for(const mr of _t.positionedLines)ur-=mr.lineOffset;const pr=_t.positionedLines.length,tr=ur/pr;let Xt=_t.top-Ct[1];for(let mr=0;mrdx&&Ur(`${f.layerIds[0]}: Value for "text-size" is >= ${tM}. Reduce your "text-size".`)):Ke.kind==="composite"&&(ht=[Ip*se.compositeTextSizes[0].evaluate(P,{},Se)*se.textScaleFactor,Ip*se.compositeTextSizes[1].evaluate(P,{},Se)*se.textScaleFactor],(ht[0]>dx||ht[1]>dx)&&Ur(`${f.layerIds[0]}: Value for "text-size" is >= ${tM}. Reduce your "text-size".`)),f.addSymbols(f.text,$e,ht,R,S,P,W,c,u,$.lineStartIndex,$.lineLength,re,fe,Se,Fe,!1,ke,$e.length);for(const ot of K)X[ot]=f.text.placedSymbolArray.length-1;return 4*$e.length}function _6(f){for(const c in f)return f[c];return null}function b6(f,c,u,g,v,k,S,P,R,$,W){let K,X,re,se;if(K=W?W.top:S.top,X=W?W.bottom:S.bottom,re=W?W.left:S.left,se=W?W.right:S.right,loe(S)&&S.collisionPadding){const fe=S.collisionPadding;re-=fe[0],K-=fe[1],se+=fe[2],X+=fe[3]}if(R){const fe=new ir(re,K),Se=new ir(se,K),ke=new ir(re,X),Fe=new ir(se,X),$e=ss(R);let Ke=new ir(0,0);$&&(Ke=new ir($[0],$[1])),fe._rotateAround($e,Ke),Se._rotateAround($e,Ke),ke._rotateAround($e,Ke),Fe._rotateAround($e,Ke),re=Math.min(fe.x,Se.x,ke.x,Fe.x),se=Math.max(fe.x,Se.x,ke.x,Fe.x),K=Math.min(fe.y,Se.y,ke.y,Fe.y),X=Math.max(fe.y,Se.y,ke.y,Fe.y)}return f.emplaceBack(c.x,c.y,c.z,u.x,u.y,re,K,se,X,P,g,v,k),f.length-1}function goe(f){loe(f)&&f.collisionPadding&&(f.top-=f.collisionPadding[1],f.bottom+=f.collisionPadding[3]);const c=f.bottom-f.top;return c>0?Math.max(10,c):null}function pVe(f,c,u,g){const v=f.compareText;if(c in v){const k=v[c];for(let S=k.length-1;S>=0;S--)if(g.dist(k[S])$e&&(Ke(ot,lr,Ct,Et,rr,or),Ke(lr,_t,rr,or,Kt,Rt))}Ke(K,X,g,k,v,k),Ke(X,re,v,k,v,S),Ke(re,se,v,S,g,S),Ke(se,K,g,S,g,k),fe-=$e,Se-=$e,ke+=$e,Fe+=$e;const ht=1/Math.max(ke-fe,Fe-Se);return{scale:ht,x:fe*ht,y:Se*ht,x2:ke*ht,y2:Fe*ht,projection:c}}function r_e(f,{x:c,y:u},g=0){return new ir(((c-g)*f.scale-f.x)*Sr,(u*f.scale-f.y)*Sr)}const mVe=A(new Float32Array(16));class e0{constructor(c){this.spec=c,this.name=c.name,this.wrap=!1,this.requiresDraping=!1,this.supportsWorldCopies=!1,this.supportsTerrain=!1,this.supportsFog=!1,this.supportsFreeCamera=!1,this.zAxisUnit="meters",this.isReprojectedInTileSpace=!0,this.unsupportedLayers=["custom"],this.center=[0,0],this.range=[3.5,7]}project(c,u){return{x:0,y:0,z:0}}unproject(c,u){return new m(0,0)}projectTilePoint(c,u,g){return{x:c,y:u,z:0}}locationPoint(c,u,g,v=!0){return c._coordinatePoint(c.locationCoordinate(u,g),v)}pixelsPerMeter(c,u){return Y(1,c)*u}pixelSpaceConversion(c,u,g){return 1}farthestPixelDistance(c){return t_e(c,c.pixelsPerMeter)}pointCoordinate(c,u,g,v){const k=c.horizonLineFromTop(!1),S=new ir(u,Math.max(k,g));return c.rayIntersectionCoordinate(c.pointRayIntersection(S,v))}pointCoordinate3D(c,u,g){const v=new ir(u,g);if(c.elevation)return c.elevation.pointCoordinate(v);{const k=this.pointCoordinate(c,v.x,v.y,0);return[k.x,k.y,k.z]}}isPointAboveHorizon(c,u){if(c.elevation&&c.elevation.visibleDemTiles.length)return!this.pointCoordinate3D(c,u.x,u.y);const g=c.horizonLineFromTop();return u.y0?u<-BN+g&&(u=-BN+g):u>BN-g&&(u=BN-g);const S=k/Math.pow(j6(u),v);let P=S*Math.sin(v*c),R=k-S*Math.cos(v*c);return P=.5*(P/Math.PI+.5),R=.5*(R/Math.PI+.5),{x:P,y:this.southernCenter?R:1-R,z:0}}unproject(c,u){c=(2*c-.5)*Math.PI,this.southernCenter&&(u=1-u),u=(2*(1-u)-.5)*Math.PI;const{n:g,f:v}=this,k=v-u,S=Math.sign(k),P=Math.sign(g)*Math.sqrt(c*c+k*k);let R=Math.atan2(c,Math.abs(k))*S;k*g<0&&(R-=Math.PI*Math.sign(c)*S);const $=xe(yo(R/g)+this.center[0],-180,180),W=xe(yo(2*Math.atan(Math.pow(v/P,1/g))-BN),-de,de);return new m($,this.southernCenter?-W:W)}}class n_e extends e0{constructor(c){super(c),this.wrap=!0,this.supportsWorldCopies=!0,this.supportsTerrain=!0,this.supportsFog=!0,this.supportsFreeCamera=!0,this.isReprojectedInTileSpace=!1,this.unsupportedLayers=[],this.range=null}project(c,u){return{x:B(c),y:V(u),z:0}}unproject(c,u){const g=Q(c),v=ce(u);return new m(g,v)}}const s_e=ss(de);class _Ve extends e0{project(c,u){const g=(u=ss(u))*u,v=g*g;return{x:.5*((c=ss(c))*(.8707-.131979*g+v*(v*(.003971*g-.001529*v)-.013791))/Math.PI+.5),y:1-.5*(u*(1.007226+g*(.015085+v*(.028874*g-.044475-.005916*v)))/Math.PI+1),z:0}}unproject(c,u){c=(2*c-.5)*Math.PI;let g=u=(2*(1-u)-1)*Math.PI,v=25,k=0,S=g*g;do{S=g*g;const $=S*S;k=(g*(1.007226+S*(.015085+$*(.028874*S-.044475-.005916*$)))-u)/(1.007226+S*(.045255+$*(.259866*S-.311325-.005916*11*$))),g=xe(g-k,-s_e,s_e)}while(Math.abs(k)>1e-6&&--v>0);S=g*g;const P=xe(yo(c/(.8707+S*(S*(S*S*S*(.003971-.001529*S)-.013791)-.131979))),-180,180),R=yo(g);return new m(P,R)}}const a_e=ss(de);class bVe extends e0{project(c,u){u=ss(u),c=ss(c);const g=Math.cos(u),v=2/Math.PI,k=Math.acos(g*Math.cos(c/2)),S=Math.sin(k)/k,P=.5*(c*v+2*g*Math.sin(c/2)/S)||0,R=.5*(u+Math.sin(u)/S)||0;return{x:.5*(P/Math.PI+.5),y:1-.5*(R/Math.PI+1),z:0}}unproject(c,u){let g=c=(2*c-.5)*Math.PI,v=u=(2*(1-u)-1)*Math.PI,k=25;const S=1e-6;let P=0,R=0;do{const $=Math.cos(v),W=Math.sin(v),K=2*W*$,X=W*W,re=$*$,se=Math.cos(g/2),fe=Math.sin(g/2),Se=2*se*fe,ke=fe*fe,Fe=1-re*se*se,$e=Fe?1/Fe:0,Ke=Fe?Math.acos($*se)*Math.sqrt(1/Fe):0,ht=.5*(2*Ke*$*fe+2*g/Math.PI)-c,ot=.5*(Ke*W+v)-u,_t=.5*$e*(re*ke+Ke*$*se*X)+1/Math.PI,Ct=$e*(Se*K/4-Ke*W*fe),Et=.125*$e*(K*fe-Ke*W*re*Se),Kt=.5*$e*(X*se+Ke*ke*$)+.5,Rt=Ct*Et-Kt*_t;P=(ot*Ct-ht*Kt)/Rt,R=(ht*Et-ot*_t)/Rt,g=xe(g-P,-Math.PI,Math.PI),v=xe(v-R,-a_e,a_e)}while((Math.abs(P)>S||Math.abs(R)>S)&&--k>0);return new m(yo(g),yo(v))}}class i_e extends e0{constructor(c){super(c),this.center=c.center||[0,0],this.parallels=c.parallels||[0,0],this.cosPhi=Math.max(.01,Math.cos(ss(this.parallels[0]))),this.scale=1/(2*Math.max(Math.PI*this.cosPhi,1/this.cosPhi)),this.wrap=!0,this.supportsWorldCopies=!0}project(c,u){const{scale:g,cosPhi:v}=this;return{x:ss(c)*v*g+.5,y:-Math.sin(ss(u))/v*g+.5,z:0}}unproject(c,u){const{scale:g,cosPhi:v}=this,k=-(u-.5)/g,S=xe(yo((c-.5)/g)/v,-180,180),P=Math.asin(xe(k*v,-1,1)),R=xe(yo(P),-de,de);return new m(S,R)}}class wVe extends n_e{constructor(c){super(c),this.requiresDraping=!0,this.supportsWorldCopies=!1,this.supportsFog=!0,this.zAxisUnit="pixels",this.unsupportedLayers=["debug"],this.range=[3,5]}projectTilePoint(c,u,g){const v=E5(c,u,g);return Ze(v,v,GP(Rh(g))),{x:v[0],y:v[1],z:v[2]}}locationPoint(c,u,g){const v=Gy(u.lat,u.lng),k=Re([],v),S=g?c._centerAltitude+g:c.elevation?c.elevation.getAtPointOrZero(c.locationCoordinate(u),c._centerAltitude):c._centerAltitude;Le(v,v,k,Y(1,0)*Sr*S);const P=A(new Float64Array(16));return T(P,c.pixelMatrix,c.globeMatrix),Ze(v,v,P),new ir(v[0],v[1])}pixelsPerMeter(c,u){return Y(1,0)*u}pixelSpaceConversion(c,u,g){const v=Y(1,c)*u,k=Fn(Y(1,45)*u,v,g);return this.pixelsPerMeter(c,u)/k}createTileMatrix(c,u,g){const v=bie(Rh(g.canonical));return T(new Float64Array(16),c.globeMatrix,v)}createInversionMatrix(c,u){const{center:g}=c,v=GP(Rh(u));return q(v,v,ss(g.lng)),F(v,v,ss(g.lat)),z(v,v,[c._pixelsPerMercatorPixel,c._pixelsPerMercatorPixel,1]),Float32Array.from(v)}pointCoordinate(c,u,g,v){return Zy(c,u,g,!0)||new Ve(0,0)}pointCoordinate3D(c,u,g){const v=this.pointCoordinate(c,u,g,0);return[v.x,v.y,v.z]}isPointAboveHorizon(c,u){return!Zy(c,u.x,u.y,!1)}farthestPixelDistance(c){const u=function(v,k){const S=v.cameraToCenterDistance,P=v._centerAltitude*k,R=v._camera,$=v._camera.forward(),W=ue([],me([],$,-S),[0,0,P]),K=v.worldSize/(2*Math.PI),X=[0,0,-K],re=v.width/v.height,se=Math.tan(v.fovAboveCenter),fe=me([],R.up(),se),Se=me([],R.right(),se*re),ke=Re([],ue([],ue([],$,fe),Se)),Fe=[];let $e;if(new Jr(W,ke).closestPointOnSphere(X,K,Fe)){const Ke=ue([],Fe,X),ht=Me([],Ke,W);$e=Math.cos(v.fovAboveCenter)*ge(ht)}else{const Ke=Me([],W,X),ht=Me([],X,W);Re(ht,ht);const ot=ge(Ke)-K;$e=Math.sqrt(ot*(ot+2*K));const _t=Math.acos($e/(K+ot))-Math.acos(je($,ht));$e*=Math.cos(_t)}return 1.01*$e}(c,this.pixelsPerMeter(c.center.lat,c.worldSize)),g=Yy(c.zoom);if(g>0){const v=t_e(c,Y(1,c.center.lat)*c.worldSize),k=c.worldSize/(2*Math.PI),S=Math.max(c.width,c.height)/c.worldSize*Math.PI;return Fn(u,v+k*(1-Math.cos(S)),Math.pow(g,10))}return u}upVector(c,u,g){return E5(u,g,c,1)}upVectorScale(c){return{metersToTile:Sf(WP(Rh(c)))}}}function o_e(f){const c=f.parallels,u=!!c&&Math.abs(c[0]+c[1])<.01;switch(f.name){case"mercator":return new n_e(f);case"equirectangular":return new yVe(f);case"naturalEarth":return new _Ve(f);case"equalEarth":return new xVe(f);case"winkelTripel":return new bVe(f);case"albers":return u?new i_e(f):new gVe(f);case"lambertConformalConic":return u?new i_e(f):new vVe(f);case"globe":return new wVe(f)}throw new Error(`Invalid projection name: ${f.name}`)}const jVe=Lt.types,kVe=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function oM(f,c,u,g,v,k,S,P,R,$,W,K,X){const re=P?Math.min(dx,Math.round(P[0])):0,se=P?Math.min(dx,Math.round(P[1])):0;f.emplaceBack(c,u,Math.round(32*g),Math.round(32*v),k,S,(re<<1)+(R?1:0),0+(se<<1),16*$,16*W,256*K,256*X)}function lM(f,c,u){f.emplaceBack(c,u)}function cM(f,c,u,g,v,k,S){f.emplaceBack(c,u,g,v,k,S)}const k6=(f,c,u,g)=>{for(let v=0;v0&&(this.iconTransitioningVertexBuffer=c.createVertexBuffer(this.iconTransitioningVertexArray,Iqe.members,!0)),this.globeExtVertexArray.length>0&&(this.globeExtVertexBuffer=c.createVertexBuffer(this.globeExtVertexArray,Mqe.members,!0)),!this.zOffsetVertexBuffer&&(this.zOffsetVertexArray.length>0||k)&&(this.zOffsetVertexBuffer=c.createVertexBuffer(this.zOffsetVertexArray,Aqe.members,!0)),!this.orientationVertexBuffer&&this.orientationVertexArray&&this.orientationVertexArray.length>0&&(this.orientationVertexBuffer=c.createVertexBuffer(this.orientationVertexArray,Eqe.members,!0)),this.opacityVertexBuffer.itemSize=1),(g||v)&&this.programConfigurations.upload(c))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy(),this.iconTransitioningVertexBuffer&&this.iconTransitioningVertexBuffer.destroy(),this.globeExtVertexBuffer&&this.globeExtVertexBuffer.destroy(),this.zOffsetVertexBuffer&&this.zOffsetVertexBuffer.destroy(),this.orientationVertexBuffer&&this.orientationVertexBuffer.destroy())}}Yr(xoe,"SymbolBuffers");class yoe{constructor(c,u,g){this.layoutVertexArray=new c,this.layoutAttributes=u,this.indexArray=new g,this.segments=new Oi,this.collisionVertexArray=new g5,this.collisionVertexArrayExt=new Um}upload(c){this.layoutVertexBuffer=c.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=c.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=c.createVertexBuffer(this.collisionVertexArray,Pqe.members,!0),this.collisionVertexBufferExt=c.createVertexBuffer(this.collisionVertexArrayExt,Lqe.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy(),this.collisionVertexBufferExt.destroy())}}Yr(yoe,"CollisionBuffers");class N6{constructor(c){this.collisionBoxArray=c.collisionBoxArray,this.zoom=c.zoom,this.overscaling=c.overscaling,this.layers=c.layers,this.layerIds=this.layers.map(S=>S.fqid),this.index=c.index,this.pixelRatio=c.pixelRatio,this.sourceLayerIndex=c.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.fullyClipped=!1,this.hasAnyIconTextFit=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=A([]),this.placementViewportMatrix=A([]);const u=this.layers[0]._unevaluatedLayout._values;this.worldview=c.worldview,this.localizable=c.localizable,this.textSizeData=DN(this.zoom,u["text-size"],this.worldview),this.iconSizeData=DN(this.zoom,u["icon-size"],this.worldview);const g=this.layers[0].layout,v=g.get("symbol-sort-key"),k=g.get("symbol-z-order");this.lut=c.lut,this.canOverlap=g.get("text-allow-overlap")||g.get("icon-allow-overlap")||g.get("text-ignore-placement")||g.get("icon-ignore-placement"),this.sortFeaturesByKey=k!=="viewport-y"&&v.constantOr(1)!==void 0,this.sortFeaturesByY=(k==="viewport-y"||k==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,this.writingModes=g.get("text-writing-mode").map(S=>ju[S]),this.stateDependentLayerIds=this.layers.filter(S=>S.isStateDependent()).map(S=>S.id),this.sourceID=c.sourceID,this.projection=c.projection,this.hasAnyZOffset=!1,this.zOffsetSortDirty=!1,this.zOffsetBuffersNeedUpload=!1,this.elevationType="none",this.elevationStateComplete=!1,this.activeReplacements=[],this.replacementUpdateTime=0,this.hasAnySecondaryIcon=!1,this.hasAppearances=null,this.lastActiveApperance=null,this.featureToAppearanceIndex={}}hasAnyAppearanceProperty(c){const u=this.layers[0].getAppearances();return!(!u||u.length===0)&&u.some(g=>g.getProperty(c)!=null)}createArrays(){this.text=new xoe(new Oh(this.layers,{zoom:this.zoom,lut:this.lut},c=>c.startsWith("text")||c.startsWith("symbol"))),this.icon=new xoe(new Oh(this.layers,{zoom:this.zoom,lut:this.lut},c=>c.startsWith("icon")||c.startsWith("symbol"))),this.glyphOffsetArray=new yN,this.lineVertexArray=new $P,this.symbolInstances=new j5}calculateGlyphDependencies(c,u,g,v,k){for(const S of c){const P=S.codePointAt(0);if(P===void 0)break;if(u[P]=!0,v&&k&&P<=65535){const R=Y5[S];R&&(u[R.charCodeAt(0)]=!0)}}}calculateEffectiveAppearanceIconSize(c,u,g,v,k,S){let P=1;const R=c.getUnevaluatedProperties()._values["icon-size"],$=DN(this.zoom,R,this.worldview),W=RN($,u);if($.kind!=="constant"&&$.kind!=="camera"||(P=W.uSize),$.kind==="composite"){const{minZoom:K,maxZoom:X}=$,re=R.possiblyEvaluate(new ti(K,{worldview:this.worldview}),v),se=R.possiblyEvaluate(new ti(X,{worldview:this.worldview}),v),fe=re.evaluate(g,{},v,k);P=fe+(se.evaluate(g,{},v,k)-fe)*W.uSizeT}return $.kind==="source"&&(P=R.possiblyEvaluate(new ti(this.zoom,{worldview:this.worldview}),v).evaluate(g,{},v,k)),P*S}updateFootprints(c,u){}updateReplacement(c,u){if(u.updateTime===this.replacementUpdateTime)return!1;this.replacementUpdateTime=u.updateTime;const g=u.getReplacementRegionsForTile(c.toUnwrapped(),!0);return!JP(this.activeReplacements,g)&&(this.activeReplacements=g,!0)}getResolvedImageFromTokens(c){return typeof c=="string"?Jc.build(c):c}populate(c,u,g,v){const k=this.layers[0],S=k.layout,P=this.projection.name==="globe",R=S.get("text-font"),$=S.get("text-field"),W=S.get("icon-image"),[K,X]=S.get("icon-size-scale-range"),re=xe(u.scaleFactor||1,K,X),se=($.value.kind!=="constant"||$.value.value instanceof Qc&&!$.value.value.isEmpty()||$.value.value.toString().length>0)&&(R.value.kind!=="constant"||R.value.value.length>0),fe=W.value.kind!=="constant"||!!W.value.value||Object.keys(W.parameters).length>0,Se=this.hasAnyAppearanceProperty("icon-image"),ke=S.get("symbol-sort-key");if(this.features=[],this.appearanceFeatureData=[],!se&&!fe&&!Se)return;const Fe=u.iconDependencies,$e=u.glyphDependencies,Ke=u.availableImages,ht=new ti(this.zoom,{worldview:this.worldview,activeFloors:u.activeFloors}),ot=_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:Kt,sourceLayerIndex:Rt}=_t,rr=k._featureFilter.needGeometry,or=Dt(Ct,rr);if(!k._featureFilter.filter(ht,or,g))continue;if(rr||(or.geometry=St(Ct,g,v)),P&&Ct.type!==1&&g.z<=5){const mr=or.geometry,Mr=.98078528056,wr=(un,Br)=>je(E5(un.x,un.y,g,1),E5(Br.x,Br.y,g,1)){if(!mr.getProperty("icon-image"))return;const Mr=this.getCombinedIconPrimary(mr,vr,or,g,Ke,tr,re);Mr&&ot(Mr)}),lr){const mr=R.evaluate(or,{},g).join(","),Mr=S.get("text-rotation-alignment")==="map"&&S.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(ju.vertical)>=0;for(const wr of lr.sections)if(wr.image){const un=wr.image.getPrimary().scaleSelf(this.pixelRatio),Br=un.id.toString(),Kr=Fe.get(Br)||[];Kr.push(un),Fe.set(Br,Kr)}else{const un=Lv(lr.toString()),Br=wr.fontStack||mr,Kr=$e[Br]=$e[Br]||{};this.calculateGlyphDependencies(wr.text,Kr,Mr,this.allowVerticalPlacement,un)}}}if(S.get("symbol-placement")==="line"&&(this.features=function(_t){const Ct={},Et={},Kt=[];let Rt=0;function rr(vr){Kt.push(_t[vr]),Rt++}function or(vr,ur,pr){const tr=Et[vr];return delete Et[vr],Et[ur]=tr,Kt[tr].geometry[0].pop(),Kt[tr].geometry[0]=Kt[tr].geometry[0].concat(pr[0]),tr}function lr(vr,ur,pr){const tr=Ct[ur];return delete Ct[ur],Ct[vr]=tr,Kt[tr].geometry[0].shift(),Kt[tr].geometry[0]=pr[0].concat(Kt[tr].geometry[0]),tr}function xr(vr,ur,pr){const tr=pr?ur[0][ur[0].length-1]:ur[0][0];return`${vr}:${tr.x}:${tr.y}`}for(let vr=0;vr<_t.length;vr++){const ur=_t[vr],pr=ur.geometry,tr=ur.text?ur.text.toString():null;if(!tr){rr(vr);continue}const Xt=xr(tr,pr),mr=xr(tr,pr,!0);if(Xt in Et&&mr in Ct&&Et[Xt]!==Ct[mr]){const Mr=lr(Xt,mr,pr),wr=or(Xt,mr,Kt[Mr].geometry);delete Ct[Xt],delete Et[mr],Et[xr(tr,Kt[wr].geometry,!0)]=wr,Kt[Mr].geometry=null}else Xt in Et?or(Xt,mr,pr):mr in Ct?lr(Xt,mr,pr):(rr(vr),Ct[Xt]=Rt-1,Et[mr]=Rt-1)}return Kt.filter(vr=>vr.geometry)}(this.features)),S.get("symbol-elevation-reference")==="hd-road-markup"){if(this.elevationType="road",u.elevationFeatures){!this.elevationFeatures&&u.elevationFeatures.length>0&&(this.elevationFeatures=[],this.elevationFeatureIdToIndex=new Map);for(const _t of u.elevationFeatures)this.elevationFeatureIdToIndex.set(_t.id,this.elevationFeatures.length),this.elevationFeatures.push(_t)}}else S.get("symbol-z-elevate")&&(this.elevationType="offset");this.elevationType!=="none"&&(this.zOffsetBuffersNeedUpload=!0),this.sortFeaturesByKey&&this.features.sort((_t,Ct)=>_t.sortKey-Ct.sortKey)}getCombinedIconPrimary(c,u,g,v,k,S,P){let R,$;const W=c.getUnevaluatedProperties();if(W._values["icon-image"].value!==void 0){const K=u.getAppearanceValueAndResolveTokens(c,"icon-image",g,v,k);R=this.getResolvedImageFromTokens(K)}else{const K=u.getValueAndResolveTokens("icon-image",g,v,k);R=this.getResolvedImageFromTokens(K)}if(R){const K=W._values["icon-size"]||u._unevaluatedLayout._values["icon-size"];$=eM(R,DN(this.zoom,K,this.worldview),K,v,this.zoom,S,this.pixelRatio,P,this.worldview).iconPrimary}return $}updateAppearanceBasedIconTextures(c,u,g,v){if(!this.appearanceFeatureData||!this.icon.layoutVertexArray||this.icon.layoutVertexArray.length===0)return!1;const k=this.layers[0];let S=!1,P=0;const R=k.layout,[$,W]=R.get("icon-size-scale-range"),K=xe(1,$,W);for(let X=0;X=0){const Se=fe.id,ke=u&&Se!==void 0?u[String(Se)]:void 0,Fe={type:"Point",id:fe.id,properties:fe.properties,geometry:[]},$e=this.layers[0].appearances&&this.layers[0].appearances.find(Ke=>Ke.isActive({globals:v,feature:Fe,canonical:c,featureState:ke}));if(fe.activeAppearance===$e){P+=re.numIconVertices;continue}if($e){fe.activeAppearance=$e;const Ke=this.getCombinedIconPrimary($e,k,Fe,c,g,{sortKey:void 0,text:void 0,icon:null,index:re.featureIndex,sourceLayerIndex:re.featureIndex,geometry:[],properties:fe.properties,type:"Point",id:fe.id},K);if(!Ke)continue;const ht=Ke.toString(),ot=this.iconAtlasPositions&&this.iconAtlasPositions.get(ht);if(ot){const _t=k.getAppearanceValueAndResolveTokens($e,"icon-offset",Fe,c,g),Ct=_t&&Array.isArray(_t)?_t:[0,0];let Et=m6(ot,void 0,Ct,k.layout.get("icon-anchor").evaluate(Fe,{},c));const Kt=k.getAppearanceValueAndResolveTokens($e,"icon-rotate",Fe,c,g),Rt=typeof Kt=="number"?Kt:0,rr=ot.sdf,or=k.layout.get("icon-text-fit").constantOr("none");or!=="none"&&fe.textShaping&&fe.iconTextFitPadding&&fe.fontScale&&(Et=coe(Et,fe.textShaping,or,fe.iconTextFitPadding,Ct,fe.fontScale));const lr=this.calculateEffectiveAppearanceIconSize($e,v.zoom,Fe,c,g,K),xr=0,vr=1+(Math.min(dx,Math.round(lr*Ip))<<1),ur=foe(Et,Rt,rr,or!=="none",K);fe.isUsingAppearanceVertexData||(fe.isUsingAppearanceVertexData=!0,fe.layoutBasedVertexData=this.icon.getIconVertexData(P,re.numIconVertices));for(let tr=0;tr0&&(this.icon.updateIconVertexData(P,0,0,0,0,0,0,0,0,0,0,0,0),this.icon.updateIconVertexData(P+1,0,0,0,0,0,0,0,0,0,0,0,0),this.icon.updateIconVertexData(P+2,0,0,0,0,0,0,0,0,0,0,0,0),this.icon.updateIconVertexData(P+3,0,0,0,0,0,0,0,0,0,0,0,0),S=!0),P+=re.numIconVertices,fe.activeAppearance=null;else if(fe.isUsingAppearanceVertexData){const ht=fe.layoutBasedVertexData.length/12;for(let ot=0;ot0||X>0,Se=re>0,ke=this.elevationFeatures[R.elevationFeatureIndex];if(ke){const Fe=new ir(R.tileAnchorX,R.tileAnchorY),$e=.075+ke.pointElevation(Fe);R.zOffset!==$e&&(u=!0,R.zOffset=$e),$e!==0&&(this.hasAnyZOffset=!0);const Ke=ke.computeSlopeNormal(Fe,v),ht=Pn(mt(),ae(0,0,1),Ke);yt($,$,ht),yt(W,W,ht),$[2]*=g,W[2]*=g,$[0]===1&&$[1]===0&&$[2]===0&&W[0]===0&&W[1]===1&&W[2]===0||(k=k||fe,S=S||Se)}if(fe&&(k6(this.text.orientationVertexArray,K,$,W),k6(this.text.orientationVertexArray,X,$,W)),Se){const{placedIconSymbolIndex:Fe,verticalPlacedIconSymbolIndex:$e}=R;Fe>=0&&k6(this.icon.orientationVertexArray,re,$,W),$e>=0&&k6(this.icon.orientationVertexArray,se,$,W)}}k||(this.text.orientationVertexArray=void 0),S||(this.icon.orientationVertexArray=void 0),u&&(this.zOffsetBuffersNeedUpload=!0,this.zOffsetSortDirty=!0)}updateZOffset(){const c=(k,S,P)=>{g+=S,g>k.length&&k.resize(g);for(let R=-S;R<0;R++)k.emplace(R+g,P)},u=(k,S,P)=>{v+=S,v>k.length&&k.resize(v);for(let R=-S;R<0;R++)k.emplace(R+v,P)};if(!this.zOffsetBuffersNeedUpload)return;this.zOffsetBuffersNeedUpload=!1;let g=0,v=0;for(let k=0;k0;if((P>0||R>0)&&(c(this.text.zOffsetVertexArray,P,W),c(this.text.zOffsetVertexArray,R,W)),K){const{placedIconSymbolIndex:X,verticalPlacedIconSymbolIndex:re}=S;X>=0&&u(this.icon.zOffsetVertexArray,$,W),re>=0&&u(this.icon.zOffsetVertexArray,S.numVerticalIconVertices,W)}}this.text.zOffsetVertexBuffer&&this.text.zOffsetVertexBuffer.updateData(this.text.zOffsetVertexArray),this.icon.zOffsetVertexBuffer&&this.icon.zOffsetVertexBuffer.updateData(this.icon.zOffsetVertexArray)}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(c,u,g,v,k){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(c),this.iconCollisionBox.upload(c)),this.text.upload(c,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload,this.zOffsetBuffersNeedUpload,!1),this.hasAppearances===null&&(this.hasAppearances=this.layers.some(S=>S.appearances&&S.appearances.length>0)),this.icon.upload(c,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload,this.zOffsetBuffersNeedUpload,this.hasAppearances),this.uploaded=!0}updateAppearances(c,u,g,v){return!!(c&&u&&g)&&!(!this.icon.layoutVertexArray||this.icon.layoutVertexArray.length===0)&&!!this.icon.layoutVertexArray.arrayBuffer&&void(this.updateAppearanceBasedIconTextures(c,u,g,v)&&this.icon.layoutVertexBuffer&&this.icon.layoutVertexArray.arrayBuffer!==null&&this.icon.layoutVertexArray.length===this.icon.layoutVertexBuffer.length&&this.icon.layoutVertexBuffer.updateData(this.icon.layoutVertexArray))}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}getProjection(){return this.projectionInstance||(this.projectionInstance=o_e(this.projection)),this.projectionInstance}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(c,u){const g=this.lineVertexArray.length;if(c.segment!==void 0)for(const{x:v,y:k}of u)this.lineVertexArray.emplaceBack(v,k);return{lineStartIndex:g,lineLength:this.lineVertexArray.length-g}}addSymbols(c,u,g,v,k,S,P,R,$,W,K,X,re,se,fe,Se,ke,Fe){const $e=c.indexArray,Ke=c.layoutVertexArray,ht=c.globeExtVertexArray,ot=c.segments.prepareSegment(4*Fe,Ke,$e,this.canOverlap?S.sortKey:void 0),_t=this.glyphOffsetArray.length,Ct=ot.vertexLength,Et=this.allowVerticalPlacement&&P===ju.vertical?Math.PI/2:0,Kt=S.text&&S.text.sections;for(let or=0;or=0?u.rightJustifiedTextSymbolIndex:u.centerJustifiedTextSymbolIndex>=0?u.centerJustifiedTextSymbolIndex:u.leftJustifiedTextSymbolIndex>=0?u.leftJustifiedTextSymbolIndex:u.verticalPlacedTextSymbolIndex>=0?u.verticalPlacedTextSymbolIndex:v),S=doe(this.textSizeData,c,k)/yl;return this.tilePixelRatio*S}getSymbolInstanceIconSize(c,u,g){const v=this.icon.placedSymbolArray.get(g),k=doe(this.iconSizeData,c,v);return this.tilePixelRatio*k}_commitDebugCollisionVertexUpdate(c,u,g,v){c.emplaceBack(u,-g,-g,v),c.emplaceBack(u,g,-g,v),c.emplaceBack(u,g,g,v),c.emplaceBack(u,-g,g,v)}_updateTextDebugCollisionBoxes(c,u,g,v,k,S,P){for(let R=v;R0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}hasIconTextFit(){return this.hasAnyIconTextFit}addIndicesForPlacedSymbol(c,u){const g=c.placedSymbolArray.get(u),v=g.vertexStartIndex+4*g.numGlyphs;for(let k=g.vertexStartIndex;kv[P]-v[R]||k[R]-k[P]),S}getSortedIndexesByZOffset(){if(!this.zOffsetSortDirty)return this.symbolInstanceIndexesSortedZOffset;if(!this.symbolInstanceIndexesSortedZOffset){this.symbolInstanceIndexesSortedZOffset=[];for(let c=0;cthis.symbolInstances.get(u).zOffset-this.symbolInstances.get(c).zOffset)}addToSortKeyRanges(c,u){const g=this.sortKeyRanges[this.sortKeyRanges.length-1];g&&g.sortKey===u?g.symbolInstanceEnd=c+1:this.sortKeyRanges.push({sortKey:u,symbolInstanceStart:c,symbolInstanceEnd:c+1})}sortFeatures(c){if(this.sortFeaturesByY&&this.sortedAngle!==c&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(c),this.sortedAngle=c,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const u of this.symbolInstanceIndexes){const g=this.symbolInstances.get(u);this.featureSortOrder.push(g.featureIndex);const{rightJustifiedTextSymbolIndex:v,centerJustifiedTextSymbolIndex:k,leftJustifiedTextSymbolIndex:S,verticalPlacedTextSymbolIndex:P,placedIconSymbolIndex:R,verticalPlacedIconSymbolIndex:$}=g;v>=0&&this.addIndicesForPlacedSymbol(this.text,v),k>=0&&k!==v&&this.addIndicesForPlacedSymbol(this.text,k),S>=0&&S!==k&&S!==v&&this.addIndicesForPlacedSymbol(this.text,S),P>=0&&this.addIndicesForPlacedSymbol(this.text,P),R>=0&&this.addIndicesForPlacedSymbol(this.icon,R),$>=0&&this.addIndicesForPlacedSymbol(this.icon,$)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}getElevationFeatureForText(c){const u=this.symbolInstances.get(this.text.symbolInstanceIndices[c]).elevationFeatureIndex;let g;return this.elevationFeatures&&ug in f?String(f[g]):"")}let c_e,d_e,voe;Yr(N6,"SymbolBucket",{omit:["layers","collisionBoxArray","compareText","features"]}),N6.addDynamicAttributes=$N;class u_e{constructor(c){this.type=c.property.overrides?c.property.overrides.runtimeType:Ah,this.defaultValue=c}evaluate(c){if(c.formattedSection){const u=this.defaultValue.property.overrides;if(u&&u.hasOverride(c.formattedSection))return u.getOverride(c.formattedSection)}return c.feature&&c.featureState?this.defaultValue.evaluate(c.feature,c.featureState):this.defaultValue.property.specification.default}eachChild(c){this.defaultValue.isConstant()||c(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}Yr(u_e,"FormatSectionOverride",{omit:["defaultValue"]});const _oe=()=>voe||(voe={layout:c_e||(c_e=new Wi({"symbol-placement":new kr(Ft.layout_symbol["symbol-placement"]),"symbol-spacing":new kr(Ft.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new kr(Ft.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Er(Ft.layout_symbol["symbol-sort-key"]),"symbol-z-order":new kr(Ft.layout_symbol["symbol-z-order"]),"symbol-z-elevate":new kr(Ft.layout_symbol["symbol-z-elevate"]),"symbol-elevation-reference":new kr(Ft.layout_symbol["symbol-elevation-reference"]),"icon-allow-overlap":new kr(Ft.layout_symbol["icon-allow-overlap"]),"icon-ignore-placement":new kr(Ft.layout_symbol["icon-ignore-placement"]),"icon-optional":new kr(Ft.layout_symbol["icon-optional"]),"icon-rotation-alignment":new kr(Ft.layout_symbol["icon-rotation-alignment"]),"icon-size":new Er(Ft.layout_symbol["icon-size"]),"icon-size-scale-range":new kr(Ft.layout_symbol["icon-size-scale-range"]),"icon-text-fit":new Er(Ft.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Er(Ft.layout_symbol["icon-text-fit-padding"]),"icon-image":new Er(Ft.layout_symbol["icon-image"]),"icon-image-use-theme":new kr({type:"string",default:"default","property-type":"data-constant"}),"icon-rotate":new Er(Ft.layout_symbol["icon-rotate"]),"icon-padding":new kr(Ft.layout_symbol["icon-padding"]),"icon-keep-upright":new kr(Ft.layout_symbol["icon-keep-upright"]),"icon-offset":new Er(Ft.layout_symbol["icon-offset"]),"icon-anchor":new Er(Ft.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new kr(Ft.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new kr(Ft.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new kr(Ft.layout_symbol["text-rotation-alignment"]),"text-field":new Er(Ft.layout_symbol["text-field"]),"text-font":new Er(Ft.layout_symbol["text-font"]),"text-size":new Er(Ft.layout_symbol["text-size"]),"text-size-scale-range":new kr(Ft.layout_symbol["text-size-scale-range"]),"text-max-width":new Er(Ft.layout_symbol["text-max-width"]),"text-line-height":new Er(Ft.layout_symbol["text-line-height"]),"text-letter-spacing":new Er(Ft.layout_symbol["text-letter-spacing"]),"text-justify":new Er(Ft.layout_symbol["text-justify"]),"text-radial-offset":new Er(Ft.layout_symbol["text-radial-offset"]),"text-variable-anchor":new kr(Ft.layout_symbol["text-variable-anchor"]),"text-anchor":new Er(Ft.layout_symbol["text-anchor"]),"text-max-angle":new kr(Ft.layout_symbol["text-max-angle"]),"text-writing-mode":new kr(Ft.layout_symbol["text-writing-mode"]),"text-rotate":new Er(Ft.layout_symbol["text-rotate"]),"text-padding":new kr(Ft.layout_symbol["text-padding"]),"text-keep-upright":new kr(Ft.layout_symbol["text-keep-upright"]),"text-transform":new Er(Ft.layout_symbol["text-transform"]),"text-offset":new Er(Ft.layout_symbol["text-offset"]),"text-allow-overlap":new kr(Ft.layout_symbol["text-allow-overlap"]),"text-ignore-placement":new kr(Ft.layout_symbol["text-ignore-placement"]),"text-optional":new kr(Ft.layout_symbol["text-optional"]),visibility:new kr(Ft.layout_symbol.visibility)})),paint:d_e||(d_e=new Wi({"icon-opacity":new Er(Ft.paint_symbol["icon-opacity"]),"icon-occlusion-opacity":new Er(Ft.paint_symbol["icon-occlusion-opacity"]),"icon-emissive-strength":new Er(Ft.paint_symbol["icon-emissive-strength"]),"text-emissive-strength":new Er(Ft.paint_symbol["text-emissive-strength"]),"icon-color":new Er(Ft.paint_symbol["icon-color"]),"icon-halo-color":new Er(Ft.paint_symbol["icon-halo-color"]),"icon-halo-width":new Er(Ft.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Er(Ft.paint_symbol["icon-halo-blur"]),"icon-translate":new kr(Ft.paint_symbol["icon-translate"]),"icon-translate-anchor":new kr(Ft.paint_symbol["icon-translate-anchor"]),"icon-image-cross-fade":new kr(Ft.paint_symbol["icon-image-cross-fade"]),"text-opacity":new Er(Ft.paint_symbol["text-opacity"]),"text-occlusion-opacity":new Er(Ft.paint_symbol["text-occlusion-opacity"]),"text-color":new Er(Ft.paint_symbol["text-color"],{runtimeType:wd,getOverride:f=>f.textColor,hasOverride:f=>!!f.textColor}),"text-halo-color":new Er(Ft.paint_symbol["text-halo-color"]),"text-halo-width":new Er(Ft.paint_symbol["text-halo-width"]),"text-halo-blur":new Er(Ft.paint_symbol["text-halo-blur"]),"text-translate":new kr(Ft.paint_symbol["text-translate"]),"text-translate-anchor":new kr(Ft.paint_symbol["text-translate-anchor"]),"icon-color-saturation":new kr(Ft.paint_symbol["icon-color-saturation"]),"icon-color-contrast":new kr(Ft.paint_symbol["icon-color-contrast"]),"icon-color-brightness-min":new kr(Ft.paint_symbol["icon-color-brightness-min"]),"icon-color-brightness-max":new kr(Ft.paint_symbol["icon-color-brightness-max"]),"symbol-z-offset":new Er(Ft.paint_symbol["symbol-z-offset"]),"icon-color-use-theme":new Er({type:"string",default:"default","property-type":"data-driven"}),"icon-halo-color-use-theme":new Er({type:"string",default:"default","property-type":"data-driven"}),"text-color-use-theme":new Er({type:"string",default:"default","property-type":"data-driven"}),"text-halo-color-use-theme":new Er({type:"string",default:"default","property-type":"data-driven"})}))},voe);class S6 extends rd{constructor(c,u,g,v){super(c,_oe(),u,g,v,c.layout?c.layout["icon-image-use-theme"]:null),this._colorAdjustmentMatrix=A([]),this.hasOcclusionOpacityProperties=c.paint!==void 0&&("icon-occlusion-opacity"in c.paint||"text-occlusion-opacity"in c.paint)}_handleSpecialPaintPropertyUpdate(c){c!=="icon-occlusion-opacity"&&c!=="text-occlusion-opacity"||(this.hasOcclusionOpacityProperties=!0)}recalculate(c,u){super.recalculate(c,u),this.appearances&&this.appearances.forEach(v=>{v.recalculate(c,u,this.iconImageUseTheme)}),this.layout.get("icon-rotation-alignment")==="auto"&&(this.layout._values["icon-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-rotation-alignment")==="auto"&&(this.layout._values["text-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-pitch-alignment")==="auto"&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")),this.layout.get("icon-pitch-alignment")==="auto"&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment"));const g=this.layout.get("text-writing-mode");if(g){const v=[];for(const k of g)v.indexOf(k)<0&&v.push(k);this.layout._values["text-writing-mode"]=v}else this.layout._values["text-writing-mode"]=this.layout.get("symbol-placement")==="point"?["horizontal"]:["horizontal","vertical"];this._setPaintOverrides()}getColorAdjustmentMatrix(c,u,g,v){return this._saturation===c&&this._contrast===u&&this._brightnessMin===g&&this._brightnessMax===v||(this._colorAdjustmentMatrix=function(k,S,P,R){k=ki(k),S=Ws(S);const $=C(),W=k/3,K=1-2*W,X=[K,W,W,0,W,K,W,0,W,W,K,0,0,0,0,1],re=.5-.5*S,se=R-P;return T($,[se,0,0,0,0,se,0,0,0,0,se,0,P,P,P,1],[S,0,0,0,0,S,0,0,0,0,S,0,re,re,re,1]),T($,$,X),$}(c,u,g,v),this._saturation=c,this._contrast=u,this._brightnessMin=g,this._brightnessMax=v),this._colorAdjustmentMatrix}getValueAndResolveTokens(c,u,g,v){const k=this.layout.get(c).evaluate(u,{},g,v),S=this._unevaluatedLayout._values[c];return S.isDataDriven()||Iv(S.value)||!k?k:l_e(u.properties,k)}getAppearanceValueAndResolveTokens(c,u,g,v,k){const S=c.getProperty(u);if(!S)return;const P=S.evaluate(g,{},v,k),R=c.getUnevaluatedProperties()._values[u];return R.isDataDriven()||Iv(R.value)||!P||typeof P!="string"?P:l_e(g.properties,P)}createBucket(c){return new N6(c)}queryRadius(){return 0}queryIntersectsFeature(){return!1}_setPaintOverrides(){for(const c of _oe().paint.overridableProperties){if(!S6.hasPaintOverride(this.layout,c))continue;const u=this.paint.get(c),g=new u_e(u),v=new Kk(g,u.property.specification,this.scope,this.options,this.layout.get("icon-image-use-theme"));let k=null;k=u.value.kind==="constant"||u.value.kind==="source"?new Fy("source",v):new Xg("composite",v,u.value.zoomStops,u.value.interpolationType),this.paint._values[c]=new Jg(u.property,k,u.parameters)}}_handleOverridablePaintPropertyUpdate(c,u,g){return!(!this.layout||u.isDataDriven()||g.isDataDriven())&&S6.hasPaintOverride(this.layout,c)}static hasPaintOverride(c,u){const g=c.get("text-field"),v=_oe().paint.properties[u];let k=!1;const S=P=>{for(const R of P)if(v.overrides&&v.overrides.hasOverride(R))return void(k=!0)};if(g.value.kind==="constant"&&g.value.value instanceof Qc)S(g.value.value.sections);else if(g.value.kind==="source"){const P=$=>{k||($ instanceof gp&&xl($.value)===xv?S($.value.sections):$ instanceof yf?S($.sections):$.eachChild(P))},R=g.value;R._styleExpression&&P(R._styleExpression.expression)}return k}getProgramIds(){return["symbol"]}getDefaultProgramParams(c,u,g){return{config:new Vm(this,{zoom:u,lut:g}),overrideFog:!1}}hasElevation(){return this.layout&&this.layout.get("symbol-elevation-reference")==="hd-road-markup"}}let h_e,f_e,p_e,m_e;var boe=Ts([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);function C6(f,c,u,g,v,k,S,P){const R=[f,c,1,u,g,1,v,k,1],$=[S,P,1],W=b([],R),[K,X,re]=pe($,$,W);return j(R,R,[K,0,0,0,X,0,0,0,re])}function g_e(f,c,u,g,v,k,S,P){const R=function($,W,K,X,re,se,fe,Se){const ke=C6(0,0,1,0,1,1,0,1),Fe=C6($,W,K,X,re,se,fe,Se);return j(Fe,Fe,b([],ke))}(f,c,u,g,v,k,S,P);return[R[2]/R[8]/Sr,R[5]/R[8]/Sr]}function M6(f){return[f[0],Math.min(Math.max(f[1],-de),de)]}class x_e extends pi{constructor(c,u,g,v){super(),this.id=c,this.dispatcher=g,this.coordinates=u.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.onNorthPole=!1,this.onSouthPole=!1,this.setEventedParent(v),this.options=u,this._dirty=!1}load(c,u){if(this._loaded=u||!1,this.fire(new Hn("dataloading",{dataType:"source"})),this.url=this.options.url,!this.url)return c&&(this.coordinates=c),this._loaded=!0,void this._finishLoading();this._imageRequest=jy(this.map._requestManager.transformRequest(this.url,qg.Image),(g,v)=>{this._imageRequest=null,this._loaded=!0,g?this.fire(new ts(g)):v&&(this.image=v instanceof HTMLImageElement?$o.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 G5(this.map.painter.context,c.handle),this.width=c.dimensions[0],this.height=c.dimensions[1],this._dirty=!1,this._loaded=!0,this._finishLoading(),this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new Hn("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(c){this.map=c,this.load()}onRemove(c){this._imageRequest&&(this._imageRequest.cancel(),this._imageRequest=null),!this.texture||this.texture instanceof G5||this.texture.destroy(),this.boundsBuffer&&(this.boundsBuffer.destroy(),this.elevatedGlobeVertexBuffer&&this.elevatedGlobeVertexBuffer.destroy(),this.elevatedGlobeIndexBuffer&&this.elevatedGlobeIndexBuffer.destroy())}setCoordinates(c){if(this.coordinates=c,this._boundsArray=void 0,this._unsupportedCoords=!1,!c.length)return this;this.onNorthPole=!1,this.onSouthPole=!1;let u=c[0][1],g=c[0][1];for(const k of c)k[1]>g&&(g=k[1]),k[1]de?this.onNorthPole=!0:v<-de&&(this.onSouthPole=!0),!this.onNorthPole&&!this.onSouthPole){const k=c.map(Ve.fromLngLat);this.tileID=function(S){let P=1/0,R=1/0,$=-1/0,W=-1/0;for(const fe of S)P=Math.min(P,fe.x),R=Math.min(R,fe.y),$=Math.max($,fe.x),W=Math.max(W,fe.y);const K=Math.max($-P,W-R),X=Math.max(0,Math.floor(-Math.log2(K))),re=Math.pow(2,X);let se=Math.floor((P+$)/2*re);return se>1&&(se-=1),new Wa(X,se,Math.floor((R+W)/2*re))}(k),this.minzoom=this.maxzoom=this.tileID.z}return this.fire(new Hn("data",{dataType:"source",sourceDataType:"content"})),this}_clear(){!this.texture||this.texture instanceof G5||(this.texture.destroy(),this._dirty=!0),this.texture=null,this._boundsArray=void 0,this._unsupportedCoords=!1}_prepareData(c){for(const ke in this.tiles){const Fe=this.tiles[ke];Fe.state!=="loaded"&&(Fe.state="loaded",Fe.texture=this.texture)}if(this._boundsArray||this.onNorthPole||this.onSouthPole||this._unsupportedCoords)return;const u=rM(new Wa(0,0,0),this.map.transform.projection),g=[u.projection.project(this.coordinates[0][0],this.coordinates[0][1]),u.projection.project(this.coordinates[1][0],this.coordinates[1][1]),u.projection.project(this.coordinates[2][0],this.coordinates[2][1]),u.projection.project(this.coordinates[3][0],this.coordinates[3][1])];if(!function(ke){const Fe=ke[1].x-ke[0].x,$e=ke[1].y-ke[0].y,Ke=ke[2].x-ke[1].x,ht=ke[2].y-ke[1].y,ot=ke[3].x-ke[2].x,_t=ke[3].y-ke[2].y,Ct=ke[0].x-ke[3].x,Et=ke[0].y-ke[3].y,Kt=Fe*ht-Ke*$e,Rt=Ke*_t-ot*ht,rr=ot*Et-Ct*_t,or=Ct*$e-Fe*Et;return Kt>0&&Rt>0&&rr>0&&or>0||Kt<0&&Rt<0&&rr<0&&or<0}(g))return console.warn("Image source coordinates are defining non-convex area in the Mercator projection"),void(this._unsupportedCoords=!0);const v=rM(this.tileID,this.map.transform.projection),[k,S,P,R]=this.coordinates.map(ke=>{const Fe=v.projection.project(ke[0],ke[1]);return r_e(v,Fe)._round()});this.perspectiveTransform=g_e(k.x,k.y,S.x,S.y,P.x,P.y,R.x,R.y);const $=this._boundsArray=new Uy;$.emplaceBack(k.x,k.y,0,0),$.emplaceBack(S.x,S.y,Sr,0),$.emplaceBack(R.x,R.y,0,Sr),$.emplaceBack(P.x,P.y,Sr,Sr),this.boundsBuffer&&(this.boundsBuffer.destroy(),this.elevatedGlobeVertexBuffer&&this.elevatedGlobeVertexBuffer.destroy(),this.elevatedGlobeIndexBuffer&&this.elevatedGlobeIndexBuffer.destroy()),this.boundsBuffer=c.createVertexBuffer($,boe.members),this.boundsSegments=Oi.simpleSegment(0,0,4,2);const W=[],K=[M6((X=this.coordinates)[0]),M6(X[1]),M6(X[2]),M6(X[3])];var X;const[re,se,fe,Se]=function(ke){let Fe=ke[0][0],$e=Fe,Ke=ke[0][1],ht=Ke;for(let ot=1;ot$e&&($e=ke[ot][0]),ke[ot][1]ht&&(ht=ke[ot][1]);return[Fe,Ke,$e-Fe,ht-Ke]}(K);{const ke=new Uy,[Fe,$e,Ke,ht]=function(ur){let pr=ur[0].x,tr=pr,Xt=ur[0].y,mr=Xt;for(let Mr=1;Mrtr&&(tr=ur[Mr].x),ur[Mr].ymr&&(mr=ur[Mr].y);return[pr,Xt,tr-pr,mr-Xt]}(g),ot=ur=>[(ur.x-Fe)/Ke,(ur.y-$e)/ht],[_t,Ct,Et,Kt]=g.map(ot),Rt=function(ur,pr,tr,Xt,mr,Mr,wr,un){const Br=C6(0,0,1,0,1,1,0,1);return j(Br,Br,b([],C6(ur,pr,tr,Xt,mr,Mr,wr,un)))}(_t[0],_t[1],Ct[0],Ct[1],Et[0],Et[1],Kt[0],Kt[1]);this.elevatedGlobePerspectiveTransform=g_e(_t[0],_t[1],Ct[0],Ct[1],Et[0],Et[1],Kt[0],Kt[1]);const rr=(ur,pr)=>{W.push(ur.lng);const tr=Math.round((ur.lng-re)/fe*Sr),Xt=Math.round((ur.lat-se)/Se*Sr),mr=ot(pr),Mr=pe([],[mr[0],mr[1],1],Rt),wr=Math.round(Mr[0]/Mr[2]*Sr),un=Math.round(Mr[1]/Mr[2]*Sr);ke.emplaceBack(tr,Xt,wr,un)},or=g[3].x-g[0].x,lr=g[3].y-g[0].y,xr=g[2].x-g[1].x,vr=g[2].y-g[1].y;for(let ur=0;ur<65;ur++){const pr=ur/64,tr=[g[0].x+pr*or,g[0].y+pr*lr],Xt=[g[1].x+pr*xr,g[1].y+pr*vr],mr=Xt[0]-tr[0],Mr=Xt[1]-tr[1];for(let wr=0;wr<65;wr++){const un=wr/64,Br={x:tr[0]+mr*un,y:tr[1]+Mr*un};rr(u.projection.unproject(Br.x,Br.y),Br)}}this.elevatedGlobeVertexBuffer=c.createVertexBuffer(ke,boe.members)}{this.maxLongitudeTriangleSize=0;let ke=[],Fe=new Uo;const $e=(Ke,ht,ot)=>{Fe.emplaceBack(Ke,ht,ot);const _t=W[Ke],Ct=W[ht],Et=W[ot],Kt=Math.min(Math.min(_t,Ct),Et),Rt=Math.max(Math.max(_t,Ct),Et)-Kt;Rt>this.maxLongitudeTriangleSize&&(this.maxLongitudeTriangleSize=Rt),ke.push(Kt+Rt/2)};for(let Ke=0;Ke<64;Ke++)for(let ht=0;ht<64;ht++){const ot=65*Ke+ht,_t=ot+1,Ct=ot+65,Et=Ct+1;$e(ot,Ct,_t),$e(_t,Ct,Et)}[ke,Fe]=function(Ke,ht){const ot=Array.from({length:Ke.length},(Et,Kt)=>Kt);ot.sort((Et,Kt)=>Ke[Et]-Ke[Kt]);const _t=[],Ct=new Uo;for(let Et=0;Et{S.segments.push({vertexOffset:0,primitiveOffset:K,vertexLength:u.segments[0].vertexLength,primitiveLength:X,sortKey:void 0,vaos:{}})},R=.51*this.maxLongitudeTriangleSize;if(Math.abs(g[0]-v)<=R){const K=ji(g,0,g.length,v+R);return K===g.length||P(K,vo(g,K+1,g.length,v+360-R)-K),S}vSr?v-Sr:v,new ir(Math.trunc(v),Math.trunc(g[u+1]))}translationForInstance(c){const u=16*c,g=this.instancedDataArray.float32;return[g[u+4],g[u+5],g[u+6]]}rotationScaleForInstance(c){const u=16*c,g=this.instancedDataArray.float32;return[g[u+7],g[u+8],g[u+9],g[u+10],g[u+11],g[u+12],g[u+13],g[u+14],g[u+15]]}transformForInstance(c){const u=16*c,g=this.instancedDataArray.float32;return[g[u+7],g[u+8],g[u+9],g[u+4],g[u+10],g[u+11],g[u+12],g[u+5],g[u+13],g[u+14],g[u+15],g[u+6],0,0,0,1]}}class koe{constructor(c){this.zoom=c.zoom,this.canonical=c.canonical,this.overscaledZ=this.canonical.z+Math.log2(c.overscaling),this.layers=c.layers,this.layerIds=this.layers.map(u=>u.fqid),this.projection=c.projection,this.index=c.index,this.worldview=c.worldview,this.hasZoomDependentProperties=this.layers[0].isZoomDependent(),this.stateDependentLayerIds=this.layers.filter(u=>u.isStateDependent()).map(u=>u.id),this.hasPattern=!1,this.instancesPerModel={},this.validForExaggeration=0,this.maxVerticalOffset=0,this.maxScale=0,this.maxHeight=0,this.lookupDim=this.zoom>this.canonical.z+1?0:this.zoom>this.canonical.z?256:this.zoom>15?75:100,this.instanceCount=0,this.terrainElevationMin=0,this.terrainElevationMax=0,this.validForDEMTile={id:null,timestamp:0},this.modelUris=[],this.modelsRequested=!1,this.activeReplacements=[],this.replacementUpdateTime=0,this.styleDefinedModelURLs=c.styleDefinedModelURLs,this.hasAppearances=null}updateFootprints(c,u){}updateAppearances(c,u,g,v){}populate(c,u,g,v){this.tileToMeter=Pe(g);const k=this.layers[0]._featureFilter.needGeometry;this.lookup=new Uint8Array(this.lookupDim*this.lookupDim);for(const{feature:S,id:P,index:R,sourceLayerIndex:$}of c){const W=P??(S.properties&&S.properties.hasOwnProperty("id")?S.properties.id:void 0),K=Dt(S,k);if(!this.layers[0]._featureFilter.filter(new ti(this.zoom,{worldview:this.worldview,activeFloors:u.activeFloors}),K,g))continue;const X={id:W,sourceLayerIndex:$,index:R,geometry:k?K.geometry:St(S,g,v),properties:S.properties,type:S.type,patterns:{}},re=this.addFeature(X,X.geometry,K);re&&u.featureIndex.insert(S,X.geometry,R,$,this.index,this.instancesPerModel[re].instancedDataArray.length,Sr/32)}this.lookup=null}evaluateQueryRenderedFeaturePadding(){const c=this.layers[0].modelManager,u=this.layers[0].scope;let g=0;for(const v of this.modelUris){const k=c.getModel(v,u);if(!k)continue;const S=this.instancesPerModel[v];if(S){const P=.5*Ne(k.aabb.max,k.aabb.min)*S.maxScale+S.maxXYTranslationDistance,R=Math.min(Sr,Math.max(P/this.tileToMeter,Sr/32));g=Math.max(R,g)}}return g}update(c,u,g,v){for(const k in this.instancesPerModel){const S=this.instancesPerModel[k];for(const P in c)S.idToFeaturesIndex.hasOwnProperty(P)&&(this.evaluate(S.features[S.idToFeaturesIndex[P]],c[P],S,!0),this.uploaded=!1)}this.maxHeight=0}updateZoomBasedPaintProperties(){if(!this.hasZoomDependentProperties)return!1;let c=!1;for(const u in this.instancesPerModel){const g=this.instancesPerModel[u];for(const v of g.features){const k=this.layers[0],S=v.feature,P=this.canonical,R=k.paint.get("model-rotation").evaluate(S,{},P),$=k.paint.get("model-scale").evaluate(S,{},P),W=k.paint.get("model-translation").evaluate(S,{},P);at(v.rotation,R)&&at(v.scale,$)&&at(v.translation,W)||(this.evaluate(v,v.featureStates,g,!0),c=!0)}}return c}updateReplacement(c,u,g,v){if(u.updateTime===this.replacementUpdateTime)return!1;this.replacementUpdateTime=u.updateTime;const k=u.getReplacementRegionsForTile(c.toUnwrapped(),!0);if(JP(this.activeReplacements,k))return!1;this.activeReplacements=k;let S=!1;for(const P in this.instancesPerModel){const R=this.instancesPerModel[P],$=R.instancedDataArray;for(const W of R.features){const K=W.instancedDataOffset,X=W.instancedDataCount;for(let re=0;reSr;fe=Se?fe-Sr:fe;const ke=Math.floor(fe),Fe=Math.floor($.float32[se+1]);let $e=!1;for(const Ke of this.activeReplacements)if(!f1e(Ke,g,N_e.Model,v)&&!(Ke.min.x>ke||ke>Ke.max.x||Ke.min.y>Fe||Fe>Ke.max.y)&&($e=y1e(x1e(ke,Fe,c.canonical,Ke.footprintTileId.canonical),Ke.footprint),$e))break;$.float32[se]=$e?fe+Sr:fe,S=S||$e!==Se}}}return S}isEmpty(){for(const c in this.instancesPerModel)if(this.instancesPerModel[c].instancedDataArray.length!==0)return!1;return!0}uploadPending(){return!this.uploaded}upload(c){if(!this.uploaded)for(const u in this.instancesPerModel){const g=this.instancesPerModel[u];g.instancedDataArray.length<0||g.instancedDataArray.length===0||(g.instancedDataBuffer?g.instancedDataBuffer.updateData(g.instancedDataArray):g.instancedDataBuffer=c.createVertexBuffer(g.instancedDataArray,YUe.members,!0,void 0,this.instanceCount))}this.uploaded=!0}destroy(c){for(const g in this.instancesPerModel){const v=this.instancesPerModel[g];v.instancedDataArray.length!==0&&v.instancedDataBuffer&&v.instancedDataBuffer.destroy()}const u=this.layers[0].modelManager;if(c&&u&&this.modelUris&&this.modelsRequested)for(const g of this.modelUris)u.removeModel(g,"",!0)}addFeature(c,u,g){const v=this.layers[0],k=v.layout.get("model-id").evaluate(g,{},this.canonical);if(!k)return Ur(`modelId is not evaluated for layer ${v.id} and it is not going to get rendered.`),k;(joe(k,!1)||this.styleDefinedModelURLs[k]!==void 0)&&(this.modelUris.includes(k)||this.modelUris.push(k)),this.instancesPerModel[k]||(this.instancesPerModel[k]=new C_e);const S=this.instancesPerModel[k],P=S.instancedDataArray,R=new S_e(g,P.length);for(const $ of u)for(const W of $){if(W.x<0||W.x>=Sr||W.y<0||W.y>=Sr)continue;if(this.lookupDim!==0){const X=(this.lookupDim-1)/Sr,re=this.lookupDim*(W.y*X|0)+W.x*X|0;if(this.lookup){if(this.lookup[re]!==0)continue;this.lookup[re]=1}}this.instanceCount++;const K=P.length;P.resize(K+1),S.instancesEvaluatedElevation.push(0),P.float32[16*K]=W.x,P.float32[16*K+1]=W.y}return R.instancedDataCount=S.instancedDataArray.length-R.instancedDataOffset,R.instancedDataCount>0&&(c.id&&(S.idToFeaturesIndex[c.id]=S.features.length),S.features.push(R),this.evaluate(R,{},S,!1)),k}getModelUris(){return this.modelUris}evaluate(c,u,g,v){const k=this.layers[0],S=c.feature,P=this.canonical,R=c.rotation=k.paint.get("model-rotation").evaluate(S,u,P),$=c.scale=k.paint.get("model-scale").evaluate(S,u,P),W=c.translation=k.paint.get("model-translation").evaluate(S,u,P),K=Object.assign({},k.paint.get("model-color").evaluate(S,u,P));K.a=k.paint.get("model-color-mix-intensity").evaluate(S,u,P);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,se),this.maxScale=Math.max(Math.max(this.maxScale,$[0]),Math.max($[1],$[2])),sve(X,R,$);const fe=Math.round(100*K.a)+K.b/1.05;for(let Se=0;Se10?this.tileToMeter:Pe(P,ht)),$e[Fe+4]=W[0],$e[Fe+5]=W[1],$e[Fe+6]=W[2]+Ke,$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[ke]=W[2]}}}let M_e,T_e;Yr(koe,"ModelBucket",{omit:["layers"]}),Yr(C_e,"PerModelAttributes"),Yr(S_e,"ModelFeature");class UN{constructor(c,u,g){this._demTile=c,this._dem=this._demTile.dem,this._scale=u,this._offset=g}static create(c,u,g){const v=g||c.findDEMTileFor(u);if(!v||!v.dem)return;const k=v.dem,S=v.tileID,P=1<$.fqid),this.stateDependentLayerIds=this.layers.filter($=>$.isStateDependent()).map($=>$.id),this.modelTraits|=PN.CoordinateSpaceTile,this.uploaded=!1,this.hasPattern=!1,v&&(this.modelTraits|=PN.HasMapboxMeshFeatures),k&&(this.modelTraits|=PN.HasMeshoptCompression),this.zoom=-1,this.terrainExaggeration=1,this.projection={name:"mercator"},this.replacementUpdateTime=0,this.elevationReadFromZ=255,this.brightness=S,this.worldview=R,this.dirty=!0,this.needsUpload=!1,this.filter=null,this.nodesInfo=[];for(const $ of u)this.nodesInfo.push(new P_e($)),E_e($,P.featureIndexArray.length,P.grid),P.featureIndexArray.emplaceBack(this.nodesInfo.length-1,0,P.bucketLayerIDs.length-1,0);this.states={},this.hasAppearances=null}updateFootprints(c,u){for(const g of this.getNodesInfo()){const v=g.node;v.footprint&&u.push({footprint:v.footprint,id:c})}}updateAppearances(c,u,g,v){}update(c){const u=Object.keys(c).length!==0;if(u&&!this.stateDependentLayers.length)return;const g=u?this.stateDependentLayers:this.layers;if(!fo(c,this.states))for(const v of g)this.evaluate(v,c);this.states=structuredClone(c)}populate(){console.log("populate 3D model bucket")}uploadPending(){return!this.uploaded||this.needsUpload}upload(c){if(!this.needsUpload)return;const u=this.getNodesInfo();for(const g of u){const v=g.node;this.uploaded?this.updatePbrBuffer(v):Zie(v,c,!0)}for(const g of u)u6(g.node);this.uploaded=!0,this.needsUpload=!1}updatePbrBuffer(c){let u=!1;if(!c.meshes)return u;for(const g of c.meshes)g.pbrBuffer&&(g.pbrBuffer.updateData(g.featureArray),u=!0);return u}needsReEvaluation(c,u,g){const v=c.transform.projectionOptions,k=c.style.getBrightness(),S=this.brightness!==k;if(!this.uploaded||this.dirty||v.name!==this.projection.name||dM(g.paint.get("model-color").value,S)||dM(g.paint.get("model-color-mix-intensity").value,S)||dM(g.paint.get("model-roughness").value,S)||dM(g.paint.get("model-emissive-strength").value,S)||dM(g.paint.get("model-height-based-emissive-strength-multiplier").value,S)){this.projection=v,this.brightness=k;const P=this.getNodesInfo();for(const R of P)R.state=null;return!0}return!1}evaluateTransform(c,u){if(c.transform.zoom===this.zoom)return;this.zoom=c.transform.zoom;const g=this.getNodesInfo(),v=this.id.canonical;for(const k of g){const S=k.feature;k.evaluatedTranslation=u.paint.get("model-translation").evaluate(S,{},v),k.evaluatedScale=u.paint.get("model-scale").evaluate(S,{},v)}}evaluate(c,u){const g=this.getNodesInfo();for(const v of g){if(!v.node.meshes)continue;const k=v.feature,S=u&&u[k.id];if(fo(S,v.state))continue;v.state=structuredClone(S);const P=v.node.meshes&&v.node.meshes[0].featureData,R=v.evaluatedColor[2],$=v.evaluatedRMEA[2],W=this.id.canonical;if(v.hasTranslucentParts=!1,P){for(let K=0;K=ot)continue;const ur=Noe[vr],pr=Math.abs(ur);pr>Rt&&(Kt=ur,Rt=pr,rr=xr,or=lr)}if(Rt>.1){const lr=1-(ot+.5*Math.abs(rr*or))/se;let xr=u._dem.get(Ct,_t)+Kt*lr;const vr=u._dem.get(Ct+rr,_t+or),ur=u._dem.get(Ct-rr,_t-or,!0);(xr-vr)*(xr-ur)>0&&(xr=(vr+ur)/2),Noe[Et]=u._dem.set(Ct,_t,xr),e_[Et]=ot}}}}}P&&(u._demTile.needsDEMTextureUpload=!0,u._dem._timestamp=$o.now())}setFilter(c){this.filter=c?nN(c):null}getNodesInfo(){return this.filter?this.nodesInfo.filter(c=>this.filter.filter(new ti(this.id.overscaledZ,{worldview:this.worldview}),c.feature,this.id.canonical)):this.nodesInfo}destroy(){const c=this.getNodesInfo();for(const u of c)u6(u.node),Yie(u.node)}isEmpty(){return!this.nodesInfo.length}updateReplacement(c,u){if(u.updateTime===this.replacementUpdateTime)return;this.replacementUpdateTime=u.updateTime;const g=u.getReplacementRegionsForTile(c.toUnwrapped());for(const v of this.getNodesInfo()){const k=v.node.footprint;v.hiddenByReplacement=!!k&&!g.find(S=>S.footprint===k)}}getHeightAtTileCoord(c,u){const g=[],v=[0,0,0],k=A([]);for(const S of this.getNodesInfo()){const P=S.node.meshes[0],R=P.transformedAabb;if(cR.max[0]||u>R.max[1])continue;if(S.node.hidden===!0)return{height:1/0,maxHeight:S.feature.properties.height,hidden:!1,verticalScale:S.evaluatedScale[2]};E(k,S.node.globalMatrix),v[0]=c,v[1]=u,Ze(v,v,k);const $=(v[0]-P.aabb.min[0])/(P.aabb.max[0]-P.aabb.min[0])*Xv|0,W=Math.min(63,(v[1]-P.aabb.min[1])/(P.aabb.max[1]-P.aabb.min[1])*Xv|0)*Xv+Math.min(63,$),K=P.heightmap[W];if(!(K<0&&S.node.footprint))return S.hiddenByReplacement?void 0:{height:K,maxHeight:S.feature.properties.height,hidden:!1,verticalScale:S.evaluatedScale[2]};if(S.node.footprint.grid.query(new ir(c,u),new ir(c,u),g),g.length>0)return{height:void 0,maxHeight:S.feature.properties.height,hidden:S.hiddenByReplacement,verticalScale:S.evaluatedScale[2]}}}}function dM(f,c){return f instanceof Fy&&!f.isLightConstant&&c}function MVe(f,c,u,g,v,k,S,P){let R=(61440&c|(61440&c)>>4)>>8,$=(3840&c|(3840&c)>>4)>>4,W=240&c|(240&c)>>4;u[3]>0&&(R=Fn(R,255*u[0],u[3]),$=Fn($,255*u[1],u[3]),W=Fn(W,255*u[2],u[3]));const K=R<<8|$,X=W<<8|Math.floor(255*g[3]),re=function(ot){const _t=xe(ot,0,2);return Math.min(Math.round(.5*_t*255),255)}(g[2])<<8|15*g[0]<<4|15*g[1],se=xe(v[0],0,1),fe=xe(v[1],0,1),Se=xe(v[2],0,1),ke=xe(v[3],0,1);let Fe,$e,Ke,ht;if(se!==fe&&S!==k&&fe!==se){const ot=S-k;$e=1/(ot*(fe-se)),Ke=-(k+ot*se)/(ot*(fe-se));const _t=xe(v[4],-1,1);ht=Math.pow(10,_t),Fe=255*Se<<8|255*ke}else Fe=65535,$e=0,Ke=1,ht=1;if(f.emplaceBack(K,X,re,Fe,$e,Ke,ht),P){const ot=P.length;P.clear();for(let _t=0;_t>16&65535,W=k?R>>16&65535:65535&R,K=(15&W)<8?15&W:0,X=f.evaluatedRMEA[K],re=f.evaluatedColor[K],se=f.emissionHeightBasedParams[K];let fe;if(P&&K===2&&g.lights&&(fe=new pN,fe.resize(10*g.lights.length)),MVe(S.featureArray,$,re,X,se,S.aabb.min[2],S.aabb.max[2],fe),fe&&P){P=!1;const Se=g.meshes[g.lightMeshIndex];Se.featureArray=fe,Se.featureArray._trim()}}S.featureArray._trim(),v++}}Yr(A6,"Tiled3dModelBucket",{omit:["layers"]}),Yr(P_e,"Tiled3dModelFeature");const AVe=["id","tile","layer","source","sourceLayer","state"];class t_{constructor(c,u,g,v,k){this.type="Feature",this._vectorTileFeature=c,this._z=u,this._x=g,this._y=v,this.properties=c?c.properties:{},this.id=k}clone(){const c=new t_(this._vectorTileFeature,this._z,this._x,this._y,this.id);return this.state&&(c.state=Object.assign({},this.state)),this.layer&&(c.layer=Object.assign({},this.layer)),this.source&&(c.source=this.source),this.sourceLayer&&(c.sourceLayer=this.sourceLayer),c}get geometry(){return this._geometry===void 0&&this._vectorTileFeature&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._x,this._y,this._z).geometry),this._geometry}set geometry(c){this._geometry=c}toJSON(){const c={type:"Feature",state:void 0,geometry:this.geometry,properties:this.properties};for(const u of AVe)this[u]!==void 0&&(c[u]=this[u]);return c}}class r_ extends pi{constructor(c,u,g,v){super(),this.id=c,this.type="model",this.models=[],this._loaded=!1,this._options=u,this._modelsInfo=new Map}load(){const c=[];for(const u in this._options.models){const g=this._options.models[u],v=this._modelsInfo.get(u);if(v){const k=v.model;k.position=g.position!=null?new m(g.position[0],g.position[1]):new m(0,0),k.orientation=g.orientation!=null?g.orientation:[0,0,0],v.modelSpec=g,r_.applyModelSpecification(k,g),k.computeBoundsAndApplyParent(),this.models.push(k)}else{const k=eve(this.map._requestManager.transformRequest(g.uri,qg.Model).url).then(S=>{if(!S)return;const P=Qie(S),R=new ave(u,g.uri,g.position,g.orientation,P);r_.applyModelSpecification(R,g),R.computeBoundsAndApplyParent(),this.models.push(R),this._modelsInfo.set(u,{modelSpec:g,model:R})}).catch(S=>{this.fire(new ts(new Error(`Could not load model ${u} from ${g.uri}: ${S.message}`)))});c.push(k)}}Promise.allSettled(c).then(()=>{this._loaded=!0,this.fire(new Hn("data",{dataType:"source",sourceDataType:"metadata"}))}).catch(u=>{this._loaded=!0,this.fire(new ts(new Error(`Could not load models: ${u.message}`)))})}static applyModelSpecification(c,u){u.nodeOverrides&&r_.convertNodeOverrides(c,u.nodeOverrides),u.materialOverrides&&r_.convertMaterialOverrides(c,u.materialOverrides),u.nodeOverrideNames&&(c.nodeOverrideNames=[...u.nodeOverrideNames]),u.materialOverrideNames&&(c.materialOverrideNames=[...u.materialOverrideNames]),u.featureProperties&&(c.featureProperties=u.featureProperties)}static convertNodeOverrides(c,u){if(Array.isArray(u)&&u.every(g=>typeof g=="string")){c.nodeOverrideNames=[];for(const g of u)c.nodeOverrideNames.push(g)}else Object.entries(u).forEach(([g,v])=>{const k={orientation:[0,0,0]};if(v.hasOwnProperty("orientation")){const S=v.orientation;S&&(k.orientation=S)}c.nodeOverrides.set(g,k)})}static convertMaterialOverrides(c,u){if(Array.isArray(u)&&u.every(g=>typeof g=="string")){c.materialOverrideNames=[];for(const g of u)c.materialOverrideNames.push(g)}else Object.entries(u).forEach(([g,v])=>{const k={color:new Sa(1,1,1),colorMix:0,emissionStrength:0,opacity:1},S=v["model-color"];S!==void 0&&(k.color.r=S[0],k.color.g=S[1],k.color.b=S[2]);const P=v["model-color-mix-intensity"];P!==void 0&&(k.colorMix=P);const R=v["model-emissive-strength"];R!==void 0&&(k.emissionStrength=R);const $=v["model-opacity"];$!==void 0&&(k.opacity=$),c.materialOverrides.set(g,k)})}onAdd(c){this.map=c,this.load()}hasTransition(){return!1}loaded(){return this._loaded}getModels(){return this.models}loadTile(c,u){}serialize(){return this._options}setProperty(c,u){return!1}reload(){const c=Lh(this.id,this.scope);this.map.style.clearSource(c),this.models=[],this._modelsInfo.clear(),this._loaded=!1,this.load()}setModels(c){this.models=[];const u=new Map;for(const g in c){const v=c[g];if(this._modelsInfo.has(g)){const k=this._modelsInfo.get(g);k&&k.modelSpec.uri===v.uri&&u.set(g,k)}}this._modelsInfo=u,this._options.models=c,this._loaded=!1,this.load()}}function Soe(f,c,u,g){const v=1<Ke.polygon).flat());const Se=re?P:null,[ke,Fe]=U1e(k,g,K,W,$,S,Se,X,se,k.center.lat,f.tileID.canonical),$e=f.queryGeometry;return $1e(ke,Fe,$e.isPointQuery()?$e.screenBounds:$e.screenGeometry)}},building:class extends rd{constructor(f,c,u,g){super(f,{layout:hve||(hve=new Wi({visibility:new kr(Ft.layout_building.visibility),"building-facade":new Er(Ft.layout_building["building-facade"]),"building-facade-floors":new Er(Ft.layout_building["building-facade-floors"]),"building-facade-unit-width":new Er(Ft.layout_building["building-facade-unit-width"]),"building-facade-window":new Er(Ft.layout_building["building-facade-window"]),"building-roof-shape":new Er(Ft.layout_building["building-roof-shape"]),"building-height":new Er(Ft.layout_building["building-height"]),"building-base":new Er(Ft.layout_building["building-base"]),"building-flood-light-wall-radius":new Er(Ft.layout_building["building-flood-light-wall-radius"]),"building-flood-light-ground-radius":new Er(Ft.layout_building["building-flood-light-ground-radius"]),"building-flip-roof-orientation":new Er(Ft.layout_building["building-flip-roof-orientation"])})),paint:fve||(fve=new Wi({"building-opacity":new kr(Ft.paint_building["building-opacity"]),"building-ambient-occlusion-intensity":new kr(Ft.paint_building["building-ambient-occlusion-intensity"]),"building-ambient-occlusion-ground-intensity":new kr(Ft.paint_building["building-ambient-occlusion-ground-intensity"]),"building-ambient-occlusion-ground-radius":new kr(Ft.paint_building["building-ambient-occlusion-ground-radius"]),"building-ambient-occlusion-ground-attenuation":new kr(Ft.paint_building["building-ambient-occlusion-ground-attenuation"]),"building-vertical-scale":new kr(Ft.paint_building["building-vertical-scale"]),"building-cast-shadows":new kr(Ft.paint_building["building-cast-shadows"]),"building-color":new Er(Ft.paint_building["building-color"]),"building-emissive-strength":new Er(Ft.paint_building["building-emissive-strength"]),"building-facade-emissive-chance":new kr(Ft.paint_building["building-facade-emissive-chance"]),"building-cutoff-fade-range":new kr(Ft.paint_building["building-cutoff-fade-range"]),"building-flood-light-color":new kr(Ft.paint_building["building-flood-light-color"]),"building-flood-light-intensity":new kr(Ft.paint_building["building-flood-light-intensity"]),"building-flood-light-ground-attenuation":new kr(Ft.paint_building["building-flood-light-ground-attenuation"]),"building-color-use-theme":new Er({type:"string",default:"default","property-type":"data-driven"}),"building-flood-light-color-use-theme":new Er({type:"string",default:"default","property-type":"data-driven"})}))},c,u,g),this._stats={numRenderedVerticesInShadowPass:0,numRenderedVerticesInTransparentPass:0}}createBucket(f){return new uve(f)}cutoffRange(){return this.paint.get("building-cutoff-fade-range")}hasShadowPass(){return this.paint.get("building-cast-shadows")}hasLightBeamPass(){return!0}canCastShadows(){return!0}is3D(f){return!0}queryRadius(f){return 0}queryIntersectsFeature(f,c,u,g,v,k,S,P,R){let $=this.layout.get("building-height").evaluate(c,u);const W=this.layout.get("building-base").evaluate(c,u),K=f.tile.getBucket(this).getFootprint(c);if(K){if(K.hiddenFlags!==0)return!1;$=K.height}const[X,re]=U1e(k,g,W,$,new ir(0,0),S,null,[0,0],1,k.center.lat,f.tileID.canonical),se=f.queryGeometry;return $1e(X,re,se.isPointQuery()?se.screenBounds:se.screenGeometry)}},line:class extends rd{constructor(f,c,u,g){const v=jve();super(f,v,c,u,g),v.layout&&(this.layout=new ex(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 Sv,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(Z5)return Z5;const u=jve();return Z5=new Sqe(u.paint.properties["line-width"].specification),Z5.useIntegerZoom=!0,Z5})().possiblyEvaluate(this._transitioningPaint._values["line-width"].value,f)}createBucket(f){return new toe(f)}getProgramIds(){return[this.paint.get("line-pattern").constantOr(1)?"linePattern":"line"]}getDefaultProgramParams(f,c,u){const g=bve(this);return{config:new Vm(this,{zoom:c,lut:u}),defines:g,overrideFog:!1}}queryRadius(f){const c=f,u=kve(bc("line-width",this,c),bc("line-gap-width",this,c)),g=bc("line-offset",this,c);return u/2+Math.abs(g)+Ul(this.paint.get("line-translate"))}queryIntersectsFeature(f,c,u,g,v,k){if(f.queryGeometry.isAboveHorizon)return!1;const S=bu(f.tilespaceGeometry,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),k.angle,f.pixelToTileUnitsFactor),P=f.pixelToTileUnitsFactor/2*kve(this.paint.get("line-width").evaluate(c,u),this.paint.get("line-gap-width").evaluate(c,u)),R=this.paint.get("line-offset").evaluate(c,u);return R&&(g=function($,W){const K=[],X=new ir(0,0);for(let re=0;re<$.length;re++){const se=$[re],fe=[];for(let Se=0;Se=3){for(let se=0;se>16&255)/255,(f>>8&255)/255,(255&f)/255,1)}function HVe(f,c,u){f===1?(c.rgb_color=L6(u.readVarint()),c.paint="rgb_color"):f===2?(c.linear_gradient_idx=u.readVarint(),c.paint="linear_gradient_idx"):f===3?(c.radial_gradient_idx=u.readVarint(),c.paint="radial_gradient_idx"):f===5?u.readPackedFloat(c.dasharray):f===6?c.dashoffset=u.readFloat():f===7?c.miterlimit=u.readFloat():f===8?c.opacity=u.readVarint():f===9?c.width=u.readFloat():f===10?c.linecap=u.readVarint():f===11&&(c.linejoin=u.readVarint())}function WVe(f,c,u){f===1?c.transform=P6(u,u.readVarint()+u.pos):f===2?c.spread_method=u.readVarint():f===3?c.stops.push(R_e(u,u.readVarint()+u.pos)):f===4?c.x1=u.readFloat():f===5?c.y1=u.readFloat():f===6?c.x2=u.readFloat():f===7&&(c.y2=u.readFloat())}function R_e(f,c){return f.readFields(GVe,{offset:0,opacity:255,rgb_color:Coe},c)}function GVe(f,c,u){f===1?c.offset=u.readFloat():f===2?c.opacity=u.readVarint():f===3&&(c.rgb_color=L6(u.readVarint()))}function KVe(f,c,u){f===1?c.transform=P6(u,u.readVarint()+u.pos):f===2?c.spread_method=u.readVarint():f===3?c.stops.push(R_e(u,u.readVarint()+u.pos)):f===4?c.cx=u.readFloat():f===5?c.cy=u.readFloat():f===6?c.r=u.readFloat():f===7?c.fx=u.readFloat():f===8?c.fy=u.readFloat():f===9&&(c.fr=u.readFloat())}function ZVe(f,c,u){f===1?c.transform=P6(u,u.readVarint()+u.pos):f===2?c.clip_path_idx=u.readVarint():f===3&&c.children.push(I6(u,u.readVarint()+u.pos))}function YVe(f,c,u){f===1?c.left=c.top=u.readFloat():f===2?c.width=c.height=u.readFloat():f===3?c.top=u.readFloat():f===4?c.height=u.readFloat():f===5?c.mask_type=u.readVarint():f===6?c.mask_idx=u.readVarint():f===7&&c.children.push(I6(u,u.readVarint()+u.pos))}class XVe{static calculate(c={},u=[]){const g=new Map,v=new Map;if(Object.keys(c).length===0)return g;u.forEach(k=>{v.set(k.name,k.rgb_color||new Sa(0,0,0))});for(const[k,S]of Object.entries(c))v.has(k)?g.set(v.get(k).toString(),S):console.warn(`Ignoring unknown image variable "${k}"`);return g}}function qN(f,c=255,u){const g=c/255,v=f.toString(),k=u.has(v)?u.get(v).clone():f.clone();return k.a*=g,k.toString()}function hM(f,c){if(!Ku()){const u=document.createElement("canvas");return u.width=f,u.height=c,u}return new OffscreenCanvas(f,c)}let Aoe,fM=null;function Eoe(f,c,u,g,v){for(const k of g.children)F_e(f,c,u,k,v)}function F_e(f,c,u,g,v){g.group?(f.save(),function(k,S,P,R,$){const W=R.mask_idx!=null?P.masks[R.mask_idx]:null,K=R.clip_path_idx!=null?P.clip_paths[R.clip_path_idx]:null;if(R.transform&&(S=VN(R.transform).preMultiplySelf(S)),!function(se,fe,Se){return se.opacity!==255||fe||Se}(R,K!=null,W!=null))return void Eoe(k,S,P,R,$);const X=hM(k.canvas.width,k.canvas.height),re=X.getContext("2d");Eoe(re,S,P,R,$),K&&H_e(re,S,P,K),W&&W_e(re,S,P,W,$),k.globalAlpha=R.opacity/255,k.drawImage(X,0,0)}(f,c,u,g.group,v),f.restore()):g.path&&(f.save(),function(k,S,P,R,$){k.setTransform(S),R.paint_order===PVe.PAINT_ORDER_FILL_AND_STROKE?(z_e(k,P,R,$),$_e(k,P,R,$)):($_e(k,P,R,$),z_e(k,P,R,$))}(f,c,u,g.path,v),f.restore())}function z_e(f,c,u,g){const v=u.fill;if(!v)return;const k=v.opacity/255;switch(f.save(),f.beginPath(),G_e(u,f),v.paint){case"rgb_color":f.fillStyle=qN(v.rgb_color,v.opacity,g);break;case"linear_gradient_idx":{const S=c.linear_gradients[v.linear_gradient_idx];S.transform&&f.setTransform(VN(S.transform).preMultiplySelf(f.getTransform())),f.fillStyle=U_e(f,S,k,g);break}case"radial_gradient_idx":{const S=c.radial_gradients[v.radial_gradient_idx];S.transform&&f.setTransform(VN(S.transform).preMultiplySelf(f.getTransform())),f.fillStyle=q_e(f,S,k,g)}}f.fill(B_e(u)),f.restore()}function B_e(f){return f.rule===Moe.PATH_RULE_NON_ZERO?"nonzero":f.rule===Moe.PATH_RULE_EVEN_ODD?"evenodd":void 0}function $_e(f,c,u,g){const v=u.stroke;if(!v)return;const k=K_e(u);f.lineWidth=v.width,f.miterLimit=v.miterlimit,f.setLineDash(v.dasharray),f.lineDashOffset=v.dashoffset;const S=v.opacity/255;switch(v.paint){case"rgb_color":f.strokeStyle=qN(v.rgb_color,v.opacity,g);break;case"linear_gradient_idx":f.strokeStyle=U_e(f,c.linear_gradients[v.linear_gradient_idx],S,g,!0);break;case"radial_gradient_idx":f.strokeStyle=q_e(f,c.radial_gradients[v.radial_gradient_idx],S,g,!0)}switch(v.linejoin){case E6.LINE_JOIN_MITER_CLIP:case E6.LINE_JOIN_MITER:f.lineJoin="miter";break;case E6.LINE_JOIN_ROUND:f.lineJoin="round";break;case E6.LINE_JOIN_BEVEL:f.lineJoin="bevel"}switch(v.linecap){case Toe.LINE_CAP_BUTT:f.lineCap="butt";break;case Toe.LINE_CAP_ROUND:f.lineCap="round";break;case Toe.LINE_CAP_SQUARE:f.lineCap="square"}f.stroke(k)}function U_e(f,c,u,g,v=!1){if(c.stops.length===1){const X=c.stops[0];return qN(X.rgb_color,X.opacity*u,g)}const{x1:k,y1:S,x2:P,y2:R}=c;let $=new DOMPoint(k,S),W=new DOMPoint(P,R);if(v){const X=VN(c.transform);$=X.transformPoint($),W=X.transformPoint(W)}const K=f.createLinearGradient($.x,$.y,W.x,W.y);for(const X of c.stops)K.addColorStop(X.offset,qN(X.rgb_color,X.opacity*u,g));return K}function q_e(f,c,u,g,v=!1){if(c.stops.length===1){const ke=c.stops[0];return qN(ke.rgb_color,ke.opacity*u,g)}const k=VN(c.transform),{fx:S,fy:P,fr:R,cx:$,cy:W,r:K}=c;let X=new DOMPoint(S,P),re=new DOMPoint($,W),se=R,fe=K;if(v){X=k.transformPoint(X),re=k.transformPoint(re);const ke=(k.a+k.d)/2;se=R*ke,fe=c.r*ke}const Se=f.createRadialGradient(X.x,X.y,se,re.x,re.y,fe);for(const ke of c.stops)Se.addColorStop(ke.offset,qN(ke.rgb_color,ke.opacity*u,g));return Se}function V_e(f,c,u,g){const v=g.transform?VN(g.transform).preMultiplySelf(c):c,k=hM(f.canvas.width,f.canvas.height),S=k.getContext("2d");for(const R of g.children)if(R.group)V_e(S,v,u,R.group);else if(R.path){const $=R.path,W=new Path2D;W.addPath(K_e($),v),S.fill(W,B_e($))}const P=g.clip_path_idx!=null?u.clip_paths[g.clip_path_idx]:null;P&&H_e(S,v,u,P),f.globalCompositeOperation="source-over",f.drawImage(k,0,0)}function H_e(f,c,u,g){const v=hM(f.canvas.width,f.canvas.height);V_e(v.getContext("2d"),c,u,g),f.globalCompositeOperation="destination-in",f.drawImage(v,0,0)}function W_e(f,c,u,g,v){if(g.children.length===0)return;const k=g.mask_idx!=null?u.masks[g.mask_idx]:null;k&&W_e(f,c,u,k,v);const S=f.canvas.width,P=f.canvas.height,R=hM(S,P),$=R.getContext("2d"),W=g.width,K=g.height,X=g.left,re=g.top,se=new Path2D,fe=new Path2D;fe.rect(X,re,W,K),se.addPath(fe,c),$.clip(se);for(const Fe of g.children)F_e($,c,u,Fe,v);const Se=$.getImageData(0,0,S,P),ke=Se.data;if(g.mask_type===L_e.MASK_TYPE_LUMINANCE)for(let Fe=0;Fec[S])return null}else{const P=1/g[S];let R=(f[S]-u[S])*P,$=(c[S]-u[S])*P;if(R>$){const W=R;R=$,$=W}if(R>v&&(v=R),$k)return null}return v}function X_e(f,c,u,g,v,k,S,P,R,$,W){const K=g-f,X=v-c,re=k-u,se=S-f,fe=P-c,Se=R-u,ke=W[1]*Se-W[2]*fe,Fe=W[2]*se-W[0]*Se,$e=W[0]*fe-W[1]*se,Ke=K*ke+X*Fe+re*$e;if(Math.abs(Ke)<1e-15)return null;const ht=1/Ke,ot=$[0]-f,_t=$[1]-c,Ct=$[2]-u,Et=(ot*ke+_t*Fe+Ct*$e)*ht;if(Et<0||Et>1)return null;const Kt=_t*re-Ct*X,Rt=Ct*K-ot*re,rr=ot*X-_t*K,or=(W[0]*Kt+W[1]*Rt+W[2]*rr)*ht;return or<0||Et+or>1?null:(se*Kt+fe*Rt+Se*rr)*ht}function Q_e(f,c,u){return(f-c)/(u-c)}function J_e(f,c,u,g,v,k,S,P,R){const $=1<{const Fe=Se?1:0,$e=(re+1)*fe-Fe,Ke=se*fe,ht=(se+1)*fe-Fe;ke[0]=re*fe,ke[1]=Ke,ke[2]=$e,ke[3]=ht};let K=new Z_e(R);const X=[];for(let re=0;re=1;R/=2){const re=P[P.length-1];K=new Z_e(R);for(let se=0;se0;){const{idx:se,t:fe,nodex:Se,nodey:ke,depth:Fe}=re.pop();if(this.leaves[se]){J_e(Se,ke,Fe,c,u,g,v,K,X);const Ke=1<=vr[2])return fe}continue}let $e=0;for(let Ke=0;Ke=$[W[Ct]]&&(W.splice(Ct,0,Ke),_t=!0);_t||(W[$e]=Ke),$e++}}for(let Ke=0;Ke<$e;Ke++){const ht=W[Ke];re.push({idx:this.childOffsets[se]+ht,t:$[ht],nodex:(Se<<1)+this._siblingOffset[ht][0],nodey:(ke<<1)+this._siblingOffset[ht][1],depth:Fe+1})}}return null}_addNode(c,u,g){return this.minimums.push(c),this.maximums.push(u),this.leaves.push(g),this.childOffsets.push(0),this.nodeCount++}_construct(c,u,g,v,k){if(c[v].isLeaf(u,g)===1)return;this.childOffsets[k]||(this.childOffsets[k]=this.nodeCount);const S=v-1,P=c[S];let R=0,$=0;for(let W=0;W=this.dim+1||u<-1||u>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(u+1)*this.stride+(c+1)}static pack(c,u){const g=[0,0,0,0],v=D6.getUnpackVector(u);let k=Math.floor((c+v[3])/v[2]);return g[2]=k%256,k=Math.floor(k/256),g[1]=k%256,k=Math.floor(k/256),g[0]=k,g}getPixels(){return new Z0e({width:this.stride,height:this.stride},this.pixels)}backfillBorder(c,u,g){if(this.dim!==c.dim)throw new Error("dem dimension mismatch");let v=u*this.dim,k=u*this.dim+this.dim,S=g*this.dim,P=g*this.dim+this.dim;switch(u){case-1:v=k-1;break;case 1:k=v+1}switch(g){case-1:S=P-1;break;case 1:P=S+1}const R=-u*this.dim,$=-g*this.dim;for(let W=S;W=1;g--){const v=g===1?1:0,k=g===2?1:0;for(let S=0;S>>1^-(1&f[c]);return f}function uHe(f,c){switch(c){case"uint32":return f;case"uint16":for(let u=0;u>4|(61440&g)>>8|(240&v)<<4|61440&v,f[u+1]=15&g|(3840&g)>>4|(15&v)<<8|(3840&v)<<4}return f;case"uint8":for(let u=0;u>6|(192&v)>>4|(192&k)>>2|192&S,f[u+1]=(48&g)>>4|(48&v)>>2|48&k|(48&S)<<2,f[u+2]=(12&g)>>2|12&v|(12&k)<<2|(12&S)<<4,f[u+3]=3&g|(3&v)<<2|(3&k)<<4|(3&S)<<6}return f;default:throw new Error(`Invalid pixel format, "${c}"`)}}Yr(D6,"DEMData"),Yr(e2e,"DemMinMaxQuadTree",{omit:["dem"]});var Fh=Uint8Array,pM=Uint16Array,hHe=Int32Array,r2e=new Fh([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),n2e=new Fh([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]),fHe=new Fh([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),s2e=function(f,c){for(var u=new pM(31),g=0;g<31;++g)u[g]=c+=1<>1|(21845&nl)<<1;o2e[nl]=((65280&(HN=(61680&(HN=(52428&HN)>>2|(13107&HN)<<2))>>4|(3855&HN)<<4))>>8|(255&HN)<<8)>>1}var mM=function(f,c,u){for(var g=f.length,v=0,k=new pM(c);v>R]=$;return S},gM=new Fh(288);for(nl=0;nl<144;++nl)gM[nl]=8;for(nl=144;nl<256;++nl)gM[nl]=9;for(nl=256;nl<280;++nl)gM[nl]=7;for(nl=280;nl<288;++nl)gM[nl]=8;var l2e=new Fh(32);for(nl=0;nl<32;++nl)l2e[nl]=5;var gHe=mM(gM,9),xHe=mM(l2e,5),Poe=function(f){for(var c=f[0],u=1;uc&&(c=f[u]);return c},Lp=function(f,c,u){var g=c/8|0;return(f[g]|f[g+1]<<8)>>(7&c)&u},Loe=function(f,c){var u=c/8|0;return(f[u]|f[u+1]<<8|f[u+2]<<16)>>(7&c)},yHe=["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"],Op=function(f,c,u){var g=new Error(c||yHe[f]);if(g.code=f,Error.captureStackTrace&&Error.captureStackTrace(g,Op),!u)throw g;return g},vHe=new Fh(0),_He=typeof TextDecoder<"u"&&new TextDecoder;try{_He.decode(vHe,{stream:!0})}catch{}const bHe={gzip_data:"gzip"};class Cf extends Error{constructor(c){super(c),this.name="MRTError"}}const wHe={0:"uint32",1:"uint32",2:"uint16",3:"uint8"},c2e={uint32:1,uint16:2,uint8:4},jHe={uint32:Uint32Array,uint16:Uint16Array,uint8:Uint8Array};let Ooe;class R6{constructor(c=5){this.x=NaN,this.y=NaN,this.z=NaN,this.layers={},this._cacheSize=c}getLayer(c){const u=this.layers[c];if(!u)throw new Cf(`Layer '${c}' not found`);return u}getHeaderLength(c){const u=new Uint8Array(c),g=new DataView(c);if(u[0]!==13)throw new Cf("File is not a valid MRT.");return g.getUint32(1,!0)}parseHeader(c){const u=new Uint8Array(c),g=this.getHeaderLength(c);if(u.length= ${g} but got buffer of length ${u.length}`);const v=new Ooe(u.subarray(0,g)).readFields(tHe,{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 Cf(`Invalid attempt to parse header ${v.z}/${v.x}/${v.y} for tile ${this.z}/${this.x}/${this.y}`);this.x=v.x,this.y=v.y,this.z=v.z;for(const k of v.layers)this.layers[k.name]=new d2e(k,{cacheSize:this._cacheSize});return this}createDecodingTask(c){const u=[],g=this.getLayer(c.layerName);for(let v of c.blockIndices){const k=g.dataIndex[v],S=k.firstByte-c.firstByte,P=k.lastByte-c.firstByte;if(g._blocksInProgress.has(v))continue;const R={layerName:g.name,firstByte:S,lastByte:P,pixelFormat:g.pixelFormat,blockIndex:v,blockShape:[k.bands.length].concat(g.bandShape),buffer:g.buffer,codec:k.codec.codec,filters:k.filters.map($=>$.filter)};g._blocksInProgress.add(v),u.push(R)}return new u2e(u,()=>{u.forEach(v=>g._blocksInProgress.delete(v.blockIndex))},(v,k)=>{if(u.forEach(S=>g._blocksInProgress.delete(S.blockIndex)),v)throw v;k.forEach(S=>{this.getLayer(S.layerName).processDecodedData(S)})})}}class d2e{constructor({version:c,name:u,units:g,tileSize:v,pixelFormat:k,buffer:S,dataIndex:P},R){if(this.version=c,this.version!==1)throw new Cf(`Cannot parse raster layer encoded with MRT version ${c}`);this.name=u,this.units=g,this.tileSize=v,this.buffer=S,this.pixelFormat=wHe[k],this.dataIndex=P,this.bandShape=[v+2*S,v+2*S,c2e[this.pixelFormat]],this._decodedBlocks=new O6(R?R.cacheSize:5),this._blocksInProgress=new Set}get dimension(){return c2e[this.pixelFormat]}get cacheSize(){return this._decodedBlocks.capacity}getBandList(){return this.dataIndex.map(({bands:c})=>c).flat()}processDecodedData(c){const u=c.blockIndex.toString();this._decodedBlocks.get(u)||this._decodedBlocks.put(u,c.data)}getBlockForBand(c){let u=0;switch(typeof c){case"string":for(const[g,v]of this.dataIndex.entries()){for(const[k,S]of v.bands.entries())if(S===c)return{bandIndex:u+k,blockIndex:g,blockBandIndex:k};u+=v.bands.length}break;case"number":for(const[g,v]of this.dataIndex.entries()){if(c>=u&&cthis.cacheSize)throw new Cf(`Number of blocks to decode (${k.size}) exceeds cache size (${this.cacheSize}).`);return{layerName:this.name,firstByte:u,lastByte:g,blockIndices:v}}hasBand(c){const{blockIndex:u}=this.getBlockForBand(c);return u>=0}hasDataForBand(c){const{blockIndex:u}=this.getBlockForBand(c);return u>=0&&!!this._decodedBlocks.get(u.toString())}getBandView(c){const{blockIndex:u,blockBandIndex:g}=this.getBlockForBand(c);if(u<0)throw new Cf(`Band not found: ${JSON.stringify(c)}`);const v=this._decodedBlocks.get(u.toString());if(!v)throw new Cf(`Data for band ${JSON.stringify(c)} of layer "${this.name}" not decoded.`);const k=this.dataIndex[u],S=this.bandShape.reduce(($,W)=>$*W,1),P=g*S,R=v.subarray(P,P+S);return{data:R,bytes:new Uint8Array(R.buffer).subarray(R.byteOffset,R.byteOffset+R.byteLength),tileSize:this.tileSize,buffer:this.buffer,pixelFormat:this.pixelFormat,dimension:this.dimension,offset:k.offset,scale:k.scale}}}R6.setPbf=function(f){Ooe=f};class u2e{constructor(c,u,g){this.tasks=c,this._onCancel=u,this._onComplete=g,this._finalized=!1}cancel(){this._finalized||(this._onCancel(),this._finalized=!0)}complete(c,u){this._finalized||(this._onComplete(c,u),this._finalized=!0)}}R6.performDecoding=function(f,c){const u=new Uint8Array(f);return Promise.all(c.tasks.map(g=>{const{layerName:v,firstByte:k,lastByte:S,pixelFormat:P,blockShape:R,blockIndex:$,filters:W,codec:K}=g,X=u.subarray(k,S+1),re=new Uint32Array(R[0]*R[1]*R[2]);let se;if(K!=="gzip_data")throw new Cf(`Unhandled codec: ${K}`);return se=function(fe,Se){if(!globalThis.DecompressionStream&&Se==="gzip_data")return Promise.resolve(((Ke=function(_t){_t[0]==31&&_t[1]==139&&_t[2]==8||Op(6,"invalid gzip data");var Ct=_t[3],Et=10;4&Ct&&(Et+=2+(_t[10]|_t[11]<<8));for(var Kt=(Ct>>3&1)+(Ct>>4&1);Kt>0;Kt-=!_t[Et++]);return Et+(2&Ct)}($e=fe))+8>$e.length&&Op(6,"invalid gzip data"),function(_t,Ct,Et,Kt){var Rt=_t.length;if(!Rt||Ct.f&&!Ct.l)return Et||new Fh(0);var rr=!Et,or=rr||Ct.i!=2,lr=Ct.i;rr&&(Et=new Fh(3*Rt));var xr,vr,ur=function($a){var fa=Et.length;if($a>fa){var _a=new Fh(Math.max(2*fa,$a));_a.set(Et),Et=_a}},pr=Ct.f||0,tr=Ct.p||0,Xt=Ct.b||0,mr=Ct.l,Mr=Ct.d,wr=Ct.m,un=Ct.n,Br=8*Rt;do{if(!mr){pr=Lp(_t,tr,1);var Kr=Lp(_t,tr+1,3);if(tr+=3,!Kr){var tn=_t[(nr=4+((tr+7)/8|0))-4]|_t[nr-3]<<8,gs=nr+tn;if(gs>Rt){lr&&Op(0);break}or&&ur(Xt+tn),Et.set(_t.subarray(nr,gs),Xt),Ct.b=Xt+=tn,Ct.p=tr=8*gs,Ct.f=pr;continue}if(Kr==1)mr=gHe,Mr=xHe,wr=9,un=5;else if(Kr==2){var jr=Lp(_t,tr,31)+257,rn=Lp(_t,tr+10,15)+4,qn=jr+Lp(_t,tr+5,31)+1;tr+=14;for(var Ds=new Fh(qn),$s=new Fh(19),ns=0;ns>4)<16)Ds[ns++]=nr;else{var Or=0,Dr=0;for(nr==16?(Dr=3+Lp(_t,tr,3),tr+=2,Or=Ds[ns-1]):nr==17?(Dr=3+Lp(_t,tr,7),tr+=3):nr==18&&(Dr=11+Lp(_t,tr,127),tr+=7);Dr--;)Ds[ns++]=Or}}var hn=Ds.subarray(0,jr),vn=Ds.subarray(jr);wr=Poe(hn),un=Poe(vn),mr=mM(hn,wr),Mr=mM(vn,un)}else Op(1);if(tr>Br){lr&&Op(0);break}}or&&ur(Xt+131072);for(var Qn=(1<>4;if((tr+=15&Or)>Br){lr&&Op(0);break}if(Or||Op(2),As<256)Et[Xt++]=As;else{if(As==256){ms=tr,mr=null;break}var Ln=As-254;As>264&&(Ln=Lp(_t,tr,(1<<(oa=r2e[ns=As-257]))-1)+i2e[ns],tr+=oa);var Un=Mr[Loe(_t,tr)&cs],na=Un>>4;if(Un||Op(3),tr+=15&Un,vn=mHe[na],na>3){var oa=n2e[na];vn+=Loe(_t,tr)&(1<Br){lr&&Op(0);break}or&&ur(Xt+131072);var la=Xt+Ln;if(Xtxr.length)&&(vr=xr.length),new Fh(xr.subarray(0,vr))):Et.subarray(0,Xt)}($e.subarray(Ke,-8),{i:2},new Fh(((ke=$e)[(Fe=ke.length)-4]|ke[Fe-3]<<8|ke[Fe-2]<<16|ke[Fe-1]<<24)>>>0))));var ke,Fe,$e,Ke;const ht=bHe[Se];if(!ht)throw new Error(`Unhandled codec: ${Se}`);const ot=new globalThis.DecompressionStream(ht);return new Response(new Blob([fe]).stream().pipeThrough(ot)).arrayBuffer().then(_t=>new Uint8Array(_t))}(X,K).then(fe=>(function(Se,ke){Se.readFields(oHe,ke)}(new Ooe(fe),re),new jHe[P](re.buffer))),se.then(fe=>{for(let Se=W.length-1;Se>=0;Se--)switch(W[Se]){case"delta_filter":cHe(fe,R);break;case"zigzag_filter":dHe(fe);break;case"bitshuffle_filter":uHe(fe,P);break;default:throw new Cf(`Unhandled filter "${W[Se]}"`)}return{layerName:v,blockIndex:$,data:fe}}).catch(fe=>{throw fe})}))},Yr(u2e,"MRTDecodingBatch",{omit:["_onCancel","_onComplete"]}),Yr(R6,"MapboxRasterTile"),Yr(d2e,"MapboxRasterLayer",{omit:["_blocksInProgress"]});class h2e{constructor(c){this._stringToNumber={},this._numberToString=[];for(let u=0;u=0&&X[3]>=0&&$.insert(R,X[0],X[1],X[2],X[3])}}loadVTLayers(){if(!this.vtLayers){this.vtLayers=new Bt(new f6(this.rawTileData)).layers,this.sourceLayerCoder=new h2e(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"]),this.vtFeatures={};for(const c in this.vtLayers)this.vtFeatures[c]=[]}return this.vtLayers}query(c,u){const{tilespaceGeometry:g,transform:v,tileTransform:k,pixelPosMatrix:S,availableImages:P,worldview:R}=u;this.loadVTLayers(),this.serializedLayersCache.clear();const $=u.queryRadius?u.queryRadius:0,W=g.bufferedTilespaceBounds,K=this.grid.query(W.min.x,W.min.y,W.max.x,W.max.y,(fe,Se,ke,Fe)=>nd(g.bufferedTilespaceGeometry,fe-$,Se-$,ke+$,Fe+$));K.sort(kHe);let X=null;v.elevation&&K.length>0&&(X=UN.create(v.elevation,this.tileID));const re={};let se;for(let fe=0;fe(Fe||(Fe=St($e,this.tileID.canonical,k)),Ke.queryIntersectsFeature(g,$e,ht,Fe,this.z,v,S,X,ot)))}return re}loadMatchingFeature(c,u,g,v,k,S){const{featureIndex:P,bucketIndex:R,sourceLayerIndex:$,layoutVertexArrayOffset:W}=u,K=this.bucketLayerIDs[R],X=g.layers,re=Object.keys(X);if(re.length&&!Wr(re,K))return;const se=g.sourceCache,fe=this.sourceLayerCoder.decode($),Se=this.vtLayers[fe].feature(P),ke=this.getId(Se,fe);for(let Fe=0;Fe`${P.key}: ${P.message}`).join(", ");return void Ur(`Failed to create expression for promoteId: ${S}`)}this.promoteIdExpression=k.value}g=this.promoteIdExpression.evaluate({zoom:0},c)}else g=c.properties[v];typeof g=="boolean"&&(g=Number(g))}return g}}function p2e(f,c,u,g,v){return Ut(f,(k,S)=>{const P=c instanceof ex?c.get(S):null;return P&&P.evaluate?P.evaluate(u,g,void 0,v):P})}function kHe(f,c){return c-f}Yr(f2e,"FeatureIndex",{omit:["rawTileData","sourceLayerCoder"]});const m2e=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class Doe{static from(c){if(!(c instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[u,g]=new Uint8Array(c,0,2);if(u!==219)throw new Error("Data does not appear to be in a KDBush format.");const v=g>>4;if(v!==1)throw new Error(`Got v${v} data when expected v1.`);const k=m2e[15&g];if(!k)throw new Error("Unrecognized array type.");const[S]=new Uint16Array(c,2,1),[P]=new Uint32Array(c,4,1);return new Doe(P,S,k,c)}constructor(c,u=64,g=Float64Array,v){if(isNaN(c)||c<0)throw new Error(`Unpexpected numItems value: ${c}.`);this.numItems=+c,this.nodeSize=Math.min(Math.max(+u,2),65535),this.ArrayType=g,this.IndexArrayType=c<65536?Uint16Array:Uint32Array;const k=m2e.indexOf(this.ArrayType),S=2*c*this.ArrayType.BYTES_PER_ELEMENT,P=c*this.IndexArrayType.BYTES_PER_ELEMENT,R=(8-P%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+P+R,2*c),this._pos=2*c,this._finished=!0):(this.data=new ArrayBuffer(8+S+P+R),this.ids=new this.IndexArrayType(this.data,8,c),this.coords=new this.ArrayType(this.data,8+P+R,2*c),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+k]),new Uint16Array(this.data,2,1)[0]=u,new Uint32Array(this.data,4,1)[0]=c)}add(c,u){const g=this._pos>>1;return this.ids[g]=g,this.coords[this._pos++]=c,this.coords[this._pos++]=u,g}finish(){const c=this._pos>>1;if(c!==this.numItems)throw new Error(`Added ${c} items when expected ${this.numItems}.`);return Roe(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(c,u,g,v){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:k,coords:S,nodeSize:P}=this,R=[0,k.length-1,0],$=[];for(;R.length;){const W=R.pop()||0,K=R.pop()||0,X=R.pop()||0;if(K-X<=P){for(let Se=X;Se<=K;Se++){const ke=S[2*Se],Fe=S[2*Se+1];ke>=c&&ke<=g&&Fe>=u&&Fe<=v&&$.push(k[Se])}continue}const re=X+K>>1,se=S[2*re],fe=S[2*re+1];se>=c&&se<=g&&fe>=u&&fe<=v&&$.push(k[re]),(W===0?c<=se:u<=fe)&&(R.push(X),R.push(re-1),R.push(1-W)),(W===0?g>=se:v>=fe)&&(R.push(re+1),R.push(K),R.push(1-W))}return $}within(c,u,g){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:v,coords:k,nodeSize:S}=this,P=[0,v.length-1,0],R=[],$=g*g;for(;P.length;){const W=P.pop()||0,K=P.pop()||0,X=P.pop()||0;if(K-X<=S){for(let Se=X;Se<=K;Se++)x2e(k[2*Se],k[2*Se+1],c,u)<=$&&R.push(v[Se]);continue}const re=X+K>>1,se=k[2*re],fe=k[2*re+1];x2e(se,fe,c,u)<=$&&R.push(v[re]),(W===0?c-g<=se:u-g<=fe)&&(P.push(X),P.push(re-1),P.push(1-W)),(W===0?c+g>=se:u+g>=fe)&&(P.push(re+1),P.push(K),P.push(1-W))}return R}}function Roe(f,c,u,g,v,k){if(v-g<=u)return;const S=g+v>>1;g2e(f,c,S,g,v,k),Roe(f,c,u,g,S-1,1-k),Roe(f,c,u,S+1,v,1-k)}function g2e(f,c,u,g,v,k){for(;v>g;){if(v-g>600){const $=v-g+1,W=u-g+1,K=Math.log($),X=.5*Math.exp(2*K/3),re=.5*Math.sqrt(K*X*($-X)/$)*(W-$/2<0?-1:1);g2e(f,c,u,Math.max(g,Math.floor(u-W*X/$+re)),Math.min(v,Math.floor(u+($-W)*X/$+re)),k)}const S=c[2*u+k];let P=g,R=v;for(xM(f,c,g,u),c[2*v+k]>S&&xM(f,c,g,v);PS;)R--}c[2*g+k]===S?xM(f,c,g,R):(R++,xM(f,c,R,v)),R<=u&&(g=R+1),u<=R&&(v=R-1)}}function xM(f,c,u,g){Foe(f,u,g),Foe(c,2*u,2*g),Foe(c,2*u+1,2*g+1)}function Foe(f,c,u){const g=f[c];f[c]=f[u],f[u]=g}function x2e(f,c,u,g){const v=f-u,k=c-g;return v*v+k*k}i.$=wk,i.A=mp,i.B=Lh,i.C=2,i.D=TN,i.E=pi,i.F=Q5,i.G=qve,i.H=bk,i.I=gl,i.J=TP,i.K=dn,i.L=Sy,i.M=Wk,i.N=Ev,i.O=gP,i.P=ir,i.Q=Iv,i.R=qg,i.S=rN,i.T=Wie,i.U=zm,i.V=T6,i.W=a5,i.X=Ey,i.Y=Ay,i.Z=Nv,i._=ed,i.a=function(f){return Ss.API_CDN_URL_REGEX.test(f)},i.a$=ce,i.a0=$n,i.a1=Vd,i.a2=wf,i.a3=class extends T6{},i.a4=Gk,i.a5=mP,i.a6=Ft,i.a7=function(f){const c=f.value;return c?$n(c)?joe(c,!0)?[]:[new T6(f.key,c,`invalid url "${c}"`)]:[new T6(f.key,c,`string expected, "${dn(c)}" found`)]:[]},i.a8=NP,i.a9=Wi,i.aA=xe,i.aB=T,i.aC=gt,i.aD=vc,i.aE=Ha,i.aF=B,i.aG=We,i.aH=function(f,c){const u={};for(let g=0;g{g(k,S)},c):g(k,S),()=>{}}return v.callbacks.push(g),v.cancel||(v.cancel=u((k,S)=>{v.result=[k,S];for(const P of v.callbacks)this.scheduler?this.scheduler.add(()=>{P(k,S)},c):P(k,S);setTimeout(()=>delete this.entries[f],3e3)})),()=>{v.result||(v.callbacks=v.callbacks.filter(k=>k!==g),v.callbacks.length||(v.cancel(),delete this.entries[f]))}}},i.aL=function(f,c,u){const g=JSON.stringify(f.request);return f.data&&(this.deduped.entries[g]={result:[null,f.data]}),this.deduped.request(g,{type:"parseTile",isSymbolTile:f.isSymbolTile,zoom:f.tileZoom},v=>{const k=Mh(f.request,(S,P,R)=>{S?v(S):P&&v(null,{rawData:P,vectorTile:u?void 0:new Bt(new f6(P)),responseHeaders:new Map(R.entries())})});return()=>{k.cancel(),v()}},c)},i.aM=function(f){return f?{cacheControl:f.get("Cache-Control"),expires:f.get("Expires")}:{cacheControl:void 0,expires:void 0}},i.aN=Xc,i.aO=function(f){_o++,_o>_y&&(f.getActor().send("enforceCacheSizeLimit",vy),_o=0)},i.aP=function(f){return f<=1?1:Math.pow(2,Math.floor(Math.log2(f)))},i.aQ=Ui,i.aR=y_e,i.aS=k_e,i.aT=m,i.aU=x_e,i.aV=function(f,c){const u=document.createElement("video");u.muted=!0,u.onloadstart=function(){c(null,u)};for(let g=0;g{}}},i.aW=G5,i.aX=r_,i.aY=Pt,i.aZ=rM,i.a_=Q,i.aa=kr,i.ab=class{constructor(f){this.specification=f}possiblyEvaluate(f,c){return Zn(f.expression.evaluate(c))}interpolate(f,c,u){return{x:Fn(f.x,c.x,u),y:Fn(f.y,c.y,u),z:Fn(f.z,c.z,u),azimuthal:Fn(f.azimuthal,c.azimuthal,u),polar:Fn(f.polar,c.polar,u)}}},i.ac=ti,i.ad=Xg,i.ae=Ve,i.af=Ze,i.ag=ge,i.ah=Ie,i.ai=ex,i.aj=Yy,i.ak=Fn,i.al=Sr,i.am=M3,i.an=ss,i.ao=Sa,i.ap=class{constructor(f){this.specification=f}possiblyEvaluate(f,c){return function([u,g]){const v=Zn([1,u,g]);return{x:v.x,y:v.y,z:v.z}}(f.expression.evaluate(c))}interpolate(f,c,u){return{x:Fn(f.x,c.x,u),y:Fn(f.y,c.y,u),z:Fn(f.z,c.z,u)}}},i.aq=function(f,c,u=0,g=!0){const v=new ir(u,u),k=f.sub(v),S=c.add(v),P=[k,new ir(S.x,k.y),S,new ir(k.x,S.y)];return g&&P.push(k.clone()),P},i.ar=function(f,c){const u=[];for(let g=0;g1)return!1;const u=c.getSource().maxzoom,g=1<1)return c;const v=g.getSource().maxzoom,k=1<{const P=this.getAtTileOffset(f,v,k,S),R=g.upVector(f.canonical,v.x,v.y);return me(R,R,P*g.upVectorScale(f.canonical,c,u).metersToTile),R}}getForTilePoints(f,c,u,g){if(this.isUsingMockSource())return!1;const v=UN.create(this,f,g);return!!v&&(c.forEach(k=>{k[2]=this.exaggeration()*v.getElevationAt(k[0],k[1],u)}),!0)}getMinMaxForTile(f){if(this.isUsingMockSource())return null;const c=this.findDEMTileFor(f);if(!c||!c.dem)return null;const u=c.dem.tree,g=c.tileID,v=1<0&&(g+=(f[v]-0)*(f[v]-0)),c[v]<0&&(g+=(0-c[v])*(0-c[v]));return g},i.c0=y1e,i.c1=ooe,i.c2=Yve,i.c3=moe,i.c4=Doe,i.c5=me,i.c6=qe,i.c7=Mt,i.c8=function(f,c,u){u*=.5;var g=c[0],v=c[1],k=c[2],S=c[3],P=Math.sin(u),R=Math.cos(u);return f[0]=g*R+v*P,f[1]=v*R-g*P,f[2]=k*R+S*P,f[3]=S*R-k*P,f},i.c9=wt,i.cA=ye,i.cB=ha,i.cC=rve,i.cD=Wa,i.cE=P0e,i.cF=function(f,c,u,g,v,k,S,P,R){if(R.name==="globe")return P0e(f,c,new Wa(u,g,v),!1);const $=rM({z:u,x:g,y:v},R);return new on([(k+$.x/$.scale)*c,c*($.y/$.scale),S],[(k+$.x2/$.scale)*c,c*($.y2/$.scale),P])},i.cG=function(f,c,u){return f[0]=Math.min(c[0],u[0]),f[1]=Math.min(c[1],u[1]),f[2]=Math.min(c[2],u[2]),f[3]=Math.min(c[3],u[3]),f},i.cH=function(f,c,u){return f[0]=Math.max(c[0],u[0]),f[1]=Math.max(c[1],u[1]),f[2]=Math.max(c[2],u[2]),f[3]=Math.max(c[3],u[3]),f},i.cI=function(f){const c=Math.round((f+45+360)%360/90)%4;return pu[c]},i.cJ=de,i.cK=Qe,i.cL=SN,i.cM=function(f){const c=A(new Float64Array(16));T(c,f.pixelMatrix,f.globeMatrix);const u=[0,th,0],g=[0,rh,0];return Ze(u,u,c),Ze(g,g,c),[u[0]>0&&u[0]<=f.width&&u[1]>0&&u[1]<=f.height&&!jie(f,new m(f.center.lat,90)),g[0]>0&&g[0]<=f.width&&g[1]>0&&g[1]<=f.height&&!jie(f,new m(f.center.lat,-90))]},i.cN=function(f,c){const{scale:u}=f.tileTransform,g=u*Sr/(f.tileSize*Math.pow(2,c.zoom-f.tileID.overscaledZ+f.tileID.canonical.z));return function(v,k,S){var P=k[1],R=k[2],$=k[3],W=S[0],K=S[1];return v[0]=k[0]*W,v[1]=P*W,v[2]=R*K,v[3]=$*K,v}(new Float32Array(4),c.inverseAdjustmentMatrix,[g,g])},i.cO=o6,i.cP=le,i.cQ=tve,i.cR=function(f){const c=tve(f,!0);return x([],[c[0],c[1],c[4],c[5]])},i.cS=z,i.cT=zr,i.cU=F,i.cV=function(f){const{x:c,y:u}=f.point,{lng:g,lat:v}=f._center;return D0e(c,u,f.worldSize,g,v)},i.cW=Ae,i.cX=yo,i.cY=Ri,i.cZ=nc,i.c_=eh,i.ca=ua,i.cb=function(f,c){return f[0]=-c[0],f[1]=-c[1],f[2]=-c[2],f[3]=c[3],f},i.cc=ie,i.cd=function(f,c,u,g,v){var k=1/Math.tan(c/2);if(f[0]=k/u,f[1]=0,f[2]=0,f[3]=0,f[4]=0,f[5]=k,f[6]=0,f[7]=0,f[8]=0,f[9]=0,f[11]=-1,f[12]=0,f[13]=0,f[15]=0,v!=null&&v!==1/0){var S=1/(g-v);f[10]=(v+g)*S,f[14]=2*v*g*S}else f[10]=-1,f[14]=-2*g;return f},i.ce=function(f,c,u,g,v,k,S){var P=1/(c-u),R=1/(g-v),$=1/(k-S);return f[0]=-2*P,f[1]=0,f[2]=0,f[3]=0,f[4]=0,f[5]=-2*R,f[6]=0,f[7]=0,f[8]=0,f[9]=0,f[10]=2*$,f[11]=0,f[12]=(c+u)*P,f[13]=(v+g)*R,f[14]=(S+k)*$,f[15]=1,f},i.cf=Y,i.cg=function(f,c,u){f[4*c+0]=u[0],f[4*c+1]=u[1],f[4*c+2]=u[2],f[4*c+3]=u[3]},i.ch=wN,i.ci=$v,i.cj=qo,i.ck=Nf,i.cl=qv,i.cm=o_e,i.cn=function(){var f=new p(4);return p!=Float32Array&&(f[1]=0,f[2]=0),f[0]=1,f[3]=1,f},i.co=function(f,c,u){var g=c[0],v=c[1],k=c[2],S=c[3],P=Math.sin(u),R=Math.cos(u);return f[0]=g*R+k*P,f[1]=v*R+S*P,f[2]=g*-P+k*R,f[3]=v*-P+S*R,f},i.cp=function(f,c){return f[0]===c[0]&&f[1]===c[1]&&f[2]===c[2]&&f[3]===c[3]},i.cq=at,i.cr=function(f){var c=f[0],u=f[1],g=f[2],v=f[3];return Math.sqrt(c*c+u*u+g*g+v*v)},i.cs=Xr,i.ct=yt,i.cu=bo,i.cv=3,i.cw=2,i.cx=7,i.cy=6,i.cz=Te,i.d=function(f){return Ss.API_TILEJSON_REGEX.test(f)},i.d$=class{constructor(f,c,u,g){this.context=f,this.format=g,this.size=u,this.texture=f.gl.createTexture();const[v,k,S]=this.size,{gl:P}=f;P.bindTexture(P.TEXTURE_3D,this.texture),f.pixelStoreUnpackFlipY.set(!1),f.pixelStoreUnpack.set(1),f.pixelStoreUnpackPremultiplyAlpha.set(!1),"data"in c&&c.data&&P.texImage3D(P.TEXTURE_3D,0,this.format,v,k,S,0,Vie(this.format),Hie(this.format),c.data)}bind(f,c){const{context:u}=this,{gl:g}=u;g.bindTexture(g.TEXTURE_3D,this.texture),f!==this.minFilter&&(g.texParameteri(g.TEXTURE_3D,g.TEXTURE_MAG_FILTER,f),g.texParameteri(g.TEXTURE_3D,g.TEXTURE_MIN_FILTER,f),this.minFilter=f),c!==this.wrapS&&(g.texParameteri(g.TEXTURE_3D,g.TEXTURE_WRAP_S,c),g.texParameteri(g.TEXTURE_3D,g.TEXTURE_WRAP_T,c),this.wrapS=c)}destroy(){const{gl:f}=this.context;f.deleteTexture(this.texture),this.texture=null}},i.d0=function(f){return f*f*f*f*f},i.d1=D,i.d2=45,i.d3=jN,i.d4=function(f,c,u){const g=Math.sqrt(f*f+c*c+u*u),v=g>0?Math.acos(u/g)*To:0;let k=f!==0||c!==0?Math.atan2(-c,-f)*To+90:0;return k<0&&(k+=360),[g,k,v]},i.d5=ae,i.d6=Zn,i.d7=Pe,i.d8=ue,i.d9=on,i.dA=function(f){return f({pluginStatus:td,pluginURL:bp}),eN.on("pluginStateChange",f),f},i.dB=Uv,i.dC=class extends kp{constructor(f){super(f),this.current=kN}set(f,c,u){if(this.fetchUniformLocation(f,c)){for(let g=0;g<9;g++)if(u[g]!==this.current[g]){this.current=u,this.gl.uniformMatrix3fv(this.location,!1,u);break}}}},i.dD=$l,i.dE=function(f,c,u){const g=Yy(u.zoom),v=f.style.map._antialias,k=f.terrain&&f.terrain.exaggeration()>0;return g===0&&!v&&!k},i.dF=function(f){const c=f.pixelsPerMeter,u=c/Y(1,f.center.lat),g=A(new Float64Array(16));return L(g,g,[f.point.x,f.point.y,0]),z(g,g,[u,u,c]),Float32Array.from(g)},i.dG=HP,i.dH=function(f){const c=de-5;f=xe(f,-c,c)/c*90;const u=Math.pow(Math.abs(Math.sin(ss(f))),3);return Math.round(u*(A5.length-1))},i.dI=function(f,c,u,g){const v=c.getNorth(),k=c.getSouth(),S=c.getWest(),P=c.getEast(),R=1<0){const se=180/g;j(re,re,[se/$+1,0,0,0,se/W+1,0,-.5*se/K,.5*se/X,1])}return re[2]=R,re[5]=f.x,re[8]=f.y,re},i.dJ=Rh,i.dK=function(f,c,u){const g=A(new Float64Array(16)),v=(c/(1<({u_matrix:new qv(f),u_texsize:new Nf(f),u_pixels_to_tile_units:new NN(f),u_device_pixel_ratio:new qo(f),u_width_scale:new qo(f),u_floor_width_scale:new qo(f),u_image:new wN(f),u_units_to_pixels:new Nf(f),u_tile_units_to_pixels:new qo(f),u_alpha_discard_threshold:new qo(f),u_trim_offset:new Nf(f),u_trim_fade_range:new Nf(f),u_trim_color:new jN(f),u_zbias_factor:new qo(f),u_tile_to_meter:new qo(f),u_ground_shadow_factor:new $v(f),u_pattern_transition:new qo(f)}),i.dX=f=>({u_matrix:new qv(f),u_pixels_to_tile_units:new NN(f),u_device_pixel_ratio:new qo(f),u_width_scale:new qo(f),u_floor_width_scale:new qo(f),u_units_to_pixels:new Nf(f),u_dash_image:new wN(f),u_gradient_image:new wN(f),u_image_height:new qo(f),u_texsize:new Nf(f),u_tile_units_to_pixels:new qo(f),u_alpha_discard_threshold:new qo(f),u_trim_offset:new Nf(f),u_trim_fade_range:new Nf(f),u_trim_color:new jN(f),u_zbias_factor:new qo(f),u_tile_to_meter:new qo(f),u_ground_shadow_factor:new $v(f)}),i.dY=f=>({u_camera_to_center_distance:new qo(f),u_extrude_scale:new NN(f),u_device_pixel_ratio:new qo(f),u_matrix:new qv(f),u_inv_rot_matrix:new qv(f),u_merc_center:new Nf(f),u_tile_id:new $v(f),u_zoom_transition:new qo(f),u_up_dir:new $v(f),u_emissive_strength:new qo(f)}),i.dZ=fN,i.d_=Oqe,i.da=_e,i.db=function(f){return[Math.pow(f[0],1/2.2),Math.pow(f[1],1/2.2),Math.pow(f[2],1/2.2)]},i.dc=eve,i.dd=Qie,i.de=ave,i.df=joe,i.dg=function(f,c){return f.readFields(LVe,{icons:[]},c)},i.dh=n6,i.di=FN,i.dj=hoe,i.dk=Vg,i.dl=Ov,i.dm=Tm,i.dn=Pr,i.dp=ar,i.dq=function(f){const c=f.indexOf(nx);return c>=0?f.slice(0,c):f},i.dr=function(f){return f.indexOf(nx)>=0},i.ds=function(f){const c=f.lastIndexOf(nx);return c>=0?f.slice(c+1):""},i.dt=function(f){const c=[],u=f.id;return u===void 0&&c.push({message:`layers.${u}: missing required property "id"`}),f.render===void 0&&c.push({message:`layers.${u}: missing required method "render"`}),f.renderingMode&&f.renderingMode!=="2d"&&f.renderingMode!=="3d"&&c.push({message:`layers.${u}: property "renderingMode" must be either "2d" or "3d"`}),c},i.du=function(f,c,u,g){return f.type==="custom"?new CVe(f,c):new IVe[f.type](f,c,u,g)},i.dv=fr,i.dw=function(f){const c=f.indexOf(nx);return c>=0?f.slice(c+1):""},i.dx=class extends t_{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=eN,i.dz=Ch,i.e=Ss,i.e$=he,i.e0=z0e,i.e1=(f,c,u,g,v,k)=>{const S=f.transform,P=S.projection.name==="globe";let R;if(k.paint.get("circle-pitch-alignment")==="map")if(P){const W=O0e(S.zoom,c.canonical)*S._pixelsPerMercatorPixel;R=Float32Array.from([W,0,0,W])}else R=S.calculatePixelsToTileUnitsMatrix(u);else R=new Float32Array([S.pixelsToGLUnits[0],0,0,S.pixelsToGLUnits[1]]);const $={u_camera_to_center_distance:f.transform.getCameraToCenterDistance(S.projection),u_matrix:f.translatePosMatrix(c.projMatrix,u,k.paint.get("circle-translate"),k.paint.get("circle-translate-anchor")),u_device_pixel_ratio:$o.devicePixelRatio,u_extrude_scale:R,u_inv_rot_matrix:X$e,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0],u_emissive_strength:k.paint.get("circle-emissive-strength")};if(P){$.u_inv_rot_matrix=g,$.u_merc_center=v,$.u_tile_id=[c.canonical.x,c.canonical.y,1<{const W=f.transform,K=W.pitch<15?yve(.07,.7,xe((14-W.zoom)/5,0,1)):.07,X=u.paint.get("line-trim-color-use-theme").constantOr("default")==="none";return{u_matrix:_ve(f,c,u,g),u_texsize:c.imageAtlasTexture?c.imageAtlasTexture.size:[0,0],u_pixels_to_tile_units:W.calculatePixelsToTileUnitsMatrix(c),u_device_pixel_ratio:v,u_width_scale:k,u_floor_width_scale:S,u_image:0,u_tile_units_to_pixels:vve(c,W),u_units_to_pixels:[1/W.pixelsToGLUnits[0],1/W.pixelsToGLUnits[1]],u_alpha_discard_threshold:0,u_trim_offset:P,u_trim_fade_range:u.paint.get("line-trim-fade-range"),u_trim_color:u.paint.get("line-trim-color").toPremultipliedRenderColor(X?null:u.lut).toArray01(),u_zbias_factor:K,u_tile_to_meter:Pe(c.tileID.canonical,0),u_ground_shadow_factor:R,u_pattern_transition:$}},i.e5=(f,c,u,g,v,k,S,P,R,$)=>{const W=f.transform,K=W.calculatePixelsToTileUnitsMatrix(c),X=u.paint.get("line-trim-color-use-theme").constantOr("default")==="none",re=W.pitch<15?yve(.07,.7,xe((14-W.zoom)/5,0,1)):.07;return{u_matrix:_ve(f,c,u,g),u_pixels_to_tile_units:K,u_device_pixel_ratio:k,u_width_scale:S,u_floor_width_scale:P,u_units_to_pixels:[1/W.pixelsToGLUnits[0],1/W.pixelsToGLUnits[1]],u_dash_image:0,u_gradient_image:1,u_image_height:v,u_texsize:wve(u)&&c.lineAtlasTexture?c.lineAtlasTexture.size:[0,0],u_tile_units_to_pixels:vve(c,f.transform),u_alpha_discard_threshold:0,u_trim_offset:R,u_trim_fade_range:u.paint.get("line-trim-fade-range"),u_trim_color:u.paint.get("line-trim-color").toPremultipliedRenderColor(X?null:u.lut).toArray01(),u_zbias_factor:re,u_tile_to_meter:Pe(c.tileID.canonical,0),u_ground_shadow_factor:$}},i.e6=zt,i.e7=I5,i.e8=oe,i.e9=sh,i.eA=function(f,c){var u=2*Math.acos(c[3]),g=Math.sin(u/2);return g>h?(f[0]=c[0]/g,f[1]=c[1]/g,f[2]=c[2]/g):(f[0]=1,f[1]=0,f[2]=0),u},i.eB=Soe,i.eC=d6,i.eD=c6,i.eE=[1,1,1],i.eF=UN,i.eG=Oe,i.eH=function(f,c,u,g){var v=c[0],k=c[1],S=c[2],P=c[3];return f[0]=v+g*(u[0]-v),f[1]=k+g*(u[1]-k),f[2]=S+g*(u[2]-S),f[3]=P+g*(u[3]-P),f},i.eI=PN,i.eJ=_u,i.eK=kf,i.eL=function(f,c,u,g,v,k,S,P,R,$,W,K,X,re,se,fe){var Se=new p(16);return Se[0]=f,Se[1]=c,Se[2]=u,Se[3]=g,Se[4]=v,Se[5]=k,Se[6]=S,Se[7]=P,Se[8]=R,Se[9]=$,Se[10]=W,Se[11]=K,Se[12]=X,Se[13]=re,Se[14]=se,Se[15]=fe,Se},i.eM=_,i.eN=Vy,i.eO=_5,i.eP=class{constructor(){this._updateTime=0,this._sourceIds=[],this._activeRegions=[],this._prevRegions=[],this._globalClipBounds={min:new ir(1/0,1/0),max:new ir(-1/0,-1/0)}}clear(){this._activeRegions.length>0&&++this._updateTime,this._activeRegions=[],this._prevRegions=[]}get updateTime(){return this._updateTime}getReplacementRegionsForTile(f,c=!1){const u=m1e(new ir(0,0),new ir(Sr,Sr),f),g=[];if(c&&!Iie(u,this._globalClipBounds))return g;for(const v of this._activeRegions){if(v.hiddenByOverlap||!Iie(u,v))continue;const k=SUe(v.min,v.max,f);g.push({min:k.min,max:k.max,sourceId:this._sourceIds[v.priority],footprint:v.footprint,footprintTileId:v.tileId,order:v.order,clipMask:v.clipMask,clipScope:v.clipScope})}return g}setSources(f){this._setSources(f.map(c=>({getSourceId:()=>c.cache.id,getFootprints:()=>{const u=[];for(const g of c.cache.getVisibleCoordinates()){const v=c.cache.getTile(g).buckets[c.layer];v&&v.updateFootprints(g.toUnwrapped(),u)}return u},getOrder:()=>c.order,getClipMask:()=>c.clipMask,getClipScope:()=>c.clipScope})))}_addSource(f){const c=f.getFootprints();if(c.length===0)return;const u=f.getOrder(),g=f.getClipMask(),v=f.getClipScope();for(const k of c){if(!k.footprint)continue;const S=m1e(k.footprint.min,k.footprint.max,k.id);this._activeRegions.push({min:S.min,max:S.max,hiddenByOverlap:!1,priority:this._sourceIds.length,tileId:k.id,footprint:k.footprint,order:u,clipMask:g,clipScope:v})}this._sourceIds.push(f.getSourceId())}_computeReplacement(){this._activeRegions.sort((c,u)=>c.priority-u.priority||QP(c.min,u.min)||QP(c.max,u.max)||c.order-u.order||c.clipMask-u.clipMask||function(g,v){const k=(S,P)=>S+P;return g.length-v.length||g.reduce(k,"").localeCompare(v.reduce(k,""))}(c.clipScope,u.clipScope));let f=this._activeRegions.length!==this._prevRegions.length;if(!f){let c=0;for(;!f&&c!==this._activeRegions.length;){const u=this._activeRegions[c],g=this._prevRegions[c];f=u.priority!==g.priority||!p1e(u,g)||u.order!==g.order||u.clipMask!==g.clipMask||!fo(u.clipScope,g.clipScope),this._activeRegions[c].hiddenByOverlap=g.hiddenByOverlap,++c}}if(f){++this._updateTime;for(const u of this._activeRegions)u.order!==F5&&(this._globalClipBounds.min.x=Math.min(this._globalClipBounds.min.x,u.min.x),this._globalClipBounds.min.y=Math.min(this._globalClipBounds.min.y,u.min.y),this._globalClipBounds.max.x=Math.max(this._globalClipBounds.max.x,u.max.x),this._globalClipBounds.max.y=Math.max(this._globalClipBounds.max.y,u.max.y));const c=u=>{const g=this._activeRegions;if(u>=g.length)return u;const v=g[u].priority;for(;u1){let u=0,g=c(u);for(;u!==g;){let v=u;const k=u;for(;v!==g;){const S=this._activeRegions[v];S.hiddenByOverlap=!1;for(let P=0;P=0;c--)this._addSource(f[c]);this._computeReplacement()}},i.eQ=F5,i.eR=class{constructor(f){this._createGrid(f),this._createPoles(f)}destroy(){this._poleIndexBuffer.destroy(),this._gridBuffer.destroy(),this._gridIndexBuffer.destroy(),this._poleNorthVertexBuffer.destroy(),this._poleSouthVertexBuffer.destroy();for(const f of this._poleSegments)f.destroy();for(const f of this._gridSegments)f.withSkirts.destroy(),f.withoutSkirts.destroy()}_fillGridMeshWithLods(f,c){const u=new $m,g=new Uo,v=[],k=f+1+2,S=c[0]+1,P=c[0]+1+(1+c.length),R=($,W,K)=>{let X=$===k-1?$-2:$===0?$:$-1;return X+=K?24575:0,[X,W]};for(let $=0;$0?(Se=2*Math.sqrt(fe+1),f[3]=.25*Se,f[0]=(K-re)/Se,f[1]=(X-R)/Se,f[2]=(P-$)/Se):S>W&&S>se?(Se=2*Math.sqrt(1+S-W-se),f[3]=(K-re)/Se,f[0]=.25*Se,f[1]=(P+$)/Se,f[2]=(X+R)/Se):W>se?(Se=2*Math.sqrt(1+W-S-se),f[3]=(X-R)/Se,f[0]=(P+$)/Se,f[1]=.25*Se,f[2]=(K+re)/Se):(Se=2*Math.sqrt(1+se-S-W),f[3]=(P-$)/Se,f[0]=(X+R)/Se,f[1]=(K+re)/Se,f[2]=.25*Se),f},i.f=function(f){return btoa(encodeURIComponent(f).replace(/%([0-9A-F]{2})/g,(c,u)=>String.fromCharCode(+("0x"+u))))},i.f0=function([f,c,u]){const g=Math.hypot(f,c,u),v=Math.atan2(f,u),k=.5*Math.PI-Math.acos(-c/g);return new m(yo(v),yo(k))},i.f1=nt,i.f2=Gie,i.f3=function(f){const c=f.navigator?f.navigator.userAgent:null;return!!function(u){if(po==null){const g=u.navigator?u.navigator.userAgent:null;po=!!u.safari||!(!g||!(/\b(iPad|iPhone|iPod)\b/.test(g)||g.match("Safari")&&!g.match("Chrome")))}return po}(f)&&!(!c||!(c.match("Version/15.4")||c.match("Version/15.5")||c.match(/CPU (OS|iPhone OS) (15_4|15_5) like Mac OS X/)))},i.f4=function(f,c){vy=f,_y=c},i.f5=jie,i.f6=R0e,i.f7=function(f){const c=[0,0,0],u=A(new Float64Array(16));return T(u,f.pixelMatrix,f.globeMatrix),Ze(c,c,u),new ir(c[0],c[1])},i.f8=function(){const f=V5;f&&(f.isPreloaded()&&f.numActive()===1?(f.release(Fie),V5=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(){n6().acquire(Fie)},i.fA=D6,i.fB=Lt,i.fC=function(f){let c=0;if(new Uint32Array(f,0,1)[0]!==Z1e){const u=new Uint32Array(f,0,7),[,,g,v,k,S]=u;c=u.byteLength+v+k+S+k,(g!==f.byteLength||c>=f.byteLength)&&Ur("Invalid b3dm header information.")}return J1e(f,c)},i.fD=function(f,c){const u=Qie(f);for(const g of u){for(const v of g.meshes)nqe(v);g.lights&&(g.lightMeshIndex=g.meshes.length,g.meshes.push(sqe(g.lights,c)))}return u},i.fE=A6,i.fF=Ls,i.fG=V1e,i.fH=wp,i.fI=Hd,i.fJ=function(f){Dc(),gu!=null&&gu.then(c=>{c.keys().then(u=>{for(let g=0;gUr(v.message))}).catch(u=>Ur(u.message))}).catch(c=>Ur(c.message))},i.fa=Dv,i.fb=function(f,c,u=!1){if(td===Hd.deferred||td===Hd.loading||td===Hd.loaded)throw new Error("setRTLTextPlugin cannot be called multiple times.");bp=$o.resolveURL(f),td=Hd.deferred,c5=c,Jk(),u||kP()},i.fc=function(f){AN=$o.resolveURL(f),EN||(EN=new TN(n6(),new pi)),EN.broadcast("setMeshoptUrl",AN)},i.fd=G1e,i.fe=function(f){$ie=$o.resolveURL(f),EN||(EN=new TN(n6(),new pi)),EN.broadcast("setDracoUrl",$ie)},i.ff=W1e,i.fg=q5,i.fh=function(f){const c=qd();if(!c)return;const u=c.delete(yy);f&&u.then(()=>f()).catch(f)},i.fi=Yv,i.fj=Yr,i.fk=Xy,i.fl=Pp,i.fm=h2e,i.fn=f2e,i.fo=pve,i.fp=Jt,i.fq="hd_road_elevation",i.fr=ya,i.fs=Ut,i.ft=ox,i.fu=uoe,i.fv=Jv,i.fw=function(f,c,u,g,v,k,S,P=1,R,$,W){f.createArrays(),f.tilePixelRatio=Sr/(512*f.overscaling),f.compareText={},f.iconsNeedLinear=!1;const K=f.layers[0].layout,X=f.layers[0]._unevaluatedLayout._values,re={};re.scaleFactor=P,re.textSizeScaleRange=K.get("text-size-scale-range"),re.iconSizeScaleRange=K.get("icon-size-scale-range");const[se,fe]=re.textSizeScaleRange,[Se,ke]=re.iconSizeScaleRange;re.textScaleFactor=xe(re.scaleFactor,se,fe),re.iconScaleFactor=xe(re.scaleFactor,Se,ke);const Fe=X["text-size"],$e=X["icon-size"];if(f.textSizeData.kind==="composite"){const{minZoom:Et,maxZoom:Kt}=f.textSizeData;re.compositeTextSizes=[Fe.possiblyEvaluate(new ti(Et,{worldview:W}),k),Fe.possiblyEvaluate(new ti(Kt,{worldview:W}),k)]}if(f.iconSizeData.kind==="composite"){const{minZoom:Et,maxZoom:Kt}=f.iconSizeData;re.compositeIconSizes=[$e.possiblyEvaluate(new ti(Et,{worldview:W}),k),$e.possiblyEvaluate(new ti(Kt,{worldview:W}),k)]}re.layoutTextSize=Fe.possiblyEvaluate(new ti(S+1,{worldview:W}),k),re.layoutIconSize=$e.possiblyEvaluate(new ti(S+1,{worldview:W}),k),re.textMaxSize=Fe.possiblyEvaluate(new ti(18,{worldview:W}),k);const Ke=K.get("symbol-placement"),ht=K.get("text-rotation-alignment")==="map"&&Ke!=="point",ot=K.get("text-size");let _t=!1;const Ct=[];for(const Et of f.features){const Kt=K.get("text-font").evaluate(Et,{},k).join(","),Rt=ot.evaluate(Et,{},k)*re.textScaleFactor,rr=re.layoutTextSize.evaluate(Et,{},k)*re.textScaleFactor,or=re.layoutIconSize.evaluate(Et,{},k)*re.iconScaleFactor,lr={horizontal:{},vertical:void 0},xr=Et.text;let vr,ur=[0,0];if(xr){const ns=xr.toString(),Ba=K.get("text-letter-spacing").evaluate(Et,{},k)*yl,lt=K.get("text-line-height").evaluate(Et,{},k)*yl,pt=o5(ns)?Ba:0,nr=K.get("text-anchor").evaluate(Et,{},k),yr=K.get("text-variable-anchor");if(!yr){const Qn=K.get("text-radial-offset").evaluate(Et,{},k);if(Qn)ur=Yve(nr,[Qn*yl,poe]);else{const cs=K.get("text-offset").evaluate(Et,{},k);ur=[cs[0]*yl,cs[1]*yl]}}let Or=ht?"center":K.get("text-justify").evaluate(Et,{},k);const Dr=Ke==="point",hn=Dr?K.get("text-max-width").evaluate(Et,{},k)*yl:1/0,vn=Qn=>{f.allowVerticalPlacement&&Lv(ns)&&(lr.vertical=ioe(xr,c,u,v,Kt,hn,lt,nr,Qn,pt,ur,ju.vertical,!0,rr,Rt,R))};if(!ht&&yr){const Qn=Or==="auto"?yr.map(ms=>moe(ms)):[Or];let cs=!1;for(let ms=0;ms=0||!Lv(ns)){const Qn=ioe(xr,c,u,v,Kt,hn,lt,nr,Or,pt,ur,ju.horizontal,!1,rr,Rt,R);Qn&&(lr.horizontal[Or]=Qn)}vn(Dr?"left":Or)}}let pr,tr,Xt,mr,Mr,wr,un=!1;const Br=K.get("icon-text-fit").evaluate(Et,{},k);if(Et.icon&&Et.icon.hasPrimary()){const ns=eM(Et.icon,f.iconSizeData,X["icon-size"],k,f.zoom,Et,R,re.iconScaleFactor,W);pr=ns.iconPrimary,Xt=ns.iconSecondary;const Ba=pr.toString();if(tr=g.get(Ba),tr&&(Mr=K.get("icon-offset").evaluate(Et,{},k),wr=K.get("icon-anchor").evaluate(Et,{},k),vr=m6(v.get(Ba),Xt?v.get(Xt.toString()):void 0,Mr,wr),un=tr.sdf,f.sdfIcons===void 0?f.sdfIcons=tr.sdf:f.sdfIcons!==tr.sdf&&Ur("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(tr.pixelRatio!==f.pixelRatio||K.get("icon-rotate").constantOr(1)!==0)&&(f.iconsNeedLinear=!0)),Xt){const lt=Xt.toString();mr=g.get(lt)}}_t=_t||!(!Et.icon||!Et.icon.hasSecondary());const Kr=_6(lr.horizontal)||lr.vertical;f.iconsInText||(f.iconsInText=!!Kr&&Kr.iconsInText);const tn=rr*re.textScaleFactor/yl,{defaultShapedIcon:gs,verticallyShapedIcon:jr}=hVe(f,vr,K,Et,k,lr,tn,Mr,Br);Br!=="none"&&vr&&(Ove(vr)||Dve(vr))&&(v6(0,tr,pr,vr,gs,Br,$,g,v),v6(0,mr,Xt,vr,gs,Br,$,g,v),jr&&(v6(0,tr,pr,vr,jr,Br,$,g,v),v6(0,mr,Xt,vr,jr,Br,$,g,v))),vr=gs;const{iconBBox:rn,iconVerticalBBox:qn,textBBox:Ds,textVerticalBBox:$s}=oVe(f,vr,jr,K,Et,k,or,Mr,re,v,wr,lr,rr,ur);Ct.push({feature:Et,shapedTextOrientations:lr,shapedText:Kr,shapedIcon:vr,iconPrimary:pr,iconSecondary:Xt,iconOffset:Mr,iconAnchor:wr,verticallyShapedIcon:jr,layoutTextSize:rr,layoutIconSize:or,textOffset:ur,isSDFIcon:un,iconTextFit:Br,iconCollisionBounds:rn,iconVerticalCollisionBounds:qn,textCollisionBounds:Ds,textVerticalCollisionBounds:$s})}return{featureData:Ct,sizes:re,hasAnySecondaryIcon:_t,textAlongLine:ht,symbolPlacement:Ke}},i.fx=Vve,i.fy=function(f,c,u,g,v,k,S,P,R,$){f.iconAtlasPositions=$.iconPositions;const{featureData:W,hasAnySecondaryIcon:K,sizes:X,textAlongLine:re,symbolPlacement:se}=c;for(const fe of W){const{shapedIcon:Se,verticallyShapedIcon:ke,feature:Fe,shapedTextOrientations:$e,shapedText:Ke,layoutTextSize:ht,textOffset:ot,isSDFIcon:_t,iconPrimary:Ct,iconSecondary:Et,iconTextFit:Kt,iconOffset:Rt,iconCollisionBounds:rr,iconVerticalCollisionBounds:or,textCollisionBounds:lr}=fe;Qve(Se,$.iconPositions,Ct,Et),Qve(ke,$.iconPositions,Ct,Et),uVe($e,$.iconPositions),dVe(Ct,Et,$.iconPositions),(Ke||Se)&&fVe(f,Fe,$e,Se,ke,R,X,ht,0,ot,_t,g,v,S,P,K,Kt,Rt,re,se,rr,or,lr)}u&&f.generateCollisionDebugBuffers(k,f.collisionBoxArray,X.textScaleFactor)},i.fz=Bt,i.g=function(f,c){return Ch(Object.assign(f,{method:"GET"}),c)},i.h=function(f){return f.indexOf("mapbox:")===0},i.i=function(f){return Ss.API_STYLE_REGEX.test(f)&&!ml(f)},i.j=Ni,i.k=bd,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 Ch(Object.assign(f,{type:"json"}),c)},i.n=jy,i.o=$o,i.p=function(f,c){return Ch(Object.assign(f,{method:"POST"}),c)},i.q=wc,i.r=Ku,i.s=function(f){try{const c=self[f];return c.setItem("_mapbox_test_",1),c.removeItem("_mapbox_test_"),!0}catch{return!1}},i.t=function(){return zie||(zie=new Yv("ImageRasterizer")),zie},i.u=function(){return function f(c){return c?(c^Math.random()*(16>>c/4)).toString(16):([1e7]+-[1e3]+-4e3+-8e3+-1e11).replace(/[018]/g,f)}()},i.v=function(f){return!!f&&/^[0-9a-f]{8}-[0-9a-f]{4}-[4][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(f)},i.w=Ur,i.x=Ioe,i.y=ts,i.z=Hn}),o(["./shared"],function(i){function h(Je){const xe=Je?Je.url.toString():void 0;return xe?performance.getEntriesByName(xe):[]}function p(Je){if(typeof Je=="number"||typeof Je=="boolean"||typeof Je=="string"||Je==null)return JSON.stringify(Je);if(Array.isArray(Je)){let Ie="[";for(const Ge of Je)Ie+=`${p(Ge)},`;return`${Ie}]`}let xe="{";for(const Ie of Object.keys(Je).sort())xe+=`${Ie}:${p(Je[Ie])},`;return`${xe}}`}function x(Je){let xe="";for(const Ie of i.bx)xe+=`/${p(Je[Ie])}`;return xe}class y{constructor(xe){this.keyCache={},this._layers={},this._layerConfigs={},xe&&this.replace(xe)}replace(xe,Ie){this._layerConfigs={},this._layers={},this.update(xe,[],Ie)}update(xe,Ie,Ge){this._options=Ge;for(const vt of xe)this._layerConfigs[vt.id]=vt,(this._layers[vt.id]=i.du(vt,this.scope,null,this._options)).compileFilter(Ge),this.keyCache[vt.id]&&delete this.keyCache[vt.id];for(const vt of Ie)delete this.keyCache[vt],delete this._layerConfigs[vt],delete this._layers[vt];this.familiesBySource={};const kt=function(vt,At){const zt={};for(let Ut=0;Utthis._layers[Wr.id]),zt=At[0];if(zt.visibility==="none")continue;const Pt=zt.source||"";let Ut=this.familiesBySource[Pt];Ut||(Ut=this.familiesBySource[Pt]={});const fr=zt.sourceLayer||"_geojsonTileLayer";let ar=Ut[fr];ar||(ar=Ut[fr]=[]),ar.push(At)}}}const b=1*i.fl;class j{constructor(xe){const Ie={},Ge=[];for(const zt in xe){const Pt=xe[zt],Ut=Ie[zt]={};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?b:1,wn={x:0,y:0,w:ar.bitmap.width+2*Wr,h:ar.bitmap.height+2*Wr};Ge.push(wn),Ut[fr]=wn}}const{w:kt,h:vt}=i.G(Ge),At=new i.fk({width:kt||1,height:vt||1});for(const zt in xe){const Pt=xe[zt];for(const Ut in Pt.glyphs){const fr=Pt.glyphs[+Ut];if(!fr||fr.bitmap.width===0||fr.bitmap.height===0)continue;const ar=Ie[zt][Ut],Wr=fr.metrics.localGlyph?b:1;i.fk.copy(fr.bitmap,At,{x:0,y:0},{x:ar.x+Wr,y:ar.y+Wr},fr.bitmap)}}this.image=At,this.positions=Ie}}function C(Je,xe,Ie){Je[xe]?Ie&&(Je[xe].center=Ie):Je[xe]={floorIds:new Set,center:Ie||[0,0],floors:{}}}function N(Je,xe,Ie,Ge){for(const kt of xe)C(Je,kt),Je[kt].floors[Ie]=Ge,Je[kt].floorIds.add(Ie)}function A(Je){return{id:Je.properties.id.toString(),center:Je.properties.center.toString().split(";").map(Number)}}function E(Je){return{id:Je.properties.id.toString(),isDefault:!!Je.properties.is_default&&Je.properties.is_default,connections:Je.properties.connected_floor_ids?new Set(Je.properties.connected_floor_ids.toString().split(";")):new Set,conflicts:Je.properties.conflicted_floor_ids?new Set(Je.properties.conflicted_floor_ids.toString().split(";")):new Set,buildings:Je.properties.building_ids?new Set(Je.properties.building_ids.toString().split(";")):new Set,name:Je.properties.name.toString(),zIndex:Je.properties.z_index}}function T(Je,xe){return xe.every(Ie=>Je.properties&&Je.properties[Ie]!=null)}function L(Je){return T(Je,["type","id","name"])&&Je.properties.type==="building"}function z(Je){return T(Je,["type","id","name","z_index"])&&Je.properties.type==="floor"}i.fj(j,"GlyphAtlas");class F{constructor(xe){this.tileID=new i.aQ(xe.tileID.overscaledZ,xe.tileID.wrap,xe.tileID.canonical.z,xe.tileID.canonical.x,xe.tileID.canonical.y),this.tileZoom=xe.tileZoom,this.uid=xe.uid,this.zoom=xe.zoom,this.lut=xe.lut,this.canonical=xe.tileID.canonical,this.pixelRatio=xe.pixelRatio,this.tileSize=xe.tileSize,this.source=xe.source,this.scope=xe.scope,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=xe.showCollisionBoxes,this.collectResourceTiming=!!xe.request&&xe.request.collectResourceTiming,this.promoteId=xe.promoteId,this.isSymbolTile=xe.isSymbolTile,this.tileTransform=i.aZ(xe.tileID.canonical,xe.projection),this.projection=xe.projection,this.worldview=xe.worldview,this.localizableLayerIds=xe.localizableLayerIds,this.brightness=xe.brightness,this.extraShadowCaster=!!xe.extraShadowCaster,this.tessellationStep=xe.tessellationStep,this.scaleFactor=xe.scaleFactor,this.worldview=xe.worldview,this.indoor=xe.indoor}parse(xe,Ie,Ge,kt,vt,At){this.status="parsing",this.data=xe,this.collisionBoxArray=new i.b3;const zt=new i.fm(Object.keys(xe.layers).sort()),Pt=new i.fn(this.tileID,this.promoteId);Pt.bucketLayerIDs=[];const Ut={},fr=new i.fo(256,256),ar={featureIndex:Pt,iconDependencies:new Map,patternDependencies:new Map,glyphDependencies:{},lineAtlas:fr,availableImages:Ge,brightness:this.brightness,scaleFactor:this.scaleFactor,elevationFeatures:void 0,activeFloors:void 0};if(this.indoor){const Jn=this.indoor.indoorState.activeFloorsVisible,es=function(Zn,Ls,Li){const po=function(ji,Ws){if(!ji)return i.w("No source layers defined in indoor specification"),Ws;if(ji.size===0)return Ws;const ki=ji.difference(Ws);for(const za of ki)i.w(`Missing source layer required in indoor specification: ${za}`);return Ws.intersection(Ws)}(Ls.sourceLayers,new Set(Object.keys(Zn.layers))),ua=Ls.indoorState,vo=function(ji,Ws,ki,za){const Ss=new Set,Ni=new Set,ml=new Set,Sl=new Map,Lc={},mf=Bo=>{const _d=Sl.get(Bo)||new Set;for(const rc of Ss)if((Sl.get(rc)||new Set).has(Bo)||_d.has(rc))return!0;return!1};for(const Bo of Ws){const _d=ji.layers[Bo];if(_d)for(let rc=0;rc<_d.length;rc++){const Ku=_d.feature(rc);if(L(Ku)){const{id:$o,center:dp}=A(Ku);C(Lc,$o,dp),Ss.add($o)}else if(z(Ku)){const{id:$o,isDefault:dp,connections:Tm,conflicts:yy,buildings:vy,name:_y,zIndex:Sh}=E(Ku);N(Lc,vy,$o,{name:_y,zIndex:Sh}),Sl.set($o,yy),($o===za||Tm.has(za))&&Ss.add($o),Ni.add($o),dp&&ml.add($o)}}else i.w(`indoor source layer not found: ${Bo}`)}if(ki)for(const Bo of ki)Ni.has(Bo)&&(mf(Bo)||Ss.add(Bo));for(const Bo of ml)Ss.has(Bo)||mf(Bo)||Ss.add(Bo);return{buildings:Lc,activeFloors:Ss}}(Zn,po,ua.lastActiveFloors,ua.selectedFloorId);return Li.send("setIndoorData",vo),vo}(xe,this.indoor,vt);ar.activeFloors=Jn?es.activeFloors:void 0}const Wr=[],wn=Ie.familiesBySource[this.source];for(const Jn in wn){const es=xe.layers[Jn];if(!es)continue;let Zn=!1,Ls=!1,Li=!1;for(const Ws of wn[Jn])Ws[0].type==="symbol"?Zn=!0:Ls=!0,Ws[0].is3D()&&Ws[0].type!=="model"&&(Li=!0);if(this.extraShadowCaster&&!Li||this.isSymbolTile===!0&&!Zn||this.isSymbolTile===!1&&!Ls)continue;es.version===1&&i.w(`Vector tile source "${this.source}" layer "${Jn}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const po=zt.encode(Jn),ua=[],vo=this.localizableLayerIds&&this.localizableLayerIds.has(Jn);let ji=!1;for(let Ws=0,ki=0;Ws=ki.maxzoom||ki.visibility==="none")continue;q(Ws,this.zoom,ar.brightness,Ge,this.worldview);const za=Ut[ki.id]=ki.createBucket({index:Pt.bucketLayerIDs.length,layers:Ws,zoom:this.zoom,lut:this.lut,canonical:this.canonical,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:po,sourceID:this.source,projection:this.projection.spec,tessellationStep:this.tessellationStep,styleDefinedModelURLs:kt,worldview:this.worldview,localizable:vo});Pt.bucketLayerIDs.push(Ws.map(Ni=>i.B(Ni.id,Ni.scope)));let Ss=za.prepare?za.prepare():null;Ss!=null?(Ss=Ss.then(()=>za.populate(ua,ar,this.tileID.canonical,this.tileTransform)),Wr.push(Ss)):za.populate(ua,ar,this.tileID.canonical,this.tileTransform)}}const Ur=()=>{let Jn,es,Zn,Ls,Li,po;fr.trim();const ua={type:"maybePrepare",isSymbolTile:this.isSymbolTile,zoom:this.zoom},vo=()=>{if(Jn)return this.status="done",At(Jn);if(this.extraShadowCaster)this.status="done",At(null,{buckets:Object.values(Ut).filter(Ws=>!Ws.isEmpty()),featureIndex:Pt,collisionBoxArray:null,glyphAtlasImage:null,lineAtlas:null,imageAtlas:null,brightness:ar.brightness,glyphMap:null,iconMap:null,glyphPositions:null});else if(es&&Zn&&Ls){const Ws=new j(es),ki=new Map;for(const[Ni,ml]of Zn.entries()){const{imagePosition:Sl}=i.fu(Ni,ml,i.fv);ki.set(Ni,Sl)}const za={};for(const Ni in Ut){const ml=Ut[Ni];ml instanceof i.b4&&(q(ml.layers,this.zoom,ar.brightness,Ge,this.worldview),za[Ni]=i.fw(ml,es,Ws.positions,Zn,ki,this.tileID.canonical,this.tileZoom,this.scaleFactor,this.pixelRatio,Li,this.worldview))}const Ss={iconsPending:!0,patternsPending:!0};this.rasterizeIfNeeded(vt,Zn,Li,()=>{Ss.iconsPending=!1,ji(za,Ws,Ss)}),this.rasterizeIfNeeded(vt,Ls,po,()=>{Ss.patternsPending=!1,ji(za,Ws,Ss)})}},ji=(Ws,ki,za,Ss)=>{if(za.iconsPending||za.patternsPending)return;const Ni=new i.fx(Zn,Ls,this.lut);for(const ml in Ut){const Sl=Ut[ml];if(ml in Ws)i.fy(Sl,Ws[ml],this.showCollisionBoxes,Ge,this.tileID.canonical,this.tileZoom,this.projection,this.brightness,Zn,Ni);else if(Sl.hasPattern&&(Sl instanceof i.ba||Sl instanceof i.bb||Sl instanceof i.ea)){q(Sl.layers,this.zoom,ar.brightness,Ge,this.worldview);const Lc=Object.fromEntries(Ni.patternPositions);Sl.addFeatures(ar,this.tileID.canonical,Lc,Ge,this.tileTransform,this.brightness)}}this.status="done",At(null,{buckets:Object.values(Ut).filter(ml=>!ml.isEmpty()),featureIndex:Pt,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:ki.image,lineAtlas:fr,imageAtlas:Ni,brightness:ar.brightness})};if(!this.extraShadowCaster){const Ws=i.fs(ar.glyphDependencies,Ss=>Object.keys(Ss).map(Number));Object.keys(Ws).length?vt.send("getGlyphs",{uid:this.uid,stacks:Ws},(Ss,Ni)=>{Jn||(Jn=Ss,es=Ni,vo())},void 0,!1,ua):es={};const ki=Array.from(ar.iconDependencies.keys()).map(Ss=>i.I.parse(Ss));ki.length?vt.send("getImages",{images:ki,source:this.source,scope:this.scope,tileID:this.tileID,type:"icons"},(Ss,Ni)=>{Jn||(Jn=Ss,Zn=new Map,Li=this.updateImageMapAndGetImageTaskQueue(Zn,Ni,ar.iconDependencies),vo())},void 0,!1,ua):(Zn=new Map,Li=new Map);const za=Array.from(ar.patternDependencies.keys()).map(Ss=>i.I.parse(Ss));za.length?vt.send("getImages",{images:za,source:this.source,scope:this.scope,tileID:this.tileID,type:"patterns"},(Ss,Ni)=>{Jn||(Jn=Ss,Ls=new Map,po=this.updateImageMapAndGetImageTaskQueue(Ls,Ni,ar.patternDependencies),vo())},void 0,!1,ua):(Ls=new Map,po=new Map)}if(ar.elevationFeatures&&ar.elevationFeatures.length>0){const Ws=[];for(const za of Object.values(Ut))if(za instanceof i.bb){const Ss=za.getUnevaluatedPortalGraph();Ss&&Ws.push(Ss)}const ki=i.ft.evaluate(Ws);for(const za of Object.values(Ut))if(za instanceof i.bb){const Ss=xe.layers[zt.decode(za.sourceLayerIndex)];za.setEvaluatedPortalGraph(ki,Ss,this.tileID.canonical,ar.availableImages,ar.brightness)}}vo()};Wr.length>0?Promise.allSettled(Wr).then(Ur).catch(At):Ur()}updateParameters(xe){this.scaleFactor=xe.scaleFactor,this.showCollisionBoxes=xe.showCollisionBoxes,this.projection=xe.projection,this.brightness=xe.brightness,this.tileTransform=i.aZ(xe.tileID.canonical,xe.projection),this.extraShadowCaster=xe.extraShadowCaster,this.lut=xe.lut,this.worldview=xe.worldview,this.indoor=xe.indoor}rasterizeIfNeeded(xe,Ie,Ge,kt){Array.from(Ie.values()).some(vt=>vt.usvg)?this.rasterize(xe,Ie,Ge,kt):kt()}updateImageMapAndGetImageTaskQueue(xe,Ie,Ge){const kt=new Map;for(const vt of Ie.keys()){const At=Ge.get(vt)||[];for(const zt of At){const Pt=zt.toString(),Ut=Ie.get(zt.id.toString());Ut.usvg?kt.has(Pt)||(kt.set(Pt,zt),xe.set(Pt,Object.assign({},Ut))):xe.set(Pt,Ut)}}return kt}rasterize(xe,Ie,Ge,kt){this.rasterizeTask=xe.send("rasterizeImages",{scope:this.scope,tasks:Ge},(vt,At)=>{if(!vt)for(const[zt,Pt]of At.entries()){const Ut=Object.assign(Ie.get(zt),{data:Pt});Ie.set(zt,Ut)}kt()})}cancelRasterize(){this.rasterizeTask&&this.rasterizeTask.cancel()}}function q(Je,xe,Ie,Ge,kt){const vt=new i.ac(xe,{brightness:Ie,worldview:kt});for(const At of Je)At.recalculate(vt,Ge)}class H extends i.E{constructor(xe,Ie,Ge,kt,vt,At,zt){super(),this.actor=xe,this.layerIndex=Ie,this.availableImages=Ge,this.availableModels=kt,this.loadVectorData=At||i.aL,this.loading={},this.loaded={},this.deduped=new i.aK(xe.scheduler),this.isSpriteLoaded=vt,this.scheduler=xe.scheduler,this.brightness=zt}loadTile(xe,Ie){const Ge=xe.uid,kt=xe&&xe.request,vt=kt&&kt.collectResourceTiming,At=this.loading[Ge]=new F(xe);At.abort=this.loadVectorData(xe,(zt,Pt)=>{const Ut=!this.loading[Ge];if(delete this.loading[Ge],At.cancelRasterize(),Ut||zt||!Pt)return At.status="done",Ut||(this.loaded[Ge]=At),Ie(zt);const fr=Pt.rawData,ar={},Wr=i.aM(Pt.responseHeaders);Wr&&Wr.expires&&(ar.expires=Wr.expires),Wr&&Wr.cacheControl&&(ar.cacheControl=Wr.cacheControl),At.vectorTile=Pt.vectorTile||new i.fz(new i.bt(fr));const wn=()=>{At.parse(At.vectorTile,this.layerIndex,this.availableImages,this.availableModels,this.actor,(Ur,Jn)=>{if(Ur||!Jn)return Ie(Ur);const es={};if(vt){const Zn=h(kt);Zn.length>0&&(es.resourceTiming=JSON.parse(JSON.stringify(Zn)))}Ie(null,Object.assign({rawTileData:fr.slice(0),responseHeaders:Pt.responseHeaders},Jn,ar,es))})};this.isSpriteLoaded?wn():this.once("isSpriteLoaded",()=>{this.scheduler?this.scheduler.add(wn,{type:"parseTile",isSymbolTile:xe.isSymbolTile,zoom:xe.tileZoom}):wn()}),this.loaded=this.loaded||{},this.loaded[Ge]=At})}reloadTile(xe,Ie){const Ge=this.loaded,kt=xe.uid;if(Ge&&Ge[kt]){const vt=Ge[kt];vt.updateParameters(xe);const At=(zt,Pt)=>{const Ut=vt.reloadCallback;Ut&&(delete vt.reloadCallback,vt.parse(vt.vectorTile,this.layerIndex,this.availableImages,this.availableModels,this.actor,Ut)),Ie(zt,Pt)};vt.status==="parsing"?vt.reloadCallback=At:vt.status==="done"&&(vt.vectorTile?vt.parse(vt.vectorTile,this.layerIndex,this.availableImages,this.availableModels,this.actor,At):At())}else Ie(null,void 0)}abortTile(xe,Ie){const Ge=xe.uid,kt=this.loading[Ge];kt&&(kt.abort&&kt.abort(),delete this.loading[Ge]),Ie()}removeTile(xe,Ie){const Ge=this.loaded,kt=xe.uid;Ge&&Ge[kt]&&delete Ge[kt],Ie()}}class Z{loadTile(xe,Ie){const{uid:Ge,encoding:kt,rawImageData:vt,padding:At}=xe,zt=ImageBitmap&&vt instanceof ImageBitmap?this.getImageData(vt,At):vt;Ie(null,new i.fA(Ge,zt,kt,At<1))}reloadTile(xe,Ie){Ie(null,null)}abortTile(xe,Ie){Ie()}removeTile(xe,Ie){Ie()}getImageData(xe,Ie){this.offscreenCanvas&&this.offscreenCanvasContext||(this.offscreenCanvas=new OffscreenCanvas(xe.width,xe.height),this.offscreenCanvasContext=this.offscreenCanvas.getContext("2d",{willReadFrequently:!0})),this.offscreenCanvas.width=xe.width,this.offscreenCanvas.height=xe.height,this.offscreenCanvasContext.drawImage(xe,0,0,xe.width,xe.height);const Ge=this.offscreenCanvasContext.getImageData(-Ie,-Ie,xe.width+2*Ie,xe.height+2*Ie);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),Ge}}i.bs.setPbf(i.bt);class G{constructor(xe){this._mrt=new i.bs(xe.partial?30:1/0),this._isHeaderLoaded=!1,this.uid=xe.uid,this.tileID=xe.tileID,this.source=xe.source}parse(xe,Ie){const Ge=this._mrt;this.status="parsing",this._entireBuffer=xe;try{Ge.parseHeader(xe),this._isHeaderLoaded=!0;const kt=[];for(const vt in Ge.layers){const At=Ge.getLayer(vt),zt=At.getDataRange(At.getBandList()),Pt=Ge.createDecodingTask(zt),Ut=xe.slice(zt.firstByte,zt.lastByte+1),fr=i.bs.performDecoding(Ut,Pt).then(ar=>Pt.complete(null,ar)).catch(ar=>Pt.complete(ar,null));kt.push(fr)}Promise.allSettled(kt).then(()=>Ie(null,Ge)).catch(vt=>Ie(vt))}catch(kt){Ie(kt)}}}class te{constructor(xe){this.actor=xe,this.loading={},this.loaded={}}loadTile(xe,Ie){const Ge=xe.uid,kt=xe.request,vt=this.loading[Ge]=new G(xe),{cancel:At}=i.bu(kt,(zt,Pt,Ut)=>{const fr=!this.loading[Ge];if(delete this.loading[Ge],fr||zt||!Pt)return vt.status="done",fr||(this.loaded[Ge]=vt),Ie(zt);vt.parse(Pt,(ar,Wr)=>{if(ar||!Wr)return Ie(ar);Ie(null,Wr,Ut)}),this.loaded[Ge]=vt});vt.abort=At}reloadTile(xe,Ie){Ie(null,void 0)}abortTile(xe,Ie){const Ge=xe.uid,kt=this.loading[Ge];kt&&(kt.abort&&kt.abort(),delete this.loading[Ge]),Ie()}removeTile(xe,Ie){const Ge=xe.uid;this.loaded[Ge]&&delete this.loaded[Ge],Ie()}decodeRasterArray(xe,Ie){i.bs.performDecoding(xe.buffer,xe.task).then(Ge=>Ie(null,Ge)).catch(Ge=>Ie(Ge))}}const ie=i.fB.prototype.toGeoJSON;class le{constructor(xe){this._feature=xe,this.extent=i.al,this.type=xe.type,this.properties=xe.tags,"id"in xe&&!isNaN(xe.id)&&(this.id=parseInt(xe.id,10))}loadGeometry(){if(this._feature.type===1){const xe=[];for(const Ie of this._feature.geometry)xe.push([new i.P(Ie[0],Ie[1])]);return xe}{const xe=[];for(const Ie of this._feature.geometry){const Ge=[];for(const kt of Ie)Ge.push(new i.P(kt[0],kt[1]));xe.push(Ge)}return xe}}toGeoJSON(xe,Ie,Ge){return ie.call(this,xe,Ie,Ge)}}class ye{constructor(xe,Ie){this.name=xe,this.extent=i.al,this.length=Ie.length,this._jsonFeatures=Ie}feature(xe){return new le(this._jsonFeatures[xe])}}class ne{constructor(xe){this.layers={},this.extent=i.al;for(const Ie of Object.keys(xe))this.layers[Ie]=new ye(Ie,xe[Ie])}}const ge=64/4096,ae=128;class he{constructor(){this.features=new Map}clear(){this.features.clear()}load(xe=[],Ie){for(const Ge of xe){const kt=Ge.id;if(kt==null)continue;let vt=this.features.get(kt);vt&&this.updateCache(vt,Ie),Ge.geometry?(vt=_e(Ge),this.updateCache(vt,Ie),this.features.set(kt,vt)):this.features.delete(kt),this.updateCache(vt,Ie)}}updateCache(xe,Ie){for(const{canonical:Ge,uid:kt}of Object.values(Ie)){const{z:vt,x:At,y:zt}=Ge;ue(xe,Math.pow(2,vt),At,zt)&&delete Ie[kt]}}getTile(xe,Ie,Ge){const kt=Math.pow(2,xe),vt=[];for(const At of this.features.values())ue(At,kt,Ie,Ge)&&vt.push(me(At,kt,Ie,Ge));return{features:vt}}getFeatures(){return[...this.features.values()]}}function ue({minX:Je,minY:xe,maxX:Ie,maxY:Ge},kt,vt,At){return Je<(vt+1+ge)/kt&&xe<(At+1+ge)/kt&&Ie>(vt-ge)/kt&&Ge>(At-ge)/kt}function _e(Je){const{id:xe,geometry:Ie,properties:Ge}=Je;if(!Ie)return;if(Ie.type==="GeometryCollection")throw new Error("GeometryCollection not supported in dynamic mode.");const{type:kt,coordinates:vt}=Ie,At={id:xe,type:1,geometry:[],tags:Ge,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0},zt=At.geometry;if(kt==="Point")Ae(vt,zt,At);else if(kt==="MultiPoint")for(const Pt of vt)Ae(Pt,zt,At);else if(kt==="LineString")At.type=2,Ce(vt,zt,At);else if(kt==="MultiLineString")At.type=2,be(vt,zt,At);else if(kt==="Polygon")At.type=3,be(vt,zt,At,!0);else{if(kt!=="MultiPolygon")throw new Error("Input data is not a valid GeoJSON object.");At.type=3;for(const Pt of vt)be(Pt,zt,At,!0)}return At}function Ae([Je,xe],Ie,Ge){const kt=i.aF(Je);let vt=i.aJ(xe);vt=vt<0?0:vt>1?1:vt,Ie.push(kt,vt),Ge.minX=Math.min(Ge.minX,kt),Ge.minY=Math.min(Ge.minY,vt),Ge.maxX=Math.max(Ge.maxX,kt),Ge.maxY=Math.max(Ge.maxY,vt)}function Ce(Je,xe,Ie,Ge=!1,kt=!1){const vt=[];for(const At of Je)Ae(At,vt,Ie);xe.push(vt),Ge&&function(At,zt){let Pt=0;for(let Ut=0,fr=At.length,ar=fr-2;Ut0===zt)for(let Ut=0,fr=At.length;Ut=At&&ar>=At||(Ut>=At?(fr+=Math.round(Ur*((At-Ut)/wn)),Ut=At):ar>=At&&(Wr=fr+Math.round(Ur*((At-Ut)/wn)),ar=At),fr>=At&&Wr>=At||(fr>=At?(Ut+=Math.round(wn*((At-fr)/Ur)),fr=At):Wr>=At&&(ar=Ut+Math.round(wn*((At-fr)/Ur)),Wr=At),zt&&Ut===zt[zt.length-1][0]&&fr===zt[zt.length-1][1]||(zt=[[Ut,fr]],kt.push(zt)),zt.push([ar,Wr])))))}}function Ne(Je,xe,Ie,Ge,kt){const vt=(Ie-ge)/xe,At=(Ge-ge)/xe,zt=(Ie+1+ge)/xe,Pt=(Ge+1+ge)/xe;function Ut(Wr,wn){let Ur=0;return Wrzt&&(Ur|=2),wnPt&&(Ur|=8),Ur}let fr=[];for(let Wr=1;Wr<=8;Wr*=2){let wn=Je[Je.length-2],Ur=Je[Je.length-1],Jn=!(Ut(wn,Ur)&Wr);for(let es=0;es>31}function et(Je,xe){const{geometry:Ie,type:Ge}=Je;let kt=0,vt=0;if(Ge===1){xe.writeVarint(Re(1,Ie.length));for(const At of Ie){const zt=At[0]-kt,Pt=At[1]-vt;xe.writeVarint(je(zt)),xe.writeVarint(je(Pt)),kt+=zt,vt+=Pt}}else for(const At of Ie){xe.writeVarint(Re(1,1));const zt=At.length-(Ge===3?1:0);for(let Pt=0;PtJe},pe=Math.fround||(yt=new Float32Array(1),Je=>(yt[0]=+Je,yt[0]));var yt;const rt=3,at=5,Me=6;class ft{constructor(xe){this.options=Object.assign(Object.create(Ze),xe),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(xe){const{log:Ie,minZoom:Ge,maxZoom:kt}=this.options;Ie&&console.time("total time");const vt=`prepare ${xe.length} points`;Ie&&console.time(vt),this.points=xe;const At=[];for(let Pt=0;Pt=Ge;Pt--){const Ut=+Date.now();zt=this.trees[Pt]=this._createTree(this._cluster(zt,Pt)),Ie&&console.log("z%d: %d clusters in %dms",Pt,zt.numItems,+Date.now()-Ut)}return Ie&&console.timeEnd("total time"),this}getClusters(xe,Ie){let Ge=((xe[0]+180)%360+360)%360-180;const kt=Math.max(-90,Math.min(90,xe[1]));let vt=xe[2]===180?180:((xe[2]+180)%360+360)%360-180;const At=Math.max(-90,Math.min(90,xe[3]));if(xe[2]-xe[0]>=360)Ge=-180,vt=180;else if(Ge>vt){const ar=this.getClusters([Ge,kt,180,At],Ie),Wr=this.getClusters([-180,kt,vt,At],Ie);return ar.concat(Wr)}const zt=this.trees[this._limitZoom(Ie)],Pt=zt.range(Qe(Ge),nt(At),Qe(vt),nt(kt)),Ut=zt.data,fr=[];for(const ar of Pt){const Wr=this.stride*ar;fr.push(Ut[Wr+at]>1?qe(Ut,Wr,this.clusterProps):this.points[Ut[Wr+rt]])}return fr}getChildren(xe){const Ie=this._getOriginId(xe),Ge=this._getOriginZoom(xe),kt="No cluster with the specified id.",vt=this.trees[Ge];if(!vt)throw new Error(kt);const At=vt.data;if(Ie*this.stride>=At.length)throw new Error(kt);const zt=this.options.radius/(this.options.extent*Math.pow(2,Ge-1)),Pt=vt.within(At[Ie*this.stride],At[Ie*this.stride+1],zt),Ut=[];for(const fr of Pt){const ar=fr*this.stride;At[ar+4]===xe&&Ut.push(At[ar+at]>1?qe(At,ar,this.clusterProps):this.points[At[ar+rt]])}if(Ut.length===0)throw new Error(kt);return Ut}getLeaves(xe,Ie,Ge){const kt=[];return this._appendLeaves(kt,xe,Ie=Ie||10,Ge=Ge||0,0),kt}getTile(xe,Ie,Ge){const kt=this.trees[this._limitZoom(xe)],vt=Math.pow(2,xe),{extent:At,radius:zt}=this.options,Pt=zt/At,Ut=(Ge-Pt)/vt,fr=(Ge+1+Pt)/vt,ar={features:[]};return this._addTileFeatures(kt.range((Ie-Pt)/vt,Ut,(Ie+1+Pt)/vt,fr),kt.data,Ie,Ge,vt,ar),Ie===0&&this._addTileFeatures(kt.range(1-Pt/vt,Ut,1,fr),kt.data,vt,Ge,vt,ar),Ie===vt-1&&this._addTileFeatures(kt.range(0,Ut,Pt/vt,fr),kt.data,-1,Ge,vt,ar),ar.features.length?ar:null}getClusterExpansionZoom(xe){let Ie=this._getOriginZoom(xe)-1;for(;Ie<=this.options.maxZoom;){const Ge=this.getChildren(xe);if(Ie++,Ge.length!==1)break;xe=Ge[0].properties.cluster_id}return Ie}_appendLeaves(xe,Ie,Ge,kt,vt){const At=this.getChildren(Ie);for(const zt of At){const Pt=zt.properties;if(Pt&&Pt.cluster?vt+Pt.point_count<=kt?vt+=Pt.point_count:vt=this._appendLeaves(xe,Pt.cluster_id,Ge,kt,vt):vt1;let fr,ar,Wr;if(Ut)fr=Oe(Ie,Pt,this.clusterProps),ar=Ie[Pt],Wr=Ie[Pt+1];else{const Jn=this.points[Ie[Pt+rt]];fr=Jn.properties;const[es,Zn]=Jn.geometry.coordinates;ar=Qe(es),Wr=nt(Zn)}const wn={type:1,geometry:[[Math.round(this.options.extent*(ar*vt-Ge)),Math.round(this.options.extent*(Wr*vt-kt))]],tags:fr};let Ur;Ur=Ut||this.options.generateId?Ie[Pt+rt]:this.points[Ie[Pt+rt]].id,Ur!==void 0&&(wn.id=Ur),At.features.push(wn)}}_limitZoom(xe){return Math.max(this.options.minZoom,Math.min(Math.floor(+xe),this.options.maxZoom+1))}_cluster(xe,Ie){const{radius:Ge,extent:kt,reduce:vt,minPoints:At}=this.options,zt=Ge/(kt*Math.pow(2,Ie)),Pt=xe.data,Ut=[],fr=this.stride;for(let ar=0;arIe&&(es+=Pt[Ls+at])}if(es>Jn&&es>=At){let Zn,Ls=Wr*Jn,Li=wn*Jn,po=-1;const ua=(ar/fr<<5)+(Ie+1)+this.points.length;for(const vo of Ur){const ji=vo*fr;if(Pt[ji+2]<=Ie)continue;Pt[ji+2]=Ie;const Ws=Pt[ji+at];Ls+=Pt[ji]*Ws,Li+=Pt[ji+1]*Ws,Pt[ji+4]=ua,vt&&(Zn||(Zn=this._map(Pt,ar,!0),po=this.clusterProps.length,this.clusterProps.push(Zn)),vt(Zn,this._map(Pt,ji)))}Pt[ar+4]=ua,Ut.push(Ls/es,Li/es,1/0,ua,-1,es),vt&&Ut.push(po)}else{for(let Zn=0;Zn1)for(const Zn of Ur){const Ls=Zn*fr;if(!(Pt[Ls+2]<=Ie)){Pt[Ls+2]=Ie;for(let Li=0;Li>5}_getOriginZoom(xe){return(xe-this.points.length)%32}_map(xe,Ie,Ge){if(xe[Ie+at]>1){const At=this.clusterProps[xe[Ie+Me]];return Ge?Object.assign({},At):At}const kt=this.points[xe[Ie+rt]].properties,vt=this.options.map(kt);return Ge&&vt===kt?Object.assign({},vt):vt}}function qe(Je,xe,Ie){return{type:"Feature",id:Je[xe+rt],properties:Oe(Je,xe,Ie),geometry:{type:"Point",coordinates:[(Ge=Je[xe],360*(Ge-.5)),gt(Je[xe+1])]}};var Ge}function Oe(Je,xe,Ie){const Ge=Je[xe+at],kt=Ge>=1e4?`${Math.round(Ge/1e3)}k`:Ge>=1e3?Math.round(Ge/100)/10+"k":Ge,vt=Je[xe+Me],At=vt===-1?{}:Object.assign({},Ie[vt]);return Object.assign(At,{cluster:!0,cluster_id:Je[xe+rt],point_count:Ge,point_count_abbreviated:kt})}function Qe(Je){return Je/360+.5}function nt(Je){const xe=Math.sin(Je*Math.PI/180),Ie=.5-.25*Math.log((1+xe)/(1-xe))/Math.PI;return Ie<0?0:Ie>1?1:Ie}function gt(Je){const xe=(180-360*Je)*Math.PI/180;return 360*Math.atan(Math.exp(xe))/Math.PI-90}function mt(Je,xe,Ie,Ge){let kt=Ge;const vt=xe+(Ie-xe>>1);let At,zt=Ie-xe;const Pt=Je[xe],Ut=Je[xe+1],fr=Je[Ie],ar=Je[Ie+1];for(let Wr=xe+3;Wrkt)At=Wr,kt=wn;else if(wn===kt){const Ur=Math.abs(Wr-vt);UrGe&&(At-xe>3&&mt(Je,xe,At,Ge),Je[At+2]=kt,Ie-At>3&&mt(Je,At,Ie,Ge))}function Mt(Je,xe,Ie,Ge,kt,vt){let At=kt-Ie,zt=vt-Ge;if(At!==0||zt!==0){const Pt=((Je-Ie)*At+(xe-Ge)*zt)/(At*At+zt*zt);Pt>1?(Ie=kt,Ge=vt):Pt>0&&(Ie+=At*Pt,Ge+=zt*Pt)}return At=Je-Ie,zt=xe-Ge,At*At+zt*zt}function wt(Je,xe,Ie,Ge){const kt={id:Je??null,type:xe,geometry:Ie,tags:Ge,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if(xe==="Point"||xe==="MultiPoint"||xe==="LineString")Qt(kt,Ie);else if(xe==="Polygon")Qt(kt,Ie[0]);else if(xe==="MultiLineString")for(const vt of Ie)Qt(kt,vt);else if(xe==="MultiPolygon")for(const vt of Ie)Qt(kt,vt[0]);return kt}function Qt(Je,xe){for(let Ie=0;Ie0&&(At+=Ge?(kt*fr-Ut*vt)/2:Math.sqrt(Math.pow(Ut-kt,2)+Math.pow(fr-vt,2))),kt=Ut,vt=fr}const zt=xe.length-3;xe[2]=1,mt(xe,0,zt,Ie),xe[zt+2]=1,xe.size=Math.abs(At),xe.start=0,xe.end=xe.size}function Xr(Je,xe,Ie,Ge){for(let kt=0;kt1?1:Ie}function hr(Je,xe,Ie,Ge,kt,vt,At,zt){if(Ge/=xe,vt>=(Ie/=xe)&&At=Ge)return null;const Pt=[];for(const Ut of Je){const fr=Ut.geometry;let ar=Ut.type;const Wr=kt===0?Ut.minX:Ut.minY,wn=kt===0?Ut.maxX:Ut.maxY;if(Wr>=Ie&&wn=Ge)continue;let Ur=[];if(ar==="Point"||ar==="MultiPoint")xs(fr,Ur,Ie,Ge,kt);else if(ar==="LineString")ka(fr,Ur,Ie,Ge,kt,!1,zt.lineMetrics);else if(ar==="MultiLineString")zi(fr,Ur,Ie,Ge,kt,!1);else if(ar==="Polygon")zi(fr,Ur,Ie,Ge,kt,!0);else if(ar==="MultiPolygon")for(const Jn of fr){const es=[];zi(Jn,es,Ie,Ge,kt,!0),es.length&&Ur.push(es)}if(Ur.length){if(zt.lineMetrics&&ar==="LineString"){for(const Jn of Ur)Pt.push(wt(Ut.id,ar,Jn,Ut.tags));continue}ar!=="LineString"&&ar!=="MultiLineString"||(Ur.length===1?(ar="LineString",Ur=Ur[0]):ar="MultiLineString"),ar!=="Point"&&ar!=="MultiPoint"||(ar=Ur.length===3?"Point":"MultiPoint"),Pt.push(wt(Ut.id,ar,Ur,Ut.tags))}}return Pt.length?Pt:null}function xs(Je,xe,Ie,Ge,kt){for(let vt=0;vt=Ie&&At<=Ge&&Bi(xe,Je[vt],Je[vt+1],Je[vt+2])}}function ka(Je,xe,Ie,Ge,kt,vt,At){let zt=xa(Je);const Pt=kt===0?tl:xo;let Ut,fr,ar=Je.start;for(let es=0;esIe&&(fr=Pt(zt,Zn,Ls,po,ua,Ie),At&&(zt.start=ar+Ut*fr)):vo>Ge?ji=Ie&&(fr=Pt(zt,Zn,Ls,po,ua,Ie),Ws=!0),ji>Ge&&vo<=Ge&&(fr=Pt(zt,Zn,Ls,po,ua,Ge),Ws=!0),!vt&&Ws&&(At&&(zt.end=ar+Ut*fr),xe.push(zt),zt=xa(Je)),At&&(ar+=Ut)}let Wr=Je.length-3;const wn=Je[Wr],Ur=Je[Wr+1],Jn=kt===0?wn:Ur;Jn>=Ie&&Jn<=Ge&&Bi(zt,wn,Ur,Je[Wr+2]),Wr=zt.length-3,vt&&Wr>=3&&(zt[Wr]!==zt[0]||zt[Wr+1]!==zt[1])&&Bi(zt,zt[0],zt[1],zt[2]),zt.length&&xe.push(zt)}function xa(Je){const xe=[];return xe.size=Je.size,xe.start=Je.start,xe.end=Je.end,xe}function zi(Je,xe,Ie,Ge,kt,vt){for(const At of Je)ka(At,xe,Ie,Ge,kt,vt,!1)}function Bi(Je,xe,Ie,Ge){Je.push(xe,Ie,Ge)}function tl(Je,xe,Ie,Ge,kt,vt){const At=(vt-xe)/(Ge-xe);return Bi(Je,vt,Ie+(kt-Ie)*At,1),At}function xo(Je,xe,Ie,Ge,kt,vt){const At=(vt-Ie)/(kt-Ie);return Bi(Je,xe+(Ge-xe)*At,vt,1),At}function Hs(Je,xe){const Ie=[];for(let Ge=0;Ge0&&xe.size<(kt?At:Ge))return void(Ie.numPoints+=xe.length/3);const zt=[];for(let Pt=0;PtAt)&&(Ie.numSimplified++,zt.push(xe[Pt],xe[Pt+1])),Ie.numPoints++;kt&&function(Pt,Ut){let fr=0;for(let ar=0,Wr=Pt.length,wn=Wr-2;ar0===Ut)for(let ar=0,Wr=Pt.length;ar24)throw new Error("maxZoom should be in the 0-24 range");if(Ie.promoteId&&Ie.generateId)throw new Error("promoteId and generateId cannot be used together.");let kt=function(vt,At){const zt=[];if(vt.type==="FeatureCollection")for(let Pt=0;Pt1&&console.time("creation"),wn=this.tiles[Wr]=Oa(xe,Ie,Ge,kt,Ut),this.tileCoords.push({z:Ie,x:Ge,y:kt}),fr)){fr>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",Ie,Ge,kt,wn.numFeatures,wn.numPoints,wn.numSimplified),console.timeEnd("creation"));const Ws=`z${Ie}`;this.stats[Ws]=(this.stats[Ws]||0)+1,this.total++}if(wn.source=xe,vt==null){if(Ie===Ut.indexMaxZoom||wn.numPoints<=Ut.indexMaxPoints)continue}else{if(Ie===Ut.maxZoom||Ie===vt)continue;if(vt!=null){const Ws=vt-Ie;if(Ge!==At>>Ws||kt!==zt>>Ws)continue}}if(wn.source=null,xe.length===0)continue;fr>1&&console.time("clipping");const Ur=.5*Ut.buffer/Ut.extent,Jn=.5-Ur,es=.5+Ur,Zn=1+Ur;let Ls=null,Li=null,po=null,ua=null,vo=hr(xe,ar,Ge-Ur,Ge+es,0,wn.minX,wn.maxX,Ut),ji=hr(xe,ar,Ge+Jn,Ge+Zn,0,wn.minX,wn.maxX,Ut);xe=null,vo&&(Ls=hr(vo,ar,kt-Ur,kt+es,1,wn.minY,wn.maxY,Ut),Li=hr(vo,ar,kt+Jn,kt+Zn,1,wn.minY,wn.maxY,Ut),vo=null),ji&&(po=hr(ji,ar,kt-Ur,kt+es,1,wn.minY,wn.maxY,Ut),ua=hr(ji,ar,kt+Jn,kt+Zn,1,wn.minY,wn.maxY,Ut),ji=null),fr>1&&console.timeEnd("clipping"),Pt.push(Ls||[],Ie+1,2*Ge,2*kt),Pt.push(Li||[],Ie+1,2*Ge,2*kt+1),Pt.push(po||[],Ie+1,2*Ge+1,2*kt),Pt.push(ua||[],Ie+1,2*Ge+1,2*kt+1)}}getTile(xe,Ie,Ge){xe=+xe,Ie=+Ie,Ge=+Ge;const kt=this.options,{extent:vt,debug:At}=kt;if(xe<0||xe>24)return null;const zt=1<1&&console.log("drilling down to z%d-%d-%d",xe,Ie,Ge);let Ut,fr=xe,ar=Ie,Wr=Ge;for(;!Ut&&fr>0;)fr--,ar>>=1,Wr>>=1,Ut=this.tiles[To(fr,ar,Wr)];return Ut&&Ut.source?(At>1&&(console.log("found parent tile z%d-%d-%d",fr,ar,Wr),console.time("drilling down")),this.splitTile(Ut.source,fr,ar,Wr,xe,Ie,Ge),At>1&&console.timeEnd("drilling down"),this.tiles[Pt]?Ns(this.tiles[Pt],vt):null):null}}function To(Je,xe,Ie){return 32*((1<Ut.tags&&"3d_elevation_id"in Ut.tags&&"source"in Ut.tags&&Ut.tags.source==="elevation",vt=Ge.features.filter(Ut=>kt(Ut));let At={_geojsonTileLayer:Ge.features};vt.length>0&&(At={_geojsonTileLayer:Ge.features.filter(Ut=>!kt(Ut)),hd_road_elevation:vt});const zt=new ne(At),Pt=function(Ut){const fr=new i.bt;for(const ar of Object.keys(Ut))fr.writeMessage(3,Be,{name:ar,features:Ut[ar]});return fr.finish()}(At).buffer;xe(null,{vectorTile:zt,rawData:Pt})}class yo extends H{constructor(xe,Ie,Ge,kt,vt,At,zt){super(xe,Ie,Ge,kt,vt,ss,zt),At&&(this.loadGeoJSON=At),this._dynamicIndex=new he}loadData(xe,Ie){const Ge=xe&&xe.request,kt=Ge&&Ge.collectResourceTiming;this._geoJSONIndex=null,this.loadGeoJSON(xe,(vt,At)=>{if(vt||!At)return Ie(vt);if(typeof At!="object")return Ie(new Error(`Input data given to '${xe.source}' is not a valid GeoJSON object.`));{try{if(xe.filter){const Pt=i.U(xe.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(Pt.result==="error")throw new Error(Pt.value.map(Ut=>`${Ut.key}: ${Ut.message}`).join(", "));At.features=At.features.filter(Ut=>Pt.value.evaluate({zoom:0},Ut))}xe.dynamic?(At.type==="Feature"&&(At={type:"FeatureCollection",features:[At]}),xe.append||(this._dynamicIndex.clear(),this.loaded={}),this._dynamicIndex.load(At.features,this.loaded),xe.cluster&&(At.features=this._dynamicIndex.getFeatures())):this.loaded={},this._geoJSONIndex=xe.cluster?new ft(function({superclusterOptions:Pt,clusterProperties:Ut}){if(!Ut||!Pt)return Pt;const fr={},ar={},Wr={accumulated:null,zoom:0},wn={properties:null},Ur=Object.keys(Ut);for(const Jn of Ur){const[es,Zn]=Ut[Jn],Ls=i.U(Zn),Li=i.U(typeof es=="string"?[es,["accumulated"],["get",Jn]]:es);fr[Jn]=Ls.value,ar[Jn]=Li.value}return Pt.map=Jn=>{wn.properties=Jn;const es={};for(const Zn of Ur)es[Zn]=fr[Zn].evaluate(Wr,wn);return es},Pt.reduce=(Jn,es)=>{wn.properties=es;for(const Zn of Ur)Wr.accumulated=Jn[Zn],Jn[Zn]=ar[Zn].evaluate(Wr,wn)},Pt}(xe)).load(At.features):xe.dynamic?this._dynamicIndex:function(Pt,Ut){return new pl(Pt,Ut)}(At,xe.geojsonVtOptions)}catch(Pt){return Ie(Pt)}const zt={};if(kt){const Pt=h(Ge);Pt&&(zt.resourceTiming={},zt.resourceTiming[xe.source]=JSON.parse(JSON.stringify(Pt)))}Ie(null,zt)}})}reloadTile(xe,Ie){const Ge=this.loaded;return Ge&&Ge[xe.uid]?xe.partial?Ie(null,void 0):super.reloadTile(xe,Ie):this.loadTile(xe,Ie)}loadGeoJSON(xe,Ie){if(xe.request)i.m(xe.request,Ie);else{if(typeof xe.data!="string")return Ie(new Error(`Input data given to '${xe.source}' is not a valid GeoJSON object.`));setTimeout(()=>{try{return Ie(null,JSON.parse(xe.data))}catch{return Ie(new Error(`Input data given to '${xe.source}' is not a valid GeoJSON object.`))}},0)}}getClusterExpansionZoom(xe,Ie){try{Ie(null,this._geoJSONIndex.getClusterExpansionZoom(xe.clusterId))}catch(Ge){Ie(Ge)}}getClusterChildren(xe,Ie){try{Ie(null,this._geoJSONIndex.getChildren(xe.clusterId))}catch(Ge){Ie(Ge)}}getClusterLeaves(xe,Ie){try{Ie(null,this._geoJSONIndex.getLeaves(xe.clusterId,xe.limit,xe.offset))}catch(Ge){Ie(Ge)}}}class pu{constructor(xe,Ie,Ge){this.tileID=new i.aQ(xe.tileID.overscaledZ,xe.tileID.wrap,xe.tileID.canonical.z,xe.tileID.canonical.x,xe.tileID.canonical.y),this.tileZoom=xe.tileZoom,this.uid=xe.uid,this.zoom=xe.zoom,this.canonical=xe.tileID.canonical,this.pixelRatio=xe.pixelRatio,this.tileSize=xe.tileSize,this.source=xe.source,this.overscaling=this.tileID.overscaleFactor(),this.projection=xe.projection,this.brightness=Ie,this.worldview=Ge}parse(xe,Ie,Ge,kt){this.status="parsing";const vt=new i.aQ(Ge.tileID.overscaledZ,Ge.tileID.wrap,Ge.tileID.canonical.z,Ge.tileID.canonical.x,Ge.tileID.canonical.y),At=[],zt=Ie.familiesBySource[Ge.source],Pt=new i.fn(vt,Ge.promoteId);Pt.bucketLayerIDs=[],Pt.is3DTile=!0,i.fC(xe).then(Ut=>{if(!Ut)return kt(new Error("Could not parse tile"));const fr=Ut.json.extensionsUsed&&Ut.json.extensionsUsed.includes("MAPBOX_mesh_features")||Ut.json.asset.extras&&Ut.json.asset.extras.MAPBOX_mesh_features,ar=Ut.json.extensionsUsed&&Ut.json.extensionsUsed.includes("EXT_meshopt_compression"),Wr=new i.ac(this.zoom,{brightness:this.brightness,worldview:this.worldview});for(const wn in zt)for(const Ur of zt[wn]){const Jn=Ur[0];Pt.bucketLayerIDs.push(Ur.map(Ls=>i.B(Ls.id,Ls.scope))),Jn.recalculate(Wr,[]);const es=i.fD(Ut,1/i.d7(Ge.tileID.canonical)),Zn=new i.fE(Ur,es,vt,fr,ar,this.brightness,Pt,this.worldview);fr||(Zn.needsUpload=!0),At.push(Zn),Zn.evaluate(Jn)}this.status="done",kt(null,{buckets:At,featureIndex:Pt,collisionBoxArray:null,glyphAtlasImage:null,lineAtlas:null,imageAtlas:null,brightness:null})}).catch(Ut=>kt(new Error(Ut.message)))}}class $l{constructor(xe,Ie,Ge,kt,vt,At,zt,Pt){this.actor=xe,this.layerIndex=Ie,this.availableImages=Ge,this.availableModels=kt,this.brightness=zt,this.loading={},this.loaded={},this.worldview=Pt}loadTile(xe,Ie){const Ge=xe.uid,kt=this.loading[Ge]=new pu(xe,this.brightness,this.worldview);i.bu(xe.request,(vt,At)=>{const zt=!this.loading[Ge];return delete this.loading[Ge],zt||vt?(kt.status="done",zt||(this.loaded[Ge]=kt),Ie(vt)):At&&At.byteLength!==0?void kt.parse(At,this.layerIndex,xe,(Pt,Ut)=>{kt.status="done",this.loaded=this.loaded||{},this.loaded[Ge]=kt,Pt||!Ut?Ie(Pt):Ie(null,Ut)}):(kt.status="done",this.loaded[Ge]=kt,Ie())})}reloadTile(xe,Ie){const Ge=this.loaded,kt=xe.uid;if(Ge&&Ge[kt]){const vt=Ge[kt];vt.projection=xe.projection,vt.brightness=xe.brightness;const At=(zt,Pt)=>{vt.reloadCallback&&(delete vt.reloadCallback,this.loadTile(xe,Ie)),Ie(zt,Pt)};vt.status==="parsing"?vt.reloadCallback=At:vt.status==="done"&&this.loadTile(xe,Ie)}}abortTile(xe,Ie){const Ge=xe.uid;this.loading[Ge]&&delete this.loading[Ge],Ie()}removeTile(xe,Ie){const Ge=this.loaded,kt=xe.uid;Ge&&Ge[kt]&&delete Ge[kt],Ie()}}class mu{constructor(xe){this.self=xe,this.actor=new i.fG(xe,this),this.layerIndexes={},this.availableImages={},this.availableModels={},this.isSpriteLoaded={},this.imageRasterizer=new i.x,this.rtlPluginParsingListeners=[],this.projections={},this.defaultProjection=i.cm({name:"mercator"}),this.workerSourceTypes={vector:H,geojson:yo,"raster-dem":Z,"raster-array":te,"batched-model":$l},this.workerSources={},this.self.registerWorkerSource=(Ie,Ge)=>{if(this.workerSourceTypes[Ie])throw new Error(`Worker source with name "${Ie}" already registered.`);this.workerSourceTypes[Ie]=Ge},this.self.registerRTLTextPlugin=Ie=>{if(i.fH.isParsed())throw new Error("RTL text plugin already registered.");i.fH.setState({pluginStatus:i.fI.parsed,pluginURL:i.fH.getPluginURL()}),i.fH.applyArabicShaping=Ie.applyArabicShaping,i.fH.processBidirectionalText=Ie.processBidirectionalText,i.fH.processStyledBidirectionalText=Ie.processStyledBidirectionalText;for(const Ge of this.rtlPluginParsingListeners)Ge(null,!0);this.rtlPluginParsingListeners=[]}}clearCaches(xe,Ie,Ge){delete this.layerIndexes[xe],delete this.availableImages[xe],delete this.availableModels[xe],delete this.workerSources[xe],Ge()}checkIfReady(xe,Ie,Ge){Ge()}setReferrer(xe,Ie){this.referrer=Ie}spriteLoaded(xe,Ie){this.isSpriteLoaded[xe]||(this.isSpriteLoaded[xe]={});const{scope:Ge,isLoaded:kt}=Ie;if(this.isSpriteLoaded[xe][Ge]=kt,this.workerSources[xe]&&this.workerSources[xe][Ge])for(const vt in this.workerSources[xe][Ge]){const At=this.workerSources[xe][Ge][vt];for(const zt in At){const Pt=At[zt];Pt instanceof H&&(Pt.isSpriteLoaded=kt,Pt.fire(new i.z("isSpriteLoaded")))}}}setImages(xe,Ie,Ge){this.availableImages[xe]||(this.availableImages[xe]={});const{scope:kt,images:vt}=Ie;if(this.availableImages[xe][kt]=vt,this.workerSources[xe]&&this.workerSources[xe][kt]){for(const At in this.workerSources[xe][kt]){const zt=this.workerSources[xe][kt][At];for(const Pt in zt)zt[Pt].availableImages=vt}Ge()}else Ge()}setModels(xe,{scope:Ie,models:Ge},kt){if(this.availableModels[xe]||(this.availableModels[xe]={}),this.availableModels[xe][Ie]=Ge,this.workerSources[xe]&&this.workerSources[xe][Ie]){for(const vt in this.workerSources[xe][Ie]){const At=this.workerSources[xe][Ie][vt];for(const zt in At)At[zt].availableModels=Ge}kt()}else kt()}setProjection(xe,Ie){this.projections[xe]=i.cm(Ie)}setBrightness(xe,Ie,Ge){this.brightness=Ie,Ge()}setWorldview(xe,Ie,Ge){this.worldview=Ie,Ge()}setLayers(xe,Ie,Ge){this.getLayerIndex(xe,Ie.scope).replace(Ie.layers,Ie.options),Ge()}updateLayers(xe,Ie,Ge){this.getLayerIndex(xe,Ie.scope).update(Ie.layers,Ie.removedIds,Ie.options),Ge()}loadTile(xe,Ie,Ge){Ie.projection=this.projections[xe]||this.defaultProjection,this.getWorkerSource(xe,Ie.type,Ie.source,Ie.scope).loadTile(Ie,Ge)}decodeRasterArray(xe,Ie,Ge){this.getWorkerSource(xe,Ie.type,Ie.source,Ie.scope).decodeRasterArray(Ie,Ge)}reloadTile(xe,Ie,Ge){Ie.projection=this.projections[xe]||this.defaultProjection,this.getWorkerSource(xe,Ie.type,Ie.source,Ie.scope).reloadTile(Ie,Ge)}abortTile(xe,Ie,Ge){this.getWorkerSource(xe,Ie.type,Ie.source,Ie.scope).abortTile(Ie,Ge)}removeTile(xe,Ie,Ge){this.getWorkerSource(xe,Ie.type,Ie.source,Ie.scope).removeTile(Ie,Ge)}removeSource(xe,Ie,Ge){if(!(this.workerSources[xe]&&this.workerSources[xe][Ie.scope]&&this.workerSources[xe][Ie.scope][Ie.type]&&this.workerSources[xe][Ie.scope][Ie.type][Ie.source]))return;const kt=this.workerSources[xe][Ie.scope][Ie.type][Ie.source];delete this.workerSources[xe][Ie.scope][Ie.type][Ie.source],kt.removeSource!==void 0?kt.removeSource(Ie,Ge):Ge()}loadWorkerSource(xe,Ie,Ge){try{this.self.importScripts(Ie.url),Ge()}catch(kt){Ge(kt)}}syncRTLPluginState(xe,Ie,Ge){if(i.fH.isParsed())Ge(null,!0);else if(i.fH.isParsing())this.rtlPluginParsingListeners.push(Ge);else try{i.fH.setState(Ie);const kt=i.fH.getPluginURL();!i.fH.isLoaded()||i.fH.isParsed()||i.fH.isParsing()||kt==null||(i.fH.setState({pluginStatus:i.fI.parsing,pluginURL:i.fH.getPluginURL()}),this.self.importScripts(kt),i.fH.isParsed()?Ge(null,!0):this.rtlPluginParsingListeners.push(Ge))}catch(kt){Ge(kt)}}setDracoUrl(xe,Ie){this.dracoUrl=Ie}getAvailableImages(xe,Ie){this.availableImages[xe]||(this.availableImages[xe]={});let Ge=this.availableImages[xe][Ie];return Ge||(Ge=[]),Ge}getAvailableModels(xe,Ie){this.availableModels[xe]||(this.availableModels[xe]={});let Ge=this.availableModels[xe][Ie];return Ge||(Ge={}),Ge}getLayerIndex(xe,Ie){this.layerIndexes[xe]||(this.layerIndexes[xe]={});let Ge=this.layerIndexes[xe][Ie];return Ge||(Ge=this.layerIndexes[xe][Ie]=new y,Ge.scope=Ie),Ge}getWorkerSource(xe,Ie,Ge,kt){const vt=this.workerSources;return vt[xe]||(vt[xe]={}),vt[xe][kt]||(vt[xe][kt]={}),vt[xe][kt][Ie]||(vt[xe][kt][Ie]={}),this.isSpriteLoaded[xe]||(this.isSpriteLoaded[xe]={}),vt[xe][kt][Ie][Ge]||(vt[xe][kt][Ie][Ge]=new this.workerSourceTypes[Ie]({send:(At,zt,Pt,Ut,fr,ar)=>this.actor.send(At,zt,Pt,xe,fr,ar),scheduler:this.actor.scheduler},this.getLayerIndex(xe,kt),this.getAvailableImages(xe,kt),this.getAvailableModels(xe,kt),this.isSpriteLoaded[xe][kt],void 0,this.brightness,this.worldview)),vt[xe][kt][Ie][Ge]}rasterizeImagesWorker(xe,Ie,Ge){const kt=new Map;for(const[vt,{image:At,imageVariant:zt}]of Ie.tasks.entries()){const Pt=this.imageRasterizer.rasterize(zt,At,Ie.scope,xe);kt.set(vt,Pt)}Ge(void 0,kt)}removeRasterizedImages(xe,Ie,Ge){this.imageRasterizer.removeImagesFromCacheByIds(Ie.imageIds,Ie.scope,xe),Ge()}enforceCacheSizeLimit(xe,Ie){i.fJ(Ie)}getWorkerPerformanceMetrics(xe,Ie,Ge){Ge(void 0,void 0)}}return i.fF(self)&&(self.worker=new mu(self)),mu}),o(["./shared"],function(i){var h="3.17.0";const p={create:"create",load:"load",fullLoad:"fullLoad"},x={mark(_){performance.mark(_)},measure(_,d,m){performance.measure(_,d,m)}};function y(_){const d=_.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 b,j={},C=function(){if(b)return j;function _(w){return!d(w)}function d(w){return typeof window>"u"||typeof document>"u"?"not a browser":function(){if(!("Worker"in window&&"Blob"in window&&"URL"in window))return!1;var O,D,B=new Blob([""],{type:"text/javascript"}),V=URL.createObjectURL(B);try{D=new Worker(V),O=!0}catch{O=!1}return D&&D.terminate(),URL.revokeObjectURL(V),O}()?function(){var O=document.createElement("canvas");O.width=O.height=1;var D=O.getContext("2d");if(!D)return!1;var B=D.getImageData(0,0,1,1);return B&&B.width===O.width}()?(m[M=w&&w.failIfMajorPerformanceCaveat]===void 0&&(m[M]=function(O){var D,B=function(V){var Y=document.createElement("canvas"),Q=Object.create(_.webGLContextAttributes);return Q.failIfMajorPerformanceCaveat=V,Y.getContext("webgl2",Q)}(O);if(!B)return!1;try{D=B.createShader(B.VERTEX_SHADER)}catch{return!1}return!(!D||B.isContextLost())&&(B.shaderSource(D,"void main() {}"),B.compileShader(D),B.getShaderParameter(D,B.COMPILE_STATUS)===!0)}(M)),m[M]?document.documentMode?"insufficient ECMAScript 6 support":void 0:"insufficient WebGL2 support"):"insufficient Canvas/getImageData support":"insufficient worker support";var M}b=1,j.supported=_,j.notSupportedReason=d;var m={};return _.webGLContextAttributes={antialias:!1,alpha:!0,stencil:!0,depth:!0},j}();function N(_,d,m){const w=document.createElement(_);return d!=null&&(w.className=d),m&&m.appendChild(w),w}function A(_,d,m){const w=document.createElementNS("http://www.w3.org/2000/svg",_);for(const M of Object.keys(d))w.setAttributeNS(null,M,String(d[M]));return m&&m.appendChild(w),w}const E=typeof document<"u"?document.documentElement&&document.documentElement.style:null,T=E&&E.userSelect!==void 0?"userSelect":"WebkitUserSelect";let L;function z(){E&&T&&(L=E[T],E[T]="none")}function F(){E&&T&&(E[T]=L)}function q(_){_.preventDefault(),_.stopPropagation(),window.removeEventListener("click",q,!0)}function H(){window.addEventListener("click",q,!0),window.setTimeout(()=>{window.removeEventListener("click",q,!0)},0)}function Z(_,d){const m=_.getBoundingClientRect();return ie(_,m,d)}function G(_,d){const m=_.getBoundingClientRect(),w=[];for(let M=0;Mthis._skuTokenExpiresAt}transformRequest(d,m){return this._transformRequestFn&&this._transformRequestFn(d,m)||{url:d}}normalizeStyleURL(d,m){if(!i.h(d))return d;const w=ae(d);return w.params.push(`sdk=js-${h}`),w.path=`/styles/v1${w.path}`,this._makeAPIURL(w,this._customAccessToken||m)}normalizeGlyphsURL(d,m){if(!i.h(d))return d;const w=ae(d);return w.path=`/fonts/v1${w.path}`,this._makeAPIURL(w,this._customAccessToken||m)}normalizeModelURL(d,m){if(!i.h(d))return d;const w=ae(d);return w.path=`/models/v1${w.path}`,this._makeAPIURL(w,this._customAccessToken||m)}normalizeSourceURL(d,m,w,M){if(!i.h(d))return d;const O=ae(d);return O.path=`/v4/${O.authority}.json`,O.params.push("secure"),w&&O.params.push(`language=${w}`),M&&O.params.push(`worldview=${M}`),this._makeAPIURL(O,this._customAccessToken||m)}normalizeIconsetURL(d,m){const w=ae(d);return i.h(d)?(w.path=`/styles/v1${w.path}/iconset.pbf`,this._makeAPIURL(w,this._customAccessToken||m)):he(w)}normalizeSpriteURL(d,m,w,M){const O=ae(d);return i.h(d)?(O.path=`/styles/v1${O.path}/sprite${m}${w}`,this._makeAPIURL(O,this._customAccessToken||M)):(O.path+=`${m}${w}`,he(O))}normalizeTileURL(d,m,w){if(this._isSkuTokenExpired()&&this._createSkuToken(),d&&!i.h(d))return d;const M=ae(d);M.path=M.path.replace(/(\.(png|jpg)\d*)(?=$)/,`${m||w&&M.authority!=="raster"&&w===512?"@2x":""}${i.k.supported?".webp":"$1"}`),M.authority==="raster"?M.path=`/${i.e.RASTER_URL_PREFIX}${M.path}`:M.authority==="rasterarrays"?M.path=`/${i.e.RASTERARRAYS_URL_PREFIX}${M.path}`:M.authority==="3dtiles"?M.path=`/${i.e.TILES3D_URL_PREFIX}${M.path}`:(M.path=M.path.replace(/^.+\/v4\//,"/"),M.path=`/${i.e.TILE_URL_VERSION}${M.path}`);const O=this._customAccessToken||function(D){for(const B of D){const V=B.match(/^access_token=(.*)$/);if(V)return V[1]}return null}(M.params)||i.e.ACCESS_TOKEN;return i.e.REQUIRE_ACCESS_TOKEN&&O&&this._skuToken&&M.params.push(`sku=${this._skuToken}`),this._makeAPIURL(M,O)}canonicalizeTileURL(d,m){const w=ae(d);if(!w.path.match(/^(\/v4\/|\/(raster|rasterarrays)\/v1\/)/)||!w.path.match(/\.[\w]+$/))return d;let M="mapbox://";w.path.match(/^\/raster\/v1\//)?M+=`raster/${w.path.replace(`/${i.e.RASTER_URL_PREFIX}/`,"")}`:w.path.match(/^\/rasterarrays\/v1\//)?M+=`rasterarrays/${w.path.replace(`/${i.e.RASTERARRAYS_URL_PREFIX}/`,"")}`:M+=`tiles/${w.path.replace(`/${i.e.TILE_URL_VERSION}/`,"")}`;let O=w.params;return m&&(O=O.filter(D=>!D.match(/^access_token=/))),O.length&&(M+=`?${O.join("&")}`),M}canonicalizeTileset(d,m){const w=!!m&&i.h(m),M=[];for(const O of d.tiles||[])i.j(O)?M.push(this.canonicalizeTileURL(O,w)):M.push(O);return M}_makeAPIURL(d,m){const w="See https://docs.mapbox.com/api/overview/#access-tokens-and-token-scopes",M=ae(i.e.API_URL);if(d.protocol=M.protocol,d.authority=M.authority,d.protocol==="http"){const O=d.params.indexOf("secure");O>=0&&d.params.splice(O,1)}if(M.path!=="/"&&(d.path=`${M.path}${d.path}`),!i.e.REQUIRE_ACCESS_TOKEN)return he(d);if(m=m||i.e.ACCESS_TOKEN,!this._silenceAuthErrors){if(!m)throw new Error(`An API access token is required to use Mapbox GL. ${w}`);if(m[0]==="s")throw new Error(`Use a public access token (pk.*) with Mapbox GL, not a secret access token (sk.*). ${w}`)}return d.params=d.params.filter(O=>O.indexOf("access_token")===-1),d.params.push(`access_token=${m||""}`),he(d)}}const ge=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function ae(_){const d=_.match(ge);if(!d)throw new Error("Unable to parse URL object");return{protocol:d[1],authority:d[2],path:d[3]||"/",params:d[4]?d[4].split("&"):[]}}function he(_){const d=_.params.length?`?${_.params.join("&")}`:"";return`${_.protocol}://${_.authority}${_.path}${d}`}const ue="mapbox.eventData";function _e(_){if(!_)return null;const d=_.split(".");if(!d||d.length!==3)return null;try{return JSON.parse(i.l(d[1]))}catch{return null}}class Ae{constructor(d){this.type=d,this.anonId=null,this.anonIdTimestamp=null,this.eventData={},this.queue=[],this.pendingRequest=null}getStorageKey(d){const m=_e(i.e.ACCESS_TOKEN);let w="";return w=m&&m.u?i.f(m.u):i.e.ACCESS_TOKEN||"",d?`${ue}.${d}:${w}`:`${ue}:${w}`}fetchEventData(){const d=i.s("localStorage"),m=this.getStorageKey(),w=this.getStorageKey("uuid"),M=this.getStorageKey("uuidTimestamp");if(d)try{const O=localStorage.getItem(m);O&&(this.eventData=JSON.parse(O));const D=localStorage.getItem(w);D&&(this.anonId=D);const B=localStorage.getItem(M);B&&(this.anonIdTimestamp=Number(B));const V=Date.now()-864e5;(!this.anonIdTimestamp||this.anonIdTimestamp=1&&localStorage.setItem(m,JSON.stringify(this.eventData)),D&&localStorage.setItem(M,D.toString())}catch{i.w("Unable to write to LocalStorage")}}processRequests(d){}postEvent(d,m,w,M){if(!i.e.EVENTS_URL)return;const O=ae(i.e.EVENTS_URL);O.params.push(`access_token=${M||i.e.ACCESS_TOKEN||""}`);const D={event:this.type,created:new Date(d).toISOString()},B=m?Object.assign(D,m):D,V={url:he(O),headers:{"Content-Type":"text/plain"},body:JSON.stringify([B])};this.pendingRequest=i.p(V,Y=>{this.pendingRequest=null,w(Y),this.saveEventData(),this.processRequests(M)})}queueRequest(d,m){this.queue.push(d),this.processRequests(m)}}class Ce extends Ae{constructor(d){super("metrics"),d&&(this.data=d)}postMetricsEvent(d){if(!i.e.EVENTS_URL||!d&&!i.e.ACCESS_TOKEN)return;this.anonId||this.fetchEventData(),i.v(this.anonId)||this.refreshUUID();const m=Object.assign({},this.data,{sessionId:this.anonId});this.queueRequest({timestamp:Date.now(),payload:m},d)}processRequests(d){if(this.pendingRequest||this.queue.length===0)return;const{timestamp:m,payload:w}=this.queue.shift();this.postEvent(m,w,()=>{},d)}}const be=new class extends Ae{constructor(_){super("appUserTurnstile"),this._customAccessToken=_}postTurnstileEvent(_,d){i.e.EVENTS_URL&&i.e.ACCESS_TOKEN&&Array.isArray(_)&&_.some(m=>i.h(m)||i.j(m))&&this.queueRequest(Date.now(),d)}processRequests(_){if(this.pendingRequest||this.queue.length===0)return;this.anonId&&this.anonIdTimestamp&&this.eventData.lastSuccess&&this.eventData.tokenU||this.fetchEventData();const d=_e(i.e.ACCESS_TOKEN),m=d?d.u:i.e.ACCESS_TOKEN;let w=m!==this.eventData.tokenU;i.v(this.anonId)||(this.refreshUUID(),w=!0);const M=this.queue.shift();if(this.eventData.lastSuccess){const O=new Date(this.eventData.lastSuccess),D=new Date(M),B=(M-this.eventData.lastSuccess)/864e5;w=w||B>=1||B<-1||O.getDate()!==D.getDate()}else w=!0;w?this.postEvent(M,{sdkIdentifier:"mapbox-gl-js",sdkVersion:h,skuId:le,"enabled.telemetry":!1,userId:this.anonId},O=>{O||(this.eventData.lastSuccess=M,this.eventData.tokenU=m)},_):this.processRequests()}},me=be.postTurnstileEvent.bind(be),Le=new class extends Ae{constructor(){super("map.load"),this.success={},this.skuToken=""}postMapLoadEvent(_,d,m,w){this.skuToken=d,this.errorCb=w,i.e.EVENTS_URL&&(m||i.e.ACCESS_TOKEN?this.queueRequest({id:_,timestamp:Date.now()},m):this.errorCb(new Error(ye)))}processRequests(_){if(this.pendingRequest||this.queue.length===0)return;const{id:d,timestamp:m}=this.queue.shift();d&&this.success[d]||(this.anonId&&this.anonIdTimestamp||this.fetchEventData(),i.v(this.anonId)||this.refreshUUID(),this.postEvent(m,{sdkIdentifier:"mapbox-gl-js",sdkVersion:h,skuId:le,skuToken:this.skuToken,userId:this.anonId},w=>{w?this.errorCb(w):d&&(this.success[d]=!0)},_))}remove(){this.errorCb=null}},Ne=Le.postMapLoadEvent.bind(Le),Be=new class extends Ae{constructor(){super("style.load"),this.eventIdPerMapInstanceMap=new Map,this.mapInstanceIdMap=new WeakMap}getMapInstanceId(_){let d=this.mapInstanceIdMap.get(_);return d||(d=i.u(),this.mapInstanceIdMap.set(_,d)),d}getEventId(_){const d=this.eventIdPerMapInstanceMap.get(_)||0;return this.eventIdPerMapInstanceMap.set(_,d+1),d}postStyleLoadEvent(_,d){const{map:m,style:w,importedStyles:M}=d;if(!i.e.EVENTS_URL||!_&&!i.e.ACCESS_TOKEN)return;const O=this.getMapInstanceId(m),D={mapInstanceId:O,eventId:this.getEventId(O),style:w};M.length&&(D.importedStyles=M),this.queueRequest({timestamp:Date.now(),payload:D},_)}processRequests(_){if(this.pendingRequest||this.queue.length===0)return;const{timestamp:d,payload:m}=this.queue.shift();this.postEvent(d,m,()=>{},_)}},Ee=Be.postStyleLoadEvent.bind(Be),Ue=new Ce({attributes:[{name:"maps/js/layer-animations/style-with-appearances"}]}),Re=Ue.postMetricsEvent.bind(Ue),je=new Ce({attributes:[{name:"maps/js/layer-animations/runtime-appearances"}]}),et=je.postMetricsEvent.bind(je),Te=new class extends Ae{constructor(){super("gljs.performance")}postPerformanceEvent(_,d){i.e.EVENTS_URL&&(_||i.e.ACCESS_TOKEN)&&this.queueRequest({timestamp:Date.now(),performanceData:d},_)}processRequests(_){if(this.pendingRequest||this.queue.length===0)return;const{timestamp:d,performanceData:m}=this.queue.shift(),w=function(M){const O=performance.getEntriesByType("resource"),D=performance.getEntriesByType("mark"),B=function(de){const we={};if(de){for(const ve in de)if(ve!=="other")for(const De of de[ve]){const Pe=`${ve}ResolveRangeMin`,Ve=`${ve}ResolveRangeMax`,Xe=`${ve}RequestCount`,We=`${ve}RequestCachedCount`;we[Pe]=Math.min(we[Pe]||1/0,De.startTime),we[Ve]=Math.max(we[Ve]||-1/0,De.responseEnd);const bt=ut=>{we[ut]===void 0&&(we[ut]=0),++we[ut]};De.transferSize!==void 0&&De.transferSize===0&&bt(We),bt(Xe)}}return we}(function(de,we){const ve={};if(de)for(const De of de){const Pe=we(De);ve[Pe]===void 0&&(ve[Pe]=[]),ve[Pe].push(De)}return ve}(O,y)),V=window.devicePixelRatio,Y=navigator.connection||navigator.mozConnection||navigator.webkitConnection,Q=Y?Y.effectiveType:void 0,ce={counters:[],metadata:[],attributes:[]},oe=(de,we,ve)=>{ve!=null&&de.push({name:we,value:ve.toString()})};for(const de in B)oe(ce.counters,de,B[de]);if(M.interactionRange[0]!==1/0&&M.interactionRange[1]!==-1/0&&(oe(ce.counters,"interactionRangeMin",M.interactionRange[0]),oe(ce.counters,"interactionRangeMax",M.interactionRange[1])),D)for(const de of Object.values(p)){const we=D.find(ve=>ve.name===de);we&&oe(ce.counters,de,we.startTime)}return oe(ce.counters,"visibilityHidden",M.visibilityHidden),oe(ce.attributes,"style",function(de){if(de)for(const we of de){const ve=we.name.split("?")[0];if(i.i(ve)){const De=ve.split("/").slice(-2);if(De.length===2)return`mapbox://styles/${De[0]}/${De[1]}`}}}(O)),oe(ce.attributes,"terrainEnabled",M.terrainEnabled?"true":"false"),oe(ce.attributes,"fogEnabled",M.fogEnabled?"true":"false"),oe(ce.attributes,"projection",M.projection),oe(ce.attributes,"zoom",M.zoom),oe(ce.metadata,"devicePixelRatio",V),oe(ce.metadata,"connectionEffectiveType",Q),oe(ce.metadata,"navigatorUserAgent",navigator.userAgent),oe(ce.metadata,"screenWidth",window.screen.width),oe(ce.metadata,"screenHeight",window.screen.height),oe(ce.metadata,"windowWidth",window.innerWidth),oe(ce.metadata,"windowHeight",window.innerHeight),oe(ce.metadata,"mapWidth",M.width/V),oe(ce.metadata,"mapHeight",M.height/V),oe(ce.metadata,"webglRenderer",M.renderer),oe(ce.metadata,"webglVendor",M.vendor),oe(ce.metadata,"sdkVersion",h),oe(ce.metadata,"sdkIdentifier","mapbox-gl-js"),ce}(m);for(const M of w.metadata);for(const M of w.counters);for(const M of w.attributes);this.postEvent(d,w,()=>{},_)}},Ze=Te.postPerformanceEvent.bind(Te),pe=new class extends Ae{constructor(){super("map.auth"),this.success={},this.skuToken=""}getSession(_,d,m,w){if(!i.e.API_URL||!i.e.SESSION_PATH)return;const M=ae(i.e.API_URL+i.e.SESSION_PATH);M.params.push(`sku=${d||""}`),M.params.push(`access_token=${w||i.e.ACCESS_TOKEN||""}`);const O={url:he(M),headers:{"Content-Type":"text/plain"}};this.pendingRequest=i.g(O,D=>{this.pendingRequest=null,m(D),this.saveEventData(),this.processRequests(w)})}getSessionAPI(_,d,m,w){this.skuToken=d,this.errorCb=w,i.e.SESSION_PATH&&i.e.API_URL&&(m||i.e.ACCESS_TOKEN?this.queueRequest({id:_,timestamp:Date.now()},m):this.errorCb(new Error(ye)))}processRequests(_){if(this.pendingRequest||this.queue.length===0)return;const{id:d,timestamp:m}=this.queue.shift();d&&this.success[d]||this.getSession(m,this.skuToken,w=>{w?this.errorCb(w):d&&(this.success[d]=!0)},_)}remove(){this.errorCb=null}},yt=pe.getSessionAPI.bind(pe),rt=new Set;function at(_,d){d?rt.add(_):rt.delete(_)}class Me{constructor(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSourceCaches={},this._updatedPaintProps=new Set,this._updatedImages={}}isDirty(){return this._changed}setDirty(){this._changed=!0}getUpdatedSourceCaches(){return this._updatedSourceCaches}updateSourceCache(d,m){this._updatedSourceCaches[d]=m,this.setDirty()}discardSourceCacheUpdate(d){delete this._updatedSourceCaches[d]}updateLayer(d){const m=d.scope;this._updatedLayers[m]=this._updatedLayers[m]||new Set,this._updatedLayers[m].add(d.id),this.setDirty()}removeLayer(d){const m=d.scope;this._removedLayers[m]=this._removedLayers[m]||{},this._updatedLayers[m]=this._updatedLayers[m]||new Set,this._removedLayers[m][d.id]=d,this._updatedLayers[m].delete(d.id),this._updatedPaintProps.delete(d.fqid),this.setDirty()}getRemovedLayer(d){return this._removedLayers[d.scope]?this._removedLayers[d.scope][d.id]:null}discardLayerRemoval(d){this._removedLayers[d.scope]&&delete this._removedLayers[d.scope][d.id]}getLayerUpdatesByScope(){const d={};for(const m in this._updatedLayers)d[m]=d[m]||{},d[m].updatedIds=Array.from(this._updatedLayers[m].values());for(const m in this._removedLayers)d[m]=d[m]||{},d[m].removedIds=Object.keys(this._removedLayers[m]);return d}getUpdatedPaintProperties(){return this._updatedPaintProps}updatePaintProperties(d){this._updatedPaintProps.add(d.fqid),this.setDirty()}getUpdatedImages(d){return this._updatedImages[d]?Array.from(this._updatedImages[d].values()):[]}updateImage(d,m){this._updatedImages[m]=this._updatedImages[m]||new Set,this._updatedImages[m].add(i.I.toString(d)),this.setDirty()}resetUpdatedImages(d){this._updatedImages[d]&&this._updatedImages[d].clear()}reset(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSourceCaches={},this._updatedPaintProps.clear(),this._updatedImages={}}}function ft(_){const{userImage:d}=_;return!!(d&&d.render&&d.render())&&(_.data.replace(new Uint8Array(d.data.buffer)),!0)}class qe extends i.E{constructor(d){super(),this.imageProviders=new Map,this.images=new Map,this.updatedImages=new Map,this.callbackDispatchedThisFrame=new Map,this.loaded=new Map,this.requestors=[],this.patterns=new Map,this.patternsInFlight=new Set,this.atlasImage=new Map,this.atlasTexture=new Map,this.dirty=!0,this.spriteFormat=d,d!=="raster"&&i.r()&&(this.imageRasterizerDispatcher=new i.D(i.t(),this,"Image Rasterizer Worker",1))}addScope(d){this.loaded.set(d,!1),this.imageProviders.set(d,new Map),this.images.set(d,new Map),this.updatedImages.set(d,new Set),this.callbackDispatchedThisFrame.set(d,new Set),this.patterns.set(d,new Map),this.atlasImage.set(d,new i.q({width:1,height:1}))}removeScope(d){this.loaded.delete(d),this.imageProviders.delete(d),this.images.delete(d),this.updatedImages.delete(d),this.callbackDispatchedThisFrame.delete(d),this.patterns.delete(d),this.atlasImage.delete(d);const m=this.atlasTexture.get(d);m&&(m.destroy(),this.atlasTexture.delete(d))}addImageProvider(d,m){this.imageProviders.has(m)||this.imageProviders.set(m,new Map),this.imageProviders.get(m).set(d.id,d)}removeImageProvider(d,m){this.imageProviders.has(m)&&this.imageProviders.get(m).delete(d)}getPendingImageProviders(){const d=[];for(const m of this.imageProviders.values())for(const w of m.values())w.hasPendingRequests()&&d.push(w);return d}get imageRasterizer(){return this._imageRasterizer||(this._imageRasterizer=new i.x),this._imageRasterizer}isLoaded(){for(const d of this.loaded.keys())if(!this.loaded.get(d))return!1;return!0}setLoaded(d,m){if(this.loaded.get(m)!==d&&(this.loaded.set(m,d),d)){for(const{ids:w,callback:M}of this.requestors)this._notify(w,m,M);this.requestors=[]}}hasImage(d,m){return!!this.getImage(d,m)}getImage(d,m){return this.images.get(m).get(d.toString())}addImage(d,m,w){this._validate(d,w)&&this.images.get(m).set(d.toString(),w)}_validate(d,m){let w=!0;return this._validateStretch(m.stretchX,m.data&&m.data.width)||(this.fire(new i.y(new Error(`Image "${d.name}" has invalid "stretchX" value`))),w=!1),this._validateStretch(m.stretchY,m.data&&m.data.height)||(this.fire(new i.y(new Error(`Image "${d.name}" has invalid "stretchY" value`))),w=!1),this._validateContent(m.content,m)||(this.fire(new i.y(new Error(`Image "${d.name}" has invalid "content" value`))),w=!1),w}_validateStretch(d,m){if(!d)return!0;let w=0;for(const M of d){if(M[0]i.I.from(m))}getImages(d,m,w){const M=[],O=[],D=this.imageProviders.get(m);for(const Q of d){if(!Q.iconsetId){M.push(Q);continue}const ce=D.get(Q.iconsetId);ce&&(this.getImage(Q,m)?O.push(Q):ce.addPendingRequest(Q))}if(M.length===0)return void this._notify(O,m,w);let B=!0;const V=!!this.loaded.get(m),Y=this.images.get(m);if(!V)for(const Q of M)Y.has(Q.toString())||(B=!1);V||B?this._notify(M,m,w):this.requestors.push({ids:M,scope:m,callback:w})}rasterizeImages(d,m){const w=new Map,{tasks:M,scope:O}=d;for(const[D,B]of M.entries()){const V=this.getImage(B.id,O);V&&w.set(D,{image:V,imageVariant:B})}this._rasterizeImages(O,w,m)}_rasterizeImages(d,m,w){if(i.r())this.imageRasterizerDispatcher.getActor().send("rasterizeImagesWorker",{tasks:m,scope:d},w);else{const M=new Map;for(const[O,{image:D,imageVariant:B}]of m.entries())M.set(O,this.imageRasterizer.rasterize(B,D,d,0));w(void 0,M)}}getUpdatedImages(d){return this.updatedImages.get(d)||new Set}_notify(d,m,w){const M=this.images.get(m),O=new Map;for(const D of d){if(!M.get(D.toString())){if(D.iconsetId)continue;this.fire(new i.z("styleimagemissing",{id:D.name}))}const B=M.get(D.toString());if(!B){i.w(`Image "${D.name}" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.`);continue}const V={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(V,{width:B.icon.usvg_tree.width,height:B.icon.usvg_tree.height}),O.set(i.I.toString(D),V)}w(null,O)}getPixelSize(d){const{width:m,height:w}=this.atlasImage.get(d);return{width:m,height:w}}getPattern(d,m,w){const M=d.toString(),O=this.patterns.get(m),D=O.get(M),B=this.getImage(d,m);if(!B)return null;if(D){if(D.position.version===B.version)return D.position;D.position.version=B.version}else{if(B.usvg&&!B.data){const V=this.getPatternInFlightId(M,m);if(this.patternsInFlight.has(V))return null;this.patternsInFlight.add(V);const Y=new i.A(d).scaleSelf(i.o.devicePixelRatio),Q=new Map([[Y.toString(),{image:B,imageVariant:Y}]]);return this._rasterizeImages(m,Q,(ce,oe)=>this.storePatternImage(Y,m,B,w,oe)),null}this.storePattern(d,m,B)}return this._updatePatternAtlas(m,w),O.get(M).position}getPatternInFlightId(d,m){return i.B(d,m)}hasPatternsInFlight(){return this.patternsInFlight.size!==0}storePatternImage(d,m,w,M,O){const D=d.toString(),B=O?O.get(D):void 0;B&&(w.data=B,this.storePattern(d.id,m,w),this._updatePatternAtlas(m,M),this.patternsInFlight.delete(this.getPatternInFlightId(d.id.toString(),m)))}storePattern(d,m,w){const M={w:w.data.width+2*i.C,h:w.data.height+2*i.C,x:0,y:0},O=new i.F(M,w,i.C);this.patterns.get(m).set(d.toString(),{bin:M,position:O})}destroyAtlasTextures(){for(const d of this.atlasTexture.values())d&&d.destroy();this.atlasTexture.clear()}bind(d,m){const w=d.gl;let M=this.atlasTexture.get(m);M?this.dirty&&(M.update(this.atlasImage.get(m)),this.dirty=!1):(M=new i.T(d,this.atlasImage.get(m),w.RGBA8),this.atlasTexture.set(m,M)),M.bind(w.LINEAR,w.CLAMP_TO_EDGE)}_updatePatternAtlas(d,m){const w=this.patterns.get(d),M=Array.from(w.values()).map(({bin:Y})=>Y),{w:O,h:D}=i.G(M),B=this.atlasImage.get(d);B.resize({width:O||1,height:D||1});const V=this.images.get(d);for(const[Y,{bin:Q,position:ce}]of w.entries()){let oe=ce.padding;const de=Q.x+oe,we=Q.y+oe,ve=V.get(Y).data,De=ve.width,Pe=ve.height;oe=oe>1?oe-1:oe,i.q.copy(ve,B,{x:0,y:0},{x:de,y:we},{width:De,height:Pe},m),i.q.copy(ve,B,{x:0,y:Pe-oe},{x:de,y:we-oe},{width:De,height:oe},m),i.q.copy(ve,B,{x:0,y:0},{x:de,y:we+Pe},{width:De,height:oe},m),i.q.copy(ve,B,{x:De-oe,y:0},{x:de-oe,y:we},{width:oe,height:Pe},m),i.q.copy(ve,B,{x:0,y:0},{x:de+De,y:we},{width:oe,height:Pe},m),i.q.copy(ve,B,{x:De-oe,y:Pe-oe},{x:de-oe,y:we-oe},{width:oe,height:oe},m),i.q.copy(ve,B,{x:0,y:Pe-oe},{x:de+De,y:we-oe},{width:oe,height:oe},m),i.q.copy(ve,B,{x:0,y:0},{x:de+De,y:we+Pe},{width:oe,height:oe},m),i.q.copy(ve,B,{x:De-oe,y:0},{x:de-oe,y:we+Pe},{width:oe,height:oe},m)}this.dirty=!0}beginFrame(){for(const d of this.images.keys())this.callbackDispatchedThisFrame.set(d,new Set)}dispatchRenderCallbacks(d,m){const w=this.images.get(m);for(const M of d){if(this.callbackDispatchedThisFrame.get(m).has(M.toString()))continue;this.callbackDispatchedThisFrame.get(m).add(M.toString());const O=w.get(M.toString());ft(O)&&this.updateImage(M,m,O)}}destroy(){this.imageRasterizerDispatcher&&this.imageRasterizerDispatcher.remove()}}function Oe(_){const d=_.value,m=_.valueSpec,w=_.style,M=_.styleSpec,O=_.key,D=_.arrayElementValidator||Hs;if(!Array.isArray(d))return[new i.V(O,d,`array expected, ${i.K(d)} found`)];if(m.length&&d.length!==m.length)return[new i.V(O,d,`array length ${m.length} expected, length ${d.length} found`)];if(m["min-length"]&&d.lengthM)return[new i.V(d,m,`${m} is greater than the maximum value ${M}`)]}return[]}function nt(_){const d=_.key,m=_.value;if(!i.H(m))return[new i.V(d,m,`object expected, ${i.K(m)} found`)];const w=_.valueSpec,M=i.J(m.type);let O,D,B,V={};const Y=M!=="categorical"&&m.property===void 0,Q=!Y,ce=function(ve){const De=ve.stops;return Array.isArray(De)&&Array.isArray(De[0])&&i.H(De[0][0])}(m),oe=Xa({key:_.key,value:_.value,valueSpec:_.styleSpec.function,style:_.style,styleSpec:_.styleSpec,objectElementValidators:{stops:function(ve){if(M==="identity")return[new i.V(ve.key,ve.value,'identity function may not have a "stops" property')];let De=[];const Pe=ve.value;return De=De.concat(Oe({key:ve.key,value:Pe,valueSpec:ve.valueSpec,style:ve.style,styleSpec:ve.styleSpec,arrayElementValidator:de})),Array.isArray(Pe)&&Pe.length===0&&De.push(new i.V(ve.key,Pe,"array must have at least one stop")),De},default:function(ve){return Hs({key:ve.key,value:ve.value,valueSpec:w,style:ve.style,styleSpec:ve.styleSpec})}}});return M==="identity"&&Y&&oe.push(new i.V(_.key,_.value,'missing required property "property"')),M==="identity"||m.stops||oe.push(new i.V(_.key,_.value,'missing required property "stops"')),M==="exponential"&&w.expression&&!i.M(w)&&oe.push(new i.V(_.key,_.value,"exponential functions not supported")),_.styleSpec.$version>=8&&(Q&&!i.N(w)?oe.push(new i.V(_.key,_.value,"property functions not supported")):Y&&!i.O(w)&&oe.push(new i.V(_.key,_.value,"zoom functions not supported"))),M!=="categorical"&&!ce||m.property!==void 0||oe.push(new i.V(_.key,_.value,'"property" property is required')),oe;function de(ve){let De=[];const Pe=ve.value,Ve=ve.key;if(!Array.isArray(Pe))return[new i.V(Ve,Pe,`array expected, ${i.K(Pe)} found`)];if(Pe.length!==2)return[new i.V(Ve,Pe,`array length 2 expected, length ${Pe.length} found`)];if(ce){if(!i.H(Pe[0]))return[new i.V(Ve,Pe,`object expected, ${i.K(Pe[0])} found`)];const Xe=Pe[0];if(Xe.zoom===void 0)return[new i.V(Ve,Pe,"object stop key must have zoom")];if(Xe.value===void 0)return[new i.V(Ve,Pe,"object stop key must have value")];const We=i.J(Xe.zoom);if(typeof We!="number")return[new i.V(Ve,Xe.zoom,"stop zoom values must be numbers")];if(B&&B>We)return[new i.V(Ve,Xe.zoom,"stop zoom values must appear in ascending order")];We!==B&&(B=We,D=void 0,V={}),De=De.concat(Xa({key:`${Ve}[0]`,value:Pe[0],valueSpec:{zoom:{}},style:ve.style,styleSpec:ve.styleSpec,objectElementValidators:{zoom:Qe,value:we}}))}else De=De.concat(we({key:`${Ve}[0]`,value:Pe[0],style:ve.style,styleSpec:ve.styleSpec},Pe));return i.Q(i.S(Pe[1]))?De.concat([new i.V(`${Ve}[1]`,Pe[1],"expressions are not allowed in function stops.")]):De.concat(Hs({key:`${Ve}[1]`,value:Pe[1],valueSpec:w,style:ve.style,styleSpec:ve.styleSpec}))}function we(ve,De){const Pe=i.K(ve.value),Ve=i.J(ve.value),Xe=ve.value!==null?ve.value:De;if(O){if(Pe!==O)return[new i.V(ve.key,Xe,`${Pe} stop domain type must match previous stop domain type ${O}`)]}else O=Pe;if(Pe!=="number"&&Pe!=="string"&&Pe!=="boolean"&&typeof Ve!="number"&&typeof Ve!="string"&&typeof Ve!="boolean")return[new i.V(ve.key,Xe,"stop domain value must be a number, string, or boolean")];if(Pe!=="number"&&M!=="categorical"){let We=`number expected, ${Pe} found`;return i.N(w)&&M===void 0&&(We+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new i.V(ve.key,Xe,We)]}return M!=="categorical"||Pe!=="number"||typeof Ve=="number"&&isFinite(Ve)&&Math.floor(Ve)===Ve?M!=="categorical"&&Pe==="number"&&typeof Ve=="number"&&typeof D=="number"&&D!==void 0&&Venew i.V(`${_.key}${w.key}`,_.value,w.message));const m=d.value.expression||d.value._styleExpression.expression;if(_.expressionContext==="property"&&_.propertyKey==="text-font"&&!m.outputDefined())return[new i.V(_.key,_.value,`Invalid data expression for "${_.propertyKey}". Output values must be contained as literals within the expression.`)];if(_.expressionContext==="property"&&_.propertyType==="layout"&&!i.Z(m))return[new i.V(_.key,_.value,'"feature-state" data expressions are not supported with layout properties.')];if(_.expressionContext==="filter")return mt(m,_);if(_.expressionContext==="appearance")return Mt(m,_);if(_.expressionContext&&_.expressionContext.indexOf("cluster")===0){if(!i.X(m,["zoom","feature-state"]))return[new i.V(_.key,_.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(_.expressionContext==="cluster-initial"&&!i.Y(m))return[new i.V(_.key,_.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function mt(_,d){const m=new Set(["zoom","feature-state","pitch","distance-from-center"]);if(d.valueSpec&&d.valueSpec.expression)for(const M of d.valueSpec.expression.parameters)m.delete(M);if(m.size===0)return[];const w=[];return _ instanceof i._&&m.has(_.name)?[new i.V(d.key,d.value,`["${_.name}"] expression is not supported in a filter for a ${d.object.type} layer with id: ${d.object.id}`)]:(_.eachChild(M=>{w.push(...mt(M,d))}),w)}function Mt(_,d){const m=new Set;if(d.valueSpec&&d.valueSpec.expression)for(const M of d.valueSpec.expression.parameters)m.add(M);if(m.size===0)return[];const w=[];return _ instanceof i._&&!m.has(_.name)?[new i.V(d.key,d.value,`["${_.name}"] is not an allowed parameter`)]:(_.eachChild(M=>{w.push(...Mt(M,d))}),w)}function wt(_){const d=_.key,m=_.value,w=_.valueSpec,M=[];return Array.isArray(w.values)?w.values.indexOf(i.J(m))===-1&&M.push(new i.V(d,m,`expected one of [${w.values.join(", ")}], ${JSON.stringify(m)} found`)):Object.keys(w.values).indexOf(i.J(m))===-1&&M.push(new i.V(d,m,`expected one of [${Object.keys(w.values).join(", ")}], ${JSON.stringify(m)} found`)),M}function Qt(_){return i.a2(i.S(_.value))?gt(Object.assign({},_,{expressionContext:"filter",valueSpec:_.styleSpec[`filter_${_.layerType||"fill"}`]})):Cr(_)}function Cr(_){const d=_.value,m=_.key;if(!Array.isArray(d))return[new i.V(m,d,`array expected, ${i.K(d)} found`)];if(d.length<1)return[new i.V(m,d,"filter array must have at least 1 element")];const w=_.styleSpec;let M=wt({key:`${m}[0]`,value:d[0],valueSpec:w.filter_operator});const O=()=>{d.length>=2&&(i.a0(d[1])||M.push(new i.V(`${m}[1]`,d[1],`string expected, ${i.K(d[1])} found`)));for(let D=2;D":case">=":d.length>=2&&i.J(d[1])==="$type"&&M.push(new i.V(m,d,`"$type" cannot be use with operator "${d[0]}"`)),d.length!==3&&M.push(new i.V(m,d,`filter array for operator "${d[0]}" must have 3 elements`)),O();break;case"==":case"!=":d.length!==3&&M.push(new i.V(m,d,`filter array for operator "${d[0]}" must have 3 elements`)),O();break;case"in":case"!in":O();break;case"any":case"all":case"none":for(let D=1;D{Y in m&&d.push(new i.V(w,m[Y],`"${Y}" is prohibited for ref layers`))}),M.layers.forEach(Y=>{i.J(Y.id)===B&&(V=Y)}),V?V.ref?d.push(new i.V(w,m.ref,"ref cannot reference another ref layer")):D=i.J(V.type):typeof B=="string"&&d.push(new i.V(w,m.ref,`ref layer "${B}" not found`))}else if(D!=="background"&&D!=="sky"&&D!=="slot")if(m.source)if(i.a0(m.source)){const V=M.sources&&M.sources[m.source],Y=V&&i.J(V.type);V?Y==="vector"&&D==="raster"?d.push(new i.V(w,m.source,`layer "${m.id}" requires a raster source`)):Y==="raster"&&D!=="raster"?d.push(new i.V(w,m.source,`layer "${m.id}" requires a vector source`)):Y!=="vector"||m["source-layer"]?Y==="raster-dem"&&D!=="hillshade"?d.push(new i.V(w,m.source,"raster-dem source can only be used with layer type 'hillshade'.")):Y!=="raster-array"||["raster","raster-particle"].includes(D)?D==="line"&&m.paint&&(m.paint["line-gradient"]||m.paint["line-trim-offset"])&&Y==="geojson"&&!V.lineMetrics?d.push(new i.V(w,m,`layer "${m.id}" specifies a line-gradient, which requires the GeoJSON source to have \`lineMetrics\` enabled.`)):D==="raster-particle"&&Y!=="raster-array"&&d.push(new i.V(w,m.source,`layer "${m.id}" requires a 'raster-array' source.`)):d.push(new i.V(w,m.source,"raster-array source can only be used with layer type 'raster'.")):d.push(new i.V(w,m,`layer "${m.id}" must specify a "source-layer"`)):d.push(new i.V(w,m.source,`source "${m.source}" not found`))}else d.push(new i.V(`${w}.source`,m.source,'"source" must be a string'));else d.push(new i.V(w,m,'missing required property "source"'));return d=d.concat(Xa({key:w,value:m,valueSpec:O.layer,style:_.style,styleSpec:_.styleSpec,objectElementValidators:{"*":()=>[],type:()=>Hs({key:`${w}.type`,value:m.type,valueSpec:O.layer.type,style:_.style,styleSpec:_.styleSpec,object:m,objectKey:"type"}),filter:V=>Qt(Object.assign({layerType:D},V)),layout:V=>Xa({layer:m,key:V.key,value:V.value,valueSpec:{},style:V.style,styleSpec:V.styleSpec,objectElementValidators:{"*":Y=>Xr(Object.assign({layerType:D},Y))}}),paint:V=>Xa({layer:m,key:V.key,value:V.value,valueSpec:{},style:V.style,styleSpec:V.styleSpec,objectElementValidators:{"*":Y=>jn(Object.assign({layerType:D,layer:m},Y))}}),appearances(V){const Y=Oe({key:V.key,value:V.value,valueSpec:V.valueSpec,style:V.style,styleSpec:V.styleSpec,arrayElementValidator:oe=>function(de){const{key:we,layer:ve,layerType:De}=de,Pe=i.J(de.value),Ve=i.J(Pe.name),Xe=i.J(Pe.condition),We=Xa({key:we,value:Pe,valueSpec:de.styleSpec.appearance,style:de.style,styleSpec:de.styleSpec,objectElementValidators:{condition:bt=>function(ut){const xt=[];return xt.push(...gt({key:ut.key,value:ut.object.condition,valueSpec:i.a6.appearance.condition,expressionContext:"appearance"})),xt}(Object.assign({layer:ve,layerType:De},bt)),properties:bt=>function(ut){const xt=[],{styleSpec:ct,layer:it,layerType:St}=ut,Dt=ct[`paint_${St}`],Lt=ct[`layout_${St}`],Ht=ut.object[ut.objectKey];for(const Wt in Ht){const sr=Wt in Dt?"paint":Wt in Lt?"layout":void 0;if(!sr){xt.push(new i.V(ut.key,Wt,`unknown property "${Wt}" for layer type "${St}"`));continue}const _r=Object.assign({},ut,{key:`${ut.key}.${Wt}`,object:Ht,objectKey:Wt,layer:it,layerType:St,value:Ht[Wt],valueSpec:sr==="paint"?Dt[Wt]:Lt[Wt]});xt.push(...cn(_r,sr))}return xt}(Object.assign({layer:ve,layerType:De},bt))}});return Ve!=="hidden"&&Xe===void 0&&We.push(new i.V(de.key,"name",'Appearance with name different than "hidden" must have a condition')),We}(Object.assign({layerType:D,layer:m},oe))}),Q=Array.isArray(V.value)?V.value:[],ce=new Set;return Q.forEach((oe,de)=>{const we=i.J(oe.name);if(we)if(ce.has(we)){const ve=i.J(m.id);Y.push(new i.V(V.key,we,`Duplicated appearance name "${we}" for layer "${ve}"`))}else ce.add(we)}),Y}}})),d}function js({key:_,value:d}){return i.a0(d)?[]:[new i.V(_,d,`string expected, ${i.K(d)} found`)]}const hr={promoteId:function _({key:d,value:m}){if(i.a0(m))return js({key:d,value:m});if(Array.isArray(m)){const M=[],O=i.S(m),D=i.U(O);return D.result==="error"&&D.value.forEach(B=>{M.push(new i.V(`${d}${B.key}`,null,`${B.message}`))}),i.X(D.value.expression,["zoom","heatmap-density","line-progress","raster-value","sky-radial-progress","accumulated","is-supported-script","pitch","distance-from-center","measure-light","raster-particle-speed"])||M.push(new i.V(`${d}`,null,"promoteId expression should be only feature dependent")),M}if(!i.H(m))return[new i.V(d,m,`string, expression or object expected, "${i.K(m)}" found`)];const w=[];for(const M in m)w.push(..._({key:`${d}.${M}`,value:m[M]}));return w}};function xs(_){const d=_.value,m=_.key,w=_.styleSpec,M=_.style;if(!i.H(d))return[new i.V(m,d,`object expected, ${i.K(d)} found`)];if(!("type"in d))return[new i.V(m,d,'"type" is required')];const O=i.J(d.type);let D=[];switch(["vector","raster","raster-dem","raster-array"].includes(O)&&("url"in d||"tiles"in d||D.push(new i.a3(m,d,'Either "url" or "tiles" is required.'))),O){case"vector":case"raster":case"raster-dem":case"raster-array":return D=D.concat(Xa({key:m,value:d,valueSpec:w[`source_${O.replace("-","_")}`],style:_.style,styleSpec:w,objectElementValidators:hr})),D;case"geojson":if(D=Xa({key:m,value:d,valueSpec:w.source_geojson,style:M,styleSpec:w,objectElementValidators:hr}),"cluster"in d&&"clusterProperties"in d){if(!i.H(d.clusterProperties))return[new i.V(`${m}.clusterProperties`,d,`object expected, ${i.K(d)} found`)];for(const B in d.clusterProperties){const V=d.clusterProperties[B];if(!Array.isArray(V))return[new i.V(`${m}.clusterProperties.${B}`,V,"array expected")];const[Y,Q]=V,ce=typeof Y=="string"?[Y,["accumulated"],["get",B]]:Y;D.push(...gt({key:`${m}.${B}.map`,value:Q,expressionContext:"cluster-map"})),D.push(...gt({key:`${m}.${B}.reduce`,value:ce,expressionContext:"cluster-reduce"}))}}return D;case"video":return Xa({key:m,value:d,valueSpec:w.source_video,style:M,styleSpec:w});case"image":return Xa({key:m,value:d,valueSpec:w.source_image,style:M,styleSpec:w});case"canvas":return[new i.V(m,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return wt({key:`${m}.type`,value:d.type,valueSpec:{values:ka(w)}})}}function ka(_){return _.source.reduce((d,m)=>{const w=_[m];return w.type.type==="enum"&&(d=d.concat(Object.keys(w.type.values||{}))),d},[])}function xa(_){const d=_.value,m=_.styleSpec,w=m.light,M=_.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$/),V=D.match(/^(.*)-use-theme$/);O=O.concat(V&&w[V[1]]?Hs({key:D,value:d[D],valueSpec:{type:"string"},style:M,styleSpec:m}):B&&w[B[1]]&&w[B[1]].transition?Hs({key:D,value:d[D],valueSpec:m.transition,style:M,styleSpec:m}):w[D]?Hs({key:D,value:d[D],valueSpec:w[D],style:M,styleSpec:m}):[new i.V(D,d[D],`unknown property "${D}"`)])}return O}function zi(_){const d=_.value;if(!d)return[];const m=_.key;if(!i.H(d))return[new i.V(m,d,`object expected, ${i.K(d)} found`)];let w=[];const M=_.styleSpec,O=M["light-3d"],D=_.style,B=_.style.lights;for(const Q of["type","id"])if(!(Q in d))return w=w.concat([new i.V(m,d,`missing property "${Q}"`)]),w;if(!i.a0(d.type))return w=w.concat([new i.V(`${m}.type`,d.type,"string expected")]),w;if(B)for(let Q=0;Q<_.arrayIndex;Q++){const ce=i.J(d.type),oe=B[Q];i.J(oe.type)===ce&&w.push(new i.V(m,d.id,`duplicate light type "${d.type}", previously defined at line ${oe.id.__line__}`))}const V=`properties_light_${d.type}`;if(!(V in M))return w=w.concat([new i.V(`${m}.type`,d,`Invalid light type ${d.type}`)]),w;const Y=M[V];for(const Q in d)if(Q==="properties"){const ce=d[Q];if(!i.H(ce))return w=w.concat([new i.V("properties",ce,`object expected, ${i.K(ce)} found`)]),w;for(const oe in ce){const de=oe.match(/^(.*)-transition$/),we=oe.match(/^(.*)-use-theme$/);w=w.concat(we&&Y[we[1]]?Hs({key:Q,value:ce[oe],valueSpec:{type:"string"},style:D,styleSpec:M}):de&&Y[de[1]]&&Y[de[1]].transition?Hs({key:Q,value:d[Q],valueSpec:M.transition,style:D,styleSpec:M}):Y[oe]?Hs({key:oe,value:ce[oe],valueSpec:Y[oe],style:D,styleSpec:M}):[new i.a3(_.key,ce[oe],`unknown property "${oe}"`)])}}else w=w.concat(O[Q]?Hs({key:Q,value:d[Q],valueSpec:O[Q],style:D,styleSpec:M}):[new i.a3(Q,d[Q],`unknown property "${Q}"`)]);return w}function Bi(_){const d=_.value,m=_.key,w=_.style,M=_.styleSpec,O=M.terrain;if(d==null)return[];if(!i.H(d))return[new i.V("terrain",d,`object expected, ${i.K(d)} found`)];let D=[];for(const B in d){const V=B.match(/^(.*)-transition$/),Y=B.match(/^(.*)-use-theme$/);D=D.concat(Y&&O[Y[1]]?Hs({key:B,value:d[B],valueSpec:{type:"string"},style:w,styleSpec:M}):V&&O[V[1]]&&O[V[1]].transition?Hs({key:B,value:d[B],valueSpec:M.transition,style:w,styleSpec:M}):O[B]?Hs({key:B,value:d[B],valueSpec:O[B],style:w,styleSpec:M}):[new i.a3(B,d[B],`unknown property "${B}"`)])}if(d.source)if(i.a0(d.source)){const B=w.sources&&w.sources[d.source],V=B&&i.J(B.type);B?V!=="raster-dem"&&D.push(new i.V(`${m}.source`,d.source,`terrain cannot be used with a source of type ${V}, it only be used with a "raster-dem" source type`)):D.push(new i.V(`${m}.source`,d.source,`source "${d.source}" not found`))}else D.push(new i.V(`${m}.source`,d.source,"source must be a string"));else D.push(new i.V(m,d,'terrain is missing required property "source"'));return D}function tl(_){const d=_.value,m=_.style,w=_.styleSpec,M=w.fog;if(d===void 0)return[];if(!i.H(d))return[new i.V("fog",d,`object expected, ${i.K(d)} found`)];let O=[];for(const D in d){const B=D.match(/^(.*)-transition$/),V=D.match(/^(.*)-use-theme$/);O=O.concat(V&&M[V[1]]?Hs({key:D,value:d[D],valueSpec:{type:"string"},style:m,styleSpec:w}):B&&M[B[1]]&&M[B[1]].transition?Hs({key:D,value:d[D],valueSpec:w.transition,style:m,styleSpec:w}):M[D]?Hs({key:D,value:d[D],valueSpec:M[D],style:m,styleSpec:w}):[new i.a3(D,d[D],`unknown property "${D}"`)])}return O}const xo={"*":()=>[],array:Oe,boolean:function(_){const d=_.value,m=_.key;return i.$(d)?[]:[new i.V(m,d,`boolean expected, ${i.K(d)} found`)]},number:Qe,color:function({key:_,value:d}){return i.a0(d)?i.a1.parseCSSColor(d)===null?[new i.V(_,d,`color expected, "${d}" found`)]:[]:[new i.V(_,d,`color expected, ${i.K(d)} found`)]},enum:wt,filter:Qt,function:nt,layer:Pn,object:Xa,source:xs,model:i.a7,light:xa,"light-3d":zi,terrain:Bi,fog:tl,string:js,formatted:function(_){return js(_).length===0?[]:gt(_)},resolvedImage:function(_){return js(_).length===0?[]:gt(_)},projection:function(_){const d=_.value,m=_.styleSpec,w=m.projection,M=_.style;if(i.H(d)){let O=[];for(const D in d)O=O.concat(Hs({key:D,value:d[D],valueSpec:w[D],style:M,styleSpec:m}));return O}return i.a0(d)?[]:[new i.V("projection",d,`object or string expected, ${i.K(d)} found`)]},import:function(_){const d=_.key,{value:m,styleSpec:w}=_;if(!i.H(m))return[new i.V(d,m,"import must be an object")];const{data:M,...O}=m;Object.defineProperty(O,"__line__",{value:m.__line__,enumerable:!1});let D=Xa(Object.assign({},_,{value:O,valueSpec:w.import}));return i.J(O.id)===""&&D.push(new i.V(`${_.key}.id`,O,"import id can't be an empty string")),M&&(D=D.concat(Fa(M,w,{key:`${_.key}.data`}))),D},iconset:function(_){const d=_.value,m=_.key,w=_.styleSpec,M=_.style;if(!i.H(d))return[new i.V(m,d,"object expected")];if(!d.type)return[new i.V(m,d,'"type" is required')];const O=i.J(d.type);let D=[];if(D=D.concat(Xa({key:m,value:d,valueSpec:w[`iconset_${O}`],style:M,styleSpec:w})),function(B,V){return!(B!=="source"||!V.source)}(O,d)){const B=M.sources&&M.sources[d.source],V=B&&i.J(B.type);B?V!=="raster-array"&&D.push(new i.V(m,d.source,`iconset cannot be used with a source of type ${String(V)}, it only be used with a "raster-array" source type`)):D.push(new i.V(m,d.source,`source "${d.source}" not found`))}return D}};function Hs(_,d=!1){const m=_.value,w=_.valueSpec,M=_.styleSpec;if(w.expression){if(i.a4(i.J(m)))return nt(_);if(i.Q(i.S(m)))return gt(_)}if(w.type&&xo[w.type]){const O=xo[w.type](_);return d===!0&&O.length>0&&Array.isArray(_.value)?gt(_):O}return Xa(Object.assign({},_,{valueSpec:w.type?M[w.type]:w}))}function Xa(_){const d=_.key,m=_.value,w=_.valueSpec||{},M=_.objectElementValidators||{},O=_.style,D=_.styleSpec;if(!i.H(m))return[new i.V(d,m,`object expected, ${i.K(m)} found`)];let B=[];for(const V in m){const Y=V.split(".")[0];let Q;M[Y]?Q=M[Y]:w[Y]?Q=Hs:M["*"]?Q=M["*"]:w["*"]&&(Q=Hs),Q?B=B.concat(Q({key:(d&&`${d}.`)+V,value:m[V],valueSpec:w[Y]||w["*"],style:O,styleSpec:D,object:m,objectKey:V},m)):B.push(new i.a3(d,m[V],`unknown property "${V}"`))}for(const V in w){if(M[V])continue;const Y=w[V];Y.required&&Y.default===void 0&&m[V]===void 0&&B.push(new i.V(d,m,`missing required property "${V}"`))}return B}function Ns({key:_,value:d}){const m=js({key:_,value:d});if(m.length)return m;const w=d;return w.indexOf("{fontstack}")===-1&&m.push(new i.V(_,d,'"glyphs" url must include a "{fontstack}" token')),w.indexOf("{range}")===-1&&m.push(new i.V(_,d,'"glyphs" url must include a "{range}" token')),m}function Fa(_,d=i.a6,m={}){return Xa({key:m.key||"",value:_,valueSpec:Object.assign(d.$root,{"*":{type:"*"}}),styleSpec:d,style:_,objectElementValidators:{glyphs:Ns}})}function Oa(_,d=i.a6){return Ie(Fa(_,d))}const Do=_=>Ie(xs(_)),ir=_=>Ie(xa(_)),fo=_=>Ie(zi(_)),pl=_=>Ie(Bi(_)),To=_=>Ie(tl(_)),ss=_=>Ie(function(d){const m=d.value,w=d.style,M=d.styleSpec,O=M.snow;if(m===void 0)return[];if(!i.H(m))return[new i.V("snow",m,`object expected, ${i.K(m)} found`)];let D=[];for(const B in m){const V=B.match(/^(.*)-transition$/);D=D.concat(V&&O[V[1]]&&O[V[1]].transition?Hs({key:B,value:m[B],valueSpec:M.transition,style:w,styleSpec:M}):O[B]?Hs({key:B,value:m[B],valueSpec:O[B],style:w,styleSpec:M}):[new i.a3(B,m[B],`unknown property "${B}"`)])}return D}(_)),yo=_=>Ie(function(d){const m=d.value,w=d.style,M=d.styleSpec,O=M.rain;if(m===void 0)return[];if(!i.H(m))return[new i.V("rain",m,`object expected, ${i.K(m)} found`)];let D=[];for(const B in m){const V=B.match(/^(.*)-transition$/);D=D.concat(V&&O[V[1]]&&O[V[1]].transition?Hs({key:B,value:m[B],valueSpec:M.transition,style:w,styleSpec:M}):O[B]?Hs({key:B,value:m[B],valueSpec:O[B],style:w,styleSpec:M}):[new i.a3(B,m[B],`unknown property "${B}"`)])}return D}(_)),pu=_=>Ie(Pn(_)),$l=_=>Ie(Qt(_)),mu=_=>Ie(jn(_)),Je=_=>Ie(Xr(_)),xe=_=>Ie(i.a7(_));function Ie(_){return _.slice().sort((d,m)=>d.line&&m.line?d.line-m.line:0)}function Ge(_,d){let m=!1;if(d&&d.length)for(const w of d)w instanceof i.a3?i.w(w.message):(_.fire(new i.y(new Error(w.message))),m=!0);return m}const kt=i.a6.light;let vt;class At extends i.E{constructor(d,m="flat"){super(),this._transitionable=new i.a8(vt||(vt=new i.a9({anchor:new i.aa(kt.anchor),position:new i.ab(kt.position),color:new i.aa(kt.color),intensity:new i.aa(kt.intensity)}))),this.setLight(d,m),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(d,m,w={}){this._validate(ir,d,w)||(this._transitionable.setTransitionOrValue(d),this.id=m)}updateTransitions(d){this._transitioning=this._transitionable.transitioned(d,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(d){this.properties=this._transitioning.possiblyEvaluate(d)}_validate(d,m,w){return(!w||w.validate!==!1)&&Ge(this,d.call(Oa,Object.assign({value:m,style:{glyphs:!0,sprite:!0},styleSpec:i.a6})))}}const zt=i.a6.terrain;let Pt=class extends i.E{constructor(_,d,m,w,M){super(),this.scope=m,this._transitionable=new i.a8(new i.a9({source:new i.aa(zt.source),exaggeration:new i.aa(zt.exaggeration)}),m,w),this._transitionable.setTransitionOrValue(_,w),this._transitioning=this._transitionable.untransitioned(),this.drapeRenderMode=d,this.worldview=M}get(){return this._transitionable.serialize()}set(_,d){this._transitionable.setTransitionOrValue(_,d)}updateTransitions(_){this._transitioning=this._transitionable.transitioned(_,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(_){this.properties=this._transitioning.possiblyEvaluate(_)}getExaggeration(_){return this._transitioning.possiblyEvaluate(new i.ac(_,{worldview:this.worldview})).get("exaggeration")}getAttenuationRange(){if(!this.isZoomDependent())return null;const _=this._transitionable._values.exaggeration;if(!_)return null;const d=_.value.expression;if(!d)return null;let m=-1,w=-1,M=1;for(const O of d.zoomStops)M=d.evaluate(new i.ac(O,{worldview:this.worldview})),M>.01?(m=O,w=-1):w=O;return M<.01&&m>0&&w>m?[m,w]:null}isZoomDependent(){const _=this._transitionable._values.exaggeration;return _!=null&&_.value!=null&&_.value.expression!=null&&_.value.expression instanceof i.ad}};const Ut=45,fr=65,ar=.05;function Wr(_,d,m,w){const M=i.ah(Ut,fr,m),[O,D]=wn(_,w);let B=1-Math.min(1,Math.exp((d-O)/(D-O)*-6));return B*=B*B,B=Math.min(1,1.00747*B),B*M*_.alpha}function wn(_,d){const m=.5/Math.tan(.5*d);return[_.range[0]+m,_.range[1]+m]}function Ur(_,d,m,w,M){const O=i.af([],[d,m,w],M.mercatorFogMatrix);return Wr(_,i.ag(O),M.pitch,M._fov)}function Jn(_,d,m,w,M,O,D){const B=[[m,w,0],[M,w,0],[M,O,0],[m,O,0]];let V=Number.MAX_VALUE,Y=-Number.MAX_VALUE;for(const Q of B){const ce=i.af([],Q,d),oe=i.ag(ce);V=Math.min(V,oe),Y=Math.max(Y,oe)}return[Wr(_,V,D.pitch,D._fov),Wr(_,Y,D.pitch,D._fov)]}const es=i.a6.fog;class Zn extends i.E{constructor(d,m,w,M){super();const O=new i.a9({range:new i.aa(es.range),color:new i.aa(es.color),"color-use-theme":new i.aa({type:"string","property-type":"data-constant",default:"default"}),"high-color":new i.aa(es["high-color"]),"high-color-use-theme":new i.aa({type:"string","property-type":"data-constant",default:"default"}),"space-color":new i.aa(es["space-color"]),"space-color-use-theme":new i.aa({type:"string","property-type":"data-constant",default:"default"}),"horizon-blend":new i.aa(es["horizon-blend"]),"star-intensity":new i.aa(es["star-intensity"]),"vertical-range":new i.aa(es["vertical-range"])});this._transitionable=new i.a8(O,w,new Map(M)),this.set(d,M),this._transitioning=this._transitionable.untransitioned(),this._transform=m,this.properties=new i.ai(O),this.scope=w}get state(){const d=this._transform,m=d.projection.name==="globe",w=i.aj(d.zoom),M=this.properties.get("range"),O=[.5,3];return{range:m?[i.ak(O[0],M[0],w),i.ak(O[1],M[1],w)]:M,horizonBlend:this.properties.get("horizon-blend"),alpha:this.properties.get("color").a}}get(){return this._transitionable.serialize()}set(d,m,w={}){if(this._validate(To,d,w))return;const M=Object.assign({},d);for(const O of Object.keys(es))M[O]===void 0&&(M[O]=es[O].default);this._options=M,this._transitionable.setTransitionOrValue(this._options,m)}getOpacity(d){if(!this._transform.projection.supportsFog)return 0;const m=this.properties&&this.properties.get("color")||1;return(this._transform.projection.name==="globe"?1:i.ah(Ut,fr,d))*m.a}getOpacityAtLatLng(d,m){return this._transform.projection.supportsFog?function(w,M,O){const D=i.ae.fromLngLat(M),B=O.elevation?O.elevation.getAtPointOrZero(D):0;return Ur(w,D.x,D.y,B,O)}(this.state,d,m):0}getOpacityForTile(d){if(!this._transform.projection.supportsFog)return[1,1];const m=this._transform.calculateFogTileMatrix(d.toUnwrapped());return Jn(this.state,m,0,0,i.al,i.al,this._transform)}getOpacityForBounds(d,m,w,M,O){return this._transform.projection.supportsFog?Jn(this.state,d,m,w,M,O,this._transform):[1,1]}getFovAdjustedRange(d){return this._transform.projection.supportsFog?wn(this.state,d):[0,1]}isVisibleOnFrustum(d){if(!this._transform.projection.supportsFog)return!1;const m=[4,5,6,7];for(const w of m){const M=d.points[w];let O;if(M[2]>=0)O=M;else{const D=d.points[w-4];O=i.am(D,M,D[2]/(D[2]-M[2]))}if(Ur(this.state,O[0],O[1],0,this._transform)>=ar)return!0}return!1}updateConfig(d){this._transitionable.setTransitionOrValue(this._options,new Map(d))}updateTransitions(d){this._transitioning=this._transitionable.transitioned(d,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(d){this.properties=this._transitioning.possiblyEvaluate(d)}_validate(d,m,w){return(!w||w.validate!==!1)&&Ge(this,d.call(Oa,Object.assign({value:m,style:{glyphs:!0,sprite:!0},styleSpec:i.a6})))}}let Ls,Li,po,ua,vo=class extends i.E{constructor(_,d,m,w){super();const M=Ls||(Ls=new i.a9({density:new i.aa(i.a6.snow.density),intensity:new i.aa(i.a6.snow.intensity),color:new i.aa(i.a6.snow.color),opacity:new i.aa(i.a6.snow.opacity),vignette:new i.aa(i.a6.snow.vignette),"vignette-color":new i.aa(i.a6.snow["vignette-color"]),"center-thinning":new i.aa(i.a6.snow["center-thinning"]),direction:new i.aa(i.a6.snow.direction),"flake-size":new i.aa(i.a6.snow["flake-size"])}));this._transitionable=new i.a8(M,m,new Map(w)),this.set(_,w),this._transitioning=this._transitionable.untransitioned(),this.properties=new i.ai(M),this.scope=m}get state(){const _=this.properties.get("opacity"),d=this.properties.get("color"),m=this.properties.get("direction"),w=i.an(m[0]),M=-Math.max(i.an(m[1]),.01),O=[Math.cos(w)*Math.cos(M),Math.sin(w)*Math.cos(M),Math.sin(M)],D=this.properties.get("vignette"),B=this.properties.get("vignette-color");return B.a=D,{density:this.properties.get("density"),intensity:this.properties.get("intensity"),color:new i.ao(d.r,d.g,d.b,d.a*_),direction:O,centerThinning:this.properties.get("center-thinning"),flakeSize:this.properties.get("flake-size"),vignetteColor:B}}get(){return this._transitionable.serialize()}set(_,d,m={}){if(this._validate(ss,_,m))return;const w=Object.assign({},_),M=i.a6.snow;for(const O of Object.keys(M))w[O]===void 0&&(w[O]=M[O].default);this._options=w,this._transitionable.setTransitionOrValue(this._options,d)}updateConfig(_){this._transitionable.setTransitionOrValue(this._options,new Map(_))}updateTransitions(_){this._transitioning=this._transitionable.transitioned(_,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(_){this.properties=this._transitioning.possiblyEvaluate(_)}_validate(_,d,m){return(!m||m.validate!==!1)&&Ge(this,_.call(Oa,Object.assign({value:d,style:{glyphs:!0,sprite:!0},styleSpec:i.a6})))}},ji=class extends i.E{constructor(_,d,m,w){super();const M=Li||(Li=new i.a9({density:new i.aa(i.a6.rain.density),intensity:new i.aa(i.a6.rain.intensity),color:new i.aa(i.a6.rain.color),opacity:new i.aa(i.a6.rain.opacity),vignette:new i.aa(i.a6.rain.vignette),"vignette-color":new i.aa(i.a6.rain["vignette-color"]),"center-thinning":new i.aa(i.a6.rain["center-thinning"]),direction:new i.aa(i.a6.rain.direction),"droplet-size":new i.aa(i.a6.rain["droplet-size"]),"distortion-strength":new i.aa(i.a6.rain["distortion-strength"])}));this._transitionable=new i.a8(M,m,new Map(w)),this.set(_,w),this._transitioning=this._transitionable.untransitioned(),this.properties=new i.ai(M),this.scope=m}get state(){const _=this.properties.get("opacity"),d=this.properties.get("color"),m=this.properties.get("direction"),w=i.an(m[0]),M=-Math.max(i.an(m[1]),.01),O=[Math.cos(w)*Math.cos(M),Math.sin(w)*Math.cos(M),Math.sin(M)],D=this.properties.get("vignette-color");return D.a=this.properties.get("vignette"),{density:this.properties.get("density"),intensity:this.properties.get("intensity"),color:new i.ao(d.r,d.g,d.b,d.a*_),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(_,d,m={}){if(this._validate(yo,_,m))return;const w=Object.assign({},_),M=i.a6.rain;for(const O of Object.keys(M))w[O]===void 0&&(w[O]=M[O].default);this._options=w,this._transitionable.setTransitionOrValue(this._options,d)}updateConfig(_){this._transitionable.setTransitionOrValue(this._options,new Map(_))}updateTransitions(_){this._transitioning=this._transitionable.transitioned(_,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(_){this.properties=this._transitioning.possiblyEvaluate(_)}_validate(_,d,m){return(!m||m.validate!==!1)&&Ge(this,_.call(Oa,Object.assign({value:d,style:{glyphs:!0,sprite:!0},styleSpec:i.a6})))}};class Ws extends i.E{constructor(d,m,w,M){super(),this.scope=w,this._options=d,this.properties=new i.ai(m),this._transitionable=new i.a8(m,w,new Map(M)),this._transitionable.setTransitionOrValue(d.properties),this._transitioning=this._transitionable.untransitioned()}updateConfig(d){this._transitionable.setTransitionOrValue(this._options.properties,new Map(d))}updateTransitions(d){this._transitioning=this._transitionable.transitioned(d,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(d){this.properties=this._transitioning.possiblyEvaluate(d)}get(){return this._options.properties=this._transitionable.serialize(),this._options}set(d,m){this._options=d,this._transitionable.setTransitionOrValue(d.properties,m)}shadowsEnabled(){return!!this.properties&&this.properties.get("cast-shadows")===!0}}class ki{constructor(d,m,w){this.screenBounds=d,this.cameraPoint=w.getCameraPoint(),this._screenRaycastCache={},this._cameraRaycastCache={},this.isAboveHorizon=m,this.screenGeometry=this.bufferedScreenGeometry(0),this.screenGeometryMercator=this._bufferedScreenMercator(0,w)}static createFromScreenPoints(d,m){let w,M;if(d instanceof i.P||typeof d[0]=="number"){const O=i.P.convert(d);w=[O],M=m.isPointAboveHorizon(O)}else{const O=i.P.convert(d[0]),D=i.P.convert(d[1]),B=O.add(D)._div(2);w=[O,D],M=i.aq(O,D).every(V=>m.isPointAboveHorizon(V))&&m.isPointAboveHorizon(B)}return new ki(w,M,m)}isPointQuery(){return this.screenBounds.length===1}bufferedScreenGeometry(d){return i.aq(this.screenBounds[0],this.screenBounds.length===1?this.screenBounds[0]:this.screenBounds[1],d)}bufferedCameraGeometry(d){const m=this.screenBounds[0],w=this.screenBounds.length===1?this.screenBounds[0].add(new i.P(1,1)):this.screenBounds[1],M=i.aq(m,w,0,!1);return this.cameraPoint.y>w.y&&(this.cameraPoint.x>m.x&&this.cameraPoint.x=w.x?M[2]=this.cameraPoint:this.cameraPoint.x<=m.x&&(M[3]=this.cameraPoint)),i.ar(M,d)}bufferedCameraGeometryGlobe(d){const m=this.screenBounds[0],w=this.screenBounds.length===1?this.screenBounds[0].add(new i.P(1,1)):this.screenBounds[1],M=i.aq(m,w,d),O=this.cameraPoint.clone();switch(3*((O.y>m.y)+(O.y>w.y))+((O.x>m.x)+(O.x>w.x))){case 0:M[0]=O,M[4]=O.clone();break;case 1:M.splice(1,0,O);break;case 2:M[1]=O;break;case 3:M.splice(4,0,O);break;case 5:M.splice(2,0,O);break;case 6:M[3]=O;break;case 7:M.splice(3,0,O);break;case 8:M[2]=O}return M}containsTile(d,m,w,M=0){const O=Math.max(d.queryPadding,d.evaluateQueryRenderedFeaturePadding())/m._pixelsPerMercatorPixel+1,D=w?this._bufferedCameraMercator(O,m):this._bufferedScreenMercator(O,m);let B=d.tileID.wrap+(D.unwrapped?M:0);const V=D.polygon.map(De=>i.as(d.tileTransform,De,B));if(!i.at(V,0,0,i.al,i.al))return;B=d.tileID.wrap+(this.screenGeometryMercator.unwrapped?M:0);const Y=this.screenGeometryMercator.polygon.map(De=>i.au(d.tileTransform,De,B)),Q=Y.map(De=>new i.P(De[0],De[1])),ce=m.getFreeCameraOptions().position||new i.ae(0,0,0),oe=i.au(d.tileTransform,ce,B),de=Y.map(De=>{const Pe=i.av(De,De,oe);return i.aw(Pe,Pe),new i.ax(oe,Pe)}),we=i.ay(d,1,m.zoom)*m._pixelsPerMercatorPixel;return{queryGeometry:this,tilespaceGeometry:Q,tilespaceRays:de,bufferedTilespaceGeometry:V,bufferedTilespaceBounds:(ve=i.az(V),ve.min.x=i.aA(ve.min.x,0,i.al),ve.min.y=i.aA(ve.min.y,0,i.al),ve.max.x=i.aA(ve.max.x,0,i.al),ve.max.y=i.aA(ve.max.y,0,i.al),ve),tile:d,tileID:d.tileID,pixelToTileUnitsFactor:we};var ve}_bufferedScreenMercator(d,m){const w=Ni(d);if(this._screenRaycastCache[w])return this._screenRaycastCache[w];{let M;return M=m.projection.name==="globe"?this._projectAndResample(this.bufferedScreenGeometry(d),m):{polygon:this.bufferedScreenGeometry(d).map(O=>m.pointCoordinate3D(O)),unwrapped:!0},this._screenRaycastCache[w]=M,M}}_bufferedCameraMercator(d,m){const w=Ni(d);if(this._cameraRaycastCache[w])return this._cameraRaycastCache[w];{let M;return M=m.projection.name==="globe"?this._projectAndResample(this.bufferedCameraGeometryGlobe(d),m):{polygon:this.bufferedCameraGeometry(d).map(O=>m.pointCoordinate3D(O)),unwrapped:!0},this._cameraRaycastCache[w]=M,M}}_projectAndResample(d,m){const w=function(O,D){const B=i.aB([],D.pixelMatrix,D.globeMatrix),V=[0,-i.aD,0,1],Y=[0,i.aD,0,1],Q=[0,0,0,1];i.aC(V,V,B),i.aC(Y,Y,B),i.aC(Q,Q,B);const ce=new i.P(V[0]/V[3],V[1]/V[3]),oe=new i.P(Y[0]/Y[3],Y[1]/Y[3]),de=i.aE(O,ce)&&V[3]1?za(O.slice(0,De),D):[],Xe=Denew i.P(Ss(xt.x),xt.y)),Xe=Xe.map(xt=>new i.P(Ss(xt.x),xt.y));const We=[...Ve];We.length===0&&We.push(Xe[Xe.length-1]);const bt=i.ak(We[We.length-1].y,(Xe.length===0?Ve[0]:Xe[0]).y,Pe);let ut;return ut=de?[new i.P(0,bt),new i.P(0,0),new i.P(1,0),new i.P(1,bt)]:[new i.P(1,bt),new i.P(1,1),new i.P(0,1),new i.P(0,bt)],We.push(...ut),Xe.length===0?We.push(Ve[0]):We.push(...Xe),{polygon:We.map(xt=>new i.ae(xt.x,xt.y)),unwrapped:!1}}(d,m);if(w)return w;const M=function(O,D){let B=!1,V=-1/0,Y=0;for(let ce=0;ceV&&(V=O[ce].x,Y=ce);for(let ce=0;ce.5&&(de.x{ce.x-=1}),{polygon:O,unwrapped:B}}(za(d,m).map(O=>new i.P(Ss(O.x),O.y)),m);return{polygon:M.polygon.map(O=>new i.ae(O.x,O.y)),unwrapped:M.unwrapped}}}function za(_,d){return i.aG(_,m=>{const w=d.pointCoordinate3D(m);m.x=w.x,m.y=w.y},1/256)}function Ss(_){return _<0?1+_%1:_%1}function Ni(_){return 100*_|0}function ml(_,d,m,w,M){const O=function(B,V){if(B)return M(B);if(V){if(_.url&&V.tiles&&_.tiles&&delete _.tiles,V.variants){if(!Array.isArray(V.variants))return M(new Error("variants must be an array"));for(const Q of V.variants){if(Q==null||typeof Q!="object"||Q.constructor!==Object)return M(new Error("variant must be an object"));if(!Array.isArray(Q.capabilities))return M(new Error("capabilities must be an array"));if(Q.capabilities.length===1&&Q.capabilities[0]==="meshopt"){V=Object.assign(V,Q);break}}}const Y=i.aH(Object.assign({},V,_),["tilejson","tiles","minzoom","maxzoom","attribution","mapbox_logo","bounds","extra_bounds","scheme","tileSize","encoding","vector_layers","raster_layers","worldview_options","worldview_default","worldview"]);Y.tiles=d.canonicalizeTileset(Y,_.url),M(null,Y)}},D=function(B,V,Y){if(!B)return null;if(!V&&!Y)return B;Y=Y||B.worldview_default;const Q=Object.values(B.language||{});if(Q.length===0)return null;const ce=Object.values(B.worldview||{});if(ce.length===0)return null;const oe=Q.every(we=>we===V),de=ce.every(we=>we===Y);return oe&&de?B:V in(B.language_options||{})||Y in(B.worldview_options||{})?null:B.language_options&&B.worldview_options?B:null}(_.data,m,w);return D?i.o.frame(()=>O(null,D)):_.url?i.m(d.transformRequest(d.normalizeSourceURL(_.url,null,m,w),i.R.Source),O):i.o.frame(()=>{const{data:B,...V}=_;O(null,V)})}function Sl(_,d){const m=Math.pow(2,d.z),w=Math.floor(i.aF(_.getWest())*m),M=Math.floor(i.aJ(_.getNorth())*m),O=Math.ceil(i.aF(_.getEast())*m),D=Math.ceil(i.aJ(_.getSouth())*m);return d.x>=w&&d.x=M&&d.ythis.maxzoom||d.z{if(this._tileJSONRequest=null,this._loaded=!0,M)m&&console.warn(`Ensure that your requested language string is a valid BCP-47 code or list of codes. Found: ${m}`),w&&console.warn(`Requested worldview strings must be a valid ISO alpha-2 code. Found: ${w}`),this.fire(new i.y(M));else if(O){if(Object.assign(this,O),this.hasWorldviews=!!O.worldview_options,O.worldview_default&&(this.worldviewDefault=O.worldview_default),O.vector_layers){this.vectorLayers=O.vector_layers,this.vectorLayerIds=[],this.localizableLayerIds=new Set;for(const D of O.vector_layers)this.vectorLayerIds.push(D.id),O.worldview&&O.worldview[D.source]&&this.localizableLayerIds.add(D.id)}this.tileBounds=Lc.fromTileJSON(O),me(O.tiles,this.map._requestManager._customAccessToken),this.fire(new i.z("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new i.z("data",{dataType:"source",sourceDataType:"content"}))}d&&d(M)})}loaded(){return this._loaded}hasTile(d){return!this.tileBounds||this.tileBounds.contains(d.canonical)}onAdd(d){this.map=d,this.load()}reload(){this.cancelTileJSONRequest();const d=i.B(this.id,this.scope);this.load(()=>this.map.style.clearSource(d))}setTiles(d){return this._options.tiles=d,this.reload(),this}setUrl(d){return this.url=d,this._options.url=d,this.reload(),this}onRemove(d){this.cancelTileJSONRequest()}serialize(){return Object.assign({},this._options)}loadTile(d,m){const w=d.tileID.canonical.url(this.tiles,this.scheme),M=this.map._requestManager.normalizeTileURL(w),O=this.map._requestManager.transformRequest(M,i.R.Tile),D=this.map.style?this.map.style.getLut(this.scope):null,B=D?{image:D.image.clone()}:null,V={request:O,data:void 0,uid:d.uid,tileID:d.tileID,tileZoom:d.tileZoom,zoom:d.tileID.overscaledZ,maxZoom:this.maxzoom,lut:B,tileSize:this.tileSize*d.tileID.overscaleFactor(),type:this.type,source:this.id,scope:this.scope,pixelRatio:i.o.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,isSymbolTile:d.isSymbolTile,brightness:this.map.style&&this.map.style.getBrightness()||0,extraShadowCaster:d.isExtraShadowCaster,tessellationStep:this.map._tessellationStep,scaleFactor:this.map.getScaleFactor(),worldview:this.map.getWorldview()||this.worldviewDefault,indoor:this.map.indoor?this.map.indoor.getIndoorTileOptions(this.id,this.scope):null};if(this.hasWorldviews&&i.h(w)&&(V.localizableLayerIds=this.localizableLayerIds),V.request.collectResourceTiming=this._collectResourceTiming,d.actor&&d.state!=="expired")d.state==="loading"?d.reloadCallback=m:d.request=d.actor.send("reloadTile",V,Y.bind(this));else if(d.actor=this._tileWorkers[M]=this._tileWorkers[M]||this.dispatcher.getActor(),this.dispatcher.ready)d.request=d.actor.send("loadTile",V,Y.bind(this),void 0,!0);else{const Q=i.aL.call({deduped:this._deduped},V,(ce,oe)=>{if(ce||!oe)Y.call(this,ce);else{const de=i.aM(oe.responseHeaders);V.data={rawData:oe.rawData.slice(0),expires:de.expires,cacheControl:de.cacheControl},d.actor&&d.actor.send("loadTile",V,Y.bind(this),void 0,!0)}},!0);d.request={cancel:Q}}function Y(Q,ce){return delete d.request,d.aborted?m(null):Q&&Q instanceof i.aN&&Q.status!==404?m(Q):(ce&&ce.resourceTiming&&(d.resourceTiming=ce.resourceTiming),this.map._refreshExpiredTiles&&ce&&d.setExpiryData(ce),d.loadVectorData(ce,this.map.painter),i.aO(this.dispatcher),m(null,ce),void(d.reloadCallback&&(this.loadTile(d,d.reloadCallback),d.reloadCallback=null)))}}abortTile(d){d.request&&(d.request.cancel(),delete d.request),d.actor&&d.actor.send("abortTile",{uid:d.uid,type:this.type,source:this.id,scope:this.scope})}unloadTile(d,m){d.actor&&d.actor.send("removeTile",{uid:d.uid,type:this.type,source:this.id,scope:this.scope}),d.destroy()}hasTransition(){return!1}afterUpdate(){this._tileWorkers={}}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}}class Bo extends i.E{constructor(d,m,w,M){super(),this.id=d,this.dispatcher=w,this.setEventedParent(M),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=Object.assign({type:"raster"},m),Object.assign(this,i.aH(m,["url","scheme","tileSize"]))}load(d){this._loaded=!1,this.fire(new i.z("dataloading",{dataType:"source"}));const m=this.map.getWorldview();this._tileJSONRequest=ml(this._options,this.map._requestManager,null,m,(w,M)=>{this._tileJSONRequest=null,this._loaded=!0,w?this.fire(new i.y(w)):M&&(Object.assign(this,M),M.raster_layers&&(this.rasterLayers=M.raster_layers,this.rasterLayerIds=this.rasterLayers.map(O=>O.id)),this.tileBounds=Lc.fromTileJSON(M),me(M.tiles),this.fire(new i.z("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new i.z("data",{dataType:"source",sourceDataType:"content"}))),d&&d(w)})}loaded(){return this._loaded}onAdd(d){this.map=d,this.load()}reload(){this.cancelTileJSONRequest();const d=i.B(this.id,this.scope);this.load(()=>this.map.style.clearSource(d))}setTiles(d){return this._options.tiles=d,this.reload(),this}setUrl(d){return this.url=d,this._options.url=d,this.reload(),this}onRemove(d){this.cancelTileJSONRequest()}serialize(){return Object.assign({},this._options)}hasTile(d){return!this.tileBounds||this.tileBounds.contains(d.canonical)}loadTile(d,m){const w=i.o.devicePixelRatio>=2,M=this.map._requestManager.normalizeTileURL(d.tileID.canonical.url(this.tiles,this.scheme),w,this.tileSize);d.request=i.n(this.map._requestManager.transformRequest(M,i.R.Tile),(O,D,B)=>{if(delete d.request,d.aborted)return d.state="unloaded",m(null);if(O)return d.state="errored",m(O);if(!D)return m(null);const V=i.aM(B);this.map._refreshExpiredTiles&&d.setExpiryData(V),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 _d([_,d],m,w,{scaled:M=!0}={}){const{tileSize:O,buffer:D}=w,{x:B,y:V,z:Y}=m;if(!isFinite(B)||!isFinite(V)||!isFinite(Y))throw new Error("Invalid MRT header");const Q=2**Y,ce=Q*i.aF(_),oe=Q*i.aJ(d);return function([de,we],ve,{scaled:De=!0}={}){if(!ve)throw new Error("bandView is undefined");const{data:Pe,tileSize:Ve,buffer:Xe,offset:We,scale:bt,dimension:ut}=ve;if(de<-Xe||de>Ve+Xe||we<-Xe||we>Ve+Xe)throw new Error(`Point (${de}, ${we}) out of bounds for tileSize=${Ve}, buffer=${Xe}`);const xt=(we+Xe)*(Ve+2*Xe)+(de+Xe);if(new Uint32Array(Pe.buffer)[xt]===4294967295)return null;let ct=[];ct=De?[]:new ve.data.constructor(ut);for(let it=0;it{if(delete d.request,d.aborted)return d.state="unloaded",m(null);if(B)return B.name==="AbortError"?void 0:(d.state="errored",m(B));if(this.map._refreshExpiredTiles&&V){const Q=i.aM(Y);d.setExpiryData(Q)}if(this.partial&&d.state!=="expired")d.state="empty";else if(!this.partial){if(!V)return m(null);d.state="loaded",d._isHeaderLoaded=!0,d._mrt=V}m(null)};d.request=this.partial?d.fetchHeader(void 0,D.bind(this)):d.actor.send("loadTile",O,D.bind(this),void 0,!0)}abortTile(d){d.request&&(d.request.cancel(),delete d.request),d.actor&&d.actor.send("abortTile",{uid:d.uid,type:this.type,source:this.id,scope:this.scope})}unloadTile(d,m){const w=d.texturePerLayer;if(d.flushAllQueues(),w.size){d.destroy(!1);for(const M of w.values())this.map.painter.saveTileTexture(M)}else d.destroy()}prepareTile(d,m,w,M){d._isHeaderLoaded&&(d.state!=="empty"&&(d.state="reloading"),d.fetchBandForRender(m,w,M,(O,D)=>{if(O)return d.state="errored",this.fire(new i.y(O)),void this.triggerRepaint(d);D&&(d._isHeaderLoaded=!0,d.setTexturePerLayer(w,D,this.map.painter),d.state="loaded",this.triggerRepaint(d))}))}getInitialBand(d){if(!this.rasterLayers)return 0;const m=this.rasterLayers.find(({id:O})=>O===d),w=m&&m.fields,M=w&&w.bands&&w.bands;return M?M[0]:0}getTextureDescriptor(d,m,w){if(!d)return;const M=m.sourceLayer||this.rasterLayerIds&&this.rasterLayerIds[0];if(!M)return;let O=null;m instanceof i.aR?O=m.paint.get("raster-array-band"):m instanceof i.aS&&(O=m.paint.get("raster-particle-array-band"));const D=O||this.getInitialBand(M);if(D==null)return;if(!d.textureDescriptorPerLayer.get(m.id))return void this.prepareTile(d,M,m.id,D);if(d.updateNeeded(m.id,D)&&!w)return;const B=d.textureDescriptorPerLayer.get(m.id);return Object.assign({},B,{texture:d.texturePerLayer.get(m.id)})}getImages(d,m){const w=new Map;for(const M of d)for(const O of m){const[D,B]=O.split("/"),V=M.getLayer(D);if(!V||!V.hasBand(B)||!V.hasDataForBand(B))continue;const{bytes:Y,tileSize:Q,buffer:ce}=V.getBandView(B),oe=Q+2*ce,de={data:new i.q({width:oe,height:oe},Y),pixelRatio:2,sdf:!1,usvg:!1,version:0};w.set(O,de)}return w}queryRasterArrayValueByBandId(d,m,w){const M=m._mrt;return new Promise(O=>{const D={},B=new Set;for(const[V,Y]of Object.entries(M.layers)){if(w.layerName&&V!==w.layerName)continue;const Q={};D[V]=Q;for(const{bands:ce}of Y.dataIndex)for(const oe of ce)w.bands&&!w.bands.includes(oe)||(B.add(i.B(V,oe)),m.fetchBand(V,null,oe,de=>{i.o.frame(()=>{Q[oe]=de?null:_d([d.lng,d.lat],M,Y.getBandView(oe)),B.delete(i.B(V,oe)),B.size===0&&O(D)})},!1))}B.size===0&&O(D)})}_loadTileForQuery(d,m){if(this._loadTileLoaded[d.uid])return void m(null,d._mrt);if(this._loadTilePending[d.uid])return void this._loadTilePending[d.uid].push(m);this._loadTilePending[d.uid]=[m];const w=this.map._requestManager.normalizeTileURL(d.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize),M=this.map._requestManager.transformRequest(w,i.R.Tile);d.actor.send("loadTile",{request:M,uid:d.uid,tileID:d.tileID,type:this.type,source:this.id,scope:this.scope,partial:!1},(O,D,B)=>{if(O)return this._loadTilePending[d.uid].forEach(V=>V(O,null)),void delete this._loadTilePending[d.uid];if(!D)return this._loadTilePending[d.uid].forEach(V=>V(null,null)),void delete this._loadTilePending[d.uid];if(this.map._refreshExpiredTiles&&D){const V=i.aM(B);d.setExpiryData(V)}d._mrt=D,d._isHeaderLoaded=!0,d.state="loaded",this._loadTilePending[d.uid].forEach(V=>V(null,D)),this._loadTileLoaded[d.uid]=!0,delete this._loadTilePending[d.uid]},void 0,!0)}queryRasterArrayValueByAllBands(d,m,w){return new Promise((M,O)=>{this._loadTileForQuery(m,(D,B)=>{D?O(D):M(B?this.queryRasterArrayValueByBandId(d,m,w):null)})})}queryRasterArrayValue(d,m){const w=i.aT.convert(d),M=this.findLoadedParent(w);return M&&M._mrt?m.bands||!this.partial?this.queryRasterArrayValueByBandId(w,M,m):this.queryRasterArrayValueByAllBands(w,M,m):Promise.resolve(null)}findLoadedParent(d){const m=i.ae.fromLngLat(d,this.map.transform.tileSize),w=this.maxzoom+1,M=1<0&&(B[new i.aQ(_.overscaledZ,M,d.z,w,d.y-1).key]={backfilled:!1},B[new i.aQ(_.overscaledZ,_.wrap,d.z,d.x,d.y-1).key]={backfilled:!1},B[new i.aQ(_.overscaledZ,D,d.z,O,d.y-1).key]={backfilled:!1}),d.y+1{if(this._loaded=!0,this._pendingLoad=null,w)this.fire(new i.y(w));else{const O={dataType:"source",sourceDataType:this._metadataFired?"content":"metadata"};this._collectResourceTiming&&M&&M.resourceTiming&&M.resourceTiming[this.id]&&(O.resourceTiming=M.resourceTiming[this.id]),_&&(this._partialReload=!0),this.fire(new i.z("data",O)),this._partialReload=!1,this._metadataFired=!0}this._coalesce&&(this._updateWorkerData(_),this._coalesce=!1)})}loaded(){return this._loaded}reload(){const _=i.B(this.id,this.scope);this.map.style.clearSource(_),this._updateWorkerData()}loadTile(_,d){const m=_.actor?"reloadTile":"loadTile";_.actor=this.actor;const w=this.map.style?this.map.style.getLut(this.scope):null,M=w?{image:w.image.clone()}:null,O=this._partialReload,D={type:this.type,uid:_.uid,tileID:_.tileID,tileZoom:_.tileZoom,zoom:_.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,lut:M,scope:this.scope,pixelRatio:i.o.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,brightness:this.map.style&&this.map.style.getBrightness()||0,extraShadowCaster:_.isExtraShadowCaster,scaleFactor:this.map.getScaleFactor(),partial:O,worldview:this.map.getWorldview(),indoor:this.map.indoor?this.map.indoor.getIndoorTileOptions(this.id,this.scope):null};_.request=this.actor.send(m,D,(B,V)=>O&&!V?(_.state="loaded",d(null)):(delete _.request,_.destroy(!1),_.aborted?d(null):B?d(B):(_.loadVectorData(V,this.map.painter,m==="reloadTile"),d(null))),void 0,m==="loadTile")}abortTile(_){_.request&&(_.request.cancel(),delete _.request),_.aborted=!0}unloadTile(_,d){this.actor.send("removeTile",{uid:_.uid,type:this.type,source:this.id,scope:this.scope}),_.destroy()}onRemove(_){this._pendingLoad&&this._pendingLoad.cancel()}serialize(){return Object.assign({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}},video:class extends i.aU{constructor(_,d,m,w){super(_,d,m,w),this.roundZoom=!0,this.type="video",this.options=d}load(){this._loaded=!1;const _=this.options;this.urls=[];for(const d of _.urls)this.urls.push(this.map._requestManager.transformRequest(d,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(_){if(this.video){const d=this.video.seekable;_d.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=_}}getVideo(){return this.video}onAdd(_){this.map||(this.map=_,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;const _=this.map.painter.context,d=_.gl;this.texture?this.video.paused||(this.texture.bind(d.LINEAR,d.CLAMP_TO_EDGE),d.texSubImage2D(d.TEXTURE_2D,0,0,0,d.RGBA,d.UNSIGNED_BYTE,this.video)):(this.texture=new i.T(_,this.video,d.RGBA8),this.texture.bind(d.LINEAR,d.CLAMP_TO_EDGE),this.width=this.video.videoWidth,this.height=this.video.videoHeight),this._prepareData(_)}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}},image:i.aU,model:i.aX,"batched-model":class extends i.E{constructor(_,d,m,w){super(),this.type="batched-model",this.id=_,this.tileSize=512,this._options=d,this.tiles=this._options.tiles,this.maxzoom=d.maxzoom||19,this.minzoom=d.minzoom||0,this.roundZoom=!0,this.usedInConflation=!0,this.dispatcher=m,this.reparseOverscaled=!1,this.scheme="xyz",this._loaded=!1,this.setEventedParent(w)}onAdd(_){this.map=_,this.load()}reload(){this.cancelTileJSONRequest();const _=i.B(this.id,this.scope);this.load(()=>this.map.style.clearSource(_))}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}load(_){this._loaded=!1,this.fire(new 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=ml(this._options,this.map._requestManager,d,m,(w,M)=>{this._tileJSONRequest=null,this._loaded=!0,w?(d&&console.warn(`Ensure that your requested language string is a valid BCP-47 code or list of codes. Found: ${d}`),m&&m.length!==2&&console.warn(`Requested worldview strings must be a valid ISO alpha-2 code. Found: ${m}`),this.fire(new i.y(w))):M&&(Object.assign(this,M),M.bounds&&(this.tileBounds=new Lc(M.bounds,this.minzoom,this.maxzoom)),me(M.tiles,this.map._requestManager._customAccessToken),this.fire(new i.z("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new i.z("data",{dataType:"source",sourceDataType:"content"}))),_&&_(w)})}hasTransition(){return!1}hasTile(_){return!this.tileBounds||this.tileBounds.contains(_.canonical)}loaded(){return this._loaded}loadTile(_,d){const m=this.map._requestManager.normalizeTileURL(_.tileID.canonical.url(this.tiles,this.scheme)),w={request:this.map._requestManager.transformRequest(m,i.R.Tile),data:void 0,uid:_.uid,tileID:_.tileID,tileZoom:_.tileZoom,zoom:_.tileID.overscaledZ,tileSize:this.tileSize*_.tileID.overscaleFactor(),type:this.type,source:this.id,scope:this.scope,showCollisionBoxes:this.map.showCollisionBoxes,isSymbolTile:_.isSymbolTile,brightness:this.map.style&&this.map.style.getBrightness()||0,pixelRatio:i.o.devicePixelRatio,promoteId:this.promoteId};if(_.actor&&_.state!=="expired")if(_.state==="loading")_.reloadCallback=d;else{if(_.buckets){const O=Object.values(_.buckets);for(const D of O)D.dirty=!0;return void(_.state="loaded")}_.request=_.actor.send("reloadTile",w,M.bind(this))}else _.actor=this.dispatcher.getActor(),_.request=_.actor.send("loadTile",w,M.bind(this),void 0,!0);function M(O,D){return _.aborted?d(null):O&&O.status!==404?d(O):(this.map._refreshExpiredTiles&&D&&_.setExpiryData(D),_.loadModelData(D,this.map.painter),_.state="loaded",void d(null))}}serialize(){return Object.assign({},this._options)}},canvas:class extends i.aU{constructor(_,d,m,w){super(_,d,m,w),d.coordinates?Array.isArray(d.coordinates)&&d.coordinates.length===4&&!d.coordinates.some(M=>!Array.isArray(M)||M.length!==2||M.some(O=>typeof O!="number"))||this.fire(new i.y(new i.V(`sources.${_}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new i.y(new i.V(`sources.${_}`,null,'missing required property "coordinates"'))),d.animate&&typeof d.animate!="boolean"&&this.fire(new i.y(new i.V(`sources.${_}`,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.${_}`,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.${_}`,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(_){this.map=_,this.load(),this.canvas&&this.animate&&this.play()}onRemove(_){this.pause()}prepare(){let _=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,_=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,_=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;const d=this.map.painter.context;this.texture?!_&&!this._playing||this.texture instanceof 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 _ of[this.canvas.width,this.canvas.height])if(isNaN(_)||_<=0)return!0;return!1}},custom:class extends i.E{constructor(_,d,m,w){super(),this.id=_,this.type="custom",this._dataType="raster",this._dispatcher=m,this._implementation=d,this.setEventedParent(w),this.scheme="xyz",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this._loaded=!1,this.roundZoom=!0,this._implementation||this.fire(new i.y(new Error(`Missing implementation for ${this.id} custom source`))),this._implementation.loadTile||this.fire(new i.y(new Error(`Missing loadTile implementation for ${this.id} custom source`))),this._implementation.bounds&&(this.tileBounds=new Lc(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(_){this.map=_,this._loaded=!1,this.fire(new i.z("dataloading",{dataType:"source"})),this._implementation.onAdd&&this._implementation.onAdd(_),this.load()}onRemove(_){this._implementation.onRemove&&this._implementation.onRemove(_)}hasTile(_){if(this._implementation.hasTile){const{x:d,y:m,z:w}=_.canonical;return this._implementation.hasTile({x:d,y:m,z:w})}return!this.tileBounds||this.tileBounds.contains(_.canonical)}loadTile(_,d){const{x:m,y:w,z:M}=_.tileID.canonical,O=new AbortController;_.request=Promise.resolve(this._implementation.loadTile({x:m,y:w,z:M},{signal:O.signal})).then((function(D){return delete _.request,_.aborted?(_.state="unloaded",d(null)):D===void 0?(_.state="errored",d(null)):D===null?(this.loadTileData(_,{width:this.tileSize,height:this.tileSize,data:null}),_.state="loaded",d(null)):function(B){return B instanceof ImageData||B instanceof HTMLCanvasElement||B instanceof ImageBitmap||B instanceof HTMLImageElement}(D)?(this.loadTileData(_,D),_.state="loaded",void d(null)):(_.state="errored",d(new Error(`Can't infer data type for ${this.id}, only raster data supported at the moment`)))}).bind(this)).catch(D=>{D.name!=="AbortError"&&(_.state="errored",d(D))}),_.request.cancel=()=>O.abort()}loadTileData(_,d){_.setTexture(d,this.map.painter)}unloadTile(_,d){if(_.texture&&_.texture instanceof i.T?(_.destroy(!1),_.texture&&_.texture instanceof i.T&&this.map.painter.saveTileTexture(_.texture)):_.destroy(),this._implementation.unloadTile){const{x:m,y:w,z:M}=_.tileID.canonical;this._implementation.unloadTile({x:m,y:w,z:M})}d&&d()}abortTile(_,d){_.request&&_.request.cancel&&(_.request.cancel(),delete _.request),d&&d()}hasTransition(){return!1}_coveringTiles(){return this.map.transform.coveringTiles({tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,roundZoom:this.roundZoom}).map(_=>({x:_.canonical.x,y:_.canonical.y,z:_.canonical.z}))}_clearTiles(){const _=i.B(this.id,this.scope);this.map.style.clearSource(_)}_update(){this.fire(new i.z("data",{dataType:"source",sourceDataType:"content"}))}}},$o=function(_,d,m,w){const M=new Ku[d.type](_,d,m,w);if(M.id!==_)throw new Error(`Expected Source id to be ${_} instead of ${M.id}`);return i.aY(["load","abort","unload","serialize","prepare"],M),M};function dp(_,d,m=""){return`${m}:${d.id||""}:${d.layer.id}:${function(w){if("layerId"in w)return`layer:${w.layerId}`;{const{featuresetId:M,importId:O}=w;return`featureset:${M}${O?`:import:${O}`:""}`}}(_.target)}`}function Tm(_,d,m,w=""){if(_.uniqueFeatureID){const M=dp(_,d,w);if(m.has(M))return!0;m.add(M)}return!1}function yy(_,d,m,w,M=!1){const O=d.sourceCache.transform,D=d.sourceCache.tilesIn(_,d.has3DLayers,M);D.sort(Sh);const B=[];for(const V of D){const Y=V.tile.queryRenderedFeatures(d,V,m,w,O,M);Object.keys(Y).length&&B.push({wrappedTileID:V.tile.tileID.wrapped().key,queryResults:Y})}for(const V in d.layers){const Y=d.layers[V];if(Y.styleLayer){const Q=Y.styleLayer.queryRenderedFeatures(_,d.sourceCache,w);Object.keys(Q).length&&B.push({wrappedTileID:0,queryResults:Q})}}return B.length===0?{}:function(V){const Y={},Q={};for(const ce of V){const oe=ce.queryResults,de=ce.wrappedTileID,we=Q[de]=Q[de]||{};for(const ve in oe){const De=oe[ve],Pe=we[ve]=we[ve]||{},Ve=Y[ve]=Y[ve]||[];for(const Xe of De)Pe[Xe.featureIndex]||(Pe[Xe.featureIndex]=!0,Ve.push(Xe))}}return Y}(B)}function vy(_,d,m,w,M,O){const D={},B=w.queryRenderedSymbols(_),V=[];for(const Y of Object.keys(B).map(Number))V.push(M[Y]);V.sort(Sh);for(const Y of V){const Q=Y.featureIndex.lookupSymbolFeatures(B[Y.bucketInstanceId],Y.bucketIndex,Y.sourceLayerIndex,d,m,O);for(const ce in Q){const oe=D[ce]=D[ce]||[],de=Q[ce];de.sort((we,ve)=>{const De=Y.featureSortOrder;if(De){const Pe=De.indexOf(we.featureIndex);return De.indexOf(ve.featureIndex)-Pe}return ve.featureIndex-we.featureIndex});for(const we of de)oe.push(we)}}return D}function _y(_,d){const m=_.getRenderableIds().map(O=>_.getTileByID(O)),w=[],M={};for(let O=0;Od.getLayer(O)).filter(Boolean);if(M.length!==0){w.layers=M,w.stateDependentLayerIds&&(w.stateDependentLayers=w.stateDependentLayerIds.map(O=>M.filter(D=>D.id===O)[0]));for(const O of M)m[O.fqid]=w}}return m}const Oc=32,qd=33,Dc=new Uint16Array(8184);for(let _=0;_<2046;_++){let d=_+2,m=0,w=0,M=0,O=0,D=0,B=0;for(1&d?M=O=D=Oc:m=w=B=Oc;(d>>=1)>1;){const Y=m+M>>1,Q=w+O>>1;1&d?(M=m,O=w,m=D,w=B):(m=M,w=O,M=D,O=B),D=Y,B=Q}const V=4*_;Dc[V+0]=m,Dc[V+1]=w,Dc[V+2]=M,Dc[V+3]=O}const _o=new Uint16Array(2178),bd=new Uint8Array(1089),Zu=new Uint16Array(1089);function xc(_){return _===0?-.03125:_===32?.03125:0}const by={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 up{constructor(d,m,w,M,O,D){this.tileID=d,this.uid=i.b2(),this.uses=0,this.tileSize=m,this.tileZoom=w,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.isRaster=O,M&&M.style&&(this._lastUpdatedBrightness=M.style.getBrightness()),this.expiredRequestCount=0,this.state="loading",M&&M.transform&&(this.projection=M.transform.projection),this.worldview=D,this._hasAppearances=null}registerFadeDuration(d){const m=d+this.timeAdded;mw)M=!1;else if(m)if(this.expirationTimew.appearances&&w.appearances.length>0))return!0;return!1}updateBuckets(d,m){if(!this.latestFeatureIndex||!d.style)return;const w=d.style.listImages(),M=d.style.getBrightness();for(const O in this.buckets){if(!d.style.hasLayer(O))continue;const D=this.buckets[O],B=D.layers[0],V=B.sourceLayer||"_geojsonTileLayer",Y=d.style.getLayerSourceCache(B);let Q={};Y&&(Q=Y._state.getState(V,void 0));const ce=this.imageAtlas?Object.fromEntries(this.imageAtlas.patternPositions):{},oe=Object.keys(Q).length>0&&!m;D.hasAppearances=D.layers.some(ve=>ve.appearances&&ve.appearances.length>0);const de=oe?D.stateDependentLayers:D.layers;if(oe&&D.stateDependentLayers.length!==0||m){const ve=this.latestFeatureIndex.loadVTLayers();D.update(Q,ve[V],w,ce,de,m,M)}if(oe&&D.stateDependentLayers.length!==0||m||D.hasAppearances){const ve={zoom:d.transform.zoom,pitch:d.transform.pitch,brightness:d.style.getBrightness()||0,worldview:d.worldview};D.updateAppearances(this.tileID.canonical,Q,w,ve)}(D instanceof i.ba||D instanceof i.bb)&&d._terrain&&d._terrain.enabled&&Y&&D.uploadPending()&&d._terrain._clearRenderCacheForTile(Y.id,this.tileID);const we=d&&d.style&&d.style.getOwnLayer(O);we&&(this.queryPadding=Math.max(this.queryPadding,we.queryRadius(D)))}}holdingForFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil=0;De--){const Pe=4*De,Ve=Dc[Pe+0],Xe=Dc[Pe+1],We=Dc[Pe+2],bt=Dc[Pe+3],ut=Ve+We>>1,xt=Xe+bt>>1,ct=ut+xt-Xe,it=xt+Ve-ut,St=Xe*qd+Ve,Dt=bt*qd+We,Lt=xt*qd+ut,Ht=Math.hypot((_o[2*St+0]+_o[2*Dt+0])/2-_o[2*Lt+0],(_o[2*St+1]+_o[2*Dt+1])/2-_o[2*Lt+1])>=16;bd[Lt]=bd[Lt]||(Ht?1:0),De<1022&&(bd[Lt]=bd[Lt]||bd[(Xe+it>>1)*qd+(Ve+ct>>1)]||bd[(bt+it>>1)*qd+(We+ct>>1)])}const ce=new i.b1,oe=new i.b0;let de=0;function we(De,Pe){const Ve=Pe*qd+De;return Zu[Ve]===0&&(ce.emplaceBack(_o[2*Ve+0],_o[2*Ve+1],De*i.al/Oc,Pe*i.al/Oc),Zu[Ve]=++de),Zu[Ve]-1}function ve(De,Pe,Ve,Xe,We,bt){const ut=De+Ve>>1,xt=Pe+Xe>>1;if(Math.abs(De-We)+Math.abs(Pe-bt)>1&&bd[xt*qd+ut])ve(We,bt,De,Pe,ut,xt),ve(Ve,Xe,We,bt,ut,xt);else{const ct=we(De,Pe),it=we(Ve,Xe),St=we(We,bt);oe.emplaceBack(ct,it,St)}}return ve(0,0,Oc,Oc,Oc,0),ve(Oc,Oc,0,0,0,Oc),{vertices:ce,indices:oe}}(this.tileID.canonical,m);M=D.vertices,O=D.indices}else{M=new i.b1,O=new i.b0;for(const{x:B,y:V}of w)M.emplaceBack(B,V,0,0);const D=i.bh(M.int16.subarray(0,4*M.length),void 0,4);for(let B=0;B0&&(V=i.bl(new Float64Array(16),m.globeMatrix)),this._makeGlobeTileDebugBorderBuffer(d,M,m,D,V,B),this._makeGlobeTileDebugTextBuffer(d,M,m,D,V,B)}_globePoint(d,m,w,M,O,D,B){let V=i.bm(d,m,w);if(D){const Y=1<.5?de=-1:oe<-.5&&(de=1);let we=(d/i.al+w.x)/Y+de,ve=(m/i.al+w.y)/Y;we=(we-Q)*M._pixelsPerMercatorPixel+Q,ve=(ve-ce)*M._pixelsPerMercatorPixel+ce;const De=[we*M.worldSize,ve*M.worldSize,0];i.af(De,De,D),V=i.bn(V,De,B)}return i.af(V,V,O)}_makeGlobeTileDebugBorderBuffer(d,m,w,M,O,D){const B=new i.bd,V=new i.be,Y=new i.bo,Q=(oe,de,we,ve,De)=>{const Pe=(we-oe)/(De-1),Ve=(ve-de)/(De-1),Xe=B.length;for(let We=0;Wece*de+we;for(let de=0;de{if(O)m(O);else try{const V=w.getHeaderLength(D);if(V>d)return void(this.request=this.fetchHeader(V,m));w.parseHeader(D),this._isHeaderLoaded=!0;let Y=0;for(const Q of Object.values(w.layers))Y=Math.max(Y,Q.dataIndex[Q.dataIndex.length-1].lastByte);D.byteLength>=Y&&(this.entireBuffer=D),m(null,this.entireBuffer||D,B)}catch(V){m(V)}}),this.request}fetchBandForRender(d,m,w,M){this.fetchBand(d,m,w,O=>{if(O)return void M(O);this.updateTextureDescriptor(d,m,w);const D=this.textureDescriptorPerLayer.get(m);M(null,D?D.img:null)})}fetchBand(d,m,w,M,O=!0){const D=this._mrt;if(!this._isHeaderLoaded||!D)return void M(new Error("Tile header is not ready"));const B=this.actor;if(!B)return void M(new Error("Can't fetch tile band without an actor"));let V;const Y=i.B(String(w),i.B(this.tileID.key,d));let Q=this._taskQueue.get(Y);Q?Q.add(M):(Q=new Set,Q.add(M),this._taskQueue.set(Y,Q));const ce=(ve,De)=>{V.complete(ve,De),ve?M(ve):(Q.forEach(Pe=>Pe(null,De)),this._taskQueue.delete(Y))},oe=(ve,De)=>{if(ve)return M(ve);const Pe=B.send("decodeRasterArray",{type:"raster-array",source:this.source,scope:this.scope,tileID:this.tileID,uid:this.uid,buffer:De,task:V},ce,void 0,!0);if(m!==null){const Ve=this._workQueuePerLayer.get(m)||[];Ve.push(()=>{Pe&&Pe.cancel(),V.cancel()}),this._workQueuePerLayer.has(m)||this._workQueuePerLayer.set(m,Ve)}};let de;try{de=D.getLayer(d)}catch(ve){if(this.state==="reloading")return;throw ve}if(!de)return void M(new Error(`Unknown sourceLayer "${d}"`));if(de.hasDataForBand(w))return Q.forEach(ve=>ve(null,null)),void this._taskQueue.delete(Y);const we=de.getDataRange([w]);if(V=D.createDecodingTask(we),!V||V.tasks.length)if(m!==null&&this.flushQueues(m),this.entireBuffer)oe(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,oe);if(m!==null){const Pe=this._fetchQueuePerLayer.get(m)||[];Pe.push(()=>{De.cancel(),V.cancel()}),this._fetchQueuePerLayer.has(m)||this._fetchQueuePerLayer.set(m,Pe)}}}updateNeeded(d,m){return(!this.textureDescriptorPerLayer.get(d)||this.textureDescriptorPerLayer.get(d).band!==m||this.refreshedUponExpiration)&&this.state!=="errored"}updateTextureDescriptor(d,m,w){if(!this._mrt)return;const M=this._mrt.getLayer(d);if(!M||!M.hasBand(w)||!M.hasDataForBand(w))return;const{bytes:O,tileSize:D,buffer:B,offset:V,scale:Y}=M.getBandView(w),Q=D+2*B,ce=new i.q({width:Q,height:Q},O),oe=this.texturePerLayer.get(m);oe&&oe instanceof i.T&&oe.update(ce,{premultiply:!1}),this.textureDescriptorPerLayer.set(m,{layer:d,band:w,img:ce,buffer:B,offset:V,tileSize:D,format:M.pixelFormat,mix:[Y,256*Y,65536*Y,16777216*Y]})}destroy(d=!1){if(super.destroy(d),delete this._mrt,!d)for(const m of this.texturePerLayer.values())m&&m instanceof i.T&&m.destroy();this.texturePerLayer.clear(),this.textureDescriptorPerLayer.clear(),this.fbo&&(this.fbo.destroy(),delete this.fbo),delete this.request,delete this.requestParams,this._isHeaderLoaded=!1}}class wy{constructor(d,m){this.max=d,this.onRemove=m,this.reset()}reset(){for(const d in this.data)for(const m of this.data[d])m.timeout&&clearTimeout(m.timeout),this.onRemove(m.value);return this.data={},this.order=[],this}add(d,m,w){const M=d.wrapped().key;this.data[M]===void 0&&(this.data[M]=[]);const O={value:m,timeout:void 0};if(w!==void 0&&(O.timeout=setTimeout(()=>{this.remove(d,O)},w)),this.data[M].push(O),this.order.push(M),this.order.length>this.max){const D=this._getAndRemoveByKey(this.order[0]);D&&this.onRemove(D)}return this}has(d){return d.wrapped().key in this.data}getAndRemove(d){return this.has(d)?this._getAndRemoveByKey(d.wrapped().key):null}_getAndRemoveByKey(d){const m=this.data[d].shift();return m.timeout&&clearTimeout(m.timeout),this.data[d].length===0&&delete this.data[d],this.order.splice(this.order.indexOf(d),1),m.value}getByKey(d){const m=this.data[d];return m?m[0].value:null}get(d){return this.has(d)?this.data[d.wrapped().key][0].value:null}remove(d,m){if(!this.has(d))return this;const w=d.wrapped().key,M=m===void 0?0:this.data[w].indexOf(m),O=this.data[w][M];return this.data[w].splice(M,1),O.timeout&&clearTimeout(O.timeout),this.data[w].length===0&&delete this.data[w],this.onRemove(O.value),this.order.splice(this.order.indexOf(w),1),this}setMaxSize(d){for(this.max=d;this.order.length>this.max;){const m=this._getAndRemoveByKey(this.order[0]);m&&this.onRemove(m)}return this}filter(d){const m=[];for(const w in this.data)for(const M of this.data[w])d(M.value)||m.push(M);for(const w of m)this.remove(w.value.tileID,w)}}class qg{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(d,m,w){const M=String(m);if(this.stateChanges[d]=this.stateChanges[d]||{},this.stateChanges[d][M]=this.stateChanges[d][M]||{},Object.assign(this.stateChanges[d][M],w),this.deletedStates[d]===null){this.deletedStates[d]={};for(const O in this.state[d])O!==M&&(this.deletedStates[d][O]=null)}else if(this.deletedStates[d]&&this.deletedStates[d][M]===null){this.deletedStates[d][M]={};for(const O in this.state[d][M])w[O]||(this.deletedStates[d][M][O]=null)}else for(const O in w)this.deletedStates[d]&&this.deletedStates[d][M]&&this.deletedStates[d][M][O]===null&&delete this.deletedStates[d][M][O]}removeFeatureState(d,m,w){if(this.deletedStates[d]===null)return;const M=String(m);if(this.deletedStates[d]=this.deletedStates[d]||{},w&&m!==void 0)this.deletedStates[d][M]!==null&&(this.deletedStates[d][M]=this.deletedStates[d][M]||{},this.deletedStates[d][M][w]=null);else if(m!==void 0)if(this.stateChanges[d]&&this.stateChanges[d][M])for(w in this.deletedStates[d][M]={},this.stateChanges[d][M])this.deletedStates[d][M][w]=null;else this.deletedStates[d][M]=null;else this.deletedStates[d]=null}getState(d,m){const w=this.state[d]||{},M=this.stateChanges[d]||{},O=this.deletedStates[d];if(O===null)return{};if(m!==void 0){const B=String(m),V=Object.assign({},w[B],M[B]);if(O){const Y=O[m];if(Y===null)return{};for(const Q in Y)delete V[Q]}return V}const D=Object.assign({},w,M);if(O)for(const B in O)delete D[B];return D}initializeTileState(d,m){d.refreshFeatureState(m)}coalesceChanges(d,m){const w={};for(const M in this.stateChanges){this.state[M]=this.state[M]||{};const O={};for(const D in this.stateChanges[M])this.state[M][D]||(this.state[M][D]={}),Object.assign(this.state[M][D],this.stateChanges[M][D]),O[D]=this.state[M][D];w[M]=O}for(const M in this.deletedStates){this.state[M]=this.state[M]||{};const O={};if(this.deletedStates[M]===null)for(const D in this.state[M])O[D]={},this.state[M][D]={};else for(const D in this.deletedStates[M]){if(this.deletedStates[M][D]===null)this.state[M][D]={};else if(this.state[M][D])for(const B of Object.keys(this.deletedStates[M][D]))delete this.state[M][D][B];O[D]=this.state[M][D]}w[M]=w[M]||{},Object.assign(w[M],O)}if(this.stateChanges={},this.deletedStates={},Object.keys(w).length!==0)for(const M in d)d[M].refreshFeatureState(m)}}class Xc extends i.E{constructor(d,m,w){super(),this.id=d,this._onlySymbols=w,m.on("data",M=>{M.dataType==="source"&&M.sourceDataType==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&M.dataType==="source"&&M.sourceDataType==="content"&&(this.reload(),this.transform&&this.update(this.transform))}),m.on("error",()=>{this._sourceErrored=!0}),this._source=m,this._tiles={},this._cache=new wy(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 qg,this._isRaster=this._source.type==="raster"||this._source.type==="raster-dem"||this._source.type==="raster-array"||this._source.type==="custom"&&this._source._dataType==="raster"}onAdd(d){this.map=d,this._minTileCacheSize=this._minTileCacheSize===void 0&&d?d._minTileCacheSize:this._minTileCacheSize,this._maxTileCacheSize=this._maxTileCacheSize===void 0&&d?d._maxTileCacheSize:this._maxTileCacheSize}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;for(const d in this._tiles)if(!this._tiles[d].loaded())return!1;return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const d=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,d&&this.reload(),this.transform&&this.update(this.transform)}_loadTile(d,m){return d.isSymbolTile=this._onlySymbols,d.isExtraShadowCaster=this._shadowCasterTiles[d.tileID.key],this._source.loadTile(d,m)}_unloadTile(d){if(this._source.unloadTile)return this._source.unloadTile(d)}_abortTile(d){if(this._source.abortTile)return this._source.abortTile(d)}serialize(){return this._source.serialize()}prepare(d){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const m in this._tiles){const w=this._tiles[m];w.upload(d,this.map?this.map.painter:void 0),w.prepare(this.map.style.imageManager,this.map?this.map.painter:null,this._source.scope)}}getIds(){return Object.values(this._tiles).map(d=>d.tileID).sort(Vg).map(d=>d.key)}getRenderableIds(d,m){const w=[];for(const M in this._tiles)this._isIdRenderable(+M,d,m)&&w.push(this._tiles[M]);return d?w.sort((M,O)=>{const D=M.tileID,B=O.tileID,V=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-V.y||Y.x-V.x}).map(M=>M.tileID.key):w.map(M=>M.tileID).sort(Vg).map(M=>M.key)}hasRenderableParent(d){const m=this.findLoadedParent(d,0);return!!m&&this._isIdRenderable(m.tileID.key)}_isIdRenderable(d,m,w){return this._tiles[d]&&this._tiles[d].hasData()&&!this._coveredTiles[d]&&(m||!this._tiles[d].holdingForFade())&&(w||!this._shadowCasterTiles[d])}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const d in this._tiles)this._tiles[d].state!=="errored"&&this._reloadTile(+d,"reloading")}}_reloadTile(d,m){const w=this._tiles[d];w&&(w.state!=="loading"&&(w.state=m),this._loadTile(w,this._tileLoaded.bind(this,w,d,m)))}_tileLoaded(d,m,w,M,O){if(M){if(d.state="errored",M.status!==404)this._source.fire(new i.y(M,{tile:d}));else{if(this._source.fire(new i.z("data",{dataType:"source",sourceDataType:"error",sourceId:this._source.id,tile:d})),!(d.tileID.key in this._loadedParentTiles))return;if(this._source.type==="raster-dem"&&this.usedForTerrain&&this.map.painter.terrain){const B=this.map.painter.terrain;this.update(this.transform,B.getScaledDemTileSize(),!0),B.resetTileLookupCache(this.id)}else this.update(this.transform)}return}d.timeAdded=i.o.now(),w==="expired"&&(d.refreshedUponExpiration=!0),this._setTileReloadTimer(m,d),this._source.type==="raster-dem"&&d.dem&&this._backfillDEM(d),this._state.initializeTileState(d,this.map?this.map.painter:null);let D=new Map;O&&O.responseHeaders&&(D=O.responseHeaders),this._source.fire(new i.z("data",{dataType:"source",tile:d,coord:d.tileID,sourceCacheId:this.id,responseHeaders:D}))}_backfillDEM(d){const m=this.getRenderableIds();for(let M=0;M1||(Math.abs(D)>1&&(Math.abs(D+V)===1?D+=V:Math.abs(D-V)===1&&(D-=V)),O.dem&&M.dem&&(M.dem.backfillBorder(O.dem,D,B),M.neighboringTiles&&M.neighboringTiles[Y]&&(M.neighboringTiles[Y].backfilled=!0)))}}getTile(d){return this.getTileByID(d.key)}getTileByID(d){return this._tiles[d]}_retainLoadedChildren(d,m,w,M){for(const O in this._tiles){let D=this._tiles[O];if(M[O]||!D.hasData()||D.tileID.overscaledZ<=m||D.tileID.overscaledZ>w)continue;let B=D.tileID;for(;D&&D.tileID.overscaledZ>m+1;){const Y=D.tileID.scaledTo(D.tileID.overscaledZ-1);D=this._tiles[Y.key],D&&D.hasData()&&(B=Y)}let V=B;for(;V.overscaledZ>m;)if(V=V.scaledTo(V.overscaledZ-1),d[V.key]){M[B.key]=B;break}}}findLoadedParent(d,m){if(d.key in this._loadedParentTiles){const w=this._loadedParentTiles[d.key];return w&&w.tileID.overscaledZ>=m?w:null}for(let w=d.overscaledZ-1;w>=m;w--){const M=d.scaledTo(w),O=this._getLoadedTile(M);if(O)return O}}_getLoadedTile(d){const m=this._tiles[d.key];return m&&m.hasData()?m:this._cache.getByKey(this._source.reparseOverscaled?d.wrapped().key:d.canonical.key)}updateCacheSize(d,m){m=m||this._source.tileSize;const w=Math.ceil(d.width/m)+1,M=Math.ceil(d.height/m)+1,O=Math.floor(w*M*5),D=typeof this._minTileCacheSize=="number"?Math.max(this._minTileCacheSize,O):O,B=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,D):D;this._cache.setMaxSize(B)}handleWrapJump(d){const m=Math.round((d-(this._prevLng===void 0?d:this._prevLng))/360);if(this._prevLng=d,m){const w={};for(const M in this._tiles){const O=this._tiles[M];O.tileID=O.tileID.unwrapTo(O.tileID.wrap+m),w[O.tileID.key]=O}this._tiles=w;for(const M in this._timers)clearTimeout(this._timers[M]),delete this._timers[M];for(const M in this._tiles)this._setTileReloadTimer(+M,this._tiles[M])}}update(d,m,w,M,O){if(this.transform=d,!this._sourceLoaded||this._paused||this.transform.freezeTileCoverage||this.usedForTerrain&&!w)return;this.updateCacheSize(d,m),this.transform.projection.name!=="globe"&&this.handleWrapJump(this.transform.center.lng),this._shadowCasterTiles={},this._coveredTiles={};const D=this._source.type==="batched-model";let B,V=this._source.maxzoom;const Y=this.map&&this.map.painter?this.map.painter._terrain:null;if(Y&&Y.sourceCache===this&&Y.attenuationRange()){const oe=Y.attenuationRange()[0],de=Math.floor(oe)-Math.log2(Y.getDemUpscale());V>de&&(V=de)}if(this.used||this.usedForTerrain){if(this._source.tileID)B=d.getVisibleUnwrappedCoordinates(this._source.tileID).map(oe=>new i.aQ(oe.canonical.z,oe.wrap,oe.canonical.z,oe.canonical.x,oe.canonical.y));else if(this.tileCoverLift!==0){const oe=d.clone();oe.tileCoverLift=this.tileCoverLift,B=oe.coveringTiles({tileSize:m||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:V,roundZoom:this._source.roundZoom&&!w,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain,calculateQuadrantVisibility:D}),this._source.minzoom<=1&&d.projection.name==="globe"&&(B.push(new i.aQ(1,0,1,0,0)),B.push(new i.aQ(1,0,1,1,0)),B.push(new i.aQ(1,0,1,0,1)),B.push(new i.aQ(1,0,1,1,1)))}else if(B=d.coveringTiles({tileSize:m||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:V,roundZoom:this._source.roundZoom&&!w,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain,calculateQuadrantVisibility:D}),this._source.hasTile){const oe=this._source.hasTile.bind(this._source);B=B.filter(de=>oe(de))}}else B=[];if(B.length>0&&this.transform.projection.name!=="globe"&&!this.usedForTerrain&&!Ch(this._source.type)){const oe=d.coveringZoomLevel({tileSize:m||this._source.tileSize,roundZoom:this._source.roundZoom&&!w}),de=Math.min(oe,this._source.maxzoom);if(D){const we=d.extendTileCover(B,de);for(const ve of we)B.push(ve)}else if(O){const we=d.extendTileCoverToNearPlane(B,this.transform.getFrustum(de),de);for(const ve of we)B.push(ve)}else if(this.castsShadows&&M){const we=d.extendTileCover(B,de,M,16);for(const ve of we)this._shadowCasterTiles[ve.key]=!0,B.push(ve)}}const Q=this._updateRetainedTiles(B);if(Ch(this._source.type)&&B.length!==0){const oe={},de={},we=Object.keys(Q);for(const De of we){const Pe=Q[De],Ve=this._tiles[De];if(!Ve||Ve.fadeEndTime&&Ve.fadeEndTime<=i.o.now())continue;const Xe=this.findLoadedParent(Pe,Math.max(Pe.overscaledZ-Xc.maxOverzooming,this._source.minzoom));Xe&&(this._addTile(Xe.tileID),oe[Xe.tileID.key]=Xe.tileID),de[De]=Pe}const ve=B[B.length-1].overscaledZ;for(const De in this._tiles){const Pe=this._tiles[De];if(Q[De]||!Pe.hasData())continue;let Ve=Pe.tileID;for(;Ve.overscaledZ>ve;){Ve=Ve.scaledTo(Ve.overscaledZ-1);const Xe=this._tiles[Ve.key];if(Xe&&Xe.hasData()&&de[Ve.key]){Q[De]=Pe.tileID;break}}}for(const De in oe)Q[De]||(this._coveredTiles[De]=!0,Q[De]=oe[De])}for(const oe in Q)this._tiles[oe].clearFadeHold();const ce=i.bv(this._tiles,Q);for(const oe of ce){const de=this._tiles[oe];de.hasSymbolBuckets&&!de.holdingForFade()?de.setHoldDuration(this.map._fadeDuration):de.hasSymbolBuckets&&!de.symbolFadeFinished()||this._removeTile(+oe)}this._updateLoadedParentTileCache(),this._onlySymbols&&this._source.afterUpdate&&this._source.afterUpdate()}releaseSymbolFadeTiles(){for(const d in this._tiles)this._tiles[d].holdingForFade()&&this._removeTile(+d)}_updateRetainedTiles(d){const m={};if(d.length===0)return m;const w={},M=d.reduce((Y,Q)=>Math.min(Y,Q.overscaledZ),1/0),O=d[0].overscaledZ,D=Math.max(O-Xc.maxOverzooming,this._source.minzoom),B=Math.max(O+Xc.maxUnderzooming,this._source.minzoom),V={};for(const Y of d){const Q=this._addTile(Y);m[Y.key]=Y,Q.hasData()||M=this._source.maxzoom){const oe=Y.children(this._source.maxzoom)[0],de=this.getTile(oe);if(de&&de.hasData()){m[oe.key]=oe;continue}}else{const oe=Y.children(this._source.maxzoom);if(m[oe[0].key]&&m[oe[1].key]&&m[oe[2].key]&&m[oe[3].key])continue}let ce=Q.wasRequested();for(let oe=Y.overscaledZ-1;oe>=D;--oe){const de=Y.scaledTo(oe);if(w[de.key]||(w[de.key]=!0,Q=this.getTile(de),!Q&&ce&&(Q=this._addTile(de)),Q&&(m[de.key]=de,ce=Q.wasRequested(),Q.hasData())))break}}return m}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const d in this._tiles){const m=[];let w,M=this._tiles[d].tileID;for(;M.overscaledZ>0;){if(M.key in this._loadedParentTiles){w=this._loadedParentTiles[M.key];break}m.push(M.key);const O=M.scaledTo(M.overscaledZ-1);if(w=this._getLoadedTile(O),w)break;M=O}for(const O of m)this._loadedParentTiles[O]=w}}_addTile(d){let m=this._tiles[d.key];if(m)return m.isExtraShadowCaster!==!0||this._shadowCasterTiles[d.key]||this._reloadTile(d.key,"reloading"),m;m=this._cache.getAndRemove(d),m&&(this._setTileReloadTimer(d.key,m),m.tileID=d,this._state.initializeTileState(m,this.map?this.map.painter:null),this._cacheTimers[d.key]&&(clearTimeout(this._cacheTimers[d.key]),delete this._cacheTimers[d.key],this._setTileReloadTimer(d.key,m)));const w=!!m;if(!w){const M=this.map?this.map.painter:null,O=this._source.tileSize*d.overscaleFactor();m=this._source.type==="raster-array"?new hp(d,O,this.transform.tileZoom,M,this._isRaster):new up(d,O,this.transform.tileZoom,M,this._isRaster,this._source.worldview),this._loadTile(m,this._tileLoaded.bind(this,m,d.key,m.state))}return m.uses++,this._tiles[d.key]=m,w||this._source.fire(new i.z("dataloading",{tile:m,coord:m.tileID,dataType:"source"})),m}_setTileReloadTimer(d,m){d in this._timers&&(clearTimeout(this._timers[d]),delete this._timers[d]);const w=m.getExpiryTimeout();w&&(this._timers[d]=setTimeout(()=>{this._reloadTile(d,"expired"),delete this._timers[d]},w))}_removeTile(d){const m=this._tiles[d];m&&(m.uses--,delete this._tiles[d],this._timers[d]&&(clearTimeout(this._timers[d]),delete this._timers[d]),m.uses>0||(m.hasData()&&m.state!=="reloading"||m.state==="empty"?this._cache.add(m.tileID,m,m.getExpiryTimeout()):(m.aborted=!0,this._abortTile(m),this._unloadTile(m))))}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const d in this._tiles)this._removeTile(+d);this._source._clear&&this._source._clear(),this._cache.reset(),this.map&&this.usedForTerrain&&this.map.painter.terrain&&this.map.painter.terrain.resetTileLookupCache(this.id)}tilesIn(d,m,w){const M=[],O=this.transform;if(!O)return M;const D=O.projection.name==="globe",B=i.aF(O.center.lng);for(const V in this._tiles){const Y=this._tiles[V];if(w&&Y.clearQueryDebugViz(),Y.holdingForFade())continue;let Q;if(D){const ce=Y.tileID.canonical;if(ce.z===0){const oe=[Math.abs(i.aA(B,...Mh(ce,-1))-B),Math.abs(i.aA(B,...Mh(ce,1))-B)];Q=[0,2*oe.indexOf(Math.min(...oe))-1]}else{const oe=[Math.abs(i.aA(B,...Mh(ce,-1))-B),Math.abs(i.aA(B,...Mh(ce,0))-B),Math.abs(i.aA(B,...Mh(ce,1))-B)];Q=[oe.indexOf(Math.min(...oe))-1]}}else Q=[0];for(const ce of Q){const oe=d.containsTile(Y,O,m,ce);oe&&M.push(oe)}}return M}getShadowCasterCoordinates(){return this._getRenderableCoordinates(!1,!0)}getVisibleCoordinates(d){return this._getRenderableCoordinates(d)}_getRenderableCoordinates(d,m){const w=this.getRenderableIds(d,m).map(O=>this._tiles[O].tileID),M=this.transform.projection.name==="globe";for(const O of w)O.projMatrix=this.transform.calculateProjMatrix(O.toUnwrapped()),O.expandedProjMatrix=M?this.transform.calculateProjMatrix(O.toUnwrapped(),!1,!0):O.projMatrix;return w}sortCoordinatesByDistance(d){const m=d.slice(),w=this.transform._camera.position,M=this.transform._camera.forward(),O={};for(const D of m){const B=1/(1<O[D.key]-O[B.key]),m}hasTransition(){if(this._source.hasTransition())return!0;if(Ch(this._source.type))for(const d in this._tiles){const m=this._tiles[d];if(m.fadeEndTime!==void 0&&m.fadeEndTime>=i.o.now())return!0}return!1}setFeatureState(d,m,w){this._state.updateState(d=d||"_geojsonTileLayer",m,w)}removeFeatureState(d,m,w){this._state.removeFeatureState(d=d||"_geojsonTileLayer",m,w)}getFeatureState(d,m){return this._state.getState(d=d||"_geojsonTileLayer",m)}setDependencies(d,m,w){const M=this._tiles[d];M&&M.setDependencies(m,w)}reloadTilesForDependencies(d,m){for(const w in this._tiles)this._tiles[w].hasDependency(d,m)&&this._reloadTile(+w,"reloading");this._cache.filter(w=>!w.hasDependency(d,m))}_preloadTiles(d,m){if(!this._sourceLoaded){const V=()=>{this._sourceLoaded&&(this._source.off("data",V),this._preloadTiles(d,m))};return void this._source.on("data",V)}const w=new Map,M=Array.isArray(d)?d:[d],O=this.map.painter.terrain,D=this.usedForTerrain&&O?O.getScaledDemTileSize():this._source.tileSize;for(const V of M){const Y=V.coveringTiles({tileSize:D,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom&&!this.usedForTerrain,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain});for(const Q of Y)w.set(Q.key,Q);this.usedForTerrain&&V.updateElevation(!1)}const B=Array.from(w.values());i.bw(B,(V,Y)=>{const Q=new up(V,this._source.tileSize*V.overscaleFactor(),this.transform.tileZoom,this.map.painter,this._isRaster,this._source.worldview);this._loadTile(Q,ce=>{this._source.type==="raster-dem"&&Q.dem&&this._backfillDEM(Q),Y(ce,Q)})},m)}}function Vg(_,d){const m=Math.abs(2*_.wrap)-+(_.wrap<0),w=Math.abs(2*d.wrap)-+(d.wrap<0);return _.overscaledZ-d.overscaledZ||w-m||d.canonical.y-_.canonical.y||d.canonical.x-_.canonical.x}function Ch(_){return _==="raster"||_==="image"||_==="video"||_==="custom"}function Mh(_,d){const m=1<<_.z;return[_.x/m+d,(_.x+1)/m+d]}Xc.maxOverzooming=10,Xc.maxUnderzooming=3;class C3{constructor(d){this.style=d,this.layersGotHidden=!1,this.layers=[]}processLayersChanged(){this.layers=[];const d=!1,m=!1;for(const w in this.style._mergedLayers){const M=this.style._mergedLayers[w];if(M.type==="fill-extrusion"||M.type==="building")this.layers.push({layer:M,visible:d,visibilityChanged:m});else if(M.type==="model"){const O=this.style.getLayerSource(M);O&&O.type==="batched-model"&&this.layers.push({layer:M,visible:d,visibilityChanged:m})}}}onNewFrame(d){this.layersGotHidden=!1;for(const m of this.layers){const w=m.layer;let M=!1;w.type==="fill-extrusion"?M=!w.isHidden(d)&&w.paint.get("fill-extrusion-opacity")>0:w.type==="building"?M=!w.isHidden(d)&&w.paint.get("building-opacity")>0:w.type==="model"&&(M=!w.isHidden(d)&&w.paint.get("model-opacity").constantOr(1)>0),this.layersGotHidden=this.layersGotHidden||!M&&m.visible,m.visible=M}}updateZOffset(d,m){this.currentBuildingBuckets=[];for(const M of this.layers){const O=M.layer,D=this.style.getLayerSourceCache(O);let B=1;O.type==="fill-extrusion"?B=M.visible?O.paint.get("fill-extrusion-vertical-scale"):0:O.type==="building"&&(B=M.visible?O.paint.get("building-vertical-scale"):0);let V=D?D.getTile(m):null;if(!V&&D)for(const Y in D._tiles){const Q=D._tiles[Y];if(m.canonical.isChildOf(Q.tileID.canonical)){V=Q;break}}this.currentBuildingBuckets.push({bucket:V?V.getBucket(O):null,tileID:V?V.tileID:m,verticalScale:B})}d.hasAnyZOffset=!1;let w=!1;for(let M=0;M{w in d&&(m[w]=d[w])}),m}function gf(_){_=_.slice();const d=Object.create(null);for(let m=0;m<_.length;m++)d[_[m].id]=_[m];for(let m=0;m<_.length;m++)"ref"in _[m]&&(_[m]=mk(_[m],d[_[m].ref]));return _}const Ys={setStyle:"setStyle",addLayer:"addLayer",removeLayer:"removeLayer",setPaintProperty:"setPaintProperty",setLayoutProperty:"setLayoutProperty",setSlot:"setSlot",setFilter:"setFilter",addSource:"addSource",removeSource:"removeSource",setGeoJSONSourceData:"setGeoJSONSourceData",setLayerZoomRange:"setLayerZoomRange",setLayerProperty:"setLayerProperty",setCenter:"setCenter",setZoom:"setZoom",setBearing:"setBearing",setPitch:"setPitch",setSprite:"setSprite",setGlyphs:"setGlyphs",setTransition:"setTransition",setLight:"setLight",setTerrain:"setTerrain",setFog:"setFog",setSnow:"setSnow",setRain:"setRain",setCamera:"setCamera",setLights:"setLights",setProjection:"setProjection",addImport:"addImport",removeImport:"removeImport",updateImport:"updateImport",addIconset:"addIconset",removeIconset:"removeIconset"};function jy(_,d,m){m.push({command:Ys.addSource,args:[_,d[_]]})}function mv(_,d,m){d.push({command:Ys.removeSource,args:[_]}),m[_]=!0}function gk(_,d,m,w){mv(_,m,w),jy(_,d,m)}function xk(_,d,m){let w;for(w in _[m])if(_[m].hasOwnProperty(w)&&w!=="data"&&!i.by(_[m][w],d[m][w]))return!1;for(w in d[m])if(d[m].hasOwnProperty(w)&&w!=="data"&&!i.by(_[m][w],d[m][w]))return!1;return!0}function Th(_,d,m,w,M,O){let D;for(D in d=d||{},_=_||{})_.hasOwnProperty(D)&&(i.by(_[D],d[D])||m.push({command:O,args:[w,D,d[D],M]}));for(D in d)d.hasOwnProperty(D)&&!_.hasOwnProperty(D)&&(i.by(_[D],d[D])||m.push({command:O,args:[w,D,d[D],M]}))}function Hg(_){return _.id}function jt(_,d){return _[d.id]=d,_}function gr(_,d,m){const w=d.createTileMatrix(_,_.worldSize,m.toUnwrapped());return i.aB(new Float32Array(16),_.projMatrix,w)}function Pr(_,d,m){if(d.projection.name===m.projection.name)return _.projMatrix;const w=m.clone();return w.setProjection(d.projection),gr(w,d.getProjection(),_)}function Hn(_,d,m){return d.name===m.projection.name?_.projMatrix:gr(m,d,_)}class ts{constructor(d,m){this.reset(d,m)}reset(d,m){this.points=d||[],this._distances=[0];for(let w=1;w0?(M-D)/B:0;return this.points[O].mult(1-V).add(this.points[m].mult(V))}}class Na{constructor(d,m,w){const M=this.boxCells=[],O=this.circleCells=[];this.xCellCount=Math.ceil(d/w),this.yCellCount=Math.ceil(m/w);for(let D=0;Dthis.width||M<0||m>this.height)return!O&&[];const B=[];if(d<=0&&m<=0&&this.width<=w&&this.height<=M){if(O)return!0;for(let V=0;V0:B}_queryCircle(d,m,w,M,O){const D=d-w,B=d+w,V=m-w,Y=m+w;if(B<0||D>this.width||Y<0||V>this.height)return!M&&[];const Q=[];return this._forEachCell(D,V,B,Y,this._queryCellCircle,Q,{hitTest:M,circle:{x:d,y:m,radius:w},seenUids:{box:{},circle:{}}},O),M?Q.length>0:Q}query(d,m,w,M,O){return this._query(d,m,w,M,!1,O)}hitTest(d,m,w,M,O){return this._query(d,m,w,M,!0,O)}hitTestCircle(d,m,w,M){return this._queryCircle(d,m,w,!0,M)}_queryCell(d,m,w,M,O,D,B,V){const Y=B.seenUids,Q=this.boxCells[O];if(Q!==null){const oe=this.bboxes;for(const de of Q)if(!Y.box[de]){Y.box[de]=!0;const we=4*de;if(d<=oe[we+2]&&m<=oe[we+3]&&w>=oe[we+0]&&M>=oe[we+1]&&(!V||V(this.boxKeys[de]))){if(B.hitTest)return D.push(!0),!0;D.push({key:this.boxKeys[de],x1:oe[we],y1:oe[we+1],x2:oe[we+2],y2:oe[we+3]})}}}const ce=this.circleCells[O];if(ce!==null){const oe=this.circles;for(const de of ce)if(!Y.circle[de]){Y.circle[de]=!0;const we=3*de;if(this._circleAndRectCollide(oe[we],oe[we+1],oe[we+2],d,m,w,M)&&(!V||V(this.circleKeys[de]))){if(B.hitTest)return D.push(!0),!0;{const ve=oe[we],De=oe[we+1],Pe=oe[we+2];D.push({key:this.circleKeys[de],x1:ve-Pe,y1:De-Pe,x2:ve+Pe,y2:De+Pe})}}}}}_queryCellCircle(d,m,w,M,O,D,B,V){const Y=B.circle,Q=B.seenUids,ce=this.boxCells[O];if(ce!==null){const de=this.bboxes;for(const we of ce)if(!Q.box[we]){Q.box[we]=!0;const ve=4*we;if(this._circleAndRectCollide(Y.x,Y.y,Y.radius,de[ve+0],de[ve+1],de[ve+2],de[ve+3])&&(!V||V(this.boxKeys[we])))return D.push(!0),!0}}const oe=this.circleCells[O];if(oe!==null){const de=this.circles;for(const we of oe)if(!Q.circle[we]){Q.circle[we]=!0;const ve=3*we;if(this._circlesCollide(de[ve],de[ve+1],de[ve+2],Y.x,Y.y,Y.radius)&&(!V||V(this.circleKeys[we])))return D.push(!0),!0}}}_forEachCell(d,m,w,M,O,D,B,V){const Y=this._convertToXCellCoord(d),Q=this._convertToYCellCoord(m),ce=this._convertToXCellCoord(w),oe=this._convertToYCellCoord(M);for(let de=Y;de<=ce;de++)for(let we=Q;we<=oe;we++)if(O.call(this,d,m,w,M,this.xCellCount*we+de,D,B,V))return}_convertToXCellCoord(d){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(d*this.xScale)))}_convertToYCellCoord(d){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(d*this.yScale)))}_circlesCollide(d,m,w,M,O,D){const B=M-d,V=O-m,Y=w+D;return Y*Y>B*B+V*V}_circleAndRectCollide(d,m,w,M,O,D,B){const V=(D-M)/2,Y=Math.abs(d-(M+V));if(Y>V+w)return!1;const Q=(B-O)/2,ce=Math.abs(m-(O+Q));if(ce>Q+w)return!1;if(Y<=V||ce<=Q)return!0;const oe=Y-V,de=ce-Q;return oe*oe+de*de<=w*w}}const ra={unknown:0,flipRequired:1,flipNotRequired:2},pi=Math.tan(85*Math.PI/180);function gl(_,d,m,w,M,O,D){const B=i.bC();if(m)if(O.name==="globe"){const V=i.bD(M,d);i.aB(B,B,V)}else{const V=i.bE([],D);B[0]=V[0],B[1]=V[1],B[4]=V[2],B[5]=V[3],w||i.bB(B,B,M.angle)}else i.aB(B,M.labelPlaneMatrix,_);return B}function fp(_,d,m,w,M,O,D){const B=gl(_,d,m,w,M,O,D);return O.name==="globe"&&m||(B[2]=B[6]=B[10]=B[14]=0),B}function pp(_,d,m,w,M,O,D){if(m){if(O.name==="globe"){const B=gl(_,d,m,w,M,O,D);return i.bl(B,B),i.aB(B,_,B),B}{const B=i.bz(_),V=i.bA([]);return V[0]=D[0],V[1]=D[1],V[4]=D[2],V[5]=D[3],i.aB(B,B,V),w||i.bB(B,B,-M.angle),B}}return M.glCoordMatrix}function Vd(_,d,m,w){const M=[_,d,m,1];m?i.aC(M,M,w):mn(M,M,w);const O=M[3];return M[0]/=O,M[1]/=O,M[2]/=O,M}function Sa(_,d){return Math.min(.5+_/d*.5,1.5)}function HI(_,d){const m=_[0]/_[3],w=_[1]/_[3];return m>=-d[0]&&m<=d[0]&&w>=-d[1]&&w<=d[1]}function WI(_,d,m,w,M,O,D,B,V,Y,Q=1){const ce=m.transform,oe=w?_.textSizeData:_.iconSizeData,de=i.bK(oe,m.transform.zoom,Q),we=ce.projection.name==="globe",ve=[256/m.width*2+1,256/m.height*2+1],De=w?_.text.dynamicLayoutVertexArray:_.icon.dynamicLayoutVertexArray;De.clear();let Pe=null;we&&(Pe=w?_.text.globeExtVertexArray:_.icon.globeExtVertexArray);const Ve=_.lineVertexArray,Xe=w?_.text.placedSymbolArray:_.icon.placedSymbolArray,We=m.transform.width/m.transform.height;let bt,ut=!1;for(let xt=0;xtMath.abs(m)?{useVertical:!0}:_===i.bL.vertical?w>0?{needsFlipping:!0}:null:d!==ra.unknown&&function(M,O){return M===0||Math.abs(O/M)>pi}(m,w)?d===ra.flipRequired?{needsFlipping:!0}:null:m<0?{needsFlipping:!0}:null}function M3(_,d,m,w,M,O,D,B,V,Y,Q,ce,oe,de,we,ve,De,Pe,Ve,Xe){const We=d/24,bt=_.lineOffsetX*We,ut=_.lineOffsetY*We,{lineStartIndex:xt,glyphStartIndex:ct,numGlyphs:it,segment:St,writingMode:Dt,flipState:Lt}=_,Ht=xt+_.lineLength,Wt=sr=>{if(Q){const[Jt,qt,dr]=sr.up,Tr=Y.length;i.bN(Q,Tr+0,Jt,qt,dr),i.bN(Q,Tr+1,Jt,qt,dr),i.bN(Q,Tr+2,Jt,qt,dr),i.bN(Q,Tr+3,Jt,qt,dr)}const[_r,Bt,Tt]=sr.point;i.bO(Y,_r,Bt,Tt,sr.angle)};if(it>1){const sr=GI(We,B,bt,ut,m,ce,oe,_,V,O,de,ve,!1,De,Pe,Ve,Xe);if(!sr)return{notEnoughRoom:!0};if(w&&!m){let[_r,Bt,Tt]=sr.first.point,[Jt,qt,dr]=sr.last.point;[_r,Bt]=Vd(_r,Bt,Tt,D),[Jt,qt]=Vd(Jt,qt,dr,D);const Tr=Fn(Dt,Lt,(Jt-_r)*we,qt-Bt);if(_.flipState=Tr&&Tr.needsFlipping?ra.flipRequired:ra.flipNotRequired,Tr)return Tr}Wt(sr.first);for(let _r=ct+1;_r0?Jt:Yu(oe,Tt,_r,1,M,void 0,De,Pe.canonical),dr=Fn(Dt,Lt,(qt[0]-_r[0])*we,qt[1]-_r[1]);if(_.flipState=dr&&dr.needsFlipping?ra.flipRequired:ra.flipNotRequired,dr)return dr}const sr=ky(We*B.getoffsetX(ct),bt,ut,m,ce,oe,St,xt,Ht,V,O,de,ve,!1,!1,De,Pe,Ve,Xe);if(!sr)return{notEnoughRoom:!0};Wt(sr)}return{}}function gv(_,d,m,w,M){const{x:O,y:D,z:B}=w.projectTilePoint(_.x,_.y,d);if(!M)return Vd(O,D,B,m);const[V,Y,Q]=M.getElevation(_,M.elevation,M.elevationFeature);return Vd(O+V,D+Y,B+Q,m)}function Yu(_,d,m,w,M,O,D,B){const V=gv(_.sub(d)._unit()._add(_),B,M,D,O);return i.av(V,m,V),i.aw(V,V),i.bH(V,m,V,w)}function ky(_,d,m,w,M,O,D,B,V,Y,Q,ce,oe,de,we,ve,De,Pe,Ve){const Xe=w?_-d:_+d;let We=Xe>0?1:-1,bt=0;w&&(We*=-1,bt=Math.PI),We<0&&(bt+=Math.PI);let ut=B+D+(We>0?0:1)|0,xt=M,ct=M,it=0,St=0;const Dt=Math.abs(Xe),Lt=[],Ht=[];let Wt=O,sr=Wt,_r=i.bF([]);const Bt=()=>Yu(sr,Wt,ct,Dt-it+1,Q,oe,ve,De.canonical);for(;it+St<=Dt;){if(ut+=We,ut=V)return null;if(ct=xt,sr=Wt,Lt.push(ct),de&&Ht.push(sr),Wt=new i.P(Y.getx(ut),Y.gety(ut)),xt=ce[ut],!xt){const Jr=gv(Wt,De.canonical,Q,ve,oe);xt=Jr[3]>0?ce[ut]=Jr:Bt()}it+=St;const br=i.av([],xt,ct),nn=i.bG(ct,xt);if(m&&nn>0&&St>0&&i.bJ(_r,br)/(St*nn)0,Xe),xt=Y*ut.perspectiveRatio,ct=(w.x1*m+B.x-w.padding)*xt+ut.point.x,it=(w.y1*m+B.y-w.padding)*xt+ut.point.y,St=(w.x2*m+B.x+w.padding)*xt+ut.point.x,Dt=(w.y2*m+B.y+w.padding)*xt+ut.point.y,Lt=ut.perspectiveRatio<=.55||ut.occluded;return!this.isInsideGrid(ct,it,St,Dt)||!V&&this.grid.hitTest(ct,it,St,Dt,ce)||Lt?{box:[],offscreen:!1,occluded:ut.occluded}:{box:[ct,it,St,Dt],offscreen:this.isOffscreen(ct,it,St,Dt),occluded:!1}}placeCollisionCircles(d,m,w,M,O,D,B,V,Y,Q,ce,oe,de,we,ve,De){const Pe=[],Ve=this.transform.elevation,Xe=d.getProjection(),We=d.elevationType==="road",bt=!!Ve||We,ut=i.bV.getAtTileOffsetFunc(De,this.transform.center.lat,this.transform.worldSize,Xe),xt=new i.P(w.tileAnchorX,w.tileAnchorY),ct=new i.P(w.tileAnchorX,w.tileAnchorY);let{x:it,y:St,z:Dt}=Xe.projectTilePoint(ct.x,ct.y,De.canonical),Lt=null;if(bt){const nn=We?d.getElevationFeatureForText(M):null;Lt={getElevation:ut,elevation:Ve,elevationFeature:nn};const[Jr,zr,Gr]=ut(xt,Ve,nn);it+=Jr,St+=zr,Dt+=Gr}const Ht=Xe.name==="globe",Wt=this.projectAndGetPerspectiveRatio(V,it,St,Dt,De,Ht||!!Ve||this.transform.pitch>0,Xe),{perspectiveRatio:sr}=Wt,_r=(oe?B/sr:B*sr)/i.bY,Bt=Vd(it,St,Dt,Y),Tt=w.lineOffsetX*_r,Jt=w.lineOffsetY*_r,qt=i.an(d.layers[0].layout.get("text-max-angle")),dr=Math.cos(qt),Tr=Wt.signedDistanceFromCamera>0?GI(_r,D,Tt,Jt,We&&w.flipState===1,Bt,ct,w,O,Y,{},bt&&!oe?Lt:null,oe&&bt,Xe,De,oe,dr):null;let Hr=!1,Nr=!1,br=!0;if(Tr&&!Wt.occluded){const nn=.5*we*sr+ve,Jr=new i.P(-100,-100),zr=new i.P(this.screenRightBoundary,this.screenBottomBoundary),Gr=new ts,{first:kn,last:Yn}=Tr,Os=kn.path.length;let ha=[];for(let Wn=Os-1;Wn>=1;Wn--)ha.push(kn.path[Wn]);for(let Wn=1;Wn(bt&&!Ht&&(Ra=ut(CaWn[3]<=0)&&(ha=[]));let ia=[];if(ha.length>0){let Wn=1/0,ya=-1/0,Ra=1/0,Ca=-1/0;for(const sa of ha)Wn=Math.min(Wn,sa[0]),Ra=Math.min(Ra,sa[1]),ya=Math.max(ya,sa[0]),Ca=Math.max(Ca,sa[1]);ya>=Jr.x&&Wn<=zr.x&&Ca>=Jr.y&&Ra<=zr.y&&(ia=[ha.map(sa=>new i.P(sa[0],sa[1]))],(Wnzr.x||Razr.y)&&(ia=i.bW(ia,Jr.x,Jr.y,zr.x,zr.y)))}for(const Wn of ia){Gr.reset(Wn,.25*nn);let ya=0;ya=Gr.length<=.5*nn?1:Math.ceil(Gr.paddedLength/on)+1;for(let Ra=0;Ra0?(i.aC(V,V,d),this.fogState&&O&&B.name!=="globe"&&(Y=function(oe,de,we,ve,De,Pe){const Ve=Pe.calculateFogTileMatrix(De),Xe=[de,we,ve];return i.af(Xe,Xe,Ve),Wr(oe,i.ag(Xe),Pe.pitch,Pe._fov)}(this.fogState,m,w,M,O.toUnwrapped(),this.transform)>.9)):mn(V,V,d);const Q=V[3];return{point:new i.P((V[0]/Q+1)/2*this.transform.width+Gs,(-V[1]/Q+1)/2*this.transform.height+Gs),perspectiveRatio:Math.min(.5+this.transform.getCameraToCenterDistance(B)/Q*.5,1.5),signedDistanceFromCamera:Q,occluded:D&&V[2]>Q||Y}}isOffscreen(d,m,w,M){return w=this.screenRightBoundary||Mthis.screenBottomBoundary}isInsideGrid(d,m,w,M){return w>=0&&d=0&&mw.collisionGroupID===m}}return this.collisionGroups[d]}}function yc(_,d,m,w,M){const{horizontalAlign:O,verticalAlign:D}=i.c1(_),B=-(O-.5)*d,V=-(D-.5)*m,Y=i.c2(_,w);return new i.P(B+Y[0]*M,V+Y[1]*M)}function Ao(_,d,m,w,M){const O=new i.P(_,d);return m&&O._rotate(w?M:-M),O}class $ae{constructor(d,m,w,M,O,D){this.transform=d.clone(),this.projection=d.projection.name,this.collisionIndex=new Da(this.transform,O),this.buildingIndex=D,this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=m,this.retainedQueryData={},this.collisionGroups=new yv(w),this.collisionCircleArrays={},this.prevPlacement=M,M&&(M.prevPlacement=void 0),this.placedOrientations={},this.lastReplacementSourceUpdateTime=0}getBucketParts(d,m,w,M,O=1){const D=w.getBucket(m),B=w.latestFeatureIndex;if(!D||!B||m.fqid!==D.layerIds[0])return;const V=D.layers[0].layout,Y=D.layers[0].paint,Q=w.collisionBoxArray,ce=Math.pow(2,this.transform.zoom-w.tileID.overscaledZ),oe=w.tileSize/i.al,de=w.tileID.toUnwrapped();this.transform.setProjection(D.projection);const we=(ve=w.tileID,De=D.getProjection(),Pe=this.transform,De.name===this.projection?Pe.calculateProjMatrix(ve.toUnwrapped()):gr(Pe,De,ve));var ve,De,Pe;const Ve=V.get("text-pitch-alignment")==="map",Xe=V.get("text-rotation-alignment")==="map";m.compileFilter(m.options);const We=m.dynamicFilter(),bt=m.dynamicFilterNeedsFeature(),ut=this.transform.calculatePixelsToTileUnitsMatrix(w),xt=fp(we,w.tileID.canonical,Ve,Xe,this.transform,D.getProjection(),ut);let ct=null;const it=D.getProjection().createInversionMatrix(this.transform,w.tileID.canonical);if(Ve){const Tt=pp(we,w.tileID.canonical,Ve,Xe,this.transform,D.getProjection(),ut);ct=i.aB([],this.transform.labelPlaneMatrix,Tt)}let St=null;We&&w.latestFeatureIndex&&(St={unwrappedTileID:de,dynamicFilter:We,dynamicFilterNeedsFeature:bt}),this.retainedQueryData[D.bucketInstanceId]=new xv(D.bucketInstanceId,B,D.sourceLayerIndex,D.index,w.tileID);const[Dt,Lt]=D.layers[0].layout.get("text-size-scale-range"),Ht=i.aA(O,Dt,Lt),[Wt,sr]=V.get("icon-size-scale-range"),_r=i.aA(O,Wt,sr),Bt={bucket:D,layout:V,paint:Y,posMatrix:we,invMatrix:it,mercatorCenter:[i.aF(this.transform.center.lng),i.aJ(this.transform.center.lat)],textLabelPlaneMatrix:xt,labelToScreenMatrix:ct,clippingData:St,scale:ce,textPixelRatio:oe,holdingForFade:w.holdingForFade(),collisionBoxArray:Q,partiallyEvaluatedTextSize:i.bK(D.textSizeData,this.transform.zoom,Ht),partiallyEvaluatedIconSize:i.bK(D.iconSizeData,this.transform.zoom,_r),collisionGroup:this.collisionGroups.get(D.sourceID),latestFeatureIndex:w.latestFeatureIndex};if(M)for(const Tt of D.sortKeyRanges){const{sortKey:Jt,symbolInstanceStart:qt,symbolInstanceEnd:dr}=Tt;d.push({sortKey:Jt,symbolInstanceStart:qt,symbolInstanceEnd:dr,parameters:Bt})}else d.push({symbolInstanceStart:0,symbolInstanceEnd:D.symbolInstances.length,parameters:Bt})}attemptAnchorPlacement(d,m,w,M,O,D,B,V,Y,Q,ce,oe,de,we,ve,De,Pe,Ve,Xe,We,bt){const{textOffset0:ut,textOffset1:xt,crossTileID:ct}=ve,it=[ut,xt],St=yc(d,D,B,it,V),Dt=this.collisionIndex.placeCollisionBox(Pe,V,m,w,M,O,Ao(St.x,St.y,Y,Q,this.transform.angle),we,ce,oe,de.predicate);if(Xe){const Lt=Pe.getSymbolInstanceIconSize(bt,this.transform.zoom,ve.placedIconSymbolIndex);if(this.collisionIndex.placeCollisionBox(Pe,Lt,Xe,w,M,O,Ao(St.x,St.y,Y,Q,this.transform.angle),we,ce,oe,de.predicate).box.length===0)return}if(Dt.box.length>0){let Lt;return this.prevPlacement&&this.prevPlacement.variableOffsets[ct]&&this.prevPlacement.placements[ct]&&this.prevPlacement.placements[ct].text&&(Lt=this.prevPlacement.variableOffsets[ct].anchor),this.variableOffsets[ct]={textOffset:it,width:D,height:B,anchor:d,textScale:V,prevAnchor:Lt},this.markUsedJustification(Pe,d,ve,Ve),Pe.allowVerticalPlacement&&(this.markUsedOrientation(Pe,Ve,ve),this.placedOrientations[ct]=Ve),{shift:St,placedGlyphBoxes:Dt}}}placeLayerBucketPart(d,m,w,M,O=1){const{bucket:D,layout:B,paint:V,posMatrix:Y,textLabelPlaneMatrix:Q,labelToScreenMatrix:ce,clippingData:oe,textPixelRatio:de,mercatorCenter:we,invMatrix:ve,holdingForFade:De,collisionBoxArray:Pe,partiallyEvaluatedTextSize:Ve,partiallyEvaluatedIconSize:Xe,collisionGroup:We,latestFeatureIndex:bt}=d.parameters,ut=B.get("text-optional"),xt=B.get("icon-optional"),ct=B.get("text-allow-overlap"),it=B.get("icon-allow-overlap"),St=B.get("text-rotation-alignment")==="map",Dt=B.get("icon-rotation-alignment")==="map",Lt=B.get("text-pitch-alignment")==="map",Ht=V.get("symbol-z-offset"),Wt=B.get("symbol-elevation-reference")==="sea",sr=B.get("symbol-placement"),[_r,Bt]=B.get("text-size-scale-range"),[Tt,Jt]=B.get("icon-size-scale-range"),qt=i.aA(O,_r,Bt),dr=i.aA(O,Tt,Jt),Tr=B.get("text-variable-anchor"),Hr=St&&sr!=="point",Nr=Dt&&sr!=="point",br=Tr&&D.hasTextData(),nn=D.hasIconTextFit()&&br&&D.hasIconData();this.transform.setProjection(D.projection);const Jr=br||Hr,zr=Nr||nn;let Gr=ct&&(it||!D.hasIconData()||xt),kn=it&&(ct||!D.hasTextData()||ut);const Yn=!Ht.isConstant();!D.collisionArrays&&Pe&&D.deserializeCollisionBoxes(Pe),w&&M&&D.updateCollisionDebugBuffers(this.transform.zoom,Pe,qt,dr);const Os=(on,ia,Wn)=>{const{crossTileID:ya,numVerticalGlyphVertices:Ra}=on;let Ca=null;if(oe&&oe.dynamicFilterNeedsFeature||Yn){const Gi=this.retainedQueryData[D.bucketInstanceId];Ca=bt.loadFeature({featureIndex:on.featureIndex,bucketIndex:Gi.bucketIndex,sourceLayerIndex:Gi.sourceLayerIndex,layoutVertexArrayOffset:0});const io=Ca.properties?Ca.properties.worldview:null;if(D.localizable&&D.worldview&&typeof io=="string")if(io==="all")Ca.properties.$localized=!0;else{if(!io.split(",").includes(D.worldview))return;Ca.properties.$localized=!0,Ca.properties.worldview=D.worldview}}if(oe&&!(0,oe.dynamicFilter)({zoom:this.transform.zoom,pitch:this.transform.pitch,worldview:D.worldview},Ca,this.retainedQueryData[D.bucketInstanceId].tileID.canonical,new i.P(on.tileAnchorX,on.tileAnchorY),this.transform.calculateDistanceTileData(oe.unwrappedTileID)))return this.placements[ya]=new ja(!1,!1,!1,!0),void m.add(ya);const sa=Ht.evaluate(Ca,{});if(m.has(ya))return;if(De)return void(this.placements[ya]=new ja(!1,!1,!1));let is=!1,ga=!1,$i=!0,gi=!1,va=!1,Qs=null,ls={box:null,offscreen:null,occluded:null},ii={box:null},eo=null,Di=null,Ha=null,nd=0,nc=0,Vo=0;Wn.textFeatureIndex?nd=Wn.textFeatureIndex:on.useRuntimeCollisionCircles&&(nd=on.featureIndex),Wn.verticalTextFeatureIndex&&(nc=Wn.verticalTextFeatureIndex);const _c=D.elevationFeatures?D.elevationFeatures[on.elevationFeatureIndex]:void 0,bc=Gi=>{Gi.tileID=this.retainedQueryData[D.bucketInstanceId].tileID;const io=this.transform.elevation;Gi.elevation=Wt?sa:sa+i.bV.getAtTileOffset(Gi.tileID,new i.P(Gi.tileAnchorX,Gi.tileAnchorY),io,_c),Gi.elevation+=on.zOffset},Ul=Wn.textBox;if(Ul){bc(Ul);const Gi=Wa=>{let bo=i.bL.horizontal;if(D.allowVerticalPlacement&&!Wa&&this.prevPlacement){const Ui=this.prevPlacement.placedOrientations[ya];Ui&&(this.placedOrientations[ya]=Ui,bo=Ui,this.markUsedOrientation(D,bo,on))}return bo},io=(Wa,bo)=>{if(D.allowVerticalPlacement&&Ra>0&&Wn.verticalTextBox){for(const Ui of D.writingModes)if(Ui===i.bL.vertical?(ls=bo(),ii=ls):ls=Wa(),ls&&ls.box&&ls.box.length)break}else ls=Wa()};if(Tr){let Wa=Tr;if(this.prevPlacement&&this.prevPlacement.variableOffsets[ya]){const Ri=this.prevPlacement.variableOffsets[ya];Wa.indexOf(Ri.anchor)>0&&(Wa=Wa.filter(sh=>sh!==Ri.anchor),Wa.unshift(Ri.anchor))}const bo=(Ri,sh,Wv)=>{const Dh=D.getSymbolInstanceTextSize(Ve,on,this.transform.zoom,ia),Gv=(Ri.x2-Ri.x1)*Dh+2*Ri.padding,Ky=(Ri.y2-Ri.y1)*Dh+2*Ri.padding,Sf=on.hasIconTextFit&&!it?sh:null;Sf&&bc(Sf);let Mp={box:[],offscreen:!1,occluded:!1};const Zy=ct?2*Wa.length:Wa.length;for(let Hm=0;Hm=Wa.length,on,ia,D,Wv,Sf,Ve,Xe);if(Tp&&(Mp=Tp.placedGlyphBoxes,Mp&&Mp.box&&Mp.box.length)){is=!0,Qs=Tp.shift;break}}return Mp};io(()=>bo(Ul,Wn.iconBox,i.bL.horizontal),()=>{const Ri=Wn.verticalTextBox;return Ri&&bc(Ri),D.allowVerticalPlacement&&!(ls&&ls.box&&ls.box.length)&&Ra>0&&Ri?bo(Ri,Wn.verticalIconBox,i.bL.vertical):{box:null,offscreen:null,occluded:null}}),ls&&(is=ls.box,$i=ls.offscreen,gi=ls.occluded);const Ui=Gi(!(!ls||!ls.box));if(!is&&this.prevPlacement){const Ri=this.prevPlacement.variableOffsets[ya];Ri&&(this.variableOffsets[ya]=Ri,this.markUsedJustification(D,Ri.anchor,on,Ui))}}else{const Wa=(bo,Ui)=>{const Ri=D.getSymbolInstanceTextSize(Ve,on,this.transform.zoom,ia),sh=this.collisionIndex.placeCollisionBox(D,Ri,bo,we,ve,Jr,new i.P(0,0),ct,de,Y,We.predicate);return sh&&sh.box&&sh.box.length&&(this.markUsedOrientation(D,Ui,on),this.placedOrientations[ya]=Ui),sh};io(()=>Wa(Ul,i.bL.horizontal),()=>{const bo=Wn.verticalTextBox;return D.allowVerticalPlacement&&Ra>0&&bo?(bc(bo),Wa(bo,i.bL.vertical)):{box:null,offscreen:null,occluded:null}}),Gi(!!(ls&&ls.box&&ls.box.length))}}if(eo=ls,is=eo&&eo.box&&eo.box.length>0,$i=eo&&eo.offscreen,gi=eo&&eo.occluded,on.useRuntimeCollisionCircles){const Gi=on.centerJustifiedTextSymbolIndex>=0?on.centerJustifiedTextSymbolIndex:on.verticalPlacedTextSymbolIndex,io=D.text.placedSymbolArray.get(Gi),Wa=i.bM(D.textSizeData,Ve,io),bo=B.get("text-padding");Di=this.collisionIndex.placeCollisionCircles(D,ct,io,Gi,D.lineVertexArray,D.glyphOffsetArray,Wa,Y,Q,ce,w,Lt,We.predicate,on.collisionCircleDiameter*Wa/i.bY,bo,this.retainedQueryData[D.bucketInstanceId].tileID),is=ct||Di.circles.length>0&&!Di.collisionDetected,$i=$i&&Di.offscreen,gi=Di.occluded}if(Wn.iconFeatureIndex&&(Vo=Wn.iconFeatureIndex),Wn.iconBox){const Gi=io=>{bc(io);const Wa=on.hasIconTextFit&&Qs?Ao(Qs.x,Qs.y,St,Lt,this.transform.angle):new i.P(0,0),bo=D.getSymbolInstanceIconSize(Xe,this.transform.zoom,on.placedIconSymbolIndex);return this.collisionIndex.placeCollisionBox(D,bo,io,we,ve,zr,Wa,it,de,Y,We.predicate)};ii&&ii.box&&ii.box.length&&Wn.verticalIconBox?(Ha=Gi(Wn.verticalIconBox),ga=Ha.box.length>0):(Ha=Gi(Wn.iconBox),ga=Ha.box.length>0),$i=$i&&Ha.offscreen,va=Ha.occluded}const bu=ut||on.numHorizontalGlyphVertices===0&&Ra===0,nh=xt||on.numIconVertices===0;if(bu||nh?nh?bu||(ga=ga&&is):is=ga&&is:ga=is=ga&&is,is&&eo&&eo.box&&this.collisionIndex.insertCollisionBox(eo.box,B.get("text-ignore-placement"),D.bucketInstanceId,ii&&ii.box&&nc?nc:nd,We.ID),ga&&Ha&&this.collisionIndex.insertCollisionBox(Ha.box,B.get("icon-ignore-placement"),D.bucketInstanceId,Vo,We.ID),Di&&(is&&this.collisionIndex.insertCollisionCircles(Di.circles,B.get("text-ignore-placement"),D.bucketInstanceId,nd,We.ID),w)){const Gi=D.bucketInstanceId;let io=this.collisionCircleArrays[Gi];io===void 0&&(io=this.collisionCircleArrays[Gi]=new yk);for(let Wa=0;Wa=0;--ia){const Wn=on[ia];Os(D.symbolInstances.get(Wn),Wn,D.collisionArrays[Wn])}D.hasAnyZOffset&&i.w(`${D.layerIds[0]} layer symbol-z-elevate: symbols are not sorted by elevation if symbol-z-order is evaluated to viewport-y`)}else if(D.hasAnyZOffset){const on=D.getSortedIndexesByZOffset();for(let ia=0;ia=0&&(d.text.placedSymbolArray.get(O).crossTileID=ce>=0&&O!==ce?0:Y),D>=0&&(d.text.placedSymbolArray.get(D).crossTileID=ce>=0&&D!==ce?0:Y),B>=0&&(d.text.placedSymbolArray.get(B).crossTileID=ce>=0&&B!==ce?0:Y),V>=0&&(d.text.placedSymbolArray.get(V).crossTileID=ce>=0&&V!==ce?0:Y)}markUsedOrientation(d,m,w){const M=m===i.bL.horizontal||m===i.bL.horizontalOnly?m:0,O=m===i.bL.vertical?m:0,{leftJustifiedTextSymbolIndex:D,centerJustifiedTextSymbolIndex:B,rightJustifiedTextSymbolIndex:V,verticalPlacedTextSymbolIndex:Y}=w,Q=d.text.placedSymbolArray;D>=0&&(Q.get(D).placedOrientation=M),B>=0&&(Q.get(B).placedOrientation=M),V>=0&&(Q.get(V).placedOrientation=M),Y>=0&&(Q.get(Y).placedOrientation=O)}commit(d){this.commitTime=d,this.zoomAtLastRecencyCheck=this.transform.zoom;const m=this.prevPlacement;let w=!1;this.prevZoomAdjustment=m?m.zoomAdjustment(this.transform.zoom):0;const M=m?m.symbolFadeChange(d):1,O=m?m.opacities:{},D=m?m.variableOffsets:{},B=m?m.placedOrientations:{};for(const V in this.placements){const Y=this.placements[V],Q=O[V];Q?(this.opacities[V]=new xf(Q,M,Y.text,Y.icon,null,Y.clipped),w=w||Y.text!==Q.text.placed||Y.icon!==Q.icon.placed):(this.opacities[V]=new xf(null,M,Y.text,Y.icon,Y.skipFade,Y.clipped),w=w||Y.text||Y.icon)}for(const V in O){const Y=O[V];if(!this.opacities[V]){const Q=new xf(Y,M,!1,!1);Q.isHidden()||(this.opacities[V]=Q,w=w||Y.text.placed||Y.icon.placed)}}for(const V in D)this.variableOffsets[V]||!this.opacities[V]||this.opacities[V].isHidden()||(this.variableOffsets[V]=D[V]);for(const V in B)this.placedOrientations[V]||!this.opacities[V]||this.opacities[V].isHidden()||(this.placedOrientations[V]=B[V]);w?this.lastPlacementChangeTime=d:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=m?m.lastPlacementChangeTime:d)}updateLayerOpacities(d,m,w,M){M&&(this.lastReplacementSourceUpdateTime=M.updateTime);const O=new Set;for(const D of m){const B=D.getBucket(d);B&&D.latestFeatureIndex&&d.fqid===B.layerIds[0]&&(this.updateBucketOpacities(B,O,D,D.collisionBoxArray,w,M,D.tileID,d.scope),B.elevationType==="offset"&&this.buildingIndex&&this.buildingIndex.updateZOffset(B,D.tileID),B.elevationType==="road"&&B.updateRoadElevation(D.tileID.canonical),B.updateZOffset())}}updateBucketOpacities(d,m,w,M,O,D,B,V){d.hasTextData()&&d.text.opacityVertexArray.clear(),d.hasIconData()&&d.icon.opacityVertexArray.clear(),d.hasIconCollisionBoxData()&&d.iconCollisionBox.collisionVertexArray.clear(),d.hasTextCollisionBoxData()&&d.textCollisionBox.collisionVertexArray.clear();const Y=d.layers[0].layout,Q=d.layers[0].paint,ce=!!d.layers[0].dynamicFilter(),oe=new xf(null,0,!1,!1,!0),de=Y.get("text-allow-overlap"),we=Y.get("icon-allow-overlap"),ve=Y.get("text-variable-anchor"),De=Y.get("text-rotation-alignment")==="map",Pe=Y.get("text-pitch-alignment")==="map",Ve=Q.get("symbol-z-offset"),Xe=Y.get("symbol-elevation-reference")==="sea",We=!Ve.isConstant(),bt=new xf(null,0,de&&(we||!d.hasIconData()||Y.get("icon-optional")),we&&(de||!d.hasTextData()||Y.get("text-optional")),!0);!d.collisionArrays&&M&&(d.hasIconCollisionBoxData()||d.hasTextCollisionBoxData())&&d.deserializeCollisionBoxes(M);const ut=(ct,it,St)=>{for(let Dt=0;Dt0||Dt>0,Tr=Ht>0,Hr=this.placedOrientations[Lt],Nr=Hr===i.bL.vertical,br=Hr===i.bL.horizontal||Hr===i.bL.horizontalOnly;!dr&&!Tr||qt.isHidden()||xt++;let nn=!1;if((dr||Tr)&&D)for(const Jr of d.activeReplacements){if(i.bZ(Jr,O,i.b_.Symbol,V)||Jr.min.x>Wt||Wt>Jr.max.x||Jr.min.y>sr||sr>Jr.max.y)continue;const zr=i.b$(Wt,sr,B.canonical,Jr.footprintTileId.canonical);if(nn=i.c0(zr,Jr.footprint),nn)break}if(dr){const Jr=nn?Wg:Jc(qt.text);ut(d.text,St,Nr?Wg:Jr),ut(d.text,Dt,br?Wg:Jr);const zr=qt.text.isHidden(),{leftJustifiedTextSymbolIndex:Gr,centerJustifiedTextSymbolIndex:kn,rightJustifiedTextSymbolIndex:Yn,verticalPlacedTextSymbolIndex:Os}=it,ha=d.text.placedSymbolArray,on=zr||Nr?1:0;Gr>=0&&(ha.get(Gr).hidden=on),kn>=0&&(ha.get(kn).hidden=on),Yn>=0&&(ha.get(Yn).hidden=on),Os>=0&&(ha.get(Os).hidden=zr||br?1:0);const ia=this.variableOffsets[Lt];ia&&this.markUsedJustification(d,ia.anchor,it,Hr);const Wn=this.placedOrientations[Lt];Wn&&(this.markUsedJustification(d,"left",it,Wn),this.markUsedOrientation(d,Wn,it))}if(Tr){const Jr=nn?Wg:Jc(qt.icon),{placedIconSymbolIndex:zr,verticalPlacedIconSymbolIndex:Gr}=it,kn=d.icon.placedSymbolArray,Yn=qt.icon.isHidden()?1:0;zr>=0&&(ut(d.icon,Ht,Nr?Wg:Jr),kn.get(zr).hidden=Yn),Gr>=0&&(ut(d.icon,it.numVerticalIconVertices,br?Wg:Jr),kn.get(Gr).hidden=Yn)}if(d.hasIconCollisionBoxData()||d.hasTextCollisionBoxData()){const Jr=d.collisionArrays[ct];if(Jr){let zr=new i.P(0,0),Gr=!0;if(Jr.textBox||Jr.verticalTextBox){if(ve){const Yn=this.variableOffsets[Lt];Yn?(zr=yc(Yn.anchor,Yn.width,Yn.height,Yn.textOffset,Yn.textScale),De&&zr._rotate(Pe?this.transform.angle:-this.transform.angle)):Gr=!1}ce&&(Gr=!qt.clipped),Jr.textBox&&Am(d.textCollisionBox.collisionVertexArray,qt.text.placed,!Gr||Nr,Tt,Xe,zr.x,zr.y),Jr.verticalTextBox&&Am(d.textCollisionBox.collisionVertexArray,qt.text.placed,!Gr||br,Tt,Xe,zr.x,zr.y)}const kn=Gr&&!!(!br&&Jr.verticalIconBox);Jr.iconBox&&Am(d.iconCollisionBox.collisionVertexArray,qt.icon.placed,kn,Tt,Xe,it.hasIconTextFit?zr.x:0,it.hasIconTextFit?zr.y:0),Jr.verticalIconBox&&Am(d.iconCollisionBox.collisionVertexArray,qt.icon.placed,!kn,Tt,Xe,it.hasIconTextFit?zr.x:0,it.hasIconTextFit?zr.y:0)}}}if(d.fullyClipped=xt===0,d.sortFeatures(this.transform.angle),this.retainedQueryData[d.bucketInstanceId]&&(this.retainedQueryData[d.bucketInstanceId].featureSortOrder=d.featureSortOrder),d.hasTextData()&&d.text.opacityVertexBuffer&&d.text.opacityVertexBuffer.updateData(d.text.opacityVertexArray),d.hasIconData()&&d.icon.opacityVertexBuffer&&d.icon.opacityVertexBuffer.updateData(d.icon.opacityVertexArray),d.hasIconCollisionBoxData()&&d.iconCollisionBox.collisionVertexBuffer&&d.iconCollisionBox.collisionVertexBuffer.updateData(d.iconCollisionBox.collisionVertexArray),d.hasTextCollisionBoxData()&&d.textCollisionBox.collisionVertexBuffer&&d.textCollisionBox.collisionVertexBuffer.updateData(d.textCollisionBox.collisionVertexArray),d.bucketInstanceId in this.collisionCircleArrays){const ct=this.collisionCircleArrays[d.bucketInstanceId];d.placementInvProjMatrix=ct.invProjMatrix,d.placementViewportMatrix=ct.viewportMatrix,d.collisionCircleArray=ct.circles,delete this.collisionCircleArrays[d.bucketInstanceId]}}symbolFadeChange(d){return this.fadeDuration===0?1:(d-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(d){return Math.max(0,(this.transform.zoom-d)/1.5)}hasTransitions(d){return this.stale||d-this.lastPlacementChangeTimed}isStale(){return this.stale}setStale(){this.stale=!0}}function Am(_,d,m,w,M,O,D){_.emplaceBack(d?1:0,m?1:0,O||0,D||0,w,M?1:0),_.emplaceBack(d?1:0,m?1:0,O||0,D||0,w,M?1:0),_.emplaceBack(d?1:0,m?1:0,O||0,D||0,w,M?1:0),_.emplaceBack(d?1:0,m?1:0,O||0,D||0,w,M?1:0)}const T3=Math.pow(2,25),vv=Math.pow(2,24),vk=Math.pow(2,17),A3=Math.pow(2,16),_k=Math.pow(2,9),Qc=Math.pow(2,8),mp=Math.pow(2,1);function Jc(_){if(_.opacity===0&&!_.placed)return 0;if(_.opacity===1&&_.placed)return 4294967295;const d=_.placed?1:0,m=Math.floor(127*_.opacity);return m*T3+d*vv+m*vk+d*A3+m*_k+d*Qc+m*mp+d}const Wg=0;class Ny{constructor(d){this._sortAcrossTiles=d.layout.get("symbol-z-order")!=="viewport-y"&&d.layout.get("symbol-sort-key").constantOr(1)!==void 0,this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs=new Set,this._bucketParts=[]}continuePlacement(d,m,w,M,O,D){const B=this._bucketParts;for(;this._currentTileIndexV.sortKey-Y.sortKey));this._currentPartIndex{const V=i.o.now()-D;return!this._forceFullPlacement&&V>2};for(;this._currentPlacementIndex>=0;){const V=m[d[this._currentPlacementIndex]],Y=this.placement.collisionIndex.transform.zoom;if(V.type==="symbol"&&V.visibility!=="none"&&(!V.minzoom||V.minzoom<=Y)&&(!V.maxzoom||V.maxzoom>Y)){const Q=V,ce=Q.layout.get("symbol-z-elevate"),oe=Q.layout.get("symbol-sort-key").constantOr(1)!==void 0,de=Q.layout.get("symbol-z-order"),we=de==="viewport-y"||de==="auto"&&!(de!=="viewport-y"&&oe),ve=Q.layout.get("text-allow-overlap")||Q.layout.get("icon-allow-overlap")||Q.layout.get("text-ignore-placement")||Q.layout.get("icon-ignore-placement"),De=we&&ve,Pe=this._inProgressLayer=this._inProgressLayer||new Ny(Q),Ve=i.B(V.source,V.scope);if(Pe.continuePlacement(ce||De?M[Ve]:w[Ve],this.placement,this._showCollisionBoxes,V,B,O))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(d){return this.placement.commit(d),this.placement}}const Xu=512/i.al/2;class gp{constructor(d,m,w){this.tileID=d,this.bucketInstanceId=w,this.index=new i.c4(m.length,16,Int32Array),this.keys=[],this.crossTileIDs=[];const M=d.canonical.x*i.al,O=d.canonical.y*i.al;for(let D=0;DDe-Pe);for(const De of ve){const Pe=this.crossTileIDs[De];if(this.keys[De]===Q&&!w.has(Pe)){w.add(Pe),Y.crossTileID=Pe;break}}}}}class rl{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class E3{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(d){const m=Math.round((d-this.lng)/360);if(m!==0)for(const w in this.indexes){const M=this.indexes[w],O={};for(const D in M){const B=M[D];B.tileID=B.tileID.unwrapTo(B.tileID.wrap+m),O[B.tileID.key]=B}this.indexes[w]=O}this.lng=d}addBucket(d,m,w){if(this.indexes[d.overscaledZ]&&this.indexes[d.overscaledZ][d.key]){if(this.indexes[d.overscaledZ][d.key].bucketInstanceId===m.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(d.overscaledZ,this.indexes[d.overscaledZ][d.key])}for(let O=0;Od.overscaledZ)for(const B in D){const V=D[B];V.tileID.isChildOf(d)&&V.findMatches(m.symbolInstances,d,M)}else{const B=D[d.scaledTo(Number(O)).key];B&&B.findMatches(m.symbolInstances,d,M)}}for(let O=0;O{m[w]=!0});for(const w in this.layerIndexes)m[w]||delete this.layerIndexes[w]}}const yf=771;class as{constructor(d,m,w,M){this.blendFunction=d,this.blendColor=m.toNonPremultipliedRenderColor(null),this.mask=w,this.blendEquation=M}}as.Replace=[1,0,1,0],as.disabled=new as(as.Replace,i.ao.transparent,[!1,!1,!1,!1]),as.unblended=new as(as.Replace,i.ao.transparent,[!0,!0,!0,!0]),as.alphaBlended=new as([1,yf,1,yf],i.ao.transparent,[!0,!0,!0,!0]),as.alphaBlendedNonPremultiplied=new as([770,yf,770,yf],i.ao.transparent,[!0,!0,!0,!0]),as.multiply=new as([774,0,774,0],i.ao.transparent,[!0,!0,!0,!0]),as.additive=new as([1,1,1,1],i.ao.transparent,[!0,!0,!0,!0]);class dn{constructor(d,m,w){this.func=d,this.mask=m,this.range=w}}dn.ReadOnly=!1,dn.ReadWrite=!0,dn.disabled=new dn(519,dn.ReadOnly,[0,1]);const bk=7680;class $n{constructor(d,m,w,M,O,D){this.test=d,this.ref=m,this.mask=w,this.fail=M,this.depthFail=O,this.pass=D}}$n.disabled=new $n({func:519,mask:0},0,0,bk,bk,bk);const Sy=1029,wk=2305;class zn{constructor(d,m,w){this.enable=d,this.mode=m,this.frontFace=w}}function vf(_,d){const m=i.ca(_,3);i.cc(_,d),i.cg(_,3,m)}function I3(_,d){const m=i.c7([]);return i.c8(m,m,-d),i.c9(m,m,-_),m}function jk(_,d){const m=[_[0],_[1],0],w=[d[0],d[1],0];if(i.ag(m)>=1e-15){const D=i.aw([],m);i.c5(w,D,i.bJ(w,D)),d[0]=w[0],d[1]=w[1]}const M=i.bI([],d,_);if(i.c6(M)<1e-15)return null;const O=Math.atan2(-M[1],M[0]);return I3(Math.atan2(Math.sqrt(_[0]*_[0]+_[1]*_[1]),-_[2]),O)}zn.disabled=new zn(!1,Sy,wk),zn.backCCW=new zn(!0,Sy,wk),zn.backCW=new zn(!0,Sy,2304),zn.frontCW=new zn(!0,1028,2304),zn.frontCCW=new zn(!0,1028,wk);class ed{constructor(d,m){this.position=d,this.orientation=m}get position(){return this._position}set position(d){if(d){const m=d instanceof i.ae?d:new i.ae(d[0],d[1],d[2]);this._renderWorldCopies&&(m.x=i.bT(m.x,0,1)),this._position=m}else this._position=null}lookAtPoint(d,m,w){if(this.orientation=null,!this.position)return;const M=this.position,O=w||(this._elevation?this._elevation.getAtPointOrZero(i.ae.fromLngLat(d)):0),D=i.ae.fromLngLat(d,O),B=[D.x-M.x,D.y-M.y,D.z-M.z];m||(m=[0,0,1]),m[2]=Math.abs(m[2]),this.orientation=jk(B,m)}setPitchBearing(d,m){this.orientation=I3(i.an(d),i.an(-m))}}class kk{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&&vf(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=I3(d,m),vf(this._transform,this._orientation)}forward(){const d=i.ca(this._transform,2);return[-d[0],-d[1],-d[2]]}up(){const d=i.ca(this._transform,1);return[-d[0],-d[1],-d[2]]}right(){const d=i.ca(this._transform,0);return[d[0],d[1],d[2]]}getCameraToWorld(d,m){const w=new Float64Array(16);return i.bl(w,this.getWorldToCamera(d,m)),w}getCameraToWorldMercator(){return this._transform}getWorldToCameraPosition(d,m,w){const M=this.position;i.c5(M,M,-d);const O=new Float64Array(16);return i.bq(O,[w,w,w]),i.br(O,O,M),O[10]*=m,O}getWorldToCamera(d,m){const w=new Float64Array(16),M=new Float64Array(4),O=this.position;return i.cb(M,this._orientation),i.c5(O,O,-d),i.cc(w,M),i.br(w,w,O),w[1]*=-1,w[5]*=-1,w[9]*=-1,w[13]*=-1,w[8]*=m,w[9]*=m,w[10]*=m,w[11]*=m,w}getCameraToClipPerspective(d,m,w,M){const O=new Float64Array(16);return i.cd(O,d,m,w,M),O}getCameraToClipOrthographic(d,m,w,M,O,D){const B=new Float64Array(16);return i.ce(B,d,m,w,M,O,D),B}getDistanceToElevation(d,m=!1){const w=d===0?0:i.cf(d,m?i.a$(this.position[1]):this.position[1]),M=this.forward();return(w-this.position[2])/M[2]}clone(){return new kk([...this.position],[...this.orientation])}}const Cl={BaseColor:5,MetallicRoughness:6,Normal:7,Occlusion:8,Emission:9,LUT:10,ShadowMap0:11};class Nk{constructor(d=0,m=0,w=0,M=0){if(isNaN(d)||d<0||isNaN(m)||m<0||isNaN(w)||w<0||isNaN(M)||M<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=d,this.bottom=m,this.left=w,this.right=M}interpolate(d,m,w){return m.top!=null&&d.top!=null&&(this.top=i.ak(d.top,m.top,w)),m.bottom!=null&&d.bottom!=null&&(this.bottom=i.ak(d.bottom,m.bottom,w)),m.left!=null&&d.left!=null&&(this.left=i.ak(d.left,m.left,w)),m.right!=null&&d.right!=null&&(this.right=i.ak(d.right,m.right,w)),this}getCenter(d,m){const w=i.aA((this.left+d-this.right)/2,0,d),M=i.aA((this.top+m-this.bottom)/2,0,m);return new i.P(w,M)}equals(d){return this.top===d.top&&this.bottom===d.bottom&&this.left===d.left&&this.right===d.right}clone(){return new Nk(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}const Ih=15;class P3{constructor(d,m,w,M,O,D,B){this.tileSize=512,this._renderWorldCopies=O===void 0||O,this._minZoom=d||0,this._maxZoom=m||22,this._minPitch=w??0,this._maxPitch=M??60,this.setProjection(D),this.setMaxBounds(B),this.width=0,this.height=0,this._center=new i.aT(0,0),this.zoom=0,this.angle=0,this._fov=.6435011087932844,this._pitch=0,this._nearZ=0,this._farZ=0,this._unmodified=!0,this._edgeInsets=new Nk,this._projMatrixCache={},this._alignedProjMatrixCache={},this._fogTileMatrixCache={},this._expandedProjMatrixCache={},this._distanceTileDataCache={},this._camera=new kk,this._centerAltitude=0,this._averageElevation=0,this.cameraElevationReference="ground",this._pixelsPerMercatorPixel=1,this.globeRadius=0,this.globeCenterInViewSpace=[0,0,0],this._tileCoverLift=0,this.freezeTileCoverage=!1,this._horizonShift=.1,this._orthographicProjectionAtLowPitch=!1,this._allowWorldUnderZoom=!1}clone(){const d=new P3(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies,this.getProjection(),this.maxBounds);return d._elevation=this._elevation,d._centerAltitude=this._centerAltitude,d._centerAltitudeValidForExaggeration=this._centerAltitudeValidForExaggeration,d.tileSize=this.tileSize,d.mercatorFromTransition=this.mercatorFromTransition,d.width=this.width,d.height=this.height,d.cameraElevationReference=this.cameraElevationReference,d._center=this._center,d._setZoom(this.zoom),d._seaLevelZoom=this._seaLevelZoom,d.angle=this.angle,d._fov=this._fov,d._pitch=this._pitch,d._nearZ=this._nearZ,d._farZ=this._farZ,d._averageElevation=this._averageElevation,d._orthographicProjectionAtLowPitch=this._orthographicProjectionAtLowPitch,d._unmodified=this._unmodified,d._edgeInsets=this._edgeInsets.clone(),d._camera=this._camera.clone(),d._calcMatrices(),d.freezeTileCoverage=this.freezeTileCoverage,d.frustumCorners=this.frustumCorners,d._allowWorldUnderZoom=this._allowWorldUnderZoom,d}get isOrthographic(){return this.projection.name!=="globe"&&this._orthographicProjectionAtLowPitch&&this.pitch0&&this.elevation.exaggeration()>0&&this._centerAltitudeValidForExaggeration;if(!this._elevation||d===Number.NEGATIVE_INFINITY&&(!m||!this._centerAltitude))return this._centerAltitude=0,this._seaLevelZoom=null,void(this._centerAltitudeValidForExaggeration=void 0);const w=this._elevation;m||this._centerAltitude&&this._centerAltitudeValidForExaggeration&&w.exaggeration()&&this._centerAltitudeValidForExaggeration!==w.exaggeration()?(this._centerAltitude=this._centerAltitude/this._centerAltitudeValidForExaggeration*w.exaggeration(),this._centerAltitudeValidForExaggeration=w.exaggeration()):(this._centerAltitude=d||0,this._centerAltitudeValidForExaggeration=w.exaggeration()),this._updateSeaLevelZoom()}_updateSeaLevelZoom(){if(this._centerAltitudeValidForExaggeration===void 0)return;const d=Math.max(0,(this.pixelsPerMeter*this._centerAltitude+this.cameraToCenterDistance)/this.worldSize);this._seaLevelZoom=this._zoomFromMercatorZ(d)}sampleAverageElevation(){if(!this._elevation)return 0;const d=this._elevation,m=[[.5,.2],[.3,.5],[.5,.5],[.7,.5],[.5,.8]],w=this.horizonLineFromTop();let M=0,O=0;for(let D=0;D{const De=i.cY(oe,ce,de,we,ve);V.has(De)||(O.push(new i.aQ(ce,oe,de,we,ve)),V.add(De))};for(let ce=0;ceoe.canonical.z)continue;const de=oe.canonical,we=oe.overscaledZ,ve=oe.wrap,De=1<0,Xe=de.y+10,bt=oe.wrap-(Ve?0:1),ut=oe.wrap+(Pe?0:1),xt=Ve?de.x-1:De-1,ct=Pe?de.x+1:0;if(D)w[0]<0?(Y(we,ut,de.z,ct,de.y),w[1]<0&&Xe&&(Y(we,ve,de.z,de.x,de.y+1),Y(we,ut,de.z,ct,de.y+1)),w[1]>0&&We&&(Y(we,ve,de.z,de.x,de.y-1),Y(we,ut,de.z,ct,de.y-1))):w[0]>0?(Y(we,bt,de.z,xt,de.y),w[1]<0&&Xe&&(Y(we,ve,de.z,de.x,de.y+1),Y(we,bt,de.z,xt,de.y+1)),w[1]>0&&We&&(Y(we,ve,de.z,de.x,de.y-1),Y(we,bt,de.z,xt,de.y-1))):w[1]<0&&Xe?Y(we,ve,de.z,de.x,de.y+1):We&&Y(we,ve,de.z,de.x,de.y-1);else{const it=oe.visibleQuadrants;1&it&&(Y(we,bt,de.z,xt,de.y),We&&(Y(we,ve,de.z,de.x,de.y-1),Y(we,bt,de.z,xt,de.y-1))),2&it&&(Y(we,ut,de.z,ct,de.y),We&&(Y(we,ve,de.z,de.x,de.y-1),Y(we,ut,de.z,ct,de.y-1))),4&it&&(Y(we,bt,de.z,xt,de.y),Xe&&(Y(we,ve,de.z,de.x,de.y+1),Y(we,bt,de.z,xt,de.y+1))),8&it&&(Y(we,ut,de.z,ct,de.y),Xe&&(Y(we,ve,de.z,de.x,de.y+1),Y(we,ut,de.z,ct,de.y+1)))}}const Q=[];for(const ce of O)O.some(oe=>ce.isChildOf(oe))||Q.push(ce);if(O=Q.filter(ce=>!d.some(oe=>!!(ce.overscaledZ{const Pe=De.canonical.x+.5-de[0],Ve=De.canonical.y+.5-de[1];return Pe*Pe+Ve*Ve{const xt=i.cY(Xe,Ve,We,bt,ut);O.has(xt)||(M.push(new i.aQ(Ve,Xe,We,bt,ut)),O.add(xt))},B=d.reduce((Ve,Xe)=>Math.max(Ve,Xe.overscaledZ),w),V=1<{const We=Math.floor(Ve[0]),bt=Math.floor(Ve[1]),ut=(Ve[0]-We)*i.al,xt=(Ve[1]-bt)*i.al,ct=Math.floor(Xe[0]),it=Math.floor(Xe[1]),St=(Xe[0]-ct)*i.al,Dt=(Xe[1]-it)*i.al;for(let Lt=-1;Lt<=1;Lt++){const Ht=We+Lt;if(!(Ht<0||Ht>=V)){Q.x=ut-Lt*i.al,ce.x=St-(Ht-ct)*i.al;for(let Wt=-1;Wt<=1;Wt++){const sr=bt+Wt;Q.y=xt-Wt*i.al,ce.y=Dt-(sr-it)*i.al,i.cZ(Q,ce,Y)&&D(B,0,w,Ht,sr)}}}},de=m.points,we=de[i.cv],ve=de[i.cw],De=this._projectToGround(we,de[i.cx]),Pe=this._projectToGround(ve,de[i.cy]);return oe(we,De),oe(ve,Pe),M}_projectToGround(d,m){return i.cz(i.cA(),d,m,d[2]/(d[2]-m[2]))}coveringTiles(d){let m=this.coveringZoomLevel(d);const w=m,M=this.elevation&&this.elevation.exaggeration(),O=M&&!d.isTerrainDEM,D=this.projection.name==="mercator";if(d.minzoom!==void 0&&md.maxzoom&&(m=d.maxzoom);const B=this.locationCoordinate(this.center),V=this.center.lat,Y=1<{const qt=new i.ae(Tt.x+25e-6,Tt.y,Tt.z),dr=new i.ae(Tt.x,Tt.y+25e-6,Tt.z),Tr=Tt.toLngLat(),Hr=qt.toLngLat(),Nr=dr.toLngLat(),br=this.locationCoordinate(Tr),nn=this.locationCoordinate(Hr),Jr=this.locationCoordinate(Nr),zr=Math.hypot(nn.x-br.x,nn.y-br.y),Gr=Math.hypot(Jr.x-br.x,Jr.y-br.y);return Math.sqrt(zr*Gr)*xt/25e-6},it=Tt=>{const Jt=bt,qt=ut;return{aabb:i.cF(this,Y,0,0,0,Tt,qt,Jt,this.projection),zoom:0,x:0,y:0,minZ:qt,maxZ:Jt,wrap:Tt,fullyVisible:!1}},St=[];let Dt=[];const Lt=m,Ht=d.reparseOverscaled?w:m,Wt=(De-this._centerAltitude)*ve,sr=Tt=>{if(!this._elevation||!Tt.tileID||!D)return;const Jt=this._elevation.getMinMaxForTile(Tt.tileID),qt=Tt.aabb;Jt?(qt.min[2]=Jt.min,qt.max[2]=Jt.max,qt.center[2]=(qt.min[2]+qt.max[2])/2):(Tt.shouldSplit=Bt(Tt),Tt.shouldSplit||(qt.min[2]=qt.max[2]=qt.center[2]=this._centerAltitude))},_r=(Tt,Jt)=>{if(.707*Jt{if(Tt.zoom=.9)return!0}else if(O&&(dr=Tt.aabb.distanceZ(Pe)*ve),this.projection.isReprojectedInTileSpace&&w<=5){const Gr=Math.pow(2,Tt.zoom),kn=ct(new i.ae((Tt.x+.5)/Gr,(Tt.y+.5)/Gr));Tr=kn>.85?1:kn}if(!D&&!ce){const Gr=Math.sqrt(Jt*Jt+qt*qt+dr*dr);let kn=(1<0;){const Tt=St.pop(),Jt=Tt.x,qt=Tt.y;let dr=Tt.fullyVisible;const Tr=()=>this.projection.name==="globe"&&(Tt.y===0||Tt.y===(1<>1),nn={aabb:D?Tt.aabb.quadrant(Hr):i.cF(this,Y,Tt.zoom+1,Nr,br,Tt.wrap,Tt.minZ,Tt.maxZ,this.projection),zoom:Tt.zoom+1,x:Nr,y:br,wrap:Tt.wrap,fullyVisible:dr,tileID:void 0,shouldSplit:void 0,minZ:Tt.minZ,maxZ:Tt.maxZ};O&&!ce&&(nn.tileID=new i.aQ(Tt.zoom+1===Lt?Ht:Tt.zoom+1,Tt.wrap,Tt.zoom+1,Nr,br),sr(nn)),St.push(nn)}else{const Hr=Tt.zoom===Lt?Ht:Tt.zoom;if(d.minzoom&&d.minzoom>Hr)continue;let Nr=0;if(!dr){let zr=Ve?Tt.aabb.intersectsPrecise(de):Tt.aabb.intersectsPreciseFlat(de);if(zr===0&&Tr()){const Gr=new i.cD(Tt.zoom,Jt,qt);zr=i.cE(this,Y,Gr,!0).intersectsPrecise(de)}if(zr===0)continue;if(d.calculateQuadrantVisibility)if(de.containsPoint(Tt.aabb.center))Nr=15;else for(let Gr=0;Gr<4;Gr++)Tt.aabb.quadrant(Gr).intersects(de)!==0&&(Nr|=1<{const dr=[0,0,0,1],Tr=[i.al,i.al,0,1],Hr=this.calculateFogTileMatrix(qt.tileID.toUnwrapped());i.aC(dr,dr,Hr),i.aC(Tr,Tr,Hr);const Nr=i.cG([],dr,Tr),br=i.cH([],dr,Tr),nn=i.c$(Nr,br);if(nn===0)return!0;let Jr=!1;const zr=this._elevation;if(zr&&nn>Tt&&Jt!==0){const Gr=this.calculateProjMatrix(qt.tileID.toUnwrapped());let kn;d.isTerrainDEM||(kn=zr.getMinMaxForTile(qt.tileID)),kn||(kn={min:ut,max:bt});const Yn=i.cI(this.rotation),Os=[Yn[0]*i.al,Yn[1]*i.al,kn.max];i.af(Os,Os,Gr),Jr=(1-Os[1])*this.height*.5Tt.distanceSq-Jt.distanceSq).map(Tt=>Tt.tileID)}resize(d,m){this.width=d,this.height=m,this.pixelsToGLUnits=[2/d,-2/m],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(d){return Math.pow(2,d)}scaleZoom(d){return Math.log2(d)}project(d){const m=i.aA(d.lat,-i.cJ,i.cJ),w=this.projection.project(d.lng,m);return new i.P(w.x*this.worldSize,w.y*this.worldSize)}unproject(d){return this.projection.unproject(d.x/this.worldSize,d.y/this.worldSize)}get point(){return this.project(this.center)}get pointMerc(){return this.point._div(this.worldSize)}get pixelsPerMeterRatio(){return this.pixelsPerMeter/i.cf(1,this.center.lat)/this.worldSize}setLocationAtPoint(d,m){let w,M;const O=this.centerPoint;if(this.projection.name==="globe"){const B=this.worldSize;w=(m.x-O.x)/B,M=(m.y-O.y)/B}else{const B=this.pointCoordinate(m),V=this.pointCoordinate(O);w=B.x-V.x,M=B.y-V.y}const D=this.locationCoordinate(d);this.setLocation(new i.ae(D.x-w,D.y-M))}setLocation(d){this.center=this.coordinateLocation(d),this.projection.wrap&&(this.center=this.center.wrap())}locationPoint(d,m){return this.projection.locationPoint(this,d,m)}locationPoint3D(d,m){return this.projection.locationPoint(this,d,m,!0)}pointLocation(d){return this.coordinateLocation(this.pointCoordinate(d))}pointLocation3D(d,m){return this.coordinateLocation(this.pointCoordinate3D(d,m))}locationCoordinate(d,m){const w=m?i.cf(m,d.lat):void 0,M=this.projection.project(d.lng,d.lat);return new i.ae(M.x,M.y,w)}coordinateLocation(d){return this.projection.unproject(d.x,d.y)}pointRayIntersection(d,m){const w=m??this._centerAltitude,M=[d.x,d.y,0,1],O=[d.x,d.y,1,1];i.aC(M,M,this.pixelMatrixInverse),i.aC(O,O,this.pixelMatrixInverse);const D=O[3];i.cK(M,M,1/M[3]),i.cK(O,O,1/D);const B=M[2],V=O[2];return{p0:M,p1:O,t:B===V?0:(w-B)/(V-B)}}screenPointToMercatorRay(d){const m=[d.x,d.y,0,1],w=[d.x,d.y,1,1];return i.aC(m,m,this.pixelMatrixInverse),i.aC(w,w,this.pixelMatrixInverse),i.cK(m,m,1/m[3]),i.cK(w,w,1/w[3]),m[2]=i.cf(m[2],this._center.lat)*this.worldSize,w[2]=i.cf(w[2],this._center.lat)*this.worldSize,i.cK(m,m,1/this.worldSize),i.cK(w,w,1/this.worldSize),new i.ax([m[0],m[1],m[2]],i.aw([],i.av([],w,m)))}rayIntersectionCoordinate(d){const{p0:m,p1:w,t:M}=d,O=i.cf(m[2],this._center.lat),D=i.cf(w[2],this._center.lat);return new i.ae(i.ak(m[0],w[0],M)/this.worldSize,i.ak(m[1],w[1],M)/this.worldSize,i.ak(O,D,M))}pointCoordinate(d,m=this._centerAltitude){return this.projection.pointCoordinate(this,d.x,d.y,m)}pointCoordinate3D(d,m){if(!this.elevation)return this.pointCoordinate(d,m);let w=this.projection.pointCoordinate3D(this,d.x,d.y);if(w)return new i.ae(w[0],w[1],w[2]);let M=0,O=this.horizonLineFromTop();if(d.y>O)return this.pointCoordinate(d,m);const D=.02*O,B=d.clone();for(let V=0;V<10&&O-M>D;V++){B.y=i.ak(M,O,.66);const Y=this.projection.pointCoordinate3D(this,B.x,B.y);Y?(O=B.y,w=Y):M=B.y}return w?new i.ae(w[0],w[1],w[2]):this.pointCoordinate(d)}isPointAboveHorizon(d){return this.projection.isPointAboveHorizon(this,d)}isPointOnSurface(d){if(d.y<0||d.y>this.height||d.x<0||d.x>this.width)return!1;if(this.elevation||this.zoom>=i.cL)return!this.isPointAboveHorizon(d);const m=this.pointCoordinate(d);return m.y>=0&&m.y<=1}_coordinatePoint(d,m){const w=m&&this.elevation?this.elevation.getAtPointOrZero(d,this._centerAltitude):this._centerAltitude,M=[d.x*this.worldSize,d.y*this.worldSize,w+d.toAltitude(),1];return i.aC(M,M,this.pixelMatrix),M[3]>0?new i.P(M[0]/M[3],M[1]/M[3]):new i.P(Number.MAX_VALUE,Number.MAX_VALUE)}_getBoundsNonRectangular(){const{top:d,left:m}=this._edgeInsets,w=this.height-this._edgeInsets.bottom,M=this.width-this._edgeInsets.right,O=this.pointLocation3D(new i.P(m,d)),D=this.pointLocation3D(new i.P(M,d)),B=this.pointLocation3D(new i.P(M,w)),V=this.pointLocation3D(new i.P(m,w));let Y=Math.min(O.lng,D.lng,B.lng,V.lng),Q=Math.max(O.lng,D.lng,B.lng,V.lng),ce=Math.min(O.lat,D.lat,B.lat,V.lat),oe=Math.max(O.lat,D.lat,B.lat,V.lat);const de=Math.pow(2,-this.zoom)/16*270,we=this.projection.name==="globe"?1:4,ve=(De,Pe,Ve,Xe,We)=>{const bt=(De+Ve)/2,ut=(Pe+Xe)/2,xt=new i.P(bt,ut),{lng:ct,lat:it}=this.pointLocation3D(xt),St=Math.max(0,Y-ct,ce-it,ct-Q,it-oe);Y=Math.min(Y,ct),Q=Math.max(Q,ct),ce=Math.min(ce,it),oe=Math.max(oe,it),(Wede)&&(ve(De,Pe,bt,ut,We+1),ve(bt,ut,Ve,Xe,We+1))};if(ve(m,d,M,d,1),ve(M,d,M,w,1),ve(M,w,m,w,1),ve(m,w,m,d,1),this.projection.name==="globe"){const[De,Pe]=i.cM(this);De?(oe=90,Q=180,Y=-180):Pe&&(ce=-90,Q=180,Y=-180)}return new i.aI(new i.aT(Y,ce),new i.aT(Q,oe))}_getBoundsRectangular(d,m){const{top:w,left:M}=this._edgeInsets,O=this.height-this._edgeInsets.bottom,D=this.width-this._edgeInsets.right,B=new i.P(M,w),V=new i.P(D,w),Y=new i.P(D,O),Q=new i.P(M,O);let ce=this.pointCoordinate(B,d),oe=this.pointCoordinate(V,d);const de=this.pointCoordinate(Y,m),we=this.pointCoordinate(Q,m),ve=(De,Pe)=>(Pe.y-De.y)/(Pe.x-De.x);return ce.y>1&&oe.y>=0?ce=new i.ae((1-we.y)/ve(we,ce)+we.x,1):ce.y<0&&oe.y<=1&&(ce=new i.ae(-we.y/ve(we,ce)+we.x,0)),oe.y>1&&ce.y>=0?oe=new i.ae((1-de.y)/ve(de,oe)+de.x,1):oe.y<0&&ce.y<=1&&(oe=new i.ae(-de.y/ve(de,oe)+de.x,0)),new i.aI().extend(this.coordinateLocation(ce)).extend(this.coordinateLocation(oe)).extend(this.coordinateLocation(we)).extend(this.coordinateLocation(de))}_getBoundsRectangularTerrain(){const d=this.elevation;if(!d.visibleDemTiles.length||d.isUsingMockSource())return this._getBoundsRectangular(0,0);const m=d.visibleDemTiles.reduce((w,M)=>{if(M.dem){const O=M.dem.tree;w.min=Math.min(w.min,O.minimums[0]),w.max=Math.max(w.max,O.maximums[0])}return w},{min:Number.MAX_VALUE,max:0});return this._getBoundsRectangular(m.min*d.exaggeration(),m.max*d.exaggeration())}getBounds(){return this.projection.name==="mercator"||this.projection.name==="equirectangular"?this._terrainEnabled()?this._getBoundsRectangularTerrain():this._getBoundsRectangular(0,0):this._getBoundsNonRectangular()}horizonLineFromTop(d=!0){const m=this.height/2/Math.tan(this._fov/2)/Math.tan(Math.max(this._pitch,.1))-this.centerOffset.y,w=this.height/2-m*(1-this._horizonShift);return d?Math.max(0,w):w}getMaxBounds(){return this.maxBounds}setMaxBounds(d){this.maxBounds=d,this.minLat=-i.cJ,this.maxLat=i.cJ,this.minLng=-180,this.maxLng=180,d&&(this.minLat=d.getSouth(),this.maxLat=d.getNorth(),this.minLng=d.getWest(),this.maxLng=d.getEast(),this.maxLngce&&(B=ce-Y),ce-Qde&&(D=de-V),de-oe{for(let Bt=0;Bt<16;Bt++)Ht[Bt]=i.ak(Wt[Bt],sr[Bt],_r)})(B,B,V,i.d0(this.pitch>=Ih?1:this.pitch/Ih))}else B=V;const Y=i.cP([],V,D);let Q=i.cP([],B,D);if(this.projection.isReprojectedInTileSpace){const it=this.locationCoordinate(this.center),St=i.bA([]);i.br(St,St,[it.x*this.worldSize,it.y*this.worldSize,0]),i.aB(St,St,i.cQ(this)),i.br(St,St,[-it.x*this.worldSize,-it.y*this.worldSize,0]),i.aB(Q,Q,St),i.aB(Y,Y,St),this.inverseAdjustmentMatrix=i.cR(this)}else this.inverseAdjustmentMatrix=[1,0,0,1];if(this.mercatorMatrix=i.cS([],Q,[this.worldSize,this.worldSize,this.worldSize/O,1]),this.projMatrix=Q,this.invProjMatrix=i.bl(new Float64Array(16),this.projMatrix),m){const it=this._camera.getCameraToClipPerspective(this._fov,this.width/this.height,this._nearZ,1/0);it[8]=2*-d.x/this.width,it[9]=2*d.y/this.height,this.expandedFarZProjMatrix=i.cP([],it,D)}else this.expandedFarZProjMatrix=this.projMatrix;const ce=i.bl([],B);this.frustumCorners=i.cT.fromInvProjectionMatrix(ce,this.horizonLineFromTop(),this.height),this.cameraFrustum=i.cB.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,0,!m);const oe=new Float32Array(16);i.bA(oe),i.cS(oe,oe,[1,-1,1]),i.cU(oe,oe,this._pitch),i.bB(oe,oe,this.angle);const de=i.cd(new Float32Array(16),this._fov,this.width/this.height,this._nearZ,this._farZ);this.starsProjMatrix=i.bz(de);const we=(Math.PI/2-this._pitch)*(this.height/this._fov)*this._horizonShift;de[8]=2*-d.x/this.width,de[9]=2*(d.y+we)/this.height,this.skyboxMatrix=i.aB(oe,de,oe);const ve=this.point,De=ve.x,Pe=ve.y,Ve=this.width%2/2,Xe=this.height%2/2,We=Math.cos(this.angle),bt=Math.sin(this.angle),ut=De-Math.round(De)+We*Ve+bt*Xe,xt=Pe-Math.round(Pe)+We*Xe+bt*Ve,ct=new Float64Array(Q);if(i.br(ct,ct,[ut>.5?ut-1:ut,xt>.5?xt-1:xt,0]),this.alignedProjMatrix=ct,Q=i.bC(),i.cS(Q,Q,[this.width/2,-this.height/2,1]),i.br(Q,Q,[1,-1,0]),this.labelPlaneMatrix=Q,Q=i.bC(),i.cS(Q,Q,[1,-1,1]),i.br(Q,Q,[-1,-1,0]),i.cS(Q,Q,[2/this.width,2/this.height,1]),this.glCoordMatrix=Q,this.pixelMatrix=i.aB(new Float64Array(16),this.labelPlaneMatrix,Y),this._calcFogMatrices(),this._distanceTileDataCache={},Q=i.bl(new Float64Array(16),this.pixelMatrix),!Q)throw new Error("failed to invert matrix");if(this.pixelMatrixInverse=Q,this.projection.name==="globe"||this.mercatorFromTransition){this.globeMatrix=i.cV(this);const it=[this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]];this.globeCenterInViewSpace=i.af(it,it,D),this.globeRadius=this.worldSize/2/Math.PI-1}else this.globeMatrix=Q;this._projMatrixCache={},this._alignedProjMatrixCache={},this._pixelsToTileUnitsCache={},this._expandedProjMatrixCache={}}_calcFogMatrices(){this._fogTileMatrixCache={};const d=this.cameraWorldSizeForFog,m=this.cameraPixelsPerMeter,w=this._camera.position,M=1/this.height/this._pixelsPerMercatorPixel,O=[d,d,m];i.c5(O,O,M),i.c5(w,w,-1),i.cW(w,w,O);const D=i.bC();i.br(D,D,w),i.cS(D,D,O),this.mercatorFogMatrix=D,this.worldToFogMatrix=this._camera.getWorldToCameraPosition(d,m,M)}_computeCameraPosition(d){const m=(d=d||this.pixelsPerMeter)/this.pixelsPerMeter,w=this._camera.forward(),M=this.point,O=this._mercatorZfromZoom(this._seaLevelZoom?this._seaLevelZoom:this._zoom)*m-d/this.worldSize*this._centerAltitude;return[M.x/this.worldSize-w[0]*O,M.y/this.worldSize-w[1]*O,d/this.worldSize*this._centerAltitude-w[2]*O]}_updateCameraState(){this.height&&(this._camera.setPitchBearing(this._pitch,this.angle),this._camera.position=this._computeCameraPosition())}_translateCameraConstrained(d){const m=this._maxCameraBoundsDistance()*Math.cos(this._pitch),w=this._camera.position[2],M=d[2];let O=1;this.projection.wrap&&(this.center=this.center.wrap()),M>0&&(O=Math.min((m-w)/M,1)),this._camera.position=i.bH([],this._camera.position,d,O),this._updateStateFromCamera()}_updateStateFromCamera(){const d=this._camera.position,m=this._camera.forward(),{pitch:w,bearing:M}=this._camera.getPitchBearing(),O=i.cf(this._centerAltitude,this.center.lat)*this._pixelsPerMercatorPixel,D=this._mercatorZfromZoom(this._maxZoom)*Math.cos(i.an(this._maxPitch)),B=Math.max((d[2]-O)/Math.cos(w),D),V=this._zoomFromMercatorZ(B);i.bH(d,d,m,B),this._pitch=i.aA(w,i.an(this.minPitch),i.an(this.maxPitch)),this.angle=i.bT(M,-Math.PI,Math.PI),this._setZoom(i.aA(V,this._minZoom,this._maxZoom)),this._updateSeaLevelZoom(),this._center=this.coordinateLocation(new i.ae(d[0],d[1],d[2])),this._unmodified=!1,this._constrain(),this._calcMatrices()}_worldSizeFromZoom(d){return Math.pow(2,d)*this.tileSize}_mercatorZfromZoom(d){return this.cameraToCenterDistance/this._worldSizeFromZoom(d)}_minimumHeightOverTerrain(){const d=Math.min(this._seaLevelZoom!=null?this._seaLevelZoom:this._zoom,this._maxZoom)+4;return this._mercatorZfromZoom(d)}_zoomFromMercatorZ(d){return this.scaleZoom(this.cameraToCenterDistance/(Math.max(0,d)*this.tileSize))}zoomFromMercatorZAdjusted(d){let m=0,w=i.cL,M=0,O=1/0;for(;w-m>1e-6&&w>m;){const D=m+.5*(w-m),B=this.tileSize*Math.pow(2,D),V=this.getCameraToCenterDistance(this.projection,D,B),Y=this.scaleZoom(V/(Math.max(0,d)*this.tileSize)),Q=Math.abs(D-Y);QY||oe.y>1)return!0}return!1}isHorizonVisible(){return this.pitch+i.cX(this.fovAboveCenter)>88||this.anyCornerOffEdge(new i.P(0,0),new i.P(this.width,this.height))}zoomDeltaToMovement(d,m){const w=i.ag(i.av([],this._camera.position,d)),M=this._zoomFromMercatorZ(w)+m;return w-this._mercatorZfromZoom(M)}getCameraPoint(){if(this.projection.name==="globe"){const d=function([m,w,M],O){const D=[m,w,M,1];i.aC(D,D,O);const B=D[3]=Math.max(D[3],1e-6);return D[0]/=B,D[1]/=B,D[2]/=B,D}([this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]],this.pixelMatrix);return new i.P(d[0],d[1])}{const d=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new i.P(0,d))}}getCameraToCenterDistance(d,m=this.zoom,w=this.worldSize){const M=i.cO(d,m,this.width,this.height,1024),O=d.pixelSpaceConversion(this.center.lat,w,M);let D=.5/Math.tan(.5*this._fov)*this.height*O;return this.isOrthographic&&(D=i.ak(1,D,i.d0(this.pitch>=Ih?1:this.pitch/Ih))),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 Em=(_,d)=>{if(d>0&&_.terrain&&i.w("Cutoff is currently disabled on terrain"),d<=0||_.terrain)return{shouldRenderCutoff:!1,uniformValues:{u_cutoff_params:[0,0,0,1]}};const m=_.transform,w=Math.max(Math.abs(m._zoom-(_.minCutoffZoom-1)),1),M=m.isLODDisabled(!1)?i.ah(60,45,m.pitch):i.ah(30,15,m.pitch),O=m._farZ-m._nearZ,D=d*m.height,B=((1-(V=M))*m.cameraToCenterDistance+V*(m._farZ+D))*w;var V;return{shouldRenderCutoff:M<1,uniformValues:{u_cutoff_params:[m._nearZ,m._farZ,(B-m._nearZ)/O,(B-D-m._nearZ)/O]}}},Qu=2048;class _v{constructor(d,m){this.aabb=d,this.lastCascade=m}}class Uae{add(d,m){const w=this.receivers[d.key];w!==void 0?(w.aabb.min[0]=Math.min(w.aabb.min[0],m.min[0]),w.aabb.min[1]=Math.min(w.aabb.min[1],m.min[1]),w.aabb.min[2]=Math.min(w.aabb.min[2],m.min[2]),w.aabb.max[0]=Math.max(w.aabb.max[0],m.max[0]),w.aabb.max[1]=Math.max(w.aabb.max[1],m.max[1]),w.aabb.max[2]=Math.max(w.aabb.max[2],m.max[2])):this.receivers[d.key]=new _v(m,null)}clear(){this.receivers={}}get(d){return this.receivers[d.key]}computeRequiredCascades(d,m,w){const M=i.d9.fromPoints(d.points);let O=0;for(const D in this.receivers){const B=this.receivers[D];if(!B||!M.intersectsAabb(B.aabb))continue;B.aabb.min=M.closestPoint(B.aabb.min),B.aabb.max=M.closestPoint(B.aabb.max);const V=B.aabb.getCorners();for(let Y=0;Y1||oe[1]<-1||oe[1]>1){Q=!1;break}}if(B.lastCascade=Y,O=Math.max(O,Y),Q)break}}return O+1}}class Cy{constructor(d){this.painter=d,this._enabled=!1,this._shadowLayerCount=0,this._numCascadesToRender=0,this._cascades=[],this._groundShadowTiles=[],this._receivers=new Uae,this._depthMode=new dn(d.context.gl.LEQUAL,dn.ReadWrite,[0,1]),this._uniformValues={u_light_matrix_0:new Float32Array(16),u_light_matrix_1:new Float32Array(16),u_shadow_intensity:0,u_fade_range:[0,0],u_shadow_normal_offset:[1,1,1],u_shadow_texel_size:1,u_shadow_map_resolution:1,u_shadow_direction:[0,0,1],u_shadow_bias:[36e-5,.0012,.012],u_shadowmap_0:0,u_shadowmap_1:0},this._forceDisable=!1,this.useNormalOffset=!1}destroy(){for(const d of this._cascades)d.texture.destroy(),d.framebuffer.destroy();this._cascades=[]}updateShadowParameters(d,m){const w=this.painter;if(this._enabled=!1,this._shadowLayerCount=0,this._receivers.clear(),!m||!m.properties)return;const M=m.properties.get("shadow-intensity");if(!m.shadowsEnabled()||M<=0||(this._shadowLayerCount=w.style.order.reduce((we,ve)=>{const De=w.style._mergedLayers[ve];return we+(De.hasShadowPass()&&!De.isHidden(d.zoom)?1:0)},0),this._enabled=this._shadowLayerCount>0,!this.enabled))return;const O=w.context,D=Qu,B=Qu;if(this._cascades.length===0||Qu!==this._cascades[0].texture.size[0]){this._cascades=[];for(let we=0;we<2;++we){const ve=w._shadowMapDebug,De=O.gl,Pe=O.createFramebuffer(D,B,ve?1:0,"texture"),Ve=new i.T(O,{width:D,height:B,data:null},De.DEPTH_COMPONENT16);if(Pe.depthAttachment.set(Ve.texture),ve){const Xe=new i.T(O,{width:D,height:B,data:null},De.RGBA8);Pe.colorAttachment0.set(Xe.texture)}this._cascades.push({framebuffer:Pe,texture:Ve,matrix:[],far:0,boundingSphereRadius:0,frustum:new i.cB,scale:0})}}this.shadowDirection=wv(m);let V=0;if(d.elevation){const we=d.elevation,ve=[1e4,-1e4];we.visibleDemTiles.filter(De=>De.dem).forEach(De=>{const Pe=De.dem.tree;ve[0]=Math.min(ve[0],Pe.minimums[0]),ve[1]=Math.max(ve[1],Pe.maximums[0])}),ve[0]!==1e4&&(V=(ve[1]-ve[0])*we.exaggeration())}const Y=1.5*d.cameraToCenterDistance,Q=3*Y,ce=new Float64Array(16);for(let we=0;we=0)return{};const O=function(V,Y,Q){const ce=Q/(1<0&&(i.d8(O[1],O[1],[M[0]*D,0,0]),i.d8(O[2],O[2],[M[0]*D,0,0])),M[1]<0?(i.d8(O[0],O[0],[0,M[1]*D,0]),i.d8(O[1],O[1],[0,M[1]*D,0])):M[1]>0&&(i.d8(O[2],O[2],[0,M[1]*D,0]),i.d8(O[3],O[3],[0,M[1]*D,0]));const B={};return B.vertices=O,B.planes=[bv(O[1],O[0],O[4]),bv(O[2],O[1],O[5]),bv(O[3],O[2],O[6]),bv(O[0],O[3],O[7])],B}addShadowReceiver(d,m,w){this._receivers.add(d,i.d9.fromTileIdAndHeight(d,m,w))}getMaxCascadeForTile(d){const m=this._receivers.get(d);return m&&m.lastCascade?m.lastCascade:0}}function bv(_,d,m){const w=i.av([],m,d),M=i.av([],_,d),O=i.bI([],w,M),D=i.ag(O);return D===0?[0,0,1,0]:(i.c5(O,O,1/D),[O[0],O[1],O[2],-i.bJ(O,d)])}function wv(_){const d=_.properties.get("direction"),m=i.d4(d.x,d.y,d.z);m[2]=i.aA(m[2],0,75);const w=i.d6([m[0],m[1],m[2]]);return i.d5(w.x,w.y,w.z)}function xp(_,d,m){const w=d.properties.get("color-use-theme")==="none",M=d.properties.get("color"),O=d.properties.get("intensity"),D=d.properties.get("direction"),B=[D.x,D.y,D.z],V=m.properties.get("color-use-theme")==="none",Y=m.properties.get("color"),Q=m.properties.get("intensity"),ce=Math.max(i.bJ([0,0,1],B),0),oe=[0,0,0];i.c5(oe,Y.toPremultipliedRenderColor(V?null:_.getLut(d.scope)).toArray01Linear().slice(0,3),Q);const de=[0,0,0];return i.c5(de,M.toPremultipliedRenderColor(w?null:_.getLut(m.scope)).toArray01Linear().slice(0,3),ce*O),i.db([oe[0]>0?oe[0]/(oe[0]+de[0]):0,oe[1]>0?oe[1]/(oe[1]+de[1]):0,oe[2]>0?oe[2]/(oe[2]+de[2]):0])}function Im(_,d,m,w,M,O){const D=_.zoom,B=_.scale,V=_.worldSize,Y=1/V,Q=_.aspect,ce=Math.sqrt(1+Q*Q)*Math.tan(.5*_.fovX),oe=ce*ce,de=w-m,we=w+m;let ve,De;oe>de/we?(ve=w,De=w*ce):(ve=.5*we*(1+oe),De=.5*Math.sqrt(de*de+2*(w*w+m*m)*oe+we*we*oe*oe));const Pe=_.projection.pixelsPerMeter(_.center.lat,V),Ve=_._camera.getCameraToWorldMercator(),Xe=[0,0,-ve*Y];i.af(Xe,Xe,Ve);let We=De*Y;const bt=_._edgeInsets;if(!(bt.left===0&&bt.top===0&&bt.right===0&&bt.bottom===0||bt.left===bt.right&&bt.top===bt.bottom)){const dr=_._camera.getWorldToCamera(_.worldSize,_.projection.zAxisUnit==="meters"?Pe:1),Tr=_._camera.getCameraToClipPerspective(_._fov,_.width/_.height,m,w);Tr[8]=2*-_.centerOffset.x/_.width,Tr[9]=2*_.centerOffset.y/_.height;const Hr=new Float64Array(16);i.cP(Hr,Tr,dr);const Nr=new Float64Array(16);i.bl(Nr,Hr);const br=i.cB.fromInvProjectionMatrix(Nr,V,D,!0);for(const nn of br.points){const Jr=((ut=nn)[0]/=B,ut[1]/=B,ut[2]=i.cf(ut[2],_._center.lat),ut);We=Math.max(We,i.c6(i.da([],Xe,Jr)))}}var ut;We*=M/(M-1);const xt=Math.acos(d[2]),ct=Math.atan2(-d[0],-d[1]),it=new kk;it.position=Xe,it.setPitchBearing(xt,ct);const St=it.getWorldToCamera(V,Pe),Dt=We*V,Lt=Math.min(_._mercatorZfromZoom(17)*V*-2,-2*Dt),Ht=it.getCameraToClipOrthographic(-Dt,Dt,-Dt,Dt,Lt,(Dt+O*Pe)/d[2]),Wt=new Float64Array(16);i.aB(Wt,Ht,St);const sr=i.d5(Math.floor(1e6*Xe[0])/1e6*V,Math.floor(1e6*Xe[1])/1e6*V,0),_r=.5*M,Bt=[0,0,0];i.af(Bt,sr,Wt),i.c5(Bt,Bt,_r);const Tt=[Math.floor(Bt[0]),Math.floor(Bt[1]),Math.floor(Bt[2])],Jt=[0,0,0];i.av(Jt,Bt,Tt),i.c5(Jt,Jt,-1/_r);const qt=new Float64Array(16);return i.bA(qt),i.br(qt,qt,Jt),i.aB(Wt,qt,Wt),[Wt,Dt]}class qae extends i.E{constructor(d){super(),this.requestManager=d,this.models={"":{}},this.modelUris={"":{}},this.modelByURL={},this.numModelsLoading={}}loadModel(d,m){return i.dc(this.requestManager.transformRequest(m,i.R.Model).url).then(w=>{if(!w)return;const M=i.dd(w),O=new i.de(d,m,void 0,void 0,M);return O.computeBoundsAndApplyParent(),O}).catch(w=>{if(w&&w.status===404)return null;this.fire(new i.y(new Error(`Could not load model ${d} from ${m}: ${w.message}`)))})}load(d,m,w={forceReload:!1}){this.models[m]||(this.models[m]={});const M=Object.keys(d),O=[],D=[];for(const B of M){const V=d[B];this.hasURLBeenRequested(V)&&!w.forceReload||(this.modelByURL[V]={modelId:B,scope:m},O.push(this.loadModel(B,V)),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 V=0;V{this.fire(new i.y(new Error(`Could not load models: ${B.message}`)))})}isLoaded(){for(const d in this.numModelsLoading)if(this.numModelsLoading[d]>0)return!1;return!0}hasModel(d,m,w={exactIdMatch:!1}){return!!(w.exactIdMatch?this.getModel(d,m):this.getModelByURL(this.modelUris[m][d]))}getModel(d,m){return this.models[m]||(this.models[m]={}),this.models[m][d]?this.models[m][d].model:void 0}getModelByURL(d){if(!d)return null;const m=this.modelByURL[d];return m?this.models[m.scope][m.modelId].model:null}hasModelBeenAdded(d,m){return this.models[m]&&this.models[m][d]!==void 0}getModelURIs(d){return this.modelUris[d]||{}}addModel(d,m,w){this.models[w]||(this.models[w]={}),this.modelUris[w]||(this.modelUris[w]={});const M=this.requestManager.normalizeModelURL(m);if((this.hasModel(d,w,{exactIdMatch:!0})||this.hasModelBeenAdded(d,w))&&this.modelUris[w][d]===M)this.models[w][d].numReferences++;else if(this.hasURLBeenRequested(M)){const{scope:O,modelId:D}=this.modelByURL[M];this.models[O][D].numReferences++}else this.modelUris[w][d]=M,this.load({[d]:this.modelUris[w][d]},w)}addModelURLs(d,m){this.models[m]||(this.models[m]={}),this.modelUris[m]||(this.modelUris[m]={});const w=this.modelUris[m];for(const M in d)w[M]=this.requestManager.normalizeModelURL(d[M])}reloadModels(d){this.load(this.modelUris[d],d,{forceReload:!0})}addModelsFromBucket(d,m){this.models[m]||(this.models[m]={}),this.modelUris[m]||(this.modelUris[m]={});const w={};for(const M of d)this.hasModel(M,m,{exactIdMatch:!0})||this.hasURLBeenRequested(M)?this.models[m][M].numReferences++:this.modelUris[m][M]&&!this.hasURLBeenRequested(M)?w[M]=this.modelUris[m][M]:!this.hasURLBeenRequested(M)&&i.df(M,!1)&&(this.modelUris[m][M]=this.requestManager.normalizeModelURL(M),w[M]=this.modelUris[m][M]);this.load(w,m)}hasURLBeenRequested(d){return this.modelByURL[d]!==void 0}removeModel(d,m,w=!1,M=!1){if(this.models[m]&&this.models[m][d]&&(this.models[m][d].numReferences--,this.models[m][d].numReferences===0||M)){const O=this.modelUris[m][d];w||delete this.modelUris[m][d],delete this.modelByURL[O];const D=this.models[m][d].model;if(!D)return;delete this.models[m][d],D.destroy()}}destroy(){for(const d of Object.keys(this.models))for(const m of Object.keys(this.models[d])){const w=this.models[d][m].model;delete this.models[d][m],w&&w.destroy()}this.models={"":{}},this.modelUris={"":{}},this.modelByURL={},this.numModelsLoading={}}listModels(d){return this.models[d]||(this.models[d]={}),Object.keys(this.models[d])}upload(d,m){this.models[m]||(this.models[m]={});for(const w in this.models[m])this.models[m][w].model&&this.models[m][w].model.upload(d.context)}}const L3=i.a6.colorTheme,Vae=new i.a9({data:new i.aa(L3.data)});function KI(_){if(!_.metadata||!_.metadata.content_area)return;const d=i.o.devicePixelRatio,{left:m,top:w,width:M,height:O}=_.metadata.content_area,D=m*d,B=w*d;return[D,B,D+M*d,B+O*d]}function ZI(_){if(_)return _.map(([d,m])=>[d*i.o.devicePixelRatio,m*i.o.devicePixelRatio])}class O3{constructor(d,m,w){this.id=d,this.scope=m,this.sourceCache=w,this.pendingRequests=new Set,this.missingRequests=new Set}addPendingRequest(d){this.missingRequests.has(d.name)||this.pendingRequests.has(d.name)||this.pendingRequests.add(d.name)}hasPendingRequests(){return this.pendingRequests.size>0}resolvePendingRequests(){const d=new Map;if(!this.sourceCache.loaded())return d;const m=this.sourceCache.getVisibleCoordinates();if(m.length===0)return d;const w=this.sourceCache.getSource();if(!(w instanceof rc))return d;const M=m.map(D=>this.sourceCache.getTile(D)),O=w.getImages(M,Array.from(this.pendingRequests));for(const[D,B]of O)d.set(i.I.from({name:D,iconsetId:this.id}),B),this.pendingRequests.delete(D);for(const D of this.pendingRequests)this.missingRequests.add(D);return this.pendingRequests.clear(),d}}const Pm=(_,d)=>Ge(_,d&&d.filter(m=>m.identifier!=="source.canvas")),YI=i.aH(Ys,["addLayer","removeLayer","setLights","setPaintProperty","setLayoutProperty","setLayerProperty","setSlot","setFilter","addSource","removeSource","setLayerZoomRange","setLight","setTransition","setGeoJSONSourceData","setTerrain","setFog","setSnow","setRain","setProjection","setCamera","addImport","removeImport","updateImport","addIconset","removeIconset"]),XI=i.aH(Ys,["setCenter","setZoom","setBearing","setPitch"]),Sk=new Set(["background","sky","slot","custom"]),Lm={version:8,layers:[],sources:{}},jv={duration:300,delay:0};class Ju 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({},jv),this._buildingIndex=new C3(this),this.crossTileSymbolIndex=new Eh,this._mergedOrder=[],this._drapedFirstOrder=[],this._mergedLayers={},this._mergedIndoor={},this._mergedSourceCaches={},this._mergedOtherSourceCaches={},this._mergedSymbolSourceCaches={},this._clipLayerPresent=!1,this._hasAppearances=!1,this._has3DLayers=!1,this._hasCircleLayers=!1,this._hasSymbolLayers=!1,this._importedAsBasemap=!1,this._changes=m.styleChanges||new Me,this._hasDataDrivenEmissive=!1,this.dispatcher=m.dispatcher?m.dispatcher:new i.D(i.dh(),this),m.imageManager?this.imageManager=m.imageManager:(this.imageManager=new qe(this.map._spriteFormat),this.imageManager.setEventedParent(this)),this.imageManager.addScope(this.scope),this.glyphManager=m.glyphManager?m.glyphManager:new i.di(d._requestManager,m.localFontFamily?i.dj.all:m.localIdeographFontFamily?i.dj.ideographs:i.dj.none,m.localFontFamily||m.localIdeographFontFamily),m.modelManager?this.modelManager=m.modelManager:(this.modelManager=new qae(d._requestManager),this.modelManager.setEventedParent(this)),this._layers={},this._sourceCaches={},this._otherSourceCaches={},this._symbolSourceCaches={},this._loaded=!1,this._precompileDone=!1,this._shouldPrecompile=!1,this._availableImages=[],this._availableModels={},this._order=[],this._markersNeedUpdate=!1,this.options=m.configOptions?m.configOptions:new Map,this._configDependentLayers=m.configDependentLayers?m.configDependentLayers:new Set,this._indoorDependentLayers=m.indoorDependentLayers?m.indoorDependentLayers:new Set,this._config=m.config,this._styleColorTheme={lut:null,lutLoading:!1,lutLoadingCorrelationID:0,colorTheme:null,colorThemeOverride:m.colorThemeOverride},this._styleColorThemeForScope={},this._initialConfig=m.initialConfig,this.dispatcher.broadcast("setReferrer",i.dk());const w=this;this._rtlTextPluginCallback=Ju.registerForPluginStateChange(M=>{w.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:M.pluginStatus,pluginURL:M.pluginURL},(O,D)=>{if(i.dl(O),D&&D.every(B=>B))for(const B in w._sourceCaches){const V=w._sourceCaches[B],Y=V.getSource().type;Y!=="vector"&&Y!=="geojson"||V.reload()}})}),this.on("data",M=>{if(M.dataType!=="source"||M.sourceDataType!=="metadata")return;const O=this.getOwnSource(M.sourceId);if(O&&O.vectorLayerIds)for(const D in this._layers){const B=this._layers[D];B.source===O.id&&this._validateLayer(B)}})}load(d){return d?(typeof d=="string"?this.loadURL(d):this.loadJSON(d),this):this}_getGlobalId(d){if(!d)return null;if(typeof d=="string"){if(i.h(d))return d;const m=i.dm(d);if(!m.startsWith("http"))try{return new URL(m,location.href).toString()}catch{return m}return m}return`json://${i.dn(JSON.stringify(d))}`}_diffStyle(d,m,w){this.globalId=this._getGlobalId(d);const M=(O,D)=>{try{D(null,this.setState(O,w))}catch(B){D(B,!1)}};if(typeof d=="string"){const O=this.map._requestManager.normalizeStyleURL(d),D=this.map._requestManager.transformRequest(O,i.R.Style);i.m(D,(B,V)=>{B?this.fire(new i.y(B)):V&&M(V,m)})}else typeof d=="object"&&M(d,m)}loadURL(d,m={}){this.fire(new i.z("dataloading",{dataType:"style"}));const w=typeof m.validate=="boolean"?m.validate:!i.h(d);this.globalId=this._getGlobalId(d),d=this.map._requestManager.normalizeStyleURL(d,m.accessToken),this.resolvedImports.add(d);const M=this.importsCache.get(d);if(M)return this._load(M,w);const O=this.map._requestManager.transformRequest(d,i.R.Style);this._request=i.m(O,(D,B)=>{if(this._request=null,D)this.fire(new i.y(D));else if(B)return this.importsCache.set(d,B),this._load(B,w)})}loadJSON(d,m={}){this.fire(new i.z("dataloading",{dataType:"style"})),this.globalId=this._getGlobalId(d),this._request=i.o.frame(()=>{this._request=null,this._load(d,m.validate!==!1)})}loadEmpty(){this.fire(new i.z("dataloading",{dataType:"style"})),this._load(Lm,!1)}_loadImports(d,m,w){if(this.importDepth>=4)return i.w("Style doesn't support nesting deeper than 5"),Promise.resolve();const M=[];for(const O of d){const D=this._createFragmentStyle(O),B=new Promise(Q=>{D.once("style.import.load",Q),D.once("error",Q)}).then(()=>this.mergeAll());if(M.push(B),this.resolvedImports.has(O.url)){D.loadEmpty();continue}const V=O.data||this.importsCache.get(O.url);V?(D.loadJSON(V,{validate:m}),this._isInternalStyle(V)&&(D.globalId=null)):O.url?D.loadURL(O.url,{validate:m}):D.loadEmpty();const Y={style:D,id:O.id,config:O.config};if(w){const Q=this.fragments.findIndex(({id:ce})=>ce===w);this.fragments=this.fragments.slice(0,Q).concat(Y).concat(this.fragments.slice(Q))}else this.fragments.push(Y)}return Promise.allSettled(M)}getImportGlobalIds(d=this,m=new Set){for(const w of d.fragments)w.style.globalId&&m.add(w.style.globalId),this.getImportGlobalIds(w.style,m);return[...m.values()]}_createFragmentStyle(d){const m=this.scope?i.B(d.id,this.scope):d.id;let w;const M=this._initialConfig&&this._initialConfig[m];(d.config||M)&&(w=Object.assign({},d.config,M));const O=new Ju(this.map,{scope:m,styleChanges:this._changes,importDepth:this.importDepth+1,importsCache:this.importsCache,resolvedImports:new Set(this.resolvedImports),dispatcher:this.dispatcher,imageManager:this.imageManager,glyphManager:this.glyphManager,modelManager:this.modelManager,config:w,configOptions:this.options,colorThemeOverride:d["color-theme"],configDependentLayers:this._configDependentLayers,indoorDependentLayers:this._indoorDependentLayers});return O.setEventedParent(this.map,{style:O}),O}_reloadImports(){this.mergeAll(),this._updateMapProjection(),this.updateConfigDependencies(),this._updateLayers(this._indoorDependentLayers),this.map._triggerCameraUpdate(this.camera),this.dispatcher.broadcast("setLayers",{layers:this._serializeLayers(this._order),scope:this.scope,options:this.options}),this._shouldPrecompile=this.map._precompilePrograms&&this.isRootStyle()}_isInternalStyle(d){return this.isRootStyle()&&(d.fragment||!!d.schema&&d.fragment!==!1)}_load(d,m){if(this._isInternalStyle(d)){const O=Object.assign({},Lm,{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&&Pm(this,Oa(d)))return;this._loaded=!0,this.stylesheet=i.dp(d);const w=()=>{for(const V in d.sources)this.addSource(V,d.sources[V],{validate:!1,isInitialLoad:!0});if(d.iconsets)for(const V in d.iconsets)this.addIconset(V,d.iconsets[V]);d.sprite?this._loadIconset(d.sprite):(this.imageManager.setLoaded(!0,this.scope),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope,isLoaded:!0})),!this.glyphManager.url&&d.glyphs&&this.glyphManager.setURL(d.glyphs);const O=gf(this.stylesheet.layers);if(this._order=O.map(V=>V.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 V=this.stylesheet.lights[0];this.light=new At(V.properties,V.id)}else this.setLights(this.stylesheet.lights);this.light||(this.light=new At(this.stylesheet.light)),this._layers={};for(const V of O){const Y=i.du(V,this.scope,this._styleColorTheme.lut,this.options);Y.expressionDependencies.configDependencies.size!==0&&this._configDependentLayers.add(Y.fqid),Y.expressionDependencies.isIndoorDependent&&this._indoorDependentLayers.add(Y.fqid),this._hasAppearances=this._hasAppearances||Y.getAppearances().length!==0,Y.setEventedParent(this,{layer:{id:Y.id}}),this._layers[Y.id]=Y;const Q=this.getOwnLayerSourceCache(Y),ce=!!this.directionalLight&&this.directionalLight.shadowsEnabled();Q&&Y.canCastShadows()&&ce&&(Q.castsShadows=!0)}this.stylesheet.featuresets&&this.setFeaturesetSelectors(this.stylesheet.featuresets),this.stylesheet.models&&this.addModelURLs(this.stylesheet.models);const 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(V=>{this.fire(new i.y(new Error("Failed to load imports",V))),this.fire(new i.z(B?"style.load":"style.import.load"))}):(this._reloadImports(),this.fire(new i.z(B?"style.load":"style.import.load")))};this._styleColorTheme.colorTheme=this.stylesheet["color-theme"];const M=this._styleColorTheme.colorThemeOverride?this._styleColorTheme.colorThemeOverride:this._styleColorTheme.colorTheme;if(M){const O=this._evaluateColorThemeData(M);this._loadColorTheme(O).then(()=>{w()}).catch(D=>{i.w(`Couldn't load color theme from the stylesheet: ${D}`),w()})}else this._styleColorTheme.lut=null,w()}isRootStyle(){return this.importDepth===0}hasAppearances(){return this._hasAppearances||this.fragments.some(d=>d.style.hasAppearances())}mergeAll(){let d,m,w,M,O,D,B,V,Y,Q;const ce={};this.terrain&&this.terrain.scope!==this.scope&&delete this.terrain,this.forEachFragmentStyle(oe=>{if(oe.stylesheet){if(oe.light!=null&&(d=oe.light),oe.stylesheet.lights)for(const de of oe.stylesheet.lights)de.type==="ambient"&&oe.ambientLight!=null&&(m=oe.ambientLight),de.type==="directional"&&oe.directionalLight!=null&&(w=oe.directionalLight);M=this._prioritizeTerrain(M,oe.terrain,oe.stylesheet.terrain),oe.stylesheet.fog&&oe.fog!=null&&(O=oe.fog),oe.stylesheet.snow&&oe.snow!=null&&(D=oe.snow),oe.stylesheet.rain&&oe.rain!=null&&(B=oe.rain),oe.stylesheet.camera!=null&&(Q=oe.stylesheet.camera),oe.stylesheet.projection!=null&&(V=oe.stylesheet.projection),oe.stylesheet.transition!=null&&(Y=oe.stylesheet.transition),ce[oe.scope]=oe._styleColorTheme}}),this.light=d,this.ambientLight=m,this.directionalLight=w,this.fog=O,this.snow=D,this.rain=B,this._styleColorThemeForScope=ce,M===null?delete this.terrain:this.terrain=M,this.camera=Q||{"camera-projection":"perspective"},this.projection=V||{name:"mercator"},this.transition=Object.assign({},jv,Y),this.mergeSources(),this.mergeLayers(),this.mergeIndoor()}forEachFragmentStyle(d){const m=w=>{for(const M of w.fragments)m(M.style);d(w)};m(this)}_prioritizeTerrain(d,m,w){const M=d&&d.drapeRenderMode===0;return w===null?m&&m.drapeRenderMode===0?m:M?d:null:m!=null&&(!d||M||m&&m.drapeRenderMode===1)?m:d}mergeTerrain(){let d;this.terrain&&this.terrain.scope!==this.scope&&delete this.terrain,this.forEachFragmentStyle(m=>{d=this._prioritizeTerrain(d,m.terrain,m.stylesheet.terrain)}),d===null?delete this.terrain:this.terrain=d}mergeProjection(){let d;this.forEachFragmentStyle(m=>{m.stylesheet.projection!=null&&(d=m.stylesheet.projection)}),this.projection=d||{name:"mercator"}}mergeSources(){const d={},m={},w={};this.forEachFragmentStyle(M=>{for(const O in M._sourceCaches){const D=i.B(O,M.scope);d[D]=M._sourceCaches[O]}for(const O in M._otherSourceCaches){const D=i.B(O,M.scope);m[D]=M._otherSourceCaches[O]}for(const O in M._symbolSourceCaches){const D=i.B(O,M.scope);w[D]=M._symbolSourceCaches[O]}}),this._mergedSourceCaches=d,this._mergedOtherSourceCaches=m,this._mergedSymbolSourceCaches=w}mergeIndoor(){this.forEachFragmentStyle(d=>{if(d.stylesheet&&d.stylesheet.indoor)for(const m of Object.values(d.stylesheet.indoor)){const w=m,M=i.B(w.sourceId,d.scope);this._mergedIndoor[M]=new Set(w.sourceLayers||[])}})}mergeLayers(){const d={},m=[],w={};this._mergedSlots=[],this._has3DLayers=!1,this._hasCircleLayers=!1,this._hasSymbolLayers=!1,this.forEachFragmentStyle(D=>{for(const B of D._order){const V=D._layers[B];if(V.type==="slot"){const Y=i.dq(B);if(d[Y])continue;d[Y]=[]}V.slot&&d[V.slot]?d[V.slot].push(V):m.push(V)}}),this._mergedOrder=[];let M=-1;const O=(D=[])=>{for(const B of D)if(B.type==="slot"){const V=i.dq(B.id);d[V]&&O(d[V]),this._mergedSlots.push(V)}else{const V=i.B(B.id,B.scope);this._mergedOrder.push(V),w[V]=B,B.is3D(!!this.terrain)&&(this._has3DLayers=!0,M=this._mergedOrder.length-1),B.type==="circle"&&(this._hasCircleLayers=!0),B.type==="symbol"&&(this._hasSymbolLayers=!0),B.type==="clip"&&(this._clipLayerPresent=!0)}};if(O(m),this._has3DLayers){const D={};for(let B=0;BD[B]-D[V])}this._mergedLayers=w,this.updateDrapeFirstLayers(),this._buildingIndex.processLayersChanged(),this._updateDataDrivenEmissiveStrength()}terrainSetForDrapingOnly(){return!!this.terrain&&this.terrain.drapeRenderMode===0}getCamera(){return this.stylesheet.camera}setCamera(d){return this.stylesheet.camera=Object.assign({},this.stylesheet.camera,d),this.camera=this.stylesheet.camera,this}_evaluateColorThemeData(d){return d.data?function(m,w,M,O){const D=Object.assign({},w);for(const V of Object.keys(L3))D[V]===void 0&&(D[V]=L3[V].default);const B=new i.a8(Vae,m,new Map(M));return B.setTransitionOrValue(D,M),B.untransitioned().possiblyEvaluate(new i.ac(0,{worldview:void 0}))}(this.scope,d,this.options).get("data"):null}_loadColorTheme(d){this._styleColorTheme.lutLoading=!0,this._styleColorTheme.lutLoadingCorrelationID+=1;const m=this._styleColorTheme.lutLoadingCorrelationID;return new Promise((w,M)=>{const O="data:image/png;base64,";if(!d||d.length===0)return this._styleColorTheme.lut=null,this._styleColorTheme.lutLoading=!1,void w();let D=d;D.startsWith(O)||(D=O+D);const B=i.I.from("mapbox-reserved-lut"),V=new Image;V.src=D,V.onerror=()=>{this._styleColorTheme.lutLoading=!1,M(new Error("Failed to load image data"))},V.onload=()=>{if(this._styleColorTheme.lutLoadingCorrelationID!==m)return void w();this._styleColorTheme.lutLoading=!1;const{width:Y,height:Q,data:ce}=i.o.getImageData(V);if(Q>32)return void M(new Error("The height of the image must be less than or equal to 32 pixels."));if(Y!==Q*Q)return void M(new Error("The width of the image must be equal to the height squared."));this.getImage(B)&&this.removeImage(B),this.addImage(B,{data:new i.q({width:Y,height:Q},ce),pixelRatio:1,sdf:!1,usvg:!1,version:0});const oe=this.imageManager.getImage(B,this.scope);oe?(this._styleColorTheme.lut={image:oe.data,data:d},w()):M(new Error("Missing LUT image."))}})}getLut(d){const m=this._styleColorThemeForScope[d];return m?m.lut:null}setProjection(d){d?this.stylesheet.projection=d:delete this.stylesheet.projection,this.mergeProjection(),this._updateMapProjection()}applyProjectionUpdate(){this._loaded&&(this.dispatcher.broadcast("setProjection",this.map.transform.projectionOptions),this.map.transform.projection.requiresDraping?(this.getTerrain()||this.stylesheet.terrain)&&!this.disableElevatedTerrain||this.setTerrainForDraping():this.terrainSetForDrapingOnly()&&this.setTerrain(null,0))}_updateMapProjection(){this.isRootStyle()&&(this.map._useExplicitProjection?this.applyProjectionUpdate():this.map._prioritizeAndUpdateProjection(null,this.projection))}_loadSprite(d){this._spriteRequest=function(m,w,M){let O,D,B;const V=i.o.devicePixelRatio>1?"@2x":"";let Y=i.m(w.transformRequest(w.normalizeSpriteURL(m,V,".json"),i.R.SpriteJSON),(oe,de)=>{Y=null,B||(B=oe,O=de,ce())}),Q=i.n(w.transformRequest(w.normalizeSpriteURL(m,V,".png"),i.R.SpriteImage),(oe,de)=>{Q=null,B||(B=oe,D=de,ce())});function ce(){if(B)M(B);else if(O&&D){const oe=i.o.getImageData(D),de={};for(const we in O){const{width:ve,height:De,x:Pe,y:Ve,sdf:Xe,pixelRatio:We,stretchX:bt,stretchY:ut,content:xt}=O[we],ct=new i.q({width:ve,height:De});i.q.copy(oe,ct,{x:Pe,y:Ve},{x:0,y:0},{width:ve,height:De},null),de[we]={data:ct,pixelRatio:We!==void 0?We:1,sdf:Xe!==void 0&&Xe,stretchX:bt,stretchY:ut,content:xt,usvg:!1,version:0}}M(null,de)}}return{cancel(){Y&&(Y.cancel(),Y=null),Q&&(Q.cancel(),Q=null)}}}(d,this.map._requestManager,(m,w)=>{if(this._spriteRequest=null,m)this.fire(new i.y(m));else if(w){const M=new Map;for(const O in w)M.set(i.I.from(O),w[O]);this.addImages(M)}this.imageManager.setLoaded(!0,this.scope),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope,isLoaded:!0}),this.fire(new i.z("data",{dataType:"style"}))})}addIconset(d,m){if(m.type==="sprite")return void this._loadSprite(m.url);const w=this.getOwnSourceCache(m.source);if(!w)return void this.fire(new i.y(new Error(`Source "${m.source}" as specified by iconset "${d}" does not exist and cannot be used as an iconset source`)));const M=w.getSource();if(M.type!=="raster-array")return void this.fire(new i.y(new Error(`Source "${m.source}" as specified by iconset "${d}" is not a "raster-array" source and cannot be used as an iconset source`)));M.partial=!1;const O=new O3(d,this.scope,w);this.imageManager.addImageProvider(O,this.scope)}removeIconset(d){this.imageManager.removeImageProvider(d,this.scope)}_loadIconset(d){if(!i.h(d)&&this.map._spriteFormat!=="icon_set"||this.map._spriteFormat==="raster")return void this._loadSprite(d);const m=this.map._spriteFormat==="auto";var w,M;this._spriteRequest=(M=(O,D)=>{if(this._spriteRequest=null,O)m?this._loadSprite(d):this.fire(new i.y(O));else if(D){const B=new Map;for(const V in D)B.set(i.I.from(V),D[V]);this.addImages(B)}this.imageManager.setLoaded(!0,this.scope),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope,isLoaded:!0}),this.fire(new i.z("data",{dataType:"style"}))},i.bu((w=this.map._requestManager).transformRequest(w.normalizeIconsetURL(d),i.R.Iconset),(O,D)=>{if(O)return void M(O);const B={},V=i.dg(new i.bt(D));for(const Y of V.icons){const Q={version:1,pixelRatio:i.o.devicePixelRatio,content:KI(Y),stretchX:Y.metadata?ZI(Y.metadata.stretch_x_areas):void 0,stretchY:Y.metadata?ZI(Y.metadata.stretch_y_areas):void 0,sdf:!1,usvg:!0,icon:Y};B[Y.name]=Q}M(null,B)}))}_validateLayer(d){const m=this.getOwnSource(d.source);if(!m)return;const w=d.sourceLayer;w&&(m.type==="geojson"||m.vectorLayerIds&&m.vectorLayerIds.indexOf(w)===-1)&&this.fire(new i.y(new Error(`Source layer "${w}" does not exist on source "${m.id}" as specified by style layer "${d.id}"`)))}loaded(){if(!this._loaded||Object.keys(this._changes.getUpdatedSourceCaches()).length)return!1;for(const d in this._sourceCaches)if(!this._sourceCaches[d].loaded())return!1;if(!this.imageManager.isLoaded()||this.imageManager.hasPatternsInFlight()||!this.modelManager.isLoaded()||this._styleColorTheme.lutLoading)return!1;for(const{style:d}of this.fragments)if(!d.loaded())return!1;return!0}_serializeImports(){if(this.stylesheet.imports)return this.stylesheet.imports.map((d,m)=>{const w=this.fragments[m];return w&&w.style&&(d.data=w.style.serialize()),d})}_serializeSources(){const d={};for(const m in this._sourceCaches){const w=this._sourceCaches[m].getSource();d[w.id]||(d[w.id]=w.serialize())}return d}_serializeLayers(d){const m=[];for(const w of d){const M=this._layers[w];M&&M.type!=="custom"&&m.push(M.serialize())}return m}hasLightTransitions(){return!(!this.light||!this.light.hasTransition())||!(!this.ambientLight||!this.ambientLight.hasTransition())||!(!this.directionalLight||!this.directionalLight.hasTransition())}hasFogTransition(){return!!this.fog&&this.fog.hasTransition()}hasSnowTransition(){return!!this.snow&&this.snow.hasTransition()}hasRainTransition(){return!!this.rain&&this.rain.hasTransition()}hasTransitions(){if(this.hasLightTransitions()||this.hasFogTransition()||this.hasSnowTransition()||this.hasRainTransition())return!0;for(const d in this._sourceCaches)if(this._sourceCaches[d].hasTransition())return!0;for(const d in this._layers)if(this._layers[d].hasTransition())return!0;return!1}_updateDataDrivenEmissiveStrength(){for(const d in this._mergedLayers){const m=this._mergedLayers[d];if(m._transitionablePaint&&m._transitionablePaint._values){const w=m._transitionablePaint._values["line-emissive-strength"];if(w&&w.value&&w.value.isDataDriven())return void(this._hasDataDrivenEmissive=!0)}}this._hasDataDrivenEmissive=!1}hasDataDrivenEmissiveStrength(){return this._hasDataDrivenEmissive}get order(){return this.terrain?this._drapedFirstOrder:this._mergedOrder}_getOrder(d){return d?this.order:this._mergedOrder}isLayerDraped(d){return!!this.terrain&&d.isDraped(this.getLayerSourceCache(d))}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading")}_checkLayer(d){const m=this.getOwnLayer(d);if(m)return m;this.fire(new i.y(new Error(`The layer '${d}' does not exist in the map's style.`)))}_checkSource(d){const m=this.getOwnSource(d);if(m)return m;this.fire(new i.y(new Error(`The source '${d}' does not exist in the map's style.`)))}precompilePrograms(d,m){const w=this.map.painter;if(w)for(let M=d.minzoom||0;M<(d.maxzoom||25.5);M++){const O=d.getProgramIds();if(O)for(const D of O){const B=d.getDefaultProgramParams(D,m.zoom,this._styleColorTheme.lut);B&&(w.style=this,this.fog&&(w._fogVisible=!0,B.overrideFog=!0,w.getOrCreateProgram(D,B)),w._fogVisible=!1,B.overrideFog=!1,w.getOrCreateProgram(D,B),(this.stylesheet.terrain||this.stylesheet.projection&&this.stylesheet.projection.name==="globe")&&(B.overrideRtt=!0,w.getOrCreateProgram(D,B)))}}}update(d){if(!this._loaded)return;this.ambientLight&&this.ambientLight.recalculate(d),this.directionalLight&&this.directionalLight.recalculate(d);const m=this.calculateLightsBrightness();d.brightness=m||0,m!==this._brightness&&(this._brightness=m,this.dispatcher.broadcast("setBrightness",m)),d.worldview!==this._worldview&&(this._worldview=d.worldview,this.dispatcher.broadcast("setWorldview",this._worldview));const w=this._changes.isDirty();let M=!1;if(this._changes.isDirty()){const B=this._changes.getLayerUpdatesByScope();for(const V in B){const{updatedIds:Y,removedIds:Q}=B[V];(Y||Q)&&(this._updateWorkerLayers(V,Y,Q),M=!0)}this.updateSourceCaches(),this._updateTilesForChangedImages(),this.updateLayers(d),this.light&&this.light.updateTransitions(d),this.ambientLight&&this.ambientLight.updateTransitions(d),this.directionalLight&&this.directionalLight.updateTransitions(d),this.fog&&this.fog.updateTransitions(d),this.snow&&this.snow.updateTransitions(d),this.rain&&this.rain.updateTransitions(d),this._changes.reset()}const O={};for(const B in this._mergedSourceCaches){const V=this._mergedSourceCaches[B];O[B]=V.used,V.used=!1,V.tileCoverLift=0}for(const B of this._mergedOrder){const V=this._mergedLayers[B];if(V.visibility!=="none"&&V.recalculate(d,this._availableImages),!V.isHidden(d.zoom)){const Y=this.getLayerSourceCache(V);Y&&(Y.used=!0,Y.tileCoverLift=Math.max(Y.tileCoverLift,V.tileCoverLift()))}!this._precompileDone&&this._shouldPrecompile&&("requestIdleCallback"in window?requestIdleCallback(()=>{this.precompilePrograms(V,d)}):this.precompilePrograms(V,d))}this._shouldPrecompile&&(this._precompileDone=!0),this.terrain&&M&&this.mergeLayers();const D=this.imageManager.getPendingImageProviders();for(const B of D)B.sourceCache.used=!0;for(const B in O){const V=this._mergedSourceCaches[B];O[B]!==V.used&&V.getSource().fire(new i.z("data",{sourceDataType:"visibility",dataType:"source",sourceId:V.getSource().id}))}this.light&&this.light.recalculate(d),this.terrain&&this.terrain.recalculate(d),this.fog&&this.fog.recalculate(d),this.snow&&this.snow.recalculate(d),this.rain&&this.rain.recalculate(d),this.z=d.zoom,this._markersNeedUpdate&&(this._updateMarkersOpacity(),this._markersNeedUpdate=!1),this.imageManager.clearUpdatedImages(this.scope),w&&this.fire(new i.z("data",{dataType:"style"}))}updateImageProviders(){const d=this.imageManager.getPendingImageProviders();for(const m of d){const w=m.resolvePendingRequests(),M=this.getFragmentStyle(m.scope);M&&M.addImages(w)}}_updateTilesForChangedImages(){const d={};for(const m in this._mergedSourceCaches){const w=this._mergedSourceCaches[m].getSource().scope;d[w]=d[w]||this._changes.getUpdatedImages(w),d[w].length!==0&&this._mergedSourceCaches[m].reloadTilesForDependencies(["icons","patterns"],d[w])}for(const m in d)this._changes.resetUpdatedImages(m)}_updateWorkerLayers(d,m,w){const M=this.getFragmentStyle(d);M&&this.dispatcher.broadcast("updateLayers",{layers:m?M._serializeLayers(m):[],scope:d,removedIds:w||[],options:M.options})}setState(d,m){if(this._checkLoaded(),Pm(this,Oa(d)))return!1;(d=i.dp(d)).layers=gf(d.layers);const w=function(D,B){if(!D)return[{command:Ys.setStyle,args:[B]}];let V=[];try{if(!i.by(D.version,B.version))return[{command:Ys.setStyle,args:[B]}];if(i.by(D.center,B.center)||V.push({command:Ys.setCenter,args:[B.center]}),i.by(D.zoom,B.zoom)||V.push({command:Ys.setZoom,args:[B.zoom]}),i.by(D.bearing,B.bearing)||V.push({command:Ys.setBearing,args:[B.bearing]}),i.by(D.pitch,B.pitch)||V.push({command:Ys.setPitch,args:[B.pitch]}),i.by(D.sprite,B.sprite)||V.push({command:Ys.setSprite,args:[B.sprite]}),i.by(D.glyphs,B.glyphs)||V.push({command:Ys.setGlyphs,args:[B.glyphs]}),i.by(D.imports,B.imports)||function(de=[],we=[],ve){we=we||[];const De=(de=de||[]).map(Hg),Pe=we.map(Hg),Ve=de.reduce(jt,{}),Xe=we.reduce(jt,{}),We=De.slice();let bt,ut,xt,ct;for(bt=0,ut=0;bt{de.source&&Y[de.source]?V.push({command:Ys.removeLayer,args:[de.id]}):ce.push(de)});let oe=D.terrain;oe&&Y[oe.source]&&(V.push({command:Ys.setTerrain,args:[void 0]}),oe=void 0),V=V.concat(Q),i.by(oe,B.terrain)||V.push({command:Ys.setTerrain,args:[B.terrain]}),function(de,we,ve){we=we||[];const De=(de=de||[]).map(Hg),Pe=we.map(Hg),Ve=de.reduce(jt,{}),Xe=we.reduce(jt,{}),We=De.slice(),bt=Object.create(null);let ut,xt,ct,it,St,Dt,Lt;for(ut=0,xt=0;ut!(D.command in XI));if(w.length===0)return!1;const M=w.filter(D=>!(D.command in YI));if(M.length>0)throw new Error(`Unimplemented: ${M.map(D=>D.command).join(", ")}.`);const O=[];return w.forEach(D=>{O.push(this[D.command](...D.args))}),m&&Promise.all(O).then(m).catch(m),this.stylesheet=d,this.mergeAll(),this.dispatcher.broadcast("setLayers",{layers:this._serializeLayers(this._order),scope:this.scope,options:this.options}),!0}_updateWorkerImages(){this._availableImages=this.imageManager.listImages(this.scope),this.dispatcher.broadcast("setImages",{scope:this.scope,images:this._availableImages})}_updateWorkerModels(){this._availableModels=this.modelManager.getModelURIs(this.scope),this.dispatcher.broadcast("setModels",{scope:this.scope,models:this._availableModels})}addImages(d){if(d.size===0)return this;for(const[m,w]of d.entries()){if(this.getImage(m))return this.fire(new i.y(new Error(`An image with the name "${m.name}" already exists.`)));this.imageManager.addImage(m,this.scope,w),this._changes.updateImage(m,this.scope)}return this._updateWorkerImages(),this.fire(new i.z("data",{dataType:"style"})),this}addImage(d,m){return this.getImage(d)?this.fire(new i.y(new Error(`An image with the name "${d.name}" already exists.`))):(this.imageManager.addImage(d,this.scope,m),this._changes.updateImage(d,this.scope),this._updateWorkerImages(),this.fire(new i.z("data",{dataType:"style"})),this)}updateImage(d,m,w=!1){this.imageManager.updateImage(d,this.scope,m),w&&(this._changes.updateImage(d,this.scope),this._updateWorkerImages(),this.fire(new i.z("data",{dataType:"style"})))}getImage(d){return this.imageManager.getImage(d,this.scope)}removeImage(d){return this.getImage(d)?(this.imageManager.removeImage(d,this.scope),this._changes.updateImage(d,this.scope),this._updateWorkerImages(),this.fire(new i.z("data",{dataType:"style"})),this):this.fire(new i.y(new Error("No image with this name exists.")))}listImages(){return this._checkLoaded(),this._availableImages.slice()}getActualScope(){return this._importedAsBasemap?"basemap":this.scope}addModelURLs(d){return this.modelManager.addModelURLs(d,this.getActualScope()),this._updateWorkerModels(),this.fire(new i.z("data",{dataType:"style"})),this}addModel(d,m,w={}){return this._checkLoaded(),this._validate(xe,`models.${d}`,m,null,w)||(this.modelManager.addModel(d,m,this.getActualScope()),this.fire(new i.z("data",{dataType:"style"}))),this}hasModel(d){return this.modelManager.hasModel(d,this.getActualScope())}removeModel(d){return this.hasModel(d)?(this.modelManager.removeModel(d,this.getActualScope(),!1,!0),this.fire(new i.z("data",{dataType:"style"})),this):this.fire(new i.y(new Error("No model with this ID exists.")))}listModels(){return this._checkLoaded(),this.modelManager.listModels(this.getActualScope())}addSource(d,m,w={}){if(this._checkLoaded(),this.getOwnSource(d)!==void 0)throw new Error(`There is already a source with ID "${d}".`);if(!m.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(m).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(m.type)>=0&&this._validate(Do,`sources.${d}`,m,null,w))return;this.map&&this.map._collectResourceTiming&&(m.collectResourceTiming=!0);const M=$o(d,m,this.dispatcher,this);M.scope=this.scope,M.setEventedParent(this,()=>({isSourceLoaded:this._isSourceCacheLoaded(M.id),source:M.serialize(),sourceId:M.id}));const O=D=>{const B=(D?"symbol:":"other:")+M.id,V=i.B(B,this.scope),Y=this._sourceCaches[B]=new Xc(V,M,D);(D?this._symbolSourceCaches:this._otherSourceCaches)[M.id]=Y,Y.onAdd(this.map)};O(!1),m.type!=="vector"&&m.type!=="geojson"||O(!0),M.onAdd&&M.onAdd(this.map),w.isInitialLoad||(this.mergeSources(),this._changes.setDirty())}removeSource(d){this._checkLoaded();const m=this.getOwnSource(d);if(!m)throw new Error("There is no source with this ID");for(const M in this._layers)if(this._layers[M].source===d)return this.fire(new i.y(new Error(`Source "${d}" cannot be removed while layer "${M}" is using it.`)));if(this.terrain&&this.terrain.scope===this.scope&&this.terrain.get().source===d)return this.fire(new i.y(new Error(`Source "${d}" cannot be removed while terrain is using it.`)));if(this.stylesheet.iconsets){const M=Object.entries(this.stylesheet.iconsets).find(([O,D])=>D.type==="source"&&D.source===d);if(M)return this.fire(new i.y(new Error(`Source "${d}" cannot be removed while iconset "${M[0]}" is using it.`)))}const w=this.getOwnSourceCaches(d);for(const M of w){const O=i.dq(M.id);delete this._sourceCaches[O],this._changes.discardSourceCacheUpdate(M.id),M.fire(new i.z("data",{sourceDataType:"metadata",dataType:"source",sourceId:M.getSource().id})),M.setEventedParent(null),M.clearTiles()}return delete this._otherSourceCaches[d],delete this._symbolSourceCaches[d],this.mergeSources(),m.setEventedParent(null),m.onRemove&&m.onRemove(this.map),this._changes.setDirty(),this}setGeoJSONSourceData(d,m){this._checkLoaded(),this.getOwnSource(d).setData(m),this._changes.setDirty()}getOwnSource(d){const m=this.getOwnSourceCache(d);return m&&m.getSource()}getOwnSources(){const d=[];for(const m in this._otherSourceCaches){const w=this.getOwnSourceCache(m);w&&d.push(w.getSource())}return d}areTilesLoaded(){const d=this._mergedSourceCaches;for(const m in d){const w=d[m]._tiles;for(const M in w){const O=w[M];if(O.state!=="loaded"&&O.state!=="errored")return!1}}return!0}setLights(d){if(this._checkLoaded(),!d)return delete this.ambientLight,void delete this.directionalLight;const m=this._getTransitionParameters();for(const O of d){if(this._validate(fo,"lights",O))return;switch(O.type){case"ambient":if(this.ambientLight){const D=this.ambientLight;D.set(O),D.updateTransitions(m)}else this.ambientLight=new Ws(O,po||(po=new i.a9({color:new i.aa(i.a6.properties_light_ambient.color),"color-use-theme":new i.aa({type:"string",default:"default","property-type":"data-constant"}),intensity:new i.aa(i.a6.properties_light_ambient.intensity)})),this.scope,this.options);break;case"directional":if(this.directionalLight){const D=this.directionalLight;D.set(O),D.updateTransitions(m)}else this.directionalLight=new Ws(O,ua||(ua=new i.a9({direction:new i.ap(i.a6.properties_light_directional.direction),color:new i.aa(i.a6.properties_light_directional.color),"color-use-theme":new i.aa({type:"string",default:"default","property-type":"data-constant"}),intensity:new i.aa(i.a6.properties_light_directional.intensity),"cast-shadows":new i.aa(i.a6.properties_light_directional["cast-shadows"]),"shadow-quality":new i.aa(i.a6.properties_light_directional["shadow-quality"]),"shadow-intensity":new i.aa(i.a6.properties_light_directional["shadow-intensity"])})),this.scope,this.options)}}const w=Object.assign(m,{worldview:this.map.getWorldview()}),M=new i.ac(this.z||0,w);this.ambientLight&&this.ambientLight.recalculate(M),this.directionalLight&&this.directionalLight.recalculate(M),this._brightness=this.calculateLightsBrightness(),this.dispatcher.broadcast("setBrightness",this._brightness)}calculateLightsBrightness(){const d=this.directionalLight,m=this.ambientLight;if(!d||!m)return;const w=oe=>.2126*(oe[0]<=.03928?oe[0]/12.92:Math.pow((oe[0]+.055)/1.055,2.4))+.7152*(oe[1]<=.03928?oe[1]/12.92:Math.pow((oe[1]+.055)/1.055,2.4))+.0722*(oe[2]<=.03928?oe[2]/12.92:Math.pow((oe[2]+.055)/1.055,2.4)),M=d.properties.get("color").toNonPremultipliedRenderColor(null).toArray01(),O=d.properties.get("intensity"),D=d.properties.get("direction"),B=1-i.d4(D.x,D.y,D.z)[2]/90,V=w(M)*O*B,Y=m.properties.get("color").toNonPremultipliedRenderColor(null).toArray01(),Q=m.properties.get("intensity"),ce=w(Y)*Q;return Number(((V+ce)/2).toFixed(6))}getBrightness(){return this._brightness}getLights(){if(!this.enable3dLights())return null;const d=[];return this.directionalLight&&d.push(this.directionalLight.get()),this.ambientLight&&d.push(this.ambientLight.get()),d}enable3dLights(){return!!this.ambientLight&&!!this.directionalLight}getFragmentStyle(d){if(d==null||d===""&&this.isRootStyle())return this;if(i.dr(d)){const m=i.ds(d),w=this.fragments.find(({id:O})=>O===m);if(!w)return;const M=i.dq(d);return w.style.getFragmentStyle(M)}{const m=this.fragments.find(({id:w})=>w===d);return m?m.style:void 0}}setFeaturesetSelectors(d){if(!d)return;const m={},w=(M,O="")=>`${M}::${O}`;this._featuresetSelectors={};for(const M in d){const O=this._featuresetSelectors[M]=[];for(const D of d[M].selectors){if(D.featureNamespace){const V=this.getOwnLayer(D.layer);if(!V){i.w(`Layer is undefined for selector: ${D.layer}`);continue}const Y=w(V.source,V.sourceLayer);if(Y in m&&m[Y]!==D.featureNamespace){i.w(`"featureNamespace ${D.featureNamespace} of featureset ${M}'s selector is not associated to the same source, skip this selector`);continue}m[Y]=D.featureNamespace}let B;if(D.properties)for(const V in D.properties){const Y=i.U(D.properties[V]);Y.result==="success"&&(B=B||{},B[V]=Y.value)}O.push({layerId:D.layer,namespace:D.featureNamespace,properties:B,uniqueFeatureID:D._uniqueFeatureID})}}}getFeaturesetDescriptors(d){const m=this.getFragmentStyle(d);if(!m||!m.stylesheet.featuresets)return[];const w=[];for(const M in m.stylesheet.featuresets)w.push({featuresetId:M,importId:m.scope?m.scope:void 0});return w}getFeaturesetLayers(d,m){const w=this.getFragmentStyle(m),M=w.stylesheet.featuresets;if(!M||!M[d])return this.fire(new i.y(new Error(`The featureset '${d}' does not exist in the map's style and cannot be queried.`))),[];const O=[];for(const D of M[d].selectors){const B=w.getOwnLayer(D.layer);B&&O.push(B)}return O}getConfigProperty(d,m){const w=this.getFragmentStyle(d);if(!w)return null;const M=i.B(m,w.scope),O=w.options.get(M),D=O?O.value||O.default:null;return D?D.serialize():null}isIndoorEnabled(){return Object.keys(this._mergedIndoor).length>0}getIndoorSourceLayers(d,m){const w=i.B(d,m);return this._mergedIndoor[w]}setIndoorData(d,m){this.map.indoor.setIndoorData(m)}updateIndoorDependentLayers(){this._updateLayers(this._indoorDependentLayers),this.map._styleDirty=!0,this.map.triggerRepaint()}setConfigProperty(d,m,w){const M=this.getFragmentStyle(d);if(!M)return;const O=M.stylesheet.schema;if(!O||!O[m])return;const D=i.U(w);if(D.result!=="success")return void Pm(this,D.value);const B=D.value.expression,V=i.B(m,M.scope),Y=M.options.get(V);if(!Y)return;let Q;const{minValue:ce,maxValue:oe,stepValue:de,type:we,values:ve}=O[m],De=i.U(O[m].default);De.result==="success"&&(Q=De.value.expression),Q?(this.options.set(V,Object.assign({},Y,{value:B,default:Q,minValue:ce,maxValue:oe,stepValue:de,type:we,values:ve})),this.updateConfigDependencies(m)):this.fire(new i.y(new Error(`No schema defined for the config option "${m}" in the "${d}" fragment.`)))}getConfig(d){const m=this.getFragmentStyle(d);if(!m)return null;const w=m.stylesheet.schema;if(!w)return null;const M={};for(const O in w){const D=i.B(O,m.scope),B=m.options.get(D),V=B?B.value||B.default:null;M[O]=V?V.serialize():null}return M}setConfig(d,m){const w=this.getFragmentStyle(d);w&&(w.updateConfig(m,w.stylesheet.schema),this.updateConfigDependencies())}getSchema(d){const m=this.getFragmentStyle(d);return m?m.stylesheet.schema:null}setSchema(d,m){const w=this.getFragmentStyle(d);w&&(w.stylesheet.schema=m,w.updateConfig(w._config,m),this.updateConfigDependencies())}updateConfig(d,m){if(this._config=d,d||m)if(m)for(const w in m){let M,O;const D=i.U(m[w].default);if(D.result==="success"&&(M=D.value.expression),d&&d[w]!==void 0){const oe=i.U(d[w]);oe.result==="success"&&(O=oe.value.expression)}const{minValue:B,maxValue:V,stepValue:Y,type:Q,values:ce}=m[w];if(M){const oe=i.B(w,this.scope);this.options.set(oe,{default:M,value:O,minValue:B,maxValue:V,stepValue:Y,type:Q,values:ce})}else this.fire(new i.y(new Error(`No schema defined for config option "${w}".`)))}else this.fire(new i.y(new Error("Attempting to set config for a style without schema.")))}_updateLayers(d,m=()=>!0){for(const w of d){const M=this.getLayer(w);M&&m(M)&&(M.possiblyEvaluateVisibility(),this._updateLayer(M),this._changes.setDirty())}}updateConfigDependencies(d){this._updateLayers(this._configDependentLayers,m=>!d||m.expressionDependencies.configDependencies.has(d)),this.ambientLight&&this.ambientLight.updateConfig(this.options),this.directionalLight&&this.directionalLight.updateConfig(this.options),this.fog&&this.fog.updateConfig(this.options),this.snow&&this.snow.updateConfig(this.options),this.rain&&this.rain.updateConfig(this.options),this.forEachFragmentStyle(m=>{const w=m._styleColorTheme.colorThemeOverride?m._styleColorTheme.colorThemeOverride:m._styleColorTheme.colorTheme;if(w){const M=m._evaluateColorThemeData(w);(!m._styleColorTheme.lut&&M!==""||m._styleColorTheme.lut&&M!==m._styleColorTheme.lut.data)&&m.setColorTheme(w)}}),this._changes.setDirty()}addLayer(d,m,w={}){this._checkLoaded();const M=d.id;if(this._layers[M])return void this.fire(new i.y(new Error(`Layer with id "${M}" already exists on this map`)));let O;if(d.type==="custom"){if(Pm(this,i.dt(d)))return;O=i.du(d,this.scope,this._styleColorTheme.lut,this.options)}else{if(typeof d.source=="object"&&(this.addSource(M,d.source),d=i.dp(d),d=Object.assign(d,{source:M})),this._validate(pu,`layers.${M}`,d,{arrayIndex:-1},w))return;O=i.du(d,this.scope,this._styleColorTheme.lut,this.options),this._validateLayer(O),O.setEventedParent(this,{layer:{id:M}})}const D=i.B(O.source,O.scope);O.expressionDependencies.configDependencies.size!==0&&this._configDependentLayers.add(D),O.expressionDependencies.isIndoorDependent&&this._indoorDependentLayers.add(D);let B=this._order.length;if(m){const ce=this._order.indexOf(m);if(ce===-1)return void this.fire(new i.y(new Error(`Layer with id "${m}" does not exist on this map.`)));O.slot===this._layers[m].slot?B=ce:i.w(`Layer with id "${m}" has a different slot. Layers can only be rearranged within the same slot.`)}this._order.splice(B,0,M),this._layerOrderChanged=!0,this._layers[M]=O;const V=this.getOwnLayerSourceCache(O),Y=!!this.directionalLight&&this.directionalLight.shadowsEnabled();V&&O.canCastShadows()&&Y&&(V.castsShadows=!0);const Q=this._changes.getRemovedLayer(O);if(Q&&O.source&&V&&O.type!=="custom"){this._changes.discardLayerRemoval(O);const ce=i.B(O.source,O.scope);Q.type!==O.type?this._changes.updateSourceCache(ce,"clear"):(this._changes.updateSourceCache(ce,"reload"),V.pause())}this._updateLayer(O),O.onAdd&&O.onAdd(this.map),O.scope=this.scope,this.mergeLayers()}moveLayer(d,m){this._checkLoaded();const w=this._checkLayer(d);if(!w||d===m)return;const M=this._order.indexOf(d);this._order.splice(M,1);let O=this._order.length;if(m){const D=this._order.indexOf(m);if(D===-1)return void this.fire(new i.y(new Error(`Layer with id "${m}" does not exist on this map.`)));w.slot===this._layers[m].slot?O=D:i.w(`Layer with id "${m}" has a different slot. Layers can only be rearranged within the same slot.`)}this._order.splice(O,0,d),this._changes.setDirty(),this._layerOrderChanged=!0,this.mergeLayers()}removeLayer(d){this._checkLoaded();const m=this._checkLayer(d);if(!m)return;m.setEventedParent(null);const w=this._order.indexOf(d);this._order.splice(w,1),delete this._layers[d],this._changes.setDirty(),this._layerOrderChanged=!0,this._configDependentLayers.delete(m.fqid),this._indoorDependentLayers.delete(m.fqid),this._changes.removeLayer(m);const M=this.getOwnLayerSourceCache(m);if(M&&M.castsShadows){let O=!1;for(const D in this._layers)if(this._layers[D].source===m.source&&this._layers[D].canCastShadows()){O=!0;break}M.castsShadows=O}m.onRemove&&m.onRemove(this.map),this.mergeLayers()}getOwnLayer(d){return this._layers[d]}hasLayer(d){return d in this._mergedLayers}hasLayerType(d){for(const m in this._layers)if(this._layers[m].type===d)return!0;return!1}setLayerZoomRange(d,m,w){this._checkLoaded();const M=this._checkLayer(d);M&&(M.minzoom===m&&M.maxzoom===w||(m!=null&&(M.minzoom=m),w!=null&&(M.maxzoom=w),this._updateLayer(M)))}getSlots(){return this._checkLoaded(),this._mergedSlots}setSlot(d,m){this._checkLoaded();const w=this._checkLayer(d);w&&w.slot!==m&&(w.slot=m,this._updateLayer(w))}setFilter(d,m,w={}){this._checkLoaded();const M=this._checkLayer(d);if(M&&!i.by(M.filter,m))return m==null?(M.filter=void 0,void this._updateLayer(M)):void(this._validate($l,`layers.${M.id}.filter`,m,{layerType:M.type},w)||(M.filter=i.dp(m),this._updateLayer(M)))}getFilter(d){const m=this._checkLayer(d);if(m)return i.dp(m.filter)}setLayoutProperty(d,m,w,M={}){this._checkLoaded();const O=this._checkLayer(d);if(O&&!i.by(O.getLayoutProperty(m),w)){if(w!=null&&(!M||M.validate!==!1)&&Pm(O,Je.call(Oa,{key:`layers.${d}.layout.${m}`,layerType:O.type,objectKey:m,value:w,styleSpec:i.a6,style:{glyphs:!0,sprite:!0}})))return;O.setLayoutProperty(m,w),O.expressionDependencies.configDependencies.size!==0&&this._configDependentLayers.add(O.fqid),O.expressionDependencies.isIndoorDependent&&this._indoorDependentLayers.add(O.fqid),this._updateLayer(O)}}setLayerProperty(d,m,w,M={}){this._checkLoaded();const O=this._checkLayer(d);O&&(m==="appearances"?(O.setAppearances(w),this._changes.setDirty()):O.isPaintProperty(m)?this.setPaintProperty(d,m,w,M):this.setLayoutProperty(d,m,w,M))}getLayoutProperty(d,m){const w=this._checkLayer(d);if(w)return w.getLayoutProperty(m)}setPaintProperty(d,m,w,M={}){this._checkLoaded();const O=this._checkLayer(d);if(!O||i.by(O.getPaintProperty(m),w)||w!=null&&(!M||M.validate!==!1)&&Pm(O,mu.call(Oa,{key:`layers.${d}.paint.${m}`,layerType:O.type,objectKey:m,value:w,styleSpec:i.a6})))return;const D=O.setPaintProperty(m,w);O.expressionDependencies.configDependencies.size!==0&&this._configDependentLayers.add(O.fqid),O.expressionDependencies.isIndoorDependent&&this._indoorDependentLayers.add(O.fqid),D&&this._updateLayer(O),this._changes.updatePaintProperties(O)}getPaintProperty(d,m){const w=this._checkLayer(d);if(w)return w.getPaintProperty(m)}setFeatureState(d,m){if(this._checkLoaded(),"target"in d){if("featuresetId"in d.target){const{featuresetId:V,importId:Y}=d.target,Q=this.getFragmentStyle(Y),ce=Q.getFeaturesetLayers(V);for(const{source:oe,sourceLayer:de}of ce)Q.setFeatureState({id:d.id,source:oe,sourceLayer:de},m)}else if("layerId"in d.target){const{layerId:V}=d.target,Y=this.getLayer(V);this.setFeatureState({id:d.id,source:Y.source,sourceLayer:Y.sourceLayer},m)}return}const w=d.source,M=d.sourceLayer,O=this._checkSource(w);if(!O)return;const D=O.type;if(D==="geojson"&&M)return void this.fire(new i.y(new Error("GeoJSON sources cannot have a sourceLayer parameter.")));if(D==="vector"&&!M)return void this.fire(new i.y(new Error("The sourceLayer parameter must be provided for vector source types.")));d.id===void 0&&this.fire(new i.y(new Error("The feature id parameter must be provided.")));const B=this.getOwnSourceCaches(w);for(const V of B)V.setFeatureState(M,d.id,m)}removeFeatureState(d,m){if(this._checkLoaded(),"target"in d){if("featuresetId"in d.target){const{featuresetId:V,importId:Y}=d.target,Q=this.getFragmentStyle(Y),ce=Q.getFeaturesetLayers(V);for(const{source:oe,sourceLayer:de}of ce)Q.removeFeatureState({id:d.id,source:oe,sourceLayer:de},m)}else if("layerId"in d.target){const{layerId:V}=d.target,Y=this.getLayer(V);this.removeFeatureState({id:d.id,source:Y.source,sourceLayer:Y.sourceLayer},m)}return}const w=d.source,M=this._checkSource(w);if(!M)return;const O=M.type,D=O==="vector"?d.sourceLayer:void 0;if(O==="vector"&&!D)return void this.fire(new i.y(new Error("The sourceLayer parameter must be provided for vector source types.")));if(m&&typeof d.id!="string"&&typeof d.id!="number")return void this.fire(new i.y(new Error("A feature id is required to remove its specific state property.")));const B=this.getOwnSourceCaches(w);for(const V of B)V.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,V=this.getFragmentStyle(B),Y=V.getFeaturesetLayers(D);for(const{source:Q,sourceLayer:ce}of Y){const oe=V.getFeatureState({id:d.id,source:Q,sourceLayer:ce});if(oe&&!O)O=oe;else if(!i.by(O,oe))return void this.fire(new i.y(new Error("The same feature id exists in multiple sources in the featureset, but their feature states are not consistent through the sources.")))}}else if("layerId"in d.target){const{layerId:D}=d.target,B=this.getLayer(D);O=this.getFeatureState({id:d.id,source:B.source,sourceLayer:B.sourceLayer})}return O}const m=d.source,w=d.sourceLayer,M=this._checkSource(m);if(M){if(M.type!=="vector"||w)return d.id===void 0&&this.fire(new i.y(new Error("The feature id parameter must be provided."))),this.getOwnSourceCaches(m)[0].getFeatureState(w,d.id);this.fire(new i.y(new Error("The sourceLayer parameter must be provided for vector source types.")))}}setTransition(d){return this.stylesheet.transition=Object.assign({},this.stylesheet.transition,d),this.transition=this.stylesheet.transition,this}getTransition(){return Object.assign({},this.stylesheet.transition)}serialize(){this._checkLoaded();const d=this.getTerrain(),m=d&&this.terrain&&this.terrain.scope===this.scope?d:this.stylesheet.terrain;return i.dv({version:this.stylesheet.version,name:this.stylesheet.name,metadata:this.stylesheet.metadata,fragment:this.stylesheet.fragment,iconsets:this.stylesheet.iconsets,imports:this._serializeImports(),schema:this.stylesheet.schema,camera:this.stylesheet.camera,light:this.stylesheet.light,lights:this.stylesheet.lights,terrain:m,fog:this.stylesheet.fog,snow:this.stylesheet.snow,rain:this.stylesheet.rain,center:this.stylesheet.center,"color-theme":this.stylesheet["color-theme"],zoom:this.stylesheet.zoom,bearing:this.stylesheet.bearing,pitch:this.stylesheet.pitch,sprite:this.stylesheet.sprite,glyphs:this.stylesheet.glyphs,transition:this.stylesheet.transition,projection:this.stylesheet.projection,sources:this._serializeSources(),layers:this._serializeLayers(this._order)},w=>w!==void 0)}_updateFilteredLayers(d){for(const m of Object.values(this._mergedLayers))d(m)&&this._updateLayer(m)}_updateLayer(d){this._changes.updateLayer(d);const m=this.getLayerSourceCache(d),w=i.B(d.source,d.scope),M=this._changes.getUpdatedSourceCaches();d.source&&!M[w]&&m&&m.getSource().type!=="raster"&&(this._changes.updateSourceCache(w,"reload"),m.pause()),d.invalidateCompiledFilter()}_flattenAndSortRenderedFeatures(d){const m=B=>this._mergedLayers[B].is3D(!!this.terrain),w=this.order,M={},O=[];for(let B=w.length-1;B>=0;B--){const V=w[B];if(m(V)){M[V]=B;for(const Y of d){const Q=Y[V];if(Q)for(const ce of Q)O.push(ce)}}}O.sort((B,V)=>V.intersectionZ-B.intersectionZ);const D=[];for(let B=w.length-1;B>=0;B--){const V=w[B];if(m(V))for(let Y=O.length-1;Y>=0;Y--){const Q=O[Y].feature;if(Q.layer&&M[Q.layer.id]{if(Sk.has(Q.type))return;const ce=this.getOwnLayerSourceCache(Q),oe=O[ce.id]=O[ce.id]||{sourceCache:ce,layers:{},has3DLayers:!1};Q.is3D(!!this.terrain)&&(oe.has3DLayers=!0),oe.layers[Q.fqid]=oe.layers[Q.fqid]||{styleLayer:Q,targets:[]},oe.layers[Q.fqid].targets.push({filter:M})};if(m&&m.layers){if(!Array.isArray(m.layers))return this.fire(new i.y(new Error("parameters.layers must be an Array."))),[];for(const Q of m.layers){const ce=this._layers[Q];if(!ce)return this.fire(new i.y(new Error(`The layer '${Q}' does not exist in the map's style and cannot be queried for features.`))),[];D(ce)}}else for(const Q in this._layers)D(this._layers[Q]);const B=this._queryRenderedFeatures(d,O,w),V=this._flattenAndSortRenderedFeatures(B),Y=[];for(const Q of V)i.dw(Q.layer.id)===this.scope&&Y.push(Q);return Y}queryRenderedFeatureset(d,m,w){let M;m&&!Array.isArray(m)&&m.filter&&(this._validate($l,"queryRenderedFeatures.filter",m.filter,null,m),M=i.b6(m.filter));const O="mock",D=[];if(m&&m.target)D.push(Object.assign({},m,{targetId:O,filter:M}));else{const Q=this.getFeaturesetDescriptors();for(const ce of Q)D.push({targetId:O,filter:M,target:ce});for(const{style:ce}of this.fragments){const oe=ce.getFeaturesetDescriptors();for(const de of oe)D.push({targetId:O,filter:M,target:de})}}const B=this.queryRenderedTargets(d,D,w),V=[],Y=new Set;for(const Q of B)for(const ce of Q.variants[O])Tm(ce,Q,Y)||V.push(new i.dx(Q,ce));return V}queryRenderedTargets(d,m,w){const M={},O=(B,V,Y,Q)=>{const ce=M[V.id]=M[V.id]||{sourceCache:V,layers:{},has3DLayers:!1};if(ce.layers[B.fqid]=ce.layers[B.fqid]||{styleLayer:B,targets:[]},B.is3D(!!this.terrain)&&(ce.has3DLayers=!0),!Q)return Y.uniqueFeatureID=!1,void ce.layers[B.fqid].targets.push(Y);ce.layers[B.fqid].targets.push(Object.assign({},Y,{namespace:Q.namespace,properties:Q.properties,uniqueFeatureID:Q.uniqueFeatureID}))};for(const B of m)if("featuresetId"in B.target){const{featuresetId:V,importId:Y}=B.target,Q=this.getFragmentStyle(Y);if(!Q||!Q._featuresetSelectors)continue;const ce=Q._featuresetSelectors[V];if(!ce){this.fire(new i.y(new Error(`The featureset '${V}' does not exist in the map's style and cannot be queried for features.`)));continue}for(const oe of ce){const de=Q.getOwnLayer(oe.layerId);de&&!Sk.has(de.type)&&O(de,Q.getOwnLayerSourceCache(de),B,oe)}}else if("layerId"in B.target){const{layerId:V}=B.target,Y=this.getLayer(V);if(!Y||Sk.has(Y.type))continue;O(Y,this.getLayerSourceCache(Y),B)}const D=this._queryRenderedFeatures(d,M,w);return this._flattenAndSortRenderedFeatures(D)}_queryRenderedFeatures(d,m,w){const M=[],O=!!this.map._showQueryGeometry,D=ki.createFromScreenPoints(d,w);for(const B in m){const V=yy(D,m[B],this._availableImages,w,O);Object.keys(V).length&&M.push(V)}if(this.placement)for(const B in m){if(!m[B].sourceCache._onlySymbols)continue;const V=vy(D.screenGeometry,m[B],this._availableImages,this.placement.collisionIndex,this.placement.retainedQueryData,this.map.getWorldview());Object.keys(V).length&&M.push(V)}return M}querySourceFeatures(d,m){const w=m&&m.filter;w&&this._validate($l,"querySourceFeatures.filter",w,null,m);let M=[];const O=this.getOwnSourceCaches(d);for(const D of O)M=M.concat(_y(D,m));return M}addSourceType(d,m,w){return Ju.getSourceType(d)?w(new Error(`A source type called "${d}" already exists.`)):(Ju.setSourceType(d,m),m.workerSourceURL?void this.dispatcher.broadcast("loadWorkerSource",{name:d,url:m.workerSourceURL},w):w(null,null))}getFlatLight(){return this.light.getLight()}setFlatLight(d,m,w={}){this._checkLoaded();const M=this.light.getLight();let O=!1;for(const B in d)if(!i.by(d[B],M[B])){O=!0;break}if(!O)return;const D=this._getTransitionParameters();this.light.setLight(d,m,w),this.light.updateTransitions(D)}getTerrain(){return this.terrain&&this.terrain.drapeRenderMode===1?this.terrain.get():null}setTerrainForDraping(){this.setTerrain({source:"",exaggeration:0},0)}checkCanvasFingerprintNoise(){this.disableElevatedTerrain===void 0&&(this.disableElevatedTerrain=i.o.hasCanvasFingerprintNoise(),this.disableElevatedTerrain&&i.w("Terrain and hillshade are disabled because of Canvas2D limitations when fingerprinting protection is enabled (e.g. in private browsing mode)."))}setTerrain(d,m=1){if(this._checkLoaded(),!d)return this.terrainSetForDrapingOnly()||(delete this.terrain,this.map.transform.projection.requiresDraping&&this.setTerrainForDraping()),m===0&&delete this.terrain,d===null?this.stylesheet.terrain=null:delete this.stylesheet.terrain,this._force3DLayerUpdate(),void(this._markersNeedUpdate=!0);this.checkCanvasFingerprintNoise();let w=d;const M=!("source"in d)||d.source==null;if(m===1){if(this.disableElevatedTerrain)return;if("source"in w&&typeof w.source=="object"){const B="terrain-dem-src";this.addSource(B,w.source),w=i.dp(w),w=Object.assign(w,{source:B})}const O=Object.assign({},w),D={};if(this.terrain&&M){O.source=this.terrain.get().source;const B=this.terrain?this.getFragmentStyle(this.terrain.scope):null;B&&(D.style=B.serialize())}if(this._validate(pl,"terrain",O,D))return}if(!this.terrain||this.terrain.scope!==this.scope&&!M||this.terrain&&m!==this.terrain.drapeRenderMode){if(!w)return;this._createTerrain(w,m),this.fire(new i.z("data",{dataType:"style"}))}else{const O=this.terrain,D=O.get();for(const B of Object.keys(i.a6.terrain))!w.hasOwnProperty(B)&&i.a6.terrain[B].default&&(w[B]=i.a6.terrain[B].default);for(const B in d)if(!i.by(d[B],D[B])){O.set(d,this.options),this.stylesheet.terrain=d;const V=this._getTransitionParameters({duration:0});O.updateTransitions(V),this.fire(new i.z("data",{dataType:"style"}));break}}this.mergeTerrain(),this.updateDrapeFirstLayers(),this._markersNeedUpdate=!0}_createFog(d){const m=this.fog=new Zn(d,this.map.transform,this.scope,this.options);this.stylesheet.fog=m.get();const w=this._getTransitionParameters({duration:0});m.updateTransitions(w)}_createSnow(d){const m=this.snow=new vo(d,this.map.transform,this.scope,this.options);this.stylesheet.snow=m.get();const w=this._getTransitionParameters({duration:0});m.updateTransitions(w)}_createRain(d){const m=this.rain=new ji(d,this.map.transform,this.scope,this.options);this.stylesheet.rain=m.get();const w=this._getTransitionParameters({duration:0});m.updateTransitions(w)}_updateMarkersOpacity(){this.map._markers.length!==0&&this.map._requestDomTask(()=>{for(const d of this.map._markers)d._evaluateOpacity()})}getFog(){return this.fog?this.fog.get():null}setFog(d){if(this._checkLoaded(),!d)return delete this.fog,delete this.stylesheet.fog,void(this._markersNeedUpdate=!0);if(this.fog){const m=this.fog;if(!i.by(m.get(),d)){m.set(d,this.options),this.stylesheet.fog=m.get();const w=this._getTransitionParameters({duration:0});m.updateTransitions(w)}}else this._createFog(d);this._markersNeedUpdate=!0}getSnow(){return this.snow?this.snow.get():null}setSnow(d){if(this._checkLoaded(),!d)return delete this.snow,void delete this.stylesheet.snow;if(this.snow){const m=this.snow;if(!i.by(m.get(),d)){m.set(d,this.options),this.stylesheet.snow=m.get();const w=this._getTransitionParameters({duration:0});m.updateTransitions(w)}}else this._createSnow(d);this._markersNeedUpdate=!0}getRain(){return this.rain?this.rain.get():null}setRain(d){if(this._checkLoaded(),!d)return delete this.rain,void delete this.stylesheet.rain;if(this.rain){const m=this.rain;if(!i.by(m.get(),d)){m.set(d,this.options),this.stylesheet.rain=m.get();const w=this._getTransitionParameters({duration:0});m.updateTransitions(w)}}else this._createRain(d);this._markersNeedUpdate=!0}_reloadColorTheme(){const d=()=>{for(const M in this._layers)this._layers[M].lut=this._styleColorTheme.lut;for(const M in this._sourceCaches)this._sourceCaches[M].clearTiles()},m=this._styleColorTheme.colorThemeOverride?this._styleColorTheme.colorThemeOverride:this._styleColorTheme.colorTheme;if(!m)return this._styleColorTheme.lut=null,void d();const w=this._evaluateColorThemeData(m);this._loadColorTheme(w).then(()=>{this.fire(new i.z("colorthemeset")),d()}).catch(M=>{i.w(`Couldn't set color theme: ${M}`)})}setColorTheme(d){this._checkLoaded(),this._styleColorTheme.colorThemeOverride&&i.w("Note: setColorTheme is called on a style with a color-theme override, the passed color-theme won't be visible."),this._styleColorTheme.colorTheme=d,this._reloadColorTheme()}setImportColorTheme(d,m){const w=this.getFragmentStyle(d);w&&(w._styleColorTheme.colorThemeOverride=m,w._reloadColorTheme())}_getTransitionParameters(d){return{now:i.o.now(),transition:Object.assign(this.transition,d)}}updateDrapeFirstLayers(){if(!this.terrain)return;const d=[],m=[];for(const w of this._mergedOrder)this.isLayerDraped(this._mergedLayers[w])?d.push(w):m.push(w);this._drapedFirstOrder=[],this._drapedFirstOrder.push(...d),this._drapedFirstOrder.push(...m)}_createTerrain(d,m){const w=this.terrain=new Pt(d,m,this.scope,this.options,this.map.getWorldview());m===1&&(this.stylesheet.terrain=d),this.mergeTerrain(),this.updateDrapeFirstLayers(),this._force3DLayerUpdate();const M=this._getTransitionParameters({duration:0});w.updateTransitions(M)}_force3DLayerUpdate(){for(const d in this._layers){const m=this._layers[d];m.type==="fill-extrusion"&&this._updateLayer(m)}}_forceSymbolLayerUpdate(){for(const d in this._layers){const m=this._layers[d];m.type==="symbol"&&this._updateLayer(m)}}_validate(d,m,w,M,O={}){if(O&&O.validate===!1)return!1;const D=Object.assign({},this.serialize());return Pm(this,d.call(Oa,Object.assign({key:m,style:D,value:w,styleSpec:i.a6},M)))}_remove(){this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),i.dy.off("pluginStateChange",this._rtlTextPluginCallback);for(const d in this._mergedLayers)this._mergedLayers[d].setEventedParent(null);for(const d in this._mergedSourceCaches)this._mergedSourceCaches[d].clearTiles(),this._mergedSourceCaches[d].setEventedParent(null);this.imageManager.removeScope(this.scope),this.setEventedParent(null),delete this.fog,delete this.snow,delete this.rain,delete this.terrain,delete this.ambientLight,delete this.directionalLight,this.isRootStyle()&&(this.imageManager.setEventedParent(null),this.imageManager.destroy(),this.modelManager.setEventedParent(null),this.modelManager.destroy(),this.dispatcher.remove())}clearSource(d){const m=this.getSourceCaches(d);for(const w of m)w.clearTiles()}clearSources(){for(const d in this._mergedSourceCaches)this._mergedSourceCaches[d].clearTiles()}clearLayers(){for(const d in this._mergedLayers){const m=this._mergedLayers[d];m._clear&&m._clear()}}reloadSource(d){const m=this.getSourceCaches(d);for(const w of m)w.resume(),w.reload()}reloadSources(){for(const d of this.getSources())d.reload&&d.reload()}reloadModels(){this.modelManager.reloadModels(""),this.forEachFragmentStyle(d=>{d.modelManager.reloadModels(d.scope)})}updateSources(d){let m;this.directionalLight&&(m=wv(this.directionalLight));const w=new Set,M=new Set;for(const O in this._mergedLayers){const D=this._mergedLayers[O];D.type==="building"&&w.add(D.source),D.hasElevation()&&!M.has(D.source)&&M.add(D.source)}for(const O in this._mergedSourceCaches){const D=this._mergedSourceCaches[O],B=M.has(D._source.id);w.has(D._source.id)&&(D._source.reparseOverscaled=!1),D.update(d,void 0,void 0,m,B)}}_generateCollisionBoxes(){for(const d in this._sourceCaches){const m=this._sourceCaches[d];m.resume(),m.reload()}}_updatePlacement(d,m,w,M,O,D,B=!1){let V=!1,Y=!1;const Q={},ce={};for(const ve of this._mergedOrder){const De=this._mergedLayers[ve];if(De.type!=="symbol")continue;const Pe=i.B(De.source,De.scope);let Ve=Q[Pe];if(!Ve){const We=this.getLayerSourceCache(De);if(!We)continue;const bt=We.getRenderableIds(!0).map(ut=>We.getTileByID(ut));ce[Pe]=bt.slice(),Ve=Q[Pe]=bt.sort((ut,xt)=>xt.tileID.overscaledZ-ut.tileID.overscaledZ||(ut.tileID.isLessThan(xt.tileID)?-1:1))}const Xe=this.crossTileSymbolIndex.addLayer(De,Ve,m.center.lng,m.projection);V=V||Xe}this.crossTileSymbolIndex.pruneUnusedLayers(this._mergedOrder),B=B||this._layerOrderChanged,this._layerOrderChanged&&this.fire(new i.z("neworder"));const oe=!!(this.placement&&!m.equals(this.placement.transform)),de=!!(this.placement&&(this.placement.lastReplacementSourceUpdateTime!==0&&!D||this.placement.lastReplacementSourceUpdateTime!==D.updateTime)),we=(oe||de||V||this.placement&&this.placement.isStale())&&M===0;if((B||!this.pauseablePlacement||we||M!==0&&this.pauseablePlacement.isDone()&&!this.placement.stillRecent(i.o.now(),m.zoom))&&(this.pauseablePlacement=new xl(m,this._mergedOrder,B||M===0,w,M,O,this.placement,this.fog&&m.projection.supportsFog?this.fog.state:null,this._buildingIndex),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._mergedOrder,this._mergedLayers,Q,ce,this.map.painter.scaleFactor),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(i.o.now()),Y=!0),V&&this.pauseablePlacement.placement.setStale()),Y||V){this._buildingIndex.onNewFrame(m.zoom);for(let ve=0;veO===d.id)!==-1)return void this.fire(new i.y(new Error(`Import with id '${d.id}' already exists in the map's style.`)));if(!m)return w.push(d),this._loadImports([d],!0);const M=w.findIndex(({id:O})=>O===m);return M===-1&&this.fire(new i.y(new Error(`Import with id "${m}" does not exist on this map.`))),this.stylesheet.imports=w.slice(0,M).concat(d).concat(w.slice(M)),this._loadImports([d],!0,m)}updateImport(d,m){this._checkLoaded();const w=this.stylesheet.imports||[],M=this.getImportIndex(d);return M===-1?this:typeof m=="string"?(this.setImportUrl(d,m),this):(m.url&&m.url!==w[M].url&&this.setImportUrl(d,m.url),i.by(m.config,w[M].config)||this.setImportConfig(d,m.config,m.data.schema),i.by(m.data,w[M].data)||this.setImportData(d,m.data),this)}moveImport(d,m){this._checkLoaded();let w=this.stylesheet.imports||[];const M=this.getImportIndex(d);if(M===-1)return this;const O=this.getImportIndex(m);if(O===-1)return this;const D=w[M],B=this.fragments[M];return w=w.filter(({id:V})=>V!==d),this.fragments=this.fragments.filter(({id:V})=>V!==d),this.stylesheet.imports=w.slice(0,O).concat(D).concat(w.slice(O)),this.fragments=this.fragments.slice(0,O).concat(B).concat(this.fragments.slice(O)),this.mergeLayers(),this}setImportUrl(d,m){this._checkLoaded();const w=this.stylesheet.imports||[],M=this.getImportIndex(d);if(M===-1)return this;w[M].url=m;const O=this.fragments[M];return O.style=this._createFragmentStyle(w[M]),O.style.on("style.import.load",()=>this.mergeAll()),O.style.loadURL(m),this}setImportData(d,m){this._checkLoaded();const w=this.getImportIndex(d),M=this.stylesheet.imports||[];return w===-1?this:m?(this.fragments[w].style.setState(m),this._reloadImports(),this):(delete M[w].data,this.setImportUrl(d,M[w].url))}setImportConfig(d,m,w){this._checkLoaded();const M=this.getImportIndex(d),O=this.stylesheet.imports||[];if(M===-1)return this;m?O[M].config=m:delete O[M].config;const D=this.fragments[M];w&&D.style.stylesheet&&(D.style.stylesheet.schema=w);const B=D.style.stylesheet&&D.style.stylesheet.schema;return D.config=m,D.style.updateConfig(m,B),this.updateConfigDependencies(),this}removeImport(d){this._checkLoaded();const m=this.stylesheet.imports||[],w=this.getImportIndex(d);w!==-1&&(m.splice(w,1),this.fragments[w].style._remove(),this.fragments.splice(w,1),this._reloadImports())}getImportIndex(d){const m=(this.stylesheet.imports||[]).findIndex(w=>w.id===d);return m===-1&&this.fire(new i.y(new Error(`Import '${d}' does not exist in the map's style and cannot be updated.`))),m}getLayer(d){return this._mergedLayers[d]}getSources(){const d=[];for(const m in this._mergedOtherSourceCaches){const w=this._mergedOtherSourceCaches[m];w&&d.push(w.getSource())}return d}getSource(d,m){const w=this.getSourceCache(d,m);return w&&w.getSource()}getLayerSource(d){const m=this.getLayerSourceCache(d);return m&&m.getSource()}getSourceCache(d,m){const w=i.B(d,m);return this._mergedOtherSourceCaches[w]}getLayerSourceCache(d){const m=i.B(d.source,d.scope);return d.type==="symbol"?this._mergedSymbolSourceCaches[m]:this._mergedOtherSourceCaches[m]}getSourceCaches(d){if(d==null)return Object.values(this._mergedSourceCaches);const m=[];return this._mergedOtherSourceCaches[d]&&m.push(this._mergedOtherSourceCaches[d]),this._mergedSymbolSourceCaches[d]&&m.push(this._mergedSymbolSourceCaches[d]),m}updateSourceCaches(){const d=this._changes.getUpdatedSourceCaches();for(const m in d){const w=d[m];w==="reload"?this.reloadSource(m):w==="clear"&&this.clearSource(m)}}updateLayers(d){const m=this._changes.getUpdatedPaintProperties();for(const w of m){const M=this.getLayer(w);M&&M.updateTransitions(d)}}getGlyphsUrl(){return this.stylesheet.glyphs}setGlyphsUrl(d){this.stylesheet.glyphs=d,this.glyphManager.setURL(d)}getImages(d,m,w){this.imageManager.getImages(m.images,m.scope,w),this._updateTilesForChangedImages();const M=D=>{if(D){const B=m.images.map(V=>i.I.toString(V));D.setDependencies(m.tileID.key,m.type,B)}},O=i.B(m.source,m.scope);M(this._mergedOtherSourceCaches[O]),M(this._mergedSymbolSourceCaches[O]),m.images.some(D=>D.iconsetId)&&this.fire(new i.z("data",{dataType:"style"}))}rasterizeImages(d,m,w){this.imageManager.rasterizeImages(m,w)}getGlyphs(d,m,w){this.glyphManager.getGlyphs(m.stacks,w)}getResource(d,m,w){return i.dz(m,w)}getOwnSourceCache(d){return this._otherSourceCaches[d]}getOwnLayerSourceCache(d){return d.type==="symbol"?this._symbolSourceCaches[d.source]:this._otherSourceCaches[d.source]}getOwnSourceCaches(d){const m=[];return this._otherSourceCaches[d]&&m.push(this._otherSourceCaches[d]),this._symbolSourceCaches[d]&&m.push(this._symbolSourceCaches[d]),m}_isSourceCacheLoaded(d){const m=this.getOwnSourceCaches(d);return m.length===0?(this.fire(new i.y(new Error(`There is no source with ID '${d}'`))),!1):m.every(w=>w.loaded())}has3DLayers(){return this._has3DLayers}hasSymbolLayers(){return this._hasSymbolLayers}hasCircleLayers(){return this._hasCircleLayers}isLayerClipped(d,m){if(!this._clipLayerPresent&&d.type!=="fill-extrusion"&&d.type!=="building")return!1;const w=d.type==="fill-extrusion"&&(d.sourceLayer==="building"||d.sourceLayer==="procedural_buildings"),M=d.type==="building";if(d.is3D(!!this.terrain)){if(w||M||m&&m.type==="batched-model"||d.type==="model")return!0}else if(d.type==="symbol")return!0;return!1}_clearWorkerCaches(){this.dispatcher.broadcast("clearCaches")}destroy(){this._clearWorkerCaches(),this.fragments.forEach(d=>{d.style._remove()}),this.terrainSetForDrapingOnly()&&(delete this.terrain,delete this.stylesheet.terrain)}}Ju.getSourceType=function(_){return Ku[_]},Ju.setSourceType=function(_,d){Ku[_]=d},Ju.registerForPluginStateChange=i.dA;class QI extends i.E{constructor(d){super(),this._style=d,this._buildings={},this._activeFloors=new Set,this._activeFloorsVisible=!0,this._indoorState={selectedFloorId:null,lastActiveFloors:null,activeFloorsVisible:!0},i.aY(["_updateUI"],this)}destroy(){this._buildings={},this._activeFloors=new Set,this._indoorState=null}selectFloor(d){d===this._selectedFloorId&&this._activeFloorsVisible||(this._selectedFloorId=d,this._activeFloorsVisible=!0,this._updateActiveFloors())}setActiveFloorsVisibility(d){this._activeFloorsVisible=d,this._updateActiveFloors(),this._updateIndoorSelector()}setIndoorData(d){for(const[m,w]of Object.entries(d.buildings))if(this._buildings[m])for(const M of w.floorIds)this._buildings[m].floors[M]||(this._buildings[m].floors[M]=w.floors[M]);else this._buildings[m]=w;for(const m of d.activeFloors)this._activeFloors.add(m);this._updateIndoorSelector()}getIndoorTileOptions(d,m){const w=this._style.getIndoorSourceLayers(d,m);return w&&this._indoorState?{sourceLayers:w,indoorState:this._indoorState}:null}_updateUI(d,m,w){const M=function(O,D,B,V){let Y=null,Q=Number.MAX_SAFE_INTEGER;if(V<16)return null;for(const[ce,oe]of Object.entries(O)){const de=oe.center;if(de){const we=D.distanceTo(i.aT.convert(de));we({id:D,name:w.floors[D].name,zIndex:w.floors[D].zIndex})).sort((D,B)=>B.zIndex-D.zIndex);this.fire(new i.z("selector-update",{selectedFloorId:M,activeFloorsVisible:this._activeFloorsVisible,floors:O}))}_updateActiveFloors(){const d=this._activeFloors;this._activeFloors=new Set,this._indoorState={selectedFloorId:this._selectedFloorId,lastActiveFloors:d,activeFloorsVisible:this._activeFloorsVisible},this._style.updateIndoorDependentLayers()}}var My=` #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`,Ty=` #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;}`,D3=` #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`,Ck="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;}",xu=` #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`,Mk=`#ifdef FOG uniform mediump vec4 u_fog_color;uniform mediump vec2 u_fog_range;uniform mediump float u_fog_horizon_blend;uniform mediump mat4 u_fog_matrix;out vec3 v_fog_pos;float fog_range(float depth) {return (depth-u_fog_range[0])/(u_fog_range[1]-u_fog_range[0]);}float fog_horizon_blending(vec3 camera_dir) {float t=max(0.0,camera_dir.z/u_fog_horizon_blend);return u_fog_color.a*exp(-3.0*t*t);}float fog_opacity(float t) {const float decay=6.0;float falloff=1.0-min(1.0,exp(-decay*t));falloff*=falloff*falloff;return u_fog_color.a*min(1.0,1.00747*falloff);}vec3 fog_position(vec3 pos) {return (u_fog_matrix*vec4(pos,1.0)).xyz;}vec3 fog_position(vec2 pos) {return fog_position(vec3(pos,0.0));}float fog(vec3 pos) {float depth=length(pos);float opacity=fog_opacity(fog_range(depth));return opacity*fog_horizon_blending(pos/depth);} #endif`,Sr=`#ifdef FOG uniform mediump vec4 u_fog_color;uniform mediump vec2 u_fog_range;uniform mediump float u_fog_horizon_blend;uniform mediump vec2 u_fog_vertical_limit;uniform mediump float u_fog_temporal_offset;in vec3 v_fog_pos;uniform highp vec3 u_frustum_tl;uniform highp vec3 u_frustum_tr;uniform highp vec3 u_frustum_br;uniform highp vec3 u_frustum_bl;uniform highp vec3 u_globe_pos;uniform highp float u_globe_radius;uniform highp vec2 u_viewport;uniform float u_globe_transition;uniform int u_is_globe;float fog_range(float depth) {return (depth-u_fog_range[0])/(u_fog_range[1]-u_fog_range[0]);}float fog_horizon_blending(vec3 camera_dir) {float t=max(0.0,camera_dir.z/u_fog_horizon_blend);return u_fog_color.a*exp(-3.0*t*t);}float fog_opacity(float t) {const float decay=6.0;float falloff=1.0-min(1.0,exp(-decay*t));falloff*=falloff*falloff;return u_fog_color.a*min(1.0,1.00747*falloff);}float globe_glow_progress() {highp vec2 uv=gl_FragCoord.xy/u_viewport; #ifdef FLIP_Y uv.y=1.0-uv.y; #endif highp vec3 ray_dir=mix( mix(u_frustum_tl,u_frustum_tr,uv.x),mix(u_frustum_bl,u_frustum_br,uv.x),1.0-uv.y);highp vec3 dir=normalize(ray_dir);highp vec3 closest_point=dot(u_globe_pos,dir)*dir;highp float sdf=length(closest_point-u_globe_pos)/u_globe_radius;return sdf+PI*0.5;}float fog_opacity(vec3 pos) {float depth=length(pos);return fog_opacity(fog_range(depth));}vec3 fog_apply(vec3 color,vec3 pos,float opacity_limit) {float depth=length(pos);float opacity;if (u_is_globe==1) {float glow_progress=globe_glow_progress();float t=mix(glow_progress,depth,u_globe_transition);opacity=fog_opacity(fog_range(t));} else {opacity=fog_opacity(fog_range(depth));opacity*=fog_horizon_blending(pos/depth);}return mix(color,u_fog_color.rgb,min(opacity,opacity_limit));}vec3 fog_apply(vec3 color,vec3 pos) {return fog_apply(color,pos,1.0);}vec4 fog_apply_from_vert(vec4 color,float fog_opac) {float alpha=EPSILON+color.a;color.rgb=mix(color.rgb/alpha,u_fog_color.rgb,fog_opac)*alpha;return color;}vec3 fog_apply_sky_gradient(vec3 camera_ray,vec3 sky_color) {float horizon_blend=fog_horizon_blending(normalize(camera_ray));return mix(sky_color,u_fog_color.rgb,horizon_blend);}vec4 fog_apply_premultiplied(vec4 color,vec3 pos) {float alpha=EPSILON+color.a;color.rgb=fog_apply(color.rgb/alpha,pos)*alpha;return color;}vec4 fog_apply_premultiplied(vec4 color,vec3 pos,float heightMeters) {float verticalProgress=(u_fog_vertical_limit.x > 0.0 || u_fog_vertical_limit.y > 0.0) ? smoothstep(u_fog_vertical_limit.x,u_fog_vertical_limit.y,heightMeters) : 0.0;float opacityLimit=1.0-smoothstep(0.9,1.0,fog_opacity(pos));return mix(fog_apply_premultiplied(color,pos),color,min(verticalProgress,opacityLimit));}vec3 fog_dither(vec3 color) {return color;}vec4 fog_dither(vec4 color) {return vec4(fog_dither(color.rgb),color.a);} #endif`,R3=`#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`,Tk=`#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;}`,Ak=`#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`,F3=`#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 kv=/#include\s+"([^"]+)"/g,_f=/#pragma mapbox: ([\w\-]+) ([\w]+) ([\w]+) ([\w]+)/g,z3=/\b[A-Za-z_][A-Za-z0-9_]*\b/g,Gg=new Set(["ifdef","ifndef","elif","if","defined"]),Kg=new Set;Dm(My,Kg),Dm(D3,Kg),Dm(Ty,Kg);const Om={"_prelude_fog.vertex.glsl":Mk,"_prelude_terrain.vertex.glsl":xu,"_prelude_shadow.vertex.glsl":Ak,"_prelude_material_table.vertex.glsl":`#ifdef HAS_SHADER_STORAGE_BLOCK_material_buffer #define MATERIAL_TABLE_DEBUG 0 uniform int u_material_offset;uniform int u_vertex_offset;layout(std140,binding=0)readonly buffer material_buffer{uvec4 material_data[];};struct MaterialInfo{uint dataOffset; #if MATERIAL_TABLE_DEBUG vec4 colorDebug; #endif };uint read_buf_no_offset(uint iDword) {return material_data[iDword/4u][iDword % 4u];}uint read_buf(uint iDword) {iDword+=uint(u_material_offset/4);return read_buf_no_offset(iDword);}float read_buf_float(uint iDword){return uintBitsToFloat(read_buf(iDword));}uint read_buf_uint8(uint iDword,uint iUint8){uint dwordOffset=iDword+(iUint8/4u);uint byteOffset=iUint8 & 3u;uint bitOffset=8u*byteOffset;uint mask=0xffu << bitOffset;uint dwordVal=read_buf(dwordOffset);return (dwordVal & mask) >> bitOffset;}uint read_buf_uint16(uint iDword,uint iUint16){uint dwordOffset=iDword+(iUint16 >> 1u);uint bitOffset=(iUint16 & 1u)*16u;uint mask=0xffffu << bitOffset;uint dwordVal=read_buf(dwordOffset);return (dwordVal & mask) >> bitOffset;}uint nrDwordsForVertexIdEntries(uint nrMaterialLookupEntries) {return nrMaterialLookupEntries;}uint nrDwordsForMaterialIdEntries(uint nrMaterialLookupEntries) {return (nrMaterialLookupEntries*2u+3u)/4u;}uint findRangeBinarySearch(uint vertexId,uint numRanges,uint dwordOffset) {uint left=0u;uint right=numRanges-1u;for (uint i=0u; i < 16u; i++) { if (left > right) {break;}uint mid=(left+right)/2u;uint start=read_buf(dwordOffset+mid);uint nextStart=(mid+1u < numRanges) ? read_buf(dwordOffset+mid+1u) : 0xffffffffu;if (vertexId >=start && vertexId < nextStart) {return mid;} else if (vertexId < start) {if (mid==0u) {break;}right=mid-1u;} else {left=mid+1u;}}return 0u; }uint readVertexId(uint dwordOffset,uint iMaterialLookupEntry) {return read_buf(dwordOffset+iMaterialLookupEntry);}uint findRange(uint vertexId,uint numRanges,uint dwordOffset) {uint iRange;if(numRanges <=64u){uint vertexBegin;for(iRange=0u; iRange < numRanges;++iRange) {vertexBegin=readVertexId(dwordOffset,iRange);if(vertexBegin > vertexId) {break;}}iRange=iRange==0u? 0u : iRange-1u;} else { iRange=findRangeBinarySearch(vertexId,numRanges,dwordOffset);}return iRange;}MaterialInfo read_material_info(uint vertex_id) {MaterialInfo info; #if MATERIAL_TABLE_DEBUG const vec4 red=vec4(1.0,0.0,0.0,1.0);const vec4 orange=vec4(1.0,0.5,0.0,1.0);const vec4 yellow=vec4(1.0,1.0,0.0,1.0);const vec4 green=vec4(0.0,1.0,0.0,1.0);const vec4 indigo=vec4(0.294,0.0,0.510,1.0);const vec4 blue=vec4(0.0,0.0,1.0,1.0);const vec4 purple=vec4(0.5,0.0,0.5,1.0);const vec4 pink=vec4(1.0,0.0,1.0,1.0);info.colorDebug=green; #endif uint offset=0u; #if MATERIAL_TABLE_DEBUG bool keepFinding=true;uint magic=read_buf(offset);if(magic !=0xCAFEBABEu) {info.colorDebug=red;keepFinding=false;return info;} #endif offset++; #if MATERIAL_TABLE_DEBUG uint nrMaterials=read_buf(offset);uint nrVertices=read_buf(offset+1u);if(keepFinding && vertex_id >=nrVertices) {info.colorDebug=red;keepFinding=false;} #endif offset+=2u;uint nrMaterialLookupEntries=read_buf(offset++);uint perMaterialEntrySizeDwords=read_buf(offset++); #if MATERIAL_TABLE_DEBUG if(keepFinding && perMaterialEntrySizeDwords !=1u) {info.colorDebug=red;keepFinding=false;} #endif uint iMaterialLookup=findRange(vertex_id,nrMaterialLookupEntries,offset); #if MATERIAL_TABLE_DEBUG if(keepFinding) {uint vertexBeginCheck=readVertexId(offset,iMaterialLookup);if(vertexBeginCheck > vertex_id) {info.colorDebug=red;keepFinding=false;}if(iMaterialLookup < nrMaterialLookupEntries-1u) {uint vertexEndCheck=readVertexId(offset,iMaterialLookup+1u);if(vertexEndCheck <=vertex_id) {info.colorDebug=red;keepFinding=false;}}} #endif offset+=nrDwordsForVertexIdEntries(nrMaterialLookupEntries);uint materialId=iMaterialLookup; #if MATERIAL_TABLE_DEBUG if(keepFinding) {if(materialId >=nrMaterialLookupEntries) {info.colorDebug=red;}} #endif info.dataOffset=offset+materialId*perMaterialEntrySizeDwords;return info;}uint get_data_location(const MaterialInfo matInfo,uint attribOffsetBytes) {uint attribFieldOffsetDwords=attribOffsetBytes/4u;return matInfo.dataOffset+attribFieldOffsetDwords;}vec4 read_material_vec4(const MaterialInfo matInfo,uint attribOffsetBytes){uint loc=get_data_location(matInfo,attribOffsetBytes);return vec4(read_buf_float(loc),read_buf_float(loc+1u),read_buf_float(loc+2u),read_buf_float(loc+3u));}vec2 read_material_vec2(const MaterialInfo matInfo,uint attribOffsetBytes){uint loc=get_data_location(matInfo,attribOffsetBytes);return vec2(read_buf_float(loc),read_buf_float(loc+1u));}float read_material_float(const MaterialInfo matInfo,uint attribOffsetBytes){uint loc=get_data_location(matInfo,attribOffsetBytes);return read_buf_float(loc);} #define GET_ATTRIBUTE_float(attrib,matInfo,attrib_offset) read_material_float(matInfo,attrib_offset) #define GET_ATTRIBUTE_vec4(attrib,matInfo,attrib_offset) read_material_vec4(matInfo,attrib_offset) #define GET_ATTRIBUTE_vec2(attrib,matInfo,attrib_offset) read_material_vec2(matInfo,attrib_offset) #define DECLARE_MATERIAL_TABLE_INFO MaterialInfo materialInfo=read_material_info(uint(gl_VertexID)); #define DECLARE_MATERIAL_TABLE_INFO_DEBUG(dbgColor) MaterialInfo materialInfo=read_material_info(uint(gl_VertexID)); dbgColor=materialInfo.colorDebug; #endif`,"_prelude_fog.fragment.glsl":Sr,"_prelude_shadow.fragment.glsl":F3,"_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":R3,"_prelude_raster_particle.glsl":Tk},Ek={};Xs("",xu),Xs(Sr,Mk),Xs(F3,Ak),Xs(R3,""),Xs(Tk,"");const JI=Xs(Ty,D3),Ik=My,Hae=[` #if defined(GL_EXT_blend_func_extended) && defined(DUAL_SOURCE_BLENDING) #extension GL_EXT_blend_func_extended : require #endif`,"precision mediump float;",Ik,JI.fragmentSource].join(` `),eP=["precision highp float;",Ik,JI.vertexSource].join(` `);var B3={background:Xs(`#include "_prelude_fog.fragment.glsl" #include "_prelude_lighting.glsl" uniform vec4 u_color;uniform float u_opacity;uniform mediump float u_emissive_strength; #ifdef LIGHTING_3D_MODE in vec4 v_color; #endif void main() {vec4 out_color; #ifdef LIGHTING_3D_MODE out_color=v_color; #else out_color=u_color; #endif #ifdef FOG out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); #endif glFragColor=out_color*u_opacity; #ifdef USE_MRT1 out_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a); #endif #ifdef OVERDRAW_INSPECTOR glFragColor=vec4(1.0); #endif HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" #include "_prelude_lighting.glsl" in vec2 a_pos;uniform mat4 u_matrix;uniform mediump float u_emissive_strength; #ifdef LIGHTING_3D_MODE uniform mediump vec4 u_color;out vec4 v_color; #endif void main() {gl_Position=u_matrix*vec4(a_pos,0,1); #ifdef LIGHTING_3D_MODE v_color=apply_lighting_with_emission_ground(u_color,u_emissive_strength); #endif #ifdef FOG v_fog_pos=fog_position(a_pos); #endif }`),backgroundPattern:Xs(`#include "_prelude_fog.fragment.glsl" #include "_prelude_lighting.glsl" uniform vec2 u_pattern_tl;uniform vec2 u_pattern_br;uniform vec2 u_texsize;uniform float u_opacity;uniform float u_emissive_strength;uniform sampler2D u_image;in highp vec2 v_pos;void main() {highp vec2 imagecoord=mod(v_pos,1.0);highp vec2 pos=mix(u_pattern_tl/u_texsize,u_pattern_br/u_texsize,imagecoord);vec4 out_color=textureLodCustom(u_image,pos,v_pos); #ifdef LIGHTING_3D_MODE out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength); #endif #ifdef FOG out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); #endif glFragColor=out_color*u_opacity; #ifdef USE_MRT1 out_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a); #endif #ifdef OVERDRAW_INSPECTOR glFragColor=vec4(1.0); #endif HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" uniform mat4 u_matrix;uniform vec2 u_pattern_size;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec2 u_pattern_units_to_pixels;in vec2 a_pos;out highp vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_pattern_size,u_pattern_units_to_pixels,a_pos); #ifdef FOG v_fog_pos=fog_position(a_pos); #endif }`),building:Xs(`#include "_prelude_fog.fragment.glsl" #include "_prelude_shadow.fragment.glsl" #include "_prelude_lighting.glsl" const float window_depth=0.5;const float ao_radius=0.2;in vec4 v_color;in highp vec3 v_normal;in highp vec3 v_pos; #ifdef BUILDING_FAUX_FACADE in lowp float v_faux_facade;in highp float v_faux_facade_ed;in highp vec2 v_faux_facade_window;in highp vec2 v_faux_facade_floor;in highp vec2 v_faux_facade_range;in highp float v_aspect;in highp vec3 v_tbn_0;in highp vec3 v_tbn_1;in highp vec3 v_tbn_2;in highp vec4 v_faux_color_emissive;uniform float u_faux_facade_ao_intensity; #endif #ifdef RENDER_SHADOWS in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1; #endif #ifdef FLOOD_LIGHT in highp float v_flood_radius;in float v_has_flood_light; #endif uniform lowp float u_opacity;uniform vec3 u_camera_pos;uniform highp float u_tile_to_meter;uniform float u_facade_emissive_chance;uniform vec3 u_flood_light_color;uniform float u_flood_light_intensity;vec3 linearTosRGB(in vec3 color) {return pow(color,vec3(1./2.2));} #ifdef BUILDING_FAUX_FACADE float hash12(in vec2 p) {vec3 p3 =fract(vec3(p.xyx)*0.1031);p3+=dot(p3,p3.yzx+33.33);return fract((p3.x+p3.y)*p3.z);}float min3(in vec3 v) {return min(min(v.x,v.y),v.z);}vec2 get_uv_mask_id(in vec2 q,out float mask,out vec2 id) {vec2 p=q;mask=step(v_faux_facade_range.x,p.y)*step(p.y,v_faux_facade_range.y);p.y=p.y-v_faux_facade_range.x;vec2 uv=modf(p/v_faux_facade_floor,id);vec4 d=(v_faux_facade_floor.xyxy+vec4(-v_faux_facade_window,v_faux_facade_window))*0.5;vec4 edge=d/v_faux_facade_floor.xyxy;vec2 m=step(edge.xy,uv)*step(uv,edge.zw);mask*=m.x*m.y;uv-=vec2(0.5);uv*=vec2(0.5)/(vec2(0.5)-edge.xy);uv+=vec2(0.5);return uv;}float ray_unit_box(in vec3 ray_o,in vec3 ray_d,in vec3 bmin,in vec3 bmax) {vec3 planes=mix(bmin,bmax,step(0.0,ray_d));vec3 t=(planes-ray_o)/ray_d;return min3(t);}float get_emissive(in vec2 id) {if (u_facade_emissive_chance > 0.0) {return (step(hash12(id),u_facade_emissive_chance)+0.05)*v_faux_color_emissive.a;}return 0.0;}vec3 get_shade_info(in vec3 v,in vec3 v_normalized,in vec3 color,in vec2 id,in mat3 tbn,inout vec3 out_normal,inout float out_emissive) {vec3 out_color=color;vec3 abs_v=abs(v_normalized);bool x_major=abs_v.x >=abs_v.y && abs_v.x >=abs_v.z;bool y_major=abs_v.y >=abs_v.x && abs_v.y >=abs_v.z;bool z_major=abs_v.z >=abs_v.x && abs_v.z >=abs_v.y; #if 0 if (x_major) {out_color=v.x > 0.0 ? vec3(1.0,0.0,0.0) : vec3(0.0,1.0,1.0);} else if (y_major) {out_color=v.y > 0.0 ? vec3(0.0,1.0,0.0) : vec3(1.0,0.0,1.0);} else if (z_major) {out_color=v.z > 0.0 ? vec3(0.0,0.0,1.0) : vec3(1.0,1.0,0.0);}out_emissive=1.0; #else if (x_major) {out_normal=sign(v.x)*tbn[0];} else if (y_major) {out_normal=vec3(0.0,0.0,-sign(v.y));} else if (z_major) {out_color=v_faux_color_emissive.rgb;out_emissive=v.z <=0.0 ? get_emissive(id) : out_emissive;}float ao=1.0;if (u_faux_facade_ao_intensity > 0.0) {vec4 ao_range=v_faux_facade_window.xxyy*0.5-vec4(0,ao_radius,0,ao_radius);vec2 ao_range_z=vec2(window_depth*0.5)-vec2(0.0,ao_radius);if (x_major || y_major) {ao*=smoothstep(-ao_range_z.x,-ao_range_z.y,v.z);} else if (z_major) {ao*=smoothstep(-ao_range.x,-ao_range.y,v.x)*(1.0-smoothstep(ao_range.y,ao_range.x,v.x));ao*=smoothstep(-ao_range.z,-ao_range.w,v.y)*(1.0-smoothstep(ao_range.w,ao_range.z,v.y));}ao=mix(1.0,min(1.0,ao+0.25),u_faux_facade_ao_intensity);}out_color*=ao; #endif return out_color;} #endif vec3 apply_lighting_linear(in vec3 color,in vec3 normal,in float dir_factor) {float ambient_directional_factor=calculate_ambient_directional_factor(normal);vec3 ambient_contrib=ambient_directional_factor*u_lighting_ambient_color;vec3 directional_contrib=u_lighting_directional_color*dir_factor;return color*(ambient_contrib+directional_contrib);}void main() {vec3 normal=normalize(v_normal);vec3 base_color=v_color.rgb;float emissive=v_color.a; #ifdef BUILDING_FAUX_FACADE if (v_faux_facade > 0.0) {mat3 tbn=mat3(v_tbn_0,v_tbn_1,v_tbn_2);vec3 v=vec3(v_pos.xy,v_pos.z/u_tile_to_meter)-u_camera_pos;vec3 view_tangent=transpose(tbn)*v;vec2 q=vec2(v_faux_facade_ed,v_pos.z);float mask=0.0;vec2 id=vec2(0.0);vec2 uv=get_uv_mask_id(q,mask,id);uv*=v_faux_facade_window;vec3 bmin=vec3(0.0,0.0,-window_depth);vec3 bmax=bmin+vec3(v_faux_facade_window,window_depth);vec3 ray_o=vec3(uv,0.0);vec3 ray_d=normalize(view_tangent);float t_min=ray_unit_box(ray_o,ray_d,bmin,bmax);vec3 hit=ray_o+t_min*ray_d;vec3 r=vec3(v_faux_facade_window,-window_depth);hit-=r*0.5;vec3 normalized=hit/r;vec3 out_normal=normal;float out_emissive=emissive;vec3 room_color=get_shade_info(hit,normalized,base_color,id,tbn,out_normal,out_emissive);base_color=mix(base_color,room_color,mask);normal=mix(normal,out_normal,mask);emissive=mix(emissive,out_emissive,mask);} #endif vec4 color=vec4(base_color,1.0);vec3 xy_flipped_normal=vec3(-normal.xy,normal.z);float shadowed_lighting_factor=0.0; #ifdef RENDER_SHADOWS #ifdef RENDER_CUTOFF shadowed_lighting_factor=shadowed_light_factor_normal_opacity(xy_flipped_normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w,v_cutoff_opacity);if (v_cutoff_opacity==0.0) {discard;} #else shadowed_lighting_factor=shadowed_light_factor_normal(xy_flipped_normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w); #endif #else shadowed_lighting_factor=dot(xy_flipped_normal,u_lighting_directional_dir); #endif color.rgb=apply_lighting_linear(color.rgb,xy_flipped_normal,shadowed_lighting_factor);color.rgb=linearTosRGB(color.rgb); #ifdef FLOOD_LIGHT float flood_radiance=(1.0-min(v_pos.z/v_flood_radius,1.0))*u_flood_light_intensity*v_has_flood_light;color.rgb=mix(color.rgb,u_flood_light_color,flood_radiance); #endif color.rgb=mix(color.rgb,linearTosRGB(base_color.rgb),emissive); #ifdef FOG color=fog_dither(fog_apply_premultiplied(color,v_fog_pos,v_pos.z)); #endif color*=u_opacity; #ifdef INDICATOR_CUTOUT color=applyCutout(color,v_pos.z); #endif #ifdef FEATURE_CUTOUT color=apply_feature_cutout(color,gl_FragCoord); #endif glFragColor=color; #ifdef DEBUG_SHOW_NORMALS color.rgb=xy_flipped_normal*0.5+vec3(0.5,0.5,0.5);color.a=1.0;glFragColor=color; #endif #ifdef OVERDRAW_INSPECTOR glFragColor=vec4(1.0); #endif HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" #include "_prelude_shadow.vertex.glsl" in vec3 a_pos_3f;in vec3 a_normal_3;in vec3 a_centroid_3;in float a_flood_light_wall_radius_1i16;in vec4 a_faux_facade_data;in vec2 a_faux_facade_vertical_range;uniform mat4 u_matrix;uniform mat4 u_normal_matrix;uniform highp float u_tile_to_meter;out vec4 v_color;out vec3 v_normal;out highp vec3 v_pos; #ifdef BUILDING_FAUX_FACADE out lowp float v_faux_facade;out highp float v_faux_facade_ed;out highp vec2 v_faux_facade_window;out highp vec2 v_faux_facade_floor;out highp vec2 v_faux_facade_range;out highp float v_aspect;out highp vec3 v_tbn_0;out highp vec3 v_tbn_1;out highp vec3 v_tbn_2;out highp vec4 v_faux_color_emissive; #endif #ifdef RENDER_SHADOWS uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1; #endif #ifdef FLOOD_LIGHT out highp float v_flood_radius;out float v_has_flood_light; #endif const float MAX_UINT_16=65535.0;const float MAX_INT_16=32767.0;const float MAX_UINT_8=255.0;const float TWO_POW_8=256.0;const float FLOOD_LIGHT_MAX_RADIUS_METER=2048.0;vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));} #ifdef BUILDING_FAUX_FACADE mat3 get_tbn(in vec3 normal) {const vec3 bitangent=vec3(0.0,0.0,1.0);vec3 tangent=normalize(vec3(normal.y,-normal.x,0.0));return mat3(tangent,bitangent,normal);} #endif #pragma mapbox: define-attribute-vertex-shader-only highp vec2 part_color_emissive #pragma mapbox: define-attribute-vertex-shader-only highp vec2 faux_facade_color_emissive void main() { #pragma mapbox: initialize-attribute-custom highp vec2 part_color_emissive #pragma mapbox: initialize-attribute-custom highp vec2 faux_facade_color_emissive #ifdef FLOOD_LIGHT v_flood_radius=(a_flood_light_wall_radius_1i16/MAX_INT_16*FLOOD_LIGHT_MAX_RADIUS_METER);v_has_flood_light=step(0.0,v_flood_radius); #endif vec4 color_emissive=decode_color(part_color_emissive);v_color=vec4(sRGBToLinear(color_emissive.rgb),color_emissive.a);vec3 a_normal_3f=a_normal_3/MAX_INT_16;v_normal=vec3(u_normal_matrix*vec4(a_normal_3f,0.0));float hidden=0.0;float depth_offset=0.0; #ifdef BUILDING_FAUX_FACADE v_faux_facade=a_faux_facade_data.x;if (v_faux_facade > 0.0) {v_faux_facade_ed=a_faux_facade_data.x *u_tile_to_meter;float window_x_perc=floor(a_faux_facade_data.y/TWO_POW_8);float window_y_perc=a_faux_facade_data.y-TWO_POW_8*window_x_perc;vec2 window_perc=vec2(window_x_perc,window_y_perc)/MAX_UINT_8;v_faux_facade_floor=(a_faux_facade_data.zw/MAX_UINT_16*EXTENT)*u_tile_to_meter;v_faux_facade_window=window_perc*v_faux_facade_floor;v_faux_facade_range=(a_faux_facade_vertical_range/MAX_UINT_16*EXTENT)*u_tile_to_meter;v_aspect=v_faux_facade_window.x/v_faux_facade_window.y;mat3 tbn=get_tbn(normalize(v_normal));v_tbn_0=tbn[0];v_tbn_1=tbn[1];v_tbn_2=tbn[2];v_faux_color_emissive=decode_color(faux_facade_color_emissive);v_faux_color_emissive.rgb=sRGBToLinear(v_faux_color_emissive.rgb);float height=a_centroid_3.z;depth_offset=min(1000.0,height)*0.0000002;} #endif v_pos=a_pos_3f; #ifdef RENDER_CUTOFF vec4 ground=u_matrix*vec4(a_centroid_3,1.0);v_cutoff_opacity=cutoff_opacity(u_cutoff_params,ground.z);hidden=float(v_cutoff_opacity==0.0);v_pos.z*=v_cutoff_opacity; #endif #ifdef RENDER_SHADOWS vec3 shadow_pos=v_pos; #ifdef NORMAL_OFFSET vec3 offset=shadow_normal_offset_model(v_normal);shadow_pos+=offset*shadow_normal_offset_multiplier0(); #endif v_pos_light_view_0=u_light_matrix_0*vec4(shadow_pos,1.0);v_pos_light_view_1=u_light_matrix_1*vec4(shadow_pos,1.0); #endif #ifdef FOG v_fog_pos=fog_position(v_pos); #endif gl_Position=mix(u_matrix*vec4(v_pos,1),AWAY,hidden);gl_Position.z-=depth_offset*gl_Position.w;}`),buildingBloom:Xs(`in vec4 v_color_emissive; #pragma mapbox: define-attribute highp vec4 bloom_attenuation #pragma mapbox: initialize-attribute highp vec4 bloom_attenuation float saturate(float val) {return clamp(val,0.0,1.0);}void main() {float emission=v_color_emissive.a;float opacity=1.0; #ifdef HAS_ATTRIBUTE_a_bloom_attenuation float distance=length(vec2(1.3*max(0.0,abs(bloom_attenuation.x)-bloom_attenuation.z),bloom_attenuation.y));distance+= mix(0.5,0.0,clamp(emission-1.0,0.0,1.0));opacity*=saturate(1.0-distance*distance); #endif #ifdef RENDER_CUTOFF opacity*=v_cutoff_opacity; #endif glFragColor=vec4(v_color_emissive.rgb,1.0)*opacity;}`,`in vec3 a_pos_3f; #pragma mapbox: define-attribute-vertex-shader-only highp vec2 part_color_emissive #pragma mapbox: define-attribute highp vec4 bloom_attenuation out vec4 v_color_emissive;uniform mat4 u_matrix;vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}void main() { #pragma mapbox: initialize-attribute-custom highp vec2 part_color_emissive #pragma mapbox: initialize-attribute highp vec4 bloom_attenuation #ifdef HAS_ATTRIBUTE_a_part_color_emissive vec4 color_emissive=decode_color(part_color_emissive);float part_emissive=color_emissive.a*5.0;v_color_emissive=vec4(sRGBToLinear(color_emissive.rgb),part_emissive); #else v_color_emissive=vec4(1.0); #endif gl_Position=u_matrix*vec4(a_pos_3f,1.0); #ifdef RENDER_CUTOFF v_cutoff_opacity=cutoff_opacity(u_cutoff_params,gl_Position.z); #endif }`),buildingDepth:Xs(`in highp float v_depth;void main() { #ifndef DEPTH_TEXTURE glFragColor=pack_depth(v_depth); #endif }`,"in vec3 a_pos_3f;uniform mat4 u_matrix;out highp float v_depth;void main() {gl_Position=u_matrix*vec4(a_pos_3f,1.0);v_depth=gl_Position.z/gl_Position.w;}"),circle:Xs(`#include "_prelude_fog.fragment.glsl" #include "_prelude_lighting.glsl" in vec3 v_data;in float v_visibility; #pragma mapbox: define highp vec4 color #pragma mapbox: define mediump float radius #pragma mapbox: define lowp float blur #pragma mapbox: define lowp float opacity #pragma mapbox: define highp vec4 stroke_color #pragma mapbox: define mediump float stroke_width #pragma mapbox: define lowp float stroke_opacity uniform float u_emissive_strength;void main() { #pragma mapbox: initialize highp vec4 color #pragma mapbox: initialize mediump float radius #pragma mapbox: initialize lowp float blur #pragma mapbox: initialize lowp float opacity #pragma mapbox: initialize highp vec4 stroke_color #pragma mapbox: initialize mediump float stroke_width #pragma mapbox: initialize lowp float stroke_opacity vec2 extrude=v_data.xy;float blur_positive=blur < 0.0 ? 0.0 : 1.0;lowp float antialiasblur=v_data.z;float extrude_length=length(extrude)+antialiasblur*(1.0-blur_positive);float antialiased_blur=-max(abs(blur),antialiasblur);float antialiase_blur_opacity=smoothstep(0.0,antialiasblur,extrude_length-1.0);float opacity_t=blur_positive==1.0 ? smoothstep(0.0,-antialiased_blur,1.0-extrude_length) : smoothstep(antialiased_blur,0.0,extrude_length-1.0)-antialiase_blur_opacity;float color_t=stroke_width < 0.01 ? 0.0 : smoothstep( antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width) );vec4 out_color=mix(color*opacity,stroke_color*stroke_opacity,color_t); #ifdef LIGHTING_3D_MODE out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength); #endif #ifdef FOG out_color=fog_apply_premultiplied(out_color,v_fog_pos); #endif glFragColor=out_color*(v_visibility*opacity_t); #ifdef OVERDRAW_INSPECTOR glFragColor=vec4(1.0); #endif }`,`#include "_prelude_fog.vertex.glsl" #include "_prelude_terrain.vertex.glsl" #define NUM_VISIBILITY_RINGS 2 #define INV_SQRT2 0.70710678 #define ELEVATION_BIAS 0.0001 #define NUM_SAMPLES_PER_RING 16 uniform mat4 u_matrix;uniform mat2 u_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;in vec2 a_pos; #ifdef PROJECTION_GLOBE_VIEW in vec3 a_pos_3;in vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir; #endif #ifdef ELEVATED_ROADS in float a_circle_z_offset; #endif out vec3 v_data;out float v_visibility; #pragma mapbox: define highp vec4 color #pragma mapbox: define mediump float radius #pragma mapbox: define lowp float blur #pragma mapbox: define lowp float opacity #pragma mapbox: define highp vec4 stroke_color #pragma mapbox: define mediump float stroke_width #pragma mapbox: define lowp float stroke_opacity vec2 calc_offset(vec2 extrusion,float radius,float stroke_width, float view_scale) {return extrusion*(radius+stroke_width)*u_extrude_scale*view_scale;}float cantilevered_elevation(vec2 pos,float radius,float stroke_width,float view_scale) {vec2 c1=pos+calc_offset(vec2(-1,-1),radius,stroke_width,view_scale);vec2 c2=pos+calc_offset(vec2(1,-1),radius,stroke_width,view_scale);vec2 c3=pos+calc_offset(vec2(1,1),radius,stroke_width,view_scale);vec2 c4=pos+calc_offset(vec2(-1,1),radius,stroke_width,view_scale);float h1=elevation(c1)+ELEVATION_BIAS;float h2=elevation(c2)+ELEVATION_BIAS;float h3=elevation(c3)+ELEVATION_BIAS;float h4=elevation(c4)+ELEVATION_BIAS;return max(h4,max(h3,max(h1,h2)));}float circle_elevation(vec2 pos) { #if defined(TERRAIN) return elevation(pos)+ELEVATION_BIAS; #else return 0.0; #endif }vec4 project_vertex(vec2 extrusion,vec4 world_center,vec4 projected_center,float radius,float stroke_width, float view_scale,mat3 surface_vectors) {vec2 sample_offset=calc_offset(extrusion,radius,stroke_width,view_scale); #ifdef PITCH_WITH_MAP #ifdef PROJECTION_GLOBE_VIEW return u_matrix*( world_center+vec4(sample_offset.x*surface_vectors[0]+sample_offset.y*surface_vectors[1],0) ); #else return u_matrix*( world_center+vec4(sample_offset,0,0) ); #endif #else return projected_center+vec4(sample_offset,0,0); #endif }float get_sample_step() { #ifdef PITCH_WITH_MAP return 2.0*PI/float(NUM_SAMPLES_PER_RING); #else return PI/float(NUM_SAMPLES_PER_RING); #endif }void main() { #pragma mapbox: initialize highp vec4 color #pragma mapbox: initialize mediump float radius #pragma mapbox: initialize lowp float blur #pragma mapbox: initialize lowp float opacity #pragma mapbox: initialize highp vec4 stroke_color #pragma mapbox: initialize mediump float stroke_width #pragma mapbox: initialize lowp float stroke_opacity vec2 extrude=vec2(mod(a_pos,2.0)*2.0-1.0);vec2 circle_center=floor(a_pos*0.5);vec4 world_center;mat3 surface_vectors; #ifdef PROJECTION_GLOBE_VIEW vec3 pos_normal_3=a_pos_normal_3/16384.0;surface_vectors=globe_mercator_surface_vectors(pos_normal_3,u_up_dir,u_zoom_transition);vec3 surface_extrusion=extrude.x*surface_vectors[0]+extrude.y*surface_vectors[1];vec3 globe_elevation=elevationVector(circle_center)*circle_elevation(circle_center);vec3 globe_pos=a_pos_3+surface_extrusion+globe_elevation;vec3 mercator_elevation=u_up_dir*u_tile_up_scale*circle_elevation(circle_center);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,circle_center,u_tile_id,u_merc_center)+surface_extrusion+mercator_elevation;vec3 pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition);world_center=vec4(pos,1); #else surface_vectors=mat3(1.0);float height=circle_elevation(circle_center);world_center=vec4(circle_center,height,1); #endif #ifdef ELEVATED_ROADS world_center.z+=a_circle_z_offset+ELEVATION_BIAS; #endif vec4 projected_center=u_matrix*world_center;float view_scale=0.0; #ifdef PITCH_WITH_MAP #ifdef SCALE_WITH_MAP view_scale=1.0; #else view_scale=projected_center.w/u_camera_to_center_distance; #endif #else #ifdef SCALE_WITH_MAP view_scale=u_camera_to_center_distance; #else view_scale=projected_center.w; #endif #endif gl_Position=project_vertex(extrude,world_center,projected_center,radius,stroke_width,view_scale,surface_vectors);float visibility=0.0; #ifdef TERRAIN float step=get_sample_step();vec4 occlusion_world_center;vec4 occlusion_projected_center; #ifdef PITCH_WITH_MAP float cantilevered_height=cantilevered_elevation(circle_center,radius,stroke_width,view_scale);occlusion_world_center=vec4(circle_center,cantilevered_height,1);occlusion_projected_center=u_matrix*occlusion_world_center; #else occlusion_world_center=world_center;occlusion_projected_center=projected_center; #endif for(int ring=0; ring < NUM_VISIBILITY_RINGS; ring++) {float scale=(float(ring)+1.0)/float(NUM_VISIBILITY_RINGS);for(int i=0; i < NUM_SAMPLES_PER_RING; i++) {vec2 extrusion=vec2(cos(step*float(i)),-sin(step*float(i)))*scale;vec4 frag_pos=project_vertex(extrusion,occlusion_world_center,occlusion_projected_center,radius,stroke_width,view_scale,surface_vectors);visibility+=float(!isOccluded(frag_pos));}}visibility/=float(NUM_VISIBILITY_RINGS)*float(NUM_SAMPLES_PER_RING); #else visibility=1.0; #endif #ifdef PROJECTION_GLOBE_VIEW visibility=1.0; #endif v_visibility=visibility;lowp float antialiasblur=1.0/u_device_pixel_ratio/(radius+stroke_width);v_data=vec3(extrude.x,extrude.y,antialiasblur); #ifdef FOG v_fog_pos=fog_position(world_center.xyz); #endif }`),clippingMask:Xs("void main() {glFragColor=vec4(1.0);}","in vec2 a_pos;uniform mat4 u_matrix;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);}"),heatmap:Xs(`#include "_prelude_fog.fragment.glsl" uniform highp float u_intensity;in vec2 v_extrude; #pragma mapbox: define highp float weight #define GAUSS_COEF 0.3989422804014327 void main() { #pragma mapbox: initialize highp float weight float d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);glFragColor=vec4(val,1.0,1.0,1.0); #ifdef FOG if (u_is_globe==0) {glFragColor.r*=pow(1.0-fog_opacity(v_fog_pos),2.0);} #endif #ifdef OVERDRAW_INSPECTOR glFragColor=vec4(1.0); #endif HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_terrain.vertex.glsl" #include "_prelude_fog.vertex.glsl" uniform mat4 u_matrix;uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;in vec2 a_pos; #ifdef PROJECTION_GLOBE_VIEW in vec3 a_pos_3;in vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir; #endif out vec2 v_extrude; #pragma mapbox: define highp float weight #pragma mapbox: define mediump float radius const highp float ZERO=1.0/255.0/16.0; #define GAUSS_COEF 0.3989422804014327 void main() { #pragma mapbox: initialize highp float weight #pragma mapbox: initialize mediump float radius vec2 unscaled_extrude=vec2(mod(a_pos,2.0)*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec2 tilePos=floor(a_pos*0.5);vec3 pos; #ifdef PROJECTION_GLOBE_VIEW vec3 pos_normal_3=a_pos_normal_3/16384.0;mat3 surface_vectors=globe_mercator_surface_vectors(pos_normal_3,u_up_dir,u_zoom_transition);vec3 surface_extrusion=extrude.x*surface_vectors[0]+extrude.y*surface_vectors[1];vec3 globe_elevation=elevationVector(tilePos)*elevation(tilePos);vec3 globe_pos=a_pos_3+surface_extrusion+globe_elevation;vec3 mercator_elevation=u_up_dir*u_tile_up_scale*elevation(tilePos);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,tilePos,u_tile_id,u_merc_center)+surface_extrusion+mercator_elevation;pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition); #else pos=vec3(tilePos+extrude,elevation(tilePos)); #endif gl_Position=u_matrix*vec4(pos,1); #ifdef FOG v_fog_pos=fog_position(pos); #endif }`),heatmapTexture:Xs(`uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;in vec2 v_pos;void main() {float t=texture(u_image,v_pos).r;vec4 color=texture(u_color_ramp,vec2(t,0.5));glFragColor=color*u_opacity; #ifdef OVERDRAW_INSPECTOR glFragColor=vec4(0.0); #endif HANDLE_WIREFRAME_DEBUG;}`,"in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=vec4(a_pos,0,1);v_pos=a_pos*0.5+0.5;}"),collisionBox:Xs("in float v_placed;in float v_notUsed;void main() {vec4 red =vec4(1.0,0.0,0.0,1.0);vec4 blue=vec4(0.0,0.0,1.0,0.5);glFragColor =mix(red,blue,step(0.5,v_placed))*0.5;glFragColor*=mix(1.0,0.1,step(0.5,v_notUsed));}",`#include "_prelude_terrain.vertex.glsl" in vec3 a_pos;in vec2 a_anchor_pos;in vec2 a_extrude;in vec2 a_placed;in vec2 a_shift;in vec2 a_elevation_from_sea;in float a_size_scale;in vec2 a_padding;in float a_auto_z_offset;uniform mat4 u_matrix;uniform vec2 u_extrude_scale;uniform float u_camera_to_center_distance; #ifdef PROJECTION_GLOBE_VIEW uniform vec3 u_tile_id;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform float u_zoom_transition; #endif out float v_placed;out float v_notUsed;void main() {float feature_elevation=a_elevation_from_sea.x+a_auto_z_offset;float terrain_elevation=(a_elevation_from_sea.y==1.0 ? 0.0 : elevation(a_anchor_pos));vec3 proj_pos=a_pos+elevationVector(a_anchor_pos)*(feature_elevation+terrain_elevation); #ifdef PROJECTION_GLOBE_VIEW #ifndef PROJECTED_POS_ON_VIEWPORT vec3 globe_pos=proj_pos;vec3 mercator_pos=mercator_tile_position(u_inv_rot_matrix,a_anchor_pos,u_tile_id,u_merc_center);proj_pos=mix_globe_mercator(globe_pos,mercator_pos,u_zoom_transition); #endif #endif vec4 projectedPoint=u_matrix*vec4(proj_pos,1);highp float camera_to_anchor_distance=projectedPoint.w;highp float collision_perspective_ratio=clamp( 0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,1.5);gl_Position=projectedPoint;gl_Position.xy+=(a_extrude*a_size_scale+a_shift+a_padding)*u_extrude_scale*gl_Position.w*collision_perspective_ratio;v_placed=a_placed.x;v_notUsed=a_placed.y;}`),collisionCircle:Xs("in float v_radius;in vec2 v_extrude;in float v_perspective_ratio;in float v_collision;void main() {float alpha=0.5*min(v_perspective_ratio,1.0);float stroke_radius=0.9*max(v_perspective_ratio,1.0);float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);glFragColor=color*alpha*opacity_t;}",`in vec2 a_pos_2f;in float a_radius;in vec2 a_flags;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform vec2 u_viewport_size;uniform float u_camera_to_center_distance;out float v_radius;out vec2 v_extrude;out float v_perspective_ratio;out float v_collision;vec3 toTilePosition(vec2 screenPos) {vec4 rayStart=u_inv_matrix*vec4(screenPos,-1.0,1.0);vec4 rayEnd =u_inv_matrix*vec4(screenPos, 1.0,1.0);rayStart.xyz/=rayStart.w;rayEnd.xyz /=rayEnd.w;highp float t=(0.0-rayStart.z)/(rayEnd.z-rayStart.z);return mix(rayStart.xyz,rayEnd.xyz,t);}void main() {vec2 quadCenterPos=a_pos_2f;float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2( mix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;vec3 tilePos=toTilePosition(quadCenterPos);vec4 clipPos=u_matrix*vec4(tilePos,1.0);highp float camera_to_anchor_distance=clipPos.w;highp float collision_perspective_ratio=clamp( 0.5+0.5*(u_camera_to_center_distance/camera_to_anchor_distance),0.0,4.0);float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_perspective_ratio=collision_perspective_ratio;v_collision=collision;gl_Position=vec4(clipPos.xyz/clipPos.w,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}`),debug:Xs("uniform highp vec4 u_color;uniform sampler2D u_overlay;in vec2 v_uv;void main() {vec4 overlay_color=texture(u_overlay,v_uv);glFragColor=mix(u_color,overlay_color,overlay_color.a);}",`#include "_prelude_terrain.vertex.glsl" in vec2 a_pos; #ifdef PROJECTION_GLOBE_VIEW in vec3 a_pos_3; #endif out vec2 v_uv;uniform mat4 u_matrix;uniform float u_overlay_scale;void main() {float h=elevation(a_pos);v_uv=a_pos/8192.0; #ifdef PROJECTION_GLOBE_VIEW gl_Position=u_matrix*vec4(a_pos_3+elevationVector(a_pos)*h,1); #else gl_Position=u_matrix*vec4(a_pos*u_overlay_scale,h,1); #endif }`),elevatedStructuresDepth:Xs(`void main() { #ifndef DEPTH_TEXTURE glFragColor=vec4(0.); #endif }`,"in vec2 a_pos;in float a_height;uniform mat4 u_matrix;uniform float u_depth_bias;void main() {gl_Position=u_matrix*vec4(a_pos,a_height,1);gl_Position.z=gl_Position.z+u_depth_bias;}"),elevatedStructuresDepthReconstruct:Xs(`#ifdef DEPTH_RECONSTRUCTION in float v_height; #endif void main() { #ifdef DEPTH_RECONSTRUCTION if (v_height >=0.0) discard; #else #ifdef FEATURE_CUTOUT apply_feature_cutout(vec4(0.0,0.0,0.0,1.0),gl_FragCoord); #endif #endif glFragColor=vec4(1.0,0.0,0.0,1.0);}`,`in vec2 a_pos;in float a_height;uniform mat4 u_matrix;uniform vec3 u_camera_pos;uniform highp float u_depth_bias;uniform lowp float u_height_scale;uniform lowp float u_reset_depth; #ifdef DEPTH_RECONSTRUCTION out float v_height; #endif void main() {vec3 vpos=vec3(a_pos,a_height*u_height_scale); #ifdef DEPTH_RECONSTRUCTION if (u_camera_pos.z > vpos.z) {vpos-=(u_camera_pos-vpos)*(vpos.z/(u_camera_pos.z-vpos.z));}v_height=a_height; #endif gl_Position=u_matrix*vec4(vpos,1);gl_Position.z=u_reset_depth==1.0 ? gl_Position.w : gl_Position.z+u_depth_bias;}`),elevatedStructures:Xs(`#include "_prelude_fog.fragment.glsl" #include "_prelude_lighting.glsl" #include "_prelude_shadow.fragment.glsl" in vec3 v_normal;in float v_height; #ifdef RENDER_SHADOWS in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in float v_depth; #endif vec3 linearTosRGB(vec3 color) {return pow(color,vec3(1./2.2));}vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}vec3 compute_view_dependent_emissive_color(float ndotl,float emissive_strength,vec3 color) {color=sRGBToLinear(color);color=color*(ndotl+(1.0-min(ndotl*57.29,1.0))*emissive_strength);color=linearTosRGB(color.rgb);return color;}uniform float u_emissive_strength; #pragma mapbox: define highp vec4 structure_color void main() { #pragma mapbox: initialize highp vec4 structure_color vec3 color=structure_color.xyz; #ifdef LIGHTING_3D_MODE vec3 normal=normalize(v_normal);vec3 transformed_normal=vec3(-normal.xy,normal.z);float ndotl=calculate_NdotL(transformed_normal);float emissive_strength=u_emissive_strength;emissive_strength=0.0;vec3 emissive_color=compute_view_dependent_emissive_color(ndotl,emissive_strength,color.xyz); #ifdef RENDER_SHADOWS float shadowed_lighting_factor=shadowed_light_factor_normal(transformed_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth);color.rgb=apply_lighting(color.rgb,transformed_normal,shadowed_lighting_factor); #else color=apply_lighting(color,transformed_normal); #endif color=mix(color,emissive_color,emissive_strength);if (v_height < 0.0) {float penetration=max(v_height+7.5,0.0);float occlusion=1.0-1.0/PI*acos(1.0-penetration/4.0);color=color*(1.0-pow(occlusion,2.0)*0.3);} #endif #ifdef FOG color=fog_apply(color,v_fog_pos); #endif vec4 out_color=vec4(color,1.0); #ifdef INDICATOR_CUTOUT out_color=applyCutout(out_color,v_height); #endif #ifdef FEATURE_CUTOUT out_color=apply_feature_cutout(out_color,gl_FragCoord); #endif glFragColor=out_color;HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" #include "_prelude_shadow.vertex.glsl" in vec2 a_pos;in float a_height;in vec3 a_pos_normal_3;uniform mat4 u_matrix;out vec3 v_normal;out float v_height; #ifdef RENDER_SHADOWS uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out float v_depth; #endif #pragma mapbox: define highp vec4 structure_color void main() { #pragma mapbox: initialize highp vec4 structure_color v_normal=a_pos_normal_3/16384.0;v_height=a_height;vec3 pos=vec3(a_pos,a_height);gl_Position=u_matrix*vec4(pos,1); #ifdef RENDER_SHADOWS vec3 shd_pos0=pos;vec3 shd_pos1=pos; #ifdef NORMAL_OFFSET vec3 offset=shadow_normal_offset(vec3(-v_normal.xy,v_normal.z));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1(); #endif v_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w; #endif #ifdef FOG v_fog_pos=fog_position(a_pos); #endif }`),fill:Xs(`#include "_prelude_fog.fragment.glsl" #include "_prelude_lighting.glsl" #include "_prelude_shadow.fragment.glsl" #pragma mapbox: define highp vec4 color #pragma mapbox: define lowp float opacity uniform float u_emissive_strength; #ifdef RENDER_SHADOWS uniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth; #endif #ifdef ELEVATED_ROADS in highp float v_road_z_offset; #endif #ifdef INDICATOR_CUTOUT in highp float v_z_offset; #endif void main() { #pragma mapbox: initialize highp vec4 color #pragma mapbox: initialize lowp float opacity vec4 out_color=color; #ifdef LIGHTING_3D_MODE out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength); #ifdef RENDER_SHADOWS float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light); #endif #endif #ifdef FOG out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); #endif out_color*=opacity; #ifdef INDICATOR_CUTOUT if (v_z_offset >=0.0) {out_color=applyCutout(out_color,v_z_offset);} #endif #ifdef FEATURE_CUTOUT out_color=apply_feature_cutout(out_color,gl_FragCoord); #endif glFragColor=out_color; #ifdef USE_MRT1 out_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a); #endif #ifdef OVERDRAW_INSPECTOR glFragColor=vec4(1.0); #endif HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" #include "_prelude_shadow.vertex.glsl" in vec2 a_pos; #ifdef ELEVATED_ROADS in float a_road_z_offset;out highp float v_road_z_offset; #endif #ifdef RENDER_SHADOWS uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth; #endif #ifdef INDICATOR_CUTOUT out highp float v_z_offset; #endif uniform mat4 u_matrix; #pragma mapbox: define highp vec4 color #pragma mapbox: define lowp float opacity #pragma mapbox: define highp float z_offset void main() { #pragma mapbox: initialize highp vec4 color #pragma mapbox: initialize lowp float opacity #pragma mapbox: initialize highp float z_offset #ifdef ELEVATED_ROADS z_offset+=a_road_z_offset;v_road_z_offset=z_offset; #endif float hidden=float(opacity==0.0);gl_Position=mix(u_matrix*vec4(a_pos,z_offset,1),AWAY,hidden); #ifdef RENDER_SHADOWS vec3 shd_pos0=vec3(a_pos,z_offset);vec3 shd_pos1=vec3(a_pos,z_offset); #ifdef NORMAL_OFFSET vec3 offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1(); #endif v_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w; #endif #ifdef FOG v_fog_pos=fog_position(a_pos); #endif #ifdef INDICATOR_CUTOUT v_z_offset=z_offset; #endif }`),fillOutline:Xs(`#include "_prelude_fog.fragment.glsl" #include "_prelude_lighting.glsl" #include "_prelude_shadow.fragment.glsl" in highp vec2 v_pos;uniform float u_emissive_strength; #ifdef RENDER_SHADOWS uniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth; #endif #pragma mapbox: define highp vec4 outline_color #pragma mapbox: define lowp float opacity void main() { #pragma mapbox: initialize highp vec4 outline_color #pragma mapbox: initialize lowp float opacity float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);vec4 out_color=outline_color; #ifdef LIGHTING_3D_MODE out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength); #ifdef RENDER_SHADOWS float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light); #endif #endif #ifdef FOG out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); #endif #ifdef FEATURE_CUTOUT out_color=apply_feature_cutout(out_color,gl_FragCoord); #endif glFragColor=out_color*(alpha*opacity); #ifdef USE_MRT1 out_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a); #endif #ifdef OVERDRAW_INSPECTOR glFragColor=vec4(1.0); #endif HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" #include "_prelude_shadow.vertex.glsl" in vec2 a_pos; #ifdef ELEVATED_ROADS in float a_road_z_offset; #endif #ifdef RENDER_SHADOWS uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth; #endif uniform mat4 u_matrix;uniform vec2 u_world;out highp vec2 v_pos; #pragma mapbox: define highp vec4 outline_color #pragma mapbox: define lowp float opacity #pragma mapbox: define highp float z_offset void main() { #pragma mapbox: initialize highp vec4 outline_color #pragma mapbox: initialize lowp float opacity #pragma mapbox: initialize highp float z_offset #ifdef ELEVATED_ROADS z_offset+=a_road_z_offset; #endif float hidden=float(opacity==0.0);gl_Position=mix(u_matrix*vec4(a_pos,z_offset,1),AWAY,hidden); #ifdef FLIP_Y v_pos=(vec2(gl_Position.x,-gl_Position.y)/gl_Position.w+1.0)/2.0*u_world; #else v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world; #endif #ifdef RENDER_SHADOWS vec3 shd_pos0=vec3(a_pos,z_offset);vec3 shd_pos1=vec3(a_pos,z_offset); #ifdef NORMAL_OFFSET vec3 offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1(); #endif v_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w; #endif #ifdef FOG v_fog_pos=fog_position(a_pos); #endif }`),fillOutlinePattern:Xs(`#include "_prelude_fog.fragment.glsl" #include "_prelude_lighting.glsl" #include "_prelude_shadow.fragment.glsl" uniform vec2 u_texsize;uniform sampler2D u_image; #ifdef FILL_PATTERN_TRANSITION uniform float u_pattern_transition; #endif uniform float u_emissive_strength; #ifdef APPLY_LUT_ON_GPU uniform highp sampler3D u_lutTexture; #endif #ifdef RENDER_SHADOWS uniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth; #endif in highp vec2 v_pos;in highp vec2 v_pos_world; #pragma mapbox: define lowp float opacity #pragma mapbox: define lowp vec4 pattern #ifdef FILL_PATTERN_TRANSITION #pragma mapbox: define mediump vec4 pattern_b #endif void main() { #pragma mapbox: initialize lowp float opacity #pragma mapbox: initialize mediump vec4 pattern #ifdef FILL_PATTERN_TRANSITION #pragma mapbox: initialize mediump vec4 pattern_b #endif vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;highp vec2 imagecoord=mod(v_pos,1.0);highp vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);highp vec2 lod_pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,v_pos);float dist=length(v_pos_world-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);vec4 out_color=textureLodCustom(u_image,pos,lod_pos); #ifdef APPLY_LUT_ON_GPU out_color=applyLUT(u_lutTexture,out_color); #endif #ifdef FILL_PATTERN_TRANSITION vec2 pattern_b_tl=pattern_b.xy;vec2 pattern_b_br=pattern_b.zw;highp vec2 pos_b=mix(pattern_b_tl/u_texsize,pattern_b_br/u_texsize,imagecoord);vec4 color_b=textureLodCustom(u_image,pos_b,lod_pos);out_color=out_color*(1.0-u_pattern_transition)+color_b*u_pattern_transition; #endif #ifdef LIGHTING_3D_MODE out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength); #ifdef RENDER_SHADOWS float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth);out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light); #endif #endif #ifdef FEATURE_CUTOUT out_color=apply_feature_cutout(out_color,gl_FragCoord); #endif #ifdef FOG out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); #endif glFragColor=out_color*(alpha*opacity); #ifdef USE_MRT1 out_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a); #endif #ifdef OVERDRAW_INSPECTOR glFragColor=vec4(1.0); #endif HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" #include "_prelude_shadow.vertex.glsl" uniform mat4 u_matrix;uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_tile_units_to_pixels;in vec2 a_pos; #ifdef ELEVATED_ROADS in float a_road_z_offset; #endif #ifdef RENDER_SHADOWS uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth; #endif out highp vec2 v_pos;out highp vec2 v_pos_world; #pragma mapbox: define lowp float opacity #pragma mapbox: define lowp vec4 pattern #ifdef FILL_PATTERN_TRANSITION #pragma mapbox: define mediump vec4 pattern_b #endif #pragma mapbox: define lowp float pixel_ratio #pragma mapbox: define highp float z_offset void main() { #pragma mapbox: initialize lowp float opacity #pragma mapbox: initialize mediump vec4 pattern #ifdef FILL_PATTERN_TRANSITION #pragma mapbox: initialize mediump vec4 pattern_b #endif #pragma mapbox: initialize lowp float pixel_ratio #pragma mapbox: initialize highp float z_offset vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw; #ifdef ELEVATED_ROADS z_offset+=a_road_z_offset; #endif float hidden=float(opacity==0.0);gl_Position=mix(u_matrix*vec4(a_pos,z_offset,1),AWAY,hidden);vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,a_pos); #ifdef FLIP_Y v_pos_world=(vec2(gl_Position.x,-gl_Position.y)/gl_Position.w+1.0)/2.0*u_world; #else v_pos_world=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world; #endif #ifdef RENDER_SHADOWS vec3 shd_pos0=vec3(a_pos,z_offset);vec3 shd_pos1=vec3(a_pos,z_offset); #ifdef NORMAL_OFFSET vec3 offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1(); #endif v_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w; #endif #ifdef FOG v_fog_pos=fog_position(a_pos); #endif }`),fillPattern:Xs(`#include "_prelude_fog.fragment.glsl" #include "_prelude_lighting.glsl" #include "_prelude_shadow.fragment.glsl" uniform vec2 u_texsize;uniform sampler2D u_image; #ifdef FILL_PATTERN_TRANSITION uniform float u_pattern_transition; #endif in highp vec2 v_pos;uniform float u_emissive_strength; #ifdef RENDER_SHADOWS uniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth; #endif #ifdef ELEVATED_ROADS in highp float v_road_z_offset; #endif #ifdef APPLY_LUT_ON_GPU uniform highp sampler3D u_lutTexture; #endif #pragma mapbox: define lowp float opacity #pragma mapbox: define lowp vec4 pattern #ifdef FILL_PATTERN_TRANSITION #pragma mapbox: define mediump vec4 pattern_b #endif void main() { #pragma mapbox: initialize lowp float opacity #pragma mapbox: initialize mediump vec4 pattern #ifdef FILL_PATTERN_TRANSITION #pragma mapbox: initialize mediump vec4 pattern_b #endif vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;highp vec2 imagecoord=mod(v_pos,1.0);highp vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);highp vec2 lod_pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,v_pos);vec4 out_color=textureLodCustom(u_image,pos,lod_pos); #ifdef APPLY_LUT_ON_GPU out_color=applyLUT(u_lutTexture,out_color); #endif #ifdef FILL_PATTERN_TRANSITION vec2 pattern_b_tl=pattern_b.xy;vec2 pattern_b_br=pattern_b.zw;highp vec2 pos_b=mix(pattern_b_tl/u_texsize,pattern_b_br/u_texsize,imagecoord);vec4 color_b=textureLodCustom(u_image,pos_b,lod_pos);out_color=out_color*(1.0-u_pattern_transition)+color_b*u_pattern_transition; #endif #ifdef LIGHTING_3D_MODE out_color=apply_lighting_with_emission_ground(out_color,u_emissive_strength); #ifdef RENDER_SHADOWS float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth); #ifdef ELEVATED_ROADS out_color.rgb*=mix(v_road_z_offset !=0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light); #else out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light); #endif #endif #endif #ifdef FEATURE_CUTOUT out_color=apply_feature_cutout(out_color,gl_FragCoord); #endif #ifdef FOG out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); #endif glFragColor=out_color*opacity; #ifdef USE_MRT1 out_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a); #endif #ifdef OVERDRAW_INSPECTOR glFragColor=vec4(1.0); #endif HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" #include "_prelude_shadow.vertex.glsl" uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_tile_units_to_pixels;in vec2 a_pos; #ifdef ELEVATED_ROADS in float a_road_z_offset;out highp float v_road_z_offset; #endif #ifdef RENDER_SHADOWS uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth; #endif out highp vec2 v_pos; #pragma mapbox: define lowp float opacity #pragma mapbox: define lowp vec4 pattern #ifdef FILL_PATTERN_TRANSITION #pragma mapbox: define mediump vec4 pattern_b #endif #pragma mapbox: define lowp float pixel_ratio #pragma mapbox: define highp float z_offset void main() { #pragma mapbox: initialize lowp float opacity #pragma mapbox: initialize mediump vec4 pattern #pragma mapbox: initialize lowp float pixel_ratio #pragma mapbox: initialize highp float z_offset #ifdef FILL_PATTERN_TRANSITION #pragma mapbox: initialize mediump vec4 pattern_b #endif vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio; #ifdef ELEVATED_ROADS z_offset+=a_road_z_offset;v_road_z_offset=z_offset; #endif float hidden=float(opacity==0.0);gl_Position=mix(u_matrix*vec4(a_pos,z_offset,1),AWAY,hidden);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,a_pos); #ifdef RENDER_SHADOWS vec3 shd_pos0=vec3(a_pos,z_offset);vec3 shd_pos1=vec3(a_pos,z_offset); #ifdef NORMAL_OFFSET vec3 offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1(); #endif v_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w; #endif #ifdef FOG v_fog_pos=fog_position(a_pos); #endif }`),fillExtrusion:Xs(`#include "_prelude_fog.fragment.glsl" #include "_prelude_shadow.fragment.glsl" #include "_prelude_lighting.glsl" in vec4 v_color;in vec4 v_flat; #ifdef RENDER_SHADOWS in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1; #endif uniform lowp float u_opacity; #ifdef FAUX_AO uniform lowp vec2 u_ao;in vec2 v_ao; #endif #if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE) in vec4 v_roof_color; #endif #if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE) in highp vec3 v_normal; #endif uniform vec3 u_flood_light_color;uniform highp float u_vertical_scale;uniform float u_flood_light_intensity;uniform vec3 u_ground_shadow_factor; #if defined(LIGHTING_3D_MODE) && defined(FLOOD_LIGHT) in float v_flood_radius;in float v_has_floodlight; #endif in float v_height; #pragma mapbox: define highp float emissive_strength void main() { #pragma mapbox: initialize highp float emissive_strength #if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE) vec3 normal=normalize(v_normal); #endif float z;vec4 color=v_color; #ifdef ZERO_ROOF_RADIUS z=float(normal.z > 0.00001); #ifdef LIGHTING_3D_MODE normal=mix(normal,vec3(0.0,0.0,1.0),z); #else color=mix(v_color,v_roof_color,z); #endif #endif float h=max(0.0,v_height);float ao_shade=1.0; #ifdef FAUX_AO float intensity=u_ao[0];float h_floors=h/(u_ao[1]*u_vertical_scale);float y_shade=1.0-0.9*intensity*min(v_ao.y,1.0);ao_shade=(1.0-0.08*intensity)*(y_shade+(1.0-y_shade)*(1.0-pow(1.0-min(h_floors/16.0,1.0),16.0)))+0.08*intensity*min(h_floors/160.0,1.0);float concave=v_ao.x*v_ao.x; #ifdef ZERO_ROOF_RADIUS concave*=(1.0-z); #endif float x_shade=mix(1.0,mix(0.6,0.75,min(h_floors/30.0,1.0)),intensity)+0.1*intensity*min(h,1.0);ao_shade*=mix(1.0,x_shade*x_shade*x_shade,concave); #ifdef LIGHTING_3D_MODE #ifdef FLOOD_LIGHT color.rgb*=mix(ao_shade,1.0,v_has_floodlight); #else color.rgb*=ao_shade; #endif #else color.rgb*=ao_shade; #endif #endif #ifdef LIGHTING_3D_MODE float flood_radiance=0.0; #ifdef FLOOD_LIGHT flood_radiance=(1.0-min(h/v_flood_radius,1.0))*u_flood_light_intensity*v_has_floodlight; #endif #ifdef RENDER_SHADOWS #ifdef FLOOD_LIGHT float ndotl_unclamped=dot(normal,u_shadow_direction);float ndotl=max(0.0,ndotl_unclamped);float occlusion=ndotl_unclamped < 0.0 ? 1.0 : shadow_occlusion(ndotl,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);vec3 litColor=apply_lighting(color.rgb,normal,(1.0-u_shadow_intensity*occlusion)*ndotl);vec3 floodLitColor=compute_flood_lighting(u_flood_light_color*u_opacity,1.0-u_shadow_intensity,occlusion,u_ground_shadow_factor);color.rgb=mix(litColor,floodLitColor,flood_radiance); #else float shadowed_lighting_factor; #ifdef RENDER_CUTOFF shadowed_lighting_factor=shadowed_light_factor_normal_opacity(normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w,v_cutoff_opacity);if (v_cutoff_opacity==0.0) {discard;} #else shadowed_lighting_factor=shadowed_light_factor_normal(normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w); #endif color.rgb=apply_lighting(color.rgb,normal,shadowed_lighting_factor); #endif #else color.rgb=apply_lighting(color.rgb,normal); #ifdef FLOOD_LIGHT color.rgb=mix(color.rgb,u_flood_light_color*u_opacity,flood_radiance); #endif #endif color.rgb=mix(color.rgb,v_flat.rgb,emissive_strength);color*=u_opacity; #endif #ifdef FOG color=fog_dither(fog_apply_premultiplied(color,v_fog_pos,h)); #endif #ifdef INDICATOR_CUTOUT color=applyCutout(color,h); #endif #ifdef FEATURE_CUTOUT color=apply_feature_cutout(color,gl_FragCoord); #endif glFragColor=color; #ifdef OVERDRAW_INSPECTOR glFragColor=vec4(1.0); #endif HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" #include "_prelude_terrain.vertex.glsl" #include "_prelude_shadow.vertex.glsl" #include "_prelude_lighting.glsl" #include "_prelude_material_table.vertex.glsl" uniform mat4 u_matrix;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform float u_edge_radius;uniform float u_width_scale;in vec4 a_pos_normal_ed;in vec2 a_centroid_pos; #ifdef RENDER_WALL_MODE in vec3 a_join_normal_inside; #endif #ifdef PROJECTION_GLOBE_VIEW in vec3 a_pos_3;in vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;uniform float u_height_lift; #endif #ifdef TERRAIN uniform int u_height_type;uniform int u_base_type; #endif uniform highp float u_vertical_scale;out vec4 v_color;out vec4 v_flat; #ifdef RENDER_SHADOWS uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1; #endif #if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE) out vec4 v_roof_color; #endif #if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE) out highp vec3 v_normal; #endif #ifdef FAUX_AO uniform lowp vec2 u_ao;out vec2 v_ao; #endif #if defined(LIGHTING_3D_MODE) && defined(FLOOD_LIGHT) out float v_flood_radius;out float v_has_floodlight; #endif out float v_height;vec3 linearTosRGB(vec3 color) {return pow(color,vec3(1./2.2));}vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));} #pragma mapbox: define highp float base #pragma mapbox: define highp float height #pragma mapbox: define highp vec4 color #pragma mapbox: define highp float flood_light_wall_radius #pragma mapbox: define highp float line_width #pragma mapbox: define highp float emissive_strength void main() {DECLARE_MATERIAL_TABLE_INFO #pragma mapbox: initialize highp float base #pragma mapbox: initialize highp float height #pragma mapbox: initialize highp vec4 color #pragma mapbox: initialize highp float flood_light_wall_radius #pragma mapbox: initialize highp float line_width #pragma mapbox: initialize highp float emissive_strength base*=u_vertical_scale;height*=u_vertical_scale;vec4 pos_nx=floor(a_pos_normal_ed*0.5);vec4 top_up_ny_start=a_pos_normal_ed-2.0*pos_nx;vec3 top_up_ny=top_up_ny_start.xyz;float x_normal=pos_nx.z/8192.0;vec3 normal=top_up_ny.y==1.0 ? vec3(0.0,0.0,1.0) : normalize(vec3(x_normal,(2.0*top_up_ny.z-1.0)*(1.0-abs(x_normal)),0.0)); #if defined(ZERO_ROOF_RADIUS) || defined(RENDER_SHADOWS) || defined(LIGHTING_3D_MODE) v_normal=normal; #endif base=max(0.0,base);float attr_height=height;height=max(0.0,top_up_ny.y==0.0 && top_up_ny.x==1.0 ? height-u_edge_radius : height);float t=top_up_ny.x;vec2 centroid_pos=vec2(0.0); #if defined(HAS_CENTROID) || defined(TERRAIN) centroid_pos=a_centroid_pos; #endif float ele=0.0;float h=0.0;float c_ele=0.0;vec3 pos; #ifdef TERRAIN bool is_flat_height=centroid_pos.x !=0.0 && u_height_type==1;bool is_flat_base=centroid_pos.x !=0.0 && u_base_type==1;ele=elevation(pos_nx.xy);c_ele=is_flat_height || is_flat_base ? (centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos)) : ele;float h_height=is_flat_height ? max(c_ele+height,ele+base+2.0) : ele+height;float h_base=is_flat_base ? max(c_ele+base,ele+base) : ele+(base==0.0 ?-5.0 : base);h=t > 0.0 ? max(h_base,h_height) : h_base;pos=vec3(pos_nx.xy,h); #else h=t > 0.0 ? height : base;pos=vec3(pos_nx.xy,h); #endif #ifdef PROJECTION_GLOBE_VIEW float lift=float((t+base) > 0.0)*u_height_lift;h+=lift;vec3 globe_normal=normalize(mix(a_pos_normal_3/16384.0,u_up_dir,u_zoom_transition));vec3 globe_pos=a_pos_3+globe_normal*(u_tile_up_scale*h);vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,pos.xy,u_tile_id,u_merc_center)+u_up_dir*u_tile_up_scale*pos.z;pos=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition); #endif float cutoff=1.0;vec3 scaled_pos=pos; #ifdef RENDER_CUTOFF vec3 centroid_random=vec3(centroid_pos.xy,centroid_pos.x+centroid_pos.y+1.0);vec3 ground_pos=centroid_pos.x==0.0 ? pos.xyz : (centroid_random/8.0);vec4 ground=u_matrix*vec4(ground_pos.xy,ele,1.0); #ifdef CLIP_ZERO_TO_ONE cutoff=cutoff_opacity(u_cutoff_params,ground.z*2.0-ground.w); #else cutoff=cutoff_opacity(u_cutoff_params,ground.z); #endif if (centroid_pos.y !=0.0 && centroid_pos.x !=0.0) {vec3 g=floor(ground_pos);vec3 mod_=centroid_random-g*8.0;float seed=min(1.0,0.1*(min(3.5,max(mod_.x+mod_.y,0.2*attr_height))*0.35+mod_.z));if (cutoff < 0.8-seed) {cutoff=0.0;}}float cutoff_scale=cutoff;v_cutoff_opacity=cutoff;scaled_pos.z=mix(c_ele,h,cutoff_scale); #endif float hidden=float((centroid_pos.x==0.0 && centroid_pos.y==1.0) || (cutoff==0.0 && centroid_pos.x !=0.0) || (color.a==0.0)); #ifdef RENDER_WALL_MODE vec2 wall_offset=u_width_scale*line_width*(a_join_normal_inside.xy/EXTENT);scaled_pos.xy+=(1.0-a_join_normal_inside.z)*wall_offset*0.5;scaled_pos.xy-=a_join_normal_inside.z*wall_offset*0.5; #endif gl_Position=mix(u_matrix*vec4(scaled_pos,1),AWAY,hidden);h=h-ele;v_height=h; #ifdef RENDER_SHADOWS vec3 shd_pos0=pos;vec3 shd_pos1=pos; #ifdef NORMAL_OFFSET vec3 offset=shadow_normal_offset(normal);shd_pos0+=offset*shadow_normal_offset_multiplier0();shd_pos1+=offset*shadow_normal_offset_multiplier1(); #endif v_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1); #endif float NdotL=0.0;float colorvalue=0.0; #ifndef LIGHTING_3D_MODE colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;NdotL=clamp(dot(normal,u_lightpos),0.0,1.0);NdotL=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),NdotL);if (normal.y !=0.0) {float r=0.84;r=mix(0.7,0.98,1.0-u_lightintensity);NdotL*=( (1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),r,1.0)));} #endif #ifdef FAUX_AO float concave=pos_nx.w-floor(pos_nx.w*0.5)*2.0;float start=top_up_ny_start.w;float y_ground=1.0-clamp(t+base,0.0,1.0);float top_height=height; #ifdef TERRAIN top_height=mix(max(c_ele+height,ele+base+2.0),ele+height,float(centroid_pos.x==0.0))-ele;y_ground+=y_ground*5.0/max(3.0,top_height); #endif v_ao=vec2(mix(concave,-concave,start),y_ground);NdotL*=(1.0+0.05*(1.0-top_up_ny.y)*u_ao[0]); #ifdef PROJECTION_GLOBE_VIEW top_height+=u_height_lift; #endif gl_Position.z-=(0.0000006*(min(top_height,500.)+2.0*min(base,500.0)+60.0*concave+3.0*start))*gl_Position.w; #endif #ifdef LIGHTING_3D_MODE #ifdef FLOOD_LIGHT float is_wall=1.0-float(t > 0.0 && top_up_ny.y > 0.0);v_has_floodlight=float(flood_light_wall_radius > 0.0 && is_wall > 0.0);v_flood_radius=flood_light_wall_radius*u_vertical_scale; #endif v_color=vec4(color.rgb,1.0);float ndotl=calculate_NdotL(normal);v_flat.rgb=sRGBToLinear(color.rgb);v_flat.rgb=v_flat.rgb*(ndotl+(1.0-min(ndotl*57.29,1.0))*emissive_strength);v_flat=vec4(linearTosRGB(v_flat.rgb),1.0); #else v_color=vec4(0.0,0.0,0.0,1.0);v_color.rgb+=clamp(color.rgb*NdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_color*=u_opacity; #endif #if defined(ZERO_ROOF_RADIUS) && !defined(LIGHTING_3D_MODE) float roofNdotL=clamp(u_lightpos.z,0.0,1.0);roofNdotL=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),roofNdotL);v_roof_color=vec4(0.0,0.0,0.0,1.0);v_roof_color.rgb+=clamp(color.rgb*roofNdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_roof_color*=u_opacity; #endif #ifdef FOG v_fog_pos=fog_position(pos); #endif }`),fillExtrusionDepth:Xs(`in highp float v_depth;void main() { #ifndef DEPTH_TEXTURE glFragColor=pack_depth(v_depth); #endif }`,`#include "_prelude_terrain.vertex.glsl" #include "_prelude_material_table.vertex.glsl" uniform mat4 u_matrix;uniform float u_edge_radius;uniform float u_width_scale;uniform float u_vertical_scale; #ifdef TERRAIN uniform int u_height_type;uniform int u_base_type; #endif in vec4 a_pos_normal_ed;in vec2 a_centroid_pos; #ifdef RENDER_WALL_MODE in vec3 a_join_normal_inside; #endif #pragma mapbox: define highp float base #pragma mapbox: define highp float height #pragma mapbox: define highp float line_width #pragma mapbox: define highp vec4 color out highp float v_depth;void main() {DECLARE_MATERIAL_TABLE_INFO #pragma mapbox: initialize highp float base #pragma mapbox: initialize highp float height #pragma mapbox: initialize highp float line_width #pragma mapbox: initialize highp vec4 color base*=u_vertical_scale;height*=u_vertical_scale;vec3 pos_nx=floor(a_pos_normal_ed.xyz*0.5);mediump vec3 top_up_ny=a_pos_normal_ed.xyz-2.0*pos_nx;base=max(0.0,base);height=max(0.0,top_up_ny.y==0.0 && top_up_ny.x==1.0 ? height-u_edge_radius : height);float t=top_up_ny.x;vec2 centroid_pos=vec2(0.0); #if defined(HAS_CENTROID) || defined(TERRAIN) centroid_pos=a_centroid_pos; #endif vec3 pos; #ifdef TERRAIN bool is_flat_height=centroid_pos.x !=0.0 && u_height_type==1;bool is_flat_base=centroid_pos.x !=0.0 && u_base_type==1;float ele=elevation(pos_nx.xy);float c_ele=is_flat_height || is_flat_base ? (centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos)) : ele;float h_height=is_flat_height ? max(c_ele+height,ele+base+2.0) : ele+height;float h_base=is_flat_base ? max(c_ele+base,ele+base) : ele+(base==0.0 ?-5.0 : base);float h=t > 0.0 ? max(h_base,h_height) : h_base;pos=vec3(pos_nx.xy,h); #else pos=vec3(pos_nx.xy,t > 0.0 ? height : base); #endif #ifdef RENDER_WALL_MODE vec2 wall_offset=u_width_scale*line_width*(a_join_normal_inside.xy/EXTENT);pos.xy+=(1.0-a_join_normal_inside.z)*wall_offset*0.5;pos.xy-=a_join_normal_inside.z*wall_offset*0.5; #endif float hidden=float((centroid_pos.x==0.0 && centroid_pos.y==1.0) || (color.a==0.0));gl_Position=mix(u_matrix*vec4(pos,1),AWAY,hidden);v_depth=gl_Position.z/gl_Position.w;}`),fillExtrusionPattern:Xs(`#include "_prelude_fog.fragment.glsl" #include "_prelude_lighting.glsl" uniform vec2 u_texsize;uniform sampler2D u_image; #ifdef FILL_EXTRUSION_PATTERN_TRANSITION uniform float u_pattern_transition; #endif #ifdef FAUX_AO uniform lowp vec2 u_ao;in vec3 v_ao; #endif #ifdef LIGHTING_3D_MODE in vec3 v_normal; #endif #ifdef APPLY_LUT_ON_GPU uniform highp sampler3D u_lutTexture; #endif in highp vec2 v_pos;in vec4 v_lighting;uniform lowp float u_opacity; #pragma mapbox: define highp float base #pragma mapbox: define highp float height #pragma mapbox: define mediump vec4 pattern #ifdef FILL_EXTRUSION_PATTERN_TRANSITION #pragma mapbox: define mediump vec4 pattern_b #endif #pragma mapbox: define highp float pixel_ratio void main() { #pragma mapbox: initialize highp float base #pragma mapbox: initialize highp float height #pragma mapbox: initialize mediump vec4 pattern #ifdef FILL_EXTRUSION_PATTERN_TRANSITION #pragma mapbox: initialize mediump vec4 pattern_b #endif #pragma mapbox: initialize highp float pixel_ratio vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;highp vec2 imagecoord=mod(v_pos,1.0);highp vec2 pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,imagecoord);highp vec2 lod_pos=mix(pattern_tl/u_texsize,pattern_br/u_texsize,v_pos);vec4 out_color=textureLodCustom(u_image,pos,lod_pos); #ifdef APPLY_LUT_ON_GPU out_color=applyLUT(u_lutTexture,out_color); #endif #ifdef FILL_EXTRUSION_PATTERN_TRANSITION vec2 pattern_b_tl=pattern_b.xy;vec2 pattern_b_br=pattern_b.zw;highp vec2 pos_b=mix(pattern_b_tl/u_texsize,pattern_b_br/u_texsize,imagecoord);vec4 color_b=textureLodCustom(u_image,pos_b,lod_pos);out_color=out_color*(1.0-u_pattern_transition)+color_b*u_pattern_transition; #endif #ifdef LIGHTING_3D_MODE out_color=apply_lighting(out_color,normalize(v_normal))*u_opacity; #else out_color=out_color*v_lighting; #endif #ifdef FAUX_AO float intensity=u_ao[0];float h=max(0.0,v_ao.z);float h_floors=h/u_ao[1];float y_shade=1.0-0.9*intensity*min(v_ao.y,1.0);float shade=(1.0-0.08*intensity)*(y_shade+(1.0-y_shade)*(1.0-pow(1.0-min(h_floors/16.0,1.0),16.0)))+0.08*intensity*min(h_floors/160.0,1.0);float concave=v_ao.x*v_ao.x;float x_shade=mix(1.0,mix(0.6,0.75,min(h_floors/30.0,1.0)),intensity)+0.1*intensity*min(h,1.0);shade*=mix(1.0,x_shade*x_shade*x_shade,concave);out_color.rgb=out_color.rgb*shade; #endif #ifdef FOG out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); #endif #ifdef INDICATOR_CUTOUT out_color=applyCutout(out_color,height); #endif glFragColor=out_color; #ifdef OVERDRAW_INSPECTOR glFragColor=vec4(1.0); #endif HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" #include "_prelude_terrain.vertex.glsl" #include "_prelude_lighting.glsl" #include "_prelude_material_table.vertex.glsl" uniform mat4 u_matrix;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform float u_tile_units_to_pixels;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform float u_width_scale;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp float u_lightintensity;in vec4 a_pos_normal_ed;in vec2 a_centroid_pos; #ifdef RENDER_WALL_MODE in vec3 a_join_normal_inside; #endif #ifdef PROJECTION_GLOBE_VIEW in vec3 a_pos_3;in vec3 a_pos_normal_3;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_tile_id;uniform float u_zoom_transition;uniform vec3 u_up_dir;uniform float u_height_lift; #endif #ifdef TERRAIN uniform int u_height_type;uniform int u_base_type; #endif out highp vec2 v_pos;out vec4 v_lighting; #ifdef FAUX_AO uniform lowp vec2 u_ao;out vec3 v_ao; #endif #ifdef LIGHTING_3D_MODE out vec3 v_normal; #endif #pragma mapbox: define highp float base #pragma mapbox: define highp float height #pragma mapbox: define highp vec4 color #pragma mapbox: define mediump vec4 pattern #ifdef FILL_EXTRUSION_PATTERN_TRANSITION #pragma mapbox: define mediump vec4 pattern_b #endif #pragma mapbox: define highp float pixel_ratio #pragma mapbox: define highp float line_width void main() {DECLARE_MATERIAL_TABLE_INFO #pragma mapbox: initialize highp float base #pragma mapbox: initialize highp float height #pragma mapbox: initialize highp vec4 color #pragma mapbox: initialize mediump vec4 pattern #ifdef FILL_EXTRUSION_PATTERN_TRANSITION #pragma mapbox: initialize mediump vec4 pattern_b #endif #pragma mapbox: initialize highp float pixel_ratio #pragma mapbox: initialize highp float line_width vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec4 pos_nx=floor(a_pos_normal_ed*0.5);mediump vec4 top_up_ny_start=a_pos_normal_ed-2.0*pos_nx;mediump vec3 top_up_ny=top_up_ny_start.xyz;float x_normal=pos_nx.z/8192.0;vec3 normal=top_up_ny.y==1.0 ? vec3(0.0,0.0,1.0) : normalize(vec3(x_normal,(2.0*top_up_ny.z-1.0)*(1.0-abs(x_normal)),0.0));float edgedistance=a_pos_normal_ed.w;vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;base=max(0.0,base);height=max(0.0,height);float t=top_up_ny.x;float z=t > 0.0 ? height : base;vec2 centroid_pos=vec2(0.0); #if defined(HAS_CENTROID) || defined(TERRAIN) centroid_pos=a_centroid_pos; #endif float ele=0.0;float h=z;vec3 p;float c_ele; #ifdef TERRAIN bool is_flat_height=centroid_pos.x !=0.0 && u_height_type==1;bool is_flat_base=centroid_pos.x !=0.0 && u_base_type==1;ele=elevation(pos_nx.xy);c_ele=is_flat_height || is_flat_base ? (centroid_pos.y==0.0 ? elevationFromUint16(centroid_pos.x) : flatElevation(centroid_pos)) : ele;float h_height=is_flat_height ? max(c_ele+height,ele+base+2.0) : ele+height;float h_base=is_flat_base ? max(c_ele+base,ele+base) : ele+(base==0.0 ?-5.0 : base);h=t > 0.0 ? max(h_base,h_height) : h_base;p=vec3(pos_nx.xy,h); #else p=vec3(pos_nx.xy,z); #endif #ifdef PROJECTION_GLOBE_VIEW float lift=float((t+base) > 0.0)*u_height_lift;h+=lift;vec3 globe_normal=normalize(mix(a_pos_normal_3/16384.0,u_up_dir,u_zoom_transition));vec3 globe_pos=a_pos_3+globe_normal*(u_tile_up_scale*(p.z+lift));vec3 merc_pos=mercator_tile_position(u_inv_rot_matrix,p.xy,u_tile_id,u_merc_center)+u_up_dir*u_tile_up_scale*p.z;p=mix_globe_mercator(globe_pos,merc_pos,u_zoom_transition); #endif #ifdef RENDER_WALL_MODE vec2 wall_offset=u_width_scale*line_width*(a_join_normal_inside.xy/EXTENT);p.xy+=(1.0-a_join_normal_inside.z)*wall_offset*0.5;p.xy-=a_join_normal_inside.z*wall_offset*0.5; #endif float hidden=float((centroid_pos.x==0.0 && centroid_pos.y==1.0) || (color.a==0.0));gl_Position=mix(u_matrix*vec4(p,1),AWAY,hidden);vec2 pos=normal.z==1.0 ? pos_nx.xy : vec2(edgedistance,z*u_height_factor);v_pos=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,display_size,u_tile_units_to_pixels,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float NdotL=0.0; #ifdef LIGHTING_3D_MODE NdotL=calculate_NdotL(normal); #else NdotL=clamp(dot(normal,u_lightpos),0.0,1.0);NdotL=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),NdotL); #endif if (normal.y !=0.0) {float r=0.84; #ifndef LIGHTING_3D_MODE r=mix(0.7,0.98,1.0-u_lightintensity); #endif NdotL*=( (1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),r,1.0)));} #ifdef FAUX_AO float concave=pos_nx.w-floor(pos_nx.w*0.5)*2.0;float start=top_up_ny_start.w;float y_ground=1.0-clamp(t+base,0.0,1.0);float top_height=height; #ifdef TERRAIN top_height=mix(max(c_ele+height,ele+base+2.0),ele+height,float(centroid_pos.x==0.0))-ele;y_ground+=y_ground*5.0/max(3.0,top_height); #endif v_ao=vec3(mix(concave,-concave,start),y_ground,h-ele);NdotL*=(1.0+0.05*(1.0-top_up_ny.y)*u_ao[0]); #ifdef PROJECTION_GLOBE_VIEW top_height+=u_height_lift; #endif gl_Position.z-=(0.0000006*(min(top_height,500.)+2.0*min(base,500.0)+60.0*concave+3.0*start))*gl_Position.w; #endif #ifdef LIGHTING_3D_MODE v_normal=normal; #else v_lighting.rgb+=clamp(NdotL*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity; #endif #ifdef FOG v_fog_pos=fog_position(p); #endif }`),groundShadow:Xs(`#include "_prelude_shadow.fragment.glsl" precision highp float;uniform vec3 u_ground_shadow_factor;in vec4 v_pos_light_view_0;in vec4 v_pos_light_view_1; #ifdef FOG in float v_fog_opacity; #endif void main() {float light=shadowed_light_factor_plane_bias(v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);vec3 shadow=mix(u_ground_shadow_factor,vec3(1.0),light); #ifdef RENDER_CUTOFF shadow=mix(vec3(1.0),shadow,cutoff_opacity(u_cutoff_params,1.0/gl_FragCoord.w)); #endif #ifdef FOG shadow=mix(shadow,vec3(1.0),v_fog_opacity); #endif #ifdef INDICATOR_CUTOUT shadow=mix(shadow,vec3(1.0),1.0-applyCutout(vec4(1.0),0.0).r); #endif glFragColor=vec4(shadow,1.0);}`,`#include "_prelude_fog.vertex.glsl" uniform mat4 u_matrix;uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;in vec2 a_pos;out vec4 v_pos_light_view_0;out vec4 v_pos_light_view_1; #ifdef FOG out float v_fog_opacity; #endif void main() {gl_Position=u_matrix*vec4(a_pos,0.0,1.0);v_pos_light_view_0=u_light_matrix_0*vec4(a_pos,0.0,1.0);v_pos_light_view_1=u_light_matrix_1*vec4(a_pos,0.0,1.0); #ifdef FOG v_fog_pos=fog_position(a_pos);v_fog_opacity=fog(v_fog_pos); #endif }`),fillExtrusionGroundEffect:Xs(`uniform highp float u_ao_pass;uniform highp float u_opacity;uniform highp float u_flood_light_intensity;uniform highp vec3 u_flood_light_color;uniform highp float u_attenuation;uniform sampler2D u_fb;uniform float u_fb_size; #ifdef SDF_SUBPASS in highp vec2 v_pos;in highp vec4 v_line_segment;in highp float v_flood_light_radius_tile;in highp vec2 v_ao;float line_df(highp vec2 a,highp vec2 b,highp vec2 p) {highp vec2 ba=b-a;highp vec2 pa=p-a;highp float r=clamp(dot(pa,ba)/dot(ba,ba),0.0,1.0);return length(pa-r*ba);} #ifdef FOG in highp float v_fog; #endif #endif void main() { #ifdef CLEAR_SUBPASS vec4 color=vec4(1.0); #ifdef CLEAR_FROM_TEXTURE color=texture(u_fb,gl_FragCoord.xy/vec2(u_fb_size)); #endif glFragColor=color; #else #ifdef SDF_SUBPASS highp float d=line_df(v_line_segment.xy,v_line_segment.zw,v_pos);highp float effect_radius=mix(v_flood_light_radius_tile,v_ao.y,u_ao_pass);d/=effect_radius;d=min(d,1.0);d=1.0-pow(1.0-d,u_attenuation);highp float effect_intensity=mix(u_flood_light_intensity,v_ao.x,u_ao_pass);highp float fog=1.0; #ifdef FOG fog=v_fog; #endif #ifdef RENDER_CUTOFF fog*=v_cutoff_opacity; #endif glFragColor=vec4(vec3(0.0),mix(1.0,d,effect_intensity*u_opacity*fog)); #else #ifdef USE_MRT1 out_Target1=vec4(1.0-texture(u_fb,gl_FragCoord.xy/vec2(u_fb_size)).a,0.0,0.0,0.0); #else vec4 color=mix(vec4(u_flood_light_color,1.0),vec4(vec3(0.0),1.0),u_ao_pass); #ifdef OVERDRAW_INSPECTOR color=vec4(1.0); #endif glFragColor=color; #endif #endif HANDLE_WIREFRAME_DEBUG; #endif }`,`#include "_prelude_fog.vertex.glsl" in highp vec4 a_pos_end;in highp float a_angular_offset_factor;in highp float a_hidden_by_landmark; #ifdef SDF_SUBPASS out highp vec2 v_pos;out highp vec4 v_line_segment;out highp float v_flood_light_radius_tile;out highp vec2 v_ao; #ifdef FOG out highp float v_fog; #endif #endif uniform highp float u_flood_light_intensity;uniform highp mat4 u_matrix;uniform highp float u_ao_pass;uniform highp float u_meter_to_tile;uniform highp float u_edge_radius;uniform highp float u_dynamic_offset;uniform highp vec2 u_ao; #pragma mapbox: define highp float flood_light_ground_radius const float TANGENT_CUTOFF=4.0;const float NORM=32767.0;void main() { #pragma mapbox: initialize highp float flood_light_ground_radius vec2 p=a_pos_end.xy;vec2 q=floor(a_pos_end.zw*0.5);vec2 start_bottom=a_pos_end.zw-q*2.0;float fl_ground_radius=flood_light_ground_radius;fl_ground_radius=abs(flood_light_ground_radius);float direction=flood_light_ground_radius < 0.0 ?-1.0 : 1.0;float flood_radius_tile=fl_ground_radius*u_meter_to_tile;vec2 v=normalize(q-p);float ao_radius=u_ao.y/3.5;float effect_radius=mix(flood_radius_tile,ao_radius,u_ao_pass)+u_edge_radius;float angular_offset_factor=a_angular_offset_factor/NORM*TANGENT_CUTOFF;float angular_offset=direction*angular_offset_factor*effect_radius;float top=1.0-start_bottom.y;float side=(0.5-start_bottom.x)*2.0;vec2 extrusion_parallel=v*side*mix(u_dynamic_offset,angular_offset,top);vec2 perp=vec2(v.y,-v.x);vec2 extrusion_perp=direction*perp*effect_radius*top;vec3 pos=vec3(mix(q,p,start_bottom.x),0.0);pos.xy+=extrusion_parallel+extrusion_perp; #ifdef SDF_SUBPASS v_pos=pos.xy;v_line_segment=vec4(p,q)+perp.xyxy*u_edge_radius;v_flood_light_radius_tile=flood_radius_tile;v_ao=vec2(u_ao.x,ao_radius); #ifdef FOG v_fog_pos=fog_position(pos);v_fog=1.0-fog(v_fog_pos); #endif #endif float hidden_by_landmark=0.0; #ifdef HAS_CENTROID hidden_by_landmark=a_hidden_by_landmark; #endif float isFloodlit=float(fl_ground_radius > 0.0 && u_flood_light_intensity > 0.0);float hidden=mix(1.0-isFloodlit,isFloodlit,u_ao_pass);hidden+=hidden_by_landmark;gl_Position=mix(u_matrix*vec4(pos,1.0),AWAY,float(hidden > 0.0)); #ifdef RENDER_CUTOFF v_cutoff_opacity=cutoff_opacity(u_cutoff_params,gl_Position.z); #endif }`),hillshadePrepare:Xs(`precision highp float;uniform highp sampler2D u_image;in vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;float getElevation(vec2 coord) {return texture(u_image,coord).r/4.0;}void main() {vec2 epsilon=1.0/u_dimension;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y));float b=getElevation(v_pos+vec2(0,-epsilon.y));float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y));float d=getElevation(v_pos+vec2(-epsilon.x,0));float e=getElevation(v_pos+vec2(epsilon.x,0));float f=getElevation(v_pos+vec2(-epsilon.x,epsilon.y));float g=getElevation(v_pos+vec2(0,epsilon.y));float h=getElevation(v_pos+vec2(epsilon.x,epsilon.y));float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2( (c+e+e+h)-(a+d+d+f),(f+g+g+h)-(a+b+b+c) )/pow(2.0,exaggeration+(19.2562-u_zoom));glFragColor=clamp(vec4( deriv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0);}`,"uniform mat4 u_matrix;uniform vec2 u_dimension;in vec2 a_pos;in vec2 a_texture_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}"),hillshade:Xs(`#include "_prelude_fog.fragment.glsl" #include "_prelude_lighting.glsl" uniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent;uniform float u_emissive_strength;void main() {vec4 pixel=texture(u_image,v_pos);vec2 deriv=((pixel.rg*2.0)-1.0);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));float slope=atan(1.25*length(deriv)/scaleFactor);float aspect=deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);float intensity=u_light.x;float azimuth=u_light.y+PI;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadow,u_highlight,shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);glFragColor=accent_color*(1.0-shade_color.a)+shade_color; #ifdef LIGHTING_3D_MODE glFragColor=apply_lighting_with_emission_ground(glFragColor,u_emissive_strength); #endif #ifdef FOG glFragColor=fog_dither(fog_apply_premultiplied(glFragColor,v_fog_pos)); #endif #ifdef USE_MRT1 out_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a); #endif #ifdef OVERDRAW_INSPECTOR glFragColor=vec4(1.0); #endif HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" uniform mat4 u_matrix;in vec2 a_pos;in vec2 a_texture_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);v_pos=a_texture_pos/8192.0; #ifdef FOG v_fog_pos=fog_position(a_pos); #endif }`),line:Xs(`#include "_prelude_fog.fragment.glsl" #include "_prelude_lighting.glsl" #include "_prelude_shadow.fragment.glsl" uniform lowp float u_device_pixel_ratio;uniform highp float u_width_scale;uniform highp float u_floor_width_scale;uniform float u_alpha_discard_threshold;uniform highp vec2 u_trim_offset;uniform highp vec2 u_trim_fade_range;uniform lowp vec4 u_trim_color;in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;in highp vec3 v_uv; #ifdef ELEVATED_ROADS in highp float v_road_z_offset; #endif #ifdef RENDER_LINE_DASH uniform sampler2D u_dash_image;in vec2 v_tex; #endif #ifdef RENDER_LINE_GRADIENT uniform sampler2D u_gradient_image; #endif #ifdef INDICATOR_CUTOUT in highp float v_z_offset; #endif #ifdef RENDER_SHADOWS uniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth; #endif float luminance(vec3 c) {return (c.r+c.r+c.b+c.g+c.g+c.g)*0.1667;} #pragma mapbox: define highp vec4 color #pragma mapbox: define lowp float floorwidth #pragma mapbox: define lowp vec4 dash #pragma mapbox: define lowp float blur #pragma mapbox: define lowp float opacity #pragma mapbox: define mediump float side_z_offset #pragma mapbox: define lowp float border_width #pragma mapbox: define lowp vec4 border_color #pragma mapbox: define lowp float emissive_strength float linearstep(float edge0,float edge1,float x) {return clamp((x-edge0)/(edge1-edge0),0.0,1.0);}void main() { #pragma mapbox: initialize highp vec4 color #pragma mapbox: initialize lowp float floorwidth #pragma mapbox: initialize lowp vec4 dash #pragma mapbox: initialize lowp float blur #pragma mapbox: initialize lowp float opacity #pragma mapbox: initialize mediump float side_z_offset #pragma mapbox: initialize lowp float border_width #pragma mapbox: initialize lowp vec4 border_color #pragma mapbox: initialize lowp float emissive_strength float dist=length(v_normal)*v_width2.s;float blur2=(u_width_scale*blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);alpha=side_z_offset > 0.0 ? 1.0-alpha : alpha; #ifdef RENDER_LINE_DASH float sdfdist=texture(u_dash_image,v_tex).r;float sdfgamma=1.0/(2.0*u_device_pixel_ratio)/dash.z;float scaled_floorwidth=(floorwidth*u_floor_width_scale);alpha*=linearstep(0.5-sdfgamma/scaled_floorwidth,0.5+sdfgamma/scaled_floorwidth,sdfdist); #endif highp vec4 out_color; #ifdef RENDER_LINE_GRADIENT out_color=texture(u_gradient_image,v_uv.xy); #ifdef MULTIPLY_LINE_GRADIENT_COLOR out_color*=color; #endif #else out_color=color; #endif float trim_alpha=1.0; #ifdef RENDER_LINE_TRIM_OFFSET highp float trim_start=u_trim_offset[0];highp float trim_end=u_trim_offset[1];highp float line_progress=v_uv[2];if (trim_end > trim_start) {highp float start_transition=max(0.0,min(1.0,(line_progress-trim_start)/max(u_trim_fade_range[0],1.0e-9)));highp float end_transition=max(0.0,min(1.0,(trim_end-line_progress)/max(u_trim_fade_range[1],1.0e-9)));highp float transition_factor=min(start_transition,end_transition);out_color=mix(out_color,u_trim_color,transition_factor);trim_alpha=1.0-transition_factor;} #endif if (u_alpha_discard_threshold !=0.0) {if (alpha < u_alpha_discard_threshold) {discard;}} #ifdef RENDER_LINE_BORDER float edgeBlur=((border_width*u_width_scale)+1.0/u_device_pixel_ratio);float alpha2=clamp(min(dist-(v_width2.t-edgeBlur),v_width2.s-dist)/edgeBlur,0.0,1.0);if (alpha2 < 1.) {float smoothAlpha=smoothstep(0.6,1.0,alpha2);if (border_color.a==0.0) {float Y=(out_color.a > 0.01) ? luminance(out_color.rgb/out_color.a) : 1.;float adjustment=(Y > 0.) ? 0.5/Y : 0.45;if (out_color.a > 0.25 && Y < 0.25) {vec3 borderColor=(Y > 0.) ? out_color.rgb : vec3(1,1,1)*out_color.a;out_color.rgb=out_color.rgb+borderColor*(adjustment*(1.0-smoothAlpha));} else {out_color.rgb*=(0.6 +0.4*smoothAlpha);}} else {out_color=mix(border_color*trim_alpha,out_color,smoothAlpha);}} #endif #ifdef LIGHTING_3D_MODE out_color=apply_lighting_with_emission_ground(out_color,emissive_strength); #ifdef RENDER_SHADOWS float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth); #ifdef ELEVATED_ROADS out_color.rgb*=mix(v_road_z_offset !=0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light); #else out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light); #endif #endif #endif #ifdef FOG out_color=fog_dither(fog_apply_premultiplied(out_color,v_fog_pos)); #endif out_color*=(alpha*opacity); #ifdef INDICATOR_CUTOUT out_color=applyCutout(out_color,v_z_offset); #endif #ifdef FEATURE_CUTOUT out_color=apply_feature_cutout(out_color,gl_FragCoord); #endif glFragColor=out_color; #ifdef DUAL_SOURCE_BLENDING glFragColorSrc1=vec4(vec3(0.0),emissive_strength); #else #ifdef USE_MRT1 out_Target1=vec4(emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a); #endif #endif #ifdef OVERDRAW_INSPECTOR glFragColor=vec4(1.0); #endif HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" #include "_prelude_shadow.vertex.glsl" #include "_prelude_terrain.vertex.glsl" #define EXTRUDE_SCALE 0.015873016 in vec2 a_pos_normal;in vec4 a_data; #if defined(ELEVATED) || defined(ELEVATED_ROADS) || defined(VARIABLE_LINE_WIDTH) in vec3 a_z_offset_width; #endif #if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET) in highp vec3 a_packed; #endif #ifdef RENDER_LINE_DASH in float a_linesofar; #endif uniform mat4 u_matrix;uniform mat2 u_pixels_to_tile_units;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;uniform float u_width_scale;uniform highp float u_floor_width_scale; #ifdef ELEVATED uniform lowp float u_zbias_factor;uniform lowp float u_tile_to_meter;float sample_elevation(vec2 apos) { #ifdef ELEVATION_REFERENCE_SEA return 0.0; #else return elevation(apos); #endif } #endif out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp vec3 v_uv; #ifdef ELEVATED_ROADS out highp float v_road_z_offset; #endif #ifdef RENDER_LINE_DASH uniform vec2 u_texsize;uniform float u_tile_units_to_pixels;out vec2 v_tex; #endif #ifdef RENDER_LINE_GRADIENT uniform float u_image_height; #endif #ifdef INDICATOR_CUTOUT out highp float v_z_offset; #endif #ifdef RENDER_SHADOWS uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth; #endif #pragma mapbox: define highp vec4 color #pragma mapbox: define lowp float floorwidth #pragma mapbox: define lowp vec4 dash #pragma mapbox: define lowp float blur #pragma mapbox: define lowp float opacity #pragma mapbox: define mediump float gapwidth #pragma mapbox: define lowp float offset #pragma mapbox: define mediump float width #pragma mapbox: define mediump float side_z_offset #pragma mapbox: define lowp float border_width #pragma mapbox: define lowp vec4 border_color #pragma mapbox: define lowp float emissive_strength void main() { #pragma mapbox: initialize highp vec4 color #pragma mapbox: initialize lowp float floorwidth #pragma mapbox: initialize lowp vec4 dash #pragma mapbox: initialize lowp float blur #pragma mapbox: initialize lowp float opacity #pragma mapbox: initialize mediump float gapwidth #pragma mapbox: initialize lowp float offset #pragma mapbox: initialize mediump float width #pragma mapbox: initialize mediump float side_z_offset #pragma mapbox: initialize lowp float border_width #pragma mapbox: initialize lowp vec4 border_color #pragma mapbox: initialize lowp float emissive_strength float a_z_offset; #if defined(ELEVATED) || defined(ELEVATED_ROADS) a_z_offset=a_z_offset_width.x; #endif float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth; #ifdef VARIABLE_LINE_WIDTH bool left=normal.y==1.0;halfwidth=(u_width_scale*(left ? a_z_offset_width.y : a_z_offset_width.z))/2.0;a_z_offset+=left ? side_z_offset : 0.0;v_normal=side_z_offset > 0.0 && left ? vec2(0.0) : v_normal; #else halfwidth=(u_width_scale*width)/2.0; #endif offset=-1.0*offset*u_width_scale;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*EXTRUDE_SCALE;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*EXTRUDE_SCALE*normal.y*mat2(t,-u,u,t);float hidden=float(opacity==0.0);vec2 extrude=dist*u_pixels_to_tile_units;vec4 projected_extrude=u_matrix*vec4(extrude,0.0,0.0);vec2 projected_extrude_xy=projected_extrude.xy; #ifdef ELEVATED_ROADS v_road_z_offset=a_z_offset;gl_Position=u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,a_z_offset,1.0)+projected_extrude; #else #ifdef ELEVATED vec2 offsetTile=offset2*u_pixels_to_tile_units;vec2 offset_pos=pos+offsetTile;float ele=0.0; #ifdef CROSS_SLOPE_VERTICAL float top=a_pos_normal.y-2.0*floor(a_pos_normal.y*0.5);float line_height=2.0*u_tile_to_meter*outset*top*u_pixels_to_tile_units[1][1]+a_z_offset;ele=sample_elevation(offset_pos)+line_height;projected_extrude=vec4(0); #else #ifdef CROSS_SLOPE_HORIZONTAL float ele0=sample_elevation(offset_pos);float ele1=max(sample_elevation(offset_pos+extrude),sample_elevation(offset_pos+extrude/2.0));float ele2=max(sample_elevation(offset_pos-extrude),sample_elevation(offset_pos-extrude/2.0));float ele_max=max(ele0,max(ele1,ele2));ele=ele_max+a_z_offset; #else float ele0=sample_elevation(offset_pos);float ele1=max(sample_elevation(offset_pos+extrude),sample_elevation(offset_pos+extrude/2.0));float ele2=max(sample_elevation(offset_pos-extrude),sample_elevation(offset_pos-extrude/2.0));float ele_max=max(ele0,0.5*(ele1+ele2));ele=ele_max-ele0+ele1+a_z_offset; #endif #endif gl_Position=u_matrix*vec4(offset_pos,ele,1.0)+projected_extrude;float z=clamp(gl_Position.z/gl_Position.w,0.5,1.0);float zbias=max(0.00005,(pow(z,0.8)-z)*u_zbias_factor*u_exaggeration);gl_Position.z-=(gl_Position.w*zbias);gl_Position=mix(gl_Position,AWAY,hidden); #else gl_Position=mix(u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,0.0,1.0)+projected_extrude,AWAY,hidden); #endif #endif #ifdef ELEVATED_ROADS #ifdef RENDER_SHADOWS vec3 shd_pos=vec3(pos+(offset2+dist)*u_pixels_to_tile_units,a_z_offset);vec3 shd_pos0=shd_pos;vec3 shd_pos1=shd_pos; #ifdef NORMAL_OFFSET vec3 shd_pos_offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=shd_pos_offset*shadow_normal_offset_multiplier0();shd_pos1+=shd_pos_offset*shadow_normal_offset_multiplier1(); #endif v_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w; #endif #endif #ifndef RENDER_TO_TEXTURE float epsilon=0.0001;float extrude_length_without_perspective=max(length(dist),epsilon);float extrude_length_with_perspective=max(length(projected_extrude_xy/gl_Position.w*u_units_to_pixels),epsilon);v_gamma_scale=mix(extrude_length_without_perspective/extrude_length_with_perspective,1.0,step(0.01,blur)); #else v_gamma_scale=1.0; #endif #if defined(RENDER_LINE_GRADIENT) || defined(RENDER_LINE_TRIM_OFFSET) highp float a_uv_x=a_packed[0];float a_split_index=a_packed[1];highp float line_progress=a_packed[2]; #ifdef RENDER_LINE_GRADIENT highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec3(a_uv_x,a_split_index*texel_height-half_texel_height,line_progress); #else v_uv=vec3(a_uv_x,0.0,line_progress); #endif #endif #ifdef RENDER_LINE_DASH float scale=dash.z==0.0 ? 0.0 : u_tile_units_to_pixels/dash.z;float height=dash.y;v_tex=vec2(a_linesofar*scale/(floorwidth*u_floor_width_scale),(-normal.y*height+dash.x+0.5)/u_texsize.y); #endif v_width2=vec2(outset,inset); #ifdef FOG v_fog_pos=fog_position(pos); #endif #ifdef INDICATOR_CUTOUT v_z_offset=a_z_offset; #endif }`),linePattern:Xs(`#include "_prelude_fog.fragment.glsl" #include "_prelude_lighting.glsl" #include "_prelude_shadow.fragment.glsl" uniform highp float u_device_pixel_ratio;uniform highp float u_width_scale;uniform highp float u_alpha_discard_threshold;uniform highp vec2 u_texsize;uniform highp float u_tile_units_to_pixels;uniform highp vec2 u_trim_offset;uniform highp vec2 u_trim_fade_range;uniform lowp vec4 u_trim_color;uniform sampler2D u_image; #ifdef APPLY_LUT_ON_GPU uniform highp sampler3D u_lutTexture; #endif #ifdef LINE_PATTERN_TRANSITION uniform float u_pattern_transition; #endif in vec2 v_normal;in vec2 v_width2;in highp float v_linesofar;in float v_gamma_scale;in float v_width; #ifdef RENDER_LINE_TRIM_OFFSET in highp vec3 v_uv; #endif #ifdef ELEVATED_ROADS in highp float v_road_z_offset; #endif #ifdef LINE_JOIN_NONE in vec2 v_pattern_data; #endif #ifdef INDICATOR_CUTOUT in highp float v_z_offset; #endif #ifdef RENDER_SHADOWS uniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth; #endif #pragma mapbox: define mediump vec4 pattern #ifdef LINE_PATTERN_TRANSITION #pragma mapbox: define mediump vec4 pattern_b #endif #pragma mapbox: define mediump float pixel_ratio #pragma mapbox: define mediump float blur #pragma mapbox: define mediump float opacity #pragma mapbox: define lowp float emissive_strength void main() { #pragma mapbox: initialize mediump vec4 pattern #ifdef LINE_PATTERN_TRANSITION #pragma mapbox: initialize mediump vec4 pattern_b #endif #pragma mapbox: initialize mediump float pixel_ratio #pragma mapbox: initialize mediump float blur #pragma mapbox: initialize mediump float opacity #pragma mapbox: initialize lowp float emissive_strength vec2 pattern_tl=pattern.xy;vec2 pattern_br=pattern.zw;vec2 display_size=(pattern_br-pattern_tl)/pixel_ratio;highp float pattern_size=display_size.x/u_tile_units_to_pixels;float aspect=display_size.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(u_width_scale*blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);highp float pattern_x=v_linesofar/pattern_size*aspect;highp float x=mod(pattern_x,1.0);highp float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;highp vec2 pos=mix(pattern_tl*texel_size-texel_size,pattern_br*texel_size+texel_size,vec2(x,y));highp vec2 lod_pos=mix(pattern_tl*texel_size-texel_size,pattern_br*texel_size+texel_size,vec2(pattern_x,y));vec4 color=textureLodCustom(u_image,pos,lod_pos); #ifdef APPLY_LUT_ON_GPU color=applyLUT(u_lutTexture,color); #endif #ifdef LINE_PATTERN_TRANSITION vec2 pattern_b_tl=pattern_b.xy;vec2 pattern_b_br=pattern_b.zw;highp vec2 pos_b=mix(pattern_b_tl*texel_size-texel_size,pattern_b_br*texel_size+texel_size,vec2(x,y));vec4 color_b=textureLodCustom(u_image,pos_b,lod_pos);color=color*(1.0-u_pattern_transition)+color_b*u_pattern_transition; #endif #ifdef RENDER_LINE_TRIM_OFFSET highp float trim_start=u_trim_offset[0];highp float trim_end=u_trim_offset[1];highp float line_progress=v_uv[2];if (trim_end > trim_start) {highp float start_transition=max(0.0,min(1.0,(line_progress-trim_start)/max(u_trim_fade_range[0],1.0e-9)));highp float end_transition=max(0.0,min(1.0,(trim_end-line_progress)/max(u_trim_fade_range[1],1.0e-9)));highp float transition_factor=min(start_transition,end_transition);color=mix(color,color.a*u_trim_color,transition_factor);} #endif #ifdef LINE_JOIN_NONE highp float pattern_len=pattern_size/aspect;highp float segment_phase=pattern_len-mod(v_linesofar-v_pattern_data.x+pattern_len,pattern_len);highp float visible_start=segment_phase-step(pattern_len*0.5,segment_phase)*pattern_len;highp float visible_end=floor((v_pattern_data.y-segment_phase)/pattern_len)*pattern_len+segment_phase;visible_end+=step(pattern_len*0.5,v_pattern_data.y-visible_end)*pattern_len;if (v_pattern_data.x < visible_start || v_pattern_data.x >=visible_end) {color=vec4(0.0);} #endif #ifdef LIGHTING_3D_MODE color=apply_lighting_with_emission_ground(color,emissive_strength); #ifdef RENDER_SHADOWS float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth); #ifdef ELEVATED_ROADS color.rgb*=mix(v_road_z_offset !=0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light); #else color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light); #endif #endif #endif #ifdef FOG color=fog_dither(fog_apply_premultiplied(color,v_fog_pos)); #endif color*=(alpha*opacity);if (u_alpha_discard_threshold !=0.0) {if (color.a < u_alpha_discard_threshold) {discard;}} #ifdef INDICATOR_CUTOUT color=applyCutout(color,v_z_offset); #endif glFragColor=color; #ifdef DUAL_SOURCE_BLENDING glFragColorSrc1=vec4(vec3(0.0),emissive_strength); #else #ifdef USE_MRT1 out_Target1=vec4(emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a); #endif #endif #ifdef OVERDRAW_INSPECTOR glFragColor=vec4(1.0); #endif HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" #include "_prelude_shadow.vertex.glsl" #include "_prelude_terrain.vertex.glsl" #define scale 0.015873016 in vec2 a_pos_normal;in vec4 a_data; #if defined(ELEVATED) || defined(ELEVATED_ROADS) in vec3 a_z_offset_width; #endif #ifdef RENDER_LINE_TRIM_OFFSET in highp vec3 a_packed; #endif in highp float a_linesofar; #ifdef LINE_JOIN_NONE in highp vec3 a_pattern_data;out vec2 v_pattern_data; #endif #ifdef INDICATOR_CUTOUT out highp float v_z_offset; #endif uniform mat4 u_matrix;uniform float u_tile_units_to_pixels;uniform vec2 u_units_to_pixels;uniform mat2 u_pixels_to_tile_units;uniform float u_device_pixel_ratio;uniform float u_width_scale;uniform float u_floor_width_scale; #ifdef ELEVATED uniform lowp float u_zbias_factor;uniform lowp float u_tile_to_meter;float sample_elevation(vec2 apos) { #ifdef ELEVATION_REFERENCE_SEA return 0.0; #else return elevation(apos); #endif } #endif out vec2 v_normal;out vec2 v_width2;out highp float v_linesofar;out float v_gamma_scale;out float v_width; #ifdef RENDER_LINE_TRIM_OFFSET out highp vec3 v_uv; #endif #ifdef ELEVATED_ROADS out highp float v_road_z_offset; #endif #ifdef RENDER_SHADOWS uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth; #endif #pragma mapbox: define mediump float blur #pragma mapbox: define mediump float opacity #pragma mapbox: define mediump float offset #pragma mapbox: define mediump float gapwidth #pragma mapbox: define mediump float width #pragma mapbox: define mediump float floorwidth #pragma mapbox: define mediump vec4 pattern #ifdef LINE_PATTERN_TRANSITION #pragma mapbox: define mediump vec4 pattern_b #endif #pragma mapbox: define mediump float pixel_ratio #pragma mapbox: define lowp float emissive_strength void main() { #pragma mapbox: initialize mediump float blur #pragma mapbox: initialize mediump float opacity #pragma mapbox: initialize mediump float offset #pragma mapbox: initialize mediump float gapwidth #pragma mapbox: initialize mediump float width #pragma mapbox: initialize mediump float floorwidth #pragma mapbox: initialize mediump vec4 pattern #ifdef LINE_PATTERN_TRANSITION #pragma mapbox: initialize mediump vec4 pattern_b #endif #pragma mapbox: initialize mediump float pixel_ratio #pragma mapbox: initialize lowp float emissive_strength float a_z_offset; #if defined(ELEVATED) || defined(ELEVATED_ROADS) a_z_offset=a_z_offset_width.x; #endif float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;vec2 pos=floor(a_pos_normal*0.5);vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=(u_width_scale*width)/2.0;offset=-1.0*offset*u_width_scale;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);vec2 dist=outset*a_extrude*scale;float u=0.5*a_direction;float t=1.0-abs(u);vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float hidden=float(opacity==0.0);vec2 extrude=dist*u_pixels_to_tile_units;vec4 projected_extrude=u_matrix*vec4(extrude,0.0,0.0);vec2 projected_extrude_xy=projected_extrude.xy; #ifdef ELEVATED_ROADS v_road_z_offset=a_z_offset;gl_Position=u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,a_z_offset,1.0)+projected_extrude; #else #ifdef ELEVATED vec2 offsetTile=offset2*u_pixels_to_tile_units;vec2 offset_pos=pos+offsetTile;float ele=0.0; #ifdef CROSS_SLOPE_VERTICAL float top=a_pos_normal.y-2.0*floor(a_pos_normal.y*0.5);float line_height=2.0*u_tile_to_meter*outset*top*u_pixels_to_tile_units[1][1]+a_z_offset;ele=sample_elevation(offset_pos)+line_height;projected_extrude=vec4(0); #else #ifdef CROSS_SLOPE_HORIZONTAL float ele0=sample_elevation(offset_pos);float ele1=max(sample_elevation(offset_pos+extrude),sample_elevation(offset_pos+extrude/2.0));float ele2=max(sample_elevation(offset_pos-extrude),sample_elevation(offset_pos-extrude/2.0));float ele_max=max(ele0,max(ele1,ele2));ele=ele_max+a_z_offset; #else float ele0=sample_elevation(offset_pos);float ele1=max(sample_elevation(offset_pos+extrude),sample_elevation(offset_pos+extrude/2.0));float ele2=max(sample_elevation(offset_pos-extrude),sample_elevation(offset_pos-extrude/2.0));float ele_max=max(ele0,0.5*(ele1+ele2));ele=ele_max-ele0+ele1+a_z_offset; #endif #endif gl_Position=u_matrix*vec4(offset_pos,ele,1.0)+projected_extrude;float z=clamp(gl_Position.z/gl_Position.w,0.5,1.0);float zbias=max(0.00005,(pow(z,0.8)-z)*u_zbias_factor*u_exaggeration);gl_Position.z-=(gl_Position.w*zbias);gl_Position=mix(gl_Position,AWAY,hidden); #else gl_Position=mix(u_matrix*vec4(pos+offset2*u_pixels_to_tile_units,0.0,1.0)+projected_extrude,AWAY,hidden); #endif #endif #ifdef ELEVATED_ROADS #ifdef RENDER_SHADOWS vec3 shd_pos=vec3(pos+(offset2+dist)*u_pixels_to_tile_units,a_z_offset);vec3 shd_pos0=shd_pos;vec3 shd_pos1=shd_pos; #ifdef NORMAL_OFFSET vec3 shd_pos_offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=shd_pos_offset*shadow_normal_offset_multiplier0();shd_pos1+=shd_pos_offset*shadow_normal_offset_multiplier1(); #endif v_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w; #endif #endif #ifndef RENDER_TO_TEXTURE float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length(projected_extrude_xy/gl_Position.w*u_units_to_pixels);v_gamma_scale=mix(extrude_length_without_perspective/extrude_length_with_perspective,1.0,step(0.01,blur)); #else v_gamma_scale=1.0; #endif #ifdef RENDER_LINE_TRIM_OFFSET highp float a_uv_x=a_packed[0];highp float line_progress=a_packed[2];v_uv=vec3(a_uv_x,0.0,line_progress); #endif v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=(floorwidth*u_floor_width_scale); #ifdef LINE_JOIN_NONE v_width=(floorwidth*u_floor_width_scale)+ANTIALIASING;mediump float pixels_to_tile_units=1.0/u_tile_units_to_pixels;mediump float pixel_ratio_inverse=1.0/pixel_ratio;mediump float aspect=v_width/((pattern.w-pattern.y)*pixel_ratio_inverse);highp float subt_multiple=(pattern.z-pattern.x)*pixel_ratio_inverse*pixels_to_tile_units*aspect*32.0;highp float subt=floor(a_pattern_data.z/subt_multiple)*subt_multiple;float offset_sign=(fract(a_pattern_data.x)-0.5)*4.0;float line_progress_offset=offset_sign*v_width*0.5*pixels_to_tile_units;v_linesofar=(a_pattern_data.z-subt)+a_linesofar+line_progress_offset;v_pattern_data=vec2(a_pattern_data.x+line_progress_offset,a_pattern_data.y); #endif #ifdef FOG v_fog_pos=fog_position(pos); #endif #ifdef INDICATOR_CUTOUT v_z_offset=a_z_offset; #endif }`),raster:Xs(`#include "_prelude_fog.fragment.glsl" #include "_prelude_lighting.glsl" #include "_prelude_raster_array.glsl" uniform float u_fade_t;uniform float u_opacity;uniform highp float u_raster_elevation;uniform highp float u_zoom_transition;in vec2 v_pos0;in vec2 v_pos1;in float v_depth; #ifdef PROJECTION_GLOBE_VIEW in float v_split_fade; #endif uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;uniform float u_emissive_strength; #ifndef RASTER_ARRAY uniform highp sampler2D u_image0;uniform sampler2D u_image1; #endif #ifdef RASTER_COLOR uniform sampler2D u_color_ramp;uniform highp vec4 u_colorization_mix;uniform highp float u_colorization_offset;uniform vec2 u_texture_res; #endif void main() {vec4 color0,color1,color;vec2 value; #ifdef RASTER_COLOR #ifdef RASTER_ARRAY #ifdef RASTER_ARRAY_LINEAR value=mix( raTexture2D_image0_linear(v_pos0,u_texture_res,u_colorization_mix,u_colorization_offset),raTexture2D_image1_linear(v_pos1,u_texture_res,u_colorization_mix,u_colorization_offset),u_fade_t ); #else value=mix( raTexture2D_image0_nearest(v_pos0,u_texture_res,u_colorization_mix,u_colorization_offset),raTexture2D_image1_nearest(v_pos1,u_texture_res,u_colorization_mix,u_colorization_offset),u_fade_t ); #endif if (value.y > 0.0) value.x/=value.y; #else color=mix(texture(u_image0,v_pos0),texture(u_image1,v_pos1),u_fade_t);value=vec2(u_colorization_offset+dot(color.rgb,u_colorization_mix.rgb),color.a); #endif color=texture(u_color_ramp,vec2(value.x,0.5));if (color.a > 0.0) color.rgb/=color.a;color.a*=value.y; #else color0=texture(u_image0,v_pos0);color1=texture(u_image1,v_pos1);if (color0.a > 0.0) color0.rgb/=color0.a;if (color1.a > 0.0) color1.rgb/=color1.a;color=mix(color0,color1,u_fade_t); #endif color.a*=u_opacity; #ifdef GLOBE_POLES color.a*=1.0-smoothstep(0.0,0.05,u_zoom_transition); #endif vec3 rgb=color.rgb;rgb=vec3( dot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);vec3 out_color=mix(u_high_vec,u_low_vec,rgb); #ifdef LIGHTING_3D_MODE out_color=apply_lighting_with_emission_ground(vec4(out_color,1.0),u_emissive_strength).rgb; #endif #ifdef FOG highp float fog_limit_high_meters=1000000.0;highp float fog_limit_low_meters=600000.0;float fog_limit=1.0-smoothstep(fog_limit_low_meters,fog_limit_high_meters,u_raster_elevation);out_color=fog_dither(fog_apply(out_color,v_fog_pos,fog_limit)); #endif glFragColor=vec4(out_color*color.a,color.a); #ifdef PROJECTION_GLOBE_VIEW glFragColor*=mix(1.0,1.0-smoothstep(0.0,0.05,u_zoom_transition),smoothstep(0.8,0.9,v_split_fade)); #endif #ifdef RENDER_CUTOFF glFragColor=glFragColor*cutoff_opacity(u_cutoff_params,v_depth); #endif #ifdef OVERDRAW_INSPECTOR glFragColor=vec4(1.0); #endif #ifdef USE_MRT1 out_Target1=vec4(u_emissive_strength*glFragColor.a,0.0,0.0,glFragColor.a); #endif HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" uniform mat4 u_matrix;uniform mat4 u_normalize_matrix;uniform mat4 u_globe_matrix;uniform mat4 u_merc_matrix;uniform mat3 u_grid_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform vec2 u_perspective_transform;uniform vec2 u_texture_offset;uniform float u_raster_elevation;uniform float u_zoom_transition;uniform vec2 u_merc_center; #define GLOBE_UPSCALE GLOBE_RADIUS/6371008.8 #ifdef GLOBE_POLES in vec3 a_globe_pos;in vec2 a_uv; #else in vec2 a_pos;in vec2 a_texture_pos; #endif out vec2 v_pos0;out vec2 v_pos1;out float v_depth; #ifdef PROJECTION_GLOBE_VIEW out float v_split_fade; #endif void main() {vec2 uv; #ifdef GLOBE_POLES vec3 globe_pos=a_globe_pos;globe_pos+=normalize(globe_pos)*u_raster_elevation*GLOBE_UPSCALE;gl_Position=u_matrix*u_globe_matrix*vec4(globe_pos ,1.0);uv=a_uv; #ifdef FOG v_fog_pos=fog_position((u_normalize_matrix*vec4(a_globe_pos,1.0)).xyz); #endif #else float w=1.0+dot(a_texture_pos,u_perspective_transform);uv=a_texture_pos/8192.0; #ifdef PROJECTION_GLOBE_VIEW vec3 decomposed_pos_and_skirt=decomposeToPosAndSkirt(a_pos);vec3 latLng=u_grid_matrix*vec3(decomposed_pos_and_skirt.xy,1.0);vec3 globe_pos=latLngToECEF(latLng.xy);globe_pos+=normalize(globe_pos)*u_raster_elevation*GLOBE_UPSCALE;vec4 globe_world_pos=u_globe_matrix*vec4(globe_pos,1.0);vec4 merc_world_pos=vec4(0.0);float mercatorY=mercatorYfromLat(latLng[0]);float mercatorX=mercatorXfromLng(latLng[1]); v_split_fade=0.0;if (u_zoom_transition > 0.0) {vec2 merc_pos=vec2(mercatorX,mercatorY);merc_world_pos=vec4(merc_pos,u_raster_elevation,1.0);merc_world_pos.xy-=u_merc_center;merc_world_pos.x=wrap(merc_world_pos.x,-0.5,0.5);merc_world_pos=u_merc_matrix*merc_world_pos;float opposite_merc_center=mod(u_merc_center.x+0.5,1.0);float dist_from_poles=(abs(mercatorY-0.5)*2.0);float range=0.1;v_split_fade=abs(opposite_merc_center-mercatorX);v_split_fade=clamp(1.0-v_split_fade,0.0,1.0);v_split_fade=max(smoothstep(1.0-range,1.0,dist_from_poles),max(smoothstep(1.0-range,1.0,v_split_fade),smoothstep(1.0-range,1.0,1.0-v_split_fade)));}float tiles=u_grid_matrix[0][2];if (tiles > 0.0) {float idx=u_grid_matrix[1][2];float idy=u_grid_matrix[2][2];float uvY=mercatorY*tiles-idy;float uvX=mercatorX*tiles-idx;uv=vec2(uvX,uvY);}vec4 interpolated_pos=vec4(mix(globe_world_pos.xyz,merc_world_pos.xyz,u_zoom_transition)*w,w);gl_Position=u_matrix*interpolated_pos; #ifdef FOG v_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz); #endif #else gl_Position=u_matrix*vec4(a_pos*w,u_raster_elevation*w,w); #ifdef FOG v_fog_pos=fog_position(a_pos); #endif #endif #endif v_pos0=uv;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;v_pos0=u_texture_offset.x+u_texture_offset.y*v_pos0;v_pos1=u_texture_offset.x+u_texture_offset.y*v_pos1; #ifdef RENDER_CUTOFF v_depth=gl_Position.z; #endif }`),rasterParticle:Xs(`#include "_prelude_fog.fragment.glsl" #include "_prelude_lighting.glsl" uniform float u_fade_t;uniform float u_opacity;uniform highp float u_raster_elevation;in vec2 v_pos0;in vec2 v_pos1;uniform sampler2D u_image0;uniform sampler2D u_image1;void main() {vec4 color0,color1,color;color0=texture(u_image0,v_pos0);color1=texture(u_image1,v_pos1);if (color0.a > 0.0) color0.rgb/=color0.a;if (color1.a > 0.0) color1.rgb/=color1.a;color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 out_color=color.rgb; #ifdef LIGHTING_3D_MODE out_color=apply_lighting_with_emission_ground(vec4(out_color,1.0),1.0).rgb; #endif #ifdef FOG highp float fog_limit_high_meters=1000000.0;highp float fog_limit_low_meters=600000.0;float fog_limit=1.0-smoothstep(fog_limit_low_meters,fog_limit_high_meters,u_raster_elevation);out_color=fog_dither(fog_apply(out_color,v_fog_pos,fog_limit)); #endif glFragColor=vec4(out_color*color.a,color.a); #ifdef OVERDRAW_INSPECTOR glFragColor=vec4(1.0); #endif HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" uniform mat4 u_matrix;uniform mat4 u_normalize_matrix;uniform mat4 u_globe_matrix;uniform mat4 u_merc_matrix;uniform mat3 u_grid_matrix;uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_raster_elevation;uniform float u_zoom_transition;uniform vec2 u_merc_center; #define GLOBE_UPSCALE GLOBE_RADIUS/6371008.8 in vec2 a_pos;in vec2 a_texture_pos;out vec2 v_pos0;out vec2 v_pos1;void main() {float w=1.0;vec2 uv; #ifdef PROJECTION_GLOBE_VIEW vec3 decomposed_pos_and_skirt=decomposeToPosAndSkirt(a_pos);vec3 latLng=u_grid_matrix*vec3(decomposed_pos_and_skirt.xy,1.0);float mercatorY=mercatorYfromLat(latLng[0]);float mercatorX=mercatorXfromLng(latLng[1]);float tiles=u_grid_matrix[0][2];float idx=u_grid_matrix[1][2];float idy=u_grid_matrix[2][2];float uvX=mercatorX*tiles-idx;float uvY=mercatorY*tiles-idy;uv=vec2(uvX,uvY);vec3 globe_pos=latLngToECEF(latLng.xy);globe_pos+=normalize(globe_pos)*u_raster_elevation*GLOBE_UPSCALE;vec4 globe_world_pos=u_globe_matrix*vec4(globe_pos,1.0);vec4 merc_world_pos=vec4(0.0);if (u_zoom_transition > 0.0) {vec2 merc_pos=vec2(mercatorX,mercatorY);merc_world_pos=vec4(merc_pos,u_raster_elevation,1.0);merc_world_pos.xy-=u_merc_center;merc_world_pos.x=wrap(merc_world_pos.x,-0.5,0.5);merc_world_pos=u_merc_matrix*merc_world_pos;}vec4 interpolated_pos=vec4(mix(globe_world_pos.xyz,merc_world_pos.xyz,u_zoom_transition)*w,w);gl_Position=u_matrix*interpolated_pos; #ifdef FOG v_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz); #endif #else uv=a_texture_pos/8192.0;gl_Position=u_matrix*vec4(a_pos*w,u_raster_elevation*w,w); #ifdef FOG v_fog_pos=fog_position(a_pos); #endif #endif v_pos0=uv;v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}`),rasterParticleDraw:Xs("uniform sampler2D u_color_ramp;in float v_particle_speed;void main() {glFragColor=texture(u_color_ramp,vec2(v_particle_speed,0.5));}",`#include "_prelude_raster_particle.glsl" in float a_index;uniform sampler2D u_particle_texture;uniform float u_particle_texture_side_len;uniform vec2 u_tile_offset;out float v_particle_speed;void main() {ivec2 pixel_coord=ivec2( mod(a_index,u_particle_texture_side_len),a_index/u_particle_texture_side_len);vec4 pixel=texelFetch(u_particle_texture,pixel_coord,0);vec2 pos=unpack_pos_from_rgba(pixel)+u_tile_offset;vec2 tex_coord=fract(pos);vec2 velocity=lookup_velocity(tex_coord);if (velocity==INVALID_VELOCITY) {gl_Position=AWAY;v_particle_speed=0.0;} else {gl_Position=vec4(2.0*pos-1.0,0,1);v_particle_speed=length(velocity);}gl_PointSize=1.0;}`),rasterParticleTexture:Xs("uniform sampler2D u_texture;uniform float u_opacity;in vec2 v_tex_pos;void main() {vec4 color=texture(u_texture,v_tex_pos);glFragColor=vec4(floor(255.0*color*u_opacity)/255.0);}","in vec2 a_pos;out vec2 v_tex_pos;void main() {vec2 uv=0.5*a_pos+vec2(0.5);v_tex_pos=uv;gl_Position=vec4(a_pos,0.0,1.0);}"),rasterParticleUpdate:Xs(`#include "_prelude_raster_particle.glsl" uniform sampler2D u_particle_texture;uniform mediump float u_particle_texture_side_len;uniform mediump float u_speed_factor;uniform highp float u_reset_rate;uniform highp float u_rand_seed;in highp vec2 v_tex_coord;vec2 linearstep(vec2 edge0,vec2 edge1,vec2 x) {return clamp((x-edge0)/(edge1-edge0),vec2(0),vec2(1));}const highp vec3 rand_constants=vec3(12.9898,78.233,4375.85453);highp float rand(const highp vec2 co) {highp float t=dot(rand_constants.xy,co);return fract(sin(t)*(rand_constants.z+t));}void main() {ivec2 pixel_coord=ivec2(v_tex_coord*u_particle_texture_side_len);highp vec4 pixel=texelFetch(u_particle_texture,pixel_coord,0);highp vec2 pos=unpack_pos_from_rgba(pixel);highp vec2 velocity=lookup_velocity(clamp(pos,0.0,1.0));highp vec2 dp=velocity==INVALID_VELOCITY ? vec2(0) : velocity*u_speed_factor;pos=pos+dp;highp vec2 seed=(pos+v_tex_coord)*u_rand_seed;highp vec2 random_pos=vec2(rand(seed+1.3),rand(seed+2.1));highp vec2 persist_rate=pow( linearstep(vec2(-u_particle_pos_offset),vec2(0),pos)*linearstep(vec2(1.0+u_particle_pos_offset),vec2(1),pos),vec2(4) );highp vec2 per_frame_persist=pow(persist_rate,abs(dp)/u_particle_pos_offset);highp float drop_rate=1.0-per_frame_persist.x*per_frame_persist.y;drop_rate=any(greaterThanEqual(abs(pos-0.5),vec2(0.5+u_particle_pos_offset))) ? 1.0 : drop_rate;highp float drop=step(1.0-drop_rate-u_reset_rate,rand(seed));highp vec2 next_pos=mix(pos,random_pos,drop);glFragColor=pack_pos_to_rgba(next_pos);}`,"in vec2 a_pos;out vec2 v_tex_coord;void main() {v_tex_coord=0.5*(a_pos+vec2(1.0));gl_Position=vec4(a_pos,0.0,1.0);}"),symbol:Xs(`#include "_prelude_lighting.glsl" #include "_prelude_shadow.fragment.glsl" #define SDF_PX 8.0 #define SDF 1.0 #define ICON 0.0 uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;uniform bool u_is_halo;uniform lowp float u_scale_factor; #ifdef ICON_TRANSITION uniform float u_icon_transition; #endif #ifdef COLOR_ADJUSTMENT uniform mat4 u_color_adj_mat; #endif #ifdef INDICATOR_CUTOUT in highp float v_z_offset; #else #ifdef RENDER_SHADOWS in highp float v_z_offset; #endif #endif in vec2 v_tex_a; #ifdef ICON_TRANSITION in vec2 v_tex_b; #endif in float v_draw_halo;in vec3 v_gamma_scale_size_fade_opacity; #ifdef RENDER_TEXT_AND_SYMBOL in float is_sdf;in vec2 v_tex_a_icon; #endif #ifdef RENDER_SHADOWS uniform vec3 u_ground_shadow_factor;in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in highp float v_depth; #endif #ifdef APPLY_LUT_ON_GPU uniform highp sampler3D u_lutTexture; #endif #pragma mapbox: define highp vec4 fill_color #pragma mapbox: define highp vec4 halo_color #pragma mapbox: define lowp float opacity #pragma mapbox: define lowp float halo_width #pragma mapbox: define lowp float halo_blur #pragma mapbox: define lowp float emissive_strength void main() { #pragma mapbox: initialize highp vec4 fill_color #pragma mapbox: initialize highp vec4 halo_color #pragma mapbox: initialize lowp float opacity #pragma mapbox: initialize lowp float halo_width #pragma mapbox: initialize lowp float halo_blur #pragma mapbox: initialize lowp float emissive_strength vec4 out_color;float fade_opacity=v_gamma_scale_size_fade_opacity[2]; #ifdef RENDER_TEXT_AND_SYMBOL if (is_sdf==ICON) {vec2 tex_icon=v_tex_a_icon;lowp float alpha=opacity*fade_opacity;glFragColor=texture(u_texture_icon,tex_icon)*alpha; #ifdef OVERDRAW_INSPECTOR glFragColor=vec4(1.0); #endif return;} #endif #ifdef RENDER_SDF float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_gamma_scale_size_fade_opacity.x;float size=v_gamma_scale_size_fade_opacity.y;float fontScale=u_is_text ? size/24.0 : size;out_color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;bool draw_halo=v_draw_halo > 0.0;if (draw_halo) {out_color=halo_color;gamma=(halo_blur*u_scale_factor*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width*u_scale_factor/fontScale)/SDF_PX;}lowp float dist=texture(u_texture,v_tex_a).r;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);out_color*=alpha; #else #ifdef ICON_TRANSITION vec4 a=texture(u_texture,v_tex_a)*(1.0-u_icon_transition);vec4 b=texture(u_texture,v_tex_b)*u_icon_transition;out_color=(a+b); #else out_color=texture(u_texture,v_tex_a); #endif #ifdef APPLY_LUT_ON_GPU out_color=applyLUT(u_lutTexture,out_color); #endif #ifdef COLOR_ADJUSTMENT out_color=u_color_adj_mat*out_color; #endif #endif out_color*=opacity*fade_opacity; #ifdef LIGHTING_3D_MODE out_color=apply_lighting_with_emission_ground(out_color,emissive_strength); #ifdef RENDER_SHADOWS float light=shadowed_light_factor(v_pos_light_view_0,v_pos_light_view_1,v_depth); #ifdef TERRAIN out_color.rgb*=mix(u_ground_shadow_factor,vec3(1.0),light); #else out_color.rgb*=mix(v_z_offset !=0.0 ? u_ground_shadow_factor : vec3(1.0),vec3(1.0),light); #endif #endif #endif #ifdef INDICATOR_CUTOUT out_color=applyCutout(out_color,v_z_offset); #endif #ifdef FEATURE_CUTOUT out_color=apply_feature_cutout(out_color,gl_FragCoord); #endif glFragColor=out_color; #ifdef OVERDRAW_INSPECTOR glFragColor=vec4(1.0); #endif HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_terrain.vertex.glsl" #include "_prelude_shadow.vertex.glsl" #define APPEARANCE_ICON 1.0 in vec4 a_pos_offset;in vec4 a_tex_size;in vec4 a_pixeloffset;in vec4 a_projected_pos;in float a_fade_opacity; #ifdef Z_OFFSET in float a_auto_z_offset; #endif #ifdef PROJECTION_GLOBE_VIEW in vec3 a_globe_anchor;in vec3 a_globe_normal; #endif #ifdef ICON_TRANSITION in vec2 a_texb; #endif #ifdef OCCLUSION_QUERIES in float a_occlusion_query_opacity; #endif #ifdef ELEVATED_ROADS in vec3 a_x_axis;in vec3 a_y_axis;uniform float u_normal_scale; #endif #ifdef INDICATOR_CUTOUT out highp float v_z_offset; #else #ifdef RENDER_SHADOWS out highp float v_z_offset; #endif #endif uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_matrix;uniform mat4 u_inv_matrix;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_elevation_from_sea;uniform bool u_pitch_with_map;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec3 u_up_vector;uniform vec2 u_texsize_icon;uniform bool u_is_halo; #ifdef PROJECTION_GLOBE_VIEW uniform vec3 u_tile_id;uniform mat4 u_inv_rot_matrix;uniform vec2 u_merc_center;uniform vec3 u_camera_forward;uniform float u_zoom_transition;uniform vec3 u_ecef_origin;uniform mat4 u_tile_matrix; #endif out vec2 v_tex_a; #ifdef ICON_TRANSITION out vec2 v_tex_b; #endif out float v_draw_halo;out vec3 v_gamma_scale_size_fade_opacity; #ifdef RENDER_TEXT_AND_SYMBOL out float is_sdf;out vec2 v_tex_a_icon; #endif #ifdef RENDER_SHADOWS uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out highp float v_depth; #endif #pragma mapbox: define highp vec4 fill_color #pragma mapbox: define highp vec4 halo_color #pragma mapbox: define lowp float opacity #pragma mapbox: define lowp float halo_width #pragma mapbox: define lowp float halo_blur #pragma mapbox: define lowp float emissive_strength #pragma mapbox: define lowp float occlusion_opacity #pragma mapbox: define lowp float z_offset void main() { #pragma mapbox: initialize highp vec4 fill_color #pragma mapbox: initialize highp vec4 halo_color #pragma mapbox: initialize lowp float opacity #pragma mapbox: initialize lowp float halo_width #pragma mapbox: initialize lowp float halo_blur #pragma mapbox: initialize lowp float emissive_strength #pragma mapbox: initialize lowp float occlusion_opacity #pragma mapbox: initialize lowp float z_offset vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_tex_size.xy;vec2 a_size=a_tex_size.zw;float a_size_min=floor(a_size[0]*0.5);float a_size_max= floor(a_size[1]*0.5);float a_apperance_icon=a_size[1]-2.0*a_size_max;vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_min_font_scale=a_pixeloffset.zw/256.0;highp float segment_angle=-a_projected_pos[3];float size;if (a_apperance_icon==APPEARANCE_ICON) {size=a_size_max/128.0;} else if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size_max,u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 tile_anchor=a_pos;float e=u_elevation_from_sea ? z_offset : z_offset+elevation(tile_anchor); #ifdef Z_OFFSET e+=a_auto_z_offset; #endif vec3 h=elevationVector(tile_anchor)*e;float globe_occlusion_fade;vec3 world_pos;vec3 mercator_pos;vec3 world_pos_globe; #ifdef PROJECTION_GLOBE_VIEW mercator_pos=mercator_tile_position(u_inv_rot_matrix,tile_anchor,u_tile_id,u_merc_center);world_pos_globe=a_globe_anchor+h;world_pos=mix_globe_mercator(world_pos_globe,mercator_pos,u_zoom_transition);vec4 ecef_point=u_tile_matrix*vec4(world_pos,1.0);vec3 origin_to_point=ecef_point.xyz-u_ecef_origin;globe_occlusion_fade=dot(origin_to_point,u_camera_forward) >=0.0 ? 0.0 : 1.0; #else world_pos=vec3(tile_anchor,0)+h;globe_occlusion_fade=1.0; #endif vec4 projected_point=u_matrix*vec4(world_pos,1);highp float camera_to_anchor_distance=projected_point.w;highp float distance_ratio=u_pitch_with_map ? camera_to_anchor_distance/u_camera_to_center_distance : u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp( 0.5+0.5*distance_ratio,0.0,1.5);size*=perspective_ratio;float font_scale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetprojected_point;vec2 a; #ifdef PROJECTION_GLOBE_VIEW vec3 displacement=vec3(a_globe_normal.z,0,-a_globe_normal.x);offsetprojected_point=u_matrix*vec4(a_globe_anchor+displacement,1);vec4 projected_point_globe=u_matrix*vec4(world_pos_globe,1);a=projected_point_globe.xy/projected_point_globe.w; #else offsetprojected_point=u_matrix*vec4(tile_anchor+vec2(1,0),0,1);a=projected_point.xy/projected_point.w; #endif vec2 b=offsetprojected_point.xy/offsetprojected_point.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}vec4 projected_pos; #ifdef PROJECTION_GLOBE_VIEW #ifdef PROJECTED_POS_ON_VIEWPORT projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xyz+h,1.0); #else vec3 proj_pos=mix_globe_mercator(a_projected_pos.xyz,mercator_pos,u_zoom_transition)+h;projected_pos=u_label_plane_matrix*vec4(proj_pos,1.0); #endif #else projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy,h.z,1.0); #endif highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);float z=0.0;vec2 offset=rotation_matrix*(a_offset/32.0*max(a_min_font_scale,font_scale)+a_pxoffset/16.0); #ifdef TERRAIN #ifdef PITCH_WITH_MAP_TERRAIN vec4 tile_pos=u_label_plane_matrix_inv*vec4(a_projected_pos.xy+offset,0.0,1.0);z=elevation(tile_pos.xy); #endif #endif #ifdef Z_OFFSET z+=u_pitch_with_map ? a_auto_z_offset+z_offset : 0.0; #else z+=u_pitch_with_map ? z_offset : 0.0; #endif float occlusion_fade=globe_occlusion_fade;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float out_fade_opacity=max(0.0,min(occlusion_fade,fade_opacity[0]+fade_change)); #ifdef DEPTH_OCCLUSION float depth_occlusion=occlusionFadeMultiSample(projected_point);float depth_occlusion_multplier=mix(occlusion_opacity,1.0,depth_occlusion);out_fade_opacity*=depth_occlusion_multplier; #endif #ifdef OCCLUSION_QUERIES float occludedFadeMultiplier=mix(occlusion_opacity,1.0,a_occlusion_query_opacity);out_fade_opacity*=occludedFadeMultiplier; #endif #ifdef Z_TEST_OCCLUSION out_fade_opacity*=occlusion_opacity; #endif float alpha=opacity*out_fade_opacity;float hidden=float(alpha==0.0 || projected_point.w <=0.0 || occlusion_fade==0.0);vec3 pos; #ifdef PROJECTION_GLOBE_VIEW vec3 xAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,u_up_vector)) : vec3(1,0,0);vec3 yAxis=u_pitch_with_map ? normalize(cross(a_globe_normal,xAxis)) : vec3(0,1,0);pos=projected_pos.xyz/projected_pos.w+xAxis*offset.x+yAxis*offset.y; #else #ifdef ELEVATED_ROADS vec3 xAxis=vec3(a_x_axis.xy,a_x_axis.z*u_normal_scale);vec3 yAxis=vec3(a_y_axis.xy,a_y_axis.z*u_normal_scale);pos=projected_pos.xyz/projected_pos.w+xAxis*offset.x+yAxis*offset.y; #else pos=vec3(projected_pos.xy/projected_pos.w+offset,z); #endif #endif gl_Position=mix(u_coord_matrix*vec4(pos,1.0),AWAY,hidden);float gamma_scale=gl_Position.w;v_draw_halo=(u_is_halo && float(gl_InstanceID)==0.0) ? 1.0 : 0.0;v_gamma_scale_size_fade_opacity=vec3(gamma_scale,size,out_fade_opacity);v_tex_a=a_tex/u_texsize; #ifdef RENDER_TEXT_AND_SYMBOL is_sdf=a_size[0]-2.0*a_size_min;v_tex_a_icon=a_tex/u_texsize_icon; #endif #ifdef ICON_TRANSITION v_tex_b=a_texb/u_texsize; #endif #ifdef RENDER_SHADOWS vec4 shd_pos=u_inv_matrix*vec4(pos,1.0);vec3 shd_pos0=shd_pos.xyz;vec3 shd_pos1=shd_pos.xyz; #ifdef NORMAL_OFFSET vec3 shd_pos_offset=shadow_normal_offset(vec3(0.0,0.0,1.0));shd_pos0+=shd_pos_offset*shadow_normal_offset_multiplier0();shd_pos1+=shd_pos_offset*shadow_normal_offset_multiplier1(); #endif v_pos_light_view_0=u_light_matrix_0*vec4(shd_pos0,1);v_pos_light_view_1=u_light_matrix_1*vec4(shd_pos1,1);v_depth=gl_Position.w; #endif #ifdef INDICATOR_CUTOUT v_z_offset=e; #else #ifdef RENDER_SHADOWS v_z_offset=e; #endif #endif }`),terrainRaster:Xs(`#include "_prelude_fog.fragment.glsl" #include "_prelude_shadow.fragment.glsl" #include "_prelude_lighting.glsl" uniform sampler2D u_image0; #ifdef LIGHTING_3D_ALPHA_EMISSIVENESS uniform sampler2D u_image1;uniform float u_emissive_texture_available; #endif in vec2 v_pos0; #ifdef FOG in float v_fog_opacity; #endif #ifdef RENDER_SHADOWS in vec4 v_pos_light_view_0;in vec4 v_pos_light_view_1; #endif uniform vec3 u_ground_shadow_factor;void main() {vec4 image_color=texture(u_image0,v_pos0);vec4 color; #ifdef LIGHTING_3D_MODE const vec3 normal=vec3(0.0,0.0,1.0); #ifdef RENDER_SHADOWS float cutoffOpacity=1.0; #ifdef RENDER_CUTOFF cutoffOpacity=cutoff_opacity(u_cutoff_params,1.0/gl_FragCoord.w); #endif #ifdef LIGHTING_3D_ALPHA_EMISSIVENESS float emissive_strength=u_emissive_texture_available > 0.5 ? texture(u_image1,v_pos0).r : image_color.a;vec3 unlit_base=image_color.rgb*(1.0-emissive_strength);vec3 emissive_base=image_color.rgb*emissive_strength;float ndotl=u_shadow_direction.z;float occlusion=ndotl < 0.0 ? 1.0 : shadow_occlusion(v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w,0.0);ndotl=max(0.0,ndotl);vec3 lit=apply_lighting(unlit_base,normal,mix(1.0,(1.0-(u_shadow_intensity*occlusion))*ndotl,cutoffOpacity));vec3 emissive=compute_emissive_draped(emissive_base,1.0-u_shadow_intensity,occlusion,u_ground_shadow_factor);color.rgb=lit+emissive;color.a=1.0; #else float lighting_factor=shadowed_light_factor_normal_unbiased(normal,v_pos_light_view_0,v_pos_light_view_1,1.0/gl_FragCoord.w);color=apply_lighting(image_color,normal,mix(1.0,lighting_factor,cutoffOpacity)); #endif #else float lighting_factor=u_lighting_directional_dir.z;color=apply_lighting(image_color,normal,lighting_factor); #ifdef LIGHTING_3D_ALPHA_EMISSIVENESS float emissive_strength=u_emissive_texture_available > 0.5 ? texture(u_image1,v_pos0).r : image_color.a;color.rgb=mix(color.rgb,image_color.rgb,emissive_strength);color.a=1.0; #endif #endif #else color=image_color; #endif #ifdef FOG #ifdef ZERO_EXAGGERATION color=fog_dither(fog_apply_premultiplied(color,v_fog_pos)); #else color=fog_dither(fog_apply_from_vert(color,v_fog_opacity)); #endif #endif glFragColor=color; #ifdef OVERDRAW_INSPECTOR glFragColor=vec4(1.0); #endif HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" #include "_prelude_terrain.vertex.glsl" uniform mat4 u_matrix;uniform float u_skirt_height;in vec2 a_pos;out vec2 v_pos0; #ifdef FOG out float v_fog_opacity; #endif #ifdef RENDER_SHADOWS uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out vec4 v_pos_light_view_0;out vec4 v_pos_light_view_1; #endif void main() {vec3 decomposedPosAndSkirt=decomposeToPosAndSkirt(a_pos);float skirt=decomposedPosAndSkirt.z;vec2 decodedPos=decomposedPosAndSkirt.xy;float elevation=elevation(decodedPos)-skirt*u_skirt_height;v_pos0=decodedPos/8192.0;gl_Position=u_matrix*vec4(decodedPos,elevation,1.0); #ifdef FOG #ifdef ZERO_EXAGGERATION v_fog_pos=fog_position(decodedPos); #else v_fog_opacity=fog(fog_position(vec3(decodedPos,elevation))); #endif #endif #ifdef RENDER_SHADOWS vec3 pos=vec3(decodedPos,elevation);v_pos_light_view_0=u_light_matrix_0*vec4(pos,1.);v_pos_light_view_1=u_light_matrix_1*vec4(pos,1.); #endif }`),terrainDepth:Xs("precision highp float;in float v_depth;void main() {glFragColor=pack_depth(v_depth);}",`#include "_prelude_terrain.vertex.glsl" uniform mat4 u_matrix;in vec2 a_pos;out float v_depth;void main() {float elevation=elevation(a_pos);gl_Position=u_matrix*vec4(a_pos,elevation,1.0);v_depth=gl_Position.z/gl_Position.w;}`),skybox:Xs(`#include "_prelude_fog.fragment.glsl" in lowp vec3 v_uv;uniform lowp samplerCube u_cubemap;uniform lowp float u_opacity;uniform highp float u_temporal_offset;uniform highp vec3 u_sun_direction;float sun_disk(highp vec3 ray_direction,highp vec3 sun_direction) {highp float cos_angle=dot(normalize(ray_direction),sun_direction);const highp float cos_sun_angular_diameter=0.99996192306;const highp float smoothstep_delta=1e-5;return smoothstep( cos_sun_angular_diameter-smoothstep_delta,cos_sun_angular_diameter+smoothstep_delta,cos_angle);}float map(float value,float start,float end,float new_start,float new_end) {return ((value-start)*(new_end-new_start))/(end-start)+new_start;}void main() {vec3 uv=v_uv;const float y_bias=0.015;uv.y+=y_bias;uv.y=pow(abs(uv.y),1.0/5.0);uv.y=map(uv.y,0.0,1.0,-1.0,1.0);vec3 sky_color=texture(u_cubemap,uv).rgb; #ifdef FOG sky_color=fog_apply_sky_gradient(v_uv.xzy,sky_color); #endif sky_color+=0.1*sun_disk(v_uv,u_sun_direction);glFragColor=vec4(sky_color*u_opacity,u_opacity); #ifdef OVERDRAW_INSPECTOR glFragColor=vec4(1.0); #endif }`,Ck),skyboxGradient:Xs(`#include "_prelude_fog.fragment.glsl" in highp vec3 v_uv;uniform lowp sampler2D u_color_ramp;uniform highp vec3 u_center_direction;uniform lowp float u_radius;uniform lowp float u_opacity;uniform highp float u_temporal_offset;void main() {float progress=acos(dot(normalize(v_uv),u_center_direction))/u_radius;vec4 color=texture(u_color_ramp,vec2(progress,0.5)); #ifdef FOG color.rgb=fog_apply_sky_gradient(v_uv.xzy,color.rgb/color.a)*color.a; #endif color*=u_opacity;glFragColor=color; #ifdef OVERDRAW_INSPECTOR glFragColor=vec4(1.0); #endif }`,Ck),skyboxCapture:Xs(` in highp vec3 v_position;uniform highp float u_sun_intensity;uniform highp float u_luminance;uniform lowp vec3 u_sun_direction;uniform highp vec4 u_color_tint_r;uniform highp vec4 u_color_tint_m;precision highp float; #define BETA_R vec3(5.5e-6,13.0e-6,22.4e-6) #define BETA_M vec3(21e-6,21e-6,21e-6) #define MIE_G 0.76 #define DENSITY_HEIGHT_SCALE_R 8000.0 #define DENSITY_HEIGHT_SCALE_M 1200.0 #define PLANET_RADIUS 6360e3 #define ATMOSPHERE_RADIUS 6420e3 #define SAMPLE_STEPS 10 #define DENSITY_STEPS 4 float ray_sphere_exit(vec3 orig,vec3 dir,float radius) {float a=dot(dir,dir);float b=2.0*dot(dir,orig);float c=dot(orig,orig)-radius*radius;float d=sqrt(b*b-4.0*a*c);return (-b+d)/(2.0*a);}vec3 extinction(vec2 density) {return exp(-vec3(BETA_R*u_color_tint_r.a*density.x+BETA_M*u_color_tint_m.a*density.y));}vec2 local_density(vec3 point) {float height=max(length(point)-PLANET_RADIUS,0.0);float exp_r=exp(-height/DENSITY_HEIGHT_SCALE_R);float exp_m=exp(-height/DENSITY_HEIGHT_SCALE_M);return vec2(exp_r,exp_m);}float phase_ray(float cos_angle) {return (3.0/(16.0*PI))*(1.0+cos_angle*cos_angle);}float phase_mie(float cos_angle) {return (3.0/(8.0*PI))*((1.0-MIE_G*MIE_G)*(1.0+cos_angle*cos_angle))/((2.0+MIE_G*MIE_G)*pow(1.0+MIE_G*MIE_G-2.0*MIE_G*cos_angle,1.5));}vec2 density_to_atmosphere(vec3 point,vec3 light_dir) {float ray_len=ray_sphere_exit(point,light_dir,ATMOSPHERE_RADIUS);float step_len=ray_len/float(DENSITY_STEPS);vec2 density_point_to_atmosphere=vec2(0.0);for (int i=0; i < DENSITY_STEPS;++i) {vec3 point_on_ray=point+light_dir*((float(i)+0.5)*step_len);density_point_to_atmosphere+=local_density(point_on_ray)*step_len;;}return density_point_to_atmosphere;}vec3 atmosphere(vec3 ray_dir,vec3 sun_direction,float sun_intensity) {vec2 density_orig_to_point=vec2(0.0);vec3 scatter_r=vec3(0.0);vec3 scatter_m=vec3(0.0);vec3 origin=vec3(0.0,PLANET_RADIUS,0.0);float ray_len=ray_sphere_exit(origin,ray_dir,ATMOSPHERE_RADIUS);float step_len=ray_len/float(SAMPLE_STEPS);for (int i=0; i < SAMPLE_STEPS;++i) {vec3 point_on_ray=origin+ray_dir*((float(i)+0.5)*step_len);vec2 density=local_density(point_on_ray)*step_len;density_orig_to_point+=density;vec2 density_point_to_atmosphere=density_to_atmosphere(point_on_ray,sun_direction);vec2 density_orig_to_atmosphere=density_orig_to_point+density_point_to_atmosphere;vec3 extinction=extinction(density_orig_to_atmosphere);scatter_r+=density.x*extinction;scatter_m+=density.y*extinction;}float cos_angle=dot(ray_dir,sun_direction);float phase_r=phase_ray(cos_angle);float phase_m=phase_mie(cos_angle);vec3 beta_r=BETA_R*u_color_tint_r.rgb*u_color_tint_r.a;vec3 beta_m=BETA_M*u_color_tint_m.rgb*u_color_tint_m.a;return (scatter_r*phase_r*beta_r+scatter_m*phase_m*beta_m)*sun_intensity;}const float A=0.15;const float B=0.50;const float C=0.10;const float D=0.20;const float E=0.02;const float F=0.30;vec3 uncharted2_tonemap(vec3 x) {return ((x*(A*x+C*B)+D*E)/(x*(A*x+B)+D*F))-E/F;}void main() {vec3 ray_direction=v_position;ray_direction.y=pow(ray_direction.y,5.0);const float y_bias=0.015;ray_direction.y+=y_bias;vec3 color=atmosphere(normalize(ray_direction),u_sun_direction,u_sun_intensity);float white_scale=1.0748724675633854;color=uncharted2_tonemap((log2(2.0/pow(u_luminance,4.0)))*color)*white_scale;glFragColor=vec4(color,1.0);}`,"in highp vec3 a_pos_3f;uniform mat3 u_matrix_3f;out highp vec3 v_position;float map(float value,float start,float end,float new_start,float new_end) {return ((value-start)*(new_end-new_start))/(end-start)+new_start;}void main() {vec4 pos=vec4(u_matrix_3f*a_pos_3f,1.0);v_position=pos.xyz;v_position.y*=-1.0;v_position.y=map(v_position.y,-1.0,1.0,0.0,1.0);gl_Position=vec4(a_pos_3f.xy,0.0,1.0);}"),globeRaster:Xs(`#include "_prelude_fog.fragment.glsl" #include "_prelude_lighting.glsl" uniform sampler2D u_image0; #ifdef LIGHTING_3D_ALPHA_EMISSIVENESS uniform sampler2D u_image1;uniform float u_emissive_texture_available; #endif uniform float u_far_z_cutoff;in vec2 v_pos0; #ifndef FOG uniform highp vec3 u_frustum_tl;uniform highp vec3 u_frustum_tr;uniform highp vec3 u_frustum_br;uniform highp vec3 u_frustum_bl;uniform highp vec3 u_globe_pos;uniform highp float u_globe_radius;uniform vec2 u_viewport; #endif void main() {vec4 color; #ifdef CUSTOM_ANTIALIASING highp vec2 uv=gl_FragCoord.xy/u_viewport; #ifdef FLIP_Y uv.y=1.0-uv.y; #endif highp vec3 ray_dir=mix( mix(u_frustum_tl,u_frustum_tr,uv.x),mix(u_frustum_bl,u_frustum_br,uv.x),1.0-uv.y);highp vec3 dir=normalize(ray_dir);highp vec3 closest_point=dot(u_globe_pos,dir)*dir;highp float norm_dist_from_center=1.0-length(closest_point-u_globe_pos)/u_globe_radius;const float antialias_pixel=2.0;highp float antialias_factor=antialias_pixel*fwidth(norm_dist_from_center);highp float antialias=smoothstep(0.0,antialias_factor,norm_dist_from_center);vec4 raster=texture(u_image0,v_pos0); #ifdef LIGHTING_3D_MODE #ifdef LIGHTING_3D_ALPHA_EMISSIVENESS float emissive_strength=u_emissive_texture_available > 0.5 ? texture(u_image1,v_pos0).r : raster.a;raster=apply_lighting_with_emission_ground(raster,emissive_strength);color=vec4(clamp(raster.rgb,vec3(0),vec3(1))*antialias,antialias); #else raster=apply_lighting_ground(raster);color=vec4(raster.rgb*antialias,raster.a*antialias); #endif #else color=vec4(raster.rgb*antialias,raster.a*antialias); #endif #else color=texture(u_image0,v_pos0); #ifdef LIGHTING_3D_MODE #ifdef LIGHTING_3D_ALPHA_EMISSIVENESS float emissive_strength=u_emissive_texture_available > 0.5 ? texture(u_image1,v_pos0).r : color.a;color=apply_lighting_with_emission_ground(color,emissive_strength);color.a=1.0; #else color=apply_lighting_ground(color); #endif #endif #endif #ifdef FOG color=fog_dither(fog_apply_premultiplied(color,v_fog_pos)); #endif color*=1.0-step(u_far_z_cutoff,1.0/gl_FragCoord.w);glFragColor=color; #ifdef OVERDRAW_INSPECTOR glFragColor=vec4(1.0); #endif HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" #include "_prelude_terrain.vertex.glsl" uniform mat4 u_proj_matrix;uniform mat4 u_normalize_matrix;uniform mat4 u_globe_matrix;uniform mat4 u_merc_matrix;uniform float u_zoom_transition;uniform vec2 u_merc_center;uniform mat3 u_grid_matrix;uniform float u_skirt_height; #ifdef GLOBE_POLES in vec3 a_globe_pos;in vec2 a_uv; #else in vec2 a_pos; #endif out vec2 v_pos0;void main() { #ifdef GLOBE_POLES vec3 globe_pos=a_globe_pos;vec2 uv=a_uv; #else float tiles=u_grid_matrix[0][2];float idx=u_grid_matrix[1][2];float idy=u_grid_matrix[2][2];vec3 decomposed_pos_and_skirt=decomposeToPosAndSkirt(a_pos);vec3 latLng=u_grid_matrix*vec3(decomposed_pos_and_skirt.xy,1.0);float mercatorY=mercatorYfromLat(latLng[0]);float uvY=mercatorY*tiles-idy;float mercatorX=mercatorXfromLng(latLng[1]);float uvX=mercatorX*tiles-idx;vec3 globe_pos=latLngToECEF(latLng.xy);vec2 merc_pos=vec2(mercatorX,mercatorY);vec2 uv=vec2(uvX,uvY); #endif v_pos0=uv;vec2 tile_pos=uv*EXTENT;vec3 globe_derived_up_vector=normalize(globe_pos)*u_tile_up_scale; #ifdef GLOBE_POLES vec3 up_vector=globe_derived_up_vector; #else vec3 up_vector=elevationVector(tile_pos); #endif float height=elevation(tile_pos);globe_pos+=up_vector*height; #ifndef GLOBE_POLES globe_pos-=globe_derived_up_vector*u_skirt_height*decomposed_pos_and_skirt.z; #endif #ifdef GLOBE_POLES vec4 interpolated_pos=u_globe_matrix*vec4(globe_pos,1.0); #else vec4 globe_world_pos=u_globe_matrix*vec4(globe_pos,1.0);vec4 merc_world_pos=vec4(0.0);if (u_zoom_transition > 0.0) {merc_world_pos=vec4(merc_pos,height-u_skirt_height*decomposed_pos_and_skirt.z,1.0);merc_world_pos.xy-=u_merc_center;merc_world_pos.x=wrap(merc_world_pos.x,-0.5,0.5);merc_world_pos=u_merc_matrix*merc_world_pos;}vec4 interpolated_pos=vec4(mix(globe_world_pos.xyz,merc_world_pos.xyz,u_zoom_transition),1.0); #endif gl_Position=u_proj_matrix*interpolated_pos; #ifdef FOG v_fog_pos=fog_position((u_normalize_matrix*vec4(globe_pos,1.0)).xyz); #endif }`),globeAtmosphere:Xs(`#include "_prelude_fog.fragment.glsl" uniform float u_transition;uniform highp float u_fadeout_range;uniform highp float u_temporal_offset;uniform vec4 u_atmosphere_fog_color;uniform vec4 u_high_color;uniform vec4 u_space_color;uniform float u_horizon_angle;in highp vec3 v_ray_dir;in highp vec3 v_horizon_dir;void main() {highp vec3 dir=normalize(v_ray_dir);float globe_pos_dot_dir; #ifdef PROJECTION_GLOBE_VIEW globe_pos_dot_dir=dot(u_globe_pos,dir);highp vec3 closest_point_forward=abs(globe_pos_dot_dir)*dir;float norm_dist_from_center=length(closest_point_forward-u_globe_pos)/u_globe_radius;if (norm_dist_from_center < 0.98) { #ifdef ALPHA_PASS glFragColor=vec4(0,0,0,0);return; #else #ifdef NATIVE glFragColor=vec4(1,1,1,1); #else glFragColor=vec4(0,0,0,1); #endif return; #endif } #endif highp vec3 horizon_dir=normalize(v_horizon_dir);float horizon_angle_mercator=dir.y < horizon_dir.y ? 0.0 : max(acos(clamp(dot(dir,horizon_dir),-1.0,1.0)),0.0);float horizon_angle; #ifdef PROJECTION_GLOBE_VIEW highp vec3 closest_point=globe_pos_dot_dir*dir;highp float closest_point_to_center=length(closest_point-u_globe_pos);highp float theta=asin(clamp(closest_point_to_center/length(u_globe_pos),-1.0,1.0));horizon_angle=globe_pos_dot_dir < 0.0 ? PI-theta-u_horizon_angle : theta-u_horizon_angle;float angle_t=pow(u_transition,10.0);horizon_angle=mix(horizon_angle,horizon_angle_mercator,angle_t); #else horizon_angle=horizon_angle_mercator; #endif horizon_angle/=PI;float t=exp(-horizon_angle/u_fadeout_range);float alpha_0=u_atmosphere_fog_color.a;float alpha_1=u_high_color.a;float alpha_2=u_space_color.a;vec3 color_stop_0=u_atmosphere_fog_color.rgb;vec3 color_stop_1=u_high_color.rgb;vec3 color_stop_2=u_space_color.rgb; #ifdef ALPHA_PASS float a0=mix(alpha_2,1.0,alpha_1);float a1=mix(a0,1.0,alpha_0);float a2=mix(a0,a1,t);float a =mix(alpha_2,a2,t);glFragColor=vec4(1.0,1.0,1.0,a); #else vec3 c0=mix(color_stop_2,color_stop_1,alpha_1);vec3 c1=mix(c0,color_stop_0,alpha_0);vec3 c2=mix(c0,c1,t);vec3 c=c2;glFragColor=vec4(c*t,t); #endif }`,`in vec3 a_pos;in vec2 a_uv;uniform vec3 u_frustum_tl;uniform vec3 u_frustum_tr;uniform vec3 u_frustum_br;uniform vec3 u_frustum_bl;uniform float u_horizon;out highp vec3 v_ray_dir;out highp vec3 v_horizon_dir;void main() {v_ray_dir=mix( mix(u_frustum_tl,u_frustum_tr,a_uv.x),mix(u_frustum_bl,u_frustum_br,a_uv.x),a_uv.y);v_horizon_dir=mix( mix(u_frustum_tl,u_frustum_bl,u_horizon),mix(u_frustum_tr,u_frustum_br,u_horizon),a_uv.x);gl_Position=vec4(a_pos,1.0);}`),model:Xs(`#include "_prelude_fog.fragment.glsl" #include "_prelude_shadow.fragment.glsl" #include "_prelude_lighting.glsl" uniform float u_opacity;uniform vec3 u_lightcolor;uniform vec3 u_lightpos;uniform float u_lightintensity;uniform vec4 u_baseColorFactor;uniform vec4 u_emissiveFactor;uniform float u_metallicFactor;uniform float u_roughnessFactor;uniform float u_emissive_strength;in highp vec4 v_position_height;in lowp vec4 v_color_mix; #ifdef RENDER_SHADOWS in highp vec4 v_pos_light_view_0;in highp vec4 v_pos_light_view_1;in float v_depth_shadows; #endif #ifdef OCCLUSION_TEXTURE_TRANSFORM uniform vec4 u_occlusionTextureTransform; #endif #pragma mapbox: define-attribute highp vec3 normal_3f #pragma mapbox: define-attribute highp vec3 color_3f #pragma mapbox: define-attribute highp vec4 color_4f #pragma mapbox: define-attribute highp vec2 uv_2f #pragma mapbox: initialize-attribute highp vec3 normal_3f #pragma mapbox: initialize-attribute highp vec3 color_3f #pragma mapbox: initialize-attribute highp vec4 color_4f #pragma mapbox: initialize-attribute highp vec2 uv_2f #ifdef HAS_ATTRIBUTE_a_pbr in lowp vec4 v_roughness_metallic_emissive_alpha;in mediump vec4 v_height_based_emission_params; #endif #ifdef HAS_TEXTURE_u_baseColorTexture uniform sampler2D u_baseColorTexture;uniform bool u_baseTextureIsAlpha;uniform bool u_alphaMask;uniform float u_alphaCutoff; #endif #ifdef HAS_TEXTURE_u_metallicRoughnessTexture uniform sampler2D u_metallicRoughnessTexture; #endif #ifdef HAS_TEXTURE_u_occlusionTexture uniform sampler2D u_occlusionTexture;uniform float u_aoIntensity; #endif #ifdef HAS_TEXTURE_u_normalTexture uniform sampler2D u_normalTexture; #endif #ifdef HAS_TEXTURE_u_emissionTexture uniform sampler2D u_emissionTexture; #endif #ifdef APPLY_LUT_ON_GPU uniform highp sampler3D u_lutTexture; #endif #ifdef TERRAIN_FRAGMENT_OCCLUSION in highp float v_depth;uniform highp sampler2D u_depthTexture;uniform highp vec2 u_inv_depth_size;uniform highp vec2 u_depth_range_unpack; #ifdef DEPTH_D24 highp float unpack_depth(highp float depth) {return depth*u_depth_range_unpack.x+u_depth_range_unpack.y;} #else highp float unpack_depth_rgba(highp vec4 rgba_depth) {const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;} #endif bool isOccluded() {highp vec2 coord=gl_FragCoord.xy*u_inv_depth_size; #ifdef FLIP_Y coord.y=1.0-coord.y; #endif #ifdef DEPTH_D24 highp float depth=unpack_depth(texture(u_depthTexture,coord).r); #else highp float depth=unpack_depth_rgba(texture(u_depthTexture,coord)); #endif return v_depth > depth+0.0005;} #endif #define saturate(_x) clamp(_x,0.,1.) vec3 linearTosRGB(vec3 color) {return pow(color,vec3(1./2.2));}vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}float calculate_NdotL(vec3 normal,vec3 lightDir) {const float ext=0.70710678118;return (clamp(dot(normal,lightDir),-ext,1.0)+ext)/(1.0+ext);}vec3 getDiffuseShadedColor(vec3 albedo,vec3 normal,vec3 lightDir,vec3 lightColor) { #ifdef LIGHTING_3D_MODE vec3 transformed_normal=vec3(-normal.xy,normal.z);float lighting_factor; #ifdef RENDER_SHADOWS lighting_factor=shadowed_light_factor_normal(transformed_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth_shadows); #else lighting_factor=saturate(dot(transformed_normal,u_lighting_directional_dir)); #endif return apply_lighting(albedo,transformed_normal,lighting_factor); #else vec3 n=normal;float colorvalue=((albedo.x*0.2126)+(albedo.y*0.7152))+(albedo.z*0.0722);vec3 c=vec3(0.03,0.03,0.03);float directional=clamp(dot(n,vec3(lightDir)),0.0,1.0);directional=mix(1.0-u_lightintensity,max((1.0-colorvalue)+u_lightintensity,1.0),directional);vec3 c3=c+clamp((albedo*directional)*lightColor,mix(vec3(0.0),vec3(0.3),vec3(1.0)-lightColor),vec3(1.0));return c3; #endif }vec4 getBaseColor() {vec4 albedo=u_baseColorFactor; #ifdef HAS_ATTRIBUTE_a_color_3f albedo*=vec4(color_3f,1.0); #endif #ifdef HAS_ATTRIBUTE_a_pbr #else #ifdef HAS_ATTRIBUTE_a_color_4f albedo*=color_4f; #endif #endif #if defined (HAS_TEXTURE_u_baseColorTexture) && defined (HAS_ATTRIBUTE_a_uv_2f) vec4 texColor=texture(u_baseColorTexture,uv_2f);if(u_alphaMask) {if (texColor.w < u_alphaCutoff) {discard;}} #ifdef UNPREMULT_TEXTURE_IN_SHADER if(texColor.w > 0.0) {texColor.rgb/=texColor.w;}texColor.w=1.0; #endif if(u_baseTextureIsAlpha) {if (texColor.r < 0.5) {discard;}} else {texColor.rgb=sRGBToLinear(texColor.rgb);albedo*=texColor;} #endif vec4 color=vec4(mix(albedo.rgb,v_color_mix.rgb,v_color_mix.a),albedo.a); #ifdef APPLY_LUT_ON_GPU color=applyLUT(u_lutTexture,color); #endif return color;}highp mat3 cotangentFrame(highp vec3 N,highp vec3 p,highp vec2 uv ) { #ifdef HAS_TEXTURE_u_normalTexture highp vec3 dp1=vec3(dFdx(p.x),dFdx(p.y),dFdx(p.z));highp vec3 dp2=vec3(dFdy(p.x),dFdy(p.y),dFdy(p.z));highp vec2 duv1=vec2(dFdx(uv.x),dFdx(uv.y));highp vec2 duv2=vec2(dFdy(uv.x),dFdy(uv.y));highp vec3 dp2perp=cross( dp2,N );highp vec3 dp1perp=cross( N,dp1 );highp vec3 T=dp2perp*duv1.x+dp1perp*duv2.x;highp vec3 B=dp2perp*duv1.y+dp1perp*duv2.y; #ifdef FLIP_Y T=-T;B=-B; #endif highp float lengthT=dot(T,T);highp float lengthB=dot(B,B);highp float maxLength=max(lengthT,lengthB);highp float invmax=inversesqrt( maxLength );highp mat3 res=mat3( T*invmax,B*invmax,N );return res; #else return mat3(1.0); #endif }highp vec3 getNormal(){highp vec3 n; #ifdef HAS_ATTRIBUTE_a_normal_3f n=normalize(normal_3f); #else highp vec3 fdx=vec3(dFdx(v_position_height.x),dFdx(v_position_height.y),dFdx(v_position_height.z));highp vec3 fdy=vec3(dFdy(v_position_height.x),dFdy(v_position_height.y),dFdy(v_position_height.z)); #ifdef FLIP_Y n=normalize(cross(fdx,fdy)); #else n=normalize(cross(fdx,fdy))*-1.0; #endif #endif #if defined(HAS_TEXTURE_u_normalTexture) && defined(HAS_ATTRIBUTE_a_uv_2f) vec3 nMap=texture( u_normalTexture,uv_2f).xyz;nMap=normalize(2.0*nMap-vec3(1.0));highp vec3 v=normalize(-v_position_height.xyz);highp mat3 TBN=cotangentFrame(n,v,uv_2f);n=normalize(TBN*nMap); #endif return n;}struct Material {float perceptualRoughness;float alphaRoughness;float metallic;vec3 f90;vec4 baseColor;vec3 diffuseColor;vec3 specularColor;highp vec3 normal;};Material getPBRMaterial() {Material mat;mat.baseColor=getBaseColor();mat.perceptualRoughness=u_roughnessFactor;mat.metallic=u_metallicFactor; #ifdef HAS_ATTRIBUTE_a_pbr mat.perceptualRoughness=v_roughness_metallic_emissive_alpha.x;mat.metallic=v_roughness_metallic_emissive_alpha.y;mat.baseColor.w*=v_roughness_metallic_emissive_alpha.w; #endif #if defined(HAS_TEXTURE_u_metallicRoughnessTexture) && defined(HAS_ATTRIBUTE_a_uv_2f) vec4 mrSample=texture(u_metallicRoughnessTexture,uv_2f);mat.perceptualRoughness*=mrSample.g;mat.metallic*=mrSample.b; #endif const float c_minRoughness=0.04;mat.perceptualRoughness=clamp(mat.perceptualRoughness,c_minRoughness,1.0);mat.metallic=saturate(mat.metallic);mat.alphaRoughness=mat.perceptualRoughness*mat.perceptualRoughness;const vec3 f0=vec3(0.04);mat.diffuseColor=mat.baseColor.rgb*(vec3(1.0)-f0);mat.diffuseColor*=1.0-mat.metallic;mat.specularColor=mix(f0,mat.baseColor.rgb,mat.metallic);highp float reflectance=max(max(mat.specularColor.r,mat.specularColor.g),mat.specularColor.b);highp float reflectance90=saturate(reflectance*25.0);mat.f90=vec3(reflectance90);mat.normal=getNormal();return mat;}float V_GGX(float NdotL,float NdotV,float roughness) {float a2=roughness*roughness;float GGXV=NdotL*sqrt(NdotV*NdotV*(1.0-a2)+a2);float GGXL=NdotV*sqrt(NdotL*NdotL*(1.0-a2)+a2);return 0.5/(GGXV+GGXL);}float V_GGXFast(float NdotL,float NdotV,float roughness) {float a=roughness;float GGXV=NdotL*(NdotV*(1.0-a)+a);float GGXL=NdotV*(NdotL*(1.0-a)+a);return 0.5/(GGXV+GGXL);}vec3 F_Schlick(vec3 specularColor,vec3 f90,float VdotH) {return specularColor+(f90-specularColor)*pow(clamp(1.0-VdotH,0.0,1.0),5.0);}vec3 F_SchlickFast(vec3 specularColor,float VdotH) {float x=1.0-VdotH;float x4=x*x*x*x;return specularColor+(1.0-specularColor)*x4*x;}float D_GGX(highp float NdotH,float alphaRoughness) {highp float a4=alphaRoughness*alphaRoughness;highp float f=(NdotH*a4-NdotH)*NdotH+1.0;return a4/(PI*f*f);}vec3 diffuseBurley(Material mat,float LdotH,float NdotL,float NdotV) {float f90=2.0*LdotH*LdotH*mat.alphaRoughness-0.5;return (mat.diffuseColor/PI)*(1.0+f90*pow((1.0-NdotL),5.0))*(1.0+f90*pow((1.0-NdotV),5.0));}vec3 diffuseLambertian(Material mat) { #ifdef LIGHTING_3D_MODE return mat.diffuseColor; #else return mat.diffuseColor/PI; #endif }vec3 EnvBRDFApprox(vec3 specularColor,float roughness,highp float NdotV) {vec4 c0=vec4(-1,-0.0275,-0.572,0.022);vec4 c1=vec4(1,0.0425,1.04,-0.04);highp vec4 r=roughness*c0+c1;highp float a004=min(r.x*r.x,exp2(-9.28*NdotV))*r.x+r.y;vec2 AB=vec2(-1.04,1.04)*a004+r.zw;return specularColor*AB.x+AB.y;}vec3 computeIndirectLightContribution(Material mat,float NdotV,vec3 normal) {vec3 env_light=vec3(0.65,0.65,0.65); #ifdef LIGHTING_3D_MODE float ambient_factor=calculate_ambient_directional_factor(normal);env_light=u_lighting_ambient_color*ambient_factor; #endif vec3 envBRDF=EnvBRDFApprox(mat.specularColor,mat.perceptualRoughness,NdotV);vec3 indirectSpecular= envBRDF*env_light;vec3 indirectDiffuse=mat.diffuseColor*env_light;return indirectSpecular+indirectDiffuse;}vec3 computeLightContribution(Material mat,vec3 lightPosition,vec3 lightColor) {highp vec3 n=mat.normal;highp vec3 v=normalize(-v_position_height.xyz);highp vec3 l=normalize(lightPosition);highp vec3 h=normalize(v+l);float NdotV=clamp(abs(dot(n,v)),0.001,1.0);float NdotL=saturate(dot(n,l));highp float NdotH=saturate(dot(n,h));float VdotH=saturate(dot(v,h));vec3 f=F_SchlickFast(mat.specularColor,VdotH);float g=V_GGXFast(NdotL,NdotV,mat.alphaRoughness);float d=D_GGX(NdotH,mat.alphaRoughness);vec3 diffuseTerm=(1.0-f)*diffuseLambertian(mat);vec3 specularTerm=f*g*d;vec3 transformed_normal=vec3(-n.xy,n.z);float lighting_factor; #ifdef RENDER_SHADOWS lighting_factor=shadowed_light_factor_normal(transformed_normal,v_pos_light_view_0,v_pos_light_view_1,v_depth_shadows); #else lighting_factor=NdotL; #endif vec3 directLightColor=(specularTerm+diffuseTerm)*lighting_factor*lightColor;vec3 indirectLightColor=computeIndirectLightContribution(mat,NdotV,transformed_normal);vec3 color=(saturate(directLightColor)+indirectLightColor);float intensityFactor=1.0; #if !defined(LIGHTING_3D_MODE) const vec3 luminosityFactor=vec3(0.2126,0.7152,0.0722);float luminance=dot(diffuseTerm,luminosityFactor);intensityFactor=mix((1.0-u_lightintensity),max((1.0-luminance+u_lightintensity),1.0),NdotL); #endif color*=intensityFactor;return color;}void main() { #ifdef TERRAIN_FRAGMENT_OCCLUSION if (isOccluded()) {discard;} #endif vec3 lightDir=u_lightpos;vec3 lightColor=u_lightcolor; #ifdef LIGHTING_3D_MODE lightDir=u_lighting_directional_dir;lightDir.xy=-lightDir.xy;lightColor=u_lighting_directional_color; #endif vec4 finalColor; #ifdef DIFFUSE_SHADED vec3 N=getNormal();vec3 baseColor=getBaseColor().rgb;vec3 diffuse=getDiffuseShadedColor(baseColor,N,lightDir,lightColor); #ifdef HAS_TEXTURE_u_occlusionTexture float ao=(texture(u_occlusionTexture,uv_2f).r-1.0)*u_aoIntensity+1.0;diffuse*=ao; #endif finalColor=vec4(mix(diffuse,baseColor,u_emissive_strength),1.0)*u_opacity; #else Material mat=getPBRMaterial();vec3 color=computeLightContribution(mat,lightDir,lightColor);float ao=1.0; #if defined (HAS_TEXTURE_u_occlusionTexture) && defined(HAS_ATTRIBUTE_a_uv_2f) #ifdef OCCLUSION_TEXTURE_TRANSFORM vec2 uv=uv_2f.xy*u_occlusionTextureTransform.zw+u_occlusionTextureTransform.xy; #else vec2 uv=uv_2f; #endif ao=(texture(u_occlusionTexture,uv).x-1.0)*u_aoIntensity+1.0;color*=ao; #endif vec4 emissive=u_emissiveFactor; #if defined(HAS_TEXTURE_u_emissionTexture) && defined(HAS_ATTRIBUTE_a_uv_2f) emissive.rgb*=sRGBToLinear(texture(u_emissionTexture,uv_2f).rgb); #endif #ifdef APPLY_LUT_ON_GPU float emissiveFactorLength=max(length(u_emissiveFactor.rgb),0.001);emissive.rgb=sRGBToLinear(applyLUT(u_lutTexture,linearTosRGB(emissive.rgb/emissiveFactorLength).rbg))*emissiveFactorLength; #endif color+=emissive.rgb;float opacity=mat.baseColor.w*u_opacity; #ifdef HAS_ATTRIBUTE_a_pbr float resEmission=v_roughness_metallic_emissive_alpha.z;resEmission*=v_height_based_emission_params.z+v_height_based_emission_params.w*pow(clamp(v_height_based_emission_params.x,0.0,1.0),v_height_based_emission_params.y);vec3 color_mix=v_color_mix.rgb; #ifdef APPLY_LUT_ON_GPU color_mix=applyLUT(u_lutTexture,color_mix); #endif color=mix(color,color_mix,min(1.0,resEmission)); #ifdef HAS_ATTRIBUTE_a_color_4f float distance=length(vec2(1.3*max(0.0,abs(color_4f.x)-color_4f.z),color_4f.y));distance+= mix(0.5,0.0,clamp(resEmission-1.0,0.0,1.0));opacity*=v_roughness_metallic_emissive_alpha.w*saturate(1.0-distance*distance); #endif #endif vec3 unlitColor=mat.baseColor.rgb*ao+emissive.rgb;color=mix(color,unlitColor,u_emissive_strength);color=linearTosRGB(color);color*=opacity;finalColor=vec4(color,opacity); #endif #ifdef FOG finalColor=fog_dither(fog_apply_premultiplied(finalColor,v_fog_pos,v_position_height.w)); #endif #ifdef RENDER_CUTOFF finalColor*=v_cutoff_opacity; #endif #ifdef INDICATOR_CUTOUT finalColor=applyCutout(finalColor,v_position_height.w); #endif #ifdef FEATURE_CUTOUT finalColor=apply_feature_cutout(finalColor,gl_FragCoord); #endif glFragColor=finalColor; #ifdef OVERDRAW_INSPECTOR glFragColor=vec4(1.0); #endif HANDLE_WIREFRAME_DEBUG;}`,`#include "_prelude_fog.vertex.glsl" #include "_prelude_shadow.vertex.glsl" in vec3 a_pos_3f; #pragma mapbox: define-attribute highp vec3 normal_3f #pragma mapbox: define-attribute highp vec2 uv_2f #pragma mapbox: define-attribute highp vec3 color_3f #pragma mapbox: define-attribute highp vec4 color_4f #pragma mapbox: define-attribute-vertex-shader-only highp vec4 pbr #pragma mapbox: define-attribute-vertex-shader-only highp vec3 heightBasedEmissiveStrength uniform mat4 u_matrix;uniform mat4 u_node_matrix;uniform mat4 u_lighting_matrix;uniform vec3 u_camera_pos;uniform vec4 u_color_mix; #ifdef INSTANCED_ARRAYS in vec4 a_normal_matrix0;in vec4 a_normal_matrix1;in vec4 a_normal_matrix2;in vec4 a_normal_matrix3; #else uniform highp mat4 u_normal_matrix; #endif #ifdef RENDER_SHADOWS uniform mat4 u_light_matrix_0;uniform mat4 u_light_matrix_1;out highp vec4 v_pos_light_view_0;out highp vec4 v_pos_light_view_1;out float v_depth_shadows; #endif out vec4 v_position_height;out lowp vec4 v_color_mix; #ifdef TERRAIN_FRAGMENT_OCCLUSION out highp float v_depth; #endif #ifdef HAS_ATTRIBUTE_a_pbr out lowp vec4 v_roughness_metallic_emissive_alpha;out mediump vec4 v_height_based_emission_params; #endif vec3 sRGBToLinear(vec3 srgbIn) {return pow(srgbIn,vec3(2.2));}void main() { #pragma mapbox: initialize-attribute highp vec3 normal_3f #pragma mapbox: initialize-attribute highp vec2 uv_2f #pragma mapbox: initialize-attribute highp vec3 color_3f #pragma mapbox: initialize-attribute highp vec4 color_4f #pragma mapbox: initialize-attribute-custom highp vec4 pbr #pragma mapbox: initialize-attribute-custom highp vec3 heightBasedEmissiveStrength highp mat4 normal_matrix; #ifdef INSTANCED_ARRAYS normal_matrix=mat4(a_normal_matrix0,a_normal_matrix1,a_normal_matrix2,a_normal_matrix3); #else normal_matrix=u_normal_matrix; #endif vec3 local_pos;mat3 rs; #ifdef MODEL_POSITION_ON_GPU vec3 pos_color=normal_matrix[0].xyz;vec4 translate=normal_matrix[1];vec3 pos_a=floor(pos_color);vec3 rgb=1.05*(pos_color-pos_a);float hidden=float(pos_a.x > EXTENT);float color_mix=pos_a.z/100.0;v_color_mix=vec4(sRGBToLinear(rgb),color_mix);float meter_to_tile=normal_matrix[0].w;vec4 pos=vec4(pos_a.xy,translate.z,1.0);rs[0].x=normal_matrix[1].w;rs[0].yz=normal_matrix[2].xy;rs[1].xy=normal_matrix[2].zw;rs[1].z=normal_matrix[3].x;rs[2].xyz=normal_matrix[3].yzw;vec4 pos_node=u_lighting_matrix*vec4(a_pos_3f,1.0);vec3 rotated_pos_node=rs*pos_node.xyz;vec3 pos_model_tile=(rotated_pos_node+vec3(translate.xy,0.0))*vec3(meter_to_tile,meter_to_tile,1.0);pos.xyz+=pos_model_tile;local_pos=pos.xyz;gl_Position=mix(u_matrix*pos,AWAY,hidden);pos.z*=meter_to_tile;v_position_height.xyz=pos.xyz-u_camera_pos; #else local_pos=a_pos_3f;gl_Position=u_matrix*vec4(a_pos_3f,1);v_position_height.xyz=vec3(u_lighting_matrix*vec4(a_pos_3f,1));v_color_mix=vec4(sRGBToLinear(u_color_mix.rgb),u_color_mix.a); #endif v_position_height.w=a_pos_3f.z; #ifdef HAS_ATTRIBUTE_a_pbr vec4 albedo_c=decode_color(pbr.xy);vec2 e_r_m=unpack_float(pbr.z);vec2 r_m= unpack_float(e_r_m.y*16.0);r_m.r=r_m.r*16.0;v_color_mix=vec4(albedo_c.rgb,1.0);v_roughness_metallic_emissive_alpha=vec4(vec3(r_m,e_r_m.x)/255.0,albedo_c.a);v_roughness_metallic_emissive_alpha.z*=2.0;float heightBasedRelativeIntepolation=a_pos_3f.z*heightBasedEmissiveStrength.x+heightBasedEmissiveStrength.y;v_height_based_emission_params.x=heightBasedRelativeIntepolation;v_height_based_emission_params.y=heightBasedEmissiveStrength.z;vec2 emissionMultiplierValues=unpack_float(pbr.w)/256.0;v_height_based_emission_params.z=emissionMultiplierValues.x;v_height_based_emission_params.w=emissionMultiplierValues.y-emissionMultiplierValues.x; #endif #ifdef FOG v_fog_pos=fog_position(local_pos); #endif #ifdef RENDER_CUTOFF v_cutoff_opacity=cutoff_opacity(u_cutoff_params,gl_Position.z); #endif #ifdef TERRAIN_FRAGMENT_OCCLUSION v_depth=gl_Position.z/gl_Position.w; #ifdef CLIP_ZERO_TO_ONE v_depth=-1.0+2.0*v_depth; #endif #endif #ifdef HAS_ATTRIBUTE_a_normal_3f #ifdef MODEL_POSITION_ON_GPU float x_squared_scale=dot(rs[0],rs[0]);float y_squared_scale=dot(rs[1],rs[1]);float z_squared_scale=dot(rs[2],rs[2]);vec3 squared_scale=vec3(x_squared_scale,y_squared_scale,z_squared_scale);normal_3f=rs*((u_lighting_matrix*vec4(normal_3f,0.0)).xyz/squared_scale);normal_3f=normalize(normal_3f); #else normal_3f=vec3(normal_matrix*vec4(normal_3f,0)); #endif #endif #ifdef HAS_ATTRIBUTE_a_pbr #ifdef HAS_ATTRIBUTE_a_color_4f v_roughness_metallic_emissive_alpha.w=clamp(color_4f.a*v_roughness_metallic_emissive_alpha.w*(v_roughness_metallic_emissive_alpha.z-1.0),0.0,1.0); #endif #endif #ifdef RENDER_SHADOWS vec4 shadow_pos=u_node_matrix*vec4(local_pos,1.0); #ifdef NORMAL_OFFSET #ifdef HAS_ATTRIBUTE_a_normal_3f #ifdef MODEL_POSITION_ON_GPU vec3 offset=shadow_normal_offset(vec3(-normal_3f.xy,normal_3f.z));shadow_pos.xyz+=offset*shadow_normal_offset_multiplier0(); #else vec3 offset=shadow_normal_offset_model(normal_3f);shadow_pos.xyz+=offset*shadow_normal_offset_multiplier0(); #endif #endif #endif v_pos_light_view_0=u_light_matrix_0*shadow_pos;v_pos_light_view_1=u_light_matrix_1*shadow_pos;v_depth_shadows=gl_Position.w; #endif }`),modelDepth:Xs(`in highp float v_depth;void main() { #ifndef DEPTH_TEXTURE glFragColor=pack_depth(v_depth); #endif }`,`in vec3 a_pos_3f;uniform mat4 u_matrix;out highp float v_depth; #ifdef MODEL_POSITION_ON_GPU #ifdef INSTANCED_ARRAYS in vec4 a_normal_matrix0;in vec4 a_normal_matrix1;in vec4 a_normal_matrix2;in vec4 a_normal_matrix3; #else uniform highp mat4 u_instance; #endif uniform highp mat4 u_node_matrix; #endif void main() { #ifdef MODEL_POSITION_ON_GPU highp mat4 instance; #ifdef INSTANCED_ARRAYS instance=mat4(a_normal_matrix0,a_normal_matrix1,a_normal_matrix2,a_normal_matrix3); #else instance=u_instance; #endif vec3 pos_color=instance[0].xyz;vec4 translate=instance[1];vec3 pos_a=floor(pos_color);float hidden=float(pos_a.x > EXTENT);float meter_to_tile=instance[0].w;vec4 pos=vec4(pos_a.xy,translate.z,1.0);mat3 rs;rs[0].x=instance[1].w;rs[0].yz=instance[2].xy;rs[1].xy=instance[2].zw;rs[1].z=instance[3].x;rs[2].xyz=instance[3].yzw;vec4 pos_node=u_node_matrix*vec4(a_pos_3f,1.0);vec3 rotated_pos_node=rs*pos_node.xyz;vec3 pos_model_tile=(rotated_pos_node+vec3(translate.xy,0.0))*vec3(meter_to_tile,meter_to_tile,1.0);pos.xyz+=pos_model_tile;gl_Position=mix(u_matrix*pos,AWAY,hidden); #else gl_Position=u_matrix*vec4(a_pos_3f,1); #endif v_depth=gl_Position.z/gl_Position.w;}`),stars:Xs(`in highp vec2 v_uv;in mediump float v_intensity;float shapeCircle(in vec2 uv) {float beginFade=0.6;float lengthFromCenter=length(v_uv);return 1.0-clamp((lengthFromCenter-beginFade)/(1.0-beginFade),0.0,1.0);}void main() {float alpha=shapeCircle(v_uv);vec3 color=vec3(1.0,1.0,1.0);alpha*=v_intensity;glFragColor=vec4(color*alpha,alpha);HANDLE_WIREFRAME_DEBUG;}`,` in vec3 a_pos_3f;in vec2 a_uv;in float a_size_scale;in float a_fade_opacity;uniform mat4 u_matrix;uniform vec3 u_up;uniform vec3 u_right;uniform float u_intensity_multiplier;out highp vec2 v_uv;out mediump float v_intensity;void main() {v_uv=a_uv;v_intensity=a_fade_opacity*u_intensity_multiplier;vec3 pos=a_pos_3f;pos+=a_uv.x*u_right*a_size_scale;pos+=a_uv.y*u_up*a_size_scale;gl_Position=u_matrix*vec4(pos,1.0);}`),snowParticle:Xs("in highp vec2 uv;in highp float alphaMultiplier;uniform vec4 u_particleColor;uniform vec2 u_simpleShapeParameters;void main() {float t=clamp((length(uv)-u_simpleShapeParameters.x)/(1.0-u_simpleShapeParameters.x),0.0,1.0);float alpha=1.0-pow(t,pow(10.0,u_simpleShapeParameters.y));alpha*=alphaMultiplier;alpha*=u_particleColor.a;vec3 color=u_particleColor.rgb*alpha;glFragColor=vec4(color,alpha) ;HANDLE_WIREFRAME_DEBUG;}",` in highp vec3 a_pos_3f;in highp vec2 a_uv;in highp vec4 a_snowParticleData;in highp vec4 a_snowParticleDataHorizontalOscillation;uniform mat4 u_modelview;uniform mat4 u_projection;uniform vec3 u_cam_pos;uniform vec2 u_screenSize;uniform float u_time;uniform float u_boxSize;uniform float u_velocityConeAperture; uniform float u_velocity;uniform vec3 u_direction;uniform float u_horizontalOscillationRadius; uniform float u_horizontalOscillationRate; uniform float u_billboardSize;uniform vec2 u_thinningCenterPos;uniform vec3 u_thinningShape;uniform float u_thinningAffectedRatio;uniform float u_thinningParticleOffset;out highp vec2 uv;out highp float alphaMultiplier;void main() {vec3 pos=a_pos_3f;float halfBoxSize=0.5*u_boxSize;pos.xyz*=halfBoxSize;pos+=u_cam_pos;float velocityConeApertureRad=radians(u_velocityConeAperture*0.5);float coneAnglePichRad=velocityConeApertureRad*a_snowParticleData.z;float coneAngleHeadingRad=a_snowParticleData.w*radians(360.0);vec3 localZ=normalize(u_direction);vec3 localX=normalize(cross(localZ,vec3(1,0,0)));vec3 localY=normalize(cross(localZ,localX));vec3 direction;direction.x=cos(coneAngleHeadingRad)*sin(coneAnglePichRad);direction.y=sin(coneAngleHeadingRad)*sin(coneAnglePichRad);direction.z=cos(coneAnglePichRad);direction=normalize(direction);vec3 simPosLocal=vec3(0,0,0);float velocityScale=(1.0+3.0*a_snowParticleData.y)*u_velocity;simPosLocal+=direction*velocityScale*u_time;float horizontalOscillationRadius=u_horizontalOscillationRadius*a_snowParticleDataHorizontalOscillation.x;float horizontalOscillationAngle=u_horizontalOscillationRate*u_time*(-1.0+2.0*a_snowParticleDataHorizontalOscillation.y);simPosLocal.xy+=horizontalOscillationRadius*vec2(cos(horizontalOscillationAngle),sin(horizontalOscillationAngle));vec3 simPos=localX*simPosLocal.x+ localY*simPosLocal.y+localZ*simPosLocal.z;pos+=simPos;pos=fract((pos+vec3(halfBoxSize))/vec3(u_boxSize))*u_boxSize-vec3(halfBoxSize);float clipZ=-u_cam_pos.z+pos.z;vec4 posView=u_modelview*vec4(pos,1.0);float size=u_billboardSize;alphaMultiplier=1.0;vec4 posScreen=u_projection*posView;posScreen/=posScreen.w;posScreen.xy=vec2(0.5)+posScreen.xy*0.5;posScreen.xy*=u_screenSize;vec2 thinningCenterPos=u_thinningCenterPos.xy;thinningCenterPos.y=u_screenSize.y-thinningCenterPos.y;float screenDist=length((thinningCenterPos-posScreen.xy)/(0.5*u_screenSize));screenDist+=a_snowParticleData.x*u_thinningParticleOffset;float scaleFactorMode=0.0;float thinningShapeDist=u_thinningShape.x+u_thinningShape.y;if (screenDist < thinningShapeDist) {float thinningFadeRatio=clamp((screenDist-u_thinningShape.x)/u_thinningShape.y,0.0,1.0);thinningFadeRatio=pow(thinningFadeRatio,u_thinningShape.z);if (a_snowParticleData.x < u_thinningAffectedRatio) {scaleFactorMode=1.0-thinningFadeRatio;alphaMultiplier=thinningFadeRatio;}}vec4 posScreen1=u_projection*vec4(posView.x-size,posView.yzw);posScreen1/=posScreen1.w;vec4 posScreen2=u_projection*vec4(posView.x+size,posView.yzw);posScreen2/=posScreen2.w;posScreen1.xy=vec2(0.5)+posScreen1.xy*0.5;posScreen1.xy*=u_screenSize;posScreen2.xy=vec2(0.5)+posScreen2.xy*0.5;posScreen2.xy*=u_screenSize;float screenLength=length(posScreen1.xy-posScreen2.xy);float screenEpsilon=3.0;float scaleFactor=1.0;if (screenLength < screenEpsilon) {scaleFactor=screenEpsilon/max(screenLength,0.01);scaleFactor=mix(scaleFactor,1.0,scaleFactorMode);}float screenEpsilon2=15.0;if (screenLength > screenEpsilon2) {scaleFactor=screenEpsilon2/max(screenLength,0.01);}size*=scaleFactor;vec2 right=size*vec2(1,0);vec2 up=size*vec2(0,1);posView.xy+=right*a_uv.x;posView.xy+=up*a_uv.y;uv=a_uv;gl_Position=u_projection*posView;}`),rainParticle:Xs("in highp vec2 uv;in highp float particleRandomValue;uniform sampler2D u_texScreen;uniform float u_distortionStrength;uniform vec4 u_color;uniform vec2 u_thinningCenterPos;uniform vec3 u_thinningShape;uniform float u_thinningAffectedRatio;uniform float u_thinningParticleOffset;uniform float u_shapeDirectionalPower;uniform float u_mode;void main() {vec2 st=uv*0.5+vec2(0.5);vec2 uvm=uv;uvm.y=-1.0+2.0*pow(st.y,u_shapeDirectionalPower);float shape=clamp(1.0-length(uvm),0.0,1.0);float alpha=abs(shape)*u_color.a;vec2 screenSize=vec2(textureSize(u_texScreen,0));vec2 thinningCenterPos=u_thinningCenterPos.xy;thinningCenterPos.y=screenSize.y-thinningCenterPos.y;float screenDist=length((thinningCenterPos-gl_FragCoord.xy)/(0.5*screenSize));screenDist+=(0.5+0.5*particleRandomValue)*u_thinningParticleOffset;float thinningShapeDist=u_thinningShape.x+u_thinningShape.y;float thinningAlpha=1.0;if (screenDist < thinningShapeDist) {float thinningFadeRatio=clamp((screenDist-u_thinningShape.x)/u_thinningShape.y,0.0,1.0);thinningFadeRatio=pow(thinningFadeRatio,u_thinningShape.z);thinningAlpha*=thinningFadeRatio;}vec2 offsetXY=normalize(uvm)*abs(shape);vec2 stScreen=(gl_FragCoord.xy+offsetXY*u_distortionStrength*thinningAlpha)/screenSize;vec3 colorScreen=texture(u_texScreen,stScreen).rgb;alpha*=thinningAlpha;glFragColor=mix(vec4(colorScreen,1.0),vec4(u_color.rgb*alpha,alpha),u_mode);HANDLE_WIREFRAME_DEBUG;}",` in highp vec3 a_pos_3f;in highp vec2 a_uv;in highp vec4 a_rainParticleData;uniform mat4 u_modelview;uniform mat4 u_projection;uniform vec3 u_cam_pos;uniform float u_time;uniform float u_boxSize;uniform float u_velocityConeAperture; uniform float u_velocity; uniform vec2 u_rainDropletSize;uniform vec3 u_rainDirection;out highp vec2 uv;out highp float particleRandomValue;void main() {vec3 pos=a_pos_3f;float halfBoxSize=0.5*u_boxSize;pos*=halfBoxSize; pos+=u_cam_pos;float velocityConeApertureRad=radians(u_velocityConeAperture*0.5);float coneAnglePichRad=velocityConeApertureRad*a_rainParticleData.z;float coneAngleHeadingRad=a_rainParticleData.w*radians(360.0);vec3 localZ=normalize(u_rainDirection);vec3 localX=normalize(cross(localZ,vec3(1,0,0)));vec3 localY=normalize(cross(localZ,localX));vec3 directionLocal;directionLocal.x=cos(coneAngleHeadingRad)*sin(coneAnglePichRad);directionLocal.y=sin(coneAngleHeadingRad)*sin(coneAnglePichRad);directionLocal.z=cos(coneAnglePichRad);directionLocal=normalize(directionLocal);vec3 directionWorld=localX*directionLocal.x+localY*directionLocal.y+localZ*directionLocal.z;float velocityScale=(1.0+3.0*a_rainParticleData.y)*u_velocity;vec3 simPosLocal=vec3(0,0,0);simPosLocal+=directionLocal*velocityScale*u_time;vec3 simPos=localX*simPosLocal.x+ localY*simPosLocal.y+localZ*simPosLocal.z;pos+=simPos;pos=fract((pos+vec3(halfBoxSize))/vec3(u_boxSize))*u_boxSize-vec3(halfBoxSize);vec4 posView=u_modelview*vec4(pos,1.0);vec3 directionView=normalize((u_modelview*vec4(directionWorld,0.0)).xyz);vec3 side=cross(directionView,normalize(posView.xyz));posView.xyz+=side*a_uv.x*u_rainDropletSize.x;posView.xyz+=directionView*a_uv.y*u_rainDropletSize.y;uv=a_uv;particleRandomValue=a_rainParticleData.x;gl_Position=u_projection*posView;}`),vignette:Xs("uniform vec3 u_vignetteShape;uniform vec4 u_vignetteColor;in vec2 st;void main() {float screenDist=length(st);float alpha=clamp((screenDist-u_vignetteShape.x)/u_vignetteShape.y,0.0,1.0);alpha=pow(alpha,u_vignetteShape.z)*u_vignetteColor.a;vec3 color=u_vignetteColor.rgb;glFragColor=vec4(color*alpha,alpha) ;}","in vec2 a_pos_2f;out vec2 st;void main() {st=a_pos_2f;gl_Position=vec4(a_pos_2f,0,1);}"),occlusion:Xs("uniform vec4 u_color;void main() {glFragColor=u_color;}",`#include "_prelude_terrain.vertex.glsl" in highp vec2 a_offset_xy;uniform highp vec3 u_anchorPos;uniform mat4 u_matrix;uniform vec2 u_screenSizePx;uniform vec2 u_occluderSizePx;void main() {vec3 world_pos=u_anchorPos; #ifdef TERRAIN float e=elevation(world_pos.xy);world_pos.z+=e; #endif vec4 projected_point=u_matrix*vec4(world_pos,1.0);projected_point.xy+=projected_point.w*a_offset_xy*0.5*u_occluderSizePx/u_screenSizePx;gl_Position=projected_point;}`)};function Dm(_,d){const m=_.split(` `);for(let w of m){if(w=w.trimStart(),w[0]!=="#"||!w.includes("if")||w.startsWith("#endif"))continue;const M=w.match(z3);if(M)for(const O of M)Gg.has(O)||d.add(O)}}function Xs(_,d){const m=new Set,w=[],M=[];_=_.replace(kv,(D,B)=>(M.push(B),"")),d=d.replace(kv,(D,B)=>(w.push(B),""));let O=new Set(Kg);Dm(_,O),Dm(d,O);for(const D of[...w,...M])Ek[D]||(Ek[D]=new Set,Dm(Om[D],Ek[D])),O=new Set([...O,...Ek[D]]);return{fragmentSource:_=_.replace(_f,(D,B,V,Y,Q)=>(m.add(Q),B==="define"?` #ifndef HAS_UNIFORM_u_${Q} in ${V} ${Y} ${Q}; #else uniform ${V} ${Y} u_${Q}; #endif `:B==="initialize"?` #ifdef HAS_UNIFORM_u_${Q} ${V} ${Y} ${Q} = u_${Q}; #endif `:B==="define-attribute"?` #ifdef HAS_ATTRIBUTE_a_${Q} in ${V} ${Y} ${Q}; #endif `:B==="initialize-attribute"?"":void 0)),vertexSource:d=d.replace(_f,(D,B,V,Y,Q)=>{const ce=`MATERIAL_ATTRIBUTE_OFFSET_${Q}`,oe=Y==="float"?"vec2":Y,de=`GET_ATTRIBUTE_${oe}(a_${Q}, materialInfo, ${ce})`,we=Q.match(/color/)?"color":oe;return B==="define-attribute-vertex-shader-only"?` #ifdef HAS_ATTRIBUTE_a_${Q} in ${V} ${Y} a_${Q}; #endif `:m.has(Q)?B==="define"?` #ifndef HAS_UNIFORM_u_${Q} uniform lowp float u_${Q}_t; #if !defined(${ce}) in ${V} ${oe} a_${Q}; #endif out ${V} ${Y} ${Q}; #else uniform ${V} ${Y} u_${Q}; #endif `:B==="initialize"?we==="vec4"?` #ifndef HAS_UNIFORM_u_${Q} ${Q} = a_${Q}; #else ${V} ${Y} ${Q} = u_${Q}; #endif `:` #if !defined(HAS_UNIFORM_u_${Q}) #ifdef ${ce} ${Q} = unpack_mix_${we}(${de}, u_${Q}_t); #else ${Q} = unpack_mix_${we}(a_${Q}, u_${Q}_t); #endif #else ${V} ${Y} ${Q} = u_${Q}; #endif `:B==="define-attribute"?` #ifdef HAS_ATTRIBUTE_a_${Q} in ${V} ${Y} a_${Q}; out ${V} ${Y} ${Q}; #endif `:B==="initialize-attribute"?` #ifdef HAS_ATTRIBUTE_a_${Q} ${Q} = a_${Q}; #endif `:void 0:B==="define"?` #ifndef HAS_UNIFORM_u_${Q} uniform lowp float u_${Q}_t; #if !defined(${ce}) in ${V} ${oe} a_${Q}; #endif #else uniform ${V} ${Y} u_${Q}; #endif `:B==="define-instanced"?we==="mat4"?` #ifdef INSTANCED_ARRAYS in vec4 a_${Q}0; in vec4 a_${Q}1; in vec4 a_${Q}2; in vec4 a_${Q}3; #else uniform ${V} ${Y} u_${Q}; #endif `:` #ifdef INSTANCED_ARRAYS in ${V} ${oe} a_${Q}; #else uniform ${V} ${Y} u_${Q}; #endif `:B==="initialize-attribute-custom"?` #ifdef HAS_ATTRIBUTE_a_${Q} ${V} ${Y} ${Q} = a_${Q}; #endif `:we==="vec4"?` #ifndef HAS_UNIFORM_u_${Q} #ifdef ${ce} ${V} ${Y} ${Q} = ${de}; #else ${V} ${Y} ${Q} = a_${Q}; #endif #else ${V} ${Y} ${Q} = u_${Q}; #endif `:` #ifndef HAS_UNIFORM_u_${Q} #ifdef ${ce} ${V} ${Y} ${Q} = unpack_mix_${we}(${de}, u_${Q}_t); #else ${V} ${Y} ${Q} = unpack_mix_${we}(a_${Q}, u_${Q}_t); #endif #else ${V} ${Y} ${Q} = u_${Q}; #endif `}),usedDefines:O,vertexIncludes:w,fragmentIncludes:M}}class Wae{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffers=[],this.vao=null}bind(d,m,w,M,O,D,B,V){this.context=d;let Y=this.boundPaintVertexBuffers.length!==M.length;for(let ce=0;!Y&&ce{const bt=Xe.paint.get("hillshade-shadow-color"),ut=Xe.paint.get("hillshade-shadow-color-use-theme").constantOr("default")==="none",xt=Xe.paint.get("hillshade-highlight-color"),ct=Xe.paint.get("hillshade-highlight-color-use-theme").constantOr("default")==="none",it=Xe.paint.get("hillshade-accent-color"),St=Xe.paint.get("hillshade-accent-color-use-theme").constantOr("default")==="none",Dt=Xe.paint.get("hillshade-emissive-strength");let Lt=i.an(Xe.paint.get("hillshade-illumination-direction"));if(Xe.paint.get("hillshade-illumination-anchor")==="viewport")Lt-=Pe.transform.angle;else if(Pe.style&&Pe.style.enable3dLights()&&Pe.style.directionalLight){const Wt=Pe.style.directionalLight.properties.get("direction"),sr=i.d4(Wt.x,Wt.y,Wt.z);Lt=i.an(sr[1])}const Ht=!Pe.options.moving;return{u_matrix:We||Pe.transform.calculateProjMatrix(Ve.tileID.toUnwrapped(),Ht),u_image:0,u_latrange:Gae(0,Ve.tileID),u_light:[Xe.paint.get("hillshade-exaggeration"),Lt],u_shadow:bt.toPremultipliedRenderColor(ut?null:Xe.lut),u_highlight:xt.toPremultipliedRenderColor(ct?null:Xe.lut),u_emissive_strength:Dt,u_accent:it.toPremultipliedRenderColor(St?null:Xe.lut)}})(_,m,w,_.terrain?d.projMatrix:null);_.uploadCommonUniforms(B,oe,d.toUnwrapped());const{tileBoundsBuffer:we,tileBoundsIndexBuffer:ve,tileBoundsSegments:De}=_.getTileBoundsBuffers(m);oe.draw(_,V.TRIANGLES,M,O,D,zn.disabled,de,w.id,we,ve,De)}function $3(_,d,m){if(!d.needsDEMTextureUpload)return;const w=_.context,M=w.gl;w.pixelStoreUnpackPremultiplyAlpha.set(!1),d.demTexture=d.demTexture||_.getTileTexture(m.stride);const O=m.getPixels();d.demTexture?d.demTexture.update(O,{premultiply:!1}):d.demTexture=new i.T(w,O,M.R32F,{premultiply:!1}),d.needsDEMTextureUpload=!1}function Zae(_,d,m){const w=_.context,M=w.gl;if(!d.dem)return;const O=d.dem;if(w.activeTexture.set(M.TEXTURE1),$3(_,d,O),!d.demTexture)return;d.demTexture.bind(M.NEAREST,M.CLAMP_TO_EDGE);const D=O.dim;w.activeTexture.set(M.TEXTURE0);let B=d.hillshadeFBO;if(!B){const oe=new i.T(w,{width:D,height:D,data:null},M.RGBA8);oe.bind(M.LINEAR,M.CLAMP_TO_EDGE),B=d.hillshadeFBO=w.createFramebuffer(D,D,1,"renderbuffer"),B.colorAttachment0.set(oe.texture)}w.bindFramebuffer.set(B.framebuffer),w.viewport.set([0,0,D,D]);const{tileBoundsBuffer:V,tileBoundsIndexBuffer:Y,tileBoundsSegments:Q}=_.getMercatorTileBoundsBuffers(),ce=[];_.linearFloatFilteringSupported()&&ce.push("TERRAIN_DEM_FLOAT_FORMAT"),_.terrain&&_.terrain.renderingToTexture&&_.emissiveMode==="mrt-fallback"&&ce.push("USE_MRT1"),_.getOrCreateProgram("hillshadePrepare",{defines:ce}).draw(_,M.TRIANGLES,dn.disabled,$n.disabled,as.unblended,zn.disabled,((oe,de)=>{const we=de.stride,ve=i.bC();return i.ce(ve,0,i.al,-i.al,0,0,1),i.br(ve,ve,[0,-i.al,0]),{u_matrix:ve,u_image:1,u_dimension:[we,we],u_zoom:oe.overscaledZ}})(d.tileID,O),m.id,V,Y,Q),d.needsHillshadePrepare=!1}class Si{constructor(d){this.gl=d.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(d){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class Yae extends Si{getDefault(){return i.ao.transparent.toNonPremultipliedRenderColor(null)}set(d){const m=this.current;(d.r!==m.r||d.g!==m.g||d.b!==m.b||d.a!==m.a||this.dirty)&&(this.gl.clearColor(d.r,d.g,d.b,d.a),this.current=d,this.dirty=!1)}}class tP extends Si{getDefault(){return 1}set(d){(d!==this.current||this.dirty)&&(this.gl.clearDepth(d),this.current=d,this.dirty=!1)}}class U3 extends Si{getDefault(){return 0}set(d){(d!==this.current||this.dirty)&&(this.gl.clearStencil(d),this.current=d,this.dirty=!1)}}class Pk extends Si{getDefault(){return[!0,!0,!0,!0]}set(d){const m=this.current;(d[0]!==m[0]||d[1]!==m[1]||d[2]!==m[2]||d[3]!==m[3]||this.dirty)&&(this.gl.colorMask(d[0],d[1],d[2],d[3]),this.current=d,this.dirty=!1)}}class q3 extends Si{getDefault(){return!0}set(d){(d!==this.current||this.dirty)&&(this.gl.depthMask(d),this.current=d,this.dirty=!1)}}class Zg extends Si{getDefault(){return 255}set(d){(d!==this.current||this.dirty)&&(this.gl.stencilMask(d),this.current=d,this.dirty=!1)}}class Ay extends Si{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(d){const m=this.current;(d.func!==m.func||d.ref!==m.ref||d.mask!==m.mask||this.dirty)&&(this.gl.stencilFunc(d.func,d.ref,d.mask),this.current=d,this.dirty=!1)}}class Nv extends Si{getDefault(){const d=this.gl;return[d.KEEP,d.KEEP,d.KEEP]}set(d){const m=this.current;(d[0]!==m[0]||d[1]!==m[1]||d[2]!==m[2]||this.dirty)&&(this.gl.stencilOp(d[0],d[1],d[2]),this.current=d,this.dirty=!1)}}class Ey extends Si{getDefault(){return!1}set(d){if(d===this.current&&!this.dirty)return;const m=this.gl;d?m.enable(m.STENCIL_TEST):m.disable(m.STENCIL_TEST),this.current=d,this.dirty=!1}}class rP extends Si{getDefault(){return[0,1]}set(d){const m=this.current;(d[0]!==m[0]||d[1]!==m[1]||this.dirty)&&(this.gl.depthRange(d[0],d[1]),this.current=d,this.dirty=!1)}}class V3 extends Si{getDefault(){return!1}set(d){if(d===this.current&&!this.dirty)return;const m=this.gl;d?m.enable(m.DEPTH_TEST):m.disable(m.DEPTH_TEST),this.current=d,this.dirty=!1}}class nP extends Si{getDefault(){return this.gl.LESS}set(d){(d!==this.current||this.dirty)&&(this.gl.depthFunc(d),this.current=d,this.dirty=!1)}}class Iy extends Si{getDefault(){return!1}set(d){if(d===this.current&&!this.dirty)return;const m=this.gl;d?m.enable(m.BLEND):m.disable(m.BLEND),this.current=d,this.dirty=!1}}class Lk extends Si{getDefault(){const d=this.gl;return[d.ONE,d.ZERO,d.ONE,d.ZERO]}set(d){const m=this.current;(d[0]!==m[0]||d[1]!==m[1]||d[2]!==m[2]||d[3]!==m[3]||this.dirty)&&(this.gl.blendFuncSeparate(d[0],d[1],d[2],d[3]),this.current=d,this.dirty=!1)}}class Ok extends Si{getDefault(){return i.ao.transparent.toNonPremultipliedRenderColor(null)}set(d){const m=this.current;(d.r!==m.r||d.g!==m.g||d.b!==m.b||d.a!==m.a||this.dirty)&&(this.gl.blendColor(d.r,d.g,d.b,d.a),this.current=d,this.dirty=!1)}}class H3 extends Si{getDefault(){return this.gl.FUNC_ADD}set(d){(d!==this.current||this.dirty)&&(this.gl.blendEquationSeparate(d,d),this.current=d,this.dirty=!1)}}class Dk extends Si{getDefault(){return!1}set(d){if(d===this.current&&!this.dirty)return;const m=this.gl;d?m.enable(m.CULL_FACE):m.disable(m.CULL_FACE),this.current=d,this.dirty=!1}}class Sv extends Si{getDefault(){return this.gl.BACK}set(d){(d!==this.current||this.dirty)&&(this.gl.cullFace(d),this.current=d,this.dirty=!1)}}class sP extends Si{getDefault(){return this.gl.CCW}set(d){(d!==this.current||this.dirty)&&(this.gl.frontFace(d),this.current=d,this.dirty=!1)}}let aP=class extends Si{getDefault(){return null}set(_){(_!==this.current||this.dirty)&&(this.gl.useProgram(_),this.current=_,this.dirty=!1)}};class iP extends Si{getDefault(){return this.gl.TEXTURE0}set(d){(d!==this.current||this.dirty)&&(this.gl.activeTexture(d),this.current=d,this.dirty=!1)}}class Py extends Si{getDefault(){const d=this.gl;return[0,0,d.drawingBufferWidth,d.drawingBufferHeight]}set(d){const m=this.current;(d[0]!==m[0]||d[1]!==m[1]||d[2]!==m[2]||d[3]!==m[3]||this.dirty)&&(this.gl.viewport(d[0],d[1],d[2],d[3]),this.current=d,this.dirty=!1)}}class oP extends Si{getDefault(){return null}set(d){if(d===this.current&&!this.dirty)return;const m=this.gl;m.bindFramebuffer(m.FRAMEBUFFER,d),this.current=d,this.dirty=!1}}class Xae extends Si{getDefault(){return null}set(d){if(d===this.current&&!this.dirty)return;const m=this.gl;m.bindRenderbuffer(m.RENDERBUFFER,d),this.current=d,this.dirty=!1}}class Qae extends Si{getDefault(){return null}set(d){if(d===this.current&&!this.dirty)return;const m=this.gl;m.bindTexture(m.TEXTURE_2D,d),this.current=d,this.dirty=!1}}class Jae extends Si{getDefault(){return null}set(d){if(d===this.current&&!this.dirty)return;const m=this.gl;m.bindBuffer(m.ARRAY_BUFFER,d),this.current=d,this.dirty=!1}}class W3 extends Si{getDefault(){return null}set(d){const m=this.gl;m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,d),this.current=d,this.dirty=!1}}class G3 extends Si{getDefault(){return null}set(d){this.gl&&(d!==this.current||this.dirty)&&(this.gl.bindVertexArray(d),this.current=d,this.dirty=!1)}}class K3 extends Si{getDefault(){return 4}set(d){if(d===this.current&&!this.dirty)return;const m=this.gl;m.pixelStorei(m.UNPACK_ALIGNMENT,d),this.current=d,this.dirty=!1}}class Z3 extends Si{getDefault(){return!1}set(d){if(d===this.current&&!this.dirty)return;const m=this.gl;m.pixelStorei(m.UNPACK_PREMULTIPLY_ALPHA_WEBGL,d),this.current=d,this.dirty=!1}}class lP extends Si{getDefault(){return!1}set(d){if(d===this.current&&!this.dirty)return;const m=this.gl;m.pixelStorei(m.UNPACK_FLIP_Y_WEBGL,d),this.current=d,this.dirty=!1}}class Rk extends Si{constructor(d,m){super(d),this.context=d,this.parent=m}getDefault(){return null}}class Fk extends Rk{constructor(d,m,w=0){super(d,m),this.attachmentPoint=d.gl.COLOR_ATTACHMENT0+w}setDirty(){this.dirty=!0}set(d){if(d===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const m=this.gl;m.framebufferTexture2D(m.FRAMEBUFFER,this.attachmentPoint,m.TEXTURE_2D,d,0),this.current=d,this.dirty=!1}}class Ly extends Rk{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 Cv extends Rk{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 cP extends Ly{attachment(){return this.gl.DEPTH_STENCIL_ATTACHMENT}}const yu=(_,d,m,w)=>({u_matrix:_,u_image0:0,u_image1:1,u_skirt_height:d,u_ground_shadow_factor:m,u_emissive_texture_available:w}),zk=(_,d,m,w,M,O,D,B,V,Y,Q,ce,oe,de,we,ve,De)=>({u_proj_matrix:Float32Array.from(_),u_globe_matrix:d,u_normalize_matrix:Float32Array.from(w),u_merc_matrix:m,u_zoom_transition:M,u_merc_center:O,u_image0:0,u_image1:1,u_frustum_tl:D,u_frustum_tr:B,u_frustum_br:V,u_frustum_bl:Y,u_globe_pos:Q,u_globe_radius:ce,u_viewport:oe,u_grid_matrix:De?Float32Array.from(De):new Float32Array(9),u_skirt_height:de,u_far_z_cutoff:we,u_emissive_texture_available:ve});function Mv(_,d){return _!=null&&d!=null&&!(!_.hasData()||!d.hasData())&&_.demTexture!=null&&d.demTexture!=null&&_.tileID.key!==d.tileID.key}const yp=new class{constructor(){this.operations={}}newMorphing(_,d,m,w,M){if(_ in this.operations){const O=this.operations[_];O.to.tileID.key!==m.tileID.key&&(O.queued=m)}else this.operations[_]={startTime:w,phase:0,duration:M,from:d,to:m,queued:null}}getMorphValuesForProxy(_){if(!(_ in this.operations))return null;const d=this.operations[_];return{from:d.from,to:d.to,phase:d.phase}}update(_){for(const d in this.operations){const m=this.operations[d];for(m.phase=(_-m.startTime)/m.duration;m.phase>=1||!this._validOp(m);)if(!this._nextOp(m,_)){delete this.operations[d];break}}}_nextOp(_,d){return!!_.queued&&(_.from=_.to,_.to=_.queued,_.queued=null,_.phase=0,_.startTime=d,!0)}_validOp(_){return _.from.hasData()&&_.to.hasData()}},Bk={0:null,1:"TERRAIN_VERTEX_MORPHING"};function $k(_,d,m){if(d===0)return 0;const w=d<1&&m===514?.25/d:1;return 6*Math.pow(1.5,22-_)*Math.max(d,1)*w}function Y3(_,d){const m=1<<_.z;return!d&&(_.x===0||_.x===m-1)||_.y===0||_.y===m-1}function Oy(_,d){if(!_.style||!_.style.enable3dLights())return;const m=_.context,w=m.gl;m.activeTexture.set(w.TEXTURE1),d?d.bind(w.LINEAR,w.CLAMP_TO_EDGE):_.emptyTexture.bind(w.LINEAR,w.CLAMP_TO_EDGE)}const Tv=_=>({u_matrix:_});function Av(_,d,m,w,M){if(M>0){const O=i.o.now(),D=(O-_.timeAdded)/M,B=d?(O-d.timeAdded)/M:-1,V=m.getSource(),Y=w.coveringZoomLevel({tileSize:V.tileSize,roundZoom:V.roundZoom}),Q=!d||Math.abs(d.tileID.overscaledZ-Y)>Math.abs(_.tileID.overscaledZ-Y),ce=Q&&_.refreshedUponExpiration?1:i.aA(Q?D:1-B,0,1);return d?{opacity:1,mix:1-ce,isFading:D<1}:{opacity:ce,mix:0,isFading:D<1}}return{opacity:1,mix:0,isFading:!1}}class Uk extends Xc{constructor(d){const m=$o("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 X3 extends Xc{constructor(d){const m=$o("proxy",{type:"geojson",maxzoom:d.transform.maxZoom},d.style.dispatcher,d.style);super("proxy",m,!1),m.setEventedParent(this),this.map=this.getSource().map=d,this.used=this._sourceLoaded=!0,this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}update(d,m,w){if(d.freezeTileCoverage)return;this.transform=d;const M=d.coveringTiles({tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled}).reduce((O,D)=>{if(O[D.key]="",!this._tiles[D.key]){const B=new up(D,this._source.tileSize*D.overscaleFactor(),d.tileZoom,void 0,void 0,this._source.worldview);B.state="loaded",this._tiles[D.key]=B}return O},{});for(const O in this._tiles)O in M||(this.freeFBO(O),this._tiles[O].unloadVectorData(),delete this._tiles[O])}freeFBO(d){const m=this.proxyCachedFBO[d];if(m!==void 0){const w=Object.values(m);this.renderCachePool.push(...w),delete this.proxyCachedFBO[d]}}deallocRenderCache(){this.renderCache.forEach(d=>d.fb.destroy()),this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}}class Q3 extends i.aQ{constructor(d,m,w){super(d.overscaledZ,d.wrap,d.canonical.z,d.canonical.x,d.canonical.y),this.proxyTileKey=m,this.projMatrix=w}}class J3 extends i.bV{constructor(d,m){super(),this._debugParams={sortTilesHiZFirst:!0,disableRenderCache:!1},this.painter=d,this.terrainTileForTile={},this.prevTerrainTileForTile={};const[w,M,O]=function(V){const Y=new i.bd,Q=new i.b0,ce=131;Y.reserve(17161),Q.reserve(33800);const oe=i.al/128,de=i.al+oe/2,we=de+oe;for(let De=-oe;Dede||De<0||De>de?24575:0,Xe=i.aA(Math.round(Pe),0,i.al),We=i.aA(Math.round(De),0,i.al);Y.emplaceBack(Xe+Ve,We)}const ve=(De,Pe)=>{const Ve=Pe*ce+De;Q.emplaceBack(Ve+1,Ve,Ve+ce),Q.emplaceBack(Ve+ce,Ve+ce+1,Ve+1)};for(let De=1;De<129;De++)for(let Pe=1;Pe<129;Pe++)ve(Pe,De);return[0,129].forEach(De=>{for(let Pe=0;Pe<130;Pe++)ve(Pe,De),ve(De,Pe)}),[Y,Q,32768]}(),D=d.context;this.gridBuffer=D.createVertexBuffer(w,i.bf.members),this.gridIndexBuffer=D.createIndexBuffer(M),this.gridSegments=i.bg.simpleSegment(0,0,w.length,M.length),this.gridNoSkirtSegments=i.bg.simpleSegment(0,0,w.length,O),this.proxyCoords=[],this.proxiedCoords={},this._visibleDemTiles=[],this._drapedRenderBatches=[],this._sourceTilesOverlap={},this.proxySourceCache=new X3(m.map),this.orthoMatrix=i.bC(),i.ce(this.orthoMatrix,this.painter.transform.projection.name==="globe"?.015:0,i.al,0,i.al,0,1);const B=D.gl;this._overlapStencilMode=new $n({func:B.GEQUAL,mask:255},0,255,B.KEEP,B.KEEP,B.REPLACE),this._previousZoom=d.transform.zoom,this.pool=[],this._findCoveringTileCache={},this._tilesDirty={},this.style=m,this._useVertexMorphing=!0,this._exaggeration=1,this._mockSourceCache=new Uk(m.map),this._pendingGroundEffectLayers=[],this._emissiveTexture=!1}set style(d){d.on("data",this._onStyleDataEvent.bind(this)),this._style=d,this._style.map.on("moveend",()=>{this._clearLineLayersFromRenderCache()})}update(d,m,w){if(d&&d.terrain){this._style!==d&&(this.style=d,this._evaluationZoom=void 0);const M=d.terrain.properties,O=d.terrain.drapeRenderMode===0,D=d.terrain.isZoomDependent();this._previousUpdateTimestamp=this.enabled?this._updateTimestamp:void 0,this._updateTimestamp=i.o.now();const B=d.terrain&&d.terrain.scope,V=M.get("source"),Y=O?this._mockSourceCache:d.getSourceCache(V,B);if(!Y)return void i.w(`Couldn't find terrain source "${V}".`);if(this.sourceCache=Y,this._attenuationRange=d.terrain.getAttenuationRange(),this._exaggeration=D?this.calculateExaggeration(m):M.get("exaggeration"),!m.projection.requiresDraping&&D&&this._exaggeration===0)return void this._disable();this.enabled=!0;const Q=()=>{this.sourceCache.used&&i.w(`Raster DEM source '${this.sourceCache.id}' is used both for terrain and as layer source. This leads to lower resolution of hillshade. For full hillshade resolution but higher memory consumption, define another raster DEM source.`);const ce=this.getScaledDemTileSize();this.sourceCache.update(m,ce,!0),this.resetTileLookupCache(this.sourceCache.id)};this.sourceCache.usedForTerrain||(this.resetTileLookupCache(this.sourceCache.id),this.sourceCache.usedForTerrain=!0,Q(),this._initializing=!0),Q(),m.updateElevation(!0,w),this.resetTileLookupCache(this.proxySourceCache.id),this.proxySourceCache.update(m),this._emptyDEMTextureDirty=!0,this._previousZoom=m.zoom}else this._disable()}calculateExaggeration(d){if(this._attenuationRange&&d.zoom>=Math.ceil(this._attenuationRange[1]))return this._style.terrain.getExaggeration(d.zoom);const m=this._previousCameraAltitude,w=d.getFreeCameraOptions().position.z/d.pixelsPerMeter*d.worldSize;this._previousCameraAltitude=w;const M=m!=null?w-m:Number.MAX_VALUE;if(Math.abs(M)<2)return this._exaggeration;const O=d.zoom,D=this._style.terrain;if(!this._previousUpdateTimestamp)return D.getExaggeration(O);let B=O-this._previousZoom;const V=this._previousUpdateTimestamp;let Y=O;this._evaluationZoom!=null&&(Y=this._evaluationZoom,Math.abs(O-Y)>.5&&(B=.5*(O-Y+B)),B*M<0&&(Y+=B)),this._evaluationZoom=Y;const Q=D.getExaggeration(Y),ce=Q===D.getExaggeration(Math.max(0,Y-.1));if(ce&&Math.abs(Q-this._exaggeration)<.01)return Q;let oe=Math.min(.1,.00375*(this._updateTimestamp-V));return(ce||Q<.1||Math.abs(B)<1e-4)&&(oe=Math.min(.2,4*oe)),i.ak(this._exaggeration,Q,oe)}resetTileLookupCache(d){this._findCoveringTileCache[d]={}}attenuationRange(){return this._attenuationRange}getDemUpscale(){return this.proxySourceCache.getSource().tileSize/128}getScaledDemTileSize(){return this.sourceCache.getSource().tileSize/128*this.proxySourceCache.getSource().tileSize}_onStyleDataEvent(d){d.dataType==="source"&&d.coord?this._clearRenderCacheForTile(d.sourceCacheId,d.coord):d.dataType==="style"&&(this.invalidateRenderCache=!0,this._evaluationZoom=void 0,this._previousUpdateTimestamp=void 0,this._previousCameraAltitude=void 0)}_disable(){if(this.enabled&&(this.enabled=!1,this._emptyDEMTextureDirty=!0,this._sharedDepthStencil=void 0,this._evaluationZoom=void 0,this._previousUpdateTimestamp=void 0,this.proxySourceCache.deallocRenderCache(),this._style))for(const d in this._style._mergedSourceCaches)this._style._mergedSourceCaches[d].usedForTerrain=!1}destroy(){this._disable(),this._emptyDEMTexture&&this._emptyDEMTexture.destroy(),this.pool.forEach(d=>d.fb.destroy()),this.pool=[],this.framebufferCopyTexture&&this.framebufferCopyTexture.destroy()}_source(){return this.enabled?this.sourceCache:null}isUsingMockSource(){return this.sourceCache===this._mockSourceCache}exaggeration(){return this.enabled?this._exaggeration:0}get visibleDemTiles(){return this._visibleDemTiles}get drapeBufferSize(){const d=2*this.proxySourceCache.getSource().tileSize;return[d,d]}set useVertexMorphing(d){this._useVertexMorphing=d}updateTileBinding(d){if(!this.enabled)return;this.prevTerrainTileForTile=this.terrainTileForTile;const m=this.proxySourceCache,w=this.painter.transform;this._initializing&&(this._initializing=w._centerAltitude===0&&this.getAtPointOrZero(i.ae.fromLngLat(w.center),-1)===-1,this._emptyDEMTextureDirty=!this._initializing);const M=this.proxyCoords=m.getIds().map(V=>{const Y=m.getTileByID(V).tileID;return Y.projMatrix=w.calculateProjMatrix(Y.toUnwrapped()),Y});(function(V,Y){const Q=Y.transform.pointCoordinate(Y.transform.getCameraPoint()),ce=new i.P(Q.x,Q.y);V.sort((oe,de)=>{if(de.overscaledZ-oe.overscaledZ)return de.overscaledZ-oe.overscaledZ;const we=new i.P(oe.canonical.x+(1<{this.proxyToSource[V.key]={}}),this.terrainTileForTile={};const D=this._style._mergedSourceCaches;for(const V in D){const Y=D[V];if(!Y.used||(Y!==this.sourceCache&&this.resetTileLookupCache(Y.id),this._setupProxiedCoordsForOrtho(Y,d[V],O),Y.usedForTerrain))continue;const Q=d[V];Y.getSource().reparseOverscaled&&this._assignTerrainTiles(Q)}this.proxiedCoords[m.id]=M.map(V=>new Q3(V,V.key,this.orthoMatrix)),this._assignTerrainTiles(M),this._prepareDEMTextures(),this._setupDrapedRenderBatches(),this._initFBOPool(),this._setupRenderCache(O),this.renderingToTexture=!1;const B={};this._visibleDemTiles=[];for(const V of this.proxyCoords){const Y=this.terrainTileForTile[V.key];if(!Y)continue;const Q=Y.tileID.key;Q in B||(this._visibleDemTiles.push(Y),B[Q]=Q)}}_assignTerrainTiles(d){this._initializing||d.forEach(m=>{if(this.terrainTileForTile[m.key])return;const w=this._findTileCoveringTileID(m,this.sourceCache);w&&(this.terrainTileForTile[m.key]=w)})}_prepareDEMTextures(){const d=this.painter.context,m=d.gl;for(const w in this.terrainTileForTile){const M=this.terrainTileForTile[w],O=M.dem;!O||M.demTexture&&!M.needsDEMTextureUpload||(d.activeTexture.set(m.TEXTURE1),$3(this.painter,M,O))}}_prepareDemTileUniforms(d,m,w,M){if(!m||m.demTexture==null)return!1;const O=d.tileID.canonical,D=Math.pow(2,m.tileID.canonical.z-O.z),B=M||"";return w[`u_dem_tl${B}`]=[O.x*D%1,O.y*D%1],w[`u_dem_scale${B}`]=D,!0}get emptyDEMTexture(){return!this._emptyDEMTextureDirty&&this._emptyDEMTexture?this._emptyDEMTexture:this._updateEmptyDEMTexture()}_getLoadedAreaMinimum(){if(!this.enabled)return 0;let d=0;const m=this._visibleDemTiles.reduce((w,M)=>{if(!M.dem)return w;const O=M.dem.tree.minimums[0];return O>0&&d++,w+O},0);return d?m/d:0}_updateEmptyDEMTexture(){const d=this.painter.context,m=d.gl;d.activeTexture.set(m.TEXTURE2);const w=this._getLoadedAreaMinimum(),M=new i.dL({width:1,height:1},new Float32Array([w]));this._emptyDEMTextureDirty=!1;let O=this._emptyDEMTexture;return O?O.update(M,{premultiply:!1}):O=this._emptyDEMTexture=new i.T(d,M,m.R32F,{premultiply:!1}),O}setupElevationDraw(d,m,w){const M=this.painter.context,O=M.gl,D={u_dem:2,u_dem_prev:4,u_dem_tl:[0,0],u_dem_tl_prev:[0,0],u_dem_scale:0,u_dem_scale_prev:0,u_dem_size:0,u_dem_lerp:1,u_depth:3,u_depth_size_inv:[0,0],u_depth_range_unpack:[0,1],u_occluder_half_size:16,u_occlusion_depth_offset:-1e-4,u_exaggeration:0};D.u_exaggeration=this.exaggeration();let B=null,V=null,Y=1;if(w&&w.morphing&&this._useVertexMorphing){const de=w.morphing.srcDemTile,we=w.morphing.dstDemTile;Y=w.morphing.phase,de&&we&&(this._prepareDemTileUniforms(d,de,D,"_prev")&&(V=de),this._prepareDemTileUniforms(d,we,D)&&(B=we))}const Q=de=>de&&de.demTexture&&this.painter.linearFloatFilteringSupported()?O.LINEAR:O.NEAREST;let ce=null;var oe;if(this.enabled?V&&B?(ce=B.demTexture,M.activeTexture.set(O.TEXTURE4),V.demTexture.bind(Q(V),O.CLAMP_TO_EDGE),D.u_dem_lerp=Y):(B=this.terrainTileForTile[d.tileID.key],ce=this._prepareDemTileUniforms(d,B,D)?B.demTexture:this.emptyDEMTexture):ce=this.emptyDEMTexture,M.activeTexture.set(O.TEXTURE2),ce&&(D.u_dem_size=(oe=ce).size[0]===1?1:oe.size[0]-2,ce.bind(Q(B),O.CLAMP_TO_EDGE)),this.painter.setupDepthForOcclusion(w&&w.useDepthForOcclusion,m,D),w&&w.useMeterToDem&&B){const de=(1<{if(Pe===Wt)return;const sr=[Bk[Wt],"PROJECTION_GLOBE_VIEW"];Xe&&sr.push("CUSTOM_ANTIALIASING");const _r=Y.isTileAffectedByFog(Ht);De=Y.getOrCreateProgram("globeRaster",{defines:sr,overrideFog:_r}),Pe=Wt},bt=Y.colorModeForRenderPass(),ut=new dn(ve.LEQUAL,dn.ReadWrite,Y.depthRangeFor3D);yp.update(de);const xt=i.dF(Ve),ct=[i.aF(Ve.center.lng),i.aJ(Ve.center.lat)],it=Y.globeSharedBuffers,St=[Ve.width*i.o.devicePixelRatio,Ve.height*i.o.devicePixelRatio],Dt=Float32Array.from(Ve.globeMatrix),Lt={useDenormalizedUpVectorScale:!0};{const Ht=Y.transform,Wt=$k(Ht.zoom,Q.exaggeration(),Q.sourceCache._source.tileSize);Pe=-1;const sr=ve.TRIANGLES;for(const _r of oe){const Bt=ce.getTile(_r),Tt=$n.disabled,Jt=Q.prevTerrainTileForTile[_r.key],qt=Q.terrainTileForTile[_r.key];Mv(Jt,qt)&&yp.newMorphing(_r.key,Jt,qt,de,250),Oy(Y,Bt.emissiveTexture),we.activeTexture.set(ve.TEXTURE0),Bt.texture&&Bt.texture.bind(ve.LINEAR,ve.CLAMP_TO_EDGE);const dr=yp.getMorphValuesForProxy(_r.key),Tr=dr?1:0;dr&&Object.assign(Lt,{morphing:{srcDemTile:dr.from,dstDemTile:dr.to,phase:i.dD(dr.phase)}});const Hr=i.dG(_r.canonical),Nr=i.dH(Hr.getCenter().lat),br=i.dI(_r.canonical,Hr,Nr,Ht.worldSize/Ht._pixelsPerMercatorPixel),nn=i.bk(i.dJ(_r.canonical)),Jr=Y.emissiveMode==="mrt-fallback"?1:0,zr=zk(Ht.expandedFarZProjMatrix,Dt,xt,nn,i.aj(Ht.zoom),ct,Ht.frustumCorners.TL,Ht.frustumCorners.TR,Ht.frustumCorners.BR,Ht.frustumCorners.BL,Ht.globeCenterInViewSpace,Ht.globeRadius,St,Wt,Ht._farZ,Jr,br);if(We(_r,Tr),De&&(Q.setupElevationDraw(Bt,De,Lt),Y.uploadCommonUniforms(we,De,_r.toUnwrapped()),it)){const[Gr,kn,Yn]=it.getGridBuffers(Nr,Wt!==0);De.draw(Y,sr,ut,Tt,bt,zn.backCCW,zr,"globe_raster",Gr,kn,Yn)}}}if(it&&(Y.renderDefaultNorthPole||Y.renderDefaultSouthPole)){const Ht=["GLOBE_POLES","PROJECTION_GLOBE_VIEW"];Xe&&Ht.push("CUSTOM_ANTIALIASING"),De=Y.getOrCreateProgram("globeRaster",{defines:Ht});for(const Wt of oe){const{x:sr,y:_r,z:Bt}=Wt.canonical,Tt=_r===0,Jt=_r===(1<Gr.draw(Y,ve.TRIANGLES,ut,$n.disabled,bt,zn.disabled,zk(Ve.expandedFarZProjMatrix,br,br,nn,0,ct,Ve.frustumCorners.TL,Ve.frustumCorners.TR,Ve.frustumCorners.BR,Ve.frustumCorners.BL,Ve.globeCenterInViewSpace,Ve.globeRadius,St,0,Ve._farZ,Jr),"globe_pole_raster",kn,Tr,Hr);Q.setupElevationDraw(Nr,De,Lt),Y.uploadCommonUniforms(we,De,Wt.toUnwrapped()),Tt&&Y.renderDefaultNorthPole&&zr(De,qt),Jt&&Y.renderDefaultSouthPole&&(br=i.cS(i.bC(),br,[1,-1,1]),zr(De,dr))}}}})(M,O,D,B,V);else{const Y=M.context,Q=Y.gl;let ce,oe;const de=M.shadowRenderer,we=Em(M,M.longestCutoffRange),ve=bt=>{if(oe===bt)return;const ut=[];ut.push(Bk[bt]),we.shouldRenderCutoff&&ut.push("RENDER_CUTOFF"),de&&(ut.push("RENDER_SHADOWS","DEPTH_TEXTURE"),de.useNormalOffset&&ut.push("NORMAL_OFFSET")),ce=M.getOrCreateProgram("terrainRaster",{defines:ut}),oe=bt},De=M.colorModeForRenderPass(),Pe=new dn(Q.LEQUAL,dn.ReadWrite,M.depthRangeFor3D);yp.update(V);const Ve=M.transform,Xe=$k(Ve.zoom,O.exaggeration(),O.sourceCache._source.tileSize);let We=[0,0,0];if(de){const bt=M.style.directionalLight,ut=M.style.ambientLight;bt&&ut&&(We=xp(M.style,bt,ut))}{oe=-1;const bt=Q.TRIANGLES,[ut,xt]=[O.gridIndexBuffer,O.gridSegments];for(const ct of B){const it=D.getTile(ct),St=$n.disabled,Dt=O.prevTerrainTileForTile[ct.key],Lt=O.terrainTileForTile[ct.key];Mv(Dt,Lt)&&yp.newMorphing(ct.key,Dt,Lt,V,250),Oy(M,it.emissiveTexture),Y.activeTexture.set(Q.TEXTURE0),it.texture&&it.texture.bind(Q.LINEAR,Q.CLAMP_TO_EDGE);const Ht=yp.getMorphValuesForProxy(ct.key),Wt=Ht?1:0;let sr;Ht&&(sr={morphing:{srcDemTile:Ht.from,dstDemTile:Ht.to,phase:i.dD(Ht.phase)}});const _r=M.emissiveMode==="mrt-fallback"?1:0,Bt=yu(ct.projMatrix,Y3(ct.canonical,Ve.renderWorldCopies)?Xe/10:Xe,We,_r);if(ve(Wt),!ce)continue;O.setupElevationDraw(it,ce,sr);const Tt=ct.toUnwrapped();de&&de.setupShadows(Tt,ce),M.uploadCommonUniforms(Y,ce,Tt,null,we),ce.draw(M,bt,Pe,St,De,zn.backCCW,Bt,"terrain_raster",O.gridBuffer,ut,xt)}}}}(m,this,this.proxySourceCache,d,this._updateTimestamp),this.renderingToTexture=!0,m.gpuTimingDeferredRenderEnd(),d.splice(0,d.length))}renderBatch(d){if(this._drapedRenderBatches.length===0)return d+1;this.renderingToTexture=!0;const m=this.painter,w=this.painter.context,M=this.proxySourceCache,O=this.proxiedCoords[M.id],D=this._drapedRenderBatches.shift(),B=m.style.order,V=[];this._updateFBOs(m.emissiveMode==="mrt-fallback");let Y=0;for(const Q of O){const ce=M.getTileByID(Q.proxyTileKey),oe=M.proxyCachedFBO[Q.key]?M.proxyCachedFBO[Q.key][d]:void 0,de=oe!==void 0?M.renderCache[oe]:this.pool[Y++],we=oe!==void 0;if(ce.texture=de.tex,ce.emissiveTexture=de.emissiveTex,we&&!de.dirty){V.push(ce.tileID);continue}w.bindFramebuffer.set(de.fb.framebuffer);const ve=w.gl;let De;ve.drawBuffers(m.emissiveMode==="mrt-fallback"?[ve.COLOR_ATTACHMENT0,ve.COLOR_ATTACHMENT1]:[ve.COLOR_ATTACHMENT0]),this.renderedToTile=!1,de.dirty&&(w.clear({color:i.ao.transparent,stencil:0}),de.dirty=!1);for(let Pe=D.start;Pe<=D.end;++Pe){const Ve=m.style._mergedLayers[B[Pe]];if(Ve.isHidden(m.transform.zoom))continue;const Xe=m.style.getLayerSourceCache(Ve),We=Xe?this.proxyToSource[Q.key][Xe.id]:[Q];if(!We)continue;const bt=We;w.viewport.set([0,0,de.fb.width,de.fb.height]),De!==(Xe?Xe.id:null)&&(this._setupStencil(de,We,Ve,Xe),De=Xe?Xe.id:null),m.renderLayer(m,Xe,Ve,bt)}if(ve.drawBuffers([ve.COLOR_ATTACHMENT0]),this._drapedRenderBatches.length===0)for(const Pe of this._pendingGroundEffectLayers){const Ve=m.style._mergedLayers[B[Pe]];if(Ve.isHidden(m.transform.zoom))continue;const Xe=m.style.getLayerSourceCache(Ve),We=Xe?this.proxyToSource[Q.key][Xe.id]:[Q];if(!We)continue;const bt=We;w.viewport.set([0,0,de.fb.width,de.fb.height]),De!==(Xe?Xe.id:null)&&(this._setupStencil(de,We,Ve,Xe),De=Xe?Xe.id:null),m.renderLayer(m,Xe,Ve,bt)}this.renderedToTile?(de.dirty=!0,V.push(ce.tileID)):we||--Y,Y===5&&(Y=0,this.renderToBackBuffer(V))}return this.renderToBackBuffer(V),this.renderingToTexture=!1,w.bindFramebuffer.set(null),w.viewport.set([0,0,m.width,m.height]),D.end+1}postRender(){}isLayerOrderingCorrect(d){const m=d.order.length;let w=-1,M=m;for(let O=0;Ow}getMinElevationBelowMSL(){let d=0;return this._visibleDemTiles.filter(m=>m.dem).forEach(m=>{d=Math.min(d,m.dem.tree.minimums[0])}),d===0?d:(d-30)*this._exaggeration}raycast(d,m,w){if(!this._visibleDemTiles)return null;const M=this._visibleDemTiles.filter(O=>O.dem).map(O=>{const D=O.tileID,B=1<(O.t!==null?O.t:Number.MAX_VALUE)-(D.t!==null?D.t:Number.MAX_VALUE));for(const O of M){if(O.t==null)return null;const D=O.tile.dem.tree.raycast(O.minx,O.miny,O.maxx,O.maxy,d,m,w);if(D!=null)return D}return null}_createFBO(){const d=this.painter.context,m=d.gl,w=this.drapeBufferSize;d.activeTexture.set(m.TEXTURE0);const M=new i.T(d,{width:w[0],height:w[1],data:null},m.RGBA8);M.bind(m.LINEAR,m.CLAMP_TO_EDGE);const O=d.createFramebuffer(w[0],w[1],1,null);let D;return O.colorAttachment0.set(M.texture),this._emissiveTexture&&(D=new i.T(d,{width:w[0],height:w[1],data:null},m.R8),D.bind(m.LINEAR,m.CLAMP_TO_EDGE),O.createColorAttachment(d,1),O.colorAttachment1.set(D.texture)),O.depthAttachment=new cP(d,O.framebuffer),this._sharedDepthStencil===void 0?(this._sharedDepthStencil=d.createRenderbuffer(d.gl.DEPTH_STENCIL,w[0],w[1]),this._stencilRef=0,O.depthAttachment.set(this._sharedDepthStencil),d.clear({stencil:0})):O.depthAttachment.set(this._sharedDepthStencil),d.extTextureFilterAnisotropic&&m.texParameterf(m.TEXTURE_2D,d.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,d.extTextureFilterAnisotropicMax),{fb:O,tex:M,emissiveTex:D,dirty:!1}}_updateFBOs(d){if(this._emissiveTexture!==d){for(const m of this.pool)this._updateFBO(m,d);for(const m of this.proxySourceCache.renderCache)this._updateFBO(m,d);this._emissiveTexture=d}}_updateFBO(d,m){const w=d.fb,M=this.painter.context,O=M.gl,D=this.drapeBufferSize;if(m){const B=new i.T(M,{width:D[0],height:D[1],data:null},O.R8);B.bind(O.LINEAR,O.CLAMP_TO_EDGE),d.emissiveTex=B,w.createColorAttachment(M,1),w.colorAttachment1.set(B.texture)}else d.emissiveTex=void 0,w.removeColorAttachment(M,1);d.dirty=!0}_initFBOPool(){for(;this.pool.length{const m=this._style._mergedLayers[d],w=m.isHidden(this.painter.transform.zoom);return m.type==="hillshade"||m.type==="custom"?!w&&m.shouldRedrape():!w&&m.hasTransition()})}_clearLineLayersFromRenderCache(){let d=!1;for(const w of this._style.getSources())if(w instanceof mf){d=!0;break}if(!d)return;const m={};for(let w=0;wV>B.end)||i.w("fill-extrusion with flood lighting and/or ground ambient occlusion should be moved to be on top of all draped layers.")}this._drapedRenderBatches=w}_setupRenderCache(d){const m=this.proxySourceCache;if(this._shouldDisableRenderCache()||this.invalidateRenderCache){if(this.invalidateRenderCache=!1,m.renderCache.length>m.renderCachePool.length){const D=Object.values(m.proxyCachedFBO);m.proxyCachedFBO={};for(let B=0;B=0;D--){const B=w[D];if(m.getTileByID(B.key),m.proxyCachedFBO[B.key]!==void 0){const V=d[B.key],Y=this.proxyToSource[B.key];let Q=0;for(const ce in Y){const oe=Y[ce],de=V[ce];if(!de||de.length!==oe.length||oe.some((we,ve)=>we!==de[ve]||M[ce]&&M[ce].hasOwnProperty(we.key))){Q=-1;break}++Q}for(const ce in m.proxyCachedFBO[B.key])m.renderCache[m.proxyCachedFBO[B.key][ce]].dirty=Q<0||Q!==Object.values(V).length}}const O=[...this._drapedRenderBatches];O.sort((D,B)=>B.end-B.start-(D.end-D.start));for(const D of O)for(const B of w){if(m.proxyCachedFBO[B.key])continue;let V=m.renderCachePool.pop();V===void 0&&m.renderCache.length<50&&(V=m.renderCache.length,m.renderCache.push(this._createFBO())),V!==void 0&&(m.proxyCachedFBO[B.key]={},m.proxyCachedFBO[B.key][D.start]=V,m.renderCache[V].dirty=!0)}this._tilesDirty={}}_setupStencil(d,m,w,M){if(!M||!this._sourceTilesOverlap[M.id])return void(this._overlapStencilType&&(this._overlapStencilType=!1));const O=this.painter.context,D=O.gl;if(m.length<=1)return void(this._overlapStencilType=!1);let B;if(w.isTileClipped())B=m.length,this._overlapStencilMode.test={func:D.EQUAL,mask:255},this._overlapStencilType="Clip";else{if(!(m[0].overscaledZ>m[m.length-1].overscaledZ))return void(this._overlapStencilType=!1);B=1,this._overlapStencilMode.test={func:D.GREATER,mask:255},this._overlapStencilType="Mask"}this._stencilRef+B>255&&(O.clear({stencil:0}),this._stencilRef=0),this._stencilRef+=B,this._overlapStencilMode.ref=this._stencilRef,w.isTileClipped()&&this._renderTileClippingMasks(m,this._overlapStencilMode.ref)}clipOrMaskOverlapStencilType(){return this._overlapStencilType==="Clip"||this._overlapStencilType==="Mask"}stencilModeForRTTOverlap(d){return this.renderingToTexture&&this._overlapStencilType?(this._overlapStencilType==="Clip"&&(this._overlapStencilMode.ref=this.painter._tileClippingMaskIDs[d.key]),this._overlapStencilMode):$n.disabled}_renderTileClippingMasks(d,m){const w=this.painter,M=this.painter.context,O=M.gl;w._tileClippingMaskIDs={},M.setColorMode(as.disabled),M.setDepthMode(dn.disabled);const D=w.getOrCreateProgram("clippingMask");for(const B of d){const V=w._tileClippingMaskIDs[B.key]=--m;D.draw(w,O.TRIANGLES,dn.disabled,new $n({func:O.ALWAYS,mask:0},V,255,O.KEEP,O.KEEP,O.REPLACE),as.disabled,zn.disabled,Tv(B.projMatrix),"$clipping",w.tileExtentBuffer,w.quadTriangleIndexBuffer,w.tileExtentSegments)}}pointCoordinate(d){const m=this.painter.transform;if(d.x<0||d.x>m.width||d.y<0||d.y>m.height)return null;const w=[d.x,d.y,1,1];i.aC(w,w,m.pixelMatrixInverse),i.cK(w,w,1/w[3]),w[0]/=m.worldSize,w[1]/=m.worldSize;const M=m._camera.position,O=i.cf(1,m.center.lat),D=[M[0],M[1],M[2]/O,0],B=i.da([],w.slice(0,3),D);i.aw(B,B);const V=this.raycast(D,B,this._exaggeration);return V!==null&&V?(i.bH(D,D,B,V),D[3]=D[2],D[2]*=O,D):null}_setupProxiedCoordsForOrtho(d,m,w){if(d.getSource()instanceof i.aU)return this._setupProxiedCoordsForImageSource(d,m,w);this._findCoveringTileCache[d.id]=this._findCoveringTileCache[d.id]||{};const M=this.proxiedCoords[d.id]=[],O=this.proxyCoords;for(let V=0;VQ.overscaledZ-Y.overscaledZ)}_setupProxiedCoordsForImageSource(d,m,w){if(!d.getSource().loaded())return;const M=this.proxiedCoords[d.id]=[],O=this.proxyCoords,D=d.getSource(),B=D.tileID;if(!B)return;const V=new i.P(B.x,B.y)._div(1<(ce.min.x=Math.min(ce.min.x,oe.x-V.x),ce.min.y=Math.min(ce.min.y,oe.y-V.y),ce.max.x=Math.max(ce.max.x,oe.x-V.x),ce.max.y=Math.max(ce.max.y,oe.y-V.y),ce),{min:new i.P(Number.MAX_VALUE,Number.MAX_VALUE),max:new i.P(-Number.MAX_VALUE,-Number.MAX_VALUE)}),Q=(ce,oe)=>{const de=ce.wrap+ce.canonical.x/(1<De+Y.max.x||we+vePe+Y.max.y};for(let ce=0;ceD.key===m.tileID.key);if(O)return O}if(m.tileID.key!==d.key){const O=d.canonical.z-m.tileID.canonical.z;let D,B,V;M=i.bC();const Y=m.tileID.wrap-d.wrap<0?(D=i.al>>O,B=D*((m.tileID.canonical.x<=ce){const oe=d.canonical.z-ce;m.getSource().reparseOverscaled?(B=Math.max(d.canonical.z+2,m.transform.tileZoom),D=new i.aQ(B,d.wrap,ce,d.canonical.x>>oe,d.canonical.y>>oe)):oe!==0&&(B=ce,D=new i.aQ(B,d.wrap,ce,d.canonical.x>>oe,d.canonical.y>>oe))}D.key!==d.key&&(Y.push(D.key),w=m.getTile(D))}const Q=ce=>{Y.forEach(oe=>{M[oe]=ce}),Y.length=0};for(B-=1;B>=V&&(!w||!w.hasData());B--){w&&Q(w.tileID.key);const ce=D.calculateScaledKey(B);if(w=m.getTileByID(ce),w&&w.hasData())break;const oe=M[ce];if(oe===null)break;oe===void 0?Y.push(ce):w=m.getTileByID(oe)}return Q(w?w.tileID.key:null),w&&w.hasData()?w:null}findDEMTileFor(d){return this.enabled?this._findTileCoveringTileID(d,this.sourceCache):null}prepareDrawTile(){this.renderedToTile=!0}_clearRenderCacheForTile(d,m){let w=this._tilesDirty[d];w||(w=this._tilesDirty[d]={}),w[m.key]=!0}}function Dy(_,d,m){const w=function(B,V,Y){const Q=i.bJ(V,B),ce=i.bJ(Y,[.2126,.7152,.0722]),oe=(we,ve,De)=>(1-De)*we+De*ve,de=oe(1-.3*Math.min(ce,1),1,Math.min(Q+1,1));return oe(.92,1,Math.asin(i.aA(V[2],-1,1))/Math.PI+.5)*de}(_,[0,0,1],d),M=[0,0,0];i.c5(M,m.slice(0,3),w);const O=[0,0,0];i.c5(O,d.slice(0,3),_[2]);const D=[0,0,0];return i.d8(D,M,O),i.db(D)}const eie=["fill","fillOutline","fillPattern","line","linePattern","background","backgroundPattern","hillshade","raster"],tie=["stars","rainParticle","snowParticle","fillExtrusion","fillExtrusionGroundEffect","building","buildingBloom","elevatedStructures","model","symbol"];class dP{static cacheKey(d,m,w,M){const O=[m];M&&O.push(M.cacheKey);for(const D of w)d.usedDefines.has(D)&&O.push(D);return O.join("/")}constructor(d,m,w,M,O,D){const B=d.gl;this.program=B.createProgram(),this.configuration=M,this.name=m,this.fixedDefines=[...D];const V=`#version 300 es ${(M?M.defines():[]).concat(D.map(ve=>`#define ${ve}`)).join(` `)}`,Y=[V,Hae];for(const ve of w.fragmentIncludes)Y.push(Om[ve]);Y.push(w.fragmentSource);const Q=Y.join(` `),ce=[V,eP];for(const ve of w.vertexIncludes)ce.push(Om[ve]);this.forceManualRenderingForInstanceIDShaders=d.forceManualRenderingForInstanceIDShaders&&w.vertexSource.includes("gl_InstanceID"),this.forceManualRenderingForInstanceIDShaders&&ce.push("uniform int u_instanceID;"),ce.push(w.vertexSource);let oe=ce.join(` `);this.forceManualRenderingForInstanceIDShaders&&(oe=oe.replaceAll("gl_InstanceID","u_instanceID"));const de=B.createShader(B.FRAGMENT_SHADER);if(B.isContextLost())return void(this.failedToCreate=!0);B.shaderSource(de,Q),B.compileShader(de),B.attachShader(this.program,de);const we=B.createShader(B.VERTEX_SHADER);B.isContextLost()?this.failedToCreate=!0:(B.shaderSource(we,oe),B.compileShader(we),B.attachShader(this.program,we),this.attributes={},B.linkProgram(this.program),B.deleteShader(we),B.deleteShader(de),this.fixedUniforms=O(d),this.fixedUniformsEntries=Object.entries(this.fixedUniforms),this.binderUniforms=M?M.getUniforms(d):[],this.forceManualRenderingForInstanceIDShaders&&(this.instancingUniforms=(ve=>({u_instanceID:new i.ch(ve)}))(d)),(D.includes("TERRAIN")||m.includes("symbol")||m.includes("circle"))&&(this.terrainUniforms=(ve=>({u_dem:new i.ch(ve),u_dem_prev:new i.ch(ve),u_dem_tl:new i.ck(ve),u_dem_scale:new i.cj(ve),u_dem_tl_prev:new i.ck(ve),u_dem_scale_prev:new i.cj(ve),u_dem_size:new i.cj(ve),u_dem_lerp:new i.cj(ve),u_exaggeration:new i.cj(ve),u_depth:new i.ch(ve),u_depth_size_inv:new i.ck(ve),u_depth_range_unpack:new i.ck(ve),u_occluder_half_size:new i.cj(ve),u_occlusion_depth_offset:new i.cj(ve),u_meter_to_dem:new i.cj(ve),u_label_plane_matrix_inv:new i.cl(ve)}))(d)),D.includes("GLOBE")&&(this.globeUniforms=(ve=>({u_tile_tl_up:new i.ci(ve),u_tile_tr_up:new i.ci(ve),u_tile_br_up:new i.ci(ve),u_tile_bl_up:new i.ci(ve),u_tile_up_scale:new i.cj(ve)}))(d)),D.includes("FOG")&&(this.fogUniforms=(ve=>({u_fog_matrix:new i.cl(ve),u_fog_range:new i.ck(ve),u_fog_color:new i.d3(ve),u_fog_horizon_blend:new i.cj(ve),u_fog_vertical_limit:new i.ck(ve),u_fog_temporal_offset:new i.cj(ve),u_frustum_tl:new i.ci(ve),u_frustum_tr:new i.ci(ve),u_frustum_br:new i.ci(ve),u_frustum_bl:new i.ci(ve),u_globe_pos:new i.ci(ve),u_globe_radius:new i.cj(ve),u_globe_transition:new i.cj(ve),u_is_globe:new i.ch(ve),u_viewport:new i.ck(ve)}))(d)),D.includes("RENDER_CUTOFF")&&(this.cutoffUniforms=(ve=>({u_cutoff_params:new i.d3(ve)}))(d)),D.includes("LIGHTING_3D_MODE")&&(this.lightsUniforms=(ve=>({u_lighting_ambient_color:new i.ci(ve),u_lighting_directional_dir:new i.ci(ve),u_lighting_directional_color:new i.ci(ve),u_ground_radiance:new i.ci(ve)}))(d)),D.includes("RENDER_SHADOWS")&&(this.shadowUniforms=(ve=>({u_light_matrix_0:new i.cl(ve),u_light_matrix_1:new i.cl(ve),u_fade_range:new i.ck(ve),u_shadow_normal_offset:new i.ci(ve),u_shadow_intensity:new i.cj(ve),u_shadow_texel_size:new i.cj(ve),u_shadow_map_resolution:new i.cj(ve),u_shadow_direction:new i.ci(ve),u_shadow_bias:new i.ci(ve),u_shadowmap_0:new i.ch(ve),u_shadowmap_1:new i.ch(ve)}))(d)))}getAttributeLocation(d,m){let w=this.attributes[m];return w===void 0&&(w=this.attributes[m]=d.getAttribLocation(this.program,m)),w}setTerrainUniformValues(d,m){if(!this.terrainUniforms)return;const w=this.terrainUniforms;if(!this.failedToCreate){d.program.set(this.program);for(const M in m)w[M]&&w[M].set(this.program,M,m[M])}}setGlobeUniformValues(d,m){if(!this.globeUniforms)return;const w=this.globeUniforms;if(!this.failedToCreate){d.program.set(this.program);for(const M in m)w[M]&&w[M].set(this.program,M,m[M])}}setFogUniformValues(d,m){if(!this.fogUniforms)return;const w=this.fogUniforms;if(!this.failedToCreate){d.program.set(this.program);for(const M in m)w[M].set(this.program,M,m[M])}}setCutoffUniformValues(d,m){if(!this.cutoffUniforms)return;const w=this.cutoffUniforms;if(!this.failedToCreate){d.program.set(this.program);for(const M in m)w[M].set(this.program,M,m[M])}}setLightsUniformValues(d,m){if(!this.lightsUniforms)return;const w=this.lightsUniforms;if(!this.failedToCreate){d.program.set(this.program);for(const M in m)w[M].set(this.program,M,m[M])}}setShadowUniformValues(d,m){if(this.failedToCreate||!this.shadowUniforms)return;const w=this.shadowUniforms;d.program.set(this.program);for(const M in m)w[M].set(this.program,M,m[M])}_drawDebugWireframe(d,m,w,M,O,D,B,V,Y,Q){const ce=d.options.wireframe;if(ce.terrain===!1&&ce.layers2D===!1&&ce.layers3D===!1)return;const oe=d.context;if(!(!(!ce.terrain||this.name!=="terrainRaster"&&this.name!=="globeRaster")||!(!ce.layers2D||d._terrain&&d._terrain.renderingToTexture||!eie.includes(this.name))||!(!ce.layers3D||!tie.includes(this.name))))return;const de=oe.gl,we=d.wireframeDebugCache.getLinesFromTrianglesBuffer(d.frameCounter,O,oe);if(!we)return;const ve=[...this.fixedDefines,"DEBUG_WIREFRAME"],De=d.getOrCreateProgram(this.name,{config:this.configuration,defines:ve});oe.program.set(De.program);const Pe=(We,bt,ut)=>{if(bt[We]&&ut[We])for(const xt in bt[We])ut[We][xt]&&ut[We][xt].set(ut.program,xt,bt[We][xt].current)};Y&&Y.setUniforms(De.program,oe,De.binderUniforms,B,{zoom:V}),Pe("fixedUniforms",this,De),Pe("terrainUniforms",this,De),Pe("globeUniforms",this,De),Pe("fogUniforms",this,De),Pe("lightsUniforms",this,De),Pe("shadowUniforms",this,De),we.bind(),oe.setColorMode(new as([de.ONE,de.ONE_MINUS_SRC_ALPHA,de.ZERO,de.ONE],i.ao.transparent,[!0,!0,!0,!1])),oe.setDepthMode(new dn(m.func===de.LESS?de.LEQUAL:m.func,dn.ReadOnly,m.range)),oe.setStencilMode($n.disabled);const Ve=3*D.primitiveLength*2,Xe=3*D.primitiveOffset*2*2;if(this.forceManualRenderingForInstanceIDShaders){const We=Q||1;for(let bt=0;bt1?de.drawElementsInstanced(de.LINES,Ve,de.UNSIGNED_SHORT,Xe,Q):de.drawElements(de.LINES,Ve,de.UNSIGNED_SHORT,Xe);O.bind(),oe.program.set(this.program),oe.setDepthMode(m),oe.setStencilMode(w),oe.setColorMode(M)}checkUniforms(d,m,w){if(this.fixedDefines.includes(m)){for(const M of Object.keys(w))if(!w[M].initialized)throw new Error(`Program '${this.name}', from draw '${d}': uniform ${M} not set but required by ${m} being defined`)}}draw(d,m,w,M,O,D,B,V,Y,Q,ce,oe,de,we,ve,De){const Pe=d.context,Ve=Pe.gl;if(this.failedToCreate)return;Pe.program.set(this.program),Pe.setDepthMode(w),Pe.setStencilMode(M),Pe.setColorMode(O),Pe.setCullFace(D);for(const[ct,it]of this.fixedUniformsEntries)it.set(this.program,ct,B[ct]);we&&we.setUniforms(this.program,Pe,this.binderUniforms,oe,{zoom:de});const Xe={[Ve.POINTS]:1,[Ve.LINES]:2,[Ve.TRIANGLES]:3,[Ve.LINE_STRIP]:1}[m];this.checkUniforms(V,"RENDER_SHADOWS",this.shadowUniforms);const We=ve||[],bt=we?we.getPaintVertexBuffers():[],ut=m===Ve.TRIANGLES&&Q,xt=De&&De>0?1:void 0;for(const ct of ce.get()){const it=ct.vaos||(ct.vaos={});if((it[V]||(it[V]=new Wae)).bind(Pe,this,Y,bt,Q,ct.vertexOffset,We,xt),this.forceManualRenderingForInstanceIDShaders){const St=De||1;for(let Dt=0;Dt1?Ve.drawElementsInstanced(m,ct.primitiveLength*Xe,Ve.UNSIGNED_SHORT,ct.primitiveOffset*Xe*2,De):Q?Ve.drawElements(m,ct.primitiveLength*Xe,Ve.UNSIGNED_SHORT,ct.primitiveOffset*Xe*2):Ve.drawArrays(m,ct.vertexOffset,ct.vertexLength);ut&&this._drawDebugWireframe(d,w,M,O,Q,ct,oe,de,we,De)}}}function uP(_,d,m=0){const w=Math.pow(2,d.tileID.overscaledZ),M=d.tileSize*Math.pow(2,_.transform.tileZoom)/w,O=M*(d.tileID.canonical.x+d.tileID.wrap*w),D=M*d.tileID.canonical.y;return{u_image:0,u_texsize:d.imageAtlasTexture?d.imageAtlasTexture.size:[0,0],u_tile_units_to_pixels:1/i.ay(d,1,_.transform.tileZoom),u_pixel_coord_upper:[O>>16,D>>16],u_pixel_coord_lower:[65535&O,65535&D],u_pattern_transition:m}}const qk={terrain:0,flat:1},rie=i.bC(),Vk=(_,d,m,w,M,O,D,B,V,Y,Q,ce,oe,de,we,ve,De,Pe)=>{const Ve=d.style.light,Xe=Ve.properties.get("position"),We=[Xe.x,Xe.y,Xe.z],bt=i.dO();Ve.properties.get("anchor")==="viewport"&&(i.dP(bt,-d.transform.angle),i.dQ(We,We,bt));const ut=Ve.properties.get("color").toPremultipliedRenderColor(null),xt=d.transform,ct={u_matrix:_,u_lightpos:We,u_lightintensity:Ve.properties.get("intensity"),u_lightcolor:[ut.r,ut.g,ut.b],u_vertical_gradient:+m,u_opacity:w,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:rie,u_merc_center:[0,0],u_up_dir:[0,0,0],u_height_lift:0,u_height_type:qk[Y],u_base_type:qk[Q],u_ao:M,u_edge_radius:O,u_width_scale:D,u_flood_light_color:we,u_vertical_scale:ve,u_flood_light_intensity:De,u_ground_shadow_factor:Pe};return xt.projection.name==="globe"&&(ct.u_tile_id=[B.canonical.x,B.canonical.y,1<({u_matrix:_,u_edge_radius:d,u_width_scale:m,u_vertical_scale:w,u_height_type:qk[M],u_base_type:qk[O]}),hP=(_,d,m,w,M,O,D,B,V,Y,Q,ce,oe,de,we,ve,De,Pe)=>{const Ve=Vk(_,d,m,w,M,O,D,B,Y,Q,ce,oe,de,we,ve,De,1,[0,0,0]),Xe={u_height_factor:-Math.pow(2,B.overscaledZ)/V.tileSize/8};return Object.assign(Ve,uP(d,V,Pe),Xe)},Ry=(_,d,m,w,M,O,D,B,V,Y,Q)=>({u_matrix:d,u_opacity:m,u_ao_pass:w?1:0,u_meter_to_tile:M,u_ao:O,u_flood_light_intensity:D,u_flood_light_color:B,u_attenuation:V,u_edge_radius:Y,u_fb:0,u_fb_size:Q,u_dynamic_offset:1}),t5=(_,d,m)=>({u_matrix:_,u_emissive_strength:d,u_ground_shadow_factor:m}),r5=(_,d,m,w,M,O=0)=>Object.assign(t5(_,d,M),uP(m,w,O)),fP=(_,d,m,w)=>({u_matrix:_,u_world:m,u_emissive_strength:d,u_ground_shadow_factor:w}),n5=(_,d,m,w,M,O,D=0)=>Object.assign(r5(_,d,m,w,O,D),{u_world:M}),Rm=(_,d)=>({u_matrix:_,u_ground_shadow_factor:d}),Yg=(_,d,m,w,M)=>({u_matrix:_,u_camera_pos:[d[0],d[1],d[2]],u_depth_bias:m,u_height_scale:w,u_reset_depth:M}),Hk=(_,d,m,w,M,O,D,B,V)=>({u_matrix:_,u_normal_matrix:d,u_opacity:m,u_faux_facade_ao_intensity:w,u_camera_pos:M,u_tile_to_meter:O,u_facade_emissive_chance:D,u_flood_light_color:B,u_flood_light_intensity:V}),pP=_=>({u_matrix:_}),Fm=_=>({u_matrix:_}),s5=(_,d,m,w,M,O,D,B)=>{const V=i.al/O.tileSize;return{u_matrix:_,u_inv_rot_matrix:d,u_camera_to_center_distance:m.getCameraToCenterDistance(B),u_extrude_scale:[m.pixelsToGLUnits[0]/V,m.pixelsToGLUnits[1]/V],u_zoom_transition:w,u_tile_id:D,u_merc_center:M}},Ev=(_,d,m=1)=>({u_matrix:_,u_color:d,u_overlay:0,u_overlay_scale:m}),mP=i.bC(),gP=(_,d,m,w,M,O,D)=>{const B=_.transform,V=B.projection.name==="globe",Y=V?i.dR(B.zoom,d.canonical)*B._pixelsPerMercatorPixel:i.ay(m,1,O),Q={u_matrix:d.projMatrix,u_extrude_scale:Y,u_intensity:D,u_inv_rot_matrix:mP,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0]};if(V){Q.u_inv_rot_matrix=w,Q.u_merc_center=M,Q.u_tile_id=[d.canonical.x,d.canonical.y,1<({u_matrix:_,u_normalize_matrix:d,u_globe_matrix:m,u_merc_matrix:w,u_grid_matrix:M,u_tl_parent:O,u_scale_parent:Y,u_fade_t:Q.mix,u_opacity:Q.opacity*ce.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:ce.paint.get("raster-brightness-min"),u_brightness_high:ce.paint.get("raster-brightness-max"),u_saturation_factor:i.dT(ce.paint.get("raster-saturation")),u_contrast_factor:i.dS(ce.paint.get("raster-contrast")),u_spin_weights:yP(ce.paint.get("raster-hue-rotate")),u_perspective_transform:oe,u_raster_elevation:de,u_zoom_transition:D,u_merc_center:B,u_cutoff_params:V,u_colorization_mix:Wk(i.dU,ve,Pe),u_colorization_offset:Gk(i.dU,De,Pe),u_color_ramp:we,u_texture_offset:[Xe/(Ve+2*Xe),Ve/(Ve+2*Xe)],u_texture_res:[Ve+2*Xe,Ve+2*Xe],u_emissive_strength:We});function yP(_){_*=Math.PI/180;const d=Math.sin(_),m=Math.cos(_);return[(2*m+1)/3,(-Math.sqrt(3)*d-m+1)/3,(Math.sqrt(3)*d-m+1)/3]}const bf=.05,nie=(_,d,m,w,M,O,D,B,V,Y,Q,ce)=>({u_matrix:_,u_normalize_matrix:d,u_globe_matrix:m,u_merc_matrix:w,u_grid_matrix:M,u_tl_parent:O,u_scale_parent:Y,u_fade_t:Q.mix,u_opacity:Q.opacity,u_image0:0,u_image1:1,u_raster_elevation:ce,u_zoom_transition:D,u_merc_center:B,u_cutoff_params:V}),sie=(_,d,m,w,M,O,D,B,V,Y)=>({u_particle_texture:_,u_particle_texture_side_len:d,u_tile_offset:m,u_velocity:w,u_color_ramp:O,u_velocity_res:M,u_max_speed:D,u_uv_offset:B,u_data_scale:[255*V[0],255*V[1]],u_data_offset:Y,u_particle_pos_scale:1.1,u_particle_pos_offset:[bf,bf]}),vP=(_,d,m,w,M,O,D,B,V,Y)=>({u_particle_texture:_,u_particle_texture_side_len:d,u_velocity:m,u_velocity_res:w,u_max_speed:M,u_speed_factor:O,u_reset_rate:D,u_rand_seed:Math.random(),u_uv_offset:B,u_data_scale:[255*V[0],255*V[1]],u_data_offset:Y,u_particle_pos_scale:1.1,u_particle_pos_offset:[bf,bf]}),_P=i.bC(),Kk=(_,d,m,w,M,O,D,B,V,Y,Q,ce,oe,de,we,ve,De,Pe,Ve,Xe,We,bt,ut,xt)=>{const ct=M.transform,it={u_is_size_zoom_constant:+(_==="constant"||_==="source"),u_is_size_feature_constant:+(_==="constant"||_==="camera"),u_size_t:d?d.uSizeT:0,u_size:d?d.uSize:0,u_camera_to_center_distance:ct.getCameraToCenterDistance(Ve),u_rotate_symbol:+m,u_aspect_ratio:ct.width/ct.height,u_fade_change:M.options.fadeDuration?M.symbolFadeChange:1,u_matrix:O,u_label_plane_matrix:D,u_coord_matrix:B,u_is_text:+Y,u_elevation_from_sea:V?1:0,u_pitch_with_map:+w,u_texsize:Q,u_texsize_icon:ce,u_texture:0,u_texture_icon:1,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:_P,u_merc_center:[0,0],u_camera_forward:[0,0,0],u_ecef_origin:[0,0,0],u_tile_matrix:_P,u_up_vector:[0,-1,0],u_color_adj_mat:bt,u_icon_transition:ut||0,u_gamma_scale:w?M.transform.getCameraToCenterDistance(Ve)*Math.cos(M.terrain?0:M.transform._pitch):1,u_device_pixel_ratio:i.o.devicePixelRatio,u_is_halo:1,u_scale_factor:xt||1,u_ground_shadow_factor:Xe,u_inv_matrix:i.bl(i.bC(),D),u_normal_scale:We,u_lutTexture:Cl.LUT};return Ve.name==="globe"&&(it.u_tile_id=[de.canonical.x,de.canonical.y,1<({u_matrix:_,u_emissive_strength:d,u_opacity:m,u_color:w}),zm=(_,d,m,w,M,O,D,B,V)=>Object.assign(function(Y,Q,ce,oe,de,we){const{width:ve,height:De}=oe.imageManager.getPixelSize(Q),Pe=Math.pow(2,we.tileID.overscaledZ),Ve=we.tileSize*Math.pow(2,oe.transform.tileZoom)/Pe,Xe=Ve*(we.tileID.canonical.x+we.tileID.wrap*Pe),We=Ve*we.tileID.canonical.y;return{u_image:0,u_pattern_tl:ce.tl,u_pattern_br:ce.br,u_texsize:[ve,De],u_pattern_size:ce.displaySize,u_pattern_units_to_pixels:de?[oe.transform.width,-1*oe.transform.height]:[1/i.ay(we,1,oe.transform.tileZoom),1/i.ay(we,1,oe.transform.tileZoom)],u_pixel_coord_upper:[Xe>>16,We>>16],u_pixel_coord_lower:[65535&Xe,65535&We]}}(0,O,D,w,B,V),{u_matrix:_,u_emissive_strength:d,u_opacity:m}),Fy=new Float32Array(i.bA([])),Xg=(_,d,m,w,M,O,D,B,V,Y,Q,ce,oe,de=[0,0,0],we,ve,De)=>{const Pe=M.style.light,Ve=Pe.properties.get("position"),Xe=[-Ve.x,-Ve.y,Ve.z],We=i.dO();Pe.properties.get("anchor")==="viewport"&&(i.dP(We,-M.transform.angle),i.dQ(Xe,Xe,We));const bt=Q.alphaMode==="MASK",ut=Pe.properties.get("color").toNonPremultipliedRenderColor(null),xt=oe.paint.get("model-ambient-occlusion-intensity"),ct=oe.paint.get("model-color").constantOr(i.ao.white).toNonPremultipliedRenderColor(null);return ct.a=oe.paint.get("model-color-mix-intensity").constantOr(0),De&&(ct.r=De[0],ct.g=De[1],ct.b=De[2],ct.a=De[3]),ve&&(ct.r=ve.color.r,ct.g=ve.color.g,ct.b=ve.color.b,ct.a=ve.colorMix,ce=ve.emissionStrength,O*=ve.opacity),{u_matrix:_,u_lighting_matrix:d,u_normal_matrix:m,u_node_matrix:w||Fy,u_lightpos:Xe,u_lightintensity:Pe.properties.get("intensity"),u_lightcolor:[ut.r,ut.g,ut.b],u_camera_pos:de,u_opacity:O,u_baseTextureIsAlpha:0,u_alphaMask:+bt,u_alphaCutoff:Q.alphaCutoff,u_baseColorFactor:D.toNonPremultipliedRenderColor(null).toArray01(),u_emissiveFactor:B.toNonPremultipliedRenderColor(null).toArray01(),u_metallicFactor:V,u_roughnessFactor:Y,u_baseColorTexture:Cl.BaseColor,u_metallicRoughnessTexture:Cl.MetallicRoughness,u_normalTexture:Cl.Normal,u_occlusionTexture:Cl.Occlusion,u_emissionTexture:Cl.Emission,u_lutTexture:Cl.LUT,u_color_mix:ct.toArray01(),u_aoIntensity:xt,u_emissive_strength:ce,u_occlusionTextureTransform:we||[0,0,0,0]}},a5=(_,d=Fy,m=Fy)=>({u_matrix:_,u_instance:d,u_node_matrix:m}),Zk={fillExtrusion:_=>({u_matrix:new i.cl(_),u_lightpos:new i.ci(_),u_lightintensity:new i.cj(_),u_lightcolor:new i.ci(_),u_vertical_gradient:new i.cj(_),u_opacity:new i.cj(_),u_edge_radius:new i.cj(_),u_width_scale:new i.cj(_),u_ao:new i.ck(_),u_height_type:new i.ch(_),u_base_type:new i.ch(_),u_tile_id:new i.ci(_),u_zoom_transition:new i.cj(_),u_inv_rot_matrix:new i.cl(_),u_merc_center:new i.ck(_),u_up_dir:new i.ci(_),u_height_lift:new i.cj(_),u_flood_light_color:new i.ci(_),u_vertical_scale:new i.cj(_),u_flood_light_intensity:new i.cj(_),u_ground_shadow_factor:new i.ci(_)}),fillExtrusionDepth:_=>({u_matrix:new i.cl(_),u_edge_radius:new i.cj(_),u_width_scale:new i.cj(_),u_vertical_scale:new i.cj(_),u_height_type:new i.ch(_),u_base_type:new i.ch(_)}),fillExtrusionPattern:_=>({u_matrix:new i.cl(_),u_lightpos:new i.ci(_),u_lightintensity:new i.cj(_),u_lightcolor:new i.ci(_),u_vertical_gradient:new i.cj(_),u_height_factor:new i.cj(_),u_edge_radius:new i.cj(_),u_width_scale:new i.cj(_),u_ao:new i.ck(_),u_height_type:new i.ch(_),u_base_type:new i.ch(_),u_tile_id:new i.ci(_),u_zoom_transition:new i.cj(_),u_inv_rot_matrix:new i.cl(_),u_merc_center:new i.ck(_),u_up_dir:new i.ci(_),u_height_lift:new i.cj(_),u_image:new i.ch(_),u_texsize:new i.ck(_),u_pixel_coord_upper:new i.ck(_),u_pixel_coord_lower:new i.ck(_),u_tile_units_to_pixels:new i.cj(_),u_opacity:new i.cj(_),u_pattern_transition:new i.cj(_)}),fillExtrusionGroundEffect:_=>({u_matrix:new i.cl(_),u_opacity:new i.cj(_),u_ao_pass:new i.cj(_),u_meter_to_tile:new i.cj(_),u_ao:new i.ck(_),u_flood_light_intensity:new i.cj(_),u_flood_light_color:new i.ci(_),u_attenuation:new i.cj(_),u_edge_radius:new i.cj(_),u_fb:new i.ch(_),u_fb_size:new i.cj(_),u_dynamic_offset:new i.cj(_)}),fill:_=>({u_matrix:new i.cl(_),u_emissive_strength:new i.cj(_),u_ground_shadow_factor:new i.ci(_)}),fillPattern:_=>({u_matrix:new i.cl(_),u_emissive_strength:new i.cj(_),u_image:new i.ch(_),u_texsize:new i.ck(_),u_pixel_coord_upper:new i.ck(_),u_pixel_coord_lower:new i.ck(_),u_tile_units_to_pixels:new i.cj(_),u_ground_shadow_factor:new i.ci(_),u_pattern_transition:new i.cj(_)}),fillOutline:_=>({u_matrix:new i.cl(_),u_emissive_strength:new i.cj(_),u_world:new i.ck(_),u_ground_shadow_factor:new i.ci(_)}),fillOutlinePattern:_=>({u_matrix:new i.cl(_),u_emissive_strength:new i.cj(_),u_world:new i.ck(_),u_image:new i.ch(_),u_texsize:new i.ck(_),u_pixel_coord_upper:new i.ck(_),u_pixel_coord_lower:new i.ck(_),u_tile_units_to_pixels:new i.cj(_),u_ground_shadow_factor:new i.ci(_),u_pattern_transition:new i.cj(_)}),building:_=>({u_matrix:new i.cl(_),u_normal_matrix:new i.cl(_),u_opacity:new i.cj(_),u_faux_facade_ao_intensity:new i.cj(_),u_camera_pos:new i.ci(_),u_tile_to_meter:new i.cj(_),u_facade_emissive_chance:new i.cj(_),u_flood_light_color:new i.ci(_),u_flood_light_intensity:new i.cj(_)}),buildingBloom:_=>({u_matrix:new i.cl(_)}),buildingDepth:_=>({u_matrix:new i.cl(_)}),elevatedStructuresDepth:_=>({u_matrix:new i.cl(_),u_depth_bias:new i.cj(_)}),elevatedStructures:_=>({u_matrix:new i.cl(_),u_ground_shadow_factor:new i.ci(_)}),elevatedStructuresDepthReconstruct:_=>({u_matrix:new i.cl(_),u_camera_pos:new i.ci(_),u_depth_bias:new i.cj(_),u_height_scale:new i.cj(_),u_reset_depth:new i.cj(_)}),circle:i.dY,collisionBox:_=>({u_matrix:new i.cl(_),u_inv_rot_matrix:new i.cl(_),u_camera_to_center_distance:new i.cj(_),u_extrude_scale:new i.ck(_),u_zoom_transition:new i.cj(_),u_merc_center:new i.ck(_),u_tile_id:new i.ci(_)}),collisionCircle:_=>({u_matrix:new i.cl(_),u_inv_matrix:new i.cl(_),u_camera_to_center_distance:new i.cj(_),u_viewport_size:new i.ck(_)}),debug:_=>({u_color:new i.dB(_),u_matrix:new i.cl(_),u_overlay:new i.ch(_),u_overlay_scale:new i.cj(_)}),clippingMask:_=>({u_matrix:new i.cl(_)}),heatmap:_=>({u_extrude_scale:new i.cj(_),u_intensity:new i.cj(_),u_matrix:new i.cl(_),u_inv_rot_matrix:new i.cl(_),u_merc_center:new i.ck(_),u_tile_id:new i.ci(_),u_zoom_transition:new i.cj(_),u_up_dir:new i.ci(_)}),heatmapTexture:_=>({u_image:new i.ch(_),u_color_ramp:new i.ch(_),u_opacity:new i.cj(_)}),hillshade:_=>({u_matrix:new i.cl(_),u_image:new i.ch(_),u_latrange:new i.ck(_),u_light:new i.ck(_),u_shadow:new i.dB(_),u_highlight:new i.dB(_),u_emissive_strength:new i.cj(_),u_accent:new i.dB(_)}),hillshadePrepare:_=>({u_matrix:new i.cl(_),u_image:new i.ch(_),u_dimension:new i.ck(_),u_zoom:new i.cj(_)}),line:i.dX,linePattern:i.dW,raster:_=>({u_matrix:new i.cl(_),u_normalize_matrix:new i.cl(_),u_globe_matrix:new i.cl(_),u_merc_matrix:new i.cl(_),u_grid_matrix:new i.dC(_),u_tl_parent:new i.ck(_),u_scale_parent:new i.cj(_),u_fade_t:new i.cj(_),u_opacity:new i.cj(_),u_image0:new i.ch(_),u_image1:new i.ch(_),u_brightness_low:new i.cj(_),u_brightness_high:new i.cj(_),u_saturation_factor:new i.cj(_),u_contrast_factor:new i.cj(_),u_spin_weights:new i.ci(_),u_perspective_transform:new i.ck(_),u_raster_elevation:new i.cj(_),u_zoom_transition:new i.cj(_),u_merc_center:new i.ck(_),u_cutoff_params:new i.d3(_),u_colorization_mix:new i.d3(_),u_colorization_offset:new i.cj(_),u_color_ramp:new i.ch(_),u_texture_offset:new i.ck(_),u_texture_res:new i.ck(_),u_emissive_strength:new i.cj(_)}),rasterParticle:_=>({u_matrix:new i.cl(_),u_normalize_matrix:new i.cl(_),u_globe_matrix:new i.cl(_),u_merc_matrix:new i.cl(_),u_grid_matrix:new i.dC(_),u_tl_parent:new i.ck(_),u_scale_parent:new i.cj(_),u_fade_t:new i.cj(_),u_opacity:new i.cj(_),u_image0:new i.ch(_),u_image1:new i.ch(_),u_raster_elevation:new i.cj(_),u_zoom_transition:new i.cj(_),u_merc_center:new i.ck(_),u_cutoff_params:new i.d3(_)}),rasterParticleTexture:_=>({u_texture:new i.ch(_),u_opacity:new i.cj(_)}),rasterParticleDraw:_=>({u_particle_texture:new i.ch(_),u_particle_texture_side_len:new i.cj(_),u_tile_offset:new i.ck(_),u_velocity:new i.ch(_),u_color_ramp:new i.ch(_),u_velocity_res:new i.ck(_),u_max_speed:new i.cj(_),u_uv_offset:new i.ck(_),u_data_scale:new i.ck(_),u_data_offset:new i.cj(_),u_particle_pos_scale:new i.cj(_),u_particle_pos_offset:new i.ck(_)}),rasterParticleUpdate:_=>({u_particle_texture:new i.ch(_),u_particle_texture_side_len:new i.cj(_),u_velocity:new i.ch(_),u_velocity_res:new i.ck(_),u_max_speed:new i.cj(_),u_speed_factor:new i.cj(_),u_reset_rate:new i.cj(_),u_rand_seed:new i.cj(_),u_uv_offset:new i.ck(_),u_data_scale:new i.ck(_),u_data_offset:new i.cj(_),u_particle_pos_scale:new i.cj(_),u_particle_pos_offset:new i.ck(_)}),symbol:_=>({u_is_size_zoom_constant:new i.ch(_),u_is_size_feature_constant:new i.ch(_),u_size_t:new i.cj(_),u_size:new i.cj(_),u_camera_to_center_distance:new i.cj(_),u_rotate_symbol:new i.ch(_),u_aspect_ratio:new i.cj(_),u_fade_change:new i.cj(_),u_matrix:new i.cl(_),u_label_plane_matrix:new i.cl(_),u_coord_matrix:new i.cl(_),u_is_text:new i.ch(_),u_elevation_from_sea:new i.ch(_),u_pitch_with_map:new i.ch(_),u_texsize:new i.ck(_),u_texsize_icon:new i.ck(_),u_texture:new i.ch(_),u_texture_icon:new i.ch(_),u_gamma_scale:new i.cj(_),u_device_pixel_ratio:new i.cj(_),u_tile_id:new i.ci(_),u_zoom_transition:new i.cj(_),u_inv_rot_matrix:new i.cl(_),u_merc_center:new i.ck(_),u_camera_forward:new i.ci(_),u_tile_matrix:new i.cl(_),u_up_vector:new i.ci(_),u_ecef_origin:new i.ci(_),u_is_halo:new i.ch(_),u_icon_transition:new i.cj(_),u_color_adj_mat:new i.cl(_),u_scale_factor:new i.cj(_),u_ground_shadow_factor:new i.ci(_),u_inv_matrix:new i.cl(_),u_normal_scale:new i.cj(_),u_lutTexture:new i.ch(_)}),background:_=>({u_matrix:new i.cl(_),u_emissive_strength:new i.cj(_),u_opacity:new i.cj(_),u_color:new i.dB(_)}),backgroundPattern:_=>({u_matrix:new i.cl(_),u_emissive_strength:new i.cj(_),u_opacity:new i.cj(_),u_image:new i.ch(_),u_pattern_tl:new i.ck(_),u_pattern_br:new i.ck(_),u_texsize:new i.ck(_),u_pattern_size:new i.ck(_),u_pixel_coord_upper:new i.ck(_),u_pixel_coord_lower:new i.ck(_),u_pattern_units_to_pixels:new i.ck(_)}),terrainRaster:_=>({u_matrix:new i.cl(_),u_image0:new i.ch(_),u_image1:new i.ch(_),u_skirt_height:new i.cj(_),u_ground_shadow_factor:new i.ci(_),u_emissive_texture_available:new i.cj(_)}),skybox:_=>({u_matrix:new i.cl(_),u_sun_direction:new i.ci(_),u_cubemap:new i.ch(_),u_opacity:new i.cj(_),u_temporal_offset:new i.cj(_)}),skyboxGradient:_=>({u_matrix:new i.cl(_),u_color_ramp:new i.ch(_),u_center_direction:new i.ci(_),u_radius:new i.cj(_),u_opacity:new i.cj(_),u_temporal_offset:new i.cj(_)}),skyboxCapture:_=>({u_matrix_3f:new i.dC(_),u_sun_direction:new i.ci(_),u_sun_intensity:new i.cj(_),u_color_tint_r:new i.d3(_),u_color_tint_m:new i.d3(_),u_luminance:new i.cj(_)}),globeRaster:_=>({u_proj_matrix:new i.cl(_),u_globe_matrix:new i.cl(_),u_normalize_matrix:new i.cl(_),u_merc_matrix:new i.cl(_),u_zoom_transition:new i.cj(_),u_merc_center:new i.ck(_),u_image0:new i.ch(_),u_image1:new i.ch(_),u_grid_matrix:new i.dC(_),u_skirt_height:new i.cj(_),u_far_z_cutoff:new i.cj(_),u_frustum_tl:new i.ci(_),u_frustum_tr:new i.ci(_),u_frustum_br:new i.ci(_),u_frustum_bl:new i.ci(_),u_globe_pos:new i.ci(_),u_globe_radius:new i.cj(_),u_viewport:new i.ck(_),u_emissive_texture_available:new i.cj(_)}),globeAtmosphere:_=>({u_frustum_tl:new i.ci(_),u_frustum_tr:new i.ci(_),u_frustum_br:new i.ci(_),u_frustum_bl:new i.ci(_),u_horizon:new i.cj(_),u_transition:new i.cj(_),u_fadeout_range:new i.cj(_),u_atmosphere_fog_color:new i.d3(_),u_high_color:new i.d3(_),u_space_color:new i.d3(_),u_temporal_offset:new i.cj(_),u_horizon_angle:new i.cj(_)}),model:_=>({u_matrix:new i.cl(_),u_lighting_matrix:new i.cl(_),u_normal_matrix:new i.cl(_),u_node_matrix:new i.cl(_),u_lightpos:new i.ci(_),u_lightintensity:new i.cj(_),u_lightcolor:new i.ci(_),u_camera_pos:new i.ci(_),u_opacity:new i.cj(_),u_baseColorFactor:new i.d3(_),u_emissiveFactor:new i.d3(_),u_metallicFactor:new i.cj(_),u_roughnessFactor:new i.cj(_),u_baseTextureIsAlpha:new i.ch(_),u_alphaMask:new i.ch(_),u_alphaCutoff:new i.cj(_),u_baseColorTexture:new i.ch(_),u_metallicRoughnessTexture:new i.ch(_),u_normalTexture:new i.ch(_),u_occlusionTexture:new i.ch(_),u_emissionTexture:new i.ch(_),u_lutTexture:new i.ch(_),u_color_mix:new i.d3(_),u_aoIntensity:new i.cj(_),u_emissive_strength:new i.cj(_),u_occlusionTextureTransform:new i.d3(_)}),modelDepth:_=>({u_matrix:new i.cl(_),u_instance:new i.cl(_),u_node_matrix:new i.cl(_)}),groundShadow:_=>({u_matrix:new i.cl(_),u_ground_shadow_factor:new i.ci(_)}),stars:_=>({u_matrix:new i.cl(_),u_up:new i.ci(_),u_right:new i.ci(_),u_intensity_multiplier:new i.cj(_)}),snowParticle:_=>({u_modelview:new i.cl(_),u_projection:new i.cl(_),u_time:new i.cj(_),u_cam_pos:new i.ci(_),u_velocityConeAperture:new i.cj(_),u_velocity:new i.cj(_),u_horizontalOscillationRadius:new i.cj(_),u_horizontalOscillationRate:new i.cj(_),u_boxSize:new i.cj(_),u_billboardSize:new i.cj(_),u_simpleShapeParameters:new i.ck(_),u_screenSize:new i.ck(_),u_thinningCenterPos:new i.ck(_),u_thinningShape:new i.ci(_),u_thinningAffectedRatio:new i.cj(_),u_thinningParticleOffset:new i.cj(_),u_particleColor:new i.d3(_),u_direction:new i.ci(_)}),rainParticle:_=>({u_modelview:new i.cl(_),u_projection:new i.cl(_),u_time:new i.cj(_),u_cam_pos:new i.ci(_),u_texScreen:new i.ch(_),u_velocityConeAperture:new i.cj(_),u_velocity:new i.cj(_),u_boxSize:new i.cj(_),u_rainDropletSize:new i.ck(_),u_distortionStrength:new i.cj(_),u_rainDirection:new i.ci(_),u_color:new i.d3(_),u_screenSize:new i.ck(_),u_thinningCenterPos:new i.ck(_),u_thinningShape:new i.ci(_),u_thinningAffectedRatio:new i.cj(_),u_thinningParticleOffset:new i.cj(_),u_shapeDirectionalPower:new i.cj(_),u_shapeNormalPower:new i.cj(_),u_mode:new i.cj(_)}),vignette:_=>({u_vignetteShape:new i.ci(_),u_vignetteColor:new i.d3(_)}),occlusion:_=>({u_matrix:new i.cl(_),u_anchorPos:new i.ci(_),u_screenSizePx:new i.ck(_),u_occluderSizePx:new i.ck(_),u_color:new i.d3(_)})};class Ph{constructor(d,m,w,M){this.id=Ph.uniqueIdxCounter,Ph.uniqueIdxCounter++,this.context=d;const O=d.gl;this.buffer=O.createBuffer(),this.dynamicDraw=!!w,this.context.unbindVAO(),d.bindElementBuffer.set(this.buffer),O.bufferData(O.ELEMENT_ARRAY_BUFFER,m.arrayBuffer,this.dynamicDraw?O.DYNAMIC_DRAW:O.STATIC_DRAW),this.dynamicDraw||M||m.destroy()}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(d){this.id=Ph.uniqueIdxCounter,Ph.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)}}Ph.uniqueIdxCounter=0;const i5={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class bP{constructor(d,m,w,M,O,D){this.length=m.length,this.attributes=w,this.itemSize=m.bytesPerElement,this.dynamicDraw=M,this.instanceCount=D,this.context=d;const B=d.gl;this.buffer=B.createBuffer(),d.bindVertexBuffer.set(this.buffer),B.bufferData(B.ARRAY_BUFFER,m.arrayBuffer,this.dynamicDraw?B.DYNAMIC_DRAW:B.STATIC_DRAW),this.dynamicDraw||O||m.destroy()}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(d){const m=this.context.gl;this.bind(),m.bufferSubData(m.ARRAY_BUFFER,0,d.arrayBuffer)}enableAttributes(d,m){for(let w=0;w0&&d.vertexAttribDivisor(O,w)}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class wP{constructor(d,m,w,M,O){this.context=d,this.width=m,this.height=w;const D=this.framebuffer=d.gl.createFramebuffer();M>0&&(this.colorAttachment0=new Fk(d,D,0)),M>1&&(this.colorAttachment1=new Fk(d,D,1)),O&&(this.depthAttachmentType=O,this.depthAttachment=O==="renderbuffer"?new Ly(d,D):new Cv(d,D))}createColorAttachment(d,m){m===0?this.colorAttachment0=new Fk(d,this.framebuffer,0):m===1&&(this.colorAttachment1=new Fk(d,this.framebuffer,1))}removeColorAttachment(d,m){const w=this.context.gl;let M;m===0?(M=this.colorAttachment0.get(),this.colorAttachment0=void 0):m===1&&(M=this.colorAttachment1.get(),this.colorAttachment1=void 0),M&&w.deleteTexture(M)}destroy(){const d=this.context.gl;if(this.colorAttachment0){const m=this.colorAttachment0.get();m&&d.deleteTexture(m)}if(this.colorAttachment1){const m=this.colorAttachment1.get();m&&d.deleteTexture(m)}if(this.depthAttachment&&this.depthAttachmentType)if(this.depthAttachmentType==="renderbuffer"){const m=this.depthAttachment.get();m&&d.deleteRenderbuffer(m)}else{const m=this.depthAttachment.get();m&&d.deleteTexture(m)}d.deleteFramebuffer(this.framebuffer)}}class zy{constructor(d,m){this.gl=d,this.clearColor=new Yae(this),this.clearDepth=new tP(this),this.clearStencil=new U3(this),this.colorMask=new Pk(this),this.depthMask=new q3(this),this.stencilMask=new Zg(this),this.stencilFunc=new Ay(this),this.stencilOp=new Nv(this),this.stencilTest=new Ey(this),this.depthRange=new rP(this),this.depthTest=new V3(this),this.depthFunc=new nP(this),this.blend=new Iy(this),this.blendFunc=new Lk(this),this.blendColor=new Ok(this),this.blendEquation=new H3(this),this.cullFace=new Dk(this),this.cullFaceSide=new Sv(this),this.frontFace=new sP(this),this.program=new aP(this),this.activeTexture=new iP(this),this.viewport=new Py(this),this.bindFramebuffer=new oP(this),this.bindRenderbuffer=new Xae(this),this.bindTexture=new Qae(this),this.bindVertexBuffer=new Jae(this),this.bindElementBuffer=new W3(this),this.bindVertexArrayOES=new G3(this),this.pixelStoreUnpack=new K3(this),this.pixelStoreUnpackPremultiplyAlpha=new Z3(this),this.pixelStoreUnpackFlipY=new lP(this),this.options=m?Object.assign({},m):{},this.options.extTextureFilterAnisotropicForceOff||(this.extTextureFilterAnisotropic=d.getExtension("EXT_texture_filter_anisotropic")||d.getExtension("MOZ_EXT_texture_filter_anisotropic")||d.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=d.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT))),this.extDebugRendererInfo=d.getExtension("WEBGL_debug_renderer_info"),this.extDebugRendererInfo&&(this.renderer=d.getParameter(this.extDebugRendererInfo.UNMASKED_RENDERER_WEBGL),this.vendor=d.getParameter(this.extDebugRendererInfo.UNMASKED_VENDOR_WEBGL)),this.forceManualRenderingForInstanceIDShaders=m&&!!m.forceManualRenderingForInstanceIDShaders||this.renderer&&this.renderer.indexOf("PowerVR")!==-1,this.options.extTextureFloatLinearForceOff||(this.extTextureFloatLinear=d.getExtension("OES_texture_float_linear")),this.extRenderToTextureHalfFloat=d.getExtension("EXT_color_buffer_half_float"),this.extTimerQuery=d.getExtension("EXT_disjoint_timer_query_webgl2"),this.maxTextureSize=d.getParameter(d.MAX_TEXTURE_SIZE),this.extBlendFuncExtended=d.getExtension("WEBGL_blend_func_extended")}setDefault(){this.unbindVAO(),this.clearColor.setDefault(),this.clearDepth.setDefault(),this.clearStencil.setDefault(),this.colorMask.setDefault(),this.depthMask.setDefault(),this.stencilMask.setDefault(),this.stencilFunc.setDefault(),this.stencilOp.setDefault(),this.stencilTest.setDefault(),this.depthRange.setDefault(),this.depthTest.setDefault(),this.depthFunc.setDefault(),this.blend.setDefault(),this.blendFunc.setDefault(),this.blendColor.setDefault(),this.blendEquation.setDefault(),this.cullFace.setDefault(),this.cullFaceSide.setDefault(),this.frontFace.setDefault(),this.program.setDefault(),this.activeTexture.setDefault(),this.bindFramebuffer.setDefault(),this.pixelStoreUnpack.setDefault(),this.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.pixelStoreUnpackFlipY.setDefault()}setDirty(){this.clearColor.dirty=!0,this.clearDepth.dirty=!0,this.clearStencil.dirty=!0,this.colorMask.dirty=!0,this.depthMask.dirty=!0,this.stencilMask.dirty=!0,this.stencilFunc.dirty=!0,this.stencilOp.dirty=!0,this.stencilTest.dirty=!0,this.depthRange.dirty=!0,this.depthTest.dirty=!0,this.depthFunc.dirty=!0,this.blend.dirty=!0,this.blendFunc.dirty=!0,this.blendColor.dirty=!0,this.blendEquation.dirty=!0,this.cullFace.dirty=!0,this.cullFaceSide.dirty=!0,this.frontFace.dirty=!0,this.program.dirty=!0,this.activeTexture.dirty=!0,this.viewport.dirty=!0,this.bindFramebuffer.dirty=!0,this.bindRenderbuffer.dirty=!0,this.bindTexture.dirty=!0,this.bindVertexBuffer.dirty=!0,this.bindElementBuffer.dirty=!0,this.bindVertexArrayOES.dirty=!0,this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0}createIndexBuffer(d,m,w){return new Ph(this,d,m,w)}createVertexBuffer(d,m,w,M,O){return new bP(this,d,m,w,M,O)}createRenderbuffer(d,m,w){const M=this.gl,O=M.createRenderbuffer();return this.bindRenderbuffer.set(O),M.renderbufferStorage(M.RENDERBUFFER,d,m,w),this.bindRenderbuffer.set(null),O}createFramebuffer(d,m,w,M){return new wP(this,d,m,w,M)}clear({color:d,depth:m,stencil:w,colorMask:M}){const O=this.gl;let D=0;d&&(D|=O.COLOR_BUFFER_BIT,this.clearColor.set(d.toNonPremultipliedRenderColor(null)),this.colorMask.set(M||[!0,!0,!0,!0])),m!==void 0&&(D|=O.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(m),this.depthMask.set(!0)),w!==void 0&&(D|=O.STENCIL_BUFFER_BIT,this.clearStencil.set(w),this.stencilMask.set(255)),O.clear(D)}setCullFace(d){d.enable===!1?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(d.mode),this.frontFace.set(d.frontFace))}setDepthMode(d){d.func!==this.gl.ALWAYS||d.mask?(this.depthTest.set(!0),this.depthFunc.set(d.func),this.depthMask.set(d.mask),this.depthRange.set(d.range)):this.depthTest.set(!1)}setStencilMode(d){d.test.func!==this.gl.ALWAYS||d.mask?(this.stencilTest.set(!0),this.stencilMask.set(d.mask),this.stencilOp.set([d.fail,d.depthFail,d.pass]),this.stencilFunc.set({func:d.test.func,ref:d.ref,mask:d.test.mask})):this.stencilTest.set(!1)}setColorMode(d){i.by(d.blendFunction,as.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(d.blendFunction),this.blendColor.set(d.blendColor),d.blendEquation?this.blendEquation.set(d.blendEquation):this.blendEquation.setDefault()),this.colorMask.set(d.mask)}unbindVAO(){this.bindVertexArrayOES.set(null)}}let Qg;function Yr(_,d,m,w,M,O,D){const B=_.context,V=B.gl,Y=_.transform,Q=[i.aF(Y.center.lng),i.aJ(Y.center.lat)],ce=m.layout.get("symbol-placement"),oe=m.layout.get("text-variable-anchor"),de=m.layout.get("icon-rotation-alignment")==="map",we=m.layout.get("text-rotation-alignment")==="map",ve=ce!=="point",De=[];let Pe=0,Ve=0;for(let it=0;it0){const zr=i.bC(),Gr=Nr;i.cP(zr,Lt.placementInvProjMatrix,Y.glCoordMatrix),i.cP(zr,zr,Lt.placementViewportMatrix),De.push({circleArray:nn,circleOffset:Ve,transform:Gr,invTransform:zr,projection:Lt.getProjection()}),Pe+=nn.length/4,Ve=Pe}if(!br)continue;_.terrain&&_.terrain.setupElevationDraw(Dt,Hr);const Jr=dr?[St.canonical.x,St.canonical.y,1<=0&&(de[Xe.associatedIconIndex]={x:Lt,y:Ht,z:Wt,angle:Jt})}else Ah(ut,ce)}if(Y){oe.clear();const Ve=_.icon.placedSymbolArray;for(let Xe=0;Xe{let Qs=[0,0,0];if(va){const ls=_.style.directionalLight,ii=_.style.ambientLight;ls&&ii&&(Qs=xp(_.style,ls,ii))}return Qs},ia=va=>{it.depthOcclusionForSymbolsAndCircles&&(m.hasOcclusionOpacityProperties||_.terrain)&&(va.push("DEPTH_D24"),va.push("DEPTH_OCCLUSION"))},Wn=va=>{m.lut&&!ut&&(m.lut.texture||(m.lut.texture=new i.d$(_.context,m.lut.image,[m.lut.image.height,m.lut.image.height,m.lut.image.height],xt.gl.RGBA8)),xt.activeTexture.set(xt.gl.TEXTURE0+Cl.LUT),m.lut.texture&&m.lut.texture.bind(xt.gl.LINEAR,xt.gl.CLAMP_TO_EDGE),va.push("APPLY_LUT_ON_GPU"))},ya=()=>{const va=St&&m.layout.get("symbol-placement")!=="point",Qs=[];ia(Qs),Wn(Qs);const ls=va||Yn,ii=br.elevationType==="road",eo=_.shadowRenderer,Di=ii&&Lt&&!!eo&&eo.enabled,Ha=on(Di),nd=ii&&Lt&&!_.terrain?Bt:_r,nc=m.paint.get("icon-image-cross-fade");_.terrainRenderModeElevated()&&Lt&&Qs.push("PITCH_WITH_MAP_TERRAIN"),nn&&(Qs.push("PROJECTION_GLOBE_VIEW"),ls&&Qs.push("PROJECTED_POS_ON_VIEWPORT")),nc>0&&br.hasAnySecondaryIcon&&Qs.push("ICON_TRANSITION"),!br.icon.zOffsetVertexBuffer||ii&&_.terrain||Qs.push("Z_OFFSET"),Pe===0&&Ve===0&&Xe===0&&We===1||Qs.push("COLOR_ADJUSTMENT"),br.sdfIcons&&Qs.push("RENDER_SDF"),Di&&Qs.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET"),ii&&Lt&&!_.terrain&&br.icon.orientationVertexBuffer&&Qs.push("ELEVATED_ROADS");const Vo=br.icon.programConfigurations.get(m.id),_c=_.getOrCreateProgram("symbol",{config:Vo,defines:Qs}),bc=Nr.imageAtlasTexture?Nr.imageAtlasTexture.size:[0,0],Ul=br.iconSizeData,bu=i.bK(Ul,it.zoom),nh=Lt||!it.isOrthographic,Nd=gl(zr,Nr.tileID.canonical,Lt,St,it,br.getProjection(),Gr),Gi=pp(zr,Nr.tileID.canonical,Lt,St,it,br.getProjection(),Gr),io=_.translatePosMatrix(Gi,Nr,B,Y,!0),Wa=_.translatePosMatrix(zr,Nr,B,Y),bo=ls?Pv:Nd,Ui=St&&!Lt&&!va;let Ri=Tr;!qt&&!it.mercatorFromTransition||St||(Ri=vp(it));const sh=nn?Ri:Tr,Wv=m.getColorAdjustmentMatrix(Pe,Ve,Xe,We),Dh=Kk(Ul.kind,bu,Ui,Lt,_,Wa,bo,io,bt,!1,bc,[0,0],0,Hr,Jr,Tt,Os,sh,br.getProjection(),Ha,ha,Wv,nc,null),Gv=Nr.imageAtlasTexture?Nr.imageAtlasTexture:null,Ky=m.layout.get("icon-size").constantOr(0)!==1||br.iconsNeedLinear,Sf=br.sdfIcons||_.options.rotating||_.options.zooming||Ky||nh?ct.LINEAR:ct.NEAREST,Mp=br.sdfIcons&&m.paint.get("icon-halo-width").constantOr(1)!==0,Zy=_.terrain&&Lt&&va?i.bl(i.bC(),Nd):Pv;if(va&&br.icon){const Hm=i.bV.getAtTileOffsetFunc(Hr,it.center.lat,it.worldSize,br.getProjection()),Tp=fp(zr,Nr.tileID.canonical,Lt,St,it,br.getProjection(),Gr),Rh=m.layout.get("icon-size-scale-range"),Ap=i.aA(_.scaleFactor,Rh[0],Rh[1]);WI(br,zr,_,!1,Tp,Gi,Lt,ve,Hm,Hr,Ap)}return{program:_c,buffers:br.icon,uniformValues:Dh,atlasTexture:Gv,atlasTextureIcon:null,atlasInterpolation:Sf,atlasInterpolationIcon:null,isSDF:br.sdfIcons,hasHalo:Mp,depthMode:nd,tile:Nr,renderWithShadows:Di,labelPlaneMatrixInv:Zy}},Ra=()=>{const va=Dt&&m.layout.get("symbol-placement")!=="point",Qs=[],ls=va||Jt||Yn,ii=br.elevationType==="road",eo=_.shadowRenderer,Di=ii&&Ht&&!!eo&&eo.enabled,Ha=on(Di),nd=ii&&Ht&&!_.terrain?Bt:_r;_.terrainRenderModeElevated()&&Ht&&Qs.push("PITCH_WITH_MAP_TERRAIN"),nn&&(Qs.push("PROJECTION_GLOBE_VIEW"),ls&&Qs.push("PROJECTED_POS_ON_VIEWPORT")),!br.text.zOffsetVertexBuffer||ii&&_.terrain||Qs.push("Z_OFFSET"),br.iconsInText&&Qs.push("RENDER_TEXT_AND_SYMBOL"),Qs.push("RENDER_SDF"),Di&&Qs.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET"),ii&&Ht&&!_.terrain&&br.text.orientationVertexBuffer&&Qs.push("ELEVATED_ROADS"),ia(Qs);const nc=br.text.programConfigurations.get(m.id),Vo=_.getOrCreateProgram("symbol",{config:nc,defines:Qs});let _c,bc=[0,0],Ul=null;const bu=br.textSizeData;br.iconsInText&&(bc=Nr.imageAtlasTexture?Nr.imageAtlasTexture.size:[0,0],Ul=Nr.imageAtlasTexture?Nr.imageAtlasTexture:null,_c=Ht||!it.isOrthographic||_.options.rotating||_.options.zooming||bu.kind==="composite"||bu.kind==="camera"?ct.LINEAR:ct.NEAREST);const nh=Nr.glyphAtlasTexture?Nr.glyphAtlasTexture.size:[0,0],Nd=m.layout.get("text-size-scale-range"),Gi=i.aA(_.scaleFactor,Nd[0],Nd[1]),io=i.bK(bu,it.zoom,Gi),Wa=gl(zr,Nr.tileID.canonical,Ht,Dt,it,br.getProjection(),Gr),bo=pp(zr,Nr.tileID.canonical,Ht,Dt,it,br.getProjection(),Gr),Ui=_.translatePosMatrix(bo,Nr,V,Q,!0),Ri=_.translatePosMatrix(zr,Nr,V,Q),sh=ls?Pv:Wa,Wv=Dt&&!Ht&&!va;let Dh=Tr;!qt&&!it.mercatorFromTransition||Dt||(Dh=vp(it));const Gv=Kk(bu.kind,io,Wv,Ht,_,Ri,sh,Ui,bt,!0,nh,bc,0,Hr,Jr,Tt,Os,nn?Dh:Tr,br.getProjection(),Ha,ha,null,null,Gi),Ky=Nr.glyphAtlasTexture?Nr.glyphAtlasTexture:null,Sf=ct.LINEAR,Mp=m.paint.get("text-halo-width").constantOr(1)!==0,Zy=_.terrain&&Ht&&va?i.bl(i.bC(),Wa):Pv;if(va&&br.text){const Hm=i.bV.getAtTileOffsetFunc(Hr,it.center.lat,it.worldSize,br.getProjection()),Tp=fp(zr,Nr.tileID.canonical,Ht,Dt,it,br.getProjection(),Gr);WI(br,zr,_,!0,Tp,bo,Ht,De,Hm,Hr,Gi)}return{program:Vo,buffers:br.text,uniformValues:Gv,atlasTexture:Ky,atlasTextureIcon:Ul,atlasInterpolation:Sf,atlasInterpolationIcon:_c,isSDF:!0,hasHalo:Mp,depthMode:nd,tile:Nr,renderWithShadows:Di,labelPlaneMatrixInv:Zy}},Ca=br.icon.segments.get().length,sa=br.text.segments.get().length,is=Ca&&!D.onlyText?ya():null,ga=sa&&!D.onlyIcons?Ra():null,$i=m.paint.get("icon-opacity").constantOr(1),gi=m.paint.get("text-opacity").constantOr(1);if(Wt&&br.canOverlap){sr=!0;const va=$i&&!D.onlyText?br.icon.segments.get():[],Qs=gi&&!D.onlyIcons?br.text.segments.get():[];for(const ls of va)dr.push({segments:new i.bg([ls]),sortKey:ls.sortKey,state:is});for(const ls of Qs)dr.push({segments:new i.bg([ls]),sortKey:ls.sortKey,state:ga})}else D.onlyText||dr.push({segments:$i?br.icon.segments:new i.bg([]),sortKey:0,state:is}),D.onlyIcons||dr.push({segments:gi?br.text.segments:new i.bg([]),sortKey:0,state:ga})}sr&&dr.sort((Hr,Nr)=>Hr.sortKey-Nr.sortKey);for(const Hr of dr){const Nr=Hr.state;if(Nr)if(_.terrain?_.terrain.setupElevationDraw(Nr.tile,Nr.program,{useDepthForOcclusion:it.depthOcclusionForSymbolsAndCircles,labelPlaneMatrixInv:Nr.labelPlaneMatrixInv}):_.setupDepthForOcclusion(it.depthOcclusionForSymbolsAndCircles,Nr.program),xt.activeTexture.set(ct.TEXTURE0),Nr.atlasTexture&&Nr.atlasTexture.bind(Nr.atlasInterpolation,ct.CLAMP_TO_EDGE,!0),Nr.atlasTextureIcon&&(xt.activeTexture.set(ct.TEXTURE1),Nr.atlasTextureIcon&&Nr.atlasTextureIcon.bind(Nr.atlasInterpolationIcon,ct.CLAMP_TO_EDGE,!0)),Nr.renderWithShadows&&_.shadowRenderer.setupShadows(Nr.tile.tileID.toUnwrapped(),Nr.program,"vector-tile"),_.uploadCommonLightUniforms(_.context,Nr.program),Nr.hasHalo){const br=Nr.uniformValues;br.u_is_halo=1,o5(Nr.buffers,Hr.segments,m,_,Nr.program,Nr.depthMode,M,O,br,2),br.u_is_halo=0}else{if(Nr.isSDF){const br=Nr.uniformValues;Nr.hasHalo&&(br.u_is_halo=1,o5(Nr.buffers,Hr.segments,m,_,Nr.program,Nr.depthMode,M,O,br,1)),br.u_is_halo=0}o5(Nr.buffers,Hr.segments,m,_,Nr.program,Nr.depthMode,M,O,Nr.uniformValues,1)}}}function o5(_,d,m,w,M,O,D,B,V,Y){const Q=[_.dynamicLayoutVertexBuffer,_.opacityVertexBuffer,_.iconTransitioningVertexBuffer,_.globeExtVertexBuffer,_.zOffsetVertexBuffer,_.orientationVertexBuffer];M.draw(w,w.context.gl.TRIANGLES,O,D,B,zn.disabled,V,m.id,_.layoutVertexBuffer,_.indexBuffer,d,m.paint,w.transform.zoom,_.programConfigurations.get(m.id),Q,Y)}function jP(_,d){const m=1<<_.canonical.z,w=(d.x*m-_.canonical.x-_.wrap*m)*i.al,M=(d.y*m-_.canonical.y)*i.al,O=i.e8(d.z,d.y);return i.d5(w,M,O)}function Yk(_,d,m,w,M){if(!m.layout||m.layout.get("fill-elevation-reference")==="none"||m.paint.get("fill-opacity").constantOr(1)===0)return;const O=_.context.gl,D=new dn(_.context.gl.LEQUAL,dn.ReadWrite,_.depthRangeFor3D),B=new dn(_.context.gl.GREATER,dn.ReadWrite,_.depthRangeFor3D),V=function(de){let we=.01;return de.isOrthographic&&(we=i.ak(1e-4,we,i.d0(de.pitch>=Ih?1:de.pitch/Ih))),2*we}(_.transform),Y=_.transform.getFreeCameraOptions().position,Q="elevatedStructuresDepthReconstruct",ce=_.getOrCreateProgram(Q,{defines:["DEPTH_RECONSTRUCTION"]}),oe=_.getOrCreateProgram(Q);for(const de of w){const we=d.getTile(de),ve=we.getBucket(m);if(!ve)continue;const De=ve.elevatedStructures;if(!De)continue;const Pe=ve.elevationBufferData.heightRange,Ve=jP(de.toUnwrapped(),Y),Xe=_.translatePosMatrix(de.projMatrix,we,m.paint.get("fill-translate"),m.paint.get("fill-translate-anchor"));let We,bt,ut,xt;if(M==="initialize"){if(!Pe||Pe.min>=1||De.depthSegments.segments[0].primitiveLength===0)continue;We=Yg(Xe,Ve,V,1,0),bt=D,ut=De.depthSegments,xt=ce}else if(M==="reset"){if(!Pe||Pe.min>=0||De.maskSegments.segments[0].primitiveLength===0)continue;We=Yg(Xe,Ve,0,0,1),bt=B,ut=De.maskSegments,xt=ce}else if(M==="geometry"){if(De.depthSegments.segments[0].primitiveLength===0)continue;We=Yg(Xe,Ve,V,1,0),bt=D,ut=De.depthSegments,xt=oe}xt.draw(_,O.TRIANGLES,bt,$n.disabled,as.disabled,zn.disabled,We,m.id,De.vertexBuffer,De.indexBuffer,ut,m.paint,_.transform.zoom)}}function Xk(_,d,m,w){const{painter:M,sourceCache:O,layer:D,coords:B,colorMode:V,elevationType:Y,terrainEnabled:Q,pass:ce}=_,oe=M.context.gl,de=D.paint.get("fill-pattern"),we=D.paint.get("fill-pattern-cross-fade"),ve=de.constantOr(null);let De=Y;Y!=="road"||d&&!Q||(De="none");const Pe=De==="road",Ve=_.painter.shadowRenderer,Xe=Pe&&!!Ve&&Ve.enabled,We=new dn(M.context.gl.LEQUAL,dn.ReadOnly,M.depthRangeFor3D);let bt=[0,0,0];if(Xe){const it=M.style.directionalLight,St=M.style.ambientLight;it&&St&&(bt=xp(M.style,it,St))}const ut=de&&de.constantOr(1),xt=M.terrain&&M.terrain.renderingToTexture,ct=(it,St)=>{let Dt,Lt,Ht,Wt,sr;St?(Dt=ut&&!D.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",Ht=oe.LINES):(Dt=ut?"fillPattern":"fill",Ht=oe.TRIANGLES);for(const _r of B){const Bt=O.getTile(_r);if(ut&&!Bt.patternsLoaded())continue;const Tt=Bt.getBucket(D);if(!Tt)continue;const Jt=d?Tt.elevationBufferData:Tt.bufferData;if(Jt.isEmpty())continue;M.prepareDrawTile();const qt=Jt.programConfigurations.get(D.id),dr=M.isTileAffectedByFog(_r),Tr=[],Hr=[];Pe&&(Tr.push("ELEVATED_ROADS"),Hr.push(Jt.elevatedLayoutVertexBuffer)),Xe&&Tr.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET"),xt&&m&&Tr.push("USE_MRT1"),ut&&(M.context.activeTexture.set(oe.TEXTURE0),Bt.imageAtlasTexture&&Bt.imageAtlasTexture.bind(oe.LINEAR,oe.CLAMP_TO_EDGE),qt.updatePaintBuffers());let Nr=!1;if(ve&&Bt.imageAtlas){const Gr=Bt.imageAtlas,kn=i.e3.from(ve),Yn=kn.getPrimary().scaleSelf(i.o.devicePixelRatio).toString(),Os=kn.getSecondary(),ha=Gr.patternPositions.get(Yn),on=Os?Gr.patternPositions.get(Os.scaleSelf(i.o.devicePixelRatio).toString()):null;Nr=!!ha&&!!on,ha&&qt.setConstantPatternPositions(ha,on)}we>0&&(Nr||qt.getPatternTransitionVertexBuffer("fill-pattern"))&&Tr.push("FILL_PATTERN_TRANSITION");const br=M.getOrCreateProgram(Dt,{config:qt,overrideFog:dr,defines:Tr}),nn=M.translatePosMatrix(_r.projMatrix,Bt,D.paint.get("fill-translate"),D.paint.get("fill-translate-anchor"));Xe&&Ve.setupShadows(Bt.tileID.toUnwrapped(),br,"vector-tile");const Jr=D.paint.get("fill-emissive-strength");if(St){Wt=Jt.lineIndexBuffer,sr=Jt.lineSegments;const Gr=M.terrain&&M.terrain.renderingToTexture?M.terrain.drapeBufferSize:[oe.drawingBufferWidth,oe.drawingBufferHeight];Lt=Dt==="fillOutlinePattern"&&ut?n5(nn,Jr,M,Bt,Gr,bt,we):fP(nn,Jr,Gr,bt)}else Wt=Jt.indexBuffer,sr=Jt.triangleSegments,Lt=ut?r5(nn,Jr,M,Bt,bt,we):t5(nn,Jr,bt);M.uploadCommonUniforms(M.context,br,_r.toUnwrapped());let zr=it;(Y==="road"&&!Q||Y==="offset")&&(zr=We),br.draw(M,Ht,zr,w||M.stencilModeForClipping(_r),V,zn.disabled,Lt,D.id,Jt.layoutVertexBuffer,Wt,sr,D.paint,M.transform.zoom,qt,Hr)}};M.renderPass===ce&&ct(M.depthModeForSublayer(1,M.renderPass==="opaque"?dn.ReadWrite:dn.ReadOnly),!1),De==="none"&&M.renderPass==="translucent"&&D.paint.get("fill-antialias")&&ct(M.depthModeForSublayer(D.getPaintProperty("fill-outline-color")?2:0,dn.ReadOnly),!0)}function Qk(_,d,m,w,M,O,D,B){m.resetLayerRenderingStats(_);const V=_.context,Y=V.gl,Q=_.transform,ce=m.paint.get("fill-extrusion-pattern"),oe=m.paint.get("fill-extrusion-pattern-cross-fade"),de=ce.constantOr(null),we=ce.constantOr(1),ve=m.paint.get("fill-extrusion-opacity"),De=_.style.enable3dLights(),Pe=m.paint.get(De&&!we?"fill-extrusion-ambient-occlusion-wall-radius":"fill-extrusion-ambient-occlusion-radius"),Ve=[m.paint.get("fill-extrusion-ambient-occlusion-intensity"),Pe],Xe=m.layout.get("fill-extrusion-edge-radius"),We=Xe>0&&!m.paint.get("fill-extrusion-rounded-roof"),bt=We?0:Xe,ut=Q.projection.name==="globe"?i.eb():0,xt=Q.projection.name==="globe",ct=xt?i.aj(Q.zoom):0,it=[i.aF(Q.center.lng),i.aJ(Q.center.lat)],St=m.paint.get("fill-extrusion-flood-light-color-use-theme").constantOr("default")==="none",Dt=m.paint.get("fill-extrusion-flood-light-color").toNonPremultipliedRenderColor(St?null:m.lut).toArray01().slice(0,3),Lt=m.paint.get("fill-extrusion-flood-light-intensity"),Ht=m.paint.get("fill-extrusion-vertical-scale"),Wt=m.paint.get("fill-extrusion-line-width").constantOr(1)!==0,sr=m.paint.get("fill-extrusion-height-alignment"),_r=m.paint.get("fill-extrusion-base-alignment"),Bt=Em(_,m.paint.get("fill-extrusion-cutoff-fade-range")),Tt=[];let Jt;xt&&Tt.push("PROJECTION_GLOBE_VIEW"),Ve[0]>0&&Tt.push("FAUX_AO"),We&&Tt.push("ZERO_ROOF_RADIUS"),B&&Tt.push("HAS_CENTROID"),Lt>0&&Tt.push("FLOOD_LIGHT"),Bt.shouldRenderCutoff&&Tt.push("RENDER_CUTOFF"),Wt&&Tt.push("RENDER_WALL_MODE");const qt=_.renderPass==="shadow",dr=_.shadowRenderer,Tr=qt&&!!dr,Hr=qt?zn.disabled:zn.backCCW;_.shadowRenderer&&(_.shadowRenderer.useNormalOffset=!0);let Nr=[0,0,0];if(dr){const Jr=_.style.directionalLight,zr=_.style.ambientLight;Jr&&zr&&(Nr=xp(_.style,Jr,zr)),qt||(Tt.push("RENDER_SHADOWS","DEPTH_TEXTURE"),dr.useNormalOffset&&Tt.push("NORMAL_OFFSET")),Jt=Tt.concat(["SHADOWS_SINGLE_CASCADE"])}const br=Tr?"fillExtrusionDepth":we?"fillExtrusionPattern":"fillExtrusion",nn=m.getLayerRenderingStats();for(const Jr of w){const zr=d.getTile(Jr),Gr=zr.getBucket(m);if(!Gr||Gr.projection.name!==Q.projection.name)continue;let kn=!1;dr&&(kn=dr.getMaxCascadeForTile(Jr.toUnwrapped())===0);const Yn=_.isTileAffectedByFog(Jr),Os=Gr.programConfigurations.get(m.id);let ha=!1;if(de&&zr.imageAtlas){const sa=zr.imageAtlas,is=i.e3.from(de),ga=is.getPrimary().scaleSelf(i.o.devicePixelRatio).toString(),$i=is.getSecondary(),gi=sa.patternPositions.get(ga),va=$i?sa.patternPositions.get($i.scaleSelf(i.o.devicePixelRatio).toString()):null;ha=!!gi&&!!va,gi&&Os.setConstantPatternPositions(gi,va)}oe>0&&(ha||Os.getPatternTransitionVertexBuffer("fill-extrusion-pattern"))&&Tt.push("FILL_EXTRUSION_PATTERN_TRANSITION");const on=_.getOrCreateProgram(br,{config:Os,defines:kn?Jt:Tt,overrideFog:Yn});if(_.terrain&&_.terrain.setupElevationDraw(zr,on,{useMeterToDem:!0}),!Gr.centroidVertexBuffer){const sa=on.getAttributeLocation(Y,"a_centroid_pos");sa!==-1&&Y.vertexAttrib2f(sa,0,0)}!qt&&dr&&dr.setupShadows(zr.tileID.toUnwrapped(),on,"vector-tile"),we&&(_.context.activeTexture.set(Y.TEXTURE0),zr.imageAtlasTexture&&zr.imageAtlasTexture.bind(Y.LINEAR,Y.CLAMP_TO_EDGE),Os.updatePaintBuffers());const ia=m.paint.get("fill-extrusion-vertical-gradient"),Wn=1/Gr.tileToMeter;let ya;if(qt&&dr){if(bp(zr.tileID,Gr.maxHeight,_))continue;const sa=dr.calculateShadowPassMatrixFromTile(zr.tileID.toUnwrapped());ya=e5(sa,bt,Wn,Ht,sr,_r)}else{const sa=_.translatePosMatrix(Jr.expandedProjMatrix,zr,m.paint.get("fill-extrusion-translate"),m.paint.get("fill-extrusion-translate-anchor")),is=Q.projection.createInversionMatrix(Q,Jr.canonical);ya=we?hP(sa,_,ia,ve,Ve,bt,Wn,Jr,zr,ut,sr,_r,ct,it,is,Dt,Ht,oe):Vk(sa,_,ia,ve,Ve,bt,Wn,Jr,ut,sr,_r,ct,it,is,Dt,Ht,Lt,Nr)}_.uploadCommonUniforms(V,on,Jr.toUnwrapped(),null,Bt);let Ra=Gr.segments;if(Q.projection.name==="mercator"&&!qt&&(Ra=Gr.getVisibleSegments(zr.tileID,_.terrain,_.transform.getFrustum(0)),!Ra.get().length))continue;if(nn)if(qt)for(const sa of Ra.get())nn.numRenderedVerticesInShadowPass+=sa.primitiveLength;else for(const sa of Ra.get())nn.numRenderedVerticesInTransparentPass+=sa.primitiveLength;const Ca=[];(_.terrain||B)&&Ca.push(Gr.centroidVertexBuffer),xt&&Ca.push(Gr.layoutVertexExtBuffer),Wt&&Ca.push(Gr.wallVertexBuffer),on.draw(_,V.gl.TRIANGLES,M,O,D,Hr,ya,m.id,Gr.layoutVertexBuffer,Gr.indexBuffer,Ra,m.paint,_.transform.zoom,Os,Ca)}_.shadowRenderer&&(_.shadowRenderer.useNormalOffset=!1)}class l5{constructor(){this.translate=[0,0],this.translateAnchor="map",this.edgeRadius=0,this.cutoffFadeRange=0}}function _p(_,d,m,w,M,O,D,B,V,Y,Q,ce,oe,de,we,ve,De,Pe,Ve,Xe){const We=d.context,bt=We.gl,ut=d.transform,xt=d.transform.zoom,ct=[],it=_.translate,St=_.translateAnchor,Dt=_.edgeRadius,Lt=Em(d,_.cutoffFadeRange);Q==="clear"?(ct.push("CLEAR_SUBPASS"),Xe&&(ct.push("CLEAR_FROM_TEXTURE"),We.activeTexture.set(bt.TEXTURE0),Xe.bind(bt.LINEAR,bt.CLAMP_TO_EDGE))):Q==="sdf"?ct.push("SDF_SUBPASS"):Q==="emissive"&&(ct.push("USE_MRT1"),We.activeTexture.set(bt.TEXTURE0),Xe.bind(bt.LINEAR,bt.CLAMP_TO_EDGE)),Pe&&ct.push("HAS_CENTROID"),Lt.shouldRenderCutoff&&ct.push("RENDER_CUTOFF");const Ht=(Wt,sr,_r,Bt,Tt)=>{let Jt=ct;sr.groundRadiusBuffer!=null&&(Jt=ct.concat("HAS_ATTRIBUTE_a_flood_light_ground_radius"));const qt=sr.programConfigurations.get(w.id),dr=d.isTileAffectedByFog(Wt),Tr=d.getOrCreateProgram("fillExtrusionGroundEffect",{config:qt,defines:Jt,overrideFog:dr}),Hr=Ry(d,Bt,ce,Y,Tt,[oe,de*Tt],we,ve,De,xt>=17?0:Dt*Tt,Xe?Xe.size[0]:0),Nr=[];Pe&&Nr.push(sr.hiddenByLandmarkVertexBuffer),sr.groundRadiusBuffer!=null&&Nr.push(sr.groundRadiusBuffer),d.uploadCommonUniforms(We,Tr,Wt.toUnwrapped(),null,Lt),Tr.draw(d,We.gl.TRIANGLES,O,D,B,V,Hr,w.id,sr.vertexBuffer,sr.indexBuffer,_r,w.paint,xt,qt,Nr)};for(const Wt of M){const sr=m.getTile(Wt),_r=sr.getBucket(w);if(!_r||_r.projection.name!==ut.projection.name||!_r.groundEffect||_r.groundEffect&&!_r.groundEffect.hasData())continue;const Bt=_r.groundEffect,Tt=1/_r.tileToMeter;{const Jt=d.translatePosMatrix(Wt.projMatrix,sr,it,St),qt=Bt.getDefaultSegment();Ht(Wt,Bt,qt,Jt,Tt)}if(Ve)for(let Jt=0;Jt<4;Jt++){const qt=i.e9[Jt](Wt),dr=m.getTile(qt);if(!dr)continue;const Tr=dr.getBucket(w);if(!Tr||Tr.projection.name!==ut.projection.name||!Tr.groundEffect||Tr.groundEffect&&!Tr.groundEffect.hasData())continue;const Hr=Tr.groundEffect;let Nr,br;Jt===0?(Nr=[-i.al,0,0],br=1):Jt===1?(Nr=[i.al,0,0],br=0):Jt===2?(Nr=[0,-i.al,0],br=3):(Nr=[0,i.al,0],br=2);const nn=Hr.regionSegments[br];if(!nn)continue;const Jr=new Float32Array(16);i.br(Jr,Wt.projMatrix,Nr),Ht(Wt,Hr,nn,d.translatePosMatrix(Jr,sr,it,St),Tt)}}}function aie(_,d,m,w,M,O,D){w.centroidVertexArray.length===0&&w.createCentroidsBuffer();const B=O?O.findDEMTileFor(m):null;if(!(B&&B.dem||D))return;O&&B&&B.dem&&w.selfDEMTileTimestamp!==B.dem._timestamp&&(w.borderDoneWithNeighborZ=[-1,-1,-1,-1],w.selfDEMTileTimestamp=B.dem._timestamp);const V=Pe=>new i.P(Math.ceil((Pe+i.ed)*i.ee),0),Y=Pe=>{const Ve=d.getSource().minzoom,Xe=bt=>{const ut=d.getTileByID(bt);if(ut&&ut.hasData())return ut.getBucket(M)},We=[0,-1,1];for(const bt of We){if(Pe.overscaledZ+bt(Q[0]=Math.min(Pe.min.y,Ve.min.y),Q[1]=Math.max(Pe.max.y,Ve.max.y),Q[2]=i.al-Ve.min.x>Pe.max.x?Ve.min.x-i.al:Pe.max.x,Q),oe=(Pe,Ve)=>(Q[0]=Math.min(Pe.min.x,Ve.min.x),Q[1]=Math.max(Pe.max.x,Ve.max.x),Q[2]=i.al-Ve.min.y>Pe.max.y?Ve.min.y-i.al:Pe.max.y,Q),de=[(Pe,Ve)=>ce(Pe,Ve),(Pe,Ve)=>ce(Ve,Pe),(Pe,Ve)=>oe(Pe,Ve),(Pe,Ve)=>oe(Ve,Pe)],we=(Pe,Ve,Xe,We,bt,ut,xt)=>{if(!O)return 0;const ct=[[ut?Xe:Pe,ut?Pe:Xe,0],[ut?Xe:Ve,ut?Ve:Xe,0]],it=xt<0?i.al+xt:xt,St=[ut?it:(Pe+Ve)/2,ut?(Pe+Ve)/2:it,0];return Xe===0&&xt<0||Xe!==0&&xt>0?O.getForTilePoints(bt,[St],!0,We):ct.push(St),O.getForTilePoints(m,ct,!0,B),Math.max(ct[0][2],ct[1][2],St[2])/O.exaggeration()};for(let Pe=0;Pe<4;Pe++){const Ve=w.borderFeatureIndices[Pe];if(Ve.length===0)continue;const Xe=i.e9[Pe](m),We=Y(Xe);if(!(We&&We instanceof i.ea))continue;const bt=O?O.findDEMTileFor(Xe):null;if(!(bt&&bt.dem||D)||(O&&bt&&bt.dem&&w.borderDEMTileTimestamp[Pe]!==bt.dem._timestamp&&(w.borderDoneWithNeighborZ[Pe]=-1,w.borderDEMTileTimestamp[Pe]=bt.dem._timestamp),w.borderDoneWithNeighborZ[Pe]===We.canonical.z))continue;We.centroidVertexArray.length===0&&We.createCentroidsBuffer();const ut=(Pe<2?1:5)-Pe,xt=We.borderDoneWithNeighborZ[ut]!==w.canonical.z,ct=We.borderFeatureIndices[ut];let it=0;if(w.canonical.z!==We.canonical.z){for(const St of Ve)w.showCentroid(w.featuresOnBorder[St]);if(xt)for(const St of ct)We.showCentroid(We.featuresOnBorder[St]);w.borderDoneWithNeighborZ[Pe]=We.canonical.z,We.borderDoneWithNeighborZ[ut]=w.canonical.z}for(const St of Ve){const Dt=w.featuresOnBorder[St],Lt=w.centroidData[Dt.centroidDataIndex],Ht=Dt.borders[Pe];let Wt;for(;itHt[0]+3||sr[0]>Ht[0]-3)break;We.showCentroid(Wt),it++}if(Wt&&itHt[1]-3)&&(_r++,++it!==ct.length);)Wt=We.featuresOnBorder[ct[it]];Wt=We.featuresOnBorder[ct[sr]];let Bt=!1;if(_r>=1){const qt=Wt.borders[ut];Math.abs(Ht[0]-qt[0])<3&&Math.abs(Ht[1]-qt[1])<3&&(_r=1,Bt=!0,it=sr+1)}else if(_r===0){w.showCentroid(Dt);continue}const Tt=We.centroidData[Wt.centroidDataIndex];D&&Bt&&(((ve=Lt).flags|(De=Tt).flags)&i.ec?(ve.flags|=i.ec,De.flags|=i.ec):(ve.flags&=~i.ec,De.flags&=~i.ec));const Jt=Dt.intersectsCount()>1||Wt.intersectsCount()>1;if(_r>1)it=sr,Lt.centroidXY=Tt.centroidXY=new i.P(0,0);else if(bt&&bt.dem&&!Jt){const qt=de[Pe](Lt,Tt),dr=Pe%2?i.al-1:0,Tr=we(qt[0],Math.min(i.al-1,qt[1]),dr,bt,Xe,Pe<2,qt[2]);Lt.centroidXY=Tt.centroidXY=V(Tr)}else Jt?Lt.centroidXY=Tt.centroidXY=new i.P(0,0):(Lt.centroidXY=w.encodeBorderCentroid(Dt),Tt.centroidXY=We.encodeBorderCentroid(Wt));w.writeCentroidToBuffer(Lt),We.writeCentroidToBuffer(Tt)}else w.showCentroid(Dt)}w.borderDoneWithNeighborZ[Pe]=We.canonical.z,We.borderDoneWithNeighborZ[ut]=w.canonical.z}var ve,De;(w.needsCentroidUpdate||!w.centroidVertexBuffer&&w.centroidVertexArray.length!==0)&&w.uploadCentroid(_)}const Hd=[1,0,0],c5=[0,1,0],td=[0,0,1];function bp(_,d,m){const w=m.transform,M=m.shadowRenderer;if(!M)return!0;const O=_.toUnwrapped(),D=w.tileSize*M._cascades[m.currentShadowCascade].scale;let B=d;if(w.elevation){const ve=w.elevation.getMinMaxForTile(_);ve&&(B+=ve.max)}const V=[...M.shadowDirection];V[2]=-V[2];const Y=M.computeSimplifiedTileShadowVolume(O,B,D,V);if(!Y)return!1;const Q=[Hd,c5,td,V,[V[0],0,V[2]],[0,V[1],V[2]]],ce=w.projection.name==="globe",oe=w.scaleZoom(D),de=i.cB.fromInvProjectionMatrix(w.invProjMatrix,w.worldSize,oe,!ce),we=M.getCurrentCascadeFrustum();return de.intersectsPrecise(Y.vertices,Y.planes,Q)===0||we.intersectsPrecise(Y.vertices,Y.planes,Q)===0}function Ov(_){const{painter:d,source:m,layer:w,coords:M}=_;let O=_.defines;const D=d.context,B=d.renderPass==="shadow",V=d.renderPass==="light-beam",Y=d.shadowRenderer,Q=i.ef(d.transform.center.lat,d.transform.zoom),ce=Em(d,w.paint.get("building-cutoff-fade-range"));ce.shouldRenderCutoff&&(O=O.concat("RENDER_CUTOFF")),_.floodLightIntensity>0&&(O=O.concat("FLOOD_LIGHT"));for(const oe of M){const de=m.getTile(oe),we=de.getBucket(w);if(!we)continue;Y&&Y.getMaxCascadeForTile(oe.toUnwrapped())===0&&(O=O.concat("SHADOWS_SINGLE_CASCADE"));const ve=we.programConfigurations.get(w.id);let De,Pe,Ve,Xe=d.translatePosMatrix(oe.expandedProjMatrix,de,[0,0],"map");if(Xe=i.cS(i.bC(),Xe,[1,1,_.verticalScale]),B&&Y){if(bp(de.tileID,we.maxHeight*Q,d))continue;let bt=Y.calculateShadowPassMatrixFromTile(de.tileID.toUnwrapped());bt=i.cS(i.bC(),bt,[1,1,_.verticalScale]),Ve=Fm(bt),De=Pe=d.getOrCreateProgram("buildingDepth",{config:ve,defines:O,overrideFog:!1})}else if(V)De=Pe=d.getOrCreateProgram("buildingBloom",{config:ve,defines:O,overrideFog:!1}),Ve=pP(Xe);else{const bt=d.transform.calculatePosMatrix(oe.toUnwrapped(),d.transform.worldSize);i.cS(bt,bt,[1,1,_.verticalScale]);const ut=i.bC();i.cS(ut,bt,[1,-1,1/Q]),i.bl(ut,ut),i.eg(ut,ut);const xt=d.transform.getFreeCameraOptions().position,ct=1<{if(V){const xt=bt.entranceBloom;ut.draw(d,D.gl.TRIANGLES,_.depthMode,$n.disabled,_.blendMode,zn.disabled,Ve,w.id,xt.layoutVertexBuffer,xt.indexBuffer,xt.segmentsBucket,w.paint,d.transform.zoom,ve,[xt.layoutAttenuationBuffer,xt.layoutColorBuffer])}else{const xt=bt.segmentsBucket;let ct=[bt.layoutNormalBuffer,bt.layoutCentroidBuffer,bt.layoutColorBuffer,bt.layoutFloodLightDataBuffer];bt.layoutFacadePaintBuffer&&(ct=ct.concat([bt.layoutFacadeDataBuffer,bt.layoutFacadeVerticalRangeBuffer,bt.layoutFacadePaintBuffer])),ut.draw(d,D.gl.TRIANGLES,_.depthMode,$n.disabled,_.blendMode,B?zn.disabled:zn.backCW,Ve,w.id,bt.layoutVertexBuffer,bt.indexBuffer,xt,w.paint,d.transform.zoom,ve,ct)}};d.uploadCommonUniforms(D,Pe,oe.toUnwrapped(),null,ce),we.buildingWithoutFacade&&We(we.buildingWithoutFacade,Pe),we.buildingWithFacade&&(De!==Pe&&d.uploadCommonUniforms(D,De,oe.toUnwrapped(),null,ce),We(we.buildingWithFacade,De))}}function Jk(_,d,m,w,M,O,D,B,V,Y,Q,ce,oe){const de=_.context.gl,we=_.depthModeForSublayer(1,dn.ReadOnly,de.LEQUAL,!0),ve=.1*(1-(De=Q))+3*De;var De;const Pe=_._showOverdrawInspector,Ve=ce,Xe=new l5;Pe||_p(Xe,_,d,m,w,we,new $n({func:de.ALWAYS,mask:255},255,255,de.KEEP,de.KEEP,de.REPLACE),new as([de.ONE,de.ONE,de.ONE,de.ONE],i.ao.transparent,[!1,!1,!1,!0],de.MIN),zn.disabled,M,"sdf",O,D,B,V,Y,ve,Ve,!1);{const We=Pe?$n.disabled:new $n({func:de.EQUAL,mask:255},255,255,de.KEEP,de.DECR,de.DECR),bt=Pe?_.colorModeForRenderPass():new as([de.ONE_MINUS_DST_ALPHA,de.DST_ALPHA,de.ONE,de.ONE],i.ao.transparent,[!0,!0,!0,!0]);_p(Xe,_,d,m,w,we,We,bt,zn.disabled,M,"color",O,D,B,V,Y,ve,Ve,!1)}}function eN(_){return[_[0]*i.eh,_[1]*i.eh,_[2]*i.eh,0]}function Dv(_,d,m,w,M,O,D,B,V){const Y=w.getSource(),Q=m.globeSharedBuffers;if(!Q)return;let ce,oe,de;if(d&&(ce=w.getTile(d)),Y instanceof i.aU?(oe=Y.texture,de=i.dK(0,0,m.transform)):ce&&d&&(oe=ce.texture,de=i.dK(d.canonical.z,d.canonical.x,m.transform)),!oe||!de)return;_||(de=i.cS(i.bC(),de,[1,-1,1]));const we=m.context,ve=we.gl,De=M.paint.get("raster-resampling")==="nearest"?ve.NEAREST:ve.LINEAR,Pe=m.colorModeForDrapableLayerRenderPass(O),Ve=D.defines;Ve.push("GLOBE_POLES");const Xe=new dn(ve.LEQUAL,dn.ReadWrite,m.depthRangeFor3D),We=Float32Array.from(m.transform.expandedFarZProjMatrix),bt=Float32Array.from(i.bk(i.dJ(new i.cD(0,0,0))));m.terrain&&m.terrain.prepareDrawTile(),we.activeTexture.set(ve.TEXTURE0),oe.bind(De,ve.CLAMP_TO_EDGE),we.activeTexture.set(ve.TEXTURE1),oe.bind(De,ve.CLAMP_TO_EDGE),"useMipmap"in oe&&we.extTextureFilterAnisotropic&&m.transform.pitch>20&&ve.texParameterf(ve.TEXTURE_2D,we.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,we.extTextureFilterAnisotropicMax);const[ut,xt,ct,it]=d?Q.getPoleBuffers(d.canonical.z,!1):Q.getPoleBuffers(0,!0),St=M.paint.get("raster-elevation");let Dt;_?(Dt=ut,m.renderDefaultNorthPole=St!==0):(Dt=xt,m.renderDefaultSouthPole=St!==0);const Lt=eN(D.mix),Ht=((sr,_r,Bt,Tt,Jt,qt,dr,Tr,Hr,Nr,br,nn,Jr)=>xP(sr,_r,Bt,new Float32Array(16),new Float32Array(9),[0,0],Tt,[0,0],[0,0,0,0],1,{opacity:1,mix:0},qt,[0,0],Tr,2,Nr,br,nn,1,0,Jr))(We,bt,de,i.aj(m.transform.zoom),0,M,0,St,0,Lt,D.offset,D.range,O),Wt=m.getOrCreateProgram("raster",{defines:Ve});m.uploadCommonUniforms(we,Wt,null),Wt.draw(m,ve.TRIANGLES,Xe,V,Pe,B,Ht,M.id,Dt,ct,it)}function kP(_){const d=_._nearZ,m=_.projection.farthestPixelDistance(_),w=m-d,M=.2*_.height,O=d+M;return[d,m,(O-M-d)/w,(O-d)/w]}function wp(_,d,m,w){if(_)return d instanceof rc&&_ instanceof hp?d.getTextureDescriptor(_,m,!0):{texture:_.texture,mix:eN(w.mix),offset:w.offset,buffer:0,tileSize:1}}var ti=i.ei([{name:"a_index",type:"Int16",components:1}]);class tN{constructor(d,m,w,M){const O={width:w[0],height:w[1],data:null},D=d.gl;this.targetColorTexture=new i.T(d,O,D.RGBA8,{useMipmap:!1}),this.backgroundColorTexture=new i.T(d,O,D.RGBA8,{useMipmap:!1}),this.context=d,this.updateParticleTexture(m,M),this.lastInvalidatedAt=0}updateParticleTexture(d,m){if(this.particleTextureDimension===m.width)return;(this.particleTexture0||this.particleTexture1||this.particleIndexBuffer||this.particleSegment)&&(this.particleTexture0.destroy(),this.particleTexture1.destroy(),this.particleIndexBuffer.destroy(),this.particleSegment.destroy());const w=this.context.gl,M=m.width*m.height;this.particleTexture0=new i.T(this.context,m,w.RGBA8,{premultiply:!1,useMipmap:!1}),this.particleTexture1=new i.T(this.context,m,w.RGBA8,{premultiply:!1,useMipmap:!1});const O=new i.ej;O.reserve(M);for(let D=0;D0){const Lt=i.bj(m.canonical,V),Ht=i.el(Lt);oe=i.aB(new Float32Array(16),V.globeMatrix,Ht),i.aB(oe,V.projMatrix,oe)}const de=i.bC();de[12]+=2*M/(i.o.devicePixelRatio*V.width),de[13]+=2*O/(i.o.devicePixelRatio*V.height),i.aB(oe,de,oe);const we=_.getOrCreateProgram("debug",{defines:ce}),ve=d.getTileByID(m.key);_.terrain&&_.terrain.setupElevationDraw(ve,we);const De=dn.disabled,Pe=$n.disabled,Ve=_.colorModeForRenderPass(),Xe="$debug";B.activeTexture.set(Y.TEXTURE0),_.emptyTexture.bind(Y.LINEAR,Y.CLAMP_TO_EDGE),Q?ve._makeGlobeTileDebugBuffers(_.context,V):ve._makeDebugTileBoundsBuffers(_.context,V.projection);const We=ve._tileDebugBuffer||_.debugBuffer,bt=ve._tileDebugIndexBuffer||_.debugIndexBuffer,ut=ve._tileDebugSegments||_.debugSegments;if(we.draw(_,Y.LINE_STRIP,De,Pe,Ve,zn.disabled,Ev(oe,w.toPremultipliedRenderColor(null)),Xe,We,bt,ut,null,null,null,[ve._globeTileDebugBorderBuffer]),D){const Lt=ve.latestRawTileData,Ht=Math.floor((Lt&&Lt.byteLength||0)/1024);let Wt=m.canonical.toString();m.overscaledZ!==m.canonical.z&&(Wt+=` => ${m.overscaledZ}`),Wt+=` ${ve.state}`,Wt+=` ${Ht}kb`,function(sr,_r){sr.initDebugOverlayCanvas();const Bt=sr.debugOverlayCanvas,Tt=sr.context.gl,Jt=sr.debugOverlayCanvas.getContext("2d");Jt.clearRect(0,0,Bt.width,Bt.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(Bt),sr.debugOverlayTexture.bind(Tt.LINEAR,Tt.CLAMP_TO_EDGE)}(_,Wt)}const xt=d.getTile(m).tileSize,ct=512/Math.min(xt,512)*(m.overscaledZ/V.zoom)*.5,it=ve._tileDebugTextBuffer||_.debugBuffer,St=ve._tileDebugTextIndexBuffer||_.quadTriangleIndexBuffer,Dt=ve._tileDebugTextSegments||_.debugSegments;we.draw(_,Y.TRIANGLES,De,Pe,as.alphaBlended,zn.disabled,Ev(oe,i.ao.transparent.toPremultipliedRenderColor(null),ct),Xe,it,St,Dt,null,null,null,[ve._globeTileDebugTextBuffer])}function tx(_,d,m,w){Ft(_,0,d+m/2,_.transform.width,m,w)}function Wi(_,d,m,w){Ft(_,d-m/2,0,m,_.transform.height,w)}function Ft(_,d,m,w,M,O){const D=_.context,B=D.gl;B.enable(B.SCISSOR_TEST),B.scissor(d*i.o.devicePixelRatio,m*i.o.devicePixelRatio,w*i.o.devicePixelRatio,M*i.o.devicePixelRatio),D.clear({color:O}),B.disable(B.SCISSOR_TEST)}const TP=i.ei([{name:"a_pos_3f",components:3,type:"Float32"}]),{members:rN}=TP;function wf(_,d,m,w){_.emplaceBack(d,m,w)}class nN{constructor(d){this.vertexArray=new i.em,this.indices=new i.b0,wf(this.vertexArray,-1,-1,1),wf(this.vertexArray,1,-1,1),wf(this.vertexArray,-1,1,1),wf(this.vertexArray,1,1,1),wf(this.vertexArray,-1,-1,-1),wf(this.vertexArray,1,-1,-1),wf(this.vertexArray,-1,1,-1),wf(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,rN),this.indexBuffer=d.createIndexBuffer(this.indices),this.segment=i.bg.simpleSegment(0,0,36,12)}}function rx(_,d,m,w,M,O){const D=_.context.gl,B=d.paint.get("sky-atmosphere-color"),V=d.paint.get("sky-atmosphere-halo-color"),Y=d.paint.get("sky-atmosphere-sun-intensity"),Q=((ce,oe,de,we,ve)=>({u_matrix_3f:ce,u_sun_direction:oe,u_sun_intensity:de,u_color_tint_r:[we.r,we.g,we.b,we.a],u_color_tint_m:[ve.r,ve.g,ve.b,ve.a],u_luminance:5e-5}))(i.eo(i.dO(),w),M,Y,B.toPremultipliedRenderColor(null),V.toPremultipliedRenderColor(null));D.framebufferTexture2D(D.FRAMEBUFFER,D.COLOR_ATTACHMENT0,D.TEXTURE_CUBE_MAP_POSITIVE_X+O,d.skyboxTexture,0),m.draw(_,D.TRIANGLES,dn.disabled,$n.disabled,as.unblended,zn.frontCW,Q,"skyboxCapture",d.skyboxGeometry.vertexBuffer,d.skyboxGeometry.indexBuffer,d.skyboxGeometry.segment)}const AP=i.ei([{type:"Float32",name:"a_pos",components:3},{type:"Float32",name:"a_uv",components:2}]);class By{constructor(d){const m=new i.ep;m.emplaceBack(-1,1,1,0,0),m.emplaceBack(1,1,1,1,0),m.emplaceBack(1,-1,1,1,1),m.emplaceBack(-1,-1,1,0,1);const w=new i.b0;w.emplaceBack(0,1,2),w.emplaceBack(2,3,0),this.vertexBuffer=d.createVertexBuffer(m,AP.members),this.indexBuffer=d.createIndexBuffer(w),this.segments=i.bg.simpleSegment(0,0,4,2)}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy()}}const iie=i.ei([{type:"Float32",name:"a_pos_3f",components:3},{type:"Float32",name:"a_uv",components:2},{type:"Float32",name:"a_size_scale",components:1},{type:"Float32",name:"a_fade_opacity",components:1}]);class oie{constructor(){this.starsCount=16e3,this.sizeMultiplier=.15,this.sizeRange=100,this.intensityRange=200}}class EP{constructor(d){this.colorModeAlphaBlendedWriteRGB=new as([1,yf,1,yf],i.ao.transparent,[!0,!0,!0,!1]),this.colorModeWriteAlpha=new as([1,0,1,0],i.ao.transparent,[!1,!1,!1,!0]),this.params=new oie,this.updateNeeded=!0}update(d){const m=d.context;if(!this.atmosphereBuffer||this.updateNeeded){this.updateNeeded=!1,this.atmosphereBuffer=new By(m);const w=this.params.sizeRange,M=this.params.intensityRange,O=function(Q){const ce=i.eq(30),oe=[];for(let de=0;de{const ct=O.projection.name==="globe"?["PROJECTION_GLOBE_VIEW","FOG"]:["FOG"];xt&&ct.push("ALPHA_PASS");const it=d.getOrCreateProgram("globeAtmosphere",{defines:ct}),St=((Lt,Ht,Wt,sr,_r,Bt,Tt,Jt,qt,dr,Tr,Hr)=>({u_frustum_tl:Lt,u_frustum_tr:Ht,u_frustum_br:Wt,u_frustum_bl:sr,u_horizon:_r,u_transition:Bt,u_fadeout_range:Tt,u_atmosphere_fog_color:Jt.toArray01(),u_high_color:qt.toArray01(),u_space_color:dr.toArray01(),u_temporal_offset:Tr,u_horizon_angle:Hr}))(O.frustumCorners.TL,O.frustumCorners.TR,O.frustumCorners.BR,O.frustumCorners.BL,O.frustumCorners.horizon,B,De,Q,oe,we,Ve,bt);d.uploadCommonUniforms(w,it);const Dt=this.atmosphereBuffer;Dt&&it.draw(d,M.TRIANGLES,D,$n.disabled,xt?this.colorModeWriteAlpha:this.colorModeAlphaBlendedWriteRGB,zn.backCW,St,xt?"atmosphere_glow_alpha":"atmosphere_glow",Dt.vertexBuffer,Dt.indexBuffer,Dt.segments)};ut(!1),ut(!0)}drawStars(d,m){const w=i.aA(m.properties.get("star-intensity"),0,1);if(w===0)return;const M=d.context,O=M.gl,D=d.transform,B=d.getOrCreateProgram("stars"),V=i.c7([]);i.c9(V,V,-D._pitch),i.c8(V,V,-D.angle),i.c9(V,V,i.an(D._center.lat)),i.et(V,V,-i.an(D._center.lng));const Y=i.cc(new Float32Array(16),V),Q=i.aB([],D.starsProjMatrix,Y),ce=i.eo([],Y),oe=i.eu([],ce),de=[0,1,0];i.dQ(de,de,oe),i.c5(de,de,this.params.sizeMultiplier);const we=[1,0,0];i.dQ(we,we,oe),i.c5(we,we,this.params.sizeMultiplier);const ve=(De=de,Pe=we,Ve=w,{u_matrix:Float32Array.from(Q),u_up:De,u_right:Pe,u_intensity_multiplier:Ve});var De,Pe,Ve;d.uploadCommonUniforms(M,B),this.starsVx&&this.starsIdx&&B.draw(d,O.TRIANGLES,dn.disabled,$n.disabled,this.colorModeAlphaBlendedWriteRGB,zn.disabled,ve,"atmosphere_stars",this.starsVx,this.starsIdx,this.starsSegments)}}class sN{constructor(){this.visibleTiles=[]}updateBorders(d,m){const w=[],M=[],O=d._getRenderableCoordinates(!1,!0);for(const V of O){const Y=d.getTile(V);if(!Y.hasData())continue;const Q=Y.getBucket(m);Q&&(Q.isEmpty()||(w.push(V.key),M.push({bucket:Q,tileID:V.canonical})))}let D=w.length!==this.visibleTiles.length;if(!D){w.sort();for(let V=0;VV.tileID.z-Y.tileID.z||V.tileID.x-Y.tileID.x||V.tileID.y-Y.tileID.y);for(const V of M){const Y=new Array,Q=new Array,ce=V.bucket;for(const oe of ce.featuresOnBorder)B.has(oe.featureId)?Q.push(oe.footprintIndex):(B.add(oe.featureId),Y.push(oe.footprintIndex));ce.updateFootprintHiddenFlags(Y,i.ev,!1),ce.updateFootprintHiddenFlags(Q,i.ev,!0)}}}function aN(_,d){const m=[..._],w=d.cameraWorldSizeForFog/d.worldSize,M=i.bA([]);return i.cS(M,M,[w,w,1]),i.aB(m,M,m),i.aB(m,d.worldToFogMatrix,m),m}function iN(_,d,m,w,M){const O=m.material,D=w.context,{baseColorTexture:B,metallicRoughnessTexture:V}=O.pbrMetallicRoughness,{normalTexture:Y,occlusionTexture:Q,emissionTexture:ce}=O;function oe(we,ve,De){if(we&&(_.push(ve),D.activeTexture.set(D.gl.TEXTURE0+De),we.gfxTexture)){const{minFilter:Pe,magFilter:Ve,wrapS:Xe,wrapT:We}=we.sampler;we.gfxTexture.bindExtraParam(Pe,Ve,Xe,We)}}oe(B,"HAS_TEXTURE_u_baseColorTexture",Cl.BaseColor),oe(V,"HAS_TEXTURE_u_metallicRoughnessTexture",Cl.MetallicRoughness),oe(Y,"HAS_TEXTURE_u_normalTexture",Cl.Normal),oe(Q,"HAS_TEXTURE_u_occlusionTexture",Cl.Occlusion),oe(ce,"HAS_TEXTURE_u_emissionTexture",Cl.Emission),M&&(M.texture||(M.texture=new i.d$(w.context,M.image,[M.image.height,M.image.height,M.image.height],D.gl.RGBA8)),D.activeTexture.set(D.gl.TEXTURE0+Cl.LUT),M.texture&&M.texture.bind(D.gl.LINEAR,D.gl.CLAMP_TO_EDGE),_.push("APPLY_LUT_ON_GPU")),m.texcoordBuffer&&(_.push("HAS_ATTRIBUTE_a_uv_2f"),d.push(m.texcoordBuffer)),m.colorBuffer&&(_.push(m.colorBuffer.itemSize===12?"HAS_ATTRIBUTE_a_color_3f":"HAS_ATTRIBUTE_a_color_4f"),d.push(m.colorBuffer)),m.normalBuffer&&(_.push("HAS_ATTRIBUTE_a_normal_3f"),d.push(m.normalBuffer)),m.pbrBuffer&&(_.push("HAS_ATTRIBUTE_a_pbr"),_.push("HAS_ATTRIBUTE_a_heightBasedEmissiveStrength"),d.push(m.pbrBuffer)),O.alphaMode!=="OPAQUE"&&O.alphaMode!=="MASK"||_.push("UNPREMULT_TEXTURE_IN_SHADER"),O.defined||_.push("DIFFUSE_SHADED");const de=w.shadowRenderer;de&&(_.push("RENDER_SHADOWS","DEPTH_TEXTURE"),de.useNormalOffset&&_.push("NORMAL_OFFSET"))}function oN(_,d,m,w,M,O){const D=_.modelOpacity,B=d.context,V=new dn(d.context.gl.LEQUAL,_.isLightMesh?dn.ReadOnly:dn.ReadWrite,d.depthRangeFor3D),Y=d.transform,Q=_.mesh,ce=Q.material,oe=ce.pbrMetallicRoughness,de=d.style.fog;let we;we=d.transform.projection.zAxisUnit==="pixels"?[..._.nodeModelMatrix]:i.aB([],w.zScaleMatrix,_.nodeModelMatrix),i.aB(we,w.negCameraPosMatrix,we);const ve=i.bl([],we);i.eg(ve,ve);const De=m.paint.get("model-color-use-theme").constantOr("default")==="none",Pe=m.paint.get("model-emissive-strength").constantOr(0),Ve=Xg(new Float32Array(_.worldViewProjection),new Float32Array(we),new Float32Array(ve),null,d,D,oe.baseColorFactor,ce.emissiveFactor,oe.metallicFactor,oe.roughnessFactor,ce,Pe,m,void 0,void 0,_.materialOverride,_.modelColor),Xe={defines:[]},We=[],bt=d.shadowRenderer;bt&&(bt.useNormalOffset=!1),iN(Xe.defines,We,Q,d,De?null:m.lut);let ut=null;if(de){const it=aN(_.nodeModelMatrix,d.transform);if(ut=new Float32Array(it),Y.projection.name!=="globe"){const St=Q.aabb.min,Dt=Q.aabb.max,[Lt,Ht]=de.getOpacityForBounds(it,St[0],St[1],Dt[0],Dt[1]);Xe.overrideFog=Lt>=ar||Ht>=ar}}const xt=Em(d,m.paint.get("model-cutoff-fade-range"));xt.shouldRenderCutoff&&Xe.defines.push("RENDER_CUTOFF");const ct=d.getOrCreateProgram("model",Xe);d.uploadCommonUniforms(B,ct,null,ut,xt),d.renderPass!=="shadow"&&bt&&bt.setupShadowsFromMatrix(_.nodeModelMatrix,ct),ct.draw(d,B.gl.TRIANGLES,V,M,O,Q.material.doubleSided?zn.disabled:zn.backCCW,Ve,m.id,Q.vertexBuffer,Q.indexBuffer,Q.segments,m.paint,d.transform.zoom,void 0,We)}function Rv(_,d){return _.style._importedAsBasemap?"basemap":d.scope}function nx(_,d,m,w,M,O,D,B,V,Y){const Q=_.transform,ce=!!d.isGeometryBloom&&d.isGeometryBloom;if(ce&&_.renderPass==="shadow")return;const oe=Q.projection.name==="globe"?i.eD(m,Q):[...m];i.aB(oe,oe,d.globalMatrix);const de=i.aB([],w,oe);if(d.meshes)for(const we of d.meshes){const ve=B.get(we.material.name);if(ve&&ve.opacity<=0)continue;if(we.material.alphaMode!=="BLEND"){D.push({mesh:we,depth:0,modelIndex:M,worldViewProjection:de,nodeModelMatrix:oe,isLightMesh:ce,materialOverride:ve,modelOpacity:V,modelColor:Y});continue}const De=i.af([],we.centroid,de);!Q.isOrthographic&&De[2]<=0||O.push({mesh:we,depth:De[2],modelIndex:M,worldViewProjection:de,nodeModelMatrix:oe,isLightMesh:ce,materialOverride:ve,modelOpacity:V,modelColor:Y})}if(d.children)for(const we of d.children)nx(_,we,m,w,M,O,D,B,V,Y)}function Lh(_,d,m,w){const M=m.shadowRenderer;if(!M)return;const O=M.getShadowPassDepthMode(),D=M.getShadowPassColorMode(),B=M.calculateShadowPassMatrixFromMatrix(d),V=a5(B);m.getOrCreateProgram("modelDepth",{defines:m._shadowMapDebug?[]:["DEPTH_TEXTURE"]}).draw(m,m.context.gl.TRIANGLES,O,$n.disabled,D,zn.disabled,V,w.id,_.vertexBuffer,_.indexBuffer,_.segments,w.paint,m.transform.zoom,void 0,void 0)}function IP(_,d,m,w,M,O){for(const D of M){const B=Object.assign({},w);B.part=D;const V={type:"Unknown",id:d,properties:B},Y={orientation:_.paint.get("model-rotation").evaluate(V,m)};O.set(D,Y)}}function PP(_,d,m,w,M,O){for(const D of M){const B=Object.assign({},w);B.part=D;const V={type:"Unknown",id:d,properties:B},Y={color:_.paint.get("model-color").evaluate(V,m),colorMix:_.paint.get("model-color-mix-intensity").evaluate(V,m),opacity:_.paint.get("model-opacity").evaluate(V,m),emissionStrength:_.paint.get("model-emissive-strength").evaluate(V,m)};O.set(D,Y)}}function LP(_,d,m,w,M){let O=!1;for(const B of w)B.modelOpacity!==1&&(oN(B,_,d,M[B.modelIndex],$n.disabled,as.disabled),O=!0);for(const B of w)oN(B,_,d,M[B.modelIndex],B.modelOpacity!==1?_.stencilModeFor3D():$n.disabled,_.colorModeForRenderPass());O&&_.resetStencilClippingMasks();const D=as.additive;for(const B of m)oN(B,_,d,M[B.modelIndex],$n.disabled,B.isLightMesh?D:_.colorModeForRenderPass())}function OP(_,d,m){const w=d.updateZoomBasedPaintProperties(),M=function(O,D,B){let V,Y,Q,ce=O.terrain?O.terrain.exaggeration():0;if(O.terrain&&ce>0){const oe=O.terrain,de=oe.findDEMTileFor(B);de&&de.dem?V=i.eF.create(oe,B,de):ce=0}if(ce===0&&(D.terrainElevationMin=0,D.terrainElevationMax=0),ce===D.validForExaggeration&&(ce===0||V&&V._demTile&&V._demTile.tileID===D.validForDEMTile.id&&V._dem._timestamp===D.validForDEMTile.timestamp))return!1;for(const oe in D.instancesPerModel){const de=D.instancesPerModel[oe];for(let we=0;weY&&(Y=de.max)}const Q=i.aA(w.x,O,D)-w.x,ce=i.aA(w.y,B,V)-w.y,oe=i.cf(Y,d.center.lat)-w.z;return d._zoomFromMercatorZ(Math.sqrt(Q*Q+ce*ce+oe*oe))}function DP(_,d,m,w,M,O,D){const B=_.context,V=_.renderPass==="shadow",Y=_.shadowRenderer,Q=V&&Y?Y.getShadowPassDepthMode():new dn(B.gl.LEQUAL,dn.ReadWrite,_.depthRangeFor3D),ce=_.isTileAffectedByFog(O),oe=_.transform.projection.name==="globe";if(m.meshes)for(const de of m.meshes){const we=oe?[]:["MODEL_POSITION_ON_GPU"],ve=[];let De,Pe,Ve;const Xe=!oe&&w.instancedDataArray.length>20;Xe&&we.push("INSTANCED_ARRAYS");const We=Em(_,d.paint.get("model-cutoff-fade-range"));if(We.shouldRenderCutoff&&we.push("RENDER_CUTOFF"),V&&Y)De=_.getOrCreateProgram("modelDepth",{defines:we}),Pe=a5(D.shadowTileMatrix,D.shadowTileMatrix,Float32Array.from(m.globalMatrix)),Ve=Y.getShadowPassColorMode();else{iN(we,ve,de,_,d.paint.get("model-color-use-theme").constantOr("default")==="none"?null:d.lut),De=_.getOrCreateProgram("model",{defines:we,overrideFog:ce});const ut=de.material,xt=ut.pbrMetallicRoughness,ct=d.paint.get("model-opacity").constantOr(1),it=d.paint.get("model-emissive-strength").constantOr(0);Pe=Xg(O.expandedProjMatrix,Float32Array.from(m.globalMatrix),new Float32Array(16),null,_,ct,xt.baseColorFactor,ut.emissiveFactor,xt.metallicFactor,xt.roughnessFactor,ut,it,d,M),Y&&(D.shadowUniformsInitialized?De.setShadowUniformValues(B,Y.getShadowUniformValues()):(Y.setupShadows(O.toUnwrapped(),De,"model-tile"),D.shadowUniformsInitialized=!0)),Ve=We.shouldRenderCutoff||ct<1||ut.alphaMode!=="OPAQUE"?as.alphaBlended:as.unblended}_.uploadCommonUniforms(B,De,O.toUnwrapped(),null,We);const bt=de.material.doubleSided?zn.disabled:zn.backCCW;if(Xe)ve.push(w.instancedDataBuffer),De.draw(_,B.gl.TRIANGLES,Q,$n.disabled,Ve,bt,Pe,d.id,de.vertexBuffer,de.indexBuffer,de.segments,d.paint,_.transform.zoom,void 0,ve,w.instancedDataArray.length);else{const ut=V?"u_instance":"u_normal_matrix";for(let xt=0;xtV[1]?D:V,O[0]=m.max[0],D=i.aC(i.eG(),O,M),B=D[1]V[1]?D:V,O[1]=m.min[1],D=i.aC(i.eG(),O,M),B=D[1]V[1]?D:V;const Y=i.aA(w[0],0,1),Q=100*d.pixelsPerMeter*i.aA(w[1],0,1),ce=i.aA(w[2],0,1),oe=i.eH(i.eG(),B,V,Y),de=Math.tan(.5*d.fovX),we=-oe[2]*de;if(Q===0)return oe[1]<-Math.abs(we)?ce:1;const ve=(-Math.abs(we)-oe[1])/Q,De=(Ve,Xe,We)=>(1-We)*Ve+We*Xe,Pe=i.aA(De(1,ce,ve),ce,1);return De(1,Pe,i.aA((d.pitch-20)/20,0,1))}class RP{}class $m{constructor(){this._storage=new Map}getLinesFromTrianglesBuffer(d,m,w){{const ce=this._storage.get(m.id);if(ce)return ce.lastUsedFrameIdx=d,ce.buf}const M=w.gl,O=M.getBufferParameter(M.ELEMENT_ARRAY_BUFFER,M.BUFFER_SIZE),D=new ArrayBuffer(O),B=new Int16Array(D);M.getBufferSubData(M.ELEMENT_ARRAY_BUFFER,0,new Int16Array(D));const V=new i.eJ;for(let ce=0;ce30&&(w.buf.destroy(),this._storage.delete(m))}destroy(){for(const[d,m]of this._storage)m.buf.destroy(),this._storage.delete(d)}}class $y{constructor(){this.occluderSize=30,this.depthOffset=-1e-4}}const Uy=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 jp{constructor(d){this.revealStart=11,this.revealRange=2}}const u5=i.ei([{type:"Float32",name:"a_pos_2f",components:2}]);class h5{destroy(){this.vignetteVx&&this.vignetteVx.destroy(),this.vignetteIdx&&this.vignetteIdx.destroy()}draw(d,m){const w=d.getOrCreateProgram("vignette");if(!this.vignetteVx||!this.vignetteIdx){const D=new i.eK,B=new i.b0;D.emplaceBack(-1,-1),D.emplaceBack(1,-1),D.emplaceBack(1,1),D.emplaceBack(-1,1),B.emplaceBack(0,1,2),B.emplaceBack(0,2,3),this.vignetteVx=d.context.createVertexBuffer(D,u5.members),this.vignetteIdx=d.context.createIndexBuffer(B)}const M=i.bg.simpleSegment(0,0,4,6);if(this.vignetteVx&&this.vignetteIdx){d.uploadCommonUniforms(d.context,w);const D={u_vignetteShape:(O={vignetteShape:[m.start,m.range,Math.pow(10,m.fadePower)],vignetteColor:[m.color.r,m.color.g,m.color.b,m.color.a*m.strength]}).vignetteShape,u_vignetteColor:O.vignetteColor};w.draw(d,d.context.gl.TRIANGLES,dn.disabled,$n.disabled,as.alphaBlended,zn.disabled,D,"vignette",this.vignetteVx,this.vignetteIdx,M)}var O}}class f5{constructor(){this._accumulatedOffsetX=0,this._accumulatedOffsetY=0,this._accumulatedElevation=0}update(d,m){const w=d.getFreeCameraOptions().position,M=w.toAltitude(),O=w.toLngLat(),D=i.an(O.lng),B=i.an(O.lat),V=d.pixelsPerMeter/m,Y=D*i.eM,Q=i.eM*Math.log(Math.tan(Math.PI/4+B/2));if(this._offsetXPrev===void 0)this._offsetXPrev=0,this._offsetYPrev=0,this._elevationPrev=0,this._accumulatedOffsetX=0,this._accumulatedOffsetY=0,this._accumulatedElevation=0;else{const ce=-this._offsetYPrev+Q,oe=-this._elevationPrev+M;this._accumulatedOffsetX+=(-this._offsetXPrev+Y)*V,this._accumulatedOffsetY+=ce*V,this._accumulatedElevation+=oe*V,this._offsetXPrev=Y,this._offsetYPrev=Q,this._elevationPrev=M}}getPosition(){return[this._accumulatedOffsetX,this._accumulatedOffsetY,this._accumulatedElevation]}}function lN(_,d){return[-(_[0]-Math.floor(_[0]/d)*d),-(_[1]-Math.floor(_[1]/d)*d),-(_[2]-Math.floor(_[2]/d)*d)]}function vu(_){const d=i.eq(1323123451230),m=[];for(let w=0;w<_;++w){const M=2*d()-1,O=2*d()-1,D=2*d()-1;m.push(i.d5(M,O,D))}return m}function jd(_,d,m,w,M){const O=i.aA((M-m)/(w-m),0,1);return(1-O)*_+O*d}class sx{constructor(d){this._movement=new f5,this._accumulatedTimeFromStart=0,this._prevTime=Date.now()/1e3,this._vignette=new h5,this._ppmScaleFactor=d}destroy(){this.particlesVx&&this.particlesVx.destroy(),this.particlesIdx&&this.particlesIdx.destroy(),this._vignette&&this._vignette.destroy()}updateOnRender(d,m){const w=d.transform;this._movement.update(w,this._ppmScaleFactor);const M=w.starsProjMatrix,O=i.c7([]);i.c9(O,O,i.an(90)-w._pitch),i.c8(O,O,-w.angle);const D=i.cc(new Float32Array(16),O),B=i.eL(1,0,0,0,0,0,1,0,0,-1,0,0,0,0,0,1),V=i.eg([],B),Y=i.aB([],V,D),Q=Date.now()/1e3;return this._accumulatedTimeFromStart+=(Q-this._prevTime)*m,this._prevTime=Q,{projectionMatrix:M,modelviewMatrix:Y}}}class cN extends sx{constructor(d){super(4.25),this._params={overrideStyleParameters:!1,intensity:.5,timeFactor:1,velocityConeAperture:0,velocity:300,boxSize:2500,dropletSizeX:1,dropletSizeYScale:10,distortionStrength:70,screenThinning:{intensity:.57,start:.46,range:1.17,fadePower:.17,affectedRatio:1,particleOffset:-.2},color:{r:.66,g:.68,b:.74,a:.7},direction:{x:-50,y:-35},shapeDirPower:2,shapeNormalPower:1},this._revealParams=new jp("Precipitation > Rain"),this._vignetteParams={strength:1,start:.7,range:1,fadePower:.4,color:{r:.27,g:.27,b:.27,a:1}},this.particlesCount=16e3}update(d){const m=d.context;if(!this.particlesVx){const w=vu(this.particlesCount),M=new i.eN,O=new i.b0;let D=0;const B=i.eq(1323123451230);for(let V=0;Vw)return;const M=jd(0,1,m.revealStart,m.revealStart+m.revealRange,w);if(!this.particlesVx||!this.particlesIdx)return;const O=structuredClone(this._params);let D=[-O.direction.x,O.direction.y,-100];i.aw(D,D);const B=structuredClone(this._vignetteParams);B.strength*=M,O.overrideStyleParameters||(O.intensity=d.style.rain.state.density,O.timeFactor=d.style.rain.state.intensity,O.color=structuredClone(d.style.rain.state.color),D=structuredClone(d.style.rain.state.direction),O.screenThinning.intensity=d.style.rain.state.centerThinning,O.dropletSizeX=d.style.rain.state.dropletSize[0],O.dropletSizeYScale=d.style.rain.state.dropletSize[1]/d.style.rain.state.dropletSize[0],O.distortionStrength=100*d.style.rain.state.distortionStrength,B.strength=1,B.color=structuredClone(d.style.rain.state.vignetteColor));const V=this.updateOnRender(d,O.timeFactor),Y=d.context,Q=Y.gl,ce=d.transform;this.screenTexture&&this.screenTexture.size[0]===d.width&&this.screenTexture.size[1]===d.height||(this.screenTexture=new i.T(Y,{width:d.width,height:d.height,data:null},Q.RGBA8)),O.distortionStrength>0&&(Y.activeTexture.set(Q.TEXTURE0),this.screenTexture.bind(Q.LINEAR,Q.CLAMP_TO_EDGE),Q.copyTexSubImage2D(Q.TEXTURE_2D,0,0,0,0,0,d.width,d.height));const oe=d.getOrCreateProgram("rainParticle");d.uploadCommonUniforms(Y,oe),Y.activeTexture.set(Q.TEXTURE0),this.screenTexture.bind(Q.LINEAR,Q.CLAMP_TO_EDGE);const de=[O.color.r,O.color.g,O.color.b,O.color.a],we=(ve,De)=>{const Pe=lN(this._movement.getPosition(),ve),Ve=O.dropletSizeX,Xe=O.dropletSizeX*O.dropletSizeYScale,We=d.width/2,bt=d.height/2,ut=jd(0,O.screenThinning.start,0,1,O.screenThinning.intensity),xt=jd(.001,O.screenThinning.range,0,1,O.screenThinning.intensity),ct=jd(0,O.screenThinning.particleOffset,0,1,O.screenThinning.intensity),it=(St={modelview:V.modelviewMatrix,projection:V.projectionMatrix,time:this._accumulatedTimeFromStart,camPos:Pe,velocityConeAperture:O.velocityConeAperture,velocity:O.velocity,boxSize:ve,rainDropletSize:[Ve,Xe],distortionStrength:O.distortionStrength,rainDirection:D,color:de,screenSize:[ce.width,ce.height],thinningCenterPos:[We,bt],thinningShape:[ut,xt,Math.pow(10,O.screenThinning.fadePower)],thinningAffectedRatio:O.screenThinning.affectedRatio,thinningParticleOffset:ct,shapeDirectionalPower:O.shapeDirPower,shapeNormalPower:O.shapeNormalPower,mode:De?0:1},{u_modelview:Float32Array.from(St.modelview),u_projection:Float32Array.from(St.projection),u_time:St.time,u_cam_pos:St.camPos,u_texScreen:0,u_velocityConeAperture:St.velocityConeAperture,u_velocity:St.velocity,u_boxSize:St.boxSize,u_rainDropletSize:St.rainDropletSize,u_distortionStrength:St.distortionStrength,u_rainDirection:St.rainDirection,u_color:St.color,u_screenSize:St.screenSize,u_thinningCenterPos:St.thinningCenterPos,u_thinningShape:St.thinningShape,u_thinningAffectedRatio:St.thinningAffectedRatio,u_thinningParticleOffset:St.thinningParticleOffset,u_shapeDirectionalPower:St.shapeDirectionalPower,u_shapeNormalPower:St.shapeNormalPower,u_mode:St.mode});var St;const Dt=Math.round(O.intensity*this.particlesCount),Lt=i.bg.simpleSegment(0,0,4*Dt,2*Dt);oe.draw(d,Q.TRIANGLES,dn.disabled,$n.disabled,as.alphaBlended,zn.disabled,it,"rain_particles",this.particlesVx,this.particlesIdx,Lt)};O.distortionStrength>0&&we(O.boxSize,!0),we(O.boxSize,!1),this._vignette.draw(d,B)}}const p5=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 sx{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 jp("Precipitation > Snow"),this._vignetteParams={strength:.3,start:.78,range:.46,fadePower:.2,color:{r:1,g:1,b:1,a:1}},this.particlesCount=16e3}update(d){const m=d.context;if(!this.particlesVx){const w=vu(this.particlesCount),M=new i.eO,O=new i.b0;let D=0;const B=i.eq(1323123451230);for(let V=0;VD)return;const B=jd(0,1,O.revealStart,O.revealStart+O.revealRange,D);M.strength*=B,m.overrideStyleParameters||(m.intensity=d.style.snow.state.density,m.timeFactor=d.style.snow.state.intensity,m.color=structuredClone(d.style.snow.state.color),w=structuredClone(d.style.snow.state.direction),m.screenThinning.intensity=d.style.snow.state.centerThinning,m.billboardSize=2.79*d.style.snow.state.flakeSize,M.strength=1,M.color=structuredClone(d.style.snow.state.vignetteColor));const V=this.updateOnRender(d,m.timeFactor);if(!this.particlesVx||!this.particlesIdx)return;const Y=d.context,Q=Y.gl,ce=d.transform,oe=d.getOrCreateProgram("snowParticle");d.uploadCommonUniforms(Y,oe),((de,we,ve)=>{const De=lN(this._movement.getPosition(),de),Pe=ce.width/2,Ve=ce.height/2,Xe=jd(0,ve.screenThinning.start,0,1,ve.screenThinning.intensity),We=jd(.001,ve.screenThinning.range,0,1,ve.screenThinning.intensity),bt=jd(0,ve.screenThinning.particleOffset,0,1,ve.screenThinning.intensity),ut=(xt={modelview:V.modelviewMatrix,projection:V.projectionMatrix,time:this._accumulatedTimeFromStart,camPos:De,velocityConeAperture:ve.velocityConeAperture,velocity:ve.velocity,horizontalOscillationRadius:ve.horizontalOscillationRadius,horizontalOscillationRate:ve.horizontalOscillationRate,boxSize:de,billboardSize:1*ve.billboardSize,simpleShapeParameters:[ve.shapeFadeStart,ve.shapeFadePower],screenSize:[ce.width,ce.height],thinningCenterPos:[Pe,Ve],thinningShape:[Xe,We,Math.pow(10,ve.screenThinning.fadePower)],thinningAffectedRatio:ve.screenThinning.affectedRatio,thinningParticleOffset:bt,color:[ve.color.r,ve.color.g,ve.color.b,ve.color.a],direction:w},{u_modelview:Float32Array.from(xt.modelview),u_projection:Float32Array.from(xt.projection),u_time:xt.time,u_cam_pos:xt.camPos,u_velocityConeAperture:xt.velocityConeAperture,u_velocity:xt.velocity,u_horizontalOscillationRadius:xt.horizontalOscillationRadius,u_horizontalOscillationRate:xt.horizontalOscillationRate,u_boxSize:xt.boxSize,u_billboardSize:xt.billboardSize,u_simpleShapeParameters:xt.simpleShapeParameters,u_screenSize:xt.screenSize,u_thinningCenterPos:xt.thinningCenterPos,u_thinningShape:xt.thinningShape,u_thinningAffectedRatio:xt.thinningAffectedRatio,u_thinningParticleOffset:xt.thinningParticleOffset,u_particleColor:xt.color,u_direction:xt.direction});var xt;const ct=Math.round(ve.intensity*this.particlesCount),it=i.bg.simpleSegment(0,0,4*ct,2*ct);this.particlesVx&&this.particlesIdx&&oe.draw(d,Q.TRIANGLES,dn.disabled,$n.disabled,as.alphaBlended,zn.disabled,ut,"snow_particles",this.particlesVx,this.particlesIdx,it)})(m.boxSize,0,m),this._vignette.draw(d,M)}}const Um={symbol:function(_,d,m,w,M){if(_.renderPass!=="translucent")return;const O=$n.disabled,D=_.colorModeForRenderPass(),B=m.layout.get("text-variable-anchor"),V=m.layout.get("text-size-scale-range"),Y=i.aA(_.scaleFactor,V[0],V[1]);B&&function(oe,de,we,ve,De,Pe,Ve,Xe){const We=de.transform,bt=De==="map",ut=Pe==="map";for(const xt of oe){const ct=ve.getTile(xt),it=ct.getBucket(we);if(!it||!it.text||!it.text.segments.get().length)continue;const St=i.bK(it.textSizeData,We.zoom,Xe),Dt=Hn(xt,it.getProjection(),We),Lt=We.calculatePixelsToTileUnitsMatrix(ct),Ht=gl(Dt,ct.tileID.canonical,ut,bt,We,it.getProjection(),Lt),Wt=it.hasIconTextFit()&&it.hasIconData();St&&Tn(it,bt,ut,Ve,We,Ht,xt,Math.pow(2,We.zoom-ct.tileID.overscaledZ),St,Wt)}}(w,_,m,d,m.layout.get("text-rotation-alignment"),m.layout.get("text-pitch-alignment"),M,Y);const Q=m.paint.get("icon-opacity").constantOr(1)!==0,ce=m.paint.get("text-opacity").constantOr(1)!==0;m.layout.get("symbol-sort-key").constantOr(1)!==void 0&&(Q||ce)?Lv(_,d,m,w,O,D):(Q&&Lv(_,d,m,w,O,D,{onlyIcons:!0}),ce&&Lv(_,d,m,w,O,D,{onlyText:!0})),d.map.showCollisionBoxes&&(Yr(_,d,m,w,m.paint.get("text-translate"),m.paint.get("text-translate-anchor"),!0),Yr(_,d,m,w,m.paint.get("icon-translate"),m.paint.get("icon-translate-anchor"),!1))},circle:function(_,d,m,w){if(_.renderPass!=="translucent")return;const M=m.paint.get("circle-opacity"),O=m.paint.get("circle-stroke-width"),D=m.paint.get("circle-stroke-opacity"),B=m.layout.get("circle-sort-key").constantOr(1)!==void 0,V=m.paint.get("circle-emissive-strength");if(M.constantOr(1)===0&&(O.constantOr(1)===0||D.constantOr(1)===0))return;const Y=_.context,Q=Y.gl,ce=_.transform,oe=!(!_.terrain||!_.terrain.enabled),de=m.layout.get("circle-elevation-reference"),we=_.depthModeForSublayer(0,dn.ReadOnly),ve=new dn(_.context.gl.LEQUAL,dn.ReadOnly,_.depthRangeFor3D),De=de==="none"||oe?we:ve,Pe=$n.disabled,Ve=_.colorModeForDrapableLayerRenderPass(V),Xe=ce.projection.name==="globe",We=[i.aF(ce.center.lng),i.aJ(ce.center.lat)],bt=[];for(let xt=0;xtxt.sortKey-ct.sortKey);const ut={useDepthForOcclusion:ce.depthOcclusionForSymbolsAndCircles};for(const xt of bt){const{programConfiguration:ct,program:it,layoutVertexBuffer:St,dynamicBuffers:Dt,indexBuffer:Lt,uniformValues:Ht,tile:Wt}=xt.state,sr=xt.segments;_.terrain&&_.terrain.setupElevationDraw(Wt,it,ut),_.uploadCommonUniforms(Y,it,Wt.tileID.toUnwrapped()),it.draw(_,Q.TRIANGLES,De,Pe,Ve,zn.disabled,Ht,m.id,St,Lt,sr,m.paint,ce.zoom,ct,Dt)}},heatmap:function(_,d,m,w){if(m.paint.get("heatmap-opacity")!==0)if(_.renderPass==="offscreen"){const M=_.context,O=M.gl,D=$n.disabled,B=new as([O.ONE,O.ONE,O.ONE,O.ONE],i.ao.transparent,[!0,!0,!0,!0]);(function(de,we,ve,De){const Pe=de.gl,Ve=we.width*De,Xe=we.height*De;de.activeTexture.set(Pe.TEXTURE1),de.viewport.set([0,0,Ve,Xe]);let We=ve.heatmapFbo;if(!We||We&&(We.width!==Ve||We.height!==Xe)){We&&We.destroy();const bt=Pe.createTexture();Pe.bindTexture(Pe.TEXTURE_2D,bt),Pe.texParameteri(Pe.TEXTURE_2D,Pe.TEXTURE_WRAP_S,Pe.CLAMP_TO_EDGE),Pe.texParameteri(Pe.TEXTURE_2D,Pe.TEXTURE_WRAP_T,Pe.CLAMP_TO_EDGE),Pe.texParameteri(Pe.TEXTURE_2D,Pe.TEXTURE_MIN_FILTER,Pe.LINEAR),Pe.texParameteri(Pe.TEXTURE_2D,Pe.TEXTURE_MAG_FILTER,Pe.LINEAR),We=ve.heatmapFbo=de.createFramebuffer(Ve,Xe,1,null),function(ut,xt,ct,it,St,Dt){const Lt=ut.gl;Lt.texImage2D(Lt.TEXTURE_2D,0,ut.extRenderToTextureHalfFloat?Lt.RGBA16F:Lt.RGBA,St,Dt,0,Lt.RGBA,ut.extRenderToTextureHalfFloat?Lt.HALF_FLOAT:Lt.UNSIGNED_BYTE,null),it.colorAttachment0.set(ct)}(de,0,bt,We,Ve,Xe)}else Pe.bindTexture(Pe.TEXTURE_2D,We.colorAttachment0.get()),de.bindFramebuffer.set(We.framebuffer)})(M,_,m,_.transform.projection.name==="globe"?.5:.25),M.clear({color:i.ao.transparent});const V=_.transform,Y=V.projection.name==="globe",Q=Y?["PROJECTION_GLOBE_VIEW"]:[],ce=Y?zn.frontCCW:zn.disabled,oe=[i.aF(V.center.lng),i.aJ(V.center.lat)];for(let de=0;de({u_image:0,u_color_ramp:1,u_opacity:ce.paint.get("heatmap-opacity")}))(0,O),O.id,M.viewportBuffer,M.quadTriangleIndexBuffer,M.viewportSegments,O.paint,M.transform.zoom)}(_,m))},line:function(_,d,m,w){if(_.renderPass!=="translucent")return;const M=m.paint.get("line-opacity"),O=m.paint.get("line-width");if(M.constantOr(1)===0||O.constantOr(1)===0)return;const D=m.paint.get("line-emissive-strength").isConstant(),B=m.paint.get("line-emissive-strength").constantOr(0),V=m.paint.get("line-occlusion-opacity"),Y=m.layout.get("line-elevation-reference"),Q=m.layout.get("line-width-unit")==="meters",ce=Y==="sea",oe=!(!_.terrain||!_.terrain.enabled),de=_.context,we=de.gl;if(m.hasElevatedBuckets&&_.transform.projection.name==="globe")return;const ve=m.layout.get("line-cross-slope"),De=ve!==void 0,Pe=ve<1,Ve=_.colorModeForDrapableLayerRenderPass(D?B:null),Xe=_.terrain&&_.terrain.renderingToTexture,We=Xe?1:i.o.devicePixelRatio,bt=m.paint.get("line-dasharray"),ut=bt.constantOr(1),xt=m.layout.get("line-cap"),ct=bt.constantOr(null),it=xt.constantOr(null),St=m.paint.get("line-pattern"),Dt=St.constantOr(1),Lt=m.paint.get("line-pattern-cross-fade"),Ht=St.constantOr(null),Wt=m.paint.get("line-opacity").constantOr(1);let sr=!Dt&&Wt!==1||_.depthOcclusion&&V>0&&V<1;const _r=m.paint.get("line-gradient"),Bt=Dt?"linePattern":"line",Tt=i.e2(m);let Jt;if(Xe&&_.terrain&&_.terrain.clipOrMaskOverlapStencilType()&&(sr=!1),V!==0&&_.depthOcclusion){const Hr=m.paint._values["line-opacity"];Hr&&Hr.value&&Hr.value.kind==="constant"?Jt=Hr.value:i.w(`Occlusion opacity for layer ${m.id} is supported only when line-opacity isn't data-driven.`)}O.value.kind!=="constant"&&O.value.isLineProgressConstant===!1&&Tt.push("VARIABLE_LINE_WIDTH"),Xe&&(_.emissiveMode!=="dual-source-blending"||D?_.emissiveMode==="mrt-fallback"&&Tt.push("USE_MRT1"):Tt.push("DUAL_SOURCE_BLENDING"));const qt=(Hr,Nr,br,nn,Jr,zr)=>{for(const Gr of Hr){const kn=d.getTile(Gr);if(Dt&&!kn.patternsLoaded())continue;const Yn=kn.getBucket(m);if(!Yn||Yn.elevationType!=="none"&&!Jr||Yn.elevationType==="none"&&Jr)continue;_.prepareDrawTile();const Os=[...Nr],ha=_.shadowRenderer,on=Yn.elevationType==="road"&&!!ha&&ha.enabled;let ia=[0,0,0];if(on){const ls=_.style.directionalLight,ii=_.style.ambientLight;ls&&ii&&(ia=xp(_.style,ls,ii)),Os.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET")}const Wn=Yn.programConfigurations.get(m.id);let ya=!1;if(Ht&&kn.imageAtlas){const ls=i.e3.from(Ht),ii=ls.getPrimary().scaleSelf(We).toString(),eo=kn.imageAtlas.patternPositions.get(ii),Di=ls.getSecondary(),Ha=Di?kn.imageAtlas.patternPositions.get(Di.scaleSelf(We).toString()):null;ya=!!eo&&!!Ha,eo&&Wn.setConstantPatternPositions(eo,Ha)}Lt>0&&(ya||Wn.getPatternTransitionVertexBuffer("line-pattern"))&&Os.push("LINE_PATTERN_TRANSITION");const Ra=_.isTileAffectedByFog(Gr),Ca=_.getOrCreateProgram(Bt,{config:Wn,defines:Os,overrideFog:Ra});if(!Dt&&ct&&it&&kn.lineAtlas){const ls=kn.lineAtlas.getDash(ct,it);ls&&Wn.setConstantPatternPositions(ls)}on&&ha.setupShadows(kn.tileID.toUnwrapped(),Ca,"vector-tile");let[sa,is]=m.paint.get("line-trim-offset");(it==="round"||it==="square")&&sa!==is&&(sa===0&&(sa-=1),is===1&&(is+=1));const ga=Xe?Gr.projMatrix:null,$i=Q?1/Yn.tileToMeter/i.ay(kn,1,_.transform.zoom):1,gi=Q?1/Yn.tileToMeter/i.ay(kn,1,Math.floor(_.transform.zoom)):1,va=Dt?i.e4(_,kn,m,ga,We,$i,gi,[sa,is],ia,Lt):i.e5(_,kn,m,ga,Yn.lineClipsArray.length,We,$i,gi,[sa,is],ia);if(_r){const ls=Yn.gradients[m.id];let ii=ls.texture;if(m.gradientVersion!==ls.version){let eo=256;if(m.stepInterpolant){const Di=d.getSource().maxzoom,Ha=Gr.canonical.z===Di?Math.ceil(1<<_.transform.maxZoom-Gr.canonical.z):1;eo=i.aA(i.e6(Yn.maxLineLength/i.al*1024*Ha),256,de.maxTextureSize)}ls.gradient=i.e7({expression:m.gradientExpression(),evaluationKey:"lineProgress",resolution:eo,image:ls.gradient||void 0,clips:Yn.lineClipsArray}),ls.texture?ls.texture.update(ls.gradient):ls.texture=new i.T(de,ls.gradient,we.RGBA8),ls.version=m.gradientVersion,ii=ls.texture}de.activeTexture.set(we.TEXTURE1),ii.bind(m.stepInterpolant?we.NEAREST:we.LINEAR,we.CLAMP_TO_EDGE)}ut&&(de.activeTexture.set(we.TEXTURE0),kn.lineAtlasTexture&&kn.lineAtlasTexture.bind(we.LINEAR,we.REPEAT),Wn.updatePaintBuffers()),Dt&&(de.activeTexture.set(we.TEXTURE0),kn.imageAtlasTexture&&kn.imageAtlasTexture.bind(we.LINEAR,we.CLAMP_TO_EDGE),Wn.updatePaintBuffers()),Jr&&!ce&&_.terrain.setupElevationDraw(kn,Ca),_.uploadCommonUniforms(de,Ca,Gr.toUnwrapped());const Qs=ls=>{Jt!=null&&(Jt.value=Wt*V),Ca.draw(_,we.TRIANGLES,br,ls,Ve,zn.disabled,va,m.id,Yn.layoutVertexBuffer,Yn.indexBuffer,Yn.segments,m.paint,_.transform.zoom,Wn,[Yn.layoutVertexBuffer2,Yn.patternVertexBuffer,Yn.zOffsetVertexBuffer]),Jt!=null&&(Jt.value=Wt)};if(sr&&!Jr){const ls=_.stencilModeForClipping(Gr).ref;ls===0&&Xe&&de.clear({stencil:0});const ii={func:we.EQUAL,mask:255};va.u_alpha_discard_threshold=.8,Qs(new $n(ii,ls,255,we.KEEP,we.KEEP,we.INVERT)),va.u_alpha_discard_threshold=0,Qs(new $n(ii,ls,255,we.KEEP,we.KEEP,we.KEEP))}else va.u_alpha_discard_threshold=sr&&Jr&&zr?.8:0,Qs(Jr?nn:_.stencilModeForClipping(Gr))}};let dr=_.depthModeForSublayer(0,dn.ReadOnly);const Tr=new dn(_.depthOcclusion?we.GREATER:we.LEQUAL,dn.ReadOnly,_.depthRangeFor3D);if(m.hasNonElevatedBuckets){const Hr=!Xe&&_.terrain;V!==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}.`):qt(w,Tt,dr,$n.disabled,!1,!0)}if(m.hasElevatedBuckets){Y==="hd-road-markup"?oe||(dr=Tr,Tt.push("ELEVATED_ROADS")):(Tt.push("ELEVATED"),dr=Tr,De&&Tt.push(Pe?"CROSS_SLOPE_HORIZONTAL":"CROSS_SLOPE_VERTICAL"),ce&&Tt.push("ELEVATION_REFERENCE_SEA"));const Hr=sr?_.stencilModeFor3D():$n.disabled;_.forceTerrainMode=!0,qt(w,Tt,dr,Hr,!0,!0),sr&&qt(w,Tt,dr,Hr,!0,!1),_.forceTerrainMode=!1}sr&&(_.resetStencilClippingMasks(),Xe&&de.clear({stencil:0})),V===0||_.depthOcclusion||Xe||_.layersWithOcclusionOpacity.push(_.currentLayer)},fill:function(_,d,m,w){const M=m.paint.get("fill-color"),O=m.paint.get("fill-opacity");if(O.constantOr(1)===0)return;const D=m.paint.get("fill-emissive-strength"),B=_.colorModeForDrapableLayerRenderPass(D),V=m.paint.get("fill-pattern"),Y=_.opaquePassEnabledForLayer()&&!V.constantOr(1)&&M.constantOr(i.ao.transparent).a===1&&O.constantOr(0)===1?"opaque":"translucent";let Q="none";m.layout.get("fill-elevation-reference")!=="none"?Q="road":m.paint.get("fill-z-offset").constantOr(1)!==0&&(Q="offset");const ce=!(!_.terrain||!_.terrain.enabled),oe={painter:_,sourceCache:d,layer:m,coords:w,colorMode:B,elevationType:Q,terrainEnabled:ce,pass:Y};if(_.renderPass==="shadow")return void(_.shadowRenderer&&Q==="road"&&!ce&&function(we){const{painter:ve,sourceCache:De,layer:Pe,coords:Ve}=we,Xe=ve.context.gl,We=we.painter.shadowRenderer;for(const bt of Ve){const ut=De.getTile(bt),xt=ut.getBucket(Pe);if(!xt)continue;const ct=xt.elevatedStructures;if(!ct||!ct.shadowCasterSegments||ct.shadowCasterSegments.segments[0].primitiveLength===0)continue;ve.prepareDrawTile();const it=xt.bufferData.programConfigurations.get(Pe.id),St=ve.isTileAffectedByFog(bt),Dt=ve.getOrCreateProgram("elevatedStructuresDepth",{config:it,overrideFog:St}),Lt=We.calculateShadowPassMatrixFromTile(ut.tileID.toUnwrapped());ve.uploadCommonUniforms(ve.context,Dt,bt.toUnwrapped());const Ht={u_matrix:Lt,u_depth_bias:0};Dt.draw(ve,Xe.TRIANGLES,We.getShadowPassDepthMode(),$n.disabled,We.getShadowPassColorMode(),zn.disabled,Ht,Pe.id,ct.vertexBuffer,ct.indexBuffer,ct.shadowCasterSegments,Pe.paint,ve.transform.zoom,it)}}(oe));const de=_.emissiveMode==="mrt-fallback";if(Q!=="offset"){if(Xk(oe,!1,de),Q==="road"){const we=!ce&&_.renderPass==="translucent";we&&Yk(_,d,m,w,"geometry"),Xk(oe,!0,de,$n.disabled),we&&function(ve){const{painter:De,sourceCache:Pe,layer:Ve,coords:Xe,colorMode:We}=ve,bt=De.context.gl,ut=ve.painter.shadowRenderer,xt=!!ut&&ut.enabled,ct=new dn(De.context.gl.LEQUAL,dn.ReadOnly,De.depthRangeFor3D);let it=[0,0,0];if(xt){const Dt=De.style.directionalLight,Lt=De.style.ambientLight;Dt&&Lt&&(it=xp(De.style,Dt,Lt))}const St=Dt=>{for(const Lt of Xe){const Ht=Pe.getTile(Lt),Wt=Ht.getBucket(Ve);if(!Wt)continue;const sr=Wt.elevatedStructures;if(!sr)continue;let _r,Bt;if(Dt?(_r=sr.renderableBridgeSegments,Bt=sr.bridgeProgramConfigurations.get(Ve.id)):(_r=sr.renderableTunnelSegments,Bt=sr.tunnelProgramConfigurations.get(Ve.id)),!_r||_r.segments[0].primitiveLength===0)continue;Bt.updatePaintBuffers(),De.prepareDrawTile();const Tt=De.isTileAffectedByFog(Lt),Jt=[];xt&&Jt.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET");const qt=De.getOrCreateProgram("elevatedStructures",{config:Bt,overrideFog:Tt,defines:Jt}),dr=De.translatePosMatrix(Lt.projMatrix,Ht,Ve.paint.get("fill-translate"),Ve.paint.get("fill-translate-anchor"));xt&&ut.setupShadows(Ht.tileID.toUnwrapped(),qt,"vector-tile");const Tr=Rm(dr,it);De.uploadCommonUniforms(De.context,qt,Lt.toUnwrapped()),qt.draw(De,bt.TRIANGLES,ct,$n.disabled,We,zn.backCCW,Tr,Ve.id,sr.vertexBuffer,sr.indexBuffer,_r,Ve.paint,De.transform.zoom,Bt,[sr.vertexBufferNormal])}};St(!0),St(!1)}(oe)}}else Xk(oe,!1,de,_.stencilModeFor3D())},"fill-extrusion":function(_,d,m,w){const M=m.paint.get("fill-extrusion-opacity"),O=_.context,D=O.gl,B=_.terrain,V=B&&B.renderingToTexture;if(M===0)return;const Y=_.emissiveMode==="mrt-fallback",Q=_.conflationActive&&_.style.isLayerClipped(m,d.getSource()),ce=_.style.order.indexOf(m.fqid);if(Q&&function(oe,de,we,ve,De){for(const Pe of ve){const Ve=de.getTile(Pe).getBucket(we);Ve&&(Ve.updateReplacement(Pe,oe.replacementSource,De),Ve.uploadCentroid(oe.context))}}(_,d,m,w,ce),B||Q)for(const oe of w){const de=d.getTile(oe).getBucket(m);de&&aie(_.context,d,oe,de,m,B,Q)}if(_.renderPass==="shadow"&&_.shadowRenderer){const oe=_.shadowRenderer;if(B&&M<.65&&m._transitionablePaint._values["fill-extrusion-opacity"].value.expression instanceof i.ad)return;const de=oe.getShadowPassDepthMode(),we=oe.getShadowPassColorMode();Qk(_,d,m,w,de,$n.disabled,we,Q)}else if(_.renderPass==="translucent"){const oe=!m.paint.get("fill-extrusion-pattern").constantOr(1),de=m.paint.get("fill-extrusion-color").constantOr(i.ao.white);if(!V&&de.a!==0){const we=new dn(_.context.gl.LEQUAL,dn.ReadWrite,_.depthRangeFor3D);M===1&&oe?Qk(_,d,m,w,we,$n.disabled,as.unblended,Q):(Qk(_,d,m,w,we,$n.disabled,as.disabled,Q),Qk(_,d,m,w,we,_.stencilModeFor3D(),_.colorModeForRenderPass(),Q),_.resetStencilClippingMasks())}if(_.style.enable3dLights()&&oe&&(!B&&_.transform.projection.name!=="globe"||V)){const we=m.paint.get("fill-extrusion-opacity"),ve=m.paint.get("fill-extrusion-ambient-occlusion-intensity"),De=m.paint.get("fill-extrusion-ambient-occlusion-ground-radius"),Pe=m.paint.get("fill-extrusion-flood-light-intensity"),Ve=m.paint.get("fill-extrusion-flood-light-color-use-theme").constantOr("default")==="none",Xe=m.paint.get("fill-extrusion-flood-light-color").toNonPremultipliedRenderColor(Ve?null:m.lut).toArray01().slice(0,3),We=ve>0&&De>0,bt=Pe>0,ut=(it,St,Dt)=>(1-Dt)*it+Dt*St,xt=new l5;xt.translate=m.paint.get("fill-extrusion-translate"),xt.translateAnchor=m.paint.get("fill-extrusion-translate-anchor"),xt.edgeRadius=m.layout.get("fill-extrusion-edge-radius"),xt.cutoffFadeRange=m.paint.get("fill-extrusion-cutoff-fade-range");const ct=it=>{const St=_.depthModeForSublayer(1,dn.ReadOnly,D.LEQUAL,!0),Dt=m.paint.get(it?"fill-extrusion-ambient-occlusion-ground-attenuation":"fill-extrusion-flood-light-ground-attenuation"),Lt=ut(.1,3,Dt),Ht=_._showOverdrawInspector;if(!Ht){const Wt=new $n({func:D.ALWAYS,mask:255},255,255,D.KEEP,D.KEEP,D.REPLACE),sr=new as([D.ONE,D.ONE,D.ONE,D.ONE],i.ao.transparent,[!1,!1,!1,!0],D.MIN);_p(xt,_,d,m,w,St,Wt,sr,zn.disabled,it,"sdf",we,ve,De,Pe,Xe,Lt,Q,!1)}{const Wt=Ht?$n.disabled:new $n({func:D.EQUAL,mask:255},255,255,D.KEEP,D.DECR,D.DECR),sr=Ht?_.colorModeForRenderPass():new as([D.ONE_MINUS_DST_ALPHA,D.DST_ALPHA,D.ONE,D.ONE],i.ao.transparent,[!0,!0,!0,!0]);_p(xt,_,d,m,w,St,Wt,sr,zn.disabled,it,"color",we,ve,De,Pe,Xe,Lt,Q,!1)}};if(V){const it=()=>{const Dt=B.drapeBufferSize[0],Lt=B.drapeBufferSize[1];let Ht=B.framebufferCopyTexture;return Ht&&(!Ht||Ht.size[0]===Dt&&Ht.size[1]===Lt)||(Ht&&Ht.destroy(),Ht=B.framebufferCopyTexture=new i.T(O,new i.q({width:Dt,height:Lt}),D.RGBA8)),Ht.bind(D.LINEAR,D.CLAMP_TO_EDGE),D.copyTexSubImage2D(D.TEXTURE_2D,0,0,0,0,0,Dt,Lt),Ht},St=(Dt,Lt,Ht)=>{const Wt=_.depthModeForSublayer(1,dn.ReadOnly,D.LEQUAL,!1),sr=m.paint.get(Dt?"fill-extrusion-ambient-occlusion-ground-attenuation":"fill-extrusion-flood-light-ground-attenuation"),_r=ut(.1,3,sr);{const Bt=new as([D.ONE,D.ONE,D.ONE,D.ONE],i.ao.transparent,[!1,!1,!1,!0]);_p(xt,_,d,m,w,Wt,$n.disabled,Bt,zn.disabled,Dt,"clear",we,ve,De,Pe,Xe,_r,Q,Lt)}{const Bt=new $n({func:D.ALWAYS,mask:255},255,255,D.KEEP,D.KEEP,D.REPLACE),Tt=new as([D.ONE,D.ONE,D.ONE,D.ONE],i.ao.transparent,[!1,!1,!1,!0],D.MIN);_p(xt,_,d,m,w,Wt,Bt,Tt,zn.disabled,Dt,"sdf",we,ve,De,Pe,Xe,_r,Q,Lt)}Y&&!Dt&&(Ht=it());{const Bt=Dt?D.ZERO:D.ONE_MINUS_DST_ALPHA,Tt=new $n({func:D.EQUAL,mask:255},255,255,D.KEEP,D.DECR,D.DECR),Jt=new as([Bt,D.DST_ALPHA,D.ONE_MINUS_DST_ALPHA,D.ZERO],i.ao.transparent,[!0,!0,!0,!0]);_p(xt,_,d,m,w,Wt,Tt,Jt,zn.disabled,Dt,"color",we,ve,De,Pe,Xe,_r,Q,Lt)}if(!Y||Dt){const Bt=new as([D.ONE,D.ONE,D.ONE,Dt?D.ZERO:D.ONE],i.ao.transparent,[!1,!1,!1,!0],Dt?D.FUNC_ADD:D.MAX);_p(xt,_,d,m,w,Wt,$n.disabled,Bt,zn.disabled,Dt,"clear",we,ve,De,Pe,Xe,_r,Q,Lt,Ht)}else{D.drawBuffers([D.NONE,D.COLOR_ATTACHMENT1]);const Bt=new $n({func:D.EQUAL,mask:255},254,255,D.KEEP,D.DECR,D.DECR),Tt=new as([D.ONE,D.ONE,D.ONE,D.ONE],i.ao.transparent,[!0,!1,!1,!1],D.MAX);_p(xt,_,d,m,w,Wt,Bt,Tt,zn.disabled,Dt,"emissive",we,ve,De,Pe,Xe,_r,Q,Lt,Ht),D.drawBuffers([D.COLOR_ATTACHMENT0])}};if(We||bt){let Dt;_.prepareDrawTile(),Y&&!We||(Dt=it()),We&&St(!0,!1,Dt),bt&&St(!1,!0,Dt)}}else We&&ct(!0),bt&&ct(!1),(We||bt)&&_.resetStencilClippingMasks()}}},building:function(_,d,m,w){_.currentLayer<_.firstLightBeamLayer&&(_.firstLightBeamLayer=_.currentLayer);const M=m.paint.get("building-ambient-occlusion-ground-intensity"),O=m.paint.get("building-ambient-occlusion-ground-radius"),D=m.paint.get("building-ambient-occlusion-ground-attenuation"),B=m.paint.get("building-opacity");if(B<=0)return;let V=M>0&&O>0,Y=!0;const Q=m.paint.get("building-vertical-scale");if(Q<=0)return;_.shadowRenderer||(Y=!1);const ce=_.conflationActive&&_.style.isLayerClipped(m,d.getSource()),oe=_.style.order.indexOf(m.fqid);if(function(de,we,ve,De,Pe,Ve){for(const Xe of Ve){const We=we.getTile(Xe).getBucket(ve);We&&(Pe&&We.updateReplacement(Xe,de.replacementSource,De),We.uploadUpdatedIndexBuffer(de.context))}}(_,d,m,oe,ce,w),function(de,we,ve,De){for(const Pe of De){const Ve=we.getTile(Pe).getBucket(ve);Ve&&Ve.needsEvaluation()&&Ve.uploadUpdatedColorBuffer(de.context)}}(_,d,m,w),m.resetLayerRenderingStats(_),_.shadowRenderer&&(_.shadowRenderer.useNormalOffset=!0),_.renderPass==="shadow"&&_.shadowRenderer){const de=_.shadowRenderer,we=[],ve=de.getShadowPassDepthMode();Ov({painter:_,source:d,layer:m,coords:w,defines:we,blendMode:de.getShadowPassColorMode(),depthMode:ve,opacity:B,verticalScale:Q,facadeEmissiveChance:0,facadeAOIntensity:0,floodLightIntensity:0,floodLightColor:[0,0,0]})}else if(_.renderPass==="translucent"){let de=["HAS_ATTRIBUTE_a_part_color_emissive","LIGHTING_3D_MODE"];Y&&(de=de.concat("RENDER_SHADOWS","DEPTH_TEXTURE")),_.shadowRenderer&&_.shadowRenderer.useNormalOffset&&(de=de.concat("NORMAL_OFFSET"));const we=m.paint.get("building-facade-emissive-chance"),ve=m.paint.get("building-ambient-occlusion-intensity"),De=m.paint.get("building-flood-light-intensity"),Pe=m.paint.get("building-flood-light-color-use-theme").constantOr("default")==="none",Ve=m.paint.get("building-flood-light-color").toNonPremultipliedRenderColor(Pe?null:m.lut).toArray01().slice(0,3),Xe=m.paint.get("building-flood-light-ground-attenuation"),We=De>0,bt=new dn(_.context.gl.LEQUAL,dn.ReadWrite,_.depthRangeFor3D);B<1&&Ov({painter:_,source:d,layer:m,coords:w,defines:de,blendMode:as.disabled,depthMode:bt,opacity:B,verticalScale:Q,facadeEmissiveChance:we,facadeAOIntensity:ve,floodLightIntensity:De,floodLightColor:Ve,depthOnly:!0});const ut=_.colorModeForRenderPass();Ov({painter:_,source:d,layer:m,coords:w,defines:de,blendMode:ut,depthMode:bt,opacity:B,verticalScale:Q,facadeEmissiveChance:we,facadeAOIntensity:ve,floodLightIntensity:De,floodLightColor:Ve}),V&&Jk(_,d,m,w,!0,B,M,O,De,Ve,D,ce),We&&Jk(_,d,m,w,!1,B,M,O,De,Ve,Xe,ce)}else if(_.renderPass==="light-beam"){const de=["HAS_ATTRIBUTE_a_part_color_emissive","HAS_ATTRIBUTE_a_bloom_attenuation"],we=new dn(_.context.gl.LEQUAL,dn.ReadOnly,_.depthRangeFor3D);Ov({painter:_,source:d,layer:m,coords:w,defines:de,blendMode:as.alphaBlended,depthMode:we,opacity:B,verticalScale:Q,facadeEmissiveChance:0,facadeAOIntensity:0,floodLightIntensity:0,floodLightColor:[0,0,0]})}_.shadowRenderer&&(_.shadowRenderer.useNormalOffset=!1),_.resetStencilClippingMasks()},hillshade:function(_,d,m,w){if(_.renderPass!=="offscreen"&&_.renderPass!=="translucent"||_.style.disableElevatedTerrain)return;const M=_.context,O=_.terrain&&_.terrain.renderingToTexture,[D,B]=_.renderPass!=="translucent"||O?[{},w]:_.stencilConfigForOverlap(w);for(const V of B){const Y=d.getTile(V);if(Y.needsHillshadePrepare&&_.renderPass==="offscreen")Zae(_,Y,m);else if(_.renderPass==="translucent"){const Q=_.depthModeForSublayer(0,dn.ReadOnly),ce=m.paint.get("hillshade-emissive-strength"),oe=_.colorModeForDrapableLayerRenderPass(ce),de=O&&_.terrain?_.terrain.stencilModeForRTTOverlap(V):D[V.overscaledZ];Kae(_,V,Y,m,Q,de,oe)}}M.viewport.set([0,0,_.width,_.height]),_.resetStencilClippingMasks()},raster:function(_,d,m,w,M,O){if(_.renderPass!=="translucent"||m.paint.get("raster-opacity")===0)return;const D=_.transform.projection.name==="globe",B=m.paint.get("raster-elevation")!==0,V=B&&D;if(_.renderElevatedRasterBackface&&!V)return;const Y=_.context,Q=Y.gl,ce=d.getSource(),oe=function(ut,xt,ct,it,St){const Dt=xt.paint.get("raster-color"),Lt=ut.type==="raster-array",Ht=[],Wt=xt.paint.get("raster-resampling"),sr=xt.paint.get("raster-color-mix");let _r=xt.paint.get("raster-color-range");const Bt=[sr[0],sr[1],sr[2],0],Tt=sr[3];let Jt=Wt==="nearest"?it.NEAREST:it.LINEAR;if(Lt&&(Ht.push("RASTER_ARRAY"),Dt||Ht.push("RASTER_COLOR"),Wt==="linear"&&Ht.push("RASTER_ARRAY_LINEAR"),Jt=it.NEAREST,!_r&&ut.rasterLayers)){const qt=ut.rasterLayers.find(({id:dr})=>dr===xt.sourceLayer);qt&&qt.fields&&qt.fields.range&&(_r=qt.fields.range)}if(_r=_r||[0,1],Dt){Ht.push("RASTER_COLOR"),ct.activeTexture.set(it.TEXTURE2),xt.updateColorRamp(_r);let qt=xt.colorRampTexture;qt||(qt=xt.colorRampTexture=new i.T(ct,xt.colorRamp,it.RGBA8)),qt.bind(it.LINEAR,it.CLAMP_TO_EDGE)}return St&&Ht.push("USE_MRT1"),{mix:Bt,range:_r,offset:Tt,defines:Ht,resampling:Jt}}(ce,m,Y,Q,_.terrain&&_.terrain.renderingToTexture&&_.emissiveMode==="mrt-fallback");if(ce instanceof i.aU&&!w.length&&!D)return;const de=m.paint.get("raster-emissive-strength"),we=_.colorModeForDrapableLayerRenderPass(de),ve=_.terrain&&_.terrain.renderingToTexture,De=!_.options.moving,Pe=m.paint.get("raster-resampling")==="nearest"?Q.NEAREST:Q.LINEAR;if(ce instanceof i.aU&&!w.length&&(ce.onNorthPole||ce.onSouthPole)){const ut=B?_.stencilModeFor3D():$n.disabled;return void Dv(!!ce.onNorthPole,null,_,d,m,de,oe,zn.disabled,ut)}if(!w.length)return;const[Ve,Xe]=ce instanceof i.aU||ve?[{},w]:_.stencilConfigForOverlap(w),We=Xe[Xe.length-1].overscaledZ;V&&oe.defines.push("PROJECTION_GLOBE_VIEW"),B&&oe.defines.push("RENDER_CUTOFF");const bt=(ut,xt,ct)=>{for(const it of ut){const St=it.toUnwrapped(),Dt=d.getTile(it);if(ve&&(!Dt||!Dt.hasData()))continue;Y.activeTexture.set(Q.TEXTURE0);const Lt=wp(Dt,ce,m,oe);if(!Lt||!Lt.texture)continue;const{texture:Ht,mix:Wt,offset:sr,tileSize:_r,buffer:Bt}=Lt;let Tt,Jt;ve?(Tt=dn.disabled,Jt=it.projMatrix):B?(Tt=new dn(Q.LEQUAL,dn.ReadWrite,_.depthRangeFor3D),Jt=D?Float32Array.from(_.transform.expandedFarZProjMatrix):_.transform.calculateProjMatrix(St,De)):(Tt=_.depthModeForSublayer(it.overscaledZ-We,m.paint.get("raster-opacity")===1?dn.ReadWrite:dn.ReadOnly,Q.LESS),Jt=_.transform.calculateProjMatrix(St,De));const qt=_.terrain&&ve?_.terrain.stencilModeForRTTOverlap(it):Ve[it.overscaledZ],dr=O?0:m.paint.get("raster-fade-duration");Dt.registerFadeDuration(dr);const Tr=d.findLoadedParent(it,0),Hr=Av(Dt,Tr,d,_.transform,dr);let Nr,br;!Hr.isFading&&Dt.refreshedUponExpiration&&(Dt.refreshedUponExpiration=!1),_.terrain&&_.terrain.prepareDrawTile(),Y.activeTexture.set(Q.TEXTURE0),Ht.bind(Pe,Q.CLAMP_TO_EDGE),Y.activeTexture.set(Q.TEXTURE1),Tr?(Tr.texture&&Tr.texture.bind(Pe,Q.CLAMP_TO_EDGE),Nr=Math.pow(2,Tr.tileID.overscaledZ-Dt.tileID.overscaledZ),br=[Dt.tileID.canonical.x*Nr%1,Dt.tileID.canonical.y*Nr%1]):Ht.bind(Pe,Q.CLAMP_TO_EDGE),"useMipmap"in Ht&&Y.extTextureFilterAnisotropic&&_.transform.pitch>20&&Q.texParameterf(Q.TEXTURE_2D,Y.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,Y.extTextureFilterAnisotropicMax);const nn=_.transform;let Jr;const zr=B?kP(nn):[0,0,0,0];let Gr,kn,Yn,Os,ha,on=0;if(V&&ce instanceof i.aU&&ce.coordinates.length>3)Gr=Float32Array.from(i.bk(i.dJ(new i.cD(0,0,0)))),kn=Float32Array.from(nn.globeMatrix),Yn=Float32Array.from(i.dF(nn)),Os=[i.aF(nn.center.lng),i.aJ(nn.center.lat)],Jr=ce.elevatedGlobePerspectiveTransform,ha=ce.elevatedGlobeGridMatrix||new Float32Array(9);else if(V){const Ra=i.dG(it.canonical);on=i.dH(Ra.getCenter().lat),Gr=Float32Array.from(i.bk(i.dJ(it.canonical))),kn=Float32Array.from(nn.globeMatrix),Yn=Float32Array.from(i.dF(nn)),Os=[i.aF(nn.center.lng),i.aJ(nn.center.lat)],Jr=[0,0],ha=Float32Array.from(i.dI(it.canonical,Ra,on,nn.worldSize/nn._pixelsPerMercatorPixel))}else Jr=ce instanceof i.aU?ce.perspectiveTransform:[0,0],Gr=new Float32Array(16),kn=new Float32Array(9),Yn=new Float32Array(16),Os=[0,0],ha=new Float32Array(9);const ia=xP(Jt,Gr,kn,Yn,ha,br||[0,0],i.aj(_.transform.zoom),Os,zr,Nr||1,Hr,m,Jr,B?m.paint.get("raster-elevation"):0,2,Wt,sr,oe.range,_r,Bt,de),Wn=_.isTileAffectedByFog(it),ya=_.getOrCreateProgram("raster",{defines:oe.defines,overrideFog:Wn});if(_.uploadCommonUniforms(Y,ya,St),ce instanceof i.aU){const Ra=ce.elevatedGlobeVertexBuffer,Ca=ce.elevatedGlobeIndexBuffer;if(ve||!D)ce.boundsBuffer&&ce.boundsSegments&&ya.draw(_,Q.TRIANGLES,Tt,$n.disabled,we,zn.disabled,ia,m.id,ce.boundsBuffer,_.quadTriangleIndexBuffer,ce.boundsSegments);else if(Ra&&Ca){const sa=nn.zoom<=i.c_?ce.elevatedGlobeSegments:ce.getSegmentsForLongitude(nn.center.lng);sa&&ya.draw(_,Q.TRIANGLES,Tt,$n.disabled,we,xt,ia,m.id,Ra,Ca,sa)}}else if(V){Tt=new dn(Q.LEQUAL,dn.ReadOnly,_.depthRangeFor3D);const Ra=_.globeSharedBuffers;if(Ra){const[Ca,sa,is]=Ra.getGridBuffers(on,!1);ya.draw(_,Q.TRIANGLES,Tt,ct||qt,_.colorModeForRenderPass(),xt,ia,m.id,Ca,sa,is)}}else{const{tileBoundsBuffer:Ra,tileBoundsIndexBuffer:Ca,tileBoundsSegments:sa}=_.getTileBoundsBuffers(Dt);ya.draw(_,Q.TRIANGLES,Tt,qt,we,zn.disabled,ia,m.id,Ra,Ca,sa)}}if(!(ce instanceof i.aU)&&V)for(const it of ut){const St=it.canonical.y===(1<>>16,2654435769),((it=Math.imul(it^it>>>16,2654435769))>>>0)/4294967296},ct=1/1.1;for(let it=0;iti.e9[qt](Ht));Bt.push(Ht);const Tt=Ht.canonical.x,Jt=Ht.canonical.y;for(const qt of Bt){const dr=We.getTile(St?qt.wrapped():qt);if(!dr)continue;const Tr=dr.rasterParticleState;if(!Tr)continue;const Hr=qt.canonical.x+(1<xt.tileID)),de&&(Y.activeTexture.set(Q.TEXTURE0),_.imageManager.bind(_.context,m.scope));const ut=[];if(_.terrain&&_.terrain.renderingToTexture&&_.emissiveMode==="mrt-fallback"&&ut.push("USE_MRT1"),V){const xt=_.getOrCreateProgram(Xe,{overrideFog:!1,overrideRtt:!0,defines:ut}),ct=new Float32Array(i.bA([])),it=new i.aQ(0,0,0,0,0),St=de?zm(ct,B,D,_,0,m.scope,we,V,{tileID:it,tileSize:oe}):Iv(ct,B,D,M.toPremultipliedRenderColor(O?null:m.lut));xt.draw(_,Q.TRIANGLES,Pe,De,Ve,zn.disabled,St,m.id,_.viewportBuffer,_.quadTriangleIndexBuffer,_.viewportSegments)}else for(const xt of bt){const ct=_.isTileAffectedByFog(xt),it=_.getOrCreateProgram(Xe,{overrideFog:ct,defines:ut}),St=xt.toUnwrapped(),Dt=w?xt.projMatrix:_.transform.calculateProjMatrix(St);_.prepareDrawTile();const Lt=d?d.getTile(xt):We?We[xt.key]:new up(xt,oe,ce.zoom,_),Ht=de?zm(Dt,B,D,_,0,m.scope,we,V,{tileID:xt,tileSize:oe}):Iv(Dt,B,D,M.toPremultipliedRenderColor(O?null:m.lut));_.uploadCommonUniforms(Y,it,St);const{tileBoundsBuffer:Wt,tileBoundsIndexBuffer:sr,tileBoundsSegments:_r}=_.getTileBoundsBuffers(Lt);it.draw(_,Q.TRIANGLES,Pe,De,Ve,zn.disabled,Ht,m.id,Wt,sr,_r)}},sky:function(_,d,m){const w=_._atmosphere?i.aj(_.transform.zoom):1,M=m.paint.get("sky-opacity")*w;if(M===0)return;const O=_.context,D=m.paint.get("sky-type"),B=new dn(O.gl.LEQUAL,dn.ReadOnly,[0,1]),V=_.frameCounter/1e3%1;D==="atmosphere"?_.renderPass==="offscreen"?m.needsSkyboxCapture(_)&&(function(Y,Q,ce,oe){const de=Y.context,we=de.gl;let ve=Q.skyboxFbo;if(!ve){ve=Q.skyboxFbo=de.createFramebuffer(32,32,1,null),Q.skyboxGeometry=new nN(de),Q.skyboxTexture=de.gl.createTexture(),we.bindTexture(we.TEXTURE_CUBE_MAP,Q.skyboxTexture),we.texParameteri(we.TEXTURE_CUBE_MAP,we.TEXTURE_WRAP_S,we.CLAMP_TO_EDGE),we.texParameteri(we.TEXTURE_CUBE_MAP,we.TEXTURE_WRAP_T,we.CLAMP_TO_EDGE),we.texParameteri(we.TEXTURE_CUBE_MAP,we.TEXTURE_MIN_FILTER,we.LINEAR),we.texParameteri(we.TEXTURE_CUBE_MAP,we.TEXTURE_MAG_FILTER,we.LINEAR);for(let Xe=0;Xe<6;++Xe)we.texImage2D(we.TEXTURE_CUBE_MAP_POSITIVE_X+Xe,0,we.RGBA,32,32,0,we.RGBA,we.UNSIGNED_BYTE,null)}de.bindFramebuffer.set(ve.framebuffer),de.viewport.set([0,0,32,32]);const De=Q.getCenter(Y,!0),Pe=Y.getOrCreateProgram("skyboxCapture"),Ve=new Float64Array(16);i.bA(Ve),i.en(Ve,Ve,.5*-Math.PI),rx(Y,Q,Pe,Ve,De,0),i.bA(Ve),i.en(Ve,Ve,.5*Math.PI),rx(Y,Q,Pe,Ve,De,1),i.bA(Ve),i.cU(Ve,Ve,.5*-Math.PI),rx(Y,Q,Pe,Ve,De,2),i.bA(Ve),i.cU(Ve,Ve,.5*Math.PI),rx(Y,Q,Pe,Ve,De,3),i.bA(Ve),rx(Y,Q,Pe,Ve,De,4),i.bA(Ve),i.en(Ve,Ve,Math.PI),rx(Y,Q,Pe,Ve,De,5),de.viewport.set([0,0,Y.width,Y.height])}(_,m),m.markSkyboxValid(_)):_.renderPass==="sky"&&function(Y,Q,ce,oe,de){const we=Y.context,ve=we.gl,De=Y.transform,Pe=Y.getOrCreateProgram("skybox");we.activeTexture.set(ve.TEXTURE0),ve.bindTexture(ve.TEXTURE_CUBE_MAP,Q.skyboxTexture);const Ve=((Xe,We,bt,ut,xt)=>({u_matrix:Xe,u_sun_direction:We,u_cubemap:0,u_opacity:ut,u_temporal_offset:xt}))(De.skyboxMatrix,Q.getCenter(Y,!1),0,oe,de);Y.uploadCommonUniforms(we,Pe),Pe.draw(Y,ve.TRIANGLES,ce,$n.disabled,Y.colorModeForRenderPass(),zn.backCW,Ve,"skybox",Q.skyboxGeometry.vertexBuffer,Q.skyboxGeometry.indexBuffer,Q.skyboxGeometry.segment)}(_,m,B,M,V):D==="gradient"&&_.renderPass==="sky"&&function(Y,Q,ce,oe,de){const we=Y.context,ve=we.gl,De=Y.transform,Pe=Y.getOrCreateProgram("skyboxGradient");Q.skyboxGeometry||(Q.skyboxGeometry=new nN(we)),we.activeTexture.set(ve.TEXTURE0);let Ve=Q.colorRampTexture;Ve||(Ve=Q.colorRampTexture=new i.T(we,Q.colorRamp,ve.RGBA8)),Ve.bind(ve.LINEAR,ve.CLAMP_TO_EDGE);const Xe=((We,bt,ut,xt,ct)=>({u_matrix:We,u_color_ramp:0,u_center_direction:bt,u_radius:i.an(ut),u_opacity:xt,u_temporal_offset:ct}))(De.skyboxMatrix,Q.getCenter(Y,!1),Q.paint.get("sky-gradient-radius"),oe,de);Y.uploadCommonUniforms(we,Pe),Pe.draw(Y,ve.TRIANGLES,ce,$n.disabled,Y.colorModeForRenderPass(),zn.backCW,Xe,"skyboxGradient",Q.skyboxGeometry.vertexBuffer,Q.skyboxGeometry.indexBuffer,Q.skyboxGeometry.segment)}(_,m,B,M,V)},custom:function(_,d,m,w){const M=_.context,O=m.implementation;if(!_.transform.projection.unsupportedLayers||!_.transform.projection.unsupportedLayers.includes("custom")||_.terrain&&(_.terrain.renderingToTexture||_.renderPass==="offscreen")&&m.isDraped(d)){if(_.renderPass==="offscreen"){const D=O.prerender;if(D){if(_.setCustomLayerDefaults(),M.setColorMode(_.colorModeForRenderPass()),_.transform.projection.name==="globe"){const B=_.transform.pointMerc;D.call(O,M.gl,_.transform.customLayerMatrix(),_.transform.getProjection(),_.transform.globeToMercatorMatrix(),i.aj(_.transform.zoom),[B.x,B.y],_.transform.pixelsPerMeterRatio)}else D.call(O,M.gl,_.transform.customLayerMatrix());M.setDirty(),_.setBaseState()}}else if(_.renderPass==="translucent"){if(_.terrain&&_.terrain.renderingToTexture){const B=O.renderToTile;if(B){const V=w[0].canonical,Y={x:V.x+w[0].wrap*(O.wrapTileId?0:1<{Y&&(Y.useNormalOffset=!0,Q||(Y.enabled=!0))},oe=d.getSource();if(_.renderPass==="light-beam"&&oe.type!=="batched-model")return;if(oe.type==="vector"||oe.type==="geojson")return function(We,bt,ut,xt,ct){const it=We.transform,St=it.projection.name==="globe",Dt=it.getFreeCameraOptions().position;if(!We.modelManager)return;const Lt=We.modelManager;ut.modelManager=Lt;const Ht=We.shadowRenderer;if(!ut._unevaluatedLayout._values.hasOwnProperty("model-id"))return;const Wt=ut._unevaluatedLayout._values["model-id"],sr=Object.assign({},ut.layout.get("model-id").parameters),_r=We.style.order.indexOf(ut.fqid),Bt=ut.paint.get("model-opacity").constantOr(1);for(const Tt of xt){const Jt=bt.getTile(Tt).getBucket(ut);if(!Jt||Jt.projection.name!==it.projection.name)continue;const qt=Jt.getModelUris();if(qt&&!Jt.modelsRequested&&(Lt.addModelsFromBucket(qt,ct),Jt.modelsRequested=!0),St)sr.zoom=Tt.overscaledZ;else{const zr=rd(Tt,it);sr.zoom=zr}const dr=Wt.possiblyEvaluate(sr);if(OP(We,Jt,Tt),jf.shadowUniformsInitialized=!1,jf.useSingleShadowCascade=!!Ht&&Ht.getMaxCascadeForTile(Tt.toUnwrapped())===0,We.renderPass==="shadow"&&Ht){if(We.currentShadowCascade===1&&Jt.isInsideFirstShadowMapFrustum)continue;const zr=it.calculatePosMatrix(Tt.toUnwrapped(),it.worldSize);if(jf.tileMatrix.set(zr),jf.shadowTileMatrix=Float32Array.from(Ht.calculateShadowPassMatrixFromMatrix(zr)),jf.aabb.min=[0,0,0],jf.aabb.max[0]=jf.aabb.max[1]=i.al,jf.aabb.max[2]=0,lie(Jt,jf,We,ut.scope))continue}const Tr=1<0&&We.style.isLayerClipped(ut,bt.getSource())&&Jt.updateReplacement(Tt,We.replacementSource,_r,ut.scope)&&(Jt.uploaded=!1,Jt.upload(We.context));let Nr=0;const br=new Array,nn=new Array,Jr=new Array;for(let zr in Jt.instancesPerModel){const Gr=Jt.instancesPerModel[zr];Gr.features.length>0&&!St&&(zr=dr.evaluate(Gr.features[0].feature,{}));const kn=Lt.getModel(zr,ct);if(kn||Lt.hasURLBeenRequested(zr)||Jt.modelUris.includes(zr)||(Jt.modelUris.push(zr),Jt.modelsRequested=!1),kn&&kn.uploaded)if(St){const Yn=i.c5([],[Dt.x,Dt.y,Dt.z],We.transform.worldSize);i.ew(Yn,Yn);for(let Os=0;Os0&&ia.elevationUpdate(zr.terrain,Os,on,kn.source),ia.needsReEvaluation(zr,ha,kn)&&ia.evaluate(kn))}})(We,bt,ut,xt),function(){let zr,Gr,kn;br?(zr=xt.length-1,Gr=-1,kn=-1):(zr=0,Gr=xt.length,kn=1);const Yn=new Float64Array(16),Os=i.cA(),ha=new i.P(0,0);for(let on=zr;on!==Gr;on+=kn){const ia=xt[on],Wn=bt.getTile(ia).getBucket(ut);if(!Wn||!Wn.uploaded)continue;let ya=!1;Dt&&(ya=Dt.getMaxCascadeForTile(ia.toUnwrapped())===0);const Ra=it.calculatePosMatrix(ia.toUnwrapped(),it.worldSize),Ca=Wn.modelTraits;!Tr&&br&&(i.bl(Yn,Ra),i.af(Os,Ht,Yn),ha.x=Os[0],ha.y=Os[1]);const sa=[];Wn.setFilter(ut.filter);for(const is of Wn.getNodesInfo()){if(is.hiddenByReplacement||!is.node.meshes)continue;const ga=is.node;let $i=0;We.terrain&&ga.elevation&&($i=ga.elevation*We.terrain.exaggeration());const gi=(()=>{const _c=is.aabb;return dr.min=[..._c.min],dr.max=[..._c.max],dr.min[2]+=$i,dr.max[2]+=$i,i.af(dr.min,dr.min,Ra),i.af(dr.max,dr.max,Ra),dr})(),va=is.evaluatedScale;if(va[0]<=1&&va[1]<=1&&va[2]<=1&&gi.intersects(Hr)===0)continue;if(!Tr&&br){const _c=.16666666666666666;is.cameraCollisionOpacity=Ht[0]>gi.min[0]&&Ht[0]gi.min[1]&&Ht[1]!br||is.opacity===1&&ga.opacity===1?is.depthga.depth?-1:1);for(const is of sa){const ga=is.nodeInfo,$i=ga.node;let gi=i.aB([],Bt,is.tileModelMatrix);i.aB(gi,sr,gi);const va=i.bl([],gi);i.eg(va,va),i.cS(va,va,Fv),gi=i.aB(gi,gi,$i.globalMatrix);const Qs=We.renderPass==="light-beam",ls=ut.paint.get("model-color-use-theme").constantOr("default")==="none",ii=Ca&i.eI.HasMapboxMeshFeatures,eo=ii?0:ga.evaluatedRMEA[0][2];for(let Di=0;Di<$i.meshes.length;++Di){const Ha=$i.meshes[Di],nd=Di===$i.lightMeshIndex;let nc=is.wvpForNode;if(nd){if(!Qs&&!We.terrain&&We.shadowRenderer){We.currentLayer=ar||Ri>=ar}}const Ul=Ha.material;let bu;Ul.occlusionTexture&&Ul.occlusionTexture.offsetScale&&(bu=Ul.occlusionTexture.offsetScale,Vo.defines.push("OCCLUSION_TEXTURE_TRANSFORM"));const nh=We.getOrCreateProgram("model",Vo);!Tr&&Dt&&Dt.setupShadowsFromMatrix(is.tileModelMatrix,nh,Dt.useNormalOffset),We.uploadCommonUniforms(ct,nh,null,bc);const Nd=Ul.pbrMetallicRoughness;Nd.metallicFactor=.9,Nd.roughnessFactor=.5;const Gi=Xg(new Float32Array(nc),new Float32Array(gi),new Float32Array(va),new Float32Array($i.globalMatrix),We,is.opacity,Nd.baseColorFactor,Ul.emissiveFactor,Nd.metallicFactor,Nd.roughnessFactor,Ul,eo,ut,[0,0,0],bu);!nd&&(ga.hasTranslucentParts||is.opacity<1)&&nh.draw(We,ct.gl.TRIANGLES,Jt,$n.disabled,as.disabled,zn.backCCW,Gi,ut.id,Ha.vertexBuffer,Ha.indexBuffer,Ha.segments,ut.paint,We.transform.zoom,void 0,_c),nh.draw(We,ct.gl.TRIANGLES,nd?qt:Jt,$n.disabled,nd||is.opacity<1||ga.hasTranslucentParts?as.alphaBlended:as.unblended,zn.backCCW,Gi,ut.id,Ha.vertexBuffer,Ha.indexBuffer,Ha.segments,ut.paint,We.transform.zoom,void 0,_c)}}}}()}(_,d,m,w),void ce();if(oe.type!=="model")return;const de=oe.getModels(),we=[],ve=_.transform.getFreeCameraOptions().position,De=i.c5([],[ve.x,ve.y,ve.z],_.transform.worldSize);i.ew(De,De);const Pe=[],Ve=[];let Xe=0;for(const We of de){const bt=d.getFeatureState("",We.id),ut={type:"Unknown",id:We.id,properties:We.featureProperties},xt=m.paint.get("model-rotation").evaluate(ut,bt),ct=m.paint.get("model-scale").evaluate(ut,bt),it=m.paint.get("model-translation").evaluate(ut,bt),St=m.paint.get("model-opacity").evaluate(ut,bt);IP(m,We.id,bt,We.featureProperties,We.nodeOverrideNames,We.nodeOverrides),PP(m,We.id,bt,We.featureProperties,We.materialOverrideNames,We.materialOverrides),We.nodeOverrides.size>0&&We.computeBoundsAndApplyParent(),We.computeModelMatrix(_,xt,ct,it,B,D,!1);const Dt=i.bA([]),Lt=i.ef(We.position.lat,_.transform.zoom),Ht=i.bq([],[1,1,1/Lt]);i.br(Dt,Dt,De),we.push({zScaleMatrix:Ht,negCameraPosMatrix:Dt});for(const Wt of We.nodes)nx(_,Wt,We.matrix,_.transform.expandedFarZProjMatrix,Xe,Pe,Ve,We.materialOverrides,St);Xe++}if(Pe.sort((We,bt)=>bt.depth-We.depth),_.renderPass!=="shadow")LP(_,m,Pe,Ve,we),ce();else{for(const We of Ve)Lh(We.mesh,We.nodeModelMatrix,_,m);for(const We of Pe)Lh(We.mesh,We.nodeModelMatrix,_,m);ce()}}},dN={line:function(_,d,m){if(_.hasElevatedBuckets=!1,_.hasNonElevatedBuckets=!1,_._unevaluatedLayout.getValue("line-elevation-reference")!==void 0||_._unevaluatedLayout.getValue("line-z-offset")!==void 0){if(d){const w=d.getVisibleCoordinates();for(const M of w){const O=d.getTile(M).getBucket(_);if(O&&(O.elevationType!=="none"?_.hasElevatedBuckets=!0:_.hasNonElevatedBuckets=!0,_.hasElevatedBuckets&&_.hasNonElevatedBuckets))break}}}else _.hasNonElevatedBuckets=!0},model:function(_,d,m){const w=d.getSource();if(!w.loaded())return;if(w.type==="vector"||w.type==="geojson")return void(m.modelManager&&m.modelManager.upload(m,Rv(m,_)));if(w.type==="batched-model"||w.type!=="model")return;const M=w.getModels();for(const O of M)O.upload(m.context)},raster:function(_,d,m){const w=d.getSource();if(!(w instanceof rc&&w.loaded()))return;const M=_.sourceLayer||w.rasterLayerIds&&w.rasterLayerIds[0];if(!M)return;const O=_.paint.get("raster-array-band")||w.getInitialBand(M);if(O==null)return;const D=d.getIds().map(B=>d.getTileByID(B));for(const B of D)B.updateNeeded(_.id,O)&&w.prepareTile(B,M,_.id,O)},"raster-particle":function(_,d,m){const w=d.getSource();if(!(w instanceof rc&&w.loaded()))return;const M=_.sourceLayer||w.rasterLayerIds&&w.rasterLayerIds[0];if(!M)return;const O=_.paint.get("raster-particle-array-band")||w.getInitialBand(M);if(O==null)return;const D=d.getIds().map(B=>d.getTileByID(B));for(const B of D)B.updateNeeded(_.id,O)&&w.prepareTile(B,M,_.id,O)}},_u={fill:Yk},uN={fill:function(_,d,m,w){if(!m.layout||m.layout.get("fill-elevation-reference")==="none"||m.paint.get("fill-opacity").constantOr(1)===0)return;const M=_.context.gl,O=new dn(M.LEQUAL,dn.ReadOnly,_.depthRangeFor3D),D=new $n({func:M.ALWAYS,mask:255},255,255,M.KEEP,M.KEEP,M.REPLACE),B=_.transform.getFreeCameraOptions().position,V=_.getOrCreateProgram("elevatedStructuresDepthReconstruct");for(const Y of w){const Q=d.getTile(Y),ce=Q.getBucket(m);if(!ce)continue;const oe=ce.elevatedStructures;if(!oe||oe.depthSegments.segments[0].primitiveLength===0)continue;const de=jP(Y.toUnwrapped(),B),we=_.translatePosMatrix(Y.projMatrix,Q,m.paint.get("fill-translate"),m.paint.get("fill-translate-anchor")),ve=Yg(we,de,0,1,0);V.draw(_,M.TRIANGLES,O,D,as.disabled,zn.disabled,ve,m.id,oe.vertexBuffer,oe.indexBuffer,oe.depthSegments,m.paint,_.transform.zoom)}}};class hN{constructor(d,m,w,M,O){this.context=new zy(d,m),this.transform=w,this._tileTextures={},this.frameCopies=[],this.loadTimeStamps=[],this._timeStamp=i.o.now(),this._averageFPS=0,this._fpsHistory=[],this._dt=0,this._debugParams={forceEnablePrecipitation:!1,showTerrainProxyTiles:!1,fpsWindow:30,continousRedraw:!1,enabledLayers:{}};const D=["fill","line","symbol","circle","heatmap","fill-extrusion","building","raster","raster-particle","hillshade","model","background","sky"];for(const V of D)this._debugParams.enabledLayers[V]=!0;for(const V of D);this.occlusionParams=new $y,this.setup(),this.numSublayers=Xc.maxUnderzooming+Xc.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 Cy(this),this._wireframeDebugCache=new $m,this.renderDefaultNorthPole=!0,this.renderDefaultSouthPole=!0,this.layersWithOcclusionOpacity=[];const B=new i.q({width:1,height:1},Uint8Array.of(0,0,0,0));this.emptyDepthTexture=new i.T(this.context,B,d.RGBA8),this._clippingActiveLastFrame=!1,this.scaleFactor=M,this.worldview=O,this._forceEmissiveMode=!1,this.emissiveMode="constant"}updateTerrain(d,m){const w=!!d&&!!d.terrain&&this.transform.projection.supportsTerrain;if(!(w||this._terrain&&this._terrain.enabled))return;this._terrain||(this._terrain=new J3(this,d));const M=this._terrain;this.transform.elevation=w?M:null,M.update(d,this.transform,m),this.transform.elevation&&!M.enabled&&(this.transform.elevation=null)}_updateFog(d){const m=d.fog;if(!m||this.transform.projection.name==="globe"||m.getOpacity(this.transform.pitch)<1||m.properties.get("horizon-blend")<.03)return void(this.transform.fogCullDistSq=null);const[w,M]=m.getFovAdjustedRange(this.transform._fov);if(w>M)return void(this.transform.fogCullDistSq=null);const O=w+.78*(M-w);this.transform.fogCullDistSq=O*O}get terrain(){return this.transform._terrainEnabled()&&this._terrain&&this._terrain.enabled||this._forceTerrainMode?this._terrain:null}get forceTerrainMode(){return this._forceTerrainMode}set forceTerrainMode(d){d&&!this._terrain&&(this._terrain=new J3(this,this.style)),this._forceTerrainMode=d}get shadowRenderer(){return this._shadowRenderer&&this._shadowRenderer.enabled?this._shadowRenderer:null}get wireframeDebugCache(){return this._wireframeDebugCache}resize(d,m){if(this.width=d*i.o.devicePixelRatio,this.height=m*i.o.devicePixelRatio,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const w of this.style.order)this.style._mergedLayers[w].resize()}setup(){const d=this.context,m=new i.bd;m.emplaceBack(0,0),m.emplaceBack(i.al,0),m.emplaceBack(0,i.al),m.emplaceBack(i.al,i.al),this.tileExtentBuffer=d.createVertexBuffer(m,i.bf.members),this.tileExtentSegments=i.bg.simpleSegment(0,0,4,2);const w=new i.bd;w.emplaceBack(0,0),w.emplaceBack(i.al,0),w.emplaceBack(0,i.al),w.emplaceBack(i.al,i.al),this.debugBuffer=d.createVertexBuffer(w,i.bf.members),this.debugSegments=i.bg.simpleSegment(0,0,4,5);const M=new i.bd;M.emplaceBack(-1,-1),M.emplaceBack(1,-1),M.emplaceBack(-1,1),M.emplaceBack(1,1),this.viewportBuffer=d.createVertexBuffer(M,i.bf.members),this.viewportSegments=i.bg.simpleSegment(0,0,4,2);const O=new i.b1;O.emplaceBack(0,0,0,0),O.emplaceBack(i.al,0,i.al,0),O.emplaceBack(0,i.al,0,i.al),O.emplaceBack(i.al,i.al,i.al,i.al),this.mercatorBoundsBuffer=d.createVertexBuffer(O,i.bi.members),this.mercatorBoundsSegments=i.bg.simpleSegment(0,0,4,2);const D=new i.b0;D.emplaceBack(0,1,2),D.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=d.createIndexBuffer(D);const B=new i.be;for(const Y of[0,1,3,2,0])B.emplaceBack(Y);this.debugIndexBuffer=d.createIndexBuffer(B),this.emptyTexture=new i.T(d,new i.q({width:1,height:1},Uint8Array.of(0,0,0,0)),d.gl.RGBA8),this.identityMat=i.bC();const V=this.context.gl;this.stencilClearMode=new $n({func:V.ALWAYS,mask:0},0,255,V.ZERO,V.ZERO,V.ZERO),this.loadTimeStamps.push(performance.now())}getMercatorTileBoundsBuffers(){return{tileBoundsBuffer:this.mercatorBoundsBuffer,tileBoundsIndexBuffer:this.quadTriangleIndexBuffer,tileBoundsSegments:this.mercatorBoundsSegments}}getTileBoundsBuffers(d){return d._makeTileBoundsBuffers(this.context,this.transform.projection),d._tileBoundsBuffer?{tileBoundsBuffer:d._tileBoundsBuffer,tileBoundsIndexBuffer:d._tileBoundsIndexBuffer,tileBoundsSegments:d._tileBoundsSegments}:this.getMercatorTileBoundsBuffers()}clearStencil(){const d=this.context.gl;this.nextStencilID=1,this.currentStencilSource=void 0,this._tileClippingMaskIDs={},this.getOrCreateProgram("clippingMask").draw(this,d.TRIANGLES,dn.disabled,this.stencilClearMode,as.disabled,zn.disabled,Tv(this.identityMat),"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}resetStencilClippingMasks(){this.terrain||(this.currentStencilSource=void 0,this._tileClippingMaskIDs={})}_renderTileClippingMasks(d,m,w){if(!m||this.currentStencilSource===m.id||!d.isTileClipped()||!w||w.length===0)return;if(this._tileClippingMaskIDs&&!this.terrain){let B=!1;for(const V of w)if(this._tileClippingMaskIDs[V.key]===void 0){B=!0;break}if(!B)return}this.currentStencilSource=m.id;const M=this.context,O=M.gl;this.nextStencilID+w.length>256&&this.clearStencil(),M.setColorMode(as.disabled),M.setDepthMode(dn.disabled);const D=this.getOrCreateProgram("clippingMask");this._tileClippingMaskIDs={};for(const B of w){const V=m.getTile(B),Y=this._tileClippingMaskIDs[B.key]=this.nextStencilID++,{tileBoundsBuffer:Q,tileBoundsIndexBuffer:ce,tileBoundsSegments:oe}=this.getTileBoundsBuffers(V);D.draw(this,O.TRIANGLES,dn.disabled,new $n({func:O.ALWAYS,mask:0},Y,255,O.KEEP,O.KEEP,O.REPLACE),as.disabled,zn.disabled,Tv(B.projMatrix),"$clipping",Q,ce,oe)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const d=this.nextStencilID++,m=this.context.gl;return new $n({func:m.NOTEQUAL,mask:255},d,255,m.KEEP,m.KEEP,m.REPLACE)}stencilModeForClipping(d){if(this.terrain)return this.terrain.stencilModeForRTTOverlap(d);const m=this.context.gl;return new $n({func:m.EQUAL,mask:255},this._tileClippingMaskIDs[d.key],0,m.KEEP,m.KEEP,m.REPLACE)}stencilConfigForOverlap(d){const m=this.context.gl,w=d.sort((D,B)=>B.overscaledZ-D.overscaledZ),M=w[w.length-1].overscaledZ,O=w[0].overscaledZ-M+1;if(O>1){this.currentStencilSource=void 0,this.nextStencilID+O>256&&this.clearStencil();const D={};for(let B=0;Bthis._debugParams.fpsWindow&&this._fpsHistory.splice(0,this._fpsHistory.length-this._debugParams.fpsWindow),this._averageFPS=Math.round(this._fpsHistory.reduce((d,m)=>d+m/this._fpsHistory.length,0))}render(d,m){const w=i.o.now();this._dt=w-this._timeStamp,this._timeStamp=w,this._wireframeDebugCache.update(this.frameCounter),this._debugParams.continousRedraw=d.map.repaint,this.style=d,this.options=m;const M=this.style._mergedLayers,O=!(!this.terrain||!this.terrain.enabled),D=()=>this.style._getOrder(O).filter(Bt=>{const Tt=M[Bt];return!(Tt.type in this._debugParams.enabledLayers)||this._debugParams.enabledLayers[Tt.type]});let B=D(),V=!1,Y=!1,Q=null,ce=0,oe=!1;for(const Bt of B){const Tt=M[Bt];Tt.visibility!=="none"&&(Tt.type==="circle"?V=!0:Tt.type==="building"?(Q=Tt,++ce):Tt.type==="symbol"&&(Tt.hasOcclusionOpacityProperties?Y=!0:V=!0))}this.updateEmissiveMode();let de=B.map(Bt=>M[Bt]);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 Bt in we){const Tt=we[Bt];Tt.used&&(Tt.prepare(this.context),Tt.getSource().usedInConflation&&++ce)}let ve=!1;for(const Bt of de)Bt.isHidden(this.transform.zoom)||(Bt.type==="clip"&&(ve=!0),this.prepareLayer(Bt));const De={},Pe={},Ve={},Xe={},We={};for(const Bt in we){const Tt=we[Bt];De[Bt]=Tt.getVisibleCoordinates(),Pe[Bt]=De[Bt].slice().reverse(),Ve[Bt]=Tt.getVisibleCoordinates(!0).reverse(),Xe[Bt]=Tt.getShadowCasterCoordinates(),We[Bt]=Tt.sortCoordinatesByDistance(De[Bt])}const bt=Bt=>{const Tt=this.style.getLayerSourceCache(Bt);return Tt&&Tt.used?Tt.getSource():null};if(ce||ve||this._clippingActiveLastFrame){const Bt=[],Tt=[];let Jt=0;for(const qt of de)this.isSourceForClippingOrConflation(qt,bt(qt))&&(Bt.push(qt),Tt.push(Jt)),Jt++;if(Bt&&(ve||Bt.length>1)||this._clippingActiveLastFrame){ve=!1;const qt=[];for(let dr=0;dr0){const qt=bt(Tt);qt&&(this.minCutoffZoom=Math.max(qt.minzoom,this.minCutoffZoom)),Tt.minzoom&&(this.minCutoffZoom=Math.max(Tt.minzoom,this.minCutoffZoom))}Tt.is3D(O)&&(this.opaquePassCutoff===1/0&&(this.opaquePassCutoff=Bt),this._lastOcclusionLayer=Bt)}const ut=this.style&&this.style.fog;ut?(this._fogVisible=ut.getOpacity(this.transform.pitch)!==0,this._fogVisible&&this.transform.projection.name!=="globe"&&(this._fogVisible=ut.isVisibleOnFrustum(this.transform.cameraFrustum))):this._fogVisible=!1,this._cachedTileFogOpacities={},this.terrain&&(this.terrain.updateTileBinding(Ve),this.opaquePassCutoff=0,B=D(),de=B.map(Bt=>M[Bt]));const xt=this._shadowRenderer;if(xt){xt.updateShadowParameters(this.transform,this.style.directionalLight);for(const Bt in we)for(const Tt of De[Bt]){let Jt={min:0,max:0};this.terrain&&(Jt=this.terrain.getMinMaxForTile(Tt)||Jt),xt.addShadowReceiver(Tt.toUnwrapped(),Jt.min,Jt.max)}}this.transform.projection.name!=="globe"||this.globeSharedBuffers||(this.globeSharedBuffers=new i.eR(this.context)),this.style.fog&&this.transform.projection.supportsFog?(this._atmosphere||(this._atmosphere=new EP(this)),this._atmosphere.update(this)):this._atmosphere&&(this._atmosphere.destroy(),this._atmosphere=void 0);const ct=this._debugParams.forceEnablePrecipitation||!(!this.style||!this.style.snow),it=this._debugParams.forceEnablePrecipitation||!(!this.style||!this.style.rain);if(ct&&!this._snow&&(this._snow=new m5(this)),!ct&&this._snow&&(this._snow.destroy(),delete this._snow),it&&!this._rain&&(this._rain=new cN(this)),!it&&this._rain&&(this._rain.destroy(),delete this._rain),this._snow&&this._snow.update(this),this._rain&&this._rain.update(this),Q){this.buildingTileBorderManager||(this.buildingTileBorderManager=new sN);const Bt=this.style.getLayerSourceCache(Q);this.buildingTileBorderManager.updateBorders(Bt,Q)}if(!rt.has(this.context.gl))return;this.renderPass="offscreen";for(const Bt of de){const Tt=d.getLayerSourceCache(Bt);if(!Bt.hasOffscreenPass()||Bt.isHidden(this.transform.zoom))continue;const Jt=Tt?Pe[Tt.id]:void 0;(Bt.type==="custom"||Bt.type==="raster"||Bt.type==="raster-particle"||Bt.isSky()||Jt&&Jt.length)&&this.renderLayer(this,Tt,Bt,Jt)}this.depthRangeFor3D=[0,1-(de.length+2)*this.numSublayers*this.depthEpsilon],this._shadowRenderer&&(this.renderPass="shadow",this._shadowRenderer.drawShadowPass(this.style,Xe)),this.context.bindFramebuffer.set(null),this.context.viewport.set([0,0,this.width,this.height]);const St=this.transform.projection.name==="globe"||this.transform.isHorizonVisible(),Dt=(()=>{if(m.showOverdrawInspector)return i.ao.black;const Bt=this.style.fog;if(Bt&&this.transform.projection.supportsFog){const Tt=this.style.getLut(Bt.scope);if(!St){const Jt=Bt.properties.get("color-use-theme")==="none",qt=Bt.properties.get("color").toNonPremultipliedRenderColor(Jt?null:Tt).toArray01();return new i.ao(...qt)}if(St){const Jt=Bt.properties.get("space-color-use-theme")==="none",qt=Bt.properties.get("space-color").toNonPremultipliedRenderColor(Jt?null:Tt).toArray01();return new i.ao(...qt)}}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 Bt=de[this.currentLayer],Tt=d.getLayerSourceCache(Bt);if(Bt.isSky())continue;const Jt=Tt?(Bt.is3D(O)?We:Pe)[Tt.id]:void 0;this._renderTileClippingMasks(Bt,Tt,Jt),this.renderLayer(this,Tt,Bt,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&&Bt.hasShadowPass()&&--Ht==0){{this.clearStencil(),this.resetStencilClippingMasks();const Jt=this.currentLayer;for(this.currentLayer=0;this.currentLayer=this._lastOcclusionLayer&&this.layersWithOcclusionOpacity.length>0){const Jt=this.currentLayer;this.depthOcclusion=!0;for(const qt of this.layersWithOcclusionOpacity){this.currentLayer=qt;const dr=de[this.currentLayer],Tr=d.getLayerSourceCache(dr),Hr=Tr?Pe[Tr.id]:void 0;this.terrain||this._renderTileClippingMasks(dr,Tr,Tr?De[Tr.id]:void 0),this.renderLayer(this,Tr,dr,Hr)}this.depthOcclusion=!1,this.currentLayer=Jt,this.renderPass="translucent",this.layersWithOcclusionOpacity=[]}++this.currentLayer}}if(this.terrain&&this.terrain.postRender(),this._snow&&this._snow.draw(this),this._rain&&this._rain.draw(this),this.options.showTileBoundaries||this.options.showQueryGeometry||this.options.showTileAABBs){let Bt=null;de.forEach(Tt=>{const Jt=d.getLayerSourceCache(Tt);Jt&&!Tt.isHidden(this.transform.zoom)&&Jt.getVisibleCoordinates().length&&(!Bt||Bt.getSource().maxzoom0?m.pop():null}terrainRenderModeElevated(){return this.style&&!!this.style.getTerrain()&&!!this.terrain&&!this.terrain.renderingToTexture||this.forceTerrainMode}linearFloatFilteringSupported(){return this.context.extTextureFloatLinear!=null}currentGlobalDefines(d,m,w){const M=w===void 0?this.terrain&&this.terrain.renderingToTexture:w,O=[];return this.style&&this.style.enable3dLights()&&(d==="globeRaster"||d==="terrainRaster"?(O.push("LIGHTING_3D_MODE"),O.push("LIGHTING_3D_ALPHA_EMISSIVENESS")):M||O.push("LIGHTING_3D_MODE")),this.renderPass==="shadow"&&(this._shadowMapDebug||O.push("DEPTH_TEXTURE")),this.terrainRenderModeElevated()&&(O.push("TERRAIN"),this.linearFloatFilteringSupported()&&O.push("TERRAIN_DEM_FLOAT_FORMAT")),this.transform.projection.name==="globe"&&O.push("GLOBE"),!this._fogVisible||M||m!==void 0&&!m||O.push("FOG","FOG_DITHERING"),M&&O.push("RENDER_TO_TEXTURE"),this._showOverdrawInspector&&O.push("OVERDRAW_INSPECTOR"),O}getOrCreateProgram(d,m){this.cache=this.cache||{};const w=m&&m.defines||[],M=m&&m.config,O=this.currentGlobalDefines(d,m&&m.overrideFog,m&&m.overrideRtt).concat(w),D=dP.cacheKey(B3[d],d,O,M);return this.cache[D]||(this.cache[D]=new dP(this.context,d,B3[d],M,Zk[d],O)),this.cache[D]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.frontFace.setDefault(),this.context.cullFaceSide.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){const d=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(d.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new i.T(this.context,this.debugOverlayCanvas,this.context.gl.RGBA8))}destroy(){this._terrain&&this._terrain.destroy(),this._atmosphere&&(this._atmosphere.destroy(),this._atmosphere=void 0),this.globeSharedBuffers&&this.globeSharedBuffers.destroy(),this.emptyTexture.destroy(),this.debugOverlayTexture&&this.debugOverlayTexture.destroy(),this._wireframeDebugCache.destroy(),this.depthFBO&&(this.depthFBO.destroy(),this.depthFBO=void 0,this.depthTexture=void 0),this.emptyDepthTexture&&this.emptyDepthTexture.destroy()}prepareDrawTile(){this.terrain&&this.terrain.prepareDrawTile()}uploadCommonLightUniforms(d,m){if(this.style.enable3dLights()){const w=this.style.directionalLight,M=this.style.ambientLight;if(w&&M){const O=((D,B,V)=>{const Y=D.properties.get("direction"),Q=D.properties.get("color-use-theme")==="none",ce=D.properties.get("color").toNonPremultipliedRenderColor(Q?null:V.getLut(D.scope)).toArray01(),oe=D.properties.get("intensity"),de=B.properties.get("color-use-theme")==="none",we=B.properties.get("color").toNonPremultipliedRenderColor(de?null:V.getLut(B.scope)).toArray01(),ve=B.properties.get("intensity"),De=[Y.x,Y.y,Y.z],Pe=i.dN(we,ve),Ve=i.dN(ce,oe);return{u_lighting_ambient_color:Pe,u_lighting_directional_dir:De,u_lighting_directional_color:Ve,u_ground_radiance:Dy(De,Ve,Pe)}})(w,M,this.style);m.setLightsUniformValues(d,O)}}}uploadCommonUniforms(d,m,w,M,O){if(this.uploadCommonLightUniforms(d,m),this.terrain&&this.terrain.renderingToTexture)return;const D=this.style.fog;if(D){const B=D.getOpacity(this.transform.pitch),V=((Y,Q,ce,oe,de,we,ve,De,Pe,Ve,Xe,We)=>{const bt=Y.transform,ut=Q.properties.get("color-use-theme")==="none",xt=Q.properties.get("color").toNonPremultipliedRenderColor(ut?null:Y.style.getLut(Q.scope)).toArray01();xt[3]=oe;const ct=Y.frameCounter/1e3%1,[it,St]=Q.properties.get("vertical-range");return{u_fog_matrix:ce?bt.calculateFogTileMatrix(ce):We||Y.identityMat,u_fog_range:Q.getFovAdjustedRange(bt._fov),u_fog_color:xt,u_fog_horizon_blend:Q.properties.get("horizon-blend"),u_fog_vertical_limit:[Math.min(it,St),St],u_fog_temporal_offset:ct,u_frustum_tl:de,u_frustum_tr:we,u_frustum_br:ve,u_frustum_bl:De,u_globe_pos:Pe,u_globe_radius:Ve,u_viewport:Xe,u_globe_transition:i.aj(bt.zoom),u_is_globe:+(bt.projection.name==="globe")}})(this,D,w,B,this.transform.frustumCorners.TL,this.transform.frustumCorners.TR,this.transform.frustumCorners.BR,this.transform.frustumCorners.BL,this.transform.globeCenterInViewSpace,this.transform.globeRadius,[this.transform.width*i.o.devicePixelRatio,this.transform.height*i.o.devicePixelRatio],M);m.setFogUniformValues(d,V)}O&&m.setCutoffUniformValues(d,O.uniformValues)}setTileLoadedFlag(d){this.tileLoaded=d}saveCanvasCopy(){const d=this.canvasCopy();d&&(this.frameCopies.push(d),this.tileLoaded=!1)}canvasCopy(){const d=this.context.gl,m=d.createTexture();return d.bindTexture(d.TEXTURE_2D,m),d.copyTexImage2D(d.TEXTURE_2D,0,d.RGBA,0,0,d.drawingBufferWidth,d.drawingBufferHeight,0),m}getCanvasCopiesAndTimestamps(){return{canvasCopies:this.frameCopies,timeStamps:this.loadTimeStamps}}averageElevationNeedsEasing(){if(!this.transform._elevation)return!1;const d=this.style&&this.style.fog;return!!d&&d.getOpacity(this.transform.pitch)!==0}getBackgroundTiles(){const d=this._backgroundTiles,m=this._backgroundTiles={},w=this.transform.coveringTiles({tileSize:512});for(const M of w)m[M.key]=d[M.key]||new up(M,512,this.transform.tileZoom,this,void 0,this.worldview);return m}clearBackgroundTiles(){this._backgroundTiles={}}isSourceForClippingOrConflation(d,m){return!(!d.is3D(!(!this.terrain||!this.terrain.enabled))||d.type!=="clip"&&d.type!=="building"&&(d.minzoom&&d.minzoom>this.transform.zoom||(this.style._clipLayerPresent||d.sourceLayer!=="building"&&d.sourceLayer!=="procedural_buildings")&&(!m||m.type!=="batched-model")))}isTileAffectedByFog(d){if(!this.style||!this.style.fog)return!1;if(this.transform.projection.name==="globe")return!0;let m=this._cachedTileFogOpacities[d.key];return m||(this._cachedTileFogOpacities[d.key]=m=this.style.fog.getOpacityForTile(d)),m[0]>=ar||m[1]>=ar}setupDepthForOcclusion(d,m,w){const M=this.context,O=M.gl,D=!!w;var B;w||(w={u_dem:2,u_dem_prev:4,u_dem_tl:[0,0],u_dem_tl_prev:[0,0],u_dem_scale:0,u_dem_scale_prev:0,u_dem_size:0,u_dem_lerp:1,u_depth:3,u_depth_size_inv:[0,0],u_depth_range_unpack:[0,1],u_occluder_half_size:16,u_occlusion_depth_offset:-1e-4,u_exaggeration:0}),M.activeTexture.set(O.TEXTURE3),d&&this.depthFBO&&this.depthTexture?(this.depthTexture.bind(O.NEAREST,O.CLAMP_TO_EDGE),w.u_depth_size_inv=[1/this.depthFBO.width,1/this.depthFBO.height],w.u_depth_range_unpack=[2/((B=this.depthRangeFor3D)[1]-B[0]),-1-2*B[0]/(B[1]-B[0])],w.u_occluder_half_size=.5*this.occlusionParams.occluderSize,w.u_occlusion_depth_offset=this.occlusionParams.depthOffset):this.emptyDepthTexture.bind(O.NEAREST,O.CLAMP_TO_EDGE),M.activeTexture.set(O.TEXTURE0),D||m.setTerrainUniformValues(M,w)}updateEmissiveMode(){if(this._forceEmissiveMode)return;const d=this.style.hasDataDrivenEmissiveStrength();this.emissiveMode=d?this.context.extBlendFuncExtended?"dual-source-blending":"mrt-fallback":"constant"}}function fN(_,d){let m=!1,w=null;const M=()=>{w=null,m&&(_(),w=setTimeout(M,d),m=!1)};return()=>(m=!0,w||M(),w)}class g5{constructor(d){this._hashName=d&&encodeURIComponent(d),i.aY(["_getCurrentHash","_onHashChange","_updateHash"],this),this._updateHash=fN(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=Uo(d);if(this._hashName){const w=this._hashName;let M=!1;const O=location.hash.slice(1).split("&").map(D=>{const B=D.split("=")[0];return B===w?(M=!0,`${B}=${m}`):D}).filter(D=>D);return M||O.push(`${w}=${m}`),`#${O.join("&")}`}return`#${m}`}_getCurrentHash(){const d=location.hash.replace("#","");if(this._hashName){let m;return d.split("&").map(w=>w.split("=")).forEach(w=>{w[0]===this._hashName&&(m=w)}),(m&&m[1]||"").split("/")}return d.split("/")}_onHashChange(){const d=this._map;if(!d)return!1;const m=this._getCurrentHash();if(m.length>=3&&!m.some(w=>isNaN(Number(w)))){const w=d.dragRotate.isEnabled()&&d.touchZoomRotate.isEnabled()?+(m[3]||0):d.getBearing();return d.jumpTo({center:[+m[2],+m[1]],zoom:+m[0],bearing:w,pitch:+(m[4]||0)}),!0}return!1}_updateHashUnthrottled(){history.replaceState(history.state,"",location.href.replace(/(#.+)?$/,this.getHashString()))}}function Uo(_,d){const m=_.getCenter(),w=Math.round(100*_.getZoom())/100,M=Math.ceil((w*Math.LN2+Math.log(512/360/.5))/Math.LN10),O=Math.pow(10,M),D=Math.round(m.lng*O)/O,B=Math.round(m.lat*O)/O,V=_.getBearing(),Y=_.getPitch();let Q=d?`/${D}/${B}/${w}`:`${w}/${B}/${D}`;return(V||Y)&&(Q+="/"+Math.round(10*V)/10),Y&&(Q+=`/${Math.round(Y)}`),Q}const qy={linearity:.3,easing:i.eT(0,0,.3,1)},x5=Object.assign({deceleration:2500,maxSpeed:1400},qy),y5=Object.assign({deceleration:20,maxSpeed:1400},qy),ax=Object.assign({deceleration:1e3,maxSpeed:360},qy),v5=Object.assign({deceleration:1e3,maxSpeed:90},qy);class _5{constructor(d){this._map=d,this.clear()}clear(){this._inertiaBuffer=[]}record(d){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:i.o.now(),settings:d})}_drainInertiaBuffer(){const d=this._inertiaBuffer,m=i.o.now();for(;d.length>0&&m-d[0].time>160;)d.shift()}_onMoveEnd(d){if(this._map._prefersReducedMotion()||(this._drainInertiaBuffer(),this._inertiaBuffer.length<2))return;const m={zoom:0,bearing:0,pitch:0,pan:new i.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:O}of this._inertiaBuffer)m.zoom+=O.zoomDelta||0,m.bearing+=O.bearingDelta||0,m.pitch+=O.pitchDelta||0,O.panDelta&&m.pan._add(O.panDelta),O.around&&(m.around=O.around),O.pinchAround&&(m.pinchAround=O.pinchAround);const w=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,M={};if(m.pan.mag()){const O=kf(m.pan.mag(),w,Object.assign({},x5,d||{}));M.offset=m.pan.mult(O.amount/m.pan.mag()),M.center=this._map.transform.center,Vy(M,O)}if(m.zoom){const O=kf(m.zoom,w,y5);M.zoom=this._map.transform.zoom+O.amount,Vy(M,O)}if(m.bearing){const O=kf(m.bearing,w,ax);M.bearing=this._map.transform.bearing+i.aA(O.amount,-179,179),Vy(M,O)}if(m.pitch){const O=kf(m.pitch,w,v5);M.pitch=this._map.transform.pitch+O.amount,Vy(M,O)}if(M.zoom||M.bearing){const O=m.pinchAround===void 0?m.around:m.pinchAround;M.around=O?this._map.unproject(O):this._map.getCenter()}return this.clear(),M.noMoveStart=!0,M}}function Vy(_,d){(!_.duration||_.durationm.unproject(V)),B=O.reduce((V,Y,Q,ce)=>V.add(Y.div(ce.length)),new i.P(0,0));super(d,{points:O,point:B,lngLats:D,lngLat:m.unproject(B),originalEvent:w}),this._defaultPrevented=!1}}class b5 extends i.z{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(d,m){super("wheel",{originalEvent:m}),this._defaultPrevented=!1}}class pN{constructor(d,m){this._map=d,this._clickTolerance=m.clickTolerance}reset(){this._mousedownPos=void 0}wheel(d){return this._firePreventable(new b5(this._map,d))}mousedown(d,m){return this._mousedownPos=m,this._firePreventable(new kd(d.type,this._map,d))}mouseup(d){this._map.fire(new kd(d.type,this._map,d))}preclick(d){const m=new MouseEvent("preclick",d);this._map.fire(new kd(m.type,this._map,m))}click(d,m){this._mousedownPos&&this._mousedownPos.dist(m)>=this._clickTolerance||(this.preclick(d),this._map.fire(new kd(d.type,this._map,d)))}dblclick(d){return this._firePreventable(new kd(d.type,this._map,d))}mouseover(d){this._map.fire(new kd(d.type,this._map,d))}mouseout(d){this._map.fire(new kd(d.type,this._map,d))}touchstart(d){return this._firePreventable(new qm(d.type,this._map,d))}touchmove(d){this._map.fire(new qm(d.type,this._map,d))}touchend(d){this._map.fire(new qm(d.type,this._map,d))}touchcancel(d){this._map.fire(new qm(d.type,this._map,d))}_firePreventable(d){if(this._map.fire(d),d.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class w5{constructor(d){this._map=d}reset(){this._delayContextMenu=!1,this._contextMenuEvent=void 0}mousemove(d){this._map.fire(new kd(d.type,this._map,d))}mousedown(){this._delayContextMenu=!0}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new kd("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(d){this._delayContextMenu?this._contextMenuEvent=d:this._map.fire(new kd(d.type,this._map,d)),this._map.listens("contextmenu")&&d.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class mN{constructor(d,m){this._map=d,this._el=d.getCanvasContainer(),this._container=d.getContainer(),this._clickTolerance=m.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(d,m){this.isEnabled()&&d.shiftKey&&d.button===0&&(z(),this._startPos=this._lastPos=m,this._active=!0)}mousemoveWindow(d,m){if(!this._active)return;const w=m,M=this._startPos,O=this._lastPos;if(!M||!O||O.equals(w)||!this._box&&w.dist(M){this._box&&(this._box.style.transform=`translate(${D}px,${V}px)`,this._box.style.width=B-D+"px",this._box.style.height=Y-V+"px")})}mouseupWindow(d,m){if(!this._active)return;const w=this._startPos,M=m;if(w&&d.button===0){if(this.reset(),H(),w.x!==M.x||w.y!==M.y)return this._map.fire(new i.z("boxzoomend",{originalEvent:d})),{cameraAnimation:O=>O.fitScreenCoordinates(w,M,this._map.getBearing(),{linear:!1})};this._fireEvent("boxzoomcancel",d)}}keydown(d){this._active&&d.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",d))}blur(){this.reset()}reset(){this._active=!1,this._container.classList.remove("mapboxgl-crosshair"),this._box&&(this._box.remove(),this._box=null),F(),delete this._startPos,delete this._lastPos}_fireEvent(d,m){return this._map.fire(new i.z(d,{originalEvent:m}))}}function gN(_,d){const m={};for(let w=0;w<_.length;w++)m[_[w].identifier]=d[w];return m}class FP{constructor(d){this.reset(),this.numTouches=d.numTouches}reset(){this.centroid=void 0,this.startTime=0,this.touches={},this.aborted=!1}touchstart(d,m,w){(this.centroid||w.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===0&&(this.startTime=d.timeStamp),w.length===this.numTouches&&(this.centroid=function(M){const O=new i.P(0,0);for(const D of M)O._add(D);return O.div(M.length)}(m),this.touches=gN(w,m)))}touchmove(d,m,w){if(this.aborted||!this.centroid)return;const M=gN(w,m);for(const O in this.touches){const D=M[O];(!D||D.dist(this.touches[O])>30)&&(this.aborted=!0)}}touchend(d,m,w){if((!this.centroid||d.timeStamp-this.startTime>500)&&(this.aborted=!0),w.length===0){const M=!this.aborted&&this.centroid;if(this.reset(),M)return M}}}class xN{constructor(d){this.singleTap=new FP(d),this.numTaps=d.numTaps,this.reset()}reset(){this.lastTime=1/0,this.lastTap=void 0,this.count=0,this.singleTap.reset()}touchstart(d,m,w){this.singleTap.touchstart(d,m,w)}touchmove(d,m,w){this.singleTap.touchmove(d,m,w)}touchend(d,m,w){const M=this.singleTap.touchend(d,m,w);if(M){const O=d.timeStamp-this.lastTime<500,D=!this.lastTap||this.lastTap.dist(M)<30;if(O&&D||this.reset(),this.count++,this.lastTime=d.timeStamp,this.lastTap=M,this.count===this.numTaps)return this.reset(),M}}}class zP{constructor(){this._zoomIn=new xN({numTouches:1,numTaps:2}),this._zoomOut=new xN({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(d,m,w){this._zoomIn.touchstart(d,m,w),this._zoomOut.touchstart(d,m,w)}touchmove(d,m,w){this._zoomIn.touchmove(d,m,w),this._zoomOut.touchmove(d,m,w)}touchend(d,m,w){const M=this._zoomIn.touchend(d,m,w),O=this._zoomOut.touchend(d,m,w);return M?(this._active=!0,d.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:D=>D.easeTo({duration:300,zoom:D.getZoom()+1,around:D.unproject(M)},{originalEvent:d})}):O?(this._active=!0,d.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:D=>D.easeTo({duration:300,zoom:D.getZoom()-1,around:D.unproject(O)},{originalEvent:d})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}const BP={0:1,2:2},j5={Control:"ctrlKey",Alt:"altKey",Shift:"shiftKey",Meta:"metaKey"};class yN{constructor(d){this.reset(),this._clickTolerance=d.clickTolerance||1}blur(){this.reset()}reset(){this._active=!1,this._moved=!1,this._lastPoint=void 0,this._eventButton=void 0}_correctButton(d,m){return!1}_move(d,m){return{}}mousedown(d,m){if(this._lastPoint)return;const w=te(d);this._correctButton(d,w)&&(this._lastPoint=m,this._eventButton=w)}mousemoveWindow(d,m){const w=this._lastPoint;if(w){if(d.preventDefault(),this._eventButton!=null&&function(M,O){const D=BP[O];return M.buttons===void 0||(M.buttons&D)!==D}(d,this._eventButton))this.reset();else if(this._moved||!(m.dist(w)0&&(this._active=!0);const M=gN(w,m),O=new i.P(0,0),D=new i.P(0,0);let B=0;for(const Y in M){const Q=M[Y],ce=this._touches[Y];ce&&(O._add(Q),D._add(Q.sub(ce)),B++,M[Y]=Q)}if(this._touches=M,B{this._alertContainer.classList.remove("mapboxgl-touch-pan-blocker-show"),this._alertContainer.removeAttribute("role")},500)}}class vN{constructor(){this.reset()}reset(){this._active=!1,this._firstTwoTouches=void 0}_start(d){}_move(d,m,w){return{}}touchstart(d,m,w){this._firstTwoTouches||w.length<2||(this._firstTwoTouches=[w[0].identifier,w[1].identifier],this._start([m[0],m[1]]))}touchmove(d,m,w){const M=this._firstTwoTouches;if(!M)return;d.preventDefault();const[O,D]=M,B=zv(w,m,O),V=zv(w,m,D);if(!B||!V)return;const Y=this._aroundCenter?null:B.add(V).div(2);return this._move([B,V],Y,d)}touchend(d,m,w){if(!this._firstTwoTouches)return;const[M,O]=this._firstTwoTouches,D=zv(w,m,M),B=zv(w,m,O);D&&B||(this._active&&H(),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 zv(_,d,m){for(let w=0;w<_.length;w++)if(_[w].identifier===m)return d[w]}function qP(_,d){return Math.log2(_/d)}class cie extends vN{reset(){super.reset(),this._distance=0,this._startDistance=0}_start(d){this._startDistance=this._distance=d[0].dist(d[1])}_move(d,m){const w=this._distance;if(this._distance=d[0].dist(d[1]),this._active||!(Math.abs(qP(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:qP(this._distance,w),pinchAround:m}}}function VP(_,d){return 180*_.angleWith(d)/Math.PI}class Oi extends vN{reset(){super.reset(),this._minDiameter=0,this._startVector=void 0,this._vector=void 0}_start(d){this._startVector=this._vector=d[0].sub(d[1]),this._minDiameter=d[0].dist(d[1])}_move(d,m){const w=this._vector;if(this._vector=d[0].sub(d[1]),w&&(this._active||!this._isBelowThreshold(this._vector)))return this._active=!0,{bearingDelta:VP(this._vector,w),pinchAround:m}}_isBelowThreshold(d){this._minDiameter=Math.min(this._minDiameter,d.mag());const m=25/(Math.PI*this._minDiameter)*360,w=this._startVector;if(!w)return!1;const M=VP(d,w);return Math.abs(M)Math.abs(_.x)}class die extends vN{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,_N(d[0].sub(d[1]))&&(this._valid=!1)}_move(d,m,w){const M=this._lastPoints;if(!M)return;const O=d[0].sub(M[0]),D=d[1].sub(M[1]);return this._map._cooperativeGestures&&!i.eU()&&w.touches.length<3||(this._valid=this.gestureBeginsVertically(O,D,w.timeStamp),!this._valid)?void 0:(this._lastPoints=d,this._active=!0,{pitchDelta:(O.y+D.y)/2*-.5})}gestureBeginsVertically(d,m,w){if(this._valid!==void 0)return this._valid;const M=d.mag()>=2,O=m.mag()>=2;if(!M&&!O)return;if(!M||!O)return this._firstMove==null&&(this._firstMove=w),w-this._firstMove<100&&void 0;const D=d.y>0==m.y>0;return _N(d)&&_N(m)&&D}}const uie={panStep:100,bearingStep:15,pitchStep:10};class hie{constructor(){const d=uie;this._panStep=d.panStep,this._bearingStep=d.bearingStep,this._pitchStep=d.pitchStep,this._rotationDisabled=!1}blur(){this.reset()}reset(){this._active=!1}keydown(d){if(d.altKey||d.ctrlKey||d.metaKey)return;let m=0,w=0,M=0,O=0,D=0;switch(d.keyCode){case 61:case 107:case 171:case 187:m=1;break;case 189:case 109:case 173:m=-1;break;case 37:d.shiftKey?w=-1:(d.preventDefault(),O=-1);break;case 39:d.shiftKey?w=1:(d.preventDefault(),O=1);break;case 38:d.shiftKey?M=1:(d.preventDefault(),D=-1);break;case 40:d.shiftKey?M=-1:(d.preventDefault(),D=1);break;default:return}return this._rotationDisabled&&(w=0,M=0),{cameraAnimation:B=>{const V=B.getZoom();B.easeTo({duration:300,easeId:"keyboardHandler",easing:Bv,zoom:m?Math.round(V)+m*(d.shiftKey?2:1):V,bearing:B.getBearing()+w*this._bearingStep,pitch:B.getPitch()+M*this._pitchStep,offset:[-O*this._panStep,-D*this._panStep],center:B.getCenter()},{originalEvent:d})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}}function Bv(_){return _*(2-_)}const S5=4.000244140625,C5=1/450;class bN{constructor(d,m){this._map=d,this._el=d.getCanvasContainer(),this._handler=m,this._delta=0,this._lastDelta=0,this._defaultZoomRate=.01,this._wheelZoomRate=C5,i.aY(["_onTimeout","_addScrollZoomBlocker","_showBlockerAlert"],this)}setZoomRate(d){this._defaultZoomRate=d}setWheelZoomRate(d){this._wheelZoomRate=d}isEnabled(){return!!this._enabled}isActive(){return this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(d){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!d&&d.around==="center",this._map._cooperativeGestures&&this._addScrollZoomBlocker())}disable(){this.isEnabled()&&(this._enabled=!1,this._map._cooperativeGestures&&(clearTimeout(this._alertTimer),this._alertContainer.remove()))}wheel(d){if(!this.isEnabled())return;if(this._map._cooperativeGestures){if(!(d.ctrlKey||d.metaKey||this.isZooming()||i.eU()))return void this._showBlockerAlert();this._alertContainer.style.visibility!=="hidden"&&(this._alertContainer.style.visibility="hidden",clearTimeout(this._alertTimer))}let m=d.deltaMode===WheelEvent.DOM_DELTA_LINE?40*d.deltaY:d.deltaY;const w=i.o.now(),M=w-(this._lastWheelEventTime||0);this._lastWheelEventTime=w,m!==0&&m%S5==0?this._type="wheel":m!==0&&Math.abs(m)<4?this._type="trackpad":M>400?(this._type=null,this._lastValue=m,this._timeout=window.setTimeout(this._onTimeout,40,d)):this._type||(this._type=Math.abs(M*m)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,m+=this._lastValue)),d.shiftKey&&m&&(m/=4),this._type&&(this._lastWheelEvent=d,this._delta-=m,this._active||this._start(d)),d.preventDefault()}_onTimeout(d){this._type="wheel",this._delta-=this._lastValue,this._active||this._start(d)}_start(d){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const m=Z(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)>S5?this._wheelZoomRate:this._defaultZoomRate;let Q=2/(1+Math.exp(-Math.abs(this._delta*Y)));this._delta<0&&Q!==0&&(Q=1/Q);const ce=m(),oe=Math.pow(2,ce),de=typeof this._targetZoom=="number"?d.zoomScale(this._targetZoom):oe;this._targetZoom=Math.min(d.maxZoom,Math.max(d.minZoom,d.scaleZoom(de*Q))),this._type==="wheel"&&(this._startZoom=ce,this._easing=this._smoothOutEasing(200)),this._lastDelta=this._delta,this._delta=0}const w=typeof this._targetZoom=="number"?this._targetZoom:m(),M=this._startZoom,O=this._easing;let D,B=!1;if(this._type==="wheel"&&M&&O){const Y=Math.min((i.o.now()-this._lastWheelEventTime)/200,1),Q=O(Y);D=i.ak(M,w,Q),Y<1?this._frameId||(this._frameId=!0):B=!0}else D=w,B=!0;this._active=!0,B&&(this._active=!1,this._finishTimeout=window.setTimeout(()=>{this._zooming=!1,this._handler._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200));let V=D-m();return V*this._lastDelta<0&&(V=0),{noInertia:!0,needsRenderFrame:!B,zoomDelta:V,around:this._aroundPoint,aroundCoord:this._aroundCoord,originalEvent:this._lastWheelEvent}}_smoothOutEasing(d){let m=i.eV;if(this._prevEase){const w=this._prevEase,M=(i.o.now()-w.start)/w.duration,O=w.easing(M+.01)-w.easing(M),D=.27/Math.sqrt(O*O+1e-4)*.01,B=Math.sqrt(.0729-D*D);m=i.eT(D,B,.25,1)}return this._prevEase={start:i.o.now(),duration:d,easing:m},m}blur(){this.reset()}reset(){this._active=!1}_addScrollZoomBlocker(){this._map&&!this._alertContainer&&(this._alertContainer=N("div","mapboxgl-scroll-zoom-blocker",this._map._container),this._alertContainer.textContent=/(Mac|iPad)/i.test(navigator.userAgent)?this._map._getUIString("ScrollZoomBlocker.CmdMessage"):this._map._getUIString("ScrollZoomBlocker.CtrlMessage"),this._alertContainer.style.fontSize=`${Math.max(10,Math.min(24,Math.floor(.05*this._el.clientWidth)))}px`)}_showBlockerAlert(){this._alertContainer.style.visibility="visible",this._alertContainer.classList.add("mapboxgl-scroll-zoom-blocker-show"),this._alertContainer.setAttribute("role","alert"),clearTimeout(this._alertTimer),this._alertTimer=window.setTimeout(()=>{this._alertContainer.classList.remove("mapboxgl-scroll-zoom-blocker-show"),this._alertContainer.removeAttribute("role")},200)}}class kp{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 wN{constructor(){this.reset()}reset(){this._active=!1}blur(){this.reset()}dblclick(d,m){return d.preventDefault(),{cameraAnimation:w=>{w.easeTo({duration:300,zoom:w.getZoom()+(d.shiftKey?-1:1),around:w.unproject(m)},{originalEvent:d})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class qo{constructor(){this._tap=new xN({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,this._swipePoint=void 0,this._swipeTouch=0,this._tapTime=0,this._tap.reset()}touchstart(d,m,w){this._swipePoint||(this._tapTime&&d.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?w.length>0&&(this._swipePoint=m[0],this._swipeTouch=w[0].identifier):this._tap.touchstart(d,m,w))}touchmove(d,m,w){if(this._tapTime){if(this._swipePoint){if(w[0].identifier!==this._swipeTouch)return;const M=m[0],O=M.y-this._swipePoint.y;return this._swipePoint=M,d.preventDefault(),this._active=!0,{zoomDelta:O/128}}}else this._tap.touchmove(d,m,w)}touchend(d,m,w){this._tapTime?this._swipePoint&&w.length===0&&this.reset():this._tap.touchend(d,m,w)&&(this._tapTime=d.timeStamp)}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Nf{constructor(d,m,w){this._el=d,this._mousePan=m,this._touchPan=w}enable(d){this._inertiaOptions=d||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("mapboxgl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("mapboxgl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class $v{constructor(d,m,w){this._pitchWithRotate=d.pitchWithRotate,this._mouseRotate=m,this._mousePitch=w}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()}}class jN{constructor(d,m,w,M){this._el=d,this._touchZoom=m,this._touchRotate=w,this._tapDragZoom=M,this._rotationDisabled=!1,this._enabled=!0}enable(d){this._touchZoom.enable(d),this._rotationDisabled||this._touchRotate.enable(d),this._tapDragZoom.enable(),this._el.classList.add("mapboxgl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("mapboxgl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}const Uv=_=>_.zoom||_.drag||_.pitch||_.rotate;class fie extends i.z{}class qv{constructor(){this.constants=[1,1,.01],this.radius=0}setup(d,m){const w=i.av([],m,d);this.radius=i.ag(w[2]<0?i.eX([],w,this.constants):[w[0],w[1],0])}projectRay(d){i.eX(d,d,this.constants),i.aw(d,d),i.eY(d,d,this.constants);const m=i.c5([],d,this.radius);if(m[2]>0){const w=i.c5([],[0,0,1],i.bJ(m,[0,0,1])),M=i.c5([],i.aw([],[m[0],m[1],0]),this.radius),O=i.d8([],m,i.c5([],i.av([],i.d8([],M,w),m),2));m[0]=O[0],m[1]=O[1]}return m}}function kN(_){return _.panDelta&&_.panDelta.mag()||_.zoomDelta||_.bearingDelta||_.pitchDelta}class pie{constructor(d,m){this._map=d,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new _5(d),this._bearingSnap=m.bearingSnap,this._previousActiveHandlers={},this._trackingEllipsoid=new qv,this._dragOrigin=null,this._eventsInProgress={},this._addDefaultHandlers(m),i.aY(["handleEvent","handleWindowEvent"],this);const w=this._el;this._listeners=[[w,"touchstart",{passive:!0}],[w,"touchmove",{passive:!1}],[w,"touchend",void 0],[w,"touchcancel",void 0],[w,"mousedown",void 0],[w,"mousemove",void 0],[w,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[w,"mouseover",void 0],[w,"mouseout",void 0],[w,"dblclick",void 0],[w,"click",void 0],[w,"keydown",{capture:!1}],[w,"keyup",void 0],[w,"wheel",{passive:!1}],[w,"contextmenu",void 0],[window,"blur",void 0]];for(const[M,O,D]of this._listeners){const B=M===document?this.handleWindowEvent:this.handleEvent;M.addEventListener(O,B,D)}}destroy(){for(const[d,m,w]of this._listeners){const M=d===document?this.handleWindowEvent:this.handleEvent;d.removeEventListener(m,M,w)}}_addDefaultHandlers(d){const m=this._map,w=m.getCanvasContainer();this._add("mapEvent",new pN(m,d));const M=m.boxZoom=new mN(m,d);this._add("boxZoom",M);const O=new zP,D=new wN;m.doubleClickZoom=new kp(D,O),this._add("tapZoom",O),this._add("clickZoom",D);const B=new qo;this._add("tapDragZoom",B);const V=m.touchPitch=new die(m);this._add("touchPitch",V);const Y=new k5(d),Q=new N5(d);m.dragRotate=new $v(d,Y,Q),this._add("mouseRotate",Y,["mousePitch"]),this._add("mousePitch",Q,["mouseRotate"]);const ce=new $P(d),oe=new UP(m,d);m.dragPan=new Nf(w,ce,oe),this._add("mousePan",ce),this._add("touchPan",oe,["touchZoom","touchRotate"]);const de=new Oi,we=new cie;m.touchZoomRotate=new jN(w,we,de,B),this._add("touchRotate",de,["touchPan","touchZoom"]),this._add("touchZoom",we,["touchPan","touchRotate"]),this._add("blockableMapEvent",new w5(m));const ve=m.scrollZoom=new bN(m,this);this._add("scrollZoom",ve,["mousePan"]);const De=m.keyboard=new hie;this._add("keyboard",De);for(const Pe of["boxZoom","doubleClickZoom","tapDragZoom","touchPitch","dragRotate","dragPan","touchZoomRotate","scrollZoom","keyboard"])d.interactive&&d[Pe]&&m[Pe].enable(d[Pe])}_add(d,m,w){this._handlers.push({handlerName:d,handler:m,allowed:w}),this._handlersById[d]=m}stop(d){if(!this._updatingCamera){for(const{handler:m}of this._handlers)m.reset();this._inertia.clear(),this._fireEvents({},{},d),this._changes=[],this._originalZoom=void 0}}isActive(){for(const{handler:d}of this._handlers)if(d.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!Uv(this._eventsInProgress)||this.isZooming()}_isDragging(){return!!this._eventsInProgress.drag}_blockedByActive(d,m,w){for(const M in d)if(M!==w&&(!m||m.indexOf(M)<0))return!0;return!1}handleWindowEvent(d){this.handleEvent(d,`${d.type}Window`)}_getMapTouches(d){const m=[];for(const w of d)this._el.contains(w.target)&&m.push(w);return m}handleEvent(d,m){this._updatingCamera=!0;const w=d.type==="renderFrame",M=w?void 0:d,O={needsRenderFrame:!1},D={},B={},V=d.touches?this._getMapTouches(d.touches):void 0,Y=V?G(this._el,V):w?void 0:Z(this._el,d);for(const{handlerName:oe,handler:de,allowed:we}of this._handlers){if(!de.isEnabled())continue;let ve;this._blockedByActive(B,we,oe)?de.reset():de[m||d.type]&&(ve=de[m||d.type](d,Y,V),this.mergeHandlerResult(O,D,ve,oe,M),ve&&ve.needsRenderFrame&&this._triggerRenderFrame()),(ve||de.isActive())&&(B[oe]=de)}const Q={};for(const oe in this._previousActiveHandlers)B[oe]||(Q[oe]=M);this._previousActiveHandlers=B,(Object.keys(Q).length||kN(O))&&(this._changes.push([O,D,Q]),this._triggerRenderFrame()),(Object.keys(B).length||kN(O))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:ce}=O;ce&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],ce(this._map))}mergeHandlerResult(d,m,w,M,O){if(!w)return;Object.assign(d,w);const D={handlerName:M,originalEvent:w.originalEvent||O};w.zoomDelta!==void 0&&(m.zoom=D),w.panDelta!==void 0&&(m.drag=D),w.pitchDelta!==void 0&&(m.pitch=D),w.bearingDelta!==void 0&&(m.rotate=D)}_applyChanges(){const d={},m={},w={};for(const[M,O,D]of this._changes)M.panDelta&&(d.panDelta=(d.panDelta||new i.P(0,0))._add(M.panDelta)),M.zoomDelta&&(d.zoomDelta=(d.zoomDelta||0)+M.zoomDelta),M.bearingDelta&&(d.bearingDelta=(d.bearingDelta||0)+M.bearingDelta),M.pitchDelta&&(d.pitchDelta=(d.pitchDelta||0)+M.pitchDelta),M.around!==void 0&&(d.around=M.around),M.aroundCoord!==void 0&&(d.aroundCoord=M.aroundCoord),M.pinchAround!==void 0&&(d.pinchAround=M.pinchAround),M.noInertia&&(d.noInertia=M.noInertia),Object.assign(m,O),Object.assign(w,D);this._updateMapTransform(d,m,w),this._changes=[]}_updateMapTransform(d,m,w){const M=this._map,O=M.transform,D=Ve=>[Ve.x,Ve.y,Ve.z];if((Ve=>{const Xe=this._eventsInProgress.drag;return Xe&&!this._handlersById[Xe.handlerName].isActive()})()&&!kN(d)){const Ve=O.zoom;O.cameraElevationReference="sea",this._originalZoom!=null&&O._orthographicProjectionAtLowPitch&&O.projection.name!=="globe"&&O.pitch===0?(O.cameraElevationReference="ground",O.zoom=this._originalZoom):(O.recenterOnTerrain(),O.cameraElevationReference="ground"),Ve!==O.zoom&&this._map._update(!0)}if(O._isCameraConstrained&&M._stop(!0),!kN(d))return void this._fireEvents(m,w,!0);let{panDelta:B,zoomDelta:V,bearingDelta:Y,pitchDelta:Q,around:ce,aroundCoord:oe,pinchAround:de}=d;O._isCameraConstrained&&(V>0&&(V=0),O._isCameraConstrained=!1),de!==void 0&&(ce=de),(V||(Ve=>m[Ve]&&!this._eventsInProgress[Ve])("drag"))&&ce&&(this._dragOrigin=D(O.pointCoordinate3D(ce)),this._originalZoom=O.zoom,this._trackingEllipsoid.setup(O._camera.position,this._dragOrigin)),O.cameraElevationReference="sea",M._stop(!0),ce=ce||M.transform.centerPoint,Y&&(O.bearing+=Y),Q&&(O.pitch+=Q),O._updateCameraState();const we=[0,0,0];if(B)if(O.projection.name==="mercator"){const Ve=this._trackingEllipsoid.projectRay(O.screenPointToMercatorRay(ce).dir),Xe=this._trackingEllipsoid.projectRay(O.screenPointToMercatorRay(ce.sub(B)).dir);we[0]=Xe[0]-Ve[0],we[1]=Xe[1]-Ve[1]}else{const Ve=O.pointCoordinate(ce);if(O.projection.name==="globe"){B=B.rotate(-O.angle);const Xe=O._pixelsPerMercatorPixel/O.worldSize;we[0]=-B.x*i.eW(i.a$(Ve.y))*Xe,we[1]=-B.y*i.eW(O.center.lat)*Xe}else{const Xe=O.pointCoordinate(ce.sub(B));Ve&&Xe&&(we[0]=Xe.x-Ve.x,we[1]=Xe.y-Ve.y)}}const ve=O.zoom,De=[0,0,0];if(V){const Ve=D(oe||O.pointCoordinate3D(ce)),Xe={dir:i.aw([],i.av([],Ve,O._camera.position))};if(Xe.dir[2]<0){const We=O.zoomDeltaToMovement(Ve,V);i.c5(De,Xe.dir,We)}}const Pe=i.d8(we,we,De);O._translateCameraConstrained(Pe),V&&Math.abs(O.zoom-ve)>1e-4&&O.recenterOnTerrain(),O.cameraElevationReference="ground",this._map._update(),d.noInertia||this._inertia.record(d),this._fireEvents(m,w,!0)}_fireEvents(d,m,w){const M=Uv(this._eventsInProgress),O=Uv(d),D={};for(const Q in d){const{originalEvent:ce}=d[Q];this._eventsInProgress[Q]||(D[`${Q}start`]=ce),this._eventsInProgress[Q]=d[Q]}!M&&O&&this._fireEvent("movestart",O.originalEvent);for(const Q in D)this._fireEvent(Q,D[Q]);O&&this._fireEvent("move",O.originalEvent);for(const Q in d){const{originalEvent:ce}=d[Q];this._fireEvent(Q,ce)}const B={};let V;for(const Q in this._eventsInProgress){const{handlerName:ce,originalEvent:oe}=this._eventsInProgress[Q];this._handlersById[ce].isActive()||(delete this._eventsInProgress[Q],V=m[ce]||oe,B[`${Q}end`]=V)}for(const Q in B)this._fireEvent(Q,B[Q]);const Y=Uv(this._eventsInProgress);if(w&&(M||O)&&!Y){this._updatingCamera=!0;const Q=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),ce=oe=>oe!==0&&-this._bearingSnap{this._frameId=void 0,this.handleEvent(new fie("renderFrame",{timeStamp:d})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}const NN="map.setFreeCameraOptions(...) and map.getFreeCameraOptions() are not yet supported for non-mercator projections.";class M5 extends i.E{constructor(d,m){super(),this._moving=!1,this._zooming=!1,this.transform=d,this._bearingSnap=m.bearingSnap,this._respectPrefersReducedMotion=m.respectPrefersReducedMotion!==!1,i.aY(["_renderFrameCallback"],this)}getCenter(){return new i.aT(this.transform.center.lng,this.transform.center.lat)}setCenter(d,m){return this.jumpTo({center:d},m)}panBy(d,m,w){return d=i.P.convert(d).mult(-1),this.panTo(this.transform.center,Object.assign({offset:d},m),w)}panTo(d,m,w){return this.easeTo(Object.assign({center:d},m),w)}getZoom(){return this.transform.zoom}setZoom(d,m){return this.jumpTo({zoom:d},m),this}zoomTo(d,m,w){return this.easeTo(Object.assign({zoom:d},m),w)}zoomIn(d,m){return this.zoomTo(this.getZoom()+1,d,m),this}zoomOut(d,m){return this.zoomTo(this.getZoom()-1,d,m),this}getBearing(){return this.transform.bearing}setBearing(d,m){return this.jumpTo({bearing:d},m),this}getPadding(){return this.transform.padding}setPadding(d,m){return this.jumpTo({padding:d},m),this}rotateTo(d,m,w){return this.easeTo(Object.assign({bearing:d},m),w)}resetNorth(d,m){return this.rotateTo(0,Object.assign({duration:1e3},d),m),this}resetNorthPitch(d,m){return this.easeTo(Object.assign({bearing:0,pitch:0,duration:1e3},d),m),this}snapToNorth(d,m){return Math.abs(this.getBearing())d.aspect?w/(2*Math.tan(.5*d.fovX)*d.aspect):M/(2*Math.tan(.5*d.fovY)*d.aspect)}_cameraForBoundsOnGlobe(d,m,w,M,O,D){const B=d.clone(),V=this._extendCameraOptions(D);B.bearing=M,B.pitch=O;const Y=i.aT.convert(m),Q=i.aT.convert(w),ce=.5*(Y.lat+Q.lat),oe=.5*(Y.lng+Q.lng),de=i.eZ(ce,oe),we=i.aw([],de),ve=i.aw([],i.bI([],we,[0,1,0])),De=i.bI([],ve,we),Pe=[ve[0],ve[1],ve[2],0,De[0],De[1],De[2],0,we[0],we[1],we[2],0,0,0,0,1],Ve=[de,i.eZ(Y.lat,Y.lng),i.eZ(Q.lat,Y.lng),i.eZ(Q.lat,Q.lng),i.eZ(Y.lat,Q.lng),i.eZ(ce,Y.lng),i.eZ(ce,Q.lng),i.eZ(Y.lat,oe),i.eZ(Q.lat,oe)];let Xe=i.d9.fromPoints(Ve.map(qt=>[i.bJ(ve,qt),i.bJ(De,qt),i.bJ(we,qt)]));const We=i.af([],Xe.center,Pe);i.e_(We)===0&&i.e$(We,0,0,1),i.aw(We,We),i.c5(We,We,i.aD),B.center=i.f0(We);const bt=B.getWorldToCameraMatrix(),ut=i.bl(new Float64Array(16),bt);Xe=i.d9.applyTransform(Xe,i.aB([],bt,Pe));const xt=this._extendAABB(Xe,B,V,M);if(!xt)return void i.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");Xe=xt,i.af(We,We,bt);const ct=.5*(Xe.max[2]-Xe.min[2]),it=this._minimumAABBFrustumDistance(B,Xe),St=i.c5([],[0,0,1],ct),Dt=i.d8(St,We,St),Lt=it+(B.pitch===0?0:i.bG(We,Dt)),Ht=B.globeCenterInViewSpace,Wt=i.av([],We,[Ht[0],Ht[1],Ht[2]]);i.aw(Wt,Wt),i.c5(Wt,Wt,Lt);const sr=i.d8([],We,Wt);i.af(sr,sr,ut);const _r=i.eM/i.aD,Bt=i.ag(sr),Tt=i.cf(Math.max(Bt*_r-i.eM,Number.EPSILON),0),Jt=Math.min(B.zoomFromMercatorZAdjusted(Tt),V.maxZoom);return Jt>.5*(i.c_+i.cL)?(B.setProjection({name:"mercator"}),B.zoom=Jt,this._cameraForBounds(B,m,w,M,O,D)):{center:B.center,zoom:Jt,bearing:M,pitch:O}}_extendAABB(d,m,w,M){const O=.5*((w.padding.left||0)+(w.padding.right||0)),D=.5*((w.padding.top||0)+(w.padding.bottom||0)),B=D,V=O,Y=O,Q=D,ce=m.width-(V+Y),oe=m.height-(B+Q),de=i.av([],d.max,d.min),we=Math.min(ce/de[0],oe/de[1]),ve=Math.min(m.scaleZoom(m.scale*we),w.maxZoom);if(isNaN(ve))return null;const De=m.scale/m.zoomScale(ve),Pe=new i.d9([d.min[0]-V*De,d.min[1]-Q*De,d.min[2]],[d.max[0]+Y*De,d.max[1]+B*De,d.max[2]]),Ve=(typeof w.offset.x=="number"&&typeof w.offset.y=="number"?new i.P(w.offset.x,w.offset.y):i.P.convert(w.offset)).rotate(-i.an(M));return Pe.center[0]-=Ve.x*De,Pe.center[1]+=Ve.y*De,Pe}queryTerrainElevation(d,m){const w=this.transform.elevation;return w?(m=Object.assign({},{exaggerated:!0},m),w.getAtPoint(i.ae.fromLngLat(d),null,m.exaggerated)):null}_cameraForBounds(d,m,w,M,O,D){if(d.projection.name==="globe")return this._cameraForBoundsOnGlobe(d,m,w,M,O,D);const B=d.clone(),V=this._extendCameraOptions(D);B.bearing=M,B.pitch=O;const Y=i.aT.convert(m),Q=i.aT.convert(w),ce=new i.aT(Y.lng,Q.lat),oe=new i.aT(Q.lng,Y.lat),de=B.project(Y),we=B.project(Q),ve=this.queryTerrainElevation(Y),De=this.queryTerrainElevation(Q),Pe=this.queryTerrainElevation(ce),Ve=this.queryTerrainElevation(oe),Xe=[[de.x,de.y,Math.min(ve||0,De||0,Pe||0,Ve||0)],[we.x,we.y,Math.max(ve||0,De||0,Pe||0,Ve||0)]];let We=i.d9.fromPoints(Xe);const bt=B.getWorldToCameraMatrix(),ut=i.bl(new Float64Array(16),bt);We=i.d9.applyTransform(We,bt);const xt=this._extendAABB(We,B,V,M);if(!xt)return void i.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");We=xt;const ct=.5*i.av([],We.max,We.min)[2],it=this._minimumAABBFrustumDistance(B,We),St=[0,0,1,0];i.aC(St,St,bt),i.f1(St,St);const Dt=i.c5([],St,it+ct),Lt=i.d8([],We.center,Dt);i.af(We.center,We.center,ut),i.af(Lt,Lt,ut);const Ht=B.unproject(new i.P(We.center[0],We.center[1])),Wt=i.f2(B.projection,Ht),sr=Math.pow(2,Wt),_r=Math.min(B._zoomFromMercatorZ(Lt[2]*B.pixelsPerMeter*sr/B.worldSize),V.maxZoom);return B.mercatorFromTransition&&_r<.5*(i.c_+i.cL)?(B.setProjection({name:"globe"}),B.zoom=_r,this._cameraForBounds(B,m,w,M,O,D)):{center:Ht,zoom:_r,bearing:M,pitch:O}}fitBounds(d,m,w){const M=this.cameraForBounds(d,m);return this._fitInternal(M,m,w)}fitScreenCoordinates(d,m,w,M,O){const D=i.P.convert(d),B=i.P.convert(m),V=new i.P(Math.min(D.x,B.x),Math.min(D.y,B.y)),Y=new i.P(Math.max(D.x,B.x),Math.max(D.y,B.y));if(this.transform.projection.name==="mercator"&&this.transform.anyCornerOffEdge(D,B))return this;const Q=this.transform.pointLocation3D(V),ce=this.transform.pointLocation3D(Y),oe=this.transform.pointLocation3D(new i.P(V.x,Y.y)),de=this.transform.pointLocation3D(new i.P(Y.x,V.y)),we=[Math.min(Q.lng,ce.lng,oe.lng,de.lng),Math.min(Q.lat,ce.lat,oe.lat,de.lat)],ve=[Math.max(Q.lng,ce.lng,oe.lng,de.lng),Math.max(Q.lat,ce.lat,oe.lat,de.lat)],De=M&&M.pitch?M.pitch:this.getPitch(),Pe=this._cameraForBounds(this.transform,we,ve,w,De,M);return this._fitInternal(Pe,M,O)}_fitInternal(d,m,w){return d?(m=Object.assign(d,m)).linear?this.easeTo(m,w):this.flyTo(m,w):this}jumpTo(d,m){this.stop();const w=d.preloadOnly?this.transform.clone():this.transform;let M=!1,O=!1,D=!1;"zoom"in d&&w.zoom!==+d.zoom&&(M=!0,w.zoom=+d.zoom),d.center!==void 0&&(w.center=i.aT.convert(d.center)),"bearing"in d&&w.bearing!==+d.bearing&&(O=!0,w.bearing=+d.bearing),"pitch"in d&&w.pitch!==+d.pitch&&(D=!0,w.pitch=+d.pitch);const B=typeof d.padding=="number"?this._extendPadding(d.padding):d.padding;if(d.padding!=null&&!w.isPaddingEqual(B))if(d.retainPadding===!1){const V=w.clone();V.padding=B,w.setLocationAtPoint(w.center,V.centerPoint)}else w.padding=B;return d.preloadOnly?(this._preloadTiles(w),this):(this.fire(new i.z("movestart",m)).fire(new i.z("move",m)),M&&this.fire(new i.z("zoomstart",m)).fire(new i.z("zoom",m)).fire(new i.z("zoomend",m)),O&&this.fire(new i.z("rotatestart",m)).fire(new i.z("rotate",m)).fire(new i.z("rotateend",m)),D&&this.fire(new i.z("pitchstart",m)).fire(new i.z("pitch",m)).fire(new i.z("pitchend",m)),this.fire(new i.z("moveend",m)))}getFreeCameraOptions(){return this.transform.projection.supportsFreeCamera||i.w(NN),this.transform.getFreeCameraOptions()}setFreeCameraOptions(d,m){const w=this.transform;if(!w.projection.supportsFreeCamera)return i.w(NN),this;this.stop();const M=w.zoom,O=w.pitch,D=w.bearing;w.setFreeCameraOptions(d);const B=M!==w.zoom,V=O!==w.pitch,Y=D!==w.bearing;return this.fire(new i.z("movestart",m)).fire(new i.z("move",m)),B&&this.fire(new i.z("zoomstart",m)).fire(new i.z("zoom",m)).fire(new i.z("zoomend",m)),Y&&this.fire(new i.z("rotatestart",m)).fire(new i.z("rotate",m)).fire(new i.z("rotateend",m)),V&&this.fire(new i.z("pitchstart",m)).fire(new i.z("pitch",m)).fire(new i.z("pitchend",m)),this.fire(new i.z("moveend",m)),this}easeTo(d,m){this._stop(!1,d.easeId),((d=Object.assign({offset:[0,0],duration:500,easing:i.eV},d)).animate===!1||this._prefersReducedMotion(d))&&(d.duration=0);const w=this.transform,M=this.getZoom(),O=this.getBearing(),D=this.getPitch(),B=this.getPadding(),V="zoom"in d?+d.zoom:M,Y="bearing"in d?this._normalizeBearing(d.bearing,O):O,Q="pitch"in d?+d.pitch:D,ce=this._extendPadding(d.padding),oe=i.P.convert(d.offset);let de,we,ve;if(w.projection.name==="globe"){const St=i.ae.fromLngLat(w.center),Dt=oe.rotate(-w.angle);St.x+=Dt.x/w.worldSize,St.y+=Dt.y/w.worldSize;const Lt=St.toLngLat(),Ht=i.aT.convert(d.center||Lt);this._normalizeCenter(Ht),de=w.centerPoint.add(Dt),we=new i.P(St.x,St.y).mult(w.worldSize),ve=new i.P(i.aF(Ht.lng),i.aJ(Ht.lat)).mult(w.worldSize).sub(we)}else{de=w.centerPoint.add(oe);const St=w.pointLocation(de),Dt=i.aT.convert(d.center||St);this._normalizeCenter(Dt),we=w.project(St),ve=w.project(Dt).sub(we)}const De=w.zoomScale(V-M);let Pe,Ve;d.around&&(Pe=i.aT.convert(d.around),Ve=w.locationPoint(Pe));const Xe=this._zooming||V!==M,We=this._rotating||O!==Y,bt=this._pitching||Q!==D,ut=!w.isPaddingEqual(ce),xt=d.retainPadding===!1?w.clone():w,ct=St=>Dt=>{if(Xe&&(St.zoom=i.ak(M,V,Dt)),We&&(St.bearing=i.ak(O,Y,Dt)),bt&&(St.pitch=i.ak(D,Q,Dt)),ut&&(xt.interpolatePadding(B,ce,Dt),de=xt.centerPoint.add(oe)),Pe)St.setLocationAtPoint(Pe,Ve);else{const Lt=St.zoomScale(St.zoom-M),Ht=V>M?Math.min(2,De):Math.max(.5,De),Wt=Math.pow(Ht,1-Dt),sr=St.unproject(we.add(ve.mult(Dt*Wt)).mult(Lt));St.setLocationAtPoint(St.renderWorldCopies?sr.wrap():sr,de)}return d.preloadOnly||this._fireMoveEvents(m),St};if(d.preloadOnly){const St=this._emulate(ct,d.duration,w);return this._preloadTiles(St),this}const it={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=Xe,this._rotating=We,this._pitching=bt,this._padding=ut,this._easeId=d.easeId,this._prepareEase(m,d.noMoveStart,it),this._ease(ct(w),St=>{w.cameraElevationReference==="sea"&&w.recenterOnTerrain(),this._afterEase(m,St)},d),this}_prepareEase(d,m,w={}){this._moving=!0,this.transform.cameraElevationReference="sea",this.transform._orthographicProjectionAtLowPitch&&this.transform.pitch===0&&this.transform.projection.name!=="globe"&&(this.transform.cameraElevationReference="ground"),m||w.moving||this.fire(new i.z("movestart",d)),this._zooming&&!w.zooming&&this.fire(new i.z("zoomstart",d)),this._rotating&&!w.rotating&&this.fire(new i.z("rotatestart",d)),this._pitching&&!w.pitching&&this.fire(new i.z("pitchstart",d))}_fireMoveEvents(d){this.fire(new i.z("move",d)),this._zooming&&this.fire(new i.z("zoom",d)),this._rotating&&this.fire(new i.z("rotate",d)),this._pitching&&this.fire(new i.z("pitch",d))}_afterEase(d,m){if(this._easeId&&m&&this._easeId===m)return;this._easeId=void 0,this.transform.cameraElevationReference="ground";const w=this._zooming,M=this._rotating,O=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,w&&this.fire(new i.z("zoomend",d)),M&&this.fire(new i.z("rotateend",d)),O&&this.fire(new i.z("pitchend",d)),this.fire(new i.z("moveend",d))}flyTo(d,m){if(this._prefersReducedMotion(d)){const qt=i.aH(d,["center","zoom","bearing","pitch","around","padding","retainPadding"]);return this.jumpTo(qt,m)}this.stop(),d=Object.assign({offset:[0,0],speed:1.2,curve:1.42,easing:i.eV},d);const w=this.transform,M=this.getZoom(),O=this.getBearing(),D=this.getPitch(),B=this.getPadding(),V="zoom"in d?i.aA(+d.zoom,w.minZoom,w.maxZoom):M,Y="bearing"in d?this._normalizeBearing(d.bearing,O):O,Q="pitch"in d?+d.pitch:D,ce=this._extendPadding(d.padding),oe=w.zoomScale(V-M),de=i.P.convert(d.offset);let we=w.centerPoint.add(de);const ve=w.pointLocation(we),De=i.aT.convert(d.center||ve);this._normalizeCenter(De);const Pe=w.project(ve),Ve=w.project(De).sub(Pe);let Xe=d.curve;const We=Math.max(w.width,w.height),bt=We/oe,ut=Ve.mag();if("minZoom"in d){const qt=i.aA(Math.min(d.minZoom,M,V),w.minZoom,w.maxZoom),dr=We/w.zoomScale(qt-M);Xe=Math.sqrt(dr/ut*2)}const xt=Xe*Xe;function ct(qt){const dr=(bt*bt-We*We+(qt?-1:1)*xt*xt*ut*ut)/(2*(qt?bt:We)*xt*ut);return Math.log(Math.sqrt(dr*dr+1)-dr)}function it(qt){return(Math.exp(qt)-Math.exp(-qt))/2}function St(qt){return(Math.exp(qt)+Math.exp(-qt))/2}const Dt=ct(0);let Lt=function(qt){return St(Dt)/St(Dt+Xe*qt)},Ht=function(qt){return We*((St(Dt)*(it(dr=Dt+Xe*qt)/St(dr))-it(Dt))/xt)/ut;var dr},Wt=(ct(1)-Dt)/Xe;if(Math.abs(ut)<1e-6||!isFinite(Wt)){if(Math.abs(We-bt)<1e-6)return this.easeTo(d,m);const qt=btd.maxDuration&&(d.duration=0);const sr=O!==Y,_r=Q!==D,Bt=!w.isPaddingEqual(ce),Tt=d.retainPadding===!1?w.clone():w,Jt=qt=>dr=>{const Tr=dr*Wt,Hr=1/Lt(Tr);qt.zoom=dr===1?V:M+qt.scaleZoom(Hr),sr&&(qt.bearing=i.ak(O,Y,dr)),_r&&(qt.pitch=i.ak(D,Q,dr)),Bt&&(Tt.interpolatePadding(B,ce,dr),we=Tt.centerPoint.add(de));const Nr=dr===1?De:qt.unproject(Pe.add(Ve.mult(Ht(Tr))).mult(Hr));return qt.setLocationAtPoint(qt.renderWorldCopies?Nr.wrap():Nr,we),qt._updateCameraOnTerrain(),d.preloadOnly||this._fireMoveEvents(m),qt};if(d.preloadOnly){const qt=this._emulate(Jt,d.duration,w);return this._preloadTiles(qt),this}return this._zooming=!0,this._rotating=sr,this._pitching=_r,this._padding=Bt,this._prepareEase(m,!1),this._ease(Jt(w),()=>this._afterEase(m),d),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_requestRenderFrame(d){}_cancelRenderFrame(d){}_stop(d,m){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),this._easeFrameId=void 0,this._onEaseFrame=void 0),this._onEaseEnd){const w=this._onEaseEnd;this._onEaseEnd=void 0,w.call(this,m)}if(!d){const w=this.handlers;w&&w.stop(!1)}return this}_ease(d,m,w){w.animate===!1||w.duration===0?(d(1),m()):(this._easeStart=i.o.now(),this._easeOptions=w,this._onEaseFrame=d,this._onEaseEnd=m,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_renderFrameCallback(){const d=Math.min((i.o.now()-this._easeStart)/this._easeOptions.duration,1),m=this._onEaseFrame;m&&m(this._easeOptions.easing(d)),d<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()}_normalizeBearing(d,m){d=i.bT(d,-180,180);const w=Math.abs(d-m);return Math.abs(d-360-m)180?-360:w<-180?360:0}_prefersReducedMotion(d){return this._respectPrefersReducedMotion&&i.o.prefersReducedMotion&&!(d&&d.essential)}_emulate(d,m,w){const M=Math.ceil(15*m/1e3),O=[],D=d(w.clone());for(let B=0;B<=M;B++){const V=D(B/M);O.push(V.clone())}return O}_preloadTiles(d,m){}}class Vv{constructor(d={}){this.options=d,i.aY(["_toggleAttribution","_updateEditLink","_updateData","_updateCompact"],this)}getDefaultPosition(){return"bottom-right"}onAdd(d){const m=this.options&&this.options.compact,w=d._getUIString("AttributionControl.ToggleAttribution");this._map=d,this._container=N("div","mapboxgl-ctrl mapboxgl-ctrl-attrib"),this._compactButton=N("button","mapboxgl-ctrl-attrib-button",this._container),this._compactButton.type="button",this._compactButton.addEventListener("click",this._toggleAttribution),this._compactButton.setAttribute("aria-label",w);const M=N("span","mapboxgl-ctrl-icon",this._compactButton);return M.setAttribute("aria-hidden","true"),M.setAttribute("title",w),this._innerContainer=N("div","mapboxgl-ctrl-attrib-inner",this._container),m&&this._container.classList.add("mapboxgl-compact"),this._updateAttributions(),this._updateEditLink(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("moveend",this._updateEditLink),m===void 0&&(this._map.on("resize",this._updateCompact),this._updateCompact()),this._container}onRemove(){this._container.remove(),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("moveend",this._updateEditLink),this._map.off("resize",this._updateCompact),this._map=void 0,this._attribHTML=void 0}_toggleAttribution(){this._container.classList.contains("mapboxgl-compact-show")?(this._container.classList.remove("mapboxgl-compact-show"),this._compactButton.setAttribute("aria-expanded","false")):(this._container.classList.add("mapboxgl-compact-show"),this._compactButton.setAttribute("aria-expanded","true"))}_updateEditLink(){let d=this._editLink;d||(d=this._editLink=this._container.querySelector(".mapbox-improve-map"));const m=[{key:"owner",value:this.styleOwner},{key:"id",value:this.styleId},{key:"access_token",value:this._map._requestManager._customAccessToken||i.e.ACCESS_TOKEN}];if(d){const w=m.reduce((M,O,D)=>(O.value&&(M+=`${O.key}=${O.value}${DM.length-O.length),d=d.filter((M,O)=>{for(let D=O+1;D=0)return!1;return!0}),this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?d=[...this.options.customAttribution,...d]:d.unshift(this.options.customAttribution));const w=d.map(M=>function(O){const D=new DOMParser().parseFromString(O,"text/html");return Array.from(D.body.querySelectorAll("*")).forEach(B=>{const V=B.textContent||"";if(B.tagName!=="A")return void B.replaceWith(D.createTextNode(V));const Y=B.getAttribute("href");if(!Y||!/^(https?:|mailto:)/i.test(Y))return void B.replaceWith(D.createTextNode(V));const Q=D.createElement("a");Q.href=Y,Q.textContent=V,Q.rel="noopener nofollow";const ce=B.getAttribute("class");ce&&(Q.className=ce),B.replaceWith(Q)}),D.body.innerHTML}(M)).join(" | ");w!==this._attribHTML&&(this._attribHTML=w,d.length?(this._innerContainer.innerHTML=w,this._container.classList.remove("mapboxgl-attrib-empty")):this._container.classList.add("mapboxgl-attrib-empty"),this._editLink=null)}_updateCompact(){this._map.getCanvasContainer().offsetWidth<=640?this._container.classList.add("mapboxgl-compact"):this._container.classList.remove("mapboxgl-compact","mapboxgl-compact-show")}}class Hv{constructor(){i.aY(["_updateLogo","_updateCompact"],this)}onAdd(d){this._map=d,this._container=N("div","mapboxgl-ctrl");const m=N("a","mapboxgl-ctrl-logo");return m.target="_blank",m.rel="noopener nofollow",m.href="https://www.mapbox.com/",m.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),m.setAttribute("rel","noopener nofollow"),this._container.appendChild(m),this._container.style.display="none",this._map.on("sourcedata",this._updateLogo),this._updateLogo(),this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){this._container.remove(),this._map.off("sourcedata",this._updateLogo),this._map.off("resize",this._updateCompact)}getDefaultPosition(){return"bottom-left"}_updateLogo(d){d&&d.sourceDataType!=="metadata"||(this._container.style.display=this._logoRequired()?"block":"none")}_logoRequired(){if(!this._map.style)return!0;const d=this._map.style._sourceCaches;if(Object.entries(d).length===0)return!0;for(const m in d){const w=d[m].getSource();if(w.hasOwnProperty("mapbox_logo")&&!w.mapbox_logo)return!1}return!0}_updateCompact(){const d=this._container.children;if(d.length){const m=d[0];this._map.getCanvasContainer().offsetWidth<250?m.classList.add("mapboxgl-compact"):m.classList.remove("mapboxgl-compact")}}}class Hy{constructor(){i.aY(["_onIndoorUpdate"],this)}onAdd(d){return this._map=d,this._container=N("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._map.indoor.on("selector-update",m=>this._onIndoorUpdate(m)),this._container}_createButton(d,m){const w=N("button",d,this._container);return w.type="button",w.addEventListener("click",m),w}_createSeparator(){return N("div","mapboxgl-ctrl-separator",this._container)}_setButtonTitle(d,m){this._map&&(d.setAttribute("aria-label",m),d.textContent=m)}onRemove(){this._container&&this._container.remove(),this._map&&this._map.indoor&&(this._map.indoor.off("selector-update",this._onIndoorUpdate),this._map=null)}getDefaultPosition(){return"right"}_onIndoorUpdate(d){if(!d||!d.floors)return this._model=d,void(this._container.style.display="none");const m=this._model;this._model=d,this._container.style.display="inline-block",this._container.style.borderRadius="8px",m&&Array.from(this._container.children).forEach(w=>w.remove()),d.floors.length>0&&(this.addBuildingsToggleButton(),this.addCurrentFloors(d.floors,d.activeFloorsVisible),this._updateBuildingsButtonState())}addBuildingsToggleButton(){const d=this._createButton("mapboxgl-ctrl-buildings-toggle",()=>{const m=this._map;this._model&&m&&m._setIndoorActiveFloorsVisibility(!this._model.activeFloorsVisible)});N("span","mapboxgl-ctrl-icon",d).setAttribute("aria-hidden","true"),d.classList.add("mapboxgl-ctrl-level-button","mapboxgl-ctrl-buildings-toggle"),this._model&&!this._model.activeFloorsVisible&&d.classList.add("mapboxgl-ctrl-level-button-selected"),this._container.append(d),this._createSeparator()}_updateBuildingsButtonState(){const d=this._container.querySelector(".mapboxgl-ctrl-buildings-toggle");d&&this._model&&(this._model.activeFloorsVisible?d.classList.remove("mapboxgl-ctrl-level-button-selected"):d.classList.add("mapboxgl-ctrl-level-button-selected"))}addCurrentFloors(d,m){for(let w=0;w{this._map._selectIndoorFloor(M.id)});this._setButtonTitle(O,M.zIndex.toString()),this._model&&M.id===this._model.selectedFloorId&&m&&O.classList.add("mapboxgl-ctrl-level-button-selected"),this._container.append(O),w=this._endTime)return this._end;const m=i.dD((d-this._startTime)/(this._endTime-this._startTime));return this._start*(1-m)+this._end*m}isEasing(d){return d>=this._startTime&&d<=this._endTime}jumpTo(d){this._startTime=-1/0,this._endTime=-1/0,this._start=d,this._end=d}easeTo(d,m,w){this._start=this.getValue(m),this._end=d,this._startTime=m,this._endTime=m+w}}const Cp={"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 Vm extends i.z{constructor(d,m,w,M){const{point:O,lngLat:D,originalEvent:B,target:V}=d;super(d.type,{point:O,lngLat:D,originalEvent:B,target:V}),this.preventDefault=()=>{d.preventDefault()},this.id=m,this.interaction=w,this.feature=M}}class Oh{constructor(d){this.map=d,this.interactionsByType=new Map,this.delegatedInteractions=new Map,this.typeById=new Map,this.filters=new Map,this.handleType=this.handleType.bind(this),this.handleMove=this.handleMove.bind(this),this.handleOut=this.handleOut.bind(this),this.hoveredFeatures=new Map,this.prevHoveredFeatures=new Map}add(d,m){if(this.typeById.has(d))throw new Error(`Interaction id "${d}" already exists.`);const w=m.filter;let M=m.type;w&&this.filters.set(d,i.b6(w)),M==="mouseover"&&(M="mouseenter"),M==="mouseout"&&(M="mouseleave");const O=this.interactionsByType.get(M)||new Map;M==="mouseenter"||M==="mouseleave"?(this.delegatedInteractions.size===0&&(this.map.on("mousemove",this.handleMove),this.map.on("mouseout",this.handleOut)),this.delegatedInteractions.set(d,m)):O.size===0&&this.map.on(M,this.handleType),O.size===0&&this.interactionsByType.set(M,O),O.set(d,m),this.typeById.set(d,M)}get(d){const m=this.typeById.get(d);if(!m)return;const w=this.interactionsByType.get(m);return w?w.get(d):void 0}remove(d){const m=this.typeById.get(d);if(!m)return;this.typeById.delete(d),this.filters.delete(d);const w=this.interactionsByType.get(m);w&&(w.delete(d),m==="mouseenter"||m==="mouseleave"?(this.delegatedInteractions.delete(d),this.delegatedInteractions.size===0&&(this.map.off("mousemove",this.handleMove),this.map.off("mouseout",this.handleOut))):w.size===0&&this.map.off(m,this.handleType))}queryTargets(d,m){const w=[];for(const[M,O]of m)O.target&&w.push({targetId:M,target:O.target,filter:this.filters.get(M)});return this.map.style.queryRenderedTargets(d,w,this.map.transform)}handleMove(d){this.prevHoveredFeatures=this.hoveredFeatures,this.hoveredFeatures=new Map;const m=this.queryTargets(d.point,Array.from(this.delegatedInteractions).reverse());m.length&&(d.type="mouseenter",this.handleType(d,m));const w=new Map;for(const[M,{feature:O}]of this.prevHoveredFeatures)this.hoveredFeatures.has(M)||w.set(O.id,O);w.size&&(d.type="mouseleave",this.handleType(d,Array.from(w.values())))}handleOut(d){const m=Array.from(this.hoveredFeatures.values()).map(({feature:w})=>w);m.length&&(d.type="mouseleave",this.handleType(d,m)),this.hoveredFeatures.clear()}handleType(d,m){const w=d.type==="mouseenter";if(w&&!this.interactionsByType.has(d.type))return void i.w("mouseenter interaction required for mouseleave to work.");const M=Array.from(this.interactionsByType.get(d.type)).reverse(),O=!!m;m=m||this.queryTargets(d.point,M);let D=!1;const B=new Set;for(const V of m){for(const[Y,Q]of M){if(!Q.target)continue;const ce=V.variants?V.variants[Y]:null;if(ce){for(const oe of ce){if(Tm(oe,V,B,Y))continue;const de=new i.dx(V,oe),we=dp(oe,V,Y);O&&de.id!==void 0&&(de.state=this.map.getFeatureState(de));const ve=w?this.prevHoveredFeatures.get(we):null,De=new Vm(d,Y,Q,de),Pe=ve?ve.stop:Q.handler(De);if(w&&this.hoveredFeatures.set(we,{feature:V,stop:Pe}),Pe!==!1){D=!0;break}}if(D)break}}if(D)break}if(!D)for(const[V,Y]of M){const{handler:Q,target:ce}=Y;if(!ce&&Q(new Vm(d,V,Y,null))!==!1)break}}}function mie(_,d){if(Array.isArray(_)&&Array.isArray(d)){const m=new Set(_),w=new Set(d);return m.size===w.size&&_.every(M=>w.has(M))}return i.by(_,d)}const gie={center:[0,0],zoom:0,bearing:0,pitch:0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:85,interactive:!0,scrollZoom:!0,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:!1,performanceMetricsCollection:!0,bearingSnap:7,clickTolerance:3,pitchWithRotate:!0,hash:!1,attributionControl:!0,antialias:!1,failIfMajorPerformanceCaveat:!1,preserveDrawingBuffer:!1,trackResize:!0,renderWorldCopies:!0,refreshExpiredTiles:!0,minTileCacheSize:null,maxTileCacheSize:null,localIdeographFontFamily:"sans-serif",localFontFamily:null,transformRequest:null,accessToken:null,fadeDuration:300,respectPrefersReducedMotion:!0,crossSourceCollisions:!0,collectResourceTiming:!1,testMode:!1,precompilePrograms:!0,scaleFactor:1,spriteFormat:"auto"},xie={showCompass:!0,showZoom:!0,visualizePitch:!1};class yie{constructor(d,m,w=!1){this._clickTolerance=10,this.element=m,this.mouseRotate=new k5({clickTolerance:d.dragRotate._mouseRotate._clickTolerance}),this.map=d,w&&(this.mousePitch=new N5({clickTolerance:d.dragRotate._mousePitch._clickTolerance})),i.aY(["mousedown","mousemove","mouseup","touchstart","touchmove","touchend","reset"],this),m.addEventListener("mousedown",this.mousedown),m.addEventListener("touchstart",this.touchstart,{passive:!1}),m.addEventListener("touchmove",this.touchmove),m.addEventListener("touchend",this.touchend),m.addEventListener("touchcancel",this.reset)}down(d,m){this.mouseRotate.mousedown(d,m),this.mousePitch&&this.mousePitch.mousedown(d,m),z()}move(d,m){const w=this.map,M=this.mouseRotate.mousemoveWindow(d,m),O=M&&M.bearingDelta;if(O&&w.setBearing(w.getBearing()+O),this.mousePitch){const D=this.mousePitch.mousemoveWindow(d,m),B=D&&D.pitchDelta;B&&w.setPitch(w.getPitch()+B)}}off(){const d=this.element;d.removeEventListener("mousedown",this.mousedown),d.removeEventListener("touchstart",this.touchstart),d.removeEventListener("touchmove",this.touchmove),d.removeEventListener("touchend",this.touchend),d.removeEventListener("touchcancel",this.reset),this.offTemp()}offTemp(){F(),window.removeEventListener("mousemove",this.mousemove),window.removeEventListener("mouseup",this.mouseup)}mousedown(d){this.down(Object.assign({},d,{ctrlKey:!0,preventDefault:()=>d.preventDefault()}),Z(this.element,d)),window.addEventListener("mousemove",this.mousemove),window.addEventListener("mouseup",this.mouseup)}mousemove(d){this.move(d,Z(this.element,d))}mouseup(d){this.mouseRotate.mouseupWindow(d),this.mousePitch&&this.mousePitch.mouseupWindow(d),this.offTemp()}touchstart(d){d.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=G(this.element,d.targetTouches)[0],this.down({type:"mousedown",button:0,ctrlKey:!0,preventDefault:()=>d.preventDefault()},this._startPos))}touchmove(d){d.targetTouches.length!==1?this.reset():(this._lastPos=G(this.element,d.targetTouches)[0],this.move({preventDefault:()=>d.preventDefault()},this._lastPos))}touchend(d){d.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)m.width||d.y>m.height;m.locationPoint3D(w).distSqr(d)180;){const w=m.locationPoint3D(_);if(w.x>=0&&w.y>=0&&w.x<=m.width&&w.y<=m.height)break;_.lng>m.center.lng?_.lng-=360:_.lng+=360}return _}const vc={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%)"},eh={rotation:0,rotationAlignment:"auto",pitchAlignment:"auto",occludedOpacity:.2,altitude:0};class SN extends i.E{constructor(d,m){super(),(d instanceof HTMLElement||m)&&(d=Object.assign({element:d},m)),i.aY(["_update","_onMove","_onUp","_addDragHandler","_onMapClick","_onKeyPress","_clearFadeTimer"],this);const{anchor:w="center",color:M="#3FB1CE",scale:O=1,draggable:D=!1,clickTolerance:B=0,rotation:V=eh.rotation,rotationAlignment:Y=eh.rotationAlignment,pitchAlignment:Q=eh.pitchAlignment,occludedOpacity:ce=eh.occludedOpacity,altitude:oe=eh.altitude}=d||{};this._anchor=w,this._color=M,this._scale=O,this._draggable=D,this._clickTolerance=B,this._rotation=V,this._rotationAlignment=Y,this._pitchAlignment=Q,this._occludedOpacity=ce,this._altitude=oe,this._state="inactive",this._isDragging=!1,this._updateMoving=()=>this._update(!0),d&&d.element?(this._element=d.element,this._offset=i.P.convert(d&&d.offset||[0,0])):(this._defaultMarker=!0,this._element=this._createDefaultMarker(),this._offset=i.P.convert(d&&d.offset||[0,-14])),this._element.hasAttribute("aria-label")||this._element.setAttribute("aria-label","Map marker"),this._element.hasAttribute("role")||this._element.setAttribute("role","img"),this._element.classList.add("mapboxgl-marker"),this._element.addEventListener("dragstart",ve=>{ve.preventDefault()}),this._element.addEventListener("mousedown",ve=>{ve.preventDefault()});const de=this._element.classList;for(const ve in vc)de.remove(`mapboxgl-marker-anchor-${ve}`);de.add(`mapboxgl-marker-anchor-${this._anchor}`);const we=d&&d.className?d.className.trim().split(/\s+/):[];de.add(...we),this._popup=null}_createDefaultMarker(){const d=N("div"),m=A("svg",{display:"block",height:41*this._scale+"px",width:27*this._scale+"px",viewBox:"0 0 27 41"},d);if(this._altitude===0){const w=A("radialGradient",{id:"shadowGradient"},A("defs",{},m));A("stop",{offset:"10%","stop-opacity":.4},w),A("stop",{offset:"100%","stop-opacity":.05},w),A("ellipse",{cx:13.5,cy:34.8,rx:10.5,ry:5.25,fill:"url(#shadowGradient)"},m)}return A("path",{fill:this._color,d:"M27,13.5C27,19.07 20.25,27 14.75,34.5C14.02,35.5 12.98,35.5 12.25,34.5C6.75,27 0,19.22 0,13.5C0,6.04 6.04,0 13.5,0C20.96,0 27,6.04 27,13.5Z"},m),A("path",{opacity:.25,d:"M13.5,0C6.04,0 0,6.04 0,13.5C0,19.22 6.75,27 12.25,34.5C13,35.52 14.02,35.5 14.75,34.5C20.25,27 27,19.07 27,13.5C27,6.04 20.96,0 13.5,0ZM13.5,1C20.42,1 26,6.58 26,13.5C26,15.9 24.5,19.18 22.22,22.74C19.95,26.3 16.71,30.14 13.94,33.91C13.74,34.18 13.61,34.32 13.5,34.44C13.39,34.32 13.26,34.18 13.06,33.91C10.28,30.13 7.41,26.31 5.02,22.77C2.62,19.23 1,15.95 1,13.5C1,6.58 6.58,1 13.5,1Z"},m),A("circle",{fill:"white",cx:13.5,cy:13.5,r:5.5},m),d}addTo(d){return d===this._map||(this.remove(),this._map=d,d.getCanvasContainer().appendChild(this._element),d.on("move",this._updateMoving),d.on("moveend",this._update),d.on("remove",this._clearFadeTimer),d._addMarker(this),this.setDraggable(this._draggable),this._update(),d.on("click",this._onMapClick)),this}remove(){const d=this._map;return d&&(d.off("click",this._onMapClick),d.off("move",this._updateMoving),d.off("moveend",this._update),d.off("mousedown",this._addDragHandler),d.off("touchstart",this._addDragHandler),d.off("mouseup",this._onUp),d.off("touchend",this._onUp),d.off("mousemove",this._onMove),d.off("touchmove",this._onMove),d.off("remove",this._clearFadeTimer),d._removeMarker(this),this._map=void 0),this._clearFadeTimer(),this._element.remove(),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(d){return this._lngLat=i.aT.convert(d),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(!0),this}setAltitude(d){return d===this._altitude||(this._defaultMarker&&(this._altitude===0&&d!==0||this._altitude!==0&&d===0)&&(this._element=this._createDefaultMarker()),this._altitude=d||eh.altitude,this._update()),this}getAltitude(){return this._altitude}getElement(){return this._element}setPopup(d){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeAttribute("role"),this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),d){if(!("offset"in d.options)){const M=Math.sqrt(Math.pow(13.5,2)/2);d.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[M,-1*(38.1-13.5+M)],"bottom-right":[-M,-1*(38.1-13.5+M)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=d,d._marker=this,d._altitude=this._altitude,this._lngLat&&this._popup.setLngLat(this._lngLat),this._element.setAttribute("role","button"),this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress),this._element.setAttribute("aria-expanded","false")}return this}_onKeyPress(d){const m=d.code,w=d.charCode||d.keyCode;m!=="Space"&&m!=="Enter"&&w!==32&&w!==13||this.togglePopup()}_onMapClick(d){const m=d.originalEvent.target,w=this._element;this._popup&&(m===w||w.contains(m))&&this.togglePopup()}getPopup(){return this._popup}togglePopup(){const d=this._popup;return d?(d.isOpen()?(d.remove(),this._element.setAttribute("aria-expanded","false")):this._map&&(d.addTo(this._map),this._element.setAttribute("aria-expanded","true")),this):this}_behindTerrain(){const d=this._map,m=this._pos;if(!d||!m)return!1;const w=d.unproject(m,this._altitude),M=d.getFreeCameraOptions();if(!M.position)return!1;const O=M.position.toLngLat();return O.distanceTo(w)<.9*O.distanceTo(this._lngLat)}_evaluateOpacity(){const d=this._map;if(!d)return;const m=this._pos;if(!m||m.x<0||m.x>d.transform.width||m.y<0||m.y>d.transform.height)return void this._clearFadeTimer();const w=d.unproject(m,this._altitude);let M;d._showingGlobe()&&i.f5(d.transform,this._lngLat)?M=0:(M=1-d._queryFogOpacity(w),d.transform._terrainEnabled()&&d.getTerrain()&&this._behindTerrain()&&(M*=this._occludedOpacity)),this._element.style.opacity=`${M}`,this._element.style.pointerEvents=M>0?"auto":"none",this._popup&&this._popup._setOpacity(M),this._fadeTimer=null}_clearFadeTimer(){this._fadeTimer&&(clearTimeout(this._fadeTimer),this._fadeTimer=null)}_updateDOM(){const d=this._pos;if(!d||!this._map)return;const m=this._offset.mult(this._scale);this._element.style.transform=` translate(${d.x}px,${d.y}px) ${vc[this._anchor]} ${this._calculateXYTransform()} ${this._calculateZTransform()} translate(${m.x}px,${m.y}px) `}_calculateXYTransform(){const d=this._pos,m=this._map,w=this.getPitchAlignment();if(!m||!d||w!=="map")return"";if(!m._showingGlobe()){const V=m.getPitch();return V?`rotateX(${V}deg)`:""}const M=i.cX(i.f6(m.transform,this._lngLat)),O=d.sub(i.f7(m.transform)),D=Math.abs(O.x)+Math.abs(O.y);if(D===0)return"";const B=M/D;return`rotateX(${-O.y*B}deg) rotateY(${O.x*B}deg)`}_calculateZTransform(){const d=this._pos,m=this._map;if(!m||!d)return"";let w=0;const M=this.getRotationAlignment();if(M==="map")if(m._showingGlobe()){const O=m.project(new i.aT(this._lngLat.lng,this._lngLat.lat+.001),this._altitude),D=m.project(new i.aT(this._lngLat.lng,this._lngLat.lat-.001),this._altitude).sub(O);w=i.cX(Math.atan2(D.y,D.x))-90}else w=-m.getBearing();else if(M==="horizon"){const O=i.ah(4,6,m.getZoom()),D=i.f7(m.transform);D.y+=O*m.transform.height;const B=d.sub(D),V=i.cX(Math.atan2(B.y,B.x));w=(V>90?V-270:V+90)*(1-O)}return w+=this._rotation,w?`rotateZ(${w}deg)`:""}_update(d){cancelAnimationFrame(this._updateFrameId);const m=this._map;m&&(m.transform.renderWorldCopies&&(this._lngLat=T5(this._lngLat,this._pos,m.transform)),this._pos=m.project(this._lngLat,this._altitude),d===!0?this._updateFrameId=requestAnimationFrame(()=>{this._element&&this._pos&&this._anchor&&(this._pos=this._pos.round(),this._updateDOM())}):this._pos=this._pos.round(),m._requestDomTask(()=>{this._map&&(this._element&&this._pos&&this._anchor&&this._updateDOM(),(m._showingGlobe()||m.getTerrain()||m.getFog())&&!this._fadeTimer&&(this._fadeTimer=window.setTimeout(this._evaluateOpacity.bind(this),60)))}))}getOffset(){return this._offset}setOffset(d){return this._offset=i.P.convert(d),this._update(),this}addClassName(d){return this._element.classList.add(d),this}removeClassName(d){return this._element.classList.remove(d),this}toggleClassName(d){return this._element.classList.toggle(d)}_onMove(d){const m=this._map;if(!m)return;const w=this._pointerdownPos,M=this._positionDelta;if(w&&M){if(!this._isDragging){const O=this._clickTolerance||m._clickTolerance;if(d.point.dist(w)_.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(_.minPitch!=null&&_.maxPitch!=null&&_.minPitch>_.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(_.minPitch!=null&&_.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(_.maxPitch!=null&&_.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(_.antialias&&i.f3(window)&&(_.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 P3(_.minZoom,_.maxZoom,_.minPitch,_.maxPitch,_.renderWorldCopies,null,null),_),this._repaint=!!_.repaint,this._interactive=_.interactive,this._minTileCacheSize=_.minTileCacheSize,this._maxTileCacheSize=_.maxTileCacheSize,this._failIfMajorPerformanceCaveat=_.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=_.preserveDrawingBuffer,this._antialias=_.antialias,this._trackResize=_.trackResize,this._bearingSnap=_.bearingSnap,this._refreshExpiredTiles=_.refreshExpiredTiles,this._fadeDuration=_.fadeDuration,this._isInitialLoad=!0,this._crossSourceCollisions=_.crossSourceCollisions,this._collectResourceTiming=_.collectResourceTiming,this._language=this._parseLanguage(_.language),this._worldview=_.worldview,this._renderTaskQueue=new Np,this._domRenderTaskQueue=new Np,this._controls=[],this._markers=[],this._popups=[],this._mapId=i.b2(),this._locale=Object.assign({},Cp,_.locale),this._clickTolerance=_.clickTolerance,this._cooperativeGestures=_.cooperativeGestures,this._performanceMetricsCollection=_.performanceMetricsCollection,this._tessellationStep=_.tessellationStep,this._containerWidth=0,this._containerHeight=0,this._showParseStatus=!0,this._precompilePrograms=_.precompilePrograms,this._scaleFactorChanged=!1,this._averageElevationLastSampledAt=-1/0,this._averageElevationExaggeration=0,this._averageElevation=new Sp(0),this._interactionRange=[1/0,-1/0],this._visibilityHidden=0,this._useExplicitProjection=!1,this._frameId=0,this._scaleFactor=_.scaleFactor,this._requestManager=new ne(_.transformRequest,_.accessToken,_.testMode),this._silenceAuthErrors=!!_.testMode,this._contextCreateOptions=_.contextCreateOptions?Object.assign({},_.contextCreateOptions):{},typeof _.container=="string"){const m=document.getElementById(_.container);if(!m)throw new Error(`Container '${_.container.toString()}' not found.`);this._container=m}else{if(!(_.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=_.container}if(this._container.childNodes.length>0&&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."),_.maxBounds&&this.setMaxBounds(_.maxBounds),this._spriteFormat=_.spriteFormat,i.aY(["_onWindowOnline","_onWindowResize","_onVisibilityChange","_onMapScroll","_contextLost","_contextRestored"],this),this._setupContainer(),this._setupPainter(),this.painter===void 0)throw new Error("Failed to initialize WebGL.");if(this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),this._fullscreenchangeEvent="onfullscreenchange"in document?"fullscreenchange":"webkitfullscreenchange",window.addEventListener("online",this._onWindowOnline,!1),window.addEventListener("resize",this._onWindowResize,!1),window.addEventListener("orientationchange",this._onWindowResize,!1),window.addEventListener(this._fullscreenchangeEvent,this._onWindowResize,!1),window.addEventListener("visibilitychange",this._onVisibilityChange,!1),this.handlers=new pie(this,_),this._localFontFamily=_.localFontFamily,this._localIdeographFontFamily=_.localIdeographFontFamily,(_.style||!_.testMode)&&this.setStyle(_.style||i.e.DEFAULT_STYLE,{config:_.config,localFontFamily:this._localFontFamily,localIdeographFontFamily:this._localIdeographFontFamily}),_.projection&&this.setProjection(_.projection),_.hash&&(this._hash=new g5(typeof _.hash=="string"&&_.hash||void 0).addTo(this)),!this._hash||!this._hash._onHashChange()){d.center==null&&d.zoom==null||(this.transform._unmodified=!1),this.jumpTo({center:_.center,zoom:_.zoom,bearing:_.bearing,pitch:_.pitch});const m=_.bounds;m&&(this.resize(),this.fitBounds(m,Object.assign({},_.fitBoundsOptions,{duration:0})))}this.resize(),_.attributionControl&&this.addControl(new Vv({customAttribution:_.customAttribution})),this._logoControl=new Hv,this.addControl(this._logoControl,_.logoPosition),this.on("style.load",()=>{this.transform.unmodified&&this.jumpTo(this.style.stylesheet),this._postStyleLoadEvent(),this._postStyleWithAppearanceEvent(),this._setupIndoor()}),this.on("data",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 Oh(this)}_getMapId(){return this._mapId}addControl(_,d){if(d===void 0&&(d=_.getDefaultPosition?_.getDefaultPosition():"top-right"),!_||!_.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=_.onAdd(this);this._controls.push(_);const w=this._controlPositions[d];return d.indexOf("bottom")!==-1?w.insertBefore(m,w.firstChild):w.appendChild(m),this}removeControl(_){if(!_||!_.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(_);return d>-1&&this._controls.splice(d,1),_.onRemove(this),this}hasControl(_){return this._controls.indexOf(_)>-1}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}resize(_){if(this._updateContainerDimensions(),this._containerWidth===this.transform.width&&this._containerHeight===this.transform.height)return this;this._resizeCanvas(this._containerWidth,this._containerHeight),this.transform.resize(this._containerWidth,this._containerHeight),this.painter.resize(Math.ceil(this._containerWidth),Math.ceil(this._containerHeight));const d=!this._moving;return d&&this.fire(new i.z("movestart",_)).fire(new i.z("move",_)),this.fire(new i.z("resize",_)),d&&this.fire(new i.z("moveend",_)),this}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()||null}setMaxBounds(_){return this.transform.setMaxBounds(i.aI.convert(_)),this._update()}setMinZoom(_){if((_=_??-2)>=-2&&_<=this.transform.maxZoom)return this.transform.minZoom=_,this._update(),this.getZoom()<_?this.setZoom(_):this.fire(new i.z("zoomstart")).fire(new i.z("zoom")).fire(new i.z("zoomend")),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(_){if((_=_??22)>=this.transform.minZoom)return this.transform.maxZoom=_,this._update(),this.getZoom()>_?this.setZoom(_):this.fire(new 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(_){if((_=_??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(_>=0&&_<=this.transform.maxPitch)return this.transform.minPitch=_,this._update(),this.getPitch()<_?this.setPitch(_):this.fire(new i.z("pitchstart")).fire(new i.z("pitch")).fire(new i.z("pitchend")),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(_){if((_=_??85)>85)throw new Error("maxPitch must be less than or equal to 85");if(_>=this.transform.minPitch)return this.transform.maxPitch=_,this._update(),this.getPitch()>_?this.setPitch(_):this.fire(new 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(_){return this._scaleFactor=_,this.painter.scaleFactor=_,this._scaleFactorChanged=!0,this.style._updateFilteredLayers(d=>d.type==="symbol"),this._update(!0),this}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(_){return this.transform.renderWorldCopies=_,this.transform.renderWorldCopies||this._forceMarkerAndPopupUpdate(!0),this._update()}getLanguage(){return this._language}_parseLanguage(_){return _==="auto"?navigator.language:Array.isArray(_)?_.length===0?void 0:_.map(d=>d==="auto"?navigator.language:d):_}setLanguage(_){const d=this._parseLanguage(_);if(!this.style||d===this._language)return this;this._language=d,this.style.reloadSources();for(const m of this._controls)m._setLanguage&&m._setLanguage(this._language);return this}getWorldview(){return this._worldview}setWorldview(_){return this.style&&_!==this._worldview?(this._worldview=_,this._styleDirty=!0,this.style.reloadSources(),this):this}getProjection(){return this.transform.mercatorFromTransition?{name:"globe",center:[0,0]}:this.transform.getProjection()}_showingGlobe(){return this.transform.projection.name==="globe"}setProjection(_){return this._lazyInitEmptyStyle(),_?typeof _=="string"&&(_={name:_}):_=null,this._useExplicitProjection=!!_,this._prioritizeAndUpdateProjection(_,this.style.projection)}_updateProjectionTransition(){if(this.getProjection().name!=="globe")return;const _=this.transform,d=_.projection.name;let m;d==="globe"&&_.zoom>=i.cL?(_.setMercatorFromTransition(),m=!0):d==="mercator"&&_.zoom=i.cL?this.transform.setMercatorFromTransition():this.transform.setProjection(_),this.style.applyProjectionUpdate();const w=this.transform.getProjection().name==="mercator"&&m!==this.transform.mercatorFromTransition;return(d||w)&&(this.painter.clearBackgroundTiles(),this.style.clearSources(),this._update(!0),this._forceMarkerAndPopupUpdate(!0)),this}project(_,d){return this.transform.locationPoint3D(i.aT.convert(_),d)}unproject(_,d){return this.transform.pointLocation3D(i.P.convert(_),d)}isMoving(){return this._moving||this.handlers&&this.handlers.isMoving()||!1}isZooming(){return this._zooming||this.handlers&&this.handlers.isZooming()||!1}isRotating(){return this._rotating||this.handlers&&this.handlers.isRotating()||!1}_isDragging(){return this.handlers&&this.handlers._isDragging()||!1}_createDelegatedListener(_,d,m){const w=M=>{let O=[];if(Array.isArray(d)){const D=d.filter(B=>this.getLayer(B));O=D.length?this.queryRenderedFeatures(M,{layers:D}):[]}else O=this.queryRenderedFeatures(M,{target:d});return O};if(_==="mouseenter"||_==="mouseover"){let M=!1;return{listener:m,targets:d,delegates:{mousemove:D=>{const B=w(D.point);B.length?M||(M=!0,m.call(this,new kd(_,this,D.originalEvent,{features:B}))):M=!1},mouseout:()=>{M=!1}}}}if(_==="mouseleave"||_==="mouseout"){let M=!1;return{listener:m,targets:d,delegates:{mousemove:B=>{w(B.point).length?M=!0:M&&(M=!1,m.call(this,new kd(_,this,B.originalEvent)))},mouseout:B=>{M&&(M=!1,m.call(this,new kd(_,this,B.originalEvent)))}}}}{const M=O=>{const D=w(O.point);D.length&&(O.features=D,m.call(this,O),delete O.features)};return{listener:m,targets:d,delegates:{[_]:M}}}}on(_,d,m){if(typeof d=="function"||m===void 0)return super.on(_,d);if(typeof d=="string"&&(d=[d]),!this._areTargetsValid(d))return this;const w=this._createDelegatedListener(_,d,m);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[_]=this._delegatedListeners[_]||[],this._delegatedListeners[_].push(w);for(const M in w.delegates)this.on(M,w.delegates[M]);return this}once(_,d,m){if(typeof d=="function"||m===void 0)return super.once(_,d);if(typeof d=="string"&&(d=[d]),!this._areTargetsValid(d))return this;const w=this._createDelegatedListener(_,d,m);for(const M in w.delegates)this.once(M,w.delegates[M]);return this}off(_,d,m){if(typeof d=="function"||m===void 0)return super.off(_,d);if(typeof d=="string"&&(d=[d]),!this._areTargetsValid(d))return this;const w=this._delegatedListeners?this._delegatedListeners[_]:void 0;return w&&(M=>{for(let O=0;O{if(m){const M=typeof m=="string"?m:m instanceof Error?m.message:m.error;i.w(`Unable to perform style diff: ${M}. Rebuilding the style from scratch.`),this._updateStyle(_,d)}else w&&this._update(!0)},()=>this._postStyleLoadEvent()),this):(this._localIdeographFontFamily=d.localIdeographFontFamily,this._localFontFamily=d.localFontFamily,this._updateStyle(_,d))}_getUIString(_){const d=this._locale[_];if(d==null)throw new Error(`Missing UI string '${_}'`);return d}_updateStyle(_,d){if(this.style&&(this.style.setEventedParent(null),this.style._remove(),this.style=void 0),_){const m=Object.assign({},d);d&&d.config&&(m.initialConfig=d.config,delete m.config),this.style=new Ju(this,m).load(_),this.style.setEventedParent(this,{style:this.style})}return this._updateTerrain(),this}_lazyInitEmptyStyle(){this.style||(this.style=new Ju(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(_){return _==null?(this.fire(new i.y(new Error("IDs can't be empty."))),!1):!i.dr(_)||(this.fire(new i.y(new Error(`IDs can't contain special symbols: "${_}".`))),!1)}_isTargetValid(_){return"featuresetId"in _?this._isValidId("importId"in _?_.importId:_.featuresetId):"layerId"in _&&this._isValidId(_.layerId)}_areTargetsValid(_){if(Array.isArray(_)){for(const d of _)if(!this._isValidId(d))return!1;return!0}return this._isTargetValid(_)}addSource(_,d){return this._isValidId(_)?(this._lazyInitEmptyStyle(),this.style.addSource(_,d),this._update(!0)):this}isSourceLoaded(_){return!!this._isValidId(_)&&!!this.style&&this.style._isSourceCacheLoaded(_)}areTilesLoaded(){return this.style.areTilesLoaded()}addSourceType(_,d,m){this._lazyInitEmptyStyle(),this.style.addSourceType(_,d,m)}removeSource(_){return this._isValidId(_)?(this.style.removeSource(_),this._updateTerrain(),this._update(!0)):this}getSource(_){return this._isValidId(_)?this.style.getOwnSource(_):null}addImage(_,d,{pixelRatio:m=1,sdf:w=!1,stretchX:M,stretchY:O,content:D}={}){this._lazyInitEmptyStyle();const B=i.I.from(_);if(d instanceof HTMLImageElement||ImageBitmap&&d instanceof ImageBitmap){const{width:V,height:Y,data:Q}=i.o.getImageData(d);this.style.addImage(B,{data:new i.q({width:V,height:Y},Q),pixelRatio:m,stretchX:M,stretchY:O,content:D,sdf:w,version:0,usvg:!1})}else if(d.width===void 0||d.height===void 0)this.fire(new i.y(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));else{const{width:V,height:Y}=d,Q=d;this.style.addImage(B,{data:new i.q({width:V,height:Y},new Uint8Array(Q.data)),pixelRatio:m,stretchX:M,stretchY:O,content:D,sdf:w,usvg:!1,version:0,userImage:Q}),Q.onAdd&&Q.onAdd(this,_)}}updateImage(_,d){this._lazyInitEmptyStyle();const m=i.I.from(_),w=this.style.getImage(m);if(!w)return void this.fire(new i.y(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const M=d instanceof HTMLImageElement||ImageBitmap&&d instanceof ImageBitmap?i.o.getImageData(d):d,{width:O,height:D,data:B}=M;if(O===void 0||D===void 0)return void this.fire(new i.y(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));if(O!==(w.usvg?w.icon.usvg_tree.width:w.data.width)||D!==(w.usvg?w.icon.usvg_tree.height:w.data.height))return void this.fire(new i.y(new Error(`The width and height of the updated image (${O}, ${D}) must be that same as the previous version of the image (${w.data.width}, ${w.data.height})`)));const V=!(d instanceof HTMLImageElement||ImageBitmap&&d instanceof ImageBitmap);let Y=!1;w.usvg?(w.data=new i.q({width:O,height:D},new Uint8Array(B)),w.usvg=!1,w.icon=void 0,Y=!0):w.data.replace(B,V),this.style.updateImage(m,w,Y)}hasImage(_){return _?!!this.style&&!!this.style.getImage(i.I.from(_)):(this.fire(new i.y(new Error("Missing required image id"))),!1)}removeImage(_){this.style.removeImage(i.I.from(_))}loadImage(_,d){i.n(this._requestManager.transformRequest(_,i.R.Image),(m,w)=>{d(m,w instanceof HTMLImageElement?i.o.getImageData(w):w)})}listImages(){return this.style.listImages().map(_=>_.name)}addModel(_,d){this._lazyInitEmptyStyle(),this.style.addModel(_,d)}hasModel(_){return _?this.style.hasModel(_):(this.fire(new i.y(new Error("Missing required model id"))),!1)}removeModel(_){this.style.removeModel(_)}listModels(){return this.style.listModels()}addLayer(_,d){return this._isValidId(_.id)?(this._lazyInitEmptyStyle(),this.style.addLayer(_,d),this._update(!0)):this}getSlot(_){const d=this.getLayer(_);return d&&d.slot||null}setSlot(_,d){return this.style.setSlot(_,d),this.style.mergeLayers(),this._update(!0)}addImport(_,d){return this.style.addImport(_,d).catch(m=>this.fire(new i.y(new Error("Failed to add import",m)))),this}updateImport(_,d){return typeof d!="string"&&d.id!==_?(this.removeImport(_),this.addImport(d)):(this.style.updateImport(_,d),this._update(!0))}removeImport(_){return this.style.removeImport(_),this}moveImport(_,d){return this.style.moveImport(_,d),this._update(!0)}moveLayer(_,d){return this._isValidId(_)?(this.style.moveLayer(_,d),this._update(!0)):this}removeLayer(_){return this._isValidId(_)?(this.style.removeLayer(_),this._update(!0)):this}getLayer(_){if(!this._isValidId(_))return null;const d=this.style.getOwnLayer(_);return d?d.type==="custom"?d.implementation:d.serialize():void 0}getSlots(){return this.style.getSlots()}setLayerZoomRange(_,d,m){return this._isValidId(_)?(this.style.setLayerZoomRange(_,d,m),this._update(!0)):this}setFilter(_,d,m={}){return this._isValidId(_)?(this.style.setFilter(_,d,m),this._update(!0)):this}getFilter(_){return this._isValidId(_)?this.style.getFilter(_):null}setPaintProperty(_,d,m,w={}){return this._isValidId(_)?(this.style.setPaintProperty(_,d,m,w),this._update(!0)):this}getPaintProperty(_,d){return this._isValidId(_)?this.style.getPaintProperty(_,d):null}setLayoutProperty(_,d,m,w={}){return this._isValidId(_)?(this.style.setLayoutProperty(_,d,m,w),this._update(!0)):this}getLayoutProperty(_,d){return this._isValidId(_)?this.style.getLayoutProperty(_,d):null}setLayerProperty(_,d,m,w={}){return this._isValidId(_)?(d==="appearances"&&this._postAddingAppearancesToStyleEvent(),this.style.setLayerProperty(_,d,m,w),this._update(!0)):this}getGlyphsUrl(){return this.style.getGlyphsUrl()}setGlyphsUrl(_){return this.style.setGlyphsUrl(_),this._update(!0)}getSchema(_){return this.style.getSchema(_)}setSchema(_,d){return this.style.setSchema(_,d),this._update(!0)}getConfig(_){return this.style.getConfig(_)}setConfig(_,d){return this.style.setConfig(_,d),this._update(!0)}getConfigProperty(_,d){return this.style.getConfigProperty(_,d)}setConfigProperty(_,d,m){return this.style.setConfigProperty(_,d,m),this._update(!0)}getFeaturesetDescriptors(_){return this.style.getFeaturesetDescriptors(_)}setLights(_){if(this._lazyInitEmptyStyle(),_&&_.length===1&&_[0].type==="flat"){const d=_[0];d.properties?this.style.setFlatLight(d.properties,d.id,{}):this.style.setFlatLight({},"flat")}else this.style.setLights(_),this.painter.terrain&&(this.painter.terrain.invalidateRenderCache=!0);return this._update(!0)}getLights(){const _=this.style.getLights()||[];return _.length===0&&_.push({id:this.style.light.id,type:"flat",properties:this.style.getFlatLight()}),_}setLight(_,d={}){return console.log("The `map.setLight` function is deprecated, prefer using `map.setLights` with `flat` light type instead."),this.setLights([{id:"flat",type:"flat",properties:_}])}getLight(){return console.log("The `map.getLight` function is deprecated, prefer using `map.getLights` instead."),this.style.getFlatLight()}setTerrain(_){return this._lazyInitEmptyStyle(),!_&&this.transform.projection.requiresDraping?this.style.setTerrainForDraping():this.style.setTerrain(_),this._averageElevationLastSampledAt=-1/0,this._update(!0)}getTerrain(){return this.style?this.style.getTerrain():null}setFog(_){return this._lazyInitEmptyStyle(),this.style.setFog(_),this._update(!0)}getFog(){return this.style?this.style.getFog():null}setSnow(_){return this._lazyInitEmptyStyle(),this.style.setSnow(_),this._update(!0)}getSnow(){return this.style?this.style.getSnow():null}setRain(_){return this._lazyInitEmptyStyle(),this.style.setRain(_),this._update(!0)}getRain(){return this.style?this.style.getRain():null}setColorTheme(_){return this._lazyInitEmptyStyle(),this.style.setColorTheme(_),this._update(!0)}setImportColorTheme(_,d){return this._lazyInitEmptyStyle(),this.style.setImportColorTheme(_,d),this._update(!0)}setCamera(_){return this.style.setCamera(_),this._triggerCameraUpdate(_)}_triggerCameraUpdate(_){return this._update(this.transform.setOrthographicProjectionAtLowPitch(_["camera-projection"]==="orthographic"))}getCamera(){return this.style.camera}_queryFogOpacity(_){return this.style&&this.style.fog?this.style.fog.getOpacityAtLatLng(i.aT.convert(_),this.transform):0}setFeatureState(_,d){return _.source&&!this._isValidId(_.source)?this:(this.style.setFeatureState(_,d),this._update())}removeFeatureState(_,d){return _.source&&!this._isValidId(_.source)?this:(this.style.removeFeatureState(_,d),this._update())}getFeatureState(_){return _.source&&!this._isValidId(_.source)?null:this.style.getFeatureState(_)}_selectIndoorFloor(_){this.indoor.selectFloor(_)}_setIndoorActiveFloorsVisibility(_){this.indoor.setActiveFloorsVisibility(_)}_addIndoorControl(){this._indoorControl||(this._indoorControl=new Hy),this.addControl(this._indoorControl,"right")}_removeIndoorControl(){this._indoorControl&&this.removeControl(this._indoorControl)}_updateContainerDimensions(){if(!this._container)return;const _=this._container.getBoundingClientRect().width||400,d=this._container.getBoundingClientRect().height||300;let m,w,M,O=this._container;for(;O&&(!w||!M);){const D=window.getComputedStyle(O).transform;D&&D!=="none"&&(m=D.match(/matrix.*\((.+)\)/)[1].split(", "),m[0]&&m[0]!=="0"&&m[0]!=="1"&&(w=m[0]),m[3]&&m[3]!=="0"&&m[3]!=="1"&&(M=m[3])),O=O.parentElement}this._containerWidth=w?Math.abs(_/w):_,this._containerHeight=M?Math.abs(d/M):d}_detectMissingCSS(){window.getComputedStyle(this._missingCSSCanary).getPropertyValue("background-color")!=="rgb(250, 128, 114)"&&i.w("This page appears to be missing CSS declarations for Mapbox GL JS, which may cause the map to display incorrectly. Please ensure your page includes mapbox-gl.css, as described in https://www.mapbox.com/mapbox-gl-js/api/.")}_setupIndoor(){this.style.isIndoorEnabled()&&(this.indoor=new QI(this.style),this.on("load",()=>{this._addIndoorControl(),this.indoor._updateUI(this.transform.zoom,this.transform.center,this.transform.getBounds()),this.on("move",()=>{this.indoor._updateUI(this.transform.zoom,this.transform.center,this.transform.getBounds())}),this.on("idle",()=>{this.indoor._updateUI(this.transform.zoom,this.transform.center,this.transform.getBounds())})}))}_setupContainer(){const _=this._container;_.classList.add("mapboxgl-map"),(this._missingCSSCanary=N("div","mapboxgl-canary",_)).style.visibility="hidden",this._detectMissingCSS();const d=this._canvasContainer=N("div","mapboxgl-canvas-container",_);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",_),w=this._controlPositions={};["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"].forEach(M=>{w[M]=N("div",`mapboxgl-ctrl-${M}`,m)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(_,d){const m=i.o.devicePixelRatio||1;this._canvas.width=m*Math.ceil(_),this._canvas.height=m*Math.ceil(d),this._canvas.style.width=`${_}px`,this._canvas.style.height=`${d}px`}_addMarker(_){this._markers.push(_)}_removeMarker(_){const d=this._markers.indexOf(_);d!==-1&&this._markers.splice(d,1)}_addPopup(_){this._popups.push(_)}_removePopup(_){const d=this._popups.indexOf(_);d!==-1&&this._popups.splice(d,1)}_setupPainter(){const _=Object.assign({},C.supported.webGLContextAttributes,{failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1}),d=this._canvas.getContext("webgl2",_);d?(at(d,!0),this.painter=new hN(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(_){_.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new i.z("webglcontextlost",{originalEvent:_}))}_contextRestored(_){this._setupPainter(),this.painter.resize(Math.ceil(this._containerWidth),Math.ceil(this._containerHeight)),this._updateTerrain(),this.style&&(this.style.clearLayers(),this.style.imageManager.destroyAtlasTextures(),this.style.reloadModels(),this.style.clearSources()),this._update(),this.fire(new i.z("webglcontextrestored",{originalEvent:_}))}_onMapScroll(_){if(_.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1}idle(){return!this.isMoving()&&this.loaded()}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}frameReady(){return this.loaded()&&!this._placementDirty}_update(_){return this.style?(this._styleDirty=this._styleDirty||_,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(_){return this._update(),this._renderTaskQueue.add(_)}_cancelRenderFrame(_){this._renderTaskQueue.remove(_)}_requestDomTask(_){!this.loaded()||this.loaded()&&!this.isMoving()?_():this._domRenderTaskQueue.add(_)}_render(_){let d;this.fire(new i.z("renderstart")),++this._frameId;const m=this.painter.context.extTimerQuery,w=i.o.now(),M=this.painter.context.gl;if(this.listens("gpu-timing-frame")&&(d=M.createQuery(),M.beginQuery(m.TIME_ELAPSED_EXT,d)),this.painter.context.setDirty(),this.painter.setBaseState(),(this.isMoving()||this.isRotating()||this.isZooming())&&(this._interactionRange[0]=Math.min(this._interactionRange[0],performance.now()),this._interactionRange[1]=Math.max(this._interactionRange[1],performance.now())),this._renderTaskQueue.run(_),this._domRenderTaskQueue.run(_),this._removed)return;this._updateProjectionTransition();const O=this._isInitialLoad?0:this._fadeDuration;if(this.style&&this._styleDirty){this._styleDirty=!1;const Y=this.transform.zoom,Q=this.transform.pitch,ce=i.o.now(),oe=new i.ac(Y,{now:ce,fadeDuration:O,pitch:Q,transition:this.style.transition,worldview:this._worldview});this.style.update(oe)}this.style&&this.style.hasFogTransition()&&(this.style._markersNeedUpdate=!0,this._sourcesDirty=!0);let D=!1;this.style&&this._sourcesDirty?(this._sourcesDirty=!1,this.painter._updateFog(this.style),this._updateTerrain(),D=this._updateAverageElevation(w),this.style.updateSources(this.transform),this.style.updateImageProviders(),this.isMoving()||this._forceMarkerAndPopupUpdate()):D=this._updateAverageElevation(w);const B=this.style&&this.style._updatePlacement(this.painter,this.painter.transform,this.showCollisionBoxes,O,this._crossSourceCollisions,this.painter.replacementSource,this._scaleFactorChanged);if(this._scaleFactorChanged&&(this._scaleFactorChanged=!1),B&&(this._placementDirty=B.needsRerender),this.style&&this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showParseStatus:this.showParseStatus,wireframe:{terrain:this.showTerrainWireframe,layers2D:this.showLayers2DWireframe,layers3D:this.showLayers3DWireframe},showOverdrawInspector:this._showOverdrawInspector,showQueryGeometry:!!this._showQueryGeometry,showTileAABBs:this.showTileAABBs,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:O,isInitialLoad:this._isInitialLoad,showPadding:this.showPadding,gpuTiming:!!this.listens("gpu-timing-layer"),gpuTimingDeferredRender:!!this.listens("gpu-timing-deferred-render"),speedIndexTiming:this.speedIndexTiming}),this.fire(new i.z("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,x.mark(p.load),this.fire(new i.z("load"))),this.style&&this.style.hasTransitions()&&(this._styleDirty=!0),this.style&&(this.style.snow||this.style.rain)&&(this._styleDirty=!0),this.style&&this.style.imageManager.hasPatternsInFlight()&&(this._styleDirty=!0),this.style&&!this.style.modelManager.isLoaded()&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles(),d){const Y=i.o.now()-w;M.endQuery(m.TIME_ELAPSED_EXT),setTimeout(()=>{const Q=M.getQueryParameter(d,M.QUERY_RESULT)/1e6;M.deleteQuery(d),this.fire(new i.z("gpu-timing-frame",{cpuTime:Y,gpuTime:Q}))},50)}if(this.listens("gpu-timing-layer")){const Y=this.painter.collectGpuTimers();setTimeout(()=>{const Q=this.painter.queryGpuTimers(Y);this.fire(new i.z("gpu-timing-layer",{layerTimes:Q}))},50)}if(this.listens("gpu-timing-deferred-render")){const Y=this.painter.collectDeferredRenderGpuQueries();setTimeout(()=>{const Q=this.painter.queryGpuTimeDeferredRender(Y);this.fire(new i.z("gpu-timing-deferred-render",{gpuTime:Q}))},50)}const V=this._sourcesDirty||this._styleDirty||this._placementDirty||D;if(V||this._repaint)this.triggerRepaint();else{const Y=this.idle();if(Y&&(D=this._updateAverageElevation(w,!0)),D)this.triggerRepaint();else if(this._triggerFrame(!1),Y&&(this.fire(new i.z("idle")),this._isInitialLoad=!1,this.speedIndexTiming)){const Q=this._calculateSpeedIndex();this.fire(new i.z("speedindexcompleted",{speedIndex:Q})),this.speedIndexTiming=!1}}!this._loaded||this._fullyLoaded||V||(this._fullyLoaded=!0,x.mark(p.fullLoad),this._performanceMetricsCollection&&Ze(this._requestManager._customAccessToken,{width:this.painter.width,height:this.painter.height,interactionRange:this._interactionRange,visibilityHidden:this._visibilityHidden,terrainEnabled:!!this.painter.style.getTerrain(),fogEnabled:!!this.painter.style.getFog(),projection:this.getProjection().name,zoom:this.transform.zoom,renderer:this.painter.context.renderer,vendor:this.painter.context.vendor}),this._authenticate())}_forceMarkerAndPopupUpdate(_){for(const d of this._markers)_&&!this.getRenderWorldCopies()&&(d._lngLat=d._lngLat.wrap()),d._update();for(const d of this._popups)!_||this.getRenderWorldCopies()||d._trackPointer||(d._lngLat=d._lngLat.wrap()),d._update()}_updateAverageElevation(_,d=!1){const m=M=>(this.transform.averageElevation=M,this._update(!1),!0);if(!this.painter.averageElevationNeedsEasing())return this.transform.averageElevation!==0&&m(0);const w=this.transform.elevation&&this.transform.elevation.exaggeration()!==this._averageElevationExaggeration;if(w||(d||_-this._averageElevationLastSampledAt>500)&&!this._averageElevation.isEasing(_)){const M=this.transform.averageElevation;let O=this.transform.sampleAverageElevation();this.transform.elevation!=null&&(this._averageElevationExaggeration=this.transform.elevation.exaggeration()),isNaN(O)?O=0:this._averageElevationLastSampledAt=_;const D=Math.abs(M-O);if(D>1){if(this._isInitialLoad||w)return this._averageElevation.jumpTo(O),m(O);this._averageElevation.easeTo(O,_,300)}else if(D>1e-4)return this._averageElevation.jumpTo(O),m(O)}return!!this._averageElevation.isEasing(_)&&m(this._averageElevation.getValue(_))}_authenticate(){yt(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,_=>{if(_&&(_.message===ye||_.status===401)){const d=this.painter.context.gl;at(d,!1),this._logoControl instanceof Hv&&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/")))}}),Ne(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,()=>{})}_postStyleLoadEvent(){this.style.globalId&&Ee(this._requestManager._customAccessToken,{map:this,style:this.style.globalId,importedStyles:this.style.getImportGlobalIds()})}_postStyleWithAppearanceEvent(){this.style.globalId&&this.style.hasAppearances()&&Re(this._requestManager._customAccessToken)}_postAddingAppearancesToStyleEvent(){et(this._requestManager._customAccessToken)}_updateTerrain(){const _=this._isDragging();this.painter.updateTerrain(this.style,_)}_calculateSpeedIndex(){const _=this.painter.canvasCopy(),d=this.painter.getCanvasCopiesAndTimestamps();d.timeStamps.push(performance.now());const m=this.painter.context.gl,w=m.createFramebuffer();function M(O){m.framebufferTexture2D(m.FRAMEBUFFER,m.COLOR_ATTACHMENT0,m.TEXTURE_2D,O,0);const D=new Uint8Array(m.drawingBufferWidth*m.drawingBufferHeight*4);return m.readPixels(0,0,m.drawingBufferWidth,m.drawingBufferHeight,m.RGBA,m.UNSIGNED_BYTE,D),D}return m.bindFramebuffer(m.FRAMEBUFFER,w),this._canvasPixelComparison(M(_),d.canvasCopies.map(M),d.timeStamps)}_canvasPixelComparison(_,d,m){let w=m[1]-m[0];const M=_.length/4;for(let O=0;O{const m=!!this._renderNextFrame;this._frame=null,this._renderNextFrame=null,m&&this._render(d)}))}_preloadTiles(_){const d=this.style?this.style.getSourceCaches():[];return i.bw(d,(m,w)=>m._preloadTiles(_,w),()=>{this.triggerRepaint()}),this}_onWindowOnline(){this._update()}_onWindowResize(_){this._trackResize&&this.resize({originalEvent:_})._update()}_onVisibilityChange(){document.visibilityState==="hidden"&&this._visibilityHidden++}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(_){this._showTileBoundaries!==_&&(this._showTileBoundaries=_,this._update())}get showParseStatus(){return!!this._showParseStatus}set showParseStatus(_){this._showParseStatus!==_&&(this._showParseStatus=_,this._update())}get showTerrainWireframe(){return!!this._showTerrainWireframe}set showTerrainWireframe(_){this._showTerrainWireframe!==_&&(this._showTerrainWireframe=_,this._update())}get showLayers2DWireframe(){return!!this._showLayers2DWireframe}set showLayers2DWireframe(_){this._showLayers2DWireframe!==_&&(this._showLayers2DWireframe=_,this._update())}get showLayers3DWireframe(){return!!this._showLayers3DWireframe}set showLayers3DWireframe(_){this._showLayers3DWireframe!==_&&(this._showLayers3DWireframe=_,this._update())}get speedIndexTiming(){return!!this._speedIndexTiming}set speedIndexTiming(_){this._speedIndexTiming!==_&&(this._speedIndexTiming=_,this._update())}get showPadding(){return!!this._showPadding}set showPadding(_){this._showPadding!==_&&(this._showPadding=_,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(_){this._showCollisionBoxes!==_&&(this._showCollisionBoxes=_,this.style&&_?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(_){this._showOverdrawInspector!==_&&(this._showOverdrawInspector=_,this._update())}get repaint(){return!!this._repaint}set repaint(_){this._repaint!==_&&(this._repaint=_,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(_){this._vertices=_,this._update()}get showTileAABBs(){return!!this._showTileAABBs}set showTileAABBs(_){this._showTileAABBs!==_&&(this._showTileAABBs=_,_&&this._update())}_setCacheLimits(_,d){i.f4(_,d)}get version(){return h}},NavigationControl:class{constructor(_={}){this.options=Object.assign({},xie,_),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 _=this._map;if(!_)return;const d=_.getZoom(),m=d===_.getMaxZoom(),w=d===_.getMinZoom();this._zoomInButton.disabled=m,this._zoomOutButton.disabled=w,this._zoomInButton.setAttribute("aria-disabled",m.toString()),this._zoomOutButton.setAttribute("aria-disabled",w.toString())}_rotateCompassArrow(){const _=this._map;if(!_)return;const d=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(_.transform.pitch*(Math.PI/180)),.5)}) rotateX(${_.transform.pitch}deg) rotateZ(${_.transform.angle*(180/Math.PI)}deg)`:`rotate(${_.transform.angle*(180/Math.PI)}deg)`;_._requestDomTask(()=>{this._compassIcon&&(this._compassIcon.style.transform=d)})}onAdd(_){return this._map=_,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),_.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&_.on("pitch",this._rotateCompassArrow),_.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new yie(_,this._compass,this.options.visualizePitch)),this._container}onRemove(){const _=this._map;_&&(this._container.remove(),this.options.showZoom&&_.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&_.off("pitch",this._rotateCompassArrow),_.off("rotate",this._rotateCompassArrow),this._handler&&this._handler.off(),this._handler=void 0),this._map=void 0)}_createButton(_,d){const m=N("button",_,this._container);return m.type="button",m.addEventListener("click",d),m}_setButtonTitle(_,d){if(!this._map)return;const m=this._map._getUIString(`NavigationControl.${d}`);_.setAttribute("aria-label",m),_.firstElementChild&&_.firstElementChild.setAttribute("title",m)}},GeolocateControl:class extends i.E{constructor(_={}){super();const d=navigator.geolocation;this.options=Object.assign({geolocation:d},vie,_),i.aY(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker","_updateMarkerRotation","_onDeviceOrientation"],this),this._updateMarkerRotationThrottled=fN(this._updateMarkerRotation,20),this._numberOfWatches=0}onAdd(_){return this._map=_,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(_){const d=(m=!!this.options.geolocation)=>{this._supportsGeolocation=m,_(m)};this._supportsGeolocation!==void 0?_(this._supportsGeolocation):navigator.permissions!==void 0?navigator.permissions.query({name:"geolocation"}).then(m=>d(m.state!=="denied")).catch(()=>d()):d()}_isOutOfMapMaxBounds(_){const d=this._map.getMaxBounds(),m=_.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(_){if(this._map){if(this._isOutOfMapMaxBounds(_))return this._setErrorState(),this.fire(new i.z("outofmaxbounds",_)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=_,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-background")}this.options.showUserLocation&&this._watchState!=="OFF"&&this._updateMarker(_),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(_),this.options.showUserLocation&&this._userLocationDotMarker.removeClassName("mapboxgl-user-location-dot-stale"),this.fire(new i.z("geolocate",Object.assign({coords:_.coords,timestamp:_.timestamp},_.toJSON?{toJSON:_.toJSON.bind(_)}:{}))),this._finish()}}_updateCamera(_){const d=new i.aT(_.coords.longitude,_.coords.latitude),m=_.coords.accuracy,w=this._map.getBearing(),M=Object.assign({bearing:w},this.options.fitBoundsOptions);this._map.fitBounds(d.toBounds(m),M,{geolocateSource:!0})}_updateMarker(_){if(_){const d=new i.aT(_.coords.longitude,_.coords.latitude);this._accuracyCircleMarker.setLngLat(d).addTo(this._map),this._userLocationDotMarker.setLngLat(d).addTo(this._map),this._accuracy=_.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()}_updateCircleRadius(){const _=this._map.transform,d=i.cf(1,_._center.lat)*_.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(_){if(this._map){if(this.options.trackUserLocation)if(_.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const d=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.setAttribute("aria-label",d),this._geolocateButton.firstElementChild&&this._geolocateButton.firstElementChild.setAttribute("title",d),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(_.code===3&&this._noTimeout)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._userLocationDotMarker.addClassName("mapboxgl-user-location-dot-stale"),this.fire(new i.z("error",_)),this._finish()}}_finish(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0}_setupUI(_){if(this._map!==void 0){if(this._container.addEventListener("contextmenu",d=>d.preventDefault()),this._geolocateButton=N("button","mapboxgl-ctrl-geolocate",this._container),N("span","mapboxgl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",_===!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 SN({element:this._dotElement,rotationAlignment:"map",pitchAlignment:"map"}),this._circleElement=N("div","mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new SN({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(_){this._userLocationDotMarker&&(_.webkitCompassHeading?this._heading=_.webkitCompassHeading:_.absolute===!0&&(this._heading=-1*_.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 _;this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),this._numberOfWatches++,this._numberOfWatches>1?(_={maximumAge:6e5,timeout:0},this._noTimeout=!0):(_=this.options.positionOptions,this._noTimeout=!1),this._geolocationWatchID=this.options.geolocation.watchPosition(this._onSuccess,this._onError,_),this.options.showUserHeading&&this._addDeviceOrientationListener()}}else this.options.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=window.setTimeout(this._finish,1e4);return!0}_addDeviceOrientationListener(){const _=()=>{"ondeviceorientationabsolute"in window?window.addEventListener("deviceorientationabsolute",this._onDeviceOrientation):window.addEventListener("deviceorientation",this._onDeviceOrientation)};typeof DeviceMotionEvent<"u"&&typeof DeviceMotionEvent.requestPermission=="function"?DeviceOrientationEvent.requestPermission().then(d=>{d==="granted"&&_()}).catch(console.error):_()}_clearWatch(){this.options.geolocation.clearWatch(this._geolocationWatchID),window.removeEventListener("deviceorientation",this._onDeviceOrientation),window.removeEventListener("deviceorientationabsolute",this._onDeviceOrientation),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},AttributionControl:Vv,ScaleControl:class{constructor(_={}){this.options=Object.assign({},Wy,_),i.aY(["_update","_setScale","setUnit"],this)}getDefaultPosition(){return"bottom-left"}_update(){const _=this.options.maxWidth||100,d=this._map,m=d._containerHeight/2,w=d._containerWidth/2-_/2,M=d.unproject([w,m]),O=d.unproject([w+_,m]),D=M.distanceTo(O);if(this.options.unit==="imperial"){const B=3.2808*D;B>5280?this._setScale(_,B/5280,"mile"):this._setScale(_,B,"foot")}else this.options.unit==="nautical"?this._setScale(_,D/1852,"nautical-mile"):D>=1e3?this._setScale(_,D/1e3,"kilometer"):this._setScale(_,D,"meter")}_setScale(_,d,m){this._map._requestDomTask(()=>{const w=function(O){const D=Math.pow(10,`${Math.floor(O)}`.length-1);let B=O/D;return B=B>=10?10:B>=5?5:B>=3?3:B>=2?2:B>=1?1:function(V){const Y=Math.pow(10,Math.ceil(-Math.log(V)/Math.LN10));return Math.round(V*Y)/Y}(B),D*B}(d),M=w/d;this._container.innerHTML=m!=="nautical-mile"?new Intl.NumberFormat(this._language,{style:"unit",unitDisplay:"short",unit:m}).format(w):`${w} ${A5[m]}`,this._container.style.width=_*M+"px"})}onAdd(_){return this._map=_,this._language=_.getLanguage(),this._container=N("div","mapboxgl-ctrl mapboxgl-ctrl-scale",_.getContainer()),this._container.dir="auto",this._map.on("move",this._update),this._update(),this._container}onRemove(){this._container.remove(),this._map.off("move",this._update),this._map=void 0}_setLanguage(_){this._language=_,this._update()}setUnit(_){this.options.unit=_,this._update()}},FullscreenControl:class{constructor(_={}){this._fullscreen=!1,_&&_.container&&(_.container instanceof HTMLElement?this._container=_.container: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(_){return this._map=_,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 _=this._fullscreenButton=N("button","mapboxgl-ctrl-fullscreen",this._controlContainer);N("span","mapboxgl-ctrl-icon",_).setAttribute("aria-hidden","true"),_.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),document.addEventListener(this._fullscreenchange,this._changeIcon)}_updateTitle(){const _=this._getTitle();this._fullscreenButton.setAttribute("aria-label",_),this._fullscreenButton.firstElementChild&&this._fullscreenButton.firstElementChild.setAttribute("title",_)}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_changeIcon(){(document.fullscreenElement||document.webkitFullscreenElement)===this._container!==this._fullscreen&&(this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("mapboxgl-ctrl-shrink"),this._fullscreenButton.classList.toggle("mapboxgl-ctrl-fullscreen"),this._updateTitle())}_onClickFullscreen(){this._isFullscreen()?document.exitFullscreen?document.exitFullscreen():document.webkitCancelFullScreen&&document.webkitCancelFullScreen():this._container.requestFullscreen?this._container.requestFullscreen():this._container.webkitRequestFullscreen&&this._container.webkitRequestFullscreen()}},IndoorControl:Hy,Popup:class extends i.E{constructor(_){super(),this.options=Object.assign(Object.create(th),_),this._altitude=this.options.altitude,i.aY(["_update","_onClose","remove","_onMouseEvent"],this),this._classList=new Set(_&&_.className?_.className.trim().split(/\s+/):[])}addTo(_){return this._map&&this.remove(),this._map=_,this.options.closeOnClick&&_.on("preclick",this._onClose),this.options.closeOnMove&&_.on("move",this._onClose),_.on("remove",this.remove),this._update(),_._addPopup(this),this._focusFirstElement(),this._trackPointer?(_.on("mousemove",this._onMouseEvent),_.on("mouseup",this._onMouseEvent),_._canvasContainer.classList.add("mapboxgl-track-pointer")):_.on("move",this._update),this.fire(new i.z("open")),this}isOpen(){return!!this._map}remove(){this._content&&this._content.remove(),this._container&&(this._container.remove(),this._container=void 0);const _=this._map;return _&&(_.off("move",this._update),_.off("move",this._onClose),_.off("preclick",this._onClose),_.off("click",this._onClose),_.off("remove",this.remove),_.off("mousemove",this._onMouseEvent),_.off("mouseup",this._onMouseEvent),_.off("drag",this._onMouseEvent),_._canvasContainer&&_._canvasContainer.classList.remove("mapboxgl-track-pointer"),_._removePopup(this),this._map=void 0),this.fire(new i.z("close")),this}getLngLat(){return this._lngLat}setLngLat(_){this._lngLat=i.aT.convert(_),this._pos=null,this._trackPointer=!1,this._update();const d=this._map;return d&&(d.on("move",this._update),d.off("mousemove",this._onMouseEvent),d._canvasContainer.classList.remove("mapboxgl-track-pointer")),this}getAltitude(){return this._altitude}setAltitude(_){return this._altitude=_,this._update(),this}trackPointer(){this._trackPointer=!0,this._pos=null,this._update();const _=this._map;return _&&(_.off("move",this._update),_.on("mousemove",this._onMouseEvent),_.on("drag",this._onMouseEvent),_._canvasContainer.classList.add("mapboxgl-track-pointer")),this}getElement(){return this._container}setText(_){return this.setDOMContent(document.createTextNode(_))}setHTML(_){const d=document.createDocumentFragment(),m=document.createElement("body");let w;for(m.innerHTML=_;w=m.firstChild,w;)d.appendChild(w);return this.setDOMContent(d)}getMaxWidth(){return this._container&&this._container.style.maxWidth}setMaxWidth(_){return this.options.maxWidth=_,this._update(),this}setDOMContent(_){let d=this._content;if(d)for(;d.hasChildNodes();)d.firstChild&&d.removeChild(d.firstChild);else d=this._content=N("div","mapboxgl-popup-content",this._container||void 0);if(d.appendChild(_),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(_){return this._classList.add(_),this._updateClassList(),this}removeClassName(_){return this._classList.delete(_),this._updateClassList(),this}setOffset(_){return this.options.offset=_,this._update(),this}toggleClassName(_){let d;return this._classList.delete(_)?d=!1:(this._classList.add(_),d=!0),this._updateClassList(),d}_onMouseEvent(_){this._update(_.point)}_getAnchor(_){if(this.options.anchor)return this.options.anchor;const d=this._map,m=this._container,w=this._pos;if(!d||!m||!w)return"bottom";const M=m.offsetWidth,O=m.offsetHeight,D=w.xd.transform.width-M/2;if(w.y+_d.transform.height-O){if(D)return"bottom-left";if(B)return"bottom-right"}return D?"left":B?"right":"bottom"}_updateClassList(){const _=this._container;if(!_)return;const d=[...this._classList];d.push("mapboxgl-popup"),this._anchor&&d.push(`mapboxgl-popup-anchor-${this._anchor}`),this._trackPointer&&d.push("mapboxgl-popup-track-pointer"),_.className=d.join(" ")}_update(_){const d=this._map,m=this._content;if(!d||!this._lngLat&&!this._trackPointer||!m)return;let w=this._container;if(w||(w=this._container=N("div","mapboxgl-popup",d.getContainer()),this._tip=N("div","mapboxgl-popup-tip",w),w.appendChild(m)),this.options.maxWidth&&w.style.maxWidth!==this.options.maxWidth&&(w.style.maxWidth=this.options.maxWidth),d.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=T5(this._lngLat,this._pos,d.transform)),!this._trackPointer||_){const M=this._pos=this._trackPointer&&_ instanceof i.P?_:d.project(this._lngLat,this._altitude),O=ix(this.options.offset),D=this._anchor=this._getAnchor(O.y),B=ix(this.options.offset,D),V=M.add(B).round();d._requestDomTask(()=>{this._container&&D&&(this._container.style.transform=`${vc[D]} translate(${V.x}px,${V.y}px)`)})}if(!this._marker&&d._showingGlobe()){const M=i.f5(d.transform,this._lngLat)?0:1;this._setOpacity(M)}this._updateClassList()}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const _=this._container.querySelector(rh);_&&_.focus()}_onClose(){this.remove()}_setOpacity(_){this._container&&(this._container.style.opacity=`${_}`),this._content&&(this._content.style.pointerEvents=_?"auto":"none")}},Marker:SN,Style:Ju,LngLat:i.aT,LngLatBounds:i.aI,Point:i.P,MercatorCoordinate:i.ae,FreeCameraOptions:ed,Evented:i.E,config:i.e,prewarm:i.f9,clearPrewarmedResources:i.f8,get accessToken(){return i.e.ACCESS_TOKEN},set accessToken(_){i.e.ACCESS_TOKEN=_},get baseApiUrl(){return i.e.API_URL},set baseApiUrl(_){i.e.API_URL=_},get workerCount(){return i.fi.workerCount},set workerCount(_){i.fi.workerCount=_},get maxParallelImageRequests(){return i.e.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(_){i.e.MAX_PARALLEL_IMAGE_REQUESTS=_},clearStorage(_){i.fh(_)},get workerUrl(){return i.fg.workerUrl},set workerUrl(_){i.fg.workerUrl=_},get workerClass(){return i.fg.workerClass},set workerClass(_){i.fg.workerClass=_},get workerParams(){return i.fg.workerParams},set workerParams(_){i.fg.workerParams=_},get dracoUrl(){return i.ff()},set dracoUrl(_){i.fe(_)},get meshoptUrl(){return i.fd()},set meshoptUrl(_){i.fc(_)},setNow:i.o.setNow,restoreNow:i.o.restoreNow}});var l=a;return l})})(kze);var nkt=kze.exports;const zL=Hi(nkt);function skt(){const t=rs(),{isAdmin:e}=Qr(),n=I.useRef(null),s=I.useRef(null),a=I.useRef([]),o=vze(),{data:l}=xze(),i=bze(),[h,p]=I.useState(""),[x,y]=I.useState(""),[b,j]=I.useState(!0),[C,N]=I.useState(null),[A,E]=I.useState(null),[T,L]=I.useState(!1),[z,F]=I.useState({popby_item_id:"",notes:""}),q=o.filter(te=>te.address||te.city&&te.state);I.useEffect(()=>{(async()=>{j(!0);try{const{data:ie}=await J.from("settings").select("value").eq("key","mapbox_public_token").maybeSingle();ie!=null&&ie.value&&p(ie.value)}catch(ie){console.error("Error fetching mapbox token:",ie)}j(!1)})()},[]),I.useEffect(()=>{"geolocation"in navigator&&navigator.geolocation.getCurrentPosition(te=>{N([te.coords.longitude,te.coords.latitude])},te=>{console.log("Could not get location:",te)})},[]),I.useEffect(()=>{if(!(!n.current||!h||s.current))return zL.accessToken=h,s.current=new zL.Map({container:n.current,style:"mapbox://styles/mapbox/streets-v12",zoom:C?12:4,center:C||[-98.5795,39.8283]}),s.current.addControl(new zL.NavigationControl,"top-right"),()=>{var te;(te=s.current)==null||te.remove(),s.current=null}},[h,C]),I.useEffect(()=>{!s.current||!h||(a.current.forEach(te=>te.remove()),a.current=[],q.forEach(async te=>{var le;const ie=[te.address,te.city,te.state,te.zip].filter(Boolean).join(", ");if(ie)try{const ne=await(await fetch(`https://api.mapbox.com/geocoding/v5/mapbox.places/${encodeURIComponent(ie)}.json?access_token=${h}`)).json();if(ne.features&&ne.features.length>0){const[ge,ae]=ne.features[0].center,he=document.createElement("div");he.className="cursor-pointer",he.innerHTML=`
${te.first_name[0]}${((le=te.last_name)==null?void 0:le[0])||""}
${te.isDue?'
':""}
`;const ue=new zL.Marker(he).setLngLat([ge,ae]).addTo(s.current);he.addEventListener("click",()=>{E(te)}),a.current.push(ue)}}catch(ye){console.error("Geocoding error for",te.first_name,ye)}}))},[q,h]);const H=()=>{C&&s.current?s.current.flyTo({center:C,zoom:13}):ma({title:"Location not available",description:"Please enable location services",variant:"destructive"})},Z=async()=>{A&&(await i.mutateAsync({contact_id:A.id,popby_item_id:z.popby_item_id||void 0,notes:z.notes||void 0,latitude:C==null?void 0:C[1],longitude:C==null?void 0:C[0]}),L(!1),E(null),F({popby_item_id:"",notes:""}))},G=async()=>{if(x.trim())try{await J.from("settings").upsert({key:"mapbox_public_token",value:x.trim()}),p(x.trim()),ma({title:"Mapbox token saved!"})}catch{ma({title:"Error saving token",variant:"destructive"})}};return b?r.jsx(Lr,{title:"Popby Map",children:r.jsx("div",{className:"flex items-center justify-center h-[60vh]",children:r.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary"})})}):h?r.jsx(Lr,{title:"Popby Map",children:r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs(ee,{variant:"ghost",onClick:()=>t("/mission-control/popbys"),children:[r.jsx(so,{className:"h-4 w-4 mr-2"}),"Back to Popbys"]}),r.jsxs(ee,{onClick:H,children:[r.jsx(PT,{className:"h-4 w-4 mr-2"}),"My Location"]})]}),r.jsxs("div",{className:"flex gap-4 text-sm",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:"w-4 h-4 rounded-full bg-primary"}),r.jsx("span",{children:"Up to date"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:"w-4 h-4 rounded-full bg-amber-500"}),r.jsx("span",{children:"Due for popby"})]})]}),r.jsxs("div",{className:"relative",children:[r.jsx("div",{ref:n,className:"w-full h-[60vh] rounded-lg shadow-lg"}),q.length===0&&r.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-background/80 rounded-lg",children:r.jsxs("div",{className:"text-center p-6",children:[r.jsx(Il,{className:"h-12 w-12 mx-auto text-muted-foreground mb-2"}),r.jsx("p",{className:"font-medium",children:"No contacts with addresses"}),r.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Add addresses to your contacts to see them on the map."})]})})]}),A&&r.jsx(Ye,{className:"fixed bottom-4 left-4 right-4 md:left-auto md:right-4 md:w-96 z-50 shadow-xl",children:r.jsxs(tt,{className:"p-4",children:[r.jsxs("div",{className:"flex items-start justify-between mb-3",children:[r.jsxs("div",{children:[r.jsxs("h3",{className:"font-semibold",children:[A.first_name," ",A.last_name]}),A.address&&r.jsxs("p",{className:"text-sm text-muted-foreground",children:[A.city,", ",A.state]})]}),r.jsx(ee,{size:"sm",variant:"ghost",onClick:()=>E(null),children:"×"})]}),r.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[A.isDue?r.jsxs(Ot,{variant:"destructive",children:[A.daysOverdue,"+ days overdue"]}):r.jsx(Ot,{variant:"secondary",children:"Up to date"}),A.lastPopby&&r.jsxs("span",{className:"text-xs text-muted-foreground",children:["Last: ",yn(new Date(A.lastPopby),"MMM d")]})]}),r.jsxs("div",{className:"flex gap-2",children:[A.phone&&r.jsx(ee,{size:"sm",variant:"outline",asChild:!0,className:"flex-1",children:r.jsxs("a",{href:`tel:${A.phone}`,children:[r.jsx(bi,{className:"h-4 w-4 mr-1"}),"Call"]})}),A.address&&r.jsxs(ee,{size:"sm",variant:"outline",className:"flex-1",onClick:()=>{const te=[A.address,A.city,A.state,A.zip].filter(Boolean).join(", ");window.open(`https://maps.google.com/maps?daddr=${encodeURIComponent(te)}`,"_blank")},children:[r.jsx(zT,{className:"h-4 w-4 mr-1"}),"Navigate"]}),r.jsxs(ee,{size:"sm",className:"flex-1",onClick:()=>L(!0),children:[r.jsx(Ki,{className:"h-4 w-4 mr-1"}),"Log Popby"]})]})]})}),r.jsx(Fr,{open:T,onOpenChange:L,children:r.jsxs(Rr,{children:[r.jsx(qr,{children:r.jsxs($r,{children:["Log Popby for ",A==null?void 0:A.first_name," ",A==null?void 0:A.last_name]})}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Popby Item (optional)"}),r.jsxs(gn,{value:z.popby_item_id,onValueChange:te=>F(ie=>({...ie,popby_item_id:te})),children:[r.jsx(fn,{children:r.jsx(xn,{placeholder:"Select a popby item..."})}),r.jsx(pn,{children:l==null?void 0:l.map(te=>r.jsx(Vt,{value:te.id,children:te.name},te.id))})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Notes (optional)"}),r.jsx(ps,{placeholder:"Any notes about this popby...",value:z.notes,onChange:te=>F(ie=>({...ie,notes:te.target.value}))})]}),C&&r.jsxs("p",{className:"text-xs text-muted-foreground flex items-center gap-1",children:[r.jsx(fl,{className:"h-3 w-3"}),"Your current location will be recorded"]})]}),r.jsxs(ea,{children:[r.jsx(ee,{variant:"outline",onClick:()=>L(!1),children:"Cancel"}),r.jsxs(ee,{onClick:Z,disabled:i.isPending,children:[r.jsx(Yi,{className:"h-4 w-4 mr-1"}),"Log Popby"]})]})]})})]})}):e?r.jsx(Lr,{title:"Popby Map",children:r.jsx("div",{className:"max-w-md mx-auto mt-8",children:r.jsx(Ye,{children:r.jsxs(tt,{className:"p-6 space-y-4",children:[r.jsxs("div",{className:"text-center mb-4",children:[r.jsx(fl,{className:"h-12 w-12 mx-auto text-muted-foreground mb-2"}),r.jsx("h2",{className:"text-lg font-semibold",children:"Setup Map"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Enter your Mapbox public token to enable the map feature."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Mapbox Public Token"}),r.jsx(dt,{placeholder:"pk.eyJ1I...",value:x,onChange:te=>y(te.target.value)}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Get your token at"," ",r.jsx("a",{href:"https://mapbox.com/",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"mapbox.com"})]})]}),r.jsx(ee,{onClick:G,className:"w-full",children:"Save Token"}),r.jsxs(ee,{variant:"outline",className:"w-full",onClick:()=>t("/mission-control/popbys"),children:[r.jsx(so,{className:"h-4 w-4 mr-2"}),"Back to Popbys"]})]})})})}):r.jsx(Lr,{title:"Popby Map",children:r.jsx("div",{className:"max-w-md mx-auto mt-8",children:r.jsx(Ye,{children:r.jsxs(tt,{className:"p-6 space-y-4",children:[r.jsxs("div",{className:"text-center",children:[r.jsx(Il,{className:"h-12 w-12 mx-auto text-muted-foreground mb-2"}),r.jsx("h2",{className:"text-lg font-semibold",children:"Map Not Available"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"The map feature has not been configured yet. Please contact your administrator."})]}),r.jsxs(ee,{variant:"outline",className:"w-full",onClick:()=>t("/mission-control/popbys"),children:[r.jsx(so,{className:"h-4 w-4 mr-2"}),"Back to Popbys"]})]})})})})}const akt=c3({property_address:ic().min(1,"Property address is required"),city:ic().optional(),state:ic().optional(),zip:ic().optional(),transaction_type:yLe(["buyer","seller"]),close_date:ic().min(1,"Close date is required"),sale_price:iA().min(0,"Sale price must be positive"),commission_amount:iA().optional(),lead_source_id:ic().optional(),client_type_id:ic().optional(),contact_id:ic().optional(),notes:ic().optional(),is_win:qot()});function Sze({open:t,onOpenChange:e,transaction:n}){const[s,a]=I.useState(!1),[o,l]=I.useState(""),[i,h]=I.useState(!1),[p,x]=I.useState(""),y=_se(),b=Yft(),{data:j}=vse(),{data:C}=Sm(),{data:N}=op(),A=gxe(),E=Zft(),{data:T}=bse(),L=(T==null?void 0:T.show_commission)??!0,z=ose({resolver:lse(akt),defaultValues:{property_address:"",city:"",state:"",zip:"",transaction_type:"buyer",close_date:new Date().toISOString().split("T")[0],sale_price:0,commission_amount:void 0,lead_source_id:void 0,client_type_id:void 0,contact_id:void 0,notes:"",is_win:!1}});I.useEffect(()=>{n?z.reset({property_address:n.property_address,city:n.city||"",state:n.state||"",zip:n.zip||"",transaction_type:n.transaction_type,close_date:n.close_date,sale_price:Number(n.sale_price),commission_amount:n.commission_amount?Number(n.commission_amount):void 0,lead_source_id:n.lead_source_id||void 0,client_type_id:n.client_type_id||void 0,contact_id:n.contact_id||void 0,notes:n.notes||"",is_win:n.is_win}):z.reset({property_address:"",city:"",state:"",zip:"",transaction_type:"buyer",close_date:new Date().toISOString().split("T")[0],sale_price:0,commission_amount:void 0,lead_source_id:void 0,client_type_id:void 0,contact_id:void 0,notes:"",is_win:!1})},[n,z]);const F=async G=>{const te={property_address:G.property_address,transaction_type:G.transaction_type,close_date:G.close_date,sale_price:G.sale_price,is_win:G.is_win,commission_amount:G.commission_amount||null,lead_source_id:G.lead_source_id||null,client_type_id:G.client_type_id||null,contact_id:G.contact_id||null,city:G.city||null,state:G.state||null,zip:G.zip||null,notes:G.notes||null};n?await b.mutateAsync({id:n.id,...te}):await y.mutateAsync(te),e(!1)},q=async()=>{if(!o.trim())return;const[G,...te]=o.trim().split(" "),ie=te.join(" ")||null,le=await A.mutateAsync({first_name:G,last_name:ie,tagIds:[]});le&&(z.setValue("contact_id",le.id),l(""),h(!1),a(!1))},H=async()=>{if(!p.trim())return;const G=await E.mutateAsync(p.trim());G&&(z.setValue("lead_source_id",G.id),x(""))},Z=N==null?void 0:N.find(G=>G.id===z.watch("contact_id"));return r.jsx(Fr,{open:t,onOpenChange:e,children:r.jsxs(Rr,{className:"max-w-lg max-h-[90vh]",children:[r.jsx(qr,{children:r.jsx($r,{children:n?"Edit Transaction":"Add Transaction"})}),r.jsx(Jo,{className:"max-h-[70vh] pr-4",children:r.jsx(cse,{...z,children:r.jsxs("form",{onSubmit:z.handleSubmit(F),className:"space-y-4",children:[r.jsx(Tl,{control:z.control,name:"property_address",render:({field:G})=>r.jsxs(bl,{children:[r.jsx(wl,{children:"Property Address *"}),r.jsx(jl,{children:r.jsx(dt,{placeholder:"123 Main St",...G})}),r.jsx(Eu,{})]})}),r.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[r.jsx(Tl,{control:z.control,name:"city",render:({field:G})=>r.jsxs(bl,{children:[r.jsx(wl,{children:"City"}),r.jsx(jl,{children:r.jsx(dt,{placeholder:"City",...G})})]})}),r.jsx(Tl,{control:z.control,name:"state",render:({field:G})=>r.jsxs(bl,{children:[r.jsx(wl,{children:"State"}),r.jsx(jl,{children:r.jsx(dt,{placeholder:"TX",...G})})]})}),r.jsx(Tl,{control:z.control,name:"zip",render:({field:G})=>r.jsxs(bl,{children:[r.jsx(wl,{children:"Zip"}),r.jsx(jl,{children:r.jsx(dt,{placeholder:"75001",...G})})]})})]}),r.jsx(Tl,{control:z.control,name:"transaction_type",render:({field:G})=>r.jsxs(bl,{children:[r.jsx(wl,{children:"Transaction Type *"}),r.jsxs(gn,{onValueChange:G.onChange,value:G.value,children:[r.jsx(jl,{children:r.jsx(fn,{children:r.jsx(xn,{placeholder:"Select type"})})}),r.jsxs(pn,{children:[r.jsx(Vt,{value:"buyer",children:"Buyer"}),r.jsx(Vt,{value:"seller",children:"Seller"})]})]}),r.jsx(Eu,{})]})}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsx(Tl,{control:z.control,name:"close_date",render:({field:G})=>r.jsxs(bl,{children:[r.jsx(wl,{children:"Close Date *"}),r.jsx(jl,{children:r.jsx(dt,{type:"date",...G})}),r.jsx(Eu,{})]})}),r.jsx(Tl,{control:z.control,name:"sale_price",render:({field:G})=>r.jsxs(bl,{children:[r.jsx(wl,{children:"Sale Price *"}),r.jsx(jl,{children:r.jsx(dt,{type:"number",placeholder:"0",...G,onChange:te=>G.onChange(Number(te.target.value))})}),r.jsx(Eu,{})]})})]}),L&&r.jsx(Tl,{control:z.control,name:"commission_amount",render:({field:G})=>r.jsxs(bl,{children:[r.jsx(wl,{children:"Commission"}),r.jsx(jl,{children:r.jsx(dt,{type:"number",placeholder:"0",...G,value:G.value??"",onChange:te=>G.onChange(te.target.value?Number(te.target.value):void 0)})})]})}),r.jsx(Tl,{control:z.control,name:"lead_source_id",render:({field:G})=>r.jsxs(bl,{children:[r.jsx(wl,{children:"Lead Source"}),r.jsxs(gn,{onValueChange:G.onChange,value:G.value||"",children:[r.jsx(jl,{children:r.jsx(fn,{children:r.jsx(xn,{placeholder:"Select source"})})}),r.jsx(pn,{children:j==null?void 0:j.map(te=>r.jsx(Vt,{value:te.id,children:te.name},te.id))})]})]})}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(dt,{placeholder:"Add custom source...",value:p,onChange:G=>x(G.target.value),className:"flex-1"}),r.jsx(ee,{type:"button",variant:"outline",size:"icon",onClick:H,disabled:!p.trim(),children:r.jsx(bn,{className:"h-4 w-4"})})]}),r.jsx(Tl,{control:z.control,name:"client_type_id",render:({field:G})=>r.jsxs(bl,{children:[r.jsx(wl,{children:"Client Type"}),r.jsxs(gn,{onValueChange:G.onChange,value:G.value||"",children:[r.jsx(jl,{children:r.jsx(fn,{children:r.jsx(xn,{placeholder:"Select client type"})})}),r.jsx(pn,{children:C==null?void 0:C.map(te=>r.jsx(Vt,{value:te.id,children:te.name},te.id))})]})]})}),r.jsx(Tl,{control:z.control,name:"contact_id",render:({field:G})=>r.jsxs(bl,{children:[r.jsx(wl,{children:"Client Contact"}),r.jsxs(zu,{open:s,onOpenChange:a,children:[r.jsx(Bu,{asChild:!0,children:r.jsx(jl,{children:r.jsxs(ee,{variant:"outline",role:"combobox",className:$t("w-full justify-between",!G.value&&"text-muted-foreground"),children:[Z?`${Z.first_name} ${Z.last_name||""}`.trim():"Select contact",r.jsx(d1,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})})}),r.jsxs(uu,{className:"w-full p-0",align:"start",children:[r.jsxs(q1,{children:[r.jsx(V1,{placeholder:"Search contacts..."}),r.jsxs(H1,{children:[r.jsx(W1,{children:r.jsxs("div",{className:"p-2 space-y-2",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"No contact found."}),!i&&r.jsxs(ee,{variant:"outline",size:"sm",className:"w-full",onClick:()=>h(!0),children:[r.jsx(bn,{className:"h-4 w-4 mr-2"}),"Add New Contact"]})]})}),r.jsx(G1,{children:N==null?void 0:N.map(te=>r.jsxs(K1,{value:`${te.first_name} ${te.last_name||""}`,onSelect:()=>{G.onChange(te.id),a(!1)},children:[r.jsx(Ai,{className:$t("mr-2 h-4 w-4",te.id===G.value?"opacity-100":"opacity-0")}),te.first_name," ",te.last_name||""]},te.id))})]})]}),i&&r.jsxs("div",{className:"p-2 border-t space-y-2",children:[r.jsx(dt,{placeholder:"Enter contact name...",value:o,onChange:te=>l(te.target.value)}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(ee,{size:"sm",onClick:q,disabled:!o.trim()||A.isPending,children:"Add Contact"}),r.jsx(ee,{size:"sm",variant:"outline",onClick:()=>{h(!1),l("")},children:"Cancel"})]})]})]})]})]})}),r.jsx(Tl,{control:z.control,name:"notes",render:({field:G})=>r.jsxs(bl,{children:[r.jsx(wl,{children:"Notes"}),r.jsx(jl,{children:r.jsx(ps,{placeholder:"Any notes about this transaction...",...G})})]})}),r.jsx(Tl,{control:z.control,name:"is_win",render:({field:G})=>r.jsxs(bl,{className:"flex items-center justify-between rounded-lg border p-3",children:[r.jsxs("div",{className:"space-y-0.5",children:[r.jsx(wl,{children:"Mark as Win 🏆"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Highlight this as a notable success"})]}),r.jsx(jl,{children:r.jsx(Ps,{checked:G.value,onCheckedChange:G.onChange})})]})}),r.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[r.jsx(ee,{type:"button",variant:"outline",onClick:()=>e(!1),children:"Cancel"}),r.jsxs(ee,{type:"submit",disabled:y.isPending||b.isPending,children:[n?"Update":"Add"," Transaction"]})]})]})})})]})})}function Cze({transactions:t,showCommission:e,isLoading:n}){const[s,a]=I.useState(null),[o,l]=I.useState(null),[i,h]=I.useState(""),[p,x]=I.useState("all"),[y,b]=I.useState("all"),[j,C]=I.useState("all"),[N,A]=I.useState(!1),E=Xft(),T=_se(),{data:L}=vse(),{data:z}=Sm(),F=f3(),q=G=>{const{id:te,created_at:ie,updated_at:le,lead_source:ye,client_type:ne,contact:ge,...ae}=G;T.mutate(ae)},H=()=>{o&&(E.mutate(o),l(null))},Z=t.filter(G=>{var ge,ae,he,ue;const te=i===""||G.property_address.toLowerCase().includes(i.toLowerCase())||((ae=(ge=G.contact)==null?void 0:ge.first_name)==null?void 0:ae.toLowerCase().includes(i.toLowerCase()))||((ue=(he=G.contact)==null?void 0:he.last_name)==null?void 0:ue.toLowerCase().includes(i.toLowerCase())),ie=p==="all"||G.transaction_type===p,le=y==="all"||G.lead_source_id===y,ye=j==="all"||G.client_type_id===j,ne=!N||G.is_win;return te&&ie&&le&&ye&&ne});return n?r.jsx(Ye,{children:r.jsx(tt,{className:"p-6 space-y-4",children:[1,2,3].map(G=>r.jsx(Ir,{className:"h-16 w-full"},G))})}):r.jsxs(r.Fragment,{children:[r.jsxs(Ye,{children:[r.jsx(Gt,{className:"pb-3",children:r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:[r.jsxs(Zt,{children:["Transactions (",Z.length,")"]}),r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsxs("div",{className:"relative",children:[r.jsx(wa,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),r.jsx(dt,{placeholder:"Search...",value:i,onChange:G=>h(G.target.value),className:"pl-8 w-[150px]"})]}),r.jsxs(gn,{value:p,onValueChange:x,children:[r.jsx(fn,{className:"w-[100px]",children:r.jsx(xn,{placeholder:"Type"})}),r.jsxs(pn,{children:[r.jsx(Vt,{value:"all",children:"All Types"}),r.jsx(Vt,{value:"buyer",children:"Buyer"}),r.jsx(Vt,{value:"seller",children:"Seller"})]})]}),r.jsxs(gn,{value:y,onValueChange:b,children:[r.jsx(fn,{className:"w-[130px]",children:r.jsx(xn,{placeholder:"Lead Source"})}),r.jsxs(pn,{children:[r.jsx(Vt,{value:"all",children:"All Sources"}),L==null?void 0:L.map(G=>r.jsx(Vt,{value:G.id,children:G.name},G.id))]})]}),r.jsxs(ee,{variant:N?"default":"outline",size:"sm",onClick:()=>A(!N),children:[r.jsx(Ol,{className:"h-4 w-4 mr-1"}),"Wins"]})]})]})}),r.jsx(tt,{children:Z.length===0?r.jsx("p",{className:"text-center text-muted-foreground py-8",children:"No transactions found"}):F?r.jsx("div",{className:"space-y-3",children:Z.map(G=>r.jsxs(Ye,{className:"p-4",children:[r.jsxs("div",{className:"flex items-start justify-between gap-2",children:[r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[r.jsx("span",{className:"font-medium truncate",children:G.property_address}),G.is_win&&r.jsx(Ol,{className:"h-4 w-4 text-yellow-500 flex-shrink-0"})]}),r.jsxs("div",{className:"text-sm text-muted-foreground",children:[G.city,G.state?`, ${G.state}`:""]})]}),r.jsx(Ot,{variant:G.transaction_type==="buyer"?"default":"secondary",children:G.transaction_type})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-2 mt-3 text-sm",children:[r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground",children:"Close Date: "}),Gbe(G.close_date)]}),r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground",children:"Price: "}),Ed(G.sale_price)]}),e&&G.commission_amount&&r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground",children:"Commission: "}),Ed(G.commission_amount)]}),G.lead_source&&r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground",children:"Source: "}),G.lead_source.name]}),G.contact&&r.jsxs("div",{className:"col-span-2",children:[r.jsx("span",{className:"text-muted-foreground",children:"Client: "}),G.contact.first_name," ",G.contact.last_name]})]}),r.jsxs("div",{className:"flex justify-end gap-2 mt-3 pt-3 border-t",children:[r.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>a(G),children:r.jsx(ac,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>q(G),children:r.jsx(hl,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>l(G.id),children:r.jsx(Vn,{className:"h-4 w-4 text-destructive"})})]})]},G.id))}):r.jsx("div",{className:"overflow-x-auto",children:r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Ar,{children:[r.jsx(It,{children:"Property"}),r.jsx(It,{children:"Type"}),r.jsx(It,{children:"Close Date"}),r.jsx(It,{children:"Sale Price"}),e&&r.jsx(It,{children:"Commission"}),r.jsx(It,{children:"Lead Source"}),r.jsx(It,{children:"Client"}),r.jsx(It,{className:"w-[50px]"})]})}),r.jsx(Vs,{children:Z.map(G=>{var te;return r.jsxs(Ar,{children:[r.jsx(Nt,{children:r.jsxs("div",{className:"flex items-center gap-2",children:[G.is_win&&r.jsx(Ol,{className:"h-4 w-4 text-yellow-500"}),r.jsxs("div",{children:[r.jsx("div",{className:"font-medium",children:G.property_address}),r.jsxs("div",{className:"text-sm text-muted-foreground",children:[G.city,G.state?`, ${G.state}`:""]})]})]})}),r.jsx(Nt,{children:r.jsx(Ot,{variant:G.transaction_type==="buyer"?"default":"secondary",children:G.transaction_type})}),r.jsx(Nt,{children:Gbe(G.close_date)}),r.jsx(Nt,{children:Ed(G.sale_price)}),e&&r.jsx(Nt,{children:G.commission_amount?Ed(G.commission_amount):"-"}),r.jsx(Nt,{children:((te=G.lead_source)==null?void 0:te.name)||"-"}),r.jsx(Nt,{children:G.contact?`${G.contact.first_name} ${G.contact.last_name||""}`.trim():"-"}),r.jsx(Nt,{children:r.jsxs(wh,{children:[r.jsx(jh,{asChild:!0,children:r.jsx(ee,{variant:"ghost",size:"icon",children:r.jsx(Sx,{className:"h-4 w-4"})})}),r.jsxs(Wu,{align:"end",children:[r.jsxs(di,{onClick:()=>a(G),children:[r.jsx(ac,{className:"h-4 w-4 mr-2"}),"Edit"]}),r.jsxs(di,{onClick:()=>q(G),children:[r.jsx(hl,{className:"h-4 w-4 mr-2"}),"Duplicate"]}),r.jsxs(di,{onClick:()=>l(G.id),className:"text-destructive",children:[r.jsx(Vn,{className:"h-4 w-4 mr-2"}),"Delete"]})]})]})})]},G.id)})})]})})})]}),r.jsx(Sze,{open:!!s,onOpenChange:G=>!G&&a(null),transaction:s||void 0}),r.jsx(Iu,{open:!!o,onOpenChange:G=>!G&&l(null),children:r.jsxs(tu,{children:[r.jsxs(ru,{children:[r.jsx(su,{children:"Delete Transaction?"}),r.jsx(au,{children:"This action cannot be undone. This will permanently delete this transaction."})]}),r.jsxs(nu,{children:[r.jsx(iu,{children:"Cancel"}),r.jsx(Ld,{onClick:H,className:"bg-destructive text-destructive-foreground",children:"Delete"})]})]})})]})}function Mze({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=(b,j)=>{if(!j||j===0)return null;const C=Math.min(b/j*100,100),N=Math.max(j-b,0),A=l>0?N/l:0,E=o/12*100,T=C>=E?"ahead":C>=E*.8?"on-track":"behind";return{percent:C,remaining:N,pace:A,status:T}},h=i(e.totalTransactions,t.transactions_goal),p=i(e.totalVolume,t.volume_goal),x=s?i(e.totalCommission,t.gci_goal):null,y=b=>{switch(b){case"ahead":return r.jsxs(Ot,{className:"bg-green-500 text-white",children:[r.jsx(Xf,{className:"h-3 w-3 mr-1"}),"Ahead"]});case"on-track":return r.jsxs(Ot,{variant:"secondary",children:[r.jsx(_1,{className:"h-3 w-3 mr-1"}),"On Track"]});case"behind":return r.jsxs(Ot,{variant:"destructive",children:[r.jsx(bj,{className:"h-3 w-3 mr-1"}),"Behind"]});default:return null}};return!t.transactions_goal&&!t.volume_goal&&!t.gci_goal?null:r.jsxs(Ye,{children:[r.jsx(Gt,{className:"pb-3",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Hx,{className:"h-5 w-5 text-primary"}),r.jsxs(Zt,{children:[n," Goals Progress"]})]})}),r.jsx(tt,{children:r.jsxs("div",{className:"grid md:grid-cols-3 gap-6",children:[t.transactions_goal&&h&&r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{className:"text-sm font-medium",children:"Transactions"}),y(h.status)]}),r.jsx(Kc,{value:h.percent,className:"h-2"}),r.jsxs("div",{className:"flex justify-between text-sm text-muted-foreground",children:[r.jsxs("span",{children:[e.totalTransactions," of ",t.transactions_goal]}),r.jsxs("span",{children:[Math.round(h.percent),"%"]})]}),h.remaining>0&&l>0&&r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Need ",Math.ceil(h.pace),"/month to hit goal"]})]}),t.volume_goal&&p&&r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{className:"text-sm font-medium",children:"Volume"}),y(p.status)]}),r.jsx(Kc,{value:p.percent,className:"h-2"}),r.jsxs("div",{className:"flex justify-between text-sm text-muted-foreground",children:[r.jsxs("span",{children:[Ed(e.totalVolume,!0)," of ",Ed(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 ",Ed(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(Kc,{value:x.percent,className:"h-2"}),r.jsxs("div",{className:"flex justify-between text-sm text-muted-foreground",children:[r.jsxs("span",{children:[Ed(e.totalCommission,!0)," of ",Ed(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 ",Ed(x.pace,!0),"/month"]})]})]})})]})}var ikt=Array.isArray,Nh=ikt,okt=typeof Ax=="object"&&Ax&&Ax.Object===Object&&Ax,Tze=okt,lkt=Tze,ckt=typeof self=="object"&&self&&self.Object===Object&&self,dkt=lkt||ckt||Function("return this")(),$g=dkt,ukt=$g,hkt=ukt.Symbol,RI=hkt,p4e=RI,Aze=Object.prototype,fkt=Aze.hasOwnProperty,pkt=Aze.toString,UM=p4e?p4e.toStringTag:void 0;function mkt(t){var e=fkt.call(t,UM),n=t[UM];try{t[UM]=void 0;var s=!0}catch{}var a=pkt.call(t);return s&&(e?t[UM]=n:delete t[UM]),a}var gkt=mkt,xkt=Object.prototype,ykt=xkt.toString;function vkt(t){return ykt.call(t)}var _kt=vkt,m4e=RI,bkt=gkt,wkt=_kt,jkt="[object Null]",kkt="[object Undefined]",g4e=m4e?m4e.toStringTag:void 0;function Nkt(t){return t==null?t===void 0?kkt:jkt:g4e&&g4e in Object(t)?bkt(t):wkt(t)}var py=Nkt;function Skt(t){return t!=null&&typeof t=="object"}var my=Skt,Ckt=py,Mkt=my,Tkt="[object Symbol]";function Akt(t){return typeof t=="symbol"||Mkt(t)&&Ckt(t)==Tkt}var p3=Akt,Ekt=Nh,Ikt=p3,Pkt=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Lkt=/^\w*$/;function Okt(t,e){if(Ekt(t))return!1;var n=typeof t;return n=="number"||n=="symbol"||n=="boolean"||t==null||Ikt(t)?!0:Lkt.test(t)||!Pkt.test(t)||e!=null&&t in Object(e)}var wye=Okt;function Dkt(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var uv=Dkt;const m3=Hi(uv);var Rkt=py,Fkt=uv,zkt="[object AsyncFunction]",Bkt="[object Function]",$kt="[object GeneratorFunction]",Ukt="[object Proxy]";function qkt(t){if(!Fkt(t))return!1;var e=Rkt(t);return e==Bkt||e==$kt||e==zkt||e==Ukt}var jye=qkt;const Ua=Hi(jye);var Vkt=$g,Hkt=Vkt["__core-js_shared__"],Wkt=Hkt,Dce=Wkt,x4e=function(){var t=/[^.]+$/.exec(Dce&&Dce.keys&&Dce.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function Gkt(t){return!!x4e&&x4e in t}var Kkt=Gkt,Zkt=Function.prototype,Ykt=Zkt.toString;function Xkt(t){if(t!=null){try{return Ykt.call(t)}catch{}try{return t+""}catch{}}return""}var Eze=Xkt,Qkt=jye,Jkt=Kkt,eNt=uv,tNt=Eze,rNt=/[\\^$.*+?()[\]{}|]/g,nNt=/^\[object .+?Constructor\]$/,sNt=Function.prototype,aNt=Object.prototype,iNt=sNt.toString,oNt=aNt.hasOwnProperty,lNt=RegExp("^"+iNt.call(oNt).replace(rNt,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function cNt(t){if(!eNt(t)||Jkt(t))return!1;var e=Qkt(t)?lNt:nNt;return e.test(tNt(t))}var dNt=cNt;function uNt(t,e){return t==null?void 0:t[e]}var hNt=uNt,fNt=dNt,pNt=hNt;function mNt(t,e){var n=pNt(t,e);return fNt(n)?n:void 0}var dk=mNt,gNt=dk,xNt=gNt(Object,"create"),Hse=xNt,y4e=Hse;function yNt(){this.__data__=y4e?y4e(null):{},this.size=0}var vNt=yNt;function _Nt(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var bNt=_Nt,wNt=Hse,jNt="__lodash_hash_undefined__",kNt=Object.prototype,NNt=kNt.hasOwnProperty;function SNt(t){var e=this.__data__;if(wNt){var n=e[t];return n===jNt?void 0:n}return NNt.call(e,t)?e[t]:void 0}var CNt=SNt,MNt=Hse,TNt=Object.prototype,ANt=TNt.hasOwnProperty;function ENt(t){var e=this.__data__;return MNt?e[t]!==void 0:ANt.call(e,t)}var INt=ENt,PNt=Hse,LNt="__lodash_hash_undefined__";function ONt(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=PNt&&e===void 0?LNt:e,this}var DNt=ONt,RNt=vNt,FNt=bNt,zNt=CNt,BNt=INt,$Nt=DNt;function g3(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e-1}var s4t=n4t,a4t=Wse;function i4t(t,e){var n=this.__data__,s=a4t(n,t);return s<0?(++this.size,n.push([t,e])):n[s][1]=e,this}var o4t=i4t,l4t=VNt,c4t=QNt,d4t=t4t,u4t=s4t,h4t=o4t;function x3(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e0?1:-1},Hw=function(e){return Yj(e)&&e.indexOf("%")===e.length-1},Dn=function(e){return ISt(e)&&!FI(e)},DSt=function(e){return vi(e)},Wc=function(e){return Dn(e)||Yj(e)},RSt=0,zI=function(e){var n=++RSt;return"".concat(e||"").concat(n)},Lu=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)&&!Yj(e))return s;var o;if(Hw(e)){var l=e.indexOf("%");o=n*parseFloat(e.slice(0,l))/100}else o=+e;return FI(o)&&(o=s),a&&o>n&&(o=n),o},E0=function(e){if(!e)return null;var n=Object.keys(e);return n&&n.length?e[n[0]]:null},FSt=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 HSt(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 N4e={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"},Zx=function(e){return typeof e=="string"?e:e?e.displayName||e.name||"Component":""},S4e=null,Fce=null,Pye=function t(e){if(e===S4e&&Array.isArray(Fce))return Fce;var n=[];return I.Children.forEach(e,function(s){vi(s)||(CSt.isFragment(s)?n=n.concat(t(s.props.children)):n.push(s))}),Fce=n,S4e=e,n};function tp(t,e){var n=[],s=[];return Array.isArray(e)?s=e.map(function(a){return Zx(a)}):s=[Zx(e)],Pye(t).forEach(function(a){var o=of(a,"type.displayName")||of(a,"type.name");s.indexOf(o)!==-1&&n.push(a)}),n}function Uh(t,e){var n=tp(t,e);return n&&n[0]}var C4e=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)},WSt=["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"],GSt=function(e){return e&&e.type&&Yj(e.type)&&WSt.indexOf(e.type)>=0},KSt=function(e,n,s,a){var o,l=(o=Rce==null?void 0:Rce[a])!==null&&o!==void 0?o:[];return n.startsWith("data-")||!Ua(e)&&(a&&l.includes(n)||$St.includes(n))||s&&Iye.includes(n)},Ia=function(e,n,s){if(!e||typeof e=="function"||typeof e=="boolean")return null;var a=e;if(I.isValidElement(e)&&(a=e.props),!m3(a))return null;var o={};return Object.keys(a).forEach(function(l){var i;KSt((i=a)===null||i===void 0?void 0:i[l],l,n,s)&&(o[l]=a[l])}),o},lfe=function t(e,n){if(e===n)return!0;var s=I.Children.count(e);if(s!==I.Children.count(n))return!1;if(s===0)return!0;if(s===1)return M4e(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 JSt(t,e){if(t==null)return{};var n={};for(var s in t)if(Object.prototype.hasOwnProperty.call(t,s)){if(e.indexOf(s)>=0)continue;n[s]=t[s]}return n}function dfe(t){var e=t.children,n=t.width,s=t.height,a=t.viewBox,o=t.className,l=t.style,i=t.title,h=t.desc,p=QSt(t,XSt),x=a||{width:n,height:s,x:0,y:0},y=si("recharts-surface",o);return st.createElement("svg",cfe({},Ia(p,!0,"svg"),{className:y,width:n,height:s,style:l,viewBox:"".concat(x.x," ").concat(x.y," ").concat(x.width," ").concat(x.height)}),st.createElement("title",null,i),st.createElement("desc",null,h),e)}var eCt=["children","className"];function ufe(){return ufe=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0)&&Object.prototype.propertyIsEnumerable.call(t,s)&&(n[s]=t[s])}return n}function rCt(t,e){if(t==null)return{};var n={};for(var s in t)if(Object.prototype.hasOwnProperty.call(t,s)){if(e.indexOf(s)>=0)continue;n[s]=t[s]}return n}var No=st.forwardRef(function(t,e){var n=t.children,s=t.className,a=tCt(t,eCt),o=si("recharts-layer",s);return st.createElement("g",ufe({className:o},Ia(a,!0),{ref:e}),n)}),ym=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:aCt(t,e,n)}var oCt=iCt,lCt="\\ud800-\\udfff",cCt="\\u0300-\\u036f",dCt="\\ufe20-\\ufe2f",uCt="\\u20d0-\\u20ff",hCt=cCt+dCt+uCt,fCt="\\ufe0e\\ufe0f",pCt="\\u200d",mCt=RegExp("["+pCt+lCt+hCt+fCt+"]");function gCt(t){return mCt.test(t)}var $ze=gCt;function xCt(t){return t.split("")}var yCt=xCt,Uze="\\ud800-\\udfff",vCt="\\u0300-\\u036f",_Ct="\\ufe20-\\ufe2f",bCt="\\u20d0-\\u20ff",wCt=vCt+_Ct+bCt,jCt="\\ufe0e\\ufe0f",kCt="["+Uze+"]",hfe="["+wCt+"]",ffe="\\ud83c[\\udffb-\\udfff]",NCt="(?:"+hfe+"|"+ffe+")",qze="[^"+Uze+"]",Vze="(?:\\ud83c[\\udde6-\\uddff]){2}",Hze="[\\ud800-\\udbff][\\udc00-\\udfff]",SCt="\\u200d",Wze=NCt+"?",Gze="["+jCt+"]?",CCt="(?:"+SCt+"(?:"+[qze,Vze,Hze].join("|")+")"+Gze+Wze+")*",MCt=Gze+Wze+CCt,TCt="(?:"+[qze+hfe+"?",hfe,Vze,Hze,kCt].join("|")+")",ACt=RegExp(ffe+"(?="+ffe+")|"+TCt+MCt,"g");function ECt(t){return t.match(ACt)||[]}var ICt=ECt,PCt=yCt,LCt=$ze,OCt=ICt;function DCt(t){return LCt(t)?OCt(t):PCt(t)}var RCt=DCt,FCt=oCt,zCt=$ze,BCt=RCt,$Ct=Oze;function UCt(t){return function(e){e=$Ct(e);var n=zCt(e)?BCt(e):void 0,s=n?n[0]:e.charAt(0),a=n?FCt(n,1).join(""):e.slice(1);return s[t]()+a}}var qCt=UCt,VCt=qCt,HCt=VCt("toUpperCase"),WCt=HCt;const iae=Hi(WCt);function Zo(t){return function(){return t}}const Kze=Math.cos,dre=Math.sin,Mm=Math.sqrt,ure=Math.PI,oae=2*ure,pfe=Math.PI,mfe=2*pfe,Cw=1e-6,GCt=mfe-Cw;function Zze(t){this._+=t[0];for(let e=1,n=t.length;e=0))throw new Error(`invalid digits: ${t}`);if(e>15)return Zze;const n=10**e;return function(s){this._+=s[0];for(let a=1,o=s.length;aCw)if(!(Math.abs(y*h-p*x)>Cw)||!o)this._append`L${this._x1=e},${this._y1=n}`;else{let j=s-l,C=a-i,N=h*h+p*p,A=j*j+C*C,E=Math.sqrt(N),T=Math.sqrt(b),L=o*Math.tan((pfe-Math.acos((N+b-A)/(2*E*T)))/2),z=L/T,F=L/E;Math.abs(z-1)>Cw&&this._append`L${e+z*x},${n+z*y}`,this._append`A${o},${o},0,0,${+(y*j>x*C)},${this._x1=e+F*h},${this._y1=n+F*p}`}}arc(e,n,s,a,o,l){if(e=+e,n=+n,s=+s,l=!!l,s<0)throw new Error(`negative radius: ${s}`);let i=s*Math.cos(a),h=s*Math.sin(a),p=e+i,x=n+h,y=1^l,b=l?a-o:o-a;this._x1===null?this._append`M${p},${x}`:(Math.abs(this._x1-p)>Cw||Math.abs(this._y1-x)>Cw)&&this._append`L${p},${x}`,s&&(b<0&&(b=b%mfe+mfe),b>GCt?this._append`A${s},${s},0,1,${y},${e-i},${n-h}A${s},${s},0,1,${y},${this._x1=p},${this._y1=x}`:b>Cw&&this._append`A${s},${s},0,${+(b>=pfe)},${y},${this._x1=e+s*Math.cos(o)},${this._y1=n+s*Math.sin(o)}`)}rect(e,n,s,a){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+n}h${s=+s}v${+a}h${-s}Z`}toString(){return this._}}function Lye(t){let e=3;return t.digits=function(n){if(!arguments.length)return e;if(n==null)e=null;else{const s=Math.floor(n);if(!(s>=0))throw new RangeError(`invalid digits: ${n}`);e=s}return t},()=>new ZCt(e)}function Oye(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function Yze(t){this._context=t}Yze.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:this._context.lineTo(t,e);break}}};function lae(t){return new Yze(t)}function Xze(t){return t[0]}function Qze(t){return t[1]}function Jze(t,e){var n=Zo(!0),s=null,a=lae,o=null,l=Lye(i);t=typeof t=="function"?t:t===void 0?Xze:Zo(t),e=typeof e=="function"?e:e===void 0?Qze:Zo(e);function i(h){var p,x=(h=Oye(h)).length,y,b=!1,j;for(s==null&&(o=a(j=l())),p=0;p<=x;++p)!(p=j;--C)i.point(L[C],z[C]);i.lineEnd(),i.areaEnd()}E&&(L[b]=+t(A,b,y),z[b]=+e(A,b,y),i.point(s?+s(A,b,y):L[b],n?+n(A,b,y):z[b]))}if(T)return i=null,T+""||null}function x(){return Jze().defined(a).curve(l).context(o)}return p.x=function(y){return arguments.length?(t=typeof y=="function"?y:Zo(+y),s=null,p):t},p.x0=function(y){return arguments.length?(t=typeof y=="function"?y:Zo(+y),p):t},p.x1=function(y){return arguments.length?(s=y==null?null:typeof y=="function"?y:Zo(+y),p):s},p.y=function(y){return arguments.length?(e=typeof y=="function"?y:Zo(+y),n=null,p):e},p.y0=function(y){return arguments.length?(e=typeof y=="function"?y:Zo(+y),p):e},p.y1=function(y){return arguments.length?(n=y==null?null:typeof y=="function"?y:Zo(+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:Zo(!!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 e7e{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 YCt(t){return new e7e(t,!0)}function XCt(t){return new e7e(t,!1)}const Dye={draw(t,e){const n=Mm(e/ure);t.moveTo(n,0),t.arc(0,0,n,0,oae)}},QCt={draw(t,e){const n=Mm(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()}},t7e=Mm(1/3),JCt=t7e*2,e3t={draw(t,e){const n=Mm(e/JCt),s=n*t7e;t.moveTo(0,-n),t.lineTo(s,0),t.lineTo(0,n),t.lineTo(-s,0),t.closePath()}},t3t={draw(t,e){const n=Mm(e),s=-n/2;t.rect(s,s,n,n)}},r3t=.8908130915292852,r7e=dre(ure/10)/dre(7*ure/10),n3t=dre(oae/10)*r7e,s3t=-Kze(oae/10)*r7e,a3t={draw(t,e){const n=Mm(e*r3t),s=n3t*n,a=s3t*n;t.moveTo(0,-n),t.lineTo(s,a);for(let o=1;o<5;++o){const l=oae*o/5,i=Kze(l),h=dre(l);t.lineTo(h*n,-i*n),t.lineTo(i*s-h*a,h*s+i*a)}t.closePath()}},zce=Mm(3),i3t={draw(t,e){const n=-Mm(e/(zce*3));t.moveTo(0,n*2),t.lineTo(-zce*n,-n),t.lineTo(zce*n,-n),t.closePath()}},Af=-.5,Ef=Mm(3)/2,gfe=1/Mm(12),o3t=(gfe/2+1)*3,l3t={draw(t,e){const n=Mm(e/o3t),s=n/2,a=n*gfe,o=s,l=n*gfe+n,i=-o,h=l;t.moveTo(s,a),t.lineTo(o,l),t.lineTo(i,h),t.lineTo(Af*s-Ef*a,Ef*s+Af*a),t.lineTo(Af*o-Ef*l,Ef*o+Af*l),t.lineTo(Af*i-Ef*h,Ef*i+Af*h),t.lineTo(Af*s+Ef*a,Af*a-Ef*s),t.lineTo(Af*o+Ef*l,Af*l-Ef*o),t.lineTo(Af*i+Ef*h,Af*h-Ef*i),t.closePath()}};function c3t(t,e){let n=null,s=Lye(a);t=typeof t=="function"?t:Zo(t||Dye),e=typeof e=="function"?e:Zo(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:Zo(o),a):t},a.size=function(o){return arguments.length?(e=typeof o=="function"?o:Zo(+o),a):e},a.context=function(o){return arguments.length?(n=o??null,a):n},a}function hre(){}function fre(t,e,n){t._context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+n)/6)}function n7e(t){this._context=t}n7e.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){switch(this._point){case 3:fre(this,this._x1,this._y1);case 2:this._context.lineTo(this._x1,this._y1);break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,this._context.lineTo((5*this._x0+this._x1)/6,(5*this._y0+this._y1)/6);default:fre(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function d3t(t){return new n7e(t)}function s7e(t){this._context=t}s7e.prototype={areaStart:hre,areaEnd:hre,lineStart:function(){this._x0=this._x1=this._x2=this._x3=this._x4=this._y0=this._y1=this._y2=this._y3=this._y4=NaN,this._point=0},lineEnd:function(){switch(this._point){case 1:{this._context.moveTo(this._x2,this._y2),this._context.closePath();break}case 2:{this._context.moveTo((this._x2+2*this._x3)/3,(this._y2+2*this._y3)/3),this._context.lineTo((this._x3+2*this._x2)/3,(this._y3+2*this._y2)/3),this._context.closePath();break}case 3:{this.point(this._x2,this._y2),this.point(this._x3,this._y3),this.point(this._x4,this._y4);break}}},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._x2=t,this._y2=e;break;case 1:this._point=2,this._x3=t,this._y3=e;break;case 2:this._point=3,this._x4=t,this._y4=e,this._context.moveTo((this._x0+4*this._x1+t)/6,(this._y0+4*this._y1+e)/6);break;default:fre(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function u3t(t){return new s7e(t)}function a7e(t){this._context=t}a7e.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0},lineEnd:function(){(this._line||this._line!==0&&this._point===3)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+t)/6,s=(this._y0+4*this._y1+e)/6;this._line?this._context.lineTo(n,s):this._context.moveTo(n,s);break;case 3:this._point=4;default:fre(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function h3t(t){return new a7e(t)}function i7e(t){this._context=t}i7e.prototype={areaStart:hre,areaEnd:hre,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(t,e){t=+t,e=+e,this._point?this._context.lineTo(t,e):(this._point=1,this._context.moveTo(t,e))}};function f3t(t){return new i7e(t)}function A4e(t){return t<0?-1:1}function E4e(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(A4e(o)+A4e(l))*Math.min(Math.abs(o),Math.abs(l),.5*Math.abs(i))||0}function I4e(t,e){var n=t._x1-t._x0;return n?(3*(t._y1-t._y0)/n-e)/2:e}function Bce(t,e,n){var s=t._x0,a=t._y0,o=t._x1,l=t._y1,i=(o-s)/3;t._context.bezierCurveTo(s+i,a+i*e,o-i,l-i*n,o,l)}function pre(t){this._context=t}pre.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0},lineEnd:function(){switch(this._point){case 2:this._context.lineTo(this._x1,this._y1);break;case 3:Bce(this,this._t0,I4e(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){var n=NaN;if(t=+t,e=+e,!(t===this._x1&&e===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,Bce(this,I4e(this,n=E4e(this,t,e)),n);break;default:Bce(this,this._t0,n=E4e(this,t,e));break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e,this._t0=n}}};function o7e(t){this._context=new l7e(t)}(o7e.prototype=Object.create(pre.prototype)).point=function(t,e){pre.prototype.point.call(this,e,t)};function l7e(t){this._context=t}l7e.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 p3t(t){return new pre(t)}function m3t(t){return new o7e(t)}function c7e(t){this._context=t}c7e.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=P4e(t),a=P4e(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 x3t(t){return new cae(t,.5)}function y3t(t){return new cae(t,0)}function v3t(t){return new cae(t,1)}function _C(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 _3t(t,e){return t[e]}function b3t(t){const e=[];return e.key=t,e}function w3t(){var t=Zo([]),e=xfe,n=_C,s=_3t;function a(o){var l=Array.from(t.apply(this,arguments),b3t),i,h=l.length,p=-1,x;for(const y of o)for(i=0,++p;i0){for(var n,s,a=0,o=t[0].length,l;a0){for(var n=0,s=t[e[0]],a,o=s.length;n0)||!((o=(a=t[e[0]]).length)>0))){for(var n=0,s=1,a,o,l;s=0)&&Object.prototype.propertyIsEnumerable.call(t,s)&&(n[s]=t[s])}return n}function E3t(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 d7e={symbolCircle:Dye,symbolCross:QCt,symbolDiamond:e3t,symbolSquare:t3t,symbolStar:a3t,symbolTriangle:i3t,symbolWye:l3t},I3t=Math.PI/180,P3t=function(e){var n="symbol".concat(iae(e));return d7e[n]||Dye},L3t=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*I3t;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}},O3t=function(e,n){d7e["symbol".concat(iae(e))]=n},Rye=function(e){var n=e.type,s=n===void 0?"circle":n,a=e.size,o=a===void 0?64:a,l=e.sizeType,i=l===void 0?"area":l,h=A3t(e,S3t),p=O4e(O4e({},h),{},{type:s,size:o,sizeType:i}),x=function(){var A=P3t(s),E=c3t().type(A).size(L3t(o,i,s));return E()},y=p.className,b=p.cx,j=p.cy,C=Ia(p,!0);return b===+b&&j===+j&&o===+o?st.createElement("path",yfe({},C,{className:si("recharts-symbols",y),transform:"translate(".concat(b,", ").concat(j,")"),d:x()})):null};Rye.registerSymbol=O3t;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 vfe(){return vfe=Object.assign?Object.assign.bind():function(t){for(var e=1;e`);var T=j.inactive?p:j.color;return st.createElement("li",vfe({className:A,style:y,key:"legend-item-".concat(C)},Xj(s.props,j,C)),st.createElement(dfe,{width:l,height:l,viewBox:x,style:b},s.renderIcon(j)),st.createElement("span",{className:"recharts-legend-item-text",style:{color:T}},N?N(E,j,C):E))})}},{key:"render",value:function(){var s=this.props,a=s.payload,o=s.layout,l=s.align;if(!a||!a.length)return null;var i={padding:0,margin:0,textAlign:o==="horizontal"?l:"left"};return st.createElement("ul",{className:"recharts-default-legend",style:i},this.renderItems())}}])}(I.PureComponent);vE(Fye,"displayName","Legend");vE(Fye,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"middle",inactiveColor:"#ccc"});var H3t=Gse;function W3t(){this.__data__=new H3t,this.size=0}var G3t=W3t;function K3t(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n}var Z3t=K3t;function Y3t(t){return this.__data__.get(t)}var X3t=Y3t;function Q3t(t){return this.__data__.has(t)}var J3t=Q3t,e5t=Gse,t5t=Nye,r5t=Sye,n5t=200;function s5t(t,e){var n=this.__data__;if(n instanceof e5t){var s=n.__data__;if(!t5t||s.lengthi))return!1;var p=o.get(t),x=o.get(e);if(p&&x)return p==e&&x==t;var y=-1,b=!0,j=n&S5t?new w5t:void 0;for(o.set(t,e),o.set(e,t);++y-1&&t%1==0&&t-1&&t%1==0&&t<=AMt}var Uye=EMt,IMt=py,PMt=Uye,LMt=my,OMt="[object Arguments]",DMt="[object Array]",RMt="[object Boolean]",FMt="[object Date]",zMt="[object Error]",BMt="[object Function]",$Mt="[object Map]",UMt="[object Number]",qMt="[object Object]",VMt="[object RegExp]",HMt="[object Set]",WMt="[object String]",GMt="[object WeakMap]",KMt="[object ArrayBuffer]",ZMt="[object DataView]",YMt="[object Float32Array]",XMt="[object Float64Array]",QMt="[object Int8Array]",JMt="[object Int16Array]",eTt="[object Int32Array]",tTt="[object Uint8Array]",rTt="[object Uint8ClampedArray]",nTt="[object Uint16Array]",sTt="[object Uint32Array]",ol={};ol[YMt]=ol[XMt]=ol[QMt]=ol[JMt]=ol[eTt]=ol[tTt]=ol[rTt]=ol[nTt]=ol[sTt]=!0;ol[OMt]=ol[DMt]=ol[KMt]=ol[RMt]=ol[ZMt]=ol[FMt]=ol[zMt]=ol[BMt]=ol[$Mt]=ol[UMt]=ol[qMt]=ol[VMt]=ol[HMt]=ol[WMt]=ol[GMt]=!1;function aTt(t){return LMt(t)&&PMt(t.length)&&!!ol[IMt(t)]}var iTt=aTt;function oTt(t){return function(e){return t(e)}}var b7e=oTt,yre={exports:{}};yre.exports;(function(t,e){var n=Tze,s=e&&!e.nodeType&&e,a=s&&!0&&t&&!t.nodeType&&t,o=a&&a.exports===s,l=o&&n.process,i=function(){try{var h=a&&a.require&&a.require("util").types;return h||l&&l.binding&&l.binding("util")}catch{}}();t.exports=i})(yre,yre.exports);var lTt=yre.exports,cTt=iTt,dTt=b7e,U4e=lTt,q4e=U4e&&U4e.isTypedArray,uTt=q4e?dTt(q4e):cTt,w7e=uTt,hTt=mMt,fTt=Bye,pTt=Nh,mTt=_7e,gTt=$ye,xTt=w7e,yTt=Object.prototype,vTt=yTt.hasOwnProperty;function _Tt(t,e){var n=pTt(t),s=!n&&fTt(t),a=!n&&!s&&mTt(t),o=!n&&!s&&!a&&xTt(t),l=n||s||a||o,i=l?hTt(t.length,String):[],h=i.length;for(var p in t)(e||vTt.call(t,p))&&!(l&&(p=="length"||a&&(p=="offset"||p=="parent")||o&&(p=="buffer"||p=="byteLength"||p=="byteOffset")||gTt(p,h)))&&i.push(p);return i}var bTt=_Tt,wTt=Object.prototype;function jTt(t){var e=t&&t.constructor,n=typeof e=="function"&&e.prototype||wTt;return t===n}var kTt=jTt;function NTt(t,e){return function(n){return t(e(n))}}var j7e=NTt,STt=j7e,CTt=STt(Object.keys,Object),MTt=CTt,TTt=kTt,ATt=MTt,ETt=Object.prototype,ITt=ETt.hasOwnProperty;function PTt(t){if(!TTt(t))return ATt(t);var e=[];for(var n in Object(t))ITt.call(t,n)&&n!="constructor"&&e.push(n);return e}var LTt=PTt,OTt=jye,DTt=Uye;function RTt(t){return t!=null&&DTt(t.length)&&!OTt(t)}var BI=RTt,FTt=bTt,zTt=LTt,BTt=BI;function $Tt(t){return BTt(t)?FTt(t):zTt(t)}var dae=$Tt,UTt=nMt,qTt=fMt,VTt=dae;function HTt(t){return UTt(t,VTt,qTt)}var WTt=HTt,V4e=WTt,GTt=1,KTt=Object.prototype,ZTt=KTt.hasOwnProperty;function YTt(t,e,n,s,a,o){var l=n>t,i=V4e(t),h=i.length,p=V4e(e),x=p.length;if(h!=x&&!l)return!1;for(var y=h;y--;){var b=i[y];if(!(l?b in e:ZTt.call(e,b)))return!1}var j=o.get(t),C=o.get(e);if(j&&C)return j==e&&C==t;var N=!0;o.set(t,e),o.set(e,t);for(var A=l;++y-1}var KEt=GEt;function ZEt(t,e,n){for(var s=-1,a=t==null?0:t.length;++s=dIt){var p=e?null:lIt(t);if(p)return cIt(p);l=!1,a=oIt,h=new sIt}else h=e?[]:i;e:for(;++s=0)&&Object.prototype.propertyIsEnumerable.call(t,s)&&(n[s]=t[s])}return n}function SIt(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 CIt(t){return t.value}function MIt(t,e){if(st.isValidElement(t))return st.cloneElement(t,e);if(typeof t=="function")return st.createElement(t,e);e.ref;var n=NIt(e,xIt);return st.createElement(Fye,n)}var iSe=1,PS=function(t){function e(){var n;yIt(this,e);for(var s=arguments.length,a=new Array(s),o=0;oiSe||Math.abs(a.height-this.lastBoundingBox.height)>iSe)&&(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?xx({},this.lastBoundingBox):{width:0,height:0}}},{key:"getDefaultPosition",value:function(s){var a=this.props,o=a.layout,l=a.align,i=a.verticalAlign,h=a.margin,p=a.chartWidth,x=a.chartHeight,y,b;if(!s||(s.left===void 0||s.left===null)&&(s.right===void 0||s.right===null))if(l==="center"&&o==="vertical"){var j=this.getBBoxSnapshot();y={left:((p||0)-j.width)/2}}else y=l==="right"?{right:h&&h.right||0}:{left:h&&h.left||0};if(!s||(s.top===void 0||s.top===null)&&(s.bottom===void 0||s.bottom===null))if(i==="middle"){var C=this.getBBoxSnapshot();b={top:((x||0)-C.height)/2}}else b=i==="bottom"?{bottom:h&&h.bottom||0}:{top:h&&h.top||0};return xx(xx({},y),b)}},{key:"render",value:function(){var s=this,a=this.props,o=a.content,l=a.width,i=a.height,h=a.wrapperStyle,p=a.payloadUniqBy,x=a.payload,y=xx(xx({position:"absolute",width:l||"auto",height:i||"auto"},this.getDefaultPosition(h)),h);return st.createElement("div",{className:"recharts-legend-wrapper",style:y,ref:function(j){s.wrapperNode=j}},MIt(o,xx(xx({},this.props),{},{payload:A7e(x,p,CIt)})))}}],[{key:"getWithHeight",value:function(s,a){var o=xx(xx({},this.defaultProps),s.props),l=o.layout;return l==="vertical"&&Dn(s.props.height)?{height:s.props.height}:l==="horizontal"?{width:s.props.width||a}:null}}])}(I.PureComponent);uae(PS,"displayName","Legend");uae(PS,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"bottom"});var oSe=RI,TIt=Bye,AIt=Nh,lSe=oSe?oSe.isConcatSpreadable:void 0;function EIt(t){return AIt(t)||TIt(t)||!!(lSe&&t&&t[lSe])}var IIt=EIt,PIt=y7e,LIt=IIt;function P7e(t,e,n,s,a){var o=-1,l=t.length;for(n||(n=LIt),a||(a=[]);++o0&&n(i)?e>1?P7e(i,e-1,n,s,a):PIt(a,i):s||(a[a.length]=i)}return a}var L7e=P7e;function OIt(t){return function(e,n,s){for(var a=-1,o=Object(e),l=s(e),i=l.length;i--;){var h=l[t?i:++a];if(n(o[h],h,o)===!1)break}return e}}var DIt=OIt,RIt=DIt,FIt=RIt(),zIt=FIt,BIt=zIt,$It=dae;function UIt(t,e){return t&&BIt(t,e,$It)}var O7e=UIt,qIt=BI;function VIt(t,e){return function(n,s){if(n==null)return n;if(!qIt(n))return t(n,s);for(var a=n.length,o=e?a:-1,l=Object(n);(e?o--:++oe||o&&l&&h&&!i&&!p||s&&l&&h||!n&&h||!a)return 1;if(!s&&!o&&!p&&t=i)return h;var p=n[s];return h*(p=="desc"?-1:1)}}return t.index-e.index}var sPt=nPt,Vce=Mye,aPt=Tye,iPt=Ug,oPt=D7e,lPt=JIt,cPt=b7e,dPt=sPt,uPt=b3,hPt=Nh;function fPt(t,e,n){e.length?e=Vce(e,function(o){return hPt(o)?function(l){return aPt(l,o.length===1?o[0]:o)}:o}):e=[uPt];var s=-1;e=Vce(e,cPt(iPt));var a=oPt(t,function(o,l,i){var h=Vce(e,function(p){return p(o)});return{criteria:h,index:++s,value:o}});return lPt(a,function(o,l){return dPt(o,l,n)})}var pPt=fPt;function mPt(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 gPt=mPt,xPt=gPt,dSe=Math.max;function yPt(t,e,n){return e=dSe(e===void 0?t.length-1:e,0),function(){for(var s=arguments,a=-1,o=dSe(s.length-e,0),l=Array(o);++a0){if(++e>=MPt)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}var IPt=EPt,PPt=CPt,LPt=IPt,OPt=LPt(PPt),DPt=OPt,RPt=b3,FPt=vPt,zPt=DPt;function BPt(t,e){return zPt(FPt(t,e,RPt),t+"")}var $Pt=BPt,UPt=kye,qPt=BI,VPt=$ye,HPt=uv;function WPt(t,e,n){if(!HPt(n))return!1;var s=typeof e;return(s=="number"?qPt(n)&&VPt(e,n.length):s=="string"&&e in n)?UPt(n[e],t):!1}var hae=WPt,GPt=L7e,KPt=pPt,ZPt=$Pt,hSe=hae,YPt=ZPt(function(t,e){if(t==null)return[];var n=e.length;return n>1&&hSe(t,e[0],e[1])?e=[]:n>2&&hSe(e[0],e[1],e[2])&&(e=[e[0]]),KPt(t,GPt(e,1),[])}),XPt=YPt;const Hye=Hi(XPt);function _E(t){"@babel/helpers - typeof";return _E=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},_E(t)}function Cfe(){return Cfe=Object.assign?Object.assign.bind():function(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,s=new Array(e);n=e.x),"".concat(qM,"-left"),Dn(n)&&e&&Dn(e.x)&&n=e.y),"".concat(qM,"-top"),Dn(s)&&e&&Dn(e.y)&&sN?Math.max(x,h[s]):Math.max(y,h[s])}function h6t(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 f6t(t){var e=t.allowEscapeViewBox,n=t.coordinate,s=t.offsetTopLeft,a=t.position,o=t.reverseDirection,l=t.tooltipBox,i=t.useTranslate3d,h=t.viewBox,p,x,y;return l.height>0&&l.width>0&&n?(x=mSe({allowEscapeViewBox:e,coordinate:n,key:"x",offsetTopLeft:s,position:a,reverseDirection:o,tooltipDimension:l.width,viewBox:h,viewBoxDimension:h.width}),y=mSe({allowEscapeViewBox:e,coordinate:n,key:"y",offsetTopLeft:s,position:a,reverseDirection:o,tooltipDimension:l.height,viewBox:h,viewBoxDimension:h.height}),p=h6t({translateX:x,translateY:y,useTranslate3d:i})):p=d6t,{cssProperties:p,cssClasses:u6t({translateX:x,translateY:y,coordinate:n})}}function jC(t){"@babel/helpers - typeof";return jC=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},jC(t)}function gSe(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 xSe(t){for(var e=1;eySe||Math.abs(s.height-this.state.lastBoundingBox.height)>ySe)&&this.setState({lastBoundingBox:{width:s.width,height:s.height}})}else(this.state.lastBoundingBox.width!==-1||this.state.lastBoundingBox.height!==-1)&&this.setState({lastBoundingBox:{width:-1,height:-1}})}},{key:"componentDidMount",value:function(){document.addEventListener("keydown",this.handleKeyDown),this.updateBBox()}},{key:"componentWillUnmount",value:function(){document.removeEventListener("keydown",this.handleKeyDown)}},{key:"componentDidUpdate",value:function(){var s,a;this.props.active&&this.updateBBox(),this.state.dismissed&&(((s=this.props.coordinate)===null||s===void 0?void 0:s.x)!==this.state.dismissedAtCoordinate.x||((a=this.props.coordinate)===null||a===void 0?void 0:a.y)!==this.state.dismissedAtCoordinate.y)&&(this.state.dismissed=!1)}},{key:"render",value:function(){var s=this,a=this.props,o=a.active,l=a.allowEscapeViewBox,i=a.animationDuration,h=a.animationEasing,p=a.children,x=a.coordinate,y=a.hasPayload,b=a.isAnimationActive,j=a.offset,C=a.position,N=a.reverseDirection,A=a.useTranslate3d,E=a.viewBox,T=a.wrapperStyle,L=f6t({allowEscapeViewBox:l,coordinate:x,offsetTopLeft:j,position:C,reverseDirection:N,tooltipBox:this.state.lastBoundingBox,useTranslate3d:A,viewBox:E}),z=L.cssClasses,F=L.cssProperties,q=xSe(xSe({transition:b&&o?"transform ".concat(i,"ms ").concat(h):void 0},F),{},{pointerEvents:"none",visibility:!this.state.dismissed&&o&&y?"visible":"hidden",position:"absolute",top:0,left:0},T);return st.createElement("div",{tabIndex:-1,className:z,style:q,ref:function(Z){s.wrapperNode=Z}},p)}}])}(I.PureComponent),j6t=function(){return!(typeof window<"u"&&window.document&&window.document.createElement&&window.setTimeout)},w3={isSsr:j6t()};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 vSe(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 _Se(t){for(var e=1;e0;return st.createElement(w6t,{allowEscapeViewBox:l,animationDuration:i,animationEasing:h,isAnimationActive:b,active:o,coordinate:x,hasPayload:q,offset:j,position:A,reverseDirection:E,useTranslate3d:T,viewBox:L,wrapperStyle:z},P6t(p,_Se(_Se({},this.props),{},{payload:F})))}}])}(I.PureComponent);Wye(Xp,"displayName","Tooltip");Wye(Xp,"defaultProps",{accessibilityLayer:!1,allowEscapeViewBox:{x:!1,y:!1},animationDuration:400,animationEasing:"ease",contentStyle:{},coordinate:{x:0,y:0},cursor:!0,cursorStyle:{},filterNull:!0,isAnimationActive:!w3.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 L6t=$g,O6t=function(){return L6t.Date.now()},D6t=O6t,R6t=/\s/;function F6t(t){for(var e=t.length;e--&&R6t.test(t.charAt(e)););return e}var z6t=F6t,B6t=z6t,$6t=/^\s+/;function U6t(t){return t&&t.slice(0,B6t(t)+1).replace($6t,"")}var q6t=U6t,V6t=q6t,bSe=uv,H6t=p3,wSe=NaN,W6t=/^[-+]0x[0-9a-f]+$/i,G6t=/^0b[01]+$/i,K6t=/^0o[0-7]+$/i,Z6t=parseInt;function Y6t(t){if(typeof t=="number")return t;if(H6t(t))return wSe;if(bSe(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=bSe(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=V6t(t);var n=G6t.test(t);return n||K6t.test(t)?Z6t(t.slice(2),n?2:8):W6t.test(t)?wSe:+t}var U7e=Y6t,X6t=uv,Wce=D6t,jSe=U7e,Q6t="Expected a function",J6t=Math.max,eLt=Math.min;function tLt(t,e,n){var s,a,o,l,i,h,p=0,x=!1,y=!1,b=!0;if(typeof t!="function")throw new TypeError(Q6t);e=jSe(e)||0,X6t(n)&&(x=!!n.leading,y="maxWait"in n,o=y?J6t(jSe(n.maxWait)||0,e):o,b="trailing"in n?!!n.trailing:b);function j(q){var H=s,Z=a;return s=a=void 0,p=q,l=t.apply(Z,H),l}function C(q){return p=q,i=setTimeout(E,e),x?j(q):l}function N(q){var H=q-h,Z=q-p,G=e-H;return y?eLt(G,o-Z):G}function A(q){var H=q-h,Z=q-p;return h===void 0||H>=e||H<0||y&&Z>=o}function E(){var q=Wce();if(A(q))return T(q);i=setTimeout(E,N(q))}function T(q){return i=void 0,b&&s?j(q):(s=a=void 0,l)}function L(){i!==void 0&&clearTimeout(i),p=0,s=h=a=i=void 0}function z(){return i===void 0?l:T(Wce())}function F(){var q=Wce(),H=A(q);if(s=arguments,a=this,h=q,H){if(i===void 0)return C(h);if(y)return clearTimeout(i),i=setTimeout(E,e),j(h)}return i===void 0&&(i=setTimeout(E,e)),l}return F.cancel=L,F.flush=z,F}var rLt=tLt,nLt=rLt,sLt=uv,aLt="Expected a function";function iLt(t,e,n){var s=!0,a=!0;if(typeof t!="function")throw new TypeError(aLt);return sLt(n)&&(s="leading"in n?!!n.leading:s,a="trailing"in n?!!n.trailing:a),nLt(t,e,{leading:s,maxWait:e,trailing:a})}var oLt=iLt;const q7e=Hi(oLt);function wE(t){"@babel/helpers - typeof";return wE=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},wE(t)}function kSe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);e&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),n.push.apply(n,s)}return n}function qL(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,s=new Array(e);n0&&(ye=q7e(ye,N,{trailing:!0,leading:!1}));var ne=new ResizeObserver(ye),ge=F.current.getBoundingClientRect(),ae=ge.width,he=ge.height;return ie(ae,he),ne.observe(F.current),function(){ne.disconnect()}},[ie,N]);var le=I.useMemo(function(){var ye=G.containerWidth,ne=G.containerHeight;if(ye<0||ne<0)return null;ym(Hw(l)||Hw(h),`The width(%s) and height(%s) are both fixed numbers, maybe you don't need to use a ResponsiveContainer.`,l,h),ym(!n||n>0,"The aspect(%s) must be greater than zero.",n);var ge=Hw(l)?ye:l,ae=Hw(h)?ne:h;n&&n>0&&(ge?ae=ge/n:ae&&(ge=ae*n),b&&ae>b&&(ae=b)),ym(ge>0||ae>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.`,ge,ae,l,h,x,y,n);var he=!Array.isArray(j)&&Zx(j.type).endsWith("Chart");return st.Children.map(j,function(ue){return st.isValidElement(ue)?I.cloneElement(ue,qL({width:ge,height:ae},he?{style:qL({height:"100%",width:"100%",maxHeight:ae,maxWidth:ge},ue.props.style)}:{})):ue})},[n,j,h,b,y,x,G,l]);return st.createElement("div",{id:A?"".concat(A):void 0,className:si("recharts-responsive-container",E),style:qL(qL({},z),{},{width:l,height:h,minWidth:x,minHeight:y,maxHeight:b}),ref:F},le)}),fae=function(e){return null};fae.displayName="Cell";function jE(t){"@babel/helpers - typeof";return jE=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},jE(t)}function SSe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);e&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),n.push.apply(n,s)}return n}function Ife(t){for(var e=1;e1&&arguments[1]!==void 0?arguments[1]:{};if(e==null||w3.isSsr)return{width:0,height:0};var s=bLt(n),a=JSON.stringify({text:e,copyStyle:s});if(f4.widthCache[a])return f4.widthCache[a];try{var o=document.getElementById(CSe);o||(o=document.createElement("span"),o.setAttribute("id",CSe),o.setAttribute("aria-hidden","true"),document.body.appendChild(o));var l=Ife(Ife({},_Lt),s);Object.assign(o.style,l),o.textContent="".concat(e);var i=o.getBoundingClientRect(),h={width:i.width,height:i.height};return f4.widthCache[a]=h,++f4.cacheCount>vLt&&(f4.cacheCount=0,f4.widthCache={}),h}catch{return{width:0,height:0}}},wLt=function(e){return{top:e.top+window.scrollY-document.documentElement.clientTop,left:e.left+window.scrollX-document.documentElement.clientLeft}};function kE(t){"@babel/helpers - typeof";return kE=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},kE(t)}function wre(t,e){return SLt(t)||NLt(t,e)||kLt(t,e)||jLt()}function jLt(){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 kLt(t,e){if(t){if(typeof t=="string")return MSe(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 MSe(t,e)}}function MSe(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 BLt(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 LSe(t,e){return VLt(t)||qLt(t,e)||ULt(t,e)||$Lt()}function $Lt(){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 ULt(t,e){if(t){if(typeof t=="string")return OSe(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 OSe(t,e)}}function OSe(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 ge.reduce(function(ae,he){var ue=he.word,_e=he.width,Ae=ae[ae.length-1];if(Ae&&(a==null||o||Ae.width+_e+she.width?ae:he})};if(!x)return j;for(var N="…",A=function(ge){var ae=y.slice(0,ge),he=G7e({breakAll:p,style:h,children:ae+N}).wordsWithComputedWidth,ue=b(he),_e=ue.length>l||C(ue).width>Number(a);return[_e,ue]},E=0,T=y.length-1,L=0,z;E<=T&&L<=y.length-1;){var F=Math.floor((E+T)/2),q=F-1,H=A(q),Z=LSe(H,2),G=Z[0],te=Z[1],ie=A(F),le=LSe(ie,1),ye=le[0];if(!G&&!ye&&(E=F+1),G&&ye&&(T=F-1),!G&&ye){z=te;break}L++}return z||j},DSe=function(e){var n=vi(e)?[]:e.toString().split(W7e);return[{words:n}]},WLt=function(e){var n=e.width,s=e.scaleToFit,a=e.children,o=e.style,l=e.breakAll,i=e.maxLines;if((n||s)&&!w3.isSsr){var h,p,x=G7e({breakAll:l,children:a,style:o});if(x){var y=x.wordsWithComputedWidth,b=x.spaceWidth;h=y,p=b}else return DSe(a);return HLt({breakAll:l,children:a,maxLines:i,style:o},h,p,n,s)}return DSe(a)},RSe="#808080",Qj=function(e){var n=e.x,s=n===void 0?0:n,a=e.y,o=a===void 0?0:a,l=e.lineHeight,i=l===void 0?"1em":l,h=e.capHeight,p=h===void 0?"0.71em":h,x=e.scaleToFit,y=x===void 0?!1:x,b=e.textAnchor,j=b===void 0?"start":b,C=e.verticalAnchor,N=C===void 0?"end":C,A=e.fill,E=A===void 0?RSe:A,T=PSe(e,FLt),L=I.useMemo(function(){return WLt({breakAll:T.breakAll,children:T.children,maxLines:T.maxLines,scaleToFit:y,style:T.style,width:T.width})},[T.breakAll,T.children,T.maxLines,y,T.style,T.width]),z=T.dx,F=T.dy,q=T.angle,H=T.className,Z=T.breakAll,G=PSe(T,zLt);if(!Wc(s)||!Wc(o))return null;var te=s+(Dn(z)?z:0),ie=o+(Dn(F)?F:0),le;switch(N){case"start":le=Gce("calc(".concat(p,")"));break;case"middle":le=Gce("calc(".concat((L.length-1)/2," * -").concat(i," + (").concat(p," / 2))"));break;default:le=Gce("calc(".concat(L.length-1," * -").concat(i,")"));break}var ye=[];if(y){var ne=L[0].width,ge=T.width;ye.push("scale(".concat((Dn(ge)?ge/ne:1)/ne,")"))}return q&&ye.push("rotate(".concat(q,", ").concat(te,", ").concat(ie,")")),ye.length&&(G.transform=ye.join(" ")),st.createElement("text",Pfe({},Ia(G,!0),{x:te,y:ie,className:si("recharts-text",H),textAnchor:j,fill:E.includes("url")?RSe:E}),L.map(function(ae,he){var ue=ae.words.join(Z?"":" ");return st.createElement("tspan",{x:te,dy:he===0?le:i,key:"".concat(ue,"-").concat(he)},ue)}))};function I1(t,e){return t==null||e==null?NaN:te?1:t>=e?0:NaN}function GLt(t,e){return t==null||e==null?NaN:et?1:e>=t?0:NaN}function Gye(t){let e,n,s;t.length!==2?(e=I1,n=(i,h)=>I1(t(i),h),s=(i,h)=>t(i)-h):(e=t===I1||t===GLt?t:KLt,n=t,s=t);function a(i,h,p=0,x=i.length){if(p>>1;n(i[y],h)<0?p=y+1:x=y}while(p>>1;n(i[y],h)<=0?p=y+1:x=y}while(pp&&s(i[y-1],h)>-s(i[y],h)?y-1:y}return{left:a,center:l,right:o}}function KLt(){return 0}function K7e(t){return t===null?NaN:+t}function*ZLt(t,e){for(let n of t)n!=null&&(n=+n)>=n&&(yield n)}const YLt=Gye(I1),$I=YLt.right;Gye(K7e).center;class FSe extends Map{constructor(e,n=JLt){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(zSe(this,e))}has(e){return super.has(zSe(this,e))}set(e,n){return super.set(XLt(this,e),n)}delete(e){return super.delete(QLt(this,e))}}function zSe({_intern:t,_key:e},n){const s=e(n);return t.has(s)?t.get(s):n}function XLt({_intern:t,_key:e},n){const s=e(n);return t.has(s)?t.get(s):(t.set(s,n),n)}function QLt({_intern:t,_key:e},n){const s=e(n);return t.has(s)&&(n=t.get(s),t.delete(s)),n}function JLt(t){return t!==null&&typeof t=="object"?t.valueOf():t}function eOt(t=I1){if(t===I1)return Z7e;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 Z7e(t,e){return(t==null||!(t>=t))-(e==null||!(e>=e))||(te?1:0)}const tOt=Math.sqrt(50),rOt=Math.sqrt(10),nOt=Math.sqrt(2);function jre(t,e,n){const s=(e-t)/Math.max(0,n),a=Math.floor(Math.log10(s)),o=s/Math.pow(10,a),l=o>=tOt?10:o>=rOt?5:o>=nOt?2:1;let i,h,p;return a<0?(p=Math.pow(10,-a)/l,i=Math.round(t*p),h=Math.round(e*p),i/pe&&--h,p=-p):(p=Math.pow(10,a)*l,i=Math.round(t/p),h=Math.round(e/p),i*pe&&--h),h0))return[];if(t===e)return[t];const s=e=a))return[];const i=o-a+1,h=new Array(i);if(s)if(l<0)for(let p=0;p=s)&&(n=s);return n}function $Se(t,e){let n;for(const s of t)s!=null&&(n>s||n===void 0&&s>=s)&&(n=s);return n}function Y7e(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?Z7e:eOt(a);s>n;){if(s-n>600){const h=s-n+1,p=e-n+1,x=Math.log(h),y=.5*Math.exp(2*x/3),b=.5*Math.sqrt(x*y*(h-y)/h)*(p-h/2<0?-1:1),j=Math.max(n,Math.floor(e-p*y/h+b)),C=Math.min(s,Math.floor(e+(h-p)*y/h+b));Y7e(t,e,j,C,a)}const o=t[e];let l=n,i=s;for(VM(t,n,e),a(t[s],o)>0&&VM(t,n,s);l0;)--i}a(t[n],o)===0?VM(t,n,i):(++i,VM(t,i,s)),i<=e&&(n=i+1),e<=i&&(s=i-1)}return t}function VM(t,e,n){const s=t[e];t[e]=t[n],t[n]=s}function sOt(t,e,n){if(t=Float64Array.from(ZLt(t)),!(!(s=t.length)||isNaN(e=+e))){if(e<=0||s<2)return $Se(t);if(e>=1)return BSe(t);var s,a=(s-1)*e,o=Math.floor(a),l=BSe(Y7e(t,o).subarray(0,o+1)),i=$Se(t.subarray(o+1));return l+(i-l)*(a-o)}}function aOt(t,e,n=K7e){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 iOt(t,e,n){t=+t,e=+e,n=(a=arguments.length)<2?(e=t,t=0,1):a<3?1:+n;for(var s=-1,a=Math.max(0,Math.ceil((e-t)/n))|0,o=new Array(a);++s>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):n===8?HL(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):n===4?HL(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|e&240,((e&15)<<4|e&15)/255):null):(e=lOt.exec(t))?new ph(e[1],e[2],e[3],1):(e=cOt.exec(t))?new ph(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=dOt.exec(t))?HL(e[1],e[2],e[3],e[4]):(e=uOt.exec(t))?HL(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=hOt.exec(t))?KSe(e[1],e[2]/100,e[3]/100,1):(e=fOt.exec(t))?KSe(e[1],e[2]/100,e[3]/100,e[4]):USe.hasOwnProperty(t)?HSe(USe[t]):t==="transparent"?new ph(NaN,NaN,NaN,0):null}function HSe(t){return new ph(t>>16&255,t>>8&255,t&255,1)}function HL(t,e,n,s){return s<=0&&(t=e=n=NaN),new ph(t,e,n,s)}function gOt(t){return t instanceof UI||(t=ME(t)),t?(t=t.rgb(),new ph(t.r,t.g,t.b,t.opacity)):new ph}function Ffe(t,e,n,s){return arguments.length===1?gOt(t):new ph(t,e,n,s??1)}function ph(t,e,n,s){this.r=+t,this.g=+e,this.b=+n,this.opacity=+s}Zye(ph,Ffe,Q7e(UI,{brighter(t){return t=t==null?kre:Math.pow(kre,t),new ph(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?SE:Math.pow(SE,t),new ph(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new ph(Mj(this.r),Mj(this.g),Mj(this.b),Nre(this.opacity))},displayable(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:WSe,formatHex:WSe,formatHex8:xOt,formatRgb:GSe,toString:GSe}));function WSe(){return`#${Ww(this.r)}${Ww(this.g)}${Ww(this.b)}`}function xOt(){return`#${Ww(this.r)}${Ww(this.g)}${Ww(this.b)}${Ww((isNaN(this.opacity)?1:this.opacity)*255)}`}function GSe(){const t=Nre(this.opacity);return`${t===1?"rgb(":"rgba("}${Mj(this.r)}, ${Mj(this.g)}, ${Mj(this.b)}${t===1?")":`, ${t})`}`}function Nre(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function Mj(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function Ww(t){return t=Mj(t),(t<16?"0":"")+t.toString(16)}function KSe(t,e,n,s){return s<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new sm(t,e,n,s)}function J7e(t){if(t instanceof sm)return new sm(t.h,t.s,t.l,t.opacity);if(t instanceof UI||(t=ME(t)),!t)return new sm;if(t instanceof sm)return t;t=t.rgb();var e=t.r/255,n=t.g/255,s=t.b/255,a=Math.min(e,n,s),o=Math.max(e,n,s),l=NaN,i=o-a,h=(o+a)/2;return i?(e===o?l=(n-s)/i+(n0&&h<1?0:l,new sm(l,i,h,t.opacity)}function yOt(t,e,n,s){return arguments.length===1?J7e(t):new sm(t,e,n,s??1)}function sm(t,e,n,s){this.h=+t,this.s=+e,this.l=+n,this.opacity=+s}Zye(sm,yOt,Q7e(UI,{brighter(t){return t=t==null?kre:Math.pow(kre,t),new sm(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?SE:Math.pow(SE,t),new sm(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 ph(Kce(t>=240?t-240:t+120,a,s),Kce(t,a,s),Kce(t<120?t+240:t-120,a,s),this.opacity)},clamp(){return new sm(ZSe(this.h),WL(this.s),WL(this.l),Nre(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){const t=Nre(this.opacity);return`${t===1?"hsl(":"hsla("}${ZSe(this.h)}, ${WL(this.s)*100}%, ${WL(this.l)*100}%${t===1?")":`, ${t})`}`}}));function ZSe(t){return t=(t||0)%360,t<0?t+360:t}function WL(t){return Math.max(0,Math.min(1,t||0))}function Kce(t,e,n){return(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)*255}const Yye=t=>()=>t;function vOt(t,e){return function(n){return t+n*e}}function _Ot(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 bOt(t){return(t=+t)==1?e9e:function(e,n){return n-e?_Ot(e,n,t):Yye(isNaN(e)?n:e)}}function e9e(t,e){var n=e-t;return n?vOt(t,n):Yye(isNaN(t)?e:t)}const YSe=function t(e){var n=bOt(e);function s(a,o){var l=n((a=Ffe(a)).r,(o=Ffe(o)).r),i=n(a.g,o.g),h=n(a.b,o.b),p=e9e(a.opacity,o.opacity);return function(x){return a.r=l(x),a.g=i(x),a.b=h(x),a.opacity=p(x),a+""}}return s.gamma=t,s}(1);function wOt(t,e){e||(e=[]);var n=t?Math.min(e.length,t.length):0,s=e.slice(),a;return function(o){for(a=0;an&&(o=e.slice(n,o),i[l]?i[l]+=o:i[++l]=o),(s=s[0])===(a=a[0])?i[l]?i[l]+=a:i[++l]=a:(i[++l]=null,h.push({i:l,x:Sre(s,a)})),n=Zce.lastIndex;return ne&&(n=t,t=e,e=n),function(s){return Math.max(t,Math.min(e,s))}}function POt(t,e,n){var s=t[0],a=t[1],o=e[0],l=e[1];return a2?LOt:POt,h=p=null,y}function y(b){return b==null||isNaN(b=+b)?o:(h||(h=i(t.map(s),e,n)))(s(l(b)))}return y.invert=function(b){return l(a((p||(p=i(e,t.map(s),Sre)))(b)))},y.domain=function(b){return arguments.length?(t=Array.from(b,Cre),x()):t.slice()},y.range=function(b){return arguments.length?(e=Array.from(b),x()):e.slice()},y.rangeRound=function(b){return e=Array.from(b),n=Xye,x()},y.clamp=function(b){return arguments.length?(l=b?!0:Ou,x()):l!==Ou},y.interpolate=function(b){return arguments.length?(n=b,x()):n},y.unknown=function(b){return arguments.length?(o=b,y):o},function(b,j){return s=b,a=j,x()}}function Qye(){return pae()(Ou,Ou)}function OOt(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)}function Mre(t,e){if((n=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"))<0)return null;var n,s=t.slice(0,n);return[s.length>1?s[0]+s.slice(2):s,+t.slice(n+1)]}function NC(t){return t=Mre(Math.abs(t)),t?t[1]:NaN}function DOt(t,e){return function(n,s){for(var a=n.length,o=[],l=0,i=t[0],h=0;a>0&&i>0&&(h+i+1>s&&(i=Math.max(1,s-h)),o.push(n.substring(a-=i,a+i)),!((h+=i+1)>s));)i=t[l=(l+1)%t.length];return o.reverse().join(e)}}function ROt(t){return function(e){return e.replace(/[0-9]/g,function(n){return t[+n]})}}var FOt=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function TE(t){if(!(e=FOt.exec(t)))throw new Error("invalid format: "+t);var e;return new Jye({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}TE.prototype=Jye.prototype;function Jye(t){this.fill=t.fill===void 0?" ":t.fill+"",this.align=t.align===void 0?">":t.align+"",this.sign=t.sign===void 0?"-":t.sign+"",this.symbol=t.symbol===void 0?"":t.symbol+"",this.zero=!!t.zero,this.width=t.width===void 0?void 0:+t.width,this.comma=!!t.comma,this.precision=t.precision===void 0?void 0:+t.precision,this.trim=!!t.trim,this.type=t.type===void 0?"":t.type+""}Jye.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(this.width===void 0?"":Math.max(1,this.width|0))+(this.comma?",":"")+(this.precision===void 0?"":"."+Math.max(0,this.precision|0))+(this.trim?"~":"")+this.type};function zOt(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 t9e;function BOt(t,e){var n=Mre(t,e);if(!n)return t+"";var s=n[0],a=n[1],o=a-(t9e=Math.max(-8,Math.min(8,Math.floor(a/3)))*3)+1,l=s.length;return o===l?s:o>l?s+new Array(o-l+1).join("0"):o>0?s.slice(0,o)+"."+s.slice(o):"0."+new Array(1-o).join("0")+Mre(t,Math.max(0,e+o-1))[0]}function QSe(t,e){var n=Mre(t,e);if(!n)return t+"";var s=n[0],a=n[1];return a<0?"0."+new Array(-a).join("0")+s:s.length>a+1?s.slice(0,a+1)+"."+s.slice(a+1):s+new Array(a-s.length+2).join("0")}const JSe={"%":(t,e)=>(t*100).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:OOt,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)=>QSe(t*100,e),r:QSe,s:BOt,X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function eCe(t){return t}var tCe=Array.prototype.map,rCe=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function $Ot(t){var e=t.grouping===void 0||t.thousands===void 0?eCe:DOt(tCe.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?eCe:ROt(tCe.call(t.numerals,String)),l=t.percent===void 0?"%":t.percent+"",i=t.minus===void 0?"−":t.minus+"",h=t.nan===void 0?"NaN":t.nan+"";function p(y){y=TE(y);var b=y.fill,j=y.align,C=y.sign,N=y.symbol,A=y.zero,E=y.width,T=y.comma,L=y.precision,z=y.trim,F=y.type;F==="n"?(T=!0,F="g"):JSe[F]||(L===void 0&&(L=12),z=!0,F="g"),(A||b==="0"&&j==="=")&&(A=!0,b="0",j="=");var q=N==="$"?n:N==="#"&&/[boxX]/.test(F)?"0"+F.toLowerCase():"",H=N==="$"?s:/[%p]/.test(F)?l:"",Z=JSe[F],G=/[defgprs%]/.test(F);L=L===void 0?6:/[gprs]/.test(F)?Math.max(1,Math.min(21,L)):Math.max(0,Math.min(20,L));function te(ie){var le=q,ye=H,ne,ge,ae;if(F==="c")ye=Z(ie)+ye,ie="";else{ie=+ie;var he=ie<0||1/ie<0;if(ie=isNaN(ie)?h:Z(Math.abs(ie),L),z&&(ie=zOt(ie)),he&&+ie==0&&C!=="+"&&(he=!1),le=(he?C==="("?C:i:C==="-"||C==="("?"":C)+le,ye=(F==="s"?rCe[8+t9e/3]:"")+ye+(he&&C==="("?")":""),G){for(ne=-1,ge=ie.length;++neae||ae>57){ye=(ae===46?a+ie.slice(ne+1):ie.slice(ne))+ye,ie=ie.slice(0,ne);break}}}T&&!A&&(ie=e(ie,1/0));var ue=le.length+ie.length+ye.length,_e=ue>1)+le+ie+ye+_e.slice(ue);break;default:ie=_e+le+ie+ye;break}return o(ie)}return te.toString=function(){return y+""},te}function x(y,b){var j=p((y=TE(y),y.type="f",y)),C=Math.max(-8,Math.min(8,Math.floor(NC(b)/3)))*3,N=Math.pow(10,-C),A=rCe[8+C/3];return function(E){return j(N*E)+A}}return{format:p,formatPrefix:x}}var GL,e0e,r9e;UOt({thousands:",",grouping:[3],currency:["$",""]});function UOt(t){return GL=$Ot(t),e0e=GL.format,r9e=GL.formatPrefix,GL}function qOt(t){return Math.max(0,-NC(Math.abs(t)))}function VOt(t,e){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(NC(e)/3)))*3-NC(Math.abs(t)))}function HOt(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,NC(e)-NC(t))+1}function n9e(t,e,n,s){var a=Dfe(t,e,n),o;switch(s=TE(s??",f"),s.type){case"s":{var l=Math.max(Math.abs(t),Math.abs(e));return s.precision==null&&!isNaN(o=VOt(a,l))&&(s.precision=o),r9e(s,l)}case"":case"e":case"g":case"p":case"r":{s.precision==null&&!isNaN(o=HOt(a,Math.max(Math.abs(t),Math.abs(e))))&&(s.precision=o-(s.type==="e"));break}case"f":case"%":{s.precision==null&&!isNaN(o=qOt(a))&&(s.precision=o-(s.type==="%")*2);break}}return e0e(s)}function hv(t){var e=t.domain;return t.ticks=function(n){var s=e();return Lfe(s[0],s[s.length-1],n??10)},t.tickFormat=function(n,s){var a=e();return n9e(a[0],a[a.length-1],n??10,s)},t.nice=function(n){n==null&&(n=10);var s=e(),a=0,o=s.length-1,l=s[a],i=s[o],h,p,x=10;for(i0;){if(p=Ofe(l,i,n),p===h)return s[a]=l,s[o]=i,e(s);if(p>0)l=Math.floor(l/p)*p,i=Math.ceil(i/p)*p;else if(p<0)l=Math.ceil(l*p)/p,i=Math.floor(i*p)/p;else break;h=p}return t},t}function Tre(){var t=Qye();return t.copy=function(){return qI(t,Tre())},cp.apply(t,arguments),hv(t)}function s9e(t){var e;function n(s){return s==null||isNaN(s=+s)?e:s}return n.invert=n,n.domain=n.range=function(s){return arguments.length?(t=Array.from(s,Cre),n):t.slice()},n.unknown=function(s){return arguments.length?(e=s,n):e},n.copy=function(){return s9e(t).unknown(e)},t=arguments.length?Array.from(t,Cre):[0,1],hv(n)}function a9e(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 YOt(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 aCe(t){return(e,n)=>-t(-e,n)}function t0e(t){const e=t(nCe,sCe),n=e.domain;let s=10,a,o;function l(){return a=YOt(s),o=ZOt(s),n()[0]<0?(a=aCe(a),o=aCe(o),t(WOt,GOt)):t(nCe,sCe),e}return e.base=function(i){return arguments.length?(s=+i,l()):s},e.domain=function(i){return arguments.length?(n(i),l()):n()},e.ticks=i=>{const h=n();let p=h[0],x=h[h.length-1];const y=x0){for(;b<=j;++b)for(C=1;Cx)break;E.push(N)}}else for(;b<=j;++b)for(C=s-1;C>=1;--C)if(N=b>0?C/o(-b):C*o(b),!(Nx)break;E.push(N)}E.length*2{if(i==null&&(i=10),h==null&&(h=s===10?"s":","),typeof h!="function"&&(!(s%1)&&(h=TE(h)).precision==null&&(h.trim=!0),h=e0e(h)),i===1/0)return h;const p=Math.max(1,s*i/e.ticks().length);return x=>{let y=x/o(Math.round(a(x)));return y*sn(a9e(n(),{floor:i=>o(Math.floor(a(i))),ceil:i=>o(Math.ceil(a(i)))})),e}function i9e(){const t=t0e(pae()).domain([1,10]);return t.copy=()=>qI(t,i9e()).base(t.base()),cp.apply(t,arguments),t}function iCe(t){return function(e){return Math.sign(e)*Math.log1p(Math.abs(e/t))}}function oCe(t){return function(e){return Math.sign(e)*Math.expm1(Math.abs(e))*t}}function r0e(t){var e=1,n=t(iCe(e),oCe(e));return n.constant=function(s){return arguments.length?t(iCe(e=+s),oCe(e)):e},hv(n)}function o9e(){var t=r0e(pae());return t.copy=function(){return qI(t,o9e()).constant(t.constant())},cp.apply(t,arguments)}function lCe(t){return function(e){return e<0?-Math.pow(-e,t):Math.pow(e,t)}}function XOt(t){return t<0?-Math.sqrt(-t):Math.sqrt(t)}function QOt(t){return t<0?-t*t:t*t}function n0e(t){var e=t(Ou,Ou),n=1;function s(){return n===1?t(Ou,Ou):n===.5?t(XOt,QOt):t(lCe(n),lCe(1/n))}return e.exponent=function(a){return arguments.length?(n=+a,s()):n},hv(e)}function s0e(){var t=n0e(pae());return t.copy=function(){return qI(t,s0e()).exponent(t.exponent())},cp.apply(t,arguments),t}function JOt(){return s0e.apply(null,arguments).exponent(.5)}function cCe(t){return Math.sign(t)*t*t}function e8t(t){return Math.sign(t)*Math.sqrt(Math.abs(t))}function l9e(){var t=Qye(),e=[0,1],n=!1,s;function a(o){var l=e8t(t(o));return isNaN(l)?s:n?Math.round(l):l}return a.invert=function(o){return t.invert(cCe(o))},a.domain=function(o){return arguments.length?(t.domain(o),a):t.domain()},a.range=function(o){return arguments.length?(t.range((e=Array.from(o,Cre)).map(cCe)),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 l9e(t.domain(),e).round(n).clamp(t.clamp()).unknown(s)},cp.apply(a,arguments),hv(a)}function c9e(){var t=[],e=[],n=[],s;function a(){var l=0,i=Math.max(1,e.length);for(n=new Array(i-1);++l0?n[i-1]:t[0],i=n?[s[n-1],e]:[s[p-1],s[p]]},l.unknown=function(h){return arguments.length&&(o=h),l},l.thresholds=function(){return s.slice()},l.copy=function(){return d9e().domain([t,e]).range(a).unknown(o)},cp.apply(hv(l),arguments)}function u9e(){var t=[.5],e=[0,1],n,s=1;function a(o){return o!=null&&o<=o?e[$I(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 u9e().domain(t).range(e).unknown(n)},cp.apply(a,arguments)}const Yce=new Date,Xce=new Date;function Yc(t,e,n,s){function a(o){return t(o=arguments.length===0?new Date:new Date(+o)),o}return a.floor=o=>(t(o=new Date(+o)),o),a.ceil=o=>(t(o=new Date(o-1)),e(o,1),t(o),o),a.round=o=>{const l=a(o),i=a.ceil(o);return o-l(e(o=new Date(+o),l==null?1:Math.floor(l)),o),a.range=(o,l,i)=>{const h=[];if(o=a.ceil(o),i=i==null?1:Math.floor(i),!(o0))return h;let p;do h.push(p=new Date(+o)),e(o,i),t(o);while(pYc(l=>{if(l>=l)for(;t(l),!o(l);)l.setTime(l-1)},(l,i)=>{if(l>=l)if(i<0)for(;++i<=0;)for(;e(l,-1),!o(l););else for(;--i>=0;)for(;e(l,1),!o(l););}),n&&(a.count=(o,l)=>(Yce.setTime(+o),Xce.setTime(+l),t(Yce),t(Xce),Math.floor(n(Yce,Xce))),a.every=o=>(o=Math.floor(o),!isFinite(o)||!(o>0)?null:o>1?a.filter(s?l=>s(l)%o===0:l=>a.count(0,l)%o===0):a)),a}const Are=Yc(()=>{},(t,e)=>{t.setTime(+t+e)},(t,e)=>e-t);Are.every=t=>(t=Math.floor(t),!isFinite(t)||!(t>0)?null:t>1?Yc(e=>{e.setTime(Math.floor(e/t)*t)},(e,n)=>{e.setTime(+e+n*t)},(e,n)=>(n-e)/t):Are);Are.range;const Ox=1e3,Wf=Ox*60,Dx=Wf*60,iy=Dx*24,a0e=iy*7,dCe=iy*30,Qce=iy*365,Gw=Yc(t=>{t.setTime(t-t.getMilliseconds())},(t,e)=>{t.setTime(+t+e*Ox)},(t,e)=>(e-t)/Ox,t=>t.getUTCSeconds());Gw.range;const i0e=Yc(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*Ox)},(t,e)=>{t.setTime(+t+e*Wf)},(t,e)=>(e-t)/Wf,t=>t.getMinutes());i0e.range;const o0e=Yc(t=>{t.setUTCSeconds(0,0)},(t,e)=>{t.setTime(+t+e*Wf)},(t,e)=>(e-t)/Wf,t=>t.getUTCMinutes());o0e.range;const l0e=Yc(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*Ox-t.getMinutes()*Wf)},(t,e)=>{t.setTime(+t+e*Dx)},(t,e)=>(e-t)/Dx,t=>t.getHours());l0e.range;const c0e=Yc(t=>{t.setUTCMinutes(0,0,0)},(t,e)=>{t.setTime(+t+e*Dx)},(t,e)=>(e-t)/Dx,t=>t.getUTCHours());c0e.range;const VI=Yc(t=>t.setHours(0,0,0,0),(t,e)=>t.setDate(t.getDate()+e),(t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*Wf)/iy,t=>t.getDate()-1);VI.range;const mae=Yc(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/iy,t=>t.getUTCDate()-1);mae.range;const h9e=Yc(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/iy,t=>Math.floor(t/iy));h9e.range;function uk(t){return Yc(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())*Wf)/a0e)}const gae=uk(0),Ere=uk(1),t8t=uk(2),r8t=uk(3),SC=uk(4),n8t=uk(5),s8t=uk(6);gae.range;Ere.range;t8t.range;r8t.range;SC.range;n8t.range;s8t.range;function hk(t){return Yc(e=>{e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)},(e,n)=>{e.setUTCDate(e.getUTCDate()+n*7)},(e,n)=>(n-e)/a0e)}const xae=hk(0),Ire=hk(1),a8t=hk(2),i8t=hk(3),CC=hk(4),o8t=hk(5),l8t=hk(6);xae.range;Ire.range;a8t.range;i8t.range;CC.range;o8t.range;l8t.range;const d0e=Yc(t=>{t.setDate(1),t.setHours(0,0,0,0)},(t,e)=>{t.setMonth(t.getMonth()+e)},(t,e)=>e.getMonth()-t.getMonth()+(e.getFullYear()-t.getFullYear())*12,t=>t.getMonth());d0e.range;const u0e=Yc(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 oy=Yc(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());oy.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:Yc(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)});oy.range;const ly=Yc(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());ly.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:Yc(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)});ly.range;function f9e(t,e,n,s,a,o){const l=[[Gw,1,Ox],[Gw,5,5*Ox],[Gw,15,15*Ox],[Gw,30,30*Ox],[o,1,Wf],[o,5,5*Wf],[o,15,15*Wf],[o,30,30*Wf],[a,1,Dx],[a,3,3*Dx],[a,6,6*Dx],[a,12,12*Dx],[s,1,iy],[s,2,2*iy],[n,1,a0e],[e,1,dCe],[e,3,3*dCe],[t,1,Qce]];function i(p,x,y){const b=xA).right(l,b);if(j===l.length)return t.every(Dfe(p/Qce,x/Qce,y));if(j===0)return Are.every(Math.max(Dfe(p,x,y),1));const[C,N]=l[b/l[j-1][2]53)return null;"w"in Te||(Te.w=1),"Z"in Te?(pe=ede(HM(Te.y,0,1)),yt=pe.getUTCDay(),pe=yt>4||yt===0?Ire.ceil(pe):Ire(pe),pe=mae.offset(pe,(Te.V-1)*7),Te.y=pe.getUTCFullYear(),Te.m=pe.getUTCMonth(),Te.d=pe.getUTCDate()+(Te.w+6)%7):(pe=Jce(HM(Te.y,0,1)),yt=pe.getDay(),pe=yt>4||yt===0?Ere.ceil(pe):Ere(pe),pe=VI.offset(pe,(Te.V-1)*7),Te.y=pe.getFullYear(),Te.m=pe.getMonth(),Te.d=pe.getDate()+(Te.w+6)%7)}else("W"in Te||"U"in Te)&&("w"in Te||(Te.w="u"in Te?Te.u%7:"W"in Te?1:0),yt="Z"in Te?ede(HM(Te.y,0,1)).getUTCDay():Jce(HM(Te.y,0,1)).getDay(),Te.m=0,Te.d="W"in Te?(Te.w+6)%7+Te.W*7-(yt+5)%7:Te.w+Te.U*7-(yt+6)%7);return"Z"in Te?(Te.H+=Te.Z/100|0,Te.M+=Te.Z%100,ede(Te)):Jce(Te)}}function Z(Re,je,et,Te){for(var Ze=0,pe=je.length,yt=et.length,rt,at;Ze=yt)return-1;if(rt=je.charCodeAt(Ze++),rt===37){if(rt=je.charAt(Ze++),at=F[rt in uCe?je.charAt(Ze++):rt],!at||(Te=at(Re,et,Te))<0)return-1}else if(rt!=et.charCodeAt(Te++))return-1}return Te}function G(Re,je,et){var Te=p.exec(je.slice(et));return Te?(Re.p=x.get(Te[0].toLowerCase()),et+Te[0].length):-1}function te(Re,je,et){var Te=j.exec(je.slice(et));return Te?(Re.w=C.get(Te[0].toLowerCase()),et+Te[0].length):-1}function ie(Re,je,et){var Te=y.exec(je.slice(et));return Te?(Re.w=b.get(Te[0].toLowerCase()),et+Te[0].length):-1}function le(Re,je,et){var Te=E.exec(je.slice(et));return Te?(Re.m=T.get(Te[0].toLowerCase()),et+Te[0].length):-1}function ye(Re,je,et){var Te=N.exec(je.slice(et));return Te?(Re.m=A.get(Te[0].toLowerCase()),et+Te[0].length):-1}function ne(Re,je,et){return Z(Re,e,je,et)}function ge(Re,je,et){return Z(Re,n,je,et)}function ae(Re,je,et){return Z(Re,s,je,et)}function he(Re){return l[Re.getDay()]}function ue(Re){return o[Re.getDay()]}function _e(Re){return h[Re.getMonth()]}function Ae(Re){return i[Re.getMonth()]}function Ce(Re){return a[+(Re.getHours()>=12)]}function be(Re){return 1+~~(Re.getMonth()/3)}function me(Re){return l[Re.getUTCDay()]}function Le(Re){return o[Re.getUTCDay()]}function Ne(Re){return h[Re.getUTCMonth()]}function Be(Re){return i[Re.getUTCMonth()]}function Ee(Re){return a[+(Re.getUTCHours()>=12)]}function Ue(Re){return 1+~~(Re.getUTCMonth()/3)}return{format:function(Re){var je=q(Re+="",L);return je.toString=function(){return Re},je},parse:function(Re){var je=H(Re+="",!1);return je.toString=function(){return Re},je},utcFormat:function(Re){var je=q(Re+="",z);return je.toString=function(){return Re},je},utcParse:function(Re){var je=H(Re+="",!0);return je.toString=function(){return Re},je}}}var uCe={"-":"",_:" ",0:"0"},vd=/^\s*\d+/,p8t=/^%/,m8t=/[\\^$*+?|[\]().{}]/g;function ao(t,e,n){var s=t<0?"-":"",a=(s?-t:t)+"",o=a.length;return s+(o[e.toLowerCase(),n]))}function x8t(t,e,n){var s=vd.exec(e.slice(n,n+1));return s?(t.w=+s[0],n+s[0].length):-1}function y8t(t,e,n){var s=vd.exec(e.slice(n,n+1));return s?(t.u=+s[0],n+s[0].length):-1}function v8t(t,e,n){var s=vd.exec(e.slice(n,n+2));return s?(t.U=+s[0],n+s[0].length):-1}function _8t(t,e,n){var s=vd.exec(e.slice(n,n+2));return s?(t.V=+s[0],n+s[0].length):-1}function b8t(t,e,n){var s=vd.exec(e.slice(n,n+2));return s?(t.W=+s[0],n+s[0].length):-1}function hCe(t,e,n){var s=vd.exec(e.slice(n,n+4));return s?(t.y=+s[0],n+s[0].length):-1}function fCe(t,e,n){var s=vd.exec(e.slice(n,n+2));return s?(t.y=+s[0]+(+s[0]>68?1900:2e3),n+s[0].length):-1}function w8t(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 j8t(t,e,n){var s=vd.exec(e.slice(n,n+1));return s?(t.q=s[0]*3-3,n+s[0].length):-1}function k8t(t,e,n){var s=vd.exec(e.slice(n,n+2));return s?(t.m=s[0]-1,n+s[0].length):-1}function pCe(t,e,n){var s=vd.exec(e.slice(n,n+2));return s?(t.d=+s[0],n+s[0].length):-1}function N8t(t,e,n){var s=vd.exec(e.slice(n,n+3));return s?(t.m=0,t.d=+s[0],n+s[0].length):-1}function mCe(t,e,n){var s=vd.exec(e.slice(n,n+2));return s?(t.H=+s[0],n+s[0].length):-1}function S8t(t,e,n){var s=vd.exec(e.slice(n,n+2));return s?(t.M=+s[0],n+s[0].length):-1}function C8t(t,e,n){var s=vd.exec(e.slice(n,n+2));return s?(t.S=+s[0],n+s[0].length):-1}function M8t(t,e,n){var s=vd.exec(e.slice(n,n+3));return s?(t.L=+s[0],n+s[0].length):-1}function T8t(t,e,n){var s=vd.exec(e.slice(n,n+6));return s?(t.L=Math.floor(s[0]/1e3),n+s[0].length):-1}function A8t(t,e,n){var s=p8t.exec(e.slice(n,n+1));return s?n+s[0].length:-1}function E8t(t,e,n){var s=vd.exec(e.slice(n));return s?(t.Q=+s[0],n+s[0].length):-1}function I8t(t,e,n){var s=vd.exec(e.slice(n));return s?(t.s=+s[0],n+s[0].length):-1}function gCe(t,e){return ao(t.getDate(),e,2)}function P8t(t,e){return ao(t.getHours(),e,2)}function L8t(t,e){return ao(t.getHours()%12||12,e,2)}function O8t(t,e){return ao(1+VI.count(oy(t),t),e,3)}function p9e(t,e){return ao(t.getMilliseconds(),e,3)}function D8t(t,e){return p9e(t,e)+"000"}function R8t(t,e){return ao(t.getMonth()+1,e,2)}function F8t(t,e){return ao(t.getMinutes(),e,2)}function z8t(t,e){return ao(t.getSeconds(),e,2)}function B8t(t){var e=t.getDay();return e===0?7:e}function $8t(t,e){return ao(gae.count(oy(t)-1,t),e,2)}function m9e(t){var e=t.getDay();return e>=4||e===0?SC(t):SC.ceil(t)}function U8t(t,e){return t=m9e(t),ao(SC.count(oy(t),t)+(oy(t).getDay()===4),e,2)}function q8t(t){return t.getDay()}function V8t(t,e){return ao(Ere.count(oy(t)-1,t),e,2)}function H8t(t,e){return ao(t.getFullYear()%100,e,2)}function W8t(t,e){return t=m9e(t),ao(t.getFullYear()%100,e,2)}function G8t(t,e){return ao(t.getFullYear()%1e4,e,4)}function K8t(t,e){var n=t.getDay();return t=n>=4||n===0?SC(t):SC.ceil(t),ao(t.getFullYear()%1e4,e,4)}function Z8t(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+ao(e/60|0,"0",2)+ao(e%60,"0",2)}function xCe(t,e){return ao(t.getUTCDate(),e,2)}function Y8t(t,e){return ao(t.getUTCHours(),e,2)}function X8t(t,e){return ao(t.getUTCHours()%12||12,e,2)}function Q8t(t,e){return ao(1+mae.count(ly(t),t),e,3)}function g9e(t,e){return ao(t.getUTCMilliseconds(),e,3)}function J8t(t,e){return g9e(t,e)+"000"}function eDt(t,e){return ao(t.getUTCMonth()+1,e,2)}function tDt(t,e){return ao(t.getUTCMinutes(),e,2)}function rDt(t,e){return ao(t.getUTCSeconds(),e,2)}function nDt(t){var e=t.getUTCDay();return e===0?7:e}function sDt(t,e){return ao(xae.count(ly(t)-1,t),e,2)}function x9e(t){var e=t.getUTCDay();return e>=4||e===0?CC(t):CC.ceil(t)}function aDt(t,e){return t=x9e(t),ao(CC.count(ly(t),t)+(ly(t).getUTCDay()===4),e,2)}function iDt(t){return t.getUTCDay()}function oDt(t,e){return ao(Ire.count(ly(t)-1,t),e,2)}function lDt(t,e){return ao(t.getUTCFullYear()%100,e,2)}function cDt(t,e){return t=x9e(t),ao(t.getUTCFullYear()%100,e,2)}function dDt(t,e){return ao(t.getUTCFullYear()%1e4,e,4)}function uDt(t,e){var n=t.getUTCDay();return t=n>=4||n===0?CC(t):CC.ceil(t),ao(t.getUTCFullYear()%1e4,e,4)}function hDt(){return"+0000"}function yCe(){return"%"}function vCe(t){return+t}function _Ce(t){return Math.floor(+t/1e3)}var p4,y9e,v9e;fDt({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 fDt(t){return p4=f8t(t),y9e=p4.format,p4.parse,v9e=p4.utcFormat,p4.utcParse,p4}function pDt(t){return new Date(t)}function mDt(t){return t instanceof Date?+t:+new Date(+t)}function h0e(t,e,n,s,a,o,l,i,h,p){var x=Qye(),y=x.invert,b=x.domain,j=p(".%L"),C=p(":%S"),N=p("%I:%M"),A=p("%I %p"),E=p("%a %d"),T=p("%b %d"),L=p("%B"),z=p("%Y");function F(q){return(h(q)e(a/(t.length-1)))},n.quantiles=function(s){return Array.from({length:s+1},(a,o)=>sOt(t,o/s))},n.copy=function(){return j9e(e).domain(t)},gy.apply(n,arguments)}function vae(){var t=0,e=.5,n=1,s=1,a,o,l,i,h,p=Ou,x,y=!1,b;function j(N){return isNaN(N=+N)?b:(N=.5+((N=+x(N))-o)*(s*Ne}var C9e=wDt,jDt=_ae,kDt=C9e,NDt=b3;function SDt(t){return t&&t.length?jDt(t,NDt,kDt):void 0}var CDt=SDt;const bae=Hi(CDt);function MDt(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)*cl;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 Yx(this,new this.constructor(t))};bs.dividedToIntegerBy=bs.idiv=function(t){var e=this,n=e.constructor;return Fo(Yx(e,new n(t),0,1),n.precision)};bs.equals=bs.eq=function(t){return!this.cmp(t)};bs.exponent=function(){return Ic(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(Zh))throw Error(sp+"NaN");if(n.s<1)throw Error(sp+(n.s?"NaN":"-Infinity"));return n.eq(Zh)?new s(0):(Nl=!1,e=Yx(AE(n,o),AE(t,o),o),Nl=!0,Fo(e,a))};bs.minus=bs.sub=function(t){var e=this;return t=new e.constructor(t),e.s==t.s?I9e(e,t):A9e(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(sp+"NaN");return n.s?(Nl=!1,e=Yx(n,t,0,1).times(t),Nl=!0,n.minus(e)):Fo(new s(n),a)};bs.naturalExponential=bs.exp=function(){return E9e(this)};bs.naturalLogarithm=bs.ln=function(){return AE(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?A9e(e,t):I9e(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(Tj+t);if(e=Ic(a)+1,s=a.d.length-1,n=s*cl+1,s=a.d[s],s){for(;s%10==0;s/=10)n--;for(s=a.d[0];s>=10;s/=10)n++}return t&&e>n?e:n};bs.squareRoot=bs.sqrt=function(){var t,e,n,s,a,o,l,i=this,h=i.constructor;if(i.s<1){if(!i.s)return new h(0);throw Error(sp+"NaN")}for(t=Ic(i),Nl=!1,a=Math.sqrt(+i),a==0||a==1/0?(e=ug(i.d),(e.length+t)%2==0&&(e+="0"),a=Math.sqrt(e),t=N3((t+1)/2)-(t<0||t%2),a==1/0?e="5e"+t:(e=a.toExponential(),e=e.slice(0,e.indexOf("e")+1)+t),s=new h(e)):s=new h(a.toString()),n=h.precision,a=l=n+3;;)if(o=s,s=o.plus(Yx(i,o,l+2)).times(.5),ug(o.d).slice(0,l)===(e=ug(s.d)).slice(0,l)){if(e=e.slice(l-3,l+1),a==l&&e=="4999"){if(Fo(o,n+1,0),o.times(o).eq(i)){s=o;break}}else if(e!="9999")break;l+=4}return Nl=!0,Fo(s,n)};bs.times=bs.mul=function(t){var e,n,s,a,o,l,i,h,p,x=this,y=x.constructor,b=x.d,j=(t=new y(t)).d;if(!x.s||!t.s)return new y(0);for(t.s*=x.s,n=x.e+t.e,h=b.length,p=j.length,h=0;){for(e=0,a=h+s;a>s;)i=o[a]+j[s]*b[a-s-1]+e,o[a--]=i%id|0,e=i/id|0;o[a]=(o[a]+e)%id|0}for(;!o[--l];)o.pop();return e?++n:o.shift(),t.d=o,t.e=n,Nl?Fo(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:(Dg(t,0,k3),e===void 0?e=s.rounding:Dg(e,0,8),Fo(n,t+Ic(n)+1,e))};bs.toExponential=function(t,e){var n,s=this,a=s.constructor;return t===void 0?n=Jj(s,!0):(Dg(t,0,k3),e===void 0?e=a.rounding:Dg(e,0,8),s=Fo(new a(s),t+1,e),n=Jj(s,!0,t+1)),n};bs.toFixed=function(t,e){var n,s,a=this,o=a.constructor;return t===void 0?Jj(a):(Dg(t,0,k3),e===void 0?e=o.rounding:Dg(e,0,8),s=Fo(new o(a),t+Ic(a)+1,e),n=Jj(s.abs(),!1,t+Ic(s)+1),a.isneg()&&!a.isZero()?"-"+n:n)};bs.toInteger=bs.toint=function(){var t=this,e=t.constructor;return Fo(new e(t),Ic(t)+1,e.rounding)};bs.toNumber=function(){return+this};bs.toPower=bs.pow=function(t){var e,n,s,a,o,l,i=this,h=i.constructor,p=12,x=+(t=new h(t));if(!t.s)return new h(Zh);if(i=new h(i),!i.s){if(t.s<1)throw Error(sp+"Infinity");return i}if(i.eq(Zh))return i;if(s=h.precision,t.eq(Zh))return Fo(i,s);if(e=t.e,n=t.d.length-1,l=e>=n,o=i.s,l){if((n=x<0?-x:x)<=T9e){for(a=new h(Zh),e=Math.ceil(s/cl+4),Nl=!1;n%2&&(a=a.times(i),jCe(a.d,e)),n=N3(n/2),n!==0;)i=i.times(i),jCe(i.d,e);return Nl=!0,t.s<0?new h(Zh).div(a):Fo(a,s)}}else if(o<0)throw Error(sp+"NaN");return o=o<0&&t.d[Math.max(e,n)]&1?-1:1,i.s=1,Nl=!1,a=t.times(AE(i,s+p)),Nl=!0,a=E9e(a),a.s=o,a};bs.toPrecision=function(t,e){var n,s,a=this,o=a.constructor;return t===void 0?(n=Ic(a),s=Jj(a,n<=o.toExpNeg||n>=o.toExpPos)):(Dg(t,1,k3),e===void 0?e=o.rounding:Dg(e,0,8),a=Fo(new o(a),t,e),n=Ic(a),s=Jj(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):(Dg(t,1,k3),e===void 0?e=s.rounding:Dg(e,0,8)),Fo(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=Ic(t),n=t.constructor;return Jj(t,e<=n.toExpNeg||e>=n.toExpPos)};function A9e(t,e){var n,s,a,o,l,i,h,p,x=t.constructor,y=x.precision;if(!t.s||!e.s)return e.s||(e=new x(t)),Nl?Fo(e,y):e;if(h=t.d,p=e.d,l=t.e,a=e.e,h=h.slice(),o=l-a,o){for(o<0?(s=h,o=-o,i=p.length):(s=p,a=l,i=h.length),l=Math.ceil(y/cl),i=l>i?l+1:i+1,o>i&&(o=i,s.length=1),s.reverse();o--;)s.push(0);s.reverse()}for(i=h.length,o=p.length,i-o<0&&(o=i,s=p,p=h,h=s),n=0;o;)n=(h[--o]=h[o]+p[o]+n)/id|0,h[o]%=id;for(n&&(h.unshift(n),++a),i=h.length;h[--i]==0;)h.pop();return e.d=h,e.e=a,Nl?Fo(e,y):e}function Dg(t,e,n){if(t!==~~t||tn)throw Error(Tj+t)}function ug(t){var e,n,s,a=t.length-1,o="",l=t[0];if(a>0){for(o+=l,e=1;el?1:-1;else for(i=h=0;ia[i]?1:-1;break}return h}function n(s,a,o){for(var l=0;o--;)s[o]-=l,l=s[o]1;)s.shift()}return function(s,a,o,l){var i,h,p,x,y,b,j,C,N,A,E,T,L,z,F,q,H,Z,G=s.constructor,te=s.s==a.s?1:-1,ie=s.d,le=a.d;if(!s.s)return new G(s);if(!a.s)throw Error(sp+"Division by zero");for(h=s.e-a.e,H=le.length,F=ie.length,j=new G(te),C=j.d=[],p=0;le[p]==(ie[p]||0);)++p;if(le[p]>(ie[p]||0)&&--h,o==null?T=o=G.precision:l?T=o+(Ic(s)-Ic(a))+1:T=o,T<0)return new G(0);if(T=T/cl+2|0,p=0,H==1)for(x=0,le=le[0],T++;(p1&&(le=t(le,x),ie=t(ie,x),H=le.length,F=ie.length),z=H,N=ie.slice(0,H),A=N.length;A=id/2&&++q;do x=0,i=e(le,N,H,A),i<0?(E=N[0],H!=A&&(E=E*id+(N[1]||0)),x=E/q|0,x>1?(x>=id&&(x=id-1),y=t(le,x),b=y.length,A=N.length,i=e(y,N,b,A),i==1&&(x--,n(y,H16)throw Error(m0e+Ic(t));if(!t.s)return new x(Zh);for(Nl=!1,i=y,l=new x(.03125);t.abs().gte(.1);)t=t.times(l),p+=5;for(s=Math.log(Tw(2,p))/Math.LN10*2+5|0,i+=s,n=a=o=new x(Zh),x.precision=i;;){if(a=Fo(a.times(t),i),n=n.times(++h),l=o.plus(Yx(a,n,i)),ug(l.d).slice(0,i)===ug(o.d).slice(0,i)){for(;p--;)o=Fo(o.times(o),i);return x.precision=y,e==null?(Nl=!0,Fo(o,y)):o}o=l}}function Ic(t){for(var e=t.e*cl,n=t.d[0];n>=10;n/=10)e++;return e}function tde(t,e,n){if(e>t.LN10.sd())throw Nl=!0,n&&(t.precision=n),Error(sp+"LN10 precision limit exceeded");return Fo(new t(t.LN10),e)}function N0(t){for(var e="";t--;)e+="0";return e}function AE(t,e){var n,s,a,o,l,i,h,p,x,y=1,b=10,j=t,C=j.d,N=j.constructor,A=N.precision;if(j.s<1)throw Error(sp+(j.s?"NaN":"-Infinity"));if(j.eq(Zh))return new N(0);if(e==null?(Nl=!1,p=A):p=e,j.eq(10))return e==null&&(Nl=!0),tde(N,p);if(p+=b,N.precision=p,n=ug(C),s=n.charAt(0),o=Ic(j),Math.abs(o)<15e14){for(;s<7&&s!=1||s==1&&n.charAt(1)>3;)j=j.times(t),n=ug(j.d),s=n.charAt(0),y++;o=Ic(j),s>1?(j=new N("0."+n),o++):j=new N(s+"."+n.slice(1))}else return h=tde(N,p+2,A).times(o+""),j=AE(new N(s+"."+n.slice(1)),p-b).plus(h),N.precision=A,e==null?(Nl=!0,Fo(j,A)):j;for(i=l=j=Yx(j.minus(Zh),j.plus(Zh),p),x=Fo(j.times(j),p),a=3;;){if(l=Fo(l.times(x),p),h=i.plus(Yx(l,new N(a),p)),ug(h.d).slice(0,p)===ug(i.d).slice(0,p))return i=i.times(2),o!==0&&(i=i.plus(tde(N,p+2,A).times(o+""))),i=Yx(i,new N(y),p),N.precision=A,e==null?(Nl=!0,Fo(i,A)):i;i=h,a+=2}}function wCe(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=N3(n/cl),t.d=[],s=(n+1)%cl,n<0&&(s+=cl),sPre||t.e<-Pre))throw Error(m0e+n)}else t.s=0,t.e=0,t.d=[0];return t}function Fo(t,e,n){var s,a,o,l,i,h,p,x,y=t.d;for(l=1,o=y[0];o>=10;o/=10)l++;if(s=e-l,s<0)s+=cl,a=e,p=y[x=0];else{if(x=Math.ceil((s+1)/cl),o=y.length,x>=o)return t;for(p=o=y[x],l=1;o>=10;o/=10)l++;s%=cl,a=s-cl+l}if(n!==void 0&&(o=Tw(10,l-a-1),i=p/o%10|0,h=e<0||y[x+1]!==void 0||p%o,h=n<4?(i||h)&&(n==0||n==(t.s<0?3:2)):i>5||i==5&&(n==4||h||n==6&&(s>0?a>0?p/Tw(10,l-a):0:y[x-1])%10&1||n==(t.s<0?8:7))),e<1||!y[0])return h?(o=Ic(t),y.length=1,e=e-o-1,y[0]=Tw(10,(cl-e%cl)%cl),t.e=N3(-e/cl)||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=Tw(10,cl-s),y[x]=a>0?(p/Tw(10,l-a)%Tw(10,a)|0)*o:0),h)for(;;)if(x==0){(y[0]+=o)==id&&(y[0]=1,++t.e);break}else{if(y[x]+=o,y[x]!=id)break;y[x--]=0,o=1}for(s=y.length;y[--s]===0;)y.pop();if(Nl&&(t.e>Pre||t.e<-Pre))throw Error(m0e+Ic(t));return t}function I9e(t,e){var n,s,a,o,l,i,h,p,x,y,b=t.constructor,j=b.precision;if(!t.s||!e.s)return e.s?e.s=-e.s:e=new b(t),Nl?Fo(e,j):e;if(h=t.d,y=e.d,s=e.e,p=t.e,h=h.slice(),l=p-s,l){for(x=l<0,x?(n=h,l=-l,i=y.length):(n=y,s=p,i=h.length),a=Math.max(Math.ceil(j/cl),i)+2,l>a&&(l=a,n.length=1),n.reverse(),a=l;a--;)n.push(0);n.reverse()}else{for(a=h.length,i=y.length,x=a0;--a)h[i++]=0;for(a=y.length;a>l;){if(h[--a]0?o=o.charAt(0)+"."+o.slice(1)+N0(s):l>1&&(o=o.charAt(0)+"."+o.slice(1)),o=o+(a<0?"e":"e+")+a):a<0?(o="0."+N0(-a-1)+o,n&&(s=n-l)>0&&(o+=N0(s))):a>=l?(o+=N0(a+1-l),n&&(s=n-a-1)>0&&(o=o+"."+N0(s))):((s=a+1)0&&(a+1===l&&(o+="."),o+=N0(s))),t.s<0?"-"+o:o}function jCe(t,e){if(t.length>e)return t.length=e,!0}function P9e(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(Tj+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 wCe(l,o.toString())}else if(typeof o!="string")throw Error(Tj+o);if(o.charCodeAt(0)===45?(o=o.slice(1),l.s=-1):l.s=1,ZDt.test(o))wCe(l,o);else throw Error(Tj+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=P9e,a.config=a.set=YDt,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(Tj+n+": "+s);if((s=t[n="LN10"])!==void 0)if(s==Math.LN10)this[n]=new this(s);else throw Error(Tj+n+": "+s);return this}var g0e=P9e(KDt);Zh=new g0e(1);const Po=g0e;function XDt(t){return tRt(t)||eRt(t)||JDt(t)||QDt()}function QDt(){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 JDt(t,e){if(t){if(typeof t=="string")return $fe(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return $fe(t,e)}}function eRt(t){if(typeof Symbol<"u"&&Symbol.iterator in Object(t))return Array.from(t)}function tRt(t){if(Array.isArray(t))return $fe(t)}function $fe(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,s=new Array(e);n=e?n.apply(void 0,a):t(e-l,kCe(function(){for(var i=arguments.length,h=new Array(i),p=0;pt.length)&&(e=t.length);for(var n=0,s=new Array(e);n"u"||!(Symbol.iterator in Object(t)))){var n=[],s=!0,a=!1,o=void 0;try{for(var l=t[Symbol.iterator](),i;!(s=(i=l.next()).done)&&(n.push(i.value),!(e&&n.length===e));s=!0);}catch(h){a=!0,o=h}finally{try{!s&&l.return!=null&&l.return()}finally{if(a)throw o}}return n}}function gRt(t){if(Array.isArray(t))return t}function F9e(t){var e=EE(t,2),n=e[0],s=e[1],a=n,o=s;return n>s&&(a=s,o=n),[a,o]}function z9e(t,e,n){if(t.lte(0))return new Po(0);var s=Nae.getDigitCount(t.toNumber()),a=new Po(10).pow(s),o=t.div(a),l=s!==1?.05:.1,i=new Po(Math.ceil(o.div(l).toNumber())).add(n).mul(l),h=i.mul(a);return e?h:new Po(Math.ceil(h))}function xRt(t,e,n){var s=1,a=new Po(t);if(!a.isint()&&n){var o=Math.abs(t);o<1?(s=new Po(10).pow(Nae.getDigitCount(t)-1),a=new Po(Math.floor(a.div(s).toNumber())).mul(s)):o>1&&(a=new Po(Math.floor(t)))}else t===0?a=new Po(Math.floor((e-1)/2)):n||(a=new Po(Math.floor(t)));var l=Math.floor((e-1)/2),i=aRt(sRt(function(h){return a.add(new Po(h-l).mul(s)).toNumber()}),Ufe);return i(0,e)}function B9e(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 Po(0),tickMin:new Po(0),tickMax:new Po(0)};var o=z9e(new Po(e).sub(t).div(n-1),s,a),l;t<=0&&e>=0?l=new Po(0):(l=new Po(t).add(e).div(2),l=l.sub(new Po(l).mod(o)));var i=Math.ceil(l.sub(t).div(o).toNumber()),h=Math.ceil(new Po(e).sub(l).div(o).toNumber()),p=i+h+1;return p>n?B9e(t,e,n,s,a+1):(p0?h+(n-p):h,i=e>0?i:i+(n-p)),{step:o,tickMin:l.sub(new Po(i).mul(o)),tickMax:l.add(new Po(h).mul(o))})}function yRt(t){var e=EE(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=F9e([n,s]),h=EE(i,2),p=h[0],x=h[1];if(p===-1/0||x===1/0){var y=x===1/0?[p].concat(Vfe(Ufe(0,a-1).map(function(){return 1/0}))):[].concat(Vfe(Ufe(0,a-1).map(function(){return-1/0})),[x]);return n>s?qfe(y):y}if(p===x)return xRt(p,a,o);var b=B9e(p,x,l,o),j=b.step,C=b.tickMin,N=b.tickMax,A=Nae.rangeStep(C,N.add(new Po(.1).mul(j)),j);return n>s?qfe(A):A}function vRt(t,e){var n=EE(t,2),s=n[0],a=n[1],o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,l=F9e([s,a]),i=EE(l,2),h=i[0],p=i[1];if(h===-1/0||p===1/0)return[s,a];if(h===p)return[h];var x=Math.max(e,2),y=z9e(new Po(p).sub(h).div(x-1),o,0),b=[].concat(Vfe(Nae.rangeStep(new Po(h),new Po(p).sub(new Po(.99).mul(y)),y)),[p]);return s>a?qfe(b):b}var _Rt=D9e(yRt),bRt=D9e(vRt),wRt="Invariant failed";function ek(t,e){throw new Error(wRt)}var jRt=["offset","layout","width","dataKey","data","dataPointFormatter","xAxis","yAxis"];function MC(t){"@babel/helpers - typeof";return MC=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},MC(t)}function Lre(){return Lre=Object.assign?Object.assign.bind():function(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,s=new Array(e);n=0)&&Object.prototype.propertyIsEnumerable.call(t,s)&&(n[s]=t[s])}return n}function ARt(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 ERt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function IRt(t,e){for(var n=0;nt.length)&&(e=t.length);for(var n=0,s=new Array(e);n1&&arguments[1]!==void 0?arguments[1]:[],a=arguments.length>2?arguments[2]:void 0,o=arguments.length>3?arguments[3]:void 0,l=-1,i=(n=s==null?void 0:s.length)!==null&&n!==void 0?n:0;if(i<=1)return 0;if(o&&o.axisType==="angleAxis"&&Math.abs(Math.abs(o.range[1]-o.range[0])-360)<=1e-6)for(var h=o.range,p=0;p0?a[p-1].coordinate:a[i-1].coordinate,y=a[p].coordinate,b=p>=i-1?a[0].coordinate:a[p+1].coordinate,j=void 0;if(Pu(y-x)!==Pu(b-y)){var C=[];if(Pu(b-y)===Pu(h[1]-h[0])){j=b;var N=y+h[1]-h[0];C[0]=Math.min(N,(N+x)/2),C[1]=Math.max(N,(N+x)/2)}else{j=x;var A=b+h[1]-h[0];C[0]=Math.min(y,(A+y)/2),C[1]=Math.max(y,(A+y)/2)}var E=[Math.min(y,(j+y)/2),Math.max(y,(j+y)/2)];if(e>E[0]&&e<=E[1]||e>=C[0]&&e<=C[1]){l=a[p].index;break}}else{var T=Math.min(x,b),L=Math.max(x,b);if(e>(T+y)/2&&e<=(L+y)/2){l=a[p].index;break}}}else for(var z=0;z0&&z(s[z].coordinate+s[z-1].coordinate)/2&&e<=(s[z].coordinate+s[z+1].coordinate)/2||z===i-1&&e>(s[z].coordinate+s[z-1].coordinate)/2){l=s[z].index;break}return l},x0e=function(e){var n,s=e,a=s.type.displayName,o=(n=e.type)!==null&&n!==void 0&&n.defaultProps?Zl(Zl({},e.type.defaultProps),e.props):e.props,l=o.stroke,i=o.fill,h;switch(a){case"Line":h=l;break;case"Area":case"Radar":h=l&&l!=="none"?l:i;break;default:h=i;break}return h},ZRt=function(e){var n=e.barSize,s=e.totalSize,a=e.stackGroups,o=a===void 0?{}:a;if(!o)return{};for(var l={},i=Object.keys(o),h=0,p=i.length;h=0});if(E&&E.length){var T=E[0].type.defaultProps,L=T!==void 0?Zl(Zl({},T),E[0].props):E[0].props,z=L.barSize,F=L[A];l[F]||(l[F]=[]);var q=vi(z)?n:z;l[F].push({item:E[0],stackList:E.slice(1),barSize:vi(q)?void 0:Lu(q,s,0)})}}return l},YRt=function(e){var n=e.barGap,s=e.barCategoryGap,a=e.bandSize,o=e.sizeList,l=o===void 0?[]:o,i=e.maxBarSize,h=l.length;if(h<1)return null;var p=Lu(n,a,0,!0),x,y=[];if(l[0].barSize===+l[0].barSize){var b=!1,j=a/h,C=l.reduce(function(z,F){return z+F.barSize||0},0);C+=(h-1)*p,C>=a&&(C-=(h-1)*p,p=0),C>=a&&j>0&&(b=!0,j*=.9,C=h*j);var N=(a-C)/2>>0,A={offset:N-p,size:0};x=l.reduce(function(z,F){var q={item:F.item,position:{offset:A.offset+A.size+p,size:b?j:F.barSize}},H=[].concat(CCe(z),[q]);return A=H[H.length-1].position,F.stackList&&F.stackList.length&&F.stackList.forEach(function(Z){H.push({item:Z,position:A})}),H},y)}else{var E=Lu(s,a,0,!0);a-2*E-(h-1)*p<=0&&(p=0);var T=(a-2*E-(h-1)*p)/h;T>1&&(T>>=0);var L=i===+i?Math.min(T,i):T;x=l.reduce(function(z,F,q){var H=[].concat(CCe(z),[{item:F.item,position:{offset:E+(T+p)*q+(T-L)/2,size:L}}]);return F.stackList&&F.stackList.length&&F.stackList.forEach(function(Z){H.push({item:Z,position:H[H.length-1].position})}),H},y)}return x},XRt=function(e,n,s,a){var o=s.children,l=s.width,i=s.margin,h=l-(i.left||0)-(i.right||0),p=V9e({children:o,legendWidth:h});if(p){var x=a||{},y=x.width,b=x.height,j=p.align,C=p.verticalAlign,N=p.layout;if((N==="vertical"||N==="horizontal"&&C==="middle")&&j!=="center"&&Dn(e[j]))return Zl(Zl({},e),{},OS({},j,e[j]+(y||0)));if((N==="horizontal"||N==="vertical"&&j==="center")&&C!=="middle"&&Dn(e[C]))return Zl(Zl({},e),{},OS({},C,e[C]+(b||0)))}return e},QRt=function(e,n,s){return vi(n)?!0:e==="horizontal"?n==="yAxis":e==="vertical"||s==="x"?n==="xAxis":s==="y"?n==="yAxis":!0},H9e=function(e,n,s,a,o){var l=n.props.children,i=tp(l,Sae).filter(function(p){return QRt(a,o,p.props.direction)});if(i&&i.length){var h=i.map(function(p){return p.props.dataKey});return e.reduce(function(p,x){var y=eu(x,s);if(vi(y))return p;var b=Array.isArray(y)?[wae(y),bae(y)]:[y,y],j=h.reduce(function(C,N){var A=eu(x,N,0),E=b[0]-Math.abs(Array.isArray(A)?A[0]:A),T=b[1]+Math.abs(Array.isArray(A)?A[1]:A);return[Math.min(E,C[0]),Math.max(T,C[1])]},[1/0,-1/0]);return[Math.min(j[0],p[0]),Math.max(j[1],p[1])]},[1/0,-1/0])}return null},JRt=function(e,n,s,a,o){var l=n.map(function(i){return H9e(e,i,s,o,a)}).filter(function(i){return!vi(i)});return l&&l.length?l.reduce(function(i,h){return[Math.min(i[0],h[0]),Math.max(i[1],h[1])]},[1/0,-1/0]):null},W9e=function(e,n,s,a,o){var l=n.map(function(h){var p=h.props.dataKey;return s==="number"&&p&&H9e(e,h,p,a)||wA(e,p,s,o)});if(s==="number")return l.reduce(function(h,p){return[Math.min(h[0],p[0]),Math.max(h[1],p[1])]},[1/0,-1/0]);var i={};return l.reduce(function(h,p){for(var x=0,y=p.length;x=2?Pu(i[0]-i[1])*2*p:p,n&&(e.ticks||e.niceTicks)){var x=(e.ticks||e.niceTicks).map(function(y){var b=o?o.indexOf(y):y;return{coordinate:a(b)+p,value:y,offset:p}});return x.filter(function(y){return!FI(y.coordinate)})}return e.isCategorical&&e.categoricalDomain?e.categoricalDomain.map(function(y,b){return{coordinate:a(y)+p,value:y,index:b,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,b){return{coordinate:a(y)+p,value:o?o[y]:y,index:b,offset:p}})},rde=new WeakMap,KL=function(e,n){if(typeof n!="function")return e;rde.has(e)||rde.set(e,new WeakMap);var s=rde.get(e);if(s.has(n))return s.get(n);var a=function(){e.apply(void 0,arguments),n.apply(void 0,arguments)};return s.set(n,a),a},Z9e=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:NE(),realScaleType:"band"}:l==="radial"&&i==="angleAxis"?{scale:Tre(),realScaleType:"linear"}:o==="category"&&n&&(n.indexOf("LineChart")>=0||n.indexOf("AreaChart")>=0||n.indexOf("ComposedChart")>=0&&!s)?{scale:bA(),realScaleType:"point"}:o==="category"?{scale:NE(),realScaleType:"band"}:{scale:Tre(),realScaleType:"linear"};if(Yj(a)){var h="scale".concat(iae(a));return{scale:(bCe[h]||bA)(),realScaleType:bCe[h]?h:"point"}}return Ua(a)?{scale:a}:{scale:bA(),realScaleType:"point"}},TCe=1e-4,Y9e=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])-TCe,l=Math.max(a[0],a[1])+TCe,i=e(n[0]),h=e(n[s-1]);(il||hl)&&e.domain([n[0],n[s-1]])}},eFt=function(e,n){if(!e)return null;for(var s=0,a=e.length;sa)&&(o[1]=a),o[0]>a&&(o[0]=a),o[1]=0?(e[i][s][0]=o,e[i][s][1]=o+h,o=e[i][s][1]):(e[i][s][0]=l,e[i][s][1]=l+h,l=e[i][s][1])}},nFt=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)}},sFt={sign:rFt,expand:j3t,none:_C,silhouette:k3t,wiggle:N3t,positive:nFt},aFt=function(e,n,s){var a=n.map(function(i){return i.props.dataKey}),o=sFt[s],l=w3t().keys(a).value(function(i,h){return+eu(i,h,0)}).order(xfe).offset(o);return l(e)},iFt=function(e,n,s,a,o,l){if(!e)return null;var i=l?n.reverse():n,h={},p=i.reduce(function(y,b){var j,C=(j=b.type)!==null&&j!==void 0&&j.defaultProps?Zl(Zl({},b.type.defaultProps),b.props):b.props,N=C.stackId,A=C.hide;if(A)return y;var E=C[s],T=y[E]||{hasStack:!1,stackGroups:{}};if(Wc(N)){var L=T.stackGroups[N]||{numericAxisId:s,cateAxisId:a,items:[]};L.items.push(b),T.hasStack=!0,T.stackGroups[N]=L}else T.stackGroups[zI("_stackId_")]={numericAxisId:s,cateAxisId:a,items:[b]};return Zl(Zl({},y),{},OS({},E,T))},h),x={};return Object.keys(p).reduce(function(y,b){var j=p[b];if(j.hasStack){var C={};j.stackGroups=Object.keys(j.stackGroups).reduce(function(N,A){var E=j.stackGroups[A];return Zl(Zl({},N),{},OS({},A,{numericAxisId:s,cateAxisId:a,items:E.items,stackedData:aFt(e,E.items,o)}))},C)}return Zl(Zl({},y),{},OS({},b,j))},x)},X9e=function(e,n){var s=n.realScaleType,a=n.type,o=n.tickCount,l=n.originalDomain,i=n.allowDecimals,h=s||n.scale;if(h!=="auto"&&h!=="linear")return null;if(o&&a==="number"&&l&&(l[0]==="auto"||l[1]==="auto")){var p=e.domain();if(!p.length)return null;var x=_Rt(p,o,i);return e.domain([wae(x),bae(x)]),{niceTicks:x}}if(o&&a==="number"){var y=e.domain(),b=bRt(y,o,i);return{niceTicks:b}}return null},ACe=function(e){var n=e.axis,s=e.ticks,a=e.offset,o=e.bandSize,l=e.entry,i=e.index;if(n.type==="category")return s[i]?s[i].coordinate+a:null;var h=eu(l,n.dataKey,n.domain[i]);return vi(h)?null:n.scale(h)-o/2+a},oFt=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]},lFt=function(e,n){var s,a=(s=e.type)!==null&&s!==void 0&&s.defaultProps?Zl(Zl({},e.type.defaultProps),e.props):e.props,o=a.stackId;if(Wc(o)){var l=n[o];if(l){var i=l.items.indexOf(e);return i>=0?l.stackedData[i]:null}}return null},cFt=function(e){return e.reduce(function(n,s){return[wae(s.concat([n[0]]).filter(Dn)),bae(s.concat([n[1]]).filter(Dn))]},[1/0,-1/0])},Q9e=function(e,n,s){return Object.keys(e).reduce(function(a,o){var l=e[o],i=l.stackedData,h=i.reduce(function(p,x){var y=cFt(x.slice(n,s+1));return[Math.min(p[0],y[0]),Math.max(p[1],y[1])]},[1/0,-1/0]);return[Math.min(h[0],a[0]),Math.max(h[1],a[1])]},[1/0,-1/0]).map(function(a){return a===1/0||a===-1/0?0:a})},ECe=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,ICe=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,Kfe=function(e,n,s){if(Ua(e))return e(n,s);if(!Array.isArray(e))return n;var a=[];if(Dn(e[0]))a[0]=s?e[0]:Math.min(e[0],n[0]);else if(ECe.test(e[0])){var o=+ECe.exec(e[0])[1];a[0]=n[0]-o}else Ua(e[0])?a[0]=e[0](n[0]):a[0]=n[0];if(Dn(e[1]))a[1]=s?e[1]:Math.max(e[1],n[1]);else if(ICe.test(e[1])){var l=+ICe.exec(e[1])[1];a[1]=n[1]+l}else Ua(e[1])?a[1]=e[1](n[1]):a[1]=n[1];return a},Dre=function(e,n,s){if(e&&e.scale&&e.scale.bandwidth){var a=e.scale.bandwidth();if(!s||a>0)return a}if(e&&n&&n.length>=2){for(var o=Hye(n,function(y){return y.coordinate}),l=1/0,i=1,h=o.length;it.length)&&(e=t.length);for(var n=0,s=new Array(e);n2&&arguments[2]!==void 0?arguments[2]:{top:0,right:0,bottom:0,left:0};return Math.min(Math.abs(e-(s.left||0)-(s.right||0)),Math.abs(n-(s.top||0)-(s.bottom||0)))/2},yFt=function(e,n,s,a,o){var l=e.width,i=e.height,h=e.startAngle,p=e.endAngle,x=Lu(e.cx,l,l/2),y=Lu(e.cy,i,i/2),b=tBe(l,i,s),j=Lu(e.innerRadius,b,0),C=Lu(e.outerRadius,b,b*.8),N=Object.keys(n);return N.reduce(function(A,E){var T=n[E],L=T.domain,z=T.reversed,F;if(vi(T.range))a==="angleAxis"?F=[h,p]:a==="radiusAxis"&&(F=[j,C]),z&&(F=[F[1],F[0]]);else{F=T.range;var q=F,H=hFt(q,2);h=H[0],p=H[1]}var Z=Z9e(T,o),G=Z.realScaleType,te=Z.scale;te.domain(L).range(F),Y9e(te);var ie=X9e(te,jx(jx({},T),{},{realScaleType:G})),le=jx(jx(jx({},T),ie),{},{range:F,radius:C,realScaleType:G,scale:te,cx:x,cy:y,innerRadius:j,outerRadius:C,startAngle:h,endAngle:p});return jx(jx({},A),{},eBe({},E,le))},{})},vFt=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))},_Ft=function(e,n){var s=e.x,a=e.y,o=n.cx,l=n.cy,i=vFt({x:s,y:a},{x:o,y:l});if(i<=0)return{radius:i};var h=(s-o)/i,p=Math.acos(h);return a>l&&(p=2*Math.PI-p),{radius:i,angle:xFt(p),angleInRadian:p}},bFt=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}},wFt=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},DCe=function(e,n){var s=e.x,a=e.y,o=_Ft({x:s,y:a},n),l=o.radius,i=o.angle,h=n.innerRadius,p=n.outerRadius;if(lp)return!1;if(l===0)return!0;var x=bFt(n),y=x.startAngle,b=x.endAngle,j=i,C;if(y<=b){for(;j>b;)j-=360;for(;j=y&&j<=b}else{for(;j>y;)j-=360;for(;j=b&&j<=y}return C?jx(jx({},n),{},{radius:l,angle:wFt(j,n)}):null},rBe=function(e){return!I.isValidElement(e)&&!Ua(e)&&typeof e!="boolean"?e.className:""};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)}var jFt=["offset"];function kFt(t){return MFt(t)||CFt(t)||SFt(t)||NFt()}function NFt(){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 SFt(t,e){if(t){if(typeof t=="string")return Zfe(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Zfe(t,e)}}function CFt(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function MFt(t){if(Array.isArray(t))return Zfe(t)}function Zfe(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,s=new Array(e);n=0)&&Object.prototype.propertyIsEnumerable.call(t,s)&&(n[s]=t[s])}return n}function AFt(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 RCe(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 Fc(t){for(var e=1;e=0?1:-1,L,z;a==="insideStart"?(L=j+T*l,z=N):a==="insideEnd"?(L=C-T*l,z=!N):a==="end"&&(L=C+T*l,z=N),z=E<=0?z:!z;var F=Xo(p,x,A,L),q=Xo(p,x,A,L+(z?1:-1)*359),H="M".concat(F.x,",").concat(F.y,` A`).concat(A,",").concat(A,",0,1,").concat(z?0:1,`, `).concat(q.x,",").concat(q.y),Z=vi(e.id)?zI("recharts-radial-line-"):e.id;return st.createElement("text",DE({},s,{dominantBaseline:"central",className:si("recharts-radial-bar-label",i)}),st.createElement("defs",null,st.createElement("path",{id:Z,d:H})),st.createElement("textPath",{xlinkHref:"#".concat(Z)},n))},RFt=function(e){var n=e.viewBox,s=e.offset,a=e.position,o=n,l=o.cx,i=o.cy,h=o.innerRadius,p=o.outerRadius,x=o.startAngle,y=o.endAngle,b=(x+y)/2;if(a==="outside"){var j=Xo(l,i,p+s,b),C=j.x,N=j.y;return{x:C,y:N,textAnchor:C>=l?"start":"end",verticalAnchor:"middle"}}if(a==="center")return{x:l,y:i,textAnchor:"middle",verticalAnchor:"middle"};if(a==="centerTop")return{x:l,y:i,textAnchor:"middle",verticalAnchor:"start"};if(a==="centerBottom")return{x:l,y:i,textAnchor:"middle",verticalAnchor:"end"};var A=(h+p)/2,E=Xo(l,i,A,b),T=E.x,L=E.y;return{x:T,y:L,textAnchor:"middle",verticalAnchor:"middle"}},FFt=function(e){var n=e.viewBox,s=e.parentViewBox,a=e.offset,o=e.position,l=n,i=l.x,h=l.y,p=l.width,x=l.height,y=x>=0?1:-1,b=y*a,j=y>0?"end":"start",C=y>0?"start":"end",N=p>=0?1:-1,A=N*a,E=N>0?"end":"start",T=N>0?"start":"end";if(o==="top"){var L={x:i+p/2,y:h-y*a,textAnchor:"middle",verticalAnchor:j};return Fc(Fc({},L),s?{height:Math.max(h-s.y,0),width:p}:{})}if(o==="bottom"){var z={x:i+p/2,y:h+x+b,textAnchor:"middle",verticalAnchor:C};return Fc(Fc({},z),s?{height:Math.max(s.y+s.height-(h+x),0),width:p}:{})}if(o==="left"){var F={x:i-A,y:h+x/2,textAnchor:E,verticalAnchor:"middle"};return Fc(Fc({},F),s?{width:Math.max(F.x-s.x,0),height:x}:{})}if(o==="right"){var q={x:i+p+A,y:h+x/2,textAnchor:T,verticalAnchor:"middle"};return Fc(Fc({},q),s?{width:Math.max(s.x+s.width-q.x,0),height:x}:{})}var H=s?{width:p,height:x}:{};return o==="insideLeft"?Fc({x:i+A,y:h+x/2,textAnchor:T,verticalAnchor:"middle"},H):o==="insideRight"?Fc({x:i+p-A,y:h+x/2,textAnchor:E,verticalAnchor:"middle"},H):o==="insideTop"?Fc({x:i+p/2,y:h+b,textAnchor:"middle",verticalAnchor:C},H):o==="insideBottom"?Fc({x:i+p/2,y:h+x-b,textAnchor:"middle",verticalAnchor:j},H):o==="insideTopLeft"?Fc({x:i+A,y:h+b,textAnchor:T,verticalAnchor:C},H):o==="insideTopRight"?Fc({x:i+p-A,y:h+b,textAnchor:E,verticalAnchor:C},H):o==="insideBottomLeft"?Fc({x:i+A,y:h+x-b,textAnchor:T,verticalAnchor:j},H):o==="insideBottomRight"?Fc({x:i+p-A,y:h+x-b,textAnchor:E,verticalAnchor:j},H):m3(o)&&(Dn(o.x)||Hw(o.x))&&(Dn(o.y)||Hw(o.y))?Fc({x:i+Lu(o.x,p),y:h+Lu(o.y,x),textAnchor:"end",verticalAnchor:"end"},H):Fc({x:i+p/2,y:h+x/2,textAnchor:"middle",verticalAnchor:"middle"},H)},zFt=function(e){return"cx"in e&&Dn(e.cx)};function cd(t){var e=t.offset,n=e===void 0?5:e,s=TFt(t,jFt),a=Fc({offset:n},s),o=a.viewBox,l=a.position,i=a.value,h=a.children,p=a.content,x=a.className,y=x===void 0?"":x,b=a.textBreakAll;if(!o||vi(i)&&vi(h)&&!I.isValidElement(p)&&!Ua(p))return null;if(I.isValidElement(p))return I.cloneElement(p,a);var j;if(Ua(p)){if(j=I.createElement(p,a),I.isValidElement(j))return j}else j=LFt(a);var C=zFt(o),N=Ia(a,!0);if(C&&(l==="insideStart"||l==="insideEnd"||l==="end"))return DFt(a,j,N);var A=C?RFt(a):FFt(a);return st.createElement(Qj,DE({className:si("recharts-label",y)},N,A,{breakAll:b}),j)}cd.displayName="Label";var nBe=function(e){var n=e.cx,s=e.cy,a=e.angle,o=e.startAngle,l=e.endAngle,i=e.r,h=e.radius,p=e.innerRadius,x=e.outerRadius,y=e.x,b=e.y,j=e.top,C=e.left,N=e.width,A=e.height,E=e.clockWise,T=e.labelViewBox;if(T)return T;if(Dn(N)&&Dn(A)){if(Dn(y)&&Dn(b))return{x:y,y:b,width:N,height:A};if(Dn(j)&&Dn(C))return{x:j,y:C,width:N,height:A}}return Dn(y)&&Dn(b)?{x:y,y:b,width:0,height:0}:Dn(n)&&Dn(s)?{cx:n,cy:s,startAngle:o||a||0,endAngle:l||a||0,innerRadius:p||0,outerRadius:x||h||i||0,clockWise:E}:e.viewBox?e.viewBox:{}},BFt=function(e,n){return e?e===!0?st.createElement(cd,{key:"label-implicit",viewBox:n}):Wc(e)?st.createElement(cd,{key:"label-implicit",viewBox:n,value:e}):I.isValidElement(e)?e.type===cd?I.cloneElement(e,{key:"label-implicit",viewBox:n}):st.createElement(cd,{key:"label-implicit",content:e,viewBox:n}):Ua(e)?st.createElement(cd,{key:"label-implicit",content:e,viewBox:n}):m3(e)?st.createElement(cd,DE({viewBox:n},e,{key:"label-implicit"})):null:null},$Ft=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=nBe(e),l=tp(a,cd).map(function(h,p){return I.cloneElement(h,{viewBox:n||o,key:"label-".concat(p)})});if(!s)return l;var i=BFt(e.label,n||o);return[i].concat(kFt(l))};cd.parseViewBox=nBe;cd.renderCallByParent=$Ft;function UFt(t){var e=t==null?0:t.length;return e?t[e-1]:void 0}var qFt=UFt;const VFt=Hi(qFt);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)}var HFt=["valueAccessor"],WFt=["data","dataKey","clockWise","id","textBreakAll"];function GFt(t){return XFt(t)||YFt(t)||ZFt(t)||KFt()}function KFt(){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 ZFt(t,e){if(t){if(typeof t=="string")return Yfe(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Yfe(t,e)}}function YFt(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function XFt(t){if(Array.isArray(t))return Yfe(t)}function Yfe(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,s=new Array(e);n=0)&&Object.prototype.propertyIsEnumerable.call(t,s)&&(n[s]=t[s])}return n}function tzt(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 rzt=function(e){return Array.isArray(e.value)?VFt(e.value):e.value};function P1(t){var e=t.valueAccessor,n=e===void 0?rzt:e,s=BCe(t,HFt),a=s.data,o=s.dataKey,l=s.clockWise,i=s.id,h=s.textBreakAll,p=BCe(s,WFt);return!a||!a.length?null:st.createElement(No,{className:"recharts-label-list"},a.map(function(x,y){var b=vi(o)?n(x,y):eu(x&&x.payload,o),j=vi(i)?{}:{id:"".concat(i,"-").concat(y)};return st.createElement(cd,Fre({},Ia(x,!0),p,j,{parentViewBox:x.parentViewBox,value:b,textBreakAll:h,viewBox:cd.parseViewBox(vi(l)?x:zCe(zCe({},x),{},{clockWise:l})),key:"label-".concat(y),index:y}))}))}P1.displayName="LabelList";function nzt(t,e){return t?t===!0?st.createElement(P1,{key:"labelList-implicit",data:e}):st.isValidElement(t)||Ua(t)?st.createElement(P1,{key:"labelList-implicit",data:e,content:t}):m3(t)?st.createElement(P1,Fre({data:e},t,{key:"labelList-implicit"})):null:null}function szt(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=tp(s,P1).map(function(l,i){return I.cloneElement(l,{data:e,key:"labelList-".concat(i)})});if(!n)return a;var o=nzt(t.label,e);return[o].concat(GFt(a))}P1.renderCallByParent=szt;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 Xfe(){return Xfe=Object.assign?Object.assign.bind():function(t){for(var e=1;e180),",").concat(+(l>p),`, `).concat(y.x,",").concat(y.y,` `);if(a>0){var j=Xo(n,s,a,l),C=Xo(n,s,a,p);b+="L ".concat(C.x,",").concat(C.y,` A `).concat(a,",").concat(a,`,0, `).concat(+(Math.abs(h)>180),",").concat(+(l<=p),`, `).concat(j.x,",").concat(j.y," Z")}else b+="L ".concat(n,",").concat(s," Z");return b},czt=function(e){var n=e.cx,s=e.cy,a=e.innerRadius,o=e.outerRadius,l=e.cornerRadius,i=e.forceCornerRadius,h=e.cornerIsExternal,p=e.startAngle,x=e.endAngle,y=Pu(x-p),b=ZL({cx:n,cy:s,radius:o,angle:p,sign:y,cornerRadius:l,cornerIsExternal:h}),j=b.circleTangency,C=b.lineTangency,N=b.theta,A=ZL({cx:n,cy:s,radius:o,angle:x,sign:-y,cornerRadius:l,cornerIsExternal:h}),E=A.circleTangency,T=A.lineTangency,L=A.theta,z=h?Math.abs(p-x):Math.abs(p-x)-N-L;if(z<0)return i?"M ".concat(C.x,",").concat(C.y,` a`).concat(l,",").concat(l,",0,0,1,").concat(l*2,`,0 a`).concat(l,",").concat(l,",0,0,1,").concat(-l*2,`,0 `):sBe({cx:n,cy:s,innerRadius:a,outerRadius:o,startAngle:p,endAngle:x});var F="M ".concat(C.x,",").concat(C.y,` A`).concat(l,",").concat(l,",0,0,").concat(+(y<0),",").concat(j.x,",").concat(j.y,` A`).concat(o,",").concat(o,",0,").concat(+(z>180),",").concat(+(y<0),",").concat(E.x,",").concat(E.y,` A`).concat(l,",").concat(l,",0,0,").concat(+(y<0),",").concat(T.x,",").concat(T.y,` `);if(a>0){var q=ZL({cx:n,cy:s,radius:a,angle:p,sign:y,isExternal:!0,cornerRadius:l,cornerIsExternal:h}),H=q.circleTangency,Z=q.lineTangency,G=q.theta,te=ZL({cx:n,cy:s,radius:a,angle:x,sign:-y,isExternal:!0,cornerRadius:l,cornerIsExternal:h}),ie=te.circleTangency,le=te.lineTangency,ye=te.theta,ne=h?Math.abs(p-x):Math.abs(p-x)-G-ye;if(ne<0&&l===0)return"".concat(F,"L").concat(n,",").concat(s,"Z");F+="L".concat(le.x,",").concat(le.y,` A`).concat(l,",").concat(l,",0,0,").concat(+(y<0),",").concat(ie.x,",").concat(ie.y,` A`).concat(a,",").concat(a,",0,").concat(+(ne>180),",").concat(+(y>0),",").concat(H.x,",").concat(H.y,` A`).concat(l,",").concat(l,",0,0,").concat(+(y<0),",").concat(Z.x,",").concat(Z.y,"Z")}else F+="L".concat(n,",").concat(s,"Z");return F},dzt={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},aBe=function(e){var n=UCe(UCe({},dzt),e),s=n.cx,a=n.cy,o=n.innerRadius,l=n.outerRadius,i=n.cornerRadius,h=n.forceCornerRadius,p=n.cornerIsExternal,x=n.startAngle,y=n.endAngle,b=n.className;if(l0&&Math.abs(x-y)<360?A=czt({cx:s,cy:a,innerRadius:o,outerRadius:l,cornerRadius:Math.min(N,C/2),forceCornerRadius:h,cornerIsExternal:p,startAngle:x,endAngle:y}):A=sBe({cx:s,cy:a,innerRadius:o,outerRadius:l,startAngle:x,endAngle:y}),st.createElement("path",Xfe({},Ia(n,!0),{className:j,d:A,role:"img"}))};function 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 Qfe(){return Qfe=Object.assign?Object.assign.bind():function(t){for(var e=1;e0;)if(!n.equals(t[s],e[s],s,s,t,e,n))return!1;return!0}function Tzt(t,e){return fk(t.getTime(),e.getTime())}function Azt(t,e){return t.name===e.name&&t.message===e.message&&t.cause===e.cause&&t.stack===e.stack}function Ezt(t,e){return t===e}function YCe(t,e,n){var s=t.size;if(s!==e.size)return!1;if(!s)return!0;for(var a=new Array(s),o=t.entries(),l,i,h=0;(l=o.next())&&!l.done;){for(var p=e.entries(),x=!1,y=0;(i=p.next())&&!i.done;){if(a[y]){y++;continue}var b=l.value,j=i.value;if(n.equals(b[0],j[0],h,y,t,e,n)&&n.equals(b[1],j[1],b[0],j[0],t,e,n)){x=a[y]=!0;break}y++}if(!x)return!1;h++}return!0}var Izt=fk;function Pzt(t,e,n){var s=ZCe(t),a=s.length;if(ZCe(e).length!==a)return!1;for(;a-- >0;)if(!cBe(t,e,n,s[a]))return!1;return!0}function YM(t,e,n){var s=GCe(t),a=s.length;if(GCe(e).length!==a)return!1;for(var o,l,i;a-- >0;)if(o=s[a],!cBe(t,e,n,o)||(l=KCe(t,o),i=KCe(e,o),(l||i)&&(!l||!i||l.configurable!==i.configurable||l.enumerable!==i.enumerable||l.writable!==i.writable)))return!1;return!0}function Lzt(t,e){return fk(t.valueOf(),e.valueOf())}function Ozt(t,e){return t.source===e.source&&t.flags===e.flags}function XCe(t,e,n){var s=t.size;if(s!==e.size)return!1;if(!s)return!0;for(var a=new Array(s),o=t.values(),l,i;(l=o.next())&&!l.done;){for(var h=e.values(),p=!1,x=0;(i=h.next())&&!i.done;){if(!a[x]&&n.equals(l.value,i.value,l.value,i.value,t,e,n)){p=a[x]=!0;break}x++}if(!p)return!1}return!0}function Dzt(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 Rzt(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 cBe(t,e,n,s){return(s===Czt||s===Szt||s===Nzt)&&(t.$$typeof||e.$$typeof)?!0:kzt(e,s)&&n.equals(t[s],e[s],s,s,t,e,n)}var Fzt="[object Arguments]",zzt="[object Boolean]",Bzt="[object Date]",$zt="[object Error]",Uzt="[object Map]",qzt="[object Number]",Vzt="[object Object]",Hzt="[object RegExp]",Wzt="[object Set]",Gzt="[object String]",Kzt="[object URL]",Zzt=Array.isArray,QCe=typeof ArrayBuffer=="function"&&ArrayBuffer.isView?ArrayBuffer.isView:null,JCe=Object.assign,Yzt=Object.prototype.toString.call.bind(Object.prototype.toString);function Xzt(t){var e=t.areArraysEqual,n=t.areDatesEqual,s=t.areErrorsEqual,a=t.areFunctionsEqual,o=t.areMapsEqual,l=t.areNumbersEqual,i=t.areObjectsEqual,h=t.arePrimitiveWrappersEqual,p=t.areRegExpsEqual,x=t.areSetsEqual,y=t.areTypedArraysEqual,b=t.areUrlsEqual;return function(C,N,A){if(C===N)return!0;if(C==null||N==null)return!1;var E=typeof C;if(E!==typeof N)return!1;if(E!=="object")return E==="number"?l(C,N,A):E==="function"?a(C,N,A):!1;var T=C.constructor;if(T!==N.constructor)return!1;if(T===Object)return i(C,N,A);if(Zzt(C))return e(C,N,A);if(QCe!=null&&QCe(C))return y(C,N,A);if(T===Date)return n(C,N,A);if(T===RegExp)return p(C,N,A);if(T===Map)return o(C,N,A);if(T===Set)return x(C,N,A);var L=Yzt(C);return L===Bzt?n(C,N,A):L===Hzt?p(C,N,A):L===Uzt?o(C,N,A):L===Wzt?x(C,N,A):L===Vzt?typeof C.then!="function"&&typeof N.then!="function"&&i(C,N,A):L===Kzt?b(C,N,A):L===$zt?s(C,N,A):L===Fzt?i(C,N,A):L===zzt||L===qzt||L===Gzt?h(C,N,A):!1}}function Qzt(t){var e=t.circular,n=t.createCustomConfig,s=t.strict,a={areArraysEqual:s?YM:Mzt,areDatesEqual:Tzt,areErrorsEqual:Azt,areFunctionsEqual:Ezt,areMapsEqual:s?WCe(YCe,YM):YCe,areNumbersEqual:Izt,areObjectsEqual:s?YM:Pzt,arePrimitiveWrappersEqual:Lzt,areRegExpsEqual:Ozt,areSetsEqual:s?WCe(XCe,YM):XCe,areTypedArraysEqual:s?YM:Dzt,areUrlsEqual:Rzt};if(n&&(a=JCe({},a,n(a))),e){var o=XL(a.areArraysEqual),l=XL(a.areMapsEqual),i=XL(a.areObjectsEqual),h=XL(a.areSetsEqual);a=JCe({},a,{areArraysEqual:o,areMapsEqual:l,areObjectsEqual:i,areSetsEqual:h})}return a}function Jzt(t){return function(e,n,s,a,o,l,i){return t(e,n,i)}}function e7t(t){var e=t.circular,n=t.comparator,s=t.createState,a=t.equals,o=t.strict;if(s)return function(h,p){var x=s(),y=x.cache,b=y===void 0?e?new WeakMap:void 0:y,j=x.meta;return n(h,p,{cache:b,equals:a,meta:j,strict:o})};if(e)return function(h,p){return n(h,p,{cache:new WeakMap,equals:a,meta:void 0,strict:o})};var l={cache:void 0,equals:a,meta:void 0,strict:o};return function(h,p){return n(h,p,l)}}var t7t=pv();pv({strict:!0});pv({circular:!0});pv({circular:!0,strict:!0});pv({createInternalComparator:function(){return fk}});pv({strict:!0,createInternalComparator:function(){return fk}});pv({circular:!0,createInternalComparator:function(){return fk}});pv({circular:!0,createInternalComparator:function(){return fk},strict:!0});function pv(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=Qzt(t),h=Xzt(i),p=s?s(h):Jzt(h);return e7t({circular:n,comparator:h,createState:a,equals:p,strict:l})}function r7t(t){typeof requestAnimationFrame<"u"&&requestAnimationFrame(t)}function e3e(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):r7t(a)};requestAnimationFrame(s)}function epe(t){"@babel/helpers - typeof";return epe=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},epe(t)}function n7t(t){return o7t(t)||i7t(t)||a7t(t)||s7t()}function s7t(){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 a7t(t,e){if(t){if(typeof t=="string")return t3e(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 t3e(t,e)}}function t3e(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,s=new Array(e);nt.length)&&(e=t.length);for(var n=0,s=new Array(e);n1?1:E<0?0:E},N=function(E){for(var T=E>1?1:E,L=T,z=0;z<8;++z){var F=y(L)-T,q=j(L);if(Math.abs(F-T)0&&arguments[0]!==void 0?arguments[0]:{},n=e.stiff,s=n===void 0?100:n,a=e.damping,o=a===void 0?8:a,l=e.dt,i=l===void 0?17:l,h=function(x,y,b){var j=-(x-y)*s,C=b*o,N=b+(j-C)*i/1e3,A=b*i/1e3+x;return Math.abs(A-y)t.length)&&(e=t.length);for(var n=0,s=new Array(e);n=0)&&Object.prototype.propertyIsEnumerable.call(t,s)&&(n[s]=t[s])}return n}function F7t(t,e){if(t==null)return{};var n={},s=Object.keys(t),a,o;for(o=0;o=0)&&(n[a]=t[a]);return n}function nde(t){return U7t(t)||$7t(t)||B7t(t)||z7t()}function z7t(){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 B7t(t,e){if(t){if(typeof t=="string")return ape(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ape(t,e)}}function $7t(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function U7t(t){if(Array.isArray(t))return ape(t)}function ape(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,s=new Array(e);n"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function $re(t){return $re=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},$re(t)}var cy=function(t){G7t(n,t);var e=K7t(n);function n(s,a){var o;q7t(this,n),o=e.call(this,s,a);var l=o.props,i=l.isActive,h=l.attributeName,p=l.from,x=l.to,y=l.steps,b=l.children,j=l.duration;if(o.handleStyleChange=o.handleStyleChange.bind(lpe(o)),o.changeStyle=o.changeStyle.bind(lpe(o)),!i||j<=0)return o.state={style:{}},typeof b=="function"&&(o.state={style:x}),ope(o);if(y&&y.length)o.state={style:y[0].style};else if(p){if(typeof b=="function")return o.state={style:p},ope(o);o.state={style:h?fT({},h,p):p}}else o.state={style:{}};return o}return H7t(n,[{key:"componentDidMount",value:function(){var a=this.props,o=a.isActive,l=a.canBegin;this.mounted=!0,!(!o||!l)&&this.runAnimation(this.props)}},{key:"componentDidUpdate",value:function(a){var o=this.props,l=o.isActive,i=o.canBegin,h=o.attributeName,p=o.shouldReAnimate,x=o.to,y=o.from,b=this.state.style;if(i){if(!l){var j={style:h?fT({},h,x):x};this.state&&b&&(h&&b[h]!==x||!h&&b!==x)&&this.setState(j);return}if(!(t7t(a.to,x)&&a.canBegin&&a.isActive)){var C=!a.canBegin||!a.isActive;this.manager&&this.manager.stop(),this.stopJSAnimation&&this.stopJSAnimation();var N=C||p?y:a.to;if(this.state&&b){var A={style:h?fT({},h,N):N};(h&&b[h]!==N||!h&&b!==N)&&this.setState(A)}this.runAnimation(Bp(Bp({},this.props),{},{from:N,begin:0}))}}}},{key:"componentWillUnmount",value:function(){this.mounted=!1;var a=this.props.onAnimationEnd;this.unSubscribe&&this.unSubscribe(),this.manager&&(this.manager.stop(),this.manager=null),this.stopJSAnimation&&this.stopJSAnimation(),a&&a()}},{key:"handleStyleChange",value:function(a){this.changeStyle(a)}},{key:"changeStyle",value:function(a){this.mounted&&this.setState({style:a})}},{key:"runJSAnimation",value:function(a){var o=this,l=a.from,i=a.to,h=a.duration,p=a.easing,x=a.begin,y=a.onAnimationEnd,b=a.onAnimationStart,j=O7t(l,i,k7t(p),h,this.changeStyle),C=function(){o.stopJSAnimation=j()};this.manager.start([b,x,C,h,y])}},{key:"runStepAnimation",value:function(a){var o=this,l=a.steps,i=a.begin,h=a.onAnimationStart,p=l[0],x=p.style,y=p.duration,b=y===void 0?0:y,j=function(N,A,E){if(E===0)return N;var T=A.duration,L=A.easing,z=L===void 0?"ease":L,F=A.style,q=A.properties,H=A.onAnimationEnd,Z=E>0?l[E-1]:A,G=q||Object.keys(F);if(typeof z=="function"||z==="spring")return[].concat(nde(N),[o.runJSAnimation.bind(o,{from:Z.style,to:F,duration:T,easing:z}),T]);var te=s3e(G,T,z),ie=Bp(Bp(Bp({},Z.style),F),{},{transition:te});return[].concat(nde(N),[ie,T,H]).filter(h7t)};return this.manager.start([h].concat(nde(l.reduce(j,[x,Math.max(b,i)])),[a.onAnimationEnd]))}},{key:"runAnimation",value:function(a){this.manager||(this.manager=l7t());var o=a.begin,l=a.duration,i=a.attributeName,h=a.to,p=a.easing,x=a.onAnimationStart,y=a.onAnimationEnd,b=a.steps,j=a.children,C=this.manager;if(this.unSubscribe=C.subscribe(this.handleStyleChange),typeof p=="function"||typeof j=="function"||p==="spring"){this.runJSAnimation(a);return}if(b.length>1){this.runStepAnimation(a);return}var N=i?fT({},i,h):h,A=s3e(Object.keys(N),l,p);C.start([x,o,Bp(Bp({},N),{},{transition:A}),l,y])}},{key:"render",value:function(){var a=this.props,o=a.children;a.begin;var l=a.duration;a.attributeName,a.easing;var i=a.isActive;a.steps,a.from,a.to,a.canBegin,a.onAnimationEnd,a.shouldReAnimate,a.onAnimationReStart;var h=R7t(a,D7t),p=I.Children.count(o),x=this.state.style;if(typeof o=="function")return o(x);if(!i||p===0||l<=0)return o;var y=function(j){var C=j.props,N=C.style,A=N===void 0?{}:N,E=C.className,T=I.cloneElement(j,Bp(Bp({},h),{},{style:Bp(Bp({},A),x),className:E}));return T};return p===1?y(I.Children.only(o)):st.createElement("div",null,I.Children.map(o,function(b){return y(b)}))}}]),n}(I.PureComponent);cy.displayName="Animate";cy.defaultProps={begin:0,duration:1e3,from:"",to:"",attributeName:"",easing:"ease",isActive:!0,canBegin:!0,steps:[],onAnimationEnd:function(){},onAnimationStart:function(){}};cy.propTypes={from:mo.oneOfType([mo.object,mo.string]),to:mo.oneOfType([mo.object,mo.string]),attributeName:mo.string,duration:mo.number,begin:mo.number,easing:mo.oneOfType([mo.string,mo.func]),steps:mo.arrayOf(mo.shape({duration:mo.number.isRequired,style:mo.object.isRequired,easing:mo.oneOfType([mo.oneOf(["ease","ease-in","ease-out","ease-in-out","linear"]),mo.func]),properties:mo.arrayOf("string"),onAnimationEnd:mo.func})),children:mo.oneOfType([mo.node,mo.func]),isActive:mo.bool,canBegin:mo.bool,onAnimationEnd:mo.func,shouldReAnimate:mo.bool,onAnimationStart:mo.func,onAnimationReStart:mo.func};function UE(t){"@babel/helpers - typeof";return UE=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},UE(t)}function Ure(){return Ure=Object.assign?Object.assign.bind():function(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,s=new Array(e);n=0?1:-1,h=s>=0?1:-1,p=a>=0&&s>=0||a<0&&s<0?1:0,x;if(l>0&&o instanceof Array){for(var y=[0,0,0,0],b=0,j=4;bl?l:o[b];x="M".concat(e,",").concat(n+i*y[0]),y[0]>0&&(x+="A ".concat(y[0],",").concat(y[0],",0,0,").concat(p,",").concat(e+h*y[0],",").concat(n)),x+="L ".concat(e+s-h*y[1],",").concat(n),y[1]>0&&(x+="A ".concat(y[1],",").concat(y[1],",0,0,").concat(p,`, `).concat(e+s,",").concat(n+i*y[1])),x+="L ".concat(e+s,",").concat(n+a-i*y[2]),y[2]>0&&(x+="A ".concat(y[2],",").concat(y[2],",0,0,").concat(p,`, `).concat(e+s-h*y[2],",").concat(n+a)),x+="L ".concat(e+h*y[3],",").concat(n+a),y[3]>0&&(x+="A ".concat(y[3],",").concat(y[3],",0,0,").concat(p,`, `).concat(e,",").concat(n+a-i*y[3])),x+="Z"}else if(l>0&&o===+o&&o>0){var C=Math.min(l,o);x="M ".concat(e,",").concat(n+i*C,` A `).concat(C,",").concat(C,",0,0,").concat(p,",").concat(e+h*C,",").concat(n,` L `).concat(e+s-h*C,",").concat(n,` A `).concat(C,",").concat(C,",0,0,").concat(p,",").concat(e+s,",").concat(n+i*C,` L `).concat(e+s,",").concat(n+a-i*C,` A `).concat(C,",").concat(C,",0,0,").concat(p,",").concat(e+s-h*C,",").concat(n+a,` L `).concat(e+h*C,",").concat(n+a,` A `).concat(C,",").concat(C,",0,0,").concat(p,",").concat(e,",").concat(n+a-i*C," Z")}else x="M ".concat(e,",").concat(n," h ").concat(s," v ").concat(a," h ").concat(-s," Z");return x},s9t=function(e,n){if(!e||!n)return!1;var s=e.x,a=e.y,o=n.x,l=n.y,i=n.width,h=n.height;if(Math.abs(i)>0&&Math.abs(h)>0){var p=Math.min(o,o+i),x=Math.max(o,o+i),y=Math.min(l,l+h),b=Math.max(l,l+h);return s>=p&&s<=x&&a>=y&&a<=b}return!1},a9t={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},y0e=function(e){var n=h3e(h3e({},a9t),e),s=I.useRef(),a=I.useState(-1),o=Y7t(a,2),l=o[0],i=o[1];I.useEffect(function(){if(s.current&&s.current.getTotalLength)try{var z=s.current.getTotalLength();z&&i(z)}catch{}},[]);var h=n.x,p=n.y,x=n.width,y=n.height,b=n.radius,j=n.className,C=n.animationEasing,N=n.animationDuration,A=n.animationBegin,E=n.isAnimationActive,T=n.isUpdateAnimationActive;if(h!==+h||p!==+p||x!==+x||y!==+y||x===0||y===0)return null;var L=si("recharts-rectangle",j);return T?st.createElement(cy,{canBegin:l>0,from:{width:x,height:y,x:h,y:p},to:{width:x,height:y,x:h,y:p},duration:N,animationEasing:C,isActive:T},function(z){var F=z.width,q=z.height,H=z.x,Z=z.y;return st.createElement(cy,{canBegin:l>0,from:"0px ".concat(l===-1?1:l,"px"),to:"".concat(l,"px 0px"),attributeName:"strokeDasharray",begin:A,duration:N,isActive:E,easing:C},st.createElement("path",Ure({},Ia(n,!0),{className:L,d:f3e(H,Z,F,q,b),ref:s})))}):st.createElement("path",Ure({},Ia(n,!0),{className:L,d:f3e(h,p,x,y,b)}))},i9t=["points","className","baseLinePoints","connectNulls"];function z4(){return z4=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 l9t(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 p3e(t){return h9t(t)||u9t(t)||d9t(t)||c9t()}function c9t(){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 d9t(t,e){if(t){if(typeof t=="string")return cpe(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return cpe(t,e)}}function u9t(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function h9t(t){if(Array.isArray(t))return cpe(t)}function cpe(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,s=new Array(e);n0&&arguments[0]!==void 0?arguments[0]:[],n=[[]];return e.forEach(function(s){m3e(s)?n[n.length-1].push(s):n[n.length-1].length>0&&n.push([])}),m3e(e[0])&&n[n.length-1].push(e[0]),n[n.length-1].length<=0&&(n=n.slice(0,-1)),n},kA=function(e,n){var s=f9t(e);n&&(s=[s.reduce(function(o,l){return[].concat(p3e(o),p3e(l))},[])]);var a=s.map(function(o){return o.reduce(function(l,i,h){return"".concat(l).concat(h===0?"M":"L").concat(i.x,",").concat(i.y)},"")}).join("");return s.length===1?"".concat(a,"Z"):a},p9t=function(e,n,s){var a=kA(e,s);return"".concat(a.slice(-1)==="Z"?a.slice(0,-1):a,"L").concat(kA(n.reverse(),s).slice(1))},m9t=function(e){var n=e.points,s=e.className,a=e.baseLinePoints,o=e.connectNulls,l=o9t(e,i9t);if(!n||!n.length)return null;var i=si("recharts-polygon",s);if(a&&a.length){var h=l.stroke&&l.stroke!=="none",p=p9t(n,a,o);return st.createElement("g",{className:i},st.createElement("path",z4({},Ia(l,!0),{fill:p.slice(-1)==="Z"?l.fill:"none",stroke:"none",d:p})),h?st.createElement("path",z4({},Ia(l,!0),{fill:"none",d:kA(n,o)})):null,h?st.createElement("path",z4({},Ia(l,!0),{fill:"none",d:kA(a,o)})):null)}var x=kA(n,o);return st.createElement("path",z4({},Ia(l,!0),{fill:x.slice(-1)==="Z"?l.fill:"none",className:i,d:x}))};function dpe(){return dpe=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0)&&Object.prototype.propertyIsEnumerable.call(t,s)&&(n[s]=t[s])}return n}function w9t(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 j9t=function(e,n,s,a,o,l){return"M".concat(e,",").concat(o,"v").concat(a,"M").concat(l,",").concat(n,"h").concat(s)},k9t=function(e){var n=e.x,s=n===void 0?0:n,a=e.y,o=a===void 0?0:a,l=e.top,i=l===void 0?0:l,h=e.left,p=h===void 0?0:h,x=e.width,y=x===void 0?0:x,b=e.height,j=b===void 0?0:b,C=e.className,N=b9t(e,g9t),A=x9t({x:s,y:o,top:i,left:p,width:y,height:j},N);return!Dn(s)||!Dn(o)||!Dn(y)||!Dn(j)||!Dn(i)||!Dn(p)?null:st.createElement("path",upe({},Ia(A,!0),{className:si("recharts-cross",C),d:j9t(s,o,y,j,i,p)}))},N9t=_ae,S9t=C9e,C9t=Ug;function M9t(t,e){return t&&t.length?N9t(t,C9t(e),S9t):void 0}var T9t=M9t;const A9t=Hi(T9t);var E9t=_ae,I9t=Ug,P9t=M9e;function L9t(t,e){return t&&t.length?E9t(t,I9t(e),P9t):void 0}var O9t=L9t;const D9t=Hi(O9t);var R9t=["cx","cy","angle","ticks","axisLine"],F9t=["ticks","tick","angle","tickFormatter","stroke"];function AC(t){"@babel/helpers - typeof";return AC=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},AC(t)}function NA(){return NA=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 z9t(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 B9t(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function v3e(t,e){for(var n=0;nw3e?l=a==="outer"?"start":"end":o<-w3e?l=a==="outer"?"end":"start":l="middle",l}},{key:"renderAxisLine",value:function(){var s=this.props,a=s.cx,o=s.cy,l=s.radius,i=s.axisLine,h=s.axisLineType,p=c_(c_({},Ia(this.props,!1)),{},{fill:"none"},Ia(i,!1));if(h==="circle")return st.createElement(v0e,Lw({className:"recharts-polar-angle-axis-line"},p,{cx:a,cy:o,r:l}));var x=this.props.ticks,y=x.map(function(b){return Xo(a,o,l,b.coordinate)});return st.createElement(m9t,Lw({className:"recharts-polar-angle-axis-line"},p,{points:y}))}},{key:"renderTicks",value:function(){var s=this,a=this.props,o=a.ticks,l=a.tick,i=a.tickLine,h=a.tickFormatter,p=a.stroke,x=Ia(this.props,!1),y=Ia(l,!1),b=c_(c_({},x),{},{fill:"none"},Ia(i,!1)),j=o.map(function(C,N){var A=s.getTickLineCoord(C),E=s.getTickTextAnchor(C),T=c_(c_(c_({textAnchor:E},x),{},{stroke:"none",fill:p},y),{},{index:N,payload:C,x:A.x2,y:A.y2});return st.createElement(No,Lw({className:si("recharts-polar-angle-axis-tick",rBe(l)),key:"tick-".concat(C.coordinate)},Xj(s.props,C,N)),i&&st.createElement("line",Lw({className:"recharts-polar-angle-axis-tick-line"},b,A)),l&&e.renderTickItem(l,T,h?h(C.value,N):C.value))});return st.createElement(No,{className:"recharts-polar-angle-axis-ticks"},j)}},{key:"render",value:function(){var s=this.props,a=s.ticks,o=s.radius,l=s.axisLine;return o<=0||!a||!a.length?null:st.createElement(No,{className:si("recharts-polar-angle-axis",this.props.className)},l&&this.renderAxisLine(),this.renderTicks())}}],[{key:"renderTickItem",value:function(s,a,o){var l;return st.isValidElement(s)?l=st.cloneElement(s,a):Ua(s)?l=s(a):l=st.createElement(Qj,Lw({},a,{className:"recharts-polar-angle-axis-tick-value"}),o),l}}])}(I.PureComponent);Tae(Aae,"displayName","PolarAngleAxis");Tae(Aae,"axisType","angleAxis");Tae(Aae,"defaultProps",{type:"category",angleAxisId:0,scale:"auto",cx:0,cy:0,orientation:"outer",axisLine:!0,tickLine:!0,tickSize:8,tick:!0,hide:!1,allowDuplicatedCategory:!0});var tBt=j7e,rBt=tBt(Object.getPrototypeOf,Object),nBt=rBt,sBt=py,aBt=nBt,iBt=my,oBt="[object Object]",lBt=Function.prototype,cBt=Object.prototype,_Be=lBt.toString,dBt=cBt.hasOwnProperty,uBt=_Be.call(Object);function hBt(t){if(!iBt(t)||sBt(t)!=oBt)return!1;var e=aBt(t);if(e===null)return!0;var n=dBt.call(e,"constructor")&&e.constructor;return typeof n=="function"&&n instanceof n&&_Be.call(n)==uBt}var fBt=hBt;const pBt=Hi(fBt);var mBt=py,gBt=my,xBt="[object Boolean]";function yBt(t){return t===!0||t===!1||gBt(t)&&mBt(t)==xBt}var vBt=yBt;const _Bt=Hi(vBt);function VE(t){"@babel/helpers - typeof";return VE=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},VE(t)}function Hre(){return Hre=Object.assign?Object.assign.bind():function(t){for(var e=1;et.length)&&(e=t.length);for(var n=0,s=new Array(e);n0,from:{upperWidth:0,lowerWidth:0,height:b,x:h,y:p},to:{upperWidth:x,lowerWidth:y,height:b,x:h,y:p},duration:N,animationEasing:C,isActive:E},function(L){var z=L.upperWidth,F=L.lowerWidth,q=L.height,H=L.x,Z=L.y;return st.createElement(cy,{canBegin:l>0,from:"0px ".concat(l===-1?1:l,"px"),to:"".concat(l,"px 0px"),attributeName:"strokeDasharray",begin:A,duration:N,easing:C},st.createElement("path",Hre({},Ia(n,!0),{className:T,d:S3e(H,Z,z,F,q),ref:s})))}):st.createElement("g",null,st.createElement("path",Hre({},Ia(n,!0),{className:T,d:S3e(h,p,x,y,b)})))},EBt=["option","shapeType","propTransformer","activeClassName","isActive"];function HE(t){"@babel/helpers - typeof";return HE=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},HE(t)}function IBt(t,e){if(t==null)return{};var n=PBt(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 PBt(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 C3e(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);e&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),n.push.apply(n,s)}return n}function Wre(t){for(var e=1;e0?of(L,"paddingAngle",0):0;if(F){var H=k0(F.endAngle-F.startAngle,L.endAngle-L.startAngle),Z=Ko(Ko({},L),{},{startAngle:T+q,endAngle:T+H(N)+q});A.push(Z),T=Z.endAngle}else{var G=L.endAngle,te=L.startAngle,ie=k0(0,G-te),le=ie(N),ye=Ko(Ko({},L),{},{startAngle:T+q,endAngle:T+le+q});A.push(ye),T=ye.endAngle}}),st.createElement(No,null,s.renderSectorsStatically(A))})}},{key:"attachKeyboardHandlers",value:function(s){var a=this;s.onkeydown=function(o){if(!o.altKey)switch(o.key){case"ArrowLeft":{var l=++a.state.sectorToFocus%a.sectorRefs.length;a.sectorRefs[l].focus(),a.setState({sectorToFocus:l});break}case"ArrowRight":{var i=--a.state.sectorToFocus<0?a.sectorRefs.length-1:a.state.sectorToFocus%a.sectorRefs.length;a.sectorRefs[i].focus(),a.setState({sectorToFocus:i});break}case"Escape":{a.sectorRefs[a.state.sectorToFocus].blur(),a.setState({sectorToFocus:0});break}}}}},{key:"renderSectors",value:function(){var s=this.props,a=s.sectors,o=s.isAnimationActive,l=this.state.prevSectors;return o&&a&&a.length&&(!l||!jae(l,a))?this.renderSectorsWithAnimation():this.renderSectorsStatically(a)}},{key:"componentDidMount",value:function(){this.pieRef&&this.attachKeyboardHandlers(this.pieRef)}},{key:"render",value:function(){var s=this,a=this.props,o=a.hide,l=a.sectors,i=a.className,h=a.label,p=a.cx,x=a.cy,y=a.innerRadius,b=a.outerRadius,j=a.isAnimationActive,C=this.state.isAnimationFinished;if(o||!l||!l.length||!Dn(p)||!Dn(x)||!Dn(y)||!Dn(b))return null;var N=si("recharts-pie",i);return st.createElement(No,{tabIndex:this.props.rootTabIndex,className:N,ref:function(E){s.pieRef=E}},this.renderSectors(),h&&this.renderLabels(l),cd.renderCallByParent(this.props,null,!1),(!j||C)&&P1.renderCallByParent(this.props,l,!1))}}],[{key:"getDerivedStateFromProps",value:function(s,a){return a.prevIsAnimationActive!==s.isAnimationActive?{prevIsAnimationActive:s.isAnimationActive,prevAnimationId:s.animationId,curSectors:s.sectors,prevSectors:[],isAnimationFinished:!0}:s.isAnimationActive&&s.animationId!==a.prevAnimationId?{prevAnimationId:s.animationId,curSectors:s.sectors,prevSectors:a.curSectors,isAnimationFinished:!0}:s.sectors!==a.curSectors?{curSectors:s.sectors,isAnimationFinished:!0}:null}},{key:"getTextAnchor",value:function(s,a){return s>a?"start":s=360?T:T-1)*h,z=A-T*j-L,F=a.reduce(function(Z,G){var te=eu(G,E,0);return Z+(Dn(te)?te:0)},0),q;if(F>0){var H;q=a.map(function(Z,G){var te=eu(Z,E,0),ie=eu(Z,x,G),le=(Dn(te)?te:0)/F,ye;G?ye=H.endAngle+Pu(N)*h*(te!==0?1:0):ye=l;var ne=ye+Pu(N)*((te!==0?j:0)+le*z),ge=(ye+ne)/2,ae=(C.innerRadius+C.outerRadius)/2,he=[{name:ie,value:te,payload:Z,dataKey:E,type:b}],ue=Xo(C.cx,C.cy,ae,ge);return H=Ko(Ko(Ko({percent:le,cornerRadius:o,name:ie,tooltipPayload:he,midAngle:ge,middleRadius:ae,tooltipPosition:ue},Z),C),{},{value:eu(Z,E),startAngle:ye,endAngle:ne,payload:Z,paddingAngle:Pu(N)*h}),H})}return Ko(Ko({},C),{},{sectors:q,data:a})});var e$t=Math.ceil,t$t=Math.max;function r$t(t,e,n,s){for(var a=-1,o=t$t(e$t((e-t)/(n||1)),0),l=Array(o);o--;)l[s?o:++a]=t,t+=n;return l}var n$t=r$t,s$t=U7e,E3e=1/0,a$t=17976931348623157e292;function i$t(t){if(!t)return t===0?t:0;if(t=s$t(t),t===E3e||t===-E3e){var e=t<0?-1:1;return e*a$t}return t===t?t:0}var kBe=i$t,o$t=n$t,l$t=hae,sde=kBe;function c$t(t){return function(e,n,s){return s&&typeof s!="number"&&l$t(e,n,s)&&(n=s=void 0),e=sde(e),n===void 0?(n=e,e=0):n=sde(n),s=s===void 0?e0&&s.handleDrag(a.changedTouches[0])}),zh(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()}),zh(s,"handleLeaveWrapper",function(){(s.state.isTravellerMoving||s.state.isSlideMoving)&&(s.leaveTimer=window.setTimeout(s.handleDragEnd,s.props.leaveTimeOut))}),zh(s,"handleEnterSlideOrTraveller",function(){s.setState({isTextActive:!0})}),zh(s,"handleLeaveSlideOrTraveller",function(){s.setState({isTextActive:!1})}),zh(s,"handleSlideDragStart",function(a){var o=D3e(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 j$t(e,t),v$t(e,[{key:"componentWillUnmount",value:function(){this.leaveTimer&&(clearTimeout(this.leaveTimer),this.leaveTimer=null),this.detachDragEndListener()}},{key:"getIndex",value:function(s){var a=s.startX,o=s.endX,l=this.state.scaleValues,i=this.props,h=i.gap,p=i.data,x=p.length-1,y=Math.min(a,o),b=Math.max(a,o),j=e.getIndexInRange(l,y),C=e.getIndexInRange(l,b);return{startIndex:j-j%h,endIndex:C===x?x:C-C%h}}},{key:"getTextOfTick",value:function(s){var a=this.props,o=a.data,l=a.tickFormatter,i=a.dataKey,h=eu(o[s],i,s);return Ua(l)?l(h,s):h}},{key:"attachDragEndListener",value:function(){window.addEventListener("mouseup",this.handleDragEnd,!0),window.addEventListener("touchend",this.handleDragEnd,!0),window.addEventListener("mousemove",this.handleDrag,!0)}},{key:"detachDragEndListener",value:function(){window.removeEventListener("mouseup",this.handleDragEnd,!0),window.removeEventListener("touchend",this.handleDragEnd,!0),window.removeEventListener("mousemove",this.handleDrag,!0)}},{key:"handleSlideDrag",value:function(s){var a=this.state,o=a.slideMoveStartX,l=a.startX,i=a.endX,h=this.props,p=h.x,x=h.width,y=h.travellerWidth,b=h.startIndex,j=h.endIndex,C=h.onChange,N=s.pageX-o;N>0?N=Math.min(N,p+x-y-i,p+x-y-l):N<0&&(N=Math.max(N,p-l,p-i));var A=this.getIndex({startX:l+N,endX:i+N});(A.startIndex!==b||A.endIndex!==j)&&C&&C(A),this.setState({startX:l+N,endX:i+N,slideMoveStartX:s.pageX})}},{key:"handleTravellerDragStart",value:function(s,a){var o=D3e(a)?a.changedTouches[0]:a;this.setState({isSlideMoving:!1,isTravellerMoving:!0,movingTravellerId:s,brushMoveStartX:o.pageX}),this.attachDragEndListener()}},{key:"handleTravellerMove",value:function(s){var a=this.state,o=a.brushMoveStartX,l=a.movingTravellerId,i=a.endX,h=a.startX,p=this.state[l],x=this.props,y=x.x,b=x.width,j=x.travellerWidth,C=x.onChange,N=x.gap,A=x.data,E={startX:this.state.startX,endX:this.state.endX},T=s.pageX-o;T>0?T=Math.min(T,y+b-j-p):T<0&&(T=Math.max(T,y-p)),E[l]=p+T;var L=this.getIndex(E),z=L.startIndex,F=L.endIndex,q=function(){var Z=A.length-1;return l==="startX"&&(i>h?z%N===0:F%N===0)||ih?F%N===0:z%N===0)||i>h&&F===Z};this.setState(zh(zh({},l,p+T),"brushMoveStartX",s.pageX),function(){C&&q()&&C(L)})}},{key:"handleTravellerMoveKeyboard",value:function(s,a){var o=this,l=this.state,i=l.scaleValues,h=l.startX,p=l.endX,x=this.state[a],y=i.indexOf(x);if(y!==-1){var b=y+s;if(!(b===-1||b>=i.length)){var j=i[b];a==="startX"&&j>=p||a==="endX"&&j<=h||this.setState(zh({},a,j),function(){o.props.onChange(o.getIndex({startX:o.state.startX,endX:o.state.endX}))})}}}},{key:"renderBackground",value:function(){var s=this.props,a=s.x,o=s.y,l=s.width,i=s.height,h=s.fill,p=s.stroke;return st.createElement("rect",{stroke:p,fill:h,x:a,y:o,width:l,height:i})}},{key:"renderPanorama",value:function(){var s=this.props,a=s.x,o=s.y,l=s.width,i=s.height,h=s.data,p=s.children,x=s.padding,y=I.Children.only(p);return y?st.cloneElement(y,{x:a,y:o,width:l,height:i,margin:x,compact:!0,data:h}):null}},{key:"renderTravellerLayer",value:function(s,a){var o,l,i=this,h=this.props,p=h.y,x=h.travellerWidth,y=h.height,b=h.traveller,j=h.ariaLabel,C=h.data,N=h.startIndex,A=h.endIndex,E=Math.max(s,this.props.x),T=ade(ade({},Ia(this.props,!1)),{},{x:E,y:p,width:x,height:y}),L=j||"Min value: ".concat((o=C[N])===null||o===void 0?void 0:o.name,", Max value: ").concat((l=C[A])===null||l===void 0?void 0:l.name);return st.createElement(No,{tabIndex:0,role:"slider","aria-label":L,"aria-valuenow":s,className:"recharts-brush-traveller",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.travellerDragStartHandlers[a],onTouchStart:this.travellerDragStartHandlers[a],onKeyDown:function(F){["ArrowLeft","ArrowRight"].includes(F.key)&&(F.preventDefault(),F.stopPropagation(),i.handleTravellerMoveKeyboard(F.key==="ArrowRight"?1:-1,a))},onFocus:function(){i.setState({isTravellerFocused:!0})},onBlur:function(){i.setState({isTravellerFocused:!1})},style:{cursor:"col-resize"}},e.renderTraveller(b,T))}},{key:"renderSlide",value:function(s,a){var o=this.props,l=o.y,i=o.height,h=o.stroke,p=o.travellerWidth,x=Math.min(s,a)+p,y=Math.max(Math.abs(a-s)-p,0);return st.createElement("rect",{className:"recharts-brush-slide",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.handleSlideDragStart,onTouchStart:this.handleSlideDragStart,style:{cursor:"move"},stroke:"none",fill:h,fillOpacity:.2,x,y:l,width:y,height:i})}},{key:"renderText",value:function(){var s=this.props,a=s.startIndex,o=s.endIndex,l=s.y,i=s.height,h=s.travellerWidth,p=s.stroke,x=this.state,y=x.startX,b=x.endX,j=5,C={pointerEvents:"none",fill:p};return st.createElement(No,{className:"recharts-brush-texts"},st.createElement(Qj,Zre({textAnchor:"end",verticalAnchor:"middle",x:Math.min(y,b)-j,y:l+i/2},C),this.getTextOfTick(a)),st.createElement(Qj,Zre({textAnchor:"start",verticalAnchor:"middle",x:Math.max(y,b)+h+j,y:l+i/2},C),this.getTextOfTick(o)))}},{key:"render",value:function(){var s=this.props,a=s.data,o=s.className,l=s.children,i=s.x,h=s.y,p=s.width,x=s.height,y=s.alwaysShowText,b=this.state,j=b.startX,C=b.endX,N=b.isTextActive,A=b.isSlideMoving,E=b.isTravellerMoving,T=b.isTravellerFocused;if(!a||!a.length||!Dn(i)||!Dn(h)||!Dn(p)||!Dn(x)||p<=0||x<=0)return null;var L=si("recharts-brush",o),z=st.Children.count(l)===1,F=x$t("userSelect","none");return st.createElement(No,{className:L,onMouseLeave:this.handleLeaveWrapper,onTouchMove:this.handleTouchMove,style:F},this.renderBackground(),z&&this.renderPanorama(),this.renderSlide(j,C),this.renderTravellerLayer(j,"startX"),this.renderTravellerLayer(C,"endX"),(N||A||E||T||y)&&this.renderText())}}],[{key:"renderDefaultTraveller",value:function(s){var a=s.x,o=s.y,l=s.width,i=s.height,h=s.stroke,p=Math.floor(o+i/2)-1;return st.createElement(st.Fragment,null,st.createElement("rect",{x:a,y:o,width:l,height:i,fill:h,stroke:"none"}),st.createElement("line",{x1:a+1,y1:p,x2:a+l-1,y2:p,fill:"none",stroke:"#fff"}),st.createElement("line",{x1:a+1,y1:p+2,x2:a+l-1,y2:p+2,fill:"none",stroke:"#fff"}))}},{key:"renderTraveller",value:function(s,a){var o;return st.isValidElement(s)?o=st.cloneElement(s,a):Ua(s)?o=s(a):o=e.renderDefaultTraveller(a),o}},{key:"getDerivedStateFromProps",value:function(s,a){var o=s.data,l=s.width,i=s.x,h=s.travellerWidth,p=s.updateId,x=s.startIndex,y=s.endIndex;if(o!==a.prevData||p!==a.prevUpdateId)return ade({prevData:o,prevTravellerWidth:h,prevUpdateId:p,prevX:i,prevWidth:l},o&&o.length?N$t({data:o,width:l,x:i,travellerWidth:h,startIndex:x,endIndex:y}):{scale:null,scaleValues:null});if(a.scale&&(l!==a.prevWidth||i!==a.prevX||h!==a.prevTravellerWidth)){a.scale.range([i,i+l-h]);var b=a.scale.domain().map(function(j){return a.scale(j)});return{prevData:o,prevTravellerWidth:h,prevUpdateId:p,prevX:i,prevWidth:l,startX:a.scale(s.startIndex),endX:a.scale(s.endIndex),scaleValues:b}}return null}},{key:"getIndexInRange",value:function(s,a){for(var o=s.length,l=0,i=o-1;i-l>1;){var h=Math.floor((l+i)/2);s[h]>a?i=h:l=h}return a>=s[i]?i:l}}])}(I.PureComponent);zh(LC,"displayName","Brush");zh(LC,"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 S$t=Vye;function C$t(t,e){var n;return S$t(t,function(s,a,o){return n=e(s,a,o),!n}),!!n}var M$t=C$t,T$t=m7e,A$t=Ug,E$t=M$t,I$t=Nh,P$t=hae;function L$t(t,e,n){var s=I$t(t)?T$t:E$t;return n&&P$t(t,e,n)&&(e=void 0),s(t,A$t(e))}var O$t=L$t;const D$t=Hi(O$t);var Ag=function(e,n){var s=e.alwaysShow,a=e.ifOverflow;return s&&(a="extendDomain"),a===n},R3e=R7e;function R$t(t,e,n){e=="__proto__"&&R3e?R3e(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}var F$t=R$t,z$t=F$t,B$t=O7e,$$t=Ug;function U$t(t,e){var n={};return e=$$t(e),B$t(t,function(s,a,o){z$t(n,a,e(s,a,o))}),n}var q$t=U$t;const V$t=Hi(q$t);function H$t(t,e){for(var n=-1,s=t==null?0:t.length;++n=0)&&Object.prototype.propertyIsEnumerable.call(t,s)&&(n[s]=t[s])}return n}function lUt(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 cUt(t,e){var n=t.x,s=t.y,a=oUt(t,nUt),o="".concat(n),l=parseInt(o,10),i="".concat(s),h=parseInt(i,10),p="".concat(e.height||a.height),x=parseInt(p,10),y="".concat(e.width||a.width),b=parseInt(y,10);return XM(XM(XM(XM(XM({},e),a),l?{x:l}:{}),h?{y:h}:{}),{},{height:x,width:b,name:e.name,radius:e.radius})}function z3e(t){return st.createElement(bBe,gpe({shapeType:"rectangle",propTransformer:cUt,activeClassName:"recharts-active-bar"},t))}var dUt=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)||DSt(s);return o?e(s,a):(o||ek(),n)}},uUt=["value","background"],TBe;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 hUt(t,e){if(t==null)return{};var n=fUt(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 fUt(t,e){if(t==null)return{};var n={};for(var s in t)if(Object.prototype.hasOwnProperty.call(t,s)){if(e.indexOf(s)>=0)continue;n[s]=t[s]}return n}function Xre(){return Xre=Object.assign?Object.assign.bind():function(t){for(var e=1;e0&&Math.abs(ge)0&&Math.abs(ne)0&&(ye=Math.min((Le||0)-(ne[Ne-1]||0),ye))}),Number.isFinite(ye)){var ge=ye/le,ae=N.layout==="vertical"?s.height:s.width;if(N.padding==="gap"&&(H=ge*ae/2),N.padding==="no-gap"){var he=Lu(e.barCategoryGap,ge*ae),ue=ge*ae/2;H=ue-he-(ue-he)/ae*he}}}a==="xAxis"?Z=[s.left+(L.left||0)+(H||0),s.left+s.width-(L.right||0)-(H||0)]:a==="yAxis"?Z=h==="horizontal"?[s.top+s.height-(L.bottom||0),s.top+(L.top||0)]:[s.top+(L.top||0)+(H||0),s.top+s.height-(L.bottom||0)-(H||0)]:Z=N.range,F&&(Z=[Z[1],Z[0]]);var _e=Z9e(N,o,b),Ae=_e.scale,Ce=_e.realScaleType;Ae.domain(E).range(Z),Y9e(Ae);var be=X9e(Ae,Qp(Qp({},N),{},{realScaleType:Ce}));a==="xAxis"?(ie=A==="top"&&!z||A==="bottom"&&z,G=s.left,te=y[q]-ie*N.height):a==="yAxis"&&(ie=A==="left"&&!z||A==="right"&&z,G=y[q]-ie*N.width,te=s.top);var me=Qp(Qp(Qp({},N),be),{},{realScaleType:Ce,x:G,y:te,scale:Ae,width:a==="xAxis"?s.width:N.width,height:a==="yAxis"?s.height:N.height});return me.bandSize=Dre(me,be),!N.hide&&a==="xAxis"?y[q]+=(ie?-1:1)*me.height:N.hide||(y[q]+=(ie?-1:1)*me.width),Qp(Qp({},j),{},Pae({},C,me))},{})},PBe=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)}},NUt=function(e){var n=e.x1,s=e.y1,a=e.x2,o=e.y2;return PBe({x:n,y:s},{x:a,y:o})},LBe=function(){function t(e){bUt(this,t),this.scale=e}return wUt(t,[{key:"domain",get:function(){return this.scale.domain}},{key:"range",get:function(){return this.scale.range}},{key:"rangeMin",get:function(){return this.range()[0]}},{key:"rangeMax",get:function(){return this.range()[1]}},{key:"bandwidth",get:function(){return this.scale.bandwidth}},{key:"apply",value:function(n){var s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=s.bandAware,o=s.position;if(n!==void 0){if(o)switch(o){case"start":return this.scale(n);case"middle":{var l=this.bandwidth?this.bandwidth()/2:0;return this.scale(n)+l}case"end":{var i=this.bandwidth?this.bandwidth():0;return this.scale(n)+i}default:return this.scale(n)}if(a){var h=this.bandwidth?this.bandwidth()/2:0;return this.scale(n)+h}return this.scale(n)}}},{key:"isInRange",value:function(n){var s=this.range(),a=s[0],o=s[s.length-1];return a<=o?n>=a&&n<=o:n>=o&&n<=a}}],[{key:"create",value:function(n){return new t(n)}}])}();Pae(LBe,"EPS",1e-4);var _0e=function(e){var n=Object.keys(e).reduce(function(s,a){return Qp(Qp({},s),{},Pae({},a,LBe.create(e[a])))},{});return Qp(Qp({},n),{},{apply:function(a){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},l=o.bandAware,i=o.position;return V$t(a,function(h,p){return n[p].apply(h,{bandAware:l,position:i})})},isInRange:function(a){return MBe(a,function(o,l){return n[l].isInRange(o)})}})};function SUt(t){return(t%180+180)%180}var CUt=function(e){var n=e.width,s=e.height,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,o=SUt(a),l=o*Math.PI/180,i=Math.atan(s/n),h=l>i&&l-1?a[o?e[l]:l]:void 0}}var IUt=EUt,PUt=kBe;function LUt(t){var e=PUt(t),n=e%1;return e===e?n?e-n:e:0}var OUt=LUt,DUt=T7e,RUt=Ug,FUt=OUt,zUt=Math.max;function BUt(t,e,n){var s=t==null?0:t.length;if(!s)return-1;var a=n==null?0:FUt(n);return a<0&&(a=zUt(s+a,0)),DUt(t,RUt(e),a)}var $Ut=BUt,UUt=IUt,qUt=$Ut,VUt=UUt(qUt),HUt=VUt;const WUt=Hi(HUt);var GUt=U4t(function(t){return{x:t.left,y:t.top,width:t.width,height:t.height}},function(t){return["l",t.left,"t",t.top,"w",t.width,"h",t.height].join("")}),b0e=I.createContext(void 0),w0e=I.createContext(void 0),OBe=I.createContext(void 0),DBe=I.createContext({}),RBe=I.createContext(void 0),FBe=I.createContext(0),zBe=I.createContext(0),V3e=function(e){var n=e.state,s=n.xAxisMap,a=n.yAxisMap,o=n.offset,l=e.clipPathId,i=e.children,h=e.width,p=e.height,x=GUt(o);return st.createElement(b0e.Provider,{value:s},st.createElement(w0e.Provider,{value:a},st.createElement(DBe.Provider,{value:o},st.createElement(OBe.Provider,{value:x},st.createElement(RBe.Provider,{value:l},st.createElement(FBe.Provider,{value:p},st.createElement(zBe.Provider,{value:h},i)))))))},KUt=function(){return I.useContext(RBe)},BBe=function(e){var n=I.useContext(b0e);n==null&&ek();var s=n[e];return s==null&&ek(),s},ZUt=function(){var e=I.useContext(b0e);return E0(e)},YUt=function(){var e=I.useContext(w0e),n=WUt(e,function(s){return MBe(s.domain,Number.isFinite)});return n||E0(e)},$Be=function(e){var n=I.useContext(w0e);n==null&&ek();var s=n[e];return s==null&&ek(),s},XUt=function(){var e=I.useContext(OBe);return e},QUt=function(){return I.useContext(DBe)},j0e=function(){return I.useContext(zBe)},k0e=function(){return I.useContext(FBe)};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 JUt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function eqt(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 Oqt(t,e){return KBe(t,e+1)}function Dqt(t,e,n,s,a){for(var o=(s||[]).slice(),l=e.start,i=e.end,h=0,p=1,x=l,y=function(){var C=s==null?void 0:s[h];if(C===void 0)return{v:KBe(s,p)};var N=h,A,E=function(){return A===void 0&&(A=n(C,N)),A},T=C.coordinate,L=h===0||rne(t,T,E,x,i);L||(h=0,x=l,p+=1),L&&(x=T+t*(E()/2+a),h+=p)},b;p<=o.length;)if(b=y(),b)return b.v;return[]}function YE(t){"@babel/helpers - typeof";return YE=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},YE(t)}function Q3e(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 Xd(t){for(var e=1;e0?j.coordinate-A*t:j.coordinate})}else o[b]=j=Xd(Xd({},j),{},{tickCoord:j.coordinate});var E=rne(t,j.tickCoord,N,i,h);E&&(h=j.tickCoord-t*(N()/2+a),o[b]=Xd(Xd({},j),{},{isShow:!0}))},x=l-1;x>=0;x--)p(x);return o}function $qt(t,e,n,s,a,o){var l=(s||[]).slice(),i=l.length,h=e.start,p=e.end;if(o){var x=s[i-1],y=n(x,i-1),b=t*(x.coordinate+t*y/2-p);l[i-1]=x=Xd(Xd({},x),{},{tickCoord:b>0?x.coordinate-b*t:x.coordinate});var j=rne(t,x.tickCoord,function(){return y},h,p);j&&(p=x.tickCoord-t*(y/2+a),l[i-1]=Xd(Xd({},x),{},{isShow:!0}))}for(var C=o?i-1:i,N=function(T){var L=l[T],z,F=function(){return z===void 0&&(z=n(L,T)),z};if(T===0){var q=t*(L.coordinate-t*F()/2-h);l[T]=L=Xd(Xd({},L),{},{tickCoord:q<0?L.coordinate-q*t:L.coordinate})}else l[T]=L=Xd(Xd({},L),{},{tickCoord:L.coordinate});var H=rne(t,L.tickCoord,F,h,p);H&&(h=L.tickCoord+t*(F()/2+a),l[T]=Xd(Xd({},L),{},{isShow:!0}))},A=0;A=2?Pu(a[1].coordinate-a[0].coordinate):1,E=Lqt(o,A,j);return h==="equidistantPreserveStart"?Dqt(A,E,N,a,l):(h==="preserveStart"||h==="preserveStartEnd"?b=$qt(A,E,N,a,l,h==="preserveStartEnd"):b=Bqt(A,E,N,a,l),b.filter(function(T){return T.isShow}))}var Uqt=["viewBox"],qqt=["viewBox"],Vqt=["ticks"];function zC(t){"@babel/helpers - typeof";return zC=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},zC(t)}function $4(){return $4=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 Hqt(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 Wqt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function e5e(t,e){for(var n=0;n0?h(this.props):h(j)),l<=0||i<=0||!C||!C.length?null:st.createElement(No,{className:si("recharts-cartesian-axis",p),ref:function(A){s.layerReference=A}},o&&this.renderAxisLine(),this.renderTicks(C,this.state.fontSize,this.state.letterSpacing),cd.renderCallByParent(this.props))}}],[{key:"renderTickItem",value:function(s,a,o){var l,i=si(a.className,"recharts-cartesian-axis-tick-value");return st.isValidElement(s)?l=st.cloneElement(s,Rc(Rc({},a),{},{className:i})):Ua(s)?l=s(Rc(Rc({},a),{},{className:i})):l=st.createElement(Qj,$4({},a,{className:"recharts-cartesian-axis-tick-value"}),o),l}}])}(I.Component);M0e(S3,"displayName","CartesianAxis");M0e(S3,"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 Jqt=["x1","y1","x2","y2","key"],eVt=["offset"];function tk(t){"@babel/helpers - typeof";return tk=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},tk(t)}function t5e(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(t);e&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(t,a).enumerable})),n.push.apply(n,s)}return n}function Jd(t){for(var e=1;e=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}var aVt=function(e){var n=e.fill;if(!n||n==="none")return null;var s=e.fillOpacity,a=e.x,o=e.y,l=e.width,i=e.height,h=e.ry;return st.createElement("rect",{x:a,y:o,ry:h,width:l,height:i,stroke:"none",fill:n,fillOpacity:s,className:"recharts-cartesian-grid-bg"})};function XBe(t,e){var n;if(st.isValidElement(t))n=st.cloneElement(t,e);else if(Ua(t))n=t(e);else{var s=e.x1,a=e.y1,o=e.x2,l=e.y2,i=e.key,h=r5e(e,Jqt),p=Ia(h,!1);p.offset;var x=r5e(p,eVt);n=st.createElement("line",Kw({},x,{x1:s,y1:a,x2:o,y2:l,fill:"none",key:i}))}return n}function iVt(t){var e=t.x,n=t.width,s=t.horizontal,a=s===void 0?!0:s,o=t.horizontalPoints;if(!a||!o||!o.length)return null;var l=o.map(function(i,h){var p=Jd(Jd({},t),{},{x1:e,y1:i,x2:e+n,y2:i,key:"line-".concat(h),index:h});return XBe(a,p)});return st.createElement("g",{className:"recharts-cartesian-grid-horizontal"},l)}function oVt(t){var e=t.y,n=t.height,s=t.vertical,a=s===void 0?!0:s,o=t.verticalPoints;if(!a||!o||!o.length)return null;var l=o.map(function(i,h){var p=Jd(Jd({},t),{},{x1:i,y1:e,x2:i,y2:e+n,key:"line-".concat(h),index:h});return XBe(a,p)});return st.createElement("g",{className:"recharts-cartesian-grid-vertical"},l)}function lVt(t){var e=t.horizontalFill,n=t.fillOpacity,s=t.x,a=t.y,o=t.width,l=t.height,i=t.horizontalPoints,h=t.horizontal,p=h===void 0?!0:h;if(!p||!e||!e.length)return null;var x=i.map(function(b){return Math.round(b+a-a)}).sort(function(b,j){return b-j});a!==x[0]&&x.unshift(0);var y=x.map(function(b,j){var C=!x[j+1],N=C?a+l-b:x[j+1]-b;if(N<=0)return null;var A=j%e.length;return st.createElement("rect",{key:"react-".concat(j),y:b,x:s,height:N,width:o,stroke:"none",fill:e[A],fillOpacity:n,className:"recharts-cartesian-grid-bg"})});return st.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},y)}function cVt(t){var e=t.vertical,n=e===void 0?!0:e,s=t.verticalFill,a=t.fillOpacity,o=t.x,l=t.y,i=t.width,h=t.height,p=t.verticalPoints;if(!n||!s||!s.length)return null;var x=p.map(function(b){return Math.round(b+o-o)}).sort(function(b,j){return b-j});o!==x[0]&&x.unshift(0);var y=x.map(function(b,j){var C=!x[j+1],N=C?o+i-b:x[j+1]-b;if(N<=0)return null;var A=j%s.length;return st.createElement("rect",{key:"react-".concat(j),x:b,y:l,width:N,height:h,stroke:"none",fill:s[A],fillOpacity:a,className:"recharts-cartesian-grid-bg"})});return st.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},y)}var dVt=function(e,n){var s=e.xAxis,a=e.width,o=e.height,l=e.offset;return K9e(C0e(Jd(Jd(Jd({},S3.defaultProps),s),{},{ticks:Rx(s,!0),viewBox:{x:0,y:0,width:a,height:o}})),l.left,l.left+l.width,n)},uVt=function(e,n){var s=e.yAxis,a=e.width,o=e.height,l=e.offset;return K9e(C0e(Jd(Jd(Jd({},S3.defaultProps),s),{},{ticks:Rx(s,!0),viewBox:{x:0,y:0,width:a,height:o}})),l.top,l.top+l.height,n)},m4={horizontal:!0,vertical:!0,stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[]};function QBe(t){var e,n,s,a,o,l,i=j0e(),h=k0e(),p=QUt(),x=Jd(Jd({},t),{},{stroke:(e=t.stroke)!==null&&e!==void 0?e:m4.stroke,fill:(n=t.fill)!==null&&n!==void 0?n:m4.fill,horizontal:(s=t.horizontal)!==null&&s!==void 0?s:m4.horizontal,horizontalFill:(a=t.horizontalFill)!==null&&a!==void 0?a:m4.horizontalFill,vertical:(o=t.vertical)!==null&&o!==void 0?o:m4.vertical,verticalFill:(l=t.verticalFill)!==null&&l!==void 0?l:m4.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,b=x.y,j=x.width,C=x.height,N=x.syncWithTicks,A=x.horizontalValues,E=x.verticalValues,T=ZUt(),L=YUt();if(!Dn(j)||j<=0||!Dn(C)||C<=0||!Dn(y)||y!==+y||!Dn(b)||b!==+b)return null;var z=x.verticalCoordinatesGenerator||dVt,F=x.horizontalCoordinatesGenerator||uVt,q=x.horizontalPoints,H=x.verticalPoints;if((!q||!q.length)&&Ua(F)){var Z=A&&A.length,G=F({yAxis:L?Jd(Jd({},L),{},{ticks:Z?A:L.ticks}):void 0,width:i,height:h,offset:p},Z?!0:N);ym(Array.isArray(G),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(tk(G),"]")),Array.isArray(G)&&(q=G)}if((!H||!H.length)&&Ua(z)){var te=E&&E.length,ie=z({xAxis:T?Jd(Jd({},T),{},{ticks:te?E:T.ticks}):void 0,width:i,height:h,offset:p},te?!0:N);ym(Array.isArray(ie),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(tk(ie),"]")),Array.isArray(ie)&&(H=ie)}return st.createElement("g",{className:"recharts-cartesian-grid"},st.createElement(aVt,{fill:x.fill,fillOpacity:x.fillOpacity,x:x.x,y:x.y,width:x.width,height:x.height,ry:x.ry}),st.createElement(iVt,Kw({},x,{offset:p,horizontalPoints:q,xAxis:T,yAxis:L})),st.createElement(oVt,Kw({},x,{offset:p,verticalPoints:H,xAxis:T,yAxis:L})),st.createElement(lVt,Kw({},x,{horizontalPoints:q})),st.createElement(cVt,Kw({},x,{verticalPoints:H})))}QBe.displayName="CartesianGrid";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 hVt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function fVt(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 JVt(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 eHt(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function tHt(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 h$e(t){return t==="number"?[0,"auto"]:void 0}var Ppe=function(e,n,s,a){var o=e.graphicalItems,l=e.tooltipAxis,i=Bae(n,e);return s<0||!o||!o.length||s>=i.length?null:o.reduce(function(h,p){var x,y=(x=p.props.data)!==null&&x!==void 0?x:n;y&&e.dataStartIndex+e.dataEndIndex!==0&&e.dataEndIndex-e.dataStartIndex>=s&&(y=y.slice(e.dataStartIndex,e.dataEndIndex+1));var b;if(l.dataKey&&!l.allowDuplicatedCategory){var j=y===void 0?i:y;b=ife(j,l.dataKey,a)}else b=y&&y[s]||i[s];return b?[].concat(qC(h),[J9e(p,b)]):h},[])},l5e=function(e,n,s,a){var o=a||{x:e.chartX,y:e.chartY},l=fHt(o,s),i=e.orderedTooltipTicks,h=e.tooltipAxis,p=e.tooltipTicks,x=KRt(l,i,p,h);if(x>=0&&p){var y=p[x]&&p[x].value,b=Ppe(e,n,x,y),j=pHt(s,i,x,o);return{activeTooltipIndex:x,activeLabel:y,activePayload:b,activeCoordinate:j}}return null},mHt=function(e,n){var s=n.axes,a=n.graphicalItems,o=n.axisType,l=n.axisIdKey,i=n.stackGroups,h=n.dataStartIndex,p=n.dataEndIndex,x=e.layout,y=e.children,b=e.stackOffset,j=G9e(x,o);return s.reduce(function(C,N){var A,E=N.type.defaultProps!==void 0?Zr(Zr({},N.type.defaultProps),N.props):N.props,T=E.type,L=E.dataKey,z=E.allowDataOverflow,F=E.allowDuplicatedCategory,q=E.scale,H=E.ticks,Z=E.includeHidden,G=E[l];if(C[G])return C;var te=Bae(e.data,{graphicalItems:a.filter(function(be){var me,Le=l in be.props?be.props[l]:(me=be.type.defaultProps)===null||me===void 0?void 0:me[l];return Le===G}),dataStartIndex:h,dataEndIndex:p}),ie=te.length,le,ye,ne;$Vt(E.domain,z,T)&&(le=Kfe(E.domain,null,z),j&&(T==="number"||q!=="auto")&&(ne=wA(te,L,"category")));var ge=h$e(T);if(!le||le.length===0){var ae,he=(ae=E.domain)!==null&&ae!==void 0?ae:ge;if(L){if(le=wA(te,L,T),T==="category"&&j){var ue=FSt(le);F&&ue?(ye=le,le=Kre(0,ie)):F||(le=PCe(he,le,N).reduce(function(be,me){return be.indexOf(me)>=0?be:[].concat(qC(be),[me])},[]))}else if(T==="category")F?le=le.filter(function(be){return be!==""&&!vi(be)}):le=PCe(he,le,N).reduce(function(be,me){return be.indexOf(me)>=0||me===""||vi(me)?be:[].concat(qC(be),[me])},[]);else if(T==="number"){var _e=JRt(te,a.filter(function(be){var me,Le,Ne=l in be.props?be.props[l]:(me=be.type.defaultProps)===null||me===void 0?void 0:me[l],Be="hide"in be.props?be.props.hide:(Le=be.type.defaultProps)===null||Le===void 0?void 0:Le.hide;return Ne===G&&(Z||!Be)}),L,o,x);_e&&(le=_e)}j&&(T==="number"||q!=="auto")&&(ne=wA(te,L,"category"))}else j?le=Kre(0,ie):i&&i[G]&&i[G].hasStack&&T==="number"?le=b==="expand"?[0,1]:Q9e(i[G].stackGroups,h,p):le=W9e(te,a.filter(function(be){var me=l in be.props?be.props[l]:be.type.defaultProps[l],Le="hide"in be.props?be.props.hide:be.type.defaultProps.hide;return me===G&&(Z||!Le)}),T,x,!0);if(T==="number")le=Ape(y,le,G,o,H),he&&(le=Kfe(he,le,z));else if(T==="category"&&he){var Ae=he,Ce=le.every(function(be){return Ae.indexOf(be)>=0});Ce&&(le=Ae)}}return Zr(Zr({},C),{},ba({},G,Zr(Zr({},E),{},{axisType:o,domain:le,categoricalDomain:ne,duplicateDomain:ye,originalDomain:(A=E.domain)!==null&&A!==void 0?A:ge,isCategorical:j,layout:x})))},{})},gHt=function(e,n){var s=n.graphicalItems,a=n.Axis,o=n.axisType,l=n.axisIdKey,i=n.stackGroups,h=n.dataStartIndex,p=n.dataEndIndex,x=e.layout,y=e.children,b=Bae(e.data,{graphicalItems:s,dataStartIndex:h,dataEndIndex:p}),j=b.length,C=G9e(x,o),N=-1;return s.reduce(function(A,E){var T=E.type.defaultProps!==void 0?Zr(Zr({},E.type.defaultProps),E.props):E.props,L=T[l],z=h$e("number");if(!A[L]){N++;var F;return C?F=Kre(0,j):i&&i[L]&&i[L].hasStack?(F=Q9e(i[L].stackGroups,h,p),F=Ape(y,F,L,o)):(F=Kfe(z,W9e(b,s.filter(function(q){var H,Z,G=l in q.props?q.props[l]:(H=q.type.defaultProps)===null||H===void 0?void 0:H[l],te="hide"in q.props?q.props.hide:(Z=q.type.defaultProps)===null||Z===void 0?void 0:Z.hide;return G===L&&!te}),"number",x),a.defaultProps.allowDataOverflow),F=Ape(y,F,L,o)),Zr(Zr({},A),{},ba({},L,Zr(Zr({axisType:o},a.defaultProps),{},{hide:!0,orientation:of(uHt,"".concat(o,".").concat(N%2),null),domain:F,originalDomain:z,isCategorical:C,layout:x})))}return A},{})},xHt=function(e,n){var s=n.axisType,a=s===void 0?"xAxis":s,o=n.AxisComp,l=n.graphicalItems,i=n.stackGroups,h=n.dataStartIndex,p=n.dataEndIndex,x=e.children,y="".concat(a,"Id"),b=tp(x,o),j={};return b&&b.length?j=mHt(e,{axes:b,graphicalItems:l,axisType:a,axisIdKey:y,stackGroups:i,dataStartIndex:h,dataEndIndex:p}):l&&l.length&&(j=gHt(e,{Axis:o,graphicalItems:l,axisType:a,axisIdKey:y,stackGroups:i,dataStartIndex:h,dataEndIndex:p})),j},yHt=function(e){var n=E0(e),s=Rx(n,!1,!0);return{tooltipTicks:s,orderedTooltipTicks:Hye(s,function(a){return a.coordinate}),tooltipAxis:n,tooltipAxisBandSize:Dre(n,s)}},c5e=function(e){var n=e.children,s=e.defaultShowTooltip,a=Uh(n,LC),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}},vHt=function(e){return!e||!e.length?!1:e.some(function(n){var s=Zx(n&&n.type);return s&&s.indexOf("Bar")>=0})},d5e=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"}},_Ht=function(e,n){var s=e.props,a=e.graphicalItems,o=e.xAxisMap,l=o===void 0?{}:o,i=e.yAxisMap,h=i===void 0?{}:i,p=s.width,x=s.height,y=s.children,b=s.margin||{},j=Uh(y,LC),C=Uh(y,PS),N=Object.keys(h).reduce(function(F,q){var H=h[q],Z=H.orientation;return!H.mirror&&!H.hide?Zr(Zr({},F),{},ba({},Z,F[Z]+H.width)):F},{left:b.left||0,right:b.right||0}),A=Object.keys(l).reduce(function(F,q){var H=l[q],Z=H.orientation;return!H.mirror&&!H.hide?Zr(Zr({},F),{},ba({},Z,of(F,"".concat(Z))+H.height)):F},{top:b.top||0,bottom:b.bottom||0}),E=Zr(Zr({},A),N),T=E.bottom;j&&(E.bottom+=j.props.height||LC.defaultProps.height),C&&n&&(E=XRt(E,a,s,n));var L=p-E.left-E.right,z=x-E.top-E.bottom;return Zr(Zr({brushBottom:T},E),{},{width:Math.max(L,0),height:Math.max(z,0)})},bHt=function(e,n){if(n==="xAxis")return e[n].width;if(n==="yAxis")return e[n].height},f$e=function(e){var n=e.chartName,s=e.GraphicalChild,a=e.defaultTooltipEventType,o=a===void 0?"axis":a,l=e.validateTooltipEventTypes,i=l===void 0?["axis"]:l,h=e.axisComponents,p=e.legendContent,x=e.formatAxisMap,y=e.defaultProps,b=function(E,T){var L=T.graphicalItems,z=T.stackGroups,F=T.offset,q=T.updateId,H=T.dataStartIndex,Z=T.dataEndIndex,G=E.barSize,te=E.layout,ie=E.barGap,le=E.barCategoryGap,ye=E.maxBarSize,ne=d5e(te),ge=ne.numericAxisName,ae=ne.cateAxisName,he=vHt(L),ue=[];return L.forEach(function(_e,Ae){var Ce=Bae(E.data,{graphicalItems:[_e],dataStartIndex:H,dataEndIndex:Z}),be=_e.type.defaultProps!==void 0?Zr(Zr({},_e.type.defaultProps),_e.props):_e.props,me=be.dataKey,Le=be.maxBarSize,Ne=be["".concat(ge,"Id")],Be=be["".concat(ae,"Id")],Ee={},Ue=h.reduce(function(Oe,Qe){var nt=T["".concat(Qe.axisType,"Map")],gt=be["".concat(Qe.axisType,"Id")];nt&&nt[gt]||Qe.axisType==="zAxis"||ek();var mt=nt[gt];return Zr(Zr({},Oe),{},ba(ba({},Qe.axisType,mt),"".concat(Qe.axisType,"Ticks"),Rx(mt)))},Ee),Re=Ue[ae],je=Ue["".concat(ae,"Ticks")],et=z&&z[Ne]&&z[Ne].hasStack&&lFt(_e,z[Ne].stackGroups),Te=Zx(_e.type).indexOf("Bar")>=0,Ze=Dre(Re,je),pe=[],yt=he&&ZRt({barSize:G,stackGroups:z,totalSize:bHt(Ue,ae)});if(Te){var rt,at,Me=vi(Le)?ye:Le,ft=(rt=(at=Dre(Re,je,!0))!==null&&at!==void 0?at:Me)!==null&&rt!==void 0?rt:0;pe=YRt({barGap:ie,barCategoryGap:le,bandSize:ft!==Ze?ft:Ze,sizeList:yt[Be],maxBarSize:Me}),ft!==Ze&&(pe=pe.map(function(Oe){return Zr(Zr({},Oe),{},{position:Zr(Zr({},Oe.position),{},{offset:Oe.position.offset-ft/2})})}))}var qe=_e&&_e.type&&_e.type.getComposedData;qe&&ue.push({props:Zr(Zr({},qe(Zr(Zr({},Ue),{},{displayedData:Ce,props:E,dataKey:me,item:_e,bandSize:Ze,barPosition:pe,offset:F,stackedData:et,layout:te,dataStartIndex:H,dataEndIndex:Z}))),{},ba(ba(ba({key:_e.key||"item-".concat(Ae)},ge,Ue[ge]),ae,Ue[ae]),"animationId",q)),childIndex:YSt(_e,E.children),item:_e})}),ue},j=function(E,T){var L=E.props,z=E.dataStartIndex,F=E.dataEndIndex,q=E.updateId;if(!C4e({props:L}))return null;var H=L.children,Z=L.layout,G=L.stackOffset,te=L.data,ie=L.reverseStackOrder,le=d5e(Z),ye=le.numericAxisName,ne=le.cateAxisName,ge=tp(H,s),ae=iFt(te,ge,"".concat(ye,"Id"),"".concat(ne,"Id"),G,ie),he=h.reduce(function(be,me){var Le="".concat(me.axisType,"Map");return Zr(Zr({},be),{},ba({},Le,xHt(L,Zr(Zr({},me),{},{graphicalItems:ge,stackGroups:me.axisType===ye&&ae,dataStartIndex:z,dataEndIndex:F}))))},{}),ue=_Ht(Zr(Zr({},he),{},{props:L,graphicalItems:ge}),T==null?void 0:T.legendBBox);Object.keys(he).forEach(function(be){he[be]=x(L,he[be],ue,be.replace("Map",""),n)});var _e=he["".concat(ne,"Map")],Ae=yHt(_e),Ce=b(L,Zr(Zr({},he),{},{dataStartIndex:z,dataEndIndex:F,updateId:q,graphicalItems:ge,stackGroups:ae,offset:ue}));return Zr(Zr({formattedGraphicalItems:Ce,graphicalItems:ge,offset:ue,stackGroups:ae},Ae),he)},C=function(A){function E(T){var L,z,F;return eHt(this,E),F=nHt(this,E,[T]),ba(F,"eventEmitterSymbol",Symbol("rechartsEventEmitter")),ba(F,"accessibilityManager",new BVt),ba(F,"handleLegendBBoxUpdate",function(q){if(q){var H=F.state,Z=H.dataStartIndex,G=H.dataEndIndex,te=H.updateId;F.setState(Zr({legendBBox:q},j({props:F.props,dataStartIndex:Z,dataEndIndex:G,updateId:te},Zr(Zr({},F.state),{},{legendBBox:q}))))}}),ba(F,"handleReceiveSyncEvent",function(q,H,Z){if(F.props.syncId===q){if(Z===F.eventEmitterSymbol&&typeof F.props.syncMethod!="function")return;F.applySyncEvent(H)}}),ba(F,"handleBrushChange",function(q){var H=q.startIndex,Z=q.endIndex;if(H!==F.state.dataStartIndex||Z!==F.state.dataEndIndex){var G=F.state.updateId;F.setState(function(){return Zr({dataStartIndex:H,dataEndIndex:Z},j({props:F.props,dataStartIndex:H,dataEndIndex:Z,updateId:G},F.state))}),F.triggerSyncEvent({dataStartIndex:H,dataEndIndex:Z})}}),ba(F,"handleMouseEnter",function(q){var H=F.getMouseInfo(q);if(H){var Z=Zr(Zr({},H),{},{isTooltipActive:!0});F.setState(Z),F.triggerSyncEvent(Z);var G=F.props.onMouseEnter;Ua(G)&&G(Z,q)}}),ba(F,"triggeredAfterMouseMove",function(q){var H=F.getMouseInfo(q),Z=H?Zr(Zr({},H),{},{isTooltipActive:!0}):{isTooltipActive:!1};F.setState(Z),F.triggerSyncEvent(Z);var G=F.props.onMouseMove;Ua(G)&&G(Z,q)}),ba(F,"handleItemMouseEnter",function(q){F.setState(function(){return{isTooltipActive:!0,activeItem:q,activePayload:q.tooltipPayload,activeCoordinate:q.tooltipPosition||{x:q.cx,y:q.cy}}})}),ba(F,"handleItemMouseLeave",function(){F.setState(function(){return{isTooltipActive:!1}})}),ba(F,"handleMouseMove",function(q){q.persist(),F.throttleTriggeredAfterMouseMove(q)}),ba(F,"handleMouseLeave",function(q){F.throttleTriggeredAfterMouseMove.cancel();var H={isTooltipActive:!1};F.setState(H),F.triggerSyncEvent(H);var Z=F.props.onMouseLeave;Ua(Z)&&Z(H,q)}),ba(F,"handleOuterEvent",function(q){var H=ZSt(q),Z=of(F.props,"".concat(H));if(H&&Ua(Z)){var G,te;/.*touch.*/i.test(H)?te=F.getMouseInfo(q.changedTouches[0]):te=F.getMouseInfo(q),Z((G=te)!==null&&G!==void 0?G:{},q)}}),ba(F,"handleClick",function(q){var H=F.getMouseInfo(q);if(H){var Z=Zr(Zr({},H),{},{isTooltipActive:!0});F.setState(Z),F.triggerSyncEvent(Z);var G=F.props.onClick;Ua(G)&&G(Z,q)}}),ba(F,"handleMouseDown",function(q){var H=F.props.onMouseDown;if(Ua(H)){var Z=F.getMouseInfo(q);H(Z,q)}}),ba(F,"handleMouseUp",function(q){var H=F.props.onMouseUp;if(Ua(H)){var Z=F.getMouseInfo(q);H(Z,q)}}),ba(F,"handleTouchMove",function(q){q.changedTouches!=null&&q.changedTouches.length>0&&F.throttleTriggeredAfterMouseMove(q.changedTouches[0])}),ba(F,"handleTouchStart",function(q){q.changedTouches!=null&&q.changedTouches.length>0&&F.handleMouseDown(q.changedTouches[0])}),ba(F,"handleTouchEnd",function(q){q.changedTouches!=null&&q.changedTouches.length>0&&F.handleMouseUp(q.changedTouches[0])}),ba(F,"handleDoubleClick",function(q){var H=F.props.onDoubleClick;if(Ua(H)){var Z=F.getMouseInfo(q);H(Z,q)}}),ba(F,"handleContextMenu",function(q){var H=F.props.onContextMenu;if(Ua(H)){var Z=F.getMouseInfo(q);H(Z,q)}}),ba(F,"triggerSyncEvent",function(q){F.props.syncId!==void 0&&ode.emit(lde,F.props.syncId,q,F.eventEmitterSymbol)}),ba(F,"applySyncEvent",function(q){var H=F.props,Z=H.layout,G=H.syncMethod,te=F.state.updateId,ie=q.dataStartIndex,le=q.dataEndIndex;if(q.dataStartIndex!==void 0||q.dataEndIndex!==void 0)F.setState(Zr({dataStartIndex:ie,dataEndIndex:le},j({props:F.props,dataStartIndex:ie,dataEndIndex:le,updateId:te},F.state)));else if(q.activeTooltipIndex!==void 0){var ye=q.chartX,ne=q.chartY,ge=q.activeTooltipIndex,ae=F.state,he=ae.offset,ue=ae.tooltipTicks;if(!he)return;if(typeof G=="function")ge=G(ue,q);else if(G==="value"){ge=-1;for(var _e=0;_e=0){var et,Te;if(ye.dataKey&&!ye.allowDuplicatedCategory){var Ze=typeof ye.dataKey=="function"?je:"payload.".concat(ye.dataKey.toString());et=ife(_e,Ze,ge),Te=Ae&&Ce&&ife(Ce,Ze,ge)}else et=_e==null?void 0:_e[ne],Te=Ae&&Ce&&Ce[ne];if(Be||Ne){var pe=q.props.activeIndex!==void 0?q.props.activeIndex:ne;return[I.cloneElement(q,Zr(Zr(Zr({},G.props),Ue),{},{activeIndex:pe})),null,null]}if(!vi(et))return[Re].concat(qC(F.renderActivePoints({item:G,activePoint:et,basePoint:Te,childIndex:ne,isRange:Ae})))}else{var yt,rt=(yt=F.getItemByXY(F.state.activeCoordinate))!==null&&yt!==void 0?yt:{graphicalItem:Re},at=rt.graphicalItem,Me=at.item,ft=Me===void 0?q:Me,qe=at.childIndex,Oe=Zr(Zr(Zr({},G.props),Ue),{},{activeIndex:qe});return[I.cloneElement(ft,Oe),null,null]}return Ae?[Re,null,null]:[Re,null]}),ba(F,"renderCustomized",function(q,H,Z){return I.cloneElement(q,Zr(Zr({key:"recharts-customized-".concat(Z)},F.props),F.state))}),ba(F,"renderMap",{CartesianGrid:{handler:JL,once:!0},ReferenceArea:{handler:F.renderReferenceElement},ReferenceLine:{handler:JL},ReferenceDot:{handler:F.renderReferenceElement},XAxis:{handler:JL},YAxis:{handler:JL},Brush:{handler:F.renderBrush,once:!0},Bar:{handler:F.renderGraphicChild},Line:{handler:F.renderGraphicChild},Area:{handler:F.renderGraphicChild},Radar:{handler:F.renderGraphicChild},RadialBar:{handler:F.renderGraphicChild},Scatter:{handler:F.renderGraphicChild},Pie:{handler:F.renderGraphicChild},Funnel:{handler:F.renderGraphicChild},Tooltip:{handler:F.renderCursor,once:!0},PolarGrid:{handler:F.renderPolarGrid,once:!0},PolarAngleAxis:{handler:F.renderPolarAxis},PolarRadiusAxis:{handler:F.renderPolarAxis},Customized:{handler:F.renderCustomized}}),F.clipPathId="".concat((L=T.id)!==null&&L!==void 0?L:zI("recharts"),"-clip"),F.throttleTriggeredAfterMouseMove=q7e(F.triggeredAfterMouseMove,(z=T.throttleDelay)!==null&&z!==void 0?z:1e3/60),F.state={},F}return iHt(E,A),rHt(E,[{key:"componentDidMount",value:function(){var L,z;this.addListener(),this.accessibilityManager.setDetails({container:this.container,offset:{left:(L=this.props.margin.left)!==null&&L!==void 0?L: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 L=this.props,z=L.children,F=L.data,q=L.height,H=L.layout,Z=Uh(z,Xp);if(Z){var G=Z.props.defaultIndex;if(!(typeof G!="number"||G<0||G>this.state.tooltipTicks.length-1)){var te=this.state.tooltipTicks[G]&&this.state.tooltipTicks[G].value,ie=Ppe(this.state,F,G,te),le=this.state.tooltipTicks[G].coordinate,ye=(this.state.offset.top+q)/2,ne=H==="horizontal",ge=ne?{x:le,y:ye}:{y:le,x:ye},ae=this.state.formattedGraphicalItems.find(function(ue){var _e=ue.item;return _e.type.name==="Scatter"});ae&&(ge=Zr(Zr({},ge),ae.props.points[G].tooltipPosition),ie=ae.props.points[G].tooltipPayload);var he={activeTooltipIndex:G,isTooltipActive:!0,activeLabel:te,activePayload:ie,activeCoordinate:ge};this.setState(he),this.renderCursor(Z),this.accessibilityManager.setIndex(G)}}}},{key:"getSnapshotBeforeUpdate",value:function(L,z){if(!this.props.accessibilityLayer)return null;if(this.state.tooltipTicks!==z.tooltipTicks&&this.accessibilityManager.setDetails({coordinateList:this.state.tooltipTicks}),this.props.layout!==L.layout&&this.accessibilityManager.setDetails({layout:this.props.layout}),this.props.margin!==L.margin){var F,q;this.accessibilityManager.setDetails({offset:{left:(F=this.props.margin.left)!==null&&F!==void 0?F:0,top:(q=this.props.margin.top)!==null&&q!==void 0?q:0}})}return null}},{key:"componentDidUpdate",value:function(L){lfe([Uh(L.children,Xp)],[Uh(this.props.children,Xp)])||this.displayDefaultTooltip()}},{key:"componentWillUnmount",value:function(){this.removeListener(),this.throttleTriggeredAfterMouseMove.cancel()}},{key:"getTooltipEventType",value:function(){var L=Uh(this.props.children,Xp);if(L&&typeof L.props.shared=="boolean"){var z=L.props.shared?"axis":"item";return i.indexOf(z)>=0?z:o}return o}},{key:"getMouseInfo",value:function(L){if(!this.container)return null;var z=this.container,F=z.getBoundingClientRect(),q=wLt(F),H={chartX:Math.round(L.pageX-q.left),chartY:Math.round(L.pageY-q.top)},Z=F.width/z.offsetWidth||1,G=this.inRange(H.chartX,H.chartY,Z);if(!G)return null;var te=this.state,ie=te.xAxisMap,le=te.yAxisMap,ye=this.getTooltipEventType(),ne=l5e(this.state,this.props.data,this.props.layout,G);if(ye!=="axis"&&ie&&le){var ge=E0(ie).scale,ae=E0(le).scale,he=ge&&ge.invert?ge.invert(H.chartX):null,ue=ae&&ae.invert?ae.invert(H.chartY):null;return Zr(Zr({},H),{},{xValue:he,yValue:ue},ne)}return ne?Zr(Zr({},H),ne):null}},{key:"inRange",value:function(L,z){var F=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,q=this.props.layout,H=L/F,Z=z/F;if(q==="horizontal"||q==="vertical"){var G=this.state.offset,te=H>=G.left&&H<=G.left+G.width&&Z>=G.top&&Z<=G.top+G.height;return te?{x:H,y:Z}:null}var ie=this.state,le=ie.angleAxisMap,ye=ie.radiusAxisMap;if(le&&ye){var ne=E0(le);return DCe({x:H,y:Z},ne)}return null}},{key:"parseEventsOfWrapper",value:function(){var L=this.props.children,z=this.getTooltipEventType(),F=Uh(L,Xp),q={};F&&z==="axis"&&(F.props.trigger==="click"?q={onClick:this.handleClick}:q={onMouseEnter:this.handleMouseEnter,onDoubleClick:this.handleDoubleClick,onMouseMove:this.handleMouseMove,onMouseLeave:this.handleMouseLeave,onTouchMove:this.handleTouchMove,onTouchStart:this.handleTouchStart,onTouchEnd:this.handleTouchEnd,onContextMenu:this.handleContextMenu});var H=cre(this.props,this.handleOuterEvent);return Zr(Zr({},H),q)}},{key:"addListener",value:function(){ode.on(lde,this.handleReceiveSyncEvent)}},{key:"removeListener",value:function(){ode.removeListener(lde,this.handleReceiveSyncEvent)}},{key:"filterFormatItem",value:function(L,z,F){for(var q=this.state.formattedGraphicalItems,H=0,Z=q.length;H");return t}const g$e=I.forwardRef(({id:t,className:e,children:n,config:s,...a},o)=>{const l=I.useId(),i=`chart-${t||l.replace(/:/g,"")}`;return r.jsx(p$e.Provider,{value:{config:s},children:r.jsxs("div",{"data-chart":i,ref:o,className:$t("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(NHt,{id:i,config:s}),r.jsx(Efe,{children:n})]})})});g$e.displayName="Chart";const NHt=({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(kHt).map(([s,a])=>` ${a} [data-chart=${t}] { ${n.map(([o,l])=>{var h;const i=((h=l.theme)==null?void 0:h[s])||l.color;return i?` --color-${o}: ${i};`:null}).join(` `)} } `).join(` `)}}):null},x$e=I.forwardRef(({active:t,payload:e,className:n,indicator:s="dot",hideLabel:a=!1,hideIndicator:o=!1,label:l,labelFormatter:i,labelClassName:h,formatter:p,color:x,nameKey:y,labelKey:b},j)=>{const{config:C}=m$e(),N=I.useMemo(()=>{var F;if(a||!(e!=null&&e.length))return null;const[E]=e,T=`${b||E.dataKey||E.name||"value"}`,L=Lpe(C,E,T),z=!b&&typeof l=="string"?((F=C[l])==null?void 0:F.label)||l:L==null?void 0:L.label;return i?r.jsx("div",{className:$t("font-medium",h),children:i(z,e)}):z?r.jsx("div",{className:$t("font-medium",h),children:z}):null},[l,i,e,a,h,C,b]);if(!t||!(e!=null&&e.length))return null;const A=e.length===1&&s!=="dot";return r.jsxs("div",{ref:j,className:$t("grid min-w-[8rem] items-start gap-1.5 rounded-lg border border-border/50 bg-background px-2.5 py-1.5 text-xs shadow-xl",n),children:[A?null:N,r.jsx("div",{className:"grid gap-1.5",children:e.map((E,T)=>{const L=`${y||E.name||E.dataKey||"value"}`,z=Lpe(C,E,L),F=x||E.payload.fill||E.color;return r.jsx("div",{className:$t("flex w-full flex-wrap items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-muted-foreground",s==="dot"&&"items-center"),children:p&&(E==null?void 0:E.value)!==void 0&&E.name?p(E.value,E.name,E,T,E.payload):r.jsxs(r.Fragment,{children:[z!=null&&z.icon?r.jsx(z.icon,{}):!o&&r.jsx("div",{className:$t("shrink-0 rounded-[2px] border-[--color-border] bg-[--color-bg]",{"h-2.5 w-2.5":s==="dot","w-1":s==="line","w-0 border-[1.5px] border-dashed bg-transparent":s==="dashed","my-0.5":A&&s==="dashed"}),style:{"--color-bg":F,"--color-border":F}}),r.jsxs("div",{className:$t("flex flex-1 justify-between leading-none",A?"items-end":"items-center"),children:[r.jsxs("div",{className:"grid gap-1.5",children:[A?N:null,r.jsx("span",{className:"text-muted-foreground",children:(z==null?void 0:z.label)||E.name})]}),E.value&&r.jsx("span",{className:"font-mono font-medium tabular-nums text-foreground",children:E.value.toLocaleString()})]})]})},E.dataKey)})})]})});x$e.displayName="ChartTooltip";const SHt=I.forwardRef(({className:t,hideIcon:e=!1,payload:n,verticalAlign:s="bottom",nameKey:a},o)=>{const{config:l}=m$e();return n!=null&&n.length?r.jsx("div",{ref:o,className:$t("flex items-center justify-center gap-4",s==="top"?"pb-3":"pt-3",t),children:n.map(i=>{const h=`${a||i.dataKey||"value"}`,p=Lpe(l,i,h);return r.jsxs("div",{className:$t("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});SHt.displayName="ChartLegend";function Lpe(t,e,n){if(typeof e!="object"||e===null)return;const s="payload"in e&&typeof e.payload=="object"&&e.payload!==null?e.payload:void 0;let a=n;return n in e&&typeof e[n]=="string"?a=e[n]:s&&n in s&&typeof s[n]=="string"&&(a=s[n]),a in t?t[a]:t[n]}const eO=["hsl(var(--primary))","hsl(var(--secondary))","hsl(210, 70%, 50%)","hsl(170, 60%, 45%)","hsl(280, 60%, 55%)","hsl(30, 70%, 50%)","hsl(340, 65%, 55%)","hsl(200, 65%, 50%)"];function y$e({stats:t,year:e}){const n=t.transactionsByMonth.some(a=>a.count>0),s=t.leadSourceBreakdown.length>0;return!n&&!s?r.jsx(Ye,{children:r.jsx(tt,{className:"py-12 text-center text-muted-foreground",children:"Add transactions to see your performance charts"})}):r.jsxs("div",{className:"grid gap-6",children:[n&&r.jsxs(Ye,{className:"overflow-hidden",children:[r.jsx(Gt,{children:r.jsx(Zt,{className:"text-base",children:"Transactions by Month"})}),r.jsx(tt,{className:"overflow-hidden",children:r.jsx(g$e,{config:{count:{label:"Transactions",color:"hsl(var(--primary))"}},className:"h-[250px]",children:r.jsx(Efe,{width:"100%",height:"100%",children:r.jsxs(wHt,{data:t.transactionsByMonth,margin:{top:5,right:10,left:0,bottom:5},children:[r.jsx(QBe,{strokeDasharray:"3 3",className:"stroke-muted"}),r.jsx(Fae,{dataKey:"month",tick:{fontSize:11},className:"fill-muted-foreground",interval:0}),r.jsx(zae,{allowDecimals:!1,tick:{fontSize:12},className:"fill-muted-foreground",width:30}),r.jsx(Xp,{content:r.jsx(x$e,{})}),r.jsx(pk,{dataKey:"count",fill:"hsl(var(--primary))",radius:[4,4,0,0],name:"Transactions"})]})})})})]}),s&&r.jsxs(Ye,{children:[r.jsx(Gt,{children:r.jsx(Zt,{className:"text-base",children:"Lead Sources"})}),r.jsxs(tt,{children:[r.jsx("div",{className:"h-[250px]",children:r.jsx(Efe,{width:"100%",height:"100%",children:r.jsxs(jHt,{children:[r.jsx(xy,{data:t.leadSourceBreakdown,dataKey:"count",nameKey:"name",cx:"50%",cy:"50%",outerRadius:80,label:({name:a,percent:o})=>o>.05?`${a} (${(o*100).toFixed(0)}%)`:"",labelLine:!1,children:t.leadSourceBreakdown.map((a,o)=>r.jsx(fae,{fill:eO[o%eO.length]},`cell-${o}`))}),r.jsx(Xp,{formatter:(a,o)=>[`${a} deals`,o]})]})})}),r.jsx("div",{className:"flex flex-wrap gap-2 mt-2 justify-center",children:t.leadSourceBreakdown.slice(0,6).map((a,o)=>r.jsxs("div",{className:"flex items-center gap-1 text-xs",children:[r.jsx("div",{className:"w-3 h-3 rounded-sm",style:{backgroundColor:eO[o%eO.length]}}),r.jsx("span",{className:"text-muted-foreground",children:a.name})]},a.name))})]})]})]})}function CHt(t){if(!t||!t.trim())return null;const e=t.trim(),n=["yyyy-MM-dd","M/d/yyyy","MM/dd/yyyy","M-d-yyyy","MM-dd-yyyy","MM/dd/yy","M/d/yy"];for(const s of n)try{const a=oxe(e,s,new Date);if(xhe(a))return yn(a,"yyyy-MM-dd")}catch{}try{const s=new Date(e);if(xhe(s))return yn(s,"yyyy-MM-dd")}catch{}return null}const MHt=["property_address","city","state","zip","transaction_type","close_date","sale_price","commission_amount","lead_source","client_type","is_win","notes"];function THt({open:t,onOpenChange:e}){const[n,s]=I.useState([]),[a,o]=I.useState(!1),[l,i]=I.useState(0),{data:h}=vse(),{data:p}=Sm(),x=_se(),y=()=>{const E=MHt.join(","),T=["123 Main St","Dallas","TX","75001","buyer","2024-06-15","450000","13500","Referral","Past Client","yes","Great transaction!"].join(","),L=`${E} ${T}`,z=new Blob([L],{type:"text/csv"}),F=URL.createObjectURL(z),q=document.createElement("a");q.href=F,q.download="transaction-import-template.csv",q.click(),URL.revokeObjectURL(F)},b=E=>{const T=E.split(` `).filter(z=>z.trim());if(T.length<2)return[];const L=T[0].split(",").map(z=>z.trim().toLowerCase().replace(/['"]/g,""));return T.slice(1).map((z,F)=>{var he,ue,_e,Ae;const q=[];let H="",Z=!1;for(const Ce of z)Ce==='"'?Z=!Z:Ce===","&&!Z?(q.push(H.trim()),H=""):H+=Ce;q.push(H.trim());const G=Ce=>{var me;const be=L.indexOf(Ce);return be>=0?(me=q[be])==null?void 0:me.replace(/^["']|["']$/g,"").trim():""},te=(he=G("transaction_type"))==null?void 0:he.toLowerCase(),ie=(ue=G("sale_price"))==null?void 0:ue.replace(/[$,]/g,""),le=(_e=G("commission_amount"))==null?void 0:_e.replace(/[$,]/g,""),ye=(Ae=G("is_win"))==null?void 0:Ae.toLowerCase(),ne=G("close_date"),ge=CHt(ne);let ae;return G("property_address")?["buyer","seller"].includes(te)?ge?(!ie||isNaN(Number(ie)))&&(ae="Invalid sale price"):ae=`Invalid date format: "${ne}" - use MM/DD/YYYY or YYYY-MM-DD`:ae='Transaction type must be "buyer" or "seller"':ae="Missing property address",{property_address:G("property_address"),city:G("city"),state:G("state"),zip:G("zip"),transaction_type:te==="seller"?"seller":"buyer",close_date:ge||"",sale_price:Number(ie)||0,commission_amount:le?Number(le):null,lead_source_name:G("lead_source"),client_type_name:G("client_type"),is_win:["yes","true","1"].includes(ye),notes:G("notes"),error:ae}})},j=E=>{var z;const T=(z=E.target.files)==null?void 0:z[0];if(!T)return;const L=new FileReader;L.onload=F=>{var Z;const q=(Z=F.target)==null?void 0:Z.result,H=b(q);s(H)},L.readAsText(T)},C=async()=>{const E=n.filter(z=>!z.error);if(E.length===0){ze.error("No valid transactions to import");return}o(!0),i(0);let T=0,L=0;for(let z=0;zZ.name.toLowerCase()===F.lead_source_name.toLowerCase()),H=p==null?void 0:p.find(Z=>Z.name.toLowerCase()===F.client_type_name.toLowerCase());await x.mutateAsync({property_address:F.property_address,city:F.city||null,state:F.state||null,zip:F.zip||null,transaction_type:F.transaction_type,close_date:F.close_date,sale_price:F.sale_price,commission_amount:F.commission_amount,lead_source_id:(q==null?void 0:q.id)||null,client_type_id:(H==null?void 0:H.id)||null,contact_id:null,notes:F.notes||null,is_win:F.is_win}),T++}catch(q){L++,console.error("Failed to import transaction:",q)}i(Math.round((z+1)/E.length*100))}o(!1),T>0&&ze.success(`Imported ${T} transaction${T>1?"s":""}`),L>0&&ze.error(`Failed to import ${L} transaction${L>1?"s":""}`),s([]),e(!1)},N=n.filter(E=>!E.error).length,A=n.filter(E=>E.error).length;return r.jsx(Fr,{open:t,onOpenChange:e,children:r.jsxs(Rr,{className:"max-w-2xl max-h-[90vh]",children:[r.jsxs(qr,{children:[r.jsx($r,{children:"Import Transactions"}),r.jsx(Xn,{children:"Upload a CSV file with your past transactions"})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between p-3 border rounded-lg bg-muted/50",children:[r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:"Download Template"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Get a CSV template with the correct format"})]}),r.jsxs(ee,{variant:"outline",onClick:y,children:[r.jsx(no,{className:"h-4 w-4 mr-2"}),"Template"]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"csv-file",children:"Upload CSV File"}),r.jsx(dt,{id:"csv-file",type:"file",accept:".csv",onChange:j})]}),n.length>0&&r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs(Ot,{variant:"outline",children:[n.length," rows found"]}),N>0&&r.jsxs(Ot,{className:"bg-green-500 text-white",children:[r.jsx(Ai,{className:"h-3 w-3 mr-1"}),N," valid"]}),A>0&&r.jsxs(Ot,{variant:"destructive",children:[r.jsx(Il,{className:"h-3 w-3 mr-1"}),A," errors"]})]}),r.jsx(Jo,{className:"h-[200px] border rounded-lg",children:r.jsxs("div",{className:"p-2 space-y-2",children:[n.slice(0,10).map((E,T)=>r.jsxs("div",{className:`p-2 rounded text-sm ${E.error?"bg-destructive/10":"bg-muted/50"}`,children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{className:"font-medium",children:E.property_address||"(no address)"}),r.jsx(Ot,{variant:E.transaction_type==="buyer"?"default":"secondary",children:E.transaction_type})]}),r.jsxs("div",{className:"text-muted-foreground",children:[E.close_date," • $",E.sale_price.toLocaleString()]}),E.error&&r.jsx(Ixe,{variant:"destructive",className:"mt-1 py-1",children:r.jsx(Pxe,{className:"text-xs",children:E.error})})]},T)),n.length>10&&r.jsxs("p",{className:"text-center text-sm text-muted-foreground",children:["...and ",n.length-10," more"]})]})}),a&&r.jsxs("div",{className:"space-y-2",children:[r.jsx("div",{className:"w-full bg-muted rounded-full h-2",children:r.jsx("div",{className:"bg-primary h-2 rounded-full transition-all",style:{width:`${l}%`}})}),r.jsxs("p",{className:"text-sm text-center text-muted-foreground",children:["Importing... ",l,"%"]})]})]}),r.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[r.jsx(ee,{variant:"outline",onClick:()=>e(!1),children:"Cancel"}),r.jsxs(ee,{onClick:C,disabled:N===0||a,children:[r.jsx(uo,{className:"h-4 w-4 mr-2"}),"Import ",N," Transaction",N!==1?"s":""]})]})]})]})})}const AHt=c3({transactions_goal:iA().min(0).optional(),volume_goal:iA().min(0).optional(),gci_goal:iA().min(0).optional()});function EHt({open:t,onOpenChange:e,year:n,existingGoals:s}){const a=Qft(),{data:o}=bse(),l=(o==null?void 0:o.show_commission)??!0,i=ose({resolver:lse(AHt),defaultValues:{transactions_goal:void 0,volume_goal:void 0,gci_goal:void 0}});I.useEffect(()=>{s?i.reset({transactions_goal:s.transactions_goal??void 0,volume_goal:s.volume_goal?Number(s.volume_goal):void 0,gci_goal:s.gci_goal?Number(s.gci_goal):void 0}):i.reset({transactions_goal:void 0,volume_goal:void 0,gci_goal:void 0})},[s,i,t]);const h=async p=>{await a.mutateAsync({year:n,transactions_goal:p.transactions_goal??null,volume_goal:p.volume_goal??null,gci_goal:l?p.gci_goal??null:null}),e(!1)};return r.jsx(Fr,{open:t,onOpenChange:e,children:r.jsxs(Rr,{className:"max-w-md",children:[r.jsxs(qr,{children:[r.jsxs($r,{children:[n," Goals"]}),r.jsx(Xn,{children:"Set your annual targets to track your progress throughout the year."})]}),r.jsx(cse,{...i,children:r.jsxs("form",{onSubmit:i.handleSubmit(h),className:"space-y-4",children:[r.jsx(Tl,{control:i.control,name:"transactions_goal",render:({field:p})=>r.jsxs(bl,{children:[r.jsx(wl,{children:"Transactions Goal"}),r.jsx(jl,{children:r.jsx(dt,{type:"number",placeholder:"e.g., 24",...p,value:p.value??"",onChange:x=>p.onChange(x.target.value?Number(x.target.value):void 0)})}),r.jsx(aee,{children:"Total number of deals you want to close"}),r.jsx(Eu,{})]})}),r.jsx(Tl,{control:i.control,name:"volume_goal",render:({field:p})=>r.jsxs(bl,{children:[r.jsx(wl,{children:"Volume Goal ($)"}),r.jsx(jl,{children:r.jsx(dt,{type:"number",placeholder:"e.g., 5000000",...p,value:p.value??"",onChange:x=>p.onChange(x.target.value?Number(x.target.value):void 0)})}),r.jsx(aee,{children:"Total sales volume you want to achieve"}),r.jsx(Eu,{})]})}),l&&r.jsx(Tl,{control:i.control,name:"gci_goal",render:({field:p})=>r.jsxs(bl,{children:[r.jsx(wl,{children:"GCI Goal ($)"}),r.jsx(jl,{children:r.jsx(dt,{type:"number",placeholder:"e.g., 150000",...p,value:p.value??"",onChange:x=>p.onChange(x.target.value?Number(x.target.value):void 0)})}),r.jsx(aee,{children:"Gross commission income target"}),r.jsx(Eu,{})]})}),r.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[r.jsx(ee,{type:"button",variant:"outline",onClick:()=>e(!1),children:"Cancel"}),r.jsx(ee,{type:"submit",disabled:a.isPending,children:"Save Goals"})]})]})})]})})}const v$e=new Date().getFullYear(),IHt=Array.from({length:10},(t,e)=>v$e-e);function PHt(){var F;const[t,e]=I.useState(v$e),[n,s]=I.useState(!1),[a,o]=I.useState(!1),[l,i]=I.useState(!1),[h,p]=I.useState(!1),{data:x,isLoading:y}=vxe(t),{yearStats:b,lifetimeStats:j,showCommission:C}=j8e(t),{data:N,isLoading:A}=w8e(t),{data:E}=bse(),T=Jft(),L=()=>{if(!x||x.length===0)return;const q=["Property Address","City","State","Zip","Transaction Type","Close Date","Sale Price",...C?["Commission"]:[],"Lead Source","Client Type","Contact Name","Is Win","Notes"],H=x.map(le=>{var ye,ne;return[le.property_address,le.city||"",le.state||"",le.zip||"",le.transaction_type,le.close_date,le.sale_price,...C?[le.commission_amount||""]:[],((ye=le.lead_source)==null?void 0:ye.name)||"",((ne=le.client_type)==null?void 0:ne.name)||"",le.contact?`${le.contact.first_name} ${le.contact.last_name||""}`.trim():"",le.is_win?"Yes":"No",le.notes||""]}),Z=[q,...H].map(le=>le.map(ye=>`"${String(ye).replace(/"/g,'""')}"`).join(",")).join(` `),G=new Blob([Z],{type:"text/csv"}),te=URL.createObjectURL(G),ie=document.createElement("a");ie.href=te,ie.download=`transactions-${t}.csv`,ie.click(),URL.revokeObjectURL(te)},z=!x||x.length===0;return r.jsxs(Lr,{title:"Scorecard",children:[r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("h1",{className:"text-2xl font-bold",children:"Scorecard"}),r.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wide px-1.5 py-0.5 rounded border border-amber-500 text-amber-600 dark:text-amber-400 bg-amber-500/10",children:"Beta"})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold text-foreground",children:"Business Scorecard"}),r.jsx("p",{className:"text-muted-foreground",children:"Track your transactions, goals, and performance"})]}),r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsxs(gn,{value:String(t),onValueChange:q=>e(Number(q)),children:[r.jsx(fn,{className:"w-[120px]",children:r.jsx(xn,{})}),r.jsx(pn,{children:IHt.map(q=>r.jsx(Vt,{value:String(q),children:q},q))})]}),r.jsx(ee,{variant:"outline",size:"icon",onClick:()=>p(!h),children:r.jsx(fd,{className:"h-4 w-4"})})]})]}),h&&r.jsxs(Ye,{children:[r.jsx(Gt,{className:"pb-3",children:r.jsx(Zt,{className:"text-lg",children:"Settings"})}),r.jsx(tt,{children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"space-y-0.5",children:[r.jsx(He,{children:"Show Commission"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Display commission fields and include in stats"})]}),r.jsx(Ps,{checked:(E==null?void 0:E.show_commission)??!0,onCheckedChange:q=>T.mutate({show_commission:q})})]})})]}),z&&!y?r.jsx(Ye,{className:"py-12",children:r.jsxs(tt,{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(cc,{className:"h-8 w-8 text-primary"})}),r.jsxs("div",{children:[r.jsx("h3",{className:"text-lg font-semibold",children:"Start Tracking Your Success"}),r.jsx("p",{className:"text-muted-foreground max-w-md mx-auto mt-1",children:"Add your past transactions to see your performance metrics, track your goals, and celebrate your wins."})]}),r.jsxs("div",{className:"flex flex-wrap justify-center gap-2 pt-2",children:[r.jsxs(ee,{onClick:()=>s(!0),children:[r.jsx(bn,{className:"h-4 w-4 mr-2"}),"Add Your First Transaction"]}),r.jsxs(ee,{variant:"outline",onClick:()=>o(!0),children:[r.jsx(uo,{className:"h-4 w-4 mr-2"}),"Import CSV"]})]}),r.jsxs("div",{className:"pt-4 border-t mt-4",children:[r.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:"Need help formatting your data?"}),r.jsx(ee,{variant:"link",className:"h-auto p-0",asChild:!0,children:r.jsxs("a",{href:"/templates/transaction-import-template.csv",download:!0,children:[r.jsx(no,{className:"h-4 w-4 mr-2"}),"Download CSV Template"]})})]})]})}):r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"flex flex-wrap gap-2",children:[r.jsxs(ee,{onClick:()=>s(!0),children:[r.jsx(bn,{className:"h-4 w-4 mr-2"}),"Add Transaction"]}),r.jsxs(ee,{variant:"outline",onClick:()=>i(!0),children:[r.jsx(Hx,{className:"h-4 w-4 mr-2"}),"Set Goals"]}),r.jsxs(ee,{variant:"outline",onClick:()=>o(!0),children:[r.jsx(uo,{className:"h-4 w-4 mr-2"}),"Import"]}),r.jsxs(ee,{variant:"outline",onClick:L,disabled:z,children:[r.jsx(no,{className:"h-4 w-4 mr-2"}),"Export"]}),r.jsx(ee,{variant:"ghost",size:"sm",asChild:!0,children:r.jsxs("a",{href:"/templates/transaction-import-template.csv",download:!0,children:[r.jsx(no,{className:"h-4 w-4 mr-2"}),"CSV Template"]})})]}),r.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 lg:grid-cols-6 gap-4",children:[r.jsx(Ye,{children:r.jsxs(tt,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(pa,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs font-medium",children:"Transactions"})]}),r.jsx("p",{className:"text-2xl font-bold",children:b.totalTransactions}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[j.totalTransactions," lifetime"]})]})}),r.jsx(Ye,{children:r.jsxs(tt,{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:[b.buyerCount,"/",b.sellerCount]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"B/S split"})]})}),r.jsx(Ye,{children:r.jsxs(tt,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(hd,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs font-medium",children:"Volume"})]}),r.jsx("p",{className:"text-2xl font-bold",children:Ed(b.totalVolume,!0)}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[Ed(j.totalVolume,!0)," lifetime"]})]})}),r.jsx(Ye,{children:r.jsxs(tt,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(Xf,{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:Ed(b.averagePrice,!0)})]})}),r.jsx(Ye,{children:r.jsxs(tt,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(Ol,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs font-medium",children:"Top Source"})]}),r.jsx("p",{className:"text-lg font-bold truncate",children:((F=b.topLeadSource)==null?void 0:F.name)||"-"}),b.topLeadSource&&r.jsxs("p",{className:"text-xs text-muted-foreground",children:[b.topLeadSource.count," deals"]})]})}),C&&r.jsx(Ye,{children:r.jsxs(tt,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(hd,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs font-medium",children:"Commission"})]}),r.jsx("p",{className:"text-2xl font-bold",children:Ed(b.totalCommission,!0)}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[Ed(j.totalCommission,!0)," lifetime"]})]})})]}),N&&r.jsx(Mze,{goals:N,stats:b,year:t,showCommission:C}),r.jsxs(Ii,{defaultValue:"transactions",className:"space-y-4",children:[r.jsxs(wi,{children:[r.jsx(ln,{value:"transactions",children:"Transactions"}),r.jsx(ln,{value:"charts",children:"Charts"})]}),r.jsx(An,{value:"transactions",children:r.jsx(Cze,{transactions:x||[],showCommission:C,isLoading:y})}),r.jsx(An,{value:"charts",children:r.jsx(y$e,{stats:b,year:t})})]})]})]}),r.jsx(Sze,{open:n,onOpenChange:s}),r.jsx(THt,{open:a,onOpenChange:o}),r.jsx(EHt,{open:l,onOpenChange:i,year:t,existingGoals:N})]})}function _$e({open:t,onOpenChange:e,listingId:n,listingSlug:s,listingTitle:a}){const{user:o}=Qr(),[l,i]=I.useState(null),[h,p]=I.useState(!1),[x,y]=I.useState(!1);I.useEffect(()=>{(async()=>{if(!(!t||!o)){p(!0);try{const{data:A,error:E}=await J.from("listing_shares").select("id, share_token, click_count, lead_count").eq("listing_id",n).eq("sharing_agent_id",o.id).order("created_at",{ascending:!1}).limit(1).maybeSingle();if(E)throw E;if(A&&A.share_token)i(A);else if(A&&!A.share_token){const{data:T,error:L}=await J.from("listing_shares").update({share_type:"referral_link"}).eq("id",A.id).select("id, share_token, click_count, lead_count").single();if(L)throw L;i(T)}else{const{data:T,error:L}=await J.from("listing_shares").insert({listing_id:n,sharing_agent_id:o.id,share_type:"referral_link"}).select("id, share_token, click_count, lead_count").single();if(L)throw L;i(T)}}catch(A){console.error("Error creating share link:",A),ze.error("Failed to generate share link")}finally{p(!1)}}})()},[t,o,n]);const b=l!=null&&l.share_token?`https://listings.relevelup.com/${s||n}?ref=${l.share_token}`:"",j=async()=>{try{await navigator.clipboard.writeText(b),y(!0),ze.success("Link copied to clipboard!"),setTimeout(()=>y(!1),2e3)}catch{ze.error("Failed to copy link")}},C=N=>{const A=encodeURIComponent(b),E=encodeURIComponent(`Check out this listing: ${a}`);switch(N){case"email":window.open(`mailto:?subject=${E}&body=${A}`);break;case"text":window.open(`sms:?body=${E}%20${A}`);break;case"facebook":window.open(`https://www.facebook.com/sharer/sharer.php?u=${A}`,"_blank");break}};return r.jsx(Fr,{open:t,onOpenChange:e,children:r.jsxs(Rr,{className:"sm:max-w-md",children:[r.jsxs(qr,{children:[r.jsxs($r,{className:"flex items-center gap-2",children:[r.jsx(Ms,{className:"h-5 w-5 text-amber-500"}),"Share & Earn Leads"]}),r.jsx(Xn,{children:"Share this listing with your network. When someone submits a lead through your link, they'll become your contact!"})]}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsx("div",{className:"bg-amber-50 dark:bg-amber-950/30 border border-amber-200 dark:border-amber-800 rounded-lg p-3",children:r.jsxs("p",{className:"text-sm text-amber-800 dark:text-amber-200",children:[r.jsx("strong",{children:"How it works:"})," The listing still shows the original agent's info, but any leads from your unique link go directly to you!"]})}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Your Referral Link"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(dt,{value:h?"Generating...":b,readOnly:!0,className:"font-mono text-sm"}),r.jsx(ee,{onClick:j,disabled:h||!b,variant:x?"default":"outline",children:x?r.jsx(Ai,{className:"h-4 w-4"}):r.jsx(hl,{className:"h-4 w-4"})})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Share via"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(ee,{variant:"outline",className:"flex-1",onClick:()=>C("email"),disabled:h,children:[r.jsx(da,{className:"h-4 w-4 mr-2"}),"Email"]}),r.jsxs(ee,{variant:"outline",className:"flex-1",onClick:()=>C("text"),disabled:h,children:[r.jsx(Lo,{className:"h-4 w-4 mr-2"}),"Text"]}),r.jsxs(ee,{variant:"outline",className:"flex-1",onClick:()=>C("facebook"),disabled:h,children:[r.jsx(Rd,{className:"h-4 w-4 mr-2"}),"Facebook"]})]})]}),l&&(l.click_count>0||l.lead_count>0)&&r.jsxs("div",{className:"pt-4 border-t",children:[r.jsx(He,{className:"mb-2 block",children:"Your Share Performance"}),r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsxs("div",{className:"bg-muted rounded-lg p-3 text-center",children:[r.jsxs("div",{className:"flex items-center justify-center gap-1 text-muted-foreground mb-1",children:[r.jsx(Qo,{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 LHt={active:"bg-emerald-500",coming_soon:"bg-sky-500",price_improvement:"bg-orange-500",under_contract:"bg-purple-500",sold:"bg-gray-500"},OHt={active:"Active",coming_soon:"Coming Soon",price_improvement:"Price Improvement",under_contract:"Under Contract",sold:"Sold"},DHt={single_family:"Single Family",condo:"Condo",townhouse:"Townhouse",land:"Land",multi_family:"Multi-Family",luxury:"Luxury",commercial:"Commercial",other:"Other"};function tO({listing:t,onClick:e,onEdit:n,onDelete:s,showActions:a}){var N,A;const{user:o}=Qr(),{data:l}=g8e(t.id),i=m8e(),[h,p]=I.useState(!1),x=E=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(E),y=((N=t.photos)==null?void 0:N.find(E=>E.is_primary))||((A=t.photos)==null?void 0:A[0]),b=(o==null?void 0:o.id)===t.agent_id,j=async E=>{E.stopPropagation();try{const T=await i.mutateAsync(t.id);ze.success(T.saved?"Listing saved!":"Listing removed from saved")}catch{ze.error("Failed to save listing")}},C=E=>{if(E.stopPropagation(),o)p(!0);else{const T=`https://listings.relevelup.com/${t.slug||t.id}`;navigator.clipboard.writeText(T),ze.success("Link copied to clipboard!")}};return r.jsxs(Ye,{className:"overflow-hidden hover:shadow-lg transition-shadow cursor-pointer group",onClick:e,children:[r.jsxs("div",{className:"relative aspect-[4/3] bg-muted",children:[y?r.jsx("img",{src:y.photo_url,alt:t.property_address||t.city,className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-300"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center text-muted-foreground",children:r.jsx(wg,{className:"h-12 w-12"})}),r.jsx(Ot,{className:`absolute top-2 left-2 ${LHt[t.status]} text-white border-0`,children:OHt[t.status]}),t.is_featured&&r.jsx("div",{className:"absolute top-2 right-2 p-1.5 bg-amber-500 rounded-full",children:r.jsx(vs,{className:"h-4 w-4 text-white fill-white"})}),r.jsxs("div",{className:"absolute bottom-2 right-2 flex gap-1 opacity-0 group-hover:opacity-100 transition-opacity",children:[r.jsx(ee,{size:"icon",variant:"secondary",className:"h-8 w-8",onClick:j,children:r.jsx(ci,{className:`h-4 w-4 ${l?"fill-pink-500 text-pink-500":""}`})}),r.jsx(ee,{size:"icon",variant:"secondary",className:"h-8 w-8",onClick:C,title:b?"Copy link":"Share & earn leads",children:b?r.jsx(fc,{className:"h-4 w-4"}):r.jsx(Ms,{className:"h-4 w-4 text-amber-500"})})]})]}),r.jsx(_$e,{open:h,onOpenChange:p,listingId:t.id,listingSlug:t.slug||null,listingTitle:t.property_address||`${t.city}, ${t.state}`}),r.jsxs(tt,{className:"p-4 space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("p",{className:"text-xl font-bold text-primary",children:x(t.price)}),t.open_to_referrals&&r.jsxs(Ot,{variant:"outline",className:"text-xs",children:[r.jsx(Bn,{className:"h-3 w-3 mr-1"}),"Referrals"]})]}),r.jsxs("div",{children:[t.property_address&&r.jsx("p",{className:"font-medium truncate",children:t.property_address}),r.jsxs("p",{className:"text-sm text-muted-foreground flex items-center gap-1",children:[r.jsx(fl,{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(l1,{className:"h-4 w-4"}),t.bedrooms," bd"]}),t.bathrooms&&r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(o1,{className:"h-4 w-4"}),t.bathrooms," ba"]}),t.square_footage&&r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(wg,{className:"h-4 w-4"}),t.square_footage.toLocaleString()," sqft"]})]}),r.jsxs("div",{className:"flex items-center justify-between pt-2 border-t",children:[r.jsx(Ot,{variant:"secondary",className:"text-xs",children:DHt[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(Qo,{className:"h-3 w-3"}),t.view_count]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(fc,{className:"h-3 w-3"}),t.share_count]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(ci,{className:"h-3 w-3"}),t.save_count]})]}),a&&(n||s)&&r.jsxs("div",{className:"flex gap-2",children:[n&&r.jsxs(ee,{variant:"outline",size:"sm",className:"flex-1",onClick:E=>{E.stopPropagation(),n()},children:[r.jsx(ac,{className:"h-4 w-4 mr-2"}),"Edit"]}),s&&r.jsx(ee,{variant:"destructive",size:"sm",onClick:E=>{E.stopPropagation(),s()},children:r.jsx(Vn,{className:"h-4 w-4"})})]})]})]})}const RHt=[{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"}],FHt=[{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 zHt({filters:t,onFiltersChange:e,onClose:n}){const s=()=>{e({sortBy:"newest"})};return r.jsxs(Ye,{children:[r.jsxs(Gt,{className:"flex flex-row items-center justify-between pb-3",children:[r.jsx(Zt,{className:"text-lg",children:"Filters"}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(ee,{variant:"ghost",size:"sm",onClick:s,children:"Clear All"}),r.jsx(ee,{variant:"ghost",size:"icon",onClick:n,children:r.jsx(_s,{className:"h-4 w-4"})})]})]}),r.jsxs(tt,{children:[r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Status"}),r.jsxs(gn,{value:t.status||"all",onValueChange:a=>e({...t,status:a==="all"?void 0:a}),children:[r.jsx(fn,{children:r.jsx(xn,{placeholder:"All statuses"})}),r.jsxs(pn,{children:[r.jsx(Vt,{value:"all",children:"All Statuses"}),RHt.map(a=>r.jsx(Vt,{value:a.value,children:a.label},a.value))]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Property Type"}),r.jsxs(gn,{value:t.propertyType||"all",onValueChange:a=>e({...t,propertyType:a==="all"?void 0:a}),children:[r.jsx(fn,{children:r.jsx(xn,{placeholder:"All types"})}),r.jsxs(pn,{children:[r.jsx(Vt,{value:"all",children:"All Types"}),FHt.map(a=>r.jsx(Vt,{value:a.value,children:a.label},a.value))]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Min Price"}),r.jsx(dt,{type:"number",placeholder:"No minimum",value:t.minPrice||"",onChange:a=>e({...t,minPrice:a.target.value?Number(a.target.value):void 0})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Max Price"}),r.jsx(dt,{type:"number",placeholder:"No maximum",value:t.maxPrice||"",onChange:a=>e({...t,maxPrice:a.target.value?Number(a.target.value):void 0})})]})]}),r.jsxs("div",{className:"flex items-center justify-between mt-4 pt-4 border-t",children:[r.jsxs("div",{children:[r.jsx(He,{children:"Open to Referrals Only"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Show only listings accepting buyer referrals"})]}),r.jsx(Ps,{checked:t.openToReferrals||!1,onCheckedChange:a=>e({...t,openToReferrals:a||void 0})})]})]})]})}function BHt({leaderboard:t}){const e=s=>{switch(s){case 0:return r.jsx(Zi,{className:"h-5 w-5 text-amber-500"});case 1:return r.jsx(qx,{className:"h-5 w-5 text-gray-400"});case 2:return r.jsx(Ol,{className:"h-5 w-5 text-amber-700"});default:return r.jsx("span",{className:"text-sm font-medium text-muted-foreground w-5 text-center",children:s+1})}},n=(s,a)=>!s||s.length===0?r.jsx("div",{className:"py-8 text-center text-muted-foreground",children:"No data yet. Start sharing to climb the leaderboard!"}):r.jsx("div",{className:"space-y-2",children:s.map((o,l)=>r.jsxs("div",{className:`flex items-center gap-4 p-3 rounded-lg ${l===0?"bg-gradient-to-r from-amber-500/10 to-amber-500/5 border border-amber-500/20":"bg-muted/50"}`,children:[r.jsx("div",{className:"flex items-center justify-center w-8",children:e(l)}),r.jsx("div",{className:"flex-1 min-w-0",children:r.jsx("p",{className:"font-medium truncate",children:o.name})}),r.jsxs(Ot,{variant:l===0?"default":"secondary",children:[o.count," ",a]})]},o.agentId))});return r.jsxs("div",{className:"space-y-6",children:[r.jsxs(Ye,{children:[r.jsx(Gt,{children:r.jsxs(Zt,{className:"flex items-center gap-2",children:[r.jsx(Zi,{className:"h-5 w-5 text-amber-500"}),"Community Badges"]})}),r.jsx(tt,{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(fc,{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(pa,{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(qx,{className:"h-6 w-6 text-purple-500"})}),r.jsx("p",{className:"font-medium text-sm",children:"Referral Connector"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Send 3+ referrals"})]}),r.jsxs("div",{className:"text-center p-4 rounded-lg bg-gradient-to-br from-amber-500/10 to-amber-500/5 border border-amber-500/20",children:[r.jsx("div",{className:"w-12 h-12 mx-auto mb-2 rounded-full bg-amber-500/20 flex items-center justify-center",children:r.jsx(Zi,{className:"h-6 w-6 text-amber-500"})}),r.jsx("p",{className:"font-medium text-sm",children:"Community MVP"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Top performer"})]})]})})]}),r.jsxs(Ye,{children:[r.jsx(Gt,{children:r.jsx(Zt,{children:"Community Leaderboard"})}),r.jsx(tt,{children:r.jsxs(Ii,{defaultValue:"sharers",children:[r.jsxs(wi,{className:"w-full",children:[r.jsxs(ln,{value:"sharers",className:"flex-1",children:[r.jsx(fc,{className:"h-4 w-4 mr-2"}),"Top Sharers"]}),r.jsxs(ln,{value:"listers",className:"flex-1",children:[r.jsx(pa,{className:"h-4 w-4 mr-2"}),"Top Contributors"]})]}),r.jsx(An,{value:"sharers",className:"mt-4",children:n(t==null?void 0:t.topSharers,"shares")}),r.jsx(An,{value:"listers",className:"mt-4",children:n(t==null?void 0:t.topListers,"listings")})]})})]})]})}function $Ht(){var G,te,ie,le,ye,ne,ge,ae;const t=rs(),{brokerageId:e}=Qr(),{data:n,isLoading:s}=d8e(),[a,o]=I.useState("feed"),[l,i]=I.useState(!1),[h,p]=I.useState(""),[x,y]=I.useState({sortBy:"newest"}),{data:b,isLoading:j}=u8e({...x,city:h||x.city}),{data:C,isLoading:N}=Oft(),{data:A,isLoading:E}=h8e(),{data:T,isLoading:L}=zft(),{data:z,isLoading:F}=Uft(),{data:q}=$ft(),H=p8e(),Z=async he=>{if(confirm("Are you sure you want to delete this listing? This action cannot be undone."))try{await H.mutateAsync(he),ze.success("Listing deleted successfully")}catch{ze.error("Failed to delete listing")}};return s?r.jsx(Lr,{title:"Listing Exchange",description:"Community-powered listing collaboration",children:r.jsx("div",{className:"flex items-center justify-center py-12",children:r.jsx("div",{className:"animate-spin h-8 w-8 border-4 border-primary border-t-transparent rounded-full"})})}):n?r.jsx(Lr,{title:"Listing Exchange",description:"Community-powered listing collaboration",children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("h1",{className:"text-2xl font-bold",children:"Listing Exchange"}),r.jsx("span",{className:"text-[10px] font-semibold uppercase tracking-wide px-1.5 py-0.5 rounded border border-amber-500 text-amber-600 dark:text-amber-400 bg-amber-500/10",children:"Beta"})]}),r.jsxs(ee,{onClick:()=>t("/mission-control/listings/new"),children:[r.jsx(bn,{className:"h-4 w-4 mr-2"}),"Add Listing"]})]}),r.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[r.jsx(Ye,{children:r.jsxs(tt,{className:"p-4 flex items-center gap-3",children:[r.jsx("div",{className:"p-2 bg-primary/10 rounded-lg",children:r.jsx(pa,{className:"h-5 w-5 text-primary"})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-2xl font-bold",children:(b==null?void 0:b.length)||0}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Active Listings"})]})]})}),r.jsx(Ye,{children:r.jsxs(tt,{className:"p-4 flex items-center gap-3",children:[r.jsx("div",{className:"p-2 bg-pink-500/10 rounded-lg",children:r.jsx(ci,{className:"h-5 w-5 text-pink-500"})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-2xl font-bold",children:(C==null?void 0:C.length)||0}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Saved"})]})]})}),r.jsx(Ye,{children:r.jsxs(tt,{className:"p-4 flex items-center gap-3",children:[r.jsx("div",{className:"p-2 bg-emerald-500/10 rounded-lg",children:r.jsx(lj,{className:"h-5 w-5 text-emerald-500"})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-2xl font-bold",children:(A==null?void 0:A.length)||0}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"My Listings"})]})]})}),r.jsx(Ye,{children:r.jsxs(tt,{className:"p-4 flex items-center gap-3",children:[r.jsx("div",{className:"p-2 bg-sky-500/10 rounded-lg",children:r.jsx(Bn,{className:"h-5 w-5 text-sky-500"})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-2xl font-bold",children:(((G=T==null?void 0:T.sent)==null?void 0:G.length)||0)+(((te=T==null?void 0:T.received)==null?void 0:te.length)||0)}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Referrals"})]})]})})]}),r.jsxs(Ii,{value:a,onValueChange:o,children:[r.jsxs(wi,{className:"w-full justify-start overflow-x-auto",children:[r.jsx(ln,{value:"feed",children:"Community Feed"}),e&&r.jsx(ln,{value:"brokerage",children:"Brokerage"}),r.jsx(ln,{value:"my-listings",children:"My Listings"}),r.jsx(ln,{value:"saved",children:"Saved"}),r.jsx(ln,{value:"referrals",children:"Referrals"}),r.jsx(ln,{value:"leaderboard",children:"Leaderboard"})]}),r.jsxs(An,{value:"feed",className:"space-y-4",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[r.jsxs("div",{className:"relative flex-1",children:[r.jsx(wa,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(dt,{placeholder:"Search by city or neighborhood...",value:h,onChange:he=>p(he.target.value),className:"pl-9"})]}),r.jsxs(gn,{value:x.sortBy,onValueChange:he=>y({...x,sortBy:he}),children:[r.jsx(fn,{className:"w-[180px]",children:r.jsx(xn,{placeholder:"Sort by"})}),r.jsxs(pn,{children:[r.jsx(Vt,{value:"newest",children:"Newest First"}),r.jsx(Vt,{value:"updated",children:"Recently Updated"}),r.jsx(Vt,{value:"price_asc",children:"Price: Low to High"}),r.jsx(Vt,{value:"price_desc",children:"Price: High to Low"})]})]}),r.jsxs(ee,{variant:"outline",onClick:()=>i(!l),children:[r.jsx(m1,{className:"h-4 w-4 mr-2"}),"Filters"]})]}),l&&r.jsx(zHt,{filters:x,onFiltersChange:y,onClose:()=>i(!1)}),j?r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[...Array(6)].map((he,ue)=>r.jsxs(Ye,{children:[r.jsx(Ir,{className:"h-48 w-full"}),r.jsxs(tt,{className:"p-4 space-y-2",children:[r.jsx(Ir,{className:"h-5 w-3/4"}),r.jsx(Ir,{className:"h-4 w-1/2"}),r.jsx(Ir,{className:"h-4 w-1/4"})]})]},ue))}):(b==null?void 0:b.length)===0?r.jsx(Ye,{children:r.jsxs(tt,{className:"py-12 text-center",children:[r.jsx(pa,{className:"h-12 w-12 mx-auto text-muted-foreground mb-4"}),r.jsx("h3",{className:"text-lg font-medium mb-2",children:"No listings found"}),r.jsx("p",{className:"text-muted-foreground mb-4",children:"Be the first to share a listing with the community!"}),r.jsxs(ee,{onClick:()=>t("/mission-control/listings/new"),children:[r.jsx(bn,{className:"h-4 w-4 mr-2"}),"Add Listing"]})]})}):r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:b==null?void 0:b.map(he=>r.jsx(tO,{listing:he,onClick:()=>t(`/mission-control/listings/${he.id}`)},he.id))})]}),r.jsx(An,{value:"my-listings",className:"space-y-4",children:E?r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[...Array(3)].map((he,ue)=>r.jsxs(Ye,{children:[r.jsx(Ir,{className:"h-48 w-full"}),r.jsxs(tt,{className:"p-4 space-y-2",children:[r.jsx(Ir,{className:"h-5 w-3/4"}),r.jsx(Ir,{className:"h-4 w-1/2"})]})]},ue))}):(A==null?void 0:A.length)===0?r.jsx(Ye,{children:r.jsxs(tt,{className:"py-12 text-center",children:[r.jsx(lj,{className:"h-12 w-12 mx-auto text-muted-foreground mb-4"}),r.jsx("h3",{className:"text-lg font-medium mb-2",children:"No listings yet"}),r.jsx("p",{className:"text-muted-foreground mb-4",children:"Share your listings with the LevelUp community!"}),r.jsxs(ee,{onClick:()=>t("/mission-control/listings/new"),children:[r.jsx(bn,{className:"h-4 w-4 mr-2"}),"Add Your First Listing"]})]})}):r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:A==null?void 0:A.map(he=>r.jsx(tO,{listing:he,showActions:!0,onClick:()=>t(`/mission-control/listings/${he.id}`),onEdit:()=>t(`/mission-control/listings/${he.id}/edit`),onDelete:()=>Z(he.id)},he.id))})}),r.jsx(An,{value:"saved",className:"space-y-4",children:N?r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[...Array(3)].map((he,ue)=>r.jsxs(Ye,{children:[r.jsx(Ir,{className:"h-48 w-full"}),r.jsxs(tt,{className:"p-4 space-y-2",children:[r.jsx(Ir,{className:"h-5 w-3/4"}),r.jsx(Ir,{className:"h-4 w-1/2"})]})]},ue))}):(C==null?void 0:C.length)===0?r.jsx(Ye,{children:r.jsxs(tt,{className:"py-12 text-center",children:[r.jsx(ci,{className:"h-12 w-12 mx-auto text-muted-foreground mb-4"}),r.jsx("h3",{className:"text-lg font-medium mb-2",children:"No saved listings"}),r.jsx("p",{className:"text-muted-foreground",children:"Save listings to quickly access them later"})]})}):r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:C==null?void 0:C.map(he=>r.jsx(tO,{listing:he.listing,onClick:()=>t(`/mission-control/listings/${he.listing.id}`)},he.id))})}),r.jsx(An,{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(fc,{className:"h-4 w-4"}),"Referrals Sent (",((ie=T==null?void 0:T.sent)==null?void 0:ie.length)||0,")"]}),((le=T==null?void 0:T.sent)==null?void 0:le.length)===0?r.jsx(Ye,{children:r.jsx(tt,{className:"py-8 text-center text-muted-foreground",children:"No referrals sent yet"})}):r.jsx("div",{className:"space-y-3",children:(ye=T==null?void 0:T.sent)==null?void 0:ye.map(he=>{var ue,_e;return r.jsx(Ye,{children:r.jsx(tt,{className:"p-4",children:r.jsxs("div",{className:"flex justify-between items-start mb-2",children:[r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:he.buyer_name}),r.jsx("p",{className:"text-sm text-muted-foreground",children:((ue=he.listing)==null?void 0:ue.property_address)||((_e=he.listing)==null?void 0:_e.city)})]}),r.jsx(Ot,{variant:he.status==="closed"?"default":"secondary",children:he.status.replace("_"," ")})]})})},he.id)})})]}),r.jsxs("div",{children:[r.jsxs("h3",{className:"font-semibold mb-3 flex items-center gap-2",children:[r.jsx(Bn,{className:"h-4 w-4"}),"Referrals Received (",((ne=T==null?void 0:T.received)==null?void 0:ne.length)||0,")"]}),((ge=T==null?void 0:T.received)==null?void 0:ge.length)===0?r.jsx(Ye,{children:r.jsx(tt,{className:"py-8 text-center text-muted-foreground",children:"No referrals received yet"})}):r.jsx("div",{className:"space-y-3",children:(ae=T==null?void 0:T.received)==null?void 0:ae.map(he=>{var ue;return r.jsx(Ye,{children:r.jsxs(tt,{className:"p-4",children:[r.jsxs("div",{className:"flex justify-between items-start mb-2",children:[r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:he.buyer_name}),r.jsxs("p",{className:"text-sm text-muted-foreground",children:["From: ",(ue=he.sender)==null?void 0:ue.name]})]}),r.jsx(Ot,{variant:he.status==="closed"?"default":"secondary",children:he.status.replace("_"," ")})]}),r.jsx(ee,{size:"sm",variant:"outline",className:"w-full mt-2",onClick:()=>t(`/mission-control/listings/${he.listing_id}`),children:"View Listing"})]})},he.id)})})]})]})}),e&&r.jsx(An,{value:"brokerage",className:"space-y-4",children:F?r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[...Array(3)].map((he,ue)=>r.jsxs(Ye,{children:[r.jsx(Ir,{className:"h-48 w-full"}),r.jsxs(tt,{className:"p-4 space-y-2",children:[r.jsx(Ir,{className:"h-5 w-3/4"}),r.jsx(Ir,{className:"h-4 w-1/2"})]})]},ue))}):(z==null?void 0:z.length)===0?r.jsx(Ye,{children:r.jsxs(tt,{className:"py-12 text-center",children:[r.jsx(lj,{className:"h-12 w-12 mx-auto text-muted-foreground mb-4"}),r.jsx("h3",{className:"text-lg font-medium mb-2",children:"No brokerage listings yet"}),r.jsx("p",{className:"text-muted-foreground mb-4",children:"No agents in your brokerage have added listings yet."}),r.jsxs(ee,{onClick:()=>t("/mission-control/listings/new"),children:[r.jsx(bn,{className:"h-4 w-4 mr-2"}),"Add a Listing"]})]})}):r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:z==null?void 0:z.map(he=>r.jsx(tO,{listing:he,onClick:()=>t(`/mission-control/listings/${he.id}`)},he.id))})}),r.jsx(An,{value:"leaderboard",children:r.jsx(BHt,{leaderboard:q})})]})]})}):r.jsx(Lr,{title:"Listing Exchange",description:"Community-powered listing collaboration",children:r.jsx(Ye,{children:r.jsxs(tt,{className:"py-12 text-center",children:[r.jsx(pa,{className:"h-12 w-12 mx-auto text-muted-foreground mb-4"}),r.jsx("h2",{className:"text-xl font-semibold mb-2",children:"Coming Soon"}),r.jsx("p",{className:"text-muted-foreground",children:"Listing Exchange is currently in development. Check back soon!"})]})})})}function T0e(){const t=Pc();return Yt({queryKey:["deal-pipeline-stages",t],queryFn:async()=>{if(!t)return[];const{data:e,error:n}=await J.from("deal_pipeline_stages").select("*").eq("owner_user_id",t).order("sort_order",{ascending:!0});if(n)throw n;return e},enabled:!!t})}function b$e(){const t=Pc(),e=Vr();return cr({mutationFn:async()=>{if(!t)throw new Error("Not authenticated");const{error:n}=await J.rpc("initialize_deal_pipeline_stages",{p_user_id:t});if(n)throw n},onSuccess:()=>{e.invalidateQueries({queryKey:["deal-pipeline-stages"]})}})}function w$e(){const t=Pc();return Yt({queryKey:["deal-pipeline-deals",t],queryFn:async()=>{if(!t)return[];const{data:e,error:n}=await J.from("deal_pipeline").select(` *, contact:innercircle_contacts(id, first_name, last_name, email, phone), listing:listings(id, property_address, city, state, price, status) `).eq("owner_user_id",t).order("updated_at",{ascending:!1});if(n)throw n;return e},enabled:!!t})}function j$e(){const t=Pc(),e=Vr();return cr({mutationFn:async n=>{if(!t)throw new Error("Not authenticated");const{data:s,error:a}=await J.from("deal_pipeline").insert({deal_name:n.deal_name,deal_type:n.deal_type,stage_id:n.stage_id||null,contact_id:n.contact_id||null,listing_id:n.listing_id||null,property_address:n.property_address||null,city:n.city||null,state:n.state||null,zip_code:n.zip_code||null,expected_price:n.expected_price||null,expected_commission:n.expected_commission||null,commission_percentage:n.commission_percentage||3,target_close_date:n.target_close_date||null,contract_date:n.contract_date||null,priority:n.priority||"medium",probability:n.probability||50,notes:n.notes||null,owner_user_id:t}).select().single();if(a)throw a;return await J.from("deal_activities").insert([{deal_id:s.id,activity_type:"system",title:"Deal created",description:`Deal "${n.deal_name}" was created`}]),s},onSuccess:()=>{e.invalidateQueries({queryKey:["deal-pipeline-deals"]}),e.invalidateQueries({queryKey:["deal-pipeline-stats"]})}})}function k$e(){const t=Vr();return cr({mutationFn:async({id:e,...n})=>{const{data:s,error:a}=await J.from("deal_pipeline").update(n).eq("id",e).select().single();if(a)throw a;return s},onSuccess:()=>{t.invalidateQueries({queryKey:["deal-pipeline-deals"]}),t.invalidateQueries({queryKey:["deal-pipeline-stats"]})}})}function UHt(){const t=Vr();return cr({mutationFn:async({dealId:e,stageId:n,stageName:s})=>{const{data:a,error:o}=await J.from("deal_pipeline").update({stage_id:n}).eq("id",e).select().single();if(o)throw o;return await J.from("deal_activities").insert({deal_id:e,activity_type:"stage_change",title:`Moved to ${s}`,metadata:{new_stage_id:n,new_stage_name:s}}),a},onSuccess:()=>{t.invalidateQueries({queryKey:["deal-pipeline-deals"]}),t.invalidateQueries({queryKey:["deal-activities"]})}})}function qHt(){const t=Vr();return cr({mutationFn:async e=>{const{error:n}=await J.from("deal_pipeline").delete().eq("id",e);if(n)throw n},onSuccess:()=>{t.invalidateQueries({queryKey:["deal-pipeline-deals"]}),t.invalidateQueries({queryKey:["deal-pipeline-stats"]})}})}function VHt(t){return Yt({queryKey:["deal-activities",t],queryFn:async()=>{const{data:e,error:n}=await J.from("deal_activities").select("*").eq("deal_id",t).order("created_at",{ascending:!1});if(n)throw n;return e},enabled:!!t})}function HHt(){const t=Vr();return cr({mutationFn:async e=>{const{data:n,error:s}=await J.from("deal_activities").insert([{deal_id:e.deal_id,activity_type:e.activity_type,title:e.title,description:e.description||null}]).select().single();if(s)throw s;return n},onSuccess:(e,n)=>{t.invalidateQueries({queryKey:["deal-activities",n.deal_id]})}})}function WHt(t){return Yt({queryKey:["deal-checklist",t],queryFn:async()=>{const{data:e,error:n}=await J.from("deal_checklist_items").select("*").eq("deal_id",t).order("sort_order",{ascending:!0});if(n)throw n;return e},enabled:!!t})}function GHt(){const t=Vr();return cr({mutationFn:async({id:e,is_completed:n,deal_id:s})=>{const{data:a,error:o}=await J.from("deal_checklist_items").update({is_completed:n,completed_at:n?new Date().toISOString():null}).eq("id",e).select().single();if(o)throw o;return a},onSuccess:(e,n)=>{t.invalidateQueries({queryKey:["deal-checklist",n.deal_id]})}})}function KHt(){const t=Vr();return cr({mutationFn:async e=>{const{data:n,error:s}=await J.from("deal_checklist_items").insert([{deal_id:e.deal_id,title:e.title,description:e.description||null,due_date:e.due_date||null,sort_order:e.sort_order||0}]).select().single();if(s)throw s;return n},onSuccess:(e,n)=>{t.invalidateQueries({queryKey:["deal-checklist",n.deal_id]})}})}function ZHt(){const t=Pc();return Yt({queryKey:["deal-pipeline-stats",t],queryFn:async()=>{if(!t)return null;const{data:e,error:n}=await J.from("deal_pipeline").select("expected_price, expected_commission, stage_id, deal_pipeline_stages(is_won_stage, is_lost_stage)").eq("owner_user_id",t);if(n)throw n;const s=(e==null?void 0:e.filter(o=>{var l,i;return!((l=o.deal_pipeline_stages)!=null&&l.is_won_stage)&&!((i=o.deal_pipeline_stages)!=null&&i.is_lost_stage)}))||[],a=(e==null?void 0:e.filter(o=>{var l;return(l=o.deal_pipeline_stages)==null?void 0:l.is_won_stage}))||[];return{totalDeals:(e==null?void 0:e.length)||0,activeDeals:s.length,wonDeals:a.length,pipelineValue:s.reduce((o,l)=>o+(l.expected_price||0),0),expectedCommission:s.reduce((o,l)=>o+(l.expected_commission||0),0),wonValue:a.reduce((o,l)=>o+(l.expected_price||0),0)}},enabled:!!t})}function YHt(t){const e=Pc();return Yt({queryKey:["deal-by-listing",t,e],queryFn:async()=>{if(!e||!t)return null;const{data:n,error:s}=await J.from("deal_pipeline").select(` *, deal_pipeline_stages(id, name, color) `).eq("owner_user_id",e).eq("listing_id",t).maybeSingle();if(s)throw s;return n},enabled:!!e&&!!t})}function XHt(){const t=Vr();return cr({mutationFn:async({dealId:e,listingId:n})=>{const{data:s,error:a}=await J.from("deal_pipeline").update({listing_id:n}).eq("id",e).select().single();if(a)throw a;return await J.from("deal_activities").insert({deal_id:e,activity_type:"system",title:"Linked to Listing Exchange",description:"This deal is now synced with Listing Exchange",metadata:{listing_id:n}}),s},onSuccess:(e,n)=>{t.invalidateQueries({queryKey:["deal-pipeline-deals"]}),t.invalidateQueries({queryKey:["deal-by-listing",n.listingId]})}})}function QHt(){const t=Vr();return cr({mutationFn:async({dealId:e,listingId:n})=>{const{data:s,error:a}=await J.from("deal_pipeline").update({listing_id:null}).eq("id",e).select().single();if(a)throw a;return{data:s,listingId:n}},onSuccess:e=>{t.invalidateQueries({queryKey:["deal-pipeline-deals"]}),t.invalidateQueries({queryKey:["deal-by-listing",e.listingId]})}})}function JHt({listing:t}){const e=rs(),[n,s]=I.useState(""),[a,o]=I.useState(!1),{data:l,isLoading:i}=YHt(t.id),{data:h,isLoading:p}=T0e(),{data:x,isLoading:y}=w$e(),b=b$e(),j=XHt(),C=QHt(),N=j$e(),A=(x==null?void 0:x.filter(F=>!F.listing_id))||[],E=F=>{if(!(h!=null&&h.length))return null;switch(F){case"coming_soon":case"active":case"price_improvement":return h.find(q=>q.name==="Active");case"under_contract":return h.find(q=>q.name==="Under Contract");case"sold":return h.find(q=>q.is_won_stage);default:return h.find(q=>q.name==="Active")}},T=async()=>{o(!0);try{h!=null&&h.length||await b.mutateAsync();const F=E(t.status);await N.mutateAsync({deal_name:t.property_address?`${t.property_address}, ${t.city}`:`${t.city}, ${t.state}`,deal_type:"seller",stage_id:(F==null?void 0:F.id)||null,listing_id:t.id,property_address:t.property_address,city:t.city,state:t.state,expected_price:t.price,expected_commission:t.price*.03,commission_percentage:3,priority:"medium",probability:50}),ze.success("Deal created and linked to listing!")}catch(F){console.error("Failed to create deal:",F),ze.error("Failed to create deal")}finally{o(!1)}},L=async()=>{if(!n){ze.error("Please select a deal");return}try{await j.mutateAsync({dealId:n,listingId:t.id}),ze.success("Listing linked to deal!"),s("")}catch{ze.error("Failed to link listing")}},z=async()=>{if(l)try{await C.mutateAsync({dealId:l.id,listingId:t.id}),ze.success("Listing unlinked from deal")}catch{ze.error("Failed to unlink listing")}};return i||p?r.jsxs(Ye,{children:[r.jsx(Gt,{children:r.jsxs(Zt,{className:"flex items-center gap-2 text-base",children:[r.jsx(y1,{className:"h-4 w-4"}),"Deal Pipeline"]})}),r.jsx(tt,{children:r.jsx("div",{className:"flex items-center justify-center py-4",children:r.jsx(en,{className:"h-5 w-5 animate-spin text-muted-foreground"})})})]}):l?r.jsxs(Ye,{className:"border-primary/20 bg-primary/5",children:[r.jsx(Gt,{className:"pb-2",children:r.jsxs(Zt,{className:"flex items-center gap-2 text-base",children:[r.jsx(tf,{className:"h-4 w-4 text-primary"}),"Linked to Pipeline"]})}),r.jsxs(tt,{className:"space-y-3",children:[r.jsx("div",{className:"flex items-center justify-between",children:r.jsxs("div",{children:[r.jsx("p",{className:"font-medium text-sm",children:l.deal_name}),r.jsx("div",{className:"flex items-center gap-2 mt-1",children:l.deal_pipeline_stages&&r.jsx(Ot,{variant:"secondary",className:"text-xs",style:{backgroundColor:`${l.deal_pipeline_stages.color}20`,color:l.deal_pipeline_stages.color},children:l.deal_pipeline_stages.name})})]})}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Status changes sync automatically between the listing and pipeline."}),r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(ee,{variant:"outline",size:"sm",className:"flex-1",onClick:()=>e("/mission-control/pipeline"),children:["View Pipeline",r.jsx(dl,{className:"h-3 w-3 ml-1"})]}),r.jsx(ee,{variant:"ghost",size:"sm",onClick:z,disabled:C.isPending,children:C.isPending?r.jsx(en,{className:"h-4 w-4 animate-spin"}):r.jsx(JT,{className:"h-4 w-4"})})]})]})]}):r.jsxs(Ye,{children:[r.jsx(Gt,{className:"pb-2",children:r.jsxs(Zt,{className:"flex items-center gap-2 text-base",children:[r.jsx(y1,{className:"h-4 w-4"}),"Deal Pipeline"]})}),r.jsxs(tt,{className:"space-y-4",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Link this listing to your pipeline to track the deal and sync status changes."}),r.jsxs(ee,{onClick:T,disabled:a||N.isPending,className:"w-full",size:"sm",children:[a||N.isPending?r.jsx(en,{className:"h-4 w-4 mr-2 animate-spin"}):r.jsx(bn,{className:"h-4 w-4 mr-2"}),"Create New Deal"]}),A.length>0&&r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"relative",children:[r.jsx("div",{className:"absolute inset-0 flex items-center",children:r.jsx("span",{className:"w-full border-t"})}),r.jsx("div",{className:"relative flex justify-center text-xs uppercase",children:r.jsx("span",{className:"bg-card px-2 text-muted-foreground",children:"or"})})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(gn,{value:n,onValueChange:s,children:[r.jsx(fn,{className:"flex-1 text-sm",children:r.jsx(xn,{placeholder:"Link to existing deal..."})}),r.jsx(pn,{children:A.map(F=>r.jsx(Vt,{value:F.id,children:F.deal_name},F.id))})]}),r.jsx(ee,{variant:"secondary",size:"icon",onClick:L,disabled:!n||j.isPending,children:j.isPending?r.jsx(en,{className:"h-4 w-4 animate-spin"}):r.jsx(tf,{className:"h-4 w-4"})})]})]})]})]})}const eWt={active:"bg-emerald-500",coming_soon:"bg-sky-500",price_improvement:"bg-orange-500",under_contract:"bg-purple-500",sold:"bg-gray-500"},tWt={active:"Active",coming_soon:"Coming Soon",price_improvement:"Price Improvement",under_contract:"Under Contract",sold:"Sold"},u5e={single_family:"Single Family",condo:"Condo",townhouse:"Townhouse",land:"Land",multi_family:"Multi-Family",luxury:"Luxury",commercial:"Commercial",other:"Other"};function rWt(){var ye,ne,ge,ae,he,ue,_e,Ae,Ce;const{listingId:t}=Zc(),e=rs(),{user:n}=Qr(),{data:s,isLoading:a}=f8e(t||""),{data:o}=g8e(t||""),{data:l}=Rft(t||""),i=m8e(),h=Dft(),p=Fft(),x=p8e(),y=Bft(),[b,j]=I.useState(!1),[C,N]=I.useState(!1),[A,E]=I.useState(!1),[T,L]=I.useState(null),[z,F]=I.useState({buyerName:"",buyerType:"",notes:""}),q=(n==null?void 0:n.id)===(s==null?void 0:s.agent_id),H=be=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(be),Z=async be=>{const me=`https://listings.relevelup.com/${(s==null?void 0:s.slug)||(s==null?void 0:s.id)}`,Le=`Check out this listing: ${(s==null?void 0:s.property_address)||(s==null?void 0:s.city)}`;p.mutate({listingId:s.id,shareType:be});try{switch(be){case"facebook":window.open(`https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(me)}`,"_blank");break;case"copy":await navigator.clipboard.writeText(me),ze.success("Link copied to clipboard!");break;case"text":window.open(`sms:?body=${encodeURIComponent(`${Le} ${me}`)}`);break;case"email":window.open(`mailto:?subject=${encodeURIComponent(Le)}&body=${encodeURIComponent(`Check out this listing: ${me}`)}`);break}}catch(Ne){console.error("Share error:",Ne),ze.error("Failed to share")}},G=async()=>{try{await x.mutateAsync(s.id),ze.success("Listing deleted"),e("/mission-control/listings")}catch{ze.error("Failed to delete listing")}},te=async()=>{if(!z.buyerName.trim()){ze.error("Please enter buyer name");return}try{await y.mutateAsync({listingId:s.id,listingAgentId:s.agent_id,buyerName:z.buyerName,buyerType:z.buyerType||void 0,notes:z.notes||void 0}),ze.success("Referral sent successfully!"),N(!1),F({buyerName:"",buyerType:"",notes:""})}catch{ze.error("Failed to send referral")}},ie=be=>{var Re,je;const me=(s==null?void 0:s.property_address)||`${s==null?void 0:s.city}, ${s==null?void 0:s.state}`,Le=H((s==null?void 0:s.price)||0),Ne=s!=null&&s.bedrooms?`${s.bedrooms}BD`:"",Be=s!=null&&s.bathrooms?`${s.bathrooms}BA`:"",Ee=s!=null&&s.square_footage?`${s.square_footage.toLocaleString()}SF`:"",Ue=[Ne,Be,Ee].filter(Boolean).join(" | ");switch(be){case"just_listed":return`🏡 JUST LISTED! ${me} ${Le} ${Ue} ${(s==null?void 0:s.description)||"Schedule your showing today!"} #JustListed #RealEstate #HomeForSale #${(Re=s==null?void 0:s.city)==null?void 0:Re.replace(/\s/g,"")}`;case"price_improvement":return`📣 PRICE IMPROVEMENT! ${me} Now ${Le}! ${Ue} Don't miss this opportunity! #PriceReduced #RealEstate #HomeForSale`;case"teaser":return`Looking for a ${u5e[(s==null?void 0:s.property_type)||"single_family"].toLowerCase()} in ${s==null?void 0:s.city}? 👀 I've got just the one for you! ${Ue} DM me for details! 📩 #ComingSoon #RealEstate #${(je=s==null?void 0:s.city)==null?void 0:je.replace(/\s/g,"")}`;default:return""}};if(a)return r.jsx(Lr,{title:"Listing",description:"",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Ir,{className:"h-10 w-32"}),r.jsx(Ir,{className:"h-[400px] w-full"}),r.jsxs("div",{className:"grid md:grid-cols-3 gap-6",children:[r.jsx(Ir,{className:"h-48"}),r.jsx(Ir,{className:"h-48"}),r.jsx(Ir,{className:"h-48"})]})]})});if(!s)return r.jsx(Lr,{title:"Listing Not Found",description:"",children:r.jsx(Ye,{children:r.jsxs(tt,{className:"py-12 text-center",children:[r.jsx("p",{className:"text-muted-foreground mb-4",children:"This listing could not be found."}),r.jsx(ee,{onClick:()=>e("/mission-control/listings"),children:"Back to Listings"})]})})});const le=((ye=s.photos)==null?void 0:ye.find(be=>be.is_primary))||((ne=s.photos)==null?void 0:ne[0]);return r.jsxs(Lr,{title:"",description:"",children:[r.jsxs("div",{className:"space-y-6",children:[r.jsxs(ee,{variant:"ghost",onClick:()=>e("/mission-control/listings"),children:[r.jsx(so,{className:"h-4 w-4 mr-2"}),"Back to Listings"]}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[r.jsx("div",{className:"md:col-span-2",children:r.jsx("div",{className:"aspect-[16/10] rounded-lg overflow-hidden bg-muted cursor-pointer",onClick:()=>le&&L(le.photo_url),children:le?r.jsx("img",{src:le.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:(ge=s.photos)==null?void 0:ge.slice(1,5).map((be,me)=>r.jsx("div",{className:"aspect-square rounded-lg overflow-hidden bg-muted cursor-pointer",onClick:()=>L(be.photo_url),children:r.jsx("img",{src:be.photo_url,alt:`Photo ${me+2}`,className:"w-full h-full object-cover"})},be.id))})]}),r.jsxs("div",{className:"grid md:grid-cols-3 gap-6",children:[r.jsxs("div",{className:"md:col-span-2 space-y-6",children:[r.jsx(Ye,{children:r.jsxs(tt,{className:"p-6",children:[r.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-4 mb-6",children:[r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[r.jsx(Ot,{className:`${eWt[s.status]} text-white border-0`,children:tWt[s.status]}),s.is_featured&&r.jsxs(Ot,{variant:"outline",className:"border-amber-500 text-amber-500",children:[r.jsx(vs,{className:"h-3 w-3 mr-1 fill-amber-500"}),"Featured"]}),s.open_to_referrals&&r.jsxs(Ot,{variant:"outline",children:[r.jsx(Bn,{className:"h-3 w-3 mr-1"}),"Open to Referrals"]})]}),r.jsx("h1",{className:"text-3xl font-bold text-primary mb-2",children:H(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(fl,{className:"h-4 w-4"}),s.city,", ",s.state,s.neighborhood&&` • ${s.neighborhood}`]})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(ee,{variant:"outline",size:"icon",onClick:()=>i.mutate(s.id),children:r.jsx(ci,{className:`h-4 w-4 ${o?"fill-pink-500 text-pink-500":""}`})}),r.jsx(ee,{variant:"outline",size:"icon",onClick:()=>h.mutate(s.id),children:l?r.jsx(oj,{className:"h-4 w-4"}):r.jsx(gg,{className:"h-4 w-4"})}),!q&&r.jsxs(ee,{variant:"outline",className:"border-amber-500 text-amber-600 hover:bg-amber-50",onClick:()=>E(!0),children:[r.jsx(Ms,{className:"h-4 w-4 mr-2"}),"Share & Earn Leads"]}),r.jsxs(wh,{children:[r.jsx(jh,{asChild:!0,children:r.jsxs(ee,{variant:"outline",children:[r.jsx(fc,{className:"h-4 w-4 mr-2"}),"Share"]})}),r.jsxs(Wu,{children:[r.jsxs(di,{onClick:()=>Z("copy"),children:[r.jsx(hl,{className:"h-4 w-4 mr-2"}),"Copy Link"]}),r.jsxs(di,{onClick:()=>Z("facebook"),children:[r.jsx(Rd,{className:"h-4 w-4 mr-2"}),"Facebook"]}),r.jsxs(di,{onClick:()=>Z("text"),children:[r.jsx(Lo,{className:"h-4 w-4 mr-2"}),"Text"]}),r.jsxs(di,{onClick:()=>Z("email"),children:[r.jsx(da,{className:"h-4 w-4 mr-2"}),"Email"]})]})]}),q&&r.jsxs(r.Fragment,{children:[r.jsxs(ee,{variant:"outline",onClick:()=>e(`/mission-control/listings/${s.id}/edit`),children:[r.jsx(ac,{className:"h-4 w-4 mr-2"}),"Edit"]}),r.jsx(ee,{variant:"destructive",size:"icon",onClick:()=>j(!0),children:r.jsx(Vn,{className:"h-4 w-4"})})]})]})]}),r.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-4 py-4 border-y",children:[s.bedrooms&&r.jsxs("div",{className:"text-center",children:[r.jsx(l1,{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(o1,{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(wg,{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(zs,{className:"h-5 w-5 mx-auto mb-1 text-muted-foreground"}),r.jsx("p",{className:"font-semibold",children:s.year_built}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Built"})]})]}),r.jsxs("div",{className:"pt-4 space-y-4",children:[r.jsxs("div",{className:"flex flex-wrap gap-2",children:[r.jsxs(Ot,{variant:"secondary",children:[r.jsx(ai,{className:"h-3 w-3 mr-1"}),u5e[s.property_type]]}),s.lot_size&&r.jsxs(Ot,{variant:"secondary",children:["Lot: ",s.lot_size]}),s.has_hoa&&r.jsx(Ot,{variant:"secondary",children:"HOA"})]}),s.description&&r.jsxs("div",{children:[r.jsx("h3",{className:"font-medium mb-2",children:"Description"}),r.jsx("p",{className:"text-muted-foreground whitespace-pre-wrap",children:s.description})]}),s.agent_notes&&s.agent_notes_public&&r.jsxs("div",{children:[r.jsx("h3",{className:"font-medium mb-2",children:"Agent Notes"}),r.jsx("p",{className:"text-muted-foreground whitespace-pre-wrap",children:s.agent_notes})]}),s.mls_link&&r.jsx(ee,{variant:"outline",asChild:!0,children:r.jsxs("a",{href:s.mls_link,target:"_blank",rel:"noopener noreferrer",children:[r.jsx(Fs,{className:"h-4 w-4 mr-2"}),"View on MLS"]})})]}),r.jsxs("div",{className:"flex items-center gap-4 pt-4 mt-4 border-t text-sm text-muted-foreground",children:[r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Qo,{className:"h-4 w-4"}),s.view_count," views"]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(fc,{className:"h-4 w-4"}),s.share_count," shares"]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(ci,{className:"h-4 w-4"}),s.save_count," saves"]})]})]})}),s.allow_sharing&&r.jsxs(Ye,{children:[r.jsx(Gt,{children:r.jsx(Zt,{className:"text-lg",children:"Share Content"})}),r.jsx(tt,{className:"space-y-4",children:["just_listed","price_improvement","teaser"].map(be=>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:[be.replace("_"," ")," Caption"]}),r.jsx(ee,{size:"sm",variant:"ghost",onClick:()=>{navigator.clipboard.writeText(ie(be)),ze.success("Caption copied!")},children:r.jsx(hl,{className:"h-3 w-3"})})]}),r.jsx("p",{className:"text-xs text-muted-foreground whitespace-pre-wrap",children:ie(be)})]},be))})]})]}),r.jsxs("div",{className:"space-y-6",children:[r.jsxs(Ye,{children:[r.jsx(Gt,{children:r.jsx(Zt,{className:"text-lg",children:"Listing Agent"})}),r.jsxs(tt,{children:[r.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[r.jsx("div",{className:"w-12 h-12 rounded-full bg-primary/10 flex items-center justify-center",children:r.jsx("span",{className:"text-lg font-semibold text-primary",children:((he=(ae=s.agent)==null?void 0:ae.name)==null?void 0:he.charAt(0))||"?"})}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:((ue=s.agent)==null?void 0:ue.name)||"Unknown"}),((Ae=(_e=s.agent)==null?void 0:_e.brokerage)==null?void 0:Ae.name)&&r.jsx("p",{className:"text-sm text-muted-foreground",children:s.agent.brokerage.name})]})]}),!q&&r.jsx("div",{className:"space-y-2",children:((Ce=s.agent)==null?void 0:Ce.email)&&r.jsx(ee,{variant:"outline",className:"w-full",asChild:!0,children:r.jsxs("a",{href:`mailto:${s.agent.email}`,children:[r.jsx(da,{className:"h-4 w-4 mr-2"}),"Email Agent"]})})})]})]}),q&&r.jsx(JHt,{listing:s}),!q&&s.open_to_referrals&&r.jsxs(Ye,{children:[r.jsx(Gt,{children:r.jsxs(Zt,{className:"text-lg flex items-center gap-2",children:[r.jsx(Bn,{className:"h-5 w-5"}),"Send a Buyer"]})}),r.jsxs(tt,{children:[r.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"Have a buyer interested in this property? Send a referral to the listing agent."}),r.jsx(ee,{className:"w-full",onClick:()=>N(!0),children:"Send Referral"})]})]})]})]})]}),r.jsx(Fr,{open:!!T,onOpenChange:()=>L(null),children:r.jsx(Rr,{className:"max-w-4xl",children:r.jsx("img",{src:T||"",alt:"Full size",className:"w-full h-auto"})})}),r.jsx(Fr,{open:b,onOpenChange:j,children:r.jsxs(Rr,{children:[r.jsxs(qr,{children:[r.jsx($r,{children:"Delete Listing"}),r.jsx(Xn,{children:"Are you sure you want to delete this listing? This action cannot be undone."})]}),r.jsxs(ea,{children:[r.jsx(ee,{variant:"outline",onClick:()=>j(!1),children:"Cancel"}),r.jsx(ee,{variant:"destructive",onClick:G,disabled:x.isPending,children:x.isPending?"Deleting...":"Delete"})]})]})}),r.jsx(Fr,{open:C,onOpenChange:N,children:r.jsxs(Rr,{children:[r.jsxs(qr,{children:[r.jsx($r,{children:"Send Buyer Referral"}),r.jsx(Xn,{children:"Submit buyer information to the listing agent"})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Buyer Name *"}),r.jsx(dt,{value:z.buyerName,onChange:be=>F({...z,buyerName:be.target.value}),placeholder:"Enter buyer's name"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Buyer Type"}),r.jsxs(gn,{value:z.buyerType,onValueChange:be=>F({...z,buyerType:be}),children:[r.jsx(fn,{children:r.jsx(xn,{placeholder:"Select type"})}),r.jsxs(pn,{children:[r.jsx(Vt,{value:"first_time",children:"First-Time Buyer"}),r.jsx(Vt,{value:"investor",children:"Investor"}),r.jsx(Vt,{value:"relocating",children:"Relocating"}),r.jsx(Vt,{value:"upgrade",children:"Upgrading"}),r.jsx(Vt,{value:"downsize",children:"Downsizing"})]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Notes"}),r.jsx(ps,{value:z.notes,onChange:be=>F({...z,notes:be.target.value}),placeholder:"Any additional information..."})]})]}),r.jsxs(ea,{children:[r.jsx(ee,{variant:"outline",onClick:()=>N(!1),children:"Cancel"}),r.jsx(ee,{onClick:te,disabled:y.isPending,children:y.isPending?"Sending...":"Send Referral"})]})]})}),r.jsx(_$e,{open:A,onOpenChange:E,listingId:(s==null?void 0:s.id)||"",listingSlug:(s==null?void 0:s.slug)||null,listingTitle:(s==null?void 0:s.property_address)||`${s==null?void 0:s.city}, ${s==null?void 0:s.state}`})]})}function nWt({selectedVideoId:t,onVideoSelect:e,listingId:n}){const s=rs(),{user:a}=Qr(),[o,l]=I.useState(!1),[i,h]=I.useState([]),[p,x]=I.useState(!1),[y,b]=I.useState(null),[j,C]=I.useState({});I.useEffect(()=>{t&&a?N():b(null)},[t,a]);const N=async()=>{if(!t)return;const{data:G,error:te}=await J.from("agent_videos").select("id, bunny_video_id, title, thumbnail_url, preview_url, playback_url, duration_seconds, status, created_at").eq("id",t).eq("is_deleted",!1).single();!te&&G&&(b(G),A(G))},A=async G=>{try{const{data:te,error:ie}=await J.functions.invoke("bunny-upload",{body:{action:"asset-urls",videoId:G.bunny_video_id,isAgentVideo:!0}});!ie&&(te!=null&&te.thumbnailUrl)&&C(le=>({...le,[G.id]:{thumbnailUrl:te.thumbnailUrl}}))}catch(te){console.warn("Failed to get signed URL",te)}},E=async()=>{if(a){x(!0);try{const{data:G,error:te}=await J.from("agent_videos").select("id, bunny_video_id, title, thumbnail_url, preview_url, playback_url, duration_seconds, status, created_at").eq("owner_user_id",a.id).eq("is_deleted",!1).eq("status","ready").order("created_at",{ascending:!1});if(te)throw te;h(G||[]),G!=null&&G.length&&T(G)}catch(G){console.error("Error fetching videos:",G),ze.error("Failed to load videos")}finally{x(!1)}}},T=async G=>{const te=await Promise.allSettled(G.map(async le=>{const{data:ye,error:ne}=await J.functions.invoke("bunny-upload",{body:{action:"asset-urls",videoId:le.bunny_video_id,isAgentVideo:!0}});if(ne)throw ne;return{id:le.id,thumbnailUrl:ye==null?void 0:ye.thumbnailUrl}})),ie={};for(const le of te)le.status==="fulfilled"&&le.value.thumbnailUrl&&(ie[le.value.id]={thumbnailUrl:le.value.thumbnailUrl});C(le=>({...le,...ie}))},L=()=>{l(!0),E()},z=G=>{e(G.id),b(G),l(!1),ze.success("Video selected")},F=()=>{e(null),b(null)},q=()=>{const G=n?`/mission-control/listings/${n}/edit`:"/mission-control/listings/new";s(`/mission-control/video?returnUrl=${encodeURIComponent(G)}`)},H=G=>{if(!G)return"0:00";const te=Math.floor(G/60),ie=G%60;return`${te}:${ie.toString().padStart(2,"0")}`},Z=G=>{var te;return((te=j[G.id])==null?void 0:te.thumbnailUrl)||G.thumbnail_url};return r.jsxs("div",{className:"space-y-3",children:[y?r.jsx(Ye,{className:"overflow-hidden",children:r.jsx(tt,{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:[Z(y)?r.jsx("img",{src:Z(y),alt:y.title||"Video thumbnail",className:"w-full h-full object-cover"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center",children:r.jsx(Pa,{className:"h-8 w-8 text-muted-foreground"})}),r.jsx("div",{className:"absolute inset-0 bg-black/30 flex items-center justify-center",children:r.jsx(hc,{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:H(y.duration_seconds)})]}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"font-medium text-sm truncate",children:y.title||"Untitled Video"}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Property Video Tour"})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(ee,{type:"button",variant:"outline",size:"sm",onClick:L,children:"Change"}),r.jsx(ee,{type:"button",variant:"ghost",size:"sm",onClick:F,className:"text-destructive hover:text-destructive",children:r.jsx(_s,{className:"h-4 w-4"})})]})]})})}):r.jsx(Ye,{className:"border-dashed",children:r.jsx(tt,{className:"p-6",children:r.jsxs("div",{className:"text-center",children:[r.jsx(Pa,{className:"h-10 w-10 mx-auto text-muted-foreground mb-3"}),r.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"Add a video walkthrough to showcase this property"}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-2 justify-center",children:[r.jsxs(ee,{type:"button",variant:"outline",onClick:L,className:"gap-2",children:[r.jsx(iS,{className:"h-4 w-4"}),"Select from Library"]}),r.jsxs(ee,{type:"button",variant:"outline",onClick:q,className:"gap-2",children:[r.jsx(xg,{className:"h-4 w-4"}),"Record New Video"]})]})]})})}),r.jsx(Fr,{open:o,onOpenChange:l,children:r.jsxs(Rr,{className:"max-w-2xl max-h-[80vh] overflow-hidden flex flex-col",children:[r.jsx(qr,{children:r.jsxs($r,{className:"flex items-center gap-2",children:[r.jsx(iS,{className:"h-5 w-5"}),"Select a Video"]})}),r.jsx("div",{className:"flex-1 overflow-y-auto",children:p?r.jsx("div",{className:"flex items-center justify-center py-12",children:r.jsx(en,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):i.length===0?r.jsxs("div",{className:"text-center py-12",children:[r.jsx(Pa,{className:"h-12 w-12 mx-auto text-muted-foreground mb-3"}),r.jsx("p",{className:"text-muted-foreground mb-4",children:"No videos in your library yet"}),r.jsxs(ee,{onClick:q,className:"gap-2",children:[r.jsx(xg,{className:"h-4 w-4"}),"Record Your First Video"]})]}):r.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-3 p-1",children:i.map(G=>r.jsxs("button",{type:"button",onClick:()=>z(G),className:`group relative rounded-lg overflow-hidden border-2 transition-all text-left ${t===G.id?"border-primary ring-2 ring-primary/20":"border-transparent hover:border-muted-foreground/30"}`,children:[r.jsxs("div",{className:"aspect-video bg-muted relative",children:[Z(G)?r.jsx("img",{src:Z(G),alt:G.title||"Video",className:"w-full h-full object-cover"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center",children:r.jsx(Pa,{className:"h-8 w-8 text-muted-foreground"})}),r.jsx("div",{className:"absolute inset-0 bg-black/0 group-hover:bg-black/30 transition-colors flex items-center justify-center",children:r.jsx(hc,{className:"h-8 w-8 text-white opacity-0 group-hover:opacity-100 transition-opacity"})}),G.duration_seconds&&r.jsx("div",{className:"absolute bottom-1 right-1 bg-black/70 text-white text-[10px] px-1.5 py-0.5 rounded",children:H(G.duration_seconds)})]}),r.jsx("div",{className:"p-2 bg-card",children:r.jsx("p",{className:"text-xs font-medium truncate",children:G.title||"Untitled Video"})})]},G.id))})}),r.jsxs("div",{className:"flex justify-between items-center pt-4 border-t",children:[r.jsxs(ee,{type:"button",variant:"ghost",onClick:q,className:"gap-2",children:[r.jsx(xg,{className:"h-4 w-4"}),"Record New Video"]}),r.jsx(ee,{type:"button",variant:"outline",onClick:()=>l(!1),children:"Cancel"})]})]})})]})}const sWt=[{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"}],aWt=[{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 h5e(){var ge;const{listingId:t}=Zc(),[e]=$d(),n=e.get("brokerage"),s=rs(),{user:a}=Qr(),o=!!t&&t!=="new",l=!!n&&!o,{data:i,isLoading:h}=f8e(o?t:""),p=Aft(),x=Eft(),y=Ift(),b=Pft(),j=Lft(),{data:C=[]}=Yt({queryKey:["brokerage-agents",n],queryFn:async()=>{if(!n)return[];const{data:ae,error:he}=await J.from("profiles").select("id, name, email").eq("brokerage_id",n).order("name");if(he)throw he;return ae||[]},enabled:l}),[N,A]=I.useState(""),[E,T]=I.useState(!1),[L,z]=I.useState([]),[F,q]=I.useState([]),[H,Z]=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 ae,he,ue,_e,Ae;i&&o&&Z({property_address:i.property_address||"",city:i.city||"",state:i.state||"",neighborhood:i.neighborhood||"",price:((ae=i.price)==null?void 0:ae.toString())||"",property_type:i.property_type,status:i.status,bedrooms:((he=i.bedrooms)==null?void 0:he.toString())||"",bathrooms:((ue=i.bathrooms)==null?void 0:ue.toString())||"",square_footage:((_e=i.square_footage)==null?void 0:_e.toString())||"",lot_size:i.lot_size||"",year_built:((Ae=i.year_built)==null?void 0:Ae.toString())||"",has_hoa:i.has_hoa,description:i.description||"",agent_notes:i.agent_notes||"",agent_notes_public:i.agent_notes_public,mls_link:i.mls_link||"",video_link:i.video_link||"",video_id:i.video_id||null,allow_sharing:i.allow_sharing,open_to_referrals:i.open_to_referrals,open_to_social_promotion:i.open_to_social_promotion,share_with_brokerage:i.share_with_brokerage??!1,is_public:i.is_public})},[i,o]);const G=ae=>{if(!ae)return;const he=Array.from(ae);z(_e=>[..._e,...he]);const ue=he.map(_e=>URL.createObjectURL(_e));q(_e=>[..._e,...ue])},te=ae=>{URL.revokeObjectURL(F[ae]),z(he=>he.filter((ue,_e)=>_e!==ae)),q(he=>he.filter((ue,_e)=>_e!==ae))},ie=async ae=>{var he;if(!(!ae||!i)){T(!0);try{for(const ue of Array.from(ae)){const _e=ue.name.split(".").pop(),Ae=`${a==null?void 0:a.id}/${i.id}/${Date.now()}.${_e}`,{error:Ce}=await J.storage.from("listing-photos").upload(Ae,ue);if(Ce)throw Ce;const{data:{publicUrl:be}}=J.storage.from("listing-photos").getPublicUrl(Ae);await b.mutateAsync({listingId:i.id,photoUrl:be,isPrimary:!((he=i.photos)!=null&&he.length)})}ze.success("Photos uploaded!")}catch(ue){console.error("Upload error:",ue),ze.error("Failed to upload photos")}finally{T(!1)}}},le=async ae=>{for(let he=0;he{if(i)try{await j.mutateAsync({photoId:ae,listingId:i.id}),ze.success("Photo removed")}catch{ze.error("Failed to remove photo")}},ne=async ae=>{if(ae.preventDefault(),!H.city.trim()||!H.state.trim()||!H.price){ze.error("Please fill in required fields (City, State, Price)");return}if(l&&!N){ze.error("Please select an agent to assign this listing to");return}try{const he={property_address:H.property_address||null,city:H.city,state:H.state,neighborhood:H.neighborhood||null,price:Number(H.price),property_type:H.property_type,status:H.status,bedrooms:H.bedrooms?Number(H.bedrooms):null,bathrooms:H.bathrooms?Number(H.bathrooms):null,square_footage:H.square_footage?Number(H.square_footage):null,lot_size:H.lot_size||null,year_built:H.year_built?Number(H.year_built):null,has_hoa:H.has_hoa,description:H.description||null,agent_notes:H.agent_notes||null,agent_notes_public:H.agent_notes_public,mls_link:H.mls_link||null,video_link:H.video_link||null,video_id:H.video_id||null,allow_sharing:H.allow_sharing,open_to_referrals:H.open_to_referrals,open_to_social_promotion:H.open_to_social_promotion,share_with_brokerage:H.share_with_brokerage,is_public:H.is_public};if(o)await y.mutateAsync({id:t,...he}),ze.success("Listing updated!"),s(`/mission-control/listings/${t}`);else{T(!0);let ue;if(l&&N?ue=await x.mutateAsync({agentId:N,...he}):ue=await p.mutateAsync(he),L.length>0)try{await le(ue.id),F.forEach(_e=>URL.revokeObjectURL(_e)),z([]),q([])}catch(_e){console.error("Photo upload error:",_e),ze.error("Listing created but some photos failed to upload")}T(!1),ze.success("Listing created!"),s(l?"/my-brokerage":`/mission-control/listings/${ue.id}`)}}catch(he){console.error("Save error:",he),ze.error("Failed to save listing"),T(!1)}};return o&&h?r.jsx(Lr,{title:"Loading...",description:"",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Ir,{className:"h-10 w-32"}),r.jsx(Ir,{className:"h-[600px] w-full"})]})}):r.jsx(Lr,{title:o?"Edit Listing":l?"Add Listing for Agent":"Add Listing",description:"",children:r.jsxs("form",{onSubmit:ne,className:"space-y-6",children:[r.jsxs(ee,{type:"button",variant:"ghost",onClick:()=>s(l?"/my-brokerage":"/mission-control/listings"),children:[r.jsx(so,{className:"h-4 w-4 mr-2"}),l?"Back to Brokerage":"Back to Listings"]}),r.jsxs("div",{className:"grid md:grid-cols-3 gap-6",children:[r.jsxs("div",{className:"md:col-span-2 space-y-6",children:[l&&r.jsxs(Ye,{children:[r.jsx(Gt,{children:r.jsx(Zt,{children:"Assign to Agent *"})}),r.jsxs(tt,{children:[r.jsxs(gn,{value:N,onValueChange:A,children:[r.jsx(fn,{children:r.jsx(xn,{placeholder:"Select an agent..."})}),r.jsx(pn,{children:C.map(ae=>r.jsx(Vt,{value:ae.id,children:ae.name||ae.email},ae.id))})]}),r.jsx("p",{className:"text-sm text-muted-foreground mt-2",children:"This listing will appear on the selected agent's Listing Exchange."})]})]}),r.jsxs(Ye,{children:[r.jsx(Gt,{children:r.jsx(Zt,{children:"Property Details"})}),r.jsx(tt,{className:"space-y-4",children:r.jsxs("div",{className:"grid sm:grid-cols-2 gap-4",children:[r.jsxs("div",{className:"sm:col-span-2 space-y-2",children:[r.jsx(He,{children:"Property Address"}),r.jsx(dt,{value:H.property_address,onChange:ae=>Z({...H,property_address:ae.target.value}),placeholder:"123 Main St"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"City *"}),r.jsx(dt,{value:H.city,onChange:ae=>Z({...H,city:ae.target.value}),placeholder:"City",required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"State *"}),r.jsx(dt,{value:H.state,onChange:ae=>Z({...H,state:ae.target.value}),placeholder:"State",required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Neighborhood"}),r.jsx(dt,{value:H.neighborhood,onChange:ae=>Z({...H,neighborhood:ae.target.value}),placeholder:"Neighborhood"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Price *"}),r.jsx(dt,{type:"number",value:H.price,onChange:ae=>Z({...H,price:ae.target.value}),placeholder:"500000",required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Property Type"}),r.jsxs(gn,{value:H.property_type,onValueChange:ae=>Z({...H,property_type:ae}),children:[r.jsx(fn,{children:r.jsx(xn,{})}),r.jsx(pn,{children:aWt.map(ae=>r.jsx(Vt,{value:ae.value,children:ae.label},ae.value))})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Status"}),r.jsxs(gn,{value:H.status,onValueChange:ae=>Z({...H,status:ae}),children:[r.jsx(fn,{children:r.jsx(xn,{})}),r.jsx(pn,{children:sWt.map(ae=>r.jsx(Vt,{value:ae.value,children:ae.label},ae.value))})]})]})]})})]}),r.jsxs(Ye,{children:[r.jsx(Gt,{children:r.jsx(Zt,{children:"Property Specs (Optional)"})}),r.jsx(tt,{children:r.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Bedrooms"}),r.jsx(dt,{type:"number",value:H.bedrooms,onChange:ae=>Z({...H,bedrooms:ae.target.value}),placeholder:"3"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Bathrooms"}),r.jsx(dt,{type:"number",step:"0.5",value:H.bathrooms,onChange:ae=>Z({...H,bathrooms:ae.target.value}),placeholder:"2"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Sq Ft"}),r.jsx(dt,{type:"number",value:H.square_footage,onChange:ae=>Z({...H,square_footage:ae.target.value}),placeholder:"2000"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Lot Size"}),r.jsx(dt,{value:H.lot_size,onChange:ae=>Z({...H,lot_size:ae.target.value}),placeholder:"0.25 acres"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Year Built"}),r.jsx(dt,{type:"number",value:H.year_built,onChange:ae=>Z({...H,year_built:ae.target.value}),placeholder:"2005"})]}),r.jsxs("div",{className:"flex items-center gap-2 pt-6",children:[r.jsx(Ps,{checked:H.has_hoa,onCheckedChange:ae=>Z({...H,has_hoa:ae})}),r.jsx(He,{children:"Has HOA"})]})]})})]}),r.jsxs(Ye,{children:[r.jsx(Gt,{children:r.jsx(Zt,{children:"Description & Links"})}),r.jsxs(tt,{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Description"}),r.jsx(ps,{value:H.description,onChange:ae=>Z({...H,description:ae.target.value}),placeholder:"Tell the story of this property...",rows:4})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Agent Notes"}),r.jsx(ps,{value:H.agent_notes,onChange:ae=>Z({...H,agent_notes:ae.target.value}),placeholder:"Notes for other agents...",rows:2}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ps,{checked:H.agent_notes_public,onCheckedChange:ae=>Z({...H,agent_notes_public:ae})}),r.jsx(He,{className:"text-sm text-muted-foreground",children:"Make notes visible to other agents"})]})]}),r.jsxs("div",{className:"grid sm:grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"MLS Link"}),r.jsx(dt,{value:H.mls_link,onChange:ae=>Z({...H,mls_link:ae.target.value}),placeholder:"https://..."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Video Link"}),r.jsx(dt,{value:H.video_link,onChange:ae=>Z({...H,video_link:ae.target.value}),placeholder:"YouTube or Vimeo URL"})]})]})]})]}),r.jsxs(Ye,{children:[r.jsx(Gt,{children:r.jsxs(Zt,{className:"flex items-center gap-2",children:[r.jsx(Pa,{className:"h-5 w-5"}),"Property Video"]})}),r.jsx(tt,{children:r.jsx(nWt,{selectedVideoId:H.video_id,onVideoSelect:ae=>Z({...H,video_id:ae}),listingId:o?t:void 0})})]}),r.jsxs(Ye,{children:[r.jsx(Gt,{children:r.jsx(Zt,{children:"Photos"})}),r.jsxs(tt,{children:[r.jsxs("div",{className:"grid grid-cols-3 sm:grid-cols-4 gap-4",children:[o&&((ge=i==null?void 0:i.photos)==null?void 0:ge.map(ae=>r.jsxs("div",{className:"relative aspect-square rounded-lg overflow-hidden bg-muted",children:[r.jsx("img",{src:ae.photo_url,alt:"",className:"w-full h-full object-cover"}),r.jsx("button",{type:"button",onClick:()=>ye(ae.id),className:"absolute top-1 right-1 p-1 bg-destructive text-destructive-foreground rounded-full hover:bg-destructive/90",children:r.jsx(_s,{className:"h-3 w-3"})}),ae.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"})]},ae.id))),!o&&F.map((ae,he)=>r.jsxs("div",{className:"relative aspect-square rounded-lg overflow-hidden bg-muted",children:[r.jsx("img",{src:ae,alt:"",className:"w-full h-full object-cover"}),r.jsx("button",{type:"button",onClick:()=>te(he),className:"absolute top-1 right-1 p-1 bg-destructive text-destructive-foreground rounded-full hover:bg-destructive/90",children:r.jsx(_s,{className:"h-3 w-3"})}),he===0&&r.jsx("span",{className:"absolute bottom-1 left-1 text-[10px] bg-primary text-primary-foreground px-1.5 py-0.5 rounded",children:"Primary"})]},he)),r.jsxs("label",{className:"aspect-square rounded-lg border-2 border-dashed border-muted-foreground/25 hover:border-muted-foreground/50 cursor-pointer flex flex-col items-center justify-center gap-2 text-muted-foreground",children:[E?r.jsx(en,{className:"h-8 w-8 animate-spin"}):r.jsxs(r.Fragment,{children:[r.jsx(uo,{className:"h-8 w-8"}),r.jsx("span",{className:"text-xs",children:"Upload"})]}),r.jsx("input",{type:"file",accept:"image/*",multiple:!0,className:"hidden",onChange:ae=>o?ie(ae.target.files):G(ae.target.files),disabled:E})]})]}),!o&&L.length>0&&r.jsxs("p",{className:"text-sm text-muted-foreground mt-4",children:[L.length," photo",L.length!==1?"s":""," will be uploaded when you save."]})]})]})]}),r.jsxs("div",{className:"space-y-6",children:[r.jsxs(Ye,{children:[r.jsx(Gt,{children:r.jsx(Zt,{children:"Sharing & Collaboration"})}),r.jsxs(tt,{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(He,{children:"Allow Sharing"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Other agents can share this listing"})]}),r.jsx(Ps,{checked:H.allow_sharing,onCheckedChange:ae=>Z({...H,allow_sharing:ae})})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(He,{children:"Open to Referrals"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Accept buyer referrals"})]}),r.jsx(Ps,{checked:H.open_to_referrals,onCheckedChange:ae=>Z({...H,open_to_referrals:ae})})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(He,{children:"Social Promotion"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Can be promoted on social media"})]}),r.jsx(Ps,{checked:H.open_to_social_promotion,onCheckedChange:ae=>Z({...H,open_to_social_promotion:ae})})]}),r.jsxs("div",{className:"flex items-center justify-between pt-2 border-t",children:[r.jsxs("div",{children:[r.jsx(He,{children:"Share with Brokerage"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Visible to agents in your brokerage"})]}),r.jsx(Ps,{checked:H.share_with_brokerage,onCheckedChange:ae=>Z({...H,share_with_brokerage:ae})})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(He,{children:"Make Public"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Publish on listings.relevelup.com to get leads"})]}),r.jsx(Ps,{checked:H.is_public,onCheckedChange:ae=>Z({...H,is_public:ae})})]})]})]}),r.jsx(ee,{type:"submit",className:"w-full",size:"lg",disabled:p.isPending||y.isPending,children:p.isPending||y.isPending?r.jsxs(r.Fragment,{children:[r.jsx(en,{className:"h-4 w-4 mr-2 animate-spin"}),"Saving..."]}):o?"Update Listing":"Create Listing"})]})]})]})})}function iWt({maxDurationSeconds:t=30,onRecordingComplete:e,onError:n,onRecordingStateChange:s,className:a,teleprompterContent:o}){const l=I.useRef(null),i=I.useRef(null),h=I.useRef(null),p=I.useRef([]),x=I.useRef(null),y=I.useRef(null),b=I.useRef(null),j=I.useRef(null),C=f3(),[N,A]=I.useState(!0),[E,T]=I.useState(!0),[L,z]=I.useState(null),[F,q]=I.useState(!1),[H,Z]=I.useState(!1),[G,te]=I.useState(null),[ie,le]=I.useState(null),[ye,ne]=I.useState(0),[ge,ae]=I.useState("user"),[he,ue]=I.useState(0),[_e,Ae]=I.useState(!1),[Ce,be]=I.useState(!0),[me,Le]=I.useState(null),[Ne,Be]=I.useState(!1),Ee=I.useCallback(Oe=>{A(Oe)},[]),Ue=I.useRef(N),Re=I.useCallback(async()=>{var Qe;T(!0),Le(null);const Oe=C&&N;console.log("[VideoRecorder] initCamera start",{isMobile:C,usePortraitMode:N,shouldBePortrait:Oe,facingMode:ge});try{if(!navigator.mediaDevices||!navigator.mediaDevices.getUserMedia)throw new Error("Camera not available in this browser or context. Try opening in a new tab.");h.current&&(console.log("[VideoRecorder] stopping existing stream"),h.current.getTracks().forEach(wt=>wt.stop()));const nt=C&&Oe?{facingMode:{ideal:ge},width:{ideal:720},height:{ideal:1280}}:{facingMode:{ideal:ge},width:{ideal:1280},height:{ideal:720}};console.log("[VideoRecorder] requesting getUserMedia",nt);const gt=await navigator.mediaDevices.getUserMedia({video:nt,audio:{echoCancellation:!0,noiseSuppression:!0}});if(console.log("[VideoRecorder] getUserMedia success"),gt.getVideoTracks().length===0)throw new Error("Camera stream started but no video track was provided.");h.current=gt,z(!0);const Mt=gt.getVideoTracks()[0].getSettings();if(console.log("[VideoRecorder] Camera initialized with dimensions:",Mt.width,"x",Mt.height),l.current){const wt=l.current;wt.srcObject=gt,wt.muted=!0,wt.playsInline=!0,wt.autoplay=!0,wt.setAttribute("muted",""),wt.setAttribute("playsinline",""),wt.setAttribute("autoplay","");try{(Qe=wt.load)==null||Qe.call(wt)}catch(Cr){console.warn("[VideoRecorder] videoEl.load failed",Cr)}const Qt=async()=>{try{return await wt.play(),console.log("[VideoRecorder] preview play ok"),Be(!1),setTimeout(()=>{console.debug("[VideoRecorder] preview metrics",{readyState:wt.readyState,videoWidth:wt.videoWidth,videoHeight:wt.videoHeight})},300),!0}catch(Cr){return console.warn("[VideoRecorder] preview play blocked",Cr),Be(!0),!1}};await new Promise(Cr=>{let cn=!1;const jn=()=>{cn||(cn=!0,Cr())},Xr=()=>{Qt().finally(jn)};wt.onloadedmetadata=Xr,wt.onloadeddata=Xr,setTimeout(jn,1500)})}try{y.current=new AudioContext;const wt=y.current.createMediaStreamSource(gt);b.current=y.current.createAnalyser(),b.current.fftSize=256,wt.connect(b.current);const Qt=()=>{if(b.current){const Cr=new Uint8Array(b.current.frequencyBinCount);b.current.getByteFrequencyData(Cr);const cn=Cr.reduce((jn,Xr)=>jn+Xr)/Cr.length;ue(Math.min(100,cn/128*100))}j.current=requestAnimationFrame(Qt)};Qt()}catch(wt){console.warn("Audio context not available:",wt)}}catch(nt){console.error("Camera initialization error:",nt),z(!1);let gt="Failed to access camera or microphone.";nt.name==="NotAllowedError"?gt="Camera permission denied. Please allow camera access in your browser settings.":nt.name==="NotFoundError"?gt="No camera found. Please connect a camera and try again.":nt.name==="NotReadableError"?gt="Camera is in use by another application. Please close other apps using the camera.":nt.message&&(gt=nt.message),Le(gt),n==null||n(gt)}finally{T(!1)}},[ge,n,C,N]);I.useEffect(()=>{Ue.current!==N&&L&&!F&&!ie&&(Ue.current=N,Re())},[N,L,F,ie,Re]),I.useEffect(()=>(Re(),()=>{h.current&&h.current.getTracks().forEach(Oe=>Oe.stop()),x.current&&clearInterval(x.current),j.current&&cancelAnimationFrame(j.current),y.current&&y.current.close(),ie&&URL.revokeObjectURL(ie)}),[Re,ie]),I.useEffect(()=>{if(E||L!==!0||ie)return;const Oe=h.current,Qe=l.current;!Oe||!Qe||(Qe.srcObject!==Oe&&(Qe.srcObject=Oe,Qe.muted=!0,Qe.playsInline=!0,Qe.autoplay=!0,Qe.setAttribute("muted",""),Qe.setAttribute("playsinline",""),Qe.setAttribute("autoplay","")),Qe.play().then(()=>Be(!1)).catch(nt=>{Be(!0),console.warn("Live preview play blocked on mount:",nt)}))},[L,E,ie]),I.useEffect(()=>{s==null||s(F)},[F,s]);const je=I.useCallback(async()=>{if(ie)return;const Oe=l.current;if(Oe)try{await Oe.play(),Be(!1)}catch(Qe){Be(!0),console.warn("Live preview still blocked (needs user gesture):",Qe)}},[ie]),et=I.useCallback(()=>{i.current&&i.current.state!=="inactive"&&i.current.stop(),x.current&&(clearInterval(x.current),x.current=null),q(!1),Z(!1)},[]),Te=I.useCallback(()=>{if(!h.current)return;je(),p.current=[],ne(0);const Qe=["video/webm;codecs=vp9,opus","video/webm;codecs=vp8,opus","video/webm;codecs=vp9","video/webm;codecs=vp8","video/webm","video/mp4"].find(gt=>MediaRecorder.isTypeSupported(gt)),nt=new MediaRecorder(h.current,Qe?{mimeType:Qe,videoBitsPerSecond:25e5}:{videoBitsPerSecond:25e5});nt.ondataavailable=gt=>{gt.data.size>0&&p.current.push(gt.data)},nt.onstop=()=>{var wt;const gt=nt.mimeType||Qe||((wt=p.current[0])==null?void 0:wt.type)||"video/webm",mt=new Blob(p.current,{type:gt});te(mt);const Mt=URL.createObjectURL(mt);le(Mt)},i.current=nt,nt.start(100),q(!0),x.current=setInterval(()=>{ne(gt=>gt>=t-1?(et(),t):gt+1)},1e3)},[je,t,et]),Ze=I.useCallback(()=>{i.current&&i.current.state==="recording"&&(i.current.pause(),Z(!0),x.current&&clearInterval(x.current))},[]),pe=I.useCallback(()=>{i.current&&i.current.state==="paused"&&(i.current.resume(),Z(!1),x.current=setInterval(()=>{ne(Oe=>Oe>=t-1?(et(),t):Oe+1)},1e3))},[t,et]),yt=I.useCallback(()=>{ie&&URL.revokeObjectURL(ie),te(null),le(null),ne(0),Ae(!1),be(!0),l.current&&h.current&&(l.current.srcObject=h.current,l.current.muted=!0,je())},[je,ie]),rt=I.useCallback(()=>{ae(Oe=>Oe==="user"?"environment":"user")},[]),at=I.useCallback(()=>{G&&e(G,ye)},[G,ye,e]),Me=I.useCallback(()=>{l.current&&ie&&(_e?l.current.pause():(be(!1),l.current.muted=!1,l.current.play()),Ae(!_e))},[ie,_e]);I.useEffect(()=>{if(!ie)return;const Oe=l.current;if(!Oe)return;be(!1),Oe.pause(),Oe.removeAttribute("src"),Oe.srcObject=null,Oe.load(),Oe.src=ie,Oe.currentTime=0,Oe.playsInline=!0,Oe.muted=!1,Oe.onended=()=>Ae(!1);const Qe=()=>{const nt=Oe.error,gt=nt?`Recorded video failed to play (code ${nt.code}). Likely unsupported format/codec in this browser.`:"Recorded video failed to play.";console.warn("[VideoRecorder] recorded playback error",nt),n==null||n(gt)};return Oe.addEventListener("error",Qe),Oe.load(),()=>{Oe.removeEventListener("error",Qe)}},[n,ie]);const ft=Oe=>{const Qe=Math.floor(Oe/60),nt=Oe%60;return`${Qe}:${nt.toString().padStart(2,"0")}`},qe=C&&N?"aspect-[9/16]":"aspect-video";return E?r.jsx("div",{className:$t("flex items-center justify-center bg-black rounded-lg",qe,a),children:r.jsxs("div",{className:"text-center text-white",children:[r.jsx(en,{className:"h-12 w-12 animate-spin mx-auto mb-4"}),r.jsx("p",{children:"Initializing camera..."})]})}):L===!1?r.jsx("div",{className:$t("flex items-center justify-center bg-black rounded-lg",qe,a),children:r.jsxs("div",{className:"text-center text-white p-8 max-w-md",children:[r.jsx(Il,{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:me||"Please allow camera and microphone access to record videos."}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs(ee,{onClick:()=>Re(),variant:"secondary",className:"w-full",children:[r.jsx(Gl,{className:"h-4 w-4 mr-2"}),"Try Again"]}),r.jsx("p",{className:"text-xs text-gray-500 mt-3",children:"💡 Tip: If you're viewing this in an embedded preview, try opening the app in a new browser tab for full camera access."})]})]})}):r.jsxs("div",{className:$t("flex flex-col gap-2",a),children:[C&&!F&&!ie&&r.jsxs("div",{className:"flex items-center justify-center gap-3 py-2 bg-muted/50 rounded-lg",children:[r.jsx(xj,{className:$t("h-4 w-4",N?"text-muted-foreground":"text-primary")}),r.jsx(He,{htmlFor:"orientation-toggle",className:"text-sm text-muted-foreground",children:"Landscape"}),r.jsx(Ps,{id:"orientation-toggle",checked:N,onCheckedChange:Ee}),r.jsx(He,{htmlFor:"orientation-toggle",className:"text-sm text-muted-foreground",children:"Portrait"}),r.jsx(bg,{className:$t("h-4 w-4",N?"text-primary":"text-muted-foreground")})]}),r.jsxs("div",{className:$t("relative bg-black rounded-lg overflow-hidden"),onPointerDown:()=>{je()},children:[r.jsx("video",{ref:l,src:ie??void 0,className:$t("w-full bg-black",N&&!ie?"object-contain":"object-cover",qe,ge==="user"&&!ie&&"scale-x-[-1]"),playsInline:!0,controls:!!ie,muted:ie?Ce:!0,autoPlay:!ie},ie??"live"),!ie&&Ne&&r.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/40",children:r.jsx(ee,{type:"button",variant:"secondary",onClick:()=>void je(),className:"bg-white/20 hover:bg-white/30 text-white",children:"Tap to enable preview"})}),o&&!ie&&r.jsx("div",{className:"absolute inset-0 pointer-events-none",children:o}),F&&r.jsxs("div",{className:"absolute top-4 left-4 flex items-center gap-2 bg-black/50 px-3 py-1.5 rounded-full",children:[r.jsx("div",{className:$t("w-3 h-3 rounded-full",H?"bg-yellow-500":"bg-red-500 animate-pulse")}),r.jsxs("span",{className:"text-white text-sm font-medium",children:[ft(ye)," / ",ft(t)]})]}),F&&r.jsx("div",{className:"absolute top-0 left-0 right-0",children:r.jsx(Kc,{value:ye/t*100,className:"h-1 rounded-none"})}),!ie&&r.jsxs("div",{className:"absolute bottom-20 left-4 flex items-center gap-2 bg-black/50 px-3 py-1.5 rounded-full",children:[r.jsx(FT,{className:"h-4 w-4 text-white"}),r.jsx("div",{className:"w-20 h-2 bg-white/20 rounded-full overflow-hidden",children:r.jsx("div",{className:"h-full bg-green-500 transition-all duration-75",style:{width:`${he}%`}})})]}),r.jsx("div",{className:"absolute bottom-4 left-0 right-0 flex justify-center gap-3 px-4",children:ie?r.jsxs(r.Fragment,{children:[r.jsxs(ee,{variant:"secondary",size:"lg",className:"bg-white/20 hover:bg-white/30 text-white",onClick:yt,children:[r.jsx(Gl,{className:"h-5 w-5 mr-2"}),"Re-record"]}),r.jsx(ee,{variant:"secondary",size:"icon",className:"h-12 w-12 rounded-full bg-white/20 hover:bg-white/30 text-white",onClick:Me,children:_e?r.jsx(Yf,{className:"h-5 w-5"}):r.jsx(hc,{className:"h-5 w-5"})}),r.jsxs(ee,{size:"lg",className:"bg-green-500 hover:bg-green-600 text-white",onClick:at,children:[r.jsx(Ai,{className:"h-5 w-5 mr-2"}),"Use This Video"]})]}):r.jsxs(r.Fragment,{children:[r.jsx(ee,{variant:"secondary",size:"icon",className:"h-12 w-12 rounded-full bg-white/20 hover:bg-white/30 text-white",onClick:rt,disabled:F,children:r.jsx(pS,{className:"h-5 w-5"})}),F?r.jsxs(r.Fragment,{children:[r.jsx(ee,{size:"icon",className:"h-12 w-12 rounded-full bg-white/20 hover:bg-white/30 text-white",onClick:H?pe:Ze,children:H?r.jsx(hc,{className:"h-5 w-5"}):r.jsx(Yf,{className:"h-5 w-5"})}),r.jsx(ee,{size:"icon",className:"h-16 w-16 rounded-full bg-red-500 hover:bg-red-600 text-white",onClick:et,children:r.jsx(wg,{className:"h-6 w-6 fill-current"})})]}):r.jsx(ee,{size:"icon",className:"h-16 w-16 rounded-full bg-red-500 hover:bg-red-600 text-white",onClick:Te,children:r.jsx(Pa,{className:"h-6 w-6"})}),r.jsx("div",{className:"h-12 w-12"})]})})]})]})}function oWt({text:t,isVisible:e,onToggleVisibility:n,isRecording:s=!1,className:a}){const o=I.useRef(null),l=I.useRef(null),i=I.useRef(0),h=I.useRef(0),[p,x]=I.useState(!1),[y,b]=I.useState(30),[j,C]=I.useState(24),[N,A]=I.useState(1.6),[E,T]=I.useState(.85),[L,z]=I.useState("top"),[F,q]=I.useState(!1),H=I.useCallback(ie=>{if(!o.current)return;i.current===0&&(i.current=ie);const le=ie-i.current;i.current=ie,h.current+=y*le/1e3;const ye=Math.floor(h.current);ye>0&&(o.current.scrollTop+=ye,h.current-=ye);const{scrollTop:ne,scrollHeight:ge,clientHeight:ae}=o.current;if(ne+ae>=ge){x(!1);return}l.current=requestAnimationFrame(H)},[y]);I.useEffect(()=>(p?(i.current=0,h.current=0,l.current=requestAnimationFrame(H)):l.current&&cancelAnimationFrame(l.current),()=>{l.current&&cancelAnimationFrame(l.current)}),[p,H]),I.useEffect(()=>{s&&e?(o.current&&(o.current.scrollTop=0),setTimeout(()=>{x(!0)},100)):s||x(!1)},[s,e]);const Z=I.useCallback(()=>{o.current&&(o.current.scrollTop=0),x(!1)},[]),G=I.useCallback(()=>{x(ie=>!ie)},[]);if(!e)return r.jsx("div",{className:$t("absolute top-4 right-4 pointer-events-auto z-10",a),children:r.jsxs(ee,{variant:"secondary",size:"sm",onClick:n,className:"bg-black/50 hover:bg-black/70 text-white border-0",children:[r.jsx(Qo,{className:"h-4 w-4 mr-2"}),"Show Script"]})});const te={top:"top-0 pt-16",center:"top-1/2 -translate-y-1/2",bottom:"bottom-0 pb-24"};return r.jsxs("div",{className:$t("absolute inset-0 pointer-events-none",a),children:[r.jsx("div",{className:$t("absolute left-0 right-0 h-[60%] overflow-hidden pointer-events-auto",te[L]),style:{opacity:E},children:r.jsxs("div",{ref:o,className:$t("mx-auto max-w-2xl px-6 overflow-y-auto scrollbar-hide h-full",F&&"scale-x-[-1]"),style:{maskImage:"linear-gradient(to bottom, transparent, black 10%, black 90%, transparent)",WebkitMaskImage:"linear-gradient(to bottom, transparent, black 10%, black 90%, transparent)"},children:[r.jsx("p",{className:"text-white text-center font-medium drop-shadow-lg",style:{fontSize:`${j}px`,lineHeight:N,textShadow:"0 2px 4px rgba(0,0,0,0.8)"},children:t}),r.jsx("div",{className:"h-32"})]})}),r.jsxs("div",{className:"absolute top-4 right-4 flex items-center gap-2 pointer-events-auto",children:[r.jsxs(zu,{children:[r.jsx(Bu,{asChild:!0,children:r.jsx(ee,{variant:"secondary",size:"icon",className:"h-9 w-9 bg-black/50 hover:bg-black/70 text-white border-0",children:r.jsx(fd,{className:"h-4 w-4"})})}),r.jsx(uu,{className:"w-72",side:"left",align:"start",children:r.jsxs("div",{className:"space-y-4",children:[r.jsx("h4",{className:"font-medium",children:"Teleprompter Settings"}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{className:"text-xs",children:"Scroll Speed"}),r.jsx(lm,{value:[y],onValueChange:([ie])=>b(ie),min:1,max:100,step:1})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{className:"text-xs",children:"Font Size"}),r.jsx(lm,{value:[j],onValueChange:([ie])=>C(ie),min:16,max:48,step:2})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{className:"text-xs",children:"Line Spacing"}),r.jsx(lm,{value:[N*10],onValueChange:([ie])=>A(ie/10),min:12,max:24,step:1})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{className:"text-xs",children:"Opacity"}),r.jsx(lm,{value:[E*100],onValueChange:([ie])=>T(ie/100),min:30,max:100,step:5})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{className:"text-xs",children:"Position"}),r.jsxs("div",{className:"flex gap-1",children:[r.jsx(ee,{variant:L==="top"?"default":"outline",size:"sm",onClick:()=>z("top"),children:r.jsx(c1,{className:"h-4 w-4"})}),r.jsx(ee,{variant:L==="center"?"default":"outline",size:"sm",onClick:()=>z("center"),children:r.jsx(_1,{className:"h-4 w-4"})}),r.jsx(ee,{variant:L==="bottom"?"default":"outline",size:"sm",onClick:()=>z("bottom"),children:r.jsx(Dd,{className:"h-4 w-4"})})]})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(He,{className:"text-xs",children:"Mirror Mode"}),r.jsx(Ps,{checked:F,onCheckedChange:q})]})]})})]}),r.jsx(ee,{variant:"secondary",size:"icon",onClick:G,className:"h-9 w-9 bg-black/50 hover:bg-black/70 text-white border-0",children:p?r.jsx(Yf,{className:"h-4 w-4"}):r.jsx(hc,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"secondary",size:"icon",onClick:Z,className:"h-9 w-9 bg-black/50 hover:bg-black/70 text-white border-0",children:r.jsx(pS,{className:"h-4 w-4"})}),r.jsxs(ee,{variant:"secondary",size:"sm",onClick:n,className:"bg-black/50 hover:bg-black/70 text-white border-0",children:[r.jsx(h1,{className:"h-4 w-4 mr-2"}),"Hide"]})]})]})}function lWt({onSelectScript:t,onCreateNew:e,selectedScriptId:n,className:s}){const{toast:a}=fi(),[o,l]=I.useState(""),[i,h]=I.useState(null),[p,x]=I.useState("levelup"),{data:y,isLoading:b}=Fjt(),{data:j,isLoading:C}=zjt(),{data:N,isLoading:A}=Bjt(),E=$jt(),T=I.useMemo(()=>j?j.filter(H=>{const Z=!o||H.title.toLowerCase().includes(o.toLowerCase())||H.script_text.toLowerCase().includes(o.toLowerCase())||H.tags.some(te=>te.toLowerCase().includes(o.toLowerCase())),G=!i||H.category_id===i;return Z&&G}):[],[j,o,i]),L=I.useMemo(()=>N?N.filter(H=>!o||H.title.toLowerCase().includes(o.toLowerCase())||H.script_text.toLowerCase().includes(o.toLowerCase())):[],[N,o]),z=H=>{t({title:H.title,text:H.script_text})},F=async H=>{try{await E.mutateAsync(H),a({title:"Script saved to My Scripts"})}catch{a({title:"Failed to save script",variant:"destructive"})}},q=b||C||A;return r.jsxs("div",{className:$t("flex flex-col h-full",s),children:[r.jsx("div",{className:"p-4 border-b",children:r.jsxs("div",{className:"relative",children:[r.jsx(wa,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(dt,{placeholder:"Search scripts...",value:o,onChange:H=>l(H.target.value),className:"pl-9"})]})}),r.jsxs(Ii,{value:p,onValueChange:H=>x(H),className:"flex-1 flex flex-col",children:[r.jsxs(wi,{className:"mx-4 mt-4 grid grid-cols-2",children:[r.jsxs(ln,{value:"levelup",children:[r.jsx(La,{className:"h-4 w-4 mr-2"}),"LevelUp Scripts"]}),r.jsxs(ln,{value:"my-scripts",children:[r.jsx(um,{className:"h-4 w-4 mr-2"}),"My Scripts"]})]}),r.jsxs(An,{value:"levelup",className:"flex-1 flex flex-col mt-0 p-4",children:[r.jsxs("div",{className:"flex flex-wrap gap-2 mb-4",children:[r.jsx(Ot,{variant:i?"outline":"default",className:"cursor-pointer",onClick:()=>h(null),children:"All"}),y==null?void 0:y.map(H=>r.jsx(Ot,{variant:i===H.id?"default":"outline",className:"cursor-pointer",onClick:()=>h(H.id),children:H.name},H.id))]}),r.jsx(Jo,{className:"flex-1 max-h-[50vh]",children:q?r.jsx("div",{className:"flex items-center justify-center py-8",children:r.jsx(en,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):T.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(La,{className:"h-12 w-12 mx-auto mb-2 opacity-50"}),r.jsx("p",{children:"No scripts found"})]}):r.jsx("div",{className:"space-y-2",children:T.map(H=>r.jsxs(Ye,{className:$t("cursor-pointer hover:bg-accent/50 transition-colors",n===H.id&&"ring-2 ring-primary"),onClick:()=>z(H),children:[r.jsx(Gt,{className:"p-3",children:r.jsxs("div",{className:"flex items-start justify-between",children:[r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx(Zt,{className:"text-sm font-medium truncate",children:H.title}),H.category&&r.jsx(Ot,{variant:"secondary",className:"mt-1 text-xs",children:H.category.name})]}),r.jsxs("div",{className:"flex items-center gap-1 ml-2",children:[r.jsx(ee,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:Z=>{Z.stopPropagation(),F(H)},children:r.jsx(um,{className:"h-4 w-4"})}),r.jsx(Vi,{className:"h-4 w-4 text-muted-foreground"})]})]})}),r.jsx(tt,{className:"p-3 pt-0",children:r.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",children:H.script_text})})]},H.id))})})]}),r.jsxs(An,{value:"my-scripts",className:"flex-1 flex flex-col mt-0 p-4",children:[e&&r.jsxs(ee,{variant:"outline",className:"mb-4",onClick:e,children:[r.jsx(bn,{className:"h-4 w-4 mr-2"}),"Create New Script"]}),r.jsx(Jo,{className:"flex-1 max-h-[50vh]",children:A?r.jsx("div",{className:"flex items-center justify-center py-8",children:r.jsx(en,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):L.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(um,{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:L.map(H=>r.jsxs(Ye,{className:$t("cursor-pointer hover:bg-accent/50 transition-colors",n===H.id&&"ring-2 ring-primary"),onClick:()=>z(H),children:[r.jsx(Gt,{className:"p-3",children:r.jsxs("div",{className:"flex items-start justify-between",children:[r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx(Zt,{className:"text-sm font-medium truncate",children:H.title}),r.jsx("div",{className:"flex items-center gap-2 mt-1",children:H.is_custom?r.jsx(Ot,{variant:"outline",className:"text-xs",children:"Custom"}):r.jsx(Ot,{variant:"secondary",className:"text-xs",children:"Saved"})})]}),r.jsx(Vi,{className:"h-4 w-4 text-muted-foreground ml-2"})]})}),r.jsx(tt,{className:"p-3 pt-0",children:r.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",children:H.script_text})})]},H.id))})})]})]})]})}function cWt({selectedTemplate:t,onSelect:e,contactName:n,saving:s=!1}){const[a,o]=I.useState(()=>{const i=CS(t);return new Set([i.category])}),l=i=>{o(h=>{const p=new Set(h);return p.has(i)?p.delete(i):p.add(i),p})};return r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(He,{className:"text-sm font-medium",children:"Share Page Template"}),s&&r.jsx(en,{className:"h-3 w-3 animate-spin text-muted-foreground"})]}),r.jsx("div",{className:"space-y-3",children:Kht.map(i=>{const h=Zht(i.id),p=a.has(i.id),x=h.some(y=>y.id===t);return r.jsxs(kS,{open:p,onOpenChange:()=>l(i.id),children:[r.jsxs(NS,{className:"flex items-center justify-between w-full p-2.5 rounded-lg bg-muted/50 hover:bg-muted transition-colors",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"font-medium text-sm",children:i.name}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",h.length,")"]}),x&&!p&&r.jsx("span",{className:"text-xs bg-primary/10 text-primary px-1.5 py-0.5 rounded-full",children:"✓"})]}),r.jsx(Dd,{className:$t("h-4 w-4 text-muted-foreground transition-transform",p&&"rotate-180")})]}),r.jsx(SS,{className:"pt-2",children:r.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-2",children:h.map(y=>{const b=t===y.id;return r.jsxs("button",{type:"button",onClick:()=>e(y.id),disabled:s,className:$t("relative rounded-lg border-2 p-2.5 text-left transition-all hover:shadow-sm disabled:opacity-50 disabled:cursor-not-allowed",b?"border-primary ring-1 ring-primary/20 bg-primary/5":"border-muted hover:border-muted-foreground/30"),children:[b&&r.jsx("div",{className:"absolute top-1 right-1 w-4 h-4 rounded-full bg-primary flex items-center justify-center",children:r.jsx(Ai,{className:"h-2.5 w-2.5 text-primary-foreground"})}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"opacity-70 shrink-0",children:y.icon}),r.jsx("span",{className:"text-sm font-medium truncate",children:y.name})]})]},y.id)})})})]},i.id)})}),n&&t!=="default"&&r.jsxs("p",{className:"text-xs text-muted-foreground",children:['Will show: "',CS(t).headerText(n),'"']})]})}function N$e({open:t,onOpenChange:e,video:n,contactName:s,onTemplateUpdated:a}){const[o,l]=I.useState(n.page_template||"default"),[i,h]=I.useState(!1),[p,x]=I.useState(!1),[y,b]=I.useState(n.page_template||"default"),[j,C]=I.useState([]),[N,A]=I.useState(n.contact_id&&s?{id:n.contact_id,name:s,email:null}:null),[E,T]=I.useState(!1),[L,z]=I.useState(!1),F=n.share_token?`https://video.relevelup.com/${n.share_token}`:"";I.useEffect(()=>{t&&j.length===0&&q()},[t]);const q=async()=>{z(!0);try{const{data:ge,error:ae}=await J.from("innercircle_contacts").select("id, first_name, last_name, email").order("first_name",{ascending:!0}).limit(500);if(ae)throw ae;const he=(ge||[]).map(ue=>({id:ue.id,name:[ue.first_name,ue.last_name].filter(Boolean).join(" ")||"Unnamed",email:ue.email||null}));C(he)}catch(ge){console.error("Failed to fetch contacts:",ge)}finally{z(!1)}},H=async ge=>{A(ge),T(!1),h(!0);try{const{error:ae}=await J.from("agent_videos").update({contact_id:(ge==null?void 0:ge.id)||null,recipient_name:(ge==null?void 0:ge.name)||null}).eq("id",n.id);if(ae)throw ae;ze.success(ge?`Assigned to ${ge.name}`:"Contact removed"),a==null||a()}catch(ae){console.error("Failed to update contact:",ae),ze.error("Failed to update contact")}finally{h(!1)}},Z=async ge=>{l(ge),h(!0);try{const{error:ae}=await J.from("agent_videos").update({page_template:ge}).eq("id",n.id);if(ae)throw ae;b(ge),ze.success("Template saved!"),a==null||a()}catch(ae){console.error("Failed to save template:",ae),ze.error("Failed to save template"),l(y)}finally{h(!1)}},G=(N==null?void 0:N.name)||null,te=()=>{const ge=n.title||"Video Message",ae=n.share_token?`https://video.relevelup.com/thumb/${n.share_token}`:n.thumbnail_url||"";return``},ie=async()=>{if(!n.thumbnail_url){ze.error("Video thumbnail not available yet");return}const ge=te(),ae=`Watch: ${n.title||"Video Message"} ${F}`;try{const he=new Blob([ge],{type:"text/html"}),ue=new Blob([ae],{type:"text/plain"}),_e=new ClipboardItem({"text/html":he,"text/plain":ue});await navigator.clipboard.write([_e]),ze.success("Copied! Paste into Gmail - the thumbnail will appear after sending.")}catch{await navigator.clipboard.writeText(ae+` `+ge),ze.success("Copied! Paste into your email.")}},le=async()=>{await navigator.clipboard.writeText(F),x(!0),ze.success("Share link copied!"),setTimeout(()=>x(!1),2e3)},ye=()=>{const ae=CS(o).headerText(G),he=o==="default"?`Check out this video: ${F}`:`${ae} Check out this special video: ${F}`;window.open(`sms:?body=${encodeURIComponent(he)}`,"_self")},ne=()=>{const ge=CS(o),ae=ge.headerText(G),he=o==="default"?n.title||"Video Message":ae,ue=`${ge.subText} Watch the video: ${F}`,_e=N!=null&&N.email?encodeURIComponent(N.email):"";window.open(`mailto:${_e}?subject=${encodeURIComponent(he)}&body=${encodeURIComponent(ue)}`,"_self")};return r.jsx(Fr,{open:t,onOpenChange:e,children:r.jsxs(Rr,{className:"max-w-lg max-h-[90vh] overflow-y-auto",children:[r.jsxs(qr,{children:[r.jsxs($r,{className:"flex items-center gap-2",children:[r.jsx(Co,{className:"h-5 w-5"}),"Share Video"]}),r.jsx(Xn,{children:"Choose a themed page template and share your video"})]}),r.jsxs("div",{className:"space-y-6 py-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{className:"text-sm font-medium",children:"Personalize for Contact (Optional)"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(zu,{open:E,onOpenChange:T,children:[r.jsx(Bu,{asChild:!0,children:r.jsxs(ee,{variant:"outline",role:"combobox","aria-expanded":E,className:"flex-1 justify-between",disabled:i,children:[N?r.jsxs("span",{className:"flex items-center gap-2",children:[r.jsx(Ec,{className:"h-4 w-4 text-muted-foreground"}),N.name]}):r.jsx("span",{className:"text-muted-foreground",children:"Select a contact..."}),r.jsx(d1,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),r.jsx(uu,{className:"w-[300px] p-0",align:"start",children:r.jsxs(q1,{children:[r.jsx(V1,{placeholder:"Search contacts..."}),r.jsxs(H1,{children:[r.jsx(W1,{children:L?"Loading...":"No contacts found."}),r.jsx(G1,{children:j.map(ge=>r.jsxs(K1,{value:ge.name,onSelect:()=>H(ge),children:[r.jsx(Ai,{className:$t("mr-2 h-4 w-4",(N==null?void 0:N.id)===ge.id?"opacity-100":"opacity-0")}),ge.name]},ge.id))})]})]})})]}),N&&r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>H(null),disabled:i,className:"shrink-0",children:r.jsx(_s,{className:"h-4 w-4"})})]}),N&&o!=="default"&&r.jsxs("p",{className:"text-xs text-muted-foreground",children:['Page will show: "',CS(o).headerText(N.name),'"']})]}),r.jsx(cWt,{selectedTemplate:o,onSelect:Z,contactName:G,saving:i}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Share Link"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(dt,{value:F,readOnly:!0,className:"font-mono text-sm"}),r.jsx(ee,{onClick:le,variant:p?"default":"outline",className:"shrink-0 gap-2",children:p?r.jsxs(r.Fragment,{children:[r.jsx(Ai,{className:"h-4 w-4"}),"Copied"]}):r.jsxs(r.Fragment,{children:[r.jsx(hl,{className:"h-4 w-4"}),"Copy"]})})]})]}),n.thumbnail_url&&r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Share for Email"}),r.jsxs(ee,{variant:"outline",className:"w-full gap-2",onClick:ie,children:[r.jsx(Pl,{className:"h-4 w-4"}),"Copy with Thumbnail (for Gmail)"]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Paste into Gmail to embed a clickable video thumbnail"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Quick Share"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(ee,{variant:"outline",className:"flex-1 gap-2",onClick:ye,children:[r.jsx(Lo,{className:"h-4 w-4"}),"Text"]}),r.jsxs(ee,{variant:"outline",className:"flex-1 gap-2",onClick:ne,children:[r.jsx(da,{className:"h-4 w-4"}),"Email"]})]})]})]}),r.jsx(ea,{children:r.jsx(ee,{variant:"outline",onClick:()=>e(!1),children:"Done"})})]})})}function dWt(){var at;const t=rs(),[e]=$d(),{toast:n}=fi(),s=e.get("contact_id"),a=e.get("task_id"),{canRecord:o,remainingMb:l,usagePercent:i,isNearLimit:h}=Hjt(),{data:p}=op(),x=jze(),y=Zjt(),[b,j]=I.useState("record"),[C,N]=I.useState(""),[A,E]=I.useState(!1),[T,L]=I.useState(!1),[z,F]=I.useState(!1),[q,H]=I.useState(null),[Z,G]=I.useState(0),[te,ie]=I.useState(0),[le,ye]=I.useState(null),[ne,ge]=I.useState(null),[ae,he]=I.useState(s||""),[ue,_e]=I.useState(""),[Ae,Ce]=I.useState(""),[be,me]=I.useState(null),[Le,Ne]=I.useState(null),[Be,Ee]=I.useState(null),[Ue,Re]=I.useState(!1),je=I.useCallback(async(Me,ft)=>{H(Me),j("uploading");try{const{videoId:qe,uploadUrl:Oe}=await Wjt(ue||"Quick Video Touch");ye(qe);const{apiKey:Qe}=await Gjt(qe),nt=new XMLHttpRequest;nt.upload.onprogress=mt=>{mt.lengthComputable&&G(mt.loaded/mt.total*100)},await new Promise((mt,Mt)=>{nt.onload=()=>{nt.status>=200&&nt.status<300?mt():Mt(new Error(`Upload failed: ${nt.status}`))},nt.onerror=()=>Mt(new Error("Upload failed")),nt.open("PUT",Oe),nt.setRequestHeader("AccessKey",Qe),nt.send(Me)}),j("processing");let gt=0;for(;gt<4;){await new Promise(Mt=>setTimeout(Mt,2e3));const mt=await Kjt(qe);if(gt=mt.status,ie(mt.encodeProgress||0),gt===4)ge({playbackUrl:mt.directPlayUrl,thumbnailUrl:mt.thumbnailUrl,previewUrl:mt.previewUrl||null,duration:mt.length||ft,fileSizeMb:(mt.storageSize||Me.size)/(1024*1024)});else if(gt===5||gt===6)throw new Error("Video processing failed")}j("details")}catch(qe){console.error("Upload error:",qe),n({title:"Upload failed",description:"Please try recording again.",variant:"destructive"}),j("record")}},[ue,n]),et=async()=>{if(!(!le||!ne))try{const Me=ae&&ae!=="none"?ae:null,ft=await x.mutateAsync({bunny_video_id:le,contact_id:Me,playback_url:ne.playbackUrl,thumbnail_url:ne.thumbnailUrl,preview_url:ne.previewUrl,duration_seconds:ne.duration,file_size_mb:ne.fileSizeMb,title:ue||"Quick Video Touch",notes:Ae,task_id:a||null,status:"ready"});me(ft.id),Ne(ft.share_token||null),Me&&await y.mutateAsync({contactId:Me,videoId:ft.id,notes:Ae}),n({title:"Video saved successfully!"}),j("share")}catch(Me){console.error("Save video error:",Me),n({title:"Failed to save video",description:(Me==null?void 0:Me.message)||"Please try again.",variant:"destructive"})}},Te=(Me,ft)=>{navigator.clipboard.writeText(ft),Ee(Me),setTimeout(()=>Ee(null),2e3),n({title:"Copied to clipboard!"})},Ze=()=>Le?`https://video.relevelup.com/${Le}`:(ne==null?void 0:ne.playbackUrl)||"",pe=()=>{const Me=p==null?void 0:p.find(nt=>nt.id===ae),ft=Me?`${Me.first_name}`:"",qe=(Me==null?void 0:Me.phone)||"",Oe=(Me==null?void 0:Me.email)||"",Qe=Ze();return{text:`Hey${ft?` ${ft}`:""}! I recorded a quick video for you: ${Qe}`,link:Qe,contactPhone:qe,contactEmail:Oe}},yt=()=>{const{text:Me,contactPhone:ft}=pe(),qe=ft?`sms:${ft}?body=${encodeURIComponent(Me)}`:`sms:?body=${encodeURIComponent(Me)}`;window.open(qe,"_self")},rt=()=>{const{link:Me,contactEmail:ft}=pe(),qe="Check out this video",Oe=`I recorded a quick video for you: ${Me}`,Qe=ft?`mailto:${ft}?subject=${encodeURIComponent(qe)}&body=${encodeURIComponent(Oe)}`:`mailto:?subject=${encodeURIComponent(qe)}&body=${encodeURIComponent(Oe)}`;window.open(Qe,"_self")};return o?r.jsx(Lr,{title:"Quick Video Touch",children:r.jsxs("div",{className:"max-w-4xl mx-auto space-y-6",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>t(-1),children:r.jsx(so,{className:"h-5 w-5"})}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold",children:"Quick Video Touch"}),r.jsx("p",{className:"text-muted-foreground",children:"Record a personal video message"})]})]}),h&&r.jsxs("div",{className:"text-right",children:[r.jsxs("p",{className:"text-sm text-warning",children:["Storage: ",i.toFixed(0),"% used"]}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[l.toFixed(0)," MB remaining"]})]})]}),b==="record"&&r.jsxs("div",{className:"grid gap-6 lg:grid-cols-3",children:[r.jsxs("div",{className:"lg:col-span-2",children:[r.jsx(iWt,{maxDurationSeconds:30,onRecordingComplete:je,onRecordingStateChange:F,className:"w-full",teleprompterContent:A&&C&&r.jsx(oWt,{text:C,isVisible:A,onToggleVisibility:()=>E(!1),isRecording:z})}),!A&&C&&r.jsxs(ee,{variant:"outline",className:"mt-4",onClick:()=>E(!0),children:[r.jsx(La,{className:"h-4 w-4 mr-2"}),"Show Teleprompter"]})]}),r.jsxs(Ye,{className:"lg:col-span-1",children:[r.jsx(Gt,{className:"pb-2",children:r.jsx(Zt,{className:"text-lg",children:"Teleprompter Script"})}),r.jsxs(tt,{className:"space-y-4",children:[r.jsx(ps,{placeholder:"Type or paste your script here...",value:C,onChange:Me=>N(Me.target.value),rows:6}),r.jsxs(Jne,{open:T,onOpenChange:L,children:[r.jsx(Rge,{asChild:!0,children:r.jsxs(ee,{variant:"outline",className:"w-full",children:[r.jsx(La,{className:"h-4 w-4 mr-2"}),"Browse Scripts"]})}),r.jsxs(NI,{side:"right",className:"w-[400px] sm:w-[540px] p-0",children:[r.jsx(ese,{className:"p-4 border-b",children:r.jsx(tse,{children:"Select a Script"})}),r.jsx(lWt,{onSelectScript:Me=>{N(Me.text),L(!1),E(!0)},className:"h-[calc(100vh-80px)]"})]})]}),C&&r.jsx(ee,{className:"w-full",onClick:()=>E(!0),children:"Use Script"})]})]})]}),b==="uploading"&&r.jsx(Ye,{className:"max-w-md mx-auto",children:r.jsxs(tt,{className:"pt-6 text-center",children:[r.jsx(uo,{className:"h-12 w-12 mx-auto mb-4 text-primary animate-pulse"}),r.jsx("h2",{className:"text-lg font-semibold mb-2",children:"Uploading Video..."}),r.jsx(Kc,{value:Z,className:"mb-2"}),r.jsxs("p",{className:"text-sm text-muted-foreground",children:[Z.toFixed(0),"%"]})]})}),b==="processing"&&r.jsx(Ye,{className:"max-w-md mx-auto",children:r.jsxs(tt,{className:"pt-6 text-center",children:[r.jsx(en,{className:"h-12 w-12 mx-auto mb-4 text-primary animate-spin"}),r.jsx("h2",{className:"text-lg font-semibold mb-2",children:"Processing Video..."}),r.jsx(Kc,{value:te,className:"mb-2"}),r.jsxs("p",{className:"text-sm text-muted-foreground",children:[te.toFixed(0),"%"]})]})}),b==="details"&&r.jsxs(Ye,{className:"max-w-lg mx-auto",children:[r.jsx(Gt,{children:r.jsx(Zt,{children:"Video Details"})}),r.jsxs(tt,{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx(He,{children:"Title"}),r.jsx(dt,{value:ue,onChange:Me=>_e(Me.target.value),placeholder:"Quick Video Touch"})]}),r.jsxs("div",{children:[r.jsx(He,{children:"Attach to Contact (Optional)"}),r.jsxs(gn,{value:ae,onValueChange:he,children:[r.jsx(fn,{children:r.jsx(xn,{placeholder:"No contact - use anywhere"})}),r.jsxs(pn,{children:[r.jsx(Vt,{value:"none",children:r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[r.jsx(Co,{className:"h-4 w-4"}),"No contact - use anywhere"]})}),p==null?void 0:p.map(Me=>r.jsx(Vt,{value:Me.id,children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ec,{className:"h-4 w-4"}),Me.first_name," ",Me.last_name]})},Me.id))]})]})]}),r.jsxs("div",{children:[r.jsx(He,{children:"Notes"}),r.jsx(ps,{value:Ae,onChange:Me=>Ce(Me.target.value),placeholder:"Add notes about this video...",rows:3})]}),r.jsxs(ee,{className:"w-full",onClick:et,disabled:x.isPending,children:[x.isPending&&r.jsx(en,{className:"h-4 w-4 mr-2 animate-spin"}),"Save Video"]})]})]}),b==="share"&&r.jsxs(Ye,{className:"max-w-lg mx-auto",children:[r.jsx(Gt,{children:r.jsxs(Zt,{className:"flex items-center gap-2",children:[r.jsx(Ai,{className:"h-5 w-5 text-green-500"}),"Video Saved!"]})}),r.jsxs(tt,{className:"space-y-4",children:[r.jsx("p",{className:"text-muted-foreground",children:"Share your video with one click:"}),r.jsxs("div",{className:"grid gap-3",children:[r.jsxs(ee,{variant:"outline",className:"justify-start",onClick:yt,children:[r.jsx(Lo,{className:"h-4 w-4 mr-2"}),"Text Contact Video"]}),r.jsxs(ee,{variant:"outline",className:"justify-start",onClick:rt,children:[r.jsx(da,{className:"h-4 w-4 mr-2"}),"Email Contact Video"]}),r.jsxs(ee,{variant:"outline",className:"justify-start",onClick:()=>Te("link",pe().link),children:[r.jsx(Co,{className:"h-4 w-4 mr-2"}),"Copy Video Link",Be==="link"&&r.jsx(Ai,{className:"h-4 w-4 ml-auto text-green-500"})]}),r.jsxs(ee,{variant:"outline",className:"justify-start",onClick:()=>Re(!0),children:[r.jsx(Fd,{className:"h-4 w-4 mr-2"}),"Send with Page Template"]})]}),r.jsxs("div",{className:"flex gap-3 pt-4",children:[r.jsx(ee,{variant:"outline",onClick:()=>t("/mission-control/video-library"),children:"View Library"}),r.jsx(ee,{onClick:()=>{j("record"),H(null),ye(null),ge(null)},children:"Record Another"})]})]})]}),be&&Le&&r.jsx(N$e,{open:Ue,onOpenChange:Re,video:{id:be,share_token:Le,title:ue||null,contact_id:ae||null,thumbnail_url:(ne==null?void 0:ne.thumbnailUrl)||null},contactName:((at=p==null?void 0:p.find(Me=>Me.id===ae))==null?void 0:at.first_name)||null})]})}):r.jsx(Lr,{title:"Quick Video Touch",children:r.jsxs("div",{className:"max-w-2xl mx-auto text-center py-12",children:[r.jsx(Vh,{className:"h-16 w-16 text-destructive mx-auto mb-4"}),r.jsx("h1",{className:"text-2xl font-bold mb-2",children:"Storage Limit Reached"}),r.jsx("p",{className:"text-muted-foreground mb-6",children:"You've reached your video storage limit. Delete videos from your library to record more."}),r.jsx(ee,{onClick:()=>t("/mission-control/video-library"),children:"Open Video Library"})]})})}function uWt({open:t,onOpenChange:e}){const{data:n}=op(),{data:s}=bye(),a=jze(),o=I.useRef(null),[l,i]=I.useState(null),[h,p]=I.useState(""),[x,y]=I.useState(""),[b,j]=I.useState(""),[C,N]=I.useState(!1),[A,E]=I.useState(0),[T,L]=I.useState("idle"),z=(s==null?void 0:s.total_storage_mb)||0,q=((s==null?void 0:s.max_storage_mb)||1024)-z,H=ie=>{var ne;const le=(ne=ie.target.files)==null?void 0:ne[0];if(!le)return;if(!le.type.startsWith("video/")){ze.error("Please select a video file");return}const ye=le.size/(1024*1024);if(ye>500){ze.error("Video file must be less than 500MB");return}if(ye>q){ze.error(`Not enough storage. You have ${q.toFixed(1)} MB remaining.`);return}i(le),h||p(le.name.replace(/\.[^/.]+$/,""))},Z=async()=>{if(!l){ze.error("Please select a video file");return}N(!0),E(0),L("creating");try{const{data:ie,error:le}=await J.functions.invoke("bunny-upload",{body:{action:"create",title:h||l.name,isAgentVideo:!0}});if(le)throw new Error(le.message);const{videoId:ye,libraryId:ne}=ie;L("uploading");const{data:ge,error:ae}=await J.functions.invoke("bunny-upload",{body:{action:"upload-url",videoId:ye,isAgentVideo:!0}});if(ae)throw new Error(ae.message);await new Promise((_e,Ae)=>{const Ce=new XMLHttpRequest;Ce.upload.addEventListener("progress",be=>{if(be.lengthComputable){const me=Math.round(be.loaded/be.total*100);E(me)}}),Ce.addEventListener("load",()=>{Ce.status>=200&&Ce.status<300?_e():Ae(new Error(`Upload failed with status ${Ce.status}`))}),Ce.addEventListener("error",()=>Ae(new Error("Upload failed"))),Ce.open("PUT",ge.uploadUrl),Ce.setRequestHeader("AccessKey",ge.apiKey),Ce.send(l)}),L("processing");const he=l.size/(1024*1024),ue=`https://iframe.mediadelivery.net/embed/${ne}/${ye}`;await a.mutateAsync({bunny_video_id:ye,playback_url:ue,file_size_mb:he,title:h||l.name,notes:x||void 0,contact_id:b||void 0,status:"processing",touch_type:"video_upload"}),ze.success("Video uploaded successfully! Processing may take a few minutes."),G()}catch(ie){console.error("Upload error:",ie),ze.error(ie instanceof Error?ie.message:"Failed to upload video")}finally{N(!1),L("idle")}},G=()=>{C||(i(null),p(""),y(""),j(""),E(0),L("idle"),e(!1))},te=()=>{switch(T){case"creating":return"Preparing upload...";case"uploading":return`Uploading... ${A}%`;case"processing":return"Saving video...";default:return""}};return r.jsx(Fr,{open:t,onOpenChange:G,children:r.jsxs(Rr,{className:"sm:max-w-md",children:[r.jsxs(qr,{children:[r.jsx($r,{children:"Upload Video"}),r.jsx(Xn,{children:"Upload a video file from your device to your video library."})]}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Video File"}),l?r.jsxs("div",{className:"flex items-center gap-3 p-3 bg-muted rounded-lg",children:[r.jsx(Pa,{className:"h-8 w-8 text-primary flex-shrink-0"}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"text-sm font-medium truncate",children:l.name}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[(l.size/(1024*1024)).toFixed(1)," MB"]})]}),!C&&r.jsx(ee,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:ie=>{ie.stopPropagation(),i(null)},children:r.jsx(_s,{className:"h-4 w-4"})})]}):r.jsxs("div",{className:"border-2 border-dashed border-muted-foreground/25 rounded-lg p-8 text-center cursor-pointer hover:border-primary/50 transition-colors",onClick:()=>{var ie;return(ie=o.current)==null?void 0:ie.click()},children:[r.jsx(uo,{className:"h-8 w-8 mx-auto text-muted-foreground mb-2"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Click to select a video file"}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"MP4, MOV, WebM (max 500MB)"})]}),r.jsx("input",{ref:o,type:"file",accept:"video/*",className:"hidden",onChange:H,disabled:C})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"title",children:"Title"}),r.jsx(dt,{id:"title",value:h,onChange:ie=>p(ie.target.value),placeholder:"Enter video title",disabled:C})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Associate with Contact (optional)"}),r.jsxs(gn,{value:b||"__none__",onValueChange:ie=>j(ie==="__none__"?"":ie),disabled:C,children:[r.jsx(fn,{children:r.jsx(xn,{placeholder:"Select a contact"})}),r.jsxs(pn,{children:[r.jsx(Vt,{value:"__none__",children:"No contact"}),n==null?void 0:n.map(ie=>r.jsxs(Vt,{value:ie.id,children:[ie.first_name," ",ie.last_name||""]},ie.id))]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"notes",children:"Notes (optional)"}),r.jsx(ps,{id:"notes",value:x,onChange:ie=>y(ie.target.value),placeholder:"Add any notes about this video",rows:2,disabled:C})]}),C&&r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[r.jsx(en,{className:"h-4 w-4 animate-spin"}),r.jsx("span",{children:te()})]}),r.jsx(Kc,{value:T==="uploading"?A:T==="processing"?100:10})]})]}),r.jsxs(ea,{children:[r.jsx(ee,{variant:"outline",onClick:G,disabled:C,children:"Cancel"}),r.jsx(ee,{onClick:Z,disabled:!l||C,children:C?r.jsxs(r.Fragment,{children:[r.jsx(en,{className:"h-4 w-4 mr-2 animate-spin"}),"Uploading..."]}):r.jsxs(r.Fragment,{children:[r.jsx(uo,{className:"h-4 w-4 mr-2"}),"Upload Video"]})})]})]})})}function hWt({previewSrc:t,thumbnailSrc:e,alt:n,isHovered:s}){const[a,o]=I.useState(!1),[l,i]=I.useState(!1),h=s&&t&&!a,p=e&&!l;return!p&&!h?r.jsx("div",{className:"w-full h-full flex items-center justify-center absolute inset-0 bg-muted",children:r.jsx(Pa,{className:"h-12 w-12 text-muted-foreground"})}):r.jsxs(r.Fragment,{children:[p&&r.jsx("img",{src:e,alt:n,loading:"lazy",className:`w-full h-full object-cover absolute inset-0 transition-opacity duration-200 ${h?"opacity-0":"opacity-100"}`,onError:()=>i(!0)}),h&&r.jsx("img",{src:t,alt:n,className:"w-full h-full object-cover absolute inset-0",onError:()=>o(!0)})]})}function fWt({video:t,previewSrc:e,thumbnailSrc:n,onOpen:s,onDelete:a,onNavigateToContact:o,onGetEmbedCode:l,onCopyEmailHtml:i,onShareWithTemplate:h,getContactName:p,getShareUrl:x,copyToClipboard:y,formatDuration:b}){const[j,C]=I.useState(!1);return r.jsxs(Ye,{className:"overflow-hidden group cursor-pointer",onClick:s,onMouseEnter:()=>C(!0),onMouseLeave:()=>C(!1),children:[r.jsxs("div",{className:"relative aspect-video bg-muted overflow-hidden",children:[r.jsx(hWt,{previewSrc:e,thumbnailSrc:n,alt:t.title||"Video preview",isHovered:j}),r.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/40 opacity-0 group-hover:opacity-100 transition-opacity",children:r.jsx("div",{className:"w-12 h-12 rounded-full bg-white/90 flex items-center justify-center",children:r.jsx(hc,{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:b(t.duration_seconds)}),t.status!=="ready"&&r.jsx(Ot,{variant:t.status==="processing"?"secondary":"destructive",className:"absolute top-2 left-2",children:t.status})]}),r.jsx(tt,{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(Ec,{className:"h-3 w-3"}),r.jsx("span",{className:"truncate",children:p(t.contact_id)})]}),r.jsxs("div",{className:"flex items-center gap-4 text-xs text-muted-foreground mt-0.5",children:[r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(Ya,{className:"h-3 w-3"}),r.jsx("span",{children:yn(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(Qo,{className:"h-3 w-3"}),r.jsxs("span",{children:[t.view_count," ",t.view_count===1?"view":"views"]})]})]})]}),r.jsxs(wh,{children:[r.jsx(jh,{asChild:!0,children:r.jsx(ee,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:N=>N.stopPropagation(),children:r.jsx(Sx,{className:"h-4 w-4"})})}),r.jsxs(Wu,{align:"end",className:"bg-popover",children:[r.jsxs(di,{onClick:N=>{N.stopPropagation(),s()},children:[r.jsx(Qo,{className:"h-4 w-4 mr-2"}),"Watch"]}),r.jsx(Fj,{}),r.jsxs(di,{onClick:N=>{N.stopPropagation(),h()},children:[r.jsx(Fd,{className:"h-4 w-4 mr-2"}),"Share with Template"]}),r.jsxs(di,{onClick:N=>{N.stopPropagation(),y(x(t),"Share link")},children:[r.jsx(Co,{className:"h-4 w-4 mr-2"}),"Copy Share Link"]}),r.jsxs(di,{onClick:N=>{N.stopPropagation(),l()},children:[r.jsx(dj,{className:"h-4 w-4 mr-2"}),"Get Embed Code"]}),r.jsxs(di,{onClick:N=>{N.stopPropagation(),i()},children:[r.jsx(da,{className:"h-4 w-4 mr-2"}),"Copy HTML for Email"]}),r.jsx(Fj,{}),t.contact_id&&r.jsxs(di,{onClick:N=>{N.stopPropagation(),o()},children:[r.jsx(Ec,{className:"h-4 w-4 mr-2"}),"View Contact"]}),r.jsxs(di,{onClick:N=>{N.stopPropagation(),a()},className:"text-destructive",children:[r.jsx(Vn,{className:"h-4 w-4 mr-2"}),"Delete"]})]})]})]})})]})}function pWt(){const t=rs(),{data:e,isLoading:n}=Ujt(),{data:s}=bye(),{data:a}=op(),o=Vjt(),[l,i]=I.useState(""),[h,p]=I.useState(null),[x,y]=I.useState(!1),[b,j]=I.useState(!1),[C,N]=I.useState(!1),[A,E]=I.useState(!1),[T,L]=I.useState(!1),[z,F]=I.useState({}),q=me=>{if(!me)return"Unassigned";const Le=a==null?void 0:a.find(Ne=>Ne.id===me);return Le?`${Le.first_name} ${Le.last_name||""}`.trim():"Unknown"},H=me=>{if(!me)return"0:00";const Le=Math.floor(me/60),Ne=me%60;return`${Le}:${Ne.toString().padStart(2,"0")}`},Z=e==null?void 0:e.filter(me=>{if(!l)return!0;const Le=q(me.contact_id).toLowerCase(),Ne=(me.title||"").toLowerCase(),Be=(me.notes||"").toLowerCase();return Le.includes(l.toLowerCase())||Ne.includes(l.toLowerCase())||Be.includes(l.toLowerCase())});I.useEffect(()=>{(async()=>{if(!(e!=null&&e.length))return;const Le=e.filter(Be=>(Be==null?void 0:Be.bunny_video_id)&&!z[Be.id]);if(!Le.length)return;const Ne=await Promise.allSettled(Le.map(async Be=>{const{data:Ee,error:Ue}=await J.functions.invoke("bunny-upload",{body:{action:"asset-urls",videoId:Be.bunny_video_id,isAgentVideo:!0}});if(Ue)throw Ue;return{id:Be.id,previewUrl:Ee==null?void 0:Ee.previewUrl,thumbnailUrl:Ee==null?void 0:Ee.thumbnailUrl}}));F(Be=>{const Ee={...Be};for(const Ue of Ne)Ue.status==="fulfilled"&&(Ee[Ue.value.id]={previewUrl:Ue.value.previewUrl,thumbnailUrl:Ue.value.thumbnailUrl});return Ee})})().catch(Le=>console.warn("Failed to load signed Bunny asset URLs",Le))},[e,z]);const G=(s==null?void 0:s.total_storage_mb)||0,te=(s==null?void 0:s.max_storage_mb)||1024,ie=G/te*100,le=ie>=80,ye=ie>=100,ne=async(me,Le)=>{await navigator.clipboard.writeText(me),ze.success(`${Le} copied to clipboard`)},ge=me=>me.share_token?`https://video.relevelup.com/${me.share_token}`:me.playback_url||"",ae=me=>{const Le=ge(me),Ne=a==null?void 0:a.find(et=>et.id===me.contact_id),Be=q(me.contact_id),Ee=Be!=="Unassigned"?Be.split(" ")[0]:"",Ue=(Ne==null?void 0:Ne.phone)||"",Re=`Hey${Ee?` ${Ee}`:""}! I recorded a quick video message for you. Check it out: ${Le}`,je=Ue?`sms:${Ue}?body=${encodeURIComponent(Re)}`:`sms:?body=${encodeURIComponent(Re)}`;window.open(je,"_self")},he=me=>{const Le=a==null?void 0:a.find(je=>je.id===me.contact_id),Ne=(Le==null?void 0:Le.email)||"",Be=ge(me),Ee="Check out this video",Ue=`I recorded a quick video for you: ${Be}`,Re=Ne?`mailto:${Ne}?subject=${encodeURIComponent(Ee)}&body=${encodeURIComponent(Ue)}`:`mailto:?subject=${encodeURIComponent(Ee)}&body=${encodeURIComponent(Ue)}`;window.open(Re,"_self")},ue=me=>{var Ee;const Le=ge(me),Ne=me.title||"Video Message",Be=me.share_token?`https://video.relevelup.com/thumb/${me.share_token}`:((Ee=z[me.id])==null?void 0:Ee.thumbnailUrl)||me.thumbnail_url||"";return``},_e=async me=>{if(!me.thumbnail_url&&!me.share_token){ze.error("Video thumbnail not available yet");return}const Le=ue(me),Ne=ge(me),Be=`Watch: ${me.title||"Video Message"} ${Ne}`;try{const Ee=new Blob([Le],{type:"text/html"}),Ue=new Blob([Be],{type:"text/plain"}),Re=new ClipboardItem({"text/html":Ee,"text/plain":Ue});await navigator.clipboard.write([Re]),ze.success("Copied! Paste into Gmail - the thumbnail will appear after sending.")}catch{await navigator.clipboard.writeText(Be+` `+Le),ze.success("Copied! Paste into your email.")}},Ae=async me=>{try{ze.loading("Preparing download...",{id:"download"});const{data:Le,error:Ne}=await J.functions.invoke("bunny-upload",{body:{action:"download-url",videoId:me.bunny_video_id,isAgentVideo:!0}});if(Ne||!(Le!=null&&Le.downloadUrl))throw new Error((Ne==null?void 0:Ne.message)||"Failed to get download URL");const Ee=`${((me.title||"video").toString().trim()||"video").replace(/[\\/:*?"<>|]+/g,"-")}.mp4`,Ue=await fetch(Le.downloadUrl);if(!Ue.ok)throw new Error("Failed to fetch video file");const Re=await Ue.blob(),je=URL.createObjectURL(Re),et=document.createElement("a");et.href=je,et.download=Ee,et.rel="noreferrer",document.body.appendChild(et),et.click(),et.remove(),URL.revokeObjectURL(je),ze.success("Download started",{id:"download"})}catch(Le){console.error("Download error:",Le),ze.error("Could not force download (your browser may block it).",{id:"download"})}},Ce=me=>{p(me),y(!0)},be=async()=>{if(h)try{await o.mutateAsync({id:h.id,bunnyVideoId:h.bunny_video_id,hardDelete:!0}),j(!1),p(null),ze.success("Video deleted successfully")}catch{ze.error("Failed to delete video")}};return r.jsx(Lr,{title:"Video Library",description:"Manage your video touches",children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-4",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold",children:"Video Library"}),r.jsx("p",{className:"text-muted-foreground",children:"Manage and share your video touches"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs(ee,{variant:"outline",onClick:()=>N(!0),children:[r.jsx(uo,{className:"h-4 w-4 mr-2"}),"Upload Video"]}),r.jsxs(ee,{onClick:()=>t("/mission-control/video/record"),children:[r.jsx(bn,{className:"h-4 w-4 mr-2"}),"Record New Video"]})]})]}),r.jsx(Ye,{className:le?"border-amber-500":ye?"border-destructive":"",children:r.jsxs(tt,{className:"py-4",children:[r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx(AT,{className:`h-5 w-5 ${ye?"text-destructive":le?"text-amber-500":"text-muted-foreground"}`}),r.jsxs("div",{className:"flex-1",children:[r.jsxs("div",{className:"flex items-center justify-between mb-1",children:[r.jsx("span",{className:"text-sm font-medium",children:"Storage Used"}),r.jsxs("span",{className:"text-sm text-muted-foreground",children:[G.toFixed(1)," MB / ",te>=1024?`${(te/1024).toFixed(0)} GB`:`${te} MB`]})]}),r.jsx(Kc,{value:Math.min(ie,100),className:`h-2 ${ye?"[&>div]:bg-destructive":le?"[&>div]:bg-amber-500":""}`})]}),le&&!ye&&r.jsxs(Ot,{variant:"outline",className:"border-amber-500 text-amber-600",children:[r.jsx(Il,{className:"h-3 w-3 mr-1"}),"Near Limit"]}),ye&&r.jsxs(Ot,{variant:"destructive",children:[r.jsx(Il,{className:"h-3 w-3 mr-1"}),"At Limit"]})]}),ye&&r.jsx("p",{className:"text-sm text-destructive mt-2",children:"You've reached your storage limit. Delete videos to record more."})]})}),r.jsxs("div",{className:"relative",children:[r.jsx(wa,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(dt,{placeholder:"Search videos by contact, title, or notes...",value:l,onChange:me=>i(me.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"})}):(Z==null?void 0:Z.length)===0?r.jsx(Ye,{children:r.jsxs(tt,{className:"py-12 text-center",children:[r.jsx(Pa,{className:"h-12 w-12 mx-auto text-muted-foreground mb-4"}),r.jsx("h3",{className:"font-semibold mb-2",children:"No videos yet"}),r.jsx("p",{className:"text-muted-foreground mb-4",children:"Record your first video touch to get started"}),r.jsxs(ee,{onClick:()=>t("/mission-control/video/record"),children:[r.jsx(bn,{className:"h-4 w-4 mr-2"}),"Record Video"]})]})}):r.jsx("div",{className:"grid sm:grid-cols-2 lg:grid-cols-3 gap-4",children:Z==null?void 0:Z.map(me=>{var Le,Ne;return r.jsx(fWt,{video:me,previewSrc:(Le=z[me.id])==null?void 0:Le.previewUrl,thumbnailSrc:(Ne=z[me.id])==null?void 0:Ne.thumbnailUrl,onOpen:()=>Ce(me),onDelete:()=>{p(me),j(!0)},onNavigateToContact:()=>t(`/mission-control/contacts/${me.contact_id}`),onGetEmbedCode:()=>{p(me),E(!0)},onCopyEmailHtml:()=>_e(me),onShareWithTemplate:()=>{p(me),L(!0)},getContactName:q,getShareUrl:ge,copyToClipboard:ne,formatDuration:H},me.id)})}),r.jsx(Fr,{open:x,onOpenChange:y,children:r.jsxs(Rr,{className:"max-w-2xl",children:[r.jsxs(qr,{children:[r.jsx($r,{children:(h==null?void 0:h.title)||"Video Preview"}),r.jsx(Xn,{children:(h==null?void 0:h.contact_id)&&r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Ec,{className:"h-3 w-3"}),q(h.contact_id)]})})]}),h&&r.jsxs("div",{className:"space-y-4",children:[r.jsx("div",{className:"relative w-full",style:{paddingBottom:"56.25%"},children:h.playback_url?(()=>{let me=h.playback_url;return me.includes("iframe.mediadelivery.net/play/")&&(me=me.replace("/play/","/embed/"),me+=(me.includes("?")?"&":"?")+"autoplay=false&responsive=true"),me.includes("iframe.mediadelivery.net")?r.jsx("iframe",{src:me,title:h.title||"Video preview",className:"absolute top-0 left-0 w-full h-full rounded-lg",style:{border:0},allow:"accelerometer; gyroscope; autoplay; encrypted-media; picture-in-picture",allowFullScreen:!0}):r.jsx("video",{src:h.playback_url,controls:!0,playsInline:!0,preload:"metadata",poster:h.thumbnail_url||void 0,className:"absolute top-0 left-0 w-full h-full rounded-lg object-cover",onError:()=>ze.error("Video preview failed to load")},h.playback_url)})():r.jsxs("div",{className:"absolute inset-0 flex items-center justify-center bg-muted rounded-lg",children:[r.jsx(Pa,{className:"h-12 w-12 text-muted-foreground"}),r.jsx("p",{className:"text-muted-foreground ml-2",children:"Video not available"})]})}),r.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[r.jsxs(ee,{variant:"outline",onClick:()=>ae(h),children:[r.jsx(Lo,{className:"h-4 w-4 mr-2"}),"Text Contact Video"]}),r.jsxs(ee,{variant:"outline",onClick:()=>he(h),children:[r.jsx(da,{className:"h-4 w-4 mr-2"}),"Email Contact Video"]}),r.jsxs(ee,{variant:"outline",onClick:()=>ne(ge(h),"Share link"),children:[r.jsx(hl,{className:"h-4 w-4 mr-2"}),"Copy Share Link"]}),r.jsxs(ee,{variant:"outline",onClick:()=>_e(h),children:[r.jsx(da,{className:"h-4 w-4 mr-2"}),"Copy HTML for Email"]}),r.jsxs(ee,{variant:"outline",onClick:()=>Ae(h),children:[r.jsx(no,{className:"h-4 w-4 mr-2"}),"Download Video"]}),r.jsxs(ee,{variant:"outline",onClick:()=>{y(!1),L(!0)},children:[r.jsx(Fd,{className:"h-4 w-4 mr-2"}),"Send with Page Template"]})]}),r.jsx("div",{className:"flex justify-end pt-2 border-t",children:r.jsxs(ee,{variant:"destructive",onClick:()=>{y(!1),j(!0)},children:[r.jsx(Vn,{className:"h-4 w-4 mr-2"}),"Delete Video"]})})]})]})}),r.jsx(Fr,{open:b,onOpenChange:j,children:r.jsxs(Rr,{children:[r.jsxs(qr,{children:[r.jsx($r,{children:"Delete Video"}),r.jsx(Xn,{children:"Are you sure you want to delete this video? This action cannot be undone."})]}),r.jsxs(ea,{children:[r.jsx(ee,{variant:"outline",onClick:()=>j(!1),children:"Cancel"}),r.jsx(ee,{variant:"destructive",onClick:be,disabled:o.isPending,children:o.isPending?"Deleting...":"Delete"})]})]})}),r.jsx(uWt,{open:C,onOpenChange:N}),r.jsx(Fr,{open:A,onOpenChange:E,children:r.jsxs(Rr,{className:"sm:max-w-lg",children:[r.jsxs(qr,{children:[r.jsx($r,{children:"Embed Video"}),r.jsx(Xn,{children:"Copy this code to embed the video on your website."})]}),h&&r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Embed Code"}),r.jsx(ps,{readOnly:!0,rows:5,value:``,className:"font-mono text-xs"})]}),r.jsx("div",{className:"flex gap-2",children:r.jsxs(ee,{className:"flex-1",onClick:()=>{const me=``;ne(me,"Embed code")},children:[r.jsx(hl,{className:"h-4 w-4 mr-2"}),"Copy Embed Code"]})}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Paste this code into your website's HTML where you want the video to appear. The video will automatically resize to fit its container."})]})]})}),h&&r.jsx(N$e,{open:T,onOpenChange:L,video:h,contactName:q(h.contact_id)})]})})}function S$e({stages:t,currentStageId:e,onStageSelect:n,disabled:s}){const[a,o]=I.useState(!1),l=t.find(h=>h.id===e),i=h=>{h.id!==e&&n(h.id,h.name),o(!1)};return r.jsxs(wh,{open:a,onOpenChange:o,children:[r.jsx(jh,{asChild:!0,children:r.jsxs(ee,{variant:"outline",size:"sm",className:"h-7 text-xs gap-1.5",disabled:s,onClick:h=>h.stopPropagation(),children:[l&&r.jsx("div",{className:"w-2 h-2 rounded-full shrink-0",style:{backgroundColor:l.color}}),r.jsx("span",{className:"max-w-[80px] truncate",children:(l==null?void 0:l.name)||"Move"}),r.jsx(Vi,{className:"h-3 w-3 shrink-0"})]})}),r.jsx(Wu,{align:"end",className:"w-48 z-50 bg-popover",onClick:h=>h.stopPropagation(),children:t.map(h=>{const p=h.icon&&mAe[h.icon]||Ru,x=h.id===e;return r.jsxs(di,{onClick:()=>i(h),className:$t("flex items-center gap-2 cursor-pointer",x&&"bg-accent"),children:[r.jsx("div",{className:"w-5 h-5 rounded flex items-center justify-center shrink-0",style:{backgroundColor:`${h.color}20`},children:r.jsx(p,{className:"h-3 w-3",style:{color:h.color}})}),r.jsx("span",{className:"flex-1",children:h.name}),x&&r.jsx(Ai,{className:"h-4 w-4 text-primary"})]},h.id)})})]})}const mWt={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"}},gWt={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 C$e({deal:t,onClick:e,isDragging:n,stages:s,onStageChange:a,showStagePicker:o=!1,isWonStage:l=!1}){var A,E;const i=f3(),h=mWt[t.deal_type],p=gWt[t.priority],x=I.useMemo(()=>t.target_close_date?qj(new Date(t.target_close_date),new Date):null,[t.target_close_date]),y=x!==null&&x<0,b=x!==null&&x<=7&&x>=0,j=l&&!t.scorecard_transaction_id,C=!!t.scorecard_transaction_id,N=T=>T?new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(T):null;return r.jsx(Ye,{className:$t("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",j&&"border-amber-300 bg-amber-50/30 dark:bg-amber-950/20"),onClick:e,children:r.jsxs(tt,{className:"p-3 space-y-2.5",children:[r.jsxs("div",{className:"flex items-start justify-between gap-2",children:[r.jsx("div",{className:"flex-1 min-w-0",children:r.jsx("h4",{className:"font-medium text-sm leading-tight line-clamp-2 group-hover:text-primary transition-colors",children:t.deal_name})}),r.jsx(Ot,{variant:"outline",className:$t("text-[10px] px-1.5 py-0 shrink-0",h.color),children:h.label})]}),t.contact&&r.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[r.jsx(Ks,{className:"h-5 w-5",children:r.jsxs(Zs,{className:"text-[10px] bg-primary/10 text-primary",children:[(A=t.contact.first_name)==null?void 0:A[0],(E=t.contact.last_name)==null?void 0:E[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(tf,{className:"h-3 w-3 text-primary shrink-0"}),r.jsx("span",{className:"text-primary truncate",children:"Linked to Listing Exchange"})]}),j&&r.jsxs("div",{className:"flex items-center gap-1.5 text-xs bg-amber-100 dark:bg-amber-900/30 text-amber-700 dark:text-amber-400 px-2 py-1 rounded",children:[r.jsx(Zi,{className:"h-3 w-3 shrink-0"}),r.jsx("span",{className:"truncate font-medium",children:"Add to Scorecard"})]}),C&&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"})]}),!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(pa,{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(hd,{className:"h-3 w-3 text-emerald-500 shrink-0"}),r.jsx("span",{className:"font-semibold text-foreground",children:N(t.expected_price)}),t.expected_commission&&r.jsxs("span",{className:"text-muted-foreground",children:["• ",N(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:$t("flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px]",p.color),children:[r.jsx("div",{className:$t("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(S$e,{stages:s,currentStageId:t.stage_id||"",onStageSelect:(T,L)=>a(t.id,T,L)}):t.target_close_date?r.jsxs("div",{className:$t("flex items-center gap-1 text-[10px]",y&&"text-red-600",b&&!y&&"text-amber-600",!y&&!b&&"text-muted-foreground"),children:[y?r.jsx(Il,{className:"h-3 w-3"}):r.jsx(zs,{className:"h-3 w-3"}),r.jsx("span",{children:y?`${Math.abs(x)}d overdue`:b?`${x}d left`:yn(new Date(t.target_close_date),"MMM d")})]}):null]})]})})}function xWt({stage:t,deals:e,onDealClick:n,onAddDeal:s,onDragStart:a,onDragOver:o,onDrop:l,isDragOver:i,isWonStage:h=!1}){const p=I.useRef(null),x=e.reduce((C,N)=>C+(N.expected_price||0),0),y=e.reduce((C,N)=>C+(N.expected_commission||0),0),b=C=>C>=1e6?`$${(C/1e6).toFixed(1)}M`:C>=1e3?`$${(C/1e3).toFixed(0)}K`:`$${C.toFixed(0)}`,j=t.icon&&mAe[t.icon]||Ru;return r.jsxs("div",{ref:p,className:$t("flex flex-col h-full min-w-[280px] max-w-[320px] bg-muted/30 rounded-xl border border-border/50 transition-all duration-200",i&&"border-primary/50 bg-primary/5 ring-2 ring-primary/20"),onDragOver:C=>o(C,t.id),onDrop:C=>l(C,t.id),children:[r.jsxs("div",{className:"p-3 border-b border-border/50 shrink-0",style:{borderTopColor:t.color,borderTopWidth:3},children:[r.jsxs("div",{className:"flex items-center justify-between mb-2",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:"w-7 h-7 rounded-lg flex items-center justify-center",style:{backgroundColor:`${t.color}20`},children:r.jsx(j,{className:"h-4 w-4",style:{color:t.color}})}),r.jsx("div",{children:r.jsx("h3",{className:"font-semibold text-sm",children:t.name})})]}),r.jsx(Ot,{variant:"secondary",className:"text-xs font-medium px-2",children:e.length})]}),x>0&&r.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[r.jsx("span",{className:"font-medium text-foreground",children:b(x)}),r.jsx("span",{children:"•"}),r.jsxs("span",{children:[b(y)," GCI"]})]})]}),r.jsx(Jo,{className:"flex-1 p-2",children:r.jsxs("div",{className:"space-y-2",children:[e.map(C=>r.jsx("div",{draggable:!0,onDragStart:N=>{N.dataTransfer.effectAllowed="move",a(C.id,t.id)},children:r.jsx(C$e,{deal:C,onClick:()=>n(C),isWonStage:h})},C.id)),e.length===0&&r.jsxs("div",{className:"py-8 px-4 text-center text-muted-foreground text-sm",children:[r.jsx("p",{className:"mb-2",children:"No deals yet"}),r.jsx("p",{className:"text-xs",children:"Drag deals here or add new"})]})]})}),r.jsx("div",{className:"p-2 border-t border-border/50 shrink-0",children:r.jsxs(ee,{variant:"ghost",size:"sm",className:"w-full justify-start text-muted-foreground hover:text-foreground",onClick:()=>s(t.id),children:[r.jsx(bn,{className:"h-4 w-4 mr-2"}),"Add Deal"]})})]})}function yWt({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:Hx,color:"text-blue-500",bgColor:"bg-blue-500/10"},{label:"Pipeline Value",value:n((t==null?void 0:t.pipelineValue)||0),icon:cc,color:"text-purple-500",bgColor:"bg-purple-500/10"},{label:"Expected GCI",value:n((t==null?void 0:t.expectedCommission)||0),icon:hd,color:"text-emerald-500",bgColor:"bg-emerald-500/10"},{label:"Won Deals",value:(t==null?void 0:t.wonDeals)||0,icon:Zi,color:"text-amber-500",bgColor:"bg-amber-500/10"}];return e?r.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:[1,2,3,4].map(a=>r.jsx(Ye,{className:"animate-pulse",children:r.jsx(tt,{className:"p-4",children:r.jsx("div",{className:"h-10 bg-muted rounded"})})},a))}):r.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:s.map(a=>r.jsx(Ye,{className:"border-border/50 hover:shadow-sm transition-shadow",children:r.jsx(tt,{className:"p-4",children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:$t("p-2 rounded-lg",a.bgColor),children:r.jsx(a.icon,{className:$t("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 vWt=[{value:"buyer",label:"Buyer"},{value:"seller",label:"Seller"},{value:"dual",label:"Dual Agency"},{value:"referral",label:"Referral"},{value:"lease",label:"Lease"}],_Wt=[{value:"low",label:"Low"},{value:"medium",label:"Medium"},{value:"high",label:"High"},{value:"urgent",label:"Urgent"}];function bWt({open:t,onOpenChange:e,deal:n,defaultStageId:s}){const{data:a}=T0e(),{data:o}=op(),{data:l}=h8e(),i=j$e(),h=k$e(),[p,x]=I.useState(""),[y,b]=I.useState(!1),j=(l==null?void 0:l.filter(z=>((n==null?void 0:n.listing_id)===z.id,!0)))||[],[C,N]=I.useState({deal_name:"",deal_type:"buyer",stage_id:"",contact_id:"",listing_id:"",property_address:"",city:"",state:"",zip_code:"",expected_price:"",commission_percentage:"3",target_close_date:void 0,contract_date:void 0,priority:"medium",probability:"50",notes:""});I.useEffect(()=>{var z,F,q;t&&(n?(N({deal_name:n.deal_name,deal_type:n.deal_type,stage_id:n.stage_id||"",contact_id:n.contact_id||"",listing_id:n.listing_id||"",property_address:n.property_address||"",city:n.city||"",state:n.state||"",zip_code:n.zip_code||"",expected_price:((z=n.expected_price)==null?void 0:z.toString())||"",commission_percentage:((F=n.commission_percentage)==null?void 0:F.toString())||"3",target_close_date:n.target_close_date?new Date(n.target_close_date):void 0,contract_date:n.contract_date?new Date(n.contract_date):void 0,priority:n.priority,probability:n.probability.toString(),notes:n.notes||""}),n.contact&&x(`${n.contact.first_name} ${n.contact.last_name}`)):(N({deal_name:"",deal_type:"buyer",stage_id:s||((q=a==null?void 0:a[0])==null?void 0:q.id)||"",contact_id:"",listing_id:"",property_address:"",city:"",state:"",zip_code:"",expected_price:"",commission_percentage:"3",target_close_date:void 0,contract_date:void 0,priority:"medium",probability:"50",notes:""}),x("")))},[t,n,s,a]);const A=o==null?void 0:o.filter(z=>{var q,H,Z;const F=p.toLowerCase();return((q=z.first_name)==null?void 0:q.toLowerCase().includes(F))||((H=z.last_name)==null?void 0:H.toLowerCase().includes(F))||((Z=z.email)==null?void 0:Z.toLowerCase().includes(F))}).slice(0,5),E=()=>{const z=parseFloat(C.expected_price)||0,F=parseFloat(C.commission_percentage)||0;return z*(F/100)},T=async z=>{var F,q;if(z.preventDefault(),!C.deal_name.trim()){ze.error("Please enter a deal name");return}try{const H={deal_name:C.deal_name,deal_type:C.deal_type,stage_id:C.stage_id||null,contact_id:C.contact_id||null,listing_id:C.listing_id||null,property_address:C.property_address||null,city:C.city||null,state:C.state||null,zip_code:C.zip_code||null,expected_price:C.expected_price?parseFloat(C.expected_price):null,expected_commission:E()||null,commission_percentage:C.commission_percentage?parseFloat(C.commission_percentage):3,target_close_date:((F=C.target_close_date)==null?void 0:F.toISOString().split("T")[0])||null,contract_date:((q=C.contract_date)==null?void 0:q.toISOString().split("T")[0])||null,priority:C.priority,probability:parseInt(C.probability)||50,notes:C.notes||null};n?(await h.mutateAsync({id:n.id,...H}),ze.success("Deal updated successfully")):(await i.mutateAsync(H),ze.success("Deal created successfully")),e(!1)}catch{ze.error("Failed to save deal")}},L=i.isPending||h.isPending;return r.jsx(Fr,{open:t,onOpenChange:e,children:r.jsxs(Rr,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsxs(qr,{children:[r.jsx($r,{children:n?"Edit Deal":"Add New Deal"}),r.jsx(Xn,{children:n?"Update the deal details below.":"Enter the details for your new deal."})]}),r.jsxs("form",{onSubmit:T,className:"space-y-6",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"col-span-2 space-y-2",children:[r.jsx(He,{htmlFor:"deal_name",children:"Deal Name *"}),r.jsx(dt,{id:"deal_name",value:C.deal_name,onChange:z=>N(F=>({...F,deal_name:z.target.value})),placeholder:"e.g., Smith Family - 123 Main St"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Deal Type"}),r.jsxs(gn,{value:C.deal_type,onValueChange:z=>N(F=>({...F,deal_type:z})),children:[r.jsx(fn,{children:r.jsx(xn,{})}),r.jsx(pn,{children:vWt.map(z=>r.jsx(Vt,{value:z.value,children:z.label},z.value))})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Stage"}),r.jsxs(gn,{value:C.stage_id,onValueChange:z=>N(F=>({...F,stage_id:z})),children:[r.jsx(fn,{children:r.jsx(xn,{placeholder:"Select stage"})}),r.jsx(pn,{children:a==null?void 0:a.map(z=>r.jsx(Vt,{value:z.id,children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:z.color}}),z.name]})},z.id))})]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Link to Contact"}),r.jsxs("div",{className:"relative",children:[r.jsx(wa,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(dt,{value:p,onChange:z=>{x(z.target.value),b(!0),z.target.value||N(F=>({...F,contact_id:""}))},onFocus:()=>b(!0),placeholder:"Search contacts...",className:"pl-9"}),y&&p&&A&&A.length>0&&r.jsx("div",{className:"absolute z-10 w-full mt-1 bg-background border rounded-lg shadow-lg max-h-48 overflow-y-auto",children:A.map(z=>r.jsxs("button",{type:"button",className:"w-full px-3 py-2 text-left hover:bg-muted flex items-center gap-2",onClick:()=>{N(F=>({...F,contact_id:z.id})),x(`${z.first_name} ${z.last_name}`),b(!1)},children:[r.jsx(Ec,{className:"h-4 w-4 text-muted-foreground"}),r.jsxs("span",{children:[z.first_name," ",z.last_name]}),z.email&&r.jsx("span",{className:"text-xs text-muted-foreground ml-auto",children:z.email})]},z.id))})]})]}),j.length>0&&r.jsxs("div",{className:"space-y-2",children:[r.jsxs(He,{className:"flex items-center gap-2",children:[r.jsx(tf,{className:"h-4 w-4"}),"Link to Listing Exchange"]}),r.jsxs(gn,{value:C.listing_id,onValueChange:z=>{const F=j.find(q=>q.id===z);N(F?q=>{var H;return{...q,listing_id:z,deal_type:"seller",property_address:F.property_address||q.property_address,city:F.city||q.city,state:F.state||q.state,expected_price:((H=F.price)==null?void 0:H.toString())||q.expected_price}}:q=>({...q,listing_id:z}))},children:[r.jsx(fn,{children:r.jsx(xn,{placeholder:"Select a listing to sync status..."})}),r.jsxs(pn,{children:[r.jsx(Vt,{value:"",children:"None"}),j.map(z=>r.jsx(Vt,{value:z.id,children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{children:z.property_address||`${z.city}, ${z.state}`}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:["$",(z.price/1e3).toFixed(0),"K"]})]})},z.id))]})]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Status changes will sync automatically between the deal and listing."})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsx("h4",{className:"font-medium text-sm",children:"Property Details"}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"col-span-2 space-y-2",children:[r.jsx(He,{htmlFor:"property_address",children:"Address"}),r.jsx(dt,{id:"property_address",value:C.property_address,onChange:z=>N(F=>({...F,property_address:z.target.value})),placeholder:"123 Main Street"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"city",children:"City"}),r.jsx(dt,{id:"city",value:C.city,onChange:z=>N(F=>({...F,city:z.target.value}))})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"state",children:"State"}),r.jsx(dt,{id:"state",value:C.state,onChange:z=>N(F=>({...F,state:z.target.value})),maxLength:2,placeholder:"TX"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"zip_code",children:"ZIP"}),r.jsx(dt,{id:"zip_code",value:C.zip_code,onChange:z=>N(F=>({...F,zip_code:z.target.value}))})]})]})]})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsx("h4",{className:"font-medium text-sm",children:"Financial Details"}),r.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"expected_price",children:"Expected Price"}),r.jsxs("div",{className:"relative",children:[r.jsx("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 text-muted-foreground",children:"$"}),r.jsx(dt,{id:"expected_price",type:"number",value:C.expected_price,onChange:z=>N(F=>({...F,expected_price:z.target.value})),className:"pl-7",placeholder:"500000"})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"commission_percentage",children:"Commission %"}),r.jsxs("div",{className:"relative",children:[r.jsx(dt,{id:"commission_percentage",type:"number",step:"0.1",value:C.commission_percentage,onChange:z=>N(F=>({...F,commission_percentage:z.target.value})),className:"pr-7"}),r.jsx("span",{className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground",children:"%"})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Expected GCI"}),r.jsx(dt,{value:E()?`$${E().toLocaleString()}`:"-",disabled:!0,className:"bg-muted"})]})]})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsx("h4",{className:"font-medium text-sm",children:"Dates & Status"}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Target Close Date"}),r.jsxs(zu,{children:[r.jsx(Bu,{asChild:!0,children:r.jsxs(ee,{variant:"outline",className:$t("w-full justify-start text-left font-normal",!C.target_close_date&&"text-muted-foreground"),children:[r.jsx(zs,{className:"mr-2 h-4 w-4"}),C.target_close_date?yn(C.target_close_date,"PPP"):"Pick a date"]})}),r.jsx(uu,{className:"w-auto p-0",align:"start",children:r.jsx(Z1,{mode:"single",selected:C.target_close_date,onSelect:z=>N(F=>({...F,target_close_date:z})),initialFocus:!0,className:"pointer-events-auto"})})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Contract Date"}),r.jsxs(zu,{children:[r.jsx(Bu,{asChild:!0,children:r.jsxs(ee,{variant:"outline",className:$t("w-full justify-start text-left font-normal",!C.contract_date&&"text-muted-foreground"),children:[r.jsx(zs,{className:"mr-2 h-4 w-4"}),C.contract_date?yn(C.contract_date,"PPP"):"Pick a date"]})}),r.jsx(uu,{className:"w-auto p-0",align:"start",children:r.jsx(Z1,{mode:"single",selected:C.contract_date,onSelect:z=>N(F=>({...F,contract_date:z})),initialFocus:!0,className:"pointer-events-auto"})})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Priority"}),r.jsxs(gn,{value:C.priority,onValueChange:z=>N(F=>({...F,priority:z})),children:[r.jsx(fn,{children:r.jsx(xn,{})}),r.jsx(pn,{children:_Wt.map(z=>r.jsx(Vt,{value:z.value,children:z.label},z.value))})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Win Probability"}),r.jsxs("div",{className:"relative",children:[r.jsx(dt,{type:"number",min:"0",max:"100",value:C.probability,onChange:z=>N(F=>({...F,probability:z.target.value})),className:"pr-7"}),r.jsx("span",{className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground",children:"%"})]})]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"notes",children:"Notes"}),r.jsx(ps,{id:"notes",value:C.notes,onChange:z=>N(F=>({...F,notes:z.target.value})),placeholder:"Add any additional notes about this deal...",rows:3})]}),r.jsxs("div",{className:"flex justify-end gap-3 pt-4 border-t",children:[r.jsx(ee,{type:"button",variant:"outline",onClick:()=>e(!1),children:"Cancel"}),r.jsxs(ee,{type:"submit",disabled:L,children:[L&&r.jsx(en,{className:"h-4 w-4 mr-2 animate-spin"}),n?"Update Deal":"Create Deal"]})]})]})]})})}const wWt={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"}},jWt={note:Lo,call:bi,email:da,meeting:zs,stage_change:Fs,task_completed:Xi,document:pa,system:Ya};function kWt({deal:t,open:e,onOpenChange:n,onEdit:s,onAddToScorecard:a,isWonStage:o}){var le,ye;const{data:l,isLoading:i}=VHt((t==null?void 0:t.id)||""),{data:h,isLoading:p}=WHt((t==null?void 0:t.id)||""),x=HHt(),y=KHt(),b=GHt(),j=qHt(),[C,N]=I.useState(""),[A,E]=I.useState(""),[T,L]=I.useState(!1);if(!t)return null;const z=wWt[t.deal_type],F=ne=>ne?new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(ne):"-",q=async()=>{if(C.trim())try{await x.mutateAsync({deal_id:t.id,activity_type:"note",title:"Note added",description:C}),N(""),ze.success("Note added")}catch{ze.error("Failed to add note")}},H=async()=>{if(A.trim())try{await y.mutateAsync({deal_id:t.id,title:A,sort_order:((h==null?void 0:h.length)||0)+1}),E(""),ze.success("Task added")}catch{ze.error("Failed to add task")}},Z=async(ne,ge)=>{try{await b.mutateAsync({id:ne,is_completed:ge,deal_id:t.id})}catch{ze.error("Failed to update task")}},G=async()=>{try{await j.mutateAsync(t.id),ze.success("Deal deleted"),n(!1)}catch{ze.error("Failed to delete deal")}},te=(h==null?void 0:h.filter(ne=>ne.is_completed).length)||0,ie=(h==null?void 0:h.length)||0;return r.jsxs(r.Fragment,{children:[r.jsx(Jne,{open:e,onOpenChange:n,children:r.jsxs(NI,{className:"w-full sm:max-w-xl p-0 flex flex-col",children:[r.jsx(ese,{className:"p-6 pb-4 border-b shrink-0",children:r.jsxs("div",{className:"flex items-start justify-between",children:[r.jsxs("div",{className:"flex-1",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[r.jsx(Ot,{variant:"outline",className:$t("text-xs",z.color),children:z.label}),r.jsxs(Ot,{variant:"secondary",className:"text-xs capitalize",children:[t.priority," priority"]})]}),r.jsx(tse,{className:"text-xl",children:t.deal_name})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(ee,{variant:"outline",size:"icon",onClick:()=>s(t),children:r.jsx(ac,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"outline",size:"icon",className:"text-destructive hover:bg-destructive/10",onClick:()=>L(!0),children:r.jsx(Vn,{className:"h-4 w-4"})})]})]})}),r.jsx(Jo,{className:"flex-1",children:r.jsxs("div",{className:"p-6 space-y-6",children:[t.contact&&r.jsxs("div",{className:"flex items-center gap-3 p-3 bg-muted/50 rounded-lg",children:[r.jsx(Ks,{className:"h-10 w-10",children:r.jsxs(Zs,{className:"bg-primary/10 text-primary",children:[(le=t.contact.first_name)==null?void 0:le[0],(ye=t.contact.last_name)==null?void 0:ye[0]]})}),r.jsxs("div",{className:"flex-1",children:[r.jsxs("p",{className:"font-medium",children:[t.contact.first_name," ",t.contact.last_name]}),t.contact.email&&r.jsx("p",{className:"text-sm text-muted-foreground",children:t.contact.email})]}),r.jsxs("div",{className:"flex gap-2",children:[t.contact.phone&&r.jsx(ee,{variant:"outline",size:"icon",asChild:!0,children:r.jsx("a",{href:`tel:${t.contact.phone}`,children:r.jsx(bi,{className:"h-4 w-4"})})}),t.contact.email&&r.jsx(ee,{variant:"outline",size:"icon",asChild:!0,children:r.jsx("a",{href:`mailto:${t.contact.email}`,children:r.jsx(da,{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(pa,{className:"h-4 w-4 text-muted-foreground mt-0.5"}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:t.property_address||"Address TBD"}),r.jsx("p",{className:"text-muted-foreground",children:[t.city,t.state,t.zip_code].filter(Boolean).join(", ")})]})]}),r.jsxs("div",{className:"bg-muted/50 rounded-lg p-3",children:[r.jsx("p",{className:"text-xs text-muted-foreground mb-1",children:"Expected Price"}),r.jsx("p",{className:"text-lg font-bold",children:F(t.expected_price)})]}),r.jsxs("div",{className:"bg-emerald-500/10 rounded-lg p-3",children:[r.jsx("p",{className:"text-xs text-muted-foreground mb-1",children:"Expected GCI"}),r.jsx("p",{className:"text-lg font-bold text-emerald-600",children:F(t.expected_commission)})]}),o&&!t.scorecard_transaction_id&&a&&r.jsxs(ee,{onClick:()=>a(t),className:"w-full bg-green-600 hover:bg-green-700",children:[r.jsx(Zi,{className:"h-4 w-4 mr-2"}),"Add to Scorecard"]}),t.scorecard_transaction_id&&r.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground bg-muted/50 rounded-lg p-3",children:[r.jsx(Xi,{className:"h-4 w-4 text-green-600"}),r.jsx("span",{children:"Synced to Scorecard"})]}),t.target_close_date&&r.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[r.jsx(zs,{className:"h-4 w-4 text-muted-foreground"}),r.jsxs("span",{children:["Close: ",yn(new Date(t.target_close_date),"MMM d, yyyy")]})]}),r.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[r.jsx(hd,{className:"h-4 w-4 text-muted-foreground"}),r.jsxs("span",{children:[t.probability,"% probability"]})]})]}),t.notes&&r.jsxs("div",{className:"text-sm",children:[r.jsx("p",{className:"font-medium mb-1",children:"Notes"}),r.jsx("p",{className:"text-muted-foreground",children:t.notes})]}),r.jsxs(Ii,{defaultValue:"tasks",className:"w-full",children:[r.jsxs(wi,{className:"w-full grid grid-cols-2",children:[r.jsxs(ln,{value:"tasks",className:"gap-1",children:[r.jsx(Xi,{className:"h-4 w-4"}),"Tasks ",ie>0&&`(${te}/${ie})`]}),r.jsxs(ln,{value:"activity",className:"gap-1",children:[r.jsx(Ya,{className:"h-4 w-4"}),"Activity"]})]}),r.jsxs(An,{value:"tasks",className:"mt-4 space-y-3",children:[r.jsxs("div",{className:"flex gap-2",children:[r.jsx(dt,{placeholder:"Add a new task...",value:A,onChange:ne=>E(ne.target.value),onKeyDown:ne=>ne.key==="Enter"&&H()}),r.jsx(ee,{onClick:H,disabled:!A.trim(),children:r.jsx(bn,{className:"h-4 w-4"})})]}),r.jsxs("div",{className:"space-y-2",children:[h==null?void 0:h.map(ne=>r.jsxs("div",{className:$t("flex items-center gap-3 p-3 rounded-lg border transition-colors",ne.is_completed?"bg-muted/50 border-border":"bg-background"),children:[r.jsx(Dl,{checked:ne.is_completed,onCheckedChange:ge=>Z(ne.id,!!ge)}),r.jsx("span",{className:$t("flex-1 text-sm",ne.is_completed&&"line-through text-muted-foreground"),children:ne.title}),ne.due_date&&r.jsx("span",{className:"text-xs text-muted-foreground",children:yn(new Date(ne.due_date),"MMM d")})]},ne.id)),(h==null?void 0:h.length)===0&&r.jsx("p",{className:"text-center text-muted-foreground text-sm py-4",children:"No tasks yet. Add one above!"})]})]}),r.jsxs(An,{value:"activity",className:"mt-4 space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(ps,{placeholder:"Add a note...",value:C,onChange:ne=>N(ne.target.value),rows:2}),r.jsxs(ee,{onClick:q,disabled:!C.trim(),size:"sm",className:"w-full",children:[r.jsx(Oo,{className:"h-4 w-4 mr-2"}),"Add Note"]})]}),r.jsxs("div",{className:"space-y-3",children:[l==null?void 0:l.map(ne=>{const ge=jWt[ne.activity_type]||Ya;return r.jsxs("div",{className:"flex gap-3",children:[r.jsx("div",{className:"w-8 h-8 rounded-full bg-muted flex items-center justify-center shrink-0",children:r.jsx(ge,{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:ne.title}),ne.description&&r.jsx("p",{className:"text-sm text-muted-foreground mt-0.5",children:ne.description}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:cu(new Date(ne.created_at),{addSuffix:!0})})]})]},ne.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(Iu,{open:T,onOpenChange:L,children:r.jsxs(tu,{children:[r.jsxs(ru,{children:[r.jsx(su,{children:"Delete Deal?"}),r.jsxs(au,{children:['This will permanently delete "',t.deal_name,'" and all associated data. This action cannot be undone.']})]}),r.jsxs(nu,{children:[r.jsx(iu,{children:"Cancel"}),r.jsx(Ld,{onClick:G,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})})]})}function NWt({open:t,onOpenChange:e,deal:n,onComplete:s}){const a=_se(),o=k$e(),{data:l}=vse(),{data:i}=Sm(),[h,p]=I.useState({property_address:"",city:"",state:"",zip:"",transaction_type:"buyer",close_date:yn(new Date,"yyyy-MM-dd"),sale_price:0,commission_amount:0,lead_source_id:"",client_type_id:"",notes:""});I.useEffect(()=>{if(n&&t){const b=n.deal_type==="seller"?"seller":"buyer",j=n.expected_price||0,C=n.commission_percentage||3,N=n.expected_commission||j*C/100;p({property_address:n.property_address||n.deal_name||"",city:n.city||"",state:n.state||"",zip:n.zip_code||"",transaction_type:b,close_date:n.actual_close_date||n.target_close_date||yn(new Date,"yyyy-MM-dd"),sale_price:j,commission_amount:N,lead_source_id:"",client_type_id:"",notes:n.notes||""})}},[n,t]);const x=async b=>{if(b.preventDefault(),!!n)try{const j=await a.mutateAsync({property_address:h.property_address,city:h.city||null,state:h.state||null,zip:h.zip||null,transaction_type:h.transaction_type,close_date:h.close_date,sale_price:h.sale_price,commission_amount:h.commission_amount||null,lead_source_id:h.lead_source_id||null,client_type_id:h.client_type_id||null,contact_id:n.contact_id||null,notes:h.notes||null,is_win:!0});await o.mutateAsync({id:n.id,scorecard_transaction_id:j.id,actual_close_date:h.close_date}),ze.success("Deal added to Scorecard! 🎉"),e(!1),s==null||s()}catch(j){console.error("Error syncing to scorecard:",j),ze.error("Failed to add to scorecard")}},y=b=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:0,maximumFractionDigits:0}).format(b);return r.jsx(Fr,{open:t,onOpenChange:e,children:r.jsxs(Rr,{className:"sm:max-w-[550px] max-h-[90vh] overflow-y-auto",children:[r.jsxs(qr,{className:"space-y-3",children:[r.jsx("div",{className:"mx-auto flex h-12 w-12 items-center justify-center rounded-full bg-green-100 dark:bg-green-900/20",children:r.jsx(Zi,{className:"h-6 w-6 text-green-600 dark:text-green-400"})}),r.jsx($r,{className:"text-center text-xl",children:"Congratulations on Closing! 🎉"}),r.jsx(Xn,{className:"text-center",children:"Review and confirm the details before adding this deal to your Scorecard."})]}),r.jsxs("form",{onSubmit:x,className:"space-y-4 mt-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsxs(He,{htmlFor:"property_address",className:"flex items-center gap-2",children:[r.jsx(pa,{className:"h-4 w-4 text-muted-foreground"}),"Property Address *"]}),r.jsx(dt,{id:"property_address",value:h.property_address,onChange:b=>p(j=>({...j,property_address:b.target.value})),placeholder:"123 Main St",required:!0})]}),r.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"city",children:"City"}),r.jsx(dt,{id:"city",value:h.city,onChange:b=>p(j=>({...j,city:b.target.value})),placeholder:"City"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"state",children:"State"}),r.jsx(dt,{id:"state",value:h.state,onChange:b=>p(j=>({...j,state:b.target.value})),placeholder:"TX",maxLength:2})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"zip",children:"Zip"}),r.jsx(dt,{id:"zip",value:h.zip,onChange:b=>p(j=>({...j,zip:b.target.value})),placeholder:"75001"})]})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Transaction Type *"}),r.jsxs(gn,{value:h.transaction_type,onValueChange:b=>p(j=>({...j,transaction_type:b})),children:[r.jsx(fn,{children:r.jsx(xn,{})}),r.jsxs(pn,{children:[r.jsx(Vt,{value:"buyer",children:"Buyer"}),r.jsx(Vt,{value:"seller",children:"Seller"})]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs(He,{htmlFor:"close_date",className:"flex items-center gap-2",children:[r.jsx(zs,{className:"h-4 w-4 text-muted-foreground"}),"Close Date *"]}),r.jsx(dt,{id:"close_date",type:"date",value:h.close_date,onChange:b=>p(j=>({...j,close_date:b.target.value})),required:!0})]})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsxs(He,{htmlFor:"sale_price",className:"flex items-center gap-2",children:[r.jsx(hd,{className:"h-4 w-4 text-muted-foreground"}),"Sale Price *"]}),r.jsx(dt,{id:"sale_price",type:"number",value:h.sale_price||"",onChange:b=>p(j=>({...j,sale_price:Number(b.target.value)})),placeholder:"450000",required:!0,min:0}),h.sale_price>0&&r.jsx("p",{className:"text-xs text-muted-foreground",children:y(h.sale_price)})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs(He,{htmlFor:"commission_amount",className:"flex items-center gap-2",children:[r.jsx(hS,{className:"h-4 w-4 text-muted-foreground"}),"GCI (Commission)"]}),r.jsx(dt,{id:"commission_amount",type:"number",value:h.commission_amount||"",onChange:b=>p(j=>({...j,commission_amount:Number(b.target.value)})),placeholder:"13500",min:0}),h.commission_amount>0&&r.jsx("p",{className:"text-xs text-muted-foreground",children:y(h.commission_amount)})]})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Lead Source"}),r.jsxs(gn,{value:h.lead_source_id,onValueChange:b=>p(j=>({...j,lead_source_id:b})),children:[r.jsx(fn,{children:r.jsx(xn,{placeholder:"Select source"})}),r.jsx(pn,{children:l==null?void 0:l.map(b=>r.jsx(Vt,{value:b.id,children:b.name},b.id))})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Client Type"}),r.jsxs(gn,{value:h.client_type_id,onValueChange:b=>p(j=>({...j,client_type_id:b})),children:[r.jsx(fn,{children:r.jsx(xn,{placeholder:"Select type"})}),r.jsx(pn,{children:i==null?void 0:i.map(b=>r.jsx(Vt,{value:b.id,children:b.name},b.id))})]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"notes",children:"Notes"}),r.jsx(ps,{id:"notes",value:h.notes,onChange:b=>p(j=>({...j,notes:b.target.value})),placeholder:"Any additional notes about this transaction...",rows:2})]}),r.jsxs(ea,{className:"gap-2 sm:gap-0 pt-4",children:[r.jsx(ee,{type:"button",variant:"outline",onClick:()=>e(!1),children:"Skip for now"}),r.jsx(ee,{type:"submit",disabled:a.isPending||o.isPending,className:"bg-green-600 hover:bg-green-700",children:a.isPending?"Adding...":r.jsxs(r.Fragment,{children:["Add to Scorecard",r.jsx(dl,{className:"ml-2 h-4 w-4"})]})})]})]})]})})}const SWt={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"}},f5e={urgent:0,high:1,medium:2,low:3};function CWt({deals:t,stages:e,onDealClick:n,onStageChange:s}){const[a,o]=I.useState("target_close_date"),[l,i]=I.useState("asc"),h=j=>{a===j?i(C=>C==="asc"?"desc":"asc"):(o(j),i("asc"))},p=I.useMemo(()=>[...t].sort((j,C)=>{var A,E;let N=0;switch(a){case"deal_name":N=j.deal_name.localeCompare(C.deal_name);break;case"stage":{const T=((A=e.find(z=>z.id===j.stage_id))==null?void 0:A.sort_order)||0,L=((E=e.find(z=>z.id===C.stage_id))==null?void 0:E.sort_order)||0;N=T-L;break}case"expected_price":N=(j.expected_price||0)-(C.expected_price||0);break;case"expected_commission":N=(j.expected_commission||0)-(C.expected_commission||0);break;case"target_close_date":{const T=j.target_close_date?new Date(j.target_close_date).getTime():1/0,L=C.target_close_date?new Date(C.target_close_date).getTime():1/0;N=T-L;break}case"priority":N=f5e[j.priority]-f5e[C.priority];break}return l==="asc"?N:-N}),[t,e,a,l]),x=j=>j?new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(j):"—",y=j=>j?e.find(C=>C.id===j):null,b=({field:j,children:C})=>r.jsxs(ee,{variant:"ghost",size:"sm",className:"h-8 -ml-3 font-medium",onClick:()=>h(j),children:[C,a===j?l==="asc"?r.jsx(mg,{className:"ml-2 h-4 w-4"}):r.jsx(i1,{className:"ml-2 h-4 w-4"}):r.jsx(zx,{className:"ml-2 h-4 w-4 opacity-50"})]});return t.length===0?r.jsx("div",{className:"text-center py-16",children:r.jsx("p",{className:"text-muted-foreground",children:"No deals to display"})}):r.jsx("div",{className:"border rounded-lg overflow-hidden",children:r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Ar,{className:"bg-muted/50",children:[r.jsx(It,{className:"w-[250px]",children:r.jsx(b,{field:"deal_name",children:"Deal Name"})}),r.jsx(It,{className:"w-[150px]",children:r.jsx(b,{field:"stage",children:"Stage"})}),r.jsx(It,{className:"w-[100px]",children:"Type"}),r.jsx(It,{className:"w-[120px]",children:r.jsx(b,{field:"expected_price",children:"Price"})}),r.jsx(It,{className:"w-[120px]",children:r.jsx(b,{field:"expected_commission",children:"GCI"})}),r.jsx(It,{className:"w-[130px]",children:r.jsx(b,{field:"target_close_date",children:"Close Date"})}),r.jsx(It,{className:"w-[100px]",children:r.jsx(b,{field:"priority",children:"Priority"})})]})}),r.jsx(Vs,{children:p.map(j=>{y(j.stage_id);const C=SWt[j.deal_type],N=j.target_close_date?qj(new Date(j.target_close_date),new Date):null,A=N!==null&&N<0,E=N!==null&&N<=7&&N>=0;return r.jsxs(Ar,{className:$t("cursor-pointer hover:bg-muted/50 transition-colors",A&&"bg-red-50/50"),onClick:()=>n(j),children:[r.jsx(Nt,{className:"font-medium",children:r.jsxs("div",{children:[r.jsx("p",{className:"truncate max-w-[230px]",children:j.deal_name}),j.contact&&r.jsxs("p",{className:"text-xs text-muted-foreground truncate",children:[j.contact.first_name," ",j.contact.last_name]})]})}),r.jsx(Nt,{onClick:T=>T.stopPropagation(),children:r.jsx(S$e,{stages:e,currentStageId:j.stage_id||"",onStageSelect:(T,L)=>s(j.id,T,L)})}),r.jsx(Nt,{children:r.jsx(Ot,{variant:"outline",className:$t("text-xs",C.color),children:C.label})}),r.jsx(Nt,{children:r.jsx("span",{className:"font-medium",children:x(j.expected_price)})}),r.jsx(Nt,{children:r.jsx("span",{className:"text-emerald-600",children:x(j.expected_commission)})}),r.jsx(Nt,{children:j.target_close_date?r.jsxs("div",{className:$t("flex items-center gap-1 text-sm",A&&"text-red-600",E&&!A&&"text-amber-600"),children:[A&&r.jsx(Il,{className:"h-3.5 w-3.5"}),r.jsx("span",{children:yn(new Date(j.target_close_date),"MMM d, yyyy")})]}):r.jsx("span",{className:"text-muted-foreground",children:"—"})}),r.jsx(Nt,{children:r.jsx(Ot,{variant:"outline",className:$t("text-xs capitalize",j.priority==="urgent"&&"border-red-200 bg-red-50 text-red-700",j.priority==="high"&&"border-orange-200 bg-orange-50 text-orange-700",j.priority==="medium"&&"border-amber-200 bg-amber-50 text-amber-700",j.priority==="low"&&"border-slate-200 bg-slate-50 text-slate-600"),children:j.priority})})]},j.id)})})]})})}function MWt(){var be;const t=f3(),{data:e,isLoading:n}=T0e(),{data:s,isLoading:a,refetch:o}=w$e(),{data:l,isLoading:i}=ZHt(),h=b$e(),p=UHt(),[x,y]=I.useState("board"),[b,j]=I.useState(!1),[C,N]=I.useState(!1),[A,E]=I.useState(null),[T,L]=I.useState(null),[z,F]=I.useState(null),[q,H]=I.useState(null),[Z,G]=I.useState(!1),[te,ie]=I.useState(null);I.useEffect(()=>{!n&&e&&e.length===0&&h.mutate()},[n,e]);const le=me=>{E(me),N(!0)},ye=me=>{L(me||null),E(null),j(!0)},ne=me=>{E(me),N(!1),j(!0)},ge=(me,Le)=>{F(me)},ae=(me,Le)=>{me.preventDefault(),me.dataTransfer.dropEffect="move",H(Le)},he=async(me,Le)=>{if(me.preventDefault(),H(null),!z)return;const Ne=s==null?void 0:s.find(Ee=>Ee.id===z),Be=e==null?void 0:e.find(Ee=>Ee.id===Le);if(!Ne||!Be||Ne.stage_id===Le){F(null);return}try{if(await p.mutateAsync({dealId:z,stageId:Le,stageName:Be.name}),ze.success(`Moved to ${Be.name}`),Be.is_won_stage&&!Ne.scorecard_transaction_id){const Ee={...Ne,stage_id:Le};ie(Ee),G(!0)}}catch{ze.error("Failed to move deal")}F(null)},ue=I.useCallback(async(me,Le,Ne)=>{const Be=s==null?void 0:s.find(Ue=>Ue.id===me),Ee=e==null?void 0:e.find(Ue=>Ue.id===Le);if(!(!Be||!Ee||Be.stage_id===Le))try{if(await p.mutateAsync({dealId:me,stageId:Le,stageName:Ne}),ze.success(`Moved to ${Ne}`),Ee.is_won_stage&&!Be.scorecard_transaction_id){const Ue={...Be,stage_id:Le};ie(Ue),G(!0)}}catch{ze.error("Failed to move deal")}},[s,e,p]),_e=me=>(s==null?void 0:s.filter(Le=>Le.stage_id===me))||[],Ae=n||a,Ce=t?"list":x;return r.jsxs(Lr,{children:[r.jsxs("div",{className:"flex flex-col h-[calc(100vh-4rem)]",children:[r.jsxs("div",{className:"shrink-0 p-4 md:p-6 pb-0 space-y-4",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold",children:"Deal Pipeline"}),r.jsx("p",{className:"text-muted-foreground text-sm",children:"Track and manage your active deals"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(ee,{variant:"outline",size:"icon",onClick:()=>o(),className:"shrink-0",children:r.jsx(Gl,{className:"h-4 w-4"})}),!t&&r.jsx(mI,{children:r.jsxs("div",{className:"flex bg-muted rounded-lg p-1 gap-0.5",children:[r.jsxs(Sg,{children:[r.jsx(Cg,{asChild:!0,children:r.jsxs(ee,{variant:x==="board"?"secondary":"ghost",size:"sm",onClick:()=>y("board"),className:"px-3 gap-1.5",children:[r.jsx(pm,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline text-xs",children:"Board"})]})}),r.jsx(xm,{children:"Kanban board view"})]}),r.jsxs(Sg,{children:[r.jsx(Cg,{asChild:!0,children:r.jsxs(ee,{variant:x==="list"?"secondary":"ghost",size:"sm",onClick:()=>y("list"),className:"px-3 gap-1.5",children:[r.jsx(Kf,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline text-xs",children:"List"})]})}),r.jsx(xm,{children:"Grouped list view"})]}),r.jsxs(Sg,{children:[r.jsx(Cg,{asChild:!0,children:r.jsxs(ee,{variant:x==="table"?"secondary":"ghost",size:"sm",onClick:()=>y("table"),className:"px-3 gap-1.5",children:[r.jsx(ZT,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline text-xs",children:"Table"})]})}),r.jsx(xm,{children:"Sortable table view"})]})]})}),r.jsxs(ee,{onClick:()=>ye(),children:[r.jsx(bn,{className:"h-4 w-4 mr-2"}),"Add Deal"]})]})]}),r.jsx(yWt,{stats:l||null,isLoading:i})]}),r.jsx("div",{className:"flex-1 min-h-0 p-4 md:p-6 pt-4",children:Ae?r.jsx("div",{className:"flex gap-4 h-full",children:[1,2,3,4].map(me=>r.jsx("div",{className:"min-w-[280px] max-w-[320px] flex-shrink-0",children:r.jsx(Ir,{className:"h-full rounded-xl"})},me))}):Ce==="board"?r.jsxs(Jo,{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(me=>r.jsx(xWt,{stage:me,deals:_e(me.id),onDealClick:le,onAddDeal:ye,onDragStart:ge,onDragOver:ae,onDrop:he,isDragOver:q===me.id,isWonStage:me.is_won_stage},me.id))}),r.jsx(Uge,{orientation:"horizontal"})]}):Ce==="table"?r.jsx(Jo,{className:"h-full",children:r.jsx(CWt,{deals:s||[],stages:e||[],onDealClick:le,onStageChange:ue})}):r.jsx(Jo,{className:"h-full",children:r.jsxs("div",{className:"space-y-6",children:[e==null?void 0:e.map(me=>{const Le=_e(me.id);return Le.length===0?null:r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[r.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:me.color}}),r.jsx("h3",{className:"font-semibold",children:me.name}),r.jsxs("span",{className:"text-muted-foreground text-sm",children:["(",Le.length,")"]})]}),r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-3",children:Le.map(Ne=>r.jsx(C$e,{deal:Ne,onClick:()=>le(Ne),stages:e,onStageChange:ue,showStagePicker:!0,isWonStage:me.is_won_stage},Ne.id))})]},me.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(pm,{className:"h-8 w-8 text-muted-foreground"})}),r.jsx("h3",{className:"font-semibold text-lg mb-2",children:"No deals yet"}),r.jsx("p",{className:"text-muted-foreground mb-4",children:"Start tracking your opportunities by adding your first deal"}),r.jsxs(ee,{onClick:()=>ye(),children:[r.jsx(bn,{className:"h-4 w-4 mr-2"}),"Add Your First Deal"]})]})]})})})]}),r.jsx(bWt,{open:b,onOpenChange:j,deal:A,defaultStageId:T}),r.jsx(kWt,{deal:A,open:C,onOpenChange:N,onEdit:ne,isWonStage:A?(be=e==null?void 0:e.find(me=>me.id===A.stage_id))==null?void 0:be.is_won_stage:!1,onAddToScorecard:me=>{ie(me),G(!0),N(!1)}}),r.jsx(NWt,{open:Z,onOpenChange:G,deal:te,onComplete:()=>{o(),ie(null)}})]})}const Ope=[{value:"video_intro",label:"Video Intro",icon:Pa,description:"Add an intro video"},{value:"testimonials",label:"Testimonials",icon:RT,description:"Client testimonials carousel"},{value:"specialties",label:"Specialties",icon:jg,description:"Tags for your specialties"},{value:"custom_links",label:"Custom Links",icon:tf,description:"Custom CTA buttons"},{value:"social_media",label:"Social Media",icon:fc,description:"Links to your social profiles"}],TWt=["First-Time Buyers","Luxury Homes","Investment Properties","Relocation","New Construction","Condos & Townhomes","Waterfront","Commercial","Land & Lots","Senior Living","Military/VA","Short Sales & Foreclosures"],AWt={video_intro:{video_url:""},testimonials:{testimonials:[{name:"",quote:"",role:""}]},specialties:{tags:[]},custom_links:{links:[{label:"",url:""}]},social_media:{platforms:[]}};function M$e({cardId:t}){const{data:e,isLoading:n}=Pit(t),s=Lit(),a=Oit(),o=Dit(),[l,i]=I.useState(!1),[h,p]=I.useState(""),[x,y]=I.useState(null);if(n)return r.jsxs("div",{className:"space-y-3",children:[r.jsx(Ir,{className:"h-16 w-full"}),r.jsx(Ir,{className:"h-16 w-full"})]});const b=()=>{h&&s.mutate({card_id:t,block_type:h,sort_order:(e==null?void 0:e.length)||0,config:AWt[h]||{}},{onSuccess:()=>{i(!1),p("")}})},j=T=>{a.mutate({id:T.id,is_visible:!T.is_visible})},C=(T,L)=>{if(!e)return;const z=e.findIndex(H=>H.id===T.id),F=L==="up"?z-1:z+1;if(F<0||F>=e.length)return;const q=e[F];a.mutate({id:T.id,sort_order:q.sort_order}),a.mutate({id:q.id,sort_order:T.sort_order})},N=T=>{confirm("Remove this block from this card?")&&o.mutate(T.id)},A=(T,L)=>{a.mutate({id:T.id,config:L},{onSuccess:()=>y(null)})},E=T=>Ope.find(L=>L.value===T);return r.jsxs("div",{className:"space-y-3",children:[!e||e.length===0?r.jsxs("div",{className:"text-center py-8",children:[r.jsx("p",{className:"text-muted-foreground mb-4 text-sm",children:"No blocks yet. Add a block to customize this card."}),r.jsxs(ee,{size:"sm",onClick:()=>i(!0),children:[r.jsx(bn,{className:"h-4 w-4 mr-1"})," Add Block"]})]}):r.jsxs(r.Fragment,{children:[e.map((T,L)=>{const z=E(T.block_type),F=(z==null?void 0:z.icon)||jg;return r.jsx(Ye,{className:T.is_visible?"":"opacity-50",children:r.jsx(tt,{className:"p-3",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(x1,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),r.jsx(F,{className:"h-4 w-4 text-primary flex-shrink-0"}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"font-medium text-xs",children:(z==null?void 0:z.label)||T.block_type}),r.jsx("p",{className:"text-xs text-muted-foreground truncate",children:EWt(T)})]}),r.jsxs("div",{className:"flex items-center gap-0.5",children:[r.jsx(ee,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>C(T,"up"),disabled:L===0,children:r.jsx(mg,{className:"h-3 w-3"})}),r.jsx(ee,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>C(T,"down"),disabled:L===e.length-1,children:r.jsx(i1,{className:"h-3 w-3"})}),r.jsx(ee,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>j(T),children:T.is_visible?r.jsx(Qo,{className:"h-3 w-3"}):r.jsx(h1,{className:"h-3 w-3"})}),r.jsx(ee,{variant:"ghost",size:"sm",className:"h-7 text-xs",onClick:()=>y(T),children:"Edit"}),r.jsx(ee,{variant:"ghost",size:"icon",className:"h-7 w-7 text-destructive",onClick:()=>N(T),children:r.jsx(Vn,{className:"h-3 w-3"})})]})]})})},T.id)}),r.jsxs(ee,{variant:"outline",size:"sm",className:"w-full",onClick:()=>i(!0),children:[r.jsx(bn,{className:"h-4 w-4 mr-1"})," Add Block"]})]}),r.jsx(Fr,{open:l,onOpenChange:i,children:r.jsxs(Rr,{children:[r.jsx(qr,{children:r.jsx($r,{children:"Add Block"})}),r.jsx("div",{className:"grid gap-3",children:Ope.map(T=>{const L=T.icon;return r.jsxs("button",{onClick:()=>p(T.value),className:`flex items-center gap-3 p-3 rounded-lg border text-left transition-colors ${h===T.value?"border-primary bg-primary/5":"border-border hover:bg-muted"}`,children:[r.jsx(L,{className:"h-5 w-5 text-primary flex-shrink-0"}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium text-sm",children:T.label}),r.jsx("p",{className:"text-xs text-muted-foreground",children:T.description})]})]},T.value)})}),r.jsxs(ea,{children:[r.jsx(ee,{variant:"outline",onClick:()=>i(!1),children:"Cancel"}),r.jsx(ee,{onClick:b,disabled:!h||s.isPending,children:"Add Block"})]})]})}),x&&r.jsx(IWt,{block:x,onSave:T=>A(x,T),onClose:()=>y(null)})]})}function EWt(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 IWt({block:t,onSave:e,onClose:n}){const[s,a]=I.useState(t.config),o=Ope.find(l=>l.value===t.block_type);return r.jsx(Fr,{open:!0,onOpenChange:n,children:r.jsxs(Rr,{className:"max-w-lg max-h-[80vh] overflow-y-auto",children:[r.jsx(qr,{children:r.jsxs($r,{children:["Edit ",o==null?void 0:o.label]})}),t.block_type==="video_intro"&&r.jsx(PWt,{config:s,onChange:a,cardId:t.card_id}),t.block_type==="testimonials"&&r.jsx(LWt,{config:s,onChange:a}),t.block_type==="specialties"&&r.jsx(OWt,{config:s,onChange:a}),t.block_type==="custom_links"&&r.jsx(DWt,{config:s,onChange:a}),t.block_type==="social_media"&&r.jsx(RWt,{config:s,onChange:a}),r.jsxs(ea,{children:[r.jsx(ee,{variant:"outline",onClick:n,children:"Cancel"}),r.jsx(ee,{onClick:()=>e(s),children:"Save"})]})]})})}function PWt({config:t,onChange:e,cardId:n}){var j,C;const[s,a]=I.useState(""),[o,l]=I.useState((j=t.video_url)!=null&&j.includes("youtube")||(C=t.video_url)!=null&&C.includes("youtu.be")?"youtube":"library"),{data:i}=Yt({queryKey:["card-owner",n],queryFn:async()=>{const{data:N}=await J.from("agent_cards").select("user_id").eq("id",n).single();return N==null?void 0:N.user_id},enabled:!!n}),{data:h,isLoading:p}=Yt({queryKey:["agent-videos-library",i],queryFn:async()=>{const{data:N,error:A}=await J.from("agent_videos").select("id, title, bunny_video_id, thumbnail_url, playback_url, created_at").eq("owner_user_id",i).eq("is_deleted",!1).eq("status","ready").order("created_at",{ascending:!1});if(A)throw A;return N||[]},enabled:!!i}),x=(h==null?void 0:h.filter(N=>!s||(N.title||"").toLowerCase().includes(s.toLowerCase())))||[],y=t.bunny_video_id,b=N=>{var L;const A=(L=N.playback_url)==null?void 0:L.match(/\/(?:play|embed)\/(\d+)\//),T=`https://iframe.mediadelivery.net/embed/${A?A[1]:"570924"}/${N.bunny_video_id}?autoplay=false&responsive=true`;e({...t,video_url:T,bunny_video_id:N.bunny_video_id,video_source:"library"})};return r.jsx("div",{className:"space-y-4",children:r.jsxs(Ii,{value:o,onValueChange:l,children:[r.jsxs(wi,{className:"w-full",children:[r.jsx(ln,{value:"library",className:"flex-1",children:"Video Library"}),r.jsx(ln,{value:"youtube",className:"flex-1",children:"YouTube URL"})]}),r.jsxs(An,{value:"library",className:"space-y-3 mt-3",children:[r.jsxs("div",{className:"relative",children:[r.jsx(wa,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(dt,{placeholder:"Search videos...",value:s,onChange:N=>a(N.target.value),className:"pl-9"})]}),r.jsx(Jo,{className:"h-[240px]",children:p?r.jsxs("div",{className:"space-y-2",children:[r.jsx(Ir,{className:"h-14 w-full"}),r.jsx(Ir,{className:"h-14 w-full"})]}):x.length===0?r.jsx("p",{className:"text-sm text-muted-foreground text-center py-8",children:(h==null?void 0:h.length)===0?"No videos in library yet":"No matching videos"}):r.jsx("div",{className:"space-y-1.5 pr-3",children:x.map(N=>r.jsxs("button",{onClick:()=>b(N),className:`w-full flex items-center gap-3 p-2 rounded-lg border text-left transition-colors ${y===N.bunny_video_id?"border-primary bg-primary/5":"border-border hover:bg-muted"}`,children:[N.thumbnail_url?r.jsx("img",{src:N.thumbnail_url,alt:"",className:"h-10 w-16 rounded object-cover flex-shrink-0 bg-muted",onError:A=>{var E;A.currentTarget.style.display="none",(E=A.currentTarget.nextElementSibling)==null||E.classList.remove("hidden")}}):null,r.jsx("div",{className:`h-10 w-16 rounded bg-muted flex items-center justify-center flex-shrink-0 ${N.thumbnail_url?"hidden":""}`,children:r.jsx(Pa,{className:"h-4 w-4 text-muted-foreground"})}),r.jsx("span",{className:"text-sm font-medium truncate flex-1",children:N.title||"Untitled Video"}),y===N.bunny_video_id&&r.jsx(Ai,{className:"h-4 w-4 text-primary flex-shrink-0"})]},N.id))})})]}),r.jsx(An,{value:"youtube",className:"space-y-3 mt-3",children:r.jsxs("div",{children:[r.jsx(He,{children:"YouTube URL"}),r.jsx(dt,{placeholder:"https://www.youtube.com/watch?v=...",value:t.video_source==="youtube"&&t.video_url||"",onChange:N=>e({...t,video_url:N.target.value,bunny_video_id:null,video_source:"youtube"})}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Paste a YouTube video link"})]})})]})})}function LWt({config:t,onChange:e}){const n=t.testimonials||[],s=(l,i,h)=>{const p=[...n];p[l]={...p[l],[i]:h},e({...t,testimonials:p})},a=()=>e({...t,testimonials:[...n,{name:"",quote:"",role:""}]}),o=l=>e({...t,testimonials:n.filter((i,h)=>h!==l)});return r.jsxs("div",{className:"space-y-4",children:[n.map((l,i)=>r.jsx(Ye,{children:r.jsxs(tt,{className:"p-3 space-y-2",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs(He,{className:"text-xs font-medium",children:["Testimonial ",i+1]}),n.length>1&&r.jsx(ee,{variant:"ghost",size:"icon",className:"h-6 w-6 text-destructive",onClick:()=>o(i),children:r.jsx(Vn,{className:"h-3 w-3"})})]}),r.jsx(dt,{placeholder:"Client name",value:l.name,onChange:h=>s(i,"name",h.target.value)}),r.jsx(dt,{placeholder:"Role/title (optional)",value:l.role||"",onChange:h=>s(i,"role",h.target.value)}),r.jsx("textarea",{className:"w-full min-h-[60px] rounded-md border border-input bg-background px-3 py-2 text-sm",placeholder:"Their testimonial quote...",value:l.quote,onChange:h=>s(i,"quote",h.target.value)})]})},i)),r.jsxs(ee,{variant:"outline",size:"sm",onClick:a,className:"w-full",children:[r.jsx(bn,{className:"h-4 w-4 mr-1"})," Add Testimonial"]})]})}function OWt({config:t,onChange:e}){const n=t.tags||[],[s,a]=I.useState(""),o=i=>{e({...t,tags:n.includes(i)?n.filter(h=>h!==i):[...n,i]})},l=()=>{s.trim()&&!n.includes(s.trim())&&(e({...t,tags:[...n,s.trim()]}),a(""))};return r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx(He,{className:"text-sm mb-2 block",children:"Preset Specialties"}),r.jsx("div",{className:"flex flex-wrap gap-2",children:TWt.map(i=>r.jsx("button",{onClick:()=>o(i),className:`px-3 py-1.5 text-xs rounded-full border transition-colors ${n.includes(i)?"bg-primary text-primary-foreground border-primary":"bg-muted border-border hover:bg-muted/80"}`,children:i},i))})]}),r.jsxs("div",{children:[r.jsx(He,{className:"text-sm mb-2 block",children:"Custom Tag"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(dt,{placeholder:"Add your own...",value:s,onChange:i=>a(i.target.value),onKeyDown:i=>i.key==="Enter"&&(i.preventDefault(),l())}),r.jsx(ee,{variant:"outline",size:"sm",onClick:l,children:"Add"})]})]}),n.length>0&&r.jsxs("div",{children:[r.jsxs(He,{className:"text-xs text-muted-foreground mb-1 block",children:["Selected (",n.length,")"]}),r.jsx("div",{className:"flex flex-wrap gap-1.5",children:n.map(i=>r.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-1 text-xs bg-primary/10 text-primary rounded-full",children:[i,r.jsx("button",{onClick:()=>o(i),className:"hover:text-destructive",children:"×"})]},i))})]})]})}function DWt({config:t,onChange:e}){const n=t.links||[],s=(l,i,h)=>{const p=[...n];p[l]={...p[l],[i]:h},e({...t,links:p})},a=()=>e({...t,links:[...n,{label:"",url:""}]}),o=l=>e({...t,links:n.filter((i,h)=>h!==l)});return r.jsxs("div",{className:"space-y-3",children:[n.map((l,i)=>r.jsxs("div",{className:"flex items-start gap-2",children:[r.jsxs("div",{className:"flex-1 space-y-2",children:[r.jsx(dt,{placeholder:"Button label",value:l.label,onChange:h=>s(i,"label",h.target.value)}),r.jsx(dt,{placeholder:"https://...",value:l.url,onChange:h=>s(i,"url",h.target.value)})]}),n.length>1&&r.jsx(ee,{variant:"ghost",size:"icon",className:"h-8 w-8 mt-1 text-destructive",onClick:()=>o(i),children:r.jsx(Vn,{className:"h-3 w-3"})})]},i)),r.jsxs(ee,{variant:"outline",size:"sm",onClick:a,className:"w-full",children:[r.jsx(bn,{className:"h-4 w-4 mr-1"})," Add Link"]})]})}const p5e=[{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 RWt({config:t,onChange:e}){const n=t.platforms||[],s=h=>{n.find(p=>p.platform===h)||e({...t,platforms:[...n,{platform:h,url:""}]})},a=(h,p)=>{const x=[...n];x[h]={...x[h],url:p},e({...t,platforms:x})},o=h=>{e({...t,platforms:n.filter((p,x)=>x!==h)})},l=p5e.filter(h=>!n.find(p=>p.platform===h.value)),i=h=>{const p=ihe[h],x=p5e.find(y=>y.value===h);return{label:(x==null?void 0:x.label)||h,color:(p==null?void 0:p.color)||"#666",iconPath:p==null?void 0:p.icon}};return r.jsxs("div",{className:"space-y-4",children:[n.length>0&&r.jsx("div",{className:"space-y-3",children:n.map((h,p)=>{const x=i(h.platform);return r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:"h-9 w-9 rounded-lg flex items-center justify-center flex-shrink-0 border",style:{borderColor:x.color+"30",backgroundColor:x.color+"10"},children:x.iconPath&&r.jsx("svg",{viewBox:"0 0 24 24",width:16,height:16,fill:x.color,children:r.jsx("path",{d:x.iconPath})})}),r.jsx("div",{className:"flex-1",children:r.jsx(dt,{placeholder:`Your ${x.label} profile URL`,value:h.url,onChange:y=>a(p,y.target.value)})}),r.jsx(ee,{variant:"ghost",size:"icon",className:"h-8 w-8 text-destructive flex-shrink-0",onClick:()=>o(p),children:r.jsx(Vn,{className:"h-3.5 w-3.5"})})]},p)})}),l.length>0&&r.jsxs("div",{children:[r.jsx(He,{className:"text-xs text-muted-foreground mb-2 block",children:"Add a platform"}),r.jsx("div",{className:"flex flex-wrap gap-2",children:l.map(h=>{const p=ihe[h.value];return r.jsxs("button",{onClick:()=>s(h.value),className:"inline-flex items-center gap-1.5 px-3 py-1.5 text-xs rounded-full border border-border bg-muted hover:bg-muted/80 transition-colors",children:[(p==null?void 0:p.icon)&&r.jsx("svg",{viewBox:"0 0 24 24",width:12,height:12,fill:p.color,children:r.jsx("path",{d:p.icon})}),h.label]},h.value)})})]}),n.length===0&&r.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:"Tap a platform above to add your social media profile."})]})}var FWt=Object.defineProperty,one=Object.getOwnPropertySymbols,T$e=Object.prototype.hasOwnProperty,A$e=Object.prototype.propertyIsEnumerable,m5e=(t,e,n)=>e in t?FWt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Dpe=(t,e)=>{for(var n in e||(e={}))T$e.call(e,n)&&m5e(t,n,e[n]);if(one)for(var n of one(e))A$e.call(e,n)&&m5e(t,n,e[n]);return t},Rpe=(t,e)=>{var n={};for(var s in t)T$e.call(t,s)&&e.indexOf(s)<0&&(n[s]=t[s]);if(t!=null&&one)for(var s of one(t))e.indexOf(s)<0&&A$e.call(t,s)&&(n[s]=t[s]);return n};/** * @license QR Code generator library (TypeScript) * Copyright (c) Project Nayuki. * SPDX-License-Identifier: MIT */var rk;(t=>{const e=class Mi{constructor(h,p,x,y){if(this.version=h,this.errorCorrectionLevel=p,this.modules=[],this.isFunction=[],hMi.MAX_VERSION)throw new RangeError("Version value out of range");if(y<-1||y>7)throw new RangeError("Mask value out of range");this.size=h*4+17;let b=[];for(let C=0;C7)throw new RangeError("Invalid value");let C,N;for(C=x;;C++){const L=Mi.getNumDataCodewords(C,p)*8,z=l.getTotalBits(h,C);if(z<=L){N=z;break}if(C>=y)throw new RangeError("Data too long")}for(const L of[Mi.Ecc.MEDIUM,Mi.Ecc.QUARTILE,Mi.Ecc.HIGH])j&&N<=Mi.getNumDataCodewords(C,L)*8&&(p=L);let A=[];for(const L of h){n(L.mode.modeBits,4,A),n(L.numChars,L.mode.numCharCountBits(C),A);for(const z of L.getData())A.push(z)}a(A.length==N);const E=Mi.getNumDataCodewords(C,p)*8;a(A.length<=E),n(0,Math.min(4,E-A.length),A),n(0,(8-A.length%8)%8,A),a(A.length%8==0);for(let L=236;A.lengthT[z>>>3]|=L<<7-(z&7)),new Mi(C,p,T,b)}getModule(h,p){return 0<=h&&h>>9)*1335;const y=(p<<10|x)^21522;a(y>>>15==0);for(let b=0;b<=5;b++)this.setFunctionModule(8,b,s(y,b));this.setFunctionModule(8,7,s(y,6)),this.setFunctionModule(8,8,s(y,7)),this.setFunctionModule(7,8,s(y,8));for(let b=9;b<15;b++)this.setFunctionModule(14-b,8,s(y,b));for(let b=0;b<8;b++)this.setFunctionModule(this.size-1-b,8,s(y,b));for(let b=8;b<15;b++)this.setFunctionModule(8,this.size-15+b,s(y,b));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let h=this.version;for(let x=0;x<12;x++)h=h<<1^(h>>>11)*7973;const p=this.version<<12|h;a(p>>>18==0);for(let x=0;x<18;x++){const y=s(p,x),b=this.size-11+x%3,j=Math.floor(x/3);this.setFunctionModule(b,j,y),this.setFunctionModule(j,b,y)}}drawFinderPattern(h,p){for(let x=-4;x<=4;x++)for(let y=-4;y<=4;y++){const b=Math.max(Math.abs(y),Math.abs(x)),j=h+y,C=p+x;0<=j&&j{(L!=N-b||F>=C)&&T.push(z[L])});return a(T.length==j),T}drawCodewords(h){if(h.length!=Math.floor(Mi.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");let p=0;for(let x=this.size-1;x>=1;x-=2){x==6&&(x=5);for(let y=0;y>>3],7-(p&7)),p++)}}a(p==h.length*8)}applyMask(h){if(h<0||h>7)throw new RangeError("Mask value out of range");for(let p=0;p5&&h++):(this.finderPenaltyAddHistory(C,N),j||(h+=this.finderPenaltyCountPatterns(N)*Mi.PENALTY_N3),j=this.modules[b][A],C=1);h+=this.finderPenaltyTerminateAndCount(j,C,N)*Mi.PENALTY_N3}for(let b=0;b5&&h++):(this.finderPenaltyAddHistory(C,N),j||(h+=this.finderPenaltyCountPatterns(N)*Mi.PENALTY_N3),j=this.modules[A][b],C=1);h+=this.finderPenaltyTerminateAndCount(j,C,N)*Mi.PENALTY_N3}for(let b=0;bj+(C?1:0),p);const x=this.size*this.size,y=Math.ceil(Math.abs(p*20-x*10)/x)-1;return a(0<=y&&y<=9),h+=y*Mi.PENALTY_N4,a(0<=h&&h<=2568888),h}getAlignmentPatternPositions(){if(this.version==1)return[];{const h=Math.floor(this.version/7)+2,p=this.version==32?26:Math.ceil((this.version*4+4)/(h*2-2))*2;let x=[6];for(let y=this.size-7;x.lengthMi.MAX_VERSION)throw new RangeError("Version number out of range");let p=(16*h+128)*h+64;if(h>=2){const x=Math.floor(h/7)+2;p-=(25*x-10)*x-55,h>=7&&(p-=36)}return a(208<=p&&p<=29648),p}static getNumDataCodewords(h,p){return Math.floor(Mi.getNumRawDataModules(h)/8)-Mi.ECC_CODEWORDS_PER_BLOCK[p.ordinal][h]*Mi.NUM_ERROR_CORRECTION_BLOCKS[p.ordinal][h]}static reedSolomonComputeDivisor(h){if(h<1||h>255)throw new RangeError("Degree out of range");let p=[];for(let y=0;y0);for(const y of h){const b=y^x.shift();x.push(0),p.forEach((j,C)=>x[C]^=Mi.reedSolomonMultiply(j,b))}return x}static reedSolomonMultiply(h,p){if(h>>>8||p>>>8)throw new RangeError("Byte out of range");let x=0;for(let y=7;y>=0;y--)x=x<<1^(x>>>7)*285,x^=(p>>>y&1)*h;return a(x>>>8==0),x}finderPenaltyCountPatterns(h){const p=h[1];a(p<=this.size*3);const x=p>0&&h[2]==p&&h[3]==p*3&&h[4]==p&&h[5]==p;return(x&&h[0]>=p*4&&h[6]>=p?1:0)+(x&&h[6]>=p*4&&h[0]>=p?1:0)}finderPenaltyTerminateAndCount(h,p,x){return h&&(this.finderPenaltyAddHistory(p,x),p=0),p+=this.size,this.finderPenaltyAddHistory(p,x),this.finderPenaltyCountPatterns(x)}finderPenaltyAddHistory(h,p){p[0]==0&&(h+=this.size),p.pop(),p.unshift(h)}};e.MIN_VERSION=1,e.MAX_VERSION=40,e.PENALTY_N1=3,e.PENALTY_N2=3,e.PENALTY_N3=40,e.PENALTY_N4=10,e.ECC_CODEWORDS_PER_BLOCK=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],e.NUM_ERROR_CORRECTION_BLOCKS=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],t.QrCode=e;function n(i,h,p){if(h<0||h>31||i>>>h)throw new RangeError("Value out of range");for(let x=h-1;x>=0;x--)p.push(i>>>x&1)}function s(i,h){return(i>>>h&1)!=0}function a(i){if(!i)throw new Error("Assertion error")}const o=class Vl{constructor(h,p,x){if(this.mode=h,this.numChars=p,this.bitData=x,p<0)throw new RangeError("Invalid argument");this.bitData=x.slice()}static makeBytes(h){let p=[];for(const x of h)n(x,8,p);return new Vl(Vl.Mode.BYTE,h.length,p)}static makeNumeric(h){if(!Vl.isNumeric(h))throw new RangeError("String contains non-numeric characters");let p=[];for(let x=0;x=1<{(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={}))})(rk||(rk={}));(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={}))})(rk||(rk={}));var q4=rk;/** * @license qrcode.react * Copyright (c) Paul O'Shannessy * SPDX-License-Identifier: ISC */var zWt={L:q4.QrCode.Ecc.LOW,M:q4.QrCode.Ecc.MEDIUM,Q:q4.QrCode.Ecc.QUARTILE,H:q4.QrCode.Ecc.HIGH},E$e=128,I$e="L",P$e="#FFFFFF",L$e="#000000",O$e=!1,D$e=1,BWt=4,$Wt=0,UWt=.1;function R$e(t,e=0){const n=[];return t.forEach(function(s,a){let o=null;s.forEach(function(l,i){if(!l&&o!==null){n.push(`M${o+e} ${a+e}h${i-o}v1H${o+e}z`),o=null;return}if(i===s.length-1){if(!l)return;o===null?n.push(`M${i+e},${a+e} h1v1H${i+e}z`):n.push(`M${o+e},${a+e} h${i+1-o}v1H${o+e}z`);return}l&&o===null&&(o=i)})}),n.join("")}function F$e(t,e){return t.slice().map((n,s)=>s=e.y+e.h?n:n.map((a,o)=>o=e.x+e.w?a:!1))}function qWt(t,e,n,s){if(s==null)return null;const a=t.length+n*2,o=Math.floor(e*UWt),l=a/e,i=(s.width||o)*l,h=(s.height||o)*l,p=s.x==null?t.length/2-i/2:s.x*l,x=s.y==null?t.length/2-h/2:s.y*l,y=s.opacity==null?1:s.opacity;let b=null;if(s.excavate){let C=Math.floor(p),N=Math.floor(x),A=Math.ceil(i+p-C),E=Math.ceil(h+x-N);b={x:C,y:N,w:A,h:E}}const j=s.crossOrigin;return{x:p,y:x,h,w:i,excavation:b,opacity:y,crossOrigin:j}}function VWt(t,e){return e!=null?Math.max(Math.floor(e),0):t?BWt:$Wt}function z$e({value:t,level:e,minVersion:n,includeMargin:s,marginSize:a,imageSettings:o,size:l,boostLevel:i}){let h=st.useMemo(()=>{const C=(Array.isArray(t)?t:[t]).reduce((N,A)=>(N.push(...q4.QrSegment.makeSegments(A)),N),[]);return q4.QrCode.encodeSegments(C,zWt[e],n,void 0,void 0,i)},[t,e,n,i]);const{cells:p,margin:x,numCells:y,calculatedImageSettings:b}=st.useMemo(()=>{let j=h.getModules();const C=VWt(s,a),N=j.length+C*2,A=qWt(j,l,C,o);return{cells:j,margin:C,numCells:N,calculatedImageSettings:A}},[h,l,o,s,a]);return{qrcode:h,margin:x,cells:p,numCells:y,calculatedImageSettings:b}}var HWt=function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0}(),WWt=st.forwardRef(function(e,n){const s=e,{value:a,size:o=E$e,level:l=I$e,bgColor:i=P$e,fgColor:h=L$e,includeMargin:p=O$e,minVersion:x=D$e,boostLevel:y,marginSize:b,imageSettings:j}=s,N=Rpe(s,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","marginSize","imageSettings"]),{style:A}=N,E=Rpe(N,["style"]),T=j==null?void 0:j.src,L=st.useRef(null),z=st.useRef(null),F=st.useCallback(ne=>{L.current=ne,typeof n=="function"?n(ne):n&&(n.current=ne)},[n]),[q,H]=st.useState(!1),{margin:Z,cells:G,numCells:te,calculatedImageSettings:ie}=z$e({value:a,level:l,minVersion:x,boostLevel:y,includeMargin:p,marginSize:b,imageSettings:j,size:o});st.useEffect(()=>{if(L.current!=null){const ne=L.current,ge=ne.getContext("2d");if(!ge)return;let ae=G;const he=z.current,ue=ie!=null&&he!==null&&he.complete&&he.naturalHeight!==0&&he.naturalWidth!==0;ue&&ie.excavation!=null&&(ae=F$e(G,ie.excavation));const _e=window.devicePixelRatio||1;ne.height=ne.width=o*_e;const Ae=o/te*_e;ge.scale(Ae,Ae),ge.fillStyle=i,ge.fillRect(0,0,te,te),ge.fillStyle=h,HWt?ge.fill(new Path2D(R$e(ae,Z))):G.forEach(function(Ce,be){Ce.forEach(function(me,Le){me&&ge.fillRect(Le+Z,be+Z,1,1)})}),ie&&(ge.globalAlpha=ie.opacity),ue&&ge.drawImage(he,ie.x+Z,ie.y+Z,ie.w,ie.h)}}),st.useEffect(()=>{H(!1)},[T]);const le=Dpe({height:o,width:o},A);let ye=null;return T!=null&&(ye=st.createElement("img",{src:T,key:T,style:{display:"none"},onLoad:()=>{H(!0)},ref:z,crossOrigin:ie==null?void 0:ie.crossOrigin})),st.createElement(st.Fragment,null,st.createElement("canvas",Dpe({style:le,height:o,width:o,ref:F,role:"img"},E)),ye)});WWt.displayName="QRCodeCanvas";var B$e=st.forwardRef(function(e,n){const s=e,{value:a,size:o=E$e,level:l=I$e,bgColor:i=P$e,fgColor:h=L$e,includeMargin:p=O$e,minVersion:x=D$e,boostLevel:y,title:b,marginSize:j,imageSettings:C}=s,N=Rpe(s,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","title","marginSize","imageSettings"]),{margin:A,cells:E,numCells:T,calculatedImageSettings:L}=z$e({value:a,level:l,minVersion:x,boostLevel:y,includeMargin:p,marginSize:j,imageSettings:C,size:o});let z=E,F=null;C!=null&&L!=null&&(L.excavation!=null&&(z=F$e(E,L.excavation)),F=st.createElement("image",{href:C.src,height:L.h,width:L.w,x:L.x+A,y:L.y+A,preserveAspectRatio:"none",opacity:L.opacity,crossOrigin:L.crossOrigin}));const q=R$e(z,A);return st.createElement("svg",Dpe({height:o,width:o,viewBox:`0 0 ${T} ${T}`,ref:n,role:"img"},N),!!b&&st.createElement("title",null,b),st.createElement("path",{fill:i,d:`M0,0 h${T}v${T}H0z`,shapeRendering:"crispEdges"}),st.createElement("path",{fill:h,d:q,shapeRendering:"crispEdges"}),F)});B$e.displayName="QRCodeSVG";function GWt({slug:t,agentName:e}){const n=I.useRef(null),s=`https://cards.relevelup.com/${t}`,a=I.useCallback(()=>{var y;const o=(y=n.current)==null?void 0:y.querySelector("svg");if(!o)return;const l=document.createElement("canvas"),i=1024;l.width=i,l.height=i;const h=l.getContext("2d");if(!h)return;const p=new XMLSerializer().serializeToString(o),x=new Image;x.onload=()=>{h.fillStyle="#ffffff",h.fillRect(0,0,i,i),h.drawImage(x,0,0,i,i);const b=document.createElement("a");b.download=`${t}-qr-code.png`,b.href=l.toDataURL("image/png"),b.click(),ze.success("QR code downloaded!")},x.src="data:image/svg+xml;base64,"+btoa(unescape(encodeURIComponent(p)))},[t]);return r.jsxs("div",{className:"space-y-3",children:[r.jsx(He,{className:"text-sm font-medium",children:"QR Code"}),r.jsxs("div",{className:"flex items-start gap-4",children:[r.jsx("div",{ref:n,className:"bg-white p-3 rounded-lg border shadow-sm shrink-0",children:r.jsx(B$e,{value:s,size:120,level:"H",bgColor:"#ffffff",fgColor:"#000000"})}),r.jsxs("div",{className:"space-y-2 min-w-0",children:[r.jsx("p",{className:"text-xs text-muted-foreground leading-relaxed",children:"Download this QR code to use on business cards, flyers, signs, or any print materials. Scanning it opens your digital card instantly."}),r.jsxs(ee,{variant:"outline",size:"sm",onClick:a,className:"gap-1.5",children:[r.jsx(no,{className:"h-3.5 w-3.5"}),"Download PNG"]})]})]})]})}function dde(t){return{is_published:t.is_published,theme:t.theme,title:t.title||"",positioning_statement:t.positioning_statement||"",bio:t.bio||"",review_snippet:t.review_snippet||"",review_source_url:t.review_source_url||"",booking_url:t.booking_url||"",custom_cta_label:t.custom_cta_label||"",show_photo:t.show_photo,show_bio:t.show_bio,show_credentials:t.show_credentials,show_social_links:t.show_social_links,show_save_contact:t.show_save_contact,show_leave_review:t.show_leave_review,show_refer_friend:t.show_refer_friend,brokerage_display_name:t.brokerage_display_name||"",brokerage_logo_url:t.brokerage_logo_url||"",brokerage_logo_size:t.brokerage_logo_size||56,team_name:t.team_name||"",team_logo_url:t.team_logo_url||"",team_logo_size:t.team_logo_size||56}}function KWt(){const{user:t}=Qr(),{data:e,isLoading:n}=Ait(t==null?void 0:t.id),s=f3(),[a,o]=I.useState(null),l=I.useMemo(()=>a||(e?dde(e):null),[a,e]);if(n)return r.jsx(Lr,{children:r.jsxs("div",{className:"max-w-2xl mx-auto p-4 space-y-4",children:[r.jsx(Ir,{className:"h-8 w-48"}),r.jsx(Ir,{className:"h-32 w-full"}),r.jsx(Ir,{className:"h-32 w-full"})]})});if(!e)return r.jsx(Lr,{children:r.jsx(YWt,{userId:t==null?void 0:t.id})});const i=l||dde(e),h=p=>{o(x=>{const y=x||dde(e);return typeof p=="function"?p(y):p})};return r.jsx(Lr,{children:r.jsxs("div",{className:"flex gap-6",children:[r.jsxs("div",{className:`${s?"w-full":"flex-1 min-w-0"} max-w-2xl mx-auto p-4 space-y-6 animate-fade-in`,children:[r.jsx(XWt,{card:e}),r.jsx(eGt,{card:e,form:i,setForm:h})]}),!s&&r.jsx("div",{className:"w-[400px] shrink-0 sticky top-4 self-start",children:r.jsxs("div",{className:"rounded-xl border bg-muted/30 overflow-hidden",children:[r.jsxs("div",{className:"flex items-center gap-2 px-4 py-2.5 border-b bg-card",children:[r.jsx(xj,{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(ZWt,{card:e,form:i})})]})})]})})}function ZWt({card:t,form:e}){const{data:n}=Yt({queryKey:["card-preview-profile",t.user_id],queryFn:async()=>{const{data:a}=await J.from("profiles").select("name, email, phone, avatar_url, brokerage_id").eq("id",t.user_id).single();let o=(a==null?void 0:a.avatar_url)||null;if(!o){const{data:l}=await J.storage.from("avatars").list(`${t.user_id}`);if(l&&l.length>0){const{data:i}=J.storage.from("avatars").getPublicUrl(`${t.user_id}/${l[0].name}`);o=`${i.publicUrl}?t=${Date.now()}`}}return{...a,avatar_url:o}}}),s=I.useMemo(()=>({...t,is_published:e.is_published,theme:e.theme,title:e.title||null,positioning_statement:e.positioning_statement||null,bio:e.bio||null,review_snippet:e.review_snippet||null,review_source_url:e.review_source_url||null,booking_url:e.booking_url||null,custom_cta_label:e.custom_cta_label||null,custom_cta_url:t.custom_cta_url,show_photo:e.show_photo,show_bio:e.show_bio,show_video:t.show_video,show_credentials:e.show_credentials,show_social_links:e.show_social_links,show_save_contact:e.show_save_contact,show_leave_review:e.show_leave_review,show_refer_friend:e.show_refer_friend,brokerage_display_name:e.brokerage_display_name||null,brokerage_logo_url:e.brokerage_logo_url||null,brokerage_logo_size:e.brokerage_logo_size,team_name:e.team_name||null,team_logo_url:e.team_logo_url||null,team_logo_size:e.team_logo_size,social_links:t.social_links||[],profile:{name:(n==null?void 0:n.name)||null,email:(n==null?void 0:n.email)||null,phone:(n==null?void 0:n.phone)||null,brokerage_id:(n==null?void 0:n.brokerage_id)||null},brokerage_name:e.brokerage_display_name||null,avatar_url:(n==null?void 0:n.avatar_url)||null}),[t,e,n]);return r.jsx("div",{className:"transform scale-[0.85] origin-top",children:r.jsx(Oge,{card:s})})}function YWt({userId:t}){var h;const[e,n]=I.useState(""),s=hLe(),{data:a}=Yt({queryKey:["my-profile-for-card",t],queryFn:async()=>{if(!t)return null;const{data:p}=await J.from("profiles").select("name").eq("id",t).single();return p},enabled:!!t}),o=((h=a==null?void 0:a.name)==null?void 0:h.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/(^-|-$)/g,""))||"",l=()=>{if(!t)return;const p=(e.trim()||o).toLowerCase().replace(/[^a-z0-9-]/g,"-");if(!p){ze.error("Please enter a URL slug for your card");return}s.mutate({user_id:t,slug:p,is_published:!0},{onSuccess:()=>ze.success("Your digital card has been created!")})},i=[{icon:Ux,title:"Shareable Link",desc:"One link that works everywhere"},{icon:kg,title:"Lead Capture",desc:"Collect leads automatically"},{icon:rf,title:"Always Up-to-Date",desc:"Edit anytime, changes are instant"},{icon:Fd,title:"Fully Customizable",desc:"Themes, colors, and content blocks"}];return r.jsxs("div",{className:"max-w-2xl mx-auto p-4 animate-fade-in",children:[r.jsxs("div",{className:"relative overflow-hidden rounded-2xl bg-gradient-to-br from-primary/90 via-primary to-primary/80 p-8 md:p-12 mb-8 text-primary-foreground",children:[r.jsx("div",{className:"absolute inset-0 bg-[radial-gradient(circle_at_30%_20%,rgba(255,255,255,0.15),transparent_50%)]"}),r.jsx("div",{className:"absolute inset-0 bg-[radial-gradient(circle_at_80%_80%,rgba(0,0,0,0.1),transparent_50%)]"}),r.jsxs("div",{className:"relative z-10",children:[r.jsxs("div",{className:"inline-flex items-center gap-2 px-3 py-1 rounded-full bg-white/20 backdrop-blur-sm text-sm font-medium mb-4",children:[r.jsx(Ms,{className:"h-3.5 w-3.5"}),"New Feature"]}),r.jsx("h1",{className:"text-3xl md:text-4xl font-bold mb-3 tracking-tight",children:"Your Digital Business Card"}),r.jsx("p",{className:"text-primary-foreground/80 text-lg max-w-md leading-relaxed",children:"Ditch the paper. Share a beautiful, interactive card that captures leads and makes a lasting impression."})]})]}),r.jsx("div",{className:"grid grid-cols-2 gap-3 mb-8",children:i.map(p=>r.jsxs("div",{className:"flex items-start gap-3 p-4 rounded-xl border bg-card hover:shadow-md transition-shadow",children:[r.jsx("div",{className:"mt-0.5 p-2 rounded-lg bg-primary/10 shrink-0",children:r.jsx(p.icon,{className:"h-4 w-4 text-primary"})}),r.jsxs("div",{children:[r.jsx("p",{className:"font-semibold text-sm",children:p.title}),r.jsx("p",{className:"text-xs text-muted-foreground",children:p.desc})]})]},p.title))}),r.jsxs(Ye,{className:"shadow-lg border-2",children:[r.jsxs(Gt,{className:"text-center pb-2",children:[r.jsx(Zt,{className:"text-xl",children:"Set Up Your Card"}),r.jsx(Mn,{children:"Choose a URL slug — this is the link you'll share with clients"})]}),r.jsxs(tt,{className:"p-6 pt-2 space-y-5",children:[r.jsxs("div",{children:[r.jsx(He,{className:"text-sm font-medium",children:"Your Card URL"}),r.jsxs("div",{className:"flex items-center gap-0 mt-1.5",children:[r.jsx("span",{className:"inline-flex items-center px-3 h-10 rounded-l-md border border-r-0 bg-muted text-sm text-muted-foreground whitespace-nowrap",children:"cards.relevelup.com/"}),r.jsx(dt,{value:e||o,onChange:p=>n(p.target.value),placeholder:"your-name",className:"rounded-l-none"})]})]}),r.jsxs(ee,{onClick:l,disabled:s.isPending,className:"w-full h-11 text-base font-semibold",size:"lg",children:[r.jsx(Ms,{className:"h-4 w-4 mr-2"}),s.isPending?"Creating...":"Create My Card"]})]})]})]})}function XWt({card:t}){const n=`https://cards.relevelup.com/${t.slug}`,s=()=>{navigator.clipboard.writeText(n),ze.success("Card link copied!")};return r.jsx("div",{className:"rounded-xl border bg-card p-5",children:r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("h1",{className:"text-xl font-bold",children:"My Digital Card"}),r.jsx(Ot,{variant:t.is_published?"default":"secondary",className:"text-[10px] uppercase tracking-wider",children:t.is_published?"Live":"Draft"})]}),r.jsxs("p",{className:"text-sm text-muted-foreground flex items-center gap-1",children:[r.jsx(Ux,{className:"h-3.5 w-3.5"}),"cards.relevelup.com/",t.slug]})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(ee,{variant:"outline",size:"sm",onClick:s,className:"gap-1.5",children:[r.jsx(hl,{className:"h-3.5 w-3.5"})," Copy Link"]}),r.jsx(ee,{size:"sm",asChild:!0,className:"gap-1.5",children:r.jsxs("a",{href:n,target:"_blank",rel:"noopener noreferrer",children:[r.jsx(Fs,{className:"h-3.5 w-3.5"})," Preview"]})})]})]})})}function QWt({userId:t}){const e=Vr(),n=I.useRef(null),[s,a]=I.useState(!1),[o,l]=I.useState(""),{data:i,isLoading:h}=Yt({queryKey:["card-editor-profile",t],queryFn:async()=>{const{data:ie}=await J.from("profiles").select("name, email, phone, avatar_url").eq("id",t).single();let le=(ie==null?void 0:ie.avatar_url)||null;if(!le){const{data:ye}=await J.storage.from("avatars").list(`${t}`);if(ye&&ye.length>0){const{data:ne}=J.storage.from("avatars").getPublicUrl(`${t}/${ye[0].name}`);le=`${ne.publicUrl}?t=${Date.now()}`,await J.from("profiles").update({avatar_url:le}).eq("id",t)}}return{...ie,avatar_url:le}}}),[p,x]=I.useState(null),[y,b]=I.useState(null),[j,C]=I.useState(null),[N,A]=I.useState(!1),E=p??(i==null?void 0:i.name)??"",T=y??(i==null?void 0:i.phone)??"",L=j??(i==null?void 0:i.email)??"",z=i==null?void 0:i.avatar_url,F=((i==null?void 0:i.name)||"A").split(" ").map(ie=>ie[0]).join("").toUpperCase().slice(0,2),q=!(i!=null&&i.avatar_url)||!(i!=null&&i.phone),H=cr({mutationFn:async ie=>{const{error:le}=await J.from("profiles").update(ie).eq("id",t);if(le)throw le},onSuccess:()=>{e.invalidateQueries({queryKey:["card-editor-profile",t]}),e.invalidateQueries({queryKey:["card-preview-profile",t]}),e.invalidateQueries({queryKey:["agent-card-user"]}),ze.success("Profile updated!")},onError:()=>ze.error("Failed to update profile")}),Z=()=>{const ie={};if(p!==null&&p!==(i==null?void 0:i.name)&&(ie.name=p),y!==null&&y!==(i==null?void 0:i.phone)&&(ie.phone=y||null),j!==null&&j!==(i==null?void 0:i.email)&&(ie.email=j),Object.keys(ie).length===0){ze.info("No changes to save");return}H.mutate(ie)},G=ie=>{var ne;const le=(ne=ie.target.files)==null?void 0:ne[0];if(!le)return;if(!le.type.startsWith("image/")){ze.error("Please select an image file");return}const ye=new FileReader;ye.onloadend=()=>{l(ye.result),a(!0)},ye.readAsDataURL(le),ie.target.value=""},te=async ie=>{A(!0);try{const{data:le}=await J.storage.from("avatars").list(`${t}`);le&&le.length>0&&await J.storage.from("avatars").remove(le.map(he=>`${t}/${he.name}`));const ye=`${t}/avatar.jpg`,{error:ne}=await J.storage.from("avatars").upload(ye,ie,{upsert:!0,contentType:"image/jpeg"});if(ne)throw ne;const{data:ge}=J.storage.from("avatars").getPublicUrl(ye),ae=ge.publicUrl+"?t="+Date.now();await J.from("profiles").update({avatar_url:ae}).eq("id",t),e.invalidateQueries({queryKey:["card-editor-profile",t]}),e.invalidateQueries({queryKey:["card-preview-profile",t]}),e.invalidateQueries({queryKey:["agent-card-user"]}),ze.success("Photo updated!")}catch{ze.error("Failed to upload photo")}finally{A(!1)}};return h?r.jsx(Ir,{className:"h-32 w-full rounded-xl"}):r.jsxs(r.Fragment,{children:[r.jsx(Ye,{className:q?"border-amber-300 dark:border-amber-700":"",children:r.jsxs(tt,{className:"p-5 space-y-4",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[r.jsx(He,{className:"text-sm font-semibold",children:"Profile Info"}),q&&r.jsxs("span",{className:"inline-flex items-center gap-1 text-xs text-amber-600 dark:text-amber-400 font-medium",children:[r.jsx(Il,{className:"h-3 w-3"}),"Missing info — complete below so your card looks great"]})]}),r.jsx("p",{className:"text-xs text-muted-foreground -mt-3",children:"This info shows on your digital card and updates your profile everywhere."}),r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsxs("div",{className:"relative group cursor-pointer",onClick:()=>{var ie;return(ie=n.current)==null?void 0:ie.click()},children:[r.jsxs(Ks,{className:"h-16 w-16 ring-2 ring-muted",children:[r.jsx(Ei,{src:z||void 0,alt:E}),r.jsx(Zs,{className:"text-lg font-semibold bg-primary/10 text-primary",children:F})]}),r.jsx("div",{className:"absolute inset-0 bg-black/40 rounded-full flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity",children:r.jsx(xg,{className:"h-5 w-5 text-white"})}),r.jsx("input",{ref:n,type:"file",accept:"image/*",className:"hidden",onChange:G})]}),r.jsxs("div",{className:"flex-1 space-y-0.5",children:[r.jsx("p",{className:"text-sm font-medium",children:N?"Uploading...":z?"Tap to change photo":"Add a profile photo"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"This photo appears on your card, profile, and community posts"})]})]}),r.jsxs("div",{className:"grid gap-3",children:[r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(He,{className:"text-xs font-medium text-muted-foreground",children:"Full Name"}),r.jsx(dt,{value:E,onChange:ie=>x(ie.target.value),placeholder:"Your full name",className:"h-10"})]}),r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(He,{className:"text-xs font-medium text-muted-foreground",children:"Phone Number"}),r.jsx(dt,{value:T,onChange:ie=>b(ie.target.value),placeholder:"(555) 123-4567",className:"h-10",type:"tel"})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(He,{className:"text-xs font-medium text-muted-foreground",children:"Email"}),r.jsx(dt,{value:L,onChange:ie=>C(ie.target.value),placeholder:"you@example.com",className:"h-10",type:"email"})]})]})]}),r.jsx(ee,{variant:"outline",size:"sm",onClick:Z,disabled:H.isPending,className:"w-full",children:H.isPending?"Saving...":"Update Profile Info"})]})}),r.jsx(wxe,{open:s,onClose:()=>a(!1),imageSrc:o,onCropComplete:te,aspectRatio:1})]})}function JWt({form:t,setForm:e,userId:n}){const[s,a]=I.useState(null),[o,l]=I.useState(t.brokerage_logo_url?"logo":"name"),[i,h]=I.useState(t.team_logo_url?"logo":"name"),p=j=>{l(j),e(j==="name"?C=>({...C,brokerage_logo_url:""}):C=>({...C,brokerage_display_name:""}))},x=j=>{h(j),e(j==="name"?C=>({...C,team_logo_url:""}):C=>({...C,team_name:""}))},y=async(j,C)=>{var A;const N=(A=j.target.files)==null?void 0:A[0];if(N){if(!N.type.startsWith("image/")){ze.error("Please select an image file");return}a(C);try{const E=N.name.split(".").pop()||"png",L=`${n}/${C==="brokerage_logo_url"?"brokerage-logo":"team-logo"}.${E}`,{error:z}=await J.storage.from("card-logos").upload(L,N,{upsert:!0});if(z)throw z;const{data:F}=J.storage.from("card-logos").getPublicUrl(L),q=F.publicUrl+"?t="+Date.now();e(C==="brokerage_logo_url"?H=>({...H,[C]:q,brokerage_display_name:""}):H=>({...H,[C]:q,team_name:""})),ze.success("Logo uploaded!")}catch{ze.error("Failed to upload logo")}finally{a(null),j.target.value=""}}},b=j=>{e(C=>({...C,[j]:""}))};return r.jsx(Ye,{children:r.jsxs(tt,{className:"p-5 space-y-5",children:[r.jsxs("div",{children:[r.jsx(He,{className:"text-sm font-semibold",children:"Brokerage & Team Branding"}),r.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Choose either a name or a logo for each — not both."})]}),r.jsxs("div",{className:"space-y-3 p-3 rounded-lg bg-muted/30 border",children:[r.jsx(He,{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:"Brokerage"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(ee,{type:"button",variant:o==="name"?"default":"outline",size:"sm",className:"text-xs",onClick:()=>p("name"),children:"Use Name"}),r.jsx(ee,{type:"button",variant:o==="logo"?"default":"outline",size:"sm",className:"text-xs",onClick:()=>p("logo"),children:"Use Logo"})]}),o==="name"?r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(He,{className:"text-xs font-medium text-muted-foreground",children:"Brokerage Name"}),r.jsx(dt,{value:t.brokerage_display_name,onChange:j=>e(C=>({...C,brokerage_display_name:j.target.value})),placeholder:"e.g. Keller Williams Realty",className:"h-10"})]}):r.jsxs("div",{className:"space-y-3",children:[r.jsx(He,{className:"text-xs font-medium text-muted-foreground",children:"Brokerage Logo"}),r.jsxs("div",{className:"flex items-center gap-3",children:[t.brokerage_logo_url?r.jsxs("div",{className:"relative group",children:[r.jsx("img",{src:t.brokerage_logo_url,alt:"Brokerage logo",style:{height:`${t.brokerage_logo_size||56}px`},className:"max-w-[200px] object-contain rounded border bg-white p-1"}),r.jsx("button",{onClick:()=>b("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(xg,{className:"h-3.5 w-3.5"}),s==="brokerage_logo_url"?"Uploading...":t.brokerage_logo_url?"Change":"Upload Logo"]}),r.jsx("input",{type:"file",accept:"image/*",className:"hidden",onChange:j=>y(j,"brokerage_logo_url"),disabled:s!==null})]})]}),t.brokerage_logo_url&&r.jsxs("div",{className:"space-y-1.5",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(He,{className:"text-xs font-medium text-muted-foreground",children:"Logo Size"}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:[t.brokerage_logo_size||56,"px"]})]}),r.jsx(lm,{value:[t.brokerage_logo_size||56],onValueChange:([j])=>e(C=>({...C,brokerage_logo_size:j})),min:24,max:120,step:4})]})]})]}),r.jsxs("div",{className:"space-y-3 p-3 rounded-lg bg-muted/30 border",children:[r.jsx(He,{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:"Team"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(ee,{type:"button",variant:i==="name"?"default":"outline",size:"sm",className:"text-xs",onClick:()=>x("name"),children:"Use Name"}),r.jsx(ee,{type:"button",variant:i==="logo"?"default":"outline",size:"sm",className:"text-xs",onClick:()=>x("logo"),children:"Use Logo"})]}),i==="name"?r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(He,{className:"text-xs font-medium text-muted-foreground",children:"Team Name"}),r.jsx(dt,{value:t.team_name,onChange:j=>e(C=>({...C,team_name:j.target.value})),placeholder:"e.g. The Smith Group",className:"h-10"})]}):r.jsxs("div",{className:"space-y-3",children:[r.jsx(He,{className:"text-xs font-medium text-muted-foreground",children:"Team Logo"}),r.jsxs("div",{className:"flex items-center gap-3",children:[t.team_logo_url?r.jsxs("div",{className:"relative group",children:[r.jsx("img",{src:t.team_logo_url,alt:"Team logo",style:{height:`${t.team_logo_size||56}px`},className:"max-w-[200px] object-contain rounded border bg-white p-1"}),r.jsx("button",{onClick:()=>b("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(xg,{className:"h-3.5 w-3.5"}),s==="team_logo_url"?"Uploading...":t.team_logo_url?"Change":"Upload Logo"]}),r.jsx("input",{type:"file",accept:"image/*",className:"hidden",onChange:j=>y(j,"team_logo_url"),disabled:s!==null})]})]}),t.team_logo_url&&r.jsxs("div",{className:"space-y-1.5",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(He,{className:"text-xs font-medium text-muted-foreground",children:"Logo Size"}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:[t.team_logo_size||56,"px"]})]}),r.jsx(lm,{value:[t.team_logo_size||56],onValueChange:([j])=>e(C=>({...C,team_logo_size:j})),min:24,max:120,step:4})]})]})]})]})})}function eGt({card:t,form:e,setForm:n}){var b;const s=fLe(),a=Vr(),{data:o}=pLe(t.id),[l,i]=I.useState(t.slug),[h,p]=I.useState(!1),x=async()=>{const j=l.trim().toLowerCase().replace(/[^a-z0-9-]/g,"-").replace(/-+/g,"-").replace(/(^-|-$)/g,"");if(!j){ze.error("Please enter a valid URL");return}if(j===t.slug){ze.info("No changes to save");return}p(!0);try{const{data:C}=await J.from("agent_cards").select("id").eq("slug",j).neq("id",t.id).maybeSingle();if(C){ze.error("This URL is already taken. Try another one.");return}const{error:N}=await J.from("agent_cards").update({slug:j}).eq("id",t.id);if(N)throw N;i(j),a.invalidateQueries({queryKey:["agent-card"]}),ze.success("Card address updated!")}catch{ze.error("Failed to update card address")}finally{p(!1)}},y=()=>{s.mutate({id:t.id,...e,is_published:!0,title:e.title||null,positioning_statement:e.positioning_statement||null,bio:e.bio||null,review_snippet:e.review_snippet||null,review_source_url:e.review_source_url||null,booking_url:e.booking_url||null,custom_cta_label:e.custom_cta_label||null,brokerage_display_name:e.brokerage_display_name||null,brokerage_logo_url:e.brokerage_logo_url||null,brokerage_logo_size:e.brokerage_logo_size,team_name:e.team_name||null,team_logo_url:e.team_logo_url||null,team_logo_size:e.team_logo_size},{onSuccess:()=>ze.success("Card saved!")})};return r.jsxs("div",{className:"space-y-4",children:[r.jsxs(Ii,{defaultValue:"content",children:[r.jsxs(wi,{className:"w-full h-11 p-1",children:[r.jsxs(ln,{value:"content",className:"flex-1 gap-1.5 data-[state=active]:shadow-sm",children:[r.jsx(fm,{className:"h-3.5 w-3.5 hidden sm:inline"}),"Content"]}),r.jsxs(ln,{value:"sections",className:"flex-1 gap-1.5 data-[state=active]:shadow-sm",children:[r.jsx(Qo,{className:"h-3.5 w-3.5 hidden sm:inline"}),"Sections"]}),r.jsxs(ln,{value:"blocks",className:"flex-1 gap-1.5 data-[state=active]:shadow-sm",children:[r.jsx(kg,{className:"h-3.5 w-3.5 hidden sm:inline"}),"Blocks"]}),r.jsxs(ln,{value:"qrcode",className:"flex-1 gap-1.5 data-[state=active]:shadow-sm",children:[r.jsx($T,{className:"h-3.5 w-3.5 hidden sm:inline"}),"QR Code"]}),r.jsxs(ln,{value:"analytics",className:"flex-1 gap-1.5 data-[state=active]:shadow-sm",children:[r.jsx(yj,{className:"h-3.5 w-3.5 hidden sm:inline"}),"Analytics"]})]}),r.jsxs(An,{value:"content",className:"mt-4 space-y-4",children:[r.jsx(QWt,{userId:t.user_id}),r.jsx(JWt,{form:e,setForm:n,userId:t.user_id}),r.jsx(Ye,{children:r.jsxs(tt,{className:"p-5 space-y-5",children:[r.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg bg-muted/50",children:[r.jsxs("div",{children:[r.jsx(He,{className:"text-sm font-semibold",children:"Card Status"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Toggle your card on or off"})]}),r.jsx(Ps,{checked:e.is_published,onCheckedChange:j=>n(C=>({...C,is_published:j}))})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(He,{className:"text-sm font-medium",children:"Card Address"}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs("div",{className:"flex flex-1",children:[r.jsx("span",{className:"inline-flex items-center px-3 rounded-l-md border border-r-0 bg-muted text-muted-foreground text-xs whitespace-nowrap",children:"cards.relevelup.com/"}),r.jsx(dt,{value:l,onChange:j=>i(j.target.value.toLowerCase().replace(/[^a-z0-9-]/g,"-")),placeholder:"your-name",className:"rounded-l-none h-10"})]}),r.jsx(ee,{variant:"outline",size:"sm",onClick:x,disabled:h||l===t.slug,className:"shrink-0",children:h?"Saving...":"Update"})]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"This is your unique card URL. Only letters, numbers, and dashes allowed."})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(He,{className:"text-sm font-medium",children:"Theme"}),r.jsxs(gn,{value:e.theme,onValueChange:j=>n(C=>({...C,theme:j})),children:[r.jsx(fn,{className:"h-11",children:r.jsx(xn,{})}),r.jsxs(pn,{children:[r.jsx(Vt,{value:"standard",children:"✨ Standard — Modern & Clean"}),r.jsx(Vt,{value:"luxury",children:"🌙 Luxury — Dark & Gold"}),r.jsx(Vt,{value:"bold",children:"🔥 Bold — Vibrant & Punchy"}),r.jsx(Vt,{value:"classic",children:"📋 Classic — Professional"})]})]})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(He,{className:"text-sm font-medium",children:"Title / Tagline"}),r.jsx(dt,{value:e.title,onChange:j=>n(C=>({...C,title:j.target.value})),placeholder:"e.g. Luxury Real Estate Specialist",className:"h-11"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Shown below your name on the card"})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(He,{className:"text-sm font-medium",children:"Positioning Statement"}),r.jsx(dt,{value:e.positioning_statement,onChange:j=>n(C=>({...C,positioning_statement:j.target.value})),placeholder:"Your home journey, handled with care.",className:"h-11"})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(He,{className:"text-sm font-medium",children:"Bio"}),r.jsx(ps,{value:e.bio,onChange:j=>n(C=>({...C,bio:j.target.value})),placeholder:"A short intro about you and what makes you different...",rows:3})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(He,{className:"text-sm font-medium",children:"Review Snippet"}),r.jsx(dt,{value:e.review_snippet,onChange:j=>n(C=>({...C,review_snippet:j.target.value})),placeholder:"Best agent we've ever worked with...",className:"h-11"})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(He,{className:"text-sm font-medium",children:"Review Source URL"}),r.jsx(dt,{value:e.review_source_url,onChange:j=>n(C=>({...C,review_source_url:j.target.value})),placeholder:"https://g.page/your-business/review",className:"h-11"})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(He,{className:"text-sm font-medium",children:"Booking URL"}),r.jsx(dt,{value:e.booking_url,onChange:j=>n(C=>({...C,booking_url:j.target.value})),placeholder:"https://calendly.com/your-link",className:"h-11"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Leave empty to show a built-in lead form instead"})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx(He,{className:"text-sm font-medium",children:"Custom CTA Label"}),r.jsx(dt,{value:e.custom_cta_label,onChange:j=>n(C=>({...C,custom_cta_label:j.target.value})),placeholder:"Book a Call",className:"h-11"})]})]})})]}),r.jsx(An,{value:"sections",className:"mt-4",children:r.jsx(Ye,{children:r.jsx(tt,{className:"p-5 divide-y",children:[{key:"show_photo",label:"Photo",desc:"Uses the photo from your Profile Info above"},{key:"show_bio",label:"Bio Section",desc:"Display your bio on the card"},{key:"show_credentials",label:"Credentials",desc:"Show star rating and reviews"},{key:"show_social_links",label:"Social Links",desc:"Display your social media links"},{key:"show_save_contact",label:"Save Contact",desc:"Let visitors save you as a contact"},{key:"show_leave_review",label:"Leave Review",desc:"Link to your review page"},{key:"show_refer_friend",label:"Refer a Friend",desc:"Enable referral submissions"}].map(({key:j,label:C,desc:N})=>r.jsxs("div",{className:"flex items-center justify-between py-4 first:pt-0 last:pb-0",children:[r.jsxs("div",{className:"space-y-0.5",children:[r.jsx(He,{className:"text-sm font-medium",children:C}),r.jsx("p",{className:"text-xs text-muted-foreground",children:N})]}),r.jsx(Ps,{checked:e[j],onCheckedChange:A=>n(E=>({...E,[j]:A}))})]},j))})})}),r.jsx(An,{value:"blocks",className:"mt-4",children:r.jsx(M$e,{cardId:t.id})}),r.jsx(An,{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:Qo,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:yj,color:"text-amber-600 bg-amber-100 dark:text-amber-400 dark:bg-amber-900/30"},{label:"Leads",value:((b=o==null?void 0:o.leads)==null?void 0:b.length)??0,icon:nf,color:"text-emerald-600 bg-emerald-100 dark:text-emerald-400 dark:bg-emerald-900/30"}].map(j=>r.jsx(Ye,{className:"overflow-hidden",children:r.jsxs(tt,{className:"p-4",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[r.jsx("div",{className:`p-1.5 rounded-md ${j.color}`,children:r.jsx(j.icon,{className:"h-3.5 w-3.5"})}),r.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:j.label})]}),r.jsx("div",{className:"text-2xl font-bold",children:j.value})]})},j.label))}),o&&o.leads.length>0&&r.jsxs(Ye,{children:[r.jsx(Gt,{className:"pb-3",children:r.jsx(Zt,{className:"text-base",children:"Recent Leads"})}),r.jsx(tt,{className:"pt-0 space-y-2",children:o.leads.slice(0,5).map(j=>r.jsxs("div",{className:"flex items-center justify-between text-sm p-3 rounded-lg bg-muted/50",children:[r.jsxs("div",{children:[r.jsx("span",{className:"font-medium",children:j.name}),j.phone&&r.jsx("span",{className:"text-muted-foreground ml-2",children:j.phone})]}),j.intent&&r.jsx(Ot,{variant:"secondary",className:"text-xs",children:j.intent})]},j.id))})]}),(!o||o.leads.length===0)&&r.jsx(Ye,{children:r.jsxs(tt,{className:"p-8 text-center",children:[r.jsx(yj,{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(An,{value:"qrcode",className:"mt-4 space-y-4",children:r.jsx(Ye,{children:r.jsx(tt,{className:"p-6",children:r.jsx(GWt,{slug:t.slug})})})})]}),r.jsx(ee,{onClick:y,disabled:s.isPending,className:"w-full h-11 text-base font-semibold",size:"lg",children:s.isPending?"Saving...":"Save Changes"})]})}const $$e=new Date().getFullYear(),tGt=Array.from({length:5},(t,e)=>$$e-e);function rGt(){const[t,e]=I.useState($$e),n=rs(),{data:s,isLoading:a}=ept();return a?r.jsx(Lr,{title:"Scorecard Admin",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Ir,{className:"h-8 w-64"}),r.jsx("div",{className:"grid grid-cols-4 gap-4",children:[1,2,3,4].map(o=>r.jsx(Ir,{className:"h-24"},o))}),r.jsx(Ir,{className:"h-96"})]})}):r.jsx(Lr,{title:"Scorecard Admin",children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold text-foreground",children:"Scorecard Admin"}),r.jsx("p",{className:"text-muted-foreground",children:"View agent performance and scorecards"})]}),r.jsxs(gn,{value:String(t),onValueChange:o=>e(Number(o)),children:[r.jsx(fn,{className:"w-[120px]",children:r.jsx(xn,{})}),r.jsx(pn,{children:tGt.map(o=>r.jsx(Vt,{value:String(o),children:o},o))})]})]}),r.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[r.jsx(Ye,{children:r.jsxs(tt,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(Bn,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs font-medium",children:"Agents Tracking"})]}),r.jsx("p",{className:"text-2xl font-bold",children:(s==null?void 0:s.length)||0})]})}),r.jsx(Ye,{children:r.jsxs(tt,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(cc,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs font-medium",children:"Total Agents"})]}),r.jsx("p",{className:"text-2xl font-bold",children:(s==null?void 0:s.length)||0}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"with transactions"})]})})]}),r.jsxs(Ye,{children:[r.jsxs(Gt,{children:[r.jsx(Zt,{children:"Agents with Scorecards"}),r.jsx(Mn,{children:"Click to view individual agent scorecards"})]}),r.jsx(tt,{children:!s||s.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(cc,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),r.jsx("p",{children:"No agents have added transactions yet"})]}):r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Ar,{children:[r.jsx(It,{children:"Agent"}),r.jsx(It,{children:"Email"}),r.jsx(It,{className:"text-right",children:"Actions"})]})}),r.jsx(Vs,{children:s.map(o=>r.jsxs(Ar,{children:[r.jsx(Nt,{className:"font-medium",children:o.name}),r.jsx(Nt,{className:"text-muted-foreground",children:o.email}),r.jsx(Nt,{className:"text-right",children:r.jsxs(ee,{variant:"ghost",size:"sm",onClick:()=>n(`/admin/scorecard/${o.id}`),children:[r.jsx(Qo,{className:"h-4 w-4 mr-2"}),"View Scorecard"]})})]},o.id))})]})})]})]})})}const U$e=new Date().getFullYear(),nGt=Array.from({length:10},(t,e)=>U$e-e);function sGt(){var b;const{userId:t}=Zc(),e=rs(),[n,s]=I.useState(U$e),{data:a,isLoading:o}=Yt({queryKey:["agent-profile",t],queryFn:async()=>{const{data:j,error:C}=await J.from("profiles").select("id, name, email").eq("id",t).single();if(C)throw C;return j},enabled:!!t}),{data:l,isLoading:i}=vxe(n,t),{yearStats:h,lifetimeStats:p,showCommission:x}=j8e(n,t),{data:y}=w8e(n,t);return o?r.jsx(Lr,{title:"Agent Scorecard",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Ir,{className:"h-8 w-64"}),r.jsx("div",{className:"grid grid-cols-4 gap-4",children:[1,2,3,4].map(j=>r.jsx(Ir,{className:"h-24"},j))})]})}):r.jsx(Lr,{title:`${a==null?void 0:a.name}'s Scorecard`,children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:[r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>e("/admin/scorecard"),children:r.jsx(so,{className:"h-5 w-5"})}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold text-foreground",children:a==null?void 0:a.name}),r.jsx("p",{className:"text-muted-foreground",children:a==null?void 0:a.email})]})]}),r.jsxs(gn,{value:String(n),onValueChange:j=>s(Number(j)),children:[r.jsx(fn,{className:"w-[120px]",children:r.jsx(xn,{})}),r.jsx(pn,{children:nGt.map(j=>r.jsx(Vt,{value:String(j),children:j},j))})]})]}),r.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 lg:grid-cols-5 gap-4",children:[r.jsx(Ye,{children:r.jsxs(tt,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(pa,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs font-medium",children:"Transactions"})]}),r.jsx("p",{className:"text-2xl font-bold",children:h.totalTransactions}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[p.totalTransactions," lifetime"]})]})}),r.jsx(Ye,{children:r.jsxs(tt,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(Bn,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs font-medium",children:"Buyer/Seller"})]}),r.jsxs("p",{className:"text-2xl font-bold",children:[h.buyerCount,"/",h.sellerCount]})]})}),r.jsx(Ye,{children:r.jsxs(tt,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(hd,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs font-medium",children:"Volume"})]}),r.jsx("p",{className:"text-2xl font-bold",children:Ed(h.totalVolume,!0)})]})}),r.jsx(Ye,{children:r.jsxs(tt,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(Xf,{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:Ed(h.averagePrice,!0)})]})}),r.jsx(Ye,{children:r.jsxs(tt,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(Ol,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs font-medium",children:"Top Source"})]}),r.jsx("p",{className:"text-lg font-bold truncate",children:((b=h.topLeadSource)==null?void 0:b.name)||"-"})]})})]}),y&&r.jsx(Mze,{goals:y,stats:h,year:n,showCommission:x}),r.jsxs(Ii,{defaultValue:"transactions",className:"space-y-4",children:[r.jsxs(wi,{children:[r.jsx(ln,{value:"transactions",children:"Transactions"}),r.jsx(ln,{value:"charts",children:"Charts"})]}),r.jsx(An,{value:"transactions",children:r.jsx(Cze,{transactions:l||[],showCommission:x,isLoading:i})}),r.jsx(An,{value:"charts",children:r.jsx(y$e,{stats:h,year:n})})]})]})})}function aGt(){const t=Vr(),[e,n]=I.useState(""),[s,a]=I.useState("all");bLe();const{data:o,refetch:l}=Yt({queryKey:["listing-exchange-flag"],queryFn:async()=>{const{data:T}=await J.from("feature_flags").select("enabled").eq("key","listing_exchange_enabled").single();return(T==null?void 0:T.enabled)??!1}}),{data:i,isLoading:h}=Yt({queryKey:["admin-listings"],queryFn:async()=>{const{data:T,error:L}=await J.from("listings").select(` *, agent:profiles!listings_agent_id_fkey(id, name, email), photos:listing_photos(id, photo_url, is_primary) `).order("created_at",{ascending:!1});if(L)throw L;return T}}),{data:p}=Yt({queryKey:["admin-listing-stats"],queryFn:async()=>{const{data:T}=await J.from("listings").select("id, is_approved, status"),{data:L}=await J.from("listing_shares").select("id"),{data:z}=await J.from("listing_views").select("id");return{total:(T==null?void 0:T.length)||0,pending:(T==null?void 0:T.filter(F=>!F.is_approved).length)||0,active:(T==null?void 0:T.filter(F=>F.status==="active").length)||0,totalShares:(L==null?void 0:L.length)||0,totalViews:(z==null?void 0:z.length)||0}}}),x=cr({mutationFn:async({id:T,approved:L})=>{const{error:z}=await J.from("listings").update({is_approved:L}).eq("id",T);if(z)throw z},onSuccess:(T,{approved:L})=>{t.invalidateQueries({queryKey:["admin-listings"]}),t.invalidateQueries({queryKey:["admin-listing-stats"]}),ze.success(L?"Listing approved":"Listing unapproved")}}),y=cr({mutationFn:async({id:T,featured:L})=>{const{error:z}=await J.from("listings").update({is_featured:L}).eq("id",T);if(z)throw z},onSuccess:(T,{featured:L})=>{t.invalidateQueries({queryKey:["admin-listings"]}),ze.success(L?"Listing featured":"Listing unfeatured")}}),b=cr({mutationFn:async T=>{const{error:L}=await J.from("listings").delete().eq("id",T);if(L)throw L},onSuccess:()=>{t.invalidateQueries({queryKey:["admin-listings"]}),t.invalidateQueries({queryKey:["admin-listing-stats"]}),ze.success("Listing deleted")}}),j=cr({mutationFn:async T=>{const{error:L}=await J.from("feature_flags").update({enabled:T}).eq("key","listing_exchange_enabled");if(L)throw L},onSuccess:()=>{l(),ze.success("Feature flag updated")}}),C=o??!1,N=i==null?void 0:i.filter(T=>{var F,q,H,Z;const L=((F=T.city)==null?void 0:F.toLowerCase().includes(e.toLowerCase()))||((H=(q=T.agent)==null?void 0:q.name)==null?void 0:H.toLowerCase().includes(e.toLowerCase()))||((Z=T.property_address)==null?void 0:Z.toLowerCase().includes(e.toLowerCase())),z=s==="all"||s==="pending"&&!T.is_approved||s==="approved"&&T.is_approved;return L&&z}),A=T=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(T),E=T=>{const L={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 L[T]||L.active};return r.jsx(Lr,{title:"Listing Exchange Admin",children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold",children:"Listing Exchange"}),r.jsx("p",{className:"text-muted-foreground",children:"Manage community listings"})]}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("span",{className:"text-sm text-muted-foreground",children:"Feature visible to agents"}),r.jsx(Ps,{checked:C,onCheckedChange:T=>j.mutate(T)})]})]}),r.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-5 gap-4",children:[r.jsx(Ye,{children:r.jsxs(tt,{className:"p-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(ai,{className:"h-4 w-4 text-muted-foreground"}),r.jsx("span",{className:"text-sm text-muted-foreground",children:"Total Listings"})]}),r.jsx("p",{className:"text-2xl font-bold mt-1",children:(p==null?void 0:p.total)||0})]})}),r.jsx(Ye,{children:r.jsxs(tt,{className:"p-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Xf,{className:"h-4 w-4 text-green-500"}),r.jsx("span",{className:"text-sm text-muted-foreground",children:"Active"})]}),r.jsx("p",{className:"text-2xl font-bold mt-1",children:(p==null?void 0:p.active)||0})]})}),r.jsx(Ye,{children:r.jsxs(tt,{className:"p-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Bn,{className:"h-4 w-4 text-amber-500"}),r.jsx("span",{className:"text-sm text-muted-foreground",children:"Pending Review"})]}),r.jsx("p",{className:"text-2xl font-bold mt-1",children:(p==null?void 0:p.pending)||0})]})}),r.jsx(Ye,{children:r.jsxs(tt,{className:"p-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Qo,{className:"h-4 w-4 text-blue-500"}),r.jsx("span",{className:"text-sm text-muted-foreground",children:"Total Views"})]}),r.jsx("p",{className:"text-2xl font-bold mt-1",children:(p==null?void 0:p.totalViews)||0})]})}),r.jsx(Ye,{children:r.jsxs(tt,{className:"p-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(fc,{className:"h-4 w-4 text-purple-500"}),r.jsx("span",{className:"text-sm text-muted-foreground",children:"Total Shares"})]}),r.jsx("p",{className:"text-2xl font-bold mt-1",children:(p==null?void 0:p.totalShares)||0})]})})]}),r.jsx(Ye,{children:r.jsx(tt,{className:"p-4",children:r.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[r.jsxs("div",{className:"relative flex-1",children:[r.jsx(wa,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(dt,{placeholder:"Search by city, address, or agent...",value:e,onChange:T=>n(T.target.value),className:"pl-9"})]}),r.jsx(Ii,{value:s,onValueChange:T=>a(T),children:r.jsxs(wi,{children:[r.jsx(ln,{value:"all",children:"All"}),r.jsx(ln,{value:"pending",children:"Pending"}),r.jsx(ln,{value:"approved",children:"Approved"})]})})]})})}),r.jsxs(Ye,{children:[r.jsx(Gt,{children:r.jsxs(Zt,{children:["Listings (",(N==null?void 0:N.length)||0,")"]})}),r.jsx(tt,{children:r.jsx("div",{className:"overflow-x-auto",children:r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Ar,{children:[r.jsx(It,{children:"Property"}),r.jsx(It,{children:"Agent"}),r.jsx(It,{children:"Price"}),r.jsx(It,{children:"Status"}),r.jsx(It,{className:"text-center",children:"Approved"}),r.jsx(It,{className:"text-center",children:"Featured"}),r.jsx(It,{children:"Views"}),r.jsx(It,{children:"Shares"}),r.jsx(It,{children:"Date"}),r.jsx(It,{})]})}),r.jsx(Vs,{children:h?r.jsx(Ar,{children:r.jsx(Nt,{colSpan:10,className:"text-center py-8 text-muted-foreground",children:"Loading..."})}):(N==null?void 0:N.length)===0?r.jsx(Ar,{children:r.jsx(Nt,{colSpan:10,className:"text-center py-8 text-muted-foreground",children:"No listings found"})}):N==null?void 0:N.map(T=>{var L,z,F,q,H;return r.jsxs(Ar,{children:[r.jsx(Nt,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[(z=(L=T.photos)==null?void 0:L[0])!=null&&z.photo_url?r.jsx("img",{src:T.photos[0].photo_url,alt:"",className:"w-12 h-12 object-cover rounded"}):r.jsx("div",{className:"w-12 h-12 bg-muted rounded flex items-center justify-center",children:r.jsx(ai,{className:"h-5 w-5 text-muted-foreground"})}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium text-sm",children:T.property_address||`${T.city}, ${T.state}`}),r.jsx("p",{className:"text-xs text-muted-foreground",children:(F=T.property_type)==null?void 0:F.replace("_"," ")})]})]})}),r.jsx(Nt,{children:r.jsx("p",{className:"text-sm",children:((q=T.agent)==null?void 0:q.name)||"Unknown"})}),r.jsx(Nt,{className:"font-medium",children:A(T.price)}),r.jsx(Nt,{children:r.jsx(Ot,{variant:"outline",className:E(T.status),children:(H=T.status)==null?void 0:H.replace("_"," ")})}),r.jsx(Nt,{className:"text-center",children:r.jsx(Ps,{checked:T.is_approved??!1,onCheckedChange:Z=>x.mutate({id:T.id,approved:Z})})}),r.jsx(Nt,{className:"text-center",children:r.jsx(Ps,{checked:T.is_featured??!1,onCheckedChange:Z=>y.mutate({id:T.id,featured:Z})})}),r.jsx(Nt,{children:T.view_count||0}),r.jsx(Nt,{children:T.share_count||0}),r.jsx(Nt,{className:"text-sm text-muted-foreground",children:yn(new Date(T.created_at),"MMM d, yyyy")}),r.jsx(Nt,{children:r.jsxs(wh,{children:[r.jsx(jh,{asChild:!0,children:r.jsx(ee,{variant:"ghost",size:"icon",children:r.jsx(em,{className:"h-4 w-4"})})}),r.jsxs(Wu,{align:"end",children:[r.jsxs(di,{onClick:()=>window.open(`/mission-control/listings/${T.id}`,"_blank"),children:[r.jsx(Qo,{className:"h-4 w-4 mr-2"}),"View Listing"]}),r.jsxs(di,{onClick:()=>y.mutate({id:T.id,featured:!T.is_featured}),children:[r.jsx(vs,{className:"h-4 w-4 mr-2"}),T.is_featured?"Unfeature":"Feature"]}),r.jsxs(di,{className:"text-destructive",onClick:()=>{confirm("Are you sure you want to delete this listing?")&&b.mutate(T.id)},children:[r.jsx(_s,{className:"h-4 w-4 mr-2"}),"Delete"]})]})]})})]},T.id)})})]})})})]})]})})}const iGt=()=>{var y,b;const[t,e]=I.useState(""),[n,s]=I.useState(null),{data:a,isLoading:o}=Yt({queryKey:["membership-reviews"],queryFn:async()=>{const{data:j,error:C}=await J.from("membership_reviews").select("*").order("created_at",{ascending:!1});if(C)throw C;const N=(j==null?void 0:j.map(T=>T.user_id))||[],{data:A}=await J.from("profiles").select("id, name, email").in("id",N);return j==null?void 0:j.map(T=>({...T,profiles:(A==null?void 0:A.find(L=>L.id===T.user_id))||null}))}}),l=a==null?void 0:a.filter(j=>{var N,A,E,T,L;const C=t.toLowerCase();return((A=(N=j.profiles)==null?void 0:N.name)==null?void 0:A.toLowerCase().includes(C))||((T=(E=j.profiles)==null?void 0:E.email)==null?void 0:T.toLowerCase().includes(C))||((L=j.review_text)==null?void 0:L.toLowerCase().includes(C))}),i=a!=null&&a.length?(a.reduce((j,C)=>j+C.rating,0)/a.length).toFixed(1):"0.0",h=a==null?void 0:a.reduce((j,C)=>(j[C.rating]=(j[C.rating]||0)+1,j),{}),p=(a==null?void 0:a.filter(j=>j.posted_to_google).length)||0,x=j=>r.jsx("div",{className:"flex gap-0.5",children:[1,2,3,4,5].map(C=>r.jsx(vs,{className:$t("h-4 w-4",j>=C?"fill-yellow-400 text-yellow-400":"text-muted-foreground")},C))});return r.jsx(Lr,{children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Gu,{title:"Membership Reviews",description:"View and manage feedback from LevelUp members"}),r.jsxs("div",{className:"grid gap-4 md:grid-cols-4",children:[r.jsx(Ye,{children:r.jsxs(Gt,{className:"pb-2",children:[r.jsx(Mn,{children:"Total Reviews"}),r.jsx(Zt,{className:"text-3xl",children:(a==null?void 0:a.length)||0})]})}),r.jsx(Ye,{children:r.jsxs(Gt,{className:"pb-2",children:[r.jsx(Mn,{children:"Average Rating"}),r.jsxs(Zt,{className:"flex items-center gap-2 text-3xl",children:[i,r.jsx(vs,{className:"h-6 w-6 fill-yellow-400 text-yellow-400"})]})]})}),r.jsx(Ye,{children:r.jsxs(Gt,{className:"pb-2",children:[r.jsx(Mn,{children:"5-Star Reviews"}),r.jsx(Zt,{className:"text-3xl",children:(h==null?void 0:h[5])||0})]})}),r.jsx(Ye,{children:r.jsxs(Gt,{className:"pb-2",children:[r.jsx(Mn,{children:"Posted to Google"}),r.jsxs(Zt,{className:"flex items-center gap-2 text-3xl",children:[p,r.jsx(Fs,{className:"h-5 w-5 text-muted-foreground"})]})]})})]}),r.jsxs("div",{className:"relative max-w-sm",children:[r.jsx(wa,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),r.jsx(dt,{placeholder:"Search by name, email, or review...",value:t,onChange:j=>e(j.target.value),className:"pl-9"})]}),r.jsx(Ye,{children:r.jsx(tt,{className:"p-0",children:r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Ar,{children:[r.jsx(It,{children:"Member"}),r.jsx(It,{children:"Rating"}),r.jsx(It,{className:"hidden md:table-cell",children:"Review"}),r.jsx(It,{children:"Google"}),r.jsx(It,{children:"Date"})]})}),r.jsx(Vs,{children:o?r.jsx(Ar,{children:r.jsx(Nt,{colSpan:5,className:"text-center py-8",children:"Loading reviews..."})}):(l==null?void 0:l.length)===0?r.jsx(Ar,{children:r.jsx(Nt,{colSpan:5,className:"text-center py-8 text-muted-foreground",children:"No reviews found"})}):l==null?void 0:l.map(j=>{var C,N;return r.jsxs(Ar,{className:"cursor-pointer hover:bg-muted/50",onClick:()=>s(j),children:[r.jsx(Nt,{children:r.jsxs("div",{children:[r.jsx("div",{className:"font-medium",children:((C=j.profiles)==null?void 0:C.name)||"Unknown"}),r.jsx("div",{className:"text-sm text-muted-foreground",children:(N=j.profiles)==null?void 0:N.email})]})}),r.jsx(Nt,{children:x(j.rating)}),r.jsx(Nt,{className:"hidden md:table-cell max-w-xs",children:r.jsx("p",{className:"truncate text-sm text-muted-foreground",children:j.review_text||"-"})}),r.jsx(Nt,{children:j.posted_to_google?r.jsx(Ot,{variant:"secondary",className:"bg-green-100 text-green-800",children:"Posted"}):r.jsx(Ot,{variant:"outline",children:"No"})}),r.jsx(Nt,{className:"text-sm text-muted-foreground",children:yn(new Date(j.created_at),"MMM d, yyyy")})]},j.id)})})]})})}),r.jsx(Fr,{open:!!n,onOpenChange:()=>s(null),children:r.jsxs(Rr,{className:"max-w-lg",children:[r.jsx(qr,{children:r.jsx($r,{children:"Review Details"})}),n&&r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-start gap-4 p-4 bg-muted/50 rounded-lg",children:[r.jsxs("div",{className:"flex-1",children:[r.jsx("h3",{className:"font-semibold text-lg",children:((y=n.profiles)==null?void 0:y.name)||"Unknown Member"}),((b=n.profiles)==null?void 0:b.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(da,{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(zs,{className:"h-4 w-4"}),yn(new Date(n.created_at),"MMMM d, yyyy 'at' h:mm a")]}),n.posted_to_google?r.jsxs(Ot,{variant:"secondary",className:"bg-green-100 text-green-800",children:[r.jsx(Fs,{className:"h-3 w-3 mr-1"}),"Posted to Google"]}):r.jsx(Ot,{variant:"outline",children:"Not posted to Google"})]})]})]})})]})})},oGt=[{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"}],lGt=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 cGt(){const t=Vr(),{user:e}=Qr(),[n,s]=I.useState(!1),[a,o]=I.useState(!1),[l,i]=I.useState(!1),{data:h,isLoading:p}=Yt({queryKey:["weekly-digest-settings"],queryFn:async()=>{const{data:Z,error:G}=await J.from("weekly_digest_settings").select("*").single();if(G)throw G;return Z}}),{data:x,isLoading:y}=Yt({queryKey:["weekly-digest-logs"],queryFn:async()=>{const{data:Z,error:G}=await J.from("weekly_digest_logs").select("*").order("sent_at",{ascending:!1}).limit(100);if(G)throw G;return Z}}),{data:b}=Yt({queryKey:["digest-subscriber-count"],queryFn:async()=>{const{count:Z,error:G}=await J.from("profiles").select("id",{count:"exact",head:!0}).eq("digest_opt_out",!1).not("email","is",null);if(G)throw G;return Z||0}}),{data:j,refetch:C}=Yt({queryKey:["digest-queue-status"],queryFn:async()=>{const Z=new Date;Z.setUTCHours(0,0,0,0);const[G,te,ie,le]=await Promise.all([J.from("weekly_digest_send_queue").select("id",{count:"exact",head:!0}).eq("status","pending").gte("created_at",Z.toISOString()),J.from("weekly_digest_send_queue").select("id",{count:"exact",head:!0}).eq("status","processing").gte("created_at",Z.toISOString()),J.from("weekly_digest_send_queue").select("id",{count:"exact",head:!0}).eq("status","sent").gte("created_at",Z.toISOString()),J.from("weekly_digest_send_queue").select("id",{count:"exact",head:!0}).eq("status","failed").gte("created_at",Z.toISOString())]);return{pending:G.count||0,processing:te.count||0,sent:ie.count||0,failed:le.count||0,total:(G.count||0)+(te.count||0)+(ie.count||0)+(le.count||0)}},refetchInterval:5e3});I.useEffect(()=>{if(j&&(j.pending>0||j.processing>0)){const Z=setInterval(()=>{C(),t.invalidateQueries({queryKey:["weekly-digest-logs"]}),t.invalidateQueries({queryKey:["digest-today-failed-count"]}),t.invalidateQueries({queryKey:["digest-today-missing-count"]})},5e3);return()=>clearInterval(Z)}},[j,C,t]);const{data:N=0}=Yt({queryKey:["digest-today-failed-count"],queryFn:async()=>{const Z=new Date;Z.setUTCHours(0,0,0,0);const{count:G,error:te}=await J.from("weekly_digest_logs").select("id",{count:"exact",head:!0}).eq("delivery_status","failed").gte("sent_at",Z.toISOString());if(te)throw te;return G||0}}),A=cr({mutationFn:async Z=>{const{error:G}=await J.from("weekly_digest_settings").update(Z).eq("id",h==null?void 0:h.id);if(G)throw G},onSuccess:()=>{t.invalidateQueries({queryKey:["weekly-digest-settings"]}),ze.success("Settings updated")},onError:Z=>{ze.error("Failed to update settings: "+Z.message)}}),E=async()=>{s(!0);try{const{data:Z,error:G}=await J.functions.invoke("send-weekly-digest",{body:{manual:!0}});if(G)throw G;Z.queued?ze.success(`${Z.queued.toLocaleString()} emails queued! They'll be sent automatically (~80/minute).`):Z.sent!==void 0&&ze.success(`Digest sent! ${Z.sent} emails delivered, ${Z.failed} failed`),C(),t.invalidateQueries({queryKey:["weekly-digest-logs"]})}catch(Z){ze.error("Failed to send digest: "+Z.message)}finally{s(!1)}},T=async()=>{var Z,G,te,ie,le,ye;if(!(e!=null&&e.email)){ze.error("No email found for your account");return}o(!0);try{const{data:ne,error:ge}=await J.functions.invoke("send-weekly-digest",{body:{preview:!0,previewEmail:e.email}});if(ge)throw ge;const ae=ne==null?void 0:ne.resendId,he=ne==null?void 0:ne.resendDetails,ue=he==null?void 0:he.status,_e=((Z=he==null?void 0:he.body)==null?void 0:Z.status)||((te=(G=he==null?void 0:he.body)==null?void 0:G.data)==null?void 0:te.status),Ae=((le=(ie=he==null?void 0:he.body)==null?void 0:ie.error)==null?void 0:le.message)||((ye=he==null?void 0:he.body)==null?void 0:ye.message);ze.success(ae?`Preview accepted by email provider (id: ${ae})${ue?`, status check: ${ue}`:""}${_e?`, provider: ${_e}`:""}${Ae?` (${Ae})`:""}. Check spam/promotions—delivery can take a few minutes.`:"Preview accepted by email provider. Check spam/promotions—delivery can take a few minutes.")}catch(ne){ze.error("Failed to send preview: "+ne.message)}finally{o(!1)}},L=async()=>{i(!0);try{const{data:Z,error:G}=await J.functions.invoke("send-weekly-digest",{body:{retryFailed:!0}});if(G)throw G;Z.queued===0||Z.sent===0&&Z.failed===0&&!Z.queued?ze.info("No failed emails to retry"):Z.queued?ze.success(`${Z.queued} emails queued for retry!`):ze.success(`Retry complete! ${Z.sent} emails delivered, ${Z.failed} failed`),C(),t.invalidateQueries({queryKey:["weekly-digest-logs"]}),t.invalidateQueries({queryKey:["digest-today-failed-count"]}),t.invalidateQueries({queryKey:["digest-today-missing-count"]})}catch(Z){ze.error("Failed to retry: "+Z.message)}finally{i(!1)}},z=j!=null&&j.total?Math.round((j.sent+j.failed)/j.total*100):0,F=((j==null?void 0:j.pending)||0)>0||((j==null?void 0:j.processing)||0)>0,{data:q}=Yt({queryKey:["digest-delivery-stats"],queryFn:async()=>{var ye,ne;const Z=new Date;Z.setUTCHours(0,0,0,0);const[G,te,ie,le]=await Promise.all([J.from("weekly_digest_logs").select("id",{count:"exact",head:!0}).eq("delivery_status","sent").gte("sent_at",Z.toISOString()),J.from("weekly_digest_logs").select("id",{count:"exact",head:!0}).eq("delivery_status","failed").gte("sent_at",Z.toISOString()),J.from("weekly_digest_logs").select("id",{count:"exact",head:!0}).eq("has_agent_os_activity",!0).gte("sent_at",Z.toISOString()),J.from("weekly_digest_logs").select("sent_at").order("sent_at",{ascending:!1}).limit(1)]);return{totalSent:G.count||0,totalFailed:te.count||0,agentOsEngaged:ie.count||0,lastSent:((ne=(ye=le.data)==null?void 0:ye[0])==null?void 0:ne.sent_at)||null}},refetchInterval:F?5e3:!1}),H={totalSent:(q==null?void 0:q.totalSent)||0,totalFailed:(q==null?void 0:q.totalFailed)||0,lastSent:q==null?void 0:q.lastSent,agentOsEngaged:(q==null?void 0:q.agentOsEngaged)||0};return p?r.jsx(Lr,{title:"Weekly Digest",description:"Manage automated weekly email digests",children:r.jsxs("div",{className:"animate-pulse space-y-4",children:[r.jsx("div",{className:"h-32 bg-muted rounded-lg"}),r.jsx("div",{className:"h-64 bg-muted rounded-lg"})]})}):r.jsx(Lr,{title:"Weekly Digest",description:"Configure and manage automated weekly email digests for members",children:r.jsxs(Ii,{defaultValue:"settings",className:"space-y-6",children:[r.jsxs(wi,{children:[r.jsxs(ln,{value:"settings",className:"flex items-center gap-2",children:[r.jsx(fd,{className:"h-4 w-4"}),"Settings"]}),r.jsxs(ln,{value:"stats",className:"flex items-center gap-2",children:[r.jsx(cc,{className:"h-4 w-4"}),"Delivery Stats"]})]}),r.jsxs(An,{value:"settings",className:"space-y-6",children:[F&&j&&r.jsx(Ye,{className:"border-primary/50 bg-primary/5",children:r.jsxs(tt,{className:"pt-6",children:[r.jsxs("div",{className:"flex items-center gap-4 mb-4",children:[r.jsx(en,{className:"h-5 w-5 animate-spin text-primary"}),r.jsxs("div",{className:"flex-1",children:[r.jsx("p",{className:"font-medium",children:"Sending emails..."}),r.jsxs("p",{className:"text-sm text-muted-foreground",children:[j.sent.toLocaleString()," sent, ",j.pending.toLocaleString()," pending",j.failed>0&&`, ${j.failed} failed`]})]}),r.jsxs("span",{className:"text-sm font-medium",children:[z,"%"]})]}),r.jsx(Kc,{value:z,className:"h-2"}),r.jsxs("p",{className:"text-xs text-muted-foreground mt-2",children:["Processing ~80 emails per minute. Estimated time remaining: ~",Math.ceil(j.pending/80)," min"]})]})}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[r.jsx(Ye,{children:r.jsx(tt,{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:b}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Subscribers"})]})]})})}),r.jsx(Ye,{children:r.jsx(tt,{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:H.totalSent}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Delivered"})]})]})})}),r.jsx(Ye,{children:r.jsx(tt,{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(qc,{className:"h-5 w-5 text-destructive"})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-2xl font-bold",children:H.totalFailed}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Failed"})]})]})})}),r.jsx(Ye,{children:r.jsx(tt,{className:"pt-6",children:r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx("div",{className:"p-3 rounded-full bg-primary/10",children:r.jsx(Ya,{className:"h-5 w-5 text-primary"})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-2xl font-bold",children:H.lastSent?yn(new Date(H.lastSent),"MMM d"):"Never"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Last Sent"})]})]})})})]}),r.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[r.jsxs(Ye,{children:[r.jsxs(Gt,{children:[r.jsxs(Zt,{className:"flex items-center gap-2",children:[r.jsx(Ya,{className:"h-5 w-5"}),"Schedule"]}),r.jsx(Mn,{children:"Configure when the digest is sent"})]}),r.jsxs(tt,{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(He,{children:"Enable Weekly Digest"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Send automated weekly emails to members"})]}),r.jsx(Ps,{checked:h==null?void 0:h.is_enabled,onCheckedChange:Z=>A.mutate({is_enabled:Z})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Cron Frequency"}),r.jsxs(gn,{value:(h==null?void 0:h.cron_frequency)||"daily",onValueChange:Z=>A.mutate({cron_frequency:Z}),children:[r.jsx(fn,{children:r.jsx(xn,{})}),r.jsxs(pn,{children:[r.jsx(Vt,{value:"daily",children:"Daily (runs once at selected time)"}),r.jsx(Vt,{value:"hourly",children:"Hourly (checks every hour)"})]})]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:(h==null?void 0:h.cron_frequency)==="hourly"?"Cron runs every hour; digest sends when day & hour match.":"Cron runs once daily at the selected hour (UTC)."})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Day of Week"}),r.jsxs(gn,{value:String(h==null?void 0:h.send_day),onValueChange:Z=>A.mutate({send_day:parseInt(Z)}),children:[r.jsx(fn,{children:r.jsx(xn,{})}),r.jsx(pn,{children:oGt.map(Z=>r.jsx(Vt,{value:Z.value,children:Z.label},Z.value))})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Time (UTC)"}),r.jsxs(gn,{value:String(h==null?void 0:h.send_hour),onValueChange:Z=>A.mutate({send_hour:parseInt(Z)}),disabled:(h==null?void 0:h.cron_frequency)==="daily",children:[r.jsx(fn,{children:r.jsx(xn,{})}),r.jsx(pn,{children:lGt.map(Z=>r.jsx(Vt,{value:Z.value,children:Z.label},Z.value))})]})]})]}),r.jsxs("div",{className:"flex flex-col gap-2",children:[r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(ee,{onClick:T,disabled:a,variant:"outline",className:"flex-1",children:[r.jsx(Qo,{className:"h-4 w-4 mr-2"}),a?"Sending...":"Send Preview to Me"]}),r.jsxs(ee,{onClick:E,disabled:n,className:"flex-1",children:[r.jsx(Oo,{className:"h-4 w-4 mr-2"}),n?"Sending...":"Send to All"]})]}),N>0&&r.jsxs(ee,{onClick:L,disabled:l,variant:"outline",className:"w-full",children:[r.jsx(Gl,{className:`h-4 w-4 mr-2 ${l?"animate-spin":""}`}),l?"Retrying...":`Retry ${N} Failed`]})]})]})]}),r.jsxs(Ye,{children:[r.jsxs(Gt,{children:[r.jsxs(Zt,{className:"flex items-center gap-2",children:[r.jsx(La,{className:"h-5 w-5"}),"Content Sections"]}),r.jsx(Mn,{children:"Choose what to include in the digest"})]}),r.jsxs(tt,{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(La,{className:"h-4 w-4 text-muted-foreground"}),r.jsx(He,{children:"New Resources"})]}),r.jsx(Ps,{checked:h==null?void 0:h.include_new_resources,onCheckedChange:Z=>A.mutate({include_new_resources:Z})})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Bn,{className:"h-4 w-4 text-muted-foreground"}),r.jsx(He,{children:"Community Highlights"})]}),r.jsx(Ps,{checked:h==null?void 0:h.include_community_posts,onCheckedChange:Z=>A.mutate({include_community_posts:Z})})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(cc,{className:"h-4 w-4 text-muted-foreground"}),r.jsx(He,{children:"Agent OS Stats"})]}),r.jsx(Ps,{checked:h==null?void 0:h.include_agent_os_stats,onCheckedChange:Z=>A.mutate({include_agent_os_stats:Z})})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(zs,{className:"h-4 w-4 text-muted-foreground"}),r.jsx(He,{children:"Upcoming Events"})]}),r.jsx(Ps,{checked:h==null?void 0:h.include_upcoming_events,onCheckedChange:Z=>A.mutate({include_upcoming_events:Z})})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Hx,{className:"h-4 w-4 text-muted-foreground"}),r.jsx(He,{children:"Goals Progress"})]}),r.jsx(Ps,{checked:h==null?void 0:h.include_goals_progress,onCheckedChange:Z=>A.mutate({include_goals_progress:Z})})]})]})]})]}),r.jsxs(Ye,{children:[r.jsxs(Gt,{children:[r.jsx(Zt,{children:"Custom Introduction"}),r.jsx(Mn,{children:"Personalize the intro message (optional)"})]}),r.jsx(tt,{children:r.jsx(ps,{placeholder:"Here's what's new this week to help you grow your business...",value:(h==null?void 0:h.custom_intro_text)||"",onChange:Z=>A.mutate({custom_intro_text:Z.target.value||null}),rows:3})})]})]}),r.jsx(An,{value:"stats",children:r.jsxs(Ye,{children:[r.jsxs(Gt,{children:[r.jsxs(Zt,{className:"flex items-center gap-2",children:[r.jsx(da,{className:"h-5 w-5"}),"Delivery History"]}),r.jsx(Mn,{children:"Recent digest emails sent to members"})]}),r.jsx(tt,{children:y?r.jsx("div",{className:"animate-pulse space-y-2",children:[1,2,3,4,5].map(Z=>r.jsx("div",{className:"h-12 bg-muted rounded"},Z))}):x&&x.length>0?r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Ar,{children:[r.jsx(It,{children:"Email"}),r.jsx(It,{children:"Sent At"}),r.jsx(It,{children:"Status"}),r.jsx(It,{children:"Resources"}),r.jsx(It,{children:"Agent OS"})]})}),r.jsx(Vs,{children:x.map(Z=>r.jsxs(Ar,{children:[r.jsx(Nt,{className:"font-medium",children:Z.email_sent_to}),r.jsx(Nt,{children:yn(new Date(Z.sent_at),"MMM d, yyyy h:mm a")}),r.jsx(Nt,{children:r.jsx(Ot,{variant:Z.delivery_status==="sent"?"default":"destructive",children:Z.delivery_status})}),r.jsx(Nt,{children:Z.resources_count}),r.jsx(Nt,{children:Z.has_agent_os_activity?r.jsx(Ot,{variant:"secondary",children:"Active"}):r.jsx(Ot,{variant:"outline",children:"Not Started"})})]},Z.id))})]}):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 digests sent yet"}),r.jsx("p",{className:"text-sm",children:"Send your first digest to see delivery stats"})]})})]})})]})})}const dGt={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 uGt(){var be,me,Le;const t=Vr(),[e,n]=I.useState(""),[s,a]=I.useState(null),[o,l]=I.useState(!1),[i,h]=I.useState(!1),[p,x]=I.useState(""),[y,b]=I.useState(""),[j,C]=I.useState(!0),[N,A]=I.useState(!1),[E,T]=I.useState(""),[L,z]=I.useState(null),{data:F,isLoading:q}=Yt({queryKey:["admin-agent-points"],queryFn:async()=>{const{data:Ne,error:Be}=await J.from("agent_attendance_stats").select("*").order("total_points",{ascending:!1});if(Be)throw Be;const Ee=(Ne==null?void 0:Ne.map(je=>je.user_id))||[],{data:Ue}=await J.from("profiles").select("id, name, email").in("id",Ee),Re=new Map((Ue==null?void 0:Ue.map(je=>[je.id,{name:je.name,email:je.email}]))||[]);return Ne==null?void 0:Ne.map(je=>({...je,profile:Re.get(je.user_id)||null}))}}),{data:H}=Yt({queryKey:["all-profiles-for-points",F],queryFn:async()=>{const{data:Ne,error:Be}=await J.from("profiles").select("id, name, email").order("name");if(Be)throw Be;return Ne}}),G=((H==null?void 0:H.filter(Ne=>!(F!=null&&F.some(Be=>Be.user_id===Ne.id))))||[]).filter(Ne=>{var Ee,Ue;if(!E)return!0;const Be=E.toLowerCase();return((Ee=Ne.name)==null?void 0:Ee.toLowerCase().includes(Be))||((Ue=Ne.email)==null?void 0:Ue.toLowerCase().includes(Be))}),{data:te,isLoading:ie}=Yt({queryKey:["agent-point-history",s==null?void 0:s.user_id],queryFn:async()=>{if(!(s!=null&&s.user_id))return[];const{data:Ne,error:Be}=await J.from("agent_points").select("*").eq("user_id",s.user_id).order("created_at",{ascending:!1});if(Be)throw Be;return Ne},enabled:!!(s!=null&&s.user_id)&&i}),{data:le}=Yt({queryKey:["agent-badges",s==null?void 0:s.user_id],queryFn:async()=>{if(!(s!=null&&s.user_id))return[];const{data:Ne,error:Be}=await J.from("agent_badges").select("*").eq("user_id",s.user_id).order("earned_at",{ascending:!1});if(Be)throw Be;return Ne},enabled:!!(s!=null&&s.user_id)}),ye=cr({mutationFn:async({userId:Ne,points:Be,reason:Ee})=>{const{error:Ue}=await J.from("agent_points").insert({user_id:Ne,points:Be,reason:Ee});if(Ue)throw Ue;const{data:Re}=await J.from("agent_attendance_stats").select("total_points, spendable_points").eq("user_id",Ne).maybeSingle(),je=((Re==null?void 0:Re.total_points)||0)+Be,et=((Re==null?void 0:Re.spendable_points)||0)+Be,{error:Te}=await J.from("agent_attendance_stats").upsert({user_id:Ne,total_points:Math.max(0,je),spendable_points:Math.max(0,et),updated_at:new Date().toISOString()},{onConflict:"user_id"});if(Te)throw Te},onSuccess:()=>{t.invalidateQueries({queryKey:["admin-agent-points"]}),t.invalidateQueries({queryKey:["agent-point-history"]}),l(!1),x(""),b(""),ze.success(j?"Points awarded successfully!":"Points deducted successfully!")},onError:Ne=>{console.error("Error modifying points:",Ne),ze.error("Failed to modify points")}}),ne=()=>{if(!s||!p||!y){ze.error("Please fill in all fields");return}const Ne=parseInt(p);if(isNaN(Ne)||Ne<=0){ze.error("Please enter a valid positive number");return}ye.mutate({userId:s.user_id,points:j?Ne:-Ne,reason:y})},ge=()=>{if(!L||!p||!y){ze.error("Please fill in all fields");return}const Ne=parseInt(p);if(isNaN(Ne)||Ne<=0){ze.error("Please enter a valid positive number");return}ye.mutate({userId:L.id,points:Ne,reason:y},{onSuccess:()=>{A(!1),z(null),T("")}})},ae=(Ne,Be)=>{a(Ne),C(Be),l(!0)},he=Ne=>{a(Ne),h(!0)},ue=F==null?void 0:F.filter(Ne=>{var Re,je,et,Te;const Be=((je=(Re=Ne.profile)==null?void 0:Re.name)==null?void 0:je.toLowerCase())||"",Ee=((Te=(et=Ne.profile)==null?void 0:et.email)==null?void 0:Te.toLowerCase())||"",Ue=e.toLowerCase();return Be.includes(Ue)||Ee.includes(Ue)}),_e=(F==null?void 0:F.reduce((Ne,Be)=>Ne+Be.total_points,0))||0,Ae=(F==null?void 0:F.length)||0,Ce=Ae>0?Math.round(_e/Ae):0;return q?r.jsx(Lr,{title:"Agent Points",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Ir,{className:"h-8 w-64"}),r.jsx("div",{className:"grid grid-cols-3 gap-4",children:[1,2,3].map(Ne=>r.jsx(Ir,{className:"h-24"},Ne))}),r.jsx(Ir,{className:"h-96"})]})}):r.jsx(Lr,{title:"Agent Points",children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold text-foreground",children:"Agent Points Management"}),r.jsx("p",{className:"text-muted-foreground",children:"Track, view, and manage agent gamification points"})]}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[r.jsx(Ye,{children:r.jsxs(tt,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(Bn,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs font-medium",children:"Total Agents"})]}),r.jsx("p",{className:"text-2xl font-bold",children:Ae}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"with points tracked"})]})}),r.jsx(Ye,{children:r.jsxs(tt,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(Zi,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs font-medium",children:"Total Points"})]}),r.jsx("p",{className:"text-2xl font-bold",children:_e.toLocaleString()}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"awarded across all agents"})]})}),r.jsx(Ye,{children:r.jsxs(tt,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(Xf,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs font-medium",children:"Average Points"})]}),r.jsx("p",{className:"text-2xl font-bold",children:Ce}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"per agent"})]})})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 items-start sm:items-center justify-between",children:[r.jsxs("div",{className:"relative max-w-sm w-full",children:[r.jsx(wa,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(dt,{placeholder:"Search agents...",value:e,onChange:Ne=>n(Ne.target.value),className:"pl-10"})]}),r.jsxs(ee,{onClick:()=>A(!0),children:[r.jsx(bn,{className:"h-4 w-4 mr-2"}),"Award Points to New Agent"]})]}),r.jsxs(Ye,{children:[r.jsxs(Gt,{children:[r.jsx(Zt,{children:"Agent Leaderboard"}),r.jsx(Mn,{children:"All agents with their points, events, and streaks"})]}),r.jsx(tt,{children:!ue||ue.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(Zi,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),r.jsx("p",{children:"No agents with points yet"})]}):r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Ar,{children:[r.jsx(It,{className:"w-12",children:"#"}),r.jsx(It,{children:"Agent"}),r.jsx(It,{className:"text-center",children:"Total Points"}),r.jsx(It,{className:"text-center",children:"Spendable"}),r.jsx(It,{className:"text-center",children:"Events"}),r.jsx(It,{className:"text-center",children:"Streak"}),r.jsx(It,{className:"text-right",children:"Actions"})]})}),r.jsx(Vs,{children:ue.map((Ne,Be)=>{var Ee,Ue,Re,je;return r.jsxs(Ar,{children:[r.jsx(Nt,{className:"font-medium",children:Be<3?r.jsx("div",{className:`w-6 h-6 rounded-full flex items-center justify-center ${Be===0?"bg-yellow-100 text-yellow-700":Be===1?"bg-gray-100 text-gray-600":"bg-amber-100 text-amber-700"}`,children:Be+1}):r.jsx("span",{className:"text-muted-foreground",children:Be+1})}),r.jsx(Nt,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(Ks,{className:"h-8 w-8",children:r.jsx(Zs,{children:((Ue=(Ee=Ne.profile)==null?void 0:Ee.name)==null?void 0:Ue.charAt(0))||"?"})}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:((Re=Ne.profile)==null?void 0:Re.name)||"Unknown"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:(je=Ne.profile)==null?void 0:je.email})]})]})}),r.jsx(Nt,{className:"text-center",children:r.jsxs(Ot,{variant:"secondary",className:"font-bold",children:[r.jsx(vs,{className:"h-3 w-3 mr-1"}),Ne.total_points]})}),r.jsx(Nt,{className:"text-center",children:r.jsxs(Ot,{variant:"outline",className:"font-bold text-primary",children:[r.jsx(Ki,{className:"h-3 w-3 mr-1"}),Ne.spendable_points||0]})}),r.jsx(Nt,{className:"text-center",children:r.jsxs("div",{className:"flex items-center justify-center gap-1",children:[r.jsx(zs,{className:"h-3 w-3 text-muted-foreground"}),Ne.total_events_attended]})}),r.jsx(Nt,{className:"text-center",children:r.jsxs("div",{className:"flex items-center justify-center gap-1",children:[r.jsx(Jh,{className:"h-3 w-3 text-orange-500"}),Ne.current_streak]})}),r.jsx(Nt,{className:"text-right",children:r.jsxs("div",{className:"flex items-center justify-end gap-1",children:[r.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>ae(Ne,!0),title:"Award points",children:r.jsx(bn,{className:"h-4 w-4 text-green-600"})}),r.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>ae(Ne,!1),title:"Deduct points",children:r.jsx(_1,{className:"h-4 w-4 text-red-600"})}),r.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>he(Ne),title:"View history",children:r.jsx(nS,{className:"h-4 w-4"})})]})})]},Ne.user_id)})})]})})]}),r.jsx(Fr,{open:o,onOpenChange:l,children:r.jsxs(Rr,{children:[r.jsxs(qr,{children:[r.jsx($r,{children:j?"Award Points":"Deduct Points"}),r.jsxs(Xn,{children:[j?"Award":"Deduct"," points ",j?"to":"from"," ",((be=s==null?void 0:s.profile)==null?void 0:be.name)||"this agent"]})]}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"points",children:"Points Amount"}),r.jsx(dt,{id:"points",type:"number",min:"1",placeholder:"Enter points...",value:p,onChange:Ne=>x(Ne.target.value)})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"reason",children:"Reason"}),r.jsx(ps,{id:"reason",placeholder:"Enter reason for this adjustment...",value:y,onChange:Ne=>b(Ne.target.value)})]})]}),r.jsxs(ea,{children:[r.jsx(ee,{variant:"outline",onClick:()=>l(!1),children:"Cancel"}),r.jsx(ee,{onClick:ne,disabled:ye.isPending,className:j?"bg-green-600 hover:bg-green-700":"bg-red-600 hover:bg-red-700",children:ye.isPending?"Saving...":j?"Award Points":"Deduct Points"})]})]})}),r.jsx(Fr,{open:i,onOpenChange:h,children:r.jsxs(Rr,{className:"max-w-2xl",children:[r.jsxs(qr,{children:[r.jsxs($r,{children:["Point History: ",(me=s==null?void 0:s.profile)==null?void 0:me.name]}),r.jsx(Xn,{children:"View all point transactions and badges for this agent"})]}),r.jsxs(Ii,{defaultValue:"history",className:"w-full",children:[r.jsxs(wi,{className:"grid w-full grid-cols-2",children:[r.jsx(ln,{value:"history",children:"Point History"}),r.jsx(ln,{value:"badges",children:"Badges"})]}),r.jsx(An,{value:"history",className:"mt-4",children:ie?r.jsx("div",{className:"space-y-2",children:[1,2,3].map(Ne=>r.jsx(Ir,{className:"h-12"},Ne))}):!te||te.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(nS,{className:"h-8 w-8 mx-auto mb-2 opacity-50"}),r.jsx("p",{children:"No point history yet"})]}):r.jsx("div",{className:"max-h-80 overflow-y-auto space-y-2",children:te.map(Ne=>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:Ne.reason}),r.jsx("p",{className:"text-xs text-muted-foreground",children:yn(new Date(Ne.created_at),"MMM d, yyyy h:mm a")})]}),r.jsxs(Ot,{variant:Ne.points>=0?"default":"destructive",className:Ne.points>=0?"bg-green-100 text-green-800":"",children:[Ne.points>=0?"+":"",Ne.points]})]},Ne.id))})}),r.jsx(An,{value:"badges",className:"mt-4",children:!le||le.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(Ol,{className:"h-8 w-8 mx-auto mb-2 opacity-50"}),r.jsx("p",{children:"No badges earned yet"})]}):r.jsx("div",{className:"grid grid-cols-2 gap-3",children:le.map(Ne=>r.jsxs("div",{className:`p-3 rounded-lg ${dGt[Ne.badge_type]||"bg-gray-100"}`,children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ol,{className:"h-5 w-5"}),r.jsx("span",{className:"font-medium",children:Ne.badge_name})]}),Ne.badge_description&&r.jsx("p",{className:"text-xs mt-1 opacity-80",children:Ne.badge_description}),r.jsxs("p",{className:"text-xs mt-1 opacity-60",children:["Earned ",yn(new Date(Ne.earned_at),"MMM d, yyyy")]})]},Ne.id))})})]})]})}),r.jsx(Fr,{open:N,onOpenChange:Ne=>{A(Ne),Ne||(z(null),T(""),x(""),b(""))},children:r.jsxs(Rr,{className:"max-w-md",children:[r.jsxs(qr,{children:[r.jsx($r,{children:"Award Points to New Agent"}),r.jsx(Xn,{children:"Select an agent who doesn't have points yet and award them points"})]}),r.jsx("div",{className:"space-y-4 py-4",children:L?r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"flex items-center gap-3 p-3 bg-muted/50 rounded-lg",children:[r.jsx(Ks,{className:"h-10 w-10",children:r.jsx(Zs,{children:((Le=L.name)==null?void 0:Le.charAt(0))||"?"})}),r.jsxs("div",{className:"flex-1",children:[r.jsx("p",{className:"font-medium",children:L.name||"Unknown"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:L.email})]}),r.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>z(null),children:"Change"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"new-points",children:"Points Amount"}),r.jsx(dt,{id:"new-points",type:"number",min:"1",placeholder:"Enter points...",value:p,onChange:Ne=>x(Ne.target.value)})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"new-reason",children:"Reason"}),r.jsx(ps,{id:"new-reason",placeholder:"Enter reason for awarding points...",value:y,onChange:Ne=>b(Ne.target.value)})]})]}):r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Search Agent"}),r.jsxs("div",{className:"relative",children:[r.jsx(wa,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(dt,{placeholder:"Search by name or email...",value:E,onChange:Ne=>T(Ne.target.value),className:"pl-10"})]})]}),r.jsx("div",{className:"max-h-60 overflow-y-auto border rounded-lg",children:G.length===0?r.jsxs("div",{className:"text-center py-4 text-muted-foreground",children:[r.jsx(Bn,{className:"h-6 w-6 mx-auto mb-2 opacity-50"}),r.jsx("p",{className:"text-sm",children:E?"No matching agents found":"All agents already have points"})]}):G.slice(0,20).map(Ne=>{var Be;return r.jsxs("button",{onClick:()=>z(Ne),className:"w-full flex items-center gap-3 p-3 hover:bg-muted/50 transition-colors border-b last:border-b-0 text-left",children:[r.jsx(Ks,{className:"h-8 w-8",children:r.jsx(Zs,{children:((Be=Ne.name)==null?void 0:Be.charAt(0))||"?"})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"font-medium truncate",children:Ne.name||"Unknown"}),r.jsx("p",{className:"text-xs text-muted-foreground truncate",children:Ne.email})]})]},Ne.id)})})]})}),r.jsxs(ea,{children:[r.jsx(ee,{variant:"outline",onClick:()=>A(!1),children:"Cancel"}),L&&r.jsxs(ee,{onClick:ge,disabled:ye.isPending,className:"bg-green-600 hover:bg-green-700",children:[r.jsx(bn,{className:"h-4 w-4 mr-2"}),"Award Points"]})]})]})})]})})}function hGt(){const{data:t,isLoading:e}=Tit(),[n,s]=I.useState(null),[a,o]=I.useState(!1),[l,i]=I.useState(""),[h,p]=I.useState("all"),[x,y]=I.useState("newest"),b=I.useMemo(()=>(t==null?void 0:t.map(E=>E.user_id))||[],[t]),j=I.useMemo(()=>(t==null?void 0:t.map(E=>E.id))||[],[t]),{data:C}=Yt({queryKey:["card-profiles-lookup",b],queryFn:async()=>{if(b.length===0)return{};const{data:E}=await J.from("profiles").select("id, name, email").in("id",b),T={};return E==null||E.forEach(L=>{T[L.id]={name:L.name||"",email:L.email||""}}),T},enabled:b.length>0}),{data:N}=Yt({queryKey:["card-stats-all",j],queryFn:async()=>{if(j.length===0)return{};const E={};j.forEach(z=>{E[z]={views:0,leads:0}});const{data:T}=await J.from("agent_card_interactions").select("card_id").in("card_id",j).eq("interaction_type","card_view");T==null||T.forEach(z=>{E[z.card_id]&&E[z.card_id].views++});const{data:L}=await J.from("agent_card_leads").select("card_id").in("card_id",j);return L==null||L.forEach(z=>{E[z.card_id]&&E[z.card_id].leads++}),E},enabled:j.length>0}),A=I.useMemo(()=>{if(!t)return[];let E=[...t];if(h==="live"?E=E.filter(T=>T.is_published):h==="draft"&&(E=E.filter(T=>!T.is_published)),l.trim()){const T=l.toLowerCase();E=E.filter(L=>{var F,q;const z=C==null?void 0:C[L.user_id];return L.slug.toLowerCase().includes(T)||((F=z==null?void 0:z.name)==null?void 0:F.toLowerCase().includes(T))||((q=z==null?void 0:z.email)==null?void 0:q.toLowerCase().includes(T))})}return x==="newest"?E.sort((T,L)=>new Date(L.created_at).getTime()-new Date(T.created_at).getTime()):x==="oldest"?E.sort((T,L)=>new Date(T.created_at).getTime()-new Date(L.created_at).getTime()):x==="name"?E.sort((T,L)=>{var z,F;return(((z=C==null?void 0:C[T.user_id])==null?void 0:z.name)||"").localeCompare(((F=C==null?void 0:C[L.user_id])==null?void 0:F.name)||"")}):x==="slug"&&E.sort((T,L)=>T.slug.localeCompare(L.slug)),E},[t,h,l,x,C]);return r.jsxs(Lr,{title:"Digital Agent Cards",children:[r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold",children:"Digital Agent Cards"}),r.jsx("p",{className:"text-muted-foreground",children:"Create and manage agent digital business cards"})]}),r.jsxs(ee,{onClick:()=>o(!0),children:[r.jsx(bn,{className:"h-4 w-4 mr-2"}),"Create Card"]})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[r.jsxs("div",{className:"relative flex-1",children:[r.jsx(wa,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(dt,{placeholder:"Search by name, email, or slug...",value:l,onChange:E=>i(E.target.value),className:"pl-9"})]}),r.jsxs(gn,{value:h,onValueChange:p,children:[r.jsx(fn,{className:"w-full sm:w-36",children:r.jsx(xn,{placeholder:"Status"})}),r.jsxs(pn,{children:[r.jsx(Vt,{value:"all",children:"All Status"}),r.jsx(Vt,{value:"live",children:"Live"}),r.jsx(Vt,{value:"draft",children:"Draft"})]})]}),r.jsxs(gn,{value:x,onValueChange:y,children:[r.jsx(fn,{className:"w-full sm:w-40",children:r.jsx(xn,{placeholder:"Sort by"})}),r.jsxs(pn,{children:[r.jsx(Vt,{value:"newest",children:"Newest First"}),r.jsx(Vt,{value:"oldest",children:"Oldest First"}),r.jsx(Vt,{value:"name",children:"Name A–Z"}),r.jsx(Vt,{value:"slug",children:"Slug A–Z"})]})]})]}),!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(E=>r.jsx(Ir,{className:"h-48"},E))}):A.length>0?r.jsx("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:A.map(E=>r.jsx(fGt,{card:E,onEdit:()=>s(E),stats:N==null?void 0:N[E.id]},E.id))}):t&&t.length>0?r.jsx(Ye,{children:r.jsxs(tt,{className:"flex flex-col items-center justify-center py-12",children:[r.jsx(wa,{className:"h-12 w-12 text-muted-foreground mb-4"}),r.jsx("h3",{className:"text-lg font-semibold mb-1",children:"No matching cards"}),r.jsx("p",{className:"text-muted-foreground text-sm",children:"Try adjusting your search or filters"})]})}):r.jsx(Ye,{children:r.jsxs(tt,{className:"flex flex-col items-center justify-center py-12",children:[r.jsx(Bn,{className:"h-12 w-12 text-muted-foreground mb-4"}),r.jsx("h3",{className:"text-lg font-semibold mb-1",children:"No cards yet"}),r.jsx("p",{className:"text-muted-foreground text-sm mb-4",children:"Create your first digital agent card"}),r.jsxs(ee,{onClick:()=>o(!0),children:[r.jsx(bn,{className:"h-4 w-4 mr-2"}),"Create Card"]})]})})]}),r.jsx(pGt,{open:a,onOpenChange:o}),n&&r.jsx(mGt,{card:n,open:!!n,onOpenChange:E=>!E&&s(null)})]})}function fGt({card:t,onEdit:e,stats:n}){const[s,a]=I.useState(null);I.useEffect(()=>{(async()=>{const{data:h}=await J.from("profiles").select("name").eq("id",t.user_id).single();let p=null;try{const{data:x}=await J.storage.from("avatars").list(`${t.user_id}`);if(x&&x.length>0){const{data:y}=J.storage.from("avatars").getPublicUrl(`${t.user_id}/${x[0].name}`);p=y.publicUrl}}catch{}a({name:(h==null?void 0:h.name)||"Unknown",avatar_url:p})})()},[t.user_id]);const o=`https://cards.relevelup.com/${t.slug}`,l=()=>{navigator.clipboard.writeText(o),ze.success("Link copied!")};return r.jsx(Ye,{children:r.jsxs(tt,{className:"p-4",children:[r.jsxs("div",{className:"flex items-start gap-3 mb-3",children:[r.jsxs(Ks,{className:"h-10 w-10",children:[r.jsx(Ei,{src:(s==null?void 0:s.avatar_url)||void 0}),r.jsx(Zs,{children:((s==null?void 0:s.name)||"U")[0]})]}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("h3",{className:"font-semibold truncate",children:(s==null?void 0:s.name)||"Loading..."}),r.jsxs("p",{className:"text-xs text-muted-foreground truncate",children:["/card/",t.slug]})]}),r.jsx(Ot,{variant:t.is_published?"default":"secondary",children:t.is_published?"Live":"Draft"})]}),r.jsxs("div",{className:"flex items-center gap-3 mb-3 text-xs text-muted-foreground",children:[r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Qo,{className:"h-3.5 w-3.5"}),(n==null?void 0:n.views)??0," views"]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Bn,{className:"h-3.5 w-3.5"}),(n==null?void 0:n.leads)??0," leads"]})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(ee,{variant:"outline",size:"sm",onClick:e,className:"flex-1",children:[r.jsx(_i,{className:"h-3 w-3 mr-1"}),"Edit"]}),r.jsx(ee,{variant:"outline",size:"sm",onClick:l,children:r.jsx(hl,{className:"h-3 w-3"})}),r.jsx(ee,{variant:"outline",size:"sm",asChild:!0,children:r.jsx("a",{href:o,target:"_blank",rel:"noopener noreferrer",children:r.jsx(Fs,{className:"h-3 w-3"})})})]})]})})}function pGt({open:t,onOpenChange:e}){const[n,s]=I.useState(""),[a,o]=I.useState(""),[l,i]=I.useState(""),[h,p]=I.useState(!1),x=hLe(),y=l.trim(),{data:b}=Yt({queryKey:["profiles-search-for-cards",y],queryFn:async()=>{let T=J.from("profiles").select("id, name, email").order("name").limit(50);y.length>=2&&(T=T.or(`name.ilike.%${y}%,email.ilike.%${y}%`));const{data:L}=await T;return L||[]},enabled:t}),[j,C]=I.useState(null),N=(b==null?void 0:b.find(T=>T.id===n))||j,A=()=>{if(!n||!a.trim()){ze.error("Select an agent and enter a slug");return}x.mutate({user_id:n,slug:a.trim().toLowerCase().replace(/[^a-z0-9-]/g,"-"),is_published:!0},{onSuccess:()=>{e(!1),s(""),o(""),i("")}})},E=T=>{var z;s(T),p(!1);const L=b==null?void 0:b.find(F=>F.id===T);L&&(C(L),o(((z=L.name)==null?void 0:z.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/(^-|-$)/g,""))||""))};return r.jsx(Fr,{open:t,onOpenChange:e,children:r.jsxs(Rr,{children:[r.jsxs(qr,{children:[r.jsx($r,{children:"Create Agent Card"}),r.jsx(Xn,{children:"Select an agent and set their card URL slug."})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx(He,{children:"Agent"}),r.jsxs(zu,{open:h,onOpenChange:p,children:[r.jsx(Bu,{asChild:!0,children:r.jsxs(ee,{variant:"outline",role:"combobox","aria-expanded":h,className:"w-full justify-between font-normal",children:[N?`${N.name} (${N.email})`:"Search for an agent...",r.jsx(d1,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),r.jsx(uu,{className:"w-[--radix-popover-trigger-width] p-0",align:"start",children:r.jsxs(q1,{shouldFilter:!1,children:[r.jsx(V1,{placeholder:"Search by name or email...",value:l,onValueChange:i}),r.jsxs(H1,{children:[r.jsx(W1,{children:"No agents found."}),r.jsx(G1,{children:(b||[]).map(T=>r.jsxs(K1,{value:T.id,onSelect:E,children:[r.jsx(Ai,{className:$t("mr-2 h-4 w-4",n===T.id?"opacity-100":"opacity-0")}),T.name," (",T.email,")"]},T.id))})]})]})})]})]}),r.jsxs("div",{children:[r.jsx(He,{children:"URL Slug"}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-sm text-muted-foreground",children:"/card/"}),r.jsx(dt,{value:a,onChange:T=>o(T.target.value),placeholder:"john-doe"})]})]}),r.jsx(ee,{onClick:A,disabled:x.isPending,className:"w-full",children:x.isPending?"Creating...":"Create Card"})]})]})})}function mGt({card:t,open:e,onOpenChange:n}){const s=fLe(),{data:a}=pLe(t.id),o=Vr(),[l,i]=I.useState(null),[h,p]=I.useState(!1),[x,y]=I.useState(!1),[b,j]=I.useState(""),[C,N]=I.useState(t.slug),[A,E]=I.useState(!1),[T,L]=I.useState({is_published:t.is_published,theme:t.theme,title:t.title||"",positioning_statement:t.positioning_statement||"",bio:t.bio||"",review_snippet:t.review_snippet||"",review_source_url:t.review_source_url||"",booking_url:t.booking_url||"",custom_cta_label:t.custom_cta_label||"",custom_cta_url:t.custom_cta_url||"",show_photo:t.show_photo,show_bio:t.show_bio,show_credentials:t.show_credentials,show_social_links:t.show_social_links,show_save_contact:t.show_save_contact,show_leave_review:t.show_leave_review,show_refer_friend:t.show_refer_friend,brokerage_display_name:t.brokerage_display_name||"",brokerage_logo_url:t.brokerage_logo_url||"",brokerage_logo_size:t.brokerage_logo_size||56,team_name:t.team_name||"",team_logo_url:t.team_logo_url||"",team_logo_size:t.team_logo_size||56});I.useEffect(()=>{e&&(async()=>{try{const{data:te}=await J.storage.from("avatars").list(`${t.user_id}`);if(te&&te.length>0){const{data:ie}=J.storage.from("avatars").getPublicUrl(`${t.user_id}/${te[0].name}`);i(`${ie.publicUrl}?t=${Date.now()}`)}}catch{}})()},[t.user_id,e]);const z=G=>{var le;const te=(le=G.target.files)==null?void 0:le[0];if(!te)return;if(!te.type.startsWith("image/")){ze.error("Please select an image file");return}if(te.size>5*1024*1024){ze.error("Image must be under 5MB");return}const ie=new FileReader;ie.onloadend=()=>{j(ie.result),y(!0)},ie.readAsDataURL(te),G.target.value=""},F=async G=>{p(!0);try{const{data:te}=await J.storage.from("avatars").list(`${t.user_id}`);te&&te.length>0&&await J.storage.from("avatars").remove(te.map(ge=>`${t.user_id}/${ge.name}`));const ie=`${t.user_id}/avatar.jpg`,{error:le}=await J.storage.from("avatars").upload(ie,G,{upsert:!0,contentType:"image/jpeg"});if(le)throw le;const{data:ye}=J.storage.from("avatars").getPublicUrl(ie),ne=`${ye.publicUrl}?t=${Date.now()}`;i(ne),await J.from("profiles").update({avatar_url:ne}).eq("id",t.user_id),o.invalidateQueries({queryKey:["agent-card-public"]}),ze.success("Photo updated!")}catch(te){ze.error(te.message||"Upload failed")}finally{p(!1)}},q=async()=>{const G=C.trim().toLowerCase().replace(/[^a-z0-9-]/g,"-").replace(/-+/g,"-").replace(/(^-|-$)/g,"");if(!G){ze.error("Please enter a valid URL");return}if(G===t.slug){ze.info("No changes to save");return}E(!0);try{const{data:te}=await J.from("agent_cards").select("id").eq("slug",G).neq("id",t.id).maybeSingle();if(te){ze.error("This URL is already taken. Try another one.");return}const{error:ie}=await J.from("agent_cards").update({slug:G}).eq("id",t.id);if(ie)throw ie;N(G),o.invalidateQueries({queryKey:["agent-cards-admin"]}),ze.success("Card address updated!")}catch{ze.error("Failed to update card address")}finally{E(!1)}},H=async(G,te)=>{var le;const ie=(le=G.target.files)==null?void 0:le[0];if(ie){if(!ie.type.startsWith("image/")){ze.error("Please select an image file");return}try{const ye=ie.name.split(".").pop()||"png",ne=te==="brokerage_logo_url"?"brokerage-logo":"team-logo",ge=`${t.user_id}/${ne}.${ye}`,{error:ae}=await J.storage.from("card-logos").upload(ge,ie,{upsert:!0});if(ae)throw ae;const{data:he}=J.storage.from("card-logos").getPublicUrl(ge),ue=he.publicUrl+"?t="+Date.now();L(te==="brokerage_logo_url"?_e=>({..._e,[te]:ue,brokerage_display_name:""}):_e=>({..._e,[te]:ue,team_name:""})),ze.success("Logo uploaded!")}catch{ze.error("Failed to upload logo")}finally{G.target.value=""}}},Z=()=>{s.mutate({id:t.id,...T,title:T.title||null,positioning_statement:T.positioning_statement||null,bio:T.bio||null,review_snippet:T.review_snippet||null,review_source_url:T.review_source_url||null,booking_url:T.booking_url||null,custom_cta_label:T.custom_cta_label||null,custom_cta_url:T.custom_cta_url||null,brokerage_display_name:T.brokerage_display_name||null,brokerage_logo_url:T.brokerage_logo_url||null,brokerage_logo_size:T.brokerage_logo_size,team_name:T.team_name||null,team_logo_url:T.team_logo_url||null,team_logo_size:T.team_logo_size},{onSuccess:()=>n(!1)})};return r.jsxs(r.Fragment,{children:[r.jsx(Fr,{open:e,onOpenChange:n,children:r.jsxs(Rr,{className:"max-w-2xl max-h-[85vh] overflow-y-auto",children:[r.jsxs(qr,{children:[r.jsx($r,{children:"Edit Agent Card"}),r.jsxs(Xn,{children:["/card/",t.slug]})]}),r.jsxs(Ii,{defaultValue:"content",children:[r.jsxs(wi,{className:"w-full",children:[r.jsx(ln,{value:"content",className:"flex-1",children:"Content"}),r.jsx(ln,{value:"sections",className:"flex-1",children:"Sections"}),r.jsx(ln,{value:"blocks",className:"flex-1",children:"Blocks"}),r.jsx(ln,{value:"analytics",className:"flex-1",children:"Analytics"})]}),r.jsxs(An,{value:"content",className:"space-y-4 mt-4",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(He,{children:"Published"}),r.jsx(Ps,{checked:T.is_published,onCheckedChange:G=>L(te=>({...te,is_published:G}))})]}),r.jsxs("div",{children:[r.jsx(He,{children:"Agent Photo"}),r.jsxs("div",{className:"flex items-center gap-4 mt-1",children:[r.jsxs(Ks,{className:"h-16 w-16",children:[r.jsx(Ei,{src:l||void 0}),r.jsx(Zs,{children:"?"})]}),r.jsxs("label",{className:"cursor-pointer",children:[r.jsx("input",{type:"file",accept:"image/*",className:"hidden",onChange:z,disabled:h}),r.jsx(ee,{variant:"outline",size:"sm",asChild:!0,disabled:h,children:r.jsx("span",{children:h?r.jsxs(r.Fragment,{children:[r.jsx(en,{className:"h-3 w-3 mr-1 animate-spin"}),"Uploading..."]}):r.jsxs(r.Fragment,{children:[r.jsx(uo,{className:"h-3 w-3 mr-1"}),"Change Photo"]})})})]})]})]}),r.jsxs("div",{children:[r.jsx(He,{children:"Card Address"}),r.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[r.jsxs("div",{className:"flex flex-1",children:[r.jsx("span",{className:"inline-flex items-center px-3 rounded-l-md border border-r-0 bg-muted text-muted-foreground text-xs whitespace-nowrap",children:"cards.relevelup.com/"}),r.jsx(dt,{value:C,onChange:G=>N(G.target.value.toLowerCase().replace(/[^a-z0-9-]/g,"-")),placeholder:"agent-name",className:"rounded-l-none"})]}),r.jsx(ee,{variant:"outline",size:"sm",onClick:q,disabled:A||C===t.slug,className:"shrink-0",children:A?"Saving...":"Update"})]})]}),r.jsxs("div",{children:[r.jsx(He,{children:"Theme"}),r.jsxs(gn,{value:T.theme,onValueChange:G=>L(te=>({...te,theme:G})),children:[r.jsx(fn,{children:r.jsx(xn,{})}),r.jsxs(pn,{children:[r.jsx(Vt,{value:"standard",children:"✨ Standard (Modern Clean)"}),r.jsx(Vt,{value:"luxury",children:"🌙 Luxury (Dark & Gold)"}),r.jsx(Vt,{value:"bold",children:"🔥 Bold (Vibrant & Punchy)"}),r.jsx(Vt,{value:"classic",children:"📋 Classic (Professional)"})]})]})]}),r.jsxs("div",{children:[r.jsx(He,{children:"Title / Tagline"}),r.jsx(dt,{value:T.title,onChange:G=>L(te=>({...te,title:G.target.value})),placeholder:"e.g. Luxury Real Estate Specialist"}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Shown below the agent's name on the card"})]}),r.jsxs("div",{children:[r.jsx(He,{children:"Positioning Statement"}),r.jsx(dt,{value:T.positioning_statement,onChange:G=>L(te=>({...te,positioning_statement:G.target.value})),placeholder:"Your home journey, handled with care."})]}),r.jsxs("div",{children:[r.jsx(He,{children:"Bio"}),r.jsx(ps,{value:T.bio,onChange:G=>L(te=>({...te,bio:G.target.value})),placeholder:"Short about me...",rows:3})]}),r.jsxs("div",{children:[r.jsx(He,{children:"Review Snippet"}),r.jsx(dt,{value:T.review_snippet,onChange:G=>L(te=>({...te,review_snippet:G.target.value})),placeholder:"Best agent we've ever worked with..."})]}),r.jsxs("div",{children:[r.jsx(He,{children:"Review Source URL"}),r.jsx(dt,{value:T.review_source_url,onChange:G=>L(te=>({...te,review_source_url:G.target.value})),placeholder:"https://g.page/your-business/review"})]}),r.jsxs("div",{children:[r.jsx(He,{children:"Booking URL (optional — if empty, shows lead form)"}),r.jsx(dt,{value:T.booking_url,onChange:G=>L(te=>({...te,booking_url:G.target.value})),placeholder:"https://calendly.com/your-link"})]}),r.jsxs("div",{children:[r.jsx(He,{children:"Custom CTA Label (optional)"}),r.jsx(dt,{value:T.custom_cta_label,onChange:G=>L(te=>({...te,custom_cta_label:G.target.value})),placeholder:"Book a Call"})]}),r.jsxs("div",{children:[r.jsx(He,{children:"Custom CTA URL (optional)"}),r.jsx(dt,{value:T.custom_cta_url,onChange:G=>L(te=>({...te,custom_cta_url:G.target.value})),placeholder:"https://example.com/landing"})]}),r.jsxs("div",{className:"space-y-3 p-3 rounded-lg bg-muted/30 border",children:[r.jsx(He,{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:"Brokerage Branding"}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(dt,{value:T.brokerage_display_name,onChange:G=>L(te=>({...te,brokerage_display_name:G.target.value,brokerage_logo_url:""})),placeholder:"Brokerage name (or upload logo below)",disabled:!!T.brokerage_logo_url}),r.jsxs("div",{className:"flex items-center gap-3",children:[T.brokerage_logo_url&&r.jsxs("div",{className:"relative group",children:[r.jsx("img",{src:T.brokerage_logo_url,alt:"Brokerage logo",style:{height:`${T.brokerage_logo_size||56}px`},className:"max-w-[200px] object-contain rounded border bg-white p-1"}),r.jsx("button",{onClick:()=>L(G=>({...G,brokerage_logo_url:""})),className:"absolute -top-1.5 -right-1.5 h-5 w-5 rounded-full bg-destructive text-destructive-foreground text-xs flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity",children:"×"})]}),r.jsxs("label",{className:"cursor-pointer",children:[r.jsxs("span",{className:"inline-flex items-center gap-1.5 px-3 py-1.5 rounded-md border text-xs font-medium hover:bg-muted transition-colors",children:[r.jsx(uo,{className:"h-3.5 w-3.5"}),T.brokerage_logo_url?"Change Logo":"Upload Logo"]}),r.jsx("input",{type:"file",accept:"image/*",className:"hidden",onChange:G=>H(G,"brokerage_logo_url")})]})]}),T.brokerage_logo_url&&r.jsxs("div",{className:"space-y-1.5",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(He,{className:"text-xs font-medium text-muted-foreground",children:"Logo Size"}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:[T.brokerage_logo_size||56,"px"]})]}),r.jsx(lm,{value:[T.brokerage_logo_size||56],onValueChange:([G])=>L(te=>({...te,brokerage_logo_size:G})),min:24,max:120,step:4})]})]})]}),r.jsxs("div",{className:"space-y-3 p-3 rounded-lg bg-muted/30 border",children:[r.jsx(He,{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:"Team Branding"}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(dt,{value:T.team_name,onChange:G=>L(te=>({...te,team_name:G.target.value,team_logo_url:""})),placeholder:"Team name (or upload logo below)",disabled:!!T.team_logo_url}),r.jsxs("div",{className:"flex items-center gap-3",children:[T.team_logo_url&&r.jsxs("div",{className:"relative group",children:[r.jsx("img",{src:T.team_logo_url,alt:"Team logo",style:{height:`${T.team_logo_size||56}px`},className:"max-w-[200px] object-contain rounded border bg-white p-1"}),r.jsx("button",{onClick:()=>L(G=>({...G,team_logo_url:""})),className:"absolute -top-1.5 -right-1.5 h-5 w-5 rounded-full bg-destructive text-destructive-foreground text-xs flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity",children:"×"})]}),r.jsxs("label",{className:"cursor-pointer",children:[r.jsxs("span",{className:"inline-flex items-center gap-1.5 px-3 py-1.5 rounded-md border text-xs font-medium hover:bg-muted transition-colors",children:[r.jsx(uo,{className:"h-3.5 w-3.5"}),T.team_logo_url?"Change Logo":"Upload Logo"]}),r.jsx("input",{type:"file",accept:"image/*",className:"hidden",onChange:G=>H(G,"team_logo_url")})]})]}),T.team_logo_url&&r.jsxs("div",{className:"space-y-1.5",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(He,{className:"text-xs font-medium text-muted-foreground",children:"Logo Size"}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:[T.team_logo_size||56,"px"]})]}),r.jsx(lm,{value:[T.team_logo_size||56],onValueChange:([G])=>L(te=>({...te,team_logo_size:G})),min:24,max:120,step:4})]})]})]})]}),r.jsx(An,{value:"sections",className:"space-y-4 mt-4",children:[{key:"show_photo",label:"Show Photo",hint:"Photo is pulled from the agent's profile."},{key:"show_bio",label:"Show Bio"},{key:"show_credentials",label:"Show Credentials"},{key:"show_social_links",label:"Show Social Links"},{key:"show_save_contact",label:"Save Contact Button"},{key:"show_leave_review",label:"Leave Review Button"},{key:"show_refer_friend",label:"Refer a Friend Button"}].map(({key:G,label:te,hint:ie})=>r.jsxs("div",{className:"flex items-center justify-between py-2",children:[r.jsxs("div",{children:[r.jsx(He,{children:te}),ie&&r.jsxs("p",{className:"text-xs text-muted-foreground mt-0.5",children:[ie," ",G==="show_photo"&&r.jsx("a",{href:"/profile",target:"_blank",rel:"noopener noreferrer",className:"text-primary underline hover:no-underline",children:"Update Profile"})]})]}),r.jsx(Ps,{checked:T[G],onCheckedChange:le=>L(ye=>({...ye,[G]:le}))})]},G))}),r.jsx(An,{value:"blocks",className:"mt-4",children:r.jsx(M$e,{cardId:t.id})}),r.jsx(An,{value:"analytics",className:"mt-4",children:a?r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[r.jsx(Ye,{children:r.jsxs(tt,{className:"p-4 text-center",children:[r.jsx("div",{className:"text-2xl font-bold",children:a.views}),r.jsx("div",{className:"text-xs text-muted-foreground",children:"Views"})]})}),r.jsx(Ye,{children:r.jsxs(tt,{className:"p-4 text-center",children:[r.jsx("div",{className:"text-2xl font-bold",children:a.clicks}),r.jsx("div",{className:"text-xs text-muted-foreground",children:"Clicks"})]})}),r.jsx(Ye,{children:r.jsxs(tt,{className:"p-4 text-center",children:[r.jsx("div",{className:"text-2xl font-bold",children:a.leads.length}),r.jsx("div",{className:"text-xs text-muted-foreground",children:"Leads"})]})})]}),a.leads.length>0&&r.jsxs("div",{children:[r.jsx("h3",{className:"font-semibold mb-2",children:"Recent Leads"}),r.jsx("div",{className:"space-y-2",children:a.leads.slice(0,5).map(G=>r.jsxs("div",{className:"text-sm p-2 bg-muted/50 rounded-lg",children:[r.jsx("span",{className:"font-medium",children:G.name}),G.phone&&r.jsxs("span",{className:"text-muted-foreground",children:[" · ",G.phone]}),G.intent&&r.jsx(Ot,{variant:"secondary",className:"ml-2 text-xs",children:G.intent})]},G.id))})]})]}):r.jsx("p",{className:"text-center text-muted-foreground py-8",children:"No analytics data yet"})})]}),r.jsx(ee,{onClick:Z,disabled:s.isPending,className:"w-full mt-4",children:s.isPending?"Saving...":"Save Changes"})]})}),r.jsx(wxe,{open:x,onClose:()=>y(!1),imageSrc:b,onCropComplete:F,aspectRatio:1})]})}const DS={pending_payment:"Pending Payment",order_submitted:"Order Submitted",awaiting_proof_approval:"Awaiting Proof Approval",proof_approved:"Proof Approved",processing:"Processing",in_production:"In Production",shipped:"Shipped",completed:"Completed",cancelled:"Cancelled",refunded:"Refunded"},A0e={pending_payment:"bg-yellow-100 text-yellow-800",order_submitted:"bg-blue-100 text-blue-800",awaiting_proof_approval:"bg-orange-100 text-orange-800",proof_approved:"bg-green-100 text-green-800",processing:"bg-purple-100 text-purple-800",in_production:"bg-indigo-100 text-indigo-800",shipped:"bg-cyan-100 text-cyan-800",completed:"bg-green-200 text-green-900",cancelled:"bg-red-100 text-red-800",refunded:"bg-gray-100 text-gray-800"};function E0e(t=!0){return Yt({queryKey:["marketplace-categories",t],queryFn:async()=>{let e=J.from("marketplace_categories").select("*").order("sort_order",{ascending:!0});t&&(e=e.eq("is_active",!0));const{data:n,error:s}=await e;if(s)throw s;return n}})}function gGt(){const t=Vr();return cr({mutationFn:async e=>{const{data:n,error:s}=await J.from("marketplace_categories").insert([e]).select().single();if(s)throw s;return n},onSuccess:()=>{t.invalidateQueries({queryKey:["marketplace-categories"]}),ze.success("Category created successfully")},onError:e=>{ze.error("Failed to create category: "+e.message)}})}function xGt(){const t=Vr();return cr({mutationFn:async({id:e,...n})=>{const{data:s,error:a}=await J.from("marketplace_categories").update(n).eq("id",e).select().single();if(a)throw a;return s},onSuccess:()=>{t.invalidateQueries({queryKey:["marketplace-categories"]}),ze.success("Category updated successfully")},onError:e=>{ze.error("Failed to update category: "+e.message)}})}function yGt(){const t=Vr();return cr({mutationFn:async e=>{const{error:n}=await J.from("marketplace_categories").delete().eq("id",e);if(n)throw n},onSuccess:()=>{t.invalidateQueries({queryKey:["marketplace-categories"]}),ze.success("Category deleted successfully")},onError:e=>{ze.error("Failed to delete category: "+e.message)}})}function q$e(t,e=!0){return Yt({queryKey:["marketplace-products",t,e],queryFn:async()=>{let n=J.from("marketplace_products").select(` *, category:marketplace_categories(*), images:marketplace_product_images(*), video:marketplace_product_videos(*), variants:marketplace_product_variants(*) `).order("sort_order",{ascending:!0});t&&(n=n.eq("category_id",t)),e&&(n=n.eq("is_active",!0));const{data:s,error:a}=await n;if(a)throw a;return s}})}function vGt(t){return Yt({queryKey:["marketplace-product",t],queryFn:async()=>{const{data:e,error:n}=await J.from("marketplace_products").select(` *, category:marketplace_categories(*), images:marketplace_product_images(*), video:marketplace_product_videos(*), variants:marketplace_product_variants(*) `).eq("id",t).single();if(n)throw n;return e},enabled:!!t})}function _Gt(){const t=Vr();return cr({mutationFn:async e=>{const{data:n,error:s}=await J.from("marketplace_products").insert([e]).select().single();if(s)throw s;return n},onSuccess:()=>{t.invalidateQueries({queryKey:["marketplace-products"]}),ze.success("Product created successfully")},onError:e=>{ze.error("Failed to create product: "+e.message)}})}function bGt(){const t=Vr();return cr({mutationFn:async({id:e,...n})=>{const{data:s,error:a}=await J.from("marketplace_products").update(n).eq("id",e).select().single();if(a)throw a;return s},onSuccess:(e,n)=>{t.invalidateQueries({queryKey:["marketplace-products"]}),t.invalidateQueries({queryKey:["marketplace-product",n.id]}),ze.success("Product updated successfully")},onError:e=>{ze.error("Failed to update product: "+e.message)}})}function wGt(){const t=Vr();return cr({mutationFn:async e=>{const{error:n}=await J.from("marketplace_products").delete().eq("id",e);if(n)throw n},onSuccess:()=>{t.invalidateQueries({queryKey:["marketplace-products"]}),ze.success("Product deleted successfully")},onError:e=>{ze.error("Failed to delete product: "+e.message)}})}function jGt(){const t=Vr();return cr({mutationFn:async e=>{const{data:n,error:s}=await J.from("marketplace_product_images").insert([e]).select().single();if(s)throw s;return n},onSuccess:(e,n)=>{t.invalidateQueries({queryKey:["marketplace-products"]}),t.invalidateQueries({queryKey:["marketplace-product",n.product_id]})}})}function kGt(){const t=Vr();return cr({mutationFn:async({id:e,productId:n})=>{const{error:s}=await J.from("marketplace_product_images").delete().eq("id",e);if(s)throw s;return n},onSuccess:e=>{t.invalidateQueries({queryKey:["marketplace-products"]}),t.invalidateQueries({queryKey:["marketplace-product",e]}),ze.success("Image deleted successfully")},onError:e=>{ze.error("Failed to delete image: "+e.message)}})}function NGt(){const t=Vr();return cr({mutationFn:async({imageId:e,productId:n})=>{const{error:s}=await J.from("marketplace_product_images").update({is_primary:!1}).eq("product_id",n);if(s)throw s;const{error:a}=await J.from("marketplace_product_images").update({is_primary:!0}).eq("id",e);if(a)throw a;return n},onSuccess:e=>{t.invalidateQueries({queryKey:["marketplace-products"]}),t.invalidateQueries({queryKey:["marketplace-product",e]}),ze.success("Primary image updated")},onError:e=>{ze.error("Failed to set primary image: "+e.message)}})}function SGt(){const t=Vr();return cr({mutationFn:async e=>{const{data:n,error:s}=await J.from("marketplace_product_variants").insert([e]).select().single();if(s)throw s;return n},onSuccess:(e,n)=>{t.invalidateQueries({queryKey:["marketplace-products"]}),t.invalidateQueries({queryKey:["marketplace-product",n.product_id]}),ze.success("Variant added successfully")}})}function CGt(){const t=Vr();return cr({mutationFn:async({id:e,productId:n})=>{const{error:s}=await J.from("marketplace_product_variants").delete().eq("id",e);if(s)throw s;return n},onSuccess:e=>{t.invalidateQueries({queryKey:["marketplace-products"]}),t.invalidateQueries({queryKey:["marketplace-product",e]}),ze.success("Variant deleted successfully")}})}function MGt(){const t=Vr();return cr({mutationFn:async({productId:e,videoUrl:n})=>{await J.from("marketplace_product_videos").delete().eq("product_id",e);const{data:s,error:a}=await J.from("marketplace_product_videos").insert({product_id:e,video_url:n}).select().single();if(a)throw a;return s},onSuccess:(e,n)=>{t.invalidateQueries({queryKey:["marketplace-products"]}),t.invalidateQueries({queryKey:["marketplace-product",n.productId]}),ze.success("Video updated successfully")}})}function TGt(t){const{isAdmin:e}=Qr();return Yt({queryKey:["marketplace-orders",t,e],queryFn:async()=>{let n=J.from("marketplace_orders").select(` *, items:marketplace_order_items(*), status_history:marketplace_order_status_history(*) `).order("created_at",{ascending:!1});const{data:s,error:a}=await n;if(a)throw a;if(e&&s){const o=[...new Set(s.map(h=>h.user_id))],{data:l}=await J.from("profiles").select("id, name, email").in("id",o),i=new Map((l==null?void 0:l.map(h=>[h.id,h]))||[]);return s.map(h=>({...h,user:i.get(h.user_id)}))}return s}})}function AGt(){const{user:t}=Qr();return Yt({queryKey:["my-marketplace-orders",t==null?void 0:t.id],queryFn:async()=>{const{data:e,error:n}=await J.from("marketplace_orders").select(` *, items:marketplace_order_items(*), status_history:marketplace_order_status_history(*) `).eq("user_id",t.id).order("created_at",{ascending:!1});if(n)throw n;return e},enabled:!!(t!=null&&t.id)})}function EGt(t){return Yt({queryKey:["marketplace-order",t],queryFn:async()=>{const{data:e,error:n}=await J.from("marketplace_orders").select(` *, items:marketplace_order_items(*), status_history:marketplace_order_status_history(*) `).eq("id",t).single();if(n)throw n;return e},enabled:!!t})}function IGt(){const t=Vr(),{user:e}=Qr();return cr({mutationFn:async({orderId:n,status:s,notes:a,trackingNumber:o,trackingUrl:l,previousStatus:i})=>{const h={status:s};o!==void 0&&(h.tracking_number=o),l!==void 0&&(h.tracking_url=l);const{error:p}=await J.from("marketplace_orders").update(h).eq("id",n);if(p)throw p;const{error:x}=await J.from("marketplace_order_status_history").insert({order_id:n,status:s,notes:a,created_by:e==null?void 0:e.id});if(x)throw x;if(["shipped","in_production","processing","completed"].includes(s)&&s!==i)try{await J.functions.invoke("marketplace-order-notify",{body:{orderId:n,notificationType:s==="shipped"?"shipped":"status_update",newStatus:s,trackingNumber:o,trackingUrl:l}})}catch(b){console.error("Failed to send notification email:",b)}},onSuccess:(n,s)=>{t.invalidateQueries({queryKey:["marketplace-orders"]}),t.invalidateQueries({queryKey:["marketplace-order",s.orderId]}),t.invalidateQueries({queryKey:["my-marketplace-orders"]}),ze.success("Order status updated")},onError:n=>{ze.error("Failed to update order: "+n.message)}})}function PGt(){const t=Vr();return cr({mutationFn:async({itemId:e,proofUrl:n,proofNotes:s,orderId:a})=>{const{error:o}=await J.from("marketplace_order_items").update({proof_url:n,proof_notes:s,proof_status:"pending"}).eq("id",e);if(o)throw o;await J.from("marketplace_orders").update({status:"awaiting_proof_approval"}).eq("id",a);try{await J.functions.invoke("marketplace-order-notify",{body:{orderId:a,notificationType:"proof_ready"}})}catch(l){console.error("Failed to send proof notification:",l)}return a},onSuccess:e=>{t.invalidateQueries({queryKey:["marketplace-orders"]}),t.invalidateQueries({queryKey:["marketplace-order",e]}),t.invalidateQueries({queryKey:["my-marketplace-orders"]}),ze.success("Proof uploaded & customer notified")}})}function LGt(){const t=Vr();return cr({mutationFn:async({itemId:e,orderId:n})=>{const{error:s}=await J.from("marketplace_order_items").update({proof_status:"approved"}).eq("id",e);if(s)throw s;return n},onSuccess:e=>{t.invalidateQueries({queryKey:["marketplace-orders"]}),t.invalidateQueries({queryKey:["marketplace-order",e]}),t.invalidateQueries({queryKey:["my-marketplace-orders"]}),ze.success("Proof approved")}})}function OGt(){const t=Vr();return cr({mutationFn:async({itemId:e,orderId:n,reason:s})=>{const{error:a}=await J.from("marketplace_order_items").update({proof_status:"rejected",proof_notes:s}).eq("id",e);if(a)throw a;return n},onSuccess:e=>{t.invalidateQueries({queryKey:["marketplace-orders"]}),t.invalidateQueries({queryKey:["marketplace-order",e]}),t.invalidateQueries({queryKey:["my-marketplace-orders"]}),ze.success("Proof rejected - please upload a new proof")}})}function DGt(){const{data:t,isLoading:e}=E0e(!1),n=gGt(),s=xGt(),a=yGt(),[o,l]=I.useState(!1),[i,h]=I.useState(null),[p,x]=I.useState({name:"",description:"",image_url:"",sort_order:0,is_active:!0}),y=()=>{x({name:"",description:"",image_url:"",sort_order:0,is_active:!0}),h(null)},b=N=>{h(N),x({name:N.name,description:N.description||"",image_url:N.image_url||"",sort_order:N.sort_order,is_active:N.is_active}),l(!0)},j=async N=>{N.preventDefault(),i?await s.mutateAsync({id:i.id,...p}):await n.mutateAsync(p),l(!1),y()},C=async N=>{confirm("Are you sure you want to delete this category?")&&await a.mutateAsync(N)};return e?r.jsxs(Ye,{children:[r.jsx(Gt,{children:r.jsx(Ir,{className:"h-8 w-48"})}),r.jsx(tt,{children:r.jsx("div",{className:"space-y-4",children:[1,2,3].map(N=>r.jsx(Ir,{className:"h-12 w-full"},N))})})]}):r.jsxs(Ye,{children:[r.jsxs(Gt,{className:"flex flex-row items-center justify-between",children:[r.jsx(Zt,{children:"Categories"}),r.jsxs(Fr,{open:o,onOpenChange:N=>{l(N),N||y()},children:[r.jsx(zo,{asChild:!0,children:r.jsxs(ee,{children:[r.jsx(bn,{className:"h-4 w-4 mr-2"}),"Add Category"]})}),r.jsxs(Rr,{children:[r.jsx(qr,{children:r.jsx($r,{children:i?"Edit Category":"Add Category"})}),r.jsxs("form",{onSubmit:j,className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"name",children:"Name"}),r.jsx(dt,{id:"name",value:p.name,onChange:N=>x({...p,name:N.target.value}),required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"description",children:"Description"}),r.jsx(ps,{id:"description",value:p.description,onChange:N=>x({...p,description:N.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"image_url",children:"Image URL"}),r.jsx(dt,{id:"image_url",value:p.image_url,onChange:N=>x({...p,image_url:N.target.value}),placeholder:"https://..."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"sort_order",children:"Sort Order"}),r.jsx(dt,{id:"sort_order",type:"number",value:p.sort_order,onChange:N=>x({...p,sort_order:parseInt(N.target.value)||0})})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ps,{id:"is_active",checked:p.is_active,onCheckedChange:N=>x({...p,is_active:N})}),r.jsx(He,{htmlFor:"is_active",children:"Active"})]}),r.jsx(ee,{type:"submit",className:"w-full",disabled:n.isPending||s.isPending,children:i?"Update Category":"Create Category"})]})]})]})]}),r.jsx(tt,{children:t&&t.length>0?r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Ar,{children:[r.jsx(It,{children:"Name"}),r.jsx(It,{children:"Description"}),r.jsx(It,{children:"Sort Order"}),r.jsx(It,{children:"Status"}),r.jsx(It,{className:"text-right",children:"Actions"})]})}),r.jsx(Vs,{children:t.map(N=>r.jsxs(Ar,{children:[r.jsx(Nt,{className:"font-medium",children:N.name}),r.jsx(Nt,{className:"max-w-xs truncate",children:N.description}),r.jsx(Nt,{children:N.sort_order}),r.jsx(Nt,{children:r.jsx("span",{className:`px-2 py-1 rounded-full text-xs ${N.is_active?"bg-green-100 text-green-800":"bg-gray-100 text-gray-800"}`,children:N.is_active?"Active":"Inactive"})}),r.jsx(Nt,{className:"text-right",children:r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>b(N),children:r.jsx(_i,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>C(N.id),disabled:a.isPending,children:r.jsx(Vn,{className:"h-4 w-4 text-destructive"})})]})})]},N.id))})]}):r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"No categories yet. Create your first category to get started."})})]})}function RGt(){var Ce,be;const{data:t,isLoading:e}=q$e(void 0,!1),{data:n}=E0e(!1),s=_Gt(),a=bGt(),o=wGt(),l=jGt(),i=kGt(),h=NGt(),p=SGt(),x=CGt(),y=MGt(),[b,j]=I.useState(!1),[C,N]=I.useState(!1),[A,E]=I.useState(!1),[T,L]=I.useState(null),[z,F]=I.useState(null),[q,H]=I.useState(!1),[Z,G]=I.useState({name:"",description:"",base_price:0,shipping_fee:0,category_id:"",allow_artwork_upload:!1,requires_proof_approval:!1,is_active:!0,sort_order:0}),[te,ie]=I.useState({name:"",price_adjustment:0}),[le,ye]=I.useState(""),ne=()=>{G({name:"",description:"",base_price:0,shipping_fee:0,category_id:"",allow_artwork_upload:!1,requires_proof_approval:!1,is_active:!0,sort_order:0}),L(null)},ge=me=>{L(me),G({name:me.name,description:me.description||"",base_price:Number(me.base_price),shipping_fee:Number(me.shipping_fee),category_id:me.category_id||"",allow_artwork_upload:me.allow_artwork_upload,requires_proof_approval:me.requires_proof_approval,is_active:me.is_active,sort_order:me.sort_order}),j(!0)},ae=async me=>{me.preventDefault();const Le={...Z,category_id:Z.category_id||null};T?await a.mutateAsync({id:T.id,...Le}):await s.mutateAsync(Le),j(!1),ne()},he=async me=>{confirm("Are you sure you want to delete this product?")&&await o.mutateAsync(me)},ue=async me=>{if(!z||!me.target.files||me.target.files.length===0)return;H(!0);const Le=me.target.files[0],Ne=Le.name.split(".").pop(),Be=`products/${z.id}/${Date.now()}.${Ne}`;try{const{error:Ee}=await J.storage.from("marketplace").upload(Be,Le);if(Ee)throw Ee;const{data:{publicUrl:Ue}}=J.storage.from("marketplace").getPublicUrl(Be);await l.mutateAsync({product_id:z.id,image_url:Ue,is_primary:!z.images||z.images.length===0}),ze.success("Image uploaded successfully")}catch(Ee){ze.error("Failed to upload image: "+Ee.message)}finally{H(!1)}},_e=async me=>{me.preventDefault(),z&&(await p.mutateAsync({product_id:z.id,name:te.name,price_adjustment:te.price_adjustment}),ie({name:"",price_adjustment:0}))},Ae=async()=>{!z||!le||(await y.mutateAsync({productId:z.id,videoUrl:le}),ye(""))};return e?r.jsxs(Ye,{children:[r.jsx(Gt,{children:r.jsx(Ir,{className:"h-8 w-48"})}),r.jsx(tt,{children:r.jsx("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:[1,2,3].map(me=>r.jsx(Ir,{className:"h-64 w-full"},me))})})]}):r.jsxs(r.Fragment,{children:[r.jsxs(Ye,{children:[r.jsxs(Gt,{className:"flex flex-row items-center justify-between",children:[r.jsx(Zt,{children:"Products"}),r.jsxs(Fr,{open:b,onOpenChange:me=>{j(me),me||ne()},children:[r.jsx(zo,{asChild:!0,children:r.jsxs(ee,{children:[r.jsx(bn,{className:"h-4 w-4 mr-2"}),"Add Product"]})}),r.jsxs(Rr,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsx(qr,{children:r.jsx($r,{children:T?"Edit Product":"Add Product"})}),r.jsxs("form",{onSubmit:ae,className:"space-y-4",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"name",children:"Product Name"}),r.jsx(dt,{id:"name",value:Z.name,onChange:me=>G({...Z,name:me.target.value}),required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"category",children:"Category"}),r.jsxs(gn,{value:Z.category_id,onValueChange:me=>G({...Z,category_id:me}),children:[r.jsx(fn,{children:r.jsx(xn,{placeholder:"Select category"})}),r.jsx(pn,{children:n==null?void 0:n.map(me=>r.jsx(Vt,{value:me.id,children:me.name},me.id))})]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"description",children:"Description"}),r.jsx(ps,{id:"description",value:Z.description,onChange:me=>G({...Z,description:me.target.value}),rows:4})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"base_price",children:"Base Price ($)"}),r.jsx(dt,{id:"base_price",type:"number",step:"0.01",min:"0",value:Z.base_price,onChange:me=>G({...Z,base_price:parseFloat(me.target.value)||0}),required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"shipping_fee",children:"Shipping Fee ($)"}),r.jsx(dt,{id:"shipping_fee",type:"number",step:"0.01",min:"0",value:Z.shipping_fee,onChange:me=>G({...Z,shipping_fee:parseFloat(me.target.value)||0})})]})]}),r.jsx("div",{className:"grid grid-cols-2 gap-4",children:r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"sort_order",children:"Sort Order"}),r.jsx(dt,{id:"sort_order",type:"number",value:Z.sort_order,onChange:me=>G({...Z,sort_order:parseInt(me.target.value)||0})})]})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ps,{id:"allow_artwork_upload",checked:Z.allow_artwork_upload,onCheckedChange:me=>G({...Z,allow_artwork_upload:me})}),r.jsx(He,{htmlFor:"allow_artwork_upload",children:"Allow customer to upload artwork"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ps,{id:"requires_proof_approval",checked:Z.requires_proof_approval,onCheckedChange:me=>G({...Z,requires_proof_approval:me})}),r.jsx(He,{htmlFor:"requires_proof_approval",children:"Requires proof approval"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ps,{id:"is_active",checked:Z.is_active,onCheckedChange:me=>G({...Z,is_active:me})}),r.jsx(He,{htmlFor:"is_active",children:"Active"})]})]}),r.jsx(ee,{type:"submit",className:"w-full",disabled:s.isPending||a.isPending,children:T?"Update Product":"Create Product"})]})]})]})]}),r.jsx(tt,{children:t&&t.length>0?r.jsx("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:t.map(me=>{var Le,Ne;return r.jsxs(Ye,{className:"overflow-hidden",children:[r.jsxs("div",{className:"aspect-video bg-muted relative",children:[me.images&&me.images.length>0?r.jsx("img",{src:((Le=me.images.find(Be=>Be.is_primary))==null?void 0:Le.image_url)||me.images[0].image_url,alt:me.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"}),!me.is_active&&r.jsx(Ot,{variant:"secondary",className:"absolute top-2 right-2",children:"Inactive"})]}),r.jsxs(tt,{className:"p-4",children:[r.jsx("h3",{className:"font-semibold mb-1",children:me.name}),r.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:((Ne=me.category)==null?void 0:Ne.name)||"No category"}),r.jsxs("div",{className:"flex items-center justify-between mb-3",children:[r.jsxs("span",{className:"font-bold",children:["$",Number(me.base_price).toFixed(2)]}),Number(me.shipping_fee)>0&&r.jsxs("span",{className:"text-sm text-muted-foreground",children:["+$",Number(me.shipping_fee).toFixed(2)," shipping"]})]}),r.jsxs("div",{className:"flex flex-wrap gap-1 mb-3",children:[me.allow_artwork_upload&&r.jsx(Ot,{variant:"outline",className:"text-xs",children:"Artwork Upload"}),me.requires_proof_approval&&r.jsx(Ot,{variant:"outline",className:"text-xs",children:"Proof Required"}),me.variants&&me.variants.length>0&&r.jsxs(Ot,{variant:"outline",className:"text-xs",children:[me.variants.length," Variants"]})]}),r.jsxs("div",{className:"flex gap-2 flex-wrap",children:[r.jsxs(ee,{variant:"outline",size:"sm",onClick:()=>ge(me),children:[r.jsx(_i,{className:"h-3 w-3 mr-1"}),"Edit"]}),r.jsxs(ee,{variant:"outline",size:"sm",onClick:()=>{F(me),N(!0)},children:[r.jsx(sS,{className:"h-3 w-3 mr-1"}),"Images"]}),r.jsxs(ee,{variant:"outline",size:"sm",onClick:()=>{F(me),E(!0)},children:[r.jsx(jg,{className:"h-3 w-3 mr-1"}),"Variants"]}),r.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>he(me.id),children:r.jsx(Vn,{className:"h-3 w-3 text-destructive"})})]})]})]},me.id)})}):r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"No products yet. Create your first product to get started."})})]}),r.jsx(Fr,{open:C,onOpenChange:N,children:r.jsxs(Rr,{className:"max-w-2xl",children:[r.jsx(qr,{children:r.jsxs($r,{children:["Manage Images - ",z==null?void 0:z.name]})}),r.jsxs("div",{className:"space-y-4",children:[r.jsx("div",{className:"grid grid-cols-3 gap-4",children:(Ce=z==null?void 0:z.images)==null?void 0:Ce.map(me=>r.jsxs("div",{className:"relative group",children:[r.jsx("img",{src:me.image_url,alt:"",className:"w-full aspect-square object-cover rounded-lg"}),me.is_primary&&r.jsx(Ot,{className:"absolute top-2 left-2",variant:"default",children:"Primary"}),r.jsxs("div",{className:"absolute top-2 right-2 flex gap-1 opacity-0 group-hover:opacity-100 transition-opacity",children:[!me.is_primary&&r.jsx(ee,{variant:"secondary",size:"icon",onClick:async()=>{var Le;await h.mutateAsync({imageId:me.id,productId:z.id}),F({...z,images:(Le=z.images)==null?void 0:Le.map(Ne=>({...Ne,is_primary:Ne.id===me.id}))})},disabled:h.isPending,title:"Set as primary",children:r.jsx(vs,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"destructive",size:"icon",onClick:async()=>{var Ne;await i.mutateAsync({id:me.id,productId:z.id});const Le=t==null?void 0:t.find(Be=>Be.id===z.id);Le&&F({...Le,images:(Ne=Le.images)==null?void 0:Ne.filter(Be=>Be.id!==me.id)})},disabled:i.isPending,children:r.jsx(Vn,{className:"h-4 w-4"})})]})]},me.id))}),r.jsxs("div",{className:"border-2 border-dashed rounded-lg p-6 text-center",children:[r.jsx("input",{type:"file",accept:"image/*",onChange:ue,className:"hidden",id:"image-upload",disabled:q}),r.jsxs("label",{htmlFor:"image-upload",className:"cursor-pointer",children:[r.jsx(sS,{className:"h-8 w-8 mx-auto mb-2 text-muted-foreground"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:q?"Uploading...":"Click to upload an image"})]})]}),r.jsxs("div",{className:"border-t pt-4 mt-4",children:[r.jsx(He,{children:"Product Video (optional)"}),r.jsxs("div",{className:"flex gap-2 mt-2",children:[r.jsx(dt,{placeholder:"Enter video URL (YouTube, Vimeo, etc.)",value:le,onChange:me=>ye(me.target.value)}),r.jsxs(ee,{onClick:Ae,disabled:!le,children:[r.jsx(Pa,{className:"h-4 w-4 mr-2"}),"Set Video"]})]}),(z==null?void 0:z.video)&&r.jsxs("p",{className:"text-sm text-muted-foreground mt-2",children:["Current video: ",z.video.video_url]})]})]})]})}),r.jsx(Fr,{open:A,onOpenChange:E,children:r.jsxs(Rr,{children:[r.jsx(qr,{children:r.jsxs($r,{children:["Manage Variants - ",z==null?void 0:z.name]})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("form",{onSubmit:_e,className:"flex gap-2",children:[r.jsx(dt,{placeholder:"Variant name (e.g., 500 count)",value:te.name,onChange:me=>ie({...te,name:me.target.value}),required:!0}),r.jsx(dt,{type:"number",step:"0.01",placeholder:"Price adj.",value:te.price_adjustment,onChange:me=>ie({...te,price_adjustment:parseFloat(me.target.value)||0}),className:"w-32"}),r.jsx(ee,{type:"submit",children:"Add"})]}),r.jsxs("div",{className:"space-y-2",children:[(be=z==null?void 0:z.variants)==null?void 0:be.map(me=>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:me.name}),r.jsxs("span",{className:"text-sm text-muted-foreground ml-2",children:[Number(me.price_adjustment)>=0?"+":"","$",Number(me.price_adjustment).toFixed(2)]})]}),r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>x.mutateAsync({id:me.id,productId:z.id}),children:r.jsx(Vn,{className:"h-4 w-4 text-destructive"})})]},me.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 FGt=["pending_payment","order_submitted","awaiting_proof_approval","proof_approved","processing","in_production","shipped","completed","cancelled","refunded"];function zGt(){var N,A,E;const{data:t,isLoading:e}=TGt(),n=IGt(),s=PGt(),[a,o]=I.useState(null),[l,i]=I.useState(!1),[h,p]=I.useState({status:"",notes:"",trackingNumber:"",trackingUrl:""}),[x,y]=I.useState(!1),b=T=>{o(T),p({status:T.status,notes:"",trackingNumber:T.tracking_number||"",trackingUrl:T.tracking_url||""}),i(!0)},j=async()=>{a&&(await n.mutateAsync({orderId:a.id,status:h.status,notes:h.notes,trackingNumber:h.trackingNumber,trackingUrl:h.trackingUrl,previousStatus:a.status}),i(!1))},C=async(T,L)=>{if(!a||!T.target.files||T.target.files.length===0)return;y(!0);const z=T.target.files[0],F=z.name.split(".").pop(),q=`proofs/${a.id}/${L}/${Date.now()}.${F}`;try{const{error:H}=await J.storage.from("marketplace").upload(q,z);if(H)throw H;const{data:{publicUrl:Z}}=J.storage.from("marketplace").getPublicUrl(q);await s.mutateAsync({itemId:L,proofUrl:Z,orderId:a.id}),ze.success("Proof uploaded successfully")}catch(H){ze.error("Failed to upload proof: "+H.message)}finally{y(!1)}};return e?r.jsxs(Ye,{children:[r.jsx(Gt,{children:r.jsx(Ir,{className:"h-8 w-48"})}),r.jsx(tt,{children:r.jsx("div",{className:"space-y-4",children:[1,2,3].map(T=>r.jsx(Ir,{className:"h-16 w-full"},T))})})]}):r.jsxs(r.Fragment,{children:[r.jsxs(Ye,{children:[r.jsx(Gt,{children:r.jsx(Zt,{children:"Orders"})}),r.jsx(tt,{children:t&&t.length>0?r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Ar,{children:[r.jsx(It,{children:"Order #"}),r.jsx(It,{children:"Customer"}),r.jsx(It,{children:"Date"}),r.jsx(It,{children:"Total"}),r.jsx(It,{children:"Status"}),r.jsx(It,{className:"text-right",children:"Actions"})]})}),r.jsx(Vs,{children:t.map(T=>{var L,z;return r.jsxs(Ar,{children:[r.jsx(Nt,{className:"font-mono",children:T.order_number}),r.jsx(Nt,{children:r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:((L=T.user)==null?void 0:L.name)||"Unknown"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:(z=T.user)==null?void 0:z.email})]})}),r.jsx(Nt,{children:yn(new Date(T.created_at),"MMM d, yyyy")}),r.jsxs(Nt,{className:"font-bold",children:["$",Number(T.total).toFixed(2)]}),r.jsx(Nt,{children:r.jsx(Ot,{className:A0e[T.status],children:DS[T.status]})}),r.jsx(Nt,{className:"text-right",children:r.jsxs(ee,{variant:"ghost",size:"sm",onClick:()=>b(T),children:[r.jsx(Qo,{className:"h-4 w-4 mr-1"}),"View"]})})]},T.id)})})]}):r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"No orders yet."})})]}),r.jsx(Fr,{open:l,onOpenChange:i,children:r.jsxs(Rr,{className:"max-w-3xl max-h-[90vh] overflow-y-auto",children:[r.jsx(qr,{children:r.jsxs($r,{children:["Order ",a==null?void 0:a.order_number]})}),a&&r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx("h4",{className:"font-medium mb-2",children:"Customer"}),r.jsx("p",{children:(N=a.user)==null?void 0:N.name}),r.jsx("p",{className:"text-sm text-muted-foreground",children:(A=a.user)==null?void 0:A.email})]}),r.jsxs("div",{children:[r.jsx("h4",{className:"font-medium mb-2",children:"Shipping Address"}),r.jsx("p",{children:a.shipping_name}),r.jsxs("p",{className:"text-sm text-muted-foreground",children:[a.shipping_address,r.jsx("br",{}),a.shipping_city,", ",a.shipping_state," ",a.shipping_zip]})]})]}),r.jsxs("div",{children:[r.jsx("h4",{className:"font-medium mb-2",children:"Order Items"}),r.jsx("div",{className:"space-y-3",children:(E=a.items)==null?void 0:E.map(T=>r.jsxs("div",{className:"border rounded-lg p-4",children:[r.jsxs("div",{className:"flex justify-between items-start mb-2",children:[r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:T.product_name}),T.variant_name&&r.jsx("p",{className:"text-sm text-muted-foreground",children:T.variant_name})]}),r.jsxs("p",{className:"font-bold",children:["$",Number(T.unit_price).toFixed(2)," x ",T.quantity]})]}),T.artwork_url&&r.jsxs("div",{className:"mt-2",children:[r.jsx("p",{className:"text-sm text-muted-foreground mb-1",children:"Customer Artwork:"}),r.jsx("a",{href:T.artwork_url,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline text-sm",children:"View Artwork"})]}),r.jsx("div",{className:"mt-3 pt-3 border-t",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium",children:"Proof Status: "}),r.jsx(Ot,{variant:T.proof_status==="approved"?"default":"secondary",children:T.proof_status||"No proof yet"})]}),T.proof_url?r.jsx("a",{href:T.proof_url,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline text-sm",children:"View Proof"}):r.jsxs("div",{children:[r.jsx("input",{type:"file",accept:"image/*,.pdf",onChange:L=>C(L,T.id),className:"hidden",id:`proof-${T.id}`,disabled:x}),r.jsx("label",{htmlFor:`proof-${T.id}`,children:r.jsx(ee,{variant:"outline",size:"sm",asChild:!0,children:r.jsxs("span",{children:[r.jsx(uo,{className:"h-4 w-4 mr-1"}),x?"Uploading...":"Upload Proof"]})})})]})]})})]},T.id))})]}),r.jsxs("div",{className:"border-t pt-4",children:[r.jsxs("div",{className:"flex justify-between text-sm",children:[r.jsx("span",{children:"Subtotal"}),r.jsxs("span",{children:["$",Number(a.subtotal).toFixed(2)]})]}),r.jsxs("div",{className:"flex justify-between text-sm",children:[r.jsx("span",{children:"Shipping"}),r.jsxs("span",{children:["$",Number(a.shipping_total).toFixed(2)]})]}),r.jsxs("div",{className:"flex justify-between font-bold text-lg mt-2",children:[r.jsx("span",{children:"Total"}),r.jsxs("span",{children:["$",Number(a.total).toFixed(2)]})]})]}),r.jsxs("div",{className:"border-t pt-4",children:[r.jsx("h4",{className:"font-medium mb-3",children:"Update Order Status"}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Status"}),r.jsxs(gn,{value:h.status,onValueChange:T=>p({...h,status:T}),children:[r.jsx(fn,{children:r.jsx(xn,{})}),r.jsx(pn,{children:FGt.map(T=>r.jsx(Vt,{value:T,children:DS[T]},T))})]})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Tracking Number"}),r.jsx(dt,{value:h.trackingNumber,onChange:T=>p({...h,trackingNumber:T.target.value}),placeholder:"Enter tracking number"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Tracking URL"}),r.jsx(dt,{value:h.trackingUrl,onChange:T=>p({...h,trackingUrl:T.target.value}),placeholder:"https://..."})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Notes (optional)"}),r.jsx(ps,{value:h.notes,onChange:T=>p({...h,notes:T.target.value}),placeholder:"Add a note about this status change..."})]}),r.jsxs(ee,{onClick:j,disabled:n.isPending,className:"w-full",children:[r.jsx(zl,{className:"h-4 w-4 mr-2"}),"Update Status"]})]})]}),a.status_history&&a.status_history.length>0&&r.jsxs("div",{className:"border-t pt-4",children:[r.jsx("h4",{className:"font-medium mb-3",children:"Status History"}),r.jsx("div",{className:"space-y-2",children:a.status_history.map(T=>r.jsxs("div",{className:"flex justify-between text-sm p-2 bg-muted rounded",children:[r.jsxs("div",{children:[r.jsx(Ot,{variant:"outline",children:DS[T.status]}),T.notes&&r.jsx("p",{className:"text-muted-foreground mt-1",children:T.notes})]}),r.jsx("span",{className:"text-muted-foreground",children:yn(new Date(T.created_at),"MMM d, h:mm a")})]},T.id))})]})]})]})})]})}function BGt(){const[t,e]=I.useState("products"),n=rs();return r.jsx(Lr,{title:"Marketplace Management",children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold",children:"Marketplace Management"}),r.jsx("p",{className:"text-muted-foreground",children:"Manage products, categories, and orders"})]}),r.jsxs(ee,{variant:"outline",onClick:()=>n("/marketplace"),children:[r.jsx(Fs,{className:"h-4 w-4 mr-2"}),"View Store"]})]}),r.jsxs(Ii,{value:t,onValueChange:e,children:[r.jsxs(wi,{className:"grid w-full grid-cols-3",children:[r.jsxs(ln,{value:"products",className:"flex items-center gap-2",children:[r.jsx(zl,{className:"h-4 w-4"}),"Products"]}),r.jsxs(ln,{value:"categories",className:"flex items-center gap-2",children:[r.jsx($x,{className:"h-4 w-4"}),"Categories"]}),r.jsxs(ln,{value:"orders",className:"flex items-center gap-2",children:[r.jsx(fh,{className:"h-4 w-4"}),"Orders"]})]}),r.jsx(An,{value:"products",children:r.jsx(RGt,{})}),r.jsx(An,{value:"categories",children:r.jsx(DGt,{})}),r.jsx(An,{value:"orders",children:r.jsx(zGt,{})})]})]})})}function V$e(){return Yt({queryKey:["reward-categories"],queryFn:async()=>{const{data:t,error:e}=await J.from("reward_store_categories").select("*").order("sort_order",{ascending:!0});if(e)throw e;return t}})}function $Gt(t){return Yt({queryKey:["reward-items",t],queryFn:async()=>{let e=J.from("reward_store_items").select(` *, category:reward_store_categories(*) `).order("created_at",{ascending:!1});const{data:n,error:s}=await e;if(s)throw s;return n}})}function UGt(t){return Yt({queryKey:["active-reward-items",t],queryFn:async()=>{let e=J.from("reward_store_items").select(` *, category:reward_store_categories(*) `).eq("is_active",!0).order("created_at",{ascending:!1});t&&(e=e.eq("category_id",t));const{data:n,error:s}=await e;if(s)throw s;return n}})}function qGt(t){return Yt({queryKey:["user-purchases",t],queryFn:async()=>{if(!t)return[];const{data:e,error:n}=await J.from("reward_store_purchases").select(` *, item:reward_store_items(*) `).eq("user_id",t).order("purchased_at",{ascending:!1});if(n)throw n;return e},enabled:!!t})}function VGt(){return Yt({queryKey:["all-reward-purchases"],queryFn:async()=>{const{data:t,error:e}=await J.from("reward_store_purchases").select(` *, item:reward_store_items(*) `).order("purchased_at",{ascending:!1});if(e)throw e;if(!t||t.length===0)return[];const n=[...new Set(t.map(l=>l.user_id))],{data:s,error:a}=await J.from("profiles").select("id, name, email").in("id",n);if(a)throw a;const o=new Map((s==null?void 0:s.map(l=>[l.id,l]))||[]);return t.map(l=>({...l,user:o.get(l.user_id)||null}))}})}function HGt(t){return Yt({queryKey:["spendable-points",t],queryFn:async()=>{if(!t)return 0;const{data:e,error:n}=await J.from("agent_attendance_stats").select("spendable_points").eq("user_id",t).single();if(n&&n.code!=="PGRST116")throw n;return(e==null?void 0:e.spendable_points)||0},enabled:!!t})}function WGt(){const t=Vr();return cr({mutationFn:async e=>{const{data:n,error:s}=await J.rpc("purchase_reward_item",{p_item_id:e});if(s)throw s;const a=n;if(!a.success)throw new Error(a.error||"Purchase failed");return a},onSuccess:()=>{t.invalidateQueries({queryKey:["user-purchases"]}),t.invalidateQueries({queryKey:["spendable-points"]}),t.invalidateQueries({queryKey:["active-reward-items"]}),t.invalidateQueries({queryKey:["reward-items"]})}})}function GGt(){const t=Vr();return cr({mutationFn:async e=>{const{data:n,error:s}=await J.from("reward_store_categories").insert([e]).select().single();if(s)throw s;return n},onSuccess:()=>{t.invalidateQueries({queryKey:["reward-categories"]})}})}function KGt(){const t=Vr();return cr({mutationFn:async({id:e,...n})=>{const{data:s,error:a}=await J.from("reward_store_categories").update(n).eq("id",e).select().single();if(a)throw a;return s},onSuccess:()=>{t.invalidateQueries({queryKey:["reward-categories"]})}})}function ZGt(){const t=Vr();return cr({mutationFn:async e=>{const{error:n}=await J.from("reward_store_categories").delete().eq("id",e);if(n)throw n},onSuccess:()=>{t.invalidateQueries({queryKey:["reward-categories"]})}})}function YGt(){const t=Vr();return cr({mutationFn:async e=>{const{data:n,error:s}=await J.from("reward_store_items").insert([e]).select().single();if(s)throw s;return n},onSuccess:()=>{t.invalidateQueries({queryKey:["reward-items"]}),t.invalidateQueries({queryKey:["active-reward-items"]})}})}function XGt(){const t=Vr();return cr({mutationFn:async({id:e,...n})=>{const{data:s,error:a}=await J.from("reward_store_items").update(n).eq("id",e).select().single();if(a)throw a;return s},onSuccess:()=>{t.invalidateQueries({queryKey:["reward-items"]}),t.invalidateQueries({queryKey:["active-reward-items"]})}})}function QGt(){const t=Vr();return cr({mutationFn:async e=>{const{error:n}=await J.from("reward_store_items").delete().eq("id",e);if(n)throw n},onSuccess:()=>{t.invalidateQueries({queryKey:["reward-items"]}),t.invalidateQueries({queryKey:["active-reward-items"]})}})}function JGt(t){const e=t.match(/\/storage\/v1\/object\/public\/([^/]+)\/(.+)$/);return e?{bucket:e[1],path:e[2]}:null}async function ude(t,e){const n=JGt(t);if(n)try{const{data:s,error:a}=await J.storage.from(n.bucket).download(n.path);if(a){console.error("Error downloading file:",a),ze.error("Failed to download file");return}const o=URL.createObjectURL(s),l=document.createElement("a");l.href=o,l.download=e||n.path.split("/").pop()||"download",document.body.appendChild(l),l.click(),document.body.removeChild(l),setTimeout(()=>URL.revokeObjectURL(o),100)}catch(s){console.error("Download error:",s),ze.error("Failed to download file")}else try{const a=await(await fetch(t)).blob(),o=URL.createObjectURL(a),l=document.createElement("a");l.href=o,l.download=e||t.split("/").pop()||"download",document.body.appendChild(l),l.click(),document.body.removeChild(l),setTimeout(()=>URL.revokeObjectURL(o),100)}catch(s){console.error("External download error:",s),ze.error("Failed to download file")}}function H$e(){return Yt({queryKey:["point-reward-settings"],queryFn:async()=>{const{data:t,error:e}=await J.from("point_reward_settings").select("*").order("action_name");if(e)throw e;return t}})}function eKt(){const t=Vr();return cr({mutationFn:async({id:e,points:n,is_active:s})=>{const a={points:n};s!==void 0&&(a.is_active=s);const{data:o,error:l}=await J.from("point_reward_settings").update(a).eq("id",e).select().single();if(l)throw l;return o},onSuccess:()=>{t.invalidateQueries({queryKey:["point-reward-settings"]})}})}function tKt(){const{user:t}=Qr(),[e,n]=I.useState("items"),[s,a]=I.useState(!1),[o,l]=I.useState(null),[i,h]=I.useState(""),[p,x]=I.useState(""),[y,b]=I.useState(""),[j,C]=I.useState(null),[N,A]=I.useState(!1),[E,T]=I.useState(null),[L,z]=I.useState(""),[F,q]=I.useState(""),[H,Z]=I.useState(null),[G,te]=I.useState(""),[ie,le]=I.useState("file"),[ye,ne]=I.useState(""),[ge,ae]=I.useState(""),[he,ue]=I.useState(""),[_e,Ae]=I.useState(!0),[Ce,be]=I.useState(null),[me,Le]=I.useState(!1),[Ne,Be]=I.useState(!1),Ee=I.useRef(null),Ue=I.useRef(null),{data:Re,isLoading:je}=V$e(),{data:et,isLoading:Te}=$Gt(),{data:Ze,isLoading:pe}=VGt(),{data:yt,isLoading:rt}=H$e(),at=GGt(),Me=KGt(),ft=ZGt(),qe=YGt(),Oe=XGt(),Qe=QGt(),nt=eKt(),[gt,mt]=I.useState({}),Mt=hr=>{hr?(l(hr),h(hr.name),x(hr.description||""),b(hr.icon||"")):(l(null),h(""),x(""),b("")),a(!0)},wt=async()=>{if(!i.trim()){ze.error("Please enter a category name");return}try{o?(await Me.mutateAsync({id:o.id,name:i,description:p||null,icon:y||null}),ze.success("Category updated successfully")):(await at.mutateAsync({name:i,description:p||null,icon:y||null,sort_order:((Re==null?void 0:Re.length)||0)+1}),ze.success("Category created successfully")),a(!1)}catch(hr){console.error("Error saving category:",hr),ze.error("Failed to save category")}},Qt=async()=>{if(j)try{await ft.mutateAsync(j),ze.success("Category deleted successfully"),C(null)}catch(hr){console.error("Error deleting category:",hr),ze.error("Failed to delete category")}},Cr=hr=>{var xs;hr?(T(hr),z(hr.name),q(hr.description||""),Z(hr.category_id),te(hr.points_cost.toString()),le(hr.item_type),ne(hr.file_url||""),ae(hr.preview_image_url||""),ue(((xs=hr.max_quantity)==null?void 0:xs.toString())||""),Ae(hr.is_active)):(T(null),z(""),q(""),Z(null),te(""),le("file"),ne(""),ae(""),ue(""),Ae(!0)),A(!0)},cn=async(hr,xs)=>{xs==="file"?Le(!0):Be(!0);try{const ka=hr.name.split(".").pop(),xa=`${Date.now()}-${Math.random().toString(36).substring(7)}.${ka}`,zi=`${xs==="file"?"items":"previews"}/${xa}`,{error:Bi}=await J.storage.from("reward-store").upload(zi,hr);if(Bi)throw Bi;const{data:{publicUrl:tl}}=J.storage.from("reward-store").getPublicUrl(zi);xs==="file"?ne(tl):ae(tl),ze.success("File uploaded successfully")}catch(ka){console.error("Error uploading file:",ka),ze.error("Failed to upload file")}finally{xs==="file"?Le(!1):Be(!1)}},jn=async()=>{if(!L.trim()){ze.error("Please enter an item name");return}if(!G||parseInt(G)<0){ze.error("Please enter a valid points cost");return}try{const hr={name:L,description:F||null,category_id:H,points_cost:parseInt(G),item_type:ie,file_url:ye||null,preview_image_url:ge||null,max_quantity:he?parseInt(he):null,current_quantity:he?parseInt(he):null,is_active:_e,created_by:t==null?void 0:t.id};E?(await Oe.mutateAsync({id:E.id,...hr,current_quantity:E.max_quantity!==(he?parseInt(he):null)?he?parseInt(he):null:E.current_quantity}),ze.success("Item updated successfully")):(await qe.mutateAsync(hr),ze.success("Item created successfully")),A(!1)}catch(hr){console.error("Error saving item:",hr),ze.error("Failed to save item")}},Xr=async()=>{if(Ce)try{await Qe.mutateAsync(Ce),ze.success("Item deleted successfully"),be(null)}catch(hr){console.error("Error deleting item:",hr),ze.error("Failed to delete item")}},Pn=async(hr,xs)=>{const ka=gt[hr];if(ka===void 0||ka===xs.toString())return;const xa=parseInt(ka);if(isNaN(xa)||xa<0){ze.error("Please enter a valid positive number");return}try{await nt.mutateAsync({id:hr,points:xa}),ze.success("Points updated successfully"),mt(zi=>{const Bi={...zi};return delete Bi[hr],Bi})}catch(zi){console.error("Error updating points:",zi),ze.error("Failed to update points")}};return je||Te||pe||rt?r.jsx(Lr,{title:"Reward Store",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Ir,{className:"h-8 w-64"}),r.jsx(Ir,{className:"h-96"})]})}):r.jsxs(Lr,{title:"Reward Store",children:[r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold text-foreground",children:"Reward Store Management"}),r.jsx("p",{className:"text-muted-foreground",children:"Manage store items that agents can purchase with their points"})]}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[r.jsx(Ye,{children:r.jsxs(tt,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(zl,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs font-medium",children:"Total Items"})]}),r.jsx("p",{className:"text-2xl font-bold",children:(et==null?void 0:et.length)||0}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[(et==null?void 0:et.filter(hr=>hr.is_active).length)||0," active"]})]})}),r.jsx(Ye,{children:r.jsxs(tt,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx($x,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs font-medium",children:"Categories"})]}),r.jsx("p",{className:"text-2xl font-bold",children:(Re==null?void 0:Re.length)||0})]})}),r.jsx(Ye,{children:r.jsxs(tt,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(vs,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs font-medium",children:"Avg. Cost"})]}),r.jsxs("p",{className:"text-2xl font-bold",children:[et&&et.length>0?Math.round(et.reduce((hr,xs)=>hr+xs.points_cost,0)/et.length):0," pts"]})]})})]}),r.jsxs(Ii,{value:e,onValueChange:n,children:[r.jsxs(wi,{children:[r.jsx(ln,{value:"items",children:"Items"}),r.jsx(ln,{value:"categories",children:"Categories"}),r.jsx(ln,{value:"purchases",children:"Purchases"}),r.jsx(ln,{value:"point-settings",children:"Point Settings"})]}),r.jsx(An,{value:"items",className:"mt-4",children:r.jsxs(Ye,{children:[r.jsxs(Gt,{className:"flex flex-row items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Zt,{children:"Store Items"}),r.jsx(Mn,{children:"Manage rewards that agents can purchase"})]}),r.jsxs(ee,{onClick:()=>Cr(),children:[r.jsx(bn,{className:"h-4 w-4 mr-2"}),"Add Item"]})]}),r.jsx(tt,{children:!et||et.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(Ki,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),r.jsx("p",{children:"No items yet. Add your first reward item!"})]}):r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Ar,{children:[r.jsx(It,{children:"Item"}),r.jsx(It,{children:"Category"}),r.jsx(It,{className:"text-center",children:"Cost"}),r.jsx(It,{className:"text-center",children:"Type"}),r.jsx(It,{className:"text-center",children:"Quantity"}),r.jsx(It,{className:"text-center",children:"Status"}),r.jsx(It,{className:"text-right",children:"Actions"})]})}),r.jsx(Vs,{children:et.map(hr=>r.jsxs(Ar,{children:[r.jsx(Nt,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[hr.preview_image_url?r.jsx("img",{src:hr.preview_image_url,alt:hr.name,className:"h-10 w-10 rounded object-cover"}):r.jsx("div",{className:"h-10 w-10 rounded bg-muted flex items-center justify-center",children:r.jsx(Ki,{className:"h-5 w-5 text-muted-foreground"})}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:hr.name}),r.jsx("p",{className:"text-xs text-muted-foreground line-clamp-1",children:hr.description||"No description"})]})]})}),r.jsx(Nt,{children:hr.category?r.jsx(Ot,{variant:"outline",children:hr.category.name}):r.jsx("span",{className:"text-muted-foreground",children:"—"})}),r.jsx(Nt,{className:"text-center",children:r.jsxs(Ot,{variant:"secondary",className:"font-bold",children:[r.jsx(vs,{className:"h-3 w-3 mr-1"}),hr.points_cost]})}),r.jsx(Nt,{className:"text-center",children:r.jsxs("div",{className:"flex items-center justify-center gap-1",children:[hr.item_type==="file"?r.jsx(La,{className:"h-4 w-4 text-muted-foreground"}):r.jsx(Co,{className:"h-4 w-4 text-muted-foreground"}),r.jsx("span",{className:"text-xs capitalize",children:hr.item_type})]})}),r.jsx(Nt,{className:"text-center",children:hr.max_quantity!==null?r.jsxs("span",{className:hr.current_quantity===0?"text-red-500":"",children:[hr.current_quantity,"/",hr.max_quantity]}):r.jsx("span",{className:"text-muted-foreground",children:"Unlimited"})}),r.jsx(Nt,{className:"text-center",children:r.jsx(Ot,{variant:hr.is_active?"default":"secondary",children:hr.is_active?"Active":"Inactive"})}),r.jsx(Nt,{className:"text-right",children:r.jsxs("div",{className:"flex items-center justify-end gap-1",children:[r.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>Cr(hr),children:r.jsx(_i,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>be(hr.id),children:r.jsx(Vn,{className:"h-4 w-4 text-destructive"})})]})})]},hr.id))})]})})]})}),r.jsx(An,{value:"categories",className:"mt-4",children:r.jsxs(Ye,{children:[r.jsxs(Gt,{className:"flex flex-row items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Zt,{children:"Categories"}),r.jsx(Mn,{children:"Organize your store items into categories"})]}),r.jsxs(ee,{onClick:()=>Mt(),children:[r.jsx(bn,{className:"h-4 w-4 mr-2"}),"Add Category"]})]}),r.jsx(tt,{children:!Re||Re.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx($x,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),r.jsx("p",{children:"No categories yet. Add your first category!"})]}):r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Ar,{children:[r.jsx(It,{children:"Name"}),r.jsx(It,{children:"Description"}),r.jsx(It,{className:"text-center",children:"Items"}),r.jsx(It,{className:"text-right",children:"Actions"})]})}),r.jsx(Vs,{children:Re.map(hr=>r.jsxs(Ar,{children:[r.jsxs(Nt,{className:"font-medium",children:[hr.icon&&r.jsx("span",{className:"mr-2",children:hr.icon}),hr.name]}),r.jsx(Nt,{className:"text-muted-foreground",children:hr.description||"—"}),r.jsx(Nt,{className:"text-center",children:(et==null?void 0:et.filter(xs=>xs.category_id===hr.id).length)||0}),r.jsx(Nt,{className:"text-right",children:r.jsxs("div",{className:"flex items-center justify-end gap-1",children:[r.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>Mt(hr),children:r.jsx(_i,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>C(hr.id),children:r.jsx(Vn,{className:"h-4 w-4 text-destructive"})})]})})]},hr.id))})]})})]})}),r.jsx(An,{value:"purchases",className:"mt-4",children:r.jsxs(Ye,{children:[r.jsxs(Gt,{children:[r.jsxs(Zt,{className:"flex items-center gap-2",children:[r.jsx(fh,{className:"h-5 w-5"}),"Purchase History"]}),r.jsx(Mn,{children:"View all reward redemptions by agents"})]}),r.jsx(tt,{children:!Ze||Ze.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(fh,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),r.jsx("p",{children:"No purchases yet."})]}):r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Ar,{children:[r.jsx(It,{children:"Date"}),r.jsx(It,{children:"Agent"}),r.jsx(It,{children:"Item"}),r.jsx(It,{className:"text-center",children:"Points Spent"})]})}),r.jsx(Vs,{children:Ze.map(hr=>{var xs,ka,xa,zi;return r.jsxs(Ar,{children:[r.jsx(Nt,{className:"text-muted-foreground",children:yn(new Date(hr.purchased_at),"MMM d, yyyy 'at' h:mm a")}),r.jsx(Nt,{children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:"h-8 w-8 rounded-full bg-muted flex items-center justify-center",children:r.jsx(Ec,{className:"h-4 w-4 text-muted-foreground"})}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:((xs=hr.user)==null?void 0:xs.name)||"Unknown"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:((ka=hr.user)==null?void 0:ka.email)||"—"})]})]})}),r.jsx(Nt,{children:r.jsxs("div",{className:"flex items-center gap-2",children:[(xa=hr.item)!=null&&xa.preview_image_url?r.jsx("img",{src:hr.item.preview_image_url,alt:hr.item.name,className:"h-8 w-8 rounded object-cover"}):r.jsx("div",{className:"h-8 w-8 rounded bg-muted flex items-center justify-center",children:r.jsx(Ki,{className:"h-4 w-4 text-muted-foreground"})}),r.jsx("span",{children:((zi=hr.item)==null?void 0:zi.name)||"Deleted item"})]})}),r.jsx(Nt,{className:"text-center",children:r.jsxs(Ot,{variant:"secondary",className:"font-bold",children:[r.jsx(vs,{className:"h-3 w-3 mr-1"}),hr.points_spent]})})]},hr.id)})})]})})]})})]})]}),r.jsx(Fr,{open:s,onOpenChange:a,children:r.jsxs(Rr,{children:[r.jsxs(qr,{children:[r.jsx($r,{children:o?"Edit Category":"Add Category"}),r.jsx(Xn,{children:o?"Update the category details":"Create a new category for your store items"})]}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"categoryName",children:"Name"}),r.jsx(dt,{id:"categoryName",value:i,onChange:hr=>h(hr.target.value),placeholder:"e.g., Templates, Resources"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"categoryDescription",children:"Description"}),r.jsx(ps,{id:"categoryDescription",value:p,onChange:hr=>x(hr.target.value),placeholder:"Optional description..."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"categoryIcon",children:"Icon (emoji)"}),r.jsx(dt,{id:"categoryIcon",value:y,onChange:hr=>b(hr.target.value),placeholder:"e.g., 📄, 🎁"})]})]}),r.jsxs(ea,{children:[r.jsx(ee,{variant:"outline",onClick:()=>a(!1),children:"Cancel"}),r.jsx(ee,{onClick:wt,disabled:at.isPending||Me.isPending,children:at.isPending||Me.isPending?"Saving...":"Save"})]})]})}),r.jsx(Fr,{open:N,onOpenChange:A,children:r.jsxs(Rr,{className:"max-w-lg max-h-[90vh] overflow-y-auto",children:[r.jsxs(qr,{children:[r.jsx($r,{children:E?"Edit Item":"Add Item"}),r.jsx(Xn,{children:E?"Update the item details":"Create a new reward item for agents to purchase"})]}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"itemName",children:"Name *"}),r.jsx(dt,{id:"itemName",value:L,onChange:hr=>z(hr.target.value),placeholder:"e.g., Premium Template Pack"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"itemDescription",children:"Description"}),r.jsx(ps,{id:"itemDescription",value:F,onChange:hr=>q(hr.target.value),placeholder:"Describe the item..."})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"itemCategory",children:"Category"}),r.jsxs(gn,{value:H||"none",onValueChange:hr=>Z(hr==="none"?null:hr),children:[r.jsx(fn,{children:r.jsx(xn,{placeholder:"Select category"})}),r.jsxs(pn,{children:[r.jsx(Vt,{value:"none",children:"No category"}),Re==null?void 0:Re.map(hr=>r.jsxs(Vt,{value:hr.id,children:[hr.icon&&`${hr.icon} `,hr.name]},hr.id))]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"itemPointsCost",children:"Points Cost *"}),r.jsx(dt,{id:"itemPointsCost",type:"number",min:"0",value:G,onChange:hr=>te(hr.target.value),placeholder:"e.g., 100"})]})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"itemType",children:"Type"}),r.jsxs(gn,{value:ie,onValueChange:le,children:[r.jsx(fn,{children:r.jsx(xn,{})}),r.jsxs(pn,{children:[r.jsx(Vt,{value:"file",children:"File Download"}),r.jsx(Vt,{value:"link",children:"External Link"})]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"itemMaxQuantity",children:"Max Quantity"}),r.jsx(dt,{id:"itemMaxQuantity",type:"number",min:"1",value:he,onChange:hr=>ue(hr.target.value),placeholder:"Leave empty for unlimited"})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"File / Link URL"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(dt,{value:ye,onChange:hr=>ne(hr.target.value),placeholder:ie==="file"?"Upload a file or paste URL":"Paste external link"}),ie==="file"&&r.jsxs(r.Fragment,{children:[r.jsx(ee,{type:"button",variant:"outline",size:"icon",onClick:()=>{var hr;return(hr=Ee.current)==null?void 0:hr.click()},disabled:me,children:r.jsx(uo,{className:"h-4 w-4"})}),r.jsx("input",{ref:Ee,type:"file",className:"hidden",onChange:hr=>{var ka;const xs=(ka=hr.target.files)==null?void 0:ka[0];xs&&cn(xs,"file")}})]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{children:"Preview Image"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(dt,{value:ge,onChange:hr=>ae(hr.target.value),placeholder:"Upload an image or paste URL"}),r.jsx(ee,{type:"button",variant:"outline",size:"icon",onClick:()=>{var hr;return(hr=Ue.current)==null?void 0:hr.click()},disabled:Ne,children:r.jsx(Pl,{className:"h-4 w-4"})}),r.jsx("input",{ref:Ue,type:"file",accept:"image/*",className:"hidden",onChange:hr=>{var ka;const xs=(ka=hr.target.files)==null?void 0:ka[0];xs&&cn(xs,"preview")}})]}),ge&&r.jsx("img",{src:ge,alt:"Preview",className:"mt-2 h-24 rounded object-cover"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ps,{id:"itemIsActive",checked:_e,onCheckedChange:Ae}),r.jsx(He,{htmlFor:"itemIsActive",children:"Active (visible to agents)"})]})]}),r.jsxs(ea,{children:[r.jsx(ee,{variant:"outline",onClick:()=>A(!1),children:"Cancel"}),r.jsx(ee,{onClick:jn,disabled:qe.isPending||Oe.isPending,children:qe.isPending||Oe.isPending?"Saving...":"Save"})]})]})}),r.jsx(Iu,{open:!!j,onOpenChange:()=>C(null),children:r.jsxs(tu,{children:[r.jsxs(ru,{children:[r.jsx(su,{children:"Delete Category"}),r.jsx(au,{children:"Are you sure you want to delete this category? Items in this category will become uncategorized."})]}),r.jsxs(nu,{children:[r.jsx(iu,{children:"Cancel"}),r.jsx(Ld,{onClick:Qt,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})}),r.jsx(Iu,{open:!!Ce,onOpenChange:()=>be(null),children:r.jsxs(tu,{children:[r.jsxs(ru,{children:[r.jsx(su,{children:"Delete Item"}),r.jsx(au,{children:"Are you sure you want to delete this item? This action cannot be undone."})]}),r.jsxs(nu,{children:[r.jsx(iu,{children:"Cancel"}),r.jsx(Ld,{onClick:Xr,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})}),e==="point-settings"&&r.jsxs(Ye,{className:"mt-4",children:[r.jsx(Gt,{children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(fd,{className:"h-5 w-5"}),r.jsxs("div",{children:[r.jsx(Zt,{children:"Point Reward Settings"}),r.jsx(Mn,{children:"Configure how many points agents earn for various actions. Adjust these values to run double-points promotions."})]})]})}),r.jsx(tt,{children:!yt||yt.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(fd,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),r.jsx("p",{children:"No point settings configured."})]}):r.jsxs(Us,{children:[r.jsx(qs,{children:r.jsxs(Ar,{children:[r.jsx(It,{children:"Action"}),r.jsx(It,{children:"Description"}),r.jsx(It,{className:"text-center w-32",children:"Points"}),r.jsx(It,{className:"text-right w-24",children:"Save"})]})}),r.jsx(Vs,{children:yt.map(hr=>r.jsxs(Ar,{children:[r.jsx(Nt,{children:r.jsx("p",{className:"font-medium",children:hr.action_name})}),r.jsx(Nt,{children:r.jsx("p",{className:"text-sm text-muted-foreground",children:hr.description})}),r.jsx(Nt,{className:"text-center",children:r.jsx(dt,{type:"number",min:"0",className:"w-20 mx-auto text-center",value:gt[hr.id]??hr.points.toString(),onChange:xs=>mt(ka=>({...ka,[hr.id]:xs.target.value}))})}),r.jsx(Nt,{className:"text-right",children:r.jsx(ee,{size:"sm",variant:"outline",disabled:gt[hr.id]===void 0||gt[hr.id]===hr.points.toString()||nt.isPending,onClick:()=>Pn(hr.id,hr.points),children:r.jsx(vg,{className:"h-4 w-4"})})})]},hr.id))})]})})]})]})}function rKt(){const t=Vr(),[e,n]=I.useState(!1),{data:s,isLoading:a}=Yt({queryKey:["social-accounts"],queryFn:async()=>{const{data:p,error:x}=await J.from("social_accounts").select("*").order("created_at",{ascending:!1});if(x)throw x;return p}}),o=cr({mutationFn:async p=>{const{error:x}=await J.from("social_accounts").delete().eq("id",p);if(x)throw x},onSuccess:()=>{t.invalidateQueries({queryKey:["social-accounts"]}),ze.success("Account disconnected successfully")},onError:()=>{ze.error("Failed to disconnect account")}}),l=async()=>{n(!0);try{const{data:p,error:x}=await J.functions.invoke("meta-oauth",{body:{action:"get_auth_url"}});if(x)throw x;if(p!=null&&p.authUrl)window.location.href=p.authUrl;else throw new Error("Failed to get authorization URL")}catch(p){console.error("Meta OAuth error:",p),ze.error("Failed to start connection. Make sure Meta App credentials are configured."),n(!1)}},i=(s==null?void 0:s.filter(p=>p.platform==="facebook"))||[],h=(s==null?void 0:s.filter(p=>p.platform==="instagram"))||[];return r.jsx(Lr,{children:r.jsxs("div",{className:"space-y-6 p-4 md:p-8",children:[r.jsx(Gu,{title:"Integrations",description:"Connect your social media accounts to post directly from the dashboard"}),r.jsxs("div",{className:"grid gap-6 md:grid-cols-2",children:[r.jsxs(Ye,{children:[r.jsx(Gt,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"rounded-full bg-blue-500/10 p-2",children:r.jsx(Rd,{className:"h-6 w-6 text-blue-600"})}),r.jsxs("div",{children:[r.jsx(Zt,{className:"text-lg",children:"Facebook"}),r.jsx(Mn,{children:"Connect Facebook Pages to post content"})]})]})}),r.jsxs(tt,{className:"space-y-4",children:[i.length>0?r.jsx("div",{className:"space-y-3",children:i.map(p=>r.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-3",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsxs(Ks,{className:"h-10 w-10",children:[r.jsx(Ei,{src:p.profile_picture_url||""}),r.jsx(Zs,{children:r.jsx(Rd,{className:"h-5 w-5"})})]}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:p.page_name||p.platform_username||"Facebook Page"}),r.jsx(Ot,{variant:p.is_active?"default":"secondary",className:"text-xs",children:p.is_active?"Connected":"Inactive"})]})]}),r.jsxs(Iu,{children:[r.jsx(G0,{asChild:!0,children:r.jsx(ee,{variant:"ghost",size:"icon",className:"text-destructive hover:text-destructive",children:r.jsx(Vn,{className:"h-4 w-4"})})}),r.jsxs(tu,{children:[r.jsxs(ru,{children:[r.jsx(su,{children:"Disconnect Facebook?"}),r.jsx(au,{children:"This will remove the connection. You'll need to reconnect to post content."})]}),r.jsxs(nu,{children:[r.jsx(iu,{children:"Cancel"}),r.jsx(Ld,{onClick:()=>o.mutate(p.id),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Disconnect"})]})]})]})]},p.id))}):r.jsx("p",{className:"text-sm text-muted-foreground",children:"No Facebook accounts connected"}),r.jsxs(ee,{onClick:l,disabled:e,className:"w-full gap-2",variant:"outline",children:[e?r.jsx(Gl,{className:"h-4 w-4 animate-spin"}):r.jsx(bn,{className:"h-4 w-4"}),"Connect Facebook Page"]})]})]}),r.jsxs(Ye,{children:[r.jsx(Gt,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"rounded-full bg-gradient-to-br from-purple-500/10 via-pink-500/10 to-orange-500/10 p-2",children:r.jsx(lu,{className:"h-6 w-6 text-pink-600"})}),r.jsxs("div",{children:[r.jsx(Zt,{className:"text-lg",children:"Instagram"}),r.jsx(Mn,{children:"Connect Instagram Business accounts"})]})]})}),r.jsxs(tt,{className:"space-y-4",children:[h.length>0?r.jsx("div",{className:"space-y-3",children:h.map(p=>r.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-3",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsxs(Ks,{className:"h-10 w-10",children:[r.jsx(Ei,{src:p.profile_picture_url||""}),r.jsx(Zs,{children:r.jsx(lu,{className:"h-5 w-5"})})]}),r.jsxs("div",{children:[r.jsxs("p",{className:"font-medium",children:["@",p.platform_username||"Instagram Account"]}),r.jsx(Ot,{variant:p.is_active?"default":"secondary",className:"text-xs",children:p.is_active?"Connected":"Inactive"})]})]}),r.jsxs(Iu,{children:[r.jsx(G0,{asChild:!0,children:r.jsx(ee,{variant:"ghost",size:"icon",className:"text-destructive hover:text-destructive",children:r.jsx(Vn,{className:"h-4 w-4"})})}),r.jsxs(tu,{children:[r.jsxs(ru,{children:[r.jsx(su,{children:"Disconnect Instagram?"}),r.jsx(au,{children:"This will remove the connection. You'll need to reconnect to post content."})]}),r.jsxs(nu,{children:[r.jsx(iu,{children:"Cancel"}),r.jsx(Ld,{onClick:()=>o.mutate(p.id),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Disconnect"})]})]})]})]},p.id))}):r.jsx("p",{className:"text-sm text-muted-foreground",children:"No Instagram accounts connected"}),r.jsxs(ee,{onClick:l,disabled:e,className:"w-full gap-2",variant:"outline",children:[e?r.jsx(Gl,{className:"h-4 w-4 animate-spin"}):r.jsx(bn,{className:"h-4 w-4"}),"Connect Instagram Business"]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Note: Instagram Business accounts must be connected to a Facebook Page"})]})]})]}),r.jsxs(Ye,{children:[r.jsxs(Gt,{children:[r.jsx(Zt,{className:"text-lg",children:"Setup Instructions"}),r.jsx(Mn,{children:"Follow these steps to set up Meta integration"})]}),r.jsxs(tt,{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-3 text-sm",children:[r.jsxs("div",{className:"flex gap-3",children:[r.jsx("div",{className:"flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-primary/10 text-xs font-medium",children:"1"}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:"Create a Meta App"}),r.jsx("p",{className:"text-muted-foreground",children:"Go to developers.facebook.com and create a new app"})]})]}),r.jsxs("div",{className:"flex gap-3",children:[r.jsx("div",{className:"flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-primary/10 text-xs font-medium",children:"2"}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:"Add Facebook Login Product"}),r.jsx("p",{className:"text-muted-foreground",children:"Enable Facebook Login and configure OAuth redirect URLs"})]})]}),r.jsxs("div",{className:"flex gap-3",children:[r.jsx("div",{className:"flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-primary/10 text-xs font-medium",children:"3"}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:"Configure API Keys"}),r.jsx("p",{className:"text-muted-foreground",children:"Add META_APP_ID and META_APP_SECRET to your environment"})]})]}),r.jsxs("div",{className:"flex gap-3",children:[r.jsx("div",{className:"flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-primary/10 text-xs font-medium",children:"4"}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:"Request Permissions"}),r.jsx("p",{className:"text-muted-foreground",children:"Request pages_manage_posts, pages_read_engagement, instagram_basic, and instagram_content_publish"})]})]})]}),r.jsx(ee,{variant:"outline",className:"gap-2",asChild:!0,children:r.jsxs("a",{href:"https://developers.facebook.com/apps",target:"_blank",rel:"noopener noreferrer",children:[r.jsx(Fs,{className:"h-4 w-4"}),"Open Meta Developer Console"]})})]})]})]})})}const nKt={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 QM(t,e=18,n=10){return t.length<=e+n+3?t:`${t.slice(0,e)}…${t.slice(-n)}`}function sKt(){var ie,le,ye,ne,ge;const t=Vr(),[e,n]=I.useState("Test Push"),[s,a]=I.useState("Testing web push notification"),[o,l]=I.useState("/community"),[i,h]=I.useState(!1),[p,x]=I.useState(!1),[y,b]=I.useState({isSupported:typeof window<"u"&&"serviceWorker"in navigator&&"PushManager"in window}),[j,C]=I.useState(null),[N,A]=I.useState(null),{data:E,isLoading:T}=Yt({queryKey:["push-notification-settings"],queryFn:async()=>{const{data:ae,error:he}=await J.from("push_notification_settings").select("*").order("setting_key");if(he)throw he;return ae}}),{data:L,isLoading:z}=Yt({queryKey:["push-subscription-stats"],queryFn:async()=>{const{count:ae,error:he}=await J.from("push_subscriptions").select("*",{count:"exact",head:!0});if(he)throw he;return{totalSubscriptions:ae||0}}}),F=cr({mutationFn:async({settingKey:ae,isEnabled:he})=>{const{error:ue}=await J.from("push_notification_settings").update({is_enabled:he}).eq("setting_key",ae);if(ue)throw ue},onSuccess:()=>{t.invalidateQueries({queryKey:["push-notification-settings"]}),ze.success("Notification setting updated")},onError:ae=>{ze.error("Failed to update setting: "+ae.message)}}),q=I.useMemo(()=>{var ae,he;return y.isSupported?`perm=${y.permission??"unknown"} · controller=${y.controllerPresent?"yes":"no"} · sw=${((ae=y.serviceWorker)==null?void 0:ae.activeState)??"unknown"} · sub=${(he=y.subscription)!=null&&he.endpoint?"yes":"no"}`:"Push not supported in this browser."},[y]);I.useEffect(()=>{let ae=!0;const he=async()=>{var Ce,be,me,Le,Ne,Be,Ee;const _e="serviceWorker"in navigator&&"PushManager"in window,Ae={isSupported:_e,permission:typeof Notification<"u"?Notification.permission:void 0,controllerPresent:!!((Ce=navigator.serviceWorker)!=null&&Ce.controller)};if(!_e){ae&&b(Ae);return}try{const{data:Ue,error:Re}=await J.functions.invoke("get-vapid-public-key",{body:{}});if(Re)throw Re;Ae.vapidPublicKey=Ue==null?void 0:Ue.vapidPublicKey;const et=(await navigator.serviceWorker.getRegistrations()).find(Te=>{var pe,yt,rt;return(((pe=Te.active)==null?void 0:pe.scriptURL)||((yt=Te.waiting)==null?void 0:yt.scriptURL)||((rt=Te.installing)==null?void 0:rt.scriptURL)||"").includes("/sw.js")});if(et){Ae.pushWorkerScriptUrl=((be=et.active)==null?void 0:be.scriptURL)||((me=et.waiting)==null?void 0:me.scriptURL)||((Le=et.installing)==null?void 0:Le.scriptURL),Ae.serviceWorker={scope:et.scope,activeState:(Ne=et.active)==null?void 0:Ne.state};const Te=await et.pushManager.getSubscription();if(Te){const Ze=Te.toJSON();Ae.subscription={endpoint:Ze.endpoint,p256dh:(Be=Ze.keys)==null?void 0:Be.p256dh,auth:(Ee=Ze.keys)==null?void 0:Ee.auth}}}}catch(Ue){Ae.error=(Ue==null?void 0:Ue.message)||String(Ue)}ae&&b(Ae)};he();const ue=window.setInterval(he,4e3);return()=>{ae=!1,window.clearInterval(ue)}},[]);const H=async()=>{if(typeof Notification>"u"){ze.error("Notifications API not available in this browser.");return}try{if(Notification.permission!=="granted"&&await Notification.requestPermission()!=="granted"){ze.error("Notification permission not granted.");return}new Notification("Local notification test",{body:"If you see this, OS/browser notifications can display."}),ze.success("Triggered a local notification (not push).")}catch(ae){ze.error(`Local notification failed: ${(ae==null?void 0:ae.message)||String(ae)}`)}},Z=async()=>{h(!0),C(null);try{const{data:ae,error:he}=await J.functions.invoke("send-push-notification",{body:{title:e,body:s,url:o}});if(he)throw he;C({sent:ae==null?void 0:ae.sent,failed:ae==null?void 0:ae.failed,expiredCleaned:ae==null?void 0:ae.expiredCleaned,vapidPublicKey:ae==null?void 0:ae.vapidPublicKey}),(ae==null?void 0:ae.sent)>0?ze.success(`Test notification sent to ${ae.sent} subscriber(s)`):(ae==null?void 0:ae.failed)>0?ze.warning(`Notification failed for ${ae.failed} subscriber(s). ${ae.expired||0} expired subscriptions cleaned up.`):ze.info("No active subscriptions to send to")}catch(ae){console.error("Error sending test notification:",ae),C({error:(ae==null?void 0:ae.message)||String(ae)}),ze.error("Failed to send test notification: "+(ae.message||"Unknown error"))}finally{h(!1)}},G=async()=>{x(!0),A(null);try{const{data:ae,error:he}=await J.functions.invoke("generate-vapid-keys",{body:{}});if(he)throw he;const ue=ae==null?void 0:ae.publicKey,_e=ae==null?void 0:ae.privateKey;if(!ue||!_e)throw new Error("generate-vapid-keys did not return keys");A({publicKey:ue,privateKey:_e}),ze.success("Generated new VAPID keys. Update backend secrets, then clear + re-subscribe.")}catch(ae){console.error("Error generating VAPID keys:",ae),ze.error("Failed to generate VAPID keys: "+((ae==null?void 0:ae.message)||"Unknown error"))}finally{x(!1)}},te=cr({mutationFn:async()=>{const{error:ae}=await J.from("push_subscriptions").delete().neq("id","00000000-0000-0000-0000-000000000000");if(ae)throw ae},onSuccess:()=>{ze.success("All subscriptions cleared. Users will need to re-enable notifications."),t.invalidateQueries({queryKey:["push-subscription-stats"]})},onError:ae=>{ze.error("Failed to clear subscriptions: "+ae.message)}});return r.jsx(Lr,{title:"Notification Settings",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Gu,{title:"Notification Settings",description:"Manage push notifications and test the notification system"}),r.jsxs(Ye,{children:[r.jsxs(Gt,{children:[r.jsxs(Zt,{className:"flex items-center gap-2",children:[r.jsx(Bn,{className:"h-5 w-5"}),"Push Notification Subscribers"]}),r.jsx(Mn,{children:"Current active push notification subscriptions"})]}),r.jsx(tt,{children:r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx("div",{className:"text-4xl font-bold",children:z?"...":(L==null?void 0:L.totalSubscriptions)||0}),r.jsx("div",{className:"text-sm text-muted-foreground",children:"active subscriptions"})]})})]}),r.jsxs(Ye,{children:[r.jsxs(Gt,{children:[r.jsxs(Zt,{className:"flex items-center gap-2",children:[r.jsx(fd,{className:"h-5 w-5"}),"Notification Types"]}),r.jsx(Mn,{children:"Control which types of push notifications are sent to users"})]}),r.jsx(tt,{children:T?r.jsx("div",{className:"text-sm text-muted-foreground",children:"Loading settings..."}):r.jsx("div",{className:"space-y-4",children:E==null?void 0:E.map(ae=>{const he=nKt[ae.setting_key]||{label:ae.setting_key,icon:"🔔"};return r.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-4",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("span",{className:"text-2xl",children:he.icon}),r.jsxs("div",{children:[r.jsx("div",{className:"font-medium",children:he.label}),r.jsx("div",{className:"text-sm text-muted-foreground",children:ae.description})]})]}),r.jsx(Ps,{checked:ae.is_enabled,onCheckedChange:ue=>F.mutate({settingKey:ae.setting_key,isEnabled:ue}),disabled:F.isPending})]},ae.id)})})})]}),r.jsxs(Ye,{children:[r.jsxs(Gt,{children:[r.jsxs(Zt,{className:"flex items-center gap-2",children:[r.jsx(gg,{className:"h-5 w-5"}),"Send Test Notification"]}),r.jsx(Mn,{children:"Send a test push notification to all subscribed users"})]}),r.jsxs(tt,{className:"space-y-4",children:[r.jsxs("div",{className:"rounded-md border bg-muted/30 p-3 text-sm",children:[r.jsx("div",{className:"font-medium",children:"Client push debug"}),r.jsx("div",{className:"mt-1 text-muted-foreground",children:q}),y.error&&r.jsx("div",{className:"mt-2 text-destructive",children:y.error}),r.jsxs("div",{className:"mt-2 grid gap-2 sm:grid-cols-2",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx("div",{className:"text-xs font-medium text-muted-foreground",children:"Backend VAPID public key"}),r.jsx("div",{className:"break-all rounded-md border bg-background p-2 font-mono text-xs",children:y.vapidPublicKey?QM(y.vapidPublicKey):"(not loaded)"})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsx("div",{className:"text-xs font-medium text-muted-foreground",children:"Service worker"}),r.jsxs("div",{className:"rounded-md border bg-background p-2 font-mono text-xs",children:[r.jsxs("div",{children:["scope: ",(ie=y.serviceWorker)!=null&&ie.scope?QM(y.serviceWorker.scope,24,8):"none"]}),r.jsxs("div",{children:["active: ",((le=y.serviceWorker)==null?void 0:le.activeState)??"none"]})]})]}),r.jsxs("div",{className:"space-y-1 sm:col-span-2",children:[r.jsx("div",{className:"text-xs font-medium text-muted-foreground",children:"Current browser subscription"}),r.jsxs("div",{className:"rounded-md border bg-background p-2 font-mono text-xs",children:[r.jsxs("div",{children:["endpoint: ",(ye=y.subscription)!=null&&ye.endpoint?QM(y.subscription.endpoint,40,12):"none"]}),r.jsxs("div",{children:["p256dh: ",(ne=y.subscription)!=null&&ne.p256dh?QM(y.subscription.p256dh,22,10):"none"]}),r.jsxs("div",{children:["auth: ",(ge=y.subscription)!=null&&ge.auth?QM(y.subscription.auth,22,10):"none"]})]})]})]}),r.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[r.jsx(ee,{variant:"outline",onClick:H,children:"Local notification test"}),r.jsx(ee,{variant:"outline",onClick:()=>window.location.reload(),children:"Reload page"})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"test-title",children:"Notification Title"}),r.jsx(dt,{id:"test-title",value:e,onChange:ae=>n(ae.target.value),placeholder:"Enter notification title"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"test-body",children:"Notification Body"}),r.jsx(ps,{id:"test-body",value:s,onChange:ae=>a(ae.target.value),placeholder:"Enter notification message",rows:3})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"test-url",children:"Click URL (optional)"}),r.jsx(dt,{id:"test-url",value:o,onChange:ae=>l(ae.target.value),placeholder:"/community or full URL"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Where users will be taken when they click the notification"})]}),r.jsxs(ee,{onClick:Z,disabled:i||!e||!s,className:"w-full sm:w-auto",children:[r.jsx(Oo,{className:"h-4 w-4 mr-2"}),i?"Sending...":"Send Test Notification"]}),j&&r.jsxs("div",{className:"rounded-md border bg-muted/30 p-3 text-sm",children:[r.jsx("div",{className:"font-medium",children:"Last send debug"}),j.error?r.jsxs("div",{className:"mt-1 text-destructive",children:["Error: ",j.error]}):r.jsxs("div",{className:"mt-1 space-y-1 text-muted-foreground",children:[r.jsxs("div",{children:["Result: ",j.sent??0," sent, ",j.failed??0," failed, ",j.expiredCleaned??0," expired cleaned"]}),j.vapidPublicKey?r.jsxs("div",{className:"break-all",children:["Backend VAPID public key: ",r.jsx("span",{className:"font-mono",children:j.vapidPublicKey})]}):r.jsx("div",{children:"Backend VAPID public key: (not returned)"})]})]})]})]}),r.jsxs(Ye,{children:[r.jsxs(Gt,{children:[r.jsxs(Zt,{className:"flex items-center gap-2 text-destructive",children:[r.jsx(Vn,{className:"h-5 w-5"}),"Subscription Maintenance"]}),r.jsx(Mn,{children:"Clear all push subscriptions if VAPID keys were changed or subscriptions are invalid"})]}),r.jsxs(tt,{className:"space-y-4",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"If you've recently updated the VAPID keys, existing subscriptions will no longer work. Use this to clear all subscriptions so users can re-subscribe with the new keys."}),r.jsxs(ee,{variant:"destructive",onClick:()=>te.mutate(),disabled:te.isPending,children:[r.jsx(Vn,{className:"h-4 w-4 mr-2"}),te.isPending?"Clearing...":"Clear All Subscriptions"]}),r.jsxs("div",{className:"rounded-md border bg-muted/30 p-3 text-sm",children:[r.jsx("div",{className:"font-medium",children:"VAPID key rotation helper"}),r.jsx("div",{className:"mt-1 text-muted-foreground",children:"If you suspect the backend public/private keys don’t match, generate a fresh pair, update backend secrets, then clear subscriptions and have users re-enable push."}),r.jsx("div",{className:"mt-3 flex flex-wrap gap-2",children:r.jsx(ee,{variant:"outline",onClick:G,disabled:p,children:p?"Generating…":"Generate VAPID keys"})}),N&&r.jsxs("div",{className:"mt-3 space-y-2",children:[r.jsxs("div",{className:"text-muted-foreground",children:["Copy these into backend secrets ",r.jsx("span",{className:"font-mono",children:"VAPID_PUBLIC_KEY"})," and ",r.jsx("span",{className:"font-mono",children:"VAPID_PRIVATE_KEY"}),"."]}),r.jsxs("div",{className:"space-y-1",children:[r.jsx("div",{className:"text-xs font-medium text-muted-foreground",children:"Public key"}),r.jsx("div",{className:"break-all rounded-md border bg-background p-2 font-mono text-xs",children:N.publicKey})]}),r.jsxs("div",{className:"space-y-1",children:[r.jsx("div",{className:"text-xs font-medium text-muted-foreground",children:"Private key (keep secret)"}),r.jsx("div",{className:"break-all rounded-md border bg-background p-2 font-mono text-xs",children:N.privateKey})]})]})]})]})]})]})})}function aKt(){const[t]=$d(),e=rs(),[n,s]=I.useState("loading"),[a,o]=I.useState("Processing connection...");return I.useEffect(()=>{(async()=>{const i=t.get("code"),h=t.get("error"),p=t.get("error_description"),x=t.get("state");if(h){s("error"),o(p||"Authorization was denied"),ze.error("Failed to connect: "+(p||h));return}if(!i){s("error"),o("No authorization code received"),ze.error("Failed to connect: No authorization code");return}try{const{data:y,error:b}=await J.functions.invoke("meta-oauth",{body:{action:"exchange_code",code:i,state:x}});if(b)throw b;if(y!=null&&y.success)s("success"),o(y.message||"Accounts connected successfully!"),ze.success(y.message||"Social accounts connected!");else throw new Error((y==null?void 0:y.error)||"Failed to connect accounts")}catch(y){console.error("Callback error:",y),s("error"),o(y.message||"Failed to complete connection"),ze.error(y.message||"Failed to connect accounts")}})()},[t]),r.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background p-4",children:r.jsxs(Ye,{className:"w-full max-w-md",children:[r.jsxs(Gt,{className:"text-center",children:[r.jsxs("div",{className:"mx-auto mb-4",children:[n==="loading"&&r.jsx(en,{className:"h-12 w-12 animate-spin text-primary"}),n==="success"&&r.jsx(Yi,{className:"h-12 w-12 text-green-500"}),n==="error"&&r.jsx(qc,{className:"h-12 w-12 text-destructive"})]}),r.jsxs(Zt,{children:[n==="loading"&&"Connecting...",n==="success"&&"Connected!",n==="error"&&"Connection Failed"]}),r.jsx(Mn,{children:a})]}),r.jsx(tt,{className:"flex justify-center",children:r.jsx(ee,{onClick:()=>e("/admin/integrations"),children:n==="success"?"View Integrations":"Back to Integrations"})})]})})}function iKt(){const t=rs(),e=Vr(),{isAdmin:n}=Qr(),[s,a]=I.useState(!1),[o,l]=I.useState(null),[i,h]=I.useState(null),{data:p,isLoading:x}=Yt({queryKey:["my-social-accounts"],queryFn:async()=>{const{data:{user:F},error:q}=await J.auth.getUser();if(q)throw q;if(!F)return[];const{data:H,error:Z}=await J.from("social_accounts").select("*").eq("user_id",F.id).order("created_at",{ascending:!1});if(Z)throw Z;return H}}),y=cr({mutationFn:async F=>{const{data:{user:q},error:H}=await J.auth.getUser();if(H)throw H;if(!q)throw new Error("Not authenticated");const{error:Z}=await J.from("social_accounts").delete().eq("id",F).eq("user_id",q.id);if(Z)throw Z},onSuccess:()=>{e.invalidateQueries({queryKey:["my-social-accounts"]}),e.invalidateQueries({queryKey:["social-accounts-for-post"]}),ze.success("Account disconnected successfully")},onError:()=>{ze.error("Failed to disconnect account")}}),b=async()=>{a(!0);try{const{data:F,error:q}=await J.functions.invoke("meta-oauth",{body:{action:"get_auth_url",callbackPath:"/social-connections/callback"}});if(q)throw q;if(F!=null&&F.authUrl)window.location.href=F.authUrl;else throw new Error("Failed to get authorization URL")}catch(F){console.error("Meta OAuth error:",F),ze.error("Failed to start connection. Please try again."),a(!1)}},j=async()=>{a(!0);try{const{data:F,error:q}=await J.functions.invoke("linkedin-oauth",{body:{action:"get_auth_url",callbackPath:"/social-connections/linkedin-callback"}});if(q)throw q;if(F!=null&&F.authUrl)window.location.href=F.authUrl;else throw new Error("Failed to get LinkedIn authorization URL")}catch(F){console.error("LinkedIn OAuth error:",F),ze.error("Failed to start LinkedIn connection. Please try again."),a(!1)}},C=async()=>{a(!0);try{const{data:F,error:q}=await J.functions.invoke("google-business-oauth",{body:{action:"get_auth_url"}});if(q)throw q;if(F!=null&&F.authUrl)window.location.href=F.authUrl;else throw new Error("Failed to get Google authorization URL")}catch(F){console.error("Google OAuth error:",F),ze.error("Failed to start Google connection. Please try again."),a(!1)}},N=(p==null?void 0:p.filter(F=>F.platform==="facebook"))||[],A=(p==null?void 0:p.filter(F=>F.platform==="instagram"))||[],E=(p==null?void 0:p.filter(F=>F.platform==="linkedin"))||[],T=(p==null?void 0:p.filter(F=>F.platform==="google_business"))||[],L=((p==null?void 0:p.length)||0)>0,z=async(F,q)=>{l(F),h(null);try{const{data:H,error:Z}=await J.functions.invoke("meta-api-test",{body:{testType:"all",accountId:F}});if(Z)throw Z;h(H.results||[]),ze.success(H.summary||"API tests completed")}catch(H){console.error("Meta API test error:",H),ze.error("Failed to run API tests")}finally{l(null)}};return r.jsx(Lr,{title:"Social Connections",children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"relative overflow-hidden rounded-2xl bg-gradient-to-br from-pink-500 via-purple-500 to-blue-500 p-6 md:p-8 text-white",children:[r.jsx("div",{className:"absolute inset-0 bg-[url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNjAiIGhlaWdodD0iNjAiIHZpZXdCb3g9IjAgMCA2MCA2MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxnIGZpbGw9IiNmZmYiIGZpbGwtb3BhY2l0eT0iMC4xIj48cGF0aCBkPSJNMzYgMzRjMC0yIDItNCAyLTRzMiAyIDIgNC0yIDQtMiA0LTItMi0yLTR6Ii8+PC9nPjwvZz48L3N2Zz4=')] opacity-30"}),r.jsxs("div",{className:"relative",children:[r.jsx("div",{className:"flex items-center gap-2 mb-3",children:r.jsxs(Ot,{variant:"secondary",className:"bg-white/20 text-white border-0 backdrop-blur-sm",children:[r.jsx(Ms,{className:"h-3 w-3 mr-1"}),"Post directly from Social Swag"]})}),r.jsx("h1",{className:"text-2xl md:text-3xl font-bold mb-2",children:"Connect Your Social Accounts"}),r.jsx("p",{className:"text-white/90 max-w-xl",children:"Link your Facebook Pages and Instagram Business accounts to post content directly from Social Swag with one click."})]})]}),r.jsxs(ee,{variant:"ghost",onClick:()=>t("/social-swag-2"),className:"gap-2",children:[r.jsx(so,{className:"h-4 w-4"}),"Back to Social Swag"]}),!n&&r.jsx(Ye,{className:"border-amber-200 bg-amber-50 dark:bg-amber-950/20 dark:border-amber-800",children:r.jsxs(tt,{className:"flex flex-col items-center justify-center py-12 text-center",children:[r.jsx("div",{className:"rounded-full bg-amber-100 dark:bg-amber-900/30 p-4 mb-4",children:r.jsx(Ya,{className:"h-10 w-10 text-amber-600 dark:text-amber-400"})}),r.jsx(Ot,{variant:"secondary",className:"mb-3 bg-amber-100 text-amber-800 dark:bg-amber-900/30 dark:text-amber-400",children:"Coming Soon"}),r.jsx("h2",{className:"text-xl font-semibold mb-2",children:"Social Connections Coming Soon!"}),r.jsx("p",{className:"text-muted-foreground max-w-md",children:"We're putting the finishing touches on this feature. Soon you'll be able to connect your social accounts and post directly from Social Swag with one click."})]})}),n&&r.jsxs(r.Fragment,{children:[L&&r.jsx(Ye,{className:"border-green-200 bg-green-50 dark:bg-green-950/20 dark:border-green-900",children:r.jsxs(tt,{className:"flex items-center gap-4 p-4",children:[r.jsx("div",{className:"rounded-full bg-green-500 p-2",children:r.jsx(Yi,{className:"h-5 w-5 text-white"})}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium text-green-800 dark:text-green-200",children:"You're all set!"}),r.jsx("p",{className:"text-sm text-green-600 dark:text-green-400",children:"You can now post directly to your connected accounts from Social Swag."})]})]})}),r.jsxs("div",{className:"grid gap-6 md:grid-cols-2 lg:grid-cols-3",children:[r.jsxs(Ye,{children:[r.jsx(Gt,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"rounded-full bg-blue-500/10 p-3",children:r.jsx(Rd,{className:"h-6 w-6 text-blue-600"})}),r.jsxs("div",{children:[r.jsx(Zt,{className:"text-lg",children:"Facebook"}),r.jsx(Mn,{children:"Connect your Facebook Pages"})]})]})}),r.jsxs(tt,{className:"space-y-4",children:[x?r.jsx("div",{className:"flex items-center justify-center py-8",children:r.jsx(Gl,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):N.length>0?r.jsx("div",{className:"space-y-3",children:N.map(F=>r.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-3",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsxs(Ks,{className:"h-10 w-10",children:[r.jsx(Ei,{src:F.profile_picture_url||""}),r.jsx(Zs,{children:r.jsx(Rd,{className:"h-5 w-5"})})]}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:F.page_name||F.platform_username||"Facebook Page"}),r.jsx(Ot,{variant:F.is_active?"default":"secondary",className:"text-xs",children:F.is_active?"Connected":"Inactive"})]})]}),r.jsxs(Iu,{children:[r.jsx(G0,{asChild:!0,children:r.jsx(ee,{variant:"ghost",size:"icon",className:"text-destructive hover:text-destructive",children:r.jsx(Vn,{className:"h-4 w-4"})})}),r.jsxs(tu,{children:[r.jsxs(ru,{children:[r.jsx(su,{children:"Disconnect Facebook?"}),r.jsx(au,{children:"This will remove the connection. You'll need to reconnect to post content."})]}),r.jsxs(nu,{children:[r.jsx(iu,{children:"Cancel"}),r.jsx(Ld,{onClick:()=>y.mutate(F.id),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Disconnect"})]})]})]})]},F.id))}):r.jsx("p",{className:"text-sm text-muted-foreground py-4 text-center",children:"No Facebook pages connected yet"}),r.jsxs(ee,{onClick:b,disabled:s,className:"w-full gap-2",variant:N.length>0?"outline":"default",children:[s?r.jsx(Gl,{className:"h-4 w-4 animate-spin"}):r.jsx(bn,{className:"h-4 w-4"}),N.length>0?"Connect Another Page":"Connect Facebook Page"]})]})]}),r.jsxs(Ye,{children:[r.jsx(Gt,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"rounded-full bg-gradient-to-br from-purple-500/10 via-pink-500/10 to-orange-500/10 p-3",children:r.jsx(lu,{className:"h-6 w-6 text-pink-600"})}),r.jsxs("div",{children:[r.jsx(Zt,{className:"text-lg",children:"Instagram"}),r.jsx(Mn,{children:"Connect Instagram Business accounts"})]})]})}),r.jsxs(tt,{className:"space-y-4",children:[x?r.jsx("div",{className:"flex items-center justify-center py-8",children:r.jsx(Gl,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):A.length>0?r.jsx("div",{className:"space-y-3",children:A.map(F=>r.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-3",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsxs(Ks,{className:"h-10 w-10",children:[r.jsx(Ei,{src:F.profile_picture_url||""}),r.jsx(Zs,{children:r.jsx(lu,{className:"h-5 w-5"})})]}),r.jsxs("div",{children:[r.jsxs("p",{className:"font-medium",children:["@",F.platform_username||"Instagram Account"]}),r.jsx(Ot,{variant:F.is_active?"default":"secondary",className:"text-xs",children:F.is_active?"Connected":"Inactive"})]})]}),r.jsxs(Iu,{children:[r.jsx(G0,{asChild:!0,children:r.jsx(ee,{variant:"ghost",size:"icon",className:"text-destructive hover:text-destructive",children:r.jsx(Vn,{className:"h-4 w-4"})})}),r.jsxs(tu,{children:[r.jsxs(ru,{children:[r.jsx(su,{children:"Disconnect Instagram?"}),r.jsx(au,{children:"This will remove the connection. You'll need to reconnect to post content."})]}),r.jsxs(nu,{children:[r.jsx(iu,{children:"Cancel"}),r.jsx(Ld,{onClick:()=>y.mutate(F.id),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Disconnect"})]})]})]})]},F.id))}):r.jsx("p",{className:"text-sm text-muted-foreground py-4 text-center",children:"No Instagram accounts connected yet"}),r.jsxs(ee,{onClick:b,disabled:s,className:"w-full gap-2",variant:A.length>0?"outline":"default",children:[s?r.jsx(Gl,{className:"h-4 w-4 animate-spin"}):r.jsx(bn,{className:"h-4 w-4"}),A.length>0?"Connect Another Account":"Connect Instagram"]}),r.jsx("p",{className:"text-xs text-muted-foreground text-center",children:"Instagram Business accounts must be connected to a Facebook Page"})]})]}),r.jsxs(Ye,{children:[r.jsx(Gt,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"rounded-full bg-blue-600/10 p-3",children:r.jsx(mm,{className:"h-6 w-6 text-blue-700"})}),r.jsxs("div",{children:[r.jsx(Zt,{className:"text-lg",children:"LinkedIn"}),r.jsx(Mn,{children:"Connect your LinkedIn profile"})]})]})}),r.jsxs(tt,{className:"space-y-4",children:[x?r.jsx("div",{className:"flex items-center justify-center py-8",children:r.jsx(Gl,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):E.length>0?r.jsx("div",{className:"space-y-3",children:E.map(F=>r.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-3",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsxs(Ks,{className:"h-10 w-10",children:[r.jsx(Ei,{src:F.profile_picture_url||""}),r.jsx(Zs,{children:r.jsx(mm,{className:"h-5 w-5"})})]}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:F.platform_username||"LinkedIn Account"}),r.jsx(Ot,{variant:F.is_active?"default":"secondary",className:"text-xs",children:F.is_active?"Connected":"Inactive"})]})]}),r.jsxs(Iu,{children:[r.jsx(G0,{asChild:!0,children:r.jsx(ee,{variant:"ghost",size:"icon",className:"text-destructive hover:text-destructive",children:r.jsx(Vn,{className:"h-4 w-4"})})}),r.jsxs(tu,{children:[r.jsxs(ru,{children:[r.jsx(su,{children:"Disconnect LinkedIn?"}),r.jsx(au,{children:"This will remove the connection. You'll need to reconnect to post content."})]}),r.jsxs(nu,{children:[r.jsx(iu,{children:"Cancel"}),r.jsx(Ld,{onClick:()=>y.mutate(F.id),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Disconnect"})]})]})]})]},F.id))}):r.jsx("p",{className:"text-sm text-muted-foreground py-4 text-center",children:"No LinkedIn account connected yet"}),r.jsxs(ee,{onClick:j,disabled:s,className:"w-full gap-2",variant:E.length>0?"outline":"default",children:[s?r.jsx(Gl,{className:"h-4 w-4 animate-spin"}):r.jsx(bn,{className:"h-4 w-4"}),E.length>0?"Reconnect LinkedIn":"Connect LinkedIn"]}),r.jsx("p",{className:"text-xs text-muted-foreground text-center",children:"Share content directly to your LinkedIn profile"})]})]}),r.jsxs(Ye,{className:`relative overflow-hidden ${n?"":"opacity-75"}`,children:[!n&&r.jsx("div",{className:"absolute top-3 right-3 z-10",children:r.jsx(Ot,{variant:"secondary",className:"bg-amber-100 text-amber-800 dark:bg-amber-900/30 dark:text-amber-400",children:"Coming Soon"})}),n&&r.jsx("div",{className:"absolute top-3 right-3 z-10",children:r.jsx(Ot,{variant:"secondary",className:"bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-400",children:"Admin Testing"})}),r.jsx(Gt,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"rounded-full bg-red-500/10 p-3",children:r.jsx(fl,{className:"h-6 w-6 text-red-600"})}),r.jsxs("div",{children:[r.jsx(Zt,{className:"text-lg",children:"Google Business"}),r.jsx(Mn,{children:"Connect your Google Business Profile"})]})]})}),r.jsxs(tt,{className:"space-y-4",children:[x?r.jsx("div",{className:"flex items-center justify-center py-8",children:r.jsx(Gl,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):T.length>0?r.jsx("div",{className:"space-y-3",children:T.map(F=>r.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-3",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsxs(Ks,{className:"h-10 w-10",children:[r.jsx(Ei,{src:F.profile_picture_url||""}),r.jsx(Zs,{children:r.jsx(fl,{className:"h-5 w-5"})})]}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:F.page_name||F.platform_username||"Google Business"}),r.jsx(Ot,{variant:F.is_active?"default":"secondary",className:"text-xs",children:F.is_active?"Connected":"Inactive"})]})]}),r.jsxs(Iu,{children:[r.jsx(G0,{asChild:!0,children:r.jsx(ee,{variant:"ghost",size:"icon",className:"text-destructive hover:text-destructive",children:r.jsx(Vn,{className:"h-4 w-4"})})}),r.jsxs(tu,{children:[r.jsxs(ru,{children:[r.jsx(su,{children:"Disconnect Google Business?"}),r.jsx(au,{children:"This will remove the connection. You'll need to reconnect to post content."})]}),r.jsxs(nu,{children:[r.jsx(iu,{children:"Cancel"}),r.jsx(Ld,{onClick:()=>y.mutate(F.id),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Disconnect"})]})]})]})]},F.id))}):r.jsx("p",{className:"text-sm text-muted-foreground py-4 text-center",children:n?"No Google Business account connected yet":"Google Business Profile integration is coming soon!"}),r.jsxs(ee,{onClick:n?C:void 0,disabled:!n||s,className:"w-full gap-2",variant:T.length>0?"outline":"default",children:[s?r.jsx(Gl,{className:"h-4 w-4 animate-spin"}):r.jsx(bn,{className:"h-4 w-4"}),T.length>0?"Reconnect Google Business":"Connect Google Business"]}),r.jsx("p",{className:"text-xs text-muted-foreground text-center",children:"Post updates directly to your Google Business Profile"})]})]})]}),n&&(N.length>0||A.length>0)&&r.jsxs(Ye,{className:"border-amber-200 bg-amber-50 dark:bg-amber-950/20 dark:border-amber-900",children:[r.jsx(Gt,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"rounded-full bg-amber-500/10 p-3",children:r.jsx(fj,{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(Mn,{children:"Run API tests to trigger all required permissions for Meta App Review"})]})]})}),r.jsxs(tt,{className:"space-y-4",children:[r.jsxs("p",{className:"text-sm text-muted-foreground",children:['Click "Run Tests" on an account to trigger API calls for: ',r.jsx("strong",{children:"public_profile"}),", ",r.jsx("strong",{children:"pages_show_list"}),", ",r.jsx("strong",{children:"pages_read_engagement"}),", ",r.jsx("strong",{children:"instagram_basic"}),", ",r.jsx("strong",{children:"pages_manage_posts"}),", and ",r.jsx("strong",{children:"instagram_content_publish"}),"."]}),r.jsxs("div",{className:"space-y-3",children:[N.map(F=>r.jsxs("div",{className:"flex items-center justify-between rounded-lg border bg-background p-3",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(Rd,{className:"h-5 w-5 text-blue-600"}),r.jsx("span",{className:"font-medium",children:F.page_name||"Facebook Page"})]}),r.jsx(ee,{size:"sm",variant:"outline",onClick:()=>z(F.id),disabled:o===F.id,children:o===F.id?r.jsxs(r.Fragment,{children:[r.jsx(en,{className:"h-4 w-4 mr-2 animate-spin"}),"Testing..."]}):r.jsxs(r.Fragment,{children:[r.jsx(fj,{className:"h-4 w-4 mr-2"}),"Run Tests"]})})]},`test-fb-${F.id}`)),A.map(F=>r.jsxs("div",{className:"flex items-center justify-between rounded-lg border bg-background p-3",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(lu,{className:"h-5 w-5 text-pink-600"}),r.jsxs("span",{className:"font-medium",children:["@",F.platform_username||"Instagram"]})]}),r.jsx(ee,{size:"sm",variant:"outline",onClick:()=>z(F.id),disabled:o===F.id,children:o===F.id?r.jsxs(r.Fragment,{children:[r.jsx(en,{className:"h-4 w-4 mr-2 animate-spin"}),"Testing..."]}):r.jsxs(r.Fragment,{children:[r.jsx(fj,{className:"h-4 w-4 mr-2"}),"Run Tests"]})})]},`test-ig-${F.id}`))]}),i&&i.length>0&&r.jsxs("div",{className:"mt-4 rounded-lg border bg-background p-4",children:[r.jsx("h4",{className:"font-medium mb-3",children:"Test Results"}),r.jsx("div",{className:"space-y-2",children:i.map((F,q)=>r.jsxs("div",{className:"flex items-start gap-2 text-sm",children:[F.status==="success"?r.jsx(Xi,{className:"h-4 w-4 text-green-600 mt-0.5 shrink-0"}):F.status==="pending"?r.jsx(en,{className:"h-4 w-4 text-amber-600 mt-0.5 shrink-0"}):r.jsx(qc,{className:"h-4 w-4 text-red-600 mt-0.5 shrink-0"}),r.jsxs("div",{children:[r.jsx("span",{className:"font-mono text-xs bg-muted px-1 rounded",children:F.test}),r.jsx("span",{className:"ml-2 text-muted-foreground",children:F.details})]})]},q))})]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Note: Facebook posts are auto-deleted. Instagram posts will remain and should be manually deleted. Allow up to 24 hours for Meta to register the API calls."})]})]}),r.jsxs(Ye,{children:[r.jsx(Gt,{children:r.jsx(Zt,{className:"text-lg",children:"How it works"})}),r.jsx(tt,{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 oKt(){const[t]=$d(),e=rs(),[n,s]=I.useState("loading"),[a,o]=I.useState("Processing your connection...");return I.useEffect(()=>{(async()=>{var y;const i=t.get("code"),h=t.get("error"),p=t.get("error_description"),x=t.get("state");if(h){s("error"),o(p||"Authorization was denied"),ze.error("Connection failed: "+(p||h));return}if(!i){s("error"),o("No authorization code received"),ze.error("No authorization code received");return}try{const{data:b,error:j}=await J.functions.invoke("meta-oauth",{body:{action:"exchange_code",code:i,state:x,callbackPath:"/social-connections/callback"}});if(j)throw j;if(b!=null&&b.success)s("success"),o(`Successfully connected ${((y=b.accounts)==null?void 0:y.length)||0} account(s)!`),ze.success("Social accounts connected successfully!");else throw new Error((b==null?void 0:b.error)||"Unknown error")}catch(b){console.error("OAuth callback error:",b),s("error"),o(b instanceof Error?b.message:"Failed to connect accounts"),ze.error("Failed to connect: "+(b instanceof Error?b.message:"Unknown error"))}})()},[t]),r.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background p-4",children:r.jsxs(Ye,{className:"w-full max-w-md",children:[r.jsxs(Gt,{className:"text-center",children:[n==="loading"&&r.jsx(en,{className:"h-12 w-12 animate-spin mx-auto text-primary"}),n==="success"&&r.jsx(Yi,{className:"h-12 w-12 mx-auto text-green-500"}),n==="error"&&r.jsx(qc,{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(Mn,{children:a})]}),r.jsx(tt,{className:"flex justify-center",children:n!=="loading"&&r.jsx(ee,{onClick:()=>e("/social-connections"),children:n==="success"?"View Connected Accounts":"Try Again"})})]})})}function lKt(){const[t]=$d(),e=rs(),[n,s]=I.useState("loading"),[a,o]=I.useState("Connecting your Google Business Profile...");return I.useEffect(()=>{(async()=>{const i=t.get("code"),h=t.get("error"),p=t.get("error_description"),x=t.get("state");if(h){s("error"),o(p||"Authorization was denied"),ze.error("Connection failed: "+(p||h));return}if(!i){s("error"),o("No authorization code received"),ze.error("No authorization code received");return}try{const{data:y,error:b}=await J.functions.invoke("google-business-oauth",{body:{action:"exchange_code",code:i,state:x}});if(b)throw b;if(y!=null&&y.success)s("success"),o(y.message||"Successfully connected Google Business Profile!"),ze.success("Google Business Profile connected!");else throw new Error((y==null?void 0:y.error)||"Unknown error")}catch(y){console.error("Google OAuth callback error:",y),s("error"),o(y instanceof Error?y.message:"Failed to connect Google Business Profile"),ze.error("Failed to connect: "+(y instanceof Error?y.message:"Unknown error"))}})()},[t]),r.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background p-4",children:r.jsxs(Ye,{className:"w-full max-w-md",children:[r.jsxs(Gt,{className:"text-center",children:[n==="loading"&&r.jsx(en,{className:"h-12 w-12 animate-spin mx-auto text-primary"}),n==="success"&&r.jsx(Yi,{className:"h-12 w-12 mx-auto text-green-500"}),n==="error"&&r.jsx(qc,{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(Mn,{children:a})]}),r.jsx(tt,{className:"flex justify-center",children:n!=="loading"&&r.jsx(ee,{onClick:()=>e("/social-connections"),children:n==="success"?"View Connected Accounts":"Try Again"})})]})})}function cKt(){const[t]=$d(),e=rs(),[n,s]=I.useState("loading"),[a,o]=I.useState("Connecting your LinkedIn account...");return I.useEffect(()=>{(async()=>{var y;const i=t.get("code"),h=t.get("state"),p=t.get("error"),x=t.get("error_description");if(p){console.error("LinkedIn OAuth error:",p,x),s("error"),o(x||"Failed to connect LinkedIn account"),ze.error(x||"Failed to connect LinkedIn");return}if(!i){s("error"),o("No authorization code received"),ze.error("No authorization code received");return}try{const{data:b,error:j}=await J.functions.invoke("linkedin-oauth",{body:{action:"exchange_code",code:i,state:h,callbackPath:"/social-connections/linkedin-callback"}});if(j)throw j;if(b!=null&&b.success)s("success"),o(`Successfully connected ${((y=b.accounts)==null?void 0:y.length)||1} LinkedIn account`),ze.success("LinkedIn connected successfully!");else throw new Error((b==null?void 0:b.error)||"Failed to connect LinkedIn account")}catch(b){console.error("LinkedIn callback error:",b),s("error"),o(b instanceof Error?b.message:"Failed to connect LinkedIn account"),ze.error("Failed to connect LinkedIn")}})()},[t]),r.jsx("div",{className:"min-h-screen flex items-center justify-center p-4 bg-background",children:r.jsxs(Ye,{className:"w-full max-w-md",children:[r.jsxs(Gt,{className:"text-center",children:[r.jsxs("div",{className:"mx-auto mb-4 rounded-full bg-blue-600/10 p-4 w-fit",children:[n==="loading"&&r.jsx(en,{className:"h-8 w-8 animate-spin text-blue-600"}),n==="success"&&r.jsx(Yi,{className:"h-8 w-8 text-green-600"}),n==="error"&&r.jsx(qc,{className:"h-8 w-8 text-red-600"})]}),r.jsxs(Zt,{className:"flex items-center justify-center gap-2",children:[r.jsx(mm,{className:"h-5 w-5 text-blue-600"}),n==="loading"&&"Connecting...",n==="success"&&"Connected!",n==="error"&&"Connection Failed"]}),r.jsx(Mn,{children:a})]}),r.jsx(tt,{className:"flex justify-center",children:r.jsx(ee,{onClick:()=>e("/social-connections"),disabled:n==="loading",children:n==="success"?"Continue":"Back to Connections"})})]})})}function dKt(){const t=rs(),[e,n]=I.useState(null),{data:s,isLoading:a}=q$e(e||void 0,!0),{data:o,isLoading:l}=E0e(!0),{cartItems:i}=xse(),h=i.reduce((x,y)=>x+y.quantity,0),p=x=>{t(`/marketplace/${x.id}`)};return a||l?r.jsx(Lr,{title:"Marketplace",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx("div",{className:"flex gap-2 overflow-x-auto pb-2",children:[1,2,3].map(x=>r.jsx(Ir,{className:"h-10 w-24 flex-shrink-0"},x))}),r.jsx("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4",children:[1,2,3,4].map(x=>r.jsx(Ir,{className:"h-72 w-full"},x))})]})}):r.jsx(Lr,{title:"Marketplace",children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-5xl font-bold text-foreground",children:"Marketplace"}),r.jsx("p",{className:"text-muted-foreground mt-1",children:"Shop exclusive products for LevelUp members"})]}),r.jsxs(ee,{variant:"outline",onClick:()=>t("/marketplace/cart"),className:"relative",children:[r.jsx(fh,{className:"h-4 w-4 mr-2"}),"Cart",h>0&&r.jsx(Ot,{className:"absolute -top-2 -right-2 h-5 w-5 flex items-center justify-center p-0 text-xs",children:h})]})]}),o&&o.length>0&&r.jsxs("div",{className:"flex gap-2 overflow-x-auto pb-2",children:[r.jsx(ee,{variant:e===null?"default":"outline",size:"sm",onClick:()=>n(null),children:"All"}),o.map(x=>r.jsx(ee,{variant:e===x.id?"default":"outline",size:"sm",onClick:()=>n(x.id),children:x.name},x.id))]}),s&&s.length>0?r.jsx("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4",children:s.map(x=>{var y;return r.jsxs(Ye,{className:"overflow-hidden cursor-pointer hover:shadow-lg transition-shadow",onClick:()=>p(x),children:[r.jsxs("div",{className:"aspect-square bg-muted relative",children:[x.images&&x.images.length>0?r.jsx("img",{src:((y=x.images.find(b=>b.is_primary))==null?void 0:y.image_url)||x.images[0].image_url,alt:x.name,className:"w-full h-full object-cover"}):r.jsx("div",{className:"flex items-center justify-center h-full",children:r.jsx(zl,{className:"h-12 w-12 text-muted-foreground"})}),x.category&&r.jsx(Ot,{className:"absolute top-2 left-2",variant:"secondary",children:x.category.name})]}),r.jsxs(tt,{className:"p-4",children:[r.jsx("h3",{className:"font-semibold mb-1 line-clamp-1",children:x.name}),x.description&&r.jsx("p",{className:"text-sm text-muted-foreground mb-2 line-clamp-2",children:x.description}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("span",{className:"font-bold text-lg",children:["$",Number(x.base_price).toFixed(2)]}),x.variants&&x.variants.length>0&&r.jsxs("span",{className:"text-xs text-muted-foreground",children:[x.variants.length," options"]})]})]})]},x.id)})}):r.jsxs("div",{className:"text-center py-12",children:[r.jsx(zl,{className:"h-12 w-12 mx-auto text-muted-foreground mb-4"}),r.jsx("p",{className:"text-muted-foreground",children:"No products available yet."})]})]})})}const W$e=I.forwardRef(({...t},e)=>r.jsx("nav",{ref:e,"aria-label":"breadcrumb",...t}));W$e.displayName="Breadcrumb";const G$e=I.forwardRef(({className:t,...e},n)=>r.jsx("ol",{ref:n,className:$t("flex flex-wrap items-center gap-1.5 break-words text-sm text-muted-foreground sm:gap-2.5",t),...e}));G$e.displayName="BreadcrumbList";const pee=I.forwardRef(({className:t,...e},n)=>r.jsx("li",{ref:n,className:$t("inline-flex items-center gap-1.5",t),...e}));pee.displayName="BreadcrumbItem";const Fpe=I.forwardRef(({asChild:t,className:e,...n},s)=>{const a=t?Dme:"a";return r.jsx(a,{ref:s,className:$t("transition-colors hover:text-foreground",e),...n})});Fpe.displayName="BreadcrumbLink";const K$e=I.forwardRef(({className:t,...e},n)=>r.jsx("span",{ref:n,role:"link","aria-disabled":"true","aria-current":"page",className:$t("font-normal text-foreground",t),...e}));K$e.displayName="BreadcrumbPage";const zpe=({children:t,className:e,...n})=>r.jsx("li",{role:"presentation","aria-hidden":"true",className:$t("[&>svg]:size-3.5",e),...n,children:t??r.jsx(Vi,{})});zpe.displayName="BreadcrumbSeparator";function uKt(){var ye,ne;const{productId:t}=Zc(),e=rs(),{data:n,isLoading:s}=vGt(t||""),{addToCart:a,cartItems:o}=xse(),[l,i]=I.useState(null),[h,p]=I.useState(1),[x,y]=I.useState(0),[b,j]=I.useState(null),[C,N]=I.useState(!1),[A,E]=I.useState(!1),T=(ye=n==null?void 0:n.variants)==null?void 0:ye.find(ge=>ge.id===l),L=((ne=n==null?void 0:n.variants)==null?void 0:ne.filter(ge=>ge.is_active))||[],z=Number((n==null?void 0:n.base_price)||0),F=T?Number(T.price_adjustment):0,q=z+F,H=Number((n==null?void 0:n.shipping_fee)||0),Z=o.reduce((ge,ae)=>ge+ae.quantity,0),G=async ge=>{if(!ge.target.files||ge.target.files.length===0)return;N(!0);const ae=ge.target.files[0],he=ae.name.split(".").pop(),ue=`artwork/${Date.now()}-${Math.random().toString(36).substring(7)}.${he}`;try{const{error:_e}=await J.storage.from("marketplace").upload(ue,ae);if(_e)throw _e;const{data:{publicUrl:Ae}}=J.storage.from("marketplace").getPublicUrl(ue);j(Ae),ze.success("Artwork uploaded successfully")}catch(_e){ze.error("Failed to upload artwork: "+_e.message)}finally{N(!1)}},te=()=>{if(n){if(L.length>0&&!l){ze.error("Please select an option");return}a(n,T||void 0,h,b||void 0),E(!0),ze.success("Added to cart!"),setTimeout(()=>E(!1),2e3)}},ie=()=>{n!=null&&n.images&&y(ge=>(ge+1)%n.images.length)},le=()=>{n!=null&&n.images&&y(ge=>(ge-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(W$e,{className:"mb-6",children:r.jsxs(G$e,{children:[r.jsx(pee,{children:r.jsx(Fpe,{asChild:!0,children:r.jsx(co,{to:"/marketplace",children:"Marketplace"})})}),n.category&&r.jsxs(r.Fragment,{children:[r.jsx(zpe,{}),r.jsx(pee,{children:r.jsx(Fpe,{asChild:!0,children:r.jsx(co,{to:`/marketplace?category=${n.category.id}`,children:n.category.name})})})]}),r.jsx(zpe,{}),r.jsx(pee,{children:r.jsx(K$e,{children:n.name})})]})}),r.jsxs("div",{className:"grid gap-8 lg:grid-cols-2",children:[r.jsxs("div",{className:"space-y-4",children:[r.jsx("div",{className:"relative aspect-square bg-muted rounded-lg overflow-hidden flex items-center justify-center",children:n.images&&n.images.length>0?r.jsxs(r.Fragment,{children:[r.jsx("img",{src:n.images[x].image_url,alt:n.name,className:"max-w-full max-h-full object-contain"}),n.images.length>1&&r.jsxs(r.Fragment,{children:[r.jsx(ee,{variant:"ghost",size:"icon",className:"absolute left-2 top-1/2 -translate-y-1/2 bg-background/80 hover:bg-background",onClick:le,children:r.jsx(Tc,{className:"h-6 w-6"})}),r.jsx(ee,{variant:"ghost",size:"icon",className:"absolute right-2 top-1/2 -translate-y-1/2 bg-background/80 hover:bg-background",onClick:ie,children:r.jsx(Vi,{className:"h-6 w-6"})})]})]}):r.jsx("div",{className:"flex items-center justify-center h-full",children:r.jsx(zl,{className:"h-24 w-24 text-muted-foreground"})})}),n.images&&n.images.length>1&&r.jsx("div",{className:"flex gap-2 overflow-x-auto pb-2",children:n.images.map((ge,ae)=>r.jsx("button",{onClick:()=>y(ae),className:`w-16 h-16 flex-shrink-0 rounded-md overflow-hidden border-2 ${ae===x?"border-primary":"border-transparent"}`,children:r.jsx("img",{src:ge.image_url,alt:"",className:"w-full h-full object-cover"})},ge.id))}),n.video&&r.jsx(Ye,{children:r.jsxs(tt,{className:"p-4",children:[r.jsx("h4",{className:"font-medium mb-2",children:"Product Video"}),r.jsx("div",{className:"aspect-video",children:r.jsx("iframe",{src:n.video.video_url,className:"w-full h-full rounded-lg",allowFullScreen:!0})})]})})]}),r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{children:[n.category&&r.jsx(Ot,{variant:"secondary",className:"mb-2",children:n.category.name}),r.jsx("h1",{className:"text-3xl font-bold mb-2",children:n.name}),r.jsxs("div",{className:"flex items-baseline gap-2",children:[r.jsxs("span",{className:"text-3xl font-bold",children:["$",q.toFixed(2)]}),H>0&&r.jsxs("span",{className:"text-muted-foreground",children:["+ $",H.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})}),L.length>0&&r.jsxs("div",{className:"space-y-3",children:[r.jsx(He,{children:"Select Option"}),r.jsx("div",{className:"flex flex-wrap gap-2",children:L.map(ge=>r.jsxs(ee,{variant:l===ge.id?"default":"outline",onClick:()=>i(ge.id),children:[ge.name,Number(ge.price_adjustment)!==0&&r.jsxs("span",{className:"ml-1 opacity-70",children:["(",Number(ge.price_adjustment)>0?"+":"","$",Number(ge.price_adjustment).toFixed(2),")"]})]},ge.id))})]}),n.allow_artwork_upload&&r.jsxs("div",{className:"space-y-3",children:[r.jsx(He,{children:"Upload Your Artwork (Optional)"}),b?r.jsxs("div",{className:"relative inline-block",children:[r.jsx("img",{src:b,alt:"Your artwork",className:"h-24 w-auto rounded-lg border"}),r.jsx(ee,{variant:"ghost",size:"sm",className:"absolute -top-2 -right-2",onClick:()=>j(null),children:"×"})]}):r.jsxs("div",{className:"border-2 border-dashed rounded-lg p-6",children:[r.jsx("input",{type:"file",accept:"image/*,.pdf,.ai,.eps",onChange:G,className:"hidden",id:"artwork-upload",disabled:C}),r.jsxs("label",{htmlFor:"artwork-upload",className:"flex flex-col items-center cursor-pointer",children:[r.jsx(uo,{className:"h-8 w-8 text-muted-foreground mb-2"}),r.jsx("span",{className:"text-sm text-muted-foreground",children:C?"Uploading...":"Click to upload artwork"}),r.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:"Supported: JPG, PNG, PDF, AI, EPS"})]})]})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsx(He,{children:"Quantity"}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(ee,{variant:"outline",size:"icon",onClick:()=>p(ge=>Math.max(1,ge-1)),children:"-"}),r.jsx(dt,{type:"number",value:h,onChange:ge=>p(Math.max(1,parseInt(ge.target.value)||1)),className:"w-20 text-center",min:"1"}),r.jsx(ee,{variant:"outline",size:"icon",onClick:()=>p(ge=>ge+1),children:"+"})]})]}),r.jsxs("div",{className:"flex gap-4",children:[r.jsx(ee,{size:"lg",className:"flex-1",onClick:te,disabled:A,children:A?r.jsxs(r.Fragment,{children:[r.jsx(Ai,{className:"h-5 w-5 mr-2"}),"Added!"]}):r.jsxs(r.Fragment,{children:[r.jsx(fh,{className:"h-5 w-5 mr-2"}),"Add to Cart"]})}),r.jsxs(ee,{variant:"outline",size:"lg",onClick:()=>e("/marketplace/cart"),className:"relative",children:[r.jsx(fh,{className:"h-5 w-5"}),Z>0&&r.jsx(Ot,{className:"absolute -top-2 -right-2 h-5 w-5 flex items-center justify-center p-0 text-xs",children:Z})]})]}),n.requires_proof_approval&&r.jsx("p",{className:"text-sm text-muted-foreground bg-muted p-3 rounded-lg",children:"📋 This product requires proof approval before production. You'll receive a proof to review after your order is placed."})]})]})]}):r.jsx(Lr,{title:"Product Not Found",children:r.jsxs("div",{className:"text-center py-12",children:[r.jsx(zl,{className:"h-12 w-12 mx-auto text-muted-foreground mb-4"}),r.jsx("p",{className:"text-muted-foreground mb-4",children:"Product not found"}),r.jsx(ee,{onClick:()=>e("/marketplace"),children:"Back to Marketplace"})]})})}function hKt(){const t=rs(),{cartItems:e,removeFromCart:n,updateQuantity:s,getItemPrice:a,getSubtotal:o,getShippingTotal:l,getTotal:i,clearCart:h}=xse(),[p,x]=I.useState(!1),[y,b]=I.useState(""),j=async()=>{if(e.length===0){ze.error("Your cart is empty");return}x(!0);try{const{data:C,error:N}=await J.functions.invoke("marketplace-checkout",{body:{items:e.map(A=>{var E;return{product_id:A.product.id,variant_id:((E=A.variant)==null?void 0:E.id)||null,quantity:A.quantity,artwork_url:A.artworkUrl||null}}),notes:y.trim()||null}});if(N)throw N;if(C!=null&&C.url)h(),window.open(C.url,"_blank");else throw new Error("No checkout URL received")}catch(C){ze.error("Checkout failed: "+C.message)}finally{x(!1)}};return e.length===0?r.jsx(Lr,{title:"Shopping Cart",children:r.jsxs("div",{className:"text-center py-12",children:[r.jsx(_g,{className:"h-16 w-16 mx-auto text-muted-foreground mb-4"}),r.jsx("h2",{className:"text-xl font-semibold mb-2",children:"Your cart is empty"}),r.jsx("p",{className:"text-muted-foreground mb-6",children:"Add some products to get started!"}),r.jsx(ee,{onClick:()=>t("/marketplace"),children:"Browse Marketplace"})]})}):r.jsx(Lr,{title:"Shopping Cart",children:r.jsxs("div",{className:"grid gap-8 lg:grid-cols-3",children:[r.jsxs("div",{className:"lg:col-span-2 space-y-4",children:[e.map(C=>{var N,A;return r.jsx(Ye,{children:r.jsx(tt,{className:"p-4",children:r.jsxs("div",{className:"flex gap-4",children:[r.jsx("div",{className:"w-24 h-24 flex-shrink-0 bg-muted rounded-lg overflow-hidden",children:C.product.images&&C.product.images.length>0?r.jsx("img",{src:((N=C.product.images.find(E=>E.is_primary))==null?void 0:N.image_url)||C.product.images[0].image_url,alt:C.product.name,className:"w-full h-full object-cover"}):r.jsx("div",{className:"flex items-center justify-center h-full",children:r.jsx(_g,{className:"h-8 w-8 text-muted-foreground"})})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("h3",{className:"font-semibold line-clamp-1",children:C.product.name}),C.variant&&r.jsx("p",{className:"text-sm text-muted-foreground",children:C.variant.name}),r.jsxs("p",{className:"font-medium mt-1",children:["$",a(C).toFixed(2),Number(C.product.shipping_fee)>0&&r.jsxs("span",{className:"text-sm text-muted-foreground ml-2",children:["+ $",Number(C.product.shipping_fee).toFixed(2)," shipping"]})]}),C.artworkUrl&&r.jsx("div",{className:"mt-2",children:r.jsx("span",{className:"text-xs text-muted-foreground",children:"Artwork uploaded ✓"})})]}),r.jsxs("div",{className:"flex flex-col items-end gap-2",children:[r.jsx(ee,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>{var E;return n(C.product.id,(E=C.variant)==null?void 0:E.id)},children:r.jsx(Vn,{className:"h-4 w-4 text-destructive"})}),r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(ee,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>{var E;return s(C.product.id,(E=C.variant)==null?void 0:E.id,C.quantity-1)},disabled:C.quantity<=1,children:r.jsx(_1,{className:"h-3 w-3"})}),r.jsx(dt,{type:"number",value:C.quantity,onChange:E=>{var T;return s(C.product.id,(T=C.variant)==null?void 0:T.id,parseInt(E.target.value)||1)},className:"w-14 h-8 text-center text-sm",min:"1"}),r.jsx(ee,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>{var E;return s(C.product.id,(E=C.variant)==null?void 0:E.id,C.quantity+1)},children:r.jsx(bn,{className:"h-3 w-3"})})]})]})]})})},`${C.product.id}-${((A=C.variant)==null?void 0:A.id)||"base"}`)}),r.jsx(ee,{variant:"ghost",className:"text-destructive",onClick:h,children:"Clear Cart"})]}),r.jsx("div",{children:r.jsxs(Ye,{className:"sticky top-4",children:[r.jsx(Gt,{children:r.jsx(Zt,{children:"Order Summary"})}),r.jsxs(tt,{className:"space-y-4",children:[r.jsxs("div",{className:"flex justify-between text-sm",children:[r.jsxs("span",{children:["Subtotal (",e.reduce((C,N)=>C+N.quantity,0)," items)"]}),r.jsxs("span",{children:["$",o().toFixed(2)]})]}),r.jsxs("div",{className:"flex justify-between text-sm",children:[r.jsx("span",{children:"Shipping"}),r.jsxs("span",{children:["$",l().toFixed(2)]})]}),r.jsx(ou,{}),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(ou,{}),r.jsxs("div",{className:"space-y-2",children:[r.jsx(He,{htmlFor:"orderNotes",children:"Order Notes (Optional)"}),r.jsx(ps,{id:"orderNotes",placeholder:"Add any special instructions, design notes, or comments for your order...",value:y,onChange:C=>b(C.target.value),rows:3,className:"resize-none"})]}),r.jsx(ee,{className:"w-full",size:"lg",onClick:j,disabled:p,children:p?r.jsxs(r.Fragment,{children:[r.jsx(en,{className:"h-5 w-5 mr-2 animate-spin"}),"Processing..."]}):r.jsxs(r.Fragment,{children:["Checkout",r.jsx(dl,{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 fKt(){const t=rs(),{data:e,isLoading:n}=AGt();return n?r.jsx(Lr,{title:"My Orders",children:r.jsx("div",{className:"space-y-4",children:[1,2,3].map(s=>r.jsx(Ir,{className:"h-32 w-full"},s))})}):!e||e.length===0?r.jsx(Lr,{title:"My Orders",children:r.jsxs("div",{className:"text-center py-12",children:[r.jsx(zl,{className:"h-16 w-16 mx-auto text-muted-foreground mb-4"}),r.jsx("h2",{className:"text-xl font-semibold mb-2",children:"No orders yet"}),r.jsx("p",{className:"text-muted-foreground mb-6",children:"Start shopping to see your orders here!"}),r.jsx(ee,{onClick:()=>t("/marketplace"),children:"Browse Marketplace"})]})}):r.jsx(Lr,{title:"My Orders",children:r.jsx("div",{className:"space-y-4",children:e.map(s=>{var a,o,l;return r.jsx(Ye,{className:"cursor-pointer hover:shadow-md transition-shadow",onClick:()=>t(`/marketplace/orders/${s.id}`),children:r.jsxs(tt,{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:yn(new Date(s.created_at),"MMM d, yyyy")})]}),r.jsx(Ot,{className:A0e[s.status],children:DS[s.status]})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsxs("div",{className:"flex -space-x-2",children:[(a=s.items)==null?void 0:a.slice(0,3).map((i,h)=>r.jsxs("div",{className:"w-10 h-10 bg-muted rounded border-2 border-background flex items-center justify-center text-xs font-medium",style:{zIndex:3-h},children:[i.quantity,"×"]},i.id)),s.items&&s.items.length>3&&r.jsxs("div",{className:"w-10 h-10 bg-muted rounded border-2 border-background flex items-center justify-center text-xs font-medium",children:["+",s.items.length-3]})]}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm",children:((o=s.items)==null?void 0:o.length)===1?s.items[0].product_name:`${(l=s.items)==null?void 0:l.length} items`}),r.jsxs("p",{className:"font-semibold",children:["$",Number(s.total).toFixed(2)]})]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[s.tracking_url&&r.jsxs(ee,{variant:"outline",size:"sm",onClick:i=>{i.stopPropagation(),window.open(s.tracking_url,"_blank")},children:[r.jsx(Fs,{className:"h-4 w-4 mr-1"}),"Track"]}),r.jsx(Vi,{className:"h-5 w-5 text-muted-foreground"})]})]})]})},s.id)})})})}const g5e=["order_submitted","awaiting_proof_approval","proof_approved","processing","in_production","shipped","completed"];function pKt({currentStatus:t,statusHistory:e}){const n=g5e.indexOf(t);return r.jsx("div",{className:"space-y-3",children:g5e.map((s,a)=>{const o=e==null?void 0:e.find(p=>p.status===s),l=an;return r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("div",{className:`mt-0.5 flex-shrink-0 w-6 h-6 rounded-full flex items-center justify-center ${l?"bg-green-500 text-white":i?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground"}`,children:l?r.jsx(Xi,{className:"h-4 w-4"}):i?r.jsx(Ya,{className:"h-4 w-4"}):r.jsx("span",{className:"text-xs",children:a+1})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:`font-medium ${h?"text-muted-foreground":""}`,children:DS[s]}),o&&r.jsxs("p",{className:"text-xs text-muted-foreground",children:[yn(new Date(o.created_at),"MMM d, yyyy h:mm a"),o.notes&&` — ${o.notes}`]})]})]},s)})})}function mKt(){var E;const{orderId:t}=Zc(),e=rs(),{data:n,isLoading:s,refetch:a}=EGt(t||""),o=LGt(),l=OGt(),[i,h]=I.useState(!1),[p,x]=I.useState(null),[y,b]=I.useState(""),[j,C]=I.useState(null),N=async T=>{C(T);try{await o.mutateAsync({orderId:t,itemId:T}),ze.success("Proof approved!"),a()}catch{ze.error("Failed to approve proof")}finally{C(null)}},A=async()=>{if(p){C(p);try{await l.mutateAsync({orderId:t,itemId:p,reason:y}),ze.success("Revision requested"),h(!1),b(""),x(null),a()}catch{ze.error("Failed to request revision")}finally{C(null)}}};return s?r.jsx(Lr,{title:"Order Details",children:r.jsxs("div",{className:"grid gap-6 lg:grid-cols-3",children:[r.jsxs("div",{className:"lg:col-span-2 space-y-6",children:[r.jsx(Ir,{className:"h-64 w-full"}),r.jsx(Ir,{className:"h-48 w-full"})]}),r.jsx(Ir,{className:"h-96 w-full"})]})}):n?r.jsxs(Lr,{title:`Order ${n.order_number}`,children:[r.jsxs("div",{className:"grid gap-6 lg:grid-cols-3",children:[r.jsxs("div",{className:"lg:col-span-2 space-y-6",children:[r.jsxs(Ye,{children:[r.jsxs(Gt,{className:"flex flex-row items-center justify-between",children:[r.jsx(Zt,{children:"Order Status"}),r.jsx(Ot,{className:A0e[n.status],children:DS[n.status]})]}),r.jsx(tt,{children:r.jsx(pKt,{currentStatus:n.status,statusHistory:n.status_history})})]}),r.jsxs(Ye,{children:[r.jsx(Gt,{children:r.jsx(Zt,{children:"Items"})}),r.jsx(tt,{className:"space-y-4",children:(E=n.items)==null?void 0:E.map(T=>r.jsxs("div",{className:"border rounded-lg p-4",children:[r.jsxs("div",{className:"flex justify-between items-start mb-3",children:[r.jsxs("div",{children:[r.jsx("h4",{className:"font-semibold",children:T.product_name}),T.variant_name&&r.jsx("p",{className:"text-sm text-muted-foreground",children:T.variant_name}),r.jsxs("p",{className:"text-sm",children:["Qty: ",T.quantity," × $",Number(T.unit_price).toFixed(2)]})]}),r.jsxs("p",{className:"font-semibold",children:["$",(Number(T.unit_price)*T.quantity).toFixed(2)]})]}),T.artwork_url&&r.jsxs("div",{className:"mb-3",children:[r.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:"Your Artwork:"}),r.jsxs("a",{href:T.artwork_url,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-2 text-primary hover:underline",children:[r.jsx(f1,{className:"h-4 w-4"}),"View Artwork",r.jsx(Fs,{className:"h-3 w-3"})]})]}),T.proof_url&&r.jsxs("div",{className:"bg-muted rounded-lg p-3",children:[r.jsx("p",{className:"text-sm font-medium mb-2",children:"Proof Ready for Review"}),r.jsxs("a",{href:T.proof_url,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-2 text-primary hover:underline mb-3",children:[r.jsx(f1,{className:"h-4 w-4"}),"View Proof",r.jsx(Fs,{className:"h-3 w-3"})]}),T.proof_status==="pending"&&r.jsxs("div",{className:"flex gap-2 mt-3",children:[r.jsxs(ee,{size:"sm",onClick:()=>N(T.id),disabled:j===T.id,children:[j===T.id?r.jsx(en,{className:"h-4 w-4 mr-1 animate-spin"}):r.jsx(pd,{className:"h-4 w-4 mr-1"}),"Approve"]}),r.jsxs(ee,{size:"sm",variant:"outline",onClick:()=>{x(T.id),h(!0)},disabled:j===T.id,children:[r.jsx(YT,{className:"h-4 w-4 mr-1"}),"Request Changes"]})]}),T.proof_status==="approved"&&r.jsxs(Ot,{className:"bg-green-100 text-green-800",children:[r.jsx(Xi,{className:"h-3 w-3 mr-1"}),"Proof Approved"]}),T.proof_status==="rejected"&&T.proof_notes&&r.jsxs("div",{className:"mt-2",children:[r.jsx(Ot,{variant:"destructive",className:"mb-2",children:"Revision Requested"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:T.proof_notes})]})]})]},T.id))})]}),n.shipping_name&&r.jsxs(Ye,{children:[r.jsx(Gt,{children:r.jsxs(Zt,{className:"flex items-center gap-2",children:[r.jsx(QT,{className:"h-5 w-5"}),"Shipping"]})}),r.jsxs(tt,{children:[r.jsx("p",{className:"font-medium",children:n.shipping_name}),r.jsxs("p",{className:"text-muted-foreground",children:[n.shipping_address,r.jsx("br",{}),n.shipping_city,", ",n.shipping_state," ",n.shipping_zip]}),n.tracking_number&&r.jsxs("div",{className:"mt-4 p-3 bg-muted rounded-lg",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Tracking Number:"}),r.jsx("p",{className:"font-mono font-medium",children:n.tracking_number}),n.tracking_url&&r.jsxs(ee,{variant:"link",className:"p-0 h-auto mt-1",onClick:()=>window.open(n.tracking_url,"_blank"),children:["Track Package",r.jsx(Fs,{className:"h-3 w-3 ml-1"})]})]})]})]})]}),r.jsx("div",{children:r.jsxs(Ye,{className:"sticky top-4",children:[r.jsx(Gt,{children:r.jsx(Zt,{children:"Order Summary"})}),r.jsxs(tt,{className:"space-y-4",children:[r.jsxs("div",{className:"text-sm text-muted-foreground",children:["Placed on ",yn(new Date(n.created_at),"MMMM d, yyyy")]}),r.jsx(ou,{}),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(ou,{}),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(ou,{}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium mb-1",children:"Order Notes"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:n.notes})]})]})]})]})})]}),r.jsx(Fr,{open:i,onOpenChange:h,children:r.jsxs(Rr,{children:[r.jsxs(qr,{children:[r.jsx($r,{children:"Request Changes"}),r.jsx(Xn,{children:"Please describe what changes you'd like made to the proof."})]}),r.jsx(ps,{placeholder:"Describe the changes needed...",value:y,onChange:T=>b(T.target.value),rows:4}),r.jsxs(ea,{children:[r.jsx(ee,{variant:"outline",onClick:()=>h(!1),children:"Cancel"}),r.jsxs(ee,{onClick:A,disabled:!y.trim()||j!==null,children:[j?r.jsx(en,{className:"h-4 w-4 mr-2 animate-spin"}):null,"Submit Request"]})]})]})})]}):r.jsx(Lr,{title:"Order Not Found",children:r.jsxs("div",{className:"text-center py-12",children:[r.jsx(zl,{className:"h-16 w-16 mx-auto text-muted-foreground mb-4"}),r.jsx("p",{className:"text-muted-foreground mb-4",children:"Order not found"}),r.jsx(ee,{onClick:()=>e("/marketplace/orders"),children:"View All Orders"})]})})}function gKt(){const t=rs(),[e]=$d();return e.get("session_id"),I.useEffect(()=>{localStorage.removeItem("marketplace-cart")},[]),r.jsx(Lr,{title:"Order Confirmed",children:r.jsx("div",{className:"max-w-lg mx-auto text-center py-8",children:r.jsx(Ye,{children:r.jsxs(tt,{className:"pt-8 pb-6",children:[r.jsx("div",{className:"w-16 h-16 bg-green-100 rounded-full flex items-center justify-center mx-auto mb-6",children:r.jsx(Xi,{className:"h-8 w-8 text-green-600"})}),r.jsx("h1",{className:"text-2xl font-bold mb-2",children:"Thank You for Your Order!"}),r.jsx("p",{className:"text-muted-foreground mb-6",children:"Your order has been confirmed and is being processed. You'll receive an email confirmation shortly."}),r.jsxs("div",{className:"bg-muted rounded-lg p-4 mb-6 text-left",children:[r.jsxs("h3",{className:"font-medium mb-2 flex items-center gap-2",children:[r.jsx(zl,{className:"h-4 w-4"}),"What happens next?"]}),r.jsxs("ul",{className:"text-sm text-muted-foreground space-y-2",children:[r.jsx("li",{children:"• We'll review your order and prepare it for production"}),r.jsx("li",{children:"• If your order requires a proof, you'll receive it for approval"}),r.jsx("li",{children:"• Once approved, we'll begin production and ship when ready"}),r.jsx("li",{children:"• You'll receive tracking info when your order ships"})]})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[r.jsxs(ee,{className:"flex-1",onClick:()=>t("/marketplace/orders"),children:["View My Orders",r.jsx(dl,{className:"h-4 w-4 ml-2"})]}),r.jsx(ee,{variant:"outline",className:"flex-1",onClick:()=>t("/marketplace"),children:"Continue Shopping"})]})]})})})})}function xKt(){const{user:t}=Qr(),[e,n]=I.useState("store"),[s,a]=I.useState(null),[o,l]=I.useState(null),[i,h]=I.useState(!1),[p,x]=I.useState(5),[y,b]=I.useState(""),[j,C]=I.useState(!1),[N,A]=I.useState(!1),[E,T]=I.useState(""),[L,z]=I.useState(null),[F,q]=I.useState(!1),{hasSubmittedReview:H,submitReview:Z,markPostedToGoogle:G}=GOe(),{data:te}=H$e(),{data:ie,isLoading:le}=V$e(),{data:ye,isLoading:ne}=UGt(s),{data:ge,isLoading:ae}=qGt(t==null?void 0:t.id),{data:he=0}=HGt(t==null?void 0:t.id),ue=WGt(),_e=new Set((ge==null?void 0:ge.map(Be=>Be.item_id))||[]),Ae=async()=>{if(o)try{await ue.mutateAsync(o.id),ze.success(`Successfully purchased "${o.name}"!`),l(null)}catch(Be){ze.error(Be.message||"Failed to purchase item")}},Ce=async()=>{if(!y.trim()){ze.error("Please write a review");return}C(!0);const Be=await Z(p,y);C(!1),Be.success?(ze.success("Thank you for your review! You earned 25 points!"),T(y),A(!0),b(""),x(5)):ze.error(Be.error||"Failed to submit review")},be=()=>{navigator.clipboard.writeText(E),ze.success("Review copied to clipboard!")},me=()=>{G(),window.open("https://g.page/r/CT8bqTBTm7nJEBM/review","_blank")},Le=()=>{A(!1),h(!1),T("")};return le||ne||ae?r.jsx(Lr,{title:"Reward Store",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Ir,{className:"h-24 w-full"}),r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[1,2,3,4,5,6].map(Be=>r.jsx(Ir,{className:"h-64"},Be))})]})}):r.jsxs(Lr,{title:"Reward Store",children:[r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-5xl font-bold text-foreground",children:"Reward Store"}),r.jsx("p",{className:"text-muted-foreground mt-1",children:"Redeem your points for exclusive rewards"})]}),r.jsx(Ye,{className:"bg-gradient-to-r from-primary/10 to-primary/5 border-primary/20",children:r.jsx(tt,{className:"pt-6",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx("div",{className:"h-12 w-12 rounded-full bg-primary/20 flex items-center justify-center",children:r.jsx(vs,{className:"h-6 w-6 text-primary"})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Your Spendable Points"}),r.jsx("p",{className:"text-3xl font-bold text-primary",children:he.toLocaleString()})]})]}),r.jsxs("div",{className:"flex items-center gap-6 text-sm text-muted-foreground",children:[r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(Zi,{className:"h-4 w-4"}),r.jsx("span",{children:"Earn points by attending events"})]}),r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(Jh,{className:"h-4 w-4 text-orange-500"}),r.jsx("span",{children:"Streak bonuses add extra points!"})]})]})]})})}),r.jsx(kS,{open:F,onOpenChange:q,children:r.jsxs(Ye,{className:"border-primary/20",children:[r.jsx(NS,{asChild:!0,children:r.jsx(Gt,{className:"cursor-pointer hover:bg-muted/50 transition-colors",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"h-10 w-10 rounded-full bg-primary/10 flex items-center justify-center",children:r.jsx(Zi,{className:"h-5 w-5 text-primary"})}),r.jsxs("div",{children:[r.jsx(Zt,{className:"text-base",children:"How to Earn Points"}),r.jsx(Mn,{children:"See all the ways you can earn spendable points"})]})]}),F?r.jsx(c1,{className:"h-5 w-5 text-muted-foreground"}):r.jsx(Dd,{className:"h-5 w-5 text-muted-foreground"})]})})}),r.jsx(SS,{children:r.jsx(tt,{className:"pt-0",children:r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-3",children:[te==null?void 0:te.filter(Be=>Be.is_active).map(Be=>{const Ee=Ue=>{switch(Ue){case"event_attendance":return r.jsx(zs,{className:"h-5 w-5"});case"leave_review":return r.jsx(vs,{className:"h-5 w-5"});case"add_listing":return r.jsx(pa,{className:"h-5 w-5"});case"first_contact":return r.jsx(Bn,{className:"h-5 w-5"});case"first_video":return r.jsx(Pa,{className:"h-5 w-5"});case"first_community_post":return r.jsx(Lo,{className:"h-5 w-5"});default:return r.jsx(Ki,{className:"h-5 w-5"})}};return r.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-lg bg-muted/50 border",children:[r.jsx("div",{className:"h-10 w-10 rounded-full bg-primary/10 flex items-center justify-center text-primary shrink-0",children:Ee(Be.action_key)}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"font-medium text-sm",children:Be.action_name}),Be.description&&r.jsx("p",{className:"text-xs text-muted-foreground truncate",children:Be.description})]}),r.jsxs(Ot,{variant:"secondary",className:"font-bold shrink-0",children:["+",Be.points]})]},Be.id)}),r.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-lg bg-orange-500/10 border border-orange-500/20",children:[r.jsx("div",{className:"h-10 w-10 rounded-full bg-orange-500/20 flex items-center justify-center text-orange-500 shrink-0",children:r.jsx(Jh,{className:"h-5 w-5"})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"font-medium text-sm",children:"Streak Bonuses"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Attend consecutive weeks for bonus points!"})]}),r.jsx(Ot,{variant:"outline",className:"font-bold shrink-0 border-orange-500/50 text-orange-600",children:"+Bonus"})]})]})})})]})}),!H&&r.jsx(Ye,{className:"bg-gradient-to-r from-yellow-500/10 to-orange-500/10 border-yellow-500/20",children:r.jsx(tt,{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(Lo,{className:"h-6 w-6 text-yellow-600"})}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:"Earn 25 Free Points!"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Leave a quick review and earn 25 spendable points"})]})]}),r.jsxs(ee,{onClick:()=>h(!0),className:"bg-yellow-600 hover:bg-yellow-700",children:[r.jsx(vs,{className:"h-4 w-4 mr-2"}),"Leave Review"]})]})})}),r.jsxs(Ii,{value:e,onValueChange:n,children:[r.jsxs(wi,{children:[r.jsxs(ln,{value:"store",className:"flex items-center gap-2",children:[r.jsx(_g,{className:"h-4 w-4"}),"Store"]}),r.jsxs(ln,{value:"my-rewards",className:"flex items-center gap-2",children:[r.jsx(zl,{className:"h-4 w-4"}),"My Rewards",ge&&ge.length>0&&r.jsx(Ot,{variant:"secondary",className:"ml-1",children:ge.length})]})]}),r.jsxs(An,{value:"store",className:"mt-6",children:[ie&&ie.length>0&&r.jsxs("div",{className:"flex flex-wrap gap-2 mb-6",children:[r.jsx(ee,{variant:s===null?"default":"outline",size:"sm",onClick:()=>a(null),children:"All"}),ie.map(Be=>r.jsxs(ee,{variant:s===Be.id?"default":"outline",size:"sm",onClick:()=>a(Be.id),children:[Be.icon&&`${Be.icon} `,Be.name]},Be.id))]}),!ye||ye.length===0?r.jsx(Ye,{children:r.jsx(tt,{className:"py-12",children:r.jsxs("div",{className:"text-center text-muted-foreground",children:[r.jsx(Ki,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),r.jsx("p",{className:"font-medium",children:"No items available"}),r.jsx("p",{className:"text-sm",children:"Check back later for new rewards!"})]})})}):r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:ye.map(Be=>{const Ee=_e.has(Be.id),Ue=Be.max_quantity!==null&&Be.current_quantity===0,Re=he>=Be.points_cost;return r.jsxs(Ye,{className:`overflow-hidden transition-all cursor-pointer hover:shadow-lg ${Ee?"ring-2 ring-green-500/50 bg-green-500/5":""}`,onClick:()=>z(Be),children:[Be.preview_image_url?r.jsxs("div",{className:"aspect-video relative overflow-hidden bg-muted",children:[r.jsx("img",{src:Be.preview_image_url,alt:Be.name,className:"w-full h-full object-cover"}),Ee&&r.jsx("div",{className:"absolute top-2 right-2",children:r.jsxs(Ot,{className:"bg-green-500 text-white",children:[r.jsx(Xi,{className:"h-3 w-3 mr-1"}),"Owned"]})}),Ue&&!Ee&&r.jsx("div",{className:"absolute inset-0 bg-black/50 flex items-center justify-center",children:r.jsx(Ot,{variant:"destructive",children:"Sold Out"})})]}):r.jsxs("div",{className:"aspect-video bg-muted flex items-center justify-center relative",children:[r.jsx(Ki,{className:"h-12 w-12 text-muted-foreground/50"}),Ee&&r.jsx("div",{className:"absolute top-2 right-2",children:r.jsxs(Ot,{className:"bg-green-500 text-white",children:[r.jsx(Xi,{className:"h-3 w-3 mr-1"}),"Owned"]})})]}),r.jsxs(Gt,{className:"pb-2",children:[r.jsxs("div",{className:"flex items-start justify-between",children:[r.jsx(Zt,{className:"text-lg",children:Be.name}),r.jsxs(Ot,{variant:"secondary",className:"font-bold shrink-0",children:[r.jsx(vs,{className:"h-3 w-3 mr-1"}),Be.points_cost]})]}),Be.category&&r.jsxs(Ot,{variant:"outline",className:"w-fit",children:[Be.category.icon&&`${Be.category.icon} `,Be.category.name]})]}),r.jsxs(tt,{children:[r.jsx(Mn,{className:"mb-4 line-clamp-2",children:Be.description||"No description available"}),Be.max_quantity!==null&&!Ee&&r.jsxs("p",{className:"text-xs text-muted-foreground mb-3",children:[Be.current_quantity," of ",Be.max_quantity," remaining"]}),Ee?r.jsx(ee,{className:"w-full",onClick:je=>{je.stopPropagation(),Be.file_url&&ude(Be.file_url,Be.name)},disabled:!Be.file_url,children:Be.item_type==="file"?r.jsxs(r.Fragment,{children:[r.jsx(no,{className:"h-4 w-4 mr-2"}),"Download"]}):r.jsxs(r.Fragment,{children:[r.jsx(Fs,{className:"h-4 w-4 mr-2"}),"Access"]})}):r.jsx(ee,{className:"w-full",onClick:je=>{je.stopPropagation(),l(Be)},disabled:Ue||!Re,children:Ue?"Sold Out":Re?r.jsxs(r.Fragment,{children:[r.jsx(_g,{className:"h-4 w-4 mr-2"}),"Purchase"]}):`Need ${Be.points_cost-he} more pts`})]})]},Be.id)})})]}),r.jsx(An,{value:"my-rewards",className:"mt-6",children:!ge||ge.length===0?r.jsx(Ye,{children:r.jsx(tt,{className:"py-12",children:r.jsxs("div",{className:"text-center text-muted-foreground",children:[r.jsx(zl,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),r.jsx("p",{className:"font-medium",children:"No rewards yet"}),r.jsx("p",{className:"text-sm",children:"Purchase items from the store to see them here!"})]})})}):r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:ge.map(Be=>{var Ee,Ue,Re,je,et;return r.jsxs(Ye,{className:"overflow-hidden",children:[(Ee=Be.item)!=null&&Ee.preview_image_url?r.jsx("div",{className:"aspect-video relative overflow-hidden bg-muted",children:r.jsx("img",{src:Be.item.preview_image_url,alt:((Ue=Be.item)==null?void 0:Ue.name)||"Reward",className:"w-full h-full object-cover"})}):r.jsx("div",{className:"aspect-video bg-muted flex items-center justify-center",children:r.jsx(Ki,{className:"h-12 w-12 text-muted-foreground/50"})}),r.jsxs(Gt,{className:"pb-2",children:[r.jsx(Zt,{className:"text-lg",children:((Re=Be.item)==null?void 0:Re.name)||"Unknown Item"}),r.jsxs(Mn,{className:"text-xs",children:["Purchased for ",Be.points_spent," points • ",new Date(Be.purchased_at).toLocaleDateString()]})]}),r.jsx(tt,{children:r.jsx(ee,{className:"w-full",onClick:()=>{var Te,Ze;(Te=Be.item)!=null&&Te.file_url&&ude(Be.item.file_url,(Ze=Be.item)==null?void 0:Ze.name)},disabled:!((je=Be.item)!=null&&je.file_url),children:((et=Be.item)==null?void 0:et.item_type)==="file"?r.jsxs(r.Fragment,{children:[r.jsx(no,{className:"h-4 w-4 mr-2"}),"Download"]}):r.jsxs(r.Fragment,{children:[r.jsx(Fs,{className:"h-4 w-4 mr-2"}),"Access"]})})})]},Be.id)})})})]})]}),r.jsx(Iu,{open:!!o,onOpenChange:()=>l(null),children:r.jsxs(tu,{children:[r.jsxs(ru,{children:[r.jsx(su,{children:"Confirm Purchase"}),r.jsxs(au,{children:['Are you sure you want to purchase "',o==null?void 0:o.name,'" for ',o==null?void 0:o.points_cost," points?",r.jsx("br",{}),r.jsx("br",{}),"You currently have ",r.jsxs("strong",{children:[he," points"]}),". After this purchase, you'll have"," ",r.jsxs("strong",{children:[he-((o==null?void 0:o.points_cost)||0)," points"]})," remaining."]})]}),r.jsxs(nu,{children:[r.jsx(iu,{children:"Cancel"}),r.jsx(Ld,{onClick:Ae,disabled:ue.isPending,children:ue.isPending?"Purchasing...":"Confirm Purchase"})]})]})}),r.jsx(Fr,{open:i,onOpenChange:Be=>{!Be&&N?Le():h(Be)},children:r.jsx(Rr,{children:N?r.jsxs(r.Fragment,{children:[r.jsxs(qr,{children:[r.jsxs($r,{className:"flex items-center gap-2",children:[r.jsx(Xi,{className:"h-5 w-5 text-green-500"}),"Thank You for Your Review!"]}),r.jsx(Xn,{children:"Would you also share your review on Google? It helps other agents discover LevelUp!"})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"bg-muted p-4 rounded-lg",children:[r.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:"Your review:"}),r.jsxs("p",{className:"text-sm italic",children:['"',E,'"']})]}),r.jsxs(ee,{variant:"outline",className:"w-full",onClick:be,children:[r.jsx(hl,{className:"h-4 w-4 mr-2"}),"Copy Review to Clipboard"]})]}),r.jsxs(ea,{className:"flex-col sm:flex-row gap-2",children:[r.jsx(ee,{variant:"outline",onClick:Le,children:"Maybe Later"}),r.jsxs(ee,{onClick:me,className:"bg-blue-600 hover:bg-blue-700",children:[r.jsx(Fs,{className:"h-4 w-4 mr-2"}),"Leave Google Review"]})]})]}):r.jsxs(r.Fragment,{children:[r.jsxs(qr,{children:[r.jsx($r,{children:"Leave a Review"}),r.jsx(Xn,{children:"Share your experience with LevelUp and earn 25 spendable points!"})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium mb-2 block",children:"Your Rating"}),r.jsx("div",{className:"flex gap-1",children:[1,2,3,4,5].map(Be=>r.jsx("button",{type:"button",onClick:()=>x(Be),className:"focus:outline-none",children:r.jsx(vs,{className:`h-8 w-8 transition-colors ${p>=Be?"fill-yellow-400 text-yellow-400":"text-muted-foreground hover:text-yellow-400"}`})},Be))})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium mb-2 block",children:"Your Review"}),r.jsx(ps,{placeholder:"What do you love about LevelUp? How has it helped your business?",value:y,onChange:Be=>b(Be.target.value),rows:4})]})]}),r.jsxs(ea,{children:[r.jsx(ee,{variant:"outline",onClick:()=>h(!1),children:"Cancel"}),r.jsx(ee,{onClick:Ce,disabled:j,className:"bg-yellow-600 hover:bg-yellow-700",children:j?"Submitting...":"Submit & Earn 25 Points"})]})]})})}),r.jsx(Fr,{open:!!L,onOpenChange:()=>z(null),children:r.jsxs(Rr,{className:"max-w-lg",children:[r.jsxs(qr,{children:[r.jsxs($r,{className:"flex items-center gap-2",children:[L==null?void 0:L.name,r.jsxs(Ot,{variant:"secondary",className:"font-bold",children:[r.jsx(vs,{className:"h-3 w-3 mr-1"}),L==null?void 0:L.points_cost]})]}),(L==null?void 0:L.category)&&r.jsxs(Ot,{variant:"outline",className:"w-fit",children:[L.category.icon&&`${L.category.icon} `,L.category.name]})]}),(L==null?void 0:L.preview_image_url)&&r.jsx("div",{className:"aspect-video relative overflow-hidden bg-muted rounded-lg",children:r.jsx("img",{src:L.preview_image_url,alt:L.name,className:"w-full h-full object-cover"})}),r.jsxs("div",{className:"space-y-4",children:[r.jsx("p",{className:"text-muted-foreground",children:(L==null?void 0:L.description)||"No description available"}),(L==null?void 0:L.max_quantity)!==null&&!_e.has((L==null?void 0:L.id)||"")&&r.jsxs("p",{className:"text-sm text-muted-foreground",children:[L==null?void 0:L.current_quantity," of ",L==null?void 0:L.max_quantity," remaining"]})]}),r.jsx(ea,{children:L&&_e.has(L.id)?r.jsx(ee,{className:"w-full",onClick:()=>{L.file_url&&ude(L.file_url,L.name)},disabled:!L.file_url,children:L.item_type==="file"?r.jsxs(r.Fragment,{children:[r.jsx(no,{className:"h-4 w-4 mr-2"}),"Download"]}):r.jsxs(r.Fragment,{children:[r.jsx(Fs,{className:"h-4 w-4 mr-2"}),"Access"]})}):L&&r.jsx(ee,{className:"w-full",onClick:()=>{z(null),l(L)},disabled:L.max_quantity!==null&&L.current_quantity===0||he{const t=jm();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"})]})})},vKt=new yQe,_Kt=()=>{const t=window.location.hostname;return t==="listings.relevelup.com"||t.startsWith("listings.")},bKt=()=>{const t=window.location.hostname;return t==="cards.relevelup.com"||t.startsWith("cards.")},wKt=()=>r.jsx(jQe,{client:vKt,children:r.jsx(PEe,{children:r.jsxs(mI,{children:[r.jsx(FZe,{}),r.jsx(gYe,{}),r.jsx(DJe,{children:r.jsx(qrt,{children:r.jsx(Vrt,{children:r.jsxs(Wrt,{children:[r.jsx(Hrt,{}),r.jsx(kat,{}),r.jsx(Bat,{}),bKt()?r.jsx(rot,{}):_Kt()?r.jsx(kit,{}):r.jsxs(MJe,{children:[r.jsx(sn,{path:"/",element:r.jsx(fot,{})}),r.jsx(sn,{path:"/privacy-policy",element:r.jsx(pot,{})}),r.jsx(sn,{path:"/terms-of-service",element:r.jsx(mot,{})}),r.jsx(sn,{path:"/data-deletion",element:r.jsx(got,{})}),r.jsx(sn,{path:"/public/listings",element:r.jsx(lLe,{})}),r.jsx(sn,{path:"/public/listing/:slugOrId",element:r.jsx(tft,{})}),r.jsx(sn,{path:"/card/:slug",element:r.jsx(rft,{})}),r.jsx(sn,{path:"/auth",element:r.jsx(Wot,{})}),r.jsx(sn,{path:"/subscription-success",element:r.jsx(Got,{})}),r.jsx(sn,{path:"/subscription",element:r.jsx(Cn,{children:r.jsx(cht,{})})}),r.jsx(sn,{path:"/share/video",element:r.jsx(Xht,{}),children:r.jsx(sn,{path:":shareToken",element:r.jsx(Yht,{})})}),r.jsx(sn,{path:"/og/video/:token",element:r.jsx(Qht,{})}),r.jsx(sn,{path:"/setup-brokerage",element:r.jsx(Cn,{children:r.jsx(dht,{})})}),r.jsx(sn,{path:"/claim-account",element:r.jsx(dke,{})}),r.jsx(sn,{path:"/claim",element:r.jsx(dke,{})}),r.jsx(sn,{path:"/join",element:r.jsx(uht,{})}),r.jsx(sn,{path:"/trial",element:r.jsx(wht,{})}),r.jsx(sn,{path:"/trial/success",element:r.jsx(jht,{})}),r.jsx(sn,{path:"/dashboard",element:r.jsx(Cn,{children:r.jsx(ipt,{})})}),r.jsx(sn,{path:"/profile",element:r.jsx(Cn,{children:r.jsx(tmt,{})})}),r.jsx(sn,{path:"/apps",element:r.jsx(Cn,{children:r.jsx(pmt,{})})}),r.jsx(sn,{path:"/admin",element:r.jsx(Cn,{requireAdmin:!0,children:r.jsx(Jxt,{})})}),r.jsx(sn,{path:"/admin/apps",element:r.jsx(Cn,{requireAdmin:!0,children:r.jsx(ryt,{})})}),r.jsx(sn,{path:"/admin/members",element:r.jsx(Cn,{requireAdmin:!0,children:r.jsx(ayt,{})})}),r.jsx(sn,{path:"/admin/invite-codes",element:r.jsx(Cn,{requireAdmin:!0,children:r.jsx(iyt,{})})}),r.jsx(sn,{path:"/admin/events",element:r.jsx(Cn,{requireAdmin:!0,children:r.jsx(ewt,{})})}),r.jsx(sn,{path:"/events",element:r.jsx(Cn,{children:r.jsx(umt,{})})}),r.jsx(sn,{path:"/events/:eventId",element:r.jsx(Cn,{children:r.jsx(fmt,{})})}),r.jsx(sn,{path:"/templates",element:r.jsx(Cn,{children:r.jsx(mmt,{})})}),r.jsx(sn,{path:"/templates/:templateId",element:r.jsx(Cn,{children:r.jsx(vmt,{})})}),r.jsx(sn,{path:"/admin/templates",element:r.jsx(Cn,{requireAdmin:!0,children:r.jsx(twt,{})})}),r.jsx(sn,{path:"/academy",element:r.jsx(Cn,{children:r.jsx(_mt,{})})}),r.jsx(sn,{path:"/academy/:videoId",element:r.jsx(Cn,{children:r.jsx(wmt,{})})}),r.jsx(sn,{path:"/admin/academy",element:r.jsx(Cn,{requireAdmin:!0,children:r.jsx(nwt,{})})}),r.jsx(sn,{path:"/toolbox",element:r.jsx(Cn,{children:r.jsx(jmt,{})})}),r.jsx(sn,{path:"/toolbox/:kitId",element:r.jsx(Cn,{children:r.jsx(kmt,{})})}),r.jsx(sn,{path:"/admin/toolbox",element:r.jsx(Cn,{requireAdmin:!0,children:r.jsx(swt,{})})}),r.jsx(sn,{path:"/social-swag",element:r.jsx(Cn,{children:r.jsx(Nmt,{})})}),r.jsx(sn,{path:"/social-swag-2",element:r.jsx(Cn,{children:r.jsx(jxt,{})})}),r.jsx(sn,{path:"/social-swag/:swagId",element:r.jsx(Cn,{children:r.jsx(kxt,{})})}),r.jsx(sn,{path:"/social-connections",element:r.jsx(Cn,{children:r.jsx(iKt,{})})}),r.jsx(sn,{path:"/social-connections/callback",element:r.jsx(Cn,{children:r.jsx(oKt,{})})}),r.jsx(sn,{path:"/social-connections/linkedin-callback",element:r.jsx(Cn,{children:r.jsx(cKt,{})})}),r.jsx(sn,{path:"/social-connections/google-callback",element:r.jsx(Cn,{children:r.jsx(lKt,{})})}),r.jsx(sn,{path:"/admin/social-swag",element:r.jsx(Cn,{requireAdmin:!0,children:r.jsx(awt,{})})}),r.jsx(sn,{path:"/admin/social-swag-2",element:r.jsx(Cn,{requireAdmin:!0,children:r.jsx(iwt,{})})}),r.jsx(sn,{path:"/community",element:r.jsx(Cn,{children:r.jsx(qxt,{})})}),r.jsx(sn,{path:"/support",element:r.jsx(Cn,{children:r.jsx(Vxt,{})})}),r.jsx(sn,{path:"/admin/community",element:r.jsx(Cn,{requireAdmin:!0,children:r.jsx(owt,{})})}),r.jsx(sn,{path:"/admin/support-tickets",element:r.jsx(Cn,{requireAdmin:!0,children:r.jsx(mwt,{})})}),r.jsx(sn,{path:"/admin/email-templates",element:r.jsx(Cn,{requireAdmin:!0,children:r.jsx(ywt,{})})}),r.jsx(sn,{path:"/admin/analytics",element:r.jsx(Cn,{requireAdmin:!0,children:r.jsx(hwt,{})})}),r.jsx(sn,{path:"/admin/brokerage-resources",element:r.jsx(Cn,{requireAdmin:!0,children:r.jsx(fwt,{})})}),r.jsx(sn,{path:"/admin/dashboard-management",element:r.jsx(Cn,{requireAdmin:!0,children:r.jsx(pwt,{})})}),r.jsx(sn,{path:"/brokerage/dashboard",element:r.jsx(Cn,{requireBrokerageManager:!0,children:r.jsx(Twt,{})})}),r.jsx(sn,{path:"/my-brokerage",element:r.jsx(Cn,{children:r.jsx(Owt,{})})}),r.jsx(sn,{path:"/brokerage-resources",element:r.jsx(Cn,{requireBrokerageManager:!0,children:r.jsx(Yxt,{})})}),r.jsx(sn,{path:"/brokerage-resources/:resourceId",element:r.jsx(Cn,{requireBrokerageManager:!0,children:r.jsx(Xxt,{})})}),r.jsx(sn,{path:"/newsletters",element:r.jsx(Cn,{children:r.jsx(Dwt,{})})}),r.jsx(sn,{path:"/newsletters/:id",element:r.jsx(Cn,{children:r.jsx(Fwt,{})})}),r.jsx(sn,{path:"/wishlist",element:r.jsx(Cn,{children:r.jsx($wt,{})})}),r.jsx(sn,{path:"/wishlist/:itemId",element:r.jsx(Cn,{children:r.jsx(Uwt,{})})}),r.jsx(sn,{path:"/admin/wishlist",element:r.jsx(Cn,{requireAdmin:!0,children:r.jsx(qwt,{})})}),r.jsx(sn,{path:"/admin/levelup-brief",element:r.jsx(Cn,{requireAdmin:!0,children:r.jsx(Vwt,{})})}),r.jsx(sn,{path:"/admin/newsletters",element:r.jsx(Cn,{requireAdmin:!0,children:r.jsx(Bwt,{})})}),r.jsx(sn,{path:"/admin/additional-services",element:r.jsx(Cn,{requireAdmin:!0,children:r.jsx(Hwt,{})})}),r.jsx(sn,{path:"/admin/discounts",element:r.jsx(Cn,{requireAdmin:!0,children:r.jsx(Wwt,{})})}),r.jsx(sn,{path:"/admin/subscriptions",element:r.jsx(Cn,{requireAdmin:!0,children:r.jsx(Gwt,{})})}),r.jsx(sn,{path:"/admin/referrals",element:r.jsx(Cn,{requireAdmin:!0,children:r.jsx(Kwt,{})})}),r.jsx(sn,{path:"/admin/onboarding-checklist",element:r.jsx(Cn,{requireAdmin:!0,children:r.jsx(Ywt,{})})}),r.jsx(sn,{path:"/admin/marketplace",element:r.jsx(Cn,{requireAdmin:!0,children:r.jsx(BGt,{})})}),r.jsx(sn,{path:"/admin/agent-points",element:r.jsx(Cn,{requireAdmin:!0,children:r.jsx(uGt,{})})}),r.jsx(sn,{path:"/admin/reward-store",element:r.jsx(Cn,{requireAdmin:!0,children:r.jsx(tKt,{})})}),r.jsx(sn,{path:"/admin/integrations",element:r.jsx(Cn,{requireAdmin:!0,children:r.jsx(rKt,{})})}),r.jsx(sn,{path:"/admin/integrations/callback",element:r.jsx(Cn,{requireAdmin:!0,children:r.jsx(aKt,{})})}),r.jsx(sn,{path:"/reward-store",element:r.jsx(Cn,{children:r.jsx(xKt,{})})}),r.jsx(sn,{path:"/additional-services",element:r.jsx(Cn,{children:r.jsx(ojt,{})})}),r.jsx(sn,{path:"/additional-services/:serviceId",element:r.jsx(Cn,{children:r.jsx(ljt,{})})}),r.jsx(sn,{path:"/ai-toolkit",element:r.jsx(Cn,{children:r.jsx(cjt,{})})}),r.jsx(sn,{path:"/mission-control",element:r.jsx(Cn,{children:r.jsx(yjt,{})})}),r.jsx(sn,{path:"/mission-control/contacts",element:r.jsx(Cn,{children:r.jsx(Rjt,{})})}),r.jsx(sn,{path:"/mission-control/contacts/:contactId",element:r.jsx(Cn,{children:r.jsx(Qjt,{})})}),r.jsx(sn,{path:"/mission-control/plans",element:r.jsx(Cn,{children:r.jsx(Jjt,{})})}),r.jsx(sn,{path:"/mission-control/popbys",element:r.jsx(Cn,{children:r.jsx(rkt,{})})}),r.jsx(sn,{path:"/mission-control/popbys/map",element:r.jsx(Cn,{children:r.jsx(skt,{})})}),r.jsx(sn,{path:"/admin/notification-settings",element:r.jsx(Cn,{requireAdmin:!0,children:r.jsx(sKt,{})})}),r.jsx(sn,{path:"/admin/agent-os",element:r.jsx(Cn,{requireAdmin:!0,children:r.jsx(Qwt,{})})}),r.jsx(sn,{path:"/mission-control/listings",element:r.jsx(Cn,{children:r.jsx($Ht,{})})}),r.jsx(sn,{path:"/mission-control/listings/new",element:r.jsx(Cn,{children:r.jsx(h5e,{})})}),r.jsx(sn,{path:"/mission-control/listings/:listingId",element:r.jsx(Cn,{children:r.jsx(rWt,{})})}),r.jsx(sn,{path:"/mission-control/listings/:listingId/edit",element:r.jsx(Cn,{children:r.jsx(h5e,{})})}),r.jsx(sn,{path:"/admin/listing-exchange",element:r.jsx(Cn,{requireAdmin:!0,children:r.jsx(aGt,{})})}),r.jsx(sn,{path:"/mission-control/pipeline",element:r.jsx(Cn,{children:r.jsx(MWt,{})})}),r.jsx(sn,{path:"/mission-control/my-card",element:r.jsx(Cn,{children:r.jsx(KWt,{})})}),r.jsx(sn,{path:"/mission-control/scorecard",element:r.jsx(Cn,{children:r.jsx(PHt,{})})}),r.jsx(sn,{path:"/admin/scorecard",element:r.jsx(Cn,{requireAdmin:!0,children:r.jsx(rGt,{})})}),r.jsx(sn,{path:"/admin/scorecard/:userId",element:r.jsx(Cn,{requireAdmin:!0,children:r.jsx(sGt,{})})}),r.jsx(sn,{path:"/admin/membership-reviews",element:r.jsx(Cn,{requireAdmin:!0,children:r.jsx(iGt,{})})}),r.jsx(sn,{path:"/admin/weekly-digest",element:r.jsx(Cn,{requireAdmin:!0,children:r.jsx(cGt,{})})}),r.jsx(sn,{path:"/mission-control/video/record",element:r.jsx(Cn,{children:r.jsx(dWt,{})})}),r.jsx(sn,{path:"/mission-control/video-library",element:r.jsx(Cn,{children:r.jsx(pWt,{})})}),r.jsx(sn,{path:"/marketplace",element:r.jsx(Cn,{children:r.jsx(dKt,{})})}),r.jsx(sn,{path:"/marketplace/:productId",element:r.jsx(Cn,{children:r.jsx(uKt,{})})}),r.jsx(sn,{path:"/marketplace/cart",element:r.jsx(Cn,{children:r.jsx(hKt,{})})}),r.jsx(sn,{path:"/marketplace/orders",element:r.jsx(Cn,{children:r.jsx(fKt,{})})}),r.jsx(sn,{path:"/marketplace/orders/:orderId",element:r.jsx(Cn,{children:r.jsx(mKt,{})})}),r.jsx(sn,{path:"/marketplace/success",element:r.jsx(Cn,{children:r.jsx(gKt,{})})}),r.jsx(sn,{path:"/admin/agent-cards",element:r.jsx(Cn,{requireAdmin:!0,children:r.jsx(hGt,{})})}),r.jsx(sn,{path:"*",element:r.jsx(yKt,{})})]}),")"]})})})})]})})});BTe(document.getElementById("root")).render(r.jsx(wKt,{}));