var SKe=Object.defineProperty;var swe=e=>{throw TypeError(e)};var CKe=(e,t,n)=>t in e?SKe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Xn=(e,t,n)=>CKe(e,typeof t!="symbol"?t+"":t,n),Rle=(e,t,n)=>t.has(e)||swe("Cannot "+n);var er=(e,t,n)=>(Rle(e,t,"read from private field"),n?n.call(e):t.get(e)),ga=(e,t,n)=>t.has(e)?swe("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n),xs=(e,t,n,s)=>(Rle(e,t,"write to private field"),s?s.call(e,n):t.set(e,n),n),pi=(e,t,n)=>(Rle(e,t,"access private method"),n);var bL=(e,t,n,s)=>({set _(a){xs(e,t,a,n)},get _(){return er(e,t,s)}});function MKe(e,t){for(var n=0;ns[a]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const 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 Yx=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Qi(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function FTe(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var n=function s(){return this instanceof s?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(s){var a=Object.getOwnPropertyDescriptor(e,s);Object.defineProperty(n,s,a.get?a:{enumerable:!0,get:function(){return e[s]}})}),n}var zTe={exports:{}},Jne={},BTe={exports:{}},Bi={};/** * @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 FI=Symbol.for("react.element"),TKe=Symbol.for("react.portal"),AKe=Symbol.for("react.fragment"),EKe=Symbol.for("react.strict_mode"),IKe=Symbol.for("react.profiler"),PKe=Symbol.for("react.provider"),LKe=Symbol.for("react.context"),OKe=Symbol.for("react.forward_ref"),DKe=Symbol.for("react.suspense"),RKe=Symbol.for("react.memo"),FKe=Symbol.for("react.lazy"),awe=Symbol.iterator;function zKe(e){return e===null||typeof e!="object"?null:(e=awe&&e[awe]||e["@@iterator"],typeof e=="function"?e:null)}var $Te={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},UTe=Object.assign,qTe={};function h3(e,t,n){this.props=e,this.context=t,this.refs=qTe,this.updater=n||$Te}h3.prototype.isReactComponent={};h3.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,e,t,"setState")};h3.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function VTe(){}VTe.prototype=h3.prototype;function rge(e,t,n){this.props=e,this.context=t,this.refs=qTe,this.updater=n||$Te}var nge=rge.prototype=new VTe;nge.constructor=rge;UTe(nge,h3.prototype);nge.isPureReactComponent=!0;var iwe=Array.isArray,HTe=Object.prototype.hasOwnProperty,sge={current:null},WTe={key:!0,ref:!0,__self:!0,__source:!0};function GTe(e,t,n){var s,a={},o=null,l=null;if(t!=null)for(s in t.ref!==void 0&&(l=t.ref),t.key!==void 0&&(o=""+t.key),t)HTe.call(t,s)&&!WTe.hasOwnProperty(s)&&(a[s]=t[s]);var i=arguments.length-2;if(i===1)a.children=n;else if(1>>1,be=he[we];if(0>>1;we<_e;){var Je=2*(we+1)-1,Te=he[Je],De=Je+1,Ue=he[De];if(0>a(Te,Ae))Dea(Ue,Te)?(he[we]=Ue,he[De]=Ae,we=De):(he[we]=Te,he[Je]=Ae,we=Je);else if(Dea(Ue,Ae))he[we]=Ue,he[De]=Ae,we=De;else break e}}return ye}function a(he,ye){var Ae=he.sortIndex-ye.sortIndex;return Ae!==0?Ae:he.id-ye.id}if(typeof performance=="object"&&typeof performance.now=="function"){var o=performance;e.unstable_now=function(){return o.now()}}else{var l=Date,i=l.now();e.unstable_now=function(){return l.now()-i}}var u=[],p=[],x=1,y=null,_=3,b=!1,S=!1,k=!1,M=typeof setTimeout=="function"?setTimeout:null,P=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 I(he){for(var ye=n(p);ye!==null;){if(ye.callback===null)s(p);else if(ye.startTime<=he)s(p),ye.sortIndex=ye.expirationTime,t(u,ye);else break;ye=n(p)}}function z(he){if(k=!1,I(he),!S)if(n(u)!==null)S=!0,se(D);else{var ye=n(p);ye!==null&&fe(z,ye.startTime-he)}}function D(he,ye){S=!1,k&&(k=!1,P(W),W=-1),b=!0;var Ae=_;try{for(I(ye),y=n(u);y!==null&&(!(y.expirationTime>ye)||he&&!ne());){var we=y.callback;if(typeof we=="function"){y.callback=null,_=y.priorityLevel;var be=we(y.expirationTime<=ye);ye=e.unstable_now(),typeof be=="function"?y.callback=be:y===n(u)&&s(u),I(ye)}else s(u);y=n(u)}if(y!==null)var _e=!0;else{var Je=n(p);Je!==null&&fe(z,Je.startTime-ye),_e=!1}return _e}finally{y=null,_=Ae,b=!1}}var U=!1,V=null,W=-1,G=5,J=-1;function ne(){return!(e.unstable_now()-Jhe||125we?(he.sortIndex=Ae,t(p,he),n(u)===null&&he===n(p)&&(k?(P(W),W=-1):k=!0,fe(z,Ae-we))):(he.sortIndex=be,t(u,he),S||b||(S=!0,se(D))),he},e.unstable_shouldYield=ne,e.unstable_wrapCallback=function(he){var ye=_;return function(){var Ae=_;_=ye;try{return he.apply(this,arguments)}finally{_=Ae}}}})(QTe);XTe.exports=QTe;var YKe=XTe.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 XKe=E,jf=YKe;function An(e){for(var t="https://reactjs.org/docs/error-decoder.html?invariant="+e,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),yue=Object.prototype.hasOwnProperty,QKe=/^[: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]*$/,lwe={},cwe={};function JKe(e){return yue.call(cwe,e)?!0:yue.call(lwe,e)?!1:QKe.test(e)?cwe[e]=!0:(lwe[e]=!0,!1)}function eZe(e,t,n,s){if(n!==null&&n.type===0)return!1;switch(typeof t){case"function":case"symbol":return!0;case"boolean":return s?!1:n!==null?!n.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function tZe(e,t,n,s){if(t===null||typeof t>"u"||eZe(e,t,n,s))return!0;if(s)return!1;if(n!==null)switch(n.type){case 3:return!t;case 4:return t===!1;case 5:return isNaN(t);case 6:return isNaN(t)||1>t}return!1}function nh(e,t,n,s,a,o,l){this.acceptsBooleans=t===2||t===3||t===4,this.attributeName=s,this.attributeNamespace=a,this.mustUseProperty=n,this.propertyName=e,this.type=t,this.sanitizeURL=o,this.removeEmptyString=l}var iu={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){iu[e]=new nh(e,0,!1,e,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var t=e[0];iu[t]=new nh(t,1,!1,e[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(e){iu[e]=new nh(e,2,!1,e.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){iu[e]=new nh(e,2,!1,e,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){iu[e]=new nh(e,3,!1,e.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(e){iu[e]=new nh(e,3,!0,e,null,!1,!1)});["capture","download"].forEach(function(e){iu[e]=new nh(e,4,!1,e,null,!1,!1)});["cols","rows","size","span"].forEach(function(e){iu[e]=new nh(e,6,!1,e,null,!1,!1)});["rowSpan","start"].forEach(function(e){iu[e]=new nh(e,5,!1,e.toLowerCase(),null,!1,!1)});var oge=/[\-:]([a-z])/g;function lge(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var t=e.replace(oge,lge);iu[t]=new nh(t,1,!1,e,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var t=e.replace(oge,lge);iu[t]=new nh(t,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(e){var t=e.replace(oge,lge);iu[t]=new nh(t,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(e){iu[e]=new nh(e,1,!1,e.toLowerCase(),null,!1,!1)});iu.xlinkHref=new nh("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(e){iu[e]=new nh(e,1,!1,e.toLowerCase(),null,!0,!0)});function cge(e,t,n,s){var a=iu.hasOwnProperty(t)?iu[t]:null;(a!==null?a.type!==0:s||!(2i||a[l]!==o[i]){var u=` `+a[l].replace(" at new "," at ");return e.displayName&&u.includes("")&&(u=u.replace("",e.displayName)),u}while(1<=l&&0<=i);break}}}finally{Ble=!1,Error.prepareStackTrace=n}return(e=e?e.displayName||e.name:"")?ST(e):""}function rZe(e){switch(e.tag){case 5:return ST(e.type);case 16:return ST("Lazy");case 13:return ST("Suspense");case 19:return ST("SuspenseList");case 0:case 2:case 15:return e=$le(e.type,!1),e;case 11:return e=$le(e.type.render,!1),e;case 1:return e=$le(e.type,!0),e;default:return""}}function wue(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case H4:return"Fragment";case V4:return"Portal";case vue:return"Profiler";case dge:return"StrictMode";case _ue:return"Suspense";case bue:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case tAe:return(e.displayName||"Context")+".Consumer";case eAe:return(e._context.displayName||"Context")+".Provider";case uge:var t=e.render;return e=e.displayName,e||(e=t.displayName||t.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case hge:return t=e.displayName||null,t!==null?t:wue(e.type)||"Memo";case q0:t=e._payload,e=e._init;try{return wue(e(t))}catch{}}return null}function nZe(e){var t=e.type;switch(e.tag){case 24:return"Cache";case 9:return(t.displayName||"Context")+".Consumer";case 10:return(t._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=t.render,e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return t;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return wue(t);case 8:return t===dge?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t}return null}function ov(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function nAe(e){var t=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(t==="checkbox"||t==="radio")}function sZe(e){var t=nAe(e)?"checked":"value",n=Object.getOwnPropertyDescriptor(e.constructor.prototype,t),s=""+e[t];if(!e.hasOwnProperty(t)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var a=n.get,o=n.set;return Object.defineProperty(e,t,{configurable:!0,get:function(){return a.call(this)},set:function(l){s=""+l,o.call(this,l)}}),Object.defineProperty(e,t,{enumerable:n.enumerable}),{getValue:function(){return s},setValue:function(l){s=""+l},stopTracking:function(){e._valueTracker=null,delete e[t]}}}}function kL(e){e._valueTracker||(e._valueTracker=sZe(e))}function sAe(e){if(!e)return!1;var t=e._valueTracker;if(!t)return!0;var n=t.getValue(),s="";return e&&(s=nAe(e)?e.checked?"true":"false":e.value),e=s,e!==n?(t.setValue(e),!0):!1}function rte(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function jue(e,t){var n=t.checked;return Hl({},t,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??e._wrapperState.initialChecked})}function uwe(e,t){var n=t.defaultValue==null?"":t.defaultValue,s=t.checked!=null?t.checked:t.defaultChecked;n=ov(t.value!=null?t.value:n),e._wrapperState={initialChecked:s,initialValue:n,controlled:t.type==="checkbox"||t.type==="radio"?t.checked!=null:t.value!=null}}function aAe(e,t){t=t.checked,t!=null&&cge(e,"checked",t,!1)}function kue(e,t){aAe(e,t);var n=ov(t.value),s=t.type;if(n!=null)s==="number"?(n===0&&e.value===""||e.value!=n)&&(e.value=""+n):e.value!==""+n&&(e.value=""+n);else if(s==="submit"||s==="reset"){e.removeAttribute("value");return}t.hasOwnProperty("value")?Nue(e,t.type,n):t.hasOwnProperty("defaultValue")&&Nue(e,t.type,ov(t.defaultValue)),t.checked==null&&t.defaultChecked!=null&&(e.defaultChecked=!!t.defaultChecked)}function hwe(e,t,n){if(t.hasOwnProperty("value")||t.hasOwnProperty("defaultValue")){var s=t.type;if(!(s!=="submit"&&s!=="reset"||t.value!==void 0&&t.value!==null))return;t=""+e._wrapperState.initialValue,n||t===e.value||(e.value=t),e.defaultValue=t}n=e.name,n!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,n!==""&&(e.name=n)}function Nue(e,t,n){(t!=="number"||rte(e.ownerDocument)!==e)&&(n==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+n&&(e.defaultValue=""+n))}var CT=Array.isArray;function dS(e,t,n,s){if(e=e.options,t){t={};for(var a=0;a"+t.valueOf().toString()+"",t=NL.firstChild;e.firstChild;)e.removeChild(e.firstChild);for(;t.firstChild;)e.appendChild(t.firstChild)}});function sE(e,t){if(t){var n=e.firstChild;if(n&&n===e.lastChild&&n.nodeType===3){n.nodeValue=t;return}}e.textContent=t}var $T={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},aZe=["Webkit","ms","Moz","O"];Object.keys($T).forEach(function(e){aZe.forEach(function(t){t=t+e.charAt(0).toUpperCase()+e.substring(1),$T[t]=$T[e]})});function cAe(e,t,n){return t==null||typeof t=="boolean"||t===""?"":n||typeof t!="number"||t===0||$T.hasOwnProperty(e)&&$T[e]?(""+t).trim():t+"px"}function dAe(e,t){e=e.style;for(var n in t)if(t.hasOwnProperty(n)){var s=n.indexOf("--")===0,a=cAe(n,t[n],s);n==="float"&&(n="cssFloat"),s?e.setProperty(n,a):e[n]=a}}var iZe=Hl({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 Mue(e,t){if(t){if(iZe[e]&&(t.children!=null||t.dangerouslySetInnerHTML!=null))throw Error(An(137,e));if(t.dangerouslySetInnerHTML!=null){if(t.children!=null)throw Error(An(60));if(typeof t.dangerouslySetInnerHTML!="object"||!("__html"in t.dangerouslySetInnerHTML))throw Error(An(61))}if(t.style!=null&&typeof t.style!="object")throw Error(An(62))}}function Tue(e,t){if(e.indexOf("-")===-1)return typeof t.is=="string";switch(e){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var Aue=null;function fge(e){return e=e.target||e.srcElement||window,e.correspondingUseElement&&(e=e.correspondingUseElement),e.nodeType===3?e.parentNode:e}var Eue=null,uS=null,hS=null;function mwe(e){if(e=$I(e)){if(typeof Eue!="function")throw Error(An(280));var t=e.stateNode;t&&(t=sse(t),Eue(e.stateNode,e.type,t))}}function uAe(e){uS?hS?hS.push(e):hS=[e]:uS=e}function hAe(){if(uS){var e=uS,t=hS;if(hS=uS=null,mwe(e),t)for(e=0;e>>=0,e===0?32:31-(xZe(e)/yZe|0)|0}var SL=64,CL=4194304;function MT(e){switch(e&-e){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return e&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return e}}function ite(e,t){var n=e.pendingLanes;if(n===0)return 0;var s=0,a=e.suspendedLanes,o=e.pingedLanes,l=n&268435455;if(l!==0){var i=l&~a;i!==0?s=MT(i):(o&=l,o!==0&&(s=MT(o)))}else l=n&~a,l!==0?s=MT(l):o!==0&&(s=MT(o));if(s===0)return 0;if(t!==0&&t!==s&&!(t&a)&&(a=s&-s,o=t&-t,a>=o||a===16&&(o&4194240)!==0))return t;if(s&4&&(s|=n&16),t=e.entangledLanes,t!==0)for(e=e.entanglements,t&=s;0n;n++)t.push(e);return t}function zI(e,t,n){e.pendingLanes|=t,t!==536870912&&(e.suspendedLanes=0,e.pingedLanes=0),e=e.eventTimes,t=31-km(t),e[t]=n}function wZe(e,t){var n=e.pendingLanes&~t;e.pendingLanes=t,e.suspendedLanes=0,e.pingedLanes=0,e.expiredLanes&=t,e.mutableReadLanes&=t,e.entangledLanes&=t,t=e.entanglements;var s=e.eventTimes;for(e=e.expirationTimes;0=qT),kwe=" ",Nwe=!1;function IAe(e,t){switch(e){case"keyup":return YZe.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function PAe(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var W4=!1;function QZe(e,t){switch(e){case"compositionend":return PAe(t);case"keypress":return t.which!==32?null:(Nwe=!0,kwe);case"textInput":return e=t.data,e===kwe&&Nwe?null:e;default:return null}}function JZe(e,t){if(W4)return e==="compositionend"||!bge&&IAe(e,t)?(e=AAe(),WO=yge=b1=null,W4=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=s}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=Twe(n)}}function RAe(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?RAe(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function FAe(){for(var e=window,t=rte();t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=rte(e.document)}return t}function wge(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}function lYe(e){var t=FAe(),n=e.focusedElem,s=e.selectionRange;if(t!==n&&n&&n.ownerDocument&&RAe(n.ownerDocument.documentElement,n)){if(s!==null&&wge(n)){if(t=s.start,e=s.end,e===void 0&&(e=t),"selectionStart"in n)n.selectionStart=t,n.selectionEnd=Math.min(e,n.value.length);else if(e=(t=n.ownerDocument||document)&&t.defaultView||window,e.getSelection){e=e.getSelection();var a=n.textContent.length,o=Math.min(s.start,a);s=s.end===void 0?o:Math.min(s.end,a),!e.extend&&o>s&&(a=s,s=o,o=a),a=Awe(n,o);var l=Awe(n,s);a&&l&&(e.rangeCount!==1||e.anchorNode!==a.node||e.anchorOffset!==a.offset||e.focusNode!==l.node||e.focusOffset!==l.offset)&&(t=t.createRange(),t.setStart(a.node,a.offset),e.removeAllRanges(),o>s?(e.addRange(t),e.extend(l.node,l.offset)):(t.setEnd(l.node,l.offset),e.addRange(t)))}}for(t=[],e=n;e=e.parentNode;)e.nodeType===1&&t.push({element:e,left:e.scrollLeft,top:e.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,G4=null,Rue=null,HT=null,Fue=!1;function Ewe(e,t,n){var s=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Fue||G4==null||G4!==rte(s)||(s=G4,"selectionStart"in s&&wge(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}),HT&&dE(HT,s)||(HT=s,s=cte(Rue,"onSelect"),0Y4||(e.current=Vue[Y4],Vue[Y4]=null,Y4--)}function il(e,t){Y4++,Vue[Y4]=e.current,e.current=t}var lv={},wu=yv(lv),Ch=yv(!1),Yj=lv;function yC(e,t){var n=e.type.contextTypes;if(!n)return lv;var s=e.stateNode;if(s&&s.__reactInternalMemoizedUnmaskedChildContext===t)return s.__reactInternalMemoizedMaskedChildContext;var a={},o;for(o in n)a[o]=t[o];return s&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=t,e.__reactInternalMemoizedMaskedChildContext=a),a}function Mh(e){return e=e.childContextTypes,e!=null}function ute(){vl(Ch),vl(wu)}function Fwe(e,t,n){if(wu.current!==lv)throw Error(An(168));il(wu,t),il(Ch,n)}function GAe(e,t,n){var s=e.stateNode;if(t=t.childContextTypes,typeof s.getChildContext!="function")return n;s=s.getChildContext();for(var a in s)if(!(a in t))throw Error(An(108,nZe(e)||"Unknown",a));return Hl({},n,s)}function hte(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||lv,Yj=wu.current,il(wu,e),il(Ch,Ch.current),!0}function zwe(e,t,n){var s=e.stateNode;if(!s)throw Error(An(169));n?(e=GAe(e,t,Yj),s.__reactInternalMemoizedMergedChildContext=e,vl(Ch),vl(wu),il(wu,e)):vl(Ch),il(Ch,n)}var Vx=null,ase=!1,tce=!1;function KAe(e){Vx===null?Vx=[e]:Vx.push(e)}function _Ye(e){ase=!0,KAe(e)}function vv(){if(!tce&&Vx!==null){tce=!0;var e=0,t=Eo;try{var n=Vx;for(Eo=1;e>=l,a-=l,Xx=1<<32-km(t)+a|n<W?(G=V,V=null):G=V.sibling;var J=_(P,V,I[W],z);if(J===null){V===null&&(V=G);break}e&&V&&J.alternate===null&&t(P,V),T=o(J,T,W),U===null?D=J:U.sibling=J,U=J,V=G}if(W===I.length)return n(P,V),Ml&&A_(P,W),D;if(V===null){for(;WW?(G=V,V=null):G=V.sibling;var ne=_(P,V,J.value,z);if(ne===null){V===null&&(V=G);break}e&&V&&ne.alternate===null&&t(P,V),T=o(ne,T,W),U===null?D=ne:U.sibling=ne,U=ne,V=G}if(J.done)return n(P,V),Ml&&A_(P,W),D;if(V===null){for(;!J.done;W++,J=I.next())J=y(P,J.value,z),J!==null&&(T=o(J,T,W),U===null?D=J:U.sibling=J,U=J);return Ml&&A_(P,W),D}for(V=s(P,V);!J.done;W++,J=I.next())J=b(V,P,W,J.value,z),J!==null&&(e&&J.alternate!==null&&V.delete(J.key===null?W:J.key),T=o(J,T,W),U===null?D=J:U.sibling=J,U=J);return e&&V.forEach(function(oe){return t(P,oe)}),Ml&&A_(P,W),D}function M(P,T,I,z){if(typeof I=="object"&&I!==null&&I.type===H4&&I.key===null&&(I=I.props.children),typeof I=="object"&&I!==null){switch(I.$$typeof){case jL:e:{for(var D=I.key,U=T;U!==null;){if(U.key===D){if(D=I.type,D===H4){if(U.tag===7){n(P,U.sibling),T=a(U,I.props.children),T.return=P,P=T;break e}}else if(U.elementType===D||typeof D=="object"&&D!==null&&D.$$typeof===q0&&Uwe(D)===U.type){n(P,U.sibling),T=a(U,I.props),T.ref=YM(P,U,I),T.return=P,P=T;break e}n(P,U);break}else t(P,U);U=U.sibling}I.type===H4?(T=Nj(I.props.children,P.mode,z,I.key),T.return=P,P=T):(z=e8(I.type,I.key,I.props,null,P.mode,z),z.ref=YM(P,T,I),z.return=P,P=z)}return l(P);case V4:e:{for(U=I.key;T!==null;){if(T.key===U)if(T.tag===4&&T.stateNode.containerInfo===I.containerInfo&&T.stateNode.implementation===I.implementation){n(P,T.sibling),T=a(T,I.children||[]),T.return=P,P=T;break e}else{n(P,T);break}else t(P,T);T=T.sibling}T=cce(I,P.mode,z),T.return=P,P=T}return l(P);case q0:return U=I._init,M(P,T,U(I._payload),z)}if(CT(I))return S(P,T,I,z);if(HM(I))return k(P,T,I,z);LL(P,I)}return typeof I=="string"&&I!==""||typeof I=="number"?(I=""+I,T!==null&&T.tag===6?(n(P,T.sibling),T=a(T,I),T.return=P,P=T):(n(P,T),T=lce(I,P.mode,z),T.return=P,P=T),l(P)):n(P,T)}return M}var _C=QAe(!0),JAe=QAe(!1),mte=yv(null),gte=null,J4=null,Sge=null;function Cge(){Sge=J4=gte=null}function Mge(e){var t=mte.current;vl(mte),e._currentValue=t}function Gue(e,t,n){for(;e!==null;){var s=e.alternate;if((e.childLanes&t)!==t?(e.childLanes|=t,s!==null&&(s.childLanes|=t)):s!==null&&(s.childLanes&t)!==t&&(s.childLanes|=t),e===n)break;e=e.return}}function pS(e,t){gte=e,Sge=J4=null,e=e.dependencies,e!==null&&e.firstContext!==null&&(e.lanes&t&&(jh=!0),e.firstContext=null)}function yp(e){var t=e._currentValue;if(Sge!==e)if(e={context:e,memoizedValue:t,next:null},J4===null){if(gte===null)throw Error(An(308));J4=e,gte.dependencies={lanes:0,firstContext:e}}else J4=J4.next=e;return t}var tj=null;function Tge(e){tj===null?tj=[e]:tj.push(e)}function eEe(e,t,n,s){var a=t.interleaved;return a===null?(n.next=n,Tge(t)):(n.next=a.next,a.next=n),t.interleaved=n,ky(e,s)}function ky(e,t){e.lanes|=t;var n=e.alternate;for(n!==null&&(n.lanes|=t),n=e,e=e.return;e!==null;)e.childLanes|=t,n=e.alternate,n!==null&&(n.childLanes|=t),n=e,e=e.return;return n.tag===3?n.stateNode:null}var V0=!1;function Age(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function tEe(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,effects:e.effects})}function sy(e,t){return{eventTime:e,lane:t,tag:0,payload:null,callback:null,next:null}}function L1(e,t,n){var s=e.updateQueue;if(s===null)return null;if(s=s.shared,ao&2){var a=s.pending;return a===null?t.next=t:(t.next=a.next,a.next=t),s.pending=t,ky(e,n)}return a=s.interleaved,a===null?(t.next=t,Tge(s)):(t.next=a.next,a.next=t),s.interleaved=t,ky(e,n)}function KO(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194240)!==0)){var s=t.lanes;s&=e.pendingLanes,n|=s,t.lanes=n,mge(e,n)}}function qwe(e,t){var n=e.updateQueue,s=e.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=t:o=o.next=t}else a=o=t;n={baseState:s.baseState,firstBaseUpdate:a,lastBaseUpdate:o,shared:s.shared,effects:s.effects},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}function xte(e,t,n,s){var a=e.updateQueue;V0=!1;var o=a.firstBaseUpdate,l=a.lastBaseUpdate,i=a.shared.pending;if(i!==null){a.shared.pending=null;var u=i,p=u.next;u.next=null,l===null?o=p:l.next=p,l=u;var x=e.alternate;x!==null&&(x=x.updateQueue,i=x.lastBaseUpdate,i!==l&&(i===null?x.firstBaseUpdate=p:i.next=p,x.lastBaseUpdate=u))}if(o!==null){var y=a.baseState;l=0,x=p=u=null,i=o;do{var _=i.lane,b=i.eventTime;if((s&_)===_){x!==null&&(x=x.next={eventTime:b,lane:0,tag:i.tag,payload:i.payload,callback:i.callback,next:null});e:{var S=e,k=i;switch(_=t,b=n,k.tag){case 1:if(S=k.payload,typeof S=="function"){y=S.call(b,y,_);break e}y=S;break e;case 3:S.flags=S.flags&-65537|128;case 0:if(S=k.payload,_=typeof S=="function"?S.call(b,y,_):S,_==null)break e;y=Hl({},y,_);break e;case 2:V0=!0}}i.callback!==null&&i.lane!==0&&(e.flags|=64,_=a.effects,_===null?a.effects=[i]:_.push(i))}else b={eventTime:b,lane:_,tag:i.tag,payload:i.payload,callback:i.callback,next:null},x===null?(p=x=b,u=y):x=x.next=b,l|=_;if(i=i.next,i===null){if(i=a.shared.pending,i===null)break;_=i,i=_.next,_.next=null,a.lastBaseUpdate=_,a.shared.pending=null}}while(!0);if(x===null&&(u=y),a.baseState=u,a.firstBaseUpdate=p,a.lastBaseUpdate=x,t=a.shared.interleaved,t!==null){a=t;do l|=a.lane,a=a.next;while(a!==t)}else o===null&&(a.shared.lanes=0);Jj|=l,e.lanes=l,e.memoizedState=y}}function Vwe(e,t,n){if(e=t.effects,t.effects=null,e!==null)for(t=0;tn?n:4,e(!0);var s=nce.transition;nce.transition={};try{e(!1),t()}finally{Eo=n,nce.transition=s}}function yEe(){return vp().memoizedState}function kYe(e,t,n){var s=D1(e);if(n={lane:s,action:n,hasEagerState:!1,eagerState:null,next:null},vEe(e))_Ee(t,n);else if(n=eEe(e,t,n,s),n!==null){var a=Xu();Nm(n,e,s,a),bEe(n,t,s)}}function NYe(e,t,n){var s=D1(e),a={lane:s,action:n,hasEagerState:!1,eagerState:null,next:null};if(vEe(e))_Ee(t,a);else{var o=e.alternate;if(e.lanes===0&&(o===null||o.lanes===0)&&(o=t.lastRenderedReducer,o!==null))try{var l=t.lastRenderedState,i=o(l,n);if(a.hasEagerState=!0,a.eagerState=i,Om(i,l)){var u=t.interleaved;u===null?(a.next=a,Tge(t)):(a.next=u.next,u.next=a),t.interleaved=a;return}}catch{}finally{}n=eEe(e,t,a,s),n!==null&&(a=Xu(),Nm(n,e,s,a),bEe(n,t,s))}}function vEe(e){var t=e.alternate;return e===$l||t!==null&&t===$l}function _Ee(e,t){WT=vte=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function bEe(e,t,n){if(n&4194240){var s=t.lanes;s&=e.pendingLanes,n|=s,t.lanes=n,mge(e,n)}}var _te={readContext:yp,useCallback:hu,useContext:hu,useEffect:hu,useImperativeHandle:hu,useInsertionEffect:hu,useLayoutEffect:hu,useMemo:hu,useReducer:hu,useRef:hu,useState:hu,useDebugValue:hu,useDeferredValue:hu,useTransition:hu,useMutableSource:hu,useSyncExternalStore:hu,useId:hu,unstable_isNewReconciler:!1},SYe={readContext:yp,useCallback:function(e,t){return mg().memoizedState=[e,t===void 0?null:t],e},useContext:yp,useEffect:Wwe,useImperativeHandle:function(e,t,n){return n=n!=null?n.concat([e]):null,YO(4194308,4,fEe.bind(null,t,e),n)},useLayoutEffect:function(e,t){return YO(4194308,4,e,t)},useInsertionEffect:function(e,t){return YO(4,2,e,t)},useMemo:function(e,t){var n=mg();return t=t===void 0?null:t,e=e(),n.memoizedState=[e,t],e},useReducer:function(e,t,n){var s=mg();return t=n!==void 0?n(t):t,s.memoizedState=s.baseState=t,e={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:t},s.queue=e,e=e.dispatch=kYe.bind(null,$l,e),[s.memoizedState,e]},useRef:function(e){var t=mg();return e={current:e},t.memoizedState=e},useState:Hwe,useDebugValue:Fge,useDeferredValue:function(e){return mg().memoizedState=e},useTransition:function(){var e=Hwe(!1),t=e[0];return e=jYe.bind(null,e[1]),mg().memoizedState=e,[t,e]},useMutableSource:function(){},useSyncExternalStore:function(e,t,n){var s=$l,a=mg();if(Ml){if(n===void 0)throw Error(An(407));n=n()}else{if(n=t(),Od===null)throw Error(An(349));Qj&30||aEe(s,t,n)}a.memoizedState=n;var o={value:n,getSnapshot:t};return a.queue=o,Wwe(oEe.bind(null,s,o,e),[e]),s.flags|=2048,yE(9,iEe.bind(null,s,o,n,t),void 0,null),n},useId:function(){var e=mg(),t=Od.identifierPrefix;if(Ml){var n=Qx,s=Xx;n=(s&~(1<<32-km(s)-1)).toString(32)+n,t=":"+t+"R"+n,n=gE++,0<\/script>",e=e.removeChild(e.firstChild)):typeof s.is=="string"?e=l.createElement(n,{is:s.is}):(e=l.createElement(n),n==="select"&&(l=e,s.multiple?l.multiple=!0:s.size&&(l.size=s.size))):e=l.createElementNS(e,n),e[jg]=t,e[fE]=s,EEe(e,t,!1,!1),t.stateNode=e;e:{switch(l=Tue(n,s),n){case"dialog":pl("cancel",e),pl("close",e),a=s;break;case"iframe":case"object":case"embed":pl("load",e),a=s;break;case"video":case"audio":for(a=0;ajC&&(t.flags|=128,s=!0,XM(o,!1),t.lanes=4194304)}else{if(!s)if(e=yte(l),e!==null){if(t.flags|=128,s=!0,n=e.updateQueue,n!==null&&(t.updateQueue=n,t.flags|=4),XM(o,!0),o.tail===null&&o.tailMode==="hidden"&&!l.alternate&&!Ml)return fu(t),null}else 2*vc()-o.renderingStartTime>jC&&n!==1073741824&&(t.flags|=128,s=!0,XM(o,!1),t.lanes=4194304);o.isBackwards?(l.sibling=t.child,t.child=l):(n=o.last,n!==null?n.sibling=l:t.child=l,o.last=l)}return o.tail!==null?(t=o.tail,o.rendering=t,o.tail=t.sibling,o.renderingStartTime=vc(),t.sibling=null,n=Dl.current,il(Dl,s?n&1|2:n&1),t):(fu(t),null);case 22:case 23:return Vge(),s=t.memoizedState!==null,e!==null&&e.memoizedState!==null!==s&&(t.flags|=8192),s&&t.mode&1?Jh&1073741824&&(fu(t),t.subtreeFlags&6&&(t.flags|=8192)):fu(t),null;case 24:return null;case 25:return null}throw Error(An(156,t.tag))}function LYe(e,t){switch(kge(t),t.tag){case 1:return Mh(t.type)&&ute(),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return bC(),vl(Ch),vl(wu),Pge(),e=t.flags,e&65536&&!(e&128)?(t.flags=e&-65537|128,t):null;case 5:return Ige(t),null;case 13:if(vl(Dl),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(An(340));vC()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return vl(Dl),null;case 4:return bC(),null;case 10:return Mge(t.type._context),null;case 22:case 23:return Vge(),null;case 24:return null;default:return null}}var DL=!1,xu=!1,OYe=typeof WeakSet=="function"?WeakSet:Set,ws=null;function eS(e,t){var n=e.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(s){Xl(e,t,s)}else n.current=null}function rhe(e,t,n){try{n()}catch(s){Xl(e,t,s)}}var nje=!1;function DYe(e,t){if(zue=ote,e=FAe(),wge(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var s=n.getSelection&&n.getSelection();if(s&&s.rangeCount!==0){n=s.anchorNode;var a=s.anchorOffset,o=s.focusNode;s=s.focusOffset;try{n.nodeType,o.nodeType}catch{n=null;break e}var l=0,i=-1,u=-1,p=0,x=0,y=e,_=null;t:for(;;){for(var b;y!==n||a!==0&&y.nodeType!==3||(i=l+a),y!==o||s!==0&&y.nodeType!==3||(u=l+s),y.nodeType===3&&(l+=y.nodeValue.length),(b=y.firstChild)!==null;)_=y,y=b;for(;;){if(y===e)break t;if(_===n&&++p===a&&(i=l),_===o&&++x===s&&(u=l),(b=y.nextSibling)!==null)break;y=_,_=y.parentNode}y=b}n=i===-1||u===-1?null:{start:i,end:u}}else n=null}n=n||{start:0,end:0}}else n=null;for(Bue={focusedElem:e,selectionRange:n},ote=!1,ws=t;ws!==null;)if(t=ws,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,ws=e;else for(;ws!==null;){t=ws;try{var S=t.alternate;if(t.flags&1024)switch(t.tag){case 0:case 11:case 15:break;case 1:if(S!==null){var k=S.memoizedProps,M=S.memoizedState,P=t.stateNode,T=P.getSnapshotBeforeUpdate(t.elementType===t.type?k:am(t.type,k),M);P.__reactInternalSnapshotBeforeUpdate=T}break;case 3:var I=t.stateNode.containerInfo;I.nodeType===1?I.textContent="":I.nodeType===9&&I.documentElement&&I.removeChild(I.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(An(163))}}catch(z){Xl(t,t.return,z)}if(e=t.sibling,e!==null){e.return=t.return,ws=e;break}ws=t.return}return S=nje,nje=!1,S}function GT(e,t,n){var s=t.updateQueue;if(s=s!==null?s.lastEffect:null,s!==null){var a=s=s.next;do{if((a.tag&e)===e){var o=a.destroy;a.destroy=void 0,o!==void 0&&rhe(t,n,o)}a=a.next}while(a!==s)}}function lse(e,t){if(t=t.updateQueue,t=t!==null?t.lastEffect:null,t!==null){var n=t=t.next;do{if((n.tag&e)===e){var s=n.create;n.destroy=s()}n=n.next}while(n!==t)}}function nhe(e){var t=e.ref;if(t!==null){var n=e.stateNode;switch(e.tag){case 5:e=n;break;default:e=n}typeof t=="function"?t(e):t.current=e}}function LEe(e){var t=e.alternate;t!==null&&(e.alternate=null,LEe(t)),e.child=null,e.deletions=null,e.sibling=null,e.tag===5&&(t=e.stateNode,t!==null&&(delete t[jg],delete t[fE],delete t[que],delete t[yYe],delete t[vYe])),e.stateNode=null,e.return=null,e.dependencies=null,e.memoizedProps=null,e.memoizedState=null,e.pendingProps=null,e.stateNode=null,e.updateQueue=null}function OEe(e){return e.tag===5||e.tag===3||e.tag===4}function sje(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||OEe(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function she(e,t,n){var s=e.tag;if(s===5||s===6)e=e.stateNode,t?n.nodeType===8?n.parentNode.insertBefore(e,t):n.insertBefore(e,t):(n.nodeType===8?(t=n.parentNode,t.insertBefore(e,n)):(t=n,t.appendChild(e)),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=dte));else if(s!==4&&(e=e.child,e!==null))for(she(e,t,n),e=e.sibling;e!==null;)she(e,t,n),e=e.sibling}function ahe(e,t,n){var s=e.tag;if(s===5||s===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(s!==4&&(e=e.child,e!==null))for(ahe(e,t,n),e=e.sibling;e!==null;)ahe(e,t,n),e=e.sibling}var Qd=null,cm=!1;function I0(e,t,n){for(n=n.child;n!==null;)DEe(e,t,n),n=n.sibling}function DEe(e,t,n){if(Ag&&typeof Ag.onCommitFiberUnmount=="function")try{Ag.onCommitFiberUnmount(ese,n)}catch{}switch(n.tag){case 5:xu||eS(n,t);case 6:var s=Qd,a=cm;Qd=null,I0(e,t,n),Qd=s,cm=a,Qd!==null&&(cm?(e=Qd,n=n.stateNode,e.nodeType===8?e.parentNode.removeChild(n):e.removeChild(n)):Qd.removeChild(n.stateNode));break;case 18:Qd!==null&&(cm?(e=Qd,n=n.stateNode,e.nodeType===8?ece(e.parentNode,n):e.nodeType===1&&ece(e,n),lE(e)):ece(Qd,n.stateNode));break;case 4:s=Qd,a=cm,Qd=n.stateNode.containerInfo,cm=!0,I0(e,t,n),Qd=s,cm=a;break;case 0:case 11:case 14:case 15:if(!xu&&(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)&&rhe(n,t,l),a=a.next}while(a!==s)}I0(e,t,n);break;case 1:if(!xu&&(eS(n,t),s=n.stateNode,typeof s.componentWillUnmount=="function"))try{s.props=n.memoizedProps,s.state=n.memoizedState,s.componentWillUnmount()}catch(i){Xl(n,t,i)}I0(e,t,n);break;case 21:I0(e,t,n);break;case 22:n.mode&1?(xu=(s=xu)||n.memoizedState!==null,I0(e,t,n),xu=s):I0(e,t,n);break;default:I0(e,t,n)}}function aje(e){var t=e.updateQueue;if(t!==null){e.updateQueue=null;var n=e.stateNode;n===null&&(n=e.stateNode=new OYe),t.forEach(function(s){var a=HYe.bind(null,e,s);n.has(s)||(n.add(s),s.then(a,a))})}}function Qp(e,t){var n=t.deletions;if(n!==null)for(var s=0;sa&&(a=l),s&=~o}if(s=a,s=vc()-s,s=(120>s?120:480>s?480:1080>s?1080:1920>s?1920:3e3>s?3e3:4320>s?4320:1960*FYe(s/1960))-s,10e?16:e,w1===null)var s=!1;else{if(e=w1,w1=null,jte=0,ao&6)throw Error(An(331));var a=ao;for(ao|=4,ws=e.current;ws!==null;){var o=ws,l=o.child;if(ws.flags&16){var i=o.deletions;if(i!==null){for(var u=0;uvc()-Uge?kj(e,0):$ge|=n),Th(e,t)}function VEe(e,t){t===0&&(e.mode&1?(t=CL,CL<<=1,!(CL&130023424)&&(CL=4194304)):t=1);var n=Xu();e=ky(e,t),e!==null&&(zI(e,t,n),Th(e,n))}function VYe(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),VEe(e,n)}function HYe(e,t){var n=0;switch(e.tag){case 13:var s=e.stateNode,a=e.memoizedState;a!==null&&(n=a.retryLane);break;case 19:s=e.stateNode;break;default:throw Error(An(314))}s!==null&&s.delete(t),VEe(e,n)}var HEe;HEe=function(e,t,n){if(e!==null)if(e.memoizedProps!==t.pendingProps||Ch.current)jh=!0;else{if(!(e.lanes&n)&&!(t.flags&128))return jh=!1,IYe(e,t,n);jh=!!(e.flags&131072)}else jh=!1,Ml&&t.flags&1048576&&ZAe(t,pte,t.index);switch(t.lanes=0,t.tag){case 2:var s=t.type;XO(e,t),e=t.pendingProps;var a=yC(t,wu.current);pS(t,n),a=Oge(null,t,s,e,a,n);var o=Dge();return t.flags|=1,typeof a=="object"&&a!==null&&typeof a.render=="function"&&a.$$typeof===void 0?(t.tag=1,t.memoizedState=null,t.updateQueue=null,Mh(s)?(o=!0,hte(t)):o=!1,t.memoizedState=a.state!==null&&a.state!==void 0?a.state:null,Age(t),a.updater=ose,t.stateNode=a,a._reactInternals=t,Zue(t,s,e,n),t=Que(null,t,s,!0,o,n)):(t.tag=0,Ml&&o&&jge(t),qu(null,t,a,n),t=t.child),t;case 16:s=t.elementType;e:{switch(XO(e,t),e=t.pendingProps,a=s._init,s=a(s._payload),t.type=s,a=t.tag=GYe(s),e=am(s,e),a){case 0:t=Xue(null,t,s,e,n);break e;case 1:t=eje(null,t,s,e,n);break e;case 11:t=Qwe(null,t,s,e,n);break e;case 14:t=Jwe(null,t,s,am(s.type,e),n);break e}throw Error(An(306,s,""))}return t;case 0:return s=t.type,a=t.pendingProps,a=t.elementType===s?a:am(s,a),Xue(e,t,s,a,n);case 1:return s=t.type,a=t.pendingProps,a=t.elementType===s?a:am(s,a),eje(e,t,s,a,n);case 3:e:{if(MEe(t),e===null)throw Error(An(387));s=t.pendingProps,o=t.memoizedState,a=o.element,tEe(e,t),xte(t,s,null,n);var l=t.memoizedState;if(s=l.element,o.isDehydrated)if(o={element:s,isDehydrated:!1,cache:l.cache,pendingSuspenseBoundaries:l.pendingSuspenseBoundaries,transitions:l.transitions},t.updateQueue.baseState=o,t.memoizedState=o,t.flags&256){a=wC(Error(An(423)),t),t=tje(e,t,s,n,a);break e}else if(s!==a){a=wC(Error(An(424)),t),t=tje(e,t,s,n,a);break e}else for(df=P1(t.stateNode.containerInfo.firstChild),uf=t,Ml=!0,fm=null,n=JAe(t,null,s,n),t.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(vC(),s===a){t=Ny(e,t,n);break e}qu(e,t,s,n)}t=t.child}return t;case 5:return rEe(t),e===null&&Wue(t),s=t.type,a=t.pendingProps,o=e!==null?e.memoizedProps:null,l=a.children,$ue(s,a)?l=null:o!==null&&$ue(s,o)&&(t.flags|=32),CEe(e,t),qu(e,t,l,n),t.child;case 6:return e===null&&Wue(t),null;case 13:return TEe(e,t,n);case 4:return Ege(t,t.stateNode.containerInfo),s=t.pendingProps,e===null?t.child=_C(t,null,s,n):qu(e,t,s,n),t.child;case 11:return s=t.type,a=t.pendingProps,a=t.elementType===s?a:am(s,a),Qwe(e,t,s,a,n);case 7:return qu(e,t,t.pendingProps,n),t.child;case 8:return qu(e,t,t.pendingProps.children,n),t.child;case 12:return qu(e,t,t.pendingProps.children,n),t.child;case 10:e:{if(s=t.type._context,a=t.pendingProps,o=t.memoizedProps,l=a.value,il(mte,s._currentValue),s._currentValue=l,o!==null)if(Om(o.value,l)){if(o.children===a.children&&!Ch.current){t=Ny(e,t,n);break e}}else for(o=t.child,o!==null&&(o.return=t);o!==null;){var i=o.dependencies;if(i!==null){l=o.child;for(var u=i.firstContext;u!==null;){if(u.context===s){if(o.tag===1){u=sy(-1,n&-n),u.tag=2;var p=o.updateQueue;if(p!==null){p=p.shared;var x=p.pending;x===null?u.next=u:(u.next=x.next,x.next=u),p.pending=u}}o.lanes|=n,u=o.alternate,u!==null&&(u.lanes|=n),Gue(o.return,n,t),i.lanes|=n;break}u=u.next}}else if(o.tag===10)l=o.type===t.type?null:o.child;else if(o.tag===18){if(l=o.return,l===null)throw Error(An(341));l.lanes|=n,i=l.alternate,i!==null&&(i.lanes|=n),Gue(l,n,t),l=o.sibling}else l=o.child;if(l!==null)l.return=o;else for(l=o;l!==null;){if(l===t){l=null;break}if(o=l.sibling,o!==null){o.return=l.return,l=o;break}l=l.return}o=l}qu(e,t,a.children,n),t=t.child}return t;case 9:return a=t.type,s=t.pendingProps.children,pS(t,n),a=yp(a),s=s(a),t.flags|=1,qu(e,t,s,n),t.child;case 14:return s=t.type,a=am(s,t.pendingProps),a=am(s.type,a),Jwe(e,t,s,a,n);case 15:return NEe(e,t,t.type,t.pendingProps,n);case 17:return s=t.type,a=t.pendingProps,a=t.elementType===s?a:am(s,a),XO(e,t),t.tag=1,Mh(s)?(e=!0,hte(t)):e=!1,pS(t,n),wEe(t,s,a),Zue(t,s,a,n),Que(null,t,s,!0,e,n);case 19:return AEe(e,t,n);case 22:return SEe(e,t,n)}throw Error(An(156,t.tag))};function WEe(e,t){return vAe(e,t)}function WYe(e,t,n,s){this.tag=e,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=t,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=s,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function ip(e,t,n,s){return new WYe(e,t,n,s)}function Wge(e){return e=e.prototype,!(!e||!e.isReactComponent)}function GYe(e){if(typeof e=="function")return Wge(e)?1:0;if(e!=null){if(e=e.$$typeof,e===uge)return 11;if(e===hge)return 14}return 2}function R1(e,t){var n=e.alternate;return n===null?(n=ip(e.tag,t,e.key,e.mode),n.elementType=e.elementType,n.type=e.type,n.stateNode=e.stateNode,n.alternate=e,e.alternate=n):(n.pendingProps=t,n.type=e.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=e.flags&14680064,n.childLanes=e.childLanes,n.lanes=e.lanes,n.child=e.child,n.memoizedProps=e.memoizedProps,n.memoizedState=e.memoizedState,n.updateQueue=e.updateQueue,t=e.dependencies,n.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext},n.sibling=e.sibling,n.index=e.index,n.ref=e.ref,n}function e8(e,t,n,s,a,o){var l=2;if(s=e,typeof e=="function")Wge(e)&&(l=1);else if(typeof e=="string")l=5;else e:switch(e){case H4:return Nj(n.children,a,o,t);case dge:l=8,a|=8;break;case vue:return e=ip(12,n,t,a|2),e.elementType=vue,e.lanes=o,e;case _ue:return e=ip(13,n,t,a),e.elementType=_ue,e.lanes=o,e;case bue:return e=ip(19,n,t,a),e.elementType=bue,e.lanes=o,e;case rAe:return dse(n,a,o,t);default:if(typeof e=="object"&&e!==null)switch(e.$$typeof){case eAe:l=10;break e;case tAe:l=9;break e;case uge:l=11;break e;case hge:l=14;break e;case q0:l=16,s=null;break e}throw Error(An(130,e==null?e:typeof e,""))}return t=ip(l,n,t,a),t.elementType=e,t.type=s,t.lanes=o,t}function Nj(e,t,n,s){return e=ip(7,e,s,t),e.lanes=n,e}function dse(e,t,n,s){return e=ip(22,e,s,t),e.elementType=rAe,e.lanes=n,e.stateNode={isHidden:!1},e}function lce(e,t,n){return e=ip(6,e,null,t),e.lanes=n,e}function cce(e,t,n){return t=ip(4,e.children!==null?e.children:[],e.key,t),t.lanes=n,t.stateNode={containerInfo:e.containerInfo,pendingChildren:null,implementation:e.implementation},t}function KYe(e,t,n,s,a){this.tag=t,this.containerInfo=e,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=qle(0),this.expirationTimes=qle(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=qle(0),this.identifierPrefix=s,this.onRecoverableError=a,this.mutableSourceEagerHydrationData=null}function Gge(e,t,n,s,a,o,l,i,u){return e=new KYe(e,t,n,i,u),t===1?(t=1,o===!0&&(t|=8)):t=0,o=ip(3,null,null,t),e.current=o,o.stateNode=e,o.memoizedState={element:s,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Age(o),e}function ZYe(e,t,n){var s=3"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(YEe)}catch(e){console.error(e)}}YEe(),YTe.exports=Cf;var kh=YTe.exports;const Xge=Qi(kh);var XEe,fje=kh;XEe=fje.createRoot,fje.hydrateRoot;const eXe=1,tXe=1e6;let dce=0;function rXe(){return dce=(dce+1)%Number.MAX_SAFE_INTEGER,dce.toString()}const uce=new Map,pje=e=>{if(uce.has(e))return;const t=setTimeout(()=>{uce.delete(e),YT({type:"REMOVE_TOAST",toastId:e})},tXe);uce.set(e,t)},nXe=(e,t)=>{switch(t.type){case"ADD_TOAST":return{...e,toasts:[t.toast,...e.toasts].slice(0,eXe)};case"UPDATE_TOAST":return{...e,toasts:e.toasts.map(n=>n.id===t.toast.id?{...n,...t.toast}:n)};case"DISMISS_TOAST":{const{toastId:n}=t;return n?pje(n):e.toasts.forEach(s=>{pje(s.id)}),{...e,toasts:e.toasts.map(s=>s.id===n||n===void 0?{...s,open:!1}:s)}}case"REMOVE_TOAST":return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(n=>n.id!==t.toastId)}}},t8=[];let r8={toasts:[]};function YT(e){r8=nXe(r8,e),t8.forEach(t=>{t(r8)})}function ka({...e}){const t=rXe(),n=a=>YT({type:"UPDATE_TOAST",toast:{...a,id:t}}),s=()=>YT({type:"DISMISS_TOAST",toastId:t});return YT({type:"ADD_TOAST",toast:{...e,id:t,open:!0,onOpenChange:a=>{a||s()}}}),{id:t,dismiss:s,update:n}}function _i(){const[e,t]=E.useState(r8);return E.useEffect(()=>(t8.push(t),()=>{const n=t8.indexOf(t);n>-1&&t8.splice(n,1)}),[e]),{...e,toast:ka,dismiss:n=>YT({type:"DISMISS_TOAST",toastId:n})}}function un(e,t,{checkForDefaultPrevented:n=!0}={}){return function(a){if(e==null||e(a),n===!1||!a.defaultPrevented)return t==null?void 0:t(a)}}function mje(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Sy(...e){return t=>{let n=!1;const s=e.map(a=>{const o=mje(a,t);return!n&&typeof o=="function"&&(n=!0),o});if(n)return()=>{for(let a=0;a{const{children:l,...i}=o,u=E.useMemo(()=>i,Object.values(i));return r.jsx(n.Provider,{value:u,children:l})};s.displayName=e+"Provider";function a(o){const l=E.useContext(n);if(l)return l;if(t!==void 0)return t;throw new Error(`\`${o}\` must be used within \`${e}\``)}return[s,a]}function cc(e,t=[]){let n=[];function s(o,l){const i=E.createContext(l),u=n.length;n=[...n,l];const p=y=>{var P;const{scope:_,children:b,...S}=y,k=((P=_==null?void 0:_[e])==null?void 0:P[u])||i,M=E.useMemo(()=>S,Object.values(S));return r.jsx(k.Provider,{value:M,children:b})};p.displayName=o+"Provider";function x(y,_){var k;const b=((k=_==null?void 0:_[e])==null?void 0:k[u])||i,S=E.useContext(b);if(S)return S;if(l!==void 0)return l;throw new Error(`\`${y}\` must be used within \`${o}\``)}return[p,x]}const a=()=>{const o=n.map(l=>E.createContext(l));return function(i){const u=(i==null?void 0:i[e])||o;return E.useMemo(()=>({[`__scope${e}`]:{...i,[e]:u}}),[i,u])}};return a.scopeName=e,[s,aXe(a,...t)]}function aXe(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const s=e.map(a=>({useScope:a(),scopeName:a.scopeName}));return function(o){const l=s.reduce((i,{useScope:u,scopeName:p})=>{const y=u(o)[`__scope${p}`];return{...i,...y}},{});return E.useMemo(()=>({[`__scope${t.scopeName}`]:l}),[l])}};return n.scopeName=t.scopeName,n}function cv(e){const t=iXe(e),n=E.forwardRef((s,a)=>{const{children:o,...l}=s,i=E.Children.toArray(o),u=i.find(oXe);if(u){const p=u.props.children,x=i.map(y=>y===u?E.Children.count(p)>1?E.Children.only(null):E.isValidElement(p)?p.props.children:null:y);return r.jsx(t,{...l,ref:a,children:E.isValidElement(p)?E.cloneElement(p,void 0,x):null})}return r.jsx(t,{...l,ref:a,children:o})});return n.displayName=`${e}.Slot`,n}var Qge=cv("Slot");function iXe(e){const t=E.forwardRef((n,s)=>{const{children:a,...o}=n;if(E.isValidElement(a)){const l=cXe(a),i=lXe(o,a.props);return a.type!==E.Fragment&&(i.ref=s?Sy(s,l):l),E.cloneElement(a,i)}return E.Children.count(a)>1?E.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var QEe=Symbol("radix.slottable");function JEe(e){const t=({children:n})=>r.jsx(r.Fragment,{children:n});return t.displayName=`${e}.Slottable`,t.__radixId=QEe,t}function oXe(e){return E.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===QEe}function lXe(e,t){const n={...t};for(const s in t){const a=e[s],o=t[s];/^on[A-Z]/.test(s)?a&&o?n[s]=(...i)=>{const u=o(...i);return a(...i),u}:a&&(n[s]=a):s==="style"?n[s]={...a,...o}:s==="className"&&(n[s]=[a,o].filter(Boolean).join(" "))}return{...e,...n}}function cXe(e){var s,a;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(a=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:a.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function qI(e){const t=e+"CollectionProvider",[n,s]=cc(t),[a,o]=n(t,{collectionRef:{current:null},itemMap:new Map}),l=k=>{const{scope:M,children:P}=k,T=lt.useRef(null),I=lt.useRef(new Map).current;return r.jsx(a,{scope:M,itemMap:I,collectionRef:T,children:P})};l.displayName=t;const i=e+"CollectionSlot",u=cv(i),p=lt.forwardRef((k,M)=>{const{scope:P,children:T}=k,I=o(i,P),z=la(M,I.collectionRef);return r.jsx(u,{ref:z,children:T})});p.displayName=i;const x=e+"CollectionItemSlot",y="data-radix-collection-item",_=cv(x),b=lt.forwardRef((k,M)=>{const{scope:P,children:T,...I}=k,z=lt.useRef(null),D=la(M,z),U=o(x,P);return lt.useEffect(()=>(U.itemMap.set(z,{ref:z,...I}),()=>void U.itemMap.delete(z))),r.jsx(_,{[y]:"",ref:D,children:T})});b.displayName=x;function S(k){const M=o(e+"CollectionConsumer",k);return lt.useCallback(()=>{const T=M.collectionRef.current;if(!T)return[];const I=Array.from(T.querySelectorAll(`[${y}]`));return Array.from(M.itemMap.values()).sort((U,V)=>I.indexOf(U.ref.current)-I.indexOf(V.ref.current))},[M.collectionRef,M.itemMap])}return[{Provider:l,Slot:p,ItemSlot:b},S,s]}var dXe=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Fn=dXe.reduce((e,t)=>{const n=cv(`Primitive.${t}`),s=E.forwardRef((a,o)=>{const{asChild:l,...i}=a,u=l?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),r.jsx(u,{...i,ref:o})});return s.displayName=`Primitive.${t}`,{...e,[t]:s}},{});function Jge(e,t){e&&kh.flushSync(()=>e.dispatchEvent(t))}function sc(e){const t=E.useRef(e);return E.useEffect(()=>{t.current=e}),E.useMemo(()=>(...n)=>{var s;return(s=t.current)==null?void 0:s.call(t,...n)},[])}function uXe(e,t=globalThis==null?void 0:globalThis.document){const n=sc(e);E.useEffect(()=>{const s=a=>{a.key==="Escape"&&n(a)};return t.addEventListener("keydown",s,{capture:!0}),()=>t.removeEventListener("keydown",s,{capture:!0})},[n,t])}var hXe="DismissableLayer",dhe="dismissableLayer.update",fXe="dismissableLayer.pointerDownOutside",pXe="dismissableLayer.focusOutside",gje,eIe=E.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),_v=E.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:s,onPointerDownOutside:a,onFocusOutside:o,onInteractOutside:l,onDismiss:i,...u}=e,p=E.useContext(eIe),[x,y]=E.useState(null),_=(x==null?void 0:x.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,b]=E.useState({}),S=la(t,V=>y(V)),k=Array.from(p.layers),[M]=[...p.layersWithOutsidePointerEventsDisabled].slice(-1),P=k.indexOf(M),T=x?k.indexOf(x):-1,I=p.layersWithOutsidePointerEventsDisabled.size>0,z=T>=P,D=gXe(V=>{const W=V.target,G=[...p.branches].some(J=>J.contains(W));!z||G||(a==null||a(V),l==null||l(V),V.defaultPrevented||i==null||i())},_),U=xXe(V=>{const W=V.target;[...p.branches].some(J=>J.contains(W))||(o==null||o(V),l==null||l(V),V.defaultPrevented||i==null||i())},_);return uXe(V=>{T===p.layers.size-1&&(s==null||s(V),!V.defaultPrevented&&i&&(V.preventDefault(),i()))},_),E.useEffect(()=>{if(x)return n&&(p.layersWithOutsidePointerEventsDisabled.size===0&&(gje=_.body.style.pointerEvents,_.body.style.pointerEvents="none"),p.layersWithOutsidePointerEventsDisabled.add(x)),p.layers.add(x),xje(),()=>{n&&p.layersWithOutsidePointerEventsDisabled.size===1&&(_.body.style.pointerEvents=gje)}},[x,_,n,p]),E.useEffect(()=>()=>{x&&(p.layers.delete(x),p.layersWithOutsidePointerEventsDisabled.delete(x),xje())},[x,p]),E.useEffect(()=>{const V=()=>b({});return document.addEventListener(dhe,V),()=>document.removeEventListener(dhe,V)},[]),r.jsx(Fn.div,{...u,ref:S,style:{pointerEvents:I?z?"auto":"none":void 0,...e.style},onFocusCapture:un(e.onFocusCapture,U.onFocusCapture),onBlurCapture:un(e.onBlurCapture,U.onBlurCapture),onPointerDownCapture:un(e.onPointerDownCapture,D.onPointerDownCapture)})});_v.displayName=hXe;var mXe="DismissableLayerBranch",tIe=E.forwardRef((e,t)=>{const n=E.useContext(eIe),s=E.useRef(null),a=la(t,s);return E.useEffect(()=>{const o=s.current;if(o)return n.branches.add(o),()=>{n.branches.delete(o)}},[n.branches]),r.jsx(Fn.div,{...e,ref:a})});tIe.displayName=mXe;function gXe(e,t=globalThis==null?void 0:globalThis.document){const n=sc(e),s=E.useRef(!1),a=E.useRef(()=>{});return E.useEffect(()=>{const o=i=>{if(i.target&&!s.current){let u=function(){rIe(fXe,n,p,{discrete:!0})};const p={originalEvent:i};i.pointerType==="touch"?(t.removeEventListener("click",a.current),a.current=u,t.addEventListener("click",a.current,{once:!0})):u()}else t.removeEventListener("click",a.current);s.current=!1},l=window.setTimeout(()=>{t.addEventListener("pointerdown",o)},0);return()=>{window.clearTimeout(l),t.removeEventListener("pointerdown",o),t.removeEventListener("click",a.current)}},[t,n]),{onPointerDownCapture:()=>s.current=!0}}function xXe(e,t=globalThis==null?void 0:globalThis.document){const n=sc(e),s=E.useRef(!1);return E.useEffect(()=>{const a=o=>{o.target&&!s.current&&rIe(pXe,n,{originalEvent:o},{discrete:!1})};return t.addEventListener("focusin",a),()=>t.removeEventListener("focusin",a)},[t,n]),{onFocusCapture:()=>s.current=!0,onBlurCapture:()=>s.current=!1}}function xje(){const e=new CustomEvent(dhe);document.dispatchEvent(e)}function rIe(e,t,n,{discrete:s}){const a=n.originalEvent.target,o=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&a.addEventListener(e,t,{once:!0}),s?Jge(a,o):a.dispatchEvent(o)}var yXe=_v,vXe=tIe,oc=globalThis!=null&&globalThis.document?E.useLayoutEffect:()=>{},_Xe="Portal",m3=E.forwardRef((e,t)=>{var i;const{container:n,...s}=e,[a,o]=E.useState(!1);oc(()=>o(!0),[]);const l=n||a&&((i=globalThis==null?void 0:globalThis.document)==null?void 0:i.body);return l?Xge.createPortal(r.jsx(Fn.div,{...s,ref:t}),l):null});m3.displayName=_Xe;function bXe(e,t){return E.useReducer((n,s)=>t[n][s]??n,e)}var Tc=e=>{const{present:t,children:n}=e,s=wXe(t),a=typeof n=="function"?n({present:s.isPresent}):E.Children.only(n),o=la(s.ref,jXe(a));return typeof n=="function"||s.isPresent?E.cloneElement(a,{ref:o}):null};Tc.displayName="Presence";function wXe(e){const[t,n]=E.useState(),s=E.useRef(null),a=E.useRef(e),o=E.useRef("none"),l=e?"mounted":"unmounted",[i,u]=bXe(l,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return E.useEffect(()=>{const p=zL(s.current);o.current=i==="mounted"?p:"none"},[i]),oc(()=>{const p=s.current,x=a.current;if(x!==e){const _=o.current,b=zL(p);e?u("MOUNT"):b==="none"||(p==null?void 0:p.display)==="none"?u("UNMOUNT"):u(x&&_!==b?"ANIMATION_OUT":"UNMOUNT"),a.current=e}},[e,u]),oc(()=>{if(t){let p;const x=t.ownerDocument.defaultView??window,y=b=>{const k=zL(s.current).includes(b.animationName);if(b.target===t&&k&&(u("ANIMATION_END"),!a.current)){const M=t.style.animationFillMode;t.style.animationFillMode="forwards",p=x.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=M)})}},_=b=>{b.target===t&&(o.current=zL(s.current))};return t.addEventListener("animationstart",_),t.addEventListener("animationcancel",y),t.addEventListener("animationend",y),()=>{x.clearTimeout(p),t.removeEventListener("animationstart",_),t.removeEventListener("animationcancel",y),t.removeEventListener("animationend",y)}}else u("ANIMATION_END")},[t,u]),{isPresent:["mounted","unmountSuspended"].includes(i),ref:E.useCallback(p=>{s.current=p?getComputedStyle(p):null,n(p)},[])}}function zL(e){return(e==null?void 0:e.animationName)||"none"}function jXe(e){var s,a;let t=(s=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:s.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(a=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:a.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var kXe=ige[" useInsertionEffect ".trim().toString()]||oc;function Ju({prop:e,defaultProp:t,onChange:n=()=>{},caller:s}){const[a,o,l]=NXe({defaultProp:t,onChange:n}),i=e!==void 0,u=i?e:a;{const x=E.useRef(e!==void 0);E.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=E.useCallback(x=>{var y;if(i){const _=SXe(x)?x(e):x;_!==e&&((y=l.current)==null||y.call(l,_))}else o(x)},[i,e,o,l]);return[u,p]}function NXe({defaultProp:e,onChange:t}){const[n,s]=E.useState(e),a=E.useRef(n),o=E.useRef(t);return kXe(()=>{o.current=t},[t]),E.useEffect(()=>{var l;a.current!==n&&((l=o.current)==null||l.call(o,n),a.current=n)},[n,a]),[n,s,o]}function SXe(e){return typeof e=="function"}var nIe=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"}),CXe="VisuallyHidden",mse=E.forwardRef((e,t)=>r.jsx(Fn.span,{...e,ref:t,style:{...nIe,...e.style}}));mse.displayName=CXe;var MXe=mse,exe="ToastProvider",[txe,TXe,AXe]=qI("Toast"),[sIe]=cc("Toast",[AXe]),[EXe,gse]=sIe(exe),aIe=e=>{const{__scopeToast:t,label:n="Notification",duration:s=5e3,swipeDirection:a="right",swipeThreshold:o=50,children:l}=e,[i,u]=E.useState(null),[p,x]=E.useState(0),y=E.useRef(!1),_=E.useRef(!1);return n.trim()||console.error(`Invalid prop \`label\` supplied to \`${exe}\`. Expected non-empty \`string\`.`),r.jsx(txe.Provider,{scope:t,children:r.jsx(EXe,{scope:t,label:n,duration:s,swipeDirection:a,swipeThreshold:o,toastCount:p,viewport:i,onViewportChange:u,onToastAdd:E.useCallback(()=>x(b=>b+1),[]),onToastRemove:E.useCallback(()=>x(b=>b-1),[]),isFocusedToastEscapeKeyDownRef:y,isClosePausedRef:_,children:l})})};aIe.displayName=exe;var iIe="ToastViewport",IXe=["F8"],uhe="toast.viewportPause",hhe="toast.viewportResume",oIe=E.forwardRef((e,t)=>{const{__scopeToast:n,hotkey:s=IXe,label:a="Notifications ({hotkey})",...o}=e,l=gse(iIe,n),i=TXe(n),u=E.useRef(null),p=E.useRef(null),x=E.useRef(null),y=E.useRef(null),_=la(t,y,l.onViewportChange),b=s.join("+").replace(/Key/g,"").replace(/Digit/g,""),S=l.toastCount>0;E.useEffect(()=>{const M=P=>{var I;s.length!==0&&s.every(z=>P[z]||P.code===z)&&((I=y.current)==null||I.focus())};return document.addEventListener("keydown",M),()=>document.removeEventListener("keydown",M)},[s]),E.useEffect(()=>{const M=u.current,P=y.current;if(S&&M&&P){const T=()=>{if(!l.isClosePausedRef.current){const U=new CustomEvent(uhe);P.dispatchEvent(U),l.isClosePausedRef.current=!0}},I=()=>{if(l.isClosePausedRef.current){const U=new CustomEvent(hhe);P.dispatchEvent(U),l.isClosePausedRef.current=!1}},z=U=>{!M.contains(U.relatedTarget)&&I()},D=()=>{M.contains(document.activeElement)||I()};return M.addEventListener("focusin",T),M.addEventListener("focusout",z),M.addEventListener("pointermove",T),M.addEventListener("pointerleave",D),window.addEventListener("blur",T),window.addEventListener("focus",I),()=>{M.removeEventListener("focusin",T),M.removeEventListener("focusout",z),M.removeEventListener("pointermove",T),M.removeEventListener("pointerleave",D),window.removeEventListener("blur",T),window.removeEventListener("focus",I)}}},[S,l.isClosePausedRef]);const k=E.useCallback(({tabbingDirection:M})=>{const T=i().map(I=>{const z=I.ref.current,D=[z,...HXe(z)];return M==="forwards"?D:D.reverse()});return(M==="forwards"?T.reverse():T).flat()},[i]);return E.useEffect(()=>{const M=y.current;if(M){const P=T=>{var D,U,V;const I=T.altKey||T.ctrlKey||T.metaKey;if(T.key==="Tab"&&!I){const W=document.activeElement,G=T.shiftKey;if(T.target===M&&G){(D=p.current)==null||D.focus();return}const oe=k({tabbingDirection:G?"backwards":"forwards"}),ge=oe.findIndex(ie=>ie===W);hce(oe.slice(ge+1))?T.preventDefault():G?(U=p.current)==null||U.focus():(V=x.current)==null||V.focus()}};return M.addEventListener("keydown",P),()=>M.removeEventListener("keydown",P)}},[i,k]),r.jsxs(vXe,{ref:u,role:"region","aria-label":a.replace("{hotkey}",b),tabIndex:-1,style:{pointerEvents:S?void 0:"none"},children:[S&&r.jsx(fhe,{ref:p,onFocusFromOutsideViewport:()=>{const M=k({tabbingDirection:"forwards"});hce(M)}}),r.jsx(txe.Slot,{scope:n,children:r.jsx(Fn.ol,{tabIndex:-1,...o,ref:_})}),S&&r.jsx(fhe,{ref:x,onFocusFromOutsideViewport:()=>{const M=k({tabbingDirection:"backwards"});hce(M)}})]})});oIe.displayName=iIe;var lIe="ToastFocusProxy",fhe=E.forwardRef((e,t)=>{const{__scopeToast:n,onFocusFromOutsideViewport:s,...a}=e,o=gse(lIe,n);return r.jsx(mse,{"aria-hidden":!0,tabIndex:0,...a,ref:t,style:{position:"fixed"},onFocus:l=>{var p;const i=l.relatedTarget;!((p=o.viewport)!=null&&p.contains(i))&&s()}})});fhe.displayName=lIe;var VI="Toast",PXe="toast.swipeStart",LXe="toast.swipeMove",OXe="toast.swipeCancel",DXe="toast.swipeEnd",cIe=E.forwardRef((e,t)=>{const{forceMount:n,open:s,defaultOpen:a,onOpenChange:o,...l}=e,[i,u]=Ju({prop:s,defaultProp:a??!0,onChange:o,caller:VI});return r.jsx(Tc,{present:n||i,children:r.jsx(zXe,{open:i,...l,ref:t,onClose:()=>u(!1),onPause:sc(e.onPause),onResume:sc(e.onResume),onSwipeStart:un(e.onSwipeStart,p=>{p.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:un(e.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:un(e.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:un(e.onSwipeEnd,p=>{const{x,y}=p.detail.delta;p.currentTarget.setAttribute("data-swipe","end"),p.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),p.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),p.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${x}px`),p.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${y}px`),u(!1)})})})});cIe.displayName=VI;var[RXe,FXe]=sIe(VI,{onClose(){}}),zXe=E.forwardRef((e,t)=>{const{__scopeToast:n,type:s="foreground",duration:a,open:o,onClose:l,onEscapeKeyDown:i,onPause:u,onResume:p,onSwipeStart:x,onSwipeMove:y,onSwipeCancel:_,onSwipeEnd:b,...S}=e,k=gse(VI,n),[M,P]=E.useState(null),T=la(t,ie=>P(ie)),I=E.useRef(null),z=E.useRef(null),D=a||k.duration,U=E.useRef(0),V=E.useRef(D),W=E.useRef(0),{onToastAdd:G,onToastRemove:J}=k,ne=sc(()=>{var pe;(M==null?void 0:M.contains(document.activeElement))&&((pe=k.viewport)==null||pe.focus()),l()}),oe=E.useCallback(ie=>{!ie||ie===1/0||(window.clearTimeout(W.current),U.current=new Date().getTime(),W.current=window.setTimeout(ne,ie))},[ne]);E.useEffect(()=>{const ie=k.viewport;if(ie){const pe=()=>{oe(V.current),p==null||p()},se=()=>{const fe=new Date().getTime()-U.current;V.current=V.current-fe,window.clearTimeout(W.current),u==null||u()};return ie.addEventListener(uhe,se),ie.addEventListener(hhe,pe),()=>{ie.removeEventListener(uhe,se),ie.removeEventListener(hhe,pe)}}},[k.viewport,D,u,p,oe]),E.useEffect(()=>{o&&!k.isClosePausedRef.current&&oe(D)},[o,D,k.isClosePausedRef,oe]),E.useEffect(()=>(G(),()=>J()),[G,J]);const ge=E.useMemo(()=>M?gIe(M):null,[M]);return k.viewport?r.jsxs(r.Fragment,{children:[ge&&r.jsx(BXe,{__scopeToast:n,role:"status","aria-live":s==="foreground"?"assertive":"polite","aria-atomic":!0,children:ge}),r.jsx(RXe,{scope:n,onClose:ne,children:kh.createPortal(r.jsx(txe.ItemSlot,{scope:n,children:r.jsx(yXe,{asChild:!0,onEscapeKeyDown:un(i,()=>{k.isFocusedToastEscapeKeyDownRef.current||ne(),k.isFocusedToastEscapeKeyDownRef.current=!1}),children:r.jsx(Fn.li,{role:"status","aria-live":"off","aria-atomic":!0,tabIndex:0,"data-state":o?"open":"closed","data-swipe-direction":k.swipeDirection,...S,ref:T,style:{userSelect:"none",touchAction:"none",...e.style},onKeyDown:un(e.onKeyDown,ie=>{ie.key==="Escape"&&(i==null||i(ie.nativeEvent),ie.nativeEvent.defaultPrevented||(k.isFocusedToastEscapeKeyDownRef.current=!0,ne()))}),onPointerDown:un(e.onPointerDown,ie=>{ie.button===0&&(I.current={x:ie.clientX,y:ie.clientY})}),onPointerMove:un(e.onPointerMove,ie=>{if(!I.current)return;const pe=ie.clientX-I.current.x,se=ie.clientY-I.current.y,fe=!!z.current,he=["left","right"].includes(k.swipeDirection),ye=["left","up"].includes(k.swipeDirection)?Math.min:Math.max,Ae=he?ye(0,pe):0,we=he?0:ye(0,se),be=ie.pointerType==="touch"?10:2,_e={x:Ae,y:we},Je={originalEvent:ie,delta:_e};fe?(z.current=_e,BL(LXe,y,Je,{discrete:!1})):yje(_e,k.swipeDirection,be)?(z.current=_e,BL(PXe,x,Je,{discrete:!1}),ie.target.setPointerCapture(ie.pointerId)):(Math.abs(pe)>be||Math.abs(se)>be)&&(I.current=null)}),onPointerUp:un(e.onPointerUp,ie=>{const pe=z.current,se=ie.target;if(se.hasPointerCapture(ie.pointerId)&&se.releasePointerCapture(ie.pointerId),z.current=null,I.current=null,pe){const fe=ie.currentTarget,he={originalEvent:ie,delta:pe};yje(pe,k.swipeDirection,k.swipeThreshold)?BL(DXe,b,he,{discrete:!0}):BL(OXe,_,he,{discrete:!0}),fe.addEventListener("click",ye=>ye.preventDefault(),{once:!0})}})})})}),k.viewport)})]}):null}),BXe=e=>{const{__scopeToast:t,children:n,...s}=e,a=gse(VI,t),[o,l]=E.useState(!1),[i,u]=E.useState(!1);return qXe(()=>l(!0)),E.useEffect(()=>{const p=window.setTimeout(()=>u(!0),1e3);return()=>window.clearTimeout(p)},[]),i?null:r.jsx(m3,{asChild:!0,children:r.jsx(mse,{...s,children:o&&r.jsxs(r.Fragment,{children:[a.label," ",n]})})})},$Xe="ToastTitle",dIe=E.forwardRef((e,t)=>{const{__scopeToast:n,...s}=e;return r.jsx(Fn.div,{...s,ref:t})});dIe.displayName=$Xe;var UXe="ToastDescription",uIe=E.forwardRef((e,t)=>{const{__scopeToast:n,...s}=e;return r.jsx(Fn.div,{...s,ref:t})});uIe.displayName=UXe;var hIe="ToastAction",fIe=E.forwardRef((e,t)=>{const{altText:n,...s}=e;return n.trim()?r.jsx(mIe,{altText:n,asChild:!0,children:r.jsx(rxe,{...s,ref:t})}):(console.error(`Invalid prop \`altText\` supplied to \`${hIe}\`. Expected non-empty \`string\`.`),null)});fIe.displayName=hIe;var pIe="ToastClose",rxe=E.forwardRef((e,t)=>{const{__scopeToast:n,...s}=e,a=FXe(pIe,n);return r.jsx(mIe,{asChild:!0,children:r.jsx(Fn.button,{type:"button",...s,ref:t,onClick:un(e.onClick,a.onClose)})})});rxe.displayName=pIe;var mIe=E.forwardRef((e,t)=>{const{__scopeToast:n,altText:s,...a}=e;return r.jsx(Fn.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":s||void 0,...a,ref:t})});function gIe(e){const t=[];return Array.from(e.childNodes).forEach(s=>{if(s.nodeType===s.TEXT_NODE&&s.textContent&&t.push(s.textContent),VXe(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&&t.push(l)}else t.push(...gIe(s))}}),t}function BL(e,t,n,{discrete:s}){const a=n.originalEvent.currentTarget,o=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:n});t&&a.addEventListener(e,t,{once:!0}),s?Jge(a,o):a.dispatchEvent(o)}var yje=(e,t,n=0)=>{const s=Math.abs(e.x),a=Math.abs(e.y),o=s>a;return t==="left"||t==="right"?o&&s>n:!o&&a>n};function qXe(e=()=>{}){const t=sc(e);oc(()=>{let n=0,s=0;return n=window.requestAnimationFrame(()=>s=window.requestAnimationFrame(t)),()=>{window.cancelAnimationFrame(n),window.cancelAnimationFrame(s)}},[t])}function VXe(e){return e.nodeType===e.ELEMENT_NODE}function HXe(e){const t=[],n=document.createTreeWalker(e,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();)t.push(n.currentNode);return t}function hce(e){const t=document.activeElement;return e.some(n=>n===t?!0:(n.focus(),document.activeElement!==t))}var WXe=aIe,xIe=oIe,yIe=cIe,vIe=dIe,_Ie=uIe,bIe=fIe,wIe=rxe;function jIe(e){var t,n,s="";if(typeof e=="string"||typeof e=="number")s+=e;else if(typeof e=="object")if(Array.isArray(e)){var a=e.length;for(t=0;ttypeof e=="boolean"?`${e}`:e===0?"0":e,_je=ui,g3=(e,t)=>n=>{var s;if((t==null?void 0:t.variants)==null)return _je(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:a,defaultVariants:o}=t,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 _=vje(x)||vje(y);return a[p][_]}),i=n&&Object.entries(n).reduce((p,x)=>{let[y,_]=x;return _===void 0||(p[y]=_),p},{}),u=t==null||(s=t.compoundVariants)===null||s===void 0?void 0:s.reduce((p,x)=>{let{class:y,className:_,...b}=x;return Object.entries(b).every(S=>{let[k,M]=S;return Array.isArray(M)?M.includes({...o,...i}[k]):{...o,...i}[k]===M})?[...p,y,_]:p},[]);return _je(e,l,u,n==null?void 0:n.class,n==null?void 0:n.className)};/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const GXe=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),kIe=(...e)=>e.filter((t,n,s)=>!!t&&t.trim()!==""&&s.indexOf(t)===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 KXe={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 NIe=E.forwardRef(({color:e="currentColor",size:t=24,strokeWidth:n=2,absoluteStrokeWidth:s,className:a="",children:o,iconNode:l,...i},u)=>E.createElement("svg",{ref:u,...KXe,width:t,height:t,stroke:e,strokeWidth:s?Number(n)*24/Number(t):n,className:kIe("lucide",a),...i},[...l.map(([p,x])=>E.createElement(p,x)),...Array.isArray(o)?o:[o]]));/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const q=(e,t)=>{const n=E.forwardRef(({className:s,...a},o)=>E.createElement(NIe,{ref:o,iconNode:t,className:kIe(`lucide-${GXe(e)}`,s),...a}));return n.displayName=`${e}`,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 n8=q("AArrowDown",[["path",{d:"M3.5 13h6",key:"p1my2r"}],["path",{d:"m2 16 4.5-9 4.5 9",key:"ndf0b3"}],["path",{d:"M18 7v9",key:"pknjwm"}],["path",{d:"m14 12 4 4 4-4",key:"buelq4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const s8=q("AArrowUp",[["path",{d:"M3.5 13h6",key:"p1my2r"}],["path",{d:"m2 16 4.5-9 4.5 9",key:"ndf0b3"}],["path",{d:"M18 16V7",key:"ty0viw"}],["path",{d:"m14 11 4-4 4 4",key:"1pu57t"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const a8=q("ALargeSmall",[["path",{d:"M21 14h-5",key:"1vh23k"}],["path",{d:"M16 16v-3.5a2.5 2.5 0 0 1 5 0V16",key:"1wh10o"}],["path",{d:"M4.5 13h6",key:"dfilno"}],["path",{d:"m3 16 4.5-9 4.5 9",key:"2dxa0e"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const i8=q("Accessibility",[["circle",{cx:"16",cy:"4",r:"1",key:"1grugj"}],["path",{d:"m18 19 1-7-6 1",key:"r0i19z"}],["path",{d:"m5 8 3-3 5.5 3-2.36 3.5",key:"9ptxx2"}],["path",{d:"M4.24 14.5a5 5 0 0 0 6.88 6",key:"10kmtu"}],["path",{d:"M13.76 17.5a5 5 0 0 0-6.88-6",key:"2qq6rc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ig=q("Activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const o8=q("AirVent",[["path",{d:"M6 12H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2",key:"larmp2"}],["path",{d:"M6 8h12",key:"6g4wlu"}],["path",{d:"M18.3 17.7a2.5 2.5 0 0 1-3.16 3.83 2.53 2.53 0 0 1-1.14-2V12",key:"1bo8pg"}],["path",{d:"M6.6 15.6A2 2 0 1 0 10 17v-5",key:"t9h90c"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const l8=q("Airplay",[["path",{d:"M5 17H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2h-1",key:"ns4c3b"}],["path",{d:"m12 15 5 6H7Z",key:"14qnn2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const I_=q("AlarmClockCheck",[["circle",{cx:"12",cy:"13",r:"8",key:"3y4lt7"}],["path",{d:"M5 3 2 6",key:"18tl5t"}],["path",{d:"m22 6-3-3",key:"1opdir"}],["path",{d:"M6.38 18.7 4 21",key:"17xu3x"}],["path",{d:"M17.64 18.67 20 21",key:"kv2oe2"}],["path",{d:"m9 13 2 2 4-4",key:"6343dt"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const P_=q("AlarmClockMinus",[["circle",{cx:"12",cy:"13",r:"8",key:"3y4lt7"}],["path",{d:"M5 3 2 6",key:"18tl5t"}],["path",{d:"m22 6-3-3",key:"1opdir"}],["path",{d:"M6.38 18.7 4 21",key:"17xu3x"}],["path",{d:"M17.64 18.67 20 21",key:"kv2oe2"}],["path",{d:"M9 13h6",key:"1uhe8q"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const c8=q("AlarmClockOff",[["path",{d:"M6.87 6.87a8 8 0 1 0 11.26 11.26",key:"3on8tj"}],["path",{d:"M19.9 14.25a8 8 0 0 0-9.15-9.15",key:"15ghsc"}],["path",{d:"m22 6-3-3",key:"1opdir"}],["path",{d:"M6.26 18.67 4 21",key:"yzmioq"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M4 4 2 6",key:"1ycko6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const L_=q("AlarmClockPlus",[["circle",{cx:"12",cy:"13",r:"8",key:"3y4lt7"}],["path",{d:"M5 3 2 6",key:"18tl5t"}],["path",{d:"m22 6-3-3",key:"1opdir"}],["path",{d:"M6.38 18.7 4 21",key:"17xu3x"}],["path",{d:"M17.64 18.67 20 21",key:"kv2oe2"}],["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const d8=q("AlarmClock",[["circle",{cx:"12",cy:"13",r:"8",key:"3y4lt7"}],["path",{d:"M12 9v4l2 2",key:"1c63tq"}],["path",{d:"M5 3 2 6",key:"18tl5t"}],["path",{d:"m22 6-3-3",key:"1opdir"}],["path",{d:"M6.38 18.7 4 21",key:"17xu3x"}],["path",{d:"M17.64 18.67 20 21",key:"kv2oe2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const u8=q("AlarmSmoke",[["path",{d:"M11 21c0-2.5 2-2.5 2-5",key:"1sicvv"}],["path",{d:"M16 21c0-2.5 2-2.5 2-5",key:"1o3eny"}],["path",{d:"m19 8-.8 3a1.25 1.25 0 0 1-1.2 1H7a1.25 1.25 0 0 1-1.2-1L5 8",key:"1bvca4"}],["path",{d:"M21 3a1 1 0 0 1 1 1v2a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V4a1 1 0 0 1 1-1z",key:"x3qr1j"}],["path",{d:"M6 21c0-2.5 2-2.5 2-5",key:"i3w1gp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const h8=q("Album",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["polyline",{points:"11 3 11 11 14 8 17 11 17 3",key:"1wcwz3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const f8=q("AlignCenterHorizontal",[["path",{d:"M2 12h20",key:"9i4pu4"}],["path",{d:"M10 16v4a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2v-4",key:"11f1s0"}],["path",{d:"M10 8V4a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v4",key:"t14dx9"}],["path",{d:"M20 16v1a2 2 0 0 1-2 2h-2a2 2 0 0 1-2-2v-1",key:"1w07xs"}],["path",{d:"M14 8V7c0-1.1.9-2 2-2h2a2 2 0 0 1 2 2v1",key:"1apec2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const p8=q("AlignCenterVertical",[["path",{d:"M12 2v20",key:"t6zp3m"}],["path",{d:"M8 10H4a2 2 0 0 1-2-2V6c0-1.1.9-2 2-2h4",key:"14d6g8"}],["path",{d:"M16 10h4a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2h-4",key:"1e2lrw"}],["path",{d:"M8 20H7a2 2 0 0 1-2-2v-2c0-1.1.9-2 2-2h1",key:"1fkdwx"}],["path",{d:"M16 14h1a2 2 0 0 1 2 2v2a2 2 0 0 1-2 2h-1",key:"1euafb"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gS=q("AlignCenter",[["path",{d:"M17 12H7",key:"16if0g"}],["path",{d:"M19 18H5",key:"18s9l3"}],["path",{d:"M21 6H3",key:"1jwq7v"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const m8=q("AlignEndHorizontal",[["rect",{width:"6",height:"16",x:"4",y:"2",rx:"2",key:"z5wdxg"}],["rect",{width:"6",height:"9",x:"14",y:"9",rx:"2",key:"um7a8w"}],["path",{d:"M22 22H2",key:"19qnx5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const g8=q("AlignEndVertical",[["rect",{width:"16",height:"6",x:"2",y:"4",rx:"2",key:"10wcwx"}],["rect",{width:"9",height:"6",x:"9",y:"14",rx:"2",key:"4p5bwg"}],["path",{d:"M22 22V2",key:"12ipfv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const x8=q("AlignHorizontalDistributeCenter",[["rect",{width:"6",height:"14",x:"4",y:"5",rx:"2",key:"1wwnby"}],["rect",{width:"6",height:"10",x:"14",y:"7",rx:"2",key:"1fe6j6"}],["path",{d:"M17 22v-5",key:"4b6g73"}],["path",{d:"M17 7V2",key:"hnrr36"}],["path",{d:"M7 22v-3",key:"1r4jpn"}],["path",{d:"M7 5V2",key:"liy1u9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const y8=q("AlignHorizontalDistributeEnd",[["rect",{width:"6",height:"14",x:"4",y:"5",rx:"2",key:"1wwnby"}],["rect",{width:"6",height:"10",x:"14",y:"7",rx:"2",key:"1fe6j6"}],["path",{d:"M10 2v20",key:"uyc634"}],["path",{d:"M20 2v20",key:"1tx262"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const v8=q("AlignHorizontalDistributeStart",[["rect",{width:"6",height:"14",x:"4",y:"5",rx:"2",key:"1wwnby"}],["rect",{width:"6",height:"10",x:"14",y:"7",rx:"2",key:"1fe6j6"}],["path",{d:"M4 2v20",key:"gtpd5x"}],["path",{d:"M14 2v20",key:"tg6bpw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _8=q("AlignHorizontalJustifyCenter",[["rect",{width:"6",height:"14",x:"2",y:"5",rx:"2",key:"dy24zr"}],["rect",{width:"6",height:"10",x:"16",y:"7",rx:"2",key:"13zkjt"}],["path",{d:"M12 2v20",key:"t6zp3m"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const b8=q("AlignHorizontalJustifyEnd",[["rect",{width:"6",height:"14",x:"2",y:"5",rx:"2",key:"dy24zr"}],["rect",{width:"6",height:"10",x:"12",y:"7",rx:"2",key:"1ht384"}],["path",{d:"M22 2v20",key:"40qfg1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const w8=q("AlignHorizontalJustifyStart",[["rect",{width:"6",height:"14",x:"6",y:"5",rx:"2",key:"hsirpf"}],["rect",{width:"6",height:"10",x:"16",y:"7",rx:"2",key:"13zkjt"}],["path",{d:"M2 2v20",key:"1ivd8o"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const j8=q("AlignHorizontalSpaceAround",[["rect",{width:"6",height:"10",x:"9",y:"7",rx:"2",key:"yn7j0q"}],["path",{d:"M4 22V2",key:"tsjzd3"}],["path",{d:"M20 22V2",key:"1bnhr8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const k8=q("AlignHorizontalSpaceBetween",[["rect",{width:"6",height:"14",x:"3",y:"5",rx:"2",key:"j77dae"}],["rect",{width:"6",height:"10",x:"15",y:"7",rx:"2",key:"bq30hj"}],["path",{d:"M3 2v20",key:"1d2pfg"}],["path",{d:"M21 2v20",key:"p059bm"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const N8=q("AlignJustify",[["path",{d:"M3 12h18",key:"1i2n21"}],["path",{d:"M3 18h18",key:"1h113x"}],["path",{d:"M3 6h18",key:"d0wm0j"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xS=q("AlignLeft",[["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M17 18H3",key:"1amg6g"}],["path",{d:"M21 6H3",key:"1jwq7v"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yS=q("AlignRight",[["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M21 18H7",key:"1ygte8"}],["path",{d:"M21 6H3",key:"1jwq7v"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const S8=q("AlignStartHorizontal",[["rect",{width:"6",height:"16",x:"4",y:"6",rx:"2",key:"1n4dg1"}],["rect",{width:"6",height:"9",x:"14",y:"6",rx:"2",key:"17khns"}],["path",{d:"M22 2H2",key:"fhrpnj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const C8=q("AlignStartVertical",[["rect",{width:"9",height:"6",x:"6",y:"14",rx:"2",key:"lpm2y7"}],["rect",{width:"16",height:"6",x:"6",y:"4",rx:"2",key:"rdj6ps"}],["path",{d:"M2 2v20",key:"1ivd8o"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const M8=q("AlignVerticalDistributeCenter",[["path",{d:"M22 17h-3",key:"1lwga1"}],["path",{d:"M22 7h-5",key:"o2endc"}],["path",{d:"M5 17H2",key:"1gx9xc"}],["path",{d:"M7 7H2",key:"6bq26l"}],["rect",{x:"5",y:"14",width:"14",height:"6",rx:"2",key:"1qrzuf"}],["rect",{x:"7",y:"4",width:"10",height:"6",rx:"2",key:"we8e9z"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const T8=q("AlignVerticalDistributeEnd",[["rect",{width:"14",height:"6",x:"5",y:"14",rx:"2",key:"jmoj9s"}],["rect",{width:"10",height:"6",x:"7",y:"4",rx:"2",key:"aza5on"}],["path",{d:"M2 20h20",key:"owomy5"}],["path",{d:"M2 10h20",key:"1ir3d8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const A8=q("AlignVerticalDistributeStart",[["rect",{width:"14",height:"6",x:"5",y:"14",rx:"2",key:"jmoj9s"}],["rect",{width:"10",height:"6",x:"7",y:"4",rx:"2",key:"aza5on"}],["path",{d:"M2 14h20",key:"myj16y"}],["path",{d:"M2 4h20",key:"mda7wb"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const E8=q("AlignVerticalJustifyCenter",[["rect",{width:"14",height:"6",x:"5",y:"16",rx:"2",key:"1i8z2d"}],["rect",{width:"10",height:"6",x:"7",y:"2",rx:"2",key:"ypihtt"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const I8=q("AlignVerticalJustifyEnd",[["rect",{width:"14",height:"6",x:"5",y:"12",rx:"2",key:"4l4tp2"}],["rect",{width:"10",height:"6",x:"7",y:"2",rx:"2",key:"ypihtt"}],["path",{d:"M2 22h20",key:"272qi7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const P8=q("AlignVerticalJustifyStart",[["rect",{width:"14",height:"6",x:"5",y:"16",rx:"2",key:"1i8z2d"}],["rect",{width:"10",height:"6",x:"7",y:"6",rx:"2",key:"13squh"}],["path",{d:"M2 2h20",key:"1ennik"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const L8=q("AlignVerticalSpaceAround",[["rect",{width:"10",height:"6",x:"7",y:"9",rx:"2",key:"b1zbii"}],["path",{d:"M22 20H2",key:"1p1f7z"}],["path",{d:"M22 4H2",key:"1b7qnq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const O8=q("AlignVerticalSpaceBetween",[["rect",{width:"14",height:"6",x:"5",y:"15",rx:"2",key:"1w91an"}],["rect",{width:"10",height:"6",x:"7",y:"3",rx:"2",key:"17wqzy"}],["path",{d:"M2 21h20",key:"1nyx9w"}],["path",{d:"M2 3h20",key:"91anmk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const D8=q("Ambulance",[["path",{d:"M10 10H6",key:"1bsnug"}],["path",{d:"M14 18V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v11a1 1 0 0 0 1 1h2",key:"wrbu53"}],["path",{d:"M19 18h2a1 1 0 0 0 1-1v-3.28a1 1 0 0 0-.684-.948l-1.923-.641a1 1 0 0 1-.578-.502l-1.539-3.076A1 1 0 0 0 16.382 8H14",key:"lrkjwd"}],["path",{d:"M8 8v4",key:"1fwk8c"}],["path",{d:"M9 18h6",key:"x1upvd"}],["circle",{cx:"17",cy:"18",r:"2",key:"332jqn"}],["circle",{cx:"7",cy:"18",r:"2",key:"19iecd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const R8=q("Ampersand",[["path",{d:"M17.5 12c0 4.4-3.6 8-8 8A4.5 4.5 0 0 1 5 15.5c0-6 8-4 8-8.5a3 3 0 1 0-6 0c0 3 2.5 8.5 12 13",key:"1o9ehi"}],["path",{d:"M16 12h3",key:"4uvgyw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const F8=q("Ampersands",[["path",{d:"M10 17c-5-3-7-7-7-9a2 2 0 0 1 4 0c0 2.5-5 2.5-5 6 0 1.7 1.3 3 3 3 2.8 0 5-2.2 5-5",key:"12lh1k"}],["path",{d:"M22 17c-5-3-7-7-7-9a2 2 0 0 1 4 0c0 2.5-5 2.5-5 6 0 1.7 1.3 3 3 3 2.8 0 5-2.2 5-5",key:"173c68"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const z8=q("Amphora",[["path",{d:"M10 2v5.632c0 .424-.272.795-.653.982A6 6 0 0 0 6 14c.006 4 3 7 5 8",key:"1h8rid"}],["path",{d:"M10 5H8a2 2 0 0 0 0 4h.68",key:"3ezsi6"}],["path",{d:"M14 2v5.632c0 .424.272.795.652.982A6 6 0 0 1 18 14c0 4-3 7-5 8",key:"yt6q09"}],["path",{d:"M14 5h2a2 2 0 0 1 0 4h-.68",key:"8f95yk"}],["path",{d:"M18 22H6",key:"mg6kv4"}],["path",{d:"M9 2h6",key:"1jrp98"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const B8=q("Anchor",[["path",{d:"M12 22V8",key:"qkxhtm"}],["path",{d:"M5 12H2a10 10 0 0 0 20 0h-3",key:"1hv3nh"}],["circle",{cx:"12",cy:"5",r:"3",key:"rqqgnr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $8=q("Angry",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M16 16s-1.5-2-4-2-4 2-4 2",key:"epbg0q"}],["path",{d:"M7.5 8 10 9",key:"olxxln"}],["path",{d:"m14 9 2.5-1",key:"1j6cij"}],["path",{d:"M9 10h.01",key:"qbtxuw"}],["path",{d:"M15 10h.01",key:"1qmjsl"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const U8=q("Annoyed",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 15h8",key:"45n4r"}],["path",{d:"M8 9h2",key:"1g203m"}],["path",{d:"M14 9h2",key:"116p9w"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const q8=q("Antenna",[["path",{d:"M2 12 7 2",key:"117k30"}],["path",{d:"m7 12 5-10",key:"1tvx22"}],["path",{d:"m12 12 5-10",key:"ev1o1a"}],["path",{d:"m17 12 5-10",key:"1e4ti3"}],["path",{d:"M4.5 7h15",key:"vlsxkz"}],["path",{d:"M12 16v6",key:"c8a4gj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const V8=q("Anvil",[["path",{d:"M7 10H6a4 4 0 0 1-4-4 1 1 0 0 1 1-1h4",key:"1hjpb6"}],["path",{d:"M7 5a1 1 0 0 1 1-1h13a1 1 0 0 1 1 1 7 7 0 0 1-7 7H8a1 1 0 0 1-1-1z",key:"1qn45f"}],["path",{d:"M9 12v5",key:"3anwtq"}],["path",{d:"M15 12v5",key:"5xh3zn"}],["path",{d:"M5 20a3 3 0 0 1 3-3h8a3 3 0 0 1 3 3 1 1 0 0 1-1 1H6a1 1 0 0 1-1-1",key:"1fi4x8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const H8=q("Aperture",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m14.31 8 5.74 9.94",key:"1y6ab4"}],["path",{d:"M9.69 8h11.48",key:"1wxppr"}],["path",{d:"m7.38 12 5.74-9.94",key:"1grp0k"}],["path",{d:"M9.69 16 3.95 6.06",key:"libnyf"}],["path",{d:"M14.31 16H2.83",key:"x5fava"}],["path",{d:"m16.62 12-5.74 9.94",key:"1vwawt"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const W8=q("AppWindowMac",[["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["path",{d:"M6 8h.01",key:"x9i8wu"}],["path",{d:"M10 8h.01",key:"1r9ogq"}],["path",{d:"M14 8h.01",key:"1primd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const XT=q("AppWindow",[["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2",key:"izxlao"}],["path",{d:"M10 4v4",key:"pp8u80"}],["path",{d:"M2 8h20",key:"d11cs7"}],["path",{d:"M6 4v4",key:"1svtjw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const G8=q("Apple",[["path",{d:"M12 20.94c1.5 0 2.75 1.06 4 1.06 3 0 6-8 6-12.22A4.91 4.91 0 0 0 17 5c-2.22 0-4 1.44-5 2-1-.56-2.78-2-5-2a4.9 4.9 0 0 0-5 4.78C2 14 5 22 8 22c1.25 0 2.5-1.06 4-1.06Z",key:"3s7exb"}],["path",{d:"M10 2c1 .5 2 2 2 5",key:"fcco2y"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const K8=q("ArchiveRestore",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h2",key:"tvwodi"}],["path",{d:"M20 8v11a2 2 0 0 1-2 2h-2",key:"1gkqxj"}],["path",{d:"m9 15 3-3 3 3",key:"1pd0qc"}],["path",{d:"M12 12v9",key:"192myk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Z8=q("ArchiveX",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"m9.5 17 5-5",key:"nakeu6"}],["path",{d:"m9.5 12 5 5",key:"1hccrj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Y8=q("Archive",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const X8=q("Armchair",[["path",{d:"M19 9V6a2 2 0 0 0-2-2H7a2 2 0 0 0-2 2v3",key:"irtipd"}],["path",{d:"M3 16a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-5a2 2 0 0 0-4 0v1.5a.5.5 0 0 1-.5.5h-9a.5.5 0 0 1-.5-.5V11a2 2 0 0 0-4 0z",key:"1qyhux"}],["path",{d:"M5 18v2",key:"ppbyun"}],["path",{d:"M19 18v2",key:"gy7782"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Q8=q("ArrowBigDownDash",[["path",{d:"M15 5H9",key:"1tp3ed"}],["path",{d:"M15 9v3h4l-7 7-7-7h4V9z",key:"ncdc4b"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const J8=q("ArrowBigDown",[["path",{d:"M15 6v6h4l-7 7-7-7h4V6h6z",key:"1thax2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const eD=q("ArrowBigLeftDash",[["path",{d:"M19 15V9",key:"1hci5f"}],["path",{d:"M15 15h-3v4l-7-7 7-7v4h3v6z",key:"16tjna"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tD=q("ArrowBigLeft",[["path",{d:"M18 15h-6v4l-7-7 7-7v4h6v6z",key:"lbrdak"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rD=q("ArrowBigRightDash",[["path",{d:"M5 9v6",key:"158jrl"}],["path",{d:"M9 9h3V5l7 7-7 7v-4H9V9z",key:"1sg2xn"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nD=q("ArrowBigRight",[["path",{d:"M6 9h6V5l7 7-7 7v-4H6V9z",key:"7fvt9c"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sD=q("ArrowBigUpDash",[["path",{d:"M9 19h6",key:"456am0"}],["path",{d:"M9 15v-3H5l7-7 7 7h-4v3H9z",key:"1r2uve"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const aD=q("ArrowBigUp",[["path",{d:"M9 18v-6H5l7-7 7 7h-4v6H9z",key:"1x06kx"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const iD=q("ArrowDown01",[["path",{d:"m3 16 4 4 4-4",key:"1co6wj"}],["path",{d:"M7 20V4",key:"1yoxec"}],["rect",{x:"15",y:"4",width:"4",height:"6",ry:"2",key:"1bwicg"}],["path",{d:"M17 20v-6h-2",key:"1qp1so"}],["path",{d:"M15 20h4",key:"1j968p"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oD=q("ArrowDown10",[["path",{d:"m3 16 4 4 4-4",key:"1co6wj"}],["path",{d:"M7 20V4",key:"1yoxec"}],["path",{d:"M17 10V4h-2",key:"zcsr5x"}],["path",{d:"M15 10h4",key:"id2lce"}],["rect",{x:"15",y:"14",width:"4",height:"6",ry:"2",key:"33xykx"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const O_=q("ArrowDownAZ",[["path",{d:"m3 16 4 4 4-4",key:"1co6wj"}],["path",{d:"M7 20V4",key:"1yoxec"}],["path",{d:"M20 8h-5",key:"1vsyxs"}],["path",{d:"M15 10V6.5a2.5 2.5 0 0 1 5 0V10",key:"ag13bf"}],["path",{d:"M15 14h5l-5 6h5",key:"ur5jdg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lD=q("ArrowDownFromLine",[["path",{d:"M19 3H5",key:"1236rx"}],["path",{d:"M12 21V7",key:"gj6g52"}],["path",{d:"m6 15 6 6 6-6",key:"h15q88"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cD=q("ArrowDownLeft",[["path",{d:"M17 7 7 17",key:"15tmo1"}],["path",{d:"M17 17H7V7",key:"1org7z"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dD=q("ArrowDownNarrowWide",[["path",{d:"m3 16 4 4 4-4",key:"1co6wj"}],["path",{d:"M7 20V4",key:"1yoxec"}],["path",{d:"M11 4h4",key:"6d7r33"}],["path",{d:"M11 8h7",key:"djye34"}],["path",{d:"M11 12h10",key:"1438ji"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uD=q("ArrowDownRight",[["path",{d:"m7 7 10 10",key:"1fmybs"}],["path",{d:"M17 7v10H7",key:"6fjiku"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hD=q("ArrowDownToDot",[["path",{d:"M12 2v14",key:"jyx4ut"}],["path",{d:"m19 9-7 7-7-7",key:"1oe3oy"}],["circle",{cx:"12",cy:"21",r:"1",key:"o0uj5v"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fD=q("ArrowDownToLine",[["path",{d:"M12 17V3",key:"1cwfxf"}],["path",{d:"m6 11 6 6 6-6",key:"12ii2o"}],["path",{d:"M19 21H5",key:"150jfl"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pD=q("ArrowDownUp",[["path",{d:"m3 16 4 4 4-4",key:"1co6wj"}],["path",{d:"M7 20V4",key:"1yoxec"}],["path",{d:"m21 8-4-4-4 4",key:"1c9v7m"}],["path",{d:"M17 4v16",key:"7dpous"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const D_=q("ArrowDownWideNarrow",[["path",{d:"m3 16 4 4 4-4",key:"1co6wj"}],["path",{d:"M7 20V4",key:"1yoxec"}],["path",{d:"M11 4h10",key:"1w87gc"}],["path",{d:"M11 8h7",key:"djye34"}],["path",{d:"M11 12h4",key:"q8tih4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const R_=q("ArrowDownZA",[["path",{d:"m3 16 4 4 4-4",key:"1co6wj"}],["path",{d:"M7 4v16",key:"1glfcx"}],["path",{d:"M15 4h5l-5 6h5",key:"8asdl1"}],["path",{d:"M15 20v-3.5a2.5 2.5 0 0 1 5 0V20",key:"r6l5cz"}],["path",{d:"M20 18h-5",key:"18j1r2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ay=q("ArrowDown",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mD=q("ArrowLeftFromLine",[["path",{d:"m9 6-6 6 6 6",key:"7v63n9"}],["path",{d:"M3 12h14",key:"13k4hi"}],["path",{d:"M21 19V5",key:"b4bplr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gD=q("ArrowLeftRight",[["path",{d:"M8 3 4 7l4 4",key:"9rb6wj"}],["path",{d:"M4 7h16",key:"6tx8e3"}],["path",{d:"m16 21 4-4-4-4",key:"siv7j2"}],["path",{d:"M20 17H4",key:"h6l3hr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xD=q("ArrowLeftToLine",[["path",{d:"M3 19V5",key:"rwsyhb"}],["path",{d:"m13 6-6 6 6 6",key:"1yhaz7"}],["path",{d:"M7 12h14",key:"uoisry"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const po=q("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yD=q("ArrowRightFromLine",[["path",{d:"M3 5v14",key:"1nt18q"}],["path",{d:"M21 12H7",key:"13ipq5"}],["path",{d:"m15 18 6-6-6-6",key:"6tx3qv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vD=q("ArrowRightLeft",[["path",{d:"m16 3 4 4-4 4",key:"1x1c3m"}],["path",{d:"M20 7H4",key:"zbl0bi"}],["path",{d:"m8 21-4-4 4-4",key:"h9nckh"}],["path",{d:"M4 17h16",key:"g4d7ey"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _D=q("ArrowRightToLine",[["path",{d:"M17 12H3",key:"8awo09"}],["path",{d:"m11 18 6-6-6-6",key:"8c2y43"}],["path",{d:"M21 5v14",key:"nzette"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Vo=q("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bD=q("ArrowUp01",[["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}],["rect",{x:"15",y:"4",width:"4",height:"6",ry:"2",key:"1bwicg"}],["path",{d:"M17 20v-6h-2",key:"1qp1so"}],["path",{d:"M15 20h4",key:"1j968p"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wD=q("ArrowUp10",[["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}],["path",{d:"M17 10V4h-2",key:"zcsr5x"}],["path",{d:"M15 10h4",key:"id2lce"}],["rect",{x:"15",y:"14",width:"4",height:"6",ry:"2",key:"33xykx"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const F_=q("ArrowUpAZ",[["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}],["path",{d:"M20 8h-5",key:"1vsyxs"}],["path",{d:"M15 10V6.5a2.5 2.5 0 0 1 5 0V10",key:"ag13bf"}],["path",{d:"M15 14h5l-5 6h5",key:"ur5jdg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Pg=q("ArrowUpDown",[["path",{d:"m21 16-4 4-4-4",key:"f6ql7i"}],["path",{d:"M17 20V4",key:"1ejh1v"}],["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jD=q("ArrowUpFromDot",[["path",{d:"m5 9 7-7 7 7",key:"1hw5ic"}],["path",{d:"M12 16V2",key:"ywoabb"}],["circle",{cx:"12",cy:"21",r:"1",key:"o0uj5v"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kD=q("ArrowUpFromLine",[["path",{d:"m18 9-6-6-6 6",key:"kcunyi"}],["path",{d:"M12 3v14",key:"7cf3v8"}],["path",{d:"M5 21h14",key:"11awu3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ND=q("ArrowUpLeft",[["path",{d:"M7 17V7h10",key:"11bw93"}],["path",{d:"M17 17 7 7",key:"2786uv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const z_=q("ArrowUpNarrowWide",[["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}],["path",{d:"M11 12h4",key:"q8tih4"}],["path",{d:"M11 16h7",key:"uosisv"}],["path",{d:"M11 20h10",key:"jvxblo"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const SD=q("ArrowUpRight",[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const CD=q("ArrowUpToLine",[["path",{d:"M5 3h14",key:"7usisc"}],["path",{d:"m18 13-6-6-6 6",key:"1kf1n9"}],["path",{d:"M12 7v14",key:"1akyts"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const MD=q("ArrowUpWideNarrow",[["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}],["path",{d:"M11 12h10",key:"1438ji"}],["path",{d:"M11 16h7",key:"uosisv"}],["path",{d:"M11 20h4",key:"1krc32"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const B_=q("ArrowUpZA",[["path",{d:"m3 8 4-4 4 4",key:"11wl7u"}],["path",{d:"M7 4v16",key:"1glfcx"}],["path",{d:"M15 4h5l-5 6h5",key:"8asdl1"}],["path",{d:"M15 20v-3.5a2.5 2.5 0 0 1 5 0V20",key:"r6l5cz"}],["path",{d:"M20 18h-5",key:"18j1r2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cp=q("ArrowUp",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const TD=q("ArrowsUpFromLine",[["path",{d:"m4 6 3-3 3 3",key:"9aidw8"}],["path",{d:"M7 17V3",key:"19qxw1"}],["path",{d:"m14 6 3-3 3 3",key:"6iy689"}],["path",{d:"M17 17V3",key:"o0fmgi"}],["path",{d:"M4 21h16",key:"1h09gz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const AD=q("Asterisk",[["path",{d:"M12 6v12",key:"1vza4d"}],["path",{d:"M17.196 9 6.804 15",key:"1ah31z"}],["path",{d:"m6.804 9 10.392 6",key:"1b6pxd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ED=q("AtSign",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8",key:"7n84p3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ID=q("Atom",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["path",{d:"M20.2 20.2c2.04-2.03.02-7.36-4.5-11.9-4.54-4.52-9.87-6.54-11.9-4.5-2.04 2.03-.02 7.36 4.5 11.9 4.54 4.52 9.87 6.54 11.9 4.5Z",key:"1l2ple"}],["path",{d:"M15.7 15.7c4.52-4.54 6.54-9.87 4.5-11.9-2.03-2.04-7.36-.02-11.9 4.5-4.52 4.54-6.54 9.87-4.5 11.9 2.03 2.04 7.36.02 11.9-4.5Z",key:"1wam0m"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const PD=q("AudioLines",[["path",{d:"M2 10v3",key:"1fnikh"}],["path",{d:"M6 6v11",key:"11sgs0"}],["path",{d:"M10 3v18",key:"yhl04a"}],["path",{d:"M14 8v7",key:"3a1oy3"}],["path",{d:"M18 5v13",key:"123xd1"}],["path",{d:"M22 10v3",key:"154ddg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const LD=q("AudioWaveform",[["path",{d:"M2 13a2 2 0 0 0 2-2V7a2 2 0 0 1 4 0v13a2 2 0 0 0 4 0V4a2 2 0 0 1 4 0v13a2 2 0 0 0 4 0v-4a2 2 0 0 1 2-2",key:"57tc96"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zl=q("Award",[["path",{d:"m15.477 12.89 1.515 8.526a.5.5 0 0 1-.81.47l-3.58-2.687a1 1 0 0 0-1.197 0l-3.586 2.686a.5.5 0 0 1-.81-.469l1.514-8.526",key:"1yiouv"}],["circle",{cx:"12",cy:"8",r:"6",key:"1vp47v"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const OD=q("Axe",[["path",{d:"m14 12-8.5 8.5a2.12 2.12 0 1 1-3-3L11 9",key:"csbz4o"}],["path",{d:"M15 13 9 7l4-4 6 6h3a8 8 0 0 1-7 7z",key:"113wfo"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $_=q("Axis3d",[["path",{d:"M4 4v16h16",key:"1s015l"}],["path",{d:"m4 20 7-7",key:"17qe9y"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const DD=q("Baby",[["path",{d:"M9 12h.01",key:"157uk2"}],["path",{d:"M15 12h.01",key:"1k8ypt"}],["path",{d:"M10 16c.5.3 1.2.5 2 .5s1.5-.2 2-.5",key:"1u7htd"}],["path",{d:"M19 6.3a9 9 0 0 1 1.8 3.9 2 2 0 0 1 0 3.6 9 9 0 0 1-17.6 0 2 2 0 0 1 0-3.6A9 9 0 0 1 12 3c2 0 3.5 1.1 3.5 2.5s-.9 2.5-2 2.5c-.8 0-1.5-.4-1.5-1",key:"5yv0yz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const RD=q("Backpack",[["path",{d:"M4 10a4 4 0 0 1 4-4h8a4 4 0 0 1 4 4v10a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2z",key:"1ol0lm"}],["path",{d:"M8 10h8",key:"c7uz4u"}],["path",{d:"M8 18h8",key:"1no2b1"}],["path",{d:"M8 22v-6a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v6",key:"1fr6do"}],["path",{d:"M9 6V4a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v2",key:"donm21"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const FD=q("BadgeAlert",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zD=q("BadgeCent",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["path",{d:"M12 7v10",key:"jspqdw"}],["path",{d:"M15.4 10a4 4 0 1 0 0 4",key:"2eqtx8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const U_=q("BadgeCheck",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const BD=q("BadgeDollarSign",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["path",{d:"M16 8h-6a2 2 0 1 0 0 4h4a2 2 0 1 1 0 4H8",key:"1h4pet"}],["path",{d:"M12 18V6",key:"zqpxq5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $D=q("BadgeEuro",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["path",{d:"M7 12h5",key:"gblrwe"}],["path",{d:"M15 9.4a4 4 0 1 0 0 5.2",key:"1makmb"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const UD=q("BadgeHelp",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["line",{x1:"12",x2:"12.01",y1:"17",y2:"17",key:"io3f8k"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qD=q("BadgeIndianRupee",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["path",{d:"M8 8h8",key:"1bis0t"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"m13 17-5-1h1a4 4 0 0 0 0-8",key:"nu2bwa"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const VD=q("BadgeInfo",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["line",{x1:"12",x2:"12",y1:"16",y2:"12",key:"1y1yb1"}],["line",{x1:"12",x2:"12.01",y1:"8",y2:"8",key:"110wyk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const HD=q("BadgeJapaneseYen",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["path",{d:"m9 8 3 3v7",key:"17yadx"}],["path",{d:"m12 11 3-3",key:"p4cfq1"}],["path",{d:"M9 12h6",key:"1c52cq"}],["path",{d:"M9 16h6",key:"8wimt3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const WD=q("BadgeMinus",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const GD=q("BadgePercent",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"M9 9h.01",key:"1q5me6"}],["path",{d:"M15 15h.01",key:"lqbp3k"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const KD=q("BadgePlus",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["line",{x1:"12",x2:"12",y1:"8",y2:"16",key:"10p56q"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ZD=q("BadgePoundSterling",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["path",{d:"M8 12h4",key:"qz6y1c"}],["path",{d:"M10 16V9.5a2.5 2.5 0 0 1 5 0",key:"3mlbjk"}],["path",{d:"M8 16h7",key:"sbedsn"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const YD=q("BadgeRussianRuble",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["path",{d:"M9 16h5",key:"1syiyw"}],["path",{d:"M9 12h5a2 2 0 1 0 0-4h-3v9",key:"1ge9c1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const XD=q("BadgeSwissFranc",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["path",{d:"M11 17V8h4",key:"1bfq6y"}],["path",{d:"M11 12h3",key:"2eqnfz"}],["path",{d:"M9 16h4",key:"1skf3a"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const QD=q("BadgeX",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["line",{x1:"15",x2:"9",y1:"9",y2:"15",key:"f7djnv"}],["line",{x1:"9",x2:"15",y1:"9",y2:"15",key:"1shsy8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const JD=q("Badge",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const eR=q("BaggageClaim",[["path",{d:"M22 18H6a2 2 0 0 1-2-2V7a2 2 0 0 0-2-2",key:"4irg2o"}],["path",{d:"M17 14V4a2 2 0 0 0-2-2h-1a2 2 0 0 0-2 2v10",key:"14fcyx"}],["rect",{width:"13",height:"8",x:"8",y:"6",rx:"1",key:"o6oiis"}],["circle",{cx:"18",cy:"20",r:"2",key:"t9985n"}],["circle",{cx:"9",cy:"20",r:"2",key:"e5v82j"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tR=q("Ban",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.9 4.9 14.2 14.2",key:"1m5liu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rR=q("Banana",[["path",{d:"M4 13c3.5-2 8-2 10 2a5.5 5.5 0 0 1 8 5",key:"1cscit"}],["path",{d:"M5.15 17.89c5.52-1.52 8.65-6.89 7-12C11.55 4 11.5 2 13 2c3.22 0 5 5.5 5 8 0 6.5-4.2 12-10.49 12C5.11 22 2 22 2 20c0-1.5 1.14-1.55 3.15-2.11Z",key:"1y1nbv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nR=q("Bandage",[["path",{d:"M10 10.01h.01",key:"1e9xi7"}],["path",{d:"M10 14.01h.01",key:"ac23bv"}],["path",{d:"M14 10.01h.01",key:"2wfrvf"}],["path",{d:"M14 14.01h.01",key:"8tw8yn"}],["path",{d:"M18 6v11.5",key:"dkbidh"}],["path",{d:"M6 6v12",key:"vkc79e"}],["rect",{x:"2",y:"6",width:"20",height:"12",rx:"2",key:"1wpnh2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sR=q("Banknote",[["rect",{width:"20",height:"12",x:"2",y:"6",rx:"2",key:"9lu3g6"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["path",{d:"M6 12h.01M18 12h.01",key:"113zkx"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const aR=q("Barcode",[["path",{d:"M3 5v14",key:"1nt18q"}],["path",{d:"M8 5v14",key:"1ybrkv"}],["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"M17 5v14",key:"ycjyhj"}],["path",{d:"M21 5v14",key:"nzette"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const iR=q("Baseline",[["path",{d:"M4 20h16",key:"14thso"}],["path",{d:"m6 16 6-12 6 12",key:"1b4byz"}],["path",{d:"M8 12h8",key:"1wcyev"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const F1=q("Bath",[["path",{d:"M10 4 8 6",key:"1rru8s"}],["path",{d:"M17 19v2",key:"ts1sot"}],["path",{d:"M2 12h20",key:"9i4pu4"}],["path",{d:"M7 19v2",key:"12npes"}],["path",{d:"M9 5 7.621 3.621A2.121 2.121 0 0 0 4 5v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-5",key:"14ym8i"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oR=q("BatteryCharging",[["path",{d:"M15 7h1a2 2 0 0 1 2 2v6a2 2 0 0 1-2 2h-2",key:"1sdynx"}],["path",{d:"M6 7H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h1",key:"1gkd3k"}],["path",{d:"m11 7-3 5h4l-3 5",key:"b4a64w"}],["line",{x1:"22",x2:"22",y1:"11",y2:"13",key:"4dh1rd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lR=q("BatteryFull",[["rect",{width:"16",height:"10",x:"2",y:"7",rx:"2",ry:"2",key:"1w10f2"}],["line",{x1:"22",x2:"22",y1:"11",y2:"13",key:"4dh1rd"}],["line",{x1:"6",x2:"6",y1:"11",y2:"13",key:"1wd6dw"}],["line",{x1:"10",x2:"10",y1:"11",y2:"13",key:"haxvl5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"13",key:"c6fn6x"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cR=q("BatteryLow",[["rect",{width:"16",height:"10",x:"2",y:"7",rx:"2",ry:"2",key:"1w10f2"}],["line",{x1:"22",x2:"22",y1:"11",y2:"13",key:"4dh1rd"}],["line",{x1:"6",x2:"6",y1:"11",y2:"13",key:"1wd6dw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dR=q("BatteryMedium",[["rect",{width:"16",height:"10",x:"2",y:"7",rx:"2",ry:"2",key:"1w10f2"}],["line",{x1:"22",x2:"22",y1:"11",y2:"13",key:"4dh1rd"}],["line",{x1:"6",x2:"6",y1:"11",y2:"13",key:"1wd6dw"}],["line",{x1:"10",x2:"10",y1:"11",y2:"13",key:"haxvl5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uR=q("BatteryWarning",[["path",{d:"M10 17h.01",key:"nbq80n"}],["path",{d:"M10 7v6",key:"nne03l"}],["path",{d:"M14 7h2a2 2 0 0 1 2 2v6a2 2 0 0 1-2 2h-2",key:"1x5o8m"}],["path",{d:"M22 11v2",key:"1wo06k"}],["path",{d:"M6 7H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h2",key:"1mdjgh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hR=q("Battery",[["rect",{width:"16",height:"10",x:"2",y:"7",rx:"2",ry:"2",key:"1w10f2"}],["line",{x1:"22",x2:"22",y1:"11",y2:"13",key:"4dh1rd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fR=q("Beaker",[["path",{d:"M4.5 3h15",key:"c7n0jr"}],["path",{d:"M6 3v16a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V3",key:"m1uhx7"}],["path",{d:"M6 14h12",key:"4cwo0f"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pR=q("BeanOff",[["path",{d:"M9 9c-.64.64-1.521.954-2.402 1.165A6 6 0 0 0 8 22a13.96 13.96 0 0 0 9.9-4.1",key:"bq3udt"}],["path",{d:"M10.75 5.093A6 6 0 0 1 22 8c0 2.411-.61 4.68-1.683 6.66",key:"17ccse"}],["path",{d:"M5.341 10.62a4 4 0 0 0 6.487 1.208M10.62 5.341a4.015 4.015 0 0 1 2.039 2.04",key:"18zqgq"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mR=q("Bean",[["path",{d:"M10.165 6.598C9.954 7.478 9.64 8.36 9 9c-.64.64-1.521.954-2.402 1.165A6 6 0 0 0 8 22c7.732 0 14-6.268 14-14a6 6 0 0 0-11.835-1.402Z",key:"1tvzk7"}],["path",{d:"M5.341 10.62a4 4 0 1 0 5.279-5.28",key:"2cyri2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gR=q("BedDouble",[["path",{d:"M2 20v-8a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v8",key:"1k78r4"}],["path",{d:"M4 10V6a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v4",key:"fb3tl2"}],["path",{d:"M12 4v6",key:"1dcgq2"}],["path",{d:"M2 18h20",key:"ajqnye"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xR=q("BedSingle",[["path",{d:"M3 20v-8a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v8",key:"1wm6mi"}],["path",{d:"M5 10V6a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v4",key:"4k93s5"}],["path",{d:"M3 18h18",key:"1h113x"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const z1=q("Bed",[["path",{d:"M2 4v16",key:"vw9hq8"}],["path",{d:"M2 8h18a2 2 0 0 1 2 2v10",key:"1dgv2r"}],["path",{d:"M2 17h20",key:"18nfp3"}],["path",{d:"M6 8v9",key:"1yriud"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yR=q("Beef",[["circle",{cx:"12.5",cy:"8.5",r:"2.5",key:"9738u8"}],["path",{d:"M12.5 2a6.5 6.5 0 0 0-6.22 4.6c-1.1 3.13-.78 3.9-3.18 6.08A3 3 0 0 0 5 18c4 0 8.4-1.8 11.4-4.3A6.5 6.5 0 0 0 12.5 2Z",key:"o0f6za"}],["path",{d:"m18.5 6 2.19 4.5a6.48 6.48 0 0 1 .31 2 6.49 6.49 0 0 1-2.6 5.2C15.4 20.2 11 22 7 22a3 3 0 0 1-2.68-1.66L2.4 16.5",key:"k7p6i0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vR=q("BeerOff",[["path",{d:"M13 13v5",key:"igwfh0"}],["path",{d:"M17 11.47V8",key:"16yw0g"}],["path",{d:"M17 11h1a3 3 0 0 1 2.745 4.211",key:"1xbt65"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M5 8v12a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2v-3",key:"c55o3e"}],["path",{d:"M7.536 7.535C6.766 7.649 6.154 8 5.5 8a2.5 2.5 0 0 1-1.768-4.268",key:"1ydug7"}],["path",{d:"M8.727 3.204C9.306 2.767 9.885 2 11 2c1.56 0 2 1.5 3 1.5s1.72-.5 2.5-.5a1 1 0 1 1 0 5c-.78 0-1.5-.5-2.5-.5a3.149 3.149 0 0 0-.842.12",key:"q81o7q"}],["path",{d:"M9 14.6V18",key:"20ek98"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _R=q("Beer",[["path",{d:"M17 11h1a3 3 0 0 1 0 6h-1",key:"1yp76v"}],["path",{d:"M9 12v6",key:"1u1cab"}],["path",{d:"M13 12v6",key:"1sugkk"}],["path",{d:"M14 7.5c-1 0-1.44.5-3 .5s-2-.5-3-.5-1.72.5-2.5.5a2.5 2.5 0 0 1 0-5c.78 0 1.57.5 2.5.5S9.44 2 11 2s2 1.5 3 1.5 1.72-.5 2.5-.5a2.5 2.5 0 0 1 0 5c-.78 0-1.5-.5-2.5-.5Z",key:"1510fo"}],["path",{d:"M5 8v12a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V8",key:"19jb7n"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bR=q("BellDot",[["path",{d:"M19.4 14.9C20.2 16.4 21 17 21 17H3s3-2 3-9c0-3.3 2.7-6 6-6 .7 0 1.3.1 1.9.3",key:"xcehk"}],["path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0",key:"qgo35s"}],["circle",{cx:"18",cy:"8",r:"3",key:"1g0gzu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wR=q("BellElectric",[["path",{d:"M18.8 4A6.3 8.7 0 0 1 20 9",key:"xve1fh"}],["path",{d:"M9 9h.01",key:"1q5me6"}],["circle",{cx:"9",cy:"9",r:"7",key:"p2h5vp"}],["rect",{width:"10",height:"6",x:"4",y:"16",rx:"2",key:"17f3te"}],["path",{d:"M14 19c3 0 4.6-1.6 4.6-1.6",key:"n7odp6"}],["circle",{cx:"20",cy:"16",r:"2",key:"1v9bxh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jR=q("BellMinus",[["path",{d:"M18.4 12c.8 3.8 2.6 5 2.6 5H3s3-2 3-9c0-3.3 2.7-6 6-6 1.8 0 3.4.8 4.5 2",key:"eck70s"}],["path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0",key:"qgo35s"}],["path",{d:"M15 8h6",key:"8ybuxh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Sj=q("BellOff",[["path",{d:"M8.7 3A6 6 0 0 1 18 8a21.3 21.3 0 0 0 .6 5",key:"o7mx20"}],["path",{d:"M17 17H3s3-2 3-9a4.67 4.67 0 0 1 .3-1.7",key:"16f1lm"}],["path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0",key:"qgo35s"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kR=q("BellPlus",[["path",{d:"M19.3 14.8C20.1 16.4 21 17 21 17H3s3-2 3-9c0-3.3 2.7-6 6-6 1 0 1.9.2 2.8.7",key:"guizqy"}],["path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0",key:"qgo35s"}],["path",{d:"M15 8h6",key:"8ybuxh"}],["path",{d:"M18 5v6",key:"g5ayrv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const NR=q("BellRing",[["path",{d:"M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9",key:"1qo2s2"}],["path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0",key:"qgo35s"}],["path",{d:"M4 2C2.8 3.7 2 5.7 2 8",key:"tap9e0"}],["path",{d:"M22 8c0-2.3-.8-4.3-2-6",key:"5bb3ad"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Lg=q("Bell",[["path",{d:"M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9",key:"1qo2s2"}],["path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0",key:"qgo35s"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const q_=q("BetweenHorizontalEnd",[["rect",{width:"13",height:"7",x:"3",y:"3",rx:"1",key:"11xb64"}],["path",{d:"m22 15-3-3 3-3",key:"26chmm"}],["rect",{width:"13",height:"7",x:"3",y:"14",rx:"1",key:"k6ky7n"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const V_=q("BetweenHorizontalStart",[["rect",{width:"13",height:"7",x:"8",y:"3",rx:"1",key:"pkso9a"}],["path",{d:"m2 9 3 3-3 3",key:"1agib5"}],["rect",{width:"13",height:"7",x:"8",y:"14",rx:"1",key:"1q5fc1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const SR=q("BetweenVerticalEnd",[["rect",{width:"7",height:"13",x:"3",y:"3",rx:"1",key:"1fdu0f"}],["path",{d:"m9 22 3-3 3 3",key:"17z65a"}],["rect",{width:"7",height:"13",x:"14",y:"3",rx:"1",key:"1squn4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const CR=q("BetweenVerticalStart",[["rect",{width:"7",height:"13",x:"3",y:"8",rx:"1",key:"1fjrkv"}],["path",{d:"m15 2-3 3-3-3",key:"1uh6eb"}],["rect",{width:"7",height:"13",x:"14",y:"8",rx:"1",key:"w3fjg8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const MR=q("BicepsFlexed",[["path",{d:"M12.409 13.017A5 5 0 0 1 22 15c0 3.866-4 7-9 7-4.077 0-8.153-.82-10.371-2.462-.426-.316-.631-.832-.62-1.362C2.118 12.723 2.627 2 10 2a3 3 0 0 1 3 3 2 2 0 0 1-2 2c-1.105 0-1.64-.444-2-1",key:"1pmlyh"}],["path",{d:"M15 14a5 5 0 0 0-7.584 2",key:"5rb254"}],["path",{d:"M9.964 6.825C8.019 7.977 9.5 13 8 15",key:"kbvsx9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const TR=q("Bike",[["circle",{cx:"18.5",cy:"17.5",r:"3.5",key:"15x4ox"}],["circle",{cx:"5.5",cy:"17.5",r:"3.5",key:"1noe27"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["path",{d:"M12 17.5V14l-3-3 4-3 2 3h2",key:"1npguv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const AR=q("Binary",[["rect",{x:"14",y:"14",width:"4",height:"6",rx:"2",key:"p02svl"}],["rect",{x:"6",y:"4",width:"4",height:"6",rx:"2",key:"xm4xkj"}],["path",{d:"M6 20h4",key:"1i6q5t"}],["path",{d:"M14 10h4",key:"ru81e7"}],["path",{d:"M6 14h2v6",key:"16z9wg"}],["path",{d:"M14 4h2v6",key:"1idq9u"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ER=q("Binoculars",[["path",{d:"M10 10h4",key:"tcdvrf"}],["path",{d:"M19 7V4a1 1 0 0 0-1-1h-2a1 1 0 0 0-1 1v3",key:"3apit1"}],["path",{d:"M20 21a2 2 0 0 0 2-2v-3.851c0-1.39-2-2.962-2-4.829V8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v11a2 2 0 0 0 2 2z",key:"rhpgnw"}],["path",{d:"M 22 16 L 2 16",key:"14lkq7"}],["path",{d:"M4 21a2 2 0 0 1-2-2v-3.851c0-1.39 2-2.962 2-4.829V8a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v11a2 2 0 0 1-2 2z",key:"104b3k"}],["path",{d:"M9 7V4a1 1 0 0 0-1-1H6a1 1 0 0 0-1 1v3",key:"14fczp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const IR=q("Biohazard",[["circle",{cx:"12",cy:"11.9",r:"2",key:"e8h31w"}],["path",{d:"M6.7 3.4c-.9 2.5 0 5.2 2.2 6.7C6.5 9 3.7 9.6 2 11.6",key:"17bolr"}],["path",{d:"m8.9 10.1 1.4.8",key:"15ezny"}],["path",{d:"M17.3 3.4c.9 2.5 0 5.2-2.2 6.7 2.4-1.2 5.2-.6 6.9 1.5",key:"wtwa5u"}],["path",{d:"m15.1 10.1-1.4.8",key:"1r0b28"}],["path",{d:"M16.7 20.8c-2.6-.4-4.6-2.6-4.7-5.3-.2 2.6-2.1 4.8-4.7 5.2",key:"m7qszh"}],["path",{d:"M12 13.9v1.6",key:"zfyyim"}],["path",{d:"M13.5 5.4c-1-.2-2-.2-3 0",key:"1bi9q0"}],["path",{d:"M17 16.4c.7-.7 1.2-1.6 1.5-2.5",key:"1rhjqw"}],["path",{d:"M5.5 13.9c.3.9.8 1.8 1.5 2.5",key:"8gsud3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const PR=q("Bird",[["path",{d:"M16 7h.01",key:"1kdx03"}],["path",{d:"M3.4 18H12a8 8 0 0 0 8-8V7a4 4 0 0 0-7.28-2.3L2 20",key:"oj1oa8"}],["path",{d:"m20 7 2 .5-2 .5",key:"12nv4d"}],["path",{d:"M10 18v3",key:"1yea0a"}],["path",{d:"M14 17.75V21",key:"1pymcb"}],["path",{d:"M7 18a6 6 0 0 0 3.84-10.61",key:"1npnn0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const LR=q("Bitcoin",[["path",{d:"M11.767 19.089c4.924.868 6.14-6.025 1.216-6.894m-1.216 6.894L5.86 18.047m5.908 1.042-.347 1.97m1.563-8.864c4.924.869 6.14-6.025 1.215-6.893m-1.215 6.893-3.94-.694m5.155-6.2L8.29 4.26m5.908 1.042.348-1.97M7.48 20.364l3.126-17.727",key:"yr8idg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const OR=q("Blend",[["circle",{cx:"9",cy:"9",r:"7",key:"p2h5vp"}],["circle",{cx:"15",cy:"15",r:"7",key:"19ennj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const DR=q("Blinds",[["path",{d:"M3 3h18",key:"o7r712"}],["path",{d:"M20 7H8",key:"gd2fo2"}],["path",{d:"M20 11H8",key:"1ynp89"}],["path",{d:"M10 19h10",key:"19hjk5"}],["path",{d:"M8 15h12",key:"1yqzne"}],["path",{d:"M4 3v14",key:"fggqzn"}],["circle",{cx:"4",cy:"19",r:"2",key:"p3m9r0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const RR=q("Blocks",[["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["path",{d:"M10 21V8a1 1 0 0 0-1-1H4a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-5a1 1 0 0 0-1-1H3",key:"1fpvtg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const FR=q("BluetoothConnected",[["path",{d:"m7 7 10 10-5 5V2l5 5L7 17",key:"1q5490"}],["line",{x1:"18",x2:"21",y1:"12",y2:"12",key:"1rsjjs"}],["line",{x1:"3",x2:"6",y1:"12",y2:"12",key:"11yl8c"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zR=q("BluetoothOff",[["path",{d:"m17 17-5 5V12l-5 5",key:"v5aci6"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M14.5 9.5 17 7l-5-5v4.5",key:"1kddfz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const BR=q("BluetoothSearching",[["path",{d:"m7 7 10 10-5 5V2l5 5L7 17",key:"1q5490"}],["path",{d:"M20.83 14.83a4 4 0 0 0 0-5.66",key:"k8tn1j"}],["path",{d:"M18 12h.01",key:"yjnet6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $R=q("Bluetooth",[["path",{d:"m7 7 10 10-5 5V2l5 5L7 17",key:"1q5490"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vS=q("Bold",[["path",{d:"M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8",key:"mg9rjx"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const UR=q("Bolt",[["path",{d:"M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z",key:"yt0hxn"}],["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qR=q("Bomb",[["circle",{cx:"11",cy:"13",r:"9",key:"hd149"}],["path",{d:"M14.35 4.65 16.3 2.7a2.41 2.41 0 0 1 3.4 0l1.6 1.6a2.4 2.4 0 0 1 0 3.4l-1.95 1.95",key:"jp4j1b"}],["path",{d:"m22 2-1.5 1.5",key:"ay92ug"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const VR=q("Bone",[["path",{d:"M17 10c.7-.7 1.69 0 2.5 0a2.5 2.5 0 1 0 0-5 .5.5 0 0 1-.5-.5 2.5 2.5 0 1 0-5 0c0 .81.7 1.8 0 2.5l-7 7c-.7.7-1.69 0-2.5 0a2.5 2.5 0 0 0 0 5c.28 0 .5.22.5.5a2.5 2.5 0 1 0 5 0c0-.81-.7-1.8 0-2.5Z",key:"w610uw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const HR=q("BookA",[["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}],["path",{d:"m8 13 4-7 4 7",key:"4rari8"}],["path",{d:"M9.1 11h5.7",key:"1gkovt"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const WR=q("BookAudio",[["path",{d:"M12 6v7",key:"1f6ttz"}],["path",{d:"M16 8v3",key:"gejaml"}],["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}],["path",{d:"M8 8v3",key:"1qzp49"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const GR=q("BookCheck",[["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}],["path",{d:"m9 9.5 2 2 4-4",key:"1dth82"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const KR=q("BookCopy",[["path",{d:"M2 16V4a2 2 0 0 1 2-2h11",key:"spzkk5"}],["path",{d:"M22 18H11a2 2 0 1 0 0 4h10.5a.5.5 0 0 0 .5-.5v-15a.5.5 0 0 0-.5-.5H11a2 2 0 0 0-2 2v12",key:"1wz07i"}],["path",{d:"M5 14H4a2 2 0 1 0 0 4h1",key:"16gqf9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const H_=q("BookDashed",[["path",{d:"M12 17h2",key:"13u4lk"}],["path",{d:"M12 22h2",key:"kn7ki6"}],["path",{d:"M12 2h2",key:"cvn524"}],["path",{d:"M18 22h1a1 1 0 0 0 1-1",key:"w6gbqz"}],["path",{d:"M18 2h1a1 1 0 0 1 1 1v1",key:"1vpra5"}],["path",{d:"M20 15v2h-2",key:"fph276"}],["path",{d:"M20 8v3",key:"deu0bs"}],["path",{d:"M4 11V9",key:"v3xsx8"}],["path",{d:"M4 19.5V15",key:"6gr39e"}],["path",{d:"M4 5v-.5A2.5 2.5 0 0 1 6.5 2H8",key:"wywhs9"}],["path",{d:"M8 22H6.5a1 1 0 0 1 0-5H8",key:"1cu73q"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ZR=q("BookDown",[["path",{d:"M12 13V7",key:"h0r20n"}],["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}],["path",{d:"m9 10 3 3 3-3",key:"zt5b4y"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const YR=q("BookHeadphones",[["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}],["path",{d:"M8 12v-2a4 4 0 0 1 8 0v2",key:"1vsqkj"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const XR=q("BookHeart",[["path",{d:"M16 8.2A2.22 2.22 0 0 0 13.8 6c-.8 0-1.4.3-1.8.9-.4-.6-1-.9-1.8-.9A2.22 2.22 0 0 0 8 8.2c0 .6.3 1.2.7 1.6A226.652 226.652 0 0 0 12 13a404 404 0 0 0 3.3-3.1 2.413 2.413 0 0 0 .7-1.7",key:"1t75a8"}],["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const QR=q("BookImage",[["path",{d:"m20 13.7-2.1-2.1a2 2 0 0 0-2.8 0L9.7 17",key:"q6ojf0"}],["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}],["circle",{cx:"10",cy:"8",r:"2",key:"2qkj4p"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const JR=q("BookKey",[["path",{d:"m19 3 1 1",key:"ze14oc"}],["path",{d:"m20 2-4.5 4.5",key:"1sppr8"}],["path",{d:"M20 8v13a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"1ocbpn"}],["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H14",key:"1gfsgw"}],["circle",{cx:"14",cy:"8",r:"2",key:"u49eql"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const eF=q("BookLock",[["path",{d:"M18 6V4a2 2 0 1 0-4 0v2",key:"1aquzs"}],["path",{d:"M20 15v6a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"1rkj32"}],["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H10",key:"18wgow"}],["rect",{x:"12",y:"6",width:"8",height:"5",rx:"1",key:"73l30o"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tF=q("BookMarked",[["path",{d:"M10 2v8l3-3 3 3V2",key:"sqw3rj"}],["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rF=q("BookMinus",[["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}],["path",{d:"M9 10h6",key:"9gxzsh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nF=q("BookOpenCheck",[["path",{d:"M12 21V7",key:"gj6g52"}],["path",{d:"m16 12 2 2 4-4",key:"mdajum"}],["path",{d:"M22 6V4a1 1 0 0 0-1-1h-5a4 4 0 0 0-4 4 4 4 0 0 0-4-4H3a1 1 0 0 0-1 1v13a1 1 0 0 0 1 1h6a3 3 0 0 1 3 3 3 3 0 0 1 3-3h6a1 1 0 0 0 1-1v-1.3",key:"8arnkb"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sF=q("BookOpenText",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M16 12h2",key:"7q9ll5"}],["path",{d:"M16 8h2",key:"msurwy"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}],["path",{d:"M6 12h2",key:"32wvfc"}],["path",{d:"M6 8h2",key:"30oboj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const QT=q("BookOpen",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const aF=q("BookPlus",[["path",{d:"M12 7v6",key:"lw1j43"}],["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}],["path",{d:"M9 10h6",key:"9gxzsh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const iF=q("BookText",[["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}],["path",{d:"M8 11h8",key:"vwpz6n"}],["path",{d:"M8 7h6",key:"1f0q6e"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oF=q("BookType",[["path",{d:"M10 13h4",key:"ytezjc"}],["path",{d:"M12 6v7",key:"1f6ttz"}],["path",{d:"M16 8V6H8v2",key:"x8j6u4"}],["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lF=q("BookUp2",[["path",{d:"M12 13V7",key:"h0r20n"}],["path",{d:"M18 2h1a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"161d7n"}],["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2",key:"1lorq7"}],["path",{d:"m9 10 3-3 3 3",key:"11gsxs"}],["path",{d:"m9 5 3-3 3 3",key:"l8vdw6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cF=q("BookUp",[["path",{d:"M12 13V7",key:"h0r20n"}],["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}],["path",{d:"m9 10 3-3 3 3",key:"11gsxs"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dF=q("BookUser",[["path",{d:"M15 13a3 3 0 1 0-6 0",key:"10j68g"}],["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}],["circle",{cx:"12",cy:"8",r:"2",key:"1822b1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uF=q("BookX",[["path",{d:"m14.5 7-5 5",key:"dy991v"}],["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}],["path",{d:"m9.5 7 5 5",key:"s45iea"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hF=q("Book",[["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fF=q("BookmarkCheck",[["path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2Z",key:"169p4p"}],["path",{d:"m9 10 2 2 4-4",key:"1gnqz4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pF=q("BookmarkMinus",[["path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z",key:"1fy3hk"}],["line",{x1:"15",x2:"9",y1:"10",y2:"10",key:"1gty7f"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const JT=q("BookmarkPlus",[["path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z",key:"1fy3hk"}],["line",{x1:"12",x2:"12",y1:"7",y2:"13",key:"1cppfj"}],["line",{x1:"15",x2:"9",y1:"10",y2:"10",key:"1gty7f"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mF=q("BookmarkX",[["path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2Z",key:"169p4p"}],["path",{d:"m14.5 7.5-5 5",key:"3lb6iw"}],["path",{d:"m9.5 7.5 5 5",key:"ko136h"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Sm=q("Bookmark",[["path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z",key:"1fy3hk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gF=q("BoomBox",[["path",{d:"M4 9V5a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v4",key:"vvzvr1"}],["path",{d:"M8 8v1",key:"xcqmfk"}],["path",{d:"M12 8v1",key:"1rj8u4"}],["path",{d:"M16 8v1",key:"1q12zr"}],["rect",{width:"20",height:"12",x:"2",y:"9",rx:"2",key:"igpb89"}],["circle",{cx:"8",cy:"15",r:"2",key:"fa4a8s"}],["circle",{cx:"16",cy:"15",r:"2",key:"14c3ya"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xF=q("BotMessageSquare",[["path",{d:"M12 6V2H8",key:"1155em"}],["path",{d:"m8 18-4 4V8a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2Z",key:"w2lp3e"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M9 11v2",key:"1ueba0"}],["path",{d:"M15 11v2",key:"i11awn"}],["path",{d:"M20 12h2",key:"1q8mjw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yF=q("BotOff",[["path",{d:"M13.67 8H18a2 2 0 0 1 2 2v4.33",key:"7az073"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M22 22 2 2",key:"1r8tn9"}],["path",{d:"M8 8H6a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h12a2 2 0 0 0 1.414-.586",key:"s09a7a"}],["path",{d:"M9 13v2",key:"rq6x2g"}],["path",{d:"M9.67 4H12v2.33",key:"110xot"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _S=q("Bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vF=q("Box",[["path",{d:"M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z",key:"hh9hay"}],["path",{d:"m3.3 7 8.7 5 8.7-5",key:"g66t2b"}],["path",{d:"M12 22V12",key:"d0xqtd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _F=q("Boxes",[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const W_=q("Braces",[["path",{d:"M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1",key:"ezmyqa"}],["path",{d:"M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1",key:"e1hn23"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bF=q("Brackets",[["path",{d:"M16 3h3v18h-3",key:"1yor1f"}],["path",{d:"M8 21H5V3h3",key:"1qrfwo"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wF=q("BrainCircuit",[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M9 13a4.5 4.5 0 0 0 3-4",key:"10igwf"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M12 13h4",key:"1ku699"}],["path",{d:"M12 18h6a2 2 0 0 1 2 2v1",key:"105ag5"}],["path",{d:"M12 8h8",key:"1lhi5i"}],["path",{d:"M16 8V5a2 2 0 0 1 2-2",key:"u6izg6"}],["circle",{cx:"16",cy:"13",r:".5",key:"ry7gng"}],["circle",{cx:"18",cy:"3",r:".5",key:"1aiba7"}],["circle",{cx:"20",cy:"21",r:".5",key:"yhc1fs"}],["circle",{cx:"20",cy:"8",r:".5",key:"1e43v0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jF=q("BrainCog",[["path",{d:"M12 5a3 3 0 1 0-5.997.142 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588 4 4 0 0 0 7.636 2.106 3.2 3.2 0 0 0 .164-.546c.028-.13.306-.13.335 0a3.2 3.2 0 0 0 .163.546 4 4 0 0 0 7.636-2.106 4 4 0 0 0 .556-6.588 4 4 0 0 0-2.526-5.77A3 3 0 1 0 12 5",key:"1kgmhc"}],["path",{d:"M17.599 6.5a3 3 0 0 0 .399-1.375",key:"tmeiqw"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M19.938 10.5a4 4 0 0 1 .585.396",key:"1qfode"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M19.967 17.484A4 4 0 0 1 18 18",key:"159ez6"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["path",{d:"m15.7 10.4-.9.4",key:"ayzo6p"}],["path",{d:"m9.2 13.2-.9.4",key:"1uzb3g"}],["path",{d:"m13.6 15.7-.4-.9",key:"11ifqf"}],["path",{d:"m10.8 9.2-.4-.9",key:"1pmk2v"}],["path",{d:"m15.7 13.5-.9-.4",key:"7ng02m"}],["path",{d:"m9.2 10.9-.9-.4",key:"1x66zd"}],["path",{d:"m10.5 15.7.4-.9",key:"3js94g"}],["path",{d:"m13.1 9.2.4-.9",key:"18n7mc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const eA=q("Brain",[["path",{d:"M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z",key:"l5xja"}],["path",{d:"M12 5a3 3 0 1 1 5.997.125 4 4 0 0 1 2.526 5.77 4 4 0 0 1-.556 6.588A4 4 0 1 1 12 18Z",key:"ep3f8r"}],["path",{d:"M15 13a4.5 4.5 0 0 1-3-4 4.5 4.5 0 0 1-3 4",key:"1p4c4q"}],["path",{d:"M17.599 6.5a3 3 0 0 0 .399-1.375",key:"tmeiqw"}],["path",{d:"M6.003 5.125A3 3 0 0 0 6.401 6.5",key:"105sqy"}],["path",{d:"M3.477 10.896a4 4 0 0 1 .585-.396",key:"ql3yin"}],["path",{d:"M19.938 10.5a4 4 0 0 1 .585.396",key:"1qfode"}],["path",{d:"M6 18a4 4 0 0 1-1.967-.516",key:"2e4loj"}],["path",{d:"M19.967 17.484A4 4 0 0 1 18 18",key:"159ez6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kF=q("BrickWall",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 9v6",key:"199k2o"}],["path",{d:"M16 15v6",key:"8rj2es"}],["path",{d:"M16 3v6",key:"1j6rpj"}],["path",{d:"M3 15h18",key:"5xshup"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M8 15v6",key:"1stoo3"}],["path",{d:"M8 3v6",key:"vlvjmk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const NF=q("BriefcaseBusiness",[["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M16 6V4a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v2",key:"1ksdt3"}],["path",{d:"M22 13a18.15 18.15 0 0 1-20 0",key:"12hx5q"}],["rect",{width:"20",height:"14",x:"2",y:"6",rx:"2",key:"i6l2r4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const SF=q("BriefcaseConveyorBelt",[["path",{d:"M10 20v2",key:"1n8e1g"}],["path",{d:"M14 20v2",key:"1lq872"}],["path",{d:"M18 20v2",key:"10uadw"}],["path",{d:"M21 20H3",key:"kdqkdp"}],["path",{d:"M6 20v2",key:"a9bc87"}],["path",{d:"M8 16V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v12",key:"17n9tx"}],["rect",{x:"4",y:"6",width:"16",height:"10",rx:"2",key:"1097i5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const CF=q("BriefcaseMedical",[["path",{d:"M12 11v4",key:"a6ujw6"}],["path",{d:"M14 13h-4",key:"1pl8zg"}],["path",{d:"M16 6V4a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v2",key:"1ksdt3"}],["path",{d:"M18 6v14",key:"1mu4gy"}],["path",{d:"M6 6v14",key:"1s15cj"}],["rect",{width:"20",height:"14",x:"2",y:"6",rx:"2",key:"i6l2r4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ah=q("Briefcase",[["path",{d:"M16 20V4a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v16",key:"jecpp"}],["rect",{width:"20",height:"14",x:"2",y:"6",rx:"2",key:"i6l2r4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const MF=q("BringToFront",[["rect",{x:"8",y:"8",width:"8",height:"8",rx:"2",key:"yj20xf"}],["path",{d:"M4 10a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2",key:"1ltk23"}],["path",{d:"M14 20a2 2 0 0 0 2 2h4a2 2 0 0 0 2-2v-4a2 2 0 0 0-2-2",key:"1q24h9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const TF=q("Brush",[["path",{d:"m9.06 11.9 8.07-8.06a2.85 2.85 0 1 1 4.03 4.03l-8.06 8.08",key:"1styjt"}],["path",{d:"M7.07 14.94c-1.66 0-3 1.35-3 3.02 0 1.33-2.5 1.52-2 2.02 1.08 1.1 2.49 2.02 4 2.02 2.2 0 4-1.8 4-4.04a3.01 3.01 0 0 0-3-3.02z",key:"z0l1mu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const AF=q("BugOff",[["path",{d:"M15 7.13V6a3 3 0 0 0-5.14-2.1L8 2",key:"vl8zik"}],["path",{d:"M14.12 3.88 16 2",key:"qol33r"}],["path",{d:"M22 13h-4v-2a4 4 0 0 0-4-4h-1.3",key:"1ou0bd"}],["path",{d:"M20.97 5c0 2.1-1.6 3.8-3.5 4",key:"18gb23"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M7.7 7.7A4 4 0 0 0 6 11v3a6 6 0 0 0 11.13 3.13",key:"1njkjs"}],["path",{d:"M12 20v-8",key:"i3yub9"}],["path",{d:"M6 13H2",key:"82j7cp"}],["path",{d:"M3 21c0-2.1 1.7-3.9 3.8-4",key:"4p0ekp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const EF=q("BugPlay",[["path",{d:"M12.765 21.522a.5.5 0 0 1-.765-.424v-8.196a.5.5 0 0 1 .765-.424l5.878 3.674a1 1 0 0 1 0 1.696z",key:"17shqo"}],["path",{d:"M14.12 3.88 16 2",key:"qol33r"}],["path",{d:"M18 11a4 4 0 0 0-4-4h-4a4 4 0 0 0-4 4v3a6.1 6.1 0 0 0 2 4.5",key:"1tjixy"}],["path",{d:"M20.97 5c0 2.1-1.6 3.8-3.5 4",key:"18gb23"}],["path",{d:"M3 21c0-2.1 1.7-3.9 3.8-4",key:"4p0ekp"}],["path",{d:"M6 13H2",key:"82j7cp"}],["path",{d:"M6.53 9C4.6 8.8 3 7.1 3 5",key:"32zzws"}],["path",{d:"m8 2 1.88 1.88",key:"fmnt4t"}],["path",{d:"M9 7.13v-1a3.003 3.003 0 1 1 6 0v1",key:"d7y7pr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const IF=q("Bug",[["path",{d:"m8 2 1.88 1.88",key:"fmnt4t"}],["path",{d:"M14.12 3.88 16 2",key:"qol33r"}],["path",{d:"M9 7.13v-1a3.003 3.003 0 1 1 6 0v1",key:"d7y7pr"}],["path",{d:"M12 20c-3.3 0-6-2.7-6-6v-3a4 4 0 0 1 4-4h4a4 4 0 0 1 4 4v3c0 3.3-2.7 6-6 6",key:"xs1cw7"}],["path",{d:"M12 20v-9",key:"1qisl0"}],["path",{d:"M6.53 9C4.6 8.8 3 7.1 3 5",key:"32zzws"}],["path",{d:"M6 13H2",key:"82j7cp"}],["path",{d:"M3 21c0-2.1 1.7-3.9 3.8-4",key:"4p0ekp"}],["path",{d:"M20.97 5c0 2.1-1.6 3.8-3.5 4",key:"18gb23"}],["path",{d:"M22 13h-4",key:"1jl80f"}],["path",{d:"M17.2 17c2.1.1 3.8 1.9 3.8 4",key:"k3fwyw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hi=q("Building2",[["path",{d:"M6 22V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v18Z",key:"1b4qmf"}],["path",{d:"M6 12H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h2",key:"i71pzd"}],["path",{d:"M18 9h2a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2h-2",key:"10jefs"}],["path",{d:"M10 6h4",key:"1itunk"}],["path",{d:"M10 10h4",key:"tcdvrf"}],["path",{d:"M10 14h4",key:"kelpxr"}],["path",{d:"M10 18h4",key:"1ulq68"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Cj=q("Building",[["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",ry:"2",key:"76otgf"}],["path",{d:"M9 22v-4h6v4",key:"r93iot"}],["path",{d:"M8 6h.01",key:"1dz90k"}],["path",{d:"M16 6h.01",key:"1x0f13"}],["path",{d:"M12 6h.01",key:"1vi96p"}],["path",{d:"M12 10h.01",key:"1nrarc"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M16 10h.01",key:"1m94wz"}],["path",{d:"M16 14h.01",key:"1gbofw"}],["path",{d:"M8 10h.01",key:"19clt8"}],["path",{d:"M8 14h.01",key:"6423bh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const PF=q("BusFront",[["path",{d:"M4 6 2 7",key:"1mqr15"}],["path",{d:"M10 6h4",key:"1itunk"}],["path",{d:"m22 7-2-1",key:"1umjhc"}],["rect",{width:"16",height:"16",x:"4",y:"3",rx:"2",key:"1wxw4b"}],["path",{d:"M4 11h16",key:"mpoxn0"}],["path",{d:"M8 15h.01",key:"a7atzg"}],["path",{d:"M16 15h.01",key:"rnfrdf"}],["path",{d:"M6 19v2",key:"1loha6"}],["path",{d:"M18 21v-2",key:"sqyl04"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const LF=q("Bus",[["path",{d:"M8 6v6",key:"18i7km"}],["path",{d:"M15 6v6",key:"1sg6z9"}],["path",{d:"M2 12h19.6",key:"de5uta"}],["path",{d:"M18 18h3s.5-1.7.8-2.8c.1-.4.2-.8.2-1.2 0-.4-.1-.8-.2-1.2l-1.4-5C20.1 6.8 19.1 6 18 6H4a2 2 0 0 0-2 2v10h3",key:"1wwztk"}],["circle",{cx:"7",cy:"18",r:"2",key:"19iecd"}],["path",{d:"M9 18h5",key:"lrx6i"}],["circle",{cx:"16",cy:"18",r:"2",key:"1v4tcr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const OF=q("CableCar",[["path",{d:"M10 3h.01",key:"lbucoy"}],["path",{d:"M14 2h.01",key:"1k8aa1"}],["path",{d:"m2 9 20-5",key:"1kz0j5"}],["path",{d:"M12 12V6.5",key:"1vbrij"}],["rect",{width:"16",height:"10",x:"4",y:"12",rx:"3",key:"if91er"}],["path",{d:"M9 12v5",key:"3anwtq"}],["path",{d:"M15 12v5",key:"5xh3zn"}],["path",{d:"M4 17h16",key:"g4d7ey"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const DF=q("Cable",[["path",{d:"M17 21v-2a1 1 0 0 1-1-1v-1a2 2 0 0 1 2-2h2a2 2 0 0 1 2 2v1a1 1 0 0 1-1 1",key:"10bnsj"}],["path",{d:"M19 15V6.5a1 1 0 0 0-7 0v11a1 1 0 0 1-7 0V9",key:"1eqmu1"}],["path",{d:"M21 21v-2h-4",key:"14zm7j"}],["path",{d:"M3 5h4V3",key:"z442eg"}],["path",{d:"M7 5a1 1 0 0 1 1 1v1a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V6a1 1 0 0 1 1-1V3",key:"ebdjd7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const RF=q("CakeSlice",[["circle",{cx:"9",cy:"7",r:"2",key:"1305pl"}],["path",{d:"M7.2 7.9 3 11v9c0 .6.4 1 1 1h16c.6 0 1-.4 1-1v-9c0-2-3-6-7-8l-3.6 2.6",key:"xle13f"}],["path",{d:"M16 13H3",key:"1wpj08"}],["path",{d:"M16 17H3",key:"3lvfcd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hf=q("Cake",[["path",{d:"M20 21v-8a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v8",key:"1w3rig"}],["path",{d:"M4 16s.5-1 2-1 2.5 2 4 2 2.5-2 4-2 2.5 2 4 2 2-1 2-1",key:"n2jgmb"}],["path",{d:"M2 21h20",key:"1nyx9w"}],["path",{d:"M7 8v3",key:"1qtyvj"}],["path",{d:"M12 8v3",key:"hwp4zt"}],["path",{d:"M17 8v3",key:"1i6e5u"}],["path",{d:"M7 4h.01",key:"1bh4kh"}],["path",{d:"M12 4h.01",key:"1ujb9j"}],["path",{d:"M17 4h.01",key:"1upcoc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const FF=q("Calculator",[["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",key:"1nb95v"}],["line",{x1:"8",x2:"16",y1:"6",y2:"6",key:"x4nwl0"}],["line",{x1:"16",x2:"16",y1:"14",y2:"18",key:"wjye3r"}],["path",{d:"M16 10h.01",key:"1m94wz"}],["path",{d:"M12 10h.01",key:"1nrarc"}],["path",{d:"M8 10h.01",key:"19clt8"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M8 14h.01",key:"6423bh"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M8 18h.01",key:"lrp35t"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zF=q("Calendar1",[["path",{d:"M11 14h1v4",key:"fy54vd"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 2v4",key:"1cmpym"}],["rect",{x:"3",y:"4",width:"18",height:"18",rx:"2",key:"12vinp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const BF=q("CalendarArrowDown",[["path",{d:"m14 18 4 4 4-4",key:"1waygx"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M18 14v8",key:"irew45"}],["path",{d:"M21 11.354V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h7.343",key:"bse4f3"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 2v4",key:"1cmpym"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $F=q("CalendarArrowUp",[["path",{d:"m14 18 4-4 4 4",key:"ftkppy"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M18 22v-8",key:"su0gjh"}],["path",{d:"M21 11.343V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h9",key:"1exg90"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 2v4",key:"1cmpym"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const UF=q("CalendarCheck2",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M21 14V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h8",key:"bce9hv"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"m16 20 2 2 4-4",key:"13tcca"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qF=q("CalendarCheck",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"m9 16 2 2 4-4",key:"19s6y9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tA=q("CalendarClock",[["path",{d:"M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5",key:"1osxxc"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M3 10h5",key:"r794hk"}],["path",{d:"M17.5 17.5 16 16.3V14",key:"akvzfd"}],["circle",{cx:"16",cy:"16",r:"6",key:"qoo3c4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const VF=q("CalendarCog",[["path",{d:"m15.2 16.9-.9-.4",key:"1r0w5f"}],["path",{d:"m15.2 19.1-.9.4",key:"j188fs"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"m16.9 15.2-.4-.9",key:"699xu"}],["path",{d:"m16.9 20.8-.4.9",key:"dfjc4z"}],["path",{d:"m19.5 14.3-.4.9",key:"1eb35c"}],["path",{d:"m19.5 21.7-.4-.9",key:"1tonu5"}],["path",{d:"M21 10.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h6",key:"11kmuh"}],["path",{d:"m21.7 16.5-.9.4",key:"1knoei"}],["path",{d:"m21.7 19.5-.9-.4",key:"q4dx6b"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 2v4",key:"1cmpym"}],["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Cm=q("CalendarDays",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 14h.01",key:"6423bh"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M16 14h.01",key:"1gbofw"}],["path",{d:"M8 18h.01",key:"lrp35t"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M16 18h.01",key:"kzsmim"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const HF=q("CalendarFold",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M21 17V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h11Z",key:"kg77oy"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M15 22v-4a2 2 0 0 1 2-2h4",key:"1gnbqr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const WF=q("CalendarHeart",[["path",{d:"M3 10h18V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h7",key:"136lmk"}],["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M21.29 14.7a2.43 2.43 0 0 0-2.65-.52c-.3.12-.57.3-.8.53l-.34.34-.35-.34a2.43 2.43 0 0 0-2.65-.53c-.3.12-.56.3-.79.53-.95.94-1 2.53.2 3.74L17.5 22l3.6-3.55c1.2-1.21 1.14-2.8.19-3.74Z",key:"1t7hil"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const GF=q("CalendarMinus2",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M10 16h4",key:"17e571"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const KF=q("CalendarMinus",[["path",{d:"M16 19h6",key:"xwg31i"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M21 15V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h8.5",key:"1scpom"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 2v4",key:"1cmpym"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ZF=q("CalendarOff",[["path",{d:"M4.2 4.2A2 2 0 0 0 3 6v14a2 2 0 0 0 2 2h14a2 2 0 0 0 1.82-1.18",key:"16swn3"}],["path",{d:"M21 15.5V6a2 2 0 0 0-2-2H9.5",key:"yhw86o"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M3 10h7",key:"1wap6i"}],["path",{d:"M21 10h-5.5",key:"quycpq"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const YF=q("CalendarPlus2",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M10 16h4",key:"17e571"}],["path",{d:"M12 14v4",key:"1thi36"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Mj=q("CalendarPlus",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M21 13V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h8",key:"3spt84"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M16 19h6",key:"xwg31i"}],["path",{d:"M19 16v6",key:"tddt3s"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const XF=q("CalendarRange",[["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M17 14h-6",key:"bkmgh3"}],["path",{d:"M13 18H7",key:"bb0bb7"}],["path",{d:"M7 14h.01",key:"1qa3f1"}],["path",{d:"M17 18h.01",key:"1bdyru"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const QF=q("CalendarSearch",[["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M21 11.75V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h7.25",key:"1jrsq6"}],["path",{d:"m22 22-1.875-1.875",key:"13zax7"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 2v4",key:"1cmpym"}],["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const JF=q("CalendarSync",[["path",{d:"M11 10v4h4",key:"172dkj"}],["path",{d:"m11 14 1.535-1.605a5 5 0 0 1 8 1.5",key:"vu0qm5"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"m21 18-1.535 1.605a5 5 0 0 1-8-1.5",key:"1qgeyt"}],["path",{d:"M21 22v-4h-4",key:"hrummi"}],["path",{d:"M21 8.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h4.3",key:"mctw84"}],["path",{d:"M3 10h4",key:"1el30a"}],["path",{d:"M8 2v4",key:"1cmpym"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ez=q("CalendarX2",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M21 13V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h8",key:"3spt84"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"m17 22 5-5",key:"1k6ppv"}],["path",{d:"m17 17 5 5",key:"p7ous7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tz=q("CalendarX",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"m14 14-4 4",key:"rymu2i"}],["path",{d:"m10 14 4 4",key:"3sz06r"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ss=q("Calendar",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rz=q("CameraOff",[["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}],["path",{d:"M7 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16",key:"qmtpty"}],["path",{d:"M9.5 4h5L17 7h3a2 2 0 0 1 2 2v7.5",key:"1ufyfc"}],["path",{d:"M14.121 15.121A3 3 0 1 1 9.88 10.88",key:"11zox6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Og=q("Camera",[["path",{d:"M14.5 4h-5L7 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3l-2.5-3z",key:"1tc9qg"}],["circle",{cx:"12",cy:"13",r:"3",key:"1vg3eu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nz=q("CandyCane",[["path",{d:"M5.7 21a2 2 0 0 1-3.5-2l8.6-14a6 6 0 0 1 10.4 6 2 2 0 1 1-3.464-2 2 2 0 1 0-3.464-2Z",key:"isaq8g"}],["path",{d:"M17.75 7 15 2.1",key:"12x7e8"}],["path",{d:"M10.9 4.8 13 9",key:"100a87"}],["path",{d:"m7.9 9.7 2 4.4",key:"ntfhaj"}],["path",{d:"M4.9 14.7 7 18.9",key:"1x43jy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sz=q("CandyOff",[["path",{d:"m8.5 8.5-1 1a4.95 4.95 0 0 0 7 7l1-1",key:"1ff4ui"}],["path",{d:"M11.843 6.187A4.947 4.947 0 0 1 16.5 7.5a4.947 4.947 0 0 1 1.313 4.657",key:"1sbrv4"}],["path",{d:"M14 16.5V14",key:"1maf8j"}],["path",{d:"M14 6.5v1.843",key:"1a6u6t"}],["path",{d:"M10 10v7.5",key:"80pj65"}],["path",{d:"m16 7 1-5 1.367.683A3 3 0 0 0 19.708 3H21v1.292a3 3 0 0 0 .317 1.341L22 7l-5 1",key:"11a9mt"}],["path",{d:"m8 17-1 5-1.367-.683A3 3 0 0 0 4.292 21H3v-1.292a3 3 0 0 0-.317-1.341L2 17l5-1",key:"3mjmon"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const az=q("Candy",[["path",{d:"m9.5 7.5-2 2a4.95 4.95 0 1 0 7 7l2-2a4.95 4.95 0 1 0-7-7Z",key:"ue6khb"}],["path",{d:"M14 6.5v10",key:"5xnk7c"}],["path",{d:"M10 7.5v10",key:"1uew51"}],["path",{d:"m16 7 1-5 1.37.68A3 3 0 0 0 19.7 3H21v1.3c0 .46.1.92.32 1.33L22 7l-5 1",key:"b9cp6k"}],["path",{d:"m8 17-1 5-1.37-.68A3 3 0 0 0 4.3 21H3v-1.3a3 3 0 0 0-.32-1.33L2 17l5-1",key:"5lney8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const iz=q("Cannabis",[["path",{d:"M12 22v-4",key:"1utk9m"}],["path",{d:"M7 12c-1.5 0-4.5 1.5-5 3 3.5 1.5 6 1 6 1-1.5 1.5-2 3.5-2 5 2.5 0 4.5-1.5 6-3 1.5 1.5 3.5 3 6 3 0-1.5-.5-3.5-2-5 0 0 2.5.5 6-1-.5-1.5-3.5-3-5-3 1.5-1 4-4 4-6-2.5 0-5.5 1.5-7 3 0-2.5-.5-5-2-7-1.5 2-2 4.5-2 7-1.5-1.5-4.5-3-7-3 0 2 2.5 5 4 6",key:"1mezod"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oz=q("CaptionsOff",[["path",{d:"M10.5 5H19a2 2 0 0 1 2 2v8.5",key:"jqtk4d"}],["path",{d:"M17 11h-.5",key:"1961ue"}],["path",{d:"M19 19H5a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2",key:"1keqsi"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M7 11h4",key:"1o1z6v"}],["path",{d:"M7 15h2.5",key:"1ina1g"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const G_=q("Captions",[["rect",{width:"18",height:"14",x:"3",y:"5",rx:"2",ry:"2",key:"12ruh7"}],["path",{d:"M7 15h4M15 15h2M7 11h2M13 11h4",key:"1ueiar"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lz=q("CarFront",[["path",{d:"m21 8-2 2-1.5-3.7A2 2 0 0 0 15.646 5H8.4a2 2 0 0 0-1.903 1.257L5 10 3 8",key:"1imjwt"}],["path",{d:"M7 14h.01",key:"1qa3f1"}],["path",{d:"M17 14h.01",key:"7oqj8z"}],["rect",{width:"18",height:"8",x:"3",y:"10",rx:"2",key:"a7itu8"}],["path",{d:"M5 18v2",key:"ppbyun"}],["path",{d:"M19 18v2",key:"gy7782"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cz=q("CarTaxiFront",[["path",{d:"M10 2h4",key:"n1abiw"}],["path",{d:"m21 8-2 2-1.5-3.7A2 2 0 0 0 15.646 5H8.4a2 2 0 0 0-1.903 1.257L5 10 3 8",key:"1imjwt"}],["path",{d:"M7 14h.01",key:"1qa3f1"}],["path",{d:"M17 14h.01",key:"7oqj8z"}],["rect",{width:"18",height:"8",x:"3",y:"10",rx:"2",key:"a7itu8"}],["path",{d:"M5 18v2",key:"ppbyun"}],["path",{d:"M19 18v2",key:"gy7782"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dz=q("Car",[["path",{d:"M19 17h2c.6 0 1-.4 1-1v-3c0-.9-.7-1.7-1.5-1.9C18.7 10.6 16 10 16 10s-1.3-1.4-2.2-2.3c-.5-.4-1.1-.7-1.8-.7H5c-.6 0-1.1.4-1.4.9l-1.4 2.9A3.7 3.7 0 0 0 2 12v4c0 .6.4 1 1 1h2",key:"5owen"}],["circle",{cx:"7",cy:"17",r:"2",key:"u2ysq9"}],["path",{d:"M9 17h6",key:"r8uit2"}],["circle",{cx:"17",cy:"17",r:"2",key:"axvx0g"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uz=q("Caravan",[["path",{d:"M18 19V9a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v8a2 2 0 0 0 2 2h2",key:"19jm3t"}],["path",{d:"M2 9h3a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1H2",key:"13hakp"}],["path",{d:"M22 17v1a1 1 0 0 1-1 1H10v-9a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v9",key:"1crci8"}],["circle",{cx:"8",cy:"19",r:"2",key:"t8fc5s"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hz=q("Carrot",[["path",{d:"M2.27 21.7s9.87-3.5 12.73-6.36a4.5 4.5 0 0 0-6.36-6.37C5.77 11.84 2.27 21.7 2.27 21.7zM8.64 14l-2.05-2.04M15.34 15l-2.46-2.46",key:"rfqxbe"}],["path",{d:"M22 9s-1.33-2-3.5-2C16.86 7 15 9 15 9s1.33 2 3.5 2S22 9 22 9z",key:"6b25w4"}],["path",{d:"M15 2s-2 1.33-2 3.5S15 9 15 9s2-1.84 2-3.5C17 3.33 15 2 15 2z",key:"fn65lo"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fz=q("CaseLower",[["circle",{cx:"7",cy:"12",r:"3",key:"12clwm"}],["path",{d:"M10 9v6",key:"17i7lo"}],["circle",{cx:"17",cy:"12",r:"3",key:"gl7c2s"}],["path",{d:"M14 7v8",key:"dl84cr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pz=q("CaseSensitive",[["path",{d:"m3 15 4-8 4 8",key:"1vwr6u"}],["path",{d:"M4 13h6",key:"1r9ots"}],["circle",{cx:"18",cy:"12",r:"3",key:"1kchzo"}],["path",{d:"M21 9v6",key:"anns31"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mz=q("CaseUpper",[["path",{d:"m3 15 4-8 4 8",key:"1vwr6u"}],["path",{d:"M4 13h6",key:"1r9ots"}],["path",{d:"M15 11h4.5a2 2 0 0 1 0 4H15V7h4a2 2 0 0 1 0 4",key:"1sqfas"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gz=q("CassetteTape",[["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["circle",{cx:"8",cy:"10",r:"2",key:"1xl4ub"}],["path",{d:"M8 12h8",key:"1wcyev"}],["circle",{cx:"16",cy:"10",r:"2",key:"r14t7q"}],["path",{d:"m6 20 .7-2.9A1.4 1.4 0 0 1 8.1 16h7.8a1.4 1.4 0 0 1 1.4 1l.7 3",key:"l01ucn"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xz=q("Cast",[["path",{d:"M2 8V6a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2h-6",key:"3zrzxg"}],["path",{d:"M2 12a9 9 0 0 1 8 8",key:"g6cvee"}],["path",{d:"M2 16a5 5 0 0 1 4 4",key:"1y1dii"}],["line",{x1:"2",x2:"2.01",y1:"20",y2:"20",key:"xu2jvo"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yz=q("Castle",[["path",{d:"M22 20v-9H2v9a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2Z",key:"109fe4"}],["path",{d:"M18 11V4H6v7",key:"mon5oj"}],["path",{d:"M15 22v-4a3 3 0 0 0-3-3a3 3 0 0 0-3 3v4",key:"1k4jtn"}],["path",{d:"M22 11V9",key:"3zbp94"}],["path",{d:"M2 11V9",key:"1x5rnq"}],["path",{d:"M6 4V2",key:"1rsq15"}],["path",{d:"M18 4V2",key:"1jsdo1"}],["path",{d:"M10 4V2",key:"75d9ly"}],["path",{d:"M14 4V2",key:"8nj3z6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vz=q("Cat",[["path",{d:"M12 5c.67 0 1.35.09 2 .26 1.78-2 5.03-2.84 6.42-2.26 1.4.58-.42 7-.42 7 .57 1.07 1 2.24 1 3.44C21 17.9 16.97 21 12 21s-9-3-9-7.56c0-1.25.5-2.4 1-3.44 0 0-1.89-6.42-.5-7 1.39-.58 4.72.23 6.5 2.23A9.04 9.04 0 0 1 12 5Z",key:"x6xyqk"}],["path",{d:"M8 14v.5",key:"1nzgdb"}],["path",{d:"M16 14v.5",key:"1lajdz"}],["path",{d:"M11.25 16.25h1.5L12 17l-.75-.75Z",key:"12kq1m"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _z=q("Cctv",[["path",{d:"M16.75 12h3.632a1 1 0 0 1 .894 1.447l-2.034 4.069a1 1 0 0 1-1.708.134l-2.124-2.97",key:"ir91b5"}],["path",{d:"M17.106 9.053a1 1 0 0 1 .447 1.341l-3.106 6.211a1 1 0 0 1-1.342.447L3.61 12.3a2.92 2.92 0 0 1-1.3-3.91L3.69 5.6a2.92 2.92 0 0 1 3.92-1.3z",key:"jlp8i1"}],["path",{d:"M2 19h3.76a2 2 0 0 0 1.8-1.1L9 15",key:"19bib8"}],["path",{d:"M2 21v-4",key:"l40lih"}],["path",{d:"M7 9h.01",key:"19b3jx"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const K_=q("ChartArea",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M7 11.207a.5.5 0 0 1 .146-.353l2-2a.5.5 0 0 1 .708 0l3.292 3.292a.5.5 0 0 0 .708 0l4.292-4.292a.5.5 0 0 1 .854.353V16a1 1 0 0 1-1 1H8a1 1 0 0 1-1-1z",key:"q0gr47"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Z_=q("ChartBarBig",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["rect",{x:"7",y:"13",width:"9",height:"4",rx:"1",key:"1iip1u"}],["rect",{x:"7",y:"5",width:"12",height:"4",rx:"1",key:"1anskk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bz=q("ChartBarDecreasing",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M7 11h8",key:"1feolt"}],["path",{d:"M7 16h3",key:"ur6vzw"}],["path",{d:"M7 6h12",key:"sz5b0d"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wz=q("ChartBarIncreasing",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M7 11h8",key:"1feolt"}],["path",{d:"M7 16h12",key:"wsnu98"}],["path",{d:"M7 6h3",key:"w9rmul"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jz=q("ChartBarStacked",[["path",{d:"M11 13v4",key:"vyy2rb"}],["path",{d:"M15 5v4",key:"1gx88a"}],["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["rect",{x:"7",y:"13",width:"9",height:"4",rx:"1",key:"1iip1u"}],["rect",{x:"7",y:"5",width:"12",height:"4",rx:"1",key:"1anskk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Y_=q("ChartBar",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M7 16h8",key:"srdodz"}],["path",{d:"M7 11h12",key:"127s9w"}],["path",{d:"M7 6h3",key:"w9rmul"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const X_=q("ChartCandlestick",[["path",{d:"M9 5v4",key:"14uxtq"}],["rect",{width:"4",height:"6",x:"7",y:"9",rx:"1",key:"f4fvz0"}],["path",{d:"M9 15v2",key:"r5rk32"}],["path",{d:"M17 3v2",key:"1l2re6"}],["rect",{width:"4",height:"8",x:"15",y:"5",rx:"1",key:"z38je5"}],["path",{d:"M17 13v3",key:"5l0wba"}],["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Q_=q("ChartColumnBig",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["rect",{x:"15",y:"5",width:"4",height:"12",rx:"1",key:"q8uenq"}],["rect",{x:"7",y:"8",width:"4",height:"9",rx:"1",key:"sr5ea"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kz=q("ChartColumnDecreasing",[["path",{d:"M13 17V9",key:"1fwyjl"}],["path",{d:"M18 17v-3",key:"1sqioe"}],["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M8 17V5",key:"1wzmnc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const J_=q("ChartColumnIncreasing",[["path",{d:"M13 17V9",key:"1fwyjl"}],["path",{d:"M18 17V5",key:"sfb6ij"}],["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M8 17v-3",key:"17ska0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Nz=q("ChartColumnStacked",[["path",{d:"M11 13H7",key:"t0o9gq"}],["path",{d:"M19 9h-4",key:"rera1j"}],["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["rect",{x:"15",y:"5",width:"4",height:"12",rx:"1",key:"q8uenq"}],["rect",{x:"7",y:"8",width:"4",height:"9",rx:"1",key:"sr5ea"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _c=q("ChartColumn",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M18 17V9",key:"2bz60n"}],["path",{d:"M13 17V5",key:"1frdt8"}],["path",{d:"M8 17v-3",key:"17ska0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Sz=q("ChartGantt",[["path",{d:"M10 6h8",key:"zvc2xc"}],["path",{d:"M12 16h6",key:"yi5mkt"}],["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M8 11h7",key:"wz2hg0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const eb=q("ChartLine",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"m19 9-5 5-4-4-3 3",key:"2osh9i"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Cz=q("ChartNetwork",[["path",{d:"m13.11 7.664 1.78 2.672",key:"go2gg9"}],["path",{d:"m14.162 12.788-3.324 1.424",key:"11x848"}],["path",{d:"m20 4-6.06 1.515",key:"1wxxh7"}],["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["circle",{cx:"12",cy:"6",r:"2",key:"1jj5th"}],["circle",{cx:"16",cy:"12",r:"2",key:"4ma0v8"}],["circle",{cx:"9",cy:"15",r:"2",key:"lf2ghp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Mz=q("ChartNoAxesColumnDecreasing",[["path",{d:"M12 20V10",key:"g8npz5"}],["path",{d:"M18 20v-4",key:"8uic4z"}],["path",{d:"M6 20V4",key:"1w1bmo"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tb=q("ChartNoAxesColumnIncreasing",[["line",{x1:"12",x2:"12",y1:"20",y2:"10",key:"1vz5eb"}],["line",{x1:"18",x2:"18",y1:"20",y2:"4",key:"cun8e5"}],["line",{x1:"6",x2:"6",y1:"20",y2:"16",key:"hq0ia6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rb=q("ChartNoAxesColumn",[["line",{x1:"18",x2:"18",y1:"20",y2:"10",key:"1xfpm4"}],["line",{x1:"12",x2:"12",y1:"20",y2:"4",key:"be30l9"}],["line",{x1:"6",x2:"6",y1:"20",y2:"14",key:"1r4le6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Tz=q("ChartNoAxesCombined",[["path",{d:"M12 16v5",key:"zza2cw"}],["path",{d:"M16 14v7",key:"1g90b9"}],["path",{d:"M20 10v11",key:"1iqoj0"}],["path",{d:"m22 3-8.646 8.646a.5.5 0 0 1-.708 0L9.354 8.354a.5.5 0 0 0-.707 0L2 15",key:"1fw8x9"}],["path",{d:"M4 18v3",key:"1yp0dc"}],["path",{d:"M8 14v7",key:"n3cwzv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nb=q("ChartNoAxesGantt",[["path",{d:"M8 6h10",key:"9lnwnk"}],["path",{d:"M6 12h9",key:"1g9pqf"}],["path",{d:"M11 18h7",key:"c8dzvl"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sb=q("ChartPie",[["path",{d:"M21 12c.552 0 1.005-.449.95-.998a10 10 0 0 0-8.953-8.951c-.55-.055-.998.398-.998.95v8a1 1 0 0 0 1 1z",key:"pzmjnu"}],["path",{d:"M21.21 15.89A10 10 0 1 1 8 2.83",key:"k2fpak"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ab=q("ChartScatter",[["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}],["circle",{cx:"18.5",cy:"5.5",r:".5",fill:"currentColor",key:"lysivs"}],["circle",{cx:"11.5",cy:"11.5",r:".5",fill:"currentColor",key:"byv1b8"}],["circle",{cx:"7.5",cy:"16.5",r:".5",fill:"currentColor",key:"nkw3mc"}],["circle",{cx:"17.5",cy:"14.5",r:".5",fill:"currentColor",key:"1gjh6j"}],["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Az=q("ChartSpline",[["path",{d:"M3 3v16a2 2 0 0 0 2 2h16",key:"c24i48"}],["path",{d:"M7 16c.5-2 1.5-7 4-7 2 0 2 3 4 3 2.5 0 4.5-5 5-7",key:"lw07rv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ez=q("CheckCheck",[["path",{d:"M18 6 7 17l-5-5",key:"116fxf"}],["path",{d:"m22 10-7.5 7.5L13 16",key:"ke71qq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ni=q("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Iz=q("ChefHat",[["path",{d:"M17 21a1 1 0 0 0 1-1v-5.35c0-.457.316-.844.727-1.041a4 4 0 0 0-2.134-7.589 5 5 0 0 0-9.186 0 4 4 0 0 0-2.134 7.588c.411.198.727.585.727 1.041V20a1 1 0 0 0 1 1Z",key:"1qvrer"}],["path",{d:"M6 17h12",key:"1jwigz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Pz=q("Cherry",[["path",{d:"M2 17a5 5 0 0 0 10 0c0-2.76-2.5-5-5-3-2.5-2-5 .24-5 3Z",key:"cvxqlc"}],["path",{d:"M12 17a5 5 0 0 0 10 0c0-2.76-2.5-5-5-3-2.5-2-5 .24-5 3Z",key:"1ostrc"}],["path",{d:"M7 14c3.22-2.91 4.29-8.75 5-12 1.66 2.38 4.94 9 5 12",key:"hqx58h"}],["path",{d:"M22 9c-4.29 0-7.14-2.33-10-7 5.71 0 10 4.67 10 7Z",key:"eykp1o"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Dd=q("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Lz=q("ChevronFirst",[["path",{d:"m17 18-6-6 6-6",key:"1yerx2"}],["path",{d:"M7 6v12",key:"1p53r6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Oz=q("ChevronLast",[["path",{d:"m7 18 6-6-6-6",key:"lwmzdw"}],["path",{d:"M17 6v12",key:"1o0aio"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kc=q("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Wi=q("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const iy=q("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Dz=q("ChevronsDownUp",[["path",{d:"m7 20 5-5 5 5",key:"13a0gw"}],["path",{d:"m7 4 5 5 5-5",key:"1kwcof"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Rz=q("ChevronsDown",[["path",{d:"m7 6 5 5 5-5",key:"1lc07p"}],["path",{d:"m7 13 5 5 5-5",key:"1d48rs"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Fz=q("ChevronsLeftRightEllipsis",[["path",{d:"m18 8 4 4-4 4",key:"1ak13k"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"M8 12h.01",key:"czm47f"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M16 12h.01",key:"1l6xoz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zz=q("ChevronsLeftRight",[["path",{d:"m9 7-5 5 5 5",key:"j5w590"}],["path",{d:"m15 7 5 5-5 5",key:"1bl6da"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Bz=q("ChevronsLeft",[["path",{d:"m11 17-5-5 5-5",key:"13zhaf"}],["path",{d:"m18 17-5-5 5-5",key:"h8a8et"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $z=q("ChevronsRightLeft",[["path",{d:"m20 17-5-5 5-5",key:"30x0n2"}],["path",{d:"m4 17 5-5-5-5",key:"16spf4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Uz=q("ChevronsRight",[["path",{d:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oy=q("ChevronsUpDown",[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qz=q("ChevronsUp",[["path",{d:"m17 11-5-5-5 5",key:"e8nh98"}],["path",{d:"m17 18-5-5-5 5",key:"2avn1x"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Vz=q("Chrome",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["line",{x1:"21.17",x2:"12",y1:"8",y2:"8",key:"a0cw5f"}],["line",{x1:"3.95",x2:"8.54",y1:"6.06",y2:"14",key:"1kftof"}],["line",{x1:"10.88",x2:"15.46",y1:"21.94",y2:"14",key:"1ymyh8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Hz=q("Church",[["path",{d:"M10 9h4",key:"u4k05v"}],["path",{d:"M12 7v5",key:"ma6bk"}],["path",{d:"M14 22v-4a2 2 0 0 0-4 0v4",key:"1pdhuj"}],["path",{d:"M18 22V5.618a1 1 0 0 0-.553-.894l-4.553-2.277a2 2 0 0 0-1.788 0L6.553 4.724A1 1 0 0 0 6 5.618V22",key:"1rkokr"}],["path",{d:"m18 7 3.447 1.724a1 1 0 0 1 .553.894V20a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9.618a1 1 0 0 1 .553-.894L6 7",key:"1w6esw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Wz=q("CigaretteOff",[["path",{d:"M12 12H3a1 1 0 0 0-1 1v2a1 1 0 0 0 1 1h13",key:"1gdiyg"}],["path",{d:"M18 8c0-2.5-2-2.5-2-5",key:"1il607"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M21 12a1 1 0 0 1 1 1v2a1 1 0 0 1-.5.866",key:"166zjj"}],["path",{d:"M22 8c0-2.5-2-2.5-2-5",key:"1gah44"}],["path",{d:"M7 12v4",key:"jqww69"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Gz=q("Cigarette",[["path",{d:"M17 12H3a1 1 0 0 0-1 1v2a1 1 0 0 0 1 1h14",key:"1mb5g1"}],["path",{d:"M18 8c0-2.5-2-2.5-2-5",key:"1il607"}],["path",{d:"M21 16a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1",key:"1yl5r7"}],["path",{d:"M22 8c0-2.5-2-2.5-2-5",key:"1gah44"}],["path",{d:"M7 12v4",key:"jqww69"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yl=q("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ib=q("CircleArrowDown",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 8v8",key:"napkw2"}],["path",{d:"m8 12 4 4 4-4",key:"k98ssh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ob=q("CircleArrowLeft",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M16 12H8",key:"1fr5h0"}],["path",{d:"m12 8-4 4 4 4",key:"15vm53"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lb=q("CircleArrowOutDownLeft",[["path",{d:"M2 12a10 10 0 1 1 10 10",key:"1yn6ov"}],["path",{d:"m2 22 10-10",key:"28ilpk"}],["path",{d:"M8 22H2v-6",key:"sulq54"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cb=q("CircleArrowOutDownRight",[["path",{d:"M12 22a10 10 0 1 1 10-10",key:"130bv5"}],["path",{d:"M22 22 12 12",key:"131aw7"}],["path",{d:"M22 16v6h-6",key:"1gvm70"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const db=q("CircleArrowOutUpLeft",[["path",{d:"M2 8V2h6",key:"hiwtdz"}],["path",{d:"m2 2 10 10",key:"1oh8rs"}],["path",{d:"M12 2A10 10 0 1 1 2 12",key:"rrk4fa"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ub=q("CircleArrowOutUpRight",[["path",{d:"M22 12A10 10 0 1 1 12 2",key:"1fm58d"}],["path",{d:"M22 2 12 12",key:"yg2myt"}],["path",{d:"M16 2h6v6",key:"zan5cs"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hb=q("CircleArrowRight",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"m12 16 4-4-4-4",key:"1i9zcv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fb=q("CircleArrowUp",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 12-4-4-4 4",key:"177agl"}],["path",{d:"M12 16V8",key:"1sbj14"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const di=q("CircleCheckBig",[["path",{d:"M21.801 10A10 10 0 1 1 17 3.335",key:"yps3ct"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const so=q("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pb=q("CircleChevronDown",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m16 10-4 4-4-4",key:"894hmk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mb=q("CircleChevronLeft",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m14 16-4-4 4-4",key:"ojs7w8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gb=q("CircleChevronRight",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m10 8 4 4-4 4",key:"1wy4r4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xb=q("CircleChevronUp",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m8 14 4-4 4 4",key:"fy2ptz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Kz=q("CircleDashed",[["path",{d:"M10.1 2.182a10 10 0 0 1 3.8 0",key:"5ilxe3"}],["path",{d:"M13.9 21.818a10 10 0 0 1-3.8 0",key:"11zvb9"}],["path",{d:"M17.609 3.721a10 10 0 0 1 2.69 2.7",key:"1iw5b2"}],["path",{d:"M2.182 13.9a10 10 0 0 1 0-3.8",key:"c0bmvh"}],["path",{d:"M20.279 17.609a10 10 0 0 1-2.7 2.69",key:"1ruxm7"}],["path",{d:"M21.818 10.1a10 10 0 0 1 0 3.8",key:"qkgqxc"}],["path",{d:"M3.721 6.391a10 10 0 0 1 2.7-2.69",key:"1mcia2"}],["path",{d:"M6.391 20.279a10 10 0 0 1-2.69-2.7",key:"1fvljs"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yb=q("CircleDivide",[["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}],["line",{x1:"12",x2:"12",y1:"16",y2:"16",key:"aqc6ln"}],["line",{x1:"12",x2:"12",y1:"8",y2:"8",key:"1mkcni"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Zz=q("CircleDollarSign",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M16 8h-6a2 2 0 1 0 0 4h4a2 2 0 1 1 0 4H8",key:"1h4pet"}],["path",{d:"M12 18V6",key:"zqpxq5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Yz=q("CircleDotDashed",[["path",{d:"M10.1 2.18a9.93 9.93 0 0 1 3.8 0",key:"1qdqn0"}],["path",{d:"M17.6 3.71a9.95 9.95 0 0 1 2.69 2.7",key:"1bq7p6"}],["path",{d:"M21.82 10.1a9.93 9.93 0 0 1 0 3.8",key:"1rlaqf"}],["path",{d:"M20.29 17.6a9.95 9.95 0 0 1-2.7 2.69",key:"1xk03u"}],["path",{d:"M13.9 21.82a9.94 9.94 0 0 1-3.8 0",key:"l7re25"}],["path",{d:"M6.4 20.29a9.95 9.95 0 0 1-2.69-2.7",key:"1v18p6"}],["path",{d:"M2.18 13.9a9.93 9.93 0 0 1 0-3.8",key:"xdo6bj"}],["path",{d:"M3.71 6.4a9.95 9.95 0 0 1 2.7-2.69",key:"1jjmaz"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Xz=q("CircleDot",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Qz=q("CircleEllipsis",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M17 12h.01",key:"1m0b6t"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M7 12h.01",key:"eqddd0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Jz=q("CircleEqual",[["path",{d:"M7 10h10",key:"1101jm"}],["path",{d:"M7 14h10",key:"1mhdw3"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const e7=q("CircleFadingArrowUp",[["path",{d:"M12 2a10 10 0 0 1 7.38 16.75",key:"175t95"}],["path",{d:"m16 12-4-4-4 4",key:"177agl"}],["path",{d:"M12 16V8",key:"1sbj14"}],["path",{d:"M2.5 8.875a10 10 0 0 0-.5 3",key:"1vce0s"}],["path",{d:"M2.83 16a10 10 0 0 0 2.43 3.4",key:"o3fkw4"}],["path",{d:"M4.636 5.235a10 10 0 0 1 .891-.857",key:"1szpfk"}],["path",{d:"M8.644 21.42a10 10 0 0 0 7.631-.38",key:"9yhvd4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const t7=q("CircleFadingPlus",[["path",{d:"M12 2a10 10 0 0 1 7.38 16.75",key:"175t95"}],["path",{d:"M12 8v8",key:"napkw2"}],["path",{d:"M16 12H8",key:"1fr5h0"}],["path",{d:"M2.5 8.875a10 10 0 0 0-.5 3",key:"1vce0s"}],["path",{d:"M2.83 16a10 10 0 0 0 2.43 3.4",key:"o3fkw4"}],["path",{d:"M4.636 5.235a10 10 0 0 1 .891-.857",key:"1szpfk"}],["path",{d:"M8.644 21.42a10 10 0 0 0 7.631-.38",key:"9yhvd4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vb=q("CircleGauge",[["path",{d:"M15.6 2.7a10 10 0 1 0 5.7 5.7",key:"1e0p6d"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["path",{d:"M13.4 10.6 19 5",key:"1kr7tw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Hx=q("CircleHelp",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _b=q("CircleMinus",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const r7=q("CircleOff",[["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M8.35 2.69A10 10 0 0 1 21.3 15.65",key:"1pfsoa"}],["path",{d:"M19.08 19.08A10 10 0 1 1 4.92 4.92",key:"1ablyi"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bb=q("CircleParkingOff",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m5 5 14 14",key:"11anup"}],["path",{d:"M13 13a3 3 0 1 0 0-6H9v2",key:"uoagbd"}],["path",{d:"M9 17v-2.34",key:"a9qo08"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wb=q("CircleParking",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9 17V7h4a3 3 0 0 1 0 6H9",key:"1dfk2c"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jb=q("CirclePause",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"10",x2:"10",y1:"15",y2:"9",key:"c1nkhi"}],["line",{x1:"14",x2:"14",y1:"15",y2:"9",key:"h65svq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kb=q("CirclePercent",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"M9 9h.01",key:"1q5me6"}],["path",{d:"M15 15h.01",key:"lqbp3k"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rp=q("CirclePlay",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polygon",{points:"10 8 16 12 10 16 10 8",key:"1cimsy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Nb=q("CirclePlus",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Sb=q("CirclePower",[["path",{d:"M12 7v4",key:"xawao1"}],["path",{d:"M7.998 9.003a5 5 0 1 0 8-.005",key:"1pek45"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Cb=q("CircleSlash2",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M22 2 2 22",key:"y4kqgn"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const n7=q("CircleSlash",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"9",x2:"15",y1:"15",y2:"9",key:"1dfufj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Mb=q("CircleStop",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["rect",{x:"9",y:"9",width:"6",height:"6",rx:"1",key:"1ssd4o"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Tb=q("CircleUserRound",[["path",{d:"M18 20a6 6 0 0 0-12 0",key:"1qehca"}],["circle",{cx:"12",cy:"10",r:"4",key:"1h16sb"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ab=q("CircleUser",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}],["path",{d:"M7 20.662V19a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v1.662",key:"154egf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bc=q("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Qu=q("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const s7=q("CircuitBoard",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M11 9h4a2 2 0 0 0 2-2V3",key:"1ve2rv"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"M7 21v-4a2 2 0 0 1 2-2h4",key:"1fwkro"}],["circle",{cx:"15",cy:"15",r:"2",key:"3i40o0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const a7=q("Citrus",[["path",{d:"M21.66 17.67a1.08 1.08 0 0 1-.04 1.6A12 12 0 0 1 4.73 2.38a1.1 1.1 0 0 1 1.61-.04z",key:"4ite01"}],["path",{d:"M19.65 15.66A8 8 0 0 1 8.35 4.34",key:"1gxipu"}],["path",{d:"m14 10-5.5 5.5",key:"92pfem"}],["path",{d:"M14 17.85V10H6.15",key:"xqmtsk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const i7=q("Clapperboard",[["path",{d:"M20.2 6 3 11l-.9-2.4c-.3-1.1.3-2.2 1.3-2.5l13.5-4c1.1-.3 2.2.3 2.5 1.3Z",key:"1tn4o7"}],["path",{d:"m6.2 5.3 3.1 3.9",key:"iuk76l"}],["path",{d:"m12.4 3.4 3.1 4",key:"6hsd6n"}],["path",{d:"M3 11h18v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2Z",key:"ltgou9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rA=q("ClipboardCheck",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"m9 14 2 2 4-4",key:"df797q"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const o7=q("ClipboardCopy",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2",key:"4jdomd"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v4",key:"3hqy98"}],["path",{d:"M21 14H11",key:"1bme5i"}],["path",{d:"m15 10-4 4 4 4",key:"5dvupr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nA=q("ClipboardList",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"M12 11h4",key:"1jrz19"}],["path",{d:"M12 16h4",key:"n85exb"}],["path",{d:"M8 11h.01",key:"1dfujw"}],["path",{d:"M8 16h.01",key:"18s6g9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const l7=q("ClipboardMinus",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"M9 14h6",key:"159ibu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const c7=q("ClipboardPaste",[["path",{d:"M15 2H9a1 1 0 0 0-1 1v2c0 .6.4 1 1 1h6c.6 0 1-.4 1-1V3c0-.6-.4-1-1-1Z",key:"1pp7kr"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2M16 4h2a2 2 0 0 1 2 2v2M11 14h10",key:"2ik1ml"}],["path",{d:"m17 10 4 4-4 4",key:"vp2hj1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Eb=q("ClipboardPenLine",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",key:"1oijnt"}],["path",{d:"M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-.5",key:"1but9f"}],["path",{d:"M16 4h2a2 2 0 0 1 1.73 1",key:"1p8n7l"}],["path",{d:"M8 18h1",key:"13wk12"}],["path",{d:"M21.378 12.626a1 1 0 0 0-3.004-3.004l-4.01 4.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z",key:"2t3380"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ib=q("ClipboardPen",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",key:"1oijnt"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-5.5",key:"cereej"}],["path",{d:"M4 13.5V6a2 2 0 0 1 2-2h2",key:"5ua5vh"}],["path",{d:"M13.378 15.626a1 1 0 1 0-3.004-3.004l-5.01 5.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z",key:"1y4qbx"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const d7=q("ClipboardPlus",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"M9 14h6",key:"159ibu"}],["path",{d:"M12 17v-6",key:"1y8rbf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const u7=q("ClipboardType",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"M9 12v-1h6v1",key:"iehl6m"}],["path",{d:"M11 17h2",key:"12w5me"}],["path",{d:"M12 11v6",key:"1bwqyc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const h7=q("ClipboardX",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"m15 11-6 6",key:"1toa9n"}],["path",{d:"m9 11 6 6",key:"wlibny"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const f7=q("Clipboard",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const p7=q("Clock1",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 14.5 8",key:"12zbmj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const m7=q("Clock10",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 8 10",key:"atfzqc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const g7=q("Clock11",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 9.5 8",key:"l5bg6f"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const x7=q("Clock12",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12",key:"1fub01"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const y7=q("Clock2",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 10",key:"1g230d"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const v7=q("Clock3",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16.5 12",key:"1aq6pp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _7=q("Clock4",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const b7=q("Clock5",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 14.5 16",key:"1pcbox"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const w7=q("Clock6",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 12 16.5",key:"hb2qv6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const j7=q("Clock7",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 9.5 16",key:"ka3394"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const k7=q("Clock8",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 8 14",key:"tmc9b4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const N7=q("Clock9",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 7.5 12",key:"1k60p0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const S7=q("ClockAlert",[["path",{d:"M12 6v6l4 2",key:"mmk7yg"}],["path",{d:"M16 21.16a10 10 0 1 1 5-13.516",key:"cxo92l"}],["path",{d:"M20 11.5v6",key:"2ei3xq"}],["path",{d:"M20 21.5h.01",key:"1r2dzp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const C7=q("ClockArrowDown",[["path",{d:"M12.338 21.994A10 10 0 1 1 21.925 13.227",key:"1i7shu"}],["path",{d:"M12 6v6l2 1",key:"19cm8n"}],["path",{d:"m14 18 4 4 4-4",key:"1waygx"}],["path",{d:"M18 14v8",key:"irew45"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const M7=q("ClockArrowUp",[["path",{d:"M13.228 21.925A10 10 0 1 1 21.994 12.338",key:"1fzlyi"}],["path",{d:"M12 6v6l1.562.781",key:"1ujuk9"}],["path",{d:"m14 18 4-4 4 4",key:"ftkppy"}],["path",{d:"M18 22v-8",key:"su0gjh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ya=q("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const T7=q("CloudAlert",[["path",{d:"M12 12v4",key:"tww15h"}],["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M17 18h.5a1 1 0 0 0 0-9h-1.79A7 7 0 1 0 7 17.708",key:"xsb5ju"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const A7=q("CloudCog",[["circle",{cx:"12",cy:"17",r:"3",key:"1spfwm"}],["path",{d:"M4.2 15.1A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.2",key:"zaobp"}],["path",{d:"m15.7 18.4-.9-.3",key:"4qxpbn"}],["path",{d:"m9.2 15.9-.9-.3",key:"17q7o2"}],["path",{d:"m10.6 20.7.3-.9",key:"1pf4s2"}],["path",{d:"m13.1 14.2.3-.9",key:"1mnuqm"}],["path",{d:"m13.6 20.7-.4-1",key:"1jpd1m"}],["path",{d:"m10.8 14.3-.4-1",key:"17ugyy"}],["path",{d:"m8.3 18.6 1-.4",key:"s42vdx"}],["path",{d:"m14.7 15.8 1-.4",key:"2wizun"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Pb=q("CloudDownload",[["path",{d:"M12 13v8l-4-4",key:"1f5nwf"}],["path",{d:"m12 21 4-4",key:"1lfcce"}],["path",{d:"M4.393 15.269A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.436 8.284",key:"ui1hmy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const E7=q("CloudDrizzle",[["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"M8 19v1",key:"1dk2by"}],["path",{d:"M8 14v1",key:"84yxot"}],["path",{d:"M16 19v1",key:"v220m7"}],["path",{d:"M16 14v1",key:"g12gj6"}],["path",{d:"M12 21v1",key:"q8vafk"}],["path",{d:"M12 16v1",key:"1mx6rx"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const I7=q("CloudFog",[["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"M16 17H7",key:"pygtm1"}],["path",{d:"M17 21H9",key:"1u2q02"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const P7=q("CloudHail",[["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"M16 14v2",key:"a1is7l"}],["path",{d:"M8 14v2",key:"1e9m6t"}],["path",{d:"M16 20h.01",key:"xwek51"}],["path",{d:"M8 20h.01",key:"1vjney"}],["path",{d:"M12 16v2",key:"z66u1j"}],["path",{d:"M12 22h.01",key:"1urd7a"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const L7=q("CloudLightning",[["path",{d:"M6 16.326A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 .5 8.973",key:"1cez44"}],["path",{d:"m13 12-3 5h4l-3 5",key:"1t22er"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const O7=q("CloudMoonRain",[["path",{d:"M10.188 8.5A6 6 0 0 1 16 4a1 1 0 0 0 6 6 6 6 0 0 1-3 5.197",key:"erj67n"}],["path",{d:"M11 20v2",key:"174qtz"}],["path",{d:"M3 20a5 5 0 1 1 8.9-4H13a3 3 0 0 1 2 5.24",key:"1qmrp3"}],["path",{d:"M7 19v2",key:"12npes"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const D7=q("CloudMoon",[["path",{d:"M10.188 8.5A6 6 0 0 1 16 4a1 1 0 0 0 6 6 6 6 0 0 1-3 5.197",key:"erj67n"}],["path",{d:"M13 16a3 3 0 1 1 0 6H7a5 5 0 1 1 4.9-6Z",key:"p44pc9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const R7=q("CloudOff",[["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M5.782 5.782A7 7 0 0 0 9 19h8.5a4.5 4.5 0 0 0 1.307-.193",key:"yfwify"}],["path",{d:"M21.532 16.5A4.5 4.5 0 0 0 17.5 10h-1.79A7.008 7.008 0 0 0 10 5.07",key:"jlfiyv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const F7=q("CloudRainWind",[["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"m9.2 22 3-7",key:"sb5f6j"}],["path",{d:"m9 13-3 7",key:"500co5"}],["path",{d:"m17 13-3 7",key:"8t2fiy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const z7=q("CloudRain",[["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"M16 14v6",key:"1j4efv"}],["path",{d:"M8 14v6",key:"17c4r9"}],["path",{d:"M12 16v6",key:"c8a4gj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const B7=q("CloudSnow",[["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"M8 15h.01",key:"a7atzg"}],["path",{d:"M8 19h.01",key:"puxtts"}],["path",{d:"M12 17h.01",key:"p32p05"}],["path",{d:"M12 21h.01",key:"h35vbk"}],["path",{d:"M16 15h.01",key:"rnfrdf"}],["path",{d:"M16 19h.01",key:"1vcnzz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $7=q("CloudSunRain",[["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}],["path",{d:"M15.947 12.65a4 4 0 0 0-5.925-4.128",key:"dpwdj0"}],["path",{d:"M3 20a5 5 0 1 1 8.9-4H13a3 3 0 0 1 2 5.24",key:"1qmrp3"}],["path",{d:"M11 20v2",key:"174qtz"}],["path",{d:"M7 19v2",key:"12npes"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const U7=q("CloudSun",[["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}],["path",{d:"M15.947 12.65a4 4 0 0 0-5.925-4.128",key:"dpwdj0"}],["path",{d:"M13 22H7a5 5 0 1 1 4.9-6H13a3 3 0 0 1 0 6Z",key:"s09mg5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Lb=q("CloudUpload",[["path",{d:"M12 13v8",key:"1l5pq0"}],["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"m8 17 4-4 4 4",key:"1quai1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const q7=q("Cloud",[["path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"p7xjir"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const V7=q("Cloudy",[["path",{d:"M17.5 21H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z",key:"gqqjvc"}],["path",{d:"M22 10a3 3 0 0 0-3-3h-2.207a5.502 5.502 0 0 0-10.702.5",key:"1p2s76"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Jx=q("Clover",[["path",{d:"M16.17 7.83 2 22",key:"t58vo8"}],["path",{d:"M4.02 12a2.827 2.827 0 1 1 3.81-4.17A2.827 2.827 0 1 1 12 4.02a2.827 2.827 0 1 1 4.17 3.81A2.827 2.827 0 1 1 19.98 12a2.827 2.827 0 1 1-3.81 4.17A2.827 2.827 0 1 1 12 19.98a2.827 2.827 0 1 1-4.17-3.81A1 1 0 1 1 4 12",key:"17k36q"}],["path",{d:"m7.83 7.83 8.34 8.34",key:"1d7sxk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const H7=q("Club",[["path",{d:"M17.28 9.05a5.5 5.5 0 1 0-10.56 0A5.5 5.5 0 1 0 12 17.66a5.5 5.5 0 1 0 5.28-8.6Z",key:"27yuqz"}],["path",{d:"M12 17.66L12 22",key:"ogfahf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ob=q("CodeXml",[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Tj=q("Code",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const W7=q("Codepen",[["polygon",{points:"12 2 22 8.5 22 15.5 12 22 2 15.5 2 8.5 12 2",key:"srzb37"}],["line",{x1:"12",x2:"12",y1:"22",y2:"15.5",key:"1t73f2"}],["polyline",{points:"22 8.5 12 15.5 2 8.5",key:"ajlxae"}],["polyline",{points:"2 15.5 12 8.5 22 15.5",key:"susrui"}],["line",{x1:"12",x2:"12",y1:"2",y2:"8.5",key:"2cldga"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const G7=q("Codesandbox",[["path",{d:"M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z",key:"yt0hxn"}],["polyline",{points:"7.5 4.21 12 6.81 16.5 4.21",key:"fabo96"}],["polyline",{points:"7.5 19.79 7.5 14.6 3 12",key:"z377f1"}],["polyline",{points:"21 12 16.5 14.6 16.5 19.79",key:"9nrev1"}],["polyline",{points:"3.27 6.96 12 12.01 20.73 6.96",key:"1180pa"}],["line",{x1:"12",x2:"12",y1:"22.08",y2:"12",key:"3z3uq6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Aj=q("Coffee",[["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M14 2v2",key:"6buw04"}],["path",{d:"M16 8a1 1 0 0 1 1 1v8a4 4 0 0 1-4 4H7a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1h14a4 4 0 1 1 0 8h-1",key:"pwadti"}],["path",{d:"M6 2v2",key:"colzsn"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const K7=q("Cog",[["path",{d:"M12 20a8 8 0 1 0 0-16 8 8 0 0 0 0 16Z",key:"sobvz5"}],["path",{d:"M12 14a2 2 0 1 0 0-4 2 2 0 0 0 0 4Z",key:"11i496"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 22v-2",key:"1osdcq"}],["path",{d:"m17 20.66-1-1.73",key:"eq3orb"}],["path",{d:"M11 10.27 7 3.34",key:"16pf9h"}],["path",{d:"m20.66 17-1.73-1",key:"sg0v6f"}],["path",{d:"m3.34 7 1.73 1",key:"1ulond"}],["path",{d:"M14 12h8",key:"4f43i9"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"m20.66 7-1.73 1",key:"1ow05n"}],["path",{d:"m3.34 17 1.73-1",key:"nuk764"}],["path",{d:"m17 3.34-1 1.73",key:"2wel8s"}],["path",{d:"m11 13.73-4 6.93",key:"794ttg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Z7=q("Coins",[["circle",{cx:"8",cy:"8",r:"6",key:"3yglwk"}],["path",{d:"M18.09 10.37A6 6 0 1 1 10.34 18",key:"t5s6rm"}],["path",{d:"M7 6h1v4",key:"1obek4"}],["path",{d:"m16.71 13.88.7.71-2.82 2.82",key:"1rbuyh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Db=q("Columns2",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Rb=q("Columns3",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"M15 3v18",key:"14nvp0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Y7=q("Columns4",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M7.5 3v18",key:"w0wo6v"}],["path",{d:"M12 3v18",key:"108xh3"}],["path",{d:"M16.5 3v18",key:"10tjh1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const X7=q("Combine",[["path",{d:"M10 18H5a3 3 0 0 1-3-3v-1",key:"ru65g8"}],["path",{d:"M14 2a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2",key:"e30een"}],["path",{d:"M20 2a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2",key:"2ahx8o"}],["path",{d:"m7 21 3-3-3-3",key:"127cv2"}],["rect",{x:"14",y:"14",width:"8",height:"8",rx:"2",key:"1b0bso"}],["rect",{x:"2",y:"2",width:"8",height:"8",rx:"2",key:"1x09vl"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Q7=q("Command",[["path",{d:"M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3",key:"11bfej"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const J7=q("Compass",[["path",{d:"m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z",key:"9ktpf1"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const e9=q("Component",[["path",{d:"M15.536 11.293a1 1 0 0 0 0 1.414l2.376 2.377a1 1 0 0 0 1.414 0l2.377-2.377a1 1 0 0 0 0-1.414l-2.377-2.377a1 1 0 0 0-1.414 0z",key:"1uwlt4"}],["path",{d:"M2.297 11.293a1 1 0 0 0 0 1.414l2.377 2.377a1 1 0 0 0 1.414 0l2.377-2.377a1 1 0 0 0 0-1.414L6.088 8.916a1 1 0 0 0-1.414 0z",key:"10291m"}],["path",{d:"M8.916 17.912a1 1 0 0 0 0 1.415l2.377 2.376a1 1 0 0 0 1.414 0l2.377-2.376a1 1 0 0 0 0-1.415l-2.377-2.376a1 1 0 0 0-1.414 0z",key:"1tqoq1"}],["path",{d:"M8.916 4.674a1 1 0 0 0 0 1.414l2.377 2.376a1 1 0 0 0 1.414 0l2.377-2.376a1 1 0 0 0 0-1.414l-2.377-2.377a1 1 0 0 0-1.414 0z",key:"1x6lto"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const t9=q("Computer",[["rect",{width:"14",height:"8",x:"5",y:"2",rx:"2",key:"wc9tft"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",key:"w68u3i"}],["path",{d:"M6 18h2",key:"rwmk9e"}],["path",{d:"M12 18h6",key:"aqd8w3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const r9=q("ConciergeBell",[["path",{d:"M3 20a1 1 0 0 1-1-1v-1a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v1a1 1 0 0 1-1 1Z",key:"1pvr1r"}],["path",{d:"M20 16a8 8 0 1 0-16 0",key:"1pa543"}],["path",{d:"M12 4v4",key:"1bq03y"}],["path",{d:"M10 4h4",key:"1xpv9s"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const n9=q("Cone",[["path",{d:"m20.9 18.55-8-15.98a1 1 0 0 0-1.8 0l-8 15.98",key:"53pte7"}],["ellipse",{cx:"12",cy:"19",rx:"9",ry:"3",key:"1ji25f"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const s9=q("Construction",[["rect",{x:"2",y:"6",width:"20",height:"8",rx:"1",key:"1estib"}],["path",{d:"M17 14v7",key:"7m2elx"}],["path",{d:"M7 14v7",key:"1cm7wv"}],["path",{d:"M17 3v3",key:"1v4jwn"}],["path",{d:"M7 3v3",key:"7o6guu"}],["path",{d:"M10 14 2.3 6.3",key:"1023jk"}],["path",{d:"m14 6 7.7 7.7",key:"1s8pl2"}],["path",{d:"m8 6 8 8",key:"hl96qh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Fb=q("ContactRound",[["path",{d:"M16 2v2",key:"scm5qe"}],["path",{d:"M17.915 22a6 6 0 0 0-12 0",key:"suqz9p"}],["path",{d:"M8 2v2",key:"pbkmx"}],["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["rect",{x:"3",y:"4",width:"18",height:"18",rx:"2",key:"12vinp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const a9=q("Contact",[["path",{d:"M16 2v2",key:"scm5qe"}],["path",{d:"M7 22v-2a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v2",key:"1waht3"}],["path",{d:"M8 2v2",key:"pbkmx"}],["circle",{cx:"12",cy:"11",r:"3",key:"itu57m"}],["rect",{x:"3",y:"4",width:"18",height:"18",rx:"2",key:"12vinp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const i9=q("Container",[["path",{d:"M22 7.7c0-.6-.4-1.2-.8-1.5l-6.3-3.9a1.72 1.72 0 0 0-1.7 0l-10.3 6c-.5.2-.9.8-.9 1.4v6.6c0 .5.4 1.2.8 1.5l6.3 3.9a1.72 1.72 0 0 0 1.7 0l10.3-6c.5-.3.9-1 .9-1.5Z",key:"1t2lqe"}],["path",{d:"M10 21.9V14L2.1 9.1",key:"o7czzq"}],["path",{d:"m10 14 11.9-6.9",key:"zm5e20"}],["path",{d:"M14 19.8v-8.1",key:"159ecu"}],["path",{d:"M18 17.5V9.4",key:"11uown"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const o9=q("Contrast",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 18a6 6 0 0 0 0-12v12z",key:"j4l70d"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const l9=q("Cookie",[["path",{d:"M12 2a10 10 0 1 0 10 10 4 4 0 0 1-5-5 4 4 0 0 1-5-5",key:"laymnq"}],["path",{d:"M8.5 8.5v.01",key:"ue8clq"}],["path",{d:"M16 15.5v.01",key:"14dtrp"}],["path",{d:"M12 12v.01",key:"u5ubse"}],["path",{d:"M11 17v.01",key:"1hyl5a"}],["path",{d:"M7 14v.01",key:"uct60s"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const c9=q("CookingPot",[["path",{d:"M2 12h20",key:"9i4pu4"}],["path",{d:"M20 12v8a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2v-8",key:"u0tga0"}],["path",{d:"m4 8 16-4",key:"16g0ng"}],["path",{d:"m8.86 6.78-.45-1.81a2 2 0 0 1 1.45-2.43l1.94-.48a2 2 0 0 1 2.43 1.46l.45 1.8",key:"12cejc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const d9=q("CopyCheck",[["path",{d:"m12 15 2 2 4-4",key:"2c609p"}],["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const u9=q("CopyMinus",[["line",{x1:"12",x2:"18",y1:"15",y2:"15",key:"1nscbv"}],["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const h9=q("CopyPlus",[["line",{x1:"15",x2:"15",y1:"12",y2:"18",key:"1p7wdc"}],["line",{x1:"12",x2:"18",y1:"15",y2:"15",key:"1nscbv"}],["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const f9=q("CopySlash",[["line",{x1:"12",x2:"18",y1:"18",y2:"12",key:"ebkxgr"}],["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const p9=q("CopyX",[["line",{x1:"12",x2:"18",y1:"12",y2:"18",key:"1rg63v"}],["line",{x1:"12",x2:"18",y1:"18",y2:"12",key:"ebkxgr"}],["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Wo=q("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const m9=q("Copyleft",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.17 14.83a4 4 0 1 0 0-5.66",key:"1sveal"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const g9=q("Copyright",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M14.83 14.83a4 4 0 1 1 0-5.66",key:"1i56pz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const x9=q("CornerDownLeft",[["polyline",{points:"9 10 4 15 9 20",key:"r3jprv"}],["path",{d:"M20 4v7a4 4 0 0 1-4 4H4",key:"6o5b7l"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const y9=q("CornerDownRight",[["polyline",{points:"15 10 20 15 15 20",key:"1q7qjw"}],["path",{d:"M4 4v7a4 4 0 0 0 4 4h12",key:"z08zvw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const v9=q("CornerLeftDown",[["polyline",{points:"14 15 9 20 4 15",key:"nkc4i"}],["path",{d:"M20 4h-7a4 4 0 0 0-4 4v12",key:"nbpdq2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _9=q("CornerLeftUp",[["polyline",{points:"14 9 9 4 4 9",key:"m9oyvo"}],["path",{d:"M20 20h-7a4 4 0 0 1-4-4V4",key:"1blwi3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const b9=q("CornerRightDown",[["polyline",{points:"10 15 15 20 20 15",key:"axus6l"}],["path",{d:"M4 4h7a4 4 0 0 1 4 4v12",key:"wcbgct"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const w9=q("CornerRightUp",[["polyline",{points:"10 9 15 4 20 9",key:"1lr6px"}],["path",{d:"M4 20h7a4 4 0 0 0 4-4V4",key:"1plgdj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const j9=q("CornerUpLeft",[["polyline",{points:"9 14 4 9 9 4",key:"881910"}],["path",{d:"M20 20v-7a4 4 0 0 0-4-4H4",key:"1nkjon"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const k9=q("CornerUpRight",[["polyline",{points:"15 14 20 9 15 4",key:"1tbx3s"}],["path",{d:"M4 20v-7a4 4 0 0 1 4-4h12",key:"1lu4f8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const N9=q("Cpu",[["rect",{width:"16",height:"16",x:"4",y:"4",rx:"2",key:"14l7u7"}],["rect",{width:"6",height:"6",x:"9",y:"9",rx:"1",key:"5aljv4"}],["path",{d:"M15 2v2",key:"13l42r"}],["path",{d:"M15 20v2",key:"15mkzm"}],["path",{d:"M2 15h2",key:"1gxd5l"}],["path",{d:"M2 9h2",key:"1bbxkp"}],["path",{d:"M20 15h2",key:"19e6y8"}],["path",{d:"M20 9h2",key:"19tzq7"}],["path",{d:"M9 2v2",key:"165o2o"}],["path",{d:"M9 20v2",key:"i2bqo8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const S9=q("CreativeCommons",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M10 9.3a2.8 2.8 0 0 0-3.5 1 3.1 3.1 0 0 0 0 3.4 2.7 2.7 0 0 0 3.5 1",key:"1ss3eq"}],["path",{d:"M17 9.3a2.8 2.8 0 0 0-3.5 1 3.1 3.1 0 0 0 0 3.4 2.7 2.7 0 0 0 3.5 1",key:"1od56t"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Mm=q("CreditCard",[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const C9=q("Croissant",[["path",{d:"m4.6 13.11 5.79-3.21c1.89-1.05 4.79 1.78 3.71 3.71l-3.22 5.81C8.8 23.16.79 15.23 4.6 13.11Z",key:"1ozxlb"}],["path",{d:"m10.5 9.5-1-2.29C9.2 6.48 8.8 6 8 6H4.5C2.79 6 2 6.5 2 8.5a7.71 7.71 0 0 0 2 4.83",key:"ffuyb5"}],["path",{d:"M8 6c0-1.55.24-4-2-4-2 0-2.5 2.17-2.5 4",key:"osnpzi"}],["path",{d:"m14.5 13.5 2.29 1c.73.3 1.21.7 1.21 1.5v3.5c0 1.71-.5 2.5-2.5 2.5a7.71 7.71 0 0 1-4.83-2",key:"1vubaw"}],["path",{d:"M18 16c1.55 0 4-.24 4 2 0 2-2.17 2.5-4 2.5",key:"wxr772"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const M9=q("Crop",[["path",{d:"M6 2v14a2 2 0 0 0 2 2h14",key:"ron5a4"}],["path",{d:"M18 22V8a2 2 0 0 0-2-2H2",key:"7s9ehn"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const T9=q("Cross",[["path",{d:"M4 9a2 2 0 0 0-2 2v2a2 2 0 0 0 2 2h4a1 1 0 0 1 1 1v4a2 2 0 0 0 2 2h2a2 2 0 0 0 2-2v-4a1 1 0 0 1 1-1h4a2 2 0 0 0 2-2v-2a2 2 0 0 0-2-2h-4a1 1 0 0 1-1-1V4a2 2 0 0 0-2-2h-2a2 2 0 0 0-2 2v4a1 1 0 0 1-1 1z",key:"1xbrqy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const A9=q("Crosshair",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"22",x2:"18",y1:"12",y2:"12",key:"l9bcsi"}],["line",{x1:"6",x2:"2",y1:"12",y2:"12",key:"13hhkx"}],["line",{x1:"12",x2:"12",y1:"6",y2:"2",key:"10w3f3"}],["line",{x1:"12",x2:"12",y1:"22",y2:"18",key:"15g9kq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const B1=q("Crown",[["path",{d:"M11.562 3.266a.5.5 0 0 1 .876 0L15.39 8.87a1 1 0 0 0 1.516.294L21.183 5.5a.5.5 0 0 1 .798.519l-2.834 10.246a1 1 0 0 1-.956.734H5.81a1 1 0 0 1-.957-.734L2.02 6.02a.5.5 0 0 1 .798-.519l4.276 3.664a1 1 0 0 0 1.516-.294z",key:"1vdc57"}],["path",{d:"M5 21h14",key:"11awu3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const E9=q("Cuboid",[["path",{d:"m21.12 6.4-6.05-4.06a2 2 0 0 0-2.17-.05L2.95 8.41a2 2 0 0 0-.95 1.7v5.82a2 2 0 0 0 .88 1.66l6.05 4.07a2 2 0 0 0 2.17.05l9.95-6.12a2 2 0 0 0 .95-1.7V8.06a2 2 0 0 0-.88-1.66Z",key:"1u2ovd"}],["path",{d:"M10 22v-8L2.25 9.15",key:"11pn4q"}],["path",{d:"m10 14 11.77-6.87",key:"1kt1wh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const I9=q("CupSoda",[["path",{d:"m6 8 1.75 12.28a2 2 0 0 0 2 1.72h4.54a2 2 0 0 0 2-1.72L18 8",key:"8166m8"}],["path",{d:"M5 8h14",key:"pcz4l3"}],["path",{d:"M7 15a6.47 6.47 0 0 1 5 0 6.47 6.47 0 0 0 5 0",key:"yjz344"}],["path",{d:"m12 8 1-6h2",key:"3ybfa4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const P9=q("Currency",[["circle",{cx:"12",cy:"12",r:"8",key:"46899m"}],["line",{x1:"3",x2:"6",y1:"3",y2:"6",key:"1jkytn"}],["line",{x1:"21",x2:"18",y1:"3",y2:"6",key:"14zfjt"}],["line",{x1:"3",x2:"6",y1:"21",y2:"18",key:"iusuec"}],["line",{x1:"21",x2:"18",y1:"21",y2:"18",key:"yj2dd7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const L9=q("Cylinder",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5v14a9 3 0 0 0 18 0V5",key:"aqi0yr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const O9=q("Dam",[["path",{d:"M11 11.31c1.17.56 1.54 1.69 3.5 1.69 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1",key:"157kva"}],["path",{d:"M11.75 18c.35.5 1.45 1 2.75 1 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1",key:"d7q6m6"}],["path",{d:"M2 10h4",key:"l0bgd4"}],["path",{d:"M2 14h4",key:"1gsvsf"}],["path",{d:"M2 18h4",key:"1bu2t1"}],["path",{d:"M2 6h4",key:"aawbzj"}],["path",{d:"M7 3a1 1 0 0 0-1 1v16a1 1 0 0 0 1 1h4a1 1 0 0 0 1-1L10 4a1 1 0 0 0-1-1z",key:"pr6s65"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const D9=q("DatabaseBackup",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 12a9 3 0 0 0 5 2.69",key:"1ui2ym"}],["path",{d:"M21 9.3V5",key:"6k6cib"}],["path",{d:"M3 5v14a9 3 0 0 0 6.47 2.88",key:"i62tjy"}],["path",{d:"M12 12v4h4",key:"1bxaet"}],["path",{d:"M13 20a5 5 0 0 0 9-3 4.5 4.5 0 0 0-4.5-4.5c-1.33 0-2.54.54-3.41 1.41L12 16",key:"1f4ei9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const R9=q("DatabaseZap",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 15 21.84",key:"14ibmq"}],["path",{d:"M21 5V8",key:"1marbg"}],["path",{d:"M21 12L18 17H22L19 22",key:"zafso"}],["path",{d:"M3 12A9 3 0 0 0 14.59 14.87",key:"1y4wr8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const F9=q("Database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const z9=q("Delete",[["path",{d:"M10 5a2 2 0 0 0-1.344.519l-6.328 5.74a1 1 0 0 0 0 1.481l6.328 5.741A2 2 0 0 0 10 19h10a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2z",key:"1yo7s0"}],["path",{d:"m12 9 6 6",key:"anjzzh"}],["path",{d:"m18 9-6 6",key:"1fp51s"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const B9=q("Dessert",[["circle",{cx:"12",cy:"4",r:"2",key:"muu5ef"}],["path",{d:"M10.2 3.2C5.5 4 2 8.1 2 13a2 2 0 0 0 4 0v-1a2 2 0 0 1 4 0v4a2 2 0 0 0 4 0v-4a2 2 0 0 1 4 0v1a2 2 0 0 0 4 0c0-4.9-3.5-9-8.2-9.8",key:"lfo06j"}],["path",{d:"M3.2 14.8a9 9 0 0 0 17.6 0",key:"12xarc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $9=q("Diameter",[["circle",{cx:"19",cy:"19",r:"2",key:"17f5cg"}],["circle",{cx:"5",cy:"5",r:"2",key:"1gwv83"}],["path",{d:"M6.48 3.66a10 10 0 0 1 13.86 13.86",key:"xr8kdq"}],["path",{d:"m6.41 6.41 11.18 11.18",key:"uhpjw7"}],["path",{d:"M3.66 6.48a10 10 0 0 0 13.86 13.86",key:"cldpwv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const U9=q("DiamondMinus",[["path",{d:"M2.7 10.3a2.41 2.41 0 0 0 0 3.41l7.59 7.59a2.41 2.41 0 0 0 3.41 0l7.59-7.59a2.41 2.41 0 0 0 0-3.41L13.7 2.71a2.41 2.41 0 0 0-3.41 0z",key:"1ey20j"}],["path",{d:"M8 12h8",key:"1wcyev"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zb=q("DiamondPercent",[["path",{d:"M2.7 10.3a2.41 2.41 0 0 0 0 3.41l7.59 7.59a2.41 2.41 0 0 0 3.41 0l7.59-7.59a2.41 2.41 0 0 0 0-3.41L13.7 2.71a2.41 2.41 0 0 0-3.41 0Z",key:"1tpxz2"}],["path",{d:"M9.2 9.2h.01",key:"1b7bvt"}],["path",{d:"m14.5 9.5-5 5",key:"17q4r4"}],["path",{d:"M14.7 14.8h.01",key:"17nsh4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const q9=q("DiamondPlus",[["path",{d:"M12 8v8",key:"napkw2"}],["path",{d:"M2.7 10.3a2.41 2.41 0 0 0 0 3.41l7.59 7.59a2.41 2.41 0 0 0 3.41 0l7.59-7.59a2.41 2.41 0 0 0 0-3.41L13.7 2.71a2.41 2.41 0 0 0-3.41 0z",key:"1ey20j"}],["path",{d:"M8 12h8",key:"1wcyev"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const V9=q("Diamond",[["path",{d:"M2.7 10.3a2.41 2.41 0 0 0 0 3.41l7.59 7.59a2.41 2.41 0 0 0 3.41 0l7.59-7.59a2.41 2.41 0 0 0 0-3.41l-7.59-7.59a2.41 2.41 0 0 0-3.41 0Z",key:"1f1r0c"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const H9=q("Dice1",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["path",{d:"M12 12h.01",key:"1mp3jc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const W9=q("Dice2",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["path",{d:"M15 9h.01",key:"x1ddxp"}],["path",{d:"M9 15h.01",key:"fzyn71"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const G9=q("Dice3",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["path",{d:"M16 8h.01",key:"cr5u4v"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M8 16h.01",key:"18s6g9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const K9=q("Dice4",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["path",{d:"M16 8h.01",key:"cr5u4v"}],["path",{d:"M8 8h.01",key:"1e4136"}],["path",{d:"M8 16h.01",key:"18s6g9"}],["path",{d:"M16 16h.01",key:"1f9h7w"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Z9=q("Dice5",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["path",{d:"M16 8h.01",key:"cr5u4v"}],["path",{d:"M8 8h.01",key:"1e4136"}],["path",{d:"M8 16h.01",key:"18s6g9"}],["path",{d:"M16 16h.01",key:"1f9h7w"}],["path",{d:"M12 12h.01",key:"1mp3jc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Y9=q("Dice6",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["path",{d:"M16 8h.01",key:"cr5u4v"}],["path",{d:"M16 12h.01",key:"1l6xoz"}],["path",{d:"M16 16h.01",key:"1f9h7w"}],["path",{d:"M8 8h.01",key:"1e4136"}],["path",{d:"M8 12h.01",key:"czm47f"}],["path",{d:"M8 16h.01",key:"18s6g9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const X9=q("Dices",[["rect",{width:"12",height:"12",x:"2",y:"10",rx:"2",ry:"2",key:"6agr2n"}],["path",{d:"m17.92 14 3.5-3.5a2.24 2.24 0 0 0 0-3l-5-4.92a2.24 2.24 0 0 0-3 0L10 6",key:"1o487t"}],["path",{d:"M6 18h.01",key:"uhywen"}],["path",{d:"M10 14h.01",key:"ssrbsk"}],["path",{d:"M15 6h.01",key:"cblpky"}],["path",{d:"M18 9h.01",key:"2061c0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Q9=q("Diff",[["path",{d:"M12 3v14",key:"7cf3v8"}],["path",{d:"M5 10h14",key:"elsbfy"}],["path",{d:"M5 21h14",key:"11awu3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const J9=q("Disc2",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 12h.01",key:"1mp3jc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const eB=q("Disc3",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M6 12c0-1.7.7-3.2 1.8-4.2",key:"oqkarx"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["path",{d:"M18 12c0 1.7-.7 3.2-1.8 4.2",key:"1eah9h"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tB=q("DiscAlbum",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["circle",{cx:"12",cy:"12",r:"5",key:"nd82uf"}],["path",{d:"M12 12h.01",key:"1mp3jc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rB=q("Disc",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nB=q("Divide",[["circle",{cx:"12",cy:"6",r:"1",key:"1bh7o1"}],["line",{x1:"5",x2:"19",y1:"12",y2:"12",key:"13b5wn"}],["circle",{cx:"12",cy:"18",r:"1",key:"lqb9t5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sB=q("DnaOff",[["path",{d:"M15 2c-1.35 1.5-2.092 3-2.5 4.5L14 8",key:"1bivrr"}],["path",{d:"m17 6-2.891-2.891",key:"xu6p2f"}],["path",{d:"M2 15c3.333-3 6.667-3 10-3",key:"nxix30"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"m20 9 .891.891",key:"3xwk7g"}],["path",{d:"M22 9c-1.5 1.35-3 2.092-4.5 2.5l-1-1",key:"18cutr"}],["path",{d:"M3.109 14.109 4 15",key:"q76aoh"}],["path",{d:"m6.5 12.5 1 1",key:"cs35ky"}],["path",{d:"m7 18 2.891 2.891",key:"1sisit"}],["path",{d:"M9 22c1.35-1.5 2.092-3 2.5-4.5L10 16",key:"rlvei3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const aB=q("Dna",[["path",{d:"m10 16 1.5 1.5",key:"11lckj"}],["path",{d:"m14 8-1.5-1.5",key:"1ohn8i"}],["path",{d:"M15 2c-1.798 1.998-2.518 3.995-2.807 5.993",key:"80uv8i"}],["path",{d:"m16.5 10.5 1 1",key:"696xn5"}],["path",{d:"m17 6-2.891-2.891",key:"xu6p2f"}],["path",{d:"M2 15c6.667-6 13.333 0 20-6",key:"1pyr53"}],["path",{d:"m20 9 .891.891",key:"3xwk7g"}],["path",{d:"M3.109 14.109 4 15",key:"q76aoh"}],["path",{d:"m6.5 12.5 1 1",key:"cs35ky"}],["path",{d:"m7 18 2.891 2.891",key:"1sisit"}],["path",{d:"M9 22c1.798-1.998 2.518-3.995 2.807-5.993",key:"q3hbxp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const iB=q("Dock",[["path",{d:"M2 8h20",key:"d11cs7"}],["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["path",{d:"M6 16h12",key:"u522kt"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oB=q("Dog",[["path",{d:"M11.25 16.25h1.5L12 17z",key:"w7jh35"}],["path",{d:"M16 14v.5",key:"1lajdz"}],["path",{d:"M4.42 11.247A13.152 13.152 0 0 0 4 14.556C4 18.728 7.582 21 12 21s8-2.272 8-6.444a11.702 11.702 0 0 0-.493-3.309",key:"u7s9ue"}],["path",{d:"M8 14v.5",key:"1nzgdb"}],["path",{d:"M8.5 8.5c-.384 1.05-1.083 2.028-2.344 2.5-1.931.722-3.576-.297-3.656-1-.113-.994 1.177-6.53 4-7 1.923-.321 3.651.845 3.651 2.235A7.497 7.497 0 0 1 14 5.277c0-1.39 1.844-2.598 3.767-2.277 2.823.47 4.113 6.006 4 7-.08.703-1.725 1.722-3.656 1-1.261-.472-1.855-1.45-2.239-2.5",key:"v8hric"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Rd=q("DollarSign",[["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"M17 5H9.5a3.5 3.5 0 0 0 0 7h5a3.5 3.5 0 0 1 0 7H6",key:"1b0p4s"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lB=q("Donut",[["path",{d:"M20.5 10a2.5 2.5 0 0 1-2.4-3H18a2.95 2.95 0 0 1-2.6-4.4 10 10 0 1 0 6.3 7.1c-.3.2-.8.3-1.2.3",key:"19sr3x"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cB=q("DoorClosed",[["path",{d:"M18 20V6a2 2 0 0 0-2-2H8a2 2 0 0 0-2 2v14",key:"36qu9e"}],["path",{d:"M2 20h20",key:"owomy5"}],["path",{d:"M14 12v.01",key:"xfcn54"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ej=q("DoorOpen",[["path",{d:"M13 4h3a2 2 0 0 1 2 2v14",key:"hrm0s9"}],["path",{d:"M2 20h3",key:"1gaodv"}],["path",{d:"M13 20h9",key:"s90cdi"}],["path",{d:"M10 12v.01",key:"vx6srw"}],["path",{d:"M13 4.562v16.157a1 1 0 0 1-1.242.97L5 20V5.562a2 2 0 0 1 1.515-1.94l4-1A2 2 0 0 1 13 4.561Z",key:"199qr4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dB=q("Dot",[["circle",{cx:"12.1",cy:"12.1",r:"1",key:"18d7e5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const io=q("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uB=q("DraftingCompass",[["path",{d:"m12.99 6.74 1.93 3.44",key:"iwagvd"}],["path",{d:"M19.136 12a10 10 0 0 1-14.271 0",key:"ppmlo4"}],["path",{d:"m21 21-2.16-3.84",key:"vylbct"}],["path",{d:"m3 21 8.02-14.26",key:"1ssaw4"}],["circle",{cx:"12",cy:"5",r:"2",key:"f1ur92"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hB=q("Drama",[["path",{d:"M10 11h.01",key:"d2at3l"}],["path",{d:"M14 6h.01",key:"k028ub"}],["path",{d:"M18 6h.01",key:"1v4wsw"}],["path",{d:"M6.5 13.1h.01",key:"1748ia"}],["path",{d:"M22 5c0 9-4 12-6 12s-6-3-6-12c0-2 2-3 6-3s6 1 6 3",key:"172yzv"}],["path",{d:"M17.4 9.9c-.8.8-2 .8-2.8 0",key:"1obv0w"}],["path",{d:"M10.1 7.1C9 7.2 7.7 7.7 6 8.6c-3.5 2-4.7 3.9-3.7 5.6 4.5 7.8 9.5 8.4 11.2 7.4.9-.5 1.9-2.1 1.9-4.7",key:"rqjl8i"}],["path",{d:"M9.1 16.5c.3-1.1 1.4-1.7 2.4-1.4",key:"1mr6wy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fB=q("Dribbble",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M19.13 5.09C15.22 9.14 10 10.44 2.25 10.94",key:"hpej1"}],["path",{d:"M21.75 12.84c-6.62-1.41-12.14 1-16.38 6.32",key:"1tr44o"}],["path",{d:"M8.56 2.75c4.37 6 6 9.42 8 17.72",key:"kbh691"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pB=q("Drill",[["path",{d:"M10 18a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1H5a3 3 0 0 1-3-3 1 1 0 0 1 1-1z",key:"ioqxb1"}],["path",{d:"M13 10H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a1 1 0 0 1 1 1v6a1 1 0 0 1-1 1l-.81 3.242a1 1 0 0 1-.97.758H8",key:"1rs59n"}],["path",{d:"M14 4h3a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1h-3",key:"105ega"}],["path",{d:"M18 6h4",key:"66u95g"}],["path",{d:"m5 10-2 8",key:"xt2lic"}],["path",{d:"m7 18 2-8",key:"1bzku2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mB=q("Droplet",[["path",{d:"M12 22a7 7 0 0 0 7-7c0-2-1-3.9-3-5.5s-3.5-4-4-6.5c-.5 2.5-2 4.9-4 6.5C6 11.1 5 13 5 15a7 7 0 0 0 7 7z",key:"c7niix"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gB=q("Droplets",[["path",{d:"M7 16.3c2.2 0 4-1.83 4-4.05 0-1.16-.57-2.26-1.71-3.19S7.29 6.75 7 5.3c-.29 1.45-1.14 2.84-2.29 3.76S3 11.1 3 12.25c0 2.22 1.8 4.05 4 4.05z",key:"1ptgy4"}],["path",{d:"M12.56 6.6A10.97 10.97 0 0 0 14 3.02c.5 2.5 2 4.9 4 6.5s3 3.5 3 5.5a6.98 6.98 0 0 1-11.91 4.97",key:"1sl1rz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xB=q("Drum",[["path",{d:"m2 2 8 8",key:"1v6059"}],["path",{d:"m22 2-8 8",key:"173r8a"}],["ellipse",{cx:"12",cy:"9",rx:"10",ry:"5",key:"liohsx"}],["path",{d:"M7 13.4v7.9",key:"1yi6u9"}],["path",{d:"M12 14v8",key:"1tn2tj"}],["path",{d:"M17 13.4v7.9",key:"eqz2v3"}],["path",{d:"M2 9v8a10 5 0 0 0 20 0V9",key:"1750ul"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yB=q("Drumstick",[["path",{d:"M15.4 15.63a7.875 6 135 1 1 6.23-6.23 4.5 3.43 135 0 0-6.23 6.23",key:"1dtqwm"}],["path",{d:"m8.29 12.71-2.6 2.6a2.5 2.5 0 1 0-1.65 4.65A2.5 2.5 0 1 0 8.7 18.3l2.59-2.59",key:"1oq1fw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vB=q("Dumbbell",[["path",{d:"M14.4 14.4 9.6 9.6",key:"ic80wn"}],["path",{d:"M18.657 21.485a2 2 0 1 1-2.829-2.828l-1.767 1.768a2 2 0 1 1-2.829-2.829l6.364-6.364a2 2 0 1 1 2.829 2.829l-1.768 1.767a2 2 0 1 1 2.828 2.829z",key:"nnl7wr"}],["path",{d:"m21.5 21.5-1.4-1.4",key:"1f1ice"}],["path",{d:"M3.9 3.9 2.5 2.5",key:"1evmna"}],["path",{d:"M6.404 12.768a2 2 0 1 1-2.829-2.829l1.768-1.767a2 2 0 1 1-2.828-2.829l2.828-2.828a2 2 0 1 1 2.829 2.828l1.767-1.768a2 2 0 1 1 2.829 2.829z",key:"yhosts"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _B=q("EarOff",[["path",{d:"M6 18.5a3.5 3.5 0 1 0 7 0c0-1.57.92-2.52 2.04-3.46",key:"1qngmn"}],["path",{d:"M6 8.5c0-.75.13-1.47.36-2.14",key:"b06bma"}],["path",{d:"M8.8 3.15A6.5 6.5 0 0 1 19 8.5c0 1.63-.44 2.81-1.09 3.76",key:"g10hsz"}],["path",{d:"M12.5 6A2.5 2.5 0 0 1 15 8.5M10 13a2 2 0 0 0 1.82-1.18",key:"ygzou7"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bB=q("Ear",[["path",{d:"M6 8.5a6.5 6.5 0 1 1 13 0c0 6-6 6-6 10a3.5 3.5 0 1 1-7 0",key:"1dfaln"}],["path",{d:"M15 8.5a2.5 2.5 0 0 0-5 0v1a2 2 0 1 1 0 4",key:"1qnva7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wB=q("EarthLock",[["path",{d:"M7 3.34V5a3 3 0 0 0 3 3",key:"w732o8"}],["path",{d:"M11 21.95V18a2 2 0 0 0-2-2 2 2 0 0 1-2-2v-1a2 2 0 0 0-2-2H2.05",key:"f02343"}],["path",{d:"M21.54 15H17a2 2 0 0 0-2 2v4.54",key:"1djwo0"}],["path",{d:"M12 2a10 10 0 1 0 9.54 13",key:"zjsr6q"}],["path",{d:"M20 6V4a2 2 0 1 0-4 0v2",key:"1of5e8"}],["rect",{width:"8",height:"5",x:"14",y:"6",rx:"1",key:"1fmf51"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Bb=q("Earth",[["path",{d:"M21.54 15H17a2 2 0 0 0-2 2v4.54",key:"1djwo0"}],["path",{d:"M7 3.34V5a3 3 0 0 0 3 3a2 2 0 0 1 2 2c0 1.1.9 2 2 2a2 2 0 0 0 2-2c0-1.1.9-2 2-2h3.17",key:"1tzkfa"}],["path",{d:"M11 21.95V18a2 2 0 0 0-2-2a2 2 0 0 1-2-2v-1a2 2 0 0 0-2-2H2.05",key:"14pb5j"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jB=q("Eclipse",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a7 7 0 1 0 10 10",key:"1yuj32"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kB=q("EggFried",[["circle",{cx:"11.5",cy:"12.5",r:"3.5",key:"1cl1mi"}],["path",{d:"M3 8c0-3.5 2.5-6 6.5-6 5 0 4.83 3 7.5 5s5 2 5 6c0 4.5-2.5 6.5-7 6.5-2.5 0-2.5 2.5-6 2.5s-7-2-7-5.5c0-3 1.5-3 1.5-5C3.5 10 3 9 3 8Z",key:"165ef9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const NB=q("EggOff",[["path",{d:"M6.399 6.399C5.362 8.157 4.65 10.189 4.5 12c-.37 4.43 1.27 9.95 7.5 10 3.256-.026 5.259-1.547 6.375-3.625",key:"6et380"}],["path",{d:"M19.532 13.875A14.07 14.07 0 0 0 19.5 12c-.36-4.34-3.95-9.96-7.5-10-1.04.012-2.082.502-3.046 1.297",key:"gcdc3f"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bS=q("Egg",[["path",{d:"M12 22c6.23-.05 7.87-5.57 7.5-10-.36-4.34-3.95-9.96-7.5-10-3.55.04-7.14 5.66-7.5 10-.37 4.43 1.27 9.95 7.5 10z",key:"1c39pg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Wx=q("EllipsisVertical",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pm=q("Ellipsis",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const SB=q("EqualApproximately",[["path",{d:"M5 15a6.5 6.5 0 0 1 7 0 6.5 6.5 0 0 0 7 0",key:"yrdkhy"}],["path",{d:"M5 9a6.5 6.5 0 0 1 7 0 6.5 6.5 0 0 0 7 0",key:"gzkvyz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const CB=q("EqualNot",[["line",{x1:"5",x2:"19",y1:"9",y2:"9",key:"1nwqeh"}],["line",{x1:"5",x2:"19",y1:"15",y2:"15",key:"g8yjpy"}],["line",{x1:"19",x2:"5",y1:"5",y2:"19",key:"1x9vlm"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const MB=q("Equal",[["line",{x1:"5",x2:"19",y1:"9",y2:"9",key:"1nwqeh"}],["line",{x1:"5",x2:"19",y1:"15",y2:"15",key:"g8yjpy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const TB=q("Eraser",[["path",{d:"m7 21-4.3-4.3c-1-1-1-2.5 0-3.4l9.6-9.6c1-1 2.5-1 3.4 0l5.6 5.6c1 1 1 2.5 0 3.4L13 21",key:"182aya"}],["path",{d:"M22 21H7",key:"t4ddhn"}],["path",{d:"m5 11 9 9",key:"1mo9qw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const AB=q("EthernetPort",[["path",{d:"m15 20 3-3h2a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h2l3 3z",key:"rbahqx"}],["path",{d:"M6 8v1",key:"1636ez"}],["path",{d:"M10 8v1",key:"1talb4"}],["path",{d:"M14 8v1",key:"1rsfgr"}],["path",{d:"M18 8v1",key:"gnkwox"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const EB=q("Euro",[["path",{d:"M4 10h12",key:"1y6xl8"}],["path",{d:"M4 14h9",key:"1loblj"}],["path",{d:"M19 6a7.7 7.7 0 0 0-5.2-2A7.9 7.9 0 0 0 6 12c0 4.4 3.5 8 7.8 8 2 0 3.8-.8 5.2-2",key:"1j6lzo"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const IB=q("Expand",[["path",{d:"m21 21-6-6m6 6v-4.8m0 4.8h-4.8",key:"1c15vz"}],["path",{d:"M3 16.2V21m0 0h4.8M3 21l6-6",key:"1fsnz2"}],["path",{d:"M21 7.8V3m0 0h-4.8M21 3l-6 6",key:"hawz9i"}],["path",{d:"M3 7.8V3m0 0h4.8M3 3l6 6",key:"u9ee12"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const As=q("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const PB=q("EyeClosed",[["path",{d:"m15 18-.722-3.25",key:"1j64jw"}],["path",{d:"M2 8a10.645 10.645 0 0 0 20 0",key:"1e7gxb"}],["path",{d:"m20 15-1.726-2.05",key:"1cnuld"}],["path",{d:"m4 15 1.726-2.05",key:"1dsqqd"}],["path",{d:"m9 18 .722-3.25",key:"ypw2yx"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $1=q("EyeOff",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ko=q("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const au=q("Facebook",[["path",{d:"M18 2h-3a5 5 0 0 0-5 5v3H7v4h3v8h4v-8h3l1-4h-4V7a1 1 0 0 1 1-1h3z",key:"1jg4f8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const LB=q("Factory",[["path",{d:"M2 20a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V8l-7 5V8l-7 5V4a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2Z",key:"159hny"}],["path",{d:"M17 18h1",key:"uldtlt"}],["path",{d:"M12 18h1",key:"s9uhes"}],["path",{d:"M7 18h1",key:"1neino"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const OB=q("Fan",[["path",{d:"M10.827 16.379a6.082 6.082 0 0 1-8.618-7.002l5.412 1.45a6.082 6.082 0 0 1 7.002-8.618l-1.45 5.412a6.082 6.082 0 0 1 8.618 7.002l-5.412-1.45a6.082 6.082 0 0 1-7.002 8.618l1.45-5.412Z",key:"484a7f"}],["path",{d:"M12 12v.01",key:"u5ubse"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const DB=q("FastForward",[["polygon",{points:"13 19 22 12 13 5 13 19",key:"587y9g"}],["polygon",{points:"2 19 11 12 2 5 2 19",key:"3pweh0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const RB=q("Feather",[["path",{d:"M12.67 19a2 2 0 0 0 1.416-.588l6.154-6.172a6 6 0 0 0-8.49-8.49L5.586 9.914A2 2 0 0 0 5 11.328V18a1 1 0 0 0 1 1z",key:"18jl4k"}],["path",{d:"M16 8 2 22",key:"vp34q"}],["path",{d:"M17.5 15H9",key:"1oz8nu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const FB=q("Fence",[["path",{d:"M4 3 2 5v15c0 .6.4 1 1 1h2c.6 0 1-.4 1-1V5Z",key:"1n2rgs"}],["path",{d:"M6 8h4",key:"utf9t1"}],["path",{d:"M6 18h4",key:"12yh4b"}],["path",{d:"m12 3-2 2v15c0 .6.4 1 1 1h2c.6 0 1-.4 1-1V5Z",key:"3ha7mj"}],["path",{d:"M14 8h4",key:"1r8wg2"}],["path",{d:"M14 18h4",key:"1t3kbu"}],["path",{d:"m20 3-2 2v15c0 .6.4 1 1 1h2c.6 0 1-.4 1-1V5Z",key:"dfd4e2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zB=q("FerrisWheel",[["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m6.8 15-3.5 2",key:"hjy98k"}],["path",{d:"m20.7 7-3.5 2",key:"f08gto"}],["path",{d:"M6.8 9 3.3 7",key:"1aevh4"}],["path",{d:"m20.7 17-3.5-2",key:"1liqo3"}],["path",{d:"m9 22 3-8 3 8",key:"wees03"}],["path",{d:"M8 22h8",key:"rmew8v"}],["path",{d:"M18 18.7a9 9 0 1 0-12 0",key:"dhzg4g"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const BB=q("Figma",[["path",{d:"M5 5.5A3.5 3.5 0 0 1 8.5 2H12v7H8.5A3.5 3.5 0 0 1 5 5.5z",key:"1340ok"}],["path",{d:"M12 2h3.5a3.5 3.5 0 1 1 0 7H12V2z",key:"1hz3m3"}],["path",{d:"M12 12.5a3.5 3.5 0 1 1 7 0 3.5 3.5 0 1 1-7 0z",key:"1oz8n2"}],["path",{d:"M5 19.5A3.5 3.5 0 0 1 8.5 16H12v3.5a3.5 3.5 0 1 1-7 0z",key:"1ff65i"}],["path",{d:"M5 12.5A3.5 3.5 0 0 1 8.5 9H12v7H8.5A3.5 3.5 0 0 1 5 12.5z",key:"pdip6e"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $B=q("FileArchive",[["path",{d:"M10 12v-1",key:"v7bkov"}],["path",{d:"M10 18v-2",key:"1cjy8d"}],["path",{d:"M10 7V6",key:"dljcrl"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M15.5 22H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v16a2 2 0 0 0 .274 1.01",key:"gkbcor"}],["circle",{cx:"10",cy:"20",r:"2",key:"1xzdoj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const UB=q("FileAudio2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v2",key:"17k7jt"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["circle",{cx:"3",cy:"17",r:"1",key:"vo6nti"}],["path",{d:"M2 17v-3a4 4 0 0 1 8 0v3",key:"1ggdre"}],["circle",{cx:"9",cy:"17",r:"1",key:"bc1fq4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qB=q("FileAudio",[["path",{d:"M17.5 22h.5a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v3",key:"rslqgf"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M2 19a2 2 0 1 1 4 0v1a2 2 0 1 1-4 0v-4a6 6 0 0 1 12 0v4a2 2 0 1 1-4 0v-1a2 2 0 1 1 4 0",key:"9f7x3i"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $b=q("FileAxis3d",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m8 18 4-4",key:"12zab0"}],["path",{d:"M8 10v8h8",key:"tlaukw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const VB=q("FileBadge2",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m14 12.5 1 5.5-3-1-3 1 1-5.5",key:"14xlky"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const HB=q("FileBadge",[["path",{d:"M12 22h6a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v3",key:"12ixgl"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M5 17a3 3 0 1 0 0-6 3 3 0 0 0 0 6Z",key:"u0c8gj"}],["path",{d:"M7 16.5 8 22l-3-1-3 1 1-5.5",key:"5gm2nr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const WB=q("FileBox",[["path",{d:"M14.5 22H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"16lz6z"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M3 13.1a2 2 0 0 0-1 1.76v3.24a2 2 0 0 0 .97 1.78L6 21.7a2 2 0 0 0 2.03.01L11 19.9a2 2 0 0 0 1-1.76V14.9a2 2 0 0 0-.97-1.78L8 11.3a2 2 0 0 0-2.03-.01Z",key:"99pj1s"}],["path",{d:"M7 17v5",key:"1yj1jh"}],["path",{d:"M11.7 14.2 7 17l-4.7-2.8",key:"1yk8tc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ub=q("FileChartColumnIncreasing",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M8 18v-2",key:"qcmpov"}],["path",{d:"M12 18v-4",key:"q1q25u"}],["path",{d:"M16 18v-6",key:"15y0np"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qb=q("FileChartColumn",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M8 18v-1",key:"zg0ygc"}],["path",{d:"M12 18v-6",key:"17g6i2"}],["path",{d:"M16 18v-3",key:"j5jt4h"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Vb=q("FileChartLine",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m16 13-3.5 3.5-2-2L8 17",key:"zz7yod"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Hb=q("FileChartPie",[["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M16 22h2a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v3.5",key:"13ddob"}],["path",{d:"M4.017 11.512a6 6 0 1 0 8.466 8.475",key:"s6vs5t"}],["path",{d:"M9 16a1 1 0 0 1-1-1v-4c0-.552.45-1.008.995-.917a6 6 0 0 1 4.922 4.922c.091.544-.365.995-.917.995z",key:"1dl6s6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const GB=q("FileCheck2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m3 15 2 2 4-4",key:"1lhrkk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const KB=q("FileCheck",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m9 15 2 2 4-4",key:"1grp1n"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ZB=q("FileClock",[["path",{d:"M16 22h2a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v3",key:"37hlfg"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["circle",{cx:"8",cy:"16",r:"6",key:"10v15b"}],["path",{d:"M9.5 17.5 8 16.25V14",key:"1o80t2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const YB=q("FileCode2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m5 12-3 3 3 3",key:"oke12k"}],["path",{d:"m9 18 3-3-3-3",key:"112psh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const XB=q("FileCode",[["path",{d:"M10 12.5 8 15l2 2.5",key:"1tg20x"}],["path",{d:"m14 12.5 2 2.5-2 2.5",key:"yinavb"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z",key:"1mlx9k"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Wb=q("FileCog",[["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m3.2 12.9-.9-.4",key:"1i3dj5"}],["path",{d:"m3.2 15.1-.9.4",key:"1fvgj0"}],["path",{d:"M4.677 21.5a2 2 0 0 0 1.313.5H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v2.5",key:"1yo3oz"}],["path",{d:"m4.9 11.2-.4-.9",key:"otmhb9"}],["path",{d:"m4.9 16.8-.4.9",key:"1b8z07"}],["path",{d:"m7.5 10.3-.4.9",key:"11k65u"}],["path",{d:"m7.5 17.7-.4-.9",key:"431x55"}],["path",{d:"m9.7 12.5-.9.4",key:"87sjan"}],["path",{d:"m9.7 15.5-.9-.4",key:"khqm91"}],["circle",{cx:"6",cy:"14",r:"3",key:"a1xfv6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const QB=q("FileDiff",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M9 10h6",key:"9gxzsh"}],["path",{d:"M12 13V7",key:"h0r20n"}],["path",{d:"M9 17h6",key:"r8uit2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const JB=q("FileDigit",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["rect",{width:"4",height:"6",x:"2",y:"12",rx:"2",key:"jm304g"}],["path",{d:"M10 12h2v6",key:"12zw74"}],["path",{d:"M10 18h4",key:"1ulq68"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const e$=q("FileDown",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M12 18v-6",key:"17g6i2"}],["path",{d:"m9 15 3 3 3-3",key:"1npd3o"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const t$=q("FileHeart",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v2",key:"17k7jt"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10.29 10.7a2.43 2.43 0 0 0-2.66-.52c-.29.12-.56.3-.78.53l-.35.34-.35-.34a2.43 2.43 0 0 0-2.65-.53c-.3.12-.56.3-.79.53-.95.94-1 2.53.2 3.74L6.5 18l3.6-3.55c1.2-1.21 1.14-2.8.19-3.74Z",key:"1c1fso"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const U1=q("FileImage",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["circle",{cx:"10",cy:"12",r:"2",key:"737tya"}],["path",{d:"m20 17-1.296-1.296a2.41 2.41 0 0 0-3.408 0L9 22",key:"wt3hpn"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const r$=q("FileInput",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M2 15h10",key:"jfw4w8"}],["path",{d:"m9 18 3-3-3-3",key:"112psh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const n$=q("FileJson2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M4 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1",key:"fq0c9t"}],["path",{d:"M8 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1",key:"4gibmv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const s$=q("FileJson",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1",key:"1oajmo"}],["path",{d:"M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1",key:"mpwhp6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const a$=q("FileKey2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v6",key:"rc0qvx"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["circle",{cx:"4",cy:"16",r:"2",key:"1ehqvc"}],["path",{d:"m10 10-4.5 4.5",key:"7fwrp6"}],["path",{d:"m9 11 1 1",key:"wa6s5q"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const i$=q("FileKey",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["circle",{cx:"10",cy:"16",r:"2",key:"4ckbqe"}],["path",{d:"m16 10-4.5 4.5",key:"7p3ebg"}],["path",{d:"m15 11 1 1",key:"1bsyx3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const o$=q("FileLock2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v1",key:"jmtmu2"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["rect",{width:"8",height:"5",x:"2",y:"13",rx:"1",key:"10y5wo"}],["path",{d:"M8 13v-2a2 2 0 1 0-4 0v2",key:"1pdxzg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const l$=q("FileLock",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["rect",{width:"8",height:"6",x:"8",y:"12",rx:"1",key:"3yr8at"}],["path",{d:"M10 12v-2a2 2 0 1 1 4 0v2",key:"j4i8d"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const c$=q("FileMinus2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M3 15h6",key:"4e2qda"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const d$=q("FileMinus",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M9 15h6",key:"cctwl0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const u$=q("FileMusic",[["path",{d:"M10.5 22H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v8.4",key:"1d3kfm"}],["path",{d:"M8 18v-7.7L16 9v7",key:"1oie6o"}],["circle",{cx:"14",cy:"16",r:"2",key:"1bzzi3"}],["circle",{cx:"6",cy:"18",r:"2",key:"1fncim"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const h$=q("FileOutput",[["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M4 7V4a2 2 0 0 1 2-2 2 2 0 0 0-2 2",key:"1vk7w2"}],["path",{d:"M4.063 20.999a2 2 0 0 0 2 1L18 22a2 2 0 0 0 2-2V7l-5-5H6",key:"1jink5"}],["path",{d:"m5 11-3 3",key:"1dgrs4"}],["path",{d:"m5 17-3-3h10",key:"1mvvaf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Gb=q("FilePenLine",[["path",{d:"m18 5-2.414-2.414A2 2 0 0 0 14.172 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2",key:"142zxg"}],["path",{d:"M21.378 12.626a1 1 0 0 0-3.004-3.004l-4.01 4.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z",key:"2t3380"}],["path",{d:"M8 18h1",key:"13wk12"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Kb=q("FilePen",[["path",{d:"M12.5 22H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v9.5",key:"1couwa"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M13.378 15.626a1 1 0 1 0-3.004-3.004l-5.01 5.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z",key:"1y4qbx"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const f$=q("FilePlus2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M3 15h6",key:"4e2qda"}],["path",{d:"M6 12v6",key:"1u72j0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const p$=q("FilePlus",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M9 15h6",key:"cctwl0"}],["path",{d:"M12 18v-6",key:"17g6i2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const m$=q("FileQuestion",[["path",{d:"M12 17h.01",key:"p32p05"}],["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z",key:"1mlx9k"}],["path",{d:"M9.1 9a3 3 0 0 1 5.82 1c0 2-3 3-3 3",key:"mhlwft"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const g$=q("FileScan",[["path",{d:"M20 10V7l-5-5H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h4",key:"1rdf37"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M16 14a2 2 0 0 0-2 2",key:"ceaadl"}],["path",{d:"M20 14a2 2 0 0 1 2 2",key:"1ny6zw"}],["path",{d:"M20 22a2 2 0 0 0 2-2",key:"1l9q4k"}],["path",{d:"M16 22a2 2 0 0 1-2-2",key:"1wqh5n"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const x$=q("FileSearch2",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["circle",{cx:"11.5",cy:"14.5",r:"2.5",key:"1bq0ko"}],["path",{d:"M13.3 16.3 15 18",key:"2quom7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const y$=q("FileSearch",[["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M4.268 21a2 2 0 0 0 1.727 1H18a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v3",key:"ms7g94"}],["path",{d:"m9 18-1.5-1.5",key:"1j6qii"}],["circle",{cx:"5",cy:"14",r:"3",key:"ufru5t"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const v$=q("FileSliders",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M10 11v2",key:"1s651w"}],["path",{d:"M8 17h8",key:"wh5c61"}],["path",{d:"M14 16v2",key:"12fp5e"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const q1=q("FileSpreadsheet",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M8 13h2",key:"yr2amv"}],["path",{d:"M14 13h2",key:"un5t4a"}],["path",{d:"M8 17h2",key:"2yhykz"}],["path",{d:"M14 17h2",key:"10kma7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _$=q("FileStack",[["path",{d:"M21 7h-3a2 2 0 0 1-2-2V2",key:"9rb54x"}],["path",{d:"M21 6v6.5c0 .8-.7 1.5-1.5 1.5h-7c-.8 0-1.5-.7-1.5-1.5v-9c0-.8.7-1.5 1.5-1.5H17Z",key:"1059l0"}],["path",{d:"M7 8v8.8c0 .3.2.6.4.8.2.2.5.4.8.4H15",key:"16874u"}],["path",{d:"M3 12v8.8c0 .3.2.6.4.8.2.2.5.4.8.4H11",key:"k2ox98"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const b$=q("FileSymlink",[["path",{d:"m10 18 3-3-3-3",key:"18f6ys"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M4 11V4a2 2 0 0 1 2-2h9l5 5v13a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2v-3a2 2 0 0 1 2-2h7",key:"50q2rw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const w$=q("FileTerminal",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m8 16 2-2-2-2",key:"10vzyd"}],["path",{d:"M12 18h4",key:"1wd2n7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ea=q("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const j$=q("FileType2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M2 13v-1h6v1",key:"1dh9dg"}],["path",{d:"M5 12v6",key:"150t9c"}],["path",{d:"M4 18h2",key:"1xrofg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const k$=q("FileType",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M9 13v-1h6v1",key:"1bb014"}],["path",{d:"M12 12v6",key:"3ahymv"}],["path",{d:"M11 18h2",key:"12mj7e"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const N$=q("FileUp",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M12 12v6",key:"3ahymv"}],["path",{d:"m15 15-3-3-3 3",key:"15xj92"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const S$=q("FileUser",[["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M15 18a3 3 0 1 0-6 0",key:"16awa0"}],["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z",key:"1mlx9k"}],["circle",{cx:"12",cy:"13",r:"2",key:"1c1ljs"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const C$=q("FileVideo2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["rect",{width:"8",height:"6",x:"2",y:"12",rx:"1",key:"1a6c1e"}],["path",{d:"m10 15.5 4 2.5v-6l-4 2.5",key:"t7cp39"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const M$=q("FileVideo",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m10 11 5 3-5 3v-6Z",key:"7ntvm4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const T$=q("FileVolume2",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M8 15h.01",key:"a7atzg"}],["path",{d:"M11.5 13.5a2.5 2.5 0 0 1 0 3",key:"1fccat"}],["path",{d:"M15 12a5 5 0 0 1 0 6",key:"ps46cm"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const A$=q("FileVolume",[["path",{d:"M11 11a5 5 0 0 1 0 6",key:"193qb2"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M4 6.765V4a2 2 0 0 1 2-2h9l5 5v13a2 2 0 0 1-2 2H6a2 2 0 0 1-.93-.23",key:"ifyjnl"}],["path",{d:"M7 10.51a.5.5 0 0 0-.826-.38l-1.893 1.628A1 1 0 0 1 3.63 12H2.5a.5.5 0 0 0-.5.5v3a.5.5 0 0 0 .5.5h1.129a1 1 0 0 1 .652.242l1.893 1.63a.5.5 0 0 0 .826-.38z",key:"mk8rxu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const E$=q("FileWarning",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const I$=q("FileX2",[["path",{d:"M4 22h14a2 2 0 0 0 2-2V7l-5-5H6a2 2 0 0 0-2 2v4",key:"1pf5j1"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m8 12.5-5 5",key:"b853mi"}],["path",{d:"m3 12.5 5 5",key:"1qls4r"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const P$=q("FileX",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"m14.5 12.5-5 5",key:"b62r18"}],["path",{d:"m9.5 12.5 5 5",key:"1rk7el"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const L$=q("File",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const O$=q("Files",[["path",{d:"M20 7h-3a2 2 0 0 1-2-2V2",key:"x099mo"}],["path",{d:"M9 18a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h7l4 4v10a2 2 0 0 1-2 2Z",key:"18t6ie"}],["path",{d:"M3 7.6v12.8A1.6 1.6 0 0 0 4.6 22h9.8",key:"1nja0z"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const eu=q("Film",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M7 3v18",key:"bbkbws"}],["path",{d:"M3 7.5h4",key:"zfgn84"}],["path",{d:"M3 12h18",key:"1i2n21"}],["path",{d:"M3 16.5h4",key:"1230mu"}],["path",{d:"M17 3v18",key:"in4fa5"}],["path",{d:"M17 7.5h4",key:"myr1c1"}],["path",{d:"M17 16.5h4",key:"go4c1d"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const D$=q("FilterX",[["path",{d:"M13.013 3H2l8 9.46V19l4 2v-8.54l.9-1.055",key:"1fi1da"}],["path",{d:"m22 3-5 5",key:"12jva0"}],["path",{d:"m17 3 5 5",key:"k36vhe"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const V1=q("Filter",[["polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3",key:"1yg77f"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const R$=q("Fingerprint",[["path",{d:"M12 10a2 2 0 0 0-2 2c0 1.02-.1 2.51-.26 4",key:"1nerag"}],["path",{d:"M14 13.12c0 2.38 0 6.38-1 8.88",key:"o46ks0"}],["path",{d:"M17.29 21.02c.12-.6.43-2.3.5-3.02",key:"ptglia"}],["path",{d:"M2 12a10 10 0 0 1 18-6",key:"ydlgp0"}],["path",{d:"M2 16h.01",key:"1gqxmh"}],["path",{d:"M21.8 16c.2-2 .131-5.354 0-6",key:"drycrb"}],["path",{d:"M5 19.5C5.5 18 6 15 6 12a6 6 0 0 1 .34-2",key:"1tidbn"}],["path",{d:"M8.65 22c.21-.66.45-1.32.57-2",key:"13wd9y"}],["path",{d:"M9 6.8a6 6 0 0 1 9 5.2v2",key:"1fr1j5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const F$=q("FireExtinguisher",[["path",{d:"M15 6.5V3a1 1 0 0 0-1-1h-2a1 1 0 0 0-1 1v3.5",key:"sqyvz"}],["path",{d:"M9 18h8",key:"i7pszb"}],["path",{d:"M18 3h-3",key:"7idoqj"}],["path",{d:"M11 3a6 6 0 0 0-6 6v11",key:"1v5je3"}],["path",{d:"M5 13h4",key:"svpcxo"}],["path",{d:"M17 10a4 4 0 0 0-8 0v10a2 2 0 0 0 2 2h4a2 2 0 0 0 2-2Z",key:"vsjego"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const z$=q("FishOff",[["path",{d:"M18 12.47v.03m0-.5v.47m-.475 5.056A6.744 6.744 0 0 1 15 18c-3.56 0-7.56-2.53-8.5-6 .348-1.28 1.114-2.433 2.121-3.38m3.444-2.088A8.802 8.802 0 0 1 15 6c3.56 0 6.06 2.54 7 6-.309 1.14-.786 2.177-1.413 3.058",key:"1j1hse"}],["path",{d:"M7 10.67C7 8 5.58 5.97 2.73 5.5c-1 1.5-1 5 .23 6.5-1.24 1.5-1.24 5-.23 6.5C5.58 18.03 7 16 7 13.33m7.48-4.372A9.77 9.77 0 0 1 16 6.07m0 11.86a9.77 9.77 0 0 1-1.728-3.618",key:"1q46z8"}],["path",{d:"m16.01 17.93-.23 1.4A2 2 0 0 1 13.8 21H9.5a5.96 5.96 0 0 0 1.49-3.98M8.53 3h5.27a2 2 0 0 1 1.98 1.67l.23 1.4M2 2l20 20",key:"1407gh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const B$=q("FishSymbol",[["path",{d:"M2 16s9-15 20-4C11 23 2 8 2 8",key:"h4oh4o"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $$=q("Fish",[["path",{d:"M6.5 12c.94-3.46 4.94-6 8.5-6 3.56 0 6.06 2.54 7 6-.94 3.47-3.44 6-7 6s-7.56-2.53-8.5-6Z",key:"15baut"}],["path",{d:"M18 12v.5",key:"18hhni"}],["path",{d:"M16 17.93a9.77 9.77 0 0 1 0-11.86",key:"16dt7o"}],["path",{d:"M7 10.67C7 8 5.58 5.97 2.73 5.5c-1 1.5-1 5 .23 6.5-1.24 1.5-1.24 5-.23 6.5C5.58 18.03 7 16 7 13.33",key:"l9di03"}],["path",{d:"M10.46 7.26C10.2 5.88 9.17 4.24 8 3h5.8a2 2 0 0 1 1.98 1.67l.23 1.4",key:"1kjonw"}],["path",{d:"m16.01 17.93-.23 1.4A2 2 0 0 1 13.8 21H9.5a5.96 5.96 0 0 0 1.49-3.98",key:"1zlm23"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const U$=q("FlagOff",[["path",{d:"M8 2c3 0 5 2 8 2s4-1 4-1v11",key:"9rwyz9"}],["path",{d:"M4 22V4",key:"1plyxx"}],["path",{d:"M4 15s1-1 4-1 5 2 8 2",key:"1myooe"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const q$=q("FlagTriangleLeft",[["path",{d:"M17 22V2L7 7l10 5",key:"1rmf0r"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const V$=q("FlagTriangleRight",[["path",{d:"M7 22V2l10 5-10 5",key:"17n18y"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ly=q("Flag",[["path",{d:"M4 15s1-1 4-1 5 2 8 2 4-1 4-1V3s-1 1-4 1-5-2-8-2-4 1-4 1z",key:"i9b6wo"}],["line",{x1:"4",x2:"4",y1:"22",y2:"15",key:"1cm3nv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const H$=q("FlameKindling",[["path",{d:"M12 2c1 3 2.5 3.5 3.5 4.5A5 5 0 0 1 17 10a5 5 0 1 1-10 0c0-.3 0-.6.1-.9a2 2 0 1 0 3.3-2C8 4.5 11 2 12 2Z",key:"1ir223"}],["path",{d:"m5 22 14-4",key:"1brv4h"}],["path",{d:"m5 18 14 4",key:"lgyyje"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ff=q("Flame",[["path",{d:"M8.5 14.5A2.5 2.5 0 0 0 11 12c0-1.38-.5-2-1-3-1.072-2.143-.224-4.054 2-6 .5 2.5 2 4.9 4 6.5 2 1.6 3 3.5 3 5.5a7 7 0 1 1-14 0c0-1.153.433-2.294 1-3a2.5 2.5 0 0 0 2.5 2.5z",key:"96xj49"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const W$=q("FlashlightOff",[["path",{d:"M16 16v4a2 2 0 0 1-2 2h-4a2 2 0 0 1-2-2V10c0-2-2-2-2-4",key:"1r120k"}],["path",{d:"M7 2h11v4c0 2-2 2-2 4v1",key:"dz1920"}],["line",{x1:"11",x2:"18",y1:"6",y2:"6",key:"bi1vpe"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const G$=q("Flashlight",[["path",{d:"M18 6c0 2-2 2-2 4v10a2 2 0 0 1-2 2h-4a2 2 0 0 1-2-2V10c0-2-2-2-2-4V2h12z",key:"1orkel"}],["line",{x1:"6",x2:"18",y1:"6",y2:"6",key:"1z11jq"}],["line",{x1:"12",x2:"12",y1:"12",y2:"12",key:"1f4yc1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const K$=q("FlaskConicalOff",[["path",{d:"M10 10 4.72 20.55a1 1 0 0 0 .9 1.45h12.76a1 1 0 0 0 .9-1.45l-1.272-2.542",key:"59ek9y"}],["path",{d:"M10 2v2.343",key:"15t272"}],["path",{d:"M14 2v6.343",key:"sxr80q"}],["path",{d:"M8.5 2h7",key:"csnxdl"}],["path",{d:"M7 16h9",key:"t5njau"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ij=q("FlaskConical",[["path",{d:"M10 2v7.527a2 2 0 0 1-.211.896L4.72 20.55a1 1 0 0 0 .9 1.45h12.76a1 1 0 0 0 .9-1.45l-5.069-10.127A2 2 0 0 1 14 9.527V2",key:"pzvekw"}],["path",{d:"M8.5 2h7",key:"csnxdl"}],["path",{d:"M7 16h10",key:"wp8him"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Z$=q("FlaskRound",[["path",{d:"M10 2v7.31",key:"5d1hyh"}],["path",{d:"M14 9.3V1.99",key:"14k4l0"}],["path",{d:"M8.5 2h7",key:"csnxdl"}],["path",{d:"M14 9.3a6.5 6.5 0 1 1-4 0",key:"1r8fvy"}],["path",{d:"M5.52 16h12.96",key:"46hh1i"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Y$=q("FlipHorizontal2",[["path",{d:"m3 7 5 5-5 5V7",key:"couhi7"}],["path",{d:"m21 7-5 5 5 5V7",key:"6ouia7"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 14v2",key:"8jcxud"}],["path",{d:"M12 8v2",key:"1woqiv"}],["path",{d:"M12 2v2",key:"tus03m"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const X$=q("FlipHorizontal",[["path",{d:"M8 3H5a2 2 0 0 0-2 2v14c0 1.1.9 2 2 2h3",key:"1i73f7"}],["path",{d:"M16 3h3a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-3",key:"saxlbk"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 14v2",key:"8jcxud"}],["path",{d:"M12 8v2",key:"1woqiv"}],["path",{d:"M12 2v2",key:"tus03m"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Q$=q("FlipVertical2",[["path",{d:"m17 3-5 5-5-5h10",key:"1ftt6x"}],["path",{d:"m17 21-5-5-5 5h10",key:"1m0wmu"}],["path",{d:"M4 12H2",key:"rhcxmi"}],["path",{d:"M10 12H8",key:"s88cx1"}],["path",{d:"M16 12h-2",key:"10asgb"}],["path",{d:"M22 12h-2",key:"14jgyd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const J$=q("FlipVertical",[["path",{d:"M21 8V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v3",key:"14bfxa"}],["path",{d:"M21 16v3a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-3",key:"14rx03"}],["path",{d:"M4 12H2",key:"rhcxmi"}],["path",{d:"M10 12H8",key:"s88cx1"}],["path",{d:"M16 12h-2",key:"10asgb"}],["path",{d:"M22 12h-2",key:"14jgyd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vm=q("Flower2",[["path",{d:"M12 5a3 3 0 1 1 3 3m-3-3a3 3 0 1 0-3 3m3-3v1M9 8a3 3 0 1 0 3 3M9 8h1m5 0a3 3 0 1 1-3 3m3-3h-1m-2 3v-1",key:"3pnvol"}],["circle",{cx:"12",cy:"8",r:"2",key:"1822b1"}],["path",{d:"M12 10v12",key:"6ubwww"}],["path",{d:"M12 22c4.2 0 7-1.667 7-5-4.2 0-7 1.667-7 5Z",key:"9hd38g"}],["path",{d:"M12 22c-4.2 0-7-1.667-7-5 4.2 0 7 1.667 7 5Z",key:"ufn41s"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const eU=q("Flower",[["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["path",{d:"M12 16.5A4.5 4.5 0 1 1 7.5 12 4.5 4.5 0 1 1 12 7.5a4.5 4.5 0 1 1 4.5 4.5 4.5 4.5 0 1 1-4.5 4.5",key:"14wa3c"}],["path",{d:"M12 7.5V9",key:"1oy5b0"}],["path",{d:"M7.5 12H9",key:"eltsq1"}],["path",{d:"M16.5 12H15",key:"vk5kw4"}],["path",{d:"M12 16.5V15",key:"k7eayi"}],["path",{d:"m8 8 1.88 1.88",key:"nxy4qf"}],["path",{d:"M14.12 9.88 16 8",key:"1lst6k"}],["path",{d:"m8 16 1.88-1.88",key:"h2eex1"}],["path",{d:"M14.12 14.12 16 16",key:"uqkrx3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tU=q("Focus",[["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rU=q("FoldHorizontal",[["path",{d:"M2 12h6",key:"1wqiqv"}],["path",{d:"M22 12h-6",key:"1eg9hc"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 8v2",key:"1woqiv"}],["path",{d:"M12 14v2",key:"8jcxud"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m19 9-3 3 3 3",key:"12ol22"}],["path",{d:"m5 15 3-3-3-3",key:"1kdhjc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nU=q("FoldVertical",[["path",{d:"M12 22v-6",key:"6o8u61"}],["path",{d:"M12 8V2",key:"1wkif3"}],["path",{d:"M4 12H2",key:"rhcxmi"}],["path",{d:"M10 12H8",key:"s88cx1"}],["path",{d:"M16 12h-2",key:"10asgb"}],["path",{d:"M22 12h-2",key:"14jgyd"}],["path",{d:"m15 19-3-3-3 3",key:"e37ymu"}],["path",{d:"m15 5-3 3-3-3",key:"19d6lf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sU=q("FolderArchive",[["circle",{cx:"15",cy:"19",r:"2",key:"u2pros"}],["path",{d:"M20.9 19.8A2 2 0 0 0 22 18V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2h5.1",key:"1jj40k"}],["path",{d:"M15 11v-1",key:"cntcp"}],["path",{d:"M15 17v-2",key:"1279jj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const aU=q("FolderCheck",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}],["path",{d:"m9 13 2 2 4-4",key:"6343dt"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const iU=q("FolderClock",[["circle",{cx:"16",cy:"16",r:"6",key:"qoo3c4"}],["path",{d:"M7 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2",key:"1urifu"}],["path",{d:"M16 14v2l1 1",key:"xth2jh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oU=q("FolderClosed",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}],["path",{d:"M2 10h20",key:"1ir3d8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lU=q("FolderCode",[["path",{d:"M10 10.5 8 13l2 2.5",key:"m4t9c1"}],["path",{d:"m14 10.5 2 2.5-2 2.5",key:"14w2eb"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2z",key:"1u1bxd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Zb=q("FolderCog",[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["path",{d:"M10.3 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v3.3",key:"1k8050"}],["path",{d:"m21.7 19.4-.9-.3",key:"1qgwi9"}],["path",{d:"m15.2 16.9-.9-.3",key:"1t7mvx"}],["path",{d:"m16.6 21.7.3-.9",key:"1j67ps"}],["path",{d:"m19.1 15.2.3-.9",key:"18r7jp"}],["path",{d:"m19.6 21.7-.4-1",key:"z2vh2"}],["path",{d:"m16.8 15.3-.4-1",key:"1ei7r6"}],["path",{d:"m14.3 19.6 1-.4",key:"11sv9r"}],["path",{d:"m20.7 16.8 1-.4",key:"19m87a"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cU=q("FolderDot",[["path",{d:"M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.93a2 2 0 0 1-1.66-.9l-.82-1.2A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13c0 1.1.9 2 2 2Z",key:"1fr9dc"}],["circle",{cx:"12",cy:"13",r:"1",key:"49l61u"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dU=q("FolderDown",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}],["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"m15 13-3 3-3-3",key:"6j2sf0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uU=q("FolderGit2",[["path",{d:"M9 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v5",key:"1w6njk"}],["circle",{cx:"13",cy:"12",r:"2",key:"1j92g6"}],["path",{d:"M18 19c-2.8 0-5-2.2-5-5v8",key:"pkpw2h"}],["circle",{cx:"20",cy:"19",r:"2",key:"1obnsp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hU=q("FolderGit",[["circle",{cx:"12",cy:"13",r:"2",key:"1c1ljs"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}],["path",{d:"M14 13h3",key:"1dgedf"}],["path",{d:"M7 13h3",key:"1pygq7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fU=q("FolderHeart",[["path",{d:"M11 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v1.5",key:"6hud8k"}],["path",{d:"M13.9 17.45c-1.2-1.2-1.14-2.8-.2-3.73a2.43 2.43 0 0 1 3.44 0l.36.34.34-.34a2.43 2.43 0 0 1 3.45-.01c.95.95 1 2.53-.2 3.74L17.5 21Z",key:"wpff58"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pU=q("FolderInput",[["path",{d:"M2 9V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-1",key:"fm4g5t"}],["path",{d:"M2 13h10",key:"pgb2dq"}],["path",{d:"m9 16 3-3-3-3",key:"6m91ic"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mU=q("FolderKanban",[["path",{d:"M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.93a2 2 0 0 1-1.66-.9l-.82-1.2A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13c0 1.1.9 2 2 2Z",key:"1fr9dc"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M12 10v2",key:"hh53o1"}],["path",{d:"M16 10v6",key:"1d6xys"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gU=q("FolderKey",[["circle",{cx:"16",cy:"20",r:"2",key:"1vifvg"}],["path",{d:"M10 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v2",key:"3hgo9p"}],["path",{d:"m22 14-4.5 4.5",key:"1ef6z8"}],["path",{d:"m21 15 1 1",key:"1ejcpy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xU=q("FolderLock",[["rect",{width:"8",height:"5",x:"14",y:"17",rx:"1",key:"19aais"}],["path",{d:"M10 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v2.5",key:"1w6v7t"}],["path",{d:"M20 17v-2a2 2 0 1 0-4 0v2",key:"pwaxnr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yU=q("FolderMinus",[["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vU=q("FolderOpenDot",[["path",{d:"m6 14 1.45-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.55 6a2 2 0 0 1-1.94 1.5H4a2 2 0 0 1-2-2V5c0-1.1.9-2 2-2h3.93a2 2 0 0 1 1.66.9l.82 1.2a2 2 0 0 0 1.66.9H18a2 2 0 0 1 2 2v2",key:"1nmvlm"}],["circle",{cx:"14",cy:"15",r:"1",key:"1gm4qj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Tm=q("FolderOpen",[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _U=q("FolderOutput",[["path",{d:"M2 7.5V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-1.5",key:"1yk7aj"}],["path",{d:"M2 13h10",key:"pgb2dq"}],["path",{d:"m5 10-3 3 3 3",key:"1r8ie0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Yb=q("FolderPen",[["path",{d:"M2 11.5V5a2 2 0 0 1 2-2h3.9c.7 0 1.3.3 1.7.9l.8 1.2c.4.6 1 .9 1.7.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2h-9.5",key:"a8xqs0"}],["path",{d:"M11.378 13.626a1 1 0 1 0-3.004-3.004l-5.01 5.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z",key:"1saktj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bU=q("FolderPlus",[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wU=q("FolderRoot",[["path",{d:"M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.93a2 2 0 0 1-1.66-.9l-.82-1.2A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13c0 1.1.9 2 2 2Z",key:"1fr9dc"}],["circle",{cx:"12",cy:"13",r:"2",key:"1c1ljs"}],["path",{d:"M12 15v5",key:"11xva1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jU=q("FolderSearch2",[["circle",{cx:"11.5",cy:"12.5",r:"2.5",key:"1ea5ju"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}],["path",{d:"M13.3 14.3 15 16",key:"1y4v1n"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kU=q("FolderSearch",[["path",{d:"M10.7 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v4.1",key:"1bw5m7"}],["path",{d:"m21 21-1.9-1.9",key:"1g2n9r"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const NU=q("FolderSymlink",[["path",{d:"M2 9V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-3a2 2 0 0 1 2-2h7",key:"x1c07l"}],["path",{d:"m8 16 3-3-3-3",key:"rlqrt1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const SU=q("FolderSync",[["path",{d:"M9 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v.5",key:"1dkoa9"}],["path",{d:"M12 10v4h4",key:"1czhmt"}],["path",{d:"m12 14 1.535-1.605a5 5 0 0 1 8 1.5",key:"lvuxfi"}],["path",{d:"M22 22v-4h-4",key:"1ewp4q"}],["path",{d:"m22 18-1.535 1.605a5 5 0 0 1-8-1.5",key:"14ync0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const CU=q("FolderTree",[["path",{d:"M20 10a1 1 0 0 0 1-1V6a1 1 0 0 0-1-1h-2.5a1 1 0 0 1-.8-.4l-.9-1.2A1 1 0 0 0 15 3h-2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"hod4my"}],["path",{d:"M20 21a1 1 0 0 0 1-1v-3a1 1 0 0 0-1-1h-2.9a1 1 0 0 1-.88-.55l-.42-.85a1 1 0 0 0-.92-.6H13a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1Z",key:"w4yl2u"}],["path",{d:"M3 5a2 2 0 0 0 2 2h3",key:"f2jnh7"}],["path",{d:"M3 3v13a2 2 0 0 0 2 2h3",key:"k8epm1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const MU=q("FolderUp",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}],["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"m9 13 3-3 3 3",key:"1pxg3c"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const TU=q("FolderX",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}],["path",{d:"m9.5 10.5 5 5",key:"ra9qjz"}],["path",{d:"m14.5 10.5-5 5",key:"l2rkpq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const AU=q("Folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const EU=q("Folders",[["path",{d:"M20 17a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3.9a2 2 0 0 1-1.69-.9l-.81-1.2a2 2 0 0 0-1.67-.9H8a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2Z",key:"4u7rpt"}],["path",{d:"M2 8v11a2 2 0 0 0 2 2h14",key:"1eicx1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const IU=q("Footprints",[["path",{d:"M4 16v-2.38C4 11.5 2.97 10.5 3 8c.03-2.72 1.49-6 4.5-6C9.37 2 10 3.8 10 5.5c0 3.11-2 5.66-2 8.68V16a2 2 0 1 1-4 0Z",key:"1dudjm"}],["path",{d:"M20 20v-2.38c0-2.12 1.03-3.12 1-5.62-.03-2.72-1.49-6-4.5-6C14.63 6 14 7.8 14 9.5c0 3.11 2 5.66 2 8.68V20a2 2 0 1 0 4 0Z",key:"l2t8xc"}],["path",{d:"M16 17h4",key:"1dejxt"}],["path",{d:"M4 13h4",key:"1bwh8b"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const PU=q("Forklift",[["path",{d:"M12 12H5a2 2 0 0 0-2 2v5",key:"7zsz91"}],["circle",{cx:"13",cy:"19",r:"2",key:"wjnkru"}],["circle",{cx:"5",cy:"19",r:"2",key:"v8kfzx"}],["path",{d:"M8 19h3m5-17v17h6M6 12V7c0-1.1.9-2 2-2h3l5 5",key:"13bk1p"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const LU=q("Forward",[["polyline",{points:"15 17 20 12 15 7",key:"1w3sku"}],["path",{d:"M4 18v-2a4 4 0 0 1 4-4h12",key:"jmiej9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const OU=q("Frame",[["line",{x1:"22",x2:"2",y1:"6",y2:"6",key:"15w7dq"}],["line",{x1:"22",x2:"2",y1:"18",y2:"18",key:"1ip48p"}],["line",{x1:"6",x2:"6",y1:"2",y2:"22",key:"a2lnyx"}],["line",{x1:"18",x2:"18",y1:"2",y2:"22",key:"8vb6jd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const DU=q("Framer",[["path",{d:"M5 16V9h14V2H5l14 14h-7m-7 0 7 7v-7m-7 0h7",key:"1a2nng"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const RU=q("Frown",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M16 16s-1.5-2-4-2-4 2-4 2",key:"epbg0q"}],["line",{x1:"9",x2:"9.01",y1:"9",y2:"9",key:"yxxnd0"}],["line",{x1:"15",x2:"15.01",y1:"9",y2:"9",key:"1p4y9e"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const FU=q("Fuel",[["line",{x1:"3",x2:"15",y1:"22",y2:"22",key:"xegly4"}],["line",{x1:"4",x2:"14",y1:"9",y2:"9",key:"xcnuvu"}],["path",{d:"M14 22V4a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v18",key:"16j0yd"}],["path",{d:"M14 13h2a2 2 0 0 1 2 2v2a2 2 0 0 0 2 2a2 2 0 0 0 2-2V9.83a2 2 0 0 0-.59-1.42L18 5",key:"7cu91f"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zU=q("Fullscreen",[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}],["rect",{width:"10",height:"8",x:"7",y:"8",rx:"1",key:"vys8me"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const BU=q("GalleryHorizontalEnd",[["path",{d:"M2 7v10",key:"a2pl2d"}],["path",{d:"M6 5v14",key:"1kq3d7"}],["rect",{width:"12",height:"18",x:"10",y:"3",rx:"2",key:"13i7bc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $U=q("GalleryHorizontal",[["path",{d:"M2 3v18",key:"pzttux"}],["rect",{width:"12",height:"18",x:"6",y:"3",rx:"2",key:"btr8bg"}],["path",{d:"M22 3v18",key:"6jf3v"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const UU=q("GalleryThumbnails",[["rect",{width:"18",height:"14",x:"3",y:"3",rx:"2",key:"74y24f"}],["path",{d:"M4 21h1",key:"16zlid"}],["path",{d:"M9 21h1",key:"15o7lz"}],["path",{d:"M14 21h1",key:"v9vybs"}],["path",{d:"M19 21h1",key:"edywat"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qU=q("GalleryVerticalEnd",[["path",{d:"M7 2h10",key:"nczekb"}],["path",{d:"M5 6h14",key:"u2x4p"}],["rect",{width:"18",height:"12",x:"3",y:"10",rx:"2",key:"l0tzu3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const VU=q("GalleryVertical",[["path",{d:"M3 2h18",key:"15qxfx"}],["rect",{width:"18",height:"12",x:"3",y:"6",rx:"2",key:"1439r6"}],["path",{d:"M3 22h18",key:"8prr45"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const HU=q("Gamepad2",[["line",{x1:"6",x2:"10",y1:"11",y2:"11",key:"1gktln"}],["line",{x1:"8",x2:"8",y1:"9",y2:"13",key:"qnk9ow"}],["line",{x1:"15",x2:"15.01",y1:"12",y2:"12",key:"krot7o"}],["line",{x1:"18",x2:"18.01",y1:"10",y2:"10",key:"1lcuu1"}],["path",{d:"M17.32 5H6.68a4 4 0 0 0-3.978 3.59c-.006.052-.01.101-.017.152C2.604 9.416 2 14.456 2 16a3 3 0 0 0 3 3c1 0 1.5-.5 2-1l1.414-1.414A2 2 0 0 1 9.828 16h4.344a2 2 0 0 1 1.414.586L17 18c.5.5 1 1 2 1a3 3 0 0 0 3-3c0-1.545-.604-6.584-.685-7.258-.007-.05-.011-.1-.017-.151A4 4 0 0 0 17.32 5z",key:"mfqc10"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const WU=q("Gamepad",[["line",{x1:"6",x2:"10",y1:"12",y2:"12",key:"161bw2"}],["line",{x1:"8",x2:"8",y1:"10",y2:"14",key:"1i6ji0"}],["line",{x1:"15",x2:"15.01",y1:"13",y2:"13",key:"dqpgro"}],["line",{x1:"18",x2:"18.01",y1:"11",y2:"11",key:"meh2c"}],["rect",{width:"20",height:"12",x:"2",y:"6",rx:"2",key:"9lu3g6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const GU=q("Gauge",[["path",{d:"m12 14 4-4",key:"9kzdfg"}],["path",{d:"M3.34 19a10 10 0 1 1 17.32 0",key:"19p75a"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const KU=q("Gavel",[["path",{d:"m14.5 12.5-8 8a2.119 2.119 0 1 1-3-3l8-8",key:"15492f"}],["path",{d:"m16 16 6-6",key:"vzrcl6"}],["path",{d:"m8 8 6-6",key:"18bi4p"}],["path",{d:"m9 7 8 8",key:"5jnvq1"}],["path",{d:"m21 11-8-8",key:"z4y7zo"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ZU=q("Gem",[["path",{d:"M6 3h12l4 6-10 13L2 9Z",key:"1pcd5k"}],["path",{d:"M11 3 8 9l4 13 4-13-3-6",key:"1fcu3u"}],["path",{d:"M2 9h20",key:"16fsjt"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Pj=q("Ghost",[["path",{d:"M9 10h.01",key:"qbtxuw"}],["path",{d:"M15 10h.01",key:"1qmjsl"}],["path",{d:"M12 2a8 8 0 0 0-8 8v12l3-3 2.5 2.5L12 19l2.5 2.5L17 19l3 3V10a8 8 0 0 0-8-8z",key:"uwwb07"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const to=q("Gift",[["rect",{x:"3",y:"8",width:"18",height:"4",rx:"1",key:"bkv52"}],["path",{d:"M12 8v13",key:"1c76mn"}],["path",{d:"M19 12v7a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2v-7",key:"6wjy6b"}],["path",{d:"M7.5 8a2.5 2.5 0 0 1 0-5A4.8 8 0 0 1 12 8a4.8 8 0 0 1 4.5-5 2.5 2.5 0 0 1 0 5",key:"1ihvrl"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const YU=q("GitBranchPlus",[["path",{d:"M6 3v12",key:"qpgusn"}],["path",{d:"M18 9a3 3 0 1 0 0-6 3 3 0 0 0 0 6z",key:"1d02ji"}],["path",{d:"M6 21a3 3 0 1 0 0-6 3 3 0 0 0 0 6z",key:"chk6ph"}],["path",{d:"M15 6a9 9 0 0 0-9 9",key:"or332x"}],["path",{d:"M18 15v6",key:"9wciyi"}],["path",{d:"M21 18h-6",key:"139f0c"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const XU=q("GitBranch",[["line",{x1:"6",x2:"6",y1:"3",y2:"15",key:"17qcm7"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M18 9a9 9 0 0 1-9 9",key:"n2h4wq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Xb=q("GitCommitHorizontal",[["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["line",{x1:"3",x2:"9",y1:"12",y2:"12",key:"1dyftd"}],["line",{x1:"15",x2:"21",y1:"12",y2:"12",key:"oup4p8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const QU=q("GitCommitVertical",[["path",{d:"M12 3v6",key:"1holv5"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["path",{d:"M12 15v6",key:"a9ows0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const JU=q("GitCompareArrows",[["circle",{cx:"5",cy:"6",r:"3",key:"1qnov2"}],["path",{d:"M12 6h5a2 2 0 0 1 2 2v7",key:"1yj91y"}],["path",{d:"m15 9-3-3 3-3",key:"1lwv8l"}],["circle",{cx:"19",cy:"18",r:"3",key:"1qljk2"}],["path",{d:"M12 18H7a2 2 0 0 1-2-2V9",key:"16sdep"}],["path",{d:"m9 15 3 3-3 3",key:"1m3kbl"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const eq=q("GitCompare",[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M13 6h3a2 2 0 0 1 2 2v7",key:"1yeb86"}],["path",{d:"M11 18H8a2 2 0 0 1-2-2V9",key:"19pyzm"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tq=q("GitFork",[["circle",{cx:"12",cy:"18",r:"3",key:"1mpf1b"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["path",{d:"M18 9v2c0 .6-.4 1-1 1H7c-.6 0-1-.4-1-1V9",key:"1uq4wg"}],["path",{d:"M12 12v3",key:"158kv8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rq=q("GitGraph",[["circle",{cx:"5",cy:"6",r:"3",key:"1qnov2"}],["path",{d:"M5 9v6",key:"158jrl"}],["circle",{cx:"5",cy:"18",r:"3",key:"104gr9"}],["path",{d:"M12 3v18",key:"108xh3"}],["circle",{cx:"19",cy:"6",r:"3",key:"108a5v"}],["path",{d:"M16 15.7A9 9 0 0 0 19 9",key:"1e3vqb"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nq=q("GitMerge",[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M6 21V9a9 9 0 0 0 9 9",key:"7kw0sc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sq=q("GitPullRequestArrow",[["circle",{cx:"5",cy:"6",r:"3",key:"1qnov2"}],["path",{d:"M5 9v12",key:"ih889a"}],["circle",{cx:"19",cy:"18",r:"3",key:"1qljk2"}],["path",{d:"m15 9-3-3 3-3",key:"1lwv8l"}],["path",{d:"M12 6h5a2 2 0 0 1 2 2v7",key:"1yj91y"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const aq=q("GitPullRequestClosed",[["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M6 9v12",key:"1sc30k"}],["path",{d:"m21 3-6 6",key:"16nqsk"}],["path",{d:"m21 9-6-6",key:"9j17rh"}],["path",{d:"M18 11.5V15",key:"65xf6f"}],["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const iq=q("GitPullRequestCreateArrow",[["circle",{cx:"5",cy:"6",r:"3",key:"1qnov2"}],["path",{d:"M5 9v12",key:"ih889a"}],["path",{d:"m15 9-3-3 3-3",key:"1lwv8l"}],["path",{d:"M12 6h5a2 2 0 0 1 2 2v3",key:"1rbwk6"}],["path",{d:"M19 15v6",key:"10aioa"}],["path",{d:"M22 18h-6",key:"1d5gi5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oq=q("GitPullRequestCreate",[["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M6 9v12",key:"1sc30k"}],["path",{d:"M13 6h3a2 2 0 0 1 2 2v3",key:"1jb6z3"}],["path",{d:"M18 15v6",key:"9wciyi"}],["path",{d:"M21 18h-6",key:"139f0c"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lq=q("GitPullRequestDraft",[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M18 6V5",key:"1oao2s"}],["path",{d:"M18 11v-1",key:"11c8tz"}],["line",{x1:"6",x2:"6",y1:"9",y2:"21",key:"rroup"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cq=q("GitPullRequest",[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M13 6h3a2 2 0 0 1 2 2v7",key:"1yeb86"}],["line",{x1:"6",x2:"6",y1:"9",y2:"21",key:"rroup"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dq=q("Github",[["path",{d:"M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4",key:"tonef"}],["path",{d:"M9 18c-4.51 2-5-2-7-2",key:"9comsn"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uq=q("Gitlab",[["path",{d:"m22 13.29-3.33-10a.42.42 0 0 0-.14-.18.38.38 0 0 0-.22-.11.39.39 0 0 0-.23.07.42.42 0 0 0-.14.18l-2.26 6.67H8.32L6.1 3.26a.42.42 0 0 0-.1-.18.38.38 0 0 0-.26-.08.39.39 0 0 0-.23.07.42.42 0 0 0-.14.18L2 13.29a.74.74 0 0 0 .27.83L12 21l9.69-6.88a.71.71 0 0 0 .31-.83Z",key:"148pdi"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hq=q("GlassWater",[["path",{d:"M5.116 4.104A1 1 0 0 1 6.11 3h11.78a1 1 0 0 1 .994 1.105L17.19 20.21A2 2 0 0 1 15.2 22H8.8a2 2 0 0 1-2-1.79z",key:"p55z4y"}],["path",{d:"M6 12a5 5 0 0 1 6 0 5 5 0 0 0 6 0",key:"mjntcy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fq=q("Glasses",[["circle",{cx:"6",cy:"15",r:"4",key:"vux9w4"}],["circle",{cx:"18",cy:"15",r:"4",key:"18o8ve"}],["path",{d:"M14 15a2 2 0 0 0-2-2 2 2 0 0 0-2 2",key:"1ag4bs"}],["path",{d:"M2.5 13 5 7c.7-1.3 1.4-2 3-2",key:"1hm1gs"}],["path",{d:"M21.5 13 19 7c-.7-1.3-1.5-2-3-2",key:"1r31ai"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pq=q("GlobeLock",[["path",{d:"M15.686 15A14.5 14.5 0 0 1 12 22a14.5 14.5 0 0 1 0-20 10 10 0 1 0 9.542 13",key:"qkt0x6"}],["path",{d:"M2 12h8.5",key:"ovaggd"}],["path",{d:"M20 6V4a2 2 0 1 0-4 0v2",key:"1of5e8"}],["rect",{width:"8",height:"5",x:"14",y:"6",rx:"1",key:"1fmf51"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cy=q("Globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mq=q("Goal",[["path",{d:"M12 13V2l8 4-8 4",key:"5wlwwj"}],["path",{d:"M20.561 10.222a9 9 0 1 1-12.55-5.29",key:"1c0wjv"}],["path",{d:"M8.002 9.997a5 5 0 1 0 8.9 2.02",key:"gb1g7m"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gq=q("Grab",[["path",{d:"M18 11.5V9a2 2 0 0 0-2-2a2 2 0 0 0-2 2v1.4",key:"edstyy"}],["path",{d:"M14 10V8a2 2 0 0 0-2-2a2 2 0 0 0-2 2v2",key:"19wdwo"}],["path",{d:"M10 9.9V9a2 2 0 0 0-2-2a2 2 0 0 0-2 2v5",key:"1lugqo"}],["path",{d:"M6 14a2 2 0 0 0-2-2a2 2 0 0 0-2 2",key:"1hbeus"}],["path",{d:"M18 11a2 2 0 1 1 4 0v3a8 8 0 0 1-8 8h-4a8 8 0 0 1-8-8 2 2 0 1 1 4 0",key:"1etffm"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const H1=q("GraduationCap",[["path",{d:"M21.42 10.922a1 1 0 0 0-.019-1.838L12.83 5.18a2 2 0 0 0-1.66 0L2.6 9.08a1 1 0 0 0 0 1.832l8.57 3.908a2 2 0 0 0 1.66 0z",key:"j76jl0"}],["path",{d:"M22 10v6",key:"1lu8f3"}],["path",{d:"M6 12.5V16a6 3 0 0 0 12 0v-3.5",key:"1r8lef"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xq=q("Grape",[["path",{d:"M22 5V2l-5.89 5.89",key:"1eenpo"}],["circle",{cx:"16.6",cy:"15.89",r:"3",key:"xjtalx"}],["circle",{cx:"8.11",cy:"7.4",r:"3",key:"u2fv6i"}],["circle",{cx:"12.35",cy:"11.65",r:"3",key:"i6i8g7"}],["circle",{cx:"13.91",cy:"5.85",r:"3",key:"6ye0dv"}],["circle",{cx:"18.15",cy:"10.09",r:"3",key:"snx9no"}],["circle",{cx:"6.56",cy:"13.2",r:"3",key:"17x4xg"}],["circle",{cx:"10.8",cy:"17.44",r:"3",key:"1hogw9"}],["circle",{cx:"5",cy:"19",r:"3",key:"1sn6vo"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yq=q("Grid2x2Check",[["path",{d:"M12 3v17a1 1 0 0 1-1 1H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v6a1 1 0 0 1-1 1H3",key:"11za1p"}],["path",{d:"m16 19 2 2 4-4",key:"1b14m6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Qb=q("Grid2x2Plus",[["path",{d:"M12 3v17a1 1 0 0 1-1 1H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v6a1 1 0 0 1-1 1H3",key:"11za1p"}],["path",{d:"M16 19h6",key:"xwg31i"}],["path",{d:"M19 22v-6",key:"qhmiwi"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vq=q("Grid2x2X",[["path",{d:"M12 3v17a1 1 0 0 1-1 1H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v6a1 1 0 0 1-1 1H3",key:"11za1p"}],["path",{d:"m16 16 5 5",key:"8tpb07"}],["path",{d:"m16 21 5-5",key:"193jll"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Jb=q("Grid2x2",[["path",{d:"M12 3v18",key:"108xh3"}],["path",{d:"M3 12h18",key:"1i2n21"}],["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",key:"h1oib"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Qh=q("Grid3x3",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"M15 3v18",key:"14nvp0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _q=q("GripHorizontal",[["circle",{cx:"12",cy:"9",r:"1",key:"124mty"}],["circle",{cx:"19",cy:"9",r:"1",key:"1ruzo2"}],["circle",{cx:"5",cy:"9",r:"1",key:"1a8b28"}],["circle",{cx:"12",cy:"15",r:"1",key:"1e56xg"}],["circle",{cx:"19",cy:"15",r:"1",key:"1a92ep"}],["circle",{cx:"5",cy:"15",r:"1",key:"5r1jwy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dy=q("GripVertical",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bq=q("Grip",[["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"19",cy:"5",r:"1",key:"w8mnmm"}],["circle",{cx:"5",cy:"5",r:"1",key:"lttvr7"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}],["circle",{cx:"19",cy:"19",r:"1",key:"shf9b7"}],["circle",{cx:"5",cy:"19",r:"1",key:"bfqh0e"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wq=q("Group",[["path",{d:"M3 7V5c0-1.1.9-2 2-2h2",key:"adw53z"}],["path",{d:"M17 3h2c1.1 0 2 .9 2 2v2",key:"an4l38"}],["path",{d:"M21 17v2c0 1.1-.9 2-2 2h-2",key:"144t0e"}],["path",{d:"M7 21H5c-1.1 0-2-.9-2-2v-2",key:"rtnfgi"}],["rect",{width:"7",height:"5",x:"7",y:"7",rx:"1",key:"1eyiv7"}],["rect",{width:"7",height:"5",x:"10",y:"12",rx:"1",key:"1qlmkx"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jq=q("Guitar",[["path",{d:"m11.9 12.1 4.514-4.514",key:"109xqo"}],["path",{d:"M20.1 2.3a1 1 0 0 0-1.4 0l-1.114 1.114A2 2 0 0 0 17 4.828v1.344a2 2 0 0 1-.586 1.414A2 2 0 0 1 17.828 7h1.344a2 2 0 0 0 1.414-.586L21.7 5.3a1 1 0 0 0 0-1.4z",key:"txyc8t"}],["path",{d:"m6 16 2 2",key:"16qmzd"}],["path",{d:"M8.2 9.9C8.7 8.8 9.8 8 11 8c2.8 0 5 2.2 5 5 0 1.2-.8 2.3-1.9 2.8l-.9.4A2 2 0 0 0 12 18a4 4 0 0 1-4 4c-3.3 0-6-2.7-6-6a4 4 0 0 1 4-4 2 2 0 0 0 1.8-1.2z",key:"1u8q3z"}],["circle",{cx:"11.5",cy:"12.5",r:".5",fill:"currentColor",key:"16onso"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kq=q("Ham",[["path",{d:"M13.144 21.144A7.274 10.445 45 1 0 2.856 10.856",key:"1k1t7q"}],["path",{d:"M13.144 21.144A7.274 4.365 45 0 0 2.856 10.856a7.274 4.365 45 0 0 10.288 10.288",key:"153t1g"}],["path",{d:"M16.565 10.435 18.6 8.4a2.501 2.501 0 1 0 1.65-4.65 2.5 2.5 0 1 0-4.66 1.66l-2.024 2.025",key:"gzrt0n"}],["path",{d:"m8.5 16.5-1-1",key:"otr954"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Nq=q("Hammer",[["path",{d:"m15 12-8.373 8.373a1 1 0 1 1-3-3L12 9",key:"eefl8a"}],["path",{d:"m18 15 4-4",key:"16gjal"}],["path",{d:"m21.5 11.5-1.914-1.914A2 2 0 0 1 19 8.172V7l-2.26-2.26a6 6 0 0 0-4.202-1.756L9 2.96l.92.82A6.18 6.18 0 0 1 12 8.4V10l2 2h1.172a2 2 0 0 1 1.414.586L18.5 14.5",key:"b7pghm"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Sq=q("HandCoins",[["path",{d:"M11 15h2a2 2 0 1 0 0-4h-3c-.6 0-1.1.2-1.4.6L3 17",key:"geh8rc"}],["path",{d:"m7 21 1.6-1.4c.3-.4.8-.6 1.4-.6h4c1.1 0 2.1-.4 2.8-1.2l4.6-4.4a2 2 0 0 0-2.75-2.91l-4.2 3.9",key:"1fto5m"}],["path",{d:"m2 16 6 6",key:"1pfhp9"}],["circle",{cx:"16",cy:"9",r:"2.9",key:"1n0dlu"}],["circle",{cx:"6",cy:"5",r:"3",key:"151irh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Cq=q("HandHeart",[["path",{d:"M11 14h2a2 2 0 1 0 0-4h-3c-.6 0-1.1.2-1.4.6L3 16",key:"1ifwr1"}],["path",{d:"m7 20 1.6-1.4c.3-.4.8-.6 1.4-.6h4c1.1 0 2.1-.4 2.8-1.2l4.6-4.4a2 2 0 0 0-2.75-2.91l-4.2 3.9",key:"17abbs"}],["path",{d:"m2 15 6 6",key:"10dquu"}],["path",{d:"M19.5 8.5c.7-.7 1.5-1.6 1.5-2.7A2.73 2.73 0 0 0 16 4a2.78 2.78 0 0 0-5 1.8c0 1.2.8 2 1.5 2.8L16 12Z",key:"1h3036"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const e2=q("HandHelping",[["path",{d:"M11 12h2a2 2 0 1 0 0-4h-3c-.6 0-1.1.2-1.4.6L3 14",key:"1j4xps"}],["path",{d:"m7 18 1.6-1.4c.3-.4.8-.6 1.4-.6h4c1.1 0 2.1-.4 2.8-1.2l4.6-4.4a2 2 0 0 0-2.75-2.91l-4.2 3.9",key:"uospg8"}],["path",{d:"m2 13 6 6",key:"16e5sb"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Mq=q("HandMetal",[["path",{d:"M18 12.5V10a2 2 0 0 0-2-2a2 2 0 0 0-2 2v1.4",key:"wc6myp"}],["path",{d:"M14 11V9a2 2 0 1 0-4 0v2",key:"94qvcw"}],["path",{d:"M10 10.5V5a2 2 0 1 0-4 0v9",key:"m1ah89"}],["path",{d:"m7 15-1.76-1.76a2 2 0 0 0-2.83 2.82l3.6 3.6C7.5 21.14 9.2 22 12 22h2a8 8 0 0 0 8-8V7a2 2 0 1 0-4 0v5",key:"t1skq1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Tq=q("HandPlatter",[["path",{d:"M12 3V2",key:"ar7q03"}],["path",{d:"m15.4 17.4 3.2-2.8a2 2 0 1 1 2.8 2.9l-3.6 3.3c-.7.8-1.7 1.2-2.8 1.2h-4c-1.1 0-2.1-.4-2.8-1.2l-1.302-1.464A1 1 0 0 0 6.151 19H5",key:"n2g93r"}],["path",{d:"M2 14h12a2 2 0 0 1 0 4h-2",key:"1o2jem"}],["path",{d:"M4 10h16",key:"img6z1"}],["path",{d:"M5 10a7 7 0 0 1 14 0",key:"1ega1o"}],["path",{d:"M5 14v6a1 1 0 0 1-1 1H2",key:"1hescx"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Aq=q("Hand",[["path",{d:"M18 11V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2",key:"1fvzgz"}],["path",{d:"M14 10V4a2 2 0 0 0-2-2a2 2 0 0 0-2 2v2",key:"1kc0my"}],["path",{d:"M10 10.5V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2v8",key:"10h0bg"}],["path",{d:"M18 8a2 2 0 1 1 4 0v6a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15",key:"1s1gnw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Eq=q("Handshake",[["path",{d:"m11 17 2 2a1 1 0 1 0 3-3",key:"efffak"}],["path",{d:"m14 14 2.5 2.5a1 1 0 1 0 3-3l-3.88-3.88a3 3 0 0 0-4.24 0l-.88.88a1 1 0 1 1-3-3l2.81-2.81a5.79 5.79 0 0 1 7.06-.87l.47.28a2 2 0 0 0 1.42.25L21 4",key:"9pr0kb"}],["path",{d:"m21 3 1 11h-2",key:"1tisrp"}],["path",{d:"M3 3 2 14l6.5 6.5a1 1 0 1 0 3-3",key:"1uvwmv"}],["path",{d:"M3 4h8",key:"1ep09j"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Iq=q("HardDriveDownload",[["path",{d:"M12 2v8",key:"1q4o3n"}],["path",{d:"m16 6-4 4-4-4",key:"6wukr"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",key:"w68u3i"}],["path",{d:"M6 18h.01",key:"uhywen"}],["path",{d:"M10 18h.01",key:"h775k"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Pq=q("HardDriveUpload",[["path",{d:"m16 6-4-4-4 4",key:"13yo43"}],["path",{d:"M12 2v8",key:"1q4o3n"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",key:"w68u3i"}],["path",{d:"M6 18h.01",key:"uhywen"}],["path",{d:"M10 18h.01",key:"h775k"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sA=q("HardDrive",[["line",{x1:"22",x2:"2",y1:"12",y2:"12",key:"1y58io"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}],["line",{x1:"6",x2:"6.01",y1:"16",y2:"16",key:"sgf278"}],["line",{x1:"10",x2:"10.01",y1:"16",y2:"16",key:"1l4acy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Lq=q("HardHat",[["path",{d:"M10 10V5a1 1 0 0 1 1-1h2a1 1 0 0 1 1 1v5",key:"1p9q5i"}],["path",{d:"M14 6a6 6 0 0 1 6 6v3",key:"1hnv84"}],["path",{d:"M4 15v-3a6 6 0 0 1 6-6",key:"9ciidu"}],["rect",{x:"2",y:"15",width:"20",height:"4",rx:"1",key:"g3x8cw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wS=q("Hash",[["line",{x1:"4",x2:"20",y1:"9",y2:"9",key:"4lhtct"}],["line",{x1:"4",x2:"20",y1:"15",y2:"15",key:"vyu0kd"}],["line",{x1:"10",x2:"8",y1:"3",y2:"21",key:"1ggp8o"}],["line",{x1:"16",x2:"14",y1:"3",y2:"21",key:"weycgp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Oq=q("Haze",[["path",{d:"m5.2 6.2 1.4 1.4",key:"17imol"}],["path",{d:"M2 13h2",key:"13gyu8"}],["path",{d:"M20 13h2",key:"16rner"}],["path",{d:"m17.4 7.6 1.4-1.4",key:"t4xlah"}],["path",{d:"M22 17H2",key:"1gtaj3"}],["path",{d:"M22 21H2",key:"1gy6en"}],["path",{d:"M16 13a4 4 0 0 0-8 0",key:"1dyczq"}],["path",{d:"M12 5V2.5",key:"1vytko"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Dq=q("HdmiPort",[["path",{d:"M22 9a1 1 0 0 0-1-1H3a1 1 0 0 0-1 1v4a1 1 0 0 0 1 1h1l2 2h12l2-2h1a1 1 0 0 0 1-1Z",key:"2128wb"}],["path",{d:"M7.5 12h9",key:"1t0ckc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const aA=q("Heading1",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"m17 12 3-2v8",key:"1hhhft"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const iA=q("Heading2",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M21 18h-4c0-4 4-3 4-6 0-1.5-2-2.5-4-1",key:"9jr5yi"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Rq=q("Heading3",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M17.5 10.5c1.7-1 3.5 0 3.5 1.5a2 2 0 0 1-2 2",key:"68ncm8"}],["path",{d:"M17 17.5c2 1.5 4 .3 4-1.5a2 2 0 0 0-2-2",key:"1ejuhz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Fq=q("Heading4",[["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M17 10v3a1 1 0 0 0 1 1h3",key:"tj5zdr"}],["path",{d:"M21 10v8",key:"1kdml4"}],["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zq=q("Heading5",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M17 13v-3h4",key:"1nvgqp"}],["path",{d:"M17 17.7c.4.2.8.3 1.3.3 1.5 0 2.7-1.1 2.7-2.5S19.8 13 18.3 13H17",key:"2nebdn"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Bq=q("Heading6",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["circle",{cx:"19",cy:"16",r:"2",key:"15mx69"}],["path",{d:"M20 10c-2 2-3 3.5-3 6",key:"f35dl0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $q=q("Heading",[["path",{d:"M6 12h12",key:"8npq4p"}],["path",{d:"M6 20V4",key:"1w1bmo"}],["path",{d:"M18 20V4",key:"o2hl4u"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Uq=q("HeadphoneOff",[["path",{d:"M21 14h-1.343",key:"1jdnxi"}],["path",{d:"M9.128 3.47A9 9 0 0 1 21 12v3.343",key:"6kipu2"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M20.414 20.414A2 2 0 0 1 19 21h-1a2 2 0 0 1-2-2v-3",key:"9x50f4"}],["path",{d:"M3 14h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-7a9 9 0 0 1 2.636-6.364",key:"1bkxnm"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qq=q("Headphones",[["path",{d:"M3 14h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-7a9 9 0 0 1 18 0v7a2 2 0 0 1-2 2h-1a2 2 0 0 1-2-2v-3a2 2 0 0 1 2-2h3",key:"1xhozi"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Vq=q("Headset",[["path",{d:"M3 11h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-5Zm0 0a9 9 0 1 1 18 0m0 0v5a2 2 0 0 1-2 2h-1a2 2 0 0 1-2-2v-3a2 2 0 0 1 2-2h3Z",key:"12oyoe"}],["path",{d:"M21 16v2a4 4 0 0 1-4 4h-5",key:"1x7m43"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Hq=q("HeartCrack",[["path",{d:"M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z",key:"c3ymky"}],["path",{d:"m12 13-1-1 2-2-3-3 2-2",key:"xjdxli"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Wq=q("HeartHandshake",[["path",{d:"M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z",key:"c3ymky"}],["path",{d:"M12 5 9.04 7.96a2.17 2.17 0 0 0 0 3.08c.82.82 2.13.85 3 .07l2.07-1.9a2.82 2.82 0 0 1 3.79 0l2.96 2.66",key:"4oyue0"}],["path",{d:"m18 15-2-2",key:"60u0ii"}],["path",{d:"m15 18-2-2",key:"6p76be"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Gq=q("HeartOff",[["line",{x1:"2",y1:"2",x2:"22",y2:"22",key:"1w4vcy"}],["path",{d:"M16.5 16.5 12 21l-7-7c-1.5-1.45-3-3.2-3-5.5a5.5 5.5 0 0 1 2.14-4.35",key:"3mpagl"}],["path",{d:"M8.76 3.1c1.15.22 2.13.78 3.24 1.9 1.5-1.5 2.74-2 4.5-2A5.5 5.5 0 0 1 22 8.5c0 2.12-1.3 3.78-2.67 5.17",key:"1gh3v3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Kq=q("HeartPulse",[["path",{d:"M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z",key:"c3ymky"}],["path",{d:"M3.22 12H9.5l.5-1 2 4.5 2-7 1.5 3.5h5.27",key:"1uw2ng"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xi=q("Heart",[["path",{d:"M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z",key:"c3ymky"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Zq=q("Heater",[["path",{d:"M11 8c2-3-2-3 0-6",key:"1ldv5m"}],["path",{d:"M15.5 8c2-3-2-3 0-6",key:"1otqoz"}],["path",{d:"M6 10h.01",key:"1lbq93"}],["path",{d:"M6 14h.01",key:"zudwn7"}],["path",{d:"M10 16v-4",key:"1c25yv"}],["path",{d:"M14 16v-4",key:"1dkbt8"}],["path",{d:"M18 16v-4",key:"1yg9me"}],["path",{d:"M20 6a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h3",key:"1ubg90"}],["path",{d:"M5 20v2",key:"1abpe8"}],["path",{d:"M19 20v2",key:"kqn6ft"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Yq=q("Hexagon",[["path",{d:"M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z",key:"yt0hxn"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Xq=q("Highlighter",[["path",{d:"m9 11-6 6v3h9l3-3",key:"1a3l36"}],["path",{d:"m22 12-4.6 4.6a2 2 0 0 1-2.8 0l-5.2-5.2a2 2 0 0 1 0-2.8L14 4",key:"14a9rk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jS=q("History",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Qq=q("HopOff",[["path",{d:"M10.82 16.12c1.69.6 3.91.79 5.18.85.28.01.53-.09.7-.27",key:"qyzcap"}],["path",{d:"M11.14 20.57c.52.24 2.44 1.12 4.08 1.37.46.06.86-.25.9-.71.12-1.52-.3-3.43-.5-4.28",key:"y078lb"}],["path",{d:"M16.13 21.05c1.65.63 3.68.84 4.87.91a.9.9 0 0 0 .7-.26",key:"1utre3"}],["path",{d:"M17.99 5.52a20.83 20.83 0 0 1 3.15 4.5.8.8 0 0 1-.68 1.13c-1.17.1-2.5.02-3.9-.25",key:"17o9hm"}],["path",{d:"M20.57 11.14c.24.52 1.12 2.44 1.37 4.08.04.3-.08.59-.31.75",key:"1d1n4p"}],["path",{d:"M4.93 4.93a10 10 0 0 0-.67 13.4c.35.43.96.4 1.17-.12.69-1.71 1.07-5.07 1.07-6.71 1.34.45 3.1.9 4.88.62a.85.85 0 0 0 .48-.24",key:"9uv3tt"}],["path",{d:"M5.52 17.99c1.05.95 2.91 2.42 4.5 3.15a.8.8 0 0 0 1.13-.68c.2-2.34-.33-5.3-1.57-8.28",key:"1292wz"}],["path",{d:"M8.35 2.68a10 10 0 0 1 9.98 1.58c.43.35.4.96-.12 1.17-1.5.6-4.3.98-6.07 1.05",key:"7ozu9p"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Jq=q("Hop",[["path",{d:"M10.82 16.12c1.69.6 3.91.79 5.18.85.55.03 1-.42.97-.97-.06-1.27-.26-3.5-.85-5.18",key:"18lxf1"}],["path",{d:"M11.5 6.5c1.64 0 5-.38 6.71-1.07.52-.2.55-.82.12-1.17A10 10 0 0 0 4.26 18.33c.35.43.96.4 1.17-.12.69-1.71 1.07-5.07 1.07-6.71 1.34.45 3.1.9 4.88.62a.88.88 0 0 0 .73-.74c.3-2.14-.15-3.5-.61-4.88",key:"vtfxrw"}],["path",{d:"M15.62 16.95c.2.85.62 2.76.5 4.28a.77.77 0 0 1-.9.7 16.64 16.64 0 0 1-4.08-1.36",key:"13hl71"}],["path",{d:"M16.13 21.05c1.65.63 3.68.84 4.87.91a.9.9 0 0 0 .96-.96 17.68 17.68 0 0 0-.9-4.87",key:"1sl8oj"}],["path",{d:"M16.94 15.62c.86.2 2.77.62 4.29.5a.77.77 0 0 0 .7-.9 16.64 16.64 0 0 0-1.36-4.08",key:"19c6kt"}],["path",{d:"M17.99 5.52a20.82 20.82 0 0 1 3.15 4.5.8.8 0 0 1-.68 1.13c-2.33.2-5.3-.32-8.27-1.57",key:"85ghs3"}],["path",{d:"M4.93 4.93 3 3a.7.7 0 0 1 0-1",key:"x087yj"}],["path",{d:"M9.58 12.18c1.24 2.98 1.77 5.95 1.57 8.28a.8.8 0 0 1-1.13.68 20.82 20.82 0 0 1-4.5-3.15",key:"11xdqo"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const eV=q("Hospital",[["path",{d:"M12 6v4",key:"16clxf"}],["path",{d:"M14 14h-4",key:"esezmu"}],["path",{d:"M14 18h-4",key:"16mqa2"}],["path",{d:"M14 8h-4",key:"z8ypaz"}],["path",{d:"M18 12h2a2 2 0 0 1 2 2v6a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-9a2 2 0 0 1 2-2h2",key:"b1k337"}],["path",{d:"M18 22V4a2 2 0 0 0-2-2H8a2 2 0 0 0-2 2v18",key:"16g51d"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tV=q("Hotel",[["path",{d:"M10 22v-6.57",key:"1wmca3"}],["path",{d:"M12 11h.01",key:"z322tv"}],["path",{d:"M12 7h.01",key:"1ivr5q"}],["path",{d:"M14 15.43V22",key:"1q2vjd"}],["path",{d:"M15 16a5 5 0 0 0-6 0",key:"o9wqvi"}],["path",{d:"M16 11h.01",key:"xkw8gn"}],["path",{d:"M16 7h.01",key:"1kdx03"}],["path",{d:"M8 11h.01",key:"1dfujw"}],["path",{d:"M8 7h.01",key:"1vti4s"}],["rect",{x:"4",y:"2",width:"16",height:"20",rx:"2",key:"1uxh74"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rV=q("Hourglass",[["path",{d:"M5 22h14",key:"ehvnwv"}],["path",{d:"M5 2h14",key:"pdyrp9"}],["path",{d:"M17 22v-4.172a2 2 0 0 0-.586-1.414L12 12l-4.414 4.414A2 2 0 0 0 7 17.828V22",key:"1d314k"}],["path",{d:"M7 2v4.172a2 2 0 0 0 .586 1.414L12 12l4.414-4.414A2 2 0 0 0 17 6.172V2",key:"1vvvr6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nV=q("HousePlug",[["path",{d:"M10 12V8.964",key:"1vll13"}],["path",{d:"M14 12V8.964",key:"1x3qvg"}],["path",{d:"M15 12a1 1 0 0 1 1 1v2a2 2 0 0 1-2 2h-4a2 2 0 0 1-2-2v-2a1 1 0 0 1 1-1z",key:"ppykja"}],["path",{d:"M8.5 21H5a2 2 0 0 1-2-2v-9a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2h-5a2 2 0 0 1-2-2v-2",key:"1gvg2z"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sV=q("HousePlus",[["path",{d:"M13.22 2.416a2 2 0 0 0-2.511.057l-7 5.999A2 2 0 0 0 3 10v9a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7.354",key:"5phn05"}],["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M15 6h6",key:"1jlkvy"}],["path",{d:"M18 3v6",key:"x1uolp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xa=q("House",[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"1d0kgt"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const t2=q("IceCreamBowl",[["path",{d:"M12 17c5 0 8-2.69 8-6H4c0 3.31 3 6 8 6m-4 4h8m-4-3v3M5.14 11a3.5 3.5 0 1 1 6.71 0",key:"1uxfcu"}],["path",{d:"M12.14 11a3.5 3.5 0 1 1 6.71 0",key:"4k3m1s"}],["path",{d:"M15.5 6.5a3.5 3.5 0 1 0-7 0",key:"zmuahr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const r2=q("IceCreamCone",[["path",{d:"m7 11 4.08 10.35a1 1 0 0 0 1.84 0L17 11",key:"1v6356"}],["path",{d:"M17 7A5 5 0 0 0 7 7",key:"151p3v"}],["path",{d:"M17 7a2 2 0 0 1 0 4H7a2 2 0 0 1 0-4",key:"1sdaij"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const aV=q("IdCard",[["path",{d:"M16 10h2",key:"8sgtl7"}],["path",{d:"M16 14h2",key:"epxaof"}],["path",{d:"M6.17 15a3 3 0 0 1 5.66 0",key:"n6f512"}],["circle",{cx:"9",cy:"11",r:"2",key:"yxgjnd"}],["rect",{x:"2",y:"5",width:"20",height:"14",rx:"2",key:"qneu4z"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const iV=q("ImageDown",[["path",{d:"M10.3 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v10l-3.1-3.1a2 2 0 0 0-2.814.014L6 21",key:"9csbqa"}],["path",{d:"m14 19 3 3v-5.5",key:"9ldu5r"}],["path",{d:"m17 22 3-3",key:"1nkfve"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oV=q("ImageMinus",[["path",{d:"M21 9v10a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7",key:"m87ecr"}],["line",{x1:"16",x2:"22",y1:"5",y2:"5",key:"ez7e4s"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lV=q("ImageOff",[["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}],["path",{d:"M10.41 10.41a2 2 0 1 1-2.83-2.83",key:"1bzlo9"}],["line",{x1:"13.5",x2:"6",y1:"13.5",y2:"21",key:"1q0aeu"}],["line",{x1:"18",x2:"21",y1:"12",y2:"15",key:"5mozeu"}],["path",{d:"M3.59 3.59A1.99 1.99 0 0 0 3 5v14a2 2 0 0 0 2 2h14c.55 0 1.052-.22 1.41-.59",key:"mmje98"}],["path",{d:"M21 15V5a2 2 0 0 0-2-2H9",key:"43el77"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cV=q("ImagePlay",[["path",{d:"m11 16-5 5",key:"j5f7ct"}],["path",{d:"M11 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v6.5",key:"7s81lt"}],["path",{d:"M15.765 22a.5.5 0 0 1-.765-.424V13.38a.5.5 0 0 1 .765-.424l5.878 3.674a1 1 0 0 1 0 1.696z",key:"1omb6s"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kS=q("ImagePlus",[["path",{d:"M16 5h6",key:"1vod17"}],["path",{d:"M19 2v6",key:"4bpg5p"}],["path",{d:"M21 11.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7.5",key:"1ue2ih"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dV=q("ImageUp",[["path",{d:"M10.3 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v10l-3.1-3.1a2 2 0 0 0-2.814.014L6 21",key:"9csbqa"}],["path",{d:"m14 19.5 3-3 3 3",key:"9vmjn0"}],["path",{d:"M17 22v-5.5",key:"1aa6fl"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uV=q("ImageUpscale",[["path",{d:"M16 3h5v5",key:"1806ms"}],["path",{d:"M17 21h2a2 2 0 0 0 2-2",key:"130fy9"}],["path",{d:"M21 12v3",key:"1wzk3p"}],["path",{d:"m21 3-5 5",key:"1g5oa7"}],["path",{d:"M3 7V5a2 2 0 0 1 2-2",key:"kk3yz1"}],["path",{d:"m5 21 4.144-4.144a1.21 1.21 0 0 1 1.712 0L13 19",key:"fyekpt"}],["path",{d:"M9 3h3",key:"d52fa"}],["rect",{x:"3",y:"11",width:"10",height:"10",rx:"1",key:"1wpmix"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Rl=q("Image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hV=q("Images",[["path",{d:"M18 22H4a2 2 0 0 1-2-2V6",key:"pblm9e"}],["path",{d:"m22 13-1.296-1.296a2.41 2.41 0 0 0-3.408 0L11 18",key:"nf6bnh"}],["circle",{cx:"12",cy:"8",r:"2",key:"1822b1"}],["rect",{width:"16",height:"16",x:"6",y:"2",rx:"2",key:"12espp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fV=q("Import",[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m8 11 4 4 4-4",key:"1dohi6"}],["path",{d:"M8 5H4a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2h-4",key:"1ywtjm"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pV=q("Inbox",[["polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12",key:"o97t9d"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const n2=q("IndentDecrease",[["path",{d:"M21 12H11",key:"wd7e0v"}],["path",{d:"M21 18H11",key:"4wu86t"}],["path",{d:"M21 6H11",key:"6dy1d6"}],["path",{d:"m7 8-4 4 4 4",key:"o5hrat"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const s2=q("IndentIncrease",[["path",{d:"M21 12H11",key:"wd7e0v"}],["path",{d:"M21 18H11",key:"4wu86t"}],["path",{d:"M21 6H11",key:"6dy1d6"}],["path",{d:"m3 8 4 4-4 4",key:"1a3j6y"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mV=q("IndianRupee",[["path",{d:"M6 3h12",key:"ggurg9"}],["path",{d:"M6 8h12",key:"6g4wlu"}],["path",{d:"m6 13 8.5 8",key:"u1kupk"}],["path",{d:"M6 13h3",key:"wdp6ag"}],["path",{d:"M9 13c6.667 0 6.667-10 0-10",key:"1nkvk2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gV=q("Infinity",[["path",{d:"M12 12c-2-2.67-4-4-6-4a4 4 0 1 0 0 8c2 0 4-1.33 6-4Zm0 0c2 2.67 4 4 6 4a4 4 0 0 0 0-8c-2 0-4 1.33-6 4Z",key:"1z0uae"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xV=q("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yV=q("InspectionPanel",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M7 7h.01",key:"7u93v4"}],["path",{d:"M17 7h.01",key:"14a9sn"}],["path",{d:"M7 17h.01",key:"19xn7k"}],["path",{d:"M17 17h.01",key:"1sd3ek"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _u=q("Instagram",[["rect",{width:"20",height:"20",x:"2",y:"2",rx:"5",ry:"5",key:"2e1cvw"}],["path",{d:"M16 11.37A4 4 0 1 1 12.63 8 4 4 0 0 1 16 11.37z",key:"9exkf1"}],["line",{x1:"17.5",x2:"17.51",y1:"6.5",y2:"6.5",key:"r4j83e"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const NS=q("Italic",[["line",{x1:"19",x2:"10",y1:"4",y2:"4",key:"15jd3p"}],["line",{x1:"14",x2:"5",y1:"20",y2:"20",key:"bu0au3"}],["line",{x1:"15",x2:"9",y1:"4",y2:"20",key:"uljnxc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vV=q("IterationCcw",[["path",{d:"M20 10c0-4.4-3.6-8-8-8s-8 3.6-8 8 3.6 8 8 8h8",key:"4znkd0"}],["polyline",{points:"16 14 20 18 16 22",key:"11njsm"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _V=q("IterationCw",[["path",{d:"M4 10c0-4.4 3.6-8 8-8s8 3.6 8 8-3.6 8-8 8H4",key:"tuf4su"}],["polyline",{points:"8 22 4 18 8 14",key:"evkj9s"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bV=q("JapaneseYen",[["path",{d:"M12 9.5V21m0-11.5L6 3m6 6.5L18 3",key:"2ej80x"}],["path",{d:"M6 15h12",key:"1hwgt5"}],["path",{d:"M6 11h12",key:"wf4gp6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wV=q("Joystick",[["path",{d:"M21 17a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v2a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-2Z",key:"jg2n2t"}],["path",{d:"M6 15v-2",key:"gd6mvg"}],["path",{d:"M12 15V9",key:"8c7uyn"}],["circle",{cx:"12",cy:"6",r:"3",key:"1gm2ql"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uy=q("Kanban",[["path",{d:"M6 5v11",key:"mdvv1e"}],["path",{d:"M12 5v6",key:"14ar3b"}],["path",{d:"M18 5v14",key:"7ji314"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Lj=q("KeyRound",[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jV=q("KeySquare",[["path",{d:"M12.4 2.7a2.5 2.5 0 0 1 3.4 0l5.5 5.5a2.5 2.5 0 0 1 0 3.4l-3.7 3.7a2.5 2.5 0 0 1-3.4 0L8.7 9.8a2.5 2.5 0 0 1 0-3.4z",key:"165ttr"}],["path",{d:"m14 7 3 3",key:"1r5n42"}],["path",{d:"m9.4 10.6-6.814 6.814A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814",key:"1ubxi2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pf=q("Key",[["path",{d:"m15.5 7.5 2.3 2.3a1 1 0 0 0 1.4 0l2.1-2.1a1 1 0 0 0 0-1.4L19 4",key:"g0fldk"}],["path",{d:"m21 2-9.6 9.6",key:"1j0ho8"}],["circle",{cx:"7.5",cy:"15.5",r:"5.5",key:"yqb3hr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kV=q("KeyboardMusic",[["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["path",{d:"M6 8h4",key:"utf9t1"}],["path",{d:"M14 8h.01",key:"1primd"}],["path",{d:"M18 8h.01",key:"emo2bl"}],["path",{d:"M2 12h20",key:"9i4pu4"}],["path",{d:"M6 12v4",key:"dy92yo"}],["path",{d:"M10 12v4",key:"1fxnav"}],["path",{d:"M14 12v4",key:"1hft58"}],["path",{d:"M18 12v4",key:"tjjnbz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const NV=q("KeyboardOff",[["path",{d:"M 20 4 A2 2 0 0 1 22 6",key:"1g1fkt"}],["path",{d:"M 22 6 L 22 16.41",key:"1qjg3w"}],["path",{d:"M 7 16 L 16 16",key:"n0yqwb"}],["path",{d:"M 9.69 4 L 20 4",key:"kbpcgx"}],["path",{d:"M14 8h.01",key:"1primd"}],["path",{d:"M18 8h.01",key:"emo2bl"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M20 20H4a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2",key:"s23sx2"}],["path",{d:"M6 8h.01",key:"x9i8wu"}],["path",{d:"M8 12h.01",key:"czm47f"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const SV=q("Keyboard",[["path",{d:"M10 8h.01",key:"1r9ogq"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M14 8h.01",key:"1primd"}],["path",{d:"M16 12h.01",key:"1l6xoz"}],["path",{d:"M18 8h.01",key:"emo2bl"}],["path",{d:"M6 8h.01",key:"x9i8wu"}],["path",{d:"M7 16h10",key:"wp8him"}],["path",{d:"M8 12h.01",key:"czm47f"}],["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const CV=q("LampCeiling",[["path",{d:"M12 2v5",key:"nd4vlx"}],["path",{d:"M6 7h12l4 9H2l4-9Z",key:"123d64"}],["path",{d:"M9.17 16a3 3 0 1 0 5.66 0",key:"1061mw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const MV=q("LampDesk",[["path",{d:"m14 5-3 3 2 7 8-8-7-2Z",key:"1b0msb"}],["path",{d:"m14 5-3 3-3-3 3-3 3 3Z",key:"1uemms"}],["path",{d:"M9.5 6.5 4 12l3 6",key:"1bx08v"}],["path",{d:"M3 22v-2c0-1.1.9-2 2-2h4a2 2 0 0 1 2 2v2H3Z",key:"wap775"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const TV=q("LampFloor",[["path",{d:"M9 2h6l3 7H6l3-7Z",key:"wcx6mj"}],["path",{d:"M12 9v13",key:"3n1su1"}],["path",{d:"M9 22h6",key:"1rlq3v"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const AV=q("LampWallDown",[["path",{d:"M11 13h6l3 7H8l3-7Z",key:"9n3qlo"}],["path",{d:"M14 13V8a2 2 0 0 0-2-2H8",key:"1hu4hb"}],["path",{d:"M4 9h2a2 2 0 0 0 2-2V5a2 2 0 0 0-2-2H4v6Z",key:"s053bc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const EV=q("LampWallUp",[["path",{d:"M11 4h6l3 7H8l3-7Z",key:"11x1ee"}],["path",{d:"M14 11v5a2 2 0 0 1-2 2H8",key:"eutp5o"}],["path",{d:"M4 15h2a2 2 0 0 1 2 2v2a2 2 0 0 1-2 2H4v-6Z",key:"1iuthr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const IV=q("Lamp",[["path",{d:"M8 2h8l4 10H4L8 2Z",key:"9dma5w"}],["path",{d:"M12 12v6",key:"3ahymv"}],["path",{d:"M8 22v-2c0-1.1.9-2 2-2h4a2 2 0 0 1 2 2v2H8Z",key:"mwf4oh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const PV=q("LandPlot",[["path",{d:"m12 8 6-3-6-3v10",key:"mvpnpy"}],["path",{d:"m8 11.99-5.5 3.14a1 1 0 0 0 0 1.74l8.5 4.86a2 2 0 0 0 2 0l8.5-4.86a1 1 0 0 0 0-1.74L16 12",key:"ek95tt"}],["path",{d:"m6.49 12.85 11.02 6.3",key:"1kt42w"}],["path",{d:"M17.51 12.85 6.5 19.15",key:"v55bdg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const LV=q("Landmark",[["line",{x1:"3",x2:"21",y1:"22",y2:"22",key:"j8o0r"}],["line",{x1:"6",x2:"6",y1:"18",y2:"11",key:"10tf0k"}],["line",{x1:"10",x2:"10",y1:"18",y2:"11",key:"54lgf6"}],["line",{x1:"14",x2:"14",y1:"18",y2:"11",key:"380y"}],["line",{x1:"18",x2:"18",y1:"18",y2:"11",key:"1kevvc"}],["polygon",{points:"12 2 20 7 4 7",key:"jkujk7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const OV=q("Languages",[["path",{d:"m5 8 6 6",key:"1wu5hv"}],["path",{d:"m4 14 6-6 2-3",key:"1k1g8d"}],["path",{d:"M2 5h12",key:"or177f"}],["path",{d:"M7 2h1",key:"1t2jsx"}],["path",{d:"m22 22-5-10-5 10",key:"don7ne"}],["path",{d:"M14 18h6",key:"1m8k6r"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const DV=q("LaptopMinimalCheck",[["path",{d:"M2 20h20",key:"owomy5"}],["path",{d:"m9 10 2 2 4-4",key:"1gnqz4"}],["rect",{x:"3",y:"4",width:"18",height:"12",rx:"2",key:"8ur36m"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const a2=q("LaptopMinimal",[["rect",{width:"18",height:"12",x:"3",y:"4",rx:"2",ry:"2",key:"1qhy41"}],["line",{x1:"2",x2:"22",y1:"20",y2:"20",key:"ni3hll"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const RV=q("Laptop",[["path",{d:"M20 16V7a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v9m16 0H4m16 0 1.28 2.55a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45L4 16",key:"tarvll"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const FV=q("LassoSelect",[["path",{d:"M7 22a5 5 0 0 1-2-4",key:"umushi"}],["path",{d:"M7 16.93c.96.43 1.96.74 2.99.91",key:"ybbtv3"}],["path",{d:"M3.34 14A6.8 6.8 0 0 1 2 10c0-4.42 4.48-8 10-8s10 3.58 10 8a7.19 7.19 0 0 1-.33 2",key:"gt5e1w"}],["path",{d:"M5 18a2 2 0 1 0 0-4 2 2 0 0 0 0 4z",key:"bq3ynw"}],["path",{d:"M14.33 22h-.09a.35.35 0 0 1-.24-.32v-10a.34.34 0 0 1 .33-.34c.08 0 .15.03.21.08l7.34 6a.33.33 0 0 1-.21.59h-4.49l-2.57 3.85a.35.35 0 0 1-.28.14z",key:"72q637"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zV=q("Lasso",[["path",{d:"M7 22a5 5 0 0 1-2-4",key:"umushi"}],["path",{d:"M3.3 14A6.8 6.8 0 0 1 2 10c0-4.4 4.5-8 10-8s10 3.6 10 8-4.5 8-10 8a12 12 0 0 1-5-1",key:"146dds"}],["path",{d:"M5 18a2 2 0 1 0 0-4 2 2 0 0 0 0 4z",key:"bq3ynw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const BV=q("Laugh",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M18 13a6 6 0 0 1-6 5 6 6 0 0 1-6-5h12Z",key:"b2q4dd"}],["line",{x1:"9",x2:"9.01",y1:"9",y2:"9",key:"yxxnd0"}],["line",{x1:"15",x2:"15.01",y1:"9",y2:"9",key:"1p4y9e"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $V=q("Layers2",[["path",{d:"m16.02 12 5.48 3.13a1 1 0 0 1 0 1.74L13 21.74a2 2 0 0 1-2 0l-8.5-4.87a1 1 0 0 1 0-1.74L7.98 12",key:"1cuww1"}],["path",{d:"M13 13.74a2 2 0 0 1-2 0L2.5 8.87a1 1 0 0 1 0-1.74L11 2.26a2 2 0 0 1 2 0l8.5 4.87a1 1 0 0 1 0 1.74Z",key:"pdlvxu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const UV=q("Layers3",[["path",{d:"m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z",key:"8b97xw"}],["path",{d:"m6.08 9.5-3.5 1.6a1 1 0 0 0 0 1.81l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9a1 1 0 0 0 0-1.83l-3.5-1.59",key:"1e5n1m"}],["path",{d:"m6.08 14.5-3.5 1.6a1 1 0 0 0 0 1.81l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9a1 1 0 0 0 0-1.83l-3.5-1.59",key:"1iwflc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qV=q("Layers",[["path",{d:"m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z",key:"8b97xw"}],["path",{d:"m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65",key:"dd6zsq"}],["path",{d:"m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65",key:"ep9fru"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Oj=q("LayoutDashboard",[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dp=q("LayoutGrid",[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const VV=q("LayoutList",[["rect",{width:"7",height:"7",x:"3",y:"3",rx:"1",key:"1g98yp"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}],["path",{d:"M14 4h7",key:"3xa0d5"}],["path",{d:"M14 9h7",key:"1icrd9"}],["path",{d:"M14 15h7",key:"1mj8o2"}],["path",{d:"M14 20h7",key:"11slyb"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const HV=q("LayoutPanelLeft",[["rect",{width:"7",height:"18",x:"3",y:"3",rx:"1",key:"2obqm"}],["rect",{width:"7",height:"7",x:"14",y:"3",rx:"1",key:"6d4xhi"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const WV=q("LayoutPanelTop",[["rect",{width:"18",height:"7",x:"3",y:"3",rx:"1",key:"f1a2em"}],["rect",{width:"7",height:"7",x:"3",y:"14",rx:"1",key:"1bb6yr"}],["rect",{width:"7",height:"7",x:"14",y:"14",rx:"1",key:"nxv5o0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Dj=q("LayoutTemplate",[["rect",{width:"18",height:"7",x:"3",y:"3",rx:"1",key:"f1a2em"}],["rect",{width:"9",height:"7",x:"3",y:"14",rx:"1",key:"jqznyg"}],["rect",{width:"5",height:"7",x:"16",y:"14",rx:"1",key:"q5h2i8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const GV=q("Leaf",[["path",{d:"M11 20A7 7 0 0 1 9.8 6.1C15.5 5 17 4.48 19 2c1 2 2 4.18 2 8 0 5.5-4.78 10-10 10Z",key:"nnexq3"}],["path",{d:"M2 21c0-3 1.85-5.36 5.08-6C9.5 14.52 12 13 13 12",key:"mt58a7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const KV=q("LeafyGreen",[["path",{d:"M2 22c1.25-.987 2.27-1.975 3.9-2.2a5.56 5.56 0 0 1 3.8 1.5 4 4 0 0 0 6.187-2.353 3.5 3.5 0 0 0 3.69-5.116A3.5 3.5 0 0 0 20.95 8 3.5 3.5 0 1 0 16 3.05a3.5 3.5 0 0 0-5.831 1.373 3.5 3.5 0 0 0-5.116 3.69 4 4 0 0 0-2.348 6.155C3.499 15.42 4.409 16.712 4.2 18.1 3.926 19.743 3.014 20.732 2 22",key:"1134nt"}],["path",{d:"M2 22 17 7",key:"1q7jp2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ZV=q("Lectern",[["path",{d:"M16 12h3a2 2 0 0 0 1.902-1.38l1.056-3.333A1 1 0 0 0 21 6H3a1 1 0 0 0-.958 1.287l1.056 3.334A2 2 0 0 0 5 12h3",key:"13jjxg"}],["path",{d:"M18 6V3a1 1 0 0 0-1-1h-3",key:"1550fe"}],["rect",{width:"8",height:"12",x:"8",y:"10",rx:"1",key:"qmu8b6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const YV=q("LetterText",[["path",{d:"M15 12h6",key:"upa0zy"}],["path",{d:"M15 6h6",key:"1jlkvy"}],["path",{d:"m3 13 3.553-7.724a.5.5 0 0 1 .894 0L11 13",key:"blevx4"}],["path",{d:"M3 18h18",key:"1h113x"}],["path",{d:"M4 11h6",key:"olkgv1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const XV=q("LibraryBig",[["rect",{width:"8",height:"18",x:"3",y:"3",rx:"1",key:"oynpb5"}],["path",{d:"M7 3v18",key:"bbkbws"}],["path",{d:"M20.4 18.9c.2.5-.1 1.1-.6 1.3l-1.9.7c-.5.2-1.1-.1-1.3-.6L11.1 5.1c-.2-.5.1-1.1.6-1.3l1.9-.7c.5-.2 1.1.1 1.3.6Z",key:"1qboyk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const SS=q("Library",[["path",{d:"m16 6 4 14",key:"ji33uf"}],["path",{d:"M12 6v14",key:"1n7gus"}],["path",{d:"M8 8v12",key:"1gg7y9"}],["path",{d:"M4 4v16",key:"6qkkli"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const CS=q("LifeBuoy",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.93 4.93 4.24 4.24",key:"1ymg45"}],["path",{d:"m14.83 9.17 4.24-4.24",key:"1cb5xl"}],["path",{d:"m14.83 14.83 4.24 4.24",key:"q42g0n"}],["path",{d:"m9.17 14.83-4.24 4.24",key:"bqpfvv"}],["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const QV=q("Ligature",[["path",{d:"M8 20V8c0-2.2 1.8-4 4-4 1.5 0 2.8.8 3.5 2",key:"1rtphz"}],["path",{d:"M6 12h4",key:"a4o3ry"}],["path",{d:"M14 12h2v8",key:"c1fccl"}],["path",{d:"M6 20h4",key:"1i6q5t"}],["path",{d:"M14 20h4",key:"lzx1xo"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const JV=q("LightbulbOff",[["path",{d:"M16.8 11.2c.8-.9 1.2-2 1.2-3.2a6 6 0 0 0-9.3-5",key:"1fkcox"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M6.3 6.3a4.67 4.67 0 0 0 1.2 5.2c.7.7 1.3 1.5 1.5 2.5",key:"10m8kw"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const W1=q("Lightbulb",[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const eH=q("Link2Off",[["path",{d:"M9 17H7A5 5 0 0 1 7 7",key:"10o201"}],["path",{d:"M15 7h2a5 5 0 0 1 4 8",key:"1d3206"}],["line",{x1:"8",x2:"12",y1:"12",y2:"12",key:"rvw6j4"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mf=q("Link2",[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Io=q("Link",[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gf=q("Linkedin",[["path",{d:"M16 8a6 6 0 0 1 6 6v7h-4v-7a2 2 0 0 0-2-2 2 2 0 0 0-2 2v7h-4v-7a6 6 0 0 1 6-6z",key:"c2jq9f"}],["rect",{width:"4",height:"12",x:"2",y:"9",key:"mk3on5"}],["circle",{cx:"4",cy:"4",r:"2",key:"bt5ra8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tH=q("ListCheck",[["path",{d:"M11 18H3",key:"n3j2dh"}],["path",{d:"m15 18 2 2 4-4",key:"1szwhi"}],["path",{d:"M16 12H3",key:"1a2rj7"}],["path",{d:"M16 6H3",key:"1wxfjs"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rH=q("ListChecks",[["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}],["path",{d:"M13 6h8",key:"15sg57"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 18h8",key:"oe0vm4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nH=q("ListCollapse",[["path",{d:"m3 10 2.5-2.5L3 5",key:"i6eama"}],["path",{d:"m3 19 2.5-2.5L3 14",key:"w2gmor"}],["path",{d:"M10 6h11",key:"c7qv1k"}],["path",{d:"M10 12h11",key:"6m4ad9"}],["path",{d:"M10 18h11",key:"11hvi2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sH=q("ListEnd",[["path",{d:"M16 12H3",key:"1a2rj7"}],["path",{d:"M16 6H3",key:"1wxfjs"}],["path",{d:"M10 18H3",key:"13769t"}],["path",{d:"M21 6v10a2 2 0 0 1-2 2h-5",key:"ilrcs8"}],["path",{d:"m16 16-2 2 2 2",key:"kkc6pm"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const aH=q("ListFilter",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M7 12h10",key:"b7w52i"}],["path",{d:"M10 18h4",key:"1ulq68"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const iH=q("ListMinus",[["path",{d:"M11 12H3",key:"51ecnj"}],["path",{d:"M16 6H3",key:"1wxfjs"}],["path",{d:"M16 18H3",key:"12xzn7"}],["path",{d:"M21 12h-6",key:"bt1uis"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oH=q("ListMusic",[["path",{d:"M21 15V6",key:"h1cx4g"}],["path",{d:"M18.5 18a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5Z",key:"8saifv"}],["path",{d:"M12 12H3",key:"18klou"}],["path",{d:"M16 6H3",key:"1wxfjs"}],["path",{d:"M12 18H3",key:"11ftsu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const MS=q("ListOrdered",[["path",{d:"M10 12h11",key:"6m4ad9"}],["path",{d:"M10 18h11",key:"11hvi2"}],["path",{d:"M10 6h11",key:"c7qv1k"}],["path",{d:"M4 10h2",key:"16xx2s"}],["path",{d:"M4 6h1v4",key:"cnovpq"}],["path",{d:"M6 18H4c0-1 2-2 2-3s-1-1.5-2-1",key:"m9a95d"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lH=q("ListPlus",[["path",{d:"M11 12H3",key:"51ecnj"}],["path",{d:"M16 6H3",key:"1wxfjs"}],["path",{d:"M16 18H3",key:"12xzn7"}],["path",{d:"M18 9v6",key:"1twb98"}],["path",{d:"M21 12h-6",key:"bt1uis"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cH=q("ListRestart",[["path",{d:"M21 6H3",key:"1jwq7v"}],["path",{d:"M7 12H3",key:"13ou7f"}],["path",{d:"M7 18H3",key:"1sijw9"}],["path",{d:"M12 18a5 5 0 0 0 9-3 4.5 4.5 0 0 0-4.5-4.5c-1.33 0-2.54.54-3.41 1.41L11 14",key:"qth677"}],["path",{d:"M11 10v4h4",key:"172dkj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dH=q("ListStart",[["path",{d:"M16 12H3",key:"1a2rj7"}],["path",{d:"M16 18H3",key:"12xzn7"}],["path",{d:"M10 6H3",key:"lf8lx7"}],["path",{d:"M21 18V8a2 2 0 0 0-2-2h-5",key:"1hghli"}],["path",{d:"m16 8-2-2 2-2",key:"160uvd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uH=q("ListTodo",[["rect",{x:"3",y:"5",width:"6",height:"6",rx:"1",key:"1defrl"}],["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"M13 6h8",key:"15sg57"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 18h8",key:"oe0vm4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hH=q("ListTree",[["path",{d:"M21 12h-8",key:"1bmf0i"}],["path",{d:"M21 6H8",key:"1pqkrb"}],["path",{d:"M21 18h-8",key:"1tm79t"}],["path",{d:"M3 6v4c0 1.1.9 2 2 2h3",key:"1ywdgy"}],["path",{d:"M3 10v6c0 1.1.9 2 2 2h3",key:"2wc746"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fH=q("ListVideo",[["path",{d:"M12 12H3",key:"18klou"}],["path",{d:"M16 6H3",key:"1wxfjs"}],["path",{d:"M12 18H3",key:"11ftsu"}],["path",{d:"m16 12 5 3-5 3v-6Z",key:"zpskkp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pH=q("ListX",[["path",{d:"M11 12H3",key:"51ecnj"}],["path",{d:"M16 6H3",key:"1wxfjs"}],["path",{d:"M16 18H3",key:"12xzn7"}],["path",{d:"m19 10-4 4",key:"1tz659"}],["path",{d:"m15 10 4 4",key:"1n7nei"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const up=q("List",[["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 18h.01",key:"1tta3j"}],["path",{d:"M3 6h.01",key:"1rqtza"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 18h13",key:"1lx6n3"}],["path",{d:"M8 6h13",key:"ik3vkj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Zr=q("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mH=q("LoaderPinwheel",[["path",{d:"M22 12a1 1 0 0 1-10 0 1 1 0 0 0-10 0",key:"1lzz15"}],["path",{d:"M7 20.7a1 1 0 1 1 5-8.7 1 1 0 1 0 5-8.6",key:"1gnrpi"}],["path",{d:"M7 3.3a1 1 0 1 1 5 8.6 1 1 0 1 0 5 8.6",key:"u9yy5q"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gH=q("Loader",[["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m16.2 7.8 2.9-2.9",key:"r700ao"}],["path",{d:"M18 12h4",key:"wj9ykh"}],["path",{d:"m16.2 16.2 2.9 2.9",key:"1bxg5t"}],["path",{d:"M12 18v4",key:"jadmvz"}],["path",{d:"m4.9 19.1 2.9-2.9",key:"bwix9q"}],["path",{d:"M2 12h4",key:"j09sii"}],["path",{d:"m4.9 4.9 2.9 2.9",key:"giyufr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xH=q("LocateFixed",[["line",{x1:"2",x2:"5",y1:"12",y2:"12",key:"bvdh0s"}],["line",{x1:"19",x2:"22",y1:"12",y2:"12",key:"1tbv5k"}],["line",{x1:"12",x2:"12",y1:"2",y2:"5",key:"11lu5j"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}],["circle",{cx:"12",cy:"12",r:"7",key:"fim9np"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yH=q("LocateOff",[["line",{x1:"2",x2:"5",y1:"12",y2:"12",key:"bvdh0s"}],["line",{x1:"19",x2:"22",y1:"12",y2:"12",key:"1tbv5k"}],["line",{x1:"12",x2:"12",y1:"2",y2:"5",key:"11lu5j"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}],["path",{d:"M7.11 7.11C5.83 8.39 5 10.1 5 12c0 3.87 3.13 7 7 7 1.9 0 3.61-.83 4.89-2.11",key:"1oh7ia"}],["path",{d:"M18.71 13.96c.19-.63.29-1.29.29-1.96 0-3.87-3.13-7-7-7-.67 0-1.33.1-1.96.29",key:"3qdecy"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oA=q("Locate",[["line",{x1:"2",x2:"5",y1:"12",y2:"12",key:"bvdh0s"}],["line",{x1:"19",x2:"22",y1:"12",y2:"12",key:"1tbv5k"}],["line",{x1:"12",x2:"12",y1:"2",y2:"5",key:"11lu5j"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}],["circle",{cx:"12",cy:"12",r:"7",key:"fim9np"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const i2=q("LockKeyholeOpen",[["circle",{cx:"12",cy:"16",r:"1",key:"1au0dj"}],["rect",{width:"18",height:"12",x:"3",y:"10",rx:"2",key:"l0tzu3"}],["path",{d:"M7 10V7a5 5 0 0 1 9.33-2.5",key:"car5b7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vH=q("LockKeyhole",[["circle",{cx:"12",cy:"16",r:"1",key:"1au0dj"}],["rect",{x:"3",y:"10",width:"18",height:"12",rx:"2",key:"6s8ecr"}],["path",{d:"M7 10V7a5 5 0 0 1 10 0v3",key:"1pqi11"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const o2=q("LockOpen",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 9.9-1",key:"1mm8w8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hp=q("Lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const TS=q("LogIn",[["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}],["polyline",{points:"10 17 15 12 10 7",key:"1ail0h"}],["line",{x1:"15",x2:"3",y1:"12",y2:"12",key:"v6grx8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const AS=q("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _H=q("Logs",[["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 18h8",key:"oe0vm4"}],["path",{d:"M13 6h8",key:"15sg57"}],["path",{d:"M3 12h1",key:"lp3yf2"}],["path",{d:"M3 18h1",key:"1eiwyy"}],["path",{d:"M3 6h1",key:"rgxa97"}],["path",{d:"M8 12h1",key:"1con00"}],["path",{d:"M8 18h1",key:"13wk12"}],["path",{d:"M8 6h1",key:"tn6mkg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bH=q("Lollipop",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}],["path",{d:"M11 11a2 2 0 0 0 4 0 4 4 0 0 0-8 0 6 6 0 0 0 12 0",key:"107gwy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wH=q("Luggage",[["path",{d:"M6 20a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2",key:"1m57jg"}],["path",{d:"M8 18V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v14",key:"1l99gc"}],["path",{d:"M10 20h4",key:"ni2waw"}],["circle",{cx:"16",cy:"20",r:"2",key:"1vifvg"}],["circle",{cx:"8",cy:"20",r:"2",key:"ckkr5m"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jH=q("Magnet",[["path",{d:"m6 15-4-4 6.75-6.77a7.79 7.79 0 0 1 11 11L13 22l-4-4 6.39-6.36a2.14 2.14 0 0 0-3-3L6 15",key:"1i3lhw"}],["path",{d:"m5 8 4 4",key:"j6kj7e"}],["path",{d:"m12 15 4 4",key:"lnac28"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kH=q("MailCheck",[["path",{d:"M22 13V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v12c0 1.1.9 2 2 2h8",key:"12jkf8"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}],["path",{d:"m16 19 2 2 4-4",key:"1b14m6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const NH=q("MailMinus",[["path",{d:"M22 15V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v12c0 1.1.9 2 2 2h8",key:"fuxbkv"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}],["path",{d:"M16 19h6",key:"xwg31i"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const SH=q("MailOpen",[["path",{d:"M21.2 8.4c.5.38.8.97.8 1.6v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V10a2 2 0 0 1 .8-1.6l8-6a2 2 0 0 1 2.4 0l8 6Z",key:"1jhwl8"}],["path",{d:"m22 10-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 10",key:"1qfld7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const CH=q("MailPlus",[["path",{d:"M22 13V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v12c0 1.1.9 2 2 2h8",key:"12jkf8"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}],["path",{d:"M19 16v6",key:"tddt3s"}],["path",{d:"M16 19h6",key:"xwg31i"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const MH=q("MailQuestion",[["path",{d:"M22 10.5V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v12c0 1.1.9 2 2 2h12.5",key:"e61zoh"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}],["path",{d:"M18 15.28c.2-.4.5-.8.9-1a2.1 2.1 0 0 1 2.6.4c.3.4.5.8.5 1.3 0 1.3-2 2-2 2",key:"7z9rxb"}],["path",{d:"M20 22v.01",key:"12bgn6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const TH=q("MailSearch",[["path",{d:"M22 12.5V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v12c0 1.1.9 2 2 2h7.5",key:"w80f2v"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}],["path",{d:"M18 21a3 3 0 1 0 0-6 3 3 0 0 0 0 6Z",key:"8lzu5m"}],["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["path",{d:"m22 22-1.5-1.5",key:"1x83k4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const AH=q("MailWarning",[["path",{d:"M22 10.5V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v12c0 1.1.9 2 2 2h12.5",key:"e61zoh"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}],["path",{d:"M20 14v4",key:"1hm744"}],["path",{d:"M20 22v.01",key:"12bgn6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lA=q("MailX",[["path",{d:"M22 13V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v12c0 1.1.9 2 2 2h9",key:"1j9vog"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}],["path",{d:"m17 17 4 4",key:"1b3523"}],["path",{d:"m21 17-4 4",key:"uinynz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ns=q("Mail",[["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const EH=q("Mailbox",[["path",{d:"M22 17a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9.5C2 7 4 5 6.5 5H18c2.2 0 4 1.8 4 4v8Z",key:"1lbycx"}],["polyline",{points:"15,9 18,9 18,11",key:"1pm9c0"}],["path",{d:"M6.5 5C9 5 11 7 11 9.5V17a2 2 0 0 1-2 2",key:"15i455"}],["line",{x1:"6",x2:"7",y1:"10",y2:"10",key:"1e2scm"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const IH=q("Mails",[["rect",{width:"16",height:"13",x:"6",y:"4",rx:"2",key:"1drq3f"}],["path",{d:"m22 7-7.1 3.78c-.57.3-1.23.3-1.8 0L6 7",key:"xn252p"}],["path",{d:"M2 8v11c0 1.1.9 2 2 2h14",key:"n13cji"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const PH=q("MapPinCheckInside",[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["path",{d:"m9 10 2 2 4-4",key:"1gnqz4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const LH=q("MapPinCheck",[["path",{d:"M19.43 12.935c.357-.967.57-1.955.57-2.935a8 8 0 0 0-16 0c0 4.993 5.539 10.193 7.399 11.799a1 1 0 0 0 1.202 0 32.197 32.197 0 0 0 .813-.728",key:"1dq61d"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}],["path",{d:"m16 18 2 2 4-4",key:"1mkfmb"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const OH=q("MapPinHouse",[["path",{d:"M15 22a1 1 0 0 1-1-1v-4a1 1 0 0 1 .445-.832l3-2a1 1 0 0 1 1.11 0l3 2A1 1 0 0 1 22 17v4a1 1 0 0 1-1 1z",key:"1p1rcz"}],["path",{d:"M18 10a8 8 0 0 0-16 0c0 4.993 5.539 10.193 7.399 11.799a1 1 0 0 0 .601.2",key:"mcbcs9"}],["path",{d:"M18 22v-3",key:"1t1ugv"}],["circle",{cx:"10",cy:"10",r:"3",key:"1ns7v1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const DH=q("MapPinMinusInside",[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["path",{d:"M9 10h6",key:"9gxzsh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const RH=q("MapPinMinus",[["path",{d:"M18.977 14C19.6 12.701 20 11.343 20 10a8 8 0 0 0-16 0c0 4.993 5.539 10.193 7.399 11.799a1 1 0 0 0 1.202 0 32 32 0 0 0 .824-.738",key:"11uxia"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}],["path",{d:"M16 18h6",key:"987eiv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const FH=q("MapPinOff",[["path",{d:"M12.75 7.09a3 3 0 0 1 2.16 2.16",key:"1d4wjd"}],["path",{d:"M17.072 17.072c-1.634 2.17-3.527 3.912-4.471 4.727a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 1.432-4.568",key:"12yil7"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M8.475 2.818A8 8 0 0 1 20 10c0 1.183-.31 2.377-.81 3.533",key:"lhrkcz"}],["path",{d:"M9.13 9.13a3 3 0 0 0 3.74 3.74",key:"13wojd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zH=q("MapPinPlusInside",[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["path",{d:"M12 7v6",key:"lw1j43"}],["path",{d:"M9 10h6",key:"9gxzsh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const BH=q("MapPinPlus",[["path",{d:"M19.914 11.105A7.298 7.298 0 0 0 20 10a8 8 0 0 0-16 0c0 4.993 5.539 10.193 7.399 11.799a1 1 0 0 0 1.202 0 32 32 0 0 0 .824-.738",key:"fcdtly"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}],["path",{d:"M16 18h6",key:"987eiv"}],["path",{d:"M19 15v6",key:"10aioa"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $H=q("MapPinXInside",[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["path",{d:"m14.5 7.5-5 5",key:"3lb6iw"}],["path",{d:"m9.5 7.5 5 5",key:"ko136h"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const UH=q("MapPinX",[["path",{d:"M19.752 11.901A7.78 7.78 0 0 0 20 10a8 8 0 0 0-16 0c0 4.993 5.539 10.193 7.399 11.799a1 1 0 0 0 1.202 0 19 19 0 0 0 .09-.077",key:"y0ewhp"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}],["path",{d:"m21.5 15.5-5 5",key:"11iqnx"}],["path",{d:"m21.5 20.5-5-5",key:"1bylgx"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Po=q("MapPin",[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qH=q("MapPinned",[["path",{d:"M18 8c0 3.613-3.869 7.429-5.393 8.795a1 1 0 0 1-1.214 0C9.87 15.429 6 11.613 6 8a6 6 0 0 1 12 0",key:"11u0oz"}],["circle",{cx:"12",cy:"8",r:"2",key:"1822b1"}],["path",{d:"M8.714 14h-3.71a1 1 0 0 0-.948.683l-2.004 6A1 1 0 0 0 3 22h18a1 1 0 0 0 .948-1.316l-2-6a1 1 0 0 0-.949-.684h-3.712",key:"q8zwxj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const VH=q("Map",[["path",{d:"M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z",key:"169xi5"}],["path",{d:"M15 5.764v15",key:"1pn4in"}],["path",{d:"M9 3.236v15",key:"1uimfh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const HH=q("Martini",[["path",{d:"M8 22h8",key:"rmew8v"}],["path",{d:"M12 11v11",key:"ur9y6a"}],["path",{d:"m19 3-7 8-7-8Z",key:"1sgpiw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const WH=q("Maximize2",[["polyline",{points:"15 3 21 3 21 9",key:"mznyad"}],["polyline",{points:"9 21 3 21 3 15",key:"1avn1i"}],["line",{x1:"21",x2:"14",y1:"3",y2:"10",key:"ota7mn"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const GH=q("Maximize",[["path",{d:"M8 3H5a2 2 0 0 0-2 2v3",key:"1dcmit"}],["path",{d:"M21 8V5a2 2 0 0 0-2-2h-3",key:"1e4gt3"}],["path",{d:"M3 16v3a2 2 0 0 0 2 2h3",key:"wsl5sc"}],["path",{d:"M16 21h3a2 2 0 0 0 2-2v-3",key:"18trek"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hy=q("Medal",[["path",{d:"M7.21 15 2.66 7.14a2 2 0 0 1 .13-2.2L4.4 2.8A2 2 0 0 1 6 2h12a2 2 0 0 1 1.6.8l1.6 2.14a2 2 0 0 1 .14 2.2L16.79 15",key:"143lza"}],["path",{d:"M11 12 5.12 2.2",key:"qhuxz6"}],["path",{d:"m13 12 5.88-9.8",key:"hbye0f"}],["path",{d:"M8 7h8",key:"i86dvs"}],["circle",{cx:"12",cy:"17",r:"5",key:"qbz8iq"}],["path",{d:"M12 18v-2h-.5",key:"fawc4q"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const KH=q("MegaphoneOff",[["path",{d:"M9.26 9.26 3 11v3l14.14 3.14",key:"3429n"}],["path",{d:"M21 15.34V6l-7.31 2.03",key:"4o1dh8"}],["path",{d:"M11.6 16.8a3 3 0 1 1-5.8-1.6",key:"1yl0tm"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Am=q("Megaphone",[["path",{d:"m3 11 18-5v12L3 14v-3z",key:"n962bs"}],["path",{d:"M11.6 16.8a3 3 0 1 1-5.8-1.6",key:"1yl0tm"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ZH=q("Meh",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"8",x2:"16",y1:"15",y2:"15",key:"1xb1d9"}],["line",{x1:"9",x2:"9.01",y1:"9",y2:"9",key:"yxxnd0"}],["line",{x1:"15",x2:"15.01",y1:"9",y2:"9",key:"1p4y9e"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const YH=q("MemoryStick",[["path",{d:"M6 19v-3",key:"1nvgqn"}],["path",{d:"M10 19v-3",key:"iu8nkm"}],["path",{d:"M14 19v-3",key:"kcehxu"}],["path",{d:"M18 19v-3",key:"1vh91z"}],["path",{d:"M8 11V9",key:"63erz4"}],["path",{d:"M16 11V9",key:"fru6f3"}],["path",{d:"M12 11V9",key:"ha00sb"}],["path",{d:"M2 15h20",key:"16ne18"}],["path",{d:"M2 7a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v1.1a2 2 0 0 0 0 3.837V17a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-5.1a2 2 0 0 0 0-3.837Z",key:"lhddv3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cA=q("Menu",[["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}],["line",{x1:"4",x2:"20",y1:"6",y2:"6",key:"1owob3"}],["line",{x1:"4",x2:"20",y1:"18",y2:"18",key:"yk5zj1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const XH=q("Merge",[["path",{d:"m8 6 4-4 4 4",key:"ybng9g"}],["path",{d:"M12 2v10.3a4 4 0 0 1-1.172 2.872L4 22",key:"1hyw0i"}],["path",{d:"m20 22-5-5",key:"1m27yz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const QH=q("MessageCircleCode",[["path",{d:"M10 9.5 8 12l2 2.5",key:"3mjy60"}],["path",{d:"m14 9.5 2 2.5-2 2.5",key:"1bir2l"}],["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22z",key:"k85zhp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const JH=q("MessageCircleDashed",[["path",{d:"M13.5 3.1c-.5 0-1-.1-1.5-.1s-1 .1-1.5.1",key:"16ll65"}],["path",{d:"M19.3 6.8a10.45 10.45 0 0 0-2.1-2.1",key:"1nq77a"}],["path",{d:"M20.9 13.5c.1-.5.1-1 .1-1.5s-.1-1-.1-1.5",key:"1sf7wn"}],["path",{d:"M17.2 19.3a10.45 10.45 0 0 0 2.1-2.1",key:"x1hs5g"}],["path",{d:"M10.5 20.9c.5.1 1 .1 1.5.1s1-.1 1.5-.1",key:"19m18z"}],["path",{d:"M3.5 17.5 2 22l4.5-1.5",key:"1f36qi"}],["path",{d:"M3.1 10.5c0 .5-.1 1-.1 1.5s.1 1 .1 1.5",key:"1vz3ju"}],["path",{d:"M6.8 4.7a10.45 10.45 0 0 0-2.1 2.1",key:"19f9do"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ES=q("MessageCircleHeart",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}],["path",{d:"M15.8 9.2a2.5 2.5 0 0 0-3.5 0l-.3.4-.35-.3a2.42 2.42 0 1 0-3.2 3.6l3.6 3.5 3.6-3.5c1.2-1.2 1.1-2.7.2-3.7",key:"43lnbm"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const eW=q("MessageCircleMore",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}],["path",{d:"M8 12h.01",key:"czm47f"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M16 12h.01",key:"1l6xoz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tW=q("MessageCircleOff",[["path",{d:"M20.5 14.9A9 9 0 0 0 9.1 3.5",key:"1iebmn"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M5.6 5.6C3 8.3 2.2 12.5 4 16l-2 6 6-2c3.4 1.8 7.6 1.1 10.3-1.7",key:"1ov8ce"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rW=q("MessageCirclePlus",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dA=q("MessageCircleQuestion",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nW=q("MessageCircleReply",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}],["path",{d:"m10 15-3-3 3-3",key:"1pgupc"}],["path",{d:"M7 12h7a2 2 0 0 1 2 2v1",key:"1gheu4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sW=q("MessageCircleWarning",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const aW=q("MessageCircleX",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ul=q("MessageCircle",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const iW=q("MessageSquareCode",[["path",{d:"M10 7.5 8 10l2 2.5",key:"xb17xw"}],["path",{d:"m14 7.5 2 2.5-2 2.5",key:"5rap1v"}],["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oW=q("MessageSquareDashed",[["path",{d:"M10 17H7l-4 4v-7",key:"1r71xu"}],["path",{d:"M14 17h1",key:"nufu4t"}],["path",{d:"M14 3h1",key:"1ec4yj"}],["path",{d:"M19 3a2 2 0 0 1 2 2",key:"18rm91"}],["path",{d:"M21 14v1a2 2 0 0 1-2 2",key:"29akq3"}],["path",{d:"M21 9v1",key:"mxsmne"}],["path",{d:"M3 9v1",key:"1r0deq"}],["path",{d:"M5 3a2 2 0 0 0-2 2",key:"y57alp"}],["path",{d:"M9 3h1",key:"1yesri"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lW=q("MessageSquareDiff",[["path",{d:"m5 19-2 2V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2",key:"1xuzuj"}],["path",{d:"M9 10h6",key:"9gxzsh"}],["path",{d:"M12 7v6",key:"lw1j43"}],["path",{d:"M9 17h6",key:"r8uit2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cW=q("MessageSquareDot",[["path",{d:"M11.7 3H5a2 2 0 0 0-2 2v16l4-4h12a2 2 0 0 0 2-2v-2.7",key:"uodpkb"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dW=q("MessageSquareHeart",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}],["path",{d:"M14.8 7.5a1.84 1.84 0 0 0-2.6 0l-.2.3-.3-.3a1.84 1.84 0 1 0-2.4 2.8L12 13l2.7-2.7c.9-.9.8-2.1.1-2.8",key:"1blaws"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uW=q("MessageSquareLock",[["path",{d:"M19 15v-2a2 2 0 1 0-4 0v2",key:"h3d1vz"}],["path",{d:"M9 17H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v3.5",key:"xsnnhn"}],["rect",{x:"13",y:"15",width:"8",height:"5",rx:"1",key:"1ccwuk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hW=q("MessageSquareMore",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}],["path",{d:"M8 10h.01",key:"19clt8"}],["path",{d:"M12 10h.01",key:"1nrarc"}],["path",{d:"M16 10h.01",key:"1m94wz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fW=q("MessageSquareOff",[["path",{d:"M21 15V5a2 2 0 0 0-2-2H9",key:"43el77"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M3.6 3.6c-.4.3-.6.8-.6 1.4v16l4-4h10",key:"pwpm4a"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pW=q("MessageSquarePlus",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}],["path",{d:"M12 7v6",key:"lw1j43"}],["path",{d:"M9 10h6",key:"9gxzsh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uA=q("MessageSquareQuote",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}],["path",{d:"M8 12a2 2 0 0 0 2-2V8H8",key:"1jfesj"}],["path",{d:"M14 12a2 2 0 0 0 2-2V8h-2",key:"1dq9mh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mW=q("MessageSquareReply",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}],["path",{d:"m10 7-3 3 3 3",key:"1eugdv"}],["path",{d:"M17 13v-1a2 2 0 0 0-2-2H7",key:"ernfh3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gW=q("MessageSquareShare",[["path",{d:"M21 12v3a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h7",key:"tqtdkg"}],["path",{d:"M16 3h5v5",key:"1806ms"}],["path",{d:"m16 8 5-5",key:"15mbrl"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xW=q("MessageSquareText",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}],["path",{d:"M13 8H7",key:"14i4kc"}],["path",{d:"M17 12H7",key:"16if0g"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yW=q("MessageSquareWarning",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}],["path",{d:"M12 7v2",key:"stiyo7"}],["path",{d:"M12 13h.01",key:"y0uutt"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vW=q("MessageSquareX",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}],["path",{d:"m14.5 7.5-5 5",key:"3lb6iw"}],["path",{d:"m9.5 7.5 5 5",key:"ko136h"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zo=q("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _W=q("MessagesSquare",[["path",{d:"M14 9a2 2 0 0 1-2 2H6l-4 4V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2z",key:"p1xzt8"}],["path",{d:"M18 9h2a2 2 0 0 1 2 2v11l-4-4h-6a2 2 0 0 1-2-2v-1",key:"1cx29u"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bW=q("MicOff",[["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}],["path",{d:"M18.89 13.23A7.12 7.12 0 0 0 19 12v-2",key:"80xlxr"}],["path",{d:"M5 10v2a7 7 0 0 0 12 5",key:"p2k8kg"}],["path",{d:"M15 9.34V5a3 3 0 0 0-5.68-1.33",key:"1gzdoj"}],["path",{d:"M9 9v3a3 3 0 0 0 5.12 2.12",key:"r2i35w"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const l2=q("MicVocal",[["path",{d:"m11 7.601-5.994 8.19a1 1 0 0 0 .1 1.298l.817.818a1 1 0 0 0 1.314.087L15.09 12",key:"80a601"}],["path",{d:"M16.5 21.174C15.5 20.5 14.372 20 13 20c-2.058 0-3.928 2.356-6 2-2.072-.356-2.775-3.369-1.5-4.5",key:"j0ngtp"}],["circle",{cx:"16",cy:"7",r:"5",key:"d08jfb"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hA=q("Mic",[["path",{d:"M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z",key:"131961"}],["path",{d:"M19 10v2a7 7 0 0 1-14 0v-2",key:"1vc78b"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wW=q("Microchip",[["path",{d:"M18 12h2",key:"quuxs7"}],["path",{d:"M18 16h2",key:"zsn3lv"}],["path",{d:"M18 20h2",key:"9x5y9y"}],["path",{d:"M18 4h2",key:"1luxfb"}],["path",{d:"M18 8h2",key:"nxqzg"}],["path",{d:"M4 12h2",key:"1ltxp0"}],["path",{d:"M4 16h2",key:"8a5zha"}],["path",{d:"M4 20h2",key:"27dk57"}],["path",{d:"M4 4h2",key:"10groj"}],["path",{d:"M4 8h2",key:"18vq6w"}],["path",{d:"M8 2a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2h-1.5c-.276 0-.494.227-.562.495a2 2 0 0 1-3.876 0C9.994 2.227 9.776 2 9.5 2z",key:"1681fp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jW=q("Microscope",[["path",{d:"M6 18h8",key:"1borvv"}],["path",{d:"M3 22h18",key:"8prr45"}],["path",{d:"M14 22a7 7 0 1 0 0-14h-1",key:"1jwaiy"}],["path",{d:"M9 14h2",key:"197e7h"}],["path",{d:"M9 12a2 2 0 0 1-2-2V6h6v4a2 2 0 0 1-2 2Z",key:"1bmzmy"}],["path",{d:"M12 6V3a1 1 0 0 0-1-1H9a1 1 0 0 0-1 1v3",key:"1drr47"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kW=q("Microwave",[["rect",{width:"20",height:"15",x:"2",y:"4",rx:"2",key:"2no95f"}],["rect",{width:"8",height:"7",x:"6",y:"8",rx:"1",key:"zh9wx"}],["path",{d:"M18 8v7",key:"o5zi4n"}],["path",{d:"M6 19v2",key:"1loha6"}],["path",{d:"M18 19v2",key:"1dawf0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const NW=q("Milestone",[["path",{d:"M12 13v8",key:"1l5pq0"}],["path",{d:"M12 3v3",key:"1n5kay"}],["path",{d:"M4 6a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1h13a2 2 0 0 0 1.152-.365l3.424-2.317a1 1 0 0 0 0-1.635l-3.424-2.318A2 2 0 0 0 17 6z",key:"1btarq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const SW=q("MilkOff",[["path",{d:"M8 2h8",key:"1ssgc1"}],["path",{d:"M9 2v1.343M15 2v2.789a4 4 0 0 0 .672 2.219l.656.984a4 4 0 0 1 .672 2.22v1.131M7.8 7.8l-.128.192A4 4 0 0 0 7 10.212V20a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2v-3",key:"y0ejgx"}],["path",{d:"M7 15a6.47 6.47 0 0 1 5 0 6.472 6.472 0 0 0 3.435.435",key:"iaxqsy"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const CW=q("Milk",[["path",{d:"M8 2h8",key:"1ssgc1"}],["path",{d:"M9 2v2.789a4 4 0 0 1-.672 2.219l-.656.984A4 4 0 0 0 7 10.212V20a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2v-9.789a4 4 0 0 0-.672-2.219l-.656-.984A4 4 0 0 1 15 4.788V2",key:"qtp12x"}],["path",{d:"M7 15a6.472 6.472 0 0 1 5 0 6.47 6.47 0 0 0 5 0",key:"ygeh44"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const MW=q("Minimize2",[["polyline",{points:"4 14 10 14 10 20",key:"11kfnr"}],["polyline",{points:"20 10 14 10 14 4",key:"rlmsce"}],["line",{x1:"14",x2:"21",y1:"10",y2:"3",key:"o5lafz"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const TW=q("Minimize",[["path",{d:"M8 3v3a2 2 0 0 1-2 2H3",key:"hohbtr"}],["path",{d:"M21 8h-3a2 2 0 0 1-2-2V3",key:"5jw1f3"}],["path",{d:"M3 16h3a2 2 0 0 1 2 2v3",key:"198tvr"}],["path",{d:"M16 21v-3a2 2 0 0 1 2-2h3",key:"ph8mxp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const G1=q("Minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const AW=q("MonitorCheck",[["path",{d:"m9 10 2 2 4-4",key:"1gnqz4"}],["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"M8 21h8",key:"1ev6f3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const EW=q("MonitorCog",[["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"m15.2 4.9-.9-.4",key:"12wd2u"}],["path",{d:"m15.2 7.1-.9.4",key:"1r2vl7"}],["path",{d:"m16.9 3.2-.4-.9",key:"3zbo91"}],["path",{d:"m16.9 8.8-.4.9",key:"1qr2dn"}],["path",{d:"m19.5 2.3-.4.9",key:"1rjrkq"}],["path",{d:"m19.5 9.7-.4-.9",key:"heryx5"}],["path",{d:"m21.7 4.5-.9.4",key:"17fqt1"}],["path",{d:"m21.7 7.5-.9-.4",key:"14zyni"}],["path",{d:"M22 13v2a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7",key:"1tnzv8"}],["path",{d:"M8 21h8",key:"1ev6f3"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const IW=q("MonitorDot",[["circle",{cx:"19",cy:"6",r:"3",key:"108a5v"}],["path",{d:"M22 12v3a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h9",key:"1fet9y"}],["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"M8 21h8",key:"1ev6f3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const PW=q("MonitorDown",[["path",{d:"M12 13V7",key:"h0r20n"}],["path",{d:"m15 10-3 3-3-3",key:"lzhmyn"}],["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"M8 21h8",key:"1ev6f3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const LW=q("MonitorOff",[["path",{d:"M17 17H4a2 2 0 0 1-2-2V5c0-1.5 1-2 1-2",key:"k0q8oc"}],["path",{d:"M22 15V5a2 2 0 0 0-2-2H9",key:"cp1ac0"}],["path",{d:"M8 21h8",key:"1ev6f3"}],["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const OW=q("MonitorPause",[["path",{d:"M10 13V7",key:"1u13u9"}],["path",{d:"M14 13V7",key:"1vj9om"}],["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"M8 21h8",key:"1ev6f3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const DW=q("MonitorPlay",[["path",{d:"M10 7.75a.75.75 0 0 1 1.142-.638l3.664 2.249a.75.75 0 0 1 0 1.278l-3.664 2.25a.75.75 0 0 1-1.142-.64z",key:"1pctta"}],["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"M8 21h8",key:"1ev6f3"}],["rect",{x:"2",y:"3",width:"20",height:"14",rx:"2",key:"x3v2xh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const RW=q("MonitorSmartphone",[["path",{d:"M18 8V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h8",key:"10dyio"}],["path",{d:"M10 19v-3.96 3.15",key:"1irgej"}],["path",{d:"M7 19h5",key:"qswx4l"}],["rect",{width:"6",height:"10",x:"16",y:"12",rx:"2",key:"1egngj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const FW=q("MonitorSpeaker",[["path",{d:"M5.5 20H8",key:"1k40s5"}],["path",{d:"M17 9h.01",key:"1j24nn"}],["rect",{width:"10",height:"16",x:"12",y:"4",rx:"2",key:"ixliua"}],["path",{d:"M8 6H4a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2h4",key:"1mp6e1"}],["circle",{cx:"17",cy:"15",r:"1",key:"tqvash"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zW=q("MonitorStop",[["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"M8 21h8",key:"1ev6f3"}],["rect",{x:"2",y:"3",width:"20",height:"14",rx:"2",key:"x3v2xh"}],["rect",{x:"9",y:"7",width:"6",height:"6",rx:"1",key:"5m2oou"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const BW=q("MonitorUp",[["path",{d:"m9 10 3-3 3 3",key:"11gsxs"}],["path",{d:"M12 13V7",key:"h0r20n"}],["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"M8 21h8",key:"1ev6f3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $W=q("MonitorX",[["path",{d:"m14.5 12.5-5-5",key:"1jahn5"}],["path",{d:"m9.5 12.5 5-5",key:"1k2t7b"}],["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"M8 21h8",key:"1ev6f3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Rj=q("Monitor",[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const UW=q("MoonStar",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9",key:"4ay0iu"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qW=q("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const VW=q("MountainSnow",[["path",{d:"m8 3 4 8 5-5 5 15H2L8 3z",key:"otkl63"}],["path",{d:"M4.14 15.08c2.62-1.57 5.24-1.43 7.86.42 2.74 1.94 5.49 2 8.23.19",key:"1pvmmp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const HW=q("Mountain",[["path",{d:"m8 3 4 8 5-5 5 15H2L8 3z",key:"otkl63"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const WW=q("MouseOff",[["path",{d:"M12 6v.343",key:"1gyhex"}],["path",{d:"M18.218 18.218A7 7 0 0 1 5 15V9a7 7 0 0 1 .782-3.218",key:"ukzz01"}],["path",{d:"M19 13.343V9A7 7 0 0 0 8.56 2.902",key:"104jy9"}],["path",{d:"M22 22 2 2",key:"1r8tn9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const GW=q("MousePointer2",[["path",{d:"M4.037 4.688a.495.495 0 0 1 .651-.651l16 6.5a.5.5 0 0 1-.063.947l-6.124 1.58a2 2 0 0 0-1.438 1.435l-1.579 6.126a.5.5 0 0 1-.947.063z",key:"edeuup"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const KW=q("MousePointerBan",[["path",{d:"M2.034 2.681a.498.498 0 0 1 .647-.647l9 3.5a.5.5 0 0 1-.033.944L8.204 7.545a1 1 0 0 0-.66.66l-1.066 3.443a.5.5 0 0 1-.944.033z",key:"11pp1i"}],["circle",{cx:"16",cy:"16",r:"6",key:"qoo3c4"}],["path",{d:"m11.8 11.8 8.4 8.4",key:"oogvdj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Fj=q("MousePointerClick",[["path",{d:"M14 4.1 12 6",key:"ita8i4"}],["path",{d:"m5.1 8-2.9-.8",key:"1go3kf"}],["path",{d:"m6 12-1.9 2",key:"mnht97"}],["path",{d:"M7.2 2.2 8 5.1",key:"1cfko1"}],["path",{d:"M9.037 9.69a.498.498 0 0 1 .653-.653l11 4.5a.5.5 0 0 1-.074.949l-4.349 1.041a1 1 0 0 0-.74.739l-1.04 4.35a.5.5 0 0 1-.95.074z",key:"s0h3yz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ZW=q("MousePointer",[["path",{d:"M12.586 12.586 19 19",key:"ea5xo7"}],["path",{d:"M3.688 3.037a.497.497 0 0 0-.651.651l6.5 15.999a.501.501 0 0 0 .947-.062l1.569-6.083a2 2 0 0 1 1.448-1.479l6.124-1.579a.5.5 0 0 0 .063-.947z",key:"277e5u"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const YW=q("Mouse",[["rect",{x:"5",y:"2",width:"14",height:"20",rx:"7",key:"11ol66"}],["path",{d:"M12 6v4",key:"16clxf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const c2=q("Move3d",[["path",{d:"M5 3v16h16",key:"1mqmf9"}],["path",{d:"m5 19 6-6",key:"jh6hbb"}],["path",{d:"m2 6 3-3 3 3",key:"tkyvxa"}],["path",{d:"m18 16 3 3-3 3",key:"1d4glt"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const XW=q("MoveDiagonal2",[["path",{d:"M19 13v6h-6",key:"1hxl6d"}],["path",{d:"M5 11V5h6",key:"12e2xe"}],["path",{d:"m5 5 14 14",key:"11anup"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const QW=q("MoveDiagonal",[["path",{d:"M11 19H5v-6",key:"8awifj"}],["path",{d:"M13 5h6v6",key:"7voy1q"}],["path",{d:"M19 5 5 19",key:"wwaj1z"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const JW=q("MoveDownLeft",[["path",{d:"M11 19H5V13",key:"1akmht"}],["path",{d:"M19 5L5 19",key:"72u4yj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const eG=q("MoveDownRight",[["path",{d:"M19 13V19H13",key:"10vkzq"}],["path",{d:"M5 5L19 19",key:"5zm2fv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tG=q("MoveDown",[["path",{d:"M8 18L12 22L16 18",key:"cskvfv"}],["path",{d:"M12 2V22",key:"r89rzk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rG=q("MoveHorizontal",[["path",{d:"m18 8 4 4-4 4",key:"1ak13k"}],["path",{d:"M2 12h20",key:"9i4pu4"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nG=q("MoveLeft",[["path",{d:"M6 8L2 12L6 16",key:"kyvwex"}],["path",{d:"M2 12H22",key:"1m8cig"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sG=q("MoveRight",[["path",{d:"M18 8L22 12L18 16",key:"1r0oui"}],["path",{d:"M2 12H22",key:"1m8cig"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const aG=q("MoveUpLeft",[["path",{d:"M5 11V5H11",key:"3q78g9"}],["path",{d:"M5 5L19 19",key:"5zm2fv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const iG=q("MoveUpRight",[["path",{d:"M13 5H19V11",key:"1n1gyv"}],["path",{d:"M19 5L5 19",key:"72u4yj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oG=q("MoveUp",[["path",{d:"M8 6L12 2L16 6",key:"1yvkyx"}],["path",{d:"M12 2V22",key:"r89rzk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lG=q("MoveVertical",[["path",{d:"M12 2v20",key:"t6zp3m"}],["path",{d:"m8 18 4 4 4-4",key:"bh5tu3"}],["path",{d:"m8 6 4-4 4 4",key:"ybng9g"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cG=q("Move",[["path",{d:"M12 2v20",key:"t6zp3m"}],["path",{d:"m15 19-3 3-3-3",key:"11eu04"}],["path",{d:"m19 9 3 3-3 3",key:"1mg7y2"}],["path",{d:"M2 12h20",key:"9i4pu4"}],["path",{d:"m5 9-3 3 3 3",key:"j64kie"}],["path",{d:"m9 5 3-3 3 3",key:"l8vdw6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dG=q("Music2",[["circle",{cx:"8",cy:"18",r:"4",key:"1fc0mg"}],["path",{d:"M12 18V2l7 4",key:"g04rme"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uG=q("Music3",[["circle",{cx:"12",cy:"18",r:"4",key:"m3r9ws"}],["path",{d:"M16 18V2",key:"40x2m5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hG=q("Music4",[["path",{d:"M9 18V5l12-2v13",key:"1jmyc2"}],["path",{d:"m9 9 12-2",key:"1e64n2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["circle",{cx:"18",cy:"16",r:"3",key:"1hluhg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fG=q("Music",[["path",{d:"M9 18V5l12-2v13",key:"1jmyc2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["circle",{cx:"18",cy:"16",r:"3",key:"1hluhg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pG=q("Navigation2Off",[["path",{d:"M9.31 9.31 5 21l7-4 7 4-1.17-3.17",key:"qoq2o2"}],["path",{d:"M14.53 8.88 12 2l-1.17 3.17",key:"k3sjzy"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mG=q("Navigation2",[["polygon",{points:"12 2 19 21 12 17 5 21 12 2",key:"x8c0qg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gG=q("NavigationOff",[["path",{d:"M8.43 8.43 3 11l8 2 2 8 2.57-5.43",key:"1vdtb7"}],["path",{d:"M17.39 11.73 22 2l-9.73 4.61",key:"tya3r6"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fA=q("Navigation",[["polygon",{points:"3 11 22 2 13 21 11 13 3 11",key:"1ltx0t"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xG=q("Network",[["rect",{x:"16",y:"16",width:"6",height:"6",rx:"1",key:"4q2zg0"}],["rect",{x:"2",y:"16",width:"6",height:"6",rx:"1",key:"8cvhb9"}],["rect",{x:"9",y:"2",width:"6",height:"6",rx:"1",key:"1egb70"}],["path",{d:"M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3",key:"1jsf9p"}],["path",{d:"M12 12V8",key:"2874zd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fy=q("Newspaper",[["path",{d:"M4 22h16a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2H8a2 2 0 0 0-2 2v16a2 2 0 0 1-2 2Zm0 0a2 2 0 0 1-2-2v-9c0-1.1.9-2 2-2h2",key:"7pis2x"}],["path",{d:"M18 14h-8",key:"sponae"}],["path",{d:"M15 18h-5",key:"95g1m2"}],["path",{d:"M10 6h8v4h-8V6Z",key:"smlsk5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yG=q("Nfc",[["path",{d:"M6 8.32a7.43 7.43 0 0 1 0 7.36",key:"9iaqei"}],["path",{d:"M9.46 6.21a11.76 11.76 0 0 1 0 11.58",key:"1yha7l"}],["path",{d:"M12.91 4.1a15.91 15.91 0 0 1 .01 15.8",key:"4iu2gk"}],["path",{d:"M16.37 2a20.16 20.16 0 0 1 0 20",key:"sap9u2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vG=q("NotebookPen",[["path",{d:"M13.4 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-7.4",key:"re6nr2"}],["path",{d:"M2 6h4",key:"aawbzj"}],["path",{d:"M2 10h4",key:"l0bgd4"}],["path",{d:"M2 14h4",key:"1gsvsf"}],["path",{d:"M2 18h4",key:"1bu2t1"}],["path",{d:"M21.378 5.626a1 1 0 1 0-3.004-3.004l-5.01 5.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z",key:"pqwjuv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _G=q("NotebookTabs",[["path",{d:"M2 6h4",key:"aawbzj"}],["path",{d:"M2 10h4",key:"l0bgd4"}],["path",{d:"M2 14h4",key:"1gsvsf"}],["path",{d:"M2 18h4",key:"1bu2t1"}],["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",key:"1nb95v"}],["path",{d:"M15 2v20",key:"dcj49h"}],["path",{d:"M15 7h5",key:"1xj5lc"}],["path",{d:"M15 12h5",key:"w5shd9"}],["path",{d:"M15 17h5",key:"1qaofu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bG=q("NotebookText",[["path",{d:"M2 6h4",key:"aawbzj"}],["path",{d:"M2 10h4",key:"l0bgd4"}],["path",{d:"M2 14h4",key:"1gsvsf"}],["path",{d:"M2 18h4",key:"1bu2t1"}],["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",key:"1nb95v"}],["path",{d:"M9.5 8h5",key:"11mslq"}],["path",{d:"M9.5 12H16",key:"ktog6x"}],["path",{d:"M9.5 16H14",key:"p1seyn"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wG=q("Notebook",[["path",{d:"M2 6h4",key:"aawbzj"}],["path",{d:"M2 10h4",key:"l0bgd4"}],["path",{d:"M2 14h4",key:"1gsvsf"}],["path",{d:"M2 18h4",key:"1bu2t1"}],["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",key:"1nb95v"}],["path",{d:"M16 2v20",key:"rotuqe"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jG=q("NotepadTextDashed",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v2",key:"j91f56"}],["path",{d:"M20 12v2",key:"w8o0tu"}],["path",{d:"M20 18v2a2 2 0 0 1-2 2h-1",key:"1c9ggx"}],["path",{d:"M13 22h-2",key:"191ugt"}],["path",{d:"M7 22H6a2 2 0 0 1-2-2v-2",key:"1rt9px"}],["path",{d:"M4 14v-2",key:"1v0sqh"}],["path",{d:"M4 8V6a2 2 0 0 1 2-2h2",key:"1mwabg"}],["path",{d:"M8 10h6",key:"3oa6kw"}],["path",{d:"M8 14h8",key:"1fgep2"}],["path",{d:"M8 18h5",key:"17enja"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kG=q("NotepadText",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"16",height:"18",x:"4",y:"4",rx:"2",key:"1u9h20"}],["path",{d:"M8 10h6",key:"3oa6kw"}],["path",{d:"M8 14h8",key:"1fgep2"}],["path",{d:"M8 18h5",key:"17enja"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const NG=q("NutOff",[["path",{d:"M12 4V2",key:"1k5q1u"}],["path",{d:"M5 10v4a7.004 7.004 0 0 0 5.277 6.787c.412.104.802.292 1.102.592L12 22l.621-.621c.3-.3.69-.488 1.102-.592a7.01 7.01 0 0 0 4.125-2.939",key:"1xcvy9"}],["path",{d:"M19 10v3.343",key:"163tfc"}],["path",{d:"M12 12c-1.349-.573-1.905-1.005-2.5-2-.546.902-1.048 1.353-2.5 2-1.018-.644-1.46-1.08-2-2-1.028.71-1.69.918-3 1 1.081-1.048 1.757-2.03 2-3 .194-.776.84-1.551 1.79-2.21m11.654 5.997c.887-.457 1.28-.891 1.556-1.787 1.032.916 1.683 1.157 3 1-1.297-1.036-1.758-2.03-2-3-.5-2-4-4-8-4-.74 0-1.461.068-2.15.192",key:"17914v"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const SG=q("Nut",[["path",{d:"M12 4V2",key:"1k5q1u"}],["path",{d:"M5 10v4a7.004 7.004 0 0 0 5.277 6.787c.412.104.802.292 1.102.592L12 22l.621-.621c.3-.3.69-.488 1.102-.592A7.003 7.003 0 0 0 19 14v-4",key:"1tgyif"}],["path",{d:"M12 4C8 4 4.5 6 4 8c-.243.97-.919 1.952-2 3 1.31-.082 1.972-.29 3-1 .54.92.982 1.356 2 2 1.452-.647 1.954-1.098 2.5-2 .595.995 1.151 1.427 2.5 2 1.31-.621 1.862-1.058 2.5-2 .629.977 1.162 1.423 2.5 2 1.209-.548 1.68-.967 2-2 1.032.916 1.683 1.157 3 1-1.297-1.036-1.758-2.03-2-3-.5-2-4-4-8-4Z",key:"tnsqj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const d2=q("OctagonAlert",[["path",{d:"M12 16h.01",key:"1drbdi"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M15.312 2a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586l-4.688-4.688A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2z",key:"1fd625"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const CG=q("OctagonMinus",[["path",{d:"M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z",key:"2d38gg"}],["path",{d:"M8 12h8",key:"1wcyev"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const u2=q("OctagonPause",[["path",{d:"M10 15V9",key:"1lckn7"}],["path",{d:"M14 15V9",key:"1muqhk"}],["path",{d:"M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z",key:"2d38gg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const h2=q("OctagonX",[["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z",key:"2d38gg"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const MG=q("Octagon",[["path",{d:"M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z",key:"2d38gg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const TG=q("Omega",[["path",{d:"M3 20h4.5a.5.5 0 0 0 .5-.5v-.282a.52.52 0 0 0-.247-.437 8 8 0 1 1 8.494-.001.52.52 0 0 0-.247.438v.282a.5.5 0 0 0 .5.5H21",key:"1x94xo"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const AG=q("Option",[["path",{d:"M3 3h6l6 18h6",key:"ph9rgk"}],["path",{d:"M14 3h7",key:"16f0ms"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const EG=q("Orbit",[["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["circle",{cx:"19",cy:"5",r:"2",key:"mhkx31"}],["circle",{cx:"5",cy:"19",r:"2",key:"v8kfzx"}],["path",{d:"M10.4 21.9a10 10 0 0 0 9.941-15.416",key:"eohfx2"}],["path",{d:"M13.5 2.1a10 10 0 0 0-9.841 15.416",key:"19pvbm"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const IG=q("Origami",[["path",{d:"M12 12V4a1 1 0 0 1 1-1h6.297a1 1 0 0 1 .651 1.759l-4.696 4.025",key:"1bx4vc"}],["path",{d:"m12 21-7.414-7.414A2 2 0 0 1 4 12.172V6.415a1.002 1.002 0 0 1 1.707-.707L20 20.009",key:"1h3km6"}],["path",{d:"m12.214 3.381 8.414 14.966a1 1 0 0 1-.167 1.199l-1.168 1.163a1 1 0 0 1-.706.291H6.351a1 1 0 0 1-.625-.219L3.25 18.8a1 1 0 0 1 .631-1.781l4.165.027",key:"1hj4wg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const PG=q("Package2",[["path",{d:"M3 9h18v10a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V9Z",key:"1ront0"}],["path",{d:"m3 9 2.45-4.9A2 2 0 0 1 7.24 3h9.52a2 2 0 0 1 1.8 1.1L21 9",key:"19h2x1"}],["path",{d:"M12 3v6",key:"1holv5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const LG=q("PackageCheck",[["path",{d:"m16 16 2 2 4-4",key:"gfu2re"}],["path",{d:"M21 10V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l2-1.14",key:"e7tb2h"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["line",{x1:"12",x2:"12",y1:"22",y2:"12",key:"a4e8g8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const OG=q("PackageMinus",[["path",{d:"M16 16h6",key:"100bgy"}],["path",{d:"M21 10V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l2-1.14",key:"e7tb2h"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["line",{x1:"12",x2:"12",y1:"22",y2:"12",key:"a4e8g8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const DG=q("PackageOpen",[["path",{d:"M12 22v-9",key:"x3hkom"}],["path",{d:"M15.17 2.21a1.67 1.67 0 0 1 1.63 0L21 4.57a1.93 1.93 0 0 1 0 3.36L8.82 14.79a1.655 1.655 0 0 1-1.64 0L3 12.43a1.93 1.93 0 0 1 0-3.36z",key:"2ntwy6"}],["path",{d:"M20 13v3.87a2.06 2.06 0 0 1-1.11 1.83l-6 3.08a1.93 1.93 0 0 1-1.78 0l-6-3.08A2.06 2.06 0 0 1 4 16.87V13",key:"1pmm1c"}],["path",{d:"M21 12.43a1.93 1.93 0 0 0 0-3.36L8.83 2.2a1.64 1.64 0 0 0-1.63 0L3 4.57a1.93 1.93 0 0 0 0 3.36l12.18 6.86a1.636 1.636 0 0 0 1.63 0z",key:"12ttoo"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const RG=q("PackagePlus",[["path",{d:"M16 16h6",key:"100bgy"}],["path",{d:"M19 13v6",key:"85cyf1"}],["path",{d:"M21 10V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l2-1.14",key:"e7tb2h"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["line",{x1:"12",x2:"12",y1:"22",y2:"12",key:"a4e8g8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const FG=q("PackageSearch",[["path",{d:"M21 10V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l2-1.14",key:"e7tb2h"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["line",{x1:"12",x2:"12",y1:"22",y2:"12",key:"a4e8g8"}],["circle",{cx:"18.5",cy:"15.5",r:"2.5",key:"b5zd12"}],["path",{d:"M20.27 17.27 22 19",key:"1l4muz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zG=q("PackageX",[["path",{d:"M21 10V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l2-1.14",key:"e7tb2h"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}],["polyline",{points:"3.29 7 12 12 20.71 7",key:"ousv84"}],["line",{x1:"12",x2:"12",y1:"22",y2:"12",key:"a4e8g8"}],["path",{d:"m17 13 5 5m-5 0 5-5",key:"im3w4b"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ql=q("Package",[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["path",{d:"m3.3 7 7.703 4.734a2 2 0 0 0 1.994 0L20.7 7",key:"yx3hmr"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const BG=q("PaintBucket",[["path",{d:"m19 11-8-8-8.6 8.6a2 2 0 0 0 0 2.8l5.2 5.2c.8.8 2 .8 2.8 0L19 11Z",key:"irua1i"}],["path",{d:"m5 2 5 5",key:"1lls2c"}],["path",{d:"M2 13h15",key:"1hkzvu"}],["path",{d:"M22 20a2 2 0 1 1-4 0c0-1.6 1.7-2.4 2-4 .3 1.6 2 2.4 2 4Z",key:"xk76lq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $G=q("PaintRoller",[["rect",{width:"16",height:"6",x:"2",y:"2",rx:"2",key:"jcyz7m"}],["path",{d:"M10 16v-2a2 2 0 0 1 2-2h8a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2h-2",key:"1b9h7c"}],["rect",{width:"4",height:"6",x:"8",y:"16",rx:"1",key:"d6e7yl"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const f2=q("PaintbrushVertical",[["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M14 2v4",key:"qmzblu"}],["path",{d:"M17 2a1 1 0 0 1 1 1v9H6V3a1 1 0 0 1 1-1z",key:"ycvu00"}],["path",{d:"M6 12a1 1 0 0 0-1 1v1a2 2 0 0 0 2 2h2a1 1 0 0 1 1 1v2.9a2 2 0 1 0 4 0V17a1 1 0 0 1 1-1h2a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1",key:"iw4wnp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const UG=q("Paintbrush",[["path",{d:"m14.622 17.897-10.68-2.913",key:"vj2p1u"}],["path",{d:"M18.376 2.622a1 1 0 1 1 3.002 3.002L17.36 9.643a.5.5 0 0 0 0 .707l.944.944a2.41 2.41 0 0 1 0 3.408l-.944.944a.5.5 0 0 1-.707 0L8.354 7.348a.5.5 0 0 1 0-.707l.944-.944a2.41 2.41 0 0 1 3.408 0l.944.944a.5.5 0 0 0 .707 0z",key:"18tc5c"}],["path",{d:"M9 8c-1.804 2.71-3.97 3.46-6.583 3.948a.507.507 0 0 0-.302.819l7.32 8.883a1 1 0 0 0 1.185.204C12.735 20.405 16 16.792 16 15",key:"ytzfxy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Uc=q("Palette",[["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["path",{d:"M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.926 0 1.648-.746 1.648-1.688 0-.437-.18-.835-.437-1.125-.29-.289-.438-.652-.438-1.125a1.64 1.64 0 0 1 1.668-1.668h1.996c3.051 0 5.555-2.503 5.555-5.554C21.965 6.012 17.461 2 12 2z",key:"12rzf8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qG=q("PanelBottomClose",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 15h18",key:"5xshup"}],["path",{d:"m15 8-3 3-3-3",key:"1oxy1z"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const p2=q("PanelBottomDashed",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M14 15h1",key:"171nev"}],["path",{d:"M19 15h2",key:"1vnucp"}],["path",{d:"M3 15h2",key:"8bym0q"}],["path",{d:"M9 15h1",key:"1tg3ks"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const VG=q("PanelBottomOpen",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 15h18",key:"5xshup"}],["path",{d:"m9 10 3-3 3 3",key:"11gsxs"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const HG=q("PanelBottom",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 15h18",key:"5xshup"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const m2=q("PanelLeftClose",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m16 15-3-3 3-3",key:"14y99z"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const g2=q("PanelLeftDashed",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 14v1",key:"askpd8"}],["path",{d:"M9 19v2",key:"16tejx"}],["path",{d:"M9 3v2",key:"1noubl"}],["path",{d:"M9 9v1",key:"19ebxg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const x2=q("PanelLeftOpen",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m14 9 3 3-3 3",key:"8010ee"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const y2=q("PanelLeft",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const WG=q("PanelRightClose",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m8 9 3 3-3 3",key:"12hl5m"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const v2=q("PanelRightDashed",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 14v1",key:"ilsfch"}],["path",{d:"M15 19v2",key:"1fst2f"}],["path",{d:"M15 3v2",key:"z204g4"}],["path",{d:"M15 9v1",key:"z2a8b1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const GG=q("PanelRightOpen",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}],["path",{d:"m10 15-3-3 3-3",key:"1pgupc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const KG=q("PanelRight",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M15 3v18",key:"14nvp0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ZG=q("PanelTopClose",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"m9 16 3-3 3 3",key:"1idcnm"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _2=q("PanelTopDashed",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M14 9h1",key:"l0svgy"}],["path",{d:"M19 9h2",key:"te2zfg"}],["path",{d:"M3 9h2",key:"1h4ldw"}],["path",{d:"M9 9h1",key:"15jzuz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const YG=q("PanelTopOpen",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"m15 14-3 3-3-3",key:"g215vf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const XG=q("PanelTop",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const QG=q("PanelsLeftBottom",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"M9 15h12",key:"5ijen5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const JG=q("PanelsRightBottom",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 15h12",key:"1wkqb3"}],["path",{d:"M15 3v18",key:"14nvp0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const H0=q("PanelsTopLeft",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M9 21V9",key:"1oto5p"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const eK=q("Paperclip",[["path",{d:"m21.44 11.05-9.19 9.19a6 6 0 0 1-8.49-8.49l8.57-8.57A4 4 0 1 1 18 8.84l-8.59 8.57a2 2 0 0 1-2.83-2.83l8.49-8.48",key:"1u3ebp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tK=q("Parentheses",[["path",{d:"M8 21s-4-3-4-9 4-9 4-9",key:"uto9ud"}],["path",{d:"M16 3s4 3 4 9-4 9-4 9",key:"4w2vsq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rK=q("ParkingMeter",[["path",{d:"M11 15h2",key:"199qp6"}],["path",{d:"M12 12v3",key:"158kv8"}],["path",{d:"M12 19v3",key:"npa21l"}],["path",{d:"M15.282 19a1 1 0 0 0 .948-.68l2.37-6.988a7 7 0 1 0-13.2 0l2.37 6.988a1 1 0 0 0 .948.68z",key:"1jofit"}],["path",{d:"M9 9a3 3 0 1 1 6 0",key:"jdoeu8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qc=q("PartyPopper",[["path",{d:"M5.8 11.3 2 22l10.7-3.79",key:"gwxi1d"}],["path",{d:"M4 3h.01",key:"1vcuye"}],["path",{d:"M22 8h.01",key:"1mrtc2"}],["path",{d:"M15 2h.01",key:"1cjtqr"}],["path",{d:"M22 20h.01",key:"1mrys2"}],["path",{d:"m22 2-2.24.75a2.9 2.9 0 0 0-1.96 3.12c.1.86-.57 1.63-1.45 1.63h-.38c-.86 0-1.6.6-1.76 1.44L14 10",key:"hbicv8"}],["path",{d:"m22 13-.82-.33c-.86-.34-1.82.2-1.98 1.11c-.11.7-.72 1.22-1.43 1.22H17",key:"1i94pl"}],["path",{d:"m11 2 .33.82c.34.86-.2 1.82-1.11 1.98C9.52 4.9 9 5.52 9 6.23V7",key:"1cofks"}],["path",{d:"M11 13c1.93 1.93 2.83 4.17 2 5-.83.83-3.07-.07-5-2-1.93-1.93-2.83-4.17-2-5 .83-.83 3.07.07 5 2Z",key:"4kbmks"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xf=q("Pause",[["rect",{x:"14",y:"4",width:"4",height:"16",rx:"1",key:"zuxfzm"}],["rect",{x:"6",y:"4",width:"4",height:"16",rx:"1",key:"1okwgv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nK=q("PawPrint",[["circle",{cx:"11",cy:"4",r:"2",key:"vol9p0"}],["circle",{cx:"18",cy:"8",r:"2",key:"17gozi"}],["circle",{cx:"20",cy:"16",r:"2",key:"1v9bxh"}],["path",{d:"M9 10a5 5 0 0 1 5 5v3.5a3.5 3.5 0 0 1-6.84 1.045Q6.52 17.48 4.46 16.84A3.5 3.5 0 0 1 5.5 10Z",key:"1ydw1z"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sK=q("PcCase",[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",key:"1uq1d7"}],["path",{d:"M15 14h.01",key:"1kp3bh"}],["path",{d:"M9 6h6",key:"dgm16u"}],["path",{d:"M9 10h6",key:"9gxzsh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const W0=q("PenLine",[["path",{d:"M12 20h9",key:"t2du7b"}],["path",{d:"M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z",key:"1ykcvy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const aK=q("PenOff",[["path",{d:"m10 10-6.157 6.162a2 2 0 0 0-.5.833l-1.322 4.36a.5.5 0 0 0 .622.624l4.358-1.323a2 2 0 0 0 .83-.5L14 13.982",key:"bjo8r8"}],["path",{d:"m12.829 7.172 4.359-4.346a1 1 0 1 1 3.986 3.986l-4.353 4.353",key:"16h5ne"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zj=q("PenTool",[["path",{d:"M15.707 21.293a1 1 0 0 1-1.414 0l-1.586-1.586a1 1 0 0 1 0-1.414l5.586-5.586a1 1 0 0 1 1.414 0l1.586 1.586a1 1 0 0 1 0 1.414z",key:"nt11vn"}],["path",{d:"m18 13-1.375-6.874a1 1 0 0 0-.746-.776L3.235 2.028a1 1 0 0 0-1.207 1.207L5.35 15.879a1 1 0 0 0 .776.746L13 18",key:"15qc1e"}],["path",{d:"m2.3 2.3 7.286 7.286",key:"1wuzzi"}],["circle",{cx:"11",cy:"11",r:"2",key:"xmgehs"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const G0=q("Pen",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const iK=q("PencilLine",[["path",{d:"M12 20h9",key:"t2du7b"}],["path",{d:"M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z",key:"1ykcvy"}],["path",{d:"m15 5 3 3",key:"1w25hb"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oK=q("PencilOff",[["path",{d:"m10 10-6.157 6.162a2 2 0 0 0-.5.833l-1.322 4.36a.5.5 0 0 0 .622.624l4.358-1.323a2 2 0 0 0 .83-.5L14 13.982",key:"bjo8r8"}],["path",{d:"m12.829 7.172 4.359-4.346a1 1 0 1 1 3.986 3.986l-4.353 4.353",key:"16h5ne"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lK=q("PencilRuler",[["path",{d:"M13 7 8.7 2.7a2.41 2.41 0 0 0-3.4 0L2.7 5.3a2.41 2.41 0 0 0 0 3.4L7 13",key:"orapub"}],["path",{d:"m8 6 2-2",key:"115y1s"}],["path",{d:"m18 16 2-2",key:"ee94s4"}],["path",{d:"m17 11 4.3 4.3c.94.94.94 2.46 0 3.4l-2.6 2.6c-.94.94-2.46.94-3.4 0L11 17",key:"cfq27r"}],["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ni=q("Pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cK=q("Pentagon",[["path",{d:"M10.83 2.38a2 2 0 0 1 2.34 0l8 5.74a2 2 0 0 1 .73 2.25l-3.04 9.26a2 2 0 0 1-1.9 1.37H7.04a2 2 0 0 1-1.9-1.37L2.1 10.37a2 2 0 0 1 .73-2.25z",key:"2hea0t"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const IS=q("Percent",[["line",{x1:"19",x2:"5",y1:"5",y2:"19",key:"1x9vlm"}],["circle",{cx:"6.5",cy:"6.5",r:"2.5",key:"4mh3h7"}],["circle",{cx:"17.5",cy:"17.5",r:"2.5",key:"1mdrzq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dK=q("PersonStanding",[["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["path",{d:"m9 20 3-6 3 6",key:"se2kox"}],["path",{d:"m6 8 6 2 6-2",key:"4o3us4"}],["path",{d:"M12 10v4",key:"1kjpxc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uK=q("PhilippinePeso",[["path",{d:"M20 11H4",key:"6ut86h"}],["path",{d:"M20 7H4",key:"zbl0bi"}],["path",{d:"M7 21V4a1 1 0 0 1 1-1h4a1 1 0 0 1 0 12H7",key:"1ana5r"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hK=q("PhoneCall",[["path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z",key:"foiqr5"}],["path",{d:"M14.05 2a9 9 0 0 1 8 7.94",key:"vmijpz"}],["path",{d:"M14.05 6A5 5 0 0 1 18 10",key:"13nbpp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fK=q("PhoneForwarded",[["polyline",{points:"18 2 22 6 18 10",key:"6vjanh"}],["line",{x1:"14",x2:"22",y1:"6",y2:"6",key:"1jsywh"}],["path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z",key:"foiqr5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pK=q("PhoneIncoming",[["polyline",{points:"16 2 16 8 22 8",key:"1ygljm"}],["line",{x1:"22",x2:"16",y1:"2",y2:"8",key:"1xzwqn"}],["path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z",key:"foiqr5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mK=q("PhoneMissed",[["line",{x1:"22",x2:"16",y1:"2",y2:"8",key:"1xzwqn"}],["line",{x1:"16",x2:"22",y1:"2",y2:"8",key:"13zxdn"}],["path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z",key:"foiqr5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gK=q("PhoneOff",[["path",{d:"M10.68 13.31a16 16 0 0 0 3.41 2.6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7 2 2 0 0 1 1.72 2v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.42 19.42 0 0 1-3.33-2.67m-2.67-3.34a19.79 19.79 0 0 1-3.07-8.63A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91",key:"z86iuo"}],["line",{x1:"22",x2:"2",y1:"2",y2:"22",key:"11kh81"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xK=q("PhoneOutgoing",[["polyline",{points:"22 8 22 2 16 2",key:"1g204g"}],["line",{x1:"16",x2:"22",y1:"8",y2:"2",key:"1ggias"}],["path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z",key:"foiqr5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ti=q("Phone",[["path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z",key:"foiqr5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yK=q("Pi",[["line",{x1:"9",x2:"9",y1:"4",y2:"20",key:"ovs5a5"}],["path",{d:"M4 7c0-1.7 1.3-3 3-3h13",key:"10pag4"}],["path",{d:"M18 20c-1.7 0-3-1.3-3-3V4",key:"1gaosr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vK=q("Piano",[["path",{d:"M18.5 8c-1.4 0-2.6-.8-3.2-2A6.87 6.87 0 0 0 2 9v11a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-8.5C22 9.6 20.4 8 18.5 8",key:"lag0yf"}],["path",{d:"M2 14h20",key:"myj16y"}],["path",{d:"M6 14v4",key:"9ng0ue"}],["path",{d:"M10 14v4",key:"1v8uk5"}],["path",{d:"M14 14v4",key:"1tqops"}],["path",{d:"M18 14v4",key:"18uqwm"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _K=q("Pickaxe",[["path",{d:"M14.531 12.469 6.619 20.38a1 1 0 1 1-3-3l7.912-7.912",key:"we99rg"}],["path",{d:"M15.686 4.314A12.5 12.5 0 0 0 5.461 2.958 1 1 0 0 0 5.58 4.71a22 22 0 0 1 6.318 3.393",key:"1w6hck"}],["path",{d:"M17.7 3.7a1 1 0 0 0-1.4 0l-4.6 4.6a1 1 0 0 0 0 1.4l2.6 2.6a1 1 0 0 0 1.4 0l4.6-4.6a1 1 0 0 0 0-1.4z",key:"15hgfx"}],["path",{d:"M19.686 8.314a12.501 12.501 0 0 1 1.356 10.225 1 1 0 0 1-1.751-.119 22 22 0 0 0-3.393-6.319",key:"452b4h"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bK=q("PictureInPicture2",[["path",{d:"M21 9V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v10c0 1.1.9 2 2 2h4",key:"daa4of"}],["rect",{width:"10",height:"7",x:"12",y:"13",rx:"2",key:"1nb8gs"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wK=q("PictureInPicture",[["path",{d:"M8 4.5v5H3m-1-6 6 6m13 0v-3c0-1.16-.84-2-2-2h-7m-9 9v2c0 1.05.95 2 2 2h3",key:"bcd8fb"}],["rect",{width:"10",height:"7",x:"12",y:"13.5",ry:"2",key:"136fx3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jK=q("PiggyBank",[["path",{d:"M19 5c-1.5 0-2.8 1.4-3 2-3.5-1.5-11-.3-11 5 0 1.8 0 3 2 4.5V20h4v-2h3v2h4v-4c1-.5 1.7-1 2-2h2v-4h-2c0-1-.5-1.5-1-2V5z",key:"1ivx2i"}],["path",{d:"M2 9v1c0 1.1.9 2 2 2h1",key:"nm575m"}],["path",{d:"M16 11h.01",key:"xkw8gn"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kK=q("PilcrowLeft",[["path",{d:"M14 3v11",key:"mlfb7b"}],["path",{d:"M14 9h-3a3 3 0 0 1 0-6h9",key:"1ulc19"}],["path",{d:"M18 3v11",key:"1phi0r"}],["path",{d:"M22 18H2l4-4",key:"yt65j9"}],["path",{d:"m6 22-4-4",key:"6jgyf5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const NK=q("PilcrowRight",[["path",{d:"M10 3v11",key:"o3l5kj"}],["path",{d:"M10 9H7a1 1 0 0 1 0-6h8",key:"1wb1nc"}],["path",{d:"M14 3v11",key:"mlfb7b"}],["path",{d:"m18 14 4 4H2",key:"4r8io1"}],["path",{d:"m22 18-4 4",key:"1hjjrd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const SK=q("Pilcrow",[["path",{d:"M13 4v16",key:"8vvj80"}],["path",{d:"M17 4v16",key:"7dpous"}],["path",{d:"M19 4H9.5a4.5 4.5 0 0 0 0 9H13",key:"sh4n9v"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const CK=q("PillBottle",[["path",{d:"M18 11h-4a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1h4",key:"17ldeb"}],["path",{d:"M6 7v13a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V7",key:"nc37y6"}],["rect",{width:"16",height:"5",x:"4",y:"2",rx:"1",key:"3jeezo"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const MK=q("Pill",[["path",{d:"m10.5 20.5 10-10a4.95 4.95 0 1 0-7-7l-10 10a4.95 4.95 0 1 0 7 7Z",key:"wa1lgi"}],["path",{d:"m8.5 8.5 7 7",key:"rvfmvr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pA=q("PinOff",[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M15 9.34V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H7.89",key:"znwnzq"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M9 9v1.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h11",key:"c9qhm2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const K1=q("Pin",[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z",key:"1nkz8b"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const TK=q("Pipette",[["path",{d:"m2 22 1-1h3l9-9",key:"1sre89"}],["path",{d:"M3 21v-3l9-9",key:"hpe2y6"}],["path",{d:"m15 6 3.4-3.4a2.1 2.1 0 1 1 3 3L18 9l.4.4a2.1 2.1 0 1 1-3 3l-3.8-3.8a2.1 2.1 0 1 1 3-3l.4.4Z",key:"196du1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const AK=q("Pizza",[["path",{d:"m12 14-1 1",key:"11onhr"}],["path",{d:"m13.75 18.25-1.25 1.42",key:"1yisr3"}],["path",{d:"M17.775 5.654a15.68 15.68 0 0 0-12.121 12.12",key:"1qtqk6"}],["path",{d:"M18.8 9.3a1 1 0 0 0 2.1 7.7",key:"fbbbr2"}],["path",{d:"M21.964 20.732a1 1 0 0 1-1.232 1.232l-18-5a1 1 0 0 1-.695-1.232A19.68 19.68 0 0 1 15.732 2.037a1 1 0 0 1 1.232.695z",key:"1hyfdd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const EK=q("PlaneLanding",[["path",{d:"M2 22h20",key:"272qi7"}],["path",{d:"M3.77 10.77 2 9l2-4.5 1.1.55c.55.28.9.84.9 1.45s.35 1.17.9 1.45L8 8.5l3-6 1.05.53a2 2 0 0 1 1.09 1.52l.72 5.4a2 2 0 0 0 1.09 1.52l4.4 2.2c.42.22.78.55 1.01.96l.6 1.03c.49.88-.06 1.98-1.06 2.1l-1.18.15c-.47.06-.95-.02-1.37-.24L4.29 11.15a2 2 0 0 1-.52-.38Z",key:"1ma21e"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const IK=q("PlaneTakeoff",[["path",{d:"M2 22h20",key:"272qi7"}],["path",{d:"M6.36 17.4 4 17l-2-4 1.1-.55a2 2 0 0 1 1.8 0l.17.1a2 2 0 0 0 1.8 0L8 12 5 6l.9-.45a2 2 0 0 1 2.09.2l4.02 3a2 2 0 0 0 2.1.2l4.19-2.06a2.41 2.41 0 0 1 1.73-.17L21 7a1.4 1.4 0 0 1 .87 1.99l-.38.76c-.23.46-.6.84-1.07 1.08L7.58 17.2a2 2 0 0 1-1.22.18Z",key:"fkigj9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const PK=q("Plane",[["path",{d:"M17.8 19.2 16 11l3.5-3.5C21 6 21.5 4 21 3c-1-.5-3 0-4.5 1.5L13 8 4.8 6.2c-.5-.1-.9.1-1.1.5l-.3.5c-.2.5-.1 1 .3 1.3L9 12l-2 3H4l-1 1 3 2 2 3 1-1v-3l3-2 3.5 5.3c.3.4.8.5 1.3.3l.5-.2c.4-.3.6-.7.5-1.2z",key:"1v9wt8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Vl=q("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const LK=q("Plug2",[["path",{d:"M9 2v6",key:"17ngun"}],["path",{d:"M15 2v6",key:"s7yy2p"}],["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M5 8h14",key:"pcz4l3"}],["path",{d:"M6 11V8h12v3a6 6 0 1 1-12 0Z",key:"wtfw2c"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const b2=q("PlugZap",[["path",{d:"M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z",key:"goz73y"}],["path",{d:"m2 22 3-3",key:"19mgm9"}],["path",{d:"M7.5 13.5 10 11",key:"7xgeeb"}],["path",{d:"M10.5 16.5 13 14",key:"10btkg"}],["path",{d:"m18 3-4 4h6l-4 4",key:"16psg9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mA=q("Plug",[["path",{d:"M12 22v-5",key:"1ega77"}],["path",{d:"M9 8V2",key:"14iosj"}],["path",{d:"M15 8V2",key:"18g5xt"}],["path",{d:"M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8Z",key:"osxo6l"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bn=q("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const OK=q("PocketKnife",[["path",{d:"M3 2v1c0 1 2 1 2 2S3 6 3 7s2 1 2 2-2 1-2 2 2 1 2 2",key:"19w3oe"}],["path",{d:"M18 6h.01",key:"1v4wsw"}],["path",{d:"M6 18h.01",key:"uhywen"}],["path",{d:"M20.83 8.83a4 4 0 0 0-5.66-5.66l-12 12a4 4 0 1 0 5.66 5.66Z",key:"6fykxj"}],["path",{d:"M18 11.66V22a4 4 0 0 0 4-4V6",key:"1utzek"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const DK=q("Pocket",[["path",{d:"M4 3h16a2 2 0 0 1 2 2v6a10 10 0 0 1-10 10A10 10 0 0 1 2 11V5a2 2 0 0 1 2-2z",key:"1mz881"}],["polyline",{points:"8 10 12 14 16 10",key:"w4mbv5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const RK=q("Podcast",[["path",{d:"M16.85 18.58a9 9 0 1 0-9.7 0",key:"d71mpg"}],["path",{d:"M8 14a5 5 0 1 1 8 0",key:"fc81rn"}],["circle",{cx:"12",cy:"11",r:"1",key:"1gvufo"}],["path",{d:"M13 17a1 1 0 1 0-2 0l.5 4.5a.5.5 0 1 0 1 0Z",key:"za5kbj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const FK=q("PointerOff",[["path",{d:"M10 4.5V4a2 2 0 0 0-2.41-1.957",key:"jsi14n"}],["path",{d:"M13.9 8.4a2 2 0 0 0-1.26-1.295",key:"hirc7f"}],["path",{d:"M21.7 16.2A8 8 0 0 0 22 14v-3a2 2 0 1 0-4 0v-1a2 2 0 0 0-3.63-1.158",key:"1jxb2e"}],["path",{d:"m7 15-1.8-1.8a2 2 0 0 0-2.79 2.86L6 19.7a7.74 7.74 0 0 0 6 2.3h2a8 8 0 0 0 5.657-2.343",key:"10r7hm"}],["path",{d:"M6 6v8",key:"tv5xkp"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zK=q("Pointer",[["path",{d:"M22 14a8 8 0 0 1-8 8",key:"56vcr3"}],["path",{d:"M18 11v-1a2 2 0 0 0-2-2a2 2 0 0 0-2 2",key:"1agjmk"}],["path",{d:"M14 10V9a2 2 0 0 0-2-2a2 2 0 0 0-2 2v1",key:"wdbh2u"}],["path",{d:"M10 9.5V4a2 2 0 0 0-2-2a2 2 0 0 0-2 2v10",key:"1ibuk9"}],["path",{d:"M18 11a2 2 0 1 1 4 0v3a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15",key:"g6ys72"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const BK=q("Popcorn",[["path",{d:"M18 8a2 2 0 0 0 0-4 2 2 0 0 0-4 0 2 2 0 0 0-4 0 2 2 0 0 0-4 0 2 2 0 0 0 0 4",key:"10td1f"}],["path",{d:"M10 22 9 8",key:"yjptiv"}],["path",{d:"m14 22 1-14",key:"8jwc8b"}],["path",{d:"M20 8c.5 0 .9.4.8 1l-2.6 12c-.1.5-.7 1-1.2 1H7c-.6 0-1.1-.4-1.2-1L3.2 9c-.1-.6.3-1 .8-1Z",key:"1qo33t"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $K=q("Popsicle",[["path",{d:"M18.6 14.4c.8-.8.8-2 0-2.8l-8.1-8.1a4.95 4.95 0 1 0-7.1 7.1l8.1 8.1c.9.7 2.1.7 2.9-.1Z",key:"1o68ps"}],["path",{d:"m22 22-5.5-5.5",key:"17o70y"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const UK=q("PoundSterling",[["path",{d:"M18 7c0-5.333-8-5.333-8 0",key:"1prm2n"}],["path",{d:"M10 7v14",key:"18tmcs"}],["path",{d:"M6 21h12",key:"4dkmi1"}],["path",{d:"M6 13h10",key:"ybwr4a"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qK=q("PowerOff",[["path",{d:"M18.36 6.64A9 9 0 0 1 20.77 15",key:"dxknvb"}],["path",{d:"M6.16 6.16a9 9 0 1 0 12.68 12.68",key:"1x7qb5"}],["path",{d:"M12 2v4",key:"3427ic"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const VK=q("Power",[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const HK=q("Presentation",[["path",{d:"M2 3h20",key:"91anmk"}],["path",{d:"M21 3v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V3",key:"2k9sn8"}],["path",{d:"m7 21 5-5 5 5",key:"bip4we"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const WK=q("PrinterCheck",[["path",{d:"M13.5 22H7a1 1 0 0 1-1-1v-6a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v.5",key:"qeb09x"}],["path",{d:"m16 19 2 2 4-4",key:"1b14m6"}],["path",{d:"M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v2",key:"1md90i"}],["path",{d:"M6 9V3a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v6",key:"1itne7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const GK=q("Printer",[["path",{d:"M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2",key:"143wyd"}],["path",{d:"M6 9V3a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v6",key:"1itne7"}],["rect",{x:"6",y:"14",width:"12",height:"8",rx:"1",key:"1ue0tg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const KK=q("Projector",[["path",{d:"M5 7 3 5",key:"1yys58"}],["path",{d:"M9 6V3",key:"1ptz9u"}],["path",{d:"m13 7 2-2",key:"1w3vmq"}],["circle",{cx:"9",cy:"13",r:"3",key:"1mma13"}],["path",{d:"M11.83 12H20a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-4a2 2 0 0 1 2-2h2.17",key:"2frwzc"}],["path",{d:"M16 16h2",key:"dnq2od"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ZK=q("Proportions",[["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["path",{d:"M12 9v11",key:"1fnkrn"}],["path",{d:"M2 9h13a2 2 0 0 1 2 2v9",key:"11z3ex"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const YK=q("Puzzle",[["path",{d:"M15.39 4.39a1 1 0 0 0 1.68-.474 2.5 2.5 0 1 1 3.014 3.015 1 1 0 0 0-.474 1.68l1.683 1.682a2.414 2.414 0 0 1 0 3.414L19.61 15.39a1 1 0 0 1-1.68-.474 2.5 2.5 0 1 0-3.014 3.015 1 1 0 0 1 .474 1.68l-1.683 1.682a2.414 2.414 0 0 1-3.414 0L8.61 19.61a1 1 0 0 0-1.68.474 2.5 2.5 0 1 1-3.014-3.015 1 1 0 0 0 .474-1.68l-1.683-1.682a2.414 2.414 0 0 1 0-3.414L4.39 8.61a1 1 0 0 1 1.68.474 2.5 2.5 0 1 0 3.014-3.015 1 1 0 0 1-.474-1.68l1.683-1.682a2.414 2.414 0 0 1 3.414 0z",key:"w46dr5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const XK=q("Pyramid",[["path",{d:"M2.5 16.88a1 1 0 0 1-.32-1.43l9-13.02a1 1 0 0 1 1.64 0l9 13.01a1 1 0 0 1-.32 1.44l-8.51 4.86a2 2 0 0 1-1.98 0Z",key:"aenxs0"}],["path",{d:"M12 2v20",key:"t6zp3m"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gA=q("QrCode",[["rect",{width:"5",height:"5",x:"3",y:"3",rx:"1",key:"1tu5fj"}],["rect",{width:"5",height:"5",x:"16",y:"3",rx:"1",key:"1v8r4q"}],["rect",{width:"5",height:"5",x:"3",y:"16",rx:"1",key:"1x03jg"}],["path",{d:"M21 16h-3a2 2 0 0 0-2 2v3",key:"177gqh"}],["path",{d:"M21 21v.01",key:"ents32"}],["path",{d:"M12 7v3a2 2 0 0 1-2 2H7",key:"8crl2c"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M12 3h.01",key:"n36tog"}],["path",{d:"M12 16v.01",key:"133mhm"}],["path",{d:"M16 12h1",key:"1slzba"}],["path",{d:"M21 12v.01",key:"1lwtk9"}],["path",{d:"M12 21v-1",key:"1880an"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xA=q("Quote",[["path",{d:"M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"rib7q0"}],["path",{d:"M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"1ymkrd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const QK=q("Rabbit",[["path",{d:"M13 16a3 3 0 0 1 2.24 5",key:"1epib5"}],["path",{d:"M18 12h.01",key:"yjnet6"}],["path",{d:"M18 21h-8a4 4 0 0 1-4-4 7 7 0 0 1 7-7h.2L9.6 6.4a1 1 0 1 1 2.8-2.8L15.8 7h.2c3.3 0 6 2.7 6 6v1a2 2 0 0 1-2 2h-1a3 3 0 0 0-3 3",key:"ue9ozu"}],["path",{d:"M20 8.54V4a2 2 0 1 0-4 0v3",key:"49iql8"}],["path",{d:"M7.612 12.524a3 3 0 1 0-1.6 4.3",key:"1e33i0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const JK=q("Radar",[["path",{d:"M19.07 4.93A10 10 0 0 0 6.99 3.34",key:"z3du51"}],["path",{d:"M4 6h.01",key:"oypzma"}],["path",{d:"M2.29 9.62A10 10 0 1 0 21.31 8.35",key:"qzzz0"}],["path",{d:"M16.24 7.76A6 6 0 1 0 8.23 16.67",key:"1yjesh"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M17.99 11.66A6 6 0 0 1 15.77 16.67",key:"1u2y91"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["path",{d:"m13.41 10.59 5.66-5.66",key:"mhq4k0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const eZ=q("Radiation",[["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M7.5 4.2c-.3-.5-.9-.7-1.3-.4C3.9 5.5 2.3 8.1 2 11c-.1.5.4 1 1 1h5c0-1.5.8-2.8 2-3.4-1.1-1.9-2-3.5-2.5-4.4z",key:"wy49g3"}],["path",{d:"M21 12c.6 0 1-.4 1-1-.3-2.9-1.8-5.5-4.1-7.1-.4-.3-1.1-.2-1.3.3-.6.9-1.5 2.5-2.6 4.3 1.2.7 2 2 2 3.5h5z",key:"vklnvr"}],["path",{d:"M7.5 19.8c-.3.5-.1 1.1.4 1.3 2.6 1.2 5.6 1.2 8.2 0 .5-.2.7-.8.4-1.3-.5-.9-1.4-2.5-2.5-4.3-1.2.7-2.8.7-4 0-1.1 1.8-2 3.4-2.5 4.3z",key:"wkdf1o"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tZ=q("Radical",[["path",{d:"M3 12h3.28a1 1 0 0 1 .948.684l2.298 7.934a.5.5 0 0 0 .96-.044L13.82 4.771A1 1 0 0 1 14.792 4H21",key:"1mqj8i"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rZ=q("RadioReceiver",[["path",{d:"M5 16v2",key:"g5qcv5"}],["path",{d:"M19 16v2",key:"1gbaio"}],["rect",{width:"20",height:"8",x:"2",y:"8",rx:"2",key:"vjsjur"}],["path",{d:"M18 12h.01",key:"yjnet6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nZ=q("RadioTower",[["path",{d:"M4.9 16.1C1 12.2 1 5.8 4.9 1.9",key:"s0qx1y"}],["path",{d:"M7.8 4.7a6.14 6.14 0 0 0-.8 7.5",key:"1idnkw"}],["circle",{cx:"12",cy:"9",r:"2",key:"1092wv"}],["path",{d:"M16.2 4.8c2 2 2.26 5.11.8 7.47",key:"ojru2q"}],["path",{d:"M19.1 1.9a9.96 9.96 0 0 1 0 14.1",key:"rhi7fg"}],["path",{d:"M9.5 18h5",key:"mfy3pd"}],["path",{d:"m8 22 4-11 4 11",key:"25yftu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Bj=q("Radio",[["path",{d:"M4.9 19.1C1 15.2 1 8.8 4.9 4.9",key:"1vaf9d"}],["path",{d:"M7.8 16.2c-2.3-2.3-2.3-6.1 0-8.5",key:"u1ii0m"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["path",{d:"M16.2 7.8c2.3 2.3 2.3 6.1 0 8.5",key:"1j5fej"}],["path",{d:"M19.1 4.9C23 8.8 23 15.1 19.1 19",key:"10b0cb"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sZ=q("Radius",[["path",{d:"M20.34 17.52a10 10 0 1 0-2.82 2.82",key:"fydyku"}],["circle",{cx:"19",cy:"19",r:"2",key:"17f5cg"}],["path",{d:"m13.41 13.41 4.18 4.18",key:"1gqbwc"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const aZ=q("RailSymbol",[["path",{d:"M5 15h14",key:"m0yey3"}],["path",{d:"M5 9h14",key:"7tsvo6"}],["path",{d:"m14 20-5-5 6-6-5-5",key:"1jo42i"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const iZ=q("Rainbow",[["path",{d:"M22 17a10 10 0 0 0-20 0",key:"ozegv"}],["path",{d:"M6 17a6 6 0 0 1 12 0",key:"5giftw"}],["path",{d:"M10 17a2 2 0 0 1 4 0",key:"gnsikk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oZ=q("Rat",[["path",{d:"M17 5c0-1.7-1.3-3-3-3s-3 1.3-3 3c0 .8.3 1.5.8 2H11c-3.9 0-7 3.1-7 7c0 2.2 1.8 4 4 4",key:"1wq71c"}],["path",{d:"M16.8 3.9c.3-.3.6-.5 1-.7 1.5-.6 3.3.1 3.9 1.6.6 1.5-.1 3.3-1.6 3.9l1.6 2.8c.2.3.2.7.2 1-.2.8-.9 1.2-1.7 1.1 0 0-1.6-.3-2.7-.6H17c-1.7 0-3 1.3-3 3",key:"1crdmb"}],["path",{d:"M13.2 18a3 3 0 0 0-2.2-5",key:"1ol3lk"}],["path",{d:"M13 22H4a2 2 0 0 1 0-4h12",key:"bt3f23"}],["path",{d:"M16 9h.01",key:"1bdo4e"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lZ=q("Ratio",[["rect",{width:"12",height:"20",x:"6",y:"2",rx:"2",key:"1oxtiu"}],["rect",{width:"20",height:"12",x:"2",y:"6",rx:"2",key:"9lu3g6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cZ=q("ReceiptCent",[["path",{d:"M4 2v20l2-1 2 1 2-1 2 1 2-1 2 1 2-1 2 1V2l-2 1-2-1-2 1-2-1-2 1-2-1-2 1Z",key:"q3az6g"}],["path",{d:"M12 6.5v11",key:"ecfhkf"}],["path",{d:"M15 9.4a4 4 0 1 0 0 5.2",key:"1makmb"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dZ=q("ReceiptEuro",[["path",{d:"M4 2v20l2-1 2 1 2-1 2 1 2-1 2 1 2-1 2 1V2l-2 1-2-1-2 1-2-1-2 1-2-1-2 1Z",key:"q3az6g"}],["path",{d:"M8 12h5",key:"1g6qi8"}],["path",{d:"M16 9.5a4 4 0 1 0 0 5.2",key:"b2px4r"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uZ=q("ReceiptIndianRupee",[["path",{d:"M4 2v20l2-1 2 1 2-1 2 1 2-1 2 1 2-1 2 1V2l-2 1-2-1-2 1-2-1-2 1-2-1-2 1Z",key:"q3az6g"}],["path",{d:"M8 7h8",key:"i86dvs"}],["path",{d:"M12 17.5 8 15h1a4 4 0 0 0 0-8",key:"grpkl4"}],["path",{d:"M8 11h8",key:"vwpz6n"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hZ=q("ReceiptJapaneseYen",[["path",{d:"M4 2v20l2-1 2 1 2-1 2 1 2-1 2 1 2-1 2 1V2l-2 1-2-1-2 1-2-1-2 1-2-1-2 1Z",key:"q3az6g"}],["path",{d:"m12 10 3-3",key:"1mc12w"}],["path",{d:"m9 7 3 3v7.5",key:"39i0xv"}],["path",{d:"M9 11h6",key:"1fldmi"}],["path",{d:"M9 15h6",key:"cctwl0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fZ=q("ReceiptPoundSterling",[["path",{d:"M4 2v20l2-1 2 1 2-1 2 1 2-1 2 1 2-1 2 1V2l-2 1-2-1-2 1-2-1-2 1-2-1-2 1Z",key:"q3az6g"}],["path",{d:"M8 13h5",key:"1k9z8w"}],["path",{d:"M10 17V9.5a2.5 2.5 0 0 1 5 0",key:"1dzgp0"}],["path",{d:"M8 17h7",key:"8mjdqu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pZ=q("ReceiptRussianRuble",[["path",{d:"M4 2v20l2-1 2 1 2-1 2 1 2-1 2 1 2-1 2 1V2l-2 1-2-1-2 1-2-1-2 1-2-1-2 1Z",key:"q3az6g"}],["path",{d:"M8 15h5",key:"vxg57a"}],["path",{d:"M8 11h5a2 2 0 1 0 0-4h-3v10",key:"1usi5u"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mZ=q("ReceiptSwissFranc",[["path",{d:"M4 2v20l2-1 2 1 2-1 2 1 2-1 2 1 2-1 2 1V2l-2 1-2-1-2 1-2-1-2 1-2-1-2 1Z",key:"q3az6g"}],["path",{d:"M10 17V7h5",key:"k7jq18"}],["path",{d:"M10 11h4",key:"1i0mka"}],["path",{d:"M8 15h5",key:"vxg57a"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gZ=q("ReceiptText",[["path",{d:"M4 2v20l2-1 2 1 2-1 2 1 2-1 2 1 2-1 2 1V2l-2 1-2-1-2 1-2-1-2 1-2-1-2 1Z",key:"q3az6g"}],["path",{d:"M14 8H8",key:"1l3xfs"}],["path",{d:"M16 12H8",key:"1fr5h0"}],["path",{d:"M13 16H8",key:"wsln4y"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xZ=q("Receipt",[["path",{d:"M4 2v20l2-1 2 1 2-1 2 1 2-1 2 1 2-1 2 1V2l-2 1-2-1-2 1-2-1-2 1-2-1-2 1Z",key:"q3az6g"}],["path",{d:"M16 8h-6a2 2 0 1 0 0 4h4a2 2 0 1 1 0 4H8",key:"1h4pet"}],["path",{d:"M12 17.5v-11",key:"1jc1ny"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const w2=q("RectangleEllipsis",[["rect",{width:"20",height:"12",x:"2",y:"6",rx:"2",key:"9lu3g6"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M17 12h.01",key:"1m0b6t"}],["path",{d:"M7 12h.01",key:"eqddd0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yZ=q("RectangleHorizontal",[["rect",{width:"20",height:"12",x:"2",y:"6",rx:"2",key:"9lu3g6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vZ=q("RectangleVertical",[["rect",{width:"12",height:"20",x:"6",y:"2",rx:"2",key:"1oxtiu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _Z=q("Recycle",[["path",{d:"M7 19H4.815a1.83 1.83 0 0 1-1.57-.881 1.785 1.785 0 0 1-.004-1.784L7.196 9.5",key:"x6z5xu"}],["path",{d:"M11 19h8.203a1.83 1.83 0 0 0 1.556-.89 1.784 1.784 0 0 0 0-1.775l-1.226-2.12",key:"1x4zh5"}],["path",{d:"m14 16-3 3 3 3",key:"f6jyew"}],["path",{d:"M8.293 13.596 7.196 9.5 3.1 10.598",key:"wf1obh"}],["path",{d:"m9.344 5.811 1.093-1.892A1.83 1.83 0 0 1 11.985 3a1.784 1.784 0 0 1 1.546.888l3.943 6.843",key:"9tzpgr"}],["path",{d:"m13.378 9.633 4.096 1.098 1.097-4.096",key:"1oe83g"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bZ=q("Redo2",[["path",{d:"m15 14 5-5-5-5",key:"12vg1m"}],["path",{d:"M20 9H9.5A5.5 5.5 0 0 0 4 14.5A5.5 5.5 0 0 0 9.5 20H13",key:"6uklza"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wZ=q("RedoDot",[["circle",{cx:"12",cy:"17",r:"1",key:"1ixnty"}],["path",{d:"M21 7v6h-6",key:"3ptur4"}],["path",{d:"M3 17a9 9 0 0 1 9-9 9 9 0 0 1 6 2.3l3 2.7",key:"1kgawr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const PS=q("Redo",[["path",{d:"M21 7v6h-6",key:"3ptur4"}],["path",{d:"M3 17a9 9 0 0 1 9-9 9 9 0 0 1 6 2.3l3 2.7",key:"1kgawr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jZ=q("RefreshCcwDot",[["path",{d:"M3 2v6h6",key:"18ldww"}],["path",{d:"M21 12A9 9 0 0 0 6 5.3L3 8",key:"1pbrqz"}],["path",{d:"M21 22v-6h-6",key:"usdfbe"}],["path",{d:"M3 12a9 9 0 0 0 15 6.7l3-2.7",key:"1hosoe"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kZ=q("RefreshCcw",[["path",{d:"M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"14sxne"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16",key:"1hlbsb"}],["path",{d:"M16 16h5v5",key:"ccwih5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const NZ=q("RefreshCwOff",[["path",{d:"M21 8L18.74 5.74A9.75 9.75 0 0 0 12 3C11 3 10.03 3.16 9.13 3.47",key:"1krf6h"}],["path",{d:"M8 16H3v5",key:"1cv678"}],["path",{d:"M3 12C3 9.51 4 7.26 5.64 5.64",key:"ruvoct"}],["path",{d:"m3 16 2.26 2.26A9.75 9.75 0 0 0 12 21c2.49 0 4.74-1 6.36-2.64",key:"19q130"}],["path",{d:"M21 12c0 1-.16 1.97-.47 2.87",key:"4w8emr"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M22 22 2 2",key:"1r8tn9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qo=q("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const SZ=q("Refrigerator",[["path",{d:"M5 6a4 4 0 0 1 4-4h6a4 4 0 0 1 4 4v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6Z",key:"fpq118"}],["path",{d:"M5 10h14",key:"elsbfy"}],["path",{d:"M15 7v6",key:"1nx30x"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const CZ=q("Regex",[["path",{d:"M17 3v10",key:"15fgeh"}],["path",{d:"m12.67 5.5 8.66 5",key:"1gpheq"}],["path",{d:"m12.67 10.5 8.66-5",key:"1dkfa6"}],["path",{d:"M9 17a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v2a2 2 0 0 0 2 2h2a2 2 0 0 0 2-2v-2z",key:"swwfx4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const MZ=q("RemoveFormatting",[["path",{d:"M4 7V4h16v3",key:"9msm58"}],["path",{d:"M5 20h6",key:"1h6pxn"}],["path",{d:"M13 4 8 20",key:"kqq6aj"}],["path",{d:"m15 15 5 5",key:"me55sn"}],["path",{d:"m20 15-5 5",key:"11p7ol"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const TZ=q("Repeat1",[["path",{d:"m17 2 4 4-4 4",key:"nntrym"}],["path",{d:"M3 11v-1a4 4 0 0 1 4-4h14",key:"84bu3i"}],["path",{d:"m7 22-4-4 4-4",key:"1wqhfi"}],["path",{d:"M21 13v1a4 4 0 0 1-4 4H3",key:"1rx37r"}],["path",{d:"M11 10h1v4",key:"70cz1p"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const AZ=q("Repeat2",[["path",{d:"m2 9 3-3 3 3",key:"1ltn5i"}],["path",{d:"M13 18H7a2 2 0 0 1-2-2V6",key:"1r6tfw"}],["path",{d:"m22 15-3 3-3-3",key:"4rnwn2"}],["path",{d:"M11 6h6a2 2 0 0 1 2 2v10",key:"2f72bc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yA=q("Repeat",[["path",{d:"m17 2 4 4-4 4",key:"nntrym"}],["path",{d:"M3 11v-1a4 4 0 0 1 4-4h14",key:"84bu3i"}],["path",{d:"m7 22-4-4 4-4",key:"1wqhfi"}],["path",{d:"M21 13v1a4 4 0 0 1-4 4H3",key:"1rx37r"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const EZ=q("ReplaceAll",[["path",{d:"M14 14a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2",key:"1yyzbs"}],["path",{d:"M14 4a2 2 0 0 1 2-2",key:"1w2hp7"}],["path",{d:"M16 10a2 2 0 0 1-2-2",key:"shjach"}],["path",{d:"M20 14a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2",key:"zfj4xr"}],["path",{d:"M20 2a2 2 0 0 1 2 2",key:"188mtx"}],["path",{d:"M22 8a2 2 0 0 1-2 2",key:"ddf4tu"}],["path",{d:"m3 7 3 3 3-3",key:"x25e72"}],["path",{d:"M6 10V5a 3 3 0 0 1 3-3h1",key:"1ageje"}],["rect",{x:"2",y:"14",width:"8",height:"8",rx:"2",key:"4rksxw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const IZ=q("Replace",[["path",{d:"M14 4a2 2 0 0 1 2-2",key:"1w2hp7"}],["path",{d:"M16 10a2 2 0 0 1-2-2",key:"shjach"}],["path",{d:"M20 2a2 2 0 0 1 2 2",key:"188mtx"}],["path",{d:"M22 8a2 2 0 0 1-2 2",key:"ddf4tu"}],["path",{d:"m3 7 3 3 3-3",key:"x25e72"}],["path",{d:"M6 10V5a3 3 0 0 1 3-3h1",key:"3y3t5z"}],["rect",{x:"2",y:"14",width:"8",height:"8",rx:"2",key:"4rksxw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const PZ=q("ReplyAll",[["polyline",{points:"7 17 2 12 7 7",key:"t83bqg"}],["polyline",{points:"12 17 7 12 12 7",key:"1g4ajm"}],["path",{d:"M22 18v-2a4 4 0 0 0-4-4H7",key:"1fcyog"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vA=q("Reply",[["polyline",{points:"9 17 4 12 9 7",key:"hvgpf2"}],["path",{d:"M20 18v-2a4 4 0 0 0-4-4H4",key:"5vmcpk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const LZ=q("Rewind",[["polygon",{points:"11 19 2 12 11 5 11 19",key:"14yba5"}],["polygon",{points:"22 19 13 12 22 5 22 19",key:"1pi1cj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const OZ=q("Ribbon",[["path",{d:"M12 11.22C11 9.997 10 9 10 8a2 2 0 0 1 4 0c0 1-.998 2.002-2.01 3.22",key:"1rnhq3"}],["path",{d:"m12 18 2.57-3.5",key:"116vt7"}],["path",{d:"M6.243 9.016a7 7 0 0 1 11.507-.009",key:"10dq0b"}],["path",{d:"M9.35 14.53 12 11.22",key:"tdsyp2"}],["path",{d:"M9.35 14.53C7.728 12.246 6 10.221 6 7a6 5 0 0 1 12 0c-.005 3.22-1.778 5.235-3.43 7.5l3.557 4.527a1 1 0 0 1-.203 1.43l-1.894 1.36a1 1 0 0 1-1.384-.215L12 18l-2.679 3.593a1 1 0 0 1-1.39.213l-1.865-1.353a1 1 0 0 1-.203-1.422z",key:"nmifey"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Dg=q("Rocket",[["path",{d:"M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09z",key:"m3kijz"}],["path",{d:"m12 15-3-3a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.35 22.35 0 0 1-4 2z",key:"1fmvmk"}],["path",{d:"M9 12H4s.55-3.03 2-4c1.62-1.08 5 0 5 0",key:"1f8sc4"}],["path",{d:"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5",key:"qeys4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const DZ=q("RockingChair",[["polyline",{points:"3.5 2 6.5 12.5 18 12.5",key:"y3iy52"}],["line",{x1:"9.5",x2:"5.5",y1:"12.5",y2:"20",key:"19vg5i"}],["line",{x1:"15",x2:"18.5",y1:"12.5",y2:"20",key:"1inpmv"}],["path",{d:"M2.75 18a13 13 0 0 0 18.5 0",key:"1nquas"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const RZ=q("RollerCoaster",[["path",{d:"M6 19V5",key:"1r845m"}],["path",{d:"M10 19V6.8",key:"9j2tfs"}],["path",{d:"M14 19v-7.8",key:"10s8qv"}],["path",{d:"M18 5v4",key:"1tajlv"}],["path",{d:"M18 19v-6",key:"ielfq3"}],["path",{d:"M22 19V9",key:"158nzp"}],["path",{d:"M2 19V9a4 4 0 0 1 4-4c2 0 4 1.33 6 4s4 4 6 4a4 4 0 1 0-3-6.65",key:"1930oh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const j2=q("Rotate3d",[["path",{d:"M16.466 7.5C15.643 4.237 13.952 2 12 2 9.239 2 7 6.477 7 12s2.239 10 5 10c.342 0 .677-.069 1-.2",key:"10n0gc"}],["path",{d:"m15.194 13.707 3.814 1.86-1.86 3.814",key:"16shm9"}],["path",{d:"M19 15.57c-1.804.885-4.274 1.43-7 1.43-5.523 0-10-2.239-10-5s4.477-5 10-5c4.838 0 8.873 1.718 9.8 4",key:"1lxi77"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const FZ=q("RotateCcwSquare",[["path",{d:"M20 9V7a2 2 0 0 0-2-2h-6",key:"19z8uc"}],["path",{d:"m15 2-3 3 3 3",key:"177bxs"}],["path",{d:"M20 13v5a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2h2",key:"d36hnl"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const LS=q("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zZ=q("RotateCwSquare",[["path",{d:"M12 5H6a2 2 0 0 0-2 2v3",key:"l96uqu"}],["path",{d:"m9 8 3-3-3-3",key:"1gzgc3"}],["path",{d:"M4 14v4a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2h-2",key:"1w2k5h"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _A=q("RotateCw",[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const BZ=q("RouteOff",[["circle",{cx:"6",cy:"19",r:"3",key:"1kj8tv"}],["path",{d:"M9 19h8.5c.4 0 .9-.1 1.3-.2",key:"1effex"}],["path",{d:"M5.2 5.2A3.5 3.53 0 0 0 6.5 12H12",key:"k9y2ds"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M21 15.3a3.5 3.5 0 0 0-3.3-3.3",key:"11nlu2"}],["path",{d:"M15 5h-4.3",key:"6537je"}],["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $Z=q("Route",[["circle",{cx:"6",cy:"19",r:"3",key:"1kj8tv"}],["path",{d:"M9 19h8.5a3.5 3.5 0 0 0 0-7h-11a3.5 3.5 0 0 1 0-7H15",key:"1d8sl"}],["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const UZ=q("Router",[["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",key:"w68u3i"}],["path",{d:"M6.01 18H6",key:"19vcac"}],["path",{d:"M10.01 18H10",key:"uamcmx"}],["path",{d:"M15 10v4",key:"qjz1xs"}],["path",{d:"M17.84 7.17a4 4 0 0 0-5.66 0",key:"1rif40"}],["path",{d:"M20.66 4.34a8 8 0 0 0-11.31 0",key:"6a5xfq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const k2=q("Rows2",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 12h18",key:"1i2n21"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const N2=q("Rows3",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M21 9H3",key:"1338ky"}],["path",{d:"M21 15H3",key:"9uk58r"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qZ=q("Rows4",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M21 7.5H3",key:"1hm9pq"}],["path",{d:"M21 12H3",key:"2avoz0"}],["path",{d:"M21 16.5H3",key:"n7jzkj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const VZ=q("Rss",[["path",{d:"M4 11a9 9 0 0 1 9 9",key:"pv89mb"}],["path",{d:"M4 4a16 16 0 0 1 16 16",key:"k0647b"}],["circle",{cx:"5",cy:"19",r:"1",key:"bfqh0e"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const HZ=q("Ruler",[["path",{d:"M21.3 15.3a2.4 2.4 0 0 1 0 3.4l-2.6 2.6a2.4 2.4 0 0 1-3.4 0L2.7 8.7a2.41 2.41 0 0 1 0-3.4l2.6-2.6a2.41 2.41 0 0 1 3.4 0Z",key:"icamh8"}],["path",{d:"m14.5 12.5 2-2",key:"inckbg"}],["path",{d:"m11.5 9.5 2-2",key:"fmmyf7"}],["path",{d:"m8.5 6.5 2-2",key:"vc6u1g"}],["path",{d:"m17.5 15.5 2-2",key:"wo5hmg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const WZ=q("RussianRuble",[["path",{d:"M6 11h8a4 4 0 0 0 0-8H9v18",key:"18ai8t"}],["path",{d:"M6 15h8",key:"1y8f6l"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const GZ=q("Sailboat",[["path",{d:"M22 18H2a4 4 0 0 0 4 4h12a4 4 0 0 0 4-4Z",key:"1404fh"}],["path",{d:"M21 14 10 2 3 14h18Z",key:"1nzg7v"}],["path",{d:"M10 2v16",key:"1labyt"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const KZ=q("Salad",[["path",{d:"M7 21h10",key:"1b0cd5"}],["path",{d:"M12 21a9 9 0 0 0 9-9H3a9 9 0 0 0 9 9Z",key:"4rw317"}],["path",{d:"M11.38 12a2.4 2.4 0 0 1-.4-4.77 2.4 2.4 0 0 1 3.2-2.77 2.4 2.4 0 0 1 3.47-.63 2.4 2.4 0 0 1 3.37 3.37 2.4 2.4 0 0 1-1.1 3.7 2.51 2.51 0 0 1 .03 1.1",key:"10xrj0"}],["path",{d:"m13 12 4-4",key:"1hckqy"}],["path",{d:"M10.9 7.25A3.99 3.99 0 0 0 4 10c0 .73.2 1.41.54 2",key:"1p4srx"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ZZ=q("Sandwich",[["path",{d:"m2.37 11.223 8.372-6.777a2 2 0 0 1 2.516 0l8.371 6.777",key:"f1wd0e"}],["path",{d:"M21 15a1 1 0 0 1 1 1v2a1 1 0 0 1-1 1h-5.25",key:"1pfu07"}],["path",{d:"M3 15a1 1 0 0 0-1 1v2a1 1 0 0 0 1 1h9",key:"1oq9qw"}],["path",{d:"m6.67 15 6.13 4.6a2 2 0 0 0 2.8-.4l3.15-4.2",key:"1fnwu5"}],["rect",{width:"20",height:"4",x:"2",y:"11",rx:"1",key:"itshg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const YZ=q("SatelliteDish",[["path",{d:"M4 10a7.31 7.31 0 0 0 10 10Z",key:"1fzpp3"}],["path",{d:"m9 15 3-3",key:"88sc13"}],["path",{d:"M17 13a6 6 0 0 0-6-6",key:"15cc6u"}],["path",{d:"M21 13A10 10 0 0 0 11 3",key:"11nf8s"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const XZ=q("Satellite",[["path",{d:"M13 7 9 3 5 7l4 4",key:"vyckw6"}],["path",{d:"m17 11 4 4-4 4-4-4",key:"rchckc"}],["path",{d:"m8 12 4 4 6-6-4-4Z",key:"1sshf7"}],["path",{d:"m16 8 3-3",key:"x428zp"}],["path",{d:"M9 21a6 6 0 0 0-6-6",key:"1iajcf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const QZ=q("SaveAll",[["path",{d:"M10 2v3a1 1 0 0 0 1 1h5",key:"1xspal"}],["path",{d:"M18 18v-6a1 1 0 0 0-1-1h-6a1 1 0 0 0-1 1v6",key:"1ra60u"}],["path",{d:"M18 22H4a2 2 0 0 1-2-2V6",key:"pblm9e"}],["path",{d:"M8 18a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9.172a2 2 0 0 1 1.414.586l2.828 2.828A2 2 0 0 1 22 6.828V16a2 2 0 0 1-2.01 2z",key:"1yve0x"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const JZ=q("SaveOff",[["path",{d:"M13 13H8a1 1 0 0 0-1 1v7",key:"h8g396"}],["path",{d:"M14 8h1",key:"1lfen6"}],["path",{d:"M17 21v-4",key:"1yknxs"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M20.41 20.41A2 2 0 0 1 19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 .59-1.41",key:"1t4vdl"}],["path",{d:"M29.5 11.5s5 5 4 5",key:"zzn4i6"}],["path",{d:"M9 3h6.2a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V15",key:"24cby9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Em=q("Save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const S2=q("Scale3d",[["path",{d:"M5 7v11a1 1 0 0 0 1 1h11",key:"13dt1j"}],["path",{d:"M5.293 18.707 11 13",key:"ezgbsx"}],["circle",{cx:"19",cy:"19",r:"2",key:"17f5cg"}],["circle",{cx:"5",cy:"5",r:"2",key:"1gwv83"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const eY=q("Scale",[["path",{d:"m16 16 3-8 3 8c-.87.65-1.92 1-3 1s-2.13-.35-3-1Z",key:"7g6ntu"}],["path",{d:"m2 16 3-8 3 8c-.87.65-1.92 1-3 1s-2.13-.35-3-1Z",key:"ijws7r"}],["path",{d:"M7 21h10",key:"1b0cd5"}],["path",{d:"M12 3v18",key:"108xh3"}],["path",{d:"M3 7h2c2 0 5-1 7-2 2 1 5 2 7 2h2",key:"3gwbw2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tY=q("Scaling",[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M14 15H9v-5",key:"pi4jk9"}],["path",{d:"M16 3h5v5",key:"1806ms"}],["path",{d:"M21 3 9 15",key:"15kdhq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rY=q("ScanBarcode",[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}],["path",{d:"M8 7v10",key:"23sfjj"}],["path",{d:"M12 7v10",key:"jspqdw"}],["path",{d:"M17 7v10",key:"578dap"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nY=q("ScanEye",[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["path",{d:"M18.944 12.33a1 1 0 0 0 0-.66 7.5 7.5 0 0 0-13.888 0 1 1 0 0 0 0 .66 7.5 7.5 0 0 0 13.888 0",key:"11ak4c"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sY=q("ScanFace",[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}],["path",{d:"M8 14s1.5 2 4 2 4-2 4-2",key:"1y1vjs"}],["path",{d:"M9 9h.01",key:"1q5me6"}],["path",{d:"M15 9h.01",key:"x1ddxp"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const aY=q("ScanLine",[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}],["path",{d:"M7 12h10",key:"b7w52i"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const iY=q("ScanQrCode",[["path",{d:"M17 12v4a1 1 0 0 1-1 1h-4",key:"uk4fdo"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M17 8V7",key:"q2g9wo"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M7 17h.01",key:"19xn7k"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}],["rect",{x:"7",y:"7",width:"5",height:"5",rx:"1",key:"m9kyts"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oY=q("ScanSearch",[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["path",{d:"m16 16-1.9-1.9",key:"1dq9hf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lY=q("ScanText",[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}],["path",{d:"M7 8h8",key:"1jbsf9"}],["path",{d:"M7 12h10",key:"b7w52i"}],["path",{d:"M7 16h6",key:"1vyc9m"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cY=q("Scan",[["path",{d:"M3 7V5a2 2 0 0 1 2-2h2",key:"aa7l1z"}],["path",{d:"M17 3h2a2 2 0 0 1 2 2v2",key:"4qcy5o"}],["path",{d:"M21 17v2a2 2 0 0 1-2 2h-2",key:"6vwrx8"}],["path",{d:"M7 21H5a2 2 0 0 1-2-2v-2",key:"ioqczr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dY=q("School",[["path",{d:"M14 22v-4a2 2 0 1 0-4 0v4",key:"hhkicm"}],["path",{d:"m18 10 3.447 1.724a1 1 0 0 1 .553.894V20a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-7.382a1 1 0 0 1 .553-.894L6 10",key:"1xqip1"}],["path",{d:"M18 5v17",key:"1sw6gf"}],["path",{d:"m4 6 7.106-3.553a2 2 0 0 1 1.788 0L20 6",key:"9d2mlk"}],["path",{d:"M6 5v17",key:"1xfsm0"}],["circle",{cx:"12",cy:"9",r:"2",key:"1092wv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uY=q("ScissorsLineDashed",[["path",{d:"M5.42 9.42 8 12",key:"12pkuq"}],["circle",{cx:"4",cy:"8",r:"2",key:"107mxr"}],["path",{d:"m14 6-8.58 8.58",key:"gvzu5l"}],["circle",{cx:"4",cy:"16",r:"2",key:"1ehqvc"}],["path",{d:"M10.8 14.8 14 18",key:"ax7m9r"}],["path",{d:"M16 12h-2",key:"10asgb"}],["path",{d:"M22 12h-2",key:"14jgyd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hY=q("Scissors",[["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M8.12 8.12 12 12",key:"1alkpv"}],["path",{d:"M20 4 8.12 15.88",key:"xgtan2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M14.8 14.8 20 20",key:"ptml3r"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fY=q("ScreenShareOff",[["path",{d:"M13 3H4a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-3",key:"i8wdob"}],["path",{d:"M8 21h8",key:"1ev6f3"}],["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"m22 3-5 5",key:"12jva0"}],["path",{d:"m17 3 5 5",key:"k36vhe"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pY=q("ScreenShare",[["path",{d:"M13 3H4a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-3",key:"i8wdob"}],["path",{d:"M8 21h8",key:"1ev6f3"}],["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"m17 8 5-5",key:"fqif7o"}],["path",{d:"M17 3h5v5",key:"1o3tu8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mY=q("ScrollText",[["path",{d:"M15 12h-5",key:"r7krc0"}],["path",{d:"M15 8h-5",key:"1khuty"}],["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gY=q("Scroll",[["path",{d:"M19 17V5a2 2 0 0 0-2-2H4",key:"zz82l3"}],["path",{d:"M8 21h12a2 2 0 0 0 2-2v-1a1 1 0 0 0-1-1H11a1 1 0 0 0-1 1v1a2 2 0 1 1-4 0V5a2 2 0 1 0-4 0v2a1 1 0 0 0 1 1h3",key:"1ph1d7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xY=q("SearchCheck",[["path",{d:"m8 11 2 2 4-4",key:"1sed1v"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yY=q("SearchCode",[["path",{d:"m13 13.5 2-2.5-2-2.5",key:"1rvxrh"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}],["path",{d:"M9 8.5 7 11l2 2.5",key:"6ffwbx"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vY=q("SearchSlash",[["path",{d:"m13.5 8.5-5 5",key:"1cs55j"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _Y=q("SearchX",[["path",{d:"m13.5 8.5-5 5",key:"1cs55j"}],["path",{d:"m8.5 8.5 5 5",key:"a8mexj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Sa=q("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bY=q("Section",[["path",{d:"M16 5a4 3 0 0 0-8 0c0 4 8 3 8 7a4 3 0 0 1-8 0",key:"vqan6v"}],["path",{d:"M8 19a4 3 0 0 0 8 0c0-4-8-3-8-7a4 3 0 0 1 8 0",key:"wdjd8o"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const C2=q("SendHorizontal",[["path",{d:"M3.714 3.048a.498.498 0 0 0-.683.627l2.843 7.627a2 2 0 0 1 0 1.396l-2.842 7.627a.498.498 0 0 0 .682.627l18-8.5a.5.5 0 0 0 0-.904z",key:"117uat"}],["path",{d:"M6 12h16",key:"s4cdu5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wY=q("SendToBack",[["rect",{x:"14",y:"14",width:"8",height:"8",rx:"2",key:"1b0bso"}],["rect",{x:"2",y:"2",width:"8",height:"8",rx:"2",key:"1x09vl"}],["path",{d:"M7 14v1a2 2 0 0 0 2 2h1",key:"pao6x6"}],["path",{d:"M14 7h1a2 2 0 0 1 2 2v1",key:"19tdru"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lo=q("Send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jY=q("SeparatorHorizontal",[["line",{x1:"3",x2:"21",y1:"12",y2:"12",key:"10d38w"}],["polyline",{points:"8 8 12 4 16 8",key:"zo8t4w"}],["polyline",{points:"16 16 12 20 8 16",key:"1oyrid"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kY=q("SeparatorVertical",[["line",{x1:"12",x2:"12",y1:"3",y2:"21",key:"1efggb"}],["polyline",{points:"8 8 4 12 8 16",key:"bnfmv4"}],["polyline",{points:"16 16 20 12 16 8",key:"u90052"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const NY=q("ServerCog",[["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["path",{d:"M4.5 10H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-.5",key:"tn8das"}],["path",{d:"M4.5 14H4a2 2 0 0 0-2 2v4a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-4a2 2 0 0 0-2-2h-.5",key:"1g2pve"}],["path",{d:"M6 6h.01",key:"1utrut"}],["path",{d:"M6 18h.01",key:"uhywen"}],["path",{d:"m15.7 13.4-.9-.3",key:"1jwmzr"}],["path",{d:"m9.2 10.9-.9-.3",key:"qapnim"}],["path",{d:"m10.6 15.7.3-.9",key:"quwk0k"}],["path",{d:"m13.6 15.7-.4-1",key:"cb9xp7"}],["path",{d:"m10.8 9.3-.4-1",key:"1uaiz5"}],["path",{d:"m8.3 13.6 1-.4",key:"s6srou"}],["path",{d:"m14.7 10.8 1-.4",key:"4d31cq"}],["path",{d:"m13.4 8.3-.3.9",key:"1bm987"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const SY=q("ServerCrash",[["path",{d:"M6 10H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-2",key:"4b9dqc"}],["path",{d:"M6 14H4a2 2 0 0 0-2 2v4a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-4a2 2 0 0 0-2-2h-2",key:"22nnkd"}],["path",{d:"M6 6h.01",key:"1utrut"}],["path",{d:"M6 18h.01",key:"uhywen"}],["path",{d:"m13 6-4 6h6l-4 6",key:"14hqih"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const CY=q("ServerOff",[["path",{d:"M7 2h13a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-5",key:"bt2siv"}],["path",{d:"M10 10 2.5 2.5C2 2 2 2.5 2 5v3a2 2 0 0 0 2 2h6z",key:"1hjrv1"}],["path",{d:"M22 17v-1a2 2 0 0 0-2-2h-1",key:"1iynyr"}],["path",{d:"M4 14a2 2 0 0 0-2 2v4a2 2 0 0 0 2 2h16.5l1-.5.5.5-8-8H4z",key:"161ggg"}],["path",{d:"M6 18h.01",key:"uhywen"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const MY=q("Server",[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const TY=q("Settings2",[["path",{d:"M20 7h-9",key:"3s1dr2"}],["path",{d:"M14 17H5",key:"gfn3mx"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Fd=q("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const AY=q("Shapes",[["path",{d:"M8.3 10a.7.7 0 0 1-.626-1.079L11.4 3a.7.7 0 0 1 1.198-.043L16.3 8.9a.7.7 0 0 1-.572 1.1Z",key:"1bo67w"}],["rect",{x:"3",y:"14",width:"7",height:"7",rx:"1",key:"1bkyp8"}],["circle",{cx:"17.5",cy:"17.5",r:"3.5",key:"w3z12y"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Nc=q("Share2",[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bA=q("Share",[["path",{d:"M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8",key:"1b2hhj"}],["polyline",{points:"16 6 12 2 8 6",key:"m901s6"}],["line",{x1:"12",x2:"12",y1:"2",y2:"15",key:"1p0rca"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const EY=q("Sheet",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["line",{x1:"3",x2:"21",y1:"9",y2:"9",key:"1vqk6q"}],["line",{x1:"3",x2:"21",y1:"15",y2:"15",key:"o2sbyz"}],["line",{x1:"9",x2:"9",y1:"9",y2:"21",key:"1ib60c"}],["line",{x1:"15",x2:"15",y1:"9",y2:"21",key:"1n26ft"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const IY=q("Shell",[["path",{d:"M14 11a2 2 0 1 1-4 0 4 4 0 0 1 8 0 6 6 0 0 1-12 0 8 8 0 0 1 16 0 10 10 0 1 1-20 0 11.93 11.93 0 0 1 2.42-7.22 2 2 0 1 1 3.16 2.44",key:"1cn552"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const PY=q("ShieldAlert",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const LY=q("ShieldBan",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m4.243 5.21 14.39 12.472",key:"1c9a7c"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wA=q("ShieldCheck",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const OY=q("ShieldEllipsis",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M8 12h.01",key:"czm47f"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M16 12h.01",key:"1l6xoz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const DY=q("ShieldHalf",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M12 22V2",key:"zs6s6o"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const RY=q("ShieldMinus",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M9 12h6",key:"1c52cq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const FY=q("ShieldOff",[["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M5 5a1 1 0 0 0-1 1v7c0 5 3.5 7.5 7.67 8.94a1 1 0 0 0 .67.01c2.35-.82 4.48-1.97 5.9-3.71",key:"1jlk70"}],["path",{d:"M9.309 3.652A12.252 12.252 0 0 0 11.24 2.28a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1v7a9.784 9.784 0 0 1-.08 1.264",key:"18rp1v"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zY=q("ShieldPlus",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M9 12h6",key:"1c52cq"}],["path",{d:"M12 9v6",key:"199k2o"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const BY=q("ShieldQuestion",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"M9.1 9a3 3 0 0 1 5.82 1c0 2-3 3-3 3",key:"mhlwft"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const M2=q("ShieldX",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m14.5 9.5-5 5",key:"17q4r4"}],["path",{d:"m9.5 9.5 5 5",key:"18nt4w"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yf=q("Shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $Y=q("ShipWheel",[["circle",{cx:"12",cy:"12",r:"8",key:"46899m"}],["path",{d:"M12 2v7.5",key:"1e5rl5"}],["path",{d:"m19 5-5.23 5.23",key:"1ezxxf"}],["path",{d:"M22 12h-7.5",key:"le1719"}],["path",{d:"m19 19-5.23-5.23",key:"p3fmgn"}],["path",{d:"M12 14.5V22",key:"dgcmos"}],["path",{d:"M10.23 13.77 5 19",key:"qwopd4"}],["path",{d:"M9.5 12H2",key:"r7bup8"}],["path",{d:"M10.23 10.23 5 5",key:"k2y7lj"}],["circle",{cx:"12",cy:"12",r:"2.5",key:"ix0uyj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const UY=q("Ship",[["path",{d:"M12 10.189V14",key:"1p8cqu"}],["path",{d:"M12 2v3",key:"qbqxhf"}],["path",{d:"M19 13V7a2 2 0 0 0-2-2H7a2 2 0 0 0-2 2v6",key:"qpkstq"}],["path",{d:"M19.38 20A11.6 11.6 0 0 0 21 14l-8.188-3.639a2 2 0 0 0-1.624 0L3 14a11.6 11.6 0 0 0 2.81 7.76",key:"7tigtc"}],["path",{d:"M2 21c.6.5 1.2 1 2.5 1 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1s1.2 1 2.5 1c2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1",key:"1924j5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qY=q("Shirt",[["path",{d:"M20.38 3.46 16 2a4 4 0 0 1-8 0L3.62 3.46a2 2 0 0 0-1.34 2.23l.58 3.47a1 1 0 0 0 .99.84H6v10c0 1.1.9 2 2 2h8a2 2 0 0 0 2-2V10h2.15a1 1 0 0 0 .99-.84l.58-3.47a2 2 0 0 0-1.34-2.23z",key:"1wgbhj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Rg=q("ShoppingBag",[["path",{d:"M6 2 3 6v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V6l-3-4Z",key:"hou9p0"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M16 10a4 4 0 0 1-8 0",key:"1ltviw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const VY=q("ShoppingBasket",[["path",{d:"m15 11-1 9",key:"5wnq3a"}],["path",{d:"m19 11-4-7",key:"cnml18"}],["path",{d:"M2 11h20",key:"3eubbj"}],["path",{d:"m3.5 11 1.6 7.4a2 2 0 0 0 2 1.6h9.8a2 2 0 0 0 2-1.6l1.7-7.4",key:"yiazzp"}],["path",{d:"M4.5 15.5h15",key:"13mye1"}],["path",{d:"m5 11 4-7",key:"116ra9"}],["path",{d:"m9 11 1 9",key:"1ojof7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Nh=q("ShoppingCart",[["circle",{cx:"8",cy:"21",r:"1",key:"jimo8o"}],["circle",{cx:"19",cy:"21",r:"1",key:"13723u"}],["path",{d:"M2.05 2.05h2l2.66 12.42a2 2 0 0 0 2 1.58h9.78a2 2 0 0 0 1.95-1.57l1.65-7.43H5.12",key:"9zh506"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const HY=q("Shovel",[["path",{d:"M2 22v-5l5-5 5 5-5 5z",key:"1fh25c"}],["path",{d:"M9.5 14.5 16 8",key:"1smz5x"}],["path",{d:"m17 2 5 5-.5.5a3.53 3.53 0 0 1-5 0s0 0 0 0a3.53 3.53 0 0 1 0-5L17 2",key:"1q8uv5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const WY=q("ShowerHead",[["path",{d:"m4 4 2.5 2.5",key:"uv2vmf"}],["path",{d:"M13.5 6.5a4.95 4.95 0 0 0-7 7",key:"frdkwv"}],["path",{d:"M15 5 5 15",key:"1ag8rq"}],["path",{d:"M14 17v.01",key:"eokfpp"}],["path",{d:"M10 16v.01",key:"14uyyl"}],["path",{d:"M13 13v.01",key:"1v1k97"}],["path",{d:"M16 10v.01",key:"5169yg"}],["path",{d:"M11 20v.01",key:"cj92p8"}],["path",{d:"M17 14v.01",key:"11cswd"}],["path",{d:"M20 11v.01",key:"19e0od"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const GY=q("Shrink",[["path",{d:"m15 15 6 6m-6-6v4.8m0-4.8h4.8",key:"17vawe"}],["path",{d:"M9 19.8V15m0 0H4.2M9 15l-6 6",key:"chjx8e"}],["path",{d:"M15 4.2V9m0 0h4.8M15 9l6-6",key:"lav6yq"}],["path",{d:"M9 4.2V9m0 0H4.2M9 9 3 3",key:"1pxi2q"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const KY=q("Shrub",[["path",{d:"M12 22v-7l-2-2",key:"eqv9mc"}],["path",{d:"M17 8v.8A6 6 0 0 1 13.8 20H10A6.5 6.5 0 0 1 7 8a5 5 0 0 1 10 0Z",key:"ubcgy"}],["path",{d:"m14 14-2 2",key:"847xa2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ZY=q("Shuffle",[["path",{d:"m18 14 4 4-4 4",key:"10pe0f"}],["path",{d:"m18 2 4 4-4 4",key:"pucp1d"}],["path",{d:"M2 18h1.973a4 4 0 0 0 3.3-1.7l5.454-8.6a4 4 0 0 1 3.3-1.7H22",key:"1ailkh"}],["path",{d:"M2 6h1.972a4 4 0 0 1 3.6 2.2",key:"km57vx"}],["path",{d:"M22 18h-6.041a4 4 0 0 1-3.3-1.8l-.359-.45",key:"os18l9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const YY=q("Sigma",[["path",{d:"M18 7V5a1 1 0 0 0-1-1H6.5a.5.5 0 0 0-.4.8l4.5 6a2 2 0 0 1 0 2.4l-4.5 6a.5.5 0 0 0 .4.8H17a1 1 0 0 0 1-1v-2",key:"wuwx1p"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const XY=q("SignalHigh",[["path",{d:"M2 20h.01",key:"4haj6o"}],["path",{d:"M7 20v-4",key:"j294jx"}],["path",{d:"M12 20v-8",key:"i3yub9"}],["path",{d:"M17 20V8",key:"1tkaf5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const QY=q("SignalLow",[["path",{d:"M2 20h.01",key:"4haj6o"}],["path",{d:"M7 20v-4",key:"j294jx"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const JY=q("SignalMedium",[["path",{d:"M2 20h.01",key:"4haj6o"}],["path",{d:"M7 20v-4",key:"j294jx"}],["path",{d:"M12 20v-8",key:"i3yub9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const eX=q("SignalZero",[["path",{d:"M2 20h.01",key:"4haj6o"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tX=q("Signal",[["path",{d:"M2 20h.01",key:"4haj6o"}],["path",{d:"M7 20v-4",key:"j294jx"}],["path",{d:"M12 20v-8",key:"i3yub9"}],["path",{d:"M17 20V8",key:"1tkaf5"}],["path",{d:"M22 4v16",key:"sih9yq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rX=q("Signature",[["path",{d:"m21 17-2.156-1.868A.5.5 0 0 0 18 15.5v.5a1 1 0 0 1-1 1h-2a1 1 0 0 1-1-1c0-2.545-3.991-3.97-8.5-4a1 1 0 0 0 0 5c4.153 0 4.745-11.295 5.708-13.5a2.5 2.5 0 1 1 3.31 3.284",key:"y32ogt"}],["path",{d:"M3 21h18",key:"itz85i"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nX=q("SignpostBig",[["path",{d:"M10 9H4L2 7l2-2h6",key:"1hq7x2"}],["path",{d:"M14 5h6l2 2-2 2h-6",key:"bv62ej"}],["path",{d:"M10 22V4a2 2 0 1 1 4 0v18",key:"eqpcf2"}],["path",{d:"M8 22h8",key:"rmew8v"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sX=q("Signpost",[["path",{d:"M12 13v8",key:"1l5pq0"}],["path",{d:"M12 3v3",key:"1n5kay"}],["path",{d:"M18 6a2 2 0 0 1 1.387.56l2.307 2.22a1 1 0 0 1 0 1.44l-2.307 2.22A2 2 0 0 1 18 13H6a2 2 0 0 1-1.387-.56l-2.306-2.22a1 1 0 0 1 0-1.44l2.306-2.22A2 2 0 0 1 6 6z",key:"gqqp9m"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const aX=q("Siren",[["path",{d:"M7 18v-6a5 5 0 1 1 10 0v6",key:"pcx96s"}],["path",{d:"M5 21a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-1a2 2 0 0 0-2-2H7a2 2 0 0 0-2 2z",key:"1b4s83"}],["path",{d:"M21 12h1",key:"jtio3y"}],["path",{d:"M18.5 4.5 18 5",key:"g5sp9y"}],["path",{d:"M2 12h1",key:"1uaihz"}],["path",{d:"M12 2v1",key:"11qlp1"}],["path",{d:"m4.929 4.929.707.707",key:"1i51kw"}],["path",{d:"M12 12v6",key:"3ahymv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const iX=q("SkipBack",[["polygon",{points:"19 20 9 12 19 4 19 20",key:"o2sva"}],["line",{x1:"5",x2:"5",y1:"19",y2:"5",key:"1ocqjk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oX=q("SkipForward",[["polygon",{points:"5 4 15 12 5 20 5 4",key:"16p6eg"}],["line",{x1:"19",x2:"19",y1:"5",y2:"19",key:"futhcm"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lX=q("Skull",[["path",{d:"m12.5 17-.5-1-.5 1h1z",key:"3me087"}],["path",{d:"M15 22a1 1 0 0 0 1-1v-1a2 2 0 0 0 1.56-3.25 8 8 0 1 0-11.12 0A2 2 0 0 0 8 20v1a1 1 0 0 0 1 1z",key:"1o5pge"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cX=q("Slack",[["rect",{width:"3",height:"8",x:"13",y:"2",rx:"1.5",key:"diqz80"}],["path",{d:"M19 8.5V10h1.5A1.5 1.5 0 1 0 19 8.5",key:"183iwg"}],["rect",{width:"3",height:"8",x:"8",y:"14",rx:"1.5",key:"hqg7r1"}],["path",{d:"M5 15.5V14H3.5A1.5 1.5 0 1 0 5 15.5",key:"76g71w"}],["rect",{width:"8",height:"3",x:"14",y:"13",rx:"1.5",key:"1kmz0a"}],["path",{d:"M15.5 19H14v1.5a1.5 1.5 0 1 0 1.5-1.5",key:"jc4sz0"}],["rect",{width:"8",height:"3",x:"2",y:"8",rx:"1.5",key:"1omvl4"}],["path",{d:"M8.5 5H10V3.5A1.5 1.5 0 1 0 8.5 5",key:"16f3cl"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dX=q("Slash",[["path",{d:"M22 2 2 22",key:"y4kqgn"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uX=q("Slice",[["path",{d:"M11 16.586V19a1 1 0 0 1-1 1H2L18.37 3.63a1 1 0 1 1 3 3l-9.663 9.663a1 1 0 0 1-1.414 0L8 14",key:"1sllp5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jA=q("SlidersHorizontal",[["line",{x1:"21",x2:"14",y1:"4",y2:"4",key:"obuewd"}],["line",{x1:"10",x2:"3",y1:"4",y2:"4",key:"1q6298"}],["line",{x1:"21",x2:"12",y1:"12",y2:"12",key:"1iu8h1"}],["line",{x1:"8",x2:"3",y1:"12",y2:"12",key:"ntss68"}],["line",{x1:"21",x2:"16",y1:"20",y2:"20",key:"14d8ph"}],["line",{x1:"12",x2:"3",y1:"20",y2:"20",key:"m0wm8r"}],["line",{x1:"14",x2:"14",y1:"2",y2:"6",key:"14e1ph"}],["line",{x1:"8",x2:"8",y1:"10",y2:"14",key:"1i6ji0"}],["line",{x1:"16",x2:"16",y1:"18",y2:"22",key:"1lctlv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const T2=q("SlidersVertical",[["line",{x1:"4",x2:"4",y1:"21",y2:"14",key:"1p332r"}],["line",{x1:"4",x2:"4",y1:"10",y2:"3",key:"gb41h5"}],["line",{x1:"12",x2:"12",y1:"21",y2:"12",key:"hf2csr"}],["line",{x1:"12",x2:"12",y1:"8",y2:"3",key:"1kfi7u"}],["line",{x1:"20",x2:"20",y1:"21",y2:"16",key:"1lhrwl"}],["line",{x1:"20",x2:"20",y1:"12",y2:"3",key:"16vvfq"}],["line",{x1:"2",x2:"6",y1:"14",y2:"14",key:"1uebub"}],["line",{x1:"10",x2:"14",y1:"8",y2:"8",key:"1yglbp"}],["line",{x1:"18",x2:"22",y1:"16",y2:"16",key:"1jxqpz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hX=q("SmartphoneCharging",[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12.667 8 10 12h4l-2.667 4",key:"h9lk2d"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fX=q("SmartphoneNfc",[["rect",{width:"7",height:"12",x:"2",y:"6",rx:"1",key:"5nje8w"}],["path",{d:"M13 8.32a7.43 7.43 0 0 1 0 7.36",key:"1g306n"}],["path",{d:"M16.46 6.21a11.76 11.76 0 0 1 0 11.58",key:"uqvjvo"}],["path",{d:"M19.91 4.1a15.91 15.91 0 0 1 .01 15.8",key:"ujntz3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const py=q("Smartphone",[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pX=q("SmilePlus",[["path",{d:"M22 11v1a10 10 0 1 1-9-10",key:"ew0xw9"}],["path",{d:"M8 14s1.5 2 4 2 4-2 4-2",key:"1y1vjs"}],["line",{x1:"9",x2:"9.01",y1:"9",y2:"9",key:"yxxnd0"}],["line",{x1:"15",x2:"15.01",y1:"9",y2:"9",key:"1p4y9e"}],["path",{d:"M16 5h6",key:"1vod17"}],["path",{d:"M19 2v6",key:"4bpg5p"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mX=q("Smile",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 14s1.5 2 4 2 4-2 4-2",key:"1y1vjs"}],["line",{x1:"9",x2:"9.01",y1:"9",y2:"9",key:"yxxnd0"}],["line",{x1:"15",x2:"15.01",y1:"9",y2:"9",key:"1p4y9e"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gX=q("Snail",[["path",{d:"M2 13a6 6 0 1 0 12 0 4 4 0 1 0-8 0 2 2 0 0 0 4 0",key:"hneq2s"}],["circle",{cx:"10",cy:"13",r:"8",key:"194lz3"}],["path",{d:"M2 21h12c4.4 0 8-3.6 8-8V7a2 2 0 1 0-4 0v6",key:"ixqyt7"}],["path",{d:"M18 3 19.1 5.2",key:"9tjm43"}],["path",{d:"M22 3 20.9 5.2",key:"j3odrs"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const j1=q("Snowflake",[["line",{x1:"2",x2:"22",y1:"12",y2:"12",key:"1dnqot"}],["line",{x1:"12",x2:"12",y1:"2",y2:"22",key:"7eqyqh"}],["path",{d:"m20 16-4-4 4-4",key:"rquw4f"}],["path",{d:"m4 8 4 4-4 4",key:"12s3z9"}],["path",{d:"m16 4-4 4-4-4",key:"1tumq1"}],["path",{d:"m8 20 4-4 4 4",key:"9p200w"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xX=q("Sofa",[["path",{d:"M20 9V6a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v3",key:"1dgpiv"}],["path",{d:"M2 16a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-5a2 2 0 0 0-4 0v1.5a.5.5 0 0 1-.5.5h-11a.5.5 0 0 1-.5-.5V11a2 2 0 0 0-4 0z",key:"xacw8m"}],["path",{d:"M4 18v2",key:"jwo5n2"}],["path",{d:"M20 18v2",key:"1ar1qi"}],["path",{d:"M12 4v9",key:"oqhhn3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yX=q("Soup",[["path",{d:"M12 21a9 9 0 0 0 9-9H3a9 9 0 0 0 9 9Z",key:"4rw317"}],["path",{d:"M7 21h10",key:"1b0cd5"}],["path",{d:"M19.5 12 22 6",key:"shfsr5"}],["path",{d:"M16.25 3c.27.1.8.53.75 1.36-.06.83-.93 1.2-1 2.02-.05.78.34 1.24.73 1.62",key:"rpc6vp"}],["path",{d:"M11.25 3c.27.1.8.53.74 1.36-.05.83-.93 1.2-.98 2.02-.06.78.33 1.24.72 1.62",key:"1lf63m"}],["path",{d:"M6.25 3c.27.1.8.53.75 1.36-.06.83-.93 1.2-1 2.02-.05.78.34 1.24.74 1.62",key:"97tijn"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vX=q("Space",[["path",{d:"M22 17v1c0 .5-.5 1-1 1H3c-.5 0-1-.5-1-1v-1",key:"lt2kga"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _X=q("Spade",[["path",{d:"M5 9c-1.5 1.5-3 3.2-3 5.5A5.5 5.5 0 0 0 7.5 20c1.8 0 3-.5 4.5-2 1.5 1.5 2.7 2 4.5 2a5.5 5.5 0 0 0 5.5-5.5c0-2.3-1.5-4-3-5.5l-7-7-7 7Z",key:"40bo9n"}],["path",{d:"M12 18v4",key:"jadmvz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bX=q("Sparkle",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ls=q("Sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wX=q("Speaker",[["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",key:"1nb95v"}],["path",{d:"M12 6h.01",key:"1vi96p"}],["circle",{cx:"12",cy:"14",r:"4",key:"1jruaj"}],["path",{d:"M12 14h.01",key:"1etili"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jX=q("Speech",[["path",{d:"M8.8 20v-4.1l1.9.2a2.3 2.3 0 0 0 2.164-2.1V8.3A5.37 5.37 0 0 0 2 8.25c0 2.8.656 3.054 1 4.55a5.77 5.77 0 0 1 .029 2.758L2 20",key:"11atix"}],["path",{d:"M19.8 17.8a7.5 7.5 0 0 0 .003-10.603",key:"yol142"}],["path",{d:"M17 15a3.5 3.5 0 0 0-.025-4.975",key:"ssbmkc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kX=q("SpellCheck2",[["path",{d:"m6 16 6-12 6 12",key:"1b4byz"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M4 21c1.1 0 1.1-1 2.3-1s1.1 1 2.3 1c1.1 0 1.1-1 2.3-1 1.1 0 1.1 1 2.3 1 1.1 0 1.1-1 2.3-1 1.1 0 1.1 1 2.3 1 1.1 0 1.1-1 2.3-1",key:"8mdmtu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const NX=q("SpellCheck",[["path",{d:"m6 16 6-12 6 12",key:"1b4byz"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"m16 20 2 2 4-4",key:"13tcca"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const SX=q("Spline",[["circle",{cx:"19",cy:"5",r:"2",key:"mhkx31"}],["circle",{cx:"5",cy:"19",r:"2",key:"v8kfzx"}],["path",{d:"M5 17A12 12 0 0 1 17 5",key:"1okkup"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const CX=q("Split",[["path",{d:"M16 3h5v5",key:"1806ms"}],["path",{d:"M8 3H3v5",key:"15dfkv"}],["path",{d:"M12 22v-8.3a4 4 0 0 0-1.172-2.872L3 3",key:"1qrqzj"}],["path",{d:"m15 9 6-6",key:"ko1vev"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const MX=q("SprayCan",[["path",{d:"M3 3h.01",key:"159qn6"}],["path",{d:"M7 5h.01",key:"1hq22a"}],["path",{d:"M11 7h.01",key:"1osv80"}],["path",{d:"M3 7h.01",key:"1xzrh3"}],["path",{d:"M7 9h.01",key:"19b3jx"}],["path",{d:"M3 11h.01",key:"1eifu7"}],["rect",{width:"4",height:"4",x:"15",y:"5",key:"mri9e4"}],["path",{d:"m19 9 2 2v10c0 .6-.4 1-1 1h-6c-.6 0-1-.4-1-1V11l2-2",key:"aib6hk"}],["path",{d:"m13 14 8-2",key:"1d7bmk"}],["path",{d:"m13 19 8-2",key:"1y2vml"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const TX=q("Sprout",[["path",{d:"M7 20h10",key:"e6iznv"}],["path",{d:"M10 20c5.5-2.5.8-6.4 3-10",key:"161w41"}],["path",{d:"M9.5 9.4c1.1.8 1.8 2.2 2.3 3.7-2 .4-3.5.4-4.8-.3-1.2-.6-2.3-1.9-3-4.2 2.8-.5 4.4 0 5.5.8z",key:"9gtqwd"}],["path",{d:"M14.1 6a7 7 0 0 0-1.1 4c1.9-.1 3.3-.6 4.3-1.4 1-1 1.6-2.3 1.7-4.6-2.7.1-4 1-4.9 2z",key:"bkxnd2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const A2=q("SquareActivity",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M17 12h-2l-2 5-2-10-2 5H7",key:"15hlnc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const E2=q("SquareArrowDownLeft",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"m16 8-8 8",key:"166keh"}],["path",{d:"M16 16H8V8",key:"1w2ppm"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const I2=q("SquareArrowDownRight",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"m8 8 8 8",key:"1imecy"}],["path",{d:"M16 8v8H8",key:"1lbpgo"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const P2=q("SquareArrowDown",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 8v8",key:"napkw2"}],["path",{d:"m8 12 4 4 4-4",key:"k98ssh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const L2=q("SquareArrowLeft",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"m12 8-4 4 4 4",key:"15vm53"}],["path",{d:"M16 12H8",key:"1fr5h0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const O2=q("SquareArrowOutDownLeft",[["path",{d:"M13 21h6a2 2 0 0 0 2-2V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v6",key:"14qz4y"}],["path",{d:"m3 21 9-9",key:"1jfql5"}],["path",{d:"M9 21H3v-6",key:"wtvkvv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const D2=q("SquareArrowOutDownRight",[["path",{d:"M21 11V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h6",key:"14rsvq"}],["path",{d:"m21 21-9-9",key:"1et2py"}],["path",{d:"M21 15v6h-6",key:"1jko0i"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const R2=q("SquareArrowOutUpLeft",[["path",{d:"M13 3h6a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-6",key:"14mv1t"}],["path",{d:"m3 3 9 9",key:"rks13r"}],["path",{d:"M3 9V3h6",key:"ira0h2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const F2=q("SquareArrowOutUpRight",[["path",{d:"M21 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h6",key:"y09zxi"}],["path",{d:"m21 3-9 9",key:"mpx6sq"}],["path",{d:"M15 3h6v6",key:"1q9fwt"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const z2=q("SquareArrowRight",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"m12 16 4-4-4-4",key:"1i9zcv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const B2=q("SquareArrowUpLeft",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M8 16V8h8",key:"19xb1h"}],["path",{d:"M16 16 8 8",key:"1qdy8n"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $2=q("SquareArrowUpRight",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M8 8h8v8",key:"b65dnt"}],["path",{d:"m8 16 8-8",key:"13b9ih"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const U2=q("SquareArrowUp",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"m16 12-4-4-4 4",key:"177agl"}],["path",{d:"M12 16V8",key:"1sbj14"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const q2=q("SquareAsterisk",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 8v8",key:"napkw2"}],["path",{d:"m8.5 14 7-4",key:"12hpby"}],["path",{d:"m8.5 10 7 4",key:"wwy2dy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const V2=q("SquareBottomDashedScissors",[["path",{d:"M4 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v16a2 2 0 0 1-2 2",key:"1vzg26"}],["path",{d:"M10 22H8",key:"euku7a"}],["path",{d:"M16 22h-2",key:"18d249"}],["circle",{cx:"8",cy:"8",r:"2",key:"14cg06"}],["path",{d:"M9.414 9.414 12 12",key:"qz4lzr"}],["path",{d:"M14.8 14.8 18 18",key:"11flf1"}],["circle",{cx:"8",cy:"16",r:"2",key:"1acxsx"}],["path",{d:"m18 6-8.586 8.586",key:"11kzk1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pg=q("SquareChartGantt",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 8h7",key:"kbo1nt"}],["path",{d:"M8 12h6",key:"ikassy"}],["path",{d:"M11 16h5",key:"oq65wt"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const K0=q("SquareCheckBig",[["path",{d:"M21 10.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.5",key:"1uzm8b"}],["path",{d:"m9 11 3 3L22 4",key:"1pflzl"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const H2=q("SquareCheck",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const W2=q("SquareChevronDown",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"m16 10-4 4-4-4",key:"894hmk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const G2=q("SquareChevronLeft",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"m14 16-4-4 4-4",key:"ojs7w8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const K2=q("SquareChevronRight",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"m10 8 4 4-4 4",key:"1wy4r4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Z2=q("SquareChevronUp",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"m8 14 4-4 4 4",key:"fy2ptz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Y2=q("SquareCode",[["path",{d:"M10 9.5 8 12l2 2.5",key:"3mjy60"}],["path",{d:"m14 9.5 2 2.5-2 2.5",key:"1bir2l"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const AX=q("SquareDashedBottomCode",[["path",{d:"M10 9.5 8 12l2 2.5",key:"3mjy60"}],["path",{d:"M14 21h1",key:"v9vybs"}],["path",{d:"m14 9.5 2 2.5-2 2.5",key:"1bir2l"}],["path",{d:"M5 21a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2",key:"as5y1o"}],["path",{d:"M9 21h1",key:"15o7lz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const EX=q("SquareDashedBottom",[["path",{d:"M5 21a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2",key:"as5y1o"}],["path",{d:"M9 21h1",key:"15o7lz"}],["path",{d:"M14 21h1",key:"v9vybs"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const X2=q("SquareDashedKanban",[["path",{d:"M8 7v7",key:"1x2jlm"}],["path",{d:"M12 7v4",key:"xawao1"}],["path",{d:"M16 7v9",key:"1hp2iy"}],["path",{d:"M5 3a2 2 0 0 0-2 2",key:"y57alp"}],["path",{d:"M9 3h1",key:"1yesri"}],["path",{d:"M14 3h1",key:"1ec4yj"}],["path",{d:"M19 3a2 2 0 0 1 2 2",key:"18rm91"}],["path",{d:"M21 9v1",key:"mxsmne"}],["path",{d:"M21 14v1",key:"169vum"}],["path",{d:"M21 19a2 2 0 0 1-2 2",key:"1j7049"}],["path",{d:"M14 21h1",key:"v9vybs"}],["path",{d:"M9 21h1",key:"15o7lz"}],["path",{d:"M5 21a2 2 0 0 1-2-2",key:"sbafld"}],["path",{d:"M3 14v1",key:"vnatye"}],["path",{d:"M3 9v1",key:"1r0deq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Q2=q("SquareDashedMousePointer",[["path",{d:"M12.034 12.681a.498.498 0 0 1 .647-.647l9 3.5a.5.5 0 0 1-.033.943l-3.444 1.068a1 1 0 0 0-.66.66l-1.067 3.443a.5.5 0 0 1-.943.033z",key:"xwnzip"}],["path",{d:"M5 3a2 2 0 0 0-2 2",key:"y57alp"}],["path",{d:"M19 3a2 2 0 0 1 2 2",key:"18rm91"}],["path",{d:"M5 21a2 2 0 0 1-2-2",key:"sbafld"}],["path",{d:"M9 3h1",key:"1yesri"}],["path",{d:"M9 21h2",key:"1qve2z"}],["path",{d:"M14 3h1",key:"1ec4yj"}],["path",{d:"M3 9v1",key:"1r0deq"}],["path",{d:"M21 9v2",key:"p14lih"}],["path",{d:"M3 14v1",key:"vnatye"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const J2=q("SquareDashed",[["path",{d:"M5 3a2 2 0 0 0-2 2",key:"y57alp"}],["path",{d:"M19 3a2 2 0 0 1 2 2",key:"18rm91"}],["path",{d:"M21 19a2 2 0 0 1-2 2",key:"1j7049"}],["path",{d:"M5 21a2 2 0 0 1-2-2",key:"sbafld"}],["path",{d:"M9 3h1",key:"1yesri"}],["path",{d:"M9 21h1",key:"15o7lz"}],["path",{d:"M14 3h1",key:"1ec4yj"}],["path",{d:"M14 21h1",key:"v9vybs"}],["path",{d:"M3 9v1",key:"1r0deq"}],["path",{d:"M21 9v1",key:"mxsmne"}],["path",{d:"M3 14v1",key:"vnatye"}],["path",{d:"M21 14v1",key:"169vum"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ew=q("SquareDivide",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}],["line",{x1:"12",x2:"12",y1:"16",y2:"16",key:"aqc6ln"}],["line",{x1:"12",x2:"12",y1:"8",y2:"8",key:"1mkcni"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tw=q("SquareDot",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rw=q("SquareEqual",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M7 10h10",key:"1101jm"}],["path",{d:"M7 14h10",key:"1mhdw3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nw=q("SquareFunction",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["path",{d:"M9 17c2 0 2.8-1 2.8-2.8V10c0-2 1-3.3 3.2-3",key:"m1af9g"}],["path",{d:"M9 11.2h5.7",key:"3zgcl2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sw=q("SquareKanban",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M8 7v7",key:"1x2jlm"}],["path",{d:"M12 7v4",key:"xawao1"}],["path",{d:"M16 7v9",key:"1hp2iy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const aw=q("SquareLibrary",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M7 7v10",key:"d5nglc"}],["path",{d:"M11 7v10",key:"pptsnr"}],["path",{d:"m15 7 2 10",key:"1m7qm5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const iw=q("SquareM",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M8 16V8l4 4 4-4v8",key:"141u4e"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ow=q("SquareMenu",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M7 8h10",key:"1jw688"}],["path",{d:"M7 12h10",key:"b7w52i"}],["path",{d:"M7 16h10",key:"wp8him"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lw=q("SquareMinus",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M8 12h8",key:"1wcyev"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cw=q("SquareMousePointer",[["path",{d:"M12.034 12.681a.498.498 0 0 1 .647-.647l9 3.5a.5.5 0 0 1-.033.943l-3.444 1.068a1 1 0 0 0-.66.66l-1.067 3.443a.5.5 0 0 1-.943.033z",key:"xwnzip"}],["path",{d:"M21 11V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h6",key:"14rsvq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dw=q("SquareParkingOff",[["path",{d:"M3.6 3.6A2 2 0 0 1 5 3h14a2 2 0 0 1 2 2v14a2 2 0 0 1-.59 1.41",key:"9l1ft6"}],["path",{d:"M3 8.7V19a2 2 0 0 0 2 2h10.3",key:"17knke"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M13 13a3 3 0 1 0 0-6H9v2",key:"uoagbd"}],["path",{d:"M9 17v-2.3",key:"1jxgo2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uw=q("SquareParking",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 17V7h4a3 3 0 0 1 0 6H9",key:"1dfk2c"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gc=q("SquarePen",[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hw=q("SquarePercent",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"M9 9h.01",key:"1q5me6"}],["path",{d:"M15 15h.01",key:"lqbp3k"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fw=q("SquarePi",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M7 7h10",key:"udp07y"}],["path",{d:"M10 7v10",key:"i1d9ee"}],["path",{d:"M16 17a2 2 0 0 1-2-2V7",key:"ftwdc7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pw=q("SquarePilcrow",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 12H9.5a2.5 2.5 0 0 1 0-5H17",key:"1l9586"}],["path",{d:"M12 7v10",key:"jspqdw"}],["path",{d:"M16 7v10",key:"lavkr4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mw=q("SquarePlay",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"m9 8 6 4-6 4Z",key:"f1r3lt"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gw=q("SquarePlus",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M8 12h8",key:"1wcyev"}],["path",{d:"M12 8v8",key:"napkw2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xw=q("SquarePower",[["path",{d:"M12 7v4",key:"xawao1"}],["path",{d:"M7.998 9.003a5 5 0 1 0 8-.005",key:"1pek45"}],["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",key:"h1oib"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const IX=q("SquareRadical",[["path",{d:"M7 12h2l2 5 2-10h4",key:"1fxv6h"}],["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",key:"h1oib"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yw=q("SquareScissors",[["rect",{width:"20",height:"20",x:"2",y:"2",rx:"2",key:"1btzen"}],["circle",{cx:"8",cy:"8",r:"2",key:"14cg06"}],["path",{d:"M9.414 9.414 12 12",key:"qz4lzr"}],["path",{d:"M14.8 14.8 18 18",key:"11flf1"}],["circle",{cx:"8",cy:"16",r:"2",key:"1acxsx"}],["path",{d:"m18 6-8.586 8.586",key:"11kzk1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vw=q("SquareSigma",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M16 8.9V7H8l4 5-4 5h8v-1.9",key:"9nih0i"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _w=q("SquareSlash",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["line",{x1:"9",x2:"15",y1:"15",y2:"9",key:"1dfufj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bw=q("SquareSplitHorizontal",[["path",{d:"M8 19H5c-1 0-2-1-2-2V7c0-1 1-2 2-2h3",key:"lubmu8"}],["path",{d:"M16 5h3c1 0 2 1 2 2v10c0 1-1 2-2 2h-3",key:"1ag34g"}],["line",{x1:"12",x2:"12",y1:"4",y2:"20",key:"1tx1rr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ww=q("SquareSplitVertical",[["path",{d:"M5 8V5c0-1 1-2 2-2h10c1 0 2 1 2 2v3",key:"1pi83i"}],["path",{d:"M19 16v3c0 1-1 2-2 2H7c-1 0-2-1-2-2v-3",key:"ido5k7"}],["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const PX=q("SquareSquare",[["rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",key:"h1oib"}],["rect",{x:"8",y:"8",width:"8",height:"8",rx:"1",key:"z9xiuo"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const LX=q("SquareStack",[["path",{d:"M4 10c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h4c1.1 0 2 .9 2 2",key:"4i38lg"}],["path",{d:"M10 16c-1.1 0-2-.9-2-2v-4c0-1.1.9-2 2-2h4c1.1 0 2 .9 2 2",key:"mlte4a"}],["rect",{width:"8",height:"8",x:"14",y:"14",rx:"2",key:"1fa9i4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jw=q("SquareTerminal",[["path",{d:"m7 11 2-2-2-2",key:"1lz0vl"}],["path",{d:"M11 13h4",key:"1p7l4v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kw=q("SquareUserRound",[["path",{d:"M18 21a6 6 0 0 0-12 0",key:"kaz2du"}],["circle",{cx:"12",cy:"11",r:"4",key:"1gt34v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Nw=q("SquareUser",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}],["path",{d:"M7 21v-2a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v2",key:"1m6ac2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Sw=q("SquareX",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Fg=q("Square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const OX=q("Squircle",[["path",{d:"M12 3c7.2 0 9 1.8 9 9s-1.8 9-9 9-9-1.8-9-9 1.8-9 9-9",key:"garfkc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const DX=q("Squirrel",[["path",{d:"M15.236 22a3 3 0 0 0-2.2-5",key:"21bitc"}],["path",{d:"M16 20a3 3 0 0 1 3-3h1a2 2 0 0 0 2-2v-2a4 4 0 0 0-4-4V4",key:"oh0fg0"}],["path",{d:"M18 13h.01",key:"9veqaj"}],["path",{d:"M18 6a4 4 0 0 0-4 4 7 7 0 0 0-7 7c0-5 4-5 4-10.5a4.5 4.5 0 1 0-9 0 2.5 2.5 0 0 0 5 0C7 10 3 11 3 17c0 2.8 2.2 5 5 5h10",key:"980v8a"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const RX=q("Stamp",[["path",{d:"M5 22h14",key:"ehvnwv"}],["path",{d:"M19.27 13.73A2.5 2.5 0 0 0 17.5 13h-11A2.5 2.5 0 0 0 4 15.5V17a1 1 0 0 0 1 1h14a1 1 0 0 0 1-1v-1.5c0-.66-.26-1.3-.73-1.77Z",key:"1sy9ra"}],["path",{d:"M14 13V8.5C14 7 15 7 15 5a3 3 0 0 0-3-3c-1.66 0-3 1-3 3s1 2 1 3.5V13",key:"cnxgux"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const FX=q("StarHalf",[["path",{d:"M12 18.338a2.1 2.1 0 0 0-.987.244L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.12 2.12 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.12 2.12 0 0 0 1.597-1.16l2.309-4.679A.53.53 0 0 1 12 2",key:"2ksp49"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zX=q("StarOff",[["path",{d:"M8.34 8.34 2 9.27l5 4.87L5.82 21 12 17.77 18.18 21l-.59-3.43",key:"16m0ql"}],["path",{d:"M18.42 12.76 22 9.27l-6.91-1L12 2l-1.44 2.91",key:"1vt8nq"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const js=q("Star",[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const BX=q("StepBack",[["line",{x1:"18",x2:"18",y1:"20",y2:"4",key:"cun8e5"}],["polygon",{points:"14,20 4,12 14,4",key:"ypakod"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $X=q("StepForward",[["line",{x1:"6",x2:"6",y1:"4",y2:"20",key:"fy8qot"}],["polygon",{points:"10,4 20,12 10,20",key:"1mc1pf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const UX=q("Stethoscope",[["path",{d:"M11 2v2",key:"1539x4"}],["path",{d:"M5 2v2",key:"1yf1q8"}],["path",{d:"M5 3H4a2 2 0 0 0-2 2v4a6 6 0 0 0 12 0V5a2 2 0 0 0-2-2h-1",key:"rb5t3r"}],["path",{d:"M8 15a6 6 0 0 0 12 0v-3",key:"x18d4x"}],["circle",{cx:"20",cy:"10",r:"2",key:"ts1r5v"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qX=q("Sticker",[["path",{d:"M15.5 3H5a2 2 0 0 0-2 2v14c0 1.1.9 2 2 2h14a2 2 0 0 0 2-2V8.5L15.5 3Z",key:"1wis1t"}],["path",{d:"M14 3v4a2 2 0 0 0 2 2h4",key:"36rjfy"}],["path",{d:"M8 13h.01",key:"1sbv64"}],["path",{d:"M16 13h.01",key:"wip0gl"}],["path",{d:"M10 16s.8 1 2 1c1.3 0 2-1 2-1",key:"1vvgv3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const VX=q("StickyNote",[["path",{d:"M16 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V8Z",key:"qazsjp"}],["path",{d:"M15 3v4a2 2 0 0 0 2 2h4",key:"40519r"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const HX=q("Store",[["path",{d:"m2 7 4.41-4.41A2 2 0 0 1 7.83 2h8.34a2 2 0 0 1 1.42.59L22 7",key:"ztvudi"}],["path",{d:"M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8",key:"1b2hhj"}],["path",{d:"M15 22v-4a2 2 0 0 0-2-2h-2a2 2 0 0 0-2 2v4",key:"2ebpfo"}],["path",{d:"M2 7h20",key:"1fcdvo"}],["path",{d:"M22 7v3a2 2 0 0 1-2 2a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 16 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 12 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 8 12a2.7 2.7 0 0 1-1.59-.63.7.7 0 0 0-.82 0A2.7 2.7 0 0 1 4 12a2 2 0 0 1-2-2V7",key:"6c3vgh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const WX=q("StretchHorizontal",[["rect",{width:"20",height:"6",x:"2",y:"4",rx:"2",key:"qdearl"}],["rect",{width:"20",height:"6",x:"2",y:"14",rx:"2",key:"1xrn6j"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const GX=q("StretchVertical",[["rect",{width:"6",height:"20",x:"4",y:"2",rx:"2",key:"19qu7m"}],["rect",{width:"6",height:"20",x:"14",y:"2",rx:"2",key:"24v0nk"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const KX=q("Strikethrough",[["path",{d:"M16 4H9a3 3 0 0 0-2.83 4",key:"43sutm"}],["path",{d:"M14 12a4 4 0 0 1 0 8H6",key:"nlfj13"}],["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ZX=q("Subscript",[["path",{d:"m4 5 8 8",key:"1eunvl"}],["path",{d:"m12 5-8 8",key:"1ah0jp"}],["path",{d:"M20 19h-4c0-1.5.44-2 1.5-2.5S20 15.33 20 14c0-.47-.17-.93-.48-1.29a2.11 2.11 0 0 0-2.62-.44c-.42.24-.74.62-.9 1.07",key:"e8ta8j"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const YX=q("SunDim",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 4h.01",key:"1ujb9j"}],["path",{d:"M20 12h.01",key:"1ykeid"}],["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M4 12h.01",key:"158zrr"}],["path",{d:"M17.657 6.343h.01",key:"31pqzk"}],["path",{d:"M17.657 17.657h.01",key:"jehnf4"}],["path",{d:"M6.343 17.657h.01",key:"gdk6ow"}],["path",{d:"M6.343 6.343h.01",key:"1uurf0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const XX=q("SunMedium",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 3v1",key:"1asbbs"}],["path",{d:"M12 20v1",key:"1wcdkc"}],["path",{d:"M3 12h1",key:"lp3yf2"}],["path",{d:"M20 12h1",key:"1vloll"}],["path",{d:"m18.364 5.636-.707.707",key:"1hakh0"}],["path",{d:"m6.343 17.657-.707.707",key:"18m9nf"}],["path",{d:"m5.636 5.636.707.707",key:"1xv1c5"}],["path",{d:"m17.657 17.657.707.707",key:"vl76zb"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const QX=q("SunMoon",[["path",{d:"M12 8a2.83 2.83 0 0 0 4 4 4 4 0 1 1-4-4",key:"1fu5g2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.9 4.9 1.4 1.4",key:"b9915j"}],["path",{d:"m17.7 17.7 1.4 1.4",key:"qc3ed3"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.3 17.7-1.4 1.4",key:"5gca6"}],["path",{d:"m19.1 4.9-1.4 1.4",key:"wpu9u6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const JX=q("SunSnow",[["path",{d:"M10 9a3 3 0 1 0 0 6",key:"6zmtdl"}],["path",{d:"M2 12h1",key:"1uaihz"}],["path",{d:"M14 21V3",key:"1llu3z"}],["path",{d:"M10 4V3",key:"pkzwkn"}],["path",{d:"M10 21v-1",key:"1u8rkd"}],["path",{d:"m3.64 18.36.7-.7",key:"105rm9"}],["path",{d:"m4.34 6.34-.7-.7",key:"d3unjp"}],["path",{d:"M14 12h8",key:"4f43i9"}],["path",{d:"m17 4-3 3",key:"15jcng"}],["path",{d:"m14 17 3 3",key:"6tlq38"}],["path",{d:"m21 15-3-3 3-3",key:"1nlnje"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Z1=q("Sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const eQ=q("Sunrise",[["path",{d:"M12 2v8",key:"1q4o3n"}],["path",{d:"m4.93 10.93 1.41 1.41",key:"2a7f42"}],["path",{d:"M2 18h2",key:"j10viu"}],["path",{d:"M20 18h2",key:"wocana"}],["path",{d:"m19.07 10.93-1.41 1.41",key:"15zs5n"}],["path",{d:"M22 22H2",key:"19qnx5"}],["path",{d:"m8 6 4-4 4 4",key:"ybng9g"}],["path",{d:"M16 18a4 4 0 0 0-8 0",key:"1lzouq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tQ=q("Sunset",[["path",{d:"M12 10V2",key:"16sf7g"}],["path",{d:"m4.93 10.93 1.41 1.41",key:"2a7f42"}],["path",{d:"M2 18h2",key:"j10viu"}],["path",{d:"M20 18h2",key:"wocana"}],["path",{d:"m19.07 10.93-1.41 1.41",key:"15zs5n"}],["path",{d:"M22 22H2",key:"19qnx5"}],["path",{d:"m16 6-4 4-4-4",key:"6wukr"}],["path",{d:"M16 18a4 4 0 0 0-8 0",key:"1lzouq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rQ=q("Superscript",[["path",{d:"m4 19 8-8",key:"hr47gm"}],["path",{d:"m12 19-8-8",key:"1dhhmo"}],["path",{d:"M20 12h-4c0-1.5.442-2 1.5-2.5S20 8.334 20 7.002c0-.472-.17-.93-.484-1.29a2.105 2.105 0 0 0-2.617-.436c-.42.239-.738.614-.899 1.06",key:"1dfcux"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nQ=q("SwatchBook",[["path",{d:"M11 17a4 4 0 0 1-8 0V5a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2Z",key:"1ldrpk"}],["path",{d:"M16.7 13H19a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2H7",key:"11i5po"}],["path",{d:"M 7 17h.01",key:"1euzgo"}],["path",{d:"m11 8 2.3-2.3a2.4 2.4 0 0 1 3.404.004L18.6 7.6a2.4 2.4 0 0 1 .026 3.434L9.9 19.8",key:"o2gii7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sQ=q("SwissFranc",[["path",{d:"M10 21V3h8",key:"br2l0g"}],["path",{d:"M6 16h9",key:"2py0wn"}],["path",{d:"M10 9.5h7",key:"13dmhz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const aQ=q("SwitchCamera",[["path",{d:"M11 19H4a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2h5",key:"mtk2lu"}],["path",{d:"M13 5h7a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2h-5",key:"120jsl"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["path",{d:"m18 22-3-3 3-3",key:"kgdoj7"}],["path",{d:"m6 2 3 3-3 3",key:"1fnbkv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const iQ=q("Sword",[["polyline",{points:"14.5 17.5 3 6 3 3 6 3 17.5 14.5",key:"1hfsw2"}],["line",{x1:"13",x2:"19",y1:"19",y2:"13",key:"1vrmhu"}],["line",{x1:"16",x2:"20",y1:"16",y2:"20",key:"1bron3"}],["line",{x1:"19",x2:"21",y1:"21",y2:"19",key:"13pww6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oQ=q("Swords",[["polyline",{points:"14.5 17.5 3 6 3 3 6 3 17.5 14.5",key:"1hfsw2"}],["line",{x1:"13",x2:"19",y1:"19",y2:"13",key:"1vrmhu"}],["line",{x1:"16",x2:"20",y1:"16",y2:"20",key:"1bron3"}],["line",{x1:"19",x2:"21",y1:"21",y2:"19",key:"13pww6"}],["polyline",{points:"14.5 6.5 18 3 21 3 21 6 17.5 9.5",key:"hbey2j"}],["line",{x1:"5",x2:"9",y1:"14",y2:"18",key:"1hf58s"}],["line",{x1:"7",x2:"4",y1:"17",y2:"20",key:"pidxm4"}],["line",{x1:"3",x2:"5",y1:"19",y2:"21",key:"1pehsh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lQ=q("Syringe",[["path",{d:"m18 2 4 4",key:"22kx64"}],["path",{d:"m17 7 3-3",key:"1w1zoj"}],["path",{d:"M19 9 8.7 19.3c-1 1-2.5 1-3.4 0l-.6-.6c-1-1-1-2.5 0-3.4L15 5",key:"1exhtz"}],["path",{d:"m9 11 4 4",key:"rovt3i"}],["path",{d:"m5 19-3 3",key:"59f2uf"}],["path",{d:"m14 4 6 6",key:"yqp9t2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const OS=q("Table2",[["path",{d:"M9 3H5a2 2 0 0 0-2 2v4m6-6h10a2 2 0 0 1 2 2v4M9 3v18m0 0h10a2 2 0 0 0 2-2V9M9 21H5a2 2 0 0 1-2-2V9m0 0h18",key:"gugj83"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cQ=q("TableCellsMerge",[["path",{d:"M12 21v-6",key:"lihzve"}],["path",{d:"M12 9V3",key:"da5inc"}],["path",{d:"M3 15h18",key:"5xshup"}],["path",{d:"M3 9h18",key:"1pudct"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dQ=q("TableCellsSplit",[["path",{d:"M12 15V9",key:"8c7uyn"}],["path",{d:"M3 15h18",key:"5xshup"}],["path",{d:"M3 9h18",key:"1pudct"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uQ=q("TableColumnsSplit",[["path",{d:"M14 14v2",key:"w2a1xv"}],["path",{d:"M14 20v2",key:"1lq872"}],["path",{d:"M14 2v2",key:"6buw04"}],["path",{d:"M14 8v2",key:"i67w9a"}],["path",{d:"M2 15h8",key:"82wtch"}],["path",{d:"M2 3h6a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H2",key:"up0l64"}],["path",{d:"M2 9h8",key:"yelfik"}],["path",{d:"M22 15h-4",key:"1es58f"}],["path",{d:"M22 3h-2a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h2",key:"pdjoqf"}],["path",{d:"M22 9h-4",key:"1luja7"}],["path",{d:"M5 3v18",key:"14hmio"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hQ=q("TableOfContents",[["path",{d:"M16 12H3",key:"1a2rj7"}],["path",{d:"M16 18H3",key:"12xzn7"}],["path",{d:"M16 6H3",key:"1wxfjs"}],["path",{d:"M21 12h.01",key:"msek7k"}],["path",{d:"M21 18h.01",key:"1e8rq1"}],["path",{d:"M21 6h.01",key:"1koanj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fQ=q("TableProperties",[["path",{d:"M15 3v18",key:"14nvp0"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M21 9H3",key:"1338ky"}],["path",{d:"M21 15H3",key:"9uk58r"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pQ=q("TableRowsSplit",[["path",{d:"M14 10h2",key:"1lstlu"}],["path",{d:"M15 22v-8",key:"1fwwgm"}],["path",{d:"M15 2v4",key:"1044rn"}],["path",{d:"M2 10h2",key:"1r8dkt"}],["path",{d:"M20 10h2",key:"1ug425"}],["path",{d:"M3 19h18",key:"awlh7x"}],["path",{d:"M3 22v-6a2 2 135 0 1 2-2h14a2 2 45 0 1 2 2v6",key:"ibqhof"}],["path",{d:"M3 2v2a2 2 45 0 0 2 2h14a2 2 135 0 0 2-2V2",key:"1uenja"}],["path",{d:"M8 10h2",key:"66od0"}],["path",{d:"M9 22v-8",key:"fmnu31"}],["path",{d:"M9 2v4",key:"j1yeou"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mQ=q("Table",[["path",{d:"M12 3v18",key:"108xh3"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gQ=q("TabletSmartphone",[["rect",{width:"10",height:"14",x:"3",y:"8",rx:"2",key:"1vrsiq"}],["path",{d:"M5 4a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v16a2 2 0 0 1-2 2h-2.4",key:"1j4zmg"}],["path",{d:"M8 18h.01",key:"lrp35t"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xQ=q("Tablet",[["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",ry:"2",key:"76otgf"}],["line",{x1:"12",x2:"12.01",y1:"18",y2:"18",key:"1dp563"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yQ=q("Tablets",[["circle",{cx:"7",cy:"7",r:"5",key:"x29byf"}],["circle",{cx:"17",cy:"17",r:"5",key:"1op1d2"}],["path",{d:"M12 17h10",key:"ls21zv"}],["path",{d:"m3.46 10.54 7.08-7.08",key:"1rehiu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zg=q("Tag",[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vQ=q("Tags",[["path",{d:"m15 5 6.3 6.3a2.4 2.4 0 0 1 0 3.4L17 19",key:"1cbfv1"}],["path",{d:"M9.586 5.586A2 2 0 0 0 8.172 5H3a1 1 0 0 0-1 1v5.172a2 2 0 0 0 .586 1.414L8.29 18.29a2.426 2.426 0 0 0 3.42 0l3.58-3.58a2.426 2.426 0 0 0 0-3.42z",key:"135mg7"}],["circle",{cx:"6.5",cy:"9.5",r:".5",fill:"currentColor",key:"5pm5xn"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _Q=q("Tally1",[["path",{d:"M4 4v16",key:"6qkkli"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bQ=q("Tally2",[["path",{d:"M4 4v16",key:"6qkkli"}],["path",{d:"M9 4v16",key:"81ygyz"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wQ=q("Tally3",[["path",{d:"M4 4v16",key:"6qkkli"}],["path",{d:"M9 4v16",key:"81ygyz"}],["path",{d:"M14 4v16",key:"12vmem"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jQ=q("Tally4",[["path",{d:"M4 4v16",key:"6qkkli"}],["path",{d:"M9 4v16",key:"81ygyz"}],["path",{d:"M14 4v16",key:"12vmem"}],["path",{d:"M19 4v16",key:"8ij5ei"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kQ=q("Tally5",[["path",{d:"M4 4v16",key:"6qkkli"}],["path",{d:"M9 4v16",key:"81ygyz"}],["path",{d:"M14 4v16",key:"12vmem"}],["path",{d:"M19 4v16",key:"8ij5ei"}],["path",{d:"M22 6 2 18",key:"h9moai"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const NQ=q("Tangent",[["circle",{cx:"17",cy:"4",r:"2",key:"y5j2s2"}],["path",{d:"M15.59 5.41 5.41 15.59",key:"l0vprr"}],["circle",{cx:"4",cy:"17",r:"2",key:"9p4efm"}],["path",{d:"M12 22s-4-9-1.5-11.5S22 12 22 12",key:"1twk4o"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const my=q("Target",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"6",key:"1vlfrh"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const SQ=q("Telescope",[["path",{d:"m10.065 12.493-6.18 1.318a.934.934 0 0 1-1.108-.702l-.537-2.15a1.07 1.07 0 0 1 .691-1.265l13.504-4.44",key:"k4qptu"}],["path",{d:"m13.56 11.747 4.332-.924",key:"19l80z"}],["path",{d:"m16 21-3.105-6.21",key:"7oh9d"}],["path",{d:"M16.485 5.94a2 2 0 0 1 1.455-2.425l1.09-.272a1 1 0 0 1 1.212.727l1.515 6.06a1 1 0 0 1-.727 1.213l-1.09.272a2 2 0 0 1-2.425-1.455z",key:"m7xp4m"}],["path",{d:"m6.158 8.633 1.114 4.456",key:"74o979"}],["path",{d:"m8 21 3.105-6.21",key:"1fvxut"}],["circle",{cx:"12",cy:"13",r:"2",key:"1c1ljs"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const CQ=q("TentTree",[["circle",{cx:"4",cy:"4",r:"2",key:"bt5ra8"}],["path",{d:"m14 5 3-3 3 3",key:"1sorif"}],["path",{d:"m14 10 3-3 3 3",key:"1jyi9h"}],["path",{d:"M17 14V2",key:"8ymqnk"}],["path",{d:"M17 14H7l-5 8h20Z",key:"13ar7p"}],["path",{d:"M8 14v8",key:"1ghmqk"}],["path",{d:"m9 14 5 8",key:"13pgi6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const MQ=q("Tent",[["path",{d:"M3.5 21 14 3",key:"1szst5"}],["path",{d:"M20.5 21 10 3",key:"1310c3"}],["path",{d:"M15.5 21 12 15l-3.5 6",key:"1ddtfw"}],["path",{d:"M2 21h20",key:"1nyx9w"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const TQ=q("Terminal",[["polyline",{points:"4 17 10 11 4 5",key:"akl6gq"}],["line",{x1:"12",x2:"20",y1:"19",y2:"19",key:"q2wloq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Cw=q("TestTubeDiagonal",[["path",{d:"M21 7 6.82 21.18a2.83 2.83 0 0 1-3.99-.01a2.83 2.83 0 0 1 0-4L17 3",key:"1ub6xw"}],["path",{d:"m16 2 6 6",key:"1gw87d"}],["path",{d:"M12 16H4",key:"1cjfip"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const AQ=q("TestTube",[["path",{d:"M14.5 2v17.5c0 1.4-1.1 2.5-2.5 2.5c-1.4 0-2.5-1.1-2.5-2.5V2",key:"125lnx"}],["path",{d:"M8.5 2h7",key:"csnxdl"}],["path",{d:"M14.5 16h-5",key:"1ox875"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const EQ=q("TestTubes",[["path",{d:"M9 2v17.5A2.5 2.5 0 0 1 6.5 22A2.5 2.5 0 0 1 4 19.5V2",key:"1hjrqt"}],["path",{d:"M20 2v17.5a2.5 2.5 0 0 1-2.5 2.5a2.5 2.5 0 0 1-2.5-2.5V2",key:"16lc8n"}],["path",{d:"M3 2h7",key:"7s29d5"}],["path",{d:"M14 2h7",key:"7sicin"}],["path",{d:"M9 16H4",key:"1bfye3"}],["path",{d:"M20 16h-5",key:"ddnjpe"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const IQ=q("TextCursorInput",[["path",{d:"M5 4h1a3 3 0 0 1 3 3 3 3 0 0 1 3-3h1",key:"18xjzo"}],["path",{d:"M13 20h-1a3 3 0 0 1-3-3 3 3 0 0 1-3 3H5",key:"fj48gi"}],["path",{d:"M5 16H4a2 2 0 0 1-2-2v-4a2 2 0 0 1 2-2h1",key:"1n9rhb"}],["path",{d:"M13 8h7a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2h-7",key:"13ksps"}],["path",{d:"M9 7v10",key:"1vc8ob"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const PQ=q("TextCursor",[["path",{d:"M17 22h-1a4 4 0 0 1-4-4V6a4 4 0 0 1 4-4h1",key:"uvaxm9"}],["path",{d:"M7 22h1a4 4 0 0 0 4-4v-1",key:"11xy8d"}],["path",{d:"M7 2h1a4 4 0 0 1 4 4v1",key:"1uw06m"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const LQ=q("TextQuote",[["path",{d:"M17 6H3",key:"16j9eg"}],["path",{d:"M21 12H8",key:"scolzb"}],["path",{d:"M21 18H8",key:"1wfozv"}],["path",{d:"M3 12v6",key:"fv4c87"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const OQ=q("TextSearch",[["path",{d:"M21 6H3",key:"1jwq7v"}],["path",{d:"M10 12H3",key:"1ulcyk"}],["path",{d:"M10 18H3",key:"13769t"}],["circle",{cx:"17",cy:"15",r:"3",key:"1upz2a"}],["path",{d:"m21 19-1.9-1.9",key:"dwi7p8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Mw=q("TextSelect",[["path",{d:"M5 3a2 2 0 0 0-2 2",key:"y57alp"}],["path",{d:"M19 3a2 2 0 0 1 2 2",key:"18rm91"}],["path",{d:"M21 19a2 2 0 0 1-2 2",key:"1j7049"}],["path",{d:"M5 21a2 2 0 0 1-2-2",key:"sbafld"}],["path",{d:"M9 3h1",key:"1yesri"}],["path",{d:"M9 21h1",key:"15o7lz"}],["path",{d:"M14 3h1",key:"1ec4yj"}],["path",{d:"M14 21h1",key:"v9vybs"}],["path",{d:"M3 9v1",key:"1r0deq"}],["path",{d:"M21 9v1",key:"mxsmne"}],["path",{d:"M3 14v1",key:"vnatye"}],["path",{d:"M21 14v1",key:"169vum"}],["line",{x1:"7",x2:"15",y1:"8",y2:"8",key:"1758g8"}],["line",{x1:"7",x2:"17",y1:"12",y2:"12",key:"197423"}],["line",{x1:"7",x2:"13",y1:"16",y2:"16",key:"37cgm6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const DQ=q("Text",[["path",{d:"M17 6.1H3",key:"wptmhv"}],["path",{d:"M21 12.1H3",key:"1j38uz"}],["path",{d:"M15.1 18H3",key:"1nb16a"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const RQ=q("Theater",[["path",{d:"M2 10s3-3 3-8",key:"3xiif0"}],["path",{d:"M22 10s-3-3-3-8",key:"ioaa5q"}],["path",{d:"M10 2c0 4.4-3.6 8-8 8",key:"16fkpi"}],["path",{d:"M14 2c0 4.4 3.6 8 8 8",key:"b9eulq"}],["path",{d:"M2 10s2 2 2 5",key:"1au1lb"}],["path",{d:"M22 10s-2 2-2 5",key:"qi2y5e"}],["path",{d:"M8 15h8",key:"45n4r"}],["path",{d:"M2 22v-1a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v1",key:"1vsc2m"}],["path",{d:"M14 22v-1a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v1",key:"hrha4u"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const FQ=q("ThermometerSnowflake",[["path",{d:"M2 12h10",key:"19562f"}],["path",{d:"M9 4v16",key:"81ygyz"}],["path",{d:"m3 9 3 3-3 3",key:"1sas0l"}],["path",{d:"M12 6 9 9 6 6",key:"pfrgxu"}],["path",{d:"m6 18 3-3 1.5 1.5",key:"1e277p"}],["path",{d:"M20 4v10.54a4 4 0 1 1-4 0V4a2 2 0 0 1 4 0Z",key:"iof6y5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zQ=q("ThermometerSun",[["path",{d:"M12 9a4 4 0 0 0-2 7.5",key:"1jvsq6"}],["path",{d:"M12 3v2",key:"1w22ol"}],["path",{d:"m6.6 18.4-1.4 1.4",key:"w2yidj"}],["path",{d:"M20 4v10.54a4 4 0 1 1-4 0V4a2 2 0 0 1 4 0Z",key:"iof6y5"}],["path",{d:"M4 13H2",key:"118le4"}],["path",{d:"M6.34 7.34 4.93 5.93",key:"1brd51"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const BQ=q("Thermometer",[["path",{d:"M14 4v10.54a4 4 0 1 1-4 0V4a2 2 0 0 1 4 0Z",key:"17jzev"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kA=q("ThumbsDown",[["path",{d:"M17 14V2",key:"8ymqnk"}],["path",{d:"M9 18.12 10 14H4.17a2 2 0 0 1-1.92-2.56l2.33-8A2 2 0 0 1 6.5 2H20a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-2.76a2 2 0 0 0-1.79 1.11L12 22a3.13 3.13 0 0 1-3-3.88Z",key:"m61m77"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zd=q("ThumbsUp",[["path",{d:"M7 10v12",key:"1qc93n"}],["path",{d:"M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z",key:"emmmcr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $Q=q("TicketCheck",[["path",{d:"M2 9a3 3 0 0 1 0 6v2a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-2a3 3 0 0 1 0-6V7a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2Z",key:"qn84l0"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const UQ=q("TicketMinus",[["path",{d:"M2 9a3 3 0 0 1 0 6v2a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-2a3 3 0 0 1 0-6V7a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2Z",key:"qn84l0"}],["path",{d:"M9 12h6",key:"1c52cq"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qQ=q("TicketPercent",[["path",{d:"M2 9a3 3 0 1 1 0 6v2a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-2a3 3 0 1 1 0-6V7a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2Z",key:"1l48ns"}],["path",{d:"M9 9h.01",key:"1q5me6"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"M15 15h.01",key:"lqbp3k"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const VQ=q("TicketPlus",[["path",{d:"M2 9a3 3 0 0 1 0 6v2a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-2a3 3 0 0 1 0-6V7a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2Z",key:"qn84l0"}],["path",{d:"M9 12h6",key:"1c52cq"}],["path",{d:"M12 9v6",key:"199k2o"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const HQ=q("TicketSlash",[["path",{d:"M2 9a3 3 0 0 1 0 6v2a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-2a3 3 0 0 1 0-6V7a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2Z",key:"qn84l0"}],["path",{d:"m9.5 14.5 5-5",key:"qviqfa"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const WQ=q("TicketX",[["path",{d:"M2 9a3 3 0 0 1 0 6v2a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-2a3 3 0 0 1 0-6V7a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2Z",key:"qn84l0"}],["path",{d:"m9.5 14.5 5-5",key:"qviqfa"}],["path",{d:"m9.5 9.5 5 5",key:"18nt4w"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const NA=q("Ticket",[["path",{d:"M2 9a3 3 0 0 1 0 6v2a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-2a3 3 0 0 1 0-6V7a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2Z",key:"qn84l0"}],["path",{d:"M13 5v2",key:"dyzc3o"}],["path",{d:"M13 17v2",key:"1ont0d"}],["path",{d:"M13 11v2",key:"1wjjxi"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const GQ=q("TicketsPlane",[["path",{d:"M10.5 17h1.227a2 2 0 0 0 1.345-.52L18 12",key:"16muxl"}],["path",{d:"m12 13.5 3.75.5",key:"1i9qhk"}],["path",{d:"m4.5 8 10.58-5.06a1 1 0 0 1 1.342.488L18.5 8",key:"12lg5p"}],["path",{d:"M6 10V8",key:"1y41hn"}],["path",{d:"M6 14v1",key:"cao2tf"}],["path",{d:"M6 19v2",key:"1loha6"}],["rect",{x:"2",y:"8",width:"20",height:"13",rx:"2",key:"p3bz5l"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const KQ=q("Tickets",[["path",{d:"m4.5 8 10.58-5.06a1 1 0 0 1 1.342.488L18.5 8",key:"12lg5p"}],["path",{d:"M6 10V8",key:"1y41hn"}],["path",{d:"M6 14v1",key:"cao2tf"}],["path",{d:"M6 19v2",key:"1loha6"}],["rect",{x:"2",y:"8",width:"20",height:"13",rx:"2",key:"p3bz5l"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ZQ=q("TimerOff",[["path",{d:"M10 2h4",key:"n1abiw"}],["path",{d:"M4.6 11a8 8 0 0 0 1.7 8.7 8 8 0 0 0 8.7 1.7",key:"10he05"}],["path",{d:"M7.4 7.4a8 8 0 0 1 10.3 1 8 8 0 0 1 .9 10.2",key:"15f7sh"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M12 12v-2",key:"fwoke6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const YQ=q("TimerReset",[["path",{d:"M10 2h4",key:"n1abiw"}],["path",{d:"M12 14v-4",key:"1evpnu"}],["path",{d:"M4 13a8 8 0 0 1 8-7 8 8 0 1 1-5.3 14L4 17.6",key:"1ts96g"}],["path",{d:"M9 17H4v5",key:"8t5av"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const XQ=q("Timer",[["line",{x1:"10",x2:"14",y1:"2",y2:"2",key:"14vaq8"}],["line",{x1:"12",x2:"15",y1:"14",y2:"11",key:"17fdiu"}],["circle",{cx:"12",cy:"14",r:"8",key:"1e1u0o"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const QQ=q("ToggleLeft",[["rect",{width:"20",height:"12",x:"2",y:"6",rx:"6",ry:"6",key:"f2vt7d"}],["circle",{cx:"8",cy:"12",r:"2",key:"1nvbw3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const JQ=q("ToggleRight",[["rect",{width:"20",height:"12",x:"2",y:"6",rx:"6",ry:"6",key:"f2vt7d"}],["circle",{cx:"16",cy:"12",r:"2",key:"4ma0v8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const eJ=q("Toilet",[["path",{d:"M7 12h13a1 1 0 0 1 1 1 5 5 0 0 1-5 5h-.598a.5.5 0 0 0-.424.765l1.544 2.47a.5.5 0 0 1-.424.765H5.402a.5.5 0 0 1-.424-.765L7 18",key:"kc4kqr"}],["path",{d:"M8 18a5 5 0 0 1-5-5V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v8",key:"1tqs57"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tJ=q("Tornado",[["path",{d:"M21 4H3",key:"1hwok0"}],["path",{d:"M18 8H6",key:"41n648"}],["path",{d:"M19 12H9",key:"1g4lpz"}],["path",{d:"M16 16h-6",key:"1j5d54"}],["path",{d:"M11 20H9",key:"39obr8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rJ=q("Torus",[["ellipse",{cx:"12",cy:"11",rx:"3",ry:"2",key:"1b2qxu"}],["ellipse",{cx:"12",cy:"12.5",rx:"10",ry:"8.5",key:"h8emeu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nJ=q("TouchpadOff",[["path",{d:"M4 4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h16",key:"lnt0bk"}],["path",{d:"M2 14h12",key:"d8icqz"}],["path",{d:"M22 14h-2",key:"jrx26d"}],["path",{d:"M12 20v-6",key:"1rm09r"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M22 16V6a2 2 0 0 0-2-2H10",key:"11y8e4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const sJ=q("Touchpad",[["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["path",{d:"M2 14h20",key:"myj16y"}],["path",{d:"M12 20v-6",key:"1rm09r"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const aJ=q("TowerControl",[["path",{d:"M18.2 12.27 20 6H4l1.8 6.27a1 1 0 0 0 .95.73h10.5a1 1 0 0 0 .96-.73Z",key:"1pledb"}],["path",{d:"M8 13v9",key:"hmv0ci"}],["path",{d:"M16 22v-9",key:"ylnf1u"}],["path",{d:"m9 6 1 7",key:"dpdgam"}],["path",{d:"m15 6-1 7",key:"ls7zgu"}],["path",{d:"M12 6V2",key:"1pj48d"}],["path",{d:"M13 2h-2",key:"mj6ths"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const iJ=q("ToyBrick",[["rect",{width:"18",height:"12",x:"3",y:"8",rx:"1",key:"158fvp"}],["path",{d:"M10 8V5c0-.6-.4-1-1-1H6a1 1 0 0 0-1 1v3",key:"s0042v"}],["path",{d:"M19 8V5c0-.6-.4-1-1-1h-3a1 1 0 0 0-1 1v3",key:"9wmeh2"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oJ=q("Tractor",[["path",{d:"m10 11 11 .9a1 1 0 0 1 .8 1.1l-.665 4.158a1 1 0 0 1-.988.842H20",key:"she1j9"}],["path",{d:"M16 18h-5",key:"bq60fd"}],["path",{d:"M18 5a1 1 0 0 0-1 1v5.573",key:"1kv8ia"}],["path",{d:"M3 4h8.129a1 1 0 0 1 .99.863L13 11.246",key:"1q1ert"}],["path",{d:"M4 11V4",key:"9ft8pt"}],["path",{d:"M7 15h.01",key:"k5ht0j"}],["path",{d:"M8 10.1V4",key:"1jgyzo"}],["circle",{cx:"18",cy:"18",r:"2",key:"1emm8v"}],["circle",{cx:"7",cy:"15",r:"5",key:"ddtuc"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lJ=q("TrafficCone",[["path",{d:"M9.3 6.2a4.55 4.55 0 0 0 5.4 0",key:"flyxqv"}],["path",{d:"M7.9 10.7c.9.8 2.4 1.3 4.1 1.3s3.2-.5 4.1-1.3",key:"1nlxxg"}],["path",{d:"M13.9 3.5a1.93 1.93 0 0 0-3.8-.1l-3 10c-.1.2-.1.4-.1.6 0 1.7 2.2 3 5 3s5-1.3 5-3c0-.2 0-.4-.1-.5Z",key:"vz7x1l"}],["path",{d:"m7.5 12.2-4.7 2.7c-.5.3-.8.7-.8 1.1s.3.8.8 1.1l7.6 4.5c.9.5 2.1.5 3 0l7.6-4.5c.7-.3 1-.7 1-1.1s-.3-.8-.8-1.1l-4.7-2.8",key:"1xfzlw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cJ=q("TrainFrontTunnel",[["path",{d:"M2 22V12a10 10 0 1 1 20 0v10",key:"o0fyp0"}],["path",{d:"M15 6.8v1.4a3 2.8 0 1 1-6 0V6.8",key:"m8q3n9"}],["path",{d:"M10 15h.01",key:"44in9x"}],["path",{d:"M14 15h.01",key:"5mohn5"}],["path",{d:"M10 19a4 4 0 0 1-4-4v-3a6 6 0 1 1 12 0v3a4 4 0 0 1-4 4Z",key:"hckbmu"}],["path",{d:"m9 19-2 3",key:"iij7hm"}],["path",{d:"m15 19 2 3",key:"npx8sa"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dJ=q("TrainFront",[["path",{d:"M8 3.1V7a4 4 0 0 0 8 0V3.1",key:"1v71zp"}],["path",{d:"m9 15-1-1",key:"1yrq24"}],["path",{d:"m15 15 1-1",key:"1t0d6s"}],["path",{d:"M9 19c-2.8 0-5-2.2-5-5v-4a8 8 0 0 1 16 0v4c0 2.8-2.2 5-5 5Z",key:"1p0hjs"}],["path",{d:"m8 19-2 3",key:"13i0xs"}],["path",{d:"m16 19 2 3",key:"xo31yx"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uJ=q("TrainTrack",[["path",{d:"M2 17 17 2",key:"18b09t"}],["path",{d:"m2 14 8 8",key:"1gv9hu"}],["path",{d:"m5 11 8 8",key:"189pqp"}],["path",{d:"m8 8 8 8",key:"1imecy"}],["path",{d:"m11 5 8 8",key:"ummqn6"}],["path",{d:"m14 2 8 8",key:"1vk7dn"}],["path",{d:"M7 22 22 7",key:"15mb1i"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Tw=q("TramFront",[["rect",{width:"16",height:"16",x:"4",y:"3",rx:"2",key:"1wxw4b"}],["path",{d:"M4 11h16",key:"mpoxn0"}],["path",{d:"M12 3v8",key:"1h2ygw"}],["path",{d:"m8 19-2 3",key:"13i0xs"}],["path",{d:"m18 22-2-3",key:"1p0ohu"}],["path",{d:"M8 15h.01",key:"a7atzg"}],["path",{d:"M16 15h.01",key:"rnfrdf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Bn=q("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hJ=q("Trash",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fJ=q("TreeDeciduous",[["path",{d:"M8 19a4 4 0 0 1-2.24-7.32A3.5 3.5 0 0 1 9 6.03V6a3 3 0 1 1 6 0v.04a3.5 3.5 0 0 1 3.24 5.65A4 4 0 0 1 16 19Z",key:"oadzkq"}],["path",{d:"M12 19v3",key:"npa21l"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Aw=q("TreePalm",[["path",{d:"M13 8c0-2.76-2.46-5-5.5-5S2 5.24 2 8h2l1-1 1 1h4",key:"foxbe7"}],["path",{d:"M13 7.14A5.82 5.82 0 0 1 16.5 6c3.04 0 5.5 2.24 5.5 5h-3l-1-1-1 1h-3",key:"18arnh"}],["path",{d:"M5.89 9.71c-2.15 2.15-2.3 5.47-.35 7.43l4.24-4.25.7-.7.71-.71 2.12-2.12c-1.95-1.96-5.27-1.8-7.42.35",key:"ywahnh"}],["path",{d:"M11 15.5c.5 2.5-.17 4.5-1 6.5h4c2-5.5-.5-12-1-14",key:"ft0feo"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Y1=q("TreePine",[["path",{d:"m17 14 3 3.3a1 1 0 0 1-.7 1.7H4.7a1 1 0 0 1-.7-1.7L7 14h-.3a1 1 0 0 1-.7-1.7L9 9h-.2A1 1 0 0 1 8 7.3L12 3l4 4.3a1 1 0 0 1-.8 1.7H15l3 3.3a1 1 0 0 1-.7 1.7H17Z",key:"cpyugq"}],["path",{d:"M12 22v-3",key:"kmzjlo"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pJ=q("Trees",[["path",{d:"M10 10v.2A3 3 0 0 1 8.9 16H5a3 3 0 0 1-1-5.8V10a3 3 0 0 1 6 0Z",key:"1l6gj6"}],["path",{d:"M7 16v6",key:"1a82de"}],["path",{d:"M13 19v3",key:"13sx9i"}],["path",{d:"M12 19h8.3a1 1 0 0 0 .7-1.7L18 14h.3a1 1 0 0 0 .7-1.7L16 9h.2a1 1 0 0 0 .8-1.7L13 3l-1.4 1.5",key:"1sj9kv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mJ=q("Trello",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["rect",{width:"3",height:"9",x:"7",y:"7",key:"14n3xi"}],["rect",{width:"3",height:"5",x:"14",y:"7",key:"s4azjd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $j=q("TrendingDown",[["polyline",{points:"22 17 13.5 8.5 8.5 13.5 2 7",key:"1r2t7k"}],["polyline",{points:"16 17 22 17 22 11",key:"11uiuu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gJ=q("TrendingUpDown",[["path",{d:"M14.828 14.828 21 21",key:"ar5fw7"}],["path",{d:"M21 16v5h-5",key:"1ck2sf"}],["path",{d:"m21 3-9 9-4-4-6 6",key:"1h02xo"}],["path",{d:"M21 8V3h-5",key:"1qoq8a"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fp=q("TrendingUp",[["polyline",{points:"22 7 13.5 15.5 8.5 10.5 2 17",key:"126l90"}],["polyline",{points:"16 7 22 7 22 13",key:"kwv8wd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const rf=q("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xJ=q("TriangleRight",[["path",{d:"M22 18a2 2 0 0 1-2 2H3c-1.1 0-1.3-.6-.4-1.3L20.4 4.3c.9-.7 1.6-.4 1.6.7Z",key:"183wce"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yJ=q("Triangle",[["path",{d:"M13.73 4a2 2 0 0 0-3.46 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z",key:"14u9p9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ro=q("Trophy",[["path",{d:"M6 9H4.5a2.5 2.5 0 0 1 0-5H6",key:"17hqa7"}],["path",{d:"M18 9h1.5a2.5 2.5 0 0 0 0-5H18",key:"lmptdp"}],["path",{d:"M4 22h16",key:"57wxv0"}],["path",{d:"M10 14.66V17c0 .55-.47.98-.97 1.21C7.85 18.75 7 20.24 7 22",key:"1nw9bq"}],["path",{d:"M14 14.66V17c0 .55.47.98.97 1.21C16.15 18.75 17 20.24 17 22",key:"1np0yb"}],["path",{d:"M18 2H6v7a6 6 0 0 0 12 0V2Z",key:"u46fv3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const SA=q("Truck",[["path",{d:"M14 18V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v11a1 1 0 0 0 1 1h2",key:"wrbu53"}],["path",{d:"M15 18H9",key:"1lyqi6"}],["path",{d:"M19 18h2a1 1 0 0 0 1-1v-3.65a1 1 0 0 0-.22-.624l-3.48-4.35A1 1 0 0 0 17.52 8H14",key:"lysw3i"}],["circle",{cx:"17",cy:"18",r:"2",key:"332jqn"}],["circle",{cx:"7",cy:"18",r:"2",key:"19iecd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vJ=q("Turtle",[["path",{d:"m12 10 2 4v3a1 1 0 0 0 1 1h2a1 1 0 0 0 1-1v-3a8 8 0 1 0-16 0v3a1 1 0 0 0 1 1h2a1 1 0 0 0 1-1v-3l2-4h4Z",key:"1lbbv7"}],["path",{d:"M4.82 7.9 8 10",key:"m9wose"}],["path",{d:"M15.18 7.9 12 10",key:"p8dp2u"}],["path",{d:"M16.93 10H20a2 2 0 0 1 0 4H2",key:"12nsm7"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _J=q("TvMinimalPlay",[["path",{d:"M10 7.75a.75.75 0 0 1 1.142-.638l3.664 2.249a.75.75 0 0 1 0 1.278l-3.664 2.25a.75.75 0 0 1-1.142-.64z",key:"1pctta"}],["path",{d:"M7 21h10",key:"1b0cd5"}],["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ew=q("TvMinimal",[["path",{d:"M7 21h10",key:"1b0cd5"}],["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bJ=q("Tv",[["rect",{width:"20",height:"15",x:"2",y:"7",rx:"2",ry:"2",key:"10ag99"}],["polyline",{points:"17 2 12 7 7 2",key:"11pgbg"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wJ=q("Twitch",[["path",{d:"M21 2H3v16h5v4l4-4h5l4-4V2zm-10 9V7m5 4V7",key:"c0yzno"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jJ=q("Twitter",[["path",{d:"M22 4s-.7 2.1-2 3.4c1.6 10-9.4 17.3-18 11.6 2.2.1 4.4-.6 6-2C3 15.5.5 9.6 3 5c2.2 2.6 5.6 4.1 9 4-.9-4.2 4-6.6 7-3.8 1.1 0 3-1.2 3-1.2z",key:"pff0z6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kJ=q("TypeOutline",[["path",{d:"M14 16.5a.5.5 0 0 0 .5.5h.5a2 2 0 0 1 0 4H9a2 2 0 0 1 0-4h.5a.5.5 0 0 0 .5-.5v-9a.5.5 0 0 0-.5-.5h-3a.5.5 0 0 0-.5.5V8a2 2 0 0 1-4 0V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v3a2 2 0 0 1-4 0v-.5a.5.5 0 0 0-.5-.5h-3a.5.5 0 0 0-.5.5Z",key:"1reda3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const NJ=q("Type",[["polyline",{points:"4 7 4 4 20 4 20 7",key:"1nosan"}],["line",{x1:"9",x2:"15",y1:"20",y2:"20",key:"swin9y"}],["line",{x1:"12",x2:"12",y1:"4",y2:"20",key:"1tx1rr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const SJ=q("UmbrellaOff",[["path",{d:"M12 2v1",key:"11qlp1"}],["path",{d:"M15.5 21a1.85 1.85 0 0 1-3.5-1v-8H2a10 10 0 0 1 3.428-6.575",key:"eki10q"}],["path",{d:"M17.5 12H22A10 10 0 0 0 9.004 3.455",key:"n2ayka"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const CJ=q("Umbrella",[["path",{d:"M22 12a10.06 10.06 1 0 0-20 0Z",key:"1teyop"}],["path",{d:"M12 12v8a2 2 0 0 0 4 0",key:"ulpmoc"}],["path",{d:"M12 2v1",key:"11qlp1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const MJ=q("Underline",[["path",{d:"M6 4v6a6 6 0 0 0 12 0V4",key:"9kb039"}],["line",{x1:"4",x2:"20",y1:"20",y2:"20",key:"nun2al"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const TJ=q("Undo2",[["path",{d:"M9 14 4 9l5-5",key:"102s5s"}],["path",{d:"M4 9h10.5a5.5 5.5 0 0 1 5.5 5.5a5.5 5.5 0 0 1-5.5 5.5H11",key:"f3b9sd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const AJ=q("UndoDot",[["path",{d:"M21 17a9 9 0 0 0-15-6.7L3 13",key:"8mp6z9"}],["path",{d:"M3 7v6h6",key:"1v2h90"}],["circle",{cx:"12",cy:"17",r:"1",key:"1ixnty"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const DS=q("Undo",[["path",{d:"M3 7v6h6",key:"1v2h90"}],["path",{d:"M21 17a9 9 0 0 0-9-9 9 9 0 0 0-6 2.3L3 13",key:"1r6uu6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const EJ=q("UnfoldHorizontal",[["path",{d:"M16 12h6",key:"15xry1"}],["path",{d:"M8 12H2",key:"1jqql6"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 8v2",key:"1woqiv"}],["path",{d:"M12 14v2",key:"8jcxud"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m19 15 3-3-3-3",key:"wjy7rq"}],["path",{d:"m5 9-3 3 3 3",key:"j64kie"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const IJ=q("UnfoldVertical",[["path",{d:"M12 22v-6",key:"6o8u61"}],["path",{d:"M12 8V2",key:"1wkif3"}],["path",{d:"M4 12H2",key:"rhcxmi"}],["path",{d:"M10 12H8",key:"s88cx1"}],["path",{d:"M16 12h-2",key:"10asgb"}],["path",{d:"M22 12h-2",key:"14jgyd"}],["path",{d:"m15 19-3 3-3-3",key:"11eu04"}],["path",{d:"m15 5-3-3-3 3",key:"itvq4r"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const PJ=q("Ungroup",[["rect",{width:"8",height:"6",x:"5",y:"4",rx:"1",key:"nzclkv"}],["rect",{width:"8",height:"6",x:"11",y:"14",rx:"1",key:"4tytwb"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Iw=q("University",[["circle",{cx:"12",cy:"10",r:"1",key:"1gnqs8"}],["path",{d:"M22 20V8h-4l-6-4-6 4H2v12a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2",key:"1qj5sn"}],["path",{d:"M6 17v.01",key:"roodi6"}],["path",{d:"M6 13v.01",key:"67c122"}],["path",{d:"M18 17v.01",key:"12ktxm"}],["path",{d:"M18 13v.01",key:"tn1rt1"}],["path",{d:"M14 22v-5a2 2 0 0 0-2-2a2 2 0 0 0-2 2v5",key:"11g7fi"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const LJ=q("Unlink2",[["path",{d:"M15 7h2a5 5 0 0 1 0 10h-2m-6 0H7A5 5 0 0 1 7 7h2",key:"1re2ne"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const CA=q("Unlink",[["path",{d:"m18.84 12.25 1.72-1.71h-.02a5.004 5.004 0 0 0-.12-7.07 5.006 5.006 0 0 0-6.95 0l-1.72 1.71",key:"yqzxt4"}],["path",{d:"m5.17 11.75-1.71 1.71a5.004 5.004 0 0 0 .12 7.07 5.006 5.006 0 0 0 6.95 0l1.71-1.71",key:"4qinb0"}],["line",{x1:"8",x2:"8",y1:"2",y2:"5",key:"1041cp"}],["line",{x1:"2",x2:"5",y1:"8",y2:"8",key:"14m1p5"}],["line",{x1:"16",x2:"16",y1:"19",y2:"22",key:"rzdirn"}],["line",{x1:"19",x2:"22",y1:"16",y2:"16",key:"ox905f"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const OJ=q("Unplug",[["path",{d:"m19 5 3-3",key:"yk6iyv"}],["path",{d:"m2 22 3-3",key:"19mgm9"}],["path",{d:"M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z",key:"goz73y"}],["path",{d:"M7.5 13.5 10 11",key:"7xgeeb"}],["path",{d:"M10.5 16.5 13 14",key:"10btkg"}],["path",{d:"m12 6 6 6 2.3-2.3a2.4 2.4 0 0 0 0-3.4l-2.6-2.6a2.4 2.4 0 0 0-3.4 0Z",key:"1snsnr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _o=q("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const DJ=q("Usb",[["circle",{cx:"10",cy:"7",r:"1",key:"dypaad"}],["circle",{cx:"4",cy:"20",r:"1",key:"22iqad"}],["path",{d:"M4.7 19.3 19 5",key:"1enqfc"}],["path",{d:"m21 3-3 1 2 2Z",key:"d3ov82"}],["path",{d:"M9.26 7.68 5 12l2 5",key:"1esawj"}],["path",{d:"m10 14 5 2 3.5-3.5",key:"v8oal5"}],["path",{d:"m18 12 1-1 1 1-1 1Z",key:"1bh22v"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Uj=q("UserCheck",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["polyline",{points:"16 11 18 13 22 9",key:"1pwet4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const MA=q("UserCog",[["circle",{cx:"18",cy:"15",r:"3",key:"gjjjvw"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M10 15H6a4 4 0 0 0-4 4v2",key:"1nfge6"}],["path",{d:"m21.7 16.4-.9-.3",key:"12j9ji"}],["path",{d:"m15.2 13.9-.9-.3",key:"1fdjdi"}],["path",{d:"m16.6 18.7.3-.9",key:"heedtr"}],["path",{d:"m19.1 12.2.3-.9",key:"1af3ki"}],["path",{d:"m19.6 18.7-.4-1",key:"1x9vze"}],["path",{d:"m16.8 12.3-.4-1",key:"vqeiwj"}],["path",{d:"m14.3 16.6 1-.4",key:"1qlj63"}],["path",{d:"m20.7 13.8 1-.4",key:"1v5t8k"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const RJ=q("UserMinus",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const FJ=q("UserPen",[["path",{d:"M11.5 15H7a4 4 0 0 0-4 4v2",key:"15lzij"}],["path",{d:"M21.378 16.626a1 1 0 0 0-3.004-3.004l-4.01 4.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z",key:"1817ys"}],["circle",{cx:"10",cy:"7",r:"4",key:"e45bow"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vf=q("UserPlus",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Pw=q("UserRoundCheck",[["path",{d:"M2 21a8 8 0 0 1 13.292-6",key:"bjp14o"}],["circle",{cx:"10",cy:"8",r:"5",key:"o932ke"}],["path",{d:"m16 19 2 2 4-4",key:"1b14m6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Lw=q("UserRoundCog",[["path",{d:"M2 21a8 8 0 0 1 10.434-7.62",key:"1yezr2"}],["circle",{cx:"10",cy:"8",r:"5",key:"o932ke"}],["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["path",{d:"m19.5 14.3-.4.9",key:"1eb35c"}],["path",{d:"m16.9 20.8-.4.9",key:"dfjc4z"}],["path",{d:"m21.7 19.5-.9-.4",key:"q4dx6b"}],["path",{d:"m15.2 16.9-.9-.4",key:"1r0w5f"}],["path",{d:"m21.7 16.5-.9.4",key:"1knoei"}],["path",{d:"m15.2 19.1-.9.4",key:"j188fs"}],["path",{d:"m19.5 21.7-.4-.9",key:"1tonu5"}],["path",{d:"m16.9 15.2-.4-.9",key:"699xu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Ow=q("UserRoundMinus",[["path",{d:"M2 21a8 8 0 0 1 13.292-6",key:"bjp14o"}],["circle",{cx:"10",cy:"8",r:"5",key:"o932ke"}],["path",{d:"M22 19h-6",key:"vcuq98"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zJ=q("UserRoundPen",[["path",{d:"M2 21a8 8 0 0 1 10.821-7.487",key:"1c8h7z"}],["path",{d:"M21.378 16.626a1 1 0 0 0-3.004-3.004l-4.01 4.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z",key:"1817ys"}],["circle",{cx:"10",cy:"8",r:"5",key:"o932ke"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Dw=q("UserRoundPlus",[["path",{d:"M2 21a8 8 0 0 1 13.292-6",key:"bjp14o"}],["circle",{cx:"10",cy:"8",r:"5",key:"o932ke"}],["path",{d:"M19 16v6",key:"tddt3s"}],["path",{d:"M22 19h-6",key:"vcuq98"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const BJ=q("UserRoundSearch",[["circle",{cx:"10",cy:"8",r:"5",key:"o932ke"}],["path",{d:"M2 21a8 8 0 0 1 10.434-7.62",key:"1yezr2"}],["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["path",{d:"m22 22-1.9-1.9",key:"1e5ubv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Rw=q("UserRoundX",[["path",{d:"M2 21a8 8 0 0 1 11.873-7",key:"74fkxq"}],["circle",{cx:"10",cy:"8",r:"5",key:"o932ke"}],["path",{d:"m17 17 5 5",key:"p7ous7"}],["path",{d:"m22 17-5 5",key:"gqnmv0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Fw=q("UserRound",[["circle",{cx:"12",cy:"8",r:"5",key:"1hypcn"}],["path",{d:"M20 21a8 8 0 0 0-16 0",key:"rfgkzh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $J=q("UserSearch",[["circle",{cx:"10",cy:"7",r:"4",key:"e45bow"}],["path",{d:"M10.3 15H7a4 4 0 0 0-4 4v2",key:"3bnktk"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["path",{d:"m21 21-1.9-1.9",key:"1g2n9r"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const UJ=q("UserX",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"17",x2:"22",y1:"8",y2:"13",key:"3nzzx3"}],["line",{x1:"22",x2:"17",y1:"8",y2:"13",key:"1swrse"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ic=q("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const zw=q("UsersRound",[["path",{d:"M18 21a8 8 0 0 0-16 0",key:"3ypg7q"}],["circle",{cx:"10",cy:"8",r:"5",key:"o932ke"}],["path",{d:"M22 20c0-3.37-2-6.5-4-8a5 5 0 0 0-.45-8.3",key:"10s06x"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Un=q("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Bw=q("UtensilsCrossed",[["path",{d:"m16 2-2.3 2.3a3 3 0 0 0 0 4.2l1.8 1.8a3 3 0 0 0 4.2 0L22 8",key:"n7qcjb"}],["path",{d:"M15 15 3.3 3.3a4.2 4.2 0 0 0 0 6l7.3 7.3c.7.7 2 .7 2.8 0L15 15Zm0 0 7 7",key:"d0u48b"}],["path",{d:"m2.1 21.8 6.4-6.3",key:"yn04lh"}],["path",{d:"m19 5-7 7",key:"194lzd"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $w=q("Utensils",[["path",{d:"M3 2v7c0 1.1.9 2 2 2h4a2 2 0 0 0 2-2V2",key:"cjf0a3"}],["path",{d:"M7 2v20",key:"1473qp"}],["path",{d:"M21 15V2a5 5 0 0 0-5 5v6c0 1.1.9 2 2 2h3Zm0 0v7",key:"j28e5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qJ=q("UtilityPole",[["path",{d:"M12 2v20",key:"t6zp3m"}],["path",{d:"M2 5h20",key:"1fs1ex"}],["path",{d:"M3 3v2",key:"9imdir"}],["path",{d:"M7 3v2",key:"n0os7"}],["path",{d:"M17 3v2",key:"1l2re6"}],["path",{d:"M21 3v2",key:"1duuac"}],["path",{d:"m19 5-7 7-7-7",key:"133zxf"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const TA=q("Variable",[["path",{d:"M8 21s-4-3-4-9 4-9 4-9",key:"uto9ud"}],["path",{d:"M16 3s4 3 4 9-4 9-4 9",key:"4w2vsq"}],["line",{x1:"15",x2:"9",y1:"9",y2:"15",key:"f7djnv"}],["line",{x1:"9",x2:"15",y1:"9",y2:"15",key:"1shsy8"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const VJ=q("Vault",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}],["path",{d:"m7.9 7.9 2.7 2.7",key:"hpeyl3"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}],["path",{d:"m13.4 10.6 2.7-2.7",key:"264c1n"}],["circle",{cx:"7.5",cy:"16.5",r:".5",fill:"currentColor",key:"nkw3mc"}],["path",{d:"m7.9 16.1 2.7-2.7",key:"p81g5e"}],["circle",{cx:"16.5",cy:"16.5",r:".5",fill:"currentColor",key:"fubopw"}],["path",{d:"m13.4 13.4 2.7 2.7",key:"abhel3"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const HJ=q("Vegan",[["path",{d:"M16 8q6 0 6-6-6 0-6 6",key:"qsyyc4"}],["path",{d:"M17.41 3.59a10 10 0 1 0 3 3",key:"41m9h7"}],["path",{d:"M2 2a26.6 26.6 0 0 1 10 20c.9-6.82 1.5-9.5 4-14",key:"qiv7li"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const WJ=q("VenetianMask",[["path",{d:"M18 11c-1.5 0-2.5.5-3 2",key:"1fod00"}],["path",{d:"M4 6a2 2 0 0 0-2 2v4a5 5 0 0 0 5 5 8 8 0 0 1 5 2 8 8 0 0 1 5-2 5 5 0 0 0 5-5V8a2 2 0 0 0-2-2h-3a8 8 0 0 0-5 2 8 8 0 0 0-5-2z",key:"d70hit"}],["path",{d:"M6 11c1.5 0 2.5.5 3 2",key:"136fht"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const GJ=q("VibrateOff",[["path",{d:"m2 8 2 2-2 2 2 2-2 2",key:"sv1b1"}],["path",{d:"m22 8-2 2 2 2-2 2 2 2",key:"101i4y"}],["path",{d:"M8 8v10c0 .55.45 1 1 1h6c.55 0 1-.45 1-1v-2",key:"1hbad5"}],["path",{d:"M16 10.34V6c0-.55-.45-1-1-1h-4.34",key:"1x5tf0"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const KJ=q("Vibrate",[["path",{d:"m2 8 2 2-2 2 2 2-2 2",key:"sv1b1"}],["path",{d:"m22 8-2 2 2 2-2 2 2 2",key:"101i4y"}],["rect",{width:"8",height:"14",x:"8",y:"5",rx:"1",key:"1oyrl4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ZJ=q("VideoOff",[["path",{d:"M10.66 6H14a2 2 0 0 1 2 2v2.5l5.248-3.062A.5.5 0 0 1 22 7.87v8.196",key:"w8jjjt"}],["path",{d:"M16 16a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h2",key:"1xawa7"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const $a=q("Video",[["path",{d:"m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5",key:"ftymec"}],["rect",{x:"2",y:"6",width:"14",height:"12",rx:"2",key:"158x01"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const YJ=q("Videotape",[["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["path",{d:"M2 8h20",key:"d11cs7"}],["circle",{cx:"8",cy:"14",r:"2",key:"1k2qr5"}],["path",{d:"M8 12h8",key:"1wcyev"}],["circle",{cx:"16",cy:"14",r:"2",key:"14k7lr"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const XJ=q("View",[["path",{d:"M21 17v2a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-2",key:"mrq65r"}],["path",{d:"M21 7V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v2",key:"be3xqs"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["path",{d:"M18.944 12.33a1 1 0 0 0 0-.66 7.5 7.5 0 0 0-13.888 0 1 1 0 0 0 0 .66 7.5 7.5 0 0 0 13.888 0",key:"11ak4c"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const QJ=q("Voicemail",[["circle",{cx:"6",cy:"12",r:"4",key:"1ehtga"}],["circle",{cx:"18",cy:"12",r:"4",key:"4vafl8"}],["line",{x1:"6",x2:"18",y1:"16",y2:"16",key:"pmt8us"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const JJ=q("Volleyball",[["path",{d:"M11.1 7.1a16.55 16.55 0 0 1 10.9 4",key:"2880wi"}],["path",{d:"M12 12a12.6 12.6 0 0 1-8.7 5",key:"113sja"}],["path",{d:"M16.8 13.6a16.55 16.55 0 0 1-9 7.5",key:"1qmsgl"}],["path",{d:"M20.7 17a12.8 12.8 0 0 0-8.7-5 13.3 13.3 0 0 1 0-10",key:"1bmeqp"}],["path",{d:"M6.3 3.8a16.55 16.55 0 0 0 1.9 11.5",key:"iekzv9"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const eee=q("Volume1",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const tee=q("Volume2",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ree=q("VolumeOff",[["path",{d:"M16 9a5 5 0 0 1 .95 2.293",key:"1fgyg8"}],["path",{d:"M19.364 5.636a9 9 0 0 1 1.889 9.96",key:"l3zxae"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"m7 7-.587.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298V11",key:"1gbwow"}],["path",{d:"M9.828 4.172A.686.686 0 0 1 11 4.657v.686",key:"s2je0y"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const nee=q("VolumeX",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["line",{x1:"22",x2:"16",y1:"9",y2:"15",key:"1ewh16"}],["line",{x1:"16",x2:"22",y1:"9",y2:"15",key:"5ykzw1"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const see=q("Volume",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const aee=q("Vote",[["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}],["path",{d:"M5 7c0-1.1.9-2 2-2h10a2 2 0 0 1 2 2v12H5V7Z",key:"1ezoue"}],["path",{d:"M22 19H2",key:"nuriw5"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const iee=q("WalletCards",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2",key:"4125el"}],["path",{d:"M3 11h3c.8 0 1.6.3 2.1.9l1.1.9c1.6 1.6 4.1 1.6 5.7 0l1.1-.9c.5-.5 1.3-.9 2.1-.9H21",key:"1dpki6"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Uw=q("WalletMinimal",[["path",{d:"M17 14h.01",key:"7oqj8z"}],["path",{d:"M7 7h12a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14",key:"u1rqew"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const oee=q("Wallet",[["path",{d:"M19 7V4a1 1 0 0 0-1-1H5a2 2 0 0 0 0 4h15a1 1 0 0 1 1 1v4h-3a2 2 0 0 0 0 4h3a1 1 0 0 0 1-1v-2a1 1 0 0 0-1-1",key:"18etb6"}],["path",{d:"M3 5v14a2 2 0 0 0 2 2h15a1 1 0 0 0 1-1v-4",key:"xoc0q4"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const lee=q("Wallpaper",[["circle",{cx:"8",cy:"9",r:"2",key:"gjzl9d"}],["path",{d:"m9 17 6.1-6.1a2 2 0 0 1 2.81.01L22 15V5a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2",key:"69xh40"}],["path",{d:"M8 21h8",key:"1ev6f3"}],["path",{d:"M12 17v4",key:"1riwvh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qw=q("WandSparkles",[["path",{d:"m21.64 3.64-1.28-1.28a1.21 1.21 0 0 0-1.72 0L2.36 18.64a1.21 1.21 0 0 0 0 1.72l1.28 1.28a1.2 1.2 0 0 0 1.72 0L21.64 5.36a1.2 1.2 0 0 0 0-1.72",key:"ul74o6"}],["path",{d:"m14 7 3 3",key:"1r5n42"}],["path",{d:"M5 6v4",key:"ilb8ba"}],["path",{d:"M19 14v4",key:"blhpug"}],["path",{d:"M10 2v2",key:"7u0qdc"}],["path",{d:"M7 8H3",key:"zfb6yr"}],["path",{d:"M21 16h-4",key:"1cnmox"}],["path",{d:"M11 3H9",key:"1obp7u"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const cee=q("Wand",[["path",{d:"M15 4V2",key:"z1p9b7"}],["path",{d:"M15 16v-2",key:"px0unx"}],["path",{d:"M8 9h2",key:"1g203m"}],["path",{d:"M20 9h2",key:"19tzq7"}],["path",{d:"M17.8 11.8 19 13",key:"yihg8r"}],["path",{d:"M15 9h.01",key:"x1ddxp"}],["path",{d:"M17.8 6.2 19 5",key:"fd4us0"}],["path",{d:"m3 21 9-9",key:"1jfql5"}],["path",{d:"M12.2 6.2 11 5",key:"i3da3b"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const dee=q("Warehouse",[["path",{d:"M22 8.35V20a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V8.35A2 2 0 0 1 3.26 6.5l8-3.2a2 2 0 0 1 1.48 0l8 3.2A2 2 0 0 1 22 8.35Z",key:"gksnxg"}],["path",{d:"M6 18h12",key:"9pbo8z"}],["path",{d:"M6 14h12",key:"4cwo0f"}],["rect",{width:"12",height:"12",x:"6",y:"10",key:"apd30q"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const uee=q("WashingMachine",[["path",{d:"M3 6h3",key:"155dbl"}],["path",{d:"M17 6h.01",key:"e2y6kg"}],["rect",{width:"18",height:"20",x:"3",y:"2",rx:"2",key:"od3kk9"}],["circle",{cx:"12",cy:"13",r:"5",key:"nlbqau"}],["path",{d:"M12 18a2.5 2.5 0 0 0 0-5 2.5 2.5 0 0 1 0-5",key:"17lach"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hee=q("Watch",[["circle",{cx:"12",cy:"12",r:"6",key:"1vlfrh"}],["polyline",{points:"12 10 12 12 13 13",key:"19dquz"}],["path",{d:"m16.13 7.66-.81-4.05a2 2 0 0 0-2-1.61h-2.68a2 2 0 0 0-2 1.61l-.78 4.05",key:"18k57s"}],["path",{d:"m7.88 16.36.8 4a2 2 0 0 0 2 1.61h2.72a2 2 0 0 0 2-1.61l.81-4.05",key:"16ny36"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const fee=q("Waves",[["path",{d:"M2 6c.6.5 1.2 1 2.5 1C7 7 7 5 9.5 5c2.6 0 2.4 2 5 2 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1",key:"knzxuh"}],["path",{d:"M2 12c.6.5 1.2 1 2.5 1 2.5 0 2.5-2 5-2 2.6 0 2.4 2 5 2 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1",key:"2jd2cc"}],["path",{d:"M2 18c.6.5 1.2 1 2.5 1 2.5 0 2.5-2 5-2 2.6 0 2.4 2 5 2 2.5 0 2.5-2 5-2 1.3 0 1.9.5 2.5 1",key:"rd2r6e"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const pee=q("Waypoints",[["circle",{cx:"12",cy:"4.5",r:"2.5",key:"r5ysbb"}],["path",{d:"m10.2 6.3-3.9 3.9",key:"1nzqf6"}],["circle",{cx:"4.5",cy:"12",r:"2.5",key:"jydg6v"}],["path",{d:"M7 12h10",key:"b7w52i"}],["circle",{cx:"19.5",cy:"12",r:"2.5",key:"1piiel"}],["path",{d:"m13.8 17.7 3.9-3.9",key:"1wyg1y"}],["circle",{cx:"12",cy:"19.5",r:"2.5",key:"13o1pw"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const mee=q("Webcam",[["circle",{cx:"12",cy:"10",r:"8",key:"1gshiw"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}],["path",{d:"M7 22h10",key:"10w4w3"}],["path",{d:"M12 22v-4",key:"1utk9m"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gee=q("WebhookOff",[["path",{d:"M17 17h-5c-1.09-.02-1.94.92-2.5 1.9A3 3 0 1 1 2.57 15",key:"1tvl6x"}],["path",{d:"M9 3.4a4 4 0 0 1 6.52.66",key:"q04jfq"}],["path",{d:"m6 17 3.1-5.8a2.5 2.5 0 0 0 .057-2.05",key:"azowf0"}],["path",{d:"M20.3 20.3a4 4 0 0 1-2.3.7",key:"5joiws"}],["path",{d:"M18.6 13a4 4 0 0 1 3.357 3.414",key:"cangb8"}],["path",{d:"m12 6 .6 1",key:"tpjl1n"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const xee=q("Webhook",[["path",{d:"M18 16.98h-5.99c-1.1 0-1.95.94-2.48 1.9A4 4 0 0 1 2 17c.01-.7.2-1.4.57-2",key:"q3hayz"}],["path",{d:"m6 17 3.13-5.78c.53-.97.1-2.18-.5-3.1a4 4 0 1 1 6.89-4.06",key:"1go1hn"}],["path",{d:"m12 6 3.13 5.73C15.66 12.7 16.9 13 18 13a4 4 0 0 1 0 8",key:"qlwsc0"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const yee=q("Weight",[["circle",{cx:"12",cy:"5",r:"3",key:"rqqgnr"}],["path",{d:"M6.5 8a2 2 0 0 0-1.905 1.46L2.1 18.5A2 2 0 0 0 4 21h16a2 2 0 0 0 1.925-2.54L19.4 9.5A2 2 0 0 0 17.48 8Z",key:"56o5sh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const vee=q("WheatOff",[["path",{d:"m2 22 10-10",key:"28ilpk"}],["path",{d:"m16 8-1.17 1.17",key:"1qqm82"}],["path",{d:"M3.47 12.53 5 11l1.53 1.53a3.5 3.5 0 0 1 0 4.94L5 19l-1.53-1.53a3.5 3.5 0 0 1 0-4.94Z",key:"1rdhi6"}],["path",{d:"m8 8-.53.53a3.5 3.5 0 0 0 0 4.94L9 15l1.53-1.53c.55-.55.88-1.25.98-1.97",key:"4wz8re"}],["path",{d:"M10.91 5.26c.15-.26.34-.51.56-.73L13 3l1.53 1.53a3.5 3.5 0 0 1 .28 4.62",key:"rves66"}],["path",{d:"M20 2h2v2a4 4 0 0 1-4 4h-2V6a4 4 0 0 1 4-4Z",key:"19rau1"}],["path",{d:"M11.47 17.47 13 19l-1.53 1.53a3.5 3.5 0 0 1-4.94 0L5 19l1.53-1.53a3.5 3.5 0 0 1 4.94 0Z",key:"tc8ph9"}],["path",{d:"m16 16-.53.53a3.5 3.5 0 0 1-4.94 0L9 15l1.53-1.53a3.49 3.49 0 0 1 1.97-.98",key:"ak46r"}],["path",{d:"M18.74 13.09c.26-.15.51-.34.73-.56L21 11l-1.53-1.53a3.5 3.5 0 0 0-4.62-.28",key:"1tw520"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const _ee=q("Wheat",[["path",{d:"M2 22 16 8",key:"60hf96"}],["path",{d:"M3.47 12.53 5 11l1.53 1.53a3.5 3.5 0 0 1 0 4.94L5 19l-1.53-1.53a3.5 3.5 0 0 1 0-4.94Z",key:"1rdhi6"}],["path",{d:"M7.47 8.53 9 7l1.53 1.53a3.5 3.5 0 0 1 0 4.94L9 15l-1.53-1.53a3.5 3.5 0 0 1 0-4.94Z",key:"1sdzmb"}],["path",{d:"M11.47 4.53 13 3l1.53 1.53a3.5 3.5 0 0 1 0 4.94L13 11l-1.53-1.53a3.5 3.5 0 0 1 0-4.94Z",key:"eoatbi"}],["path",{d:"M20 2h2v2a4 4 0 0 1-4 4h-2V6a4 4 0 0 1 4-4Z",key:"19rau1"}],["path",{d:"M11.47 17.47 13 19l-1.53 1.53a3.5 3.5 0 0 1-4.94 0L5 19l1.53-1.53a3.5 3.5 0 0 1 4.94 0Z",key:"tc8ph9"}],["path",{d:"M15.47 13.47 17 15l-1.53 1.53a3.5 3.5 0 0 1-4.94 0L9 15l1.53-1.53a3.5 3.5 0 0 1 4.94 0Z",key:"2m8kc5"}],["path",{d:"M19.47 9.47 21 11l-1.53 1.53a3.5 3.5 0 0 1-4.94 0L13 11l1.53-1.53a3.5 3.5 0 0 1 4.94 0Z",key:"vex3ng"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const bee=q("WholeWord",[["circle",{cx:"7",cy:"12",r:"3",key:"12clwm"}],["path",{d:"M10 9v6",key:"17i7lo"}],["circle",{cx:"17",cy:"12",r:"3",key:"gl7c2s"}],["path",{d:"M14 7v8",key:"dl84cr"}],["path",{d:"M22 17v1c0 .5-.5 1-1 1H3c-.5 0-1-.5-1-1v-1",key:"lt2kga"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const wee=q("WifiHigh",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const jee=q("WifiLow",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const kee=q("WifiOff",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Nee=q("WifiZero",[["path",{d:"M12 20h.01",key:"zekei9"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const See=q("Wifi",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M2 8.82a15 15 0 0 1 20 0",key:"dnpr2z"}],["path",{d:"M5 12.859a10 10 0 0 1 14 0",key:"1x1e6c"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Cee=q("WindArrowDown",[["path",{d:"M10 2v8",key:"d4bbey"}],["path",{d:"M12.8 21.6A2 2 0 1 0 14 18H2",key:"19kp1d"}],["path",{d:"M17.5 10a2.5 2.5 0 1 1 2 4H2",key:"19kpjc"}],["path",{d:"m6 6 4 4 4-4",key:"k13n16"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Mee=q("Wind",[["path",{d:"M12.8 19.6A2 2 0 1 0 14 16H2",key:"148xed"}],["path",{d:"M17.5 8a2.5 2.5 0 1 1 2 4H2",key:"1u4tom"}],["path",{d:"M9.8 4.4A2 2 0 1 1 11 8H2",key:"75valh"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Tee=q("WineOff",[["path",{d:"M8 22h8",key:"rmew8v"}],["path",{d:"M7 10h3m7 0h-1.343",key:"v48bem"}],["path",{d:"M12 15v7",key:"t2xh3l"}],["path",{d:"M7.307 7.307A12.33 12.33 0 0 0 7 10a5 5 0 0 0 7.391 4.391M8.638 2.981C8.75 2.668 8.872 2.34 9 2h6c1.5 4 2 6 2 8 0 .407-.05.809-.145 1.198",key:"1ymjlu"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Aee=q("Wine",[["path",{d:"M8 22h8",key:"rmew8v"}],["path",{d:"M7 10h10",key:"1101jm"}],["path",{d:"M12 15v7",key:"t2xh3l"}],["path",{d:"M12 15a5 5 0 0 0 5-5c0-2-.5-4-2-8H9c-1.5 4-2 6-2 8a5 5 0 0 0 5 5Z",key:"10ffi3"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Eee=q("Workflow",[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2",key:"by2w9f"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4",key:"xkn7yn"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2",key:"1cgmvn"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Iee=q("Worm",[["path",{d:"m19 12-1.5 3",key:"9bcu4o"}],["path",{d:"M19.63 18.81 22 20",key:"121v98"}],["path",{d:"M6.47 8.23a1.68 1.68 0 0 1 2.44 1.93l-.64 2.08a6.76 6.76 0 0 0 10.16 7.67l.42-.27a1 1 0 1 0-2.73-4.21l-.42.27a1.76 1.76 0 0 1-2.63-1.99l.64-2.08A6.66 6.66 0 0 0 3.94 3.9l-.7.4a1 1 0 1 0 2.55 4.34z",key:"1tij6q"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Pee=q("WrapText",[["line",{x1:"3",x2:"21",y1:"6",y2:"6",key:"4m8b97"}],["path",{d:"M3 12h15a3 3 0 1 1 0 6h-4",key:"1cl7v7"}],["polyline",{points:"16 16 14 18 16 20",key:"1jznyi"}],["line",{x1:"3",x2:"10",y1:"18",y2:"18",key:"1h33wv"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const gy=q("Wrench",[["path",{d:"M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z",key:"cbrjhi"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const hs=q("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Lee=q("Youtube",[["path",{d:"M2.5 17a24.12 24.12 0 0 1 0-10 2 2 0 0 1 1.4-1.4 49.56 49.56 0 0 1 16.2 0A2 2 0 0 1 21.5 7a24.12 24.12 0 0 1 0 10 2 2 0 0 1-1.4 1.4 49.55 49.55 0 0 1-16.2 0A2 2 0 0 1 2.5 17",key:"1q2vi4"}],["path",{d:"m10 15 5-3-5-3z",key:"1jp15x"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Oee=q("ZapOff",[["path",{d:"M10.513 4.856 13.12 2.17a.5.5 0 0 1 .86.46l-1.377 4.317",key:"193nxd"}],["path",{d:"M15.656 10H20a1 1 0 0 1 .78 1.63l-1.72 1.773",key:"27a7lr"}],["path",{d:"M16.273 16.273 10.88 21.83a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14H4a1 1 0 0 1-.78-1.63l4.507-4.643",key:"1e0qe9"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Bg=q("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const RS=q("ZoomIn",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const FS=q("ZoomOut",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]);/** * @license lucide-react v0.462.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const ZXe=Object.freeze(Object.defineProperty({__proto__:null,AArrowDown:n8,AArrowUp:s8,ALargeSmall:a8,Accessibility:i8,Activity:Ig,AirVent:o8,Airplay:l8,AlarmClock:d8,AlarmClockCheck:I_,AlarmClockMinus:P_,AlarmClockOff:c8,AlarmClockPlus:L_,AlarmSmoke:u8,Album:h8,AlignCenter:gS,AlignCenterHorizontal:f8,AlignCenterVertical:p8,AlignEndHorizontal:m8,AlignEndVertical:g8,AlignHorizontalDistributeCenter:x8,AlignHorizontalDistributeEnd:y8,AlignHorizontalDistributeStart:v8,AlignHorizontalJustifyCenter:_8,AlignHorizontalJustifyEnd:b8,AlignHorizontalJustifyStart:w8,AlignHorizontalSpaceAround:j8,AlignHorizontalSpaceBetween:k8,AlignJustify:N8,AlignLeft:xS,AlignRight:yS,AlignStartHorizontal:S8,AlignStartVertical:C8,AlignVerticalDistributeCenter:M8,AlignVerticalDistributeEnd:T8,AlignVerticalDistributeStart:A8,AlignVerticalJustifyCenter:E8,AlignVerticalJustifyEnd:I8,AlignVerticalJustifyStart:P8,AlignVerticalSpaceAround:L8,AlignVerticalSpaceBetween:O8,Ambulance:D8,Ampersand:R8,Ampersands:F8,Amphora:z8,Anchor:B8,Angry:$8,Annoyed:U8,Antenna:q8,Anvil:V8,Aperture:H8,AppWindow:XT,AppWindowMac:W8,Apple:G8,Archive:Y8,ArchiveRestore:K8,ArchiveX:Z8,Armchair:X8,ArrowBigDown:J8,ArrowBigDownDash:Q8,ArrowBigLeft:tD,ArrowBigLeftDash:eD,ArrowBigRight:nD,ArrowBigRightDash:rD,ArrowBigUp:aD,ArrowBigUpDash:sD,ArrowDown:ay,ArrowDown01:iD,ArrowDown10:oD,ArrowDownAZ:O_,ArrowDownFromLine:lD,ArrowDownLeft:cD,ArrowDownNarrowWide:dD,ArrowDownRight:uD,ArrowDownToDot:hD,ArrowDownToLine:fD,ArrowDownUp:pD,ArrowDownWideNarrow:D_,ArrowDownZA:R_,ArrowLeft:po,ArrowLeftFromLine:mD,ArrowLeftRight:gD,ArrowLeftToLine:xD,ArrowRight:Vo,ArrowRightFromLine:yD,ArrowRightLeft:vD,ArrowRightToLine:_D,ArrowUp:cp,ArrowUp01:bD,ArrowUp10:wD,ArrowUpAZ:F_,ArrowUpDown:Pg,ArrowUpFromDot:jD,ArrowUpFromLine:kD,ArrowUpLeft:ND,ArrowUpNarrowWide:z_,ArrowUpRight:SD,ArrowUpToLine:CD,ArrowUpWideNarrow:MD,ArrowUpZA:B_,ArrowsUpFromLine:TD,Asterisk:AD,AtSign:ED,Atom:ID,AudioLines:PD,AudioWaveform:LD,Award:zl,Axe:OD,Axis3d:$_,Baby:DD,Backpack:RD,Badge:JD,BadgeAlert:FD,BadgeCent:zD,BadgeCheck:U_,BadgeDollarSign:BD,BadgeEuro:$D,BadgeHelp:UD,BadgeIndianRupee:qD,BadgeInfo:VD,BadgeJapaneseYen:HD,BadgeMinus:WD,BadgePercent:GD,BadgePlus:KD,BadgePoundSterling:ZD,BadgeRussianRuble:YD,BadgeSwissFranc:XD,BadgeX:QD,BaggageClaim:eR,Ban:tR,Banana:rR,Bandage:nR,Banknote:sR,Barcode:aR,Baseline:iR,Bath:F1,Battery:hR,BatteryCharging:oR,BatteryFull:lR,BatteryLow:cR,BatteryMedium:dR,BatteryWarning:uR,Beaker:fR,Bean:mR,BeanOff:pR,Bed:z1,BedDouble:gR,BedSingle:xR,Beef:yR,Beer:_R,BeerOff:vR,Bell:Lg,BellDot:bR,BellElectric:wR,BellMinus:jR,BellOff:Sj,BellPlus:kR,BellRing:NR,BetweenHorizontalEnd:q_,BetweenHorizontalStart:V_,BetweenVerticalEnd:SR,BetweenVerticalStart:CR,BicepsFlexed:MR,Bike:TR,Binary:AR,Binoculars:ER,Biohazard:IR,Bird:PR,Bitcoin:LR,Blend:OR,Blinds:DR,Blocks:RR,Bluetooth:$R,BluetoothConnected:FR,BluetoothOff:zR,BluetoothSearching:BR,Bold:vS,Bolt:UR,Bomb:qR,Bone:VR,Book:hF,BookA:HR,BookAudio:WR,BookCheck:GR,BookCopy:KR,BookDashed:H_,BookDown:ZR,BookHeadphones:YR,BookHeart:XR,BookImage:QR,BookKey:JR,BookLock:eF,BookMarked:tF,BookMinus:rF,BookOpen:QT,BookOpenCheck:nF,BookOpenText:sF,BookPlus:aF,BookText:iF,BookType:oF,BookUp:cF,BookUp2:lF,BookUser:dF,BookX:uF,Bookmark:Sm,BookmarkCheck:fF,BookmarkMinus:pF,BookmarkPlus:JT,BookmarkX:mF,BoomBox:gF,Bot:_S,BotMessageSquare:xF,BotOff:yF,Box:vF,Boxes:_F,Braces:W_,Brackets:bF,Brain:eA,BrainCircuit:wF,BrainCog:jF,BrickWall:kF,Briefcase:Ah,BriefcaseBusiness:NF,BriefcaseConveyorBelt:SF,BriefcaseMedical:CF,BringToFront:MF,Brush:TF,Bug:IF,BugOff:AF,BugPlay:EF,Building:Cj,Building2:hi,Bus:LF,BusFront:PF,Cable:DF,CableCar:OF,Cake:hf,CakeSlice:RF,Calculator:FF,Calendar:Ss,Calendar1:zF,CalendarArrowDown:BF,CalendarArrowUp:$F,CalendarCheck:qF,CalendarCheck2:UF,CalendarClock:tA,CalendarCog:VF,CalendarDays:Cm,CalendarFold:HF,CalendarHeart:WF,CalendarMinus:KF,CalendarMinus2:GF,CalendarOff:ZF,CalendarPlus:Mj,CalendarPlus2:YF,CalendarRange:XF,CalendarSearch:QF,CalendarSync:JF,CalendarX:tz,CalendarX2:ez,Camera:Og,CameraOff:rz,Candy:az,CandyCane:nz,CandyOff:sz,Cannabis:iz,Captions:G_,CaptionsOff:oz,Car:dz,CarFront:lz,CarTaxiFront:cz,Caravan:uz,Carrot:hz,CaseLower:fz,CaseSensitive:pz,CaseUpper:mz,CassetteTape:gz,Cast:xz,Castle:yz,Cat:vz,Cctv:_z,ChartArea:K_,ChartBar:Y_,ChartBarBig:Z_,ChartBarDecreasing:bz,ChartBarIncreasing:wz,ChartBarStacked:jz,ChartCandlestick:X_,ChartColumn:_c,ChartColumnBig:Q_,ChartColumnDecreasing:kz,ChartColumnIncreasing:J_,ChartColumnStacked:Nz,ChartGantt:Sz,ChartLine:eb,ChartNetwork:Cz,ChartNoAxesColumn:rb,ChartNoAxesColumnDecreasing:Mz,ChartNoAxesColumnIncreasing:tb,ChartNoAxesCombined:Tz,ChartNoAxesGantt:nb,ChartPie:sb,ChartScatter:ab,ChartSpline:Az,Check:Ni,CheckCheck:Ez,ChefHat:Iz,Cherry:Pz,ChevronDown:Dd,ChevronFirst:Lz,ChevronLast:Oz,ChevronLeft:kc,ChevronRight:Wi,ChevronUp:iy,ChevronsDown:Rz,ChevronsDownUp:Dz,ChevronsLeft:Bz,ChevronsLeftRight:zz,ChevronsLeftRightEllipsis:Fz,ChevronsRight:Uz,ChevronsRightLeft:$z,ChevronsUp:qz,ChevronsUpDown:oy,Chrome:Vz,Church:Hz,Cigarette:Gz,CigaretteOff:Wz,Circle:Qu,CircleAlert:yl,CircleArrowDown:ib,CircleArrowLeft:ob,CircleArrowOutDownLeft:lb,CircleArrowOutDownRight:cb,CircleArrowOutUpLeft:db,CircleArrowOutUpRight:ub,CircleArrowRight:hb,CircleArrowUp:fb,CircleCheck:so,CircleCheckBig:di,CircleChevronDown:pb,CircleChevronLeft:mb,CircleChevronRight:gb,CircleChevronUp:xb,CircleDashed:Kz,CircleDivide:yb,CircleDollarSign:Zz,CircleDot:Xz,CircleDotDashed:Yz,CircleEllipsis:Qz,CircleEqual:Jz,CircleFadingArrowUp:e7,CircleFadingPlus:t7,CircleGauge:vb,CircleHelp:Hx,CircleMinus:_b,CircleOff:r7,CircleParking:wb,CircleParkingOff:bb,CirclePause:jb,CirclePercent:kb,CirclePlay:rp,CirclePlus:Nb,CirclePower:Sb,CircleSlash:n7,CircleSlash2:Cb,CircleStop:Mb,CircleUser:Ab,CircleUserRound:Tb,CircleX:bc,CircuitBoard:s7,Citrus:a7,Clapperboard:i7,Clipboard:f7,ClipboardCheck:rA,ClipboardCopy:o7,ClipboardList:nA,ClipboardMinus:l7,ClipboardPaste:c7,ClipboardPen:Ib,ClipboardPenLine:Eb,ClipboardPlus:d7,ClipboardType:u7,ClipboardX:h7,Clock:Ya,Clock1:p7,Clock10:m7,Clock11:g7,Clock12:x7,Clock2:y7,Clock3:v7,Clock4:_7,Clock5:b7,Clock6:w7,Clock7:j7,Clock8:k7,Clock9:N7,ClockAlert:S7,ClockArrowDown:C7,ClockArrowUp:M7,Cloud:q7,CloudAlert:T7,CloudCog:A7,CloudDownload:Pb,CloudDrizzle:E7,CloudFog:I7,CloudHail:P7,CloudLightning:L7,CloudMoon:D7,CloudMoonRain:O7,CloudOff:R7,CloudRain:z7,CloudRainWind:F7,CloudSnow:B7,CloudSun:U7,CloudSunRain:$7,CloudUpload:Lb,Cloudy:V7,Clover:Jx,Club:H7,Code:Tj,CodeXml:Ob,Codepen:W7,Codesandbox:G7,Coffee:Aj,Cog:K7,Coins:Z7,Columns2:Db,Columns3:Rb,Columns4:Y7,Combine:X7,Command:Q7,Compass:J7,Component:e9,Computer:t9,ConciergeBell:r9,Cone:n9,Construction:s9,Contact:a9,ContactRound:Fb,Container:i9,Contrast:o9,Cookie:l9,CookingPot:c9,Copy:Wo,CopyCheck:d9,CopyMinus:u9,CopyPlus:h9,CopySlash:f9,CopyX:p9,Copyleft:m9,Copyright:g9,CornerDownLeft:x9,CornerDownRight:y9,CornerLeftDown:v9,CornerLeftUp:_9,CornerRightDown:b9,CornerRightUp:w9,CornerUpLeft:j9,CornerUpRight:k9,Cpu:N9,CreativeCommons:S9,CreditCard:Mm,Croissant:C9,Crop:M9,Cross:T9,Crosshair:A9,Crown:B1,Cuboid:E9,CupSoda:I9,Currency:P9,Cylinder:L9,Dam:O9,Database:F9,DatabaseBackup:D9,DatabaseZap:R9,Delete:z9,Dessert:B9,Diameter:$9,Diamond:V9,DiamondMinus:U9,DiamondPercent:zb,DiamondPlus:q9,Dice1:H9,Dice2:W9,Dice3:G9,Dice4:K9,Dice5:Z9,Dice6:Y9,Dices:X9,Diff:Q9,Disc:rB,Disc2:J9,Disc3:eB,DiscAlbum:tB,Divide:nB,Dna:aB,DnaOff:sB,Dock:iB,Dog:oB,DollarSign:Rd,Donut:lB,DoorClosed:cB,DoorOpen:Ej,Dot:dB,Download:io,DraftingCompass:uB,Drama:hB,Dribbble:fB,Drill:pB,Droplet:mB,Droplets:gB,Drum:xB,Drumstick:yB,Dumbbell:vB,Ear:bB,EarOff:_B,Earth:Bb,EarthLock:wB,Eclipse:jB,Egg:bS,EggFried:kB,EggOff:NB,Ellipsis:pm,EllipsisVertical:Wx,Equal:MB,EqualApproximately:SB,EqualNot:CB,Eraser:TB,EthernetPort:AB,Euro:EB,Expand:IB,ExternalLink:As,Eye:Ko,EyeClosed:PB,EyeOff:$1,Facebook:au,Factory:LB,Fan:OB,FastForward:DB,Feather:RB,Fence:FB,FerrisWheel:zB,Figma:BB,File:L$,FileArchive:$B,FileAudio:qB,FileAudio2:UB,FileAxis3d:$b,FileBadge:HB,FileBadge2:VB,FileBox:WB,FileChartColumn:qb,FileChartColumnIncreasing:Ub,FileChartLine:Vb,FileChartPie:Hb,FileCheck:KB,FileCheck2:GB,FileClock:ZB,FileCode:XB,FileCode2:YB,FileCog:Wb,FileDiff:QB,FileDigit:JB,FileDown:e$,FileHeart:t$,FileImage:U1,FileInput:r$,FileJson:s$,FileJson2:n$,FileKey:i$,FileKey2:a$,FileLock:l$,FileLock2:o$,FileMinus:d$,FileMinus2:c$,FileMusic:u$,FileOutput:h$,FilePen:Kb,FilePenLine:Gb,FilePlus:p$,FilePlus2:f$,FileQuestion:m$,FileScan:g$,FileSearch:y$,FileSearch2:x$,FileSliders:v$,FileSpreadsheet:q1,FileStack:_$,FileSymlink:b$,FileTerminal:w$,FileText:Ea,FileType:k$,FileType2:j$,FileUp:N$,FileUser:S$,FileVideo:M$,FileVideo2:C$,FileVolume:A$,FileVolume2:T$,FileWarning:E$,FileX:P$,FileX2:I$,Files:O$,Film:eu,Filter:V1,FilterX:D$,Fingerprint:R$,FireExtinguisher:F$,Fish:$$,FishOff:z$,FishSymbol:B$,Flag:ly,FlagOff:U$,FlagTriangleLeft:q$,FlagTriangleRight:V$,Flame:ff,FlameKindling:H$,Flashlight:G$,FlashlightOff:W$,FlaskConical:Ij,FlaskConicalOff:K$,FlaskRound:Z$,FlipHorizontal:X$,FlipHorizontal2:Y$,FlipVertical:J$,FlipVertical2:Q$,Flower:eU,Flower2:vm,Focus:tU,FoldHorizontal:rU,FoldVertical:nU,Folder:AU,FolderArchive:sU,FolderCheck:aU,FolderClock:iU,FolderClosed:oU,FolderCode:lU,FolderCog:Zb,FolderDot:cU,FolderDown:dU,FolderGit:hU,FolderGit2:uU,FolderHeart:fU,FolderInput:pU,FolderKanban:mU,FolderKey:gU,FolderLock:xU,FolderMinus:yU,FolderOpen:Tm,FolderOpenDot:vU,FolderOutput:_U,FolderPen:Yb,FolderPlus:bU,FolderRoot:wU,FolderSearch:kU,FolderSearch2:jU,FolderSymlink:NU,FolderSync:SU,FolderTree:CU,FolderUp:MU,FolderX:TU,Folders:EU,Footprints:IU,Forklift:PU,Forward:LU,Frame:OU,Framer:DU,Frown:RU,Fuel:FU,Fullscreen:zU,GalleryHorizontal:$U,GalleryHorizontalEnd:BU,GalleryThumbnails:UU,GalleryVertical:VU,GalleryVerticalEnd:qU,Gamepad:WU,Gamepad2:HU,Gauge:GU,Gavel:KU,Gem:ZU,Ghost:Pj,Gift:to,GitBranch:XU,GitBranchPlus:YU,GitCommitHorizontal:Xb,GitCommitVertical:QU,GitCompare:eq,GitCompareArrows:JU,GitFork:tq,GitGraph:rq,GitMerge:nq,GitPullRequest:cq,GitPullRequestArrow:sq,GitPullRequestClosed:aq,GitPullRequestCreate:oq,GitPullRequestCreateArrow:iq,GitPullRequestDraft:lq,Github:dq,Gitlab:uq,GlassWater:hq,Glasses:fq,Globe:cy,GlobeLock:pq,Goal:mq,Grab:gq,GraduationCap:H1,Grape:xq,Grid2x2:Jb,Grid2x2Check:yq,Grid2x2Plus:Qb,Grid2x2X:vq,Grid3x3:Qh,Grip:bq,GripHorizontal:_q,GripVertical:dy,Group:wq,Guitar:jq,Ham:kq,Hammer:Nq,Hand:Aq,HandCoins:Sq,HandHeart:Cq,HandHelping:e2,HandMetal:Mq,HandPlatter:Tq,Handshake:Eq,HardDrive:sA,HardDriveDownload:Iq,HardDriveUpload:Pq,HardHat:Lq,Hash:wS,Haze:Oq,HdmiPort:Dq,Heading:$q,Heading1:aA,Heading2:iA,Heading3:Rq,Heading4:Fq,Heading5:zq,Heading6:Bq,HeadphoneOff:Uq,Headphones:qq,Headset:Vq,Heart:xi,HeartCrack:Hq,HeartHandshake:Wq,HeartOff:Gq,HeartPulse:Kq,Heater:Zq,Hexagon:Yq,Highlighter:Xq,History:jS,Hop:Jq,HopOff:Qq,Hospital:eV,Hotel:tV,Hourglass:rV,House:xa,HousePlug:nV,HousePlus:sV,IceCreamBowl:t2,IceCreamCone:r2,IdCard:aV,Image:Rl,ImageDown:iV,ImageMinus:oV,ImageOff:lV,ImagePlay:cV,ImagePlus:kS,ImageUp:dV,ImageUpscale:uV,Images:hV,Import:fV,Inbox:pV,IndentDecrease:n2,IndentIncrease:s2,IndianRupee:mV,Infinity:gV,Info:xV,InspectionPanel:yV,Instagram:_u,Italic:NS,IterationCcw:vV,IterationCw:_V,JapaneseYen:bV,Joystick:wV,Kanban:uy,Key:pf,KeyRound:Lj,KeySquare:jV,Keyboard:SV,KeyboardMusic:kV,KeyboardOff:NV,Lamp:IV,LampCeiling:CV,LampDesk:MV,LampFloor:TV,LampWallDown:AV,LampWallUp:EV,LandPlot:PV,Landmark:LV,Languages:OV,Laptop:RV,LaptopMinimal:a2,LaptopMinimalCheck:DV,Lasso:zV,LassoSelect:FV,Laugh:BV,Layers:qV,Layers2:$V,Layers3:UV,LayoutDashboard:Oj,LayoutGrid:dp,LayoutList:VV,LayoutPanelLeft:HV,LayoutPanelTop:WV,LayoutTemplate:Dj,Leaf:GV,LeafyGreen:KV,Lectern:ZV,LetterText:YV,Library:SS,LibraryBig:XV,LifeBuoy:CS,Ligature:QV,Lightbulb:W1,LightbulbOff:JV,Link:Io,Link2:mf,Link2Off:eH,Linkedin:gf,List:up,ListCheck:tH,ListChecks:rH,ListCollapse:nH,ListEnd:sH,ListFilter:aH,ListMinus:iH,ListMusic:oH,ListOrdered:MS,ListPlus:lH,ListRestart:cH,ListStart:dH,ListTodo:uH,ListTree:hH,ListVideo:fH,ListX:pH,Loader:gH,LoaderCircle:Zr,LoaderPinwheel:mH,Locate:oA,LocateFixed:xH,LocateOff:yH,Lock:hp,LockKeyhole:vH,LockKeyholeOpen:i2,LockOpen:o2,LogIn:TS,LogOut:AS,Logs:_H,Lollipop:bH,Luggage:wH,Magnet:jH,Mail:Ns,MailCheck:kH,MailMinus:NH,MailOpen:SH,MailPlus:CH,MailQuestion:MH,MailSearch:TH,MailWarning:AH,MailX:lA,Mailbox:EH,Mails:IH,Map:VH,MapPin:Po,MapPinCheck:LH,MapPinCheckInside:PH,MapPinHouse:OH,MapPinMinus:RH,MapPinMinusInside:DH,MapPinOff:FH,MapPinPlus:BH,MapPinPlusInside:zH,MapPinX:UH,MapPinXInside:$H,MapPinned:qH,Martini:HH,Maximize:GH,Maximize2:WH,Medal:hy,Megaphone:Am,MegaphoneOff:KH,Meh:ZH,MemoryStick:YH,Menu:cA,Merge:XH,MessageCircle:Ul,MessageCircleCode:QH,MessageCircleDashed:JH,MessageCircleHeart:ES,MessageCircleMore:eW,MessageCircleOff:tW,MessageCirclePlus:rW,MessageCircleQuestion:dA,MessageCircleReply:nW,MessageCircleWarning:sW,MessageCircleX:aW,MessageSquare:zo,MessageSquareCode:iW,MessageSquareDashed:oW,MessageSquareDiff:lW,MessageSquareDot:cW,MessageSquareHeart:dW,MessageSquareLock:uW,MessageSquareMore:hW,MessageSquareOff:fW,MessageSquarePlus:pW,MessageSquareQuote:uA,MessageSquareReply:mW,MessageSquareShare:gW,MessageSquareText:xW,MessageSquareWarning:yW,MessageSquareX:vW,MessagesSquare:_W,Mic:hA,MicOff:bW,MicVocal:l2,Microchip:wW,Microscope:jW,Microwave:kW,Milestone:NW,Milk:CW,MilkOff:SW,Minimize:TW,Minimize2:MW,Minus:G1,Monitor:Rj,MonitorCheck:AW,MonitorCog:EW,MonitorDot:IW,MonitorDown:PW,MonitorOff:LW,MonitorPause:OW,MonitorPlay:DW,MonitorSmartphone:RW,MonitorSpeaker:FW,MonitorStop:zW,MonitorUp:BW,MonitorX:$W,Moon:qW,MoonStar:UW,Mountain:HW,MountainSnow:VW,Mouse:YW,MouseOff:WW,MousePointer:ZW,MousePointer2:GW,MousePointerBan:KW,MousePointerClick:Fj,Move:cG,Move3d:c2,MoveDiagonal:QW,MoveDiagonal2:XW,MoveDown:tG,MoveDownLeft:JW,MoveDownRight:eG,MoveHorizontal:rG,MoveLeft:nG,MoveRight:sG,MoveUp:oG,MoveUpLeft:aG,MoveUpRight:iG,MoveVertical:lG,Music:fG,Music2:dG,Music3:uG,Music4:hG,Navigation:fA,Navigation2:mG,Navigation2Off:pG,NavigationOff:gG,Network:xG,Newspaper:fy,Nfc:yG,Notebook:wG,NotebookPen:vG,NotebookTabs:_G,NotebookText:bG,NotepadText:kG,NotepadTextDashed:jG,Nut:SG,NutOff:NG,Octagon:MG,OctagonAlert:d2,OctagonMinus:CG,OctagonPause:u2,OctagonX:h2,Omega:TG,Option:AG,Orbit:EG,Origami:IG,Package:ql,Package2:PG,PackageCheck:LG,PackageMinus:OG,PackageOpen:DG,PackagePlus:RG,PackageSearch:FG,PackageX:zG,PaintBucket:BG,PaintRoller:$G,Paintbrush:UG,PaintbrushVertical:f2,Palette:Uc,PanelBottom:HG,PanelBottomClose:qG,PanelBottomDashed:p2,PanelBottomOpen:VG,PanelLeft:y2,PanelLeftClose:m2,PanelLeftDashed:g2,PanelLeftOpen:x2,PanelRight:KG,PanelRightClose:WG,PanelRightDashed:v2,PanelRightOpen:GG,PanelTop:XG,PanelTopClose:ZG,PanelTopDashed:_2,PanelTopOpen:YG,PanelsLeftBottom:QG,PanelsRightBottom:JG,PanelsTopLeft:H0,Paperclip:eK,Parentheses:tK,ParkingMeter:rK,PartyPopper:qc,Pause:xf,PawPrint:nK,PcCase:sK,Pen:G0,PenLine:W0,PenOff:aK,PenTool:zj,Pencil:ni,PencilLine:iK,PencilOff:oK,PencilRuler:lK,Pentagon:cK,Percent:IS,PersonStanding:dK,PhilippinePeso:uK,Phone:Ti,PhoneCall:hK,PhoneForwarded:fK,PhoneIncoming:pK,PhoneMissed:mK,PhoneOff:gK,PhoneOutgoing:xK,Pi:yK,Piano:vK,Pickaxe:_K,PictureInPicture:wK,PictureInPicture2:bK,PiggyBank:jK,Pilcrow:SK,PilcrowLeft:kK,PilcrowRight:NK,Pill:MK,PillBottle:CK,Pin:K1,PinOff:pA,Pipette:TK,Pizza:AK,Plane:PK,PlaneLanding:EK,PlaneTakeoff:IK,Play:Vl,Plug:mA,Plug2:LK,PlugZap:b2,Plus:bn,Pocket:DK,PocketKnife:OK,Podcast:RK,Pointer:zK,PointerOff:FK,Popcorn:BK,Popsicle:$K,PoundSterling:UK,Power:VK,PowerOff:qK,Presentation:HK,Printer:GK,PrinterCheck:WK,Projector:KK,Proportions:ZK,Puzzle:YK,Pyramid:XK,QrCode:gA,Quote:xA,Rabbit:QK,Radar:JK,Radiation:eZ,Radical:tZ,Radio:Bj,RadioReceiver:rZ,RadioTower:nZ,Radius:sZ,RailSymbol:aZ,Rainbow:iZ,Rat:oZ,Ratio:lZ,Receipt:xZ,ReceiptCent:cZ,ReceiptEuro:dZ,ReceiptIndianRupee:uZ,ReceiptJapaneseYen:hZ,ReceiptPoundSterling:fZ,ReceiptRussianRuble:pZ,ReceiptSwissFranc:mZ,ReceiptText:gZ,RectangleEllipsis:w2,RectangleHorizontal:yZ,RectangleVertical:vZ,Recycle:_Z,Redo:PS,Redo2:bZ,RedoDot:wZ,RefreshCcw:kZ,RefreshCcwDot:jZ,RefreshCw:qo,RefreshCwOff:NZ,Refrigerator:SZ,Regex:CZ,RemoveFormatting:MZ,Repeat:yA,Repeat1:TZ,Repeat2:AZ,Replace:IZ,ReplaceAll:EZ,Reply:vA,ReplyAll:PZ,Rewind:LZ,Ribbon:OZ,Rocket:Dg,RockingChair:DZ,RollerCoaster:RZ,Rotate3d:j2,RotateCcw:LS,RotateCcwSquare:FZ,RotateCw:_A,RotateCwSquare:zZ,Route:$Z,RouteOff:BZ,Router:UZ,Rows2:k2,Rows3:N2,Rows4:qZ,Rss:VZ,Ruler:HZ,RussianRuble:WZ,Sailboat:GZ,Salad:KZ,Sandwich:ZZ,Satellite:XZ,SatelliteDish:YZ,Save:Em,SaveAll:QZ,SaveOff:JZ,Scale:eY,Scale3d:S2,Scaling:tY,Scan:cY,ScanBarcode:rY,ScanEye:nY,ScanFace:sY,ScanLine:aY,ScanQrCode:iY,ScanSearch:oY,ScanText:lY,School:dY,Scissors:hY,ScissorsLineDashed:uY,ScreenShare:pY,ScreenShareOff:fY,Scroll:gY,ScrollText:mY,Search:Sa,SearchCheck:xY,SearchCode:yY,SearchSlash:vY,SearchX:_Y,Section:bY,Send:lo,SendHorizontal:C2,SendToBack:wY,SeparatorHorizontal:jY,SeparatorVertical:kY,Server:MY,ServerCog:NY,ServerCrash:SY,ServerOff:CY,Settings:Fd,Settings2:TY,Shapes:AY,Share:bA,Share2:Nc,Sheet:EY,Shell:IY,Shield:yf,ShieldAlert:PY,ShieldBan:LY,ShieldCheck:wA,ShieldEllipsis:OY,ShieldHalf:DY,ShieldMinus:RY,ShieldOff:FY,ShieldPlus:zY,ShieldQuestion:BY,ShieldX:M2,Ship:UY,ShipWheel:$Y,Shirt:qY,ShoppingBag:Rg,ShoppingBasket:VY,ShoppingCart:Nh,Shovel:HY,ShowerHead:WY,Shrink:GY,Shrub:KY,Shuffle:ZY,Sigma:YY,Signal:tX,SignalHigh:XY,SignalLow:QY,SignalMedium:JY,SignalZero:eX,Signature:rX,Signpost:sX,SignpostBig:nX,Siren:aX,SkipBack:iX,SkipForward:oX,Skull:lX,Slack:cX,Slash:dX,Slice:uX,SlidersHorizontal:jA,SlidersVertical:T2,Smartphone:py,SmartphoneCharging:hX,SmartphoneNfc:fX,Smile:mX,SmilePlus:pX,Snail:gX,Snowflake:j1,Sofa:xX,Soup:yX,Space:vX,Spade:_X,Sparkle:bX,Sparkles:Ls,Speaker:wX,Speech:jX,SpellCheck:NX,SpellCheck2:kX,Spline:SX,Split:CX,SprayCan:MX,Sprout:TX,Square:Fg,SquareActivity:A2,SquareArrowDown:P2,SquareArrowDownLeft:E2,SquareArrowDownRight:I2,SquareArrowLeft:L2,SquareArrowOutDownLeft:O2,SquareArrowOutDownRight:D2,SquareArrowOutUpLeft:R2,SquareArrowOutUpRight:F2,SquareArrowRight:z2,SquareArrowUp:U2,SquareArrowUpLeft:B2,SquareArrowUpRight:$2,SquareAsterisk:q2,SquareBottomDashedScissors:V2,SquareChartGantt:pg,SquareCheck:H2,SquareCheckBig:K0,SquareChevronDown:W2,SquareChevronLeft:G2,SquareChevronRight:K2,SquareChevronUp:Z2,SquareCode:Y2,SquareDashed:J2,SquareDashedBottom:EX,SquareDashedBottomCode:AX,SquareDashedKanban:X2,SquareDashedMousePointer:Q2,SquareDivide:ew,SquareDot:tw,SquareEqual:rw,SquareFunction:nw,SquareKanban:sw,SquareLibrary:aw,SquareM:iw,SquareMenu:ow,SquareMinus:lw,SquareMousePointer:cw,SquareParking:uw,SquareParkingOff:dw,SquarePen:gc,SquarePercent:hw,SquarePi:fw,SquarePilcrow:pw,SquarePlay:mw,SquarePlus:gw,SquarePower:xw,SquareRadical:IX,SquareScissors:yw,SquareSigma:vw,SquareSlash:_w,SquareSplitHorizontal:bw,SquareSplitVertical:ww,SquareSquare:PX,SquareStack:LX,SquareTerminal:jw,SquareUser:Nw,SquareUserRound:kw,SquareX:Sw,Squircle:OX,Squirrel:DX,Stamp:RX,Star:js,StarHalf:FX,StarOff:zX,StepBack:BX,StepForward:$X,Stethoscope:UX,Sticker:qX,StickyNote:VX,Store:HX,StretchHorizontal:WX,StretchVertical:GX,Strikethrough:KX,Subscript:ZX,Sun:Z1,SunDim:YX,SunMedium:XX,SunMoon:QX,SunSnow:JX,Sunrise:eQ,Sunset:tQ,Superscript:rQ,SwatchBook:nQ,SwissFranc:sQ,SwitchCamera:aQ,Sword:iQ,Swords:oQ,Syringe:lQ,Table:mQ,Table2:OS,TableCellsMerge:cQ,TableCellsSplit:dQ,TableColumnsSplit:uQ,TableOfContents:hQ,TableProperties:fQ,TableRowsSplit:pQ,Tablet:xQ,TabletSmartphone:gQ,Tablets:yQ,Tag:zg,Tags:vQ,Tally1:_Q,Tally2:bQ,Tally3:wQ,Tally4:jQ,Tally5:kQ,Tangent:NQ,Target:my,Telescope:SQ,Tent:MQ,TentTree:CQ,Terminal:TQ,TestTube:AQ,TestTubeDiagonal:Cw,TestTubes:EQ,Text:DQ,TextCursor:PQ,TextCursorInput:IQ,TextQuote:LQ,TextSearch:OQ,TextSelect:Mw,Theater:RQ,Thermometer:BQ,ThermometerSnowflake:FQ,ThermometerSun:zQ,ThumbsDown:kA,ThumbsUp:zd,Ticket:NA,TicketCheck:$Q,TicketMinus:UQ,TicketPercent:qQ,TicketPlus:VQ,TicketSlash:HQ,TicketX:WQ,Tickets:KQ,TicketsPlane:GQ,Timer:XQ,TimerOff:ZQ,TimerReset:YQ,ToggleLeft:QQ,ToggleRight:JQ,Toilet:eJ,Tornado:tJ,Torus:rJ,Touchpad:sJ,TouchpadOff:nJ,TowerControl:aJ,ToyBrick:iJ,Tractor:oJ,TrafficCone:lJ,TrainFront:dJ,TrainFrontTunnel:cJ,TrainTrack:uJ,TramFront:Tw,Trash:hJ,Trash2:Bn,TreeDeciduous:fJ,TreePalm:Aw,TreePine:Y1,Trees:pJ,Trello:mJ,TrendingDown:$j,TrendingUp:fp,TrendingUpDown:gJ,Triangle:yJ,TriangleAlert:rf,TriangleRight:xJ,Trophy:ro,Truck:SA,Turtle:vJ,Tv:bJ,TvMinimal:Ew,TvMinimalPlay:_J,Twitch:wJ,Twitter:jJ,Type:NJ,TypeOutline:kJ,Umbrella:CJ,UmbrellaOff:SJ,Underline:MJ,Undo:DS,Undo2:TJ,UndoDot:AJ,UnfoldHorizontal:EJ,UnfoldVertical:IJ,Ungroup:PJ,University:Iw,Unlink:CA,Unlink2:LJ,Unplug:OJ,Upload:_o,Usb:DJ,User:ic,UserCheck:Uj,UserCog:MA,UserMinus:RJ,UserPen:FJ,UserPlus:vf,UserRound:Fw,UserRoundCheck:Pw,UserRoundCog:Lw,UserRoundMinus:Ow,UserRoundPen:zJ,UserRoundPlus:Dw,UserRoundSearch:BJ,UserRoundX:Rw,UserSearch:$J,UserX:UJ,Users:Un,UsersRound:zw,Utensils:$w,UtensilsCrossed:Bw,UtilityPole:qJ,Variable:TA,Vault:VJ,Vegan:HJ,VenetianMask:WJ,Vibrate:KJ,VibrateOff:GJ,Video:$a,VideoOff:ZJ,Videotape:YJ,View:XJ,Voicemail:QJ,Volleyball:JJ,Volume:see,Volume1:eee,Volume2:tee,VolumeOff:ree,VolumeX:nee,Vote:aee,Wallet:oee,WalletCards:iee,WalletMinimal:Uw,Wallpaper:lee,Wand:cee,WandSparkles:qw,Warehouse:dee,WashingMachine:uee,Watch:hee,Waves:fee,Waypoints:pee,Webcam:mee,Webhook:xee,WebhookOff:gee,Weight:yee,Wheat:_ee,WheatOff:vee,WholeWord:bee,Wifi:See,WifiHigh:wee,WifiLow:jee,WifiOff:kee,WifiZero:Nee,Wind:Mee,WindArrowDown:Cee,Wine:Aee,WineOff:Tee,Workflow:Eee,Worm:Iee,WrapText:Pee,Wrench:gy,X:hs,Youtube:Lee,Zap:Bg,ZapOff:Oee,ZoomIn:RS,ZoomOut:FS},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 SIe=Object.freeze(Object.defineProperty({__proto__:null,AArrowDown:n8,AArrowDownIcon:n8,AArrowUp:s8,AArrowUpIcon:s8,ALargeSmall:a8,ALargeSmallIcon:a8,Accessibility:i8,AccessibilityIcon:i8,Activity:Ig,ActivityIcon:Ig,ActivitySquare:A2,ActivitySquareIcon:A2,AirVent:o8,AirVentIcon:o8,Airplay:l8,AirplayIcon:l8,AlarmCheck:I_,AlarmCheckIcon:I_,AlarmClock:d8,AlarmClockCheck:I_,AlarmClockCheckIcon:I_,AlarmClockIcon:d8,AlarmClockMinus:P_,AlarmClockMinusIcon:P_,AlarmClockOff:c8,AlarmClockOffIcon:c8,AlarmClockPlus:L_,AlarmClockPlusIcon:L_,AlarmMinus:P_,AlarmMinusIcon:P_,AlarmPlus:L_,AlarmPlusIcon:L_,AlarmSmoke:u8,AlarmSmokeIcon:u8,Album:h8,AlbumIcon:h8,AlertCircle:yl,AlertCircleIcon:yl,AlertOctagon:d2,AlertOctagonIcon:d2,AlertTriangle:rf,AlertTriangleIcon:rf,AlignCenter:gS,AlignCenterHorizontal:f8,AlignCenterHorizontalIcon:f8,AlignCenterIcon:gS,AlignCenterVertical:p8,AlignCenterVerticalIcon:p8,AlignEndHorizontal:m8,AlignEndHorizontalIcon:m8,AlignEndVertical:g8,AlignEndVerticalIcon:g8,AlignHorizontalDistributeCenter:x8,AlignHorizontalDistributeCenterIcon:x8,AlignHorizontalDistributeEnd:y8,AlignHorizontalDistributeEndIcon:y8,AlignHorizontalDistributeStart:v8,AlignHorizontalDistributeStartIcon:v8,AlignHorizontalJustifyCenter:_8,AlignHorizontalJustifyCenterIcon:_8,AlignHorizontalJustifyEnd:b8,AlignHorizontalJustifyEndIcon:b8,AlignHorizontalJustifyStart:w8,AlignHorizontalJustifyStartIcon:w8,AlignHorizontalSpaceAround:j8,AlignHorizontalSpaceAroundIcon:j8,AlignHorizontalSpaceBetween:k8,AlignHorizontalSpaceBetweenIcon:k8,AlignJustify:N8,AlignJustifyIcon:N8,AlignLeft:xS,AlignLeftIcon:xS,AlignRight:yS,AlignRightIcon:yS,AlignStartHorizontal:S8,AlignStartHorizontalIcon:S8,AlignStartVertical:C8,AlignStartVerticalIcon:C8,AlignVerticalDistributeCenter:M8,AlignVerticalDistributeCenterIcon:M8,AlignVerticalDistributeEnd:T8,AlignVerticalDistributeEndIcon:T8,AlignVerticalDistributeStart:A8,AlignVerticalDistributeStartIcon:A8,AlignVerticalJustifyCenter:E8,AlignVerticalJustifyCenterIcon:E8,AlignVerticalJustifyEnd:I8,AlignVerticalJustifyEndIcon:I8,AlignVerticalJustifyStart:P8,AlignVerticalJustifyStartIcon:P8,AlignVerticalSpaceAround:L8,AlignVerticalSpaceAroundIcon:L8,AlignVerticalSpaceBetween:O8,AlignVerticalSpaceBetweenIcon:O8,Ambulance:D8,AmbulanceIcon:D8,Ampersand:R8,AmpersandIcon:R8,Ampersands:F8,AmpersandsIcon:F8,Amphora:z8,AmphoraIcon:z8,Anchor:B8,AnchorIcon:B8,Angry:$8,AngryIcon:$8,Annoyed:U8,AnnoyedIcon:U8,Antenna:q8,AntennaIcon:q8,Anvil:V8,AnvilIcon:V8,Aperture:H8,ApertureIcon:H8,AppWindow:XT,AppWindowIcon:XT,AppWindowMac:W8,AppWindowMacIcon:W8,Apple:G8,AppleIcon:G8,Archive:Y8,ArchiveIcon:Y8,ArchiveRestore:K8,ArchiveRestoreIcon:K8,ArchiveX:Z8,ArchiveXIcon:Z8,AreaChart:K_,AreaChartIcon:K_,Armchair:X8,ArmchairIcon:X8,ArrowBigDown:J8,ArrowBigDownDash:Q8,ArrowBigDownDashIcon:Q8,ArrowBigDownIcon:J8,ArrowBigLeft:tD,ArrowBigLeftDash:eD,ArrowBigLeftDashIcon:eD,ArrowBigLeftIcon:tD,ArrowBigRight:nD,ArrowBigRightDash:rD,ArrowBigRightDashIcon:rD,ArrowBigRightIcon:nD,ArrowBigUp:aD,ArrowBigUpDash:sD,ArrowBigUpDashIcon:sD,ArrowBigUpIcon:aD,ArrowDown:ay,ArrowDown01:iD,ArrowDown01Icon:iD,ArrowDown10:oD,ArrowDown10Icon:oD,ArrowDownAZ:O_,ArrowDownAZIcon:O_,ArrowDownAz:O_,ArrowDownAzIcon:O_,ArrowDownCircle:ib,ArrowDownCircleIcon:ib,ArrowDownFromLine:lD,ArrowDownFromLineIcon:lD,ArrowDownIcon:ay,ArrowDownLeft:cD,ArrowDownLeftFromCircle:lb,ArrowDownLeftFromCircleIcon:lb,ArrowDownLeftFromSquare:O2,ArrowDownLeftFromSquareIcon:O2,ArrowDownLeftIcon:cD,ArrowDownLeftSquare:E2,ArrowDownLeftSquareIcon:E2,ArrowDownNarrowWide:dD,ArrowDownNarrowWideIcon:dD,ArrowDownRight:uD,ArrowDownRightFromCircle:cb,ArrowDownRightFromCircleIcon:cb,ArrowDownRightFromSquare:D2,ArrowDownRightFromSquareIcon:D2,ArrowDownRightIcon:uD,ArrowDownRightSquare:I2,ArrowDownRightSquareIcon:I2,ArrowDownSquare:P2,ArrowDownSquareIcon:P2,ArrowDownToDot:hD,ArrowDownToDotIcon:hD,ArrowDownToLine:fD,ArrowDownToLineIcon:fD,ArrowDownUp:pD,ArrowDownUpIcon:pD,ArrowDownWideNarrow:D_,ArrowDownWideNarrowIcon:D_,ArrowDownZA:R_,ArrowDownZAIcon:R_,ArrowDownZa:R_,ArrowDownZaIcon:R_,ArrowLeft:po,ArrowLeftCircle:ob,ArrowLeftCircleIcon:ob,ArrowLeftFromLine:mD,ArrowLeftFromLineIcon:mD,ArrowLeftIcon:po,ArrowLeftRight:gD,ArrowLeftRightIcon:gD,ArrowLeftSquare:L2,ArrowLeftSquareIcon:L2,ArrowLeftToLine:xD,ArrowLeftToLineIcon:xD,ArrowRight:Vo,ArrowRightCircle:hb,ArrowRightCircleIcon:hb,ArrowRightFromLine:yD,ArrowRightFromLineIcon:yD,ArrowRightIcon:Vo,ArrowRightLeft:vD,ArrowRightLeftIcon:vD,ArrowRightSquare:z2,ArrowRightSquareIcon:z2,ArrowRightToLine:_D,ArrowRightToLineIcon:_D,ArrowUp:cp,ArrowUp01:bD,ArrowUp01Icon:bD,ArrowUp10:wD,ArrowUp10Icon:wD,ArrowUpAZ:F_,ArrowUpAZIcon:F_,ArrowUpAz:F_,ArrowUpAzIcon:F_,ArrowUpCircle:fb,ArrowUpCircleIcon:fb,ArrowUpDown:Pg,ArrowUpDownIcon:Pg,ArrowUpFromDot:jD,ArrowUpFromDotIcon:jD,ArrowUpFromLine:kD,ArrowUpFromLineIcon:kD,ArrowUpIcon:cp,ArrowUpLeft:ND,ArrowUpLeftFromCircle:db,ArrowUpLeftFromCircleIcon:db,ArrowUpLeftFromSquare:R2,ArrowUpLeftFromSquareIcon:R2,ArrowUpLeftIcon:ND,ArrowUpLeftSquare:B2,ArrowUpLeftSquareIcon:B2,ArrowUpNarrowWide:z_,ArrowUpNarrowWideIcon:z_,ArrowUpRight:SD,ArrowUpRightFromCircle:ub,ArrowUpRightFromCircleIcon:ub,ArrowUpRightFromSquare:F2,ArrowUpRightFromSquareIcon:F2,ArrowUpRightIcon:SD,ArrowUpRightSquare:$2,ArrowUpRightSquareIcon:$2,ArrowUpSquare:U2,ArrowUpSquareIcon:U2,ArrowUpToLine:CD,ArrowUpToLineIcon:CD,ArrowUpWideNarrow:MD,ArrowUpWideNarrowIcon:MD,ArrowUpZA:B_,ArrowUpZAIcon:B_,ArrowUpZa:B_,ArrowUpZaIcon:B_,ArrowsUpFromLine:TD,ArrowsUpFromLineIcon:TD,Asterisk:AD,AsteriskIcon:AD,AsteriskSquare:q2,AsteriskSquareIcon:q2,AtSign:ED,AtSignIcon:ED,Atom:ID,AtomIcon:ID,AudioLines:PD,AudioLinesIcon:PD,AudioWaveform:LD,AudioWaveformIcon:LD,Award:zl,AwardIcon:zl,Axe:OD,AxeIcon:OD,Axis3D:$_,Axis3DIcon:$_,Axis3d:$_,Axis3dIcon:$_,Baby:DD,BabyIcon:DD,Backpack:RD,BackpackIcon:RD,Badge:JD,BadgeAlert:FD,BadgeAlertIcon:FD,BadgeCent:zD,BadgeCentIcon:zD,BadgeCheck:U_,BadgeCheckIcon:U_,BadgeDollarSign:BD,BadgeDollarSignIcon:BD,BadgeEuro:$D,BadgeEuroIcon:$D,BadgeHelp:UD,BadgeHelpIcon:UD,BadgeIcon:JD,BadgeIndianRupee:qD,BadgeIndianRupeeIcon:qD,BadgeInfo:VD,BadgeInfoIcon:VD,BadgeJapaneseYen:HD,BadgeJapaneseYenIcon:HD,BadgeMinus:WD,BadgeMinusIcon:WD,BadgePercent:GD,BadgePercentIcon:GD,BadgePlus:KD,BadgePlusIcon:KD,BadgePoundSterling:ZD,BadgePoundSterlingIcon:ZD,BadgeRussianRuble:YD,BadgeRussianRubleIcon:YD,BadgeSwissFranc:XD,BadgeSwissFrancIcon:XD,BadgeX:QD,BadgeXIcon:QD,BaggageClaim:eR,BaggageClaimIcon:eR,Ban:tR,BanIcon:tR,Banana:rR,BananaIcon:rR,Bandage:nR,BandageIcon:nR,Banknote:sR,BanknoteIcon:sR,BarChart:tb,BarChart2:rb,BarChart2Icon:rb,BarChart3:_c,BarChart3Icon:_c,BarChart4:J_,BarChart4Icon:J_,BarChartBig:Q_,BarChartBigIcon:Q_,BarChartHorizontal:Y_,BarChartHorizontalBig:Z_,BarChartHorizontalBigIcon:Z_,BarChartHorizontalIcon:Y_,BarChartIcon:tb,Barcode:aR,BarcodeIcon:aR,Baseline:iR,BaselineIcon:iR,Bath:F1,BathIcon:F1,Battery:hR,BatteryCharging:oR,BatteryChargingIcon:oR,BatteryFull:lR,BatteryFullIcon:lR,BatteryIcon:hR,BatteryLow:cR,BatteryLowIcon:cR,BatteryMedium:dR,BatteryMediumIcon:dR,BatteryWarning:uR,BatteryWarningIcon:uR,Beaker:fR,BeakerIcon:fR,Bean:mR,BeanIcon:mR,BeanOff:pR,BeanOffIcon:pR,Bed:z1,BedDouble:gR,BedDoubleIcon:gR,BedIcon:z1,BedSingle:xR,BedSingleIcon:xR,Beef:yR,BeefIcon:yR,Beer:_R,BeerIcon:_R,BeerOff:vR,BeerOffIcon:vR,Bell:Lg,BellDot:bR,BellDotIcon:bR,BellElectric:wR,BellElectricIcon:wR,BellIcon:Lg,BellMinus:jR,BellMinusIcon:jR,BellOff:Sj,BellOffIcon:Sj,BellPlus:kR,BellPlusIcon:kR,BellRing:NR,BellRingIcon:NR,BetweenHorizonalEnd:q_,BetweenHorizonalEndIcon:q_,BetweenHorizonalStart:V_,BetweenHorizonalStartIcon:V_,BetweenHorizontalEnd:q_,BetweenHorizontalEndIcon:q_,BetweenHorizontalStart:V_,BetweenHorizontalStartIcon:V_,BetweenVerticalEnd:SR,BetweenVerticalEndIcon:SR,BetweenVerticalStart:CR,BetweenVerticalStartIcon:CR,BicepsFlexed:MR,BicepsFlexedIcon:MR,Bike:TR,BikeIcon:TR,Binary:AR,BinaryIcon:AR,Binoculars:ER,BinocularsIcon:ER,Biohazard:IR,BiohazardIcon:IR,Bird:PR,BirdIcon:PR,Bitcoin:LR,BitcoinIcon:LR,Blend:OR,BlendIcon:OR,Blinds:DR,BlindsIcon:DR,Blocks:RR,BlocksIcon:RR,Bluetooth:$R,BluetoothConnected:FR,BluetoothConnectedIcon:FR,BluetoothIcon:$R,BluetoothOff:zR,BluetoothOffIcon:zR,BluetoothSearching:BR,BluetoothSearchingIcon:BR,Bold:vS,BoldIcon:vS,Bolt:UR,BoltIcon:UR,Bomb:qR,BombIcon:qR,Bone:VR,BoneIcon:VR,Book:hF,BookA:HR,BookAIcon:HR,BookAudio:WR,BookAudioIcon:WR,BookCheck:GR,BookCheckIcon:GR,BookCopy:KR,BookCopyIcon:KR,BookDashed:H_,BookDashedIcon:H_,BookDown:ZR,BookDownIcon:ZR,BookHeadphones:YR,BookHeadphonesIcon:YR,BookHeart:XR,BookHeartIcon:XR,BookIcon:hF,BookImage:QR,BookImageIcon:QR,BookKey:JR,BookKeyIcon:JR,BookLock:eF,BookLockIcon:eF,BookMarked:tF,BookMarkedIcon:tF,BookMinus:rF,BookMinusIcon:rF,BookOpen:QT,BookOpenCheck:nF,BookOpenCheckIcon:nF,BookOpenIcon:QT,BookOpenText:sF,BookOpenTextIcon:sF,BookPlus:aF,BookPlusIcon:aF,BookTemplate:H_,BookTemplateIcon:H_,BookText:iF,BookTextIcon:iF,BookType:oF,BookTypeIcon:oF,BookUp:cF,BookUp2:lF,BookUp2Icon:lF,BookUpIcon:cF,BookUser:dF,BookUserIcon:dF,BookX:uF,BookXIcon:uF,Bookmark:Sm,BookmarkCheck:fF,BookmarkCheckIcon:fF,BookmarkIcon:Sm,BookmarkMinus:pF,BookmarkMinusIcon:pF,BookmarkPlus:JT,BookmarkPlusIcon:JT,BookmarkX:mF,BookmarkXIcon:mF,BoomBox:gF,BoomBoxIcon:gF,Bot:_S,BotIcon:_S,BotMessageSquare:xF,BotMessageSquareIcon:xF,BotOff:yF,BotOffIcon:yF,Box:vF,BoxIcon:vF,BoxSelect:J2,BoxSelectIcon:J2,Boxes:_F,BoxesIcon:_F,Braces:W_,BracesIcon:W_,Brackets:bF,BracketsIcon:bF,Brain:eA,BrainCircuit:wF,BrainCircuitIcon:wF,BrainCog:jF,BrainCogIcon:jF,BrainIcon:eA,BrickWall:kF,BrickWallIcon:kF,Briefcase:Ah,BriefcaseBusiness:NF,BriefcaseBusinessIcon:NF,BriefcaseConveyorBelt:SF,BriefcaseConveyorBeltIcon:SF,BriefcaseIcon:Ah,BriefcaseMedical:CF,BriefcaseMedicalIcon:CF,BringToFront:MF,BringToFrontIcon:MF,Brush:TF,BrushIcon:TF,Bug:IF,BugIcon:IF,BugOff:AF,BugOffIcon:AF,BugPlay:EF,BugPlayIcon:EF,Building:Cj,Building2:hi,Building2Icon:hi,BuildingIcon:Cj,Bus:LF,BusFront:PF,BusFrontIcon:PF,BusIcon:LF,Cable:DF,CableCar:OF,CableCarIcon:OF,CableIcon:DF,Cake:hf,CakeIcon:hf,CakeSlice:RF,CakeSliceIcon:RF,Calculator:FF,CalculatorIcon:FF,Calendar:Ss,Calendar1:zF,Calendar1Icon:zF,CalendarArrowDown:BF,CalendarArrowDownIcon:BF,CalendarArrowUp:$F,CalendarArrowUpIcon:$F,CalendarCheck:qF,CalendarCheck2:UF,CalendarCheck2Icon:UF,CalendarCheckIcon:qF,CalendarClock:tA,CalendarClockIcon:tA,CalendarCog:VF,CalendarCogIcon:VF,CalendarDays:Cm,CalendarDaysIcon:Cm,CalendarFold:HF,CalendarFoldIcon:HF,CalendarHeart:WF,CalendarHeartIcon:WF,CalendarIcon:Ss,CalendarMinus:KF,CalendarMinus2:GF,CalendarMinus2Icon:GF,CalendarMinusIcon:KF,CalendarOff:ZF,CalendarOffIcon:ZF,CalendarPlus:Mj,CalendarPlus2:YF,CalendarPlus2Icon:YF,CalendarPlusIcon:Mj,CalendarRange:XF,CalendarRangeIcon:XF,CalendarSearch:QF,CalendarSearchIcon:QF,CalendarSync:JF,CalendarSyncIcon:JF,CalendarX:tz,CalendarX2:ez,CalendarX2Icon:ez,CalendarXIcon:tz,Camera:Og,CameraIcon:Og,CameraOff:rz,CameraOffIcon:rz,CandlestickChart:X_,CandlestickChartIcon:X_,Candy:az,CandyCane:nz,CandyCaneIcon:nz,CandyIcon:az,CandyOff:sz,CandyOffIcon:sz,Cannabis:iz,CannabisIcon:iz,Captions:G_,CaptionsIcon:G_,CaptionsOff:oz,CaptionsOffIcon:oz,Car:dz,CarFront:lz,CarFrontIcon:lz,CarIcon:dz,CarTaxiFront:cz,CarTaxiFrontIcon:cz,Caravan:uz,CaravanIcon:uz,Carrot:hz,CarrotIcon:hz,CaseLower:fz,CaseLowerIcon:fz,CaseSensitive:pz,CaseSensitiveIcon:pz,CaseUpper:mz,CaseUpperIcon:mz,CassetteTape:gz,CassetteTapeIcon:gz,Cast:xz,CastIcon:xz,Castle:yz,CastleIcon:yz,Cat:vz,CatIcon:vz,Cctv:_z,CctvIcon:_z,ChartArea:K_,ChartAreaIcon:K_,ChartBar:Y_,ChartBarBig:Z_,ChartBarBigIcon:Z_,ChartBarDecreasing:bz,ChartBarDecreasingIcon:bz,ChartBarIcon:Y_,ChartBarIncreasing:wz,ChartBarIncreasingIcon:wz,ChartBarStacked:jz,ChartBarStackedIcon:jz,ChartCandlestick:X_,ChartCandlestickIcon:X_,ChartColumn:_c,ChartColumnBig:Q_,ChartColumnBigIcon:Q_,ChartColumnDecreasing:kz,ChartColumnDecreasingIcon:kz,ChartColumnIcon:_c,ChartColumnIncreasing:J_,ChartColumnIncreasingIcon:J_,ChartColumnStacked:Nz,ChartColumnStackedIcon:Nz,ChartGantt:Sz,ChartGanttIcon:Sz,ChartLine:eb,ChartLineIcon:eb,ChartNetwork:Cz,ChartNetworkIcon:Cz,ChartNoAxesColumn:rb,ChartNoAxesColumnDecreasing:Mz,ChartNoAxesColumnDecreasingIcon:Mz,ChartNoAxesColumnIcon:rb,ChartNoAxesColumnIncreasing:tb,ChartNoAxesColumnIncreasingIcon:tb,ChartNoAxesCombined:Tz,ChartNoAxesCombinedIcon:Tz,ChartNoAxesGantt:nb,ChartNoAxesGanttIcon:nb,ChartPie:sb,ChartPieIcon:sb,ChartScatter:ab,ChartScatterIcon:ab,ChartSpline:Az,ChartSplineIcon:Az,Check:Ni,CheckCheck:Ez,CheckCheckIcon:Ez,CheckCircle:di,CheckCircle2:so,CheckCircle2Icon:so,CheckCircleIcon:di,CheckIcon:Ni,CheckSquare:K0,CheckSquare2:H2,CheckSquare2Icon:H2,CheckSquareIcon:K0,ChefHat:Iz,ChefHatIcon:Iz,Cherry:Pz,CherryIcon:Pz,ChevronDown:Dd,ChevronDownCircle:pb,ChevronDownCircleIcon:pb,ChevronDownIcon:Dd,ChevronDownSquare:W2,ChevronDownSquareIcon:W2,ChevronFirst:Lz,ChevronFirstIcon:Lz,ChevronLast:Oz,ChevronLastIcon:Oz,ChevronLeft:kc,ChevronLeftCircle:mb,ChevronLeftCircleIcon:mb,ChevronLeftIcon:kc,ChevronLeftSquare:G2,ChevronLeftSquareIcon:G2,ChevronRight:Wi,ChevronRightCircle:gb,ChevronRightCircleIcon:gb,ChevronRightIcon:Wi,ChevronRightSquare:K2,ChevronRightSquareIcon:K2,ChevronUp:iy,ChevronUpCircle:xb,ChevronUpCircleIcon:xb,ChevronUpIcon:iy,ChevronUpSquare:Z2,ChevronUpSquareIcon:Z2,ChevronsDown:Rz,ChevronsDownIcon:Rz,ChevronsDownUp:Dz,ChevronsDownUpIcon:Dz,ChevronsLeft:Bz,ChevronsLeftIcon:Bz,ChevronsLeftRight:zz,ChevronsLeftRightEllipsis:Fz,ChevronsLeftRightEllipsisIcon:Fz,ChevronsLeftRightIcon:zz,ChevronsRight:Uz,ChevronsRightIcon:Uz,ChevronsRightLeft:$z,ChevronsRightLeftIcon:$z,ChevronsUp:qz,ChevronsUpDown:oy,ChevronsUpDownIcon:oy,ChevronsUpIcon:qz,Chrome:Vz,ChromeIcon:Vz,Church:Hz,ChurchIcon:Hz,Cigarette:Gz,CigaretteIcon:Gz,CigaretteOff:Wz,CigaretteOffIcon:Wz,Circle:Qu,CircleAlert:yl,CircleAlertIcon:yl,CircleArrowDown:ib,CircleArrowDownIcon:ib,CircleArrowLeft:ob,CircleArrowLeftIcon:ob,CircleArrowOutDownLeft:lb,CircleArrowOutDownLeftIcon:lb,CircleArrowOutDownRight:cb,CircleArrowOutDownRightIcon:cb,CircleArrowOutUpLeft:db,CircleArrowOutUpLeftIcon:db,CircleArrowOutUpRight:ub,CircleArrowOutUpRightIcon:ub,CircleArrowRight:hb,CircleArrowRightIcon:hb,CircleArrowUp:fb,CircleArrowUpIcon:fb,CircleCheck:so,CircleCheckBig:di,CircleCheckBigIcon:di,CircleCheckIcon:so,CircleChevronDown:pb,CircleChevronDownIcon:pb,CircleChevronLeft:mb,CircleChevronLeftIcon:mb,CircleChevronRight:gb,CircleChevronRightIcon:gb,CircleChevronUp:xb,CircleChevronUpIcon:xb,CircleDashed:Kz,CircleDashedIcon:Kz,CircleDivide:yb,CircleDivideIcon:yb,CircleDollarSign:Zz,CircleDollarSignIcon:Zz,CircleDot:Xz,CircleDotDashed:Yz,CircleDotDashedIcon:Yz,CircleDotIcon:Xz,CircleEllipsis:Qz,CircleEllipsisIcon:Qz,CircleEqual:Jz,CircleEqualIcon:Jz,CircleFadingArrowUp:e7,CircleFadingArrowUpIcon:e7,CircleFadingPlus:t7,CircleFadingPlusIcon:t7,CircleGauge:vb,CircleGaugeIcon:vb,CircleHelp:Hx,CircleHelpIcon:Hx,CircleIcon:Qu,CircleMinus:_b,CircleMinusIcon:_b,CircleOff:r7,CircleOffIcon:r7,CircleParking:wb,CircleParkingIcon:wb,CircleParkingOff:bb,CircleParkingOffIcon:bb,CirclePause:jb,CirclePauseIcon:jb,CirclePercent:kb,CirclePercentIcon:kb,CirclePlay:rp,CirclePlayIcon:rp,CirclePlus:Nb,CirclePlusIcon:Nb,CirclePower:Sb,CirclePowerIcon:Sb,CircleSlash:n7,CircleSlash2:Cb,CircleSlash2Icon:Cb,CircleSlashIcon:n7,CircleSlashed:Cb,CircleSlashedIcon:Cb,CircleStop:Mb,CircleStopIcon:Mb,CircleUser:Ab,CircleUserIcon:Ab,CircleUserRound:Tb,CircleUserRoundIcon:Tb,CircleX:bc,CircleXIcon:bc,CircuitBoard:s7,CircuitBoardIcon:s7,Citrus:a7,CitrusIcon:a7,Clapperboard:i7,ClapperboardIcon:i7,Clipboard:f7,ClipboardCheck:rA,ClipboardCheckIcon:rA,ClipboardCopy:o7,ClipboardCopyIcon:o7,ClipboardEdit:Ib,ClipboardEditIcon:Ib,ClipboardIcon:f7,ClipboardList:nA,ClipboardListIcon:nA,ClipboardMinus:l7,ClipboardMinusIcon:l7,ClipboardPaste:c7,ClipboardPasteIcon:c7,ClipboardPen:Ib,ClipboardPenIcon:Ib,ClipboardPenLine:Eb,ClipboardPenLineIcon:Eb,ClipboardPlus:d7,ClipboardPlusIcon:d7,ClipboardSignature:Eb,ClipboardSignatureIcon:Eb,ClipboardType:u7,ClipboardTypeIcon:u7,ClipboardX:h7,ClipboardXIcon:h7,Clock:Ya,Clock1:p7,Clock10:m7,Clock10Icon:m7,Clock11:g7,Clock11Icon:g7,Clock12:x7,Clock12Icon:x7,Clock1Icon:p7,Clock2:y7,Clock2Icon:y7,Clock3:v7,Clock3Icon:v7,Clock4:_7,Clock4Icon:_7,Clock5:b7,Clock5Icon:b7,Clock6:w7,Clock6Icon:w7,Clock7:j7,Clock7Icon:j7,Clock8:k7,Clock8Icon:k7,Clock9:N7,Clock9Icon:N7,ClockAlert:S7,ClockAlertIcon:S7,ClockArrowDown:C7,ClockArrowDownIcon:C7,ClockArrowUp:M7,ClockArrowUpIcon:M7,ClockIcon:Ya,Cloud:q7,CloudAlert:T7,CloudAlertIcon:T7,CloudCog:A7,CloudCogIcon:A7,CloudDownload:Pb,CloudDownloadIcon:Pb,CloudDrizzle:E7,CloudDrizzleIcon:E7,CloudFog:I7,CloudFogIcon:I7,CloudHail:P7,CloudHailIcon:P7,CloudIcon:q7,CloudLightning:L7,CloudLightningIcon:L7,CloudMoon:D7,CloudMoonIcon:D7,CloudMoonRain:O7,CloudMoonRainIcon:O7,CloudOff:R7,CloudOffIcon:R7,CloudRain:z7,CloudRainIcon:z7,CloudRainWind:F7,CloudRainWindIcon:F7,CloudSnow:B7,CloudSnowIcon:B7,CloudSun:U7,CloudSunIcon:U7,CloudSunRain:$7,CloudSunRainIcon:$7,CloudUpload:Lb,CloudUploadIcon:Lb,Cloudy:V7,CloudyIcon:V7,Clover:Jx,CloverIcon:Jx,Club:H7,ClubIcon:H7,Code:Tj,Code2:Ob,Code2Icon:Ob,CodeIcon:Tj,CodeSquare:Y2,CodeSquareIcon:Y2,CodeXml:Ob,CodeXmlIcon:Ob,Codepen:W7,CodepenIcon:W7,Codesandbox:G7,CodesandboxIcon:G7,Coffee:Aj,CoffeeIcon:Aj,Cog:K7,CogIcon:K7,Coins:Z7,CoinsIcon:Z7,Columns:Db,Columns2:Db,Columns2Icon:Db,Columns3:Rb,Columns3Icon:Rb,Columns4:Y7,Columns4Icon:Y7,ColumnsIcon:Db,Combine:X7,CombineIcon:X7,Command:Q7,CommandIcon:Q7,Compass:J7,CompassIcon:J7,Component:e9,ComponentIcon:e9,Computer:t9,ComputerIcon:t9,ConciergeBell:r9,ConciergeBellIcon:r9,Cone:n9,ConeIcon:n9,Construction:s9,ConstructionIcon:s9,Contact:a9,Contact2:Fb,Contact2Icon:Fb,ContactIcon:a9,ContactRound:Fb,ContactRoundIcon:Fb,Container:i9,ContainerIcon:i9,Contrast:o9,ContrastIcon:o9,Cookie:l9,CookieIcon:l9,CookingPot:c9,CookingPotIcon:c9,Copy:Wo,CopyCheck:d9,CopyCheckIcon:d9,CopyIcon:Wo,CopyMinus:u9,CopyMinusIcon:u9,CopyPlus:h9,CopyPlusIcon:h9,CopySlash:f9,CopySlashIcon:f9,CopyX:p9,CopyXIcon:p9,Copyleft:m9,CopyleftIcon:m9,Copyright:g9,CopyrightIcon:g9,CornerDownLeft:x9,CornerDownLeftIcon:x9,CornerDownRight:y9,CornerDownRightIcon:y9,CornerLeftDown:v9,CornerLeftDownIcon:v9,CornerLeftUp:_9,CornerLeftUpIcon:_9,CornerRightDown:b9,CornerRightDownIcon:b9,CornerRightUp:w9,CornerRightUpIcon:w9,CornerUpLeft:j9,CornerUpLeftIcon:j9,CornerUpRight:k9,CornerUpRightIcon:k9,Cpu:N9,CpuIcon:N9,CreativeCommons:S9,CreativeCommonsIcon:S9,CreditCard:Mm,CreditCardIcon:Mm,Croissant:C9,CroissantIcon:C9,Crop:M9,CropIcon:M9,Cross:T9,CrossIcon:T9,Crosshair:A9,CrosshairIcon:A9,Crown:B1,CrownIcon:B1,Cuboid:E9,CuboidIcon:E9,CupSoda:I9,CupSodaIcon:I9,CurlyBraces:W_,CurlyBracesIcon:W_,Currency:P9,CurrencyIcon:P9,Cylinder:L9,CylinderIcon:L9,Dam:O9,DamIcon:O9,Database:F9,DatabaseBackup:D9,DatabaseBackupIcon:D9,DatabaseIcon:F9,DatabaseZap:R9,DatabaseZapIcon:R9,Delete:z9,DeleteIcon:z9,Dessert:B9,DessertIcon:B9,Diameter:$9,DiameterIcon:$9,Diamond:V9,DiamondIcon:V9,DiamondMinus:U9,DiamondMinusIcon:U9,DiamondPercent:zb,DiamondPercentIcon:zb,DiamondPlus:q9,DiamondPlusIcon:q9,Dice1:H9,Dice1Icon:H9,Dice2:W9,Dice2Icon:W9,Dice3:G9,Dice3Icon:G9,Dice4:K9,Dice4Icon:K9,Dice5:Z9,Dice5Icon:Z9,Dice6:Y9,Dice6Icon:Y9,Dices:X9,DicesIcon:X9,Diff:Q9,DiffIcon:Q9,Disc:rB,Disc2:J9,Disc2Icon:J9,Disc3:eB,Disc3Icon:eB,DiscAlbum:tB,DiscAlbumIcon:tB,DiscIcon:rB,Divide:nB,DivideCircle:yb,DivideCircleIcon:yb,DivideIcon:nB,DivideSquare:ew,DivideSquareIcon:ew,Dna:aB,DnaIcon:aB,DnaOff:sB,DnaOffIcon:sB,Dock:iB,DockIcon:iB,Dog:oB,DogIcon:oB,DollarSign:Rd,DollarSignIcon:Rd,Donut:lB,DonutIcon:lB,DoorClosed:cB,DoorClosedIcon:cB,DoorOpen:Ej,DoorOpenIcon:Ej,Dot:dB,DotIcon:dB,DotSquare:tw,DotSquareIcon:tw,Download:io,DownloadCloud:Pb,DownloadCloudIcon:Pb,DownloadIcon:io,DraftingCompass:uB,DraftingCompassIcon:uB,Drama:hB,DramaIcon:hB,Dribbble:fB,DribbbleIcon:fB,Drill:pB,DrillIcon:pB,Droplet:mB,DropletIcon:mB,Droplets:gB,DropletsIcon:gB,Drum:xB,DrumIcon:xB,Drumstick:yB,DrumstickIcon:yB,Dumbbell:vB,DumbbellIcon:vB,Ear:bB,EarIcon:bB,EarOff:_B,EarOffIcon:_B,Earth:Bb,EarthIcon:Bb,EarthLock:wB,EarthLockIcon:wB,Eclipse:jB,EclipseIcon:jB,Edit:gc,Edit2:G0,Edit2Icon:G0,Edit3:W0,Edit3Icon:W0,EditIcon:gc,Egg:bS,EggFried:kB,EggFriedIcon:kB,EggIcon:bS,EggOff:NB,EggOffIcon:NB,Ellipsis:pm,EllipsisIcon:pm,EllipsisVertical:Wx,EllipsisVerticalIcon:Wx,Equal:MB,EqualApproximately:SB,EqualApproximatelyIcon:SB,EqualIcon:MB,EqualNot:CB,EqualNotIcon:CB,EqualSquare:rw,EqualSquareIcon:rw,Eraser:TB,EraserIcon:TB,EthernetPort:AB,EthernetPortIcon:AB,Euro:EB,EuroIcon:EB,Expand:IB,ExpandIcon:IB,ExternalLink:As,ExternalLinkIcon:As,Eye:Ko,EyeClosed:PB,EyeClosedIcon:PB,EyeIcon:Ko,EyeOff:$1,EyeOffIcon:$1,Facebook:au,FacebookIcon:au,Factory:LB,FactoryIcon:LB,Fan:OB,FanIcon:OB,FastForward:DB,FastForwardIcon:DB,Feather:RB,FeatherIcon:RB,Fence:FB,FenceIcon:FB,FerrisWheel:zB,FerrisWheelIcon:zB,Figma:BB,FigmaIcon:BB,File:L$,FileArchive:$B,FileArchiveIcon:$B,FileAudio:qB,FileAudio2:UB,FileAudio2Icon:UB,FileAudioIcon:qB,FileAxis3D:$b,FileAxis3DIcon:$b,FileAxis3d:$b,FileAxis3dIcon:$b,FileBadge:HB,FileBadge2:VB,FileBadge2Icon:VB,FileBadgeIcon:HB,FileBarChart:Ub,FileBarChart2:qb,FileBarChart2Icon:qb,FileBarChartIcon:Ub,FileBox:WB,FileBoxIcon:WB,FileChartColumn:qb,FileChartColumnIcon:qb,FileChartColumnIncreasing:Ub,FileChartColumnIncreasingIcon:Ub,FileChartLine:Vb,FileChartLineIcon:Vb,FileChartPie:Hb,FileChartPieIcon:Hb,FileCheck:KB,FileCheck2:GB,FileCheck2Icon:GB,FileCheckIcon:KB,FileClock:ZB,FileClockIcon:ZB,FileCode:XB,FileCode2:YB,FileCode2Icon:YB,FileCodeIcon:XB,FileCog:Wb,FileCog2:Wb,FileCog2Icon:Wb,FileCogIcon:Wb,FileDiff:QB,FileDiffIcon:QB,FileDigit:JB,FileDigitIcon:JB,FileDown:e$,FileDownIcon:e$,FileEdit:Kb,FileEditIcon:Kb,FileHeart:t$,FileHeartIcon:t$,FileIcon:L$,FileImage:U1,FileImageIcon:U1,FileInput:r$,FileInputIcon:r$,FileJson:s$,FileJson2:n$,FileJson2Icon:n$,FileJsonIcon:s$,FileKey:i$,FileKey2:a$,FileKey2Icon:a$,FileKeyIcon:i$,FileLineChart:Vb,FileLineChartIcon:Vb,FileLock:l$,FileLock2:o$,FileLock2Icon:o$,FileLockIcon:l$,FileMinus:d$,FileMinus2:c$,FileMinus2Icon:c$,FileMinusIcon:d$,FileMusic:u$,FileMusicIcon:u$,FileOutput:h$,FileOutputIcon:h$,FilePen:Kb,FilePenIcon:Kb,FilePenLine:Gb,FilePenLineIcon:Gb,FilePieChart:Hb,FilePieChartIcon:Hb,FilePlus:p$,FilePlus2:f$,FilePlus2Icon:f$,FilePlusIcon:p$,FileQuestion:m$,FileQuestionIcon:m$,FileScan:g$,FileScanIcon:g$,FileSearch:y$,FileSearch2:x$,FileSearch2Icon:x$,FileSearchIcon:y$,FileSignature:Gb,FileSignatureIcon:Gb,FileSliders:v$,FileSlidersIcon:v$,FileSpreadsheet:q1,FileSpreadsheetIcon:q1,FileStack:_$,FileStackIcon:_$,FileSymlink:b$,FileSymlinkIcon:b$,FileTerminal:w$,FileTerminalIcon:w$,FileText:Ea,FileTextIcon:Ea,FileType:k$,FileType2:j$,FileType2Icon:j$,FileTypeIcon:k$,FileUp:N$,FileUpIcon:N$,FileUser:S$,FileUserIcon:S$,FileVideo:M$,FileVideo2:C$,FileVideo2Icon:C$,FileVideoIcon:M$,FileVolume:A$,FileVolume2:T$,FileVolume2Icon:T$,FileVolumeIcon:A$,FileWarning:E$,FileWarningIcon:E$,FileX:P$,FileX2:I$,FileX2Icon:I$,FileXIcon:P$,Files:O$,FilesIcon:O$,Film:eu,FilmIcon:eu,Filter:V1,FilterIcon:V1,FilterX:D$,FilterXIcon:D$,Fingerprint:R$,FingerprintIcon:R$,FireExtinguisher:F$,FireExtinguisherIcon:F$,Fish:$$,FishIcon:$$,FishOff:z$,FishOffIcon:z$,FishSymbol:B$,FishSymbolIcon:B$,Flag:ly,FlagIcon:ly,FlagOff:U$,FlagOffIcon:U$,FlagTriangleLeft:q$,FlagTriangleLeftIcon:q$,FlagTriangleRight:V$,FlagTriangleRightIcon:V$,Flame:ff,FlameIcon:ff,FlameKindling:H$,FlameKindlingIcon:H$,Flashlight:G$,FlashlightIcon:G$,FlashlightOff:W$,FlashlightOffIcon:W$,FlaskConical:Ij,FlaskConicalIcon:Ij,FlaskConicalOff:K$,FlaskConicalOffIcon:K$,FlaskRound:Z$,FlaskRoundIcon:Z$,FlipHorizontal:X$,FlipHorizontal2:Y$,FlipHorizontal2Icon:Y$,FlipHorizontalIcon:X$,FlipVertical:J$,FlipVertical2:Q$,FlipVertical2Icon:Q$,FlipVerticalIcon:J$,Flower:eU,Flower2:vm,Flower2Icon:vm,FlowerIcon:eU,Focus:tU,FocusIcon:tU,FoldHorizontal:rU,FoldHorizontalIcon:rU,FoldVertical:nU,FoldVerticalIcon:nU,Folder:AU,FolderArchive:sU,FolderArchiveIcon:sU,FolderCheck:aU,FolderCheckIcon:aU,FolderClock:iU,FolderClockIcon:iU,FolderClosed:oU,FolderClosedIcon:oU,FolderCode:lU,FolderCodeIcon:lU,FolderCog:Zb,FolderCog2:Zb,FolderCog2Icon:Zb,FolderCogIcon:Zb,FolderDot:cU,FolderDotIcon:cU,FolderDown:dU,FolderDownIcon:dU,FolderEdit:Yb,FolderEditIcon:Yb,FolderGit:hU,FolderGit2:uU,FolderGit2Icon:uU,FolderGitIcon:hU,FolderHeart:fU,FolderHeartIcon:fU,FolderIcon:AU,FolderInput:pU,FolderInputIcon:pU,FolderKanban:mU,FolderKanbanIcon:mU,FolderKey:gU,FolderKeyIcon:gU,FolderLock:xU,FolderLockIcon:xU,FolderMinus:yU,FolderMinusIcon:yU,FolderOpen:Tm,FolderOpenDot:vU,FolderOpenDotIcon:vU,FolderOpenIcon:Tm,FolderOutput:_U,FolderOutputIcon:_U,FolderPen:Yb,FolderPenIcon:Yb,FolderPlus:bU,FolderPlusIcon:bU,FolderRoot:wU,FolderRootIcon:wU,FolderSearch:kU,FolderSearch2:jU,FolderSearch2Icon:jU,FolderSearchIcon:kU,FolderSymlink:NU,FolderSymlinkIcon:NU,FolderSync:SU,FolderSyncIcon:SU,FolderTree:CU,FolderTreeIcon:CU,FolderUp:MU,FolderUpIcon:MU,FolderX:TU,FolderXIcon:TU,Folders:EU,FoldersIcon:EU,Footprints:IU,FootprintsIcon:IU,ForkKnife:$w,ForkKnifeCrossed:Bw,ForkKnifeCrossedIcon:Bw,ForkKnifeIcon:$w,Forklift:PU,ForkliftIcon:PU,FormInput:w2,FormInputIcon:w2,Forward:LU,ForwardIcon:LU,Frame:OU,FrameIcon:OU,Framer:DU,FramerIcon:DU,Frown:RU,FrownIcon:RU,Fuel:FU,FuelIcon:FU,Fullscreen:zU,FullscreenIcon:zU,FunctionSquare:nw,FunctionSquareIcon:nw,GalleryHorizontal:$U,GalleryHorizontalEnd:BU,GalleryHorizontalEndIcon:BU,GalleryHorizontalIcon:$U,GalleryThumbnails:UU,GalleryThumbnailsIcon:UU,GalleryVertical:VU,GalleryVerticalEnd:qU,GalleryVerticalEndIcon:qU,GalleryVerticalIcon:VU,Gamepad:WU,Gamepad2:HU,Gamepad2Icon:HU,GamepadIcon:WU,GanttChart:nb,GanttChartIcon:nb,GanttChartSquare:pg,GanttChartSquareIcon:pg,Gauge:GU,GaugeCircle:vb,GaugeCircleIcon:vb,GaugeIcon:GU,Gavel:KU,GavelIcon:KU,Gem:ZU,GemIcon:ZU,Ghost:Pj,GhostIcon:Pj,Gift:to,GiftIcon:to,GitBranch:XU,GitBranchIcon:XU,GitBranchPlus:YU,GitBranchPlusIcon:YU,GitCommit:Xb,GitCommitHorizontal:Xb,GitCommitHorizontalIcon:Xb,GitCommitIcon:Xb,GitCommitVertical:QU,GitCommitVerticalIcon:QU,GitCompare:eq,GitCompareArrows:JU,GitCompareArrowsIcon:JU,GitCompareIcon:eq,GitFork:tq,GitForkIcon:tq,GitGraph:rq,GitGraphIcon:rq,GitMerge:nq,GitMergeIcon:nq,GitPullRequest:cq,GitPullRequestArrow:sq,GitPullRequestArrowIcon:sq,GitPullRequestClosed:aq,GitPullRequestClosedIcon:aq,GitPullRequestCreate:oq,GitPullRequestCreateArrow:iq,GitPullRequestCreateArrowIcon:iq,GitPullRequestCreateIcon:oq,GitPullRequestDraft:lq,GitPullRequestDraftIcon:lq,GitPullRequestIcon:cq,Github:dq,GithubIcon:dq,Gitlab:uq,GitlabIcon:uq,GlassWater:hq,GlassWaterIcon:hq,Glasses:fq,GlassesIcon:fq,Globe:cy,Globe2:Bb,Globe2Icon:Bb,GlobeIcon:cy,GlobeLock:pq,GlobeLockIcon:pq,Goal:mq,GoalIcon:mq,Grab:gq,GrabIcon:gq,GraduationCap:H1,GraduationCapIcon:H1,Grape:xq,GrapeIcon:xq,Grid:Qh,Grid2X2:Jb,Grid2X2Icon:Jb,Grid2X2Plus:Qb,Grid2X2PlusIcon:Qb,Grid2x2:Jb,Grid2x2Check:yq,Grid2x2CheckIcon:yq,Grid2x2Icon:Jb,Grid2x2Plus:Qb,Grid2x2PlusIcon:Qb,Grid2x2X:vq,Grid2x2XIcon:vq,Grid3X3:Qh,Grid3X3Icon:Qh,Grid3x3:Qh,Grid3x3Icon:Qh,GridIcon:Qh,Grip:bq,GripHorizontal:_q,GripHorizontalIcon:_q,GripIcon:bq,GripVertical:dy,GripVerticalIcon:dy,Group:wq,GroupIcon:wq,Guitar:jq,GuitarIcon:jq,Ham:kq,HamIcon:kq,Hammer:Nq,HammerIcon:Nq,Hand:Aq,HandCoins:Sq,HandCoinsIcon:Sq,HandHeart:Cq,HandHeartIcon:Cq,HandHelping:e2,HandHelpingIcon:e2,HandIcon:Aq,HandMetal:Mq,HandMetalIcon:Mq,HandPlatter:Tq,HandPlatterIcon:Tq,Handshake:Eq,HandshakeIcon:Eq,HardDrive:sA,HardDriveDownload:Iq,HardDriveDownloadIcon:Iq,HardDriveIcon:sA,HardDriveUpload:Pq,HardDriveUploadIcon:Pq,HardHat:Lq,HardHatIcon:Lq,Hash:wS,HashIcon:wS,Haze:Oq,HazeIcon:Oq,HdmiPort:Dq,HdmiPortIcon:Dq,Heading:$q,Heading1:aA,Heading1Icon:aA,Heading2:iA,Heading2Icon:iA,Heading3:Rq,Heading3Icon:Rq,Heading4:Fq,Heading4Icon:Fq,Heading5:zq,Heading5Icon:zq,Heading6:Bq,Heading6Icon:Bq,HeadingIcon:$q,HeadphoneOff:Uq,HeadphoneOffIcon:Uq,Headphones:qq,HeadphonesIcon:qq,Headset:Vq,HeadsetIcon:Vq,Heart:xi,HeartCrack:Hq,HeartCrackIcon:Hq,HeartHandshake:Wq,HeartHandshakeIcon:Wq,HeartIcon:xi,HeartOff:Gq,HeartOffIcon:Gq,HeartPulse:Kq,HeartPulseIcon:Kq,Heater:Zq,HeaterIcon:Zq,HelpCircle:Hx,HelpCircleIcon:Hx,HelpingHand:e2,HelpingHandIcon:e2,Hexagon:Yq,HexagonIcon:Yq,Highlighter:Xq,HighlighterIcon:Xq,History:jS,HistoryIcon:jS,Home:xa,HomeIcon:xa,Hop:Jq,HopIcon:Jq,HopOff:Qq,HopOffIcon:Qq,Hospital:eV,HospitalIcon:eV,Hotel:tV,HotelIcon:tV,Hourglass:rV,HourglassIcon:rV,House:xa,HouseIcon:xa,HousePlug:nV,HousePlugIcon:nV,HousePlus:sV,HousePlusIcon:sV,IceCream:r2,IceCream2:t2,IceCream2Icon:t2,IceCreamBowl:t2,IceCreamBowlIcon:t2,IceCreamCone:r2,IceCreamConeIcon:r2,IceCreamIcon:r2,Icon:NIe,IdCard:aV,IdCardIcon:aV,Image:Rl,ImageDown:iV,ImageDownIcon:iV,ImageIcon:Rl,ImageMinus:oV,ImageMinusIcon:oV,ImageOff:lV,ImageOffIcon:lV,ImagePlay:cV,ImagePlayIcon:cV,ImagePlus:kS,ImagePlusIcon:kS,ImageUp:dV,ImageUpIcon:dV,ImageUpscale:uV,ImageUpscaleIcon:uV,Images:hV,ImagesIcon:hV,Import:fV,ImportIcon:fV,Inbox:pV,InboxIcon:pV,Indent:s2,IndentDecrease:n2,IndentDecreaseIcon:n2,IndentIcon:s2,IndentIncrease:s2,IndentIncreaseIcon:s2,IndianRupee:mV,IndianRupeeIcon:mV,Infinity:gV,InfinityIcon:gV,Info:xV,InfoIcon:xV,Inspect:cw,InspectIcon:cw,InspectionPanel:yV,InspectionPanelIcon:yV,Instagram:_u,InstagramIcon:_u,Italic:NS,ItalicIcon:NS,IterationCcw:vV,IterationCcwIcon:vV,IterationCw:_V,IterationCwIcon:_V,JapaneseYen:bV,JapaneseYenIcon:bV,Joystick:wV,JoystickIcon:wV,Kanban:uy,KanbanIcon:uy,KanbanSquare:sw,KanbanSquareDashed:X2,KanbanSquareDashedIcon:X2,KanbanSquareIcon:sw,Key:pf,KeyIcon:pf,KeyRound:Lj,KeyRoundIcon:Lj,KeySquare:jV,KeySquareIcon:jV,Keyboard:SV,KeyboardIcon:SV,KeyboardMusic:kV,KeyboardMusicIcon:kV,KeyboardOff:NV,KeyboardOffIcon:NV,Lamp:IV,LampCeiling:CV,LampCeilingIcon:CV,LampDesk:MV,LampDeskIcon:MV,LampFloor:TV,LampFloorIcon:TV,LampIcon:IV,LampWallDown:AV,LampWallDownIcon:AV,LampWallUp:EV,LampWallUpIcon:EV,LandPlot:PV,LandPlotIcon:PV,Landmark:LV,LandmarkIcon:LV,Languages:OV,LanguagesIcon:OV,Laptop:RV,Laptop2:a2,Laptop2Icon:a2,LaptopIcon:RV,LaptopMinimal:a2,LaptopMinimalCheck:DV,LaptopMinimalCheckIcon:DV,LaptopMinimalIcon:a2,Lasso:zV,LassoIcon:zV,LassoSelect:FV,LassoSelectIcon:FV,Laugh:BV,LaughIcon:BV,Layers:qV,Layers2:$V,Layers2Icon:$V,Layers3:UV,Layers3Icon:UV,LayersIcon:qV,Layout:H0,LayoutDashboard:Oj,LayoutDashboardIcon:Oj,LayoutGrid:dp,LayoutGridIcon:dp,LayoutIcon:H0,LayoutList:VV,LayoutListIcon:VV,LayoutPanelLeft:HV,LayoutPanelLeftIcon:HV,LayoutPanelTop:WV,LayoutPanelTopIcon:WV,LayoutTemplate:Dj,LayoutTemplateIcon:Dj,Leaf:GV,LeafIcon:GV,LeafyGreen:KV,LeafyGreenIcon:KV,Lectern:ZV,LecternIcon:ZV,LetterText:YV,LetterTextIcon:YV,Library:SS,LibraryBig:XV,LibraryBigIcon:XV,LibraryIcon:SS,LibrarySquare:aw,LibrarySquareIcon:aw,LifeBuoy:CS,LifeBuoyIcon:CS,Ligature:QV,LigatureIcon:QV,Lightbulb:W1,LightbulbIcon:W1,LightbulbOff:JV,LightbulbOffIcon:JV,LineChart:eb,LineChartIcon:eb,Link:Io,Link2:mf,Link2Icon:mf,Link2Off:eH,Link2OffIcon:eH,LinkIcon:Io,Linkedin:gf,LinkedinIcon:gf,List:up,ListCheck:tH,ListCheckIcon:tH,ListChecks:rH,ListChecksIcon:rH,ListCollapse:nH,ListCollapseIcon:nH,ListEnd:sH,ListEndIcon:sH,ListFilter:aH,ListFilterIcon:aH,ListIcon:up,ListMinus:iH,ListMinusIcon:iH,ListMusic:oH,ListMusicIcon:oH,ListOrdered:MS,ListOrderedIcon:MS,ListPlus:lH,ListPlusIcon:lH,ListRestart:cH,ListRestartIcon:cH,ListStart:dH,ListStartIcon:dH,ListTodo:uH,ListTodoIcon:uH,ListTree:hH,ListTreeIcon:hH,ListVideo:fH,ListVideoIcon:fH,ListX:pH,ListXIcon:pH,Loader:gH,Loader2:Zr,Loader2Icon:Zr,LoaderCircle:Zr,LoaderCircleIcon:Zr,LoaderIcon:gH,LoaderPinwheel:mH,LoaderPinwheelIcon:mH,Locate:oA,LocateFixed:xH,LocateFixedIcon:xH,LocateIcon:oA,LocateOff:yH,LocateOffIcon:yH,Lock:hp,LockIcon:hp,LockKeyhole:vH,LockKeyholeIcon:vH,LockKeyholeOpen:i2,LockKeyholeOpenIcon:i2,LockOpen:o2,LockOpenIcon:o2,LogIn:TS,LogInIcon:TS,LogOut:AS,LogOutIcon:AS,Logs:_H,LogsIcon:_H,Lollipop:bH,LollipopIcon:bH,LucideAArrowDown:n8,LucideAArrowUp:s8,LucideALargeSmall:a8,LucideAccessibility:i8,LucideActivity:Ig,LucideActivitySquare:A2,LucideAirVent:o8,LucideAirplay:l8,LucideAlarmCheck:I_,LucideAlarmClock:d8,LucideAlarmClockCheck:I_,LucideAlarmClockMinus:P_,LucideAlarmClockOff:c8,LucideAlarmClockPlus:L_,LucideAlarmMinus:P_,LucideAlarmPlus:L_,LucideAlarmSmoke:u8,LucideAlbum:h8,LucideAlertCircle:yl,LucideAlertOctagon:d2,LucideAlertTriangle:rf,LucideAlignCenter:gS,LucideAlignCenterHorizontal:f8,LucideAlignCenterVertical:p8,LucideAlignEndHorizontal:m8,LucideAlignEndVertical:g8,LucideAlignHorizontalDistributeCenter:x8,LucideAlignHorizontalDistributeEnd:y8,LucideAlignHorizontalDistributeStart:v8,LucideAlignHorizontalJustifyCenter:_8,LucideAlignHorizontalJustifyEnd:b8,LucideAlignHorizontalJustifyStart:w8,LucideAlignHorizontalSpaceAround:j8,LucideAlignHorizontalSpaceBetween:k8,LucideAlignJustify:N8,LucideAlignLeft:xS,LucideAlignRight:yS,LucideAlignStartHorizontal:S8,LucideAlignStartVertical:C8,LucideAlignVerticalDistributeCenter:M8,LucideAlignVerticalDistributeEnd:T8,LucideAlignVerticalDistributeStart:A8,LucideAlignVerticalJustifyCenter:E8,LucideAlignVerticalJustifyEnd:I8,LucideAlignVerticalJustifyStart:P8,LucideAlignVerticalSpaceAround:L8,LucideAlignVerticalSpaceBetween:O8,LucideAmbulance:D8,LucideAmpersand:R8,LucideAmpersands:F8,LucideAmphora:z8,LucideAnchor:B8,LucideAngry:$8,LucideAnnoyed:U8,LucideAntenna:q8,LucideAnvil:V8,LucideAperture:H8,LucideAppWindow:XT,LucideAppWindowMac:W8,LucideApple:G8,LucideArchive:Y8,LucideArchiveRestore:K8,LucideArchiveX:Z8,LucideAreaChart:K_,LucideArmchair:X8,LucideArrowBigDown:J8,LucideArrowBigDownDash:Q8,LucideArrowBigLeft:tD,LucideArrowBigLeftDash:eD,LucideArrowBigRight:nD,LucideArrowBigRightDash:rD,LucideArrowBigUp:aD,LucideArrowBigUpDash:sD,LucideArrowDown:ay,LucideArrowDown01:iD,LucideArrowDown10:oD,LucideArrowDownAZ:O_,LucideArrowDownAz:O_,LucideArrowDownCircle:ib,LucideArrowDownFromLine:lD,LucideArrowDownLeft:cD,LucideArrowDownLeftFromCircle:lb,LucideArrowDownLeftFromSquare:O2,LucideArrowDownLeftSquare:E2,LucideArrowDownNarrowWide:dD,LucideArrowDownRight:uD,LucideArrowDownRightFromCircle:cb,LucideArrowDownRightFromSquare:D2,LucideArrowDownRightSquare:I2,LucideArrowDownSquare:P2,LucideArrowDownToDot:hD,LucideArrowDownToLine:fD,LucideArrowDownUp:pD,LucideArrowDownWideNarrow:D_,LucideArrowDownZA:R_,LucideArrowDownZa:R_,LucideArrowLeft:po,LucideArrowLeftCircle:ob,LucideArrowLeftFromLine:mD,LucideArrowLeftRight:gD,LucideArrowLeftSquare:L2,LucideArrowLeftToLine:xD,LucideArrowRight:Vo,LucideArrowRightCircle:hb,LucideArrowRightFromLine:yD,LucideArrowRightLeft:vD,LucideArrowRightSquare:z2,LucideArrowRightToLine:_D,LucideArrowUp:cp,LucideArrowUp01:bD,LucideArrowUp10:wD,LucideArrowUpAZ:F_,LucideArrowUpAz:F_,LucideArrowUpCircle:fb,LucideArrowUpDown:Pg,LucideArrowUpFromDot:jD,LucideArrowUpFromLine:kD,LucideArrowUpLeft:ND,LucideArrowUpLeftFromCircle:db,LucideArrowUpLeftFromSquare:R2,LucideArrowUpLeftSquare:B2,LucideArrowUpNarrowWide:z_,LucideArrowUpRight:SD,LucideArrowUpRightFromCircle:ub,LucideArrowUpRightFromSquare:F2,LucideArrowUpRightSquare:$2,LucideArrowUpSquare:U2,LucideArrowUpToLine:CD,LucideArrowUpWideNarrow:MD,LucideArrowUpZA:B_,LucideArrowUpZa:B_,LucideArrowsUpFromLine:TD,LucideAsterisk:AD,LucideAsteriskSquare:q2,LucideAtSign:ED,LucideAtom:ID,LucideAudioLines:PD,LucideAudioWaveform:LD,LucideAward:zl,LucideAxe:OD,LucideAxis3D:$_,LucideAxis3d:$_,LucideBaby:DD,LucideBackpack:RD,LucideBadge:JD,LucideBadgeAlert:FD,LucideBadgeCent:zD,LucideBadgeCheck:U_,LucideBadgeDollarSign:BD,LucideBadgeEuro:$D,LucideBadgeHelp:UD,LucideBadgeIndianRupee:qD,LucideBadgeInfo:VD,LucideBadgeJapaneseYen:HD,LucideBadgeMinus:WD,LucideBadgePercent:GD,LucideBadgePlus:KD,LucideBadgePoundSterling:ZD,LucideBadgeRussianRuble:YD,LucideBadgeSwissFranc:XD,LucideBadgeX:QD,LucideBaggageClaim:eR,LucideBan:tR,LucideBanana:rR,LucideBandage:nR,LucideBanknote:sR,LucideBarChart:tb,LucideBarChart2:rb,LucideBarChart3:_c,LucideBarChart4:J_,LucideBarChartBig:Q_,LucideBarChartHorizontal:Y_,LucideBarChartHorizontalBig:Z_,LucideBarcode:aR,LucideBaseline:iR,LucideBath:F1,LucideBattery:hR,LucideBatteryCharging:oR,LucideBatteryFull:lR,LucideBatteryLow:cR,LucideBatteryMedium:dR,LucideBatteryWarning:uR,LucideBeaker:fR,LucideBean:mR,LucideBeanOff:pR,LucideBed:z1,LucideBedDouble:gR,LucideBedSingle:xR,LucideBeef:yR,LucideBeer:_R,LucideBeerOff:vR,LucideBell:Lg,LucideBellDot:bR,LucideBellElectric:wR,LucideBellMinus:jR,LucideBellOff:Sj,LucideBellPlus:kR,LucideBellRing:NR,LucideBetweenHorizonalEnd:q_,LucideBetweenHorizonalStart:V_,LucideBetweenHorizontalEnd:q_,LucideBetweenHorizontalStart:V_,LucideBetweenVerticalEnd:SR,LucideBetweenVerticalStart:CR,LucideBicepsFlexed:MR,LucideBike:TR,LucideBinary:AR,LucideBinoculars:ER,LucideBiohazard:IR,LucideBird:PR,LucideBitcoin:LR,LucideBlend:OR,LucideBlinds:DR,LucideBlocks:RR,LucideBluetooth:$R,LucideBluetoothConnected:FR,LucideBluetoothOff:zR,LucideBluetoothSearching:BR,LucideBold:vS,LucideBolt:UR,LucideBomb:qR,LucideBone:VR,LucideBook:hF,LucideBookA:HR,LucideBookAudio:WR,LucideBookCheck:GR,LucideBookCopy:KR,LucideBookDashed:H_,LucideBookDown:ZR,LucideBookHeadphones:YR,LucideBookHeart:XR,LucideBookImage:QR,LucideBookKey:JR,LucideBookLock:eF,LucideBookMarked:tF,LucideBookMinus:rF,LucideBookOpen:QT,LucideBookOpenCheck:nF,LucideBookOpenText:sF,LucideBookPlus:aF,LucideBookTemplate:H_,LucideBookText:iF,LucideBookType:oF,LucideBookUp:cF,LucideBookUp2:lF,LucideBookUser:dF,LucideBookX:uF,LucideBookmark:Sm,LucideBookmarkCheck:fF,LucideBookmarkMinus:pF,LucideBookmarkPlus:JT,LucideBookmarkX:mF,LucideBoomBox:gF,LucideBot:_S,LucideBotMessageSquare:xF,LucideBotOff:yF,LucideBox:vF,LucideBoxSelect:J2,LucideBoxes:_F,LucideBraces:W_,LucideBrackets:bF,LucideBrain:eA,LucideBrainCircuit:wF,LucideBrainCog:jF,LucideBrickWall:kF,LucideBriefcase:Ah,LucideBriefcaseBusiness:NF,LucideBriefcaseConveyorBelt:SF,LucideBriefcaseMedical:CF,LucideBringToFront:MF,LucideBrush:TF,LucideBug:IF,LucideBugOff:AF,LucideBugPlay:EF,LucideBuilding:Cj,LucideBuilding2:hi,LucideBus:LF,LucideBusFront:PF,LucideCable:DF,LucideCableCar:OF,LucideCake:hf,LucideCakeSlice:RF,LucideCalculator:FF,LucideCalendar:Ss,LucideCalendar1:zF,LucideCalendarArrowDown:BF,LucideCalendarArrowUp:$F,LucideCalendarCheck:qF,LucideCalendarCheck2:UF,LucideCalendarClock:tA,LucideCalendarCog:VF,LucideCalendarDays:Cm,LucideCalendarFold:HF,LucideCalendarHeart:WF,LucideCalendarMinus:KF,LucideCalendarMinus2:GF,LucideCalendarOff:ZF,LucideCalendarPlus:Mj,LucideCalendarPlus2:YF,LucideCalendarRange:XF,LucideCalendarSearch:QF,LucideCalendarSync:JF,LucideCalendarX:tz,LucideCalendarX2:ez,LucideCamera:Og,LucideCameraOff:rz,LucideCandlestickChart:X_,LucideCandy:az,LucideCandyCane:nz,LucideCandyOff:sz,LucideCannabis:iz,LucideCaptions:G_,LucideCaptionsOff:oz,LucideCar:dz,LucideCarFront:lz,LucideCarTaxiFront:cz,LucideCaravan:uz,LucideCarrot:hz,LucideCaseLower:fz,LucideCaseSensitive:pz,LucideCaseUpper:mz,LucideCassetteTape:gz,LucideCast:xz,LucideCastle:yz,LucideCat:vz,LucideCctv:_z,LucideChartArea:K_,LucideChartBar:Y_,LucideChartBarBig:Z_,LucideChartBarDecreasing:bz,LucideChartBarIncreasing:wz,LucideChartBarStacked:jz,LucideChartCandlestick:X_,LucideChartColumn:_c,LucideChartColumnBig:Q_,LucideChartColumnDecreasing:kz,LucideChartColumnIncreasing:J_,LucideChartColumnStacked:Nz,LucideChartGantt:Sz,LucideChartLine:eb,LucideChartNetwork:Cz,LucideChartNoAxesColumn:rb,LucideChartNoAxesColumnDecreasing:Mz,LucideChartNoAxesColumnIncreasing:tb,LucideChartNoAxesCombined:Tz,LucideChartNoAxesGantt:nb,LucideChartPie:sb,LucideChartScatter:ab,LucideChartSpline:Az,LucideCheck:Ni,LucideCheckCheck:Ez,LucideCheckCircle:di,LucideCheckCircle2:so,LucideCheckSquare:K0,LucideCheckSquare2:H2,LucideChefHat:Iz,LucideCherry:Pz,LucideChevronDown:Dd,LucideChevronDownCircle:pb,LucideChevronDownSquare:W2,LucideChevronFirst:Lz,LucideChevronLast:Oz,LucideChevronLeft:kc,LucideChevronLeftCircle:mb,LucideChevronLeftSquare:G2,LucideChevronRight:Wi,LucideChevronRightCircle:gb,LucideChevronRightSquare:K2,LucideChevronUp:iy,LucideChevronUpCircle:xb,LucideChevronUpSquare:Z2,LucideChevronsDown:Rz,LucideChevronsDownUp:Dz,LucideChevronsLeft:Bz,LucideChevronsLeftRight:zz,LucideChevronsLeftRightEllipsis:Fz,LucideChevronsRight:Uz,LucideChevronsRightLeft:$z,LucideChevronsUp:qz,LucideChevronsUpDown:oy,LucideChrome:Vz,LucideChurch:Hz,LucideCigarette:Gz,LucideCigaretteOff:Wz,LucideCircle:Qu,LucideCircleAlert:yl,LucideCircleArrowDown:ib,LucideCircleArrowLeft:ob,LucideCircleArrowOutDownLeft:lb,LucideCircleArrowOutDownRight:cb,LucideCircleArrowOutUpLeft:db,LucideCircleArrowOutUpRight:ub,LucideCircleArrowRight:hb,LucideCircleArrowUp:fb,LucideCircleCheck:so,LucideCircleCheckBig:di,LucideCircleChevronDown:pb,LucideCircleChevronLeft:mb,LucideCircleChevronRight:gb,LucideCircleChevronUp:xb,LucideCircleDashed:Kz,LucideCircleDivide:yb,LucideCircleDollarSign:Zz,LucideCircleDot:Xz,LucideCircleDotDashed:Yz,LucideCircleEllipsis:Qz,LucideCircleEqual:Jz,LucideCircleFadingArrowUp:e7,LucideCircleFadingPlus:t7,LucideCircleGauge:vb,LucideCircleHelp:Hx,LucideCircleMinus:_b,LucideCircleOff:r7,LucideCircleParking:wb,LucideCircleParkingOff:bb,LucideCirclePause:jb,LucideCirclePercent:kb,LucideCirclePlay:rp,LucideCirclePlus:Nb,LucideCirclePower:Sb,LucideCircleSlash:n7,LucideCircleSlash2:Cb,LucideCircleSlashed:Cb,LucideCircleStop:Mb,LucideCircleUser:Ab,LucideCircleUserRound:Tb,LucideCircleX:bc,LucideCircuitBoard:s7,LucideCitrus:a7,LucideClapperboard:i7,LucideClipboard:f7,LucideClipboardCheck:rA,LucideClipboardCopy:o7,LucideClipboardEdit:Ib,LucideClipboardList:nA,LucideClipboardMinus:l7,LucideClipboardPaste:c7,LucideClipboardPen:Ib,LucideClipboardPenLine:Eb,LucideClipboardPlus:d7,LucideClipboardSignature:Eb,LucideClipboardType:u7,LucideClipboardX:h7,LucideClock:Ya,LucideClock1:p7,LucideClock10:m7,LucideClock11:g7,LucideClock12:x7,LucideClock2:y7,LucideClock3:v7,LucideClock4:_7,LucideClock5:b7,LucideClock6:w7,LucideClock7:j7,LucideClock8:k7,LucideClock9:N7,LucideClockAlert:S7,LucideClockArrowDown:C7,LucideClockArrowUp:M7,LucideCloud:q7,LucideCloudAlert:T7,LucideCloudCog:A7,LucideCloudDownload:Pb,LucideCloudDrizzle:E7,LucideCloudFog:I7,LucideCloudHail:P7,LucideCloudLightning:L7,LucideCloudMoon:D7,LucideCloudMoonRain:O7,LucideCloudOff:R7,LucideCloudRain:z7,LucideCloudRainWind:F7,LucideCloudSnow:B7,LucideCloudSun:U7,LucideCloudSunRain:$7,LucideCloudUpload:Lb,LucideCloudy:V7,LucideClover:Jx,LucideClub:H7,LucideCode:Tj,LucideCode2:Ob,LucideCodeSquare:Y2,LucideCodeXml:Ob,LucideCodepen:W7,LucideCodesandbox:G7,LucideCoffee:Aj,LucideCog:K7,LucideCoins:Z7,LucideColumns:Db,LucideColumns2:Db,LucideColumns3:Rb,LucideColumns4:Y7,LucideCombine:X7,LucideCommand:Q7,LucideCompass:J7,LucideComponent:e9,LucideComputer:t9,LucideConciergeBell:r9,LucideCone:n9,LucideConstruction:s9,LucideContact:a9,LucideContact2:Fb,LucideContactRound:Fb,LucideContainer:i9,LucideContrast:o9,LucideCookie:l9,LucideCookingPot:c9,LucideCopy:Wo,LucideCopyCheck:d9,LucideCopyMinus:u9,LucideCopyPlus:h9,LucideCopySlash:f9,LucideCopyX:p9,LucideCopyleft:m9,LucideCopyright:g9,LucideCornerDownLeft:x9,LucideCornerDownRight:y9,LucideCornerLeftDown:v9,LucideCornerLeftUp:_9,LucideCornerRightDown:b9,LucideCornerRightUp:w9,LucideCornerUpLeft:j9,LucideCornerUpRight:k9,LucideCpu:N9,LucideCreativeCommons:S9,LucideCreditCard:Mm,LucideCroissant:C9,LucideCrop:M9,LucideCross:T9,LucideCrosshair:A9,LucideCrown:B1,LucideCuboid:E9,LucideCupSoda:I9,LucideCurlyBraces:W_,LucideCurrency:P9,LucideCylinder:L9,LucideDam:O9,LucideDatabase:F9,LucideDatabaseBackup:D9,LucideDatabaseZap:R9,LucideDelete:z9,LucideDessert:B9,LucideDiameter:$9,LucideDiamond:V9,LucideDiamondMinus:U9,LucideDiamondPercent:zb,LucideDiamondPlus:q9,LucideDice1:H9,LucideDice2:W9,LucideDice3:G9,LucideDice4:K9,LucideDice5:Z9,LucideDice6:Y9,LucideDices:X9,LucideDiff:Q9,LucideDisc:rB,LucideDisc2:J9,LucideDisc3:eB,LucideDiscAlbum:tB,LucideDivide:nB,LucideDivideCircle:yb,LucideDivideSquare:ew,LucideDna:aB,LucideDnaOff:sB,LucideDock:iB,LucideDog:oB,LucideDollarSign:Rd,LucideDonut:lB,LucideDoorClosed:cB,LucideDoorOpen:Ej,LucideDot:dB,LucideDotSquare:tw,LucideDownload:io,LucideDownloadCloud:Pb,LucideDraftingCompass:uB,LucideDrama:hB,LucideDribbble:fB,LucideDrill:pB,LucideDroplet:mB,LucideDroplets:gB,LucideDrum:xB,LucideDrumstick:yB,LucideDumbbell:vB,LucideEar:bB,LucideEarOff:_B,LucideEarth:Bb,LucideEarthLock:wB,LucideEclipse:jB,LucideEdit:gc,LucideEdit2:G0,LucideEdit3:W0,LucideEgg:bS,LucideEggFried:kB,LucideEggOff:NB,LucideEllipsis:pm,LucideEllipsisVertical:Wx,LucideEqual:MB,LucideEqualApproximately:SB,LucideEqualNot:CB,LucideEqualSquare:rw,LucideEraser:TB,LucideEthernetPort:AB,LucideEuro:EB,LucideExpand:IB,LucideExternalLink:As,LucideEye:Ko,LucideEyeClosed:PB,LucideEyeOff:$1,LucideFacebook:au,LucideFactory:LB,LucideFan:OB,LucideFastForward:DB,LucideFeather:RB,LucideFence:FB,LucideFerrisWheel:zB,LucideFigma:BB,LucideFile:L$,LucideFileArchive:$B,LucideFileAudio:qB,LucideFileAudio2:UB,LucideFileAxis3D:$b,LucideFileAxis3d:$b,LucideFileBadge:HB,LucideFileBadge2:VB,LucideFileBarChart:Ub,LucideFileBarChart2:qb,LucideFileBox:WB,LucideFileChartColumn:qb,LucideFileChartColumnIncreasing:Ub,LucideFileChartLine:Vb,LucideFileChartPie:Hb,LucideFileCheck:KB,LucideFileCheck2:GB,LucideFileClock:ZB,LucideFileCode:XB,LucideFileCode2:YB,LucideFileCog:Wb,LucideFileCog2:Wb,LucideFileDiff:QB,LucideFileDigit:JB,LucideFileDown:e$,LucideFileEdit:Kb,LucideFileHeart:t$,LucideFileImage:U1,LucideFileInput:r$,LucideFileJson:s$,LucideFileJson2:n$,LucideFileKey:i$,LucideFileKey2:a$,LucideFileLineChart:Vb,LucideFileLock:l$,LucideFileLock2:o$,LucideFileMinus:d$,LucideFileMinus2:c$,LucideFileMusic:u$,LucideFileOutput:h$,LucideFilePen:Kb,LucideFilePenLine:Gb,LucideFilePieChart:Hb,LucideFilePlus:p$,LucideFilePlus2:f$,LucideFileQuestion:m$,LucideFileScan:g$,LucideFileSearch:y$,LucideFileSearch2:x$,LucideFileSignature:Gb,LucideFileSliders:v$,LucideFileSpreadsheet:q1,LucideFileStack:_$,LucideFileSymlink:b$,LucideFileTerminal:w$,LucideFileText:Ea,LucideFileType:k$,LucideFileType2:j$,LucideFileUp:N$,LucideFileUser:S$,LucideFileVideo:M$,LucideFileVideo2:C$,LucideFileVolume:A$,LucideFileVolume2:T$,LucideFileWarning:E$,LucideFileX:P$,LucideFileX2:I$,LucideFiles:O$,LucideFilm:eu,LucideFilter:V1,LucideFilterX:D$,LucideFingerprint:R$,LucideFireExtinguisher:F$,LucideFish:$$,LucideFishOff:z$,LucideFishSymbol:B$,LucideFlag:ly,LucideFlagOff:U$,LucideFlagTriangleLeft:q$,LucideFlagTriangleRight:V$,LucideFlame:ff,LucideFlameKindling:H$,LucideFlashlight:G$,LucideFlashlightOff:W$,LucideFlaskConical:Ij,LucideFlaskConicalOff:K$,LucideFlaskRound:Z$,LucideFlipHorizontal:X$,LucideFlipHorizontal2:Y$,LucideFlipVertical:J$,LucideFlipVertical2:Q$,LucideFlower:eU,LucideFlower2:vm,LucideFocus:tU,LucideFoldHorizontal:rU,LucideFoldVertical:nU,LucideFolder:AU,LucideFolderArchive:sU,LucideFolderCheck:aU,LucideFolderClock:iU,LucideFolderClosed:oU,LucideFolderCode:lU,LucideFolderCog:Zb,LucideFolderCog2:Zb,LucideFolderDot:cU,LucideFolderDown:dU,LucideFolderEdit:Yb,LucideFolderGit:hU,LucideFolderGit2:uU,LucideFolderHeart:fU,LucideFolderInput:pU,LucideFolderKanban:mU,LucideFolderKey:gU,LucideFolderLock:xU,LucideFolderMinus:yU,LucideFolderOpen:Tm,LucideFolderOpenDot:vU,LucideFolderOutput:_U,LucideFolderPen:Yb,LucideFolderPlus:bU,LucideFolderRoot:wU,LucideFolderSearch:kU,LucideFolderSearch2:jU,LucideFolderSymlink:NU,LucideFolderSync:SU,LucideFolderTree:CU,LucideFolderUp:MU,LucideFolderX:TU,LucideFolders:EU,LucideFootprints:IU,LucideForkKnife:$w,LucideForkKnifeCrossed:Bw,LucideForklift:PU,LucideFormInput:w2,LucideForward:LU,LucideFrame:OU,LucideFramer:DU,LucideFrown:RU,LucideFuel:FU,LucideFullscreen:zU,LucideFunctionSquare:nw,LucideGalleryHorizontal:$U,LucideGalleryHorizontalEnd:BU,LucideGalleryThumbnails:UU,LucideGalleryVertical:VU,LucideGalleryVerticalEnd:qU,LucideGamepad:WU,LucideGamepad2:HU,LucideGanttChart:nb,LucideGanttChartSquare:pg,LucideGauge:GU,LucideGaugeCircle:vb,LucideGavel:KU,LucideGem:ZU,LucideGhost:Pj,LucideGift:to,LucideGitBranch:XU,LucideGitBranchPlus:YU,LucideGitCommit:Xb,LucideGitCommitHorizontal:Xb,LucideGitCommitVertical:QU,LucideGitCompare:eq,LucideGitCompareArrows:JU,LucideGitFork:tq,LucideGitGraph:rq,LucideGitMerge:nq,LucideGitPullRequest:cq,LucideGitPullRequestArrow:sq,LucideGitPullRequestClosed:aq,LucideGitPullRequestCreate:oq,LucideGitPullRequestCreateArrow:iq,LucideGitPullRequestDraft:lq,LucideGithub:dq,LucideGitlab:uq,LucideGlassWater:hq,LucideGlasses:fq,LucideGlobe:cy,LucideGlobe2:Bb,LucideGlobeLock:pq,LucideGoal:mq,LucideGrab:gq,LucideGraduationCap:H1,LucideGrape:xq,LucideGrid:Qh,LucideGrid2X2:Jb,LucideGrid2X2Plus:Qb,LucideGrid2x2:Jb,LucideGrid2x2Check:yq,LucideGrid2x2Plus:Qb,LucideGrid2x2X:vq,LucideGrid3X3:Qh,LucideGrid3x3:Qh,LucideGrip:bq,LucideGripHorizontal:_q,LucideGripVertical:dy,LucideGroup:wq,LucideGuitar:jq,LucideHam:kq,LucideHammer:Nq,LucideHand:Aq,LucideHandCoins:Sq,LucideHandHeart:Cq,LucideHandHelping:e2,LucideHandMetal:Mq,LucideHandPlatter:Tq,LucideHandshake:Eq,LucideHardDrive:sA,LucideHardDriveDownload:Iq,LucideHardDriveUpload:Pq,LucideHardHat:Lq,LucideHash:wS,LucideHaze:Oq,LucideHdmiPort:Dq,LucideHeading:$q,LucideHeading1:aA,LucideHeading2:iA,LucideHeading3:Rq,LucideHeading4:Fq,LucideHeading5:zq,LucideHeading6:Bq,LucideHeadphoneOff:Uq,LucideHeadphones:qq,LucideHeadset:Vq,LucideHeart:xi,LucideHeartCrack:Hq,LucideHeartHandshake:Wq,LucideHeartOff:Gq,LucideHeartPulse:Kq,LucideHeater:Zq,LucideHelpCircle:Hx,LucideHelpingHand:e2,LucideHexagon:Yq,LucideHighlighter:Xq,LucideHistory:jS,LucideHome:xa,LucideHop:Jq,LucideHopOff:Qq,LucideHospital:eV,LucideHotel:tV,LucideHourglass:rV,LucideHouse:xa,LucideHousePlug:nV,LucideHousePlus:sV,LucideIceCream:r2,LucideIceCream2:t2,LucideIceCreamBowl:t2,LucideIceCreamCone:r2,LucideIdCard:aV,LucideImage:Rl,LucideImageDown:iV,LucideImageMinus:oV,LucideImageOff:lV,LucideImagePlay:cV,LucideImagePlus:kS,LucideImageUp:dV,LucideImageUpscale:uV,LucideImages:hV,LucideImport:fV,LucideInbox:pV,LucideIndent:s2,LucideIndentDecrease:n2,LucideIndentIncrease:s2,LucideIndianRupee:mV,LucideInfinity:gV,LucideInfo:xV,LucideInspect:cw,LucideInspectionPanel:yV,LucideInstagram:_u,LucideItalic:NS,LucideIterationCcw:vV,LucideIterationCw:_V,LucideJapaneseYen:bV,LucideJoystick:wV,LucideKanban:uy,LucideKanbanSquare:sw,LucideKanbanSquareDashed:X2,LucideKey:pf,LucideKeyRound:Lj,LucideKeySquare:jV,LucideKeyboard:SV,LucideKeyboardMusic:kV,LucideKeyboardOff:NV,LucideLamp:IV,LucideLampCeiling:CV,LucideLampDesk:MV,LucideLampFloor:TV,LucideLampWallDown:AV,LucideLampWallUp:EV,LucideLandPlot:PV,LucideLandmark:LV,LucideLanguages:OV,LucideLaptop:RV,LucideLaptop2:a2,LucideLaptopMinimal:a2,LucideLaptopMinimalCheck:DV,LucideLasso:zV,LucideLassoSelect:FV,LucideLaugh:BV,LucideLayers:qV,LucideLayers2:$V,LucideLayers3:UV,LucideLayout:H0,LucideLayoutDashboard:Oj,LucideLayoutGrid:dp,LucideLayoutList:VV,LucideLayoutPanelLeft:HV,LucideLayoutPanelTop:WV,LucideLayoutTemplate:Dj,LucideLeaf:GV,LucideLeafyGreen:KV,LucideLectern:ZV,LucideLetterText:YV,LucideLibrary:SS,LucideLibraryBig:XV,LucideLibrarySquare:aw,LucideLifeBuoy:CS,LucideLigature:QV,LucideLightbulb:W1,LucideLightbulbOff:JV,LucideLineChart:eb,LucideLink:Io,LucideLink2:mf,LucideLink2Off:eH,LucideLinkedin:gf,LucideList:up,LucideListCheck:tH,LucideListChecks:rH,LucideListCollapse:nH,LucideListEnd:sH,LucideListFilter:aH,LucideListMinus:iH,LucideListMusic:oH,LucideListOrdered:MS,LucideListPlus:lH,LucideListRestart:cH,LucideListStart:dH,LucideListTodo:uH,LucideListTree:hH,LucideListVideo:fH,LucideListX:pH,LucideLoader:gH,LucideLoader2:Zr,LucideLoaderCircle:Zr,LucideLoaderPinwheel:mH,LucideLocate:oA,LucideLocateFixed:xH,LucideLocateOff:yH,LucideLock:hp,LucideLockKeyhole:vH,LucideLockKeyholeOpen:i2,LucideLockOpen:o2,LucideLogIn:TS,LucideLogOut:AS,LucideLogs:_H,LucideLollipop:bH,LucideLuggage:wH,LucideMSquare:iw,LucideMagnet:jH,LucideMail:Ns,LucideMailCheck:kH,LucideMailMinus:NH,LucideMailOpen:SH,LucideMailPlus:CH,LucideMailQuestion:MH,LucideMailSearch:TH,LucideMailWarning:AH,LucideMailX:lA,LucideMailbox:EH,LucideMails:IH,LucideMap:VH,LucideMapPin:Po,LucideMapPinCheck:LH,LucideMapPinCheckInside:PH,LucideMapPinHouse:OH,LucideMapPinMinus:RH,LucideMapPinMinusInside:DH,LucideMapPinOff:FH,LucideMapPinPlus:BH,LucideMapPinPlusInside:zH,LucideMapPinX:UH,LucideMapPinXInside:$H,LucideMapPinned:qH,LucideMartini:HH,LucideMaximize:GH,LucideMaximize2:WH,LucideMedal:hy,LucideMegaphone:Am,LucideMegaphoneOff:KH,LucideMeh:ZH,LucideMemoryStick:YH,LucideMenu:cA,LucideMenuSquare:ow,LucideMerge:XH,LucideMessageCircle:Ul,LucideMessageCircleCode:QH,LucideMessageCircleDashed:JH,LucideMessageCircleHeart:ES,LucideMessageCircleMore:eW,LucideMessageCircleOff:tW,LucideMessageCirclePlus:rW,LucideMessageCircleQuestion:dA,LucideMessageCircleReply:nW,LucideMessageCircleWarning:sW,LucideMessageCircleX:aW,LucideMessageSquare:zo,LucideMessageSquareCode:iW,LucideMessageSquareDashed:oW,LucideMessageSquareDiff:lW,LucideMessageSquareDot:cW,LucideMessageSquareHeart:dW,LucideMessageSquareLock:uW,LucideMessageSquareMore:hW,LucideMessageSquareOff:fW,LucideMessageSquarePlus:pW,LucideMessageSquareQuote:uA,LucideMessageSquareReply:mW,LucideMessageSquareShare:gW,LucideMessageSquareText:xW,LucideMessageSquareWarning:yW,LucideMessageSquareX:vW,LucideMessagesSquare:_W,LucideMic:hA,LucideMic2:l2,LucideMicOff:bW,LucideMicVocal:l2,LucideMicrochip:wW,LucideMicroscope:jW,LucideMicrowave:kW,LucideMilestone:NW,LucideMilk:CW,LucideMilkOff:SW,LucideMinimize:TW,LucideMinimize2:MW,LucideMinus:G1,LucideMinusCircle:_b,LucideMinusSquare:lw,LucideMonitor:Rj,LucideMonitorCheck:AW,LucideMonitorCog:EW,LucideMonitorDot:IW,LucideMonitorDown:PW,LucideMonitorOff:LW,LucideMonitorPause:OW,LucideMonitorPlay:DW,LucideMonitorSmartphone:RW,LucideMonitorSpeaker:FW,LucideMonitorStop:zW,LucideMonitorUp:BW,LucideMonitorX:$W,LucideMoon:qW,LucideMoonStar:UW,LucideMoreHorizontal:pm,LucideMoreVertical:Wx,LucideMountain:HW,LucideMountainSnow:VW,LucideMouse:YW,LucideMouseOff:WW,LucideMousePointer:ZW,LucideMousePointer2:GW,LucideMousePointerBan:KW,LucideMousePointerClick:Fj,LucideMousePointerSquareDashed:Q2,LucideMove:cG,LucideMove3D:c2,LucideMove3d:c2,LucideMoveDiagonal:QW,LucideMoveDiagonal2:XW,LucideMoveDown:tG,LucideMoveDownLeft:JW,LucideMoveDownRight:eG,LucideMoveHorizontal:rG,LucideMoveLeft:nG,LucideMoveRight:sG,LucideMoveUp:oG,LucideMoveUpLeft:aG,LucideMoveUpRight:iG,LucideMoveVertical:lG,LucideMusic:fG,LucideMusic2:dG,LucideMusic3:uG,LucideMusic4:hG,LucideNavigation:fA,LucideNavigation2:mG,LucideNavigation2Off:pG,LucideNavigationOff:gG,LucideNetwork:xG,LucideNewspaper:fy,LucideNfc:yG,LucideNotebook:wG,LucideNotebookPen:vG,LucideNotebookTabs:_G,LucideNotebookText:bG,LucideNotepadText:kG,LucideNotepadTextDashed:jG,LucideNut:SG,LucideNutOff:NG,LucideOctagon:MG,LucideOctagonAlert:d2,LucideOctagonMinus:CG,LucideOctagonPause:u2,LucideOctagonX:h2,LucideOmega:TG,LucideOption:AG,LucideOrbit:EG,LucideOrigami:IG,LucideOutdent:n2,LucidePackage:ql,LucidePackage2:PG,LucidePackageCheck:LG,LucidePackageMinus:OG,LucidePackageOpen:DG,LucidePackagePlus:RG,LucidePackageSearch:FG,LucidePackageX:zG,LucidePaintBucket:BG,LucidePaintRoller:$G,LucidePaintbrush:UG,LucidePaintbrush2:f2,LucidePaintbrushVertical:f2,LucidePalette:Uc,LucidePalmtree:Aw,LucidePanelBottom:HG,LucidePanelBottomClose:qG,LucidePanelBottomDashed:p2,LucidePanelBottomInactive:p2,LucidePanelBottomOpen:VG,LucidePanelLeft:y2,LucidePanelLeftClose:m2,LucidePanelLeftDashed:g2,LucidePanelLeftInactive:g2,LucidePanelLeftOpen:x2,LucidePanelRight:KG,LucidePanelRightClose:WG,LucidePanelRightDashed:v2,LucidePanelRightInactive:v2,LucidePanelRightOpen:GG,LucidePanelTop:XG,LucidePanelTopClose:ZG,LucidePanelTopDashed:_2,LucidePanelTopInactive:_2,LucidePanelTopOpen:YG,LucidePanelsLeftBottom:QG,LucidePanelsLeftRight:Rb,LucidePanelsRightBottom:JG,LucidePanelsTopBottom:N2,LucidePanelsTopLeft:H0,LucidePaperclip:eK,LucideParentheses:tK,LucideParkingCircle:wb,LucideParkingCircleOff:bb,LucideParkingMeter:rK,LucideParkingSquare:uw,LucideParkingSquareOff:dw,LucidePartyPopper:qc,LucidePause:xf,LucidePauseCircle:jb,LucidePauseOctagon:u2,LucidePawPrint:nK,LucidePcCase:sK,LucidePen:G0,LucidePenBox:gc,LucidePenLine:W0,LucidePenOff:aK,LucidePenSquare:gc,LucidePenTool:zj,LucidePencil:ni,LucidePencilLine:iK,LucidePencilOff:oK,LucidePencilRuler:lK,LucidePentagon:cK,LucidePercent:IS,LucidePercentCircle:kb,LucidePercentDiamond:zb,LucidePercentSquare:hw,LucidePersonStanding:dK,LucidePhilippinePeso:uK,LucidePhone:Ti,LucidePhoneCall:hK,LucidePhoneForwarded:fK,LucidePhoneIncoming:pK,LucidePhoneMissed:mK,LucidePhoneOff:gK,LucidePhoneOutgoing:xK,LucidePi:yK,LucidePiSquare:fw,LucidePiano:vK,LucidePickaxe:_K,LucidePictureInPicture:wK,LucidePictureInPicture2:bK,LucidePieChart:sb,LucidePiggyBank:jK,LucidePilcrow:SK,LucidePilcrowLeft:kK,LucidePilcrowRight:NK,LucidePilcrowSquare:pw,LucidePill:MK,LucidePillBottle:CK,LucidePin:K1,LucidePinOff:pA,LucidePipette:TK,LucidePizza:AK,LucidePlane:PK,LucidePlaneLanding:EK,LucidePlaneTakeoff:IK,LucidePlay:Vl,LucidePlayCircle:rp,LucidePlaySquare:mw,LucidePlug:mA,LucidePlug2:LK,LucidePlugZap:b2,LucidePlugZap2:b2,LucidePlus:bn,LucidePlusCircle:Nb,LucidePlusSquare:gw,LucidePocket:DK,LucidePocketKnife:OK,LucidePodcast:RK,LucidePointer:zK,LucidePointerOff:FK,LucidePopcorn:BK,LucidePopsicle:$K,LucidePoundSterling:UK,LucidePower:VK,LucidePowerCircle:Sb,LucidePowerOff:qK,LucidePowerSquare:xw,LucidePresentation:HK,LucidePrinter:GK,LucidePrinterCheck:WK,LucideProjector:KK,LucideProportions:ZK,LucidePuzzle:YK,LucidePyramid:XK,LucideQrCode:gA,LucideQuote:xA,LucideRabbit:QK,LucideRadar:JK,LucideRadiation:eZ,LucideRadical:tZ,LucideRadio:Bj,LucideRadioReceiver:rZ,LucideRadioTower:nZ,LucideRadius:sZ,LucideRailSymbol:aZ,LucideRainbow:iZ,LucideRat:oZ,LucideRatio:lZ,LucideReceipt:xZ,LucideReceiptCent:cZ,LucideReceiptEuro:dZ,LucideReceiptIndianRupee:uZ,LucideReceiptJapaneseYen:hZ,LucideReceiptPoundSterling:fZ,LucideReceiptRussianRuble:pZ,LucideReceiptSwissFranc:mZ,LucideReceiptText:gZ,LucideRectangleEllipsis:w2,LucideRectangleHorizontal:yZ,LucideRectangleVertical:vZ,LucideRecycle:_Z,LucideRedo:PS,LucideRedo2:bZ,LucideRedoDot:wZ,LucideRefreshCcw:kZ,LucideRefreshCcwDot:jZ,LucideRefreshCw:qo,LucideRefreshCwOff:NZ,LucideRefrigerator:SZ,LucideRegex:CZ,LucideRemoveFormatting:MZ,LucideRepeat:yA,LucideRepeat1:TZ,LucideRepeat2:AZ,LucideReplace:IZ,LucideReplaceAll:EZ,LucideReply:vA,LucideReplyAll:PZ,LucideRewind:LZ,LucideRibbon:OZ,LucideRocket:Dg,LucideRockingChair:DZ,LucideRollerCoaster:RZ,LucideRotate3D:j2,LucideRotate3d:j2,LucideRotateCcw:LS,LucideRotateCcwSquare:FZ,LucideRotateCw:_A,LucideRotateCwSquare:zZ,LucideRoute:$Z,LucideRouteOff:BZ,LucideRouter:UZ,LucideRows:k2,LucideRows2:k2,LucideRows3:N2,LucideRows4:qZ,LucideRss:VZ,LucideRuler:HZ,LucideRussianRuble:WZ,LucideSailboat:GZ,LucideSalad:KZ,LucideSandwich:ZZ,LucideSatellite:XZ,LucideSatelliteDish:YZ,LucideSave:Em,LucideSaveAll:QZ,LucideSaveOff:JZ,LucideScale:eY,LucideScale3D:S2,LucideScale3d:S2,LucideScaling:tY,LucideScan:cY,LucideScanBarcode:rY,LucideScanEye:nY,LucideScanFace:sY,LucideScanLine:aY,LucideScanQrCode:iY,LucideScanSearch:oY,LucideScanText:lY,LucideScatterChart:ab,LucideSchool:dY,LucideSchool2:Iw,LucideScissors:hY,LucideScissorsLineDashed:uY,LucideScissorsSquare:yw,LucideScissorsSquareDashedBottom:V2,LucideScreenShare:pY,LucideScreenShareOff:fY,LucideScroll:gY,LucideScrollText:mY,LucideSearch:Sa,LucideSearchCheck:xY,LucideSearchCode:yY,LucideSearchSlash:vY,LucideSearchX:_Y,LucideSection:bY,LucideSend:lo,LucideSendHorizonal:C2,LucideSendHorizontal:C2,LucideSendToBack:wY,LucideSeparatorHorizontal:jY,LucideSeparatorVertical:kY,LucideServer:MY,LucideServerCog:NY,LucideServerCrash:SY,LucideServerOff:CY,LucideSettings:Fd,LucideSettings2:TY,LucideShapes:AY,LucideShare:bA,LucideShare2:Nc,LucideSheet:EY,LucideShell:IY,LucideShield:yf,LucideShieldAlert:PY,LucideShieldBan:LY,LucideShieldCheck:wA,LucideShieldClose:M2,LucideShieldEllipsis:OY,LucideShieldHalf:DY,LucideShieldMinus:RY,LucideShieldOff:FY,LucideShieldPlus:zY,LucideShieldQuestion:BY,LucideShieldX:M2,LucideShip:UY,LucideShipWheel:$Y,LucideShirt:qY,LucideShoppingBag:Rg,LucideShoppingBasket:VY,LucideShoppingCart:Nh,LucideShovel:HY,LucideShowerHead:WY,LucideShrink:GY,LucideShrub:KY,LucideShuffle:ZY,LucideSidebar:y2,LucideSidebarClose:m2,LucideSidebarOpen:x2,LucideSigma:YY,LucideSigmaSquare:vw,LucideSignal:tX,LucideSignalHigh:XY,LucideSignalLow:QY,LucideSignalMedium:JY,LucideSignalZero:eX,LucideSignature:rX,LucideSignpost:sX,LucideSignpostBig:nX,LucideSiren:aX,LucideSkipBack:iX,LucideSkipForward:oX,LucideSkull:lX,LucideSlack:cX,LucideSlash:dX,LucideSlashSquare:_w,LucideSlice:uX,LucideSliders:T2,LucideSlidersHorizontal:jA,LucideSlidersVertical:T2,LucideSmartphone:py,LucideSmartphoneCharging:hX,LucideSmartphoneNfc:fX,LucideSmile:mX,LucideSmilePlus:pX,LucideSnail:gX,LucideSnowflake:j1,LucideSofa:xX,LucideSortAsc:z_,LucideSortDesc:D_,LucideSoup:yX,LucideSpace:vX,LucideSpade:_X,LucideSparkle:bX,LucideSparkles:Ls,LucideSpeaker:wX,LucideSpeech:jX,LucideSpellCheck:NX,LucideSpellCheck2:kX,LucideSpline:SX,LucideSplit:CX,LucideSplitSquareHorizontal:bw,LucideSplitSquareVertical:ww,LucideSprayCan:MX,LucideSprout:TX,LucideSquare:Fg,LucideSquareActivity:A2,LucideSquareArrowDown:P2,LucideSquareArrowDownLeft:E2,LucideSquareArrowDownRight:I2,LucideSquareArrowLeft:L2,LucideSquareArrowOutDownLeft:O2,LucideSquareArrowOutDownRight:D2,LucideSquareArrowOutUpLeft:R2,LucideSquareArrowOutUpRight:F2,LucideSquareArrowRight:z2,LucideSquareArrowUp:U2,LucideSquareArrowUpLeft:B2,LucideSquareArrowUpRight:$2,LucideSquareAsterisk:q2,LucideSquareBottomDashedScissors:V2,LucideSquareChartGantt:pg,LucideSquareCheck:H2,LucideSquareCheckBig:K0,LucideSquareChevronDown:W2,LucideSquareChevronLeft:G2,LucideSquareChevronRight:K2,LucideSquareChevronUp:Z2,LucideSquareCode:Y2,LucideSquareDashed:J2,LucideSquareDashedBottom:EX,LucideSquareDashedBottomCode:AX,LucideSquareDashedKanban:X2,LucideSquareDashedMousePointer:Q2,LucideSquareDivide:ew,LucideSquareDot:tw,LucideSquareEqual:rw,LucideSquareFunction:nw,LucideSquareGanttChart:pg,LucideSquareKanban:sw,LucideSquareLibrary:aw,LucideSquareM:iw,LucideSquareMenu:ow,LucideSquareMinus:lw,LucideSquareMousePointer:cw,LucideSquareParking:uw,LucideSquareParkingOff:dw,LucideSquarePen:gc,LucideSquarePercent:hw,LucideSquarePi:fw,LucideSquarePilcrow:pw,LucideSquarePlay:mw,LucideSquarePlus:gw,LucideSquarePower:xw,LucideSquareRadical:IX,LucideSquareScissors:yw,LucideSquareSigma:vw,LucideSquareSlash:_w,LucideSquareSplitHorizontal:bw,LucideSquareSplitVertical:ww,LucideSquareSquare:PX,LucideSquareStack:LX,LucideSquareTerminal:jw,LucideSquareUser:Nw,LucideSquareUserRound:kw,LucideSquareX:Sw,LucideSquircle:OX,LucideSquirrel:DX,LucideStamp:RX,LucideStar:js,LucideStarHalf:FX,LucideStarOff:zX,LucideStars:Ls,LucideStepBack:BX,LucideStepForward:$X,LucideStethoscope:UX,LucideSticker:qX,LucideStickyNote:VX,LucideStopCircle:Mb,LucideStore:HX,LucideStretchHorizontal:WX,LucideStretchVertical:GX,LucideStrikethrough:KX,LucideSubscript:ZX,LucideSubtitles:G_,LucideSun:Z1,LucideSunDim:YX,LucideSunMedium:XX,LucideSunMoon:QX,LucideSunSnow:JX,LucideSunrise:eQ,LucideSunset:tQ,LucideSuperscript:rQ,LucideSwatchBook:nQ,LucideSwissFranc:sQ,LucideSwitchCamera:aQ,LucideSword:iQ,LucideSwords:oQ,LucideSyringe:lQ,LucideTable:mQ,LucideTable2:OS,LucideTableCellsMerge:cQ,LucideTableCellsSplit:dQ,LucideTableColumnsSplit:uQ,LucideTableOfContents:hQ,LucideTableProperties:fQ,LucideTableRowsSplit:pQ,LucideTablet:xQ,LucideTabletSmartphone:gQ,LucideTablets:yQ,LucideTag:zg,LucideTags:vQ,LucideTally1:_Q,LucideTally2:bQ,LucideTally3:wQ,LucideTally4:jQ,LucideTally5:kQ,LucideTangent:NQ,LucideTarget:my,LucideTelescope:SQ,LucideTent:MQ,LucideTentTree:CQ,LucideTerminal:TQ,LucideTerminalSquare:jw,LucideTestTube:AQ,LucideTestTube2:Cw,LucideTestTubeDiagonal:Cw,LucideTestTubes:EQ,LucideText:DQ,LucideTextCursor:PQ,LucideTextCursorInput:IQ,LucideTextQuote:LQ,LucideTextSearch:OQ,LucideTextSelect:Mw,LucideTextSelection:Mw,LucideTheater:RQ,LucideThermometer:BQ,LucideThermometerSnowflake:FQ,LucideThermometerSun:zQ,LucideThumbsDown:kA,LucideThumbsUp:zd,LucideTicket:NA,LucideTicketCheck:$Q,LucideTicketMinus:UQ,LucideTicketPercent:qQ,LucideTicketPlus:VQ,LucideTicketSlash:HQ,LucideTicketX:WQ,LucideTickets:KQ,LucideTicketsPlane:GQ,LucideTimer:XQ,LucideTimerOff:ZQ,LucideTimerReset:YQ,LucideToggleLeft:QQ,LucideToggleRight:JQ,LucideToilet:eJ,LucideTornado:tJ,LucideTorus:rJ,LucideTouchpad:sJ,LucideTouchpadOff:nJ,LucideTowerControl:aJ,LucideToyBrick:iJ,LucideTractor:oJ,LucideTrafficCone:lJ,LucideTrain:Tw,LucideTrainFront:dJ,LucideTrainFrontTunnel:cJ,LucideTrainTrack:uJ,LucideTramFront:Tw,LucideTrash:hJ,LucideTrash2:Bn,LucideTreeDeciduous:fJ,LucideTreePalm:Aw,LucideTreePine:Y1,LucideTrees:pJ,LucideTrello:mJ,LucideTrendingDown:$j,LucideTrendingUp:fp,LucideTrendingUpDown:gJ,LucideTriangle:yJ,LucideTriangleAlert:rf,LucideTriangleRight:xJ,LucideTrophy:ro,LucideTruck:SA,LucideTurtle:vJ,LucideTv:bJ,LucideTv2:Ew,LucideTvMinimal:Ew,LucideTvMinimalPlay:_J,LucideTwitch:wJ,LucideTwitter:jJ,LucideType:NJ,LucideTypeOutline:kJ,LucideUmbrella:CJ,LucideUmbrellaOff:SJ,LucideUnderline:MJ,LucideUndo:DS,LucideUndo2:TJ,LucideUndoDot:AJ,LucideUnfoldHorizontal:EJ,LucideUnfoldVertical:IJ,LucideUngroup:PJ,LucideUniversity:Iw,LucideUnlink:CA,LucideUnlink2:LJ,LucideUnlock:o2,LucideUnlockKeyhole:i2,LucideUnplug:OJ,LucideUpload:_o,LucideUploadCloud:Lb,LucideUsb:DJ,LucideUser:ic,LucideUser2:Fw,LucideUserCheck:Uj,LucideUserCheck2:Pw,LucideUserCircle:Ab,LucideUserCircle2:Tb,LucideUserCog:MA,LucideUserCog2:Lw,LucideUserMinus:RJ,LucideUserMinus2:Ow,LucideUserPen:FJ,LucideUserPlus:vf,LucideUserPlus2:Dw,LucideUserRound:Fw,LucideUserRoundCheck:Pw,LucideUserRoundCog:Lw,LucideUserRoundMinus:Ow,LucideUserRoundPen:zJ,LucideUserRoundPlus:Dw,LucideUserRoundSearch:BJ,LucideUserRoundX:Rw,LucideUserSearch:$J,LucideUserSquare:Nw,LucideUserSquare2:kw,LucideUserX:UJ,LucideUserX2:Rw,LucideUsers:Un,LucideUsers2:zw,LucideUsersRound:zw,LucideUtensils:$w,LucideUtensilsCrossed:Bw,LucideUtilityPole:qJ,LucideVariable:TA,LucideVault:VJ,LucideVegan:HJ,LucideVenetianMask:WJ,LucideVerified:U_,LucideVibrate:KJ,LucideVibrateOff:GJ,LucideVideo:$a,LucideVideoOff:ZJ,LucideVideotape:YJ,LucideView:XJ,LucideVoicemail:QJ,LucideVolleyball:JJ,LucideVolume:see,LucideVolume1:eee,LucideVolume2:tee,LucideVolumeOff:ree,LucideVolumeX:nee,LucideVote:aee,LucideWallet:oee,LucideWallet2:Uw,LucideWalletCards:iee,LucideWalletMinimal:Uw,LucideWallpaper:lee,LucideWand:cee,LucideWand2:qw,LucideWandSparkles:qw,LucideWarehouse:dee,LucideWashingMachine:uee,LucideWatch:hee,LucideWaves:fee,LucideWaypoints:pee,LucideWebcam:mee,LucideWebhook:xee,LucideWebhookOff:gee,LucideWeight:yee,LucideWheat:_ee,LucideWheatOff:vee,LucideWholeWord:bee,LucideWifi:See,LucideWifiHigh:wee,LucideWifiLow:jee,LucideWifiOff:kee,LucideWifiZero:Nee,LucideWind:Mee,LucideWindArrowDown:Cee,LucideWine:Aee,LucideWineOff:Tee,LucideWorkflow:Eee,LucideWorm:Iee,LucideWrapText:Pee,LucideWrench:gy,LucideX:hs,LucideXCircle:bc,LucideXOctagon:h2,LucideXSquare:Sw,LucideYoutube:Lee,LucideZap:Bg,LucideZapOff:Oee,LucideZoomIn:RS,LucideZoomOut:FS,Luggage:wH,LuggageIcon:wH,MSquare:iw,MSquareIcon:iw,Magnet:jH,MagnetIcon:jH,Mail:Ns,MailCheck:kH,MailCheckIcon:kH,MailIcon:Ns,MailMinus:NH,MailMinusIcon:NH,MailOpen:SH,MailOpenIcon:SH,MailPlus:CH,MailPlusIcon:CH,MailQuestion:MH,MailQuestionIcon:MH,MailSearch:TH,MailSearchIcon:TH,MailWarning:AH,MailWarningIcon:AH,MailX:lA,MailXIcon:lA,Mailbox:EH,MailboxIcon:EH,Mails:IH,MailsIcon:IH,Map:VH,MapIcon:VH,MapPin:Po,MapPinCheck:LH,MapPinCheckIcon:LH,MapPinCheckInside:PH,MapPinCheckInsideIcon:PH,MapPinHouse:OH,MapPinHouseIcon:OH,MapPinIcon:Po,MapPinMinus:RH,MapPinMinusIcon:RH,MapPinMinusInside:DH,MapPinMinusInsideIcon:DH,MapPinOff:FH,MapPinOffIcon:FH,MapPinPlus:BH,MapPinPlusIcon:BH,MapPinPlusInside:zH,MapPinPlusInsideIcon:zH,MapPinX:UH,MapPinXIcon:UH,MapPinXInside:$H,MapPinXInsideIcon:$H,MapPinned:qH,MapPinnedIcon:qH,Martini:HH,MartiniIcon:HH,Maximize:GH,Maximize2:WH,Maximize2Icon:WH,MaximizeIcon:GH,Medal:hy,MedalIcon:hy,Megaphone:Am,MegaphoneIcon:Am,MegaphoneOff:KH,MegaphoneOffIcon:KH,Meh:ZH,MehIcon:ZH,MemoryStick:YH,MemoryStickIcon:YH,Menu:cA,MenuIcon:cA,MenuSquare:ow,MenuSquareIcon:ow,Merge:XH,MergeIcon:XH,MessageCircle:Ul,MessageCircleCode:QH,MessageCircleCodeIcon:QH,MessageCircleDashed:JH,MessageCircleDashedIcon:JH,MessageCircleHeart:ES,MessageCircleHeartIcon:ES,MessageCircleIcon:Ul,MessageCircleMore:eW,MessageCircleMoreIcon:eW,MessageCircleOff:tW,MessageCircleOffIcon:tW,MessageCirclePlus:rW,MessageCirclePlusIcon:rW,MessageCircleQuestion:dA,MessageCircleQuestionIcon:dA,MessageCircleReply:nW,MessageCircleReplyIcon:nW,MessageCircleWarning:sW,MessageCircleWarningIcon:sW,MessageCircleX:aW,MessageCircleXIcon:aW,MessageSquare:zo,MessageSquareCode:iW,MessageSquareCodeIcon:iW,MessageSquareDashed:oW,MessageSquareDashedIcon:oW,MessageSquareDiff:lW,MessageSquareDiffIcon:lW,MessageSquareDot:cW,MessageSquareDotIcon:cW,MessageSquareHeart:dW,MessageSquareHeartIcon:dW,MessageSquareIcon:zo,MessageSquareLock:uW,MessageSquareLockIcon:uW,MessageSquareMore:hW,MessageSquareMoreIcon:hW,MessageSquareOff:fW,MessageSquareOffIcon:fW,MessageSquarePlus:pW,MessageSquarePlusIcon:pW,MessageSquareQuote:uA,MessageSquareQuoteIcon:uA,MessageSquareReply:mW,MessageSquareReplyIcon:mW,MessageSquareShare:gW,MessageSquareShareIcon:gW,MessageSquareText:xW,MessageSquareTextIcon:xW,MessageSquareWarning:yW,MessageSquareWarningIcon:yW,MessageSquareX:vW,MessageSquareXIcon:vW,MessagesSquare:_W,MessagesSquareIcon:_W,Mic:hA,Mic2:l2,Mic2Icon:l2,MicIcon:hA,MicOff:bW,MicOffIcon:bW,MicVocal:l2,MicVocalIcon:l2,Microchip:wW,MicrochipIcon:wW,Microscope:jW,MicroscopeIcon:jW,Microwave:kW,MicrowaveIcon:kW,Milestone:NW,MilestoneIcon:NW,Milk:CW,MilkIcon:CW,MilkOff:SW,MilkOffIcon:SW,Minimize:TW,Minimize2:MW,Minimize2Icon:MW,MinimizeIcon:TW,Minus:G1,MinusCircle:_b,MinusCircleIcon:_b,MinusIcon:G1,MinusSquare:lw,MinusSquareIcon:lw,Monitor:Rj,MonitorCheck:AW,MonitorCheckIcon:AW,MonitorCog:EW,MonitorCogIcon:EW,MonitorDot:IW,MonitorDotIcon:IW,MonitorDown:PW,MonitorDownIcon:PW,MonitorIcon:Rj,MonitorOff:LW,MonitorOffIcon:LW,MonitorPause:OW,MonitorPauseIcon:OW,MonitorPlay:DW,MonitorPlayIcon:DW,MonitorSmartphone:RW,MonitorSmartphoneIcon:RW,MonitorSpeaker:FW,MonitorSpeakerIcon:FW,MonitorStop:zW,MonitorStopIcon:zW,MonitorUp:BW,MonitorUpIcon:BW,MonitorX:$W,MonitorXIcon:$W,Moon:qW,MoonIcon:qW,MoonStar:UW,MoonStarIcon:UW,MoreHorizontal:pm,MoreHorizontalIcon:pm,MoreVertical:Wx,MoreVerticalIcon:Wx,Mountain:HW,MountainIcon:HW,MountainSnow:VW,MountainSnowIcon:VW,Mouse:YW,MouseIcon:YW,MouseOff:WW,MouseOffIcon:WW,MousePointer:ZW,MousePointer2:GW,MousePointer2Icon:GW,MousePointerBan:KW,MousePointerBanIcon:KW,MousePointerClick:Fj,MousePointerClickIcon:Fj,MousePointerIcon:ZW,MousePointerSquareDashed:Q2,MousePointerSquareDashedIcon:Q2,Move:cG,Move3D:c2,Move3DIcon:c2,Move3d:c2,Move3dIcon:c2,MoveDiagonal:QW,MoveDiagonal2:XW,MoveDiagonal2Icon:XW,MoveDiagonalIcon:QW,MoveDown:tG,MoveDownIcon:tG,MoveDownLeft:JW,MoveDownLeftIcon:JW,MoveDownRight:eG,MoveDownRightIcon:eG,MoveHorizontal:rG,MoveHorizontalIcon:rG,MoveIcon:cG,MoveLeft:nG,MoveLeftIcon:nG,MoveRight:sG,MoveRightIcon:sG,MoveUp:oG,MoveUpIcon:oG,MoveUpLeft:aG,MoveUpLeftIcon:aG,MoveUpRight:iG,MoveUpRightIcon:iG,MoveVertical:lG,MoveVerticalIcon:lG,Music:fG,Music2:dG,Music2Icon:dG,Music3:uG,Music3Icon:uG,Music4:hG,Music4Icon:hG,MusicIcon:fG,Navigation:fA,Navigation2:mG,Navigation2Icon:mG,Navigation2Off:pG,Navigation2OffIcon:pG,NavigationIcon:fA,NavigationOff:gG,NavigationOffIcon:gG,Network:xG,NetworkIcon:xG,Newspaper:fy,NewspaperIcon:fy,Nfc:yG,NfcIcon:yG,Notebook:wG,NotebookIcon:wG,NotebookPen:vG,NotebookPenIcon:vG,NotebookTabs:_G,NotebookTabsIcon:_G,NotebookText:bG,NotebookTextIcon:bG,NotepadText:kG,NotepadTextDashed:jG,NotepadTextDashedIcon:jG,NotepadTextIcon:kG,Nut:SG,NutIcon:SG,NutOff:NG,NutOffIcon:NG,Octagon:MG,OctagonAlert:d2,OctagonAlertIcon:d2,OctagonIcon:MG,OctagonMinus:CG,OctagonMinusIcon:CG,OctagonPause:u2,OctagonPauseIcon:u2,OctagonX:h2,OctagonXIcon:h2,Omega:TG,OmegaIcon:TG,Option:AG,OptionIcon:AG,Orbit:EG,OrbitIcon:EG,Origami:IG,OrigamiIcon:IG,Outdent:n2,OutdentIcon:n2,Package:ql,Package2:PG,Package2Icon:PG,PackageCheck:LG,PackageCheckIcon:LG,PackageIcon:ql,PackageMinus:OG,PackageMinusIcon:OG,PackageOpen:DG,PackageOpenIcon:DG,PackagePlus:RG,PackagePlusIcon:RG,PackageSearch:FG,PackageSearchIcon:FG,PackageX:zG,PackageXIcon:zG,PaintBucket:BG,PaintBucketIcon:BG,PaintRoller:$G,PaintRollerIcon:$G,Paintbrush:UG,Paintbrush2:f2,Paintbrush2Icon:f2,PaintbrushIcon:UG,PaintbrushVertical:f2,PaintbrushVerticalIcon:f2,Palette:Uc,PaletteIcon:Uc,Palmtree:Aw,PalmtreeIcon:Aw,PanelBottom:HG,PanelBottomClose:qG,PanelBottomCloseIcon:qG,PanelBottomDashed:p2,PanelBottomDashedIcon:p2,PanelBottomIcon:HG,PanelBottomInactive:p2,PanelBottomInactiveIcon:p2,PanelBottomOpen:VG,PanelBottomOpenIcon:VG,PanelLeft:y2,PanelLeftClose:m2,PanelLeftCloseIcon:m2,PanelLeftDashed:g2,PanelLeftDashedIcon:g2,PanelLeftIcon:y2,PanelLeftInactive:g2,PanelLeftInactiveIcon:g2,PanelLeftOpen:x2,PanelLeftOpenIcon:x2,PanelRight:KG,PanelRightClose:WG,PanelRightCloseIcon:WG,PanelRightDashed:v2,PanelRightDashedIcon:v2,PanelRightIcon:KG,PanelRightInactive:v2,PanelRightInactiveIcon:v2,PanelRightOpen:GG,PanelRightOpenIcon:GG,PanelTop:XG,PanelTopClose:ZG,PanelTopCloseIcon:ZG,PanelTopDashed:_2,PanelTopDashedIcon:_2,PanelTopIcon:XG,PanelTopInactive:_2,PanelTopInactiveIcon:_2,PanelTopOpen:YG,PanelTopOpenIcon:YG,PanelsLeftBottom:QG,PanelsLeftBottomIcon:QG,PanelsLeftRight:Rb,PanelsLeftRightIcon:Rb,PanelsRightBottom:JG,PanelsRightBottomIcon:JG,PanelsTopBottom:N2,PanelsTopBottomIcon:N2,PanelsTopLeft:H0,PanelsTopLeftIcon:H0,Paperclip:eK,PaperclipIcon:eK,Parentheses:tK,ParenthesesIcon:tK,ParkingCircle:wb,ParkingCircleIcon:wb,ParkingCircleOff:bb,ParkingCircleOffIcon:bb,ParkingMeter:rK,ParkingMeterIcon:rK,ParkingSquare:uw,ParkingSquareIcon:uw,ParkingSquareOff:dw,ParkingSquareOffIcon:dw,PartyPopper:qc,PartyPopperIcon:qc,Pause:xf,PauseCircle:jb,PauseCircleIcon:jb,PauseIcon:xf,PauseOctagon:u2,PauseOctagonIcon:u2,PawPrint:nK,PawPrintIcon:nK,PcCase:sK,PcCaseIcon:sK,Pen:G0,PenBox:gc,PenBoxIcon:gc,PenIcon:G0,PenLine:W0,PenLineIcon:W0,PenOff:aK,PenOffIcon:aK,PenSquare:gc,PenSquareIcon:gc,PenTool:zj,PenToolIcon:zj,Pencil:ni,PencilIcon:ni,PencilLine:iK,PencilLineIcon:iK,PencilOff:oK,PencilOffIcon:oK,PencilRuler:lK,PencilRulerIcon:lK,Pentagon:cK,PentagonIcon:cK,Percent:IS,PercentCircle:kb,PercentCircleIcon:kb,PercentDiamond:zb,PercentDiamondIcon:zb,PercentIcon:IS,PercentSquare:hw,PercentSquareIcon:hw,PersonStanding:dK,PersonStandingIcon:dK,PhilippinePeso:uK,PhilippinePesoIcon:uK,Phone:Ti,PhoneCall:hK,PhoneCallIcon:hK,PhoneForwarded:fK,PhoneForwardedIcon:fK,PhoneIcon:Ti,PhoneIncoming:pK,PhoneIncomingIcon:pK,PhoneMissed:mK,PhoneMissedIcon:mK,PhoneOff:gK,PhoneOffIcon:gK,PhoneOutgoing:xK,PhoneOutgoingIcon:xK,Pi:yK,PiIcon:yK,PiSquare:fw,PiSquareIcon:fw,Piano:vK,PianoIcon:vK,Pickaxe:_K,PickaxeIcon:_K,PictureInPicture:wK,PictureInPicture2:bK,PictureInPicture2Icon:bK,PictureInPictureIcon:wK,PieChart:sb,PieChartIcon:sb,PiggyBank:jK,PiggyBankIcon:jK,Pilcrow:SK,PilcrowIcon:SK,PilcrowLeft:kK,PilcrowLeftIcon:kK,PilcrowRight:NK,PilcrowRightIcon:NK,PilcrowSquare:pw,PilcrowSquareIcon:pw,Pill:MK,PillBottle:CK,PillBottleIcon:CK,PillIcon:MK,Pin:K1,PinIcon:K1,PinOff:pA,PinOffIcon:pA,Pipette:TK,PipetteIcon:TK,Pizza:AK,PizzaIcon:AK,Plane:PK,PlaneIcon:PK,PlaneLanding:EK,PlaneLandingIcon:EK,PlaneTakeoff:IK,PlaneTakeoffIcon:IK,Play:Vl,PlayCircle:rp,PlayCircleIcon:rp,PlayIcon:Vl,PlaySquare:mw,PlaySquareIcon:mw,Plug:mA,Plug2:LK,Plug2Icon:LK,PlugIcon:mA,PlugZap:b2,PlugZap2:b2,PlugZap2Icon:b2,PlugZapIcon:b2,Plus:bn,PlusCircle:Nb,PlusCircleIcon:Nb,PlusIcon:bn,PlusSquare:gw,PlusSquareIcon:gw,Pocket:DK,PocketIcon:DK,PocketKnife:OK,PocketKnifeIcon:OK,Podcast:RK,PodcastIcon:RK,Pointer:zK,PointerIcon:zK,PointerOff:FK,PointerOffIcon:FK,Popcorn:BK,PopcornIcon:BK,Popsicle:$K,PopsicleIcon:$K,PoundSterling:UK,PoundSterlingIcon:UK,Power:VK,PowerCircle:Sb,PowerCircleIcon:Sb,PowerIcon:VK,PowerOff:qK,PowerOffIcon:qK,PowerSquare:xw,PowerSquareIcon:xw,Presentation:HK,PresentationIcon:HK,Printer:GK,PrinterCheck:WK,PrinterCheckIcon:WK,PrinterIcon:GK,Projector:KK,ProjectorIcon:KK,Proportions:ZK,ProportionsIcon:ZK,Puzzle:YK,PuzzleIcon:YK,Pyramid:XK,PyramidIcon:XK,QrCode:gA,QrCodeIcon:gA,Quote:xA,QuoteIcon:xA,Rabbit:QK,RabbitIcon:QK,Radar:JK,RadarIcon:JK,Radiation:eZ,RadiationIcon:eZ,Radical:tZ,RadicalIcon:tZ,Radio:Bj,RadioIcon:Bj,RadioReceiver:rZ,RadioReceiverIcon:rZ,RadioTower:nZ,RadioTowerIcon:nZ,Radius:sZ,RadiusIcon:sZ,RailSymbol:aZ,RailSymbolIcon:aZ,Rainbow:iZ,RainbowIcon:iZ,Rat:oZ,RatIcon:oZ,Ratio:lZ,RatioIcon:lZ,Receipt:xZ,ReceiptCent:cZ,ReceiptCentIcon:cZ,ReceiptEuro:dZ,ReceiptEuroIcon:dZ,ReceiptIcon:xZ,ReceiptIndianRupee:uZ,ReceiptIndianRupeeIcon:uZ,ReceiptJapaneseYen:hZ,ReceiptJapaneseYenIcon:hZ,ReceiptPoundSterling:fZ,ReceiptPoundSterlingIcon:fZ,ReceiptRussianRuble:pZ,ReceiptRussianRubleIcon:pZ,ReceiptSwissFranc:mZ,ReceiptSwissFrancIcon:mZ,ReceiptText:gZ,ReceiptTextIcon:gZ,RectangleEllipsis:w2,RectangleEllipsisIcon:w2,RectangleHorizontal:yZ,RectangleHorizontalIcon:yZ,RectangleVertical:vZ,RectangleVerticalIcon:vZ,Recycle:_Z,RecycleIcon:_Z,Redo:PS,Redo2:bZ,Redo2Icon:bZ,RedoDot:wZ,RedoDotIcon:wZ,RedoIcon:PS,RefreshCcw:kZ,RefreshCcwDot:jZ,RefreshCcwDotIcon:jZ,RefreshCcwIcon:kZ,RefreshCw:qo,RefreshCwIcon:qo,RefreshCwOff:NZ,RefreshCwOffIcon:NZ,Refrigerator:SZ,RefrigeratorIcon:SZ,Regex:CZ,RegexIcon:CZ,RemoveFormatting:MZ,RemoveFormattingIcon:MZ,Repeat:yA,Repeat1:TZ,Repeat1Icon:TZ,Repeat2:AZ,Repeat2Icon:AZ,RepeatIcon:yA,Replace:IZ,ReplaceAll:EZ,ReplaceAllIcon:EZ,ReplaceIcon:IZ,Reply:vA,ReplyAll:PZ,ReplyAllIcon:PZ,ReplyIcon:vA,Rewind:LZ,RewindIcon:LZ,Ribbon:OZ,RibbonIcon:OZ,Rocket:Dg,RocketIcon:Dg,RockingChair:DZ,RockingChairIcon:DZ,RollerCoaster:RZ,RollerCoasterIcon:RZ,Rotate3D:j2,Rotate3DIcon:j2,Rotate3d:j2,Rotate3dIcon:j2,RotateCcw:LS,RotateCcwIcon:LS,RotateCcwSquare:FZ,RotateCcwSquareIcon:FZ,RotateCw:_A,RotateCwIcon:_A,RotateCwSquare:zZ,RotateCwSquareIcon:zZ,Route:$Z,RouteIcon:$Z,RouteOff:BZ,RouteOffIcon:BZ,Router:UZ,RouterIcon:UZ,Rows:k2,Rows2:k2,Rows2Icon:k2,Rows3:N2,Rows3Icon:N2,Rows4:qZ,Rows4Icon:qZ,RowsIcon:k2,Rss:VZ,RssIcon:VZ,Ruler:HZ,RulerIcon:HZ,RussianRuble:WZ,RussianRubleIcon:WZ,Sailboat:GZ,SailboatIcon:GZ,Salad:KZ,SaladIcon:KZ,Sandwich:ZZ,SandwichIcon:ZZ,Satellite:XZ,SatelliteDish:YZ,SatelliteDishIcon:YZ,SatelliteIcon:XZ,Save:Em,SaveAll:QZ,SaveAllIcon:QZ,SaveIcon:Em,SaveOff:JZ,SaveOffIcon:JZ,Scale:eY,Scale3D:S2,Scale3DIcon:S2,Scale3d:S2,Scale3dIcon:S2,ScaleIcon:eY,Scaling:tY,ScalingIcon:tY,Scan:cY,ScanBarcode:rY,ScanBarcodeIcon:rY,ScanEye:nY,ScanEyeIcon:nY,ScanFace:sY,ScanFaceIcon:sY,ScanIcon:cY,ScanLine:aY,ScanLineIcon:aY,ScanQrCode:iY,ScanQrCodeIcon:iY,ScanSearch:oY,ScanSearchIcon:oY,ScanText:lY,ScanTextIcon:lY,ScatterChart:ab,ScatterChartIcon:ab,School:dY,School2:Iw,School2Icon:Iw,SchoolIcon:dY,Scissors:hY,ScissorsIcon:hY,ScissorsLineDashed:uY,ScissorsLineDashedIcon:uY,ScissorsSquare:yw,ScissorsSquareDashedBottom:V2,ScissorsSquareDashedBottomIcon:V2,ScissorsSquareIcon:yw,ScreenShare:pY,ScreenShareIcon:pY,ScreenShareOff:fY,ScreenShareOffIcon:fY,Scroll:gY,ScrollIcon:gY,ScrollText:mY,ScrollTextIcon:mY,Search:Sa,SearchCheck:xY,SearchCheckIcon:xY,SearchCode:yY,SearchCodeIcon:yY,SearchIcon:Sa,SearchSlash:vY,SearchSlashIcon:vY,SearchX:_Y,SearchXIcon:_Y,Section:bY,SectionIcon:bY,Send:lo,SendHorizonal:C2,SendHorizonalIcon:C2,SendHorizontal:C2,SendHorizontalIcon:C2,SendIcon:lo,SendToBack:wY,SendToBackIcon:wY,SeparatorHorizontal:jY,SeparatorHorizontalIcon:jY,SeparatorVertical:kY,SeparatorVerticalIcon:kY,Server:MY,ServerCog:NY,ServerCogIcon:NY,ServerCrash:SY,ServerCrashIcon:SY,ServerIcon:MY,ServerOff:CY,ServerOffIcon:CY,Settings:Fd,Settings2:TY,Settings2Icon:TY,SettingsIcon:Fd,Shapes:AY,ShapesIcon:AY,Share:bA,Share2:Nc,Share2Icon:Nc,ShareIcon:bA,Sheet:EY,SheetIcon:EY,Shell:IY,ShellIcon:IY,Shield:yf,ShieldAlert:PY,ShieldAlertIcon:PY,ShieldBan:LY,ShieldBanIcon:LY,ShieldCheck:wA,ShieldCheckIcon:wA,ShieldClose:M2,ShieldCloseIcon:M2,ShieldEllipsis:OY,ShieldEllipsisIcon:OY,ShieldHalf:DY,ShieldHalfIcon:DY,ShieldIcon:yf,ShieldMinus:RY,ShieldMinusIcon:RY,ShieldOff:FY,ShieldOffIcon:FY,ShieldPlus:zY,ShieldPlusIcon:zY,ShieldQuestion:BY,ShieldQuestionIcon:BY,ShieldX:M2,ShieldXIcon:M2,Ship:UY,ShipIcon:UY,ShipWheel:$Y,ShipWheelIcon:$Y,Shirt:qY,ShirtIcon:qY,ShoppingBag:Rg,ShoppingBagIcon:Rg,ShoppingBasket:VY,ShoppingBasketIcon:VY,ShoppingCart:Nh,ShoppingCartIcon:Nh,Shovel:HY,ShovelIcon:HY,ShowerHead:WY,ShowerHeadIcon:WY,Shrink:GY,ShrinkIcon:GY,Shrub:KY,ShrubIcon:KY,Shuffle:ZY,ShuffleIcon:ZY,Sidebar:y2,SidebarClose:m2,SidebarCloseIcon:m2,SidebarIcon:y2,SidebarOpen:x2,SidebarOpenIcon:x2,Sigma:YY,SigmaIcon:YY,SigmaSquare:vw,SigmaSquareIcon:vw,Signal:tX,SignalHigh:XY,SignalHighIcon:XY,SignalIcon:tX,SignalLow:QY,SignalLowIcon:QY,SignalMedium:JY,SignalMediumIcon:JY,SignalZero:eX,SignalZeroIcon:eX,Signature:rX,SignatureIcon:rX,Signpost:sX,SignpostBig:nX,SignpostBigIcon:nX,SignpostIcon:sX,Siren:aX,SirenIcon:aX,SkipBack:iX,SkipBackIcon:iX,SkipForward:oX,SkipForwardIcon:oX,Skull:lX,SkullIcon:lX,Slack:cX,SlackIcon:cX,Slash:dX,SlashIcon:dX,SlashSquare:_w,SlashSquareIcon:_w,Slice:uX,SliceIcon:uX,Sliders:T2,SlidersHorizontal:jA,SlidersHorizontalIcon:jA,SlidersIcon:T2,SlidersVertical:T2,SlidersVerticalIcon:T2,Smartphone:py,SmartphoneCharging:hX,SmartphoneChargingIcon:hX,SmartphoneIcon:py,SmartphoneNfc:fX,SmartphoneNfcIcon:fX,Smile:mX,SmileIcon:mX,SmilePlus:pX,SmilePlusIcon:pX,Snail:gX,SnailIcon:gX,Snowflake:j1,SnowflakeIcon:j1,Sofa:xX,SofaIcon:xX,SortAsc:z_,SortAscIcon:z_,SortDesc:D_,SortDescIcon:D_,Soup:yX,SoupIcon:yX,Space:vX,SpaceIcon:vX,Spade:_X,SpadeIcon:_X,Sparkle:bX,SparkleIcon:bX,Sparkles:Ls,SparklesIcon:Ls,Speaker:wX,SpeakerIcon:wX,Speech:jX,SpeechIcon:jX,SpellCheck:NX,SpellCheck2:kX,SpellCheck2Icon:kX,SpellCheckIcon:NX,Spline:SX,SplineIcon:SX,Split:CX,SplitIcon:CX,SplitSquareHorizontal:bw,SplitSquareHorizontalIcon:bw,SplitSquareVertical:ww,SplitSquareVerticalIcon:ww,SprayCan:MX,SprayCanIcon:MX,Sprout:TX,SproutIcon:TX,Square:Fg,SquareActivity:A2,SquareActivityIcon:A2,SquareArrowDown:P2,SquareArrowDownIcon:P2,SquareArrowDownLeft:E2,SquareArrowDownLeftIcon:E2,SquareArrowDownRight:I2,SquareArrowDownRightIcon:I2,SquareArrowLeft:L2,SquareArrowLeftIcon:L2,SquareArrowOutDownLeft:O2,SquareArrowOutDownLeftIcon:O2,SquareArrowOutDownRight:D2,SquareArrowOutDownRightIcon:D2,SquareArrowOutUpLeft:R2,SquareArrowOutUpLeftIcon:R2,SquareArrowOutUpRight:F2,SquareArrowOutUpRightIcon:F2,SquareArrowRight:z2,SquareArrowRightIcon:z2,SquareArrowUp:U2,SquareArrowUpIcon:U2,SquareArrowUpLeft:B2,SquareArrowUpLeftIcon:B2,SquareArrowUpRight:$2,SquareArrowUpRightIcon:$2,SquareAsterisk:q2,SquareAsteriskIcon:q2,SquareBottomDashedScissors:V2,SquareBottomDashedScissorsIcon:V2,SquareChartGantt:pg,SquareChartGanttIcon:pg,SquareCheck:H2,SquareCheckBig:K0,SquareCheckBigIcon:K0,SquareCheckIcon:H2,SquareChevronDown:W2,SquareChevronDownIcon:W2,SquareChevronLeft:G2,SquareChevronLeftIcon:G2,SquareChevronRight:K2,SquareChevronRightIcon:K2,SquareChevronUp:Z2,SquareChevronUpIcon:Z2,SquareCode:Y2,SquareCodeIcon:Y2,SquareDashed:J2,SquareDashedBottom:EX,SquareDashedBottomCode:AX,SquareDashedBottomCodeIcon:AX,SquareDashedBottomIcon:EX,SquareDashedIcon:J2,SquareDashedKanban:X2,SquareDashedKanbanIcon:X2,SquareDashedMousePointer:Q2,SquareDashedMousePointerIcon:Q2,SquareDivide:ew,SquareDivideIcon:ew,SquareDot:tw,SquareDotIcon:tw,SquareEqual:rw,SquareEqualIcon:rw,SquareFunction:nw,SquareFunctionIcon:nw,SquareGanttChart:pg,SquareGanttChartIcon:pg,SquareIcon:Fg,SquareKanban:sw,SquareKanbanIcon:sw,SquareLibrary:aw,SquareLibraryIcon:aw,SquareM:iw,SquareMIcon:iw,SquareMenu:ow,SquareMenuIcon:ow,SquareMinus:lw,SquareMinusIcon:lw,SquareMousePointer:cw,SquareMousePointerIcon:cw,SquareParking:uw,SquareParkingIcon:uw,SquareParkingOff:dw,SquareParkingOffIcon:dw,SquarePen:gc,SquarePenIcon:gc,SquarePercent:hw,SquarePercentIcon:hw,SquarePi:fw,SquarePiIcon:fw,SquarePilcrow:pw,SquarePilcrowIcon:pw,SquarePlay:mw,SquarePlayIcon:mw,SquarePlus:gw,SquarePlusIcon:gw,SquarePower:xw,SquarePowerIcon:xw,SquareRadical:IX,SquareRadicalIcon:IX,SquareScissors:yw,SquareScissorsIcon:yw,SquareSigma:vw,SquareSigmaIcon:vw,SquareSlash:_w,SquareSlashIcon:_w,SquareSplitHorizontal:bw,SquareSplitHorizontalIcon:bw,SquareSplitVertical:ww,SquareSplitVerticalIcon:ww,SquareSquare:PX,SquareSquareIcon:PX,SquareStack:LX,SquareStackIcon:LX,SquareTerminal:jw,SquareTerminalIcon:jw,SquareUser:Nw,SquareUserIcon:Nw,SquareUserRound:kw,SquareUserRoundIcon:kw,SquareX:Sw,SquareXIcon:Sw,Squircle:OX,SquircleIcon:OX,Squirrel:DX,SquirrelIcon:DX,Stamp:RX,StampIcon:RX,Star:js,StarHalf:FX,StarHalfIcon:FX,StarIcon:js,StarOff:zX,StarOffIcon:zX,Stars:Ls,StarsIcon:Ls,StepBack:BX,StepBackIcon:BX,StepForward:$X,StepForwardIcon:$X,Stethoscope:UX,StethoscopeIcon:UX,Sticker:qX,StickerIcon:qX,StickyNote:VX,StickyNoteIcon:VX,StopCircle:Mb,StopCircleIcon:Mb,Store:HX,StoreIcon:HX,StretchHorizontal:WX,StretchHorizontalIcon:WX,StretchVertical:GX,StretchVerticalIcon:GX,Strikethrough:KX,StrikethroughIcon:KX,Subscript:ZX,SubscriptIcon:ZX,Subtitles:G_,SubtitlesIcon:G_,Sun:Z1,SunDim:YX,SunDimIcon:YX,SunIcon:Z1,SunMedium:XX,SunMediumIcon:XX,SunMoon:QX,SunMoonIcon:QX,SunSnow:JX,SunSnowIcon:JX,Sunrise:eQ,SunriseIcon:eQ,Sunset:tQ,SunsetIcon:tQ,Superscript:rQ,SuperscriptIcon:rQ,SwatchBook:nQ,SwatchBookIcon:nQ,SwissFranc:sQ,SwissFrancIcon:sQ,SwitchCamera:aQ,SwitchCameraIcon:aQ,Sword:iQ,SwordIcon:iQ,Swords:oQ,SwordsIcon:oQ,Syringe:lQ,SyringeIcon:lQ,Table:mQ,Table2:OS,Table2Icon:OS,TableCellsMerge:cQ,TableCellsMergeIcon:cQ,TableCellsSplit:dQ,TableCellsSplitIcon:dQ,TableColumnsSplit:uQ,TableColumnsSplitIcon:uQ,TableIcon:mQ,TableOfContents:hQ,TableOfContentsIcon:hQ,TableProperties:fQ,TablePropertiesIcon:fQ,TableRowsSplit:pQ,TableRowsSplitIcon:pQ,Tablet:xQ,TabletIcon:xQ,TabletSmartphone:gQ,TabletSmartphoneIcon:gQ,Tablets:yQ,TabletsIcon:yQ,Tag:zg,TagIcon:zg,Tags:vQ,TagsIcon:vQ,Tally1:_Q,Tally1Icon:_Q,Tally2:bQ,Tally2Icon:bQ,Tally3:wQ,Tally3Icon:wQ,Tally4:jQ,Tally4Icon:jQ,Tally5:kQ,Tally5Icon:kQ,Tangent:NQ,TangentIcon:NQ,Target:my,TargetIcon:my,Telescope:SQ,TelescopeIcon:SQ,Tent:MQ,TentIcon:MQ,TentTree:CQ,TentTreeIcon:CQ,Terminal:TQ,TerminalIcon:TQ,TerminalSquare:jw,TerminalSquareIcon:jw,TestTube:AQ,TestTube2:Cw,TestTube2Icon:Cw,TestTubeDiagonal:Cw,TestTubeDiagonalIcon:Cw,TestTubeIcon:AQ,TestTubes:EQ,TestTubesIcon:EQ,Text:DQ,TextCursor:PQ,TextCursorIcon:PQ,TextCursorInput:IQ,TextCursorInputIcon:IQ,TextIcon:DQ,TextQuote:LQ,TextQuoteIcon:LQ,TextSearch:OQ,TextSearchIcon:OQ,TextSelect:Mw,TextSelectIcon:Mw,TextSelection:Mw,TextSelectionIcon:Mw,Theater:RQ,TheaterIcon:RQ,Thermometer:BQ,ThermometerIcon:BQ,ThermometerSnowflake:FQ,ThermometerSnowflakeIcon:FQ,ThermometerSun:zQ,ThermometerSunIcon:zQ,ThumbsDown:kA,ThumbsDownIcon:kA,ThumbsUp:zd,ThumbsUpIcon:zd,Ticket:NA,TicketCheck:$Q,TicketCheckIcon:$Q,TicketIcon:NA,TicketMinus:UQ,TicketMinusIcon:UQ,TicketPercent:qQ,TicketPercentIcon:qQ,TicketPlus:VQ,TicketPlusIcon:VQ,TicketSlash:HQ,TicketSlashIcon:HQ,TicketX:WQ,TicketXIcon:WQ,Tickets:KQ,TicketsIcon:KQ,TicketsPlane:GQ,TicketsPlaneIcon:GQ,Timer:XQ,TimerIcon:XQ,TimerOff:ZQ,TimerOffIcon:ZQ,TimerReset:YQ,TimerResetIcon:YQ,ToggleLeft:QQ,ToggleLeftIcon:QQ,ToggleRight:JQ,ToggleRightIcon:JQ,Toilet:eJ,ToiletIcon:eJ,Tornado:tJ,TornadoIcon:tJ,Torus:rJ,TorusIcon:rJ,Touchpad:sJ,TouchpadIcon:sJ,TouchpadOff:nJ,TouchpadOffIcon:nJ,TowerControl:aJ,TowerControlIcon:aJ,ToyBrick:iJ,ToyBrickIcon:iJ,Tractor:oJ,TractorIcon:oJ,TrafficCone:lJ,TrafficConeIcon:lJ,Train:Tw,TrainFront:dJ,TrainFrontIcon:dJ,TrainFrontTunnel:cJ,TrainFrontTunnelIcon:cJ,TrainIcon:Tw,TrainTrack:uJ,TrainTrackIcon:uJ,TramFront:Tw,TramFrontIcon:Tw,Trash:hJ,Trash2:Bn,Trash2Icon:Bn,TrashIcon:hJ,TreeDeciduous:fJ,TreeDeciduousIcon:fJ,TreePalm:Aw,TreePalmIcon:Aw,TreePine:Y1,TreePineIcon:Y1,Trees:pJ,TreesIcon:pJ,Trello:mJ,TrelloIcon:mJ,TrendingDown:$j,TrendingDownIcon:$j,TrendingUp:fp,TrendingUpDown:gJ,TrendingUpDownIcon:gJ,TrendingUpIcon:fp,Triangle:yJ,TriangleAlert:rf,TriangleAlertIcon:rf,TriangleIcon:yJ,TriangleRight:xJ,TriangleRightIcon:xJ,Trophy:ro,TrophyIcon:ro,Truck:SA,TruckIcon:SA,Turtle:vJ,TurtleIcon:vJ,Tv:bJ,Tv2:Ew,Tv2Icon:Ew,TvIcon:bJ,TvMinimal:Ew,TvMinimalIcon:Ew,TvMinimalPlay:_J,TvMinimalPlayIcon:_J,Twitch:wJ,TwitchIcon:wJ,Twitter:jJ,TwitterIcon:jJ,Type:NJ,TypeIcon:NJ,TypeOutline:kJ,TypeOutlineIcon:kJ,Umbrella:CJ,UmbrellaIcon:CJ,UmbrellaOff:SJ,UmbrellaOffIcon:SJ,Underline:MJ,UnderlineIcon:MJ,Undo:DS,Undo2:TJ,Undo2Icon:TJ,UndoDot:AJ,UndoDotIcon:AJ,UndoIcon:DS,UnfoldHorizontal:EJ,UnfoldHorizontalIcon:EJ,UnfoldVertical:IJ,UnfoldVerticalIcon:IJ,Ungroup:PJ,UngroupIcon:PJ,University:Iw,UniversityIcon:Iw,Unlink:CA,Unlink2:LJ,Unlink2Icon:LJ,UnlinkIcon:CA,Unlock:o2,UnlockIcon:o2,UnlockKeyhole:i2,UnlockKeyholeIcon:i2,Unplug:OJ,UnplugIcon:OJ,Upload:_o,UploadCloud:Lb,UploadCloudIcon:Lb,UploadIcon:_o,Usb:DJ,UsbIcon:DJ,User:ic,User2:Fw,User2Icon:Fw,UserCheck:Uj,UserCheck2:Pw,UserCheck2Icon:Pw,UserCheckIcon:Uj,UserCircle:Ab,UserCircle2:Tb,UserCircle2Icon:Tb,UserCircleIcon:Ab,UserCog:MA,UserCog2:Lw,UserCog2Icon:Lw,UserCogIcon:MA,UserIcon:ic,UserMinus:RJ,UserMinus2:Ow,UserMinus2Icon:Ow,UserMinusIcon:RJ,UserPen:FJ,UserPenIcon:FJ,UserPlus:vf,UserPlus2:Dw,UserPlus2Icon:Dw,UserPlusIcon:vf,UserRound:Fw,UserRoundCheck:Pw,UserRoundCheckIcon:Pw,UserRoundCog:Lw,UserRoundCogIcon:Lw,UserRoundIcon:Fw,UserRoundMinus:Ow,UserRoundMinusIcon:Ow,UserRoundPen:zJ,UserRoundPenIcon:zJ,UserRoundPlus:Dw,UserRoundPlusIcon:Dw,UserRoundSearch:BJ,UserRoundSearchIcon:BJ,UserRoundX:Rw,UserRoundXIcon:Rw,UserSearch:$J,UserSearchIcon:$J,UserSquare:Nw,UserSquare2:kw,UserSquare2Icon:kw,UserSquareIcon:Nw,UserX:UJ,UserX2:Rw,UserX2Icon:Rw,UserXIcon:UJ,Users:Un,Users2:zw,Users2Icon:zw,UsersIcon:Un,UsersRound:zw,UsersRoundIcon:zw,Utensils:$w,UtensilsCrossed:Bw,UtensilsCrossedIcon:Bw,UtensilsIcon:$w,UtilityPole:qJ,UtilityPoleIcon:qJ,Variable:TA,VariableIcon:TA,Vault:VJ,VaultIcon:VJ,Vegan:HJ,VeganIcon:HJ,VenetianMask:WJ,VenetianMaskIcon:WJ,Verified:U_,VerifiedIcon:U_,Vibrate:KJ,VibrateIcon:KJ,VibrateOff:GJ,VibrateOffIcon:GJ,Video:$a,VideoIcon:$a,VideoOff:ZJ,VideoOffIcon:ZJ,Videotape:YJ,VideotapeIcon:YJ,View:XJ,ViewIcon:XJ,Voicemail:QJ,VoicemailIcon:QJ,Volleyball:JJ,VolleyballIcon:JJ,Volume:see,Volume1:eee,Volume1Icon:eee,Volume2:tee,Volume2Icon:tee,VolumeIcon:see,VolumeOff:ree,VolumeOffIcon:ree,VolumeX:nee,VolumeXIcon:nee,Vote:aee,VoteIcon:aee,Wallet:oee,Wallet2:Uw,Wallet2Icon:Uw,WalletCards:iee,WalletCardsIcon:iee,WalletIcon:oee,WalletMinimal:Uw,WalletMinimalIcon:Uw,Wallpaper:lee,WallpaperIcon:lee,Wand:cee,Wand2:qw,Wand2Icon:qw,WandIcon:cee,WandSparkles:qw,WandSparklesIcon:qw,Warehouse:dee,WarehouseIcon:dee,WashingMachine:uee,WashingMachineIcon:uee,Watch:hee,WatchIcon:hee,Waves:fee,WavesIcon:fee,Waypoints:pee,WaypointsIcon:pee,Webcam:mee,WebcamIcon:mee,Webhook:xee,WebhookIcon:xee,WebhookOff:gee,WebhookOffIcon:gee,Weight:yee,WeightIcon:yee,Wheat:_ee,WheatIcon:_ee,WheatOff:vee,WheatOffIcon:vee,WholeWord:bee,WholeWordIcon:bee,Wifi:See,WifiHigh:wee,WifiHighIcon:wee,WifiIcon:See,WifiLow:jee,WifiLowIcon:jee,WifiOff:kee,WifiOffIcon:kee,WifiZero:Nee,WifiZeroIcon:Nee,Wind:Mee,WindArrowDown:Cee,WindArrowDownIcon:Cee,WindIcon:Mee,Wine:Aee,WineIcon:Aee,WineOff:Tee,WineOffIcon:Tee,Workflow:Eee,WorkflowIcon:Eee,Worm:Iee,WormIcon:Iee,WrapText:Pee,WrapTextIcon:Pee,Wrench:gy,WrenchIcon:gy,X:hs,XCircle:bc,XCircleIcon:bc,XIcon:hs,XOctagon:h2,XOctagonIcon:h2,XSquare:Sw,XSquareIcon:Sw,Youtube:Lee,YoutubeIcon:Lee,Zap:Bg,ZapIcon:Bg,ZapOff:Oee,ZapOffIcon:Oee,ZoomIn:RS,ZoomInIcon:RS,ZoomOut:FS,ZoomOutIcon:FS,createLucideIcon:q,icons:ZXe},Symbol.toStringTag,{value:"Module"})),nxe="-",YXe=e=>{const t=QXe(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:s}=e;return{getClassGroupId:l=>{const i=l.split(nxe);return i[0]===""&&i.length!==1&&i.shift(),CIe(i,t)||XXe(l)},getConflictingClassGroupIds:(l,i)=>{const u=n[l]||[];return i&&s[l]?[...u,...s[l]]:u}}},CIe=(e,t)=>{var l;if(e.length===0)return t.classGroupId;const n=e[0],s=t.nextPart.get(n),a=s?CIe(e.slice(1),s):void 0;if(a)return a;if(t.validators.length===0)return;const o=e.join(nxe);return(l=t.validators.find(({validator:i})=>i(o)))==null?void 0:l.classGroupId},bje=/^\[(.+)\]$/,XXe=e=>{if(bje.test(e)){const t=bje.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},QXe=e=>{const{theme:t,prefix:n}=e,s={nextPart:new Map,validators:[]};return eQe(Object.entries(e.classGroups),n).forEach(([o,l])=>{phe(l,s,o,t)}),s},phe=(e,t,n,s)=>{e.forEach(a=>{if(typeof a=="string"){const o=a===""?t:wje(t,a);o.classGroupId=n;return}if(typeof a=="function"){if(JXe(a)){phe(a(s),t,n,s);return}t.validators.push({validator:a,classGroupId:n});return}Object.entries(a).forEach(([o,l])=>{phe(l,wje(t,o),n,s)})})},wje=(e,t)=>{let n=e;return t.split(nxe).forEach(s=>{n.nextPart.has(s)||n.nextPart.set(s,{nextPart:new Map,validators:[]}),n=n.nextPart.get(s)}),n},JXe=e=>e.isThemeGetter,eQe=(e,t)=>t?e.map(([n,s])=>{const a=s.map(o=>typeof o=="string"?t+o:typeof o=="object"?Object.fromEntries(Object.entries(o).map(([l,i])=>[t+l,i])):o);return[n,a]}):e,tQe=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,s=new Map;const a=(o,l)=>{n.set(o,l),t++,t>e&&(t=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)}}},MIe="!",rQe=e=>{const{separator:t,experimentalParseClassName:n}=e,s=t.length===1,a=t[0],o=t.length,l=i=>{const u=[];let p=0,x=0,y;for(let M=0;Mx?y-x:void 0;return{modifiers:u,hasImportantModifier:b,baseClassName:S,maybePostfixModifierPosition:k}};return n?i=>n({className:i,parseClassName:l}):l},nQe=e=>{if(e.length<=1)return e;const t=[];let n=[];return e.forEach(s=>{s[0]==="["?(t.push(...n.sort(),s),n=[]):n.push(s)}),t.push(...n.sort()),t},sQe=e=>({cache:tQe(e.cacheSize),parseClassName:rQe(e),...YXe(e)}),aQe=/\s+/,iQe=(e,t)=>{const{parseClassName:n,getClassGroupId:s,getConflictingClassGroupIds:a}=t,o=[],l=e.trim().split(aQe);let i="";for(let u=l.length-1;u>=0;u-=1){const p=l[u],{modifiers:x,hasImportantModifier:y,baseClassName:_,maybePostfixModifierPosition:b}=n(p);let S=!!b,k=s(S?_.substring(0,b):_);if(!k){if(!S){i=p+(i.length>0?" "+i:i);continue}if(k=s(_),!k){i=p+(i.length>0?" "+i:i);continue}S=!1}const M=nQe(x).join(":"),P=y?M+MIe:M,T=P+k;if(o.includes(T))continue;o.push(T);const I=a(k,S);for(let z=0;z0?" "+i:i)}return i};function oQe(){let e=0,t,n,s="";for(;e{if(typeof e=="string")return e;let t,n="";for(let s=0;sy(x),e());return n=sQe(p),s=n.cache.get,a=n.cache.set,o=i,i(u)}function i(u){const p=s(u);if(p)return p;const x=iQe(u,n);return a(u,x),x}return function(){return o(oQe.apply(null,arguments))}}const fl=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},AIe=/^\[(?:([a-z-]+):)?(.+)\]$/i,cQe=/^\d+\/\d+$/,dQe=new Set(["px","full","screen"]),uQe=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,hQe=/\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$/,fQe=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,pQe=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,mQe=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Ax=e=>zS(e)||dQe.has(e)||cQe.test(e),P0=e=>x3(e,"length",jQe),zS=e=>!!e&&!Number.isNaN(Number(e)),fce=e=>x3(e,"number",zS),JM=e=>!!e&&Number.isInteger(Number(e)),gQe=e=>e.endsWith("%")&&zS(e.slice(0,-1)),ci=e=>AIe.test(e),L0=e=>uQe.test(e),xQe=new Set(["length","size","percentage"]),yQe=e=>x3(e,xQe,EIe),vQe=e=>x3(e,"position",EIe),_Qe=new Set(["image","url"]),bQe=e=>x3(e,_Qe,NQe),wQe=e=>x3(e,"",kQe),eT=()=>!0,x3=(e,t,n)=>{const s=AIe.exec(e);return s?s[1]?typeof t=="string"?s[1]===t:t.has(s[1]):n(s[2]):!1},jQe=e=>hQe.test(e)&&!fQe.test(e),EIe=()=>!1,kQe=e=>pQe.test(e),NQe=e=>mQe.test(e),SQe=()=>{const e=fl("colors"),t=fl("spacing"),n=fl("blur"),s=fl("brightness"),a=fl("borderColor"),o=fl("borderRadius"),l=fl("borderSpacing"),i=fl("borderWidth"),u=fl("contrast"),p=fl("grayscale"),x=fl("hueRotate"),y=fl("invert"),_=fl("gap"),b=fl("gradientColorStops"),S=fl("gradientColorStopPositions"),k=fl("inset"),M=fl("margin"),P=fl("opacity"),T=fl("padding"),I=fl("saturate"),z=fl("scale"),D=fl("sepia"),U=fl("skew"),V=fl("space"),W=fl("translate"),G=()=>["auto","contain","none"],J=()=>["auto","hidden","clip","visible","scroll"],ne=()=>["auto",ci,t],oe=()=>[ci,t],ge=()=>["",Ax,P0],ie=()=>["auto",zS,ci],pe=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],se=()=>["solid","dashed","dotted","double","none"],fe=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],he=()=>["start","end","center","between","around","evenly","stretch"],ye=()=>["","0",ci],Ae=()=>["auto","avoid","all","avoid-page","page","left","right","column"],we=()=>[zS,ci];return{cacheSize:500,separator:":",theme:{colors:[eT],spacing:[Ax,P0],blur:["none","",L0,ci],brightness:we(),borderColor:[e],borderRadius:["none","","full",L0,ci],borderSpacing:oe(),borderWidth:ge(),contrast:we(),grayscale:ye(),hueRotate:we(),invert:ye(),gap:oe(),gradientColorStops:[e],gradientColorStopPositions:[gQe,P0],inset:ne(),margin:ne(),opacity:we(),padding:oe(),saturate:we(),scale:we(),sepia:ye(),skew:we(),space:oe(),translate:oe()},classGroups:{aspect:[{aspect:["auto","square","video",ci]}],container:["container"],columns:[{columns:[L0]}],"break-after":[{"break-after":Ae()}],"break-before":[{"break-before":Ae()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...pe(),ci]}],overflow:[{overflow:J()}],"overflow-x":[{"overflow-x":J()}],"overflow-y":[{"overflow-y":J()}],overscroll:[{overscroll:G()}],"overscroll-x":[{"overscroll-x":G()}],"overscroll-y":[{"overscroll-y":G()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[k]}],"inset-x":[{"inset-x":[k]}],"inset-y":[{"inset-y":[k]}],start:[{start:[k]}],end:[{end:[k]}],top:[{top:[k]}],right:[{right:[k]}],bottom:[{bottom:[k]}],left:[{left:[k]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",JM,ci]}],basis:[{basis:ne()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",ci]}],grow:[{grow:ye()}],shrink:[{shrink:ye()}],order:[{order:["first","last","none",JM,ci]}],"grid-cols":[{"grid-cols":[eT]}],"col-start-end":[{col:["auto",{span:["full",JM,ci]},ci]}],"col-start":[{"col-start":ie()}],"col-end":[{"col-end":ie()}],"grid-rows":[{"grid-rows":[eT]}],"row-start-end":[{row:["auto",{span:[JM,ci]},ci]}],"row-start":[{"row-start":ie()}],"row-end":[{"row-end":ie()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",ci]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",ci]}],gap:[{gap:[_]}],"gap-x":[{"gap-x":[_]}],"gap-y":[{"gap-y":[_]}],"justify-content":[{justify:["normal",...he()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...he(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...he(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[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:[M]}],mx:[{mx:[M]}],my:[{my:[M]}],ms:[{ms:[M]}],me:[{me:[M]}],mt:[{mt:[M]}],mr:[{mr:[M]}],mb:[{mb:[M]}],ml:[{ml:[M]}],"space-x":[{"space-x":[V]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[V]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",ci,t]}],"min-w":[{"min-w":[ci,t,"min","max","fit"]}],"max-w":[{"max-w":[ci,t,"none","full","min","max","fit","prose",{screen:[L0]},L0]}],h:[{h:[ci,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[ci,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[ci,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[ci,t,"auto","min","max","fit"]}],"font-size":[{text:["base",L0,P0]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",fce]}],"font-family":[{font:[eT]}],"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",ci]}],"line-clamp":[{"line-clamp":["none",zS,fce]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Ax,ci]}],"list-image":[{"list-image":["none",ci]}],"list-style-type":[{list:["none","disc","decimal",ci]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[P]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[P]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...se(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Ax,P0]}],"underline-offset":[{"underline-offset":["auto",Ax,ci]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:oe()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ci]}],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",ci]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[P]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...pe(),vQe]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",yQe]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},bQe]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[S]}],"gradient-via-pos":[{via:[S]}],"gradient-to-pos":[{to:[S]}],"gradient-from":[{from:[b]}],"gradient-via":[{via:[b]}],"gradient-to":[{to:[b]}],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":[P]}],"border-style":[{border:[...se(),"hidden"]}],"divide-x":[{"divide-x":[i]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[i]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[P]}],"divide-style":[{divide:se()}],"border-color":[{border:[a]}],"border-color-x":[{"border-x":[a]}],"border-color-y":[{"border-y":[a]}],"border-color-s":[{"border-s":[a]}],"border-color-e":[{"border-e":[a]}],"border-color-t":[{"border-t":[a]}],"border-color-r":[{"border-r":[a]}],"border-color-b":[{"border-b":[a]}],"border-color-l":[{"border-l":[a]}],"divide-color":[{divide:[a]}],"outline-style":[{outline:["",...se()]}],"outline-offset":[{"outline-offset":[Ax,ci]}],"outline-w":[{outline:[Ax,P0]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:ge()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[P]}],"ring-offset-w":[{"ring-offset":[Ax,P0]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",L0,wQe]}],"shadow-color":[{shadow:[eT]}],opacity:[{opacity:[P]}],"mix-blend":[{"mix-blend":[...fe(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":fe()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[s]}],contrast:[{contrast:[u]}],"drop-shadow":[{"drop-shadow":["","none",L0,ci]}],grayscale:[{grayscale:[p]}],"hue-rotate":[{"hue-rotate":[x]}],invert:[{invert:[y]}],saturate:[{saturate:[I]}],sepia:[{sepia:[D]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[s]}],"backdrop-contrast":[{"backdrop-contrast":[u]}],"backdrop-grayscale":[{"backdrop-grayscale":[p]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[x]}],"backdrop-invert":[{"backdrop-invert":[y]}],"backdrop-opacity":[{"backdrop-opacity":[P]}],"backdrop-saturate":[{"backdrop-saturate":[I]}],"backdrop-sepia":[{"backdrop-sepia":[D]}],"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",ci]}],duration:[{duration:we()}],ease:[{ease:["linear","in","out","in-out",ci]}],delay:[{delay:we()}],animate:[{animate:["none","spin","ping","pulse","bounce",ci]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[z]}],"scale-x":[{"scale-x":[z]}],"scale-y":[{"scale-y":[z]}],rotate:[{rotate:[JM,ci]}],"translate-x":[{"translate-x":[W]}],"translate-y":[{"translate-y":[W]}],"skew-x":[{"skew-x":[U]}],"skew-y":[{"skew-y":[U]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",ci]}],accent:[{accent:["auto",e]}],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",ci]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":oe()}],"scroll-mx":[{"scroll-mx":oe()}],"scroll-my":[{"scroll-my":oe()}],"scroll-ms":[{"scroll-ms":oe()}],"scroll-me":[{"scroll-me":oe()}],"scroll-mt":[{"scroll-mt":oe()}],"scroll-mr":[{"scroll-mr":oe()}],"scroll-mb":[{"scroll-mb":oe()}],"scroll-ml":[{"scroll-ml":oe()}],"scroll-p":[{"scroll-p":oe()}],"scroll-px":[{"scroll-px":oe()}],"scroll-py":[{"scroll-py":oe()}],"scroll-ps":[{"scroll-ps":oe()}],"scroll-pe":[{"scroll-pe":oe()}],"scroll-pt":[{"scroll-pt":oe()}],"scroll-pr":[{"scroll-pr":oe()}],"scroll-pb":[{"scroll-pb":oe()}],"scroll-pl":[{"scroll-pl":oe()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",ci]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[Ax,P0,fce]}],stroke:[{stroke:[e,"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"]}}},CQe=lQe(SQe);function Bt(...e){return CQe(ui(e))}function tu(e,t=!1){return t&&e>=1e6?`$${(e/1e6).toFixed(1)}M`:t&&e>=1e3?`$${(e/1e3).toFixed(0)}K`:new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:0,maximumFractionDigits:0}).format(e)}function jje(e){const t=new Date(e);return new Intl.DateTimeFormat("en-US",{month:"short",day:"numeric",year:"numeric"}).format(t)}function xse(e){return e?e.replace(/<[^>]*>/g,""):""}const MQe=WXe,IIe=E.forwardRef(({className:e,...t},n)=>r.jsx(xIe,{ref:n,className:Bt("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]",e),...t}));IIe.displayName=xIe.displayName;const TQe=g3("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"}}),PIe=E.forwardRef(({className:e,variant:t,...n},s)=>r.jsx(yIe,{ref:s,className:Bt(TQe({variant:t}),e),...n}));PIe.displayName=yIe.displayName;const AQe=E.forwardRef(({className:e,...t},n)=>r.jsx(bIe,{ref:n,className:Bt("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",e),...t}));AQe.displayName=bIe.displayName;const LIe=E.forwardRef(({className:e,...t},n)=>r.jsx(wIe,{ref:n,className:Bt("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",e),"toast-close":"",...t,children:r.jsx(hs,{className:"h-4 w-4"})}));LIe.displayName=wIe.displayName;const OIe=E.forwardRef(({className:e,...t},n)=>r.jsx(vIe,{ref:n,className:Bt("text-sm font-semibold",e),...t}));OIe.displayName=vIe.displayName;const DIe=E.forwardRef(({className:e,...t},n)=>r.jsx(_Ie,{ref:n,className:Bt("text-sm opacity-90",e),...t}));DIe.displayName=_Ie.displayName;function EQe(){const{toasts:e}=_i();return r.jsxs(MQe,{children:[e.map(function({id:t,title:n,description:s,action:a,...o}){return r.jsxs(PIe,{...o,children:[r.jsxs("div",{className:"grid gap-1",children:[n&&r.jsx(OIe,{children:n}),s&&r.jsx(DIe,{children:s})]}),a,r.jsx(LIe,{})]},t)}),r.jsx(IIe,{})]})}var kje=["light","dark"],IQe="(prefers-color-scheme: dark)",PQe=E.createContext(void 0),LQe={setTheme:e=>{},themes:[]},OQe=()=>{var e;return(e=E.useContext(PQe))!=null?e:LQe};E.memo(({forcedTheme:e,storageKey:t,attribute:n,enableSystem:s,enableColorScheme:a,defaultTheme:o,value:l,attrs:i,nonce:u})=>{let p=o==="system",x=n==="class"?`var d=document.documentElement,c=d.classList;${`c.remove(${i.map(S=>`'${S}'`).join(",")})`};`:`var d=document.documentElement,n='${n}',s='setAttribute';`,y=a?kje.includes(o)&&o?`if(e==='light'||e==='dark'||!e)d.style.colorScheme=e||'${o}'`:"if(e==='light'||e==='dark')d.style.colorScheme=e":"",_=(S,k=!1,M=!0)=>{let P=l?l[S]:S,T=k?S+"|| ''":`'${P}'`,I="";return a&&M&&!k&&kje.includes(S)&&(I+=`d.style.colorScheme = '${S}';`),n==="class"?k||P?I+=`c.add(${T})`:I+="null":P&&(I+=`d[s](n,${T})`),I},b=e?`!function(){${x}${_(e)}}()`:s?`!function(){try{${x}var e=localStorage.getItem('${t}');if('system'===e||(!e&&${p})){var t='${IQe}',m=window.matchMedia(t);if(m.media!==t||m.matches){${_("dark")}}else{${_("light")}}}else if(e){${l?`var x=${JSON.stringify(l)};`:""}${_(l?"x[e]":"e",!0)}}${p?"":"else{"+_(o,!1,!1)+"}"}${y}}catch(e){}}()`:`!function(){try{${x}var e=localStorage.getItem('${t}');if(e){${l?`var x=${JSON.stringify(l)};`:""}${_(l?"x[e]":"e",!0)}}else{${_(o,!1,!1)};}${y}}catch(t){}}();`;return E.createElement("script",{nonce:u,dangerouslySetInnerHTML:{__html:b}})});var DQe=e=>{switch(e){case"success":return zQe;case"info":return $Qe;case"warning":return BQe;case"error":return UQe;default:return null}},RQe=Array(12).fill(0),FQe=({visible:e,className:t})=>lt.createElement("div",{className:["sonner-loading-wrapper",t].filter(Boolean).join(" "),"data-visible":e},lt.createElement("div",{className:"sonner-spinner"},RQe.map((n,s)=>lt.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${s}`})))),zQe=lt.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},lt.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),BQe=lt.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},lt.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),$Qe=lt.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},lt.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),UQe=lt.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},lt.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),qQe=lt.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},lt.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),lt.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),VQe=()=>{let[e,t]=lt.useState(document.hidden);return lt.useEffect(()=>{let n=()=>{t(document.hidden)};return document.addEventListener("visibilitychange",n),()=>window.removeEventListener("visibilitychange",n)},[]),e},mhe=1,HQe=class{constructor(){this.subscribe=e=>(this.subscribers.push(e),()=>{let t=this.subscribers.indexOf(e);this.subscribers.splice(t,1)}),this.publish=e=>{this.subscribers.forEach(t=>t(e))},this.addToast=e=>{this.publish(e),this.toasts=[...this.toasts,e]},this.create=e=>{var t;let{message:n,...s}=e,a=typeof(e==null?void 0:e.id)=="number"||((t=e.id)==null?void 0:t.length)>0?e.id:mhe++,o=this.toasts.find(i=>i.id===a),l=e.dismissible===void 0?!0:e.dismissible;return this.dismissedToasts.has(a)&&this.dismissedToasts.delete(a),o?this.toasts=this.toasts.map(i=>i.id===a?(this.publish({...i,...e,id:a,title:n}),{...i,...e,id:a,dismissible:l,title:n}):i):this.addToast({title:n,...s,dismissible:l,id:a}),a},this.dismiss=e=>(this.dismissedToasts.add(e),e||this.toasts.forEach(t=>{this.subscribers.forEach(n=>n({id:t.id,dismiss:!0}))}),this.subscribers.forEach(t=>t({id:e,dismiss:!0})),e),this.message=(e,t)=>this.create({...t,message:e}),this.error=(e,t)=>this.create({...t,message:e,type:"error"}),this.success=(e,t)=>this.create({...t,type:"success",message:e}),this.info=(e,t)=>this.create({...t,type:"info",message:e}),this.warning=(e,t)=>this.create({...t,type:"warning",message:e}),this.loading=(e,t)=>this.create({...t,type:"loading",message:e}),this.promise=(e,t)=>{if(!t)return;let n;t.loading!==void 0&&(n=this.create({...t,promise:e,type:"loading",message:t.loading,description:typeof t.description!="function"?t.description:void 0}));let s=e instanceof Promise?e:e(),a=n!==void 0,o,l=s.then(async u=>{if(o=["resolve",u],lt.isValidElement(u))a=!1,this.create({id:n,type:"default",message:u});else if(GQe(u)&&!u.ok){a=!1;let p=typeof t.error=="function"?await t.error(`HTTP error! status: ${u.status}`):t.error,x=typeof t.description=="function"?await t.description(`HTTP error! status: ${u.status}`):t.description;this.create({id:n,type:"error",message:p,description:x})}else if(t.success!==void 0){a=!1;let p=typeof t.success=="function"?await t.success(u):t.success,x=typeof t.description=="function"?await t.description(u):t.description;this.create({id:n,type:"success",message:p,description:x})}}).catch(async u=>{if(o=["reject",u],t.error!==void 0){a=!1;let p=typeof t.error=="function"?await t.error(u):t.error,x=typeof t.description=="function"?await t.description(u):t.description;this.create({id:n,type:"error",message:p,description:x})}}).finally(()=>{var u;a&&(this.dismiss(n),n=void 0),(u=t.finally)==null||u.call(t)}),i=()=>new Promise((u,p)=>l.then(()=>o[0]==="reject"?p(o[1]):u(o[1])).catch(p));return typeof n!="string"&&typeof n!="number"?{unwrap:i}:Object.assign(n,{unwrap:i})},this.custom=(e,t)=>{let n=(t==null?void 0:t.id)||mhe++;return this.create({jsx:e(n),id:n,...t}),n},this.getActiveToasts=()=>this.toasts.filter(e=>!this.dismissedToasts.has(e.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}},vh=new HQe,WQe=(e,t)=>{let n=(t==null?void 0:t.id)||mhe++;return vh.addToast({title:e,...t,id:n}),n},GQe=e=>e&&typeof e=="object"&&"ok"in e&&typeof e.ok=="boolean"&&"status"in e&&typeof e.status=="number",KQe=WQe,ZQe=()=>vh.toasts,YQe=()=>vh.getActiveToasts(),Ie=Object.assign(KQe,{success:vh.success,info:vh.info,warning:vh.warning,error:vh.error,custom:vh.custom,message:vh.message,promise:vh.promise,dismiss:vh.dismiss,loading:vh.loading},{getHistory:ZQe,getToasts:YQe});function XQe(e,{insertAt:t}={}){if(typeof document>"u")return;let n=document.head||document.getElementsByTagName("head")[0],s=document.createElement("style");s.type="text/css",t==="top"&&n.firstChild?n.insertBefore(s,n.firstChild):n.appendChild(s),s.styleSheet?s.styleSheet.cssText=e:s.appendChild(document.createTextNode(e))}XQe(`: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 $L(e){return e.label!==void 0}var QQe=3,JQe="32px",eJe="16px",Nje=4e3,tJe=356,rJe=14,nJe=20,sJe=200;function Jp(...e){return e.filter(Boolean).join(" ")}function aJe(e){let[t,n]=e.split("-"),s=[];return t&&s.push(t),n&&s.push(n),s}var iJe=e=>{var t,n,s,a,o,l,i,u,p,x,y;let{invert:_,toast:b,unstyled:S,interacting:k,setHeights:M,visibleToasts:P,heights:T,index:I,toasts:z,expanded:D,removeToast:U,defaultRichColors:V,closeButton:W,style:G,cancelButtonStyle:J,actionButtonStyle:ne,className:oe="",descriptionClassName:ge="",duration:ie,position:pe,gap:se,loadingIcon:fe,expandByDefault:he,classNames:ye,icons:Ae,closeButtonAriaLabel:we="Close toast",pauseWhenPageIsHidden:be}=e,[_e,Je]=lt.useState(null),[Te,De]=lt.useState(null),[Ue,Be]=lt.useState(!1),[qe,ot]=lt.useState(!1),[Mt,Oe]=lt.useState(!1),[at,le]=lt.useState(!1),[Ve,Qe]=lt.useState(!1),[st,ke]=lt.useState(0),[ct,Ce]=lt.useState(0),Me=lt.useRef(b.duration||ie||Nje),Ge=lt.useRef(null),Ee=lt.useRef(null),He=I===0,nt=I+1<=P,yt=b.type,it=b.dismissible!==!1,zt=b.className||"",dr=b.descriptionClassName||"",Rr=lt.useMemo(()=>T.findIndex(ds=>ds.toastId===b.id)||0,[T,b.id]),Gr=lt.useMemo(()=>{var ds;return(ds=b.closeButton)!=null?ds:W},[b.closeButton,W]),Ur=lt.useMemo(()=>b.duration||ie||Nje,[b.duration,ie]),kn=lt.useRef(0),_s=lt.useRef(0),ur=lt.useRef(0),Rn=lt.useRef(null),[ea,ca]=pe.split("-"),Ei=lt.useMemo(()=>T.reduce((ds,Hs,Os)=>Os>=Rr?ds:ds+Hs.height,0),[T,Rr]),Ii=VQe(),$o=b.invert||_,Va=yt==="loading";_s.current=lt.useMemo(()=>Rr*se+Ei,[Rr,Ei]),lt.useEffect(()=>{Me.current=Ur},[Ur]),lt.useEffect(()=>{Be(!0)},[]),lt.useEffect(()=>{let ds=Ee.current;if(ds){let Hs=ds.getBoundingClientRect().height;return Ce(Hs),M(Os=>[{toastId:b.id,height:Hs,position:b.position},...Os]),()=>M(Os=>Os.filter(bi=>bi.toastId!==b.id))}},[M,b.id]),lt.useLayoutEffect(()=>{if(!Ue)return;let ds=Ee.current,Hs=ds.style.height;ds.style.height="auto";let Os=ds.getBoundingClientRect().height;ds.style.height=Hs,Ce(Os),M(bi=>bi.find(sr=>sr.toastId===b.id)?bi.map(sr=>sr.toastId===b.id?{...sr,height:Os}:sr):[{toastId:b.id,height:Os,position:b.position},...bi])},[Ue,b.title,b.description,M,b.id]);let cs=lt.useCallback(()=>{ot(!0),ke(_s.current),M(ds=>ds.filter(Hs=>Hs.toastId!==b.id)),setTimeout(()=>{U(b)},sJe)},[b,U,M,_s]);lt.useEffect(()=>{if(b.promise&&yt==="loading"||b.duration===1/0||b.type==="loading")return;let ds;return D||k||be&&Ii?(()=>{if(ur.current{var Hs;(Hs=b.onAutoClose)==null||Hs.call(b,b),cs()},Me.current)),()=>clearTimeout(ds)},[D,k,b,yt,be,Ii,cs]),lt.useEffect(()=>{b.delete&&cs()},[cs,b.delete]);function ta(){var ds,Hs,Os;return Ae!=null&&Ae.loading?lt.createElement("div",{className:Jp(ye==null?void 0:ye.loader,(ds=b==null?void 0:b.classNames)==null?void 0:ds.loader,"sonner-loader"),"data-visible":yt==="loading"},Ae.loading):fe?lt.createElement("div",{className:Jp(ye==null?void 0:ye.loader,(Hs=b==null?void 0:b.classNames)==null?void 0:Hs.loader,"sonner-loader"),"data-visible":yt==="loading"},fe):lt.createElement(FQe,{className:Jp(ye==null?void 0:ye.loader,(Os=b==null?void 0:b.classNames)==null?void 0:Os.loader),visible:yt==="loading"})}return lt.createElement("li",{tabIndex:0,ref:Ee,className:Jp(oe,zt,ye==null?void 0:ye.toast,(t=b==null?void 0:b.classNames)==null?void 0:t.toast,ye==null?void 0:ye.default,ye==null?void 0:ye[yt],(n=b==null?void 0:b.classNames)==null?void 0:n[yt]),"data-sonner-toast":"","data-rich-colors":(s=b.richColors)!=null?s:V,"data-styled":!(b.jsx||b.unstyled||S),"data-mounted":Ue,"data-promise":!!b.promise,"data-swiped":Ve,"data-removed":qe,"data-visible":nt,"data-y-position":ea,"data-x-position":ca,"data-index":I,"data-front":He,"data-swiping":Mt,"data-dismissible":it,"data-type":yt,"data-invert":$o,"data-swipe-out":at,"data-swipe-direction":Te,"data-expanded":!!(D||he&&Ue),style:{"--index":I,"--toasts-before":I,"--z-index":z.length-I,"--offset":`${qe?st:_s.current}px`,"--initial-height":he?"auto":`${ct}px`,...G,...b.style},onDragEnd:()=>{Oe(!1),Je(null),Rn.current=null},onPointerDown:ds=>{Va||!it||(Ge.current=new Date,ke(_s.current),ds.target.setPointerCapture(ds.pointerId),ds.target.tagName!=="BUTTON"&&(Oe(!0),Rn.current={x:ds.clientX,y:ds.clientY}))},onPointerUp:()=>{var ds,Hs,Os,bi;if(at||!it)return;Rn.current=null;let sr=Number(((ds=Ee.current)==null?void 0:ds.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),Ia=Number(((Hs=Ee.current)==null?void 0:Hs.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),no=new Date().getTime()-((Os=Ge.current)==null?void 0:Os.getTime()),yi=_e==="x"?sr:Ia,qn=Math.abs(yi)/no;if(Math.abs(yi)>=nJe||qn>.11){ke(_s.current),(bi=b.onDismiss)==null||bi.call(b,b),De(_e==="x"?sr>0?"right":"left":Ia>0?"down":"up"),cs(),le(!0),Qe(!1);return}Oe(!1),Je(null)},onPointerMove:ds=>{var Hs,Os,bi,sr;if(!Rn.current||!it||((Hs=window.getSelection())==null?void 0:Hs.toString().length)>0)return;let Ia=ds.clientY-Rn.current.y,no=ds.clientX-Rn.current.x,yi=(Os=e.swipeDirections)!=null?Os:aJe(pe);!_e&&(Math.abs(no)>1||Math.abs(Ia)>1)&&Je(Math.abs(no)>Math.abs(Ia)?"x":"y");let qn={x:0,y:0};_e==="y"?(yi.includes("top")||yi.includes("bottom"))&&(yi.includes("top")&&Ia<0||yi.includes("bottom")&&Ia>0)&&(qn.y=Ia):_e==="x"&&(yi.includes("left")||yi.includes("right"))&&(yi.includes("left")&&no<0||yi.includes("right")&&no>0)&&(qn.x=no),(Math.abs(qn.x)>0||Math.abs(qn.y)>0)&&Qe(!0),(bi=Ee.current)==null||bi.style.setProperty("--swipe-amount-x",`${qn.x}px`),(sr=Ee.current)==null||sr.style.setProperty("--swipe-amount-y",`${qn.y}px`)}},Gr&&!b.jsx?lt.createElement("button",{"aria-label":we,"data-disabled":Va,"data-close-button":!0,onClick:Va||!it?()=>{}:()=>{var ds;cs(),(ds=b.onDismiss)==null||ds.call(b,b)},className:Jp(ye==null?void 0:ye.closeButton,(a=b==null?void 0:b.classNames)==null?void 0:a.closeButton)},(o=Ae==null?void 0:Ae.close)!=null?o:qQe):null,b.jsx||E.isValidElement(b.title)?b.jsx?b.jsx:typeof b.title=="function"?b.title():b.title:lt.createElement(lt.Fragment,null,yt||b.icon||b.promise?lt.createElement("div",{"data-icon":"",className:Jp(ye==null?void 0:ye.icon,(l=b==null?void 0:b.classNames)==null?void 0:l.icon)},b.promise||b.type==="loading"&&!b.icon?b.icon||ta():null,b.type!=="loading"?b.icon||(Ae==null?void 0:Ae[yt])||DQe(yt):null):null,lt.createElement("div",{"data-content":"",className:Jp(ye==null?void 0:ye.content,(i=b==null?void 0:b.classNames)==null?void 0:i.content)},lt.createElement("div",{"data-title":"",className:Jp(ye==null?void 0:ye.title,(u=b==null?void 0:b.classNames)==null?void 0:u.title)},typeof b.title=="function"?b.title():b.title),b.description?lt.createElement("div",{"data-description":"",className:Jp(ge,dr,ye==null?void 0:ye.description,(p=b==null?void 0:b.classNames)==null?void 0:p.description)},typeof b.description=="function"?b.description():b.description):null),E.isValidElement(b.cancel)?b.cancel:b.cancel&&$L(b.cancel)?lt.createElement("button",{"data-button":!0,"data-cancel":!0,style:b.cancelButtonStyle||J,onClick:ds=>{var Hs,Os;$L(b.cancel)&&it&&((Os=(Hs=b.cancel).onClick)==null||Os.call(Hs,ds),cs())},className:Jp(ye==null?void 0:ye.cancelButton,(x=b==null?void 0:b.classNames)==null?void 0:x.cancelButton)},b.cancel.label):null,E.isValidElement(b.action)?b.action:b.action&&$L(b.action)?lt.createElement("button",{"data-button":!0,"data-action":!0,style:b.actionButtonStyle||ne,onClick:ds=>{var Hs,Os;$L(b.action)&&((Os=(Hs=b.action).onClick)==null||Os.call(Hs,ds),!ds.defaultPrevented&&cs())},className:Jp(ye==null?void 0:ye.actionButton,(y=b==null?void 0:b.classNames)==null?void 0:y.actionButton)},b.action.label):null))};function Sje(){if(typeof window>"u"||typeof document>"u")return"ltr";let e=document.documentElement.getAttribute("dir");return e==="auto"||!e?window.getComputedStyle(document.documentElement).direction:e}function oJe(e,t){let n={};return[e,t].forEach((s,a)=>{let o=a===1,l=o?"--mobile-offset":"--offset",i=o?eJe:JQe;function u(p){["top","right","bottom","left"].forEach(x=>{n[`${l}-${x}`]=typeof p=="number"?`${p}px`:p})}typeof s=="number"||typeof s=="string"?u(s):typeof s=="object"?["top","right","bottom","left"].forEach(p=>{s[p]===void 0?n[`${l}-${p}`]=i:n[`${l}-${p}`]=typeof s[p]=="number"?`${s[p]}px`:s[p]}):u(i)}),n}var lJe=E.forwardRef(function(e,t){let{invert:n,position:s="bottom-right",hotkey:a=["altKey","KeyT"],expand:o,closeButton:l,className:i,offset:u,mobileOffset:p,theme:x="light",richColors:y,duration:_,style:b,visibleToasts:S=QQe,toastOptions:k,dir:M=Sje(),gap:P=rJe,loadingIcon:T,icons:I,containerAriaLabel:z="Notifications",pauseWhenPageIsHidden:D}=e,[U,V]=lt.useState([]),W=lt.useMemo(()=>Array.from(new Set([s].concat(U.filter(be=>be.position).map(be=>be.position)))),[U,s]),[G,J]=lt.useState([]),[ne,oe]=lt.useState(!1),[ge,ie]=lt.useState(!1),[pe,se]=lt.useState(x!=="system"?x:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),fe=lt.useRef(null),he=a.join("+").replace(/Key/g,"").replace(/Digit/g,""),ye=lt.useRef(null),Ae=lt.useRef(!1),we=lt.useCallback(be=>{V(_e=>{var Je;return(Je=_e.find(Te=>Te.id===be.id))!=null&&Je.delete||vh.dismiss(be.id),_e.filter(({id:Te})=>Te!==be.id)})},[]);return lt.useEffect(()=>vh.subscribe(be=>{if(be.dismiss){V(_e=>_e.map(Je=>Je.id===be.id?{...Je,delete:!0}:Je));return}setTimeout(()=>{Xge.flushSync(()=>{V(_e=>{let Je=_e.findIndex(Te=>Te.id===be.id);return Je!==-1?[..._e.slice(0,Je),{..._e[Je],...be},..._e.slice(Je+1)]:[be,..._e]})})})}),[]),lt.useEffect(()=>{if(x!=="system"){se(x);return}if(x==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?se("dark"):se("light")),typeof window>"u")return;let be=window.matchMedia("(prefers-color-scheme: dark)");try{be.addEventListener("change",({matches:_e})=>{se(_e?"dark":"light")})}catch{be.addListener(({matches:Je})=>{try{se(Je?"dark":"light")}catch(Te){console.error(Te)}})}},[x]),lt.useEffect(()=>{U.length<=1&&oe(!1)},[U]),lt.useEffect(()=>{let be=_e=>{var Je,Te;a.every(De=>_e[De]||_e.code===De)&&(oe(!0),(Je=fe.current)==null||Je.focus()),_e.code==="Escape"&&(document.activeElement===fe.current||(Te=fe.current)!=null&&Te.contains(document.activeElement))&&oe(!1)};return document.addEventListener("keydown",be),()=>document.removeEventListener("keydown",be)},[a]),lt.useEffect(()=>{if(fe.current)return()=>{ye.current&&(ye.current.focus({preventScroll:!0}),ye.current=null,Ae.current=!1)}},[fe.current]),lt.createElement("section",{ref:t,"aria-label":`${z} ${he}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},W.map((be,_e)=>{var Je;let[Te,De]=be.split("-");return U.length?lt.createElement("ol",{key:be,dir:M==="auto"?Sje():M,tabIndex:-1,ref:fe,className:i,"data-sonner-toaster":!0,"data-theme":pe,"data-y-position":Te,"data-lifted":ne&&U.length>1&&!o,"data-x-position":De,style:{"--front-toast-height":`${((Je=G[0])==null?void 0:Je.height)||0}px`,"--width":`${tJe}px`,"--gap":`${P}px`,...b,...oJe(u,p)},onBlur:Ue=>{Ae.current&&!Ue.currentTarget.contains(Ue.relatedTarget)&&(Ae.current=!1,ye.current&&(ye.current.focus({preventScroll:!0}),ye.current=null))},onFocus:Ue=>{Ue.target instanceof HTMLElement&&Ue.target.dataset.dismissible==="false"||Ae.current||(Ae.current=!0,ye.current=Ue.relatedTarget)},onMouseEnter:()=>oe(!0),onMouseMove:()=>oe(!0),onMouseLeave:()=>{ge||oe(!1)},onDragEnd:()=>oe(!1),onPointerDown:Ue=>{Ue.target instanceof HTMLElement&&Ue.target.dataset.dismissible==="false"||ie(!0)},onPointerUp:()=>ie(!1)},U.filter(Ue=>!Ue.position&&_e===0||Ue.position===be).map((Ue,Be)=>{var qe,ot;return lt.createElement(iJe,{key:Ue.id,icons:I,index:Be,toast:Ue,defaultRichColors:y,duration:(qe=k==null?void 0:k.duration)!=null?qe:_,className:k==null?void 0:k.className,descriptionClassName:k==null?void 0:k.descriptionClassName,invert:n,visibleToasts:S,closeButton:(ot=k==null?void 0:k.closeButton)!=null?ot:l,interacting:ge,position:be,style:k==null?void 0:k.style,unstyled:k==null?void 0:k.unstyled,classNames:k==null?void 0:k.classNames,cancelButtonStyle:k==null?void 0:k.cancelButtonStyle,actionButtonStyle:k==null?void 0:k.actionButtonStyle,removeToast:we,toasts:U.filter(Mt=>Mt.position==Ue.position),heights:G.filter(Mt=>Mt.position==Ue.position),setHeights:J,expandByDefault:o,gap:P,loadingIcon:T,expanded:ne,pauseWhenPageIsHidden:D,swipeDirections:e.swipeDirections})})):null}))});const cJe=({...e})=>{const{theme:t="system"}=OQe();return r.jsx(lJe,{theme:t,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"}},...e})};var dJe=ige[" useId ".trim().toString()]||(()=>{}),uJe=0;function fd(e){const[t,n]=E.useState(dJe());return oc(()=>{n(s=>s??String(uJe++))},[e]),t?`radix-${t}`:""}const hJe=["top","right","bottom","left"],dv=Math.min,nf=Math.max,Ste=Math.round,UL=Math.floor,$g=e=>({x:e,y:e}),fJe={left:"right",right:"left",bottom:"top",top:"bottom"},pJe={start:"end",end:"start"};function ghe(e,t,n){return nf(e,dv(t,n))}function Cy(e,t){return typeof e=="function"?e(t):e}function My(e){return e.split("-")[0]}function y3(e){return e.split("-")[1]}function sxe(e){return e==="x"?"y":"x"}function axe(e){return e==="y"?"height":"width"}const mJe=new Set(["top","bottom"]);function Sg(e){return mJe.has(My(e))?"y":"x"}function ixe(e){return sxe(Sg(e))}function gJe(e,t,n){n===void 0&&(n=!1);const s=y3(e),a=ixe(e),o=axe(a);let l=a==="x"?s===(n?"end":"start")?"right":"left":s==="start"?"bottom":"top";return t.reference[o]>t.floating[o]&&(l=Cte(l)),[l,Cte(l)]}function xJe(e){const t=Cte(e);return[xhe(e),t,xhe(t)]}function xhe(e){return e.replace(/start|end/g,t=>pJe[t])}const Cje=["left","right"],Mje=["right","left"],yJe=["top","bottom"],vJe=["bottom","top"];function _Je(e,t,n){switch(e){case"top":case"bottom":return n?t?Mje:Cje:t?Cje:Mje;case"left":case"right":return t?yJe:vJe;default:return[]}}function bJe(e,t,n,s){const a=y3(e);let o=_Je(My(e),n==="start",s);return a&&(o=o.map(l=>l+"-"+a),t&&(o=o.concat(o.map(xhe)))),o}function Cte(e){return e.replace(/left|right|bottom|top/g,t=>fJe[t])}function wJe(e){return{top:0,right:0,bottom:0,left:0,...e}}function RIe(e){return typeof e!="number"?wJe(e):{top:e,right:e,bottom:e,left:e}}function Mte(e){const{x:t,y:n,width:s,height:a}=e;return{width:s,height:a,top:n,left:t,right:t+s,bottom:n+a,x:t,y:n}}function Tje(e,t,n){let{reference:s,floating:a}=e;const o=Sg(t),l=ixe(t),i=axe(l),u=My(t),p=o==="y",x=s.x+s.width/2-a.width/2,y=s.y+s.height/2-a.height/2,_=s[i]/2-a[i]/2;let b;switch(u){case"top":b={x,y:s.y-a.height};break;case"bottom":b={x,y:s.y+s.height};break;case"right":b={x:s.x+s.width,y};break;case"left":b={x:s.x-a.width,y};break;default:b={x:s.x,y:s.y}}switch(y3(t)){case"start":b[l]-=_*(n&&p?-1:1);break;case"end":b[l]+=_*(n&&p?-1:1);break}return b}const jJe=async(e,t,n)=>{const{placement:s="bottom",strategy:a="absolute",middleware:o=[],platform:l}=n,i=o.filter(Boolean),u=await(l.isRTL==null?void 0:l.isRTL(t));let p=await l.getElementRects({reference:e,floating:t,strategy:a}),{x,y}=Tje(p,s,u),_=s,b={},S=0;for(let k=0;k({name:"arrow",options:e,async fn(t){const{x:n,y:s,placement:a,rects:o,platform:l,elements:i,middlewareData:u}=t,{element:p,padding:x=0}=Cy(e,t)||{};if(p==null)return{};const y=RIe(x),_={x:n,y:s},b=ixe(a),S=axe(b),k=await l.getDimensions(p),M=b==="y",P=M?"top":"left",T=M?"bottom":"right",I=M?"clientHeight":"clientWidth",z=o.reference[S]+o.reference[b]-_[b]-o.floating[S],D=_[b]-o.reference[b],U=await(l.getOffsetParent==null?void 0:l.getOffsetParent(p));let V=U?U[I]:0;(!V||!await(l.isElement==null?void 0:l.isElement(U)))&&(V=i.floating[I]||o.floating[S]);const W=z/2-D/2,G=V/2-k[S]/2-1,J=dv(y[P],G),ne=dv(y[T],G),oe=J,ge=V-k[S]-ne,ie=V/2-k[S]/2+W,pe=ghe(oe,ie,ge),se=!u.arrow&&y3(a)!=null&&ie!==pe&&o.reference[S]/2-(ieie<=0)){var ne,oe;const ie=(((ne=o.flip)==null?void 0:ne.index)||0)+1,pe=V[ie];if(pe&&(!(y==="alignment"?T!==Sg(pe):!1)||J.every(he=>he.overflows[0]>0&&Sg(he.placement)===T)))return{data:{index:ie,overflows:J},reset:{placement:pe}};let se=(oe=J.filter(fe=>fe.overflows[0]<=0).sort((fe,he)=>fe.overflows[1]-he.overflows[1])[0])==null?void 0:oe.placement;if(!se)switch(b){case"bestFit":{var ge;const fe=(ge=J.filter(he=>{if(U){const ye=Sg(he.placement);return ye===T||ye==="y"}return!0}).map(he=>[he.placement,he.overflows.filter(ye=>ye>0).reduce((ye,Ae)=>ye+Ae,0)]).sort((he,ye)=>he[1]-ye[1])[0])==null?void 0:ge[0];fe&&(se=fe);break}case"initialPlacement":se=i;break}if(a!==se)return{reset:{placement:se}}}return{}}}};function Aje(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Eje(e){return hJe.some(t=>e[t]>=0)}const SJe=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:s="referenceHidden",...a}=Cy(e,t);switch(s){case"referenceHidden":{const o=await _E(t,{...a,elementContext:"reference"}),l=Aje(o,n.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:Eje(l)}}}case"escaped":{const o=await _E(t,{...a,altBoundary:!0}),l=Aje(o,n.floating);return{data:{escapedOffsets:l,escaped:Eje(l)}}}default:return{}}}}},FIe=new Set(["left","top"]);async function CJe(e,t){const{placement:n,platform:s,elements:a}=e,o=await(s.isRTL==null?void 0:s.isRTL(a.floating)),l=My(n),i=y3(n),u=Sg(n)==="y",p=FIe.has(l)?-1:1,x=o&&u?-1:1,y=Cy(t,e);let{mainAxis:_,crossAxis:b,alignmentAxis:S}=typeof y=="number"?{mainAxis:y,crossAxis:0,alignmentAxis:null}:{mainAxis:y.mainAxis||0,crossAxis:y.crossAxis||0,alignmentAxis:y.alignmentAxis};return i&&typeof S=="number"&&(b=i==="end"?S*-1:S),u?{x:b*x,y:_*p}:{x:_*p,y:b*x}}const MJe=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,s;const{x:a,y:o,placement:l,middlewareData:i}=t,u=await CJe(t,e);return l===((n=i.offset)==null?void 0:n.placement)&&(s=i.arrow)!=null&&s.alignmentOffset?{}:{x:a+u.x,y:o+u.y,data:{...u,placement:l}}}}},TJe=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:s,placement:a}=t,{mainAxis:o=!0,crossAxis:l=!1,limiter:i={fn:M=>{let{x:P,y:T}=M;return{x:P,y:T}}},...u}=Cy(e,t),p={x:n,y:s},x=await _E(t,u),y=Sg(My(a)),_=sxe(y);let b=p[_],S=p[y];if(o){const M=_==="y"?"top":"left",P=_==="y"?"bottom":"right",T=b+x[M],I=b-x[P];b=ghe(T,b,I)}if(l){const M=y==="y"?"top":"left",P=y==="y"?"bottom":"right",T=S+x[M],I=S-x[P];S=ghe(T,S,I)}const k=i.fn({...t,[_]:b,[y]:S});return{...k,data:{x:k.x-n,y:k.y-s,enabled:{[_]:o,[y]:l}}}}}},AJe=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:s,placement:a,rects:o,middlewareData:l}=t,{offset:i=0,mainAxis:u=!0,crossAxis:p=!0}=Cy(e,t),x={x:n,y:s},y=Sg(a),_=sxe(y);let b=x[_],S=x[y];const k=Cy(i,t),M=typeof k=="number"?{mainAxis:k,crossAxis:0}:{mainAxis:0,crossAxis:0,...k};if(u){const I=_==="y"?"height":"width",z=o.reference[_]-o.floating[I]+M.mainAxis,D=o.reference[_]+o.reference[I]-M.mainAxis;bD&&(b=D)}if(p){var P,T;const I=_==="y"?"width":"height",z=FIe.has(My(a)),D=o.reference[y]-o.floating[I]+(z&&((P=l.offset)==null?void 0:P[y])||0)+(z?0:M.crossAxis),U=o.reference[y]+o.reference[I]+(z?0:((T=l.offset)==null?void 0:T[y])||0)-(z?M.crossAxis:0);SU&&(S=U)}return{[_]:b,[y]:S}}}},EJe=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,s;const{placement:a,rects:o,platform:l,elements:i}=t,{apply:u=()=>{},...p}=Cy(e,t),x=await _E(t,p),y=My(a),_=y3(a),b=Sg(a)==="y",{width:S,height:k}=o.floating;let M,P;y==="top"||y==="bottom"?(M=y,P=_===(await(l.isRTL==null?void 0:l.isRTL(i.floating))?"start":"end")?"left":"right"):(P=y,M=_==="end"?"top":"bottom");const T=k-x.top-x.bottom,I=S-x.left-x.right,z=dv(k-x[M],T),D=dv(S-x[P],I),U=!t.middlewareData.shift;let V=z,W=D;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(W=I),(s=t.middlewareData.shift)!=null&&s.enabled.y&&(V=T),U&&!_){const J=nf(x.left,0),ne=nf(x.right,0),oe=nf(x.top,0),ge=nf(x.bottom,0);b?W=S-2*(J!==0||ne!==0?J+ne:nf(x.left,x.right)):V=k-2*(oe!==0||ge!==0?oe+ge:nf(x.top,x.bottom))}await u({...t,availableWidth:W,availableHeight:V});const G=await l.getDimensions(i.floating);return S!==G.width||k!==G.height?{reset:{rects:!0}}:{}}}};function yse(){return typeof window<"u"}function v3(e){return zIe(e)?(e.nodeName||"").toLowerCase():"#document"}function _f(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function ex(e){var t;return(t=(zIe(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function zIe(e){return yse()?e instanceof Node||e instanceof _f(e).Node:!1}function Dm(e){return yse()?e instanceof Element||e instanceof _f(e).Element:!1}function Gg(e){return yse()?e instanceof HTMLElement||e instanceof _f(e).HTMLElement:!1}function Ije(e){return!yse()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof _f(e).ShadowRoot}const IJe=new Set(["inline","contents"]);function HI(e){const{overflow:t,overflowX:n,overflowY:s,display:a}=Rm(e);return/auto|scroll|overlay|hidden|clip/.test(t+s+n)&&!IJe.has(a)}const PJe=new Set(["table","td","th"]);function LJe(e){return PJe.has(v3(e))}const OJe=[":popover-open",":modal"];function vse(e){return OJe.some(t=>{try{return e.matches(t)}catch{return!1}})}const DJe=["transform","translate","scale","rotate","perspective"],RJe=["transform","translate","scale","rotate","perspective","filter"],FJe=["paint","layout","strict","content"];function oxe(e){const t=lxe(),n=Dm(e)?Rm(e):e;return DJe.some(s=>n[s]?n[s]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||RJe.some(s=>(n.willChange||"").includes(s))||FJe.some(s=>(n.contain||"").includes(s))}function zJe(e){let t=uv(e);for(;Gg(t)&&!kC(t);){if(oxe(t))return t;if(vse(t))return null;t=uv(t)}return null}function lxe(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const BJe=new Set(["html","body","#document"]);function kC(e){return BJe.has(v3(e))}function Rm(e){return _f(e).getComputedStyle(e)}function _se(e){return Dm(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function uv(e){if(v3(e)==="html")return e;const t=e.assignedSlot||e.parentNode||Ije(e)&&e.host||ex(e);return Ije(t)?t.host:t}function BIe(e){const t=uv(e);return kC(t)?e.ownerDocument?e.ownerDocument.body:e.body:Gg(t)&&HI(t)?t:BIe(t)}function bE(e,t,n){var s;t===void 0&&(t=[]),n===void 0&&(n=!0);const a=BIe(e),o=a===((s=e.ownerDocument)==null?void 0:s.body),l=_f(a);if(o){const i=yhe(l);return t.concat(l,l.visualViewport||[],HI(a)?a:[],i&&n?bE(i):[])}return t.concat(a,bE(a,[],n))}function yhe(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function $Ie(e){const t=Rm(e);let n=parseFloat(t.width)||0,s=parseFloat(t.height)||0;const a=Gg(e),o=a?e.offsetWidth:n,l=a?e.offsetHeight:s,i=Ste(n)!==o||Ste(s)!==l;return i&&(n=o,s=l),{width:n,height:s,$:i}}function cxe(e){return Dm(e)?e:e.contextElement}function BS(e){const t=cxe(e);if(!Gg(t))return $g(1);const n=t.getBoundingClientRect(),{width:s,height:a,$:o}=$Ie(t);let l=(o?Ste(n.width):n.width)/s,i=(o?Ste(n.height):n.height)/a;return(!l||!Number.isFinite(l))&&(l=1),(!i||!Number.isFinite(i))&&(i=1),{x:l,y:i}}const $Je=$g(0);function UIe(e){const t=_f(e);return!lxe()||!t.visualViewport?$Je:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function UJe(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==_f(e)?!1:t}function tk(e,t,n,s){t===void 0&&(t=!1),n===void 0&&(n=!1);const a=e.getBoundingClientRect(),o=cxe(e);let l=$g(1);t&&(s?Dm(s)&&(l=BS(s)):l=BS(e));const i=UJe(o,n,s)?UIe(o):$g(0);let u=(a.left+i.x)/l.x,p=(a.top+i.y)/l.y,x=a.width/l.x,y=a.height/l.y;if(o){const _=_f(o),b=s&&Dm(s)?_f(s):s;let S=_,k=yhe(S);for(;k&&s&&b!==S;){const M=BS(k),P=k.getBoundingClientRect(),T=Rm(k),I=P.left+(k.clientLeft+parseFloat(T.paddingLeft))*M.x,z=P.top+(k.clientTop+parseFloat(T.paddingTop))*M.y;u*=M.x,p*=M.y,x*=M.x,y*=M.y,u+=I,p+=z,S=_f(k),k=yhe(S)}}return Mte({width:x,height:y,x:u,y:p})}function dxe(e,t){const n=_se(e).scrollLeft;return t?t.left+n:tk(ex(e)).left+n}function qIe(e,t,n){n===void 0&&(n=!1);const s=e.getBoundingClientRect(),a=s.left+t.scrollLeft-(n?0:dxe(e,s)),o=s.top+t.scrollTop;return{x:a,y:o}}function qJe(e){let{elements:t,rect:n,offsetParent:s,strategy:a}=e;const o=a==="fixed",l=ex(s),i=t?vse(t.floating):!1;if(s===l||i&&o)return n;let u={scrollLeft:0,scrollTop:0},p=$g(1);const x=$g(0),y=Gg(s);if((y||!y&&!o)&&((v3(s)!=="body"||HI(l))&&(u=_se(s)),Gg(s))){const b=tk(s);p=BS(s),x.x=b.x+s.clientLeft,x.y=b.y+s.clientTop}const _=l&&!y&&!o?qIe(l,u,!0):$g(0);return{width:n.width*p.x,height:n.height*p.y,x:n.x*p.x-u.scrollLeft*p.x+x.x+_.x,y:n.y*p.y-u.scrollTop*p.y+x.y+_.y}}function VJe(e){return Array.from(e.getClientRects())}function HJe(e){const t=ex(e),n=_se(e),s=e.ownerDocument.body,a=nf(t.scrollWidth,t.clientWidth,s.scrollWidth,s.clientWidth),o=nf(t.scrollHeight,t.clientHeight,s.scrollHeight,s.clientHeight);let l=-n.scrollLeft+dxe(e);const i=-n.scrollTop;return Rm(s).direction==="rtl"&&(l+=nf(t.clientWidth,s.clientWidth)-a),{width:a,height:o,x:l,y:i}}function WJe(e,t){const n=_f(e),s=ex(e),a=n.visualViewport;let o=s.clientWidth,l=s.clientHeight,i=0,u=0;if(a){o=a.width,l=a.height;const p=lxe();(!p||p&&t==="fixed")&&(i=a.offsetLeft,u=a.offsetTop)}return{width:o,height:l,x:i,y:u}}const GJe=new Set(["absolute","fixed"]);function KJe(e,t){const n=tk(e,!0,t==="fixed"),s=n.top+e.clientTop,a=n.left+e.clientLeft,o=Gg(e)?BS(e):$g(1),l=e.clientWidth*o.x,i=e.clientHeight*o.y,u=a*o.x,p=s*o.y;return{width:l,height:i,x:u,y:p}}function Pje(e,t,n){let s;if(t==="viewport")s=WJe(e,n);else if(t==="document")s=HJe(ex(e));else if(Dm(t))s=KJe(t,n);else{const a=UIe(e);s={x:t.x-a.x,y:t.y-a.y,width:t.width,height:t.height}}return Mte(s)}function VIe(e,t){const n=uv(e);return n===t||!Dm(n)||kC(n)?!1:Rm(n).position==="fixed"||VIe(n,t)}function ZJe(e,t){const n=t.get(e);if(n)return n;let s=bE(e,[],!1).filter(i=>Dm(i)&&v3(i)!=="body"),a=null;const o=Rm(e).position==="fixed";let l=o?uv(e):e;for(;Dm(l)&&!kC(l);){const i=Rm(l),u=oxe(l);!u&&i.position==="fixed"&&(a=null),(o?!u&&!a:!u&&i.position==="static"&&!!a&&GJe.has(a.position)||HI(l)&&!u&&VIe(e,l))?s=s.filter(x=>x!==l):a=i,l=uv(l)}return t.set(e,s),s}function YJe(e){let{element:t,boundary:n,rootBoundary:s,strategy:a}=e;const l=[...n==="clippingAncestors"?vse(t)?[]:ZJe(t,this._c):[].concat(n),s],i=l[0],u=l.reduce((p,x)=>{const y=Pje(t,x,a);return p.top=nf(y.top,p.top),p.right=dv(y.right,p.right),p.bottom=dv(y.bottom,p.bottom),p.left=nf(y.left,p.left),p},Pje(t,i,a));return{width:u.right-u.left,height:u.bottom-u.top,x:u.left,y:u.top}}function XJe(e){const{width:t,height:n}=$Ie(e);return{width:t,height:n}}function QJe(e,t,n){const s=Gg(t),a=ex(t),o=n==="fixed",l=tk(e,!0,o,t);let i={scrollLeft:0,scrollTop:0};const u=$g(0);function p(){u.x=dxe(a)}if(s||!s&&!o)if((v3(t)!=="body"||HI(a))&&(i=_se(t)),s){const b=tk(t,!0,o,t);u.x=b.x+t.clientLeft,u.y=b.y+t.clientTop}else a&&p();o&&!s&&a&&p();const x=a&&!s&&!o?qIe(a,i):$g(0),y=l.left+i.scrollLeft-u.x-x.x,_=l.top+i.scrollTop-u.y-x.y;return{x:y,y:_,width:l.width,height:l.height}}function pce(e){return Rm(e).position==="static"}function Lje(e,t){if(!Gg(e)||Rm(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return ex(e)===n&&(n=n.ownerDocument.body),n}function HIe(e,t){const n=_f(e);if(vse(e))return n;if(!Gg(e)){let a=uv(e);for(;a&&!kC(a);){if(Dm(a)&&!pce(a))return a;a=uv(a)}return n}let s=Lje(e,t);for(;s&&LJe(s)&&pce(s);)s=Lje(s,t);return s&&kC(s)&&pce(s)&&!oxe(s)?n:s||zJe(e)||n}const JJe=async function(e){const t=this.getOffsetParent||HIe,n=this.getDimensions,s=await n(e.floating);return{reference:QJe(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:s.width,height:s.height}}};function eet(e){return Rm(e).direction==="rtl"}const tet={convertOffsetParentRelativeRectToViewportRelativeRect:qJe,getDocumentElement:ex,getClippingRect:YJe,getOffsetParent:HIe,getElementRects:JJe,getClientRects:VJe,getDimensions:XJe,getScale:BS,isElement:Dm,isRTL:eet};function WIe(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function ret(e,t){let n=null,s;const a=ex(e);function o(){var i;clearTimeout(s),(i=n)==null||i.disconnect(),n=null}function l(i,u){i===void 0&&(i=!1),u===void 0&&(u=1),o();const p=e.getBoundingClientRect(),{left:x,top:y,width:_,height:b}=p;if(i||t(),!_||!b)return;const S=UL(y),k=UL(a.clientWidth-(x+_)),M=UL(a.clientHeight-(y+b)),P=UL(x),I={rootMargin:-S+"px "+-k+"px "+-M+"px "+-P+"px",threshold:nf(0,dv(1,u))||1};let z=!0;function D(U){const V=U[0].intersectionRatio;if(V!==u){if(!z)return l();V?l(!1,V):s=setTimeout(()=>{l(!1,1e-7)},1e3)}V===1&&!WIe(p,e.getBoundingClientRect())&&l(),z=!1}try{n=new IntersectionObserver(D,{...I,root:a.ownerDocument})}catch{n=new IntersectionObserver(D,I)}n.observe(e)}return l(!0),o}function net(e,t,n,s){s===void 0&&(s={});const{ancestorScroll:a=!0,ancestorResize:o=!0,elementResize:l=typeof ResizeObserver=="function",layoutShift:i=typeof IntersectionObserver=="function",animationFrame:u=!1}=s,p=cxe(e),x=a||o?[...p?bE(p):[],...bE(t)]:[];x.forEach(P=>{a&&P.addEventListener("scroll",n,{passive:!0}),o&&P.addEventListener("resize",n)});const y=p&&i?ret(p,n):null;let _=-1,b=null;l&&(b=new ResizeObserver(P=>{let[T]=P;T&&T.target===p&&b&&(b.unobserve(t),cancelAnimationFrame(_),_=requestAnimationFrame(()=>{var I;(I=b)==null||I.observe(t)})),n()}),p&&!u&&b.observe(p),b.observe(t));let S,k=u?tk(e):null;u&&M();function M(){const P=tk(e);k&&!WIe(k,P)&&n(),k=P,S=requestAnimationFrame(M)}return n(),()=>{var P;x.forEach(T=>{a&&T.removeEventListener("scroll",n),o&&T.removeEventListener("resize",n)}),y==null||y(),(P=b)==null||P.disconnect(),b=null,u&&cancelAnimationFrame(S)}}const set=MJe,aet=TJe,iet=NJe,oet=EJe,cet=SJe,Oje=kJe,det=AJe,uet=(e,t,n)=>{const s=new Map,a={platform:tet,...n},o={...a.platform,_c:s};return jJe(e,t,{...a,platform:o})};var het=typeof document<"u",fet=function(){},Dee=het?E.useLayoutEffect:fet;function Tte(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,s,a;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(s=n;s--!==0;)if(!Tte(e[s],t[s]))return!1;return!0}if(a=Object.keys(e),n=a.length,n!==Object.keys(t).length)return!1;for(s=n;s--!==0;)if(!{}.hasOwnProperty.call(t,a[s]))return!1;for(s=n;s--!==0;){const o=a[s];if(!(o==="_owner"&&e.$$typeof)&&!Tte(e[o],t[o]))return!1}return!0}return e!==e&&t!==t}function GIe(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Dje(e,t){const n=GIe(e);return Math.round(t*n)/n}function mce(e){const t=E.useRef(e);return Dee(()=>{t.current=e}),t}function pet(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:s=[],platform:a,elements:{reference:o,floating:l}={},transform:i=!0,whileElementsMounted:u,open:p}=e,[x,y]=E.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[_,b]=E.useState(s);Tte(_,s)||b(s);const[S,k]=E.useState(null),[M,P]=E.useState(null),T=E.useCallback(he=>{he!==U.current&&(U.current=he,k(he))},[]),I=E.useCallback(he=>{he!==V.current&&(V.current=he,P(he))},[]),z=o||S,D=l||M,U=E.useRef(null),V=E.useRef(null),W=E.useRef(x),G=u!=null,J=mce(u),ne=mce(a),oe=mce(p),ge=E.useCallback(()=>{if(!U.current||!V.current)return;const he={placement:t,strategy:n,middleware:_};ne.current&&(he.platform=ne.current),uet(U.current,V.current,he).then(ye=>{const Ae={...ye,isPositioned:oe.current!==!1};ie.current&&!Tte(W.current,Ae)&&(W.current=Ae,kh.flushSync(()=>{y(Ae)}))})},[_,t,n,ne,oe]);Dee(()=>{p===!1&&W.current.isPositioned&&(W.current.isPositioned=!1,y(he=>({...he,isPositioned:!1})))},[p]);const ie=E.useRef(!1);Dee(()=>(ie.current=!0,()=>{ie.current=!1}),[]),Dee(()=>{if(z&&(U.current=z),D&&(V.current=D),z&&D){if(J.current)return J.current(z,D,ge);ge()}},[z,D,ge,J,G]);const pe=E.useMemo(()=>({reference:U,floating:V,setReference:T,setFloating:I}),[T,I]),se=E.useMemo(()=>({reference:z,floating:D}),[z,D]),fe=E.useMemo(()=>{const he={position:n,left:0,top:0};if(!se.floating)return he;const ye=Dje(se.floating,x.x),Ae=Dje(se.floating,x.y);return i?{...he,transform:"translate("+ye+"px, "+Ae+"px)",...GIe(se.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:ye,top:Ae}},[n,i,se.floating,x.x,x.y]);return E.useMemo(()=>({...x,update:ge,refs:pe,elements:se,floatingStyles:fe}),[x,ge,pe,se,fe])}const met=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:s,padding:a}=typeof e=="function"?e(n):e;return s&&t(s)?s.current!=null?Oje({element:s.current,padding:a}).fn(n):{}:s?Oje({element:s,padding:a}).fn(n):{}}}},get=(e,t)=>({...set(e),options:[e,t]}),xet=(e,t)=>({...aet(e),options:[e,t]}),yet=(e,t)=>({...det(e),options:[e,t]}),vet=(e,t)=>({...iet(e),options:[e,t]}),_et=(e,t)=>({...oet(e),options:[e,t]}),bet=(e,t)=>({...cet(e),options:[e,t]}),wet=(e,t)=>({...met(e),options:[e,t]});var jet="Arrow",KIe=E.forwardRef((e,t)=>{const{children:n,width:s=10,height:a=5,...o}=e;return r.jsx(Fn.svg,{...o,ref:t,width:s,height:a,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:r.jsx("polygon",{points:"0,0 30,0 15,10"})})});KIe.displayName=jet;var ket=KIe;function WI(e){const[t,n]=E.useState(void 0);return oc(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const s=new ResizeObserver(a=>{if(!Array.isArray(a)||!a.length)return;const o=a[0];let l,i;if("borderBoxSize"in o){const u=o.borderBoxSize,p=Array.isArray(u)?u[0]:u;l=p.inlineSize,i=p.blockSize}else l=e.offsetWidth,i=e.offsetHeight;n({width:l,height:i})});return s.observe(e,{box:"border-box"}),()=>s.unobserve(e)}else n(void 0)},[e]),t}var uxe="Popper",[ZIe,tx]=cc(uxe),[Net,YIe]=ZIe(uxe),XIe=e=>{const{__scopePopper:t,children:n}=e,[s,a]=E.useState(null);return r.jsx(Net,{scope:t,anchor:s,onAnchorChange:a,children:n})};XIe.displayName=uxe;var QIe="PopperAnchor",JIe=E.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:s,...a}=e,o=YIe(QIe,n),l=E.useRef(null),i=la(t,l);return E.useEffect(()=>{o.onAnchorChange((s==null?void 0:s.current)||l.current)}),s?null:r.jsx(Fn.div,{...a,ref:i})});JIe.displayName=QIe;var hxe="PopperContent",[Cet,Met]=ZIe(hxe),ePe=E.forwardRef((e,t)=>{var Ue,Be,qe,ot,Mt,Oe;const{__scopePopper:n,side:s="bottom",sideOffset:a=0,align:o="center",alignOffset:l=0,arrowPadding:i=0,avoidCollisions:u=!0,collisionBoundary:p=[],collisionPadding:x=0,sticky:y="partial",hideWhenDetached:_=!1,updatePositionStrategy:b="optimized",onPlaced:S,...k}=e,M=YIe(hxe,n),[P,T]=E.useState(null),I=la(t,at=>T(at)),[z,D]=E.useState(null),U=WI(z),V=(U==null?void 0:U.width)??0,W=(U==null?void 0:U.height)??0,G=s+(o!=="center"?"-"+o:""),J=typeof x=="number"?x:{top:0,right:0,bottom:0,left:0,...x},ne=Array.isArray(p)?p:[p],oe=ne.length>0,ge={padding:J,boundary:ne.filter(Aet),altBoundary:oe},{refs:ie,floatingStyles:pe,placement:se,isPositioned:fe,middlewareData:he}=pet({strategy:"fixed",placement:G,whileElementsMounted:(...at)=>net(...at,{animationFrame:b==="always"}),elements:{reference:M.anchor},middleware:[get({mainAxis:a+W,alignmentAxis:l}),u&&xet({mainAxis:!0,crossAxis:!1,limiter:y==="partial"?yet():void 0,...ge}),u&&vet({...ge}),_et({...ge,apply:({elements:at,rects:le,availableWidth:Ve,availableHeight:Qe})=>{const{width:st,height:ke}=le.reference,ct=at.floating.style;ct.setProperty("--radix-popper-available-width",`${Ve}px`),ct.setProperty("--radix-popper-available-height",`${Qe}px`),ct.setProperty("--radix-popper-anchor-width",`${st}px`),ct.setProperty("--radix-popper-anchor-height",`${ke}px`)}}),z&&wet({element:z,padding:i}),Eet({arrowWidth:V,arrowHeight:W}),_&&bet({strategy:"referenceHidden",...ge})]}),[ye,Ae]=nPe(se),we=sc(S);oc(()=>{fe&&(we==null||we())},[fe,we]);const be=(Ue=he.arrow)==null?void 0:Ue.x,_e=(Be=he.arrow)==null?void 0:Be.y,Je=((qe=he.arrow)==null?void 0:qe.centerOffset)!==0,[Te,De]=E.useState();return oc(()=>{P&&De(window.getComputedStyle(P).zIndex)},[P]),r.jsx("div",{ref:ie.setFloating,"data-radix-popper-content-wrapper":"",style:{...pe,transform:fe?pe.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Te,"--radix-popper-transform-origin":[(ot=he.transformOrigin)==null?void 0:ot.x,(Mt=he.transformOrigin)==null?void 0:Mt.y].join(" "),...((Oe=he.hide)==null?void 0:Oe.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:r.jsx(Cet,{scope:n,placedSide:ye,onArrowChange:D,arrowX:be,arrowY:_e,shouldHideArrow:Je,children:r.jsx(Fn.div,{"data-side":ye,"data-align":Ae,...k,ref:I,style:{...k.style,animation:fe?void 0:"none"}})})})});ePe.displayName=hxe;var tPe="PopperArrow",Tet={top:"bottom",right:"left",bottom:"top",left:"right"},rPe=E.forwardRef(function(t,n){const{__scopePopper:s,...a}=t,o=Met(tPe,s),l=Tet[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(ket,{...a,ref:n,style:{...a.style,display:"block"}})})});rPe.displayName=tPe;function Aet(e){return e!==null}var Eet=e=>({name:"transformOrigin",options:e,fn(t){var M,P,T;const{placement:n,rects:s,middlewareData:a}=t,l=((M=a.arrow)==null?void 0:M.centerOffset)!==0,i=l?0:e.arrowWidth,u=l?0:e.arrowHeight,[p,x]=nPe(n),y={start:"0%",center:"50%",end:"100%"}[x],_=(((P=a.arrow)==null?void 0:P.x)??0)+i/2,b=(((T=a.arrow)==null?void 0:T.y)??0)+u/2;let S="",k="";return p==="bottom"?(S=l?y:`${_}px`,k=`${-u}px`):p==="top"?(S=l?y:`${_}px`,k=`${s.floating.height+u}px`):p==="right"?(S=`${-u}px`,k=l?y:`${b}px`):p==="left"&&(S=`${s.floating.width+u}px`,k=l?y:`${b}px`),{data:{x:S,y:k}}}});function nPe(e){const[t,n="center"]=e.split("-");return[t,n]}var GI=XIe,_3=JIe,KI=ePe,ZI=rPe,[bse]=cc("Tooltip",[tx]),wse=tx(),sPe="TooltipProvider",Iet=700,vhe="tooltip.open",[Pet,fxe]=bse(sPe),aPe=e=>{const{__scopeTooltip:t,delayDuration:n=Iet,skipDelayDuration:s=300,disableHoverableContent:a=!1,children:o}=e,l=E.useRef(!0),i=E.useRef(!1),u=E.useRef(0);return E.useEffect(()=>{const p=u.current;return()=>window.clearTimeout(p)},[]),r.jsx(Pet,{scope:t,isOpenDelayedRef:l,delayDuration:n,onOpen:E.useCallback(()=>{window.clearTimeout(u.current),l.current=!1},[]),onClose:E.useCallback(()=>{window.clearTimeout(u.current),u.current=window.setTimeout(()=>l.current=!0,s)},[s]),isPointerInTransitRef:i,onPointerInTransitChange:E.useCallback(p=>{i.current=p},[]),disableHoverableContent:a,children:o})};aPe.displayName=sPe;var wE="Tooltip",[Let,jse]=bse(wE),iPe=e=>{const{__scopeTooltip:t,children:n,open:s,defaultOpen:a,onOpenChange:o,disableHoverableContent:l,delayDuration:i}=e,u=fxe(wE,e.__scopeTooltip),p=wse(t),[x,y]=E.useState(null),_=fd(),b=E.useRef(0),S=l??u.disableHoverableContent,k=i??u.delayDuration,M=E.useRef(!1),[P,T]=Ju({prop:s,defaultProp:a??!1,onChange:V=>{V?(u.onOpen(),document.dispatchEvent(new CustomEvent(vhe))):u.onClose(),o==null||o(V)},caller:wE}),I=E.useMemo(()=>P?M.current?"delayed-open":"instant-open":"closed",[P]),z=E.useCallback(()=>{window.clearTimeout(b.current),b.current=0,M.current=!1,T(!0)},[T]),D=E.useCallback(()=>{window.clearTimeout(b.current),b.current=0,T(!1)},[T]),U=E.useCallback(()=>{window.clearTimeout(b.current),b.current=window.setTimeout(()=>{M.current=!0,T(!0),b.current=0},k)},[k,T]);return E.useEffect(()=>()=>{b.current&&(window.clearTimeout(b.current),b.current=0)},[]),r.jsx(GI,{...p,children:r.jsx(Let,{scope:t,contentId:_,open:P,stateAttribute:I,trigger:x,onTriggerChange:y,onTriggerEnter:E.useCallback(()=>{u.isOpenDelayedRef.current?U():z()},[u.isOpenDelayedRef,U,z]),onTriggerLeave:E.useCallback(()=>{S?D():(window.clearTimeout(b.current),b.current=0)},[D,S]),onOpen:z,onClose:D,disableHoverableContent:S,children:n})})};iPe.displayName=wE;var _he="TooltipTrigger",oPe=E.forwardRef((e,t)=>{const{__scopeTooltip:n,...s}=e,a=jse(_he,n),o=fxe(_he,n),l=wse(n),i=E.useRef(null),u=la(t,i,a.onTriggerChange),p=E.useRef(!1),x=E.useRef(!1),y=E.useCallback(()=>p.current=!1,[]);return E.useEffect(()=>()=>document.removeEventListener("pointerup",y),[y]),r.jsx(_3,{asChild:!0,...l,children:r.jsx(Fn.button,{"aria-describedby":a.open?a.contentId:void 0,"data-state":a.stateAttribute,...s,ref:u,onPointerMove:un(e.onPointerMove,_=>{_.pointerType!=="touch"&&!x.current&&!o.isPointerInTransitRef.current&&(a.onTriggerEnter(),x.current=!0)}),onPointerLeave:un(e.onPointerLeave,()=>{a.onTriggerLeave(),x.current=!1}),onPointerDown:un(e.onPointerDown,()=>{a.open&&a.onClose(),p.current=!0,document.addEventListener("pointerup",y,{once:!0})}),onFocus:un(e.onFocus,()=>{p.current||a.onOpen()}),onBlur:un(e.onBlur,a.onClose),onClick:un(e.onClick,a.onClose)})})});oPe.displayName=_he;var Oet="TooltipPortal",[Ner,Det]=bse(Oet,{forceMount:void 0}),NC="TooltipContent",lPe=E.forwardRef((e,t)=>{const n=Det(NC,e.__scopeTooltip),{forceMount:s=n.forceMount,side:a="top",...o}=e,l=jse(NC,e.__scopeTooltip);return r.jsx(Tc,{present:s||l.open,children:l.disableHoverableContent?r.jsx(cPe,{side:a,...o,ref:t}):r.jsx(Ret,{side:a,...o,ref:t})})}),Ret=E.forwardRef((e,t)=>{const n=jse(NC,e.__scopeTooltip),s=fxe(NC,e.__scopeTooltip),a=E.useRef(null),o=la(t,a),[l,i]=E.useState(null),{trigger:u,onClose:p}=n,x=a.current,{onPointerInTransitChange:y}=s,_=E.useCallback(()=>{i(null),y(!1)},[y]),b=E.useCallback((S,k)=>{const M=S.currentTarget,P={x:S.clientX,y:S.clientY},T=Uet(P,M.getBoundingClientRect()),I=qet(P,T),z=Vet(k.getBoundingClientRect()),D=Wet([...I,...z]);i(D),y(!0)},[y]);return E.useEffect(()=>()=>_(),[_]),E.useEffect(()=>{if(u&&x){const S=M=>b(M,x),k=M=>b(M,u);return u.addEventListener("pointerleave",S),x.addEventListener("pointerleave",k),()=>{u.removeEventListener("pointerleave",S),x.removeEventListener("pointerleave",k)}}},[u,x,b,_]),E.useEffect(()=>{if(l){const S=k=>{const M=k.target,P={x:k.clientX,y:k.clientY},T=(u==null?void 0:u.contains(M))||(x==null?void 0:x.contains(M)),I=!Het(P,l);T?_():I&&(_(),p())};return document.addEventListener("pointermove",S),()=>document.removeEventListener("pointermove",S)}},[u,x,l,p,_]),r.jsx(cPe,{...e,ref:o})}),[Fet,zet]=bse(wE,{isInside:!1}),Bet=JEe("TooltipContent"),cPe=E.forwardRef((e,t)=>{const{__scopeTooltip:n,children:s,"aria-label":a,onEscapeKeyDown:o,onPointerDownOutside:l,...i}=e,u=jse(NC,n),p=wse(n),{onClose:x}=u;return E.useEffect(()=>(document.addEventListener(vhe,x),()=>document.removeEventListener(vhe,x)),[x]),E.useEffect(()=>{if(u.trigger){const y=_=>{const b=_.target;b!=null&&b.contains(u.trigger)&&x()};return window.addEventListener("scroll",y,{capture:!0}),()=>window.removeEventListener("scroll",y,{capture:!0})}},[u.trigger,x]),r.jsx(_v,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:o,onPointerDownOutside:l,onFocusOutside:y=>y.preventDefault(),onDismiss:x,children:r.jsxs(KI,{"data-state":u.stateAttribute,...p,...i,ref:t,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(Bet,{children:s}),r.jsx(Fet,{scope:n,isInside:!0,children:r.jsx(MXe,{id:u.contentId,role:"tooltip",children:a||s})})]})})});lPe.displayName=NC;var dPe="TooltipArrow",$et=E.forwardRef((e,t)=>{const{__scopeTooltip:n,...s}=e,a=wse(n);return zet(dPe,n).isInside?null:r.jsx(ZI,{...a,...s,ref:t})});$et.displayName=dPe;function Uet(e,t){const n=Math.abs(t.top-e.y),s=Math.abs(t.bottom-e.y),a=Math.abs(t.right-e.x),o=Math.abs(t.left-e.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 qet(e,t,n=5){const s=[];switch(t){case"top":s.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":s.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":s.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":s.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return s}function Vet(e){const{top:t,right:n,bottom:s,left:a}=e;return[{x:a,y:t},{x:n,y:t},{x:n,y:s},{x:a,y:s}]}function Het(e,t){const{x:n,y:s}=e;let a=!1;for(let o=0,l=t.length-1;os!=_>s&&n<(y-p)*(s-x)/(_-x)+p&&(a=!a)}return a}function Wet(e){const t=e.slice();return t.sort((n,s)=>n.xs.x?1:n.ys.y?1:0),Get(t)}function Get(e){if(e.length<=1)return e.slice();const t=[];for(let s=0;s=2;){const o=t[t.length-1],l=t[t.length-2];if((o.x-l.x)*(a.y-l.y)>=(o.y-l.y)*(a.x-l.x))t.pop();else break}t.push(a)}t.pop();const n=[];for(let s=e.length-1;s>=0;s--){const a=e[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(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var Ket=aPe,Zet=iPe,Yet=oPe,uPe=lPe;const YI=Ket,Ug=Zet,qg=Yet,Im=E.forwardRef(({className:e,sideOffset:t=4,...n},s)=>r.jsx(uPe,{ref:s,sideOffset:t,className:Bt("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",e),...n}));Im.displayName=uPe.displayName;var b3=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(e){return this.listeners.add(e),this.onSubscribe(),()=>{this.listeners.delete(e),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},rk=typeof window>"u"||"Deno"in globalThis;function Vu(){}function Xet(e,t){return typeof e=="function"?e(t):e}function bhe(e){return typeof e=="number"&&e>=0&&e!==1/0}function hPe(e,t){return Math.max(e+(t||0)-Date.now(),0)}function X1(e,t){return typeof e=="function"?e(t):e}function Xf(e,t){return typeof e=="function"?e(t):e}function Rje(e,t){const{type:n="all",exact:s,fetchStatus:a,predicate:o,queryKey:l,stale:i}=e;if(l){if(s){if(t.queryHash!==pxe(l,t.options))return!1}else if(!jE(t.queryKey,l))return!1}if(n!=="all"){const u=t.isActive();if(n==="active"&&!u||n==="inactive"&&u)return!1}return!(typeof i=="boolean"&&t.isStale()!==i||a&&a!==t.state.fetchStatus||o&&!o(t))}function Fje(e,t){const{exact:n,status:s,predicate:a,mutationKey:o}=e;if(o){if(!t.options.mutationKey)return!1;if(n){if(nk(t.options.mutationKey)!==nk(o))return!1}else if(!jE(t.options.mutationKey,o))return!1}return!(s&&t.state.status!==s||a&&!a(t))}function pxe(e,t){return((t==null?void 0:t.queryKeyHashFn)||nk)(e)}function nk(e){return JSON.stringify(e,(t,n)=>whe(n)?Object.keys(n).sort().reduce((s,a)=>(s[a]=n[a],s),{}):n)}function jE(e,t){return e===t?!0:typeof e!=typeof t?!1:e&&t&&typeof e=="object"&&typeof t=="object"?Object.keys(t).every(n=>jE(e[n],t[n])):!1}function fPe(e,t){if(e===t)return e;const n=zje(e)&&zje(t);if(n||whe(e)&&whe(t)){const s=n?e:Object.keys(e),a=s.length,o=n?t:Object.keys(t),l=o.length,i=n?[]:{},u=new Set(s);let p=0;for(let x=0;x{setTimeout(t,e)})}function jhe(e,t,n){return typeof n.structuralSharing=="function"?n.structuralSharing(e,t):n.structuralSharing!==!1?fPe(e,t):t}function Jet(e,t,n=0){const s=[...e,t];return n&&s.length>n?s.slice(1):s}function ett(e,t,n=0){const s=[t,...e];return n&&s.length>n?s.slice(0,-1):s}var mxe=Symbol();function pPe(e,t){return!e.queryFn&&(t!=null&&t.initialPromise)?()=>t.initialPromise:!e.queryFn||e.queryFn===mxe?()=>Promise.reject(new Error(`Missing queryFn: '${e.queryHash}'`)):e.queryFn}function mPe(e,t){return typeof e=="function"?e(...t):!!e}var pj,u1,aC,MTe,ttt=(MTe=class extends b3{constructor(){super();ga(this,pj);ga(this,u1);ga(this,aC);xs(this,aC,t=>{if(!rk&&window.addEventListener){const n=()=>t();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){er(this,u1)||this.setEventListener(er(this,aC))}onUnsubscribe(){var t;this.hasListeners()||((t=er(this,u1))==null||t.call(this),xs(this,u1,void 0))}setEventListener(t){var n;xs(this,aC,t),(n=er(this,u1))==null||n.call(this),xs(this,u1,t(s=>{typeof s=="boolean"?this.setFocused(s):this.onFocus()}))}setFocused(t){er(this,pj)!==t&&(xs(this,pj,t),this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(n=>{n(t)})}isFocused(){var t;return typeof er(this,pj)=="boolean"?er(this,pj):((t=globalThis.document)==null?void 0:t.visibilityState)!=="hidden"}},pj=new WeakMap,u1=new WeakMap,aC=new WeakMap,MTe),gxe=new ttt,iC,h1,oC,TTe,rtt=(TTe=class extends b3{constructor(){super();ga(this,iC,!0);ga(this,h1);ga(this,oC);xs(this,oC,t=>{if(!rk&&window.addEventListener){const n=()=>t(!0),s=()=>t(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",s,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",s)}}})}onSubscribe(){er(this,h1)||this.setEventListener(er(this,oC))}onUnsubscribe(){var t;this.hasListeners()||((t=er(this,h1))==null||t.call(this),xs(this,h1,void 0))}setEventListener(t){var n;xs(this,oC,t),(n=er(this,h1))==null||n.call(this),xs(this,h1,t(this.setOnline.bind(this)))}setOnline(t){er(this,iC)!==t&&(xs(this,iC,t),this.listeners.forEach(s=>{s(t)}))}isOnline(){return er(this,iC)}},iC=new WeakMap,h1=new WeakMap,oC=new WeakMap,TTe),Ete=new rtt;function khe(){let e,t;const n=new Promise((a,o)=>{e=a,t=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}),e(a)},n.reject=a=>{s({status:"rejected",reason:a}),t(a)},n}function ntt(e){return Math.min(1e3*2**e,3e4)}function gPe(e){return(e??"online")==="online"?Ete.isOnline():!0}var xPe=class extends Error{constructor(e){super("CancelledError"),this.revert=e==null?void 0:e.revert,this.silent=e==null?void 0:e.silent}};function gce(e){return e instanceof xPe}function yPe(e){let t=!1,n=0,s=!1,a;const o=khe(),l=k=>{var M;s||(_(new xPe(k)),(M=e.abort)==null||M.call(e))},i=()=>{t=!0},u=()=>{t=!1},p=()=>gxe.isFocused()&&(e.networkMode==="always"||Ete.isOnline())&&e.canRun(),x=()=>gPe(e.networkMode)&&e.canRun(),y=k=>{var M;s||(s=!0,(M=e.onSuccess)==null||M.call(e,k),a==null||a(),o.resolve(k))},_=k=>{var M;s||(s=!0,(M=e.onError)==null||M.call(e,k),a==null||a(),o.reject(k))},b=()=>new Promise(k=>{var M;a=P=>{(s||p())&&k(P)},(M=e.onPause)==null||M.call(e)}).then(()=>{var k;a=void 0,s||(k=e.onContinue)==null||k.call(e)}),S=()=>{if(s)return;let k;const M=n===0?e.initialPromise:void 0;try{k=M??e.fn()}catch(P){k=Promise.reject(P)}Promise.resolve(k).then(y).catch(P=>{var U;if(s)return;const T=e.retry??(rk?0:3),I=e.retryDelay??ntt,z=typeof I=="function"?I(n,P):I,D=T===!0||typeof T=="number"&&np()?void 0:b()).then(()=>{t?_(P):S()})})};return{promise:o,cancel:l,continue:()=>(a==null||a(),o),cancelRetry:i,continueRetry:u,canStart:x,start:()=>(x()?S():b().then(S),o)}}var stt=e=>setTimeout(e,0);function att(){let e=[],t=0,n=i=>{i()},s=i=>{i()},a=stt;const o=i=>{t?e.push(i):a(()=>{n(i)})},l=()=>{const i=e;e=[],i.length&&a(()=>{s(()=>{i.forEach(u=>{n(u)})})})};return{batch:i=>{let u;t++;try{u=i()}finally{t--,t||l()}return u},batchCalls:i=>(...u)=>{o(()=>{i(...u)})},schedule:o,setNotifyFunction:i=>{n=i},setBatchNotifyFunction:i=>{s=i},setScheduler:i=>{a=i}}}var sd=att(),mj,ATe,vPe=(ATe=class{constructor(){ga(this,mj)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),bhe(this.gcTime)&&xs(this,mj,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(e){this.gcTime=Math.max(this.gcTime||0,e??(rk?1/0:5*60*1e3))}clearGcTimeout(){er(this,mj)&&(clearTimeout(er(this,mj)),xs(this,mj,void 0))}},mj=new WeakMap,ATe),lC,gj,Yf,xj,pu,LI,yj,om,Rx,ETe,itt=(ETe=class extends vPe{constructor(t){super();ga(this,om);ga(this,lC);ga(this,gj);ga(this,Yf);ga(this,xj);ga(this,pu);ga(this,LI);ga(this,yj);xs(this,yj,!1),xs(this,LI,t.defaultOptions),this.setOptions(t.options),this.observers=[],xs(this,xj,t.client),xs(this,Yf,er(this,xj).getQueryCache()),this.queryKey=t.queryKey,this.queryHash=t.queryHash,xs(this,lC,ott(this.options)),this.state=t.state??er(this,lC),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var t;return(t=er(this,pu))==null?void 0:t.promise}setOptions(t){this.options={...er(this,LI),...t},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&er(this,Yf).remove(this)}setData(t,n){const s=jhe(this.state.data,t,this.options);return pi(this,om,Rx).call(this,{data:s,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),s}setState(t,n){pi(this,om,Rx).call(this,{type:"setState",state:t,setStateOptions:n})}cancel(t){var s,a;const n=(s=er(this,pu))==null?void 0:s.promise;return(a=er(this,pu))==null||a.cancel(t),n?n.then(Vu).catch(Vu):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(er(this,lC))}isActive(){return this.observers.some(t=>Xf(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===mxe||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>X1(t.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(t=>t.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(t=0){return this.state.data===void 0?!0:t==="static"?!1:this.state.isInvalidated?!0:!hPe(this.state.dataUpdatedAt,t)}onFocus(){var n;const t=this.observers.find(s=>s.shouldFetchOnWindowFocus());t==null||t.refetch({cancelRefetch:!1}),(n=er(this,pu))==null||n.continue()}onOnline(){var n;const t=this.observers.find(s=>s.shouldFetchOnReconnect());t==null||t.refetch({cancelRefetch:!1}),(n=er(this,pu))==null||n.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),er(this,Yf).notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(n=>n!==t),this.observers.length||(er(this,pu)&&(er(this,yj)?er(this,pu).cancel({revert:!0}):er(this,pu).cancelRetry()),this.scheduleGc()),er(this,Yf).notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||pi(this,om,Rx).call(this,{type:"invalidate"})}fetch(t,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,pu))return er(this,pu).continueRetry(),er(this,pu).promise}if(t&&this.setOptions(t),!this.options.queryFn){const _=this.observers.find(b=>b.options.queryFn);_&&this.setOptions(_.options)}const s=new AbortController,a=_=>{Object.defineProperty(_,"signal",{enumerable:!0,get:()=>(xs(this,yj,!0),s.signal)})},o=()=>{const _=pPe(this.options,n),S=(()=>{const k={client:er(this,xj),queryKey:this.queryKey,meta:this.meta};return a(k),k})();return xs(this,yj,!1),this.options.persister?this.options.persister(_,S,this):_(S)},i=(()=>{const _={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:er(this,xj),state:this.state,fetchFn:o};return a(_),_})();(p=this.options.behavior)==null||p.onFetch(i,this),xs(this,gj,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((x=i.fetchOptions)==null?void 0:x.meta))&&pi(this,om,Rx).call(this,{type:"fetch",meta:(y=i.fetchOptions)==null?void 0:y.meta});const u=_=>{var b,S,k,M;gce(_)&&_.silent||pi(this,om,Rx).call(this,{type:"error",error:_}),gce(_)||((S=(b=er(this,Yf).config).onError)==null||S.call(b,_,this),(M=(k=er(this,Yf).config).onSettled)==null||M.call(k,this.state.data,_,this)),this.scheduleGc()};return xs(this,pu,yPe({initialPromise:n==null?void 0:n.initialPromise,fn:i.fetchFn,abort:s.abort.bind(s),onSuccess:_=>{var b,S,k,M;if(_===void 0){u(new Error(`${this.queryHash} data is undefined`));return}try{this.setData(_)}catch(P){u(P);return}(S=(b=er(this,Yf).config).onSuccess)==null||S.call(b,_,this),(M=(k=er(this,Yf).config).onSettled)==null||M.call(k,_,this.state.error,this),this.scheduleGc()},onError:u,onFail:(_,b)=>{pi(this,om,Rx).call(this,{type:"failed",failureCount:_,error:b})},onPause:()=>{pi(this,om,Rx).call(this,{type:"pause"})},onContinue:()=>{pi(this,om,Rx).call(this,{type:"continue"})},retry:i.options.retry,retryDelay:i.options.retryDelay,networkMode:i.options.networkMode,canRun:()=>!0})),er(this,pu).start()}},lC=new WeakMap,gj=new WeakMap,Yf=new WeakMap,xj=new WeakMap,pu=new WeakMap,LI=new WeakMap,yj=new WeakMap,om=new WeakSet,Rx=function(t){const n=s=>{switch(t.type){case"failed":return{...s,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...s,fetchStatus:"paused"};case"continue":return{...s,fetchStatus:"fetching"};case"fetch":return{...s,..._Pe(s.data,this.options),fetchMeta:t.meta??null};case"success":return xs(this,gj,void 0),{...s,data:t.data,dataUpdateCount:s.dataUpdateCount+1,dataUpdatedAt:t.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const a=t.error;return gce(a)&&a.revert&&er(this,gj)?{...er(this,gj),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,...t.state}}};this.state=n(this.state),sd.batch(()=>{this.observers.forEach(s=>{s.onQueryUpdate()}),er(this,Yf).notify({query:this,type:"updated",action:t})})},ETe);function _Pe(e,t){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:gPe(t.networkMode)?"fetching":"paused",...e===void 0&&{error:null,status:"pending"}}}function ott(e){const t=typeof e.initialData=="function"?e.initialData():e.initialData,n=t!==void 0,s=n?typeof e.initialDataUpdatedAt=="function"?e.initialDataUpdatedAt():e.initialDataUpdatedAt:0;return{data:t,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 _g,ITe,ltt=(ITe=class extends b3{constructor(t={}){super();ga(this,_g);this.config=t,xs(this,_g,new Map)}build(t,n,s){const a=n.queryKey,o=n.queryHash??pxe(a,n);let l=this.get(o);return l||(l=new itt({client:t,queryKey:a,queryHash:o,options:t.defaultQueryOptions(n),state:s,defaultOptions:t.getQueryDefaults(a)}),this.add(l)),l}add(t){er(this,_g).has(t.queryHash)||(er(this,_g).set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const n=er(this,_g).get(t.queryHash);n&&(t.destroy(),n===t&&er(this,_g).delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){sd.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return er(this,_g).get(t)}getAll(){return[...er(this,_g).values()]}find(t){const n={exact:!0,...t};return this.getAll().find(s=>Rje(n,s))}findAll(t={}){const n=this.getAll();return Object.keys(t).length>0?n.filter(s=>Rje(t,s)):n}notify(t){sd.batch(()=>{this.listeners.forEach(n=>{n(t)})})}onFocus(){sd.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){sd.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},_g=new WeakMap,ITe),bg,$u,vj,wg,z0,PTe,ctt=(PTe=class extends vPe{constructor(t){super();ga(this,wg);ga(this,bg);ga(this,$u);ga(this,vj);this.mutationId=t.mutationId,xs(this,$u,t.mutationCache),xs(this,bg,[]),this.state=t.state||bPe(),this.setOptions(t.options),this.scheduleGc()}setOptions(t){this.options=t,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(t){er(this,bg).includes(t)||(er(this,bg).push(t),this.clearGcTimeout(),er(this,$u).notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){xs(this,bg,er(this,bg).filter(n=>n!==t)),this.scheduleGc(),er(this,$u).notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){er(this,bg).length||(this.state.status==="pending"?this.scheduleGc():er(this,$u).remove(this))}continue(){var t;return((t=er(this,vj))==null?void 0:t.continue())??this.execute(this.state.variables)}async execute(t){var o,l,i,u,p,x,y,_,b,S,k,M,P,T,I,z,D,U,V,W;const n=()=>{pi(this,wg,z0).call(this,{type:"continue"})};xs(this,vj,yPe({fn:()=>this.options.mutationFn?this.options.mutationFn(t):Promise.reject(new Error("No mutationFn found")),onFail:(G,J)=>{pi(this,wg,z0).call(this,{type:"failed",failureCount:G,error:J})},onPause:()=>{pi(this,wg,z0).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>er(this,$u).canRun(this)}));const s=this.state.status==="pending",a=!er(this,vj).canStart();try{if(s)n();else{pi(this,wg,z0).call(this,{type:"pending",variables:t,isPaused:a}),await((l=(o=er(this,$u).config).onMutate)==null?void 0:l.call(o,t,this));const J=await((u=(i=this.options).onMutate)==null?void 0:u.call(i,t));J!==this.state.context&&pi(this,wg,z0).call(this,{type:"pending",context:J,variables:t,isPaused:a})}const G=await er(this,vj).start();return await((x=(p=er(this,$u).config).onSuccess)==null?void 0:x.call(p,G,t,this.state.context,this)),await((_=(y=this.options).onSuccess)==null?void 0:_.call(y,G,t,this.state.context)),await((S=(b=er(this,$u).config).onSettled)==null?void 0:S.call(b,G,null,this.state.variables,this.state.context,this)),await((M=(k=this.options).onSettled)==null?void 0:M.call(k,G,null,t,this.state.context)),pi(this,wg,z0).call(this,{type:"success",data:G}),G}catch(G){try{throw await((T=(P=er(this,$u).config).onError)==null?void 0:T.call(P,G,t,this.state.context,this)),await((z=(I=this.options).onError)==null?void 0:z.call(I,G,t,this.state.context)),await((U=(D=er(this,$u).config).onSettled)==null?void 0:U.call(D,void 0,G,this.state.variables,this.state.context,this)),await((W=(V=this.options).onSettled)==null?void 0:W.call(V,void 0,G,t,this.state.context)),G}finally{pi(this,wg,z0).call(this,{type:"error",error:G})}}finally{er(this,$u).runNext(this)}}},bg=new WeakMap,$u=new WeakMap,vj=new WeakMap,wg=new WeakSet,z0=function(t){const n=s=>{switch(t.type){case"failed":return{...s,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...s,isPaused:!0};case"continue":return{...s,isPaused:!1};case"pending":return{...s,context:t.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:t.isPaused,status:"pending",variables:t.variables,submittedAt:Date.now()};case"success":return{...s,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...s,data:void 0,error:t.error,failureCount:s.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=n(this.state),sd.batch(()=>{er(this,bg).forEach(s=>{s.onMutationUpdate(t)}),er(this,$u).notify({mutation:this,type:"updated",action:t})})},PTe);function bPe(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Gx,lm,OI,LTe,dtt=(LTe=class extends b3{constructor(t={}){super();ga(this,Gx);ga(this,lm);ga(this,OI);this.config=t,xs(this,Gx,new Set),xs(this,lm,new Map),xs(this,OI,0)}build(t,n,s){const a=new ctt({mutationCache:this,mutationId:++bL(this,OI)._,options:t.defaultMutationOptions(n),state:s});return this.add(a),a}add(t){er(this,Gx).add(t);const n=qL(t);if(typeof n=="string"){const s=er(this,lm).get(n);s?s.push(t):er(this,lm).set(n,[t])}this.notify({type:"added",mutation:t})}remove(t){if(er(this,Gx).delete(t)){const n=qL(t);if(typeof n=="string"){const s=er(this,lm).get(n);if(s)if(s.length>1){const a=s.indexOf(t);a!==-1&&s.splice(a,1)}else s[0]===t&&er(this,lm).delete(n)}}this.notify({type:"removed",mutation:t})}canRun(t){const n=qL(t);if(typeof n=="string"){const s=er(this,lm).get(n),a=s==null?void 0:s.find(o=>o.state.status==="pending");return!a||a===t}else return!0}runNext(t){var s;const n=qL(t);if(typeof n=="string"){const a=(s=er(this,lm).get(n))==null?void 0:s.find(o=>o!==t&&o.state.isPaused);return(a==null?void 0:a.continue())??Promise.resolve()}else return Promise.resolve()}clear(){sd.batch(()=>{er(this,Gx).forEach(t=>{this.notify({type:"removed",mutation:t})}),er(this,Gx).clear(),er(this,lm).clear()})}getAll(){return Array.from(er(this,Gx))}find(t){const n={exact:!0,...t};return this.getAll().find(s=>Fje(n,s))}findAll(t={}){return this.getAll().filter(n=>Fje(t,n))}notify(t){sd.batch(()=>{this.listeners.forEach(n=>{n(t)})})}resumePausedMutations(){const t=this.getAll().filter(n=>n.state.isPaused);return sd.batch(()=>Promise.all(t.map(n=>n.continue().catch(Vu))))}},Gx=new WeakMap,lm=new WeakMap,OI=new WeakMap,LTe);function qL(e){var t;return(t=e.options.scope)==null?void 0:t.id}function Ite(e){return{onFetch:(t,n)=>{var x,y,_,b,S;const s=t.options,a=(_=(y=(x=t.fetchOptions)==null?void 0:x.meta)==null?void 0:y.fetchMore)==null?void 0:_.direction,o=((b=t.state.data)==null?void 0:b.pages)||[],l=((S=t.state.data)==null?void 0:S.pageParams)||[];let i={pages:[],pageParams:[]},u=0;const p=async()=>{let k=!1;const M=I=>{Object.defineProperty(I,"signal",{enumerable:!0,get:()=>(t.signal.aborted?k=!0:t.signal.addEventListener("abort",()=>{k=!0}),t.signal)})},P=pPe(t.options,t.fetchOptions),T=async(I,z,D)=>{if(k)return Promise.reject();if(z==null&&I.pages.length)return Promise.resolve(I);const V=(()=>{const ne={client:t.client,queryKey:t.queryKey,pageParam:z,direction:D?"backward":"forward",meta:t.options.meta};return M(ne),ne})(),W=await P(V),{maxPages:G}=t.options,J=D?ett:Jet;return{pages:J(I.pages,W,G),pageParams:J(I.pageParams,z,G)}};if(a&&o.length){const I=a==="backward",z=I?wPe:Nhe,D={pages:o,pageParams:l},U=z(s,D);i=await T(D,U,I)}else{const I=e??o.length;do{const z=u===0?l[0]??s.initialPageParam:Nhe(s,i);if(u>0&&z==null)break;i=await T(i,z),u++}while(u{var k,M;return(M=(k=t.options).persister)==null?void 0:M.call(k,p,{client:t.client,queryKey:t.queryKey,meta:t.options.meta,signal:t.signal},n)}:t.fetchFn=p}}}function Nhe(e,{pages:t,pageParams:n}){const s=t.length-1;return t.length>0?e.getNextPageParam(t[s],t,n[s],n):void 0}function wPe(e,{pages:t,pageParams:n}){var s;return t.length>0?(s=e.getPreviousPageParam)==null?void 0:s.call(e,t[0],t,n[0],n):void 0}function utt(e,t){return t?Nhe(e,t)!=null:!1}function htt(e,t){return!t||!e.getPreviousPageParam?!1:wPe(e,t)!=null}var Yl,f1,p1,cC,dC,m1,uC,hC,OTe,ftt=(OTe=class{constructor(e={}){ga(this,Yl);ga(this,f1);ga(this,p1);ga(this,cC);ga(this,dC);ga(this,m1);ga(this,uC);ga(this,hC);xs(this,Yl,e.queryCache||new ltt),xs(this,f1,e.mutationCache||new dtt),xs(this,p1,e.defaultOptions||{}),xs(this,cC,new Map),xs(this,dC,new Map),xs(this,m1,0)}mount(){bL(this,m1)._++,er(this,m1)===1&&(xs(this,uC,gxe.subscribe(async e=>{e&&(await this.resumePausedMutations(),er(this,Yl).onFocus())})),xs(this,hC,Ete.subscribe(async e=>{e&&(await this.resumePausedMutations(),er(this,Yl).onOnline())})))}unmount(){var e,t;bL(this,m1)._--,er(this,m1)===0&&((e=er(this,uC))==null||e.call(this),xs(this,uC,void 0),(t=er(this,hC))==null||t.call(this),xs(this,hC,void 0))}isFetching(e){return er(this,Yl).findAll({...e,fetchStatus:"fetching"}).length}isMutating(e){return er(this,f1).findAll({...e,status:"pending"}).length}getQueryData(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=er(this,Yl).get(t.queryHash))==null?void 0:n.state.data}ensureQueryData(e){const t=this.defaultQueryOptions(e),n=er(this,Yl).build(this,t),s=n.state.data;return s===void 0?this.fetchQuery(e):(e.revalidateIfStale&&n.isStaleByTime(X1(t.staleTime,n))&&this.prefetchQuery(t),Promise.resolve(s))}getQueriesData(e){return er(this,Yl).findAll(e).map(({queryKey:t,state:n})=>{const s=n.data;return[t,s]})}setQueryData(e,t,n){const s=this.defaultQueryOptions({queryKey:e}),a=er(this,Yl).get(s.queryHash),o=a==null?void 0:a.state.data,l=Xet(t,o);if(l!==void 0)return er(this,Yl).build(this,s).setData(l,{...n,manual:!0})}setQueriesData(e,t,n){return sd.batch(()=>er(this,Yl).findAll(e).map(({queryKey:s})=>[s,this.setQueryData(s,t,n)]))}getQueryState(e){var n;const t=this.defaultQueryOptions({queryKey:e});return(n=er(this,Yl).get(t.queryHash))==null?void 0:n.state}removeQueries(e){const t=er(this,Yl);sd.batch(()=>{t.findAll(e).forEach(n=>{t.remove(n)})})}resetQueries(e,t){const n=er(this,Yl);return sd.batch(()=>(n.findAll(e).forEach(s=>{s.reset()}),this.refetchQueries({type:"active",...e},t)))}cancelQueries(e,t={}){const n={revert:!0,...t},s=sd.batch(()=>er(this,Yl).findAll(e).map(a=>a.cancel(n)));return Promise.all(s).then(Vu).catch(Vu)}invalidateQueries(e,t={}){return sd.batch(()=>(er(this,Yl).findAll(e).forEach(n=>{n.invalidate()}),(e==null?void 0:e.refetchType)==="none"?Promise.resolve():this.refetchQueries({...e,type:(e==null?void 0:e.refetchType)??(e==null?void 0:e.type)??"active"},t)))}refetchQueries(e,t={}){const n={...t,cancelRefetch:t.cancelRefetch??!0},s=sd.batch(()=>er(this,Yl).findAll(e).filter(a=>!a.isDisabled()&&!a.isStatic()).map(a=>{let o=a.fetch(void 0,n);return n.throwOnError||(o=o.catch(Vu)),a.state.fetchStatus==="paused"?Promise.resolve():o}));return Promise.all(s).then(Vu)}fetchQuery(e){const t=this.defaultQueryOptions(e);t.retry===void 0&&(t.retry=!1);const n=er(this,Yl).build(this,t);return n.isStaleByTime(X1(t.staleTime,n))?n.fetch(t):Promise.resolve(n.state.data)}prefetchQuery(e){return this.fetchQuery(e).then(Vu).catch(Vu)}fetchInfiniteQuery(e){return e.behavior=Ite(e.pages),this.fetchQuery(e)}prefetchInfiniteQuery(e){return this.fetchInfiniteQuery(e).then(Vu).catch(Vu)}ensureInfiniteQueryData(e){return e.behavior=Ite(e.pages),this.ensureQueryData(e)}resumePausedMutations(){return Ete.isOnline()?er(this,f1).resumePausedMutations():Promise.resolve()}getQueryCache(){return er(this,Yl)}getMutationCache(){return er(this,f1)}getDefaultOptions(){return er(this,p1)}setDefaultOptions(e){xs(this,p1,e)}setQueryDefaults(e,t){er(this,cC).set(nk(e),{queryKey:e,defaultOptions:t})}getQueryDefaults(e){const t=[...er(this,cC).values()],n={};return t.forEach(s=>{jE(e,s.queryKey)&&Object.assign(n,s.defaultOptions)}),n}setMutationDefaults(e,t){er(this,dC).set(nk(e),{mutationKey:e,defaultOptions:t})}getMutationDefaults(e){const t=[...er(this,dC).values()],n={};return t.forEach(s=>{jE(e,s.mutationKey)&&Object.assign(n,s.defaultOptions)}),n}defaultQueryOptions(e){if(e._defaulted)return e;const t={...er(this,p1).queries,...this.getQueryDefaults(e.queryKey),...e,_defaulted:!0};return t.queryHash||(t.queryHash=pxe(t.queryKey,t)),t.refetchOnReconnect===void 0&&(t.refetchOnReconnect=t.networkMode!=="always"),t.throwOnError===void 0&&(t.throwOnError=!!t.suspense),!t.networkMode&&t.persister&&(t.networkMode="offlineFirst"),t.queryFn===mxe&&(t.enabled=!1),t}defaultMutationOptions(e){return e!=null&&e._defaulted?e:{...er(this,p1).mutations,...(e==null?void 0:e.mutationKey)&&this.getMutationDefaults(e.mutationKey),...e,_defaulted:!0}}clear(){er(this,Yl).clear(),er(this,f1).clear()}},Yl=new WeakMap,f1=new WeakMap,p1=new WeakMap,cC=new WeakMap,dC=new WeakMap,m1=new WeakMap,uC=new WeakMap,hC=new WeakMap,OTe),gh,Yi,DI,Uu,_j,fC,g1,x1,RI,pC,mC,bj,wj,y1,gC,ko,AT,She,Che,Mhe,The,Ahe,Ehe,Ihe,kPe,DTe,jPe=(DTe=class extends b3{constructor(t,n){super();ga(this,ko);ga(this,gh);ga(this,Yi);ga(this,DI);ga(this,Uu);ga(this,_j);ga(this,fC);ga(this,g1);ga(this,x1);ga(this,RI);ga(this,pC);ga(this,mC);ga(this,bj);ga(this,wj);ga(this,y1);ga(this,gC,new Set);this.options=n,xs(this,gh,t),xs(this,x1,null),xs(this,g1,khe()),this.options.experimental_prefetchInRender||er(this,g1).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,Yi).addObserver(this),$je(er(this,Yi),this.options)?pi(this,ko,AT).call(this):this.updateResult(),pi(this,ko,The).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return Phe(er(this,Yi),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return Phe(er(this,Yi),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,pi(this,ko,Ahe).call(this),pi(this,ko,Ehe).call(this),er(this,Yi).removeObserver(this)}setOptions(t){const n=this.options,s=er(this,Yi);if(this.options=er(this,gh).defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof Xf(this.options.enabled,er(this,Yi))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");pi(this,ko,Ihe).call(this),er(this,Yi).setOptions(this.options),n._defaulted&&!Ate(this.options,n)&&er(this,gh).getQueryCache().notify({type:"observerOptionsUpdated",query:er(this,Yi),observer:this});const a=this.hasListeners();a&&Uje(er(this,Yi),s,this.options,n)&&pi(this,ko,AT).call(this),this.updateResult(),a&&(er(this,Yi)!==s||Xf(this.options.enabled,er(this,Yi))!==Xf(n.enabled,er(this,Yi))||X1(this.options.staleTime,er(this,Yi))!==X1(n.staleTime,er(this,Yi)))&&pi(this,ko,She).call(this);const o=pi(this,ko,Che).call(this);a&&(er(this,Yi)!==s||Xf(this.options.enabled,er(this,Yi))!==Xf(n.enabled,er(this,Yi))||o!==er(this,y1))&&pi(this,ko,Mhe).call(this,o)}getOptimisticResult(t){const n=er(this,gh).getQueryCache().build(er(this,gh),t),s=this.createResult(n,t);return mtt(this,s)&&(xs(this,Uu,s),xs(this,fC,this.options),xs(this,_j,er(this,Yi).state)),s}getCurrentResult(){return er(this,Uu)}trackResult(t,n){return new Proxy(t,{get:(s,a)=>(this.trackProp(a),n==null||n(a),Reflect.get(s,a))})}trackProp(t){er(this,gC).add(t)}getCurrentQuery(){return er(this,Yi)}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const n=er(this,gh).defaultQueryOptions(t),s=er(this,gh).getQueryCache().build(er(this,gh),n);return s.fetch().then(()=>this.createResult(s,n))}fetch(t){return pi(this,ko,AT).call(this,{...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),er(this,Uu)))}createResult(t,n){var G;const s=er(this,Yi),a=this.options,o=er(this,Uu),l=er(this,_j),i=er(this,fC),p=t!==s?t.state:er(this,DI),{state:x}=t;let y={...x},_=!1,b;if(n._optimisticResults){const J=this.hasListeners(),ne=!J&&$je(t,n),oe=J&&Uje(t,s,n,a);(ne||oe)&&(y={...y,..._Pe(x.data,t.options)}),n._optimisticResults==="isRestoring"&&(y.fetchStatus="idle")}let{error:S,errorUpdatedAt:k,status:M}=y;b=y.data;let P=!1;if(n.placeholderData!==void 0&&b===void 0&&M==="pending"){let J;o!=null&&o.isPlaceholderData&&n.placeholderData===(i==null?void 0:i.placeholderData)?(J=o.data,P=!0):J=typeof n.placeholderData=="function"?n.placeholderData((G=er(this,mC))==null?void 0:G.state.data,er(this,mC)):n.placeholderData,J!==void 0&&(M="success",b=jhe(o==null?void 0:o.data,J,n),_=!0)}if(n.select&&b!==void 0&&!P)if(o&&b===(l==null?void 0:l.data)&&n.select===er(this,RI))b=er(this,pC);else try{xs(this,RI,n.select),b=n.select(b),b=jhe(o==null?void 0:o.data,b,n),xs(this,pC,b),xs(this,x1,null)}catch(J){xs(this,x1,J)}er(this,x1)&&(S=er(this,x1),b=er(this,pC),k=Date.now(),M="error");const T=y.fetchStatus==="fetching",I=M==="pending",z=M==="error",D=I&&T,U=b!==void 0,W={status:M,fetchStatus:y.fetchStatus,isPending:I,isSuccess:M==="success",isError:z,isInitialLoading:D,isLoading:D,data:b,dataUpdatedAt:y.dataUpdatedAt,error:S,errorUpdatedAt:k,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&&!I,isLoadingError:z&&!U,isPaused:y.fetchStatus==="paused",isPlaceholderData:_,isRefetchError:z&&U,isStale:xxe(t,n),refetch:this.refetch,promise:er(this,g1),isEnabled:Xf(n.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const J=ge=>{W.status==="error"?ge.reject(W.error):W.data!==void 0&&ge.resolve(W.data)},ne=()=>{const ge=xs(this,g1,W.promise=khe());J(ge)},oe=er(this,g1);switch(oe.status){case"pending":t.queryHash===s.queryHash&&J(oe);break;case"fulfilled":(W.status==="error"||W.data!==oe.value)&&ne();break;case"rejected":(W.status!=="error"||W.error!==oe.reason)&&ne();break}}return W}updateResult(){const t=er(this,Uu),n=this.createResult(er(this,Yi),this.options);if(xs(this,_j,er(this,Yi).state),xs(this,fC,this.options),er(this,_j).data!==void 0&&xs(this,mC,er(this,Yi)),Ate(n,t))return;xs(this,Uu,n);const s=()=>{if(!t)return!0;const{notifyOnChangeProps:a}=this.options,o=typeof a=="function"?a():a;if(o==="all"||!o&&!er(this,gC).size)return!0;const l=new Set(o??er(this,gC));return this.options.throwOnError&&l.add("error"),Object.keys(er(this,Uu)).some(i=>{const u=i;return er(this,Uu)[u]!==t[u]&&l.has(u)})};pi(this,ko,kPe).call(this,{listeners:s()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&pi(this,ko,The).call(this)}},gh=new WeakMap,Yi=new WeakMap,DI=new WeakMap,Uu=new WeakMap,_j=new WeakMap,fC=new WeakMap,g1=new WeakMap,x1=new WeakMap,RI=new WeakMap,pC=new WeakMap,mC=new WeakMap,bj=new WeakMap,wj=new WeakMap,y1=new WeakMap,gC=new WeakMap,ko=new WeakSet,AT=function(t){pi(this,ko,Ihe).call(this);let n=er(this,Yi).fetch(this.options,t);return t!=null&&t.throwOnError||(n=n.catch(Vu)),n},She=function(){pi(this,ko,Ahe).call(this);const t=X1(this.options.staleTime,er(this,Yi));if(rk||er(this,Uu).isStale||!bhe(t))return;const s=hPe(er(this,Uu).dataUpdatedAt,t)+1;xs(this,bj,setTimeout(()=>{er(this,Uu).isStale||this.updateResult()},s))},Che=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(er(this,Yi)):this.options.refetchInterval)??!1},Mhe=function(t){pi(this,ko,Ehe).call(this),xs(this,y1,t),!(rk||Xf(this.options.enabled,er(this,Yi))===!1||!bhe(er(this,y1))||er(this,y1)===0)&&xs(this,wj,setInterval(()=>{(this.options.refetchIntervalInBackground||gxe.isFocused())&&pi(this,ko,AT).call(this)},er(this,y1)))},The=function(){pi(this,ko,She).call(this),pi(this,ko,Mhe).call(this,pi(this,ko,Che).call(this))},Ahe=function(){er(this,bj)&&(clearTimeout(er(this,bj)),xs(this,bj,void 0))},Ehe=function(){er(this,wj)&&(clearInterval(er(this,wj)),xs(this,wj,void 0))},Ihe=function(){const t=er(this,gh).getQueryCache().build(er(this,gh),this.options);if(t===er(this,Yi))return;const n=er(this,Yi);xs(this,Yi,t),xs(this,DI,t.state),this.hasListeners()&&(n==null||n.removeObserver(this),t.addObserver(this))},kPe=function(t){sd.batch(()=>{t.listeners&&this.listeners.forEach(n=>{n(er(this,Uu))}),er(this,gh).getQueryCache().notify({query:er(this,Yi),type:"observerResultsUpdated"})})},DTe);function ptt(e,t){return Xf(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status==="error"&&t.retryOnMount===!1)}function $je(e,t){return ptt(e,t)||e.state.data!==void 0&&Phe(e,t,t.refetchOnMount)}function Phe(e,t,n){if(Xf(t.enabled,e)!==!1&&X1(t.staleTime,e)!=="static"){const s=typeof n=="function"?n(e):n;return s==="always"||s!==!1&&xxe(e,t)}return!1}function Uje(e,t,n,s){return(e!==t||Xf(s.enabled,e)===!1)&&(!n.suspense||e.state.status!=="error")&&xxe(e,n)}function xxe(e,t){return Xf(t.enabled,e)!==!1&&e.isStaleByTime(X1(t.staleTime,e))}function mtt(e,t){return!Ate(e.getCurrentResult(),t)}var gtt=class extends jPe{constructor(e,t){super(e,t)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(e){super.setOptions({...e,behavior:Ite()})}getOptimisticResult(e){return e.behavior=Ite(),super.getOptimisticResult(e)}fetchNextPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(e){return this.fetch({...e,meta:{fetchMore:{direction:"backward"}}})}createResult(e,t){var S,k;const{state:n}=e,s=super.createResult(e,t),{isFetching:a,isRefetching:o,isError:l,isRefetchError:i}=s,u=(k=(S=n.fetchMeta)==null?void 0:S.fetchMore)==null?void 0:k.direction,p=l&&u==="forward",x=a&&u==="forward",y=l&&u==="backward",_=a&&u==="backward";return{...s,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:utt(t,n.data),hasPreviousPage:htt(t,n.data),isFetchNextPageError:p,isFetchingNextPage:x,isFetchPreviousPageError:y,isFetchingPreviousPage:_,isRefetchError:i&&!p&&!y,isRefetching:o&&!x&&!_}}},v1,_1,xh,Kx,by,Ree,Lhe,RTe,xtt=(RTe=class extends b3{constructor(n,s){super();ga(this,by);ga(this,v1);ga(this,_1);ga(this,xh);ga(this,Kx);xs(this,v1,n),this.setOptions(s),this.bindMethods(),pi(this,by,Ree).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,v1).defaultMutationOptions(n),Ate(this.options,s)||er(this,v1).getMutationCache().notify({type:"observerOptionsUpdated",mutation:er(this,xh),observer:this}),s!=null&&s.mutationKey&&this.options.mutationKey&&nk(s.mutationKey)!==nk(this.options.mutationKey)?this.reset():((a=er(this,xh))==null?void 0:a.state.status)==="pending"&&er(this,xh).setOptions(this.options)}onUnsubscribe(){var n;this.hasListeners()||(n=er(this,xh))==null||n.removeObserver(this)}onMutationUpdate(n){pi(this,by,Ree).call(this),pi(this,by,Lhe).call(this,n)}getCurrentResult(){return er(this,_1)}reset(){var n;(n=er(this,xh))==null||n.removeObserver(this),xs(this,xh,void 0),pi(this,by,Ree).call(this),pi(this,by,Lhe).call(this)}mutate(n,s){var a;return xs(this,Kx,s),(a=er(this,xh))==null||a.removeObserver(this),xs(this,xh,er(this,v1).getMutationCache().build(er(this,v1),this.options)),er(this,xh).addObserver(this),er(this,xh).execute(n)}},v1=new WeakMap,_1=new WeakMap,xh=new WeakMap,Kx=new WeakMap,by=new WeakSet,Ree=function(){var s;const n=((s=er(this,xh))==null?void 0:s.state)??bPe();xs(this,_1,{...n,isPending:n.status==="pending",isSuccess:n.status==="success",isError:n.status==="error",isIdle:n.status==="idle",mutate:this.mutate,reset:this.reset})},Lhe=function(n){sd.batch(()=>{var s,a,o,l,i,u,p,x;if(er(this,Kx)&&this.hasListeners()){const y=er(this,_1).variables,_=er(this,_1).context;(n==null?void 0:n.type)==="success"?((a=(s=er(this,Kx)).onSuccess)==null||a.call(s,n.data,y,_),(l=(o=er(this,Kx)).onSettled)==null||l.call(o,n.data,null,y,_)):(n==null?void 0:n.type)==="error"&&((u=(i=er(this,Kx)).onError)==null||u.call(i,n.error,y,_),(x=(p=er(this,Kx)).onSettled)==null||x.call(p,void 0,n.error,y,_))}this.listeners.forEach(y=>{y(er(this,_1))})})},RTe),NPe=E.createContext(void 0),Hr=e=>{const t=E.useContext(NPe);if(!t)throw new Error("No QueryClient set, use QueryClientProvider to set one");return t},ytt=({client:e,children:t})=>(E.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),r.jsx(NPe.Provider,{value:e,children:t})),SPe=E.createContext(!1),vtt=()=>E.useContext(SPe);SPe.Provider;function _tt(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var btt=E.createContext(_tt()),wtt=()=>E.useContext(btt),jtt=(e,t)=>{(e.suspense||e.throwOnError||e.experimental_prefetchInRender)&&(t.isReset()||(e.retryOnMount=!1))},ktt=e=>{E.useEffect(()=>{e.clearReset()},[e])},Ntt=({result:e,errorResetBoundary:t,throwOnError:n,query:s,suspense:a})=>e.isError&&!t.isReset()&&!e.isFetching&&s&&(a&&e.data===void 0||mPe(n,[e.error,s])),Stt=e=>{if(e.suspense){const t=s=>s==="static"?s:Math.max(s??1e3,1e3),n=e.staleTime;e.staleTime=typeof n=="function"?(...s)=>t(n(...s)):t(n),typeof e.gcTime=="number"&&(e.gcTime=Math.max(e.gcTime,1e3))}},Ctt=(e,t)=>e.isLoading&&e.isFetching&&!t,Mtt=(e,t)=>(e==null?void 0:e.suspense)&&t.isPending,qje=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});function CPe(e,t,n){var y,_,b,S,k;const s=vtt(),a=wtt(),o=Hr(),l=o.defaultQueryOptions(e);(_=(y=o.getDefaultOptions().queries)==null?void 0:y._experimental_beforeQuery)==null||_.call(y,l),l._optimisticResults=s?"isRestoring":"optimistic",Stt(l),jtt(l,a),ktt(a);const i=!o.getQueryCache().get(l.queryHash),[u]=E.useState(()=>new t(o,l)),p=u.getOptimisticResult(l),x=!s&&e.subscribed!==!1;if(E.useSyncExternalStore(E.useCallback(M=>{const P=x?u.subscribe(sd.batchCalls(M)):Vu;return u.updateResult(),P},[u,x]),()=>u.getCurrentResult(),()=>u.getCurrentResult()),E.useEffect(()=>{u.setOptions(l)},[l,u]),Mtt(l,p))throw qje(l,u,a);if(Ntt({result:p,errorResetBoundary:a,throwOnError:l.throwOnError,query:o.getQueryCache().get(l.queryHash),suspense:l.suspense}))throw p.error;if((S=(b=o.getDefaultOptions().queries)==null?void 0:b._experimental_afterQuery)==null||S.call(b,l,p),l.experimental_prefetchInRender&&!rk&&Ctt(p,s)){const M=i?qje(l,u,a):(k=o.getQueryCache().get(l.queryHash))==null?void 0:k.promise;M==null||M.catch(Vu).finally(()=>{u.updateResult()})}return l.notifyOnChangeProps?p:u.trackResult(p)}function Kt(e,t){return CPe(e,jPe)}function ir(e,t){const n=Hr(),[s]=E.useState(()=>new xtt(n,e));E.useEffect(()=>{s.setOptions(e)},[s,e]);const a=E.useSyncExternalStore(E.useCallback(l=>s.subscribe(sd.batchCalls(l)),[s]),()=>s.getCurrentResult(),()=>s.getCurrentResult()),o=E.useCallback((l,i)=>{s.mutate(l,i).catch(Vu)},[s]);if(a.error&&mPe(s.options.throwOnError,[a.error]))throw a.error;return{...a,mutate:o,mutateAsync:a.mutate}}function Ttt(e,t){return CPe(e,gtt)}/** * @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 kE(){return kE=Object.assign?Object.assign.bind():function(e){for(var t=1;t"u")throw new Error(t)}function MPe(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function Ett(){return Math.random().toString(36).substr(2,8)}function Hje(e,t){return{usr:e.state,key:e.key,idx:t}}function Ohe(e,t,n,s){return n===void 0&&(n=null),kE({pathname:typeof e=="string"?e:e.pathname,search:"",hash:""},typeof t=="string"?w3(t):t,{state:n,key:t&&t.key||s||Ett()})}function Pte(e){let{pathname:t="/",search:n="",hash:s=""}=e;return n&&n!=="?"&&(t+=n.charAt(0)==="?"?n:"?"+n),s&&s!=="#"&&(t+=s.charAt(0)==="#"?s:"#"+s),t}function w3(e){let t={};if(e){let n=e.indexOf("#");n>=0&&(t.hash=e.substr(n),e=e.substr(0,n));let s=e.indexOf("?");s>=0&&(t.search=e.substr(s),e=e.substr(0,s)),e&&(t.pathname=e)}return t}function Itt(e,t,n,s){s===void 0&&(s={});let{window:a=document.defaultView,v5Compat:o=!1}=s,l=a.history,i=k1.Pop,u=null,p=x();p==null&&(p=0,l.replaceState(kE({},l.state,{idx:p}),""));function x(){return(l.state||{idx:null}).idx}function y(){i=k1.Pop;let M=x(),P=M==null?null:M-p;p=M,u&&u({action:i,location:k.location,delta:P})}function _(M,P){i=k1.Push;let T=Ohe(k.location,M,P);p=x()+1;let I=Hje(T,p),z=k.createHref(T);try{l.pushState(I,"",z)}catch(D){if(D instanceof DOMException&&D.name==="DataCloneError")throw D;a.location.assign(z)}o&&u&&u({action:i,location:k.location,delta:1})}function b(M,P){i=k1.Replace;let T=Ohe(k.location,M,P);p=x();let I=Hje(T,p),z=k.createHref(T);l.replaceState(I,"",z),o&&u&&u({action:i,location:k.location,delta:0})}function S(M){let P=a.location.origin!=="null"?a.location.origin:a.location.href,T=typeof M=="string"?M:Pte(M);return T=T.replace(/ $/,"%20"),Sc(P,"No window.location.(origin|href) available to create URL for href: "+T),new URL(T,P)}let k={get action(){return i},get location(){return e(a,l)},listen(M){if(u)throw new Error("A history only accepts one active listener");return a.addEventListener(Vje,y),u=M,()=>{a.removeEventListener(Vje,y),u=null}},createHref(M){return t(a,M)},createURL:S,encodeLocation(M){let P=S(M);return{pathname:P.pathname,search:P.search,hash:P.hash}},push:_,replace:b,go(M){return l.go(M)}};return k}var Wje;(function(e){e.data="data",e.deferred="deferred",e.redirect="redirect",e.error="error"})(Wje||(Wje={}));function Ptt(e,t,n){return n===void 0&&(n="/"),Ltt(e,t,n)}function Ltt(e,t,n,s){let a=typeof t=="string"?w3(t):t,o=yxe(a.pathname||"/",n);if(o==null)return null;let l=TPe(e);Ott(l);let i=null;for(let u=0;i==null&&u{let u={relativePath:i===void 0?o.path||"":i,caseSensitive:o.caseSensitive===!0,childrenIndex:l,route:o};u.relativePath.startsWith("/")&&(Sc(u.relativePath.startsWith(s),'Absolute route path "'+u.relativePath+'" nested under path '+('"'+s+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),u.relativePath=u.relativePath.slice(s.length));let p=Q1([s,u.relativePath]),x=n.concat(u);o.children&&o.children.length>0&&(Sc(o.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+p+'".')),TPe(o.children,t,x,p)),!(o.path==null&&!o.index)&&t.push({path:p,score:Utt(p,o.index),routesMeta:x})};return e.forEach((o,l)=>{var i;if(o.path===""||!((i=o.path)!=null&&i.includes("?")))a(o,l);else for(let u of APe(o.path))a(o,l,u)}),t}function APe(e){let t=e.split("/");if(t.length===0)return[];let[n,...s]=t,a=n.endsWith("?"),o=n.replace(/\?$/,"");if(s.length===0)return a?[o,""]:[o];let l=APe(s.join("/")),i=[];return i.push(...l.map(u=>u===""?o:[o,u].join("/"))),a&&i.push(...l),i.map(u=>e.startsWith("/")&&u===""?"/":u)}function Ott(e){e.sort((t,n)=>t.score!==n.score?n.score-t.score:qtt(t.routesMeta.map(s=>s.childrenIndex),n.routesMeta.map(s=>s.childrenIndex)))}const Dtt=/^:[\w-]+$/,Rtt=3,Ftt=2,ztt=1,Btt=10,$tt=-2,Gje=e=>e==="*";function Utt(e,t){let n=e.split("/"),s=n.length;return n.some(Gje)&&(s+=$tt),t&&(s+=Ftt),n.filter(a=>!Gje(a)).reduce((a,o)=>a+(Dtt.test(o)?Rtt:o===""?ztt:Btt),s)}function qtt(e,t){return e.length===t.length&&e.slice(0,-1).every((s,a)=>s===t[a])?e[e.length-1]-t[t.length-1]:0}function Vtt(e,t,n){let{routesMeta:s}=e,a={},o="/",l=[];for(let i=0;i{let{paramName:_,isOptional:b}=x;if(_==="*"){let k=i[y]||"";l=o.slice(0,o.length-k.length).replace(/(.)\/+$/,"$1")}const S=i[y];return b&&!S?p[_]=void 0:p[_]=(S||"").replace(/%2F/g,"/"),p},{}),pathname:o,pathnameBase:l,pattern:e}}function Wtt(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!0),MPe(e==="*"||!e.endsWith("*")||e.endsWith("/*"),'Route path "'+e+'" will be treated as if it were '+('"'+e.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+e.replace(/\*$/,"/*")+'".'));let s=[],a="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(l,i,u)=>(s.push({paramName:i,isOptional:u!=null}),u?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(s.push({paramName:"*"}),a+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?a+="\\/*$":e!==""&&e!=="/"&&(a+="(?:(?=\\/|$))"),[new RegExp(a,t?void 0:"i"),s]}function Gtt(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return MPe(!1,'The URL path "'+e+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+t+").")),e}}function yxe(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith("/")?t.length-1:t.length,s=e.charAt(n);return s&&s!=="/"?null:e.slice(n)||"/"}function Ktt(e,t){t===void 0&&(t="/");let{pathname:n,search:s="",hash:a=""}=typeof e=="string"?w3(e):e;return{pathname:n?n.startsWith("/")?n:Ztt(n,t):t,search:Qtt(s),hash:Jtt(a)}}function Ztt(e,t){let n=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(a=>{a===".."?n.length>1&&n.pop():a!=="."&&n.push(a)}),n.length>1?n.join("/"):"/"}function xce(e,t,n,s){return"Cannot include a '"+e+"' character in a manually specified "+("`to."+t+"` 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 Ytt(e){return e.filter((t,n)=>n===0||t.route.path&&t.route.path.length>0)}function vxe(e,t){let n=Ytt(e);return t?n.map((s,a)=>a===n.length-1?s.pathname:s.pathnameBase):n.map(s=>s.pathnameBase)}function _xe(e,t,n,s){s===void 0&&(s=!1);let a;typeof e=="string"?a=w3(e):(a=kE({},e),Sc(!a.pathname||!a.pathname.includes("?"),xce("?","pathname","search",a)),Sc(!a.pathname||!a.pathname.includes("#"),xce("#","pathname","hash",a)),Sc(!a.search||!a.search.includes("#"),xce("#","search","hash",a)));let o=e===""||a.pathname==="",l=o?"/":a.pathname,i;if(l==null)i=n;else{let y=t.length-1;if(!s&&l.startsWith("..")){let _=l.split("/");for(;_[0]==="..";)_.shift(),y-=1;a.pathname=_.join("/")}i=y>=0?t[y]:"/"}let u=Ktt(a,i),p=l&&l!=="/"&&l.endsWith("/"),x=(o||l===".")&&n.endsWith("/");return!u.pathname.endsWith("/")&&(p||x)&&(u.pathname+="/"),u}const Q1=e=>e.join("/").replace(/\/\/+/g,"/"),Xtt=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),Qtt=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,Jtt=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function ert(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}const EPe=["post","put","patch","delete"];new Set(EPe);const trt=["get",...EPe];new Set(trt);/** * 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 NE(){return NE=Object.assign?Object.assign.bind():function(e){for(var t=1;t{i.current=!0}),E.useCallback(function(p,x){if(x===void 0&&(x={}),!i.current)return;if(typeof p=="number"){s.go(p);return}let y=_xe(p,JSON.parse(l),o,x.relative==="path");e==null&&t!=="/"&&(y.pathname=y.pathname==="/"?t:Q1([t,y.pathname])),(x.replace?s.replace:s.push)(y,x.state,x)},[t,s,l,o,e])}const art=E.createContext(null);function irt(e){let t=E.useContext(rx).outlet;return t&&E.createElement(art.Provider,{value:e},t)}function md(){let{matches:e}=E.useContext(rx),t=e[e.length-1];return t?t.params:{}}function LPe(e,t){let{relative:n}=t===void 0?{}:t,{future:s}=E.useContext(bv),{matches:a}=E.useContext(rx),{pathname:o}=Bm(),l=JSON.stringify(vxe(a,s.v7_relativeSplatPath));return E.useMemo(()=>_xe(e,JSON.parse(l),o,n==="path"),[e,l,o,n])}function ort(e,t){return lrt(e,t)}function lrt(e,t,n,s){j3()||Sc(!1);let{navigator:a}=E.useContext(bv),{matches:o}=E.useContext(rx),l=o[o.length-1],i=l?l.params:{};l&&l.pathname;let u=l?l.pathnameBase:"/";l&&l.route;let p=Bm(),x;if(t){var y;let M=typeof t=="string"?w3(t):t;u==="/"||(y=M.pathname)!=null&&y.startsWith(u)||Sc(!1),x=M}else x=p;let _=x.pathname||"/",b=_;if(u!=="/"){let M=u.replace(/^\//,"").split("/");b="/"+_.replace(/^\//,"").split("/").slice(M.length).join("/")}let S=Ptt(e,{pathname:b}),k=frt(S&&S.map(M=>Object.assign({},M,{params:Object.assign({},i,M.params),pathname:Q1([u,a.encodeLocation?a.encodeLocation(M.pathname).pathname:M.pathname]),pathnameBase:M.pathnameBase==="/"?u:Q1([u,a.encodeLocation?a.encodeLocation(M.pathnameBase).pathname:M.pathnameBase])})),o,n,s);return t&&k?E.createElement(kse.Provider,{value:{location:NE({pathname:"/",search:"",hash:"",state:null,key:"default"},x),navigationType:k1.Pop}},k):k}function crt(){let e=xrt(),t=ert(e)?e.status+" "+e.statusText:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null,a={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return E.createElement(E.Fragment,null,E.createElement("h2",null,"Unexpected Application Error!"),E.createElement("h3",{style:{fontStyle:"italic"}},t),n?E.createElement("pre",{style:a},n):null,null)}const drt=E.createElement(crt,null);class urt extends E.Component{constructor(t){super(t),this.state={location:t.location,revalidation:t.revalidation,error:t.error}}static getDerivedStateFromError(t){return{error:t}}static getDerivedStateFromProps(t,n){return n.location!==t.location||n.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:n.error,location:n.location,revalidation:t.revalidation||n.revalidation}}componentDidCatch(t,n){console.error("React Router caught the following error during render",t,n)}render(){return this.state.error!==void 0?E.createElement(rx.Provider,{value:this.props.routeContext},E.createElement(IPe.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function hrt(e){let{routeContext:t,match:n,children:s}=e,a=E.useContext(bxe);return a&&a.static&&a.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(a.staticContext._deepestRenderedBoundaryId=n.route.id),E.createElement(rx.Provider,{value:t},s)}function frt(e,t,n,s){var a;if(t===void 0&&(t=[]),n===void 0&&(n=null),s===void 0&&(s=null),e==null){var o;if(!n)return null;if(n.errors)e=n.matches;else if((o=s)!=null&&o.v7_partialHydration&&t.length===0&&!n.initialized&&n.matches.length>0)e=n.matches;else return null}let l=e,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||Sc(!1),l=l.slice(0,Math.min(l.length,x+1))}let u=!1,p=-1;if(n&&s&&s.v7_partialHydration)for(let x=0;x=0?l=l.slice(0,p+1):l=[l[0]];break}}}return l.reduceRight((x,y,_)=>{let b,S=!1,k=null,M=null;n&&(b=i&&y.route.id?i[y.route.id]:void 0,k=y.route.errorElement||drt,u&&(p<0&&_===0?(vrt("route-fallback"),S=!0,M=null):p===_&&(S=!0,M=y.route.hydrateFallbackElement||null)));let P=t.concat(l.slice(0,_+1)),T=()=>{let I;return b?I=k:S?I=M:y.route.Component?I=E.createElement(y.route.Component,null):y.route.element?I=y.route.element:I=x,E.createElement(hrt,{match:y,routeContext:{outlet:x,matches:P,isDataRoute:n!=null},children:I})};return n&&(y.route.ErrorBoundary||y.route.errorElement||_===0)?E.createElement(urt,{location:n.location,revalidation:n.revalidation,component:k,error:b,children:T(),routeContext:{outlet:null,matches:P,isDataRoute:!0}}):T()},null)}var OPe=function(e){return e.UseBlocker="useBlocker",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e}(OPe||{}),DPe=function(e){return e.UseBlocker="useBlocker",e.UseLoaderData="useLoaderData",e.UseActionData="useActionData",e.UseRouteError="useRouteError",e.UseNavigation="useNavigation",e.UseRouteLoaderData="useRouteLoaderData",e.UseMatches="useMatches",e.UseRevalidator="useRevalidator",e.UseNavigateStable="useNavigate",e.UseRouteId="useRouteId",e}(DPe||{});function prt(e){let t=E.useContext(bxe);return t||Sc(!1),t}function mrt(e){let t=E.useContext(rrt);return t||Sc(!1),t}function grt(e){let t=E.useContext(rx);return t||Sc(!1),t}function RPe(e){let t=grt(),n=t.matches[t.matches.length-1];return n.route.id||Sc(!1),n.route.id}function xrt(){var e;let t=E.useContext(IPe),n=mrt(),s=RPe();return t!==void 0?t:(e=n.errors)==null?void 0:e[s]}function yrt(){let{router:e}=prt(OPe.UseNavigateStable),t=RPe(DPe.UseNavigateStable),n=E.useRef(!1);return PPe(()=>{n.current=!0}),E.useCallback(function(a,o){o===void 0&&(o={}),n.current&&(typeof a=="number"?e.navigate(a):e.navigate(a,NE({fromRouteId:t},o)))},[e,t])}const Kje={};function vrt(e,t,n){Kje[e]||(Kje[e]=!0)}function _rt(e,t){e==null||e.v7_startTransition,e==null||e.v7_relativeSplatPath}function yce(e){let{to:t,replace:n,state:s,relative:a}=e;j3()||Sc(!1);let{future:o,static:l}=E.useContext(bv),{matches:i}=E.useContext(rx),{pathname:u}=Bm(),p=Gn(),x=_xe(t,vxe(i,o.v7_relativeSplatPath),u,a==="path"),y=JSON.stringify(x);return E.useEffect(()=>p(JSON.parse(y),{replace:n,state:s,relative:a}),[p,y,a,n,s]),null}function brt(e){return irt(e.context)}function nn(e){Sc(!1)}function wrt(e){let{basename:t="/",children:n=null,location:s,navigationType:a=k1.Pop,navigator:o,static:l=!1,future:i}=e;j3()&&Sc(!1);let u=t.replace(/^\/*/,"/"),p=E.useMemo(()=>({basename:u,navigator:o,static:l,future:NE({v7_relativeSplatPath:!1},i)}),[u,i,o,l]);typeof s=="string"&&(s=w3(s));let{pathname:x="/",search:y="",hash:_="",state:b=null,key:S="default"}=s,k=E.useMemo(()=>{let M=yxe(x,u);return M==null?null:{location:{pathname:M,search:y,hash:_,state:b,key:S},navigationType:a}},[u,x,y,_,b,S,a]);return k==null?null:E.createElement(bv.Provider,{value:p},E.createElement(kse.Provider,{children:n,value:k}))}function jrt(e){let{children:t,location:n}=e;return ort(Dhe(t),n)}new Promise(()=>{});function Dhe(e,t){t===void 0&&(t=[]);let n=[];return E.Children.forEach(e,(s,a)=>{if(!E.isValidElement(s))return;let o=[...t,a];if(s.type===E.Fragment){n.push.apply(n,Dhe(s.props.children,o));return}s.type!==nn&&Sc(!1),!s.props.index||!s.props.children||Sc(!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=Dhe(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 Rhe(){return Rhe=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&(n[a]=e[a]);return n}function Nrt(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function Srt(e,t){return e.button===0&&(!t||t==="_self")&&!Nrt(e)}function Fhe(e){return e===void 0&&(e=""),new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,n)=>{let s=e[n];return t.concat(Array.isArray(s)?s.map(a=>[n,a]):[[n,s]])},[]))}function Crt(e,t){let n=Fhe(e);return t&&t.forEach((s,a)=>{n.has(a)||t.getAll(a).forEach(o=>{n.append(a,o)})}),n}const Mrt=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],Trt="6";try{window.__reactRouterVersion=Trt}catch{}const Art="startTransition",Zje=ige[Art];function Ert(e){let{basename:t,children:n,future:s,window:a}=e,o=E.useRef();o.current==null&&(o.current=Att({window:a,v5Compat:!0}));let l=o.current,[i,u]=E.useState({action:l.action,location:l.location}),{v7_startTransition:p}=s||{},x=E.useCallback(y=>{p&&Zje?Zje(()=>u(y)):u(y)},[u,p]);return E.useLayoutEffect(()=>l.listen(x),[l,x]),E.useEffect(()=>_rt(s),[s]),E.createElement(wrt,{basename:t,children:n,location:i.location,navigationType:i.action,navigator:l,future:s})}const Irt=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",Prt=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,oo=E.forwardRef(function(t,n){let{onClick:s,relative:a,reloadDocument:o,replace:l,state:i,target:u,to:p,preventScrollReset:x,viewTransition:y}=t,_=krt(t,Mrt),{basename:b}=E.useContext(bv),S,k=!1;if(typeof p=="string"&&Prt.test(p)&&(S=p,Irt))try{let I=new URL(window.location.href),z=p.startsWith("//")?new URL(I.protocol+p):new URL(p),D=yxe(z.pathname,b);z.origin===I.origin&&D!=null?p=D+z.search+z.hash:k=!0}catch{}let M=nrt(p,{relative:a}),P=Lrt(p,{replace:l,state:i,target:u,preventScrollReset:x,relative:a,viewTransition:y});function T(I){s&&s(I),I.defaultPrevented||P(I)}return E.createElement("a",Rhe({},_,{href:S||M,onClick:k||o?s:T,ref:n,target:u}))});var Yje;(function(e){e.UseScrollRestoration="useScrollRestoration",e.UseSubmit="useSubmit",e.UseSubmitFetcher="useSubmitFetcher",e.UseFetcher="useFetcher",e.useViewTransitionState="useViewTransitionState"})(Yje||(Yje={}));var Xje;(function(e){e.UseFetcher="useFetcher",e.UseFetchers="useFetchers",e.UseScrollRestoration="useScrollRestoration"})(Xje||(Xje={}));function Lrt(e,t){let{target:n,replace:s,state:a,preventScrollReset:o,relative:l,viewTransition:i}=t===void 0?{}:t,u=Gn(),p=Bm(),x=LPe(e,{relative:l});return E.useCallback(y=>{if(Srt(y,n)){y.preventDefault();let _=s!==void 0?s:Pte(p)===Pte(x);u(e,{replace:_,state:a,preventScrollReset:o,relative:l,viewTransition:i})}},[p,u,x,s,a,n,e,o,l,i])}function Gc(e){let t=E.useRef(Fhe(e)),n=E.useRef(!1),s=Bm(),a=E.useMemo(()=>Crt(s.search,n.current?null:t.current),[s.search]),o=Gn(),l=E.useCallback((i,u)=>{const p=Fhe(typeof i=="function"?i(a):i);n.current=!0,o("?"+p,u)},[o,a]);return[a,l]}var Ort=typeof Element<"u",Drt=typeof Map=="function",Rrt=typeof Set=="function",Frt=typeof ArrayBuffer=="function"&&!!ArrayBuffer.isView;function Fee(e,t){if(e===t)return!0;if(e&&t&&typeof e=="object"&&typeof t=="object"){if(e.constructor!==t.constructor)return!1;var n,s,a;if(Array.isArray(e)){if(n=e.length,n!=t.length)return!1;for(s=n;s--!==0;)if(!Fee(e[s],t[s]))return!1;return!0}var o;if(Drt&&e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(o=e.entries();!(s=o.next()).done;)if(!t.has(s.value[0]))return!1;for(o=e.entries();!(s=o.next()).done;)if(!Fee(s.value[1],t.get(s.value[0])))return!1;return!0}if(Rrt&&e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(o=e.entries();!(s=o.next()).done;)if(!t.has(s.value[0]))return!1;return!0}if(Frt&&ArrayBuffer.isView(e)&&ArrayBuffer.isView(t)){if(n=e.length,n!=t.length)return!1;for(s=n;s--!==0;)if(e[s]!==t[s])return!1;return!0}if(e.constructor===RegExp)return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf&&typeof e.valueOf=="function"&&typeof t.valueOf=="function")return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString&&typeof e.toString=="function"&&typeof t.toString=="function")return e.toString()===t.toString();if(a=Object.keys(e),n=a.length,n!==Object.keys(t).length)return!1;for(s=n;s--!==0;)if(!Object.prototype.hasOwnProperty.call(t,a[s]))return!1;if(Ort&&e instanceof Element)return!1;for(s=n;s--!==0;)if(!((a[s]==="_owner"||a[s]==="__v"||a[s]==="__o")&&e.$$typeof)&&!Fee(e[a[s]],t[a[s]]))return!1;return!0}return e!==e&&t!==t}var zrt=function(t,n){try{return Fee(t,n)}catch(s){if((s.message||"").match(/stack|recursion/i))return console.warn("react-fast-compare cannot handle circular refs"),!1;throw s}};const Brt=Qi(zrt);var $rt=function(e,t,n,s,a,o,l,i){if(!e){var u;if(t===void 0)u=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var p=[n,s,a,o,l,i],x=0;u=new Error(t.replace(/%s/g,function(){return p[x++]})),u.name="Invariant Violation"}throw u.framesToPop=1,u}},Urt=$rt;const Qje=Qi(Urt);var qrt=function(t,n,s,a){var o=s?s.call(a,t,n):void 0;if(o!==void 0)return!!o;if(t===n)return!0;if(typeof t!="object"||!t||typeof n!="object"||!n)return!1;var l=Object.keys(t),i=Object.keys(n);if(l.length!==i.length)return!1;for(var u=Object.prototype.hasOwnProperty.bind(n),p=0;p(e.BASE="base",e.BODY="body",e.HEAD="head",e.HTML="html",e.LINK="link",e.META="meta",e.NOSCRIPT="noscript",e.SCRIPT="script",e.STYLE="style",e.TITLE="title",e.FRAGMENT="Symbol(react.fragment)",e))(FPe||{}),vce={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"]}},Jje=Object.values(FPe),wxe={accesskey:"accessKey",charset:"charSet",class:"className",contenteditable:"contentEditable",contextmenu:"contextMenu","http-equiv":"httpEquiv",itemprop:"itemProp",tabindex:"tabIndex"},Hrt=Object.entries(wxe).reduce((e,[t,n])=>(e[n]=t,e),{}),_m="data-rh",$S={DEFAULT_TITLE:"defaultTitle",DEFER:"defer",ENCODE_SPECIAL_CHARACTERS:"encodeSpecialCharacters",ON_CHANGE_CLIENT_STATE:"onChangeClientState",TITLE_TEMPLATE:"titleTemplate",PRIORITIZE_SEO_TAGS:"prioritizeSeoTags"},US=(e,t)=>{for(let n=e.length-1;n>=0;n-=1){const s=e[n];if(Object.prototype.hasOwnProperty.call(s,t))return s[t]}return null},Wrt=e=>{let t=US(e,"title");const n=US(e,$S.TITLE_TEMPLATE);if(Array.isArray(t)&&(t=t.join("")),n&&t)return n.replace(/%s/g,()=>t);const s=US(e,$S.DEFAULT_TITLE);return t||s||void 0},Grt=e=>US(e,$S.ON_CHANGE_CLIENT_STATE)||(()=>{}),_ce=(e,t)=>t.filter(n=>typeof n[e]<"u").map(n=>n[e]).reduce((n,s)=>({...n,...s}),{}),Krt=(e,t)=>t.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(e),tT=(e,t,n)=>{const s={};return n.filter(a=>Array.isArray(a[e])?!0:(typeof a[e]<"u"&&Zrt(`Helmet: ${e} should be of type "Array". Instead found type "${typeof a[e]}"`),!1)).map(a=>a[e]).reverse().reduce((a,o)=>{const l={};o.filter(u=>{let p;const x=Object.keys(u);for(let _=0;_a.push(u));const i=Object.keys(l);for(let u=0;u{if(Array.isArray(e)&&e.length){for(let n=0;n({baseTag:Krt(["href"],e),bodyAttributes:_ce("bodyAttributes",e),defer:US(e,$S.DEFER),encode:US(e,$S.ENCODE_SPECIAL_CHARACTERS),htmlAttributes:_ce("htmlAttributes",e),linkTags:tT("link",["rel","href"],e),metaTags:tT("meta",["name","charset","http-equiv","property","itemprop"],e),noscriptTags:tT("noscript",["innerHTML"],e),onChangeClientState:Grt(e),scriptTags:tT("script",["src","innerHTML"],e),styleTags:tT("style",["cssText"],e),title:Wrt(e),titleAttributes:_ce("titleAttributes",e),prioritizeSeoTags:Yrt(e,$S.PRIORITIZE_SEO_TAGS)}),zPe=e=>Array.isArray(e)?e.join(""):e,Qrt=(e,t)=>{const n=Object.keys(e);for(let s=0;sArray.isArray(e)?e.reduce((n,s)=>(Qrt(s,t)?n.priority.push(s):n.default.push(s),n),{priority:[],default:[]}):{default:e,priority:[]},eke=(e,t)=>({...e,[t]:void 0}),Jrt=["noscript","script","style"],zhe=(e,t=!0)=>t===!1?String(e):String(e).replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'"),BPe=e=>Object.keys(e).reduce((t,n)=>{const s=typeof e[n]<"u"?`${n}="${e[n]}"`:`${n}`;return t?`${t} ${s}`:s},""),ent=(e,t,n,s)=>{const a=BPe(n),o=zPe(t);return a?`<${e} ${_m}="true" ${a}>${zhe(o,s)}`:`<${e} ${_m}="true">${zhe(o,s)}`},tnt=(e,t,n=!0)=>t.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}="${zhe(o[x],n)}"`;return p?`${p} ${y}`:y},""),i=o.innerHTML||o.cssText||"",u=Jrt.indexOf(e)===-1;return`${s}<${e} ${_m}="true" ${l}${u?"/>":`>${i}`}`},""),$Pe=(e,t={})=>Object.keys(e).reduce((n,s)=>{const a=wxe[s];return n[a||s]=e[s],n},t),rnt=(e,t,n)=>{const s={key:t,[_m]:!0},a=$Pe(n,s);return[lt.createElement("title",a,t)]},zee=(e,t)=>t.map((n,s)=>{const a={key:s,[_m]:!0};return Object.keys(n).forEach(o=>{const i=wxe[o]||o;if(i==="innerHTML"||i==="cssText"){const u=n.innerHTML||n.cssText;a.dangerouslySetInnerHTML={__html:u}}else a[i]=n[o]}),lt.createElement(e,a)}),Zf=(e,t,n=!0)=>{switch(e){case"title":return{toComponent:()=>rnt(e,t.title,t.titleAttributes),toString:()=>ent(e,t.title,t.titleAttributes,n)};case"bodyAttributes":case"htmlAttributes":return{toComponent:()=>$Pe(t),toString:()=>BPe(t)};default:return{toComponent:()=>zee(e,t),toString:()=>tnt(e,t,n)}}},nnt=({metaTags:e,linkTags:t,scriptTags:n,encode:s})=>{const a=bce(e,vce.meta),o=bce(t,vce.link),l=bce(n,vce.script);return{priorityMethods:{toComponent:()=>[...zee("meta",a.priority),...zee("link",o.priority),...zee("script",l.priority)],toString:()=>`${Zf("meta",a.priority,s)} ${Zf("link",o.priority,s)} ${Zf("script",l.priority,s)}`},metaTags:a.default,linkTags:o.default,scriptTags:l.default}},snt=e=>{const{baseTag:t,bodyAttributes:n,encode:s=!0,htmlAttributes:a,noscriptTags:o,styleTags:l,title:i="",titleAttributes:u,prioritizeSeoTags:p}=e;let{linkTags:x,metaTags:y,scriptTags:_}=e,b={toComponent:()=>{},toString:()=>""};return p&&({priorityMethods:b,linkTags:x,metaTags:y,scriptTags:_}=nnt(e)),{priority:b,base:Zf("base",t,s),bodyAttributes:Zf("bodyAttributes",n,s),htmlAttributes:Zf("htmlAttributes",a,s),link:Zf("link",x,s),meta:Zf("meta",y,s),noscript:Zf("noscript",o,s),script:Zf("script",_,s),style:Zf("style",l,s),title:Zf("title",{title:i,titleAttributes:u},s)}},Bhe=snt,VL=[],UPe=!!(typeof window<"u"&&window.document&&window.document.createElement),$he=class{constructor(e,t){Xn(this,"instances",[]);Xn(this,"canUseDOM",UPe);Xn(this,"context");Xn(this,"value",{setHelmet:e=>{this.context.helmet=e},helmetInstances:{get:()=>this.canUseDOM?VL:this.instances,add:e=>{(this.canUseDOM?VL:this.instances).push(e)},remove:e=>{const t=(this.canUseDOM?VL:this.instances).indexOf(e);(this.canUseDOM?VL:this.instances).splice(t,1)}}});this.context=e,this.canUseDOM=t||!1,t||(e.helmet=Bhe({baseTag:[],bodyAttributes:{},htmlAttributes:{},linkTags:[],metaTags:[],noscriptTags:[],scriptTags:[],styleTags:[],title:"",titleAttributes:{}}))}},ant={},qPe=lt.createContext(ant),jj,VPe=(jj=class extends E.Component{constructor(n){super(n);Xn(this,"helmetData");this.helmetData=new $he(this.props.context||{},jj.canUseDOM)}render(){return lt.createElement(qPe.Provider,{value:this.helmetData.value},this.props.children)}},Xn(jj,"canUseDOM",UPe),jj),g4=(e,t)=>{const n=document.head||document.querySelector("head"),s=n.querySelectorAll(`${e}[${_m}]`),a=[].slice.call(s),o=[];let l;return t&&t.length&&t.forEach(i=>{const u=document.createElement(e);for(const p in i)if(Object.prototype.hasOwnProperty.call(i,p))if(p==="innerHTML")u.innerHTML=i.innerHTML;else if(p==="cssText")u.styleSheet?u.styleSheet.cssText=i.cssText:u.appendChild(document.createTextNode(i.cssText));else{const x=p,y=typeof i[x]>"u"?"":i[x];u.setAttribute(p,y)}u.setAttribute(_m,"true"),a.some((p,x)=>(l=x,u.isEqualNode(p)))?a.splice(l,1):o.push(u)}),a.forEach(i=>{var u;return(u=i.parentNode)==null?void 0:u.removeChild(i)}),o.forEach(i=>n.appendChild(i)),{oldTags:a,newTags:o}},Uhe=(e,t)=>{const n=document.getElementsByTagName(e)[0];if(!n)return;const s=n.getAttribute(_m),a=s?s.split(","):[],o=[...a],l=Object.keys(t);for(const i of l){const u=t[i]||"";n.getAttribute(i)!==u&&n.setAttribute(i,u),a.indexOf(i)===-1&&a.push(i);const p=o.indexOf(i);p!==-1&&o.splice(p,1)}for(let i=o.length-1;i>=0;i-=1)n.removeAttribute(o[i]);a.length===o.length?n.removeAttribute(_m):n.getAttribute(_m)!==l.join(",")&&n.setAttribute(_m,l.join(","))},int=(e,t)=>{typeof e<"u"&&document.title!==e&&(document.title=zPe(e)),Uhe("title",t)},tke=(e,t)=>{const{baseTag:n,bodyAttributes:s,htmlAttributes:a,linkTags:o,metaTags:l,noscriptTags:i,onChangeClientState:u,scriptTags:p,styleTags:x,title:y,titleAttributes:_}=e;Uhe("body",s),Uhe("html",a),int(y,_);const b={baseTag:g4("base",n),linkTags:g4("link",o),metaTags:g4("meta",l),noscriptTags:g4("noscript",i),scriptTags:g4("script",p),styleTags:g4("style",x)},S={},k={};Object.keys(b).forEach(M=>{const{newTags:P,oldTags:T}=b[M];P.length&&(S[M]=P),T.length&&(k[M]=b[M].oldTags)}),t&&t(),u(e,S,k)},rT=null,ont=e=>{rT&&cancelAnimationFrame(rT),e.defer?rT=requestAnimationFrame(()=>{tke(e,()=>{rT=null})}):(tke(e),rT=null)},lnt=ont,rke=class extends E.Component{constructor(){super(...arguments);Xn(this,"rendered",!1)}shouldComponentUpdate(t){return!Vrt(t,this.props)}componentDidUpdate(){this.emitChange()}componentWillUnmount(){const{helmetInstances:t}=this.props.context;t.remove(this),this.emitChange()}emitChange(){const{helmetInstances:t,setHelmet:n}=this.props.context;let s=null;const a=Xrt(t.get().map(o=>{const l={...o.props};return delete l.context,l}));VPe.canUseDOM?lnt(a):Bhe&&(s=Bhe(a)),n(s)}init(){if(this.rendered)return;this.rendered=!0;const{helmetInstances:t}=this.props.context;t.add(this),this.emitChange()}render(){return this.init(),null}},xue,$m=(xue=class extends E.Component{shouldComponentUpdate(e){return!Brt(eke(this.props,"helmetData"),eke(e,"helmetData"))}mapNestedChildrenToProps(e,t){if(!t)return null;switch(e.type){case"script":case"noscript":return{innerHTML:t};case"style":return{cssText:t};default:throw new Error(`<${e.type} /> elements are self-closing and can not contain children. Refer to our API for more information.`)}}flattenArrayTypeChildren(e,t,n,s){return{...t,[e.type]:[...t[e.type]||[],{...n,...this.mapNestedChildrenToProps(e,s)}]}}mapObjectTypeChildren(e,t,n,s){switch(e.type){case"title":return{...t,[e.type]:s,titleAttributes:{...n}};case"body":return{...t,bodyAttributes:{...n}};case"html":return{...t,htmlAttributes:{...n}};default:return{...t,[e.type]:{...n}}}}mapArrayTypeChildrenToProps(e,t){let n={...t};return Object.keys(e).forEach(s=>{n={...n,[s]:e[s]}}),n}warnOnInvalidChildren(e,t){return Qje(Jje.some(n=>e.type===n),typeof e.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 ${Jje.join(", ")} are allowed. Helmet does not support rendering <${e.type}> elements. Refer to our API for more information.`),Qje(!t||typeof t=="string"||Array.isArray(t)&&!t.some(n=>typeof n!="string"),`Helmet expects a string as a child of <${e.type}>. Did you forget to wrap your children in braces? ( <${e.type}>{\`\`} ) Refer to our API for more information.`),!0}mapChildrenToProps(e,t){let n={};return lt.Children.forEach(e,s=>{if(!s||!s.props)return;const{children:a,...o}=s.props,l=Object.keys(o).reduce((u,p)=>(u[Hrt[p]||p]=o[p],u),{});let{type:i}=s;switch(typeof i=="symbol"?i=i.toString():this.warnOnInvalidChildren(s,a),i){case"Symbol(react.fragment)":t=this.mapChildrenToProps(a,t);break;case"link":case"meta":case"noscript":case"script":case"style":n=this.flattenArrayTypeChildren(s,n,l,a);break;default:t=this.mapObjectTypeChildren(s,t,l,a);break}}),this.mapArrayTypeChildrenToProps(n,t)}render(){const{children:e,...t}=this.props;let n={...t},{helmetData:s}=t;if(e&&(n=this.mapChildrenToProps(e,n)),s&&!(s instanceof $he)){const a=s;s=new $he(a.context,!0),delete n.helmetData}return s?lt.createElement(rke,{...n,context:s.value}):lt.createElement(qPe.Consumer,null,a=>lt.createElement(rke,{...n,context:a}))}},Xn(xue,"defaultProps",{defer:!0,encodeSpecialCharacters:!0,prioritizeSeoTags:!1}),xue),qhe=function(e,t){return qhe=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])},qhe(e,t)};function HPe(e,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");qhe(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}var np=function(){return np=Object.assign||function(t){for(var n,s=1,a=arguments.length;s=0;i--)(l=e[i])&&(o=(a<3?l(o):a>3?l(t,n,o):l(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o}function GPe(e,t){return function(n,s){t(n,s,e)}}function KPe(e,t,n,s,a,o){function l(P){if(P!==void 0&&typeof P!="function")throw new TypeError("Function expected");return P}for(var i=s.kind,u=i==="getter"?"get":i==="setter"?"set":"value",p=!t&&e?s.static?e:e.prototype:null,x=t||(p?Object.getOwnPropertyDescriptor(p,s.name):{}),y,_=!1,b=n.length-1;b>=0;b--){var S={};for(var k in s)S[k]=k==="access"?{}:s[k];for(var k in s.access)S.access[k]=s.access[k];S.addInitializer=function(P){if(_)throw new TypeError("Cannot add initializers after decoration has completed");o.push(l(P||null))};var M=(0,n[b])(i==="accessor"?{get:x.get,set:x.set}:x[u],S);if(i==="accessor"){if(M===void 0)continue;if(M===null||typeof M!="object")throw new TypeError("Object expected");(y=l(M.get))&&(x.get=y),(y=l(M.set))&&(x.set=y),(y=l(M.init))&&a.unshift(y)}else(y=l(M))&&(i==="field"?a.unshift(y):x[u]=y)}p&&Object.defineProperty(p,s.name,x),_=!0}function ZPe(e,t,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]=e.length&&(e=void 0),{value:e&&e[s++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function jxe(e,t){var n=typeof Symbol=="function"&&e[Symbol.iterator];if(!n)return e;var s=n.call(e),a,o=[],l;try{for(;(t===void 0||t-- >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 t6e(){for(var e=[],t=0;t1||u(b,k)})},S&&(a[b]=S(a[b])))}function u(b,S){try{p(s[b](S))}catch(k){_(o[0][3],k)}}function p(b){b.value instanceof SC?Promise.resolve(b.value.v).then(x,y):_(o[0][2],b)}function x(b){u("next",b)}function y(b){u("throw",b)}function _(b,S){b(S),o.shift(),o.length&&u(o[0][0],o[0][1])}}function s6e(e){var t,n;return t={},s("next"),s("throw",function(a){throw a}),s("return"),t[Symbol.iterator]=function(){return this},t;function s(a,o){t[a]=e[a]?function(l){return(n=!n)?{value:SC(e[a](l)),done:!1}:o?o(l):l}:o}}function a6e(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t=e[Symbol.asyncIterator],n;return t?t.call(e):(e=typeof Lte=="function"?Lte(e):e[Symbol.iterator](),n={},s("next"),s("throw"),s("return"),n[Symbol.asyncIterator]=function(){return this},n);function s(o){n[o]=e[o]&&function(l){return new Promise(function(i,u){l=e[o](l),a(i,u,l.done,l.value)})}}function a(o,l,i,u){Promise.resolve(u).then(function(p){o({value:p,done:i})},l)}}function i6e(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}var cnt=Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t},Vhe=function(e){return Vhe=Object.getOwnPropertyNames||function(t){var n=[];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(n[n.length]=s);return n},Vhe(e)};function o6e(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n=Vhe(e),s=0;s0){document.getElementsByTagName("link");const l=document.querySelector("meta[property=csp-nonce]"),i=(l==null?void 0:l.nonce)||(l==null?void 0:l.getAttribute("nonce"));a=Promise.allSettled(n.map(u=>{if(u=pnt(u),u in nke)return;nke[u]=!0;const p=u.endsWith(".css"),x=p?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${u}"]${x}`))return;const y=document.createElement("link");if(y.rel=p?"stylesheet":fnt,p||(y.as="script"),y.crossOrigin="",y.href=u,i&&y.setAttribute("nonce",i),document.head.appendChild(y),p)return new Promise((_,b)=>{y.addEventListener("load",_),y.addEventListener("error",()=>b(new Error(`Unable to preload CSS for ${u}`)))})}))}function o(l){const i=new Event("vite:preloadError",{cancelable:!0});if(i.payload=l,window.dispatchEvent(i),!i.defaultPrevented)throw l}return a.then(l=>{for(const i of l||[])i.status==="rejected"&&o(i.reason);return t().catch(o)})},mnt=e=>{let t;return e?t=e:typeof fetch>"u"?t=(...n)=>k3(async()=>{const{default:s}=await Promise.resolve().then(()=>Nk);return{default:s}},void 0).then(({default:s})=>s(...n)):t=fetch,(...n)=>t(...n)};class Nxe extends Error{constructor(t,n="FunctionsError",s){super(t),this.name=n,this.context=s}}class ske extends Nxe{constructor(t){super("Failed to send a request to the Edge Function","FunctionsFetchError",t)}}class ake extends Nxe{constructor(t){super("Relay Error invoking the Edge Function","FunctionsRelayError",t)}}class ike extends Nxe{constructor(t){super("Edge Function returned a non-2xx status code","FunctionsHttpError",t)}}var Hhe;(function(e){e.Any="any",e.ApNortheast1="ap-northeast-1",e.ApNortheast2="ap-northeast-2",e.ApSouth1="ap-south-1",e.ApSoutheast1="ap-southeast-1",e.ApSoutheast2="ap-southeast-2",e.CaCentral1="ca-central-1",e.EuCentral1="eu-central-1",e.EuWest1="eu-west-1",e.EuWest2="eu-west-2",e.EuWest3="eu-west-3",e.SaEast1="sa-east-1",e.UsEast1="us-east-1",e.UsWest1="us-west-1",e.UsWest2="us-west-2"})(Hhe||(Hhe={}));class gnt{constructor(t,{headers:n={},customFetch:s,region:a=Hhe.Any}={}){this.url=t,this.headers=n,this.region=a,this.fetch=mnt(s)}setAuth(t){this.headers.Authorization=`Bearer ${t}`}invoke(t){return zs(this,arguments,void 0,function*(n,s={}){var a;try{const{headers:o,method:l,body:i,signal:u}=s;let p={},{region:x}=s;x||(x=this.region);const y=new URL(`${this.url}/${n}`);x&&x!=="any"&&(p["x-region"]=x,y.searchParams.set("forceFunctionRegion",x));let _;i&&(o&&!Object.prototype.hasOwnProperty.call(o,"Content-Type")||!o)?typeof Blob<"u"&&i instanceof Blob||i instanceof ArrayBuffer?(p["Content-Type"]="application/octet-stream",_=i):typeof i=="string"?(p["Content-Type"]="text/plain",_=i):typeof FormData<"u"&&i instanceof FormData?_=i:(p["Content-Type"]="application/json",_=JSON.stringify(i)):_=i;const b=yield this.fetch(y.toString(),{method:l||"POST",headers:Object.assign(Object.assign(Object.assign({},p),this.headers),o),body:_,signal:u}).catch(P=>{throw P.name==="AbortError"?P:new ske(P)}),S=b.headers.get("x-relay-error");if(S&&S==="true")throw new ake(b);if(!b.ok)throw new ike(b);let k=((a=b.headers.get("Content-Type"))!==null&&a!==void 0?a:"text/plain").split(";")[0].trim(),M;return k==="application/json"?M=yield b.json():k==="application/octet-stream"||k==="application/pdf"?M=yield b.blob():k==="text/event-stream"?M=b:k==="multipart/form-data"?M=yield b.formData():M=yield b.text(),{data:M,error:null,response:b}}catch(o){return o instanceof Error&&o.name==="AbortError"?{data:null,error:new ske(o)}:{data:null,error:o,response:o instanceof ike||o instanceof ake?o.context:void 0}}})}}var bh={};const N3=FTe(hnt);var HL={},WL={},GL={},KL={},ZL={},xnt=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")},CC=xnt();const ynt=CC.fetch,m6e=CC.fetch.bind(CC),g6e=CC.Headers,vnt=CC.Request,_nt=CC.Response,Nk=Object.freeze(Object.defineProperty({__proto__:null,Headers:g6e,Request:vnt,Response:_nt,default:m6e,fetch:ynt},Symbol.toStringTag,{value:"Module"})),bnt=FTe(Nk);var YL={},oke;function x6e(){if(oke)return YL;oke=1,Object.defineProperty(YL,"__esModule",{value:!0});class e extends Error{constructor(n){super(n.message),this.name="PostgrestError",this.details=n.details,this.hint=n.hint,this.code=n.code}}return YL.default=e,YL}var lke;function y6e(){if(lke)return ZL;lke=1,Object.defineProperty(ZL,"__esModule",{value:!0});const e=N3,t=e.__importDefault(bnt),n=e.__importDefault(x6e());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=t.default:this.fetch=fetch}throwOnError(){return this.shouldThrowOnError=!0,this}setHeader(o,l){return this.headers=new Headers(this.headers),this.headers.set(o,l),this}then(o,l){this.schema===void 0||(["GET","HEAD"].includes(this.method)?this.headers.set("Accept-Profile",this.schema):this.headers.set("Content-Profile",this.schema)),this.method!=="GET"&&this.method!=="HEAD"&&this.headers.set("Content-Type","application/json");const i=this.fetch;let u=i(this.url.toString(),{method:this.method,headers:this.headers,body:JSON.stringify(this.body),signal:this.signal}).then(async p=>{var x,y,_,b;let S=null,k=null,M=null,P=p.status,T=p.statusText;if(p.ok){if(this.method!=="HEAD"){const U=await p.text();U===""||(this.headers.get("Accept")==="text/csv"||this.headers.get("Accept")&&(!((x=this.headers.get("Accept"))===null||x===void 0)&&x.includes("application/vnd.pgrst.plan+text"))?k=U:k=JSON.parse(U))}const z=(y=this.headers.get("Prefer"))===null||y===void 0?void 0:y.match(/count=(exact|planned|estimated)/),D=(_=p.headers.get("content-range"))===null||_===void 0?void 0:_.split("/");z&&D&&D.length>1&&(M=parseInt(D[1])),this.isMaybeSingle&&this.method==="GET"&&Array.isArray(k)&&(k.length>1?(S={code:"PGRST116",details:`Results contain ${k.length} rows, application/vnd.pgrst.object+json requires 1 row`,hint:null,message:"JSON object requested, multiple (or no) rows returned"},k=null,M=null,P=406,T="Not Acceptable"):k.length===1?k=k[0]:k=null)}else{const z=await p.text();try{S=JSON.parse(z),Array.isArray(S)&&p.status===404&&(k=[],S=null,P=200,T="OK")}catch{p.status===404&&z===""?(P=204,T="No Content"):S={message:z}}if(S&&this.isMaybeSingle&&(!((b=S==null?void 0:S.details)===null||b===void 0)&&b.includes("0 rows"))&&(S=null,P=200,T="OK"),S&&this.shouldThrowOnError)throw new n.default(S)}return{error:S,data:k,count:M,status:P,statusText:T}});return this.shouldThrowOnError||(u=u.catch(p=>{var x,y,_;return{error:{message:`${(x=p==null?void 0:p.name)!==null&&x!==void 0?x:"FetchError"}: ${p==null?void 0:p.message}`,details:`${(y=p==null?void 0:p.stack)!==null&&y!==void 0?y:""}`,hint:"",code:`${(_=p==null?void 0:p.code)!==null&&_!==void 0?_:""}`},data:null,count:null,status:0,statusText:""}})),u.then(o,l)}returns(){return this}overrideTypes(){return this}}return ZL.default=s,ZL}var cke;function v6e(){if(cke)return KL;cke=1,Object.defineProperty(KL,"__esModule",{value:!0});const t=N3.__importDefault(y6e());class n extends t.default{select(a){let o=!1;const l=(a??"*").split("").map(i=>/\s/.test(i)&&!o?"":(i==='"'&&(o=!o),i)).join("");return this.url.searchParams.set("select",l),this.headers.append("Prefer","return=representation"),this}order(a,{ascending:o=!0,nullsFirst:l,foreignTable:i,referencedTable:u=i}={}){const p=u?`${u}.order`:"order",x=this.url.searchParams.get(p);return this.url.searchParams.set(p,`${x?`${x},`:""}${a}.${o?"asc":"desc"}${l===void 0?"":l?".nullsfirst":".nullslast"}`),this}limit(a,{foreignTable:o,referencedTable:l=o}={}){const i=typeof l>"u"?"limit":`${l}.limit`;return this.url.searchParams.set(i,`${a}`),this}range(a,o,{foreignTable:l,referencedTable:i=l}={}){const u=typeof i>"u"?"offset":`${i}.offset`,p=typeof i>"u"?"limit":`${i}.limit`;return this.url.searchParams.set(u,`${a}`),this.url.searchParams.set(p,`${o-a+1}`),this}abortSignal(a){return this.signal=a,this}single(){return this.headers.set("Accept","application/vnd.pgrst.object+json"),this}maybeSingle(){return this.method==="GET"?this.headers.set("Accept","application/json"):this.headers.set("Accept","application/vnd.pgrst.object+json"),this.isMaybeSingle=!0,this}csv(){return this.headers.set("Accept","text/csv"),this}geojson(){return this.headers.set("Accept","application/geo+json"),this}explain({analyze:a=!1,verbose:o=!1,settings:l=!1,buffers:i=!1,wal:u=!1,format:p="text"}={}){var x;const y=[a?"analyze":null,o?"verbose":null,l?"settings":null,i?"buffers":null,u?"wal":null].filter(Boolean).join("|"),_=(x=this.headers.get("Accept"))!==null&&x!==void 0?x:"application/json";return this.headers.set("Accept",`application/vnd.pgrst.plan+${p}; for="${_}"; options=${y};`),p==="json"?this:this}rollback(){return this.headers.append("Prefer","tx=rollback"),this}returns(){return this}maxAffected(a){return this.headers.append("Prefer","handling=strict"),this.headers.append("Prefer",`max-affected=${a}`),this}}return KL.default=n,KL}var dke;function Sxe(){if(dke)return GL;dke=1,Object.defineProperty(GL,"__esModule",{value:!0});const t=N3.__importDefault(v6e()),n=new RegExp("[,()]");class s extends t.default{eq(o,l){return this.url.searchParams.append(o,`eq.${l}`),this}neq(o,l){return this.url.searchParams.append(o,`neq.${l}`),this}gt(o,l){return this.url.searchParams.append(o,`gt.${l}`),this}gte(o,l){return this.url.searchParams.append(o,`gte.${l}`),this}lt(o,l){return this.url.searchParams.append(o,`lt.${l}`),this}lte(o,l){return this.url.searchParams.append(o,`lte.${l}`),this}like(o,l){return this.url.searchParams.append(o,`like.${l}`),this}likeAllOf(o,l){return this.url.searchParams.append(o,`like(all).{${l.join(",")}}`),this}likeAnyOf(o,l){return this.url.searchParams.append(o,`like(any).{${l.join(",")}}`),this}ilike(o,l){return this.url.searchParams.append(o,`ilike.${l}`),this}ilikeAllOf(o,l){return this.url.searchParams.append(o,`ilike(all).{${l.join(",")}}`),this}ilikeAnyOf(o,l){return this.url.searchParams.append(o,`ilike(any).{${l.join(",")}}`),this}is(o,l){return this.url.searchParams.append(o,`is.${l}`),this}in(o,l){const i=Array.from(new Set(l)).map(u=>typeof u=="string"&&n.test(u)?`"${u}"`:`${u}`).join(",");return this.url.searchParams.append(o,`in.(${i})`),this}contains(o,l){return typeof l=="string"?this.url.searchParams.append(o,`cs.${l}`):Array.isArray(l)?this.url.searchParams.append(o,`cs.{${l.join(",")}}`):this.url.searchParams.append(o,`cs.${JSON.stringify(l)}`),this}containedBy(o,l){return typeof l=="string"?this.url.searchParams.append(o,`cd.${l}`):Array.isArray(l)?this.url.searchParams.append(o,`cd.{${l.join(",")}}`):this.url.searchParams.append(o,`cd.${JSON.stringify(l)}`),this}rangeGt(o,l){return this.url.searchParams.append(o,`sr.${l}`),this}rangeGte(o,l){return this.url.searchParams.append(o,`nxl.${l}`),this}rangeLt(o,l){return this.url.searchParams.append(o,`sl.${l}`),this}rangeLte(o,l){return this.url.searchParams.append(o,`nxr.${l}`),this}rangeAdjacent(o,l){return this.url.searchParams.append(o,`adj.${l}`),this}overlaps(o,l){return typeof l=="string"?this.url.searchParams.append(o,`ov.${l}`):this.url.searchParams.append(o,`ov.{${l.join(",")}}`),this}textSearch(o,l,{config:i,type:u}={}){let p="";u==="plain"?p="pl":u==="phrase"?p="ph":u==="websearch"&&(p="w");const x=i===void 0?"":`(${i})`;return this.url.searchParams.append(o,`${p}fts${x}.${l}`),this}match(o){return Object.entries(o).forEach(([l,i])=>{this.url.searchParams.append(l,`eq.${i}`)}),this}not(o,l,i){return this.url.searchParams.append(o,`not.${l}.${i}`),this}or(o,{foreignTable:l,referencedTable:i=l}={}){const u=i?`${i}.or`:"or";return this.url.searchParams.append(u,`(${o})`),this}filter(o,l,i){return this.url.searchParams.append(o,`${l}.${i}`),this}}return GL.default=s,GL}var uke;function _6e(){if(uke)return WL;uke=1,Object.defineProperty(WL,"__esModule",{value:!0});const t=N3.__importDefault(Sxe());class n{constructor(a,{headers:o={},schema:l,fetch:i}){this.url=a,this.headers=new Headers(o),this.schema=l,this.fetch=i}select(a,o){const{head:l=!1,count:i}=o??{},u=l?"HEAD":"GET";let p=!1;const x=(a??"*").split("").map(y=>/\s/.test(y)&&!p?"":(y==='"'&&(p=!p),y)).join("");return this.url.searchParams.set("select",x),i&&this.headers.append("Prefer",`count=${i}`),new t.default({method:u,url:this.url,headers:this.headers,schema:this.schema,fetch:this.fetch})}insert(a,{count:o,defaultToNull:l=!0}={}){var i;const u="POST";if(o&&this.headers.append("Prefer",`count=${o}`),l||this.headers.append("Prefer","missing=default"),Array.isArray(a)){const p=a.reduce((x,y)=>x.concat(Object.keys(y)),[]);if(p.length>0){const x=[...new Set(p)].map(y=>`"${y}"`);this.url.searchParams.set("columns",x.join(","))}}return new t.default({method:u,url:this.url,headers:this.headers,schema:this.schema,body:a,fetch:(i=this.fetch)!==null&&i!==void 0?i:fetch})}upsert(a,{onConflict:o,ignoreDuplicates:l=!1,count:i,defaultToNull:u=!0}={}){var p;const x="POST";if(this.headers.append("Prefer",`resolution=${l?"ignore":"merge"}-duplicates`),o!==void 0&&this.url.searchParams.set("on_conflict",o),i&&this.headers.append("Prefer",`count=${i}`),u||this.headers.append("Prefer","missing=default"),Array.isArray(a)){const y=a.reduce((_,b)=>_.concat(Object.keys(b)),[]);if(y.length>0){const _=[...new Set(y)].map(b=>`"${b}"`);this.url.searchParams.set("columns",_.join(","))}}return new t.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 t.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 t.default({method:l,url:this.url,headers:this.headers,schema:this.schema,fetch:(o=this.fetch)!==null&&o!==void 0?o:fetch})}}return WL.default=n,WL}var hke;function wnt(){if(hke)return HL;hke=1,Object.defineProperty(HL,"__esModule",{value:!0});const e=N3,t=e.__importDefault(_6e()),n=e.__importDefault(Sxe());class s{constructor(o,{headers:l={},schema:i,fetch:u}={}){this.url=o,this.headers=new Headers(l),this.schemaName=i,this.fetch=u}from(o){const l=new URL(`${this.url}/${o}`);return new t.default(l,{headers:new Headers(this.headers),schema:this.schemaName,fetch:this.fetch})}schema(o){return new s(this.url,{headers:this.headers,schema:o,fetch:this.fetch})}rpc(o,l={},{head:i=!1,get:u=!1,count:p}={}){var x;let y;const _=new URL(`${this.url}/rpc/${o}`);let b;i||u?(y=i?"HEAD":"GET",Object.entries(l).filter(([k,M])=>M!==void 0).map(([k,M])=>[k,Array.isArray(M)?`{${M.join(",")}}`:`${M}`]).forEach(([k,M])=>{_.searchParams.append(k,M)})):(y="POST",b=l);const S=new Headers(this.headers);return p&&S.set("Prefer",`count=${p}`),new n.default({method:y,url:_,headers:S,schema:this.schemaName,body:b,fetch:(x=this.fetch)!==null&&x!==void 0?x:fetch})}}return HL.default=s,HL}Object.defineProperty(bh,"__esModule",{value:!0});var b6e=bh.PostgrestError=E6e=bh.PostgrestBuilder=T6e=bh.PostgrestTransformBuilder=C6e=bh.PostgrestFilterBuilder=N6e=bh.PostgrestQueryBuilder=j6e=bh.PostgrestClient=void 0;const S3=N3,w6e=S3.__importDefault(wnt());var j6e=bh.PostgrestClient=w6e.default;const k6e=S3.__importDefault(_6e());var N6e=bh.PostgrestQueryBuilder=k6e.default;const S6e=S3.__importDefault(Sxe());var C6e=bh.PostgrestFilterBuilder=S6e.default;const M6e=S3.__importDefault(v6e());var T6e=bh.PostgrestTransformBuilder=M6e.default;const A6e=S3.__importDefault(y6e());var E6e=bh.PostgrestBuilder=A6e.default;const I6e=S3.__importDefault(x6e());b6e=bh.PostgrestError=I6e.default;var P6e=bh.default={PostgrestClient:w6e.default,PostgrestQueryBuilder:k6e.default,PostgrestFilterBuilder:S6e.default,PostgrestTransformBuilder:M6e.default,PostgrestBuilder:A6e.default,PostgrestError:I6e.default};const jnt=Object.freeze(Object.defineProperty({__proto__:null,get PostgrestBuilder(){return E6e},get PostgrestClient(){return j6e},get PostgrestError(){return b6e},get PostgrestFilterBuilder(){return C6e},get PostgrestQueryBuilder(){return N6e},get PostgrestTransformBuilder(){return T6e},default:P6e},Symbol.toStringTag,{value:"Module"})),{PostgrestClient:knt,PostgrestQueryBuilder:Cer,PostgrestFilterBuilder:Mer,PostgrestTransformBuilder:Ter,PostgrestBuilder:Aer,PostgrestError:Eer}=P6e||jnt;class Nnt{static detectEnvironment(){var t;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"&&(!((t=navigator.userAgent)===null||t===void 0)&&t.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 t=this.detectEnvironment();if(t.constructor)return t.constructor;let n=t.error||"WebSocket not supported in this environment.";throw t.workaround&&(n+=` Suggested solution: ${t.workaround}`),new Error(n)}static createWebSocket(t,n){const s=this.getWebSocketConstructor();return new s(t,n)}static isWebSocketSupported(){try{const t=this.detectEnvironment();return t.type==="native"||t.type==="ws"}catch{return!1}}}const Snt="2.78.0",Cnt=`realtime-js/${Snt}`,Mnt="1.0.0",Whe=1e4,Tnt=1e3,Ant=100;var AA;(function(e){e[e.connecting=0]="connecting",e[e.open=1]="open",e[e.closing=2]="closing",e[e.closed=3]="closed"})(AA||(AA={}));var ed;(function(e){e.closed="closed",e.errored="errored",e.joined="joined",e.joining="joining",e.leaving="leaving"})(ed||(ed={}));var dm;(function(e){e.close="phx_close",e.error="phx_error",e.join="phx_join",e.reply="phx_reply",e.leave="phx_leave",e.access_token="access_token"})(dm||(dm={}));var Ghe;(function(e){e.websocket="websocket"})(Ghe||(Ghe={}));var Zw;(function(e){e.Connecting="connecting",e.Open="open",e.Closing="closing",e.Closed="closed"})(Zw||(Zw={}));class Ent{constructor(){this.HEADER_LENGTH=1}decode(t,n){return t.constructor===ArrayBuffer?n(this._binaryDecode(t)):n(typeof t=="string"?JSON.parse(t):{})}_binaryDecode(t){const n=new DataView(t),s=new TextDecoder;return this._decodeBroadcast(t,n,s)}_decodeBroadcast(t,n,s){const a=n.getUint8(1),o=n.getUint8(2);let l=this.HEADER_LENGTH+2;const i=s.decode(t.slice(l,l+a));l=l+a;const u=s.decode(t.slice(l,l+o));l=l+o;const p=JSON.parse(s.decode(t.slice(l,t.byteLength)));return{ref:null,topic:i,event:u,payload:p}}}class L6e{constructor(t,n){this.callback=t,this.timerCalc=n,this.timer=void 0,this.tries=0,this.callback=t,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 nl;(function(e){e.abstime="abstime",e.bool="bool",e.date="date",e.daterange="daterange",e.float4="float4",e.float8="float8",e.int2="int2",e.int4="int4",e.int4range="int4range",e.int8="int8",e.int8range="int8range",e.json="json",e.jsonb="jsonb",e.money="money",e.numeric="numeric",e.oid="oid",e.reltime="reltime",e.text="text",e.time="time",e.timestamp="timestamp",e.timestamptz="timestamptz",e.timetz="timetz",e.tsrange="tsrange",e.tstzrange="tstzrange"})(nl||(nl={}));const fke=(e,t,n={})=>{var s;const a=(s=n.skipTypes)!==null&&s!==void 0?s:[];return t?Object.keys(t).reduce((o,l)=>(o[l]=Int(l,e,t,a),o),{}):{}},Int=(e,t,n,s)=>{const a=t.find(i=>i.name===e),o=a==null?void 0:a.type,l=n[e];return o&&!s.includes(o)?O6e(o,l):Khe(l)},O6e=(e,t)=>{if(e.charAt(0)==="_"){const n=e.slice(1,e.length);return Dnt(t,n)}switch(e){case nl.bool:return Pnt(t);case nl.float4:case nl.float8:case nl.int2:case nl.int4:case nl.int8:case nl.numeric:case nl.oid:return Lnt(t);case nl.json:case nl.jsonb:return Ont(t);case nl.timestamp:return Rnt(t);case nl.abstime:case nl.date:case nl.daterange:case nl.int4range:case nl.int8range:case nl.money:case nl.reltime:case nl.text:case nl.time:case nl.timestamptz:case nl.timetz:case nl.tsrange:case nl.tstzrange:return Khe(t);default:return Khe(t)}},Khe=e=>e,Pnt=e=>{switch(e){case"t":return!0;case"f":return!1;default:return e}},Lnt=e=>{if(typeof e=="string"){const t=parseFloat(e);if(!Number.isNaN(t))return t}return e},Ont=e=>{if(typeof e=="string")try{return JSON.parse(e)}catch(t){return console.log(`JSON parse error: ${t}`),e}return e},Dnt=(e,t)=>{if(typeof e!="string")return e;const n=e.length-1,s=e[n];if(e[0]==="{"&&s==="}"){let o;const l=e.slice(1,n);try{o=JSON.parse("["+l+"]")}catch{o=l?l.split(","):[]}return o.map(i=>O6e(t,i))}return e},Rnt=e=>typeof e=="string"?e.replace(" ","T"):e,D6e=e=>{const t=new URL(e);return t.protocol=t.protocol.replace(/^ws/i,"http"),t.pathname=t.pathname.replace(/\/+$/,"").replace(/\/socket\/websocket$/i,"").replace(/\/socket$/i,"").replace(/\/websocket$/i,""),t.pathname===""||t.pathname==="/"?t.pathname="/api/broadcast":t.pathname=t.pathname+"/api/broadcast",t.href};class wce{constructor(t,n,s={},a=Whe){this.channel=t,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(t){this.timeout=t,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(t){this.payload=Object.assign(Object.assign({},this.payload),t)}receive(t,n){var s;return this._hasReceived(t)&&n((s=this.receivedResp)===null||s===void 0?void 0:s.response),this.recHooks.push({status:t,callback:n}),this}startTimeout(){if(this.timeoutTimer)return;this.ref=this.channel.socket._makeRef(),this.refEvent=this.channel._replyEventName(this.ref);const t=n=>{this._cancelRefEvent(),this._cancelTimeout(),this.receivedResp=n,this._matchReceive(n)};this.channel._on(this.refEvent,{},t),this.timeoutTimer=setTimeout(()=>{this.trigger("timeout",{})},this.timeout)}trigger(t,n){this.refEvent&&this.channel._trigger(this.refEvent,{status:t,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:t,response:n}){this.recHooks.filter(s=>s.status===t).forEach(s=>s.callback(n))}_hasReceived(t){return this.receivedResp&&this.receivedResp.status===t}}var pke;(function(e){e.SYNC="sync",e.JOIN="join",e.LEAVE="leave"})(pke||(pke={}));class EA{constructor(t,n){this.channel=t,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=EA.syncState(this.state,a,o,l),this.pendingDiffs.forEach(u=>{this.state=EA.syncDiff(this.state,u,o,l)}),this.pendingDiffs=[],i()}),this.channel._on(s.diff,{},a=>{const{onJoin:o,onLeave:l,onSync:i}=this.caller;this.inPendingSyncState()?this.pendingDiffs.push(a):(this.state=EA.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(t,n,s,a){const o=this.cloneDeep(t),l=this.transformState(n),i={},u={};return this.map(o,(p,x)=>{l[p]||(u[p]=x)}),this.map(l,(p,x)=>{const y=o[p];if(y){const _=x.map(M=>M.presence_ref),b=y.map(M=>M.presence_ref),S=x.filter(M=>b.indexOf(M.presence_ref)<0),k=y.filter(M=>_.indexOf(M.presence_ref)<0);S.length>0&&(i[p]=S),k.length>0&&(u[p]=k)}else i[p]=x}),this.syncDiff(o,{joins:i,leaves:u},s,a)}static syncDiff(t,n,s,a){const{joins:o,leaves:l}={joins:this.transformState(n.joins),leaves:this.transformState(n.leaves)};return s||(s=()=>{}),a||(a=()=>{}),this.map(o,(i,u)=>{var p;const x=(p=t[i])!==null&&p!==void 0?p:[];if(t[i]=this.cloneDeep(u),x.length>0){const y=t[i].map(b=>b.presence_ref),_=x.filter(b=>y.indexOf(b.presence_ref)<0);t[i].unshift(..._)}s(i,x,u)}),this.map(l,(i,u)=>{let p=t[i];if(!p)return;const x=u.map(y=>y.presence_ref);p=p.filter(y=>x.indexOf(y.presence_ref)<0),t[i]=p,a(i,p,u),p.length===0&&delete t[i]}),t}static map(t,n){return Object.getOwnPropertyNames(t).map(s=>n(s,t[s]))}static transformState(t){return t=this.cloneDeep(t),Object.getOwnPropertyNames(t).reduce((n,s)=>{const a=t[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(t){return JSON.parse(JSON.stringify(t))}onJoin(t){this.caller.onJoin=t}onLeave(t){this.caller.onLeave=t}onSync(t){this.caller.onSync=t}inPendingSyncState(){return!this.joinRef||this.joinRef!==this.channel._joinRef()}}var mke;(function(e){e.ALL="*",e.INSERT="INSERT",e.UPDATE="UPDATE",e.DELETE="DELETE"})(mke||(mke={}));var IA;(function(e){e.BROADCAST="broadcast",e.PRESENCE="presence",e.POSTGRES_CHANGES="postgres_changes",e.SYSTEM="system"})(IA||(IA={}));var $x;(function(e){e.SUBSCRIBED="SUBSCRIBED",e.TIMED_OUT="TIMED_OUT",e.CLOSED="CLOSED",e.CHANNEL_ERROR="CHANNEL_ERROR"})($x||($x={}));class Cxe{constructor(t,n={config:{}},s){var a,o;if(this.topic=t,this.params=n,this.socket=s,this.bindings={},this.state=ed.closed,this.joinedOnce=!1,this.pushBuffer=[],this.subTopic=t.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 wce(this,dm.join,this.params,this.timeout),this.rejoinTimer=new L6e(()=>this._rejoinUntilConnected(),this.socket.reconnectAfterMs),this.joinPush.receive("ok",()=>{this.state=ed.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=ed.closed,this.socket._remove(this)}),this._onError(l=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,l),this.state=ed.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("timeout",()=>{this._isJoining()&&(this.socket.log("channel",`timeout ${this.topic}`,this.joinPush.timeout),this.state=ed.errored,this.rejoinTimer.scheduleTimeout())}),this.joinPush.receive("error",l=>{this._isLeaving()||this._isClosed()||(this.socket.log("channel",`error ${this.topic}`,l),this.state=ed.errored,this.rejoinTimer.scheduleTimeout())}),this._on(dm.reply,{},(l,i)=>{this._trigger(this._replyEventName(i),l)}),this.presence=new EA(this),this.broadcastEndpointURL=D6e(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(t,n=this.timeout){var s,a,o;if(this.socket.isConnected()||this.socket.connect(),this.state==ed.closed){const{config:{broadcast:l,presence:i,private:u}}=this.params,p=(a=(s=this.bindings.postgres_changes)===null||s===void 0?void 0:s.map(b=>b.filter))!==null&&a!==void 0?a:[],x=!!this.bindings[IA.PRESENCE]&&this.bindings[IA.PRESENCE].length>0||((o=this.params.config.presence)===null||o===void 0?void 0:o.enabled)===!0,y={},_={broadcast:l,presence:Object.assign(Object.assign({},i),{enabled:x}),postgres_changes:p,private:u};this.socket.accessTokenValue&&(y.access_token=this.socket.accessTokenValue),this._onError(b=>t==null?void 0:t($x.CHANNEL_ERROR,b)),this._onClose(()=>t==null?void 0:t($x.CLOSED)),this.updateJoinPayload(Object.assign({config:_},y)),this.joinedOnce=!0,this._rejoin(n),this.joinPush.receive("ok",async({postgres_changes:b})=>{var S;if(this.socket.setAuth(),b===void 0){t==null||t($x.SUBSCRIBED);return}else{const k=this.bindings.postgres_changes,M=(S=k==null?void 0:k.length)!==null&&S!==void 0?S:0,P=[];for(let T=0;T{this.state=ed.errored,t==null||t($x.CHANNEL_ERROR,new Error(JSON.stringify(Object.values(b).join(", ")||"error")))}).receive("timeout",()=>{t==null||t($x.TIMED_OUT)})}return this}presenceState(){return this.presence.state}async track(t,n={}){return await this.send({type:"presence",event:"track",payload:t},n.timeout||this.timeout)}async untrack(t={}){return await this.send({type:"presence",event:"untrack"},t)}on(t,n,s){return this.state===ed.joined&&t===IA.PRESENCE&&(this.socket.log("channel",`resubscribe to ${this.topic} due to change in presence callbacks on joined channel`),this.unsubscribe().then(()=>this.subscribe())),this._on(t,n,s)}async httpSend(t,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:t,payload:n,private:this.private}]})},i=await this._fetchWithTimeout(this.broadcastEndpointURL,l,(a=s.timeout)!==null&&a!==void 0?a:this.timeout);if(i.status===202)return{success:!0};let u=i.statusText;try{const p=await i.json();u=p.error||p.message||u}catch{}return Promise.reject(new Error(u))}async send(t,n={}){var s,a;if(!this._canPush()&&t.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}=t,u={method:"POST",headers:{Authorization:this.socket.accessTokenValue?`Bearer ${this.socket.accessTokenValue}`:"",apikey:this.socket.apiKey?this.socket.apiKey:"","Content-Type":"application/json"},body:JSON.stringify({messages:[{topic:this.subTopic,event:o,payload:l,private:this.private}]})};try{const p=await this._fetchWithTimeout(this.broadcastEndpointURL,u,(s=n.timeout)!==null&&s!==void 0?s:this.timeout);return await((a=p.body)===null||a===void 0?void 0:a.cancel()),p.ok?"ok":"error"}catch(p){return p.name==="AbortError"?"timed out":"error"}}else return new Promise(o=>{var l,i,u;const p=this._push(t.type,t,n.timeout||this.timeout);t.type==="broadcast"&&!(!((u=(i=(l=this.params)===null||l===void 0?void 0:l.config)===null||i===void 0?void 0:i.broadcast)===null||u===void 0)&&u.ack)&&o("ok"),p.receive("ok",()=>o("ok")),p.receive("error",()=>o("error")),p.receive("timeout",()=>o("timed out"))})}updateJoinPayload(t){this.joinPush.updatePayload(t)}unsubscribe(t=this.timeout){this.state=ed.leaving;const n=()=>{this.socket.log("channel",`leave ${this.topic}`),this._trigger(dm.close,"leave",this._joinRef())};this.joinPush.destroy();let s=null;return new Promise(a=>{s=new wce(this,dm.leave,{},t),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(t=>t.destroy()),this.pushBuffer=[],this.rejoinTimer.reset(),this.joinPush.destroy(),this.state=ed.closed,this.bindings={}}async _fetchWithTimeout(t,n,s){const a=new AbortController,o=setTimeout(()=>a.abort(),s),l=await this.socket.fetch(t,Object.assign(Object.assign({},n),{signal:a.signal}));return clearTimeout(o),l}_push(t,n,s=this.timeout){if(!this.joinedOnce)throw`tried to push '${t}' to '${this.topic}' before joining. Use channel.subscribe() before pushing events`;let a=new wce(this,t,n,s);return this._canPush()?a.send():this._addToPushBuffer(a),a}_addToPushBuffer(t){if(t.startTimeout(),this.pushBuffer.push(t),this.pushBuffer.length>Ant){const n=this.pushBuffer.shift();n&&(n.destroy(),this.socket.log("channel",`discarded push due to buffer overflow: ${n.event}`,n.payload))}}_onMessage(t,n,s){return n}_isMember(t){return this.topic===t}_joinRef(){return this.joinPush.ref}_trigger(t,n,s){var a,o;const l=t.toLocaleLowerCase(),{close:i,error:u,leave:p,join:x}=dm;if(s&&[i,u,p,x].indexOf(l)>=0&&s!==this._joinRef())return;let _=this._onMessage(l,n,s);if(n&&!_)throw"channel onMessage callbacks must return the payload, modified or unmodified";["insert","update","delete"].includes(l)?(a=this.bindings.postgres_changes)===null||a===void 0||a.filter(b=>{var S,k,M;return((S=b.filter)===null||S===void 0?void 0:S.event)==="*"||((M=(k=b.filter)===null||k===void 0?void 0:k.event)===null||M===void 0?void 0:M.toLocaleLowerCase())===l}).map(b=>b.callback(_,s)):(o=this.bindings[l])===null||o===void 0||o.filter(b=>{var S,k,M,P,T,I;if(["broadcast","presence","postgres_changes"].includes(l))if("id"in b){const z=b.id,D=(S=b.filter)===null||S===void 0?void 0:S.event;return z&&((k=n.ids)===null||k===void 0?void 0:k.includes(z))&&(D==="*"||(D==null?void 0:D.toLocaleLowerCase())===((M=n.data)===null||M===void 0?void 0:M.type.toLocaleLowerCase()))}else{const z=(T=(P=b==null?void 0:b.filter)===null||P===void 0?void 0:P.event)===null||T===void 0?void 0:T.toLocaleLowerCase();return z==="*"||z===((I=n==null?void 0:n.event)===null||I===void 0?void 0:I.toLocaleLowerCase())}else return b.type.toLocaleLowerCase()===l}).map(b=>{if(typeof _=="object"&&"ids"in _){const S=_.data,{schema:k,table:M,commit_timestamp:P,type:T,errors:I}=S;_=Object.assign(Object.assign({},{schema:k,table:M,commit_timestamp:P,eventType:T,new:{},old:{},errors:I}),this._getPayloadRecords(S))}b.callback(_,s)})}_isClosed(){return this.state===ed.closed}_isJoined(){return this.state===ed.joined}_isJoining(){return this.state===ed.joining}_isLeaving(){return this.state===ed.leaving}_replyEventName(t){return`chan_reply_${t}`}_on(t,n,s){const a=t.toLocaleLowerCase(),o={type:a,filter:n,callback:s};return this.bindings[a]?this.bindings[a].push(o):this.bindings[a]=[o],this}_off(t,n){const s=t.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&&Cxe.isEqual(a.filter,n))})),this}static isEqual(t,n){if(Object.keys(t).length!==Object.keys(n).length)return!1;for(const s in t)if(t[s]!==n[s])return!1;return!0}_rejoinUntilConnected(){this.rejoinTimer.scheduleTimeout(),this.socket.isConnected()&&this._rejoin()}_onClose(t){this._on(dm.close,{},t)}_onError(t){this._on(dm.error,{},n=>t(n))}_canPush(){return this.socket.isConnected()&&this._isJoined()}_rejoin(t=this.timeout){this._isLeaving()||(this.socket._leaveOpenTopic(this.topic),this.state=ed.joining,this.joinPush.resend(t))}_getPayloadRecords(t){const n={new:{},old:{}};return(t.type==="INSERT"||t.type==="UPDATE")&&(n.new=fke(t.columns,t.record)),(t.type==="UPDATE"||t.type==="DELETE")&&(n.old=fke(t.columns,t.old_record)),n}}const jce=()=>{},XL={HEARTBEAT_INTERVAL:25e3,RECONNECT_DELAY:10,HEARTBEAT_TIMEOUT_FALLBACK:100},Fnt=[1e3,2e3,5e3,1e4],znt=1e4,Bnt=` addEventListener("message", (e) => { if (e.data.event === "start") { setInterval(() => postMessage({ event: "keepAlive" }), e.data.interval); } });`;class $nt{constructor(t,n){var s;if(this.accessTokenValue=null,this.apiKey=null,this.channels=new Array,this.endPoint="",this.httpEndpoint="",this.headers={},this.params={},this.timeout=Whe,this.transport=null,this.heartbeatIntervalMs=XL.HEARTBEAT_INTERVAL,this.heartbeatTimer=void 0,this.pendingHeartbeatRef=null,this.heartbeatCallback=jce,this.ref=0,this.reconnectTimer=null,this.logger=jce,this.conn=null,this.sendBuffer=[],this.serializer=new Ent,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)=>k3(async()=>{const{default:i}=await Promise.resolve().then(()=>Nk);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=`${t}/${Ghe.websocket}`,this.httpEndpoint=D6e(t),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=Nnt.createWebSocket(this.endpointURL())}catch(t){this._setConnectionState("disconnected");const n=t.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:Mnt}))}disconnect(t,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")},t?this.conn.close(t,n??""):this.conn.close(),this._teardownConnection()}else this._setConnectionState("disconnected")}getChannels(){return this.channels}async removeChannel(t){const n=await t.unsubscribe();return this.channels.length===0&&this.disconnect(),n}async removeAllChannels(){const t=await Promise.all(this.channels.map(n=>n.unsubscribe()));return this.channels=[],this.disconnect(),t}log(t,n,s){this.logger(t,n,s)}connectionState(){switch(this.conn&&this.conn.readyState){case AA.connecting:return Zw.Connecting;case AA.open:return Zw.Open;case AA.closing:return Zw.Closing;default:return Zw.Closed}}isConnected(){return this.connectionState()===Zw.Open}isConnecting(){return this._connectionState==="connecting"}isDisconnecting(){return this._connectionState==="disconnecting"}channel(t,n={config:{}}){const s=`realtime:${t}`,a=this.getChannels().find(o=>o.topic===s);if(a)return a;{const o=new Cxe(`realtime:${t}`,n,this);return this.channels.push(o),o}}push(t){const{topic:n,event:s,payload:a,ref:o}=t,l=()=>{this.encode(t,i=>{var u;(u=this.conn)===null||u===void 0||u.send(i)})};this.log("push",`${n} ${s} (${o})`,a),this.isConnected()?l():this.sendBuffer.push(l)}async setAuth(t=null){this._authPromise=this._performAuth(t);try{await this._authPromise}finally{this._authPromise=null}}async sendHeartbeat(){var t;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,(t=this.conn)===null||t===void 0||t.close(Tnt,"heartbeat timeout"),setTimeout(()=>{var n;this.isConnected()||(n=this.reconnectTimer)===null||n===void 0||n.scheduleTimeout()},XL.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(t){this.heartbeatCallback=t}flushSendBuffer(){this.isConnected()&&this.sendBuffer.length>0&&(this.sendBuffer.forEach(t=>t()),this.sendBuffer=[])}_makeRef(){let t=this.ref+1;return t===this.ref?this.ref=0:this.ref=t,this.ref.toString()}_leaveOpenTopic(t){let n=this.channels.find(s=>s.topic===t&&(s._isJoined()||s._isJoining()));n&&(this.log("transport",`leaving duplicate topic "${t}"`),n.unsubscribe())}_remove(t){this.channels=this.channels.filter(n=>n.topic!==t.topic)}_onConnMessage(t){this.decode(t.data,n=>{if(n.topic==="phoenix"&&n.event==="phx_reply")try{this.heartbeatCallback(n.payload.status==="ok"?"ok":"error")}catch(p){this.log("error","error in heartbeat callback",p)}n.ref&&n.ref===this.pendingHeartbeatRef&&(this.pendingHeartbeatRef=null);const{topic:s,event:a,payload:o,ref:l}=n,i=l?`(${l})`:"",u=o.status||"";this.log("receive",`${u} ${s} ${a} ${i}`.trim(),o),this.channels.filter(p=>p._isMember(s)).forEach(p=>p._trigger(a,o,l)),this._triggerStateCallbacks("message",n)})}_clearTimer(t){var n;t==="heartbeat"&&this.heartbeatTimer?(clearInterval(this.heartbeatTimer),this.heartbeatTimer=void 0):t==="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=t=>this._onConnError(t),this.conn.onmessage=t=>this._onConnMessage(t),this.conn.onclose=t=>this._onConnClose(t))}_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(t=>t.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 t=this._workerObjectUrl(this.workerUrl);this.workerRef=new Worker(t),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(t){var n;this._setConnectionState("disconnected"),this.log("transport","close",t),this._triggerChanError(),this._clearTimer("heartbeat"),this._wasManualDisconnect||(n=this.reconnectTimer)===null||n===void 0||n.scheduleTimeout(),this._triggerStateCallbacks("close",t)}_onConnError(t){this._setConnectionState("disconnected"),this.log("transport",`${t}`),this._triggerChanError(),this._triggerStateCallbacks("error",t)}_triggerChanError(){this.channels.forEach(t=>t._trigger(dm.error))}_appendParams(t,n){if(Object.keys(n).length===0)return t;const s=t.match(/\?/)?"&":"?",a=new URLSearchParams(n);return`${t}${s}${a}`}_workerObjectUrl(t){let n;if(t)n=t;else{const s=new Blob([Bnt],{type:"application/javascript"});n=URL.createObjectURL(s)}return n}_setConnectionState(t,n=!1){this._connectionState=t,t==="connecting"?this._wasManualDisconnect=!1:t==="disconnecting"&&(this._wasManualDisconnect=n)}async _performAuth(t=null){let n;t?n=t: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:Cnt};n&&s.updateJoinPayload(a),s.joinedOnce&&s._isJoined()&&s._push(dm.access_token,{access_token:n})}))}async _waitForAuthIfNeeded(){this._authPromise&&await this._authPromise}_setAuthSafely(t="general"){this.setAuth().catch(n=>{this.log("error",`error setting auth in ${t}`,n)})}_triggerStateCallbacks(t,n){try{this.stateChangeCallbacks[t].forEach(s=>{try{s(n)}catch(a){this.log("error",`error in ${t} callback`,a)}})}catch(s){this.log("error",`error triggering ${t} callbacks`,s)}}_setupReconnectionTimer(){this.reconnectTimer=new L6e(async()=>{setTimeout(async()=>{await this._waitForAuthIfNeeded(),this.isConnected()||this.connect()},XL.RECONNECT_DELAY)},this.reconnectAfterMs)}_initializeOptions(t){var n,s,a,o,l,i,u,p,x;if(this.transport=(n=t==null?void 0:t.transport)!==null&&n!==void 0?n:null,this.timeout=(s=t==null?void 0:t.timeout)!==null&&s!==void 0?s:Whe,this.heartbeatIntervalMs=(a=t==null?void 0:t.heartbeatIntervalMs)!==null&&a!==void 0?a:XL.HEARTBEAT_INTERVAL,this.worker=(o=t==null?void 0:t.worker)!==null&&o!==void 0?o:!1,this.accessToken=(l=t==null?void 0:t.accessToken)!==null&&l!==void 0?l:null,this.heartbeatCallback=(i=t==null?void 0:t.heartbeatCallback)!==null&&i!==void 0?i:jce,t!=null&&t.params&&(this.params=t.params),t!=null&&t.logger&&(this.logger=t.logger),(t!=null&&t.logLevel||t!=null&&t.log_level)&&(this.logLevel=t.logLevel||t.log_level,this.params=Object.assign(Object.assign({},this.params),{log_level:this.logLevel})),this.reconnectAfterMs=(u=t==null?void 0:t.reconnectAfterMs)!==null&&u!==void 0?u:y=>Fnt[y-1]||znt,this.encode=(p=t==null?void 0:t.encode)!==null&&p!==void 0?p:(y,_)=>_(JSON.stringify(y)),this.decode=(x=t==null?void 0:t.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=t==null?void 0:t.workerUrl}}}class Mxe extends Error{constructor(t){super(t),this.__isStorageError=!0,this.name="StorageError"}}function Ol(e){return typeof e=="object"&&e!==null&&"__isStorageError"in e}class Unt extends Mxe{constructor(t,n,s){super(t),this.name="StorageApiError",this.status=n,this.statusCode=s}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}}class Zhe extends Mxe{constructor(t,n){super(t),this.name="StorageUnknownError",this.originalError=n}}const Txe=e=>{let t;return e?t=e:typeof fetch>"u"?t=(...n)=>k3(async()=>{const{default:s}=await Promise.resolve().then(()=>Nk);return{default:s}},void 0).then(({default:s})=>s(...n)):t=fetch,(...n)=>t(...n)},qnt=()=>zs(void 0,void 0,void 0,function*(){return typeof Response>"u"?(yield k3(()=>Promise.resolve().then(()=>Nk),void 0)).Response:Response}),Yhe=e=>{if(Array.isArray(e))return e.map(n=>Yhe(n));if(typeof e=="function"||e!==Object(e))return e;const t={};return Object.entries(e).forEach(([n,s])=>{const a=n.replace(/([-_][a-z])/gi,o=>o.toUpperCase().replace(/[-_]/g,""));t[a]=Yhe(s)}),t},Vnt=e=>{if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)},kce=e=>{var t;return e.msg||e.message||e.error_description||(typeof e.error=="string"?e.error:(t=e.error)===null||t===void 0?void 0:t.message)||JSON.stringify(e)},Hnt=(e,t,n)=>zs(void 0,void 0,void 0,function*(){const s=yield qnt();e instanceof s&&!(n!=null&&n.noResolveJson)?e.json().then(a=>{const o=e.status||500,l=(a==null?void 0:a.statusCode)||o+"";t(new Unt(kce(a),o,l))}).catch(a=>{t(new Zhe(kce(a),a))}):t(new Zhe(kce(e),e))}),Wnt=(e,t,n,s)=>{const a={method:e,headers:(t==null?void 0:t.headers)||{}};return e==="GET"||!s?a:(Vnt(s)?(a.headers=Object.assign({"Content-Type":"application/json"},t==null?void 0:t.headers),a.body=JSON.stringify(s)):a.body=s,t!=null&&t.duplex&&(a.duplex=t.duplex),Object.assign(Object.assign({},a),n))};function XI(e,t,n,s,a,o){return zs(this,void 0,void 0,function*(){return new Promise((l,i)=>{e(n,Wnt(t,s,a,o)).then(u=>{if(!u.ok)throw u;return s!=null&&s.noResolveJson?u:u.json()}).then(u=>l(u)).catch(u=>Hnt(u,i,s))})})}function SE(e,t,n,s){return zs(this,void 0,void 0,function*(){return XI(e,"GET",t,n,s)})}function im(e,t,n,s,a){return zs(this,void 0,void 0,function*(){return XI(e,"POST",t,s,a,n)})}function Xhe(e,t,n,s,a){return zs(this,void 0,void 0,function*(){return XI(e,"PUT",t,s,a,n)})}function Gnt(e,t,n,s){return zs(this,void 0,void 0,function*(){return XI(e,"HEAD",t,Object.assign(Object.assign({},n),{noResolveJson:!0}),s)})}function Axe(e,t,n,s,a){return zs(this,void 0,void 0,function*(){return XI(e,"DELETE",t,s,a,n)})}class Knt{constructor(t,n){this.downloadFn=t,this.shouldThrowOnError=n}then(t,n){return this.execute().then(t,n)}execute(){return zs(this,void 0,void 0,function*(){try{return{data:(yield this.downloadFn()).body,error:null}}catch(t){if(this.shouldThrowOnError)throw t;if(Ol(t))return{data:null,error:t};throw t}})}}var R6e;class Znt{constructor(t,n){this.downloadFn=t,this.shouldThrowOnError=n,this[R6e]="BlobDownloadBuilder",this.promise=null}asStream(){return new Knt(this.downloadFn,this.shouldThrowOnError)}then(t,n){return this.getPromise().then(t,n)}catch(t){return this.getPromise().catch(t)}finally(t){return this.getPromise().finally(t)}getPromise(){return this.promise||(this.promise=this.execute()),this.promise}execute(){return zs(this,void 0,void 0,function*(){try{return{data:yield(yield this.downloadFn()).blob(),error:null}}catch(t){if(this.shouldThrowOnError)throw t;if(Ol(t))return{data:null,error:t};throw t}})}}R6e=Symbol.toStringTag;const Ynt={limit:100,offset:0,sortBy:{column:"name",order:"asc"}},gke={cacheControl:"3600",contentType:"text/plain;charset=UTF-8",upsert:!1};class Xnt{constructor(t,n={},s,a){this.shouldThrowOnError=!1,this.url=t,this.headers=n,this.bucketId=s,this.fetch=Txe(a)}throwOnError(){return this.shouldThrowOnError=!0,this}uploadOrUpdate(t,n,s,a){return zs(this,void 0,void 0,function*(){try{let o;const l=Object.assign(Object.assign({},gke),a);let i=Object.assign(Object.assign({},this.headers),t==="POST"&&{"x-upsert":String(l.upsert)});const u=l.metadata;typeof Blob<"u"&&s instanceof Blob?(o=new FormData,o.append("cacheControl",l.cacheControl),u&&o.append("metadata",this.encodeMetadata(u)),o.append("",s)):typeof FormData<"u"&&s instanceof FormData?(o=s,o.append("cacheControl",l.cacheControl),u&&o.append("metadata",this.encodeMetadata(u))):(o=s,i["cache-control"]=`max-age=${l.cacheControl}`,i["content-type"]=l.contentType,u&&(i["x-metadata"]=this.toBase64(this.encodeMetadata(u)))),a!=null&&a.headers&&(i=Object.assign(Object.assign({},i),a.headers));const p=this._removeEmptyFolders(n),x=this._getFinalPath(p),y=yield(t=="PUT"?Xhe:im)(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(Ol(o))return{data:null,error:o};throw o}})}upload(t,n,s){return zs(this,void 0,void 0,function*(){return this.uploadOrUpdate("POST",t,n,s)})}uploadToSignedUrl(t,n,s,a){return zs(this,void 0,void 0,function*(){const o=this._removeEmptyFolders(t),l=this._getFinalPath(o),i=new URL(this.url+`/object/upload/sign/${l}`);i.searchParams.set("token",n);try{let u;const p=Object.assign({upsert:gke.upsert},a),x=Object.assign(Object.assign({},this.headers),{"x-upsert":String(p.upsert)});typeof Blob<"u"&&s instanceof Blob?(u=new FormData,u.append("cacheControl",p.cacheControl),u.append("",s)):typeof FormData<"u"&&s instanceof FormData?(u=s,u.append("cacheControl",p.cacheControl)):(u=s,x["cache-control"]=`max-age=${p.cacheControl}`,x["content-type"]=p.contentType);const y=yield Xhe(this.fetch,i.toString(),u,{headers:x});return{data:{path:o,fullPath:y.Key},error:null}}catch(u){if(this.shouldThrowOnError)throw u;if(Ol(u))return{data:null,error:u};throw u}})}createSignedUploadUrl(t,n){return zs(this,void 0,void 0,function*(){try{let s=this._getFinalPath(t);const a=Object.assign({},this.headers);n!=null&&n.upsert&&(a["x-upsert"]="true");const o=yield im(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 Mxe("No token returned by API");return{data:{signedUrl:l.toString(),path:t,token:i},error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(Ol(s))return{data:null,error:s};throw s}})}update(t,n,s){return zs(this,void 0,void 0,function*(){return this.uploadOrUpdate("PUT",t,n,s)})}move(t,n,s){return zs(this,void 0,void 0,function*(){try{return{data:yield im(this.fetch,`${this.url}/object/move`,{bucketId:this.bucketId,sourceKey:t,destinationKey:n,destinationBucket:s==null?void 0:s.destinationBucket},{headers:this.headers}),error:null}}catch(a){if(this.shouldThrowOnError)throw a;if(Ol(a))return{data:null,error:a};throw a}})}copy(t,n,s){return zs(this,void 0,void 0,function*(){try{return{data:{path:(yield im(this.fetch,`${this.url}/object/copy`,{bucketId:this.bucketId,sourceKey:t,destinationKey:n,destinationBucket:s==null?void 0:s.destinationBucket},{headers:this.headers})).Key},error:null}}catch(a){if(this.shouldThrowOnError)throw a;if(Ol(a))return{data:null,error:a};throw a}})}createSignedUrl(t,n,s){return zs(this,void 0,void 0,function*(){try{let a=this._getFinalPath(t),o=yield im(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(Ol(a))return{data:null,error:a};throw a}})}createSignedUrls(t,n,s){return zs(this,void 0,void 0,function*(){try{const a=yield im(this.fetch,`${this.url}/object/sign/${this.bucketId}`,{expiresIn:n,paths:t},{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(Ol(a))return{data:null,error:a};throw a}})}download(t,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(t),u=()=>SE(this.fetch,`${this.url}/${a}/${i}${l}`,{headers:this.headers,noResolveJson:!0});return new Znt(u,this.shouldThrowOnError)}info(t){return zs(this,void 0,void 0,function*(){const n=this._getFinalPath(t);try{const s=yield SE(this.fetch,`${this.url}/object/info/${n}`,{headers:this.headers});return{data:Yhe(s),error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(Ol(s))return{data:null,error:s};throw s}})}exists(t){return zs(this,void 0,void 0,function*(){const n=this._getFinalPath(t);try{return yield Gnt(this.fetch,`${this.url}/object/${n}`,{headers:this.headers}),{data:!0,error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(Ol(s)&&s instanceof Zhe){const a=s.originalError;if([400,404].includes(a==null?void 0:a.status))return{data:!1,error:s}}throw s}})}getPublicUrl(t,n){const s=this._getFinalPath(t),a=[],o=n!=null&&n.download?`download=${n.download===!0?"":n.download}`:"";o!==""&&a.push(o);const i=typeof(n==null?void 0:n.transform)<"u"?"render/image":"object",u=this.transformOptsToQueryString((n==null?void 0:n.transform)||{});u!==""&&a.push(u);let p=a.join("&");return p!==""&&(p=`?${p}`),{data:{publicUrl:encodeURI(`${this.url}/${i}/public/${s}${p}`)}}}remove(t){return zs(this,void 0,void 0,function*(){try{return{data:yield Axe(this.fetch,`${this.url}/object/${this.bucketId}`,{prefixes:t},{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Ol(n))return{data:null,error:n};throw n}})}list(t,n,s){return zs(this,void 0,void 0,function*(){try{const a=Object.assign(Object.assign(Object.assign({},Ynt),n),{prefix:t||""});return{data:yield im(this.fetch,`${this.url}/object/list/${this.bucketId}`,a,{headers:this.headers},s),error:null}}catch(a){if(this.shouldThrowOnError)throw a;if(Ol(a))return{data:null,error:a};throw a}})}listV2(t,n){return zs(this,void 0,void 0,function*(){try{const s=Object.assign({},t);return{data:yield im(this.fetch,`${this.url}/object/list-v2/${this.bucketId}`,s,{headers:this.headers},n),error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(Ol(s))return{data:null,error:s};throw s}})}encodeMetadata(t){return JSON.stringify(t)}toBase64(t){return typeof Buffer<"u"?Buffer.from(t).toString("base64"):btoa(t)}_getFinalPath(t){return`${this.bucketId}/${t.replace(/^\/+/,"")}`}_removeEmptyFolders(t){return t.replace(/^\/|\/$/g,"").replace(/\/+/g,"/")}transformOptsToQueryString(t){const n=[];return t.width&&n.push(`width=${t.width}`),t.height&&n.push(`height=${t.height}`),t.resize&&n.push(`resize=${t.resize}`),t.format&&n.push(`format=${t.format}`),t.quality&&n.push(`quality=${t.quality}`),n.join("&")}}const F6e="2.78.0",z6e={"X-Client-Info":`storage-js/${F6e}`};class Qnt{constructor(t,n={},s,a){this.shouldThrowOnError=!1;const o=new URL(t);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({},z6e),n),this.fetch=Txe(s)}throwOnError(){return this.shouldThrowOnError=!0,this}listBuckets(t){return zs(this,void 0,void 0,function*(){try{const n=this.listBucketOptionsToQueryString(t);return{data:yield SE(this.fetch,`${this.url}/bucket${n}`,{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Ol(n))return{data:null,error:n};throw n}})}getBucket(t){return zs(this,void 0,void 0,function*(){try{return{data:yield SE(this.fetch,`${this.url}/bucket/${t}`,{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Ol(n))return{data:null,error:n};throw n}})}createBucket(t){return zs(this,arguments,void 0,function*(n,s={public:!1}){try{return{data:yield im(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(Ol(a))return{data:null,error:a};throw a}})}updateBucket(t,n){return zs(this,void 0,void 0,function*(){try{return{data:yield Xhe(this.fetch,`${this.url}/bucket/${t}`,{id:t,name:t,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(Ol(s))return{data:null,error:s};throw s}})}emptyBucket(t){return zs(this,void 0,void 0,function*(){try{return{data:yield im(this.fetch,`${this.url}/bucket/${t}/empty`,{},{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Ol(n))return{data:null,error:n};throw n}})}deleteBucket(t){return zs(this,void 0,void 0,function*(){try{return{data:yield Axe(this.fetch,`${this.url}/bucket/${t}`,{},{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Ol(n))return{data:null,error:n};throw n}})}listBucketOptionsToQueryString(t){const n={};return t&&("limit"in t&&(n.limit=String(t.limit)),"offset"in t&&(n.offset=String(t.offset)),t.search&&(n.search=t.search),t.sortColumn&&(n.sortColumn=t.sortColumn),t.sortOrder&&(n.sortOrder=t.sortOrder)),Object.keys(n).length>0?"?"+new URLSearchParams(n).toString():""}}class Jnt{constructor(t,n={},s){this.shouldThrowOnError=!1,this.url=t.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},z6e),n),this.fetch=Txe(s)}throwOnError(){return this.shouldThrowOnError=!0,this}createBucket(t){return zs(this,void 0,void 0,function*(){try{return{data:yield im(this.fetch,`${this.url}/bucket`,{name:t},{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Ol(n))return{data:null,error:n};throw n}})}listBuckets(t){return zs(this,void 0,void 0,function*(){try{const n=new URLSearchParams;(t==null?void 0:t.limit)!==void 0&&n.set("limit",t.limit.toString()),(t==null?void 0:t.offset)!==void 0&&n.set("offset",t.offset.toString()),t!=null&&t.sortColumn&&n.set("sortColumn",t.sortColumn),t!=null&&t.sortOrder&&n.set("sortOrder",t.sortOrder),t!=null&&t.search&&n.set("search",t.search);const s=n.toString(),a=s?`${this.url}/bucket?${s}`:`${this.url}/bucket`;return{data:yield SE(this.fetch,a,{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Ol(n))return{data:null,error:n};throw n}})}deleteBucket(t){return zs(this,void 0,void 0,function*(){try{return{data:yield Axe(this.fetch,`${this.url}/bucket/${t}`,{},{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(Ol(n))return{data:null,error:n};throw n}})}}const Exe={"X-Client-Info":`storage-js/${F6e}`,"Content-Type":"application/json"};class B6e extends Error{constructor(t){super(t),this.__isStorageVectorsError=!0,this.name="StorageVectorsError"}}function sf(e){return typeof e=="object"&&e!==null&&"__isStorageVectorsError"in e}class Nce extends B6e{constructor(t,n,s){super(t),this.name="StorageVectorsApiError",this.status=n,this.statusCode=s}toJSON(){return{name:this.name,message:this.message,status:this.status,statusCode:this.statusCode}}}class est extends B6e{constructor(t,n){super(t),this.name="StorageVectorsUnknownError",this.originalError=n}}var xke;(function(e){e.InternalError="InternalError",e.S3VectorConflictException="S3VectorConflictException",e.S3VectorNotFoundException="S3VectorNotFoundException",e.S3VectorBucketNotEmpty="S3VectorBucketNotEmpty",e.S3VectorMaxBucketsExceeded="S3VectorMaxBucketsExceeded",e.S3VectorMaxIndexesExceeded="S3VectorMaxIndexesExceeded"})(xke||(xke={}));const Ixe=e=>{let t;return e?t=e:typeof fetch>"u"?t=(...n)=>k3(async()=>{const{default:s}=await Promise.resolve().then(()=>Nk);return{default:s}},void 0).then(({default:s})=>s(...n)):t=fetch,(...n)=>t(...n)},tst=e=>{if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)},yke=e=>e.msg||e.message||e.error_description||e.error||JSON.stringify(e),rst=(e,t,n)=>zs(void 0,void 0,void 0,function*(){if(e&&typeof e=="object"&&"status"in e&&"ok"in e&&typeof e.status=="number"&&!(n!=null&&n.noResolveJson)){const a=e.status||500,o=e;if(typeof o.json=="function")o.json().then(l=>{const i=(l==null?void 0:l.statusCode)||(l==null?void 0:l.code)||a+"";t(new Nce(yke(l),a,i))}).catch(()=>{const l=a+"",i=o.statusText||`HTTP ${a} error`;t(new Nce(i,a,l))});else{const l=a+"",i=o.statusText||`HTTP ${a} error`;t(new Nce(i,a,l))}}else t(new est(yke(e),e))}),nst=(e,t,n,s)=>{const a={method:e,headers:(t==null?void 0:t.headers)||{}};return s?(tst(s)?(a.headers=Object.assign({"Content-Type":"application/json"},t==null?void 0:t.headers),a.body=JSON.stringify(s)):a.body=s,Object.assign(Object.assign({},a),n)):a};function sst(e,t,n,s,a,o){return zs(this,void 0,void 0,function*(){return new Promise((l,i)=>{e(n,nst(t,s,a,o)).then(u=>{if(!u.ok)throw u;if(s!=null&&s.noResolveJson)return u;const p=u.headers.get("content-type");return!p||!p.includes("application/json")?{}:u.json()}).then(u=>l(u)).catch(u=>rst(u,i,s))})})}function af(e,t,n,s,a){return zs(this,void 0,void 0,function*(){return sst(e,"POST",t,s,a,n)})}class ast{constructor(t,n={},s){this.shouldThrowOnError=!1,this.url=t.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},Exe),n),this.fetch=Ixe(s)}throwOnError(){return this.shouldThrowOnError=!0,this}createIndex(t){return zs(this,void 0,void 0,function*(){try{return{data:(yield af(this.fetch,`${this.url}/CreateIndex`,t,{headers:this.headers}))||{},error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(sf(n))return{data:null,error:n};throw n}})}getIndex(t,n){return zs(this,void 0,void 0,function*(){try{return{data:yield af(this.fetch,`${this.url}/GetIndex`,{vectorBucketName:t,indexName:n},{headers:this.headers}),error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(sf(s))return{data:null,error:s};throw s}})}listIndexes(t){return zs(this,void 0,void 0,function*(){try{return{data:yield af(this.fetch,`${this.url}/ListIndexes`,t,{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(sf(n))return{data:null,error:n};throw n}})}deleteIndex(t,n){return zs(this,void 0,void 0,function*(){try{return{data:(yield af(this.fetch,`${this.url}/DeleteIndex`,{vectorBucketName:t,indexName:n},{headers:this.headers}))||{},error:null}}catch(s){if(this.shouldThrowOnError)throw s;if(sf(s))return{data:null,error:s};throw s}})}}class ist{constructor(t,n={},s){this.shouldThrowOnError=!1,this.url=t.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},Exe),n),this.fetch=Ixe(s)}throwOnError(){return this.shouldThrowOnError=!0,this}putVectors(t){return zs(this,void 0,void 0,function*(){try{if(t.vectors.length<1||t.vectors.length>500)throw new Error("Vector batch size must be between 1 and 500 items");return{data:(yield af(this.fetch,`${this.url}/PutVectors`,t,{headers:this.headers}))||{},error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(sf(n))return{data:null,error:n};throw n}})}getVectors(t){return zs(this,void 0,void 0,function*(){try{return{data:yield af(this.fetch,`${this.url}/GetVectors`,t,{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(sf(n))return{data:null,error:n};throw n}})}listVectors(t){return zs(this,void 0,void 0,function*(){try{if(t.segmentCount!==void 0){if(t.segmentCount<1||t.segmentCount>16)throw new Error("segmentCount must be between 1 and 16");if(t.segmentIndex!==void 0&&(t.segmentIndex<0||t.segmentIndex>=t.segmentCount))throw new Error(`segmentIndex must be between 0 and ${t.segmentCount-1}`)}return{data:yield af(this.fetch,`${this.url}/ListVectors`,t,{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(sf(n))return{data:null,error:n};throw n}})}queryVectors(t){return zs(this,void 0,void 0,function*(){try{return{data:yield af(this.fetch,`${this.url}/QueryVectors`,t,{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(sf(n))return{data:null,error:n};throw n}})}deleteVectors(t){return zs(this,void 0,void 0,function*(){try{if(t.keys.length<1||t.keys.length>500)throw new Error("Keys batch size must be between 1 and 500 items");return{data:(yield af(this.fetch,`${this.url}/DeleteVectors`,t,{headers:this.headers}))||{},error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(sf(n))return{data:null,error:n};throw n}})}}class ost{constructor(t,n={},s){this.shouldThrowOnError=!1,this.url=t.replace(/\/$/,""),this.headers=Object.assign(Object.assign({},Exe),n),this.fetch=Ixe(s)}throwOnError(){return this.shouldThrowOnError=!0,this}createBucket(t){return zs(this,void 0,void 0,function*(){try{return{data:(yield af(this.fetch,`${this.url}/CreateVectorBucket`,{vectorBucketName:t},{headers:this.headers}))||{},error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(sf(n))return{data:null,error:n};throw n}})}getBucket(t){return zs(this,void 0,void 0,function*(){try{return{data:yield af(this.fetch,`${this.url}/GetVectorBucket`,{vectorBucketName:t},{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(sf(n))return{data:null,error:n};throw n}})}listBuckets(){return zs(this,arguments,void 0,function*(t={}){try{return{data:yield af(this.fetch,`${this.url}/ListVectorBuckets`,t,{headers:this.headers}),error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(sf(n))return{data:null,error:n};throw n}})}deleteBucket(t){return zs(this,void 0,void 0,function*(){try{return{data:(yield af(this.fetch,`${this.url}/DeleteVectorBucket`,{vectorBucketName:t},{headers:this.headers}))||{},error:null}}catch(n){if(this.shouldThrowOnError)throw n;if(sf(n))return{data:null,error:n};throw n}})}}class lst extends ost{constructor(t,n={}){super(t,n.headers||{},n.fetch)}from(t){return new cst(this.url,this.headers,t,this.fetch)}}class cst extends ast{constructor(t,n,s,a){super(t,n,a),this.vectorBucketName=s}createIndex(t){const n=Object.create(null,{createIndex:{get:()=>super.createIndex}});return zs(this,void 0,void 0,function*(){return n.createIndex.call(this,Object.assign(Object.assign({},t),{vectorBucketName:this.vectorBucketName}))})}listIndexes(){const t=Object.create(null,{listIndexes:{get:()=>super.listIndexes}});return zs(this,arguments,void 0,function*(n={}){return t.listIndexes.call(this,Object.assign(Object.assign({},n),{vectorBucketName:this.vectorBucketName}))})}getIndex(t){const n=Object.create(null,{getIndex:{get:()=>super.getIndex}});return zs(this,void 0,void 0,function*(){return n.getIndex.call(this,this.vectorBucketName,t)})}deleteIndex(t){const n=Object.create(null,{deleteIndex:{get:()=>super.deleteIndex}});return zs(this,void 0,void 0,function*(){return n.deleteIndex.call(this,this.vectorBucketName,t)})}index(t){return new dst(this.url,this.headers,this.vectorBucketName,t,this.fetch)}}class dst extends ist{constructor(t,n,s,a,o){super(t,n,o),this.vectorBucketName=s,this.indexName=a}putVectors(t){const n=Object.create(null,{putVectors:{get:()=>super.putVectors}});return zs(this,void 0,void 0,function*(){return n.putVectors.call(this,Object.assign(Object.assign({},t),{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))})}getVectors(t){const n=Object.create(null,{getVectors:{get:()=>super.getVectors}});return zs(this,void 0,void 0,function*(){return n.getVectors.call(this,Object.assign(Object.assign({},t),{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))})}listVectors(){const t=Object.create(null,{listVectors:{get:()=>super.listVectors}});return zs(this,arguments,void 0,function*(n={}){return t.listVectors.call(this,Object.assign(Object.assign({},n),{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))})}queryVectors(t){const n=Object.create(null,{queryVectors:{get:()=>super.queryVectors}});return zs(this,void 0,void 0,function*(){return n.queryVectors.call(this,Object.assign(Object.assign({},t),{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))})}deleteVectors(t){const n=Object.create(null,{deleteVectors:{get:()=>super.deleteVectors}});return zs(this,void 0,void 0,function*(){return n.deleteVectors.call(this,Object.assign(Object.assign({},t),{vectorBucketName:this.vectorBucketName,indexName:this.indexName}))})}}class ust extends Qnt{constructor(t,n={},s,a){super(t,n,s,a)}from(t){return new Xnt(this.url,this.headers,t,this.fetch)}get vectors(){return new lst(this.url+"/vector",{headers:this.headers,fetch:this.fetch})}get analytics(){return new Jnt(this.url+"/iceberg",this.headers,this.fetch)}}const hst="2.78.0";let ET="";typeof Deno<"u"?ET="deno":typeof document<"u"?ET="web":typeof navigator<"u"&&navigator.product==="ReactNative"?ET="react-native":ET="node";const fst={"X-Client-Info":`supabase-js-${ET}/${hst}`},pst={headers:fst},mst={schema:"public"},gst={autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,flowType:"implicit"},xst={},yst=e=>{let t;return e?t=e:typeof fetch>"u"?t=m6e:t=fetch,(...n)=>t(...n)},vst=()=>typeof Headers>"u"?g6e:Headers,_st=(e,t,n)=>{const s=yst(n),a=vst();return async(o,l)=>{var i;const u=(i=await t())!==null&&i!==void 0?i:e;let p=new a(l==null?void 0:l.headers);return p.has("apikey")||p.set("apikey",e),p.has("Authorization")||p.set("Authorization",`Bearer ${u}`),s(o,Object.assign(Object.assign({},l),{headers:p}))}};function bst(e){return e.endsWith("/")?e:e+"/"}function wst(e,t){var n,s;const{db:a,auth:o,realtime:l,global:i}=e,{db:u,auth:p,realtime:x,global:y}=t,_={db:Object.assign(Object.assign({},u),a),auth:Object.assign(Object.assign({},p),o),realtime:Object.assign(Object.assign({},x),l),storage:{},global:Object.assign(Object.assign(Object.assign({},y),i),{headers:Object.assign(Object.assign({},(n=y==null?void 0:y.headers)!==null&&n!==void 0?n:{}),(s=i==null?void 0:i.headers)!==null&&s!==void 0?s:{})}),accessToken:async()=>""};return e.accessToken?_.accessToken=e.accessToken:delete _.accessToken,_}function jst(e){const t=e==null?void 0:e.trim();if(!t)throw new Error("supabaseUrl is required.");if(!t.match(/^https?:\/\//i))throw new Error("Invalid supabaseUrl: Must be a valid HTTP or HTTPS URL.");try{return new URL(bst(t))}catch{throw Error("Invalid supabaseUrl: Provided URL is malformed.")}}const $6e="2.78.0",D4=30*1e3,Qhe=3,Sce=Qhe*D4,kst="http://localhost:9999",Nst="supabase.auth.token",Sst={"X-Client-Info":`gotrue-js/${$6e}`},Jhe="X-Supabase-Api-Version",U6e={"2024-01-01":{timestamp:Date.parse("2024-01-01T00:00:00.0Z"),name:"2024-01-01"}},Cst=/^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i,Mst=10*60*1e3;class CE extends Error{constructor(t,n,s){super(t),this.__isAuthError=!0,this.name="AuthError",this.status=n,this.code=s}}function oa(e){return typeof e=="object"&&e!==null&&"__isAuthError"in e}class Tst extends CE{constructor(t,n,s){super(t,n,s),this.name="AuthApiError",this.status=n,this.code=s}}function Ast(e){return oa(e)&&e.name==="AuthApiError"}class Yw extends CE{constructor(t,n){super(t),this.name="AuthUnknownError",this.originalError=n}}class jv extends CE{constructor(t,n,s,a){super(t,s,a),this.name=n,this.status=s}}class tm extends jv{constructor(){super("Auth session missing!","AuthSessionMissingError",400,void 0)}}function Est(e){return oa(e)&&e.name==="AuthSessionMissingError"}class x4 extends jv{constructor(){super("Auth session or user missing","AuthInvalidTokenResponseError",500,void 0)}}class QL extends jv{constructor(t){super(t,"AuthInvalidCredentialsError",400,void 0)}}class JL extends jv{constructor(t,n=null){super(t,"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 Ist(e){return oa(e)&&e.name==="AuthImplicitGrantRedirectError"}class vke extends jv{constructor(t,n=null){super(t,"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 efe extends jv{constructor(t,n){super(t,"AuthRetryableFetchError",n,void 0)}}function Cce(e){return oa(e)&&e.name==="AuthRetryableFetchError"}class _ke extends jv{constructor(t,n,s){super(t,"AuthWeakPasswordError",n,"weak_password"),this.reasons=s}}class tfe extends jv{constructor(t){super(t,"AuthInvalidJwtError",400,"invalid_jwt")}}const Ote="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split(""),bke=` \r=`.split(""),Pst=(()=>{const e=new Array(128);for(let t=0;t=6;){const s=t.queue>>t.queuedBits-6&63;n(Ote[s]),t.queuedBits-=6}else if(t.queuedBits>0)for(t.queue=t.queue<<6-t.queuedBits,t.queuedBits=6;t.queuedBits>=6;){const s=t.queue>>t.queuedBits-6&63;n(Ote[s]),t.queuedBits-=6}}function q6e(e,t,n){const s=Pst[e];if(s>-1)for(t.queue=t.queue<<6|s,t.queuedBits+=6;t.queuedBits>=8;)n(t.queue>>t.queuedBits-8&255),t.queuedBits-=8;else{if(s===-2)return;throw new Error(`Invalid Base64-URL character "${String.fromCharCode(e)}"`)}}function jke(e){const t=[],n=l=>{t.push(String.fromCodePoint(l))},s={utf8seq:0,codepoint:0},a={queue:0,queuedBits:0},o=l=>{Dst(l,s,n)};for(let l=0;l>6),t(128|e&63);return}else if(e<=65535){t(224|e>>12),t(128|e>>6&63),t(128|e&63);return}else if(e<=1114111){t(240|e>>18),t(128|e>>12&63),t(128|e>>6&63),t(128|e&63);return}throw new Error(`Unrecognized Unicode codepoint: ${e.toString(16)}`)}function Ost(e,t){for(let n=0;n55295&&s<=56319){const a=(s-55296)*1024&65535;s=(e.charCodeAt(n+1)-56320&65535|a)+65536,n+=1}Lst(s,t)}}function Dst(e,t,n){if(t.utf8seq===0){if(e<=127){n(e);return}for(let s=1;s<6;s+=1)if(!(e>>7-s&1)){t.utf8seq=s;break}if(t.utf8seq===2)t.codepoint=e&31;else if(t.utf8seq===3)t.codepoint=e&15;else if(t.utf8seq===4)t.codepoint=e&7;else throw new Error("Invalid UTF-8 sequence");t.utf8seq-=1}else if(t.utf8seq>0){if(e<=127)throw new Error("Invalid UTF-8 sequence");t.codepoint=t.codepoint<<6|e&63,t.utf8seq-=1,t.utf8seq===0&&n(t.codepoint)}}function qS(e){const t=[],n={queue:0,queuedBits:0},s=a=>{t.push(a)};for(let a=0;at.push(n)),new Uint8Array(t)}function nj(e){const t=[],n={queue:0,queuedBits:0},s=a=>{t.push(a)};return e.forEach(a=>wke(a,n,s)),wke(null,n,s),t.join("")}function Fst(e){return Math.round(Date.now()/1e3)+e}function zst(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){const t=Math.random()*16|0;return(e=="x"?t:t&3|8).toString(16)})}const Bu=()=>typeof window<"u"&&typeof document<"u",j_={tested:!1,writable:!1},V6e=()=>{if(!Bu())return!1;try{if(typeof globalThis.localStorage!="object")return!1}catch{return!1}if(j_.tested)return j_.writable;const e=`lswt-${Math.random()}${Math.random()}`;try{globalThis.localStorage.setItem(e,e),globalThis.localStorage.removeItem(e),j_.tested=!0,j_.writable=!0}catch{j_.tested=!0,j_.writable=!1}return j_.writable};function Bst(e){const t={},n=new URL(e);if(n.hash&&n.hash[0]==="#")try{new URLSearchParams(n.hash.substring(1)).forEach((a,o)=>{t[o]=a})}catch{}return n.searchParams.forEach((s,a)=>{t[a]=s}),t}const H6e=e=>{let t;return e?t=e:typeof fetch>"u"?t=(...n)=>k3(async()=>{const{default:s}=await Promise.resolve().then(()=>Nk);return{default:s}},void 0).then(({default:s})=>s(...n)):t=fetch,(...n)=>t(...n)},$st=e=>typeof e=="object"&&e!==null&&"status"in e&&"ok"in e&&"json"in e&&typeof e.json=="function",R4=async(e,t,n)=>{await e.setItem(t,JSON.stringify(n))},k_=async(e,t)=>{const n=await e.getItem(t);if(!n)return null;try{return JSON.parse(n)}catch{return n}},O0=async(e,t)=>{await e.removeItem(t)};class Sse{constructor(){this.promise=new Sse.promiseConstructor((t,n)=>{this.resolve=t,this.reject=n})}}Sse.promiseConstructor=Promise;function Mce(e){const t=e.split(".");if(t.length!==3)throw new tfe("Invalid JWT structure");for(let s=0;s{setTimeout(()=>t(null),e)})}function qst(e,t){return new Promise((s,a)=>{(async()=>{for(let o=0;o<1/0;o++)try{const l=await e(o);if(!t(o,null,l)){s(l);return}}catch(l){if(!t(o,l)){a(l);return}}})()})}function Vst(e){return("0"+e.toString(16)).substr(-2)}function Hst(){const t=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(t),Array.from(t,Vst).join("")}async function Wst(e){const n=new TextEncoder().encode(e),s=await crypto.subtle.digest("SHA-256",n),a=new Uint8Array(s);return Array.from(a).map(o=>String.fromCharCode(o)).join("")}async function Gst(e){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."),e;const n=await Wst(e);return btoa(n).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}async function y4(e,t,n=!1){const s=Hst();let a=s;n&&(a+="/PASSWORD_RECOVERY"),await R4(e,`${t}-code-verifier`,a);const o=await Gst(s);return[o,s===o?"plain":"s256"]}const Kst=/^2[0-9]{3}-(0[1-9]|1[0-2])-(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/i;function Zst(e){const t=e.headers.get(Jhe);if(!t||!t.match(Kst))return null;try{return new Date(`${t}T00:00:00.0Z`)}catch{return null}}function Yst(e){if(!e)throw new Error("Missing exp claim");const t=Math.floor(Date.now()/1e3);if(e<=t)throw new Error("JWT has expired")}function Xst(e){switch(e){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 Qst=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;function v4(e){if(!Qst.test(e))throw new Error("@supabase/auth-js: Expected parameter to be UUID but is not")}function Tce(){const e={};return new Proxy(e,{get:(t,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:(t,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:(t,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 Jst(e,t){return new Proxy(e,{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!t.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."),t.value=!0),Reflect.get(n,s,a)}})}function kke(e){return JSON.parse(JSON.stringify(e))}const Vw=e=>e.msg||e.message||e.error_description||e.error||JSON.stringify(e),eat=[502,503,504];async function Nke(e){var t;if(!$st(e))throw new efe(Vw(e),0);if(eat.includes(e.status))throw new efe(Vw(e),e.status);let n;try{n=await e.json()}catch(o){throw new Yw(Vw(o),o)}let s;const a=Zst(e);if(a&&a.getTime()>=U6e["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 _ke(Vw(n),e.status,((t=n.weak_password)===null||t===void 0?void 0:t.reasons)||[]);if(s==="session_not_found")throw new tm}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 _ke(Vw(n),e.status,n.weak_password.reasons);throw new Tst(Vw(n),e.status||500,s)}const tat=(e,t,n,s)=>{const a={method:e,headers:(t==null?void 0:t.headers)||{}};return e==="GET"?a:(a.headers=Object.assign({"Content-Type":"application/json;charset=UTF-8"},t==null?void 0:t.headers),a.body=JSON.stringify(s),Object.assign(Object.assign({},a),n))};async function Fa(e,t,n,s){var a;const o=Object.assign({},s==null?void 0:s.headers);o[Jhe]||(o[Jhe]=U6e["2024-01-01"].name),s!=null&&s.jwt&&(o.Authorization=`Bearer ${s.jwt}`);const l=(a=s==null?void 0:s.query)!==null&&a!==void 0?a:{};s!=null&&s.redirectTo&&(l.redirect_to=s.redirectTo);const i=Object.keys(l).length?"?"+new URLSearchParams(l).toString():"",u=await rat(e,t,n+i,{headers:o,noResolveJson:s==null?void 0:s.noResolveJson},{},s==null?void 0:s.body);return s!=null&&s.xform?s==null?void 0:s.xform(u):{data:Object.assign({},u),error:null}}async function rat(e,t,n,s,a,o){const l=tat(t,s,a,o);let i;try{i=await e(n,Object.assign({},l))}catch(u){throw console.error(u),new efe(Vw(u),0)}if(i.ok||await Nke(i),s!=null&&s.noResolveJson)return i;try{return await i.json()}catch(u){await Nke(u)}}function rm(e){var t;let n=null;aat(e)&&(n=Object.assign({},e),e.expires_at||(n.expires_at=Fst(e.expires_in)));const s=(t=e.user)!==null&&t!==void 0?t:e;return{data:{session:n,user:s},error:null}}function Ske(e){const t=rm(e);return!t.error&&e.weak_password&&typeof e.weak_password=="object"&&Array.isArray(e.weak_password.reasons)&&e.weak_password.reasons.length&&e.weak_password.message&&typeof e.weak_password.message=="string"&&e.weak_password.reasons.reduce((n,s)=>n&&typeof s=="string",!0)&&(t.data.weak_password=e.weak_password),t}function i1(e){var t;return{data:{user:(t=e.user)!==null&&t!==void 0?t:e},error:null}}function nat(e){return{data:e,error:null}}function sat(e){const{action_link:t,email_otp:n,hashed_token:s,redirect_to:a,verification_type:o}=e,l=wv(e,["action_link","email_otp","hashed_token","redirect_to","verification_type"]),i={action_link:t,email_otp:n,hashed_token:s,redirect_to:a,verification_type:o},u=Object.assign({},l);return{data:{properties:i,user:u},error:null}}function Cke(e){return e}function aat(e){return e.access_token&&e.refresh_token&&e.expires_in}const Ace=["global","local","others"];class iat{constructor({url:t="",headers:n={},fetch:s}){this.url=t,this.headers=n,this.fetch=H6e(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(t,n=Ace[0]){if(Ace.indexOf(n)<0)throw new Error(`@supabase/auth-js: Parameter scope must be one of ${Ace.join(", ")}`);try{return await Fa(this.fetch,"POST",`${this.url}/logout?scope=${n}`,{headers:this.headers,jwt:t,noResolveJson:!0}),{data:null,error:null}}catch(s){if(oa(s))return{data:null,error:s};throw s}}async inviteUserByEmail(t,n={}){try{return await Fa(this.fetch,"POST",`${this.url}/invite`,{body:{email:t,data:n.data},headers:this.headers,redirectTo:n.redirectTo,xform:i1})}catch(s){if(oa(s))return{data:{user:null},error:s};throw s}}async generateLink(t){try{const{options:n}=t,s=wv(t,["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 Fa(this.fetch,"POST",`${this.url}/admin/generate_link`,{body:a,headers:this.headers,xform:sat,redirectTo:n==null?void 0:n.redirectTo})}catch(n){if(oa(n))return{data:{properties:null,user:null},error:n};throw n}}async createUser(t){try{return await Fa(this.fetch,"POST",`${this.url}/admin/users`,{body:t,headers:this.headers,xform:i1})}catch(n){if(oa(n))return{data:{user:null},error:n};throw n}}async listUsers(t){var n,s,a,o,l,i,u;try{const p={nextPage:null,lastPage:0,total:0},x=await Fa(this.fetch,"GET",`${this.url}/admin/users`,{headers:this.headers,noResolveJson:!0,query:{page:(s=(n=t==null?void 0:t.page)===null||n===void 0?void 0:n.toString())!==null&&s!==void 0?s:"",per_page:(o=(a=t==null?void 0:t.perPage)===null||a===void 0?void 0:a.toString())!==null&&o!==void 0?o:""},xform:Cke});if(x.error)throw x.error;const y=await x.json(),_=(l=x.headers.get("x-total-count"))!==null&&l!==void 0?l:0,b=(u=(i=x.headers.get("link"))===null||i===void 0?void 0:i.split(","))!==null&&u!==void 0?u:[];return b.length>0&&(b.forEach(S=>{const k=parseInt(S.split(";")[0].split("=")[1].substring(0,1)),M=JSON.parse(S.split(";")[1].split("=")[1]);p[`${M}Page`]=k}),p.total=parseInt(_)),{data:Object.assign(Object.assign({},y),p),error:null}}catch(p){if(oa(p))return{data:{users:[]},error:p};throw p}}async getUserById(t){v4(t);try{return await Fa(this.fetch,"GET",`${this.url}/admin/users/${t}`,{headers:this.headers,xform:i1})}catch(n){if(oa(n))return{data:{user:null},error:n};throw n}}async updateUserById(t,n){v4(t);try{return await Fa(this.fetch,"PUT",`${this.url}/admin/users/${t}`,{body:n,headers:this.headers,xform:i1})}catch(s){if(oa(s))return{data:{user:null},error:s};throw s}}async deleteUser(t,n=!1){v4(t);try{return await Fa(this.fetch,"DELETE",`${this.url}/admin/users/${t}`,{headers:this.headers,body:{should_soft_delete:n},xform:i1})}catch(s){if(oa(s))return{data:{user:null},error:s};throw s}}async _listFactors(t){v4(t.userId);try{const{data:n,error:s}=await Fa(this.fetch,"GET",`${this.url}/admin/users/${t.userId}/factors`,{headers:this.headers,xform:a=>({data:{factors:a},error:null})});return{data:n,error:s}}catch(n){if(oa(n))return{data:null,error:n};throw n}}async _deleteFactor(t){v4(t.userId),v4(t.id);try{return{data:await Fa(this.fetch,"DELETE",`${this.url}/admin/users/${t.userId}/factors/${t.id}`,{headers:this.headers}),error:null}}catch(n){if(oa(n))return{data:null,error:n};throw n}}async _listOAuthClients(t){var n,s,a,o,l,i,u;try{const p={nextPage:null,lastPage:0,total:0},x=await Fa(this.fetch,"GET",`${this.url}/admin/oauth/clients`,{headers:this.headers,noResolveJson:!0,query:{page:(s=(n=t==null?void 0:t.page)===null||n===void 0?void 0:n.toString())!==null&&s!==void 0?s:"",per_page:(o=(a=t==null?void 0:t.perPage)===null||a===void 0?void 0:a.toString())!==null&&o!==void 0?o:""},xform:Cke});if(x.error)throw x.error;const y=await x.json(),_=(l=x.headers.get("x-total-count"))!==null&&l!==void 0?l:0,b=(u=(i=x.headers.get("link"))===null||i===void 0?void 0:i.split(","))!==null&&u!==void 0?u:[];return b.length>0&&(b.forEach(S=>{const k=parseInt(S.split(";")[0].split("=")[1].substring(0,1)),M=JSON.parse(S.split(";")[1].split("=")[1]);p[`${M}Page`]=k}),p.total=parseInt(_)),{data:Object.assign(Object.assign({},y),p),error:null}}catch(p){if(oa(p))return{data:{clients:[]},error:p};throw p}}async _createOAuthClient(t){try{return await Fa(this.fetch,"POST",`${this.url}/admin/oauth/clients`,{body:t,headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(oa(n))return{data:null,error:n};throw n}}async _getOAuthClient(t){try{return await Fa(this.fetch,"GET",`${this.url}/admin/oauth/clients/${t}`,{headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(oa(n))return{data:null,error:n};throw n}}async _updateOAuthClient(t,n){try{return await Fa(this.fetch,"PUT",`${this.url}/admin/oauth/clients/${t}`,{body:n,headers:this.headers,xform:s=>({data:s,error:null})})}catch(s){if(oa(s))return{data:null,error:s};throw s}}async _deleteOAuthClient(t){try{return await Fa(this.fetch,"DELETE",`${this.url}/admin/oauth/clients/${t}`,{headers:this.headers,noResolveJson:!0}),{data:null,error:null}}catch(n){if(oa(n))return{data:null,error:n};throw n}}async _regenerateOAuthClientSecret(t){try{return await Fa(this.fetch,"POST",`${this.url}/admin/oauth/clients/${t}/regenerate_secret`,{headers:this.headers,xform:n=>({data:n,error:null})})}catch(n){if(oa(n))return{data:null,error:n};throw n}}}function Mke(e={}){return{getItem:t=>e[t]||null,setItem:(t,n)=>{e[t]=n},removeItem:t=>{delete e[t]}}}const _4={debug:!!(globalThis&&V6e()&&globalThis.localStorage&&globalThis.localStorage.getItem("supabase.gotrue-js.locks.debug")==="true")};class W6e extends Error{constructor(t){super(t),this.isAcquireTimeout=!0}}class oat extends W6e{}async function lat(e,t,n){_4.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquire lock",e,t);const s=new globalThis.AbortController;return t>0&&setTimeout(()=>{s.abort(),_4.debug&&console.log("@supabase/gotrue-js: navigatorLock acquire timed out",e)},t),await Promise.resolve().then(()=>globalThis.navigator.locks.request(e,t===0?{mode:"exclusive",ifAvailable:!0}:{mode:"exclusive",signal:s.signal},async a=>{if(a){_4.debug&&console.log("@supabase/gotrue-js: navigatorLock: acquired",e,a.name);try{return await n()}finally{_4.debug&&console.log("@supabase/gotrue-js: navigatorLock: released",e,a.name)}}else{if(t===0)throw _4.debug&&console.log("@supabase/gotrue-js: navigatorLock: not immediately available",e),new oat(`Acquiring an exclusive Navigator LockManager lock "${e}" immediately failed`);if(_4.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 cat(){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 G6e(e){if(!/^0x[a-fA-F0-9]{40}$/.test(e))throw new Error(`@supabase/auth-js: Address "${e}" is invalid.`);return e.toLowerCase()}function dat(e){return parseInt(e,16)}function uat(e){const t=new TextEncoder().encode(e);return"0x"+Array.from(t,s=>s.toString(16).padStart(2,"0")).join("")}function hat(e){var t;const{chainId:n,domain:s,expirationTime:a,issuedAt:o=new Date,nonce:l,notBefore:i,requestId:u,resources:p,scheme:x,uri:y,version:_}=e;{if(!Number.isInteger(n))throw new Error(`@supabase/auth-js: Invalid SIWE message field "chainId". Chain ID must be a EIP-155 chain ID. Provided value: ${n}`);if(!s)throw new Error('@supabase/auth-js: Invalid SIWE message field "domain". Domain must be provided.');if(l&&l.length<8)throw new Error(`@supabase/auth-js: Invalid SIWE message field "nonce". Nonce must be at least 8 characters. Provided value: ${l}`);if(!y)throw new Error('@supabase/auth-js: Invalid SIWE message field "uri". URI must be provided.');if(_!=="1")throw new Error(`@supabase/auth-js: Invalid SIWE message field "version". Version must be '1'. Provided value: ${_}`);if(!((t=e.statement)===null||t===void 0)&&t.includes(` `))throw new Error(`@supabase/auth-js: Invalid SIWE message field "statement". Statement must not include '\\n'. Provided value: ${e.statement}`)}const b=G6e(e.address),S=x?`${x}://${s}`:s,k=e.statement?`${e.statement} `:"",M=`${S} wants you to sign in with your Ethereum account: ${b} ${k}`;let P=`URI: ${y} Version: ${_} Chain ID: ${n}${l?` Nonce: ${l}`:""} Issued At: ${o.toISOString()}`;if(a&&(P+=` Expiration Time: ${a.toISOString()}`),i&&(P+=` Not Before: ${i.toISOString()}`),u&&(P+=` Request ID: ${u}`),p){let T=` Resources:`;for(const I of p){if(!I||typeof I!="string")throw new Error(`@supabase/auth-js: Invalid SIWE message field "resources". Every resource must be a valid string. Provided value: ${I}`);T+=` - ${I}`}P+=T}return`${M} ${P}`}class Rc extends Error{constructor({message:t,code:n,cause:s,name:a}){var o;super(t,{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 Dte extends Rc{constructor(t,n){super({code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:n,message:t}),this.name="WebAuthnUnknownError",this.originalError=n}}function fat({error:e,options:t}){var n,s,a;const{publicKey:o}=t;if(!o)throw Error("options was missing required publicKey property");if(e.name==="AbortError"){if(t.signal instanceof AbortSignal)return new Rc({message:"Registration ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:e})}else if(e.name==="ConstraintError"){if(((n=o.authenticatorSelection)===null||n===void 0?void 0:n.requireResidentKey)===!0)return new Rc({message:"Discoverable credentials were required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT",cause:e});if(t.mediation==="conditional"&&((s=o.authenticatorSelection)===null||s===void 0?void 0:s.userVerification)==="required")return new Rc({message:"User verification was required during automatic registration but it could not be performed",code:"ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE",cause:e});if(((a=o.authenticatorSelection)===null||a===void 0?void 0:a.userVerification)==="required")return new Rc({message:"User verification was required but no available authenticator supported it",code:"ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT",cause:e})}else{if(e.name==="InvalidStateError")return new Rc({message:"The authenticator was previously registered",code:"ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED",cause:e});if(e.name==="NotAllowedError")return new Rc({message:e.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e});if(e.name==="NotSupportedError")return o.pubKeyCredParams.filter(i=>i.type==="public-key").length===0?new Rc({message:'No entry in pubKeyCredParams was of type "public-key"',code:"ERROR_MALFORMED_PUBKEYCREDPARAMS",cause:e}):new Rc({message:"No available authenticator supported any of the specified pubKeyCredParams algorithms",code:"ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG",cause:e});if(e.name==="SecurityError"){const l=window.location.hostname;if(K6e(l)){if(o.rp.id!==l)return new Rc({message:`The RP ID "${o.rp.id}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:e})}else return new Rc({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:e})}else if(e.name==="TypeError"){if(o.user.id.byteLength<1||o.user.id.byteLength>64)return new Rc({message:"User ID was not between 1 and 64 characters",code:"ERROR_INVALID_USER_ID_LENGTH",cause:e})}else if(e.name==="UnknownError")return new Rc({message:"The authenticator was unable to process the specified options, or could not create a new credential",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:e})}return new Rc({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e})}function pat({error:e,options:t}){const{publicKey:n}=t;if(!n)throw Error("options was missing required publicKey property");if(e.name==="AbortError"){if(t.signal instanceof AbortSignal)return new Rc({message:"Authentication ceremony was sent an abort signal",code:"ERROR_CEREMONY_ABORTED",cause:e})}else{if(e.name==="NotAllowedError")return new Rc({message:e.message,code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e});if(e.name==="SecurityError"){const s=window.location.hostname;if(K6e(s)){if(n.rpId!==s)return new Rc({message:`The RP ID "${n.rpId}" is invalid for this domain`,code:"ERROR_INVALID_RP_ID",cause:e})}else return new Rc({message:`${window.location.hostname} is an invalid domain`,code:"ERROR_INVALID_DOMAIN",cause:e})}else if(e.name==="UnknownError")return new Rc({message:"The authenticator was unable to process the specified options, or could not create a new assertion signature",code:"ERROR_AUTHENTICATOR_GENERAL_ERROR",cause:e})}return new Rc({message:"a Non-Webauthn related error has occurred",code:"ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY",cause:e})}class mat{createNewAbortSignal(){if(this.controller){const n=new Error("Cancelling existing WebAuthn API call for new one");n.name="AbortError",this.controller.abort(n)}const t=new AbortController;return this.controller=t,t.signal}cancelCeremony(){if(this.controller){const t=new Error("Manually cancelling existing WebAuthn API call");t.name="AbortError",this.controller.abort(t),this.controller=void 0}}}const gat=new mat;function xat(e){if(!e)throw new Error("Credential creation options are required");if(typeof PublicKeyCredential<"u"&&"parseCreationOptionsFromJSON"in PublicKeyCredential&&typeof PublicKeyCredential.parseCreationOptionsFromJSON=="function")return PublicKeyCredential.parseCreationOptionsFromJSON(e);const{challenge:t,user:n,excludeCredentials:s}=e,a=wv(e,["challenge","user","excludeCredentials"]),o=qS(t).buffer,l=Object.assign(Object.assign({},n),{id:qS(n.id).buffer}),i=Object.assign(Object.assign({},a),{challenge:o,user:l});if(s&&s.length>0){i.excludeCredentials=new Array(s.length);for(let u=0;u0){o.allowCredentials=new Array(n.length);for(let l=0;la!==null&&typeof a=="object"&&!Array.isArray(a),n=a=>a instanceof ArrayBuffer||ArrayBuffer.isView(a),s={};for(const a of e)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(t(l)){const i=s[o];t(i)?s[o]=Rte(i,l):s[o]=Rte(l)}else s[o]=l}return s}function Nat(e,t){return Rte(jat,e,t||{})}function Sat(e,t){return Rte(kat,e,t||{})}class Cat{constructor(t){this.client=t,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(t){return this.client.mfa.enroll(Object.assign(Object.assign({},t),{factorType:"webauthn"}))}async _challenge({factorId:t,webauthn:n,friendlyName:s,signal:a},o){try{const{data:l,error:i}=await this.client.mfa.challenge({factorId:t,webauthn:n});if(!l)return{data:null,error:i};const u=a??gat.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=Nat(l.webauthn.credential_options.publicKey,o==null?void 0:o.create),{data:x,error:y}=await bat({publicKey:p,signal:u});return x?{data:{factorId:t,challengeId:l.id,webauthn:{type:l.webauthn.type,credential_response:x}},error:null}:{data:null,error:y}}case"request":{const p=Sat(l.webauthn.credential_options.publicKey,o==null?void 0:o.request),{data:x,error:y}=await wat(Object.assign(Object.assign({},l.webauthn.credential_options),{publicKey:p,signal:u}));return x?{data:{factorId:t,challengeId:l.id,webauthn:{type:l.webauthn.type,credential_response:x}},error:null}:{data:null,error:y}}}}catch(l){return oa(l)?{data:null,error:l}:{data:null,error:new Yw("Unexpected error in challenge",l)}}}async _verify({challengeId:t,factorId:n,webauthn:s}){return this.client.mfa.verify({factorId:n,challengeId:t,webauthn:s})}async _authenticate({factorId:t,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 CE("rpId is required for WebAuthn authentication")};try{if(!Tke())return{data:null,error:new Yw("Browser does not support WebAuthn",null)};const{data:l,error:i}=await this.challenge({factorId:t,webauthn:{rpId:n,rpOrigins:s},signal:a},{request:o});if(!l)return{data:null,error:i};const{webauthn:u}=l;return this._verify({factorId:t,challengeId:l.challengeId,webauthn:{type:u.type,rpId:n,rpOrigins:s,credential_response:u.credential_response}})}catch(l){return oa(l)?{data:null,error:l}:{data:null,error:new Yw("Unexpected error in authenticate",l)}}}async _register({friendlyName:t,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 CE("rpId is required for WebAuthn registration")};try{if(!Tke())return{data:null,error:new Yw("Browser does not support WebAuthn",null)};const{data:l,error:i}=await this._enroll({friendlyName:t});if(!l)return await this.client.mfa.listFactors().then(x=>{var y;return(y=x.data)===null||y===void 0?void 0:y.all.find(_=>_.factor_type==="webauthn"&&_.friendly_name===t&&_.status!=="unverified")}).then(x=>x?this.client.mfa.unenroll({factorId:x==null?void 0:x.id}):void 0),{data:null,error:i};const{data:u,error:p}=await this._challenge({factorId:l.id,friendlyName:l.friendly_name,webauthn:{rpId:n,rpOrigins:s},signal:a},{create:o});return u?this._verify({factorId:l.id,challengeId:u.challengeId,webauthn:{rpId:n,rpOrigins:s,type:u.webauthn.type,credential_response:u.webauthn.credential_response}}):{data:null,error:p}}catch(l){return oa(l)?{data:null,error:l}:{data:null,error:new Yw("Unexpected error in register",l)}}}}cat();const Mat={url:kst,storageKey:Nst,autoRefreshToken:!0,persistSession:!0,detectSessionInUrl:!0,headers:Sst,flowType:"implicit",debug:!1,hasCustomAuthorizationHeader:!1};async function Ake(e,t,n){return await n()}const b4={};class ME{get jwks(){var t,n;return(n=(t=b4[this.storageKey])===null||t===void 0?void 0:t.jwks)!==null&&n!==void 0?n:{keys:[]}}set jwks(t){b4[this.storageKey]=Object.assign(Object.assign({},b4[this.storageKey]),{jwks:t})}get jwks_cached_at(){var t,n;return(n=(t=b4[this.storageKey])===null||t===void 0?void 0:t.cachedAt)!==null&&n!==void 0?n:Number.MIN_SAFE_INTEGER}set jwks_cached_at(t){b4[this.storageKey]=Object.assign(Object.assign({},b4[this.storageKey]),{cachedAt:t})}constructor(t){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=ME.nextInstanceID,ME.nextInstanceID+=1,this.instanceID>0&&Bu()&&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({},Mat),t);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 iat({url:a.url,headers:a.headers,fetch:a.fetch}),this.url=a.url,this.headers=a.headers,this.fetch=H6e(a.fetch),this.lock=a.lock||Ake,this.detectSessionInUrl=a.detectSessionInUrl,this.flowType=a.flowType,this.hasCustomAuthorizationHeader=a.hasCustomAuthorizationHeader,a.lock?this.lock=a.lock:Bu()&&(!((n=globalThis==null?void 0:globalThis.navigator)===null||n===void 0)&&n.locks)?this.lock=lat:this.lock=Ake,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 Cat(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:V6e()?this.storage=globalThis.localStorage:(this.memoryStorage={},this.storage=Mke(this.memoryStorage)),a.userStorage&&(this.userStorage=a.userStorage)):(this.memoryStorage={},this.storage=Mke(this.memoryStorage)),Bu()&&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(...t){return this.logDebugMessages&&this.logger(`GoTrueClient@${this.instanceID} (${$6e}) ${new Date().toISOString()}`,...t),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 t;try{const n=Bst(window.location.href);let s="none";if(this._isImplicitGrantCallback(n)?s="implicit":await this._isPKCECallback(n)&&(s="pkce"),Bu()&&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),Ist(o)){const u=(t=o.details)===null||t===void 0?void 0:t.code;if(u==="identity_already_exists"||u==="identity_not_found"||u==="single_identity_not_deletable")return{error:o}}return await this._removeSession(),{error:o}}const{session:l,redirectType:i}=a;return this._debug("#_initialize()","detected session in URL",l,"redirect type",i),await this._saveSession(l),setTimeout(async()=>{i==="recovery"?await this._notifyAllSubscribers("PASSWORD_RECOVERY",l):await this._notifyAllSubscribers("SIGNED_IN",l)},0),{error:null}}return await this._recoverAndRefresh(),{error:null}}catch(n){return oa(n)?{error:n}:{error:new Yw("Unexpected error during initialization",n)}}finally{await this._handleVisibilityChange(),this._debug("#_initialize()","end")}}async signInAnonymously(t){var n,s,a;try{const o=await Fa(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{data:(s=(n=t==null?void 0:t.options)===null||n===void 0?void 0:n.data)!==null&&s!==void 0?s:{},gotrue_meta_security:{captcha_token:(a=t==null?void 0:t.options)===null||a===void 0?void 0:a.captchaToken}},xform:rm}),{data:l,error:i}=o;if(i||!l)return{data:{user:null,session:null},error:i};const u=l.session,p=l.user;return l.session&&(await this._saveSession(l.session),await this._notifyAllSubscribers("SIGNED_IN",u)),{data:{user:p,session:u},error:null}}catch(o){if(oa(o))return{data:{user:null,session:null},error:o};throw o}}async signUp(t){var n,s,a;try{let o;if("email"in t){const{email:x,password:y,options:_}=t;let b=null,S=null;this.flowType==="pkce"&&([b,S]=await y4(this.storage,this.storageKey)),o=await Fa(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,redirectTo:_==null?void 0:_.emailRedirectTo,body:{email:x,password:y,data:(n=_==null?void 0:_.data)!==null&&n!==void 0?n:{},gotrue_meta_security:{captcha_token:_==null?void 0:_.captchaToken},code_challenge:b,code_challenge_method:S},xform:rm})}else if("phone"in t){const{phone:x,password:y,options:_}=t;o=await Fa(this.fetch,"POST",`${this.url}/signup`,{headers:this.headers,body:{phone:x,password:y,data:(s=_==null?void 0:_.data)!==null&&s!==void 0?s:{},channel:(a=_==null?void 0:_.channel)!==null&&a!==void 0?a:"sms",gotrue_meta_security:{captcha_token:_==null?void 0:_.captchaToken}},xform:rm})}else throw new QL("You must provide either an email or phone number and a password");const{data:l,error:i}=o;if(i||!l)return{data:{user:null,session:null},error:i};const u=l.session,p=l.user;return l.session&&(await this._saveSession(l.session),await this._notifyAllSubscribers("SIGNED_IN",u)),{data:{user:p,session:u},error:null}}catch(o){if(oa(o))return{data:{user:null,session:null},error:o};throw o}}async signInWithPassword(t){try{let n;if("email"in t){const{email:o,password:l,options:i}=t;n=await Fa(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:Ske})}else if("phone"in t){const{phone:o,password:l,options:i}=t;n=await Fa(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:Ske})}else throw new QL("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 x4}:(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(oa(n))return{data:{user:null,session:null},error:n};throw n}}async signInWithOAuth(t){var n,s,a,o;return await this._handleProviderSignIn(t.provider,{redirectTo:(n=t.options)===null||n===void 0?void 0:n.redirectTo,scopes:(s=t.options)===null||s===void 0?void 0:s.scopes,queryParams:(a=t.options)===null||a===void 0?void 0:a.queryParams,skipBrowserRedirect:(o=t.options)===null||o===void 0?void 0:o.skipBrowserRedirect})}async exchangeCodeForSession(t){return await this.initializePromise,this._acquireLock(-1,async()=>this._exchangeCodeForSession(t))}async signInWithWeb3(t){const{chain:n}=t;switch(n){case"ethereum":return await this.signInWithEthereum(t);case"solana":return await this.signInWithSolana(t);default:throw new Error(`@supabase/auth-js: Unsupported chain "${n}"`)}}async signInWithEthereum(t){var n,s,a,o,l,i,u,p,x,y,_;let b,S;if("message"in t)b=t.message,S=t.signature;else{const{chain:k,wallet:M,statement:P,options:T}=t;let I;if(Bu())if(typeof M=="object")I=M;else{const G=window;if("ethereum"in G&&typeof G.ethereum=="object"&&"request"in G.ethereum&&typeof G.ethereum.request=="function")I=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 M!="object"||!(T!=null&&T.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");I=M}const z=new URL((n=T==null?void 0:T.url)!==null&&n!==void 0?n:window.location.href),D=await I.request({method:"eth_requestAccounts"}).then(G=>G).catch(()=>{throw new Error("@supabase/auth-js: Wallet method eth_requestAccounts is missing or invalid")});if(!D||D.length===0)throw new Error("@supabase/auth-js: No accounts available. Please ensure the wallet is connected.");const U=G6e(D[0]);let V=(s=T==null?void 0:T.signInWithEthereum)===null||s===void 0?void 0:s.chainId;if(!V){const G=await I.request({method:"eth_chainId"});V=dat(G)}const W={domain:z.host,address:U,statement:P,uri:z.href,version:"1",chainId:V,nonce:(a=T==null?void 0:T.signInWithEthereum)===null||a===void 0?void 0:a.nonce,issuedAt:(l=(o=T==null?void 0:T.signInWithEthereum)===null||o===void 0?void 0:o.issuedAt)!==null&&l!==void 0?l:new Date,expirationTime:(i=T==null?void 0:T.signInWithEthereum)===null||i===void 0?void 0:i.expirationTime,notBefore:(u=T==null?void 0:T.signInWithEthereum)===null||u===void 0?void 0:u.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};b=hat(W),S=await I.request({method:"personal_sign",params:[uat(b),U]})}try{const{data:k,error:M}=await Fa(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"ethereum",message:b,signature:S},!((y=t.options)===null||y===void 0)&&y.captchaToken?{gotrue_meta_security:{captcha_token:(_=t.options)===null||_===void 0?void 0:_.captchaToken}}:null),xform:rm});if(M)throw M;return!k||!k.session||!k.user?{data:{user:null,session:null},error:new x4}:(k.session&&(await this._saveSession(k.session),await this._notifyAllSubscribers("SIGNED_IN",k.session)),{data:Object.assign({},k),error:M})}catch(k){if(oa(k))return{data:{user:null,session:null},error:k};throw k}}async signInWithSolana(t){var n,s,a,o,l,i,u,p,x,y,_,b;let S,k;if("message"in t)S=t.message,k=t.signature;else{const{chain:M,wallet:P,statement:T,options:I}=t;let z;if(Bu())if(typeof P=="object")z=P;else{const U=window;if("solana"in U&&typeof U.solana=="object"&&("signIn"in U.solana&&typeof U.solana.signIn=="function"||"signMessage"in U.solana&&typeof U.solana.signMessage=="function"))z=U.solana;else throw new Error("@supabase/auth-js: No compatible Solana wallet interface on the window object (window.solana) detected. Make sure the user already has a wallet installed and connected for this app. Prefer passing the wallet interface object directly to signInWithWeb3({ chain: 'solana', wallet: resolvedUserWallet }) instead.")}else{if(typeof P!="object"||!(I!=null&&I.url))throw new Error("@supabase/auth-js: Both wallet and url must be specified in non-browser environments.");z=P}const D=new URL((n=I==null?void 0:I.url)!==null&&n!==void 0?n:window.location.href);if("signIn"in z&&z.signIn){const U=await z.signIn(Object.assign(Object.assign(Object.assign({issuedAt:new Date().toISOString()},I==null?void 0:I.signInWithSolana),{version:"1",domain:D.host,uri:D.href}),T?{statement:T}:null));let V;if(Array.isArray(U)&&U[0]&&typeof U[0]=="object")V=U[0];else if(U&&typeof U=="object"&&"signedMessage"in U&&"signature"in U)V=U;else throw new Error("@supabase/auth-js: Wallet method signIn() returned unrecognized value");if("signedMessage"in V&&"signature"in V&&(typeof V.signedMessage=="string"||V.signedMessage instanceof Uint8Array)&&V.signature instanceof Uint8Array)S=typeof V.signedMessage=="string"?V.signedMessage:new TextDecoder().decode(V.signedMessage),k=V.signature;else throw new Error("@supabase/auth-js: Wallet method signIn() API returned object without signedMessage and signature fields")}else{if(!("signMessage"in z)||typeof z.signMessage!="function"||!("publicKey"in z)||typeof z!="object"||!z.publicKey||!("toBase58"in z.publicKey)||typeof z.publicKey.toBase58!="function")throw new Error("@supabase/auth-js: Wallet does not have a compatible signMessage() and publicKey.toBase58() API");S=[`${D.host} wants you to sign in with your Solana account:`,z.publicKey.toBase58(),...T?["",T,""]:[""],"Version: 1",`URI: ${D.href}`,`Issued At: ${(a=(s=I==null?void 0:I.signInWithSolana)===null||s===void 0?void 0:s.issuedAt)!==null&&a!==void 0?a:new Date().toISOString()}`,...!((o=I==null?void 0:I.signInWithSolana)===null||o===void 0)&&o.notBefore?[`Not Before: ${I.signInWithSolana.notBefore}`]:[],...!((l=I==null?void 0:I.signInWithSolana)===null||l===void 0)&&l.expirationTime?[`Expiration Time: ${I.signInWithSolana.expirationTime}`]:[],...!((i=I==null?void 0:I.signInWithSolana)===null||i===void 0)&&i.chainId?[`Chain ID: ${I.signInWithSolana.chainId}`]:[],...!((u=I==null?void 0:I.signInWithSolana)===null||u===void 0)&&u.nonce?[`Nonce: ${I.signInWithSolana.nonce}`]:[],...!((p=I==null?void 0:I.signInWithSolana)===null||p===void 0)&&p.requestId?[`Request ID: ${I.signInWithSolana.requestId}`]:[],...!((y=(x=I==null?void 0:I.signInWithSolana)===null||x===void 0?void 0:x.resources)===null||y===void 0)&&y.length?["Resources",...I.signInWithSolana.resources.map(V=>`- ${V}`)]:[]].join(` `);const U=await z.signMessage(new TextEncoder().encode(S),"utf8");if(!U||!(U instanceof Uint8Array))throw new Error("@supabase/auth-js: Wallet signMessage() API returned an recognized value");k=U}}try{const{data:M,error:P}=await Fa(this.fetch,"POST",`${this.url}/token?grant_type=web3`,{headers:this.headers,body:Object.assign({chain:"solana",message:S,signature:nj(k)},!((_=t.options)===null||_===void 0)&&_.captchaToken?{gotrue_meta_security:{captcha_token:(b=t.options)===null||b===void 0?void 0:b.captchaToken}}:null),xform:rm});if(P)throw P;return!M||!M.session||!M.user?{data:{user:null,session:null},error:new x4}:(M.session&&(await this._saveSession(M.session),await this._notifyAllSubscribers("SIGNED_IN",M.session)),{data:Object.assign({},M),error:P})}catch(M){if(oa(M))return{data:{user:null,session:null},error:M};throw M}}async _exchangeCodeForSession(t){const n=await k_(this.storage,`${this.storageKey}-code-verifier`),[s,a]=(n??"").split("/");try{const{data:o,error:l}=await Fa(this.fetch,"POST",`${this.url}/token?grant_type=pkce`,{headers:this.headers,body:{auth_code:t,code_verifier:s},xform:rm});if(await O0(this.storage,`${this.storageKey}-code-verifier`),l)throw l;return!o||!o.session||!o.user?{data:{user:null,session:null,redirectType:null},error:new x4}:(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(oa(o))return{data:{user:null,session:null,redirectType:null},error:o};throw o}}async signInWithIdToken(t){try{const{options:n,provider:s,token:a,access_token:o,nonce:l}=t,i=await Fa(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:rm}),{data:u,error:p}=i;return p?{data:{user:null,session:null},error:p}:!u||!u.session||!u.user?{data:{user:null,session:null},error:new x4}:(u.session&&(await this._saveSession(u.session),await this._notifyAllSubscribers("SIGNED_IN",u.session)),{data:u,error:p})}catch(n){if(oa(n))return{data:{user:null,session:null},error:n};throw n}}async signInWithOtp(t){var n,s,a,o,l;try{if("email"in t){const{email:i,options:u}=t;let p=null,x=null;this.flowType==="pkce"&&([p,x]=await y4(this.storage,this.storageKey));const{error:y}=await Fa(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{email:i,data:(n=u==null?void 0:u.data)!==null&&n!==void 0?n:{},create_user:(s=u==null?void 0:u.shouldCreateUser)!==null&&s!==void 0?s:!0,gotrue_meta_security:{captcha_token:u==null?void 0:u.captchaToken},code_challenge:p,code_challenge_method:x},redirectTo:u==null?void 0:u.emailRedirectTo});return{data:{user:null,session:null},error:y}}if("phone"in t){const{phone:i,options:u}=t,{data:p,error:x}=await Fa(this.fetch,"POST",`${this.url}/otp`,{headers:this.headers,body:{phone:i,data:(a=u==null?void 0:u.data)!==null&&a!==void 0?a:{},create_user:(o=u==null?void 0:u.shouldCreateUser)!==null&&o!==void 0?o:!0,gotrue_meta_security:{captcha_token:u==null?void 0:u.captchaToken},channel:(l=u==null?void 0:u.channel)!==null&&l!==void 0?l:"sms"}});return{data:{user:null,session:null,messageId:p==null?void 0:p.message_id},error:x}}throw new QL("You must provide either an email or phone number.")}catch(i){if(oa(i))return{data:{user:null,session:null},error:i};throw i}}async verifyOtp(t){var n,s;try{let a,o;"options"in t&&(a=(n=t.options)===null||n===void 0?void 0:n.redirectTo,o=(s=t.options)===null||s===void 0?void 0:s.captchaToken);const{data:l,error:i}=await Fa(this.fetch,"POST",`${this.url}/verify`,{headers:this.headers,body:Object.assign(Object.assign({},t),{gotrue_meta_security:{captcha_token:o}}),redirectTo:a,xform:rm});if(i)throw i;if(!l)throw new Error("An error occurred on token verification.");const u=l.session,p=l.user;return u!=null&&u.access_token&&(await this._saveSession(u),await this._notifyAllSubscribers(t.type=="recovery"?"PASSWORD_RECOVERY":"SIGNED_IN",u)),{data:{user:p,session:u},error:null}}catch(a){if(oa(a))return{data:{user:null,session:null},error:a};throw a}}async signInWithSSO(t){var n,s,a;try{let o=null,l=null;return this.flowType==="pkce"&&([o,l]=await y4(this.storage,this.storageKey)),await Fa(this.fetch,"POST",`${this.url}/sso`,{body:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},"providerId"in t?{provider_id:t.providerId}:null),"domain"in t?{domain:t.domain}:null),{redirect_to:(s=(n=t.options)===null||n===void 0?void 0:n.redirectTo)!==null&&s!==void 0?s:void 0}),!((a=t==null?void 0:t.options)===null||a===void 0)&&a.captchaToken?{gotrue_meta_security:{captcha_token:t.options.captchaToken}}:null),{skip_http_redirect:!0,code_challenge:o,code_challenge_method:l}),headers:this.headers,xform:nat})}catch(o){if(oa(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 t=>{const{data:{session:n},error:s}=t;if(s)throw s;if(!n)throw new tm;const{error:a}=await Fa(this.fetch,"GET",`${this.url}/reauthenticate`,{headers:this.headers,jwt:n.access_token});return{data:{user:null,session:null},error:a}})}catch(t){if(oa(t))return{data:{user:null,session:null},error:t};throw t}}async resend(t){try{const n=`${this.url}/resend`;if("email"in t){const{email:s,type:a,options:o}=t,{error:l}=await Fa(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 t){const{phone:s,type:a,options:o}=t,{data:l,error:i}=await Fa(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 QL("You must provide either an email or phone number and a type")}catch(n){if(oa(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(t,n){this._debug("#_acquireLock","begin",t);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}`,t,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(t){this._debug("#_useSession","begin");try{const n=await this.__loadSession();return await t(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 t=null;const n=await k_(this.storage,this.storageKey);if(this._debug("#getSession()","session from storage",n),n!==null&&(this._isValidSession(n)?t=n:(this._debug("#getSession()","session from storage is not valid"),await this._removeSession())),!t)return{data:{session:null},error:null};const s=t.expires_at?t.expires_at*1e3-Date.now()await this._getUser()))}async _getUser(t){try{return t?await Fa(this.fetch,"GET",`${this.url}/user`,{headers:this.headers,jwt:t,xform:i1}):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 tm}:await Fa(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:i1})})}catch(n){if(oa(n))return Est(n)&&(await this._removeSession(),await O0(this.storage,`${this.storageKey}-code-verifier`)),{data:{user:null},error:n};throw n}}async updateUser(t,n={}){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._updateUser(t,n))}async _updateUser(t,n={}){try{return await this._useSession(async s=>{const{data:a,error:o}=s;if(o)throw o;if(!a.session)throw new tm;const l=a.session;let i=null,u=null;this.flowType==="pkce"&&t.email!=null&&([i,u]=await y4(this.storage,this.storageKey));const{data:p,error:x}=await Fa(this.fetch,"PUT",`${this.url}/user`,{headers:this.headers,redirectTo:n==null?void 0:n.emailRedirectTo,body:Object.assign(Object.assign({},t),{code_challenge:i,code_challenge_method:u}),jwt:l.access_token,xform:i1});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(oa(s))return{data:{user:null},error:s};throw s}}async setSession(t){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._setSession(t))}async _setSession(t){try{if(!t.access_token||!t.refresh_token)throw new tm;const n=Date.now()/1e3;let s=n,a=!0,o=null;const{payload:l}=Mce(t.access_token);if(l.exp&&(s=l.exp,a=s<=n),a){const{data:i,error:u}=await this._callRefreshToken(t.refresh_token);if(u)return{data:{user:null,session:null},error:u};if(!i)return{data:{user:null,session:null},error:null};o=i}else{const{data:i,error:u}=await this._getUser(t.access_token);if(u)throw u;o={access_token:t.access_token,refresh_token:t.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(oa(n))return{data:{session:null,user:null},error:n};throw n}}async refreshSession(t){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._refreshSession(t))}async _refreshSession(t){try{return await this._useSession(async n=>{var s;if(!t){const{data:l,error:i}=n;if(i)throw i;t=(s=l.session)!==null&&s!==void 0?s:void 0}if(!(t!=null&&t.refresh_token))throw new tm;const{data:a,error:o}=await this._callRefreshToken(t.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(oa(n))return{data:{user:null,session:null},error:n};throw n}}async _getSessionFromURL(t,n){try{if(!Bu())throw new JL("No browser detected.");if(t.error||t.error_description||t.error_code)throw new JL(t.error_description||"Error in URL with unspecified error_description",{error:t.error||"unspecified_error",code:t.error_code||"unspecified_code"});switch(n){case"implicit":if(this.flowType==="pkce")throw new vke("Not a valid PKCE flow url.");break;case"pkce":if(this.flowType==="implicit")throw new JL("Not a valid implicit grant flow url.");break;default:}if(n==="pkce"){if(this._debug("#_initialize()","begin","is PKCE flow",!0),!t.code)throw new vke("No code detected.");const{data:T,error:I}=await this._exchangeCodeForSession(t.code);if(I)throw I;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:u,token_type:p}=t;if(!o||!i||!l||!p)throw new JL("No session defined in URL");const x=Math.round(Date.now()/1e3),y=parseInt(i);let _=x+y;u&&(_=parseInt(u));const b=_-x;b*1e3<=D4&&console.warn(`@supabase/gotrue-js: Session as retrieved from URL expires in ${b}s, should have been closer to ${y}s`);const S=_-y;x-S>=120?console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued over 120s ago, URL could be stale",S,_,x):x-S<0&&console.warn("@supabase/gotrue-js: Session as retrieved from URL was issued in the future? Check the device clock for skew",S,_,x);const{data:k,error:M}=await this._getUser(o);if(M)throw M;const P={provider_token:s,provider_refresh_token:a,access_token:o,expires_in:y,expires_at:_,refresh_token:l,token_type:p,user:k.user};return window.location.hash="",this._debug("#_getSessionFromURL()","clearing window.location.hash"),{data:{session:P,redirectType:t.type},error:null}}catch(s){if(oa(s))return{data:{session:null,redirectType:null},error:s};throw s}}_isImplicitGrantCallback(t){return!!(t.access_token||t.error_description)}async _isPKCECallback(t){const n=await k_(this.storage,`${this.storageKey}-code-verifier`);return!!(t.code&&n)}async signOut(t={scope:"global"}){return await this.initializePromise,await this._acquireLock(-1,async()=>await this._signOut(t))}async _signOut({scope:t}={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,t);if(i&&!(Ast(i)&&(i.status===404||i.status===401||i.status===403)))return{error:i}}return t!=="others"&&(await this._removeSession(),await O0(this.storage,`${this.storageKey}-code-verifier`)),{error:null}})}onAuthStateChange(t){const n=zst(),s={id:n,callback:t,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(t){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(t))===null||s===void 0?void 0:s.callback("INITIAL_SESSION",o)),this._debug("INITIAL_SESSION","callback id",t,"session",o)}catch(o){await((a=this.stateChangeEmitters.get(t))===null||a===void 0?void 0:a.callback("INITIAL_SESSION",null)),this._debug("INITIAL_SESSION","callback id",t,"error",o),console.error(o)}})}async resetPasswordForEmail(t,n={}){let s=null,a=null;this.flowType==="pkce"&&([s,a]=await y4(this.storage,this.storageKey,!0));try{return await Fa(this.fetch,"POST",`${this.url}/recover`,{body:{email:t,code_challenge:s,code_challenge_method:a,gotrue_meta_security:{captcha_token:n.captchaToken}},headers:this.headers,redirectTo:n.redirectTo})}catch(o){if(oa(o))return{data:null,error:o};throw o}}async getUserIdentities(){var t;try{const{data:n,error:s}=await this.getUser();if(s)throw s;return{data:{identities:(t=n.user.identities)!==null&&t!==void 0?t:[]},error:null}}catch(n){if(oa(n))return{data:null,error:n};throw n}}async linkIdentity(t){return"token"in t?this.linkIdentityIdToken(t):this.linkIdentityOAuth(t)}async linkIdentityOAuth(t){var n;try{const{data:s,error:a}=await this._useSession(async o=>{var l,i,u,p,x;const{data:y,error:_}=o;if(_)throw _;const b=await this._getUrlForProvider(`${this.url}/user/identities/authorize`,t.provider,{redirectTo:(l=t.options)===null||l===void 0?void 0:l.redirectTo,scopes:(i=t.options)===null||i===void 0?void 0:i.scopes,queryParams:(u=t.options)===null||u===void 0?void 0:u.queryParams,skipBrowserRedirect:!0});return await Fa(this.fetch,"GET",b,{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 Bu()&&!(!((n=t.options)===null||n===void 0)&&n.skipBrowserRedirect)&&window.location.assign(s==null?void 0:s.url),{data:{provider:t.provider,url:s==null?void 0:s.url},error:null}}catch(s){if(oa(s))return{data:{provider:t.provider,url:null},error:s};throw s}}async linkIdentityIdToken(t){return await this._useSession(async n=>{var s;try{const{error:a,data:{session:o}}=n;if(a)throw a;const{options:l,provider:i,token:u,access_token:p,nonce:x}=t,y=await Fa(this.fetch,"POST",`${this.url}/token?grant_type=id_token`,{headers:this.headers,jwt:(s=o==null?void 0:o.access_token)!==null&&s!==void 0?s:void 0,body:{provider:i,id_token:u,access_token:p,nonce:x,link_identity:!0,gotrue_meta_security:{captcha_token:l==null?void 0:l.captchaToken}},xform:rm}),{data:_,error:b}=y;return b?{data:{user:null,session:null},error:b}:!_||!_.session||!_.user?{data:{user:null,session:null},error:new x4}:(_.session&&(await this._saveSession(_.session),await this._notifyAllSubscribers("USER_UPDATED",_.session)),{data:_,error:b})}catch(a){if(oa(a))return{data:{user:null,session:null},error:a};throw a}})}async unlinkIdentity(t){try{return await this._useSession(async n=>{var s,a;const{data:o,error:l}=n;if(l)throw l;return await Fa(this.fetch,"DELETE",`${this.url}/user/identities/${t.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(oa(n))return{data:null,error:n};throw n}}async _refreshAccessToken(t){const n=`#_refreshAccessToken(${t.substring(0,5)}...)`;this._debug(n,"begin");try{const s=Date.now();return await qst(async a=>(a>0&&await Ust(200*Math.pow(2,a-1)),this._debug(n,"refreshing attempt",a),await Fa(this.fetch,"POST",`${this.url}/token?grant_type=refresh_token`,{body:{refresh_token:t},headers:this.headers,xform:rm})),(a,o)=>{const l=200*Math.pow(2,a);return o&&Cce(o)&&Date.now()+l-s{try{await i.callback(t,n)}catch(u){o.push(u)}});if(await Promise.all(l),o.length>0){for(let i=0;ithis._autoRefreshTokenTick(),D4);this.autoRefreshTicker=t,t&&typeof t=="object"&&typeof t.unref=="function"?t.unref():typeof Deno<"u"&&typeof Deno.unrefTimer=="function"&&Deno.unrefTimer(t),setTimeout(async()=>{await this.initializePromise,await this._autoRefreshTokenTick()},0)}async _stopAutoRefresh(){this._debug("#_stopAutoRefresh()");const t=this.autoRefreshTicker;this.autoRefreshTicker=null,t&&clearInterval(t)}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 t=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-t)/D4);this._debug("#_autoRefreshTokenTick()",`access token expires in ${a} ticks, a tick lasts ${D4}ms, refresh threshold is ${Qhe} ticks`),a<=Qhe&&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(t){if(t.isAcquireTimeout||t instanceof W6e)this._debug("auto refresh token tick lock not available");else throw t}}async _handleVisibilityChange(){if(this._debug("#_handleVisibilityChange()"),!Bu()||!(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(t){console.error("_handleVisibilityChange",t)}}async _onVisibilityChanged(t){const n=`#_onVisibilityChanged(${t})`;this._debug(n,"visibilityState",document.visibilityState),document.visibilityState==="visible"?(this.autoRefreshToken&&this._startAutoRefresh(),t||(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(t,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 y4(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}`),`${t}?${a.join("&")}`}async _unenroll(t){try{return await this._useSession(async n=>{var s;const{data:a,error:o}=n;return o?{data:null,error:o}:await Fa(this.fetch,"DELETE",`${this.url}/factors/${t.factorId}`,{headers:this.headers,jwt:(s=a==null?void 0:a.session)===null||s===void 0?void 0:s.access_token})})}catch(n){if(oa(n))return{data:null,error:n};throw n}}async _enroll(t){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:t.friendlyName,factor_type:t.factorType},t.factorType==="phone"?{phone:t.phone}:t.factorType==="totp"?{issuer:t.issuer}:{}),{data:u,error:p}=await Fa(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}:(t.factorType==="totp"&&u.type==="totp"&&(!((a=u==null?void 0:u.totp)===null||a===void 0)&&a.qr_code)&&(u.totp.qr_code=`data:image/svg+xml;utf-8,${u.totp.qr_code}`),{data:u,error:null})})}catch(n){if(oa(n))return{data:null,error:n};throw n}}async _verify(t){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:t.challengeId},"webauthn"in t?{webauthn:Object.assign(Object.assign({},t.webauthn),{credential_response:t.webauthn.type==="create"?vat(t.webauthn.credential_response):_at(t.webauthn.credential_response)})}:{code:t.code}),{data:i,error:u}=await Fa(this.fetch,"POST",`${this.url}/factors/${t.factorId}/verify`,{body:l,headers:this.headers,jwt:(s=a==null?void 0:a.session)===null||s===void 0?void 0:s.access_token});return u?{data:null,error:u}:(await this._saveSession(Object.assign({expires_at:Math.round(Date.now()/1e3)+i.expires_in},i)),await this._notifyAllSubscribers("MFA_CHALLENGE_VERIFIED",i),{data:i,error:u})})}catch(n){if(oa(n))return{data:null,error:n};throw n}})}async _challenge(t){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 Fa(this.fetch,"POST",`${this.url}/factors/${t.factorId}/challenge`,{body:t,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:xat(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:yat(i.webauthn.credential_options.publicKey)})})}),error:null}}})}catch(n){if(oa(n))return{data:null,error:n};throw n}})}async _challengeAndVerify(t){const{data:n,error:s}=await this._challenge({factorId:t.factorId});return s?{data:null,error:s}:await this._verify({factorId:t.factorId,challengeId:n.id,code:t.code})}async _listFactors(){var t;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(t=n==null?void 0:n.factors)!==null&&t!==void 0?t:[])a.all.push(o),o.status==="verified"&&a[o.factor_type].push(o);return{data:a,error:null}}async _getAuthenticatorAssuranceLevel(){var t,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}=Mce(s.access_token);let l=null;o.aal&&(l=o.aal);let i=l;((n=(t=s.user.factors)===null||t===void 0?void 0:t.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(t){try{return await this._useSession(async n=>{const{data:{session:s},error:a}=n;return a?{data:null,error:a}:s?await Fa(this.fetch,"GET",`${this.url}/oauth/authorizations/${t}`,{headers:this.headers,jwt:s.access_token,xform:o=>({data:o,error:null})}):{data:null,error:new tm}})}catch(n){if(oa(n))return{data:null,error:n};throw n}}async _approveAuthorization(t,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 tm};const l=await Fa(this.fetch,"POST",`${this.url}/oauth/authorizations/${t}/consent`,{headers:this.headers,jwt:a.access_token,body:{action:"approve"},xform:i=>({data:i,error:null})});return l.data&&l.data.redirect_url&&Bu()&&!(n!=null&&n.skipBrowserRedirect)&&window.location.assign(l.data.redirect_url),l})}catch(s){if(oa(s))return{data:null,error:s};throw s}}async _denyAuthorization(t,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 tm};const l=await Fa(this.fetch,"POST",`${this.url}/oauth/authorizations/${t}/consent`,{headers:this.headers,jwt:a.access_token,body:{action:"deny"},xform:i=>({data:i,error:null})});return l.data&&l.data.redirect_url&&Bu()&&!(n!=null&&n.skipBrowserRedirect)&&window.location.assign(l.data.redirect_url),l})}catch(s){if(oa(s))return{data:null,error:s};throw s}}async fetchJwk(t,n={keys:[]}){let s=n.keys.find(i=>i.kid===t);if(s)return s;const a=Date.now();if(s=this.jwks.keys.find(i=>i.kid===t),s&&this.jwks_cached_at+Mst>a)return s;const{data:o,error:l}=await Fa(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===t),!s)?null:s}async getClaims(t,n={}){try{let s=t;if(!s){const{data:b,error:S}=await this.getSession();if(S||!b.session)return{data:null,error:S};s=b.session.access_token}const{header:a,payload:o,signature:l,raw:{header:i,payload:u}}=Mce(s);n!=null&&n.allowExpired||Yst(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:b}=await this.getUser(s);if(b)throw b;return{data:{claims:o,header:a,signature:l},error:null}}const x=Xst(a.alg),y=await crypto.subtle.importKey("jwk",p,x,!0,["verify"]);if(!await crypto.subtle.verify(x,y,l,Rst(`${i}.${u}`)))throw new tfe("Invalid JWT signature");return{data:{claims:o,header:a,signature:l},error:null}}catch(s){if(oa(s))return{data:null,error:s};throw s}}}ME.nextInstanceID=0;const Tat=ME;class Aat extends Tat{constructor(t){super(t)}}class Eat{constructor(t,n,s){var a,o,l;this.supabaseUrl=t,this.supabaseKey=n;const i=jst(t);if(!n)throw new Error("supabaseKey is required.");this.realtimeUrl=new URL("realtime/v1",i),this.realtimeUrl.protocol=this.realtimeUrl.protocol.replace("http","ws"),this.authUrl=new URL("auth/v1",i),this.storageUrl=new URL("storage/v1",i),this.functionsUrl=new URL("functions/v1",i);const u=`sb-${i.hostname.split(".")[0]}-auth-token`,p={db:mst,realtime:xst,auth:Object.assign(Object.assign({},gst),{storageKey:u}),global:pst},x=wst(s??{},p);this.storageKey=(a=x.auth.storageKey)!==null&&a!==void 0?a:"",this.headers=(o=x.global.headers)!==null&&o!==void 0?o:{},x.accessToken?(this.accessToken=x.accessToken,this.auth=new Proxy({},{get:(y,_)=>{throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(_)} is not possible`)}})):this.auth=this._initSupabaseAuthClient((l=x.auth)!==null&&l!==void 0?l:{},this.headers,x.global.fetch),this.fetch=_st(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 knt(new URL("rest/v1",i).href,{headers:this.headers,schema:x.db.schema,fetch:this.fetch}),this.storage=new ust(this.storageUrl.href,this.headers,this.fetch,s==null?void 0:s.storage),x.accessToken||this._listenForAuthEvents()}get functions(){return new gnt(this.functionsUrl.href,{headers:this.headers,customFetch:this.fetch})}from(t){return this.rest.from(t)}schema(t){return this.rest.schema(t)}rpc(t,n={},s={head:!1,get:!1,count:void 0}){return this.rest.rpc(t,n,s)}channel(t,n={config:{}}){return this.realtime.channel(t,n)}getChannels(){return this.realtime.getChannels()}removeChannel(t){return this.realtime.removeChannel(t)}removeAllChannels(){return this.realtime.removeAllChannels()}async _getAccessToken(){var t,n;if(this.accessToken)return await this.accessToken();const{data:s}=await this.auth.getSession();return(n=(t=s.session)===null||t===void 0?void 0:t.access_token)!==null&&n!==void 0?n:this.supabaseKey}_initSupabaseAuthClient({autoRefreshToken:t,persistSession:n,detectSessionInUrl:s,storage:a,userStorage:o,storageKey:l,flowType:i,lock:u,debug:p},x,y){const _={Authorization:`Bearer ${this.supabaseKey}`,apikey:`${this.supabaseKey}`};return new Aat({url:this.authUrl.href,headers:Object.assign(Object.assign({},_),x),storageKey:l,autoRefreshToken:t,persistSession:n,detectSessionInUrl:s,storage:a,userStorage:o,flowType:i,lock:u,debug:p,fetch:y,hasCustomAuthorizationHeader:Object.keys(this.headers).some(b=>b.toLowerCase()==="authorization")})}_initRealtimeClient(t){return new $nt(this.realtimeUrl.href,Object.assign(Object.assign({},t),{params:Object.assign({apikey:this.supabaseKey},t==null?void 0:t.params)}))}_listenForAuthEvents(){return this.auth.onAuthStateChange((n,s)=>{this._handleTokenChanged(n,"CLIENT",s==null?void 0:s.access_token)})}_handleTokenChanged(t,n,s){(t==="TOKEN_REFRESHED"||t==="SIGNED_IN")&&this.changedAccessToken!==s?(this.changedAccessToken=s,this.realtime.setAuth(s)):t==="SIGNED_OUT"&&(this.realtime.setAuth(),n=="STORAGE"&&this.auth.signOut(),this.changedAccessToken=void 0)}}const Iat=(e,t,n)=>new Eat(e,t,n);function Pat(){if(typeof window<"u"||typeof process>"u")return!1;const e=process.version;if(e==null)return!1;const t=e.match(/^v(\d+)\./);return t?parseInt(t[1],10)<=18:!1}Pat()&&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 Lat="https://relzejiswnotikjgvjhz.supabase.co",Oat="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InJlbHplamlzd25vdGlramd2amh6Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3NjE5NTAzNDQsImV4cCI6MjA3NzUyNjM0NH0.dzIkIr_oFSbFE3oWS0ktIr83iKHHkZxt40Gc7SpC_mM",Q=Iat(Lat,Oat,{auth:{storage:localStorage,persistSession:!0,autoRefreshToken:!0}}),Z6e=E.createContext(void 0),Dat=({children:e})=>{const[t,n]=E.useState(null),[s,a]=E.useState(null),[o,l]=E.useState(!0),[i,u]=E.useState(!1),[p,x]=E.useState(!1),[y,_]=E.useState(null),[b,S]=E.useState([]),[k,M]=E.useState(null),P=Gn(),T=async U=>{try{console.log("Checking roles via RPC for user:",U);const[{data:V,error:W},{data:G,error:J}]=await Promise.all([Q.rpc("has_role",{_user_id:U,_role:"admin"}),Q.rpc("has_role",{_user_id:U,_role:"brokerage_manager"})]);if(W||J)console.error("Role RPC errors:",{isAdminError:W,isBrokerError:J}),u(!1),x(!1);else{const ge=!!V,ie=!!G;console.log("RPC roles result:",{adminValue:ge,brokerValue:ie}),u(ge),x(ie)}const{data:ne,error:oe}=await Q.from("profiles").select("brokerage_id").eq("id",U).single();if(_(!oe&&ne?ne.brokerage_id:null),G){console.log("Fetching managed brokerages for user:",U);const{data:ge,error:ie}=await Q.from("brokerage_manager_assignments").select("brokerage_id").eq("user_id",U);if(console.log("Managed brokerage assignments result:",{assignments:ge,assignmentsError:ie}),ie||!ge){console.error("Error fetching managed brokerage assignments:",ie),S([]);return}const pe=Array.from(new Set(ge.map(ye=>ye.brokerage_id).filter(Boolean)));if(pe.length===0){S([]);return}const{data:se,error:fe}=await Q.from("brokerages").select("id, name").in("id",pe);if(console.log("Managed brokerages details result:",{brokeragesData:se,brokeragesError:fe}),fe||!se){console.error("Error fetching managed brokerages details:",fe),S([]);return}const he=se.map(ye=>({id:ye.id,name:ye.name})).sort((ye,Ae)=>pe.indexOf(ye.id)-pe.indexOf(Ae.id));console.log("Parsed managed brokerages:",he),S(he),he.length>0&&!k&&M(he[0].id)}else console.log("User is not a brokerage manager, skipping managed brokerages fetch"),S([])}catch(V){console.error("Unexpected error in checkRoles:",V),u(!1),x(!1),_(null),S([])}};E.useEffect(()=>{const{data:{subscription:U}}=Q.auth.onAuthStateChange((V,W)=>{console.log("Auth event:",V),a(W),n((W==null?void 0:W.user)??null),V==="PASSWORD_RECOVERY"&&(console.log("Password recovery detected, redirecting to profile"),setTimeout(()=>{P("/profile?reset=true")},100)),W!=null&&W.user?setTimeout(()=>{T(W.user.id)},0):(u(!1),x(!1),_(null),S([]),M(null))});return Q.auth.getSession().then(({data:{session:V}})=>{a(V),n((V==null?void 0:V.user)??null),V!=null&&V.user?T(V.user.id).finally(()=>{l(!1)}):l(!1)}),()=>U.unsubscribe()},[]);const I=async(U,V)=>{const{error:W}=await Q.auth.signInWithPassword({email:U,password:V});if(W)throw Ie.error(W.message),W;Ie.success("Welcome back!"),P("/dashboard")},z=async(U,V,W)=>{const G=`${window.location.origin}/dashboard`,{error:J}=await Q.auth.signUp({email:U,password:V,options:{emailRedirectTo:G,data:{name:W}}});if(J)throw Ie.error(J.message),J;Ie.success("Account created! Welcome to LevelUp."),P("/dashboard")},D=async()=>{try{const{data:{session:U}}=await Q.auth.getSession();if(U){const{error:V}=await Q.auth.signOut();V?V.message==="Auth session missing!"?console.warn("Sign out warning (ignored):",V.message):(console.error("Sign out error:",V),Ie.error(V.message)):Ie.success("Signed out successfully")}else console.log("No active session found, redirecting to auth");n(null),a(null),u(!1),x(!1),_(null),S([]),M(null),P("/auth")}catch(U){console.error("Unexpected sign out error:",U),P("/auth")}};return r.jsx(Z6e.Provider,{value:{user:t,session:s,loading:o,signIn:I,signUp:z,signOut:D,isAdmin:i,isBrokerageManager:p,brokerageId:y,managedBrokerages:b,selectedBrokerageId:k,setSelectedBrokerageId:M},children:e})},tn=()=>{const e=E.useContext(Z6e);if(e===void 0)throw new Error("useAuth must be used within an AuthProvider");return e},Y6e=E.createContext(void 0),N_="levelup_admin_session",D0="levelup_impersonation",Rat=({children:e})=>{const[t,n]=E.useState(!1),[s,a]=E.useState(null),[o,l]=E.useState(!1);E.useEffect(()=>{const p=sessionStorage.getItem(D0);if(p)try{const x=JSON.parse(p);n(!0),a(x)}catch{sessionStorage.removeItem(D0)}},[]);const i=async p=>{l(!0);try{const{data:{session:x}}=await Q.auth.getSession();if(!x)return Ie.error("No active session found"),!1;const y={access_token:x.access_token,refresh_token:x.refresh_token};sessionStorage.setItem(N_,JSON.stringify(y));const _=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/impersonate-user",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${x.access_token}`},body:JSON.stringify({targetUserId:p})}),b=await _.json();if(!_.ok)throw new Error(b.error||"Failed to impersonate user");const S={id:b.targetUser.id,name:b.targetUser.name,email:b.targetUser.email};if(sessionStorage.setItem(D0,JSON.stringify(S)),b.method==="session"){const{error:k}=await Q.auth.setSession({access_token:b.access_token,refresh_token:b.refresh_token});if(k)throw console.error("Set session error:",k),sessionStorage.removeItem(N_),sessionStorage.removeItem(D0),new Error("Failed to establish impersonation session")}else{const k=b.type||"recovery",{error:M}=await Q.auth.verifyOtp({token_hash:b.token_hash,type:k});if(M)throw console.error("Verify OTP error:",M),sessionStorage.removeItem(N_),sessionStorage.removeItem(D0),new Error("Failed to establish impersonation session")}return n(!0),a(S),Ie.success(`Now viewing as ${S.name}`),window.location.href="/dashboard",!0}catch(x){return console.error("Impersonation error:",x),Ie.error(x.message||"Failed to impersonate user"),sessionStorage.removeItem(N_),sessionStorage.removeItem(D0),!1}finally{l(!1)}},u=async()=>{l(!0);try{const p=sessionStorage.getItem(N_);if(!p){await Q.auth.signOut(),window.location.href="/auth";return}const x=JSON.parse(p);await Q.auth.signOut();const{error:y}=await Q.auth.setSession({access_token:x.access_token,refresh_token:x.refresh_token});if(sessionStorage.removeItem(N_),sessionStorage.removeItem(D0),y){console.error("Failed to restore admin session:",y),Ie.error("Admin session expired, please sign in again"),window.location.href="/auth";return}n(!1),a(null),Ie.success("Returned to admin account"),window.location.href="/admin/members"}catch(p){console.error("Stop impersonation error:",p),Ie.error("Failed to restore admin session"),sessionStorage.removeItem(N_),sessionStorage.removeItem(D0),window.location.href="/auth"}finally{l(!1)}};return r.jsx(Y6e.Provider,{value:{isImpersonating:t,impersonatedUser:s,startImpersonation:i,stopImpersonation:u,isLoading:o},children:e})},Pxe=()=>{const e=E.useContext(Y6e);if(e===void 0)throw new Error("useImpersonation must be used within an ImpersonationProvider");return e},TE=g3("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=E.forwardRef(({className:e,variant:t,size:n,asChild:s=!1,...a},o)=>{const l=s?Qge:"button";return r.jsx(l,{className:Bt(TE({variant:t,size:n,className:e})),ref:o,...a})});ee.displayName="Button";const Fat=()=>{const{isImpersonating:e,impersonatedUser:t,stopImpersonation:n,isLoading:s}=Pxe();return!e||!t?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(rf,{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:t.name}),r.jsxs("span",{className:"hidden md:inline text-amber-800",children:[" (",t.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(Zr,{className:"h-4 w-4 animate-spin"}):r.jsxs(r.Fragment,{children:[r.jsx(hs,{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"})]})})]})})},X6e=E.createContext(void 0),nT="levelup_acting_as",zat=({children:e})=>{const{user:t}=tn(),[n,s]=E.useState(!1),[a,o]=E.useState([]),[l,i]=E.useState(null),[u,p]=E.useState({}),[x,y]=E.useState(!0);E.useEffect(()=>{if(!(t!=null&&t.id)){s(!1),o([]),i(null),p({}),y(!1);return}(async()=>{y(!0);try{const{data:M}=await Q.rpc("has_role",{_user_id:t.id,_role:"assistant"});if(!M){s(!1),o([]),i(null),p({}),y(!1);return}s(!0);const{data:P,error:T}=await Q.from("agent_assistant_assignments").select("agent_id, permissions").eq("assistant_id",t.id);if(T||!P||P.length===0){o([]),y(!1);return}const I=P.map(V=>V.agent_id),{data:z}=await Q.from("profiles").select("id, name, email, avatar_url").in("id",I),D=(z||[]).map(V=>({id:V.id,name:V.name||V.email||"Unknown",email:V.email||"",avatar_url:V.avatar_url}));o(D);const U=sessionStorage.getItem(nT);if(U){const V=D.find(W=>W.id===U);if(V){i(V);const W=P.find(G=>G.agent_id===U);p((W==null?void 0:W.permissions)||{})}else if(D.length>0){i(D[0]);const W=P.find(G=>G.agent_id===D[0].id);p((W==null?void 0:W.permissions)||{}),sessionStorage.setItem(nT,D[0].id)}}else if(D.length>0){i(D[0]);const V=P.find(W=>W.agent_id===D[0].id);p((V==null?void 0:V.permissions)||{}),sessionStorage.setItem(nT,D[0].id)}}catch(M){console.error("Error loading assistant data:",M)}finally{y(!1)}})()},[t==null?void 0:t.id]);const _=k=>{i(k),k?(sessionStorage.setItem(nT,k.id),Q.from("agent_assistant_assignments").select("permissions").eq("assistant_id",(t==null?void 0:t.id)||"").eq("agent_id",k.id).single().then(({data:M})=>{p((M==null?void 0:M.permissions)||{})})):(sessionStorage.removeItem(nT),p({}))},b=k=>n?u[k]===!0:!0,S=n&&l?l.id:(t==null?void 0:t.id)||null;return r.jsx(X6e.Provider,{value:{isAssistant:n,assignedAgents:a,actingAsAgent:l,setActingAsAgent:_,effectiveUserId:S,permissions:u,hasPermission:b,isLoading:x},children:e})},Lxe=()=>{const e=E.useContext(X6e);if(e===void 0)throw new Error("useActingAs must be used within an ActingAsProvider");return e},Kc=()=>{const{effectiveUserId:e}=Lxe();return e};var Q6e={exports:{}},J6e={};/** * @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 MC=E;function Bat(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var $at=typeof Object.is=="function"?Object.is:Bat,Uat=MC.useState,qat=MC.useEffect,Vat=MC.useLayoutEffect,Hat=MC.useDebugValue;function Wat(e,t){var n=t(),s=Uat({inst:{value:n,getSnapshot:t}}),a=s[0].inst,o=s[1];return Vat(function(){a.value=n,a.getSnapshot=t,Ece(a)&&o({inst:a})},[e,n,t]),qat(function(){return Ece(a)&&o({inst:a}),e(function(){Ece(a)&&o({inst:a})})},[e]),Hat(n),n}function Ece(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!$at(e,n)}catch{return!0}}function Gat(e,t){return t()}var Kat=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?Gat:Wat;J6e.useSyncExternalStore=MC.useSyncExternalStore!==void 0?MC.useSyncExternalStore:Kat;Q6e.exports=J6e;var Zat=Q6e.exports;function Yat(){return Zat.useSyncExternalStore(Xat,()=>!0,()=>!1)}function Xat(){return()=>{}}var Oxe="Avatar",[Qat]=cc(Oxe),[Jat,eLe]=Qat(Oxe),tLe=E.forwardRef((e,t)=>{const{__scopeAvatar:n,...s}=e,[a,o]=E.useState("idle");return r.jsx(Jat,{scope:n,imageLoadingStatus:a,onImageLoadingStatusChange:o,children:r.jsx(Fn.span,{...s,ref:t})})});tLe.displayName=Oxe;var rLe="AvatarImage",nLe=E.forwardRef((e,t)=>{const{__scopeAvatar:n,src:s,onLoadingStatusChange:a=()=>{},...o}=e,l=eLe(rLe,n),i=eit(s,o),u=sc(p=>{a(p),l.onImageLoadingStatusChange(p)});return oc(()=>{i!=="idle"&&u(i)},[i,u]),i==="loaded"?r.jsx(Fn.img,{...o,ref:t,src:s}):null});nLe.displayName=rLe;var sLe="AvatarFallback",aLe=E.forwardRef((e,t)=>{const{__scopeAvatar:n,delayMs:s,...a}=e,o=eLe(sLe,n),[l,i]=E.useState(s===void 0);return E.useEffect(()=>{if(s!==void 0){const u=window.setTimeout(()=>i(!0),s);return()=>window.clearTimeout(u)}},[s]),l&&o.imageLoadingStatus!=="loaded"?r.jsx(Fn.span,{...a,ref:t}):null});aLe.displayName=sLe;function Eke(e,t){return e?t?(e.src!==t&&(e.src=t),e.complete&&e.naturalWidth>0?"loaded":"loading"):"error":"idle"}function eit(e,{referrerPolicy:t,crossOrigin:n}){const s=Yat(),a=E.useRef(null),o=s?(a.current||(a.current=new window.Image),a.current):null,[l,i]=E.useState(()=>Eke(o,e));return oc(()=>{i(Eke(o,e))},[o,e]),oc(()=>{const u=y=>()=>{i(y)};if(!o)return;const p=u("loaded"),x=u("error");return o.addEventListener("load",p),o.addEventListener("error",x),t&&(o.referrerPolicy=t),typeof n=="string"&&(o.crossOrigin=n),()=>{o.removeEventListener("load",p),o.removeEventListener("error",x)}},[o,n,t]),l}var iLe=tLe,oLe=nLe,lLe=aLe;const Qs=E.forwardRef(({className:e,...t},n)=>r.jsx(iLe,{ref:n,className:Bt("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",e),...t}));Qs.displayName=iLe.displayName;const Si=E.forwardRef(({className:e,...t},n)=>r.jsx(oLe,{ref:n,className:Bt("aspect-square h-full w-full",e),...t}));Si.displayName=oLe.displayName;const Js=E.forwardRef(({className:e,...t},n)=>r.jsx(lLe,{ref:n,className:Bt("flex h-full w-full items-center justify-center rounded-full bg-muted",e),...t}));Js.displayName=lLe.displayName;const tit=g3("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 Pt({className:e,variant:t,...n}){return r.jsx("div",{className:Bt(tit({variant:t}),e),...n})}var rit=E.createContext(void 0);function Sk(e){const t=E.useContext(rit);return e||t||"ltr"}var Ice=0;function Cse(){E.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??Ike()),document.body.insertAdjacentElement("beforeend",e[1]??Ike()),Ice++,()=>{Ice===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),Ice--}},[])}function Ike(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var Pce="focusScope.autoFocusOnMount",Lce="focusScope.autoFocusOnUnmount",Pke={bubbles:!1,cancelable:!0},nit="FocusScope",QI=E.forwardRef((e,t)=>{const{loop:n=!1,trapped:s=!1,onMountAutoFocus:a,onUnmountAutoFocus:o,...l}=e,[i,u]=E.useState(null),p=sc(a),x=sc(o),y=E.useRef(null),_=la(t,k=>u(k)),b=E.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;E.useEffect(()=>{if(s){let k=function(I){if(b.paused||!i)return;const z=I.target;i.contains(z)?y.current=z:B0(y.current,{select:!0})},M=function(I){if(b.paused||!i)return;const z=I.relatedTarget;z!==null&&(i.contains(z)||B0(y.current,{select:!0}))},P=function(I){if(document.activeElement===document.body)for(const D of I)D.removedNodes.length>0&&B0(i)};document.addEventListener("focusin",k),document.addEventListener("focusout",M);const T=new MutationObserver(P);return i&&T.observe(i,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",k),document.removeEventListener("focusout",M),T.disconnect()}}},[s,i,b.paused]),E.useEffect(()=>{if(i){Oke.add(b);const k=document.activeElement;if(!i.contains(k)){const P=new CustomEvent(Pce,Pke);i.addEventListener(Pce,p),i.dispatchEvent(P),P.defaultPrevented||(sit(cit(cLe(i)),{select:!0}),document.activeElement===k&&B0(i))}return()=>{i.removeEventListener(Pce,p),setTimeout(()=>{const P=new CustomEvent(Lce,Pke);i.addEventListener(Lce,x),i.dispatchEvent(P),P.defaultPrevented||B0(k??document.body,{select:!0}),i.removeEventListener(Lce,x),Oke.remove(b)},0)}}},[i,p,x,b]);const S=E.useCallback(k=>{if(!n&&!s||b.paused)return;const M=k.key==="Tab"&&!k.altKey&&!k.ctrlKey&&!k.metaKey,P=document.activeElement;if(M&&P){const T=k.currentTarget,[I,z]=ait(T);I&&z?!k.shiftKey&&P===z?(k.preventDefault(),n&&B0(I,{select:!0})):k.shiftKey&&P===I&&(k.preventDefault(),n&&B0(z,{select:!0})):P===T&&k.preventDefault()}},[n,s,b.paused]);return r.jsx(Fn.div,{tabIndex:-1,...l,ref:_,onKeyDown:S})});QI.displayName=nit;function sit(e,{select:t=!1}={}){const n=document.activeElement;for(const s of e)if(B0(s,{select:t}),document.activeElement!==n)return}function ait(e){const t=cLe(e),n=Lke(t,e),s=Lke(t.reverse(),e);return[n,s]}function cLe(e){const t=[],n=document.createTreeWalker(e,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();)t.push(n.currentNode);return t}function Lke(e,t){for(const n of e)if(!iit(n,{upTo:t}))return n}function iit(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function oit(e){return e instanceof HTMLInputElement&&"select"in e}function B0(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&oit(e)&&t&&e.select()}}var Oke=lit();function lit(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=Dke(e,t),e.unshift(t)},remove(t){var n;e=Dke(e,t),(n=e[0])==null||n.resume()}}}function Dke(e,t){const n=[...e],s=n.indexOf(t);return s!==-1&&n.splice(s,1),n}function cit(e){return e.filter(t=>t.tagName!=="A")}var Oce="rovingFocusGroup.onEntryFocus",dit={bubbles:!1,cancelable:!0},JI="RovingFocusGroup",[rfe,dLe,uit]=qI(JI),[hit,C3]=cc(JI,[uit]),[fit,pit]=hit(JI),uLe=E.forwardRef((e,t)=>r.jsx(rfe.Provider,{scope:e.__scopeRovingFocusGroup,children:r.jsx(rfe.Slot,{scope:e.__scopeRovingFocusGroup,children:r.jsx(mit,{...e,ref:t})})}));uLe.displayName=JI;var mit=E.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:s,loop:a=!1,dir:o,currentTabStopId:l,defaultCurrentTabStopId:i,onCurrentTabStopIdChange:u,onEntryFocus:p,preventScrollOnEntryFocus:x=!1,...y}=e,_=E.useRef(null),b=la(t,_),S=Sk(o),[k,M]=Ju({prop:l,defaultProp:i??null,onChange:u,caller:JI}),[P,T]=E.useState(!1),I=sc(p),z=dLe(n),D=E.useRef(!1),[U,V]=E.useState(0);return E.useEffect(()=>{const W=_.current;if(W)return W.addEventListener(Oce,I),()=>W.removeEventListener(Oce,I)},[I]),r.jsx(fit,{scope:n,orientation:s,dir:S,loop:a,currentTabStopId:k,onItemFocus:E.useCallback(W=>M(W),[M]),onItemShiftTab:E.useCallback(()=>T(!0),[]),onFocusableItemAdd:E.useCallback(()=>V(W=>W+1),[]),onFocusableItemRemove:E.useCallback(()=>V(W=>W-1),[]),children:r.jsx(Fn.div,{tabIndex:P||U===0?-1:0,"data-orientation":s,...y,ref:b,style:{outline:"none",...e.style},onMouseDown:un(e.onMouseDown,()=>{D.current=!0}),onFocus:un(e.onFocus,W=>{const G=!D.current;if(W.target===W.currentTarget&&G&&!P){const J=new CustomEvent(Oce,dit);if(W.currentTarget.dispatchEvent(J),!J.defaultPrevented){const ne=z().filter(se=>se.focusable),oe=ne.find(se=>se.active),ge=ne.find(se=>se.id===k),pe=[oe,ge,...ne].filter(Boolean).map(se=>se.ref.current);pLe(pe,x)}}D.current=!1}),onBlur:un(e.onBlur,()=>T(!1))})})}),hLe="RovingFocusGroupItem",fLe=E.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:s=!0,active:a=!1,tabStopId:o,children:l,...i}=e,u=fd(),p=o||u,x=pit(hLe,n),y=x.currentTabStopId===p,_=dLe(n),{onFocusableItemAdd:b,onFocusableItemRemove:S,currentTabStopId:k}=x;return E.useEffect(()=>{if(s)return b(),()=>S()},[s,b,S]),r.jsx(rfe.ItemSlot,{scope:n,id:p,focusable:s,active:a,children:r.jsx(Fn.span,{tabIndex:y?0:-1,"data-orientation":x.orientation,...i,ref:t,onMouseDown:un(e.onMouseDown,M=>{s?x.onItemFocus(p):M.preventDefault()}),onFocus:un(e.onFocus,()=>x.onItemFocus(p)),onKeyDown:un(e.onKeyDown,M=>{if(M.key==="Tab"&&M.shiftKey){x.onItemShiftTab();return}if(M.target!==M.currentTarget)return;const P=yit(M,x.orientation,x.dir);if(P!==void 0){if(M.metaKey||M.ctrlKey||M.altKey||M.shiftKey)return;M.preventDefault();let I=_().filter(z=>z.focusable).map(z=>z.ref.current);if(P==="last")I.reverse();else if(P==="prev"||P==="next"){P==="prev"&&I.reverse();const z=I.indexOf(M.currentTarget);I=x.loop?vit(I,z+1):I.slice(z+1)}setTimeout(()=>pLe(I))}}),children:typeof l=="function"?l({isCurrentTabStop:y,hasTabStop:k!=null}):l})})});fLe.displayName=hLe;var git={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function xit(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function yit(e,t,n){const s=xit(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(s))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(s)))return git[s]}function pLe(e,t=!1){const n=document.activeElement;for(const s of e)if(s===n||(s.focus({preventScroll:t}),document.activeElement!==n))return}function vit(e,t){return e.map((n,s)=>e[(t+s)%e.length])}var Dxe=uLe,Rxe=fLe,_it=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},w4=new WeakMap,eO=new WeakMap,tO={},Dce=0,mLe=function(e){return e&&(e.host||mLe(e.parentNode))},bit=function(e,t){return t.map(function(n){if(e.contains(n))return n;var s=mLe(n);return s&&e.contains(s)?s:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},wit=function(e,t,n,s){var a=bit(t,Array.isArray(e)?e:[e]);tO[n]||(tO[n]=new WeakMap);var o=tO[n],l=[],i=new Set,u=new Set(a),p=function(y){!y||i.has(y)||(i.add(y),p(y.parentNode))};a.forEach(p);var x=function(y){!y||u.has(y)||Array.prototype.forEach.call(y.children,function(_){if(i.has(_))x(_);else try{var b=_.getAttribute(s),S=b!==null&&b!=="false",k=(w4.get(_)||0)+1,M=(o.get(_)||0)+1;w4.set(_,k),o.set(_,M),l.push(_),k===1&&S&&eO.set(_,!0),M===1&&_.setAttribute(n,"true"),S||_.setAttribute(s,"true")}catch(P){console.error("aria-hidden: cannot operate on ",_,P)}})};return x(t),i.clear(),Dce++,function(){l.forEach(function(y){var _=w4.get(y)-1,b=o.get(y)-1;w4.set(y,_),o.set(y,b),_||(eO.has(y)||y.removeAttribute(s),eO.delete(y)),b||y.removeAttribute(n)}),Dce--,Dce||(w4=new WeakMap,w4=new WeakMap,eO=new WeakMap,tO={})}},Mse=function(e,t,n){n===void 0&&(n="data-aria-hidden");var s=Array.from(Array.isArray(e)?e:[e]),a=_it(e);return a?(s.push.apply(s,Array.from(a.querySelectorAll("[aria-live]"))),wit(s,a,n,"aria-hidden")):function(){return null}},Bee="right-scroll-bar-position",$ee="width-before-scroll-bar",jit="with-scroll-bars-hidden",kit="--removed-body-scroll-bar-size";function Rce(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function Nit(e,t){var n=E.useState(function(){return{value:e,callback:t,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=t,n.facade}var Sit=typeof window<"u"?E.useLayoutEffect:E.useEffect,Rke=new WeakMap;function Cit(e,t){var n=Nit(null,function(s){return e.forEach(function(a){return Rce(a,s)})});return Sit(function(){var s=Rke.get(n);if(s){var a=new Set(s),o=new Set(e),l=n.current;a.forEach(function(i){o.has(i)||Rce(i,null)}),o.forEach(function(i){a.has(i)||Rce(i,l)})}Rke.set(n,e)},[e]),n}function Mit(e){return e}function Tit(e,t){t===void 0&&(t=Mit);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]:e},useMedium:function(o){var l=t(o,s);return n.push(l),function(){n=n.filter(function(i){return i!==l})}},assignSyncMedium:function(o){for(s=!0;n.length;){var l=n;n=[],l.forEach(o)}n={push:function(i){return o(i)},filter:function(){return n}}},assignMedium:function(o){s=!0;var l=[];if(n.length){var i=n;n=[],i.forEach(o),l=n}var u=function(){var x=l;l=[],x.forEach(o)},p=function(){return Promise.resolve().then(u)};p(),n={push:function(x){l.push(x),p()},filter:function(x){return l=l.filter(x),n}}}};return a}function Ait(e){e===void 0&&(e={});var t=Tit(null);return t.options=np({async:!0,ssr:!1},e),t}var gLe=function(e){var t=e.sideCar,n=wv(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var s=t.read();if(!s)throw new Error("Sidecar medium not found");return E.createElement(s,np({},n))};gLe.isSideCarExport=!0;function Eit(e,t){return e.useMedium(t),gLe}var xLe=Ait(),Fce=function(){},Tse=E.forwardRef(function(e,t){var n=E.useRef(null),s=E.useState({onScrollCapture:Fce,onWheelCapture:Fce,onTouchMoveCapture:Fce}),a=s[0],o=s[1],l=e.forwardProps,i=e.children,u=e.className,p=e.removeScrollBar,x=e.enabled,y=e.shards,_=e.sideCar,b=e.noRelative,S=e.noIsolation,k=e.inert,M=e.allowPinchZoom,P=e.as,T=P===void 0?"div":P,I=e.gapMode,z=wv(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),D=_,U=Cit([n,t]),V=np(np({},z),a);return E.createElement(E.Fragment,null,x&&E.createElement(D,{sideCar:xLe,removeScrollBar:p,shards:y,noRelative:b,noIsolation:S,inert:k,setCallbacks:o,allowPinchZoom:!!M,lockRef:n,gapMode:I}),l?E.cloneElement(E.Children.only(i),np(np({},V),{ref:U})):E.createElement(T,np({},V,{className:u,ref:U}),i))});Tse.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Tse.classNames={fullWidth:$ee,zeroRight:Bee};var Iit=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function Pit(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=Iit();return t&&e.setAttribute("nonce",t),e}function Lit(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function Oit(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var Dit=function(){var e=0,t=null;return{add:function(n){e==0&&(t=Pit())&&(Lit(t,n),Oit(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Rit=function(){var e=Dit();return function(t,n){E.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},yLe=function(){var e=Rit(),t=function(n){var s=n.styles,a=n.dynamic;return e(s,a),null};return t},Fit={left:0,top:0,right:0,gap:0},zce=function(e){return parseInt(e||"",10)||0},zit=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],s=t[e==="padding"?"paddingTop":"marginTop"],a=t[e==="padding"?"paddingRight":"marginRight"];return[zce(n),zce(s),zce(a)]},Bit=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return Fit;var t=zit(e),n=document.documentElement.clientWidth,s=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,s-n+t[2]-t[0])}},$it=yLe(),VS="data-scroll-locked",Uit=function(e,t,n,s){var a=e.left,o=e.top,l=e.right,i=e.gap;return n===void 0&&(n="margin"),` .`.concat(jit,` { overflow: hidden `).concat(s,`; padding-right: `).concat(i,"px ").concat(s,`; } body[`).concat(VS,`] { overflow: hidden `).concat(s,`; overscroll-behavior: contain; `).concat([t&&"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(Bee,` { right: `).concat(i,"px ").concat(s,`; } .`).concat($ee,` { margin-right: `).concat(i,"px ").concat(s,`; } .`).concat(Bee," .").concat(Bee,` { right: 0 `).concat(s,`; } .`).concat($ee," .").concat($ee,` { margin-right: 0 `).concat(s,`; } body[`).concat(VS,`] { `).concat(kit,": ").concat(i,`px; } `)},Fke=function(){var e=parseInt(document.body.getAttribute(VS)||"0",10);return isFinite(e)?e:0},qit=function(){E.useEffect(function(){return document.body.setAttribute(VS,(Fke()+1).toString()),function(){var e=Fke()-1;e<=0?document.body.removeAttribute(VS):document.body.setAttribute(VS,e.toString())}},[])},Vit=function(e){var t=e.noRelative,n=e.noImportant,s=e.gapMode,a=s===void 0?"margin":s;qit();var o=E.useMemo(function(){return Bit(a)},[a]);return E.createElement($it,{styles:Uit(o,!t,a,n?"":"!important")})},nfe=!1;if(typeof window<"u")try{var rO=Object.defineProperty({},"passive",{get:function(){return nfe=!0,!0}});window.addEventListener("test",rO,rO),window.removeEventListener("test",rO,rO)}catch{nfe=!1}var j4=nfe?{passive:!1}:!1,Hit=function(e){return e.tagName==="TEXTAREA"},vLe=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!Hit(e)&&n[t]==="visible")},Wit=function(e){return vLe(e,"overflowY")},Git=function(e){return vLe(e,"overflowX")},zke=function(e,t){var n=t.ownerDocument,s=t;do{typeof ShadowRoot<"u"&&s instanceof ShadowRoot&&(s=s.host);var a=_Le(e,s);if(a){var o=bLe(e,s),l=o[1],i=o[2];if(l>i)return!0}s=s.parentNode}while(s&&s!==n.body);return!1},Kit=function(e){var t=e.scrollTop,n=e.scrollHeight,s=e.clientHeight;return[t,n,s]},Zit=function(e){var t=e.scrollLeft,n=e.scrollWidth,s=e.clientWidth;return[t,n,s]},_Le=function(e,t){return e==="v"?Wit(t):Git(t)},bLe=function(e,t){return e==="v"?Kit(t):Zit(t)},Yit=function(e,t){return e==="h"&&t==="rtl"?-1:1},Xit=function(e,t,n,s,a){var o=Yit(e,window.getComputedStyle(t).direction),l=o*s,i=n.target,u=t.contains(i),p=!1,x=l>0,y=0,_=0;do{if(!i)break;var b=bLe(e,i),S=b[0],k=b[1],M=b[2],P=k-M-o*S;(S||P)&&_Le(e,i)&&(y+=P,_+=S);var T=i.parentNode;i=T&&T.nodeType===Node.DOCUMENT_FRAGMENT_NODE?T.host:T}while(!u&&i!==document.body||u&&(t.contains(i)||t===i));return(x&&Math.abs(y)<1||!x&&Math.abs(_)<1)&&(p=!0),p},nO=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Bke=function(e){return[e.deltaX,e.deltaY]},$ke=function(e){return e&&"current"in e?e.current:e},Qit=function(e,t){return e[0]===t[0]&&e[1]===t[1]},Jit=function(e){return` .block-interactivity-`.concat(e,` {pointer-events: none;} .allow-interactivity-`).concat(e,` {pointer-events: all;} `)},eot=0,k4=[];function tot(e){var t=E.useRef([]),n=E.useRef([0,0]),s=E.useRef(),a=E.useState(eot++)[0],o=E.useState(yLe)[0],l=E.useRef(e);E.useEffect(function(){l.current=e},[e]),E.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(a));var k=kxe([e.lockRef.current],(e.shards||[]).map($ke),!0).filter(Boolean);return k.forEach(function(M){return M.classList.add("allow-interactivity-".concat(a))}),function(){document.body.classList.remove("block-interactivity-".concat(a)),k.forEach(function(M){return M.classList.remove("allow-interactivity-".concat(a))})}}},[e.inert,e.lockRef.current,e.shards]);var i=E.useCallback(function(k,M){if("touches"in k&&k.touches.length===2||k.type==="wheel"&&k.ctrlKey)return!l.current.allowPinchZoom;var P=nO(k),T=n.current,I="deltaX"in k?k.deltaX:T[0]-P[0],z="deltaY"in k?k.deltaY:T[1]-P[1],D,U=k.target,V=Math.abs(I)>Math.abs(z)?"h":"v";if("touches"in k&&V==="h"&&U.type==="range")return!1;var W=zke(V,U);if(!W)return!0;if(W?D=V:(D=V==="v"?"h":"v",W=zke(V,U)),!W)return!1;if(!s.current&&"changedTouches"in k&&(I||z)&&(s.current=D),!D)return!0;var G=s.current||D;return Xit(G,M,k,G==="h"?I:z)},[]),u=E.useCallback(function(k){var M=k;if(!(!k4.length||k4[k4.length-1]!==o)){var P="deltaY"in M?Bke(M):nO(M),T=t.current.filter(function(D){return D.name===M.type&&(D.target===M.target||M.target===D.shadowParent)&&Qit(D.delta,P)})[0];if(T&&T.should){M.cancelable&&M.preventDefault();return}if(!T){var I=(l.current.shards||[]).map($ke).filter(Boolean).filter(function(D){return D.contains(M.target)}),z=I.length>0?i(M,I[0]):!l.current.noIsolation;z&&M.cancelable&&M.preventDefault()}}},[]),p=E.useCallback(function(k,M,P,T){var I={name:k,delta:M,target:P,should:T,shadowParent:rot(P)};t.current.push(I),setTimeout(function(){t.current=t.current.filter(function(z){return z!==I})},1)},[]),x=E.useCallback(function(k){n.current=nO(k),s.current=void 0},[]),y=E.useCallback(function(k){p(k.type,Bke(k),k.target,i(k,e.lockRef.current))},[]),_=E.useCallback(function(k){p(k.type,nO(k),k.target,i(k,e.lockRef.current))},[]);E.useEffect(function(){return k4.push(o),e.setCallbacks({onScrollCapture:y,onWheelCapture:y,onTouchMoveCapture:_}),document.addEventListener("wheel",u,j4),document.addEventListener("touchmove",u,j4),document.addEventListener("touchstart",x,j4),function(){k4=k4.filter(function(k){return k!==o}),document.removeEventListener("wheel",u,j4),document.removeEventListener("touchmove",u,j4),document.removeEventListener("touchstart",x,j4)}},[]);var b=e.removeScrollBar,S=e.inert;return E.createElement(E.Fragment,null,S?E.createElement(o,{styles:Jit(a)}):null,b?E.createElement(Vit,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function rot(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const not=Eit(xLe,tot);var eP=E.forwardRef(function(e,t){return E.createElement(Tse,np({},e,{ref:t,sideCar:not}))});eP.classNames=Tse.classNames;var sfe=["Enter"," "],sot=["ArrowDown","PageUp","Home"],wLe=["ArrowUp","PageDown","End"],aot=[...sot,...wLe],iot={ltr:[...sfe,"ArrowRight"],rtl:[...sfe,"ArrowLeft"]},oot={ltr:["ArrowLeft"],rtl:["ArrowRight"]},tP="Menu",[AE,lot,cot]=qI(tP),[Ck,jLe]=cc(tP,[cot,tx,C3]),Ase=tx(),kLe=C3(),[dot,Mk]=Ck(tP),[uot,rP]=Ck(tP),NLe=e=>{const{__scopeMenu:t,open:n=!1,children:s,dir:a,onOpenChange:o,modal:l=!0}=e,i=Ase(t),[u,p]=E.useState(null),x=E.useRef(!1),y=sc(o),_=Sk(a);return E.useEffect(()=>{const b=()=>{x.current=!0,document.addEventListener("pointerdown",S,{capture:!0,once:!0}),document.addEventListener("pointermove",S,{capture:!0,once:!0})},S=()=>x.current=!1;return document.addEventListener("keydown",b,{capture:!0}),()=>{document.removeEventListener("keydown",b,{capture:!0}),document.removeEventListener("pointerdown",S,{capture:!0}),document.removeEventListener("pointermove",S,{capture:!0})}},[]),r.jsx(GI,{...i,children:r.jsx(dot,{scope:t,open:n,onOpenChange:y,content:u,onContentChange:p,children:r.jsx(uot,{scope:t,onClose:E.useCallback(()=>y(!1),[y]),isUsingKeyboardRef:x,dir:_,modal:l,children:s})})})};NLe.displayName=tP;var hot="MenuAnchor",Fxe=E.forwardRef((e,t)=>{const{__scopeMenu:n,...s}=e,a=Ase(n);return r.jsx(_3,{...a,...s,ref:t})});Fxe.displayName=hot;var zxe="MenuPortal",[fot,SLe]=Ck(zxe,{forceMount:void 0}),CLe=e=>{const{__scopeMenu:t,forceMount:n,children:s,container:a}=e,o=Mk(zxe,t);return r.jsx(fot,{scope:t,forceMount:n,children:r.jsx(Tc,{present:n||o.open,children:r.jsx(m3,{asChild:!0,container:a,children:s})})})};CLe.displayName=zxe;var pp="MenuContent",[pot,Bxe]=Ck(pp),MLe=E.forwardRef((e,t)=>{const n=SLe(pp,e.__scopeMenu),{forceMount:s=n.forceMount,...a}=e,o=Mk(pp,e.__scopeMenu),l=rP(pp,e.__scopeMenu);return r.jsx(AE.Provider,{scope:e.__scopeMenu,children:r.jsx(Tc,{present:s||o.open,children:r.jsx(AE.Slot,{scope:e.__scopeMenu,children:l.modal?r.jsx(mot,{...a,ref:t}):r.jsx(got,{...a,ref:t})})})})}),mot=E.forwardRef((e,t)=>{const n=Mk(pp,e.__scopeMenu),s=E.useRef(null),a=la(t,s);return E.useEffect(()=>{const o=s.current;if(o)return Mse(o)},[]),r.jsx($xe,{...e,ref:a,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:un(e.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),got=E.forwardRef((e,t)=>{const n=Mk(pp,e.__scopeMenu);return r.jsx($xe,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),xot=cv("MenuContent.ScrollLock"),$xe=E.forwardRef((e,t)=>{const{__scopeMenu:n,loop:s=!1,trapFocus:a,onOpenAutoFocus:o,onCloseAutoFocus:l,disableOutsidePointerEvents:i,onEntryFocus:u,onEscapeKeyDown:p,onPointerDownOutside:x,onFocusOutside:y,onInteractOutside:_,onDismiss:b,disableOutsideScroll:S,...k}=e,M=Mk(pp,n),P=rP(pp,n),T=Ase(n),I=kLe(n),z=lot(n),[D,U]=E.useState(null),V=E.useRef(null),W=la(t,V,M.onContentChange),G=E.useRef(0),J=E.useRef(""),ne=E.useRef(0),oe=E.useRef(null),ge=E.useRef("right"),ie=E.useRef(0),pe=S?eP:E.Fragment,se=S?{as:xot,allowPinchZoom:!0}:void 0,fe=ye=>{var Ue,Be;const Ae=J.current+ye,we=z().filter(qe=>!qe.disabled),be=document.activeElement,_e=(Ue=we.find(qe=>qe.ref.current===be))==null?void 0:Ue.textValue,Je=we.map(qe=>qe.textValue),Te=Tot(Je,Ae,_e),De=(Be=we.find(qe=>qe.textValue===Te))==null?void 0:Be.ref.current;(function qe(ot){J.current=ot,window.clearTimeout(G.current),ot!==""&&(G.current=window.setTimeout(()=>qe(""),1e3))})(Ae),De&&setTimeout(()=>De.focus())};E.useEffect(()=>()=>window.clearTimeout(G.current),[]),Cse();const he=E.useCallback(ye=>{var we,be;return ge.current===((we=oe.current)==null?void 0:we.side)&&Eot(ye,(be=oe.current)==null?void 0:be.area)},[]);return r.jsx(pot,{scope:n,searchRef:J,onItemEnter:E.useCallback(ye=>{he(ye)&&ye.preventDefault()},[he]),onItemLeave:E.useCallback(ye=>{var Ae;he(ye)||((Ae=V.current)==null||Ae.focus(),U(null))},[he]),onTriggerLeave:E.useCallback(ye=>{he(ye)&&ye.preventDefault()},[he]),pointerGraceTimerRef:ne,onPointerGraceIntentChange:E.useCallback(ye=>{oe.current=ye},[]),children:r.jsx(pe,{...se,children:r.jsx(QI,{asChild:!0,trapped:a,onMountAutoFocus:un(o,ye=>{var Ae;ye.preventDefault(),(Ae=V.current)==null||Ae.focus({preventScroll:!0})}),onUnmountAutoFocus:l,children:r.jsx(_v,{asChild:!0,disableOutsidePointerEvents:i,onEscapeKeyDown:p,onPointerDownOutside:x,onFocusOutside:y,onInteractOutside:_,onDismiss:b,children:r.jsx(Dxe,{asChild:!0,...I,dir:P.dir,orientation:"vertical",loop:s,currentTabStopId:D,onCurrentTabStopIdChange:U,onEntryFocus:un(u,ye=>{P.isUsingKeyboardRef.current||ye.preventDefault()}),preventScrollOnEntryFocus:!0,children:r.jsx(KI,{role:"menu","aria-orientation":"vertical","data-state":VLe(M.open),"data-radix-menu-content":"",dir:P.dir,...T,...k,ref:W,style:{outline:"none",...k.style},onKeyDown:un(k.onKeyDown,ye=>{const we=ye.target.closest("[data-radix-menu-content]")===ye.currentTarget,be=ye.ctrlKey||ye.altKey||ye.metaKey,_e=ye.key.length===1;we&&(ye.key==="Tab"&&ye.preventDefault(),!be&&_e&&fe(ye.key));const Je=V.current;if(ye.target!==Je||!aot.includes(ye.key))return;ye.preventDefault();const De=z().filter(Ue=>!Ue.disabled).map(Ue=>Ue.ref.current);wLe.includes(ye.key)&&De.reverse(),Cot(De)}),onBlur:un(e.onBlur,ye=>{ye.currentTarget.contains(ye.target)||(window.clearTimeout(G.current),J.current="")}),onPointerMove:un(e.onPointerMove,EE(ye=>{const Ae=ye.target,we=ie.current!==ye.clientX;if(ye.currentTarget.contains(Ae)&&we){const be=ye.clientX>ie.current?"right":"left";ge.current=be,ie.current=ye.clientX}}))})})})})})})});MLe.displayName=pp;var yot="MenuGroup",Uxe=E.forwardRef((e,t)=>{const{__scopeMenu:n,...s}=e;return r.jsx(Fn.div,{role:"group",...s,ref:t})});Uxe.displayName=yot;var vot="MenuLabel",TLe=E.forwardRef((e,t)=>{const{__scopeMenu:n,...s}=e;return r.jsx(Fn.div,{...s,ref:t})});TLe.displayName=vot;var Fte="MenuItem",Uke="menu.itemSelect",Ese=E.forwardRef((e,t)=>{const{disabled:n=!1,onSelect:s,...a}=e,o=E.useRef(null),l=rP(Fte,e.__scopeMenu),i=Bxe(Fte,e.__scopeMenu),u=la(t,o),p=E.useRef(!1),x=()=>{const y=o.current;if(!n&&y){const _=new CustomEvent(Uke,{bubbles:!0,cancelable:!0});y.addEventListener(Uke,b=>s==null?void 0:s(b),{once:!0}),Jge(y,_),_.defaultPrevented?p.current=!1:l.onClose()}};return r.jsx(ALe,{...a,ref:u,disabled:n,onClick:un(e.onClick,x),onPointerDown:y=>{var _;(_=e.onPointerDown)==null||_.call(e,y),p.current=!0},onPointerUp:un(e.onPointerUp,y=>{var _;p.current||(_=y.currentTarget)==null||_.click()}),onKeyDown:un(e.onKeyDown,y=>{const _=i.searchRef.current!=="";n||_&&y.key===" "||sfe.includes(y.key)&&(y.currentTarget.click(),y.preventDefault())})})});Ese.displayName=Fte;var ALe=E.forwardRef((e,t)=>{const{__scopeMenu:n,disabled:s=!1,textValue:a,...o}=e,l=Bxe(Fte,n),i=kLe(n),u=E.useRef(null),p=la(t,u),[x,y]=E.useState(!1),[_,b]=E.useState("");return E.useEffect(()=>{const S=u.current;S&&b((S.textContent??"").trim())},[o.children]),r.jsx(AE.ItemSlot,{scope:n,disabled:s,textValue:a??_,children:r.jsx(Rxe,{asChild:!0,...i,focusable:!s,children:r.jsx(Fn.div,{role:"menuitem","data-highlighted":x?"":void 0,"aria-disabled":s||void 0,"data-disabled":s?"":void 0,...o,ref:p,onPointerMove:un(e.onPointerMove,EE(S=>{s?l.onItemLeave(S):(l.onItemEnter(S),S.defaultPrevented||S.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:un(e.onPointerLeave,EE(S=>l.onItemLeave(S))),onFocus:un(e.onFocus,()=>y(!0)),onBlur:un(e.onBlur,()=>y(!1))})})})}),_ot="MenuCheckboxItem",ELe=E.forwardRef((e,t)=>{const{checked:n=!1,onCheckedChange:s,...a}=e;return r.jsx(DLe,{scope:e.__scopeMenu,checked:n,children:r.jsx(Ese,{role:"menuitemcheckbox","aria-checked":zte(n)?"mixed":n,...a,ref:t,"data-state":Vxe(n),onSelect:un(a.onSelect,()=>s==null?void 0:s(zte(n)?!0:!n),{checkForDefaultPrevented:!1})})})});ELe.displayName=_ot;var ILe="MenuRadioGroup",[bot,wot]=Ck(ILe,{value:void 0,onValueChange:()=>{}}),PLe=E.forwardRef((e,t)=>{const{value:n,onValueChange:s,...a}=e,o=sc(s);return r.jsx(bot,{scope:e.__scopeMenu,value:n,onValueChange:o,children:r.jsx(Uxe,{...a,ref:t})})});PLe.displayName=ILe;var LLe="MenuRadioItem",OLe=E.forwardRef((e,t)=>{const{value:n,...s}=e,a=wot(LLe,e.__scopeMenu),o=n===a.value;return r.jsx(DLe,{scope:e.__scopeMenu,checked:o,children:r.jsx(Ese,{role:"menuitemradio","aria-checked":o,...s,ref:t,"data-state":Vxe(o),onSelect:un(s.onSelect,()=>{var l;return(l=a.onValueChange)==null?void 0:l.call(a,n)},{checkForDefaultPrevented:!1})})})});OLe.displayName=LLe;var qxe="MenuItemIndicator",[DLe,jot]=Ck(qxe,{checked:!1}),RLe=E.forwardRef((e,t)=>{const{__scopeMenu:n,forceMount:s,...a}=e,o=jot(qxe,n);return r.jsx(Tc,{present:s||zte(o.checked)||o.checked===!0,children:r.jsx(Fn.span,{...a,ref:t,"data-state":Vxe(o.checked)})})});RLe.displayName=qxe;var kot="MenuSeparator",FLe=E.forwardRef((e,t)=>{const{__scopeMenu:n,...s}=e;return r.jsx(Fn.div,{role:"separator","aria-orientation":"horizontal",...s,ref:t})});FLe.displayName=kot;var Not="MenuArrow",zLe=E.forwardRef((e,t)=>{const{__scopeMenu:n,...s}=e,a=Ase(n);return r.jsx(ZI,{...a,...s,ref:t})});zLe.displayName=Not;var Sot="MenuSub",[Ier,BLe]=Ck(Sot),IT="MenuSubTrigger",$Le=E.forwardRef((e,t)=>{const n=Mk(IT,e.__scopeMenu),s=rP(IT,e.__scopeMenu),a=BLe(IT,e.__scopeMenu),o=Bxe(IT,e.__scopeMenu),l=E.useRef(null),{pointerGraceTimerRef:i,onPointerGraceIntentChange:u}=o,p={__scopeMenu:e.__scopeMenu},x=E.useCallback(()=>{l.current&&window.clearTimeout(l.current),l.current=null},[]);return E.useEffect(()=>x,[x]),E.useEffect(()=>{const y=i.current;return()=>{window.clearTimeout(y),u(null)}},[i,u]),r.jsx(Fxe,{asChild:!0,...p,children:r.jsx(ALe,{id:a.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":a.contentId,"data-state":VLe(n.open),...e,ref:Sy(t,a.onTriggerChange),onClick:y=>{var _;(_=e.onClick)==null||_.call(e,y),!(e.disabled||y.defaultPrevented)&&(y.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:un(e.onPointerMove,EE(y=>{o.onItemEnter(y),!y.defaultPrevented&&!e.disabled&&!n.open&&!l.current&&(o.onPointerGraceIntentChange(null),l.current=window.setTimeout(()=>{n.onOpenChange(!0),x()},100))})),onPointerLeave:un(e.onPointerLeave,EE(y=>{var b,S;x();const _=(b=n.content)==null?void 0:b.getBoundingClientRect();if(_){const k=(S=n.content)==null?void 0:S.dataset.side,M=k==="right",P=M?-5:5,T=_[M?"left":"right"],I=_[M?"right":"left"];o.onPointerGraceIntentChange({area:[{x:y.clientX+P,y:y.clientY},{x:T,y:_.top},{x:I,y:_.top},{x:I,y:_.bottom},{x:T,y:_.bottom}],side:k}),window.clearTimeout(i.current),i.current=window.setTimeout(()=>o.onPointerGraceIntentChange(null),300)}else{if(o.onTriggerLeave(y),y.defaultPrevented)return;o.onPointerGraceIntentChange(null)}})),onKeyDown:un(e.onKeyDown,y=>{var b;const _=o.searchRef.current!=="";e.disabled||_&&y.key===" "||iot[s.dir].includes(y.key)&&(n.onOpenChange(!0),(b=n.content)==null||b.focus(),y.preventDefault())})})})});$Le.displayName=IT;var ULe="MenuSubContent",qLe=E.forwardRef((e,t)=>{const n=SLe(pp,e.__scopeMenu),{forceMount:s=n.forceMount,...a}=e,o=Mk(pp,e.__scopeMenu),l=rP(pp,e.__scopeMenu),i=BLe(ULe,e.__scopeMenu),u=E.useRef(null),p=la(t,u);return r.jsx(AE.Provider,{scope:e.__scopeMenu,children:r.jsx(Tc,{present:s||o.open,children:r.jsx(AE.Slot,{scope:e.__scopeMenu,children:r.jsx($xe,{id:i.contentId,"aria-labelledby":i.triggerId,...a,ref:p,align:"start",side:l.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:x=>{var y;l.isUsingKeyboardRef.current&&((y=u.current)==null||y.focus()),x.preventDefault()},onCloseAutoFocus:x=>x.preventDefault(),onFocusOutside:un(e.onFocusOutside,x=>{x.target!==i.trigger&&o.onOpenChange(!1)}),onEscapeKeyDown:un(e.onEscapeKeyDown,x=>{l.onClose(),x.preventDefault()}),onKeyDown:un(e.onKeyDown,x=>{var b;const y=x.currentTarget.contains(x.target),_=oot[l.dir].includes(x.key);y&&_&&(o.onOpenChange(!1),(b=i.trigger)==null||b.focus(),x.preventDefault())})})})})})});qLe.displayName=ULe;function VLe(e){return e?"open":"closed"}function zte(e){return e==="indeterminate"}function Vxe(e){return zte(e)?"indeterminate":e?"checked":"unchecked"}function Cot(e){const t=document.activeElement;for(const n of e)if(n===t||(n.focus(),document.activeElement!==t))return}function Mot(e,t){return e.map((n,s)=>e[(t+s)%e.length])}function Tot(e,t,n){const a=t.length>1&&Array.from(t).every(p=>p===t[0])?t[0]:t,o=n?e.indexOf(n):-1;let l=Mot(e,Math.max(o,0));a.length===1&&(l=l.filter(p=>p!==n));const u=l.find(p=>p.toLowerCase().startsWith(a.toLowerCase()));return u!==n?u:void 0}function Aot(e,t){const{x:n,y:s}=e;let a=!1;for(let o=0,l=t.length-1;os!=_>s&&n<(y-p)*(s-x)/(_-x)+p&&(a=!a)}return a}function Eot(e,t){if(!t)return!1;const n={x:e.clientX,y:e.clientY};return Aot(n,t)}function EE(e){return t=>t.pointerType==="mouse"?e(t):void 0}var Iot=NLe,Pot=Fxe,Lot=CLe,Oot=MLe,Dot=Uxe,Rot=TLe,Fot=Ese,zot=ELe,Bot=PLe,$ot=OLe,Uot=RLe,qot=FLe,Vot=zLe,Hot=$Le,Wot=qLe,Ise="DropdownMenu",[Got]=cc(Ise,[jLe]),sh=jLe(),[Kot,HLe]=Got(Ise),WLe=e=>{const{__scopeDropdownMenu:t,children:n,dir:s,open:a,defaultOpen:o,onOpenChange:l,modal:i=!0}=e,u=sh(t),p=E.useRef(null),[x,y]=Ju({prop:a,defaultProp:o??!1,onChange:l,caller:Ise});return r.jsx(Kot,{scope:t,triggerId:fd(),triggerRef:p,contentId:fd(),open:x,onOpenChange:y,onOpenToggle:E.useCallback(()=>y(_=>!_),[y]),modal:i,children:r.jsx(Iot,{...u,open:x,onOpenChange:y,dir:s,modal:i,children:n})})};WLe.displayName=Ise;var GLe="DropdownMenuTrigger",KLe=E.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,disabled:s=!1,...a}=e,o=HLe(GLe,n),l=sh(n);return r.jsx(Pot,{asChild:!0,...l,children:r.jsx(Fn.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:Sy(t,o.triggerRef),onPointerDown:un(e.onPointerDown,i=>{!s&&i.button===0&&i.ctrlKey===!1&&(o.onOpenToggle(),o.open||i.preventDefault())}),onKeyDown:un(e.onKeyDown,i=>{s||(["Enter"," "].includes(i.key)&&o.onOpenToggle(),i.key==="ArrowDown"&&o.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(i.key)&&i.preventDefault())})})})});KLe.displayName=GLe;var Zot="DropdownMenuPortal",ZLe=e=>{const{__scopeDropdownMenu:t,...n}=e,s=sh(t);return r.jsx(Lot,{...s,...n})};ZLe.displayName=Zot;var YLe="DropdownMenuContent",XLe=E.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,a=HLe(YLe,n),o=sh(n),l=E.useRef(!1);return r.jsx(Oot,{id:a.contentId,"aria-labelledby":a.triggerId,...o,...s,ref:t,onCloseAutoFocus:un(e.onCloseAutoFocus,i=>{var u;l.current||(u=a.triggerRef.current)==null||u.focus(),l.current=!1,i.preventDefault()}),onInteractOutside:un(e.onInteractOutside,i=>{const u=i.detail.originalEvent,p=u.button===0&&u.ctrlKey===!0,x=u.button===2||p;(!a.modal||x)&&(l.current=!0)}),style:{...e.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)"}})});XLe.displayName=YLe;var Yot="DropdownMenuGroup",Xot=E.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,a=sh(n);return r.jsx(Dot,{...a,...s,ref:t})});Xot.displayName=Yot;var Qot="DropdownMenuLabel",QLe=E.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,a=sh(n);return r.jsx(Rot,{...a,...s,ref:t})});QLe.displayName=Qot;var Jot="DropdownMenuItem",JLe=E.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,a=sh(n);return r.jsx(Fot,{...a,...s,ref:t})});JLe.displayName=Jot;var elt="DropdownMenuCheckboxItem",eOe=E.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,a=sh(n);return r.jsx(zot,{...a,...s,ref:t})});eOe.displayName=elt;var tlt="DropdownMenuRadioGroup",rlt=E.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,a=sh(n);return r.jsx(Bot,{...a,...s,ref:t})});rlt.displayName=tlt;var nlt="DropdownMenuRadioItem",tOe=E.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,a=sh(n);return r.jsx($ot,{...a,...s,ref:t})});tOe.displayName=nlt;var slt="DropdownMenuItemIndicator",rOe=E.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,a=sh(n);return r.jsx(Uot,{...a,...s,ref:t})});rOe.displayName=slt;var alt="DropdownMenuSeparator",nOe=E.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,a=sh(n);return r.jsx(qot,{...a,...s,ref:t})});nOe.displayName=alt;var ilt="DropdownMenuArrow",olt=E.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,a=sh(n);return r.jsx(Vot,{...a,...s,ref:t})});olt.displayName=ilt;var llt="DropdownMenuSubTrigger",sOe=E.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,a=sh(n);return r.jsx(Hot,{...a,...s,ref:t})});sOe.displayName=llt;var clt="DropdownMenuSubContent",aOe=E.forwardRef((e,t)=>{const{__scopeDropdownMenu:n,...s}=e,a=sh(n);return r.jsx(Wot,{...a,...s,ref:t,style:{...e.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)"}})});aOe.displayName=clt;var dlt=WLe,ult=KLe,hlt=ZLe,iOe=XLe,oOe=QLe,lOe=JLe,cOe=eOe,dOe=tOe,uOe=rOe,hOe=nOe,fOe=sOe,pOe=aOe;const Lh=dlt,Oh=ult,flt=E.forwardRef(({className:e,inset:t,children:n,...s},a)=>r.jsxs(fOe,{ref:a,className:Bt("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",t&&"pl-8",e),...s,children:[n,r.jsx(Wi,{className:"ml-auto h-4 w-4"})]}));flt.displayName=fOe.displayName;const plt=E.forwardRef(({className:e,...t},n)=>r.jsx(pOe,{ref:n,className:Bt("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",e),...t}));plt.displayName=pOe.displayName;const ah=E.forwardRef(({className:e,sideOffset:t=4,...n},s)=>r.jsx(hlt,{children:r.jsx(iOe,{ref:s,sideOffset:t,className:Bt("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",e),...n})}));ah.displayName=iOe.displayName;const ei=E.forwardRef(({className:e,inset:t,...n},s)=>r.jsx(lOe,{ref:s,className:Bt("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",t&&"pl-8",e),...n}));ei.displayName=lOe.displayName;const mlt=E.forwardRef(({className:e,children:t,checked:n,...s},a)=>r.jsxs(cOe,{ref:a,className:Bt("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",e),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(uOe,{children:r.jsx(Ni,{className:"h-4 w-4"})})}),t]}));mlt.displayName=cOe.displayName;const glt=E.forwardRef(({className:e,children:t,...n},s)=>r.jsxs(dOe,{ref:s,className:Bt("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",e),...n,children:[r.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:r.jsx(uOe,{children:r.jsx(Qu,{className:"h-2 w-2 fill-current"})})}),t]}));glt.displayName=dOe.displayName;const afe=E.forwardRef(({className:e,inset:t,...n},s)=>r.jsx(oOe,{ref:s,className:Bt("px-2 py-1.5 text-sm font-semibold",t&&"pl-8",e),...n}));afe.displayName=oOe.displayName;const sk=E.forwardRef(({className:e,...t},n)=>r.jsx(hOe,{ref:n,className:Bt("-mx-1 my-1 h-px bg-muted",e),...t}));sk.displayName=hOe.displayName;const xlt=()=>{const{isAssistant:e,actingAsAgent:t,assignedAgents:n,setActingAsAgent:s}=Lxe();if(!(e&&!!t))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(Un,{className:"h-4 w-4 flex-shrink-0"}),r.jsx("span",{className:"font-medium text-sm",children:"Acting as"}),n.length>1?r.jsxs(Lh,{children:[r.jsx(Oh,{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(Qs,{className:"h-5 w-5",children:[r.jsx(Si,{src:t.avatar_url||void 0}),r.jsx(Js,{className:"text-[10px] bg-primary-foreground/30",children:o(t.name)})]}),r.jsx("strong",{children:t.name}),r.jsx(Dd,{className:"h-3 w-3"})]})}),r.jsx(ah,{align:"start",children:n.map(l=>r.jsxs(ei,{onClick:()=>s(l),className:"gap-2",children:[r.jsxs(Qs,{className:"h-6 w-6",children:[r.jsx(Si,{src:l.avatar_url||void 0}),r.jsx(Js,{className:"text-[10px]",children:o(l.name)})]}),r.jsx("span",{children:l.name}),l.id===t.id&&r.jsx(Pt,{variant:"secondary",className:"ml-auto text-[10px]",children:"Current"})]},l.id))})]}):r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs(Qs,{className:"h-5 w-5",children:[r.jsx(Si,{src:t.avatar_url||void 0}),r.jsx(Js,{className:"text-[10px] bg-primary-foreground/30",children:o(t.name)})]}),r.jsx("strong",{children:t.name})]})]}),r.jsx(Pt,{variant:"secondary",className:"bg-primary-foreground/20 text-primary-foreground border-0 text-xs",children:"Assistant Mode"})]})})},Nn=({children:e,requireAdmin:t=!1,requireBrokerageManager:n=!1})=>{const{user:s,loading:a,isAdmin:o,isBrokerageManager:l}=tn();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?t&&!o?r.jsx(yce,{to:"/dashboard",replace:!0}):n&&!l&&!o?r.jsx(yce,{to:"/dashboard",replace:!0}):r.jsx(r.Fragment,{children:e}):r.jsx(yce,{to:"/auth",replace:!0})};var Hxe={};(function e(t,n,s,a){var o=!!(t.Worker&&t.Blob&&t.Promise&&t.OffscreenCanvas&&t.OffscreenCanvasRenderingContext2D&&t.HTMLCanvasElement&&t.HTMLCanvasElement.prototype.transferControlToOffscreen&&t.URL&&t.URL.createObjectURL),l=typeof Path2D=="function"&&typeof DOMMatrix=="function",i=function(){if(!t.OffscreenCanvas)return!1;try{var Ae=new OffscreenCanvas(1,1),we=Ae.getContext("2d");we.fillRect(0,0,1,1);var be=Ae.transferToImageBitmap();we.createPattern(be,"no-repeat")}catch{return!1}return!0}();function u(){}function p(Ae){var we=n.exports.Promise,be=we!==void 0?we:t.Promise;return typeof be=="function"?new be(Ae):(Ae(u,u),null)}var x=function(Ae,we){return{transform:function(be){if(Ae)return be;if(we.has(be))return we.get(be);var _e=new OffscreenCanvas(be.width,be.height),Je=_e.getContext("2d");return Je.drawImage(be,0,0),we.set(be,_e),_e},clear:function(){we.clear()}}}(i,new Map),y=function(){var Ae=Math.floor(16.666666666666668),we,be,_e={},Je=0;return typeof requestAnimationFrame=="function"&&typeof cancelAnimationFrame=="function"?(we=function(Te){var De=Math.random();return _e[De]=requestAnimationFrame(function Ue(Be){Je===Be||Je+Ae-1{const{data:t,error:n}=await Q.from("celebration_queue").select("*").eq("user_id",e.id).is("seen_at",null).order("created_at",{ascending:!0});if(n)throw n;return t},enabled:!!(e!=null&&e.id),refetchOnWindowFocus:!0,staleTime:0})}function vlt(){const e=Hr();return ir({mutationFn:async t=>{const{error:n}=await Q.from("celebration_queue").update({seen_at:new Date().toISOString()}).eq("id",t);if(n)throw n},onSuccess:()=>{e.invalidateQueries({queryKey:["celebrations"]})}})}function _lt(){const e=Hr(),{user:t}=tn();return ir({mutationFn:async n=>{const{error:s}=await Q.from("celebration_queue").insert({user_id:n.user_id,celebration_type:n.celebration_type,title:n.title,message:n.message||null,points_amount:n.points_amount||null,created_by:t==null?void 0:t.id});if(s)throw s},onSuccess:()=>{e.invalidateQueries({queryKey:["celebrations"]})}})}var Pse="Dialog",[mOe,gOe]=cc(Pse),[blt,Um]=mOe(Pse),xOe=e=>{const{__scopeDialog:t,children:n,open:s,defaultOpen:a,onOpenChange:o,modal:l=!0}=e,i=E.useRef(null),u=E.useRef(null),[p,x]=Ju({prop:s,defaultProp:a??!1,onChange:o,caller:Pse});return r.jsx(blt,{scope:t,triggerRef:i,contentRef:u,contentId:fd(),titleId:fd(),descriptionId:fd(),open:p,onOpenChange:x,onOpenToggle:E.useCallback(()=>x(y=>!y),[x]),modal:l,children:n})};xOe.displayName=Pse;var yOe="DialogTrigger",vOe=E.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,a=Um(yOe,n),o=la(t,a.triggerRef);return r.jsx(Fn.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.contentId,"data-state":Kxe(a.open),...s,ref:o,onClick:un(e.onClick,a.onOpenToggle)})});vOe.displayName=yOe;var Wxe="DialogPortal",[wlt,_Oe]=mOe(Wxe,{forceMount:void 0}),bOe=e=>{const{__scopeDialog:t,forceMount:n,children:s,container:a}=e,o=Um(Wxe,t);return r.jsx(wlt,{scope:t,forceMount:n,children:E.Children.map(s,l=>r.jsx(Tc,{present:n||o.open,children:r.jsx(m3,{asChild:!0,container:a,children:l})}))})};bOe.displayName=Wxe;var Bte="DialogOverlay",wOe=E.forwardRef((e,t)=>{const n=_Oe(Bte,e.__scopeDialog),{forceMount:s=n.forceMount,...a}=e,o=Um(Bte,e.__scopeDialog);return o.modal?r.jsx(Tc,{present:s||o.open,children:r.jsx(klt,{...a,ref:t})}):null});wOe.displayName=Bte;var jlt=cv("DialogOverlay.RemoveScroll"),klt=E.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,a=Um(Bte,n);return r.jsx(eP,{as:jlt,allowPinchZoom:!0,shards:[a.contentRef],children:r.jsx(Fn.div,{"data-state":Kxe(a.open),...s,ref:t,style:{pointerEvents:"auto",...s.style}})})}),ak="DialogContent",jOe=E.forwardRef((e,t)=>{const n=_Oe(ak,e.__scopeDialog),{forceMount:s=n.forceMount,...a}=e,o=Um(ak,e.__scopeDialog);return r.jsx(Tc,{present:s||o.open,children:o.modal?r.jsx(Nlt,{...a,ref:t}):r.jsx(Slt,{...a,ref:t})})});jOe.displayName=ak;var Nlt=E.forwardRef((e,t)=>{const n=Um(ak,e.__scopeDialog),s=E.useRef(null),a=la(t,n.contentRef,s);return E.useEffect(()=>{const o=s.current;if(o)return Mse(o)},[]),r.jsx(kOe,{...e,ref:a,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:un(e.onCloseAutoFocus,o=>{var l;o.preventDefault(),(l=n.triggerRef.current)==null||l.focus()}),onPointerDownOutside:un(e.onPointerDownOutside,o=>{const l=o.detail.originalEvent,i=l.button===0&&l.ctrlKey===!0;(l.button===2||i)&&o.preventDefault()}),onFocusOutside:un(e.onFocusOutside,o=>o.preventDefault())})}),Slt=E.forwardRef((e,t)=>{const n=Um(ak,e.__scopeDialog),s=E.useRef(!1),a=E.useRef(!1);return r.jsx(kOe,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{var l,i;(l=e.onCloseAutoFocus)==null||l.call(e,o),o.defaultPrevented||(s.current||(i=n.triggerRef.current)==null||i.focus(),o.preventDefault()),s.current=!1,a.current=!1},onInteractOutside:o=>{var u,p;(u=e.onInteractOutside)==null||u.call(e,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()}})}),kOe=E.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:s,onOpenAutoFocus:a,onCloseAutoFocus:o,...l}=e,i=Um(ak,n),u=E.useRef(null),p=la(t,u);return Cse(),r.jsxs(r.Fragment,{children:[r.jsx(QI,{asChild:!0,loop:!0,trapped:s,onMountAutoFocus:a,onUnmountAutoFocus:o,children:r.jsx(_v,{role:"dialog",id:i.contentId,"aria-describedby":i.descriptionId,"aria-labelledby":i.titleId,"data-state":Kxe(i.open),...l,ref:p,onDismiss:()=>i.onOpenChange(!1)})}),r.jsxs(r.Fragment,{children:[r.jsx(Mlt,{titleId:i.titleId}),r.jsx(Alt,{contentRef:u,descriptionId:i.descriptionId})]})]})}),Gxe="DialogTitle",NOe=E.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,a=Um(Gxe,n);return r.jsx(Fn.h2,{id:a.titleId,...s,ref:t})});NOe.displayName=Gxe;var SOe="DialogDescription",COe=E.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,a=Um(SOe,n);return r.jsx(Fn.p,{id:a.descriptionId,...s,ref:t})});COe.displayName=SOe;var MOe="DialogClose",TOe=E.forwardRef((e,t)=>{const{__scopeDialog:n,...s}=e,a=Um(MOe,n);return r.jsx(Fn.button,{type:"button",...s,ref:t,onClick:un(e.onClick,()=>a.onOpenChange(!1))})});TOe.displayName=MOe;function Kxe(e){return e?"open":"closed"}var AOe="DialogTitleWarning",[Clt,EOe]=sXe(AOe,{contentName:ak,titleName:Gxe,docsSlug:"dialog"}),Mlt=({titleId:e})=>{const t=EOe(AOe),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users. If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component. For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return E.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},Tlt="DialogDescriptionWarning",Alt=({contentRef:e,descriptionId:t})=>{const s=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${EOe(Tlt).contentName}}.`;return E.useEffect(()=>{var o;const a=(o=e.current)==null?void 0:o.getAttribute("aria-describedby");t&&a&&(document.getElementById(t)||console.warn(s))},[s,e,t]),null},Lse=xOe,Zxe=vOe,Ose=bOe,M3=wOe,T3=jOe,nP=NOe,sP=COe,Dse=TOe;const Or=Lse,Zo=Zxe,Elt=Ose,IOe=E.forwardRef(({className:e,...t},n)=>r.jsx(M3,{ref:n,className:Bt("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",e),...t}));IOe.displayName=M3.displayName;const Ir=E.forwardRef(({className:e,children:t,...n},s)=>r.jsxs(Elt,{children:[r.jsx(IOe,{}),r.jsxs(T3,{ref:s,className:Bt("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",e),...n,children:[t,r.jsxs(Dse,{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(hs,{className:"h-4 w-4"}),r.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Ir.displayName=T3.displayName;const $r=({className:e,...t})=>r.jsx("div",{className:Bt("flex flex-col space-y-1.5 text-center sm:text-left",e),...t});$r.displayName="DialogHeader";const Bs=({className:e,...t})=>r.jsx("div",{className:Bt("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});Bs.displayName="DialogFooter";const Fr=E.forwardRef(({className:e,...t},n)=>r.jsx(nP,{ref:n,className:Bt("text-lg font-semibold leading-none tracking-tight",e),...t}));Fr.displayName=nP.displayName;const Zn=E.forwardRef(({className:e,...t},n)=>r.jsx(sP,{ref:n,className:Bt("text-sm text-muted-foreground",e),...t}));Zn.displayName=sP.displayName;const Ilt={points_earned:ro,listing_created:xa,deal_closed:Rd,custom:js},Vke={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 Plt(){const{user:e}=tn(),t=Hr(),{data:n}=ylt(),s=vlt(),[a,o]=E.useState(null),[l,i]=E.useState(!1),u=E.useCallback(()=>{const b=Date.now()+3e3,S={startVelocity:30,spread:360,ticks:60,zIndex:9999},k=(P,T)=>Math.random()*(T-P)+P,M=setInterval(()=>{const P=b-Date.now();if(P<=0){clearInterval(M);return}const T=50*(P/3e3);qke({...S,particleCount:T,origin:{x:k(.1,.3),y:Math.random()-.2},colors:["#ff6b6b","#feca57","#48dbfb","#ff9ff3","#54a0ff","#5f27cd"]}),qke({...S,particleCount:T,origin:{x:k(.7,.9),y:Math.random()-.2},colors:["#ff6b6b","#feca57","#48dbfb","#ff9ff3","#54a0ff","#5f27cd"]})},250)},[]);E.useEffect(()=>{n&&n.length>0&&!a&&(o(n[0]),i(!0),setTimeout(u,100))},[n,a,u]);const p=async()=>{if(a){const _=a.id;i(!1),o(null),t.setQueryData(["celebrations","pending",e==null?void 0:e.id],b=>(b==null?void 0:b.filter(S=>S.id!==_))??[]),await s.mutateAsync(_)}};if(!a)return null;const x=Ilt[a.celebration_type]||js,y=Vke[a.celebration_type]||Vke.custom;return r.jsx(Or,{open:l,onOpenChange:_=>!_&&p(),children:r.jsxs(Ir,{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(Ls,{className:"w-5 h-5 text-yellow-500 animate-pulse"}),r.jsx(Ls,{className:"w-5 h-5 text-yellow-500 animate-pulse delay-75"}),r.jsx(Ls,{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 POe="/assets/levelup-logo-horizontal-DEFNc0ms.png",Yxe="/assets/levelup-logo-white-C2RAgAoG.png",Llt="/assets/listings-hero-BI9Ki9Dq.jpg",dt=E.forwardRef(({className:e,type:t,...n},s)=>r.jsx("input",{type:t,className:Bt("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",e),ref:s,...n}));dt.displayName="Input";var LOe={exports:{}};(function(e,t){(function(n,s){e.exports=s()})(Yx,function(){var n,s,a;function o(i,u){if(!n)n=u;else if(!s)s=u;else{var p="self.onerror = function() { console.error('An error occurred while parsing the WebWorker bundle. This is most likely due to improper transpilation by Babel; please see https://docs.mapbox.com/mapbox-gl-js/guides/install/#transpiling'); }; var sharedChunk = {}; ("+n+")(sharedChunk); ("+s+")(sharedChunk); self.onerror = null;",x={};n(x),a=u(x),typeof window<"u"&&window&&window.URL&&window.URL.createObjectURL&&(a.workerUrl=window.URL.createObjectURL(new Blob([p],{type:"text/javascript"})))}}o(["exports"],function(i){var u=1e-6,p=typeof Float32Array<"u"?Float32Array:Array;function x(f,c){var h=c[0],g=c[1],v=c[2],N=c[3],C=h*N-v*g;return C?(f[0]=N*(C=1/C),f[1]=-g*C,f[2]=-v*C,f[3]=h*C,f):null}function y(){var f=new p(9);return p!=Float32Array&&(f[1]=0,f[2]=0,f[3]=0,f[5]=0,f[6]=0,f[7]=0),f[0]=1,f[4]=1,f[8]=1,f}function _(f,c){var h=c[0],g=c[1],v=c[2],N=c[3],C=c[4],L=c[5],F=c[6],$=c[7],K=c[8];return f[0]=C*K-L*$,f[1]=v*$-g*K,f[2]=g*L-v*C,f[3]=L*F-N*K,f[4]=h*K-v*F,f[5]=v*N-h*L,f[6]=N*$-C*F,f[7]=g*F-h*$,f[8]=h*C-g*N,f}function b(f,c,h){var g=c[0],v=c[1],N=c[2],C=c[3],L=c[4],F=c[5],$=c[6],K=c[7],Z=c[8],X=h[0],re=h[1],ae=h[2],me=h[3],Se=h[4],Ne=h[5],Fe=h[6],ze=h[7],Xe=h[8];return f[0]=X*g+re*C+ae*$,f[1]=X*v+re*L+ae*K,f[2]=X*N+re*F+ae*Z,f[3]=me*g+Se*C+Ne*$,f[4]=me*v+Se*L+Ne*K,f[5]=me*N+Se*F+Ne*Z,f[6]=Fe*g+ze*C+Xe*$,f[7]=Fe*v+ze*L+Xe*K,f[8]=Fe*N+ze*F+Xe*Z,f}function S(){var f=new p(16);return p!=Float32Array&&(f[1]=0,f[2]=0,f[3]=0,f[4]=0,f[6]=0,f[7]=0,f[8]=0,f[9]=0,f[11]=0,f[12]=0,f[13]=0,f[14]=0),f[0]=1,f[5]=1,f[10]=1,f[15]=1,f}function k(f){var c=new p(16);return c[0]=f[0],c[1]=f[1],c[2]=f[2],c[3]=f[3],c[4]=f[4],c[5]=f[5],c[6]=f[6],c[7]=f[7],c[8]=f[8],c[9]=f[9],c[10]=f[10],c[11]=f[11],c[12]=f[12],c[13]=f[13],c[14]=f[14],c[15]=f[15],c}function M(f){return f[0]=1,f[1]=0,f[2]=0,f[3]=0,f[4]=0,f[5]=1,f[6]=0,f[7]=0,f[8]=0,f[9]=0,f[10]=1,f[11]=0,f[12]=0,f[13]=0,f[14]=0,f[15]=1,f}function P(f,c){var h=c[0],g=c[1],v=c[2],N=c[3],C=c[4],L=c[5],F=c[6],$=c[7],K=c[8],Z=c[9],X=c[10],re=c[11],ae=c[12],me=c[13],Se=c[14],Ne=c[15],Fe=h*L-g*C,ze=h*F-v*C,Xe=h*$-N*C,gt=g*F-v*L,ht=g*$-N*L,bt=v*$-N*F,Ct=K*me-Z*ae,Et=K*Se-X*ae,Xt=K*Ne-re*ae,Rt=Z*Se-X*me,rr=Z*Ne-re*me,lr=X*Ne-re*Se,cr=Fe*lr-ze*rr+Xe*Rt+gt*Xt-ht*Et+bt*Ct;return cr?(f[0]=(L*lr-F*rr+$*Rt)*(cr=1/cr),f[1]=(v*rr-g*lr-N*Rt)*cr,f[2]=(me*bt-Se*ht+Ne*gt)*cr,f[3]=(X*ht-Z*bt-re*gt)*cr,f[4]=(F*Xt-C*lr-$*Et)*cr,f[5]=(h*lr-v*Xt+N*Et)*cr,f[6]=(Se*Xe-ae*bt-Ne*ze)*cr,f[7]=(K*bt-X*Xe+re*ze)*cr,f[8]=(C*rr-L*Xt+$*Ct)*cr,f[9]=(g*Xt-h*rr-N*Ct)*cr,f[10]=(ae*ht-me*Xe+Ne*Fe)*cr,f[11]=(Z*Xe-K*ht-re*Fe)*cr,f[12]=(L*Et-C*Rt-F*Ct)*cr,f[13]=(h*Rt-g*Et+v*Ct)*cr,f[14]=(me*ze-ae*gt-Se*Fe)*cr,f[15]=(K*gt-Z*ze+X*Fe)*cr,f):null}function T(f,c,h){var g=c[0],v=c[1],N=c[2],C=c[3],L=c[4],F=c[5],$=c[6],K=c[7],Z=c[8],X=c[9],re=c[10],ae=c[11],me=c[12],Se=c[13],Ne=c[14],Fe=c[15],ze=h[0],Xe=h[1],gt=h[2],ht=h[3];return f[0]=ze*g+Xe*L+gt*Z+ht*me,f[1]=ze*v+Xe*F+gt*X+ht*Se,f[2]=ze*N+Xe*$+gt*re+ht*Ne,f[3]=ze*C+Xe*K+gt*ae+ht*Fe,f[4]=(ze=h[4])*g+(Xe=h[5])*L+(gt=h[6])*Z+(ht=h[7])*me,f[5]=ze*v+Xe*F+gt*X+ht*Se,f[6]=ze*N+Xe*$+gt*re+ht*Ne,f[7]=ze*C+Xe*K+gt*ae+ht*Fe,f[8]=(ze=h[8])*g+(Xe=h[9])*L+(gt=h[10])*Z+(ht=h[11])*me,f[9]=ze*v+Xe*F+gt*X+ht*Se,f[10]=ze*N+Xe*$+gt*re+ht*Ne,f[11]=ze*C+Xe*K+gt*ae+ht*Fe,f[12]=(ze=h[12])*g+(Xe=h[13])*L+(gt=h[14])*Z+(ht=h[15])*me,f[13]=ze*v+Xe*F+gt*X+ht*Se,f[14]=ze*N+Xe*$+gt*re+ht*Ne,f[15]=ze*C+Xe*K+gt*ae+ht*Fe,f}function I(f,c,h){var g,v,N,C,L,F,$,K,Z,X,re,ae,me=h[0],Se=h[1],Ne=h[2];return c===f?(f[12]=c[0]*me+c[4]*Se+c[8]*Ne+c[12],f[13]=c[1]*me+c[5]*Se+c[9]*Ne+c[13],f[14]=c[2]*me+c[6]*Se+c[10]*Ne+c[14],f[15]=c[3]*me+c[7]*Se+c[11]*Ne+c[15]):(v=c[1],N=c[2],C=c[3],L=c[4],F=c[5],$=c[6],K=c[7],Z=c[8],X=c[9],re=c[10],ae=c[11],f[0]=g=c[0],f[1]=v,f[2]=N,f[3]=C,f[4]=L,f[5]=F,f[6]=$,f[7]=K,f[8]=Z,f[9]=X,f[10]=re,f[11]=ae,f[12]=g*me+L*Se+Z*Ne+c[12],f[13]=v*me+F*Se+X*Ne+c[13],f[14]=N*me+$*Se+re*Ne+c[14],f[15]=C*me+K*Se+ae*Ne+c[15]),f}function z(f,c,h){var g=h[0],v=h[1],N=h[2];return f[0]=c[0]*g,f[1]=c[1]*g,f[2]=c[2]*g,f[3]=c[3]*g,f[4]=c[4]*v,f[5]=c[5]*v,f[6]=c[6]*v,f[7]=c[7]*v,f[8]=c[8]*N,f[9]=c[9]*N,f[10]=c[10]*N,f[11]=c[11]*N,f[12]=c[12],f[13]=c[13],f[14]=c[14],f[15]=c[15],f}function D(f,c,h){var g=Math.sin(h),v=Math.cos(h),N=c[4],C=c[5],L=c[6],F=c[7],$=c[8],K=c[9],Z=c[10],X=c[11];return c!==f&&(f[0]=c[0],f[1]=c[1],f[2]=c[2],f[3]=c[3],f[12]=c[12],f[13]=c[13],f[14]=c[14],f[15]=c[15]),f[4]=N*v+$*g,f[5]=C*v+K*g,f[6]=L*v+Z*g,f[7]=F*v+X*g,f[8]=$*v-N*g,f[9]=K*v-C*g,f[10]=Z*v-L*g,f[11]=X*v-F*g,f}function U(f,c,h){var g=Math.sin(h),v=Math.cos(h),N=c[0],C=c[1],L=c[2],F=c[3],$=c[8],K=c[9],Z=c[10],X=c[11];return c!==f&&(f[4]=c[4],f[5]=c[5],f[6]=c[6],f[7]=c[7],f[12]=c[12],f[13]=c[13],f[14]=c[14],f[15]=c[15]),f[0]=N*v-$*g,f[1]=C*v-K*g,f[2]=L*v-Z*g,f[3]=F*v-X*g,f[8]=N*g+$*v,f[9]=C*g+K*v,f[10]=L*g+Z*v,f[11]=F*g+X*v,f}function V(f,c,h){var g=Math.sin(h),v=Math.cos(h),N=c[0],C=c[1],L=c[2],F=c[3],$=c[4],K=c[5],Z=c[6],X=c[7];return c!==f&&(f[8]=c[8],f[9]=c[9],f[10]=c[10],f[11]=c[11],f[12]=c[12],f[13]=c[13],f[14]=c[14],f[15]=c[15]),f[0]=N*v+$*g,f[1]=C*v+K*g,f[2]=L*v+Z*g,f[3]=F*v+X*g,f[4]=$*v-N*g,f[5]=K*v-C*g,f[6]=Z*v-L*g,f[7]=X*v-F*g,f}function W(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,h){var g,v,N,C=h[0],L=h[1],F=h[2],$=Math.sqrt(C*C+L*L+F*F);return $0&&(N=1/Math.sqrt(N)),f[0]=c[0]*N,f[1]=c[1]*N,f[2]=c[2]*N,f}function ot(f,c){return f[0]*c[0]+f[1]*c[1]+f[2]*c[2]}function Mt(f,c,h){var g=c[0],v=c[1],N=c[2],C=h[0],L=h[1],F=h[2];return f[0]=v*F-N*L,f[1]=N*C-g*F,f[2]=g*L-v*C,f}function Oe(f,c,h,g){var v=c[0],N=c[1],C=c[2];return f[0]=v+g*(h[0]-v),f[1]=N+g*(h[1]-N),f[2]=C+g*(h[2]-C),f}function at(f,c,h){var g=c[0],v=c[1],N=c[2],C=h[3]*g+h[7]*v+h[11]*N+h[15];return f[0]=(h[0]*g+h[4]*v+h[8]*N+h[12])/(C=C||1),f[1]=(h[1]*g+h[5]*v+h[9]*N+h[13])/C,f[2]=(h[2]*g+h[6]*v+h[10]*N+h[14])/C,f}function le(f,c,h){var g=c[0],v=c[1],N=c[2];return f[0]=g*h[0]+v*h[3]+N*h[6],f[1]=g*h[1]+v*h[4]+N*h[7],f[2]=g*h[2]+v*h[5]+N*h[8],f}function Ve(f,c,h){var g=h[0],v=h[1],N=h[2],C=h[3],L=c[0],F=c[1],$=c[2],K=v*$-N*F,Z=N*L-g*$,X=g*F-v*L;return f[0]=L+C*(K+=K)+v*(X+=X)-N*(Z+=Z),f[1]=F+C*Z+N*K-g*X,f[2]=$+C*X+g*Z-v*K,f}function Qe(f){return f[0]=0,f[1]=0,f[2]=0,f}function st(f,c){return f[0]===c[0]&&f[1]===c[1]&&f[2]===c[2]}var ke=ye,ct=Ae,Ce=pe;function Me(){var f=new p(4);return p!=Float32Array&&(f[0]=0,f[1]=0,f[2]=0,f[3]=0),f}function Ge(f,c,h){return f[0]=c[0]*h,f[1]=c[1]*h,f[2]=c[2]*h,f[3]=c[3]*h,f}function Ee(f,c){var h=c[0],g=c[1],v=c[2],N=c[3],C=h*h+g*g+v*v+N*N;return C>0&&(C=1/Math.sqrt(C)),f[0]=h*C,f[1]=g*C,f[2]=v*C,f[3]=N*C,f}function He(f,c,h){var g=c[0],v=c[1],N=c[2],C=c[3];return f[0]=h[0]*g+h[4]*v+h[8]*N+h[12]*C,f[1]=h[1]*g+h[5]*v+h[9]*N+h[13]*C,f[2]=h[2]*g+h[6]*v+h[10]*N+h[14]*C,f[3]=h[3]*g+h[7]*v+h[11]*N+h[15]*C,f}function nt(){var f=new p(4);return p!=Float32Array&&(f[0]=0,f[1]=0,f[2]=0),f[3]=1,f}function yt(f){return f[0]=0,f[1]=0,f[2]=0,f[3]=1,f}function it(f,c,h){h*=.5;var g=c[0],v=c[1],N=c[2],C=c[3],L=Math.sin(h),F=Math.cos(h);return f[0]=g*F+C*L,f[1]=v*F+N*L,f[2]=N*F-v*L,f[3]=C*F-g*L,f}function zt(f,c,h){h*=.5;var g=c[0],v=c[1],N=c[2],C=c[3],L=Math.sin(h),F=Math.cos(h);return f[0]=g*F-N*L,f[1]=v*F+C*L,f[2]=N*F+g*L,f[3]=C*F-v*L,f}ge(),Me();var dr,Rr,Gr,Ur=Ee,kn=(dr=ge(),Rr=se(1,0,0),Gr=se(0,1,0),function(f,c,h){var g=ot(c,h);return g<-.999999?(Mt(dr,Rr,c),Ce(dr)<1e-6&&Mt(dr,Gr,c),qe(dr,dr),function(v,N,C){C*=.5;var L=Math.sin(C);v[0]=L*N[0],v[1]=L*N[1],v[2]=L*N[2],v[3]=Math.cos(C)}(f,dr,Math.PI),f):g>.999999?(f[0]=0,f[1]=0,f[2]=0,f[3]=1,f):(Mt(dr,c,h),f[0]=dr[0],f[1]=dr[1],f[2]=dr[2],f[3]=1+g,Ur(f,f))});function _s(){var f=new p(2);return p!=Float32Array&&(f[0]=0,f[1]=0),f}function ur(f,c){var h=new p(2);return h[0]=f,h[1]=c,h}function Rn(f,c,h){return f[0]=c,f[1]=h,f}function ea(f,c,h){return f[0]=c[0]+h[0],f[1]=c[1]+h[1],f}function ca(f,c,h){return f[0]=c[0]-h[0],f[1]=c[1]-h[1],f}function Ei(f,c,h){return f[0]=c[0]*h,f[1]=c[1]*h,f}function Ii(f){var c=f[0],h=f[1];return Math.sqrt(c*c+h*h)}function $o(f,c){var h=c[0],g=c[1],v=h*h+g*g;return v>0&&(v=1/Math.sqrt(v)),f[0]=c[0]*v,f[1]=c[1]*v,f}function Va(f,c){return f[0]*c[0]+f[1]*c[1]}nt(),nt(),y();var cs,ta,ds=ca;function Hs(f){return f&&f.__esModule&&Object.prototype.hasOwnProperty.call(f,"default")?f.default:f}_s();var Os=function(){if(ta)return cs;function f(c,h,g,v){this.cx=3*c,this.bx=3*(g-c)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*h,this.by=3*(v-h)-this.cy,this.ay=1-this.cy-this.by,this.p1x=c,this.p1y=h,this.p2x=g,this.p2y=v}return ta=1,cs=f,f.prototype={sampleCurveX:function(c){return((this.ax*c+this.bx)*c+this.cx)*c},sampleCurveY:function(c){return((this.ay*c+this.by)*c+this.cy)*c},sampleCurveDerivativeX:function(c){return(3*this.ax*c+2*this.bx)*c+this.cx},solveCurveX:function(c,h){if(h===void 0&&(h=1e-6),c<0)return 0;if(c>1)return 1;for(var g=c,v=0;v<8;v++){var N=this.sampleCurveX(g)-c;if(Math.abs(N)N?L=g:F=g,g=.5*(F-L)+L;return g},solve:function(c,h){return this.sampleCurveY(this.solveCurveX(c,h))}},cs}(),bi=Hs(Os);function sr(f,c){this.x=f,this.y=c}function Ia(f,c){if(Array.isArray(f)){if(!Array.isArray(c)||f.length!==c.length)return!1;for(let h=0;h=1)return 1;const c=f*f,h=c*f;return 4*(f<.5?h:3*(f-c)+h-.75)}function uc(f,c,h,g){const v=new bi(f,c,h,g);return function(N){return v.solve(N)}}const tt=uc(.25,.1,.25,1);function xe(f,c,h){return Math.min(h,Math.max(c,f))}function Pe(f,c,h){return(h=xe((h-f)/(c-f),0,1))*h*(3-2*h)}function Ye(f,c,h){const g=h-c,v=((f-c)%g+g)%g+c;return v===c?h:v}function Nt(f,c,h){if(!f.length)return h(null,[]);let g=f.length;const v=new Array(f.length);let N=null;f.forEach((C,L)=>{c(C,(F,$)=>{F&&(N=F),v[L]=$,--g==0&&h(N,v)})})}let _t=1;function At(){return _t++}function $t(f){return f<=1?1:Math.pow(2,Math.ceil(Math.log2(f)))}function Lt(f,c){f.forEach(h=>{c[h]&&(c[h]=c[h].bind(c))})}function Vt(f,c,h){const g={};for(const v in f)g[v]=c.call(this,f[v],v,f);return g}function pr(f,c,h){const g={};for(const v in f)c.call(this,f[v],v,f)&&(g[v]=f[v]);return g}function or(f){return Array.isArray(f)?f.map(or):typeof f=="object"&&f?Vt(f,or):f}function Yr(f,c){for(let h=0;h=0)return!0;return!1}const jn={};function Wr(f){jn[f]||(typeof console<"u"&&console.warn(f),jn[f]=!0)}function as(f,c,h){return(h.y-f.y)*(c.x-f.x)>(c.y-f.y)*(h.x-f.x)}function is(f){let c=0;for(let h,g,v=0,N=f.length,C=N-1;v@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(h,g,v,N)=>{const C=v||N;return c[g]=!C||C.toLowerCase(),""}),c["max-age"]){const h=parseInt(c["max-age"],10);isNaN(h)?delete c["max-age"]:c["max-age"]=h}return c}let wo=null;function va(f,c){return[f[4*c],f[4*c+1],f[4*c+2],f[4*c+3]]}function No(f,c,h,g){for(;c>1;f[v]>1;f[v]<=g?c=v+1:h=v}return c}function ra(f){return f>0?1/(1.001-f):1+f}function Li(f){return f>0?1-1/(1.001-f):-f}function Ha(f,c,h){return(f-c.min)*(h.max-h.min)/(c.max-c.min)+h.min}const Es={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(!Es.API_URL)return null;try{const f=new URL(Es.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 Oi(f){return Es.API_URL_REGEX.test(f)}function _l(f){return Es.API_SPRITE_REGEX.test(f)}let Al,Zc,Tf,Yo,Vd,hc;function ih(){return Al==null&&(Al=self.OffscreenCanvas&&new OffscreenCanvas(1,1).getContext("2d")&&typeof self.createImageBitmap=="function"),Al}const Xo={now:()=>Yo!==void 0?Yo:performance.now(),setNow(f){Yo=f},restoreNow(){Yo=void 0},frame(f){const c=requestAnimationFrame(f);return{cancel:()=>cancelAnimationFrame(c)}},getImageData(f,c=0){const{width:h,height:g}=f;Vd||(Vd=document.createElement("canvas"));const v=Vd.getContext("2d",{willReadFrequently:!0});if(!v)throw new Error("failed to create canvas 2d context");return(h>Vd.width||g>Vd.height)&&(Vd.width=h,Vd.height=g),v.clearRect(-c,-c,h+2*c,g+2*c),v.drawImage(f,0,0,h,g),v.getImageData(-c,-c,h+2*c,g+2*c)},resolveURL:f=>(Zc||(Zc=document.createElement("a")),Zc.href=f,Zc.href),get devicePixelRatio(){return window.devicePixelRatio},get prefersReducedMotion(){return!!window.matchMedia&&(Tf==null&&(Tf=window.matchMedia("(prefers-reduced-motion: reduce)")),Tf.matches)},hasCanvasFingerprintNoise(){if(hc!==void 0)return hc;if(!ih())return hc=!1,!1;const f=new OffscreenCanvas(85,1),c=f.getContext("2d",{willReadFrequently:!0});let h=0;for(let v=0;v0?`?${N}`:""}`}const Gy="mapbox-tiles";let Ky=500,Zy=50;const zh=["language","worldview","jobid"];let Tu,Yc;function lu(){try{return caches}catch{}}function fc(){const f=lu();f&&Tu==null&&(Tu=f.open(Gy))}let Xc=1/0;const Uo={supported:!1,testSupport:function(f){!Hd&&Bh&&(Cp?lx(f):Au=f)}};let Au,Bh,Hd=!1,Cp=!1;const Yy=typeof self<"u"?self:{};function lx(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,Bh),f.isContextLost())return;Uo.supported=!0}catch{}f.deleteTexture(c),Hd=!0}Yy.document&&(Bh=Yy.document.createElement("img"),Bh.onload=function(){Au&&lx(Au),Au=null,Cp=!0},Bh.onerror=function(){Hd=!0,Au=null},Bh.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA=");const Mp={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(Mp);class yd extends Error{constructor(c,h,g){h===401&&Oi(g)&&(c+=": you may have provided an invalid Mapbox access token. See https://docs.mapbox.com/api/overview/#access-tokens-and-token-scopes"),super(c),this.status=h,this.url=g}toString(){return`${this.name}: ${this.message} (${this.status}): ${this.url}`}}const Xy=$s()?()=>self.worker.referrer:()=>(location.protocol==="blob:"?parent:self).location.href,Af=function(f,c){if(!(/^file:/.test(h=f.url)||/^file:/.test(Xy())&&!/^\w+:/.test(h))){if(self.fetch&&self.Request&&self.AbortController&&Request.prototype.hasOwnProperty("signal"))return function(g,v){const N=new AbortController,C=new Request(g.url,{method:g.method||"GET",body:g.body,credentials:g.credentials,headers:g.headers,referrer:Xy(),referrerPolicy:g.referrerPolicy,signal:N.signal});let L=!1,F=!1;const $=(K=C.url).indexOf("sku=")>0&&Oi(K);var K;g.type==="json"&&C.headers.set("Accept","application/json");const Z=(re,ae,me)=>{if(F)return;if(re&&re.message!=="SecurityError"&&Wr(re.toString()),ae&&me)return X(ae);const Se=Date.now();fetch(C).then(Ne=>{if(Ne.ok){const Fe=$?Ne.clone():null;return X(Ne,Fe,Se)}return v(new yd(Ne.statusText,Ne.status,g.url))}).catch(Ne=>{Ne.name!=="AbortError"&&v(new Error(`${Ne.message} ${g.url}`))})},X=(re,ae,me)=>{(g.type==="arrayBuffer"?re.arrayBuffer():g.type==="json"?re.json():re.text()).then(Se=>{F||(ae&&me&&function(Ne,Fe,ze){if(fc(),Tu==null)return;const Xe=$i(Fe.headers.get("Cache-Control")||"");if(Xe["no-store"])return;const gt={status:Fe.status,statusText:Fe.statusText,headers:new Headers};Fe.headers.forEach((Ct,Et)=>gt.headers.set(Et,Ct)),Xe["max-age"]&>.headers.set("Expires",new Date(ze+1e3*Xe["max-age"]).toUTCString());const ht=gt.headers.get("Expires");if(!ht||new Date(ht).getTime()-ze<42e4)return;let bt=Wm(Ne.url,{persistentParams:zh});if(Fe.status===206){const Ct=Ne.headers.get("Range");if(!Ct)return;gt.status=200,bt=Sp(bt,{range:Ct})}(function(Ct,Et){if(Yc===void 0)try{new Response(new ReadableStream),Yc=!0}catch{Yc=!1}Yc?Et(Ct.body):Ct.blob().then(Et).catch(Xt=>Wr(Xt.message))})(Fe,Ct=>{const Et=new Response((Xt=Fe.status)!==200&&Xt!==404&&[101,103,204,205,304].includes(Xt)?null:Ct,gt);var Xt;fc(),Tu!=null&&Tu.then(Rt=>Rt.put(bt,Et)).catch(Rt=>Wr(Rt.message))})}(C,ae,me),L=!0,v(null,Se,re.headers))}).catch(Se=>{F||v(new Error(Se.message))})};return $?function(re,ae){if(fc(),Tu==null)return ae(null);Tu.then(me=>{let Se=Wm(re.url,{persistentParams:zh});const Ne=re.headers.get("Range");Ne&&(Se=Sp(Se,{range:Ne})),me.match(Se).then(Fe=>{const ze=function(Xe){if(!Xe)return!1;const gt=new Date(Xe.headers.get("Expires")||0),ht=$i(Xe.headers.get("Cache-Control")||"");return Number(gt)>Date.now()&&!ht["no-cache"]}(Fe);me.delete(Se).catch(ae),ze&&me.put(Se,Fe.clone()).catch(ae),ae(null,Fe,ze)}).catch(ae)}).catch(ae)}(C,Z):Z(null,null),{cancel:()=>{F=!0,L||N.abort()}}}(f,c);if($s(self)&&self.worker.actor)return self.worker.actor.send("getResource",f,c,void 0,!0)}var h;return function(g,v){const N=new XMLHttpRequest;N.open(g.method||"GET",g.url,!0),g.type==="arrayBuffer"&&(N.responseType="arraybuffer");for(const C in g.headers)N.setRequestHeader(C,g.headers[C]);return g.type==="json"&&(N.responseType="text",N.setRequestHeader("Accept","application/json")),N.withCredentials=g.credentials==="include",N.onerror=()=>{v(new Error(N.statusText))},N.onload=()=>{if((N.status>=200&&N.status<300||N.status===0)&&N.response!==null){let C=N.response;if(g.type==="json")try{C=JSON.parse(N.response)}catch(F){return v(F)}const L=new Headers;N.getAllResponseHeaders().trim().split(/[\r\n]+/).forEach(F=>{const $=F.split(": "),K=$.shift(),Z=$.join(": ");L.append(K,Z)}),v(null,C,L)}else v(new yd(N.statusText,N.status,g.url))},N.send(g.body),{cancel:()=>N.abort()}}(f,c)},Eu=function(f,c){return Af(Object.assign(f,{type:"arrayBuffer"}),c)};function J3(f){const c=document.createElement("a");return c.href=f,c.protocol===location.protocol&&c.host===location.host}const Ok="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";let cx,Ws;cx=[],Ws=0;const Qy=function(f,c){if(Uo.supported&&(f.headers||(f.headers={}),f.headers.accept="image/webp,*/*"),Ws>=Es.MAX_PARALLEL_IMAGE_REQUESTS){const N={requestParameters:f,callback:c,cancelled:!1,cancel(){this.cancelled=!0}};return cx.push(N),N}Ws++;let h=!1;const g=()=>{if(!h)for(h=!0,Ws--;cx.length&&Ws{g(),N?c(N):C&&(self.createImageBitmap?function(F,$){const K=new Blob([new Uint8Array(F)],{type:"image/png"});createImageBitmap(K).then(Z=>{$(null,Z)}).catch(Z=>{$(new Error(`Could not load image because of ${Z.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`))})}(C,(F,$)=>c(F,$,L)):function(F,$){const K=new Image;K.onload=()=>{$(null,K),URL.revokeObjectURL(K.src),K.onload=null,requestAnimationFrame(()=>{K.src=Ok})},K.onerror=()=>$(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));const Z=new Blob([new Uint8Array(F)],{type:"image/png"});K.src=F.byteLength?URL.createObjectURL(Z):Ok}(C,(F,$)=>c(F,$,L)))});return{cancel:()=>{v.cancel(),g()}}};var Ov,Dk,Rk,Ef={exports:{}},Gm={exports:{}},dx={exports:{}},jt=function(){if(Rk)return Ef.exports;Rk=1;var f=(Ov||(Ov=1,Gm.exports=function(h,g){var v,N,C,L,F,$,K,Z;for(N=h.length-(v=3&h.length),C=g,F=3432918353,$=461845907,Z=0;Z>>16)*F&65535)<<16)&4294967295)<<15|K>>>17))*$+(((K>>>16)*$&65535)<<16)&4294967295)<<13|C>>>19))+((5*(C>>>16)&65535)<<16)&4294967295))+((58964+(L>>>16)&65535)<<16);switch(K=0,v){case 3:K^=(255&h.charCodeAt(Z+2))<<16;case 2:K^=(255&h.charCodeAt(Z+1))<<8;case 1:C^=K=(65535&(K=(K=(65535&(K^=255&h.charCodeAt(Z)))*F+(((K>>>16)*F&65535)<<16)&4294967295)<<15|K>>>17))*$+(((K>>>16)*$&65535)<<16)&4294967295}return C^=h.length,C=2246822507*(65535&(C^=C>>>16))+((2246822507*(C>>>16)&65535)<<16)&4294967295,C=3266489909*(65535&(C^=C>>>13))+((3266489909*(C>>>16)&65535)<<16)&4294967295,(C^=C>>>16)>>>0}),Gm.exports),c=(Dk||(Dk=1,dx.exports=function(h,g){for(var v,N=h.length,C=g^N,L=0;N>=4;)v=1540483477*(65535&(v=255&h.charCodeAt(L)|(255&h.charCodeAt(++L))<<8|(255&h.charCodeAt(++L))<<16|(255&h.charCodeAt(++L))<<24))+((1540483477*(v>>>16)&65535)<<16),C=1540483477*(65535&C)+((1540483477*(C>>>16)&65535)<<16)^(v=1540483477*(65535&(v^=v>>>24))+((1540483477*(v>>>16)&65535)<<16)),N-=4,++L;switch(N){case 3:C^=(255&h.charCodeAt(L+2))<<16;case 2:C^=(255&h.charCodeAt(L+1))<<8;case 1:C=1540483477*(65535&(C^=255&h.charCodeAt(L)))+((1540483477*(C>>>16)&65535)<<16)}return C=1540483477*(65535&(C^=C>>>13))+((1540483477*(C>>>16)&65535)<<16),(C^=C>>>15)>>>0}),dx.exports);return Ef.exports=f,Ef.exports.murmur3=f,Ef.exports.murmur2=c,Ef.exports}(),mr=Hs(jt);class Er{constructor(c,...h){Object.assign(this,h[0]||{}),this.type=c}}class rs extends Er{constructor(c,h={}){super("error",Object.assign({error:c},h))}}function ns(f,c,h){h[f]&&h[f].indexOf(c)!==-1||(h[f]=h[f]||[],h[f].push(c))}function na(f,c,h){if(h&&h[f]){const g=h[f].indexOf(c);g!==-1&&h[f].splice(g,1)}}class Is{on(c,h){return this._listeners=this._listeners||{},ns(c,h,this._listeners),this}off(c,h){return na(c,h,this._listeners),na(c,h,this._oneTimeListeners),this}once(c,h){return h?(this._oneTimeListeners=this._oneTimeListeners||{},ns(c,h,this._oneTimeListeners),this):new Promise(g=>{this.once(c,g)})}fire(c,h){const g=typeof c=="string"?new Er(c,h):c,v=g.type;if(this.listens(v)){g.target=this;const N=this._listeners&&this._listeners[v]?this._listeners[v].slice():[];for(const F of N)F.call(this,g);const C=this._oneTimeListeners&&this._oneTimeListeners[v]?this._oneTimeListeners[v].slice():[];for(const F of C)na(v,F,this._oneTimeListeners),F.call(this,g);const L=this._eventedParent;if(L){const F=typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData;Object.assign(g,F),L.fire(g)}}else g instanceof rs&&console.error(g.error);return this}listens(c){return!!(this._listeners&&this._listeners[c]&&this._listeners[c].length>0||this._oneTimeListeners&&this._oneTimeListeners[c]&&this._oneTimeListeners[c].length>0||this._eventedParent&&this._eventedParent.listens(c))}setEventedParent(c,h){return this._eventedParent=c,this._eventedParentData=h,this}}class _a{constructor(c){typeof c=="string"?this.name=c:(this.name=c.name,this.iconsetId=c.iconsetId)}static from(c){return new _a(c)}static toString(c){return c.iconsetId?`${c.name}${c.iconsetId}`:c.name}static parse(c){const[h,g]=c.split("");return new _a({name:h,iconsetId:g})}static isEqual(c,h){return c.name===h.name&&c.iconsetId===h.iconsetId}toString(){return _a.toString(this)}serialize(){return{name:this.name,iconsetId:this.iconsetId}}}var $h,cu={},El=function(){if($h)return cu;$h=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(N){return(N=Math.round(N))<0?0:N>255?255:N}function h(N){return c(N[N.length-1]==="%"?parseFloat(N)/100*255:parseInt(N))}function g(N){return(C=N[N.length-1]==="%"?parseFloat(N)/100:parseFloat(N))<0?0:C>1?1:C;var C}function v(N,C,L){return L<0?L+=1:L>1&&(L-=1),6*L<1?N+(C-N)*L*6:2*L<1?C:3*L<2?N+(C-N)*(2/3-L)*6:N}try{cu.parseCSSColor=function(N){var C,L=N.replace(/ /g,"").toLowerCase();if(L in f)return f[L].slice();if(L[0]==="#")return L.length===4?(C=parseInt(L.substr(1),16))>=0&&C<=4095?[(3840&C)>>4|(3840&C)>>8,240&C|(240&C)>>4,15&C|(15&C)<<4,1]:null:L.length===7&&(C=parseInt(L.substr(1),16))>=0&&C<=16777215?[(16711680&C)>>16,(65280&C)>>8,255&C,1]:null;var F=L.indexOf("("),$=L.indexOf(")");if(F!==-1&&$+1===L.length){var K=L.substr(0,F),Z=L.substr(F+1,$-(F+1)).split(","),X=1;switch(K){case"rgba":if(Z.length!==4)return null;X=g(Z.pop());case"rgb":return Z.length!==3?null:[h(Z[0]),h(Z[1]),h(Z[2]),X];case"hsla":if(Z.length!==4)return null;X=g(Z.pop());case"hsl":if(Z.length!==3)return null;var re=(parseFloat(Z[0])%360+360)%360/360,ae=g(Z[1]),me=g(Z[2]),Se=me<=.5?me*(ae+1):me+ae-me*ae,Ne=2*me-Se;return[c(255*v(Ne,Se,re+1/3)),c(255*v(Ne,Se,re)),c(255*v(Ne,Se,re-1/3)),X];default:return null}}return null}}catch{}return cu}();class ba{constructor(c,h,g,v=1){this.r=c,this.g=h,this.b=g,this.a=v}static parse(c){if(!c)return;if(c instanceof ba)return c;if(typeof c!="string")return;const h=El.parseCSSColor(c);return h?new ba(h[0]/255,h[1]/255,h[2]/255,h[3]):void 0}toString(){const[c,h,g,v]=[this.r,this.g,this.b,this.a];return`rgba(${Math.round(255*c)},${Math.round(255*h)},${Math.round(255*g)},${v})`}toNonPremultipliedRenderColor(c){const{r:h,g,b:v,a:N}=this;return new TP(c,h,g,v,N)}toPremultipliedRenderColor(c){const{r:h,g,b:v,a:N}=this;return new AP(c,h*N,g*N,v*N,N)}clone(){return new ba(this.r,this.g,this.b,this.a)}}class Fk{constructor(c,h,g,v,N,C=!1){if(this.premultiplied=!1,this.premultiplied=C,c){const L=c.image.height,F=L*L;this.premultiplied?(h=N===0?0:h/N*(L-1),g=N===0?0:g/N*(L-1),v=N===0?0:v/N*(L-1)):(h*=L-1,g*=L-1,v*=L-1);const $=Math.floor(h),K=Math.floor(g),Z=Math.floor(v),X=Math.ceil(h),re=Math.ceil(g),ae=Math.ceil(v),me=h-$,Se=g-K,Ne=v-Z,Fe=c.image.data,ze=4*($+K*F+Z*L),Xe=4*($+K*F+ae*L),gt=4*($+re*F+Z*L),ht=4*($+re*F+ae*L),bt=4*(X+K*F+Z*L),Ct=4*(X+K*F+ae*L),Et=4*(X+re*F+Z*L),Xt=4*(X+re*F+ae*L);if(ze<0||Xt>=Fe.length)throw new Error("out of range");this.r=zn(zn(zn(Fe[ze],Fe[Xe],Ne),zn(Fe[gt],Fe[ht],Ne),Se),zn(zn(Fe[bt],Fe[Ct],Ne),zn(Fe[Et],Fe[Xt],Ne),Se),me)/255*(this.premultiplied?N:1),this.g=zn(zn(zn(Fe[ze+1],Fe[Xe+1],Ne),zn(Fe[gt+1],Fe[ht+1],Ne),Se),zn(zn(Fe[bt+1],Fe[Ct+1],Ne),zn(Fe[Et+1],Fe[Xt+1],Ne),Se),me)/255*(this.premultiplied?N:1),this.b=zn(zn(zn(Fe[ze+2],Fe[Xe+2],Ne),zn(Fe[gt+2],Fe[ht+2],Ne),Se),zn(zn(Fe[bt+2],Fe[Ct+2],Ne),zn(Fe[Et+2],Fe[Xt+2],Ne),Se),me)/255*(this.premultiplied?N:1),this.a=N}else this.r=h,this.g=g,this.b=v,this.a=N}toArray(){const{r:c,g:h,b:g,a:v}=this;return[255*c,255*h,255*g,v]}toHslaArray(){let{r:c,g:h,b:g,a:v}=this;if(this.premultiplied){if(v===0)return[0,0,0,0];const ae=1/v;c*=ae,h*=ae,g*=ae}const N=Math.min(Math.max(c,0),1),C=Math.min(Math.max(h,0),1),L=Math.min(Math.max(g,0),1),F=Math.min(N,C,L),$=Math.max(N,C,L),K=$-F,Z=.5*(F+$);if(K===0)return[0,0,100*Z,v];const X=Z>.5?K/(2-$-F):K/($+F);let re;switch($){case N:re=60*((C-L)/K+(Czn(g,c[v],h))}ba.black=new ba(0,0,0,1),ba.white=new ba(1,1,1,1),ba.transparent=new ba(0,0,0,0),ba.red=new ba(1,0,0,1),ba.blue=new ba(0,0,1,1);var Dv=Object.freeze({__proto__:null,array:e5,color:function(f,c,h){return new ba(zn(f.r,c.r,h),zn(f.g,c.g,h),zn(f.b,c.b,h),zn(f.a,c.a,h))},number:zn});class oh extends Error{constructor(c,h){super(h),this.message=h,this.key=c}}class Jy{constructor(c,h=[]){this.parent=c,this.bindings={};for(const[g,v]of h)this.bindings[g]=v}concat(c){return new Jy(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 Uh={kind:"null"},_n={kind:"number"},sa={kind:"string"},Ua={kind:"boolean"},Wd={kind:"color"},If={kind:"object"},Pa={kind:"value"},zk={kind:"collator"},Rv={kind:"formatted"},Fv={kind:"resolvedImage"};function Ac(f,c){return{kind:"array",itemType:f,N:c}}function Oo(f){if(f.kind==="array"){const c=Oo(f.itemType);return typeof f.N=="number"?`array<${c}, ${f.N}>`:f.itemType.kind==="value"?"array":`array<${c}>`}return f.kind}const zie=[Uh,_n,sa,Ua,Wd,Rv,If,Ac(Pa),Fv];function Km(f,c){if(c.kind==="error")return null;if(f.kind==="array"){if(c.kind==="array"&&(c.N===0&&c.itemType.kind==="value"||!Km(f.itemType,c.itemType))&&(typeof f.N!="number"||f.N===c.N))return null}else{if(f.kind===c.kind)return null;if(f.kind==="value"){for(const h of zie)if(!Km(h,c))return null}}return`Expected ${Oo(f)} but found ${Oo(c)} instead.`}function t5(f,c){return c.some(h=>h.kind===f.kind)}function zv(f,c){return c.some(h=>h==="null"?f===null:h==="array"?Array.isArray(f):h==="object"?f&&!Array.isArray(f)&&typeof f=="object":h===typeof f)}function Bk(f,c){return f.kind==="array"&&c.kind==="array"?f.N===c.N&&Bk(f.itemType,c.itemType):f.kind===c.kind}class r5{constructor(c,h,g){this.sensitivity=c?h?"variant":"case":h?"accent":"base",this.locale=g,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(c,h){return this.collator.compare(c,h)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}class $k{constructor(c,h,g,v,N){this.text=c.normalize?c.normalize():c,this.image=h,this.scale=g,this.fontStack=v,this.textColor=N}}class vd{constructor(c){this.sections=c}static fromString(c){return new vd([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 vd?c:vd.fromString(c)}toString(){return this.sections.length===0?"":this.sections.map(c=>c.text).join("")}serialize(){const c=["format"];for(const h of this.sections){if(h.image){const v=h.image.getPrimary().id.toString();c.push(["image",v]);continue}c.push(h.text);const g={};h.fontStack&&(g["text-font"]=["literal",h.fontStack.split(",")]),h.scale&&(g["font-scale"]=h.scale),h.textColor&&(g["text-color"]=["rgba"].concat(h.textColor.toNonPremultipliedRenderColor(null).toArray())),c.push(g)}return c}}class Tp{constructor(c,h={}){this.id=_a.from(c),this.params=h.params,this.sx=h.sx||1,this.sy=h.sy||1}toString(){return JSON.stringify(this)}static parse(c){let h,g,v,N;try{({id:h,params:g,sx:v,sy:N}=JSON.parse(c)||{})}catch{return null}return h?new Tp(h,{params:g,sx:v,sy:N}):null}scaleSelf(c,h=c){return this.sx*=c,this.sy*=h,this}}class _d{constructor(c,h,g,v,N=!1){this.primaryId=_a.from(c),this.primaryOptions=h,g&&(this.secondaryId=_a.from(g)),this.secondaryOptions=v,this.available=N}toString(){return this.primaryId&&this.secondaryId?`[${this.primaryId.name},${this.secondaryId.name}]`:this.primaryId.name}hasPrimary(){return!!this.primaryId}getPrimary(){return new Tp(this.primaryId,this.primaryOptions)}hasSecondary(){return!!this.secondaryId}getSecondary(){return this.secondaryId?new Tp(this.secondaryId,this.secondaryOptions):null}static from(c){return typeof c=="string"?_d.build({name:c}):c}static build(c,h,g,v){return!c||typeof c=="object"&&!("name"in c)?null:new _d(c,g,h,v)}}function ux(f,c,h,g){return typeof f=="number"&&f>=0&&f<=255&&typeof c=="number"&&c>=0&&c<=255&&typeof h=="number"&&h>=0&&h<=255?g===void 0||typeof g=="number"&&g>=0&&g<=1?null:`Invalid rgba value [${[f,c,h,g].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof g=="number"?[f,c,h,g]:[f,c,h]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function e0(f){if(f===null||typeof f=="string"||typeof f=="boolean"||typeof f=="number"||f instanceof ba||f instanceof r5||f instanceof vd||f instanceof _d)return!0;if(Array.isArray(f)){for(const c of f)if(!e0(c))return!1;return!0}if(typeof f=="object"){for(const c in f)if(!e0(f[c]))return!1;return!0}return!1}function bl(f){if(f===null)return Uh;if(typeof f=="string")return sa;if(typeof f=="boolean")return Ua;if(typeof f=="number")return _n;if(f instanceof ba)return Wd;if(f instanceof r5)return zk;if(f instanceof vd)return Rv;if(f instanceof _d)return Fv;if(Array.isArray(f)){const c=f.length;let h;for(const g of f){const v=bl(g);if(h){if(h===v)continue;h=Pa;break}h=v}return Ac(h||Pa,c)}return If}function lh(f){const c=typeof f;return f===null?"":c==="string"||c==="number"||c==="boolean"?String(f):f instanceof vd||f instanceof _d||f instanceof ba?f.toString():JSON.stringify(f)}class Ap{constructor(c,h){this.type=c,this.value=h}static parse(c,h){if(c.length!==2)return h.error(`'literal' expression requires exactly one argument, but found ${c.length-1} instead.`);if(!e0(c[1]))return h.error("invalid value");const g=c[1];let v=bl(g);const N=h.expectedType;return v.kind!=="array"||v.N!==0||!N||N.kind!=="array"||typeof N.N=="number"&&N.N!==0||(v=N),new Ap(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 ba?["rgba"].concat(this.value.toNonPremultipliedRenderColor(null).toArray()):this.value instanceof vd?this.value.serialize():this.value}}class dl{constructor(c){this.name="ExpressionEvaluationError",this.message=c}toJSON(){return this.message}}const n5={string:sa,number:_n,boolean:Ua,object:If};class qh{constructor(c,h){this.type=c,this.args=h}static parse(c,h){if(c.length<2)return h.error("Expected at least one argument.");let g,v=1;const N=c[0];if(N==="array"){let L,F;if(c.length>2){const $=c[1];if(typeof $!="string"||!($ in n5)||$==="object")return h.error('The item type argument of "array" must be one of string, number, boolean',1);L=n5[$],v++}else L=Pa;if(c.length>3){if(c[2]!==null&&(typeof c[2]!="number"||c[2]<0||c[2]!==Math.floor(c[2])))return h.error('The length argument to "array" must be a positive integer literal',2);F=c[2],v++}g=Ac(L,F)}else g=n5[N];const C=[];for(;vc.outputDefined())}serialize(){const c=this.type,h=[c.kind];if(c.kind==="array"){const g=c.itemType;if(g.kind==="string"||g.kind==="number"||g.kind==="boolean"){h.push(g.kind);const v=c.N;(typeof v=="number"||this.args.length>1)&&h.push(v)}}return h.concat(this.args.map(g=>g.serialize()))}}class Pf{constructor(c){this.type=Rv,this.sections=c}static parse(c,h){if(c.length<2)return h.error("Expected at least one argument.");const g=c[1];if(!Array.isArray(g)&&typeof g=="object")return h.error("First argument must be an image or text section.");const v=[];let N=!1;for(let C=1;C<=c.length-1;++C){const L=c[C];if(N&&typeof L=="object"&&!Array.isArray(L)){N=!1;let F=null;if(L["font-scale"]&&(F=h.parseObjectValue(L["font-scale"],C,"font-scale",_n),!F))return null;let $=null;if(L["text-font"]&&($=h.parseObjectValue(L["text-font"],C,"text-font",Ac(sa)),!$))return null;let K=null;if(L["text-color"]&&(K=h.parseObjectValue(L["text-color"],C,"text-color",Wd),!K))return null;const Z=v[v.length-1];Z.scale=F,Z.font=$,Z.textColor=K}else{const F=h.parse(c[C],C,Pa);if(!F)return null;const $=F.type.kind;if($!=="string"&&$!=="value"&&$!=="null"&&$!=="resolvedImage")return h.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");N=!0,v.push({content:F,scale:null,font:null,textColor:null})}}return new Pf(v)}evaluate(c){return new vd(this.sections.map(h=>{const g=h.content.evaluate(c);return Bk(bl(g),Fv)?new $k("",g,null,null,null):new $k(lh(g),null,h.scale?h.scale.evaluate(c):null,h.font?h.font.evaluate(c).join(","):null,h.textColor?h.textColor.evaluate(c):null)}))}eachChild(c){for(const h of this.sections)c(h.content),h.scale&&c(h.scale),h.font&&c(h.font),h.textColor&&c(h.textColor)}outputDefined(){return!1}serialize(){const c=["format"];for(const h of this.sections){c.push(h.content.serialize());const g={};h.scale&&(g["font-scale"]=h.scale.serialize()),h.font&&(g["text-font"]=h.font.serialize()),h.textColor&&(g["text-color"]=h.textColor.serialize()),c.push(g)}return c}}class us{constructor(c,h,g,v){this._imageWarnHistory={},this.type=Fv,this.namePrimary=c,this.nameSecondary=h,g&&(this.paramsPrimary=g.params,this.iconsetIdPrimary=g.iconset?g.iconset.id:void 0),v&&(this.paramsSecondary=v.params,this.iconsetIdSecondary=v.iconset?v.iconset.id:void 0)}static parse(c,h){if(c.length<2)return h.error("Expected two or more arguments.");let g=1;const v=[];function N(){if(g_a.isEqual(C,N)),v.available){const C=v.getSecondary()?v.getSecondary().id:null;C&&(v.available=c.availableImages.some(L=>_a.isEqual(L,C)))}}return v}eachChild(c){if(c(this.namePrimary),this.paramsPrimary)for(const h in this.paramsPrimary)this.paramsPrimary[h]&&c(this.paramsPrimary[h]);if(this.nameSecondary&&(c(this.nameSecondary),this.paramsSecondary))for(const h in this.paramsSecondary)this.paramsSecondary[h]&&c(this.paramsSecondary[h])}outputDefined(){return!1}serializeOptions(c,h){const g={};if(h&&(g.iconset={id:h}),c){g.params={};for(const v in c)c[v]&&(g.params[v]=c[v].serialize())}return Object.keys(g).length>0?g:void 0}serialize(){const c=["image",this.namePrimary.serialize()];if(this.paramsPrimary||this.iconsetIdPrimary){const h=this.serializeOptions(this.paramsPrimary,this.iconsetIdPrimary);h&&c.push(h)}if(this.nameSecondary&&(c.push(this.nameSecondary.serialize()),this.paramsSecondary||this.iconsetIdSecondary)){const h=this.serializeOptions(this.paramsSecondary,this.iconsetIdSecondary);h&&c.push(h)}return c}}function gn(f){return Vn(f)?"string":t0(f)?"number":qk(f)?"boolean":Array.isArray(f)?"array":f===null?"null":Uk(f)?"object":typeof f}function Uk(f){return f!=null&&!Array.isArray(f)&&typeof f!="function"&&!(f instanceof String||f instanceof Number||f instanceof Boolean)&&typeof f=="object"}function Vn(f){return typeof f=="string"||f instanceof String}function t0(f){return typeof f=="number"||f instanceof Number}function qk(f){return typeof f=="boolean"||f instanceof Boolean}const $n={"to-boolean":Ua,"to-color":Wd,"to-number":_n,"to-string":sa};class Lf{constructor(c,h){this.type=c,this.args=h}static parse(c,h){if(c.length<2)return h.error("Expected at least one argument.");const g=c[0],v=[];let N=Uh;if(g==="to-array"){if(!Array.isArray(c[1]))return null;const C=c[1].length;if(h.expectedType){if(h.expectedType.kind!=="array")return h.error(`Expected ${h.expectedType.kind} but found array.`);N=Ac(h.expectedType.itemType,C)}else{if(!(C>0&&e0(c[1][0])))return null;N=Ac(bl(c[1][0]),C)}for(let L=0;L4?`Invalid rbga value ${JSON.stringify(h)}: expected an array containing either three or four numeric values.`:ux(h[0],h[1],h[2],h[3]),!g))return new ba(h[0]/255,h[1]/255,h[2]/255,h[3])}throw new dl(g||`Could not parse color from value '${typeof h=="string"?h:String(JSON.stringify(h))}'`)}if(this.type.kind==="number"){let h=null;for(const g of this.args){if(h=g.evaluate(c),h===null)return 0;const v=Number(h);if(!isNaN(v))return v}throw new dl(`Could not convert ${JSON.stringify(h)} to number.`)}return this.type.kind==="formatted"?vd.fromString(lh(this.args[0].evaluate(c))):this.type.kind==="resolvedImage"?_d.build(lh(this.args[0].evaluate(c))):this.type.kind==="array"?this.args.map(h=>h.evaluate(c)):lh(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 Pf([{content:this.args[0],scale:null,font:null,textColor:null}]).serialize();if(this.type.kind==="resolvedImage")return new us(this.args[0]).serialize();const c=this.type.kind==="array"?[]:[`to-${this.type.kind}`];return this.eachChild(h=>{c.push(h.serialize())}),c}}const s5=["Unknown","Point","LineString","Polygon"];class Vk{constructor(c,h,g){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null,this.featureTileCoord=null,this.featureDistanceData=null,this.scope=c,this.options=h,this.iconImageUseTheme=g}id(){return this.feature&&this.feature.id!==void 0?this.feature.id:null}geometryType(){return this.feature?typeof this.feature.type=="number"?s5[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}measureLight(c){return this.globals.brightness||0}distanceFromCenter(){if(this.featureTileCoord&&this.featureDistanceData){const c=this.featureDistanceData.center,h=this.featureDistanceData.scale,{x:g,y:v}=this.featureTileCoord;return this.featureDistanceData.bearing[0]*(g*h-c[0])+this.featureDistanceData.bearing[1]*(v*h-c[1])}return 0}parseColor(c){let h=this._parseColorCache[c];return h||(h=this._parseColorCache[c]=ba.parse(c)),h}getConfig(c){return this.options?this.options.get(c):null}}class bd{constructor(c,h,g,v,N){this.name=c,this.type=h,this._evaluate=g,this.args=v,this._overloadIndex=N}evaluate(c){if(!this._evaluate){const h=bd.definitions[this.name];this._evaluate=Array.isArray(h)?h[2]:h.overloads[this._overloadIndex][1]}return this._evaluate(c,this.args)}eachChild(c){this.args.forEach(c)}outputDefined(){return!1}serialize(){return[this.name].concat(this.args.map(c=>c.serialize()))}static parse(c,h){const g=c[0],v=bd.definitions[g];if(!v)return h.error(`Unknown expression "${g}". If you wanted a literal array, use ["literal", [...]].`,0);const N=Array.isArray(v)?v[0]:v.type,C=Array.isArray(v)?[[v[1],v[2]]]:v.overloads,L=[];let F=null,$=-1;for(const[K,Z]of C){if(Array.isArray(K)&&K.length!==c.length-1)continue;L.push(K),$++,F=new rN(h.registry,h.path,null,h.scope,void 0,h._scope,h.options,h.iconImageUseTheme);const X=[];let re=!1;for(let ae=1;aeX)).map(Hk).join(" | "),Z=[];for(let X=1;Xh;){if(g-h>600){const F=g-h+1,$=c-h+1,K=Math.log(F),Z=.5*Math.exp(2*K/3),X=.5*Math.sqrt(K*Z*(F-Z)/F)*($-F/2<0?-1:1);Wk(f,c,Math.max(h,Math.floor(c-$*Z/F+X)),Math.min(g,Math.floor(c+(F-$)*Z/F+X)),v)}const N=f[c];let C=h,L=g;for(Vh(f,h,c),v(f[g],N)>0&&Vh(f,h,g);C0;)L--}v(f[h],N)===0?Vh(f,h,L):(L++,Vh(f,L,g)),L<=c&&(h=L+1),c<=L&&(g=L-1)}}function Vh(f,c,h){const g=f[c];f[c]=f[h],f[h]=g}function a5(f,c){return fc?1:0}function Zm(f){let c=0;for(let h,g,v=0,N=f.length,C=N-1;v=c[2]||f[1]<=c[1]||f[3]>=c[3])}function Bie(f,c,h){const g=f[0]-c[0],v=f[1]-c[1],N=f[0]-h[0],C=f[1]-h[1];return g*C-N*v==0&&g*N<=0&&v*C<=0}function r0(f,c,h=!1){let g=!1;for(let L=0,F=c.length;L(v=f)[1]!=(C=ae)[1]>v[1]&&v[0]<(C[0]-N[0])*(v[1]-N[1])/(C[1]-N[1])+N[0]&&(g=!g)}}var v,N,C;return g}function $v(f,c,h,g){const v=g[0]-h[0],N=g[1]-h[1],C=(f[0]-h[0])*N-v*(f[1]-h[1]),L=(c[0]-h[0])*N-v*(c[1]-h[1]);return C>0&&L<0||C<0&&L>0}function Uv(f,c,h,g){return(v=[g[0]-h[0],g[1]-h[1]])[0]*(N=[c[0]-f[0],c[1]-f[1]])[1]-v[1]*N[0]!=0&&!(!$v(f,c,h,g)||!$v(h,g,f,c));var v,N}function Ep(f){const c=new sr(Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),h=new sr(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY);for(const g of f[0])c.x>g.x&&(c.x=g.x),c.y>g.y&&(c.y=g.y),h.xh[2]){const v=.5*g;let N=f[0]-h[0]>v?-g:h[0]-f[0]>v?g:0;N===0&&(N=f[0]-h[2]>v?-g:h[2]-f[0]>v?g:0),f[0]+=N}ch(c,f)}function LP(f,c,h,g){const v=Math.pow(2,g.z)*Ym,N=[g.x*Ym,g.y*Ym],C=[];if(!f)return C;for(const L of f)for(const F of L){const $=[F.x+N[0],F.y+N[1]];PP($,c,h,v),C.push($)}return C}function Gk(f,c,h,g){const v=Math.pow(2,g.z)*Ym,N=[g.x*Ym,g.y*Ym],C=[];if(!f)return C;for(const F of f){const $=[];for(const K of F){const Z=[K.x+N[0],K.y+N[1]];ch(c,Z),$.push(Z)}C.push($)}if(c[2]-c[0]<=v/2){(L=c)[0]=L[1]=1/0,L[2]=L[3]=-1/0;for(const F of C)for(const $ of F)PP($,c,h,v)}var L;return C}class Qm{constructor(c,h){this.type=Ua,this.geojson=c,this.geometries=h}static parse(c,h){if(c.length!==2)return h.error(`'within' expression requires exactly one argument, but found ${c.length-1} instead.`);if(e0(c[1])){const g=c[1];if(g.type==="FeatureCollection")for(let v=0;vh)return Kk(N,C,(h-(g-L))/L)}return c[c.length-1]}pointToSegmentDistance(c,h,g){let[v,N]=h,C=Iu(g[0]-v)*this.kx,L=(g[1]-N)*this.ky;if(C!==0||L!==0){const F=(Iu(c[0]-v)*this.kx*C+(c[1]-N)*this.ky*L)/(C*C+L*L);F>1?(v=g[0],N=g[1]):F>0&&(v+=C/this.kx*F,N+=L/this.ky*F)}return C=Iu(c[0]-v)*this.kx,L=(c[1]-N)*this.ky,Math.sqrt(C*C+L*L)}pointOnLine(c,h){let g=1/0,v=c[0][0],N=c[0][1],C=0,L=0;for(let F=0;F1?($=c[F+1][0],K=c[F+1][1]):re>0&&($+=Z/this.kx*re,K+=X/this.ky*re)),Z=Iu(h[0]-$)*this.kx,X=(h[1]-K)*this.ky;const ae=Z*Z+X*X;aeN.index||v.index===N.index&&v.t>N.t){const $=v;v=N,N=$}const C=[v.point],L=v.index+1,F=N.index;!l5(g[L],C[0])&&L<=F&&C.push(g[L]);for(let $=L+1;$<=F;$++)C.push(g[$]);return l5(g[F],N.point)||C.push(N.point),C}lineSliceAlong(c,h,g){let v=0;const N=[];for(let C=0;Cc&&N.length===0&&N.push(Kk(L,F,(c-(v-$))/$)),v>=h)return N.push(Kk(L,F,(h-(v-$))/$)),N;v>c&&N.push(F)}return N}bufferPoint(c,h){const g=h/this.ky,v=h/this.kx;return[c[0]-v,c[1]-g,c[0]+v,c[1]+g]}bufferBBox(c,h){const g=h/this.ky,v=h/this.kx;return[c[0]-v,c[1]-g,c[2]+v,c[3]+g]}insideBBox(c,h){return Iu(c[0]-h[0])>=0&&Iu(c[0]-h[2])<=0&&c[1]>=h[1]&&c[1]<=h[3]}}function l5(f,c){return f[0]===c[0]&&f[1]===c[1]}function Kk(f,c,h){const g=Iu(c[0]-f[0]);return[f[0]+g*h,f[1]+(c[1]-f[1])*h]}function Iu(f){for(;f<-180;)f+=360;for(;f>180;)f-=360;return f}class Zk{constructor(c=[],h=(g,v)=>gv?1:0){if(this.data=c,this.length=this.data.length,this.compare=h,this.length>0)for(let g=(this.length>>1)-1;g>=0;g--)this._down(g)}push(c){this.data.push(c),this._up(this.length++)}pop(){if(this.length===0)return;const c=this.data[0],h=this.data.pop();return--this.length>0&&(this.data[0]=h,this._down(0)),c}peek(){return this.data[0]}_up(c){const{data:h,compare:g}=this,v=h[c];for(;c>0;){const N=c-1>>1,C=h[N];if(g(v,C)>=0)break;h[c]=C,c=N}h[c]=v}_down(c){const{data:h,compare:g}=this,v=this.length>>1,N=h[c];for(;c=0)break;h[c]=h[C],c=C}h[c]=N}}var Cr=8192;function c5(f,c){return c.dist-f.dist}const Yk=100,Xk=50;function d5(f){const c=[1/0,1/0,-1/0,-1/0];if(c.length!==f.length)return!1;for(let h=0;h=f[0]&&f[1]f[1])return[null,null];const h=Vv(f);if(c){if(h===2)return[f,null];const g=Math.floor(h/2);return[[f[0],f[0]+g],[f[0]+g,f[1]]]}{if(h===1)return[f,null];const g=Math.floor(h/2)-1;return[[f[0],f[0]+g],[f[0]+g+1,f[1]]]}}function hx(f,c){const h=[1/0,1/0,-1/0,-1/0];if(!Of(c,f.length))return h;for(let g=c[0];g<=c[1];++g)ch(h,f[g]);return h}function fx(f){const c=[1/0,1/0,-1/0,-1/0];for(let h=0;hc[2]&&(g=f[0]-c[2]),f[1]>c[3]&&(v=f[1]-c[3]),f[3]=g)return g;if(Bv(v,N)){if(f5(f,c))return 0}else if(f5(c,f))return 0;let C=g;for(const L of f)for(let F=0,$=L.length,K=$-1;F<$;K=F++)for(const Z of c)for(let X=0,re=Z.length,ae=re-1;X=N)continue;const K=$.range1;if(Vv(K)<=L){if(!Of(K,f.length))return NaN;if(c){const Z=Wie(f,K,h,g);if((N=Math.min(N,Z))===0)return N}else for(let Z=K[0];Z<=K[1];++Z){const X=Hie(f[Z],h,g);if((N=Math.min(N,X))===0)return N}}else{const Z=u5(K,c);if(Z[0]!==null){const X=Jm(hx(f,Z[0]),F,g);X=C)continue;const Z=K.range1,X=K.range2;if(Vv(Z)<=F&&Vv(X)<=$){if(!Of(Z,f.length)||!Of(X,h.length))return NaN;if(c&&g?C=Math.min(C,aa(f,Z,h,X,v)):c||g?c&&!g?C=Math.min(C,h5(h,X,f,Z,v)):!c&&g&&(C=Math.min(C,h5(f,Z,h,X,v))):C=Math.min(C,Vie(f,Z,h,X,v)),C===0)return C}else{const re=u5(Z,c),ae=u5(X,g);Di(L,C,v,f,h,re[0],ae[0]),Di(L,C,v,f,h,re[0],ae[1]),Di(L,C,v,f,h,re[1],ae[0]),Di(L,C,v,f,h,re[1],ae[1])}}return C}function p5(f,c,h,g,v=1/0){let N=v;const C=hx(f,[0,f.length-1]);for(const L of h)if(!(N!==1/0&&Jm(C,hx(L,[0,L.length-1]),g)>=N)&&(N=Math.min(N,FP(f,c,L,!0,g,N)),N===0))return N;return N}function eN(f,c,h,g,v=1/0){let N=v;const C=hx(f,[0,f.length-1]);for(const L of h){if(N!==1/0&&Jm(C,fx(L),g)>=N)continue;const F=Kie(f,c,L,g,N);if(isNaN(F))return F;if((N=Math.min(N,F))===0)return N}return N}function m5(f){return f==="Point"||f==="MultiPoint"||f==="LineString"||f==="MultiLineString"||f==="Polygon"||f==="MultiPolygon"}class px{constructor(c,h){this.type=_n,this.geojson=c,this.geometries=h}static parse(c,h){if(c.length!==2)return h.error(`'distance' expression requires either one argument, but found ' ${c.length-1} instead.`);if(e0(c[1])){const g=c[1];if(g.type==="FeatureCollection"){for(let v=0;v{c&&!a0(h)&&(c=!1)}),c}function Hv(f){if(f instanceof bd&&f.name==="feature-state")return!1;let c=!0;return f.eachChild(h=>{c&&!Hv(h)&&(c=!1)}),c}function i0(f,c){if(f instanceof bd&&c.indexOf(f.name)>=0)return!1;let h=!0;return f.eachChild(g=>{h&&!i0(g,c)&&(h=!1)}),h}function zP(f,c,h){return[f,c,h].filter(Boolean).join("")}function g5(f,c){switch(f){case"string":return lh(c);case"number":return+c;case"boolean":return!!c;case"color":return ba.parse(c);case"formatted":return vd.fromString(lh(c));case"resolvedImage":return _d.build(lh(c))}return c}function BP(f,c,h,g){return g!==void 0&&(f=g*Math.round(f/g)),c!==void 0&&fh&&(f=h),f}class o0{constructor(c,h,g,v=!1){this.type=c,this.key=h,this.scope=g,this.featureConstant=v}static parse(c,h){let g=h.expectedType;if(g==null&&(g=Pa),c.length<2||c.length>3)return h.error("Invalid number of arguments for 'config' expression.");const v=h.parse(c[1],1);if(!(v instanceof Ap))return h.error("Key name of 'config' expression must be a string literal.");let N,C=!0;const L=lh(v.value);if(c.length>=3){const F=h.parse(c[2],2);if(!(F instanceof Ap))return h.error("Scope of 'config' expression must be a string literal.");N=lh(F.value)}if(h.options){const F=zP(L,N,h._scope),$=h.options.get(F);$&&(C=a0($.value||$.default))}return new o0(g,L,N,C)}evaluate(c){const h=zP(this.key,this.scope,c.scope),g=c.getConfig(h);if(!g)return null;const{type:v,value:N,values:C,minValue:L,maxValue:F,stepValue:$}=g,K=g.default.evaluate(c);let Z=K;if(N){const X=c.scope;c.scope=(X||"").split("").slice(1).join(""),Z=N.evaluate(c),c.scope=X}return v&&(Z=g5(v,Z)),Z===void 0||L===void 0&&F===void 0&&$===void 0||(typeof Z=="number"?Z=BP(Z,L,F,$):Array.isArray(Z)&&(Z=Z.map(X=>typeof X=="number"?BP(X,L,F,$):X))),N!==void 0&&Z!==void 0&&C&&!C.includes(Z)&&(Z=K,v&&(Z=g5(v,Z))),(v&&v!==this.type||Z!==void 0&&!Bk(bl(Z),this.type))&&(Z=g5(this.type.kind,Z)),Z}eachChild(){}outputDefined(){return!1}serialize(){const c=["config",this.key];return this.scope&&c.concat(this.scope),c}}class tN{constructor(c,h){this.type=h.type,this.name=c,this.boundExpression=h}static parse(c,h){if(c.length!==2||typeof c[1]!="string")return h.error("'var' expression requires exactly one string literal argument.");const g=c[1];return h.scope.has(g)?new tN(g,h.scope.get(g)):h.error(`Unknown variable "${g}". Make sure "${g}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(c){return this.boundExpression.evaluate(c)}eachChild(){}outputDefined(){return!1}serialize(){return["var",this.name]}}class rN{constructor(c,h=[],g,v=new Jy,N=[],C,L,F){this.registry=c,this.path=h,this.key=h.map($=>typeof $=="string"?`['${$}']`:`[${$}]`).join(""),this.scope=v,this.errors=N,this.expectedType=g,this._scope=C,this.options=L,this.iconImageUseTheme=F}parse(c,h,g,v,N={}){return h||g?this.concat(h,null,g,v)._parse(c,N):this._parse(c,N)}parseObjectValue(c,h,g,v,N,C={}){return this.concat(h,g,v,N)._parse(c,C)}_parse(c,h){function g(v,N,C){return C==="assert"?new qh(N,[v]):C==="coerce"?new Lf(N,[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 N=v.parse(c,this);if(!N)return null;if(this.expectedType){const C=this.expectedType,L=N.type;if(C.kind!=="string"&&C.kind!=="number"&&C.kind!=="boolean"&&C.kind!=="object"&&C.kind!=="array"||L.kind!=="value")if(C.kind!=="color"&&C.kind!=="formatted"&&C.kind!=="resolvedImage"||L.kind!=="value"&&L.kind!=="string"){if(this.checkSubtype(C,L))return null}else N=g(N,C,h.typeAnnotation||"coerce");else N=g(N,C,h.typeAnnotation||"assert")}if(!(N instanceof Ap)&&N.type.kind!=="resolvedImage"&&x5(N)){const C=new Vk(this._scope,this.options,this.iconImageUseTheme);try{N=new Ap(N.type,N.evaluate(C))}catch(L){return this.error(L.message),null}}return N}return Lf.parse(["to-array",c],this)}return this.error(c===void 0?"'undefined' value invalid. Use null instead.":typeof c=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof c} instead.`)}concat(c,h,g,v){let N=typeof c=="number"?this.path.concat(c):this.path;N=typeof h=="string"?N.concat(h):N;const C=v?this.scope.concat(v):this.scope;return new rN(this.registry,N,g||null,C,this.errors,this._scope,this.options,this.iconImageUseTheme)}error(c,...h){const g=`${this.key}${h.map(v=>`[${v}]`).join("")}`;this.errors.push(new oh(g,c))}checkSubtype(c,h){const g=Km(c,h);return g&&this.error(g),g}}function x5(f){if(f instanceof tN)return x5(f.boundExpression);if(f instanceof bd&&f.name==="error"||f instanceof Il||f instanceof Qm||f instanceof px||f instanceof o0)return!1;const c=f instanceof Lf||f instanceof qh;let h=!0;return f.eachChild(g=>{h=c?h&&x5(g):h&&g instanceof Ap}),!!h&&a0(f)&&i0(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 nN(f,c){const h=f.length-1;let g,v,N=0,C=h,L=0;for(;N<=C;)if(L=Math.floor((N+C)/2),g=f[L],v=f[L+1],g<=c){if(L===h||cc))throw new dl("Input is not a number.");C=L-1}return 0}class Wv{constructor(c,h,g){this.type=c,this.input=h,this.labels=[],this.outputs=[];for(const[v,N]of g)this.labels.push(v),this.outputs.push(N)}static parse(c,h){if(c.length-1<4)return h.error(`Expected at least 4 arguments, but found only ${c.length-1}.`);if((c.length-1)%2!=0)return h.error("Expected an even number of arguments.");const g=h.parse(c[1],1,_n);if(!g)return null;const v=[];let N=null;h.expectedType&&h.expectedType.kind!=="value"&&(N=h.expectedType);for(let C=1;C=L)return h.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',$);const Z=h.parse(F,K,N);if(!Z)return null;N=N||Z.type,v.push([L,Z])}return new Wv(N,g,v)}evaluate(c){const h=this.labels,g=this.outputs;if(h.length===1)return g[0].evaluate(c);const v=this.input.evaluate(c);if(v<=h[0])return g[0].evaluate(c);const N=h.length;return v>=h[N-1]?g[N-1].evaluate(c):g[nN(h,v)].evaluate(c)}eachChild(c){c(this.input);for(const h of this.outputs)c(h)}outputDefined(){return this.outputs.every(c=>c.outputDefined())}serialize(){const c=["step",this.input.serialize()];for(let h=0;h0&&c.push(this.labels[h]),c.push(this.outputs[h].serialize());return c}}const $P=.95047,UP=1.08883,qP=4/29,l0=6/29,VP=3*l0*l0,Zie=l0*l0*l0,Yie=Math.PI/180,Xie=180/Math.PI;function y5(f){return f>Zie?Math.pow(f,1/3):f/VP+qP}function v5(f){return f>l0?f*f*f:VP*(f-qP)}function _5(f){return 255*(f<=.0031308?12.92*f:1.055*Math.pow(f,1/2.4)-.055)}function b5(f){return(f/=255)<=.04045?f/12.92:Math.pow((f+.055)/1.055,2.4)}function HP(f){const c=b5(f.r),h=b5(f.g),g=b5(f.b),v=y5((.4124564*c+.3575761*h+.1804375*g)/$P),N=y5((.2126729*c+.7151522*h+.072175*g)/1);return{l:116*N-16,a:500*(v-N),b:200*(N-y5((.0193339*c+.119192*h+.9503041*g)/UP)),alpha:f.a}}function sN(f){let c=(f.l+16)/116,h=isNaN(f.a)?c:c+f.a/500,g=isNaN(f.b)?c:c-f.b/200;return c=1*v5(c),h=$P*v5(h),g=UP*v5(g),new ba(_5(3.2404542*h-1.5371385*c-.4985314*g),_5(-.969266*h+1.8760108*c+.041556*g),_5(.0556434*h-.2040259*c+1.0572252*g),f.alpha)}function aN(f,c,h){const g=c-f;return f+h*(g>180||g<-180?g-360*Math.round(g/360):g)}const c0={forward:HP,reverse:sN,interpolate:function(f,c,h){return{l:zn(f.l,c.l,h),a:zn(f.a,c.a,h),b:zn(f.b,c.b,h),alpha:zn(f.alpha,c.alpha,h)}}},Gv={forward:function(f){const{l:c,a:h,b:g}=HP(f),v=Math.atan2(g,h)*Xie;return{h:v<0?v+360:v,c:Math.sqrt(h*h+g*g),l:c,alpha:f.a}},reverse:function(f){const c=f.h*Yie,h=f.c;return sN({l:f.l,a:Math.cos(c)*h,b:Math.sin(c)*h,alpha:f.alpha})},interpolate:function(f,c,h){return{h:aN(f.h,c.h,h),c:zn(f.c,c.c,h),l:zn(f.l,c.l,h),alpha:zn(f.alpha,c.alpha,h)}}};var WP=Object.freeze({__proto__:null,hcl:Gv,lab:c0});class Pu{constructor(c,h,g,v,N){this.type=c,this.operator=h,this.interpolation=g,this.input=v,this.labels=[],this.outputs=[];for(const[C,L]of N)this.labels.push(C),this.outputs.push(L)}static interpolationFactor(c,h,g,v){let N=0;if(c.name==="exponential")N=iN(h,c.base,g,v);else if(c.name==="linear")N=iN(h,1,g,v);else if(c.name==="cubic-bezier"){const C=c.controlPoints;N=new bi(C[0],C[1],C[2],C[3]).solve(iN(h,1,g,v))}return N}static parse(c,h){let[g,v,N,...C]=c;if(!Array.isArray(v)||v.length===0)return h.error("Expected an interpolation type expression.",1);if(v[0]==="linear")v={name:"linear"};else if(v[0]==="exponential"){const $=v[1];if(typeof $!="number")return h.error("Exponential interpolation requires a numeric base.",1,1);v={name:"exponential",base:$}}else{if(v[0]!=="cubic-bezier")return h.error(`Unknown interpolation type ${String(v[0])}`,1,0);{const $=v.slice(1);if($.length!==4||$.some(K=>typeof K!="number"||K<0||K>1))return h.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);v={name:"cubic-bezier",controlPoints:$}}}if(c.length-1<4)return h.error(`Expected at least 4 arguments, but found only ${c.length-1}.`);if(c.length-1>3&&(c.length-1)%2!=0)return h.error("Expected an even number of arguments.");if(N=h.parse(N,2,_n),!N)return null;const L=[];let F=null;g==="interpolate-hcl"||g==="interpolate-lab"?F=Wd:h.expectedType&&h.expectedType.kind!=="value"&&(F=h.expectedType);for(let $=0;$=K)return h.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',X);const ae=h.parse(Z,re,F);if(!ae)return null;F=F||ae.type,L.push([K,ae])}return F.kind==="number"||F.kind==="color"||F.kind==="array"&&F.itemType.kind==="number"&&typeof F.N=="number"?new Pu(F,g,v,N,L):h.error(`Type ${Oo(F)} is not interpolatable.`)}evaluate(c){const h=this.labels,g=this.outputs;if(h.length===1)return g[0].evaluate(c);const v=this.input.evaluate(c);if(v<=h[0])return g[0].evaluate(c);const N=h.length;if(v>=h[N-1])return g[N-1].evaluate(c);const C=nN(h,v),L=Pu.interpolationFactor(this.interpolation,v,h[C],h[C+1]),F=g[C].evaluate(c),$=g[C+1].evaluate(c);return this.operator==="interpolate"?Dv[this.type.kind.toLowerCase()](F,$,L):this.operator==="interpolate-hcl"?Gv.reverse(Gv.interpolate(Gv.forward(F),Gv.forward($),L)):c0.reverse(c0.interpolate(c0.forward(F),c0.forward($),L))}eachChild(c){c(this.input);for(const h of this.outputs)c(h)}outputDefined(){return this.outputs.every(c=>c.outputDefined())}serialize(){let c;c=this.interpolation.name==="linear"?["linear"]:this.interpolation.name==="exponential"?this.interpolation.base===1?["linear"]:["exponential",this.interpolation.base]:["cubic-bezier",...this.interpolation.controlPoints];const h=[this.operator,c,this.input.serialize()];for(let g=0;gKm(v,L.type));return new Kv(C?Pa:g,N)}evaluate(c){let h,g=null,v=0;for(const N of this.args){if(v++,g=N.evaluate(c),g&&g instanceof _d&&!g.available&&(h||(h=g),g=null,v===this.args.length))return h;if(g!==null)break}return g}eachChild(c){this.args.forEach(c)}outputDefined(){return this.args.every(c=>c.outputDefined())}serialize(){const c=["coalesce"];return this.eachChild(h=>{c.push(h.serialize())}),c}}class Ip{constructor(c,h){this.type=h.type,this.bindings=[].concat(c),this.result=h}evaluate(c){return this.result.evaluate(c)}eachChild(c){for(const h of this.bindings)c(h[1]);c(this.result)}static parse(c,h){if(c.length<4)return h.error(`Expected at least 3 arguments, but found ${c.length-1} instead.`);const g=[];for(let N=1;N=g.length)throw new dl("Array index out of bounds: index exceeds array size");if(h!==Math.floor(h))throw new dl("Array index must be an integer. Use at-interpolated for fractional indices");return g[h]}eachChild(c){c(this.index),c(this.input)}outputDefined(){return!1}serialize(){return["at",this.index.serialize(),this.input.serialize()]}}class lN{constructor(c,h,g){this.type=c,this.index=h,this.input=g}static parse(c,h){if(c.length!==3)return h.error(`Expected 2 arguments, but found ${c.length-1} instead.`);const g=h.parse(c[1],1,_n),v=h.parse(c[2],2,Ac(h.expectedType||Pa));return g&&v?new lN(v.type.itemType,g,v):null}evaluate(c){const h=this.index.evaluate(c),g=this.input.evaluate(c);if(h<0)throw new dl(`Array index out of bounds: ${h} < 0.`);if(h>g.length-1)throw new dl(`Array index out of bounds: ${h} > ${g.length-1}.`);if(h===Math.floor(h))return g[h];const v=Math.floor(h),N=Math.ceil(h),C=g[v],L=g[N];if(typeof C!="number"||typeof L!="number")throw new dl(`Cannot interpolate between non-number values at index ${h}.`);const F=h-v;return C*(1-F)+L*F}eachChild(c){c(this.index),c(this.input)}outputDefined(){return!1}serialize(){return["at-interpolated",this.index.serialize(),this.input.serialize()]}}class w5{constructor(c,h){this.type=Ua,this.needle=c,this.haystack=h}static parse(c,h){if(c.length!==3)return h.error(`Expected 2 arguments, but found ${c.length-1} instead.`);const g=h.parse(c[1],1,Pa),v=h.parse(c[2],2,Pa);return g&&v?t5(g.type,[Ua,sa,_n,Uh,Pa])?new w5(g,v):h.error(`Expected first argument to be of type boolean, string, number or null, but found ${Oo(g.type)} instead`):null}evaluate(c){const h=this.needle.evaluate(c),g=this.haystack.evaluate(c);if(g==null)return!1;if(!zv(h,["boolean","string","number","null"]))throw new dl(`Expected first argument to be of type boolean, string, number or null, but found ${Oo(bl(h))} instead.`);if(!zv(g,["string","array"]))throw new dl(`Expected second argument to be of type array or string, but found ${Oo(bl(g))} instead.`);return g.indexOf(h)>=0}eachChild(c){c(this.needle),c(this.haystack)}outputDefined(){return!0}serialize(){return["in",this.needle.serialize(),this.haystack.serialize()]}}class d0{constructor(c,h,g){this.type=_n,this.needle=c,this.haystack=h,this.fromIndex=g}static parse(c,h){if(c.length<=2||c.length>=5)return h.error(`Expected 3 or 4 arguments, but found ${c.length-1} instead.`);const g=h.parse(c[1],1,Pa),v=h.parse(c[2],2,Pa);if(!g||!v)return null;if(!t5(g.type,[Ua,sa,_n,Uh,Pa]))return h.error(`Expected first argument to be of type boolean, string, number or null, but found ${Oo(g.type)} instead`);if(c.length===4){const N=h.parse(c[3],3,_n);return N?new d0(g,v,N):null}return new d0(g,v)}evaluate(c){const h=this.needle.evaluate(c),g=this.haystack.evaluate(c);if(!zv(h,["boolean","string","number","null"]))throw new dl(`Expected first argument to be of type boolean, string, number or null, but found ${Oo(bl(h))} instead.`);if(!zv(g,["string","array"]))throw new dl(`Expected second argument to be of type array or string, but found ${Oo(bl(g))} instead.`);if(this.fromIndex){const v=this.fromIndex.evaluate(c);return g.indexOf(h,v)}return g.indexOf(h)}eachChild(c){c(this.needle),c(this.haystack),this.fromIndex&&c(this.fromIndex)}outputDefined(){return!1}serialize(){if(this.fromIndex!=null&&this.fromIndex!==void 0){const c=this.fromIndex.serialize();return["index-of",this.needle.serialize(),this.haystack.serialize(),c]}return["index-of",this.needle.serialize(),this.haystack.serialize()]}}class Zv{constructor(c,h,g,v,N,C){this.inputType=c,this.type=h,this.input=g,this.cases=v,this.outputs=N,this.otherwise=C}static parse(c,h){if(c.length<5)return h.error(`Expected at least 4 arguments, but found only ${c.length-1}.`);if(c.length%2!=1)return h.error("Expected an even number of arguments.");let g,v;h.expectedType&&h.expectedType.kind!=="value"&&(v=h.expectedType);const N={},C=[];for(let $=2;$Number.MAX_SAFE_INTEGER)return X.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof ae=="number"&&Math.floor(ae)!==ae)return X.error("Numeric branch labels must be integer values.");if(g){if(X.checkSubtype(g,bl(ae)))return null}else g=bl(ae);if(N[String(ae)]!==void 0)return X.error("Branch labels must be unique.");N[String(ae)]=C.length}const re=h.parse(Z,$,v);if(!re)return null;v=v||re.type,C.push(re)}const L=h.parse(c[1],1,Pa);if(!L)return null;const F=h.parse(c[c.length-1],c.length-1,v);return F?L.type.kind!=="value"&&h.concat(1).checkSubtype(g,L.type)?null:new Zv(g,v,L,N,C,F):null}evaluate(c){const h=this.input.evaluate(c);return(Bk(bl(h),this.inputType)&&this.outputs[this.cases[h]]||this.otherwise).evaluate(c)}eachChild(c){c(this.input),this.outputs.forEach(c),c(this.otherwise)}outputDefined(){return this.outputs.every(c=>c.outputDefined())&&this.otherwise.outputDefined()}serialize(){const c=["match",this.input.serialize()],h=Object.keys(this.cases).sort(),g=[],v={};for(const C of h){const L=v[this.cases[C]];L===void 0?(v[this.cases[C]]=g.length,g.push([this.cases[C],[C]])):g[L][1].push(C)}const N=C=>this.inputType.kind==="number"?Number(C):C;for(const[C,L]of g)c.push(L.length===1?N(L[0]):L.map(N)),c.push(this.outputs[C].serialize());return c.push(this.otherwise.serialize()),c}}class Yv{constructor(c,h,g){this.type=c,this.branches=h,this.otherwise=g}static parse(c,h){if(c.length<4)return h.error(`Expected at least 3 arguments, but found only ${c.length-1}.`);if(c.length%2!=0)return h.error("Expected an odd number of arguments.");let g;h.expectedType&&h.expectedType.kind!=="value"&&(g=h.expectedType);const v=[];for(let C=1;Ch.outputDefined())&&this.otherwise.outputDefined()}serialize(){const c=["case"];return this.eachChild(h=>{c.push(h.serialize())}),c}}class cN{constructor(c,h,g,v){this.type=c,this.input=h,this.beginIndex=g,this.endIndex=v}static parse(c,h){if(c.length<=2||c.length>=5)return h.error(`Expected 3 or 4 arguments, but found ${c.length-1} instead.`);const g=h.parse(c[1],1,Pa),v=h.parse(c[2],2,_n);if(!g||!v)return null;if(!t5(g.type,[Ac(Pa),sa,Pa]))return h.error(`Expected first argument to be of type array or string, but found ${Oo(g.type)} instead`);if(c.length===4){const N=h.parse(c[3],3,_n);return N?new cN(g.type,g,v,N):null}return new cN(g.type,g,v)}evaluate(c){const h=this.input.evaluate(c),g=this.beginIndex.evaluate(c);if(!zv(h,["string","array"]))throw new dl(`Expected first argument to be of type array or string, but found ${Oo(bl(h))} instead.`);if(this.endIndex){const v=this.endIndex.evaluate(c);return h.slice(g,v)}return h.slice(g)}eachChild(c){c(this.input),c(this.beginIndex),this.endIndex&&c(this.endIndex)}outputDefined(){return!1}serialize(){if(this.endIndex!=null&&this.endIndex!==void 0){const c=this.endIndex.serialize();return["slice",this.input.serialize(),this.beginIndex.serialize(),c]}return["slice",this.input.serialize(),this.beginIndex.serialize()]}}class j5{constructor(c,h){this.type=Ac(sa),this.str=c,this.delimiter=h}static parse(c,h){if(c.length!==3)return h.error(`Expected 2 arguments, but found ${c.length-1} instead.`);const g=h.parse(c[1],1,sa),v=h.parse(c[2],2,sa);return g&&v?new j5(g,v):void 0}evaluate(c){const h=this.str.evaluate(c),g=this.delimiter.evaluate(c);return h.split(g)}eachChild(c){c(this.str),c(this.delimiter)}outputDefined(){return!1}serialize(){return["split",this.str.serialize(),this.delimiter.serialize()]}}function k5(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 N5(f,c,h,g){return g.compare(c,h)===0}function u0(f,c,h){const g=f!=="=="&&f!=="!=";return class OOe{constructor(N,C,L){this.type=Ua,this.lhs=N,this.rhs=C,this.collator=L,this.hasUntypedArgument=N.type.kind==="value"||C.type.kind==="value"}static parse(N,C){if(N.length!==3&&N.length!==4)return C.error("Expected two or three arguments.");const L=N[0];let F=C.parse(N[1],1,Pa);if(!F)return null;if(!k5(L,F.type))return C.concat(1).error(`"${L}" comparisons are not supported for type '${Oo(F.type)}'.`);let $=C.parse(N[2],2,Pa);if(!$)return null;if(!k5(L,$.type))return C.concat(2).error(`"${L}" comparisons are not supported for type '${Oo($.type)}'.`);if(F.type.kind!==$.type.kind&&F.type.kind!=="value"&&$.type.kind!=="value")return C.error(`Cannot compare types '${Oo(F.type)}' and '${Oo($.type)}'.`);g&&(F.type.kind==="value"&&$.type.kind!=="value"?F=new qh($.type,[F]):F.type.kind!=="value"&&$.type.kind==="value"&&($=new qh(F.type,[$])));let K=null;if(N.length===4){if(F.type.kind!=="string"&&$.type.kind!=="string"&&F.type.kind!=="value"&&$.type.kind!=="value")return C.error("Cannot use collator to compare non-string types.");if(K=C.parse(N[3],3,zk),!K)return null}return new OOe(F,$,K)}evaluate(N){const C=this.lhs.evaluate(N),L=this.rhs.evaluate(N);if(g&&this.hasUntypedArgument){const F=bl(C),$=bl(L);if(F.kind!==$.kind||F.kind!=="string"&&F.kind!=="number")throw new dl(`Expected arguments for "${f}" to be (string, string) or (number, number), but found (${F.kind}, ${$.kind}) instead.`)}if(this.collator&&!g&&this.hasUntypedArgument){const F=bl(C),$=bl(L);if(F.kind!=="string"||$.kind!=="string")return c(N,C,L)}return this.collator?h(N,C,L,this.collator.evaluate(N)):c(N,C,L)}eachChild(N){N(this.lhs),N(this.rhs),this.collator&&N(this.collator)}outputDefined(){return!0}serialize(){const N=[f];return this.eachChild(C=>{N.push(C.serialize())}),N}}}const Qie=u0("==",function(f,c,h){return c===h},N5),Jie=u0("!=",function(f,c,h){return c!==h},function(f,c,h,g){return!N5(0,c,h,g)}),GP=u0("<",function(f,c,h){return c",function(f,c,h){return c>h},function(f,c,h,g){return g.compare(c,h)>0}),dN=u0("<=",function(f,c,h){return c<=h},function(f,c,h,g){return g.compare(c,h)<=0}),eoe=u0(">=",function(f,c,h){return c>=h},function(f,c,h,g){return g.compare(c,h)>=0});class uN{constructor(c,h,g,v,N,C){this.type=sa,this.number=c,this.locale=h,this.currency=g,this.unit=v,this.minFractionDigits=N,this.maxFractionDigits=C}static parse(c,h){if(c.length!==3)return h.error("Expected two arguments.");const g=h.parse(c[1],1,_n);if(!g)return null;const v=c[2];if(typeof v!="object"||Array.isArray(v))return h.error("NumberFormat options argument must be an object.");let N=null;if(v.locale&&(N=h.parseObjectValue(v.locale,2,"locale",sa),!N))return null;let C=null;if(v.currency&&(C=h.parseObjectValue(v.currency,2,"currency",sa),!C))return null;let L=null;if(v.unit&&(L=h.parseObjectValue(v.unit,2,"unit",sa),!L))return null;let F=null;if(v["min-fraction-digits"]&&(F=h.parseObjectValue(v["min-fraction-digits"],2,"min-fraction-digits",_n),!F))return null;let $=null;return v["max-fraction-digits"]&&($=h.parseObjectValue(v["max-fraction-digits"],2,"max-fraction-digits",_n),!$)?null:new uN(g,N,C,L,F,$)}evaluate(c){return new Intl.NumberFormat(this.locale?this.locale.evaluate(c):[],{style:(this.currency?"currency":this.unit&&"unit")||"decimal",currency:this.currency?this.currency.evaluate(c):void 0,unit:this.unit?this.unit.evaluate(c):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(c):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(c):void 0}).format(this.number.evaluate(c))}eachChild(c){c(this.number),this.locale&&c(this.locale),this.currency&&c(this.currency),this.unit&&c(this.unit),this.minFractionDigits&&c(this.minFractionDigits),this.maxFractionDigits&&c(this.maxFractionDigits)}outputDefined(){return!1}serialize(){const c={};return this.locale&&(c.locale=this.locale.serialize()),this.currency&&(c.currency=this.currency.serialize()),this.unit&&(c.unit=this.unit.serialize()),this.minFractionDigits&&(c["min-fraction-digits"]=this.minFractionDigits.serialize()),this.maxFractionDigits&&(c["max-fraction-digits"]=this.maxFractionDigits.serialize()),["number-format",this.number.serialize(),c]}}class S5{constructor(c){this.type=_n,this.input=c}static parse(c,h){if(c.length!==2)return h.error(`Expected 1 argument, but found ${c.length-1} instead.`);const g=h.parse(c[1],1);return g?g.type.kind!=="array"&&g.type.kind!=="string"&&g.type.kind!=="value"?h.error(`Expected argument of type string or array, but found ${Oo(g.type)} instead.`):new S5(g):null}evaluate(c){const h=this.input.evaluate(c);if(typeof h=="string"||Array.isArray(h))return h.length;throw new dl(`Expected value to be of type string or array, but found ${Oo(bl(h))} instead.`)}eachChild(c){c(this.input)}outputDefined(){return!1}serialize(){const c=["length"];return this.eachChild(h=>{c.push(h.serialize())}),c}}function ZP(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 h0={"==":Qie,"!=":Jie,">":KP,"<":GP,">=":eoe,"<=":dN,array:qh,at:oN,"at-interpolated":lN,boolean:qh,case:Yv,coalesce:Kv,collator:Il,format:Pf,image:us,in:w5,"index-of":d0,interpolate:Pu,"interpolate-hcl":Pu,"interpolate-lab":Pu,length:S5,let:Ip,literal:Ap,match:Zv,number:qh,"number-format":uN,object:qh,slice:cN,step:Wv,string:qh,"to-boolean":Lf,"to-color":Lf,"to-number":Lf,"to-string":Lf,var:tN,within:Qm,distance:px,config:o0,split:j5};function C5(f,[c,h,g,v]){c=c.evaluate(f),h=h.evaluate(f),g=g.evaluate(f);const N=v?v.evaluate(f):1,C=ux(c,h,g,N);if(C)throw new dl(C);return new ba(c/255,h/255,g/255,N)}function M5(f,[c,h,g,v]){c=c.evaluate(f),h=h.evaluate(f),g=g.evaluate(f);const N=v?v.evaluate(f):1,C=function($,K,Z,X){return typeof $=="number"&&$>=0&&$<=360?typeof K=="number"&&K>=0&&K<=100&&typeof Z=="number"&&Z>=0&&Z<=100?X===void 0||typeof X=="number"&&X>=0&&X<=1?null:`Invalid hsla value [${[$,K,Z,X].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid hsla value [${(typeof X=="number"?[$,K,Z,X]:[$,K,Z]).join(", ")}]: 's', and 'l' must be between 0 and 100.`:`Invalid hsla value [${(typeof X=="number"?[$,K,Z,X]:[$,K,Z]).join(", ")}]: 'h' must be between 0 and 360.`}(c,h,g,N);if(C)throw new dl(C);const L=`hsla(${c}, ${h}%, ${g}%, ${N})`,F=ba.parse(L);if(!F)throw new dl(`Failed to parse HSLA color: ${L}`);return F}function YP(f,c){return f in c}function T5(f,c){const h=c[f];return h===void 0?null:h}function tg(f){return{type:f}}function mx(f){if(f instanceof o0)return new Set([f.key]);let c=new Set;return f.eachChild(h=>{c=new Set([...c,...mx(h)])}),c}function hN(f){if(f instanceof bd&&f.name==="is-active-floor")return!0;let c=!1;return f.eachChild(h=>{!c&&hN(h)&&(c=!0)}),c}function XP(f){return{result:"success",value:f}}function rg(f){return{result:"error",value:f}}function A5(f,c){return!!f&&!!f.parameters&&f.parameters.indexOf(c)>-1}function Xv(f){return f["property-type"]==="data-driven"}function QP(f){return A5(f.expression,"measure-light")}function JP(f){return A5(f.expression,"zoom")}function fN(f){return!!f.expression&&f.expression.interpolated}function pN(f){return typeof f=="object"&&f!==null&&!Array.isArray(f)}function e6(f){return f}function t6(f,c){const h=c.type==="color",g=f.stops&&typeof f.stops[0][0]=="object",v=g||!(g||f.property!==void 0),N=f.type||(fN(c)?"exponential":"interval");if(h&&((f=Object.assign({},f)).stops&&(f.stops=f.stops.map($=>[$[0],ba.parse($[1])])),f.default=ba.parse(f.default?f.default:c.default)),f.colorSpace&&f.colorSpace!=="rgb"&&!WP[f.colorSpace])throw new Error(`Unknown color space: ${f.colorSpace}`);let C,L,F;if(N==="exponential")C=r6;else if(N==="interval")C=roe;else if(N==="categorical"){C=toe,L=Object.create(null);for(const $ of f.stops)L[$[0]]=$[1];F=typeof f.stops[0][0]}else{if(N!=="identity")throw new Error(`Unknown function type "${N}"`);C=n6}if(g){const $={},K=[];for(let re=0;rere[0]),evaluate:({zoom:re},ae)=>r6({stops:Z,base:f.base},c,re).evaluate(re,ae)}}if(v){const $=N==="exponential"?{name:"exponential",base:f.base!==void 0?f.base:1}:null;return{kind:"camera",interpolationType:$,interpolationFactor:Pu.interpolationFactor.bind(void 0,$),zoomStops:f.stops.map(K=>K[0]),evaluate:({zoom:K})=>C(f,c,K,L,F)}}return{kind:"source",evaluate($,K){const Z=K&&K.properties?K.properties[f.property]:void 0;return Z===void 0?Df(f.default,c.default):C(f,c,Z,L,F)}}}function Df(f,c,h){return f!==void 0?f:c!==void 0?c:h!==void 0?h:void 0}function toe(f,c,h,g,v){return Df(typeof h===v?g[h]:void 0,f.default,c.default)}function roe(f,c,h){if(!t0(h))return Df(f.default,c.default);const g=f.stops.length;if(g===1||h<=f.stops[0][0])return f.stops[0][1];if(h>=f.stops[g-1][0])return f.stops[g-1][1];const v=nN(f.stops.map(N=>N[0]),h);return f.stops[v][1]}function r6(f,c,h){const g=f.base!==void 0?f.base:1;if(!t0(h))return Df(f.default,c.default);const v=f.stops.length;if(v===1||h<=f.stops[0][0])return f.stops[0][1];if(h>=f.stops[v-1][0])return f.stops[v-1][1];const N=nN(f.stops.map(K=>K[0]),h),C=function(K,Z,X,re){const ae=re-X,me=K-X;return ae===0?0:Z===1?me/ae:(Math.pow(Z,me)-1)/(Math.pow(Z,ae)-1)}(h,g,f.stops[N][0],f.stops[N+1][0]),L=f.stops[N][1],F=f.stops[N+1][1];let $=Dv[c.type]||e6;if(f.colorSpace&&f.colorSpace!=="rgb"){const K=WP[f.colorSpace];$=(Z,X)=>K.reverse(K.interpolate(K.forward(Z),K.forward(X),C))}return typeof L.evaluate=="function"?{evaluate(...K){const Z=L.evaluate.apply(void 0,K),X=F.evaluate.apply(void 0,K);if(Z!==void 0&&X!==void 0)return $(Z,X,C)}}:$(L,F,C)}function n6(f,c,h){return c.type==="color"?h=ba.parse(h):c.type==="formatted"?h=vd.fromString(h.toString()):c.type==="resolvedImage"?h=_d.build(h.toString()):gn(h)===c.type||c.type==="enum"&&c.values[h]||(h=void 0),Df(h,f.default,c.default)}bd.register(h0,{error:[{kind:"error"},[sa],(f,[c])=>{throw new dl(c.evaluate(f))}],typeof:[sa,[Pa],(f,[c])=>Oo(bl(c.evaluate(f)))],"to-rgba":[Ac(_n,4),[Wd],(f,[c])=>c.evaluate(f).toNonPremultipliedRenderColor(null).toArray()],"to-hsla":[Ac(_n,4),[Wd],(f,[c])=>c.evaluate(f).toNonPremultipliedRenderColor(null).toHslaArray()],rgb:[Wd,[_n,_n,_n],C5],rgba:[Wd,[_n,_n,_n,_n],C5],hsl:[Wd,[_n,_n,_n],M5],hsla:[Wd,[_n,_n,_n,_n],M5],has:{type:Ua,overloads:[[[sa],(f,[c])=>YP(c.evaluate(f),f.properties())],[[sa,If],(f,[c,h])=>YP(c.evaluate(f),h.evaluate(f))]]},get:{type:Pa,overloads:[[[sa],(f,[c])=>T5(c.evaluate(f),f.properties())],[[sa,If],(f,[c,h])=>T5(c.evaluate(f),h.evaluate(f))]]},"feature-state":[Pa,[sa],(f,[c])=>T5(c.evaluate(f),f.featureState||{})],properties:[If,[],f=>f.properties()],"geometry-type":[sa,[],f=>f.geometryType()],worldview:[sa,[],f=>f.globals.worldview||""],"is-active-floor":[Ua,tg(sa),(f,c)=>{if(!(f.globals.activeFloors&&f.globals.activeFloors.size>0))return!1;const h=f.globals.activeFloors;return c.some(g=>{const v=g.evaluate(f);return h.has(v)})}],id:[Pa,[],f=>f.id()],zoom:[_n,[],f=>f.globals.zoom],pitch:[_n,[],f=>f.globals.pitch||0],"distance-from-center":[_n,[],f=>f.distanceFromCenter()],"measure-light":[_n,[sa],(f,[c])=>f.measureLight(c.evaluate(f))],"heatmap-density":[_n,[],f=>f.globals.heatmapDensity||0],"line-progress":[_n,[],f=>f.globals.lineProgress||0],"raster-value":[_n,[],f=>f.globals.rasterValue||0],"raster-particle-speed":[_n,[],f=>f.globals.rasterParticleSpeed||0],"sky-radial-progress":[_n,[],f=>f.globals.skyRadialProgress||0],accumulated:[Pa,[],f=>f.globals.accumulated===void 0?null:f.globals.accumulated],"+":[_n,tg(_n),(f,c)=>{let h=0;for(const g of c)h+=g.evaluate(f);return h}],"*":[_n,tg(_n),(f,c)=>{let h=1;for(const g of c)h*=g.evaluate(f);return h}],"-":{type:_n,overloads:[[[_n,_n],(f,[c,h])=>c.evaluate(f)-h.evaluate(f)],[[_n],(f,[c])=>-c.evaluate(f)]]},"/":[_n,[_n,_n],(f,[c,h])=>c.evaluate(f)/h.evaluate(f)],"%":[_n,[_n,_n],(f,[c,h])=>c.evaluate(f)%h.evaluate(f)],ln2:[_n,[],()=>Math.LN2],pi:[_n,[],()=>Math.PI],e:[_n,[],()=>Math.E],"^":[_n,[_n,_n],(f,[c,h])=>Math.pow(c.evaluate(f),h.evaluate(f))],sqrt:[_n,[_n],(f,[c])=>Math.sqrt(c.evaluate(f))],log10:[_n,[_n],(f,[c])=>Math.log(c.evaluate(f))/Math.LN10],ln:[_n,[_n],(f,[c])=>Math.log(c.evaluate(f))],log2:[_n,[_n],(f,[c])=>Math.log2(c.evaluate(f))],sin:[_n,[_n],(f,[c])=>Math.sin(c.evaluate(f))],cos:[_n,[_n],(f,[c])=>Math.cos(c.evaluate(f))],tan:[_n,[_n],(f,[c])=>Math.tan(c.evaluate(f))],asin:[_n,[_n],(f,[c])=>Math.asin(c.evaluate(f))],acos:[_n,[_n],(f,[c])=>Math.acos(c.evaluate(f))],atan:[_n,[_n],(f,[c])=>Math.atan(c.evaluate(f))],min:[_n,tg(_n),(f,c)=>Math.min(...c.map(h=>h.evaluate(f)))],max:[_n,tg(_n),(f,c)=>Math.max(...c.map(h=>h.evaluate(f)))],abs:[_n,[_n],(f,[c])=>Math.abs(c.evaluate(f))],round:[_n,[_n],(f,[c])=>{const h=c.evaluate(f);return h<0?-Math.round(-h):Math.round(h)}],floor:[_n,[_n],(f,[c])=>Math.floor(c.evaluate(f))],ceil:[_n,[_n],(f,[c])=>Math.ceil(c.evaluate(f))],"filter-==":[Ua,[sa,Pa],(f,[c,h])=>f.properties()[c.value]===h.value],"filter-id-==":[Ua,[Pa],(f,[c])=>f.id()===c.value],"filter-type-==":[Ua,[sa],(f,[c])=>f.geometryType()===c.value],"filter-<":[Ua,[sa,Pa],(f,[c,h])=>{const g=f.properties()[c.value],v=h.value;return typeof g==typeof v&&g{const h=f.id(),g=c.value;return typeof h==typeof g&&h":[Ua,[sa,Pa],(f,[c,h])=>{const g=f.properties()[c.value],v=h.value;return typeof g==typeof v&&g>v}],"filter-id->":[Ua,[Pa],(f,[c])=>{const h=f.id(),g=c.value;return typeof h==typeof g&&h>g}],"filter-<=":[Ua,[sa,Pa],(f,[c,h])=>{const g=f.properties()[c.value],v=h.value;return typeof g==typeof v&&g<=v}],"filter-id-<=":[Ua,[Pa],(f,[c])=>{const h=f.id(),g=c.value;return typeof h==typeof g&&h<=g}],"filter->=":[Ua,[sa,Pa],(f,[c,h])=>{const g=f.properties()[c.value],v=h.value;return typeof g==typeof v&&g>=v}],"filter-id->=":[Ua,[Pa],(f,[c])=>{const h=f.id(),g=c.value;return typeof h==typeof g&&h>=g}],"filter-has":[Ua,[Pa],(f,[c])=>c.value in f.properties()],"filter-has-id":[Ua,[],f=>f.id()!==null&&f.id()!==void 0],"filter-type-in":[Ua,[Ac(sa)],(f,[c])=>c.value.indexOf(f.geometryType())>=0],"filter-id-in":[Ua,[Ac(Pa)],(f,[c])=>c.value.indexOf(f.id())>=0],"filter-in-small":[Ua,[sa,Ac(Pa)],(f,[c,h])=>h.value.indexOf(f.properties()[c.value])>=0],"filter-in-large":[Ua,[sa,Ac(Pa)],(f,[c,h])=>function(g,v,N,C){for(;N<=C;){const L=N+C>>1;if(v[L]===g)return!0;v[L]>g?C=L-1:N=L+1}return!1}(f.properties()[c.value],h.value,0,h.value.length-1)],all:{type:Ua,overloads:[[[Ua,Ua],(f,[c,h])=>c.evaluate(f)&&h.evaluate(f)],[tg(Ua),(f,c)=>{for(const h of c)if(!h.evaluate(f))return!1;return!0}]]},any:{type:Ua,overloads:[[[Ua,Ua],(f,[c,h])=>c.evaluate(f)||h.evaluate(f)],[tg(Ua),(f,c)=>{for(const h of c)if(h.evaluate(f))return!0;return!1}]]},"!":[Ua,[Ua],(f,[c])=>!c.evaluate(f)],"is-supported-script":[Ua,[sa],(f,[c])=>{const h=f.globals&&f.globals.isSupportedScript;return!h||h(c.evaluate(f))}],upcase:[sa,[sa],(f,[c])=>c.evaluate(f).toUpperCase()],downcase:[sa,[sa],(f,[c])=>c.evaluate(f).toLowerCase()],concat:[sa,tg(Pa),(f,c)=>c.map(h=>lh(h.evaluate(f))).join("")],"resolved-locale":[sa,[zk],(f,[c])=>c.evaluate(f).resolvedLocale()],random:[_n,[_n,_n,Pa],(f,c)=>{const[h,g,v]=c.map(C=>C.evaluate(f));if(h>g||h===g)return h;let N;if(typeof v=="string")N=function(C){let L=0;if(C.length===0)return L;for(let F=0;FJSON.stringify(Z)).join(", ")}, but found ${JSON.stringify(K)} instead.`);return K}catch(K){const Z=K;return this._warningHistory[Z.message]||(this._warningHistory[Z.message]=!0,typeof console<"u"&&console.warn(`Failed to evaluate expression "${JSON.stringify(this.expression.serialize())}". ${Z.message}`)),this._defaultValue}}}function Qv(f){return Array.isArray(f)&&f.length>0&&typeof f[0]=="string"&&f[0]in h0}function ng(f,c,h,g,v){const N=new rN(h0,[],c?function(L){const F={color:Wd,string:sa,number:_n,enum:sa,boolean:Ua,formatted:Rv,resolvedImage:Fv};return L.type==="array"?Ac(F[L.value]||Pa,L.length):F[L.type]}(c):void 0,void 0,void 0,h,g,v),C=N.parse(f,void 0,void 0,void 0,c&&c.type==="string"?{typeAnnotation:"coerce"}:void 0);return C?XP(new mN(C,c,h,g,v)):rg(N.errors)}class f0{constructor(c,h,g,v){this.kind=c,this._styleExpression=h,this.isLightConstant=g,this.isLineProgressConstant=v,this.isStateDependent=c!=="constant"&&!Hv(h.expression),this.configDependencies=mx(h.expression),this.isIndoorDependent=hN(h.expression)}evaluateWithoutErrorHandling(c,h,g,v,N,C){return this._styleExpression.evaluateWithoutErrorHandling(c,h,g,v,N,C)}evaluate(c,h,g,v,N,C,L){return this._styleExpression.evaluate(c,h,g,v,N,C,void 0,void 0,L)}}class gx{constructor(c,h,g,v,N,C){this.kind=c,this.zoomStops=g,this._styleExpression=h,this.isStateDependent=c!=="camera"&&!Hv(h.expression),this.isIndoorDependent=hN(h.expression),this.isLightConstant=N,this.isLineProgressConstant=C,this.configDependencies=mx(h.expression),this.interpolationType=v}evaluateWithoutErrorHandling(c,h,g,v,N,C){return this._styleExpression.evaluateWithoutErrorHandling(c,h,g,v,N,C)}evaluate(c,h,g,v,N,C){return this._styleExpression.evaluate(c,h,g,v,N,C)}interpolationFactor(c,h,g){return this.interpolationType?Pu.interpolationFactor(this.interpolationType,c,h,g):0}}function E5(f,c,h,g,v){if((f=ng(f,c,h,g,v)).result==="error")return f;const N=f.value.expression,C=a0(N);if(!C&&!Xv(c))return rg([new oh("","data expressions not supported")]);const L=i0(N,["zoom","pitch","distance-from-center"]);if(!L&&!JP(c))return rg([new oh("","zoom expressions not supported")]);const F=i0(N,["measure-light"]);if(!F&&!QP(c))return rg([new oh("","measure-light expression not supported")]);const $=i0(N,["line-progress"]);if(!$&&!function(X){return A5(X.expression,"line-progress")}(c))return rg([new oh("","line-progress expression not supported")]);const K=c.expression&&c.expression.relaxZoomRestriction,Z=Hh(N);return Z||L||K?Z instanceof oh?rg([Z]):Z instanceof Pu&&!fN(c)?rg([new oh("",'"interpolate" expressions cannot be used with this property')]):XP(Z?new gx(C&&$?"camera":"composite",f.value,Z.labels,Z instanceof Pu?Z.interpolation:void 0,F,$):new f0(C&&$?"constant":"source",f.value,F,$)):rg([new oh("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression, or in the properties of atmosphere.')])}class gN{constructor(c,h){this._parameters=c,this._specification=h,Object.assign(this,t6(this._parameters,this._specification))}static deserialize(c){return new gN(c._parameters,c._specification)}static serialize(c){return{_parameters:c._parameters,_specification:c._specification}}}function Hh(f){let c=null;if(f instanceof Ip)c=Hh(f.result);else if(f instanceof Kv){for(const h of f.args)if(c=Hh(h),c)break}else(f instanceof Wv||f instanceof Pu)&&f.input instanceof bd&&f.input.name==="zoom"&&(c=f);return c instanceof oh||f.eachChild(h=>{const g=Hh(h);g instanceof oh?c=g:c&&g&&c!==g&&(c=new oh("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),c}var I5,s6,a6=function(){if(s6)return I5;s6=1,I5=c;var f=3;function c(h,g,v){var N=this.cells=[];if(h instanceof ArrayBuffer){this.arrayBuffer=h;var C=new Int32Array(this.arrayBuffer);h=C[0],this.d=(g=C[1])+2*(v=C[2]);for(var L=0;L=X[me+0]&&N>=X[me+1])?(F[ae]=!0,L.push(Z[ae])):F[ae]=!1}}},c.prototype._forEachCell=function(h,g,v,N,C,L,F,$){for(var K=this._convertToCellCoord(h),Z=this._convertToCellCoord(g),X=this._convertToCellCoord(v),re=this._convertToCellCoord(N),ae=K;ae<=X;ae++)for(var me=Z;me<=re;me++){var Se=this.d*me+ae;if((!$||$(this._convertFromCellCoord(ae),this._convertFromCellCoord(me),this._convertFromCellCoord(ae+1),this._convertFromCellCoord(me+1)))&&C.call(this,h,g,v,N,Se,L,F,$))return}},c.prototype._convertFromCellCoord=function(h){return(h-this.padding)/this.scale},c.prototype._convertToCellCoord=function(h){return Math.max(0,Math.min(this.d-1,Math.floor(h*this.scale)+this.padding))},c.prototype.toArrayBuffer=function(){if(this.arrayBuffer)return this.arrayBuffer;for(var h=this.cells,g=f+this.cells.length+1+1,v=0,N=0;N=0||(v[N]=Pp(f[N],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 sg(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||Jv(f)||f instanceof ImageBitmap||ArrayBuffer.isView(f)||f instanceof ImageData)return f;if(Array.isArray(f))return f.map(sg);if(typeof f=="object"){const c=f.$name||"Object";if(c==="Map"){const v=f.entries||[],N=new Map;for(let C=0;Cf>=128&&f<=255,Arabic:f=>f>=1536&&f<=1791,"Arabic Supplement":f=>f>=1872&&f<=1919,"Arabic Extended-A":f=>f>=2208&&f<=2303,"Hangul Jamo":f=>f>=4352&&f<=4607,"Unified Canadian Aboriginal Syllabics":f=>f>=5120&&f<=5759,Khmer:f=>f>=6016&&f<=6143,"Unified Canadian Aboriginal Syllabics Extended":f=>f>=6320&&f<=6399,"General Punctuation":f=>f>=8192&&f<=8303,"Letterlike Symbols":f=>f>=8448&&f<=8527,"Number Forms":f=>f>=8528&&f<=8591,"Miscellaneous Technical":f=>f>=8960&&f<=9215,"Control Pictures":f=>f>=9216&&f<=9279,"Optical Character Recognition":f=>f>=9280&&f<=9311,"Enclosed Alphanumerics":f=>f>=9312&&f<=9471,"Geometric Shapes":f=>f>=9632&&f<=9727,"Miscellaneous Symbols":f=>f>=9728&&f<=9983,"Miscellaneous Symbols and Arrows":f=>f>=11008&&f<=11263,"CJK Radicals Supplement":f=>f>=11904&&f<=12031,"Kangxi Radicals":f=>f>=12032&&f<=12255,"Ideographic Description Characters":f=>f>=12272&&f<=12287,"CJK Symbols and Punctuation":f=>f>=12288&&f<=12351,Hiragana:f=>f>=12352&&f<=12447,Katakana:f=>f>=12448&&f<=12543,Bopomofo:f=>f>=12544&&f<=12591,"Hangul Compatibility Jamo":f=>f>=12592&&f<=12687,Kanbun:f=>f>=12688&&f<=12703,"Bopomofo Extended":f=>f>=12704&&f<=12735,"CJK Strokes":f=>f>=12736&&f<=12783,"Katakana Phonetic Extensions":f=>f>=12784&&f<=12799,"Enclosed CJK Letters and Months":f=>f>=12800&&f<=13055,"CJK Compatibility":f=>f>=13056&&f<=13311,"CJK Unified Ideographs Extension A":f=>f>=13312&&f<=19903,"Yijing Hexagram Symbols":f=>f>=19904&&f<=19967,"CJK Unified Ideographs":f=>f>=19968&&f<=40959,"Yi Syllables":f=>f>=40960&&f<=42127,"Yi Radicals":f=>f>=42128&&f<=42191,"Hangul Jamo Extended-A":f=>f>=43360&&f<=43391,"Hangul Syllables":f=>f>=44032&&f<=55215,"Hangul Jamo Extended-B":f=>f>=55216&&f<=55295,"Private Use Area":f=>f>=57344&&f<=63743,"CJK Compatibility Ideographs":f=>f>=63744&&f<=64255,"Arabic Presentation Forms-A":f=>f>=64336&&f<=65023,"Vertical Forms":f=>f>=65040&&f<=65055,"CJK Compatibility Forms":f=>f>=65072&&f<=65103,"Small Form Variants":f=>f>=65104&&f<=65135,"Arabic Presentation Forms-B":f=>f>=65136&&f<=65279,"Halfwidth and Fullwidth Forms":f=>f>=65280&&f<=65519,Osage:f=>f>=66736&&f<=66815,"CJK Unified Ideographs Extension B":f=>f>=131072&&f<=173791};function e_(f){for(const c of f)if(xN(c.charCodeAt(0)))return!0;return!1}function P5(f){for(const c of f)if(!i6(c.charCodeAt(0)))return!1;return!0}function i6(f){return!(En.Arabic(f)||En["Arabic Supplement"](f)||En["Arabic Extended-A"](f)||En["Arabic Presentation Forms-A"](f)||En["Arabic Presentation Forms-B"](f))}function xN(f){return!(f!==746&&f!==747&&(f<4352||!(En["Bopomofo Extended"](f)||En.Bopomofo(f)||En["CJK Compatibility Forms"](f)&&!(f>=65097&&f<=65103)||En["CJK Compatibility Ideographs"](f)||En["CJK Compatibility"](f)||En["CJK Radicals Supplement"](f)||En["CJK Strokes"](f)||!(!En["CJK Symbols and Punctuation"](f)||f>=12296&&f<=12305||f>=12308&&f<=12319||f===12336)||En["CJK Unified Ideographs Extension A"](f)||En["CJK Unified Ideographs"](f)||En["Enclosed CJK Letters and Months"](f)||En["Hangul Compatibility Jamo"](f)||En["Hangul Jamo Extended-A"](f)||En["Hangul Jamo Extended-B"](f)||En["Hangul Jamo"](f)||En["Hangul Syllables"](f)||En.Hiragana(f)||En["Ideographic Description Characters"](f)||En.Kanbun(f)||En["Kangxi Radicals"](f)||En["Katakana Phonetic Extensions"](f)||En.Katakana(f)&&f!==12540||!(!En["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)||!(!En["Small Form Variants"](f)||f>=65112&&f<=65118||f>=65123&&f<=65126)||En["Unified Canadian Aboriginal Syllabics"](f)||En["Unified Canadian Aboriginal Syllabics Extended"](f)||En["Vertical Forms"](f)||En["Yijing Hexagram Symbols"](f)||En["Yi Syllables"](f)||En["Yi Radicals"](f))))}function yN(f){return!(xN(f)||function(c){return!!(En["Latin-1 Supplement"](c)&&(c===167||c===169||c===174||c===177||c===188||c===189||c===190||c===215||c===247)||En["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)||En["Letterlike Symbols"](c)||En["Number Forms"](c)||En["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)||En["Control Pictures"](c)&&c!==9251||En["Optical Character Recognition"](c)||En["Enclosed Alphanumerics"](c)||En["Geometric Shapes"](c)||En["Miscellaneous Symbols"](c)&&!(c>=9754&&c<=9759)||En["Miscellaneous Symbols and Arrows"](c)&&(c>=11026&&c<=11055||c>=11088&&c<=11097||c>=11192&&c<=11243)||En["CJK Symbols and Punctuation"](c)||En.Katakana(c)||En["Private Use Area"](c)||En["CJK Compatibility Forms"](c)||En["Small Form Variants"](c)||En["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 vN(f){return En.Arabic(f)||En["Arabic Supplement"](f)||En["Arabic Extended-A"](f)||En["Arabic Presentation Forms-A"](f)||En["Arabic Presentation Forms-B"](f)}function L5(f){return f>=1424&&f<=2303||En["Arabic Presentation Forms-A"](f)||En["Arabic Presentation Forms-B"](f)}function Lp(f,c){return!(!c&&L5(f)||f>=2304&&f<=3583||f>=3840&&f<=4255||En.Khmer(f))}function noe(f){for(const c of f)if(L5(c.charCodeAt(0)))return!0;return!1}const du={unavailable:"unavailable",deferred:"deferred",loading:"loading",parsing:"parsing",parsed:"parsed",loaded:"loaded",error:"error"};let O5=null,wd=du.unavailable,Op=null;const t_=function(f){f&&typeof f=="string"&&f.indexOf("NetworkError")>-1&&(wd=du.error),O5&&O5(f)};function _N(){bN.fire(new Er("pluginStateChange",{pluginStatus:wd,pluginURL:Op}))}const bN=new Is,r_=function(){return wd},o6=function(){if(wd!==du.deferred||!Op)throw new Error("rtl-text-plugin cannot be downloaded unless a pluginURL is specified");wd=du.loading,_N(),Op&&Eu({url:Op},f=>{f?t_(f):(wd=du.loaded,_N())})},Dp={applyArabicShaping:null,processBidirectionalText:null,processStyledBidirectionalText:null,isLoaded:()=>wd===du.loaded||Dp.applyArabicShaping!=null,isLoading:()=>wd===du.loading,setState(f){wd=f.pluginStatus,Op=f.pluginURL},isParsing:()=>wd===du.parsing,isParsed:()=>wd===du.parsed,getPluginURL:()=>Op};class oi{constructor(c,h){this.zoom=c,h?(this.now=h.now,this.fadeDuration=h.fadeDuration,this.transition=h.transition,this.pitch=h.pitch,this.brightness=h.brightness,this.worldview=h.worldview,this.activeFloors=h.activeFloors):(this.now=0,this.fadeDuration=0,this.transition={},this.pitch=0,this.brightness=0)}isSupportedScript(c){return function(h,g){for(const v of h)if(!Lp(v.charCodeAt(0),g))return!1;return!0}(c,Dp.isLoaded())}}class wN{constructor(c,h,g,v,N){this.property=c,this.value=h,this.expression=function(C,L,F,$,K){if(pN(C))return new gN(C,L);if(Qv(C)||Array.isArray(C)&&C.length>0){const Z=E5(C,L,F,$,K);if(Z.result==="error")throw new Error(Z.value.map(X=>`${X.key}: ${X.message}`).join(", "));return Z.value}{let Z=C;return typeof C=="string"&&L.type==="color"&&(Z=ba.parse(C)),{kind:"constant",configDependencies:new Set,isIndoorDependent:!1,evaluate:()=>Z}}}(h===void 0?c.specification.default:h,c.specification,g,v,N)}isIndoorDependent(){return this.expression.isIndoorDependent}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(c,h,g,v){return this.property.possiblyEvaluate(this,c,h,g,v)}}class D5{constructor(c,h,g,v){this.property=c,this.value=new wN(c,void 0,h,g,v)}transitioned(c,h){return new c6(this.property,this.value,h,Object.assign({},c.transition,this.transition),c.now)}untransitioned(){return new c6(this.property,this.value,null,{},0)}}class l6{constructor(c,h,g,v){this._properties=c,this._values=Object.create(c.defaultTransitionablePropertyValues),this._scope=h,this._options=g,this._iconImageUseTheme=v,this._isIndoorDependent=!1,this.configDependencies=new Set}getValue(c){return or(this._values[c].value.value)}setValue(c,h){this._values.hasOwnProperty(c)||(this._values[c]=new D5(this._values[c].property,this._scope,this._options,this._iconImageUseTheme)),this._values[c].value=new wN(this._values[c].property,h===null?void 0:or(h),this._scope,this._options,this._iconImageUseTheme),this._values[c].value.expression.configDependencies&&(this.configDependencies=new Set([...this.configDependencies,...this._values[c].value.expression.configDependencies]),this._isIndoorDependent=this._isIndoorDependent||this._values[c].value.isIndoorDependent())}setTransitionOrValue(c,h){h&&(this._options=h);const g=this._properties.properties;if(c)for(const v in c){const N=c[v];if(v.endsWith("-transition")){const C=v.slice(0,-11);g[C]&&this.setTransition(C,N)}else g.hasOwnProperty(v)&&this.setValue(v,N)}}getTransition(c){return or(this._values[c].transition)}setTransition(c,h){this._values.hasOwnProperty(c)||(this._values[c]=new D5(this._values[c].property)),this._values[c].transition=or(h)||void 0}serialize(){const c={};for(const h of Object.keys(this._values)){const g=this.getValue(h);g!==void 0&&(c[h]=g);const v=this.getTransition(h);v!==void 0&&(c[`${h}-transition`]=v)}return c}transitioned(c,h){const g=new d6(this._properties);for(const v of Object.keys(this._values))g._values[v]=this._values[v].transitioned(c,h._values[v]);return g}untransitioned(){const c=new d6(this._properties);for(const h of Object.keys(this._values))c._values[h]=this._values[h].untransitioned();return c}isIndoorDependent(){return this._isIndoorDependent}}class c6{constructor(c,h,g,v,N){const C=v.delay||0,L=v.duration||0;N=N||0,this.property=c,this.value=h,this.begin=N+C,this.end=this.begin+L,c.specification.transition&&(v.delay||v.duration)&&(this.prior=g)}possiblyEvaluate(c,h,g){const v=c.now||0,N=this.value.possiblyEvaluate(c,h,g),C=this.prior;if(C){if(v>this.end)return this.prior=null,N;if(this.value.isDataDriven())return this.prior=null,N;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 h6(f){return f instanceof Number||f instanceof String||f instanceof Boolean?f.valueOf():f}function jN(f){if(Array.isArray(f))return f.map(jN);if(f instanceof Object&&!(f instanceof Number||f instanceof String||f instanceof Boolean)){const c={};for(const h in f)c[h]=jN(f[h]);return c}return h6(f)}function Rf(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(!Rf(c)&&typeof c!="boolean")return!1;return!0;default:return!0}}function kN(f,c="",h=null,g="fill"){if(f==null)return{filter:()=>!0,needGeometry:!1,needFeature:!1};Rf(f)||(f=NN(f));const v=f;let N=!0;try{N=function(K){if(!m0(K))return K;let Z=jN(K);return f6(Z),Z=bx(Z),Z}(v)}catch{console.warn(`Failed to extract static filter. Filter will continue working, but at higher memory usage and slower framerate. This is most likely a bug, please report this via https://github.com/mapbox/mapbox-gl-js/issues/new?assignees=&labels=&template=Bug_report.md and paste the contents of this message in the report. Thank you! Filter Expression: ${JSON.stringify(v,null,2)} `)}let C=null,L=null;if(g!=="background"&&g!=="sky"&&g!=="slot"){L=Ft[`filter_${g}`];const K=ng(N,L,c,h);if(K.result==="error")throw new Error(K.value.map(Z=>`${Z.key}: ${Z.message}`).join(", "));C=(Z,X,re)=>K.value.evaluate(Z,X,{},re)}let F=null,$=null;if(N!==v){const K=ng(v,L,c,h);if(K.result==="error")throw new Error(K.value.map(Z=>`${Z.key}: ${Z.message}`).join(", "));F=(Z,X,re,ae,me)=>K.value.evaluate(Z,X,{},re,void 0,void 0,ae,me),$=!a0(K.value.expression)}return{filter:C,dynamicFilter:F||void 0,needGeometry:p6(N),needFeature:!!$}}function bx(f){if(!Array.isArray(f))return f;const c=function(h){if(soe.has(h[0])){for(let g=1;gbx(h))}function f6(f){let c=!1;const h=[];if(f[0]==="case"){for(let g=1;g",">=","<","<=","to-boolean"]);function aoe(f,c){return fc?1:0}function p6(f){if(!Array.isArray(f))return!1;if(f[0]==="within"||f[0]==="distance")return!0;for(let c=1;c"||c==="<="||c===">="?SN(f[1],f[2],c):c==="any"?(h=f.slice(1),["any"].concat(h.map(NN))):c==="all"?["all"].concat(f.slice(1).map(NN)):c==="none"?["all"].concat(f.slice(1).map(NN).map(n_)):c==="in"?CN(f[1],f.slice(2)):c==="!in"?n_(CN(f[1],f.slice(2))):c==="has"?MN(f[1]):c!=="!has"||n_(MN(f[1]));var h}function SN(f,c,h){switch(f){case"$type":return[`filter-type-${h}`,c];case"$id":return[`filter-id-${h}`,c];default:return[`filter-${h}`,f,c]}}function CN(f,c){if(c.length===0)return!1;switch(f){case"$type":return["filter-type-in",["literal",c]];case"$id":return["filter-id-in",["literal",c]];default:return c.length>200&&!c.some(h=>typeof h!=typeof c[0])?["filter-in-large",f,["literal",c.sort(aoe)]]:["filter-in-small",f,["literal",c]]}}function MN(f){switch(f){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",f]}}function n_(f){return["!",f]}const wx="";function Wh(f,c){return c?`${f}${wx}${c}`:f}let m6;const g6=()=>m6||(m6=new Ji({"icon-size":new Pr(Ft.layout_symbol["icon-size"]),"icon-image":new Pr(Ft.layout_symbol["icon-image"]),"icon-rotate":new Pr(Ft.layout_symbol["icon-rotate"]),"icon-offset":new Pr(Ft.layout_symbol["icon-offset"]),"text-size":new Pr(Ft.layout_symbol["text-size"]),"text-rotate":new Pr(Ft.layout_symbol["text-rotate"]),"text-offset":new Pr(Ft.layout_symbol["text-offset"])}));class x6{constructor(c,h,g,v,N,C){const L=ng(c,Ft.appearance.condition);if(L.result==="success"&&(this.condition=L.value),this.name=h,g){this.properties=new vx(g6()),this.unevaluatedLayout=new u6(g6(),v,N,C);for(const F in g)this.unevaluatedLayout.setValue(F,g[F])}}isActive(c){return!(this.condition||!c.isHidden||this.name!=="hidden")||this.condition.evaluate(c.globals,c.feature,c.featureState,c.canonical)}getCondition(){return this.condition}getName(){return this.name}getProperty(c){return this.properties.get(c)}getUnevaluatedProperties(){return this.unevaluatedLayout}getUnevaluatedProperty(c){return this.unevaluatedLayout._values[c]}recalculate(c,h,g){this.unevaluatedLayout&&(this.properties=this.unevaluatedLayout.possiblyEvaluate(c,void 0,h,g))}serialize(){const c={};return c.condition=this.condition.expression.serialize(),this.name&&(c.name=this.name),this.unevaluatedLayout&&(c.properties=this.unevaluatedLayout.serialize()),c}hasIconProperties(){const c=this.hasProperty("icon-image"),h=this.hasProperty("icon-size"),g=this.hasProperty("icon-offset"),v=this.hasProperty("icon-rotate");return c||h||g||v}hasTextProperties(){const c=this.hasProperty("text-size"),h=this.hasProperty("text-offset"),g=this.hasProperty("text-rotate");return c||h||g}hasProperty(c){return this.getUnevaluatedProperty(c).value!==void 0}}const y6="-transition",Ff=new Set(["fill","line","background","hillshade","raster"]);class jd extends Is{constructor(c,h,g,v,N,C){if(super(),this.id=c.id,this.fqid=Wh(this.id,g),this.type=c.type,this.scope=g,this.lut=v,this.options=N,this.iconImageUseTheme=C,this.appearances=new Array,this._featureFilter={filter:()=>!0,needGeometry:!1,needFeature:!1},this._filterCompiled=!1,this.expressionDependencies={isIndoorDependent:!1,configDependencies:new Set},c.type!=="custom"){if(this.metadata=c.metadata,this.minzoom=c.minzoom,this.maxzoom=c.maxzoom,c.type&&c.type!=="background"&&c.type!=="sky"&&c.type!=="slot"){this.source=c.source,this.sourceLayer=c["source-layer"],this.filter=c.filter;const L=ng(this.filter,Ft[`filter_${c.type}`]);L.result!=="error"&&(this.expressionDependencies.configDependencies=new Set([...this.expressionDependencies.configDependencies,...L.value.configDependencies]),this.expressionDependencies.isIndoorDependent=this.expressionDependencies.isIndoorDependent||L.value.isIndoorDependent)}if(c.slot&&(this.slot=c.slot),c.appearances&&this.setAppearances(c.appearances),h.layout&&(this._unevaluatedLayout=new u6(h.layout,this.scope,N,this.iconImageUseTheme),this.expressionDependencies.configDependencies=new Set([...this.expressionDependencies.configDependencies,...this._unevaluatedLayout.configDependencies]),this.expressionDependencies.isIndoorDependent=this.expressionDependencies.isIndoorDependent||this._unevaluatedLayout.isIndoorDependent()),h.paint){this._transitionablePaint=new l6(h.paint,this.scope,N);for(const L in c.paint)this.setPaintProperty(L,c.paint[L]);for(const L in c.layout)this.setLayoutProperty(L,c.layout[L]);this.expressionDependencies.configDependencies=new Set([...this.expressionDependencies.configDependencies,...this._transitionablePaint.configDependencies]),this.expressionDependencies.isIndoorDependent=this.expressionDependencies.isIndoorDependent||this._transitionablePaint.isIndoorDependent(),this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new vx(h.paint)}}}onAdd(c){}onRemove(c){}isDraped(c){return!this.is3D(!0)&&Ff.has(this.type)}getLayoutProperty(c){return c==="visibility"?this.visibility:this._unevaluatedLayout.getValue(c)}setLayoutProperty(c,h){if(this.type==="custom"&&c==="visibility")return void(this.visibility=h);const g=this._unevaluatedLayout;g._properties.properties[c]&&(g.setValue(c,h),this.expressionDependencies.configDependencies=new Set([...this.expressionDependencies.configDependencies,...g.configDependencies]),this.expressionDependencies.isIndoorDependent=this.expressionDependencies.isIndoorDependent||g.isIndoorDependent(),c==="visibility"&&this.possiblyEvaluateVisibility())}setAppearances(c){this.appearances=[],c.forEach(h=>{this.appearances.push(new x6(h.condition,h.name,h.properties,this.scope,this.options,this.iconImageUseTheme))})}possiblyEvaluateVisibility(){this._unevaluatedLayout._values.visibility&&(this.visibility=this._unevaluatedLayout._values.visibility.possiblyEvaluate({zoom:0}))}getPaintProperty(c){return c.endsWith(y6)?this._transitionablePaint.getTransition(c.slice(0,-11)):this._transitionablePaint.getValue(c)}isPaintProperty(c){return!!this._transitionablePaint._properties.properties[c]}setPaintProperty(c,h){const g=this._transitionablePaint,v=g._properties.properties;if(c.endsWith(y6)){const Z=c.slice(0,-11);return v[Z]&&g.setTransition(Z,h||void 0),!1}if(!v[c])return!1;const N=g._values[c],C=N.value.isDataDriven(),L=N.value;g.setValue(c,h),this.expressionDependencies.configDependencies=new Set([...this.expressionDependencies.configDependencies,...g.configDependencies]),this.expressionDependencies.isIndoorDependent=this.expressionDependencies.isIndoorDependent||g.isIndoorDependent(),this._handleSpecialPaintPropertyUpdate(c);const F=g._values[c].value,$=F.isDataDriven(),K=c.endsWith("pattern")||c==="line-dasharray";return $||C||K||this._handleOverridablePaintPropertyUpdate(c,L,F)}_handleSpecialPaintPropertyUpdate(c){}getProgramIds(){return null}getDefaultProgramParams(c,h,g){return null}_handleOverridablePaintPropertyUpdate(c,h,g){return!1}isHidden(c){return!!(this.minzoom&&c=this.maxzoom)||this.visibility==="none"}updateTransitions(c){this._transitioningPaint=this._transitionablePaint.transitioned(c,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(c,h){this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(c,void 0,h,this.iconImageUseTheme)),this.paint=this._transitioningPaint.possiblyEvaluate(c,void 0,h)}serialize(){const c={id:this.id,type:this.type,slot:this.slot,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.appearances.length!==0&&(c.appearances=this.appearances.map(h=>h.serialize())),pr(c,(h,g)=>!(h===void 0||g==="layout"&&!Object.keys(h).length||g==="paint"&&!Object.keys(h).length))}is3D(c){return!1}hasElevation(){return!1}isSky(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}hasShadowPass(){return!1}canCastShadows(){return!1}hasLightBeamPass(){return!1}cutoffRange(){return 0}tileCoverLift(){return 0}resize(){}_clear(){}isStateDependent(){for(const c in this.paint._values){const h=this.paint.get(c);if(h instanceof yx&&Xv(h.property.specification)&&(h.value.kind==="source"||h.value.kind==="composite")&&h.value.isStateDependent)return!0}for(const c of this.appearances)if(!Hv(c.condition.expression))return!0;return!1}compileFilter(c){this._filterCompiled||(this._featureFilter=kN(this.filter,this.scope,c),this._filterCompiled=!0)}invalidateCompiledFilter(){this._filterCompiled=!1}dynamicFilter(){return this._featureFilter.dynamicFilter}dynamicFilterNeedsFeature(){return this._featureFilter.needFeature}getLayerRenderingStats(){return this._stats}resetLayerRenderingStats(c){this._stats&&(c.renderPass==="shadow"?this._stats.numRenderedVerticesInShadowPass=0:this._stats.numRenderedVerticesInTransparentPass=0)}getAppearances(){return this.appearances}queryRenderedFeatures(c,h,g){return{}}queryRadius(c){}queryIntersectsFeature(c,h,g,v,N,C,L,F,$){}}const v6={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class s_{constructor(c,h){this._structArray=c,this._pos1=h*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}const ioe=new ArrayBuffer(0);class wi{constructor(){this._reallocCount=0,this.capacity=0,this.length=0}static serialize(c,h){return c._trim(),h&&c.arrayBuffer&&h.add(c.arrayBuffer),{length:c.length,arrayBuffer:c.arrayBuffer}}static deserialize(c){const h=Object.create(this.prototype);return h.arrayBuffer=c.arrayBuffer,h.length=c.length,c.arrayBuffer?h.capacity=c.arrayBuffer.byteLength/h.bytesPerElement:(h.capacity=0,h.arrayBuffer=ioe),h._refreshViews(),h}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(c){this.reserve(c),this.length=c}reserve(c){if(c>this.capacity){this._reallocCount++,this.capacity=Math.max(c,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const h=this.uint8;this._refreshViews(),h&&this.uint8.set(h)}}reserveForAdditional(c){this.reserve(this.length+c)}_refreshViews(){throw new Error("StructArray#_refreshViews() must be implemented by each concrete StructArray layout")}emplace(...c){throw new Error("StructArray#emplace() must be implemented by each concrete StructArray layout")}emplaceBack(...c){throw new Error("StructArray#emplaceBack() must be implemented by each concrete StructArray layout")}destroy(){this.int8=this.uint8=this.int16=this.uint16=this.int32=this.uint32=this.float32=null,this.arrayBuffer=null}}function Ds(f,c=1){let h=0,g=0;return{members:f.map(v=>{const N=v6[v.type].BYTES_PER_ELEMENT,C=h=_6(h,Math.max(c,N)),L=v.components||1;return g=Math.max(g,N),h+=N*L,{name:v.name,type:v.type,components:L,offset:C}}),size:_6(h,Math.max(g,c)),alignment:c}}function _6(f,c){return Math.ceil(f/c)*c}class ag extends wi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(c,h){const g=this.length;return this.resize(g+1),this.emplace(g,c,h)}emplace(c,h,g){const v=2*c;return this.int16[v+0]=h,this.int16[v+1]=g,c}}ag.prototype.bytesPerElement=4,en(ag,"StructArrayLayout2i4");class g0 extends wi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(c,h,g){const v=this.length;return this.resize(v+1),this.emplace(v,c,h,g)}emplace(c,h,g,v){const N=3*c;return this.int16[N+0]=h,this.int16[N+1]=g,this.int16[N+2]=v,c}}g0.prototype.bytesPerElement=6,en(g0,"StructArrayLayout3i6");class x0 extends wi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(c,h,g,v){const N=this.length;return this.resize(N+1),this.emplace(N,c,h,g,v)}emplace(c,h,g,v,N){const C=4*c;return this.int16[C+0]=h,this.int16[C+1]=g,this.int16[C+2]=v,this.int16[C+3]=N,c}}x0.prototype.bytesPerElement=8,en(x0,"StructArrayLayout4i8");class Rp extends wi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c){const h=this.length;return this.resize(h+1),this.emplace(h,c)}emplace(c,h){return this.float32[1*c+0]=h,c}}Rp.prototype.bytesPerElement=4,en(Rp,"StructArrayLayout1f4");class R5 extends wi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c,h,g){const v=this.length;return this.resize(v+1),this.emplace(v,c,h,g)}emplace(c,h,g,v){const N=4*c,C=2*c;return this.int16[N+0]=h,this.int16[N+1]=g,this.float32[C+1]=v,c}}R5.prototype.bytesPerElement=8,en(R5,"StructArrayLayout2i1f8");class F5 extends wi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(c,h,g){const v=this.length;return this.resize(v+1),this.emplace(v,c,h,g)}emplace(c,h,g,v){const N=4*c;return this.int16[N+0]=h,this.int16[N+1]=g,this.int16[N+2]=v,c}}F5.prototype.bytesPerElement=8,en(F5,"StructArrayLayout3i8");class z5 extends wi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(c,h,g,v,N){const C=this.length;return this.resize(C+1),this.emplace(C,c,h,g,v,N)}emplace(c,h,g,v,N,C){const L=5*c;return this.int16[L+0]=h,this.int16[L+1]=g,this.int16[L+2]=v,this.int16[L+3]=N,this.int16[L+4]=C,c}}z5.prototype.bytesPerElement=10,en(z5,"StructArrayLayout5i10");class TN extends wi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c,h,g,v,N,C,L){const F=this.length;return this.resize(F+1),this.emplace(F,c,h,g,v,N,C,L)}emplace(c,h,g,v,N,C,L,F){const $=6*c,K=12*c,Z=3*c;return this.int16[$+0]=h,this.int16[$+1]=g,this.uint8[K+4]=v,this.uint8[K+5]=N,this.uint8[K+6]=C,this.uint8[K+7]=L,this.float32[Z+2]=F,c}}TN.prototype.bytesPerElement=12,en(TN,"StructArrayLayout2i4ub1f12");class Lu extends wi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c,h,g){const v=this.length;return this.resize(v+1),this.emplace(v,c,h,g)}emplace(c,h,g,v){const N=3*c;return this.float32[N+0]=h,this.float32[N+1]=g,this.float32[N+2]=v,c}}Lu.prototype.bytesPerElement=12,en(Lu,"StructArrayLayout3f12");class Gd extends wi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c,h,g,v,N){const C=this.length;return this.resize(C+1),this.emplace(C,c,h,g,v,N)}emplace(c,h,g,v,N,C){const L=6*c,F=3*c;return this.uint16[L+0]=h,this.uint16[L+1]=g,this.uint16[L+2]=v,this.uint16[L+3]=N,this.float32[F+2]=C,c}}Gd.prototype.bytesPerElement=12,en(Gd,"StructArrayLayout4ui1f12");class jx extends wi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(c,h,g,v){const N=this.length;return this.resize(N+1),this.emplace(N,c,h,g,v)}emplace(c,h,g,v,N){const C=4*c;return this.uint16[C+0]=h,this.uint16[C+1]=g,this.uint16[C+2]=v,this.uint16[C+3]=N,c}}jx.prototype.bytesPerElement=8,en(jx,"StructArrayLayout4ui8");class AN extends wi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(c,h,g,v,N,C){const L=this.length;return this.resize(L+1),this.emplace(L,c,h,g,v,N,C)}emplace(c,h,g,v,N,C,L){const F=6*c;return this.int16[F+0]=h,this.int16[F+1]=g,this.int16[F+2]=v,this.int16[F+3]=N,this.int16[F+4]=C,this.int16[F+5]=L,c}}AN.prototype.bytesPerElement=12,en(AN,"StructArrayLayout6i12");class B5 extends wi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(c,h,g,v,N,C,L,F,$,K,Z,X){const re=this.length;return this.resize(re+1),this.emplace(re,c,h,g,v,N,C,L,F,$,K,Z,X)}emplace(c,h,g,v,N,C,L,F,$,K,Z,X,re){const ae=12*c;return this.int16[ae+0]=h,this.int16[ae+1]=g,this.int16[ae+2]=v,this.int16[ae+3]=N,this.uint16[ae+4]=C,this.uint16[ae+5]=L,this.uint16[ae+6]=F,this.uint16[ae+7]=$,this.int16[ae+8]=K,this.int16[ae+9]=Z,this.int16[ae+10]=X,this.int16[ae+11]=re,c}}B5.prototype.bytesPerElement=24,en(B5,"StructArrayLayout4i4ui4i24");class $5 extends wi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c,h,g,v,N,C){const L=this.length;return this.resize(L+1),this.emplace(L,c,h,g,v,N,C)}emplace(c,h,g,v,N,C,L){const F=10*c,$=5*c;return this.int16[F+0]=h,this.int16[F+1]=g,this.int16[F+2]=v,this.float32[$+2]=N,this.float32[$+3]=C,this.float32[$+4]=L,c}}$5.prototype.bytesPerElement=20,en($5,"StructArrayLayout3i3f20");class ig extends wi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c,h,g,v){const N=this.length;return this.resize(N+1),this.emplace(N,c,h,g,v)}emplace(c,h,g,v,N){const C=4*c;return this.float32[C+0]=h,this.float32[C+1]=g,this.float32[C+2]=v,this.float32[C+3]=N,c}}ig.prototype.bytesPerElement=16,en(ig,"StructArrayLayout4f16");class EN extends wi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(c){const h=this.length;return this.resize(h+1),this.emplace(h,c)}emplace(c,h){return this.uint32[1*c+0]=h,c}}EN.prototype.bytesPerElement=4,en(EN,"StructArrayLayout1ul4");class Ou extends wi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(c,h){const g=this.length;return this.resize(g+1),this.emplace(g,c,h)}emplace(c,h,g){const v=2*c;return this.uint16[v+0]=h,this.uint16[v+1]=g,c}}Ou.prototype.bytesPerElement=4,en(Ou,"StructArrayLayout2ui4");class IN extends wi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(c,h,g,v,N,C,L,F,$,K,Z,X,re){const ae=this.length;return this.resize(ae+1),this.emplace(ae,c,h,g,v,N,C,L,F,$,K,Z,X,re)}emplace(c,h,g,v,N,C,L,F,$,K,Z,X,re,ae){const me=20*c,Se=10*c;return this.int16[me+0]=h,this.int16[me+1]=g,this.int16[me+2]=v,this.int16[me+3]=N,this.int16[me+4]=C,this.float32[Se+3]=L,this.float32[Se+4]=F,this.float32[Se+5]=$,this.float32[Se+6]=K,this.int16[me+14]=Z,this.uint32[Se+8]=X,this.uint16[me+18]=re,this.uint16[me+19]=ae,c}}IN.prototype.bytesPerElement=40,en(IN,"StructArrayLayout5i4f1i1ul2ui40");class PN extends wi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(c,h,g,v,N,C,L){const F=this.length;return this.resize(F+1),this.emplace(F,c,h,g,v,N,C,L)}emplace(c,h,g,v,N,C,L,F){const $=8*c;return this.int16[$+0]=h,this.int16[$+1]=g,this.int16[$+2]=v,this.int16[$+4]=N,this.int16[$+5]=C,this.int16[$+6]=L,this.int16[$+7]=F,c}}PN.prototype.bytesPerElement=16,en(PN,"StructArrayLayout3i2i2i16");class LN extends wi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(c,h,g,v,N){const C=this.length;return this.resize(C+1),this.emplace(C,c,h,g,v,N)}emplace(c,h,g,v,N,C){const L=4*c,F=8*c;return this.float32[L+0]=h,this.float32[L+1]=g,this.float32[L+2]=v,this.int16[F+6]=N,this.int16[F+7]=C,c}}LN.prototype.bytesPerElement=16,en(LN,"StructArrayLayout2f1f2i16");class U5 extends wi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c,h,g,v,N,C){const L=this.length;return this.resize(L+1),this.emplace(L,c,h,g,v,N,C)}emplace(c,h,g,v,N,C,L){const F=20*c,$=5*c;return this.uint8[F+0]=h,this.uint8[F+1]=g,this.float32[$+1]=v,this.float32[$+2]=N,this.float32[$+3]=C,this.float32[$+4]=L,c}}U5.prototype.bytesPerElement=20,en(U5,"StructArrayLayout2ub4f20");class Qo extends wi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(c,h,g){const v=this.length;return this.resize(v+1),this.emplace(v,c,h,g)}emplace(c,h,g,v){const N=3*c;return this.uint16[N+0]=h,this.uint16[N+1]=g,this.uint16[N+2]=v,c}}Qo.prototype.bytesPerElement=6,en(Qo,"StructArrayLayout3ui6");class y0 extends wi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(c,h,g,v,N,C,L,F,$,K,Z,X,re,ae,me,Se,Ne,Fe,ze,Xe,gt){const ht=this.length;return this.resize(ht+1),this.emplace(ht,c,h,g,v,N,C,L,F,$,K,Z,X,re,ae,me,Se,Ne,Fe,ze,Xe,gt)}emplace(c,h,g,v,N,C,L,F,$,K,Z,X,re,ae,me,Se,Ne,Fe,ze,Xe,gt,ht){const bt=30*c,Ct=15*c,Et=60*c;return this.int16[bt+0]=h,this.int16[bt+1]=g,this.int16[bt+2]=v,this.float32[Ct+2]=N,this.float32[Ct+3]=C,this.uint16[bt+8]=L,this.uint16[bt+9]=F,this.uint32[Ct+5]=$,this.uint32[Ct+6]=K,this.uint32[Ct+7]=Z,this.uint16[bt+16]=X,this.uint16[bt+17]=re,this.uint16[bt+18]=ae,this.float32[Ct+10]=me,this.float32[Ct+11]=Se,this.uint8[Et+48]=Ne,this.uint8[Et+49]=Fe,this.uint8[Et+50]=ze,this.uint32[Ct+13]=Xe,this.int16[bt+28]=gt,this.uint8[Et+58]=ht,c}}y0.prototype.bytesPerElement=60,en(y0,"StructArrayLayout3i2f2ui3ul3ui2f3ub1ul1i1ub60");class q5 extends wi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(c,h,g,v,N,C,L,F,$,K,Z,X,re,ae,me,Se,Ne,Fe,ze,Xe,gt,ht,bt,Ct,Et,Xt,Rt,rr,lr,cr,yr,_r,fr){const gr=this.length;return this.resize(gr+1),this.emplace(gr,c,h,g,v,N,C,L,F,$,K,Z,X,re,ae,me,Se,Ne,Fe,ze,Xe,gt,ht,bt,Ct,Et,Xt,Rt,rr,lr,cr,yr,_r,fr)}emplace(c,h,g,v,N,C,L,F,$,K,Z,X,re,ae,me,Se,Ne,Fe,ze,Xe,gt,ht,bt,Ct,Et,Xt,Rt,rr,lr,cr,yr,_r,fr,gr){const tr=20*c,Qt=40*c,xr=80*c;return this.float32[tr+0]=h,this.float32[tr+1]=g,this.int16[Qt+4]=v,this.int16[Qt+5]=N,this.int16[Qt+6]=C,this.int16[Qt+7]=L,this.int16[Qt+8]=F,this.int16[Qt+9]=$,this.int16[Qt+10]=K,this.int16[Qt+11]=Z,this.int16[Qt+12]=X,this.uint16[Qt+13]=re,this.uint16[Qt+14]=ae,this.uint16[Qt+15]=me,this.uint16[Qt+16]=Se,this.uint16[Qt+17]=Ne,this.uint16[Qt+18]=Fe,this.uint16[Qt+19]=ze,this.uint16[Qt+20]=Xe,this.uint16[Qt+21]=gt,this.uint16[Qt+22]=ht,this.uint16[Qt+23]=bt,this.uint16[Qt+24]=Ct,this.uint16[Qt+25]=Et,this.uint16[Qt+26]=Xt,this.uint16[Qt+27]=Rt,this.uint32[tr+14]=rr,this.float32[tr+15]=lr,this.float32[tr+16]=cr,this.float32[tr+17]=yr,this.float32[tr+18]=_r,this.uint8[xr+76]=fr,this.uint16[Qt+39]=gr,c}}q5.prototype.bytesPerElement=80,en(q5,"StructArrayLayout2f9i15ui1ul4f1ub1ui80");class V5 extends wi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c,h,g,v,N,C){const L=this.length;return this.resize(L+1),this.emplace(L,c,h,g,v,N,C)}emplace(c,h,g,v,N,C,L){const F=6*c;return this.float32[F+0]=h,this.float32[F+1]=g,this.float32[F+2]=v,this.float32[F+3]=N,this.float32[F+4]=C,this.float32[F+5]=L,c}}V5.prototype.bytesPerElement=24,en(V5,"StructArrayLayout6f24");class kx extends wi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c,h,g,v,N){const C=this.length;return this.resize(C+1),this.emplace(C,c,h,g,v,N)}emplace(c,h,g,v,N,C){const L=5*c;return this.float32[L+0]=h,this.float32[L+1]=g,this.float32[L+2]=v,this.float32[L+3]=N,this.float32[L+4]=C,c}}kx.prototype.bytesPerElement=20,en(kx,"StructArrayLayout5f20");class H5 extends wi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c,h,g,v,N,C,L){const F=this.length;return this.resize(F+1),this.emplace(F,c,h,g,v,N,C,L)}emplace(c,h,g,v,N,C,L,F){const $=7*c;return this.float32[$+0]=h,this.float32[$+1]=g,this.float32[$+2]=v,this.float32[$+3]=N,this.float32[$+4]=C,this.float32[$+5]=L,this.float32[$+6]=F,c}}H5.prototype.bytesPerElement=28,en(H5,"StructArrayLayout7f28");class W5 extends wi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c,h,g,v,N,C,L,F,$,K,Z){const X=this.length;return this.resize(X+1),this.emplace(X,c,h,g,v,N,C,L,F,$,K,Z)}emplace(c,h,g,v,N,C,L,F,$,K,Z,X){const re=11*c;return this.float32[re+0]=h,this.float32[re+1]=g,this.float32[re+2]=v,this.float32[re+3]=N,this.float32[re+4]=C,this.float32[re+5]=L,this.float32[re+6]=F,this.float32[re+7]=$,this.float32[re+8]=K,this.float32[re+9]=Z,this.float32[re+10]=X,c}}W5.prototype.bytesPerElement=44,en(W5,"StructArrayLayout11f44");class v0 extends wi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c,h,g,v,N,C,L,F,$){const K=this.length;return this.resize(K+1),this.emplace(K,c,h,g,v,N,C,L,F,$)}emplace(c,h,g,v,N,C,L,F,$,K){const Z=9*c;return this.float32[Z+0]=h,this.float32[Z+1]=g,this.float32[Z+2]=v,this.float32[Z+3]=N,this.float32[Z+4]=C,this.float32[Z+5]=L,this.float32[Z+6]=F,this.float32[Z+7]=$,this.float32[Z+8]=K,c}}v0.prototype.bytesPerElement=36,en(v0,"StructArrayLayout9f36");class zf extends wi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c,h){const g=this.length;return this.resize(g+1),this.emplace(g,c,h)}emplace(c,h,g){const v=2*c;return this.float32[v+0]=h,this.float32[v+1]=g,c}}zf.prototype.bytesPerElement=8,en(zf,"StructArrayLayout2f8");class Kd extends wi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(c,h,g,v){const N=this.length;return this.resize(N+1),this.emplace(N,c,h,g,v)}emplace(c,h,g,v,N){const C=6*c;return this.uint32[3*c+0]=h,this.uint16[C+2]=g,this.uint16[C+3]=v,this.uint16[C+4]=N,c}}Kd.prototype.bytesPerElement=12,en(Kd,"StructArrayLayout1ul3ui12");class og extends wi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(c){const h=this.length;return this.resize(h+1),this.emplace(h,c)}emplace(c,h){return this.uint16[1*c+0]=h,c}}og.prototype.bytesPerElement=2,en(og,"StructArrayLayout1ui2");class G5 extends wi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c,h,g,v,N,C,L,F,$,K,Z,X,re,ae,me,Se){const Ne=this.length;return this.resize(Ne+1),this.emplace(Ne,c,h,g,v,N,C,L,F,$,K,Z,X,re,ae,me,Se)}emplace(c,h,g,v,N,C,L,F,$,K,Z,X,re,ae,me,Se,Ne){const Fe=16*c;return this.float32[Fe+0]=h,this.float32[Fe+1]=g,this.float32[Fe+2]=v,this.float32[Fe+3]=N,this.float32[Fe+4]=C,this.float32[Fe+5]=L,this.float32[Fe+6]=F,this.float32[Fe+7]=$,this.float32[Fe+8]=K,this.float32[Fe+9]=Z,this.float32[Fe+10]=X,this.float32[Fe+11]=re,this.float32[Fe+12]=ae,this.float32[Fe+13]=me,this.float32[Fe+14]=Se,this.float32[Fe+15]=Ne,c}}G5.prototype.bytesPerElement=64,en(G5,"StructArrayLayout16f64");class ON extends wi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(c,h,g,v,N,C,L){const F=this.length;return this.resize(F+1),this.emplace(F,c,h,g,v,N,C,L)}emplace(c,h,g,v,N,C,L,F){const $=10*c,K=5*c;return this.uint16[$+0]=h,this.uint16[$+1]=g,this.uint16[$+2]=v,this.uint16[$+3]=N,this.float32[K+2]=C,this.float32[K+3]=L,this.float32[K+4]=F,c}}ON.prototype.bytesPerElement=20,en(ON,"StructArrayLayout4ui3f20");class K5 extends wi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(c){const h=this.length;return this.resize(h+1),this.emplace(h,c)}emplace(c,h){return this.int16[1*c+0]=h,c}}K5.prototype.bytesPerElement=2,en(K5,"StructArrayLayout1i2");class DN extends wi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer)}emplaceBack(c){const h=this.length;return this.resize(h+1),this.emplace(h,c)}emplace(c,h){return this.uint8[1*c+0]=h,c}}DN.prototype.bytesPerElement=1,en(DN,"StructArrayLayout1ub1");class RN extends s_{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]}}RN.prototype.size=40;class b6 extends IN{get(c){return new RN(this,c)}}en(b6,"CollisionBoxArray");class FN extends s_{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}}FN.prototype.size=60;class w6 extends y0{get(c){return new FN(this,c)}}en(w6,"PlacedSymbolArray");class j6 extends s_{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]}}j6.prototype.size=80;class Z5 extends q5{get(c){return new j6(this,c)}}en(Z5,"SymbolInstanceArray");class zN extends Rp{getoffsetX(c){return this.float32[1*c+0]}}en(zN,"GlyphOffsetArray");class k6 extends ag{getx(c){return this.int16[2*c+0]}gety(c){return this.int16[2*c+1]}}en(k6,"SymbolLineVertexArray");class Y5 extends s_{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]}}Y5.prototype.size=12;class X5 extends Kd{get(c){return new Y5(this,c)}}en(X5,"FeatureIndexArray");class N6 extends Ou{geta_centroid_pos0(c){return this.uint16[2*c+0]}geta_centroid_pos1(c){return this.uint16[2*c+1]}}en(N6,"FillExtrusionCentroidArray");class BN extends s_{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]}}BN.prototype.size=6;class a_ extends g0{get(c){return new BN(this,c)}}en(a_,"FillExtrusionWallArray");const S6=Ds([{name:"a_pos",components:2,type:"Int16"}],4),ooe=Ds([{name:"a_circle_z_offset",components:1,type:"Float32"}],4),C6=Ds([{name:"a_pos_3",components:3,type:"Int16"},{name:"a_pos_normal_3",components:3,type:"Int16"}]);class Ui{constructor(c=[]){this.segments=c}_prepareSegment(c,h,g,v){let N=this.segments[this.segments.length-1];return c>Ui.MAX_VERTEX_ARRAY_LENGTH&&Wr(`Max vertices per segment is ${Ui.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${c}`),(!N||N.vertexLength+c>Ui.MAX_VERTEX_ARRAY_LENGTH||N.sortKey!==v)&&(N={vertexOffset:h,primitiveOffset:g,vertexLength:0,primitiveLength:0},v!==void 0&&(N.sortKey=v),this.segments.push(N)),N}prepareSegment(c,h,g,v){return this._prepareSegment(c,h.length,g.length,v)}get(){return this.segments}destroy(){for(const c of this.segments)for(const h in c.vaos)c.vaos[h].destroy()}static simpleSegment(c,h,g,v){return new Ui([{vertexOffset:c,primitiveOffset:h,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)}Ui.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,en(Ui,"SegmentVector");const loe=Ds([{name:"a_pattern",components:4,type:"Uint16"},{name:"a_pixel_ratio",components:1,type:"Float32"}]),coe=Ds([{name:"a_pattern_b",components:4,type:"Uint16"}]),doe=Ds([{name:"a_dash",components:4,type:"Uint16"}]);class i_{constructor(){this.ids=[],this.uniqueIds=[],this.positions=[],this.indexed=!1}add(c,h,g,v){this.ids.push(Q5(c)),this.positions.push(h,g,v)}eachPosition(c,h){const g=Q5(c);let v=0,N=this.ids.length-1;for(;v>1;this.ids[C]>=g?N=C:v=C+1}for(;this.ids[v]===g;)h(this.positions[3*v],this.positions[3*v+1],this.positions[3*v+2]),v++}static serialize(c,h){const g=new Float64Array(c.ids),v=new Uint32Array(c.positions);return J5(g,v,0,g.length-1),h&&(h.add(g.buffer),h.add(v.buffer)),{ids:g,positions:v}}static deserialize(c){const h=new i_;let g;h.ids=c.ids,h.positions=c.positions;for(const v of h.ids)v!==g&&h.uniqueIds.push(v),g=v;return h.indexed=!0,h}}function Q5(f){const c=+f;return Number.isSafeInteger(c)?c:mr(String(f))}function J5(f,c,h,g){for(;h>1];let N=h-1,C=g+1;for(;;){do N++;while(f[N]v);if(N>=C)break;UN(f,N,C),UN(c,3*N,3*C),UN(c,3*N+1,3*C+1),UN(c,3*N+2,3*C+2)}C-h`u_${N}`),this.type=g,this.context=v}setUniform(c,h,g,v,N){const C=v.constantOr(this.value);h.set(c,N,C instanceof ba?C.toPremultipliedRenderColor(this.lutExpression&&this.lutExpression.kind==="constant"&&this.lutExpression.value==="none"?null:this.context.lut):C)}getBinding(c,h){return this.type==="color"?new l_(c):new Jo(c)}}class _0{constructor(c,h){this.uniformNames=h.map(g=>`u_${g}`),this.pattern=null,this.patternTransition=null,this.pixelRatio=1}setConstantPatternPositions(c,h){this.pixelRatio=c.pixelRatio||1,this.pattern=c.tl.concat(c.br),this.patternTransition=h?h.tl.concat(h.br):this.pattern}setUniform(c,h,g,v,N){let C=null;N!=="u_pattern"&&N!=="u_dash"||(C=this.pattern),N==="u_pattern_b"&&(C=this.patternTransition),N==="u_pixel_ratio"&&(C=this.pixelRatio),C&&h.set(c,N,C)}getBinding(c,h){return h==="u_pattern"||h==="u_pattern_b"||h==="u_dash"?new VN(c):new Jo(c)}}class zp{constructor(c,h,g,v){this.expression=c,this.type=g,this.maxValue=0,this.paintVertexAttributes=h.map(N=>({name:`a_${N}`,type:"Float32",components:g==="color"?2:1,offset:0})),this.paintVertexArray=new v}populatePaintArray(c,h,g,v,N,C,L,F){const $=this.paintVertexArray.length,K=this.expression.kind==="composite"||this.expression.kind==="source"?this.expression.evaluate(new oi(0,{brightness:C,worldview:F}),h,{},N,v,L):this.expression.kind==="constant"&&this.expression.value,Z=d_(this.lutExpression,h,{},v,N,C,L,F);this.paintVertexArray.resize(c),this._setPaintValue($,c,K,Z?null:this.context.lut)}updatePaintArray(c,h,g,v,N,C,L,F){const $=this.expression.kind==="composite"||this.expression.kind==="source"?this.expression.evaluate({zoom:0,brightness:L,worldview:F},g,v,void 0,N):this.expression.kind==="constant"&&this.expression.value,K=d_(this.lutExpression,g,v,N,void 0,L,void 0,F);this._setPaintValue(c,h,$,K?null:this.context.lut)}_setPaintValue(c,h,g,v){if(this.type==="color"){const N=eM(g.toPremultipliedRenderColor(v));for(let C=c;C`u_${L}_t`),this.type=g,this.useIntegerZoom=v,this.context=N,this.maxValue=0,this.paintVertexAttributes=h.map(L=>({name:`a_${L}`,type:"Float32",components:g==="color"?4:2,offset:0})),this.paintVertexArray=new C}populatePaintArray(c,h,g,v,N,C,L,F){const $=this.expression.evaluate(new oi(this.context.zoom,{brightness:C,worldview:F}),h,{},N,v,L),K=this.expression.evaluate(new oi(this.context.zoom+1,{brightness:C,worldview:F}),h,{},N,v,L),Z=d_(this.lutExpression,h,{},v,N,C,L,F),X=this.paintVertexArray.length;this.paintVertexArray.resize(c),this._setPaintValue(X,c,$,K,Z?null:this.context.lut)}updatePaintArray(c,h,g,v,N,C,L,F){const $=this.expression.evaluate({zoom:this.context.zoom,brightness:L,worldview:F},g,v,void 0,N),K=this.expression.evaluate({zoom:this.context.zoom+1,brightness:L,worldview:F},g,v,void 0,N),Z=d_(this.lutExpression,g,v,N,void 0,L,void 0,F);this._setPaintValue(c,h,$,K,Z?null:this.context.lut)}_setPaintValue(c,h,g,v,N){if(this.type==="color"){const C=eM(g.toPremultipliedRenderColor(N)),L=eM(g.toPremultipliedRenderColor(N));for(let F=c;F!0){this.binders={},this._buffers=[],this.context=h;const v=[];for(const N in c.paint._values){const C=c.paint.get(N);if(N.endsWith("-use-theme")||!g(N)||!(C instanceof yx&&Xv(C.property.specification)))continue;const L=poe(N,c.type),F=C.value,$=C.property.specification.type,K=!!C.property.useIntegerZoom,Z=N==="line-dasharray"||N.endsWith("pattern"),X=c.paint.get(`${N}-use-theme`),re=N==="line-dasharray"&&c.layout.get("line-cap").value.kind!=="constant"||X&&X.value.kind!=="constant";if(F.kind!=="constant"||re)if(F.kind==="source"||re||Z){const ae=tM(N,$,"source");this.binders[N]=Z?new $p(F,L,$,ae,c.id):new zp(F,L,$,ae),v.push(`/a_${N}`)}else{const ae=tM(N,$,"composite");this.binders[N]=new Bp(F,L,$,K,h,ae),v.push(`/z_${N}`)}else this.binders[N]=Z?new _0(F.value,L):new u_(F.value,L,$,h),v.push(`/u_${N}`);X&&(this.binders[N].lutExpression=X.value)}this.cacheKey=v.sort().join("")}getMaxValue(c){const h=this.binders[c];return h instanceof zp||h instanceof Bp?h.maxValue:0}populatePaintArrays(c,h,g,v,N,C,L,F){for(const $ in this.binders){const K=this.binders[$];K.context=this.context,(K instanceof zp||K instanceof Bp||K instanceof $p)&&K.populatePaintArray(c,h,g,v,N,C,L,F)}}setConstantPatternPositions(c,h){for(const g in this.binders){const v=this.binders[g];v instanceof _0&&v.setConstantPatternPositions(c,h)}}getPatternTransitionVertexBuffer(c){const h=this.binders[c];return h instanceof $p?h.paintTransitionVertexBuffer:null}updatePaintArrays(c,h,g,v,N,C,L,F,$,K){let Z=!1;const X=Object.keys(c),re=X.length!==0&&!F,ae=re?X:h.uniqueIds;this.context.lut=N.lut;for(const me in this.binders){const Se=this.binders[me];if(Se.context=this.context,(Se instanceof zp||Se instanceof Bp||Se instanceof $p)&&Se.expression&&Se.expression.kind&&Se.expression.kind!=="constant"&&(Se.expression.isStateDependent===!0||Se.expression.isLightConstant===!1)){const Ne=N.paint.get(me);Se.expression=Ne.value;for(const Fe of ae){const ze=c[Fe.toString()];h.eachPosition(Fe,(Xe,gt,ht)=>{const bt=v.feature(Xe);Se.updatePaintArray(gt,ht,bt,ze,C,L,$,K)})}if(!re)for(const Fe of g.uniqueIds){const ze=c[Fe.toString()];g.eachPosition(Fe,(Xe,gt,ht)=>{const bt=v.feature(Xe);Se.updatePaintArray(gt,ht,bt,ze,C,L,$,K)})}Z=!0}}return Z}defines(){const c=[];for(const h in this.binders){const g=this.binders[h];(g instanceof u_||g instanceof _0)&&c.push(...g.uniformNames.map(v=>`#define HAS_UNIFORM_${v}`))}return c}getPaintVertexBuffers(){return this._buffers}getUniforms(c){const h=[];for(const g in this.binders){const v=this.binders[g];if(v instanceof u_||v instanceof _0||v instanceof Bp)for(const N of v.uniformNames)h.push({name:N,property:g,binding:v.getBinding(c,N)})}return h}setUniforms(c,h,g,v,N){for(const{name:C,property:L,binding:F}of g)this.binders[L].setUniform(c,F,N,v.get(L),C)}updatePaintBuffers(){this._buffers=[];for(const c in this.binders){const h=this.binders[c];(h instanceof zp||h instanceof Bp||h instanceof $p)&&h.paintVertexBuffer&&this._buffers.push(h.paintVertexBuffer),h instanceof $p&&h.paintTransitionVertexBuffer&&this._buffers.push(h.paintTransitionVertexBuffer)}}upload(c){for(const h in this.binders){const g=this.binders[h];(g instanceof zp||g instanceof Bp||g instanceof $p)&&g.upload(c)}this.updatePaintBuffers()}destroy(){for(const c in this.binders){const h=this.binders[c];(h instanceof zp||h instanceof Bp||h instanceof $p)&&h.destroy()}}}class Gh{constructor(c,h,g=()=>!0){this.programConfigurations={};for(const v of c)this.programConfigurations[v.id]=new lg(v,h,g);this.needsUpload=!1,this._featureMap=new i_,this._featureMapWithoutIds=new i_,this._bufferOffset=0,this._idlessCounter=0}populatePaintArrays(c,h,g,v,N,C,L,F,$){for(const K in this.programConfigurations)this.programConfigurations[K].populatePaintArrays(c,h,v,N,C,L,F,$);h.id!==void 0?this._featureMap.add(h.id,g,this._bufferOffset,c):(this._featureMapWithoutIds.add(this._idlessCounter,g,this._bufferOffset,c),this._idlessCounter+=1),this._bufferOffset=c,this.needsUpload=!0}updatePaintArrays(c,h,g,v,N,C,L,F){for(const $ of g)this.needsUpload=this.programConfigurations[$.id].updatePaintArrays(c,this._featureMap,this._featureMapWithoutIds,h,$,v,N,C,L||0,F)||this.needsUpload}get(c){return this.programConfigurations[c]}upload(c){if(this.needsUpload){for(const h in this.programConfigurations)this.programConfigurations[h].upload(c);this.needsUpload=!1}}destroy(){for(const c in this.programConfigurations)this.programConfigurations[c].destroy()}}const foe={"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 poe(f,c){return foe[f]||[f.replace(`${c}-`,"").replace(/-/g,"_")]}const moe={"line-pattern":{source:Gd,composite:Gd},"fill-pattern":{source:Gd,composite:Gd},"fill-extrusion-pattern":{source:Gd,composite:Gd},"line-dasharray":{source:jx,composite:jx}},goe={color:{source:zf,composite:ig},number:{source:Rp,composite:zf}};function tM(f,c,h){const g=moe[f];return g&&g[h]||goe[c][h]}en(u_,"ConstantBinder"),en(_0,"PatternConstantBinder"),en(zp,"SourceExpressionBinder"),en($p,"PatternCompositeBinder"),en(Bp,"CompositeExpressionBinder"),en(lg,"ProgramConfiguration",{omit:["_buffers"]}),en(Gh,"ProgramConfigurationSet");const Ec=Cr/Math.PI/2,uh=5,GN=6,xoe=16383,b0=64,rM=[b0,32,16],hh=-Ec,fh=Ec;function Nx(f,c,h,g=Ec){return h=qn(h),[f*Math.sin(h)*g,-c*g,f*Math.cos(h)*g]}function w0(f,c,h){return Nx(Math.cos(qn(f)),Math.sin(qn(f)),c,h)}const w=63710088e-1,d=2*Math.PI*w;class m{constructor(c,h){if(isNaN(c)||isNaN(h))throw new Error(`Invalid LngLat object: (${c}, ${h})`);if(this.lng=+c,this.lat=+h,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new m(Ye(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(c){const h=Math.PI/180,g=this.lat*h,v=c.lat*h,N=Math.sin(g)*Math.sin(v)+Math.cos(g)*Math.cos(v)*Math.cos((c.lng-this.lng)*h);return w*Math.acos(Math.min(N,1))}toBounds(c=0){const h=360*c/40075017,g=h/Math.cos(Math.PI/180*this.lat);return new j({lng:this.lng-g,lat:this.lat-h},{lng:this.lng+g,lat:this.lat+h})}toEcef(c){return w0(this.lat,this.lng,Ec+c*Ec/w)}static convert(c){if(c instanceof m)return c;if(Array.isArray(c)&&(c.length===2||c.length===3))return new m(Number(c[0]),Number(c[1]));if(!Array.isArray(c)&&typeof c=="object"&&c!==null)return new m(Number("lng"in c?c.lng:c.lon),Number(c.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: , lat: }, an object {lon: , lat: }, or an array of [, ]")}}class j{constructor(c,h){c&&(h?this.setSouthWest(c).setNorthEast(h):Array.isArray(c)&&c.length===4?this.setSouthWest([c[0],c[1]]).setNorthEast([c[2],c[3]]):this.setSouthWest(c[0]).setNorthEast(c[1]))}setNorthEast(c){return this._ne=c instanceof m?new m(c.lng,c.lat):m.convert(c),this}setSouthWest(c){return this._sw=c instanceof m?new m(c.lng,c.lat):m.convert(c),this}extend(c){const h=this._sw,g=this._ne;let v,N;if(c instanceof m)v=c,N=c;else{if(!(c instanceof j))return Array.isArray(c)?c.length===4||c.every(Array.isArray)?this.extend(j.convert(c)):this.extend(m.convert(c)):typeof c=="object"&&c!==null&&c.hasOwnProperty("lat")&&(c.hasOwnProperty("lon")||c.hasOwnProperty("lng"))?this.extend(m.convert(c)):this;if(v=c._sw,N=c._ne,!v||!N)return this}return h||g?(h.lng=Math.min(v.lng,h.lng),h.lat=Math.min(v.lat,h.lat),g.lng=Math.max(N.lng,g.lng),g.lat=Math.max(N.lat,g.lat)):(this._sw=new m(v.lng,v.lat),this._ne=new m(N.lng,N.lat)),this}getCenter(){return new m((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)}getSouthWest(){return this._sw}getNorthEast(){return this._ne}getNorthWest(){return new m(this.getWest(),this.getNorth())}getSouthEast(){return new m(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(c){const{lng:h,lat:g}=m.convert(c);let v=this._sw.lng<=h&&h<=this._ne.lng;return this._sw.lng>this._ne.lng&&(v=this._sw.lng>=h&&h>=this._ne.lng),this._sw.lat<=g&&g<=this._ne.lat&&v}static convert(c){if(c)return c instanceof j?c:new j(c)}}const A=0,O=25.5;function R(f){return d*Math.cos(f*Math.PI/180)}function B(f){return(180+f)/360}function H(f){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+f*Math.PI/360)))/360}function Y(f,c){return f/R(c)}function te(f){return 360*f-180}function de(f){return 360/Math.PI*Math.atan(Math.exp((180-360*f)*Math.PI/180))-90}function ce(f,c){return f*R(de(c))}const ue=85.051129;function je(f){return Math.cos(qn(xe(f,-ue,ue)))}function ve(f,c){const h=xe(c,A,O),g=Math.pow(2,h);return je(f)*d/(512*g)}function Re(f){return 1/Math.cos(f*Math.PI/180)}function Le(f,c=0){const h=Math.exp(Math.PI*(1-(f.y+c/Cr)/(1<=F?(rt(f,c,h,$,K,N,Z,L,F),rt(f,$,K,g,v,Z,C,L,F)):f.push(C)}function Ke(f,c,h){let g=f[0],v=g.x,N=g.y;c(g);const C=[g];for(let L=1;Lf.x+1||gf.y+1)&&Wr("Geometry exceeds allowed extent, reduce your vector tile buffer size"),f}function St(f,c,h){const g=f.loadGeometry(),v=f.extent,N=Cr/v;if(c&&h&&h.projection.isReprojectedInTileSpace){const C=1<{const re=te((c.x+X.x/v)/C),ae=de((c.y+X.y/v)/C),me=K.project(re,ae);X.x=(me.x*L-F)*v,X.y=(me.y*L-$)*v};for(let X=0;X=v||ae.y<0||ae.y>=v||(Z(ae),re.push(ae));g[X]=re}}for(const C of g)for(const L of C)ut(L,N);return g}function Dt(f,c){return{type:f.type,id:f.id,properties:f.properties,geometry:c?St(f):[]}}class Ot{constructor(c,h,g,v,N){this.properties={},this.extent=g,this.type=0,this.id=void 0,this._pbf=c,this._geometry=-1,this._keys=v,this._values=N,c.readFields(Gt,this,h)}loadGeometry(){const c=this._pbf;c.pos=this._geometry;const h=c.readVarint()+c.pos,g=[];let v,N=1,C=0,L=0,F=0;for(;c.pos>3}if(C--,N===1||N===2)L+=c.readSVarint(),F+=c.readSVarint(),N===1&&(v&&g.push(v),v=[]),v&&v.push(new sr(L,F));else{if(N!==7)throw new Error(`unknown command ${N}`);v&&v.push(v[0].clone())}}return v&&g.push(v),g}bbox(){const c=this._pbf;c.pos=this._geometry;const h=c.readVarint()+c.pos;let g=1,v=0,N=0,C=0,L=1/0,F=-1/0,$=1/0,K=-1/0;for(;c.pos>3}if(v--,g===1||g===2)N+=c.readSVarint(),C+=c.readSVarint(),NF&&(F=N),C<$&&($=C),C>K&&(K=C);else if(g!==7)throw new Error(`unknown command ${g}`)}return[L,$,F,K]}toGeoJSON(c,h,g){const v=this.extent*Math.pow(2,g),N=this.extent*c,C=this.extent*h,L=this.loadGeometry();function F(X){return[360*(X.x+N)/v-180,360/Math.PI*Math.atan(Math.exp((1-2*(X.y+C)/v)*Math.PI))-90]}function $(X){return X.map(F)}let K;if(this.type===1){const X=[];for(const ae of L)X.push(ae[0]);const re=$(X);K=X.length===1?{type:"Point",coordinates:re[0]}:{type:"MultiPoint",coordinates:re}}else if(this.type===2){const X=L.map($);K=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(ae){const me=ae.length;if(me<=1)return[ae];const Se=[];let Ne,Fe;for(let ze=0;ze=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[c];const h=this._pbf.readVarint()+this._pbf.pos;return new Ot(this._pbf,h,this.extent,this._keys,this._values)}}function br(f,c,h){f===15?c.version=h.readVarint():f===1?c.name=h.readString():f===5?c.extent=h.readVarint():f===2?c._features.push(h.pos):f===3?c._keys.push(h.readString()):f===4&&c._values.push(function(g){let v=null;const N=g.readVarint()+g.pos;for(;g.pos>3;v=C===1?g.readString():C===2?g.readFloat():C===3?g.readDouble():C===4?g.readVarint64():C===5?g.readVarint():C===6?g.readSVarint():C===7?g.readBoolean():null}if(v==null)throw new Error("unknown feature value");return v}(h))}class Ut{constructor(c,h){this.layers=c.readFields(Tt,{},h)}}function Tt(f,c,h){if(f===3){const g=new ar(h,h.readVarint()+h.pos);g.length&&(c[g.name]=g)}}const Jt="3d_elevation_id",Ht="level";class hr{constructor(){this._valid=!1}reset(c){return this.feature=c,this._valid=!0,this._geometry=c.loadGeometry(),this._geometry.length!==0&&this._geometry[0].length!==0||(this._valid=!1),this}geometry(c,h){return this._valid&&c(h(this._geometry)),this}require(c,h,g){return this.get(c,!0,h,g)}optional(c,h,g){return this.get(c,!1,h,g)}success(){return this._valid}get(c,h,g,v){const N=this.feature.properties.hasOwnProperty(c)?+this.feature.properties[c]:void 0;return this._valid&&N!==void 0&&!Number.isNaN(N)?g(v?v(N):N):h&&(this._valid=!1),this}}class Ar{constructor(c,h){this.featureFunc=c,this.vertexFunc=h}parseFeature(c,h,g){return this.featureFunc(c,h,g)}parseVertex(c,h,g){return this.vertexFunc(c,h,g)}}const Kr=new Ar((f,c,h)=>f.reset(c).require(Jt,g=>{h.id=g}).optional("fixed_height_relative",g=>{h.constantHeight=g},wr.decodeRelativeHeight).geometry(g=>{h.bounds=g},Ep).success(),(f,c,h)=>f.reset(c).require(Jt,g=>{h.id=g}).require("elevation_idx",g=>{h.idx=g}).require("extent",g=>{h.extent=g}).require("height_relative",g=>{h.height=g},wr.decodeRelativeHeight).geometry(g=>{h.position=g},wr.getPoint).success()),Sr=new Ar((f,c,h)=>f.reset(c).require(Jt,g=>{h.id=g}).optional("fixed_height",g=>{h.constantHeight=g},wr.decodeMetricHeight).geometry(g=>{h.bounds=g},Ep).success(),(f,c,h)=>f.reset(c).require(Jt,g=>{h.id=g}).require("elevation_idx",g=>{h.idx=g}).require("extent",g=>{h.extent=g}).require("height",g=>{h.height=g},wr.decodeMetricHeight).geometry(g=>{h.position=g},wr.getPoint).success());class wr{static getPoint(c){return ur(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"?Sr:void 0:Kr}static parse(c){const h=[],g=[],v=c.length,N=new hr;for(let C=0;C=0);if(N===0)return 0;N!==c.length&&(h=!1)}return h?2:1}function ts(f,c){for(const h of f.projections){const g=Xr(c,f.points[0],h.axis);if(h.projection[1]g[1])return 0}return 1}function Us(f,c){let h=0;const g=[0,0,0,0];for(let C=0;C=0&&h++;var v,N;return h}class wa{constructor(c,h){this.points=c||new Array(8).fill([0,0,0]),this.planes=h||new Array(6).fill([0,0,0,0]),this.bounds=hn.fromPoints(this.points),this.projections=[],this.frustumEdges=[ke([],this.points[2],this.points[3]),ke([],this.points[0],this.points[3]),ke([],this.points[4],this.points[0]),ke([],this.points[5],this.points[1]),ke([],this.points[6],this.points[2]),ke([],this.points[7],this.points[3])];for(const g of this.frustumEdges){const v=[0,-g[2],g[1]],N=[g[2],0,-g[0]];this.projections.push({axis:v,projection:Xr(this.points,this.points[0],v)}),this.projections.push({axis:N,projection:Xr(this.points,this.points[0],N)})}}static fromInvProjectionMatrix(c,h,g,v){const N=Math.pow(2,g),C=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map($=>{const K=He([],$,c),Z=1/K[3]/h*N;return(X=K)[0]=(re=K)[0]*(ae=[Z,Z,v?1/K[3]:Z,Z])[0],X[1]=re[1]*ae[1],X[2]=re[2]*ae[2],X[3]=re[3]*ae[3],X;var X,re,ae}),L=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map($=>{const K=qe([],Mt([],ke([],C[$[0]],C[$[1]]),ke([],C[$[2]],C[$[1]]))),Z=-ot(K,C[$[1]]);return K.concat(Z)}),F=[];for(let $=0;$$[1]||$[0]>F[1])return 0}return 1}containsPoint(c){for(const h of this.planes){const g=h[3];if(ot([h[0],h[1],h[2]],c)+g<0)return!1}return!0}}class hn{static fromPoints(c){const h=[1/0,1/0,1/0],g=[-1/0,-1/0,-1/0];for(const v of c)we(h,h,v),be(g,g,v);return new hn(h,g)}static fromTileIdAndHeight(c,h,g){const v=1<c.max[h]||c.min[h]>this.max[h])return!1;return!0}intersectsAabbXY(c){return!(this.min[0]>c.max[0]||c.min[0]>this.max[0]||this.min[1]>c.max[1]||c.min[1]>this.max[1])}encapsulate(c){for(let h=0;h<3;h++)this.min[h]=Math.min(this.min[h],c.min[h]),this.max[h]=Math.max(this.max[h],c.max[h])}encapsulatePoint(c){for(let h=0;h<3;h++)this.min[h]=Math.min(this.min[h],c[h]),this.max[h]=Math.max(this.max[h],c[h])}closestPoint(c){return[Math.max(Math.min(this.max[0],c[0]),this.min[0]),Math.max(Math.min(this.max[1],c[1]),this.min[1]),Math.max(Math.min(this.max[2],c[2]),this.min[2])]}}en(hn,"Aabb");class fa{constructor(c,h){this.feature=c,this.metersToTile=h,this.index=0}get(){const c=this.feature.vertices[this.index],h=this.feature.vertexProps[this.index].dir,g=h[1],v=-h[0],N=(c.extent+1)*this.metersToTile;return[new sr(Math.trunc(c.position[0]+g*N),Math.trunc(c.position[1]+v*N)),new sr(Math.trunc(c.position[0]-g*N),Math.trunc(c.position[1]-v*N))]}next(){this.index++}valid(){return this.index{return L.a0?_e(F,F,1/$):fe(F,0,0,1)}getSafeArea(){return this.safeArea}isTunnel(){return this.heightRange.max<=-5}getClosestEdge(c){if(this.edges.length===0)return;let h=0,g=Number.POSITIVE_INFINITY,v=0;const[N,C,L,F,$,K,Z]=this._tmpVec2;Rn(Z,c.x,c.y);const X=new cn(Z,null);for(let re=0;re0?Va(F,L)/Xe:0,ht=xe(gt,0,1),bt=Math.abs((gt-ht)*this.edgeProps[re].len);ca($,Z,Se),Rn(K,me[1],-me[0]);const Ct=bt+Math.abs(Va($,K));Ct=0;--C){const L=this.edges[C].a,F=this.edges[C].b,{position:$,height:K,extent:Z}=this.vertices[L],{position:X,height:re,extent:ae}=this.vertices[F],me=this.vertexProps[L].dir,Se=this.vertexProps[F].dir;if(fe(h,$[0]/c,$[1]/c,K),fe(g,X[0]/c,X[1]/c,re),fe(v,me[1],-me[0],0),_e(v,v,Z),fe(N,Se[1],-Se[0],0),_e(N,N,ae),this.distSqLines(se(h[0]+.5*v[0],h[1]+.5*v[1],h[2]+.5*v[2]),se(g[0]-.5*N[0],g[1]-.5*N[1],g[2]-.5*N[2]),se(h[0]-.5*v[0],h[1]-.5*v[1],h[2]-.5*v[2]),se(g[0]+.5*N[0],g[1]+.5*N[1],g[2]+.5*N[2]))<=.0025000000000000005)continue;const Ne=this.vertices.length,Fe=ea(_s(),$,X);this.vertices.push({position:Ei(Fe,Fe,.5),height:.5*(K+re),extent:.5*(Z+ae)});const ze=ea(_s(),me,Se);this.vertexProps.push({dir:$o(ze,ze)}),this.edges.splice(C,1),this.edgeProps.splice(C,1),this.edges.push({a:L,b:Ne}),this.edges.push({a:Ne,b:F});const Xe=ca(_s(),this.vertices[Ne].position,$),gt=Ii(Xe),ht={vec:Xe,dir:Ei(_s(),Xe,1/gt),len:gt};this.edgeProps.push(ht),this.edgeProps.push(ht)}}distSqLines(c,h,g,v){const N=ye(ge(),h,c),C=ye(ge(),v,g),L=ye(ge(),c,g),F=ot(N,N),$=ot(N,C),K=ot(N,L),Z=ot(C,C),X=ot(C,L),re=F*Z-$*$;if(re===0)return De(Oe(N,g,v,ot(L,C)/ot(C,C)),c);const ae=(F*X-$*K)/re;return De(Oe(N,c,h,($*X-K*Z)/re),Oe(C,g,v,ae))}}class Ca{static parseFrom(c,h){const g=wr.parse(c);if(!g)return[];let{vertices:v,features:N}=g;const C=1/Le(h);N.sort((K,Z)=>K.id-Z.id),v.sort((K,Z)=>K.id-Z.id||K.idx-Z.idx),v=v.filter((K,Z,X)=>Z===X.findIndex(re=>re.id===K.id&&re.idx===K.idx));const L=new Array;let F=0;const $=v.length;for(const K of N){if(K.constantHeight){L.push(new Yn(K.id,K.bounds,K.constantHeight));continue}for(;F!==$&&v[F].idv.id===g)}}class qa{constructor(c,h){this.zScale=1,this.xOffset=0,this.yOffset=0,c.equals(h)||(this.zScale=Math.pow(2,h.z-c.z),this.xOffset=(c.x*this.zScale-h.x)*Cr,this.yOffset=(c.y*this.zScale-h.y)*Cr)}constantElevation(c,h){if(c.constantHeight!=null)return this.computeBiasedHeight(c.constantHeight,h)}pointElevation(c,h,g){const v=this.constantElevation(h,g);return v??(c.x=c.x*this.zScale+this.xOffset,c.y=c.y*this.zScale+this.yOffset,this.computeBiasedHeight(h.pointElevation(c),g))}computeBiasedHeight(c,h){return h<=0?c:c+h*Pe(0,h,c>=0?c:Math.abs(.5*c))}}en(Yn,"ElevationFeature");class Oa{constructor(c){this.zoom=c.zoom,this.overscaling=c.overscaling,this.layers=c.layers,this.layerIds=this.layers.map(h=>h.fqid),this.index=c.index,this.hasPattern=!1,this.projection=c.projection,this.layoutVertexArray=new ag,this.indexArray=new Qo,this.segments=new Ui,this.programConfigurations=new Gh(c.layers,{zoom:c.zoom,lut:c.lut}),this.stateDependentLayerIds=this.layers.filter(h=>h.isStateDependent()).map(h=>h.id),this.elevationMode=this.layers[0].layout.get("circle-elevation-reference"),this.hasElevation=!1,this.elevationMode!=="none"&&(this.elevatedLayoutVertexArray=new Rp),this.worldview=c.worldview,this.hasAppearances=null}updateFootprints(c,h){}updateAppearances(c,h,g,v){}populate(c,h,g,v){const N=this.layers[0],C=[];let L=null;N.type==="circle"&&(L=N.layout.get("circle-sort-key"));for(const{feature:$,id:K,index:Z,sourceLayerIndex:X}of c){const re=this.layers[0]._featureFilter.needGeometry,ae=Dt($,re);if(!this.layers[0]._featureFilter.filter(new oi(this.zoom,{worldview:this.worldview,activeFloors:h.activeFloors}),ae,g))continue;const me=L?L.evaluate(ae,{},g):void 0,Se={id:K,properties:$.properties,type:$.type,sourceLayerIndex:X,index:Z,geometry:re?ae.geometry:St($,g,v),patterns:{},sortKey:me};C.push(Se)}L&&C.sort(($,K)=>$.sortKey-K.sortKey);let F=null;v.projection.name==="globe"&&(this.globeExtVertexArray=new AN,F=v.projection);for(const $ of C){const{geometry:K,index:Z,sourceLayerIndex:X}=$,re=c[Z].feature;this.addFeature($,K,Z,h.availableImages,g,F,h.brightness,h.elevationFeatures),h.featureIndex.insert(re,K,Z,X,this.index)}this.hasElevation||(this.elevatedLayoutVertexArray=void 0)}update(c,h,g,v,N,C,L){this.programConfigurations.updatePaintArrays(c,h,N,g,v,C,L,this.worldview)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(c){this.uploaded||(this.layoutVertexBuffer=c.createVertexBuffer(this.layoutVertexArray,S6.members),this.indexBuffer=c.createIndexBuffer(this.indexArray),this.globeExtVertexArray&&(this.globeExtVertexBuffer=c.createVertexBuffer(this.globeExtVertexArray,C6.members)),this.elevatedLayoutVertexArray&&(this.elevatedLayoutVertexBuffer=c.createVertexBuffer(this.elevatedLayoutVertexArray,ooe.members))),this.programConfigurations.upload(c),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.globeExtVertexBuffer&&this.globeExtVertexBuffer.destroy(),this.elevatedLayoutVertexBuffer&&this.elevatedLayoutVertexBuffer.destroy())}addFeature(c,h,g,v,N,C,L,F){let $;this.elevationMode!=="none"&&($=Ca.getElevationFeature(c,F));for(const K of h)for(const Z of K){const X=Z.x,re=Z.y;if(X<0||X>=Cr||re<0||re>=Cr)continue;if(C){const Se=C.projectTilePoint(X,re,N),Ne=C.upVector(N,X,re);this.addGlobeExtVertex(Se,Ne),this.addGlobeExtVertex(Se,Ne),this.addGlobeExtVertex(Se,Ne),this.addGlobeExtVertex(Se,Ne)}const ae=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray,c.sortKey),me=ae.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 sr(X,re)):0;this.hasElevation=this.hasElevation||Se!==0;for(let Ne=0;Ne<4;Ne++)this.elevatedLayoutVertexArray.emplaceBack(Se)}this.indexArray.emplaceBack(me,me+1,me+2),this.indexArray.emplaceBack(me,me+2,me+3),ae.vertexLength+=4,ae.primitiveLength+=2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,c,g,{},v,N,L,void 0,this.worldview)}addCircleVertex(c,h,g,v){this.layoutVertexArray.emplaceBack(2*c+(g+1)/2,2*h+(v+1)/2)}addGlobeExtVertex(c,h){this.globeExtVertexArray.emplaceBack(c.x,c.y,c.z,h[0]*16384,h[1]*16384,h[2]*16384)}}function ha(f,c){for(let h=0;h1){if(ji(f,c))return!0;for(let g=0;g1?h:h.sub(c)._mult(v)._add(c))}function qi(f,c){let h,g,v,N=!1;for(let C=0;Cc.y!=v.y>c.y&&c.x<(v.x-g.x)*(c.y-g.y)/(v.y-g.y)+g.x&&(N=!N)}return N}function Xa(f,c){let h=!1;for(let g=0,v=f.length-1;gc.y!=C.y>c.y&&c.x<(C.x-N.x)*(c.y-N.y)/(C.y-N.y)+N.x&&(h=!h)}return h}function kd(f,c,h,g,v){for(const C of f)if(c<=C.x&&h<=C.y&&g>=C.x&&v>=C.y)return!0;const N=[new sr(c,h),new sr(c,v),new sr(g,v),new sr(g,h)];if(f.length>2){for(const C of N)if(Xa(f,C))return!0}for(let C=0;Cv.x&&c.x>v.x||f.yv.y&&c.y>v.y)return!1;const N=as(f,c,h[0]);return N!==as(f,c,h[1])||N!==as(f,c,h[2])||N!==as(f,c,h[3])}function el(f,c,h,g,v,N){let C=c.y-f.y,L=f.x-c.x;if(N=N||0){const F=C*C+L*L;if(F===0)return!0;const $=Math.sqrt(F);C/=$,L/=$}return!((h.x-f.x)*C+(h.y-f.y)*L-N<0||(g.x-f.x)*C+(g.y-f.y)*L-N<0||(v.x-f.x)*C+(v.y-f.y)*L-N<0)}function Ic(f,c,h,g,v,N,C){return!(el(f,c,g,v,N,C)||el(c,h,g,v,N,C)||el(h,f,g,v,N,C)||el(g,v,f,c,h,C)||el(v,N,f,c,h,C)||el(N,g,f,c,h,C))}function Pc(f,c,h){const g=c.paint.get(f).value;return g.kind==="constant"?g.value:h.programConfigurations.get(c.id).getMaxValue(f)}function Gl(f){return Math.sqrt(f[0]*f[0]+f[1]*f[1])}function Du(f,c,h,g,v){if(!c[0]&&!c[1])return f;const N=sr.convert(c)._mult(v);h==="viewport"&&N._rotate(-g);const C=[];for(let L=0;L>h&&c.y===this.y>>h}url(c,h){const g=function(N,C,L){var F=xo(256*N,256*(C=Math.pow(2,L)-C-1),L),$=xo(256*(N+1),256*(C+1),L);return F[0]+","+F[1]+","+$[0]+","+$[1]}(this.x,this.y,this.z),v=function(N,C,L){let F,$="";for(let K=N;K>0;K--)F=1<this.canonical.z?new Zi(c,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Zi(c,this.wrap,c,this.canonical.x>>h,this.canonical.y>>h)}calculateScaledKey(c,h=!0){if(this.overscaledZ===c&&h)return this.key;if(c>this.canonical.z)return Vi(this.wrap*+h,c,this.canonical.z,this.canonical.x,this.canonical.y);{const g=this.canonical.z-c;return Vi(this.wrap*+h,c,c,this.canonical.x>>g,this.canonical.y>>g)}}isChildOf(c){if(c.wrap!==this.wrap)return!1;const h=this.canonical.z-c.canonical.z;return c.overscaledZ===0||c.overscaledZ>h&&c.canonical.y===this.canonical.y>>h}children(c){if(this.overscaledZ>=c)return[new Zi(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const h=this.canonical.z+1,g=2*this.canonical.x,v=2*this.canonical.y;return[new Zi(h,this.wrap,h,g,v),new Zi(h,this.wrap,h,g+1,v),new Zi(h,this.wrap,h,g,v+1),new Zi(h,this.wrap,h,g+1,v+1)]}isLessThan(c){return this.wrapc.wrap)&&(this.overscaledZc.overscaledZ)&&(this.canonical.xc.canonical.x)&&this.canonical.y{let c=f.canonical.x-1,h=f.wrap;return c<0&&(c=(1<{let c=f.canonical.x+1,h=f.wrap;return c===1<new Zi(f.overscaledZ,f.wrap,f.canonical.z,f.canonical.x,(f.canonical.y===0?1<new Zi(f.overscaledZ,f.wrap,f.canonical.z,f.canonical.x,f.canonical.y===(1<1?null:function(g,v,N,C){const L=Math.sin(N);return g*(Math.sin((1-C)*N)/L)+v*(Math.sin(C*N)/L)}(f.a[c],f.b[c],f.angle,xe(h,0,1))+f.center[c]}function Zh(f){if(f.z<=1)return Up[f.z+2*f.y+f.x];const c=yoe(M6(f));return hn.fromPoints(c)}function Vp(f,c,h){return _e(f,f,1-h),Je(f,f,c,h)}function lve(f,c,h){for(const g of f)at(g,g,c),_e(g,g,h)}function cve(f,c,h,g){const v=c/f.worldSize,N=f.globeMatrix;if(h.z<=1){const Et=Zh(h).getCorners();return lve(Et,N,v),hn.fromPoints(Et)}const C=M6(h,g),L=yoe(C,Ec+$f(f._tileCoverLift));lve(L,N,v);const F=Number.MAX_VALUE,$=[-F,-F,-F],K=[F,F,F];if(C.contains(f.center)){for(const Rt of L)we(K,K,Rt),be($,$,Rt);$[2]=0;const Et=f.point,Xt=[Et.x*v,Et.y*v,0];return we(K,K,Xt),be($,$,Xt),new hn(K,$)}if(f._tileCoverLift>0){for(const Et of L)we(K,K,Et),be($,$,Et);return new hn(K,$)}const Z=[N[12]*v,N[13]*v,N[14]*v],X=C.getCenter(),re=xe(f.center.lat,-ue,ue),ae=xe(X.lat,-ue,ue),me=B(f.center.lng),Se=H(re);let Ne=me-B(X.lng);const Fe=Se-H(ae);Ne>.5?Ne-=1:Ne<-.5&&(Ne+=1);let ze=0;Math.abs(Ne)>Math.abs(Fe)?ze=Ne>=0?1:3:(ze=Fe>=0?0:2,Je(Z,Z,[N[4]*v,N[5]*v,N[6]*v],-Math.sin(qn(Fe>=0?C.getSouth():C.getNorth()))*Ec));const Xe=L[ze],gt=L[(ze+1)%4],ht=new cg(Xe,gt,Z),bt=[qp(ht,0)||Xe[0],qp(ht,1)||Xe[1],qp(ht,2)||Xe[2]],Ct=N0(f.zoom);if(Ct>0){const Et=function({x:Rt,y:rr,z:lr},cr,yr,_r,fr){const gr=1/(1<.5?jr=-1:xn<-.5&&(jr=1),tr=((tr+jr)*cr-(_r*=cr))*yr+_r,Qt=((Qt+jr)*cr-_r)*yr+_r,xr=(xr*cr-(fr*=cr))*yr+fr,Tr=(Tr*cr-fr)*yr+fr,[[tr,Tr,0],[Qt,Tr,0],[Qt,xr,0],[tr,xr,0]]}(h,c,f._pixelsPerMercatorPixel,me,Se);for(let Rt=0;RtMath.PI/2*1.01}const pve=qn(85),UVe=Math.cos(pve),qVe=Math.sin(pve),VVe=S(),mve=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 gve(f,c,h,g,v,N,C,L,F){if(N&&f.queryGeometry.isAboveHorizon)return!1;N&&(F*=f.pixelToTileUnitsFactor);const $=f.tileID.canonical,K=h.projection.upVectorScale($,h.center.lat,h.worldSize).metersToTile;for(const Z of c)for(const X of Z){const re=X.add(L),ae=v&&h.elevation?h.elevation.exaggeration()*v.getElevationAt(re.x,re.y,!0):0,me=h.projection.projectTilePoint(re.x,re.y,$);if(ae>0){const ze=h.projection.upVector($,re.x,re.y);me.x+=ze[0]*K*ae,me.y+=ze[1]*K*ae,me.z+=ze[2]*K*ae}const Se=N?re:HVe(me.x,me.y,me.z,g),Ne=N?f.tilespaceRays.map(ze=>GVe(ze,ae)):f.queryGeometry.screenGeometry,Fe=He([],[me.x,me.y,me.z,1],g);if(!C&&N?F*=Fe[3]/h.cameraToCenterDistance:C&&!N&&(F*=h.cameraToCenterDistance/Fe[3]),N){const ze=de((X.y/Cr+$.y)/(1<<$.z));F/=h.projection.pixelsPerMeter(ze,1)/Y(1,ze)}if(fs(Ne,Se,F))return!0}return!1}function HVe(f,c,h,g){const v=He([],[f,c,h,1],g);return new sr(v[0]/v[3],v[1]/v[3])}const xve=se(0,0,0),WVe=se(0,0,1);function GVe(f,c){const h=ge();return xve[2]=c,f.intersectsPlane(xve,WVe,h),new sr(h[0],h[1])}class yve extends Oa{}let vve,_ve,bve,wve;function jve(f,{width:c,height:h},g,v){if(v){if(v instanceof Uint8ClampedArray)v=new Uint8Array(v.buffer);else if(v.length!==c*h*g)throw new RangeError("mismatched image size")}else v=new Uint8Array(c*h*g);return f.width=c,f.height=h,f.data=v,f}function kve(f,c,h){const{width:g,height:v}=c;g===f.width&&v===f.height||(woe(f,c,{x:0,y:0},{x:0,y:0},{width:Math.min(f.width,g),height:Math.min(f.height,v)},h,null),f.width=g,f.height=v,f.data=c.data)}function woe(f,c,h,g,v,N,C,L){if(v.width===0||v.height===0)return c;if(v.width>f.width||v.height>f.height||h.x>f.width-v.width||h.y>f.height-v.height)throw new RangeError("out of range source coordinates for image copy");if(v.width>c.width||v.height>c.height||g.x>c.width-v.width||g.y>c.height-v.height)throw new RangeError("out of range destination coordinates for image copy");const F=f.data,$=c.data,K=N===4&&L;for(let Z=0;Z{c[f.evaluationKey]=F;const $=f.expression.evaluate(c),K=$?$.toNonPremultipliedRenderColor(null):null;K&&(v.data[C+L+0]=Math.floor(255*K.r),v.data[C+L+1]=Math.floor(255*K.g),v.data[C+L+2]=Math.floor(255*K.b),v.data[C+L+3]=Math.floor(255*K.a))};if(f.clips)for(let C=0,L=0;C80*h){L=f[0],F=f[1];let K=L,Z=F;for(let X=h;XK&&(K=re),ae>Z&&(Z=ae)}$=Math.max(K-L,Z-F),$=$!==0?32767/$:0}return aM(N,C,h,L,F,$,0),C}function Sve(f,c,h,g,v){let N;if(v===function(C,L,F,$){let K=0;for(let Z=L,X=F-$;Z0)for(let C=c;C=c;C-=g)N=Ave(C/g|0,f[C],f[C+1],N);return N&&ZN(N,N.next)&&(lM(N),N=N.next),N}function p_(f,c){if(!f)return f;c||(c=f);let h,g=f;do if(h=!1,g.steiner||!ZN(g,g.next)&&Pl(g.prev,g,g.next)!==0)g=g.next;else{if(lM(g),g=c=g.prev,g===g.next)break;h=!0}while(h||g!==c);return c}function aM(f,c,h,g,v,N,C){if(!f)return;!C&&N&&function(F,$,K,Z){let X=F;do X.z===0&&(X.z=joe(X.x,X.y,$,K,Z)),X.prevZ=X.prev,X.nextZ=X.next,X=X.next;while(X!==F);X.prevZ.nextZ=null,X.prevZ=null,function(re){let ae,me=1;do{let Se,Ne=re;re=null;let Fe=null;for(ae=0;Ne;){ae++;let ze=Ne,Xe=0;for(let ht=0;ht0||gt>0&&ze;)Xe!==0&&(gt===0||!ze||Ne.z<=ze.z)?(Se=Ne,Ne=Ne.nextZ,Xe--):(Se=ze,ze=ze.nextZ,gt--),Fe?Fe.nextZ=Se:re=Se,Se.prevZ=Fe,Fe=Se;Ne=ze}Fe.nextZ=null,me*=2}while(ae>1)}(X)}(f,g,v,N);let L=f;for(;f.prev!==f.next;){const F=f.prev,$=f.next;if(N?JVe(f,g,v,N):QVe(f))c.push(F.i,f.i,$.i),lM(f),f=$.next,L=$.next;else if((f=$)===L){C?C===1?aM(f=eHe(p_(f),c),c,h,g,v,N,2):C===2&&tHe(f,c,h,g,v,N):aM(p_(f),c,h,g,v,N,1);break}}}function QVe(f){const c=f.prev,h=f,g=f.next;if(Pl(c,h,g)>=0)return!1;const v=c.x,N=h.x,C=g.x,L=c.y,F=h.y,$=g.y,K=Math.min(v,N,C),Z=Math.min(L,F,$),X=Math.max(v,N,C),re=Math.max(L,F,$);let ae=g.next;for(;ae!==c;){if(ae.x>=K&&ae.x<=X&&ae.y>=Z&&ae.y<=re&&iM(v,L,N,F,C,$,ae.x,ae.y)&&Pl(ae.prev,ae,ae.next)>=0)return!1;ae=ae.next}return!0}function JVe(f,c,h,g){const v=f.prev,N=f,C=f.next;if(Pl(v,N,C)>=0)return!1;const L=v.x,F=N.x,$=C.x,K=v.y,Z=N.y,X=C.y,re=Math.min(L,F,$),ae=Math.min(K,Z,X),me=Math.max(L,F,$),Se=Math.max(K,Z,X),Ne=joe(re,ae,c,h,g),Fe=joe(me,Se,c,h,g);let ze=f.prevZ,Xe=f.nextZ;for(;ze&&ze.z>=Ne&&Xe&&Xe.z<=Fe;){if(ze.x>=re&&ze.x<=me&&ze.y>=ae&&ze.y<=Se&&ze!==v&&ze!==C&&iM(L,K,F,Z,$,X,ze.x,ze.y)&&Pl(ze.prev,ze,ze.next)>=0||(ze=ze.prevZ,Xe.x>=re&&Xe.x<=me&&Xe.y>=ae&&Xe.y<=Se&&Xe!==v&&Xe!==C&&iM(L,K,F,Z,$,X,Xe.x,Xe.y)&&Pl(Xe.prev,Xe,Xe.next)>=0))return!1;Xe=Xe.nextZ}for(;ze&&ze.z>=Ne;){if(ze.x>=re&&ze.x<=me&&ze.y>=ae&&ze.y<=Se&&ze!==v&&ze!==C&&iM(L,K,F,Z,$,X,ze.x,ze.y)&&Pl(ze.prev,ze,ze.next)>=0)return!1;ze=ze.prevZ}for(;Xe&&Xe.z<=Fe;){if(Xe.x>=re&&Xe.x<=me&&Xe.y>=ae&&Xe.y<=Se&&Xe!==v&&Xe!==C&&iM(L,K,F,Z,$,X,Xe.x,Xe.y)&&Pl(Xe.prev,Xe,Xe.next)>=0)return!1;Xe=Xe.nextZ}return!0}function eHe(f,c){let h=f;do{const g=h.prev,v=h.next.next;!ZN(g,v)&&Mve(g,h,h.next,v)&&oM(g,v)&&oM(v,g)&&(c.push(g.i,h.i,v.i),lM(h),lM(h.next),h=f=v),h=h.next}while(h!==f);return p_(h)}function tHe(f,c,h,g,v,N){let C=f;do{let L=C.next.next;for(;L!==C.prev;){if(C.i!==L.i&&iHe(C,L)){let F=Tve(C,L);return C=p_(C,C.next),F=p_(F,F.next),aM(C,c,h,g,v,N,0),void aM(F,c,h,g,v,N,0)}L=L.next}C=C.next}while(C!==f)}function rHe(f,c){let h=f.x-c.x;return h===0&&(h=f.y-c.y,h===0)&&(h=(f.next.y-f.y)/(f.next.x-f.x)-(c.next.y-c.y)/(c.next.x-c.x)),h}function nHe(f,c){const h=function(v,N){let C=N;const L=v.x,F=v.y;let $,K=-1/0;if(ZN(v,C))return C;do{if(ZN(v,C.next))return C.next;if(F<=C.y&&F>=C.next.y&&C.next.y!==C.y){const me=C.x+(F-C.y)*(C.next.x-C.x)/(C.next.y-C.y);if(me<=L&&me>K&&(K=me,$=C.x=C.x&&C.x>=X&&L!==C.x&&Cve(F$.x||C.x===$.x&&sHe($,C)))&&($=C,ae=me)}C=C.next}while(C!==Z);return $}(f,c);if(!h)return c;const g=Tve(h,f);return p_(g,g.next),p_(h,h.next)}function sHe(f,c){return Pl(f.prev,f,c.prev)<0&&Pl(c.next,f,f.next)<0}function joe(f,c,h,g,v){return(f=1431655765&((f=858993459&((f=252645135&((f=16711935&((f=(f-h)*v|0)|f<<8))|f<<4))|f<<2))|f<<1))|(c=1431655765&((c=858993459&((c=252645135&((c=16711935&((c=(c-g)*v|0)|c<<8))|c<<4))|c<<2))|c<<1))<<1}function aHe(f){let c=f,h=f;do(c.x=(f-C)*(N-L)&&(f-C)*(g-L)>=(h-C)*(c-L)&&(h-C)*(N-L)>=(v-C)*(g-L)}function iM(f,c,h,g,v,N,C,L){return!(f===C&&c===L)&&Cve(f,c,h,g,v,N,C,L)}function iHe(f,c){return f.next.i!==c.i&&f.prev.i!==c.i&&!function(h,g){let v=h;do{if(v.i!==h.i&&v.next.i!==h.i&&v.i!==g.i&&v.next.i!==g.i&&Mve(v,v.next,h,g))return!0;v=v.next}while(v!==h);return!1}(f,c)&&(oM(f,c)&&oM(c,f)&&function(h,g){let v=h,N=!1;const C=(h.x+g.x)/2,L=(h.y+g.y)/2;do v.y>L!=v.next.y>L&&v.next.y!==v.y&&C<(v.next.x-v.x)*(L-v.y)/(v.next.y-v.y)+v.x&&(N=!N),v=v.next;while(v!==h);return N}(f,c)&&(Pl(f.prev,f,c.prev)||Pl(f,c.prev,c))||ZN(f,c)&&Pl(f.prev,f,f.next)>0&&Pl(c.prev,c,c.next)>0)}function Pl(f,c,h){return(c.y-f.y)*(h.x-c.x)-(c.x-f.x)*(h.y-c.y)}function ZN(f,c){return f.x===c.x&&f.y===c.y}function Mve(f,c,h,g){const v=I6(Pl(f,c,h)),N=I6(Pl(f,c,g)),C=I6(Pl(h,g,f)),L=I6(Pl(h,g,c));return v!==N&&C!==L||!(v!==0||!E6(f,h,c))||!(N!==0||!E6(f,g,c))||!(C!==0||!E6(h,f,g))||!(L!==0||!E6(h,c,g))}function E6(f,c,h){return c.x<=Math.max(f.x,h.x)&&c.x>=Math.min(f.x,h.x)&&c.y<=Math.max(f.y,h.y)&&c.y>=Math.min(f.y,h.y)}function I6(f){return f>0?1:f<0?-1:0}function oM(f,c){return Pl(f.prev,f,f.next)<0?Pl(f,c,f.next)>=0&&Pl(f,f.prev,c)>=0:Pl(f,c,f.prev)<0||Pl(f,f.next,c)<0}function Tve(f,c){const h=koe(f.i,f.x,f.y),g=koe(c.i,c.x,c.y),v=f.next,N=c.prev;return f.next=c,c.prev=f,h.next=v,v.prev=h,g.next=h,h.prev=g,N.next=g,g.prev=N,g}function Ave(f,c,h,g){const v=koe(f,c,h);return g?(v.next=g.next,v.prev=g,g.next.prev=v,g.next=v):(v.prev=v,v.next=v),v}function lM(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 koe(f,c,h){return{i:f,x:c,y:h,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function cM(f,c){const h=f.length;if(h<=1)return[f];const g=[];let v,N;for(let C=0;C1)for(let C=0;C=Cr&&h>=Cr}static evaluate(c){if(c.length===0)return new Sx;let h=[];for(const F of c)h.push(...F.portals);if(h.length===0)return new Sx;for(const F of h){const $=F.va,K=F.vb;(Sx.isOnBorder($.x,K.x)||Sx.isOnBorder($.y,K.y))&&(F.type="border")}const g=h.filter(F=>F.type!=="unevaluated"),v=h.filter(F=>F.type==="unevaluated");if(v.length===0)return new Sx;v.sort((F,$)=>F.hash===$.hash?F.isTunnel===$.isTunnel?0:F.isTunnel?-1:1:F.hash<$.hash?1:-1),h=g.concat(v);let N=g.length,C=N,L=N;do if(C++,C===h.length||h[N].hash!==h[C].hash){if(C-N==2){LF.hash<$.hash?1:-1),{portals:h}}}en(Sx,"ElevationPortalGraph"),en(Ive,"ElevationPolygons");class lHe{constructor(c,h,g){this.outPositions=c,this.outNormals=h,this.outIndices=g,this.vertexLookup=new Map}addVertex(c,h,g){let v=c[2];g!=null&&(v*=g);const N=`${c[0]},${c[1]},${c[2]},${h[0]},${h[1]},${h[2]}`,C=this.vertexLookup.get(N);if(C!=null)return C;const L=this.outPositions.length;this.vertexLookup.set(N,L);const F=Math.trunc(16384*h[0]),$=Math.trunc(16384*h[1]),K=Math.trunc(16384*h[2]);return this.outPositions.emplaceBack(c[0],c[1],v),this.outNormals.emplaceBack(F,$,K),L}addTriangle(c,h,g){this.outIndices.emplaceBack(c,h,g)}addTriangles(c,h,g){if(c.length===0)return;const v=g.length===1,N=ge(),C=ge();for(let L=0;LN!=="fill-tunnel-structure-color"),this.tunnelProgramConfigurations=new Gh(h,{zoom:g,lut:v},N=>N!=="fill-bridge-guard-rail-color")}addVertices(c,h){const g=this.unevalVertices.length;for(let v=0;v=N.min.x&&Z.x<=N.max.x&&Z.y>=N.min.y&&Z.y<=N.max.y||X.x>=N.min.x&&X.x<=N.max.x&&X.y>=N.min.y&&X.y<=N.max.y||pc(Z,X,L))||this.isOnBorder(Z.x,X.x)||this.isOnBorder(Z.y,X.y))continue;const re=Ru.computeEdgeHash(this.unevalVertices[$],this.unevalVertices[K]);let ae,me=this.vertexHashLookup.get(Ru.computePosHash(Z));me!=null?ae=me.next:(me=this.vertexHashLookup.get(Ru.computePosHash(X)),ae=me!=null?me.prev:re),this.unevalEdges.push({polygonIdx:c,a:$,b:K,hash:re,portalHash:ae,isTunnel:v,type:"unevaluated",featureInfo:C})}}addPortalCandidates(c,h,g,v,N){if(h.length===0)return;this.portalPolygons.add(c,{geometry:h,zLevel:N});const C=h[0];this.vertexHashLookup.clear();let L=Ru.computeEdgeHash(C[C.length-2],C[C.length-1]);for(let F=0;F({vertexOffset:0,primitiveOffset:this.indexArray.length}),g=X=>{X.primitiveLength=this.indexArray.length-X.primitiveOffset},v=new lHe(this.vertexPositions,this.vertexNormals,this.indexArray);this.prepareEdges(c.portals,this.unevalEdges);const N=h(),C=h(),L=h(),F=(X,re)=>{X.sort((me,Se)=>me.type===re&&Se.type!==re?-1:me.type!==re&&Se.type===re?1:0);const ae=X.findIndex(me=>me.type!==re);return ae>=0?ae:X.length};let $=0;this.unevalEdges.length>0&&($=F(this.unevalEdges,"none"),this.constructBridgeStructures(v,this.unevalVertices,this.unevalHeights,this.unevalEdges,{min:0,max:$},this.tileToMeters)),g(L);const K=h(),Z=h();if(this.unevalEdges.length>0){const X=this.unevalEdges.splice($),re=F(X,"tunnel")+$;this.unevalEdges.push(...X),this.constructTunnelStructures(v,this.unevalVertices,this.unevalHeights,this.unevalEdges,{min:0,max:$},{min:$,max:re})}g(K),v.addTriangles(this.unevalTriangles,this.unevalVertices,this.unevalHeights),g(Z),v.addTriangles(this.unevalTunnelTriangles,this.unevalVertices,this.unevalHeights),g(C),v.addTriangles(this.unevalTunnelTriangles,this.unevalVertices,[-.1]),g(N),this.maskSegments=Ui.simpleSegment(0,Z.primitiveOffset,0,Z.primitiveLength),this.depthSegments=Ui.simpleSegment(0,C.primitiveOffset,0,C.primitiveLength),this.renderableBridgeSegments=Ui.simpleSegment(0,L.primitiveOffset,0,L.primitiveLength),this.renderableTunnelSegments=Ui.simpleSegment(0,K.primitiveOffset,0,K.primitiveLength),this.shadowCasterSegments=Ui.simpleSegment(0,N.primitiveOffset,0,N.primitiveLength)}update(c,h,g,v,N,C,L,F){this.bridgeProgramConfigurations.updatePaintArrays(c,h,N,g,v,C,L,F),this.tunnelProgramConfigurations.updatePaintArrays(c,h,N,g,v,C,L,F)}upload(c){this.vertexBuffer||this.vertexPositions.length===0||this.vertexNormals.length===0||this.indexArray.length===0||(this.vertexBuffer=c.createVertexBuffer(this.vertexPositions,YVe.members),this.vertexBufferNormal=c.createVertexBuffer(this.vertexNormals,XVe.members),this.indexBuffer=c.createIndexBuffer(this.indexArray),this.bridgeProgramConfigurations.upload(c),this.tunnelProgramConfigurations.upload(c))}destroy(){this.vertexBuffer&&(this.vertexBuffer.destroy(),this.vertexBufferNormal.destroy(),this.indexBuffer.destroy()),this.maskSegments&&(this.maskSegments.destroy(),this.depthSegments.destroy(),this.renderableBridgeSegments.destroy(),this.renderableTunnelSegments.destroy(),this.shadowCasterSegments.destroy()),this.bridgeProgramConfigurations.destroy(),this.tunnelProgramConfigurations.destroy()}populatePaintArrays(c,h,g,v,N){const C=(L,F)=>{for(let $=0;$fe(yr,h[_r].x,h[_r].y,g[_r]*F),Z=ge(),X=ge(),re=ge(),ae=ge(),me=ge(),Se=(yr,_r)=>{const fr=L.get(Ru.computePosHash(h[_r])),gr=fr.from,tr=fr.to;if(!gr||!tr)return;K(Z,gr),K(X,_r),K(re,tr),Qe(ae),st(Z,X)||(ke(me,X,Z),qe(ae,me)),st(re,X)||(ke(me,re,X),he(ae,ae,qe(me,me)));const Qt=Ce(ae);return Qt>0?_e(yr,ae,1/Qt):void 0};let Ne=Number.POSITIVE_INFINITY;this.sortSubarray(v,N.min,N.max,(yr,_r)=>yr.featureInfo.featureIndex-_r.featureInfo.featureIndex);const Fe=ge(),ze=ge(),Xe=ge(),gt=ge(),ht=ge(),bt=ge(),Ct=ge(),Et=ge(),Xt=ge(),Rt=[ge(),ge(),ge(),ge()],rr=[ge(),ge(),ge(),ge()],lr=[{coord:new sr(0,0),height:0},{coord:new sr(0,0),height:0}],cr=(yr,_r)=>yr>_r;for(let yr=N.min;yrNe.featureInfo.featureIndex-Fe.featureInfo.featureIndex;this.sortSubarray(v,N.min,N.max,F),this.sortSubarray(v,C.min,C.max,F);const $=Ne=>qe(Ne,Ne),K=[{coord:new sr(0,0),height:0},{coord:new sr(0,0),height:0}],Z=(Ne,Fe)=>NeL.hash===F.hash?F.polygonIdx-L.polygonIdx:F.hash>L.hash?1:-1);let g=0,v=0,N=0,C=h[g].polygonIdx;do v++,(v===h.length||h[g].hash!==h[v].hash)&&((v-g==1||h[v-1].polygonIdx!==C)&&(N$.portalHashK.hash?L++:K.hash>$.portalHash?F++:($.type=K.type,L++)}}}isOnBorder(c,h){return c<=0&&h<=0||c>=Cr&&h>=Cr}addFeatureSection(c,h,g,v){return c!==h&&(h=c,g.push({featureIndex:c,vertexStart:v.getVertexCount()}),v.clearVertexLookup()),h}sortSubarray(c,h,g,v){const N=c.slice(h,g);N.sort(v),c.splice(h,N.length,...N)}static computeEdgeHash(c,h){return(c.y===h.y&&c.x>h.x||c.y>h.y)&&([c,h]=[h,c]),BigInt(Ru.computePosHash(c))<<32n|BigInt(Ru.computePosHash(h))}static computePosHash(c){return((65535&c.x)<<16|65535&c.y)>>>0}}var Pve,Lve={exports:{}},Ove=(Pve||(Pve=1,function(f){function c(ft,xt){return ft>xt?1:ft0){var vn=vr+Math.floor(Br/2),wn={key:xt[vn],data:nr[vn],parent:ft};return wn.left=v(wn,xt,nr,vr,vn),wn.right=v(wn,xt,nr,vn+1,zr),wn}return null}function N(ft,xt,nr,vr,zr){if(!(nr>=vr)){for(var Br=ft[nr+vr>>1],vn=nr-1,wn=vr+1;;){do vn++;while(zr(ft[vn],Br)<0);do wn--;while(zr(ft[wn],Br)>0);if(vn>=wn)break;var ss=ft[vn];ft[vn]=ft[wn],ft[wn]=ss,ss=xt[vn],xt[vn]=xt[wn],xt[wn]=ss}N(ft,xt,nr,wn,zr),N(ft,xt,wn+1,vr,zr)}}h.prototype.rotateLeft=function(ft){var xt=ft.right;xt&&(ft.right=xt.left,xt.left&&(xt.left.parent=ft),xt.parent=ft.parent),ft.parent?ft===ft.parent.left?ft.parent.left=xt:ft.parent.right=xt:this._root=xt,xt&&(xt.left=ft),ft.parent=xt},h.prototype.rotateRight=function(ft){var xt=ft.left;xt&&(ft.left=xt.right,xt.right&&(xt.right.parent=ft),xt.parent=ft.parent),ft.parent?ft===ft.parent.left?ft.parent.left=xt:ft.parent.right=xt:this._root=xt,xt&&(xt.right=ft),ft.parent=xt},h.prototype._splay=function(ft){for(;ft.parent;){var xt=ft.parent;xt.parent?xt.left===ft&&xt.parent.left===xt?(this.rotateRight(xt.parent),this.rotateRight(xt)):xt.right===ft&&xt.parent.right===xt?(this.rotateLeft(xt.parent),this.rotateLeft(xt)):xt.left===ft&&xt.parent.right===xt?(this.rotateRight(xt),this.rotateLeft(xt)):(this.rotateLeft(xt),this.rotateRight(xt)):xt.left===ft?this.rotateRight(xt):this.rotateLeft(xt)}},h.prototype.splay=function(ft){for(var xt,nr,vr,zr,Br;ft.parent;)(nr=(xt=ft.parent).parent)&&nr.parent?((vr=nr.parent).left===nr?vr.left=ft:vr.right=ft,ft.parent=vr):(ft.parent=null,this._root=ft),zr=ft.left,Br=ft.right,ft===xt.left?(nr&&(nr.left===xt?(xt.right?(nr.left=xt.right,nr.left.parent=nr):nr.left=null,xt.right=nr,nr.parent=xt):(zr?(nr.right=zr,zr.parent=nr):nr.right=null,ft.left=nr,nr.parent=ft)),Br?(xt.left=Br,Br.parent=xt):xt.left=null,ft.right=xt,xt.parent=ft):(nr&&(nr.right===xt?(xt.left?(nr.right=xt.left,nr.right.parent=nr):nr.right=null,xt.left=nr,nr.parent=xt):(Br?(nr.left=Br,Br.parent=nr):nr.left=null,ft.right=nr,nr.parent=ft)),zr?(xt.right=zr,zr.parent=xt):xt.right=null,ft.left=xt,xt.parent=ft)},h.prototype.replace=function(ft,xt){ft.parent?ft===ft.parent.left?ft.parent.left=xt:ft.parent.right=xt:this._root=xt,xt&&(xt.parent=ft.parent)},h.prototype.minNode=function(ft){if(ft===void 0&&(ft=this._root),ft)for(;ft.left;)ft=ft.left;return ft},h.prototype.maxNode=function(ft){if(ft===void 0&&(ft=this._root),ft)for(;ft.right;)ft=ft.right;return ft},h.prototype.insert=function(ft,xt){var nr=this._root,vr=null,zr=this._compare;if(this._noDuplicates)for(;nr;){if(vr=nr,zr(nr.key,ft)===0)return;nr=zr(nr.key,ft)<0?nr.right:nr.left}else for(;nr;)vr=nr,nr=zr(nr.key,ft)<0?nr.right:nr.left;return nr={key:ft,data:xt,left:null,right:null,parent:vr},vr?zr(vr.key,nr.key)<0?vr.right=nr:vr.left=nr:this._root=nr,this.splay(nr),this._size++,nr},h.prototype.find=function(ft){for(var xt=this._root,nr=this._compare;xt;){var vr=nr(xt.key,ft);if(vr<0)xt=xt.right;else{if(!(vr>0))return xt;xt=xt.left}}return null},h.prototype.contains=function(ft){for(var xt=this._root,nr=this._compare;xt;){var vr=nr(ft,xt.key);if(vr===0)return!0;xt=vr<0?xt.left:xt.right}return!1},h.prototype.remove=function(ft){var xt=this.find(ft);if(!xt)return!1;if(this.splay(xt),xt.left)if(xt.right){var nr=this.minNode(xt.right);nr.parent!==xt&&(this.replace(nr,nr.right),nr.right=xt.right,nr.right.parent=nr),this.replace(xt,nr),nr.left=xt.left,nr.left.parent=nr}else this.replace(xt,xt.left);else this.replace(xt,xt.right);return this._size--,!0},h.prototype.removeNode=function(ft){if(!ft)return!1;if(this.splay(ft),ft.left)if(ft.right){var xt=this.minNode(ft.right);xt.parent!==ft&&(this.replace(xt,xt.right),xt.right=ft.right,xt.right.parent=xt),this.replace(ft,xt),xt.left=ft.left,xt.left.parent=xt}else this.replace(ft,ft.left);else this.replace(ft,ft.right);return this._size--,!0},h.prototype.erase=function(ft){var xt=this.find(ft);if(xt){this.splay(xt);var nr=xt.left,vr=xt.right,zr=null;nr&&(nr.parent=null,zr=this.maxNode(nr),this.splay(zr),this._root=zr),vr&&(nr?zr.right=vr:this._root=vr,vr.parent=zr),this._size--}},h.prototype.pop=function(){var ft=this._root,xt=null;if(ft){for(;ft.left;)ft=ft.left;xt={key:ft.key,data:ft.data},this.remove(ft.key)}return xt},h.prototype.next=function(ft){var xt=ft;if(xt)if(xt.right)for(xt=xt.right;xt&&xt.left;)xt=xt.left;else for(xt=ft.parent;xt&&xt.right===ft;)ft=xt,xt=xt.parent;return xt},h.prototype.prev=function(ft){var xt=ft;if(xt)if(xt.left)for(xt=xt.left;xt&&xt.right;)xt=xt.right;else for(xt=ft.parent;xt&&xt.left===ft;)ft=xt,xt=xt.parent;return xt},h.prototype.forEach=function(ft){for(var xt=this._root,nr=[],vr=!1,zr=0;!vr;)xt?(nr.push(xt),xt=xt.left):nr.length>0?(ft(xt=nr.pop(),zr++),xt=xt.right):vr=!0;return this},h.prototype.range=function(ft,xt,nr,vr){for(var zr=[],Br=this._compare,vn=this._root;zr.length!==0||vn;)if(vn)zr.push(vn),vn=vn.left;else{if(Br((vn=zr.pop()).key,xt)>0)break;if(Br(vn.key,ft)>=0&&nr.call(vr,vn))return this;vn=vn.right}return this},h.prototype.keys=function(){for(var ft=this._root,xt=[],nr=[],vr=!1;!vr;)ft?(xt.push(ft),ft=ft.left):xt.length>0?(ft=xt.pop(),nr.push(ft.key),ft=ft.right):vr=!0;return nr},h.prototype.values=function(){for(var ft=this._root,xt=[],nr=[],vr=!1;!vr;)ft?(xt.push(ft),ft=ft.left):xt.length>0?(ft=xt.pop(),nr.push(ft.data),ft=ft.right):vr=!0;return nr},h.prototype.at=function(ft){for(var xt=this._root,nr=[],vr=!1,zr=0;!vr;)if(xt)nr.push(xt),xt=xt.left;else if(nr.length>0){if(xt=nr.pop(),zr===ft)return xt;zr++,xt=xt.right}else vr=!0;return null},h.prototype.load=function(ft,xt,nr){if(ft===void 0&&(ft=[]),xt===void 0&&(xt=[]),nr===void 0&&(nr=!1),this._size!==0)throw new Error("bulk-load: tree is not empty");var vr=ft.length;return nr&&N(ft,xt,0,vr-1,this._compare),this._root=v(null,ft,xt,0,vr),this._size=vr,this},h.prototype.min=function(){var ft=this.minNode(this._root);return ft?ft.key:null},h.prototype.max=function(){var ft=this.maxNode(this._root);return ft?ft.key:null},h.prototype.isEmpty=function(){return this._root===null},g.size.get=function(){return this._size},h.createTree=function(ft,xt,nr,vr,zr){return new h(nr,zr).load(ft,xt,vr)},Object.defineProperties(h.prototype,g);var C=0,L=1,F=2,$=3,K=0,Z=1,X=2,re=3;function ae(ft,xt,nr){xt===null?(ft.inOut=!1,ft.otherInOut=!0):(ft.isSubject===xt.isSubject?(ft.inOut=!xt.inOut,ft.otherInOut=xt.otherInOut):(ft.inOut=!xt.otherInOut,ft.otherInOut=xt.isVertical()?!xt.inOut:xt.inOut),xt&&(ft.prevInResult=!me(xt,nr)||xt.isVertical()?xt.prevInResult:xt));var vr=me(ft,nr);ft.resultTransition=vr?function(zr,Br){var vn,wn=!zr.inOut,ss=!zr.otherInOut;switch(Br){case K:vn=wn&&ss;break;case Z:vn=wn||ss;break;case re:vn=wn^ss;break;case X:vn=zr.isSubject?wn&&!ss:ss&&!wn}return vn?1:-1}(ft,nr):0}function me(ft,xt){switch(ft.type){case C:switch(xt){case K:return!ft.otherInOut;case Z:return ft.otherInOut;case X:return ft.isSubject&&ft.otherInOut||!ft.isSubject&&!ft.otherInOut;case re:return!0}break;case F:return xt===K||xt===Z;case $:return xt===X;case L:return!1}return!1}var Se=function(ft,xt,nr,vr,zr){this.left=xt,this.point=ft,this.otherEvent=nr,this.isSubject=vr,this.type=zr||C,this.inOut=!1,this.otherInOut=!1,this.prevInResult=null,this.resultTransition=0,this.otherPos=-1,this.outputContourId=-1,this.isExteriorRing=!0},Ne={inResult:{configurable:!0}};function Fe(ft,xt){return ft[0]===xt[0]&&ft[1]===xt[1]}Se.prototype.isBelow=function(ft){var xt=this.point,nr=this.otherEvent.point;return this.left?(xt[0]-ft[0])*(nr[1]-ft[1])-(nr[0]-ft[0])*(xt[1]-ft[1])>0:(nr[0]-ft[0])*(xt[1]-ft[1])-(xt[0]-ft[0])*(nr[1]-ft[1])>0},Se.prototype.isAbove=function(ft){return!this.isBelow(ft)},Se.prototype.isVertical=function(){return this.point[0]===this.otherEvent.point[0]},Ne.inResult.get=function(){return this.resultTransition!==0},Se.prototype.clone=function(){var ft=new Se(this.point,this.left,this.otherEvent,this.isSubject,this.type);return ft.contourId=this.contourId,ft.resultTransition=this.resultTransition,ft.prevInResult=this.prevInResult,ft.isExteriorRing=this.isExteriorRing,ft.inOut=this.inOut,ft.otherInOut=this.otherInOut,ft},Object.defineProperties(Se.prototype,Ne);var ze=11102230246251565e-32,Xe=134217729,gt=(3+8*ze)*ze;function ht(ft,xt,nr,vr,zr){var Br,vn,wn,ss,ms=xt[0],vs=vr[0],Rs=0,Ln=0;vs>ms==vs>-ms?(Br=ms,ms=xt[++Rs]):(Br=vs,vs=vr[++Ln]);var Hn=0;if(Rsms==vs>-ms?(wn=Br-((vn=ms+Br)-ms),ms=xt[++Rs]):(wn=Br-((vn=vs+Br)-vs),vs=vr[++Ln]),Br=vn,wn!==0&&(zr[Hn++]=wn);Rsms==vs>-ms?(wn=Br-((vn=Br+ms)-(ss=vn-Br))+(ms-ss),ms=xt[++Rs]):(wn=Br-((vn=Br+vs)-(ss=vn-Br))+(vs-ss),vs=vr[++Ln]),Br=vn,wn!==0&&(zr[Hn++]=wn);for(;Rs0!=Rs>0)return Ln;var Hn=Math.abs(vs+Rs);return Math.abs(Ln)>=Ct*Hn?Ln:-function(da,pa,ma,Da,Ja,Ga,ja){var Ta,gs,Gs,Ri,In,Fs,Za,si,li,yo,ai,Pn,Hi,Ra,ki,tl,jl,Do,Ro=da-Ja,hl=ma-Ja,Yd=pa-Ga,ii=Da-Ga;Rt[0]=(ki=(si=Ro-(Za=(Fs=Xe*Ro)-(Fs-Ro)))*(yo=ii-(li=(Fs=Xe*ii)-(Fs-ii)))-((Ra=Ro*ii)-Za*li-si*li-Za*yo))-((ai=ki-(jl=(si=Yd-(Za=(Fs=Xe*Yd)-(Fs-Yd)))*(yo=hl-(li=(Fs=Xe*hl)-(Fs-hl)))-((tl=Yd*hl)-Za*li-si*li-Za*yo)))+(In=ki-ai))+(In-jl),Rt[1]=(Hi=Ra-((Pn=Ra+ai)-(In=Pn-Ra))+(ai-In))-((ai=Hi-tl)+(In=Hi-ai))+(In-tl),Rt[2]=Pn-((Do=Pn+ai)-(In=Do-Pn))+(ai-In),Rt[3]=Do;var ho=function(hg,mc){for(var Nd=mc[0],zu=1;zu<4;zu++)Nd+=mc[zu];return Nd}(0,Rt),vo=Et*ja;if(ho>=vo||-ho>=vo||(Ta=da-(Ro+(In=da-Ro))+(In-Ja),Gs=ma-(hl+(In=ma-hl))+(In-Ja),gs=pa-(Yd+(In=pa-Yd))+(In-Ga),Ri=Da-(ii+(In=Da-ii))+(In-Ga),Ta===0&&gs===0&&Gs===0&&Ri===0)||(vo=Xt*ja+gt*Math.abs(ho),(ho+=Ro*Ri+ii*Ta-(Yd*Gs+hl*gs))>=vo||-ho>=vo))return ho;yr[0]=(ki=(si=Ta-(Za=(Fs=Xe*Ta)-(Fs-Ta)))*(yo=ii-(li=(Fs=Xe*ii)-(Fs-ii)))-((Ra=Ta*ii)-Za*li-si*li-Za*yo))-((ai=ki-(jl=(si=gs-(Za=(Fs=Xe*gs)-(Fs-gs)))*(yo=hl-(li=(Fs=Xe*hl)-(Fs-hl)))-((tl=gs*hl)-Za*li-si*li-Za*yo)))+(In=ki-ai))+(In-jl),yr[1]=(Hi=Ra-((Pn=Ra+ai)-(In=Pn-Ra))+(ai-In))-((ai=Hi-tl)+(In=Hi-ai))+(In-tl),yr[2]=Pn-((Do=Pn+ai)-(In=Do-Pn))+(ai-In),yr[3]=Do;var uu=ht(4,Rt,4,yr,rr);yr[0]=(ki=(si=Ro-(Za=(Fs=Xe*Ro)-(Fs-Ro)))*(yo=Ri-(li=(Fs=Xe*Ri)-(Fs-Ri)))-((Ra=Ro*Ri)-Za*li-si*li-Za*yo))-((ai=ki-(jl=(si=Yd-(Za=(Fs=Xe*Yd)-(Fs-Yd)))*(yo=Gs-(li=(Fs=Xe*Gs)-(Fs-Gs)))-((tl=Yd*Gs)-Za*li-si*li-Za*yo)))+(In=ki-ai))+(In-jl),yr[1]=(Hi=Ra-((Pn=Ra+ai)-(In=Pn-Ra))+(ai-In))-((ai=Hi-tl)+(In=Hi-ai))+(In-tl),yr[2]=Pn-((Do=Pn+ai)-(In=Do-Pn))+(ai-In),yr[3]=Do;var rl=ht(uu,rr,4,yr,lr);yr[0]=(ki=(si=Ta-(Za=(Fs=Xe*Ta)-(Fs-Ta)))*(yo=Ri-(li=(Fs=Xe*Ri)-(Fs-Ri)))-((Ra=Ta*Ri)-Za*li-si*li-Za*yo))-((ai=ki-(jl=(si=gs-(Za=(Fs=Xe*gs)-(Fs-gs)))*(yo=Gs-(li=(Fs=Xe*Gs)-(Fs-Gs)))-((tl=gs*Gs)-Za*li-si*li-Za*yo)))+(In=ki-ai))+(In-jl),yr[1]=(Hi=Ra-((Pn=Ra+ai)-(In=Pn-Ra))+(ai-In))-((ai=Hi-tl)+(In=Hi-ai))+(In-tl),yr[2]=Pn-((Do=Pn+ai)-(In=Do-Pn))+(ai-In),yr[3]=Do;var qf=ht(rl,lr,4,yr,cr);return cr[qf-1]}(zr,Br,vn,wn,ss,ms,Hn)}(ft[0],ft[1],xt[0],xt[1],nr[0],nr[1]);return vr>0?-1:vr<0?1:0}function fr(ft,xt){var nr=ft.point,vr=xt.point;return nr[0]>vr[0]?1:nr[0]vr[1]?1:-1:function(zr,Br,vn,wn){return zr.left!==Br.left?zr.left?1:-1:_r(vn,zr.otherEvent.point,Br.otherEvent.point)!==0?zr.isBelow(Br.otherEvent.point)?-1:1:!zr.isSubject&&Br.isSubject?1:-1}(ft,xt,nr)}function gr(ft,xt,nr){var vr=new Se(xt,!1,ft,ft.isSubject),zr=new Se(xt,!0,ft.otherEvent,ft.isSubject);return Fe(ft.point,ft.otherEvent.point)&&console.warn("what is that, a collapsed segment?",ft),vr.contourId=zr.contourId=ft.contourId,fr(zr,ft.otherEvent)>0&&(ft.otherEvent.left=!0,zr.left=!1),ft.otherEvent.otherEvent=zr,ft.otherEvent=vr,nr.push(zr),nr.push(vr),nr}function tr(ft,xt){return ft[0]*xt[1]-ft[1]*xt[0]}function Qt(ft,xt){return ft[0]*xt[0]+ft[1]*xt[1]}function xr(ft,xt,nr){var vr=function(ss,ms,vs,Rs,Ln){var Hn=[ms[0]-ss[0],ms[1]-ss[1]],da=[Rs[0]-vs[0],Rs[1]-vs[1]];function pa(Fs,Za,si){return[Fs[0]+Za*si[0],Fs[1]+Za*si[1]]}var ma=[vs[0]-ss[0],vs[1]-ss[1]],Da=tr(Hn,da),Ja=Da*Da,Ga=Qt(Hn,Hn);if(Ja>0){var ja=tr(ma,da)/Da;if(ja<0||ja>1)return null;var Ta=tr(ma,Hn)/Da;return Ta<0||Ta>1?null:ja===0||ja===1?[pa(ss,ja,Hn)]:Ta===0||Ta===1?[pa(vs,Ta,da)]:[pa(ss,ja,Hn)]}if((Ja=(Da=tr(ma,Hn))*Da)>0)return null;var gs=Qt(Hn,ma)/Ga,Gs=gs+Qt(Hn,da)/Ga,Ri=Math.min(gs,Gs),In=Math.max(gs,Gs);return Ri<=1&&In>=0?Ri===1?[pa(ss,Ri>0?Ri:0,Hn)]:In===0?[pa(ss,In<1?In:1,Hn)]:[pa(ss,Ri>0?Ri:0,Hn),pa(ss,In<1?In:1,Hn)]:null}(ft.point,ft.otherEvent.point,xt.point,xt.otherEvent.point),zr=vr?vr.length:0;if(zr===0||zr===1&&(Fe(ft.point,xt.point)||Fe(ft.otherEvent.point,xt.otherEvent.point))||zr===2&&ft.isSubject===xt.isSubject)return 0;if(zr===1)return Fe(ft.point,vr[0])||Fe(ft.otherEvent.point,vr[0])||gr(ft,vr[0],nr),Fe(xt.point,vr[0])||Fe(xt.otherEvent.point,vr[0])||gr(xt,vr[0],nr),1;var Br=[],vn=!1,wn=!1;return Fe(ft.point,xt.point)?vn=!0:fr(ft,xt)===1?Br.push(xt,ft):Br.push(ft,xt),Fe(ft.otherEvent.point,xt.otherEvent.point)?wn=!0:fr(ft.otherEvent,xt.otherEvent)===1?Br.push(xt.otherEvent,ft.otherEvent):Br.push(ft.otherEvent,xt.otherEvent),vn&&wn||vn?(xt.type=L,ft.type=xt.inOut===ft.inOut?F:$,vn&&!wn&&gr(Br[1].otherEvent,Br[0].point,nr),2):wn?(gr(Br[0],Br[1].point,nr),3):Br[0]!==Br[3].otherEvent?(gr(Br[0],Br[1].point,nr),gr(Br[1],Br[2].point,nr),3):(gr(Br[0],Br[1].point,nr),gr(Br[3].otherEvent,Br[2].point,nr),3)}function Tr(ft,xt){if(ft===xt)return 0;if(_r(ft.point,ft.otherEvent.point,xt.point)!==0||_r(ft.point,ft.otherEvent.point,xt.otherEvent.point)!==0)return Fe(ft.point,xt.point)?ft.isBelow(xt.otherEvent.point)?-1:1:ft.point[0]===xt.point[0]?ft.point[1]xt.contourId?1:-1:fr(ft,xt)===1?1:-1}var jr=function(){this.points=[],this.holeIds=[],this.holeOf=null,this.depth=null};function xn(ft,xt,nr,vr){var zr,Br=ft+1,vn=xt[ft].point,wn=xt.length;for(Brvr;)Br--;return Br}jr.prototype.isExterior=function(){return this.holeOf==null};var Vr=an,Qr=an;function an(ft,xt){if(!(this instanceof an))return new an(ft,xt);if(this.data=ft||[],this.length=this.data.length,this.compare=xt||bs,this.length>0)for(var nr=(this.length>>1)-1;nr>=0;nr--)this._down(nr)}function bs(ft,xt){return ftxt?1:0}an.prototype={push:function(ft){this.data.push(ft),this.length++,this._up(this.length-1)},pop:function(){if(this.length!==0){var ft=this.data[0];return this.length--,this.length>0&&(this.data[0]=this.data[this.length],this._down(0)),this.data.pop(),ft}},peek:function(){return this.data[0]},_up:function(ft){for(var xt=this.data,nr=this.compare,vr=xt[ft];ft>0;){var zr=ft-1>>1,Br=xt[zr];if(nr(vr,Br)>=0)break;xt[ft]=Br,ft=zr}xt[ft]=vr},_down:function(ft){for(var xt=this.data,nr=this.compare,vr=this.length>>1,zr=xt[ft];ft=0)break;xt[ft]=wn,ft=Br}xt[ft]=zr}},Vr.default=Qr;var kr=Math.max,ln=Math.min,Wn=0;function qs(ft,xt,nr,vr,zr,Br){var vn,wn,ss,ms,vs,Rs;for(vn=0,wn=ft.length-1;vn0?Rs.left=!0:vs.left=!0;var Ln=ss[0],Hn=ss[1];zr[0]=ln(zr[0],Ln),zr[1]=ln(zr[1],Hn),zr[2]=kr(zr[2],Ln),zr[3]=kr(zr[3],Hn),vr.push(vs),vr.push(Rs)}}var Xs=[];function ls(ft,xt,nr){typeof ft[0][0][0]=="number"&&(ft=[ft]),typeof xt[0][0][0]=="number"&&(xt=[xt]);var vr=function(Hn,da,pa){var ma=null;return Hn.length*da.length==0&&(pa===K?ma=Xs:pa===X?ma=Hn:pa!==Z&&pa!==re||(ma=Hn.length===0?da:Hn)),ma}(ft,xt,nr);if(vr)return vr===Xs?null:vr;var zr=[1/0,1/0,-1/0,-1/0],Br=[1/0,1/0,-1/0,-1/0],vn=function(Hn,da,pa,ma,Da){var Ja,Ga,ja,Ta,gs,Gs,Ri=new Vr(null,fr);for(ja=0,Ta=Hn.length;jama[2]||ma[0]>pa[2]||pa[1]>ma[3]||ma[1]>pa[3])&&(Da===K?Ja=Xs:Da===X?Ja=Hn:Da!==Z&&Da!==re||(Ja=Hn.concat(da))),Ja}(ft,xt,zr,Br,nr))return vr===Xs?null:vr;for(var wn=function(Hn){var da,pa,ma=function(ja){var Ta,gs,Gs,Ri,In=[];for(gs=0,Gs=ja.length;gs0){var ai=Fs[yo];if(ai.holeOf!=null){var Pn=ai.holeOf;Fs[Pn].holeIds.push(Za),si.holeOf=Pn,si.depth=Fs[yo].depth}else Fs[yo].holeIds.push(Za),si.holeOf=yo,si.depth=Fs[yo].depth+1}else si.holeOf=null,si.depth=Fs[yo].depth}else si.holeOf=null,si.depth=0;return si}(ma[da],Ja,ja),gs=function(In){Da[In]=!0,In=ma.length)&&ma[Gs];);Ja.push(Ta)}};for(da=0,pa=ma.length;daRi||Ja===X&&In.point[0]>ma[2])break;if(In.left){ja=Ga=gs.insert(In),Ga=Ga!==(Ta=gs.minNode())?gs.prev(Ga):null,ja=gs.next(ja);var Fs=Ga?Ga.key:null;if(ae(In,Fs,Ja),ja&&xr(In,ja.key,Hn)===2&&(ae(In,Fs,Ja),ae(ja.key,In,Ja)),Ga&&xr(Ga.key,In,Hn)===2){var Za=Ga;ae(Fs,(Za=Za!==Ta?gs.prev(Za):null)?Za.key:null,Ja),ae(In,Fs,Ja)}}else ja=Ga=gs.find(In=In.otherEvent),Ga&&ja&&(Ga=Ga!==Ta?gs.prev(Ga):null,ja=gs.next(ja),gs.remove(In),ja&&Ga&&xr(Ga.key,ja.key,Hn))}return Gs}(vn,0,0,zr,Br,nr)),ss=[],ms=0;ms * @license MIT * @preserve */function P6(f,c,h,g){const v=[],N=g===0?(C,L,F,$,K,Z)=>{C.push(new sr(Z,F+(Z-L)/($-L)*(K-F)))}:(C,L,F,$,K,Z)=>{C.push(new sr(L+(Z-F)/(K-F)*($-L),Z))};for(const C of f){const L=[];for(const F of C){if(F.length<=2)continue;const $=[];for(let X=0;Xc&&N($,re,ae,me,Se,c):Ne>h?Fe=c&&N($,re,ae,me,Se,c),Fe>h&&Ne<=h&&N($,re,ae,me,Se,h)}let K=F[F.length-1];const Z=g===0?K.x:K.y;Z>=c&&Z<=h&&$.push(K),$.length&&(K=$[$.length-1],$[0].x===K.x&&$[0].y===K.y||$.push($[0]),L.push($))}L.length&&v.push(L)}return v}function cHe(f,c){const h=Coe(f),g=Coe([c]),v=Ove.intersection(h,g);return v==null?[]:Dve(v)}function dHe(f,c){let g=Coe(f,65536);const v=[];for(;c.valid();c.next()){const[N,C]=c.get(),L=N.x*65536,F=N.y*65536,$=C.x*65536,K=C.y*65536,Z=$-L,X=K-F,re=Math.hypot(Z,X);if(re===0)continue;const ae=Math.trunc(X/re*3),me=-Math.trunc(Z/re*3);v.push([[[L,F],[$,K],[$+ae,K+me],[L+ae,F+me],[L,F]]])}return v.length>0&&(g=Ove.diff(g,v)),Dve(g,1/65536)}function Coe(f,c=1){return[f.map(h=>h.map(g=>[g.x*c,g.y*c]))]}function Dve(f,c=1){return f.map(h=>h.map((g,v)=>{const N=g.map(C=>new sr(C[0]*c,C[1]*c).round());return v>0&&N.reverse(),N}))}class Moe{constructor(c,h){this.layoutVertexArray=new ag,this.indexArray=new Qo,this.lineIndexArray=new Ou,this.triangleSegments=new Ui,this.lineSegments=new Ui,this.programConfigurations=new Gh(c.layers,{zoom:c.zoom,lut:c.lut}),this.uploaded=!1,h&&(this.elevatedLayoutVertexArray=new Rp)}update(c,h,g,v,N,C,L,F){this.programConfigurations.updatePaintArrays(c,h,N,g,v,C,L,F)}isEmpty(){return this.layoutVertexArray.length===0}needsUpload(){return this.programConfigurations.needsUpload}upload(c){this.uploaded||(this.layoutVertexBuffer=c.createVertexBuffer(this.layoutVertexArray,KVe.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,ZVe.members))),this.programConfigurations.upload(c),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.elevatedLayoutVertexBuffer&&this.elevatedLayoutVertexBuffer.destroy(),this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.lineIndexBuffer.destroy(),this.programConfigurations.destroy(),this.triangleSegments.destroy(),this.lineSegments.destroy())}populatePaintArrays(c,h,g,v,N,C,L){this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,c,h,g,v,N,C,void 0,L)}}class Toe{constructor(c){this.zoom=c.zoom,this.pixelRatio=c.pixelRatio,this.overscaling=c.overscaling,this.layers=c.layers,this.layerIds=this.layers.map(h=>h.fqid),this.index=c.index,this.hasPattern=!1,this.patternFeatures=[],this.lut=c.lut,this.bufferData=new Moe(c,!1),this.elevationBufferData=new Moe(c,!0),this.stateDependentLayerIds=this.layers.filter(h=>h.isStateDependent()).map(h=>h.id),this.projection=c.projection,this.elevationMode=this.layers[0].layout.get("fill-elevation-reference"),this.sourceLayerIndex=c.sourceLayerIndex,this.worldview=c.worldview,this.hasAppearances=null}updateFootprints(c,h){}updateAppearances(c,h,g,v){}populate(c,h,g,v){this.hasPattern=Noe("fill",this.layers,this.pixelRatio,h);const N=this.layers[0].layout.get("fill-sort-key"),C=[];for(const{feature:L,id:F,index:$,sourceLayerIndex:K}of c){const Z=this.layers[0]._featureFilter.needGeometry,X=Dt(L,Z);if(!this.layers[0]._featureFilter.filter(new oi(this.zoom,{worldview:this.worldview,activeFloors:h.activeFloors}),X,g))continue;const re=N?N.evaluate(X,{},g,h.availableImages):void 0,ae={id:F,properties:L.properties,type:L.type,sourceLayerIndex:K,index:$,geometry:Z?X.geometry:St(L,g,v),patterns:{},sortKey:re};C.push(ae)}N&&C.sort((L,F)=>L.sortKey-F.sortKey);for(const L of C){const{geometry:F,index:$,sourceLayerIndex:K}=L;if(this.hasPattern){const Z=Soe("fill",this.layers,L,this.zoom,this.pixelRatio,h);this.patternFeatures.push(Z)}else this.addFeature(L,F,$,g,{},h.availableImages,h.brightness,h.elevationFeatures);h.featureIndex.insert(c[$].feature,F,$,K,this.index)}}update(c,h,g,v,N,C,L){this.bufferData.update(c,h,g,v,N,C,L,this.worldview),this.elevationBufferData.update(c,h,g,v,N,C,L,this.worldview),this.elevatedStructures&&this.elevatedStructures.update(c,h,g,v,N,C,L,this.worldview)}addFeatures(c,h,g,v,N,C){for(const L of this.patternFeatures)this.addFeature(L,L.geometry,L.index,h,g,v,C,c.elevationFeatures)}isEmpty(){return this.bufferData.isEmpty()&&this.elevationBufferData.isEmpty()}uploadPending(){return!this.uploaded||this.bufferData.needsUpload()||this.elevationBufferData.needsUpload()}upload(c){this.bufferData.upload(c),this.elevationBufferData.upload(c),this.elevatedStructures&&this.elevatedStructures.upload(c)}destroy(){this.bufferData.destroy(),this.elevationBufferData.destroy(),this.elevatedStructures&&this.elevatedStructures.destroy()}addFeature(c,h,g,v,N,C=[],L,F){const $=cM(h,500);this.elevationMode!=="none"?this.addElevatedRoadFeature(c,$,v,g,F):this.addGeometry($,this.bufferData),this.bufferData.populatePaintArrays(c,g,N,C,v,L,this.worldview),this.elevationBufferData.populatePaintArrays(c,g,N,C,v,L,this.worldview)}getUnevaluatedPortalGraph(){return this.elevatedStructures?this.elevatedStructures.unevaluatedPortals:void 0}getElevationPolygons(){return this.elevatedStructures?this.elevatedStructures.portalPolygons:void 0}setEvaluatedPortalGraph(c,h,g,v,N){this.elevatedStructures&&(this.elevatedStructures.construct(c),this.elevatedStructures.populatePaintArrays(h,g,v,N,this.worldview))}addElevatedRoadFeature(c,h,g,v,N){const C=new Array,L=Ca.getElevationFeature(c,N);if(!L)return void this.addGeometry(h,this.bufferData);{const $=this.clipPolygonsToTile(h,1);$.length>0&&C.push({polygons:$,elevationFeature:L,elevationTileID:g})}const F={guardRailEnabled:this.layers[0].layout.get("fill-construct-bridge-guard-rail").evaluate(c,{},g),featureIndex:v};for(const $ of C)if($.elevationFeature){if(this.elevationMode==="hd-road-base"){this.elevatedStructures||(this.elevatedStructures=new Ru($.elevationTileID,this.layers,this.zoom,this.lut));const Z=$.elevationFeature.isTunnel();let X=0;c.properties.hasOwnProperty(Ht)&&(X=+c.properties[Ht]);for(const re of $.polygons)this.elevatedStructures.addPortalCandidates($.elevationFeature.id,re,Z,$.elevationFeature,X)}$.elevationFeature.constantHeight==null&&($.polygons=this.prepareElevatedPolygons($.polygons,$.elevationFeature,$.elevationTileID));const K=new qa(g,$.elevationTileID);this.addElevatedGeometry($.polygons,K,$.elevationFeature,this.elevationMode==="hd-road-base"?0:.05,v,F)}}addElevatedGeometry(c,h,g,v,N,C){const L={elevation:g,elevationSampler:h,bias:v,index:N,featureInfo:C},[F,$]=this.addGeometry(c,this.elevationBufferData,L);this.elevationBufferData.heightRange==null?this.elevationBufferData.heightRange={min:F,max:$}:(this.elevationBufferData.heightRange.min=Math.min(this.elevationBufferData.heightRange.min,F),this.elevationBufferData.heightRange.max=Math.max(this.elevationBufferData.heightRange.max,$))}addGeometry(c,h,g){let v=Number.POSITIVE_INFINITY,N=Number.NEGATIVE_INFINITY,C=null;g&&(C=g.elevationSampler.constantElevation(g.elevation,g.bias),C!=null&&(v=C,N=C));const L=(F,$,K)=>{if(g!=null)if($.push(F),C!=null)h.elevatedLayoutVertexArray.emplaceBack(C),K.push(C);else{const Z=g.elevationSampler.pointElevation(F,g.elevation,g.bias);h.elevatedLayoutVertexArray.emplaceBack(Z),K.push(Z),v=Math.min(v,Z),N=Math.max(N,Z)}};for(const F of c){let $=0;for(const ze of F)$+=ze.length;const K=h.triangleSegments.prepareSegment($,h.layoutVertexArray,h.indexArray),Z=K.vertexLength,X=[],re=[],ae=[],me=[],Se=[],Ne=h.layoutVertexArray.length;for(const ze of F){if(ze.length===0)continue;ze!==F[0]&&re.push(X.length/2);const Xe=h.lineSegments.prepareSegment(ze.length,h.layoutVertexArray,h.lineIndexArray),gt=Xe.vertexLength;g&&Se.push(h.layoutVertexArray.length-Ne),L(ze[0],ae,me),h.layoutVertexArray.emplaceBack(ze[0].x,ze[0].y),h.lineIndexArray.emplaceBack(gt+ze.length-1,gt),X.push(ze[0].x),X.push(ze[0].y);for(let ht=1;ht0&&g&&this.elevationMode==="hd-road-base"){const ze=g.elevation.isTunnel(),Xe=g.elevation.safeArea,gt=this.elevatedStructures.addVertices(ae,me);this.elevatedStructures.addTriangles(Fe,gt,ze);const ht=Se.length;if(ht>0){for(let bt=0;bt=g&&re.max.x<=N&&re.min.y>=v&&re.max.y<=C?F:$).push(X)}if(F.length===c.length)return c;const K=[new sr(g,v),new sr(N,v),new sr(N,C),new sr(g,C),new sr(g,v)],Z=F;for(const X of $)Z.push(...cHe(X,K));return Z}}let Rve,Fve,zve,Bve;en(Toe,"FillBucket",{omit:["layers","patternFeatures"]}),en(Moe,"FillBufferData"),en(Ru,"ElevatedStructures");class L6{constructor(c,h,g,v){if(this.triangleCount=h.length/3,this.min=new sr(0,0),this.max=new sr(0,0),this.xScale=0,this.yScale=0,this.cellsX=0,this.cellsY=0,this.cells=[],this.payload=[],this.triangleCount===0||c.length===0)return;const[N,C]=[c[0].clone(),c[0].clone()];for(let Z=1;ZZ.cellIdx-X.cellIdx||Z.triIdx-X.triIdx);let K=0;for(;K<$.length;){const Z=$[K].cellIdx,X={start:this.payload.length,len:0};for(;K<$.length&&$[K].cellIdx===Z;)++X.len,this.payload.push($[K++].triIdx);this.cells[Z]=X}}_lazyInitLookup(){this.lookup||(this.lookup=new Uint8Array(Math.ceil(this.triangleCount/8))),this.lookup.fill(0)}queryPoint(c,h){if(this.triangleCount===0||this.cells.length===0||c.x>this.max.x||this.min.x>c.x||c.y>this.max.y||this.min.y>c.y)return;const g=dg(c.x-this.min.x,this.xScale,this.cellsX),v=dg(c.y-this.min.y,this.yScale,this.cellsY),N=this.cells[v*this.cellsX+g];if(N){this._lazyInitLookup();for(let C=0;Cthis.max.x||this.min.x>h.x||c.y>this.max.y||this.min.y>h.y)return;this._lazyInitLookup();const v=dg(c.x-this.min.x,this.xScale,this.cellsX),N=dg(h.x-this.min.x,this.xScale,this.cellsX),C=dg(c.y-this.min.y,this.yScale,this.cellsY),L=dg(h.y-this.min.y,this.yScale,this.cellsY);for(let F=C;F<=L;F++)for(let $=v;$<=N;$++){const K=this.cells[F*this.cellsX+$];if(K)for(let Z=0;Zh.fqid),this.index=c.index,this.hasPattern=!1,this.stateDependentLayerIds=this.layers.filter(h=>h.isStateDependent()).map(h=>h.id),this.footprints=[],this.worldview=c.worldview,this.hasAppearances=null}updateFootprints(c,h){for(const g of this.footprints)h.push({footprint:g,id:c})}updateAppearances(c,h,g,v){}populate(c,h,g,v){const N=[];for(const{feature:C,id:L,index:F,sourceLayerIndex:$}of c){const K=this.layers[0]._featureFilter.needGeometry,Z=Dt(C,K);if(!this.layers[0]._featureFilter.filter(new oi(this.zoom,{worldview:this.worldview,activeFloors:h.activeFloors}),Z,g))continue;const X={id:L,properties:C.properties,type:C.type,sourceLayerIndex:$,index:F,geometry:K?Z.geometry:St(C,g,v),patterns:{}};N.push(X)}for(const C of N){const{geometry:L,index:F,sourceLayerIndex:$}=C;this.addFeature(C,L,F,g,{},h.availableImages,h.brightness),h.featureIndex.insert(c[F].feature,L,F,$,this.index)}}isEmpty(){return this.footprints.length===0}uploadPending(){return!1}upload(c){}update(c,h,g,v,N,C,L){}destroy(){}addFeature(c,h,g,v,N,C=[],L){for(const F of cM(h,2)){const $=[],K=[],Z=[],X=new sr(1/0,1/0),re=new sr(-1/0,-1/0);for(const Se of F)if(Se.length!==0){Se!==F[0]&&Z.push(K.length/2);for(let Ne=0;NeC===v)===void 0}(g,f.clipScope)}function O6(f,c){return f.x-c.x||f.y-c.y}function Vve(f,c){return O6(f.min,c.min)===0&&O6(f.max,c.max)===0}function Aoe(f,c){return!(f.min.x>c.max.x||f.max.xc.max.y||f.max.ynew sr((F.x+N.x*Cr)*L-C.x*Cr,(F.y+N.y*Cr)*L-C.y*Cr))}return Eoe(h,v,f.indices,0,f.indices.length,0,0)}function Gve(f,c,h,g){const v=Math.pow(2,g.z-h.z);return new sr((f+h.x*Cr)*v-g.x*Cr,(c+h.y*Cr)*v-g.y*Cr)}function Kve(f,c){const h=[];c.grid.queryPoint(f,h);const g=c.indices,v=c.vertices;for(let N=0;N0&&(g.length>1&&h.push(g),g=[])}return g.length>1&&h.push(g),h}const Poe=Ot.types,_He=["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"],bHe=["fill-extrusion-flood-light-ground-radius"],wHe=Math.pow(2,13),jHe=Math.pow(2,15)-1,Yve=new sr(0,1),Cx=2147483648,Xve=7,Qve=450;function uM(f,c,h,g,v,N,C,L){f.emplaceBack((c<<1)+C,(h<<1)+N,(Math.floor(g*wHe)<<1)+v,Math.round(L))}function hM(f,c,h){f.emplaceBack(c.x*Cr,c.y*Cr,h?1:0)}function R6(f,c,h,g,v,N){f.emplaceBack(c.x,c.y,(h.x<<1)+g,(h.y<<1)+v,N)}function fM(f,c,h){f.emplaceBack(c.x,c.y,c.z,h[0]*16384,h[1]*16384,h[2]*16384)}class Jve{constructor(){this.vertexOffset=0,this.vertexCount=0,this.indexOffset=0,this.indexCount=0}}class e_e{constructor(){this.centroidXY=new sr(0,0),this.vertexArrayOffset=0,this.vertexCount=0,this.groundVertexArrayOffset=0,this.groundVertexCount=0,this.flags=0,this.footprintSegIdx=-1,this.footprintSegLen=0,this.polygonSegIdx=-1,this.polygonSegLen=0,this.min=new sr(Number.MAX_VALUE,Number.MAX_VALUE),this.max=new sr(-Number.MAX_VALUE,-Number.MAX_VALUE),this.height=0,this.buildingId=0}span(){return new sr(this.max.x-this.min.x,this.max.y-this.min.y)}}class t_e{constructor(){this.acc=new sr(0,0),this.accCount=0,this.centroidDataIndex=0}startRing(c,h){c.min.x===Number.MAX_VALUE&&(c.min.x=c.max.x=h.x,c.min.y=c.max.y=h.y)}appendEdge(c,h,g){this.accCount++,this.acc._add(h);let v=!!this.borders;h.xc.max.x&&(c.max.x=h.x,v=!0),h.yc.max.y&&(c.max.y=h.y,v=!0),((h.x===0||h.x===Cr)&&h.x===g.x)!=((h.y===0||h.y===Cr)&&h.y===g.y)&&this.processBorderOverlap(h,g),v&&this.checkBorderIntersection(h,g)}checkBorderIntersection(c,h){h.x<0!=c.x<0&&this.addBorderIntersection(0,zn(h.y,c.y,(0-h.x)/(c.x-h.x))),h.x>Cr!=c.x>Cr&&this.addBorderIntersection(1,zn(h.y,c.y,(Cr-h.x)/(c.x-h.x))),h.y<0!=c.y<0&&this.addBorderIntersection(2,zn(h.x,c.x,(0-h.y)/(c.y-h.y))),h.y>Cr!=c.y>Cr&&this.addBorderIntersection(3,zn(h.x,c.x,(Cr-h.y)/(c.y-h.y)))}addBorderIntersection(c,h){this.borders||(this.borders=[[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE],[Number.MAX_VALUE,-Number.MAX_VALUE]]);const g=this.borders[c];hg[1]&&(g[1]=h)}processBorderOverlap(c,h){if(c.x===h.x){if(c.y===h.y)return;const g=c.x===0?0:1;this.addBorderIntersection(g,h.y),this.addBorderIntersection(g,c.y)}else{const g=c.y===0?2:3;this.addBorderIntersection(g,h.x),this.addBorderIntersection(g,c.x)}}centroid(){return this.accCount===0?new sr(0,0):new sr(Math.floor(Math.max(0,this.acc.x)/this.accCount),Math.floor(Math.max(0,this.acc.y)/this.accCount))}intersectsCount(){return this.borders?this.borders.reduce((c,h)=>c+ +(h[0]!==Number.MAX_VALUE),0):0}}function r_e(f,c){const h=f.add(c)._unit(),g=xe(f.x*h.x+f.y*h.y,-1,1);var v,N,C;return v=Math.acos(g),Math.min(4,Math.max(-4,Math.tan(v)))/4*jHe*((N=f).x*(C=c).y-N.y*C.x<0?-1:1)}const kHe=[f=>f.x<0,f=>f.x>Cr,f=>f.y<0,f=>f.y>Cr];function NHe(f,c,h,g){const v=[4];if(g===0)return v;h._mult(g);const N=f.sub(h),C=c.sub(h),L=[f,c,N,C];for(let F=0;F<4;F++)for(const $ of L)if(kHe[F]($)){v.push(F);break}return v}class Loe{constructor(c){this.groundRadiusArray=null,this.groundRadiusBuffer=null,this.vertexArray=new z5,this.indexArray=new Qo,this.programConfigurations=new Gh(c.layers,{zoom:c.zoom,lut:c.lut},h=>bHe.includes(h)),this._segments=new Ui,this.hiddenByLandmarkVertexArray=new DN,this._segmentToGroundQuads={},this._segmentToGroundQuads[0]=[],this._segmentToRegionTriCounts={},this._segmentToRegionTriCounts[0]=[0,0,0,0,0],this.regionSegments={},this.regionSegments[4]=new Ui}getDefaultSegment(){return this.regionSegments[4]}hasData(){return this.vertexArray.length!==0}addData(c,h,g,v=!1){const N=c.length;if(N>2){let C=Math.max(0,this._segments.get().length-1);const L=this._segments._prepareSegment(4*N,this.vertexArray.length,2*this._segmentToGroundQuads[C].length);let F;C!==this._segments.get().length-1&&(C++,this._segmentToGroundQuads[C]=[],this._segmentToRegionTriCounts[C]=[0,0,0,0,0]);{const $=c[0],K=c[1];F=r_e($.sub(c[N-1])._perp()._unit(),K.sub($)._perp()._unit())}for(let $=0;$v.region-N.region);for(let g=0;gF+$,0);let L=0;for(let F=0;F<=4;F++){const $=C[F];if($!==0){let K=this.regionSegments[F];K||(K=this.regionSegments[F]=new Ui);const Z={vertexOffset:N.vertexOffset,primitiveOffset:N.primitiveOffset+L,vertexLength:N.vertexLength,primitiveLength:$};K.get().push(Z)}L+=$}for(let F=0;F0?this.hiddenByLandmarkVertexBuffer=c.createVertexBuffer(this.hiddenByLandmarkVertexArray,gHe.members,!0):this.hiddenByLandmarkVertexBuffer&&this.hiddenByLandmarkVertexBuffer.updateData(this.hiddenByLandmarkVertexArray),this._needsHiddenByLandmarkUpdate=!1)}destroy(){if(this.vertexBuffer){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.hiddenByLandmarkVertexBuffer&&this.hiddenByLandmarkVertexBuffer.destroy(),this.groundRadiusBuffer&&this.groundRadiusBuffer.destroy(),this._segments&&this._segments.destroy(),this.programConfigurations.destroy();for(let c=0;c<=4;c++){const h=this.regionSegments[c];h&&h.destroy()}}}}class F6{constructor(c){this.zoom=c.zoom,this.canonical=c.canonical,this.overscaling=c.overscaling,this.layers=c.layers,this.pixelRatio=c.pixelRatio,this.layerIds=this.layers.map(h=>h.fqid),this.index=c.index,this.hasPattern=!1,this.edgeRadius=0,this.projection=c.projection,this.activeReplacements=[],this.replacementUpdateTime=0,this.centroidData=[],this.footprintIndices=new Qo,this.footprintVertices=new ag,this.footprintSegments=[],this.layoutVertexArray=new x0,this.centroidVertexArray=new N6,this.wallVertexArray=new a_,this.indexArray=new Qo,this.programConfigurations=new Gh(c.layers,{zoom:c.zoom,lut:c.lut},h=>_He.includes(h)),this.segments=new Ui,this.stateDependentLayerIds=this.layers.filter(h=>h.isStateDependent()).map(h=>h.id),this.groundEffect=new Loe(c),this.maxHeight=0,this.partLookup={},this.triangleSubSegments=[],this.polygonSegments=[],this.worldview=c.worldview,this.hasAppearances=null}updateFootprints(c,h){}updateAppearances(c,h,g,v){}populate(c,h,g,v){this.features=[],this.hasPattern=Noe("fill-extrusion",this.layers,this.pixelRatio,h),this.featuresOnBorder=[],this.borderFeatureIndices=[[],[],[],[]],this.borderDoneWithNeighborZ=[-1,-1,-1,-1],this.selfDEMTileTimestamp=Number.MAX_VALUE,this.borderDEMTileTimestamp=[Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE],this.tileToMeter=Le(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:N,id:C,index:L,sourceLayerIndex:F}of c){const $=this.layers[0]._featureFilter.needGeometry,K=Dt(N,$);if(!this.layers[0]._featureFilter.filter(new oi(this.zoom,{worldview:this.worldview,activeFloors:h.activeFloors}),K,g))continue;const Z={id:C,sourceLayerIndex:F,index:L,geometry:$?K.geometry:St(N,g,v),properties:N.properties,type:N.type,patterns:{}},X=this.layoutVertexArray.length,re=Poe[Z.type]==="Polygon";if(this.hasPattern)this.features.push({featureId:N.id,feature:Soe("fill-extrusion",this.layers,Z,this.zoom,this.pixelRatio,h)});else if(this.wallMode)for(const ae of Z.geometry)for(const me of Zve(ae,re))this.addFeature(N.id,Z,[me],L,g,{},h.availableImages,v,h.brightness);else this.addFeature(N.id,Z,Z.geometry,L,g,{},h.availableImages,v,h.brightness);h.featureIndex.insert(N,Z.geometry,L,F,this.index,X)}this.sortBorders(),this.projection.name==="mercator"&&this.splitToSubtiles(),this.groundEffect.prepareBorderSegments(),this.polygonSegments.length=0}addFeatures(c,h,g,v,N,C){for(const{featureId:L,feature:F}of this.features){const $=Poe[F.type]==="Polygon",{geometry:K}=F;if(this.wallMode)for(const Z of K)for(const X of Zve(Z,$))this.addFeature(L,F,[X],F.index,h,g,v,N,C);else this.addFeature(L,F,K,F.index,h,g,v,N,C)}this.sortBorders(),this.projection.name==="mercator"&&this.splitToSubtiles()}update(c,h,g,v,N,C,L){this.programConfigurations.updatePaintArrays(c,h,N,g,v,C,L,this.worldview),this.groundEffect.update(c,h,N,g,v,C,L,this.worldview)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload||this.groundEffect.programConfigurations.needsUpload}upload(c){this.uploaded||(this.layoutVertexBuffer=c.createVertexBuffer(this.layoutVertexArray,yHe),this.indexBuffer=c.createIndexBuffer(this.indexArray),this.wallVertexBuffer=c.createVertexBuffer(this.wallVertexArray,mHe.members),this.layoutVertexExtArray&&(this.layoutVertexExtBuffer=c.createVertexBuffer(this.layoutVertexExtArray,xHe.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,pHe.members,!0):this.centroidVertexBuffer&&this.centroidVertexBuffer.updateData(this.centroidVertexArray),this.needsCentroidUpdate=!1)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.centroidVertexBuffer&&this.centroidVertexBuffer.destroy(),this.layoutVertexExtBuffer&&this.layoutVertexExtBuffer.destroy(),this.groundEffect.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(c,h,g,v,N,C,L,F,$){const K=this.layers[0].paint.get("fill-extrusion-flood-light-ground-radius").evaluate(h,{})/this.tileToMeter,Z=[new sr(0,0),new sr(Cr,Cr)],X=F.projection,re=X.name==="globe",ae=this.wallMode||Poe[h.type]==="Polygon",me=new t_e;me.centroidDataIndex=this.centroidData.length;const Se=new e_e;Se.buildingId=c,h.properties&&h.properties.hasOwnProperty("building_id")&&(Se.buildingId=h.properties.building_id);const Ne=this.layers[0].paint.get("fill-extrusion-base").evaluate(h,{},N)<=0,Fe=this.layers[0].paint.get("fill-extrusion-height").evaluate(h,{},N);let ze;if(Se.height=Fe,Se.vertexArrayOffset=this.layoutVertexArray.length,Se.groundVertexArrayOffset=this.groundEffect.vertexArray.length,re&&!this.layoutVertexExtArray&&(this.layoutVertexExtArray=new AN),this.wallMode){if(re)return void Wr("Non zero fill-extrusion-line-width is not yet supported on globe.");if(g.length!==1)return;ze=function(Rt){const rr=Rt[0].x===Rt[Rt.length-1].x&&Rt[0].y===Rt[Rt.length-1].y;(function(Qr){let an=0;const bs=Qr.length;for(let kr=0;kr=0})(Rt)||(Rt=Rt.reverse());const cr={geometry:[],joinNormals:[],indices:[]},yr=[],_r=[],fr=[];let gr=Rt.length;for(;gr>=2&&Rt[gr-1].equals(Rt[gr-2]);)gr--;if(gr<(rr?3:2))return cr;let tr,Qt,xr,Tr,jr,xn=0;for(;xn0;let Wn="miter";const qs=2;Wn==="miter"&&kr>qs&&(Wn="bevel"),Wn==="bevel"&&(kr>100&&(Wn="flipbevel"),kr{const nr=new sr(ls.x,ls.y),vr=new sr(ls.x,ls.y);nr.x+=Wa.x*xt,nr.y+=Wa.y*xt,vr.x-=Wa.x*Math.max(ft,1),vr.y-=Wa.y*Math.max(ft,1),fr.push(Wa),yr.push(nr),_r.push(vr)};if(Wn==="miter")an._mult(kr),Xs(tr,an,0,0);else if(Wn==="flipbevel")an=jr.mult(-1),Xs(tr,an,0,0),Xs(tr,an.mult(-1),0,0);else{const ls=-Math.sqrt(kr*kr-1),Wa=ln?ls:0,ft=ln?0:ls;Qt&&Xs(tr,Tr,Wa,ft),xr&&Xs(tr,jr,Wa,ft)}}cr.geometry=[...yr,..._r.reverse(),yr[0]],cr.joinNormals=[...fr,...fr.reverse(),fr[fr.length-1]];const Vr=cr.geometry.length-1;for(let Qr=0;QrRt<(rr.length-1)/2||Rt===rr.length-1,gt=this.wallMode?[g]:cM(g,500);for(let Rt=gt.length-1;Rt>=0;Rt--){const rr=gt[Rt];(rr.length===0||(ht=rr[0]).every(lr=>lr.x<=0)||ht.every(lr=>lr.x>=Cr)||ht.every(lr=>lr.y<=0)||ht.every(lr=>lr.y>=Cr))&>.splice(Rt,1)}var ht;let bt;if(re)bt=c_e(gt,Z,N);else{bt=[];for(const Rt of gt)bt.push({polygon:Rt,bounds:Z})}const Ct=ae?this.edgeRadius:0,Et=Ct>0&&this.zoom<17,Xt=(Rt,rr)=>{if(Rt.length===0)return!1;const lr=Rt[Rt.length-1];return rr.x===lr.x&&rr.y===lr.y};for(const{polygon:Rt,bounds:rr}of bt){let lr=0,cr=0;for(const gr of Rt)ae&&!gr[0].equals(gr[gr.length-1])&&gr.push(gr[0]),cr+=ae?gr.length-1:gr.length;const yr=this.segments.prepareSegment((ae?5:4)*cr,this.layoutVertexArray,this.indexArray);Se.footprintSegIdx<0&&(Se.footprintSegIdx=this.footprintSegments.length),Se.polygonSegIdx<0&&(Se.polygonSegIdx=this.polygonSegments.length);const _r={triangleArrayOffset:this.indexArray.length,triangleCount:0,triangleSegIdx:this.segments.segments.length-1},fr=new Jve;if(fr.vertexOffset=this.footprintVertices.length,fr.indexOffset=3*this.footprintIndices.length,fr.ringIndices=[],ae){const gr=[],tr=[];lr=yr.vertexLength;for(let xr=0;xr4&&i_e(tr[tr.length-2],tr[0],tr[1]),xr=Ct?SHe(tr[tr.length-2],tr[0],tr[1],Ct):0;const Tr=[];let jr,xn,Vr;xn=tr[1].sub(tr[0])._perp()._unit();let Qr=!0;for(let an=1,bs=0;an0?1:0,Wa=kr.dist(ln);if(bs+Wa>32768&&(bs=0),Ct){Vr=Wn.sub(ln)._perp()._unit();let vr=s_e(kr,ln,Wn,n_e(xn,Vr),Ct);isNaN(vr)&&(vr=0);const zr=ln.sub(kr)._unit();kr=kr.add(zr.mult(xr))._round(),ln=ln.add(zr.mult(-vr))._round(),xr=vr,xn=Vr,Ne&&this.zoom>=17&&(Xt(Tr,kr)||Tr.push(kr),Xt(Tr,ln)||Tr.push(ln))}const ft=yr.vertexLength,xt=tr.length>4&&i_e(kr,ln,Wn);let nr=o_e(bs,Qt,Qr);if(uM(this.layoutVertexArray,kr.x,kr.y,Xs,ls,0,0,nr),uM(this.layoutVertexArray,kr.x,kr.y,Xs,ls,0,1,nr),this.wallMode){const vr=Xe(an-1,tr),zr=ze.joinNormals[an-1];hM(this.wallVertexArray,zr,vr),hM(this.wallVertexArray,zr,vr)}if(bs+=Wa,nr=o_e(bs,xt,!Qr),Qt=xt,uM(this.layoutVertexArray,ln.x,ln.y,Xs,ls,0,0,nr),uM(this.layoutVertexArray,ln.x,ln.y,Xs,ls,0,1,nr),this.wallMode){const vr=Xe(an,tr),zr=ze.joinNormals[an];hM(this.wallVertexArray,zr,vr),hM(this.wallVertexArray,zr,vr)}if(yr.vertexLength+=4,this.indexArray.emplaceBack(ft+0,ft+1,ft+2),this.indexArray.emplaceBack(ft+1,ft+3,ft+2),yr.primitiveLength+=2,Ct){const vr=lr+(an===1?tr.length-2:an-2),zr=an===1?lr:vr+1;if(this.indexArray.emplaceBack(ft+1,vr,ft+3),this.indexArray.emplaceBack(vr,zr,ft+3),yr.primitiveLength+=2,jr===void 0&&(jr=ft),!Ooe(Wn,tr[an],rr)){const Br=an===tr.length-1?jr:yr.vertexLength;this.indexArray.emplaceBack(ft+2,ft+3,Br),this.indexArray.emplaceBack(ft+3,Br+1,Br),this.indexArray.emplaceBack(ft+3,zr,Br+1),yr.primitiveLength+=3}Qr=!Qr}if(re){const vr=this.layoutVertexExtArray,zr=X.projectTilePoint(kr.x,kr.y,N),Br=X.projectTilePoint(ln.x,ln.y,N),vn=X.upVector(N,kr.x,kr.y),wn=X.upVector(N,ln.x,ln.y);fM(vr,zr,vn),fM(vr,zr,vn),fM(vr,Br,wn),fM(vr,Br,wn)}}ae&&(lr+=tr.length-1),Ne&&Ct&&this.zoom>=17&&(Tr.length!==0&&Xt(Tr,Tr[0])&&Tr.pop(),this.groundEffect.addData(Tr,rr,K,Ct>0))}this.footprintSegments.push(fr),_r.triangleCount=this.indexArray.length-_r.triangleArrayOffset,this.polygonSegments.push(_r),++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=me.borders?Yve:this.encodeCentroid(me,Se),this.centroidData.push(Se),me.borders){this.featuresOnBorder.push(me);const Rt=this.featuresOnBorder.length-1;for(let rr=0;rrthis.featuresOnBorder[h].borders[c][0]-this.featuresOnBorder[g].borders[c][0])}splitToSubtiles(){const c=[];for(let L=0;LCr),K=2*$+(+(F.min.x+F.max.x>Cr)^$);for(let Z=0;ZL.triangleSegmentIdx===F.triangleSegmentIdx?L.subtile-F.subtile:L.triangleSegmentIdx-F.triangleSegmentIdx);let g=0,v=0,N=0;for(const L of c){if(L.triangleSegmentIdx!==g)break;N++}const C=c.length;for(;v!==c.length;){g=c[v].triangleSegmentIdx;let L=0,F=v,$=v;for(let K=F;K0&&this.triangleSubSegments.push({segment:re,min:Z,max:X}),F=$;for(let ae=F;ae[me[0]*(1-Ne[0])+Se[0]*Ne[0],me[1]*(1-Ne[1])+Se[1]*Ne[1]],re=[],ae=[];for(const me of this.triangleSubSegments){re[0]=me.min.x/Cr,re[1]=me.min.y/Cr,ae[0]=me.max.x/Cr,ae[1]=me.max.y/Cr;const Se=X(K,Z,re),Ne=X(K,Z,ae);if(new hn([Se[0],Se[1],N],[Ne[0],Ne[1],C]).intersectsPrecise(g)===0){$&&(v.segments.push($),$=void 0);continue}const Fe=me.segment;$&&$.vertexOffset!==Fe.vertexOffset&&(v.segments.push($),$=void 0),$?($.vertexLength+=Fe.vertexLength,$.primitiveLength+=Fe.primitiveLength):$={vertexOffset:Fe.vertexOffset,primitiveLength:Fe.primitiveLength,vertexLength:Fe.vertexLength,primitiveOffset:Fe.primitiveOffset,sortKey:void 0,vaos:{}}}return $&&v.segments.push($),v}encodeCentroid(c,h){const g=c.centroid(),v=h.span(),N=Math.min(7,Math.round(v.x*this.tileToMeter/10)),C=Math.min(7,Math.round(v.y*this.tileToMeter/10));return new sr(xe(g.x,1,Cr-1)<<3|N,xe(g.y,1,Cr-1)<<3|C)}encodeBorderCentroid(c){if(!c.borders)return new sr(0,0);const h=c.borders,g=Number.MAX_VALUE;if(h[0][0]!==g||h[1][0]!==g){const v=h[0][0]!==g?0:1;return new sr(6|(h[0][0]!==g?0:65528),(h[v][0]+h[v][1])/2<<3|6)}{const v=h[2][0]!==g?2:3;return new sr((h[v][0]+h[v][1])/2<<3|6,6|(h[2][0]!==g?0:65528))}}showCentroid(c){const h=this.centroidData[c.centroidDataIndex];h.flags&=2147483647,h.centroidXY.x=0,h.centroidXY.y=0,this.writeCentroidToBuffer(h)}writeCentroidToBuffer(c){this.groundEffect.updateHiddenByLandmark(c);const h=c.vertexArrayOffset,g=c.vertexCount+c.vertexArrayOffset,v=c.flags&Cx?Yve:c.centroidXY,N=this.centroidVertexArray.geta_centroid_pos0(h);if(this.centroidVertexArray.geta_centroid_pos1(h)!==v.y||N!==v.x){for(let C=h;CF.max.x||F.min.x>C.max.x||C.min.y>F.max.y||F.min.y>C.max.y||C.footprint.buildingIds.has(F.buildingId)&&(F.flags|=Cx);else for(const F of this.centroidData)if(!(F.flags&Cx||C.min.x>F.max.x||F.min.x>C.max.x||C.min.y>F.max.y||F.min.y>C.max.y))for(let $=0;$h!=re>h&&c<(this.footprintVertices.int16[2*(K+C.vertexOffset)+0]-Z)*(h-X)/(re-X)+Z&&(v=!v)}L=F}}return v}getHeightAtTileCoord(c,h){let g=Number.NEGATIVE_INFINITY,v=!0;const N=4*(c+Cr)*Cr+(h+Cr);if(this.partLookup.hasOwnProperty(N)){const C=this.partLookup[N];return C?{height:C.height,hidden:!!(C.flags&Cx)}:void 0}for(const C of this.centroidData)c>C.max.x||C.min.x>c||h>C.max.y||C.min.y>h||C.height<=g||this.footprintContainsPoint(c,h,C)&&(g=C.height,this.partLookup[N]=C,v=!!(C.flags&Cx));if(g!==Number.NEGATIVE_INFINITY)return{height:g,hidden:v};this.partLookup[N]=void 0}}function n_e(f,c){const h=f.add(c)._unit();return f.x*h.x+f.y*h.y}function SHe(f,c,h,g){const v=c.sub(f)._perp()._unit(),N=h.sub(c)._perp()._unit();return s_e(f,c,h,n_e(v,N),g)}function s_e(f,c,h,g,v){const N=Math.sqrt(1-g*g);return Math.min(f.dist(c)/3,c.dist(h)/3,v*N/g)}function Ooe(f,c,h){return f.xh[1].x&&c.x>h[1].x||f.yh[1].y&&c.y>h[1].y}function a_e(f,c){return f.xc[1].x||f.yc[1].y}function i_e(f,c,h){if(f.x<0||f.x>=Cr||c.x<0||c.x>=Cr||h.x<0||h.x>=Cr)return!1;const g=h.sub(c),v=g.perp(),N=f.sub(c);return(g.x*N.x+g.y*N.y)/Math.sqrt((g.x*g.x+g.y*g.y)*(N.x*N.x+N.y*N.y))>-.866&&v.x*N.x+v.y*N.y<0}function o_e(f,c,h){const g=c?2|f:-3&f;return h?1|g:-2&g}function l_e(){const f=Math.PI/32,c=Math.tan(f),h=w;return h*Math.sqrt(1+2*c*c)-h}function c_e(f,c,h){const g=1<{for(const Ct of ht)ae.push({polygon:Ct,bounds:bt})},Se=Math.ceil(Math.log2(K)),Ne=Math.ceil(Math.log2(Z)),Fe=Se-Ne,ze=[];for(let ht=0;ht0?0:1);for(let ht=0;htbt+1?gt.push({polygons:cr,bounds:_r,depth:bt+1}):me(cr,_r)}if(yr.length){const _r=[new sr(Ct===0?lr:Et.x,Ct===1?lr:Et.y),Xt];ze.length>bt+1?gt.push({polygons:yr,bounds:_r,depth:bt+1}):me(yr,_r)}}return ae}(f,c,Math.ceil((N-v)/11.25),Math.ceil((C-L)/11.25),1,(F,$,K)=>{if(F===0)return .5*($+K);{const Z=de((h.y+$/Cr)/g);return(H(.5*(de((h.y+K/Cr)/g)+Z))*g-h.y)*Cr}})}function CHe(f,c,h,g,v,N){const C=Math.pow(2,g.z-v.z);for(let L=0;L=F[C]&&(L=c,F=f),L[C]v&&f_e(L,F,C,v),L[C]N&&f_e(F,L,C,N)}}function z6(f,c,h,g,v,N){const C=[];for(let L=0;L=g&&ae.x>=g||(re.x>=g?re=new sr(g,re.y+(g-re.x)/(ae.x-re.x)*(ae.y-re.y))._round():ae.x>=g&&(ae=new sr(g,re.y+(g-re.x)/(ae.x-re.x)*(ae.y-re.y))._round()),re.y>=v&&ae.y>=v||(re.y>=v?re=new sr(re.x+(v-re.y)/(ae.y-re.y)*(ae.x-re.x),v)._round():ae.y>=v&&(ae=new sr(re.x+(v-re.y)/(ae.y-re.y)*(ae.x-re.x),v)._round()),$&&re.equals($[$.length-1])||($=[re],C.push($),N&&N.push({progress:{min:Se+m_e(Ne,Fe,re)*me,max:1},parentIndex:L,prevPoint:Ne,nextPoint:Fe})),$.push(ae),N&&(N[N.length-1].progress.max=Se+m_e(Ne,Fe,ae)*me,N[N.length-1].nextPoint=Fe)))))}if(N&&Z>0)for(let X=K;X$.t-K.t);let C=0,L=0,F=[];for(g.push(F);C!==f.length;){if(L===N.length){for(;C!==f.length;)F.length!==0&&F[F.length-1].equals(f[C])||F.push(f[C]),C++;break}N[L].t<=C?(F.length!==0&&F[F.length-1].equals(N[L].point)||F.push(N[L].point),Math.trunc(N[L].t),L++):(F.length!==0&&F[F.length-1].equals(f[C])||F.push(f[C]),C++)}}function m_e(f,c,h){return f.x!==c.x?(h.x-f.x)/(c.x-f.x):f.y!==c.y?(h.y-f.y)/(c.y-f.y):0}function pM(f,c){return f.x*c.x+f.y*c.y}function g_e(f,c){if(f.length===1){let h=0;const g=c[h++];let v;for(;!v||g.equals(v);)if(v=c[h++],!v)return 1/0;for(;h{lr[0]=cr,lr[1]=yr,lr[2]=_r,lr[3]=1},rr=l_e();re>0&&(re+=rr),ae+=rr;for(const lr of X){const cr=[],yr=[];for(const _r of lr){const fr=_r.x+me.x,gr=_r.y+me.y,tr=Z.projection.projectTilePoint(fr,gr,gt),Qt=Z.projection.upVector(gt,_r.x,_r.y);let xr=re,Tr=ae;if(Ne){const jr=v_e(fr,gr,re,ae,Ne,Fe,ze,Xe);xr+=jr.base,Tr+=jr.top}re!==0?Rt(Et,tr.x+Qt[0]*Ct*xr,tr.y+Qt[1]*Ct*xr,tr.z+Qt[2]*Ct*xr):Rt(Et,tr.x,tr.y,tr.z),Rt(Xt,tr.x+Qt[0]*Ct*Tr,tr.y+Qt[1]*Ct*Tr,tr.z+Qt[2]*Ct*Tr),at(Et,Et,Se),at(Xt,Xt,Se),cr.push(new m_(Et[0],Et[1],Et[2])),yr.push(new m_(Xt[0],Xt[1],Xt[2]))}ht.push(cr),bt.push(yr)}return[ht,bt]}(f,c,h,g,v,N,C,L,F,$,K):C?function(Z,X,re,ae,me,Se,Ne,Fe,ze){const Xe=[],gt=[],ht=[0,0,0,1];for(const bt of Z){const Ct=[],Et=[];for(const Xt of bt){const Rt=Xt.x+ae.x,rr=Xt.y+ae.y,lr=v_e(Rt,rr,X,re,Se,Ne,Fe,ze);ht[0]=Rt,ht[1]=rr,ht[2]=lr.base,ht[3]=1,He(ht,ht,me),ht[3]=Math.max(ht[3],1e-5);const cr=new m_(ht[0]/ht[3],ht[1]/ht[3],ht[2]/ht[3]);ht[0]=Rt,ht[1]=rr,ht[2]=lr.top,ht[3]=1,He(ht,ht,me),ht[3]=Math.max(ht[3],1e-5);const yr=new m_(ht[0]/ht[3],ht[1]/ht[3],ht[2]/ht[3]);Ct.push(cr),Et.push(yr)}Xe.push(Ct),gt.push(Et)}return[Xe,gt]}(c,h,g,v,N,C,L,F,$):function(Z,X,re,ae,me){const Se=[],Ne=[],Fe=me[8]*X,ze=me[9]*X,Xe=me[10]*X,gt=me[11]*X,ht=me[8]*re,bt=me[9]*re,Ct=me[10]*re,Et=me[11]*re;for(const Xt of Z){const Rt=[],rr=[];for(const lr of Xt){const cr=lr.x+ae.x,yr=lr.y+ae.y,_r=me[0]*cr+me[4]*yr+me[12],fr=me[1]*cr+me[5]*yr+me[13],gr=me[2]*cr+me[6]*yr+me[14],tr=me[3]*cr+me[7]*yr+me[15],Qt=_r+Fe,xr=fr+ze,Tr=gr+Xe,jr=Math.max(tr+gt,1e-5),xn=_r+ht,Vr=fr+bt,Qr=gr+Ct,an=Math.max(tr+Et,1e-5);Rt.push(new m_(Qt/jr,xr/jr,Tr/jr)),rr.push(new m_(xn/an,Vr/an,Qr/an))}Se.push(Rt),Ne.push(rr)}return[Se,Ne]}(c,h,g,v,N)}function v_e(f,c,h,g,v,N,C,L){const F=C*v.getElevationAt(f,c,!0,!0),$=N[0]!==0,K=$?N[1]===0?C*(N[0]/Xve-Qve):C*function(Z,X,re){const ae=Math.floor(X[0]/8),me=Math.floor(X[1]/8),Se=10*(X[0]-8*ae),Ne=10*(X[1]-8*me),Fe=Z.getElevationAt(ae,me,!0,!0),ze=Z.getMeterToDEM(re),Xe=Math.floor(.5*(Se*ze-1)),gt=Math.floor(.5*(Ne*ze-1)),ht=Z.tileCoordToPixel(ae,me),bt=2*Xe+1,Ct=2*gt+1,Et=function(yr,_r,fr,gr,tr){return[yr.getElevationAtPixel(_r,fr,!0),yr.getElevationAtPixel(_r+tr,fr,!0),yr.getElevationAtPixel(_r,fr+tr,!0),yr.getElevationAtPixel(_r+gr,fr+tr,!0)]}(Z,ht.x-Xe,ht.y-gt,bt,Ct),Xt=Math.abs(Et[0]-Et[1]),Rt=Math.abs(Et[2]-Et[3]),rr=Math.abs(Et[0]-Et[2])+Math.abs(Et[1]-Et[3]),lr=Math.min(.25,.5*ze*(Xt+Rt)/bt),cr=Math.min(.25,.5*ze*rr/Ct);return Fe+Math.max(lr*Se,cr*Ne)}(v,N,L):F;return{base:F+(h===0?-1:h),top:$?Math.max(K+g,F+h+2):F+g}}class THe{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 AHe{constructor(){this.tasks={},this.taskQueue=[],Lt(["process"],this),this.invoker=new THe(this.process),this.nextId=0}add(c,h){const g=this.nextId++,v=function({type:N,isSymbolTile:C,zoom:L}){return L=L||0,N==="message"?0:N!=="maybePrepare"||C?N!=="parseTile"||C?N==="parseTile"&&C?300-L:N==="maybePrepare"&&C?400-L:500:200-L:100-L}(h);if(v===0){try{c()}finally{}return null}return this.tasks[g]={fn:c,metadata:h,priority:v,id:g},this.taskQueue.push(g),this.invoker.trigger(),{cancel:()=>{delete this.tasks[g]}}}process(){try{if(this.taskQueue=this.taskQueue.filter(g=>!!this.tasks[g]),!this.taskQueue.length)return;const c=this.pick();if(c===null)return;const h=this.tasks[c];if(delete this.tasks[c],this.taskQueue.length&&this.invoker.trigger(),!h)return;h.fn()}finally{}}pick(){let c=null,h=1/0;for(let v=0;v{g&&delete this.callbacks[L],this.target.postMessage({id:L,type:"",targetMapId:v,sourceMapId:this.mapId})}}}receive(c){const h=c.data;if(!h)return;const g=h.id;if(g&&(!h.targetMapId||this.mapId===h.targetMapId))if(h.type===""){const v=this.cancelCallbacks[g];delete this.cancelCallbacks[g],v&&v.cancel()}else if(h.mustQueue||$s(self)){const v=this.callbacks[g],N=this.scheduler.add(()=>this.processTask(g,h),v&&v.metadata||{type:"message"});N&&(this.cancelCallbacks[g]=N)}else this.processTask(g,h)}processTask(c,h){if(delete this.cancelCallbacks[c],h.type===""){const g=this.callbacks[c];delete this.callbacks[c],g&&(h.error?g(sg(h.error)):g(null,sg(h.data)))}else{const g=new Set,v=h.hasCallback?(C,L)=>{this.target.postMessage({id:c,type:"",sourceMapId:this.mapId,error:C?Pp(C):null,data:Pp(L,g)},g)}:()=>{},N=sg(h.data);if(this.parent[h.type])this.parent[h.type](h.sourceMapId,N,v);else if(this.parent.getWorkerSource){const C=h.type.split("."),{source:L,scope:F}=N;this.parent.getWorkerSource(h.sourceMapId,C[0],L,F)[C[1]](N,v)}else v(new Error(`Could not find function ${h.type}`))}}remove(){this.scheduler.remove(),this.target.removeEventListener("message",this.receive,!1)}}var mM={workerUrl:"",workerClass:null,workerParams:void 0};const Doe="mapboxgl_preloaded_worker_pool";class g_{constructor(c){this.active={},this.name=c}acquire(c,h=g_.workerCount){if(!this.workers)for(this.workers=[];this.workers.length{h.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[Doe]}numActive(){return Object.keys(this.active).length}}g_.workerCount=2;class YN{constructor(c,h,g="Worker",v=g_.workerCount){this.workerPool=c,this.actors=[],this.currentActor=0,this.id=At();const N=this.workerPool.acquire(this.id,v);for(let C=0;C{this.ready=!0})}broadcast(c,h,g){Nt(this.actors,(v,N)=>{v.send(c,h,N)},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 gM,Roe;function B6(){return gM||(gM=new g_),gM}YN.Actor=__e;const Foe=4096;class EHe{constructor(c){this.module=c,this.memoryStack=this.module.malloc(Foe),this.memoryStackNextFree=this.memoryStack}createIntArray(c){const h=this.memoryStackNextFree;return this.memoryStackNextFree+=c.length*Int32Array.BYTES_PER_ELEMENT,this.memoryStackNextFree-this.memoryStack>Foe?-1:(new Int32Array(this.module.heap32.buffer,h,c.length).set(c),h)}createFloatArray(c){const h=this.memoryStackNextFree;return this.memoryStackNextFree+=c.length*Float32Array.BYTES_PER_ELEMENT,this.memoryStackNextFree-this.memoryStack>Foe?-1:(new Float32Array(this.module.heapF32.buffer,h,c.length).set(c),h)}readStringBuffer(c){let h="";for(;this.module.heapU8[c]!==0;)h+=String.fromCharCode(this.module.heapU8[c]),++c;return h}setStyle(c){const h=c.normalScale;this.module.setStyle(h[0],h[1],h[2],c.tileToMeters)}setAOOptions(c,h){this.module.setAOOptions(c?1:0,h)}setMetricOptions(c,h){this.module.setMetricOptions(c?1:0,h)}setStructuralOptions(c){this.module.setStructuralOptions(c?1:0)}setFacadeOptions(c,h){this.module.setFacadeOptions(c,h?1:0)}setFauxFacadeOptions(c,h,g){this.module.setFauxFacadeOptions(c?1:0,h?1:0,g)}setFacadeClassifierOptions(c){this.module.setFacadeClassifierOptions(c)}generateMesh(c,h){this.memoryStackNextFree=this.memoryStack;for(const L of c){const F=this.createIntArray(L.ringIndices),$=this.createFloatArray(L.coordinates);if(F===-1||$===-1)return`building_gen: Out of stack memory: ${this.memoryStackNextFree-this.memoryStack}/4096`;this.module.addFeature(L.id,L.sourceId,L.minHeight,L.height,L.roofType,$,F,L.ringIndices.length-1)}for(const L of h){let F;F=L.entrances?JSON.parse(L.entrances):[];const $=this.createFloatArray(F),K=this.createFloatArray(L.coordinates);if($===-1||K===-1)return`building_gen: Out of stack memory: ${this.memoryStackNextFree-this.memoryStack}/4096`;this.module.addFacade(L.sourceId,L.crossPerc,L.distanceToRoad,$,F.length,K,L.coordinates.length)}if(!this.module.generateMesh()){const L=this.module.getLastError();return this.readStringBuffer(L)}const g=this.module.getMeshCount(),v=new Array(g);for(let L=0;Lv.arrayBuffer()).then(v=>{c.buffers[h]=v})}function M_e(f,c){const h=f.json.bufferViews[c];return new Uint8Array(f.buffers[h.buffer],h.byteOffset||0,h.byteLength)}function RHe(f,c,h,g){if(f.uri){const v=C_e(f.uri,g);return fetch(v).then(N=>N.blob()).then(N=>createImageBitmap(N)).then(N=>{c.images[h]=N})}if(f.bufferView!==void 0){const v=M_e(c,f.bufferView),N=new Blob([v],{type:f.mimeType});return createImageBitmap(N).then(C=>{c.images[h]=C})}}function T_e(f,c=0,h){const g={json:null,images:[],buffers:[]};if(new Uint32Array(f,c,1)[0]===N_e){const K=new Uint32Array(f,c);let Z=2;const X=(K[Z++]>>2)-3,re=K[Z++]>>2;if(Z++,g.json=JSON.parse(S_e.decode(K.subarray(Z,Z+re))),Z+=re,Z{const K=[],Z=L&&L.includes($oe),X=L&&L.includes(q6);if(Z&&K.push(function(){if(!Hp)return xM??(xM=function(re){let ae,me=null;function Se(){ae=new Uint8Array(me.buffer)}function Ne(){throw new Error("Unexpected Draco error.")}const Fe={a:{a:Ne,d:function(ze,Xe,gt){return ae.copyWithin(ze,Xe,Xe+gt)},c:function(ze){const Xe=ae.length,gt=Math.max(ze>>>0,Math.ceil(1.2*Xe)),ht=Math.ceil((gt-Xe)/65536);try{return me.grow(ht),Se(),!0}catch{return!1}},b:Ne}};return(WebAssembly.instantiateStreaming?WebAssembly.instantiateStreaming(re,Fe):re.then(ze=>ze.arrayBuffer()).then(ze=>WebAssembly.instantiate(ze,Fe))).then(ze=>{const{Rb:Xe,Qb:gt,P:ht,T:bt,X:Ct,Ja:Et,La:Xt,Qa:Rt,Va:rr,Wa:lr,eb:cr,jb:yr,f:_r,e:fr,yb:gr,zb:tr,Ab:Qt,Bb:xr,Db:Tr,Gb:jr}=ze.instance.exports;me=fr;const xn=(()=>{let Vr=0,Qr=0,an=0,bs=0;return kr=>{an&&(Xe(bs),Xe(Vr),Qr+=an,an=Vr=0),Vr||(Qr+=128,Vr=gt(Qr));const ln=kr.length+7&-8;let Wn=Vr;ln>=Qr&&(an=ln,Wn=bs=gt(ln));for(let qs=0;qs{Hp=re,xM=void 0}))}()),X&&K.push(function(){if(Boe)return;const re=function(ae){let me;const Se=WebAssembly.instantiateStreaming(ae,{}).then(ze=>{me=ze.instance,me.exports.__wasm_call_ctors()}),Ne={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(ze,Xe,gt,ht,bt,Ct){(function(Et,Xt,Rt,rr,lr,cr,yr){const _r=Et.exports.sbrk,fr=rr+3&-4,gr=_r(fr*lr),tr=_r(cr.length),Qt=new Uint8Array(Et.exports.memory.buffer);Qt.set(cr,tr);const xr=Xt(gr,rr,lr,tr,cr.length);if(xr===0&&yr&&yr(gr,fr,lr),Rt.set(Qt.subarray(gr,gr+rr*lr)),_r(gr-_r(0)),xr!==0)throw new Error(`Malformed buffer data: ${xr}`)})(me,me.exports[Fe[bt]],ze,Xe,gt,ht,me.exports[Ne[Ct]])}}}(fetch(j_e()));return re.ready.then(()=>{Boe=re})}()),N)for(let re=0;re{if(Z&&C)for(const{primitives:re}of C)for(const ae of re)LHe(ae,g);if(X&&C&&F)for(const re of F)OHe(re,g);return g})})}function A_e(f){return fetch(f).then(c=>c.arrayBuffer()).then(c=>T_e(c,0,f))}function Uoe(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 qoe(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 Voe{constructor(c,h,g,v){this.context=c,this.format=g,this.useMipmap=v&&v.useMipmap,this.texture=c.gl.createTexture(),this.update(h,{premultiply:v&&v.premultiply})}update(c,h){const g=c&&c instanceof HTMLVideoElement&&c.width===0?c.videoWidth:c.width,v=c&&c instanceof HTMLVideoElement&&c.height===0?c.videoHeight:c.height,{context:N}=this,{gl:C}=N,{x:L,y:F}=h&&h.position?h.position:{x:0,y:0},$=L+g,K=F+v;!this.size||this.size[0]===$&&this.size[1]===K||(C.bindTexture(C.TEXTURE_2D,null),C.deleteTexture(this.texture),this.texture=C.createTexture(),this.size=null),C.bindTexture(C.TEXTURE_2D,this.texture),N.pixelStoreUnpackFlipY.set(!1),N.pixelStoreUnpack.set(1),N.pixelStoreUnpackPremultiplyAlpha.set(this.format===C.RGBA8&&(!h||h.premultiply!==!1));const Z=c instanceof HTMLImageElement||c instanceof HTMLCanvasElement||c instanceof HTMLVideoElement||c instanceof ImageData||ImageBitmap&&c instanceof ImageBitmap;if(!this.size&&$>0&&K>0){const X=this.useMipmap?Math.floor(Math.log2(Math.max($,K)))+1:1;C.texStorage2D(C.TEXTURE_2D,X,this.format,$,K),this.size=[$,K]}this.size&&(Z?C.texSubImage2D(C.TEXTURE_2D,0,L,F,Uoe(this.format),qoe(this.format),c):"data"in c&&c.data&&C.texSubImage2D(C.TEXTURE_2D,0,L,F,g,v,Uoe(this.format),qoe(this.format),c.data)),this.useMipmap&&C.generateMipmap(C.TEXTURE_2D)}bind(c,h,g=!1){const{context:v}=this,{gl:N}=v;N.bindTexture(N.TEXTURE_2D,this.texture),c!==this.minFilter&&(N.texParameteri(N.TEXTURE_2D,N.TEXTURE_MAG_FILTER,c),N.texParameteri(N.TEXTURE_2D,N.TEXTURE_MIN_FILTER,this.useMipmap&&!g?c===N.NEAREST?N.NEAREST_MIPMAP_NEAREST:N.LINEAR_MIPMAP_LINEAR:c),this.minFilter=c),h!==this.wrapS&&(N.texParameteri(N.TEXTURE_2D,N.TEXTURE_WRAP_S,h),N.texParameteri(N.TEXTURE_2D,N.TEXTURE_WRAP_T,h),this.wrapS=h)}bindExtraParam(c,h,g,v,N){const{context:C}=this,{gl:L}=C;L.bindTexture(L.TEXTURE_2D,this.texture),h!==this.magFilter&&(L.texParameteri(L.TEXTURE_2D,L.TEXTURE_MAG_FILTER,h),this.magFilter=h),c!==this.minFilter&&(L.texParameteri(L.TEXTURE_2D,L.TEXTURE_MIN_FILTER,this.useMipmap?c===L.NEAREST?L.NEAREST_MIPMAP_NEAREST:L.LINEAR_MIPMAP_LINEAR:c),this.minFilter=c),g!==this.wrapS&&(L.texParameteri(L.TEXTURE_2D,L.TEXTURE_WRAP_S,g),this.wrapS=g),v!==this.wrapT&&(L.texParameteri(L.TEXTURE_2D,L.TEXTURE_WRAP_T,v),this.wrapT=v),N!==this.compareMode&&(N?(L.texParameteri(L.TEXTURE_2D,L.TEXTURE_COMPARE_MODE,L.COMPARE_REF_TO_TEXTURE),L.texParameteri(L.TEXTURE_2D,L.TEXTURE_COMPARE_FUNC,N)):L.texParameteri(L.TEXTURE_2D,L.TEXTURE_COMPARE_MODE,L.NONE),this.compareMode=N)}destroy(){const{gl:c}=this.context;c.deleteTexture(this.texture),this.texture=null}}class vM{constructor(c,h){this.context=c,this.texture=h}bind(c,h){const{context:g}=this,{gl:v}=g;v.bindTexture(v.TEXTURE_2D,this.texture),c!==this.minFilter&&(v.texParameteri(v.TEXTURE_2D,v.TEXTURE_MAG_FILTER,c),v.texParameteri(v.TEXTURE_2D,v.TEXTURE_MIN_FILTER,c),this.minFilter=c),h!==this.wrapS&&(v.texParameteri(v.TEXTURE_2D,v.TEXTURE_WRAP_S,h),v.texParameteri(v.TEXTURE_2D,v.TEXTURE_WRAP_T,h),this.wrapS=h)}}const FHe=Ds([{name:"a_pos_3f",components:3,type:"Float32"}]),zHe=Ds([{name:"a_color_3f",components:3,type:"Float32"}]),BHe=Ds([{name:"a_color_4f",components:4,type:"Float32"}]),$He=Ds([{name:"a_uv_2f",components:2,type:"Float32"}]),UHe=Ds([{name:"a_normal_3f",components:3,type:"Float32"}]),qHe=Ds([{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"}]),VHe=Ds([{name:"a_pbr",components:4,type:"Uint16"},{name:"a_heightBasedEmissiveStrength",components:3,type:"Float32"}]);function E_e(f,c){const h=V6(f.projection,f.zoom,f.width,f.height),g=function(N,C,L,F,$){const K=new m(L.lng-180*C0,L.lat),Z=new m(L.lng+180*C0,L.lat),X=N.project(K.lng,K.lat),re=N.project(Z.lng,Z.lat),ae=-Math.atan2(re.y-X.y,re.x-X.x),me=We.fromLngLat(L);me.y=xe(me.y,-1+C0,1-C0);const Se=me.toLngLat(),Ne=N.project(Se.lng,Se.lat),Fe=We.fromLngLat(Se);Fe.x+=C0;const ze=Fe.toLngLat(),Xe=N.project(ze.lng,ze.lat),gt=P_e(Xe.x-Ne.x,Xe.y-Ne.y,ae),ht=We.fromLngLat(Se);ht.y+=C0;const bt=ht.toLngLat(),Ct=N.project(bt.lng,bt.lat),Et=P_e(Ct.x-Ne.x,Ct.y-Ne.y,ae),Xt=Math.abs(gt.x)/Math.abs(Et.y),Rt=M([]);V(Rt,Rt,-ae*(1-($?0:F)));const rr=M([]);return z(rr,rr,[1,1-(1-Xt)*F,1]),rr[4]=-Et.x/Et.y*F,V(rr,rr,ae),T(rr,Rt,rr),rr}(f.projection,0,f.center,h,c),v=I_e(f);return z(g,g,[v,v,1]),g}function I_e(f){const c=f.projection,h=V6(f.projection,f.zoom,f.width,f.height),g=Hoe(c,f.center),v=Hoe(c,m.convert(c.center));return Math.pow(2,g*h+(1-h)*v)}function V6(f,c,h,g,v=1/0){const N=f.range;if(!N)return 0;const C=Math.min(v,Math.max(h,g)),L=Math.log2(C/1024);return Pe(N[0]+L,N[1]+L,c)}const C0=1/4e4;function Hoe(f,c){const h=xe(c.lat,-ue,ue),g=new m(c.lng-180*C0,h),v=new m(c.lng+180*C0,h),N=f.project(g.lng,h),C=f.project(v.lng,h),L=We.fromLngLat(g),F=We.fromLngLat(v),$=C.x-N.x,K=C.y-N.y,Z=F.x-L.x,X=F.y-L.y,re=Math.sqrt((Z*Z+X*X)/($*$+K*K));return Math.log2(re)}function P_e(f,c,h){const g=Math.cos(h),v=Math.sin(h);return{x:f*g-c*v,y:f*v+c*g}}function L_e(f,c,h){M(f),V(f,f,qn(c[2])),D(f,f,qn(c[0])),U(f,f,qn(c[1])),z(f,f,h),T(f,f,[1,0,0,0,0,0,1,0,0,1,0,0,0,0,0,1])}function H6(f,c,h,g,v,N,C,L){const F=[h[0]-c[0],h[1]-c[1],0],$=[g[0]-c[0],g[1]-c[1],0];if(pe(F)<1e-12||pe($)<1e-12)return yt(f);const K=Mt([],F,$);qe(K,K),ye($,g,c),F[2]=(N-v)*L,$[2]=(C-v)*L;const Z=F;return Mt(Z,F,$),qe(Z,Z),kn(f,K,Z)}function W6(f,c,h=!1){const g=N0(c.zoom),v=function(N,C,L){const F=C.worldSize,$=[N[12],N[13],N[14]],K=de($[1]/F),Z=te($[0]/F),X=M([]),re=Y(1,K)*F,ae=Y(1,0)*F*ve(K,C.zoom),me=1/_oe(F);let Se=ae*me;if(L){const Xe=V6(C.projection,C.zoom,C.width,C.height,1024);Se=me*C.projection.pixelSpaceConversion(C.center.lat,F,Xe)}const Ne=w0(K,Z);he(Ne,Ne,_e([],qe([],Ne),re*Se*$[2]));const Fe=function(Xe){const gt=[Xe[0],Xe[1],Xe[2]];let ht=[0,1,0];const bt=Mt([],ht,gt);return Mt(ht,gt,bt),Ue(ht)===0&&(ht=[0,1,0],Mt(bt,gt,ht)),qe(bt,bt),qe(ht,ht),qe(gt,gt),[bt[0],bt[1],bt[2],0,ht[0],ht[1],ht[2],0,gt[0],gt[1],gt[2],0,Xe[0],Xe[1],Xe[2],1]}(Ne);z(X,X,[Se,Se,Se*re]),I(X,X,[-$[0],-$[1],-$[2]]);const ze=T([],C.globeMatrix,Fe);return T(ze,ze,X),T(ze,ze,N),ze}(f,c,h);if(g>0){const N=function(C,L){const F=L.worldSize,$=Y(1,0)*F*ve(L.center.lat,L.zoom)/_oe(F),K=Y(1,L.center.lat)*F,Z=M([]);U(Z,Z,qn(L.center.lng)),D(Z,Z,qn(L.center.lat)),I(Z,Z,[0,0,Ec]),z(Z,Z,[$,$,$*K]);const X=L.point;return I(Z,Z,[-X.x,-X.y,0]),T(Z,Z,C),T(Z,L.globeMatrix,Z)}(f,c);return function(C,L,F){const $=(ae,me,Se)=>{const Ne=pe(ae),Fe=pe(me),ze=Vp(ae,me,Se);return _e(ze,ze,1/pe(ze)*zn(Ne,Fe,Se))},K=$([C[0],C[1],C[2]],[L[0],L[1],L[2]],F),Z=$([C[4],C[5],C[6]],[L[4],L[5],L[6]],F),X=$([C[8],C[9],C[10]],[L[8],L[9],L[10]],F),re=Vp([C[12],C[13],C[14]],[L[12],L[13],L[14]],F);return[K[0],K[1],K[2],0,Z[0],Z[1],Z[2],0,X[0],X[1],X[2],0,re[0],re[1],re[2],1]}(v,N,g)}return v}function Woe(f,c,h,g){const v=hn.projectAabbCorners(g,h);let N=Number.MAX_VALUE;for(let L=0;L0||Se===0&&ae[0]*me[0]+ae[1]*me[1]>=0&&ae[0]*ae[0]+ae[1]*ae[1]>me[0]*me[0]+me[1]*me[1])&&(K=re)}Z=K}while(Z!==$);return F.length>0&&F.push(F[0]),F}(v);if(ha(f,C))return N}const x_=64,e4={CoordinateSpaceTile:1,HasMapboxMeshFeatures:4,HasMeshoptCompression:8};function G6(f,c,h,g,v,N,C,L,F,$=!1){const K=h.zoom,Z=h.project(g),X=ve(g.lat,K),re=1/X;M(f),I(f,f,[Z.x+C[0]*re,Z.y+C[1]*re,C[2]]);let ae=1,me=1;const Se=h.worldSize;if($){if(h.projection.name==="mercator"){let Xe=0;h.elevation&&(Xe=h.elevation.getAtPointOrZero(new We(Z.x/Se,Z.y/Se),0));const gt=He([],[Z.x,Z.y,Xe,1],h.projMatrix)[3]/h.cameraToCenterDistance;ae=gt,me=gt*ve(h.center.lat,K)}else if(h.projection.name==="globe"){const Xe=W6(f,h),gt=[0,0,0,1];He(gt,gt,T([],h.projMatrix,Xe));const ht=gt[3]/h.cameraToCenterDistance,bt=N0(K),Ct=h.projection.pixelsPerMeter(g.lat,Se)*ve(g.lat,K),Et=h.projection.pixelsPerMeter(h.center.lat,Se)*ve(h.center.lat,K);ae=ht/zn(Ct,je(h.center.lat),bt),me=ht*X/Ct,ae*=Et,me*=Et}}else ae=re;z(f,f,[ae,ae,me]);const Ne=[...f],Fe=c.orientation,ze=[];if(L_e(ze,[Fe[0]+(v?v[0]:0),Fe[1]+(v?v[1]:0),Fe[2]+(v?v[2]:0)],N),T(f,Ne,ze),L&&h.elevation){let Xe=0;const gt=[];if(F&&h.elevation){Xe=function(bt,Ct,Et,Xt,Rt){const rr=Ct.elevation;if(!rr)return 0;const lr=hn.projectAabbCorners(Et,Xt),cr=Y(1,Rt.lat)*Ct.worldSize,yr=function(Qr,an){const bs=[0,0,1],kr=[{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 ln of kr){const Wn=Qr[ln.corners[0]],qs=Qr[ln.corners[1]],Xs=Qr[ln.corners[2]],ls=[qs[0]-Wn[0],qs[1]-Wn[1],an*(qs[2]-Wn[2])],Wa=Mt(ls,ls,[Xs[0]-Wn[0],Xs[1]-Wn[1],an*(Xs[2]-Wn[2])]);qe(Wa,Wa),ln.dotProductWithUp=ot(Wa,bs)}return kr.sort((ln,Wn)=>ln.dotProductWithUp-Wn.dotProductWithUp),kr[0].corners}(lr,cr),_r=lr[yr[0]],fr=lr[yr[1]],gr=lr[yr[2]],tr=lr[yr[3]],Qt=rr.getAtPointOrZero(new We(_r[0]/Ct.worldSize,_r[1]/Ct.worldSize),0),xr=rr.getAtPointOrZero(new We(fr[0]/Ct.worldSize,fr[1]/Ct.worldSize),0),Tr=rr.getAtPointOrZero(new We(gr[0]/Ct.worldSize,gr[1]/Ct.worldSize),0),jr=rr.getAtPointOrZero(new We(tr[0]/Ct.worldSize,tr[1]/Ct.worldSize),0),xn=(Qt+jr)/2,Vr=(xr+Tr)/2;return xn>Vr?xr=c.gl.NEAREST_MIPMAP_NEAREST}),f.uploaded=!0,f.image=null)}function HHe(f,c,h){f.indexBuffer=c.createIndexBuffer(f.indexArray,!1,!0),f.vertexBuffer=c.createVertexBuffer(f.vertexArray,FHe.members,!1,!0),f.normalArray&&(f.normalBuffer=c.createVertexBuffer(f.normalArray,UHe.members,!1,!0)),f.texcoordArray&&(f.texcoordBuffer=c.createVertexBuffer(f.texcoordArray,$He.members,!1,!0)),f.colorArray&&(f.colorBuffer=c.createVertexBuffer(f.colorArray,(f.colorArray.bytesPerElement===12?zHe:BHe).members,!1,!0)),f.featureArray&&(f.pbrBuffer=c.createVertexBuffer(f.featureArray,VHe.members,!0)),f.segments=Ui.simpleSegment(0,0,f.vertexArray.length,f.indexArray.length);const g=f.material;g.pbrMetallicRoughness.baseColorTexture&&_M(g.pbrMetallicRoughness.baseColorTexture,c),g.pbrMetallicRoughness.metallicRoughnessTexture&&_M(g.pbrMetallicRoughness.metallicRoughnessTexture,c),g.normalTexture&&_M(g.normalTexture,c),g.occlusionTexture&&_M(g.occlusionTexture,c,h),g.emissionTexture&&_M(g.emissionTexture,c)}function Goe(f,c,h){if(f.meshes)for(const g of f.meshes)HHe(g,c,h);if(f.children)for(const g of f.children)Goe(g,c,h)}function K6(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)K6(c)}function Koe(f){if(f.meshes)for(const h of f.meshes)h.vertexBuffer&&(h.vertexBuffer.destroy(),h.indexBuffer.destroy(),h.normalBuffer&&h.normalBuffer.destroy(),h.texcoordBuffer&&h.texcoordBuffer.destroy(),h.colorBuffer&&h.colorBuffer.destroy(),h.pbrBuffer&&h.pbrBuffer.destroy(),h.segments.destroy(),h.material&&((c=h.material).pbrMetallicRoughness.baseColorTexture&&c.pbrMetallicRoughness.baseColorTexture.gfxTexture&&c.pbrMetallicRoughness.baseColorTexture.gfxTexture.destroy(),c.pbrMetallicRoughness.metallicRoughnessTexture&&c.pbrMetallicRoughness.metallicRoughnessTexture.gfxTexture&&c.pbrMetallicRoughness.metallicRoughnessTexture.gfxTexture.destroy(),c.normalTexture&&c.normalTexture.gfxTexture&&c.normalTexture.gfxTexture.destroy(),c.emissionTexture&&c.emissionTexture.gfxTexture&&c.emissionTexture.gfxTexture.destroy(),c.occlusionTexture&&c.occlusionTexture.gfxTexture&&c.occlusionTexture.gfxTexture.destroy()));var c;if(f.children)for(const h of f.children)Koe(h)}function y_(f,c){const h=f.json.bufferViews[c.bufferView],g=U6[c.componentType];return new g(f.buffers[h.buffer],(c.byteOffset||0)+(h.byteOffset||0),c.count*(h.byteStride&&h.byteStride!==yM[c.type]*g.BYTES_PER_ELEMENT?h.byteStride/g.BYTES_PER_ELEMENT:yM[c.type]))}function Zoe(f,c,h,g){const v=U6[c.componentType],N=function(K){switch(K){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:return 1}}(v),C=f.json.bufferViews[c.bufferView],L=C.byteStride?C.byteStride/v.BYTES_PER_ELEMENT:yM[c.type],F=h.float32,$=F.length/h.capacity;for(let K=0,Z=0;K0){for(let Se=0;Se0){N.texcoordArray=new zf;const X=c.json.accessors[v.TEXCOORD_0];N.texcoordArray.resize(X.count);const re=y_(c,X);Zoe(c,X,N.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")&&(N.featureData=y_(c,X))}v._FEATURE_RGBA4444!==void 0&&(N.featureData=new Uint32Array(y_(c,c.json.accessors[v._FEATURE_RGBA4444]).buffer));const Z=f.material;return N.material=function(X,re){const{emissiveFactor:ae=[0,0,0],alphaMode:me="OPAQUE",alphaCutoff:Se=.5,normalTexture:Ne,occlusionTexture:Fe,emissiveTexture:ze,doubleSided:Xe,name:gt}=X,{baseColorFactor:ht=[1,1,1,1],metallicFactor:bt=1,roughnessFactor:Ct=1,baseColorTexture:Et,metallicRoughnessTexture:Xt}=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:gt,pbrMetallicRoughness:{baseColorFactor:new ba(...ht),metallicFactor:bt,roughnessFactor:Ct,baseColorTexture:Et?re[Et.index]:void 0,metallicRoughnessTexture:Xt?re[Xt.index]:void 0},doubleSided:Xe,emissiveFactor:new ba(...ae),alphaMode:me,alphaCutoff:Se,normalTexture:Ne?re[Ne.index]:void 0,occlusionTexture:Rt,emissionTexture:ze?re[ze.index]:void 0,defined:X.defined===void 0}}(Z!==void 0?c.json.materials[Z]:{defined:!1},h),N}function D_e(f,c,h){const{matrix:g,rotation:v,translation:N,scale:C,mesh:L,extras:F,children:$,name:K}=f,Z={};if(Z.name=K,Z.localMatrix=g||function(X,re,ae,me){var Se=re[0],Ne=re[1],Fe=re[2],ze=re[3],Xe=Se+Se,gt=Ne+Ne,ht=Fe+Fe,bt=Se*Xe,Ct=Se*gt,Et=Se*ht,Xt=Ne*gt,Rt=Ne*ht,rr=Fe*ht,lr=ze*Xe,cr=ze*gt,yr=ze*ht,_r=me[0],fr=me[1],gr=me[2];return X[0]=(1-(Xt+rr))*_r,X[1]=(Ct+yr)*_r,X[2]=(Et-cr)*_r,X[3]=0,X[4]=(Ct-yr)*fr,X[5]=(1-(bt+rr))*fr,X[6]=(Rt+lr)*fr,X[7]=0,X[8]=(Et+cr)*gr,X[9]=(Rt-lr)*gr,X[10]=(1-(bt+Xt))*gr,X[11]=0,X[12]=ae[0],X[13]=ae[1],X[14]=ae[2],X[15]=1,X}([],v||[0,0,0,1],N||[0,0,0],C||[1,1,1]),Z.globalMatrix=k(Z.localMatrix),L!==void 0){Z.meshes=h[L];const X=Z.anchor=[0,0];for(const re of Z.meshes){const{min:ae,max:me}=re.aabb;X[0]+=ae[0]+me[0],X[1]+=ae[1]+me[1]}X[0]=Math.floor(X[0]/Z.meshes.length/2),X[1]=Math.floor(X[1]/Z.meshes.length/2)}if(F&&(F.id&&(Z.id=F.id),F.lights&&(Z.lights=function(X){if(!X.length)return[];const re=function(Fe){const ze=atob(Fe),Xe=new Uint8Array(ze.length);for(let gt=0;gt1&&g[g.length-1].equals(g[0])&&g.pop();let v=0;for(let C=0;C0&&g.reverse();const N=KN(g.flatMap(C=>[C.x,C.y]),[]);return N.length===0?null:{vertices:g,indices:N}}function ZHe(f,c){const h=[],g=[];let v=0;const N=[];for(const C of f){v=h.length;const L=C.vertexArray.float32,F=C.indexArray.uint16;for(let $=0;$0&&([g[C+1],g[C+2]]=[g[C+2],g[C+1]])}return{vertices:h,indices:g}}function Yoe(f){const c=function(F,$){const K=[],Z=WebGL2RenderingContext;if(F.json.textures)for(const X of F.json.textures){const re={magFilter:Z.LINEAR,minFilter:Z.NEAREST,wrapS:Z.REPEAT,wrapT:Z.REPEAT};X.sampler!==void 0&&Object.assign(re,F.json.samplers[X.sampler]),K.push({image:$[X.source],sampler:re,uploaded:!1})}return K}(f,f.images),h=function(F,$){const K=[];for(const Z of F.json.meshes){const X=[];for(const re of Z.primitives)X.push(WHe(re,F,$));K.push(X)}return K}(f,c),{scenes:g,scene:v,nodes:N}=f.json,C=g?g[v||0].nodes:[...N.keys()],L=[];for(const F of C)L.push(D_e(N[F],f,h));return function(F,$,K){const Z={},X=new Set;for(let re=0;re0){const re=Array.from(X.values()).sort((ae,me)=>ae-me);for(let ae=re.length-1;ae>=0;ae--)F.splice(re[ae],1)}}(L,C,f.json.nodes),L}function YHe(f){f.heightmap=new Float32Array(4096),f.heightmap.fill(-1);const c=f.vertexArray.float32,h=f.aabb.min[0]-1,g=f.aabb.min[1]-1,v=x_/(f.aabb.max[0]-h+2),N=x_/(f.aabb.max[1]-g+2);for(let C=0;Cf.heightmap[$*x_+F]&&(f.heightmap[$*x_+F]=L)}}function R_e(f,c,h,g,v){h.reserve(h.length+4*f.length),g.reserve(g.length+10*f.length),v.reserve(v.length+10*f.length);let N=g.length;for(const C of f){const L=Math.min(10,Math.max(4,1.3*C.height))*c,F=[-C.normal[1],C.normal[0],0],$=Math.min(.29,.1*C.width/C.depth),K=C.width-2*C.depth*c*($+.01),Z=Je([],C.pos,F,K/2),X=Je([],C.pos,F,-K/2),re=[Z[0],Z[1],Z[2]+C.height],ae=[X[0],X[1],X[2]+C.height],me=Je([],C.normal,F,$);_e(me,me,L);const Se=Je([],C.normal,F,-$);_e(Se,Se,L),he(me,Z,me),he(Se,X,Se),Z[2]+=.1,X[2]+=.1,g.emplaceBack(me[0],me[1],me[2]),g.emplaceBack(Se[0],Se[1],Se[2]),g.emplaceBack(Z[0],Z[1],Z[2]),g.emplaceBack(X[0],X[1],X[2]),g.emplaceBack(re[0],re[1],re[2]),g.emplaceBack(ae[0],ae[1],ae[2]),g.emplaceBack(Z[0],Z[1],Z[2]),g.emplaceBack(X[0],X[1],X[2]),g.emplaceBack(me[0],me[1],me[2]),g.emplaceBack(Se[0],Se[1],Se[2]);const Ne=K/L/2;v.emplaceBack(-Ne-$,-1,Ne,.8),v.emplaceBack(Ne+$,-1,Ne,.8),v.emplaceBack(-Ne,0,Ne,1.3),v.emplaceBack(Ne,0,Ne,1.3),v.emplaceBack(Ne+$,-.8,Ne,.7),v.emplaceBack(Ne+$,-.8,Ne,.7),v.emplaceBack(0,0,Ne,1.3),v.emplaceBack(0,0,Ne,1.3),v.emplaceBack(Ne+$,-1.2,Ne,.8),v.emplaceBack(Ne+$,-1.2,Ne,.8),h.emplaceBack(6+N,4+N,8+N),h.emplaceBack(7+N,9+N,5+N),h.emplaceBack(0+N,1+N,2+N),h.emplaceBack(1+N,3+N,2+N),N+=10}}function XHe(f,c){const h={};h.indexArray=new Qo,h.vertexArray=new Lu,h.colorArray=new ig,R_e(f,c,h.indexArray,h.vertexArray,h.colorArray);const g={defined:!0};g.emissiveFactor=ba.black;const v={};return v.baseColorFactor=ba.white,g.pbrMetallicRoughness=v,h.material=g,h.aabb=new hn([1/0,1/0,1/0],[-1/0,-1/0,-1/0]),h}const F_e=Ds([{name:"a_pos_3f",components:3,type:"Float32"}]),QHe=Ds([{name:"a_normal_3",components:3,type:"Int16"}]),JHe=Ds([{name:"a_centroid_3",components:3,type:"Int16"}]),z_e=Ds([{name:"a_part_color_emissive",components:2,type:"Uint16"}]),eWe=Ds([{name:"a_faux_facade_color_emissive",components:2,type:"Uint16"}]),tWe=Ds([{name:"a_faux_facade_data",components:4,type:"Uint16"}]),rWe=Ds([{name:"a_faux_facade_vertical_range",components:2,type:"Uint16"}]),nWe=Ds([{name:"a_bloom_attenuation",components:4,type:"Float32"}]),sWe=Ds([{name:"a_flood_light_wall_radius_1i16",components:1,type:"Uint16"}]),B_e=Ot.types,Z6=32767;function aWe(f,c){const h=Cr+c;for(const g of f)for(const v of g)if(v.x<-c||v.x>h||v.y<-c||v.y>h)return!1;return!0}function iWe(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 Xoe{constructor(){this.layoutVertexArray=new Lu,this.layoutAttenuationArray=new ig,this.layoutColorArray=new Ou,this.indexArray=new Qo,this.indexArrayForConflation=new Qo,this.segmentsBucket=new Ui}}class Qoe{constructor(c){this.layoutFacadePaintArray=null,this.layoutFacadeDataArray=null,this.layoutFacadeVerticalRangeArray=null,this.segmentsBucket=new Ui,this.entranceBloom=new Xoe;const h=66560;this.layoutVertexArray=new Lu,this.layoutVertexArray.reserve(h),this.layoutNormalArray=new g0,this.layoutNormalArray.reserve(h),this.layoutCentroidArray=new g0,this.layoutCentroidArray.reserve(h),this.layoutColorArray=new Ou,this.layoutColorArray.reserve(h),this.layoutFloodLightDataArray=new og,this.layoutFloodLightDataArray.reserve(h),this.layoutAOArray=new DN,this.layoutAOArray.reserve(h),this.indexArray=new Qo,this.indexArray.reserve(66560),this.indexArrayForConflation=new Qo,this.segmentsBucket=new Ui,this.entranceBloom=new Xoe,c&&(this.layoutFacadePaintArray=new Ou,this.layoutFacadeDataArray=new jx,this.layoutFacadeVerticalRangeArray=new Ou)}reserve(c,h,g){this.layoutVertexArray.reserveForAdditional(c),this.layoutCentroidArray.reserveForAdditional(c),this.layoutFloodLightDataArray.reserveForAdditional(c),this.layoutNormalArray.reserveForAdditional(c),this.layoutAOArray.reserveForAdditional(c),this.layoutColorArray.reserveForAdditional(c),this.indexArray.reserveForAdditional(h),g&&(this.layoutFacadePaintArray.reserveForAdditional(c),this.layoutFacadeDataArray.reserveForAdditional(c),this.layoutFacadeVerticalRangeArray.reserveForAdditional(c))}}class $_e{constructor(c){this.colorBufferUploaded=!1,this.maxHeight=0,this.replacementUpdateTime=0,this.activeReplacements=[],this.footprints=[],this.footprintsVertices=new zf,this.footprintsIndices=new og,this.footprintsMin=new sr(1/0,1/0),this.footprintsMax=new sr(-1/0,-1/0),this.featuresOnBorder=[],this.buildingWithoutFacade=new Qoe(!1),this.buildingWithFacade=new Qoe(!0),this.indexArrayForConflationUploaded=!1,this.featureFootprintLookup=new Map,this.buildingIds=new Set,this.footprintLookup={},this.zoom=c.zoom,this.canonical=c.canonical,this.layers=c.layers,this.layerIds=this.layers.map(h=>h.fqid),this.index=c.index,this.hasPattern=!1,this.worldview=c.worldview,this.lut=c.lut,this.programConfigurations=new Gh(c.layers,{zoom:c.zoom,lut:c.lut}),this.stateDependentLayerIds=this.layers.filter(h=>h.isStateDependent()).map(h=>h.id),this.projection=c.projection,this.groundEffect=new Loe(c),this.groundEffect.groundRadiusArray=new Rp,this.hasAppearances=null}updateFootprints(c,h){const g=new L6([],[],1),v={vertices:[],indices:new Uint32Array(0),grid:g,min:this.footprintsMin,max:this.footprintsMax,buildingIds:this.buildingIds};h.push({footprint:v,id:c})}updateAppearances(c,h,g,v){}prepare(){return function(){if($6!=null||b_e!=null)return null;if(JN!=null)return JN;const c=fetch(Es.BUILDING_GEN_URL);return JN=function(h){let g,v,N,C,L;function F(){g=new Uint8Array(L.buffer),v=new Int16Array(L.buffer),N=new Int32Array(L.buffer),C=new Float32Array(L.buffer)}function $(){throw new Error("Unexpected BuildingGen error.")}const K=()=>{},Z={a:{a:$,f:function(X){const re=g.length,ae=Math.max(X>>>0,Math.ceil(1.2*re)),me=Math.ceil((ae-re)/65536);try{return L.grow(me),F(),!0}catch{return!1}},g:$,b:K,c:K,d:K,e:K}};return(WebAssembly.instantiateStreaming?WebAssembly.instantiateStreaming(h,Z):h.then(X=>X.arrayBuffer()).then(X=>WebAssembly.instantiate(X,Z))).then(X=>{const re=X.instance.exports;return(0,re.g)(),L=re.f,F(),new EHe({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:N,heapF32:C})})}(c).then(h=>(JN=null,$6=h,$6)).catch(h=>{Wr("Could not load building-gen"),JN=null,b_e=h}),JN}()}populate(c,h,g,v){const N=IHe();if(!N)return;const C=Le(g);this.tileToMeter=C,this.brightness=h.brightness,N.setStyle({normalScale:[1,-1,C],tileToMeters:C}),N.setAOOptions(!1,.3),N.setMetricOptions(!1,16),N.setStructuralOptions(!0),N.setFacadeClassifierOptions(3);const L=new Map,F=new Map;let $=0;for(const{feature:Ne}of c){if(B_e[Ne.type]!=="LineString"){L.set(Ne.id,Ne.properties.source_id);continue}const Fe=this.layers[0]._featureFilter.needGeometry;if(Fe&&!this.layers[0]._featureFilter.filter(new oi(this.zoom),Ne,g))continue;const ze=Dt(Ne,Fe);if(!Fe&&!this.layers[0]._featureFilter.filter(new oi(this.zoom),ze,g))continue;const Xe=Fe?ze.geometry:St(Ne,g,v),gt=[];for(const Et of Xe)for(const Xt of Et)gt.push(Xt.x),gt.push(Xt.y);const ht={coordinates:gt,crossPerc:Ne.properties.cross_perc,distanceToRoad:Ne.properties.distance_to_road,entrances:Ne.properties.entrances,sourceId:0},bt=Ne.properties.source_id;let Ct=F.get(bt);Ct||(Ct=[],F.set(bt,Ct)),Ct.push(ht),++$}this.maxHeight=0;const K=new Array,Z=new Set,X=Ne=>{Ne!=null&&Z.add(Ne)},re=(Ne,Fe)=>{Ne!=null&&K.push({buildingId:Ne,footprintIndex:Fe})},ae=64*(c.length-$),me=ae/2;this.buildingWithFacade.reserve(ae,me,!0),this.buildingWithoutFacade.reserve(2*ae,2*me,!1),this.footprintsIndices.reserve(16*(c.length-$)),this.footprintsVertices.reserve(8*(c.length-$));for(const{feature:Ne,id:Fe,index:ze,sourceLayerIndex:Xe}of c){if(B_e[Ne.type]==="LineString")continue;const gt=this.layers[0]._featureFilter.needGeometry;if(gt&&!this.layers[0]._featureFilter.filter(new oi(this.zoom),Ne,g))continue;let ht=null;if(Ne.properties&&Ne.properties.hasOwnProperty("building_id")&&(ht=Ne.properties.building_id,Z.has(ht)))continue;const bt=Dt(Ne,gt);if(!gt&&!this.layers[0]._featureFilter.filter(new oi(this.zoom),bt,g))continue;const Ct=gt?bt.geometry:St(Ne,g,v),Et=cM(Ct,500);let Xt=!1;for(const Pn of Et)if(Pn.length!==1){Xt=!0;break}if(Xt){X(ht);continue}if(!aWe(Ct,163)){X(ht);continue}const Rt=this.layers[0],rr=iWe(Rt.layout.get("building-roof-shape").evaluate(Ne,{},g)),lr=Rt.layout.get("building-base").evaluate(Ne,{},g),cr=Rt.layout.get("building-height").evaluate(Ne,{},g),yr=Rt.layout.get("building-flood-light-ground-radius").evaluate(Ne,{},g),_r=Rt.paint.get("building-ambient-occlusion-intensity"),fr=yr/this.tileToMeter;Ne.properties["building-part"]="roof";const gr=Rt.paint.get("building-color").evaluate(Ne,{},this.canonical).toPremultipliedRenderColor(this.lut),tr=Rt.paint.get("building-emissive-strength").evaluate(Ne,{},this.canonical);Ne.properties["building-part"]="wall";const Qt=Rt.paint.get("building-color").evaluate(Ne,{},this.canonical).toPremultipliedRenderColor(this.lut),xr=Rt.paint.get("building-emissive-strength").evaluate(Ne,{},this.canonical);Ne.properties["building-part"]="window";const Tr=Rt.paint.get("building-color").evaluate(Ne,{},this.canonical).toPremultipliedRenderColor(this.lut),jr=Rt.paint.get("building-emissive-strength").evaluate(Ne,{},this.canonical);Ne.properties["building-part"]="door";const xn=Rt.paint.get("building-color").evaluate(Ne,{},this.canonical).toPremultipliedRenderColor(this.lut),Vr=Rt.paint.get("building-emissive-strength").evaluate(Ne,{},this.canonical);let Qr=Rt.layout.get("building-flood-light-wall-radius").evaluate(Ne,{},g);Qr=xe(Qr,0,2048);const an=Qr/2048*Z6,bs=L.get(Fe),kr=F.get(bs)||[],ln=kr.length!==0&&Rt.layout.get("building-facade").evaluate(Ne,{},g);N.setFacadeOptions(4,!0),N.setFauxFacadeOptions(ln,!1,1);let Wn=0,qs=0,Xs=0,ls=0,Wa=0,ft=0,xt=0,nr=0,vr=0,zr=0,Br=0;if(ln){let Pn=Math.round(Rt.layout.get("building-facade-floors").evaluate(Ne,{},g));if(lr===0){Pn=Math.max(1,Pn-(kr.length>0?1:0));let Ra=4;if(cr>100){const ki=[10,13,15];Ra=ki[Ne.id?Ne.id%ki.length:0]}else cr<=10&&(Ra=3);N.setFacadeOptions(Ra,!0),Wa=(cr<15?1.3:1.61803)*Ra/C}else Wa=lr/C;ft=cr/C,Wa=Math.min(Wa,ft),Xs=Rt.layout.get("building-facade-unit-width").evaluate(Ne,{},g)/C,ls=(ft-Wa)/Pn,N.setFauxFacadeOptions(!0,!0,Xs);const Hi=Rt.layout.get("building-facade-window").evaluate(Ne,{},g);Wn=Hi[0],qs=Hi[1],xt=Math.floor(65535*Math.min(1,Wa/Cr)),nr=Math.floor(65535*Math.min(1,ft/Cr)),vr=Math.floor(255*Wn)<<8|Math.floor(255*qs),zr=Math.floor(65535*Math.min(1,Xs/Cr)),Br=Math.floor(65535*Math.min(1,ls/Cr))}const vn=Array(Et.length),wn={x:1/0,y:1/0},ss={x:-1/0,y:-1/0},ms={x:0,y:0};let vs=0;for(let Pn=0;Pn0){const Ra=[],ki=Array(Hi.length+1);ki[0]=0;for(let tl=0;tlCr||wn.y<0||ss.y>Cr)&&this.featuresOnBorder.push({featureId:Ne.id,footprintIndex:this.footprints.length});{const Pn=KN(Za,null,2);this.footprintsIndices.resize(this.footprintsIndices.length+Pn.length),this.footprintsIndices.uint16.set(Pn,In),this.buildingIds.add(ht??Ne.id),this.footprintsMin.x=Math.min(this.footprintsMin.x,si.x),this.footprintsMin.y=Math.min(this.footprintsMin.y,si.y),this.footprintsMax.x=Math.max(this.footprintsMax.x,li.x),this.footprintsMax.y=Math.max(this.footprintsMax.y,li.y);const Hi={footprintVertexOffset:Fs,footprintVertexLength:this.footprintsVertices.length-Fs,footprintIndexOffset:In,footprintIndexLength:this.footprintsIndices.length-In,min:si,max:li,hiddenFlags:0,indicesOffset:Ta,indicesLength:Ri,bloomIndicesOffset:Da,bloomIndicesLength:Ja,groundEffectVertexOffset:yo,groundEffectVertexLength:ai,hasFauxFacade:ln,height:gs,promoteId:Fe,feature:bt,parts:pa,buildingBloom:ma},Ra=this.footprints.length;Ne.id!==void 0&&this.featureFootprintLookup.set(Ne.id,Ra),re(ht,Ra),this.footprints.push(Hi)}this.programConfigurations.populatePaintArrays(Ln.layoutVertexArray.length,Ne,ze,{},h.availableImages,g,h.brightness),this.groundEffect.addPaintPropertiesData(Ne,ze,{},h.availableImages,g,h.brightness),h.featureIndex.insert(Ne,Ct,ze,Xe,this.index,Ga)}K.forEach(({buildingId:Ne,footprintIndex:Fe})=>{Z.has(Ne)&&(this.footprints[Fe].hiddenFlags|=4)});const Se=new Set;this.buildingIds.forEach((Ne,Fe,ze)=>{Z.has(Ne)||Se.add(Ne)}),this.buildingIds=Se,this.groundEffect.prepareBorderSegments()}update(c,h,g,v,N,C,L){this.programConfigurations.updatePaintArrays(c,h,N,g,v,C,L),this.groundEffect.update(c,h,N,g,v,C,L),this.evaluate(this.layers[0],c),this.colorBufferUploaded=!1}isEmpty(){return this.buildingWithoutFacade.layoutVertexArray.length===0&&this.buildingWithFacade.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload||this.groundEffect.programConfigurations.needsUpload}upload(c){const h=g=>{g.layoutVertexBuffer=c.createVertexBuffer(g.layoutVertexArray,F_e.members),g.layoutNormalBuffer=c.createVertexBuffer(g.layoutNormalArray,QHe.members),g.layoutCentroidBuffer=c.createVertexBuffer(g.layoutCentroidArray,JHe.members),g.layoutFloodLightDataBuffer=c.createVertexBuffer(g.layoutFloodLightDataArray,sWe.members),g.layoutFacadeDataArray&&g.layoutFacadeDataArray.length&&(g.layoutFacadeDataBuffer=c.createVertexBuffer(g.layoutFacadeDataArray,tWe.members)),g.layoutFacadeVerticalRangeArray&&g.layoutFacadeVerticalRangeArray.length&&(g.layoutFacadeVerticalRangeBuffer=c.createVertexBuffer(g.layoutFacadeVerticalRangeArray,rWe.members)),g.entranceBloom.layoutVertexArray.length&&(g.entranceBloom.layoutVertexBuffer=c.createVertexBuffer(g.entranceBloom.layoutVertexArray,F_e.members),g.entranceBloom.layoutAttenuationBuffer=c.createVertexBuffer(g.entranceBloom.layoutAttenuationArray,nWe.members)),this.uploadUpdatedColorBuffer(c),this.uploadUpdatedIndexBuffer(c)};this.uploaded||(h(this.buildingWithoutFacade),h(this.buildingWithFacade),this.groundEffect.upload(c)),this.groundEffect.uploadPaintProperties(c),this.programConfigurations.upload(c),this.uploaded=!0}destroy(){const c=h=>{h.layoutVertexBuffer&&(h.layoutVertexBuffer.destroy(),h.layoutNormalBuffer.destroy(),h.layoutColorBuffer.destroy(),h.segmentsBucket.destroy(),h.indexBuffer&&h.indexBuffer.destroy(),h.entranceBloom.layoutVertexBuffer&&(h.entranceBloom.layoutVertexBuffer.destroy(),h.entranceBloom.layoutColorBuffer.destroy(),h.entranceBloom.layoutAttenuationBuffer.destroy(),h.entranceBloom.indexBuffer.destroy(),h.entranceBloom.segmentsBucket.destroy()))};c(this.buildingWithoutFacade),c(this.buildingWithFacade),this.groundEffect.destroy(),this.programConfigurations.destroy()}updateFootprintHiddenFlags(c,h,g=!0){let v=!1;const N=g?h:0,C=0|(g?-1:~h);this.groundEffect.hiddenByLandmarkVertexArray.length===0&&this.groundEffect.hiddenByLandmarkVertexArray.resize(this.groundEffect.vertexArray.length);for(const L of c){const F=this.footprints[L],$=F.hiddenFlags&C|N;F.hiddenFlags!==$&&(F.hiddenFlags=$,v=!0,this.groundEffect.updateHiddenByLandmarkRange(F.groundEffectVertexOffset,F.groundEffectVertexLength,F.hiddenFlags!==0))}return v&&(this.indexArrayForConflationUploaded=!1),v}uploadUpdatedIndexBuffer(c){if(this.groundEffect.uploadHiddenByLandmark(c),this.indexArrayForConflationUploaded)return;const h=v=>{v.indexArray.length!==0&&(v.indexArrayForConflation.resize(v.indexArray.length),v.indexArrayForConflation.uint16.set(v.indexArray.uint16),v.entranceBloom.indexArrayForConflation.resize(v.entranceBloom.indexArray.length),v.entranceBloom.indexArrayForConflation.uint16.set(v.entranceBloom.indexArray.uint16))};h(this.buildingWithoutFacade),h(this.buildingWithFacade);for(const v of this.footprints){const N=v.hasFauxFacade?this.buildingWithFacade:this.buildingWithoutFacade,C=v.indicesOffset+v.indicesLength;if(v.hiddenFlags!==0){for(let F=v.indicesOffset;F{v.indexArray.length!==0&&(v.indexBuffer?v.indexBuffer.updateData(v.indexArrayForConflation):v.indexBuffer=c.createIndexBuffer(v.indexArrayForConflation,!0),v.entranceBloom.indexBuffer?v.entranceBloom.indexBuffer.updateData(v.entranceBloom.indexArrayForConflation):v.entranceBloom.indexBuffer=c.createIndexBuffer(v.entranceBloom.indexArrayForConflation,!0))};g(this.buildingWithoutFacade),g(this.buildingWithFacade),this.indexArrayForConflationUploaded=!0}uploadUpdatedColorBuffer(c){const h=g=>{g.layoutColorBuffer?g.layoutColorBuffer.updateData(g.layoutColorArray):g.layoutColorBuffer=c.createVertexBuffer(g.layoutColorArray,z_e.members,!0),g.layoutFacadePaintArray&&(g.layoutFacadePaintBuffer?g.layoutFacadePaintBuffer.updateData(g.layoutFacadePaintArray):g.layoutFacadePaintBuffer=c.createVertexBuffer(g.layoutFacadePaintArray,eWe.members,!0)),g.entranceBloom.layoutColorBuffer?g.entranceBloom.layoutColorBuffer.updateData(g.entranceBloom.layoutColorArray):g.entranceBloom.layoutColorBuffer=c.createVertexBuffer(g.entranceBloom.layoutColorArray,z_e.members,!0)};h(this.buildingWithoutFacade),h(this.buildingWithFacade),this.colorBufferUploaded=!0}evaluate(c,h){const g=c.paint.get("building-ambient-occlusion-intensity");for(const v of this.footprints){if(4&v.hiddenFlags)continue;const N=h[v.promoteId],C=v.feature;C.properties["building-part"]="roof";const L=c.paint.get("building-color").evaluate(C,N,this.canonical).toPremultipliedRenderColor(this.lut),F=c.paint.get("building-emissive-strength").evaluate(C,N,this.canonical);C.properties["building-part"]="wall";const $=c.paint.get("building-color").evaluate(C,N,this.canonical).toPremultipliedRenderColor(this.lut),K=c.paint.get("building-emissive-strength").evaluate(C,N,this.canonical);C.properties["building-part"]="window";const Z=c.paint.get("building-color").evaluate(C,N,this.canonical).toPremultipliedRenderColor(this.lut),X=c.paint.get("building-emissive-strength").evaluate(C,N,this.canonical);C.properties["building-part"]="door";const re=c.paint.get("building-color").evaluate(C,N,this.canonical).toPremultipliedRenderColor(this.lut),ae=c.paint.get("building-emissive-strength").evaluate(C,N,this.canonical),me=v.hasFauxFacade?this.buildingWithFacade:this.buildingWithoutFacade;for(const Ne of v.parts){let Fe,ze=L;Ne.part===1?(ze=L,Fe=F):Ne.part===0?(ze=$,Fe=K):Ne.part===2?(ze=Z,Fe=X):Ne.part===3&&(ze=re,Fe=ae),Fe=xe(Fe,0,1);for(let Xe=0;XeC.max.x||F.max.xC.max.y||F.max.yL.max.x||L.min.x>c||h>L.max.y||L.min.y>h||L.height<=g||oWe(C,this.footprintsVertices.float32.subarray(2*L.footprintVertexOffset,2*(L.footprintVertexOffset+L.footprintVertexLength)),this.footprintsIndices.uint16.subarray(L.footprintIndexOffset,L.footprintIndexOffset+L.footprintIndexLength))&&(g=L.height,this.footprintLookup[N]=L,v=L.hiddenFlags!==0);if(g!==Number.NEGATIVE_INFINITY)return{height:g,hidden:v};this.footprintLookup[N]=void 0}}function oWe(f,c,h){for(let g=0;g1&&(F=c[++L]);const K=Math.abs($-F.left),Z=Math.abs($-F.right),X=Math.min(K,Z);let re;const ae=N/g*(v+1);if(F.isDash){const me=v-Math.abs(ae);re=Math.sqrt(X*X+me*me)}else re=v-Math.sqrt(X*X+ae*ae);this.image.data[C+$]=Math.max(0,Math.min(255,re+128))}}}addRegularDash(c,h){for(let F=c.length-1;F>=0;--F){const $=c[F],K=c[F+1];$.zeroLength?c.splice(F,1):K&&K.isDash===$.isDash&&(K.left=$.left,c.splice(F,1))}const g=c[0],v=c[c.length-1];g.isDash===v.isDash&&(g.left=v.left-this.width,v.right=g.right+this.width);const N=this.width*this.nextRow;let C=0,L=c[C];for(let F=0;F1&&(L=c[++C]);const $=Math.abs(F-L.left),K=Math.abs(F-L.right),Z=Math.min($,K);this.image.data[N+F]=Math.max(0,Math.min(255,(L.isDash?Z:-Z)+h+128))}}addDash(c,h){const g=this.getKey(c,h);if(this.positions[g])return this.positions[g];const v=h==="round",N=v?7:0,C=2*N+1;if(this.nextRow+C>this.height)return Wr("LineAtlas out of space"),null;c.length===0&&c.push(1);let L=0;for(let K=0;Kh.fqid),this.index=c.index,this.projection=c.projection,this.hasPattern=!1,this.hasCrossSlope=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(h=>{this.gradients[h.id]={}}),this.layoutVertexArray=new TN,this.layoutVertexArray2=new Lu,this.patternVertexArray=new Lu,this.indexArray=new Qo,this.programConfigurations=new Gh(c.layers,{zoom:c.zoom,lut:c.lut}),this.segments=new Ui,this.maxLineLength=0,this.zOffsetVertexArray=new Lu,this.stateDependentLayerIds=this.layers.filter(h=>h.isStateDependent()).map(h=>h.id),this.tessellationStep=c.tessellationStep?c.tessellationStep:Cr/64,this.worldview=c.worldview,this.hasAppearances=null}updateFootprints(c,h){}updateAppearances(c,h,g,v){}populate(c,h,g,v){this.hasPattern=Noe("line",this.layers,this.pixelRatio,h);const N=this.layers[0].layout.get("line-sort-key");this.tileToMeter=Le(g);const C=this.layers[0].layout.get("line-elevation-reference");if(C==="hd-road-markup")this.elevationType="road";else{const X=this.layers[0].layout.get("line-z-offset"),re=X.isConstant()&&!X.constantOr(0);this.elevationType=C!=="sea"&&C!=="ground"&&re?"none":"offset",this.elevationType==="offset"&&C==="none"&&Wr(`line-elevation-reference: ground is used for the layer ${this.layerIds[0]} because non-zero line-z-offset value was found.`)}const L=this.layers[0].layout.get("line-cross-slope");this.hasCrossSlope=this.elevationType==="offset"&&L!==void 0;const F=[];for(const{feature:X,id:re,index:ae,sourceLayerIndex:me}of c){const Se=this.layers[0]._featureFilter.needGeometry,Ne=Dt(X,Se);if(!this.layers[0]._featureFilter.filter(new oi(this.zoom,{worldview:this.worldview,activeFloors:h.activeFloors}),Ne,g))continue;const Fe=N?N.evaluate(Ne,{},g):void 0,ze={id:re,properties:X.properties,type:X.type,sourceLayerIndex:me,index:ae,geometry:Se?Ne.geometry:St(X,g,v),patterns:{},sortKey:Fe};F.push(ze)}N&&F.sort((X,re)=>X.sortKey-re.sortKey);const{lineAtlas:$,featureIndex:K}=h,Z=this.addConstantDashes($);for(const X of F){const{geometry:re,index:ae,sourceLayerIndex:me}=X;if(Z&&this.addFeatureDashes(X,$),this.hasPattern){const Se=Soe("line",this.layers,X,this.zoom,this.pixelRatio,h);this.patternFeatures.push(Se)}else this.addFeature(X,re,ae,g,$.positions,h.availableImages,h.brightness,h.elevationFeatures);K.insert(c[ae].feature,re,ae,me,this.index)}}addConstantDashes(c){let h=!1;for(const g of this.layers){const v=g.paint.get("line-dasharray").value,N=g.layout.get("line-cap").value;if(v.kind!=="constant"||N.kind!=="constant")h=!0;else{const C=N.value,L=v.value;if(!L)continue;c.addDash(L,C)}}return h}addFeatureDashes(c,h){const g=this.zoom;for(const v of this.layers){const N=v.paint.get("line-dasharray").value,C=v.layout.get("line-cap").value;if(N.kind==="constant"&&C.kind==="constant")continue;let L,F;if(N.kind==="constant"){if(L=N.value,!L)continue}else L=N.evaluate({zoom:g},c);F=C.kind==="constant"?C.value:C.evaluate({zoom:g},c),h.addDash(L,F),c.patterns[v.id]=[h.getKey(L,F)]}}update(c,h,g,v,N,C,L,F){this.programConfigurations.updatePaintArrays(c,h,N,g,v,C,L,F)}addFeatures(c,h,g,v,N,C){for(const L of this.patternFeatures)this.addFeature(L,L.geometry,L.index,h,g,v,C,c.elevationFeatures)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(c){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=c.createVertexBuffer(this.layoutVertexArray2,fWe)),this.patternVertexArray.length!==0&&(this.patternVertexBuffer=c.createVertexBuffer(this.patternVertexArray,mWe)),!this.zOffsetVertexBuffer&&this.zOffsetVertexArray.length>0&&(this.zOffsetVertexBuffer=c.createVertexBuffer(this.zOffsetVertexArray,dWe.members,!0)),this.layoutVertexBuffer=c.createVertexBuffer(this.layoutVertexArray,uWe),this.indexBuffer=c.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(c),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.zOffsetVertexBuffer&&this.zOffsetVertexBuffer.destroy(),this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(c,h){let g,v;if(h&&h>0?(g=`mapbox_clip_start_${h}`,v=`mapbox_clip_end_${h}`):(g="mapbox_clip_start",v="mapbox_clip_end"),c.properties&&c.properties.hasOwnProperty(g)&&c.properties.hasOwnProperty(v))return{start:+c.properties[g],end:+c.properties[v]}}addFeature(c,h,g,v,N,C,L,F){const $=this.layers[0].layout,K=$.get("line-join").evaluate(c,{}),Z=$.get("line-cap").evaluate(c,{}),X=$.get("line-miter-limit"),re=$.get("line-round-limit");this.lineClips=this.lineFeatureClips(c),this.lineFeature=c;const ae=!(!c.properties||!c.properties.hasOwnProperty("mapbox_line_metrics"))&&c.properties.mapbox_line_metrics;this.zOffsetValue=$.get("line-z-offset").value;const me=this.layers[0].paint.get("line-width").value;if(me.kind!=="constant"&&me.isLineProgressConstant===!1&&(this.variableWidthValue=me),this.elevationType==="road"){const Se=this.layoutVertexArray.length;if(!this.addElevatedRoadFeature(c,h,v,F,K,Z,X,re)){const[Ne,Fe]=this.clipRuntimeLinesToTile(h,1);for(let ze=0;ze0?gt.parentIndex:null)}this.fillNonElevatedRoadSegment(Se)}}else for(let Se=0;Se0?Se:null);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,c,g,N,C,v,L,void 0,this.worldview)}computeSegNextDir(c,h){return c.nextPoint.sub(h.at(-2)).unit()}computeSegPrevDir(c,h){return h[1].sub(c.prevPoint).unit()}clipLinesToTile(c,h){return z6(c,-h,-h,Cr+h,Cr+h)}clipRuntimeLinesToTile(c,h){const g=[];return[z6(c,-h,-h,Cr+h,Cr+h,g),g]}addElevatedRoadFeature(c,h,g,v,N,C,L,F){const $=[],K=Ca.getElevationFeature(c,v);if(K){const Z=this.clipLinesToTile(h,1),X=this.prepareElevatedLines(Z,K,g);for(const re of X)$.push({geometry:re,elevation:K,elevationTileID:g,segment:{progress:{min:0,max:1},nextDir:void 0,prevDir:void 0}})}if($.length===0)return!1;for(const Z of $){const X=this.layoutVertexArray.length;this.addLine(Z.geometry,c,g,N,C,L,F);const re=new qa(g,Z.elevationTileID);if(Z.elevation)for(let ae=X;ae>1,this.layoutVertexArray.int16[6*ae+1]>>1),Se=re.pointElevation(me,Z.elevation,.05);this.updateHeightRange(Se),this.zOffsetVertexArray.emplaceBack(Se,0,0)}else this.fillNonElevatedRoadSegment(X)}return!0}prepareElevatedLines(c,h,g){if(h.constantHeight!=null)return c;const v=[],N=1/Le(g);for(const C of c)MHe(C,new fa(h,N),0,v);return v}fillNonElevatedRoadSegment(c){for(let h=c;h0,X=F&&F.progress.max<1;if(this.lineClips){let Et={min:this.lineClips.start,max:this.lineClips.end},Xt=1;if(F){const lr=this.lineClips.end-this.lineClips.start;Et=function(cr,yr,_r){return{min:Ha(cr.min,yr,_r),max:Ha(cr.max,yr,_r)}}(F.progress,{min:0,max:1},Et),lr>0&&(Xt=(Et.max-Et.min)/lr)}const Rt=+h.properties.mapbox_clip_feature_len,rr=+h.properties.mapbox_clip_seg_len;if(Number.isNaN(Rt)||Number.isNaN(rr)){for(let cr=0;cr=2&&c[ae-1].equals(c[ae-2]);)ae--;let me=0;for(;me0,tr=this.overscaling<=16?15*Cr/(512*this.overscaling):0;if(Xt&&Rt==="round"){if(yrC&&(Rt="bevel"),Rt==="bevel"&&(yr>2&&(Rt="flipbevel"),yr2*tr){const Tr=Ne.sub(Ne.sub(Fe)._mult(tr/Qt)._round());this.updateDistance(Fe,Tr),this.addCurrentVertex(Tr,Xe,0,0,Se,Ct),Fe=Tr}this.updateDistance(Fe,Ne),lr._mult(yr),this.addCurrentVertex(Ne,lr,0,0,Se,Ct);const xr=Ne.dist(ze);if(xr>2*tr){const Tr=Ne.add(ze.sub(Ne)._mult(tr/xr)._round());this.updateDistance(Ne,Tr),this.addCurrentVertex(Tr,gt,0,0,Se,Ct),Ne=Tr}}else lr._mult(yr),this.addCurrentVertex(Ne,lr,0,0,Se,Ct);else if(Rt==="flipbevel"){if(yr>100)lr=gt.mult(-1);else{const Qt=yr*Xe.add(gt).mag()/Xe.sub(gt).mag();lr._perp()._mult(Qt*(gr?-1:1))}this.addCurrentVertex(Ne,lr,0,0,Se,Ct),this.addCurrentVertex(Ne,lr.mult(-1),0,0,Se,Ct)}else if(Rt==="bevel"||Rt==="fakeround"){Ct!=null&&Fe&&this.addCurrentVertex(Ne,bt||Xe,-1,-1,Se,Ct);const Qt=Ne.dist(Fe)<=2*tr&&Rt!=="bevel",xr=lr.mult(gr?1:-1);xr._mult(yr);const Tr=gt.mult(gr?-1:1),jr=Xe.mult(gr?-1:1),xn=this.evaluateLineProgressFeatures(this.distance);if(Ct==null&&(this.addHalfVertex(Ne,xr.x,xr.y,!1,!gr,0,Se,xn),Qt||this.addHalfVertex(Ne,xr.x+2*jr.x,xr.y+2*jr.y,!1,gr,0,Se,xn)),Rt==="fakeround"){const Vr=Math.round(180*_r/Math.PI/20);this.addHalfVertex(Ne,jr.x,jr.y,!1,gr,0,Se,xn);for(let Qr=0;Qr1){this.lineSoFar=c.w;const me=(h.x-c.x)/Z,Se=(h.y-c.y)/Z,Ne=(h.z-c.z)/Z,Fe=(h.w-c.w)/Z;for(let ze=1;ze=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,this.e2,K),F.primitiveLength++),C?this.e2=K:this.e1=K,$!=null&&this.zOffsetVertexArray.emplaceBack($.zOffset,$.variableWidth,$.variableWidth)}updateScaledDistance(){this.lineClips?(this.scaledDistance=this.distance/this.totalDistance,this.lineSoFar=this.totalFeatureLength*this.lineClips.start+this.distance):this.lineSoFar=this.distance}updateDistance(c,h){this.prevDistance=this.distance,this.distance+=c.dist(h),this.updateScaledDistance()}}function ele(f,c,h){return f.xh||f.yh}let H_e,W_e;function G_e(f,c,h){return c*(Cr/(f.tileSize*Math.pow(2,h-f.tileID.overscaledZ)))}en(Joe,"LineBucket",{omit:["layers","patternFeatures","currentVertex","currentVertexIsOutside"]});const K_e=(f,c,h)=>(1-h)*f+h*c;function Z_e(f,c){return 1/G_e(f,1,c.tileZoom)}function Y_e(f,c,h,g){return f.translatePosMatrix(g||c.tileID.projMatrix,c,h.paint.get("line-translate"),h.paint.get("line-translate-anchor"))}const X_e=f=>{const c=[];Q_e(f)&&c.push("RENDER_LINE_DASH"),f.paint.get("line-gradient")&&c.push("RENDER_LINE_GRADIENT");const h=f.paint.get("line-trim-offset");h[0]===0&&h[1]===0||c.push("RENDER_LINE_TRIM_OFFSET"),f.paint.get("line-border-width").constantOr(1)!==0&&c.push("RENDER_LINE_BORDER");const g=f.layout.get("line-join").constantOr("miter")==="none",v=!!f.paint.get("line-pattern").constantOr(1);return g&&v&&c.push("LINE_JOIN_NONE"),c};function Q_e(f){const c=f.paint.get("line-dasharray").value;return c.kind!=="constant"||c.value}let tle;const J_e=()=>tle||(tle={layout:H_e||(H_e=new Ji({"line-cap":new Pr(Ft.layout_line["line-cap"]),"line-join":new Pr(Ft.layout_line["line-join"]),"line-miter-limit":new Nr(Ft.layout_line["line-miter-limit"]),"line-round-limit":new Nr(Ft.layout_line["line-round-limit"]),"line-sort-key":new Pr(Ft.layout_line["line-sort-key"]),"line-z-offset":new Pr(Ft.layout_line["line-z-offset"]),"line-elevation-reference":new Nr(Ft.layout_line["line-elevation-reference"]),"line-cross-slope":new Nr(Ft.layout_line["line-cross-slope"]),visibility:new Nr(Ft.layout_line.visibility),"line-width-unit":new Nr(Ft.layout_line["line-width-unit"])})),paint:W_e||(W_e=new Ji({"line-opacity":new Pr(Ft.paint_line["line-opacity"]),"line-color":new Pr(Ft.paint_line["line-color"]),"line-translate":new Nr(Ft.paint_line["line-translate"]),"line-translate-anchor":new Nr(Ft.paint_line["line-translate-anchor"]),"line-width":new Pr(Ft.paint_line["line-width"]),"line-gap-width":new Pr(Ft.paint_line["line-gap-width"]),"line-offset":new Pr(Ft.paint_line["line-offset"]),"line-blur":new Pr(Ft.paint_line["line-blur"]),"line-dasharray":new Pr(Ft.paint_line["line-dasharray"]),"line-pattern":new Pr(Ft.paint_line["line-pattern"]),"line-pattern-cross-fade":new Nr(Ft.paint_line["line-pattern-cross-fade"]),"line-gradient":new _x(Ft.paint_line["line-gradient"]),"line-trim-offset":new Nr(Ft.paint_line["line-trim-offset"]),"line-trim-fade-range":new Nr(Ft.paint_line["line-trim-fade-range"]),"line-trim-color":new Nr(Ft.paint_line["line-trim-color"]),"line-emissive-strength":new Pr(Ft.paint_line["line-emissive-strength"]),"line-border-width":new Pr(Ft.paint_line["line-border-width"]),"line-border-color":new Pr(Ft.paint_line["line-border-color"]),"line-occlusion-opacity":new Nr(Ft.paint_line["line-occlusion-opacity"]),"line-color-use-theme":new Pr({type:"string",default:"default","property-type":"data-driven"}),"line-gradient-use-theme":new Pr({type:"string",default:"default","property-type":"data-driven"}),"line-trim-color-use-theme":new Pr({type:"string",default:"default","property-type":"data-driven"}),"line-border-color-use-theme":new Pr({type:"string",default:"default","property-type":"data-driven"})}))},tle);class vWe extends Pr{possiblyEvaluate(c,h){return h=new oi(Math.floor(h.zoom),{now:h.now,fadeDuration:h.fadeDuration,transition:h.transition,worldview:h.worldview}),super.possiblyEvaluate(c,h)}evaluate(c,h,g,v){return h=Object.assign({},h,{zoom:Math.floor(h.zoom)}),super.evaluate(c,h,g,v)}}let bM;function ebe(f,c){return c>0?c+2*f:f}const _We=Ds([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_tex_size",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),bWe=Ds([{name:"a_globe_anchor",components:3,type:"Int16"},{name:"a_globe_normal",components:3,type:"Float32"}],4),wWe=Ds([{name:"a_projected_pos",components:4,type:"Float32"}],4);Ds([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const jWe=Ds([{name:"a_auto_z_offset",components:1,type:"Float32"}],4),kWe=Ds([{name:"a_x_axis",components:3,type:"Float32"},{name:"a_y_axis",components:3,type:"Float32"}]),NWe=Ds([{name:"a_texb",components:2,type:"Uint16"}]),SWe=Ds([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_elevation_from_sea",components:2,type:"Float32"}]),CWe=Ds([{name:"a_size_scale",components:1,type:"Float32"},{name:"a_padding",components:2,type:"Float32"},{name:"a_auto_z_offset",components:1,type:"Float32"}]);Ds([{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 tbe=Ds([{name:"a_pos",components:3,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),MWe=Ds([{name:"a_pos_2f",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);Ds([{name:"triangle",components:3,type:"Uint16"}]),Ds([{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"}]),Ds([{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"}]),Ds([{type:"Float32",name:"offsetX"}]),Ds([{type:"Int16",name:"x"},{type:"Int16",name:"y"}]);var wl=24;function TWe(f,c,h){return f.sections.forEach(g=>{g.text=function(v,N,C){const L=N.layout.get("text-transform").evaluate(C,{});return L==="uppercase"?v=v.toLocaleUpperCase():L==="lowercase"&&(v=v.toLocaleLowerCase()),Dp.applyArabicShaping&&(v=Dp.applyArabicShaping(v)),v}(g.text,c,h)}),f}const wM={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂","←":"↑","→":"↓"};function AWe(f){return f==="︶"||f==="﹈"||f==="︸"||f==="﹄"||f==="﹂"||f==="︾"||f==="︼"||f==="︺"||f==="︘"||f==="﹀"||f==="︐"||f==="︓"||f==="︔"||f==="`"||f===" ̄"||f==="︑"||f==="︒"}function EWe(f){return f==="︵"||f==="﹇"||f==="︷"||f==="﹃"||f==="﹁"||f==="︽"||f==="︻"||f==="︹"||f==="︗"||f==="︿"}const rle=4294967296,rbe=1/rle,nbe=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");let Y6=class{constructor(f=new Uint8Array(16)){this.buf=ArrayBuffer.isView(f)?f:new Uint8Array(f),this.dataView=new DataView(this.buf.buffer),this.pos=0,this.type=0,this.length=this.buf.length}readFields(f,c,h=this.length){for(;this.pos>3,N=this.pos;this.type=7&g,f(v,c,this),this.pos===N&&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)*rle;return this.pos+=8,f}readSFixed64(){const f=this.dataView.getUint32(this.pos,!0)+this.dataView.getInt32(this.pos+4,!0)*rle;return this.pos+=8,f}readFloat(){const f=this.dataView.getFloat32(this.pos,!0);return this.pos+=4,f}readDouble(){const f=this.dataView.getFloat64(this.pos,!0);return this.pos+=8,f}readVarint(f){const c=this.buf;let h,g;return g=c[this.pos++],h=127&g,g<128?h:(g=c[this.pos++],h|=(127&g)<<7,g<128?h:(g=c[this.pos++],h|=(127&g)<<14,g<128?h:(g=c[this.pos++],h|=(127&g)<<21,g<128?h:(g=c[this.pos],h|=(15&g)<<28,function(v,N,C){const L=C.buf;let F,$;if($=L[C.pos++],F=(112&$)>>4,$<128||($=L[C.pos++],F|=(127&$)<<3,$<128)||($=L[C.pos++],F|=(127&$)<<10,$<128)||($=L[C.pos++],F|=(127&$)<<17,$<128)||($=L[C.pos++],F|=(127&$)<<24,$<128)||($=L[C.pos++],F|=(1&$)<<31,$<128))return t4(v,F,N);throw new Error("Expected varint not more than 10 bytes")}(h,f,this)))))}readVarint64(){return this.readVarint(!0)}readSVarint(){const f=this.readVarint();return f%2==1?(f+1)/-2:f/2}readBoolean(){return!!this.readVarint()}readString(){const f=this.readVarint()+this.pos,c=this.pos;return this.pos=f,f-c>=12&&nbe?nbe.decode(this.buf.subarray(c,f)):function(h,g,v){let N="",C=g;for(;C239?4:L>223?3:L>191?2:1;if(C+X>v)break;X===1?L<128&&(Z=L):X===2?(F=h[C+1],(192&F)==128&&(Z=(31&L)<<6|63&F,Z<=127&&(Z=null))):X===3?(F=h[C+1],$=h[C+2],(192&F)==128&&(192&$)==128&&(Z=(15&L)<<12|(63&F)<<6|63&$,(Z<=2047||Z>=55296&&Z<=57343)&&(Z=null))):X===4&&(F=h[C+1],$=h[C+2],K=h[C+3],(192&F)==128&&(192&$)==128&&(192&K)==128&&(Z=(15&L)<<18|(63&F)<<12|(63&$)<<6|63&K,(Z<=65535||Z>=1114112)&&(Z=null))),Z===null?(Z=65533,X=1):Z>65535&&(Z-=65536,N+=String.fromCharCode(Z>>>10&1023|55296),Z=56320|1023&Z),N+=String.fromCharCode(Z),C+=X}return N}(this.buf,c,f)}readBytes(){const f=this.readVarint()+this.pos,c=this.buf.subarray(this.pos,f);return this.pos=f,c}readPackedVarint(f=[],c){const h=this.readPackedEnd();for(;this.pos127;);else if(c===2)this.pos=this.readVarint()+this.pos;else if(c===5)this.pos+=4;else{if(c!==1)throw new Error(`Unimplemented type: ${c}`);this.pos+=8}}writeTag(f,c){this.writeVarint(f<<3|c)}realloc(f){let c=this.length||16;for(;c268435455||f<0?function(c,h){let g,v;if(c>=0?(g=c%4294967296|0,v=c/4294967296|0):(g=~(-c%4294967296),v=~(-c/4294967296),4294967295^g?g=g+1|0:(g=0,v=v+1|0)),c>=18446744073709552e3||c<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");h.realloc(10),function(N,C,L){L.buf[L.pos++]=127&N|128,N>>>=7,L.buf[L.pos++]=127&N|128,N>>>=7,L.buf[L.pos++]=127&N|128,N>>>=7,L.buf[L.pos++]=127&N|128,L.buf[L.pos]=127&(N>>>=7)}(g,0,h),function(N,C){const L=(7&N)<<4;C.buf[C.pos++]|=L|((N>>>=3)?128:0),N&&(C.buf[C.pos++]=127&N|((N>>>=7)?128:0),N&&(C.buf[C.pos++]=127&N|((N>>>=7)?128:0),N&&(C.buf[C.pos++]=127&N|((N>>>=7)?128:0),N&&(C.buf[C.pos++]=127&N|((N>>>=7)?128:0),N&&(C.buf[C.pos++]=127&N)))))}(v,h)}(f,this):(this.realloc(4),this.buf[this.pos++]=127&f|(f>127?128:0),f<=127||(this.buf[this.pos++]=127&(f>>>=7)|(f>127?128:0),f<=127||(this.buf[this.pos++]=127&(f>>>=7)|(f>127?128:0),f<=127||(this.buf[this.pos++]=f>>>7&127))))}writeSVarint(f){this.writeVarint(f<0?2*-f-1:2*f)}writeBoolean(f){this.writeVarint(+f)}writeString(f){f=String(f),this.realloc(4*f.length),this.pos++;const c=this.pos;this.pos=function(g,v,N){for(let C,L,F=0;F55295&&C<57344){if(!L){C>56319||F+1===v.length?(g[N++]=239,g[N++]=191,g[N++]=189):L=C;continue}if(C<56320){g[N++]=239,g[N++]=191,g[N++]=189,L=C;continue}C=L-55296<<10|C-56320|65536,L=null}else L&&(g[N++]=239,g[N++]=191,g[N++]=189,L=null);C<128?g[N++]=C:(C<2048?g[N++]=C>>6|192:(C<65536?g[N++]=C>>12|224:(g[N++]=C>>18|240,g[N++]=C>>12&63|128),g[N++]=C>>6&63|128),g[N++]=63&C|128)}return N}(this.buf,f,this.pos);const h=this.pos-c;h>=128&&sbe(c,h,this),this.pos=c-1,this.writeVarint(h),this.pos+=h}writeFloat(f){this.realloc(4),this.dataView.setFloat32(this.pos,f,!0),this.pos+=4}writeDouble(f){this.realloc(8),this.dataView.setFloat64(this.pos,f,!0),this.pos+=8}writeBytes(f){const c=f.length;this.writeVarint(c),this.realloc(c);for(let h=0;h=128&&sbe(h,g,this),this.pos=h-1,this.writeVarint(g),this.pos+=g}writeMessage(f,c,h){this.writeTag(f,2),this.writeRawMessage(c,h)}writePackedVarint(f,c){c.length&&this.writeMessage(f,IWe,c)}writePackedSVarint(f,c){c.length&&this.writeMessage(f,PWe,c)}writePackedBoolean(f,c){c.length&&this.writeMessage(f,DWe,c)}writePackedFloat(f,c){c.length&&this.writeMessage(f,LWe,c)}writePackedDouble(f,c){c.length&&this.writeMessage(f,OWe,c)}writePackedFixed32(f,c){c.length&&this.writeMessage(f,RWe,c)}writePackedSFixed32(f,c){c.length&&this.writeMessage(f,FWe,c)}writePackedFixed64(f,c){c.length&&this.writeMessage(f,zWe,c)}writePackedSFixed64(f,c){c.length&&this.writeMessage(f,BWe,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 t4(f,c,h){return h?4294967296*c+(f>>>0):4294967296*(c>>>0)+(f>>>0)}function sbe(f,c,h){const g=c<=16383?1:c<=2097151?2:c<=268435455?3:Math.floor(Math.log(c)/(7*Math.LN2));h.realloc(g);for(let v=h.pos-1;v>=f;v--)h.buf[v+g]=h.buf[v]}function IWe(f,c){for(let h=0;h=0&&g>=c&&X6[this.text.charCodeAt(g)];g--)h--;this.text=this.text.substring(c,h),this.sectionIndex=this.sectionIndex.slice(c,h)}substring(c,h){const g=new r4;return g.text=this.text.substring(c,h),g.sectionIndex=this.sectionIndex.slice(c,h),g.sections=this.sections,g}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((c,h)=>Math.max(c,this.sections[h].scale),0)}addTextSection(c,h){this.text+=c.text,this.sections.push(jM.forText(c.scale,c.fontStack||h));const g=this.sections.length-1;for(let v=0;v=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function sle(f,c,h,g,v,N,C,L,F,$,K,Z,X,re,ae,me=1){const Se=r4.fromFeature(f,v,me);Z===Fu.vertical&&Se.verticalizePunctuation(X);let Ne=[];const Fe=function(bt,Ct,Et,Xt,Rt,rr){if(!bt)return[];const lr=[],cr=function(gr,tr,Qt,xr,Tr,jr){let xn=0;for(let Vr=0;Vr=0;let _r=0;for(let gr=0;gr0&&ma>ls&&(ls=ma)}else{const da=Et[vr.fontStack];if(!da)continue;da[Br]&&(ss=da[Br]);const pa=Ct[vr.fontStack];if(!pa)continue;const ma=pa.glyphs[Br];if(!ma)continue;if(wn=ma.metrics,vs=Br!==8203?wl:0,jr){const Da=pa.ascender!==void 0?Math.abs(pa.ascender):0,Ja=pa.descender!==void 0?Math.abs(pa.descender):0,Ga=(Da+Ja)*vn;Wa-h/2;){if(C--,C<0)return!1;L-=f[C].dist(N),N=f[C]}L+=f[C].dist(f[C+1]),C++;const F=[];let $=0;for(;Lg;)$-=F.shift().angleDelta;if($>v)return!1;C++,L+=K.dist(Z)}return!0}function mbe(f){let c=0;for(let h=0;h$){const ae=($-F)/re,me=zn(Z.x,X.x,ae),Se=zn(Z.y,X.y,ae),Ne=new Mx(me,Se,0,X.angleTo(Z),K);return!C||pbe(f,Ne,L,C,c)?Ne:void 0}F+=re}}function GWe(f,c,h,g,v,N,C,L,F){const $=gbe(g,N,C),K=xbe(g,v),Z=K*C,X=f[0].x===0||f[0].x===F||f[0].y===0||f[0].y===F;return c-Z=0&&Xe=0&>=0&&X+$<=K){const ht=new Mx(Xe,gt,0,Fe,ae);g&&!pbe(f,ht,N,g,v)||re.push(ht)}}Z+=Ne}return L||re.length||C||(re=ybe(f,Z/2,h,g,v,N,C,!0,F)),re}function vbe(f){let c=0,h=0;for(const C of f)c+=C.w*C.h,h=Math.max(h,C.w);f.sort((C,L)=>L.h-C.h);const g=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(c/.95)),h),h:1/0}];let v=0,N=0;for(const C of f)for(let L=g.length-1;L>=0;L--){const F=g[L];if(!(C.w>F.w||C.h>F.h)){if(C.x=F.x,C.y=F.y,N=Math.max(N,C.y+C.h),v=Math.max(v,C.x+C.w),C.w===F.w&&C.h===F.h){const $=g.pop();$&&L1?ae-1:ae,Lc.copy(Z.data,$,{x:0,y:0},{x:me,y:Se},Z.data,g),Lc.copy(Z.data,$,{x:0,y:Fe-ae},{x:me,y:Se-ae},{width:Ne,height:ae},g),Lc.copy(Z.data,$,{x:0,y:0},{x:me,y:Se+Fe},{width:Ne,height:ae},g),Lc.copy(Z.data,$,{x:Ne-ae,y:0},{x:me-ae,y:Se},{width:ae,height:Fe},g),Lc.copy(Z.data,$,{x:0,y:0},{x:me+Ne,y:Se},{width:ae,height:Fe},g),Lc.copy(Z.data,$,{x:Ne-ae,y:Fe-ae},{x:me-ae,y:Se-ae},{width:ae,height:ae},g),Lc.copy(Z.data,$,{x:0,y:Fe-ae},{x:me+Ne,y:Se-ae},{width:ae,height:ae},g),Lc.copy(Z.data,$,{x:0,y:0},{x:me+Ne,y:Se+Fe},{width:ae,height:ae},g),Lc.copy(Z.data,$,{x:Ne-ae,y:0},{x:me-ae,y:Se+Fe},{width:ae,height:ae},g)}this.lut=g,this.image=$,this.iconPositions=v,this.patternPositions=N}addImages(c,h,g,v){for(const[N,C]of c.entries()){const{bin:L,imagePosition:F,imageVariant:$}=cle(N,C,g);h.set(N,F),v.push(L),C.hasRenderCallback&&this.haveRenderCallbacks.push($.id)}}patchUpdatedImages(c,h,g){this.haveRenderCallbacks=this.haveRenderCallbacks.filter(v=>c.hasImage(v,g)),c.dispatchRenderCallbacks(this.haveRenderCallbacks,g);for(const v of c.getUpdatedImages(g)){for(const N of this.iconPositions.keys()){const C=Tp.parse(N);if(_a.isEqual(C.id,v)){const L=c.getImage(v,g);this.patchUpdatedImage(this.iconPositions.get(N),L,h,null)}}for(const N of this.patternPositions.keys()){const C=Tp.parse(N);if(_a.isEqual(C.id,v)){const L=c.getImage(v,g);this.patchUpdatedImage(this.patternPositions.get(N),L,h,this.lut)}}}}patchUpdatedImage(c,h,g,v=null){if(!c||!h||c.version===h.version)return;c.version=h.version;const[N,C]=c.tl,L=c.sdf;if(this.lut||L){const F={width:h.data.width,height:h.data.height},$=new Lc(F);Lc.copy(h.data,$,{x:0,y:0},{x:0,y:0},F,v,L),g.update($,{position:{x:N,y:C}})}else g.update(h.data,{position:{x:N,y:C}})}}en(kM,"ImagePosition"),en(_be,"ImageAtlas");const NM=1e20;function bbe(f,c,h,g,v,N,C,L,F){for(let $=c;$-1);F++,N[F]=L,C[F]=$,C[F+1]=NM}for(let L=0,F=0;L{let F=this.entries[N];F||(F=this.entries[N]={glyphs:{},requests:{},ranges:{},ascender:void 0,descender:void 0});let $=F.glyphs[C];if($!==void 0)return void L(null,{stack:N,id:C,glyph:$});if($=this._tinySDF(F,N,C),$)return F.glyphs[C]=$,void L(null,{stack:N,id:C,glyph:$});const K=Math.floor(C/256);if(256*K>65535)return Wr("glyphs > 65535 not supported"),void L(null,{stack:N,id:C,glyph:$});if(F.ranges[K])return void L(null,{stack:N,id:C,glyph:$});let Z=F.requests[K];Z||(Z=F.requests[K]=[],a4.loadGlyphRange(N,K,v,this.requestManager,(X,re)=>{if(re){F.ascender=re.ascender,F.descender=re.descender;for(const ae in re.glyphs)this._doesCharSupportLocalGlyph(+ae)||(F.glyphs[+ae]=re.glyphs[+ae]);F.ranges[K]=!0}for(const ae of Z)ae(X,re);delete F.requests[K]})),Z.push((X,re)=>{X?L(X):re&&L(null,{stack:N,id:C,glyph:re.glyphs[C]||null})})},(N,C)=>{if(N)h(N);else if(C){const L={};for(const{stack:F,id:$,glyph:K}of C)L[F]===void 0&&(L[F]={}),L[F].glyphs===void 0&&(L[F].glyphs={}),L[F].glyphs[$]=K&&{id:K.id,bitmap:K.bitmap.clone(),metrics:K.metrics},L[F].ascender=this.entries[F].ascender,L[F].descender=this.entries[F].descender;h(null,L)}})}_doesCharSupportLocalGlyph(c){return this.localGlyphMode!==dle.none&&(this.localGlyphMode===dle.all?!!this.localFontFamily:!!this.localFontFamily&&(En["CJK Unified Ideographs"](c)||En["Hangul Syllables"](c)||En.Hiragana(c)||En.Katakana(c)||En["CJK Symbols and Punctuation"](c)||En["CJK Unified Ideographs Extension A"](c)||En["CJK Unified Ideographs Extension B"](c)||En.Osage(c)))}_tinySDF(c,h,g){const v=this.localFontFamily;if(!v||!this._doesCharSupportLocalGlyph(g))return;let N=c.tinySDF;if(!N){let me="400";/bold/i.test(h)?me="900":/medium/i.test(h)?me="500":/light/i.test(h)&&(me="200"),N=c.tinySDF=new a4.TinySDF({fontFamily:v,fontWeight:me,fontSize:24*Gp,buffer:3*Gp,radius:8*Gp}),N.fontWeight=me}if(this.localGlyphs[N.fontWeight][g])return this.localGlyphs[N.fontWeight][g];const C=String.fromCodePoint(g),{data:L,width:F,height:$,glyphWidth:K,glyphHeight:Z,glyphLeft:X,glyphTop:re,glyphAdvance:ae}=N.draw(C);return this.localGlyphs[N.fontWeight][g]={id:g,bitmap:new S0({width:F,height:$},L),metrics:{width:K/Gp,height:Z/Gp,left:X/Gp,top:re/Gp-27,advance:ae/Gp,localGlyph:!0}}}}a4.loadGlyphRange=function(f,c,h,g,v){const N=256*c,C=N+255,L=g.transformRequest(g.normalizeGlyphsURL(h).replace("{fontstack}",f).replace("{range}",`${N}-${C}`),Mp.Glyphs);Eu(L,(F,$)=>{if(F)v(F);else if($){const K={},Z=function(X){return new Y6(X).readFields($We,{})}($);for(const X of Z.glyphs)K[X.id]=X;v(null,{glyphs:K,ascender:Z.ascender,descender:Z.descender})}})},a4.TinySDF=class{constructor({fontSize:f=24,buffer:c=3,radius:h=8,cutoff:g=.25,fontFamily:v="sans-serif",fontWeight:N="normal",fontStyle:C="normal",lang:L=null}={}){this.buffer=c,this.cutoff=g,this.radius=h,this.lang=L;const F=this.size=f+4*c,$=this._createCanvas(F),K=this.ctx=$.getContext("2d",{willReadFrequently:!0});K.font=`${C} ${N} ${f}px ${v}`,K.textBaseline="alphabetic",K.textAlign="left",K.fillStyle="black",this.gridOuter=new Float64Array(F*F),this.gridInner=new Float64Array(F*F),this.f=new Float64Array(F),this.z=new Float64Array(F+1),this.v=new Uint16Array(F)}_createCanvas(f){const c=document.createElement("canvas");return c.width=c.height=f,c}draw(f){const{width:c,actualBoundingBoxAscent:h,actualBoundingBoxDescent:g,actualBoundingBoxLeft:v,actualBoundingBoxRight:N}=this.ctx.measureText(f),C=Math.ceil(h),L=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(N-v))),F=Math.min(this.size-this.buffer,C+Math.ceil(g)),$=L+2*this.buffer,K=F+2*this.buffer,Z=Math.max($*K,0),X=new Uint8ClampedArray(Z),re={data:X,width:$,height:K,glyphWidth:L,glyphHeight:F,glyphTop:C,glyphLeft:0,glyphAdvance:c};if(L===0||F===0)return re;const{ctx:ae,buffer:me,gridInner:Se,gridOuter:Ne}=this;this.lang&&(ae.lang=this.lang),ae.clearRect(me,me,L,F),ae.fillText(f,me,me+C);const Fe=ae.getImageData(me,me,L,F);Ne.fill(NM,0,Z),Se.fill(0,0,Z);for(let ze=0;ze0?bt*bt:0,Se[ht]=bt<0?bt*bt:0}}bbe(Ne,0,0,$,K,$,this.f,this.v,this.z),bbe(Se,me,me,L,F,$,this.f,this.v,this.z);for(let ze=0;ze{const yr=eL(Rt.stretch-Fe,ze,K,f.left*v),_r=tL(Rt.fixed-ht,bt,Rt.stretch,ae),fr=eL(rr.stretch-Xe,gt,Z,f.top*v),gr=tL(rr.fixed-Ct,Et,rr.stretch,me),tr=eL(lr.stretch-Fe,ze,K,f.left*v),Qt=tL(lr.fixed-ht,bt,lr.stretch,ae),xr=eL(cr.stretch-Xe,gt,Z,f.top*v),Tr=tL(cr.fixed-Ct,Et,cr.stretch,me),jr=new sr(yr,fr),xn=new sr(tr,fr),Vr=new sr(tr,xr),Qr=new sr(yr,xr),an=new sr(_r/L,gr/L),bs=new sr(Qt/L,Tr/L),kr=c*Math.PI/180;if(kr){const Wa=Math.sin(kr),ft=Math.cos(kr),xt=[ft,-Wa,Wa,ft];jr._matMult(xt),xn._matMult(xt),Qr._matMult(xt),Vr._matMult(xt)}const ln=Rt.stretch+Rt.fixed,Wn=lr.stretch+lr.fixed,qs=rr.stretch+rr.fixed,Xs=cr.stretch+cr.fixed,ls=f.imageSecondary;return{tl:jr,tr:xn,bl:Qr,br:Vr,texPrimary:{x:C.paddedRect.x+ug+ln,y:C.paddedRect.y+ug+qs,w:Wn-ln,h:Xs-qs},texSecondary:ls?{x:ls.paddedRect.x+ug+ln,y:ls.paddedRect.y+ug+qs,w:Wn-ln,h:Xs-qs}:void 0,writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:an,pixelOffsetBR:bs,minFontScaleX:bt/L/K,minFontScaleY:Et/L/Z,isSDF:h}};if(g&&(C.stretchX||C.stretchY)){const Rt=kbe(X,Se,ae),rr=kbe(re,Ne,me);for(let lr=0;lrN)&&(N=ae.x),(!re||ae.y>C)&&(C=ae.y)}const F=Math.min(N-g,C-v);let $=F/2;const K=new Zk([],XWe);if(F===0)return new sr(g,v);for(let re=g;reZ.d||!Z.d)&&(Z=re,h&&console.log("found best %d after %d probes",Math.round(1e4*re.d)/1e4,X)),re.max-Z.d<=c||($=re.h/2,K.push(new i4(re.p.x-$,re.p.y-$,$,f)),K.push(new i4(re.p.x+$,re.p.y-$,$,f)),K.push(new i4(re.p.x-$,re.p.y+$,$,f)),K.push(new i4(re.p.x+$,re.p.y+$,$,f)),X+=4)}return h&&(console.log(`num probes: ${X}`),console.log(`best distance: ${Z.d}`)),Z.p}function XWe(f,c){return c.max-f.max}class i4{constructor(c,h,g,v){this.p=new sr(c,h),this.h=g,this.d=function(N,C){let L=!1,F=1/0;for(let $=0;$N.y!=me.y>N.y&&N.x<(me.x-ae.x)*(N.y-ae.y)/(me.y-ae.y)+ae.x&&(L=!L),F=Math.min(F,uo(N,ae,me))}}return(L?1:-1)*Math.sqrt(F)}(this.p,v),this.max=this.d+this.h*Math.SQRT2}}const QWe=Object.keys,hle=Number.POSITIVE_INFINITY,JWe=Math.sqrt(2);function M0(f,c,h,g,v){const N=ile(f)&&f.collisionPadding?f.collisionPadding:[0,0,0,0],C={top:f.top-N[1],bottom:f.bottom+N[3],left:f.left-N[0],right:f.right+N[2],scaled:!1};return g!==void 0&&function(L,F){L.top*=F,L.bottom*=F,L.left*=F,L.right*=F,L.scaled=!0}(C,g),h&&function(L,F){if(!F)return;const $=qn(F),K=new sr(L.left,L.top),Z=new sr(L.right,L.top),X=new sr(L.left,L.bottom),re=new sr(L.right,L.bottom),ae=new sr(0,0);K._rotateAround($,ae),Z._rotateAround($,ae),X._rotateAround($,ae),re._rotateAround($,ae),L.left=Math.min(K.x,Z.x,X.x,re.x),L.right=Math.max(K.x,Z.x,X.x,re.x),L.top=Math.min(K.y,Z.y,X.y,re.y),L.bottom=Math.max(K.y,Z.y,X.y,re.y)}(C,h),v&&(C.left+=v[0],C.right+=v[0],C.top+=v[1],C.bottom+=v[1]),c?{top:Math.min(c.top,C.top),bottom:Math.max(c.bottom,C.bottom),left:Math.min(c.left,C.left),right:Math.max(c.right,C.right),scaled:c.scaled||C.scaled}:C}function Sbe(f,[c,h]){let g=0,v=0;if(h===hle){c<0&&(c=0);const N=c/JWe;switch(f){case"top-right":case"top-left":v=N-7;break;case"bottom-right":case"bottom-left":v=7-N;break;case"bottom":v=7-c;break;case"top":v=c-7}switch(f){case"top-right":case"bottom-right":g=-N;break;case"top-left":case"bottom-left":g=N;break;case"left":g=c;break;case"right":g=-c}}else{switch(c=Math.abs(c),h=Math.abs(h),f){case"top-right":case"top-left":case"top":v=h-7;break;case"bottom-right":case"bottom-left":case"bottom":v=7-h}switch(f){case"top-right":case"bottom-right":case"right":g=-c;break;case"top-left":case"bottom-left":case"left":g=c}}return[g,v]}function eGe(f,c,h,g,v,N,C,L,F,$,K,Z,X,re){const ae=f.layers[0],me=ae.appearances;if(me.length===0)return{iconBBox:null,iconVerticalBBox:null,textBBox:null,textVerticalBBox:null};const Se={iconBBox:null,iconVerticalBBox:null},Ne={textBBox:null,textVerticalBBox:null},{baseIconRotate:Fe,baseTextRotate:ze,iconScaleFactor:Xe}=function(ht,bt,Ct){const Et=ht.get("icon-rotate").evaluate(bt,{},Ct),Xt=ht.get("text-rotate").evaluate(bt,{},Ct),[Rt,rr]=ht.get("icon-size-scale-range");return{baseIconRotate:Et,baseTextRotate:Xt,iconScaleFactor:xe(1,Rt,rr)}}(g,v,N);c&&(Se.iconBBox=M0(c,Se.iconBBox,Fe,C),h)&&(Se.iconVerticalBBox=M0(h,Se.iconVerticalBBox,Fe+90,C));const gt=nL(Z.horizontal);gt&&(Ne.textBBox=M0(gt,Ne.textBBox,ze,1,re)),Z.vertical&&(Ne.textVerticalBBox=M0(Z.vertical,Ne.textVerticalBBox,ze+90,1,re));for(const ht of me)ht.hasIconProperties()&&tGe(Se,f,ae,ht,v,N,L,Fe,C,F,c,$,Xe,K),ht.hasTextProperties()&&rGe(Ne,ae,ht,v,N,re,ze,X,gt,Z.vertical);return{iconBBox:Se.iconBBox,iconVerticalBBox:Se.iconVerticalBBox,textBBox:Ne.textBBox,textVerticalBBox:Ne.textVerticalBBox}}function tGe(f,c,h,g,v,N,C,L,F,$,K,Z,X,re){const{appearanceIconOffset:ae,appearanceIconRotate:me,appearanceIconSize:Se}=function(Xe,gt,ht,bt,Ct,Et,Xt,Rt){const rr=Xe.hasProperty("icon-offset")?gt.getAppearanceValueAndResolveTokens(Xe,"icon-offset",ht,bt,[]):null,lr=rr&&Array.isArray(rr)?rr:Ct,cr=Xe.hasProperty("icon-rotate")?gt.getAppearanceValueAndResolveTokens(Xe,"icon-rotate",ht,bt,[]):null,yr=typeof cr=="number"?cr:Et,_r=Xe.hasProperty("icon-size")?gt.getAppearanceValueAndResolveTokens(Xe,"icon-size",ht,bt,[]):null;return{appearanceIconOffset:lr,appearanceIconRotate:yr,appearanceIconSize:typeof _r=="number"?_r*Rt.iconScaleFactor:Xt}}(g,h,v,N,C,L,F,$);let Ne=null,Fe=null,ze=null;g.hasProperty("icon-image")?ze=function(Xe,gt,ht,bt,Ct,Et,Xt){let Rt=null;const rr=gt.getAppearanceValueAndResolveTokens(ht,"icon-image",bt,Ct,[]);if(rr){const lr=Xe.getResolvedImageFromTokens(rr),cr=ht.getUnevaluatedProperty("icon-size"),yr=SM(lr,n4(Xe.zoom,cr,Xe.worldview),cr,Ct,Xe.zoom,bt,Xe.pixelRatio,Xt,Xe.worldview);Rt=Et.get(yr.iconPrimary.toString())}return Rt}(c,h,g,v,N,Z,X):K&&(ze=K.imagePrimary),ze&&(Ne=Q6(ze,null,ae,re),c.allowVerticalPlacement&&(Fe=Q6(ze,null,ae,re))),Ne&&(f.iconBBox=M0(Ne,f.iconBBox,me,Se)),Fe&&(f.iconVerticalBBox=M0(Fe,f.iconVerticalBBox,me+90,Se))}function rGe(f,c,h,g,v,N,C,L,F,$){const{appearanceTextOffset:K,appearanceTextRotate:Z,appearanceTextSize:X}=function(ae,me,Se,Ne,Fe,ze,Xe){const gt=ae.hasProperty("text-offset")?me.getAppearanceValueAndResolveTokens(ae,"text-offset",Se,Ne,[]):null,ht=gt&&Array.isArray(gt)?[gt[0]*wl,gt[1]*wl]:Fe,bt=ae.hasProperty("text-rotate")?me.getAppearanceValueAndResolveTokens(ae,"text-rotate",Se,Ne,[]):null,Ct=typeof bt=="number"?bt:ze,Et=ae.hasProperty("text-size")?me.getAppearanceValueAndResolveTokens(ae,"text-size",Se,Ne,[]):null;return{appearanceTextOffset:ht,appearanceTextRotate:Ct,appearanceTextSize:typeof Et=="number"?Et:Xe}}(h,c,g,v,N,C,L),re=X/L;F&&(f.textBBox=M0(F,f.textBBox,Z,re,K)),$&&(f.textVerticalBBox=M0($,f.textVerticalBBox,Z+90,re,K))}function rL(f,c,h,g,v,N,C,L,F){if(!c||!c.usvg)return;const $=fbe(g),K=fbe(v),Z=N!=="both"&&N!=="width"||!ube(g)?1:K.width/$.width,X=N!=="both"&&N!=="height"||!hbe(g)?1:K.height/$.height;h.scaleSelf(Z,X);const re=h.toString();C.set(re,h),L.set(re,c);const{imagePosition:ae}=cle(re,c,v_);F.set(re,ae)}function Cbe(f,c,h,g,v,N,C,L,F){if(!f)return;const $=function(K,Z,X,re,ae,me){if(K.kind==="camera")return K.maxSize;if(K.kind==="composite"){const Se=Z.possiblyEvaluate(new oi(K.maxZoom,{worldview:me}),X).evaluate(ae,{},X),Ne=Z.possiblyEvaluate(new oi(K.minZoom,{worldview:me}),X).evaluate(ae,{},X);return Math.max(Se,Ne)}return Z.possiblyEvaluate(new oi(re,{worldview:me})).evaluate(ae,{},X)}(c,h,g,v,N,F);return f.scaleSelf($*L*C)}function SM(f,c,h,g,v,N,C,L,F){return{iconPrimary:Cbe(f.getPrimary(),c,h,g,v,N,C,L,F),iconSecondary:Cbe(f.getSecondary(),c,h,g,v,N,C,L,F)}}function nGe(f,c,h){if(!c)return;const g=h.get(f.toString()),v=h.get(c.toString());g&&v&&(g.paddedRect.w===v.paddedRect.w&&g.paddedRect.h===v.paddedRect.h||Wr(`Mismatch in icon variant sizes: ${f.toString()} and ${c.toString()}`),g.usvg!==v.usvg&&Wr(`Mismatch in icon variant image types: ${f.id} and ${c.id}`))}function Mbe(f,c,h,g){if(!f)return;const v=c.get(h.toString());if(f.imagePrimary=v,g){const N=c.get(g.toString());f.imageSecondary=N}}function sGe(f,c){for(const h in f.horizontal)Tbe(f.horizontal[h],c);Tbe(f.vertical,c)}function Tbe(f,c){if(f){for(const h of f.positionedLines)for(const g of h.positionedGlyphs)if(g.image!==null){const v=g.image.toString();g.rect=c.get(v).paddedRect}}}function fle(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 aGe(f,c,h,g,v,N,C,L,F){const $=nL(N.horizontal)||N.vertical,K=h.get("icon-text-fit-padding").evaluate(g,{},v);let Z,X=c;return c&&F!=="none"&&(f.allowVerticalPlacement&&N.vertical&&(Z=ole(c,N.vertical,F,K,L,C)),$&&(X=ole(c,$,F,K,L,C))),{defaultShapedIcon:X,verticallyShapedIcon:Z}}function iGe(f,c,h,g,v,N,C,L,F,$,K,Z,X,re,ae,me,Se,Ne,Fe,ze,Xe,gt,ht,bt){let Ct=C.textMaxSize.evaluate(c,{},X);Ct===void 0?Ct=L*C.textScaleFactor:Ct*=C.textScaleFactor;const Et=f.layers[0].layout,Xt=wl,Rt=L*C.textScaleFactor/Xt,rr=nL(h.horizontal)||h.vertical;if(Se!=="none"&&f.appearanceFeatureData&&c.index18&&xr>2&&(xr>>=1),Math.max(Cr/(512*xr),1)*Et.get("symbol-spacing")),_r=Et.get("text-padding")*f.tilePixelRatio,fr=Et.get("icon-padding")*f.tilePixelRatio,gr=qn(Et.get("text-max-angle")),tr=Et.get("icon-rotation-alignment")==="map"&&ze!=="point",Qt=yr/2;var xr;f.hasAnyIconTextFit===!1&&Se!=="none"&&(f.hasAnyIconTextFit=!0);const Tr=c.properties?+c.properties[Jt]:null,jr=Tr&&f.elevationFeatureIdToIndex?f.elevationFeatureIdToIndex.get(Tr):65535,xn=(Vr,Qr,an)=>{if(Qr.x<0||Qr.x>=Cr||Qr.y<0||Qr.y>=Cr)return;let bs=null;if(lr){const{x:kr,y:ln,z:Wn}=re.projectTilePoint(Qr.x,Qr.y,an);bs={anchor:new Mx(kr,ln,Wn,0,void 0),up:re.upVector(an,Qr.x,Qr.y)}}(function(kr,ln,Wn,qs,Xs,ls,Wa,ft,xt,nr,vr,zr,Br,vn,wn,ss,ms,vs,Rs,Ln,Hn,da,pa,ma,Da,Ja,Ga,ja,Ta,gs,Gs,Ri,In){const Fs=kr.addToLineVertexArray(ln,qs);let Za,si,li,yo,ai,Pn,Hi,Ra=0,ki=0,tl=0,jl=0,Do=-1,Ro=-1;const hl={};let Yd=mr("");const ii=Wn?Wn.anchor:ln,ho=ja!=="none";let vo=0,uu=0;if(xt._unevaluatedLayout.getValue("text-radial-offset")===void 0){const mc=xt.layout.get("text-offset").evaluate(Hn,{},Da);vo=mc[0]*wl,uu=mc[1]*wl}else vo=xt.layout.get("text-radial-offset").evaluate(Hn,{},Da)*wl,uu=hle;if(kr.allowVerticalPlacement&&Xs.vertical){const mc=Xs.vertical;if(wn)Pn=ple(mc),ft&&(Hi=ple(ft));else{const Nd=xt.layout.get("text-rotate").evaluate(Hn,{},Da)+90;li=sL(nr,ii,ln,vr,zr,Br,mc,vn,Nd,ss,Ri),ft&&(yo=sL(nr,ii,ln,vr,zr,Br,ft,vs,Nd,null,Gs))}}if(ls){const mc=kr.iconSizeData,Nd=xt.layout.get("icon-rotate").evaluate(Hn,{},Da),zu=ule(ls,Nd,pa,ho,da.iconScaleFactor),E0=ft?ule(ft,Nd,pa,ho,da.iconScaleFactor):void 0;si=sL(nr,ii,ln,vr,zr,Br,ls,vs,Nd,null,gs);const f4=function(Xp,VM,K2e,yKe,Z2e,Y2e,vKe,_Ke){const X2e=Xp.layers[0],Q2e=X2e.appearances;let p4=VM.length;if(K2e&&(p4=Math.max(p4,K2e.length)),Q2e.length===0)return p4;const[bKe,wKe]=yKe.get("icon-size-scale-range"),jKe=xe(1,bKe,wKe);for(const J2e of Q2e){const ewe=J2e.getUnevaluatedProperties();if(ewe._values["icon-image"].value!==void 0){const twe=X2e.getAppearanceValueAndResolveTokens(J2e,"icon-image",Z2e,Y2e,[]);if(twe){const rwe=Xp.getResolvedImageFromTokens(twe);if(rwe){const nwe=ewe._values["icon-size"],kKe=SM(rwe,n4(Xp.zoom,nwe,Xp.worldview),nwe,Y2e,Xp.zoom,Z2e,Xp.pixelRatio,jKe,Xp.worldview),NKe=vKe.get(kKe.iconPrimary.toString());p4=Math.max(p4,KWe(NKe,_Ke))}}}}return p4}(kr,zu,E0,xt.layout,Hn,Da,kr.iconAtlasPositions,ho);Ra=4*f4;let Yp=null;mc.kind==="source"?(Yp=[Wp*xt.layout.get("icon-size").evaluate(Hn,{},Da)*da.iconScaleFactor],Yp[0]>Tx&&Wr(`${kr.layerIds[0]}: Value for "icon-size" is >= ${CM}. Reduce your "icon-size".`)):mc.kind==="composite"&&(Yp=[Wp*da.compositeIconSizes[0].evaluate(Hn,{},Da)*da.iconScaleFactor,Wp*da.compositeIconSizes[1].evaluate(Hn,{},Da)*da.iconScaleFactor],(Yp[0]>Tx||Yp[1]>Tx)&&Wr(`${kr.layerIds[0]}: Value for "icon-size" is >= ${CM}. Reduce your "icon-size".`)),kr.addSymbols(kr.icon,zu,Yp,Ln,Rs,Hn,void 0,Wn,ln,Fs.lineStartIndex,Fs.lineLength,-1,ma,Da,Ja,Ga,kr.symbolInstances.length,f4),Do=kr.icon.placedSymbolArray.length-1,E0&&(ki=4*f4,kr.addSymbols(kr.icon,E0,Yp,Ln,Rs,Hn,Fu.vertical,Wn,ln,Fs.lineStartIndex,Fs.lineLength,-1,ma,Da,Ja,Ga,kr.symbolInstances.length,f4),Ro=kr.icon.placedSymbolArray.length-1)}for(const mc in Xs.horizontal){const Nd=mc,zu=Xs.horizontal[Nd];Za||(Yd=mr(zu.text),wn?ai=ple(zu):Za=sL(nr,ii,ln,vr,zr,Br,zu,vn,xt.layout.get("text-rotate").evaluate(Hn,{},Da),ss,Ri));const E0=zu.positionedLines.length===1;if(tl+=Abe(kr,Wn,ln,zu,Wa,xt,wn,Hn,ss,Fs,Xs.vertical?Fu.horizontal:Fu.horizontalOnly,E0?QWe(Xs.horizontal):[Nd],hl,Do,da,ma,Da,kr.symbolInstances.length,Ja),E0)break}Xs.vertical&&(jl+=Abe(kr,Wn,ln,Xs.vertical,Wa,xt,wn,Hn,ss,Fs,Fu.vertical,["vertical"],hl,Ro,da,ma,Da,kr.symbolInstances.length,Ja));let rl=-1;const qf=(mc,Nd)=>mc?Math.max(mc,Nd):Nd;rl=qf(ai,rl),rl=qf(Pn,rl),rl=qf(Hi,rl);const hg=rl>-1?1:0;kr.glyphOffsetArray.length>=65535&&Wr("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),Hn.sortKey!==void 0&&kr.addToSortKeyRanges(kr.symbolInstances.length,Hn.sortKey),kr.symbolInstances.emplaceBack(ln.x,ln.y,ii.x,ii.y,ii.z,hl.right>=0?hl.right:-1,hl.center>=0?hl.center:-1,hl.left>=0?hl.left:-1,hl.vertical>=0?hl.vertical:-1,Do,Ro,Yd,Za!==void 0?Za:kr.collisionBoxArray.length,Za!==void 0?Za+1:kr.collisionBoxArray.length,li!==void 0?li:kr.collisionBoxArray.length,li!==void 0?li+1:kr.collisionBoxArray.length,si!==void 0?si:kr.collisionBoxArray.length,si!==void 0?si+1:kr.collisionBoxArray.length,yo||kr.collisionBoxArray.length,yo?yo+1:kr.collisionBoxArray.length,vr,tl,jl,Ra,ki,hg,0,vo,uu,rl,0,ho?1:0,Ta)})(f,Qr,bs,Vr,h,g,N,v,f.layers[0],f.collisionBoxArray,c.index,c.sourceLayerIndex,f.index,_r,Fe,$,0,fr,tr,Ne,c,C,K,Z,X,ae,me,Se,jr,Xe,gt,ht)};if(ze==="line")for(const Vr of z6(c.geometry,0,0,Cr,Cr)){const Qr=GWe(Vr,yr,gr,h.vertical||rr,g,Xt,cr,f.overscaling,Cr);for(const an of Qr)rr&&oGe(f,rr.text,Qt,an)||xn(Vr,an,X)}else if(ze==="line-center"){for(const Vr of c.geometry)if(Vr.length>1){const Qr=WWe(Vr,gr,h.vertical||rr,g,Xt,cr);Qr&&xn(Vr,Qr,X)}}else if(c.type==="Polygon")for(const Vr of cM(c.geometry,0)){const Qr=YWe(Vr,16);xn(Vr[0],new Mx(Qr.x,Qr.y,0,0,void 0),X)}else if(c.type==="LineString")for(const Vr of c.geometry)xn(Vr,new Mx(Vr[0].x,Vr[0].y,0,0,void 0),X);else if(c.type==="Point")for(const Vr of c.geometry)for(const Qr of Vr)xn([Qr],new Mx(Qr.x,Qr.y,0,0,void 0),X)}const CM=255,Tx=CM*Wp;function Abe(f,c,h,g,v,N,C,L,F,$,K,Z,X,re,ae,me,Se,Ne,Fe){const ze=function(ht,bt,Ct,Et,Xt,Rt,rr,lr){const cr=[];if(bt.positionedLines.length===0)return cr;const yr=Et.layout.get("text-rotate").evaluate(Rt,{})*Math.PI/180,_r=function(xr){const Tr=xr[0],jr=xr[1],xn=Tr*jr;return xn>0?[Tr,-jr]:xn<0?[-Tr,jr]:Tr===0?[jr,Tr]:[jr,-Tr]}(Ct);let fr=Math.abs(bt.top-bt.bottom);for(const xr of bt.positionedLines)fr-=xr.lineOffset;const gr=bt.positionedLines.length,tr=fr/gr;let Qt=bt.top-Ct[1];for(let xr=0;xrTx&&Wr(`${f.layerIds[0]}: Value for "text-size" is >= ${CM}. Reduce your "text-size".`)):Xe.kind==="composite"&&(gt=[Wp*ae.compositeTextSizes[0].evaluate(L,{},Se)*ae.textScaleFactor,Wp*ae.compositeTextSizes[1].evaluate(L,{},Se)*ae.textScaleFactor],(gt[0]>Tx||gt[1]>Tx)&&Wr(`${f.layerIds[0]}: Value for "text-size" is >= ${CM}. Reduce your "text-size".`)),f.addSymbols(f.text,ze,gt,F,C,L,K,c,h,$.lineStartIndex,$.lineLength,re,me,Se,Fe,!1,Ne,ze.length);for(const ht of Z)X[ht]=f.text.placedSymbolArray.length-1;return 4*ze.length}function nL(f){for(const c in f)return f[c];return null}function sL(f,c,h,g,v,N,C,L,F,$,K){let Z,X,re,ae;if(Z=K?K.top:C.top,X=K?K.bottom:C.bottom,re=K?K.left:C.left,ae=K?K.right:C.right,ile(C)&&C.collisionPadding){const me=C.collisionPadding;re-=me[0],Z-=me[1],ae+=me[2],X+=me[3]}if(F){const me=new sr(re,Z),Se=new sr(ae,Z),Ne=new sr(re,X),Fe=new sr(ae,X),ze=qn(F);let Xe=new sr(0,0);$&&(Xe=new sr($[0],$[1])),me._rotateAround(ze,Xe),Se._rotateAround(ze,Xe),Ne._rotateAround(ze,Xe),Fe._rotateAround(ze,Xe),re=Math.min(me.x,Se.x,Ne.x,Fe.x),ae=Math.max(me.x,Se.x,Ne.x,Fe.x),Z=Math.min(me.y,Se.y,Ne.y,Fe.y),X=Math.max(me.y,Se.y,Ne.y,Fe.y)}return f.emplaceBack(c.x,c.y,c.z,h.x,h.y,re,Z,ae,X,L,g,v,N),f.length-1}function ple(f){ile(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 oGe(f,c,h,g){const v=f.compareText;if(c in v){const N=v[c];for(let C=N.length-1;C>=0;C--)if(g.dist(N[C])ze&&(Xe(ht,cr,Ct,Et,rr,lr),Xe(cr,bt,rr,lr,Xt,Rt))}Xe(Z,X,g,N,v,N),Xe(X,re,v,N,v,C),Xe(re,ae,v,C,g,C),Xe(ae,Z,g,C,g,N),me-=ze,Se-=ze,Ne+=ze,Fe+=ze;const gt=1/Math.max(Ne-me,Fe-Se);return{scale:gt,x:me*gt,y:Se*gt,x2:Ne*gt,y2:Fe*gt,projection:c}}function Ibe(f,{x:c,y:h},g=0){return new sr(((c-g)*f.scale-f.x)*Cr,(h*f.scale-f.y)*Cr)}const lGe=M(new Float32Array(16));class T0{constructor(c){this.spec=c,this.name=c.name,this.wrap=!1,this.requiresDraping=!1,this.supportsWorldCopies=!1,this.supportsTerrain=!1,this.supportsFog=!1,this.supportsFreeCamera=!1,this.zAxisUnit="meters",this.isReprojectedInTileSpace=!0,this.unsupportedLayers=["custom"],this.center=[0,0],this.range=[3.5,7]}project(c,h){return{x:0,y:0,z:0}}unproject(c,h){return new m(0,0)}projectTilePoint(c,h,g){return{x:c,y:h,z:0}}locationPoint(c,h,g,v=!0){return c._coordinatePoint(c.locationCoordinate(h,g),v)}pixelsPerMeter(c,h){return Y(1,c)*h}pixelSpaceConversion(c,h,g){return 1}farthestPixelDistance(c){return Ebe(c,c.pixelsPerMeter)}pointCoordinate(c,h,g,v){const N=c.horizonLineFromTop(!1),C=new sr(h,Math.max(N,g));return c.rayIntersectionCoordinate(c.pointRayIntersection(C,v))}pointCoordinate3D(c,h,g){const v=new sr(h,g);if(c.elevation)return c.elevation.pointCoordinate(v);{const N=this.pointCoordinate(c,v.x,v.y,0);return[N.x,N.y,N.z]}}isPointAboveHorizon(c,h){if(c.elevation&&c.elevation.visibleDemTiles.length)return!this.pointCoordinate3D(c,h.x,h.y);const g=c.horizonLineFromTop();return h.y0?h<-o4+g&&(h=-o4+g):h>o4-g&&(h=o4-g);const C=N/Math.pow(iL(h),v);let L=C*Math.sin(v*c),F=N-C*Math.cos(v*c);return L=.5*(L/Math.PI+.5),F=.5*(F/Math.PI+.5),{x:L,y:this.southernCenter?F:1-F,z:0}}unproject(c,h){c=(2*c-.5)*Math.PI,this.southernCenter&&(h=1-h),h=(2*(1-h)-.5)*Math.PI;const{n:g,f:v}=this,N=v-h,C=Math.sign(N),L=Math.sign(g)*Math.sqrt(c*c+N*N);let F=Math.atan2(c,Math.abs(N))*C;N*g<0&&(F-=Math.PI*Math.sign(c)*C);const $=xe(Gi(F/g)+this.center[0],-180,180),K=xe(Gi(2*Math.atan(Math.pow(v/L,1/g))-o4),-ue,ue);return new m($,this.southernCenter?-K:K)}}class Pbe extends T0{constructor(c){super(c),this.wrap=!0,this.supportsWorldCopies=!0,this.supportsTerrain=!0,this.supportsFog=!0,this.supportsFreeCamera=!0,this.isReprojectedInTileSpace=!1,this.unsupportedLayers=[],this.range=null}project(c,h){return{x:B(c),y:H(h),z:0}}unproject(c,h){const g=te(c),v=de(h);return new m(g,v)}}const Lbe=qn(ue);class fGe extends T0{project(c,h){const g=(h=qn(h))*h,v=g*g;return{x:.5*((c=qn(c))*(.8707-.131979*g+v*(v*(.003971*g-.001529*v)-.013791))/Math.PI+.5),y:1-.5*(h*(1.007226+g*(.015085+v*(.028874*g-.044475-.005916*v)))/Math.PI+1),z:0}}unproject(c,h){c=(2*c-.5)*Math.PI;let g=h=(2*(1-h)-1)*Math.PI,v=25,N=0,C=g*g;do{C=g*g;const $=C*C;N=(g*(1.007226+C*(.015085+$*(.028874*C-.044475-.005916*$)))-h)/(1.007226+C*(.045255+$*(.259866*C-.311325-.005916*11*$))),g=xe(g-N,-Lbe,Lbe)}while(Math.abs(N)>1e-6&&--v>0);C=g*g;const L=xe(Gi(c/(.8707+C*(C*(C*C*C*(.003971-.001529*C)-.013791)-.131979))),-180,180),F=Gi(g);return new m(L,F)}}const Obe=qn(ue);class pGe extends T0{project(c,h){h=qn(h),c=qn(c);const g=Math.cos(h),v=2/Math.PI,N=Math.acos(g*Math.cos(c/2)),C=Math.sin(N)/N,L=.5*(c*v+2*g*Math.sin(c/2)/C)||0,F=.5*(h+Math.sin(h)/C)||0;return{x:.5*(L/Math.PI+.5),y:1-.5*(F/Math.PI+1),z:0}}unproject(c,h){let g=c=(2*c-.5)*Math.PI,v=h=(2*(1-h)-1)*Math.PI,N=25;const C=1e-6;let L=0,F=0;do{const $=Math.cos(v),K=Math.sin(v),Z=2*K*$,X=K*K,re=$*$,ae=Math.cos(g/2),me=Math.sin(g/2),Se=2*ae*me,Ne=me*me,Fe=1-re*ae*ae,ze=Fe?1/Fe:0,Xe=Fe?Math.acos($*ae)*Math.sqrt(1/Fe):0,gt=.5*(2*Xe*$*me+2*g/Math.PI)-c,ht=.5*(Xe*K+v)-h,bt=.5*ze*(re*Ne+Xe*$*ae*X)+1/Math.PI,Ct=ze*(Se*Z/4-Xe*K*me),Et=.125*ze*(Z*me-Xe*K*re*Se),Xt=.5*ze*(X*ae+Xe*Ne*$)+.5,Rt=Ct*Et-Xt*bt;L=(ht*Ct-gt*Xt)/Rt,F=(gt*Et-ht*bt)/Rt,g=xe(g-L,-Math.PI,Math.PI),v=xe(v-F,-Obe,Obe)}while((Math.abs(L)>C||Math.abs(F)>C)&&--N>0);return new m(Gi(g),Gi(v))}}class Dbe extends T0{constructor(c){super(c),this.center=c.center||[0,0],this.parallels=c.parallels||[0,0],this.cosPhi=Math.max(.01,Math.cos(qn(this.parallels[0]))),this.scale=1/(2*Math.max(Math.PI*this.cosPhi,1/this.cosPhi)),this.wrap=!0,this.supportsWorldCopies=!0}project(c,h){const{scale:g,cosPhi:v}=this;return{x:qn(c)*v*g+.5,y:-Math.sin(qn(h))/v*g+.5,z:0}}unproject(c,h){const{scale:g,cosPhi:v}=this,N=-(h-.5)/g,C=xe(Gi((c-.5)/g)/v,-180,180),L=Math.asin(xe(N*v,-1,1)),F=xe(Gi(L),-ue,ue);return new m(C,F)}}class mGe extends Pbe{constructor(c){super(c),this.requiresDraping=!0,this.supportsWorldCopies=!1,this.supportsFog=!0,this.zAxisUnit="pixels",this.unsupportedLayers=["debug"],this.range=[3,5]}projectTilePoint(c,h,g){const v=nM(c,h,g);return at(v,v,A6(Zh(g))),{x:v[0],y:v[1],z:v[2]}}locationPoint(c,h,g){const v=w0(h.lat,h.lng),N=qe([],v),C=g?c._centerAltitude+g:c.elevation?c.elevation.getAtPointOrZero(c.locationCoordinate(h),c._centerAltitude):c._centerAltitude;Je(v,v,N,Y(1,0)*Cr*C);const L=M(new Float64Array(16));return T(L,c.pixelMatrix,c.globeMatrix),at(v,v,L),new sr(v[0],v[1])}pixelsPerMeter(c,h){return Y(1,0)*h}pixelSpaceConversion(c,h,g){const v=Y(1,c)*h,N=zn(Y(1,45)*h,v,g);return this.pixelsPerMeter(c,h)/N}createTileMatrix(c,h,g){const v=voe(Zh(g.canonical));return T(new Float64Array(16),c.globeMatrix,v)}createInversionMatrix(c,h){const{center:g}=c,v=A6(Zh(h));return U(v,v,qn(g.lng)),D(v,v,qn(g.lat)),z(v,v,[c._pixelsPerMercatorPixel,c._pixelsPerMercatorPixel,1]),Float32Array.from(v)}pointCoordinate(c,h,g,v){return k0(c,h,g,!0)||new We(0,0)}pointCoordinate3D(c,h,g){const v=this.pointCoordinate(c,h,g,0);return[v.x,v.y,v.z]}isPointAboveHorizon(c,h){return!k0(c,h.x,h.y,!1)}farthestPixelDistance(c){const h=function(v,N){const C=v.cameraToCenterDistance,L=v._centerAltitude*N,F=v._camera,$=v._camera.forward(),K=he([],_e([],$,-C),[0,0,L]),Z=v.worldSize/(2*Math.PI),X=[0,0,-Z],re=v.width/v.height,ae=Math.tan(v.fovAboveCenter),me=_e([],F.up(),ae),Se=_e([],F.right(),ae*re),Ne=qe([],he([],he([],$,me),Se)),Fe=[];let ze;if(new rn(K,Ne).closestPointOnSphere(X,Z,Fe)){const Xe=he([],Fe,X),gt=ke([],Xe,K);ze=Math.cos(v.fovAboveCenter)*pe(gt)}else{const Xe=ke([],K,X),gt=ke([],X,K);qe(gt,gt);const ht=pe(Xe)-Z;ze=Math.sqrt(ht*(ht+2*Z));const bt=Math.acos(ze/(Z+ht))-Math.acos(ot($,gt));ze*=Math.cos(bt)}return 1.01*ze}(c,this.pixelsPerMeter(c.center.lat,c.worldSize)),g=N0(c.zoom);if(g>0){const v=Ebe(c,Y(1,c.center.lat)*c.worldSize),N=c.worldSize/(2*Math.PI),C=Math.max(c.width,c.height)/c.worldSize*Math.PI;return zn(h,v+N*(1-Math.cos(C)),Math.pow(g,10))}return h}upVector(c,h,g){return nM(h,g,c,1)}upVectorScale(c){return{metersToTile:$f(T6(Zh(c)))}}}function Rbe(f){const c=f.parallels,h=!!c&&Math.abs(c[0]+c[1])<.01;switch(f.name){case"mercator":return new Pbe(f);case"equirectangular":return new uGe(f);case"naturalEarth":return new fGe(f);case"equalEarth":return new dGe(f);case"winkelTripel":return new pGe(f);case"albers":return h?new Dbe(f):new cGe(f);case"lambertConformalConic":return h?new Dbe(f):new hGe(f);case"globe":return new mGe(f)}throw new Error(`Invalid projection name: ${f.name}`)}const gGe=Ot.types,xGe=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function PM(f,c,h,g,v,N,C,L,F,$,K,Z,X){const re=L?Math.min(Tx,Math.round(L[0])):0,ae=L?Math.min(Tx,Math.round(L[1])):0;f.emplaceBack(c,h,Math.round(32*g),Math.round(32*v),N,C,(re<<1)+(F?1:0),0+(ae<<1),16*$,16*K,256*Z,256*X)}function LM(f,c,h){f.emplaceBack(c,h)}function OM(f,c,h,g,v,N,C){f.emplaceBack(c,h,g,v,N,C)}const oL=(f,c,h,g)=>{for(let v=0;v0&&(this.iconTransitioningVertexBuffer=c.createVertexBuffer(this.iconTransitioningVertexArray,NWe.members,!0)),this.globeExtVertexArray.length>0&&(this.globeExtVertexBuffer=c.createVertexBuffer(this.globeExtVertexArray,bWe.members,!0)),!this.zOffsetVertexBuffer&&(this.zOffsetVertexArray.length>0||N)&&(this.zOffsetVertexBuffer=c.createVertexBuffer(this.zOffsetVertexArray,jWe.members,!0)),!this.orientationVertexBuffer&&this.orientationVertexArray&&this.orientationVertexArray.length>0&&(this.orientationVertexBuffer=c.createVertexBuffer(this.orientationVertexArray,kWe.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())}}en(mle,"SymbolBuffers");class gle{constructor(c,h,g){this.layoutVertexArray=new c,this.layoutAttributes=h,this.indexArray=new g,this.segments=new Ui,this.collisionVertexArray=new U5,this.collisionVertexArrayExt=new ig}upload(c){this.layoutVertexBuffer=c.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=c.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=c.createVertexBuffer(this.collisionVertexArray,SWe.members,!0),this.collisionVertexBufferExt=c.createVertexBuffer(this.collisionVertexArrayExt,CWe.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy(),this.collisionVertexBufferExt.destroy())}}en(gle,"CollisionBuffers");class lL{constructor(c){this.collisionBoxArray=c.collisionBoxArray,this.zoom=c.zoom,this.overscaling=c.overscaling,this.layers=c.layers,this.layerIds=this.layers.map(C=>C.fqid),this.index=c.index,this.pixelRatio=c.pixelRatio,this.sourceLayerIndex=c.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.fullyClipped=!1,this.hasAnyIconTextFit=!1,this.sortKeyRanges=[],this.collisionCircleArray=[],this.placementInvProjMatrix=M([]),this.placementViewportMatrix=M([]);const h=this.layers[0]._unevaluatedLayout._values;this.worldview=c.worldview,this.localizable=c.localizable,this.textSizeData=n4(this.zoom,h["text-size"],this.worldview),this.iconSizeData=n4(this.zoom,h["icon-size"],this.worldview);const g=this.layers[0].layout,v=g.get("symbol-sort-key"),N=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=N!=="viewport-y"&&v.constantOr(1)!==void 0,this.sortFeaturesByY=(N==="viewport-y"||N==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,this.writingModes=g.get("text-writing-mode").map(C=>Fu[C]),this.stateDependentLayerIds=this.layers.filter(C=>C.isStateDependent()).map(C=>C.id),this.sourceID=c.sourceID,this.projection=c.projection,this.hasAnyZOffset=!1,this.zOffsetSortDirty=!1,this.zOffsetBuffersNeedUpload=!1,this.elevationType="none",this.elevationStateComplete=!1,this.activeReplacements=[],this.replacementUpdateTime=0,this.hasAnySecondaryIcon=!1,this.hasAppearances=null,this.lastActiveApperance=null,this.featureToAppearanceIndex={}}hasAnyAppearanceProperty(c){const h=this.layers[0].getAppearances();return!(!h||h.length===0)&&h.some(g=>g.getProperty(c)!=null)}createArrays(){this.text=new mle(new Gh(this.layers,{zoom:this.zoom,lut:this.lut},c=>c.startsWith("text")||c.startsWith("symbol"))),this.icon=new mle(new Gh(this.layers,{zoom:this.zoom,lut:this.lut},c=>c.startsWith("icon")||c.startsWith("symbol"))),this.glyphOffsetArray=new zN,this.lineVertexArray=new k6,this.symbolInstances=new Z5}calculateGlyphDependencies(c,h,g,v,N){for(const C of c){const L=C.codePointAt(0);if(L===void 0)break;if(h[L]=!0,v&&N&&L<=65535){const F=wM[C];F&&(h[F.charCodeAt(0)]=!0)}}}calculateEffectiveAppearanceIconSize(c,h,g,v,N,C){let L=1;const F=c.getUnevaluatedProperties()._values["icon-size"],$=n4(this.zoom,F,this.worldview),K=s4($,h);if($.kind!=="constant"&&$.kind!=="camera"||(L=K.uSize),$.kind==="composite"){const{minZoom:Z,maxZoom:X}=$,re=F.possiblyEvaluate(new oi(Z,{worldview:this.worldview}),v),ae=F.possiblyEvaluate(new oi(X,{worldview:this.worldview}),v),me=re.evaluate(g,{},v,N);L=me+(ae.evaluate(g,{},v,N)-me)*K.uSizeT}return $.kind==="source"&&(L=F.possiblyEvaluate(new oi(this.zoom,{worldview:this.worldview}),v).evaluate(g,{},v,N)),L*C}updateFootprints(c,h){}updateReplacement(c,h){if(h.updateTime===this.replacementUpdateTime)return!1;this.replacementUpdateTime=h.updateTime;const g=h.getReplacementRegionsForTile(c.toUnwrapped(),!0);return!D6(this.activeReplacements,g)&&(this.activeReplacements=g,!0)}getResolvedImageFromTokens(c){return typeof c=="string"?_d.build(c):c}populate(c,h,g,v){const N=this.layers[0],C=N.layout,L=this.projection.name==="globe",F=C.get("text-font"),$=C.get("text-field"),K=C.get("icon-image"),[Z,X]=C.get("icon-size-scale-range"),re=xe(h.scaleFactor||1,Z,X),ae=($.value.kind!=="constant"||$.value.value instanceof vd&&!$.value.value.isEmpty()||$.value.value.toString().length>0)&&(F.value.kind!=="constant"||F.value.value.length>0),me=K.value.kind!=="constant"||!!K.value.value||Object.keys(K.parameters).length>0,Se=this.hasAnyAppearanceProperty("icon-image"),Ne=C.get("symbol-sort-key");if(this.features=[],this.appearanceFeatureData=[],!ae&&!me&&!Se)return;const Fe=h.iconDependencies,ze=h.glyphDependencies,Xe=h.availableImages,gt=new oi(this.zoom,{worldview:this.worldview,activeFloors:h.activeFloors}),ht=bt=>{const Ct=bt.id.toString();Fe.has(Ct)?Fe.get(Ct).push(bt):Fe.set(Ct,[bt])};for(const bt of c){const{feature:Ct,id:Et,index:Xt,sourceLayerIndex:Rt}=bt,rr=N._featureFilter.needGeometry,lr=Dt(Ct,rr);if(!N._featureFilter.filter(gt,lr,g))continue;if(rr||(lr.geometry=St(Ct,g,v)),L&&Ct.type!==1&&g.z<=5){const xr=lr.geometry,Tr=.98078528056,jr=(xn,Vr)=>ot(nM(xn.x,xn.y,g,1),nM(Vr.x,Vr.y,g,1)){if(!xr.getProperty("icon-image"))return;const Tr=this.getCombinedIconPrimary(xr,_r,lr,g,Xe,tr,re);Tr&&ht(Tr)}),cr){const xr=F.evaluate(lr,{},g).join(","),Tr=C.get("text-rotation-alignment")==="map"&&C.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(Fu.vertical)>=0;for(const jr of cr.sections)if(jr.image){const xn=jr.image.getPrimary().scaleSelf(this.pixelRatio),Vr=xn.id.toString(),Qr=Fe.get(Vr)||[];Qr.push(xn),Fe.set(Vr,Qr)}else{const xn=e_(cr.toString()),Vr=jr.fontStack||xr,Qr=ze[Vr]=ze[Vr]||{};this.calculateGlyphDependencies(jr.text,Qr,Tr,this.allowVerticalPlacement,xn)}}}if(C.get("symbol-placement")==="line"&&(this.features=function(bt){const Ct={},Et={},Xt=[];let Rt=0;function rr(_r){Xt.push(bt[_r]),Rt++}function lr(_r,fr,gr){const tr=Et[_r];return delete Et[_r],Et[fr]=tr,Xt[tr].geometry[0].pop(),Xt[tr].geometry[0]=Xt[tr].geometry[0].concat(gr[0]),tr}function cr(_r,fr,gr){const tr=Ct[fr];return delete Ct[fr],Ct[_r]=tr,Xt[tr].geometry[0].shift(),Xt[tr].geometry[0]=gr[0].concat(Xt[tr].geometry[0]),tr}function yr(_r,fr,gr){const tr=gr?fr[0][fr[0].length-1]:fr[0][0];return`${_r}:${tr.x}:${tr.y}`}for(let _r=0;_r_r.geometry)}(this.features)),C.get("symbol-elevation-reference")==="hd-road-markup"){if(this.elevationType="road",h.elevationFeatures){!this.elevationFeatures&&h.elevationFeatures.length>0&&(this.elevationFeatures=[],this.elevationFeatureIdToIndex=new Map);for(const bt of h.elevationFeatures)this.elevationFeatureIdToIndex.set(bt.id,this.elevationFeatures.length),this.elevationFeatures.push(bt)}}else C.get("symbol-z-elevate")&&(this.elevationType="offset");this.elevationType!=="none"&&(this.zOffsetBuffersNeedUpload=!0),this.sortFeaturesByKey&&this.features.sort((bt,Ct)=>bt.sortKey-Ct.sortKey)}getCombinedIconPrimary(c,h,g,v,N,C,L){let F,$;const K=c.getUnevaluatedProperties();if(K._values["icon-image"].value!==void 0){const Z=h.getAppearanceValueAndResolveTokens(c,"icon-image",g,v,N);F=this.getResolvedImageFromTokens(Z)}else{const Z=h.getValueAndResolveTokens("icon-image",g,v,N);F=this.getResolvedImageFromTokens(Z)}if(F){const Z=K._values["icon-size"]||h._unevaluatedLayout._values["icon-size"];$=SM(F,n4(this.zoom,Z,this.worldview),Z,v,this.zoom,C,this.pixelRatio,L,this.worldview).iconPrimary}return $}updateAppearanceBasedIconTextures(c,h,g,v){if(!this.appearanceFeatureData||!this.icon.layoutVertexArray||this.icon.layoutVertexArray.length===0)return!1;const N=this.layers[0];let C=!1,L=0;const F=N.layout,[$,K]=F.get("icon-size-scale-range"),Z=xe(1,$,K);for(let X=0;X=0){const Se=me.id,Ne=h&&Se!==void 0?h[String(Se)]:void 0,Fe={type:"Point",id:me.id,properties:me.properties,geometry:[]},ze=this.layers[0].appearances&&this.layers[0].appearances.find(Xe=>Xe.isActive({globals:v,feature:Fe,canonical:c,featureState:Ne}));if(me.activeAppearance===ze){L+=re.numIconVertices;continue}if(ze){me.activeAppearance=ze;const Xe=this.getCombinedIconPrimary(ze,N,Fe,c,g,{sortKey:void 0,text:void 0,icon:null,index:re.featureIndex,sourceLayerIndex:re.featureIndex,geometry:[],properties:me.properties,type:"Point",id:me.id},Z);if(!Xe)continue;const gt=Xe.toString(),ht=this.iconAtlasPositions&&this.iconAtlasPositions.get(gt);if(ht){const bt=N.getAppearanceValueAndResolveTokens(ze,"icon-offset",Fe,c,g),Ct=bt&&Array.isArray(bt)?bt:[0,0];let Et=Q6(ht,void 0,Ct,N.layout.get("icon-anchor").evaluate(Fe,{},c));const Xt=N.getAppearanceValueAndResolveTokens(ze,"icon-rotate",Fe,c,g),Rt=typeof Xt=="number"?Xt:0,rr=ht.sdf,lr=N.layout.get("icon-text-fit").constantOr("none");lr!=="none"&&me.textShaping&&me.iconTextFitPadding&&me.fontScale&&(Et=ole(Et,me.textShaping,lr,me.iconTextFitPadding,Ct,me.fontScale));const cr=this.calculateEffectiveAppearanceIconSize(ze,v.zoom,Fe,c,g,Z),yr=0,_r=1+(Math.min(Tx,Math.round(cr*Wp))<<1),fr=ule(Et,Rt,rr,lr!=="none",Z);me.isUsingAppearanceVertexData||(me.isUsingAppearanceVertexData=!0,me.layoutBasedVertexData=this.icon.getIconVertexData(L,re.numIconVertices));for(let tr=0;tr0&&(this.icon.updateIconVertexData(L,0,0,0,0,0,0,0,0,0,0,0,0),this.icon.updateIconVertexData(L+1,0,0,0,0,0,0,0,0,0,0,0,0),this.icon.updateIconVertexData(L+2,0,0,0,0,0,0,0,0,0,0,0,0),this.icon.updateIconVertexData(L+3,0,0,0,0,0,0,0,0,0,0,0,0),C=!0),L+=re.numIconVertices,me.activeAppearance=null;else if(me.isUsingAppearanceVertexData){const gt=me.layoutBasedVertexData.length/12;for(let ht=0;ht0||X>0,Se=re>0,Ne=this.elevationFeatures[F.elevationFeatureIndex];if(Ne){const Fe=new sr(F.tileAnchorX,F.tileAnchorY),ze=.075+Ne.pointElevation(Fe);F.zOffset!==ze&&(h=!0,F.zOffset=ze),ze!==0&&(this.hasAnyZOffset=!0);const Xe=Ne.computeSlopeNormal(Fe,v),gt=kn(nt(),se(0,0,1),Xe);Ve($,$,gt),Ve(K,K,gt),$[2]*=g,K[2]*=g,$[0]===1&&$[1]===0&&$[2]===0&&K[0]===0&&K[1]===1&&K[2]===0||(N=N||me,C=C||Se)}if(me&&(oL(this.text.orientationVertexArray,Z,$,K),oL(this.text.orientationVertexArray,X,$,K)),Se){const{placedIconSymbolIndex:Fe,verticalPlacedIconSymbolIndex:ze}=F;Fe>=0&&oL(this.icon.orientationVertexArray,re,$,K),ze>=0&&oL(this.icon.orientationVertexArray,ae,$,K)}}N||(this.text.orientationVertexArray=void 0),C||(this.icon.orientationVertexArray=void 0),h&&(this.zOffsetBuffersNeedUpload=!0,this.zOffsetSortDirty=!0)}updateZOffset(){const c=(N,C,L)=>{g+=C,g>N.length&&N.resize(g);for(let F=-C;F<0;F++)N.emplace(F+g,L)},h=(N,C,L)=>{v+=C,v>N.length&&N.resize(v);for(let F=-C;F<0;F++)N.emplace(F+v,L)};if(!this.zOffsetBuffersNeedUpload)return;this.zOffsetBuffersNeedUpload=!1;let g=0,v=0;for(let N=0;N0;if((L>0||F>0)&&(c(this.text.zOffsetVertexArray,L,K),c(this.text.zOffsetVertexArray,F,K)),Z){const{placedIconSymbolIndex:X,verticalPlacedIconSymbolIndex:re}=C;X>=0&&h(this.icon.zOffsetVertexArray,$,K),re>=0&&h(this.icon.zOffsetVertexArray,C.numVerticalIconVertices,K)}}this.text.zOffsetVertexBuffer&&this.text.zOffsetVertexBuffer.updateData(this.text.zOffsetVertexArray),this.icon.zOffsetVertexBuffer&&this.icon.zOffsetVertexBuffer.updateData(this.icon.zOffsetVertexArray)}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(c,h,g,v,N){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(c),this.iconCollisionBox.upload(c)),this.text.upload(c,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload,this.zOffsetBuffersNeedUpload,!1),this.hasAppearances===null&&(this.hasAppearances=this.layers.some(C=>C.appearances&&C.appearances.length>0)),this.icon.upload(c,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload,this.zOffsetBuffersNeedUpload,this.hasAppearances),this.uploaded=!0}updateAppearances(c,h,g,v){return!!(c&&h&&g)&&!(!this.icon.layoutVertexArray||this.icon.layoutVertexArray.length===0)&&!!this.icon.layoutVertexArray.arrayBuffer&&void(this.updateAppearanceBasedIconTextures(c,h,g,v)&&this.icon.layoutVertexBuffer&&this.icon.layoutVertexArray.arrayBuffer!==null&&this.icon.layoutVertexArray.length===this.icon.layoutVertexBuffer.length&&this.icon.layoutVertexBuffer.updateData(this.icon.layoutVertexArray))}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}getProjection(){return this.projectionInstance||(this.projectionInstance=Rbe(this.projection)),this.projectionInstance}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(c,h){const g=this.lineVertexArray.length;if(c.segment!==void 0)for(const{x:v,y:N}of h)this.lineVertexArray.emplaceBack(v,N);return{lineStartIndex:g,lineLength:this.lineVertexArray.length-g}}addSymbols(c,h,g,v,N,C,L,F,$,K,Z,X,re,ae,me,Se,Ne,Fe){const ze=c.indexArray,Xe=c.layoutVertexArray,gt=c.globeExtVertexArray,ht=c.segments.prepareSegment(4*Fe,Xe,ze,this.canOverlap?C.sortKey:void 0),bt=this.glyphOffsetArray.length,Ct=ht.vertexLength,Et=this.allowVerticalPlacement&&L===Fu.vertical?Math.PI/2:0,Xt=C.text&&C.text.sections;for(let lr=0;lr=0?h.rightJustifiedTextSymbolIndex:h.centerJustifiedTextSymbolIndex>=0?h.centerJustifiedTextSymbolIndex:h.leftJustifiedTextSymbolIndex>=0?h.leftJustifiedTextSymbolIndex:h.verticalPlacedTextSymbolIndex>=0?h.verticalPlacedTextSymbolIndex:v),C=lle(this.textSizeData,c,N)/wl;return this.tilePixelRatio*C}getSymbolInstanceIconSize(c,h,g){const v=this.icon.placedSymbolArray.get(g),N=lle(this.iconSizeData,c,v);return this.tilePixelRatio*N}_commitDebugCollisionVertexUpdate(c,h,g,v){c.emplaceBack(h,-g,-g,v),c.emplaceBack(h,g,-g,v),c.emplaceBack(h,g,g,v),c.emplaceBack(h,-g,g,v)}_updateTextDebugCollisionBoxes(c,h,g,v,N,C,L){for(let F=v;F0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}hasIconTextFit(){return this.hasAnyIconTextFit}addIndicesForPlacedSymbol(c,h){const g=c.placedSymbolArray.get(h),v=g.vertexStartIndex+4*g.numGlyphs;for(let N=g.vertexStartIndex;Nv[L]-v[F]||N[F]-N[L]),C}getSortedIndexesByZOffset(){if(!this.zOffsetSortDirty)return this.symbolInstanceIndexesSortedZOffset;if(!this.symbolInstanceIndexesSortedZOffset){this.symbolInstanceIndexesSortedZOffset=[];for(let c=0;cthis.symbolInstances.get(h).zOffset-this.symbolInstances.get(c).zOffset)}addToSortKeyRanges(c,h){const g=this.sortKeyRanges[this.sortKeyRanges.length-1];g&&g.sortKey===h?g.symbolInstanceEnd=c+1:this.sortKeyRanges.push({sortKey:h,symbolInstanceStart:c,symbolInstanceEnd:c+1})}sortFeatures(c){if(this.sortFeaturesByY&&this.sortedAngle!==c&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(c),this.sortedAngle=c,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const h of this.symbolInstanceIndexes){const g=this.symbolInstances.get(h);this.featureSortOrder.push(g.featureIndex);const{rightJustifiedTextSymbolIndex:v,centerJustifiedTextSymbolIndex:N,leftJustifiedTextSymbolIndex:C,verticalPlacedTextSymbolIndex:L,placedIconSymbolIndex:F,verticalPlacedIconSymbolIndex:$}=g;v>=0&&this.addIndicesForPlacedSymbol(this.text,v),N>=0&&N!==v&&this.addIndicesForPlacedSymbol(this.text,N),C>=0&&C!==N&&C!==v&&this.addIndicesForPlacedSymbol(this.text,C),L>=0&&this.addIndicesForPlacedSymbol(this.text,L),F>=0&&this.addIndicesForPlacedSymbol(this.icon,F),$>=0&&this.addIndicesForPlacedSymbol(this.icon,$)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}getElevationFeatureForText(c){const h=this.symbolInstances.get(this.text.symbolInstanceIndices[c]).elevationFeatureIndex;let g;return this.elevationFeatures&&hg in f?String(f[g]):"")}let zbe,Bbe,xle;en(lL,"SymbolBucket",{omit:["layers","collisionBoxArray","compareText","features"]}),lL.addDynamicAttributes=l4;class $be{constructor(c){this.type=c.property.overrides?c.property.overrides.runtimeType:Uh,this.defaultValue=c}evaluate(c){if(c.formattedSection){const h=this.defaultValue.property.overrides;if(h&&h.hasOverride(c.formattedSection))return h.getOverride(c.formattedSection)}return c.feature&&c.featureState?this.defaultValue.evaluate(c.feature,c.featureState):this.defaultValue.property.specification.default}eachChild(c){this.defaultValue.isConstant()||c(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}en($be,"FormatSectionOverride",{omit:["defaultValue"]});const yle=()=>xle||(xle={layout:zbe||(zbe=new Ji({"symbol-placement":new Nr(Ft.layout_symbol["symbol-placement"]),"symbol-spacing":new Nr(Ft.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Nr(Ft.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new Pr(Ft.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Nr(Ft.layout_symbol["symbol-z-order"]),"symbol-z-elevate":new Nr(Ft.layout_symbol["symbol-z-elevate"]),"symbol-elevation-reference":new Nr(Ft.layout_symbol["symbol-elevation-reference"]),"icon-allow-overlap":new Nr(Ft.layout_symbol["icon-allow-overlap"]),"icon-ignore-placement":new Nr(Ft.layout_symbol["icon-ignore-placement"]),"icon-optional":new Nr(Ft.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Nr(Ft.layout_symbol["icon-rotation-alignment"]),"icon-size":new Pr(Ft.layout_symbol["icon-size"]),"icon-size-scale-range":new Nr(Ft.layout_symbol["icon-size-scale-range"]),"icon-text-fit":new Pr(Ft.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Pr(Ft.layout_symbol["icon-text-fit-padding"]),"icon-image":new Pr(Ft.layout_symbol["icon-image"]),"icon-image-use-theme":new Nr({type:"string",default:"default","property-type":"data-constant"}),"icon-rotate":new Pr(Ft.layout_symbol["icon-rotate"]),"icon-padding":new Nr(Ft.layout_symbol["icon-padding"]),"icon-keep-upright":new Nr(Ft.layout_symbol["icon-keep-upright"]),"icon-offset":new Pr(Ft.layout_symbol["icon-offset"]),"icon-anchor":new Pr(Ft.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Nr(Ft.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Nr(Ft.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Nr(Ft.layout_symbol["text-rotation-alignment"]),"text-field":new Pr(Ft.layout_symbol["text-field"]),"text-font":new Pr(Ft.layout_symbol["text-font"]),"text-size":new Pr(Ft.layout_symbol["text-size"]),"text-size-scale-range":new Nr(Ft.layout_symbol["text-size-scale-range"]),"text-max-width":new Pr(Ft.layout_symbol["text-max-width"]),"text-line-height":new Pr(Ft.layout_symbol["text-line-height"]),"text-letter-spacing":new Pr(Ft.layout_symbol["text-letter-spacing"]),"text-justify":new Pr(Ft.layout_symbol["text-justify"]),"text-radial-offset":new Pr(Ft.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Nr(Ft.layout_symbol["text-variable-anchor"]),"text-anchor":new Pr(Ft.layout_symbol["text-anchor"]),"text-max-angle":new Nr(Ft.layout_symbol["text-max-angle"]),"text-writing-mode":new Nr(Ft.layout_symbol["text-writing-mode"]),"text-rotate":new Pr(Ft.layout_symbol["text-rotate"]),"text-padding":new Nr(Ft.layout_symbol["text-padding"]),"text-keep-upright":new Nr(Ft.layout_symbol["text-keep-upright"]),"text-transform":new Pr(Ft.layout_symbol["text-transform"]),"text-offset":new Pr(Ft.layout_symbol["text-offset"]),"text-allow-overlap":new Nr(Ft.layout_symbol["text-allow-overlap"]),"text-ignore-placement":new Nr(Ft.layout_symbol["text-ignore-placement"]),"text-optional":new Nr(Ft.layout_symbol["text-optional"]),visibility:new Nr(Ft.layout_symbol.visibility)})),paint:Bbe||(Bbe=new Ji({"icon-opacity":new Pr(Ft.paint_symbol["icon-opacity"]),"icon-occlusion-opacity":new Pr(Ft.paint_symbol["icon-occlusion-opacity"]),"icon-emissive-strength":new Pr(Ft.paint_symbol["icon-emissive-strength"]),"text-emissive-strength":new Pr(Ft.paint_symbol["text-emissive-strength"]),"icon-color":new Pr(Ft.paint_symbol["icon-color"]),"icon-halo-color":new Pr(Ft.paint_symbol["icon-halo-color"]),"icon-halo-width":new Pr(Ft.paint_symbol["icon-halo-width"]),"icon-halo-blur":new Pr(Ft.paint_symbol["icon-halo-blur"]),"icon-translate":new Nr(Ft.paint_symbol["icon-translate"]),"icon-translate-anchor":new Nr(Ft.paint_symbol["icon-translate-anchor"]),"icon-image-cross-fade":new Nr(Ft.paint_symbol["icon-image-cross-fade"]),"text-opacity":new Pr(Ft.paint_symbol["text-opacity"]),"text-occlusion-opacity":new Pr(Ft.paint_symbol["text-occlusion-opacity"]),"text-color":new Pr(Ft.paint_symbol["text-color"],{runtimeType:Wd,getOverride:f=>f.textColor,hasOverride:f=>!!f.textColor}),"text-halo-color":new Pr(Ft.paint_symbol["text-halo-color"]),"text-halo-width":new Pr(Ft.paint_symbol["text-halo-width"]),"text-halo-blur":new Pr(Ft.paint_symbol["text-halo-blur"]),"text-translate":new Nr(Ft.paint_symbol["text-translate"]),"text-translate-anchor":new Nr(Ft.paint_symbol["text-translate-anchor"]),"icon-color-saturation":new Nr(Ft.paint_symbol["icon-color-saturation"]),"icon-color-contrast":new Nr(Ft.paint_symbol["icon-color-contrast"]),"icon-color-brightness-min":new Nr(Ft.paint_symbol["icon-color-brightness-min"]),"icon-color-brightness-max":new Nr(Ft.paint_symbol["icon-color-brightness-max"]),"symbol-z-offset":new Pr(Ft.paint_symbol["symbol-z-offset"]),"icon-color-use-theme":new Pr({type:"string",default:"default","property-type":"data-driven"}),"icon-halo-color-use-theme":new Pr({type:"string",default:"default","property-type":"data-driven"}),"text-color-use-theme":new Pr({type:"string",default:"default","property-type":"data-driven"}),"text-halo-color-use-theme":new Pr({type:"string",default:"default","property-type":"data-driven"})}))},xle);class cL extends jd{constructor(c,h,g,v){super(c,yle(),h,g,v,c.layout?c.layout["icon-image-use-theme"]:null),this._colorAdjustmentMatrix=M([]),this.hasOcclusionOpacityProperties=c.paint!==void 0&&("icon-occlusion-opacity"in c.paint||"text-occlusion-opacity"in c.paint)}_handleSpecialPaintPropertyUpdate(c){c!=="icon-occlusion-opacity"&&c!=="text-occlusion-opacity"||(this.hasOcclusionOpacityProperties=!0)}recalculate(c,h){super.recalculate(c,h),this.appearances&&this.appearances.forEach(v=>{v.recalculate(c,h,this.iconImageUseTheme)}),this.layout.get("icon-rotation-alignment")==="auto"&&(this.layout._values["icon-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-rotation-alignment")==="auto"&&(this.layout._values["text-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-pitch-alignment")==="auto"&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")),this.layout.get("icon-pitch-alignment")==="auto"&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment"));const g=this.layout.get("text-writing-mode");if(g){const v=[];for(const N of g)v.indexOf(N)<0&&v.push(N);this.layout._values["text-writing-mode"]=v}else this.layout._values["text-writing-mode"]=this.layout.get("symbol-placement")==="point"?["horizontal"]:["horizontal","vertical"];this._setPaintOverrides()}getColorAdjustmentMatrix(c,h,g,v){return this._saturation===c&&this._contrast===h&&this._brightnessMin===g&&this._brightnessMax===v||(this._colorAdjustmentMatrix=function(N,C,L,F){N=Li(N),C=ra(C);const $=S(),K=N/3,Z=1-2*K,X=[Z,K,K,0,K,Z,K,0,K,K,Z,0,0,0,0,1],re=.5-.5*C,ae=F-L;return T($,[ae,0,0,0,0,ae,0,0,0,0,ae,0,L,L,L,1],[C,0,0,0,0,C,0,0,0,0,C,0,re,re,re,1]),T($,$,X),$}(c,h,g,v),this._saturation=c,this._contrast=h,this._brightnessMin=g,this._brightnessMax=v),this._colorAdjustmentMatrix}getValueAndResolveTokens(c,h,g,v){const N=this.layout.get(c).evaluate(h,{},g,v),C=this._unevaluatedLayout._values[c];return C.isDataDriven()||Qv(C.value)||!N?N:Fbe(h.properties,N)}getAppearanceValueAndResolveTokens(c,h,g,v,N){const C=c.getProperty(h);if(!C)return;const L=C.evaluate(g,{},v,N),F=c.getUnevaluatedProperties()._values[h];return F.isDataDriven()||Qv(F.value)||!L||typeof L!="string"?L:Fbe(g.properties,L)}createBucket(c){return new lL(c)}queryRadius(){return 0}queryIntersectsFeature(){return!1}_setPaintOverrides(){for(const c of yle().paint.overridableProperties){if(!cL.hasPaintOverride(this.layout,c))continue;const h=this.paint.get(c),g=new $be(h),v=new mN(g,h.property.specification,this.scope,this.options,this.layout.get("icon-image-use-theme"));let N=null;N=h.value.kind==="constant"||h.value.kind==="source"?new f0("source",v):new gx("composite",v,h.value.zoomStops,h.value.interpolationType),this.paint._values[c]=new yx(h.property,N,h.parameters)}}_handleOverridablePaintPropertyUpdate(c,h,g){return!(!this.layout||h.isDataDriven()||g.isDataDriven())&&cL.hasPaintOverride(this.layout,c)}static hasPaintOverride(c,h){const g=c.get("text-field"),v=yle().paint.properties[h];let N=!1;const C=L=>{for(const F of L)if(v.overrides&&v.overrides.hasOverride(F))return void(N=!0)};if(g.value.kind==="constant"&&g.value.value instanceof vd)C(g.value.value.sections);else if(g.value.kind==="source"){const L=$=>{N||($ instanceof Ap&&bl($.value)===Rv?C($.value.sections):$ instanceof Pf?C($.sections):$.eachChild(L))},F=g.value;F._styleExpression&&L(F._styleExpression.expression)}return N}getProgramIds(){return["symbol"]}getDefaultProgramParams(c,h,g){return{config:new lg(this,{zoom:h,lut:g}),overrideFog:!1}}hasElevation(){return this.layout&&this.layout.get("symbol-elevation-reference")==="hd-road-markup"}}let Ube,qbe,Vbe,Hbe;var vle=Ds([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);function dL(f,c,h,g,v,N,C,L){const F=[f,c,1,h,g,1,v,N,1],$=[C,L,1],K=_([],F),[Z,X,re]=le($,$,K);return b(F,F,[Z,0,0,0,X,0,0,0,re])}function Wbe(f,c,h,g,v,N,C,L){const F=function($,K,Z,X,re,ae,me,Se){const Ne=dL(0,0,1,0,1,1,0,1),Fe=dL($,K,Z,X,re,ae,me,Se);return b(Fe,Fe,_([],Ne))}(f,c,h,g,v,N,C,L);return[F[2]/F[8]/Cr,F[5]/F[8]/Cr]}function uL(f){return[f[0],Math.min(Math.max(f[1],-ue),ue)]}class Gbe extends Is{constructor(c,h,g,v){super(),this.id=c,this.dispatcher=g,this.coordinates=h.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.onNorthPole=!1,this.onSouthPole=!1,this.setEventedParent(v),this.options=h,this._dirty=!1}load(c,h){if(this._loaded=h||!1,this.fire(new Er("dataloading",{dataType:"source"})),this.url=this.options.url,!this.url)return c&&(this.coordinates=c),this._loaded=!0,void this._finishLoading();this._imageRequest=Qy(this.map._requestManager.transformRequest(this.url,Mp.Image),(g,v)=>{this._imageRequest=null,this._loaded=!0,g?this.fire(new rs(g)):v&&(this.image=v instanceof HTMLImageElement?Xo.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 vM(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 Er("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 vM||this.texture.destroy(),this.boundsBuffer&&(this.boundsBuffer.destroy(),this.elevatedGlobeVertexBuffer&&this.elevatedGlobeVertexBuffer.destroy(),this.elevatedGlobeIndexBuffer&&this.elevatedGlobeIndexBuffer.destroy())}setCoordinates(c){if(this.coordinates=c,this._boundsArray=void 0,this._unsupportedCoords=!1,!c.length)return this;this.onNorthPole=!1,this.onSouthPole=!1;let h=c[0][1],g=c[0][1];for(const N of c)N[1]>g&&(g=N[1]),N[1]ue?this.onNorthPole=!0:v<-ue&&(this.onSouthPole=!0),!this.onNorthPole&&!this.onSouthPole){const N=c.map(We.fromLngLat);this.tileID=function(C){let L=1/0,F=1/0,$=-1/0,K=-1/0;for(const me of C)L=Math.min(L,me.x),F=Math.min(F,me.y),$=Math.max($,me.x),K=Math.max(K,me.y);const Z=Math.max($-L,K-F),X=Math.max(0,Math.floor(-Math.log2(Z))),re=Math.pow(2,X);let ae=Math.floor((L+$)/2*re);return ae>1&&(ae-=1),new Qa(X,ae,Math.floor((F+K)/2*re))}(N),this.minzoom=this.maxzoom=this.tileID.z}return this.fire(new Er("data",{dataType:"source",sourceDataType:"content"})),this}_clear(){!this.texture||this.texture instanceof vM||(this.texture.destroy(),this._dirty=!0),this.texture=null,this._boundsArray=void 0,this._unsupportedCoords=!1}_prepareData(c){for(const Ne in this.tiles){const Fe=this.tiles[Ne];Fe.state!=="loaded"&&(Fe.state="loaded",Fe.texture=this.texture)}if(this._boundsArray||this.onNorthPole||this.onSouthPole||this._unsupportedCoords)return;const h=MM(new Qa(0,0,0),this.map.transform.projection),g=[h.projection.project(this.coordinates[0][0],this.coordinates[0][1]),h.projection.project(this.coordinates[1][0],this.coordinates[1][1]),h.projection.project(this.coordinates[2][0],this.coordinates[2][1]),h.projection.project(this.coordinates[3][0],this.coordinates[3][1])];if(!function(Ne){const Fe=Ne[1].x-Ne[0].x,ze=Ne[1].y-Ne[0].y,Xe=Ne[2].x-Ne[1].x,gt=Ne[2].y-Ne[1].y,ht=Ne[3].x-Ne[2].x,bt=Ne[3].y-Ne[2].y,Ct=Ne[0].x-Ne[3].x,Et=Ne[0].y-Ne[3].y,Xt=Fe*gt-Xe*ze,Rt=Xe*bt-ht*gt,rr=ht*Et-Ct*bt,lr=Ct*ze-Fe*Et;return Xt>0&&Rt>0&&rr>0&&lr>0||Xt<0&&Rt<0&&rr<0&&lr<0}(g))return console.warn("Image source coordinates are defining non-convex area in the Mercator projection"),void(this._unsupportedCoords=!0);const v=MM(this.tileID,this.map.transform.projection),[N,C,L,F]=this.coordinates.map(Ne=>{const Fe=v.projection.project(Ne[0],Ne[1]);return Ibe(v,Fe)._round()});this.perspectiveTransform=Wbe(N.x,N.y,C.x,C.y,L.x,L.y,F.x,F.y);const $=this._boundsArray=new x0;$.emplaceBack(N.x,N.y,0,0),$.emplaceBack(C.x,C.y,Cr,0),$.emplaceBack(F.x,F.y,0,Cr),$.emplaceBack(L.x,L.y,Cr,Cr),this.boundsBuffer&&(this.boundsBuffer.destroy(),this.elevatedGlobeVertexBuffer&&this.elevatedGlobeVertexBuffer.destroy(),this.elevatedGlobeIndexBuffer&&this.elevatedGlobeIndexBuffer.destroy()),this.boundsBuffer=c.createVertexBuffer($,vle.members),this.boundsSegments=Ui.simpleSegment(0,0,4,2);const K=[],Z=[uL((X=this.coordinates)[0]),uL(X[1]),uL(X[2]),uL(X[3])];var X;const[re,ae,me,Se]=function(Ne){let Fe=Ne[0][0],ze=Fe,Xe=Ne[0][1],gt=Xe;for(let ht=1;htze&&(ze=Ne[ht][0]),Ne[ht][1]gt&&(gt=Ne[ht][1]);return[Fe,Xe,ze-Fe,gt-Xe]}(Z);{const Ne=new x0,[Fe,ze,Xe,gt]=function(fr){let gr=fr[0].x,tr=gr,Qt=fr[0].y,xr=Qt;for(let Tr=1;Trtr&&(tr=fr[Tr].x),fr[Tr].yxr&&(xr=fr[Tr].y);return[gr,Qt,tr-gr,xr-Qt]}(g),ht=fr=>[(fr.x-Fe)/Xe,(fr.y-ze)/gt],[bt,Ct,Et,Xt]=g.map(ht),Rt=function(fr,gr,tr,Qt,xr,Tr,jr,xn){const Vr=dL(0,0,1,0,1,1,0,1);return b(Vr,Vr,_([],dL(fr,gr,tr,Qt,xr,Tr,jr,xn)))}(bt[0],bt[1],Ct[0],Ct[1],Et[0],Et[1],Xt[0],Xt[1]);this.elevatedGlobePerspectiveTransform=Wbe(bt[0],bt[1],Ct[0],Ct[1],Et[0],Et[1],Xt[0],Xt[1]);const rr=(fr,gr)=>{K.push(fr.lng);const tr=Math.round((fr.lng-re)/me*Cr),Qt=Math.round((fr.lat-ae)/Se*Cr),xr=ht(gr),Tr=le([],[xr[0],xr[1],1],Rt),jr=Math.round(Tr[0]/Tr[2]*Cr),xn=Math.round(Tr[1]/Tr[2]*Cr);Ne.emplaceBack(tr,Qt,jr,xn)},lr=g[3].x-g[0].x,cr=g[3].y-g[0].y,yr=g[2].x-g[1].x,_r=g[2].y-g[1].y;for(let fr=0;fr<65;fr++){const gr=fr/64,tr=[g[0].x+gr*lr,g[0].y+gr*cr],Qt=[g[1].x+gr*yr,g[1].y+gr*_r],xr=Qt[0]-tr[0],Tr=Qt[1]-tr[1];for(let jr=0;jr<65;jr++){const xn=jr/64,Vr={x:tr[0]+xr*xn,y:tr[1]+Tr*xn};rr(h.projection.unproject(Vr.x,Vr.y),Vr)}}this.elevatedGlobeVertexBuffer=c.createVertexBuffer(Ne,vle.members)}{this.maxLongitudeTriangleSize=0;let Ne=[],Fe=new Qo;const ze=(Xe,gt,ht)=>{Fe.emplaceBack(Xe,gt,ht);const bt=K[Xe],Ct=K[gt],Et=K[ht],Xt=Math.min(Math.min(bt,Ct),Et),Rt=Math.max(Math.max(bt,Ct),Et)-Xt;Rt>this.maxLongitudeTriangleSize&&(this.maxLongitudeTriangleSize=Rt),Ne.push(Xt+Rt/2)};for(let Xe=0;Xe<64;Xe++)for(let gt=0;gt<64;gt++){const ht=65*Xe+gt,bt=ht+1,Ct=ht+65,Et=Ct+1;ze(ht,Ct,bt),ze(bt,Ct,Et)}[Ne,Fe]=function(Xe,gt){const ht=Array.from({length:Xe.length},(Et,Xt)=>Xt);ht.sort((Et,Xt)=>Xe[Et]-Xe[Xt]);const bt=[],Ct=new Qo;for(let Et=0;Et{C.segments.push({vertexOffset:0,primitiveOffset:Z,vertexLength:h.segments[0].vertexLength,primitiveLength:X,sortKey:void 0,vaos:{}})},F=.51*this.maxLongitudeTriangleSize;if(Math.abs(g[0]-v)<=F){const Z=Pi(g,0,g.length,v+F);return Z===g.length||L(Z,No(g,Z+1,g.length,v+360-F)-Z),C}vCr?v-Cr:v,new sr(Math.trunc(v),Math.trunc(g[h+1]))}translationForInstance(c){const h=16*c,g=this.instancedDataArray.float32;return[g[h+4],g[h+5],g[h+6]]}rotationScaleForInstance(c){const h=16*c,g=this.instancedDataArray.float32;return[g[h+7],g[h+8],g[h+9],g[h+10],g[h+11],g[h+12],g[h+13],g[h+14],g[h+15]]}transformForInstance(c){const h=16*c,g=this.instancedDataArray.float32;return[g[h+7],g[h+8],g[h+9],g[h+4],g[h+10],g[h+11],g[h+12],g[h+5],g[h+13],g[h+14],g[h+15],g[h+6],0,0,0,1]}}class wle{constructor(c){this.zoom=c.zoom,this.canonical=c.canonical,this.overscaledZ=this.canonical.z+Math.log2(c.overscaling),this.layers=c.layers,this.layerIds=this.layers.map(h=>h.fqid),this.projection=c.projection,this.index=c.index,this.worldview=c.worldview,this.hasZoomDependentProperties=this.layers[0].isZoomDependent(),this.stateDependentLayerIds=this.layers.filter(h=>h.isStateDependent()).map(h=>h.id),this.hasPattern=!1,this.instancesPerModel={},this.validForExaggeration=0,this.maxVerticalOffset=0,this.maxScale=0,this.maxHeight=0,this.lookupDim=this.zoom>this.canonical.z+1?0:this.zoom>this.canonical.z?256:this.zoom>15?75:100,this.instanceCount=0,this.terrainElevationMin=0,this.terrainElevationMax=0,this.validForDEMTile={id:null,timestamp:0},this.modelUris=[],this.modelsRequested=!1,this.activeReplacements=[],this.replacementUpdateTime=0,this.styleDefinedModelURLs=c.styleDefinedModelURLs,this.hasAppearances=null}updateFootprints(c,h){}updateAppearances(c,h,g,v){}populate(c,h,g,v){this.tileToMeter=Le(g);const N=this.layers[0]._featureFilter.needGeometry;this.lookup=new Uint8Array(this.lookupDim*this.lookupDim);for(const{feature:C,id:L,index:F,sourceLayerIndex:$}of c){const K=L??(C.properties&&C.properties.hasOwnProperty("id")?C.properties.id:void 0),Z=Dt(C,N);if(!this.layers[0]._featureFilter.filter(new oi(this.zoom,{worldview:this.worldview,activeFloors:h.activeFloors}),Z,g))continue;const X={id:K,sourceLayerIndex:$,index:F,geometry:N?Z.geometry:St(C,g,v),properties:C.properties,type:C.type,patterns:{}},re=this.addFeature(X,X.geometry,Z);re&&h.featureIndex.insert(C,X.geometry,F,$,this.index,this.instancesPerModel[re].instancedDataArray.length,Cr/32)}this.lookup=null}evaluateQueryRenderedFeaturePadding(){const c=this.layers[0].modelManager,h=this.layers[0].scope;let g=0;for(const v of this.modelUris){const N=c.getModel(v,h);if(!N)continue;const C=this.instancesPerModel[v];if(C){const L=.5*Te(N.aabb.max,N.aabb.min)*C.maxScale+C.maxXYTranslationDistance,F=Math.min(Cr,Math.max(L/this.tileToMeter,Cr/32));g=Math.max(F,g)}}return g}update(c,h,g,v){for(const N in this.instancesPerModel){const C=this.instancesPerModel[N];for(const L in c)C.idToFeaturesIndex.hasOwnProperty(L)&&(this.evaluate(C.features[C.idToFeaturesIndex[L]],c[L],C,!0),this.uploaded=!1)}this.maxHeight=0}updateZoomBasedPaintProperties(){if(!this.hasZoomDependentProperties)return!1;let c=!1;for(const h in this.instancesPerModel){const g=this.instancesPerModel[h];for(const v of g.features){const N=this.layers[0],C=v.feature,L=this.canonical,F=N.paint.get("model-rotation").evaluate(C,{},L),$=N.paint.get("model-scale").evaluate(C,{},L),K=N.paint.get("model-translation").evaluate(C,{},L);st(v.rotation,F)&&st(v.scale,$)&&st(v.translation,K)||(this.evaluate(v,v.featureStates,g,!0),c=!0)}}return c}updateReplacement(c,h,g,v){if(h.updateTime===this.replacementUpdateTime)return!1;this.replacementUpdateTime=h.updateTime;const N=h.getReplacementRegionsForTile(c.toUnwrapped(),!0);if(D6(this.activeReplacements,N))return!1;this.activeReplacements=N;let C=!1;for(const L in this.instancesPerModel){const F=this.instancesPerModel[L],$=F.instancedDataArray;for(const K of F.features){const Z=K.instancedDataOffset,X=K.instancedDataCount;for(let re=0;reCr;me=Se?me-Cr:me;const Ne=Math.floor(me),Fe=Math.floor($.float32[ae+1]);let ze=!1;for(const Xe of this.activeReplacements)if(!qve(Xe,g,t2e.Model,v)&&!(Xe.min.x>Ne||Ne>Xe.max.x||Xe.min.y>Fe||Fe>Xe.max.y)&&(ze=Kve(Gve(Ne,Fe,c.canonical,Xe.footprintTileId.canonical),Xe.footprint),ze))break;$.float32[ae]=ze?me+Cr:me,C=C||ze!==Se}}}return C}isEmpty(){for(const c in this.instancesPerModel)if(this.instancesPerModel[c].instancedDataArray.length!==0)return!1;return!0}uploadPending(){return!this.uploaded}upload(c){if(!this.uploaded)for(const h in this.instancesPerModel){const g=this.instancesPerModel[h];g.instancedDataArray.length<0||g.instancedDataArray.length===0||(g.instancedDataBuffer?g.instancedDataBuffer.updateData(g.instancedDataArray):g.instancedDataBuffer=c.createVertexBuffer(g.instancedDataArray,qHe.members,!0,void 0,this.instanceCount))}this.uploaded=!0}destroy(c){for(const g in this.instancesPerModel){const v=this.instancesPerModel[g];v.instancedDataArray.length!==0&&v.instancedDataBuffer&&v.instancedDataBuffer.destroy()}const h=this.layers[0].modelManager;if(c&&h&&this.modelUris&&this.modelsRequested)for(const g of this.modelUris)h.removeModel(g,"",!0)}addFeature(c,h,g){const v=this.layers[0],N=v.layout.get("model-id").evaluate(g,{},this.canonical);if(!N)return Wr(`modelId is not evaluated for layer ${v.id} and it is not going to get rendered.`),N;(ble(N,!1)||this.styleDefinedModelURLs[N]!==void 0)&&(this.modelUris.includes(N)||this.modelUris.push(N)),this.instancesPerModel[N]||(this.instancesPerModel[N]=new n2e);const C=this.instancesPerModel[N],L=C.instancedDataArray,F=new r2e(g,L.length);for(const $ of h)for(const K of $){if(K.x<0||K.x>=Cr||K.y<0||K.y>=Cr)continue;if(this.lookupDim!==0){const X=(this.lookupDim-1)/Cr,re=this.lookupDim*(K.y*X|0)+K.x*X|0;if(this.lookup){if(this.lookup[re]!==0)continue;this.lookup[re]=1}}this.instanceCount++;const Z=L.length;L.resize(Z+1),C.instancesEvaluatedElevation.push(0),L.float32[16*Z]=K.x,L.float32[16*Z+1]=K.y}return F.instancedDataCount=C.instancedDataArray.length-F.instancedDataOffset,F.instancedDataCount>0&&(c.id&&(C.idToFeaturesIndex[c.id]=C.features.length),C.features.push(F),this.evaluate(F,{},C,!1)),N}getModelUris(){return this.modelUris}evaluate(c,h,g,v){const N=this.layers[0],C=c.feature,L=this.canonical,F=c.rotation=N.paint.get("model-rotation").evaluate(C,h,L),$=c.scale=N.paint.get("model-scale").evaluate(C,h,L),K=c.translation=N.paint.get("model-translation").evaluate(C,h,L),Z=Object.assign({},N.paint.get("model-color").evaluate(C,h,L));Z.a=N.paint.get("model-color-mix-intensity").evaluate(C,h,L);const X=[];this.maxVerticalOffset0?Math.sqrt(re):0;g.maxScale=Math.max(Math.max(g.maxScale,$[0]),Math.max($[1],$[2])),g.maxXYTranslationDistance=Math.max(g.maxXYTranslationDistance,ae),this.maxScale=Math.max(Math.max(this.maxScale,$[0]),Math.max($[1],$[2])),L_e(X,F,$);const me=Math.round(100*Z.a)+Z.b/1.05;for(let Se=0;Se10?this.tileToMeter:Le(L,gt)),ze[Fe+4]=K[0],ze[Fe+5]=K[1],ze[Fe+6]=K[2]+Xe,ze[Fe+7]=X[0],ze[Fe+8]=X[1],ze[Fe+9]=X[2],ze[Fe+10]=X[4],ze[Fe+11]=X[5],ze[Fe+12]=X[6],ze[Fe+13]=X[8],ze[Fe+14]=X[9],ze[Fe+15]=X[10],g.instancesEvaluatedElevation[Ne]=K[2]}}}let s2e,a2e;en(wle,"ModelBucket",{omit:["layers"]}),en(n2e,"PerModelAttributes"),en(r2e,"ModelFeature");class c4{constructor(c,h,g){this._demTile=c,this._dem=this._demTile.dem,this._scale=h,this._offset=g}static create(c,h,g){const v=g||c.findDEMTileFor(h);if(!v||!v.dem)return;const N=v.dem,C=v.tileID,L=1<$.fqid),this.stateDependentLayerIds=this.layers.filter($=>$.isStateDependent()).map($=>$.id),this.modelTraits|=e4.CoordinateSpaceTile,this.uploaded=!1,this.hasPattern=!1,v&&(this.modelTraits|=e4.HasMapboxMeshFeatures),N&&(this.modelTraits|=e4.HasMeshoptCompression),this.zoom=-1,this.terrainExaggeration=1,this.projection={name:"mercator"},this.replacementUpdateTime=0,this.elevationReadFromZ=255,this.brightness=C,this.worldview=F,this.dirty=!0,this.needsUpload=!1,this.filter=null,this.nodesInfo=[];for(const $ of h)this.nodesInfo.push(new c2e($)),o2e($,L.featureIndexArray.length,L.grid),L.featureIndexArray.emplaceBack(this.nodesInfo.length-1,0,L.bucketLayerIDs.length-1,0);this.states={},this.hasAppearances=null}updateFootprints(c,h){for(const g of this.getNodesInfo()){const v=g.node;v.footprint&&h.push({footprint:v.footprint,id:c})}}updateAppearances(c,h,g,v){}update(c){const h=Object.keys(c).length!==0;if(h&&!this.stateDependentLayers.length)return;const g=h?this.stateDependentLayers:this.layers;if(!Ia(c,this.states))for(const v of g)this.evaluate(v,c);this.states=structuredClone(c)}populate(){console.log("populate 3D model bucket")}uploadPending(){return!this.uploaded||this.needsUpload}upload(c){if(!this.needsUpload)return;const h=this.getNodesInfo();for(const g of h){const v=g.node;this.uploaded?this.updatePbrBuffer(v):Goe(v,c,!0)}for(const g of h)K6(g.node);this.uploaded=!0,this.needsUpload=!1}updatePbrBuffer(c){let h=!1;if(!c.meshes)return h;for(const g of c.meshes)g.pbrBuffer&&(g.pbrBuffer.updateData(g.featureArray),h=!0);return h}needsReEvaluation(c,h,g){const v=c.transform.projectionOptions,N=c.style.getBrightness(),C=this.brightness!==N;if(!this.uploaded||this.dirty||v.name!==this.projection.name||DM(g.paint.get("model-color").value,C)||DM(g.paint.get("model-color-mix-intensity").value,C)||DM(g.paint.get("model-roughness").value,C)||DM(g.paint.get("model-emissive-strength").value,C)||DM(g.paint.get("model-height-based-emissive-strength-multiplier").value,C)){this.projection=v,this.brightness=N;const L=this.getNodesInfo();for(const F of L)F.state=null;return!0}return!1}evaluateTransform(c,h){if(c.transform.zoom===this.zoom)return;this.zoom=c.transform.zoom;const g=this.getNodesInfo(),v=this.id.canonical;for(const N of g){const C=N.feature;N.evaluatedTranslation=h.paint.get("model-translation").evaluate(C,{},v),N.evaluatedScale=h.paint.get("model-scale").evaluate(C,{},v)}}evaluate(c,h){const g=this.getNodesInfo();for(const v of g){if(!v.node.meshes)continue;const N=v.feature,C=h&&h[N.id];if(Ia(C,v.state))continue;v.state=structuredClone(C);const L=v.node.meshes&&v.node.meshes[0].featureData,F=v.evaluatedColor[2],$=v.evaluatedRMEA[2],K=this.id.canonical;if(v.hasTranslucentParts=!1,L){for(let Z=0;Z=ht)continue;const fr=jle[_r],gr=Math.abs(fr);gr>Rt&&(Xt=fr,Rt=gr,rr=yr,lr=cr)}if(Rt>.1){const cr=1-(ht+.5*Math.abs(rr*lr))/ae;let yr=h._dem.get(Ct,bt)+Xt*cr;const _r=h._dem.get(Ct+rr,bt+lr),fr=h._dem.get(Ct-rr,bt-lr,!0);(yr-_r)*(yr-fr)>0&&(yr=(_r+fr)/2),jle[Et]=h._dem.set(Ct,bt,yr),__[Et]=ht}}}}}L&&(h._demTile.needsDEMTextureUpload=!0,h._dem._timestamp=Xo.now())}setFilter(c){this.filter=c?kN(c):null}getNodesInfo(){return this.filter?this.nodesInfo.filter(c=>this.filter.filter(new oi(this.id.overscaledZ,{worldview:this.worldview}),c.feature,this.id.canonical)):this.nodesInfo}destroy(){const c=this.getNodesInfo();for(const h of c)K6(h.node),Koe(h.node)}isEmpty(){return!this.nodesInfo.length}updateReplacement(c,h){if(h.updateTime===this.replacementUpdateTime)return;this.replacementUpdateTime=h.updateTime;const g=h.getReplacementRegionsForTile(c.toUnwrapped());for(const v of this.getNodesInfo()){const N=v.node.footprint;v.hiddenByReplacement=!!N&&!g.find(C=>C.footprint===N)}}getHeightAtTileCoord(c,h){const g=[],v=[0,0,0],N=M([]);for(const C of this.getNodesInfo()){const L=C.node.meshes[0],F=L.transformedAabb;if(cF.max[0]||h>F.max[1])continue;if(C.node.hidden===!0)return{height:1/0,maxHeight:C.feature.properties.height,hidden:!1,verticalScale:C.evaluatedScale[2]};P(N,C.node.globalMatrix),v[0]=c,v[1]=h,at(v,v,N);const $=(v[0]-L.aabb.min[0])/(L.aabb.max[0]-L.aabb.min[0])*x_|0,K=Math.min(63,(v[1]-L.aabb.min[1])/(L.aabb.max[1]-L.aabb.min[1])*x_|0)*x_+Math.min(63,$),Z=L.heightmap[K];if(!(Z<0&&C.node.footprint))return C.hiddenByReplacement?void 0:{height:Z,maxHeight:C.feature.properties.height,hidden:!1,verticalScale:C.evaluatedScale[2]};if(C.node.footprint.grid.query(new sr(c,h),new sr(c,h),g),g.length>0)return{height:void 0,maxHeight:C.feature.properties.height,hidden:C.hiddenByReplacement,verticalScale:C.evaluatedScale[2]}}}}function DM(f,c){return f instanceof f0&&!f.isLightConstant&&c}function bGe(f,c,h,g,v,N,C,L){let F=(61440&c|(61440&c)>>4)>>8,$=(3840&c|(3840&c)>>4)>>4,K=240&c|(240&c)>>4;h[3]>0&&(F=zn(F,255*h[0],h[3]),$=zn($,255*h[1],h[3]),K=zn(K,255*h[2],h[3]));const Z=F<<8|$,X=K<<8|Math.floor(255*g[3]),re=function(ht){const bt=xe(ht,0,2);return Math.min(Math.round(.5*bt*255),255)}(g[2])<<8|15*g[0]<<4|15*g[1],ae=xe(v[0],0,1),me=xe(v[1],0,1),Se=xe(v[2],0,1),Ne=xe(v[3],0,1);let Fe,ze,Xe,gt;if(ae!==me&&C!==N&&me!==ae){const ht=C-N;ze=1/(ht*(me-ae)),Xe=-(N+ht*ae)/(ht*(me-ae));const bt=xe(v[4],-1,1);gt=Math.pow(10,bt),Fe=255*Se<<8|255*Ne}else Fe=65535,ze=0,Xe=1,gt=1;if(f.emplaceBack(Z,X,re,Fe,ze,Xe,gt),L){const ht=L.length;L.clear();for(let bt=0;bt>16&65535,K=N?F>>16&65535:65535&F,Z=(15&K)<8?15&K:0,X=f.evaluatedRMEA[Z],re=f.evaluatedColor[Z],ae=f.emissionHeightBasedParams[Z];let me;if(L&&Z===2&&g.lights&&(me=new ON,me.resize(10*g.lights.length)),bGe(C.featureArray,$,re,X,ae,C.aabb.min[2],C.aabb.max[2],me),me&&L){L=!1;const Se=g.meshes[g.lightMeshIndex];Se.featureArray=me,Se.featureArray._trim()}}C.featureArray._trim(),v++}}en(fL,"Tiled3dModelBucket",{omit:["layers"]}),en(c2e,"Tiled3dModelFeature");const jGe=["id","tile","layer","source","sourceLayer","state"];class b_{constructor(c,h,g,v,N){this.type="Feature",this._vectorTileFeature=c,this._z=h,this._x=g,this._y=v,this.properties=c?c.properties:{},this.id=N}clone(){const c=new b_(this._vectorTileFeature,this._z,this._x,this._y,this.id);return this.state&&(c.state=Object.assign({},this.state)),this.layer&&(c.layer=Object.assign({},this.layer)),this.source&&(c.source=this.source),this.sourceLayer&&(c.sourceLayer=this.sourceLayer),c}get geometry(){return this._geometry===void 0&&this._vectorTileFeature&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._x,this._y,this._z).geometry),this._geometry}set geometry(c){this._geometry=c}toJSON(){const c={type:"Feature",state:void 0,geometry:this.geometry,properties:this.properties};for(const h of jGe)this[h]!==void 0&&(c[h]=this[h]);return c}}class w_ extends Is{constructor(c,h,g,v){super(),this.id=c,this.type="model",this.models=[],this._loaded=!1,this._options=h,this._modelsInfo=new Map}load(){const c=[];for(const h in this._options.models){const g=this._options.models[h],v=this._modelsInfo.get(h);if(v){const N=v.model;N.position=g.position!=null?new m(g.position[0],g.position[1]):new m(0,0),N.orientation=g.orientation!=null?g.orientation:[0,0,0],v.modelSpec=g,w_.applyModelSpecification(N,g),N.computeBoundsAndApplyParent(),this.models.push(N)}else{const N=A_e(this.map._requestManager.transformRequest(g.uri,Mp.Model).url).then(C=>{if(!C)return;const L=Yoe(C),F=new O_e(h,g.uri,g.position,g.orientation,L);w_.applyModelSpecification(F,g),F.computeBoundsAndApplyParent(),this.models.push(F),this._modelsInfo.set(h,{modelSpec:g,model:F})}).catch(C=>{this.fire(new rs(new Error(`Could not load model ${h} from ${g.uri}: ${C.message}`)))});c.push(N)}}Promise.allSettled(c).then(()=>{this._loaded=!0,this.fire(new Er("data",{dataType:"source",sourceDataType:"metadata"}))}).catch(h=>{this._loaded=!0,this.fire(new rs(new Error(`Could not load models: ${h.message}`)))})}static applyModelSpecification(c,h){h.nodeOverrides&&w_.convertNodeOverrides(c,h.nodeOverrides),h.materialOverrides&&w_.convertMaterialOverrides(c,h.materialOverrides),h.nodeOverrideNames&&(c.nodeOverrideNames=[...h.nodeOverrideNames]),h.materialOverrideNames&&(c.materialOverrideNames=[...h.materialOverrideNames]),h.featureProperties&&(c.featureProperties=h.featureProperties)}static convertNodeOverrides(c,h){if(Array.isArray(h)&&h.every(g=>typeof g=="string")){c.nodeOverrideNames=[];for(const g of h)c.nodeOverrideNames.push(g)}else Object.entries(h).forEach(([g,v])=>{const N={orientation:[0,0,0]};if(v.hasOwnProperty("orientation")){const C=v.orientation;C&&(N.orientation=C)}c.nodeOverrides.set(g,N)})}static convertMaterialOverrides(c,h){if(Array.isArray(h)&&h.every(g=>typeof g=="string")){c.materialOverrideNames=[];for(const g of h)c.materialOverrideNames.push(g)}else Object.entries(h).forEach(([g,v])=>{const N={color:new ba(1,1,1),colorMix:0,emissionStrength:0,opacity:1},C=v["model-color"];C!==void 0&&(N.color.r=C[0],N.color.g=C[1],N.color.b=C[2]);const L=v["model-color-mix-intensity"];L!==void 0&&(N.colorMix=L);const F=v["model-emissive-strength"];F!==void 0&&(N.emissionStrength=F);const $=v["model-opacity"];$!==void 0&&(N.opacity=$),c.materialOverrides.set(g,N)})}onAdd(c){this.map=c,this.load()}hasTransition(){return!1}loaded(){return this._loaded}getModels(){return this.models}loadTile(c,h){}serialize(){return this._options}setProperty(c,h){return!1}reload(){const c=Wh(this.id,this.scope);this.map.style.clearSource(c),this.models=[],this._modelsInfo.clear(),this._loaded=!1,this.load()}setModels(c){this.models=[];const h=new Map;for(const g in c){const v=c[g];if(this._modelsInfo.has(g)){const N=this._modelsInfo.get(g);N&&N.modelSpec.uri===v.uri&&h.set(g,N)}}this._modelsInfo=h,this._options.models=c,this._loaded=!1,this.load()}}function kle(f,c,h,g){const v=1<Xe.polygon).flat());const Se=re?L:null,[Ne,Fe]=y_e(N,g,Z,K,$,C,Se,X,ae,N.center.lat,f.tileID.canonical),ze=f.queryGeometry;return x_e(Ne,Fe,ze.isPointQuery()?ze.screenBounds:ze.screenGeometry)}},building:class extends jd{constructor(f,c,h,g){super(f,{layout:U_e||(U_e=new Ji({visibility:new Nr(Ft.layout_building.visibility),"building-facade":new Pr(Ft.layout_building["building-facade"]),"building-facade-floors":new Pr(Ft.layout_building["building-facade-floors"]),"building-facade-unit-width":new Pr(Ft.layout_building["building-facade-unit-width"]),"building-facade-window":new Pr(Ft.layout_building["building-facade-window"]),"building-roof-shape":new Pr(Ft.layout_building["building-roof-shape"]),"building-height":new Pr(Ft.layout_building["building-height"]),"building-base":new Pr(Ft.layout_building["building-base"]),"building-flood-light-wall-radius":new Pr(Ft.layout_building["building-flood-light-wall-radius"]),"building-flood-light-ground-radius":new Pr(Ft.layout_building["building-flood-light-ground-radius"]),"building-flip-roof-orientation":new Pr(Ft.layout_building["building-flip-roof-orientation"])})),paint:q_e||(q_e=new Ji({"building-opacity":new Nr(Ft.paint_building["building-opacity"]),"building-ambient-occlusion-intensity":new Nr(Ft.paint_building["building-ambient-occlusion-intensity"]),"building-ambient-occlusion-ground-intensity":new Nr(Ft.paint_building["building-ambient-occlusion-ground-intensity"]),"building-ambient-occlusion-ground-radius":new Nr(Ft.paint_building["building-ambient-occlusion-ground-radius"]),"building-ambient-occlusion-ground-attenuation":new Nr(Ft.paint_building["building-ambient-occlusion-ground-attenuation"]),"building-vertical-scale":new Nr(Ft.paint_building["building-vertical-scale"]),"building-cast-shadows":new Nr(Ft.paint_building["building-cast-shadows"]),"building-color":new Pr(Ft.paint_building["building-color"]),"building-emissive-strength":new Pr(Ft.paint_building["building-emissive-strength"]),"building-facade-emissive-chance":new Nr(Ft.paint_building["building-facade-emissive-chance"]),"building-cutoff-fade-range":new Nr(Ft.paint_building["building-cutoff-fade-range"]),"building-flood-light-color":new Nr(Ft.paint_building["building-flood-light-color"]),"building-flood-light-intensity":new Nr(Ft.paint_building["building-flood-light-intensity"]),"building-flood-light-ground-attenuation":new Nr(Ft.paint_building["building-flood-light-ground-attenuation"]),"building-color-use-theme":new Pr({type:"string",default:"default","property-type":"data-driven"}),"building-flood-light-color-use-theme":new Pr({type:"string",default:"default","property-type":"data-driven"})}))},c,h,g),this._stats={numRenderedVerticesInShadowPass:0,numRenderedVerticesInTransparentPass:0}}createBucket(f){return new $_e(f)}cutoffRange(){return this.paint.get("building-cutoff-fade-range")}hasShadowPass(){return this.paint.get("building-cast-shadows")}hasLightBeamPass(){return!0}canCastShadows(){return!0}is3D(f){return!0}queryRadius(f){return 0}queryIntersectsFeature(f,c,h,g,v,N,C,L,F){let $=this.layout.get("building-height").evaluate(c,h);const K=this.layout.get("building-base").evaluate(c,h),Z=f.tile.getBucket(this).getFootprint(c);if(Z){if(Z.hiddenFlags!==0)return!1;$=Z.height}const[X,re]=y_e(N,g,K,$,new sr(0,0),C,null,[0,0],1,N.center.lat,f.tileID.canonical),ae=f.queryGeometry;return x_e(X,re,ae.isPointQuery()?ae.screenBounds:ae.screenGeometry)}},line:class extends jd{constructor(f,c,h,g){const v=J_e();super(f,v,c,h,g),v.layout&&(this.layout=new vx(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 Wv,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(bM)return bM;const h=J_e();return bM=new vWe(h.paint.properties["line-width"].specification),bM.useIntegerZoom=!0,bM})().possiblyEvaluate(this._transitioningPaint._values["line-width"].value,f)}createBucket(f){return new Joe(f)}getProgramIds(){return[this.paint.get("line-pattern").constantOr(1)?"linePattern":"line"]}getDefaultProgramParams(f,c,h){const g=X_e(this);return{config:new lg(this,{zoom:c,lut:h}),defines:g,overrideFog:!1}}queryRadius(f){const c=f,h=ebe(Pc("line-width",this,c),Pc("line-gap-width",this,c)),g=Pc("line-offset",this,c);return h/2+Math.abs(g)+Gl(this.paint.get("line-translate"))}queryIntersectsFeature(f,c,h,g,v,N){if(f.queryGeometry.isAboveHorizon)return!1;const C=Du(f.tilespaceGeometry,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),N.angle,f.pixelToTileUnitsFactor),L=f.pixelToTileUnitsFactor/2*ebe(this.paint.get("line-width").evaluate(c,h),this.paint.get("line-gap-width").evaluate(c,h)),F=this.paint.get("line-offset").evaluate(c,h);return F&&(g=function($,K){const Z=[],X=new sr(0,0);for(let re=0;re<$.length;re++){const ae=$[re],me=[];for(let Se=0;Se=3){for(let ae=0;ae>16&255)/255,(f>>8&255)/255,(255&f)/255,1)}function FGe(f,c,h){f===1?(c.rgb_color=xL(h.readVarint()),c.paint="rgb_color"):f===2?(c.linear_gradient_idx=h.readVarint(),c.paint="linear_gradient_idx"):f===3?(c.radial_gradient_idx=h.readVarint(),c.paint="radial_gradient_idx"):f===5?h.readPackedFloat(c.dasharray):f===6?c.dashoffset=h.readFloat():f===7?c.miterlimit=h.readFloat():f===8?c.opacity=h.readVarint():f===9?c.width=h.readFloat():f===10?c.linecap=h.readVarint():f===11&&(c.linejoin=h.readVarint())}function zGe(f,c,h){f===1?c.transform=gL(h,h.readVarint()+h.pos):f===2?c.spread_method=h.readVarint():f===3?c.stops.push(f2e(h,h.readVarint()+h.pos)):f===4?c.x1=h.readFloat():f===5?c.y1=h.readFloat():f===6?c.x2=h.readFloat():f===7&&(c.y2=h.readFloat())}function f2e(f,c){return f.readFields(BGe,{offset:0,opacity:255,rgb_color:Nle},c)}function BGe(f,c,h){f===1?c.offset=h.readFloat():f===2?c.opacity=h.readVarint():f===3&&(c.rgb_color=xL(h.readVarint()))}function $Ge(f,c,h){f===1?c.transform=gL(h,h.readVarint()+h.pos):f===2?c.spread_method=h.readVarint():f===3?c.stops.push(f2e(h,h.readVarint()+h.pos)):f===4?c.cx=h.readFloat():f===5?c.cy=h.readFloat():f===6?c.r=h.readFloat():f===7?c.fx=h.readFloat():f===8?c.fy=h.readFloat():f===9&&(c.fr=h.readFloat())}function UGe(f,c,h){f===1?c.transform=gL(h,h.readVarint()+h.pos):f===2?c.clip_path_idx=h.readVarint():f===3&&c.children.push(mL(h,h.readVarint()+h.pos))}function qGe(f,c,h){f===1?c.left=c.top=h.readFloat():f===2?c.width=c.height=h.readFloat():f===3?c.top=h.readFloat():f===4?c.height=h.readFloat():f===5?c.mask_type=h.readVarint():f===6?c.mask_idx=h.readVarint():f===7&&c.children.push(mL(h,h.readVarint()+h.pos))}class VGe{static calculate(c={},h=[]){const g=new Map,v=new Map;if(Object.keys(c).length===0)return g;h.forEach(N=>{v.set(N.name,N.rgb_color||new ba(0,0,0))});for(const[N,C]of Object.entries(c))v.has(N)?g.set(v.get(N).toString(),C):console.warn(`Ignoring unknown image variable "${N}"`);return g}}function d4(f,c=255,h){const g=c/255,v=f.toString(),N=h.has(v)?h.get(v).clone():f.clone();return N.a*=g,N.toString()}function FM(f,c){if(!ih()){const h=document.createElement("canvas");return h.width=f,h.height=c,h}return new OffscreenCanvas(f,c)}let Mle,zM=null;function Tle(f,c,h,g,v){for(const N of g.children)p2e(f,c,h,N,v)}function p2e(f,c,h,g,v){g.group?(f.save(),function(N,C,L,F,$){const K=F.mask_idx!=null?L.masks[F.mask_idx]:null,Z=F.clip_path_idx!=null?L.clip_paths[F.clip_path_idx]:null;if(F.transform&&(C=u4(F.transform).preMultiplySelf(C)),!function(ae,me,Se){return ae.opacity!==255||me||Se}(F,Z!=null,K!=null))return void Tle(N,C,L,F,$);const X=FM(N.canvas.width,N.canvas.height),re=X.getContext("2d");Tle(re,C,L,F,$),Z&&b2e(re,C,L,Z),K&&w2e(re,C,L,K,$),N.globalAlpha=F.opacity/255,N.drawImage(X,0,0)}(f,c,h,g.group,v),f.restore()):g.path&&(f.save(),function(N,C,L,F,$){N.setTransform(C),F.paint_order===SGe.PAINT_ORDER_FILL_AND_STROKE?(m2e(N,L,F,$),x2e(N,L,F,$)):(x2e(N,L,F,$),m2e(N,L,F,$))}(f,c,h,g.path,v),f.restore())}function m2e(f,c,h,g){const v=h.fill;if(!v)return;const N=v.opacity/255;switch(f.save(),f.beginPath(),j2e(h,f),v.paint){case"rgb_color":f.fillStyle=d4(v.rgb_color,v.opacity,g);break;case"linear_gradient_idx":{const C=c.linear_gradients[v.linear_gradient_idx];C.transform&&f.setTransform(u4(C.transform).preMultiplySelf(f.getTransform())),f.fillStyle=y2e(f,C,N,g);break}case"radial_gradient_idx":{const C=c.radial_gradients[v.radial_gradient_idx];C.transform&&f.setTransform(u4(C.transform).preMultiplySelf(f.getTransform())),f.fillStyle=v2e(f,C,N,g)}}f.fill(g2e(h)),f.restore()}function g2e(f){return f.rule===Sle.PATH_RULE_NON_ZERO?"nonzero":f.rule===Sle.PATH_RULE_EVEN_ODD?"evenodd":void 0}function x2e(f,c,h,g){const v=h.stroke;if(!v)return;const N=k2e(h);f.lineWidth=v.width,f.miterLimit=v.miterlimit,f.setLineDash(v.dasharray),f.lineDashOffset=v.dashoffset;const C=v.opacity/255;switch(v.paint){case"rgb_color":f.strokeStyle=d4(v.rgb_color,v.opacity,g);break;case"linear_gradient_idx":f.strokeStyle=y2e(f,c.linear_gradients[v.linear_gradient_idx],C,g,!0);break;case"radial_gradient_idx":f.strokeStyle=v2e(f,c.radial_gradients[v.radial_gradient_idx],C,g,!0)}switch(v.linejoin){case pL.LINE_JOIN_MITER_CLIP:case pL.LINE_JOIN_MITER:f.lineJoin="miter";break;case pL.LINE_JOIN_ROUND:f.lineJoin="round";break;case pL.LINE_JOIN_BEVEL:f.lineJoin="bevel"}switch(v.linecap){case Cle.LINE_CAP_BUTT:f.lineCap="butt";break;case Cle.LINE_CAP_ROUND:f.lineCap="round";break;case Cle.LINE_CAP_SQUARE:f.lineCap="square"}f.stroke(N)}function y2e(f,c,h,g,v=!1){if(c.stops.length===1){const X=c.stops[0];return d4(X.rgb_color,X.opacity*h,g)}const{x1:N,y1:C,x2:L,y2:F}=c;let $=new DOMPoint(N,C),K=new DOMPoint(L,F);if(v){const X=u4(c.transform);$=X.transformPoint($),K=X.transformPoint(K)}const Z=f.createLinearGradient($.x,$.y,K.x,K.y);for(const X of c.stops)Z.addColorStop(X.offset,d4(X.rgb_color,X.opacity*h,g));return Z}function v2e(f,c,h,g,v=!1){if(c.stops.length===1){const Ne=c.stops[0];return d4(Ne.rgb_color,Ne.opacity*h,g)}const N=u4(c.transform),{fx:C,fy:L,fr:F,cx:$,cy:K,r:Z}=c;let X=new DOMPoint(C,L),re=new DOMPoint($,K),ae=F,me=Z;if(v){X=N.transformPoint(X),re=N.transformPoint(re);const Ne=(N.a+N.d)/2;ae=F*Ne,me=c.r*Ne}const Se=f.createRadialGradient(X.x,X.y,ae,re.x,re.y,me);for(const Ne of c.stops)Se.addColorStop(Ne.offset,d4(Ne.rgb_color,Ne.opacity*h,g));return Se}function _2e(f,c,h,g){const v=g.transform?u4(g.transform).preMultiplySelf(c):c,N=FM(f.canvas.width,f.canvas.height),C=N.getContext("2d");for(const F of g.children)if(F.group)_2e(C,v,h,F.group);else if(F.path){const $=F.path,K=new Path2D;K.addPath(k2e($),v),C.fill(K,g2e($))}const L=g.clip_path_idx!=null?h.clip_paths[g.clip_path_idx]:null;L&&b2e(C,v,h,L),f.globalCompositeOperation="source-over",f.drawImage(N,0,0)}function b2e(f,c,h,g){const v=FM(f.canvas.width,f.canvas.height);_2e(v.getContext("2d"),c,h,g),f.globalCompositeOperation="destination-in",f.drawImage(v,0,0)}function w2e(f,c,h,g,v){if(g.children.length===0)return;const N=g.mask_idx!=null?h.masks[g.mask_idx]:null;N&&w2e(f,c,h,N,v);const C=f.canvas.width,L=f.canvas.height,F=FM(C,L),$=F.getContext("2d"),K=g.width,Z=g.height,X=g.left,re=g.top,ae=new Path2D,me=new Path2D;me.rect(X,re,K,Z),ae.addPath(me,c),$.clip(ae);for(const Fe of g.children)p2e($,c,h,Fe,v);const Se=$.getImageData(0,0,C,L),Ne=Se.data;if(g.mask_type===d2e.MASK_TYPE_LUMINANCE)for(let Fe=0;Fec[C])return null}else{const L=1/g[C];let F=(f[C]-h[C])*L,$=(c[C]-h[C])*L;if(F>$){const K=F;F=$,$=K}if(F>v&&(v=F),$N)return null}return v}function C2e(f,c,h,g,v,N,C,L,F,$,K){const Z=g-f,X=v-c,re=N-h,ae=C-f,me=L-c,Se=F-h,Ne=K[1]*Se-K[2]*me,Fe=K[2]*ae-K[0]*Se,ze=K[0]*me-K[1]*ae,Xe=Z*Ne+X*Fe+re*ze;if(Math.abs(Xe)<1e-15)return null;const gt=1/Xe,ht=$[0]-f,bt=$[1]-c,Ct=$[2]-h,Et=(ht*Ne+bt*Fe+Ct*ze)*gt;if(Et<0||Et>1)return null;const Xt=bt*re-Ct*X,Rt=Ct*Z-ht*re,rr=ht*X-bt*Z,lr=(K[0]*Xt+K[1]*Rt+K[2]*rr)*gt;return lr<0||Et+lr>1?null:(ae*Xt+me*Rt+Se*rr)*gt}function M2e(f,c,h){return(f-c)/(h-c)}function T2e(f,c,h,g,v,N,C,L,F){const $=1<{const Fe=Se?1:0,ze=(re+1)*me-Fe,Xe=ae*me,gt=(ae+1)*me-Fe;Ne[0]=re*me,Ne[1]=Xe,Ne[2]=ze,Ne[3]=gt};let Z=new N2e(F);const X=[];for(let re=0;re=1;F/=2){const re=L[L.length-1];Z=new N2e(F);for(let ae=0;ae0;){const{idx:ae,t:me,nodex:Se,nodey:Ne,depth:Fe}=re.pop();if(this.leaves[ae]){T2e(Se,Ne,Fe,c,h,g,v,Z,X);const Xe=1<=_r[2])return me}continue}let ze=0;for(let Xe=0;Xe=$[K[Ct]]&&(K.splice(Ct,0,Xe),bt=!0);bt||(K[ze]=Xe),ze++}}for(let Xe=0;Xe=this.dim+1||h<-1||h>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(h+1)*this.stride+(c+1)}static pack(c,h){const g=[0,0,0,0],v=vL.getUnpackVector(h);let N=Math.floor((c+v[3])/v[2]);return g[2]=N%256,N=Math.floor(N/256),g[1]=N%256,N=Math.floor(N/256),g[0]=N,g}getPixels(){return new Nve({width:this.stride,height:this.stride},this.pixels)}backfillBorder(c,h,g){if(this.dim!==c.dim)throw new Error("dem dimension mismatch");let v=h*this.dim,N=h*this.dim+this.dim,C=g*this.dim,L=g*this.dim+this.dim;switch(h){case-1:v=N-1;break;case 1:N=v+1}switch(g){case-1:C=L-1;break;case 1:L=C+1}const F=-h*this.dim,$=-g*this.dim;for(let K=C;K=1;g--){const v=g===1?1:0,N=g===2?1:0;for(let C=0;C>>1^-(1&f[c]);return f}function sKe(f,c){switch(c){case"uint32":return f;case"uint16":for(let h=0;h>4|(61440&g)>>8|(240&v)<<4|61440&v,f[h+1]=15&g|(3840&g)>>4|(15&v)<<8|(3840&v)<<4}return f;case"uint8":for(let h=0;h>6|(192&v)>>4|(192&N)>>2|192&C,f[h+1]=(48&g)>>4|(48&v)>>2|48&N|(48&C)<<2,f[h+2]=(12&g)>>2|12&v|(12&N)<<2|(12&C)<<4,f[h+3]=3&g|(3&v)<<2|(3&N)<<4|(3&C)<<6}return f;default:throw new Error(`Invalid pixel format, "${c}"`)}}en(vL,"DEMData"),en(A2e,"DemMinMaxQuadTree",{omit:["dem"]});var Yh=Uint8Array,BM=Uint16Array,aKe=Int32Array,I2e=new Yh([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]),P2e=new Yh([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]),iKe=new Yh([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),L2e=function(f,c){for(var h=new BM(31),g=0;g<31;++g)h[g]=c+=1<>1|(21845&ul)<<1;R2e[ul]=((65280&(h4=(61680&(h4=(52428&h4)>>2|(13107&h4)<<2))>>4|(3855&h4)<<4))>>8|(255&h4)<<8)>>1}var $M=function(f,c,h){for(var g=f.length,v=0,N=new BM(c);v>F]=$;return C},UM=new Yh(288);for(ul=0;ul<144;++ul)UM[ul]=8;for(ul=144;ul<256;++ul)UM[ul]=9;for(ul=256;ul<280;++ul)UM[ul]=7;for(ul=280;ul<288;++ul)UM[ul]=8;var F2e=new Yh(32);for(ul=0;ul<32;++ul)F2e[ul]=5;var cKe=$M(UM,9),dKe=$M(F2e,5),Ele=function(f){for(var c=f[0],h=1;hc&&(c=f[h]);return c},Kp=function(f,c,h){var g=c/8|0;return(f[g]|f[g+1]<<8)>>(7&c)&h},Ile=function(f,c){var h=c/8|0;return(f[h]|f[h+1]<<8|f[h+2]<<16)>>(7&c)},uKe=["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"],Zp=function(f,c,h){var g=new Error(c||uKe[f]);if(g.code=f,Error.captureStackTrace&&Error.captureStackTrace(g,Zp),!h)throw g;return g},hKe=new Yh(0),fKe=typeof TextDecoder<"u"&&new TextDecoder;try{fKe.decode(hKe,{stream:!0})}catch{}const pKe={gzip_data:"gzip"};class Uf extends Error{constructor(c){super(c),this.name="MRTError"}}const mKe={0:"uint32",1:"uint32",2:"uint16",3:"uint8"},z2e={uint32:1,uint16:2,uint8:4},gKe={uint32:Uint32Array,uint16:Uint16Array,uint8:Uint8Array};let Ple;class _L{constructor(c=5){this.x=NaN,this.y=NaN,this.z=NaN,this.layers={},this._cacheSize=c}getLayer(c){const h=this.layers[c];if(!h)throw new Uf(`Layer '${c}' not found`);return h}getHeaderLength(c){const h=new Uint8Array(c),g=new DataView(c);if(h[0]!==13)throw new Uf("File is not a valid MRT.");return g.getUint32(1,!0)}parseHeader(c){const h=new Uint8Array(c),g=this.getHeaderLength(c);if(h.length= ${g} but got buffer of length ${h.length}`);const v=new Ple(h.subarray(0,g)).readFields(KGe,{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 Uf(`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 N of v.layers)this.layers[N.name]=new B2e(N,{cacheSize:this._cacheSize});return this}createDecodingTask(c){const h=[],g=this.getLayer(c.layerName);for(let v of c.blockIndices){const N=g.dataIndex[v],C=N.firstByte-c.firstByte,L=N.lastByte-c.firstByte;if(g._blocksInProgress.has(v))continue;const F={layerName:g.name,firstByte:C,lastByte:L,pixelFormat:g.pixelFormat,blockIndex:v,blockShape:[N.bands.length].concat(g.bandShape),buffer:g.buffer,codec:N.codec.codec,filters:N.filters.map($=>$.filter)};g._blocksInProgress.add(v),h.push(F)}return new $2e(h,()=>{h.forEach(v=>g._blocksInProgress.delete(v.blockIndex))},(v,N)=>{if(h.forEach(C=>g._blocksInProgress.delete(C.blockIndex)),v)throw v;N.forEach(C=>{this.getLayer(C.layerName).processDecodedData(C)})})}}class B2e{constructor({version:c,name:h,units:g,tileSize:v,pixelFormat:N,buffer:C,dataIndex:L},F){if(this.version=c,this.version!==1)throw new Uf(`Cannot parse raster layer encoded with MRT version ${c}`);this.name=h,this.units=g,this.tileSize=v,this.buffer=C,this.pixelFormat=mKe[N],this.dataIndex=L,this.bandShape=[v+2*C,v+2*C,z2e[this.pixelFormat]],this._decodedBlocks=new yL(F?F.cacheSize:5),this._blocksInProgress=new Set}get dimension(){return z2e[this.pixelFormat]}get cacheSize(){return this._decodedBlocks.capacity}getBandList(){return this.dataIndex.map(({bands:c})=>c).flat()}processDecodedData(c){const h=c.blockIndex.toString();this._decodedBlocks.get(h)||this._decodedBlocks.put(h,c.data)}getBlockForBand(c){let h=0;switch(typeof c){case"string":for(const[g,v]of this.dataIndex.entries()){for(const[N,C]of v.bands.entries())if(C===c)return{bandIndex:h+N,blockIndex:g,blockBandIndex:N};h+=v.bands.length}break;case"number":for(const[g,v]of this.dataIndex.entries()){if(c>=h&&cthis.cacheSize)throw new Uf(`Number of blocks to decode (${N.size}) exceeds cache size (${this.cacheSize}).`);return{layerName:this.name,firstByte:h,lastByte:g,blockIndices:v}}hasBand(c){const{blockIndex:h}=this.getBlockForBand(c);return h>=0}hasDataForBand(c){const{blockIndex:h}=this.getBlockForBand(c);return h>=0&&!!this._decodedBlocks.get(h.toString())}getBandView(c){const{blockIndex:h,blockBandIndex:g}=this.getBlockForBand(c);if(h<0)throw new Uf(`Band not found: ${JSON.stringify(c)}`);const v=this._decodedBlocks.get(h.toString());if(!v)throw new Uf(`Data for band ${JSON.stringify(c)} of layer "${this.name}" not decoded.`);const N=this.dataIndex[h],C=this.bandShape.reduce(($,K)=>$*K,1),L=g*C,F=v.subarray(L,L+C);return{data:F,bytes:new Uint8Array(F.buffer).subarray(F.byteOffset,F.byteOffset+F.byteLength),tileSize:this.tileSize,buffer:this.buffer,pixelFormat:this.pixelFormat,dimension:this.dimension,offset:N.offset,scale:N.scale}}}_L.setPbf=function(f){Ple=f};class $2e{constructor(c,h,g){this.tasks=c,this._onCancel=h,this._onComplete=g,this._finalized=!1}cancel(){this._finalized||(this._onCancel(),this._finalized=!0)}complete(c,h){this._finalized||(this._onComplete(c,h),this._finalized=!0)}}_L.performDecoding=function(f,c){const h=new Uint8Array(f);return Promise.all(c.tasks.map(g=>{const{layerName:v,firstByte:N,lastByte:C,pixelFormat:L,blockShape:F,blockIndex:$,filters:K,codec:Z}=g,X=h.subarray(N,C+1),re=new Uint32Array(F[0]*F[1]*F[2]);let ae;if(Z!=="gzip_data")throw new Uf(`Unhandled codec: ${Z}`);return ae=function(me,Se){if(!globalThis.DecompressionStream&&Se==="gzip_data")return Promise.resolve(((Xe=function(bt){bt[0]==31&&bt[1]==139&&bt[2]==8||Zp(6,"invalid gzip data");var Ct=bt[3],Et=10;4&Ct&&(Et+=2+(bt[10]|bt[11]<<8));for(var Xt=(Ct>>3&1)+(Ct>>4&1);Xt>0;Xt-=!bt[Et++]);return Et+(2&Ct)}(ze=me))+8>ze.length&&Zp(6,"invalid gzip data"),function(bt,Ct,Et,Xt){var Rt=bt.length;if(!Rt||Ct.f&&!Ct.l)return Et||new Yh(0);var rr=!Et,lr=rr||Ct.i!=2,cr=Ct.i;rr&&(Et=new Yh(3*Rt));var yr,_r,fr=function(Ga){var ja=Et.length;if(Ga>ja){var Ta=new Yh(Math.max(2*ja,Ga));Ta.set(Et),Et=Ta}},gr=Ct.f||0,tr=Ct.p||0,Qt=Ct.b||0,xr=Ct.l,Tr=Ct.d,jr=Ct.m,xn=Ct.n,Vr=8*Rt;do{if(!xr){gr=Kp(bt,tr,1);var Qr=Kp(bt,tr+1,3);if(tr+=3,!Qr){var an=bt[(nr=4+((tr+7)/8|0))-4]|bt[nr-3]<<8,bs=nr+an;if(bs>Rt){cr&&Zp(0);break}lr&&fr(Qt+an),Et.set(bt.subarray(nr,bs),Qt),Ct.b=Qt+=an,Ct.p=tr=8*bs,Ct.f=gr;continue}if(Qr==1)xr=cKe,Tr=dKe,jr=9,xn=5;else if(Qr==2){var kr=Kp(bt,tr,31)+257,ln=Kp(bt,tr+10,15)+4,Wn=kr+Kp(bt,tr+5,31)+1;tr+=14;for(var qs=new Yh(Wn),Xs=new Yh(19),ls=0;ls>4)<16)qs[ls++]=nr;else{var zr=0,Br=0;for(nr==16?(Br=3+Kp(bt,tr,3),tr+=2,zr=qs[ls-1]):nr==17?(Br=3+Kp(bt,tr,7),tr+=3):nr==18&&(Br=11+Kp(bt,tr,127),tr+=7);Br--;)qs[ls++]=zr}}var vn=qs.subarray(0,kr),wn=qs.subarray(kr);jr=Ele(vn),xn=Ele(wn),xr=$M(vn,jr),Tr=$M(wn,xn)}else Zp(1);if(tr>Vr){cr&&Zp(0);break}}lr&&fr(Qt+131072);for(var ss=(1<>4;if((tr+=15&zr)>Vr){cr&&Zp(0);break}if(zr||Zp(2),Rs<256)Et[Qt++]=Rs;else{if(Rs==256){vs=tr,xr=null;break}var Ln=Rs-254;Rs>264&&(Ln=Kp(bt,tr,(1<<(pa=I2e[ls=Rs-257]))-1)+D2e[ls],tr+=pa);var Hn=Tr[Ile(bt,tr)&ms],da=Hn>>4;if(Hn||Zp(3),tr+=15&Hn,wn=lKe[da],da>3){var pa=P2e[da];wn+=Ile(bt,tr)&(1<Vr){cr&&Zp(0);break}lr&&fr(Qt+131072);var ma=Qt+Ln;if(Qtyr.length)&&(_r=yr.length),new Yh(yr.subarray(0,_r))):Et.subarray(0,Qt)}(ze.subarray(Xe,-8),{i:2},new Yh(((Ne=ze)[(Fe=Ne.length)-4]|Ne[Fe-3]<<8|Ne[Fe-2]<<16|Ne[Fe-1]<<24)>>>0))));var Ne,Fe,ze,Xe;const gt=pKe[Se];if(!gt)throw new Error(`Unhandled codec: ${Se}`);const ht=new globalThis.DecompressionStream(gt);return new Response(new Blob([me]).stream().pipeThrough(ht)).arrayBuffer().then(bt=>new Uint8Array(bt))}(X,Z).then(me=>(function(Se,Ne){Se.readFields(eKe,Ne)}(new Ple(me),re),new gKe[L](re.buffer))),ae.then(me=>{for(let Se=K.length-1;Se>=0;Se--)switch(K[Se]){case"delta_filter":rKe(me,F);break;case"zigzag_filter":nKe(me);break;case"bitshuffle_filter":sKe(me,L);break;default:throw new Uf(`Unhandled filter "${K[Se]}"`)}return{layerName:v,blockIndex:$,data:me}}).catch(me=>{throw me})}))},en($2e,"MRTDecodingBatch",{omit:["_onCancel","_onComplete"]}),en(_L,"MapboxRasterTile"),en(B2e,"MapboxRasterLayer",{omit:["_blocksInProgress"]});class U2e{constructor(c){this._stringToNumber={},this._numberToString=[];for(let h=0;h=0&&X[3]>=0&&$.insert(F,X[0],X[1],X[2],X[3])}}loadVTLayers(){if(!this.vtLayers){this.vtLayers=new Ut(new Y6(this.rawTileData)).layers,this.sourceLayerCoder=new U2e(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"]),this.vtFeatures={};for(const c in this.vtLayers)this.vtFeatures[c]=[]}return this.vtLayers}query(c,h){const{tilespaceGeometry:g,transform:v,tileTransform:N,pixelPosMatrix:C,availableImages:L,worldview:F}=h;this.loadVTLayers(),this.serializedLayersCache.clear();const $=h.queryRadius?h.queryRadius:0,K=g.bufferedTilespaceBounds,Z=this.grid.query(K.min.x,K.min.y,K.max.x,K.max.y,(me,Se,Ne,Fe)=>kd(g.bufferedTilespaceGeometry,me-$,Se-$,Ne+$,Fe+$));Z.sort(xKe);let X=null;v.elevation&&Z.length>0&&(X=c4.create(v.elevation,this.tileID));const re={};let ae;for(let me=0;me(Fe||(Fe=St(ze,this.tileID.canonical,N)),Xe.queryIntersectsFeature(g,ze,gt,Fe,this.z,v,C,X,ht)))}return re}loadMatchingFeature(c,h,g,v,N,C){const{featureIndex:L,bucketIndex:F,sourceLayerIndex:$,layoutVertexArrayOffset:K}=h,Z=this.bucketLayerIDs[F],X=g.layers,re=Object.keys(X);if(re.length&&!Yr(re,Z))return;const ae=g.sourceCache,me=this.sourceLayerCoder.decode($),Se=this.vtLayers[me].feature(L),Ne=this.getId(Se,me);for(let Fe=0;Fe`${L.key}: ${L.message}`).join(", ");return void Wr(`Failed to create expression for promoteId: ${C}`)}this.promoteIdExpression=N.value}g=this.promoteIdExpression.evaluate({zoom:0},c)}else g=c.properties[v];typeof g=="boolean"&&(g=Number(g))}return g}}function V2e(f,c,h,g,v){return Vt(f,(N,C)=>{const L=c instanceof vx?c.get(C):null;return L&&L.evaluate?L.evaluate(h,g,void 0,v):L})}function xKe(f,c){return c-f}en(q2e,"FeatureIndex",{omit:["rawTileData","sourceLayerCoder"]});const H2e=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class Lle{static from(c){if(!(c instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[h,g]=new Uint8Array(c,0,2);if(h!==219)throw new Error("Data does not appear to be in a KDBush format.");const v=g>>4;if(v!==1)throw new Error(`Got v${v} data when expected v1.`);const N=H2e[15&g];if(!N)throw new Error("Unrecognized array type.");const[C]=new Uint16Array(c,2,1),[L]=new Uint32Array(c,4,1);return new Lle(L,C,N,c)}constructor(c,h=64,g=Float64Array,v){if(isNaN(c)||c<0)throw new Error(`Unpexpected numItems value: ${c}.`);this.numItems=+c,this.nodeSize=Math.min(Math.max(+h,2),65535),this.ArrayType=g,this.IndexArrayType=c<65536?Uint16Array:Uint32Array;const N=H2e.indexOf(this.ArrayType),C=2*c*this.ArrayType.BYTES_PER_ELEMENT,L=c*this.IndexArrayType.BYTES_PER_ELEMENT,F=(8-L%8)%8;if(N<0)throw new Error(`Unexpected typed array class: ${g}.`);v&&v instanceof ArrayBuffer?(this.data=v,this.ids=new this.IndexArrayType(this.data,8,c),this.coords=new this.ArrayType(this.data,8+L+F,2*c),this._pos=2*c,this._finished=!0):(this.data=new ArrayBuffer(8+C+L+F),this.ids=new this.IndexArrayType(this.data,8,c),this.coords=new this.ArrayType(this.data,8+L+F,2*c),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+N]),new Uint16Array(this.data,2,1)[0]=h,new Uint32Array(this.data,4,1)[0]=c)}add(c,h){const g=this._pos>>1;return this.ids[g]=g,this.coords[this._pos++]=c,this.coords[this._pos++]=h,g}finish(){const c=this._pos>>1;if(c!==this.numItems)throw new Error(`Added ${c} items when expected ${this.numItems}.`);return Ole(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(c,h,g,v){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:N,coords:C,nodeSize:L}=this,F=[0,N.length-1,0],$=[];for(;F.length;){const K=F.pop()||0,Z=F.pop()||0,X=F.pop()||0;if(Z-X<=L){for(let Se=X;Se<=Z;Se++){const Ne=C[2*Se],Fe=C[2*Se+1];Ne>=c&&Ne<=g&&Fe>=h&&Fe<=v&&$.push(N[Se])}continue}const re=X+Z>>1,ae=C[2*re],me=C[2*re+1];ae>=c&&ae<=g&&me>=h&&me<=v&&$.push(N[re]),(K===0?c<=ae:h<=me)&&(F.push(X),F.push(re-1),F.push(1-K)),(K===0?g>=ae:v>=me)&&(F.push(re+1),F.push(Z),F.push(1-K))}return $}within(c,h,g){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:v,coords:N,nodeSize:C}=this,L=[0,v.length-1,0],F=[],$=g*g;for(;L.length;){const K=L.pop()||0,Z=L.pop()||0,X=L.pop()||0;if(Z-X<=C){for(let Se=X;Se<=Z;Se++)G2e(N[2*Se],N[2*Se+1],c,h)<=$&&F.push(v[Se]);continue}const re=X+Z>>1,ae=N[2*re],me=N[2*re+1];G2e(ae,me,c,h)<=$&&F.push(v[re]),(K===0?c-g<=ae:h-g<=me)&&(L.push(X),L.push(re-1),L.push(1-K)),(K===0?c+g>=ae:h+g>=me)&&(L.push(re+1),L.push(Z),L.push(1-K))}return F}}function Ole(f,c,h,g,v,N){if(v-g<=h)return;const C=g+v>>1;W2e(f,c,C,g,v,N),Ole(f,c,h,g,C-1,1-N),Ole(f,c,h,C+1,v,1-N)}function W2e(f,c,h,g,v,N){for(;v>g;){if(v-g>600){const $=v-g+1,K=h-g+1,Z=Math.log($),X=.5*Math.exp(2*Z/3),re=.5*Math.sqrt(Z*X*($-X)/$)*(K-$/2<0?-1:1);W2e(f,c,h,Math.max(g,Math.floor(h-K*X/$+re)),Math.min(v,Math.floor(h+($-K)*X/$+re)),N)}const C=c[2*h+N];let L=g,F=v;for(qM(f,c,g,h),c[2*v+N]>C&&qM(f,c,g,v);LC;)F--}c[2*g+N]===C?qM(f,c,g,F):(F++,qM(f,c,F,v)),F<=h&&(g=F+1),h<=F&&(v=F-1)}}function qM(f,c,h,g){Dle(f,h,g),Dle(c,2*h,2*g),Dle(c,2*h+1,2*g+1)}function Dle(f,c,h){const g=f[c];f[c]=f[h],f[h]=g}function G2e(f,c,h,g){const v=f-h,N=c-g;return v*v+N*N}i.$=qk,i.A=Tp,i.B=Wh,i.C=2,i.D=YN,i.E=Is,i.F=kM,i.G=vbe,i.H=Uk,i.I=_a,i.J=h6,i.K=gn,i.L=t0,i.M=fN,i.N=Xv,i.O=JP,i.P=sr,i.Q=Qv,i.R=Mp,i.S=jN,i.T=Voe,i.U=ng,i.V=hL,i.W=E5,i.X=i0,i.Y=a0,i.Z=Hv,i._=bd,i.a=function(f){return Es.API_CDN_URL_REGEX.test(f)},i.a$=de,i.a0=Vn,i.a1=El,i.a2=Rf,i.a3=class extends hL{},i.a4=pN,i.a5=QP,i.a6=Ft,i.a7=function(f){const c=f.value;return c?Vn(c)?ble(c,!0)?[]:[new hL(f.key,c,`invalid url "${c}"`)]:[new hL(f.key,c,`string expected, "${gn(c)}" found`)]:[]},i.a8=l6,i.a9=Ji,i.aA=xe,i.aB=T,i.aC=He,i.aD=Ec,i.aE=Xa,i.aF=B,i.aG=Ke,i.aH=function(f,c){const h={};for(let g=0;g{g(N,C)},c):g(N,C),()=>{}}return v.callbacks.push(g),v.cancel||(v.cancel=h((N,C)=>{v.result=[N,C];for(const L of v.callbacks)this.scheduler?this.scheduler.add(()=>{L(N,C)},c):L(N,C);setTimeout(()=>delete this.entries[f],3e3)})),()=>{v.result||(v.callbacks=v.callbacks.filter(N=>N!==g),v.callbacks.length||(v.cancel(),delete this.entries[f]))}}},i.aL=function(f,c,h){const g=JSON.stringify(f.request);return f.data&&(this.deduped.entries[g]={result:[null,f.data]}),this.deduped.request(g,{type:"parseTile",isSymbolTile:f.isSymbolTile,zoom:f.tileZoom},v=>{const N=Eu(f.request,(C,L,F)=>{C?v(C):L&&v(null,{rawData:L,vectorTile:h?void 0:new Ut(new Y6(L)),responseHeaders:new Map(F.entries())})});return()=>{N.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=yd,i.aO=function(f){Xc++,Xc>Zy&&(f.getActor().send("enforceCacheSizeLimit",Ky),Xc=0)},i.aP=function(f){return f<=1?1:Math.pow(2,Math.floor(Math.log2(f)))},i.aQ=Zi,i.aR=Kbe,i.aS=e2e,i.aT=m,i.aU=Gbe,i.aV=function(f,c){const h=document.createElement("video");h.muted=!0,h.onloadstart=function(){c(null,h)};for(let g=0;g{}}},i.aW=vM,i.aX=w_,i.aY=Lt,i.aZ=MM,i.a_=te,i.aa=Nr,i.ab=class{constructor(f){this.specification=f}possiblyEvaluate(f,c){return es(f.expression.evaluate(c))}interpolate(f,c,h){return{x:zn(f.x,c.x,h),y:zn(f.y,c.y,h),z:zn(f.z,c.z,h),azimuthal:zn(f.azimuthal,c.azimuthal,h),polar:zn(f.polar,c.polar,h)}}},i.ac=oi,i.ad=gx,i.ae=We,i.af=at,i.ag=pe,i.ah=Pe,i.ai=vx,i.aj=N0,i.ak=zn,i.al=Cr,i.am=e5,i.an=qn,i.ao=ba,i.ap=class{constructor(f){this.specification=f}possiblyEvaluate(f,c){return function([h,g]){const v=es([1,h,g]);return{x:v.x,y:v.y,z:v.z}}(f.expression.evaluate(c))}interpolate(f,c,h){return{x:zn(f.x,c.x,h),y:zn(f.y,c.y,h),z:zn(f.z,c.z,h)}}},i.aq=function(f,c,h=0,g=!0){const v=new sr(h,h),N=f.sub(v),C=c.add(v),L=[N,new sr(C.x,N.y),C,new sr(N.x,C.y)];return g&&L.push(N.clone()),L},i.ar=function(f,c){const h=[];for(let g=0;g1)return!1;const h=c.getSource().maxzoom,g=1<1)return c;const v=g.getSource().maxzoom,N=1<{const L=this.getAtTileOffset(f,v,N,C),F=g.upVector(f.canonical,v.x,v.y);return _e(F,F,L*g.upVectorScale(f.canonical,c,h).metersToTile),F}}getForTilePoints(f,c,h,g){if(this.isUsingMockSource())return!1;const v=c4.create(this,f,g);return!!v&&(c.forEach(N=>{N[2]=this.exaggeration()*v.getElevationAt(N[0],N[1],h)}),!0)}getMinMaxForTile(f){if(this.isUsingMockSource())return null;const c=this.findDEMTileFor(f);if(!c||!c.dem)return null;const h=c.dem.tree,g=c.tileID,v=1<0&&(g+=(f[v]-0)*(f[v]-0)),c[v]<0&&(g+=(0-c[v])*(0-c[v]));return g},i.c0=Kve,i.c1=ale,i.c2=Sbe,i.c3=fle,i.c4=Lle,i.c5=_e,i.c6=Ce,i.c7=yt,i.c8=function(f,c,h){h*=.5;var g=c[0],v=c[1],N=c[2],C=c[3],L=Math.sin(h),F=Math.cos(h);return f[0]=g*F+v*L,f[1]=v*F-g*L,f[2]=N*F+C*L,f[3]=C*F-N*L,f},i.c9=it,i.cA=ge,i.cB=wa,i.cC=I_e,i.cD=Qa,i.cE=cve,i.cF=function(f,c,h,g,v,N,C,L,F){if(F.name==="globe")return cve(f,c,new Qa(h,g,v),!1);const $=MM({z:h,x:g,y:v},F);return new hn([(N+$.x/$.scale)*c,c*($.y/$.scale),C],[(N+$.x2/$.scale)*c,c*($.y2/$.scale),L])},i.cG=function(f,c,h){return f[0]=Math.min(c[0],h[0]),f[1]=Math.min(c[1],h[1]),f[2]=Math.min(c[2],h[2]),f[3]=Math.min(c[3],h[3]),f},i.cH=function(f,c,h){return f[0]=Math.max(c[0],h[0]),f[1]=Math.max(c[1],h[1]),f[2]=Math.max(c[2],h[2]),f[3]=Math.max(c[3],h[3]),f},i.cI=function(f){const c=Math.round((f+45+360)%360/90)%4;return dc[c]},i.cJ=ue,i.cK=Ge,i.cL=GN,i.cM=function(f){const c=M(new Float64Array(16));T(c,f.pixelMatrix,f.globeMatrix);const h=[0,hh,0],g=[0,fh,0];return at(h,h,c),at(g,g,c),[h[0]>0&&h[0]<=f.width&&h[1]>0&&h[1]<=f.height&&!boe(f,new m(f.center.lat,90)),g[0]>0&&g[0]<=f.width&&g[1]>0&&g[1]<=f.height&&!boe(f,new m(f.center.lat,-90))]},i.cN=function(f,c){const{scale:h}=f.tileTransform,g=h*Cr/(f.tileSize*Math.pow(2,c.zoom-f.tileID.overscaledZ+f.tileID.canonical.z));return function(v,N,C){var L=N[1],F=N[2],$=N[3],K=C[0],Z=C[1];return v[0]=N[0]*K,v[1]=L*K,v[2]=F*Z,v[3]=$*Z,v}(new Float32Array(4),c.inverseAdjustmentMatrix,[g,g])},i.cO=V6,i.cP=oe,i.cQ=E_e,i.cR=function(f){const c=E_e(f,!0);return x([],[c[0],c[1],c[4],c[5]])},i.cS=z,i.cT=qr,i.cU=D,i.cV=function(f){const{x:c,y:h}=f.point,{lng:g,lat:v}=f._center;return hve(c,h,f.worldSize,g,v)},i.cW=Ae,i.cX=Gi,i.cY=Vi,i.cZ=pc,i.c_=uh,i.ca=va,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=ne,i.cd=function(f,c,h,g,v){var N=1/Math.tan(c/2);if(f[0]=N/h,f[1]=0,f[2]=0,f[3]=0,f[4]=0,f[5]=N,f[6]=0,f[7]=0,f[8]=0,f[9]=0,f[11]=-1,f[12]=0,f[13]=0,f[15]=0,v!=null&&v!==1/0){var C=1/(g-v);f[10]=(v+g)*C,f[14]=2*v*g*C}else f[10]=-1,f[14]=-2*g;return f},i.ce=function(f,c,h,g,v,N,C){var L=1/(c-h),F=1/(g-v),$=1/(N-C);return f[0]=-2*L,f[1]=0,f[2]=0,f[3]=0,f[4]=0,f[5]=-2*F,f[6]=0,f[7]=0,f[8]=0,f[9]=0,f[10]=2*$,f[11]=0,f[12]=(c+h)*L,f[13]=(v+g)*F,f[14]=(C+N)*$,f[15]=1,f},i.cf=Y,i.cg=function(f,c,h){f[4*c+0]=h[0],f[4*c+1]=h[1],f[4*c+2]=h[2],f[4*c+3]=h[3]},i.ch=qN,i.ci=o_,i.cj=Jo,i.ck=Bf,i.cl=c_,i.cm=Rbe,i.cn=function(){var f=new p(4);return p!=Float32Array&&(f[1]=0,f[2]=0),f[0]=1,f[3]=1,f},i.co=function(f,c,h){var g=c[0],v=c[1],N=c[2],C=c[3],L=Math.sin(h),F=Math.cos(h);return f[0]=g*F+N*L,f[1]=v*F+C*L,f[2]=g*-L+N*F,f[3]=v*-L+C*F,f},i.cp=function(f,c){return f[0]===c[0]&&f[1]===c[1]&&f[2]===c[2]&&f[3]===c[3]},i.cq=st,i.cr=function(f){var c=f[0],h=f[1],g=f[2],v=f[3];return Math.sqrt(c*c+h*h+g*g+v*v)},i.cs=Ur,i.ct=Ve,i.cu=So,i.cv=3,i.cw=2,i.cx=7,i.cy=6,i.cz=Oe,i.d=function(f){return Es.API_TILEJSON_REGEX.test(f)},i.d$=class{constructor(f,c,h,g){this.context=f,this.format=g,this.size=h,this.texture=f.gl.createTexture();const[v,N,C]=this.size,{gl:L}=f;L.bindTexture(L.TEXTURE_3D,this.texture),f.pixelStoreUnpackFlipY.set(!1),f.pixelStoreUnpack.set(1),f.pixelStoreUnpackPremultiplyAlpha.set(!1),"data"in c&&c.data&&L.texImage3D(L.TEXTURE_3D,0,this.format,v,N,C,0,Uoe(this.format),qoe(this.format),c.data)}bind(f,c){const{context:h}=this,{gl:g}=h;g.bindTexture(g.TEXTURE_3D,this.texture),f!==this.minFilter&&(g.texParameteri(g.TEXTURE_3D,g.TEXTURE_MAG_FILTER,f),g.texParameteri(g.TEXTURE_3D,g.TEXTURE_MIN_FILTER,f),this.minFilter=f),c!==this.wrapS&&(g.texParameteri(g.TEXTURE_3D,g.TEXTURE_WRAP_S,c),g.texParameteri(g.TEXTURE_3D,g.TEXTURE_WRAP_T,c),this.wrapS=c)}destroy(){const{gl:f}=this.context;f.deleteTexture(this.texture),this.texture=null}},i.d0=function(f){return f*f*f*f*f},i.d1=R,i.d2=45,i.d3=VN,i.d4=function(f,c,h){const g=Math.sqrt(f*f+c*c+h*h),v=g>0?Math.acos(h/g)*yi:0;let N=f!==0||c!==0?Math.atan2(-c,-f)*yi+90:0;return N<0&&(N+=360),[g,N,v]},i.d5=se,i.d6=es,i.d7=Le,i.d8=he,i.d9=hn,i.dA=function(f){return f({pluginStatus:wd,pluginURL:Op}),bN.on("pluginStateChange",f),f},i.dB=l_,i.dC=class extends Fp{constructor(f){super(f),this.current=HN}set(f,c,h){if(this.fetchUniformLocation(f,c)){for(let g=0;g<9;g++)if(h[g]!==this.current[g]){this.current=h,this.gl.uniformMatrix3fv(this.location,!1,h);break}}}},i.dD=go,i.dE=function(f,c,h){const g=N0(h.zoom),v=f.style.map._antialias,N=f.terrain&&f.terrain.exaggeration()>0;return g===0&&!v&&!N},i.dF=function(f){const c=f.pixelsPerMeter,h=c/Y(1,f.center.lat),g=M(new Float64Array(16));return I(g,g,[f.point.x,f.point.y,0]),z(g,g,[h,h,c]),Float32Array.from(g)},i.dG=M6,i.dH=function(f){const c=ue-5;f=xe(f,-c,c)/c*90;const h=Math.pow(Math.abs(Math.sin(qn(f))),3);return Math.round(h*(rM.length-1))},i.dI=function(f,c,h,g){const v=c.getNorth(),N=c.getSouth(),C=c.getWest(),L=c.getEast(),F=1<0){const ae=180/g;b(re,re,[ae/$+1,0,0,0,ae/K+1,0,-.5*ae/Z,.5*ae/X,1])}return re[2]=F,re[5]=f.x,re[8]=f.y,re},i.dJ=Zh,i.dK=function(f,c,h){const g=M(new Float64Array(16)),v=(c/(1<({u_matrix:new c_(f),u_texsize:new Bf(f),u_pixels_to_tile_units:new WN(f),u_device_pixel_ratio:new Jo(f),u_width_scale:new Jo(f),u_floor_width_scale:new Jo(f),u_image:new qN(f),u_units_to_pixels:new Bf(f),u_tile_units_to_pixels:new Jo(f),u_alpha_discard_threshold:new Jo(f),u_trim_offset:new Bf(f),u_trim_fade_range:new Bf(f),u_trim_color:new VN(f),u_zbias_factor:new Jo(f),u_tile_to_meter:new Jo(f),u_ground_shadow_factor:new o_(f),u_pattern_transition:new Jo(f)}),i.dX=f=>({u_matrix:new c_(f),u_pixels_to_tile_units:new WN(f),u_device_pixel_ratio:new Jo(f),u_width_scale:new Jo(f),u_floor_width_scale:new Jo(f),u_units_to_pixels:new Bf(f),u_dash_image:new qN(f),u_gradient_image:new qN(f),u_image_height:new Jo(f),u_texsize:new Bf(f),u_tile_units_to_pixels:new Jo(f),u_alpha_discard_threshold:new Jo(f),u_trim_offset:new Bf(f),u_trim_fade_range:new Bf(f),u_trim_color:new VN(f),u_zbias_factor:new Jo(f),u_tile_to_meter:new Jo(f),u_ground_shadow_factor:new o_(f)}),i.dY=f=>({u_camera_to_center_distance:new Jo(f),u_extrude_scale:new WN(f),u_device_pixel_ratio:new Jo(f),u_matrix:new c_(f),u_inv_rot_matrix:new c_(f),u_merc_center:new Bf(f),u_tile_id:new o_(f),u_zoom_transition:new Jo(f),u_up_dir:new o_(f),u_emissive_strength:new Jo(f)}),i.dZ=LN,i.d_=MWe,i.da=ye,i.db=function(f){return[Math.pow(f[0],1/2.2),Math.pow(f[1],1/2.2),Math.pow(f[2],1/2.2)]},i.dc=A_e,i.dd=Yoe,i.de=O_e,i.df=ble,i.dg=function(f,c){return f.readFields(CGe,{icons:[]},c)},i.dh=B6,i.di=a4,i.dj=dle,i.dk=Xy,i.dl=t_,i.dm=Wm,i.dn=mr,i.dp=or,i.dq=function(f){const c=f.indexOf(wx);return c>=0?f.slice(0,c):f},i.dr=function(f){return f.indexOf(wx)>=0},i.ds=function(f){const c=f.lastIndexOf(wx);return c>=0?f.slice(c+1):""},i.dt=function(f){const c=[],h=f.id;return h===void 0&&c.push({message:`layers.${h}: missing required property "id"`}),f.render===void 0&&c.push({message:`layers.${h}: missing required method "render"`}),f.renderingMode&&f.renderingMode!=="2d"&&f.renderingMode!=="3d"&&c.push({message:`layers.${h}: property "renderingMode" must be either "2d" or "3d"`}),c},i.du=function(f,c,h,g){return f.type==="custom"?new _Ge(f,c):new NGe[f.type](f,c,h,g)},i.dv=pr,i.dw=function(f){const c=f.indexOf(wx);return c>=0?f.slice(c+1):""},i.dx=class extends b_{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=bN,i.dz=Af,i.e=Es,i.e$=fe,i.e0=mve,i.e1=(f,c,h,g,v,N)=>{const C=f.transform,L=C.projection.name==="globe";let F;if(N.paint.get("circle-pitch-alignment")==="map")if(L){const K=uve(C.zoom,c.canonical)*C._pixelsPerMercatorPixel;F=Float32Array.from([K,0,0,K])}else F=C.calculatePixelsToTileUnitsMatrix(h);else F=new Float32Array([C.pixelsToGLUnits[0],0,0,C.pixelsToGLUnits[1]]);const $={u_camera_to_center_distance:f.transform.getCameraToCenterDistance(C.projection),u_matrix:f.translatePosMatrix(c.projMatrix,h,N.paint.get("circle-translate"),N.paint.get("circle-translate-anchor")),u_device_pixel_ratio:Xo.devicePixelRatio,u_extrude_scale:F,u_inv_rot_matrix:VVe,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0],u_emissive_strength:N.paint.get("circle-emissive-strength")};if(L){$.u_inv_rot_matrix=g,$.u_merc_center=v,$.u_tile_id=[c.canonical.x,c.canonical.y,1<{const K=f.transform,Z=K.pitch<15?K_e(.07,.7,xe((14-K.zoom)/5,0,1)):.07,X=h.paint.get("line-trim-color-use-theme").constantOr("default")==="none";return{u_matrix:Y_e(f,c,h,g),u_texsize:c.imageAtlasTexture?c.imageAtlasTexture.size:[0,0],u_pixels_to_tile_units:K.calculatePixelsToTileUnitsMatrix(c),u_device_pixel_ratio:v,u_width_scale:N,u_floor_width_scale:C,u_image:0,u_tile_units_to_pixels:Z_e(c,K),u_units_to_pixels:[1/K.pixelsToGLUnits[0],1/K.pixelsToGLUnits[1]],u_alpha_discard_threshold:0,u_trim_offset:L,u_trim_fade_range:h.paint.get("line-trim-fade-range"),u_trim_color:h.paint.get("line-trim-color").toPremultipliedRenderColor(X?null:h.lut).toArray01(),u_zbias_factor:Z,u_tile_to_meter:Le(c.tileID.canonical,0),u_ground_shadow_factor:F,u_pattern_transition:$}},i.e5=(f,c,h,g,v,N,C,L,F,$)=>{const K=f.transform,Z=K.calculatePixelsToTileUnitsMatrix(c),X=h.paint.get("line-trim-color-use-theme").constantOr("default")==="none",re=K.pitch<15?K_e(.07,.7,xe((14-K.zoom)/5,0,1)):.07;return{u_matrix:Y_e(f,c,h,g),u_pixels_to_tile_units:Z,u_device_pixel_ratio:N,u_width_scale:C,u_floor_width_scale:L,u_units_to_pixels:[1/K.pixelsToGLUnits[0],1/K.pixelsToGLUnits[1]],u_dash_image:0,u_gradient_image:1,u_image_height:v,u_texsize:Q_e(h)&&c.lineAtlasTexture?c.lineAtlasTexture.size:[0,0],u_tile_units_to_pixels:Z_e(c,f.transform),u_alpha_discard_threshold:0,u_trim_offset:F,u_trim_fade_range:h.paint.get("line-trim-fade-range"),u_trim_color:h.paint.get("line-trim-color").toPremultipliedRenderColor(X?null:h.lut).toArray01(),u_zbias_factor:re,u_tile_to_meter:Le(c.tileID.canonical,0),u_ground_shadow_factor:$}},i.e6=$t,i.e7=sM,i.e8=ce,i.e9=mh,i.eA=function(f,c){var h=2*Math.acos(c[3]),g=Math.sin(h/2);return g>u?(f[0]=c[0]/g,f[1]=c[1]/g,f[2]=c[2]/g):(f[0]=1,f[1]=0,f[2]=0),h},i.eB=kle,i.eC=G6,i.eD=W6,i.eE=[1,1,1],i.eF=c4,i.eG=Me,i.eH=function(f,c,h,g){var v=c[0],N=c[1],C=c[2],L=c[3];return f[0]=v+g*(h[0]-v),f[1]=N+g*(h[1]-N),f[2]=C+g*(h[2]-C),f[3]=L+g*(h[3]-L),f},i.eI=e4,i.eJ=Ou,i.eK=zf,i.eL=function(f,c,h,g,v,N,C,L,F,$,K,Z,X,re,ae,me){var Se=new p(16);return Se[0]=f,Se[1]=c,Se[2]=h,Se[3]=g,Se[4]=v,Se[5]=N,Se[6]=C,Se[7]=L,Se[8]=F,Se[9]=$,Se[10]=K,Se[11]=Z,Se[12]=X,Se[13]=re,Se[14]=ae,Se[15]=me,Se},i.eM=w,i.eN=v0,i.eO=W5,i.eP=class{constructor(){this._updateTime=0,this._sourceIds=[],this._activeRegions=[],this._prevRegions=[],this._globalClipBounds={min:new sr(1/0,1/0),max:new sr(-1/0,-1/0)}}clear(){this._activeRegions.length>0&&++this._updateTime,this._activeRegions=[],this._prevRegions=[]}get updateTime(){return this._updateTime}getReplacementRegionsForTile(f,c=!1){const h=Hve(new sr(0,0),new sr(Cr,Cr),f),g=[];if(c&&!Aoe(h,this._globalClipBounds))return g;for(const v of this._activeRegions){if(v.hiddenByOverlap||!Aoe(h,v))continue;const N=vHe(v.min,v.max,f);g.push({min:N.min,max:N.max,sourceId:this._sourceIds[v.priority],footprint:v.footprint,footprintTileId:v.tileId,order:v.order,clipMask:v.clipMask,clipScope:v.clipScope})}return g}setSources(f){this._setSources(f.map(c=>({getSourceId:()=>c.cache.id,getFootprints:()=>{const h=[];for(const g of c.cache.getVisibleCoordinates()){const v=c.cache.getTile(g).buckets[c.layer];v&&v.updateFootprints(g.toUnwrapped(),h)}return h},getOrder:()=>c.order,getClipMask:()=>c.clipMask,getClipScope:()=>c.clipScope})))}_addSource(f){const c=f.getFootprints();if(c.length===0)return;const h=f.getOrder(),g=f.getClipMask(),v=f.getClipScope();for(const N of c){if(!N.footprint)continue;const C=Hve(N.footprint.min,N.footprint.max,N.id);this._activeRegions.push({min:C.min,max:C.max,hiddenByOverlap:!1,priority:this._sourceIds.length,tileId:N.id,footprint:N.footprint,order:h,clipMask:g,clipScope:v})}this._sourceIds.push(f.getSourceId())}_computeReplacement(){this._activeRegions.sort((c,h)=>c.priority-h.priority||O6(c.min,h.min)||O6(c.max,h.max)||c.order-h.order||c.clipMask-h.clipMask||function(g,v){const N=(C,L)=>C+L;return g.length-v.length||g.reduce(N,"").localeCompare(v.reduce(N,""))}(c.clipScope,h.clipScope));let f=this._activeRegions.length!==this._prevRegions.length;if(!f){let c=0;for(;!f&&c!==this._activeRegions.length;){const h=this._activeRegions[c],g=this._prevRegions[c];f=h.priority!==g.priority||!Vve(h,g)||h.order!==g.order||h.clipMask!==g.clipMask||!Ia(h.clipScope,g.clipScope),this._activeRegions[c].hiddenByOverlap=g.hiddenByOverlap,++c}}if(f){++this._updateTime;for(const h of this._activeRegions)h.order!==dM&&(this._globalClipBounds.min.x=Math.min(this._globalClipBounds.min.x,h.min.x),this._globalClipBounds.min.y=Math.min(this._globalClipBounds.min.y,h.min.y),this._globalClipBounds.max.x=Math.max(this._globalClipBounds.max.x,h.max.x),this._globalClipBounds.max.y=Math.max(this._globalClipBounds.max.y,h.max.y));const c=h=>{const g=this._activeRegions;if(h>=g.length)return h;const v=g[h].priority;for(;h1){let h=0,g=c(h);for(;h!==g;){let v=h;const N=h;for(;v!==g;){const C=this._activeRegions[v];C.hiddenByOverlap=!1;for(let L=0;L=0;c--)this._addSource(f[c]);this._computeReplacement()}},i.eQ=dM,i.eR=class{constructor(f){this._createGrid(f),this._createPoles(f)}destroy(){this._poleIndexBuffer.destroy(),this._gridBuffer.destroy(),this._gridIndexBuffer.destroy(),this._poleNorthVertexBuffer.destroy(),this._poleSouthVertexBuffer.destroy();for(const f of this._poleSegments)f.destroy();for(const f of this._gridSegments)f.withSkirts.destroy(),f.withoutSkirts.destroy()}_fillGridMeshWithLods(f,c){const h=new ag,g=new Qo,v=[],N=f+1+2,C=c[0]+1,L=c[0]+1+(1+c.length),F=($,K,Z)=>{let X=$===N-1?$-2:$===0?$:$-1;return X+=Z?24575:0,[X,K]};for(let $=0;$0?(Se=2*Math.sqrt(me+1),f[3]=.25*Se,f[0]=(Z-re)/Se,f[1]=(X-F)/Se,f[2]=(L-$)/Se):C>K&&C>ae?(Se=2*Math.sqrt(1+C-K-ae),f[3]=(Z-re)/Se,f[0]=.25*Se,f[1]=(L+$)/Se,f[2]=(X+F)/Se):K>ae?(Se=2*Math.sqrt(1+K-C-ae),f[3]=(X-F)/Se,f[0]=(L+$)/Se,f[1]=.25*Se,f[2]=(Z+re)/Se):(Se=2*Math.sqrt(1+ae-C-K),f[3]=(L-$)/Se,f[0]=(X+F)/Se,f[1]=(Z+re)/Se,f[2]=.25*Se),f},i.f=function(f){return btoa(encodeURIComponent(f).replace(/%([0-9A-F]{2})/g,(c,h)=>String.fromCharCode(+("0x"+h))))},i.f0=function([f,c,h]){const g=Math.hypot(f,c,h),v=Math.atan2(f,h),N=.5*Math.PI-Math.acos(-c/g);return new m(Gi(v),Gi(N))},i.f1=Ee,i.f2=Hoe,i.f3=function(f){const c=f.navigator?f.navigator.userAgent:null;return!!function(h){if(wo==null){const g=h.navigator?h.navigator.userAgent:null;wo=!!h.safari||!(!g||!(/\b(iPad|iPhone|iPod)\b/.test(g)||g.match("Safari")&&!g.match("Chrome")))}return wo}(f)&&!(!c||!(c.match("Version/15.4")||c.match("Version/15.5")||c.match(/CPU (OS|iPhone OS) (15_4|15_5) like Mac OS X/)))},i.f4=function(f,c){Ky=f,Zy=c},i.f5=boe,i.f6=fve,i.f7=function(f){const c=[0,0,0],h=M(new Float64Array(16));return T(h,f.pixelMatrix,f.globeMatrix),at(c,c,h),new sr(c[0],c[1])},i.f8=function(){const f=gM;f&&(f.isPreloaded()&&f.numActive()===1?(f.release(Doe),gM=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(){B6().acquire(Doe)},i.fA=vL,i.fB=Ot,i.fC=function(f){let c=0;if(new Uint32Array(f,0,1)[0]!==N_e){const h=new Uint32Array(f,0,7),[,,g,v,N,C]=h;c=h.byteLength+v+N+C+N,(g!==f.byteLength||c>=f.byteLength)&&Wr("Invalid b3dm header information.")}return T_e(f,c)},i.fD=function(f,c){const h=Yoe(f);for(const g of h){for(const v of g.meshes)YHe(v);g.lights&&(g.lightMeshIndex=g.meshes.length,g.meshes.push(XHe(g.lights,c)))}return h},i.fE=fL,i.fF=$s,i.fG=__e,i.fH=Dp,i.fI=du,i.fJ=function(f){fc(),Tu!=null&&Tu.then(c=>{c.keys().then(h=>{for(let g=0;gWr(v.message))}).catch(h=>Wr(h.message))}).catch(c=>Wr(c.message))},i.fa=r_,i.fb=function(f,c,h=!1){if(wd===du.deferred||wd===du.loading||wd===du.loaded)throw new Error("setRTLTextPlugin cannot be called multiple times.");Op=Xo.resolveURL(f),wd=du.deferred,O5=c,_N(),h||o6()},i.fc=function(f){XN=Xo.resolveURL(f),QN||(QN=new YN(B6(),new Is)),QN.broadcast("setMeshoptUrl",XN)},i.fd=j_e,i.fe=function(f){zoe=Xo.resolveURL(f),QN||(QN=new YN(B6(),new Is)),QN.broadcast("setDracoUrl",zoe)},i.ff=w_e,i.fg=mM,i.fh=function(f){const c=lu();if(!c)return;const h=c.delete(Gy);f&&h.then(()=>f()).catch(f)},i.fi=g_,i.fj=en,i.fk=S0,i.fl=Gp,i.fm=U2e,i.fn=q2e,i.fo=V_e,i.fp=Jt,i.fq="hd_road_elevation",i.fr=Ca,i.fs=Vt,i.ft=Sx,i.fu=cle,i.fv=v_,i.fw=function(f,c,h,g,v,N,C,L=1,F,$,K){f.createArrays(),f.tilePixelRatio=Cr/(512*f.overscaling),f.compareText={},f.iconsNeedLinear=!1;const Z=f.layers[0].layout,X=f.layers[0]._unevaluatedLayout._values,re={};re.scaleFactor=L,re.textSizeScaleRange=Z.get("text-size-scale-range"),re.iconSizeScaleRange=Z.get("icon-size-scale-range");const[ae,me]=re.textSizeScaleRange,[Se,Ne]=re.iconSizeScaleRange;re.textScaleFactor=xe(re.scaleFactor,ae,me),re.iconScaleFactor=xe(re.scaleFactor,Se,Ne);const Fe=X["text-size"],ze=X["icon-size"];if(f.textSizeData.kind==="composite"){const{minZoom:Et,maxZoom:Xt}=f.textSizeData;re.compositeTextSizes=[Fe.possiblyEvaluate(new oi(Et,{worldview:K}),N),Fe.possiblyEvaluate(new oi(Xt,{worldview:K}),N)]}if(f.iconSizeData.kind==="composite"){const{minZoom:Et,maxZoom:Xt}=f.iconSizeData;re.compositeIconSizes=[ze.possiblyEvaluate(new oi(Et,{worldview:K}),N),ze.possiblyEvaluate(new oi(Xt,{worldview:K}),N)]}re.layoutTextSize=Fe.possiblyEvaluate(new oi(C+1,{worldview:K}),N),re.layoutIconSize=ze.possiblyEvaluate(new oi(C+1,{worldview:K}),N),re.textMaxSize=Fe.possiblyEvaluate(new oi(18,{worldview:K}),N);const Xe=Z.get("symbol-placement"),gt=Z.get("text-rotation-alignment")==="map"&&Xe!=="point",ht=Z.get("text-size");let bt=!1;const Ct=[];for(const Et of f.features){const Xt=Z.get("text-font").evaluate(Et,{},N).join(","),Rt=ht.evaluate(Et,{},N)*re.textScaleFactor,rr=re.layoutTextSize.evaluate(Et,{},N)*re.textScaleFactor,lr=re.layoutIconSize.evaluate(Et,{},N)*re.iconScaleFactor,cr={horizontal:{},vertical:void 0},yr=Et.text;let _r,fr=[0,0];if(yr){const ls=yr.toString(),Wa=Z.get("text-letter-spacing").evaluate(Et,{},N)*wl,ft=Z.get("text-line-height").evaluate(Et,{},N)*wl,xt=P5(ls)?Wa:0,nr=Z.get("text-anchor").evaluate(Et,{},N),vr=Z.get("text-variable-anchor");if(!vr){const ss=Z.get("text-radial-offset").evaluate(Et,{},N);if(ss)fr=Sbe(nr,[ss*wl,hle]);else{const ms=Z.get("text-offset").evaluate(Et,{},N);fr=[ms[0]*wl,ms[1]*wl]}}let zr=gt?"center":Z.get("text-justify").evaluate(Et,{},N);const Br=Xe==="point",vn=Br?Z.get("text-max-width").evaluate(Et,{},N)*wl:1/0,wn=ss=>{f.allowVerticalPlacement&&e_(ls)&&(cr.vertical=sle(yr,c,h,v,Xt,vn,ft,nr,ss,xt,fr,Fu.vertical,!0,rr,Rt,F))};if(!gt&&vr){const ss=zr==="auto"?vr.map(vs=>fle(vs)):[zr];let ms=!1;for(let vs=0;vs=0||!e_(ls)){const ss=sle(yr,c,h,v,Xt,vn,ft,nr,zr,xt,fr,Fu.horizontal,!1,rr,Rt,F);ss&&(cr.horizontal[zr]=ss)}wn(Br?"left":zr)}}let gr,tr,Qt,xr,Tr,jr,xn=!1;const Vr=Z.get("icon-text-fit").evaluate(Et,{},N);if(Et.icon&&Et.icon.hasPrimary()){const ls=SM(Et.icon,f.iconSizeData,X["icon-size"],N,f.zoom,Et,F,re.iconScaleFactor,K);gr=ls.iconPrimary,Qt=ls.iconSecondary;const Wa=gr.toString();if(tr=g.get(Wa),tr&&(Tr=Z.get("icon-offset").evaluate(Et,{},N),jr=Z.get("icon-anchor").evaluate(Et,{},N),_r=Q6(v.get(Wa),Qt?v.get(Qt.toString()):void 0,Tr,jr),xn=tr.sdf,f.sdfIcons===void 0?f.sdfIcons=tr.sdf:f.sdfIcons!==tr.sdf&&Wr("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(tr.pixelRatio!==f.pixelRatio||Z.get("icon-rotate").constantOr(1)!==0)&&(f.iconsNeedLinear=!0)),Qt){const ft=Qt.toString();xr=g.get(ft)}}bt=bt||!(!Et.icon||!Et.icon.hasSecondary());const Qr=nL(cr.horizontal)||cr.vertical;f.iconsInText||(f.iconsInText=!!Qr&&Qr.iconsInText);const an=rr*re.textScaleFactor/wl,{defaultShapedIcon:bs,verticallyShapedIcon:kr}=aGe(f,_r,Z,Et,N,cr,an,Tr,Vr);Vr!=="none"&&_r&&(ube(_r)||hbe(_r))&&(rL(0,tr,gr,_r,bs,Vr,$,g,v),rL(0,xr,Qt,_r,bs,Vr,$,g,v),kr&&(rL(0,tr,gr,_r,kr,Vr,$,g,v),rL(0,xr,Qt,_r,kr,Vr,$,g,v))),_r=bs;const{iconBBox:ln,iconVerticalBBox:Wn,textBBox:qs,textVerticalBBox:Xs}=eGe(f,_r,kr,Z,Et,N,lr,Tr,re,v,jr,cr,rr,fr);Ct.push({feature:Et,shapedTextOrientations:cr,shapedText:Qr,shapedIcon:_r,iconPrimary:gr,iconSecondary:Qt,iconOffset:Tr,iconAnchor:jr,verticallyShapedIcon:kr,layoutTextSize:rr,layoutIconSize:lr,textOffset:fr,isSDFIcon:xn,iconTextFit:Vr,iconCollisionBounds:ln,iconVerticalCollisionBounds:Wn,textCollisionBounds:qs,textVerticalCollisionBounds:Xs})}return{featureData:Ct,sizes:re,hasAnySecondaryIcon:bt,textAlongLine:gt,symbolPlacement:Xe}},i.fx=_be,i.fy=function(f,c,h,g,v,N,C,L,F,$){f.iconAtlasPositions=$.iconPositions;const{featureData:K,hasAnySecondaryIcon:Z,sizes:X,textAlongLine:re,symbolPlacement:ae}=c;for(const me of K){const{shapedIcon:Se,verticallyShapedIcon:Ne,feature:Fe,shapedTextOrientations:ze,shapedText:Xe,layoutTextSize:gt,textOffset:ht,isSDFIcon:bt,iconPrimary:Ct,iconSecondary:Et,iconTextFit:Xt,iconOffset:Rt,iconCollisionBounds:rr,iconVerticalCollisionBounds:lr,textCollisionBounds:cr}=me;Mbe(Se,$.iconPositions,Ct,Et),Mbe(Ne,$.iconPositions,Ct,Et),sGe(ze,$.iconPositions),nGe(Ct,Et,$.iconPositions),(Xe||Se)&&iGe(f,Fe,ze,Se,Ne,F,X,gt,0,ht,bt,g,v,C,L,Z,Xt,Rt,re,ae,rr,lr,cr)}h&&f.generateCollisionDebugBuffers(N,f.collisionBoxArray,X.textScaleFactor)},i.fz=Ut,i.g=function(f,c){return Af(Object.assign(f,{method:"GET"}),c)},i.h=function(f){return f.indexOf("mapbox:")===0},i.i=function(f){return Es.API_STYLE_REGEX.test(f)&&!_l(f)},i.j=Oi,i.k=Uo,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 Af(Object.assign(f,{type:"json"}),c)},i.n=Qy,i.o=Xo,i.p=function(f,c){return Af(Object.assign(f,{method:"POST"}),c)},i.q=Lc,i.r=ih,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 Roe||(Roe=new g_("ImageRasterizer")),Roe},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=Wr,i.x=Ale,i.y=rs,i.z=Er}),o(["./shared"],function(i){function u(tt){const xe=tt?tt.url.toString():void 0;return xe?performance.getEntriesByName(xe):[]}function p(tt){if(typeof tt=="number"||typeof tt=="boolean"||typeof tt=="string"||tt==null)return JSON.stringify(tt);if(Array.isArray(tt)){let Pe="[";for(const Ye of tt)Pe+=`${p(Ye)},`;return`${Pe}]`}let xe="{";for(const Pe of Object.keys(tt).sort())xe+=`${Pe}:${p(tt[Pe])},`;return`${xe}}`}function x(tt){let xe="";for(const Pe of i.bx)xe+=`/${p(tt[Pe])}`;return xe}class y{constructor(xe){this.keyCache={},this._layers={},this._layerConfigs={},xe&&this.replace(xe)}replace(xe,Pe){this._layerConfigs={},this._layers={},this.update(xe,[],Pe)}update(xe,Pe,Ye){this._options=Ye;for(const _t of xe)this._layerConfigs[_t.id]=_t,(this._layers[_t.id]=i.du(_t,this.scope,null,this._options)).compileFilter(Ye),this.keyCache[_t.id]&&delete this.keyCache[_t.id];for(const _t of Pe)delete this.keyCache[_t],delete this._layerConfigs[_t],delete this._layers[_t];this.familiesBySource={};const Nt=function(_t,At){const $t={};for(let Vt=0;Vt<_t.length;Vt++){const pr=_t[Vt];let or=At&&At[pr.id];or||(pr.type==="symbol"?or=pr.id:(or=x(pr),pr.type==="line"&&pr.paint&&function jn(Wr){return typeof Wr=="string"&&Wr==="line-progress"||(Array.isArray(Wr)?Wr.some(jn):!(!Wr||typeof Wr!="object")&&Object.values(Wr).some(jn))}(pr.paint["line-width"])&&(or+=`/${p(pr.paint["line-width"])}`))),At&&(At[pr.id]=or);let Yr=$t[or];Yr||(Yr=$t[or]=[]),Yr.push(pr)}const Lt=[];for(const Vt in $t)Lt.push($t[Vt]);return Lt}(Object.values(this._layerConfigs),this.keyCache);for(const _t of Nt){const At=_t.map(Yr=>this._layers[Yr.id]),$t=At[0];if($t.visibility==="none")continue;const Lt=$t.source||"";let Vt=this.familiesBySource[Lt];Vt||(Vt=this.familiesBySource[Lt]={});const pr=$t.sourceLayer||"_geojsonTileLayer";let or=Vt[pr];or||(or=Vt[pr]=[]),or.push(At)}}}const _=1*i.fl;class b{constructor(xe){const Pe={},Ye=[];for(const $t in xe){const Lt=xe[$t],Vt=Pe[$t]={};for(const pr in Lt.glyphs){const or=Lt.glyphs[+pr];if(!or||or.bitmap.width===0||or.bitmap.height===0)continue;const Yr=or.metrics.localGlyph?_:1,jn={x:0,y:0,w:or.bitmap.width+2*Yr,h:or.bitmap.height+2*Yr};Ye.push(jn),Vt[pr]=jn}}const{w:Nt,h:_t}=i.G(Ye),At=new i.fk({width:Nt||1,height:_t||1});for(const $t in xe){const Lt=xe[$t];for(const Vt in Lt.glyphs){const pr=Lt.glyphs[+Vt];if(!pr||pr.bitmap.width===0||pr.bitmap.height===0)continue;const or=Pe[$t][Vt],Yr=pr.metrics.localGlyph?_:1;i.fk.copy(pr.bitmap,At,{x:0,y:0},{x:or.x+Yr,y:or.y+Yr},pr.bitmap)}}this.image=At,this.positions=Pe}}function S(tt,xe,Pe){tt[xe]?Pe&&(tt[xe].center=Pe):tt[xe]={floorIds:new Set,center:Pe||[0,0],floors:{}}}function k(tt,xe,Pe,Ye){for(const Nt of xe)S(tt,Nt),tt[Nt].floors[Pe]=Ye,tt[Nt].floorIds.add(Pe)}function M(tt){return{id:tt.properties.id.toString(),center:tt.properties.center.toString().split(";").map(Number)}}function P(tt){return{id:tt.properties.id.toString(),isDefault:!!tt.properties.is_default&&tt.properties.is_default,connections:tt.properties.connected_floor_ids?new Set(tt.properties.connected_floor_ids.toString().split(";")):new Set,conflicts:tt.properties.conflicted_floor_ids?new Set(tt.properties.conflicted_floor_ids.toString().split(";")):new Set,buildings:tt.properties.building_ids?new Set(tt.properties.building_ids.toString().split(";")):new Set,name:tt.properties.name.toString(),zIndex:tt.properties.z_index}}function T(tt,xe){return xe.every(Pe=>tt.properties&&tt.properties[Pe]!=null)}function I(tt){return T(tt,["type","id","name"])&&tt.properties.type==="building"}function z(tt){return T(tt,["type","id","name","z_index"])&&tt.properties.type==="floor"}i.fj(b,"GlyphAtlas");class D{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,Pe,Ye,Nt,_t,At){this.status="parsing",this.data=xe,this.collisionBoxArray=new i.b3;const $t=new i.fm(Object.keys(xe.layers).sort()),Lt=new i.fn(this.tileID,this.promoteId);Lt.bucketLayerIDs=[];const Vt={},pr=new i.fo(256,256),or={featureIndex:Lt,iconDependencies:new Map,patternDependencies:new Map,glyphDependencies:{},lineAtlas:pr,availableImages:Ye,brightness:this.brightness,scaleFactor:this.scaleFactor,elevationFeatures:void 0,activeFloors:void 0};if(this.indoor){const as=this.indoor.indoorState.activeFloorsVisible,is=function(es,$s,$i){const wo=function(Pi,ra){if(!Pi)return i.w("No source layers defined in indoor specification"),ra;if(Pi.size===0)return ra;const Li=Pi.difference(ra);for(const Ha of Li)i.w(`Missing source layer required in indoor specification: ${Ha}`);return ra.intersection(ra)}($s.sourceLayers,new Set(Object.keys(es.layers))),va=$s.indoorState,No=function(Pi,ra,Li,Ha){const Es=new Set,Oi=new Set,_l=new Set,Al=new Map,Zc={},Tf=Yo=>{const Vd=Al.get(Yo)||new Set;for(const hc of Es)if((Al.get(hc)||new Set).has(Yo)||Vd.has(hc))return!0;return!1};for(const Yo of ra){const Vd=Pi.layers[Yo];if(Vd)for(let hc=0;hc=Li.maxzoom||Li.visibility==="none")continue;U(ra,this.zoom,or.brightness,Ye,this.worldview);const Ha=Vt[Li.id]=Li.createBucket({index:Lt.bucketLayerIDs.length,layers:ra,zoom:this.zoom,lut:this.lut,canonical:this.canonical,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:wo,sourceID:this.source,projection:this.projection.spec,tessellationStep:this.tessellationStep,styleDefinedModelURLs:Nt,worldview:this.worldview,localizable:No});Lt.bucketLayerIDs.push(ra.map(Oi=>i.B(Oi.id,Oi.scope)));let Es=Ha.prepare?Ha.prepare():null;Es!=null?(Es=Es.then(()=>Ha.populate(va,or,this.tileID.canonical,this.tileTransform)),Yr.push(Es)):Ha.populate(va,or,this.tileID.canonical,this.tileTransform)}}const Wr=()=>{let as,is,es,$s,$i,wo;pr.trim();const va={type:"maybePrepare",isSymbolTile:this.isSymbolTile,zoom:this.zoom},No=()=>{if(as)return this.status="done",At(as);if(this.extraShadowCaster)this.status="done",At(null,{buckets:Object.values(Vt).filter(ra=>!ra.isEmpty()),featureIndex:Lt,collisionBoxArray:null,glyphAtlasImage:null,lineAtlas:null,imageAtlas:null,brightness:or.brightness,glyphMap:null,iconMap:null,glyphPositions:null});else if(is&&es&&$s){const ra=new b(is),Li=new Map;for(const[Oi,_l]of es.entries()){const{imagePosition:Al}=i.fu(Oi,_l,i.fv);Li.set(Oi,Al)}const Ha={};for(const Oi in Vt){const _l=Vt[Oi];_l instanceof i.b4&&(U(_l.layers,this.zoom,or.brightness,Ye,this.worldview),Ha[Oi]=i.fw(_l,is,ra.positions,es,Li,this.tileID.canonical,this.tileZoom,this.scaleFactor,this.pixelRatio,$i,this.worldview))}const Es={iconsPending:!0,patternsPending:!0};this.rasterizeIfNeeded(_t,es,$i,()=>{Es.iconsPending=!1,Pi(Ha,ra,Es)}),this.rasterizeIfNeeded(_t,$s,wo,()=>{Es.patternsPending=!1,Pi(Ha,ra,Es)})}},Pi=(ra,Li,Ha,Es)=>{if(Ha.iconsPending||Ha.patternsPending)return;const Oi=new i.fx(es,$s,this.lut);for(const _l in Vt){const Al=Vt[_l];if(_l in ra)i.fy(Al,ra[_l],this.showCollisionBoxes,Ye,this.tileID.canonical,this.tileZoom,this.projection,this.brightness,es,Oi);else if(Al.hasPattern&&(Al instanceof i.ba||Al instanceof i.bb||Al instanceof i.ea)){U(Al.layers,this.zoom,or.brightness,Ye,this.worldview);const Zc=Object.fromEntries(Oi.patternPositions);Al.addFeatures(or,this.tileID.canonical,Zc,Ye,this.tileTransform,this.brightness)}}this.status="done",At(null,{buckets:Object.values(Vt).filter(_l=>!_l.isEmpty()),featureIndex:Lt,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:Li.image,lineAtlas:pr,imageAtlas:Oi,brightness:or.brightness})};if(!this.extraShadowCaster){const ra=i.fs(or.glyphDependencies,Es=>Object.keys(Es).map(Number));Object.keys(ra).length?_t.send("getGlyphs",{uid:this.uid,stacks:ra},(Es,Oi)=>{as||(as=Es,is=Oi,No())},void 0,!1,va):is={};const Li=Array.from(or.iconDependencies.keys()).map(Es=>i.I.parse(Es));Li.length?_t.send("getImages",{images:Li,source:this.source,scope:this.scope,tileID:this.tileID,type:"icons"},(Es,Oi)=>{as||(as=Es,es=new Map,$i=this.updateImageMapAndGetImageTaskQueue(es,Oi,or.iconDependencies),No())},void 0,!1,va):(es=new Map,$i=new Map);const Ha=Array.from(or.patternDependencies.keys()).map(Es=>i.I.parse(Es));Ha.length?_t.send("getImages",{images:Ha,source:this.source,scope:this.scope,tileID:this.tileID,type:"patterns"},(Es,Oi)=>{as||(as=Es,$s=new Map,wo=this.updateImageMapAndGetImageTaskQueue($s,Oi,or.patternDependencies),No())},void 0,!1,va):($s=new Map,wo=new Map)}if(or.elevationFeatures&&or.elevationFeatures.length>0){const ra=[];for(const Ha of Object.values(Vt))if(Ha instanceof i.bb){const Es=Ha.getUnevaluatedPortalGraph();Es&&ra.push(Es)}const Li=i.ft.evaluate(ra);for(const Ha of Object.values(Vt))if(Ha instanceof i.bb){const Es=xe.layers[$t.decode(Ha.sourceLayerIndex)];Ha.setEvaluatedPortalGraph(Li,Es,this.tileID.canonical,or.availableImages,or.brightness)}}No()};Yr.length>0?Promise.allSettled(Yr).then(Wr).catch(At):Wr()}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,Pe,Ye,Nt){Array.from(Pe.values()).some(_t=>_t.usvg)?this.rasterize(xe,Pe,Ye,Nt):Nt()}updateImageMapAndGetImageTaskQueue(xe,Pe,Ye){const Nt=new Map;for(const _t of Pe.keys()){const At=Ye.get(_t)||[];for(const $t of At){const Lt=$t.toString(),Vt=Pe.get($t.id.toString());Vt.usvg?Nt.has(Lt)||(Nt.set(Lt,$t),xe.set(Lt,Object.assign({},Vt))):xe.set(Lt,Vt)}}return Nt}rasterize(xe,Pe,Ye,Nt){this.rasterizeTask=xe.send("rasterizeImages",{scope:this.scope,tasks:Ye},(_t,At)=>{if(!_t)for(const[$t,Lt]of At.entries()){const Vt=Object.assign(Pe.get($t),{data:Lt});Pe.set($t,Vt)}Nt()})}cancelRasterize(){this.rasterizeTask&&this.rasterizeTask.cancel()}}function U(tt,xe,Pe,Ye,Nt){const _t=new i.ac(xe,{brightness:Pe,worldview:Nt});for(const At of tt)At.recalculate(_t,Ye)}class V extends i.E{constructor(xe,Pe,Ye,Nt,_t,At,$t){super(),this.actor=xe,this.layerIndex=Pe,this.availableImages=Ye,this.availableModels=Nt,this.loadVectorData=At||i.aL,this.loading={},this.loaded={},this.deduped=new i.aK(xe.scheduler),this.isSpriteLoaded=_t,this.scheduler=xe.scheduler,this.brightness=$t}loadTile(xe,Pe){const Ye=xe.uid,Nt=xe&&xe.request,_t=Nt&&Nt.collectResourceTiming,At=this.loading[Ye]=new D(xe);At.abort=this.loadVectorData(xe,($t,Lt)=>{const Vt=!this.loading[Ye];if(delete this.loading[Ye],At.cancelRasterize(),Vt||$t||!Lt)return At.status="done",Vt||(this.loaded[Ye]=At),Pe($t);const pr=Lt.rawData,or={},Yr=i.aM(Lt.responseHeaders);Yr&&Yr.expires&&(or.expires=Yr.expires),Yr&&Yr.cacheControl&&(or.cacheControl=Yr.cacheControl),At.vectorTile=Lt.vectorTile||new i.fz(new i.bt(pr));const jn=()=>{At.parse(At.vectorTile,this.layerIndex,this.availableImages,this.availableModels,this.actor,(Wr,as)=>{if(Wr||!as)return Pe(Wr);const is={};if(_t){const es=u(Nt);es.length>0&&(is.resourceTiming=JSON.parse(JSON.stringify(es)))}Pe(null,Object.assign({rawTileData:pr.slice(0),responseHeaders:Lt.responseHeaders},as,or,is))})};this.isSpriteLoaded?jn():this.once("isSpriteLoaded",()=>{this.scheduler?this.scheduler.add(jn,{type:"parseTile",isSymbolTile:xe.isSymbolTile,zoom:xe.tileZoom}):jn()}),this.loaded=this.loaded||{},this.loaded[Ye]=At})}reloadTile(xe,Pe){const Ye=this.loaded,Nt=xe.uid;if(Ye&&Ye[Nt]){const _t=Ye[Nt];_t.updateParameters(xe);const At=($t,Lt)=>{const Vt=_t.reloadCallback;Vt&&(delete _t.reloadCallback,_t.parse(_t.vectorTile,this.layerIndex,this.availableImages,this.availableModels,this.actor,Vt)),Pe($t,Lt)};_t.status==="parsing"?_t.reloadCallback=At:_t.status==="done"&&(_t.vectorTile?_t.parse(_t.vectorTile,this.layerIndex,this.availableImages,this.availableModels,this.actor,At):At())}else Pe(null,void 0)}abortTile(xe,Pe){const Ye=xe.uid,Nt=this.loading[Ye];Nt&&(Nt.abort&&Nt.abort(),delete this.loading[Ye]),Pe()}removeTile(xe,Pe){const Ye=this.loaded,Nt=xe.uid;Ye&&Ye[Nt]&&delete Ye[Nt],Pe()}}class W{loadTile(xe,Pe){const{uid:Ye,encoding:Nt,rawImageData:_t,padding:At}=xe,$t=ImageBitmap&&_t instanceof ImageBitmap?this.getImageData(_t,At):_t;Pe(null,new i.fA(Ye,$t,Nt,At<1))}reloadTile(xe,Pe){Pe(null,null)}abortTile(xe,Pe){Pe()}removeTile(xe,Pe){Pe()}getImageData(xe,Pe){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 Ye=this.offscreenCanvasContext.getImageData(-Pe,-Pe,xe.width+2*Pe,xe.height+2*Pe);return this.offscreenCanvasContext.clearRect(0,0,this.offscreenCanvas.width,this.offscreenCanvas.height),Ye}}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,Pe){const Ye=this._mrt;this.status="parsing",this._entireBuffer=xe;try{Ye.parseHeader(xe),this._isHeaderLoaded=!0;const Nt=[];for(const _t in Ye.layers){const At=Ye.getLayer(_t),$t=At.getDataRange(At.getBandList()),Lt=Ye.createDecodingTask($t),Vt=xe.slice($t.firstByte,$t.lastByte+1),pr=i.bs.performDecoding(Vt,Lt).then(or=>Lt.complete(null,or)).catch(or=>Lt.complete(or,null));Nt.push(pr)}Promise.allSettled(Nt).then(()=>Pe(null,Ye)).catch(_t=>Pe(_t))}catch(Nt){Pe(Nt)}}}class J{constructor(xe){this.actor=xe,this.loading={},this.loaded={}}loadTile(xe,Pe){const Ye=xe.uid,Nt=xe.request,_t=this.loading[Ye]=new G(xe),{cancel:At}=i.bu(Nt,($t,Lt,Vt)=>{const pr=!this.loading[Ye];if(delete this.loading[Ye],pr||$t||!Lt)return _t.status="done",pr||(this.loaded[Ye]=_t),Pe($t);_t.parse(Lt,(or,Yr)=>{if(or||!Yr)return Pe(or);Pe(null,Yr,Vt)}),this.loaded[Ye]=_t});_t.abort=At}reloadTile(xe,Pe){Pe(null,void 0)}abortTile(xe,Pe){const Ye=xe.uid,Nt=this.loading[Ye];Nt&&(Nt.abort&&Nt.abort(),delete this.loading[Ye]),Pe()}removeTile(xe,Pe){const Ye=xe.uid;this.loaded[Ye]&&delete this.loaded[Ye],Pe()}decodeRasterArray(xe,Pe){i.bs.performDecoding(xe.buffer,xe.task).then(Ye=>Pe(null,Ye)).catch(Ye=>Pe(Ye))}}const ne=i.fB.prototype.toGeoJSON;class oe{constructor(xe){this._feature=xe,this.extent=i.al,this.type=xe.type,this.properties=xe.tags,"id"in xe&&!isNaN(xe.id)&&(this.id=parseInt(xe.id,10))}loadGeometry(){if(this._feature.type===1){const xe=[];for(const Pe of this._feature.geometry)xe.push([new i.P(Pe[0],Pe[1])]);return xe}{const xe=[];for(const Pe of this._feature.geometry){const Ye=[];for(const Nt of Pe)Ye.push(new i.P(Nt[0],Nt[1]));xe.push(Ye)}return xe}}toGeoJSON(xe,Pe,Ye){return ne.call(this,xe,Pe,Ye)}}class ge{constructor(xe,Pe){this.name=xe,this.extent=i.al,this.length=Pe.length,this._jsonFeatures=Pe}feature(xe){return new oe(this._jsonFeatures[xe])}}class ie{constructor(xe){this.layers={},this.extent=i.al;for(const Pe of Object.keys(xe))this.layers[Pe]=new ge(Pe,xe[Pe])}}const pe=64/4096,se=128;class fe{constructor(){this.features=new Map}clear(){this.features.clear()}load(xe=[],Pe){for(const Ye of xe){const Nt=Ye.id;if(Nt==null)continue;let _t=this.features.get(Nt);_t&&this.updateCache(_t,Pe),Ye.geometry?(_t=ye(Ye),this.updateCache(_t,Pe),this.features.set(Nt,_t)):this.features.delete(Nt),this.updateCache(_t,Pe)}}updateCache(xe,Pe){for(const{canonical:Ye,uid:Nt}of Object.values(Pe)){const{z:_t,x:At,y:$t}=Ye;he(xe,Math.pow(2,_t),At,$t)&&delete Pe[Nt]}}getTile(xe,Pe,Ye){const Nt=Math.pow(2,xe),_t=[];for(const At of this.features.values())he(At,Nt,Pe,Ye)&&_t.push(_e(At,Nt,Pe,Ye));return{features:_t}}getFeatures(){return[...this.features.values()]}}function he({minX:tt,minY:xe,maxX:Pe,maxY:Ye},Nt,_t,At){return tt<(_t+1+pe)/Nt&&xe<(At+1+pe)/Nt&&Pe>(_t-pe)/Nt&&Ye>(At-pe)/Nt}function ye(tt){const{id:xe,geometry:Pe,properties:Ye}=tt;if(!Pe)return;if(Pe.type==="GeometryCollection")throw new Error("GeometryCollection not supported in dynamic mode.");const{type:Nt,coordinates:_t}=Pe,At={id:xe,type:1,geometry:[],tags:Ye,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0},$t=At.geometry;if(Nt==="Point")Ae(_t,$t,At);else if(Nt==="MultiPoint")for(const Lt of _t)Ae(Lt,$t,At);else if(Nt==="LineString")At.type=2,we(_t,$t,At);else if(Nt==="MultiLineString")At.type=2,be(_t,$t,At);else if(Nt==="Polygon")At.type=3,be(_t,$t,At,!0);else{if(Nt!=="MultiPolygon")throw new Error("Input data is not a valid GeoJSON object.");At.type=3;for(const Lt of _t)be(Lt,$t,At,!0)}return At}function Ae([tt,xe],Pe,Ye){const Nt=i.aF(tt);let _t=i.aJ(xe);_t=_t<0?0:_t>1?1:_t,Pe.push(Nt,_t),Ye.minX=Math.min(Ye.minX,Nt),Ye.minY=Math.min(Ye.minY,_t),Ye.maxX=Math.max(Ye.maxX,Nt),Ye.maxY=Math.max(Ye.maxY,_t)}function we(tt,xe,Pe,Ye=!1,Nt=!1){const _t=[];for(const At of tt)Ae(At,_t,Pe);xe.push(_t),Ye&&function(At,$t){let Lt=0;for(let Vt=0,pr=At.length,or=pr-2;Vt0===$t)for(let Vt=0,pr=At.length;Vt=At&&or>=At||(Vt>=At?(pr+=Math.round(Wr*((At-Vt)/jn)),Vt=At):or>=At&&(Yr=pr+Math.round(Wr*((At-Vt)/jn)),or=At),pr>=At&&Yr>=At||(pr>=At?(Vt+=Math.round(jn*((At-pr)/Wr)),pr=At):Yr>=At&&(or=Vt+Math.round(jn*((At-pr)/Wr)),Yr=At),$t&&Vt===$t[$t.length-1][0]&&pr===$t[$t.length-1][1]||($t=[[Vt,pr]],Nt.push($t)),$t.push([or,Yr])))))}}function Te(tt,xe,Pe,Ye,Nt){const _t=(Pe-pe)/xe,At=(Ye-pe)/xe,$t=(Pe+1+pe)/xe,Lt=(Ye+1+pe)/xe;function Vt(Yr,jn){let Wr=0;return Yr<_t?Wr|=1:Yr>$t&&(Wr|=2),jnLt&&(Wr|=8),Wr}let pr=[];for(let Yr=1;Yr<=8;Yr*=2){let jn=tt[tt.length-2],Wr=tt[tt.length-1],as=!(Vt(jn,Wr)&Yr);for(let is=0;is>31}function Mt(tt,xe){const{geometry:Pe,type:Ye}=tt;let Nt=0,_t=0;if(Ye===1){xe.writeVarint(qe(1,Pe.length));for(const At of Pe){const $t=At[0]-Nt,Lt=At[1]-_t;xe.writeVarint(ot($t)),xe.writeVarint(ot(Lt)),Nt+=$t,_t+=Lt}}else for(const At of Pe){xe.writeVarint(qe(1,1));const $t=At.length-(Ye===3?1:0);for(let Lt=0;Lt<$t;Lt++){Lt===1&&xe.writeVarint(qe(2,$t-1));const Vt=At[Lt][0]-Nt,pr=At[Lt][1]-_t;xe.writeVarint(ot(Vt)),xe.writeVarint(ot(pr)),Nt+=Vt,_t+=pr}Ye===3&&xe.writeVarint(qe(7,1))}}function Oe(tt,xe){const Pe=typeof tt;Pe==="string"?xe.writeStringField(1,tt):Pe==="boolean"?xe.writeBooleanField(7,tt):Pe==="number"&&(tt%1!=0?xe.writeDoubleField(3,tt):tt<0?xe.writeSVarintField(6,tt):xe.writeVarintField(5,tt))}const at={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:tt=>tt},le=Math.fround||(Ve=new Float32Array(1),tt=>(Ve[0]=+tt,Ve[0]));var Ve;const Qe=3,st=5,ke=6;class ct{constructor(xe){this.options=Object.assign(Object.create(at),xe),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(xe){const{log:Pe,minZoom:Ye,maxZoom:Nt}=this.options;Pe&&console.time("total time");const _t=`prepare ${xe.length} points`;Pe&&console.time(_t),this.points=xe;const At=[];for(let Lt=0;Lt=Ye;Lt--){const Vt=+Date.now();$t=this.trees[Lt]=this._createTree(this._cluster($t,Lt)),Pe&&console.log("z%d: %d clusters in %dms",Lt,$t.numItems,+Date.now()-Vt)}return Pe&&console.timeEnd("total time"),this}getClusters(xe,Pe){let Ye=((xe[0]+180)%360+360)%360-180;const Nt=Math.max(-90,Math.min(90,xe[1]));let _t=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)Ye=-180,_t=180;else if(Ye>_t){const or=this.getClusters([Ye,Nt,180,At],Pe),Yr=this.getClusters([-180,Nt,_t,At],Pe);return or.concat(Yr)}const $t=this.trees[this._limitZoom(Pe)],Lt=$t.range(Ge(Ye),Ee(At),Ge(_t),Ee(Nt)),Vt=$t.data,pr=[];for(const or of Lt){const Yr=this.stride*or;pr.push(Vt[Yr+st]>1?Ce(Vt,Yr,this.clusterProps):this.points[Vt[Yr+Qe]])}return pr}getChildren(xe){const Pe=this._getOriginId(xe),Ye=this._getOriginZoom(xe),Nt="No cluster with the specified id.",_t=this.trees[Ye];if(!_t)throw new Error(Nt);const At=_t.data;if(Pe*this.stride>=At.length)throw new Error(Nt);const $t=this.options.radius/(this.options.extent*Math.pow(2,Ye-1)),Lt=_t.within(At[Pe*this.stride],At[Pe*this.stride+1],$t),Vt=[];for(const pr of Lt){const or=pr*this.stride;At[or+4]===xe&&Vt.push(At[or+st]>1?Ce(At,or,this.clusterProps):this.points[At[or+Qe]])}if(Vt.length===0)throw new Error(Nt);return Vt}getLeaves(xe,Pe,Ye){const Nt=[];return this._appendLeaves(Nt,xe,Pe=Pe||10,Ye=Ye||0,0),Nt}getTile(xe,Pe,Ye){const Nt=this.trees[this._limitZoom(xe)],_t=Math.pow(2,xe),{extent:At,radius:$t}=this.options,Lt=$t/At,Vt=(Ye-Lt)/_t,pr=(Ye+1+Lt)/_t,or={features:[]};return this._addTileFeatures(Nt.range((Pe-Lt)/_t,Vt,(Pe+1+Lt)/_t,pr),Nt.data,Pe,Ye,_t,or),Pe===0&&this._addTileFeatures(Nt.range(1-Lt/_t,Vt,1,pr),Nt.data,_t,Ye,_t,or),Pe===_t-1&&this._addTileFeatures(Nt.range(0,Vt,Lt/_t,pr),Nt.data,-1,Ye,_t,or),or.features.length?or:null}getClusterExpansionZoom(xe){let Pe=this._getOriginZoom(xe)-1;for(;Pe<=this.options.maxZoom;){const Ye=this.getChildren(xe);if(Pe++,Ye.length!==1)break;xe=Ye[0].properties.cluster_id}return Pe}_appendLeaves(xe,Pe,Ye,Nt,_t){const At=this.getChildren(Pe);for(const $t of At){const Lt=$t.properties;if(Lt&&Lt.cluster?_t+Lt.point_count<=Nt?_t+=Lt.point_count:_t=this._appendLeaves(xe,Lt.cluster_id,Ye,Nt,_t):_t1;let pr,or,Yr;if(Vt)pr=Me(Pe,Lt,this.clusterProps),or=Pe[Lt],Yr=Pe[Lt+1];else{const as=this.points[Pe[Lt+Qe]];pr=as.properties;const[is,es]=as.geometry.coordinates;or=Ge(is),Yr=Ee(es)}const jn={type:1,geometry:[[Math.round(this.options.extent*(or*_t-Ye)),Math.round(this.options.extent*(Yr*_t-Nt))]],tags:pr};let Wr;Wr=Vt||this.options.generateId?Pe[Lt+Qe]:this.points[Pe[Lt+Qe]].id,Wr!==void 0&&(jn.id=Wr),At.features.push(jn)}}_limitZoom(xe){return Math.max(this.options.minZoom,Math.min(Math.floor(+xe),this.options.maxZoom+1))}_cluster(xe,Pe){const{radius:Ye,extent:Nt,reduce:_t,minPoints:At}=this.options,$t=Ye/(Nt*Math.pow(2,Pe)),Lt=xe.data,Vt=[],pr=this.stride;for(let or=0;orPe&&(is+=Lt[$s+st])}if(is>as&&is>=At){let es,$s=Yr*as,$i=jn*as,wo=-1;const va=(or/pr<<5)+(Pe+1)+this.points.length;for(const No of Wr){const Pi=No*pr;if(Lt[Pi+2]<=Pe)continue;Lt[Pi+2]=Pe;const ra=Lt[Pi+st];$s+=Lt[Pi]*ra,$i+=Lt[Pi+1]*ra,Lt[Pi+4]=va,_t&&(es||(es=this._map(Lt,or,!0),wo=this.clusterProps.length,this.clusterProps.push(es)),_t(es,this._map(Lt,Pi)))}Lt[or+4]=va,Vt.push($s/is,$i/is,1/0,va,-1,is),_t&&Vt.push(wo)}else{for(let es=0;es1)for(const es of Wr){const $s=es*pr;if(!(Lt[$s+2]<=Pe)){Lt[$s+2]=Pe;for(let $i=0;$i>5}_getOriginZoom(xe){return(xe-this.points.length)%32}_map(xe,Pe,Ye){if(xe[Pe+st]>1){const At=this.clusterProps[xe[Pe+ke]];return Ye?Object.assign({},At):At}const Nt=this.points[xe[Pe+Qe]].properties,_t=this.options.map(Nt);return Ye&&_t===Nt?Object.assign({},_t):_t}}function Ce(tt,xe,Pe){return{type:"Feature",id:tt[xe+Qe],properties:Me(tt,xe,Pe),geometry:{type:"Point",coordinates:[(Ye=tt[xe],360*(Ye-.5)),He(tt[xe+1])]}};var Ye}function Me(tt,xe,Pe){const Ye=tt[xe+st],Nt=Ye>=1e4?`${Math.round(Ye/1e3)}k`:Ye>=1e3?Math.round(Ye/100)/10+"k":Ye,_t=tt[xe+ke],At=_t===-1?{}:Object.assign({},Pe[_t]);return Object.assign(At,{cluster:!0,cluster_id:tt[xe+Qe],point_count:Ye,point_count_abbreviated:Nt})}function Ge(tt){return tt/360+.5}function Ee(tt){const xe=Math.sin(tt*Math.PI/180),Pe=.5-.25*Math.log((1+xe)/(1-xe))/Math.PI;return Pe<0?0:Pe>1?1:Pe}function He(tt){const xe=(180-360*tt)*Math.PI/180;return 360*Math.atan(Math.exp(xe))/Math.PI-90}function nt(tt,xe,Pe,Ye){let Nt=Ye;const _t=xe+(Pe-xe>>1);let At,$t=Pe-xe;const Lt=tt[xe],Vt=tt[xe+1],pr=tt[Pe],or=tt[Pe+1];for(let Yr=xe+3;YrNt)At=Yr,Nt=jn;else if(jn===Nt){const Wr=Math.abs(Yr-_t);Wr<$t&&(At=Yr,$t=Wr)}}Nt>Ye&&(At-xe>3&&nt(tt,xe,At,Ye),tt[At+2]=Nt,Pe-At>3&&nt(tt,At,Pe,Ye))}function yt(tt,xe,Pe,Ye,Nt,_t){let At=Nt-Pe,$t=_t-Ye;if(At!==0||$t!==0){const Lt=((tt-Pe)*At+(xe-Ye)*$t)/(At*At+$t*$t);Lt>1?(Pe=Nt,Ye=_t):Lt>0&&(Pe+=At*Lt,Ye+=$t*Lt)}return At=tt-Pe,$t=xe-Ye,At*At+$t*$t}function it(tt,xe,Pe,Ye){const Nt={id:tt??null,type:xe,geometry:Pe,tags:Ye,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if(xe==="Point"||xe==="MultiPoint"||xe==="LineString")zt(Nt,Pe);else if(xe==="Polygon")zt(Nt,Pe[0]);else if(xe==="MultiLineString")for(const _t of Pe)zt(Nt,_t);else if(xe==="MultiPolygon")for(const _t of Pe)zt(Nt,_t[0]);return Nt}function zt(tt,xe){for(let Pe=0;Pe0&&(At+=Ye?(Nt*pr-Vt*_t)/2:Math.sqrt(Math.pow(Vt-Nt,2)+Math.pow(pr-_t,2))),Nt=Vt,_t=pr}const $t=xe.length-3;xe[2]=1,nt(xe,0,$t,Pe),xe[$t+2]=1,xe.size=Math.abs(At),xe.start=0,xe.end=xe.size}function Ur(tt,xe,Pe,Ye){for(let Nt=0;Nt1?1:Pe}function ur(tt,xe,Pe,Ye,Nt,_t,At,$t){if(Ye/=xe,_t>=(Pe/=xe)&&At=Ye)return null;const Lt=[];for(const Vt of tt){const pr=Vt.geometry;let or=Vt.type;const Yr=Nt===0?Vt.minX:Vt.minY,jn=Nt===0?Vt.maxX:Vt.maxY;if(Yr>=Pe&&jn=Ye)continue;let Wr=[];if(or==="Point"||or==="MultiPoint")Rn(pr,Wr,Pe,Ye,Nt);else if(or==="LineString")ea(pr,Wr,Pe,Ye,Nt,!1,$t.lineMetrics);else if(or==="MultiLineString")Ei(pr,Wr,Pe,Ye,Nt,!1);else if(or==="Polygon")Ei(pr,Wr,Pe,Ye,Nt,!0);else if(or==="MultiPolygon")for(const as of pr){const is=[];Ei(as,is,Pe,Ye,Nt,!0),is.length&&Wr.push(is)}if(Wr.length){if($t.lineMetrics&&or==="LineString"){for(const as of Wr)Lt.push(it(Vt.id,or,as,Vt.tags));continue}or!=="LineString"&&or!=="MultiLineString"||(Wr.length===1?(or="LineString",Wr=Wr[0]):or="MultiLineString"),or!=="Point"&&or!=="MultiPoint"||(or=Wr.length===3?"Point":"MultiPoint"),Lt.push(it(Vt.id,or,Wr,Vt.tags))}}return Lt.length?Lt:null}function Rn(tt,xe,Pe,Ye,Nt){for(let _t=0;_t=Pe&&At<=Ye&&Ii(xe,tt[_t],tt[_t+1],tt[_t+2])}}function ea(tt,xe,Pe,Ye,Nt,_t,At){let $t=ca(tt);const Lt=Nt===0?$o:Va;let Vt,pr,or=tt.start;for(let is=0;isPe&&(pr=Lt($t,es,$s,wo,va,Pe),At&&($t.start=or+Vt*pr)):No>Ye?Pi=Pe&&(pr=Lt($t,es,$s,wo,va,Pe),ra=!0),Pi>Ye&&No<=Ye&&(pr=Lt($t,es,$s,wo,va,Ye),ra=!0),!_t&&ra&&(At&&($t.end=or+Vt*pr),xe.push($t),$t=ca(tt)),At&&(or+=Vt)}let Yr=tt.length-3;const jn=tt[Yr],Wr=tt[Yr+1],as=Nt===0?jn:Wr;as>=Pe&&as<=Ye&&Ii($t,jn,Wr,tt[Yr+2]),Yr=$t.length-3,_t&&Yr>=3&&($t[Yr]!==$t[0]||$t[Yr+1]!==$t[1])&&Ii($t,$t[0],$t[1],$t[2]),$t.length&&xe.push($t)}function ca(tt){const xe=[];return xe.size=tt.size,xe.start=tt.start,xe.end=tt.end,xe}function Ei(tt,xe,Pe,Ye,Nt,_t){for(const At of tt)ea(At,xe,Pe,Ye,Nt,_t,!1)}function Ii(tt,xe,Pe,Ye){tt.push(xe,Pe,Ye)}function $o(tt,xe,Pe,Ye,Nt,_t){const At=(_t-xe)/(Ye-xe);return Ii(tt,_t,Pe+(Nt-Pe)*At,1),At}function Va(tt,xe,Pe,Ye,Nt,_t){const At=(_t-Pe)/(Nt-Pe);return Ii(tt,xe+(Ye-xe)*At,_t,1),At}function cs(tt,xe){const Pe=[];for(let Ye=0;Ye0&&xe.size<(Nt?At:Ye))return void(Pe.numPoints+=xe.length/3);const $t=[];for(let Lt=0;LtAt)&&(Pe.numSimplified++,$t.push(xe[Lt],xe[Lt+1])),Pe.numPoints++;Nt&&function(Lt,Vt){let pr=0;for(let or=0,Yr=Lt.length,jn=Yr-2;or0===Vt)for(let or=0,Yr=Lt.length;or24)throw new Error("maxZoom should be in the 0-24 range");if(Pe.promoteId&&Pe.generateId)throw new Error("promoteId and generateId cannot be used together.");let Nt=function(_t,At){const $t=[];if(_t.type==="FeatureCollection")for(let Lt=0;Lt<_t.features.length;Lt++)dr($t,_t.features[Lt],At,Lt);else dr($t,_t.type==="Feature"?_t:{geometry:_t},At);return $t}(xe,Pe);this.tiles={},this.tileCoords=[],Ye&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",Pe.indexMaxZoom,Pe.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),Nt=function(_t,At){const $t=At.buffer/At.extent;let Lt=_t;const Vt=ur(_t,1,-1-$t,$t,0,-1,2,At),pr=ur(_t,1,1-$t,2+$t,0,-1,2,At);return(Vt||pr)&&(Lt=ur(_t,1,-$t,1+$t,0,-1,2,At)||[],Vt&&(Lt=cs(Vt,1).concat(Lt)),pr&&(Lt=Lt.concat(cs(pr,-1)))),Lt}(Nt,Pe),Nt.length&&this.splitTile(Nt,0,0,0),Ye&&(Nt.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}splitTile(xe,Pe,Ye,Nt,_t,At,$t){const Lt=[xe,Pe,Ye,Nt],Vt=this.options,pr=Vt.debug;for(;Lt.length;){Nt=Lt.pop(),Ye=Lt.pop(),Pe=Lt.pop(),xe=Lt.pop();const or=1<1&&console.time("creation"),jn=this.tiles[Yr]=Os(xe,Pe,Ye,Nt,Vt),this.tileCoords.push({z:Pe,x:Ye,y:Nt}),pr)){pr>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",Pe,Ye,Nt,jn.numFeatures,jn.numPoints,jn.numSimplified),console.timeEnd("creation"));const ra=`z${Pe}`;this.stats[ra]=(this.stats[ra]||0)+1,this.total++}if(jn.source=xe,_t==null){if(Pe===Vt.indexMaxZoom||jn.numPoints<=Vt.indexMaxPoints)continue}else{if(Pe===Vt.maxZoom||Pe===_t)continue;if(_t!=null){const ra=_t-Pe;if(Ye!==At>>ra||Nt!==$t>>ra)continue}}if(jn.source=null,xe.length===0)continue;pr>1&&console.time("clipping");const Wr=.5*Vt.buffer/Vt.extent,as=.5-Wr,is=.5+Wr,es=1+Wr;let $s=null,$i=null,wo=null,va=null,No=ur(xe,or,Ye-Wr,Ye+is,0,jn.minX,jn.maxX,Vt),Pi=ur(xe,or,Ye+as,Ye+es,0,jn.minX,jn.maxX,Vt);xe=null,No&&($s=ur(No,or,Nt-Wr,Nt+is,1,jn.minY,jn.maxY,Vt),$i=ur(No,or,Nt+as,Nt+es,1,jn.minY,jn.maxY,Vt),No=null),Pi&&(wo=ur(Pi,or,Nt-Wr,Nt+is,1,jn.minY,jn.maxY,Vt),va=ur(Pi,or,Nt+as,Nt+es,1,jn.minY,jn.maxY,Vt),Pi=null),pr>1&&console.timeEnd("clipping"),Lt.push($s||[],Pe+1,2*Ye,2*Nt),Lt.push($i||[],Pe+1,2*Ye,2*Nt+1),Lt.push(wo||[],Pe+1,2*Ye+1,2*Nt),Lt.push(va||[],Pe+1,2*Ye+1,2*Nt+1)}}getTile(xe,Pe,Ye){xe=+xe,Pe=+Pe,Ye=+Ye;const Nt=this.options,{extent:_t,debug:At}=Nt;if(xe<0||xe>24)return null;const $t=1<1&&console.log("drilling down to z%d-%d-%d",xe,Pe,Ye);let Vt,pr=xe,or=Pe,Yr=Ye;for(;!Vt&&pr>0;)pr--,or>>=1,Yr>>=1,Vt=this.tiles[yi(pr,or,Yr)];return Vt&&Vt.source?(At>1&&(console.log("found parent tile z%d-%d-%d",pr,or,Yr),console.time("drilling down")),this.splitTile(Vt.source,pr,or,Yr,xe,Pe,Ye),At>1&&console.timeEnd("drilling down"),this.tiles[Lt]?ds(this.tiles[Lt],_t):null):null}}function yi(tt,xe,Pe){return 32*((1<Vt.tags&&"3d_elevation_id"in Vt.tags&&"source"in Vt.tags&&Vt.tags.source==="elevation",_t=Ye.features.filter(Vt=>Nt(Vt));let At={_geojsonTileLayer:Ye.features};_t.length>0&&(At={_geojsonTileLayer:Ye.features.filter(Vt=>!Nt(Vt)),hd_road_elevation:_t});const $t=new ie(At),Lt=function(Vt){const pr=new i.bt;for(const or of Object.keys(Vt))pr.writeMessage(3,De,{name:or,features:Vt[or]});return pr.finish()}(At).buffer;xe(null,{vectorTile:$t,rawData:Lt})}class Gi extends V{constructor(xe,Pe,Ye,Nt,_t,At,$t){super(xe,Pe,Ye,Nt,_t,qn,$t),At&&(this.loadGeoJSON=At),this._dynamicIndex=new fe}loadData(xe,Pe){const Ye=xe&&xe.request,Nt=Ye&&Ye.collectResourceTiming;this._geoJSONIndex=null,this.loadGeoJSON(xe,(_t,At)=>{if(_t||!At)return Pe(_t);if(typeof At!="object")return Pe(new Error(`Input data given to '${xe.source}' is not a valid GeoJSON object.`));{try{if(xe.filter){const Lt=i.U(xe.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(Lt.result==="error")throw new Error(Lt.value.map(Vt=>`${Vt.key}: ${Vt.message}`).join(", "));At.features=At.features.filter(Vt=>Lt.value.evaluate({zoom:0},Vt))}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 ct(function({superclusterOptions:Lt,clusterProperties:Vt}){if(!Vt||!Lt)return Lt;const pr={},or={},Yr={accumulated:null,zoom:0},jn={properties:null},Wr=Object.keys(Vt);for(const as of Wr){const[is,es]=Vt[as],$s=i.U(es),$i=i.U(typeof is=="string"?[is,["accumulated"],["get",as]]:is);pr[as]=$s.value,or[as]=$i.value}return Lt.map=as=>{jn.properties=as;const is={};for(const es of Wr)is[es]=pr[es].evaluate(Yr,jn);return is},Lt.reduce=(as,is)=>{jn.properties=is;for(const es of Wr)Yr.accumulated=as[es],as[es]=or[es].evaluate(Yr,jn)},Lt}(xe)).load(At.features):xe.dynamic?this._dynamicIndex:function(Lt,Vt){return new no(Lt,Vt)}(At,xe.geojsonVtOptions)}catch(Lt){return Pe(Lt)}const $t={};if(Nt){const Lt=u(Ye);Lt&&($t.resourceTiming={},$t.resourceTiming[xe.source]=JSON.parse(JSON.stringify(Lt)))}Pe(null,$t)}})}reloadTile(xe,Pe){const Ye=this.loaded;return Ye&&Ye[xe.uid]?xe.partial?Pe(null,void 0):super.reloadTile(xe,Pe):this.loadTile(xe,Pe)}loadGeoJSON(xe,Pe){if(xe.request)i.m(xe.request,Pe);else{if(typeof xe.data!="string")return Pe(new Error(`Input data given to '${xe.source}' is not a valid GeoJSON object.`));setTimeout(()=>{try{return Pe(null,JSON.parse(xe.data))}catch{return Pe(new Error(`Input data given to '${xe.source}' is not a valid GeoJSON object.`))}},0)}}getClusterExpansionZoom(xe,Pe){try{Pe(null,this._geoJSONIndex.getClusterExpansionZoom(xe.clusterId))}catch(Ye){Pe(Ye)}}getClusterChildren(xe,Pe){try{Pe(null,this._geoJSONIndex.getChildren(xe.clusterId))}catch(Ye){Pe(Ye)}}getClusterLeaves(xe,Pe){try{Pe(null,this._geoJSONIndex.getLeaves(xe.clusterId,xe.limit,xe.offset))}catch(Ye){Pe(Ye)}}}class dc{constructor(xe,Pe,Ye){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=Pe,this.worldview=Ye}parse(xe,Pe,Ye,Nt){this.status="parsing";const _t=new i.aQ(Ye.tileID.overscaledZ,Ye.tileID.wrap,Ye.tileID.canonical.z,Ye.tileID.canonical.x,Ye.tileID.canonical.y),At=[],$t=Pe.familiesBySource[Ye.source],Lt=new i.fn(_t,Ye.promoteId);Lt.bucketLayerIDs=[],Lt.is3DTile=!0,i.fC(xe).then(Vt=>{if(!Vt)return Nt(new Error("Could not parse tile"));const pr=Vt.json.extensionsUsed&&Vt.json.extensionsUsed.includes("MAPBOX_mesh_features")||Vt.json.asset.extras&&Vt.json.asset.extras.MAPBOX_mesh_features,or=Vt.json.extensionsUsed&&Vt.json.extensionsUsed.includes("EXT_meshopt_compression"),Yr=new i.ac(this.zoom,{brightness:this.brightness,worldview:this.worldview});for(const jn in $t)for(const Wr of $t[jn]){const as=Wr[0];Lt.bucketLayerIDs.push(Wr.map($s=>i.B($s.id,$s.scope))),as.recalculate(Yr,[]);const is=i.fD(Vt,1/i.d7(Ye.tileID.canonical)),es=new i.fE(Wr,is,_t,pr,or,this.brightness,Lt,this.worldview);pr||(es.needsUpload=!0),At.push(es),es.evaluate(as)}this.status="done",Nt(null,{buckets:At,featureIndex:Lt,collisionBoxArray:null,glyphAtlasImage:null,lineAtlas:null,imageAtlas:null,brightness:null})}).catch(Vt=>Nt(new Error(Vt.message)))}}class go{constructor(xe,Pe,Ye,Nt,_t,At,$t,Lt){this.actor=xe,this.layerIndex=Pe,this.availableImages=Ye,this.availableModels=Nt,this.brightness=$t,this.loading={},this.loaded={},this.worldview=Lt}loadTile(xe,Pe){const Ye=xe.uid,Nt=this.loading[Ye]=new dc(xe,this.brightness,this.worldview);i.bu(xe.request,(_t,At)=>{const $t=!this.loading[Ye];return delete this.loading[Ye],$t||_t?(Nt.status="done",$t||(this.loaded[Ye]=Nt),Pe(_t)):At&&At.byteLength!==0?void Nt.parse(At,this.layerIndex,xe,(Lt,Vt)=>{Nt.status="done",this.loaded=this.loaded||{},this.loaded[Ye]=Nt,Lt||!Vt?Pe(Lt):Pe(null,Vt)}):(Nt.status="done",this.loaded[Ye]=Nt,Pe())})}reloadTile(xe,Pe){const Ye=this.loaded,Nt=xe.uid;if(Ye&&Ye[Nt]){const _t=Ye[Nt];_t.projection=xe.projection,_t.brightness=xe.brightness;const At=($t,Lt)=>{_t.reloadCallback&&(delete _t.reloadCallback,this.loadTile(xe,Pe)),Pe($t,Lt)};_t.status==="parsing"?_t.reloadCallback=At:_t.status==="done"&&this.loadTile(xe,Pe)}}abortTile(xe,Pe){const Ye=xe.uid;this.loading[Ye]&&delete this.loading[Ye],Pe()}removeTile(xe,Pe){const Ye=this.loaded,Nt=xe.uid;Ye&&Ye[Nt]&&delete Ye[Nt],Pe()}}class uc{constructor(xe){this.self=xe,this.actor=new i.fG(xe,this),this.layerIndexes={},this.availableImages={},this.availableModels={},this.isSpriteLoaded={},this.imageRasterizer=new i.x,this.rtlPluginParsingListeners=[],this.projections={},this.defaultProjection=i.cm({name:"mercator"}),this.workerSourceTypes={vector:V,geojson:Gi,"raster-dem":W,"raster-array":J,"batched-model":go},this.workerSources={},this.self.registerWorkerSource=(Pe,Ye)=>{if(this.workerSourceTypes[Pe])throw new Error(`Worker source with name "${Pe}" already registered.`);this.workerSourceTypes[Pe]=Ye},this.self.registerRTLTextPlugin=Pe=>{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=Pe.applyArabicShaping,i.fH.processBidirectionalText=Pe.processBidirectionalText,i.fH.processStyledBidirectionalText=Pe.processStyledBidirectionalText;for(const Ye of this.rtlPluginParsingListeners)Ye(null,!0);this.rtlPluginParsingListeners=[]}}clearCaches(xe,Pe,Ye){delete this.layerIndexes[xe],delete this.availableImages[xe],delete this.availableModels[xe],delete this.workerSources[xe],Ye()}checkIfReady(xe,Pe,Ye){Ye()}setReferrer(xe,Pe){this.referrer=Pe}spriteLoaded(xe,Pe){this.isSpriteLoaded[xe]||(this.isSpriteLoaded[xe]={});const{scope:Ye,isLoaded:Nt}=Pe;if(this.isSpriteLoaded[xe][Ye]=Nt,this.workerSources[xe]&&this.workerSources[xe][Ye])for(const _t in this.workerSources[xe][Ye]){const At=this.workerSources[xe][Ye][_t];for(const $t in At){const Lt=At[$t];Lt instanceof V&&(Lt.isSpriteLoaded=Nt,Lt.fire(new i.z("isSpriteLoaded")))}}}setImages(xe,Pe,Ye){this.availableImages[xe]||(this.availableImages[xe]={});const{scope:Nt,images:_t}=Pe;if(this.availableImages[xe][Nt]=_t,this.workerSources[xe]&&this.workerSources[xe][Nt]){for(const At in this.workerSources[xe][Nt]){const $t=this.workerSources[xe][Nt][At];for(const Lt in $t)$t[Lt].availableImages=_t}Ye()}else Ye()}setModels(xe,{scope:Pe,models:Ye},Nt){if(this.availableModels[xe]||(this.availableModels[xe]={}),this.availableModels[xe][Pe]=Ye,this.workerSources[xe]&&this.workerSources[xe][Pe]){for(const _t in this.workerSources[xe][Pe]){const At=this.workerSources[xe][Pe][_t];for(const $t in At)At[$t].availableModels=Ye}Nt()}else Nt()}setProjection(xe,Pe){this.projections[xe]=i.cm(Pe)}setBrightness(xe,Pe,Ye){this.brightness=Pe,Ye()}setWorldview(xe,Pe,Ye){this.worldview=Pe,Ye()}setLayers(xe,Pe,Ye){this.getLayerIndex(xe,Pe.scope).replace(Pe.layers,Pe.options),Ye()}updateLayers(xe,Pe,Ye){this.getLayerIndex(xe,Pe.scope).update(Pe.layers,Pe.removedIds,Pe.options),Ye()}loadTile(xe,Pe,Ye){Pe.projection=this.projections[xe]||this.defaultProjection,this.getWorkerSource(xe,Pe.type,Pe.source,Pe.scope).loadTile(Pe,Ye)}decodeRasterArray(xe,Pe,Ye){this.getWorkerSource(xe,Pe.type,Pe.source,Pe.scope).decodeRasterArray(Pe,Ye)}reloadTile(xe,Pe,Ye){Pe.projection=this.projections[xe]||this.defaultProjection,this.getWorkerSource(xe,Pe.type,Pe.source,Pe.scope).reloadTile(Pe,Ye)}abortTile(xe,Pe,Ye){this.getWorkerSource(xe,Pe.type,Pe.source,Pe.scope).abortTile(Pe,Ye)}removeTile(xe,Pe,Ye){this.getWorkerSource(xe,Pe.type,Pe.source,Pe.scope).removeTile(Pe,Ye)}removeSource(xe,Pe,Ye){if(!(this.workerSources[xe]&&this.workerSources[xe][Pe.scope]&&this.workerSources[xe][Pe.scope][Pe.type]&&this.workerSources[xe][Pe.scope][Pe.type][Pe.source]))return;const Nt=this.workerSources[xe][Pe.scope][Pe.type][Pe.source];delete this.workerSources[xe][Pe.scope][Pe.type][Pe.source],Nt.removeSource!==void 0?Nt.removeSource(Pe,Ye):Ye()}loadWorkerSource(xe,Pe,Ye){try{this.self.importScripts(Pe.url),Ye()}catch(Nt){Ye(Nt)}}syncRTLPluginState(xe,Pe,Ye){if(i.fH.isParsed())Ye(null,!0);else if(i.fH.isParsing())this.rtlPluginParsingListeners.push(Ye);else try{i.fH.setState(Pe);const Nt=i.fH.getPluginURL();!i.fH.isLoaded()||i.fH.isParsed()||i.fH.isParsing()||Nt==null||(i.fH.setState({pluginStatus:i.fI.parsing,pluginURL:i.fH.getPluginURL()}),this.self.importScripts(Nt),i.fH.isParsed()?Ye(null,!0):this.rtlPluginParsingListeners.push(Ye))}catch(Nt){Ye(Nt)}}setDracoUrl(xe,Pe){this.dracoUrl=Pe}getAvailableImages(xe,Pe){this.availableImages[xe]||(this.availableImages[xe]={});let Ye=this.availableImages[xe][Pe];return Ye||(Ye=[]),Ye}getAvailableModels(xe,Pe){this.availableModels[xe]||(this.availableModels[xe]={});let Ye=this.availableModels[xe][Pe];return Ye||(Ye={}),Ye}getLayerIndex(xe,Pe){this.layerIndexes[xe]||(this.layerIndexes[xe]={});let Ye=this.layerIndexes[xe][Pe];return Ye||(Ye=this.layerIndexes[xe][Pe]=new y,Ye.scope=Pe),Ye}getWorkerSource(xe,Pe,Ye,Nt){const _t=this.workerSources;return _t[xe]||(_t[xe]={}),_t[xe][Nt]||(_t[xe][Nt]={}),_t[xe][Nt][Pe]||(_t[xe][Nt][Pe]={}),this.isSpriteLoaded[xe]||(this.isSpriteLoaded[xe]={}),_t[xe][Nt][Pe][Ye]||(_t[xe][Nt][Pe][Ye]=new this.workerSourceTypes[Pe]({send:(At,$t,Lt,Vt,pr,or)=>this.actor.send(At,$t,Lt,xe,pr,or),scheduler:this.actor.scheduler},this.getLayerIndex(xe,Nt),this.getAvailableImages(xe,Nt),this.getAvailableModels(xe,Nt),this.isSpriteLoaded[xe][Nt],void 0,this.brightness,this.worldview)),_t[xe][Nt][Pe][Ye]}rasterizeImagesWorker(xe,Pe,Ye){const Nt=new Map;for(const[_t,{image:At,imageVariant:$t}]of Pe.tasks.entries()){const Lt=this.imageRasterizer.rasterize($t,At,Pe.scope,xe);Nt.set(_t,Lt)}Ye(void 0,Nt)}removeRasterizedImages(xe,Pe,Ye){this.imageRasterizer.removeImagesFromCacheByIds(Pe.imageIds,Pe.scope,xe),Ye()}enforceCacheSizeLimit(xe,Pe){i.fJ(Pe)}getWorkerPerformanceMetrics(xe,Pe,Ye){Ye(void 0,void 0)}}return i.fF(self)&&(self.worker=new uc(self)),uc}),o(["./shared"],function(i){var u="3.17.0";const p={create:"create",load:"load",fullLoad:"fullLoad"},x={mark(w){performance.mark(w)},measure(w,d,m){performance.measure(w,d,m)}};function y(w){const d=w.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={},S=function(){if(_)return b;function w(j){return!d(j)}function d(j){return typeof window>"u"||typeof document>"u"?"not a browser":function(){if(!("Worker"in window&&"Blob"in window&&"URL"in window))return!1;var O,R,B=new Blob([""],{type:"text/javascript"}),H=URL.createObjectURL(B);try{R=new Worker(H),O=!0}catch{O=!1}return R&&R.terminate(),URL.revokeObjectURL(H),O}()?function(){var O=document.createElement("canvas");O.width=O.height=1;var R=O.getContext("2d");if(!R)return!1;var B=R.getImageData(0,0,1,1);return B&&B.width===O.width}()?(m[A=j&&j.failIfMajorPerformanceCaveat]===void 0&&(m[A]=function(O){var R,B=function(H){var Y=document.createElement("canvas"),te=Object.create(w.webGLContextAttributes);return te.failIfMajorPerformanceCaveat=H,Y.getContext("webgl2",te)}(O);if(!B)return!1;try{R=B.createShader(B.VERTEX_SHADER)}catch{return!1}return!(!R||B.isContextLost())&&(B.shaderSource(R,"void main() {}"),B.compileShader(R),B.getShaderParameter(R,B.COMPILE_STATUS)===!0)}(A)),m[A]?document.documentMode?"insufficient ECMAScript 6 support":void 0:"insufficient WebGL2 support"):"insufficient Canvas/getImageData support":"insufficient worker support";var A}_=1,b.supported=w,b.notSupportedReason=d;var m={};return w.webGLContextAttributes={antialias:!1,alpha:!0,stencil:!0,depth:!0},b}();function k(w,d,m){const j=document.createElement(w);return d!=null&&(j.className=d),m&&m.appendChild(j),j}function M(w,d,m){const j=document.createElementNS("http://www.w3.org/2000/svg",w);for(const A of Object.keys(d))j.setAttributeNS(null,A,String(d[A]));return m&&m.appendChild(j),j}const P=typeof document<"u"?document.documentElement&&document.documentElement.style:null,T=P&&P.userSelect!==void 0?"userSelect":"WebkitUserSelect";let I;function z(){P&&T&&(I=P[T],P[T]="none")}function D(){P&&T&&(P[T]=I)}function U(w){w.preventDefault(),w.stopPropagation(),window.removeEventListener("click",U,!0)}function V(){window.addEventListener("click",U,!0),window.setTimeout(()=>{window.removeEventListener("click",U,!0)},0)}function W(w,d){const m=w.getBoundingClientRect();return ne(w,m,d)}function G(w,d){const m=w.getBoundingClientRect(),j=[];for(let A=0;Athis._skuTokenExpiresAt}transformRequest(d,m){return this._transformRequestFn&&this._transformRequestFn(d,m)||{url:d}}normalizeStyleURL(d,m){if(!i.h(d))return d;const j=se(d);return j.params.push(`sdk=js-${u}`),j.path=`/styles/v1${j.path}`,this._makeAPIURL(j,this._customAccessToken||m)}normalizeGlyphsURL(d,m){if(!i.h(d))return d;const j=se(d);return j.path=`/fonts/v1${j.path}`,this._makeAPIURL(j,this._customAccessToken||m)}normalizeModelURL(d,m){if(!i.h(d))return d;const j=se(d);return j.path=`/models/v1${j.path}`,this._makeAPIURL(j,this._customAccessToken||m)}normalizeSourceURL(d,m,j,A){if(!i.h(d))return d;const O=se(d);return O.path=`/v4/${O.authority}.json`,O.params.push("secure"),j&&O.params.push(`language=${j}`),A&&O.params.push(`worldview=${A}`),this._makeAPIURL(O,this._customAccessToken||m)}normalizeIconsetURL(d,m){const j=se(d);return i.h(d)?(j.path=`/styles/v1${j.path}/iconset.pbf`,this._makeAPIURL(j,this._customAccessToken||m)):fe(j)}normalizeSpriteURL(d,m,j,A){const O=se(d);return i.h(d)?(O.path=`/styles/v1${O.path}/sprite${m}${j}`,this._makeAPIURL(O,this._customAccessToken||A)):(O.path+=`${m}${j}`,fe(O))}normalizeTileURL(d,m,j){if(this._isSkuTokenExpired()&&this._createSkuToken(),d&&!i.h(d))return d;const A=se(d);A.path=A.path.replace(/(\.(png|jpg)\d*)(?=$)/,`${m||j&&A.authority!=="raster"&&j===512?"@2x":""}${i.k.supported?".webp":"$1"}`),A.authority==="raster"?A.path=`/${i.e.RASTER_URL_PREFIX}${A.path}`:A.authority==="rasterarrays"?A.path=`/${i.e.RASTERARRAYS_URL_PREFIX}${A.path}`:A.authority==="3dtiles"?A.path=`/${i.e.TILES3D_URL_PREFIX}${A.path}`:(A.path=A.path.replace(/^.+\/v4\//,"/"),A.path=`/${i.e.TILE_URL_VERSION}${A.path}`);const O=this._customAccessToken||function(R){for(const B of R){const H=B.match(/^access_token=(.*)$/);if(H)return H[1]}return null}(A.params)||i.e.ACCESS_TOKEN;return i.e.REQUIRE_ACCESS_TOKEN&&O&&this._skuToken&&A.params.push(`sku=${this._skuToken}`),this._makeAPIURL(A,O)}canonicalizeTileURL(d,m){const j=se(d);if(!j.path.match(/^(\/v4\/|\/(raster|rasterarrays)\/v1\/)/)||!j.path.match(/\.[\w]+$/))return d;let A="mapbox://";j.path.match(/^\/raster\/v1\//)?A+=`raster/${j.path.replace(`/${i.e.RASTER_URL_PREFIX}/`,"")}`:j.path.match(/^\/rasterarrays\/v1\//)?A+=`rasterarrays/${j.path.replace(`/${i.e.RASTERARRAYS_URL_PREFIX}/`,"")}`:A+=`tiles/${j.path.replace(`/${i.e.TILE_URL_VERSION}/`,"")}`;let O=j.params;return m&&(O=O.filter(R=>!R.match(/^access_token=/))),O.length&&(A+=`?${O.join("&")}`),A}canonicalizeTileset(d,m){const j=!!m&&i.h(m),A=[];for(const O of d.tiles||[])i.j(O)?A.push(this.canonicalizeTileURL(O,j)):A.push(O);return A}_makeAPIURL(d,m){const j="See https://docs.mapbox.com/api/overview/#access-tokens-and-token-scopes",A=se(i.e.API_URL);if(d.protocol=A.protocol,d.authority=A.authority,d.protocol==="http"){const O=d.params.indexOf("secure");O>=0&&d.params.splice(O,1)}if(A.path!=="/"&&(d.path=`${A.path}${d.path}`),!i.e.REQUIRE_ACCESS_TOKEN)return fe(d);if(m=m||i.e.ACCESS_TOKEN,!this._silenceAuthErrors){if(!m)throw new Error(`An API access token is required to use Mapbox GL. ${j}`);if(m[0]==="s")throw new Error(`Use a public access token (pk.*) with Mapbox GL, not a secret access token (sk.*). ${j}`)}return d.params=d.params.filter(O=>O.indexOf("access_token")===-1),d.params.push(`access_token=${m||""}`),fe(d)}}const pe=/^(\w+):\/\/([^/?]*)(\/[^?]+)?\??(.+)?/;function se(w){const d=w.match(pe);if(!d)throw new Error("Unable to parse URL object");return{protocol:d[1],authority:d[2],path:d[3]||"/",params:d[4]?d[4].split("&"):[]}}function fe(w){const d=w.params.length?`?${w.params.join("&")}`:"";return`${w.protocol}://${w.authority}${w.path}${d}`}const he="mapbox.eventData";function ye(w){if(!w)return null;const d=w.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=ye(i.e.ACCESS_TOKEN);let j="";return j=m&&m.u?i.f(m.u):i.e.ACCESS_TOKEN||"",d?`${he}.${d}:${j}`:`${he}:${j}`}fetchEventData(){const d=i.s("localStorage"),m=this.getStorageKey(),j=this.getStorageKey("uuid"),A=this.getStorageKey("uuidTimestamp");if(d)try{const O=localStorage.getItem(m);O&&(this.eventData=JSON.parse(O));const R=localStorage.getItem(j);R&&(this.anonId=R);const B=localStorage.getItem(A);B&&(this.anonIdTimestamp=Number(B));const H=Date.now()-864e5;(!this.anonIdTimestamp||this.anonIdTimestamp=1&&localStorage.setItem(m,JSON.stringify(this.eventData)),R&&localStorage.setItem(A,R.toString())}catch{i.w("Unable to write to LocalStorage")}}processRequests(d){}postEvent(d,m,j,A){if(!i.e.EVENTS_URL)return;const O=se(i.e.EVENTS_URL);O.params.push(`access_token=${A||i.e.ACCESS_TOKEN||""}`);const R={event:this.type,created:new Date(d).toISOString()},B=m?Object.assign(R,m):R,H={url:fe(O),headers:{"Content-Type":"text/plain"},body:JSON.stringify([B])};this.pendingRequest=i.p(H,Y=>{this.pendingRequest=null,j(Y),this.saveEventData(),this.processRequests(A)})}queueRequest(d,m){this.queue.push(d),this.processRequests(m)}}class we 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:j}=this.queue.shift();this.postEvent(m,j,()=>{},d)}}const be=new class extends Ae{constructor(w){super("appUserTurnstile"),this._customAccessToken=w}postTurnstileEvent(w,d){i.e.EVENTS_URL&&i.e.ACCESS_TOKEN&&Array.isArray(w)&&w.some(m=>i.h(m)||i.j(m))&&this.queueRequest(Date.now(),d)}processRequests(w){if(this.pendingRequest||this.queue.length===0)return;this.anonId&&this.anonIdTimestamp&&this.eventData.lastSuccess&&this.eventData.tokenU||this.fetchEventData();const d=ye(i.e.ACCESS_TOKEN),m=d?d.u:i.e.ACCESS_TOKEN;let j=m!==this.eventData.tokenU;i.v(this.anonId)||(this.refreshUUID(),j=!0);const A=this.queue.shift();if(this.eventData.lastSuccess){const O=new Date(this.eventData.lastSuccess),R=new Date(A),B=(A-this.eventData.lastSuccess)/864e5;j=j||B>=1||B<-1||O.getDate()!==R.getDate()}else j=!0;j?this.postEvent(A,{sdkIdentifier:"mapbox-gl-js",sdkVersion:u,skuId:oe,"enabled.telemetry":!1,userId:this.anonId},O=>{O||(this.eventData.lastSuccess=A,this.eventData.tokenU=m)},w):this.processRequests()}},_e=be.postTurnstileEvent.bind(be),Je=new class extends Ae{constructor(){super("map.load"),this.success={},this.skuToken=""}postMapLoadEvent(w,d,m,j){this.skuToken=d,this.errorCb=j,i.e.EVENTS_URL&&(m||i.e.ACCESS_TOKEN?this.queueRequest({id:w,timestamp:Date.now()},m):this.errorCb(new Error(ge)))}processRequests(w){if(this.pendingRequest||this.queue.length===0)return;const{id:d,timestamp:m}=this.queue.shift();d&&this.success[d]||(this.anonId&&this.anonIdTimestamp||this.fetchEventData(),i.v(this.anonId)||this.refreshUUID(),this.postEvent(m,{sdkIdentifier:"mapbox-gl-js",sdkVersion:u,skuId:oe,skuToken:this.skuToken,userId:this.anonId},j=>{j?this.errorCb(j):d&&(this.success[d]=!0)},w))}remove(){this.errorCb=null}},Te=Je.postMapLoadEvent.bind(Je),De=new class extends Ae{constructor(){super("style.load"),this.eventIdPerMapInstanceMap=new Map,this.mapInstanceIdMap=new WeakMap}getMapInstanceId(w){let d=this.mapInstanceIdMap.get(w);return d||(d=i.u(),this.mapInstanceIdMap.set(w,d)),d}getEventId(w){const d=this.eventIdPerMapInstanceMap.get(w)||0;return this.eventIdPerMapInstanceMap.set(w,d+1),d}postStyleLoadEvent(w,d){const{map:m,style:j,importedStyles:A}=d;if(!i.e.EVENTS_URL||!w&&!i.e.ACCESS_TOKEN)return;const O=this.getMapInstanceId(m),R={mapInstanceId:O,eventId:this.getEventId(O),style:j};A.length&&(R.importedStyles=A),this.queueRequest({timestamp:Date.now(),payload:R},w)}processRequests(w){if(this.pendingRequest||this.queue.length===0)return;const{timestamp:d,payload:m}=this.queue.shift();this.postEvent(d,m,()=>{},w)}},Ue=De.postStyleLoadEvent.bind(De),Be=new we({attributes:[{name:"maps/js/layer-animations/style-with-appearances"}]}),qe=Be.postMetricsEvent.bind(Be),ot=new we({attributes:[{name:"maps/js/layer-animations/runtime-appearances"}]}),Mt=ot.postMetricsEvent.bind(ot),Oe=new class extends Ae{constructor(){super("gljs.performance")}postPerformanceEvent(w,d){i.e.EVENTS_URL&&(w||i.e.ACCESS_TOKEN)&&this.queueRequest({timestamp:Date.now(),performanceData:d},w)}processRequests(w){if(this.pendingRequest||this.queue.length===0)return;const{timestamp:d,performanceData:m}=this.queue.shift(),j=function(A){const O=performance.getEntriesByType("resource"),R=performance.getEntriesByType("mark"),B=function(ue){const je={};if(ue){for(const ve in ue)if(ve!=="other")for(const Re of ue[ve]){const Le=`${ve}ResolveRangeMin`,We=`${ve}ResolveRangeMax`,rt=`${ve}RequestCount`,Ke=`${ve}RequestCachedCount`;je[Le]=Math.min(je[Le]||1/0,Re.startTime),je[We]=Math.max(je[We]||-1/0,Re.responseEnd);const wt=mt=>{je[mt]===void 0&&(je[mt]=0),++je[mt]};Re.transferSize!==void 0&&Re.transferSize===0&&wt(Ke),wt(rt)}}return je}(function(ue,je){const ve={};if(ue)for(const Re of ue){const Le=je(Re);ve[Le]===void 0&&(ve[Le]=[]),ve[Le].push(Re)}return ve}(O,y)),H=window.devicePixelRatio,Y=navigator.connection||navigator.mozConnection||navigator.webkitConnection,te=Y?Y.effectiveType:void 0,de={counters:[],metadata:[],attributes:[]},ce=(ue,je,ve)=>{ve!=null&&ue.push({name:je,value:ve.toString()})};for(const ue in B)ce(de.counters,ue,B[ue]);if(A.interactionRange[0]!==1/0&&A.interactionRange[1]!==-1/0&&(ce(de.counters,"interactionRangeMin",A.interactionRange[0]),ce(de.counters,"interactionRangeMax",A.interactionRange[1])),R)for(const ue of Object.values(p)){const je=R.find(ve=>ve.name===ue);je&&ce(de.counters,ue,je.startTime)}return ce(de.counters,"visibilityHidden",A.visibilityHidden),ce(de.attributes,"style",function(ue){if(ue)for(const je of ue){const ve=je.name.split("?")[0];if(i.i(ve)){const Re=ve.split("/").slice(-2);if(Re.length===2)return`mapbox://styles/${Re[0]}/${Re[1]}`}}}(O)),ce(de.attributes,"terrainEnabled",A.terrainEnabled?"true":"false"),ce(de.attributes,"fogEnabled",A.fogEnabled?"true":"false"),ce(de.attributes,"projection",A.projection),ce(de.attributes,"zoom",A.zoom),ce(de.metadata,"devicePixelRatio",H),ce(de.metadata,"connectionEffectiveType",te),ce(de.metadata,"navigatorUserAgent",navigator.userAgent),ce(de.metadata,"screenWidth",window.screen.width),ce(de.metadata,"screenHeight",window.screen.height),ce(de.metadata,"windowWidth",window.innerWidth),ce(de.metadata,"windowHeight",window.innerHeight),ce(de.metadata,"mapWidth",A.width/H),ce(de.metadata,"mapHeight",A.height/H),ce(de.metadata,"webglRenderer",A.renderer),ce(de.metadata,"webglVendor",A.vendor),ce(de.metadata,"sdkVersion",u),ce(de.metadata,"sdkIdentifier","mapbox-gl-js"),de}(m);for(const A of j.metadata);for(const A of j.counters);for(const A of j.attributes);this.postEvent(d,j,()=>{},w)}},at=Oe.postPerformanceEvent.bind(Oe),le=new class extends Ae{constructor(){super("map.auth"),this.success={},this.skuToken=""}getSession(w,d,m,j){if(!i.e.API_URL||!i.e.SESSION_PATH)return;const A=se(i.e.API_URL+i.e.SESSION_PATH);A.params.push(`sku=${d||""}`),A.params.push(`access_token=${j||i.e.ACCESS_TOKEN||""}`);const O={url:fe(A),headers:{"Content-Type":"text/plain"}};this.pendingRequest=i.g(O,R=>{this.pendingRequest=null,m(R),this.saveEventData(),this.processRequests(j)})}getSessionAPI(w,d,m,j){this.skuToken=d,this.errorCb=j,i.e.SESSION_PATH&&i.e.API_URL&&(m||i.e.ACCESS_TOKEN?this.queueRequest({id:w,timestamp:Date.now()},m):this.errorCb(new Error(ge)))}processRequests(w){if(this.pendingRequest||this.queue.length===0)return;const{id:d,timestamp:m}=this.queue.shift();d&&this.success[d]||this.getSession(m,this.skuToken,j=>{j?this.errorCb(j):d&&(this.success[d]=!0)},w)}remove(){this.errorCb=null}},Ve=le.getSessionAPI.bind(le),Qe=new Set;function st(w,d){d?Qe.add(w):Qe.delete(w)}class ke{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 ct(w){const{userImage:d}=w;return!!(d&&d.render&&d.render())&&(w.data.replace(new Uint8Array(d.data.buffer)),!0)}class Ce extends i.E{constructor(d){super(),this.imageProviders=new Map,this.images=new Map,this.updatedImages=new Map,this.callbackDispatchedThisFrame=new Map,this.loaded=new Map,this.requestors=[],this.patterns=new Map,this.patternsInFlight=new Set,this.atlasImage=new Map,this.atlasTexture=new Map,this.dirty=!0,this.spriteFormat=d,d!=="raster"&&i.r()&&(this.imageRasterizerDispatcher=new i.D(i.t(),this,"Image Rasterizer Worker",1))}addScope(d){this.loaded.set(d,!1),this.imageProviders.set(d,new Map),this.images.set(d,new Map),this.updatedImages.set(d,new Set),this.callbackDispatchedThisFrame.set(d,new Set),this.patterns.set(d,new Map),this.atlasImage.set(d,new i.q({width:1,height:1}))}removeScope(d){this.loaded.delete(d),this.imageProviders.delete(d),this.images.delete(d),this.updatedImages.delete(d),this.callbackDispatchedThisFrame.delete(d),this.patterns.delete(d),this.atlasImage.delete(d);const m=this.atlasTexture.get(d);m&&(m.destroy(),this.atlasTexture.delete(d))}addImageProvider(d,m){this.imageProviders.has(m)||this.imageProviders.set(m,new Map),this.imageProviders.get(m).set(d.id,d)}removeImageProvider(d,m){this.imageProviders.has(m)&&this.imageProviders.get(m).delete(d)}getPendingImageProviders(){const d=[];for(const m of this.imageProviders.values())for(const j of m.values())j.hasPendingRequests()&&d.push(j);return d}get imageRasterizer(){return this._imageRasterizer||(this._imageRasterizer=new i.x),this._imageRasterizer}isLoaded(){for(const d of this.loaded.keys())if(!this.loaded.get(d))return!1;return!0}setLoaded(d,m){if(this.loaded.get(m)!==d&&(this.loaded.set(m,d),d)){for(const{ids:j,callback:A}of this.requestors)this._notify(j,m,A);this.requestors=[]}}hasImage(d,m){return!!this.getImage(d,m)}getImage(d,m){return this.images.get(m).get(d.toString())}addImage(d,m,j){this._validate(d,j)&&this.images.get(m).set(d.toString(),j)}_validate(d,m){let j=!0;return this._validateStretch(m.stretchX,m.data&&m.data.width)||(this.fire(new i.y(new Error(`Image "${d.name}" has invalid "stretchX" value`))),j=!1),this._validateStretch(m.stretchY,m.data&&m.data.height)||(this.fire(new i.y(new Error(`Image "${d.name}" has invalid "stretchY" value`))),j=!1),this._validateContent(m.content,m)||(this.fire(new i.y(new Error(`Image "${d.name}" has invalid "content" value`))),j=!1),j}_validateStretch(d,m){if(!d)return!0;let j=0;for(const A of d){if(A[0]i.I.from(m))}getImages(d,m,j){const A=[],O=[],R=this.imageProviders.get(m);for(const te of d){if(!te.iconsetId){A.push(te);continue}const de=R.get(te.iconsetId);de&&(this.getImage(te,m)?O.push(te):de.addPendingRequest(te))}if(A.length===0)return void this._notify(O,m,j);let B=!0;const H=!!this.loaded.get(m),Y=this.images.get(m);if(!H)for(const te of A)Y.has(te.toString())||(B=!1);H||B?this._notify(A,m,j):this.requestors.push({ids:A,scope:m,callback:j})}rasterizeImages(d,m){const j=new Map,{tasks:A,scope:O}=d;for(const[R,B]of A.entries()){const H=this.getImage(B.id,O);H&&j.set(R,{image:H,imageVariant:B})}this._rasterizeImages(O,j,m)}_rasterizeImages(d,m,j){if(i.r())this.imageRasterizerDispatcher.getActor().send("rasterizeImagesWorker",{tasks:m,scope:d},j);else{const A=new Map;for(const[O,{image:R,imageVariant:B}]of m.entries())A.set(O,this.imageRasterizer.rasterize(B,R,d,0));j(void 0,A)}}getUpdatedImages(d){return this.updatedImages.get(d)||new Set}_notify(d,m,j){const A=this.images.get(m),O=new Map;for(const R of d){if(!A.get(R.toString())){if(R.iconsetId)continue;this.fire(new i.z("styleimagemissing",{id:R.name}))}const B=A.get(R.toString());if(!B){i.w(`Image "${R.name}" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.`);continue}const H={data:B.usvg?null:B.data.clone(),pixelRatio:B.pixelRatio,sdf:B.sdf,usvg:B.usvg,version:B.version,stretchX:B.stretchX,stretchY:B.stretchY,content:B.content,hasRenderCallback:!!(B.userImage&&B.userImage.render)};B.usvg&&Object.assign(H,{width:B.icon.usvg_tree.width,height:B.icon.usvg_tree.height}),O.set(i.I.toString(R),H)}j(null,O)}getPixelSize(d){const{width:m,height:j}=this.atlasImage.get(d);return{width:m,height:j}}getPattern(d,m,j){const A=d.toString(),O=this.patterns.get(m),R=O.get(A),B=this.getImage(d,m);if(!B)return null;if(R){if(R.position.version===B.version)return R.position;R.position.version=B.version}else{if(B.usvg&&!B.data){const H=this.getPatternInFlightId(A,m);if(this.patternsInFlight.has(H))return null;this.patternsInFlight.add(H);const Y=new i.A(d).scaleSelf(i.o.devicePixelRatio),te=new Map([[Y.toString(),{image:B,imageVariant:Y}]]);return this._rasterizeImages(m,te,(de,ce)=>this.storePatternImage(Y,m,B,j,ce)),null}this.storePattern(d,m,B)}return this._updatePatternAtlas(m,j),O.get(A).position}getPatternInFlightId(d,m){return i.B(d,m)}hasPatternsInFlight(){return this.patternsInFlight.size!==0}storePatternImage(d,m,j,A,O){const R=d.toString(),B=O?O.get(R):void 0;B&&(j.data=B,this.storePattern(d.id,m,j),this._updatePatternAtlas(m,A),this.patternsInFlight.delete(this.getPatternInFlightId(d.id.toString(),m)))}storePattern(d,m,j){const A={w:j.data.width+2*i.C,h:j.data.height+2*i.C,x:0,y:0},O=new i.F(A,j,i.C);this.patterns.get(m).set(d.toString(),{bin:A,position:O})}destroyAtlasTextures(){for(const d of this.atlasTexture.values())d&&d.destroy();this.atlasTexture.clear()}bind(d,m){const j=d.gl;let A=this.atlasTexture.get(m);A?this.dirty&&(A.update(this.atlasImage.get(m)),this.dirty=!1):(A=new i.T(d,this.atlasImage.get(m),j.RGBA8),this.atlasTexture.set(m,A)),A.bind(j.LINEAR,j.CLAMP_TO_EDGE)}_updatePatternAtlas(d,m){const j=this.patterns.get(d),A=Array.from(j.values()).map(({bin:Y})=>Y),{w:O,h:R}=i.G(A),B=this.atlasImage.get(d);B.resize({width:O||1,height:R||1});const H=this.images.get(d);for(const[Y,{bin:te,position:de}]of j.entries()){let ce=de.padding;const ue=te.x+ce,je=te.y+ce,ve=H.get(Y).data,Re=ve.width,Le=ve.height;ce=ce>1?ce-1:ce,i.q.copy(ve,B,{x:0,y:0},{x:ue,y:je},{width:Re,height:Le},m),i.q.copy(ve,B,{x:0,y:Le-ce},{x:ue,y:je-ce},{width:Re,height:ce},m),i.q.copy(ve,B,{x:0,y:0},{x:ue,y:je+Le},{width:Re,height:ce},m),i.q.copy(ve,B,{x:Re-ce,y:0},{x:ue-ce,y:je},{width:ce,height:Le},m),i.q.copy(ve,B,{x:0,y:0},{x:ue+Re,y:je},{width:ce,height:Le},m),i.q.copy(ve,B,{x:Re-ce,y:Le-ce},{x:ue-ce,y:je-ce},{width:ce,height:ce},m),i.q.copy(ve,B,{x:0,y:Le-ce},{x:ue+Re,y:je-ce},{width:ce,height:ce},m),i.q.copy(ve,B,{x:0,y:0},{x:ue+Re,y:je+Le},{width:ce,height:ce},m),i.q.copy(ve,B,{x:Re-ce,y:0},{x:ue-ce,y:je+Le},{width:ce,height:ce},m)}this.dirty=!0}beginFrame(){for(const d of this.images.keys())this.callbackDispatchedThisFrame.set(d,new Set)}dispatchRenderCallbacks(d,m){const j=this.images.get(m);for(const A of d){if(this.callbackDispatchedThisFrame.get(m).has(A.toString()))continue;this.callbackDispatchedThisFrame.get(m).add(A.toString());const O=j.get(A.toString());ct(O)&&this.updateImage(A,m,O)}}destroy(){this.imageRasterizerDispatcher&&this.imageRasterizerDispatcher.remove()}}function Me(w){const d=w.value,m=w.valueSpec,j=w.style,A=w.styleSpec,O=w.key,R=w.arrayElementValidator||cs;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.lengthA)return[new i.V(d,m,`${m} is greater than the maximum value ${A}`)]}return[]}function Ee(w){const d=w.key,m=w.value;if(!i.H(m))return[new i.V(d,m,`object expected, ${i.K(m)} found`)];const j=w.valueSpec,A=i.J(m.type);let O,R,B,H={};const Y=A!=="categorical"&&m.property===void 0,te=!Y,de=function(ve){const Re=ve.stops;return Array.isArray(Re)&&Array.isArray(Re[0])&&i.H(Re[0][0])}(m),ce=ta({key:w.key,value:w.value,valueSpec:w.styleSpec.function,style:w.style,styleSpec:w.styleSpec,objectElementValidators:{stops:function(ve){if(A==="identity")return[new i.V(ve.key,ve.value,'identity function may not have a "stops" property')];let Re=[];const Le=ve.value;return Re=Re.concat(Me({key:ve.key,value:Le,valueSpec:ve.valueSpec,style:ve.style,styleSpec:ve.styleSpec,arrayElementValidator:ue})),Array.isArray(Le)&&Le.length===0&&Re.push(new i.V(ve.key,Le,"array must have at least one stop")),Re},default:function(ve){return cs({key:ve.key,value:ve.value,valueSpec:j,style:ve.style,styleSpec:ve.styleSpec})}}});return A==="identity"&&Y&&ce.push(new i.V(w.key,w.value,'missing required property "property"')),A==="identity"||m.stops||ce.push(new i.V(w.key,w.value,'missing required property "stops"')),A==="exponential"&&j.expression&&!i.M(j)&&ce.push(new i.V(w.key,w.value,"exponential functions not supported")),w.styleSpec.$version>=8&&(te&&!i.N(j)?ce.push(new i.V(w.key,w.value,"property functions not supported")):Y&&!i.O(j)&&ce.push(new i.V(w.key,w.value,"zoom functions not supported"))),A!=="categorical"&&!de||m.property!==void 0||ce.push(new i.V(w.key,w.value,'"property" property is required')),ce;function ue(ve){let Re=[];const Le=ve.value,We=ve.key;if(!Array.isArray(Le))return[new i.V(We,Le,`array expected, ${i.K(Le)} found`)];if(Le.length!==2)return[new i.V(We,Le,`array length 2 expected, length ${Le.length} found`)];if(de){if(!i.H(Le[0]))return[new i.V(We,Le,`object expected, ${i.K(Le[0])} found`)];const rt=Le[0];if(rt.zoom===void 0)return[new i.V(We,Le,"object stop key must have zoom")];if(rt.value===void 0)return[new i.V(We,Le,"object stop key must have value")];const Ke=i.J(rt.zoom);if(typeof Ke!="number")return[new i.V(We,rt.zoom,"stop zoom values must be numbers")];if(B&&B>Ke)return[new i.V(We,rt.zoom,"stop zoom values must appear in ascending order")];Ke!==B&&(B=Ke,R=void 0,H={}),Re=Re.concat(ta({key:`${We}[0]`,value:Le[0],valueSpec:{zoom:{}},style:ve.style,styleSpec:ve.styleSpec,objectElementValidators:{zoom:Ge,value:je}}))}else Re=Re.concat(je({key:`${We}[0]`,value:Le[0],style:ve.style,styleSpec:ve.styleSpec},Le));return i.Q(i.S(Le[1]))?Re.concat([new i.V(`${We}[1]`,Le[1],"expressions are not allowed in function stops.")]):Re.concat(cs({key:`${We}[1]`,value:Le[1],valueSpec:j,style:ve.style,styleSpec:ve.styleSpec}))}function je(ve,Re){const Le=i.K(ve.value),We=i.J(ve.value),rt=ve.value!==null?ve.value:Re;if(O){if(Le!==O)return[new i.V(ve.key,rt,`${Le} stop domain type must match previous stop domain type ${O}`)]}else O=Le;if(Le!=="number"&&Le!=="string"&&Le!=="boolean"&&typeof We!="number"&&typeof We!="string"&&typeof We!="boolean")return[new i.V(ve.key,rt,"stop domain value must be a number, string, or boolean")];if(Le!=="number"&&A!=="categorical"){let Ke=`number expected, ${Le} found`;return i.N(j)&&A===void 0&&(Ke+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new i.V(ve.key,rt,Ke)]}return A!=="categorical"||Le!=="number"||typeof We=="number"&&isFinite(We)&&Math.floor(We)===We?A!=="categorical"&&Le==="number"&&typeof We=="number"&&typeof R=="number"&&R!==void 0&&Wenew i.V(`${w.key}${j.key}`,w.value,j.message));const m=d.value.expression||d.value._styleExpression.expression;if(w.expressionContext==="property"&&w.propertyKey==="text-font"&&!m.outputDefined())return[new i.V(w.key,w.value,`Invalid data expression for "${w.propertyKey}". Output values must be contained as literals within the expression.`)];if(w.expressionContext==="property"&&w.propertyType==="layout"&&!i.Z(m))return[new i.V(w.key,w.value,'"feature-state" data expressions are not supported with layout properties.')];if(w.expressionContext==="filter")return nt(m,w);if(w.expressionContext==="appearance")return yt(m,w);if(w.expressionContext&&w.expressionContext.indexOf("cluster")===0){if(!i.X(m,["zoom","feature-state"]))return[new i.V(w.key,w.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(w.expressionContext==="cluster-initial"&&!i.Y(m))return[new i.V(w.key,w.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function nt(w,d){const m=new Set(["zoom","feature-state","pitch","distance-from-center"]);if(d.valueSpec&&d.valueSpec.expression)for(const A of d.valueSpec.expression.parameters)m.delete(A);if(m.size===0)return[];const j=[];return w instanceof i._&&m.has(w.name)?[new i.V(d.key,d.value,`["${w.name}"] expression is not supported in a filter for a ${d.object.type} layer with id: ${d.object.id}`)]:(w.eachChild(A=>{j.push(...nt(A,d))}),j)}function yt(w,d){const m=new Set;if(d.valueSpec&&d.valueSpec.expression)for(const A of d.valueSpec.expression.parameters)m.add(A);if(m.size===0)return[];const j=[];return w instanceof i._&&!m.has(w.name)?[new i.V(d.key,d.value,`["${w.name}"] is not an allowed parameter`)]:(w.eachChild(A=>{j.push(...yt(A,d))}),j)}function it(w){const d=w.key,m=w.value,j=w.valueSpec,A=[];return Array.isArray(j.values)?j.values.indexOf(i.J(m))===-1&&A.push(new i.V(d,m,`expected one of [${j.values.join(", ")}], ${JSON.stringify(m)} found`)):Object.keys(j.values).indexOf(i.J(m))===-1&&A.push(new i.V(d,m,`expected one of [${Object.keys(j.values).join(", ")}], ${JSON.stringify(m)} found`)),A}function zt(w){return i.a2(i.S(w.value))?He(Object.assign({},w,{expressionContext:"filter",valueSpec:w.styleSpec[`filter_${w.layerType||"fill"}`]})):dr(w)}function dr(w){const d=w.value,m=w.key;if(!Array.isArray(d))return[new i.V(m,d,`array expected, ${i.K(d)} found`)];if(d.length<1)return[new i.V(m,d,"filter array must have at least 1 element")];const j=w.styleSpec;let A=it({key:`${m}[0]`,value:d[0],valueSpec:j.filter_operator});const O=()=>{d.length>=2&&(i.a0(d[1])||A.push(new i.V(`${m}[1]`,d[1],`string expected, ${i.K(d[1])} found`)));for(let R=2;R":case">=":d.length>=2&&i.J(d[1])==="$type"&&A.push(new i.V(m,d,`"$type" cannot be use with operator "${d[0]}"`)),d.length!==3&&A.push(new i.V(m,d,`filter array for operator "${d[0]}" must have 3 elements`)),O();break;case"==":case"!=":d.length!==3&&A.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 R=1;R{Y in m&&d.push(new i.V(j,m[Y],`"${Y}" is prohibited for ref layers`))}),A.layers.forEach(Y=>{i.J(Y.id)===B&&(H=Y)}),H?H.ref?d.push(new i.V(j,m.ref,"ref cannot reference another ref layer")):R=i.J(H.type):typeof B=="string"&&d.push(new i.V(j,m.ref,`ref layer "${B}" not found`))}else if(R!=="background"&&R!=="sky"&&R!=="slot")if(m.source)if(i.a0(m.source)){const H=A.sources&&A.sources[m.source],Y=H&&i.J(H.type);H?Y==="vector"&&R==="raster"?d.push(new i.V(j,m.source,`layer "${m.id}" requires a raster source`)):Y==="raster"&&R!=="raster"?d.push(new i.V(j,m.source,`layer "${m.id}" requires a vector source`)):Y!=="vector"||m["source-layer"]?Y==="raster-dem"&&R!=="hillshade"?d.push(new i.V(j,m.source,"raster-dem source can only be used with layer type 'hillshade'.")):Y!=="raster-array"||["raster","raster-particle"].includes(R)?R==="line"&&m.paint&&(m.paint["line-gradient"]||m.paint["line-trim-offset"])&&Y==="geojson"&&!H.lineMetrics?d.push(new i.V(j,m,`layer "${m.id}" specifies a line-gradient, which requires the GeoJSON source to have \`lineMetrics\` enabled.`)):R==="raster-particle"&&Y!=="raster-array"&&d.push(new i.V(j,m.source,`layer "${m.id}" requires a 'raster-array' source.`)):d.push(new i.V(j,m.source,"raster-array source can only be used with layer type 'raster'.")):d.push(new i.V(j,m,`layer "${m.id}" must specify a "source-layer"`)):d.push(new i.V(j,m.source,`source "${m.source}" not found`))}else d.push(new i.V(`${j}.source`,m.source,'"source" must be a string'));else d.push(new i.V(j,m,'missing required property "source"'));return d=d.concat(ta({key:j,value:m,valueSpec:O.layer,style:w.style,styleSpec:w.styleSpec,objectElementValidators:{"*":()=>[],type:()=>cs({key:`${j}.type`,value:m.type,valueSpec:O.layer.type,style:w.style,styleSpec:w.styleSpec,object:m,objectKey:"type"}),filter:H=>zt(Object.assign({layerType:R},H)),layout:H=>ta({layer:m,key:H.key,value:H.value,valueSpec:{},style:H.style,styleSpec:H.styleSpec,objectElementValidators:{"*":Y=>Ur(Object.assign({layerType:R},Y))}}),paint:H=>ta({layer:m,key:H.key,value:H.value,valueSpec:{},style:H.style,styleSpec:H.styleSpec,objectElementValidators:{"*":Y=>Gr(Object.assign({layerType:R,layer:m},Y))}}),appearances(H){const Y=Me({key:H.key,value:H.value,valueSpec:H.valueSpec,style:H.style,styleSpec:H.styleSpec,arrayElementValidator:ce=>function(ue){const{key:je,layer:ve,layerType:Re}=ue,Le=i.J(ue.value),We=i.J(Le.name),rt=i.J(Le.condition),Ke=ta({key:je,value:Le,valueSpec:ue.styleSpec.appearance,style:ue.style,styleSpec:ue.styleSpec,objectElementValidators:{condition:wt=>function(mt){const vt=[];return vt.push(...He({key:mt.key,value:mt.object.condition,valueSpec:i.a6.appearance.condition,expressionContext:"appearance"})),vt}(Object.assign({layer:ve,layerType:Re},wt)),properties:wt=>function(mt){const vt=[],{styleSpec:pt,layer:ut,layerType:St}=mt,Dt=pt[`paint_${St}`],Ot=pt[`layout_${St}`],Gt=mt.object[mt.objectKey];for(const Zt in Gt){const ar=Zt in Dt?"paint":Zt in Ot?"layout":void 0;if(!ar){vt.push(new i.V(mt.key,Zt,`unknown property "${Zt}" for layer type "${St}"`));continue}const br=Object.assign({},mt,{key:`${mt.key}.${Zt}`,object:Gt,objectKey:Zt,layer:ut,layerType:St,value:Gt[Zt],valueSpec:ar==="paint"?Dt[Zt]:Ot[Zt]});vt.push(...Rr(br,ar))}return vt}(Object.assign({layer:ve,layerType:Re},wt))}});return We!=="hidden"&&rt===void 0&&Ke.push(new i.V(ue.key,"name",'Appearance with name different than "hidden" must have a condition')),Ke}(Object.assign({layerType:R,layer:m},ce))}),te=Array.isArray(H.value)?H.value:[],de=new Set;return te.forEach((ce,ue)=>{const je=i.J(ce.name);if(je)if(de.has(je)){const ve=i.J(m.id);Y.push(new i.V(H.key,je,`Duplicated appearance name "${je}" for layer "${ve}"`))}else de.add(je)}),Y}}})),d}function _s({key:w,value:d}){return i.a0(d)?[]:[new i.V(w,d,`string expected, ${i.K(d)} found`)]}const ur={promoteId:function w({key:d,value:m}){if(i.a0(m))return _s({key:d,value:m});if(Array.isArray(m)){const A=[],O=i.S(m),R=i.U(O);return R.result==="error"&&R.value.forEach(B=>{A.push(new i.V(`${d}${B.key}`,null,`${B.message}`))}),i.X(R.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"])||A.push(new i.V(`${d}`,null,"promoteId expression should be only feature dependent")),A}if(!i.H(m))return[new i.V(d,m,`string, expression or object expected, "${i.K(m)}" found`)];const j=[];for(const A in m)j.push(...w({key:`${d}.${A}`,value:m[A]}));return j}};function Rn(w){const d=w.value,m=w.key,j=w.styleSpec,A=w.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 R=[];switch(["vector","raster","raster-dem","raster-array"].includes(O)&&("url"in d||"tiles"in d||R.push(new i.a3(m,d,'Either "url" or "tiles" is required.'))),O){case"vector":case"raster":case"raster-dem":case"raster-array":return R=R.concat(ta({key:m,value:d,valueSpec:j[`source_${O.replace("-","_")}`],style:w.style,styleSpec:j,objectElementValidators:ur})),R;case"geojson":if(R=ta({key:m,value:d,valueSpec:j.source_geojson,style:A,styleSpec:j,objectElementValidators:ur}),"cluster"in d&&"clusterProperties"in d){if(!i.H(d.clusterProperties))return[new i.V(`${m}.clusterProperties`,d,`object expected, ${i.K(d)} found`)];for(const B in d.clusterProperties){const H=d.clusterProperties[B];if(!Array.isArray(H))return[new i.V(`${m}.clusterProperties.${B}`,H,"array expected")];const[Y,te]=H,de=typeof Y=="string"?[Y,["accumulated"],["get",B]]:Y;R.push(...He({key:`${m}.${B}.map`,value:te,expressionContext:"cluster-map"})),R.push(...He({key:`${m}.${B}.reduce`,value:de,expressionContext:"cluster-reduce"}))}}return R;case"video":return ta({key:m,value:d,valueSpec:j.source_video,style:A,styleSpec:j});case"image":return ta({key:m,value:d,valueSpec:j.source_image,style:A,styleSpec:j});case"canvas":return[new i.V(m,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return it({key:`${m}.type`,value:d.type,valueSpec:{values:ea(j)}})}}function ea(w){return w.source.reduce((d,m)=>{const j=w[m];return j.type.type==="enum"&&(d=d.concat(Object.keys(j.type.values||{}))),d},[])}function ca(w){const d=w.value,m=w.styleSpec,j=m.light,A=w.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 R in d){const B=R.match(/^(.*)-transition$/),H=R.match(/^(.*)-use-theme$/);O=O.concat(H&&j[H[1]]?cs({key:R,value:d[R],valueSpec:{type:"string"},style:A,styleSpec:m}):B&&j[B[1]]&&j[B[1]].transition?cs({key:R,value:d[R],valueSpec:m.transition,style:A,styleSpec:m}):j[R]?cs({key:R,value:d[R],valueSpec:j[R],style:A,styleSpec:m}):[new i.V(R,d[R],`unknown property "${R}"`)])}return O}function Ei(w){const d=w.value;if(!d)return[];const m=w.key;if(!i.H(d))return[new i.V(m,d,`object expected, ${i.K(d)} found`)];let j=[];const A=w.styleSpec,O=A["light-3d"],R=w.style,B=w.style.lights;for(const te of["type","id"])if(!(te in d))return j=j.concat([new i.V(m,d,`missing property "${te}"`)]),j;if(!i.a0(d.type))return j=j.concat([new i.V(`${m}.type`,d.type,"string expected")]),j;if(B)for(let te=0;te[],array:Me,boolean:function(w){const d=w.value,m=w.key;return i.$(d)?[]:[new i.V(m,d,`boolean expected, ${i.K(d)} found`)]},number:Ge,color:function({key:w,value:d}){return i.a0(d)?i.a1.parseCSSColor(d)===null?[new i.V(w,d,`color expected, "${d}" found`)]:[]:[new i.V(w,d,`color expected, ${i.K(d)} found`)]},enum:it,filter:zt,function:Ee,layer:kn,object:ta,source:Rn,model:i.a7,light:ca,"light-3d":Ei,terrain:Ii,fog:$o,string:_s,formatted:function(w){return _s(w).length===0?[]:He(w)},resolvedImage:function(w){return _s(w).length===0?[]:He(w)},projection:function(w){const d=w.value,m=w.styleSpec,j=m.projection,A=w.style;if(i.H(d)){let O=[];for(const R in d)O=O.concat(cs({key:R,value:d[R],valueSpec:j[R],style:A,styleSpec:m}));return O}return i.a0(d)?[]:[new i.V("projection",d,`object or string expected, ${i.K(d)} found`)]},import:function(w){const d=w.key,{value:m,styleSpec:j}=w;if(!i.H(m))return[new i.V(d,m,"import must be an object")];const{data:A,...O}=m;Object.defineProperty(O,"__line__",{value:m.__line__,enumerable:!1});let R=ta(Object.assign({},w,{value:O,valueSpec:j.import}));return i.J(O.id)===""&&R.push(new i.V(`${w.key}.id`,O,"import id can't be an empty string")),A&&(R=R.concat(Hs(A,j,{key:`${w.key}.data`}))),R},iconset:function(w){const d=w.value,m=w.key,j=w.styleSpec,A=w.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 R=[];if(R=R.concat(ta({key:m,value:d,valueSpec:j[`iconset_${O}`],style:A,styleSpec:j})),function(B,H){return!(B!=="source"||!H.source)}(O,d)){const B=A.sources&&A.sources[d.source],H=B&&i.J(B.type);B?H!=="raster-array"&&R.push(new i.V(m,d.source,`iconset cannot be used with a source of type ${String(H)}, it only be used with a "raster-array" source type`)):R.push(new i.V(m,d.source,`source "${d.source}" not found`))}return R}};function cs(w,d=!1){const m=w.value,j=w.valueSpec,A=w.styleSpec;if(j.expression){if(i.a4(i.J(m)))return Ee(w);if(i.Q(i.S(m)))return He(w)}if(j.type&&Va[j.type]){const O=Va[j.type](w);return d===!0&&O.length>0&&Array.isArray(w.value)?He(w):O}return ta(Object.assign({},w,{valueSpec:j.type?A[j.type]:j}))}function ta(w){const d=w.key,m=w.value,j=w.valueSpec||{},A=w.objectElementValidators||{},O=w.style,R=w.styleSpec;if(!i.H(m))return[new i.V(d,m,`object expected, ${i.K(m)} found`)];let B=[];for(const H in m){const Y=H.split(".")[0];let te;A[Y]?te=A[Y]:j[Y]?te=cs:A["*"]?te=A["*"]:j["*"]&&(te=cs),te?B=B.concat(te({key:(d&&`${d}.`)+H,value:m[H],valueSpec:j[Y]||j["*"],style:O,styleSpec:R,object:m,objectKey:H},m)):B.push(new i.a3(d,m[H],`unknown property "${H}"`))}for(const H in j){if(A[H])continue;const Y=j[H];Y.required&&Y.default===void 0&&m[H]===void 0&&B.push(new i.V(d,m,`missing required property "${H}"`))}return B}function ds({key:w,value:d}){const m=_s({key:w,value:d});if(m.length)return m;const j=d;return j.indexOf("{fontstack}")===-1&&m.push(new i.V(w,d,'"glyphs" url must include a "{fontstack}" token')),j.indexOf("{range}")===-1&&m.push(new i.V(w,d,'"glyphs" url must include a "{range}" token')),m}function Hs(w,d=i.a6,m={}){return ta({key:m.key||"",value:w,valueSpec:Object.assign(d.$root,{"*":{type:"*"}}),styleSpec:d,style:w,objectElementValidators:{glyphs:ds}})}function Os(w,d=i.a6){return Pe(Hs(w,d))}const bi=w=>Pe(Rn(w)),sr=w=>Pe(ca(w)),Ia=w=>Pe(Ei(w)),no=w=>Pe(Ii(w)),yi=w=>Pe($o(w)),qn=w=>Pe(function(d){const m=d.value,j=d.style,A=d.styleSpec,O=A.snow;if(m===void 0)return[];if(!i.H(m))return[new i.V("snow",m,`object expected, ${i.K(m)} found`)];let R=[];for(const B in m){const H=B.match(/^(.*)-transition$/);R=R.concat(H&&O[H[1]]&&O[H[1]].transition?cs({key:B,value:m[B],valueSpec:A.transition,style:j,styleSpec:A}):O[B]?cs({key:B,value:m[B],valueSpec:O[B],style:j,styleSpec:A}):[new i.a3(B,m[B],`unknown property "${B}"`)])}return R}(w)),Gi=w=>Pe(function(d){const m=d.value,j=d.style,A=d.styleSpec,O=A.rain;if(m===void 0)return[];if(!i.H(m))return[new i.V("rain",m,`object expected, ${i.K(m)} found`)];let R=[];for(const B in m){const H=B.match(/^(.*)-transition$/);R=R.concat(H&&O[H[1]]&&O[H[1]].transition?cs({key:B,value:m[B],valueSpec:A.transition,style:j,styleSpec:A}):O[B]?cs({key:B,value:m[B],valueSpec:O[B],style:j,styleSpec:A}):[new i.a3(B,m[B],`unknown property "${B}"`)])}return R}(w)),dc=w=>Pe(kn(w)),go=w=>Pe(zt(w)),uc=w=>Pe(Gr(w)),tt=w=>Pe(Ur(w)),xe=w=>Pe(i.a7(w));function Pe(w){return w.slice().sort((d,m)=>d.line&&m.line?d.line-m.line:0)}function Ye(w,d){let m=!1;if(d&&d.length)for(const j of d)j instanceof i.a3?i.w(j.message):(w.fire(new i.y(new Error(j.message))),m=!0);return m}const Nt=i.a6.light;let _t;class At extends i.E{constructor(d,m="flat"){super(),this._transitionable=new i.a8(_t||(_t=new i.a9({anchor:new i.aa(Nt.anchor),position:new i.ab(Nt.position),color:new i.aa(Nt.color),intensity:new i.aa(Nt.intensity)}))),this.setLight(d,m),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(d,m,j={}){this._validate(sr,d,j)||(this._transitionable.setTransitionOrValue(d),this.id=m)}updateTransitions(d){this._transitioning=this._transitionable.transitioned(d,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(d){this.properties=this._transitioning.possiblyEvaluate(d)}_validate(d,m,j){return(!j||j.validate!==!1)&&Ye(this,d.call(Os,Object.assign({value:m,style:{glyphs:!0,sprite:!0},styleSpec:i.a6})))}}const $t=i.a6.terrain;let Lt=class extends i.E{constructor(w,d,m,j,A){super(),this.scope=m,this._transitionable=new i.a8(new i.a9({source:new i.aa($t.source),exaggeration:new i.aa($t.exaggeration)}),m,j),this._transitionable.setTransitionOrValue(w,j),this._transitioning=this._transitionable.untransitioned(),this.drapeRenderMode=d,this.worldview=A}get(){return this._transitionable.serialize()}set(w,d){this._transitionable.setTransitionOrValue(w,d)}updateTransitions(w){this._transitioning=this._transitionable.transitioned(w,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(w){this.properties=this._transitioning.possiblyEvaluate(w)}getExaggeration(w){return this._transitioning.possiblyEvaluate(new i.ac(w,{worldview:this.worldview})).get("exaggeration")}getAttenuationRange(){if(!this.isZoomDependent())return null;const w=this._transitionable._values.exaggeration;if(!w)return null;const d=w.value.expression;if(!d)return null;let m=-1,j=-1,A=1;for(const O of d.zoomStops)A=d.evaluate(new i.ac(O,{worldview:this.worldview})),A>.01?(m=O,j=-1):j=O;return A<.01&&m>0&&j>m?[m,j]:null}isZoomDependent(){const w=this._transitionable._values.exaggeration;return w!=null&&w.value!=null&&w.value.expression!=null&&w.value.expression instanceof i.ad}};const Vt=45,pr=65,or=.05;function Yr(w,d,m,j){const A=i.ah(Vt,pr,m),[O,R]=jn(w,j);let B=1-Math.min(1,Math.exp((d-O)/(R-O)*-6));return B*=B*B,B=Math.min(1,1.00747*B),B*A*w.alpha}function jn(w,d){const m=.5/Math.tan(.5*d);return[w.range[0]+m,w.range[1]+m]}function Wr(w,d,m,j,A){const O=i.af([],[d,m,j],A.mercatorFogMatrix);return Yr(w,i.ag(O),A.pitch,A._fov)}function as(w,d,m,j,A,O,R){const B=[[m,j,0],[A,j,0],[A,O,0],[m,O,0]];let H=Number.MAX_VALUE,Y=-Number.MAX_VALUE;for(const te of B){const de=i.af([],te,d),ce=i.ag(de);H=Math.min(H,ce),Y=Math.max(Y,ce)}return[Yr(w,H,R.pitch,R._fov),Yr(w,Y,R.pitch,R._fov)]}const is=i.a6.fog;class es extends i.E{constructor(d,m,j,A){super();const O=new i.a9({range:new i.aa(is.range),color:new i.aa(is.color),"color-use-theme":new i.aa({type:"string","property-type":"data-constant",default:"default"}),"high-color":new i.aa(is["high-color"]),"high-color-use-theme":new i.aa({type:"string","property-type":"data-constant",default:"default"}),"space-color":new i.aa(is["space-color"]),"space-color-use-theme":new i.aa({type:"string","property-type":"data-constant",default:"default"}),"horizon-blend":new i.aa(is["horizon-blend"]),"star-intensity":new i.aa(is["star-intensity"]),"vertical-range":new i.aa(is["vertical-range"])});this._transitionable=new i.a8(O,j,new Map(A)),this.set(d,A),this._transitioning=this._transitionable.untransitioned(),this._transform=m,this.properties=new i.ai(O),this.scope=j}get state(){const d=this._transform,m=d.projection.name==="globe",j=i.aj(d.zoom),A=this.properties.get("range"),O=[.5,3];return{range:m?[i.ak(O[0],A[0],j),i.ak(O[1],A[1],j)]:A,horizonBlend:this.properties.get("horizon-blend"),alpha:this.properties.get("color").a}}get(){return this._transitionable.serialize()}set(d,m,j={}){if(this._validate(yi,d,j))return;const A=Object.assign({},d);for(const O of Object.keys(is))A[O]===void 0&&(A[O]=is[O].default);this._options=A,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(Vt,pr,d))*m.a}getOpacityAtLatLng(d,m){return this._transform.projection.supportsFog?function(j,A,O){const R=i.ae.fromLngLat(A),B=O.elevation?O.elevation.getAtPointOrZero(R):0;return Wr(j,R.x,R.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 as(this.state,m,0,0,i.al,i.al,this._transform)}getOpacityForBounds(d,m,j,A,O){return this._transform.projection.supportsFog?as(this.state,d,m,j,A,O,this._transform):[1,1]}getFovAdjustedRange(d){return this._transform.projection.supportsFog?jn(this.state,d):[0,1]}isVisibleOnFrustum(d){if(!this._transform.projection.supportsFog)return!1;const m=[4,5,6,7];for(const j of m){const A=d.points[j];let O;if(A[2]>=0)O=A;else{const R=d.points[j-4];O=i.am(R,A,R[2]/(R[2]-A[2]))}if(Wr(this.state,O[0],O[1],0,this._transform)>=or)return!0}return!1}updateConfig(d){this._transitionable.setTransitionOrValue(this._options,new Map(d))}updateTransitions(d){this._transitioning=this._transitionable.transitioned(d,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(d){this.properties=this._transitioning.possiblyEvaluate(d)}_validate(d,m,j){return(!j||j.validate!==!1)&&Ye(this,d.call(Os,Object.assign({value:m,style:{glyphs:!0,sprite:!0},styleSpec:i.a6})))}}let $s,$i,wo,va,No=class extends i.E{constructor(w,d,m,j){super();const A=$s||($s=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(A,m,new Map(j)),this.set(w,j),this._transitioning=this._transitionable.untransitioned(),this.properties=new i.ai(A),this.scope=m}get state(){const w=this.properties.get("opacity"),d=this.properties.get("color"),m=this.properties.get("direction"),j=i.an(m[0]),A=-Math.max(i.an(m[1]),.01),O=[Math.cos(j)*Math.cos(A),Math.sin(j)*Math.cos(A),Math.sin(A)],R=this.properties.get("vignette"),B=this.properties.get("vignette-color");return B.a=R,{density:this.properties.get("density"),intensity:this.properties.get("intensity"),color:new i.ao(d.r,d.g,d.b,d.a*w),direction:O,centerThinning:this.properties.get("center-thinning"),flakeSize:this.properties.get("flake-size"),vignetteColor:B}}get(){return this._transitionable.serialize()}set(w,d,m={}){if(this._validate(qn,w,m))return;const j=Object.assign({},w),A=i.a6.snow;for(const O of Object.keys(A))j[O]===void 0&&(j[O]=A[O].default);this._options=j,this._transitionable.setTransitionOrValue(this._options,d)}updateConfig(w){this._transitionable.setTransitionOrValue(this._options,new Map(w))}updateTransitions(w){this._transitioning=this._transitionable.transitioned(w,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(w){this.properties=this._transitioning.possiblyEvaluate(w)}_validate(w,d,m){return(!m||m.validate!==!1)&&Ye(this,w.call(Os,Object.assign({value:d,style:{glyphs:!0,sprite:!0},styleSpec:i.a6})))}},Pi=class extends i.E{constructor(w,d,m,j){super();const A=$i||($i=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(A,m,new Map(j)),this.set(w,j),this._transitioning=this._transitionable.untransitioned(),this.properties=new i.ai(A),this.scope=m}get state(){const w=this.properties.get("opacity"),d=this.properties.get("color"),m=this.properties.get("direction"),j=i.an(m[0]),A=-Math.max(i.an(m[1]),.01),O=[Math.cos(j)*Math.cos(A),Math.sin(j)*Math.cos(A),Math.sin(A)],R=this.properties.get("vignette-color");return R.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*w),direction:O,centerThinning:this.properties.get("center-thinning"),dropletSize:this.properties.get("droplet-size"),distortionStrength:this.properties.get("distortion-strength"),vignetteColor:R}}get(){return this._transitionable.serialize()}set(w,d,m={}){if(this._validate(Gi,w,m))return;const j=Object.assign({},w),A=i.a6.rain;for(const O of Object.keys(A))j[O]===void 0&&(j[O]=A[O].default);this._options=j,this._transitionable.setTransitionOrValue(this._options,d)}updateConfig(w){this._transitionable.setTransitionOrValue(this._options,new Map(w))}updateTransitions(w){this._transitioning=this._transitionable.transitioned(w,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(w){this.properties=this._transitioning.possiblyEvaluate(w)}_validate(w,d,m){return(!m||m.validate!==!1)&&Ye(this,w.call(Os,Object.assign({value:d,style:{glyphs:!0,sprite:!0},styleSpec:i.a6})))}};class ra extends i.E{constructor(d,m,j,A){super(),this.scope=j,this._options=d,this.properties=new i.ai(m),this._transitionable=new i.a8(m,j,new Map(A)),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 Li{constructor(d,m,j){this.screenBounds=d,this.cameraPoint=j.getCameraPoint(),this._screenRaycastCache={},this._cameraRaycastCache={},this.isAboveHorizon=m,this.screenGeometry=this.bufferedScreenGeometry(0),this.screenGeometryMercator=this._bufferedScreenMercator(0,j)}static createFromScreenPoints(d,m){let j,A;if(d instanceof i.P||typeof d[0]=="number"){const O=i.P.convert(d);j=[O],A=m.isPointAboveHorizon(O)}else{const O=i.P.convert(d[0]),R=i.P.convert(d[1]),B=O.add(R)._div(2);j=[O,R],A=i.aq(O,R).every(H=>m.isPointAboveHorizon(H))&&m.isPointAboveHorizon(B)}return new Li(j,A,m)}isPointQuery(){return this.screenBounds.length===1}bufferedScreenGeometry(d){return i.aq(this.screenBounds[0],this.screenBounds.length===1?this.screenBounds[0]:this.screenBounds[1],d)}bufferedCameraGeometry(d){const m=this.screenBounds[0],j=this.screenBounds.length===1?this.screenBounds[0].add(new i.P(1,1)):this.screenBounds[1],A=i.aq(m,j,0,!1);return this.cameraPoint.y>j.y&&(this.cameraPoint.x>m.x&&this.cameraPoint.x=j.x?A[2]=this.cameraPoint:this.cameraPoint.x<=m.x&&(A[3]=this.cameraPoint)),i.ar(A,d)}bufferedCameraGeometryGlobe(d){const m=this.screenBounds[0],j=this.screenBounds.length===1?this.screenBounds[0].add(new i.P(1,1)):this.screenBounds[1],A=i.aq(m,j,d),O=this.cameraPoint.clone();switch(3*((O.y>m.y)+(O.y>j.y))+((O.x>m.x)+(O.x>j.x))){case 0:A[0]=O,A[4]=O.clone();break;case 1:A.splice(1,0,O);break;case 2:A[1]=O;break;case 3:A.splice(4,0,O);break;case 5:A.splice(2,0,O);break;case 6:A[3]=O;break;case 7:A.splice(3,0,O);break;case 8:A[2]=O}return A}containsTile(d,m,j,A=0){const O=Math.max(d.queryPadding,d.evaluateQueryRenderedFeaturePadding())/m._pixelsPerMercatorPixel+1,R=j?this._bufferedCameraMercator(O,m):this._bufferedScreenMercator(O,m);let B=d.tileID.wrap+(R.unwrapped?A:0);const H=R.polygon.map(Re=>i.as(d.tileTransform,Re,B));if(!i.at(H,0,0,i.al,i.al))return;B=d.tileID.wrap+(this.screenGeometryMercator.unwrapped?A:0);const Y=this.screenGeometryMercator.polygon.map(Re=>i.au(d.tileTransform,Re,B)),te=Y.map(Re=>new i.P(Re[0],Re[1])),de=m.getFreeCameraOptions().position||new i.ae(0,0,0),ce=i.au(d.tileTransform,de,B),ue=Y.map(Re=>{const Le=i.av(Re,Re,ce);return i.aw(Le,Le),new i.ax(ce,Le)}),je=i.ay(d,1,m.zoom)*m._pixelsPerMercatorPixel;return{queryGeometry:this,tilespaceGeometry:te,tilespaceRays:ue,bufferedTilespaceGeometry:H,bufferedTilespaceBounds:(ve=i.az(H),ve.min.x=i.aA(ve.min.x,0,i.al),ve.min.y=i.aA(ve.min.y,0,i.al),ve.max.x=i.aA(ve.max.x,0,i.al),ve.max.y=i.aA(ve.max.y,0,i.al),ve),tile:d,tileID:d.tileID,pixelToTileUnitsFactor:je};var ve}_bufferedScreenMercator(d,m){const j=Oi(d);if(this._screenRaycastCache[j])return this._screenRaycastCache[j];{let A;return A=m.projection.name==="globe"?this._projectAndResample(this.bufferedScreenGeometry(d),m):{polygon:this.bufferedScreenGeometry(d).map(O=>m.pointCoordinate3D(O)),unwrapped:!0},this._screenRaycastCache[j]=A,A}}_bufferedCameraMercator(d,m){const j=Oi(d);if(this._cameraRaycastCache[j])return this._cameraRaycastCache[j];{let A;return A=m.projection.name==="globe"?this._projectAndResample(this.bufferedCameraGeometryGlobe(d),m):{polygon:this.bufferedCameraGeometry(d).map(O=>m.pointCoordinate3D(O)),unwrapped:!0},this._cameraRaycastCache[j]=A,A}}_projectAndResample(d,m){const j=function(O,R){const B=i.aB([],R.pixelMatrix,R.globeMatrix),H=[0,-i.aD,0,1],Y=[0,i.aD,0,1],te=[0,0,0,1];i.aC(H,H,B),i.aC(Y,Y,B),i.aC(te,te,B);const de=new i.P(H[0]/H[3],H[1]/H[3]),ce=new i.P(Y[0]/Y[3],Y[1]/Y[3]),ue=i.aE(O,de)&&H[3]1?Ha(O.slice(0,Re),R):[],rt=Renew i.P(Es(vt.x),vt.y)),rt=rt.map(vt=>new i.P(Es(vt.x),vt.y));const Ke=[...We];Ke.length===0&&Ke.push(rt[rt.length-1]);const wt=i.ak(Ke[Ke.length-1].y,(rt.length===0?We[0]:rt[0]).y,Le);let mt;return mt=ue?[new i.P(0,wt),new i.P(0,0),new i.P(1,0),new i.P(1,wt)]:[new i.P(1,wt),new i.P(1,1),new i.P(0,1),new i.P(0,wt)],Ke.push(...mt),rt.length===0?Ke.push(We[0]):Ke.push(...rt),{polygon:Ke.map(vt=>new i.ae(vt.x,vt.y)),unwrapped:!1}}(d,m);if(j)return j;const A=function(O,R){let B=!1,H=-1/0,Y=0;for(let de=0;deH&&(H=O[de].x,Y=de);for(let de=0;de.5&&(ue.x{de.x-=1}),{polygon:O,unwrapped:B}}(Ha(d,m).map(O=>new i.P(Es(O.x),O.y)),m);return{polygon:A.polygon.map(O=>new i.ae(O.x,O.y)),unwrapped:A.unwrapped}}}function Ha(w,d){return i.aG(w,m=>{const j=d.pointCoordinate3D(m);m.x=j.x,m.y=j.y},1/256)}function Es(w){return w<0?1+w%1:w%1}function Oi(w){return 100*w|0}function _l(w,d,m,j,A){const O=function(B,H){if(B)return A(B);if(H){if(w.url&&H.tiles&&w.tiles&&delete w.tiles,H.variants){if(!Array.isArray(H.variants))return A(new Error("variants must be an array"));for(const te of H.variants){if(te==null||typeof te!="object"||te.constructor!==Object)return A(new Error("variant must be an object"));if(!Array.isArray(te.capabilities))return A(new Error("capabilities must be an array"));if(te.capabilities.length===1&&te.capabilities[0]==="meshopt"){H=Object.assign(H,te);break}}}const Y=i.aH(Object.assign({},H,w),["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,w.url),A(null,Y)}},R=function(B,H,Y){if(!B)return null;if(!H&&!Y)return B;Y=Y||B.worldview_default;const te=Object.values(B.language||{});if(te.length===0)return null;const de=Object.values(B.worldview||{});if(de.length===0)return null;const ce=te.every(je=>je===H),ue=de.every(je=>je===Y);return ce&&ue?B:H in(B.language_options||{})||Y in(B.worldview_options||{})?null:B.language_options&&B.worldview_options?B:null}(w.data,m,j);return R?i.o.frame(()=>O(null,R)):w.url?i.m(d.transformRequest(d.normalizeSourceURL(w.url,null,m,j),i.R.Source),O):i.o.frame(()=>{const{data:B,...H}=w;O(null,H)})}function Al(w,d){const m=Math.pow(2,d.z),j=Math.floor(i.aF(w.getWest())*m),A=Math.floor(i.aJ(w.getNorth())*m),O=Math.ceil(i.aF(w.getEast())*m),R=Math.ceil(i.aJ(w.getSouth())*m);return d.x>=j&&d.x=A&&d.ythis.maxzoom||d.z{if(this._tileJSONRequest=null,this._loaded=!0,A)m&&console.warn(`Ensure that your requested language string is a valid BCP-47 code or list of codes. Found: ${m}`),j&&console.warn(`Requested worldview strings must be a valid ISO alpha-2 code. Found: ${j}`),this.fire(new i.y(A));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 R of O.vector_layers)this.vectorLayerIds.push(R.id),O.worldview&&O.worldview[R.source]&&this.localizableLayerIds.add(R.id)}this.tileBounds=Zc.fromTileJSON(O),_e(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(A)})}loaded(){return this._loaded}hasTile(d){return!this.tileBounds||this.tileBounds.contains(d.canonical)}onAdd(d){this.map=d,this.load()}reload(){this.cancelTileJSONRequest();const d=i.B(this.id,this.scope);this.load(()=>this.map.style.clearSource(d))}setTiles(d){return this._options.tiles=d,this.reload(),this}setUrl(d){return this.url=d,this._options.url=d,this.reload(),this}onRemove(d){this.cancelTileJSONRequest()}serialize(){return Object.assign({},this._options)}loadTile(d,m){const j=d.tileID.canonical.url(this.tiles,this.scheme),A=this.map._requestManager.normalizeTileURL(j),O=this.map._requestManager.transformRequest(A,i.R.Tile),R=this.map.style?this.map.style.getLut(this.scope):null,B=R?{image:R.image.clone()}:null,H={request:O,data:void 0,uid:d.uid,tileID:d.tileID,tileZoom:d.tileZoom,zoom:d.tileID.overscaledZ,maxZoom:this.maxzoom,lut:B,tileSize:this.tileSize*d.tileID.overscaleFactor(),type:this.type,source:this.id,scope:this.scope,pixelRatio:i.o.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,isSymbolTile:d.isSymbolTile,brightness:this.map.style&&this.map.style.getBrightness()||0,extraShadowCaster:d.isExtraShadowCaster,tessellationStep:this.map._tessellationStep,scaleFactor:this.map.getScaleFactor(),worldview:this.map.getWorldview()||this.worldviewDefault,indoor:this.map.indoor?this.map.indoor.getIndoorTileOptions(this.id,this.scope):null};if(this.hasWorldviews&&i.h(j)&&(H.localizableLayerIds=this.localizableLayerIds),H.request.collectResourceTiming=this._collectResourceTiming,d.actor&&d.state!=="expired")d.state==="loading"?d.reloadCallback=m:d.request=d.actor.send("reloadTile",H,Y.bind(this));else if(d.actor=this._tileWorkers[A]=this._tileWorkers[A]||this.dispatcher.getActor(),this.dispatcher.ready)d.request=d.actor.send("loadTile",H,Y.bind(this),void 0,!0);else{const te=i.aL.call({deduped:this._deduped},H,(de,ce)=>{if(de||!ce)Y.call(this,de);else{const ue=i.aM(ce.responseHeaders);H.data={rawData:ce.rawData.slice(0),expires:ue.expires,cacheControl:ue.cacheControl},d.actor&&d.actor.send("loadTile",H,Y.bind(this),void 0,!0)}},!0);d.request={cancel:te}}function Y(te,de){return delete d.request,d.aborted?m(null):te&&te instanceof i.aN&&te.status!==404?m(te):(de&&de.resourceTiming&&(d.resourceTiming=de.resourceTiming),this.map._refreshExpiredTiles&&de&&d.setExpiryData(de),d.loadVectorData(de,this.map.painter),i.aO(this.dispatcher),m(null,de),void(d.reloadCallback&&(this.loadTile(d,d.reloadCallback),d.reloadCallback=null)))}}abortTile(d){d.request&&(d.request.cancel(),delete d.request),d.actor&&d.actor.send("abortTile",{uid:d.uid,type:this.type,source:this.id,scope:this.scope})}unloadTile(d,m){d.actor&&d.actor.send("removeTile",{uid:d.uid,type:this.type,source:this.id,scope:this.scope}),d.destroy()}hasTransition(){return!1}afterUpdate(){this._tileWorkers={}}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}}class Yo extends i.E{constructor(d,m,j,A){super(),this.id=d,this.dispatcher=j,this.setEventedParent(A),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=_l(this._options,this.map._requestManager,null,m,(j,A)=>{this._tileJSONRequest=null,this._loaded=!0,j?this.fire(new i.y(j)):A&&(Object.assign(this,A),A.raster_layers&&(this.rasterLayers=A.raster_layers,this.rasterLayerIds=this.rasterLayers.map(O=>O.id)),this.tileBounds=Zc.fromTileJSON(A),_e(A.tiles),this.fire(new i.z("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new i.z("data",{dataType:"source",sourceDataType:"content"}))),d&&d(j)})}loaded(){return this._loaded}onAdd(d){this.map=d,this.load()}reload(){this.cancelTileJSONRequest();const d=i.B(this.id,this.scope);this.load(()=>this.map.style.clearSource(d))}setTiles(d){return this._options.tiles=d,this.reload(),this}setUrl(d){return this.url=d,this._options.url=d,this.reload(),this}onRemove(d){this.cancelTileJSONRequest()}serialize(){return Object.assign({},this._options)}hasTile(d){return!this.tileBounds||this.tileBounds.contains(d.canonical)}loadTile(d,m){const j=i.o.devicePixelRatio>=2,A=this.map._requestManager.normalizeTileURL(d.tileID.canonical.url(this.tiles,this.scheme),j,this.tileSize);d.request=i.n(this.map._requestManager.transformRequest(A,i.R.Tile),(O,R,B)=>{if(delete d.request,d.aborted)return d.state="unloaded",m(null);if(O)return d.state="errored",m(O);if(!R)return m(null);const H=i.aM(B);this.map._refreshExpiredTiles&&d.setExpiryData(H),d.setTexture(R,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 Vd([w,d],m,j,{scaled:A=!0}={}){const{tileSize:O,buffer:R}=j,{x:B,y:H,z:Y}=m;if(!isFinite(B)||!isFinite(H)||!isFinite(Y))throw new Error("Invalid MRT header");const te=2**Y,de=te*i.aF(w),ce=te*i.aJ(d);return function([ue,je],ve,{scaled:Re=!0}={}){if(!ve)throw new Error("bandView is undefined");const{data:Le,tileSize:We,buffer:rt,offset:Ke,scale:wt,dimension:mt}=ve;if(ue<-rt||ue>We+rt||je<-rt||je>We+rt)throw new Error(`Point (${ue}, ${je}) out of bounds for tileSize=${We}, buffer=${rt}`);const vt=(je+rt)*(We+2*rt)+(ue+rt);if(new Uint32Array(Le.buffer)[vt]===4294967295)return null;let pt=[];pt=Re?[]:new ve.data.constructor(mt);for(let ut=0;ut{if(delete d.request,d.aborted)return d.state="unloaded",m(null);if(B)return B.name==="AbortError"?void 0:(d.state="errored",m(B));if(this.map._refreshExpiredTiles&&H){const te=i.aM(Y);d.setExpiryData(te)}if(this.partial&&d.state!=="expired")d.state="empty";else if(!this.partial){if(!H)return m(null);d.state="loaded",d._isHeaderLoaded=!0,d._mrt=H}m(null)};d.request=this.partial?d.fetchHeader(void 0,R.bind(this)):d.actor.send("loadTile",O,R.bind(this),void 0,!0)}abortTile(d){d.request&&(d.request.cancel(),delete d.request),d.actor&&d.actor.send("abortTile",{uid:d.uid,type:this.type,source:this.id,scope:this.scope})}unloadTile(d,m){const j=d.texturePerLayer;if(d.flushAllQueues(),j.size){d.destroy(!1);for(const A of j.values())this.map.painter.saveTileTexture(A)}else d.destroy()}prepareTile(d,m,j,A){d._isHeaderLoaded&&(d.state!=="empty"&&(d.state="reloading"),d.fetchBandForRender(m,j,A,(O,R)=>{if(O)return d.state="errored",this.fire(new i.y(O)),void this.triggerRepaint(d);R&&(d._isHeaderLoaded=!0,d.setTexturePerLayer(j,R,this.map.painter),d.state="loaded",this.triggerRepaint(d))}))}getInitialBand(d){if(!this.rasterLayers)return 0;const m=this.rasterLayers.find(({id:O})=>O===d),j=m&&m.fields,A=j&&j.bands&&j.bands;return A?A[0]:0}getTextureDescriptor(d,m,j){if(!d)return;const A=m.sourceLayer||this.rasterLayerIds&&this.rasterLayerIds[0];if(!A)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 R=O||this.getInitialBand(A);if(R==null)return;if(!d.textureDescriptorPerLayer.get(m.id))return void this.prepareTile(d,A,m.id,R);if(d.updateNeeded(m.id,R)&&!j)return;const B=d.textureDescriptorPerLayer.get(m.id);return Object.assign({},B,{texture:d.texturePerLayer.get(m.id)})}getImages(d,m){const j=new Map;for(const A of d)for(const O of m){const[R,B]=O.split("/"),H=A.getLayer(R);if(!H||!H.hasBand(B)||!H.hasDataForBand(B))continue;const{bytes:Y,tileSize:te,buffer:de}=H.getBandView(B),ce=te+2*de,ue={data:new i.q({width:ce,height:ce},Y),pixelRatio:2,sdf:!1,usvg:!1,version:0};j.set(O,ue)}return j}queryRasterArrayValueByBandId(d,m,j){const A=m._mrt;return new Promise(O=>{const R={},B=new Set;for(const[H,Y]of Object.entries(A.layers)){if(j.layerName&&H!==j.layerName)continue;const te={};R[H]=te;for(const{bands:de}of Y.dataIndex)for(const ce of de)j.bands&&!j.bands.includes(ce)||(B.add(i.B(H,ce)),m.fetchBand(H,null,ce,ue=>{i.o.frame(()=>{te[ce]=ue?null:Vd([d.lng,d.lat],A,Y.getBandView(ce)),B.delete(i.B(H,ce)),B.size===0&&O(R)})},!1))}B.size===0&&O(R)})}_loadTileForQuery(d,m){if(this._loadTileLoaded[d.uid])return void m(null,d._mrt);if(this._loadTilePending[d.uid])return void this._loadTilePending[d.uid].push(m);this._loadTilePending[d.uid]=[m];const j=this.map._requestManager.normalizeTileURL(d.tileID.canonical.url(this.tiles,this.scheme),!1,this.tileSize),A=this.map._requestManager.transformRequest(j,i.R.Tile);d.actor.send("loadTile",{request:A,uid:d.uid,tileID:d.tileID,type:this.type,source:this.id,scope:this.scope,partial:!1},(O,R,B)=>{if(O)return this._loadTilePending[d.uid].forEach(H=>H(O,null)),void delete this._loadTilePending[d.uid];if(!R)return this._loadTilePending[d.uid].forEach(H=>H(null,null)),void delete this._loadTilePending[d.uid];if(this.map._refreshExpiredTiles&&R){const H=i.aM(B);d.setExpiryData(H)}d._mrt=R,d._isHeaderLoaded=!0,d.state="loaded",this._loadTilePending[d.uid].forEach(H=>H(null,R)),this._loadTileLoaded[d.uid]=!0,delete this._loadTilePending[d.uid]},void 0,!0)}queryRasterArrayValueByAllBands(d,m,j){return new Promise((A,O)=>{this._loadTileForQuery(m,(R,B)=>{R?O(R):A(B?this.queryRasterArrayValueByBandId(d,m,j):null)})})}queryRasterArrayValue(d,m){const j=i.aT.convert(d),A=this.findLoadedParent(j);return A&&A._mrt?m.bands||!this.partial?this.queryRasterArrayValueByBandId(j,A,m):this.queryRasterArrayValueByAllBands(j,A,m):Promise.resolve(null)}findLoadedParent(d){const m=i.ae.fromLngLat(d,this.map.transform.tileSize),j=this.maxzoom+1,A=1<0&&(B[new i.aQ(w.overscaledZ,A,d.z,j,d.y-1).key]={backfilled:!1},B[new i.aQ(w.overscaledZ,w.wrap,d.z,d.x,d.y-1).key]={backfilled:!1},B[new i.aQ(w.overscaledZ,R,d.z,O,d.y-1).key]={backfilled:!1}),d.y+1{if(this._loaded=!0,this._pendingLoad=null,j)this.fire(new i.y(j));else{const O={dataType:"source",sourceDataType:this._metadataFired?"content":"metadata"};this._collectResourceTiming&&A&&A.resourceTiming&&A.resourceTiming[this.id]&&(O.resourceTiming=A.resourceTiming[this.id]),w&&(this._partialReload=!0),this.fire(new i.z("data",O)),this._partialReload=!1,this._metadataFired=!0}this._coalesce&&(this._updateWorkerData(w),this._coalesce=!1)})}loaded(){return this._loaded}reload(){const w=i.B(this.id,this.scope);this.map.style.clearSource(w),this._updateWorkerData()}loadTile(w,d){const m=w.actor?"reloadTile":"loadTile";w.actor=this.actor;const j=this.map.style?this.map.style.getLut(this.scope):null,A=j?{image:j.image.clone()}:null,O=this._partialReload,R={type:this.type,uid:w.uid,tileID:w.tileID,tileZoom:w.tileZoom,zoom:w.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,lut:A,scope:this.scope,pixelRatio:i.o.devicePixelRatio,showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,brightness:this.map.style&&this.map.style.getBrightness()||0,extraShadowCaster:w.isExtraShadowCaster,scaleFactor:this.map.getScaleFactor(),partial:O,worldview:this.map.getWorldview(),indoor:this.map.indoor?this.map.indoor.getIndoorTileOptions(this.id,this.scope):null};w.request=this.actor.send(m,R,(B,H)=>O&&!H?(w.state="loaded",d(null)):(delete w.request,w.destroy(!1),w.aborted?d(null):B?d(B):(w.loadVectorData(H,this.map.painter,m==="reloadTile"),d(null))),void 0,m==="loadTile")}abortTile(w){w.request&&(w.request.cancel(),delete w.request),w.aborted=!0}unloadTile(w,d){this.actor.send("removeTile",{uid:w.uid,type:this.type,source:this.id,scope:this.scope}),w.destroy()}onRemove(w){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(w,d,m,j){super(w,d,m,j),this.roundZoom=!0,this.type="video",this.options=d}load(){this._loaded=!1;const w=this.options;this.urls=[];for(const d of w.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(w){if(this.video){const d=this.video.seekable;wd.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=w}}getVideo(){return this.video}onAdd(w){this.map||(this.map=w,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 w=this.map.painter.context,d=w.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(w,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(w)}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(w,d,m,j){super(),this.type="batched-model",this.id=w,this.tileSize=512,this._options=d,this.tiles=this._options.tiles,this.maxzoom=d.maxzoom||19,this.minzoom=d.minzoom||0,this.roundZoom=!0,this.usedInConflation=!0,this.dispatcher=m,this.reparseOverscaled=!1,this.scheme="xyz",this._loaded=!1,this.setEventedParent(j)}onAdd(w){this.map=w,this.load()}reload(){this.cancelTileJSONRequest();const w=i.B(this.id,this.scope);this.load(()=>this.map.style.clearSource(w))}cancelTileJSONRequest(){this._tileJSONRequest&&(this._tileJSONRequest.cancel(),this._tileJSONRequest=null)}load(w){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=_l(this._options,this.map._requestManager,d,m,(j,A)=>{this._tileJSONRequest=null,this._loaded=!0,j?(d&&console.warn(`Ensure that your requested language string is a valid BCP-47 code or list of codes. Found: ${d}`),m&&m.length!==2&&console.warn(`Requested worldview strings must be a valid ISO alpha-2 code. Found: ${m}`),this.fire(new i.y(j))):A&&(Object.assign(this,A),A.bounds&&(this.tileBounds=new Zc(A.bounds,this.minzoom,this.maxzoom)),_e(A.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&&w(j)})}hasTransition(){return!1}hasTile(w){return!this.tileBounds||this.tileBounds.contains(w.canonical)}loaded(){return this._loaded}loadTile(w,d){const m=this.map._requestManager.normalizeTileURL(w.tileID.canonical.url(this.tiles,this.scheme)),j={request:this.map._requestManager.transformRequest(m,i.R.Tile),data:void 0,uid:w.uid,tileID:w.tileID,tileZoom:w.tileZoom,zoom:w.tileID.overscaledZ,tileSize:this.tileSize*w.tileID.overscaleFactor(),type:this.type,source:this.id,scope:this.scope,showCollisionBoxes:this.map.showCollisionBoxes,isSymbolTile:w.isSymbolTile,brightness:this.map.style&&this.map.style.getBrightness()||0,pixelRatio:i.o.devicePixelRatio,promoteId:this.promoteId};if(w.actor&&w.state!=="expired")if(w.state==="loading")w.reloadCallback=d;else{if(w.buckets){const O=Object.values(w.buckets);for(const R of O)R.dirty=!0;return void(w.state="loaded")}w.request=w.actor.send("reloadTile",j,A.bind(this))}else w.actor=this.dispatcher.getActor(),w.request=w.actor.send("loadTile",j,A.bind(this),void 0,!0);function A(O,R){return w.aborted?d(null):O&&O.status!==404?d(O):(this.map._refreshExpiredTiles&&R&&w.setExpiryData(R),w.loadModelData(R,this.map.painter),w.state="loaded",void d(null))}}serialize(){return Object.assign({},this._options)}},canvas:class extends i.aU{constructor(w,d,m,j){super(w,d,m,j),d.coordinates?Array.isArray(d.coordinates)&&d.coordinates.length===4&&!d.coordinates.some(A=>!Array.isArray(A)||A.length!==2||A.some(O=>typeof O!="number"))||this.fire(new i.y(new i.V(`sources.${w}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new i.y(new i.V(`sources.${w}`,null,'missing required property "coordinates"'))),d.animate&&typeof d.animate!="boolean"&&this.fire(new i.y(new i.V(`sources.${w}`,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.${w}`,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.${w}`,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(w){this.map=w,this.load(),this.canvas&&this.animate&&this.play()}onRemove(w){this.pause()}prepare(){let w=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,w=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,w=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;const d=this.map.painter.context;this.texture?!w&&!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 w of[this.canvas.width,this.canvas.height])if(isNaN(w)||w<=0)return!0;return!1}},custom:class extends i.E{constructor(w,d,m,j){super(),this.id=w,this.type="custom",this._dataType="raster",this._dispatcher=m,this._implementation=d,this.setEventedParent(j),this.scheme="xyz",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this._loaded=!1,this.roundZoom=!0,this._implementation||this.fire(new i.y(new Error(`Missing implementation for ${this.id} custom source`))),this._implementation.loadTile||this.fire(new i.y(new Error(`Missing loadTile implementation for ${this.id} custom source`))),this._implementation.bounds&&(this.tileBounds=new Zc(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(w){this.map=w,this._loaded=!1,this.fire(new i.z("dataloading",{dataType:"source"})),this._implementation.onAdd&&this._implementation.onAdd(w),this.load()}onRemove(w){this._implementation.onRemove&&this._implementation.onRemove(w)}hasTile(w){if(this._implementation.hasTile){const{x:d,y:m,z:j}=w.canonical;return this._implementation.hasTile({x:d,y:m,z:j})}return!this.tileBounds||this.tileBounds.contains(w.canonical)}loadTile(w,d){const{x:m,y:j,z:A}=w.tileID.canonical,O=new AbortController;w.request=Promise.resolve(this._implementation.loadTile({x:m,y:j,z:A},{signal:O.signal})).then((function(R){return delete w.request,w.aborted?(w.state="unloaded",d(null)):R===void 0?(w.state="errored",d(null)):R===null?(this.loadTileData(w,{width:this.tileSize,height:this.tileSize,data:null}),w.state="loaded",d(null)):function(B){return B instanceof ImageData||B instanceof HTMLCanvasElement||B instanceof ImageBitmap||B instanceof HTMLImageElement}(R)?(this.loadTileData(w,R),w.state="loaded",void d(null)):(w.state="errored",d(new Error(`Can't infer data type for ${this.id}, only raster data supported at the moment`)))}).bind(this)).catch(R=>{R.name!=="AbortError"&&(w.state="errored",d(R))}),w.request.cancel=()=>O.abort()}loadTileData(w,d){w.setTexture(d,this.map.painter)}unloadTile(w,d){if(w.texture&&w.texture instanceof i.T?(w.destroy(!1),w.texture&&w.texture instanceof i.T&&this.map.painter.saveTileTexture(w.texture)):w.destroy(),this._implementation.unloadTile){const{x:m,y:j,z:A}=w.tileID.canonical;this._implementation.unloadTile({x:m,y:j,z:A})}d&&d()}abortTile(w,d){w.request&&w.request.cancel&&(w.request.cancel(),delete w.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(w=>({x:w.canonical.x,y:w.canonical.y,z:w.canonical.z}))}_clearTiles(){const w=i.B(this.id,this.scope);this.map.style.clearSource(w)}_update(){this.fire(new i.z("data",{dataType:"source",sourceDataType:"content"}))}}},Xo=function(w,d,m,j){const A=new ih[d.type](w,d,m,j);if(A.id!==w)throw new Error(`Expected Source id to be ${w} instead of ${A.id}`);return i.aY(["load","abort","unload","serialize","prepare"],A),A};function Sp(w,d,m=""){return`${m}:${d.id||""}:${d.layer.id}:${function(j){if("layerId"in j)return`layer:${j.layerId}`;{const{featuresetId:A,importId:O}=j;return`featureset:${A}${O?`:import:${O}`:""}`}}(w.target)}`}function Wm(w,d,m,j=""){if(w.uniqueFeatureID){const A=Sp(w,d,j);if(m.has(A))return!0;m.add(A)}return!1}function Gy(w,d,m,j,A=!1){const O=d.sourceCache.transform,R=d.sourceCache.tilesIn(w,d.has3DLayers,A);R.sort(zh);const B=[];for(const H of R){const Y=H.tile.queryRenderedFeatures(d,H,m,j,O,A);Object.keys(Y).length&&B.push({wrappedTileID:H.tile.tileID.wrapped().key,queryResults:Y})}for(const H in d.layers){const Y=d.layers[H];if(Y.styleLayer){const te=Y.styleLayer.queryRenderedFeatures(w,d.sourceCache,j);Object.keys(te).length&&B.push({wrappedTileID:0,queryResults:te})}}return B.length===0?{}:function(H){const Y={},te={};for(const de of H){const ce=de.queryResults,ue=de.wrappedTileID,je=te[ue]=te[ue]||{};for(const ve in ce){const Re=ce[ve],Le=je[ve]=je[ve]||{},We=Y[ve]=Y[ve]||[];for(const rt of Re)Le[rt.featureIndex]||(Le[rt.featureIndex]=!0,We.push(rt))}}return Y}(B)}function Ky(w,d,m,j,A,O){const R={},B=j.queryRenderedSymbols(w),H=[];for(const Y of Object.keys(B).map(Number))H.push(A[Y]);H.sort(zh);for(const Y of H){const te=Y.featureIndex.lookupSymbolFeatures(B[Y.bucketInstanceId],Y.bucketIndex,Y.sourceLayerIndex,d,m,O);for(const de in te){const ce=R[de]=R[de]||[],ue=te[de];ue.sort((je,ve)=>{const Re=Y.featureSortOrder;if(Re){const Le=Re.indexOf(je.featureIndex);return Re.indexOf(ve.featureIndex)-Le}return ve.featureIndex-je.featureIndex});for(const je of ue)ce.push(je)}}return R}function Zy(w,d){const m=w.getRenderableIds().map(O=>w.getTileByID(O)),j=[],A={};for(let O=0;Od.getLayer(O)).filter(Boolean);if(A.length!==0){j.layers=A,j.stateDependentLayerIds&&(j.stateDependentLayers=j.stateDependentLayerIds.map(O=>A.filter(R=>R.id===O)[0]));for(const O of A)m[O.fqid]=j}}return m}const Yc=32,lu=33,fc=new Uint16Array(8184);for(let w=0;w<2046;w++){let d=w+2,m=0,j=0,A=0,O=0,R=0,B=0;for(1&d?A=O=R=Yc:m=j=B=Yc;(d>>=1)>1;){const Y=m+A>>1,te=j+O>>1;1&d?(A=m,O=j,m=R,j=B):(m=A,j=O,A=R,O=B),R=Y,B=te}const H=4*w;fc[H+0]=m,fc[H+1]=j,fc[H+2]=A,fc[H+3]=O}const Xc=new Uint16Array(2178),Uo=new Uint8Array(1089),Au=new Uint16Array(1089);function Bh(w){return w===0?-.03125:w===32?.03125:0}const Hd={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 Cp{constructor(d,m,j,A,O,R){this.tileID=d,this.uid=i.b2(),this.uses=0,this.tileSize=m,this.tileZoom=j,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.isRaster=O,A&&A.style&&(this._lastUpdatedBrightness=A.style.getBrightness()),this.expiredRequestCount=0,this.state="loading",A&&A.transform&&(this.projection=A.transform.projection),this.worldview=R,this._hasAppearances=null}registerFadeDuration(d){const m=d+this.timeAdded;mj)A=!1;else if(m)if(this.expirationTimej.appearances&&j.appearances.length>0))return!0;return!1}updateBuckets(d,m){if(!this.latestFeatureIndex||!d.style)return;const j=d.style.listImages(),A=d.style.getBrightness();for(const O in this.buckets){if(!d.style.hasLayer(O))continue;const R=this.buckets[O],B=R.layers[0],H=B.sourceLayer||"_geojsonTileLayer",Y=d.style.getLayerSourceCache(B);let te={};Y&&(te=Y._state.getState(H,void 0));const de=this.imageAtlas?Object.fromEntries(this.imageAtlas.patternPositions):{},ce=Object.keys(te).length>0&&!m;R.hasAppearances=R.layers.some(ve=>ve.appearances&&ve.appearances.length>0);const ue=ce?R.stateDependentLayers:R.layers;if(ce&&R.stateDependentLayers.length!==0||m){const ve=this.latestFeatureIndex.loadVTLayers();R.update(te,ve[H],j,de,ue,m,A)}if(ce&&R.stateDependentLayers.length!==0||m||R.hasAppearances){const ve={zoom:d.transform.zoom,pitch:d.transform.pitch,brightness:d.style.getBrightness()||0,worldview:d.worldview};R.updateAppearances(this.tileID.canonical,te,j,ve)}(R instanceof i.ba||R instanceof i.bb)&&d._terrain&&d._terrain.enabled&&Y&&R.uploadPending()&&d._terrain._clearRenderCacheForTile(Y.id,this.tileID);const je=d&&d.style&&d.style.getOwnLayer(O);je&&(this.queryPadding=Math.max(this.queryPadding,je.queryRadius(R)))}}holdingForFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil=0;Re--){const Le=4*Re,We=fc[Le+0],rt=fc[Le+1],Ke=fc[Le+2],wt=fc[Le+3],mt=We+Ke>>1,vt=rt+wt>>1,pt=mt+vt-rt,ut=vt+We-mt,St=rt*lu+We,Dt=wt*lu+Ke,Ot=vt*lu+mt,Gt=Math.hypot((Xc[2*St+0]+Xc[2*Dt+0])/2-Xc[2*Ot+0],(Xc[2*St+1]+Xc[2*Dt+1])/2-Xc[2*Ot+1])>=16;Uo[Ot]=Uo[Ot]||(Gt?1:0),Re<1022&&(Uo[Ot]=Uo[Ot]||Uo[(rt+ut>>1)*lu+(We+pt>>1)]||Uo[(wt+ut>>1)*lu+(Ke+pt>>1)])}const de=new i.b1,ce=new i.b0;let ue=0;function je(Re,Le){const We=Le*lu+Re;return Au[We]===0&&(de.emplaceBack(Xc[2*We+0],Xc[2*We+1],Re*i.al/Yc,Le*i.al/Yc),Au[We]=++ue),Au[We]-1}function ve(Re,Le,We,rt,Ke,wt){const mt=Re+We>>1,vt=Le+rt>>1;if(Math.abs(Re-Ke)+Math.abs(Le-wt)>1&&Uo[vt*lu+mt])ve(Ke,wt,Re,Le,mt,vt),ve(We,rt,Ke,wt,mt,vt);else{const pt=je(Re,Le),ut=je(We,rt),St=je(Ke,wt);ce.emplaceBack(pt,ut,St)}}return ve(0,0,Yc,Yc,Yc,0),ve(Yc,Yc,0,0,0,Yc),{vertices:de,indices:ce}}(this.tileID.canonical,m);A=R.vertices,O=R.indices}else{A=new i.b1,O=new i.b0;for(const{x:B,y:H}of j)A.emplaceBack(B,H,0,0);const R=i.bh(A.int16.subarray(0,4*A.length),void 0,4);for(let B=0;B0&&(H=i.bl(new Float64Array(16),m.globeMatrix)),this._makeGlobeTileDebugBorderBuffer(d,A,m,R,H,B),this._makeGlobeTileDebugTextBuffer(d,A,m,R,H,B)}_globePoint(d,m,j,A,O,R,B){let H=i.bm(d,m,j);if(R){const Y=1<.5?ue=-1:ce<-.5&&(ue=1);let je=(d/i.al+j.x)/Y+ue,ve=(m/i.al+j.y)/Y;je=(je-te)*A._pixelsPerMercatorPixel+te,ve=(ve-de)*A._pixelsPerMercatorPixel+de;const Re=[je*A.worldSize,ve*A.worldSize,0];i.af(Re,Re,R),H=i.bn(H,Re,B)}return i.af(H,H,O)}_makeGlobeTileDebugBorderBuffer(d,m,j,A,O,R){const B=new i.bd,H=new i.be,Y=new i.bo,te=(ce,ue,je,ve,Re)=>{const Le=(je-ce)/(Re-1),We=(ve-ue)/(Re-1),rt=B.length;for(let Ke=0;Kede*ue+je;for(let ue=0;ue{if(O)m(O);else try{const H=j.getHeaderLength(R);if(H>d)return void(this.request=this.fetchHeader(H,m));j.parseHeader(R),this._isHeaderLoaded=!0;let Y=0;for(const te of Object.values(j.layers))Y=Math.max(Y,te.dataIndex[te.dataIndex.length-1].lastByte);R.byteLength>=Y&&(this.entireBuffer=R),m(null,this.entireBuffer||R,B)}catch(H){m(H)}}),this.request}fetchBandForRender(d,m,j,A){this.fetchBand(d,m,j,O=>{if(O)return void A(O);this.updateTextureDescriptor(d,m,j);const R=this.textureDescriptorPerLayer.get(m);A(null,R?R.img:null)})}fetchBand(d,m,j,A,O=!0){const R=this._mrt;if(!this._isHeaderLoaded||!R)return void A(new Error("Tile header is not ready"));const B=this.actor;if(!B)return void A(new Error("Can't fetch tile band without an actor"));let H;const Y=i.B(String(j),i.B(this.tileID.key,d));let te=this._taskQueue.get(Y);te?te.add(A):(te=new Set,te.add(A),this._taskQueue.set(Y,te));const de=(ve,Re)=>{H.complete(ve,Re),ve?A(ve):(te.forEach(Le=>Le(null,Re)),this._taskQueue.delete(Y))},ce=(ve,Re)=>{if(ve)return A(ve);const Le=B.send("decodeRasterArray",{type:"raster-array",source:this.source,scope:this.scope,tileID:this.tileID,uid:this.uid,buffer:Re,task:H},de,void 0,!0);if(m!==null){const We=this._workQueuePerLayer.get(m)||[];We.push(()=>{Le&&Le.cancel(),H.cancel()}),this._workQueuePerLayer.has(m)||this._workQueuePerLayer.set(m,We)}};let ue;try{ue=R.getLayer(d)}catch(ve){if(this.state==="reloading")return;throw ve}if(!ue)return void A(new Error(`Unknown sourceLayer "${d}"`));if(ue.hasDataForBand(j))return te.forEach(ve=>ve(null,null)),void this._taskQueue.delete(Y);const je=ue.getDataRange([j]);if(H=R.createDecodingTask(je),!H||H.tasks.length)if(m!==null&&this.flushQueues(m),this.entireBuffer)ce(null,this.entireBuffer.slice(je.firstByte,je.lastByte+1));else{const ve=Object.assign({},this.requestParams,{headers:{Range:`bytes=${je.firstByte}-${je.lastByte}`}}),Re=i.bu(ve,ce);if(m!==null){const Le=this._fetchQueuePerLayer.get(m)||[];Le.push(()=>{Re.cancel(),H.cancel()}),this._fetchQueuePerLayer.has(m)||this._fetchQueuePerLayer.set(m,Le)}}}updateNeeded(d,m){return(!this.textureDescriptorPerLayer.get(d)||this.textureDescriptorPerLayer.get(d).band!==m||this.refreshedUponExpiration)&&this.state!=="errored"}updateTextureDescriptor(d,m,j){if(!this._mrt)return;const A=this._mrt.getLayer(d);if(!A||!A.hasBand(j)||!A.hasDataForBand(j))return;const{bytes:O,tileSize:R,buffer:B,offset:H,scale:Y}=A.getBandView(j),te=R+2*B,de=new i.q({width:te,height:te},O),ce=this.texturePerLayer.get(m);ce&&ce instanceof i.T&&ce.update(de,{premultiply:!1}),this.textureDescriptorPerLayer.set(m,{layer:d,band:j,img:de,buffer:B,offset:H,tileSize:R,format:A.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 lx{constructor(d,m){this.max=d,this.onRemove=m,this.reset()}reset(){for(const d in this.data)for(const m of this.data[d])m.timeout&&clearTimeout(m.timeout),this.onRemove(m.value);return this.data={},this.order=[],this}add(d,m,j){const A=d.wrapped().key;this.data[A]===void 0&&(this.data[A]=[]);const O={value:m,timeout:void 0};if(j!==void 0&&(O.timeout=setTimeout(()=>{this.remove(d,O)},j)),this.data[A].push(O),this.order.push(A),this.order.length>this.max){const R=this._getAndRemoveByKey(this.order[0]);R&&this.onRemove(R)}return this}has(d){return d.wrapped().key in this.data}getAndRemove(d){return this.has(d)?this._getAndRemoveByKey(d.wrapped().key):null}_getAndRemoveByKey(d){const m=this.data[d].shift();return m.timeout&&clearTimeout(m.timeout),this.data[d].length===0&&delete this.data[d],this.order.splice(this.order.indexOf(d),1),m.value}getByKey(d){const m=this.data[d];return m?m[0].value:null}get(d){return this.has(d)?this.data[d.wrapped().key][0].value:null}remove(d,m){if(!this.has(d))return this;const j=d.wrapped().key,A=m===void 0?0:this.data[j].indexOf(m),O=this.data[j][A];return this.data[j].splice(A,1),O.timeout&&clearTimeout(O.timeout),this.data[j].length===0&&delete this.data[j],this.onRemove(O.value),this.order.splice(this.order.indexOf(j),1),this}setMaxSize(d){for(this.max=d;this.order.length>this.max;){const m=this._getAndRemoveByKey(this.order[0]);m&&this.onRemove(m)}return this}filter(d){const m=[];for(const j in this.data)for(const A of this.data[j])d(A.value)||m.push(A);for(const j of m)this.remove(j.value.tileID,j)}}class Mp{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(d,m,j){const A=String(m);if(this.stateChanges[d]=this.stateChanges[d]||{},this.stateChanges[d][A]=this.stateChanges[d][A]||{},Object.assign(this.stateChanges[d][A],j),this.deletedStates[d]===null){this.deletedStates[d]={};for(const O in this.state[d])O!==A&&(this.deletedStates[d][O]=null)}else if(this.deletedStates[d]&&this.deletedStates[d][A]===null){this.deletedStates[d][A]={};for(const O in this.state[d][A])j[O]||(this.deletedStates[d][A][O]=null)}else for(const O in j)this.deletedStates[d]&&this.deletedStates[d][A]&&this.deletedStates[d][A][O]===null&&delete this.deletedStates[d][A][O]}removeFeatureState(d,m,j){if(this.deletedStates[d]===null)return;const A=String(m);if(this.deletedStates[d]=this.deletedStates[d]||{},j&&m!==void 0)this.deletedStates[d][A]!==null&&(this.deletedStates[d][A]=this.deletedStates[d][A]||{},this.deletedStates[d][A][j]=null);else if(m!==void 0)if(this.stateChanges[d]&&this.stateChanges[d][A])for(j in this.deletedStates[d][A]={},this.stateChanges[d][A])this.deletedStates[d][A][j]=null;else this.deletedStates[d][A]=null;else this.deletedStates[d]=null}getState(d,m){const j=this.state[d]||{},A=this.stateChanges[d]||{},O=this.deletedStates[d];if(O===null)return{};if(m!==void 0){const B=String(m),H=Object.assign({},j[B],A[B]);if(O){const Y=O[m];if(Y===null)return{};for(const te in Y)delete H[te]}return H}const R=Object.assign({},j,A);if(O)for(const B in O)delete R[B];return R}initializeTileState(d,m){d.refreshFeatureState(m)}coalesceChanges(d,m){const j={};for(const A in this.stateChanges){this.state[A]=this.state[A]||{};const O={};for(const R in this.stateChanges[A])this.state[A][R]||(this.state[A][R]={}),Object.assign(this.state[A][R],this.stateChanges[A][R]),O[R]=this.state[A][R];j[A]=O}for(const A in this.deletedStates){this.state[A]=this.state[A]||{};const O={};if(this.deletedStates[A]===null)for(const R in this.state[A])O[R]={},this.state[A][R]={};else for(const R in this.deletedStates[A]){if(this.deletedStates[A][R]===null)this.state[A][R]={};else if(this.state[A][R])for(const B of Object.keys(this.deletedStates[A][R]))delete this.state[A][R][B];O[R]=this.state[A][R]}j[A]=j[A]||{},Object.assign(j[A],O)}if(this.stateChanges={},this.deletedStates={},Object.keys(j).length!==0)for(const A in d)d[A].refreshFeatureState(m)}}class yd extends i.E{constructor(d,m,j){super(),this.id=d,this._onlySymbols=j,m.on("data",A=>{A.dataType==="source"&&A.sourceDataType==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&A.dataType==="source"&&A.sourceDataType==="content"&&(this.reload(),this.transform&&this.update(this.transform))}),m.on("error",()=>{this._sourceErrored=!0}),this._source=m,this._tiles={},this._cache=new lx(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 Mp,this._isRaster=this._source.type==="raster"||this._source.type==="raster-dem"||this._source.type==="raster-array"||this._source.type==="custom"&&this._source._dataType==="raster"}onAdd(d){this.map=d,this._minTileCacheSize=this._minTileCacheSize===void 0&&d?d._minTileCacheSize:this._minTileCacheSize,this._maxTileCacheSize=this._maxTileCacheSize===void 0&&d?d._maxTileCacheSize:this._maxTileCacheSize}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;for(const d in this._tiles)if(!this._tiles[d].loaded())return!1;return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const d=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,d&&this.reload(),this.transform&&this.update(this.transform)}_loadTile(d,m){return d.isSymbolTile=this._onlySymbols,d.isExtraShadowCaster=this._shadowCasterTiles[d.tileID.key],this._source.loadTile(d,m)}_unloadTile(d){if(this._source.unloadTile)return this._source.unloadTile(d)}_abortTile(d){if(this._source.abortTile)return this._source.abortTile(d)}serialize(){return this._source.serialize()}prepare(d){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const m in this._tiles){const j=this._tiles[m];j.upload(d,this.map?this.map.painter:void 0),j.prepare(this.map.style.imageManager,this.map?this.map.painter:null,this._source.scope)}}getIds(){return Object.values(this._tiles).map(d=>d.tileID).sort(Xy).map(d=>d.key)}getRenderableIds(d,m){const j=[];for(const A in this._tiles)this._isIdRenderable(+A,d,m)&&j.push(this._tiles[A]);return d?j.sort((A,O)=>{const R=A.tileID,B=O.tileID,H=new i.P(R.canonical.x,R.canonical.y)._rotate(this.transform.angle),Y=new i.P(B.canonical.x,B.canonical.y)._rotate(this.transform.angle);return R.overscaledZ-B.overscaledZ||Y.y-H.y||Y.x-H.x}).map(A=>A.tileID.key):j.map(A=>A.tileID).sort(Xy).map(A=>A.key)}hasRenderableParent(d){const m=this.findLoadedParent(d,0);return!!m&&this._isIdRenderable(m.tileID.key)}_isIdRenderable(d,m,j){return this._tiles[d]&&this._tiles[d].hasData()&&!this._coveredTiles[d]&&(m||!this._tiles[d].holdingForFade())&&(j||!this._shadowCasterTiles[d])}reload(){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const d in this._tiles)this._tiles[d].state!=="errored"&&this._reloadTile(+d,"reloading")}}_reloadTile(d,m){const j=this._tiles[d];j&&(j.state!=="loading"&&(j.state=m),this._loadTile(j,this._tileLoaded.bind(this,j,d,m)))}_tileLoaded(d,m,j,A,O){if(A){if(d.state="errored",A.status!==404)this._source.fire(new i.y(A,{tile:d}));else{if(this._source.fire(new i.z("data",{dataType:"source",sourceDataType:"error",sourceId:this._source.id,tile:d})),!(d.tileID.key in this._loadedParentTiles))return;if(this._source.type==="raster-dem"&&this.usedForTerrain&&this.map.painter.terrain){const B=this.map.painter.terrain;this.update(this.transform,B.getScaledDemTileSize(),!0),B.resetTileLookupCache(this.id)}else this.update(this.transform)}return}d.timeAdded=i.o.now(),j==="expired"&&(d.refreshedUponExpiration=!0),this._setTileReloadTimer(m,d),this._source.type==="raster-dem"&&d.dem&&this._backfillDEM(d),this._state.initializeTileState(d,this.map?this.map.painter:null);let R=new Map;O&&O.responseHeaders&&(R=O.responseHeaders),this._source.fire(new i.z("data",{dataType:"source",tile:d,coord:d.tileID,sourceCacheId:this.id,responseHeaders:R}))}_backfillDEM(d){const m=this.getRenderableIds();for(let A=0;A1||(Math.abs(R)>1&&(Math.abs(R+H)===1?R+=H:Math.abs(R-H)===1&&(R-=H)),O.dem&&A.dem&&(A.dem.backfillBorder(O.dem,R,B),A.neighboringTiles&&A.neighboringTiles[Y]&&(A.neighboringTiles[Y].backfilled=!0)))}}getTile(d){return this.getTileByID(d.key)}getTileByID(d){return this._tiles[d]}_retainLoadedChildren(d,m,j,A){for(const O in this._tiles){let R=this._tiles[O];if(A[O]||!R.hasData()||R.tileID.overscaledZ<=m||R.tileID.overscaledZ>j)continue;let B=R.tileID;for(;R&&R.tileID.overscaledZ>m+1;){const Y=R.tileID.scaledTo(R.tileID.overscaledZ-1);R=this._tiles[Y.key],R&&R.hasData()&&(B=Y)}let H=B;for(;H.overscaledZ>m;)if(H=H.scaledTo(H.overscaledZ-1),d[H.key]){A[B.key]=B;break}}}findLoadedParent(d,m){if(d.key in this._loadedParentTiles){const j=this._loadedParentTiles[d.key];return j&&j.tileID.overscaledZ>=m?j:null}for(let j=d.overscaledZ-1;j>=m;j--){const A=d.scaledTo(j),O=this._getLoadedTile(A);if(O)return O}}_getLoadedTile(d){const m=this._tiles[d.key];return m&&m.hasData()?m:this._cache.getByKey(this._source.reparseOverscaled?d.wrapped().key:d.canonical.key)}updateCacheSize(d,m){m=m||this._source.tileSize;const j=Math.ceil(d.width/m)+1,A=Math.ceil(d.height/m)+1,O=Math.floor(j*A*5),R=typeof this._minTileCacheSize=="number"?Math.max(this._minTileCacheSize,O):O,B=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,R):R;this._cache.setMaxSize(B)}handleWrapJump(d){const m=Math.round((d-(this._prevLng===void 0?d:this._prevLng))/360);if(this._prevLng=d,m){const j={};for(const A in this._tiles){const O=this._tiles[A];O.tileID=O.tileID.unwrapTo(O.tileID.wrap+m),j[O.tileID.key]=O}this._tiles=j;for(const A in this._timers)clearTimeout(this._timers[A]),delete this._timers[A];for(const A in this._tiles)this._setTileReloadTimer(+A,this._tiles[A])}}update(d,m,j,A,O){if(this.transform=d,!this._sourceLoaded||this._paused||this.transform.freezeTileCoverage||this.usedForTerrain&&!j)return;this.updateCacheSize(d,m),this.transform.projection.name!=="globe"&&this.handleWrapJump(this.transform.center.lng),this._shadowCasterTiles={},this._coveredTiles={};const R=this._source.type==="batched-model";let B,H=this._source.maxzoom;const Y=this.map&&this.map.painter?this.map.painter._terrain:null;if(Y&&Y.sourceCache===this&&Y.attenuationRange()){const ce=Y.attenuationRange()[0],ue=Math.floor(ce)-Math.log2(Y.getDemUpscale());H>ue&&(H=ue)}if(this.used||this.usedForTerrain){if(this._source.tileID)B=d.getVisibleUnwrappedCoordinates(this._source.tileID).map(ce=>new i.aQ(ce.canonical.z,ce.wrap,ce.canonical.z,ce.canonical.x,ce.canonical.y));else if(this.tileCoverLift!==0){const ce=d.clone();ce.tileCoverLift=this.tileCoverLift,B=ce.coveringTiles({tileSize:m||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:H,roundZoom:this._source.roundZoom&&!j,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain,calculateQuadrantVisibility:R}),this._source.minzoom<=1&&d.projection.name==="globe"&&(B.push(new i.aQ(1,0,1,0,0)),B.push(new i.aQ(1,0,1,1,0)),B.push(new i.aQ(1,0,1,0,1)),B.push(new i.aQ(1,0,1,1,1)))}else if(B=d.coveringTiles({tileSize:m||this._source.tileSize,minzoom:this._source.minzoom,maxzoom:H,roundZoom:this._source.roundZoom&&!j,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain,calculateQuadrantVisibility:R}),this._source.hasTile){const ce=this._source.hasTile.bind(this._source);B=B.filter(ue=>ce(ue))}}else B=[];if(B.length>0&&this.transform.projection.name!=="globe"&&!this.usedForTerrain&&!Af(this._source.type)){const ce=d.coveringZoomLevel({tileSize:m||this._source.tileSize,roundZoom:this._source.roundZoom&&!j}),ue=Math.min(ce,this._source.maxzoom);if(R){const je=d.extendTileCover(B,ue);for(const ve of je)B.push(ve)}else if(O){const je=d.extendTileCoverToNearPlane(B,this.transform.getFrustum(ue),ue);for(const ve of je)B.push(ve)}else if(this.castsShadows&&A){const je=d.extendTileCover(B,ue,A,16);for(const ve of je)this._shadowCasterTiles[ve.key]=!0,B.push(ve)}}const te=this._updateRetainedTiles(B);if(Af(this._source.type)&&B.length!==0){const ce={},ue={},je=Object.keys(te);for(const Re of je){const Le=te[Re],We=this._tiles[Re];if(!We||We.fadeEndTime&&We.fadeEndTime<=i.o.now())continue;const rt=this.findLoadedParent(Le,Math.max(Le.overscaledZ-yd.maxOverzooming,this._source.minzoom));rt&&(this._addTile(rt.tileID),ce[rt.tileID.key]=rt.tileID),ue[Re]=Le}const ve=B[B.length-1].overscaledZ;for(const Re in this._tiles){const Le=this._tiles[Re];if(te[Re]||!Le.hasData())continue;let We=Le.tileID;for(;We.overscaledZ>ve;){We=We.scaledTo(We.overscaledZ-1);const rt=this._tiles[We.key];if(rt&&rt.hasData()&&ue[We.key]){te[Re]=Le.tileID;break}}}for(const Re in ce)te[Re]||(this._coveredTiles[Re]=!0,te[Re]=ce[Re])}for(const ce in te)this._tiles[ce].clearFadeHold();const de=i.bv(this._tiles,te);for(const ce of de){const ue=this._tiles[ce];ue.hasSymbolBuckets&&!ue.holdingForFade()?ue.setHoldDuration(this.map._fadeDuration):ue.hasSymbolBuckets&&!ue.symbolFadeFinished()||this._removeTile(+ce)}this._updateLoadedParentTileCache(),this._onlySymbols&&this._source.afterUpdate&&this._source.afterUpdate()}releaseSymbolFadeTiles(){for(const d in this._tiles)this._tiles[d].holdingForFade()&&this._removeTile(+d)}_updateRetainedTiles(d){const m={};if(d.length===0)return m;const j={},A=d.reduce((Y,te)=>Math.min(Y,te.overscaledZ),1/0),O=d[0].overscaledZ,R=Math.max(O-yd.maxOverzooming,this._source.minzoom),B=Math.max(O+yd.maxUnderzooming,this._source.minzoom),H={};for(const Y of d){const te=this._addTile(Y);m[Y.key]=Y,te.hasData()||A=this._source.maxzoom){const ce=Y.children(this._source.maxzoom)[0],ue=this.getTile(ce);if(ue&&ue.hasData()){m[ce.key]=ce;continue}}else{const ce=Y.children(this._source.maxzoom);if(m[ce[0].key]&&m[ce[1].key]&&m[ce[2].key]&&m[ce[3].key])continue}let de=te.wasRequested();for(let ce=Y.overscaledZ-1;ce>=R;--ce){const ue=Y.scaledTo(ce);if(j[ue.key]||(j[ue.key]=!0,te=this.getTile(ue),!te&&de&&(te=this._addTile(ue)),te&&(m[ue.key]=ue,de=te.wasRequested(),te.hasData())))break}}return m}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const d in this._tiles){const m=[];let j,A=this._tiles[d].tileID;for(;A.overscaledZ>0;){if(A.key in this._loadedParentTiles){j=this._loadedParentTiles[A.key];break}m.push(A.key);const O=A.scaledTo(A.overscaledZ-1);if(j=this._getLoadedTile(O),j)break;A=O}for(const O of m)this._loadedParentTiles[O]=j}}_addTile(d){let m=this._tiles[d.key];if(m)return m.isExtraShadowCaster!==!0||this._shadowCasterTiles[d.key]||this._reloadTile(d.key,"reloading"),m;m=this._cache.getAndRemove(d),m&&(this._setTileReloadTimer(d.key,m),m.tileID=d,this._state.initializeTileState(m,this.map?this.map.painter:null),this._cacheTimers[d.key]&&(clearTimeout(this._cacheTimers[d.key]),delete this._cacheTimers[d.key],this._setTileReloadTimer(d.key,m)));const j=!!m;if(!j){const A=this.map?this.map.painter:null,O=this._source.tileSize*d.overscaleFactor();m=this._source.type==="raster-array"?new Yy(d,O,this.transform.tileZoom,A,this._isRaster):new Cp(d,O,this.transform.tileZoom,A,this._isRaster,this._source.worldview),this._loadTile(m,this._tileLoaded.bind(this,m,d.key,m.state))}return m.uses++,this._tiles[d.key]=m,j||this._source.fire(new i.z("dataloading",{tile:m,coord:m.tileID,dataType:"source"})),m}_setTileReloadTimer(d,m){d in this._timers&&(clearTimeout(this._timers[d]),delete this._timers[d]);const j=m.getExpiryTimeout();j&&(this._timers[d]=setTimeout(()=>{this._reloadTile(d,"expired"),delete this._timers[d]},j))}_removeTile(d){const m=this._tiles[d];m&&(m.uses--,delete this._tiles[d],this._timers[d]&&(clearTimeout(this._timers[d]),delete this._timers[d]),m.uses>0||(m.hasData()&&m.state!=="reloading"||m.state==="empty"?this._cache.add(m.tileID,m,m.getExpiryTimeout()):(m.aborted=!0,this._abortTile(m),this._unloadTile(m))))}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const d in this._tiles)this._removeTile(+d);this._source._clear&&this._source._clear(),this._cache.reset(),this.map&&this.usedForTerrain&&this.map.painter.terrain&&this.map.painter.terrain.resetTileLookupCache(this.id)}tilesIn(d,m,j){const A=[],O=this.transform;if(!O)return A;const R=O.projection.name==="globe",B=i.aF(O.center.lng);for(const H in this._tiles){const Y=this._tiles[H];if(j&&Y.clearQueryDebugViz(),Y.holdingForFade())continue;let te;if(R){const de=Y.tileID.canonical;if(de.z===0){const ce=[Math.abs(i.aA(B,...Eu(de,-1))-B),Math.abs(i.aA(B,...Eu(de,1))-B)];te=[0,2*ce.indexOf(Math.min(...ce))-1]}else{const ce=[Math.abs(i.aA(B,...Eu(de,-1))-B),Math.abs(i.aA(B,...Eu(de,0))-B),Math.abs(i.aA(B,...Eu(de,1))-B)];te=[ce.indexOf(Math.min(...ce))-1]}}else te=[0];for(const de of te){const ce=d.containsTile(Y,O,m,de);ce&&A.push(ce)}}return A}getShadowCasterCoordinates(){return this._getRenderableCoordinates(!1,!0)}getVisibleCoordinates(d){return this._getRenderableCoordinates(d)}_getRenderableCoordinates(d,m){const j=this.getRenderableIds(d,m).map(O=>this._tiles[O].tileID),A=this.transform.projection.name==="globe";for(const O of j)O.projMatrix=this.transform.calculateProjMatrix(O.toUnwrapped()),O.expandedProjMatrix=A?this.transform.calculateProjMatrix(O.toUnwrapped(),!1,!0):O.projMatrix;return j}sortCoordinatesByDistance(d){const m=d.slice(),j=this.transform._camera.position,A=this.transform._camera.forward(),O={};for(const R of m){const B=1/(1<O[R.key]-O[B.key]),m}hasTransition(){if(this._source.hasTransition())return!0;if(Af(this._source.type))for(const d in this._tiles){const m=this._tiles[d];if(m.fadeEndTime!==void 0&&m.fadeEndTime>=i.o.now())return!0}return!1}setFeatureState(d,m,j){this._state.updateState(d=d||"_geojsonTileLayer",m,j)}removeFeatureState(d,m,j){this._state.removeFeatureState(d=d||"_geojsonTileLayer",m,j)}getFeatureState(d,m){return this._state.getState(d=d||"_geojsonTileLayer",m)}setDependencies(d,m,j){const A=this._tiles[d];A&&A.setDependencies(m,j)}reloadTilesForDependencies(d,m){for(const j in this._tiles)this._tiles[j].hasDependency(d,m)&&this._reloadTile(+j,"reloading");this._cache.filter(j=>!j.hasDependency(d,m))}_preloadTiles(d,m){if(!this._sourceLoaded){const H=()=>{this._sourceLoaded&&(this._source.off("data",H),this._preloadTiles(d,m))};return void this._source.on("data",H)}const j=new Map,A=Array.isArray(d)?d:[d],O=this.map.painter.terrain,R=this.usedForTerrain&&O?O.getScaledDemTileSize():this._source.tileSize;for(const H of A){const Y=H.coveringTiles({tileSize:R,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom&&!this.usedForTerrain,reparseOverscaled:this._source.reparseOverscaled,isTerrainDEM:this.usedForTerrain});for(const te of Y)j.set(te.key,te);this.usedForTerrain&&H.updateElevation(!1)}const B=Array.from(j.values());i.bw(B,(H,Y)=>{const te=new Cp(H,this._source.tileSize*H.overscaleFactor(),this.transform.tileZoom,this.map.painter,this._isRaster,this._source.worldview);this._loadTile(te,de=>{this._source.type==="raster-dem"&&te.dem&&this._backfillDEM(te),Y(de,te)})},m)}}function Xy(w,d){const m=Math.abs(2*w.wrap)-+(w.wrap<0),j=Math.abs(2*d.wrap)-+(d.wrap<0);return w.overscaledZ-d.overscaledZ||j-m||d.canonical.y-w.canonical.y||d.canonical.x-w.canonical.x}function Af(w){return w==="raster"||w==="image"||w==="video"||w==="custom"}function Eu(w,d){const m=1<0:j.type==="building"?A=!j.isHidden(d)&&j.paint.get("building-opacity")>0:j.type==="model"&&(A=!j.isHidden(d)&&j.paint.get("model-opacity").constantOr(1)>0),this.layersGotHidden=this.layersGotHidden||!A&&m.visible,m.visible=A}}updateZOffset(d,m){this.currentBuildingBuckets=[];for(const A of this.layers){const O=A.layer,R=this.style.getLayerSourceCache(O);let B=1;O.type==="fill-extrusion"?B=A.visible?O.paint.get("fill-extrusion-vertical-scale"):0:O.type==="building"&&(B=A.visible?O.paint.get("building-vertical-scale"):0);let H=R?R.getTile(m):null;if(!H&&R)for(const Y in R._tiles){const te=R._tiles[Y];if(m.canonical.isChildOf(te.tileID.canonical)){H=te;break}}this.currentBuildingBuckets.push({bucket:H?H.getBucket(O):null,tileID:H?H.tileID:m,verticalScale:B})}d.hasAnyZOffset=!1;let j=!1;for(let A=0;A{j in d&&(m[j]=d[j])}),m}function cx(w){w=w.slice();const d=Object.create(null);for(let m=0;m0?(A-R)/B:0;return this.points[O].mult(1-H).add(this.points[m].mult(H))}}class ns{constructor(d,m,j){const A=this.boxCells=[],O=this.circleCells=[];this.xCellCount=Math.ceil(d/j),this.yCellCount=Math.ceil(m/j);for(let R=0;Rthis.width||A<0||m>this.height)return!O&&[];const B=[];if(d<=0&&m<=0&&this.width<=j&&this.height<=A){if(O)return!0;for(let H=0;H0:B}_queryCircle(d,m,j,A,O){const R=d-j,B=d+j,H=m-j,Y=m+j;if(B<0||R>this.width||Y<0||H>this.height)return!A&&[];const te=[];return this._forEachCell(R,H,B,Y,this._queryCellCircle,te,{hitTest:A,circle:{x:d,y:m,radius:j},seenUids:{box:{},circle:{}}},O),A?te.length>0:te}query(d,m,j,A,O){return this._query(d,m,j,A,!1,O)}hitTest(d,m,j,A,O){return this._query(d,m,j,A,!0,O)}hitTestCircle(d,m,j,A){return this._queryCircle(d,m,j,!0,A)}_queryCell(d,m,j,A,O,R,B,H){const Y=B.seenUids,te=this.boxCells[O];if(te!==null){const ce=this.bboxes;for(const ue of te)if(!Y.box[ue]){Y.box[ue]=!0;const je=4*ue;if(d<=ce[je+2]&&m<=ce[je+3]&&j>=ce[je+0]&&A>=ce[je+1]&&(!H||H(this.boxKeys[ue]))){if(B.hitTest)return R.push(!0),!0;R.push({key:this.boxKeys[ue],x1:ce[je],y1:ce[je+1],x2:ce[je+2],y2:ce[je+3]})}}}const de=this.circleCells[O];if(de!==null){const ce=this.circles;for(const ue of de)if(!Y.circle[ue]){Y.circle[ue]=!0;const je=3*ue;if(this._circleAndRectCollide(ce[je],ce[je+1],ce[je+2],d,m,j,A)&&(!H||H(this.circleKeys[ue]))){if(B.hitTest)return R.push(!0),!0;{const ve=ce[je],Re=ce[je+1],Le=ce[je+2];R.push({key:this.circleKeys[ue],x1:ve-Le,y1:Re-Le,x2:ve+Le,y2:Re+Le})}}}}}_queryCellCircle(d,m,j,A,O,R,B,H){const Y=B.circle,te=B.seenUids,de=this.boxCells[O];if(de!==null){const ue=this.bboxes;for(const je of de)if(!te.box[je]){te.box[je]=!0;const ve=4*je;if(this._circleAndRectCollide(Y.x,Y.y,Y.radius,ue[ve+0],ue[ve+1],ue[ve+2],ue[ve+3])&&(!H||H(this.boxKeys[je])))return R.push(!0),!0}}const ce=this.circleCells[O];if(ce!==null){const ue=this.circles;for(const je of ce)if(!te.circle[je]){te.circle[je]=!0;const ve=3*je;if(this._circlesCollide(ue[ve],ue[ve+1],ue[ve+2],Y.x,Y.y,Y.radius)&&(!H||H(this.circleKeys[je])))return R.push(!0),!0}}}_forEachCell(d,m,j,A,O,R,B,H){const Y=this._convertToXCellCoord(d),te=this._convertToYCellCoord(m),de=this._convertToXCellCoord(j),ce=this._convertToYCellCoord(A);for(let ue=Y;ue<=de;ue++)for(let je=te;je<=ce;je++)if(O.call(this,d,m,j,A,this.xCellCount*je+ue,R,B,H))return}_convertToXCellCoord(d){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(d*this.xScale)))}_convertToYCellCoord(d){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(d*this.yScale)))}_circlesCollide(d,m,j,A,O,R){const B=A-d,H=O-m,Y=j+R;return Y*Y>B*B+H*H}_circleAndRectCollide(d,m,j,A,O,R,B){const H=(R-A)/2,Y=Math.abs(d-(A+H));if(Y>H+j)return!1;const te=(B-O)/2,de=Math.abs(m-(O+te));if(de>te+j)return!1;if(Y<=H||de<=te)return!0;const ce=Y-H,ue=de-te;return ce*ce+ue*ue<=j*j}}const na={unknown:0,flipRequired:1,flipNotRequired:2},Is=Math.tan(85*Math.PI/180);function _a(w,d,m,j,A,O,R){const B=i.bC();if(m)if(O.name==="globe"){const H=i.bD(A,d);i.aB(B,B,H)}else{const H=i.bE([],R);B[0]=H[0],B[1]=H[1],B[4]=H[2],B[5]=H[3],j||i.bB(B,B,A.angle)}else i.aB(B,A.labelPlaneMatrix,w);return B}function $h(w,d,m,j,A,O,R){const B=_a(w,d,m,j,A,O,R);return O.name==="globe"&&m||(B[2]=B[6]=B[10]=B[14]=0),B}function cu(w,d,m,j,A,O,R){if(m){if(O.name==="globe"){const B=_a(w,d,m,j,A,O,R);return i.bl(B,B),i.aB(B,w,B),B}{const B=i.bz(w),H=i.bA([]);return H[0]=R[0],H[1]=R[1],H[4]=R[2],H[5]=R[3],i.aB(B,B,H),j||i.bB(B,B,-A.angle),B}}return A.glCoordMatrix}function El(w,d,m,j){const A=[w,d,m,1];m?i.aC(A,A,j):_n(A,A,j);const O=A[3];return A[0]/=O,A[1]/=O,A[2]/=O,A}function ba(w,d){return Math.min(.5+w/d*.5,1.5)}function Fk(w,d){const m=w[0]/w[3],j=w[1]/w[3];return m>=-d[0]&&m<=d[0]&&j>=-d[1]&&j<=d[1]}function TP(w,d,m,j,A,O,R,B,H,Y,te=1){const de=m.transform,ce=j?w.textSizeData:w.iconSizeData,ue=i.bK(ce,m.transform.zoom,te),je=de.projection.name==="globe",ve=[256/m.width*2+1,256/m.height*2+1],Re=j?w.text.dynamicLayoutVertexArray:w.icon.dynamicLayoutVertexArray;Re.clear();let Le=null;je&&(Le=j?w.text.globeExtVertexArray:w.icon.globeExtVertexArray);const We=w.lineVertexArray,rt=j?w.text.placedSymbolArray:w.icon.placedSymbolArray,Ke=m.transform.width/m.transform.height;let wt,mt=!1;for(let vt=0;vtMath.abs(m)?{useVertical:!0}:w===i.bL.vertical?j>0?{needsFlipping:!0}:null:d!==na.unknown&&function(A,O){return A===0||Math.abs(O/A)>Is}(m,j)?d===na.flipRequired?{needsFlipping:!0}:null:m<0?{needsFlipping:!0}:null}function e5(w,d,m,j,A,O,R,B,H,Y,te,de,ce,ue,je,ve,Re,Le,We,rt){const Ke=d/24,wt=w.lineOffsetX*Ke,mt=w.lineOffsetY*Ke,{lineStartIndex:vt,glyphStartIndex:pt,numGlyphs:ut,segment:St,writingMode:Dt,flipState:Ot}=w,Gt=vt+w.lineLength,Zt=ar=>{if(te){const[Jt,Ht,hr]=ar.up,Ar=Y.length;i.bN(te,Ar+0,Jt,Ht,hr),i.bN(te,Ar+1,Jt,Ht,hr),i.bN(te,Ar+2,Jt,Ht,hr),i.bN(te,Ar+3,Jt,Ht,hr)}const[br,Ut,Tt]=ar.point;i.bO(Y,br,Ut,Tt,ar.angle)};if(ut>1){const ar=AP(Ke,B,wt,mt,m,de,ce,w,H,O,ue,ve,!1,Re,Le,We,rt);if(!ar)return{notEnoughRoom:!0};if(j&&!m){let[br,Ut,Tt]=ar.first.point,[Jt,Ht,hr]=ar.last.point;[br,Ut]=El(br,Ut,Tt,R),[Jt,Ht]=El(Jt,Ht,hr,R);const Ar=zn(Dt,Ot,(Jt-br)*je,Ht-Ut);if(w.flipState=Ar&&Ar.needsFlipping?na.flipRequired:na.flipNotRequired,Ar)return Ar}Zt(ar.first);for(let br=pt+1;br0?Jt:oh(ce,Tt,br,1,A,void 0,Re,Le.canonical),hr=zn(Dt,Ot,(Ht[0]-br[0])*je,Ht[1]-br[1]);if(w.flipState=hr&&hr.needsFlipping?na.flipRequired:na.flipNotRequired,hr)return hr}const ar=Jy(Ke*B.getoffsetX(pt),wt,mt,m,de,ce,St,vt,Gt,H,O,ue,ve,!1,!1,Re,Le,We,rt);if(!ar)return{notEnoughRoom:!0};Zt(ar)}return{}}function Dv(w,d,m,j,A){const{x:O,y:R,z:B}=j.projectTilePoint(w.x,w.y,d);if(!A)return El(O,R,B,m);const[H,Y,te]=A.getElevation(w,A.elevation,A.elevationFeature);return El(O+H,R+Y,B+te,m)}function oh(w,d,m,j,A,O,R,B){const H=Dv(w.sub(d)._unit()._add(w),B,A,R,O);return i.av(H,m,H),i.aw(H,H),i.bH(H,m,H,j)}function Jy(w,d,m,j,A,O,R,B,H,Y,te,de,ce,ue,je,ve,Re,Le,We){const rt=j?w-d:w+d;let Ke=rt>0?1:-1,wt=0;j&&(Ke*=-1,wt=Math.PI),Ke<0&&(wt+=Math.PI);let mt=B+R+(Ke>0?0:1)|0,vt=A,pt=A,ut=0,St=0;const Dt=Math.abs(rt),Ot=[],Gt=[];let Zt=O,ar=Zt,br=i.bF([]);const Ut=()=>oh(ar,Zt,pt,Dt-ut+1,te,ce,ve,Re.canonical);for(;ut+St<=Dt;){if(mt+=Ke,mt=H)return null;if(pt=vt,ar=Zt,Ot.push(pt),ue&&Gt.push(ar),Zt=new i.P(Y.getx(mt),Y.gety(mt)),vt=de[mt],!vt){const rn=Dv(Zt,Re.canonical,te,ve,ce);vt=rn[3]>0?de[mt]=rn:Ut()}ut+=St;const wr=i.av([],vt,pt),cn=i.bG(pt,vt);if(m&&cn>0&&St>0&&i.bJ(br,wr)/(St*cn)0,rt),vt=Y*mt.perspectiveRatio,pt=(j.x1*m+B.x-j.padding)*vt+mt.point.x,ut=(j.y1*m+B.y-j.padding)*vt+mt.point.y,St=(j.x2*m+B.x+j.padding)*vt+mt.point.x,Dt=(j.y2*m+B.y+j.padding)*vt+mt.point.y,Ot=mt.perspectiveRatio<=.55||mt.occluded;return!this.isInsideGrid(pt,ut,St,Dt)||!H&&this.grid.hitTest(pt,ut,St,Dt,de)||Ot?{box:[],offscreen:!1,occluded:mt.occluded}:{box:[pt,ut,St,Dt],offscreen:this.isOffscreen(pt,ut,St,Dt),occluded:!1}}placeCollisionCircles(d,m,j,A,O,R,B,H,Y,te,de,ce,ue,je,ve,Re){const Le=[],We=this.transform.elevation,rt=d.getProjection(),Ke=d.elevationType==="road",wt=!!We||Ke,mt=i.bV.getAtTileOffsetFunc(Re,this.transform.center.lat,this.transform.worldSize,rt),vt=new i.P(j.tileAnchorX,j.tileAnchorY),pt=new i.P(j.tileAnchorX,j.tileAnchorY);let{x:ut,y:St,z:Dt}=rt.projectTilePoint(pt.x,pt.y,Re.canonical),Ot=null;if(wt){const cn=Ke?d.getElevationFeatureForText(A):null;Ot={getElevation:mt,elevation:We,elevationFeature:cn};const[rn,qr,Xr]=mt(vt,We,cn);ut+=rn,St+=qr,Dt+=Xr}const Gt=rt.name==="globe",Zt=this.projectAndGetPerspectiveRatio(H,ut,St,Dt,Re,Gt||!!We||this.transform.pitch>0,rt),{perspectiveRatio:ar}=Zt,br=(ce?B/ar:B*ar)/i.bY,Ut=El(ut,St,Dt,Y),Tt=j.lineOffsetX*br,Jt=j.lineOffsetY*br,Ht=i.an(d.layers[0].layout.get("text-max-angle")),hr=Math.cos(Ht),Ar=Zt.signedDistanceFromCamera>0?AP(br,R,Tt,Jt,Ke&&j.flipState===1,Ut,pt,j,O,Y,{},wt&&!ce?Ot:null,ce&&wt,rt,Re,ce,hr):null;let Kr=!1,Sr=!1,wr=!0;if(Ar&&!Zt.occluded){const cn=.5*je*ar+ve,rn=new i.P(-100,-100),qr=new i.P(this.screenRightBoundary,this.screenBottomBoundary),Xr=new rs,{first:Cn,last:ts}=Ar,Us=Cn.path.length;let wa=[];for(let Yn=Us-1;Yn>=1;Yn--)wa.push(Cn.path[Yn]);for(let Yn=1;Yn(wt&&!Gt&&(qa=mt(OaYn[3]<=0)&&(wa=[]));let fa=[];if(wa.length>0){let Yn=1/0,Ca=-1/0,qa=1/0,Oa=-1/0;for(const ha of wa)Yn=Math.min(Yn,ha[0]),qa=Math.min(qa,ha[1]),Ca=Math.max(Ca,ha[0]),Oa=Math.max(Oa,ha[1]);Ca>=rn.x&&Yn<=qr.x&&Oa>=rn.y&&qa<=qr.y&&(fa=[wa.map(ha=>new i.P(ha[0],ha[1]))],(Ynqr.x||qaqr.y)&&(fa=i.bW(fa,rn.x,rn.y,qr.x,qr.y)))}for(const Yn of fa){Xr.reset(Yn,.25*cn);let Ca=0;Ca=Xr.length<=.5*cn?1:Math.ceil(Xr.paddedLength/hn)+1;for(let qa=0;qa0?(i.aC(H,H,d),this.fogState&&O&&B.name!=="globe"&&(Y=function(ce,ue,je,ve,Re,Le){const We=Le.calculateFogTileMatrix(Re),rt=[ue,je,ve];return i.af(rt,rt,We),Yr(ce,i.ag(rt),Le.pitch,Le._fov)}(this.fogState,m,j,A,O.toUnwrapped(),this.transform)>.9)):_n(H,H,d);const te=H[3];return{point:new i.P((H[0]/te+1)/2*this.transform.width+sa,(-H[1]/te+1)/2*this.transform.height+sa),perspectiveRatio:Math.min(.5+this.transform.getCameraToCenterDistance(B)/te*.5,1.5),signedDistanceFromCamera:te,occluded:R&&H[2]>te||Y}}isOffscreen(d,m,j,A){return j=this.screenRightBoundary||Athis.screenBottomBoundary}isInsideGrid(d,m,j,A){return j>=0&&d=0&&mj.collisionGroupID===m}}return this.collisionGroups[d]}}function Ac(w,d,m,j,A){const{horizontalAlign:O,verticalAlign:R}=i.c1(w),B=-(O-.5)*d,H=-(R-.5)*m,Y=i.c2(w,j);return new i.P(B+Y[0]*A,H+Y[1]*A)}function Oo(w,d,m,j,A){const O=new i.P(w,d);return m&&O._rotate(j?A:-A),O}class zie{constructor(d,m,j,A,O,R){this.transform=d.clone(),this.projection=d.projection.name,this.collisionIndex=new Ua(this.transform,O),this.buildingIndex=R,this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=m,this.retainedQueryData={},this.collisionGroups=new Fv(j),this.collisionCircleArrays={},this.prevPlacement=A,A&&(A.prevPlacement=void 0),this.placedOrientations={},this.lastReplacementSourceUpdateTime=0}getBucketParts(d,m,j,A,O=1){const R=j.getBucket(m),B=j.latestFeatureIndex;if(!R||!B||m.fqid!==R.layerIds[0])return;const H=R.layers[0].layout,Y=R.layers[0].paint,te=j.collisionBoxArray,de=Math.pow(2,this.transform.zoom-j.tileID.overscaledZ),ce=j.tileSize/i.al,ue=j.tileID.toUnwrapped();this.transform.setProjection(R.projection);const je=(ve=j.tileID,Re=R.getProjection(),Le=this.transform,Re.name===this.projection?Le.calculateProjMatrix(ve.toUnwrapped()):jt(Le,Re,ve));var ve,Re,Le;const We=H.get("text-pitch-alignment")==="map",rt=H.get("text-rotation-alignment")==="map";m.compileFilter(m.options);const Ke=m.dynamicFilter(),wt=m.dynamicFilterNeedsFeature(),mt=this.transform.calculatePixelsToTileUnitsMatrix(j),vt=$h(je,j.tileID.canonical,We,rt,this.transform,R.getProjection(),mt);let pt=null;const ut=R.getProjection().createInversionMatrix(this.transform,j.tileID.canonical);if(We){const Tt=cu(je,j.tileID.canonical,We,rt,this.transform,R.getProjection(),mt);pt=i.aB([],this.transform.labelPlaneMatrix,Tt)}let St=null;Ke&&j.latestFeatureIndex&&(St={unwrappedTileID:ue,dynamicFilter:Ke,dynamicFilterNeedsFeature:wt}),this.retainedQueryData[R.bucketInstanceId]=new Rv(R.bucketInstanceId,B,R.sourceLayerIndex,R.index,j.tileID);const[Dt,Ot]=R.layers[0].layout.get("text-size-scale-range"),Gt=i.aA(O,Dt,Ot),[Zt,ar]=H.get("icon-size-scale-range"),br=i.aA(O,Zt,ar),Ut={bucket:R,layout:H,paint:Y,posMatrix:je,invMatrix:ut,mercatorCenter:[i.aF(this.transform.center.lng),i.aJ(this.transform.center.lat)],textLabelPlaneMatrix:vt,labelToScreenMatrix:pt,clippingData:St,scale:de,textPixelRatio:ce,holdingForFade:j.holdingForFade(),collisionBoxArray:te,partiallyEvaluatedTextSize:i.bK(R.textSizeData,this.transform.zoom,Gt),partiallyEvaluatedIconSize:i.bK(R.iconSizeData,this.transform.zoom,br),collisionGroup:this.collisionGroups.get(R.sourceID),latestFeatureIndex:j.latestFeatureIndex};if(A)for(const Tt of R.sortKeyRanges){const{sortKey:Jt,symbolInstanceStart:Ht,symbolInstanceEnd:hr}=Tt;d.push({sortKey:Jt,symbolInstanceStart:Ht,symbolInstanceEnd:hr,parameters:Ut})}else d.push({symbolInstanceStart:0,symbolInstanceEnd:R.symbolInstances.length,parameters:Ut})}attemptAnchorPlacement(d,m,j,A,O,R,B,H,Y,te,de,ce,ue,je,ve,Re,Le,We,rt,Ke,wt){const{textOffset0:mt,textOffset1:vt,crossTileID:pt}=ve,ut=[mt,vt],St=Ac(d,R,B,ut,H),Dt=this.collisionIndex.placeCollisionBox(Le,H,m,j,A,O,Oo(St.x,St.y,Y,te,this.transform.angle),je,de,ce,ue.predicate);if(rt){const Ot=Le.getSymbolInstanceIconSize(wt,this.transform.zoom,ve.placedIconSymbolIndex);if(this.collisionIndex.placeCollisionBox(Le,Ot,rt,j,A,O,Oo(St.x,St.y,Y,te,this.transform.angle),je,de,ce,ue.predicate).box.length===0)return}if(Dt.box.length>0){let Ot;return this.prevPlacement&&this.prevPlacement.variableOffsets[pt]&&this.prevPlacement.placements[pt]&&this.prevPlacement.placements[pt].text&&(Ot=this.prevPlacement.variableOffsets[pt].anchor),this.variableOffsets[pt]={textOffset:ut,width:R,height:B,anchor:d,textScale:H,prevAnchor:Ot},this.markUsedJustification(Le,d,ve,We),Le.allowVerticalPlacement&&(this.markUsedOrientation(Le,We,ve),this.placedOrientations[pt]=We),{shift:St,placedGlyphBoxes:Dt}}}placeLayerBucketPart(d,m,j,A,O=1){const{bucket:R,layout:B,paint:H,posMatrix:Y,textLabelPlaneMatrix:te,labelToScreenMatrix:de,clippingData:ce,textPixelRatio:ue,mercatorCenter:je,invMatrix:ve,holdingForFade:Re,collisionBoxArray:Le,partiallyEvaluatedTextSize:We,partiallyEvaluatedIconSize:rt,collisionGroup:Ke,latestFeatureIndex:wt}=d.parameters,mt=B.get("text-optional"),vt=B.get("icon-optional"),pt=B.get("text-allow-overlap"),ut=B.get("icon-allow-overlap"),St=B.get("text-rotation-alignment")==="map",Dt=B.get("icon-rotation-alignment")==="map",Ot=B.get("text-pitch-alignment")==="map",Gt=H.get("symbol-z-offset"),Zt=B.get("symbol-elevation-reference")==="sea",ar=B.get("symbol-placement"),[br,Ut]=B.get("text-size-scale-range"),[Tt,Jt]=B.get("icon-size-scale-range"),Ht=i.aA(O,br,Ut),hr=i.aA(O,Tt,Jt),Ar=B.get("text-variable-anchor"),Kr=St&&ar!=="point",Sr=Dt&&ar!=="point",wr=Ar&&R.hasTextData(),cn=R.hasIconTextFit()&&wr&&R.hasIconData();this.transform.setProjection(R.projection);const rn=wr||Kr,qr=Sr||cn;let Xr=pt&&(ut||!R.hasIconData()||vt),Cn=ut&&(pt||!R.hasTextData()||mt);const ts=!Gt.isConstant();!R.collisionArrays&&Le&&R.deserializeCollisionBoxes(Le),j&&A&&R.updateCollisionDebugBuffers(this.transform.zoom,Le,Ht,hr);const Us=(hn,fa,Yn)=>{const{crossTileID:Ca,numVerticalGlyphVertices:qa}=hn;let Oa=null;if(ce&&ce.dynamicFilterNeedsFeature||ts){const eo=this.retainedQueryData[R.bucketInstanceId];Oa=wt.loadFeature({featureIndex:hn.featureIndex,bucketIndex:eo.bucketIndex,sourceLayerIndex:eo.sourceLayerIndex,layoutVertexArrayOffset:0});const xo=Oa.properties?Oa.properties.worldview:null;if(R.localizable&&R.worldview&&typeof xo=="string")if(xo==="all")Oa.properties.$localized=!0;else{if(!xo.split(",").includes(R.worldview))return;Oa.properties.$localized=!0,Oa.properties.worldview=R.worldview}}if(ce&&!(0,ce.dynamicFilter)({zoom:this.transform.zoom,pitch:this.transform.pitch,worldview:R.worldview},Oa,this.retainedQueryData[R.bucketInstanceId].tileID.canonical,new i.P(hn.tileAnchorX,hn.tileAnchorY),this.transform.calculateDistanceTileData(ce.unwrappedTileID)))return this.placements[Ca]=new Pa(!1,!1,!1,!0),void m.add(Ca);const ha=Gt.evaluate(Oa,{});if(m.has(Ca))return;if(Re)return void(this.placements[Ca]=new Pa(!1,!1,!1));let fs=!1,Na=!1,Ki=!0,ji=!1,Ma=!1,ia=null,ps={box:null,offscreen:null,occluded:null},fi={box:null},uo=null,qi=null,Xa=null,kd=0,pc=0,el=0;Yn.textFeatureIndex?kd=Yn.textFeatureIndex:hn.useRuntimeCollisionCircles&&(kd=hn.featureIndex),Yn.verticalTextFeatureIndex&&(pc=Yn.verticalTextFeatureIndex);const Ic=R.elevationFeatures?R.elevationFeatures[hn.elevationFeatureIndex]:void 0,Pc=eo=>{eo.tileID=this.retainedQueryData[R.bucketInstanceId].tileID;const xo=this.transform.elevation;eo.elevation=Zt?ha:ha+i.bV.getAtTileOffset(eo.tileID,new i.P(eo.tileAnchorX,eo.tileAnchorY),xo,Ic),eo.elevation+=hn.zOffset},Gl=Yn.textBox;if(Gl){Pc(Gl);const eo=Qa=>{let So=i.bL.horizontal;if(R.allowVerticalPlacement&&!Qa&&this.prevPlacement){const Zi=this.prevPlacement.placedOrientations[Ca];Zi&&(this.placedOrientations[Ca]=Zi,So=Zi,this.markUsedOrientation(R,So,hn))}return So},xo=(Qa,So)=>{if(R.allowVerticalPlacement&&qa>0&&Yn.verticalTextBox){for(const Zi of R.writingModes)if(Zi===i.bL.vertical?(ps=So(),fi=ps):ps=Qa(),ps&&ps.box&&ps.box.length)break}else ps=Qa()};if(Ar){let Qa=Ar;if(this.prevPlacement&&this.prevPlacement.variableOffsets[Ca]){const Vi=this.prevPlacement.variableOffsets[Ca];Qa.indexOf(Vi.anchor)>0&&(Qa=Qa.filter(mh=>mh!==Vi.anchor),Qa.unshift(Vi.anchor))}const So=(Vi,mh,h_)=>{const Kh=R.getSymbolInstanceTextSize(We,hn,this.transform.zoom,fa),f_=(Vi.x2-Vi.x1)*Kh+2*Vi.padding,j0=(Vi.y2-Vi.y1)*Kh+2*Vi.padding,$f=hn.hasIconTextFit&&!ut?mh:null;$f&&Pc($f);let Up={box:[],offscreen:!1,occluded:!1};const k0=pt?2*Qa.length:Qa.length;for(let cg=0;cg=Qa.length,hn,fa,R,h_,$f,We,rt);if(qp&&(Up=qp.placedGlyphBoxes,Up&&Up.box&&Up.box.length)){fs=!0,ia=qp.shift;break}}return Up};xo(()=>So(Gl,Yn.iconBox,i.bL.horizontal),()=>{const Vi=Yn.verticalTextBox;return Vi&&Pc(Vi),R.allowVerticalPlacement&&!(ps&&ps.box&&ps.box.length)&&qa>0&&Vi?So(Vi,Yn.verticalIconBox,i.bL.vertical):{box:null,offscreen:null,occluded:null}}),ps&&(fs=ps.box,Ki=ps.offscreen,ji=ps.occluded);const Zi=eo(!(!ps||!ps.box));if(!fs&&this.prevPlacement){const Vi=this.prevPlacement.variableOffsets[Ca];Vi&&(this.variableOffsets[Ca]=Vi,this.markUsedJustification(R,Vi.anchor,hn,Zi))}}else{const Qa=(So,Zi)=>{const Vi=R.getSymbolInstanceTextSize(We,hn,this.transform.zoom,fa),mh=this.collisionIndex.placeCollisionBox(R,Vi,So,je,ve,rn,new i.P(0,0),pt,ue,Y,Ke.predicate);return mh&&mh.box&&mh.box.length&&(this.markUsedOrientation(R,Zi,hn),this.placedOrientations[Ca]=Zi),mh};xo(()=>Qa(Gl,i.bL.horizontal),()=>{const So=Yn.verticalTextBox;return R.allowVerticalPlacement&&qa>0&&So?(Pc(So),Qa(So,i.bL.vertical)):{box:null,offscreen:null,occluded:null}}),eo(!!(ps&&ps.box&&ps.box.length))}}if(uo=ps,fs=uo&&uo.box&&uo.box.length>0,Ki=uo&&uo.offscreen,ji=uo&&uo.occluded,hn.useRuntimeCollisionCircles){const eo=hn.centerJustifiedTextSymbolIndex>=0?hn.centerJustifiedTextSymbolIndex:hn.verticalPlacedTextSymbolIndex,xo=R.text.placedSymbolArray.get(eo),Qa=i.bM(R.textSizeData,We,xo),So=B.get("text-padding");qi=this.collisionIndex.placeCollisionCircles(R,pt,xo,eo,R.lineVertexArray,R.glyphOffsetArray,Qa,Y,te,de,j,Ot,Ke.predicate,hn.collisionCircleDiameter*Qa/i.bY,So,this.retainedQueryData[R.bucketInstanceId].tileID),fs=pt||qi.circles.length>0&&!qi.collisionDetected,Ki=Ki&&qi.offscreen,ji=qi.occluded}if(Yn.iconFeatureIndex&&(el=Yn.iconFeatureIndex),Yn.iconBox){const eo=xo=>{Pc(xo);const Qa=hn.hasIconTextFit&&ia?Oo(ia.x,ia.y,St,Ot,this.transform.angle):new i.P(0,0),So=R.getSymbolInstanceIconSize(rt,this.transform.zoom,hn.placedIconSymbolIndex);return this.collisionIndex.placeCollisionBox(R,So,xo,je,ve,qr,Qa,ut,ue,Y,Ke.predicate)};fi&&fi.box&&fi.box.length&&Yn.verticalIconBox?(Xa=eo(Yn.verticalIconBox),Na=Xa.box.length>0):(Xa=eo(Yn.iconBox),Na=Xa.box.length>0),Ki=Ki&&Xa.offscreen,Ma=Xa.occluded}const Du=mt||hn.numHorizontalGlyphVertices===0&&qa===0,ph=vt||hn.numIconVertices===0;if(Du||ph?ph?Du||(Na=Na&&fs):fs=Na&&fs:Na=fs=Na&&fs,fs&&uo&&uo.box&&this.collisionIndex.insertCollisionBox(uo.box,B.get("text-ignore-placement"),R.bucketInstanceId,fi&&fi.box&&pc?pc:kd,Ke.ID),Na&&Xa&&this.collisionIndex.insertCollisionBox(Xa.box,B.get("icon-ignore-placement"),R.bucketInstanceId,el,Ke.ID),qi&&(fs&&this.collisionIndex.insertCollisionCircles(qi.circles,B.get("text-ignore-placement"),R.bucketInstanceId,kd,Ke.ID),j)){const eo=R.bucketInstanceId;let xo=this.collisionCircleArrays[eo];xo===void 0&&(xo=this.collisionCircleArrays[eo]=new zk);for(let Qa=0;Qa=0;--fa){const Yn=hn[fa];Us(R.symbolInstances.get(Yn),Yn,R.collisionArrays[Yn])}R.hasAnyZOffset&&i.w(`${R.layerIds[0]} layer symbol-z-elevate: symbols are not sorted by elevation if symbol-z-order is evaluated to viewport-y`)}else if(R.hasAnyZOffset){const hn=R.getSortedIndexesByZOffset();for(let fa=0;fa=0&&(d.text.placedSymbolArray.get(O).crossTileID=de>=0&&O!==de?0:Y),R>=0&&(d.text.placedSymbolArray.get(R).crossTileID=de>=0&&R!==de?0:Y),B>=0&&(d.text.placedSymbolArray.get(B).crossTileID=de>=0&&B!==de?0:Y),H>=0&&(d.text.placedSymbolArray.get(H).crossTileID=de>=0&&H!==de?0:Y)}markUsedOrientation(d,m,j){const A=m===i.bL.horizontal||m===i.bL.horizontalOnly?m:0,O=m===i.bL.vertical?m:0,{leftJustifiedTextSymbolIndex:R,centerJustifiedTextSymbolIndex:B,rightJustifiedTextSymbolIndex:H,verticalPlacedTextSymbolIndex:Y}=j,te=d.text.placedSymbolArray;R>=0&&(te.get(R).placedOrientation=A),B>=0&&(te.get(B).placedOrientation=A),H>=0&&(te.get(H).placedOrientation=A),Y>=0&&(te.get(Y).placedOrientation=O)}commit(d){this.commitTime=d,this.zoomAtLastRecencyCheck=this.transform.zoom;const m=this.prevPlacement;let j=!1;this.prevZoomAdjustment=m?m.zoomAdjustment(this.transform.zoom):0;const A=m?m.symbolFadeChange(d):1,O=m?m.opacities:{},R=m?m.variableOffsets:{},B=m?m.placedOrientations:{};for(const H in this.placements){const Y=this.placements[H],te=O[H];te?(this.opacities[H]=new If(te,A,Y.text,Y.icon,null,Y.clipped),j=j||Y.text!==te.text.placed||Y.icon!==te.icon.placed):(this.opacities[H]=new If(null,A,Y.text,Y.icon,Y.skipFade,Y.clipped),j=j||Y.text||Y.icon)}for(const H in O){const Y=O[H];if(!this.opacities[H]){const te=new If(Y,A,!1,!1);te.isHidden()||(this.opacities[H]=te,j=j||Y.text.placed||Y.icon.placed)}}for(const H in R)this.variableOffsets[H]||!this.opacities[H]||this.opacities[H].isHidden()||(this.variableOffsets[H]=R[H]);for(const H in B)this.placedOrientations[H]||!this.opacities[H]||this.opacities[H].isHidden()||(this.placedOrientations[H]=B[H]);j?this.lastPlacementChangeTime=d:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=m?m.lastPlacementChangeTime:d)}updateLayerOpacities(d,m,j,A){A&&(this.lastReplacementSourceUpdateTime=A.updateTime);const O=new Set;for(const R of m){const B=R.getBucket(d);B&&R.latestFeatureIndex&&d.fqid===B.layerIds[0]&&(this.updateBucketOpacities(B,O,R,R.collisionBoxArray,j,A,R.tileID,d.scope),B.elevationType==="offset"&&this.buildingIndex&&this.buildingIndex.updateZOffset(B,R.tileID),B.elevationType==="road"&&B.updateRoadElevation(R.tileID.canonical),B.updateZOffset())}}updateBucketOpacities(d,m,j,A,O,R,B,H){d.hasTextData()&&d.text.opacityVertexArray.clear(),d.hasIconData()&&d.icon.opacityVertexArray.clear(),d.hasIconCollisionBoxData()&&d.iconCollisionBox.collisionVertexArray.clear(),d.hasTextCollisionBoxData()&&d.textCollisionBox.collisionVertexArray.clear();const Y=d.layers[0].layout,te=d.layers[0].paint,de=!!d.layers[0].dynamicFilter(),ce=new If(null,0,!1,!1,!0),ue=Y.get("text-allow-overlap"),je=Y.get("icon-allow-overlap"),ve=Y.get("text-variable-anchor"),Re=Y.get("text-rotation-alignment")==="map",Le=Y.get("text-pitch-alignment")==="map",We=te.get("symbol-z-offset"),rt=Y.get("symbol-elevation-reference")==="sea",Ke=!We.isConstant(),wt=new If(null,0,ue&&(je||!d.hasIconData()||Y.get("icon-optional")),je&&(ue||!d.hasTextData()||Y.get("text-optional")),!0);!d.collisionArrays&&A&&(d.hasIconCollisionBoxData()||d.hasTextCollisionBoxData())&&d.deserializeCollisionBoxes(A);const mt=(pt,ut,St)=>{for(let Dt=0;Dt0||Dt>0,Ar=Gt>0,Kr=this.placedOrientations[Ot],Sr=Kr===i.bL.vertical,wr=Kr===i.bL.horizontal||Kr===i.bL.horizontalOnly;!hr&&!Ar||Ht.isHidden()||vt++;let cn=!1;if((hr||Ar)&&R)for(const rn of d.activeReplacements){if(i.bZ(rn,O,i.b_.Symbol,H)||rn.min.x>Zt||Zt>rn.max.x||rn.min.y>ar||ar>rn.max.y)continue;const qr=i.b$(Zt,ar,B.canonical,rn.footprintTileId.canonical);if(cn=i.c0(qr,rn.footprint),cn)break}if(hr){const rn=cn?ux:_d(Ht.text);mt(d.text,St,Sr?ux:rn),mt(d.text,Dt,wr?ux:rn);const qr=Ht.text.isHidden(),{leftJustifiedTextSymbolIndex:Xr,centerJustifiedTextSymbolIndex:Cn,rightJustifiedTextSymbolIndex:ts,verticalPlacedTextSymbolIndex:Us}=ut,wa=d.text.placedSymbolArray,hn=qr||Sr?1:0;Xr>=0&&(wa.get(Xr).hidden=hn),Cn>=0&&(wa.get(Cn).hidden=hn),ts>=0&&(wa.get(ts).hidden=hn),Us>=0&&(wa.get(Us).hidden=qr||wr?1:0);const fa=this.variableOffsets[Ot];fa&&this.markUsedJustification(d,fa.anchor,ut,Kr);const Yn=this.placedOrientations[Ot];Yn&&(this.markUsedJustification(d,"left",ut,Yn),this.markUsedOrientation(d,Yn,ut))}if(Ar){const rn=cn?ux:_d(Ht.icon),{placedIconSymbolIndex:qr,verticalPlacedIconSymbolIndex:Xr}=ut,Cn=d.icon.placedSymbolArray,ts=Ht.icon.isHidden()?1:0;qr>=0&&(mt(d.icon,Gt,Sr?ux:rn),Cn.get(qr).hidden=ts),Xr>=0&&(mt(d.icon,ut.numVerticalIconVertices,wr?ux:rn),Cn.get(Xr).hidden=ts)}if(d.hasIconCollisionBoxData()||d.hasTextCollisionBoxData()){const rn=d.collisionArrays[pt];if(rn){let qr=new i.P(0,0),Xr=!0;if(rn.textBox||rn.verticalTextBox){if(ve){const ts=this.variableOffsets[Ot];ts?(qr=Ac(ts.anchor,ts.width,ts.height,ts.textOffset,ts.textScale),Re&&qr._rotate(Le?this.transform.angle:-this.transform.angle)):Xr=!1}de&&(Xr=!Ht.clipped),rn.textBox&&Km(d.textCollisionBox.collisionVertexArray,Ht.text.placed,!Xr||Sr,Tt,rt,qr.x,qr.y),rn.verticalTextBox&&Km(d.textCollisionBox.collisionVertexArray,Ht.text.placed,!Xr||wr,Tt,rt,qr.x,qr.y)}const Cn=Xr&&!!(!wr&&rn.verticalIconBox);rn.iconBox&&Km(d.iconCollisionBox.collisionVertexArray,Ht.icon.placed,Cn,Tt,rt,ut.hasIconTextFit?qr.x:0,ut.hasIconTextFit?qr.y:0),rn.verticalIconBox&&Km(d.iconCollisionBox.collisionVertexArray,Ht.icon.placed,!Cn,Tt,rt,ut.hasIconTextFit?qr.x:0,ut.hasIconTextFit?qr.y:0)}}}if(d.fullyClipped=vt===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 pt=this.collisionCircleArrays[d.bucketInstanceId];d.placementInvProjMatrix=pt.invProjMatrix,d.placementViewportMatrix=pt.viewportMatrix,d.collisionCircleArray=pt.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 Km(w,d,m,j,A,O,R){w.emplaceBack(d?1:0,m?1:0,O||0,R||0,j,A?1:0),w.emplaceBack(d?1:0,m?1:0,O||0,R||0,j,A?1:0),w.emplaceBack(d?1:0,m?1:0,O||0,R||0,j,A?1:0),w.emplaceBack(d?1:0,m?1:0,O||0,R||0,j,A?1:0)}const t5=Math.pow(2,25),zv=Math.pow(2,24),Bk=Math.pow(2,17),r5=Math.pow(2,16),$k=Math.pow(2,9),vd=Math.pow(2,8),Tp=Math.pow(2,1);function _d(w){if(w.opacity===0&&!w.placed)return 0;if(w.opacity===1&&w.placed)return 4294967295;const d=w.placed?1:0,m=Math.floor(127*w.opacity);return m*t5+d*zv+m*Bk+d*r5+m*$k+d*vd+m*Tp+d}const ux=0;class e0{constructor(d){this._sortAcrossTiles=d.layout.get("symbol-z-order")!=="viewport-y"&&d.layout.get("symbol-sort-key").constantOr(1)!==void 0,this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs=new Set,this._bucketParts=[]}continuePlacement(d,m,j,A,O,R){const B=this._bucketParts;for(;this._currentTileIndexH.sortKey-Y.sortKey));this._currentPartIndex{const H=i.o.now()-R;return!this._forceFullPlacement&&H>2};for(;this._currentPlacementIndex>=0;){const H=m[d[this._currentPlacementIndex]],Y=this.placement.collisionIndex.transform.zoom;if(H.type==="symbol"&&H.visibility!=="none"&&(!H.minzoom||H.minzoom<=Y)&&(!H.maxzoom||H.maxzoom>Y)){const te=H,de=te.layout.get("symbol-z-elevate"),ce=te.layout.get("symbol-sort-key").constantOr(1)!==void 0,ue=te.layout.get("symbol-z-order"),je=ue==="viewport-y"||ue==="auto"&&!(ue!=="viewport-y"&&ce),ve=te.layout.get("text-allow-overlap")||te.layout.get("icon-allow-overlap")||te.layout.get("text-ignore-placement")||te.layout.get("icon-ignore-placement"),Re=je&&ve,Le=this._inProgressLayer=this._inProgressLayer||new e0(te),We=i.B(H.source,H.scope);if(Le.continuePlacement(de||Re?A[We]:j[We],this.placement,this._showCollisionBoxes,H,B,O))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(d){return this.placement.commit(d),this.placement}}const lh=512/i.al/2;class Ap{constructor(d,m,j){this.tileID=d,this.bucketInstanceId=j,this.index=new i.c4(m.length,16,Int32Array),this.keys=[],this.crossTileIDs=[];const A=d.canonical.x*i.al,O=d.canonical.y*i.al;for(let R=0;RRe-Le);for(const Re of ve){const Le=this.crossTileIDs[Re];if(this.keys[Re]===te&&!j.has(Le)){j.add(Le),Y.crossTileID=Le;break}}}}}class dl{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class n5{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(d){const m=Math.round((d-this.lng)/360);if(m!==0)for(const j in this.indexes){const A=this.indexes[j],O={};for(const R in A){const B=A[R];B.tileID=B.tileID.unwrapTo(B.tileID.wrap+m),O[B.tileID.key]=B}this.indexes[j]=O}this.lng=d}addBucket(d,m,j){if(this.indexes[d.overscaledZ]&&this.indexes[d.overscaledZ][d.key]){if(this.indexes[d.overscaledZ][d.key].bucketInstanceId===m.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(d.overscaledZ,this.indexes[d.overscaledZ][d.key])}for(let O=0;Od.overscaledZ)for(const B in R){const H=R[B];H.tileID.isChildOf(d)&&H.findMatches(m.symbolInstances,d,A)}else{const B=R[d.scaledTo(Number(O)).key];B&&B.findMatches(m.symbolInstances,d,A)}}for(let O=0;O{m[j]=!0});for(const j in this.layerIndexes)m[j]||delete this.layerIndexes[j]}}const Pf=771;class us{constructor(d,m,j,A){this.blendFunction=d,this.blendColor=m.toNonPremultipliedRenderColor(null),this.mask=j,this.blendEquation=A}}us.Replace=[1,0,1,0],us.disabled=new us(us.Replace,i.ao.transparent,[!1,!1,!1,!1]),us.unblended=new us(us.Replace,i.ao.transparent,[!0,!0,!0,!0]),us.alphaBlended=new us([1,Pf,1,Pf],i.ao.transparent,[!0,!0,!0,!0]),us.alphaBlendedNonPremultiplied=new us([770,Pf,770,Pf],i.ao.transparent,[!0,!0,!0,!0]),us.multiply=new us([774,0,774,0],i.ao.transparent,[!0,!0,!0,!0]),us.additive=new us([1,1,1,1],i.ao.transparent,[!0,!0,!0,!0]);class gn{constructor(d,m,j){this.func=d,this.mask=m,this.range=j}}gn.ReadOnly=!1,gn.ReadWrite=!0,gn.disabled=new gn(519,gn.ReadOnly,[0,1]);const Uk=7680;class Vn{constructor(d,m,j,A,O,R){this.test=d,this.ref=m,this.mask=j,this.fail=A,this.depthFail=O,this.pass=R}}Vn.disabled=new Vn({func:519,mask:0},0,0,Uk,Uk,Uk);const t0=1029,qk=2305;class $n{constructor(d,m,j){this.enable=d,this.mode=m,this.frontFace=j}}function Lf(w,d){const m=i.ca(w,3);i.cc(w,d),i.cg(w,3,m)}function s5(w,d){const m=i.c7([]);return i.c8(m,m,-d),i.c9(m,m,-w),m}function Vk(w,d){const m=[w[0],w[1],0],j=[d[0],d[1],0];if(i.ag(m)>=1e-15){const R=i.aw([],m);i.c5(j,R,i.bJ(j,R)),d[0]=j[0],d[1]=j[1]}const A=i.bI([],d,w);if(i.c6(A)<1e-15)return null;const O=Math.atan2(-A[1],A[0]);return s5(Math.atan2(Math.sqrt(w[0]*w[0]+w[1]*w[1]),-w[2]),O)}$n.disabled=new $n(!1,t0,qk),$n.backCCW=new $n(!0,t0,qk),$n.backCW=new $n(!0,t0,2304),$n.frontCW=new $n(!0,1028,2304),$n.frontCCW=new $n(!0,1028,qk);class bd{constructor(d,m){this.position=d,this.orientation=m}get position(){return this._position}set position(d){if(d){const m=d instanceof i.ae?d:new i.ae(d[0],d[1],d[2]);this._renderWorldCopies&&(m.x=i.bT(m.x,0,1)),this._position=m}else this._position=null}lookAtPoint(d,m,j){if(this.orientation=null,!this.position)return;const A=this.position,O=j||(this._elevation?this._elevation.getAtPointOrZero(i.ae.fromLngLat(d)):0),R=i.ae.fromLngLat(d,O),B=[R.x-A.x,R.y-A.y,R.z-A.z];m||(m=[0,0,1]),m[2]=Math.abs(m[2]),this.orientation=Vk(B,m)}setPitchBearing(d,m){this.orientation=s5(i.an(d),i.an(-m))}}class Hk{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&&Lf(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=s5(d,m),Lf(this._transform,this._orientation)}forward(){const d=i.ca(this._transform,2);return[-d[0],-d[1],-d[2]]}up(){const d=i.ca(this._transform,1);return[-d[0],-d[1],-d[2]]}right(){const d=i.ca(this._transform,0);return[d[0],d[1],d[2]]}getCameraToWorld(d,m){const j=new Float64Array(16);return i.bl(j,this.getWorldToCamera(d,m)),j}getCameraToWorldMercator(){return this._transform}getWorldToCameraPosition(d,m,j){const A=this.position;i.c5(A,A,-d);const O=new Float64Array(16);return i.bq(O,[j,j,j]),i.br(O,O,A),O[10]*=m,O}getWorldToCamera(d,m){const j=new Float64Array(16),A=new Float64Array(4),O=this.position;return i.cb(A,this._orientation),i.c5(O,O,-d),i.cc(j,A),i.br(j,j,O),j[1]*=-1,j[5]*=-1,j[9]*=-1,j[13]*=-1,j[8]*=m,j[9]*=m,j[10]*=m,j[11]*=m,j}getCameraToClipPerspective(d,m,j,A){const O=new Float64Array(16);return i.cd(O,d,m,j,A),O}getCameraToClipOrthographic(d,m,j,A,O,R){const B=new Float64Array(16);return i.ce(B,d,m,j,A,O,R),B}getDistanceToElevation(d,m=!1){const j=d===0?0:i.cf(d,m?i.a$(this.position[1]):this.position[1]),A=this.forward();return(j-this.position[2])/A[2]}clone(){return new Hk([...this.position],[...this.orientation])}}const Il={BaseColor:5,MetallicRoughness:6,Normal:7,Occlusion:8,Emission:9,LUT:10,ShadowMap0:11};class Wk{constructor(d=0,m=0,j=0,A=0){if(isNaN(d)||d<0||isNaN(m)||m<0||isNaN(j)||j<0||isNaN(A)||A<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=d,this.bottom=m,this.left=j,this.right=A}interpolate(d,m,j){return m.top!=null&&d.top!=null&&(this.top=i.ak(d.top,m.top,j)),m.bottom!=null&&d.bottom!=null&&(this.bottom=i.ak(d.bottom,m.bottom,j)),m.left!=null&&d.left!=null&&(this.left=i.ak(d.left,m.left,j)),m.right!=null&&d.right!=null&&(this.right=i.ak(d.right,m.right,j)),this}getCenter(d,m){const j=i.aA((this.left+d-this.right)/2,0,d),A=i.aA((this.top+m-this.bottom)/2,0,m);return new i.P(j,A)}equals(d){return this.top===d.top&&this.bottom===d.bottom&&this.left===d.left&&this.right===d.right}clone(){return new Wk(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}const Vh=15;class a5{constructor(d,m,j,A,O,R,B){this.tileSize=512,this._renderWorldCopies=O===void 0||O,this._minZoom=d||0,this._maxZoom=m||22,this._minPitch=j??0,this._maxPitch=A??60,this.setProjection(R),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 Wk,this._projMatrixCache={},this._alignedProjMatrixCache={},this._fogTileMatrixCache={},this._expandedProjMatrixCache={},this._distanceTileDataCache={},this._camera=new Hk,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 a5(this._minZoom,this._maxZoom,this._minPitch,this.maxPitch,this._renderWorldCopies,this.getProjection(),this.maxBounds);return d._elevation=this._elevation,d._centerAltitude=this._centerAltitude,d._centerAltitudeValidForExaggeration=this._centerAltitudeValidForExaggeration,d.tileSize=this.tileSize,d.mercatorFromTransition=this.mercatorFromTransition,d.width=this.width,d.height=this.height,d.cameraElevationReference=this.cameraElevationReference,d._center=this._center,d._setZoom(this.zoom),d._seaLevelZoom=this._seaLevelZoom,d.angle=this.angle,d._fov=this._fov,d._pitch=this._pitch,d._nearZ=this._nearZ,d._farZ=this._farZ,d._averageElevation=this._averageElevation,d._orthographicProjectionAtLowPitch=this._orthographicProjectionAtLowPitch,d._unmodified=this._unmodified,d._edgeInsets=this._edgeInsets.clone(),d._camera=this._camera.clone(),d._calcMatrices(),d.freezeTileCoverage=this.freezeTileCoverage,d.frustumCorners=this.frustumCorners,d._allowWorldUnderZoom=this._allowWorldUnderZoom,d}get isOrthographic(){return this.projection.name!=="globe"&&this._orthographicProjectionAtLowPitch&&this.pitch0&&this.elevation.exaggeration()>0&&this._centerAltitudeValidForExaggeration;if(!this._elevation||d===Number.NEGATIVE_INFINITY&&(!m||!this._centerAltitude))return this._centerAltitude=0,this._seaLevelZoom=null,void(this._centerAltitudeValidForExaggeration=void 0);const j=this._elevation;m||this._centerAltitude&&this._centerAltitudeValidForExaggeration&&j.exaggeration()&&this._centerAltitudeValidForExaggeration!==j.exaggeration()?(this._centerAltitude=this._centerAltitude/this._centerAltitudeValidForExaggeration*j.exaggeration(),this._centerAltitudeValidForExaggeration=j.exaggeration()):(this._centerAltitude=d||0,this._centerAltitudeValidForExaggeration=j.exaggeration()),this._updateSeaLevelZoom()}_updateSeaLevelZoom(){if(this._centerAltitudeValidForExaggeration===void 0)return;const d=Math.max(0,(this.pixelsPerMeter*this._centerAltitude+this.cameraToCenterDistance)/this.worldSize);this._seaLevelZoom=this._zoomFromMercatorZ(d)}sampleAverageElevation(){if(!this._elevation)return 0;const d=this._elevation,m=[[.5,.2],[.3,.5],[.5,.5],[.7,.5],[.5,.8]],j=this.horizonLineFromTop();let A=0,O=0;for(let R=0;R{const Re=i.cY(ce,de,ue,je,ve);H.has(Re)||(O.push(new i.aQ(de,ce,ue,je,ve)),H.add(Re))};for(let de=0;dece.canonical.z)continue;const ue=ce.canonical,je=ce.overscaledZ,ve=ce.wrap,Re=1<0,rt=ue.y+10,wt=ce.wrap-(We?0:1),mt=ce.wrap+(Le?0:1),vt=We?ue.x-1:Re-1,pt=Le?ue.x+1:0;if(R)j[0]<0?(Y(je,mt,ue.z,pt,ue.y),j[1]<0&&rt&&(Y(je,ve,ue.z,ue.x,ue.y+1),Y(je,mt,ue.z,pt,ue.y+1)),j[1]>0&&Ke&&(Y(je,ve,ue.z,ue.x,ue.y-1),Y(je,mt,ue.z,pt,ue.y-1))):j[0]>0?(Y(je,wt,ue.z,vt,ue.y),j[1]<0&&rt&&(Y(je,ve,ue.z,ue.x,ue.y+1),Y(je,wt,ue.z,vt,ue.y+1)),j[1]>0&&Ke&&(Y(je,ve,ue.z,ue.x,ue.y-1),Y(je,wt,ue.z,vt,ue.y-1))):j[1]<0&&rt?Y(je,ve,ue.z,ue.x,ue.y+1):Ke&&Y(je,ve,ue.z,ue.x,ue.y-1);else{const ut=ce.visibleQuadrants;1&ut&&(Y(je,wt,ue.z,vt,ue.y),Ke&&(Y(je,ve,ue.z,ue.x,ue.y-1),Y(je,wt,ue.z,vt,ue.y-1))),2&ut&&(Y(je,mt,ue.z,pt,ue.y),Ke&&(Y(je,ve,ue.z,ue.x,ue.y-1),Y(je,mt,ue.z,pt,ue.y-1))),4&ut&&(Y(je,wt,ue.z,vt,ue.y),rt&&(Y(je,ve,ue.z,ue.x,ue.y+1),Y(je,wt,ue.z,vt,ue.y+1))),8&ut&&(Y(je,mt,ue.z,pt,ue.y),rt&&(Y(je,ve,ue.z,ue.x,ue.y+1),Y(je,mt,ue.z,pt,ue.y+1)))}}const te=[];for(const de of O)O.some(ce=>de.isChildOf(ce))||te.push(de);if(O=te.filter(de=>!d.some(ce=>!!(de.overscaledZ{const Le=Re.canonical.x+.5-ue[0],We=Re.canonical.y+.5-ue[1];return Le*Le+We*We{const vt=i.cY(rt,We,Ke,wt,mt);O.has(vt)||(A.push(new i.aQ(We,rt,Ke,wt,mt)),O.add(vt))},B=d.reduce((We,rt)=>Math.max(We,rt.overscaledZ),j),H=1<{const Ke=Math.floor(We[0]),wt=Math.floor(We[1]),mt=(We[0]-Ke)*i.al,vt=(We[1]-wt)*i.al,pt=Math.floor(rt[0]),ut=Math.floor(rt[1]),St=(rt[0]-pt)*i.al,Dt=(rt[1]-ut)*i.al;for(let Ot=-1;Ot<=1;Ot++){const Gt=Ke+Ot;if(!(Gt<0||Gt>=H)){te.x=mt-Ot*i.al,de.x=St-(Gt-pt)*i.al;for(let Zt=-1;Zt<=1;Zt++){const ar=wt+Zt;te.y=vt-Zt*i.al,de.y=Dt-(ar-ut)*i.al,i.cZ(te,de,Y)&&R(B,0,j,Gt,ar)}}}},ue=m.points,je=ue[i.cv],ve=ue[i.cw],Re=this._projectToGround(je,ue[i.cx]),Le=this._projectToGround(ve,ue[i.cy]);return ce(je,Re),ce(ve,Le),A}_projectToGround(d,m){return i.cz(i.cA(),d,m,d[2]/(d[2]-m[2]))}coveringTiles(d){let m=this.coveringZoomLevel(d);const j=m,A=this.elevation&&this.elevation.exaggeration(),O=A&&!d.isTerrainDEM,R=this.projection.name==="mercator";if(d.minzoom!==void 0&&md.maxzoom&&(m=d.maxzoom);const B=this.locationCoordinate(this.center),H=this.center.lat,Y=1<{const Ht=new i.ae(Tt.x+25e-6,Tt.y,Tt.z),hr=new i.ae(Tt.x,Tt.y+25e-6,Tt.z),Ar=Tt.toLngLat(),Kr=Ht.toLngLat(),Sr=hr.toLngLat(),wr=this.locationCoordinate(Ar),cn=this.locationCoordinate(Kr),rn=this.locationCoordinate(Sr),qr=Math.hypot(cn.x-wr.x,cn.y-wr.y),Xr=Math.hypot(rn.x-wr.x,rn.y-wr.y);return Math.sqrt(qr*Xr)*vt/25e-6},ut=Tt=>{const Jt=wt,Ht=mt;return{aabb:i.cF(this,Y,0,0,0,Tt,Ht,Jt,this.projection),zoom:0,x:0,y:0,minZ:Ht,maxZ:Jt,wrap:Tt,fullyVisible:!1}},St=[];let Dt=[];const Ot=m,Gt=d.reparseOverscaled?j:m,Zt=(Re-this._centerAltitude)*ve,ar=Tt=>{if(!this._elevation||!Tt.tileID||!R)return;const Jt=this._elevation.getMinMaxForTile(Tt.tileID),Ht=Tt.aabb;Jt?(Ht.min[2]=Jt.min,Ht.max[2]=Jt.max,Ht.center[2]=(Ht.min[2]+Ht.max[2])/2):(Tt.shouldSplit=Ut(Tt),Tt.shouldSplit||(Ht.min[2]=Ht.max[2]=Ht.center[2]=this._centerAltitude))},br=(Tt,Jt)=>{if(.707*Jt{if(Tt.zoom=.9)return!0}else if(O&&(hr=Tt.aabb.distanceZ(Le)*ve),this.projection.isReprojectedInTileSpace&&j<=5){const Xr=Math.pow(2,Tt.zoom),Cn=pt(new i.ae((Tt.x+.5)/Xr,(Tt.y+.5)/Xr));Ar=Cn>.85?1:Cn}if(!R&&!de){const Xr=Math.sqrt(Jt*Jt+Ht*Ht+hr*hr);let Cn=(1<0;){const Tt=St.pop(),Jt=Tt.x,Ht=Tt.y;let hr=Tt.fullyVisible;const Ar=()=>this.projection.name==="globe"&&(Tt.y===0||Tt.y===(1<>1),cn={aabb:R?Tt.aabb.quadrant(Kr):i.cF(this,Y,Tt.zoom+1,Sr,wr,Tt.wrap,Tt.minZ,Tt.maxZ,this.projection),zoom:Tt.zoom+1,x:Sr,y:wr,wrap:Tt.wrap,fullyVisible:hr,tileID:void 0,shouldSplit:void 0,minZ:Tt.minZ,maxZ:Tt.maxZ};O&&!de&&(cn.tileID=new i.aQ(Tt.zoom+1===Ot?Gt:Tt.zoom+1,Tt.wrap,Tt.zoom+1,Sr,wr),ar(cn)),St.push(cn)}else{const Kr=Tt.zoom===Ot?Gt:Tt.zoom;if(d.minzoom&&d.minzoom>Kr)continue;let Sr=0;if(!hr){let qr=We?Tt.aabb.intersectsPrecise(ue):Tt.aabb.intersectsPreciseFlat(ue);if(qr===0&&Ar()){const Xr=new i.cD(Tt.zoom,Jt,Ht);qr=i.cE(this,Y,Xr,!0).intersectsPrecise(ue)}if(qr===0)continue;if(d.calculateQuadrantVisibility)if(ue.containsPoint(Tt.aabb.center))Sr=15;else for(let Xr=0;Xr<4;Xr++)Tt.aabb.quadrant(Xr).intersects(ue)!==0&&(Sr|=1<{const hr=[0,0,0,1],Ar=[i.al,i.al,0,1],Kr=this.calculateFogTileMatrix(Ht.tileID.toUnwrapped());i.aC(hr,hr,Kr),i.aC(Ar,Ar,Kr);const Sr=i.cG([],hr,Ar),wr=i.cH([],hr,Ar),cn=i.c$(Sr,wr);if(cn===0)return!0;let rn=!1;const qr=this._elevation;if(qr&&cn>Tt&&Jt!==0){const Xr=this.calculateProjMatrix(Ht.tileID.toUnwrapped());let Cn;d.isTerrainDEM||(Cn=qr.getMinMaxForTile(Ht.tileID)),Cn||(Cn={min:mt,max:wt});const ts=i.cI(this.rotation),Us=[ts[0]*i.al,ts[1]*i.al,Cn.max];i.af(Us,Us,Xr),rn=(1-Us[1])*this.height*.5Tt.distanceSq-Jt.distanceSq).map(Tt=>Tt.tileID)}resize(d,m){this.width=d,this.height=m,this.pixelsToGLUnits=[2/d,-2/m],this._constrain(),this._calcMatrices()}get unmodified(){return this._unmodified}zoomScale(d){return Math.pow(2,d)}scaleZoom(d){return Math.log2(d)}project(d){const m=i.aA(d.lat,-i.cJ,i.cJ),j=this.projection.project(d.lng,m);return new i.P(j.x*this.worldSize,j.y*this.worldSize)}unproject(d){return this.projection.unproject(d.x/this.worldSize,d.y/this.worldSize)}get point(){return this.project(this.center)}get pointMerc(){return this.point._div(this.worldSize)}get pixelsPerMeterRatio(){return this.pixelsPerMeter/i.cf(1,this.center.lat)/this.worldSize}setLocationAtPoint(d,m){let j,A;const O=this.centerPoint;if(this.projection.name==="globe"){const B=this.worldSize;j=(m.x-O.x)/B,A=(m.y-O.y)/B}else{const B=this.pointCoordinate(m),H=this.pointCoordinate(O);j=B.x-H.x,A=B.y-H.y}const R=this.locationCoordinate(d);this.setLocation(new i.ae(R.x-j,R.y-A))}setLocation(d){this.center=this.coordinateLocation(d),this.projection.wrap&&(this.center=this.center.wrap())}locationPoint(d,m){return this.projection.locationPoint(this,d,m)}locationPoint3D(d,m){return this.projection.locationPoint(this,d,m,!0)}pointLocation(d){return this.coordinateLocation(this.pointCoordinate(d))}pointLocation3D(d,m){return this.coordinateLocation(this.pointCoordinate3D(d,m))}locationCoordinate(d,m){const j=m?i.cf(m,d.lat):void 0,A=this.projection.project(d.lng,d.lat);return new i.ae(A.x,A.y,j)}coordinateLocation(d){return this.projection.unproject(d.x,d.y)}pointRayIntersection(d,m){const j=m??this._centerAltitude,A=[d.x,d.y,0,1],O=[d.x,d.y,1,1];i.aC(A,A,this.pixelMatrixInverse),i.aC(O,O,this.pixelMatrixInverse);const R=O[3];i.cK(A,A,1/A[3]),i.cK(O,O,1/R);const B=A[2],H=O[2];return{p0:A,p1:O,t:B===H?0:(j-B)/(H-B)}}screenPointToMercatorRay(d){const m=[d.x,d.y,0,1],j=[d.x,d.y,1,1];return i.aC(m,m,this.pixelMatrixInverse),i.aC(j,j,this.pixelMatrixInverse),i.cK(m,m,1/m[3]),i.cK(j,j,1/j[3]),m[2]=i.cf(m[2],this._center.lat)*this.worldSize,j[2]=i.cf(j[2],this._center.lat)*this.worldSize,i.cK(m,m,1/this.worldSize),i.cK(j,j,1/this.worldSize),new i.ax([m[0],m[1],m[2]],i.aw([],i.av([],j,m)))}rayIntersectionCoordinate(d){const{p0:m,p1:j,t:A}=d,O=i.cf(m[2],this._center.lat),R=i.cf(j[2],this._center.lat);return new i.ae(i.ak(m[0],j[0],A)/this.worldSize,i.ak(m[1],j[1],A)/this.worldSize,i.ak(O,R,A))}pointCoordinate(d,m=this._centerAltitude){return this.projection.pointCoordinate(this,d.x,d.y,m)}pointCoordinate3D(d,m){if(!this.elevation)return this.pointCoordinate(d,m);let j=this.projection.pointCoordinate3D(this,d.x,d.y);if(j)return new i.ae(j[0],j[1],j[2]);let A=0,O=this.horizonLineFromTop();if(d.y>O)return this.pointCoordinate(d,m);const R=.02*O,B=d.clone();for(let H=0;H<10&&O-A>R;H++){B.y=i.ak(A,O,.66);const Y=this.projection.pointCoordinate3D(this,B.x,B.y);Y?(O=B.y,j=Y):A=B.y}return j?new i.ae(j[0],j[1],j[2]):this.pointCoordinate(d)}isPointAboveHorizon(d){return this.projection.isPointAboveHorizon(this,d)}isPointOnSurface(d){if(d.y<0||d.y>this.height||d.x<0||d.x>this.width)return!1;if(this.elevation||this.zoom>=i.cL)return!this.isPointAboveHorizon(d);const m=this.pointCoordinate(d);return m.y>=0&&m.y<=1}_coordinatePoint(d,m){const j=m&&this.elevation?this.elevation.getAtPointOrZero(d,this._centerAltitude):this._centerAltitude,A=[d.x*this.worldSize,d.y*this.worldSize,j+d.toAltitude(),1];return i.aC(A,A,this.pixelMatrix),A[3]>0?new i.P(A[0]/A[3],A[1]/A[3]):new i.P(Number.MAX_VALUE,Number.MAX_VALUE)}_getBoundsNonRectangular(){const{top:d,left:m}=this._edgeInsets,j=this.height-this._edgeInsets.bottom,A=this.width-this._edgeInsets.right,O=this.pointLocation3D(new i.P(m,d)),R=this.pointLocation3D(new i.P(A,d)),B=this.pointLocation3D(new i.P(A,j)),H=this.pointLocation3D(new i.P(m,j));let Y=Math.min(O.lng,R.lng,B.lng,H.lng),te=Math.max(O.lng,R.lng,B.lng,H.lng),de=Math.min(O.lat,R.lat,B.lat,H.lat),ce=Math.max(O.lat,R.lat,B.lat,H.lat);const ue=Math.pow(2,-this.zoom)/16*270,je=this.projection.name==="globe"?1:4,ve=(Re,Le,We,rt,Ke)=>{const wt=(Re+We)/2,mt=(Le+rt)/2,vt=new i.P(wt,mt),{lng:pt,lat:ut}=this.pointLocation3D(vt),St=Math.max(0,Y-pt,de-ut,pt-te,ut-ce);Y=Math.min(Y,pt),te=Math.max(te,pt),de=Math.min(de,ut),ce=Math.max(ce,ut),(Keue)&&(ve(Re,Le,wt,mt,Ke+1),ve(wt,mt,We,rt,Ke+1))};if(ve(m,d,A,d,1),ve(A,d,A,j,1),ve(A,j,m,j,1),ve(m,j,m,d,1),this.projection.name==="globe"){const[Re,Le]=i.cM(this);Re?(ce=90,te=180,Y=-180):Le&&(de=-90,te=180,Y=-180)}return new i.aI(new i.aT(Y,de),new i.aT(te,ce))}_getBoundsRectangular(d,m){const{top:j,left:A}=this._edgeInsets,O=this.height-this._edgeInsets.bottom,R=this.width-this._edgeInsets.right,B=new i.P(A,j),H=new i.P(R,j),Y=new i.P(R,O),te=new i.P(A,O);let de=this.pointCoordinate(B,d),ce=this.pointCoordinate(H,d);const ue=this.pointCoordinate(Y,m),je=this.pointCoordinate(te,m),ve=(Re,Le)=>(Le.y-Re.y)/(Le.x-Re.x);return de.y>1&&ce.y>=0?de=new i.ae((1-je.y)/ve(je,de)+je.x,1):de.y<0&&ce.y<=1&&(de=new i.ae(-je.y/ve(je,de)+je.x,0)),ce.y>1&&de.y>=0?ce=new i.ae((1-ue.y)/ve(ue,ce)+ue.x,1):ce.y<0&&de.y<=1&&(ce=new i.ae(-ue.y/ve(ue,ce)+ue.x,0)),new i.aI().extend(this.coordinateLocation(de)).extend(this.coordinateLocation(ce)).extend(this.coordinateLocation(je)).extend(this.coordinateLocation(ue))}_getBoundsRectangularTerrain(){const d=this.elevation;if(!d.visibleDemTiles.length||d.isUsingMockSource())return this._getBoundsRectangular(0,0);const m=d.visibleDemTiles.reduce((j,A)=>{if(A.dem){const O=A.dem.tree;j.min=Math.min(j.min,O.minimums[0]),j.max=Math.max(j.max,O.maximums[0])}return j},{min:Number.MAX_VALUE,max:0});return this._getBoundsRectangular(m.min*d.exaggeration(),m.max*d.exaggeration())}getBounds(){return this.projection.name==="mercator"||this.projection.name==="equirectangular"?this._terrainEnabled()?this._getBoundsRectangularTerrain():this._getBoundsRectangular(0,0):this._getBoundsNonRectangular()}horizonLineFromTop(d=!0){const m=this.height/2/Math.tan(this._fov/2)/Math.tan(Math.max(this._pitch,.1))-this.centerOffset.y,j=this.height/2-m*(1-this._horizonShift);return d?Math.max(0,j):j}getMaxBounds(){return this.maxBounds}setMaxBounds(d){this.maxBounds=d,this.minLat=-i.cJ,this.maxLat=i.cJ,this.minLng=-180,this.maxLng=180,d&&(this.minLat=d.getSouth(),this.maxLat=d.getNorth(),this.minLng=d.getWest(),this.maxLng=d.getEast(),this.maxLngde&&(B=de-Y),de-teue&&(R=ue-H),ue-ce{for(let Ut=0;Ut<16;Ut++)Gt[Ut]=i.ak(Zt[Ut],ar[Ut],br)})(B,B,H,i.d0(this.pitch>=Vh?1:this.pitch/Vh))}else B=H;const Y=i.cP([],H,R);let te=i.cP([],B,R);if(this.projection.isReprojectedInTileSpace){const ut=this.locationCoordinate(this.center),St=i.bA([]);i.br(St,St,[ut.x*this.worldSize,ut.y*this.worldSize,0]),i.aB(St,St,i.cQ(this)),i.br(St,St,[-ut.x*this.worldSize,-ut.y*this.worldSize,0]),i.aB(te,te,St),i.aB(Y,Y,St),this.inverseAdjustmentMatrix=i.cR(this)}else this.inverseAdjustmentMatrix=[1,0,0,1];if(this.mercatorMatrix=i.cS([],te,[this.worldSize,this.worldSize,this.worldSize/O,1]),this.projMatrix=te,this.invProjMatrix=i.bl(new Float64Array(16),this.projMatrix),m){const ut=this._camera.getCameraToClipPerspective(this._fov,this.width/this.height,this._nearZ,1/0);ut[8]=2*-d.x/this.width,ut[9]=2*d.y/this.height,this.expandedFarZProjMatrix=i.cP([],ut,R)}else this.expandedFarZProjMatrix=this.projMatrix;const de=i.bl([],B);this.frustumCorners=i.cT.fromInvProjectionMatrix(de,this.horizonLineFromTop(),this.height),this.cameraFrustum=i.cB.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,0,!m);const ce=new Float32Array(16);i.bA(ce),i.cS(ce,ce,[1,-1,1]),i.cU(ce,ce,this._pitch),i.bB(ce,ce,this.angle);const ue=i.cd(new Float32Array(16),this._fov,this.width/this.height,this._nearZ,this._farZ);this.starsProjMatrix=i.bz(ue);const je=(Math.PI/2-this._pitch)*(this.height/this._fov)*this._horizonShift;ue[8]=2*-d.x/this.width,ue[9]=2*(d.y+je)/this.height,this.skyboxMatrix=i.aB(ce,ue,ce);const ve=this.point,Re=ve.x,Le=ve.y,We=this.width%2/2,rt=this.height%2/2,Ke=Math.cos(this.angle),wt=Math.sin(this.angle),mt=Re-Math.round(Re)+Ke*We+wt*rt,vt=Le-Math.round(Le)+Ke*rt+wt*We,pt=new Float64Array(te);if(i.br(pt,pt,[mt>.5?mt-1:mt,vt>.5?vt-1:vt,0]),this.alignedProjMatrix=pt,te=i.bC(),i.cS(te,te,[this.width/2,-this.height/2,1]),i.br(te,te,[1,-1,0]),this.labelPlaneMatrix=te,te=i.bC(),i.cS(te,te,[1,-1,1]),i.br(te,te,[-1,-1,0]),i.cS(te,te,[2/this.width,2/this.height,1]),this.glCoordMatrix=te,this.pixelMatrix=i.aB(new Float64Array(16),this.labelPlaneMatrix,Y),this._calcFogMatrices(),this._distanceTileDataCache={},te=i.bl(new Float64Array(16),this.pixelMatrix),!te)throw new Error("failed to invert matrix");if(this.pixelMatrixInverse=te,this.projection.name==="globe"||this.mercatorFromTransition){this.globeMatrix=i.cV(this);const ut=[this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]];this.globeCenterInViewSpace=i.af(ut,ut,R),this.globeRadius=this.worldSize/2/Math.PI-1}else this.globeMatrix=te;this._projMatrixCache={},this._alignedProjMatrixCache={},this._pixelsToTileUnitsCache={},this._expandedProjMatrixCache={}}_calcFogMatrices(){this._fogTileMatrixCache={};const d=this.cameraWorldSizeForFog,m=this.cameraPixelsPerMeter,j=this._camera.position,A=1/this.height/this._pixelsPerMercatorPixel,O=[d,d,m];i.c5(O,O,A),i.c5(j,j,-1),i.cW(j,j,O);const R=i.bC();i.br(R,R,j),i.cS(R,R,O),this.mercatorFogMatrix=R,this.worldToFogMatrix=this._camera.getWorldToCameraPosition(d,m,A)}_computeCameraPosition(d){const m=(d=d||this.pixelsPerMeter)/this.pixelsPerMeter,j=this._camera.forward(),A=this.point,O=this._mercatorZfromZoom(this._seaLevelZoom?this._seaLevelZoom:this._zoom)*m-d/this.worldSize*this._centerAltitude;return[A.x/this.worldSize-j[0]*O,A.y/this.worldSize-j[1]*O,d/this.worldSize*this._centerAltitude-j[2]*O]}_updateCameraState(){this.height&&(this._camera.setPitchBearing(this._pitch,this.angle),this._camera.position=this._computeCameraPosition())}_translateCameraConstrained(d){const m=this._maxCameraBoundsDistance()*Math.cos(this._pitch),j=this._camera.position[2],A=d[2];let O=1;this.projection.wrap&&(this.center=this.center.wrap()),A>0&&(O=Math.min((m-j)/A,1)),this._camera.position=i.bH([],this._camera.position,d,O),this._updateStateFromCamera()}_updateStateFromCamera(){const d=this._camera.position,m=this._camera.forward(),{pitch:j,bearing:A}=this._camera.getPitchBearing(),O=i.cf(this._centerAltitude,this.center.lat)*this._pixelsPerMercatorPixel,R=this._mercatorZfromZoom(this._maxZoom)*Math.cos(i.an(this._maxPitch)),B=Math.max((d[2]-O)/Math.cos(j),R),H=this._zoomFromMercatorZ(B);i.bH(d,d,m,B),this._pitch=i.aA(j,i.an(this.minPitch),i.an(this.maxPitch)),this.angle=i.bT(A,-Math.PI,Math.PI),this._setZoom(i.aA(H,this._minZoom,this._maxZoom)),this._updateSeaLevelZoom(),this._center=this.coordinateLocation(new i.ae(d[0],d[1],d[2])),this._unmodified=!1,this._constrain(),this._calcMatrices()}_worldSizeFromZoom(d){return Math.pow(2,d)*this.tileSize}_mercatorZfromZoom(d){return this.cameraToCenterDistance/this._worldSizeFromZoom(d)}_minimumHeightOverTerrain(){const d=Math.min(this._seaLevelZoom!=null?this._seaLevelZoom:this._zoom,this._maxZoom)+4;return this._mercatorZfromZoom(d)}_zoomFromMercatorZ(d){return this.scaleZoom(this.cameraToCenterDistance/(Math.max(0,d)*this.tileSize))}zoomFromMercatorZAdjusted(d){let m=0,j=i.cL,A=0,O=1/0;for(;j-m>1e-6&&j>m;){const R=m+.5*(j-m),B=this.tileSize*Math.pow(2,R),H=this.getCameraToCenterDistance(this.projection,R,B),Y=this.scaleZoom(H/(Math.max(0,d)*this.tileSize)),te=Math.abs(R-Y);teY||ce.y>1)return!0}return!1}isHorizonVisible(){return this.pitch+i.cX(this.fovAboveCenter)>88||this.anyCornerOffEdge(new i.P(0,0),new i.P(this.width,this.height))}zoomDeltaToMovement(d,m){const j=i.ag(i.av([],this._camera.position,d)),A=this._zoomFromMercatorZ(j)+m;return j-this._mercatorZfromZoom(A)}getCameraPoint(){if(this.projection.name==="globe"){const d=function([m,j,A],O){const R=[m,j,A,1];i.aC(R,R,O);const B=R[3]=Math.max(R[3],1e-6);return R[0]/=B,R[1]/=B,R[2]/=B,R}([this.globeMatrix[12],this.globeMatrix[13],this.globeMatrix[14]],this.pixelMatrix);return new i.P(d[0],d[1])}{const d=Math.tan(this._pitch)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new i.P(0,d))}}getCameraToCenterDistance(d,m=this.zoom,j=this.worldSize){const A=i.cO(d,m,this.width,this.height,1024),O=d.pixelSpaceConversion(this.center.lat,j,A);let R=.5/Math.tan(.5*this._fov)*this.height*O;return this.isOrthographic&&(R=i.ak(1,R,i.d0(this.pitch>=Vh?1:this.pitch/Vh))),R}getWorldToCameraMatrix(){const d=this._camera.getWorldToCamera(this.worldSize,this.projection.zAxisUnit==="meters"?this.pixelsPerMeter:1);return this.projection.name==="globe"&&i.aB(d,d,this.globeMatrix),d}getFrustum(d){return i.cB.fromInvProjectionMatrix(this.invProjMatrix,this.worldSize,d,this.projection.zAxisUnit==="meters")}}const Zm=(w,d)=>{if(d>0&&w.terrain&&i.w("Cutoff is currently disabled on terrain"),d<=0||w.terrain)return{shouldRenderCutoff:!1,uniformValues:{u_cutoff_params:[0,0,0,1]}};const m=w.transform,j=Math.max(Math.abs(m._zoom-(w.minCutoffZoom-1)),1),A=m.isLODDisabled(!1)?i.ah(60,45,m.pitch):i.ah(30,15,m.pitch),O=m._farZ-m._nearZ,R=d*m.height,B=((1-(H=A))*m.cameraToCenterDistance+H*(m._farZ+R))*j;var H;return{shouldRenderCutoff:A<1,uniformValues:{u_cutoff_params:[m._nearZ,m._farZ,(B-m._nearZ)/O,(B-R-m._nearZ)/O]}}},ch=2048;class Bv{constructor(d,m){this.aabb=d,this.lastCascade=m}}class Bie{add(d,m){const j=this.receivers[d.key];j!==void 0?(j.aabb.min[0]=Math.min(j.aabb.min[0],m.min[0]),j.aabb.min[1]=Math.min(j.aabb.min[1],m.min[1]),j.aabb.min[2]=Math.min(j.aabb.min[2],m.min[2]),j.aabb.max[0]=Math.max(j.aabb.max[0],m.max[0]),j.aabb.max[1]=Math.max(j.aabb.max[1],m.max[1]),j.aabb.max[2]=Math.max(j.aabb.max[2],m.max[2])):this.receivers[d.key]=new Bv(m,null)}clear(){this.receivers={}}get(d){return this.receivers[d.key]}computeRequiredCascades(d,m,j){const A=i.d9.fromPoints(d.points);let O=0;for(const R in this.receivers){const B=this.receivers[R];if(!B||!A.intersectsAabb(B.aabb))continue;B.aabb.min=A.closestPoint(B.aabb.min),B.aabb.max=A.closestPoint(B.aabb.max);const H=B.aabb.getCorners();for(let Y=0;Y1||ce[1]<-1||ce[1]>1){te=!1;break}}if(B.lastCascade=Y,O=Math.max(O,Y),te)break}}return O+1}}class r0{constructor(d){this.painter=d,this._enabled=!1,this._shadowLayerCount=0,this._numCascadesToRender=0,this._cascades=[],this._groundShadowTiles=[],this._receivers=new Bie,this._depthMode=new gn(d.context.gl.LEQUAL,gn.ReadWrite,[0,1]),this._uniformValues={u_light_matrix_0:new Float32Array(16),u_light_matrix_1:new Float32Array(16),u_shadow_intensity:0,u_fade_range:[0,0],u_shadow_normal_offset:[1,1,1],u_shadow_texel_size:1,u_shadow_map_resolution:1,u_shadow_direction:[0,0,1],u_shadow_bias:[36e-5,.0012,.012],u_shadowmap_0:0,u_shadowmap_1:0},this._forceDisable=!1,this.useNormalOffset=!1}destroy(){for(const d of this._cascades)d.texture.destroy(),d.framebuffer.destroy();this._cascades=[]}updateShadowParameters(d,m){const j=this.painter;if(this._enabled=!1,this._shadowLayerCount=0,this._receivers.clear(),!m||!m.properties)return;const A=m.properties.get("shadow-intensity");if(!m.shadowsEnabled()||A<=0||(this._shadowLayerCount=j.style.order.reduce((je,ve)=>{const Re=j.style._mergedLayers[ve];return je+(Re.hasShadowPass()&&!Re.isHidden(d.zoom)?1:0)},0),this._enabled=this._shadowLayerCount>0,!this.enabled))return;const O=j.context,R=ch,B=ch;if(this._cascades.length===0||ch!==this._cascades[0].texture.size[0]){this._cascades=[];for(let je=0;je<2;++je){const ve=j._shadowMapDebug,Re=O.gl,Le=O.createFramebuffer(R,B,ve?1:0,"texture"),We=new i.T(O,{width:R,height:B,data:null},Re.DEPTH_COMPONENT16);if(Le.depthAttachment.set(We.texture),ve){const rt=new i.T(O,{width:R,height:B,data:null},Re.RGBA8);Le.colorAttachment0.set(rt.texture)}this._cascades.push({framebuffer:Le,texture:We,matrix:[],far:0,boundingSphereRadius:0,frustum:new i.cB,scale:0})}}this.shadowDirection=Uv(m);let H=0;if(d.elevation){const je=d.elevation,ve=[1e4,-1e4];je.visibleDemTiles.filter(Re=>Re.dem).forEach(Re=>{const Le=Re.dem.tree;ve[0]=Math.min(ve[0],Le.minimums[0]),ve[1]=Math.max(ve[1],Le.maximums[0])}),ve[0]!==1e4&&(H=(ve[1]-ve[0])*je.exaggeration())}const Y=1.5*d.cameraToCenterDistance,te=3*Y,de=new Float64Array(16);for(let je=0;je=0)return{};const O=function(H,Y,te){const de=te/(1<0&&(i.d8(O[1],O[1],[A[0]*R,0,0]),i.d8(O[2],O[2],[A[0]*R,0,0])),A[1]<0?(i.d8(O[0],O[0],[0,A[1]*R,0]),i.d8(O[1],O[1],[0,A[1]*R,0])):A[1]>0&&(i.d8(O[2],O[2],[0,A[1]*R,0]),i.d8(O[3],O[3],[0,A[1]*R,0]));const B={};return B.vertices=O,B.planes=[$v(O[1],O[0],O[4]),$v(O[2],O[1],O[5]),$v(O[3],O[2],O[6]),$v(O[0],O[3],O[7])],B}addShadowReceiver(d,m,j){this._receivers.add(d,i.d9.fromTileIdAndHeight(d,m,j))}getMaxCascadeForTile(d){const m=this._receivers.get(d);return m&&m.lastCascade?m.lastCascade:0}}function $v(w,d,m){const j=i.av([],m,d),A=i.av([],w,d),O=i.bI([],j,A),R=i.ag(O);return R===0?[0,0,1,0]:(i.c5(O,O,1/R),[O[0],O[1],O[2],-i.bJ(O,d)])}function Uv(w){const d=w.properties.get("direction"),m=i.d4(d.x,d.y,d.z);m[2]=i.aA(m[2],0,75);const j=i.d6([m[0],m[1],m[2]]);return i.d5(j.x,j.y,j.z)}function Ep(w,d,m){const j=d.properties.get("color-use-theme")==="none",A=d.properties.get("color"),O=d.properties.get("intensity"),R=d.properties.get("direction"),B=[R.x,R.y,R.z],H=m.properties.get("color-use-theme")==="none",Y=m.properties.get("color"),te=m.properties.get("intensity"),de=Math.max(i.bJ([0,0,1],B),0),ce=[0,0,0];i.c5(ce,Y.toPremultipliedRenderColor(H?null:w.getLut(d.scope)).toArray01Linear().slice(0,3),te);const ue=[0,0,0];return i.c5(ue,A.toPremultipliedRenderColor(j?null:w.getLut(m.scope)).toArray01Linear().slice(0,3),de*O),i.db([ce[0]>0?ce[0]/(ce[0]+ue[0]):0,ce[1]>0?ce[1]/(ce[1]+ue[1]):0,ce[2]>0?ce[2]/(ce[2]+ue[2]):0])}function Ym(w,d,m,j,A,O){const R=w.zoom,B=w.scale,H=w.worldSize,Y=1/H,te=w.aspect,de=Math.sqrt(1+te*te)*Math.tan(.5*w.fovX),ce=de*de,ue=j-m,je=j+m;let ve,Re;ce>ue/je?(ve=j,Re=j*de):(ve=.5*je*(1+ce),Re=.5*Math.sqrt(ue*ue+2*(j*j+m*m)*ce+je*je*ce*ce));const Le=w.projection.pixelsPerMeter(w.center.lat,H),We=w._camera.getCameraToWorldMercator(),rt=[0,0,-ve*Y];i.af(rt,rt,We);let Ke=Re*Y;const wt=w._edgeInsets;if(!(wt.left===0&&wt.top===0&&wt.right===0&&wt.bottom===0||wt.left===wt.right&&wt.top===wt.bottom)){const hr=w._camera.getWorldToCamera(w.worldSize,w.projection.zAxisUnit==="meters"?Le:1),Ar=w._camera.getCameraToClipPerspective(w._fov,w.width/w.height,m,j);Ar[8]=2*-w.centerOffset.x/w.width,Ar[9]=2*w.centerOffset.y/w.height;const Kr=new Float64Array(16);i.cP(Kr,Ar,hr);const Sr=new Float64Array(16);i.bl(Sr,Kr);const wr=i.cB.fromInvProjectionMatrix(Sr,H,R,!0);for(const cn of wr.points){const rn=((mt=cn)[0]/=B,mt[1]/=B,mt[2]=i.cf(mt[2],w._center.lat),mt);Ke=Math.max(Ke,i.c6(i.da([],rt,rn)))}}var mt;Ke*=A/(A-1);const vt=Math.acos(d[2]),pt=Math.atan2(-d[0],-d[1]),ut=new Hk;ut.position=rt,ut.setPitchBearing(vt,pt);const St=ut.getWorldToCamera(H,Le),Dt=Ke*H,Ot=Math.min(w._mercatorZfromZoom(17)*H*-2,-2*Dt),Gt=ut.getCameraToClipOrthographic(-Dt,Dt,-Dt,Dt,Ot,(Dt+O*Le)/d[2]),Zt=new Float64Array(16);i.aB(Zt,Gt,St);const ar=i.d5(Math.floor(1e6*rt[0])/1e6*H,Math.floor(1e6*rt[1])/1e6*H,0),br=.5*A,Ut=[0,0,0];i.af(Ut,ar,Zt),i.c5(Ut,Ut,br);const Tt=[Math.floor(Ut[0]),Math.floor(Ut[1]),Math.floor(Ut[2])],Jt=[0,0,0];i.av(Jt,Ut,Tt),i.c5(Jt,Jt,-1/br);const Ht=new Float64Array(16);return i.bA(Ht),i.br(Ht,Ht,Jt),i.aB(Zt,Ht,Zt),[Zt,Dt]}class $ie extends i.E{constructor(d){super(),this.requestManager=d,this.models={"":{}},this.modelUris={"":{}},this.modelByURL={},this.numModelsLoading={}}loadModel(d,m){return i.dc(this.requestManager.transformRequest(m,i.R.Model).url).then(j=>{if(!j)return;const A=i.dd(j),O=new i.de(d,m,void 0,void 0,A);return O.computeBoundsAndApplyParent(),O}).catch(j=>{if(j&&j.status===404)return null;this.fire(new i.y(new Error(`Could not load model ${d} from ${m}: ${j.message}`)))})}load(d,m,j={forceReload:!1}){this.models[m]||(this.models[m]={});const A=Object.keys(d),O=[],R=[];for(const B of A){const H=d[B];this.hasURLBeenRequested(H)&&!j.forceReload||(this.modelByURL[H]={modelId:B,scope:m},O.push(this.loadModel(B,H)),R.push(B)),this.models[m][B]||(this.models[m][B]={model:null,numReferences:1})}this.numModelsLoading[m]=(this.numModelsLoading[m]||0)+R.length,Promise.allSettled(O).then(B=>{for(let H=0;H{this.fire(new i.y(new Error(`Could not load models: ${B.message}`)))})}isLoaded(){for(const d in this.numModelsLoading)if(this.numModelsLoading[d]>0)return!1;return!0}hasModel(d,m,j={exactIdMatch:!1}){return!!(j.exactIdMatch?this.getModel(d,m):this.getModelByURL(this.modelUris[m][d]))}getModel(d,m){return this.models[m]||(this.models[m]={}),this.models[m][d]?this.models[m][d].model:void 0}getModelByURL(d){if(!d)return null;const m=this.modelByURL[d];return m?this.models[m.scope][m.modelId].model:null}hasModelBeenAdded(d,m){return this.models[m]&&this.models[m][d]!==void 0}getModelURIs(d){return this.modelUris[d]||{}}addModel(d,m,j){this.models[j]||(this.models[j]={}),this.modelUris[j]||(this.modelUris[j]={});const A=this.requestManager.normalizeModelURL(m);if((this.hasModel(d,j,{exactIdMatch:!0})||this.hasModelBeenAdded(d,j))&&this.modelUris[j][d]===A)this.models[j][d].numReferences++;else if(this.hasURLBeenRequested(A)){const{scope:O,modelId:R}=this.modelByURL[A];this.models[O][R].numReferences++}else this.modelUris[j][d]=A,this.load({[d]:this.modelUris[j][d]},j)}addModelURLs(d,m){this.models[m]||(this.models[m]={}),this.modelUris[m]||(this.modelUris[m]={});const j=this.modelUris[m];for(const A in d)j[A]=this.requestManager.normalizeModelURL(d[A])}reloadModels(d){this.load(this.modelUris[d],d,{forceReload:!0})}addModelsFromBucket(d,m){this.models[m]||(this.models[m]={}),this.modelUris[m]||(this.modelUris[m]={});const j={};for(const A of d)this.hasModel(A,m,{exactIdMatch:!0})||this.hasURLBeenRequested(A)?this.models[m][A].numReferences++:this.modelUris[m][A]&&!this.hasURLBeenRequested(A)?j[A]=this.modelUris[m][A]:!this.hasURLBeenRequested(A)&&i.df(A,!1)&&(this.modelUris[m][A]=this.requestManager.normalizeModelURL(A),j[A]=this.modelUris[m][A]);this.load(j,m)}hasURLBeenRequested(d){return this.modelByURL[d]!==void 0}removeModel(d,m,j=!1,A=!1){if(this.models[m]&&this.models[m][d]&&(this.models[m][d].numReferences--,this.models[m][d].numReferences===0||A)){const O=this.modelUris[m][d];j||delete this.modelUris[m][d],delete this.modelByURL[O];const R=this.models[m][d].model;if(!R)return;delete this.models[m][d],R.destroy()}}destroy(){for(const d of Object.keys(this.models))for(const m of Object.keys(this.models[d])){const j=this.models[d][m].model;delete this.models[d][m],j&&j.destroy()}this.models={"":{}},this.modelUris={"":{}},this.modelByURL={},this.numModelsLoading={}}listModels(d){return this.models[d]||(this.models[d]={}),Object.keys(this.models[d])}upload(d,m){this.models[m]||(this.models[m]={});for(const j in this.models[m])this.models[m][j].model&&this.models[m][j].model.upload(d.context)}}const i5=i.a6.colorTheme,Uie=new i.a9({data:new i.aa(i5.data)});function EP(w){if(!w.metadata||!w.metadata.content_area)return;const d=i.o.devicePixelRatio,{left:m,top:j,width:A,height:O}=w.metadata.content_area,R=m*d,B=j*d;return[R,B,R+A*d,B+O*d]}function IP(w){if(w)return w.map(([d,m])=>[d*i.o.devicePixelRatio,m*i.o.devicePixelRatio])}class o5{constructor(d,m,j){this.id=d,this.scope=m,this.sourceCache=j,this.pendingRequests=new Set,this.missingRequests=new Set}addPendingRequest(d){this.missingRequests.has(d.name)||this.pendingRequests.has(d.name)||this.pendingRequests.add(d.name)}hasPendingRequests(){return this.pendingRequests.size>0}resolvePendingRequests(){const d=new Map;if(!this.sourceCache.loaded())return d;const m=this.sourceCache.getVisibleCoordinates();if(m.length===0)return d;const j=this.sourceCache.getSource();if(!(j instanceof hc))return d;const A=m.map(R=>this.sourceCache.getTile(R)),O=j.getImages(A,Array.from(this.pendingRequests));for(const[R,B]of O)d.set(i.I.from({name:R,iconsetId:this.id}),B),this.pendingRequests.delete(R);for(const R of this.pendingRequests)this.missingRequests.add(R);return this.pendingRequests.clear(),d}}const Xm=(w,d)=>Ye(w,d&&d.filter(m=>m.identifier!=="source.canvas")),PP=i.aH(Ws,["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"]),LP=i.aH(Ws,["setCenter","setZoom","setBearing","setPitch"]),Gk=new Set(["background","sky","slot","custom"]),Qm={version:8,layers:[],sources:{}},qv={duration:300,delay:0};class dh 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({},qv),this._buildingIndex=new J3(this),this.crossTileSymbolIndex=new qh,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 ke,this._hasDataDrivenEmissive=!1,this.dispatcher=m.dispatcher?m.dispatcher:new i.D(i.dh(),this),m.imageManager?this.imageManager=m.imageManager:(this.imageManager=new Ce(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 $ie(d._requestManager),this.modelManager.setEventedParent(this)),this._layers={},this._sourceCaches={},this._otherSourceCaches={},this._symbolSourceCaches={},this._loaded=!1,this._precompileDone=!1,this._shouldPrecompile=!1,this._availableImages=[],this._availableModels={},this._order=[],this._markersNeedUpdate=!1,this.options=m.configOptions?m.configOptions:new Map,this._configDependentLayers=m.configDependentLayers?m.configDependentLayers:new Set,this._indoorDependentLayers=m.indoorDependentLayers?m.indoorDependentLayers:new Set,this._config=m.config,this._styleColorTheme={lut:null,lutLoading:!1,lutLoadingCorrelationID:0,colorTheme:null,colorThemeOverride:m.colorThemeOverride},this._styleColorThemeForScope={},this._initialConfig=m.initialConfig,this.dispatcher.broadcast("setReferrer",i.dk());const j=this;this._rtlTextPluginCallback=dh.registerForPluginStateChange(A=>{j.dispatcher.broadcast("syncRTLPluginState",{pluginStatus:A.pluginStatus,pluginURL:A.pluginURL},(O,R)=>{if(i.dl(O),R&&R.every(B=>B))for(const B in j._sourceCaches){const H=j._sourceCaches[B],Y=H.getSource().type;Y!=="vector"&&Y!=="geojson"||H.reload()}})}),this.on("data",A=>{if(A.dataType!=="source"||A.sourceDataType!=="metadata")return;const O=this.getOwnSource(A.sourceId);if(O&&O.vectorLayerIds)for(const R in this._layers){const B=this._layers[R];B.source===O.id&&this._validateLayer(B)}})}load(d){return d?(typeof d=="string"?this.loadURL(d):this.loadJSON(d),this):this}_getGlobalId(d){if(!d)return null;if(typeof d=="string"){if(i.h(d))return d;const m=i.dm(d);if(!m.startsWith("http"))try{return new URL(m,location.href).toString()}catch{return m}return m}return`json://${i.dn(JSON.stringify(d))}`}_diffStyle(d,m,j){this.globalId=this._getGlobalId(d);const A=(O,R)=>{try{R(null,this.setState(O,j))}catch(B){R(B,!1)}};if(typeof d=="string"){const O=this.map._requestManager.normalizeStyleURL(d),R=this.map._requestManager.transformRequest(O,i.R.Style);i.m(R,(B,H)=>{B?this.fire(new i.y(B)):H&&A(H,m)})}else typeof d=="object"&&A(d,m)}loadURL(d,m={}){this.fire(new i.z("dataloading",{dataType:"style"}));const j=typeof m.validate=="boolean"?m.validate:!i.h(d);this.globalId=this._getGlobalId(d),d=this.map._requestManager.normalizeStyleURL(d,m.accessToken),this.resolvedImports.add(d);const A=this.importsCache.get(d);if(A)return this._load(A,j);const O=this.map._requestManager.transformRequest(d,i.R.Style);this._request=i.m(O,(R,B)=>{if(this._request=null,R)this.fire(new i.y(R));else if(B)return this.importsCache.set(d,B),this._load(B,j)})}loadJSON(d,m={}){this.fire(new i.z("dataloading",{dataType:"style"})),this.globalId=this._getGlobalId(d),this._request=i.o.frame(()=>{this._request=null,this._load(d,m.validate!==!1)})}loadEmpty(){this.fire(new i.z("dataloading",{dataType:"style"})),this._load(Qm,!1)}_loadImports(d,m,j){if(this.importDepth>=4)return i.w("Style doesn't support nesting deeper than 5"),Promise.resolve();const A=[];for(const O of d){const R=this._createFragmentStyle(O),B=new Promise(te=>{R.once("style.import.load",te),R.once("error",te)}).then(()=>this.mergeAll());if(A.push(B),this.resolvedImports.has(O.url)){R.loadEmpty();continue}const H=O.data||this.importsCache.get(O.url);H?(R.loadJSON(H,{validate:m}),this._isInternalStyle(H)&&(R.globalId=null)):O.url?R.loadURL(O.url,{validate:m}):R.loadEmpty();const Y={style:R,id:O.id,config:O.config};if(j){const te=this.fragments.findIndex(({id:de})=>de===j);this.fragments=this.fragments.slice(0,te).concat(Y).concat(this.fragments.slice(te))}else this.fragments.push(Y)}return Promise.allSettled(A)}getImportGlobalIds(d=this,m=new Set){for(const j of d.fragments)j.style.globalId&&m.add(j.style.globalId),this.getImportGlobalIds(j.style,m);return[...m.values()]}_createFragmentStyle(d){const m=this.scope?i.B(d.id,this.scope):d.id;let j;const A=this._initialConfig&&this._initialConfig[m];(d.config||A)&&(j=Object.assign({},d.config,A));const O=new dh(this.map,{scope:m,styleChanges:this._changes,importDepth:this.importDepth+1,importsCache:this.importsCache,resolvedImports:new Set(this.resolvedImports),dispatcher:this.dispatcher,imageManager:this.imageManager,glyphManager:this.glyphManager,modelManager:this.modelManager,config:j,configOptions:this.options,colorThemeOverride:d["color-theme"],configDependentLayers:this._configDependentLayers,indoorDependentLayers:this._indoorDependentLayers});return O.setEventedParent(this.map,{style:O}),O}_reloadImports(){this.mergeAll(),this._updateMapProjection(),this.updateConfigDependencies(),this._updateLayers(this._indoorDependentLayers),this.map._triggerCameraUpdate(this.camera),this.dispatcher.broadcast("setLayers",{layers:this._serializeLayers(this._order),scope:this.scope,options:this.options}),this._shouldPrecompile=this.map._precompilePrograms&&this.isRootStyle()}_isInternalStyle(d){return this.isRootStyle()&&(d.fragment||!!d.schema&&d.fragment!==!1)}_load(d,m){if(this._isInternalStyle(d)){const O=Object.assign({},Qm,{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&&Xm(this,Os(d)))return;this._loaded=!0,this.stylesheet=i.dp(d);const j=()=>{for(const H in d.sources)this.addSource(H,d.sources[H],{validate:!1,isInitialLoad:!0});if(d.iconsets)for(const H in d.iconsets)this.addIconset(H,d.iconsets[H]);d.sprite?this._loadIconset(d.sprite):(this.imageManager.setLoaded(!0,this.scope),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope,isLoaded:!0})),!this.glyphManager.url&&d.glyphs&&this.glyphManager.setURL(d.glyphs);const O=cx(this.stylesheet.layers);if(this._order=O.map(H=>H.id),this.stylesheet.light&&i.w("The `light` root property is deprecated, prefer using `lights` with `flat` light type instead."),this.stylesheet.lights)if(this.stylesheet.lights.length===1&&this.stylesheet.lights[0].type==="flat"){const H=this.stylesheet.lights[0];this.light=new At(H.properties,H.id)}else this.setLights(this.stylesheet.lights);this.light||(this.light=new At(this.stylesheet.light)),this._layers={};for(const H of O){const Y=i.du(H,this.scope,this._styleColorTheme.lut,this.options);Y.expressionDependencies.configDependencies.size!==0&&this._configDependentLayers.add(Y.fqid),Y.expressionDependencies.isIndoorDependent&&this._indoorDependentLayers.add(Y.fqid),this._hasAppearances=this._hasAppearances||Y.getAppearances().length!==0,Y.setEventedParent(this,{layer:{id:Y.id}}),this._layers[Y.id]=Y;const te=this.getOwnLayerSourceCache(Y),de=!!this.directionalLight&&this.directionalLight.shadowsEnabled();te&&Y.canCastShadows()&&de&&(te.castsShadows=!0)}this.stylesheet.featuresets&&this.setFeaturesetSelectors(this.stylesheet.featuresets),this.stylesheet.models&&this.addModelURLs(this.stylesheet.models);const R=this.stylesheet.terrain;R&&(this.checkCanvasFingerprintNoise(),this.disableElevatedTerrain||this.terrainSetForDrapingOnly()||this._createTerrain(R,1)),this.stylesheet.fog&&this._createFog(this.stylesheet.fog),this.stylesheet.snow&&this._createSnow(this.stylesheet.snow),this.stylesheet.rain&&this._createRain(this.stylesheet.rain),this.stylesheet.transition&&this.setTransition(this.stylesheet.transition),this.fire(new i.z("data",{dataType:"style"}));const B=this.isRootStyle();d.imports?this._loadImports(d.imports,m).then(()=>{this._reloadImports(),this.fire(new i.z(B?"style.load":"style.import.load"))}).catch(H=>{this.fire(new i.y(new Error("Failed to load imports",H))),this.fire(new i.z(B?"style.load":"style.import.load"))}):(this._reloadImports(),this.fire(new i.z(B?"style.load":"style.import.load")))};this._styleColorTheme.colorTheme=this.stylesheet["color-theme"];const A=this._styleColorTheme.colorThemeOverride?this._styleColorTheme.colorThemeOverride:this._styleColorTheme.colorTheme;if(A){const O=this._evaluateColorThemeData(A);this._loadColorTheme(O).then(()=>{j()}).catch(R=>{i.w(`Couldn't load color theme from the stylesheet: ${R}`),j()})}else this._styleColorTheme.lut=null,j()}isRootStyle(){return this.importDepth===0}hasAppearances(){return this._hasAppearances||this.fragments.some(d=>d.style.hasAppearances())}mergeAll(){let d,m,j,A,O,R,B,H,Y,te;const de={};this.terrain&&this.terrain.scope!==this.scope&&delete this.terrain,this.forEachFragmentStyle(ce=>{if(ce.stylesheet){if(ce.light!=null&&(d=ce.light),ce.stylesheet.lights)for(const ue of ce.stylesheet.lights)ue.type==="ambient"&&ce.ambientLight!=null&&(m=ce.ambientLight),ue.type==="directional"&&ce.directionalLight!=null&&(j=ce.directionalLight);A=this._prioritizeTerrain(A,ce.terrain,ce.stylesheet.terrain),ce.stylesheet.fog&&ce.fog!=null&&(O=ce.fog),ce.stylesheet.snow&&ce.snow!=null&&(R=ce.snow),ce.stylesheet.rain&&ce.rain!=null&&(B=ce.rain),ce.stylesheet.camera!=null&&(te=ce.stylesheet.camera),ce.stylesheet.projection!=null&&(H=ce.stylesheet.projection),ce.stylesheet.transition!=null&&(Y=ce.stylesheet.transition),de[ce.scope]=ce._styleColorTheme}}),this.light=d,this.ambientLight=m,this.directionalLight=j,this.fog=O,this.snow=R,this.rain=B,this._styleColorThemeForScope=de,A===null?delete this.terrain:this.terrain=A,this.camera=te||{"camera-projection":"perspective"},this.projection=H||{name:"mercator"},this.transition=Object.assign({},qv,Y),this.mergeSources(),this.mergeLayers(),this.mergeIndoor()}forEachFragmentStyle(d){const m=j=>{for(const A of j.fragments)m(A.style);d(j)};m(this)}_prioritizeTerrain(d,m,j){const A=d&&d.drapeRenderMode===0;return j===null?m&&m.drapeRenderMode===0?m:A?d:null:m!=null&&(!d||A||m&&m.drapeRenderMode===1)?m:d}mergeTerrain(){let d;this.terrain&&this.terrain.scope!==this.scope&&delete this.terrain,this.forEachFragmentStyle(m=>{d=this._prioritizeTerrain(d,m.terrain,m.stylesheet.terrain)}),d===null?delete this.terrain:this.terrain=d}mergeProjection(){let d;this.forEachFragmentStyle(m=>{m.stylesheet.projection!=null&&(d=m.stylesheet.projection)}),this.projection=d||{name:"mercator"}}mergeSources(){const d={},m={},j={};this.forEachFragmentStyle(A=>{for(const O in A._sourceCaches){const R=i.B(O,A.scope);d[R]=A._sourceCaches[O]}for(const O in A._otherSourceCaches){const R=i.B(O,A.scope);m[R]=A._otherSourceCaches[O]}for(const O in A._symbolSourceCaches){const R=i.B(O,A.scope);j[R]=A._symbolSourceCaches[O]}}),this._mergedSourceCaches=d,this._mergedOtherSourceCaches=m,this._mergedSymbolSourceCaches=j}mergeIndoor(){this.forEachFragmentStyle(d=>{if(d.stylesheet&&d.stylesheet.indoor)for(const m of Object.values(d.stylesheet.indoor)){const j=m,A=i.B(j.sourceId,d.scope);this._mergedIndoor[A]=new Set(j.sourceLayers||[])}})}mergeLayers(){const d={},m=[],j={};this._mergedSlots=[],this._has3DLayers=!1,this._hasCircleLayers=!1,this._hasSymbolLayers=!1,this.forEachFragmentStyle(R=>{for(const B of R._order){const H=R._layers[B];if(H.type==="slot"){const Y=i.dq(B);if(d[Y])continue;d[Y]=[]}H.slot&&d[H.slot]?d[H.slot].push(H):m.push(H)}}),this._mergedOrder=[];let A=-1;const O=(R=[])=>{for(const B of R)if(B.type==="slot"){const H=i.dq(B.id);d[H]&&O(d[H]),this._mergedSlots.push(H)}else{const H=i.B(B.id,B.scope);this._mergedOrder.push(H),j[H]=B,B.is3D(!!this.terrain)&&(this._has3DLayers=!0,A=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 R={};for(let B=0;BR[B]-R[H])}this._mergedLayers=j,this.updateDrapeFirstLayers(),this._buildingIndex.processLayersChanged(),this._updateDataDrivenEmissiveStrength()}terrainSetForDrapingOnly(){return!!this.terrain&&this.terrain.drapeRenderMode===0}getCamera(){return this.stylesheet.camera}setCamera(d){return this.stylesheet.camera=Object.assign({},this.stylesheet.camera,d),this.camera=this.stylesheet.camera,this}_evaluateColorThemeData(d){return d.data?function(m,j,A,O){const R=Object.assign({},j);for(const H of Object.keys(i5))R[H]===void 0&&(R[H]=i5[H].default);const B=new i.a8(Uie,m,new Map(A));return B.setTransitionOrValue(R,A),B.untransitioned().possiblyEvaluate(new i.ac(0,{worldview:void 0}))}(this.scope,d,this.options).get("data"):null}_loadColorTheme(d){this._styleColorTheme.lutLoading=!0,this._styleColorTheme.lutLoadingCorrelationID+=1;const m=this._styleColorTheme.lutLoadingCorrelationID;return new Promise((j,A)=>{const O="data:image/png;base64,";if(!d||d.length===0)return this._styleColorTheme.lut=null,this._styleColorTheme.lutLoading=!1,void j();let R=d;R.startsWith(O)||(R=O+R);const B=i.I.from("mapbox-reserved-lut"),H=new Image;H.src=R,H.onerror=()=>{this._styleColorTheme.lutLoading=!1,A(new Error("Failed to load image data"))},H.onload=()=>{if(this._styleColorTheme.lutLoadingCorrelationID!==m)return void j();this._styleColorTheme.lutLoading=!1;const{width:Y,height:te,data:de}=i.o.getImageData(H);if(te>32)return void A(new Error("The height of the image must be less than or equal to 32 pixels."));if(Y!==te*te)return void A(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:te},de),pixelRatio:1,sdf:!1,usvg:!1,version:0});const ce=this.imageManager.getImage(B,this.scope);ce?(this._styleColorTheme.lut={image:ce.data,data:d},j()):A(new Error("Missing LUT image."))}})}getLut(d){const m=this._styleColorThemeForScope[d];return m?m.lut:null}setProjection(d){d?this.stylesheet.projection=d:delete this.stylesheet.projection,this.mergeProjection(),this._updateMapProjection()}applyProjectionUpdate(){this._loaded&&(this.dispatcher.broadcast("setProjection",this.map.transform.projectionOptions),this.map.transform.projection.requiresDraping?(this.getTerrain()||this.stylesheet.terrain)&&!this.disableElevatedTerrain||this.setTerrainForDraping():this.terrainSetForDrapingOnly()&&this.setTerrain(null,0))}_updateMapProjection(){this.isRootStyle()&&(this.map._useExplicitProjection?this.applyProjectionUpdate():this.map._prioritizeAndUpdateProjection(null,this.projection))}_loadSprite(d){this._spriteRequest=function(m,j,A){let O,R,B;const H=i.o.devicePixelRatio>1?"@2x":"";let Y=i.m(j.transformRequest(j.normalizeSpriteURL(m,H,".json"),i.R.SpriteJSON),(ce,ue)=>{Y=null,B||(B=ce,O=ue,de())}),te=i.n(j.transformRequest(j.normalizeSpriteURL(m,H,".png"),i.R.SpriteImage),(ce,ue)=>{te=null,B||(B=ce,R=ue,de())});function de(){if(B)A(B);else if(O&&R){const ce=i.o.getImageData(R),ue={};for(const je in O){const{width:ve,height:Re,x:Le,y:We,sdf:rt,pixelRatio:Ke,stretchX:wt,stretchY:mt,content:vt}=O[je],pt=new i.q({width:ve,height:Re});i.q.copy(ce,pt,{x:Le,y:We},{x:0,y:0},{width:ve,height:Re},null),ue[je]={data:pt,pixelRatio:Ke!==void 0?Ke:1,sdf:rt!==void 0&&rt,stretchX:wt,stretchY:mt,content:vt,usvg:!1,version:0}}A(null,ue)}}return{cancel(){Y&&(Y.cancel(),Y=null),te&&(te.cancel(),te=null)}}}(d,this.map._requestManager,(m,j)=>{if(this._spriteRequest=null,m)this.fire(new i.y(m));else if(j){const A=new Map;for(const O in j)A.set(i.I.from(O),j[O]);this.addImages(A)}this.imageManager.setLoaded(!0,this.scope),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope,isLoaded:!0}),this.fire(new i.z("data",{dataType:"style"}))})}addIconset(d,m){if(m.type==="sprite")return void this._loadSprite(m.url);const j=this.getOwnSourceCache(m.source);if(!j)return void this.fire(new i.y(new Error(`Source "${m.source}" as specified by iconset "${d}" does not exist and cannot be used as an iconset source`)));const A=j.getSource();if(A.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`)));A.partial=!1;const O=new o5(d,this.scope,j);this.imageManager.addImageProvider(O,this.scope)}removeIconset(d){this.imageManager.removeImageProvider(d,this.scope)}_loadIconset(d){if(!i.h(d)&&this.map._spriteFormat!=="icon_set"||this.map._spriteFormat==="raster")return void this._loadSprite(d);const m=this.map._spriteFormat==="auto";var j,A;this._spriteRequest=(A=(O,R)=>{if(this._spriteRequest=null,O)m?this._loadSprite(d):this.fire(new i.y(O));else if(R){const B=new Map;for(const H in R)B.set(i.I.from(H),R[H]);this.addImages(B)}this.imageManager.setLoaded(!0,this.scope),this.dispatcher.broadcast("spriteLoaded",{scope:this.scope,isLoaded:!0}),this.fire(new i.z("data",{dataType:"style"}))},i.bu((j=this.map._requestManager).transformRequest(j.normalizeIconsetURL(d),i.R.Iconset),(O,R)=>{if(O)return void A(O);const B={},H=i.dg(new i.bt(R));for(const Y of H.icons){const te={version:1,pixelRatio:i.o.devicePixelRatio,content:EP(Y),stretchX:Y.metadata?IP(Y.metadata.stretch_x_areas):void 0,stretchY:Y.metadata?IP(Y.metadata.stretch_y_areas):void 0,sdf:!1,usvg:!0,icon:Y};B[Y.name]=te}A(null,B)}))}_validateLayer(d){const m=this.getOwnSource(d.source);if(!m)return;const j=d.sourceLayer;j&&(m.type==="geojson"||m.vectorLayerIds&&m.vectorLayerIds.indexOf(j)===-1)&&this.fire(new i.y(new Error(`Source layer "${j}" does not exist on source "${m.id}" as specified by style layer "${d.id}"`)))}loaded(){if(!this._loaded||Object.keys(this._changes.getUpdatedSourceCaches()).length)return!1;for(const d in this._sourceCaches)if(!this._sourceCaches[d].loaded())return!1;if(!this.imageManager.isLoaded()||this.imageManager.hasPatternsInFlight()||!this.modelManager.isLoaded()||this._styleColorTheme.lutLoading)return!1;for(const{style:d}of this.fragments)if(!d.loaded())return!1;return!0}_serializeImports(){if(this.stylesheet.imports)return this.stylesheet.imports.map((d,m)=>{const j=this.fragments[m];return j&&j.style&&(d.data=j.style.serialize()),d})}_serializeSources(){const d={};for(const m in this._sourceCaches){const j=this._sourceCaches[m].getSource();d[j.id]||(d[j.id]=j.serialize())}return d}_serializeLayers(d){const m=[];for(const j of d){const A=this._layers[j];A&&A.type!=="custom"&&m.push(A.serialize())}return m}hasLightTransitions(){return!(!this.light||!this.light.hasTransition())||!(!this.ambientLight||!this.ambientLight.hasTransition())||!(!this.directionalLight||!this.directionalLight.hasTransition())}hasFogTransition(){return!!this.fog&&this.fog.hasTransition()}hasSnowTransition(){return!!this.snow&&this.snow.hasTransition()}hasRainTransition(){return!!this.rain&&this.rain.hasTransition()}hasTransitions(){if(this.hasLightTransitions()||this.hasFogTransition()||this.hasSnowTransition()||this.hasRainTransition())return!0;for(const d in this._sourceCaches)if(this._sourceCaches[d].hasTransition())return!0;for(const d in this._layers)if(this._layers[d].hasTransition())return!0;return!1}_updateDataDrivenEmissiveStrength(){for(const d in this._mergedLayers){const m=this._mergedLayers[d];if(m._transitionablePaint&&m._transitionablePaint._values){const j=m._transitionablePaint._values["line-emissive-strength"];if(j&&j.value&&j.value.isDataDriven())return void(this._hasDataDrivenEmissive=!0)}}this._hasDataDrivenEmissive=!1}hasDataDrivenEmissiveStrength(){return this._hasDataDrivenEmissive}get order(){return this.terrain?this._drapedFirstOrder:this._mergedOrder}_getOrder(d){return d?this.order:this._mergedOrder}isLayerDraped(d){return!!this.terrain&&d.isDraped(this.getLayerSourceCache(d))}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading")}_checkLayer(d){const m=this.getOwnLayer(d);if(m)return m;this.fire(new i.y(new Error(`The layer '${d}' does not exist in the map's style.`)))}_checkSource(d){const m=this.getOwnSource(d);if(m)return m;this.fire(new i.y(new Error(`The source '${d}' does not exist in the map's style.`)))}precompilePrograms(d,m){const j=this.map.painter;if(j)for(let A=d.minzoom||0;A<(d.maxzoom||25.5);A++){const O=d.getProgramIds();if(O)for(const R of O){const B=d.getDefaultProgramParams(R,m.zoom,this._styleColorTheme.lut);B&&(j.style=this,this.fog&&(j._fogVisible=!0,B.overrideFog=!0,j.getOrCreateProgram(R,B)),j._fogVisible=!1,B.overrideFog=!1,j.getOrCreateProgram(R,B),(this.stylesheet.terrain||this.stylesheet.projection&&this.stylesheet.projection.name==="globe")&&(B.overrideRtt=!0,j.getOrCreateProgram(R,B)))}}}update(d){if(!this._loaded)return;this.ambientLight&&this.ambientLight.recalculate(d),this.directionalLight&&this.directionalLight.recalculate(d);const m=this.calculateLightsBrightness();d.brightness=m||0,m!==this._brightness&&(this._brightness=m,this.dispatcher.broadcast("setBrightness",m)),d.worldview!==this._worldview&&(this._worldview=d.worldview,this.dispatcher.broadcast("setWorldview",this._worldview));const j=this._changes.isDirty();let A=!1;if(this._changes.isDirty()){const B=this._changes.getLayerUpdatesByScope();for(const H in B){const{updatedIds:Y,removedIds:te}=B[H];(Y||te)&&(this._updateWorkerLayers(H,Y,te),A=!0)}this.updateSourceCaches(),this._updateTilesForChangedImages(),this.updateLayers(d),this.light&&this.light.updateTransitions(d),this.ambientLight&&this.ambientLight.updateTransitions(d),this.directionalLight&&this.directionalLight.updateTransitions(d),this.fog&&this.fog.updateTransitions(d),this.snow&&this.snow.updateTransitions(d),this.rain&&this.rain.updateTransitions(d),this._changes.reset()}const O={};for(const B in this._mergedSourceCaches){const H=this._mergedSourceCaches[B];O[B]=H.used,H.used=!1,H.tileCoverLift=0}for(const B of this._mergedOrder){const H=this._mergedLayers[B];if(H.visibility!=="none"&&H.recalculate(d,this._availableImages),!H.isHidden(d.zoom)){const Y=this.getLayerSourceCache(H);Y&&(Y.used=!0,Y.tileCoverLift=Math.max(Y.tileCoverLift,H.tileCoverLift()))}!this._precompileDone&&this._shouldPrecompile&&("requestIdleCallback"in window?requestIdleCallback(()=>{this.precompilePrograms(H,d)}):this.precompilePrograms(H,d))}this._shouldPrecompile&&(this._precompileDone=!0),this.terrain&&A&&this.mergeLayers();const R=this.imageManager.getPendingImageProviders();for(const B of R)B.sourceCache.used=!0;for(const B in O){const H=this._mergedSourceCaches[B];O[B]!==H.used&&H.getSource().fire(new i.z("data",{sourceDataType:"visibility",dataType:"source",sourceId:H.getSource().id}))}this.light&&this.light.recalculate(d),this.terrain&&this.terrain.recalculate(d),this.fog&&this.fog.recalculate(d),this.snow&&this.snow.recalculate(d),this.rain&&this.rain.recalculate(d),this.z=d.zoom,this._markersNeedUpdate&&(this._updateMarkersOpacity(),this._markersNeedUpdate=!1),this.imageManager.clearUpdatedImages(this.scope),j&&this.fire(new i.z("data",{dataType:"style"}))}updateImageProviders(){const d=this.imageManager.getPendingImageProviders();for(const m of d){const j=m.resolvePendingRequests(),A=this.getFragmentStyle(m.scope);A&&A.addImages(j)}}_updateTilesForChangedImages(){const d={};for(const m in this._mergedSourceCaches){const j=this._mergedSourceCaches[m].getSource().scope;d[j]=d[j]||this._changes.getUpdatedImages(j),d[j].length!==0&&this._mergedSourceCaches[m].reloadTilesForDependencies(["icons","patterns"],d[j])}for(const m in d)this._changes.resetUpdatedImages(m)}_updateWorkerLayers(d,m,j){const A=this.getFragmentStyle(d);A&&this.dispatcher.broadcast("updateLayers",{layers:m?A._serializeLayers(m):[],scope:d,removedIds:j||[],options:A.options})}setState(d,m){if(this._checkLoaded(),Xm(this,Os(d)))return!1;(d=i.dp(d)).layers=cx(d.layers);const j=function(R,B){if(!R)return[{command:Ws.setStyle,args:[B]}];let H=[];try{if(!i.by(R.version,B.version))return[{command:Ws.setStyle,args:[B]}];if(i.by(R.center,B.center)||H.push({command:Ws.setCenter,args:[B.center]}),i.by(R.zoom,B.zoom)||H.push({command:Ws.setZoom,args:[B.zoom]}),i.by(R.bearing,B.bearing)||H.push({command:Ws.setBearing,args:[B.bearing]}),i.by(R.pitch,B.pitch)||H.push({command:Ws.setPitch,args:[B.pitch]}),i.by(R.sprite,B.sprite)||H.push({command:Ws.setSprite,args:[B.sprite]}),i.by(R.glyphs,B.glyphs)||H.push({command:Ws.setGlyphs,args:[B.glyphs]}),i.by(R.imports,B.imports)||function(ue=[],je=[],ve){je=je||[];const Re=(ue=ue||[]).map(Gm),Le=je.map(Gm),We=ue.reduce(dx,{}),rt=je.reduce(dx,{}),Ke=Re.slice();let wt,mt,vt,pt;for(wt=0,mt=0;wt{ue.source&&Y[ue.source]?H.push({command:Ws.removeLayer,args:[ue.id]}):de.push(ue)});let ce=R.terrain;ce&&Y[ce.source]&&(H.push({command:Ws.setTerrain,args:[void 0]}),ce=void 0),H=H.concat(te),i.by(ce,B.terrain)||H.push({command:Ws.setTerrain,args:[B.terrain]}),function(ue,je,ve){je=je||[];const Re=(ue=ue||[]).map(Gm),Le=je.map(Gm),We=ue.reduce(dx,{}),rt=je.reduce(dx,{}),Ke=Re.slice(),wt=Object.create(null);let mt,vt,pt,ut,St,Dt,Ot;for(mt=0,vt=0;mt!(R.command in LP));if(j.length===0)return!1;const A=j.filter(R=>!(R.command in PP));if(A.length>0)throw new Error(`Unimplemented: ${A.map(R=>R.command).join(", ")}.`);const O=[];return j.forEach(R=>{O.push(this[R.command](...R.args))}),m&&Promise.all(O).then(m).catch(m),this.stylesheet=d,this.mergeAll(),this.dispatcher.broadcast("setLayers",{layers:this._serializeLayers(this._order),scope:this.scope,options:this.options}),!0}_updateWorkerImages(){this._availableImages=this.imageManager.listImages(this.scope),this.dispatcher.broadcast("setImages",{scope:this.scope,images:this._availableImages})}_updateWorkerModels(){this._availableModels=this.modelManager.getModelURIs(this.scope),this.dispatcher.broadcast("setModels",{scope:this.scope,models:this._availableModels})}addImages(d){if(d.size===0)return this;for(const[m,j]of d.entries()){if(this.getImage(m))return this.fire(new i.y(new Error(`An image with the name "${m.name}" already exists.`)));this.imageManager.addImage(m,this.scope,j),this._changes.updateImage(m,this.scope)}return this._updateWorkerImages(),this.fire(new i.z("data",{dataType:"style"})),this}addImage(d,m){return this.getImage(d)?this.fire(new i.y(new Error(`An image with the name "${d.name}" already exists.`))):(this.imageManager.addImage(d,this.scope,m),this._changes.updateImage(d,this.scope),this._updateWorkerImages(),this.fire(new i.z("data",{dataType:"style"})),this)}updateImage(d,m,j=!1){this.imageManager.updateImage(d,this.scope,m),j&&(this._changes.updateImage(d,this.scope),this._updateWorkerImages(),this.fire(new i.z("data",{dataType:"style"})))}getImage(d){return this.imageManager.getImage(d,this.scope)}removeImage(d){return this.getImage(d)?(this.imageManager.removeImage(d,this.scope),this._changes.updateImage(d,this.scope),this._updateWorkerImages(),this.fire(new i.z("data",{dataType:"style"})),this):this.fire(new i.y(new Error("No image with this name exists.")))}listImages(){return this._checkLoaded(),this._availableImages.slice()}getActualScope(){return this._importedAsBasemap?"basemap":this.scope}addModelURLs(d){return this.modelManager.addModelURLs(d,this.getActualScope()),this._updateWorkerModels(),this.fire(new i.z("data",{dataType:"style"})),this}addModel(d,m,j={}){return this._checkLoaded(),this._validate(xe,`models.${d}`,m,null,j)||(this.modelManager.addModel(d,m,this.getActualScope()),this.fire(new i.z("data",{dataType:"style"}))),this}hasModel(d){return this.modelManager.hasModel(d,this.getActualScope())}removeModel(d){return this.hasModel(d)?(this.modelManager.removeModel(d,this.getActualScope(),!1,!0),this.fire(new i.z("data",{dataType:"style"})),this):this.fire(new i.y(new Error("No model with this ID exists.")))}listModels(){return this._checkLoaded(),this.modelManager.listModels(this.getActualScope())}addSource(d,m,j={}){if(this._checkLoaded(),this.getOwnSource(d)!==void 0)throw new Error(`There is already a source with ID "${d}".`);if(!m.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(m).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(m.type)>=0&&this._validate(bi,`sources.${d}`,m,null,j))return;this.map&&this.map._collectResourceTiming&&(m.collectResourceTiming=!0);const A=Xo(d,m,this.dispatcher,this);A.scope=this.scope,A.setEventedParent(this,()=>({isSourceLoaded:this._isSourceCacheLoaded(A.id),source:A.serialize(),sourceId:A.id}));const O=R=>{const B=(R?"symbol:":"other:")+A.id,H=i.B(B,this.scope),Y=this._sourceCaches[B]=new yd(H,A,R);(R?this._symbolSourceCaches:this._otherSourceCaches)[A.id]=Y,Y.onAdd(this.map)};O(!1),m.type!=="vector"&&m.type!=="geojson"||O(!0),A.onAdd&&A.onAdd(this.map),j.isInitialLoad||(this.mergeSources(),this._changes.setDirty())}removeSource(d){this._checkLoaded();const m=this.getOwnSource(d);if(!m)throw new Error("There is no source with this ID");for(const A in this._layers)if(this._layers[A].source===d)return this.fire(new i.y(new Error(`Source "${d}" cannot be removed while layer "${A}" 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 A=Object.entries(this.stylesheet.iconsets).find(([O,R])=>R.type==="source"&&R.source===d);if(A)return this.fire(new i.y(new Error(`Source "${d}" cannot be removed while iconset "${A[0]}" is using it.`)))}const j=this.getOwnSourceCaches(d);for(const A of j){const O=i.dq(A.id);delete this._sourceCaches[O],this._changes.discardSourceCacheUpdate(A.id),A.fire(new i.z("data",{sourceDataType:"metadata",dataType:"source",sourceId:A.getSource().id})),A.setEventedParent(null),A.clearTiles()}return delete this._otherSourceCaches[d],delete this._symbolSourceCaches[d],this.mergeSources(),m.setEventedParent(null),m.onRemove&&m.onRemove(this.map),this._changes.setDirty(),this}setGeoJSONSourceData(d,m){this._checkLoaded(),this.getOwnSource(d).setData(m),this._changes.setDirty()}getOwnSource(d){const m=this.getOwnSourceCache(d);return m&&m.getSource()}getOwnSources(){const d=[];for(const m in this._otherSourceCaches){const j=this.getOwnSourceCache(m);j&&d.push(j.getSource())}return d}areTilesLoaded(){const d=this._mergedSourceCaches;for(const m in d){const j=d[m]._tiles;for(const A in j){const O=j[A];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(Ia,"lights",O))return;switch(O.type){case"ambient":if(this.ambientLight){const R=this.ambientLight;R.set(O),R.updateTransitions(m)}else this.ambientLight=new ra(O,wo||(wo=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 R=this.directionalLight;R.set(O),R.updateTransitions(m)}else this.directionalLight=new ra(O,va||(va=new i.a9({direction:new i.ap(i.a6.properties_light_directional.direction),color:new i.aa(i.a6.properties_light_directional.color),"color-use-theme":new i.aa({type:"string",default:"default","property-type":"data-constant"}),intensity:new i.aa(i.a6.properties_light_directional.intensity),"cast-shadows":new i.aa(i.a6.properties_light_directional["cast-shadows"]),"shadow-quality":new i.aa(i.a6.properties_light_directional["shadow-quality"]),"shadow-intensity":new i.aa(i.a6.properties_light_directional["shadow-intensity"])})),this.scope,this.options)}}const j=Object.assign(m,{worldview:this.map.getWorldview()}),A=new i.ac(this.z||0,j);this.ambientLight&&this.ambientLight.recalculate(A),this.directionalLight&&this.directionalLight.recalculate(A),this._brightness=this.calculateLightsBrightness(),this.dispatcher.broadcast("setBrightness",this._brightness)}calculateLightsBrightness(){const d=this.directionalLight,m=this.ambientLight;if(!d||!m)return;const j=ce=>.2126*(ce[0]<=.03928?ce[0]/12.92:Math.pow((ce[0]+.055)/1.055,2.4))+.7152*(ce[1]<=.03928?ce[1]/12.92:Math.pow((ce[1]+.055)/1.055,2.4))+.0722*(ce[2]<=.03928?ce[2]/12.92:Math.pow((ce[2]+.055)/1.055,2.4)),A=d.properties.get("color").toNonPremultipliedRenderColor(null).toArray01(),O=d.properties.get("intensity"),R=d.properties.get("direction"),B=1-i.d4(R.x,R.y,R.z)[2]/90,H=j(A)*O*B,Y=m.properties.get("color").toNonPremultipliedRenderColor(null).toArray01(),te=m.properties.get("intensity"),de=j(Y)*te;return Number(((H+de)/2).toFixed(6))}getBrightness(){return this._brightness}getLights(){if(!this.enable3dLights())return null;const d=[];return this.directionalLight&&d.push(this.directionalLight.get()),this.ambientLight&&d.push(this.ambientLight.get()),d}enable3dLights(){return!!this.ambientLight&&!!this.directionalLight}getFragmentStyle(d){if(d==null||d===""&&this.isRootStyle())return this;if(i.dr(d)){const m=i.ds(d),j=this.fragments.find(({id:O})=>O===m);if(!j)return;const A=i.dq(d);return j.style.getFragmentStyle(A)}{const m=this.fragments.find(({id:j})=>j===d);return m?m.style:void 0}}setFeaturesetSelectors(d){if(!d)return;const m={},j=(A,O="")=>`${A}::${O}`;this._featuresetSelectors={};for(const A in d){const O=this._featuresetSelectors[A]=[];for(const R of d[A].selectors){if(R.featureNamespace){const H=this.getOwnLayer(R.layer);if(!H){i.w(`Layer is undefined for selector: ${R.layer}`);continue}const Y=j(H.source,H.sourceLayer);if(Y in m&&m[Y]!==R.featureNamespace){i.w(`"featureNamespace ${R.featureNamespace} of featureset ${A}'s selector is not associated to the same source, skip this selector`);continue}m[Y]=R.featureNamespace}let B;if(R.properties)for(const H in R.properties){const Y=i.U(R.properties[H]);Y.result==="success"&&(B=B||{},B[H]=Y.value)}O.push({layerId:R.layer,namespace:R.featureNamespace,properties:B,uniqueFeatureID:R._uniqueFeatureID})}}}getFeaturesetDescriptors(d){const m=this.getFragmentStyle(d);if(!m||!m.stylesheet.featuresets)return[];const j=[];for(const A in m.stylesheet.featuresets)j.push({featuresetId:A,importId:m.scope?m.scope:void 0});return j}getFeaturesetLayers(d,m){const j=this.getFragmentStyle(m),A=j.stylesheet.featuresets;if(!A||!A[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 R of A[d].selectors){const B=j.getOwnLayer(R.layer);B&&O.push(B)}return O}getConfigProperty(d,m){const j=this.getFragmentStyle(d);if(!j)return null;const A=i.B(m,j.scope),O=j.options.get(A),R=O?O.value||O.default:null;return R?R.serialize():null}isIndoorEnabled(){return Object.keys(this._mergedIndoor).length>0}getIndoorSourceLayers(d,m){const j=i.B(d,m);return this._mergedIndoor[j]}setIndoorData(d,m){this.map.indoor.setIndoorData(m)}updateIndoorDependentLayers(){this._updateLayers(this._indoorDependentLayers),this.map._styleDirty=!0,this.map.triggerRepaint()}setConfigProperty(d,m,j){const A=this.getFragmentStyle(d);if(!A)return;const O=A.stylesheet.schema;if(!O||!O[m])return;const R=i.U(j);if(R.result!=="success")return void Xm(this,R.value);const B=R.value.expression,H=i.B(m,A.scope),Y=A.options.get(H);if(!Y)return;let te;const{minValue:de,maxValue:ce,stepValue:ue,type:je,values:ve}=O[m],Re=i.U(O[m].default);Re.result==="success"&&(te=Re.value.expression),te?(this.options.set(H,Object.assign({},Y,{value:B,default:te,minValue:de,maxValue:ce,stepValue:ue,type:je,values:ve})),this.updateConfigDependencies(m)):this.fire(new i.y(new Error(`No schema defined for the config option "${m}" in the "${d}" fragment.`)))}getConfig(d){const m=this.getFragmentStyle(d);if(!m)return null;const j=m.stylesheet.schema;if(!j)return null;const A={};for(const O in j){const R=i.B(O,m.scope),B=m.options.get(R),H=B?B.value||B.default:null;A[O]=H?H.serialize():null}return A}setConfig(d,m){const j=this.getFragmentStyle(d);j&&(j.updateConfig(m,j.stylesheet.schema),this.updateConfigDependencies())}getSchema(d){const m=this.getFragmentStyle(d);return m?m.stylesheet.schema:null}setSchema(d,m){const j=this.getFragmentStyle(d);j&&(j.stylesheet.schema=m,j.updateConfig(j._config,m),this.updateConfigDependencies())}updateConfig(d,m){if(this._config=d,d||m)if(m)for(const j in m){let A,O;const R=i.U(m[j].default);if(R.result==="success"&&(A=R.value.expression),d&&d[j]!==void 0){const ce=i.U(d[j]);ce.result==="success"&&(O=ce.value.expression)}const{minValue:B,maxValue:H,stepValue:Y,type:te,values:de}=m[j];if(A){const ce=i.B(j,this.scope);this.options.set(ce,{default:A,value:O,minValue:B,maxValue:H,stepValue:Y,type:te,values:de})}else this.fire(new i.y(new Error(`No schema defined for config option "${j}".`)))}else this.fire(new i.y(new Error("Attempting to set config for a style without schema.")))}_updateLayers(d,m=()=>!0){for(const j of d){const A=this.getLayer(j);A&&m(A)&&(A.possiblyEvaluateVisibility(),this._updateLayer(A),this._changes.setDirty())}}updateConfigDependencies(d){this._updateLayers(this._configDependentLayers,m=>!d||m.expressionDependencies.configDependencies.has(d)),this.ambientLight&&this.ambientLight.updateConfig(this.options),this.directionalLight&&this.directionalLight.updateConfig(this.options),this.fog&&this.fog.updateConfig(this.options),this.snow&&this.snow.updateConfig(this.options),this.rain&&this.rain.updateConfig(this.options),this.forEachFragmentStyle(m=>{const j=m._styleColorTheme.colorThemeOverride?m._styleColorTheme.colorThemeOverride:m._styleColorTheme.colorTheme;if(j){const A=m._evaluateColorThemeData(j);(!m._styleColorTheme.lut&&A!==""||m._styleColorTheme.lut&&A!==m._styleColorTheme.lut.data)&&m.setColorTheme(j)}}),this._changes.setDirty()}addLayer(d,m,j={}){this._checkLoaded();const A=d.id;if(this._layers[A])return void this.fire(new i.y(new Error(`Layer with id "${A}" already exists on this map`)));let O;if(d.type==="custom"){if(Xm(this,i.dt(d)))return;O=i.du(d,this.scope,this._styleColorTheme.lut,this.options)}else{if(typeof d.source=="object"&&(this.addSource(A,d.source),d=i.dp(d),d=Object.assign(d,{source:A})),this._validate(dc,`layers.${A}`,d,{arrayIndex:-1},j))return;O=i.du(d,this.scope,this._styleColorTheme.lut,this.options),this._validateLayer(O),O.setEventedParent(this,{layer:{id:A}})}const R=i.B(O.source,O.scope);O.expressionDependencies.configDependencies.size!==0&&this._configDependentLayers.add(R),O.expressionDependencies.isIndoorDependent&&this._indoorDependentLayers.add(R);let B=this._order.length;if(m){const de=this._order.indexOf(m);if(de===-1)return void this.fire(new i.y(new Error(`Layer with id "${m}" does not exist on this map.`)));O.slot===this._layers[m].slot?B=de:i.w(`Layer with id "${m}" has a different slot. Layers can only be rearranged within the same slot.`)}this._order.splice(B,0,A),this._layerOrderChanged=!0,this._layers[A]=O;const H=this.getOwnLayerSourceCache(O),Y=!!this.directionalLight&&this.directionalLight.shadowsEnabled();H&&O.canCastShadows()&&Y&&(H.castsShadows=!0);const te=this._changes.getRemovedLayer(O);if(te&&O.source&&H&&O.type!=="custom"){this._changes.discardLayerRemoval(O);const de=i.B(O.source,O.scope);te.type!==O.type?this._changes.updateSourceCache(de,"clear"):(this._changes.updateSourceCache(de,"reload"),H.pause())}this._updateLayer(O),O.onAdd&&O.onAdd(this.map),O.scope=this.scope,this.mergeLayers()}moveLayer(d,m){this._checkLoaded();const j=this._checkLayer(d);if(!j||d===m)return;const A=this._order.indexOf(d);this._order.splice(A,1);let O=this._order.length;if(m){const R=this._order.indexOf(m);if(R===-1)return void this.fire(new i.y(new Error(`Layer with id "${m}" does not exist on this map.`)));j.slot===this._layers[m].slot?O=R:i.w(`Layer with id "${m}" has a different slot. Layers can only be rearranged within the same slot.`)}this._order.splice(O,0,d),this._changes.setDirty(),this._layerOrderChanged=!0,this.mergeLayers()}removeLayer(d){this._checkLoaded();const m=this._checkLayer(d);if(!m)return;m.setEventedParent(null);const j=this._order.indexOf(d);this._order.splice(j,1),delete this._layers[d],this._changes.setDirty(),this._layerOrderChanged=!0,this._configDependentLayers.delete(m.fqid),this._indoorDependentLayers.delete(m.fqid),this._changes.removeLayer(m);const A=this.getOwnLayerSourceCache(m);if(A&&A.castsShadows){let O=!1;for(const R in this._layers)if(this._layers[R].source===m.source&&this._layers[R].canCastShadows()){O=!0;break}A.castsShadows=O}m.onRemove&&m.onRemove(this.map),this.mergeLayers()}getOwnLayer(d){return this._layers[d]}hasLayer(d){return d in this._mergedLayers}hasLayerType(d){for(const m in this._layers)if(this._layers[m].type===d)return!0;return!1}setLayerZoomRange(d,m,j){this._checkLoaded();const A=this._checkLayer(d);A&&(A.minzoom===m&&A.maxzoom===j||(m!=null&&(A.minzoom=m),j!=null&&(A.maxzoom=j),this._updateLayer(A)))}getSlots(){return this._checkLoaded(),this._mergedSlots}setSlot(d,m){this._checkLoaded();const j=this._checkLayer(d);j&&j.slot!==m&&(j.slot=m,this._updateLayer(j))}setFilter(d,m,j={}){this._checkLoaded();const A=this._checkLayer(d);if(A&&!i.by(A.filter,m))return m==null?(A.filter=void 0,void this._updateLayer(A)):void(this._validate(go,`layers.${A.id}.filter`,m,{layerType:A.type},j)||(A.filter=i.dp(m),this._updateLayer(A)))}getFilter(d){const m=this._checkLayer(d);if(m)return i.dp(m.filter)}setLayoutProperty(d,m,j,A={}){this._checkLoaded();const O=this._checkLayer(d);if(O&&!i.by(O.getLayoutProperty(m),j)){if(j!=null&&(!A||A.validate!==!1)&&Xm(O,tt.call(Os,{key:`layers.${d}.layout.${m}`,layerType:O.type,objectKey:m,value:j,styleSpec:i.a6,style:{glyphs:!0,sprite:!0}})))return;O.setLayoutProperty(m,j),O.expressionDependencies.configDependencies.size!==0&&this._configDependentLayers.add(O.fqid),O.expressionDependencies.isIndoorDependent&&this._indoorDependentLayers.add(O.fqid),this._updateLayer(O)}}setLayerProperty(d,m,j,A={}){this._checkLoaded();const O=this._checkLayer(d);O&&(m==="appearances"?(O.setAppearances(j),this._changes.setDirty()):O.isPaintProperty(m)?this.setPaintProperty(d,m,j,A):this.setLayoutProperty(d,m,j,A))}getLayoutProperty(d,m){const j=this._checkLayer(d);if(j)return j.getLayoutProperty(m)}setPaintProperty(d,m,j,A={}){this._checkLoaded();const O=this._checkLayer(d);if(!O||i.by(O.getPaintProperty(m),j)||j!=null&&(!A||A.validate!==!1)&&Xm(O,uc.call(Os,{key:`layers.${d}.paint.${m}`,layerType:O.type,objectKey:m,value:j,styleSpec:i.a6})))return;const R=O.setPaintProperty(m,j);O.expressionDependencies.configDependencies.size!==0&&this._configDependentLayers.add(O.fqid),O.expressionDependencies.isIndoorDependent&&this._indoorDependentLayers.add(O.fqid),R&&this._updateLayer(O),this._changes.updatePaintProperties(O)}getPaintProperty(d,m){const j=this._checkLayer(d);if(j)return j.getPaintProperty(m)}setFeatureState(d,m){if(this._checkLoaded(),"target"in d){if("featuresetId"in d.target){const{featuresetId:H,importId:Y}=d.target,te=this.getFragmentStyle(Y),de=te.getFeaturesetLayers(H);for(const{source:ce,sourceLayer:ue}of de)te.setFeatureState({id:d.id,source:ce,sourceLayer:ue},m)}else if("layerId"in d.target){const{layerId:H}=d.target,Y=this.getLayer(H);this.setFeatureState({id:d.id,source:Y.source,sourceLayer:Y.sourceLayer},m)}return}const j=d.source,A=d.sourceLayer,O=this._checkSource(j);if(!O)return;const R=O.type;if(R==="geojson"&&A)return void this.fire(new i.y(new Error("GeoJSON sources cannot have a sourceLayer parameter.")));if(R==="vector"&&!A)return void this.fire(new i.y(new Error("The sourceLayer parameter must be provided for vector source types.")));d.id===void 0&&this.fire(new i.y(new Error("The feature id parameter must be provided.")));const B=this.getOwnSourceCaches(j);for(const H of B)H.setFeatureState(A,d.id,m)}removeFeatureState(d,m){if(this._checkLoaded(),"target"in d){if("featuresetId"in d.target){const{featuresetId:H,importId:Y}=d.target,te=this.getFragmentStyle(Y),de=te.getFeaturesetLayers(H);for(const{source:ce,sourceLayer:ue}of de)te.removeFeatureState({id:d.id,source:ce,sourceLayer:ue},m)}else if("layerId"in d.target){const{layerId:H}=d.target,Y=this.getLayer(H);this.removeFeatureState({id:d.id,source:Y.source,sourceLayer:Y.sourceLayer},m)}return}const j=d.source,A=this._checkSource(j);if(!A)return;const O=A.type,R=O==="vector"?d.sourceLayer:void 0;if(O==="vector"&&!R)return void this.fire(new i.y(new Error("The sourceLayer parameter must be provided for vector source types.")));if(m&&typeof d.id!="string"&&typeof d.id!="number")return void this.fire(new i.y(new Error("A feature id is required to remove its specific state property.")));const B=this.getOwnSourceCaches(j);for(const H of B)H.removeFeatureState(R,d.id,m)}getFeatureState(d){if(this._checkLoaded(),"target"in d){let O;if("featuresetId"in d.target){const{featuresetId:R,importId:B}=d.target,H=this.getFragmentStyle(B),Y=H.getFeaturesetLayers(R);for(const{source:te,sourceLayer:de}of Y){const ce=H.getFeatureState({id:d.id,source:te,sourceLayer:de});if(ce&&!O)O=ce;else if(!i.by(O,ce))return void this.fire(new i.y(new Error("The same feature id exists in multiple sources in the featureset, but their feature states are not consistent through the sources.")))}}else if("layerId"in d.target){const{layerId:R}=d.target,B=this.getLayer(R);O=this.getFeatureState({id:d.id,source:B.source,sourceLayer:B.sourceLayer})}return O}const m=d.source,j=d.sourceLayer,A=this._checkSource(m);if(A){if(A.type!=="vector"||j)return d.id===void 0&&this.fire(new i.y(new Error("The feature id parameter must be provided."))),this.getOwnSourceCaches(m)[0].getFeatureState(j,d.id);this.fire(new i.y(new Error("The sourceLayer parameter must be provided for vector source types.")))}}setTransition(d){return this.stylesheet.transition=Object.assign({},this.stylesheet.transition,d),this.transition=this.stylesheet.transition,this}getTransition(){return Object.assign({},this.stylesheet.transition)}serialize(){this._checkLoaded();const d=this.getTerrain(),m=d&&this.terrain&&this.terrain.scope===this.scope?d:this.stylesheet.terrain;return i.dv({version:this.stylesheet.version,name:this.stylesheet.name,metadata:this.stylesheet.metadata,fragment:this.stylesheet.fragment,iconsets:this.stylesheet.iconsets,imports:this._serializeImports(),schema:this.stylesheet.schema,camera:this.stylesheet.camera,light:this.stylesheet.light,lights:this.stylesheet.lights,terrain:m,fog:this.stylesheet.fog,snow:this.stylesheet.snow,rain:this.stylesheet.rain,center:this.stylesheet.center,"color-theme":this.stylesheet["color-theme"],zoom:this.stylesheet.zoom,bearing:this.stylesheet.bearing,pitch:this.stylesheet.pitch,sprite:this.stylesheet.sprite,glyphs:this.stylesheet.glyphs,transition:this.stylesheet.transition,projection:this.stylesheet.projection,sources:this._serializeSources(),layers:this._serializeLayers(this._order)},j=>j!==void 0)}_updateFilteredLayers(d){for(const m of Object.values(this._mergedLayers))d(m)&&this._updateLayer(m)}_updateLayer(d){this._changes.updateLayer(d);const m=this.getLayerSourceCache(d),j=i.B(d.source,d.scope),A=this._changes.getUpdatedSourceCaches();d.source&&!A[j]&&m&&m.getSource().type!=="raster"&&(this._changes.updateSourceCache(j,"reload"),m.pause()),d.invalidateCompiledFilter()}_flattenAndSortRenderedFeatures(d){const m=B=>this._mergedLayers[B].is3D(!!this.terrain),j=this.order,A={},O=[];for(let B=j.length-1;B>=0;B--){const H=j[B];if(m(H)){A[H]=B;for(const Y of d){const te=Y[H];if(te)for(const de of te)O.push(de)}}}O.sort((B,H)=>H.intersectionZ-B.intersectionZ);const R=[];for(let B=j.length-1;B>=0;B--){const H=j[B];if(m(H))for(let Y=O.length-1;Y>=0;Y--){const te=O[Y].feature;if(te.layer&&A[te.layer.id]{if(Gk.has(te.type))return;const de=this.getOwnLayerSourceCache(te),ce=O[de.id]=O[de.id]||{sourceCache:de,layers:{},has3DLayers:!1};te.is3D(!!this.terrain)&&(ce.has3DLayers=!0),ce.layers[te.fqid]=ce.layers[te.fqid]||{styleLayer:te,targets:[]},ce.layers[te.fqid].targets.push({filter:A})};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 te of m.layers){const de=this._layers[te];if(!de)return this.fire(new i.y(new Error(`The layer '${te}' does not exist in the map's style and cannot be queried for features.`))),[];R(de)}}else for(const te in this._layers)R(this._layers[te]);const B=this._queryRenderedFeatures(d,O,j),H=this._flattenAndSortRenderedFeatures(B),Y=[];for(const te of H)i.dw(te.layer.id)===this.scope&&Y.push(te);return Y}queryRenderedFeatureset(d,m,j){let A;m&&!Array.isArray(m)&&m.filter&&(this._validate(go,"queryRenderedFeatures.filter",m.filter,null,m),A=i.b6(m.filter));const O="mock",R=[];if(m&&m.target)R.push(Object.assign({},m,{targetId:O,filter:A}));else{const te=this.getFeaturesetDescriptors();for(const de of te)R.push({targetId:O,filter:A,target:de});for(const{style:de}of this.fragments){const ce=de.getFeaturesetDescriptors();for(const ue of ce)R.push({targetId:O,filter:A,target:ue})}}const B=this.queryRenderedTargets(d,R,j),H=[],Y=new Set;for(const te of B)for(const de of te.variants[O])Wm(de,te,Y)||H.push(new i.dx(te,de));return H}queryRenderedTargets(d,m,j){const A={},O=(B,H,Y,te)=>{const de=A[H.id]=A[H.id]||{sourceCache:H,layers:{},has3DLayers:!1};if(de.layers[B.fqid]=de.layers[B.fqid]||{styleLayer:B,targets:[]},B.is3D(!!this.terrain)&&(de.has3DLayers=!0),!te)return Y.uniqueFeatureID=!1,void de.layers[B.fqid].targets.push(Y);de.layers[B.fqid].targets.push(Object.assign({},Y,{namespace:te.namespace,properties:te.properties,uniqueFeatureID:te.uniqueFeatureID}))};for(const B of m)if("featuresetId"in B.target){const{featuresetId:H,importId:Y}=B.target,te=this.getFragmentStyle(Y);if(!te||!te._featuresetSelectors)continue;const de=te._featuresetSelectors[H];if(!de){this.fire(new i.y(new Error(`The featureset '${H}' does not exist in the map's style and cannot be queried for features.`)));continue}for(const ce of de){const ue=te.getOwnLayer(ce.layerId);ue&&!Gk.has(ue.type)&&O(ue,te.getOwnLayerSourceCache(ue),B,ce)}}else if("layerId"in B.target){const{layerId:H}=B.target,Y=this.getLayer(H);if(!Y||Gk.has(Y.type))continue;O(Y,this.getLayerSourceCache(Y),B)}const R=this._queryRenderedFeatures(d,A,j);return this._flattenAndSortRenderedFeatures(R)}_queryRenderedFeatures(d,m,j){const A=[],O=!!this.map._showQueryGeometry,R=Li.createFromScreenPoints(d,j);for(const B in m){const H=Gy(R,m[B],this._availableImages,j,O);Object.keys(H).length&&A.push(H)}if(this.placement)for(const B in m){if(!m[B].sourceCache._onlySymbols)continue;const H=Ky(R.screenGeometry,m[B],this._availableImages,this.placement.collisionIndex,this.placement.retainedQueryData,this.map.getWorldview());Object.keys(H).length&&A.push(H)}return A}querySourceFeatures(d,m){const j=m&&m.filter;j&&this._validate(go,"querySourceFeatures.filter",j,null,m);let A=[];const O=this.getOwnSourceCaches(d);for(const R of O)A=A.concat(Zy(R,m));return A}addSourceType(d,m,j){return dh.getSourceType(d)?j(new Error(`A source type called "${d}" already exists.`)):(dh.setSourceType(d,m),m.workerSourceURL?void this.dispatcher.broadcast("loadWorkerSource",{name:d,url:m.workerSourceURL},j):j(null,null))}getFlatLight(){return this.light.getLight()}setFlatLight(d,m,j={}){this._checkLoaded();const A=this.light.getLight();let O=!1;for(const B in d)if(!i.by(d[B],A[B])){O=!0;break}if(!O)return;const R=this._getTransitionParameters();this.light.setLight(d,m,j),this.light.updateTransitions(R)}getTerrain(){return this.terrain&&this.terrain.drapeRenderMode===1?this.terrain.get():null}setTerrainForDraping(){this.setTerrain({source:"",exaggeration:0},0)}checkCanvasFingerprintNoise(){this.disableElevatedTerrain===void 0&&(this.disableElevatedTerrain=i.o.hasCanvasFingerprintNoise(),this.disableElevatedTerrain&&i.w("Terrain and hillshade are disabled because of Canvas2D limitations when fingerprinting protection is enabled (e.g. in private browsing mode)."))}setTerrain(d,m=1){if(this._checkLoaded(),!d)return this.terrainSetForDrapingOnly()||(delete this.terrain,this.map.transform.projection.requiresDraping&&this.setTerrainForDraping()),m===0&&delete this.terrain,d===null?this.stylesheet.terrain=null:delete this.stylesheet.terrain,this._force3DLayerUpdate(),void(this._markersNeedUpdate=!0);this.checkCanvasFingerprintNoise();let j=d;const A=!("source"in d)||d.source==null;if(m===1){if(this.disableElevatedTerrain)return;if("source"in j&&typeof j.source=="object"){const B="terrain-dem-src";this.addSource(B,j.source),j=i.dp(j),j=Object.assign(j,{source:B})}const O=Object.assign({},j),R={};if(this.terrain&&A){O.source=this.terrain.get().source;const B=this.terrain?this.getFragmentStyle(this.terrain.scope):null;B&&(R.style=B.serialize())}if(this._validate(no,"terrain",O,R))return}if(!this.terrain||this.terrain.scope!==this.scope&&!A||this.terrain&&m!==this.terrain.drapeRenderMode){if(!j)return;this._createTerrain(j,m),this.fire(new i.z("data",{dataType:"style"}))}else{const O=this.terrain,R=O.get();for(const B of Object.keys(i.a6.terrain))!j.hasOwnProperty(B)&&i.a6.terrain[B].default&&(j[B]=i.a6.terrain[B].default);for(const B in d)if(!i.by(d[B],R[B])){O.set(d,this.options),this.stylesheet.terrain=d;const H=this._getTransitionParameters({duration:0});O.updateTransitions(H),this.fire(new i.z("data",{dataType:"style"}));break}}this.mergeTerrain(),this.updateDrapeFirstLayers(),this._markersNeedUpdate=!0}_createFog(d){const m=this.fog=new es(d,this.map.transform,this.scope,this.options);this.stylesheet.fog=m.get();const j=this._getTransitionParameters({duration:0});m.updateTransitions(j)}_createSnow(d){const m=this.snow=new No(d,this.map.transform,this.scope,this.options);this.stylesheet.snow=m.get();const j=this._getTransitionParameters({duration:0});m.updateTransitions(j)}_createRain(d){const m=this.rain=new Pi(d,this.map.transform,this.scope,this.options);this.stylesheet.rain=m.get();const j=this._getTransitionParameters({duration:0});m.updateTransitions(j)}_updateMarkersOpacity(){this.map._markers.length!==0&&this.map._requestDomTask(()=>{for(const d of this.map._markers)d._evaluateOpacity()})}getFog(){return this.fog?this.fog.get():null}setFog(d){if(this._checkLoaded(),!d)return delete this.fog,delete this.stylesheet.fog,void(this._markersNeedUpdate=!0);if(this.fog){const m=this.fog;if(!i.by(m.get(),d)){m.set(d,this.options),this.stylesheet.fog=m.get();const j=this._getTransitionParameters({duration:0});m.updateTransitions(j)}}else this._createFog(d);this._markersNeedUpdate=!0}getSnow(){return this.snow?this.snow.get():null}setSnow(d){if(this._checkLoaded(),!d)return delete this.snow,void delete this.stylesheet.snow;if(this.snow){const m=this.snow;if(!i.by(m.get(),d)){m.set(d,this.options),this.stylesheet.snow=m.get();const j=this._getTransitionParameters({duration:0});m.updateTransitions(j)}}else this._createSnow(d);this._markersNeedUpdate=!0}getRain(){return this.rain?this.rain.get():null}setRain(d){if(this._checkLoaded(),!d)return delete this.rain,void delete this.stylesheet.rain;if(this.rain){const m=this.rain;if(!i.by(m.get(),d)){m.set(d,this.options),this.stylesheet.rain=m.get();const j=this._getTransitionParameters({duration:0});m.updateTransitions(j)}}else this._createRain(d);this._markersNeedUpdate=!0}_reloadColorTheme(){const d=()=>{for(const A in this._layers)this._layers[A].lut=this._styleColorTheme.lut;for(const A in this._sourceCaches)this._sourceCaches[A].clearTiles()},m=this._styleColorTheme.colorThemeOverride?this._styleColorTheme.colorThemeOverride:this._styleColorTheme.colorTheme;if(!m)return this._styleColorTheme.lut=null,void d();const j=this._evaluateColorThemeData(m);this._loadColorTheme(j).then(()=>{this.fire(new i.z("colorthemeset")),d()}).catch(A=>{i.w(`Couldn't set color theme: ${A}`)})}setColorTheme(d){this._checkLoaded(),this._styleColorTheme.colorThemeOverride&&i.w("Note: setColorTheme is called on a style with a color-theme override, the passed color-theme won't be visible."),this._styleColorTheme.colorTheme=d,this._reloadColorTheme()}setImportColorTheme(d,m){const j=this.getFragmentStyle(d);j&&(j._styleColorTheme.colorThemeOverride=m,j._reloadColorTheme())}_getTransitionParameters(d){return{now:i.o.now(),transition:Object.assign(this.transition,d)}}updateDrapeFirstLayers(){if(!this.terrain)return;const d=[],m=[];for(const j of this._mergedOrder)this.isLayerDraped(this._mergedLayers[j])?d.push(j):m.push(j);this._drapedFirstOrder=[],this._drapedFirstOrder.push(...d),this._drapedFirstOrder.push(...m)}_createTerrain(d,m){const j=this.terrain=new Lt(d,m,this.scope,this.options,this.map.getWorldview());m===1&&(this.stylesheet.terrain=d),this.mergeTerrain(),this.updateDrapeFirstLayers(),this._force3DLayerUpdate();const A=this._getTransitionParameters({duration:0});j.updateTransitions(A)}_force3DLayerUpdate(){for(const d in this._layers){const m=this._layers[d];m.type==="fill-extrusion"&&this._updateLayer(m)}}_forceSymbolLayerUpdate(){for(const d in this._layers){const m=this._layers[d];m.type==="symbol"&&this._updateLayer(m)}}_validate(d,m,j,A,O={}){if(O&&O.validate===!1)return!1;const R=Object.assign({},this.serialize());return Xm(this,d.call(Os,Object.assign({key:m,style:R,value:j,styleSpec:i.a6},A)))}_remove(){this._request&&(this._request.cancel(),this._request=null),this._spriteRequest&&(this._spriteRequest.cancel(),this._spriteRequest=null),i.dy.off("pluginStateChange",this._rtlTextPluginCallback);for(const d in this._mergedLayers)this._mergedLayers[d].setEventedParent(null);for(const d in this._mergedSourceCaches)this._mergedSourceCaches[d].clearTiles(),this._mergedSourceCaches[d].setEventedParent(null);this.imageManager.removeScope(this.scope),this.setEventedParent(null),delete this.fog,delete this.snow,delete this.rain,delete this.terrain,delete this.ambientLight,delete this.directionalLight,this.isRootStyle()&&(this.imageManager.setEventedParent(null),this.imageManager.destroy(),this.modelManager.setEventedParent(null),this.modelManager.destroy(),this.dispatcher.remove())}clearSource(d){const m=this.getSourceCaches(d);for(const j of m)j.clearTiles()}clearSources(){for(const d in this._mergedSourceCaches)this._mergedSourceCaches[d].clearTiles()}clearLayers(){for(const d in this._mergedLayers){const m=this._mergedLayers[d];m._clear&&m._clear()}}reloadSource(d){const m=this.getSourceCaches(d);for(const j of m)j.resume(),j.reload()}reloadSources(){for(const d of this.getSources())d.reload&&d.reload()}reloadModels(){this.modelManager.reloadModels(""),this.forEachFragmentStyle(d=>{d.modelManager.reloadModels(d.scope)})}updateSources(d){let m;this.directionalLight&&(m=Uv(this.directionalLight));const j=new Set,A=new Set;for(const O in this._mergedLayers){const R=this._mergedLayers[O];R.type==="building"&&j.add(R.source),R.hasElevation()&&!A.has(R.source)&&A.add(R.source)}for(const O in this._mergedSourceCaches){const R=this._mergedSourceCaches[O],B=A.has(R._source.id);j.has(R._source.id)&&(R._source.reparseOverscaled=!1),R.update(d,void 0,void 0,m,B)}}_generateCollisionBoxes(){for(const d in this._sourceCaches){const m=this._sourceCaches[d];m.resume(),m.reload()}}_updatePlacement(d,m,j,A,O,R,B=!1){let H=!1,Y=!1;const te={},de={};for(const ve of this._mergedOrder){const Re=this._mergedLayers[ve];if(Re.type!=="symbol")continue;const Le=i.B(Re.source,Re.scope);let We=te[Le];if(!We){const Ke=this.getLayerSourceCache(Re);if(!Ke)continue;const wt=Ke.getRenderableIds(!0).map(mt=>Ke.getTileByID(mt));de[Le]=wt.slice(),We=te[Le]=wt.sort((mt,vt)=>vt.tileID.overscaledZ-mt.tileID.overscaledZ||(mt.tileID.isLessThan(vt.tileID)?-1:1))}const rt=this.crossTileSymbolIndex.addLayer(Re,We,m.center.lng,m.projection);H=H||rt}this.crossTileSymbolIndex.pruneUnusedLayers(this._mergedOrder),B=B||this._layerOrderChanged,this._layerOrderChanged&&this.fire(new i.z("neworder"));const ce=!!(this.placement&&!m.equals(this.placement.transform)),ue=!!(this.placement&&(this.placement.lastReplacementSourceUpdateTime!==0&&!R||this.placement.lastReplacementSourceUpdateTime!==R.updateTime)),je=(ce||ue||H||this.placement&&this.placement.isStale())&&A===0;if((B||!this.pauseablePlacement||je||A!==0&&this.pauseablePlacement.isDone()&&!this.placement.stillRecent(i.o.now(),m.zoom))&&(this.pauseablePlacement=new bl(m,this._mergedOrder,B||A===0,j,A,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,te,de,this.map.painter.scaleFactor),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(i.o.now()),Y=!0),H&&this.pauseablePlacement.placement.setStale()),Y||H){this._buildingIndex.onNewFrame(m.zoom);for(let ve=0;veO===d.id)!==-1)return void this.fire(new i.y(new Error(`Import with id '${d.id}' already exists in the map's style.`)));if(!m)return j.push(d),this._loadImports([d],!0);const A=j.findIndex(({id:O})=>O===m);return A===-1&&this.fire(new i.y(new Error(`Import with id "${m}" does not exist on this map.`))),this.stylesheet.imports=j.slice(0,A).concat(d).concat(j.slice(A)),this._loadImports([d],!0,m)}updateImport(d,m){this._checkLoaded();const j=this.stylesheet.imports||[],A=this.getImportIndex(d);return A===-1?this:typeof m=="string"?(this.setImportUrl(d,m),this):(m.url&&m.url!==j[A].url&&this.setImportUrl(d,m.url),i.by(m.config,j[A].config)||this.setImportConfig(d,m.config,m.data.schema),i.by(m.data,j[A].data)||this.setImportData(d,m.data),this)}moveImport(d,m){this._checkLoaded();let j=this.stylesheet.imports||[];const A=this.getImportIndex(d);if(A===-1)return this;const O=this.getImportIndex(m);if(O===-1)return this;const R=j[A],B=this.fragments[A];return j=j.filter(({id:H})=>H!==d),this.fragments=this.fragments.filter(({id:H})=>H!==d),this.stylesheet.imports=j.slice(0,O).concat(R).concat(j.slice(O)),this.fragments=this.fragments.slice(0,O).concat(B).concat(this.fragments.slice(O)),this.mergeLayers(),this}setImportUrl(d,m){this._checkLoaded();const j=this.stylesheet.imports||[],A=this.getImportIndex(d);if(A===-1)return this;j[A].url=m;const O=this.fragments[A];return O.style=this._createFragmentStyle(j[A]),O.style.on("style.import.load",()=>this.mergeAll()),O.style.loadURL(m),this}setImportData(d,m){this._checkLoaded();const j=this.getImportIndex(d),A=this.stylesheet.imports||[];return j===-1?this:m?(this.fragments[j].style.setState(m),this._reloadImports(),this):(delete A[j].data,this.setImportUrl(d,A[j].url))}setImportConfig(d,m,j){this._checkLoaded();const A=this.getImportIndex(d),O=this.stylesheet.imports||[];if(A===-1)return this;m?O[A].config=m:delete O[A].config;const R=this.fragments[A];j&&R.style.stylesheet&&(R.style.stylesheet.schema=j);const B=R.style.stylesheet&&R.style.stylesheet.schema;return R.config=m,R.style.updateConfig(m,B),this.updateConfigDependencies(),this}removeImport(d){this._checkLoaded();const m=this.stylesheet.imports||[],j=this.getImportIndex(d);j!==-1&&(m.splice(j,1),this.fragments[j].style._remove(),this.fragments.splice(j,1),this._reloadImports())}getImportIndex(d){const m=(this.stylesheet.imports||[]).findIndex(j=>j.id===d);return m===-1&&this.fire(new i.y(new Error(`Import '${d}' does not exist in the map's style and cannot be updated.`))),m}getLayer(d){return this._mergedLayers[d]}getSources(){const d=[];for(const m in this._mergedOtherSourceCaches){const j=this._mergedOtherSourceCaches[m];j&&d.push(j.getSource())}return d}getSource(d,m){const j=this.getSourceCache(d,m);return j&&j.getSource()}getLayerSource(d){const m=this.getLayerSourceCache(d);return m&&m.getSource()}getSourceCache(d,m){const j=i.B(d,m);return this._mergedOtherSourceCaches[j]}getLayerSourceCache(d){const m=i.B(d.source,d.scope);return d.type==="symbol"?this._mergedSymbolSourceCaches[m]:this._mergedOtherSourceCaches[m]}getSourceCaches(d){if(d==null)return Object.values(this._mergedSourceCaches);const m=[];return this._mergedOtherSourceCaches[d]&&m.push(this._mergedOtherSourceCaches[d]),this._mergedSymbolSourceCaches[d]&&m.push(this._mergedSymbolSourceCaches[d]),m}updateSourceCaches(){const d=this._changes.getUpdatedSourceCaches();for(const m in d){const j=d[m];j==="reload"?this.reloadSource(m):j==="clear"&&this.clearSource(m)}}updateLayers(d){const m=this._changes.getUpdatedPaintProperties();for(const j of m){const A=this.getLayer(j);A&&A.updateTransitions(d)}}getGlyphsUrl(){return this.stylesheet.glyphs}setGlyphsUrl(d){this.stylesheet.glyphs=d,this.glyphManager.setURL(d)}getImages(d,m,j){this.imageManager.getImages(m.images,m.scope,j),this._updateTilesForChangedImages();const A=R=>{if(R){const B=m.images.map(H=>i.I.toString(H));R.setDependencies(m.tileID.key,m.type,B)}},O=i.B(m.source,m.scope);A(this._mergedOtherSourceCaches[O]),A(this._mergedSymbolSourceCaches[O]),m.images.some(R=>R.iconsetId)&&this.fire(new i.z("data",{dataType:"style"}))}rasterizeImages(d,m,j){this.imageManager.rasterizeImages(m,j)}getGlyphs(d,m,j){this.glyphManager.getGlyphs(m.stacks,j)}getResource(d,m,j){return i.dz(m,j)}getOwnSourceCache(d){return this._otherSourceCaches[d]}getOwnLayerSourceCache(d){return d.type==="symbol"?this._symbolSourceCaches[d.source]:this._otherSourceCaches[d.source]}getOwnSourceCaches(d){const m=[];return this._otherSourceCaches[d]&&m.push(this._otherSourceCaches[d]),this._symbolSourceCaches[d]&&m.push(this._symbolSourceCaches[d]),m}_isSourceCacheLoaded(d){const m=this.getOwnSourceCaches(d);return m.length===0?(this.fire(new i.y(new Error(`There is no source with ID '${d}'`))),!1):m.every(j=>j.loaded())}has3DLayers(){return this._has3DLayers}hasSymbolLayers(){return this._hasSymbolLayers}hasCircleLayers(){return this._hasCircleLayers}isLayerClipped(d,m){if(!this._clipLayerPresent&&d.type!=="fill-extrusion"&&d.type!=="building")return!1;const j=d.type==="fill-extrusion"&&(d.sourceLayer==="building"||d.sourceLayer==="procedural_buildings"),A=d.type==="building";if(d.is3D(!!this.terrain)){if(j||A||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)}}dh.getSourceType=function(w){return ih[w]},dh.setSourceType=function(w,d){ih[w]=d},dh.registerForPluginStateChange=i.dA;class OP extends i.E{constructor(d){super(),this._style=d,this._buildings={},this._activeFloors=new Set,this._activeFloorsVisible=!0,this._indoorState={selectedFloorId:null,lastActiveFloors:null,activeFloorsVisible:!0},i.aY(["_updateUI"],this)}destroy(){this._buildings={},this._activeFloors=new Set,this._indoorState=null}selectFloor(d){d===this._selectedFloorId&&this._activeFloorsVisible||(this._selectedFloorId=d,this._activeFloorsVisible=!0,this._updateActiveFloors())}setActiveFloorsVisibility(d){this._activeFloorsVisible=d,this._updateActiveFloors(),this._updateIndoorSelector()}setIndoorData(d){for(const[m,j]of Object.entries(d.buildings))if(this._buildings[m])for(const A of j.floorIds)this._buildings[m].floors[A]||(this._buildings[m].floors[A]=j.floors[A]);else this._buildings[m]=j;for(const m of d.activeFloors)this._activeFloors.add(m);this._updateIndoorSelector()}getIndoorTileOptions(d,m){const j=this._style.getIndoorSourceLayers(d,m);return j&&this._indoorState?{sourceLayers:j,indoorState:this._indoorState}:null}_updateUI(d,m,j){const A=function(O,R,B,H){let Y=null,te=Number.MAX_SAFE_INTEGER;if(H<16)return null;for(const[de,ce]of Object.entries(O)){const ue=ce.center;if(ue){const je=R.distanceTo(i.aT.convert(ue));je({id:R,name:j.floors[R].name,zIndex:j.floors[R].zIndex})).sort((R,B)=>B.zIndex-R.zIndex);this.fire(new i.z("selector-update",{selectedFloorId:A,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 n0=` #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`,s0=` #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;}`,l5=` #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`,Kk="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;}",Iu=` #define ELEVATION_SCALE 7.0 #define ELEVATION_OFFSET 450.0 #ifdef PROJECTION_GLOBE_VIEW uniform vec3 u_tile_tl_up;uniform vec3 u_tile_tr_up;uniform vec3 u_tile_br_up;uniform vec3 u_tile_bl_up;uniform float u_tile_up_scale;vec3 elevationVector(vec2 pos) {vec2 uv=pos/EXTENT;vec3 up=normalize(mix( mix(u_tile_tl_up,u_tile_tr_up,uv.xxx),mix(u_tile_bl_up,u_tile_br_up,uv.xxx),uv.yyy));return up*u_tile_up_scale;} #else vec3 elevationVector(vec2 pos) { return vec3(0,0,1); } #endif #ifdef TERRAIN uniform highp sampler2D u_dem;uniform highp sampler2D u_dem_prev;uniform vec2 u_dem_tl;uniform vec2 u_dem_tl_prev;uniform float u_dem_scale;uniform float u_dem_scale_prev;uniform float u_dem_size;uniform float u_dem_lerp;uniform float u_exaggeration;uniform float u_meter_to_dem;uniform mat4 u_label_plane_matrix_inv;vec4 tileUvToDemSample(vec2 uv,float dem_size,float dem_scale,vec2 dem_tl) {vec2 pos=dem_size*(uv*dem_scale+dem_tl)+1.0;vec2 f=fract(pos);return vec4((pos-f+0.5)/(dem_size+2.0),f);}float currentElevation(vec2 apos) { #ifdef TERRAIN_DEM_FLOAT_FORMAT vec2 pos=(u_dem_size*(apos/8192.0*u_dem_scale+u_dem_tl)+1.5)/(u_dem_size+2.0);return u_exaggeration*texture(u_dem,pos).r; #else float dd=1.0/(u_dem_size+2.0);vec4 r=tileUvToDemSample(apos/8192.0,u_dem_size,u_dem_scale,u_dem_tl);vec2 pos=r.xy;vec2 f=r.zw;float tl=texture(u_dem,pos).r;float tr=texture(u_dem,pos+vec2(dd,0)).r;float bl=texture(u_dem,pos+vec2(0,dd)).r;float br=texture(u_dem,pos+vec2(dd,dd)).r;return u_exaggeration*mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y); #endif }float prevElevation(vec2 apos) { #ifdef TERRAIN_DEM_FLOAT_FORMAT vec2 pos=(u_dem_size*(apos/8192.0*u_dem_scale_prev+u_dem_tl_prev)+1.5)/(u_dem_size+2.0);return u_exaggeration*texture(u_dem_prev,pos).r; #else float dd=1.0/(u_dem_size+2.0);vec4 r=tileUvToDemSample(apos/8192.0,u_dem_size,u_dem_scale_prev,u_dem_tl_prev);vec2 pos=r.xy;vec2 f=r.zw;float tl=texture(u_dem_prev,pos).r;float tr=texture(u_dem_prev,pos+vec2(dd,0)).r;float bl=texture(u_dem_prev,pos+vec2(0,dd)).r;float br=texture(u_dem_prev,pos+vec2(dd,dd)).r;return u_exaggeration*mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y); #endif } #ifdef TERRAIN_VERTEX_MORPHING float elevation(vec2 apos) { #ifdef ZERO_EXAGGERATION return 0.0; #endif float nextElevation=currentElevation(apos);float prevElevation=prevElevation(apos);return mix(prevElevation,nextElevation,u_dem_lerp);} #else float elevation(vec2 apos) { #ifdef ZERO_EXAGGERATION return 0.0; #endif return currentElevation(apos);} #endif vec4 fourSample(vec2 pos,vec2 off) {float tl=texture(u_dem,pos).r;float tr=texture(u_dem,pos+vec2(off.x,0.0)).r;float bl=texture(u_dem,pos+vec2(0.0,off.y)).r;float br=texture(u_dem,pos+off).r;return vec4(tl,tr,bl,br);}float flatElevation(vec2 pack) {vec2 apos=floor(pack/8.0);vec2 span=10.0*(pack-apos*8.0);vec2 uvTex=(apos-vec2(1.0,1.0))/8190.0;float size=u_dem_size+2.0;float dd=1.0/size;vec2 pos=u_dem_size*(uvTex*u_dem_scale+u_dem_tl)+1.0;vec2 f=fract(pos);pos=(pos-f+0.5)*dd;vec4 h=fourSample(pos,vec2(dd));float z=mix(mix(h.x,h.y,f.x),mix(h.z,h.w,f.x),f.y);vec2 w=floor(0.5*(span*u_meter_to_dem-1.0));vec2 d=dd*w;h=fourSample(pos-d,2.0*d+vec2(dd));vec4 diff=abs(h.xzxy-h.ywzw);vec2 slope=min(vec2(0.25),u_meter_to_dem*0.5*(diff.xz+diff.yw)/(2.0*w+vec2(1.0)));vec2 fix=slope*span;float base=z+max(fix.x,fix.y);return u_exaggeration*base;}float elevationFromUint16(float word) {return u_exaggeration*(word/ELEVATION_SCALE-ELEVATION_OFFSET);} #else float elevation(vec2 pos) { return 0.0; } #endif #ifdef DEPTH_OCCLUSION uniform highp sampler2D u_depth;uniform highp vec2 u_depth_size_inv;uniform highp vec2 u_depth_range_unpack;uniform highp float u_occluder_half_size;uniform highp float u_occlusion_depth_offset; #ifdef DEPTH_D24 float unpack_depth(float depth) {return depth*u_depth_range_unpack.x+u_depth_range_unpack.y;}vec4 unpack_depth4(vec4 depth) {return depth*u_depth_range_unpack.x+vec4(u_depth_range_unpack.y);} #else highp float unpack_depth_rgba(vec4 rgba_depth) {const highp vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);return dot(rgba_depth,bit_shift)*2.0-1.0;} #endif bool isOccluded(vec4 frag) {vec3 coord=frag.xyz/frag.w; #ifdef CLIP_ZERO_TO_ONE coord.z=-1.0+2.0*coord.z; #endif #ifdef DEPTH_D24 float depth=unpack_depth(texture(u_depth,(coord.xy+1.0)*0.5).r); #else float depth=unpack_depth_rgba(texture(u_depth,(coord.xy+1.0)*0.5)); #endif return coord.z+u_occlusion_depth_offset > depth;}highp vec4 getCornerDepths(vec2 coord) {highp vec3 df=vec3(u_occluder_half_size*u_depth_size_inv,0.0);highp vec2 uv=0.5*coord.xy+0.5; #ifdef DEPTH_D24 highp vec4 depth=vec4( texture(u_depth,uv-df.xz).r,texture(u_depth,uv+df.xz).r,texture(u_depth,uv-df.zy).r,texture(u_depth,uv+df.zy).r );depth=unpack_depth4(depth); #else highp vec4 depth=vec4( unpack_depth_rgba(texture(u_depth,uv-df.xz)),unpack_depth_rgba(texture(u_depth,uv+df.xz)),unpack_depth_rgba(texture(u_depth,uv-df.zy)),unpack_depth_rgba(texture(u_depth,uv+df.zy)) ); #endif return depth;}highp float occlusionFadeMultiSample(vec4 frag) {highp vec3 coord=frag.xyz/frag.w;highp vec2 uv=0.5*coord.xy+0.5; #ifdef CLIP_ZERO_TO_ONE coord.z=-1.0+2.0*coord.z; #endif int NX=3;int NY=4;highp vec2 df=u_occluder_half_size*u_depth_size_inv;highp vec2 oneStep=2.0*u_occluder_half_size*u_depth_size_inv/vec2(NX-1,NY-1);highp float res=0.0;for (int y=0; y < NY;++y) {for (int x=0; x < NX;++x) { #ifdef DEPTH_D24 highp float depth=unpack_depth(texture(u_depth,uv-df+vec2(float(x)*oneStep.x,float(y)*oneStep.y)).r); #else highp float depth=unpack_depth_rgba(texture(u_depth,uv-df+vec2(float(x)*oneStep.x,float(y)*oneStep.y))); #endif res+=1.0-clamp(300.0*(coord.z+u_occlusion_depth_offset-depth),0.0,1.0);}}res=clamp(2.0*res/float(NX*NY)-0.5,0.0,1.0);return res;}highp float occlusionFade(vec4 frag) {highp vec3 coord=frag.xyz/frag.w; #ifdef CLIP_ZERO_TO_ONE coord.z=-1.0+2.0*coord.z; #endif highp vec4 depth=getCornerDepths(coord.xy);return dot(vec4(0.25),vec4(1.0)-clamp(300.0*(vec4(coord.z+u_occlusion_depth_offset)-depth),0.0,1.0));} #else bool isOccluded(vec4 frag) { return false; }highp float occlusionFade(vec4 frag) { return 1.0; }highp float occlusionFadeMultiSample(vec4 frag) { return 1.0; } #endif`,Zk=`#ifdef FOG uniform mediump vec4 u_fog_color;uniform mediump vec2 u_fog_range;uniform mediump float u_fog_horizon_blend;uniform mediump mat4 u_fog_matrix;out vec3 v_fog_pos;float fog_range(float depth) {return (depth-u_fog_range[0])/(u_fog_range[1]-u_fog_range[0]);}float fog_horizon_blending(vec3 camera_dir) {float t=max(0.0,camera_dir.z/u_fog_horizon_blend);return u_fog_color.a*exp(-3.0*t*t);}float fog_opacity(float t) {const float decay=6.0;float falloff=1.0-min(1.0,exp(-decay*t));falloff*=falloff*falloff;return u_fog_color.a*min(1.0,1.00747*falloff);}vec3 fog_position(vec3 pos) {return (u_fog_matrix*vec4(pos,1.0)).xyz;}vec3 fog_position(vec2 pos) {return fog_position(vec3(pos,0.0));}float fog(vec3 pos) {float depth=length(pos);float opacity=fog_opacity(fog_range(depth));return opacity*fog_horizon_blending(pos/depth);} #endif`,Cr=`#ifdef FOG uniform mediump vec4 u_fog_color;uniform mediump vec2 u_fog_range;uniform mediump float u_fog_horizon_blend;uniform mediump vec2 u_fog_vertical_limit;uniform mediump float u_fog_temporal_offset;in vec3 v_fog_pos;uniform highp vec3 u_frustum_tl;uniform highp vec3 u_frustum_tr;uniform highp vec3 u_frustum_br;uniform highp vec3 u_frustum_bl;uniform highp vec3 u_globe_pos;uniform highp float u_globe_radius;uniform highp vec2 u_viewport;uniform float u_globe_transition;uniform int u_is_globe;float fog_range(float depth) {return (depth-u_fog_range[0])/(u_fog_range[1]-u_fog_range[0]);}float fog_horizon_blending(vec3 camera_dir) {float t=max(0.0,camera_dir.z/u_fog_horizon_blend);return u_fog_color.a*exp(-3.0*t*t);}float fog_opacity(float t) {const float decay=6.0;float falloff=1.0-min(1.0,exp(-decay*t));falloff*=falloff*falloff;return u_fog_color.a*min(1.0,1.00747*falloff);}float globe_glow_progress() {highp vec2 uv=gl_FragCoord.xy/u_viewport; #ifdef FLIP_Y uv.y=1.0-uv.y; #endif highp vec3 ray_dir=mix( mix(u_frustum_tl,u_frustum_tr,uv.x),mix(u_frustum_bl,u_frustum_br,uv.x),1.0-uv.y);highp vec3 dir=normalize(ray_dir);highp vec3 closest_point=dot(u_globe_pos,dir)*dir;highp float sdf=length(closest_point-u_globe_pos)/u_globe_radius;return sdf+PI*0.5;}float fog_opacity(vec3 pos) {float depth=length(pos);return fog_opacity(fog_range(depth));}vec3 fog_apply(vec3 color,vec3 pos,float opacity_limit) {float depth=length(pos);float opacity;if (u_is_globe==1) {float glow_progress=globe_glow_progress();float t=mix(glow_progress,depth,u_globe_transition);opacity=fog_opacity(fog_range(t));} else {opacity=fog_opacity(fog_range(depth));opacity*=fog_horizon_blending(pos/depth);}return mix(color,u_fog_color.rgb,min(opacity,opacity_limit));}vec3 fog_apply(vec3 color,vec3 pos) {return fog_apply(color,pos,1.0);}vec4 fog_apply_from_vert(vec4 color,float fog_opac) {float alpha=EPSILON+color.a;color.rgb=mix(color.rgb/alpha,u_fog_color.rgb,fog_opac)*alpha;return color;}vec3 fog_apply_sky_gradient(vec3 camera_ray,vec3 sky_color) {float horizon_blend=fog_horizon_blending(normalize(camera_ray));return mix(sky_color,u_fog_color.rgb,horizon_blend);}vec4 fog_apply_premultiplied(vec4 color,vec3 pos) {float alpha=EPSILON+color.a;color.rgb=fog_apply(color.rgb/alpha,pos)*alpha;return color;}vec4 fog_apply_premultiplied(vec4 color,vec3 pos,float heightMeters) {float verticalProgress=(u_fog_vertical_limit.x > 0.0 || u_fog_vertical_limit.y > 0.0) ? smoothstep(u_fog_vertical_limit.x,u_fog_vertical_limit.y,heightMeters) : 0.0;float opacityLimit=1.0-smoothstep(0.9,1.0,fog_opacity(pos));return mix(fog_apply_premultiplied(color,pos),color,min(verticalProgress,opacityLimit));}vec3 fog_dither(vec3 color) {return color;}vec4 fog_dither(vec4 color) {return vec4(fog_dither(color.rgb),color.a);} #endif`,c5=`#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`,Yk=`#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;}`,Xk=`#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`,d5=`#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 Vv=/#include\s+"([^"]+)"/g,Of=/#pragma mapbox: ([\w\-]+) ([\w]+) ([\w]+) ([\w]+)/g,u5=/\b[A-Za-z_][A-Za-z0-9_]*\b/g,hx=new Set(["ifdef","ifndef","elif","if","defined"]),fx=new Set;eg(n0,fx),eg(l5,fx),eg(s0,fx);const Jm={"_prelude_fog.vertex.glsl":Zk,"_prelude_terrain.vertex.glsl":Iu,"_prelude_shadow.vertex.glsl":Xk,"_prelude_material_table.vertex.glsl":`#ifdef HAS_SHADER_STORAGE_BLOCK_material_buffer #define MATERIAL_TABLE_DEBUG 0 uniform int u_material_offset;uniform int u_vertex_offset;layout(std140,binding=0)readonly buffer material_buffer{uvec4 material_data[];};struct MaterialInfo{uint dataOffset; #if MATERIAL_TABLE_DEBUG vec4 colorDebug; #endif };uint read_buf_no_offset(uint iDword) {return material_data[iDword/4u][iDword % 4u];}uint read_buf(uint iDword) {iDword+=uint(u_material_offset/4);return read_buf_no_offset(iDword);}float read_buf_float(uint iDword){return uintBitsToFloat(read_buf(iDword));}uint read_buf_uint8(uint iDword,uint iUint8){uint dwordOffset=iDword+(iUint8/4u);uint byteOffset=iUint8 & 3u;uint bitOffset=8u*byteOffset;uint mask=0xffu << bitOffset;uint dwordVal=read_buf(dwordOffset);return (dwordVal & mask) >> bitOffset;}uint read_buf_uint16(uint iDword,uint iUint16){uint dwordOffset=iDword+(iUint16 >> 1u);uint bitOffset=(iUint16 & 1u)*16u;uint mask=0xffffu << bitOffset;uint dwordVal=read_buf(dwordOffset);return (dwordVal & mask) >> bitOffset;}uint nrDwordsForVertexIdEntries(uint nrMaterialLookupEntries) {return nrMaterialLookupEntries;}uint nrDwordsForMaterialIdEntries(uint nrMaterialLookupEntries) {return (nrMaterialLookupEntries*2u+3u)/4u;}uint findRangeBinarySearch(uint vertexId,uint numRanges,uint dwordOffset) {uint left=0u;uint right=numRanges-1u;for (uint i=0u; i < 16u; i++) { if (left > right) {break;}uint mid=(left+right)/2u;uint start=read_buf(dwordOffset+mid);uint nextStart=(mid+1u < numRanges) ? read_buf(dwordOffset+mid+1u) : 0xffffffffu;if (vertexId >=start && vertexId < nextStart) {return mid;} else if (vertexId < start) {if (mid==0u) {break;}right=mid-1u;} else {left=mid+1u;}}return 0u; }uint readVertexId(uint dwordOffset,uint iMaterialLookupEntry) {return read_buf(dwordOffset+iMaterialLookupEntry);}uint findRange(uint vertexId,uint numRanges,uint dwordOffset) {uint iRange;if(numRanges <=64u){uint vertexBegin;for(iRange=0u; iRange < numRanges;++iRange) {vertexBegin=readVertexId(dwordOffset,iRange);if(vertexBegin > vertexId) {break;}}iRange=iRange==0u? 0u : iRange-1u;} else { iRange=findRangeBinarySearch(vertexId,numRanges,dwordOffset);}return iRange;}MaterialInfo read_material_info(uint vertex_id) {MaterialInfo info; #if MATERIAL_TABLE_DEBUG const vec4 red=vec4(1.0,0.0,0.0,1.0);const vec4 orange=vec4(1.0,0.5,0.0,1.0);const vec4 yellow=vec4(1.0,1.0,0.0,1.0);const vec4 green=vec4(0.0,1.0,0.0,1.0);const vec4 indigo=vec4(0.294,0.0,0.510,1.0);const vec4 blue=vec4(0.0,0.0,1.0,1.0);const vec4 purple=vec4(0.5,0.0,0.5,1.0);const vec4 pink=vec4(1.0,0.0,1.0,1.0);info.colorDebug=green; #endif uint offset=0u; #if MATERIAL_TABLE_DEBUG bool keepFinding=true;uint magic=read_buf(offset);if(magic !=0xCAFEBABEu) {info.colorDebug=red;keepFinding=false;return info;} #endif offset++; #if MATERIAL_TABLE_DEBUG uint nrMaterials=read_buf(offset);uint nrVertices=read_buf(offset+1u);if(keepFinding && vertex_id >=nrVertices) {info.colorDebug=red;keepFinding=false;} #endif offset+=2u;uint nrMaterialLookupEntries=read_buf(offset++);uint perMaterialEntrySizeDwords=read_buf(offset++); #if MATERIAL_TABLE_DEBUG if(keepFinding && perMaterialEntrySizeDwords !=1u) {info.colorDebug=red;keepFinding=false;} #endif uint iMaterialLookup=findRange(vertex_id,nrMaterialLookupEntries,offset); #if MATERIAL_TABLE_DEBUG if(keepFinding) {uint vertexBeginCheck=readVertexId(offset,iMaterialLookup);if(vertexBeginCheck > vertex_id) {info.colorDebug=red;keepFinding=false;}if(iMaterialLookup < nrMaterialLookupEntries-1u) {uint vertexEndCheck=readVertexId(offset,iMaterialLookup+1u);if(vertexEndCheck <=vertex_id) {info.colorDebug=red;keepFinding=false;}}} #endif offset+=nrDwordsForVertexIdEntries(nrMaterialLookupEntries);uint materialId=iMaterialLookup; #if MATERIAL_TABLE_DEBUG if(keepFinding) {if(materialId >=nrMaterialLookupEntries) {info.colorDebug=red;}} #endif info.dataOffset=offset+materialId*perMaterialEntrySizeDwords;return info;}uint get_data_location(const MaterialInfo matInfo,uint attribOffsetBytes) {uint attribFieldOffsetDwords=attribOffsetBytes/4u;return matInfo.dataOffset+attribFieldOffsetDwords;}vec4 read_material_vec4(const MaterialInfo matInfo,uint attribOffsetBytes){uint loc=get_data_location(matInfo,attribOffsetBytes);return vec4(read_buf_float(loc),read_buf_float(loc+1u),read_buf_float(loc+2u),read_buf_float(loc+3u));}vec2 read_material_vec2(const MaterialInfo matInfo,uint attribOffsetBytes){uint loc=get_data_location(matInfo,attribOffsetBytes);return vec2(read_buf_float(loc),read_buf_float(loc+1u));}float read_material_float(const MaterialInfo matInfo,uint attribOffsetBytes){uint loc=get_data_location(matInfo,attribOffsetBytes);return read_buf_float(loc);} #define GET_ATTRIBUTE_float(attrib,matInfo,attrib_offset) read_material_float(matInfo,attrib_offset) #define GET_ATTRIBUTE_vec4(attrib,matInfo,attrib_offset) read_material_vec4(matInfo,attrib_offset) #define GET_ATTRIBUTE_vec2(attrib,matInfo,attrib_offset) read_material_vec2(matInfo,attrib_offset) #define DECLARE_MATERIAL_TABLE_INFO MaterialInfo materialInfo=read_material_info(uint(gl_VertexID)); #define DECLARE_MATERIAL_TABLE_INFO_DEBUG(dbgColor) MaterialInfo materialInfo=read_material_info(uint(gl_VertexID)); dbgColor=materialInfo.colorDebug; #endif`,"_prelude_fog.fragment.glsl":Cr,"_prelude_shadow.fragment.glsl":d5,"_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":c5,"_prelude_raster_particle.glsl":Yk},Qk={};aa("",Iu),aa(Cr,Zk),aa(d5,Xk),aa(c5,""),aa(Yk,"");const DP=aa(s0,l5),Jk=n0,qie=[` #if defined(GL_EXT_blend_func_extended) && defined(DUAL_SOURCE_BLENDING) #extension GL_EXT_blend_func_extended : require #endif`,"precision mediump float;",Jk,DP.fragmentSource].join(` `),RP=["precision highp float;",Jk,DP.vertexSource].join(` `);var h5={background:aa(`#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:aa(`#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:aa(`#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:aa(`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:aa(`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:aa(`#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:aa("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:aa(`#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:aa(`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:aa("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:aa("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:aa("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:aa(`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:aa(`#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:aa(`#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:aa(`#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:aa(`#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:aa(`#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:aa(`#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:aa(`#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:aa(`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:aa(`#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:aa(`#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:aa(`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:aa(`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:aa(`#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:aa(`#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:aa(`#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:aa(`#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:aa(`#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:aa("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:aa("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:aa(`#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:aa(`#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:aa(`#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:aa("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:aa(`#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 }`,Kk),skyboxGradient:aa(`#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 }`,Kk),skyboxCapture:aa(` 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:aa(`#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:aa(`#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:aa(`#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:aa(`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:aa(`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:aa("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:aa("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:aa("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:aa("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 eg(w,d){const m=w.split(` `);for(let j of m){if(j=j.trimStart(),j[0]!=="#"||!j.includes("if")||j.startsWith("#endif"))continue;const A=j.match(u5);if(A)for(const O of A)hx.has(O)||d.add(O)}}function aa(w,d){const m=new Set,j=[],A=[];w=w.replace(Vv,(R,B)=>(A.push(B),"")),d=d.replace(Vv,(R,B)=>(j.push(B),""));let O=new Set(fx);eg(w,O),eg(d,O);for(const R of[...j,...A])Qk[R]||(Qk[R]=new Set,eg(Jm[R],Qk[R])),O=new Set([...O,...Qk[R]]);return{fragmentSource:w=w.replace(Of,(R,B,H,Y,te)=>(m.add(te),B==="define"?` #ifndef HAS_UNIFORM_u_${te} in ${H} ${Y} ${te}; #else uniform ${H} ${Y} u_${te}; #endif `:B==="initialize"?` #ifdef HAS_UNIFORM_u_${te} ${H} ${Y} ${te} = u_${te}; #endif `:B==="define-attribute"?` #ifdef HAS_ATTRIBUTE_a_${te} in ${H} ${Y} ${te}; #endif `:B==="initialize-attribute"?"":void 0)),vertexSource:d=d.replace(Of,(R,B,H,Y,te)=>{const de=`MATERIAL_ATTRIBUTE_OFFSET_${te}`,ce=Y==="float"?"vec2":Y,ue=`GET_ATTRIBUTE_${ce}(a_${te}, materialInfo, ${de})`,je=te.match(/color/)?"color":ce;return B==="define-attribute-vertex-shader-only"?` #ifdef HAS_ATTRIBUTE_a_${te} in ${H} ${Y} a_${te}; #endif `:m.has(te)?B==="define"?` #ifndef HAS_UNIFORM_u_${te} uniform lowp float u_${te}_t; #if !defined(${de}) in ${H} ${ce} a_${te}; #endif out ${H} ${Y} ${te}; #else uniform ${H} ${Y} u_${te}; #endif `:B==="initialize"?je==="vec4"?` #ifndef HAS_UNIFORM_u_${te} ${te} = a_${te}; #else ${H} ${Y} ${te} = u_${te}; #endif `:` #if !defined(HAS_UNIFORM_u_${te}) #ifdef ${de} ${te} = unpack_mix_${je}(${ue}, u_${te}_t); #else ${te} = unpack_mix_${je}(a_${te}, u_${te}_t); #endif #else ${H} ${Y} ${te} = u_${te}; #endif `:B==="define-attribute"?` #ifdef HAS_ATTRIBUTE_a_${te} in ${H} ${Y} a_${te}; out ${H} ${Y} ${te}; #endif `:B==="initialize-attribute"?` #ifdef HAS_ATTRIBUTE_a_${te} ${te} = a_${te}; #endif `:void 0:B==="define"?` #ifndef HAS_UNIFORM_u_${te} uniform lowp float u_${te}_t; #if !defined(${de}) in ${H} ${ce} a_${te}; #endif #else uniform ${H} ${Y} u_${te}; #endif `:B==="define-instanced"?je==="mat4"?` #ifdef INSTANCED_ARRAYS in vec4 a_${te}0; in vec4 a_${te}1; in vec4 a_${te}2; in vec4 a_${te}3; #else uniform ${H} ${Y} u_${te}; #endif `:` #ifdef INSTANCED_ARRAYS in ${H} ${ce} a_${te}; #else uniform ${H} ${Y} u_${te}; #endif `:B==="initialize-attribute-custom"?` #ifdef HAS_ATTRIBUTE_a_${te} ${H} ${Y} ${te} = a_${te}; #endif `:je==="vec4"?` #ifndef HAS_UNIFORM_u_${te} #ifdef ${de} ${H} ${Y} ${te} = ${ue}; #else ${H} ${Y} ${te} = a_${te}; #endif #else ${H} ${Y} ${te} = u_${te}; #endif `:` #ifndef HAS_UNIFORM_u_${te} #ifdef ${de} ${H} ${Y} ${te} = unpack_mix_${je}(${ue}, u_${te}_t); #else ${H} ${Y} ${te} = unpack_mix_${je}(a_${te}, u_${te}_t); #endif #else ${H} ${Y} ${te} = u_${te}; #endif `}),usedDefines:O,vertexIncludes:j,fragmentIncludes:A}}class Vie{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffers=[],this.vao=null}bind(d,m,j,A,O,R,B,H){this.context=d;let Y=this.boundPaintVertexBuffers.length!==A.length;for(let de=0;!Y&&de{const wt=rt.paint.get("hillshade-shadow-color"),mt=rt.paint.get("hillshade-shadow-color-use-theme").constantOr("default")==="none",vt=rt.paint.get("hillshade-highlight-color"),pt=rt.paint.get("hillshade-highlight-color-use-theme").constantOr("default")==="none",ut=rt.paint.get("hillshade-accent-color"),St=rt.paint.get("hillshade-accent-color-use-theme").constantOr("default")==="none",Dt=rt.paint.get("hillshade-emissive-strength");let Ot=i.an(rt.paint.get("hillshade-illumination-direction"));if(rt.paint.get("hillshade-illumination-anchor")==="viewport")Ot-=Le.transform.angle;else if(Le.style&&Le.style.enable3dLights()&&Le.style.directionalLight){const Zt=Le.style.directionalLight.properties.get("direction"),ar=i.d4(Zt.x,Zt.y,Zt.z);Ot=i.an(ar[1])}const Gt=!Le.options.moving;return{u_matrix:Ke||Le.transform.calculateProjMatrix(We.tileID.toUnwrapped(),Gt),u_image:0,u_latrange:Hie(0,We.tileID),u_light:[rt.paint.get("hillshade-exaggeration"),Ot],u_shadow:wt.toPremultipliedRenderColor(mt?null:rt.lut),u_highlight:vt.toPremultipliedRenderColor(pt?null:rt.lut),u_emissive_strength:Dt,u_accent:ut.toPremultipliedRenderColor(St?null:rt.lut)}})(w,m,j,w.terrain?d.projMatrix:null);w.uploadCommonUniforms(B,ce,d.toUnwrapped());const{tileBoundsBuffer:je,tileBoundsIndexBuffer:ve,tileBoundsSegments:Re}=w.getTileBoundsBuffers(m);ce.draw(w,H.TRIANGLES,A,O,R,$n.disabled,ue,j.id,je,ve,Re)}function f5(w,d,m){if(!d.needsDEMTextureUpload)return;const j=w.context,A=j.gl;j.pixelStoreUnpackPremultiplyAlpha.set(!1),d.demTexture=d.demTexture||w.getTileTexture(m.stride);const O=m.getPixels();d.demTexture?d.demTexture.update(O,{premultiply:!1}):d.demTexture=new i.T(j,O,A.R32F,{premultiply:!1}),d.needsDEMTextureUpload=!1}function Gie(w,d,m){const j=w.context,A=j.gl;if(!d.dem)return;const O=d.dem;if(j.activeTexture.set(A.TEXTURE1),f5(w,d,O),!d.demTexture)return;d.demTexture.bind(A.NEAREST,A.CLAMP_TO_EDGE);const R=O.dim;j.activeTexture.set(A.TEXTURE0);let B=d.hillshadeFBO;if(!B){const ce=new i.T(j,{width:R,height:R,data:null},A.RGBA8);ce.bind(A.LINEAR,A.CLAMP_TO_EDGE),B=d.hillshadeFBO=j.createFramebuffer(R,R,1,"renderbuffer"),B.colorAttachment0.set(ce.texture)}j.bindFramebuffer.set(B.framebuffer),j.viewport.set([0,0,R,R]);const{tileBoundsBuffer:H,tileBoundsIndexBuffer:Y,tileBoundsSegments:te}=w.getMercatorTileBoundsBuffers(),de=[];w.linearFloatFilteringSupported()&&de.push("TERRAIN_DEM_FLOAT_FORMAT"),w.terrain&&w.terrain.renderingToTexture&&w.emissiveMode==="mrt-fallback"&&de.push("USE_MRT1"),w.getOrCreateProgram("hillshadePrepare",{defines:de}).draw(w,A.TRIANGLES,gn.disabled,Vn.disabled,us.unblended,$n.disabled,((ce,ue)=>{const je=ue.stride,ve=i.bC();return i.ce(ve,0,i.al,-i.al,0,0,1),i.br(ve,ve,[0,-i.al,0]),{u_matrix:ve,u_image:1,u_dimension:[je,je],u_zoom:ce.overscaledZ}})(d.tileID,O),m.id,H,Y,te),d.needsHillshadePrepare=!1}class Di{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 Kie extends Di{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 FP extends Di{getDefault(){return 1}set(d){(d!==this.current||this.dirty)&&(this.gl.clearDepth(d),this.current=d,this.dirty=!1)}}class p5 extends Di{getDefault(){return 0}set(d){(d!==this.current||this.dirty)&&(this.gl.clearStencil(d),this.current=d,this.dirty=!1)}}class eN extends Di{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 m5 extends Di{getDefault(){return!0}set(d){(d!==this.current||this.dirty)&&(this.gl.depthMask(d),this.current=d,this.dirty=!1)}}class px extends Di{getDefault(){return 255}set(d){(d!==this.current||this.dirty)&&(this.gl.stencilMask(d),this.current=d,this.dirty=!1)}}class a0 extends Di{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 Hv extends Di{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 i0 extends Di{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 zP extends Di{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 g5 extends Di{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 BP extends Di{getDefault(){return this.gl.LESS}set(d){(d!==this.current||this.dirty)&&(this.gl.depthFunc(d),this.current=d,this.dirty=!1)}}class o0 extends Di{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 tN extends Di{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 rN extends Di{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 x5 extends Di{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 nN extends Di{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 Wv extends Di{getDefault(){return this.gl.BACK}set(d){(d!==this.current||this.dirty)&&(this.gl.cullFace(d),this.current=d,this.dirty=!1)}}class $P extends Di{getDefault(){return this.gl.CCW}set(d){(d!==this.current||this.dirty)&&(this.gl.frontFace(d),this.current=d,this.dirty=!1)}}let UP=class extends Di{getDefault(){return null}set(w){(w!==this.current||this.dirty)&&(this.gl.useProgram(w),this.current=w,this.dirty=!1)}};class qP extends Di{getDefault(){return this.gl.TEXTURE0}set(d){(d!==this.current||this.dirty)&&(this.gl.activeTexture(d),this.current=d,this.dirty=!1)}}class l0 extends Di{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 VP extends Di{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 Zie extends Di{getDefault(){return null}set(d){if(d===this.current&&!this.dirty)return;const m=this.gl;m.bindRenderbuffer(m.RENDERBUFFER,d),this.current=d,this.dirty=!1}}class Yie extends Di{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 Xie extends Di{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 y5 extends Di{getDefault(){return null}set(d){const m=this.gl;m.bindBuffer(m.ELEMENT_ARRAY_BUFFER,d),this.current=d,this.dirty=!1}}class v5 extends Di{getDefault(){return null}set(d){this.gl&&(d!==this.current||this.dirty)&&(this.gl.bindVertexArray(d),this.current=d,this.dirty=!1)}}class _5 extends Di{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 b5 extends Di{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 HP extends Di{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 sN extends Di{constructor(d,m){super(d),this.context=d,this.parent=m}getDefault(){return null}}class aN extends sN{constructor(d,m,j=0){super(d,m),this.attachmentPoint=d.gl.COLOR_ATTACHMENT0+j}setDirty(){this.dirty=!0}set(d){if(d===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const m=this.gl;m.framebufferTexture2D(m.FRAMEBUFFER,this.attachmentPoint,m.TEXTURE_2D,d,0),this.current=d,this.dirty=!1}}class c0 extends sN{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 Gv extends sN{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 WP extends c0{attachment(){return this.gl.DEPTH_STENCIL_ATTACHMENT}}const Pu=(w,d,m,j)=>({u_matrix:w,u_image0:0,u_image1:1,u_skirt_height:d,u_ground_shadow_factor:m,u_emissive_texture_available:j}),iN=(w,d,m,j,A,O,R,B,H,Y,te,de,ce,ue,je,ve,Re)=>({u_proj_matrix:Float32Array.from(w),u_globe_matrix:d,u_normalize_matrix:Float32Array.from(j),u_merc_matrix:m,u_zoom_transition:A,u_merc_center:O,u_image0:0,u_image1:1,u_frustum_tl:R,u_frustum_tr:B,u_frustum_br:H,u_frustum_bl:Y,u_globe_pos:te,u_globe_radius:de,u_viewport:ce,u_grid_matrix:Re?Float32Array.from(Re):new Float32Array(9),u_skirt_height:ue,u_far_z_cutoff:je,u_emissive_texture_available:ve});function Kv(w,d){return w!=null&&d!=null&&!(!w.hasData()||!d.hasData())&&w.demTexture!=null&&d.demTexture!=null&&w.tileID.key!==d.tileID.key}const Ip=new class{constructor(){this.operations={}}newMorphing(w,d,m,j,A){if(w in this.operations){const O=this.operations[w];O.to.tileID.key!==m.tileID.key&&(O.queued=m)}else this.operations[w]={startTime:j,phase:0,duration:A,from:d,to:m,queued:null}}getMorphValuesForProxy(w){if(!(w in this.operations))return null;const d=this.operations[w];return{from:d.from,to:d.to,phase:d.phase}}update(w){for(const d in this.operations){const m=this.operations[d];for(m.phase=(w-m.startTime)/m.duration;m.phase>=1||!this._validOp(m);)if(!this._nextOp(m,w)){delete this.operations[d];break}}}_nextOp(w,d){return!!w.queued&&(w.from=w.to,w.to=w.queued,w.queued=null,w.phase=0,w.startTime=d,!0)}_validOp(w){return w.from.hasData()&&w.to.hasData()}},oN={0:null,1:"TERRAIN_VERTEX_MORPHING"};function lN(w,d,m){if(d===0)return 0;const j=d<1&&m===514?.25/d:1;return 6*Math.pow(1.5,22-w)*Math.max(d,1)*j}function w5(w,d){const m=1<({u_matrix:w});function Yv(w,d,m,j,A){if(A>0){const O=i.o.now(),R=(O-w.timeAdded)/A,B=d?(O-d.timeAdded)/A:-1,H=m.getSource(),Y=j.coveringZoomLevel({tileSize:H.tileSize,roundZoom:H.roundZoom}),te=!d||Math.abs(d.tileID.overscaledZ-Y)>Math.abs(w.tileID.overscaledZ-Y),de=te&&w.refreshedUponExpiration?1:i.aA(te?R:1-B,0,1);return d?{opacity:1,mix:1-de,isFading:R<1}:{opacity:de,mix:0,isFading:R<1}}return{opacity:1,mix:0,isFading:!1}}class cN extends yd{constructor(d){const m=Xo("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 j5 extends yd{constructor(d){const m=Xo("proxy",{type:"geojson",maxzoom:d.transform.maxZoom},d.style.dispatcher,d.style);super("proxy",m,!1),m.setEventedParent(this),this.map=this.getSource().map=d,this.used=this._sourceLoaded=!0,this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}update(d,m,j){if(d.freezeTileCoverage)return;this.transform=d;const A=d.coveringTiles({tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled}).reduce((O,R)=>{if(O[R.key]="",!this._tiles[R.key]){const B=new Cp(R,this._source.tileSize*R.overscaleFactor(),d.tileZoom,void 0,void 0,this._source.worldview);B.state="loaded",this._tiles[R.key]=B}return O},{});for(const O in this._tiles)O in A||(this.freeFBO(O),this._tiles[O].unloadVectorData(),delete this._tiles[O])}freeFBO(d){const m=this.proxyCachedFBO[d];if(m!==void 0){const j=Object.values(m);this.renderCachePool.push(...j),delete this.proxyCachedFBO[d]}}deallocRenderCache(){this.renderCache.forEach(d=>d.fb.destroy()),this.renderCache=[],this.renderCachePool=[],this.proxyCachedFBO={}}}class k5 extends i.aQ{constructor(d,m,j){super(d.overscaledZ,d.wrap,d.canonical.z,d.canonical.x,d.canonical.y),this.proxyTileKey=m,this.projMatrix=j}}class N5 extends i.bV{constructor(d,m){super(),this._debugParams={sortTilesHiZFirst:!0,disableRenderCache:!1},this.painter=d,this.terrainTileForTile={},this.prevTerrainTileForTile={};const[j,A,O]=function(H){const Y=new i.bd,te=new i.b0,de=131;Y.reserve(17161),te.reserve(33800);const ce=i.al/128,ue=i.al+ce/2,je=ue+ce;for(let Re=-ce;Reue||Re<0||Re>ue?24575:0,rt=i.aA(Math.round(Le),0,i.al),Ke=i.aA(Math.round(Re),0,i.al);Y.emplaceBack(rt+We,Ke)}const ve=(Re,Le)=>{const We=Le*de+Re;te.emplaceBack(We+1,We,We+de),te.emplaceBack(We+de,We+de+1,We+1)};for(let Re=1;Re<129;Re++)for(let Le=1;Le<129;Le++)ve(Le,Re);return[0,129].forEach(Re=>{for(let Le=0;Le<130;Le++)ve(Le,Re),ve(Re,Le)}),[Y,te,32768]}(),R=d.context;this.gridBuffer=R.createVertexBuffer(j,i.bf.members),this.gridIndexBuffer=R.createIndexBuffer(A),this.gridSegments=i.bg.simpleSegment(0,0,j.length,A.length),this.gridNoSkirtSegments=i.bg.simpleSegment(0,0,j.length,O),this.proxyCoords=[],this.proxiedCoords={},this._visibleDemTiles=[],this._drapedRenderBatches=[],this._sourceTilesOverlap={},this.proxySourceCache=new j5(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=R.gl;this._overlapStencilMode=new Vn({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 cN(m.map),this._pendingGroundEffectLayers=[],this._emissiveTexture=!1}set style(d){d.on("data",this._onStyleDataEvent.bind(this)),this._style=d,this._style.map.on("moveend",()=>{this._clearLineLayersFromRenderCache()})}update(d,m,j){if(d&&d.terrain){this._style!==d&&(this.style=d,this._evaluationZoom=void 0);const A=d.terrain.properties,O=d.terrain.drapeRenderMode===0,R=d.terrain.isZoomDependent();this._previousUpdateTimestamp=this.enabled?this._updateTimestamp:void 0,this._updateTimestamp=i.o.now();const B=d.terrain&&d.terrain.scope,H=A.get("source"),Y=O?this._mockSourceCache:d.getSourceCache(H,B);if(!Y)return void i.w(`Couldn't find terrain source "${H}".`);if(this.sourceCache=Y,this._attenuationRange=d.terrain.getAttenuationRange(),this._exaggeration=R?this.calculateExaggeration(m):A.get("exaggeration"),!m.projection.requiresDraping&&R&&this._exaggeration===0)return void this._disable();this.enabled=!0;const te=()=>{this.sourceCache.used&&i.w(`Raster DEM source '${this.sourceCache.id}' is used both for terrain and as layer source. This leads to lower resolution of hillshade. For full hillshade resolution but higher memory consumption, define another raster DEM source.`);const de=this.getScaledDemTileSize();this.sourceCache.update(m,de,!0),this.resetTileLookupCache(this.sourceCache.id)};this.sourceCache.usedForTerrain||(this.resetTileLookupCache(this.sourceCache.id),this.sourceCache.usedForTerrain=!0,te(),this._initializing=!0),te(),m.updateElevation(!0,j),this.resetTileLookupCache(this.proxySourceCache.id),this.proxySourceCache.update(m),this._emptyDEMTextureDirty=!0,this._previousZoom=m.zoom}else this._disable()}calculateExaggeration(d){if(this._attenuationRange&&d.zoom>=Math.ceil(this._attenuationRange[1]))return this._style.terrain.getExaggeration(d.zoom);const m=this._previousCameraAltitude,j=d.getFreeCameraOptions().position.z/d.pixelsPerMeter*d.worldSize;this._previousCameraAltitude=j;const A=m!=null?j-m:Number.MAX_VALUE;if(Math.abs(A)<2)return this._exaggeration;const O=d.zoom,R=this._style.terrain;if(!this._previousUpdateTimestamp)return R.getExaggeration(O);let B=O-this._previousZoom;const H=this._previousUpdateTimestamp;let Y=O;this._evaluationZoom!=null&&(Y=this._evaluationZoom,Math.abs(O-Y)>.5&&(B=.5*(O-Y+B)),B*A<0&&(Y+=B)),this._evaluationZoom=Y;const te=R.getExaggeration(Y),de=te===R.getExaggeration(Math.max(0,Y-.1));if(de&&Math.abs(te-this._exaggeration)<.01)return te;let ce=Math.min(.1,.00375*(this._updateTimestamp-H));return(de||te<.1||Math.abs(B)<1e-4)&&(ce=Math.min(.2,4*ce)),i.ak(this._exaggeration,te,ce)}resetTileLookupCache(d){this._findCoveringTileCache[d]={}}attenuationRange(){return this._attenuationRange}getDemUpscale(){return this.proxySourceCache.getSource().tileSize/128}getScaledDemTileSize(){return this.sourceCache.getSource().tileSize/128*this.proxySourceCache.getSource().tileSize}_onStyleDataEvent(d){d.dataType==="source"&&d.coord?this._clearRenderCacheForTile(d.sourceCacheId,d.coord):d.dataType==="style"&&(this.invalidateRenderCache=!0,this._evaluationZoom=void 0,this._previousUpdateTimestamp=void 0,this._previousCameraAltitude=void 0)}_disable(){if(this.enabled&&(this.enabled=!1,this._emptyDEMTextureDirty=!0,this._sharedDepthStencil=void 0,this._evaluationZoom=void 0,this._previousUpdateTimestamp=void 0,this.proxySourceCache.deallocRenderCache(),this._style))for(const d in this._style._mergedSourceCaches)this._style._mergedSourceCaches[d].usedForTerrain=!1}destroy(){this._disable(),this._emptyDEMTexture&&this._emptyDEMTexture.destroy(),this.pool.forEach(d=>d.fb.destroy()),this.pool=[],this.framebufferCopyTexture&&this.framebufferCopyTexture.destroy()}_source(){return this.enabled?this.sourceCache:null}isUsingMockSource(){return this.sourceCache===this._mockSourceCache}exaggeration(){return this.enabled?this._exaggeration:0}get visibleDemTiles(){return this._visibleDemTiles}get drapeBufferSize(){const d=2*this.proxySourceCache.getSource().tileSize;return[d,d]}set useVertexMorphing(d){this._useVertexMorphing=d}updateTileBinding(d){if(!this.enabled)return;this.prevTerrainTileForTile=this.terrainTileForTile;const m=this.proxySourceCache,j=this.painter.transform;this._initializing&&(this._initializing=j._centerAltitude===0&&this.getAtPointOrZero(i.ae.fromLngLat(j.center),-1)===-1,this._emptyDEMTextureDirty=!this._initializing);const A=this.proxyCoords=m.getIds().map(H=>{const Y=m.getTileByID(H).tileID;return Y.projMatrix=j.calculateProjMatrix(Y.toUnwrapped()),Y});(function(H,Y){const te=Y.transform.pointCoordinate(Y.transform.getCameraPoint()),de=new i.P(te.x,te.y);H.sort((ce,ue)=>{if(ue.overscaledZ-ce.overscaledZ)return ue.overscaledZ-ce.overscaledZ;const je=new i.P(ce.canonical.x+(1<{this.proxyToSource[H.key]={}}),this.terrainTileForTile={};const R=this._style._mergedSourceCaches;for(const H in R){const Y=R[H];if(!Y.used||(Y!==this.sourceCache&&this.resetTileLookupCache(Y.id),this._setupProxiedCoordsForOrtho(Y,d[H],O),Y.usedForTerrain))continue;const te=d[H];Y.getSource().reparseOverscaled&&this._assignTerrainTiles(te)}this.proxiedCoords[m.id]=A.map(H=>new k5(H,H.key,this.orthoMatrix)),this._assignTerrainTiles(A),this._prepareDEMTextures(),this._setupDrapedRenderBatches(),this._initFBOPool(),this._setupRenderCache(O),this.renderingToTexture=!1;const B={};this._visibleDemTiles=[];for(const H of this.proxyCoords){const Y=this.terrainTileForTile[H.key];if(!Y)continue;const te=Y.tileID.key;te in B||(this._visibleDemTiles.push(Y),B[te]=te)}}_assignTerrainTiles(d){this._initializing||d.forEach(m=>{if(this.terrainTileForTile[m.key])return;const j=this._findTileCoveringTileID(m,this.sourceCache);j&&(this.terrainTileForTile[m.key]=j)})}_prepareDEMTextures(){const d=this.painter.context,m=d.gl;for(const j in this.terrainTileForTile){const A=this.terrainTileForTile[j],O=A.dem;!O||A.demTexture&&!A.needsDEMTextureUpload||(d.activeTexture.set(m.TEXTURE1),f5(this.painter,A,O))}}_prepareDemTileUniforms(d,m,j,A){if(!m||m.demTexture==null)return!1;const O=d.tileID.canonical,R=Math.pow(2,m.tileID.canonical.z-O.z),B=A||"";return j[`u_dem_tl${B}`]=[O.x*R%1,O.y*R%1],j[`u_dem_scale${B}`]=R,!0}get emptyDEMTexture(){return!this._emptyDEMTextureDirty&&this._emptyDEMTexture?this._emptyDEMTexture:this._updateEmptyDEMTexture()}_getLoadedAreaMinimum(){if(!this.enabled)return 0;let d=0;const m=this._visibleDemTiles.reduce((j,A)=>{if(!A.dem)return j;const O=A.dem.tree.minimums[0];return O>0&&d++,j+O},0);return d?m/d:0}_updateEmptyDEMTexture(){const d=this.painter.context,m=d.gl;d.activeTexture.set(m.TEXTURE2);const j=this._getLoadedAreaMinimum(),A=new i.dL({width:1,height:1},new Float32Array([j]));this._emptyDEMTextureDirty=!1;let O=this._emptyDEMTexture;return O?O.update(A,{premultiply:!1}):O=this._emptyDEMTexture=new i.T(d,A,m.R32F,{premultiply:!1}),O}setupElevationDraw(d,m,j){const A=this.painter.context,O=A.gl,R={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};R.u_exaggeration=this.exaggeration();let B=null,H=null,Y=1;if(j&&j.morphing&&this._useVertexMorphing){const ue=j.morphing.srcDemTile,je=j.morphing.dstDemTile;Y=j.morphing.phase,ue&&je&&(this._prepareDemTileUniforms(d,ue,R,"_prev")&&(H=ue),this._prepareDemTileUniforms(d,je,R)&&(B=je))}const te=ue=>ue&&ue.demTexture&&this.painter.linearFloatFilteringSupported()?O.LINEAR:O.NEAREST;let de=null;var ce;if(this.enabled?H&&B?(de=B.demTexture,A.activeTexture.set(O.TEXTURE4),H.demTexture.bind(te(H),O.CLAMP_TO_EDGE),R.u_dem_lerp=Y):(B=this.terrainTileForTile[d.tileID.key],de=this._prepareDemTileUniforms(d,B,R)?B.demTexture:this.emptyDEMTexture):de=this.emptyDEMTexture,A.activeTexture.set(O.TEXTURE2),de&&(R.u_dem_size=(ce=de).size[0]===1?1:ce.size[0]-2,de.bind(te(B),O.CLAMP_TO_EDGE)),this.painter.setupDepthForOcclusion(j&&j.useDepthForOcclusion,m,R),j&&j.useMeterToDem&&B){const ue=(1<{if(Le===Zt)return;const ar=[oN[Zt],"PROJECTION_GLOBE_VIEW"];rt&&ar.push("CUSTOM_ANTIALIASING");const br=Y.isTileAffectedByFog(Gt);Re=Y.getOrCreateProgram("globeRaster",{defines:ar,overrideFog:br}),Le=Zt},wt=Y.colorModeForRenderPass(),mt=new gn(ve.LEQUAL,gn.ReadWrite,Y.depthRangeFor3D);Ip.update(ue);const vt=i.dF(We),pt=[i.aF(We.center.lng),i.aJ(We.center.lat)],ut=Y.globeSharedBuffers,St=[We.width*i.o.devicePixelRatio,We.height*i.o.devicePixelRatio],Dt=Float32Array.from(We.globeMatrix),Ot={useDenormalizedUpVectorScale:!0};{const Gt=Y.transform,Zt=lN(Gt.zoom,te.exaggeration(),te.sourceCache._source.tileSize);Le=-1;const ar=ve.TRIANGLES;for(const br of ce){const Ut=de.getTile(br),Tt=Vn.disabled,Jt=te.prevTerrainTileForTile[br.key],Ht=te.terrainTileForTile[br.key];Kv(Jt,Ht)&&Ip.newMorphing(br.key,Jt,Ht,ue,250),d0(Y,Ut.emissiveTexture),je.activeTexture.set(ve.TEXTURE0),Ut.texture&&Ut.texture.bind(ve.LINEAR,ve.CLAMP_TO_EDGE);const hr=Ip.getMorphValuesForProxy(br.key),Ar=hr?1:0;hr&&Object.assign(Ot,{morphing:{srcDemTile:hr.from,dstDemTile:hr.to,phase:i.dD(hr.phase)}});const Kr=i.dG(br.canonical),Sr=i.dH(Kr.getCenter().lat),wr=i.dI(br.canonical,Kr,Sr,Gt.worldSize/Gt._pixelsPerMercatorPixel),cn=i.bk(i.dJ(br.canonical)),rn=Y.emissiveMode==="mrt-fallback"?1:0,qr=iN(Gt.expandedFarZProjMatrix,Dt,vt,cn,i.aj(Gt.zoom),pt,Gt.frustumCorners.TL,Gt.frustumCorners.TR,Gt.frustumCorners.BR,Gt.frustumCorners.BL,Gt.globeCenterInViewSpace,Gt.globeRadius,St,Zt,Gt._farZ,rn,wr);if(Ke(br,Ar),Re&&(te.setupElevationDraw(Ut,Re,Ot),Y.uploadCommonUniforms(je,Re,br.toUnwrapped()),ut)){const[Xr,Cn,ts]=ut.getGridBuffers(Sr,Zt!==0);Re.draw(Y,ar,mt,Tt,wt,$n.backCCW,qr,"globe_raster",Xr,Cn,ts)}}}if(ut&&(Y.renderDefaultNorthPole||Y.renderDefaultSouthPole)){const Gt=["GLOBE_POLES","PROJECTION_GLOBE_VIEW"];rt&&Gt.push("CUSTOM_ANTIALIASING"),Re=Y.getOrCreateProgram("globeRaster",{defines:Gt});for(const Zt of ce){const{x:ar,y:br,z:Ut}=Zt.canonical,Tt=br===0,Jt=br===(1<Xr.draw(Y,ve.TRIANGLES,mt,Vn.disabled,wt,$n.disabled,iN(We.expandedFarZProjMatrix,wr,wr,cn,0,pt,We.frustumCorners.TL,We.frustumCorners.TR,We.frustumCorners.BR,We.frustumCorners.BL,We.globeCenterInViewSpace,We.globeRadius,St,0,We._farZ,rn),"globe_pole_raster",Cn,Ar,Kr);te.setupElevationDraw(Sr,Re,Ot),Y.uploadCommonUniforms(je,Re,Zt.toUnwrapped()),Tt&&Y.renderDefaultNorthPole&&qr(Re,Ht),Jt&&Y.renderDefaultSouthPole&&(wr=i.cS(i.bC(),wr,[1,-1,1]),qr(Re,hr))}}}})(A,O,R,B,H);else{const Y=A.context,te=Y.gl;let de,ce;const ue=A.shadowRenderer,je=Zm(A,A.longestCutoffRange),ve=wt=>{if(ce===wt)return;const mt=[];mt.push(oN[wt]),je.shouldRenderCutoff&&mt.push("RENDER_CUTOFF"),ue&&(mt.push("RENDER_SHADOWS","DEPTH_TEXTURE"),ue.useNormalOffset&&mt.push("NORMAL_OFFSET")),de=A.getOrCreateProgram("terrainRaster",{defines:mt}),ce=wt},Re=A.colorModeForRenderPass(),Le=new gn(te.LEQUAL,gn.ReadWrite,A.depthRangeFor3D);Ip.update(H);const We=A.transform,rt=lN(We.zoom,O.exaggeration(),O.sourceCache._source.tileSize);let Ke=[0,0,0];if(ue){const wt=A.style.directionalLight,mt=A.style.ambientLight;wt&&mt&&(Ke=Ep(A.style,wt,mt))}{ce=-1;const wt=te.TRIANGLES,[mt,vt]=[O.gridIndexBuffer,O.gridSegments];for(const pt of B){const ut=R.getTile(pt),St=Vn.disabled,Dt=O.prevTerrainTileForTile[pt.key],Ot=O.terrainTileForTile[pt.key];Kv(Dt,Ot)&&Ip.newMorphing(pt.key,Dt,Ot,H,250),d0(A,ut.emissiveTexture),Y.activeTexture.set(te.TEXTURE0),ut.texture&&ut.texture.bind(te.LINEAR,te.CLAMP_TO_EDGE);const Gt=Ip.getMorphValuesForProxy(pt.key),Zt=Gt?1:0;let ar;Gt&&(ar={morphing:{srcDemTile:Gt.from,dstDemTile:Gt.to,phase:i.dD(Gt.phase)}});const br=A.emissiveMode==="mrt-fallback"?1:0,Ut=Pu(pt.projMatrix,w5(pt.canonical,We.renderWorldCopies)?rt/10:rt,Ke,br);if(ve(Zt),!de)continue;O.setupElevationDraw(ut,de,ar);const Tt=pt.toUnwrapped();ue&&ue.setupShadows(Tt,de),A.uploadCommonUniforms(Y,de,Tt,null,je),de.draw(A,wt,Le,St,Re,$n.backCCW,Ut,"terrain_raster",O.gridBuffer,mt,vt)}}}}(m,this,this.proxySourceCache,d,this._updateTimestamp),this.renderingToTexture=!0,m.gpuTimingDeferredRenderEnd(),d.splice(0,d.length))}renderBatch(d){if(this._drapedRenderBatches.length===0)return d+1;this.renderingToTexture=!0;const m=this.painter,j=this.painter.context,A=this.proxySourceCache,O=this.proxiedCoords[A.id],R=this._drapedRenderBatches.shift(),B=m.style.order,H=[];this._updateFBOs(m.emissiveMode==="mrt-fallback");let Y=0;for(const te of O){const de=A.getTileByID(te.proxyTileKey),ce=A.proxyCachedFBO[te.key]?A.proxyCachedFBO[te.key][d]:void 0,ue=ce!==void 0?A.renderCache[ce]:this.pool[Y++],je=ce!==void 0;if(de.texture=ue.tex,de.emissiveTexture=ue.emissiveTex,je&&!ue.dirty){H.push(de.tileID);continue}j.bindFramebuffer.set(ue.fb.framebuffer);const ve=j.gl;let Re;ve.drawBuffers(m.emissiveMode==="mrt-fallback"?[ve.COLOR_ATTACHMENT0,ve.COLOR_ATTACHMENT1]:[ve.COLOR_ATTACHMENT0]),this.renderedToTile=!1,ue.dirty&&(j.clear({color:i.ao.transparent,stencil:0}),ue.dirty=!1);for(let Le=R.start;Le<=R.end;++Le){const We=m.style._mergedLayers[B[Le]];if(We.isHidden(m.transform.zoom))continue;const rt=m.style.getLayerSourceCache(We),Ke=rt?this.proxyToSource[te.key][rt.id]:[te];if(!Ke)continue;const wt=Ke;j.viewport.set([0,0,ue.fb.width,ue.fb.height]),Re!==(rt?rt.id:null)&&(this._setupStencil(ue,Ke,We,rt),Re=rt?rt.id:null),m.renderLayer(m,rt,We,wt)}if(ve.drawBuffers([ve.COLOR_ATTACHMENT0]),this._drapedRenderBatches.length===0)for(const Le of this._pendingGroundEffectLayers){const We=m.style._mergedLayers[B[Le]];if(We.isHidden(m.transform.zoom))continue;const rt=m.style.getLayerSourceCache(We),Ke=rt?this.proxyToSource[te.key][rt.id]:[te];if(!Ke)continue;const wt=Ke;j.viewport.set([0,0,ue.fb.width,ue.fb.height]),Re!==(rt?rt.id:null)&&(this._setupStencil(ue,Ke,We,rt),Re=rt?rt.id:null),m.renderLayer(m,rt,We,wt)}this.renderedToTile?(ue.dirty=!0,H.push(de.tileID)):je||--Y,Y===5&&(Y=0,this.renderToBackBuffer(H))}return this.renderToBackBuffer(H),this.renderingToTexture=!1,j.bindFramebuffer.set(null),j.viewport.set([0,0,m.width,m.height]),R.end+1}postRender(){}isLayerOrderingCorrect(d){const m=d.order.length;let j=-1,A=m;for(let O=0;Oj}getMinElevationBelowMSL(){let d=0;return this._visibleDemTiles.filter(m=>m.dem).forEach(m=>{d=Math.min(d,m.dem.tree.minimums[0])}),d===0?d:(d-30)*this._exaggeration}raycast(d,m,j){if(!this._visibleDemTiles)return null;const A=this._visibleDemTiles.filter(O=>O.dem).map(O=>{const R=O.tileID,B=1<(O.t!==null?O.t:Number.MAX_VALUE)-(R.t!==null?R.t:Number.MAX_VALUE));for(const O of A){if(O.t==null)return null;const R=O.tile.dem.tree.raycast(O.minx,O.miny,O.maxx,O.maxy,d,m,j);if(R!=null)return R}return null}_createFBO(){const d=this.painter.context,m=d.gl,j=this.drapeBufferSize;d.activeTexture.set(m.TEXTURE0);const A=new i.T(d,{width:j[0],height:j[1],data:null},m.RGBA8);A.bind(m.LINEAR,m.CLAMP_TO_EDGE);const O=d.createFramebuffer(j[0],j[1],1,null);let R;return O.colorAttachment0.set(A.texture),this._emissiveTexture&&(R=new i.T(d,{width:j[0],height:j[1],data:null},m.R8),R.bind(m.LINEAR,m.CLAMP_TO_EDGE),O.createColorAttachment(d,1),O.colorAttachment1.set(R.texture)),O.depthAttachment=new WP(d,O.framebuffer),this._sharedDepthStencil===void 0?(this._sharedDepthStencil=d.createRenderbuffer(d.gl.DEPTH_STENCIL,j[0],j[1]),this._stencilRef=0,O.depthAttachment.set(this._sharedDepthStencil),d.clear({stencil:0})):O.depthAttachment.set(this._sharedDepthStencil),d.extTextureFilterAnisotropic&&m.texParameterf(m.TEXTURE_2D,d.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,d.extTextureFilterAnisotropicMax),{fb:O,tex:A,emissiveTex:R,dirty:!1}}_updateFBOs(d){if(this._emissiveTexture!==d){for(const m of this.pool)this._updateFBO(m,d);for(const m of this.proxySourceCache.renderCache)this._updateFBO(m,d);this._emissiveTexture=d}}_updateFBO(d,m){const j=d.fb,A=this.painter.context,O=A.gl,R=this.drapeBufferSize;if(m){const B=new i.T(A,{width:R[0],height:R[1],data:null},O.R8);B.bind(O.LINEAR,O.CLAMP_TO_EDGE),d.emissiveTex=B,j.createColorAttachment(A,1),j.colorAttachment1.set(B.texture)}else d.emissiveTex=void 0,j.removeColorAttachment(A,1);d.dirty=!0}_initFBOPool(){for(;this.pool.length{const m=this._style._mergedLayers[d],j=m.isHidden(this.painter.transform.zoom);return m.type==="hillshade"||m.type==="custom"?!j&&m.shouldRedrape():!j&&m.hasTransition()})}_clearLineLayersFromRenderCache(){let d=!1;for(const j of this._style.getSources())if(j instanceof Tf){d=!0;break}if(!d)return;const m={};for(let j=0;jH>B.end)||i.w("fill-extrusion with flood lighting and/or ground ambient occlusion should be moved to be on top of all draped layers.")}this._drapedRenderBatches=j}_setupRenderCache(d){const m=this.proxySourceCache;if(this._shouldDisableRenderCache()||this.invalidateRenderCache){if(this.invalidateRenderCache=!1,m.renderCache.length>m.renderCachePool.length){const R=Object.values(m.proxyCachedFBO);m.proxyCachedFBO={};for(let B=0;B=0;R--){const B=j[R];if(m.getTileByID(B.key),m.proxyCachedFBO[B.key]!==void 0){const H=d[B.key],Y=this.proxyToSource[B.key];let te=0;for(const de in Y){const ce=Y[de],ue=H[de];if(!ue||ue.length!==ce.length||ce.some((je,ve)=>je!==ue[ve]||A[de]&&A[de].hasOwnProperty(je.key))){te=-1;break}++te}for(const de in m.proxyCachedFBO[B.key])m.renderCache[m.proxyCachedFBO[B.key][de]].dirty=te<0||te!==Object.values(H).length}}const O=[...this._drapedRenderBatches];O.sort((R,B)=>B.end-B.start-(R.end-R.start));for(const R of O)for(const B of j){if(m.proxyCachedFBO[B.key])continue;let H=m.renderCachePool.pop();H===void 0&&m.renderCache.length<50&&(H=m.renderCache.length,m.renderCache.push(this._createFBO())),H!==void 0&&(m.proxyCachedFBO[B.key]={},m.proxyCachedFBO[B.key][R.start]=H,m.renderCache[H].dirty=!0)}this._tilesDirty={}}_setupStencil(d,m,j,A){if(!A||!this._sourceTilesOverlap[A.id])return void(this._overlapStencilType&&(this._overlapStencilType=!1));const O=this.painter.context,R=O.gl;if(m.length<=1)return void(this._overlapStencilType=!1);let B;if(j.isTileClipped())B=m.length,this._overlapStencilMode.test={func:R.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:R.GREATER,mask:255},this._overlapStencilType="Mask"}this._stencilRef+B>255&&(O.clear({stencil:0}),this._stencilRef=0),this._stencilRef+=B,this._overlapStencilMode.ref=this._stencilRef,j.isTileClipped()&&this._renderTileClippingMasks(m,this._overlapStencilMode.ref)}clipOrMaskOverlapStencilType(){return this._overlapStencilType==="Clip"||this._overlapStencilType==="Mask"}stencilModeForRTTOverlap(d){return this.renderingToTexture&&this._overlapStencilType?(this._overlapStencilType==="Clip"&&(this._overlapStencilMode.ref=this.painter._tileClippingMaskIDs[d.key]),this._overlapStencilMode):Vn.disabled}_renderTileClippingMasks(d,m){const j=this.painter,A=this.painter.context,O=A.gl;j._tileClippingMaskIDs={},A.setColorMode(us.disabled),A.setDepthMode(gn.disabled);const R=j.getOrCreateProgram("clippingMask");for(const B of d){const H=j._tileClippingMaskIDs[B.key]=--m;R.draw(j,O.TRIANGLES,gn.disabled,new Vn({func:O.ALWAYS,mask:0},H,255,O.KEEP,O.KEEP,O.REPLACE),us.disabled,$n.disabled,Zv(B.projMatrix),"$clipping",j.tileExtentBuffer,j.quadTriangleIndexBuffer,j.tileExtentSegments)}}pointCoordinate(d){const m=this.painter.transform;if(d.x<0||d.x>m.width||d.y<0||d.y>m.height)return null;const j=[d.x,d.y,1,1];i.aC(j,j,m.pixelMatrixInverse),i.cK(j,j,1/j[3]),j[0]/=m.worldSize,j[1]/=m.worldSize;const A=m._camera.position,O=i.cf(1,m.center.lat),R=[A[0],A[1],A[2]/O,0],B=i.da([],j.slice(0,3),R);i.aw(B,B);const H=this.raycast(R,B,this._exaggeration);return H!==null&&H?(i.bH(R,R,B,H),R[3]=R[2],R[2]*=O,R):null}_setupProxiedCoordsForOrtho(d,m,j){if(d.getSource()instanceof i.aU)return this._setupProxiedCoordsForImageSource(d,m,j);this._findCoveringTileCache[d.id]=this._findCoveringTileCache[d.id]||{};const A=this.proxiedCoords[d.id]=[],O=this.proxyCoords;for(let H=0;Hte.overscaledZ-Y.overscaledZ)}_setupProxiedCoordsForImageSource(d,m,j){if(!d.getSource().loaded())return;const A=this.proxiedCoords[d.id]=[],O=this.proxyCoords,R=d.getSource(),B=R.tileID;if(!B)return;const H=new i.P(B.x,B.y)._div(1<(de.min.x=Math.min(de.min.x,ce.x-H.x),de.min.y=Math.min(de.min.y,ce.y-H.y),de.max.x=Math.max(de.max.x,ce.x-H.x),de.max.y=Math.max(de.max.y,ce.y-H.y),de),{min:new i.P(Number.MAX_VALUE,Number.MAX_VALUE),max:new i.P(-Number.MAX_VALUE,-Number.MAX_VALUE)}),te=(de,ce)=>{const ue=de.wrap+de.canonical.x/(1<Re+Y.max.x||je+veLe+Y.max.y};for(let de=0;deR.key===m.tileID.key);if(O)return O}if(m.tileID.key!==d.key){const O=d.canonical.z-m.tileID.canonical.z;let R,B,H;A=i.bC();const Y=m.tileID.wrap-d.wrap<0?(R=i.al>>O,B=R*((m.tileID.canonical.x<=de){const ce=d.canonical.z-de;m.getSource().reparseOverscaled?(B=Math.max(d.canonical.z+2,m.transform.tileZoom),R=new i.aQ(B,d.wrap,de,d.canonical.x>>ce,d.canonical.y>>ce)):ce!==0&&(B=de,R=new i.aQ(B,d.wrap,de,d.canonical.x>>ce,d.canonical.y>>ce))}R.key!==d.key&&(Y.push(R.key),j=m.getTile(R))}const te=de=>{Y.forEach(ce=>{A[ce]=de}),Y.length=0};for(B-=1;B>=H&&(!j||!j.hasData());B--){j&&te(j.tileID.key);const de=R.calculateScaledKey(B);if(j=m.getTileByID(de),j&&j.hasData())break;const ce=A[de];if(ce===null)break;ce===void 0?Y.push(de):j=m.getTileByID(ce)}return te(j?j.tileID.key:null),j&&j.hasData()?j:null}findDEMTileFor(d){return this.enabled?this._findTileCoveringTileID(d,this.sourceCache):null}prepareDrawTile(){this.renderedToTile=!0}_clearRenderCacheForTile(d,m){let j=this._tilesDirty[d];j||(j=this._tilesDirty[d]={}),j[m.key]=!0}}function u0(w,d,m){const j=function(B,H,Y){const te=i.bJ(H,B),de=i.bJ(Y,[.2126,.7152,.0722]),ce=(je,ve,Re)=>(1-Re)*je+Re*ve,ue=ce(1-.3*Math.min(de,1),1,Math.min(te+1,1));return ce(.92,1,Math.asin(i.aA(H[2],-1,1))/Math.PI+.5)*ue}(w,[0,0,1],d),A=[0,0,0];i.c5(A,m.slice(0,3),j);const O=[0,0,0];i.c5(O,d.slice(0,3),w[2]);const R=[0,0,0];return i.d8(R,A,O),i.db(R)}const Qie=["fill","fillOutline","fillPattern","line","linePattern","background","backgroundPattern","hillshade","raster"],Jie=["stars","rainParticle","snowParticle","fillExtrusion","fillExtrusionGroundEffect","building","buildingBloom","elevatedStructures","model","symbol"];class GP{static cacheKey(d,m,j,A){const O=[m];A&&O.push(A.cacheKey);for(const R of j)d.usedDefines.has(R)&&O.push(R);return O.join("/")}constructor(d,m,j,A,O,R){const B=d.gl;this.program=B.createProgram(),this.configuration=A,this.name=m,this.fixedDefines=[...R];const H=`#version 300 es ${(A?A.defines():[]).concat(R.map(ve=>`#define ${ve}`)).join(` `)}`,Y=[H,qie];for(const ve of j.fragmentIncludes)Y.push(Jm[ve]);Y.push(j.fragmentSource);const te=Y.join(` `),de=[H,RP];for(const ve of j.vertexIncludes)de.push(Jm[ve]);this.forceManualRenderingForInstanceIDShaders=d.forceManualRenderingForInstanceIDShaders&&j.vertexSource.includes("gl_InstanceID"),this.forceManualRenderingForInstanceIDShaders&&de.push("uniform int u_instanceID;"),de.push(j.vertexSource);let ce=de.join(` `);this.forceManualRenderingForInstanceIDShaders&&(ce=ce.replaceAll("gl_InstanceID","u_instanceID"));const ue=B.createShader(B.FRAGMENT_SHADER);if(B.isContextLost())return void(this.failedToCreate=!0);B.shaderSource(ue,te),B.compileShader(ue),B.attachShader(this.program,ue);const je=B.createShader(B.VERTEX_SHADER);B.isContextLost()?this.failedToCreate=!0:(B.shaderSource(je,ce),B.compileShader(je),B.attachShader(this.program,je),this.attributes={},B.linkProgram(this.program),B.deleteShader(je),B.deleteShader(ue),this.fixedUniforms=O(d),this.fixedUniformsEntries=Object.entries(this.fixedUniforms),this.binderUniforms=A?A.getUniforms(d):[],this.forceManualRenderingForInstanceIDShaders&&(this.instancingUniforms=(ve=>({u_instanceID:new i.ch(ve)}))(d)),(R.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)),R.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)),R.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)),R.includes("RENDER_CUTOFF")&&(this.cutoffUniforms=(ve=>({u_cutoff_params:new i.d3(ve)}))(d)),R.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)),R.includes("RENDER_SHADOWS")&&(this.shadowUniforms=(ve=>({u_light_matrix_0:new i.cl(ve),u_light_matrix_1:new i.cl(ve),u_fade_range:new i.ck(ve),u_shadow_normal_offset:new i.ci(ve),u_shadow_intensity:new i.cj(ve),u_shadow_texel_size:new i.cj(ve),u_shadow_map_resolution:new i.cj(ve),u_shadow_direction:new i.ci(ve),u_shadow_bias:new i.ci(ve),u_shadowmap_0:new i.ch(ve),u_shadowmap_1:new i.ch(ve)}))(d)))}getAttributeLocation(d,m){let j=this.attributes[m];return j===void 0&&(j=this.attributes[m]=d.getAttribLocation(this.program,m)),j}setTerrainUniformValues(d,m){if(!this.terrainUniforms)return;const j=this.terrainUniforms;if(!this.failedToCreate){d.program.set(this.program);for(const A in m)j[A]&&j[A].set(this.program,A,m[A])}}setGlobeUniformValues(d,m){if(!this.globeUniforms)return;const j=this.globeUniforms;if(!this.failedToCreate){d.program.set(this.program);for(const A in m)j[A]&&j[A].set(this.program,A,m[A])}}setFogUniformValues(d,m){if(!this.fogUniforms)return;const j=this.fogUniforms;if(!this.failedToCreate){d.program.set(this.program);for(const A in m)j[A].set(this.program,A,m[A])}}setCutoffUniformValues(d,m){if(!this.cutoffUniforms)return;const j=this.cutoffUniforms;if(!this.failedToCreate){d.program.set(this.program);for(const A in m)j[A].set(this.program,A,m[A])}}setLightsUniformValues(d,m){if(!this.lightsUniforms)return;const j=this.lightsUniforms;if(!this.failedToCreate){d.program.set(this.program);for(const A in m)j[A].set(this.program,A,m[A])}}setShadowUniformValues(d,m){if(this.failedToCreate||!this.shadowUniforms)return;const j=this.shadowUniforms;d.program.set(this.program);for(const A in m)j[A].set(this.program,A,m[A])}_drawDebugWireframe(d,m,j,A,O,R,B,H,Y,te){const de=d.options.wireframe;if(de.terrain===!1&&de.layers2D===!1&&de.layers3D===!1)return;const ce=d.context;if(!(!(!de.terrain||this.name!=="terrainRaster"&&this.name!=="globeRaster")||!(!de.layers2D||d._terrain&&d._terrain.renderingToTexture||!Qie.includes(this.name))||!(!de.layers3D||!Jie.includes(this.name))))return;const ue=ce.gl,je=d.wireframeDebugCache.getLinesFromTrianglesBuffer(d.frameCounter,O,ce);if(!je)return;const ve=[...this.fixedDefines,"DEBUG_WIREFRAME"],Re=d.getOrCreateProgram(this.name,{config:this.configuration,defines:ve});ce.program.set(Re.program);const Le=(Ke,wt,mt)=>{if(wt[Ke]&&mt[Ke])for(const vt in wt[Ke])mt[Ke][vt]&&mt[Ke][vt].set(mt.program,vt,wt[Ke][vt].current)};Y&&Y.setUniforms(Re.program,ce,Re.binderUniforms,B,{zoom:H}),Le("fixedUniforms",this,Re),Le("terrainUniforms",this,Re),Le("globeUniforms",this,Re),Le("fogUniforms",this,Re),Le("lightsUniforms",this,Re),Le("shadowUniforms",this,Re),je.bind(),ce.setColorMode(new us([ue.ONE,ue.ONE_MINUS_SRC_ALPHA,ue.ZERO,ue.ONE],i.ao.transparent,[!0,!0,!0,!1])),ce.setDepthMode(new gn(m.func===ue.LESS?ue.LEQUAL:m.func,gn.ReadOnly,m.range)),ce.setStencilMode(Vn.disabled);const We=3*R.primitiveLength*2,rt=3*R.primitiveOffset*2*2;if(this.forceManualRenderingForInstanceIDShaders){const Ke=te||1;for(let wt=0;wt1?ue.drawElementsInstanced(ue.LINES,We,ue.UNSIGNED_SHORT,rt,te):ue.drawElements(ue.LINES,We,ue.UNSIGNED_SHORT,rt);O.bind(),ce.program.set(this.program),ce.setDepthMode(m),ce.setStencilMode(j),ce.setColorMode(A)}checkUniforms(d,m,j){if(this.fixedDefines.includes(m)){for(const A of Object.keys(j))if(!j[A].initialized)throw new Error(`Program '${this.name}', from draw '${d}': uniform ${A} not set but required by ${m} being defined`)}}draw(d,m,j,A,O,R,B,H,Y,te,de,ce,ue,je,ve,Re){const Le=d.context,We=Le.gl;if(this.failedToCreate)return;Le.program.set(this.program),Le.setDepthMode(j),Le.setStencilMode(A),Le.setColorMode(O),Le.setCullFace(R);for(const[pt,ut]of this.fixedUniformsEntries)ut.set(this.program,pt,B[pt]);je&&je.setUniforms(this.program,Le,this.binderUniforms,ce,{zoom:ue});const rt={[We.POINTS]:1,[We.LINES]:2,[We.TRIANGLES]:3,[We.LINE_STRIP]:1}[m];this.checkUniforms(H,"RENDER_SHADOWS",this.shadowUniforms);const Ke=ve||[],wt=je?je.getPaintVertexBuffers():[],mt=m===We.TRIANGLES&&te,vt=Re&&Re>0?1:void 0;for(const pt of de.get()){const ut=pt.vaos||(pt.vaos={});if((ut[H]||(ut[H]=new Vie)).bind(Le,this,Y,wt,te,pt.vertexOffset,Ke,vt),this.forceManualRenderingForInstanceIDShaders){const St=Re||1;for(let Dt=0;Dt1?We.drawElementsInstanced(m,pt.primitiveLength*rt,We.UNSIGNED_SHORT,pt.primitiveOffset*rt*2,Re):te?We.drawElements(m,pt.primitiveLength*rt,We.UNSIGNED_SHORT,pt.primitiveOffset*rt*2):We.drawArrays(m,pt.vertexOffset,pt.vertexLength);mt&&this._drawDebugWireframe(d,j,A,O,te,pt,ce,ue,je,Re)}}}function KP(w,d,m=0){const j=Math.pow(2,d.tileID.overscaledZ),A=d.tileSize*Math.pow(2,w.transform.tileZoom)/j,O=A*(d.tileID.canonical.x+d.tileID.wrap*j),R=A*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,w.transform.tileZoom),u_pixel_coord_upper:[O>>16,R>>16],u_pixel_coord_lower:[65535&O,65535&R],u_pattern_transition:m}}const dN={terrain:0,flat:1},eoe=i.bC(),uN=(w,d,m,j,A,O,R,B,H,Y,te,de,ce,ue,je,ve,Re,Le)=>{const We=d.style.light,rt=We.properties.get("position"),Ke=[rt.x,rt.y,rt.z],wt=i.dO();We.properties.get("anchor")==="viewport"&&(i.dP(wt,-d.transform.angle),i.dQ(Ke,Ke,wt));const mt=We.properties.get("color").toPremultipliedRenderColor(null),vt=d.transform,pt={u_matrix:w,u_lightpos:Ke,u_lightintensity:We.properties.get("intensity"),u_lightcolor:[mt.r,mt.g,mt.b],u_vertical_gradient:+m,u_opacity:j,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:eoe,u_merc_center:[0,0],u_up_dir:[0,0,0],u_height_lift:0,u_height_type:dN[Y],u_base_type:dN[te],u_ao:A,u_edge_radius:O,u_width_scale:R,u_flood_light_color:je,u_vertical_scale:ve,u_flood_light_intensity:Re,u_ground_shadow_factor:Le};return vt.projection.name==="globe"&&(pt.u_tile_id=[B.canonical.x,B.canonical.y,1<({u_matrix:w,u_edge_radius:d,u_width_scale:m,u_vertical_scale:j,u_height_type:dN[A],u_base_type:dN[O]}),ZP=(w,d,m,j,A,O,R,B,H,Y,te,de,ce,ue,je,ve,Re,Le)=>{const We=uN(w,d,m,j,A,O,R,B,Y,te,de,ce,ue,je,ve,Re,1,[0,0,0]),rt={u_height_factor:-Math.pow(2,B.overscaledZ)/H.tileSize/8};return Object.assign(We,KP(d,H,Le),rt)},h0=(w,d,m,j,A,O,R,B,H,Y,te)=>({u_matrix:d,u_opacity:m,u_ao_pass:j?1:0,u_meter_to_tile:A,u_ao:O,u_flood_light_intensity:R,u_flood_light_color:B,u_attenuation:H,u_edge_radius:Y,u_fb:0,u_fb_size:te,u_dynamic_offset:1}),C5=(w,d,m)=>({u_matrix:w,u_emissive_strength:d,u_ground_shadow_factor:m}),M5=(w,d,m,j,A,O=0)=>Object.assign(C5(w,d,A),KP(m,j,O)),YP=(w,d,m,j)=>({u_matrix:w,u_world:m,u_emissive_strength:d,u_ground_shadow_factor:j}),T5=(w,d,m,j,A,O,R=0)=>Object.assign(M5(w,d,m,j,O,R),{u_world:A}),tg=(w,d)=>({u_matrix:w,u_ground_shadow_factor:d}),mx=(w,d,m,j,A)=>({u_matrix:w,u_camera_pos:[d[0],d[1],d[2]],u_depth_bias:m,u_height_scale:j,u_reset_depth:A}),hN=(w,d,m,j,A,O,R,B,H)=>({u_matrix:w,u_normal_matrix:d,u_opacity:m,u_faux_facade_ao_intensity:j,u_camera_pos:A,u_tile_to_meter:O,u_facade_emissive_chance:R,u_flood_light_color:B,u_flood_light_intensity:H}),XP=w=>({u_matrix:w}),rg=w=>({u_matrix:w}),A5=(w,d,m,j,A,O,R,B)=>{const H=i.al/O.tileSize;return{u_matrix:w,u_inv_rot_matrix:d,u_camera_to_center_distance:m.getCameraToCenterDistance(B),u_extrude_scale:[m.pixelsToGLUnits[0]/H,m.pixelsToGLUnits[1]/H],u_zoom_transition:j,u_tile_id:R,u_merc_center:A}},Xv=(w,d,m=1)=>({u_matrix:w,u_color:d,u_overlay:0,u_overlay_scale:m}),QP=i.bC(),JP=(w,d,m,j,A,O,R)=>{const B=w.transform,H=B.projection.name==="globe",Y=H?i.dR(B.zoom,d.canonical)*B._pixelsPerMercatorPixel:i.ay(m,1,O),te={u_matrix:d.projMatrix,u_extrude_scale:Y,u_intensity:R,u_inv_rot_matrix:QP,u_merc_center:[0,0],u_tile_id:[0,0,0],u_zoom_transition:0,u_up_dir:[0,0,0]};if(H){te.u_inv_rot_matrix=j,te.u_merc_center=A,te.u_tile_id=[d.canonical.x,d.canonical.y,1<({u_matrix:w,u_normalize_matrix:d,u_globe_matrix:m,u_merc_matrix:j,u_grid_matrix:A,u_tl_parent:O,u_scale_parent:Y,u_fade_t:te.mix,u_opacity:te.opacity*de.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:de.paint.get("raster-brightness-min"),u_brightness_high:de.paint.get("raster-brightness-max"),u_saturation_factor:i.dT(de.paint.get("raster-saturation")),u_contrast_factor:i.dS(de.paint.get("raster-contrast")),u_spin_weights:t6(de.paint.get("raster-hue-rotate")),u_perspective_transform:ce,u_raster_elevation:ue,u_zoom_transition:R,u_merc_center:B,u_cutoff_params:H,u_colorization_mix:fN(i.dU,ve,Le),u_colorization_offset:pN(i.dU,Re,Le),u_color_ramp:je,u_texture_offset:[rt/(We+2*rt),We/(We+2*rt)],u_texture_res:[We+2*rt,We+2*rt],u_emissive_strength:Ke});function t6(w){w*=Math.PI/180;const d=Math.sin(w),m=Math.cos(w);return[(2*m+1)/3,(-Math.sqrt(3)*d-m+1)/3,(Math.sqrt(3)*d-m+1)/3]}const Df=.05,toe=(w,d,m,j,A,O,R,B,H,Y,te,de)=>({u_matrix:w,u_normalize_matrix:d,u_globe_matrix:m,u_merc_matrix:j,u_grid_matrix:A,u_tl_parent:O,u_scale_parent:Y,u_fade_t:te.mix,u_opacity:te.opacity,u_image0:0,u_image1:1,u_raster_elevation:de,u_zoom_transition:R,u_merc_center:B,u_cutoff_params:H}),roe=(w,d,m,j,A,O,R,B,H,Y)=>({u_particle_texture:w,u_particle_texture_side_len:d,u_tile_offset:m,u_velocity:j,u_color_ramp:O,u_velocity_res:A,u_max_speed:R,u_uv_offset:B,u_data_scale:[255*H[0],255*H[1]],u_data_offset:Y,u_particle_pos_scale:1.1,u_particle_pos_offset:[Df,Df]}),r6=(w,d,m,j,A,O,R,B,H,Y)=>({u_particle_texture:w,u_particle_texture_side_len:d,u_velocity:m,u_velocity_res:j,u_max_speed:A,u_speed_factor:O,u_reset_rate:R,u_rand_seed:Math.random(),u_uv_offset:B,u_data_scale:[255*H[0],255*H[1]],u_data_offset:Y,u_particle_pos_scale:1.1,u_particle_pos_offset:[Df,Df]}),n6=i.bC(),mN=(w,d,m,j,A,O,R,B,H,Y,te,de,ce,ue,je,ve,Re,Le,We,rt,Ke,wt,mt,vt)=>{const pt=A.transform,ut={u_is_size_zoom_constant:+(w==="constant"||w==="source"),u_is_size_feature_constant:+(w==="constant"||w==="camera"),u_size_t:d?d.uSizeT:0,u_size:d?d.uSize:0,u_camera_to_center_distance:pt.getCameraToCenterDistance(We),u_rotate_symbol:+m,u_aspect_ratio:pt.width/pt.height,u_fade_change:A.options.fadeDuration?A.symbolFadeChange:1,u_matrix:O,u_label_plane_matrix:R,u_coord_matrix:B,u_is_text:+Y,u_elevation_from_sea:H?1:0,u_pitch_with_map:+j,u_texsize:te,u_texsize_icon:de,u_texture:0,u_texture_icon:1,u_tile_id:[0,0,0],u_zoom_transition:0,u_inv_rot_matrix:n6,u_merc_center:[0,0],u_camera_forward:[0,0,0],u_ecef_origin:[0,0,0],u_tile_matrix:n6,u_up_vector:[0,-1,0],u_color_adj_mat:wt,u_icon_transition:mt||0,u_gamma_scale:j?A.transform.getCameraToCenterDistance(We)*Math.cos(A.terrain?0:A.transform._pitch):1,u_device_pixel_ratio:i.o.devicePixelRatio,u_is_halo:1,u_scale_factor:vt||1,u_ground_shadow_factor:rt,u_inv_matrix:i.bl(i.bC(),R),u_normal_scale:Ke,u_lutTexture:Il.LUT};return We.name==="globe"&&(ut.u_tile_id=[ue.canonical.x,ue.canonical.y,1<({u_matrix:w,u_emissive_strength:d,u_opacity:m,u_color:j}),ng=(w,d,m,j,A,O,R,B,H)=>Object.assign(function(Y,te,de,ce,ue,je){const{width:ve,height:Re}=ce.imageManager.getPixelSize(te),Le=Math.pow(2,je.tileID.overscaledZ),We=je.tileSize*Math.pow(2,ce.transform.tileZoom)/Le,rt=We*(je.tileID.canonical.x+je.tileID.wrap*Le),Ke=We*je.tileID.canonical.y;return{u_image:0,u_pattern_tl:de.tl,u_pattern_br:de.br,u_texsize:[ve,Re],u_pattern_size:de.displaySize,u_pattern_units_to_pixels:ue?[ce.transform.width,-1*ce.transform.height]:[1/i.ay(je,1,ce.transform.tileZoom),1/i.ay(je,1,ce.transform.tileZoom)],u_pixel_coord_upper:[rt>>16,Ke>>16],u_pixel_coord_lower:[65535&rt,65535&Ke]}}(0,O,R,j,B,H),{u_matrix:w,u_emissive_strength:d,u_opacity:m}),f0=new Float32Array(i.bA([])),gx=(w,d,m,j,A,O,R,B,H,Y,te,de,ce,ue=[0,0,0],je,ve,Re)=>{const Le=A.style.light,We=Le.properties.get("position"),rt=[-We.x,-We.y,We.z],Ke=i.dO();Le.properties.get("anchor")==="viewport"&&(i.dP(Ke,-A.transform.angle),i.dQ(rt,rt,Ke));const wt=te.alphaMode==="MASK",mt=Le.properties.get("color").toNonPremultipliedRenderColor(null),vt=ce.paint.get("model-ambient-occlusion-intensity"),pt=ce.paint.get("model-color").constantOr(i.ao.white).toNonPremultipliedRenderColor(null);return pt.a=ce.paint.get("model-color-mix-intensity").constantOr(0),Re&&(pt.r=Re[0],pt.g=Re[1],pt.b=Re[2],pt.a=Re[3]),ve&&(pt.r=ve.color.r,pt.g=ve.color.g,pt.b=ve.color.b,pt.a=ve.colorMix,de=ve.emissionStrength,O*=ve.opacity),{u_matrix:w,u_lighting_matrix:d,u_normal_matrix:m,u_node_matrix:j||f0,u_lightpos:rt,u_lightintensity:Le.properties.get("intensity"),u_lightcolor:[mt.r,mt.g,mt.b],u_camera_pos:ue,u_opacity:O,u_baseTextureIsAlpha:0,u_alphaMask:+wt,u_alphaCutoff:te.alphaCutoff,u_baseColorFactor:R.toNonPremultipliedRenderColor(null).toArray01(),u_emissiveFactor:B.toNonPremultipliedRenderColor(null).toArray01(),u_metallicFactor:H,u_roughnessFactor:Y,u_baseColorTexture:Il.BaseColor,u_metallicRoughnessTexture:Il.MetallicRoughness,u_normalTexture:Il.Normal,u_occlusionTexture:Il.Occlusion,u_emissionTexture:Il.Emission,u_lutTexture:Il.LUT,u_color_mix:pt.toArray01(),u_aoIntensity:vt,u_emissive_strength:de,u_occlusionTextureTransform:je||[0,0,0,0]}},E5=(w,d=f0,m=f0)=>({u_matrix:w,u_instance:d,u_node_matrix:m}),gN={fillExtrusion:w=>({u_matrix:new i.cl(w),u_lightpos:new i.ci(w),u_lightintensity:new i.cj(w),u_lightcolor:new i.ci(w),u_vertical_gradient:new i.cj(w),u_opacity:new i.cj(w),u_edge_radius:new i.cj(w),u_width_scale:new i.cj(w),u_ao:new i.ck(w),u_height_type:new i.ch(w),u_base_type:new i.ch(w),u_tile_id:new i.ci(w),u_zoom_transition:new i.cj(w),u_inv_rot_matrix:new i.cl(w),u_merc_center:new i.ck(w),u_up_dir:new i.ci(w),u_height_lift:new i.cj(w),u_flood_light_color:new i.ci(w),u_vertical_scale:new i.cj(w),u_flood_light_intensity:new i.cj(w),u_ground_shadow_factor:new i.ci(w)}),fillExtrusionDepth:w=>({u_matrix:new i.cl(w),u_edge_radius:new i.cj(w),u_width_scale:new i.cj(w),u_vertical_scale:new i.cj(w),u_height_type:new i.ch(w),u_base_type:new i.ch(w)}),fillExtrusionPattern:w=>({u_matrix:new i.cl(w),u_lightpos:new i.ci(w),u_lightintensity:new i.cj(w),u_lightcolor:new i.ci(w),u_vertical_gradient:new i.cj(w),u_height_factor:new i.cj(w),u_edge_radius:new i.cj(w),u_width_scale:new i.cj(w),u_ao:new i.ck(w),u_height_type:new i.ch(w),u_base_type:new i.ch(w),u_tile_id:new i.ci(w),u_zoom_transition:new i.cj(w),u_inv_rot_matrix:new i.cl(w),u_merc_center:new i.ck(w),u_up_dir:new i.ci(w),u_height_lift:new i.cj(w),u_image:new i.ch(w),u_texsize:new i.ck(w),u_pixel_coord_upper:new i.ck(w),u_pixel_coord_lower:new i.ck(w),u_tile_units_to_pixels:new i.cj(w),u_opacity:new i.cj(w),u_pattern_transition:new i.cj(w)}),fillExtrusionGroundEffect:w=>({u_matrix:new i.cl(w),u_opacity:new i.cj(w),u_ao_pass:new i.cj(w),u_meter_to_tile:new i.cj(w),u_ao:new i.ck(w),u_flood_light_intensity:new i.cj(w),u_flood_light_color:new i.ci(w),u_attenuation:new i.cj(w),u_edge_radius:new i.cj(w),u_fb:new i.ch(w),u_fb_size:new i.cj(w),u_dynamic_offset:new i.cj(w)}),fill:w=>({u_matrix:new i.cl(w),u_emissive_strength:new i.cj(w),u_ground_shadow_factor:new i.ci(w)}),fillPattern:w=>({u_matrix:new i.cl(w),u_emissive_strength:new i.cj(w),u_image:new i.ch(w),u_texsize:new i.ck(w),u_pixel_coord_upper:new i.ck(w),u_pixel_coord_lower:new i.ck(w),u_tile_units_to_pixels:new i.cj(w),u_ground_shadow_factor:new i.ci(w),u_pattern_transition:new i.cj(w)}),fillOutline:w=>({u_matrix:new i.cl(w),u_emissive_strength:new i.cj(w),u_world:new i.ck(w),u_ground_shadow_factor:new i.ci(w)}),fillOutlinePattern:w=>({u_matrix:new i.cl(w),u_emissive_strength:new i.cj(w),u_world:new i.ck(w),u_image:new i.ch(w),u_texsize:new i.ck(w),u_pixel_coord_upper:new i.ck(w),u_pixel_coord_lower:new i.ck(w),u_tile_units_to_pixels:new i.cj(w),u_ground_shadow_factor:new i.ci(w),u_pattern_transition:new i.cj(w)}),building:w=>({u_matrix:new i.cl(w),u_normal_matrix:new i.cl(w),u_opacity:new i.cj(w),u_faux_facade_ao_intensity:new i.cj(w),u_camera_pos:new i.ci(w),u_tile_to_meter:new i.cj(w),u_facade_emissive_chance:new i.cj(w),u_flood_light_color:new i.ci(w),u_flood_light_intensity:new i.cj(w)}),buildingBloom:w=>({u_matrix:new i.cl(w)}),buildingDepth:w=>({u_matrix:new i.cl(w)}),elevatedStructuresDepth:w=>({u_matrix:new i.cl(w),u_depth_bias:new i.cj(w)}),elevatedStructures:w=>({u_matrix:new i.cl(w),u_ground_shadow_factor:new i.ci(w)}),elevatedStructuresDepthReconstruct:w=>({u_matrix:new i.cl(w),u_camera_pos:new i.ci(w),u_depth_bias:new i.cj(w),u_height_scale:new i.cj(w),u_reset_depth:new i.cj(w)}),circle:i.dY,collisionBox:w=>({u_matrix:new i.cl(w),u_inv_rot_matrix:new i.cl(w),u_camera_to_center_distance:new i.cj(w),u_extrude_scale:new i.ck(w),u_zoom_transition:new i.cj(w),u_merc_center:new i.ck(w),u_tile_id:new i.ci(w)}),collisionCircle:w=>({u_matrix:new i.cl(w),u_inv_matrix:new i.cl(w),u_camera_to_center_distance:new i.cj(w),u_viewport_size:new i.ck(w)}),debug:w=>({u_color:new i.dB(w),u_matrix:new i.cl(w),u_overlay:new i.ch(w),u_overlay_scale:new i.cj(w)}),clippingMask:w=>({u_matrix:new i.cl(w)}),heatmap:w=>({u_extrude_scale:new i.cj(w),u_intensity:new i.cj(w),u_matrix:new i.cl(w),u_inv_rot_matrix:new i.cl(w),u_merc_center:new i.ck(w),u_tile_id:new i.ci(w),u_zoom_transition:new i.cj(w),u_up_dir:new i.ci(w)}),heatmapTexture:w=>({u_image:new i.ch(w),u_color_ramp:new i.ch(w),u_opacity:new i.cj(w)}),hillshade:w=>({u_matrix:new i.cl(w),u_image:new i.ch(w),u_latrange:new i.ck(w),u_light:new i.ck(w),u_shadow:new i.dB(w),u_highlight:new i.dB(w),u_emissive_strength:new i.cj(w),u_accent:new i.dB(w)}),hillshadePrepare:w=>({u_matrix:new i.cl(w),u_image:new i.ch(w),u_dimension:new i.ck(w),u_zoom:new i.cj(w)}),line:i.dX,linePattern:i.dW,raster:w=>({u_matrix:new i.cl(w),u_normalize_matrix:new i.cl(w),u_globe_matrix:new i.cl(w),u_merc_matrix:new i.cl(w),u_grid_matrix:new i.dC(w),u_tl_parent:new i.ck(w),u_scale_parent:new i.cj(w),u_fade_t:new i.cj(w),u_opacity:new i.cj(w),u_image0:new i.ch(w),u_image1:new i.ch(w),u_brightness_low:new i.cj(w),u_brightness_high:new i.cj(w),u_saturation_factor:new i.cj(w),u_contrast_factor:new i.cj(w),u_spin_weights:new i.ci(w),u_perspective_transform:new i.ck(w),u_raster_elevation:new i.cj(w),u_zoom_transition:new i.cj(w),u_merc_center:new i.ck(w),u_cutoff_params:new i.d3(w),u_colorization_mix:new i.d3(w),u_colorization_offset:new i.cj(w),u_color_ramp:new i.ch(w),u_texture_offset:new i.ck(w),u_texture_res:new i.ck(w),u_emissive_strength:new i.cj(w)}),rasterParticle:w=>({u_matrix:new i.cl(w),u_normalize_matrix:new i.cl(w),u_globe_matrix:new i.cl(w),u_merc_matrix:new i.cl(w),u_grid_matrix:new i.dC(w),u_tl_parent:new i.ck(w),u_scale_parent:new i.cj(w),u_fade_t:new i.cj(w),u_opacity:new i.cj(w),u_image0:new i.ch(w),u_image1:new i.ch(w),u_raster_elevation:new i.cj(w),u_zoom_transition:new i.cj(w),u_merc_center:new i.ck(w),u_cutoff_params:new i.d3(w)}),rasterParticleTexture:w=>({u_texture:new i.ch(w),u_opacity:new i.cj(w)}),rasterParticleDraw:w=>({u_particle_texture:new i.ch(w),u_particle_texture_side_len:new i.cj(w),u_tile_offset:new i.ck(w),u_velocity:new i.ch(w),u_color_ramp:new i.ch(w),u_velocity_res:new i.ck(w),u_max_speed:new i.cj(w),u_uv_offset:new i.ck(w),u_data_scale:new i.ck(w),u_data_offset:new i.cj(w),u_particle_pos_scale:new i.cj(w),u_particle_pos_offset:new i.ck(w)}),rasterParticleUpdate:w=>({u_particle_texture:new i.ch(w),u_particle_texture_side_len:new i.cj(w),u_velocity:new i.ch(w),u_velocity_res:new i.ck(w),u_max_speed:new i.cj(w),u_speed_factor:new i.cj(w),u_reset_rate:new i.cj(w),u_rand_seed:new i.cj(w),u_uv_offset:new i.ck(w),u_data_scale:new i.ck(w),u_data_offset:new i.cj(w),u_particle_pos_scale:new i.cj(w),u_particle_pos_offset:new i.ck(w)}),symbol:w=>({u_is_size_zoom_constant:new i.ch(w),u_is_size_feature_constant:new i.ch(w),u_size_t:new i.cj(w),u_size:new i.cj(w),u_camera_to_center_distance:new i.cj(w),u_rotate_symbol:new i.ch(w),u_aspect_ratio:new i.cj(w),u_fade_change:new i.cj(w),u_matrix:new i.cl(w),u_label_plane_matrix:new i.cl(w),u_coord_matrix:new i.cl(w),u_is_text:new i.ch(w),u_elevation_from_sea:new i.ch(w),u_pitch_with_map:new i.ch(w),u_texsize:new i.ck(w),u_texsize_icon:new i.ck(w),u_texture:new i.ch(w),u_texture_icon:new i.ch(w),u_gamma_scale:new i.cj(w),u_device_pixel_ratio:new i.cj(w),u_tile_id:new i.ci(w),u_zoom_transition:new i.cj(w),u_inv_rot_matrix:new i.cl(w),u_merc_center:new i.ck(w),u_camera_forward:new i.ci(w),u_tile_matrix:new i.cl(w),u_up_vector:new i.ci(w),u_ecef_origin:new i.ci(w),u_is_halo:new i.ch(w),u_icon_transition:new i.cj(w),u_color_adj_mat:new i.cl(w),u_scale_factor:new i.cj(w),u_ground_shadow_factor:new i.ci(w),u_inv_matrix:new i.cl(w),u_normal_scale:new i.cj(w),u_lutTexture:new i.ch(w)}),background:w=>({u_matrix:new i.cl(w),u_emissive_strength:new i.cj(w),u_opacity:new i.cj(w),u_color:new i.dB(w)}),backgroundPattern:w=>({u_matrix:new i.cl(w),u_emissive_strength:new i.cj(w),u_opacity:new i.cj(w),u_image:new i.ch(w),u_pattern_tl:new i.ck(w),u_pattern_br:new i.ck(w),u_texsize:new i.ck(w),u_pattern_size:new i.ck(w),u_pixel_coord_upper:new i.ck(w),u_pixel_coord_lower:new i.ck(w),u_pattern_units_to_pixels:new i.ck(w)}),terrainRaster:w=>({u_matrix:new i.cl(w),u_image0:new i.ch(w),u_image1:new i.ch(w),u_skirt_height:new i.cj(w),u_ground_shadow_factor:new i.ci(w),u_emissive_texture_available:new i.cj(w)}),skybox:w=>({u_matrix:new i.cl(w),u_sun_direction:new i.ci(w),u_cubemap:new i.ch(w),u_opacity:new i.cj(w),u_temporal_offset:new i.cj(w)}),skyboxGradient:w=>({u_matrix:new i.cl(w),u_color_ramp:new i.ch(w),u_center_direction:new i.ci(w),u_radius:new i.cj(w),u_opacity:new i.cj(w),u_temporal_offset:new i.cj(w)}),skyboxCapture:w=>({u_matrix_3f:new i.dC(w),u_sun_direction:new i.ci(w),u_sun_intensity:new i.cj(w),u_color_tint_r:new i.d3(w),u_color_tint_m:new i.d3(w),u_luminance:new i.cj(w)}),globeRaster:w=>({u_proj_matrix:new i.cl(w),u_globe_matrix:new i.cl(w),u_normalize_matrix:new i.cl(w),u_merc_matrix:new i.cl(w),u_zoom_transition:new i.cj(w),u_merc_center:new i.ck(w),u_image0:new i.ch(w),u_image1:new i.ch(w),u_grid_matrix:new i.dC(w),u_skirt_height:new i.cj(w),u_far_z_cutoff:new i.cj(w),u_frustum_tl:new i.ci(w),u_frustum_tr:new i.ci(w),u_frustum_br:new i.ci(w),u_frustum_bl:new i.ci(w),u_globe_pos:new i.ci(w),u_globe_radius:new i.cj(w),u_viewport:new i.ck(w),u_emissive_texture_available:new i.cj(w)}),globeAtmosphere:w=>({u_frustum_tl:new i.ci(w),u_frustum_tr:new i.ci(w),u_frustum_br:new i.ci(w),u_frustum_bl:new i.ci(w),u_horizon:new i.cj(w),u_transition:new i.cj(w),u_fadeout_range:new i.cj(w),u_atmosphere_fog_color:new i.d3(w),u_high_color:new i.d3(w),u_space_color:new i.d3(w),u_temporal_offset:new i.cj(w),u_horizon_angle:new i.cj(w)}),model:w=>({u_matrix:new i.cl(w),u_lighting_matrix:new i.cl(w),u_normal_matrix:new i.cl(w),u_node_matrix:new i.cl(w),u_lightpos:new i.ci(w),u_lightintensity:new i.cj(w),u_lightcolor:new i.ci(w),u_camera_pos:new i.ci(w),u_opacity:new i.cj(w),u_baseColorFactor:new i.d3(w),u_emissiveFactor:new i.d3(w),u_metallicFactor:new i.cj(w),u_roughnessFactor:new i.cj(w),u_baseTextureIsAlpha:new i.ch(w),u_alphaMask:new i.ch(w),u_alphaCutoff:new i.cj(w),u_baseColorTexture:new i.ch(w),u_metallicRoughnessTexture:new i.ch(w),u_normalTexture:new i.ch(w),u_occlusionTexture:new i.ch(w),u_emissionTexture:new i.ch(w),u_lutTexture:new i.ch(w),u_color_mix:new i.d3(w),u_aoIntensity:new i.cj(w),u_emissive_strength:new i.cj(w),u_occlusionTextureTransform:new i.d3(w)}),modelDepth:w=>({u_matrix:new i.cl(w),u_instance:new i.cl(w),u_node_matrix:new i.cl(w)}),groundShadow:w=>({u_matrix:new i.cl(w),u_ground_shadow_factor:new i.ci(w)}),stars:w=>({u_matrix:new i.cl(w),u_up:new i.ci(w),u_right:new i.ci(w),u_intensity_multiplier:new i.cj(w)}),snowParticle:w=>({u_modelview:new i.cl(w),u_projection:new i.cl(w),u_time:new i.cj(w),u_cam_pos:new i.ci(w),u_velocityConeAperture:new i.cj(w),u_velocity:new i.cj(w),u_horizontalOscillationRadius:new i.cj(w),u_horizontalOscillationRate:new i.cj(w),u_boxSize:new i.cj(w),u_billboardSize:new i.cj(w),u_simpleShapeParameters:new i.ck(w),u_screenSize:new i.ck(w),u_thinningCenterPos:new i.ck(w),u_thinningShape:new i.ci(w),u_thinningAffectedRatio:new i.cj(w),u_thinningParticleOffset:new i.cj(w),u_particleColor:new i.d3(w),u_direction:new i.ci(w)}),rainParticle:w=>({u_modelview:new i.cl(w),u_projection:new i.cl(w),u_time:new i.cj(w),u_cam_pos:new i.ci(w),u_texScreen:new i.ch(w),u_velocityConeAperture:new i.cj(w),u_velocity:new i.cj(w),u_boxSize:new i.cj(w),u_rainDropletSize:new i.ck(w),u_distortionStrength:new i.cj(w),u_rainDirection:new i.ci(w),u_color:new i.d3(w),u_screenSize:new i.ck(w),u_thinningCenterPos:new i.ck(w),u_thinningShape:new i.ci(w),u_thinningAffectedRatio:new i.cj(w),u_thinningParticleOffset:new i.cj(w),u_shapeDirectionalPower:new i.cj(w),u_shapeNormalPower:new i.cj(w),u_mode:new i.cj(w)}),vignette:w=>({u_vignetteShape:new i.ci(w),u_vignetteColor:new i.d3(w)}),occlusion:w=>({u_matrix:new i.cl(w),u_anchorPos:new i.ci(w),u_screenSizePx:new i.ck(w),u_occluderSizePx:new i.ck(w),u_color:new i.d3(w)})};class Hh{constructor(d,m,j,A){this.id=Hh.uniqueIdxCounter,Hh.uniqueIdxCounter++,this.context=d;const O=d.gl;this.buffer=O.createBuffer(),this.dynamicDraw=!!j,this.context.unbindVAO(),d.bindElementBuffer.set(this.buffer),O.bufferData(O.ELEMENT_ARRAY_BUFFER,m.arrayBuffer,this.dynamicDraw?O.DYNAMIC_DRAW:O.STATIC_DRAW),this.dynamicDraw||A||m.destroy()}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(d){this.id=Hh.uniqueIdxCounter,Hh.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)}}Hh.uniqueIdxCounter=0;const I5={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class s6{constructor(d,m,j,A,O,R){this.length=m.length,this.attributes=j,this.itemSize=m.bytesPerElement,this.dynamicDraw=A,this.instanceCount=R,this.context=d;const B=d.gl;this.buffer=B.createBuffer(),d.bindVertexBuffer.set(this.buffer),B.bufferData(B.ARRAY_BUFFER,m.arrayBuffer,this.dynamicDraw?B.DYNAMIC_DRAW:B.STATIC_DRAW),this.dynamicDraw||O||m.destroy()}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(d){const m=this.context.gl;this.bind(),m.bufferSubData(m.ARRAY_BUFFER,0,d.arrayBuffer)}enableAttributes(d,m){for(let j=0;j0&&d.vertexAttribDivisor(O,j)}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class a6{constructor(d,m,j,A,O){this.context=d,this.width=m,this.height=j;const R=this.framebuffer=d.gl.createFramebuffer();A>0&&(this.colorAttachment0=new aN(d,R,0)),A>1&&(this.colorAttachment1=new aN(d,R,1)),O&&(this.depthAttachmentType=O,this.depthAttachment=O==="renderbuffer"?new c0(d,R):new Gv(d,R))}createColorAttachment(d,m){m===0?this.colorAttachment0=new aN(d,this.framebuffer,0):m===1&&(this.colorAttachment1=new aN(d,this.framebuffer,1))}removeColorAttachment(d,m){const j=this.context.gl;let A;m===0?(A=this.colorAttachment0.get(),this.colorAttachment0=void 0):m===1&&(A=this.colorAttachment1.get(),this.colorAttachment1=void 0),A&&j.deleteTexture(A)}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 p0{constructor(d,m){this.gl=d,this.clearColor=new Kie(this),this.clearDepth=new FP(this),this.clearStencil=new p5(this),this.colorMask=new eN(this),this.depthMask=new m5(this),this.stencilMask=new px(this),this.stencilFunc=new a0(this),this.stencilOp=new Hv(this),this.stencilTest=new i0(this),this.depthRange=new zP(this),this.depthTest=new g5(this),this.depthFunc=new BP(this),this.blend=new o0(this),this.blendFunc=new tN(this),this.blendColor=new rN(this),this.blendEquation=new x5(this),this.cullFace=new nN(this),this.cullFaceSide=new Wv(this),this.frontFace=new $P(this),this.program=new UP(this),this.activeTexture=new qP(this),this.viewport=new l0(this),this.bindFramebuffer=new VP(this),this.bindRenderbuffer=new Zie(this),this.bindTexture=new Yie(this),this.bindVertexBuffer=new Xie(this),this.bindElementBuffer=new y5(this),this.bindVertexArrayOES=new v5(this),this.pixelStoreUnpack=new _5(this),this.pixelStoreUnpackPremultiplyAlpha=new b5(this),this.pixelStoreUnpackFlipY=new HP(this),this.options=m?Object.assign({},m):{},this.options.extTextureFilterAnisotropicForceOff||(this.extTextureFilterAnisotropic=d.getExtension("EXT_texture_filter_anisotropic")||d.getExtension("MOZ_EXT_texture_filter_anisotropic")||d.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=d.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT))),this.extDebugRendererInfo=d.getExtension("WEBGL_debug_renderer_info"),this.extDebugRendererInfo&&(this.renderer=d.getParameter(this.extDebugRendererInfo.UNMASKED_RENDERER_WEBGL),this.vendor=d.getParameter(this.extDebugRendererInfo.UNMASKED_VENDOR_WEBGL)),this.forceManualRenderingForInstanceIDShaders=m&&!!m.forceManualRenderingForInstanceIDShaders||this.renderer&&this.renderer.indexOf("PowerVR")!==-1,this.options.extTextureFloatLinearForceOff||(this.extTextureFloatLinear=d.getExtension("OES_texture_float_linear")),this.extRenderToTextureHalfFloat=d.getExtension("EXT_color_buffer_half_float"),this.extTimerQuery=d.getExtension("EXT_disjoint_timer_query_webgl2"),this.maxTextureSize=d.getParameter(d.MAX_TEXTURE_SIZE),this.extBlendFuncExtended=d.getExtension("WEBGL_blend_func_extended")}setDefault(){this.unbindVAO(),this.clearColor.setDefault(),this.clearDepth.setDefault(),this.clearStencil.setDefault(),this.colorMask.setDefault(),this.depthMask.setDefault(),this.stencilMask.setDefault(),this.stencilFunc.setDefault(),this.stencilOp.setDefault(),this.stencilTest.setDefault(),this.depthRange.setDefault(),this.depthTest.setDefault(),this.depthFunc.setDefault(),this.blend.setDefault(),this.blendFunc.setDefault(),this.blendColor.setDefault(),this.blendEquation.setDefault(),this.cullFace.setDefault(),this.cullFaceSide.setDefault(),this.frontFace.setDefault(),this.program.setDefault(),this.activeTexture.setDefault(),this.bindFramebuffer.setDefault(),this.pixelStoreUnpack.setDefault(),this.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.pixelStoreUnpackFlipY.setDefault()}setDirty(){this.clearColor.dirty=!0,this.clearDepth.dirty=!0,this.clearStencil.dirty=!0,this.colorMask.dirty=!0,this.depthMask.dirty=!0,this.stencilMask.dirty=!0,this.stencilFunc.dirty=!0,this.stencilOp.dirty=!0,this.stencilTest.dirty=!0,this.depthRange.dirty=!0,this.depthTest.dirty=!0,this.depthFunc.dirty=!0,this.blend.dirty=!0,this.blendFunc.dirty=!0,this.blendColor.dirty=!0,this.blendEquation.dirty=!0,this.cullFace.dirty=!0,this.cullFaceSide.dirty=!0,this.frontFace.dirty=!0,this.program.dirty=!0,this.activeTexture.dirty=!0,this.viewport.dirty=!0,this.bindFramebuffer.dirty=!0,this.bindRenderbuffer.dirty=!0,this.bindTexture.dirty=!0,this.bindVertexBuffer.dirty=!0,this.bindElementBuffer.dirty=!0,this.bindVertexArrayOES.dirty=!0,this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0}createIndexBuffer(d,m,j){return new Hh(this,d,m,j)}createVertexBuffer(d,m,j,A,O){return new s6(this,d,m,j,A,O)}createRenderbuffer(d,m,j){const A=this.gl,O=A.createRenderbuffer();return this.bindRenderbuffer.set(O),A.renderbufferStorage(A.RENDERBUFFER,d,m,j),this.bindRenderbuffer.set(null),O}createFramebuffer(d,m,j,A){return new a6(this,d,m,j,A)}clear({color:d,depth:m,stencil:j,colorMask:A}){const O=this.gl;let R=0;d&&(R|=O.COLOR_BUFFER_BIT,this.clearColor.set(d.toNonPremultipliedRenderColor(null)),this.colorMask.set(A||[!0,!0,!0,!0])),m!==void 0&&(R|=O.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(m),this.depthMask.set(!0)),j!==void 0&&(R|=O.STENCIL_BUFFER_BIT,this.clearStencil.set(j),this.stencilMask.set(255)),O.clear(R)}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,us.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 xx;function en(w,d,m,j,A,O,R){const B=w.context,H=B.gl,Y=w.transform,te=[i.aF(Y.center.lng),i.aJ(Y.center.lat)],de=m.layout.get("symbol-placement"),ce=m.layout.get("text-variable-anchor"),ue=m.layout.get("icon-rotation-alignment")==="map",je=m.layout.get("text-rotation-alignment")==="map",ve=de!=="point",Re=[];let Le=0,We=0;for(let ut=0;ut0){const qr=i.bC(),Xr=Sr;i.cP(qr,Ot.placementInvProjMatrix,Y.glCoordMatrix),i.cP(qr,qr,Ot.placementViewportMatrix),Re.push({circleArray:cn,circleOffset:We,transform:Xr,invTransform:qr,projection:Ot.getProjection()}),Le+=cn.length/4,We=Le}if(!wr)continue;w.terrain&&w.terrain.setupElevationDraw(Dt,Kr);const rn=hr?[St.canonical.x,St.canonical.y,1<=0&&(ue[rt.associatedIconIndex]={x:Ot,y:Gt,z:Zt,angle:Jt})}else Uh(mt,de)}if(Y){ce.clear();const We=w.icon.placedSymbolArray;for(let rt=0;rt{let ia=[0,0,0];if(Ma){const ps=w.style.directionalLight,fi=w.style.ambientLight;ps&&fi&&(ia=Ep(w.style,ps,fi))}return ia},fa=Ma=>{ut.depthOcclusionForSymbolsAndCircles&&(m.hasOcclusionOpacityProperties||w.terrain)&&(Ma.push("DEPTH_D24"),Ma.push("DEPTH_OCCLUSION"))},Yn=Ma=>{m.lut&&!mt&&(m.lut.texture||(m.lut.texture=new i.d$(w.context,m.lut.image,[m.lut.image.height,m.lut.image.height,m.lut.image.height],vt.gl.RGBA8)),vt.activeTexture.set(vt.gl.TEXTURE0+Il.LUT),m.lut.texture&&m.lut.texture.bind(vt.gl.LINEAR,vt.gl.CLAMP_TO_EDGE),Ma.push("APPLY_LUT_ON_GPU"))},Ca=()=>{const Ma=St&&m.layout.get("symbol-placement")!=="point",ia=[];fa(ia),Yn(ia);const ps=Ma||ts,fi=wr.elevationType==="road",uo=w.shadowRenderer,qi=fi&&Ot&&!!uo&&uo.enabled,Xa=hn(qi),kd=fi&&Ot&&!w.terrain?Ut:br,pc=m.paint.get("icon-image-cross-fade");w.terrainRenderModeElevated()&&Ot&&ia.push("PITCH_WITH_MAP_TERRAIN"),cn&&(ia.push("PROJECTION_GLOBE_VIEW"),ps&&ia.push("PROJECTED_POS_ON_VIEWPORT")),pc>0&&wr.hasAnySecondaryIcon&&ia.push("ICON_TRANSITION"),!wr.icon.zOffsetVertexBuffer||fi&&w.terrain||ia.push("Z_OFFSET"),Le===0&&We===0&&rt===0&&Ke===1||ia.push("COLOR_ADJUSTMENT"),wr.sdfIcons&&ia.push("RENDER_SDF"),qi&&ia.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET"),fi&&Ot&&!w.terrain&&wr.icon.orientationVertexBuffer&&ia.push("ELEVATED_ROADS");const el=wr.icon.programConfigurations.get(m.id),Ic=w.getOrCreateProgram("symbol",{config:el,defines:ia}),Pc=Sr.imageAtlasTexture?Sr.imageAtlasTexture.size:[0,0],Gl=wr.iconSizeData,Du=i.bK(Gl,ut.zoom),ph=Ot||!ut.isOrthographic,Zd=_a(qr,Sr.tileID.canonical,Ot,St,ut,wr.getProjection(),Xr),eo=cu(qr,Sr.tileID.canonical,Ot,St,ut,wr.getProjection(),Xr),xo=w.translatePosMatrix(eo,Sr,B,Y,!0),Qa=w.translatePosMatrix(qr,Sr,B,Y),So=ps?Jv:Zd,Zi=St&&!Ot&&!Ma;let Vi=Ar;!Ht&&!ut.mercatorFromTransition||St||(Vi=Pp(ut));const mh=cn?Vi:Ar,h_=m.getColorAdjustmentMatrix(Le,We,rt,Ke),Kh=mN(Gl.kind,Du,Zi,Ot,w,Qa,So,xo,wt,!1,Pc,[0,0],0,Kr,rn,Tt,Us,mh,wr.getProjection(),Xa,wa,h_,pc,null),f_=Sr.imageAtlasTexture?Sr.imageAtlasTexture:null,j0=m.layout.get("icon-size").constantOr(0)!==1||wr.iconsNeedLinear,$f=wr.sdfIcons||w.options.rotating||w.options.zooming||j0||ph?pt.LINEAR:pt.NEAREST,Up=wr.sdfIcons&&m.paint.get("icon-halo-width").constantOr(1)!==0,k0=w.terrain&&Ot&&Ma?i.bl(i.bC(),Zd):Jv;if(Ma&&wr.icon){const cg=i.bV.getAtTileOffsetFunc(Kr,ut.center.lat,ut.worldSize,wr.getProjection()),qp=$h(qr,Sr.tileID.canonical,Ot,St,ut,wr.getProjection(),Xr),Zh=m.layout.get("icon-size-scale-range"),Vp=i.aA(w.scaleFactor,Zh[0],Zh[1]);TP(wr,qr,w,!1,qp,eo,Ot,ve,cg,Kr,Vp)}return{program:Ic,buffers:wr.icon,uniformValues:Kh,atlasTexture:f_,atlasTextureIcon:null,atlasInterpolation:$f,atlasInterpolationIcon:null,isSDF:wr.sdfIcons,hasHalo:Up,depthMode:kd,tile:Sr,renderWithShadows:qi,labelPlaneMatrixInv:k0}},qa=()=>{const Ma=Dt&&m.layout.get("symbol-placement")!=="point",ia=[],ps=Ma||Jt||ts,fi=wr.elevationType==="road",uo=w.shadowRenderer,qi=fi&&Gt&&!!uo&&uo.enabled,Xa=hn(qi),kd=fi&&Gt&&!w.terrain?Ut:br;w.terrainRenderModeElevated()&&Gt&&ia.push("PITCH_WITH_MAP_TERRAIN"),cn&&(ia.push("PROJECTION_GLOBE_VIEW"),ps&&ia.push("PROJECTED_POS_ON_VIEWPORT")),!wr.text.zOffsetVertexBuffer||fi&&w.terrain||ia.push("Z_OFFSET"),wr.iconsInText&&ia.push("RENDER_TEXT_AND_SYMBOL"),ia.push("RENDER_SDF"),qi&&ia.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET"),fi&&Gt&&!w.terrain&&wr.text.orientationVertexBuffer&&ia.push("ELEVATED_ROADS"),fa(ia);const pc=wr.text.programConfigurations.get(m.id),el=w.getOrCreateProgram("symbol",{config:pc,defines:ia});let Ic,Pc=[0,0],Gl=null;const Du=wr.textSizeData;wr.iconsInText&&(Pc=Sr.imageAtlasTexture?Sr.imageAtlasTexture.size:[0,0],Gl=Sr.imageAtlasTexture?Sr.imageAtlasTexture:null,Ic=Gt||!ut.isOrthographic||w.options.rotating||w.options.zooming||Du.kind==="composite"||Du.kind==="camera"?pt.LINEAR:pt.NEAREST);const ph=Sr.glyphAtlasTexture?Sr.glyphAtlasTexture.size:[0,0],Zd=m.layout.get("text-size-scale-range"),eo=i.aA(w.scaleFactor,Zd[0],Zd[1]),xo=i.bK(Du,ut.zoom,eo),Qa=_a(qr,Sr.tileID.canonical,Gt,Dt,ut,wr.getProjection(),Xr),So=cu(qr,Sr.tileID.canonical,Gt,Dt,ut,wr.getProjection(),Xr),Zi=w.translatePosMatrix(So,Sr,H,te,!0),Vi=w.translatePosMatrix(qr,Sr,H,te),mh=ps?Jv:Qa,h_=Dt&&!Gt&&!Ma;let Kh=Ar;!Ht&&!ut.mercatorFromTransition||Dt||(Kh=Pp(ut));const f_=mN(Du.kind,xo,h_,Gt,w,Vi,mh,Zi,wt,!0,ph,Pc,0,Kr,rn,Tt,Us,cn?Kh:Ar,wr.getProjection(),Xa,wa,null,null,eo),j0=Sr.glyphAtlasTexture?Sr.glyphAtlasTexture:null,$f=pt.LINEAR,Up=m.paint.get("text-halo-width").constantOr(1)!==0,k0=w.terrain&&Gt&&Ma?i.bl(i.bC(),Qa):Jv;if(Ma&&wr.text){const cg=i.bV.getAtTileOffsetFunc(Kr,ut.center.lat,ut.worldSize,wr.getProjection()),qp=$h(qr,Sr.tileID.canonical,Gt,Dt,ut,wr.getProjection(),Xr);TP(wr,qr,w,!0,qp,So,Gt,Re,cg,Kr,eo)}return{program:el,buffers:wr.text,uniformValues:f_,atlasTexture:j0,atlasTextureIcon:Gl,atlasInterpolation:$f,atlasInterpolationIcon:Ic,isSDF:!0,hasHalo:Up,depthMode:kd,tile:Sr,renderWithShadows:qi,labelPlaneMatrixInv:k0}},Oa=wr.icon.segments.get().length,ha=wr.text.segments.get().length,fs=Oa&&!R.onlyText?Ca():null,Na=ha&&!R.onlyIcons?qa():null,Ki=m.paint.get("icon-opacity").constantOr(1),ji=m.paint.get("text-opacity").constantOr(1);if(Zt&&wr.canOverlap){ar=!0;const Ma=Ki&&!R.onlyText?wr.icon.segments.get():[],ia=ji&&!R.onlyIcons?wr.text.segments.get():[];for(const ps of Ma)hr.push({segments:new i.bg([ps]),sortKey:ps.sortKey,state:fs});for(const ps of ia)hr.push({segments:new i.bg([ps]),sortKey:ps.sortKey,state:Na})}else R.onlyText||hr.push({segments:Ki?wr.icon.segments:new i.bg([]),sortKey:0,state:fs}),R.onlyIcons||hr.push({segments:ji?wr.text.segments:new i.bg([]),sortKey:0,state:Na})}ar&&hr.sort((Kr,Sr)=>Kr.sortKey-Sr.sortKey);for(const Kr of hr){const Sr=Kr.state;if(Sr)if(w.terrain?w.terrain.setupElevationDraw(Sr.tile,Sr.program,{useDepthForOcclusion:ut.depthOcclusionForSymbolsAndCircles,labelPlaneMatrixInv:Sr.labelPlaneMatrixInv}):w.setupDepthForOcclusion(ut.depthOcclusionForSymbolsAndCircles,Sr.program),vt.activeTexture.set(pt.TEXTURE0),Sr.atlasTexture&&Sr.atlasTexture.bind(Sr.atlasInterpolation,pt.CLAMP_TO_EDGE,!0),Sr.atlasTextureIcon&&(vt.activeTexture.set(pt.TEXTURE1),Sr.atlasTextureIcon&&Sr.atlasTextureIcon.bind(Sr.atlasInterpolationIcon,pt.CLAMP_TO_EDGE,!0)),Sr.renderWithShadows&&w.shadowRenderer.setupShadows(Sr.tile.tileID.toUnwrapped(),Sr.program,"vector-tile"),w.uploadCommonLightUniforms(w.context,Sr.program),Sr.hasHalo){const wr=Sr.uniformValues;wr.u_is_halo=1,P5(Sr.buffers,Kr.segments,m,w,Sr.program,Sr.depthMode,A,O,wr,2),wr.u_is_halo=0}else{if(Sr.isSDF){const wr=Sr.uniformValues;Sr.hasHalo&&(wr.u_is_halo=1,P5(Sr.buffers,Kr.segments,m,w,Sr.program,Sr.depthMode,A,O,wr,1)),wr.u_is_halo=0}P5(Sr.buffers,Kr.segments,m,w,Sr.program,Sr.depthMode,A,O,Sr.uniformValues,1)}}}function P5(w,d,m,j,A,O,R,B,H,Y){const te=[w.dynamicLayoutVertexBuffer,w.opacityVertexBuffer,w.iconTransitioningVertexBuffer,w.globeExtVertexBuffer,w.zOffsetVertexBuffer,w.orientationVertexBuffer];A.draw(j,j.context.gl.TRIANGLES,O,R,B,$n.disabled,H,m.id,w.layoutVertexBuffer,w.indexBuffer,d,m.paint,j.transform.zoom,w.programConfigurations.get(m.id),te,Y)}function i6(w,d){const m=1<=Vh?1:ue.pitch/Vh))),2*je}(w.transform),Y=w.transform.getFreeCameraOptions().position,te="elevatedStructuresDepthReconstruct",de=w.getOrCreateProgram(te,{defines:["DEPTH_RECONSTRUCTION"]}),ce=w.getOrCreateProgram(te);for(const ue of j){const je=d.getTile(ue),ve=je.getBucket(m);if(!ve)continue;const Re=ve.elevatedStructures;if(!Re)continue;const Le=ve.elevationBufferData.heightRange,We=i6(ue.toUnwrapped(),Y),rt=w.translatePosMatrix(ue.projMatrix,je,m.paint.get("fill-translate"),m.paint.get("fill-translate-anchor"));let Ke,wt,mt,vt;if(A==="initialize"){if(!Le||Le.min>=1||Re.depthSegments.segments[0].primitiveLength===0)continue;Ke=mx(rt,We,H,1,0),wt=R,mt=Re.depthSegments,vt=de}else if(A==="reset"){if(!Le||Le.min>=0||Re.maskSegments.segments[0].primitiveLength===0)continue;Ke=mx(rt,We,0,0,1),wt=B,mt=Re.maskSegments,vt=de}else if(A==="geometry"){if(Re.depthSegments.segments[0].primitiveLength===0)continue;Ke=mx(rt,We,H,1,0),wt=R,mt=Re.depthSegments,vt=ce}vt.draw(w,O.TRIANGLES,wt,Vn.disabled,us.disabled,$n.disabled,Ke,m.id,Re.vertexBuffer,Re.indexBuffer,mt,m.paint,w.transform.zoom)}}function yN(w,d,m,j){const{painter:A,sourceCache:O,layer:R,coords:B,colorMode:H,elevationType:Y,terrainEnabled:te,pass:de}=w,ce=A.context.gl,ue=R.paint.get("fill-pattern"),je=R.paint.get("fill-pattern-cross-fade"),ve=ue.constantOr(null);let Re=Y;Y!=="road"||d&&!te||(Re="none");const Le=Re==="road",We=w.painter.shadowRenderer,rt=Le&&!!We&&We.enabled,Ke=new gn(A.context.gl.LEQUAL,gn.ReadOnly,A.depthRangeFor3D);let wt=[0,0,0];if(rt){const ut=A.style.directionalLight,St=A.style.ambientLight;ut&&St&&(wt=Ep(A.style,ut,St))}const mt=ue&&ue.constantOr(1),vt=A.terrain&&A.terrain.renderingToTexture,pt=(ut,St)=>{let Dt,Ot,Gt,Zt,ar;St?(Dt=mt&&!R.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",Gt=ce.LINES):(Dt=mt?"fillPattern":"fill",Gt=ce.TRIANGLES);for(const br of B){const Ut=O.getTile(br);if(mt&&!Ut.patternsLoaded())continue;const Tt=Ut.getBucket(R);if(!Tt)continue;const Jt=d?Tt.elevationBufferData:Tt.bufferData;if(Jt.isEmpty())continue;A.prepareDrawTile();const Ht=Jt.programConfigurations.get(R.id),hr=A.isTileAffectedByFog(br),Ar=[],Kr=[];Le&&(Ar.push("ELEVATED_ROADS"),Kr.push(Jt.elevatedLayoutVertexBuffer)),rt&&Ar.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET"),vt&&m&&Ar.push("USE_MRT1"),mt&&(A.context.activeTexture.set(ce.TEXTURE0),Ut.imageAtlasTexture&&Ut.imageAtlasTexture.bind(ce.LINEAR,ce.CLAMP_TO_EDGE),Ht.updatePaintBuffers());let Sr=!1;if(ve&&Ut.imageAtlas){const Xr=Ut.imageAtlas,Cn=i.e3.from(ve),ts=Cn.getPrimary().scaleSelf(i.o.devicePixelRatio).toString(),Us=Cn.getSecondary(),wa=Xr.patternPositions.get(ts),hn=Us?Xr.patternPositions.get(Us.scaleSelf(i.o.devicePixelRatio).toString()):null;Sr=!!wa&&!!hn,wa&&Ht.setConstantPatternPositions(wa,hn)}je>0&&(Sr||Ht.getPatternTransitionVertexBuffer("fill-pattern"))&&Ar.push("FILL_PATTERN_TRANSITION");const wr=A.getOrCreateProgram(Dt,{config:Ht,overrideFog:hr,defines:Ar}),cn=A.translatePosMatrix(br.projMatrix,Ut,R.paint.get("fill-translate"),R.paint.get("fill-translate-anchor"));rt&&We.setupShadows(Ut.tileID.toUnwrapped(),wr,"vector-tile");const rn=R.paint.get("fill-emissive-strength");if(St){Zt=Jt.lineIndexBuffer,ar=Jt.lineSegments;const Xr=A.terrain&&A.terrain.renderingToTexture?A.terrain.drapeBufferSize:[ce.drawingBufferWidth,ce.drawingBufferHeight];Ot=Dt==="fillOutlinePattern"&&mt?T5(cn,rn,A,Ut,Xr,wt,je):YP(cn,rn,Xr,wt)}else Zt=Jt.indexBuffer,ar=Jt.triangleSegments,Ot=mt?M5(cn,rn,A,Ut,wt,je):C5(cn,rn,wt);A.uploadCommonUniforms(A.context,wr,br.toUnwrapped());let qr=ut;(Y==="road"&&!te||Y==="offset")&&(qr=Ke),wr.draw(A,Gt,qr,j||A.stencilModeForClipping(br),H,$n.disabled,Ot,R.id,Jt.layoutVertexBuffer,Zt,ar,R.paint,A.transform.zoom,Ht,Kr)}};A.renderPass===de&&pt(A.depthModeForSublayer(1,A.renderPass==="opaque"?gn.ReadWrite:gn.ReadOnly),!1),Re==="none"&&A.renderPass==="translucent"&&R.paint.get("fill-antialias")&&pt(A.depthModeForSublayer(R.getPaintProperty("fill-outline-color")?2:0,gn.ReadOnly),!0)}function vN(w,d,m,j,A,O,R,B){m.resetLayerRenderingStats(w);const H=w.context,Y=H.gl,te=w.transform,de=m.paint.get("fill-extrusion-pattern"),ce=m.paint.get("fill-extrusion-pattern-cross-fade"),ue=de.constantOr(null),je=de.constantOr(1),ve=m.paint.get("fill-extrusion-opacity"),Re=w.style.enable3dLights(),Le=m.paint.get(Re&&!je?"fill-extrusion-ambient-occlusion-wall-radius":"fill-extrusion-ambient-occlusion-radius"),We=[m.paint.get("fill-extrusion-ambient-occlusion-intensity"),Le],rt=m.layout.get("fill-extrusion-edge-radius"),Ke=rt>0&&!m.paint.get("fill-extrusion-rounded-roof"),wt=Ke?0:rt,mt=te.projection.name==="globe"?i.eb():0,vt=te.projection.name==="globe",pt=vt?i.aj(te.zoom):0,ut=[i.aF(te.center.lng),i.aJ(te.center.lat)],St=m.paint.get("fill-extrusion-flood-light-color-use-theme").constantOr("default")==="none",Dt=m.paint.get("fill-extrusion-flood-light-color").toNonPremultipliedRenderColor(St?null:m.lut).toArray01().slice(0,3),Ot=m.paint.get("fill-extrusion-flood-light-intensity"),Gt=m.paint.get("fill-extrusion-vertical-scale"),Zt=m.paint.get("fill-extrusion-line-width").constantOr(1)!==0,ar=m.paint.get("fill-extrusion-height-alignment"),br=m.paint.get("fill-extrusion-base-alignment"),Ut=Zm(w,m.paint.get("fill-extrusion-cutoff-fade-range")),Tt=[];let Jt;vt&&Tt.push("PROJECTION_GLOBE_VIEW"),We[0]>0&&Tt.push("FAUX_AO"),Ke&&Tt.push("ZERO_ROOF_RADIUS"),B&&Tt.push("HAS_CENTROID"),Ot>0&&Tt.push("FLOOD_LIGHT"),Ut.shouldRenderCutoff&&Tt.push("RENDER_CUTOFF"),Zt&&Tt.push("RENDER_WALL_MODE");const Ht=w.renderPass==="shadow",hr=w.shadowRenderer,Ar=Ht&&!!hr,Kr=Ht?$n.disabled:$n.backCCW;w.shadowRenderer&&(w.shadowRenderer.useNormalOffset=!0);let Sr=[0,0,0];if(hr){const rn=w.style.directionalLight,qr=w.style.ambientLight;rn&&qr&&(Sr=Ep(w.style,rn,qr)),Ht||(Tt.push("RENDER_SHADOWS","DEPTH_TEXTURE"),hr.useNormalOffset&&Tt.push("NORMAL_OFFSET")),Jt=Tt.concat(["SHADOWS_SINGLE_CASCADE"])}const wr=Ar?"fillExtrusionDepth":je?"fillExtrusionPattern":"fillExtrusion",cn=m.getLayerRenderingStats();for(const rn of j){const qr=d.getTile(rn),Xr=qr.getBucket(m);if(!Xr||Xr.projection.name!==te.projection.name)continue;let Cn=!1;hr&&(Cn=hr.getMaxCascadeForTile(rn.toUnwrapped())===0);const ts=w.isTileAffectedByFog(rn),Us=Xr.programConfigurations.get(m.id);let wa=!1;if(ue&&qr.imageAtlas){const ha=qr.imageAtlas,fs=i.e3.from(ue),Na=fs.getPrimary().scaleSelf(i.o.devicePixelRatio).toString(),Ki=fs.getSecondary(),ji=ha.patternPositions.get(Na),Ma=Ki?ha.patternPositions.get(Ki.scaleSelf(i.o.devicePixelRatio).toString()):null;wa=!!ji&&!!Ma,ji&&Us.setConstantPatternPositions(ji,Ma)}ce>0&&(wa||Us.getPatternTransitionVertexBuffer("fill-extrusion-pattern"))&&Tt.push("FILL_EXTRUSION_PATTERN_TRANSITION");const hn=w.getOrCreateProgram(wr,{config:Us,defines:Cn?Jt:Tt,overrideFog:ts});if(w.terrain&&w.terrain.setupElevationDraw(qr,hn,{useMeterToDem:!0}),!Xr.centroidVertexBuffer){const ha=hn.getAttributeLocation(Y,"a_centroid_pos");ha!==-1&&Y.vertexAttrib2f(ha,0,0)}!Ht&&hr&&hr.setupShadows(qr.tileID.toUnwrapped(),hn,"vector-tile"),je&&(w.context.activeTexture.set(Y.TEXTURE0),qr.imageAtlasTexture&&qr.imageAtlasTexture.bind(Y.LINEAR,Y.CLAMP_TO_EDGE),Us.updatePaintBuffers());const fa=m.paint.get("fill-extrusion-vertical-gradient"),Yn=1/Xr.tileToMeter;let Ca;if(Ht&&hr){if(Op(qr.tileID,Xr.maxHeight,w))continue;const ha=hr.calculateShadowPassMatrixFromTile(qr.tileID.toUnwrapped());Ca=S5(ha,wt,Yn,Gt,ar,br)}else{const ha=w.translatePosMatrix(rn.expandedProjMatrix,qr,m.paint.get("fill-extrusion-translate"),m.paint.get("fill-extrusion-translate-anchor")),fs=te.projection.createInversionMatrix(te,rn.canonical);Ca=je?ZP(ha,w,fa,ve,We,wt,Yn,rn,qr,mt,ar,br,pt,ut,fs,Dt,Gt,ce):uN(ha,w,fa,ve,We,wt,Yn,rn,mt,ar,br,pt,ut,fs,Dt,Gt,Ot,Sr)}w.uploadCommonUniforms(H,hn,rn.toUnwrapped(),null,Ut);let qa=Xr.segments;if(te.projection.name==="mercator"&&!Ht&&(qa=Xr.getVisibleSegments(qr.tileID,w.terrain,w.transform.getFrustum(0)),!qa.get().length))continue;if(cn)if(Ht)for(const ha of qa.get())cn.numRenderedVerticesInShadowPass+=ha.primitiveLength;else for(const ha of qa.get())cn.numRenderedVerticesInTransparentPass+=ha.primitiveLength;const Oa=[];(w.terrain||B)&&Oa.push(Xr.centroidVertexBuffer),vt&&Oa.push(Xr.layoutVertexExtBuffer),Zt&&Oa.push(Xr.wallVertexBuffer),hn.draw(w,H.gl.TRIANGLES,A,O,R,Kr,Ca,m.id,Xr.layoutVertexBuffer,Xr.indexBuffer,qa,m.paint,w.transform.zoom,Us,Oa)}w.shadowRenderer&&(w.shadowRenderer.useNormalOffset=!1)}class L5{constructor(){this.translate=[0,0],this.translateAnchor="map",this.edgeRadius=0,this.cutoffFadeRange=0}}function Lp(w,d,m,j,A,O,R,B,H,Y,te,de,ce,ue,je,ve,Re,Le,We,rt){const Ke=d.context,wt=Ke.gl,mt=d.transform,vt=d.transform.zoom,pt=[],ut=w.translate,St=w.translateAnchor,Dt=w.edgeRadius,Ot=Zm(d,w.cutoffFadeRange);te==="clear"?(pt.push("CLEAR_SUBPASS"),rt&&(pt.push("CLEAR_FROM_TEXTURE"),Ke.activeTexture.set(wt.TEXTURE0),rt.bind(wt.LINEAR,wt.CLAMP_TO_EDGE))):te==="sdf"?pt.push("SDF_SUBPASS"):te==="emissive"&&(pt.push("USE_MRT1"),Ke.activeTexture.set(wt.TEXTURE0),rt.bind(wt.LINEAR,wt.CLAMP_TO_EDGE)),Le&&pt.push("HAS_CENTROID"),Ot.shouldRenderCutoff&&pt.push("RENDER_CUTOFF");const Gt=(Zt,ar,br,Ut,Tt)=>{let Jt=pt;ar.groundRadiusBuffer!=null&&(Jt=pt.concat("HAS_ATTRIBUTE_a_flood_light_ground_radius"));const Ht=ar.programConfigurations.get(j.id),hr=d.isTileAffectedByFog(Zt),Ar=d.getOrCreateProgram("fillExtrusionGroundEffect",{config:Ht,defines:Jt,overrideFog:hr}),Kr=h0(d,Ut,de,Y,Tt,[ce,ue*Tt],je,ve,Re,vt>=17?0:Dt*Tt,rt?rt.size[0]:0),Sr=[];Le&&Sr.push(ar.hiddenByLandmarkVertexBuffer),ar.groundRadiusBuffer!=null&&Sr.push(ar.groundRadiusBuffer),d.uploadCommonUniforms(Ke,Ar,Zt.toUnwrapped(),null,Ot),Ar.draw(d,Ke.gl.TRIANGLES,O,R,B,H,Kr,j.id,ar.vertexBuffer,ar.indexBuffer,br,j.paint,vt,Ht,Sr)};for(const Zt of A){const ar=m.getTile(Zt),br=ar.getBucket(j);if(!br||br.projection.name!==mt.projection.name||!br.groundEffect||br.groundEffect&&!br.groundEffect.hasData())continue;const Ut=br.groundEffect,Tt=1/br.tileToMeter;{const Jt=d.translatePosMatrix(Zt.projMatrix,ar,ut,St),Ht=Ut.getDefaultSegment();Gt(Zt,Ut,Ht,Jt,Tt)}if(We)for(let Jt=0;Jt<4;Jt++){const Ht=i.e9[Jt](Zt),hr=m.getTile(Ht);if(!hr)continue;const Ar=hr.getBucket(j);if(!Ar||Ar.projection.name!==mt.projection.name||!Ar.groundEffect||Ar.groundEffect&&!Ar.groundEffect.hasData())continue;const Kr=Ar.groundEffect;let Sr,wr;Jt===0?(Sr=[-i.al,0,0],wr=1):Jt===1?(Sr=[i.al,0,0],wr=0):Jt===2?(Sr=[0,-i.al,0],wr=3):(Sr=[0,i.al,0],wr=2);const cn=Kr.regionSegments[wr];if(!cn)continue;const rn=new Float32Array(16);i.br(rn,Zt.projMatrix,Sr),Gt(Zt,Kr,cn,d.translatePosMatrix(rn,ar,ut,St),Tt)}}}function noe(w,d,m,j,A,O,R){j.centroidVertexArray.length===0&&j.createCentroidsBuffer();const B=O?O.findDEMTileFor(m):null;if(!(B&&B.dem||R))return;O&&B&&B.dem&&j.selfDEMTileTimestamp!==B.dem._timestamp&&(j.borderDoneWithNeighborZ=[-1,-1,-1,-1],j.selfDEMTileTimestamp=B.dem._timestamp);const H=Le=>new i.P(Math.ceil((Le+i.ed)*i.ee),0),Y=Le=>{const We=d.getSource().minzoom,rt=wt=>{const mt=d.getTileByID(wt);if(mt&&mt.hasData())return mt.getBucket(A)},Ke=[0,-1,1];for(const wt of Ke){if(Le.overscaledZ+wt(te[0]=Math.min(Le.min.y,We.min.y),te[1]=Math.max(Le.max.y,We.max.y),te[2]=i.al-We.min.x>Le.max.x?We.min.x-i.al:Le.max.x,te),ce=(Le,We)=>(te[0]=Math.min(Le.min.x,We.min.x),te[1]=Math.max(Le.max.x,We.max.x),te[2]=i.al-We.min.y>Le.max.y?We.min.y-i.al:Le.max.y,te),ue=[(Le,We)=>de(Le,We),(Le,We)=>de(We,Le),(Le,We)=>ce(Le,We),(Le,We)=>ce(We,Le)],je=(Le,We,rt,Ke,wt,mt,vt)=>{if(!O)return 0;const pt=[[mt?rt:Le,mt?Le:rt,0],[mt?rt:We,mt?We:rt,0]],ut=vt<0?i.al+vt:vt,St=[mt?ut:(Le+We)/2,mt?(Le+We)/2:ut,0];return rt===0&&vt<0||rt!==0&&vt>0?O.getForTilePoints(wt,[St],!0,Ke):pt.push(St),O.getForTilePoints(m,pt,!0,B),Math.max(pt[0][2],pt[1][2],St[2])/O.exaggeration()};for(let Le=0;Le<4;Le++){const We=j.borderFeatureIndices[Le];if(We.length===0)continue;const rt=i.e9[Le](m),Ke=Y(rt);if(!(Ke&&Ke instanceof i.ea))continue;const wt=O?O.findDEMTileFor(rt):null;if(!(wt&&wt.dem||R)||(O&&wt&&wt.dem&&j.borderDEMTileTimestamp[Le]!==wt.dem._timestamp&&(j.borderDoneWithNeighborZ[Le]=-1,j.borderDEMTileTimestamp[Le]=wt.dem._timestamp),j.borderDoneWithNeighborZ[Le]===Ke.canonical.z))continue;Ke.centroidVertexArray.length===0&&Ke.createCentroidsBuffer();const mt=(Le<2?1:5)-Le,vt=Ke.borderDoneWithNeighborZ[mt]!==j.canonical.z,pt=Ke.borderFeatureIndices[mt];let ut=0;if(j.canonical.z!==Ke.canonical.z){for(const St of We)j.showCentroid(j.featuresOnBorder[St]);if(vt)for(const St of pt)Ke.showCentroid(Ke.featuresOnBorder[St]);j.borderDoneWithNeighborZ[Le]=Ke.canonical.z,Ke.borderDoneWithNeighborZ[mt]=j.canonical.z}for(const St of We){const Dt=j.featuresOnBorder[St],Ot=j.centroidData[Dt.centroidDataIndex],Gt=Dt.borders[Le];let Zt;for(;utGt[0]+3||ar[0]>Gt[0]-3)break;Ke.showCentroid(Zt),ut++}if(Zt&&utGt[1]-3)&&(br++,++ut!==pt.length);)Zt=Ke.featuresOnBorder[pt[ut]];Zt=Ke.featuresOnBorder[pt[ar]];let Ut=!1;if(br>=1){const Ht=Zt.borders[mt];Math.abs(Gt[0]-Ht[0])<3&&Math.abs(Gt[1]-Ht[1])<3&&(br=1,Ut=!0,ut=ar+1)}else if(br===0){j.showCentroid(Dt);continue}const Tt=Ke.centroidData[Zt.centroidDataIndex];R&&Ut&&(((ve=Ot).flags|(Re=Tt).flags)&i.ec?(ve.flags|=i.ec,Re.flags|=i.ec):(ve.flags&=~i.ec,Re.flags&=~i.ec));const Jt=Dt.intersectsCount()>1||Zt.intersectsCount()>1;if(br>1)ut=ar,Ot.centroidXY=Tt.centroidXY=new i.P(0,0);else if(wt&&wt.dem&&!Jt){const Ht=ue[Le](Ot,Tt),hr=Le%2?i.al-1:0,Ar=je(Ht[0],Math.min(i.al-1,Ht[1]),hr,wt,rt,Le<2,Ht[2]);Ot.centroidXY=Tt.centroidXY=H(Ar)}else Jt?Ot.centroidXY=Tt.centroidXY=new i.P(0,0):(Ot.centroidXY=j.encodeBorderCentroid(Dt),Tt.centroidXY=Ke.encodeBorderCentroid(Zt));j.writeCentroidToBuffer(Ot),Ke.writeCentroidToBuffer(Tt)}else j.showCentroid(Dt)}j.borderDoneWithNeighborZ[Le]=Ke.canonical.z,Ke.borderDoneWithNeighborZ[mt]=j.canonical.z}var ve,Re;(j.needsCentroidUpdate||!j.centroidVertexBuffer&&j.centroidVertexArray.length!==0)&&j.uploadCentroid(w)}const du=[1,0,0],O5=[0,1,0],wd=[0,0,1];function Op(w,d,m){const j=m.transform,A=m.shadowRenderer;if(!A)return!0;const O=w.toUnwrapped(),R=j.tileSize*A._cascades[m.currentShadowCascade].scale;let B=d;if(j.elevation){const ve=j.elevation.getMinMaxForTile(w);ve&&(B+=ve.max)}const H=[...A.shadowDirection];H[2]=-H[2];const Y=A.computeSimplifiedTileShadowVolume(O,B,R,H);if(!Y)return!1;const te=[du,O5,wd,H,[H[0],0,H[2]],[0,H[1],H[2]]],de=j.projection.name==="globe",ce=j.scaleZoom(R),ue=i.cB.fromInvProjectionMatrix(j.invProjMatrix,j.worldSize,ce,!de),je=A.getCurrentCascadeFrustum();return ue.intersectsPrecise(Y.vertices,Y.planes,te)===0||je.intersectsPrecise(Y.vertices,Y.planes,te)===0}function t_(w){const{painter:d,source:m,layer:j,coords:A}=w;let O=w.defines;const R=d.context,B=d.renderPass==="shadow",H=d.renderPass==="light-beam",Y=d.shadowRenderer,te=i.ef(d.transform.center.lat,d.transform.zoom),de=Zm(d,j.paint.get("building-cutoff-fade-range"));de.shouldRenderCutoff&&(O=O.concat("RENDER_CUTOFF")),w.floodLightIntensity>0&&(O=O.concat("FLOOD_LIGHT"));for(const ce of A){const ue=m.getTile(ce),je=ue.getBucket(j);if(!je)continue;Y&&Y.getMaxCascadeForTile(ce.toUnwrapped())===0&&(O=O.concat("SHADOWS_SINGLE_CASCADE"));const ve=je.programConfigurations.get(j.id);let Re,Le,We,rt=d.translatePosMatrix(ce.expandedProjMatrix,ue,[0,0],"map");if(rt=i.cS(i.bC(),rt,[1,1,w.verticalScale]),B&&Y){if(Op(ue.tileID,je.maxHeight*te,d))continue;let wt=Y.calculateShadowPassMatrixFromTile(ue.tileID.toUnwrapped());wt=i.cS(i.bC(),wt,[1,1,w.verticalScale]),We=rg(wt),Re=Le=d.getOrCreateProgram("buildingDepth",{config:ve,defines:O,overrideFog:!1})}else if(H)Re=Le=d.getOrCreateProgram("buildingBloom",{config:ve,defines:O,overrideFog:!1}),We=XP(rt);else{const wt=d.transform.calculatePosMatrix(ce.toUnwrapped(),d.transform.worldSize);i.cS(wt,wt,[1,1,w.verticalScale]);const mt=i.bC();i.cS(mt,wt,[1,-1,1/te]),i.bl(mt,mt),i.eg(mt,mt);const vt=d.transform.getFreeCameraOptions().position,pt=1<{if(H){const vt=wt.entranceBloom;mt.draw(d,R.gl.TRIANGLES,w.depthMode,Vn.disabled,w.blendMode,$n.disabled,We,j.id,vt.layoutVertexBuffer,vt.indexBuffer,vt.segmentsBucket,j.paint,d.transform.zoom,ve,[vt.layoutAttenuationBuffer,vt.layoutColorBuffer])}else{const vt=wt.segmentsBucket;let pt=[wt.layoutNormalBuffer,wt.layoutCentroidBuffer,wt.layoutColorBuffer,wt.layoutFloodLightDataBuffer];wt.layoutFacadePaintBuffer&&(pt=pt.concat([wt.layoutFacadeDataBuffer,wt.layoutFacadeVerticalRangeBuffer,wt.layoutFacadePaintBuffer])),mt.draw(d,R.gl.TRIANGLES,w.depthMode,Vn.disabled,w.blendMode,B?$n.disabled:$n.backCW,We,j.id,wt.layoutVertexBuffer,wt.indexBuffer,vt,j.paint,d.transform.zoom,ve,pt)}};d.uploadCommonUniforms(R,Le,ce.toUnwrapped(),null,de),je.buildingWithoutFacade&&Ke(je.buildingWithoutFacade,Le),je.buildingWithFacade&&(Re!==Le&&d.uploadCommonUniforms(R,Re,ce.toUnwrapped(),null,de),Ke(je.buildingWithFacade,Re))}}function _N(w,d,m,j,A,O,R,B,H,Y,te,de,ce){const ue=w.context.gl,je=w.depthModeForSublayer(1,gn.ReadOnly,ue.LEQUAL,!0),ve=.1*(1-(Re=te))+3*Re;var Re;const Le=w._showOverdrawInspector,We=de,rt=new L5;Le||Lp(rt,w,d,m,j,je,new Vn({func:ue.ALWAYS,mask:255},255,255,ue.KEEP,ue.KEEP,ue.REPLACE),new us([ue.ONE,ue.ONE,ue.ONE,ue.ONE],i.ao.transparent,[!1,!1,!1,!0],ue.MIN),$n.disabled,A,"sdf",O,R,B,H,Y,ve,We,!1);{const Ke=Le?Vn.disabled:new Vn({func:ue.EQUAL,mask:255},255,255,ue.KEEP,ue.DECR,ue.DECR),wt=Le?w.colorModeForRenderPass():new us([ue.ONE_MINUS_DST_ALPHA,ue.DST_ALPHA,ue.ONE,ue.ONE],i.ao.transparent,[!0,!0,!0,!0]);Lp(rt,w,d,m,j,je,Ke,wt,$n.disabled,A,"color",O,R,B,H,Y,ve,We,!1)}}function bN(w){return[w[0]*i.eh,w[1]*i.eh,w[2]*i.eh,0]}function r_(w,d,m,j,A,O,R,B,H){const Y=j.getSource(),te=m.globeSharedBuffers;if(!te)return;let de,ce,ue;if(d&&(de=j.getTile(d)),Y instanceof i.aU?(ce=Y.texture,ue=i.dK(0,0,m.transform)):de&&d&&(ce=de.texture,ue=i.dK(d.canonical.z,d.canonical.x,m.transform)),!ce||!ue)return;w||(ue=i.cS(i.bC(),ue,[1,-1,1]));const je=m.context,ve=je.gl,Re=A.paint.get("raster-resampling")==="nearest"?ve.NEAREST:ve.LINEAR,Le=m.colorModeForDrapableLayerRenderPass(O),We=R.defines;We.push("GLOBE_POLES");const rt=new gn(ve.LEQUAL,gn.ReadWrite,m.depthRangeFor3D),Ke=Float32Array.from(m.transform.expandedFarZProjMatrix),wt=Float32Array.from(i.bk(i.dJ(new i.cD(0,0,0))));m.terrain&&m.terrain.prepareDrawTile(),je.activeTexture.set(ve.TEXTURE0),ce.bind(Re,ve.CLAMP_TO_EDGE),je.activeTexture.set(ve.TEXTURE1),ce.bind(Re,ve.CLAMP_TO_EDGE),"useMipmap"in ce&&je.extTextureFilterAnisotropic&&m.transform.pitch>20&&ve.texParameterf(ve.TEXTURE_2D,je.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,je.extTextureFilterAnisotropicMax);const[mt,vt,pt,ut]=d?te.getPoleBuffers(d.canonical.z,!1):te.getPoleBuffers(0,!0),St=A.paint.get("raster-elevation");let Dt;w?(Dt=mt,m.renderDefaultNorthPole=St!==0):(Dt=vt,m.renderDefaultSouthPole=St!==0);const Ot=bN(R.mix),Gt=((ar,br,Ut,Tt,Jt,Ht,hr,Ar,Kr,Sr,wr,cn,rn)=>e6(ar,br,Ut,new Float32Array(16),new Float32Array(9),[0,0],Tt,[0,0],[0,0,0,0],1,{opacity:1,mix:0},Ht,[0,0],Ar,2,Sr,wr,cn,1,0,rn))(Ke,wt,ue,i.aj(m.transform.zoom),0,A,0,St,0,Ot,R.offset,R.range,O),Zt=m.getOrCreateProgram("raster",{defines:We});m.uploadCommonUniforms(je,Zt,null),Zt.draw(m,ve.TRIANGLES,rt,H,Le,B,Gt,A.id,Dt,pt,ut)}function o6(w){const d=w._nearZ,m=w.projection.farthestPixelDistance(w),j=m-d,A=.2*w.height,O=d+A;return[d,m,(O-A-d)/j,(O-d)/j]}function Dp(w,d,m,j){if(w)return d instanceof hc&&w instanceof Yy?d.getTextureDescriptor(w,m,!0):{texture:w.texture,mix:bN(j.mix),offset:j.offset,buffer:0,tileSize:1}}var oi=i.ei([{name:"a_index",type:"Int16",components:1}]);class wN{constructor(d,m,j,A){const O={width:j[0],height:j[1],data:null},R=d.gl;this.targetColorTexture=new i.T(d,O,R.RGBA8,{useMipmap:!1}),this.backgroundColorTexture=new i.T(d,O,R.RGBA8,{useMipmap:!1}),this.context=d,this.updateParticleTexture(m,A),this.lastInvalidatedAt=0}updateParticleTexture(d,m){if(this.particleTextureDimension===m.width)return;(this.particleTexture0||this.particleTexture1||this.particleIndexBuffer||this.particleSegment)&&(this.particleTexture0.destroy(),this.particleTexture1.destroy(),this.particleIndexBuffer.destroy(),this.particleSegment.destroy());const j=this.context.gl,A=m.width*m.height;this.particleTexture0=new i.T(this.context,m,j.RGBA8,{premultiply:!1,useMipmap:!1}),this.particleTexture1=new i.T(this.context,m,j.RGBA8,{premultiply:!1,useMipmap:!1});const O=new i.ej;O.reserve(A);for(let R=0;R0){const Ot=i.bj(m.canonical,H),Gt=i.el(Ot);ce=i.aB(new Float32Array(16),H.globeMatrix,Gt),i.aB(ce,H.projMatrix,ce)}const ue=i.bC();ue[12]+=2*A/(i.o.devicePixelRatio*H.width),ue[13]+=2*O/(i.o.devicePixelRatio*H.height),i.aB(ce,ue,ce);const je=w.getOrCreateProgram("debug",{defines:de}),ve=d.getTileByID(m.key);w.terrain&&w.terrain.setupElevationDraw(ve,je);const Re=gn.disabled,Le=Vn.disabled,We=w.colorModeForRenderPass(),rt="$debug";B.activeTexture.set(Y.TEXTURE0),w.emptyTexture.bind(Y.LINEAR,Y.CLAMP_TO_EDGE),te?ve._makeGlobeTileDebugBuffers(w.context,H):ve._makeDebugTileBoundsBuffers(w.context,H.projection);const Ke=ve._tileDebugBuffer||w.debugBuffer,wt=ve._tileDebugIndexBuffer||w.debugIndexBuffer,mt=ve._tileDebugSegments||w.debugSegments;if(je.draw(w,Y.LINE_STRIP,Re,Le,We,$n.disabled,Xv(ce,j.toPremultipliedRenderColor(null)),rt,Ke,wt,mt,null,null,null,[ve._globeTileDebugBorderBuffer]),R){const Ot=ve.latestRawTileData,Gt=Math.floor((Ot&&Ot.byteLength||0)/1024);let Zt=m.canonical.toString();m.overscaledZ!==m.canonical.z&&(Zt+=` => ${m.overscaledZ}`),Zt+=` ${ve.state}`,Zt+=` ${Gt}kb`,function(ar,br){ar.initDebugOverlayCanvas();const Ut=ar.debugOverlayCanvas,Tt=ar.context.gl,Jt=ar.debugOverlayCanvas.getContext("2d");Jt.clearRect(0,0,Ut.width,Ut.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(br,5,5),Jt.strokeText(br,5,5),ar.debugOverlayTexture.update(Ut),ar.debugOverlayTexture.bind(Tt.LINEAR,Tt.CLAMP_TO_EDGE)}(w,Zt)}const vt=d.getTile(m).tileSize,pt=512/Math.min(vt,512)*(m.overscaledZ/H.zoom)*.5,ut=ve._tileDebugTextBuffer||w.debugBuffer,St=ve._tileDebugTextIndexBuffer||w.quadTriangleIndexBuffer,Dt=ve._tileDebugTextSegments||w.debugSegments;je.draw(w,Y.TRIANGLES,Re,Le,us.alphaBlended,$n.disabled,Xv(ce,i.ao.transparent.toPremultipliedRenderColor(null),pt),rt,ut,St,Dt,null,null,null,[ve._globeTileDebugTextBuffer])}function _x(w,d,m,j){Ft(w,0,d+m/2,w.transform.width,m,j)}function Ji(w,d,m,j){Ft(w,d-m/2,0,m,w.transform.height,j)}function Ft(w,d,m,j,A,O){const R=w.context,B=R.gl;B.enable(B.SCISSOR_TEST),B.scissor(d*i.o.devicePixelRatio,m*i.o.devicePixelRatio,j*i.o.devicePixelRatio,A*i.o.devicePixelRatio),R.clear({color:O}),B.disable(B.SCISSOR_TEST)}const h6=i.ei([{name:"a_pos_3f",components:3,type:"Float32"}]),{members:jN}=h6;function Rf(w,d,m,j){w.emplaceBack(d,m,j)}class kN{constructor(d){this.vertexArray=new i.em,this.indices=new i.b0,Rf(this.vertexArray,-1,-1,1),Rf(this.vertexArray,1,-1,1),Rf(this.vertexArray,-1,1,1),Rf(this.vertexArray,1,1,1),Rf(this.vertexArray,-1,-1,-1),Rf(this.vertexArray,1,-1,-1),Rf(this.vertexArray,-1,1,-1),Rf(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,jN),this.indexBuffer=d.createIndexBuffer(this.indices),this.segment=i.bg.simpleSegment(0,0,36,12)}}function bx(w,d,m,j,A,O){const R=w.context.gl,B=d.paint.get("sky-atmosphere-color"),H=d.paint.get("sky-atmosphere-halo-color"),Y=d.paint.get("sky-atmosphere-sun-intensity"),te=((de,ce,ue,je,ve)=>({u_matrix_3f:de,u_sun_direction:ce,u_sun_intensity:ue,u_color_tint_r:[je.r,je.g,je.b,je.a],u_color_tint_m:[ve.r,ve.g,ve.b,ve.a],u_luminance:5e-5}))(i.eo(i.dO(),j),A,Y,B.toPremultipliedRenderColor(null),H.toPremultipliedRenderColor(null));R.framebufferTexture2D(R.FRAMEBUFFER,R.COLOR_ATTACHMENT0,R.TEXTURE_CUBE_MAP_POSITIVE_X+O,d.skyboxTexture,0),m.draw(w,R.TRIANGLES,gn.disabled,Vn.disabled,us.unblended,$n.frontCW,te,"skyboxCapture",d.skyboxGeometry.vertexBuffer,d.skyboxGeometry.indexBuffer,d.skyboxGeometry.segment)}const f6=i.ei([{type:"Float32",name:"a_pos",components:3},{type:"Float32",name:"a_uv",components:2}]);class m0{constructor(d){const m=new i.ep;m.emplaceBack(-1,1,1,0,0),m.emplaceBack(1,1,1,1,0),m.emplaceBack(1,-1,1,1,1),m.emplaceBack(-1,-1,1,0,1);const j=new i.b0;j.emplaceBack(0,1,2),j.emplaceBack(2,3,0),this.vertexBuffer=d.createVertexBuffer(m,f6.members),this.indexBuffer=d.createIndexBuffer(j),this.segments=i.bg.simpleSegment(0,0,4,2)}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy()}}const soe=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 aoe{constructor(){this.starsCount=16e3,this.sizeMultiplier=.15,this.sizeRange=100,this.intensityRange=200}}class p6{constructor(d){this.colorModeAlphaBlendedWriteRGB=new us([1,Pf,1,Pf],i.ao.transparent,[!0,!0,!0,!1]),this.colorModeWriteAlpha=new us([1,0,1,0],i.ao.transparent,[!1,!1,!1,!0]),this.params=new aoe,this.updateNeeded=!0}update(d){const m=d.context;if(!this.atmosphereBuffer||this.updateNeeded){this.updateNeeded=!1,this.atmosphereBuffer=new m0(m);const j=this.params.sizeRange,A=this.params.intensityRange,O=function(te){const de=i.eq(30),ce=[];for(let ue=0;ue{const pt=O.projection.name==="globe"?["PROJECTION_GLOBE_VIEW","FOG"]:["FOG"];vt&&pt.push("ALPHA_PASS");const ut=d.getOrCreateProgram("globeAtmosphere",{defines:pt}),St=((Ot,Gt,Zt,ar,br,Ut,Tt,Jt,Ht,hr,Ar,Kr)=>({u_frustum_tl:Ot,u_frustum_tr:Gt,u_frustum_br:Zt,u_frustum_bl:ar,u_horizon:br,u_transition:Ut,u_fadeout_range:Tt,u_atmosphere_fog_color:Jt.toArray01(),u_high_color:Ht.toArray01(),u_space_color:hr.toArray01(),u_temporal_offset:Ar,u_horizon_angle:Kr}))(O.frustumCorners.TL,O.frustumCorners.TR,O.frustumCorners.BR,O.frustumCorners.BL,O.frustumCorners.horizon,B,Re,te,ce,je,We,wt);d.uploadCommonUniforms(j,ut);const Dt=this.atmosphereBuffer;Dt&&ut.draw(d,A.TRIANGLES,R,Vn.disabled,vt?this.colorModeWriteAlpha:this.colorModeAlphaBlendedWriteRGB,$n.backCW,St,vt?"atmosphere_glow_alpha":"atmosphere_glow",Dt.vertexBuffer,Dt.indexBuffer,Dt.segments)};mt(!1),mt(!0)}drawStars(d,m){const j=i.aA(m.properties.get("star-intensity"),0,1);if(j===0)return;const A=d.context,O=A.gl,R=d.transform,B=d.getOrCreateProgram("stars"),H=i.c7([]);i.c9(H,H,-R._pitch),i.c8(H,H,-R.angle),i.c9(H,H,i.an(R._center.lat)),i.et(H,H,-i.an(R._center.lng));const Y=i.cc(new Float32Array(16),H),te=i.aB([],R.starsProjMatrix,Y),de=i.eo([],Y),ce=i.eu([],de),ue=[0,1,0];i.dQ(ue,ue,ce),i.c5(ue,ue,this.params.sizeMultiplier);const je=[1,0,0];i.dQ(je,je,ce),i.c5(je,je,this.params.sizeMultiplier);const ve=(Re=ue,Le=je,We=j,{u_matrix:Float32Array.from(te),u_up:Re,u_right:Le,u_intensity_multiplier:We});var Re,Le,We;d.uploadCommonUniforms(A,B),this.starsVx&&this.starsIdx&&B.draw(d,O.TRIANGLES,gn.disabled,Vn.disabled,this.colorModeAlphaBlendedWriteRGB,$n.disabled,ve,"atmosphere_stars",this.starsVx,this.starsIdx,this.starsSegments)}}class NN{constructor(){this.visibleTiles=[]}updateBorders(d,m){const j=[],A=[],O=d._getRenderableCoordinates(!1,!0);for(const H of O){const Y=d.getTile(H);if(!Y.hasData())continue;const te=Y.getBucket(m);te&&(te.isEmpty()||(j.push(H.key),A.push({bucket:te,tileID:H.canonical})))}let R=j.length!==this.visibleTiles.length;if(!R){j.sort();for(let H=0;HH.tileID.z-Y.tileID.z||H.tileID.x-Y.tileID.x||H.tileID.y-Y.tileID.y);for(const H of A){const Y=new Array,te=new Array,de=H.bucket;for(const ce of de.featuresOnBorder)B.has(ce.featureId)?te.push(ce.footprintIndex):(B.add(ce.featureId),Y.push(ce.footprintIndex));de.updateFootprintHiddenFlags(Y,i.ev,!1),de.updateFootprintHiddenFlags(te,i.ev,!0)}}}function SN(w,d){const m=[...w],j=d.cameraWorldSizeForFog/d.worldSize,A=i.bA([]);return i.cS(A,A,[j,j,1]),i.aB(m,A,m),i.aB(m,d.worldToFogMatrix,m),m}function CN(w,d,m,j,A){const O=m.material,R=j.context,{baseColorTexture:B,metallicRoughnessTexture:H}=O.pbrMetallicRoughness,{normalTexture:Y,occlusionTexture:te,emissionTexture:de}=O;function ce(je,ve,Re){if(je&&(w.push(ve),R.activeTexture.set(R.gl.TEXTURE0+Re),je.gfxTexture)){const{minFilter:Le,magFilter:We,wrapS:rt,wrapT:Ke}=je.sampler;je.gfxTexture.bindExtraParam(Le,We,rt,Ke)}}ce(B,"HAS_TEXTURE_u_baseColorTexture",Il.BaseColor),ce(H,"HAS_TEXTURE_u_metallicRoughnessTexture",Il.MetallicRoughness),ce(Y,"HAS_TEXTURE_u_normalTexture",Il.Normal),ce(te,"HAS_TEXTURE_u_occlusionTexture",Il.Occlusion),ce(de,"HAS_TEXTURE_u_emissionTexture",Il.Emission),A&&(A.texture||(A.texture=new i.d$(j.context,A.image,[A.image.height,A.image.height,A.image.height],R.gl.RGBA8)),R.activeTexture.set(R.gl.TEXTURE0+Il.LUT),A.texture&&A.texture.bind(R.gl.LINEAR,R.gl.CLAMP_TO_EDGE),w.push("APPLY_LUT_ON_GPU")),m.texcoordBuffer&&(w.push("HAS_ATTRIBUTE_a_uv_2f"),d.push(m.texcoordBuffer)),m.colorBuffer&&(w.push(m.colorBuffer.itemSize===12?"HAS_ATTRIBUTE_a_color_3f":"HAS_ATTRIBUTE_a_color_4f"),d.push(m.colorBuffer)),m.normalBuffer&&(w.push("HAS_ATTRIBUTE_a_normal_3f"),d.push(m.normalBuffer)),m.pbrBuffer&&(w.push("HAS_ATTRIBUTE_a_pbr"),w.push("HAS_ATTRIBUTE_a_heightBasedEmissiveStrength"),d.push(m.pbrBuffer)),O.alphaMode!=="OPAQUE"&&O.alphaMode!=="MASK"||w.push("UNPREMULT_TEXTURE_IN_SHADER"),O.defined||w.push("DIFFUSE_SHADED");const ue=j.shadowRenderer;ue&&(w.push("RENDER_SHADOWS","DEPTH_TEXTURE"),ue.useNormalOffset&&w.push("NORMAL_OFFSET"))}function MN(w,d,m,j,A,O){const R=w.modelOpacity,B=d.context,H=new gn(d.context.gl.LEQUAL,w.isLightMesh?gn.ReadOnly:gn.ReadWrite,d.depthRangeFor3D),Y=d.transform,te=w.mesh,de=te.material,ce=de.pbrMetallicRoughness,ue=d.style.fog;let je;je=d.transform.projection.zAxisUnit==="pixels"?[...w.nodeModelMatrix]:i.aB([],j.zScaleMatrix,w.nodeModelMatrix),i.aB(je,j.negCameraPosMatrix,je);const ve=i.bl([],je);i.eg(ve,ve);const Re=m.paint.get("model-color-use-theme").constantOr("default")==="none",Le=m.paint.get("model-emissive-strength").constantOr(0),We=gx(new Float32Array(w.worldViewProjection),new Float32Array(je),new Float32Array(ve),null,d,R,ce.baseColorFactor,de.emissiveFactor,ce.metallicFactor,ce.roughnessFactor,de,Le,m,void 0,void 0,w.materialOverride,w.modelColor),rt={defines:[]},Ke=[],wt=d.shadowRenderer;wt&&(wt.useNormalOffset=!1),CN(rt.defines,Ke,te,d,Re?null:m.lut);let mt=null;if(ue){const ut=SN(w.nodeModelMatrix,d.transform);if(mt=new Float32Array(ut),Y.projection.name!=="globe"){const St=te.aabb.min,Dt=te.aabb.max,[Ot,Gt]=ue.getOpacityForBounds(ut,St[0],St[1],Dt[0],Dt[1]);rt.overrideFog=Ot>=or||Gt>=or}}const vt=Zm(d,m.paint.get("model-cutoff-fade-range"));vt.shouldRenderCutoff&&rt.defines.push("RENDER_CUTOFF");const pt=d.getOrCreateProgram("model",rt);d.uploadCommonUniforms(B,pt,null,mt,vt),d.renderPass!=="shadow"&&wt&&wt.setupShadowsFromMatrix(w.nodeModelMatrix,pt),pt.draw(d,B.gl.TRIANGLES,H,A,O,te.material.doubleSided?$n.disabled:$n.backCCW,We,m.id,te.vertexBuffer,te.indexBuffer,te.segments,m.paint,d.transform.zoom,void 0,Ke)}function n_(w,d){return w.style._importedAsBasemap?"basemap":d.scope}function wx(w,d,m,j,A,O,R,B,H,Y){const te=w.transform,de=!!d.isGeometryBloom&&d.isGeometryBloom;if(de&&w.renderPass==="shadow")return;const ce=te.projection.name==="globe"?i.eD(m,te):[...m];i.aB(ce,ce,d.globalMatrix);const ue=i.aB([],j,ce);if(d.meshes)for(const je of d.meshes){const ve=B.get(je.material.name);if(ve&&ve.opacity<=0)continue;if(je.material.alphaMode!=="BLEND"){R.push({mesh:je,depth:0,modelIndex:A,worldViewProjection:ue,nodeModelMatrix:ce,isLightMesh:de,materialOverride:ve,modelOpacity:H,modelColor:Y});continue}const Re=i.af([],je.centroid,ue);!te.isOrthographic&&Re[2]<=0||O.push({mesh:je,depth:Re[2],modelIndex:A,worldViewProjection:ue,nodeModelMatrix:ce,isLightMesh:de,materialOverride:ve,modelOpacity:H,modelColor:Y})}if(d.children)for(const je of d.children)wx(w,je,m,j,A,O,R,B,H,Y)}function Wh(w,d,m,j){const A=m.shadowRenderer;if(!A)return;const O=A.getShadowPassDepthMode(),R=A.getShadowPassColorMode(),B=A.calculateShadowPassMatrixFromMatrix(d),H=E5(B);m.getOrCreateProgram("modelDepth",{defines:m._shadowMapDebug?[]:["DEPTH_TEXTURE"]}).draw(m,m.context.gl.TRIANGLES,O,Vn.disabled,R,$n.disabled,H,j.id,w.vertexBuffer,w.indexBuffer,w.segments,j.paint,m.transform.zoom,void 0,void 0)}function m6(w,d,m,j,A,O){for(const R of A){const B=Object.assign({},j);B.part=R;const H={type:"Unknown",id:d,properties:B},Y={orientation:w.paint.get("model-rotation").evaluate(H,m)};O.set(R,Y)}}function g6(w,d,m,j,A,O){for(const R of A){const B=Object.assign({},j);B.part=R;const H={type:"Unknown",id:d,properties:B},Y={color:w.paint.get("model-color").evaluate(H,m),colorMix:w.paint.get("model-color-mix-intensity").evaluate(H,m),opacity:w.paint.get("model-opacity").evaluate(H,m),emissionStrength:w.paint.get("model-emissive-strength").evaluate(H,m)};O.set(R,Y)}}function x6(w,d,m,j,A){let O=!1;for(const B of j)B.modelOpacity!==1&&(MN(B,w,d,A[B.modelIndex],Vn.disabled,us.disabled),O=!0);for(const B of j)MN(B,w,d,A[B.modelIndex],B.modelOpacity!==1?w.stencilModeFor3D():Vn.disabled,w.colorModeForRenderPass());O&&w.resetStencilClippingMasks();const R=us.additive;for(const B of m)MN(B,w,d,A[B.modelIndex],Vn.disabled,B.isLightMesh?R:w.colorModeForRenderPass())}function y6(w,d,m){const j=d.updateZoomBasedPaintProperties(),A=function(O,R,B){let H,Y,te,de=O.terrain?O.terrain.exaggeration():0;if(O.terrain&&de>0){const ce=O.terrain,ue=ce.findDEMTileFor(B);ue&&ue.dem?H=i.eF.create(ce,B,ue):de=0}if(de===0&&(R.terrainElevationMin=0,R.terrainElevationMax=0),de===R.validForExaggeration&&(de===0||H&&H._demTile&&H._demTile.tileID===R.validForDEMTile.id&&H._dem._timestamp===R.validForDEMTile.timestamp))return!1;for(const ce in R.instancesPerModel){const ue=R.instancesPerModel[ce];for(let je=0;jeY&&(Y=ue.max)}const te=i.aA(j.x,O,R)-j.x,de=i.aA(j.y,B,H)-j.y,ce=i.cf(Y,d.center.lat)-j.z;return d._zoomFromMercatorZ(Math.sqrt(te*te+de*de+ce*ce))}function v6(w,d,m,j,A,O,R){const B=w.context,H=w.renderPass==="shadow",Y=w.shadowRenderer,te=H&&Y?Y.getShadowPassDepthMode():new gn(B.gl.LEQUAL,gn.ReadWrite,w.depthRangeFor3D),de=w.isTileAffectedByFog(O),ce=w.transform.projection.name==="globe";if(m.meshes)for(const ue of m.meshes){const je=ce?[]:["MODEL_POSITION_ON_GPU"],ve=[];let Re,Le,We;const rt=!ce&&j.instancedDataArray.length>20;rt&&je.push("INSTANCED_ARRAYS");const Ke=Zm(w,d.paint.get("model-cutoff-fade-range"));if(Ke.shouldRenderCutoff&&je.push("RENDER_CUTOFF"),H&&Y)Re=w.getOrCreateProgram("modelDepth",{defines:je}),Le=E5(R.shadowTileMatrix,R.shadowTileMatrix,Float32Array.from(m.globalMatrix)),We=Y.getShadowPassColorMode();else{CN(je,ve,ue,w,d.paint.get("model-color-use-theme").constantOr("default")==="none"?null:d.lut),Re=w.getOrCreateProgram("model",{defines:je,overrideFog:de});const mt=ue.material,vt=mt.pbrMetallicRoughness,pt=d.paint.get("model-opacity").constantOr(1),ut=d.paint.get("model-emissive-strength").constantOr(0);Le=gx(O.expandedProjMatrix,Float32Array.from(m.globalMatrix),new Float32Array(16),null,w,pt,vt.baseColorFactor,mt.emissiveFactor,vt.metallicFactor,vt.roughnessFactor,mt,ut,d,A),Y&&(R.shadowUniformsInitialized?Re.setShadowUniformValues(B,Y.getShadowUniformValues()):(Y.setupShadows(O.toUnwrapped(),Re,"model-tile"),R.shadowUniformsInitialized=!0)),We=Ke.shouldRenderCutoff||pt<1||mt.alphaMode!=="OPAQUE"?us.alphaBlended:us.unblended}w.uploadCommonUniforms(B,Re,O.toUnwrapped(),null,Ke);const wt=ue.material.doubleSided?$n.disabled:$n.backCCW;if(rt)ve.push(j.instancedDataBuffer),Re.draw(w,B.gl.TRIANGLES,te,Vn.disabled,We,wt,Le,d.id,ue.vertexBuffer,ue.indexBuffer,ue.segments,d.paint,w.transform.zoom,void 0,ve,j.instancedDataArray.length);else{const mt=H?"u_instance":"u_normal_matrix";for(let vt=0;vtH[1]?R:H,O[0]=m.max[0],R=i.aC(i.eG(),O,A),B=R[1]H[1]?R:H,O[1]=m.min[1],R=i.aC(i.eG(),O,A),B=R[1]H[1]?R:H;const Y=i.aA(j[0],0,1),te=100*d.pixelsPerMeter*i.aA(j[1],0,1),de=i.aA(j[2],0,1),ce=i.eH(i.eG(),B,H,Y),ue=Math.tan(.5*d.fovX),je=-ce[2]*ue;if(te===0)return ce[1]<-Math.abs(je)?de:1;const ve=(-Math.abs(je)-ce[1])/te,Re=(We,rt,Ke)=>(1-Ke)*We+Ke*rt,Le=i.aA(Re(1,de,ve),de,1);return Re(1,Le,i.aA((d.pitch-20)/20,0,1))}class _6{}class ag{constructor(){this._storage=new Map}getLinesFromTrianglesBuffer(d,m,j){{const de=this._storage.get(m.id);if(de)return de.lastUsedFrameIdx=d,de.buf}const A=j.gl,O=A.getBufferParameter(A.ELEMENT_ARRAY_BUFFER,A.BUFFER_SIZE),R=new ArrayBuffer(O),B=new Int16Array(R);A.getBufferSubData(A.ELEMENT_ARRAY_BUFFER,0,new Int16Array(R));const H=new i.eJ;for(let de=0;de30&&(j.buf.destroy(),this._storage.delete(m))}destroy(){for(const[d,m]of this._storage)m.buf.destroy(),this._storage.delete(d)}}class g0{constructor(){this.occluderSize=30,this.depthOffset=-1e-4}}const x0=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 Rp{constructor(d){this.revealStart=11,this.revealRange=2}}const R5=i.ei([{type:"Float32",name:"a_pos_2f",components:2}]);class F5{destroy(){this.vignetteVx&&this.vignetteVx.destroy(),this.vignetteIdx&&this.vignetteIdx.destroy()}draw(d,m){const j=d.getOrCreateProgram("vignette");if(!this.vignetteVx||!this.vignetteIdx){const R=new i.eK,B=new i.b0;R.emplaceBack(-1,-1),R.emplaceBack(1,-1),R.emplaceBack(1,1),R.emplaceBack(-1,1),B.emplaceBack(0,1,2),B.emplaceBack(0,2,3),this.vignetteVx=d.context.createVertexBuffer(R,R5.members),this.vignetteIdx=d.context.createIndexBuffer(B)}const A=i.bg.simpleSegment(0,0,4,6);if(this.vignetteVx&&this.vignetteIdx){d.uploadCommonUniforms(d.context,j);const R={u_vignetteShape:(O={vignetteShape:[m.start,m.range,Math.pow(10,m.fadePower)],vignetteColor:[m.color.r,m.color.g,m.color.b,m.color.a*m.strength]}).vignetteShape,u_vignetteColor:O.vignetteColor};j.draw(d,d.context.gl.TRIANGLES,gn.disabled,Vn.disabled,us.alphaBlended,$n.disabled,R,"vignette",this.vignetteVx,this.vignetteIdx,A)}var O}}class z5{constructor(){this._accumulatedOffsetX=0,this._accumulatedOffsetY=0,this._accumulatedElevation=0}update(d,m){const j=d.getFreeCameraOptions().position,A=j.toAltitude(),O=j.toLngLat(),R=i.an(O.lng),B=i.an(O.lat),H=d.pixelsPerMeter/m,Y=R*i.eM,te=i.eM*Math.log(Math.tan(Math.PI/4+B/2));if(this._offsetXPrev===void 0)this._offsetXPrev=0,this._offsetYPrev=0,this._elevationPrev=0,this._accumulatedOffsetX=0,this._accumulatedOffsetY=0,this._accumulatedElevation=0;else{const de=-this._offsetYPrev+te,ce=-this._elevationPrev+A;this._accumulatedOffsetX+=(-this._offsetXPrev+Y)*H,this._accumulatedOffsetY+=de*H,this._accumulatedElevation+=ce*H,this._offsetXPrev=Y,this._offsetYPrev=te,this._elevationPrev=A}}getPosition(){return[this._accumulatedOffsetX,this._accumulatedOffsetY,this._accumulatedElevation]}}function TN(w,d){return[-(w[0]-Math.floor(w[0]/d)*d),-(w[1]-Math.floor(w[1]/d)*d),-(w[2]-Math.floor(w[2]/d)*d)]}function Lu(w){const d=i.eq(1323123451230),m=[];for(let j=0;j Rain"),this._vignetteParams={strength:1,start:.7,range:1,fadePower:.4,color:{r:.27,g:.27,b:.27,a:1}},this.particlesCount=16e3}update(d){const m=d.context;if(!this.particlesVx){const j=Lu(this.particlesCount),A=new i.eN,O=new i.b0;let R=0;const B=i.eq(1323123451230);for(let H=0;Hj)return;const A=Gd(0,1,m.revealStart,m.revealStart+m.revealRange,j);if(!this.particlesVx||!this.particlesIdx)return;const O=structuredClone(this._params);let R=[-O.direction.x,O.direction.y,-100];i.aw(R,R);const B=structuredClone(this._vignetteParams);B.strength*=A,O.overrideStyleParameters||(O.intensity=d.style.rain.state.density,O.timeFactor=d.style.rain.state.intensity,O.color=structuredClone(d.style.rain.state.color),R=structuredClone(d.style.rain.state.direction),O.screenThinning.intensity=d.style.rain.state.centerThinning,O.dropletSizeX=d.style.rain.state.dropletSize[0],O.dropletSizeYScale=d.style.rain.state.dropletSize[1]/d.style.rain.state.dropletSize[0],O.distortionStrength=100*d.style.rain.state.distortionStrength,B.strength=1,B.color=structuredClone(d.style.rain.state.vignetteColor));const H=this.updateOnRender(d,O.timeFactor),Y=d.context,te=Y.gl,de=d.transform;this.screenTexture&&this.screenTexture.size[0]===d.width&&this.screenTexture.size[1]===d.height||(this.screenTexture=new i.T(Y,{width:d.width,height:d.height,data:null},te.RGBA8)),O.distortionStrength>0&&(Y.activeTexture.set(te.TEXTURE0),this.screenTexture.bind(te.LINEAR,te.CLAMP_TO_EDGE),te.copyTexSubImage2D(te.TEXTURE_2D,0,0,0,0,0,d.width,d.height));const ce=d.getOrCreateProgram("rainParticle");d.uploadCommonUniforms(Y,ce),Y.activeTexture.set(te.TEXTURE0),this.screenTexture.bind(te.LINEAR,te.CLAMP_TO_EDGE);const ue=[O.color.r,O.color.g,O.color.b,O.color.a],je=(ve,Re)=>{const Le=TN(this._movement.getPosition(),ve),We=O.dropletSizeX,rt=O.dropletSizeX*O.dropletSizeYScale,Ke=d.width/2,wt=d.height/2,mt=Gd(0,O.screenThinning.start,0,1,O.screenThinning.intensity),vt=Gd(.001,O.screenThinning.range,0,1,O.screenThinning.intensity),pt=Gd(0,O.screenThinning.particleOffset,0,1,O.screenThinning.intensity),ut=(St={modelview:H.modelviewMatrix,projection:H.projectionMatrix,time:this._accumulatedTimeFromStart,camPos:Le,velocityConeAperture:O.velocityConeAperture,velocity:O.velocity,boxSize:ve,rainDropletSize:[We,rt],distortionStrength:O.distortionStrength,rainDirection:R,color:ue,screenSize:[de.width,de.height],thinningCenterPos:[Ke,wt],thinningShape:[mt,vt,Math.pow(10,O.screenThinning.fadePower)],thinningAffectedRatio:O.screenThinning.affectedRatio,thinningParticleOffset:pt,shapeDirectionalPower:O.shapeDirPower,shapeNormalPower:O.shapeNormalPower,mode:Re?0:1},{u_modelview:Float32Array.from(St.modelview),u_projection:Float32Array.from(St.projection),u_time:St.time,u_cam_pos:St.camPos,u_texScreen:0,u_velocityConeAperture:St.velocityConeAperture,u_velocity:St.velocity,u_boxSize:St.boxSize,u_rainDropletSize:St.rainDropletSize,u_distortionStrength:St.distortionStrength,u_rainDirection:St.rainDirection,u_color:St.color,u_screenSize:St.screenSize,u_thinningCenterPos:St.thinningCenterPos,u_thinningShape:St.thinningShape,u_thinningAffectedRatio:St.thinningAffectedRatio,u_thinningParticleOffset:St.thinningParticleOffset,u_shapeDirectionalPower:St.shapeDirectionalPower,u_shapeNormalPower:St.shapeNormalPower,u_mode:St.mode});var St;const Dt=Math.round(O.intensity*this.particlesCount),Ot=i.bg.simpleSegment(0,0,4*Dt,2*Dt);ce.draw(d,te.TRIANGLES,gn.disabled,Vn.disabled,us.alphaBlended,$n.disabled,ut,"rain_particles",this.particlesVx,this.particlesIdx,Ot)};O.distortionStrength>0&&je(O.boxSize,!0),je(O.boxSize,!1),this._vignette.draw(d,B)}}const B5=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 $5 extends jx{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 Rp("Precipitation > Snow"),this._vignetteParams={strength:.3,start:.78,range:.46,fadePower:.2,color:{r:1,g:1,b:1,a:1}},this.particlesCount=16e3}update(d){const m=d.context;if(!this.particlesVx){const j=Lu(this.particlesCount),A=new i.eO,O=new i.b0;let R=0;const B=i.eq(1323123451230);for(let H=0;HR)return;const B=Gd(0,1,O.revealStart,O.revealStart+O.revealRange,R);A.strength*=B,m.overrideStyleParameters||(m.intensity=d.style.snow.state.density,m.timeFactor=d.style.snow.state.intensity,m.color=structuredClone(d.style.snow.state.color),j=structuredClone(d.style.snow.state.direction),m.screenThinning.intensity=d.style.snow.state.centerThinning,m.billboardSize=2.79*d.style.snow.state.flakeSize,A.strength=1,A.color=structuredClone(d.style.snow.state.vignetteColor));const H=this.updateOnRender(d,m.timeFactor);if(!this.particlesVx||!this.particlesIdx)return;const Y=d.context,te=Y.gl,de=d.transform,ce=d.getOrCreateProgram("snowParticle");d.uploadCommonUniforms(Y,ce),((ue,je,ve)=>{const Re=TN(this._movement.getPosition(),ue),Le=de.width/2,We=de.height/2,rt=Gd(0,ve.screenThinning.start,0,1,ve.screenThinning.intensity),Ke=Gd(.001,ve.screenThinning.range,0,1,ve.screenThinning.intensity),wt=Gd(0,ve.screenThinning.particleOffset,0,1,ve.screenThinning.intensity),mt=(vt={modelview:H.modelviewMatrix,projection:H.projectionMatrix,time:this._accumulatedTimeFromStart,camPos:Re,velocityConeAperture:ve.velocityConeAperture,velocity:ve.velocity,horizontalOscillationRadius:ve.horizontalOscillationRadius,horizontalOscillationRate:ve.horizontalOscillationRate,boxSize:ue,billboardSize:1*ve.billboardSize,simpleShapeParameters:[ve.shapeFadeStart,ve.shapeFadePower],screenSize:[de.width,de.height],thinningCenterPos:[Le,We],thinningShape:[rt,Ke,Math.pow(10,ve.screenThinning.fadePower)],thinningAffectedRatio:ve.screenThinning.affectedRatio,thinningParticleOffset:wt,color:[ve.color.r,ve.color.g,ve.color.b,ve.color.a],direction:j},{u_modelview:Float32Array.from(vt.modelview),u_projection:Float32Array.from(vt.projection),u_time:vt.time,u_cam_pos:vt.camPos,u_velocityConeAperture:vt.velocityConeAperture,u_velocity:vt.velocity,u_horizontalOscillationRadius:vt.horizontalOscillationRadius,u_horizontalOscillationRate:vt.horizontalOscillationRate,u_boxSize:vt.boxSize,u_billboardSize:vt.billboardSize,u_simpleShapeParameters:vt.simpleShapeParameters,u_screenSize:vt.screenSize,u_thinningCenterPos:vt.thinningCenterPos,u_thinningShape:vt.thinningShape,u_thinningAffectedRatio:vt.thinningAffectedRatio,u_thinningParticleOffset:vt.thinningParticleOffset,u_particleColor:vt.color,u_direction:vt.direction});var vt;const pt=Math.round(ve.intensity*this.particlesCount),ut=i.bg.simpleSegment(0,0,4*pt,2*pt);this.particlesVx&&this.particlesIdx&&ce.draw(d,te.TRIANGLES,gn.disabled,Vn.disabled,us.alphaBlended,$n.disabled,mt,"snow_particles",this.particlesVx,this.particlesIdx,ut)})(m.boxSize,0,m),this._vignette.draw(d,A)}}const ig={symbol:function(w,d,m,j,A){if(w.renderPass!=="translucent")return;const O=Vn.disabled,R=w.colorModeForRenderPass(),B=m.layout.get("text-variable-anchor"),H=m.layout.get("text-size-scale-range"),Y=i.aA(w.scaleFactor,H[0],H[1]);B&&function(ce,ue,je,ve,Re,Le,We,rt){const Ke=ue.transform,wt=Re==="map",mt=Le==="map";for(const vt of ce){const pt=ve.getTile(vt),ut=pt.getBucket(je);if(!ut||!ut.text||!ut.text.segments.get().length)continue;const St=i.bK(ut.textSizeData,Ke.zoom,rt),Dt=Er(vt,ut.getProjection(),Ke),Ot=Ke.calculatePixelsToTileUnitsMatrix(pt),Gt=_a(Dt,pt.tileID.canonical,mt,wt,Ke,ut.getProjection(),Ot),Zt=ut.hasIconTextFit()&&ut.hasIconData();St&&En(ut,wt,mt,We,Ke,Gt,vt,Math.pow(2,Ke.zoom-pt.tileID.overscaledZ),St,Zt)}}(j,w,m,d,m.layout.get("text-rotation-alignment"),m.layout.get("text-pitch-alignment"),A,Y);const te=m.paint.get("icon-opacity").constantOr(1)!==0,de=m.paint.get("text-opacity").constantOr(1)!==0;m.layout.get("symbol-sort-key").constantOr(1)!==void 0&&(te||de)?e_(w,d,m,j,O,R):(te&&e_(w,d,m,j,O,R,{onlyIcons:!0}),de&&e_(w,d,m,j,O,R,{onlyText:!0})),d.map.showCollisionBoxes&&(en(w,d,m,j,m.paint.get("text-translate"),m.paint.get("text-translate-anchor"),!0),en(w,d,m,j,m.paint.get("icon-translate"),m.paint.get("icon-translate-anchor"),!1))},circle:function(w,d,m,j){if(w.renderPass!=="translucent")return;const A=m.paint.get("circle-opacity"),O=m.paint.get("circle-stroke-width"),R=m.paint.get("circle-stroke-opacity"),B=m.layout.get("circle-sort-key").constantOr(1)!==void 0,H=m.paint.get("circle-emissive-strength");if(A.constantOr(1)===0&&(O.constantOr(1)===0||R.constantOr(1)===0))return;const Y=w.context,te=Y.gl,de=w.transform,ce=!(!w.terrain||!w.terrain.enabled),ue=m.layout.get("circle-elevation-reference"),je=w.depthModeForSublayer(0,gn.ReadOnly),ve=new gn(w.context.gl.LEQUAL,gn.ReadOnly,w.depthRangeFor3D),Re=ue==="none"||ce?je:ve,Le=Vn.disabled,We=w.colorModeForDrapableLayerRenderPass(H),rt=de.projection.name==="globe",Ke=[i.aF(de.center.lng),i.aJ(de.center.lat)],wt=[];for(let vt=0;vtvt.sortKey-pt.sortKey);const mt={useDepthForOcclusion:de.depthOcclusionForSymbolsAndCircles};for(const vt of wt){const{programConfiguration:pt,program:ut,layoutVertexBuffer:St,dynamicBuffers:Dt,indexBuffer:Ot,uniformValues:Gt,tile:Zt}=vt.state,ar=vt.segments;w.terrain&&w.terrain.setupElevationDraw(Zt,ut,mt),w.uploadCommonUniforms(Y,ut,Zt.tileID.toUnwrapped()),ut.draw(w,te.TRIANGLES,Re,Le,We,$n.disabled,Gt,m.id,St,Ot,ar,m.paint,de.zoom,pt,Dt)}},heatmap:function(w,d,m,j){if(m.paint.get("heatmap-opacity")!==0)if(w.renderPass==="offscreen"){const A=w.context,O=A.gl,R=Vn.disabled,B=new us([O.ONE,O.ONE,O.ONE,O.ONE],i.ao.transparent,[!0,!0,!0,!0]);(function(ue,je,ve,Re){const Le=ue.gl,We=je.width*Re,rt=je.height*Re;ue.activeTexture.set(Le.TEXTURE1),ue.viewport.set([0,0,We,rt]);let Ke=ve.heatmapFbo;if(!Ke||Ke&&(Ke.width!==We||Ke.height!==rt)){Ke&&Ke.destroy();const wt=Le.createTexture();Le.bindTexture(Le.TEXTURE_2D,wt),Le.texParameteri(Le.TEXTURE_2D,Le.TEXTURE_WRAP_S,Le.CLAMP_TO_EDGE),Le.texParameteri(Le.TEXTURE_2D,Le.TEXTURE_WRAP_T,Le.CLAMP_TO_EDGE),Le.texParameteri(Le.TEXTURE_2D,Le.TEXTURE_MIN_FILTER,Le.LINEAR),Le.texParameteri(Le.TEXTURE_2D,Le.TEXTURE_MAG_FILTER,Le.LINEAR),Ke=ve.heatmapFbo=ue.createFramebuffer(We,rt,1,null),function(mt,vt,pt,ut,St,Dt){const Ot=mt.gl;Ot.texImage2D(Ot.TEXTURE_2D,0,mt.extRenderToTextureHalfFloat?Ot.RGBA16F:Ot.RGBA,St,Dt,0,Ot.RGBA,mt.extRenderToTextureHalfFloat?Ot.HALF_FLOAT:Ot.UNSIGNED_BYTE,null),ut.colorAttachment0.set(pt)}(ue,0,wt,Ke,We,rt)}else Le.bindTexture(Le.TEXTURE_2D,Ke.colorAttachment0.get()),ue.bindFramebuffer.set(Ke.framebuffer)})(A,w,m,w.transform.projection.name==="globe"?.5:.25),A.clear({color:i.ao.transparent});const H=w.transform,Y=H.projection.name==="globe",te=Y?["PROJECTION_GLOBE_VIEW"]:[],de=Y?$n.frontCCW:$n.disabled,ce=[i.aF(H.center.lng),i.aJ(H.center.lat)];for(let ue=0;ue({u_image:0,u_color_ramp:1,u_opacity:de.paint.get("heatmap-opacity")}))(0,O),O.id,A.viewportBuffer,A.quadTriangleIndexBuffer,A.viewportSegments,O.paint,A.transform.zoom)}(w,m))},line:function(w,d,m,j){if(w.renderPass!=="translucent")return;const A=m.paint.get("line-opacity"),O=m.paint.get("line-width");if(A.constantOr(1)===0||O.constantOr(1)===0)return;const R=m.paint.get("line-emissive-strength").isConstant(),B=m.paint.get("line-emissive-strength").constantOr(0),H=m.paint.get("line-occlusion-opacity"),Y=m.layout.get("line-elevation-reference"),te=m.layout.get("line-width-unit")==="meters",de=Y==="sea",ce=!(!w.terrain||!w.terrain.enabled),ue=w.context,je=ue.gl;if(m.hasElevatedBuckets&&w.transform.projection.name==="globe")return;const ve=m.layout.get("line-cross-slope"),Re=ve!==void 0,Le=ve<1,We=w.colorModeForDrapableLayerRenderPass(R?B:null),rt=w.terrain&&w.terrain.renderingToTexture,Ke=rt?1:i.o.devicePixelRatio,wt=m.paint.get("line-dasharray"),mt=wt.constantOr(1),vt=m.layout.get("line-cap"),pt=wt.constantOr(null),ut=vt.constantOr(null),St=m.paint.get("line-pattern"),Dt=St.constantOr(1),Ot=m.paint.get("line-pattern-cross-fade"),Gt=St.constantOr(null),Zt=m.paint.get("line-opacity").constantOr(1);let ar=!Dt&&Zt!==1||w.depthOcclusion&&H>0&&H<1;const br=m.paint.get("line-gradient"),Ut=Dt?"linePattern":"line",Tt=i.e2(m);let Jt;if(rt&&w.terrain&&w.terrain.clipOrMaskOverlapStencilType()&&(ar=!1),H!==0&&w.depthOcclusion){const Kr=m.paint._values["line-opacity"];Kr&&Kr.value&&Kr.value.kind==="constant"?Jt=Kr.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"),rt&&(w.emissiveMode!=="dual-source-blending"||R?w.emissiveMode==="mrt-fallback"&&Tt.push("USE_MRT1"):Tt.push("DUAL_SOURCE_BLENDING"));const Ht=(Kr,Sr,wr,cn,rn,qr)=>{for(const Xr of Kr){const Cn=d.getTile(Xr);if(Dt&&!Cn.patternsLoaded())continue;const ts=Cn.getBucket(m);if(!ts||ts.elevationType!=="none"&&!rn||ts.elevationType==="none"&&rn)continue;w.prepareDrawTile();const Us=[...Sr],wa=w.shadowRenderer,hn=ts.elevationType==="road"&&!!wa&&wa.enabled;let fa=[0,0,0];if(hn){const ps=w.style.directionalLight,fi=w.style.ambientLight;ps&&fi&&(fa=Ep(w.style,ps,fi)),Us.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET")}const Yn=ts.programConfigurations.get(m.id);let Ca=!1;if(Gt&&Cn.imageAtlas){const ps=i.e3.from(Gt),fi=ps.getPrimary().scaleSelf(Ke).toString(),uo=Cn.imageAtlas.patternPositions.get(fi),qi=ps.getSecondary(),Xa=qi?Cn.imageAtlas.patternPositions.get(qi.scaleSelf(Ke).toString()):null;Ca=!!uo&&!!Xa,uo&&Yn.setConstantPatternPositions(uo,Xa)}Ot>0&&(Ca||Yn.getPatternTransitionVertexBuffer("line-pattern"))&&Us.push("LINE_PATTERN_TRANSITION");const qa=w.isTileAffectedByFog(Xr),Oa=w.getOrCreateProgram(Ut,{config:Yn,defines:Us,overrideFog:qa});if(!Dt&&pt&&ut&&Cn.lineAtlas){const ps=Cn.lineAtlas.getDash(pt,ut);ps&&Yn.setConstantPatternPositions(ps)}hn&&wa.setupShadows(Cn.tileID.toUnwrapped(),Oa,"vector-tile");let[ha,fs]=m.paint.get("line-trim-offset");(ut==="round"||ut==="square")&&ha!==fs&&(ha===0&&(ha-=1),fs===1&&(fs+=1));const Na=rt?Xr.projMatrix:null,Ki=te?1/ts.tileToMeter/i.ay(Cn,1,w.transform.zoom):1,ji=te?1/ts.tileToMeter/i.ay(Cn,1,Math.floor(w.transform.zoom)):1,Ma=Dt?i.e4(w,Cn,m,Na,Ke,Ki,ji,[ha,fs],fa,Ot):i.e5(w,Cn,m,Na,ts.lineClipsArray.length,Ke,Ki,ji,[ha,fs],fa);if(br){const ps=ts.gradients[m.id];let fi=ps.texture;if(m.gradientVersion!==ps.version){let uo=256;if(m.stepInterpolant){const qi=d.getSource().maxzoom,Xa=Xr.canonical.z===qi?Math.ceil(1<{Jt!=null&&(Jt.value=Zt*H),Oa.draw(w,je.TRIANGLES,wr,ps,We,$n.disabled,Ma,m.id,ts.layoutVertexBuffer,ts.indexBuffer,ts.segments,m.paint,w.transform.zoom,Yn,[ts.layoutVertexBuffer2,ts.patternVertexBuffer,ts.zOffsetVertexBuffer]),Jt!=null&&(Jt.value=Zt)};if(ar&&!rn){const ps=w.stencilModeForClipping(Xr).ref;ps===0&&rt&&ue.clear({stencil:0});const fi={func:je.EQUAL,mask:255};Ma.u_alpha_discard_threshold=.8,ia(new Vn(fi,ps,255,je.KEEP,je.KEEP,je.INVERT)),Ma.u_alpha_discard_threshold=0,ia(new Vn(fi,ps,255,je.KEEP,je.KEEP,je.KEEP))}else Ma.u_alpha_discard_threshold=ar&&rn&&qr?.8:0,ia(rn?cn:w.stencilModeForClipping(Xr))}};let hr=w.depthModeForSublayer(0,gn.ReadOnly);const Ar=new gn(w.depthOcclusion?je.GREATER:je.LEQUAL,gn.ReadOnly,w.depthRangeFor3D);if(m.hasNonElevatedBuckets){const Kr=!rt&&w.terrain;H!==0&&Kr?i.w(`Occlusion opacity for layer ${m.id} is supported on terrain only if the layer has line-z-offset enabled.`):Kr?i.w(`Cannot render non-elevated lines in immediate mode when terrain is enabled. Layer: ${m.id}.`):Ht(j,Tt,hr,Vn.disabled,!1,!0)}if(m.hasElevatedBuckets){Y==="hd-road-markup"?ce||(hr=Ar,Tt.push("ELEVATED_ROADS")):(Tt.push("ELEVATED"),hr=Ar,Re&&Tt.push(Le?"CROSS_SLOPE_HORIZONTAL":"CROSS_SLOPE_VERTICAL"),de&&Tt.push("ELEVATION_REFERENCE_SEA"));const Kr=ar?w.stencilModeFor3D():Vn.disabled;w.forceTerrainMode=!0,Ht(j,Tt,hr,Kr,!0,!0),ar&&Ht(j,Tt,hr,Kr,!0,!1),w.forceTerrainMode=!1}ar&&(w.resetStencilClippingMasks(),rt&&ue.clear({stencil:0})),H===0||w.depthOcclusion||rt||w.layersWithOcclusionOpacity.push(w.currentLayer)},fill:function(w,d,m,j){const A=m.paint.get("fill-color"),O=m.paint.get("fill-opacity");if(O.constantOr(1)===0)return;const R=m.paint.get("fill-emissive-strength"),B=w.colorModeForDrapableLayerRenderPass(R),H=m.paint.get("fill-pattern"),Y=w.opaquePassEnabledForLayer()&&!H.constantOr(1)&&A.constantOr(i.ao.transparent).a===1&&O.constantOr(0)===1?"opaque":"translucent";let te="none";m.layout.get("fill-elevation-reference")!=="none"?te="road":m.paint.get("fill-z-offset").constantOr(1)!==0&&(te="offset");const de=!(!w.terrain||!w.terrain.enabled),ce={painter:w,sourceCache:d,layer:m,coords:j,colorMode:B,elevationType:te,terrainEnabled:de,pass:Y};if(w.renderPass==="shadow")return void(w.shadowRenderer&&te==="road"&&!de&&function(je){const{painter:ve,sourceCache:Re,layer:Le,coords:We}=je,rt=ve.context.gl,Ke=je.painter.shadowRenderer;for(const wt of We){const mt=Re.getTile(wt),vt=mt.getBucket(Le);if(!vt)continue;const pt=vt.elevatedStructures;if(!pt||!pt.shadowCasterSegments||pt.shadowCasterSegments.segments[0].primitiveLength===0)continue;ve.prepareDrawTile();const ut=vt.bufferData.programConfigurations.get(Le.id),St=ve.isTileAffectedByFog(wt),Dt=ve.getOrCreateProgram("elevatedStructuresDepth",{config:ut,overrideFog:St}),Ot=Ke.calculateShadowPassMatrixFromTile(mt.tileID.toUnwrapped());ve.uploadCommonUniforms(ve.context,Dt,wt.toUnwrapped());const Gt={u_matrix:Ot,u_depth_bias:0};Dt.draw(ve,rt.TRIANGLES,Ke.getShadowPassDepthMode(),Vn.disabled,Ke.getShadowPassColorMode(),$n.disabled,Gt,Le.id,pt.vertexBuffer,pt.indexBuffer,pt.shadowCasterSegments,Le.paint,ve.transform.zoom,ut)}}(ce));const ue=w.emissiveMode==="mrt-fallback";if(te!=="offset"){if(yN(ce,!1,ue),te==="road"){const je=!de&&w.renderPass==="translucent";je&&xN(w,d,m,j,"geometry"),yN(ce,!0,ue,Vn.disabled),je&&function(ve){const{painter:Re,sourceCache:Le,layer:We,coords:rt,colorMode:Ke}=ve,wt=Re.context.gl,mt=ve.painter.shadowRenderer,vt=!!mt&&mt.enabled,pt=new gn(Re.context.gl.LEQUAL,gn.ReadOnly,Re.depthRangeFor3D);let ut=[0,0,0];if(vt){const Dt=Re.style.directionalLight,Ot=Re.style.ambientLight;Dt&&Ot&&(ut=Ep(Re.style,Dt,Ot))}const St=Dt=>{for(const Ot of rt){const Gt=Le.getTile(Ot),Zt=Gt.getBucket(We);if(!Zt)continue;const ar=Zt.elevatedStructures;if(!ar)continue;let br,Ut;if(Dt?(br=ar.renderableBridgeSegments,Ut=ar.bridgeProgramConfigurations.get(We.id)):(br=ar.renderableTunnelSegments,Ut=ar.tunnelProgramConfigurations.get(We.id)),!br||br.segments[0].primitiveLength===0)continue;Ut.updatePaintBuffers(),Re.prepareDrawTile();const Tt=Re.isTileAffectedByFog(Ot),Jt=[];vt&&Jt.push("RENDER_SHADOWS","DEPTH_TEXTURE","NORMAL_OFFSET");const Ht=Re.getOrCreateProgram("elevatedStructures",{config:Ut,overrideFog:Tt,defines:Jt}),hr=Re.translatePosMatrix(Ot.projMatrix,Gt,We.paint.get("fill-translate"),We.paint.get("fill-translate-anchor"));vt&&mt.setupShadows(Gt.tileID.toUnwrapped(),Ht,"vector-tile");const Ar=tg(hr,ut);Re.uploadCommonUniforms(Re.context,Ht,Ot.toUnwrapped()),Ht.draw(Re,wt.TRIANGLES,pt,Vn.disabled,Ke,$n.backCCW,Ar,We.id,ar.vertexBuffer,ar.indexBuffer,br,We.paint,Re.transform.zoom,Ut,[ar.vertexBufferNormal])}};St(!0),St(!1)}(ce)}}else yN(ce,!1,ue,w.stencilModeFor3D())},"fill-extrusion":function(w,d,m,j){const A=m.paint.get("fill-extrusion-opacity"),O=w.context,R=O.gl,B=w.terrain,H=B&&B.renderingToTexture;if(A===0)return;const Y=w.emissiveMode==="mrt-fallback",te=w.conflationActive&&w.style.isLayerClipped(m,d.getSource()),de=w.style.order.indexOf(m.fqid);if(te&&function(ce,ue,je,ve,Re){for(const Le of ve){const We=ue.getTile(Le).getBucket(je);We&&(We.updateReplacement(Le,ce.replacementSource,Re),We.uploadCentroid(ce.context))}}(w,d,m,j,de),B||te)for(const ce of j){const ue=d.getTile(ce).getBucket(m);ue&&noe(w.context,d,ce,ue,m,B,te)}if(w.renderPass==="shadow"&&w.shadowRenderer){const ce=w.shadowRenderer;if(B&&A<.65&&m._transitionablePaint._values["fill-extrusion-opacity"].value.expression instanceof i.ad)return;const ue=ce.getShadowPassDepthMode(),je=ce.getShadowPassColorMode();vN(w,d,m,j,ue,Vn.disabled,je,te)}else if(w.renderPass==="translucent"){const ce=!m.paint.get("fill-extrusion-pattern").constantOr(1),ue=m.paint.get("fill-extrusion-color").constantOr(i.ao.white);if(!H&&ue.a!==0){const je=new gn(w.context.gl.LEQUAL,gn.ReadWrite,w.depthRangeFor3D);A===1&&ce?vN(w,d,m,j,je,Vn.disabled,us.unblended,te):(vN(w,d,m,j,je,Vn.disabled,us.disabled,te),vN(w,d,m,j,je,w.stencilModeFor3D(),w.colorModeForRenderPass(),te),w.resetStencilClippingMasks())}if(w.style.enable3dLights()&&ce&&(!B&&w.transform.projection.name!=="globe"||H)){const je=m.paint.get("fill-extrusion-opacity"),ve=m.paint.get("fill-extrusion-ambient-occlusion-intensity"),Re=m.paint.get("fill-extrusion-ambient-occlusion-ground-radius"),Le=m.paint.get("fill-extrusion-flood-light-intensity"),We=m.paint.get("fill-extrusion-flood-light-color-use-theme").constantOr("default")==="none",rt=m.paint.get("fill-extrusion-flood-light-color").toNonPremultipliedRenderColor(We?null:m.lut).toArray01().slice(0,3),Ke=ve>0&&Re>0,wt=Le>0,mt=(ut,St,Dt)=>(1-Dt)*ut+Dt*St,vt=new L5;vt.translate=m.paint.get("fill-extrusion-translate"),vt.translateAnchor=m.paint.get("fill-extrusion-translate-anchor"),vt.edgeRadius=m.layout.get("fill-extrusion-edge-radius"),vt.cutoffFadeRange=m.paint.get("fill-extrusion-cutoff-fade-range");const pt=ut=>{const St=w.depthModeForSublayer(1,gn.ReadOnly,R.LEQUAL,!0),Dt=m.paint.get(ut?"fill-extrusion-ambient-occlusion-ground-attenuation":"fill-extrusion-flood-light-ground-attenuation"),Ot=mt(.1,3,Dt),Gt=w._showOverdrawInspector;if(!Gt){const Zt=new Vn({func:R.ALWAYS,mask:255},255,255,R.KEEP,R.KEEP,R.REPLACE),ar=new us([R.ONE,R.ONE,R.ONE,R.ONE],i.ao.transparent,[!1,!1,!1,!0],R.MIN);Lp(vt,w,d,m,j,St,Zt,ar,$n.disabled,ut,"sdf",je,ve,Re,Le,rt,Ot,te,!1)}{const Zt=Gt?Vn.disabled:new Vn({func:R.EQUAL,mask:255},255,255,R.KEEP,R.DECR,R.DECR),ar=Gt?w.colorModeForRenderPass():new us([R.ONE_MINUS_DST_ALPHA,R.DST_ALPHA,R.ONE,R.ONE],i.ao.transparent,[!0,!0,!0,!0]);Lp(vt,w,d,m,j,St,Zt,ar,$n.disabled,ut,"color",je,ve,Re,Le,rt,Ot,te,!1)}};if(H){const ut=()=>{const Dt=B.drapeBufferSize[0],Ot=B.drapeBufferSize[1];let Gt=B.framebufferCopyTexture;return Gt&&(!Gt||Gt.size[0]===Dt&&Gt.size[1]===Ot)||(Gt&&Gt.destroy(),Gt=B.framebufferCopyTexture=new i.T(O,new i.q({width:Dt,height:Ot}),R.RGBA8)),Gt.bind(R.LINEAR,R.CLAMP_TO_EDGE),R.copyTexSubImage2D(R.TEXTURE_2D,0,0,0,0,0,Dt,Ot),Gt},St=(Dt,Ot,Gt)=>{const Zt=w.depthModeForSublayer(1,gn.ReadOnly,R.LEQUAL,!1),ar=m.paint.get(Dt?"fill-extrusion-ambient-occlusion-ground-attenuation":"fill-extrusion-flood-light-ground-attenuation"),br=mt(.1,3,ar);{const Ut=new us([R.ONE,R.ONE,R.ONE,R.ONE],i.ao.transparent,[!1,!1,!1,!0]);Lp(vt,w,d,m,j,Zt,Vn.disabled,Ut,$n.disabled,Dt,"clear",je,ve,Re,Le,rt,br,te,Ot)}{const Ut=new Vn({func:R.ALWAYS,mask:255},255,255,R.KEEP,R.KEEP,R.REPLACE),Tt=new us([R.ONE,R.ONE,R.ONE,R.ONE],i.ao.transparent,[!1,!1,!1,!0],R.MIN);Lp(vt,w,d,m,j,Zt,Ut,Tt,$n.disabled,Dt,"sdf",je,ve,Re,Le,rt,br,te,Ot)}Y&&!Dt&&(Gt=ut());{const Ut=Dt?R.ZERO:R.ONE_MINUS_DST_ALPHA,Tt=new Vn({func:R.EQUAL,mask:255},255,255,R.KEEP,R.DECR,R.DECR),Jt=new us([Ut,R.DST_ALPHA,R.ONE_MINUS_DST_ALPHA,R.ZERO],i.ao.transparent,[!0,!0,!0,!0]);Lp(vt,w,d,m,j,Zt,Tt,Jt,$n.disabled,Dt,"color",je,ve,Re,Le,rt,br,te,Ot)}if(!Y||Dt){const Ut=new us([R.ONE,R.ONE,R.ONE,Dt?R.ZERO:R.ONE],i.ao.transparent,[!1,!1,!1,!0],Dt?R.FUNC_ADD:R.MAX);Lp(vt,w,d,m,j,Zt,Vn.disabled,Ut,$n.disabled,Dt,"clear",je,ve,Re,Le,rt,br,te,Ot,Gt)}else{R.drawBuffers([R.NONE,R.COLOR_ATTACHMENT1]);const Ut=new Vn({func:R.EQUAL,mask:255},254,255,R.KEEP,R.DECR,R.DECR),Tt=new us([R.ONE,R.ONE,R.ONE,R.ONE],i.ao.transparent,[!0,!1,!1,!1],R.MAX);Lp(vt,w,d,m,j,Zt,Ut,Tt,$n.disabled,Dt,"emissive",je,ve,Re,Le,rt,br,te,Ot,Gt),R.drawBuffers([R.COLOR_ATTACHMENT0])}};if(Ke||wt){let Dt;w.prepareDrawTile(),Y&&!Ke||(Dt=ut()),Ke&&St(!0,!1,Dt),wt&&St(!1,!0,Dt)}}else Ke&&pt(!0),wt&&pt(!1),(Ke||wt)&&w.resetStencilClippingMasks()}}},building:function(w,d,m,j){w.currentLayer0&&O>0,Y=!0;const te=m.paint.get("building-vertical-scale");if(te<=0)return;w.shadowRenderer||(Y=!1);const de=w.conflationActive&&w.style.isLayerClipped(m,d.getSource()),ce=w.style.order.indexOf(m.fqid);if(function(ue,je,ve,Re,Le,We){for(const rt of We){const Ke=je.getTile(rt).getBucket(ve);Ke&&(Le&&Ke.updateReplacement(rt,ue.replacementSource,Re),Ke.uploadUpdatedIndexBuffer(ue.context))}}(w,d,m,ce,de,j),function(ue,je,ve,Re){for(const Le of Re){const We=je.getTile(Le).getBucket(ve);We&&We.needsEvaluation()&&We.uploadUpdatedColorBuffer(ue.context)}}(w,d,m,j),m.resetLayerRenderingStats(w),w.shadowRenderer&&(w.shadowRenderer.useNormalOffset=!0),w.renderPass==="shadow"&&w.shadowRenderer){const ue=w.shadowRenderer,je=[],ve=ue.getShadowPassDepthMode();t_({painter:w,source:d,layer:m,coords:j,defines:je,blendMode:ue.getShadowPassColorMode(),depthMode:ve,opacity:B,verticalScale:te,facadeEmissiveChance:0,facadeAOIntensity:0,floodLightIntensity:0,floodLightColor:[0,0,0]})}else if(w.renderPass==="translucent"){let ue=["HAS_ATTRIBUTE_a_part_color_emissive","LIGHTING_3D_MODE"];Y&&(ue=ue.concat("RENDER_SHADOWS","DEPTH_TEXTURE")),w.shadowRenderer&&w.shadowRenderer.useNormalOffset&&(ue=ue.concat("NORMAL_OFFSET"));const je=m.paint.get("building-facade-emissive-chance"),ve=m.paint.get("building-ambient-occlusion-intensity"),Re=m.paint.get("building-flood-light-intensity"),Le=m.paint.get("building-flood-light-color-use-theme").constantOr("default")==="none",We=m.paint.get("building-flood-light-color").toNonPremultipliedRenderColor(Le?null:m.lut).toArray01().slice(0,3),rt=m.paint.get("building-flood-light-ground-attenuation"),Ke=Re>0,wt=new gn(w.context.gl.LEQUAL,gn.ReadWrite,w.depthRangeFor3D);B<1&&t_({painter:w,source:d,layer:m,coords:j,defines:ue,blendMode:us.disabled,depthMode:wt,opacity:B,verticalScale:te,facadeEmissiveChance:je,facadeAOIntensity:ve,floodLightIntensity:Re,floodLightColor:We,depthOnly:!0});const mt=w.colorModeForRenderPass();t_({painter:w,source:d,layer:m,coords:j,defines:ue,blendMode:mt,depthMode:wt,opacity:B,verticalScale:te,facadeEmissiveChance:je,facadeAOIntensity:ve,floodLightIntensity:Re,floodLightColor:We}),H&&_N(w,d,m,j,!0,B,A,O,Re,We,R,de),Ke&&_N(w,d,m,j,!1,B,A,O,Re,We,rt,de)}else if(w.renderPass==="light-beam"){const ue=["HAS_ATTRIBUTE_a_part_color_emissive","HAS_ATTRIBUTE_a_bloom_attenuation"],je=new gn(w.context.gl.LEQUAL,gn.ReadOnly,w.depthRangeFor3D);t_({painter:w,source:d,layer:m,coords:j,defines:ue,blendMode:us.alphaBlended,depthMode:je,opacity:B,verticalScale:te,facadeEmissiveChance:0,facadeAOIntensity:0,floodLightIntensity:0,floodLightColor:[0,0,0]})}w.shadowRenderer&&(w.shadowRenderer.useNormalOffset=!1),w.resetStencilClippingMasks()},hillshade:function(w,d,m,j){if(w.renderPass!=="offscreen"&&w.renderPass!=="translucent"||w.style.disableElevatedTerrain)return;const A=w.context,O=w.terrain&&w.terrain.renderingToTexture,[R,B]=w.renderPass!=="translucent"||O?[{},j]:w.stencilConfigForOverlap(j);for(const H of B){const Y=d.getTile(H);if(Y.needsHillshadePrepare&&w.renderPass==="offscreen")Gie(w,Y,m);else if(w.renderPass==="translucent"){const te=w.depthModeForSublayer(0,gn.ReadOnly),de=m.paint.get("hillshade-emissive-strength"),ce=w.colorModeForDrapableLayerRenderPass(de),ue=O&&w.terrain?w.terrain.stencilModeForRTTOverlap(H):R[H.overscaledZ];Wie(w,H,Y,m,te,ue,ce)}}A.viewport.set([0,0,w.width,w.height]),w.resetStencilClippingMasks()},raster:function(w,d,m,j,A,O){if(w.renderPass!=="translucent"||m.paint.get("raster-opacity")===0)return;const R=w.transform.projection.name==="globe",B=m.paint.get("raster-elevation")!==0,H=B&&R;if(w.renderElevatedRasterBackface&&!H)return;const Y=w.context,te=Y.gl,de=d.getSource(),ce=function(mt,vt,pt,ut,St){const Dt=vt.paint.get("raster-color"),Ot=mt.type==="raster-array",Gt=[],Zt=vt.paint.get("raster-resampling"),ar=vt.paint.get("raster-color-mix");let br=vt.paint.get("raster-color-range");const Ut=[ar[0],ar[1],ar[2],0],Tt=ar[3];let Jt=Zt==="nearest"?ut.NEAREST:ut.LINEAR;if(Ot&&(Gt.push("RASTER_ARRAY"),Dt||Gt.push("RASTER_COLOR"),Zt==="linear"&&Gt.push("RASTER_ARRAY_LINEAR"),Jt=ut.NEAREST,!br&&mt.rasterLayers)){const Ht=mt.rasterLayers.find(({id:hr})=>hr===vt.sourceLayer);Ht&&Ht.fields&&Ht.fields.range&&(br=Ht.fields.range)}if(br=br||[0,1],Dt){Gt.push("RASTER_COLOR"),pt.activeTexture.set(ut.TEXTURE2),vt.updateColorRamp(br);let Ht=vt.colorRampTexture;Ht||(Ht=vt.colorRampTexture=new i.T(pt,vt.colorRamp,ut.RGBA8)),Ht.bind(ut.LINEAR,ut.CLAMP_TO_EDGE)}return St&&Gt.push("USE_MRT1"),{mix:Ut,range:br,offset:Tt,defines:Gt,resampling:Jt}}(de,m,Y,te,w.terrain&&w.terrain.renderingToTexture&&w.emissiveMode==="mrt-fallback");if(de instanceof i.aU&&!j.length&&!R)return;const ue=m.paint.get("raster-emissive-strength"),je=w.colorModeForDrapableLayerRenderPass(ue),ve=w.terrain&&w.terrain.renderingToTexture,Re=!w.options.moving,Le=m.paint.get("raster-resampling")==="nearest"?te.NEAREST:te.LINEAR;if(de instanceof i.aU&&!j.length&&(de.onNorthPole||de.onSouthPole)){const mt=B?w.stencilModeFor3D():Vn.disabled;return void r_(!!de.onNorthPole,null,w,d,m,ue,ce,$n.disabled,mt)}if(!j.length)return;const[We,rt]=de instanceof i.aU||ve?[{},j]:w.stencilConfigForOverlap(j),Ke=rt[rt.length-1].overscaledZ;H&&ce.defines.push("PROJECTION_GLOBE_VIEW"),B&&ce.defines.push("RENDER_CUTOFF");const wt=(mt,vt,pt)=>{for(const ut of mt){const St=ut.toUnwrapped(),Dt=d.getTile(ut);if(ve&&(!Dt||!Dt.hasData()))continue;Y.activeTexture.set(te.TEXTURE0);const Ot=Dp(Dt,de,m,ce);if(!Ot||!Ot.texture)continue;const{texture:Gt,mix:Zt,offset:ar,tileSize:br,buffer:Ut}=Ot;let Tt,Jt;ve?(Tt=gn.disabled,Jt=ut.projMatrix):B?(Tt=new gn(te.LEQUAL,gn.ReadWrite,w.depthRangeFor3D),Jt=R?Float32Array.from(w.transform.expandedFarZProjMatrix):w.transform.calculateProjMatrix(St,Re)):(Tt=w.depthModeForSublayer(ut.overscaledZ-Ke,m.paint.get("raster-opacity")===1?gn.ReadWrite:gn.ReadOnly,te.LESS),Jt=w.transform.calculateProjMatrix(St,Re));const Ht=w.terrain&&ve?w.terrain.stencilModeForRTTOverlap(ut):We[ut.overscaledZ],hr=O?0:m.paint.get("raster-fade-duration");Dt.registerFadeDuration(hr);const Ar=d.findLoadedParent(ut,0),Kr=Yv(Dt,Ar,d,w.transform,hr);let Sr,wr;!Kr.isFading&&Dt.refreshedUponExpiration&&(Dt.refreshedUponExpiration=!1),w.terrain&&w.terrain.prepareDrawTile(),Y.activeTexture.set(te.TEXTURE0),Gt.bind(Le,te.CLAMP_TO_EDGE),Y.activeTexture.set(te.TEXTURE1),Ar?(Ar.texture&&Ar.texture.bind(Le,te.CLAMP_TO_EDGE),Sr=Math.pow(2,Ar.tileID.overscaledZ-Dt.tileID.overscaledZ),wr=[Dt.tileID.canonical.x*Sr%1,Dt.tileID.canonical.y*Sr%1]):Gt.bind(Le,te.CLAMP_TO_EDGE),"useMipmap"in Gt&&Y.extTextureFilterAnisotropic&&w.transform.pitch>20&&te.texParameterf(te.TEXTURE_2D,Y.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,Y.extTextureFilterAnisotropicMax);const cn=w.transform;let rn;const qr=B?o6(cn):[0,0,0,0];let Xr,Cn,ts,Us,wa,hn=0;if(H&&de instanceof i.aU&&de.coordinates.length>3)Xr=Float32Array.from(i.bk(i.dJ(new i.cD(0,0,0)))),Cn=Float32Array.from(cn.globeMatrix),ts=Float32Array.from(i.dF(cn)),Us=[i.aF(cn.center.lng),i.aJ(cn.center.lat)],rn=de.elevatedGlobePerspectiveTransform,wa=de.elevatedGlobeGridMatrix||new Float32Array(9);else if(H){const qa=i.dG(ut.canonical);hn=i.dH(qa.getCenter().lat),Xr=Float32Array.from(i.bk(i.dJ(ut.canonical))),Cn=Float32Array.from(cn.globeMatrix),ts=Float32Array.from(i.dF(cn)),Us=[i.aF(cn.center.lng),i.aJ(cn.center.lat)],rn=[0,0],wa=Float32Array.from(i.dI(ut.canonical,qa,hn,cn.worldSize/cn._pixelsPerMercatorPixel))}else rn=de instanceof i.aU?de.perspectiveTransform:[0,0],Xr=new Float32Array(16),Cn=new Float32Array(9),ts=new Float32Array(16),Us=[0,0],wa=new Float32Array(9);const fa=e6(Jt,Xr,Cn,ts,wa,wr||[0,0],i.aj(w.transform.zoom),Us,qr,Sr||1,Kr,m,rn,B?m.paint.get("raster-elevation"):0,2,Zt,ar,ce.range,br,Ut,ue),Yn=w.isTileAffectedByFog(ut),Ca=w.getOrCreateProgram("raster",{defines:ce.defines,overrideFog:Yn});if(w.uploadCommonUniforms(Y,Ca,St),de instanceof i.aU){const qa=de.elevatedGlobeVertexBuffer,Oa=de.elevatedGlobeIndexBuffer;if(ve||!R)de.boundsBuffer&&de.boundsSegments&&Ca.draw(w,te.TRIANGLES,Tt,Vn.disabled,je,$n.disabled,fa,m.id,de.boundsBuffer,w.quadTriangleIndexBuffer,de.boundsSegments);else if(qa&&Oa){const ha=cn.zoom<=i.c_?de.elevatedGlobeSegments:de.getSegmentsForLongitude(cn.center.lng);ha&&Ca.draw(w,te.TRIANGLES,Tt,Vn.disabled,je,vt,fa,m.id,qa,Oa,ha)}}else if(H){Tt=new gn(te.LEQUAL,gn.ReadOnly,w.depthRangeFor3D);const qa=w.globeSharedBuffers;if(qa){const[Oa,ha,fs]=qa.getGridBuffers(hn,!1);Ca.draw(w,te.TRIANGLES,Tt,pt||Ht,w.colorModeForRenderPass(),vt,fa,m.id,Oa,ha,fs)}}else{const{tileBoundsBuffer:qa,tileBoundsIndexBuffer:Oa,tileBoundsSegments:ha}=w.getTileBoundsBuffers(Dt);Ca.draw(w,te.TRIANGLES,Tt,Ht,je,$n.disabled,fa,m.id,qa,Oa,ha)}}if(!(de instanceof i.aU)&&H)for(const ut of mt){const St=ut.canonical.y===(1<>>16,2654435769),((ut=Math.imul(ut^ut>>>16,2654435769))>>>0)/4294967296},pt=1/1.1;for(let ut=0;uti.e9[Ht](Gt));Ut.push(Gt);const Tt=Gt.canonical.x,Jt=Gt.canonical.y;for(const Ht of Ut){const hr=Ke.getTile(St?Ht.wrapped():Ht);if(!hr)continue;const Ar=hr.rasterParticleState;if(!Ar)continue;const Kr=Ht.canonical.x+(1<vt.tileID)),ue&&(Y.activeTexture.set(te.TEXTURE0),w.imageManager.bind(w.context,m.scope));const mt=[];if(w.terrain&&w.terrain.renderingToTexture&&w.emissiveMode==="mrt-fallback"&&mt.push("USE_MRT1"),H){const vt=w.getOrCreateProgram(rt,{overrideFog:!1,overrideRtt:!0,defines:mt}),pt=new Float32Array(i.bA([])),ut=new i.aQ(0,0,0,0,0),St=ue?ng(pt,B,R,w,0,m.scope,je,H,{tileID:ut,tileSize:ce}):Qv(pt,B,R,A.toPremultipliedRenderColor(O?null:m.lut));vt.draw(w,te.TRIANGLES,Le,Re,We,$n.disabled,St,m.id,w.viewportBuffer,w.quadTriangleIndexBuffer,w.viewportSegments)}else for(const vt of wt){const pt=w.isTileAffectedByFog(vt),ut=w.getOrCreateProgram(rt,{overrideFog:pt,defines:mt}),St=vt.toUnwrapped(),Dt=j?vt.projMatrix:w.transform.calculateProjMatrix(St);w.prepareDrawTile();const Ot=d?d.getTile(vt):Ke?Ke[vt.key]:new Cp(vt,ce,de.zoom,w),Gt=ue?ng(Dt,B,R,w,0,m.scope,je,H,{tileID:vt,tileSize:ce}):Qv(Dt,B,R,A.toPremultipliedRenderColor(O?null:m.lut));w.uploadCommonUniforms(Y,ut,St);const{tileBoundsBuffer:Zt,tileBoundsIndexBuffer:ar,tileBoundsSegments:br}=w.getTileBoundsBuffers(Ot);ut.draw(w,te.TRIANGLES,Le,Re,We,$n.disabled,Gt,m.id,Zt,ar,br)}},sky:function(w,d,m){const j=w._atmosphere?i.aj(w.transform.zoom):1,A=m.paint.get("sky-opacity")*j;if(A===0)return;const O=w.context,R=m.paint.get("sky-type"),B=new gn(O.gl.LEQUAL,gn.ReadOnly,[0,1]),H=w.frameCounter/1e3%1;R==="atmosphere"?w.renderPass==="offscreen"?m.needsSkyboxCapture(w)&&(function(Y,te,de,ce){const ue=Y.context,je=ue.gl;let ve=te.skyboxFbo;if(!ve){ve=te.skyboxFbo=ue.createFramebuffer(32,32,1,null),te.skyboxGeometry=new kN(ue),te.skyboxTexture=ue.gl.createTexture(),je.bindTexture(je.TEXTURE_CUBE_MAP,te.skyboxTexture),je.texParameteri(je.TEXTURE_CUBE_MAP,je.TEXTURE_WRAP_S,je.CLAMP_TO_EDGE),je.texParameteri(je.TEXTURE_CUBE_MAP,je.TEXTURE_WRAP_T,je.CLAMP_TO_EDGE),je.texParameteri(je.TEXTURE_CUBE_MAP,je.TEXTURE_MIN_FILTER,je.LINEAR),je.texParameteri(je.TEXTURE_CUBE_MAP,je.TEXTURE_MAG_FILTER,je.LINEAR);for(let rt=0;rt<6;++rt)je.texImage2D(je.TEXTURE_CUBE_MAP_POSITIVE_X+rt,0,je.RGBA,32,32,0,je.RGBA,je.UNSIGNED_BYTE,null)}ue.bindFramebuffer.set(ve.framebuffer),ue.viewport.set([0,0,32,32]);const Re=te.getCenter(Y,!0),Le=Y.getOrCreateProgram("skyboxCapture"),We=new Float64Array(16);i.bA(We),i.en(We,We,.5*-Math.PI),bx(Y,te,Le,We,Re,0),i.bA(We),i.en(We,We,.5*Math.PI),bx(Y,te,Le,We,Re,1),i.bA(We),i.cU(We,We,.5*-Math.PI),bx(Y,te,Le,We,Re,2),i.bA(We),i.cU(We,We,.5*Math.PI),bx(Y,te,Le,We,Re,3),i.bA(We),bx(Y,te,Le,We,Re,4),i.bA(We),i.en(We,We,Math.PI),bx(Y,te,Le,We,Re,5),ue.viewport.set([0,0,Y.width,Y.height])}(w,m),m.markSkyboxValid(w)):w.renderPass==="sky"&&function(Y,te,de,ce,ue){const je=Y.context,ve=je.gl,Re=Y.transform,Le=Y.getOrCreateProgram("skybox");je.activeTexture.set(ve.TEXTURE0),ve.bindTexture(ve.TEXTURE_CUBE_MAP,te.skyboxTexture);const We=((rt,Ke,wt,mt,vt)=>({u_matrix:rt,u_sun_direction:Ke,u_cubemap:0,u_opacity:mt,u_temporal_offset:vt}))(Re.skyboxMatrix,te.getCenter(Y,!1),0,ce,ue);Y.uploadCommonUniforms(je,Le),Le.draw(Y,ve.TRIANGLES,de,Vn.disabled,Y.colorModeForRenderPass(),$n.backCW,We,"skybox",te.skyboxGeometry.vertexBuffer,te.skyboxGeometry.indexBuffer,te.skyboxGeometry.segment)}(w,m,B,A,H):R==="gradient"&&w.renderPass==="sky"&&function(Y,te,de,ce,ue){const je=Y.context,ve=je.gl,Re=Y.transform,Le=Y.getOrCreateProgram("skyboxGradient");te.skyboxGeometry||(te.skyboxGeometry=new kN(je)),je.activeTexture.set(ve.TEXTURE0);let We=te.colorRampTexture;We||(We=te.colorRampTexture=new i.T(je,te.colorRamp,ve.RGBA8)),We.bind(ve.LINEAR,ve.CLAMP_TO_EDGE);const rt=((Ke,wt,mt,vt,pt)=>({u_matrix:Ke,u_color_ramp:0,u_center_direction:wt,u_radius:i.an(mt),u_opacity:vt,u_temporal_offset:pt}))(Re.skyboxMatrix,te.getCenter(Y,!1),te.paint.get("sky-gradient-radius"),ce,ue);Y.uploadCommonUniforms(je,Le),Le.draw(Y,ve.TRIANGLES,de,Vn.disabled,Y.colorModeForRenderPass(),$n.backCW,rt,"skyboxGradient",te.skyboxGeometry.vertexBuffer,te.skyboxGeometry.indexBuffer,te.skyboxGeometry.segment)}(w,m,B,A,H)},custom:function(w,d,m,j){const A=w.context,O=m.implementation;if(!w.transform.projection.unsupportedLayers||!w.transform.projection.unsupportedLayers.includes("custom")||w.terrain&&(w.terrain.renderingToTexture||w.renderPass==="offscreen")&&m.isDraped(d)){if(w.renderPass==="offscreen"){const R=O.prerender;if(R){if(w.setCustomLayerDefaults(),A.setColorMode(w.colorModeForRenderPass()),w.transform.projection.name==="globe"){const B=w.transform.pointMerc;R.call(O,A.gl,w.transform.customLayerMatrix(),w.transform.getProjection(),w.transform.globeToMercatorMatrix(),i.aj(w.transform.zoom),[B.x,B.y],w.transform.pixelsPerMeterRatio)}else R.call(O,A.gl,w.transform.customLayerMatrix());A.setDirty(),w.setBaseState()}}else if(w.renderPass==="translucent"){if(w.terrain&&w.terrain.renderingToTexture){const B=O.renderToTile;if(B){const H=j[0].canonical,Y={x:H.x+j[0].wrap*(O.wrapTileId?0:1<{Y&&(Y.useNormalOffset=!0,te||(Y.enabled=!0))},ce=d.getSource();if(w.renderPass==="light-beam"&&ce.type!=="batched-model")return;if(ce.type==="vector"||ce.type==="geojson")return function(Ke,wt,mt,vt,pt){const ut=Ke.transform,St=ut.projection.name==="globe",Dt=ut.getFreeCameraOptions().position;if(!Ke.modelManager)return;const Ot=Ke.modelManager;mt.modelManager=Ot;const Gt=Ke.shadowRenderer;if(!mt._unevaluatedLayout._values.hasOwnProperty("model-id"))return;const Zt=mt._unevaluatedLayout._values["model-id"],ar=Object.assign({},mt.layout.get("model-id").parameters),br=Ke.style.order.indexOf(mt.fqid),Ut=mt.paint.get("model-opacity").constantOr(1);for(const Tt of vt){const Jt=wt.getTile(Tt).getBucket(mt);if(!Jt||Jt.projection.name!==ut.projection.name)continue;const Ht=Jt.getModelUris();if(Ht&&!Jt.modelsRequested&&(Ot.addModelsFromBucket(Ht,pt),Jt.modelsRequested=!0),St)ar.zoom=Tt.overscaledZ;else{const qr=jd(Tt,ut);ar.zoom=qr}const hr=Zt.possiblyEvaluate(ar);if(y6(Ke,Jt,Tt),Ff.shadowUniformsInitialized=!1,Ff.useSingleShadowCascade=!!Gt&&Gt.getMaxCascadeForTile(Tt.toUnwrapped())===0,Ke.renderPass==="shadow"&&Gt){if(Ke.currentShadowCascade===1&&Jt.isInsideFirstShadowMapFrustum)continue;const qr=ut.calculatePosMatrix(Tt.toUnwrapped(),ut.worldSize);if(Ff.tileMatrix.set(qr),Ff.shadowTileMatrix=Float32Array.from(Gt.calculateShadowPassMatrixFromMatrix(qr)),Ff.aabb.min=[0,0,0],Ff.aabb.max[0]=Ff.aabb.max[1]=i.al,Ff.aabb.max[2]=0,ioe(Jt,Ff,Ke,mt.scope))continue}const Ar=1<0&&Ke.style.isLayerClipped(mt,wt.getSource())&&Jt.updateReplacement(Tt,Ke.replacementSource,br,mt.scope)&&(Jt.uploaded=!1,Jt.upload(Ke.context));let Sr=0;const wr=new Array,cn=new Array,rn=new Array;for(let qr in Jt.instancesPerModel){const Xr=Jt.instancesPerModel[qr];Xr.features.length>0&&!St&&(qr=hr.evaluate(Xr.features[0].feature,{}));const Cn=Ot.getModel(qr,pt);if(Cn||Ot.hasURLBeenRequested(qr)||Jt.modelUris.includes(qr)||(Jt.modelUris.push(qr),Jt.modelsRequested=!1),Cn&&Cn.uploaded)if(St){const ts=i.c5([],[Dt.x,Dt.y,Dt.z],Ke.transform.worldSize);i.ew(ts,ts);for(let Us=0;Us0&&fa.elevationUpdate(qr.terrain,Us,hn,Cn.source),fa.needsReEvaluation(qr,wa,Cn)&&fa.evaluate(Cn))}})(Ke,wt,mt,vt),function(){let qr,Xr,Cn;wr?(qr=vt.length-1,Xr=-1,Cn=-1):(qr=0,Xr=vt.length,Cn=1);const ts=new Float64Array(16),Us=i.cA(),wa=new i.P(0,0);for(let hn=qr;hn!==Xr;hn+=Cn){const fa=vt[hn],Yn=wt.getTile(fa).getBucket(mt);if(!Yn||!Yn.uploaded)continue;let Ca=!1;Dt&&(Ca=Dt.getMaxCascadeForTile(fa.toUnwrapped())===0);const qa=ut.calculatePosMatrix(fa.toUnwrapped(),ut.worldSize),Oa=Yn.modelTraits;!Ar&&wr&&(i.bl(ts,qa),i.af(Us,Gt,ts),wa.x=Us[0],wa.y=Us[1]);const ha=[];Yn.setFilter(mt.filter);for(const fs of Yn.getNodesInfo()){if(fs.hiddenByReplacement||!fs.node.meshes)continue;const Na=fs.node;let Ki=0;Ke.terrain&&Na.elevation&&(Ki=Na.elevation*Ke.terrain.exaggeration());const ji=(()=>{const Ic=fs.aabb;return hr.min=[...Ic.min],hr.max=[...Ic.max],hr.min[2]+=Ki,hr.max[2]+=Ki,i.af(hr.min,hr.min,qa),i.af(hr.max,hr.max,qa),hr})(),Ma=fs.evaluatedScale;if(Ma[0]<=1&&Ma[1]<=1&&Ma[2]<=1&&ji.intersects(Kr)===0)continue;if(!Ar&&wr){const Ic=.16666666666666666;fs.cameraCollisionOpacity=Gt[0]>ji.min[0]&&Gt[0]ji.min[1]&&Gt[1]!wr||fs.opacity===1&&Na.opacity===1?fs.depthNa.depth?-1:1);for(const fs of ha){const Na=fs.nodeInfo,Ki=Na.node;let ji=i.aB([],Ut,fs.tileModelMatrix);i.aB(ji,ar,ji);const Ma=i.bl([],ji);i.eg(Ma,Ma),i.cS(Ma,Ma,s_),ji=i.aB(ji,ji,Ki.globalMatrix);const ia=Ke.renderPass==="light-beam",ps=mt.paint.get("model-color-use-theme").constantOr("default")==="none",fi=Oa&i.eI.HasMapboxMeshFeatures,uo=fi?0:Na.evaluatedRMEA[0][2];for(let qi=0;qi=or||Vi>=or}}const Gl=Xa.material;let Du;Gl.occlusionTexture&&Gl.occlusionTexture.offsetScale&&(Du=Gl.occlusionTexture.offsetScale,el.defines.push("OCCLUSION_TEXTURE_TRANSFORM"));const ph=Ke.getOrCreateProgram("model",el);!Ar&&Dt&&Dt.setupShadowsFromMatrix(fs.tileModelMatrix,ph,Dt.useNormalOffset),Ke.uploadCommonUniforms(pt,ph,null,Pc);const Zd=Gl.pbrMetallicRoughness;Zd.metallicFactor=.9,Zd.roughnessFactor=.5;const eo=gx(new Float32Array(pc),new Float32Array(ji),new Float32Array(Ma),new Float32Array(Ki.globalMatrix),Ke,fs.opacity,Zd.baseColorFactor,Gl.emissiveFactor,Zd.metallicFactor,Zd.roughnessFactor,Gl,uo,mt,[0,0,0],Du);!kd&&(Na.hasTranslucentParts||fs.opacity<1)&&ph.draw(Ke,pt.gl.TRIANGLES,Jt,Vn.disabled,us.disabled,$n.backCCW,eo,mt.id,Xa.vertexBuffer,Xa.indexBuffer,Xa.segments,mt.paint,Ke.transform.zoom,void 0,Ic),ph.draw(Ke,pt.gl.TRIANGLES,kd?Ht:Jt,Vn.disabled,kd||fs.opacity<1||Na.hasTranslucentParts?us.alphaBlended:us.unblended,$n.backCCW,eo,mt.id,Xa.vertexBuffer,Xa.indexBuffer,Xa.segments,mt.paint,Ke.transform.zoom,void 0,Ic)}}}}()}(w,d,m,j),void de();if(ce.type!=="model")return;const ue=ce.getModels(),je=[],ve=w.transform.getFreeCameraOptions().position,Re=i.c5([],[ve.x,ve.y,ve.z],w.transform.worldSize);i.ew(Re,Re);const Le=[],We=[];let rt=0;for(const Ke of ue){const wt=d.getFeatureState("",Ke.id),mt={type:"Unknown",id:Ke.id,properties:Ke.featureProperties},vt=m.paint.get("model-rotation").evaluate(mt,wt),pt=m.paint.get("model-scale").evaluate(mt,wt),ut=m.paint.get("model-translation").evaluate(mt,wt),St=m.paint.get("model-opacity").evaluate(mt,wt);m6(m,Ke.id,wt,Ke.featureProperties,Ke.nodeOverrideNames,Ke.nodeOverrides),g6(m,Ke.id,wt,Ke.featureProperties,Ke.materialOverrideNames,Ke.materialOverrides),Ke.nodeOverrides.size>0&&Ke.computeBoundsAndApplyParent(),Ke.computeModelMatrix(w,vt,pt,ut,B,R,!1);const Dt=i.bA([]),Ot=i.ef(Ke.position.lat,w.transform.zoom),Gt=i.bq([],[1,1,1/Ot]);i.br(Dt,Dt,Re),je.push({zScaleMatrix:Gt,negCameraPosMatrix:Dt});for(const Zt of Ke.nodes)wx(w,Zt,Ke.matrix,w.transform.expandedFarZProjMatrix,rt,Le,We,Ke.materialOverrides,St);rt++}if(Le.sort((Ke,wt)=>wt.depth-Ke.depth),w.renderPass!=="shadow")x6(w,m,Le,We,je),de();else{for(const Ke of We)Wh(Ke.mesh,Ke.nodeModelMatrix,w,m);for(const Ke of Le)Wh(Ke.mesh,Ke.nodeModelMatrix,w,m);de()}}},EN={line:function(w,d,m){if(w.hasElevatedBuckets=!1,w.hasNonElevatedBuckets=!1,w._unevaluatedLayout.getValue("line-elevation-reference")!==void 0||w._unevaluatedLayout.getValue("line-z-offset")!==void 0){if(d){const j=d.getVisibleCoordinates();for(const A of j){const O=d.getTile(A).getBucket(w);if(O&&(O.elevationType!=="none"?w.hasElevatedBuckets=!0:w.hasNonElevatedBuckets=!0,w.hasElevatedBuckets&&w.hasNonElevatedBuckets))break}}}else w.hasNonElevatedBuckets=!0},model:function(w,d,m){const j=d.getSource();if(!j.loaded())return;if(j.type==="vector"||j.type==="geojson")return void(m.modelManager&&m.modelManager.upload(m,n_(m,w)));if(j.type==="batched-model"||j.type!=="model")return;const A=j.getModels();for(const O of A)O.upload(m.context)},raster:function(w,d,m){const j=d.getSource();if(!(j instanceof hc&&j.loaded()))return;const A=w.sourceLayer||j.rasterLayerIds&&j.rasterLayerIds[0];if(!A)return;const O=w.paint.get("raster-array-band")||j.getInitialBand(A);if(O==null)return;const R=d.getIds().map(B=>d.getTileByID(B));for(const B of R)B.updateNeeded(w.id,O)&&j.prepareTile(B,A,w.id,O)},"raster-particle":function(w,d,m){const j=d.getSource();if(!(j instanceof hc&&j.loaded()))return;const A=w.sourceLayer||j.rasterLayerIds&&j.rasterLayerIds[0];if(!A)return;const O=w.paint.get("raster-particle-array-band")||j.getInitialBand(A);if(O==null)return;const R=d.getIds().map(B=>d.getTileByID(B));for(const B of R)B.updateNeeded(w.id,O)&&j.prepareTile(B,A,w.id,O)}},Ou={fill:xN},IN={fill:function(w,d,m,j){if(!m.layout||m.layout.get("fill-elevation-reference")==="none"||m.paint.get("fill-opacity").constantOr(1)===0)return;const A=w.context.gl,O=new gn(A.LEQUAL,gn.ReadOnly,w.depthRangeFor3D),R=new Vn({func:A.ALWAYS,mask:255},255,255,A.KEEP,A.KEEP,A.REPLACE),B=w.transform.getFreeCameraOptions().position,H=w.getOrCreateProgram("elevatedStructuresDepthReconstruct");for(const Y of j){const te=d.getTile(Y),de=te.getBucket(m);if(!de)continue;const ce=de.elevatedStructures;if(!ce||ce.depthSegments.segments[0].primitiveLength===0)continue;const ue=i6(Y.toUnwrapped(),B),je=w.translatePosMatrix(Y.projMatrix,te,m.paint.get("fill-translate"),m.paint.get("fill-translate-anchor")),ve=mx(je,ue,0,1,0);H.draw(w,A.TRIANGLES,O,R,us.disabled,$n.disabled,ve,m.id,ce.vertexBuffer,ce.indexBuffer,ce.depthSegments,m.paint,w.transform.zoom)}}};class PN{constructor(d,m,j,A,O){this.context=new p0(d,m),this.transform=j,this._tileTextures={},this.frameCopies=[],this.loadTimeStamps=[],this._timeStamp=i.o.now(),this._averageFPS=0,this._fpsHistory=[],this._dt=0,this._debugParams={forceEnablePrecipitation:!1,showTerrainProxyTiles:!1,fpsWindow:30,continousRedraw:!1,enabledLayers:{}};const R=["fill","line","symbol","circle","heatmap","fill-extrusion","building","raster","raster-particle","hillshade","model","background","sky"];for(const H of R)this._debugParams.enabledLayers[H]=!0;for(const H of R);this.occlusionParams=new g0,this.setup(),this.numSublayers=yd.maxUnderzooming+yd.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 r0(this),this._wireframeDebugCache=new ag,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=A,this.worldview=O,this._forceEmissiveMode=!1,this.emissiveMode="constant"}updateTerrain(d,m){const j=!!d&&!!d.terrain&&this.transform.projection.supportsTerrain;if(!(j||this._terrain&&this._terrain.enabled))return;this._terrain||(this._terrain=new N5(this,d));const A=this._terrain;this.transform.elevation=j?A:null,A.update(d,this.transform,m),this.transform.elevation&&!A.enabled&&(this.transform.elevation=null)}_updateFog(d){const m=d.fog;if(!m||this.transform.projection.name==="globe"||m.getOpacity(this.transform.pitch)<1||m.properties.get("horizon-blend")<.03)return void(this.transform.fogCullDistSq=null);const[j,A]=m.getFovAdjustedRange(this.transform._fov);if(j>A)return void(this.transform.fogCullDistSq=null);const O=j+.78*(A-j);this.transform.fogCullDistSq=O*O}get terrain(){return this.transform._terrainEnabled()&&this._terrain&&this._terrain.enabled||this._forceTerrainMode?this._terrain:null}get forceTerrainMode(){return this._forceTerrainMode}set forceTerrainMode(d){d&&!this._terrain&&(this._terrain=new N5(this,this.style)),this._forceTerrainMode=d}get shadowRenderer(){return this._shadowRenderer&&this._shadowRenderer.enabled?this._shadowRenderer:null}get wireframeDebugCache(){return this._wireframeDebugCache}resize(d,m){if(this.width=d*i.o.devicePixelRatio,this.height=m*i.o.devicePixelRatio,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const j of this.style.order)this.style._mergedLayers[j].resize()}setup(){const d=this.context,m=new i.bd;m.emplaceBack(0,0),m.emplaceBack(i.al,0),m.emplaceBack(0,i.al),m.emplaceBack(i.al,i.al),this.tileExtentBuffer=d.createVertexBuffer(m,i.bf.members),this.tileExtentSegments=i.bg.simpleSegment(0,0,4,2);const j=new i.bd;j.emplaceBack(0,0),j.emplaceBack(i.al,0),j.emplaceBack(0,i.al),j.emplaceBack(i.al,i.al),this.debugBuffer=d.createVertexBuffer(j,i.bf.members),this.debugSegments=i.bg.simpleSegment(0,0,4,5);const A=new i.bd;A.emplaceBack(-1,-1),A.emplaceBack(1,-1),A.emplaceBack(-1,1),A.emplaceBack(1,1),this.viewportBuffer=d.createVertexBuffer(A,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 R=new i.b0;R.emplaceBack(0,1,2),R.emplaceBack(2,1,3),this.quadTriangleIndexBuffer=d.createIndexBuffer(R);const B=new i.be;for(const Y of[0,1,3,2,0])B.emplaceBack(Y);this.debugIndexBuffer=d.createIndexBuffer(B),this.emptyTexture=new i.T(d,new i.q({width:1,height:1},Uint8Array.of(0,0,0,0)),d.gl.RGBA8),this.identityMat=i.bC();const H=this.context.gl;this.stencilClearMode=new Vn({func:H.ALWAYS,mask:0},0,255,H.ZERO,H.ZERO,H.ZERO),this.loadTimeStamps.push(performance.now())}getMercatorTileBoundsBuffers(){return{tileBoundsBuffer:this.mercatorBoundsBuffer,tileBoundsIndexBuffer:this.quadTriangleIndexBuffer,tileBoundsSegments:this.mercatorBoundsSegments}}getTileBoundsBuffers(d){return d._makeTileBoundsBuffers(this.context,this.transform.projection),d._tileBoundsBuffer?{tileBoundsBuffer:d._tileBoundsBuffer,tileBoundsIndexBuffer:d._tileBoundsIndexBuffer,tileBoundsSegments:d._tileBoundsSegments}:this.getMercatorTileBoundsBuffers()}clearStencil(){const d=this.context.gl;this.nextStencilID=1,this.currentStencilSource=void 0,this._tileClippingMaskIDs={},this.getOrCreateProgram("clippingMask").draw(this,d.TRIANGLES,gn.disabled,this.stencilClearMode,us.disabled,$n.disabled,Zv(this.identityMat),"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}resetStencilClippingMasks(){this.terrain||(this.currentStencilSource=void 0,this._tileClippingMaskIDs={})}_renderTileClippingMasks(d,m,j){if(!m||this.currentStencilSource===m.id||!d.isTileClipped()||!j||j.length===0)return;if(this._tileClippingMaskIDs&&!this.terrain){let B=!1;for(const H of j)if(this._tileClippingMaskIDs[H.key]===void 0){B=!0;break}if(!B)return}this.currentStencilSource=m.id;const A=this.context,O=A.gl;this.nextStencilID+j.length>256&&this.clearStencil(),A.setColorMode(us.disabled),A.setDepthMode(gn.disabled);const R=this.getOrCreateProgram("clippingMask");this._tileClippingMaskIDs={};for(const B of j){const H=m.getTile(B),Y=this._tileClippingMaskIDs[B.key]=this.nextStencilID++,{tileBoundsBuffer:te,tileBoundsIndexBuffer:de,tileBoundsSegments:ce}=this.getTileBoundsBuffers(H);R.draw(this,O.TRIANGLES,gn.disabled,new Vn({func:O.ALWAYS,mask:0},Y,255,O.KEEP,O.KEEP,O.REPLACE),us.disabled,$n.disabled,Zv(B.projMatrix),"$clipping",te,de,ce)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const d=this.nextStencilID++,m=this.context.gl;return new Vn({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 Vn({func:m.EQUAL,mask:255},this._tileClippingMaskIDs[d.key],0,m.KEEP,m.KEEP,m.REPLACE)}stencilConfigForOverlap(d){const m=this.context.gl,j=d.sort((R,B)=>B.overscaledZ-R.overscaledZ),A=j[j.length-1].overscaledZ,O=j[0].overscaledZ-A+1;if(O>1){this.currentStencilSource=void 0,this.nextStencilID+O>256&&this.clearStencil();const R={};for(let B=0;Bthis._debugParams.fpsWindow&&this._fpsHistory.splice(0,this._fpsHistory.length-this._debugParams.fpsWindow),this._averageFPS=Math.round(this._fpsHistory.reduce((d,m)=>d+m/this._fpsHistory.length,0))}render(d,m){const j=i.o.now();this._dt=j-this._timeStamp,this._timeStamp=j,this._wireframeDebugCache.update(this.frameCounter),this._debugParams.continousRedraw=d.map.repaint,this.style=d,this.options=m;const A=this.style._mergedLayers,O=!(!this.terrain||!this.terrain.enabled),R=()=>this.style._getOrder(O).filter(Ut=>{const Tt=A[Ut];return!(Tt.type in this._debugParams.enabledLayers)||this._debugParams.enabledLayers[Tt.type]});let B=R(),H=!1,Y=!1,te=null,de=0,ce=!1;for(const Ut of B){const Tt=A[Ut];Tt.visibility!=="none"&&(Tt.type==="circle"?H=!0:Tt.type==="building"?(te=Tt,++de):Tt.type==="symbol"&&(Tt.hasOcclusionOpacityProperties?Y=!0:H=!0))}this.updateEmissiveMode();let ue=B.map(Ut=>A[Ut]);const je=this.style._mergedSourceCaches;this.imageManager=d.imageManager,this.modelManager=d.modelManager,this.symbolFadeChange=d.placement.symbolFadeChange(i.o.now()),this.imageManager.beginFrame();for(const Ut in je){const Tt=je[Ut];Tt.used&&(Tt.prepare(this.context),Tt.getSource().usedInConflation&&++de)}let ve=!1;for(const Ut of ue)Ut.isHidden(this.transform.zoom)||(Ut.type==="clip"&&(ve=!0),this.prepareLayer(Ut));const Re={},Le={},We={},rt={},Ke={};for(const Ut in je){const Tt=je[Ut];Re[Ut]=Tt.getVisibleCoordinates(),Le[Ut]=Re[Ut].slice().reverse(),We[Ut]=Tt.getVisibleCoordinates(!0).reverse(),rt[Ut]=Tt.getShadowCasterCoordinates(),Ke[Ut]=Tt.sortCoordinatesByDistance(Re[Ut])}const wt=Ut=>{const Tt=this.style.getLayerSourceCache(Ut);return Tt&&Tt.used?Tt.getSource():null};if(de||ve||this._clippingActiveLastFrame){const Ut=[],Tt=[];let Jt=0;for(const Ht of ue)this.isSourceForClippingOrConflation(Ht,wt(Ht))&&(Ut.push(Ht),Tt.push(Jt)),Jt++;if(Ut&&(ve||Ut.length>1)||this._clippingActiveLastFrame){ve=!1;const Ht=[];for(let hr=0;hr0){const Ht=wt(Tt);Ht&&(this.minCutoffZoom=Math.max(Ht.minzoom,this.minCutoffZoom)),Tt.minzoom&&(this.minCutoffZoom=Math.max(Tt.minzoom,this.minCutoffZoom))}Tt.is3D(O)&&(this.opaquePassCutoff===1/0&&(this.opaquePassCutoff=Ut),this._lastOcclusionLayer=Ut)}const mt=this.style&&this.style.fog;mt?(this._fogVisible=mt.getOpacity(this.transform.pitch)!==0,this._fogVisible&&this.transform.projection.name!=="globe"&&(this._fogVisible=mt.isVisibleOnFrustum(this.transform.cameraFrustum))):this._fogVisible=!1,this._cachedTileFogOpacities={},this.terrain&&(this.terrain.updateTileBinding(We),this.opaquePassCutoff=0,B=R(),ue=B.map(Ut=>A[Ut]));const vt=this._shadowRenderer;if(vt){vt.updateShadowParameters(this.transform,this.style.directionalLight);for(const Ut in je)for(const Tt of Re[Ut]){let Jt={min:0,max:0};this.terrain&&(Jt=this.terrain.getMinMaxForTile(Tt)||Jt),vt.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 p6(this)),this._atmosphere.update(this)):this._atmosphere&&(this._atmosphere.destroy(),this._atmosphere=void 0);const pt=this._debugParams.forceEnablePrecipitation||!(!this.style||!this.style.snow),ut=this._debugParams.forceEnablePrecipitation||!(!this.style||!this.style.rain);if(pt&&!this._snow&&(this._snow=new $5(this)),!pt&&this._snow&&(this._snow.destroy(),delete this._snow),ut&&!this._rain&&(this._rain=new AN(this)),!ut&&this._rain&&(this._rain.destroy(),delete this._rain),this._snow&&this._snow.update(this),this._rain&&this._rain.update(this),te){this.buildingTileBorderManager||(this.buildingTileBorderManager=new NN);const Ut=this.style.getLayerSourceCache(te);this.buildingTileBorderManager.updateBorders(Ut,te)}if(!Qe.has(this.context.gl))return;this.renderPass="offscreen";for(const Ut of ue){const Tt=d.getLayerSourceCache(Ut);if(!Ut.hasOffscreenPass()||Ut.isHidden(this.transform.zoom))continue;const Jt=Tt?Le[Tt.id]:void 0;(Ut.type==="custom"||Ut.type==="raster"||Ut.type==="raster-particle"||Ut.isSky()||Jt&&Jt.length)&&this.renderLayer(this,Tt,Ut,Jt)}this.depthRangeFor3D=[0,1-(ue.length+2)*this.numSublayers*this.depthEpsilon],this._shadowRenderer&&(this.renderPass="shadow",this._shadowRenderer.drawShadowPass(this.style,rt)),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 Ut=this.style.fog;if(Ut&&this.transform.projection.supportsFog){const Tt=this.style.getLut(Ut.scope);if(!St){const Jt=Ut.properties.get("color-use-theme")==="none",Ht=Ut.properties.get("color").toNonPremultipliedRenderColor(Jt?null:Tt).toArray01();return new i.ao(...Ht)}if(St){const Jt=Ut.properties.get("space-color-use-theme")==="none",Ht=Ut.properties.get("space-color").toNonPremultipliedRenderColor(Jt?null:Tt).toArray01();return new i.ao(...Ht)}}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 Ut=ue[this.currentLayer],Tt=d.getLayerSourceCache(Ut);if(Ut.isSky())continue;const Jt=Tt?(Ut.is3D(O)?Ke:Le)[Tt.id]:void 0;this._renderTileClippingMasks(Ut,Tt,Jt),this.renderLayer(this,Tt,Ut,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&&Ut.hasShadowPass()&&--Gt==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 Ht of this.layersWithOcclusionOpacity){this.currentLayer=Ht;const hr=ue[this.currentLayer],Ar=d.getLayerSourceCache(hr),Kr=Ar?Le[Ar.id]:void 0;this.terrain||this._renderTileClippingMasks(hr,Ar,Ar?Re[Ar.id]:void 0),this.renderLayer(this,Ar,hr,Kr)}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 Ut=null;ue.forEach(Tt=>{const Jt=d.getLayerSourceCache(Tt);Jt&&!Tt.isHidden(this.transform.zoom)&&Jt.getVisibleCoordinates().length&&(!Ut||Ut.getSource().maxzoom0?m.pop():null}terrainRenderModeElevated(){return this.style&&!!this.style.getTerrain()&&!!this.terrain&&!this.terrain.renderingToTexture||this.forceTerrainMode}linearFloatFilteringSupported(){return this.context.extTextureFloatLinear!=null}currentGlobalDefines(d,m,j){const A=j===void 0?this.terrain&&this.terrain.renderingToTexture:j,O=[];return this.style&&this.style.enable3dLights()&&(d==="globeRaster"||d==="terrainRaster"?(O.push("LIGHTING_3D_MODE"),O.push("LIGHTING_3D_ALPHA_EMISSIVENESS")):A||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||A||m!==void 0&&!m||O.push("FOG","FOG_DITHERING"),A&&O.push("RENDER_TO_TEXTURE"),this._showOverdrawInspector&&O.push("OVERDRAW_INSPECTOR"),O}getOrCreateProgram(d,m){this.cache=this.cache||{};const j=m&&m.defines||[],A=m&&m.config,O=this.currentGlobalDefines(d,m&&m.overrideFog,m&&m.overrideRtt).concat(j),R=GP.cacheKey(h5[d],d,O,A);return this.cache[R]||(this.cache[R]=new GP(this.context,d,h5[d],A,gN[d],O)),this.cache[R]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.frontFace.setDefault(),this.context.cullFaceSide.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){const d=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(d.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new i.T(this.context,this.debugOverlayCanvas,this.context.gl.RGBA8))}destroy(){this._terrain&&this._terrain.destroy(),this._atmosphere&&(this._atmosphere.destroy(),this._atmosphere=void 0),this.globeSharedBuffers&&this.globeSharedBuffers.destroy(),this.emptyTexture.destroy(),this.debugOverlayTexture&&this.debugOverlayTexture.destroy(),this._wireframeDebugCache.destroy(),this.depthFBO&&(this.depthFBO.destroy(),this.depthFBO=void 0,this.depthTexture=void 0),this.emptyDepthTexture&&this.emptyDepthTexture.destroy()}prepareDrawTile(){this.terrain&&this.terrain.prepareDrawTile()}uploadCommonLightUniforms(d,m){if(this.style.enable3dLights()){const j=this.style.directionalLight,A=this.style.ambientLight;if(j&&A){const O=((R,B,H)=>{const Y=R.properties.get("direction"),te=R.properties.get("color-use-theme")==="none",de=R.properties.get("color").toNonPremultipliedRenderColor(te?null:H.getLut(R.scope)).toArray01(),ce=R.properties.get("intensity"),ue=B.properties.get("color-use-theme")==="none",je=B.properties.get("color").toNonPremultipliedRenderColor(ue?null:H.getLut(B.scope)).toArray01(),ve=B.properties.get("intensity"),Re=[Y.x,Y.y,Y.z],Le=i.dN(je,ve),We=i.dN(de,ce);return{u_lighting_ambient_color:Le,u_lighting_directional_dir:Re,u_lighting_directional_color:We,u_ground_radiance:u0(Re,We,Le)}})(j,A,this.style);m.setLightsUniformValues(d,O)}}}uploadCommonUniforms(d,m,j,A,O){if(this.uploadCommonLightUniforms(d,m),this.terrain&&this.terrain.renderingToTexture)return;const R=this.style.fog;if(R){const B=R.getOpacity(this.transform.pitch),H=((Y,te,de,ce,ue,je,ve,Re,Le,We,rt,Ke)=>{const wt=Y.transform,mt=te.properties.get("color-use-theme")==="none",vt=te.properties.get("color").toNonPremultipliedRenderColor(mt?null:Y.style.getLut(te.scope)).toArray01();vt[3]=ce;const pt=Y.frameCounter/1e3%1,[ut,St]=te.properties.get("vertical-range");return{u_fog_matrix:de?wt.calculateFogTileMatrix(de):Ke||Y.identityMat,u_fog_range:te.getFovAdjustedRange(wt._fov),u_fog_color:vt,u_fog_horizon_blend:te.properties.get("horizon-blend"),u_fog_vertical_limit:[Math.min(ut,St),St],u_fog_temporal_offset:pt,u_frustum_tl:ue,u_frustum_tr:je,u_frustum_br:ve,u_frustum_bl:Re,u_globe_pos:Le,u_globe_radius:We,u_viewport:rt,u_globe_transition:i.aj(wt.zoom),u_is_globe:+(wt.projection.name==="globe")}})(this,R,j,B,this.transform.frustumCorners.TL,this.transform.frustumCorners.TR,this.transform.frustumCorners.BR,this.transform.frustumCorners.BL,this.transform.globeCenterInViewSpace,this.transform.globeRadius,[this.transform.width*i.o.devicePixelRatio,this.transform.height*i.o.devicePixelRatio],A);m.setFogUniformValues(d,H)}O&&m.setCutoffUniformValues(d,O.uniformValues)}setTileLoadedFlag(d){this.tileLoaded=d}saveCanvasCopy(){const d=this.canvasCopy();d&&(this.frameCopies.push(d),this.tileLoaded=!1)}canvasCopy(){const d=this.context.gl,m=d.createTexture();return d.bindTexture(d.TEXTURE_2D,m),d.copyTexImage2D(d.TEXTURE_2D,0,d.RGBA,0,0,d.drawingBufferWidth,d.drawingBufferHeight,0),m}getCanvasCopiesAndTimestamps(){return{canvasCopies:this.frameCopies,timeStamps:this.loadTimeStamps}}averageElevationNeedsEasing(){if(!this.transform._elevation)return!1;const d=this.style&&this.style.fog;return!!d&&d.getOpacity(this.transform.pitch)!==0}getBackgroundTiles(){const d=this._backgroundTiles,m=this._backgroundTiles={},j=this.transform.coveringTiles({tileSize:512});for(const A of j)m[A.key]=d[A.key]||new Cp(A,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]>=or||m[1]>=or}setupDepthForOcclusion(d,m,j){const A=this.context,O=A.gl,R=!!j;var B;j||(j={u_dem:2,u_dem_prev:4,u_dem_tl:[0,0],u_dem_tl_prev:[0,0],u_dem_scale:0,u_dem_scale_prev:0,u_dem_size:0,u_dem_lerp:1,u_depth:3,u_depth_size_inv:[0,0],u_depth_range_unpack:[0,1],u_occluder_half_size:16,u_occlusion_depth_offset:-1e-4,u_exaggeration:0}),A.activeTexture.set(O.TEXTURE3),d&&this.depthFBO&&this.depthTexture?(this.depthTexture.bind(O.NEAREST,O.CLAMP_TO_EDGE),j.u_depth_size_inv=[1/this.depthFBO.width,1/this.depthFBO.height],j.u_depth_range_unpack=[2/((B=this.depthRangeFor3D)[1]-B[0]),-1-2*B[0]/(B[1]-B[0])],j.u_occluder_half_size=.5*this.occlusionParams.occluderSize,j.u_occlusion_depth_offset=this.occlusionParams.depthOffset):this.emptyDepthTexture.bind(O.NEAREST,O.CLAMP_TO_EDGE),A.activeTexture.set(O.TEXTURE0),R||m.setTerrainUniformValues(A,j)}updateEmissiveMode(){if(this._forceEmissiveMode)return;const d=this.style.hasDataDrivenEmissiveStrength();this.emissiveMode=d?this.context.extBlendFuncExtended?"dual-source-blending":"mrt-fallback":"constant"}}function LN(w,d){let m=!1,j=null;const A=()=>{j=null,m&&(w(),j=setTimeout(A,d),m=!1)};return()=>(m=!0,j||A(),j)}class U5{constructor(d){this._hashName=d&&encodeURIComponent(d),i.aY(["_getCurrentHash","_onHashChange","_updateHash"],this),this._updateHash=LN(this._updateHashUnthrottled.bind(this),300)}addTo(d){return this._map=d,window.addEventListener("hashchange",this._onHashChange,!1),d.on("moveend",this._updateHash),this}remove(){return this._map?(this._map.off("moveend",this._updateHash),window.removeEventListener("hashchange",this._onHashChange,!1),clearTimeout(this._updateHash()),this._map=void 0,this):this}getHashString(){const d=this._map;if(!d)return"";const m=Qo(d);if(this._hashName){const j=this._hashName;let A=!1;const O=location.hash.slice(1).split("&").map(R=>{const B=R.split("=")[0];return B===j?(A=!0,`${B}=${m}`):R}).filter(R=>R);return A||O.push(`${j}=${m}`),`#${O.join("&")}`}return`#${m}`}_getCurrentHash(){const d=location.hash.replace("#","");if(this._hashName){let m;return d.split("&").map(j=>j.split("=")).forEach(j=>{j[0]===this._hashName&&(m=j)}),(m&&m[1]||"").split("/")}return d.split("/")}_onHashChange(){const d=this._map;if(!d)return!1;const m=this._getCurrentHash();if(m.length>=3&&!m.some(j=>isNaN(Number(j)))){const j=d.dragRotate.isEnabled()&&d.touchZoomRotate.isEnabled()?+(m[3]||0):d.getBearing();return d.jumpTo({center:[+m[2],+m[1]],zoom:+m[0],bearing:j,pitch:+(m[4]||0)}),!0}return!1}_updateHashUnthrottled(){history.replaceState(history.state,"",location.href.replace(/(#.+)?$/,this.getHashString()))}}function Qo(w,d){const m=w.getCenter(),j=Math.round(100*w.getZoom())/100,A=Math.ceil((j*Math.LN2+Math.log(512/360/.5))/Math.LN10),O=Math.pow(10,A),R=Math.round(m.lng*O)/O,B=Math.round(m.lat*O)/O,H=w.getBearing(),Y=w.getPitch();let te=d?`/${R}/${B}/${j}`:`${j}/${B}/${R}`;return(H||Y)&&(te+="/"+Math.round(10*H)/10),Y&&(te+=`/${Math.round(Y)}`),te}const y0={linearity:.3,easing:i.eT(0,0,.3,1)},q5=Object.assign({deceleration:2500,maxSpeed:1400},y0),V5=Object.assign({deceleration:20,maxSpeed:1400},y0),kx=Object.assign({deceleration:1e3,maxSpeed:360},y0),H5=Object.assign({deceleration:1e3,maxSpeed:90},y0);class W5{constructor(d){this._map=d,this.clear()}clear(){this._inertiaBuffer=[]}record(d){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:i.o.now(),settings:d})}_drainInertiaBuffer(){const d=this._inertiaBuffer,m=i.o.now();for(;d.length>0&&m-d[0].time>160;)d.shift()}_onMoveEnd(d){if(this._map._prefersReducedMotion()||(this._drainInertiaBuffer(),this._inertiaBuffer.length<2))return;const m={zoom:0,bearing:0,pitch:0,pan:new i.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:O}of this._inertiaBuffer)m.zoom+=O.zoomDelta||0,m.bearing+=O.bearingDelta||0,m.pitch+=O.pitchDelta||0,O.panDelta&&m.pan._add(O.panDelta),O.around&&(m.around=O.around),O.pinchAround&&(m.pinchAround=O.pinchAround);const j=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,A={};if(m.pan.mag()){const O=zf(m.pan.mag(),j,Object.assign({},q5,d||{}));A.offset=m.pan.mult(O.amount/m.pan.mag()),A.center=this._map.transform.center,v0(A,O)}if(m.zoom){const O=zf(m.zoom,j,V5);A.zoom=this._map.transform.zoom+O.amount,v0(A,O)}if(m.bearing){const O=zf(m.bearing,j,kx);A.bearing=this._map.transform.bearing+i.aA(O.amount,-179,179),v0(A,O)}if(m.pitch){const O=zf(m.pitch,j,H5);A.pitch=this._map.transform.pitch+O.amount,v0(A,O)}if(A.zoom||A.bearing){const O=m.pinchAround===void 0?m.around:m.pinchAround;A.around=O?this._map.unproject(O):this._map.getCenter()}return this.clear(),A.noMoveStart=!0,A}}function v0(w,d){(!w.duration||w.durationm.unproject(H)),B=O.reduce((H,Y,te,de)=>H.add(Y.div(de.length)),new i.P(0,0));super(d,{points:O,point:B,lngLats:R,lngLat:m.unproject(B),originalEvent:j}),this._defaultPrevented=!1}}class G5 extends i.z{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(d,m){super("wheel",{originalEvent:m}),this._defaultPrevented=!1}}class ON{constructor(d,m){this._map=d,this._clickTolerance=m.clickTolerance}reset(){this._mousedownPos=void 0}wheel(d){return this._firePreventable(new G5(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 og(d.type,this._map,d))}touchmove(d){this._map.fire(new og(d.type,this._map,d))}touchend(d){this._map.fire(new og(d.type,this._map,d))}touchcancel(d){this._map.fire(new og(d.type,this._map,d))}_firePreventable(d){if(this._map.fire(d),d.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class K5{constructor(d){this._map=d}reset(){this._delayContextMenu=!1,this._contextMenuEvent=void 0}mousemove(d){this._map.fire(new 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 DN{constructor(d,m){this._map=d,this._el=d.getCanvasContainer(),this._container=d.getContainer(),this._clickTolerance=m.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(d,m){this.isEnabled()&&d.shiftKey&&d.button===0&&(z(),this._startPos=this._lastPos=m,this._active=!0)}mousemoveWindow(d,m){if(!this._active)return;const j=m,A=this._startPos,O=this._lastPos;if(!A||!O||O.equals(j)||!this._box&&j.dist(A){this._box&&(this._box.style.transform=`translate(${R}px,${H}px)`,this._box.style.width=B-R+"px",this._box.style.height=Y-H+"px")})}mouseupWindow(d,m){if(!this._active)return;const j=this._startPos,A=m;if(j&&d.button===0){if(this.reset(),V(),j.x!==A.x||j.y!==A.y)return this._map.fire(new i.z("boxzoomend",{originalEvent:d})),{cameraAnimation:O=>O.fitScreenCoordinates(j,A,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),D(),delete this._startPos,delete this._lastPos}_fireEvent(d,m){return this._map.fire(new i.z(d,{originalEvent:m}))}}function RN(w,d){const m={};for(let j=0;jthis.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===0&&(this.startTime=d.timeStamp),j.length===this.numTouches&&(this.centroid=function(A){const O=new i.P(0,0);for(const R of A)O._add(R);return O.div(A.length)}(m),this.touches=RN(j,m)))}touchmove(d,m,j){if(this.aborted||!this.centroid)return;const A=RN(j,m);for(const O in this.touches){const R=A[O];(!R||R.dist(this.touches[O])>30)&&(this.aborted=!0)}}touchend(d,m,j){if((!this.centroid||d.timeStamp-this.startTime>500)&&(this.aborted=!0),j.length===0){const A=!this.aborted&&this.centroid;if(this.reset(),A)return A}}}class FN{constructor(d){this.singleTap=new b6(d),this.numTaps=d.numTaps,this.reset()}reset(){this.lastTime=1/0,this.lastTap=void 0,this.count=0,this.singleTap.reset()}touchstart(d,m,j){this.singleTap.touchstart(d,m,j)}touchmove(d,m,j){this.singleTap.touchmove(d,m,j)}touchend(d,m,j){const A=this.singleTap.touchend(d,m,j);if(A){const O=d.timeStamp-this.lastTime<500,R=!this.lastTap||this.lastTap.dist(A)<30;if(O&&R||this.reset(),this.count++,this.lastTime=d.timeStamp,this.lastTap=A,this.count===this.numTaps)return this.reset(),A}}}class w6{constructor(){this._zoomIn=new FN({numTouches:1,numTaps:2}),this._zoomOut=new FN({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(d,m,j){this._zoomIn.touchstart(d,m,j),this._zoomOut.touchstart(d,m,j)}touchmove(d,m,j){this._zoomIn.touchmove(d,m,j),this._zoomOut.touchmove(d,m,j)}touchend(d,m,j){const A=this._zoomIn.touchend(d,m,j),O=this._zoomOut.touchend(d,m,j);return A?(this._active=!0,d.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:R=>R.easeTo({duration:300,zoom:R.getZoom()+1,around:R.unproject(A)},{originalEvent:d})}):O?(this._active=!0,d.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:R=>R.easeTo({duration:300,zoom:R.getZoom()-1,around:R.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 j6={0:1,2:2},Z5={Control:"ctrlKey",Alt:"altKey",Shift:"shiftKey",Meta:"metaKey"};class zN{constructor(d){this.reset(),this._clickTolerance=d.clickTolerance||1}blur(){this.reset()}reset(){this._active=!1,this._moved=!1,this._lastPoint=void 0,this._eventButton=void 0}_correctButton(d,m){return!1}_move(d,m){return{}}mousedown(d,m){if(this._lastPoint)return;const j=J(d);this._correctButton(d,j)&&(this._lastPoint=m,this._eventButton=j)}mousemoveWindow(d,m){const j=this._lastPoint;if(j){if(d.preventDefault(),this._eventButton!=null&&function(A,O){const R=j6[O];return A.buttons===void 0||(A.buttons&R)!==R}(d,this._eventButton))this.reset();else if(this._moved||!(m.dist(j)0&&(this._active=!0);const A=RN(j,m),O=new i.P(0,0),R=new i.P(0,0);let B=0;for(const Y in A){const te=A[Y],de=this._touches[Y];de&&(O._add(te),R._add(te.sub(de)),B++,A[Y]=te)}if(this._touches=A,B{this._alertContainer.classList.remove("mapboxgl-touch-pan-blocker-show"),this._alertContainer.removeAttribute("role")},500)}}class BN{constructor(){this.reset()}reset(){this._active=!1,this._firstTwoTouches=void 0}_start(d){}_move(d,m,j){return{}}touchstart(d,m,j){this._firstTwoTouches||j.length<2||(this._firstTwoTouches=[j[0].identifier,j[1].identifier],this._start([m[0],m[1]]))}touchmove(d,m,j){const A=this._firstTwoTouches;if(!A)return;d.preventDefault();const[O,R]=A,B=a_(j,m,O),H=a_(j,m,R);if(!B||!H)return;const Y=this._aroundCenter?null:B.add(H).div(2);return this._move([B,H],Y,d)}touchend(d,m,j){if(!this._firstTwoTouches)return;const[A,O]=this._firstTwoTouches,R=a_(j,m,A),B=a_(j,m,O);R&&B||(this._active&&V(),this.reset())}touchcancel(){this.reset()}enable(d){this._enabled=!0,this._aroundCenter=!!d&&d.around==="center"}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}function a_(w,d,m){for(let j=0;jMath.abs(w.x)}class loe extends BN{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,j){const A=this._lastPoints;if(!A)return;const O=d[0].sub(A[0]),R=d[1].sub(A[1]);return this._map._cooperativeGestures&&!i.eU()&&j.touches.length<3||(this._valid=this.gestureBeginsVertically(O,R,j.timeStamp),!this._valid)?void 0:(this._lastPoints=d,this._active=!0,{pitchDelta:(O.y+R.y)/2*-.5})}gestureBeginsVertically(d,m,j){if(this._valid!==void 0)return this._valid;const A=d.mag()>=2,O=m.mag()>=2;if(!A&&!O)return;if(!A||!O)return this._firstMove==null&&(this._firstMove=j),j-this._firstMove<100&&void 0;const R=d.y>0==m.y>0;return $N(d)&&$N(m)&&R}}const coe={panStep:100,bearingStep:15,pitchStep:10};class doe{constructor(){const d=coe;this._panStep=d.panStep,this._bearingStep=d.bearingStep,this._pitchStep=d.pitchStep,this._rotationDisabled=!1}blur(){this.reset()}reset(){this._active=!1}keydown(d){if(d.altKey||d.ctrlKey||d.metaKey)return;let m=0,j=0,A=0,O=0,R=0;switch(d.keyCode){case 61:case 107:case 171:case 187:m=1;break;case 189:case 109:case 173:m=-1;break;case 37:d.shiftKey?j=-1:(d.preventDefault(),O=-1);break;case 39:d.shiftKey?j=1:(d.preventDefault(),O=1);break;case 38:d.shiftKey?A=1:(d.preventDefault(),R=-1);break;case 40:d.shiftKey?A=-1:(d.preventDefault(),R=1);break;default:return}return this._rotationDisabled&&(j=0,A=0),{cameraAnimation:B=>{const H=B.getZoom();B.easeTo({duration:300,easeId:"keyboardHandler",easing:i_,zoom:m?Math.round(H)+m*(d.shiftKey?2:1):H,bearing:B.getBearing()+j*this._bearingStep,pitch:B.getPitch()+A*this._pitchStep,offset:[-O*this._panStep,-R*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 i_(w){return w*(2-w)}const Q5=4.000244140625,J5=1/450;class UN{constructor(d,m){this._map=d,this._el=d.getCanvasContainer(),this._handler=m,this._delta=0,this._lastDelta=0,this._defaultZoomRate=.01,this._wheelZoomRate=J5,i.aY(["_onTimeout","_addScrollZoomBlocker","_showBlockerAlert"],this)}setZoomRate(d){this._defaultZoomRate=d}setWheelZoomRate(d){this._wheelZoomRate=d}isEnabled(){return!!this._enabled}isActive(){return this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(d){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!d&&d.around==="center",this._map._cooperativeGestures&&this._addScrollZoomBlocker())}disable(){this.isEnabled()&&(this._enabled=!1,this._map._cooperativeGestures&&(clearTimeout(this._alertTimer),this._alertContainer.remove()))}wheel(d){if(!this.isEnabled())return;if(this._map._cooperativeGestures){if(!(d.ctrlKey||d.metaKey||this.isZooming()||i.eU()))return void this._showBlockerAlert();this._alertContainer.style.visibility!=="hidden"&&(this._alertContainer.style.visibility="hidden",clearTimeout(this._alertTimer))}let m=d.deltaMode===WheelEvent.DOM_DELTA_LINE?40*d.deltaY:d.deltaY;const j=i.o.now(),A=j-(this._lastWheelEventTime||0);this._lastWheelEventTime=j,m!==0&&m%Q5==0?this._type="wheel":m!==0&&Math.abs(m)<4?this._type="trackpad":A>400?(this._type=null,this._lastValue=m,this._timeout=window.setTimeout(this._onTimeout,40,d)):this._type||(this._type=Math.abs(A*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=W(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)>Q5?this._wheelZoomRate:this._defaultZoomRate;let te=2/(1+Math.exp(-Math.abs(this._delta*Y)));this._delta<0&&te!==0&&(te=1/te);const de=m(),ce=Math.pow(2,de),ue=typeof this._targetZoom=="number"?d.zoomScale(this._targetZoom):ce;this._targetZoom=Math.min(d.maxZoom,Math.max(d.minZoom,d.scaleZoom(ue*te))),this._type==="wheel"&&(this._startZoom=de,this._easing=this._smoothOutEasing(200)),this._lastDelta=this._delta,this._delta=0}const j=typeof this._targetZoom=="number"?this._targetZoom:m(),A=this._startZoom,O=this._easing;let R,B=!1;if(this._type==="wheel"&&A&&O){const Y=Math.min((i.o.now()-this._lastWheelEventTime)/200,1),te=O(Y);R=i.ak(A,j,te),Y<1?this._frameId||(this._frameId=!0):B=!0}else R=j,B=!0;this._active=!0,B&&(this._active=!1,this._finishTimeout=window.setTimeout(()=>{this._zooming=!1,this._handler._triggerRenderFrame(),delete this._targetZoom,delete this._finishTimeout},200));let H=R-m();return H*this._lastDelta<0&&(H=0),{noInertia:!0,needsRenderFrame:!B,zoomDelta:H,around:this._aroundPoint,aroundCoord:this._aroundCoord,originalEvent:this._lastWheelEvent}}_smoothOutEasing(d){let m=i.eV;if(this._prevEase){const j=this._prevEase,A=(i.o.now()-j.start)/j.duration,O=j.easing(A+.01)-j.easing(A),R=.27/Math.sqrt(O*O+1e-4)*.01,B=Math.sqrt(.0729-R*R);m=i.eT(R,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=k("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 Fp{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 qN{constructor(){this.reset()}reset(){this._active=!1}blur(){this.reset()}dblclick(d,m){return d.preventDefault(),{cameraAnimation:j=>{j.easeTo({duration:300,zoom:j.getZoom()+(d.shiftKey?-1:1),around:j.unproject(m)},{originalEvent:d})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Jo{constructor(){this._tap=new FN({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,this._swipePoint=void 0,this._swipeTouch=0,this._tapTime=0,this._tap.reset()}touchstart(d,m,j){this._swipePoint||(this._tapTime&&d.timeStamp-this._tapTime>500&&this.reset(),this._tapTime?j.length>0&&(this._swipePoint=m[0],this._swipeTouch=j[0].identifier):this._tap.touchstart(d,m,j))}touchmove(d,m,j){if(this._tapTime){if(this._swipePoint){if(j[0].identifier!==this._swipeTouch)return;const A=m[0],O=A.y-this._swipePoint.y;return this._swipePoint=A,d.preventDefault(),this._active=!0,{zoomDelta:O/128}}}else this._tap.touchmove(d,m,j)}touchend(d,m,j){this._tapTime?this._swipePoint&&j.length===0&&this.reset():this._tap.touchend(d,m,j)&&(this._tapTime=d.timeStamp)}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Bf{constructor(d,m,j){this._el=d,this._mousePan=m,this._touchPan=j}enable(d){this._inertiaOptions=d||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("mapboxgl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("mapboxgl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class o_{constructor(d,m,j){this._pitchWithRotate=d.pitchWithRotate,this._mouseRotate=m,this._mousePitch=j}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()}}class VN{constructor(d,m,j,A){this._el=d,this._touchZoom=m,this._touchRotate=j,this._tapDragZoom=A,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 l_=w=>w.zoom||w.drag||w.pitch||w.rotate;class uoe extends i.z{}class c_{constructor(){this.constants=[1,1,.01],this.radius=0}setup(d,m){const j=i.av([],m,d);this.radius=i.ag(j[2]<0?i.eX([],j,this.constants):[j[0],j[1],0])}projectRay(d){i.eX(d,d,this.constants),i.aw(d,d),i.eY(d,d,this.constants);const m=i.c5([],d,this.radius);if(m[2]>0){const j=i.c5([],[0,0,1],i.bJ(m,[0,0,1])),A=i.c5([],i.aw([],[m[0],m[1],0]),this.radius),O=i.d8([],m,i.c5([],i.av([],i.d8([],A,j),m),2));m[0]=O[0],m[1]=O[1]}return m}}function HN(w){return w.panDelta&&w.panDelta.mag()||w.zoomDelta||w.bearingDelta||w.pitchDelta}class hoe{constructor(d,m){this._map=d,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new W5(d),this._bearingSnap=m.bearingSnap,this._previousActiveHandlers={},this._trackingEllipsoid=new c_,this._dragOrigin=null,this._eventsInProgress={},this._addDefaultHandlers(m),i.aY(["handleEvent","handleWindowEvent"],this);const j=this._el;this._listeners=[[j,"touchstart",{passive:!0}],[j,"touchmove",{passive:!1}],[j,"touchend",void 0],[j,"touchcancel",void 0],[j,"mousedown",void 0],[j,"mousemove",void 0],[j,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[j,"mouseover",void 0],[j,"mouseout",void 0],[j,"dblclick",void 0],[j,"click",void 0],[j,"keydown",{capture:!1}],[j,"keyup",void 0],[j,"wheel",{passive:!1}],[j,"contextmenu",void 0],[window,"blur",void 0]];for(const[A,O,R]of this._listeners){const B=A===document?this.handleWindowEvent:this.handleEvent;A.addEventListener(O,B,R)}}destroy(){for(const[d,m,j]of this._listeners){const A=d===document?this.handleWindowEvent:this.handleEvent;d.removeEventListener(m,A,j)}}_addDefaultHandlers(d){const m=this._map,j=m.getCanvasContainer();this._add("mapEvent",new ON(m,d));const A=m.boxZoom=new DN(m,d);this._add("boxZoom",A);const O=new w6,R=new qN;m.doubleClickZoom=new Fp(R,O),this._add("tapZoom",O),this._add("clickZoom",R);const B=new Jo;this._add("tapDragZoom",B);const H=m.touchPitch=new loe(m);this._add("touchPitch",H);const Y=new Y5(d),te=new X5(d);m.dragRotate=new o_(d,Y,te),this._add("mouseRotate",Y,["mousePitch"]),this._add("mousePitch",te,["mouseRotate"]);const de=new k6(d),ce=new N6(m,d);m.dragPan=new Bf(j,de,ce),this._add("mousePan",de),this._add("touchPan",ce,["touchZoom","touchRotate"]);const ue=new Ui,je=new ooe;m.touchZoomRotate=new VN(j,je,ue,B),this._add("touchRotate",ue,["touchPan","touchZoom"]),this._add("touchZoom",je,["touchPan","touchRotate"]),this._add("blockableMapEvent",new K5(m));const ve=m.scrollZoom=new UN(m,this);this._add("scrollZoom",ve,["mousePan"]);const Re=m.keyboard=new doe;this._add("keyboard",Re);for(const Le of["boxZoom","doubleClickZoom","tapDragZoom","touchPitch","dragRotate","dragPan","touchZoomRotate","scrollZoom","keyboard"])d.interactive&&d[Le]&&m[Le].enable(d[Le])}_add(d,m,j){this._handlers.push({handlerName:d,handler:m,allowed:j}),this._handlersById[d]=m}stop(d){if(!this._updatingCamera){for(const{handler:m}of this._handlers)m.reset();this._inertia.clear(),this._fireEvents({},{},d),this._changes=[],this._originalZoom=void 0}}isActive(){for(const{handler:d}of this._handlers)if(d.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!l_(this._eventsInProgress)||this.isZooming()}_isDragging(){return!!this._eventsInProgress.drag}_blockedByActive(d,m,j){for(const A in d)if(A!==j&&(!m||m.indexOf(A)<0))return!0;return!1}handleWindowEvent(d){this.handleEvent(d,`${d.type}Window`)}_getMapTouches(d){const m=[];for(const j of d)this._el.contains(j.target)&&m.push(j);return m}handleEvent(d,m){this._updatingCamera=!0;const j=d.type==="renderFrame",A=j?void 0:d,O={needsRenderFrame:!1},R={},B={},H=d.touches?this._getMapTouches(d.touches):void 0,Y=H?G(this._el,H):j?void 0:W(this._el,d);for(const{handlerName:ce,handler:ue,allowed:je}of this._handlers){if(!ue.isEnabled())continue;let ve;this._blockedByActive(B,je,ce)?ue.reset():ue[m||d.type]&&(ve=ue[m||d.type](d,Y,H),this.mergeHandlerResult(O,R,ve,ce,A),ve&&ve.needsRenderFrame&&this._triggerRenderFrame()),(ve||ue.isActive())&&(B[ce]=ue)}const te={};for(const ce in this._previousActiveHandlers)B[ce]||(te[ce]=A);this._previousActiveHandlers=B,(Object.keys(te).length||HN(O))&&(this._changes.push([O,R,te]),this._triggerRenderFrame()),(Object.keys(B).length||HN(O))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:de}=O;de&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],de(this._map))}mergeHandlerResult(d,m,j,A,O){if(!j)return;Object.assign(d,j);const R={handlerName:A,originalEvent:j.originalEvent||O};j.zoomDelta!==void 0&&(m.zoom=R),j.panDelta!==void 0&&(m.drag=R),j.pitchDelta!==void 0&&(m.pitch=R),j.bearingDelta!==void 0&&(m.rotate=R)}_applyChanges(){const d={},m={},j={};for(const[A,O,R]of this._changes)A.panDelta&&(d.panDelta=(d.panDelta||new i.P(0,0))._add(A.panDelta)),A.zoomDelta&&(d.zoomDelta=(d.zoomDelta||0)+A.zoomDelta),A.bearingDelta&&(d.bearingDelta=(d.bearingDelta||0)+A.bearingDelta),A.pitchDelta&&(d.pitchDelta=(d.pitchDelta||0)+A.pitchDelta),A.around!==void 0&&(d.around=A.around),A.aroundCoord!==void 0&&(d.aroundCoord=A.aroundCoord),A.pinchAround!==void 0&&(d.pinchAround=A.pinchAround),A.noInertia&&(d.noInertia=A.noInertia),Object.assign(m,O),Object.assign(j,R);this._updateMapTransform(d,m,j),this._changes=[]}_updateMapTransform(d,m,j){const A=this._map,O=A.transform,R=We=>[We.x,We.y,We.z];if((We=>{const rt=this._eventsInProgress.drag;return rt&&!this._handlersById[rt.handlerName].isActive()})()&&!HN(d)){const We=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"),We!==O.zoom&&this._map._update(!0)}if(O._isCameraConstrained&&A._stop(!0),!HN(d))return void this._fireEvents(m,j,!0);let{panDelta:B,zoomDelta:H,bearingDelta:Y,pitchDelta:te,around:de,aroundCoord:ce,pinchAround:ue}=d;O._isCameraConstrained&&(H>0&&(H=0),O._isCameraConstrained=!1),ue!==void 0&&(de=ue),(H||(We=>m[We]&&!this._eventsInProgress[We])("drag"))&&de&&(this._dragOrigin=R(O.pointCoordinate3D(de)),this._originalZoom=O.zoom,this._trackingEllipsoid.setup(O._camera.position,this._dragOrigin)),O.cameraElevationReference="sea",A._stop(!0),de=de||A.transform.centerPoint,Y&&(O.bearing+=Y),te&&(O.pitch+=te),O._updateCameraState();const je=[0,0,0];if(B)if(O.projection.name==="mercator"){const We=this._trackingEllipsoid.projectRay(O.screenPointToMercatorRay(de).dir),rt=this._trackingEllipsoid.projectRay(O.screenPointToMercatorRay(de.sub(B)).dir);je[0]=rt[0]-We[0],je[1]=rt[1]-We[1]}else{const We=O.pointCoordinate(de);if(O.projection.name==="globe"){B=B.rotate(-O.angle);const rt=O._pixelsPerMercatorPixel/O.worldSize;je[0]=-B.x*i.eW(i.a$(We.y))*rt,je[1]=-B.y*i.eW(O.center.lat)*rt}else{const rt=O.pointCoordinate(de.sub(B));We&&rt&&(je[0]=rt.x-We.x,je[1]=rt.y-We.y)}}const ve=O.zoom,Re=[0,0,0];if(H){const We=R(ce||O.pointCoordinate3D(de)),rt={dir:i.aw([],i.av([],We,O._camera.position))};if(rt.dir[2]<0){const Ke=O.zoomDeltaToMovement(We,H);i.c5(Re,rt.dir,Ke)}}const Le=i.d8(je,je,Re);O._translateCameraConstrained(Le),H&&Math.abs(O.zoom-ve)>1e-4&&O.recenterOnTerrain(),O.cameraElevationReference="ground",this._map._update(),d.noInertia||this._inertia.record(d),this._fireEvents(m,j,!0)}_fireEvents(d,m,j){const A=l_(this._eventsInProgress),O=l_(d),R={};for(const te in d){const{originalEvent:de}=d[te];this._eventsInProgress[te]||(R[`${te}start`]=de),this._eventsInProgress[te]=d[te]}!A&&O&&this._fireEvent("movestart",O.originalEvent);for(const te in R)this._fireEvent(te,R[te]);O&&this._fireEvent("move",O.originalEvent);for(const te in d){const{originalEvent:de}=d[te];this._fireEvent(te,de)}const B={};let H;for(const te in this._eventsInProgress){const{handlerName:de,originalEvent:ce}=this._eventsInProgress[te];this._handlersById[de].isActive()||(delete this._eventsInProgress[te],H=m[de]||ce,B[`${te}end`]=H)}for(const te in B)this._fireEvent(te,B[te]);const Y=l_(this._eventsInProgress);if(j&&(A||O)&&!Y){this._updatingCamera=!0;const te=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),de=ce=>ce!==0&&-this._bearingSnap{this._frameId=void 0,this.handleEvent(new uoe("renderFrame",{timeStamp:d})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}const WN="map.setFreeCameraOptions(...) and map.getFreeCameraOptions() are not yet supported for non-mercator projections.";class eM extends i.E{constructor(d,m){super(),this._moving=!1,this._zooming=!1,this.transform=d,this._bearingSnap=m.bearingSnap,this._respectPrefersReducedMotion=m.respectPrefersReducedMotion!==!1,i.aY(["_renderFrameCallback"],this)}getCenter(){return new i.aT(this.transform.center.lng,this.transform.center.lat)}setCenter(d,m){return this.jumpTo({center:d},m)}panBy(d,m,j){return d=i.P.convert(d).mult(-1),this.panTo(this.transform.center,Object.assign({offset:d},m),j)}panTo(d,m,j){return this.easeTo(Object.assign({center:d},m),j)}getZoom(){return this.transform.zoom}setZoom(d,m){return this.jumpTo({zoom:d},m),this}zoomTo(d,m,j){return this.easeTo(Object.assign({zoom:d},m),j)}zoomIn(d,m){return this.zoomTo(this.getZoom()+1,d,m),this}zoomOut(d,m){return this.zoomTo(this.getZoom()-1,d,m),this}getBearing(){return this.transform.bearing}setBearing(d,m){return this.jumpTo({bearing:d},m),this}getPadding(){return this.transform.padding}setPadding(d,m){return this.jumpTo({padding:d},m),this}rotateTo(d,m,j){return this.easeTo(Object.assign({bearing:d},m),j)}resetNorth(d,m){return this.rotateTo(0,Object.assign({duration:1e3},d),m),this}resetNorthPitch(d,m){return this.easeTo(Object.assign({bearing:0,pitch:0,duration:1e3},d),m),this}snapToNorth(d,m){return Math.abs(this.getBearing())d.aspect?j/(2*Math.tan(.5*d.fovX)*d.aspect):A/(2*Math.tan(.5*d.fovY)*d.aspect)}_cameraForBoundsOnGlobe(d,m,j,A,O,R){const B=d.clone(),H=this._extendCameraOptions(R);B.bearing=A,B.pitch=O;const Y=i.aT.convert(m),te=i.aT.convert(j),de=.5*(Y.lat+te.lat),ce=.5*(Y.lng+te.lng),ue=i.eZ(de,ce),je=i.aw([],ue),ve=i.aw([],i.bI([],je,[0,1,0])),Re=i.bI([],ve,je),Le=[ve[0],ve[1],ve[2],0,Re[0],Re[1],Re[2],0,je[0],je[1],je[2],0,0,0,0,1],We=[ue,i.eZ(Y.lat,Y.lng),i.eZ(te.lat,Y.lng),i.eZ(te.lat,te.lng),i.eZ(Y.lat,te.lng),i.eZ(de,Y.lng),i.eZ(de,te.lng),i.eZ(Y.lat,ce),i.eZ(te.lat,ce)];let rt=i.d9.fromPoints(We.map(Ht=>[i.bJ(ve,Ht),i.bJ(Re,Ht),i.bJ(je,Ht)]));const Ke=i.af([],rt.center,Le);i.e_(Ke)===0&&i.e$(Ke,0,0,1),i.aw(Ke,Ke),i.c5(Ke,Ke,i.aD),B.center=i.f0(Ke);const wt=B.getWorldToCameraMatrix(),mt=i.bl(new Float64Array(16),wt);rt=i.d9.applyTransform(rt,i.aB([],wt,Le));const vt=this._extendAABB(rt,B,H,A);if(!vt)return void i.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");rt=vt,i.af(Ke,Ke,wt);const pt=.5*(rt.max[2]-rt.min[2]),ut=this._minimumAABBFrustumDistance(B,rt),St=i.c5([],[0,0,1],pt),Dt=i.d8(St,Ke,St),Ot=ut+(B.pitch===0?0:i.bG(Ke,Dt)),Gt=B.globeCenterInViewSpace,Zt=i.av([],Ke,[Gt[0],Gt[1],Gt[2]]);i.aw(Zt,Zt),i.c5(Zt,Zt,Ot);const ar=i.d8([],Ke,Zt);i.af(ar,ar,mt);const br=i.eM/i.aD,Ut=i.ag(ar),Tt=i.cf(Math.max(Ut*br-i.eM,Number.EPSILON),0),Jt=Math.min(B.zoomFromMercatorZAdjusted(Tt),H.maxZoom);return Jt>.5*(i.c_+i.cL)?(B.setProjection({name:"mercator"}),B.zoom=Jt,this._cameraForBounds(B,m,j,A,O,R)):{center:B.center,zoom:Jt,bearing:A,pitch:O}}_extendAABB(d,m,j,A){const O=.5*((j.padding.left||0)+(j.padding.right||0)),R=.5*((j.padding.top||0)+(j.padding.bottom||0)),B=R,H=O,Y=O,te=R,de=m.width-(H+Y),ce=m.height-(B+te),ue=i.av([],d.max,d.min),je=Math.min(de/ue[0],ce/ue[1]),ve=Math.min(m.scaleZoom(m.scale*je),j.maxZoom);if(isNaN(ve))return null;const Re=m.scale/m.zoomScale(ve),Le=new i.d9([d.min[0]-H*Re,d.min[1]-te*Re,d.min[2]],[d.max[0]+Y*Re,d.max[1]+B*Re,d.max[2]]),We=(typeof j.offset.x=="number"&&typeof j.offset.y=="number"?new i.P(j.offset.x,j.offset.y):i.P.convert(j.offset)).rotate(-i.an(A));return Le.center[0]-=We.x*Re,Le.center[1]+=We.y*Re,Le}queryTerrainElevation(d,m){const j=this.transform.elevation;return j?(m=Object.assign({},{exaggerated:!0},m),j.getAtPoint(i.ae.fromLngLat(d),null,m.exaggerated)):null}_cameraForBounds(d,m,j,A,O,R){if(d.projection.name==="globe")return this._cameraForBoundsOnGlobe(d,m,j,A,O,R);const B=d.clone(),H=this._extendCameraOptions(R);B.bearing=A,B.pitch=O;const Y=i.aT.convert(m),te=i.aT.convert(j),de=new i.aT(Y.lng,te.lat),ce=new i.aT(te.lng,Y.lat),ue=B.project(Y),je=B.project(te),ve=this.queryTerrainElevation(Y),Re=this.queryTerrainElevation(te),Le=this.queryTerrainElevation(de),We=this.queryTerrainElevation(ce),rt=[[ue.x,ue.y,Math.min(ve||0,Re||0,Le||0,We||0)],[je.x,je.y,Math.max(ve||0,Re||0,Le||0,We||0)]];let Ke=i.d9.fromPoints(rt);const wt=B.getWorldToCameraMatrix(),mt=i.bl(new Float64Array(16),wt);Ke=i.d9.applyTransform(Ke,wt);const vt=this._extendAABB(Ke,B,H,A);if(!vt)return void i.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.");Ke=vt;const pt=.5*i.av([],Ke.max,Ke.min)[2],ut=this._minimumAABBFrustumDistance(B,Ke),St=[0,0,1,0];i.aC(St,St,wt),i.f1(St,St);const Dt=i.c5([],St,ut+pt),Ot=i.d8([],Ke.center,Dt);i.af(Ke.center,Ke.center,mt),i.af(Ot,Ot,mt);const Gt=B.unproject(new i.P(Ke.center[0],Ke.center[1])),Zt=i.f2(B.projection,Gt),ar=Math.pow(2,Zt),br=Math.min(B._zoomFromMercatorZ(Ot[2]*B.pixelsPerMeter*ar/B.worldSize),H.maxZoom);return B.mercatorFromTransition&&br<.5*(i.c_+i.cL)?(B.setProjection({name:"globe"}),B.zoom=br,this._cameraForBounds(B,m,j,A,O,R)):{center:Gt,zoom:br,bearing:A,pitch:O}}fitBounds(d,m,j){const A=this.cameraForBounds(d,m);return this._fitInternal(A,m,j)}fitScreenCoordinates(d,m,j,A,O){const R=i.P.convert(d),B=i.P.convert(m),H=new i.P(Math.min(R.x,B.x),Math.min(R.y,B.y)),Y=new i.P(Math.max(R.x,B.x),Math.max(R.y,B.y));if(this.transform.projection.name==="mercator"&&this.transform.anyCornerOffEdge(R,B))return this;const te=this.transform.pointLocation3D(H),de=this.transform.pointLocation3D(Y),ce=this.transform.pointLocation3D(new i.P(H.x,Y.y)),ue=this.transform.pointLocation3D(new i.P(Y.x,H.y)),je=[Math.min(te.lng,de.lng,ce.lng,ue.lng),Math.min(te.lat,de.lat,ce.lat,ue.lat)],ve=[Math.max(te.lng,de.lng,ce.lng,ue.lng),Math.max(te.lat,de.lat,ce.lat,ue.lat)],Re=A&&A.pitch?A.pitch:this.getPitch(),Le=this._cameraForBounds(this.transform,je,ve,j,Re,A);return this._fitInternal(Le,A,O)}_fitInternal(d,m,j){return d?(m=Object.assign(d,m)).linear?this.easeTo(m,j):this.flyTo(m,j):this}jumpTo(d,m){this.stop();const j=d.preloadOnly?this.transform.clone():this.transform;let A=!1,O=!1,R=!1;"zoom"in d&&j.zoom!==+d.zoom&&(A=!0,j.zoom=+d.zoom),d.center!==void 0&&(j.center=i.aT.convert(d.center)),"bearing"in d&&j.bearing!==+d.bearing&&(O=!0,j.bearing=+d.bearing),"pitch"in d&&j.pitch!==+d.pitch&&(R=!0,j.pitch=+d.pitch);const B=typeof d.padding=="number"?this._extendPadding(d.padding):d.padding;if(d.padding!=null&&!j.isPaddingEqual(B))if(d.retainPadding===!1){const H=j.clone();H.padding=B,j.setLocationAtPoint(j.center,H.centerPoint)}else j.padding=B;return d.preloadOnly?(this._preloadTiles(j),this):(this.fire(new i.z("movestart",m)).fire(new i.z("move",m)),A&&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)),R&&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(WN),this.transform.getFreeCameraOptions()}setFreeCameraOptions(d,m){const j=this.transform;if(!j.projection.supportsFreeCamera)return i.w(WN),this;this.stop();const A=j.zoom,O=j.pitch,R=j.bearing;j.setFreeCameraOptions(d);const B=A!==j.zoom,H=O!==j.pitch,Y=R!==j.bearing;return this.fire(new i.z("movestart",m)).fire(new i.z("move",m)),B&&this.fire(new i.z("zoomstart",m)).fire(new i.z("zoom",m)).fire(new i.z("zoomend",m)),Y&&this.fire(new i.z("rotatestart",m)).fire(new i.z("rotate",m)).fire(new i.z("rotateend",m)),H&&this.fire(new i.z("pitchstart",m)).fire(new i.z("pitch",m)).fire(new i.z("pitchend",m)),this.fire(new i.z("moveend",m)),this}easeTo(d,m){this._stop(!1,d.easeId),((d=Object.assign({offset:[0,0],duration:500,easing:i.eV},d)).animate===!1||this._prefersReducedMotion(d))&&(d.duration=0);const j=this.transform,A=this.getZoom(),O=this.getBearing(),R=this.getPitch(),B=this.getPadding(),H="zoom"in d?+d.zoom:A,Y="bearing"in d?this._normalizeBearing(d.bearing,O):O,te="pitch"in d?+d.pitch:R,de=this._extendPadding(d.padding),ce=i.P.convert(d.offset);let ue,je,ve;if(j.projection.name==="globe"){const St=i.ae.fromLngLat(j.center),Dt=ce.rotate(-j.angle);St.x+=Dt.x/j.worldSize,St.y+=Dt.y/j.worldSize;const Ot=St.toLngLat(),Gt=i.aT.convert(d.center||Ot);this._normalizeCenter(Gt),ue=j.centerPoint.add(Dt),je=new i.P(St.x,St.y).mult(j.worldSize),ve=new i.P(i.aF(Gt.lng),i.aJ(Gt.lat)).mult(j.worldSize).sub(je)}else{ue=j.centerPoint.add(ce);const St=j.pointLocation(ue),Dt=i.aT.convert(d.center||St);this._normalizeCenter(Dt),je=j.project(St),ve=j.project(Dt).sub(je)}const Re=j.zoomScale(H-A);let Le,We;d.around&&(Le=i.aT.convert(d.around),We=j.locationPoint(Le));const rt=this._zooming||H!==A,Ke=this._rotating||O!==Y,wt=this._pitching||te!==R,mt=!j.isPaddingEqual(de),vt=d.retainPadding===!1?j.clone():j,pt=St=>Dt=>{if(rt&&(St.zoom=i.ak(A,H,Dt)),Ke&&(St.bearing=i.ak(O,Y,Dt)),wt&&(St.pitch=i.ak(R,te,Dt)),mt&&(vt.interpolatePadding(B,de,Dt),ue=vt.centerPoint.add(ce)),Le)St.setLocationAtPoint(Le,We);else{const Ot=St.zoomScale(St.zoom-A),Gt=H>A?Math.min(2,Re):Math.max(.5,Re),Zt=Math.pow(Gt,1-Dt),ar=St.unproject(je.add(ve.mult(Dt*Zt)).mult(Ot));St.setLocationAtPoint(St.renderWorldCopies?ar.wrap():ar,ue)}return d.preloadOnly||this._fireMoveEvents(m),St};if(d.preloadOnly){const St=this._emulate(pt,d.duration,j);return this._preloadTiles(St),this}const ut={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching};return this._zooming=rt,this._rotating=Ke,this._pitching=wt,this._padding=mt,this._easeId=d.easeId,this._prepareEase(m,d.noMoveStart,ut),this._ease(pt(j),St=>{j.cameraElevationReference==="sea"&&j.recenterOnTerrain(),this._afterEase(m,St)},d),this}_prepareEase(d,m,j={}){this._moving=!0,this.transform.cameraElevationReference="sea",this.transform._orthographicProjectionAtLowPitch&&this.transform.pitch===0&&this.transform.projection.name!=="globe"&&(this.transform.cameraElevationReference="ground"),m||j.moving||this.fire(new i.z("movestart",d)),this._zooming&&!j.zooming&&this.fire(new i.z("zoomstart",d)),this._rotating&&!j.rotating&&this.fire(new i.z("rotatestart",d)),this._pitching&&!j.pitching&&this.fire(new i.z("pitchstart",d))}_fireMoveEvents(d){this.fire(new i.z("move",d)),this._zooming&&this.fire(new i.z("zoom",d)),this._rotating&&this.fire(new i.z("rotate",d)),this._pitching&&this.fire(new i.z("pitch",d))}_afterEase(d,m){if(this._easeId&&m&&this._easeId===m)return;this._easeId=void 0,this.transform.cameraElevationReference="ground";const j=this._zooming,A=this._rotating,O=this._pitching;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._padding=!1,j&&this.fire(new i.z("zoomend",d)),A&&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 Ht=i.aH(d,["center","zoom","bearing","pitch","around","padding","retainPadding"]);return this.jumpTo(Ht,m)}this.stop(),d=Object.assign({offset:[0,0],speed:1.2,curve:1.42,easing:i.eV},d);const j=this.transform,A=this.getZoom(),O=this.getBearing(),R=this.getPitch(),B=this.getPadding(),H="zoom"in d?i.aA(+d.zoom,j.minZoom,j.maxZoom):A,Y="bearing"in d?this._normalizeBearing(d.bearing,O):O,te="pitch"in d?+d.pitch:R,de=this._extendPadding(d.padding),ce=j.zoomScale(H-A),ue=i.P.convert(d.offset);let je=j.centerPoint.add(ue);const ve=j.pointLocation(je),Re=i.aT.convert(d.center||ve);this._normalizeCenter(Re);const Le=j.project(ve),We=j.project(Re).sub(Le);let rt=d.curve;const Ke=Math.max(j.width,j.height),wt=Ke/ce,mt=We.mag();if("minZoom"in d){const Ht=i.aA(Math.min(d.minZoom,A,H),j.minZoom,j.maxZoom),hr=Ke/j.zoomScale(Ht-A);rt=Math.sqrt(hr/mt*2)}const vt=rt*rt;function pt(Ht){const hr=(wt*wt-Ke*Ke+(Ht?-1:1)*vt*vt*mt*mt)/(2*(Ht?wt:Ke)*vt*mt);return Math.log(Math.sqrt(hr*hr+1)-hr)}function ut(Ht){return(Math.exp(Ht)-Math.exp(-Ht))/2}function St(Ht){return(Math.exp(Ht)+Math.exp(-Ht))/2}const Dt=pt(0);let Ot=function(Ht){return St(Dt)/St(Dt+rt*Ht)},Gt=function(Ht){return Ke*((St(Dt)*(ut(hr=Dt+rt*Ht)/St(hr))-ut(Dt))/vt)/mt;var hr},Zt=(pt(1)-Dt)/rt;if(Math.abs(mt)<1e-6||!isFinite(Zt)){if(Math.abs(Ke-wt)<1e-6)return this.easeTo(d,m);const Ht=wtd.maxDuration&&(d.duration=0);const ar=O!==Y,br=te!==R,Ut=!j.isPaddingEqual(de),Tt=d.retainPadding===!1?j.clone():j,Jt=Ht=>hr=>{const Ar=hr*Zt,Kr=1/Ot(Ar);Ht.zoom=hr===1?H:A+Ht.scaleZoom(Kr),ar&&(Ht.bearing=i.ak(O,Y,hr)),br&&(Ht.pitch=i.ak(R,te,hr)),Ut&&(Tt.interpolatePadding(B,de,hr),je=Tt.centerPoint.add(ue));const Sr=hr===1?Re:Ht.unproject(Le.add(We.mult(Gt(Ar))).mult(Kr));return Ht.setLocationAtPoint(Ht.renderWorldCopies?Sr.wrap():Sr,je),Ht._updateCameraOnTerrain(),d.preloadOnly||this._fireMoveEvents(m),Ht};if(d.preloadOnly){const Ht=this._emulate(Jt,d.duration,j);return this._preloadTiles(Ht),this}return this._zooming=!0,this._rotating=ar,this._pitching=br,this._padding=Ut,this._prepareEase(m,!1),this._ease(Jt(j),()=>this._afterEase(m),d),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_requestRenderFrame(d){}_cancelRenderFrame(d){}_stop(d,m){if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),this._easeFrameId=void 0,this._onEaseFrame=void 0),this._onEaseEnd){const j=this._onEaseEnd;this._onEaseEnd=void 0,j.call(this,m)}if(!d){const j=this.handlers;j&&j.stop(!1)}return this}_ease(d,m,j){j.animate===!1||j.duration===0?(d(1),m()):(this._easeStart=i.o.now(),this._easeOptions=j,this._onEaseFrame=d,this._onEaseEnd=m,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_renderFrameCallback(){const d=Math.min((i.o.now()-this._easeStart)/this._easeOptions.duration,1),m=this._onEaseFrame;m&&m(this._easeOptions.easing(d)),d<1?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()}_normalizeBearing(d,m){d=i.bT(d,-180,180);const j=Math.abs(d-m);return Math.abs(d-360-m)180?-360:j<-180?360:0}_prefersReducedMotion(d){return this._respectPrefersReducedMotion&&i.o.prefersReducedMotion&&!(d&&d.essential)}_emulate(d,m,j){const A=Math.ceil(15*m/1e3),O=[],R=d(j.clone());for(let B=0;B<=A;B++){const H=R(B/A);O.push(H.clone())}return O}_preloadTiles(d,m){}}class d_{constructor(d={}){this.options=d,i.aY(["_toggleAttribution","_updateEditLink","_updateData","_updateCompact"],this)}getDefaultPosition(){return"bottom-right"}onAdd(d){const m=this.options&&this.options.compact,j=d._getUIString("AttributionControl.ToggleAttribution");this._map=d,this._container=k("div","mapboxgl-ctrl mapboxgl-ctrl-attrib"),this._compactButton=k("button","mapboxgl-ctrl-attrib-button",this._container),this._compactButton.type="button",this._compactButton.addEventListener("click",this._toggleAttribution),this._compactButton.setAttribute("aria-label",j);const A=k("span","mapboxgl-ctrl-icon",this._compactButton);return A.setAttribute("aria-hidden","true"),A.setAttribute("title",j),this._innerContainer=k("div","mapboxgl-ctrl-attrib-inner",this._container),m&&this._container.classList.add("mapboxgl-compact"),this._updateAttributions(),this._updateEditLink(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("moveend",this._updateEditLink),m===void 0&&(this._map.on("resize",this._updateCompact),this._updateCompact()),this._container}onRemove(){this._container.remove(),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("moveend",this._updateEditLink),this._map.off("resize",this._updateCompact),this._map=void 0,this._attribHTML=void 0}_toggleAttribution(){this._container.classList.contains("mapboxgl-compact-show")?(this._container.classList.remove("mapboxgl-compact-show"),this._compactButton.setAttribute("aria-expanded","false")):(this._container.classList.add("mapboxgl-compact-show"),this._compactButton.setAttribute("aria-expanded","true"))}_updateEditLink(){let d=this._editLink;d||(d=this._editLink=this._container.querySelector(".mapbox-improve-map"));const m=[{key:"owner",value:this.styleOwner},{key:"id",value:this.styleId},{key:"access_token",value:this._map._requestManager._customAccessToken||i.e.ACCESS_TOKEN}];if(d){const j=m.reduce((A,O,R)=>(O.value&&(A+=`${O.key}=${O.value}${RA.length-O.length),d=d.filter((A,O)=>{for(let R=O+1;R=0)return!1;return!0}),this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?d=[...this.options.customAttribution,...d]:d.unshift(this.options.customAttribution));const j=d.map(A=>function(O){const R=new DOMParser().parseFromString(O,"text/html");return Array.from(R.body.querySelectorAll("*")).forEach(B=>{const H=B.textContent||"";if(B.tagName!=="A")return void B.replaceWith(R.createTextNode(H));const Y=B.getAttribute("href");if(!Y||!/^(https?:|mailto:)/i.test(Y))return void B.replaceWith(R.createTextNode(H));const te=R.createElement("a");te.href=Y,te.textContent=H,te.rel="noopener nofollow";const de=B.getAttribute("class");de&&(te.className=de),B.replaceWith(te)}),R.body.innerHTML}(A)).join(" | ");j!==this._attribHTML&&(this._attribHTML=j,d.length?(this._innerContainer.innerHTML=j,this._container.classList.remove("mapboxgl-attrib-empty")):this._container.classList.add("mapboxgl-attrib-empty"),this._editLink=null)}_updateCompact(){this._map.getCanvasContainer().offsetWidth<=640?this._container.classList.add("mapboxgl-compact"):this._container.classList.remove("mapboxgl-compact","mapboxgl-compact-show")}}class u_{constructor(){i.aY(["_updateLogo","_updateCompact"],this)}onAdd(d){this._map=d,this._container=k("div","mapboxgl-ctrl");const m=k("a","mapboxgl-ctrl-logo");return m.target="_blank",m.rel="noopener nofollow",m.href="https://www.mapbox.com/",m.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),m.setAttribute("rel","noopener nofollow"),this._container.appendChild(m),this._container.style.display="none",this._map.on("sourcedata",this._updateLogo),this._updateLogo(),this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){this._container.remove(),this._map.off("sourcedata",this._updateLogo),this._map.off("resize",this._updateCompact)}getDefaultPosition(){return"bottom-left"}_updateLogo(d){d&&d.sourceDataType!=="metadata"||(this._container.style.display=this._logoRequired()?"block":"none")}_logoRequired(){if(!this._map.style)return!0;const d=this._map.style._sourceCaches;if(Object.entries(d).length===0)return!0;for(const m in d){const j=d[m].getSource();if(j.hasOwnProperty("mapbox_logo")&&!j.mapbox_logo)return!1}return!0}_updateCompact(){const d=this._container.children;if(d.length){const m=d[0];this._map.getCanvasContainer().offsetWidth<250?m.classList.add("mapboxgl-compact"):m.classList.remove("mapboxgl-compact")}}}class _0{constructor(){i.aY(["_onIndoorUpdate"],this)}onAdd(d){return this._map=d,this._container=k("div","mapboxgl-ctrl mapboxgl-ctrl-group"),this._map.indoor.on("selector-update",m=>this._onIndoorUpdate(m)),this._container}_createButton(d,m){const j=k("button",d,this._container);return j.type="button",j.addEventListener("click",m),j}_createSeparator(){return k("div","mapboxgl-ctrl-separator",this._container)}_setButtonTitle(d,m){this._map&&(d.setAttribute("aria-label",m),d.textContent=m)}onRemove(){this._container&&this._container.remove(),this._map&&this._map.indoor&&(this._map.indoor.off("selector-update",this._onIndoorUpdate),this._map=null)}getDefaultPosition(){return"right"}_onIndoorUpdate(d){if(!d||!d.floors)return this._model=d,void(this._container.style.display="none");const m=this._model;this._model=d,this._container.style.display="inline-block",this._container.style.borderRadius="8px",m&&Array.from(this._container.children).forEach(j=>j.remove()),d.floors.length>0&&(this.addBuildingsToggleButton(),this.addCurrentFloors(d.floors,d.activeFloorsVisible),this._updateBuildingsButtonState())}addBuildingsToggleButton(){const d=this._createButton("mapboxgl-ctrl-buildings-toggle",()=>{const m=this._map;this._model&&m&&m._setIndoorActiveFloorsVisibility(!this._model.activeFloorsVisible)});k("span","mapboxgl-ctrl-icon",d).setAttribute("aria-hidden","true"),d.classList.add("mapboxgl-ctrl-level-button","mapboxgl-ctrl-buildings-toggle"),this._model&&!this._model.activeFloorsVisible&&d.classList.add("mapboxgl-ctrl-level-button-selected"),this._container.append(d),this._createSeparator()}_updateBuildingsButtonState(){const d=this._container.querySelector(".mapboxgl-ctrl-buildings-toggle");d&&this._model&&(this._model.activeFloorsVisible?d.classList.remove("mapboxgl-ctrl-level-button-selected"):d.classList.add("mapboxgl-ctrl-level-button-selected"))}addCurrentFloors(d,m){for(let j=0;j{this._map._selectIndoorFloor(A.id)});this._setButtonTitle(O,A.zIndex.toString()),this._model&&A.id===this._model.selectedFloorId&&m&&O.classList.add("mapboxgl-ctrl-level-button-selected"),this._container.append(O),j=this._endTime)return this._end;const m=i.dD((d-this._startTime)/(this._endTime-this._startTime));return this._start*(1-m)+this._end*m}isEasing(d){return d>=this._startTime&&d<=this._endTime}jumpTo(d){this._startTime=-1/0,this._endTime=-1/0,this._start=d,this._end=d}easeTo(d,m,j){this._start=this.getValue(m),this._end=d,this._startTime=m,this._endTime=m+j}}const $p={"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 lg extends i.z{constructor(d,m,j,A){const{point:O,lngLat:R,originalEvent:B,target:H}=d;super(d.type,{point:O,lngLat:R,originalEvent:B,target:H}),this.preventDefault=()=>{d.preventDefault()},this.id=m,this.interaction=j,this.feature=A}}class Gh{constructor(d){this.map=d,this.interactionsByType=new Map,this.delegatedInteractions=new Map,this.typeById=new Map,this.filters=new Map,this.handleType=this.handleType.bind(this),this.handleMove=this.handleMove.bind(this),this.handleOut=this.handleOut.bind(this),this.hoveredFeatures=new Map,this.prevHoveredFeatures=new Map}add(d,m){if(this.typeById.has(d))throw new Error(`Interaction id "${d}" already exists.`);const j=m.filter;let A=m.type;j&&this.filters.set(d,i.b6(j)),A==="mouseover"&&(A="mouseenter"),A==="mouseout"&&(A="mouseleave");const O=this.interactionsByType.get(A)||new Map;A==="mouseenter"||A==="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(A,this.handleType),O.size===0&&this.interactionsByType.set(A,O),O.set(d,m),this.typeById.set(d,A)}get(d){const m=this.typeById.get(d);if(!m)return;const j=this.interactionsByType.get(m);return j?j.get(d):void 0}remove(d){const m=this.typeById.get(d);if(!m)return;this.typeById.delete(d),this.filters.delete(d);const j=this.interactionsByType.get(m);j&&(j.delete(d),m==="mouseenter"||m==="mouseleave"?(this.delegatedInteractions.delete(d),this.delegatedInteractions.size===0&&(this.map.off("mousemove",this.handleMove),this.map.off("mouseout",this.handleOut))):j.size===0&&this.map.off(m,this.handleType))}queryTargets(d,m){const j=[];for(const[A,O]of m)O.target&&j.push({targetId:A,target:O.target,filter:this.filters.get(A)});return this.map.style.queryRenderedTargets(d,j,this.map.transform)}handleMove(d){this.prevHoveredFeatures=this.hoveredFeatures,this.hoveredFeatures=new Map;const m=this.queryTargets(d.point,Array.from(this.delegatedInteractions).reverse());m.length&&(d.type="mouseenter",this.handleType(d,m));const j=new Map;for(const[A,{feature:O}]of this.prevHoveredFeatures)this.hoveredFeatures.has(A)||j.set(O.id,O);j.size&&(d.type="mouseleave",this.handleType(d,Array.from(j.values())))}handleOut(d){const m=Array.from(this.hoveredFeatures.values()).map(({feature:j})=>j);m.length&&(d.type="mouseleave",this.handleType(d,m)),this.hoveredFeatures.clear()}handleType(d,m){const j=d.type==="mouseenter";if(j&&!this.interactionsByType.has(d.type))return void i.w("mouseenter interaction required for mouseleave to work.");const A=Array.from(this.interactionsByType.get(d.type)).reverse(),O=!!m;m=m||this.queryTargets(d.point,A);let R=!1;const B=new Set;for(const H of m){for(const[Y,te]of A){if(!te.target)continue;const de=H.variants?H.variants[Y]:null;if(de){for(const ce of de){if(Wm(ce,H,B,Y))continue;const ue=new i.dx(H,ce),je=Sp(ce,H,Y);O&&ue.id!==void 0&&(ue.state=this.map.getFeatureState(ue));const ve=j?this.prevHoveredFeatures.get(je):null,Re=new lg(d,Y,te,ue),Le=ve?ve.stop:te.handler(Re);if(j&&this.hoveredFeatures.set(je,{feature:H,stop:Le}),Le!==!1){R=!0;break}}if(R)break}}if(R)break}if(!R)for(const[H,Y]of A){const{handler:te,target:de}=Y;if(!de&&te(new lg(d,H,Y,null))!==!1)break}}}function foe(w,d){if(Array.isArray(w)&&Array.isArray(d)){const m=new Set(w),j=new Set(d);return m.size===j.size&&w.every(A=>j.has(A))}return i.by(w,d)}const poe={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"},moe={showCompass:!0,showZoom:!0,visualizePitch:!1};class goe{constructor(d,m,j=!1){this._clickTolerance=10,this.element=m,this.mouseRotate=new Y5({clickTolerance:d.dragRotate._mouseRotate._clickTolerance}),this.map=d,j&&(this.mousePitch=new X5({clickTolerance:d.dragRotate._mousePitch._clickTolerance})),i.aY(["mousedown","mousemove","mouseup","touchstart","touchmove","touchend","reset"],this),m.addEventListener("mousedown",this.mousedown),m.addEventListener("touchstart",this.touchstart,{passive:!1}),m.addEventListener("touchmove",this.touchmove),m.addEventListener("touchend",this.touchend),m.addEventListener("touchcancel",this.reset)}down(d,m){this.mouseRotate.mousedown(d,m),this.mousePitch&&this.mousePitch.mousedown(d,m),z()}move(d,m){const j=this.map,A=this.mouseRotate.mousemoveWindow(d,m),O=A&&A.bearingDelta;if(O&&j.setBearing(j.getBearing()+O),this.mousePitch){const R=this.mousePitch.mousemoveWindow(d,m),B=R&&R.pitchDelta;B&&j.setPitch(j.getPitch()+B)}}off(){const d=this.element;d.removeEventListener("mousedown",this.mousedown),d.removeEventListener("touchstart",this.touchstart),d.removeEventListener("touchmove",this.touchmove),d.removeEventListener("touchend",this.touchend),d.removeEventListener("touchcancel",this.reset),this.offTemp()}offTemp(){D(),window.removeEventListener("mousemove",this.mousemove),window.removeEventListener("mouseup",this.mouseup)}mousedown(d){this.down(Object.assign({},d,{ctrlKey:!0,preventDefault:()=>d.preventDefault()}),W(this.element,d)),window.addEventListener("mousemove",this.mousemove),window.addEventListener("mouseup",this.mouseup)}mousemove(d){this.move(d,W(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(j).distSqr(d)180;){const j=m.locationPoint3D(w);if(j.x>=0&&j.y>=0&&j.x<=m.width&&j.y<=m.height)break;w.lng>m.center.lng?w.lng-=360:w.lng+=360}return w}const Ec={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%)"},uh={rotation:0,rotationAlignment:"auto",pitchAlignment:"auto",occludedOpacity:.2,altitude:0};class GN extends i.E{constructor(d,m){super(),(d instanceof HTMLElement||m)&&(d=Object.assign({element:d},m)),i.aY(["_update","_onMove","_onUp","_addDragHandler","_onMapClick","_onKeyPress","_clearFadeTimer"],this);const{anchor:j="center",color:A="#3FB1CE",scale:O=1,draggable:R=!1,clickTolerance:B=0,rotation:H=uh.rotation,rotationAlignment:Y=uh.rotationAlignment,pitchAlignment:te=uh.pitchAlignment,occludedOpacity:de=uh.occludedOpacity,altitude:ce=uh.altitude}=d||{};this._anchor=j,this._color=A,this._scale=O,this._draggable=R,this._clickTolerance=B,this._rotation=H,this._rotationAlignment=Y,this._pitchAlignment=te,this._occludedOpacity=de,this._altitude=ce,this._state="inactive",this._isDragging=!1,this._updateMoving=()=>this._update(!0),d&&d.element?(this._element=d.element,this._offset=i.P.convert(d&&d.offset||[0,0])):(this._defaultMarker=!0,this._element=this._createDefaultMarker(),this._offset=i.P.convert(d&&d.offset||[0,-14])),this._element.hasAttribute("aria-label")||this._element.setAttribute("aria-label","Map marker"),this._element.hasAttribute("role")||this._element.setAttribute("role","img"),this._element.classList.add("mapboxgl-marker"),this._element.addEventListener("dragstart",ve=>{ve.preventDefault()}),this._element.addEventListener("mousedown",ve=>{ve.preventDefault()});const ue=this._element.classList;for(const ve in Ec)ue.remove(`mapboxgl-marker-anchor-${ve}`);ue.add(`mapboxgl-marker-anchor-${this._anchor}`);const je=d&&d.className?d.className.trim().split(/\s+/):[];ue.add(...je),this._popup=null}_createDefaultMarker(){const d=k("div"),m=M("svg",{display:"block",height:41*this._scale+"px",width:27*this._scale+"px",viewBox:"0 0 27 41"},d);if(this._altitude===0){const j=M("radialGradient",{id:"shadowGradient"},M("defs",{},m));M("stop",{offset:"10%","stop-opacity":.4},j),M("stop",{offset:"100%","stop-opacity":.05},j),M("ellipse",{cx:13.5,cy:34.8,rx:10.5,ry:5.25,fill:"url(#shadowGradient)"},m)}return M("path",{fill:this._color,d:"M27,13.5C27,19.07 20.25,27 14.75,34.5C14.02,35.5 12.98,35.5 12.25,34.5C6.75,27 0,19.22 0,13.5C0,6.04 6.04,0 13.5,0C20.96,0 27,6.04 27,13.5Z"},m),M("path",{opacity:.25,d:"M13.5,0C6.04,0 0,6.04 0,13.5C0,19.22 6.75,27 12.25,34.5C13,35.52 14.02,35.5 14.75,34.5C20.25,27 27,19.07 27,13.5C27,6.04 20.96,0 13.5,0ZM13.5,1C20.42,1 26,6.58 26,13.5C26,15.9 24.5,19.18 22.22,22.74C19.95,26.3 16.71,30.14 13.94,33.91C13.74,34.18 13.61,34.32 13.5,34.44C13.39,34.32 13.26,34.18 13.06,33.91C10.28,30.13 7.41,26.31 5.02,22.77C2.62,19.23 1,15.95 1,13.5C1,6.58 6.58,1 13.5,1Z"},m),M("circle",{fill:"white",cx:13.5,cy:13.5,r:5.5},m),d}addTo(d){return d===this._map||(this.remove(),this._map=d,d.getCanvasContainer().appendChild(this._element),d.on("move",this._updateMoving),d.on("moveend",this._update),d.on("remove",this._clearFadeTimer),d._addMarker(this),this.setDraggable(this._draggable),this._update(),d.on("click",this._onMapClick)),this}remove(){const d=this._map;return d&&(d.off("click",this._onMapClick),d.off("move",this._updateMoving),d.off("moveend",this._update),d.off("mousedown",this._addDragHandler),d.off("touchstart",this._addDragHandler),d.off("mouseup",this._onUp),d.off("touchend",this._onUp),d.off("mousemove",this._onMove),d.off("touchmove",this._onMove),d.off("remove",this._clearFadeTimer),d._removeMarker(this),this._map=void 0),this._clearFadeTimer(),this._element.remove(),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(d){return this._lngLat=i.aT.convert(d),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(!0),this}setAltitude(d){return d===this._altitude||(this._defaultMarker&&(this._altitude===0&&d!==0||this._altitude!==0&&d===0)&&(this._element=this._createDefaultMarker()),this._altitude=d||uh.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 A=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":[A,-1*(38.1-13.5+A)],"bottom-right":[-A,-1*(38.1-13.5+A)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=d,d._marker=this,d._altitude=this._altitude,this._lngLat&&this._popup.setLngLat(this._lngLat),this._element.setAttribute("role","button"),this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress),this._element.setAttribute("aria-expanded","false")}return this}_onKeyPress(d){const m=d.code,j=d.charCode||d.keyCode;m!=="Space"&&m!=="Enter"&&j!==32&&j!==13||this.togglePopup()}_onMapClick(d){const m=d.originalEvent.target,j=this._element;this._popup&&(m===j||j.contains(m))&&this.togglePopup()}getPopup(){return this._popup}togglePopup(){const d=this._popup;return d?(d.isOpen()?(d.remove(),this._element.setAttribute("aria-expanded","false")):this._map&&(d.addTo(this._map),this._element.setAttribute("aria-expanded","true")),this):this}_behindTerrain(){const d=this._map,m=this._pos;if(!d||!m)return!1;const j=d.unproject(m,this._altitude),A=d.getFreeCameraOptions();if(!A.position)return!1;const O=A.position.toLngLat();return O.distanceTo(j)<.9*O.distanceTo(this._lngLat)}_evaluateOpacity(){const d=this._map;if(!d)return;const m=this._pos;if(!m||m.x<0||m.x>d.transform.width||m.y<0||m.y>d.transform.height)return void this._clearFadeTimer();const j=d.unproject(m,this._altitude);let A;d._showingGlobe()&&i.f5(d.transform,this._lngLat)?A=0:(A=1-d._queryFogOpacity(j),d.transform._terrainEnabled()&&d.getTerrain()&&this._behindTerrain()&&(A*=this._occludedOpacity)),this._element.style.opacity=`${A}`,this._element.style.pointerEvents=A>0?"auto":"none",this._popup&&this._popup._setOpacity(A),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) ${Ec[this._anchor]} ${this._calculateXYTransform()} ${this._calculateZTransform()} translate(${m.x}px,${m.y}px) `}_calculateXYTransform(){const d=this._pos,m=this._map,j=this.getPitchAlignment();if(!m||!d||j!=="map")return"";if(!m._showingGlobe()){const H=m.getPitch();return H?`rotateX(${H}deg)`:""}const A=i.cX(i.f6(m.transform,this._lngLat)),O=d.sub(i.f7(m.transform)),R=Math.abs(O.x)+Math.abs(O.y);if(R===0)return"";const B=A/R;return`rotateX(${-O.y*B}deg) rotateY(${O.x*B}deg)`}_calculateZTransform(){const d=this._pos,m=this._map;if(!m||!d)return"";let j=0;const A=this.getRotationAlignment();if(A==="map")if(m._showingGlobe()){const O=m.project(new i.aT(this._lngLat.lng,this._lngLat.lat+.001),this._altitude),R=m.project(new i.aT(this._lngLat.lng,this._lngLat.lat-.001),this._altitude).sub(O);j=i.cX(Math.atan2(R.y,R.x))-90}else j=-m.getBearing();else if(A==="horizon"){const O=i.ah(4,6,m.getZoom()),R=i.f7(m.transform);R.y+=O*m.transform.height;const B=d.sub(R),H=i.cX(Math.atan2(B.y,B.x));j=(H>90?H-270:H+90)*(1-O)}return j+=this._rotation,j?`rotateZ(${j}deg)`:""}_update(d){cancelAnimationFrame(this._updateFrameId);const m=this._map;m&&(m.transform.renderWorldCopies&&(this._lngLat=tM(this._lngLat,this._pos,m.transform)),this._pos=m.project(this._lngLat,this._altitude),d===!0?this._updateFrameId=requestAnimationFrame(()=>{this._element&&this._pos&&this._anchor&&(this._pos=this._pos.round(),this._updateDOM())}):this._pos=this._pos.round(),m._requestDomTask(()=>{this._map&&(this._element&&this._pos&&this._anchor&&this._updateDOM(),(m._showingGlobe()||m.getTerrain()||m.getFog())&&!this._fadeTimer&&(this._fadeTimer=window.setTimeout(this._evaluateOpacity.bind(this),60)))}))}getOffset(){return this._offset}setOffset(d){return this._offset=i.P.convert(d),this._update(),this}addClassName(d){return this._element.classList.add(d),this}removeClassName(d){return this._element.classList.remove(d),this}toggleClassName(d){return this._element.classList.toggle(d)}_onMove(d){const m=this._map;if(!m)return;const j=this._pointerdownPos,A=this._positionDelta;if(j&&A){if(!this._isDragging){const O=this._clickTolerance||m._clickTolerance;if(d.point.dist(j)w.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(w.minPitch!=null&&w.maxPitch!=null&&w.minPitch>w.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(w.minPitch!=null&&w.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(w.maxPitch!=null&&w.maxPitch>85)throw new Error("maxPitch must be less than or equal to 85");if(w.antialias&&i.f3(window)&&(w.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 a5(w.minZoom,w.maxZoom,w.minPitch,w.maxPitch,w.renderWorldCopies,null,null),w),this._repaint=!!w.repaint,this._interactive=w.interactive,this._minTileCacheSize=w.minTileCacheSize,this._maxTileCacheSize=w.maxTileCacheSize,this._failIfMajorPerformanceCaveat=w.failIfMajorPerformanceCaveat,this._preserveDrawingBuffer=w.preserveDrawingBuffer,this._antialias=w.antialias,this._trackResize=w.trackResize,this._bearingSnap=w.bearingSnap,this._refreshExpiredTiles=w.refreshExpiredTiles,this._fadeDuration=w.fadeDuration,this._isInitialLoad=!0,this._crossSourceCollisions=w.crossSourceCollisions,this._collectResourceTiming=w.collectResourceTiming,this._language=this._parseLanguage(w.language),this._worldview=w.worldview,this._renderTaskQueue=new zp,this._domRenderTaskQueue=new zp,this._controls=[],this._markers=[],this._popups=[],this._mapId=i.b2(),this._locale=Object.assign({},$p,w.locale),this._clickTolerance=w.clickTolerance,this._cooperativeGestures=w.cooperativeGestures,this._performanceMetricsCollection=w.performanceMetricsCollection,this._tessellationStep=w.tessellationStep,this._containerWidth=0,this._containerHeight=0,this._showParseStatus=!0,this._precompilePrograms=w.precompilePrograms,this._scaleFactorChanged=!1,this._averageElevationLastSampledAt=-1/0,this._averageElevationExaggeration=0,this._averageElevation=new Bp(0),this._interactionRange=[1/0,-1/0],this._visibilityHidden=0,this._useExplicitProjection=!1,this._frameId=0,this._scaleFactor=w.scaleFactor,this._requestManager=new ie(w.transformRequest,w.accessToken,w.testMode),this._silenceAuthErrors=!!w.testMode,this._contextCreateOptions=w.contextCreateOptions?Object.assign({},w.contextCreateOptions):{},typeof w.container=="string"){const m=document.getElementById(w.container);if(!m)throw new Error(`Container '${w.container.toString()}' not found.`);this._container=m}else{if(!(w.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=w.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."),w.maxBounds&&this.setMaxBounds(w.maxBounds),this._spriteFormat=w.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 hoe(this,w),this._localFontFamily=w.localFontFamily,this._localIdeographFontFamily=w.localIdeographFontFamily,(w.style||!w.testMode)&&this.setStyle(w.style||i.e.DEFAULT_STYLE,{config:w.config,localFontFamily:this._localFontFamily,localIdeographFontFamily:this._localIdeographFontFamily}),w.projection&&this.setProjection(w.projection),w.hash&&(this._hash=new U5(typeof w.hash=="string"&&w.hash||void 0).addTo(this)),!this._hash||!this._hash._onHashChange()){d.center==null&&d.zoom==null||(this.transform._unmodified=!1),this.jumpTo({center:w.center,zoom:w.zoom,bearing:w.bearing,pitch:w.pitch});const m=w.bounds;m&&(this.resize(),this.fitBounds(m,Object.assign({},w.fitBoundsOptions,{duration:0})))}this.resize(),w.attributionControl&&this.addControl(new d_({customAttribution:w.customAttribution})),this._logoControl=new u_,this.addControl(this._logoControl,w.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 Gh(this)}_getMapId(){return this._mapId}addControl(w,d){if(d===void 0&&(d=w.getDefaultPosition?w.getDefaultPosition():"top-right"),!w||!w.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=w.onAdd(this);this._controls.push(w);const j=this._controlPositions[d];return d.indexOf("bottom")!==-1?j.insertBefore(m,j.firstChild):j.appendChild(m),this}removeControl(w){if(!w||!w.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(w);return d>-1&&this._controls.splice(d,1),w.onRemove(this),this}hasControl(w){return this._controls.indexOf(w)>-1}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}resize(w){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",w)).fire(new i.z("move",w)),this.fire(new i.z("resize",w)),d&&this.fire(new i.z("moveend",w)),this}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()||null}setMaxBounds(w){return this.transform.setMaxBounds(i.aI.convert(w)),this._update()}setMinZoom(w){if((w=w??-2)>=-2&&w<=this.transform.maxZoom)return this.transform.minZoom=w,this._update(),this.getZoom()=this.transform.minZoom)return this.transform.maxZoom=w,this._update(),this.getZoom()>w?this.setZoom(w):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(w){if((w=w??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(w>=0&&w<=this.transform.maxPitch)return this.transform.minPitch=w,this._update(),this.getPitch()85)throw new Error("maxPitch must be less than or equal to 85");if(w>=this.transform.minPitch)return this.transform.maxPitch=w,this._update(),this.getPitch()>w?this.setPitch(w):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(w){return this._scaleFactor=w,this.painter.scaleFactor=w,this._scaleFactorChanged=!0,this.style._updateFilteredLayers(d=>d.type==="symbol"),this._update(!0),this}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(w){return this.transform.renderWorldCopies=w,this.transform.renderWorldCopies||this._forceMarkerAndPopupUpdate(!0),this._update()}getLanguage(){return this._language}_parseLanguage(w){return w==="auto"?navigator.language:Array.isArray(w)?w.length===0?void 0:w.map(d=>d==="auto"?navigator.language:d):w}setLanguage(w){const d=this._parseLanguage(w);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(w){return this.style&&w!==this._worldview?(this._worldview=w,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(w){return this._lazyInitEmptyStyle(),w?typeof w=="string"&&(w={name:w}):w=null,this._useExplicitProjection=!!w,this._prioritizeAndUpdateProjection(w,this.style.projection)}_updateProjectionTransition(){if(this.getProjection().name!=="globe")return;const w=this.transform,d=w.projection.name;let m;d==="globe"&&w.zoom>=i.cL?(w.setMercatorFromTransition(),m=!0):d==="mercator"&&w.zoom=i.cL?this.transform.setMercatorFromTransition():this.transform.setProjection(w),this.style.applyProjectionUpdate();const j=this.transform.getProjection().name==="mercator"&&m!==this.transform.mercatorFromTransition;return(d||j)&&(this.painter.clearBackgroundTiles(),this.style.clearSources(),this._update(!0),this._forceMarkerAndPopupUpdate(!0)),this}project(w,d){return this.transform.locationPoint3D(i.aT.convert(w),d)}unproject(w,d){return this.transform.pointLocation3D(i.P.convert(w),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(w,d,m){const j=A=>{let O=[];if(Array.isArray(d)){const R=d.filter(B=>this.getLayer(B));O=R.length?this.queryRenderedFeatures(A,{layers:R}):[]}else O=this.queryRenderedFeatures(A,{target:d});return O};if(w==="mouseenter"||w==="mouseover"){let A=!1;return{listener:m,targets:d,delegates:{mousemove:R=>{const B=j(R.point);B.length?A||(A=!0,m.call(this,new Kd(w,this,R.originalEvent,{features:B}))):A=!1},mouseout:()=>{A=!1}}}}if(w==="mouseleave"||w==="mouseout"){let A=!1;return{listener:m,targets:d,delegates:{mousemove:B=>{j(B.point).length?A=!0:A&&(A=!1,m.call(this,new Kd(w,this,B.originalEvent)))},mouseout:B=>{A&&(A=!1,m.call(this,new Kd(w,this,B.originalEvent)))}}}}{const A=O=>{const R=j(O.point);R.length&&(O.features=R,m.call(this,O),delete O.features)};return{listener:m,targets:d,delegates:{[w]:A}}}}on(w,d,m){if(typeof d=="function"||m===void 0)return super.on(w,d);if(typeof d=="string"&&(d=[d]),!this._areTargetsValid(d))return this;const j=this._createDelegatedListener(w,d,m);this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[w]=this._delegatedListeners[w]||[],this._delegatedListeners[w].push(j);for(const A in j.delegates)this.on(A,j.delegates[A]);return this}once(w,d,m){if(typeof d=="function"||m===void 0)return super.once(w,d);if(typeof d=="string"&&(d=[d]),!this._areTargetsValid(d))return this;const j=this._createDelegatedListener(w,d,m);for(const A in j.delegates)this.once(A,j.delegates[A]);return this}off(w,d,m){if(typeof d=="function"||m===void 0)return super.off(w,d);if(typeof d=="string"&&(d=[d]),!this._areTargetsValid(d))return this;const j=this._delegatedListeners?this._delegatedListeners[w]:void 0;return j&&(A=>{for(let O=0;O{if(m){const A=typeof m=="string"?m:m instanceof Error?m.message:m.error;i.w(`Unable to perform style diff: ${A}. Rebuilding the style from scratch.`),this._updateStyle(w,d)}else j&&this._update(!0)},()=>this._postStyleLoadEvent()),this):(this._localIdeographFontFamily=d.localIdeographFontFamily,this._localFontFamily=d.localFontFamily,this._updateStyle(w,d))}_getUIString(w){const d=this._locale[w];if(d==null)throw new Error(`Missing UI string '${w}'`);return d}_updateStyle(w,d){if(this.style&&(this.style.setEventedParent(null),this.style._remove(),this.style=void 0),w){const m=Object.assign({},d);d&&d.config&&(m.initialConfig=d.config,delete m.config),this.style=new dh(this,m).load(w),this.style.setEventedParent(this,{style:this.style})}return this._updateTerrain(),this}_lazyInitEmptyStyle(){this.style||(this.style=new dh(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(w){return w==null?(this.fire(new i.y(new Error("IDs can't be empty."))),!1):!i.dr(w)||(this.fire(new i.y(new Error(`IDs can't contain special symbols: "${w}".`))),!1)}_isTargetValid(w){return"featuresetId"in w?this._isValidId("importId"in w?w.importId:w.featuresetId):"layerId"in w&&this._isValidId(w.layerId)}_areTargetsValid(w){if(Array.isArray(w)){for(const d of w)if(!this._isValidId(d))return!1;return!0}return this._isTargetValid(w)}addSource(w,d){return this._isValidId(w)?(this._lazyInitEmptyStyle(),this.style.addSource(w,d),this._update(!0)):this}isSourceLoaded(w){return!!this._isValidId(w)&&!!this.style&&this.style._isSourceCacheLoaded(w)}areTilesLoaded(){return this.style.areTilesLoaded()}addSourceType(w,d,m){this._lazyInitEmptyStyle(),this.style.addSourceType(w,d,m)}removeSource(w){return this._isValidId(w)?(this.style.removeSource(w),this._updateTerrain(),this._update(!0)):this}getSource(w){return this._isValidId(w)?this.style.getOwnSource(w):null}addImage(w,d,{pixelRatio:m=1,sdf:j=!1,stretchX:A,stretchY:O,content:R}={}){this._lazyInitEmptyStyle();const B=i.I.from(w);if(d instanceof HTMLImageElement||ImageBitmap&&d instanceof ImageBitmap){const{width:H,height:Y,data:te}=i.o.getImageData(d);this.style.addImage(B,{data:new i.q({width:H,height:Y},te),pixelRatio:m,stretchX:A,stretchY:O,content:R,sdf:j,version:0,usvg:!1})}else if(d.width===void 0||d.height===void 0)this.fire(new i.y(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));else{const{width:H,height:Y}=d,te=d;this.style.addImage(B,{data:new i.q({width:H,height:Y},new Uint8Array(te.data)),pixelRatio:m,stretchX:A,stretchY:O,content:R,sdf:j,usvg:!1,version:0,userImage:te}),te.onAdd&&te.onAdd(this,w)}}updateImage(w,d){this._lazyInitEmptyStyle();const m=i.I.from(w),j=this.style.getImage(m);if(!j)return void this.fire(new i.y(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const A=d instanceof HTMLImageElement||ImageBitmap&&d instanceof ImageBitmap?i.o.getImageData(d):d,{width:O,height:R,data:B}=A;if(O===void 0||R===void 0)return void this.fire(new i.y(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));if(O!==(j.usvg?j.icon.usvg_tree.width:j.data.width)||R!==(j.usvg?j.icon.usvg_tree.height:j.data.height))return void this.fire(new i.y(new Error(`The width and height of the updated image (${O}, ${R}) must be that same as the previous version of the image (${j.data.width}, ${j.data.height})`)));const H=!(d instanceof HTMLImageElement||ImageBitmap&&d instanceof ImageBitmap);let Y=!1;j.usvg?(j.data=new i.q({width:O,height:R},new Uint8Array(B)),j.usvg=!1,j.icon=void 0,Y=!0):j.data.replace(B,H),this.style.updateImage(m,j,Y)}hasImage(w){return w?!!this.style&&!!this.style.getImage(i.I.from(w)):(this.fire(new i.y(new Error("Missing required image id"))),!1)}removeImage(w){this.style.removeImage(i.I.from(w))}loadImage(w,d){i.n(this._requestManager.transformRequest(w,i.R.Image),(m,j)=>{d(m,j instanceof HTMLImageElement?i.o.getImageData(j):j)})}listImages(){return this.style.listImages().map(w=>w.name)}addModel(w,d){this._lazyInitEmptyStyle(),this.style.addModel(w,d)}hasModel(w){return w?this.style.hasModel(w):(this.fire(new i.y(new Error("Missing required model id"))),!1)}removeModel(w){this.style.removeModel(w)}listModels(){return this.style.listModels()}addLayer(w,d){return this._isValidId(w.id)?(this._lazyInitEmptyStyle(),this.style.addLayer(w,d),this._update(!0)):this}getSlot(w){const d=this.getLayer(w);return d&&d.slot||null}setSlot(w,d){return this.style.setSlot(w,d),this.style.mergeLayers(),this._update(!0)}addImport(w,d){return this.style.addImport(w,d).catch(m=>this.fire(new i.y(new Error("Failed to add import",m)))),this}updateImport(w,d){return typeof d!="string"&&d.id!==w?(this.removeImport(w),this.addImport(d)):(this.style.updateImport(w,d),this._update(!0))}removeImport(w){return this.style.removeImport(w),this}moveImport(w,d){return this.style.moveImport(w,d),this._update(!0)}moveLayer(w,d){return this._isValidId(w)?(this.style.moveLayer(w,d),this._update(!0)):this}removeLayer(w){return this._isValidId(w)?(this.style.removeLayer(w),this._update(!0)):this}getLayer(w){if(!this._isValidId(w))return null;const d=this.style.getOwnLayer(w);return d?d.type==="custom"?d.implementation:d.serialize():void 0}getSlots(){return this.style.getSlots()}setLayerZoomRange(w,d,m){return this._isValidId(w)?(this.style.setLayerZoomRange(w,d,m),this._update(!0)):this}setFilter(w,d,m={}){return this._isValidId(w)?(this.style.setFilter(w,d,m),this._update(!0)):this}getFilter(w){return this._isValidId(w)?this.style.getFilter(w):null}setPaintProperty(w,d,m,j={}){return this._isValidId(w)?(this.style.setPaintProperty(w,d,m,j),this._update(!0)):this}getPaintProperty(w,d){return this._isValidId(w)?this.style.getPaintProperty(w,d):null}setLayoutProperty(w,d,m,j={}){return this._isValidId(w)?(this.style.setLayoutProperty(w,d,m,j),this._update(!0)):this}getLayoutProperty(w,d){return this._isValidId(w)?this.style.getLayoutProperty(w,d):null}setLayerProperty(w,d,m,j={}){return this._isValidId(w)?(d==="appearances"&&this._postAddingAppearancesToStyleEvent(),this.style.setLayerProperty(w,d,m,j),this._update(!0)):this}getGlyphsUrl(){return this.style.getGlyphsUrl()}setGlyphsUrl(w){return this.style.setGlyphsUrl(w),this._update(!0)}getSchema(w){return this.style.getSchema(w)}setSchema(w,d){return this.style.setSchema(w,d),this._update(!0)}getConfig(w){return this.style.getConfig(w)}setConfig(w,d){return this.style.setConfig(w,d),this._update(!0)}getConfigProperty(w,d){return this.style.getConfigProperty(w,d)}setConfigProperty(w,d,m){return this.style.setConfigProperty(w,d,m),this._update(!0)}getFeaturesetDescriptors(w){return this.style.getFeaturesetDescriptors(w)}setLights(w){if(this._lazyInitEmptyStyle(),w&&w.length===1&&w[0].type==="flat"){const d=w[0];d.properties?this.style.setFlatLight(d.properties,d.id,{}):this.style.setFlatLight({},"flat")}else this.style.setLights(w),this.painter.terrain&&(this.painter.terrain.invalidateRenderCache=!0);return this._update(!0)}getLights(){const w=this.style.getLights()||[];return w.length===0&&w.push({id:this.style.light.id,type:"flat",properties:this.style.getFlatLight()}),w}setLight(w,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:w}])}getLight(){return console.log("The `map.getLight` function is deprecated, prefer using `map.getLights` instead."),this.style.getFlatLight()}setTerrain(w){return this._lazyInitEmptyStyle(),!w&&this.transform.projection.requiresDraping?this.style.setTerrainForDraping():this.style.setTerrain(w),this._averageElevationLastSampledAt=-1/0,this._update(!0)}getTerrain(){return this.style?this.style.getTerrain():null}setFog(w){return this._lazyInitEmptyStyle(),this.style.setFog(w),this._update(!0)}getFog(){return this.style?this.style.getFog():null}setSnow(w){return this._lazyInitEmptyStyle(),this.style.setSnow(w),this._update(!0)}getSnow(){return this.style?this.style.getSnow():null}setRain(w){return this._lazyInitEmptyStyle(),this.style.setRain(w),this._update(!0)}getRain(){return this.style?this.style.getRain():null}setColorTheme(w){return this._lazyInitEmptyStyle(),this.style.setColorTheme(w),this._update(!0)}setImportColorTheme(w,d){return this._lazyInitEmptyStyle(),this.style.setImportColorTheme(w,d),this._update(!0)}setCamera(w){return this.style.setCamera(w),this._triggerCameraUpdate(w)}_triggerCameraUpdate(w){return this._update(this.transform.setOrthographicProjectionAtLowPitch(w["camera-projection"]==="orthographic"))}getCamera(){return this.style.camera}_queryFogOpacity(w){return this.style&&this.style.fog?this.style.fog.getOpacityAtLatLng(i.aT.convert(w),this.transform):0}setFeatureState(w,d){return w.source&&!this._isValidId(w.source)?this:(this.style.setFeatureState(w,d),this._update())}removeFeatureState(w,d){return w.source&&!this._isValidId(w.source)?this:(this.style.removeFeatureState(w,d),this._update())}getFeatureState(w){return w.source&&!this._isValidId(w.source)?null:this.style.getFeatureState(w)}_selectIndoorFloor(w){this.indoor.selectFloor(w)}_setIndoorActiveFloorsVisibility(w){this.indoor.setActiveFloorsVisibility(w)}_addIndoorControl(){this._indoorControl||(this._indoorControl=new _0),this.addControl(this._indoorControl,"right")}_removeIndoorControl(){this._indoorControl&&this.removeControl(this._indoorControl)}_updateContainerDimensions(){if(!this._container)return;const w=this._container.getBoundingClientRect().width||400,d=this._container.getBoundingClientRect().height||300;let m,j,A,O=this._container;for(;O&&(!j||!A);){const R=window.getComputedStyle(O).transform;R&&R!=="none"&&(m=R.match(/matrix.*\((.+)\)/)[1].split(", "),m[0]&&m[0]!=="0"&&m[0]!=="1"&&(j=m[0]),m[3]&&m[3]!=="0"&&m[3]!=="1"&&(A=m[3])),O=O.parentElement}this._containerWidth=j?Math.abs(w/j):w,this._containerHeight=A?Math.abs(d/A):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 OP(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 w=this._container;w.classList.add("mapboxgl-map"),(this._missingCSSCanary=k("div","mapboxgl-canary",w)).style.visibility="hidden",this._detectMissingCSS();const d=this._canvasContainer=k("div","mapboxgl-canvas-container",w);this._canvas=k("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=k("div","mapboxgl-control-container",w),j=this._controlPositions={};["top-left","top","top-right","right","bottom-right","bottom","bottom-left","left"].forEach(A=>{j[A]=k("div",`mapboxgl-ctrl-${A}`,m)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(w,d){const m=i.o.devicePixelRatio||1;this._canvas.width=m*Math.ceil(w),this._canvas.height=m*Math.ceil(d),this._canvas.style.width=`${w}px`,this._canvas.style.height=`${d}px`}_addMarker(w){this._markers.push(w)}_removeMarker(w){const d=this._markers.indexOf(w);d!==-1&&this._markers.splice(d,1)}_addPopup(w){this._popups.push(w)}_removePopup(w){const d=this._popups.indexOf(w);d!==-1&&this._popups.splice(d,1)}_setupPainter(){const w=Object.assign({},S.supported.webGLContextAttributes,{failIfMajorPerformanceCaveat:this._failIfMajorPerformanceCaveat,preserveDrawingBuffer:this._preserveDrawingBuffer,antialias:this._antialias||!1}),d=this._canvas.getContext("webgl2",w);d?(st(d,!0),this.painter=new PN(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(w){w.preventDefault(),this._frame&&(this._frame.cancel(),this._frame=null),this.fire(new i.z("webglcontextlost",{originalEvent:w}))}_contextRestored(w){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:w}))}_onMapScroll(w){if(w.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(w){return this.style?(this._styleDirty=this._styleDirty||w,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(w){return this._update(),this._renderTaskQueue.add(w)}_cancelRenderFrame(w){this._renderTaskQueue.remove(w)}_requestDomTask(w){!this.loaded()||this.loaded()&&!this.isMoving()?w():this._domRenderTaskQueue.add(w)}_render(w){let d;this.fire(new i.z("renderstart")),++this._frameId;const m=this.painter.context.extTimerQuery,j=i.o.now(),A=this.painter.context.gl;if(this.listens("gpu-timing-frame")&&(d=A.createQuery(),A.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(w),this._domRenderTaskQueue.run(w),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,te=this.transform.pitch,de=i.o.now(),ce=new i.ac(Y,{now:de,fadeDuration:O,pitch:te,transition:this.style.transition,worldview:this._worldview});this.style.update(ce)}this.style&&this.style.hasFogTransition()&&(this.style._markersNeedUpdate=!0,this._sourcesDirty=!0);let R=!1;this.style&&this._sourcesDirty?(this._sourcesDirty=!1,this.painter._updateFog(this.style),this._updateTerrain(),R=this._updateAverageElevation(j),this.style.updateSources(this.transform),this.style.updateImageProviders(),this.isMoving()||this._forceMarkerAndPopupUpdate()):R=this._updateAverageElevation(j);const B=this.style&&this.style._updatePlacement(this.painter,this.painter.transform,this.showCollisionBoxes,O,this._crossSourceCollisions,this.painter.replacementSource,this._scaleFactorChanged);if(this._scaleFactorChanged&&(this._scaleFactorChanged=!1),B&&(this._placementDirty=B.needsRerender),this.style&&this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showParseStatus:this.showParseStatus,wireframe:{terrain:this.showTerrainWireframe,layers2D:this.showLayers2DWireframe,layers3D:this.showLayers3DWireframe},showOverdrawInspector:this._showOverdrawInspector,showQueryGeometry:!!this._showQueryGeometry,showTileAABBs:this.showTileAABBs,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:O,isInitialLoad:this._isInitialLoad,showPadding:this.showPadding,gpuTiming:!!this.listens("gpu-timing-layer"),gpuTimingDeferredRender:!!this.listens("gpu-timing-deferred-render"),speedIndexTiming:this.speedIndexTiming}),this.fire(new i.z("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,x.mark(p.load),this.fire(new i.z("load"))),this.style&&this.style.hasTransitions()&&(this._styleDirty=!0),this.style&&(this.style.snow||this.style.rain)&&(this._styleDirty=!0),this.style&&this.style.imageManager.hasPatternsInFlight()&&(this._styleDirty=!0),this.style&&!this.style.modelManager.isLoaded()&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles(),d){const Y=i.o.now()-j;A.endQuery(m.TIME_ELAPSED_EXT),setTimeout(()=>{const te=A.getQueryParameter(d,A.QUERY_RESULT)/1e6;A.deleteQuery(d),this.fire(new i.z("gpu-timing-frame",{cpuTime:Y,gpuTime:te}))},50)}if(this.listens("gpu-timing-layer")){const Y=this.painter.collectGpuTimers();setTimeout(()=>{const te=this.painter.queryGpuTimers(Y);this.fire(new i.z("gpu-timing-layer",{layerTimes:te}))},50)}if(this.listens("gpu-timing-deferred-render")){const Y=this.painter.collectDeferredRenderGpuQueries();setTimeout(()=>{const te=this.painter.queryGpuTimeDeferredRender(Y);this.fire(new i.z("gpu-timing-deferred-render",{gpuTime:te}))},50)}const H=this._sourcesDirty||this._styleDirty||this._placementDirty||R;if(H||this._repaint)this.triggerRepaint();else{const Y=this.idle();if(Y&&(R=this._updateAverageElevation(j,!0)),R)this.triggerRepaint();else if(this._triggerFrame(!1),Y&&(this.fire(new i.z("idle")),this._isInitialLoad=!1,this.speedIndexTiming)){const te=this._calculateSpeedIndex();this.fire(new i.z("speedindexcompleted",{speedIndex:te})),this.speedIndexTiming=!1}}!this._loaded||this._fullyLoaded||H||(this._fullyLoaded=!0,x.mark(p.fullLoad),this._performanceMetricsCollection&&at(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(w){for(const d of this._markers)w&&!this.getRenderWorldCopies()&&(d._lngLat=d._lngLat.wrap()),d._update();for(const d of this._popups)!w||this.getRenderWorldCopies()||d._trackPointer||(d._lngLat=d._lngLat.wrap()),d._update()}_updateAverageElevation(w,d=!1){const m=A=>(this.transform.averageElevation=A,this._update(!1),!0);if(!this.painter.averageElevationNeedsEasing())return this.transform.averageElevation!==0&&m(0);const j=this.transform.elevation&&this.transform.elevation.exaggeration()!==this._averageElevationExaggeration;if(j||(d||w-this._averageElevationLastSampledAt>500)&&!this._averageElevation.isEasing(w)){const A=this.transform.averageElevation;let O=this.transform.sampleAverageElevation();this.transform.elevation!=null&&(this._averageElevationExaggeration=this.transform.elevation.exaggeration()),isNaN(O)?O=0:this._averageElevationLastSampledAt=w;const R=Math.abs(A-O);if(R>1){if(this._isInitialLoad||j)return this._averageElevation.jumpTo(O),m(O);this._averageElevation.easeTo(O,w,300)}else if(R>1e-4)return this._averageElevation.jumpTo(O),m(O)}return!!this._averageElevation.isEasing(w)&&m(this._averageElevation.getValue(w))}_authenticate(){Ve(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,w=>{if(w&&(w.message===ge||w.status===401)){const d=this.painter.context.gl;st(d,!1),this._logoControl instanceof u_&&this._logoControl._updateLogo(),d&&d.clear(d.DEPTH_BUFFER_BIT|d.COLOR_BUFFER_BIT|d.STENCIL_BUFFER_BIT),this._silenceAuthErrors||this.fire(new i.y(new Error("A valid Mapbox access token is required to use Mapbox GL JS. To create an account or a new access token, visit https://account.mapbox.com/")))}}),Te(this._getMapId(),this._requestManager._skuToken,this._requestManager._customAccessToken,()=>{})}_postStyleLoadEvent(){this.style.globalId&&Ue(this._requestManager._customAccessToken,{map:this,style:this.style.globalId,importedStyles:this.style.getImportGlobalIds()})}_postStyleWithAppearanceEvent(){this.style.globalId&&this.style.hasAppearances()&&qe(this._requestManager._customAccessToken)}_postAddingAppearancesToStyleEvent(){Mt(this._requestManager._customAccessToken)}_updateTerrain(){const w=this._isDragging();this.painter.updateTerrain(this.style,w)}_calculateSpeedIndex(){const w=this.painter.canvasCopy(),d=this.painter.getCanvasCopiesAndTimestamps();d.timeStamps.push(performance.now());const m=this.painter.context.gl,j=m.createFramebuffer();function A(O){m.framebufferTexture2D(m.FRAMEBUFFER,m.COLOR_ATTACHMENT0,m.TEXTURE_2D,O,0);const R=new Uint8Array(m.drawingBufferWidth*m.drawingBufferHeight*4);return m.readPixels(0,0,m.drawingBufferWidth,m.drawingBufferHeight,m.RGBA,m.UNSIGNED_BYTE,R),R}return m.bindFramebuffer(m.FRAMEBUFFER,j),this._canvasPixelComparison(A(w),d.canvasCopies.map(A),d.timeStamps)}_canvasPixelComparison(w,d,m){let j=m[1]-m[0];const A=w.length/4;for(let O=0;O{const m=!!this._renderNextFrame;this._frame=null,this._renderNextFrame=null,m&&this._render(d)}))}_preloadTiles(w){const d=this.style?this.style.getSourceCaches():[];return i.bw(d,(m,j)=>m._preloadTiles(w,j),()=>{this.triggerRepaint()}),this}_onWindowOnline(){this._update()}_onWindowResize(w){this._trackResize&&this.resize({originalEvent:w})._update()}_onVisibilityChange(){document.visibilityState==="hidden"&&this._visibilityHidden++}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(w){this._showTileBoundaries!==w&&(this._showTileBoundaries=w,this._update())}get showParseStatus(){return!!this._showParseStatus}set showParseStatus(w){this._showParseStatus!==w&&(this._showParseStatus=w,this._update())}get showTerrainWireframe(){return!!this._showTerrainWireframe}set showTerrainWireframe(w){this._showTerrainWireframe!==w&&(this._showTerrainWireframe=w,this._update())}get showLayers2DWireframe(){return!!this._showLayers2DWireframe}set showLayers2DWireframe(w){this._showLayers2DWireframe!==w&&(this._showLayers2DWireframe=w,this._update())}get showLayers3DWireframe(){return!!this._showLayers3DWireframe}set showLayers3DWireframe(w){this._showLayers3DWireframe!==w&&(this._showLayers3DWireframe=w,this._update())}get speedIndexTiming(){return!!this._speedIndexTiming}set speedIndexTiming(w){this._speedIndexTiming!==w&&(this._speedIndexTiming=w,this._update())}get showPadding(){return!!this._showPadding}set showPadding(w){this._showPadding!==w&&(this._showPadding=w,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(w){this._showCollisionBoxes!==w&&(this._showCollisionBoxes=w,this.style&&w?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(w){this._showOverdrawInspector!==w&&(this._showOverdrawInspector=w,this._update())}get repaint(){return!!this._repaint}set repaint(w){this._repaint!==w&&(this._repaint=w,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(w){this._vertices=w,this._update()}get showTileAABBs(){return!!this._showTileAABBs}set showTileAABBs(w){this._showTileAABBs!==w&&(this._showTileAABBs=w,w&&this._update())}_setCacheLimits(w,d){i.f4(w,d)}get version(){return u}},NavigationControl:class{constructor(w={}){this.options=Object.assign({},moe,w),this._container=k("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})}),k("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})}),k("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=k("span","mapboxgl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}_updateZoomButtons(){const w=this._map;if(!w)return;const d=w.getZoom(),m=d===w.getMaxZoom(),j=d===w.getMinZoom();this._zoomInButton.disabled=m,this._zoomOutButton.disabled=j,this._zoomInButton.setAttribute("aria-disabled",m.toString()),this._zoomOutButton.setAttribute("aria-disabled",j.toString())}_rotateCompassArrow(){const w=this._map;if(!w)return;const d=this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(w.transform.pitch*(Math.PI/180)),.5)}) rotateX(${w.transform.pitch}deg) rotateZ(${w.transform.angle*(180/Math.PI)}deg)`:`rotate(${w.transform.angle*(180/Math.PI)}deg)`;w._requestDomTask(()=>{this._compassIcon&&(this._compassIcon.style.transform=d)})}onAdd(w){return this._map=w,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),w.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&w.on("pitch",this._rotateCompassArrow),w.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new goe(w,this._compass,this.options.visualizePitch)),this._container}onRemove(){const w=this._map;w&&(this._container.remove(),this.options.showZoom&&w.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&w.off("pitch",this._rotateCompassArrow),w.off("rotate",this._rotateCompassArrow),this._handler&&this._handler.off(),this._handler=void 0),this._map=void 0)}_createButton(w,d){const m=k("button",w,this._container);return m.type="button",m.addEventListener("click",d),m}_setButtonTitle(w,d){if(!this._map)return;const m=this._map._getUIString(`NavigationControl.${d}`);w.setAttribute("aria-label",m),w.firstElementChild&&w.firstElementChild.setAttribute("title",m)}},GeolocateControl:class extends i.E{constructor(w={}){super();const d=navigator.geolocation;this.options=Object.assign({geolocation:d},xoe,w),i.aY(["_onSuccess","_onError","_onZoom","_finish","_setupUI","_updateCamera","_updateMarker","_updateMarkerRotation","_onDeviceOrientation"],this),this._updateMarkerRotationThrottled=LN(this._updateMarkerRotation,20),this._numberOfWatches=0}onAdd(w){return this._map=w,this._container=k("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(w){const d=(m=!!this.options.geolocation)=>{this._supportsGeolocation=m,w(m)};this._supportsGeolocation!==void 0?w(this._supportsGeolocation):navigator.permissions!==void 0?navigator.permissions.query({name:"geolocation"}).then(m=>d(m.state!=="denied")).catch(()=>d()):d()}_isOutOfMapMaxBounds(w){const d=this._map.getMaxBounds(),m=w.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(w){if(this._map){if(this._isOutOfMapMaxBounds(w))return this._setErrorState(),this.fire(new i.z("outofmaxbounds",w)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=w,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(w),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(w),this.options.showUserLocation&&this._userLocationDotMarker.removeClassName("mapboxgl-user-location-dot-stale"),this.fire(new i.z("geolocate",Object.assign({coords:w.coords,timestamp:w.timestamp},w.toJSON?{toJSON:w.toJSON.bind(w)}:{}))),this._finish()}}_updateCamera(w){const d=new i.aT(w.coords.longitude,w.coords.latitude),m=w.coords.accuracy,j=this._map.getBearing(),A=Object.assign({bearing:j},this.options.fitBoundsOptions);this._map.fitBounds(d.toBounds(m),A,{geolocateSource:!0})}_updateMarker(w){if(w){const d=new i.aT(w.coords.longitude,w.coords.latitude);this._accuracyCircleMarker.setLngLat(d).addTo(this._map),this._userLocationDotMarker.setLngLat(d).addTo(this._map),this._accuracy=w.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()}_updateCircleRadius(){const w=this._map.transform,d=i.cf(1,w._center.lat)*w.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(w){if(this._map){if(this.options.trackUserLocation)if(w.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(w.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",w)),this._finish()}}_finish(){this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0}_setupUI(w){if(this._map!==void 0){if(this._container.addEventListener("contextmenu",d=>d.preventDefault()),this._geolocateButton=k("button","mapboxgl-ctrl-geolocate",this._container),k("span","mapboxgl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",w===!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=k("div","mapboxgl-user-location"),this._dotElement.appendChild(k("div","mapboxgl-user-location-dot")),this._dotElement.appendChild(k("div","mapboxgl-user-location-heading")),this._userLocationDotMarker=new GN({element:this._dotElement,rotationAlignment:"map",pitchAlignment:"map"}),this._circleElement=k("div","mapboxgl-user-location-accuracy-circle"),this._accuracyCircleMarker=new GN({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(w){this._userLocationDotMarker&&(w.webkitCompassHeading?this._heading=w.webkitCompassHeading:w.absolute===!0&&(this._heading=-1*w.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 w;this._geolocateButton.classList.add("mapboxgl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),this._numberOfWatches++,this._numberOfWatches>1?(w={maximumAge:6e5,timeout:0},this._noTimeout=!0):(w=this.options.positionOptions,this._noTimeout=!1),this._geolocationWatchID=this.options.geolocation.watchPosition(this._onSuccess,this._onError,w),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 w=()=>{"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"&&w()}).catch(console.error):w()}_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:d_,ScaleControl:class{constructor(w={}){this.options=Object.assign({},b0,w),i.aY(["_update","_setScale","setUnit"],this)}getDefaultPosition(){return"bottom-left"}_update(){const w=this.options.maxWidth||100,d=this._map,m=d._containerHeight/2,j=d._containerWidth/2-w/2,A=d.unproject([j,m]),O=d.unproject([j+w,m]),R=A.distanceTo(O);if(this.options.unit==="imperial"){const B=3.2808*R;B>5280?this._setScale(w,B/5280,"mile"):this._setScale(w,B,"foot")}else this.options.unit==="nautical"?this._setScale(w,R/1852,"nautical-mile"):R>=1e3?this._setScale(w,R/1e3,"kilometer"):this._setScale(w,R,"meter")}_setScale(w,d,m){this._map._requestDomTask(()=>{const j=function(O){const R=Math.pow(10,`${Math.floor(O)}`.length-1);let B=O/R;return B=B>=10?10:B>=5?5:B>=3?3:B>=2?2:B>=1?1:function(H){const Y=Math.pow(10,Math.ceil(-Math.log(H)/Math.LN10));return Math.round(H*Y)/Y}(B),R*B}(d),A=j/d;this._container.innerHTML=m!=="nautical-mile"?new Intl.NumberFormat(this._language,{style:"unit",unitDisplay:"short",unit:m}).format(j):`${j} ${rM[m]}`,this._container.style.width=w*A+"px"})}onAdd(w){return this._map=w,this._language=w.getLanguage(),this._container=k("div","mapboxgl-ctrl mapboxgl-ctrl-scale",w.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(w){this._language=w,this._update()}setUnit(w){this.options.unit=w,this._update()}},FullscreenControl:class{constructor(w={}){this._fullscreen=!1,w&&w.container&&(w.container instanceof HTMLElement?this._container=w.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(w){return this._map=w,this._container||(this._container=this._map.getContainer()),this._controlContainer=k("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 w=this._fullscreenButton=k("button","mapboxgl-ctrl-fullscreen",this._controlContainer);k("span","mapboxgl-ctrl-icon",w).setAttribute("aria-hidden","true"),w.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),document.addEventListener(this._fullscreenchange,this._changeIcon)}_updateTitle(){const w=this._getTitle();this._fullscreenButton.setAttribute("aria-label",w),this._fullscreenButton.firstElementChild&&this._fullscreenButton.firstElementChild.setAttribute("title",w)}_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:_0,Popup:class extends i.E{constructor(w){super(),this.options=Object.assign(Object.create(hh),w),this._altitude=this.options.altitude,i.aY(["_update","_onClose","remove","_onMouseEvent"],this),this._classList=new Set(w&&w.className?w.className.trim().split(/\s+/):[])}addTo(w){return this._map&&this.remove(),this._map=w,this.options.closeOnClick&&w.on("preclick",this._onClose),this.options.closeOnMove&&w.on("move",this._onClose),w.on("remove",this.remove),this._update(),w._addPopup(this),this._focusFirstElement(),this._trackPointer?(w.on("mousemove",this._onMouseEvent),w.on("mouseup",this._onMouseEvent),w._canvasContainer.classList.add("mapboxgl-track-pointer")):w.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 w=this._map;return w&&(w.off("move",this._update),w.off("move",this._onClose),w.off("preclick",this._onClose),w.off("click",this._onClose),w.off("remove",this.remove),w.off("mousemove",this._onMouseEvent),w.off("mouseup",this._onMouseEvent),w.off("drag",this._onMouseEvent),w._canvasContainer&&w._canvasContainer.classList.remove("mapboxgl-track-pointer"),w._removePopup(this),this._map=void 0),this.fire(new i.z("close")),this}getLngLat(){return this._lngLat}setLngLat(w){this._lngLat=i.aT.convert(w),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(w){return this._altitude=w,this._update(),this}trackPointer(){this._trackPointer=!0,this._pos=null,this._update();const w=this._map;return w&&(w.off("move",this._update),w.on("mousemove",this._onMouseEvent),w.on("drag",this._onMouseEvent),w._canvasContainer.classList.add("mapboxgl-track-pointer")),this}getElement(){return this._container}setText(w){return this.setDOMContent(document.createTextNode(w))}setHTML(w){const d=document.createDocumentFragment(),m=document.createElement("body");let j;for(m.innerHTML=w;j=m.firstChild,j;)d.appendChild(j);return this.setDOMContent(d)}getMaxWidth(){return this._container&&this._container.style.maxWidth}setMaxWidth(w){return this.options.maxWidth=w,this._update(),this}setDOMContent(w){let d=this._content;if(d)for(;d.hasChildNodes();)d.firstChild&&d.removeChild(d.firstChild);else d=this._content=k("div","mapboxgl-popup-content",this._container||void 0);if(d.appendChild(w),this.options.closeButton){const m=this._closeButton=k("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(w){return this._classList.add(w),this._updateClassList(),this}removeClassName(w){return this._classList.delete(w),this._updateClassList(),this}setOffset(w){return this.options.offset=w,this._update(),this}toggleClassName(w){let d;return this._classList.delete(w)?d=!1:(this._classList.add(w),d=!0),this._updateClassList(),d}_onMouseEvent(w){this._update(w.point)}_getAnchor(w){if(this.options.anchor)return this.options.anchor;const d=this._map,m=this._container,j=this._pos;if(!d||!m||!j)return"bottom";const A=m.offsetWidth,O=m.offsetHeight,R=j.xd.transform.width-A/2;if(j.y+wd.transform.height-O){if(R)return"bottom-left";if(B)return"bottom-right"}return R?"left":B?"right":"bottom"}_updateClassList(){const w=this._container;if(!w)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"),w.className=d.join(" ")}_update(w){const d=this._map,m=this._content;if(!d||!this._lngLat&&!this._trackPointer||!m)return;let j=this._container;if(j||(j=this._container=k("div","mapboxgl-popup",d.getContainer()),this._tip=k("div","mapboxgl-popup-tip",j),j.appendChild(m)),this.options.maxWidth&&j.style.maxWidth!==this.options.maxWidth&&(j.style.maxWidth=this.options.maxWidth),d.transform.renderWorldCopies&&!this._trackPointer&&(this._lngLat=tM(this._lngLat,this._pos,d.transform)),!this._trackPointer||w){const A=this._pos=this._trackPointer&&w instanceof i.P?w:d.project(this._lngLat,this._altitude),O=Nx(this.options.offset),R=this._anchor=this._getAnchor(O.y),B=Nx(this.options.offset,R),H=A.add(B).round();d._requestDomTask(()=>{this._container&&R&&(this._container.style.transform=`${Ec[R]} translate(${H.x}px,${H.y}px)`)})}if(!this._marker&&d._showingGlobe()){const A=i.f5(d.transform,this._lngLat)?0:1;this._setOpacity(A)}this._updateClassList()}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const w=this._container.querySelector(fh);w&&w.focus()}_onClose(){this.remove()}_setOpacity(w){this._container&&(this._container.style.opacity=`${w}`),this._content&&(this._content.style.pointerEvents=w?"auto":"none")}},Marker:GN,Style:dh,LngLat:i.aT,LngLatBounds:i.aI,Point:i.P,MercatorCoordinate:i.ae,FreeCameraOptions:bd,Evented:i.E,config:i.e,prewarm:i.f9,clearPrewarmedResources:i.f8,get accessToken(){return i.e.ACCESS_TOKEN},set accessToken(w){i.e.ACCESS_TOKEN=w},get baseApiUrl(){return i.e.API_URL},set baseApiUrl(w){i.e.API_URL=w},get workerCount(){return i.fi.workerCount},set workerCount(w){i.fi.workerCount=w},get maxParallelImageRequests(){return i.e.MAX_PARALLEL_IMAGE_REQUESTS},set maxParallelImageRequests(w){i.e.MAX_PARALLEL_IMAGE_REQUESTS=w},clearStorage(w){i.fh(w)},get workerUrl(){return i.fg.workerUrl},set workerUrl(w){i.fg.workerUrl=w},get workerClass(){return i.fg.workerClass},set workerClass(w){i.fg.workerClass=w},get workerParams(){return i.fg.workerParams},set workerParams(w){i.fg.workerParams=w},get dracoUrl(){return i.ff()},set dracoUrl(w){i.fe(w)},get meshoptUrl(){return i.fd()},set meshoptUrl(w){i.fc(w)},setNow:i.o.setNow,restoreNow:i.o.restoreNow}});var l=a;return l})})(LOe);var Olt=LOe.exports;const rc=Qi(Olt);function Lr({className:e,...t}){return r.jsx("div",{className:Bt("animate-pulse rounded-md bg-muted",e),...t})}const Hke={coming_soon:"#3B82F6",active:"#10B981",price_improvement:"#F97316",under_contract:"#8B5CF6",sold:"#6B7280"},Wke={coming_soon:"Coming Soon",active:"Active",price_improvement:"Price Improvement",under_contract:"Under Contract",sold:"Sold"};function Dlt(e){return e>=1e6?`$${(e/1e6).toFixed(1)}M`:`$${(e/1e3).toFixed(0)}K`}function Rlt({listings:e,isLoading:t}){const n=Gn(),s=E.useRef(null),a=E.useRef(null),o=E.useRef([]),[l,i]=E.useState(""),[u,p]=E.useState(!0);return E.useEffect(()=>{(async()=>{p(!0);try{const{data:_}=await Q.from("settings").select("value").eq("key","mapbox_public_token").maybeSingle();_!=null&&_.value&&i(_.value)}catch(_){console.error("Error fetching mapbox token:",_)}p(!1)})()},[]),E.useEffect(()=>{if(!s.current||!l||a.current)return;rc.accessToken=l;const y=e.filter(S=>S.latitude!=null&&S.longitude!=null);let _=[-98.5795,39.8283],b=4;if(y.length>0){const S=y.reduce((M,P)=>M+P.longitude,0)/y.length,k=y.reduce((M,P)=>M+P.latitude,0)/y.length;_=[S,k],b=y.length===1?12:10}return a.current=new rc.Map({container:s.current,style:"mapbox://styles/mapbox/light-v11",zoom:b,center:_}),a.current.addControl(new rc.NavigationControl,"top-right"),()=>{var S;(S=a.current)==null||S.remove(),a.current=null}},[l]),E.useEffect(()=>{if(!a.current||!l)return;o.current.forEach(_=>_.remove()),o.current=[];const y=e.filter(_=>_.latitude!=null&&_.longitude!=null);if(y.forEach(_=>{var z,D,U;const b=Hke[_.status]||"#10B981",S=((z=_.photos)==null?void 0:z.find(V=>V.is_primary))||((D=_.photos)==null?void 0:D[0]),M=window.location.hostname==="listings.relevelup.com"||window.location.hostname.startsWith("listings.")?`/${_.slug||_.id}`:`/public/listing/${_.slug||_.id}`,P=document.createElement("div");P.className="cursor-pointer",P.innerHTML=`
`;const T=new rc.Popup({offset:25,closeButton:!0,maxWidth:"280px"}).setHTML(`
${S!=null&&S.photo_url?``:""}
${Dlt(_.price)}
${_.property_address||""}
${_.city}, ${_.state}
${Wke[_.status]||_.status} ${_.bedrooms?`${_.bedrooms} bed`:""} ${_.bathrooms?`${_.bathrooms} bath`:""}
${(U=_.agent)!=null&&U.name?`
Listed by ${_.agent.name}
`:""}
Click to view details →
`),I=new rc.Marker(P).setLngLat([_.longitude,_.latitude]).setPopup(T).addTo(a.current);o.current.push(I)}),y.length>1){const _=new rc.LngLatBounds;y.forEach(b=>_.extend([b.longitude,b.latitude])),a.current.fitBounds(_,{padding:60,maxZoom:13})}else y.length===1&&a.current.flyTo({center:[y[0].longitude,y[0].latitude],zoom:12})},[e,l]),E.useEffect(()=>(window.__navigateToPublicListing__=y=>{n(y)},()=>{delete window.__navigateToPublicListing__}),[n]),u||t?r.jsx(Lr,{className:"w-full h-[500px] rounded-lg"}):!l||e.filter(y=>y.latitude!=null&&y.longitude!=null).length===0?null:r.jsxs("div",{className:"space-y-3",children:[r.jsx("div",{className:"flex flex-wrap items-center gap-3 text-sm",children:Object.entries(Hke).map(([y,_])=>r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx("div",{className:"w-3 h-3 rounded-full border-2 border-white shadow",style:{background:_}}),r.jsx("span",{className:"text-xs text-gray-600",children:Wke[y]})]},y))}),r.jsx("div",{ref:s,className:"w-full h-[500px] rounded-lg shadow-lg border border-gray-200"})]})}function IE(e,[t,n]){return Math.min(n,Math.max(t,e))}function aP(e){const t=E.useRef({value:e,previous:e});return E.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var Flt=[" ","Enter","ArrowUp","ArrowDown"],zlt=[" ","Enter"],ik="Select",[Rse,Fse,Blt]=qI(ik),[A3]=cc(ik,[Blt,tx]),zse=tx(),[$lt,kv]=A3(ik),[Ult,qlt]=A3(ik),DOe=e=>{const{__scopeSelect:t,children:n,open:s,defaultOpen:a,onOpenChange:o,value:l,defaultValue:i,onValueChange:u,dir:p,name:x,autoComplete:y,disabled:_,required:b,form:S}=e,k=zse(t),[M,P]=E.useState(null),[T,I]=E.useState(null),[z,D]=E.useState(!1),U=Sk(p),[V,W]=Ju({prop:s,defaultProp:a??!1,onChange:o,caller:ik}),[G,J]=Ju({prop:l,defaultProp:i,onChange:u,caller:ik}),ne=E.useRef(null),oe=M?S||!!M.closest("form"):!0,[ge,ie]=E.useState(new Set),pe=Array.from(ge).map(se=>se.props.value).join(";");return r.jsx(GI,{...k,children:r.jsxs($lt,{required:b,scope:t,trigger:M,onTriggerChange:P,valueNode:T,onValueNodeChange:I,valueNodeHasChildren:z,onValueNodeHasChildrenChange:D,contentId:fd(),value:G,onValueChange:J,open:V,onOpenChange:W,dir:U,triggerPointerDownPosRef:ne,disabled:_,children:[r.jsx(Rse.Provider,{scope:t,children:r.jsx(Ult,{scope:e.__scopeSelect,onNativeOptionAdd:E.useCallback(se=>{ie(fe=>new Set(fe).add(se))},[]),onNativeOptionRemove:E.useCallback(se=>{ie(fe=>{const he=new Set(fe);return he.delete(se),he})},[]),children:n})}),oe?r.jsxs(i8e,{"aria-hidden":!0,required:b,tabIndex:-1,name:x,autoComplete:y,value:G,onChange:se=>J(se.target.value),disabled:_,form:S,children:[G===void 0?r.jsx("option",{value:""}):null,Array.from(ge)]},pe):null]})})};DOe.displayName=ik;var ROe="SelectTrigger",FOe=E.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:s=!1,...a}=e,o=zse(n),l=kv(ROe,n),i=l.disabled||s,u=la(t,l.onTriggerChange),p=Fse(n),x=E.useRef("touch"),[y,_,b]=l8e(k=>{const M=p().filter(I=>!I.disabled),P=M.find(I=>I.value===l.value),T=c8e(M,k,P);T!==void 0&&l.onValueChange(T.value)}),S=k=>{i||(l.onOpenChange(!0),b()),k&&(l.triggerPointerDownPosRef.current={x:Math.round(k.pageX),y:Math.round(k.pageY)})};return r.jsx(_3,{asChild:!0,...o,children:r.jsx(Fn.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":o8e(l.value)?"":void 0,...a,ref:u,onClick:un(a.onClick,k=>{k.currentTarget.focus(),x.current!=="mouse"&&S(k)}),onPointerDown:un(a.onPointerDown,k=>{x.current=k.pointerType;const M=k.target;M.hasPointerCapture(k.pointerId)&&M.releasePointerCapture(k.pointerId),k.button===0&&k.ctrlKey===!1&&k.pointerType==="mouse"&&(S(k),k.preventDefault())}),onKeyDown:un(a.onKeyDown,k=>{const M=y.current!=="";!(k.ctrlKey||k.altKey||k.metaKey)&&k.key.length===1&&_(k.key),!(M&&k.key===" ")&&Flt.includes(k.key)&&(S(),k.preventDefault())})})})});FOe.displayName=ROe;var zOe="SelectValue",BOe=E.forwardRef((e,t)=>{const{__scopeSelect:n,className:s,style:a,children:o,placeholder:l="",...i}=e,u=kv(zOe,n),{onValueNodeHasChildrenChange:p}=u,x=o!==void 0,y=la(t,u.onValueNodeChange);return oc(()=>{p(x)},[p,x]),r.jsx(Fn.span,{...i,ref:y,style:{pointerEvents:"none"},children:o8e(u.value)?r.jsx(r.Fragment,{children:l}):o})});BOe.displayName=zOe;var Vlt="SelectIcon",$Oe=E.forwardRef((e,t)=>{const{__scopeSelect:n,children:s,...a}=e;return r.jsx(Fn.span,{"aria-hidden":!0,...a,ref:t,children:s||"▼"})});$Oe.displayName=Vlt;var Hlt="SelectPortal",UOe=e=>r.jsx(m3,{asChild:!0,...e});UOe.displayName=Hlt;var ok="SelectContent",qOe=E.forwardRef((e,t)=>{const n=kv(ok,e.__scopeSelect),[s,a]=E.useState();if(oc(()=>{a(new DocumentFragment)},[]),!n.open){const o=s;return o?kh.createPortal(r.jsx(VOe,{scope:e.__scopeSelect,children:r.jsx(Rse.Slot,{scope:e.__scopeSelect,children:r.jsx("div",{children:e.children})})}),o):null}return r.jsx(HOe,{...e,ref:t})});qOe.displayName=ok;var sm=10,[VOe,Nv]=A3(ok),Wlt="SelectContentImpl",Glt=cv("SelectContent.RemoveScroll"),HOe=E.forwardRef((e,t)=>{const{__scopeSelect:n,position:s="item-aligned",onCloseAutoFocus:a,onEscapeKeyDown:o,onPointerDownOutside:l,side:i,sideOffset:u,align:p,alignOffset:x,arrowPadding:y,collisionBoundary:_,collisionPadding:b,sticky:S,hideWhenDetached:k,avoidCollisions:M,...P}=e,T=kv(ok,n),[I,z]=E.useState(null),[D,U]=E.useState(null),V=la(t,Ue=>z(Ue)),[W,G]=E.useState(null),[J,ne]=E.useState(null),oe=Fse(n),[ge,ie]=E.useState(!1),pe=E.useRef(!1);E.useEffect(()=>{if(I)return Mse(I)},[I]),Cse();const se=E.useCallback(Ue=>{const[Be,...qe]=oe().map(Oe=>Oe.ref.current),[ot]=qe.slice(-1),Mt=document.activeElement;for(const Oe of Ue)if(Oe===Mt||(Oe==null||Oe.scrollIntoView({block:"nearest"}),Oe===Be&&D&&(D.scrollTop=0),Oe===ot&&D&&(D.scrollTop=D.scrollHeight),Oe==null||Oe.focus(),document.activeElement!==Mt))return},[oe,D]),fe=E.useCallback(()=>se([W,I]),[se,W,I]);E.useEffect(()=>{ge&&fe()},[ge,fe]);const{onOpenChange:he,triggerPointerDownPosRef:ye}=T;E.useEffect(()=>{if(I){let Ue={x:0,y:0};const Be=ot=>{var Mt,Oe;Ue={x:Math.abs(Math.round(ot.pageX)-(((Mt=ye.current)==null?void 0:Mt.x)??0)),y:Math.abs(Math.round(ot.pageY)-(((Oe=ye.current)==null?void 0:Oe.y)??0))}},qe=ot=>{Ue.x<=10&&Ue.y<=10?ot.preventDefault():I.contains(ot.target)||he(!1),document.removeEventListener("pointermove",Be),ye.current=null};return ye.current!==null&&(document.addEventListener("pointermove",Be),document.addEventListener("pointerup",qe,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",Be),document.removeEventListener("pointerup",qe,{capture:!0})}}},[I,he,ye]),E.useEffect(()=>{const Ue=()=>he(!1);return window.addEventListener("blur",Ue),window.addEventListener("resize",Ue),()=>{window.removeEventListener("blur",Ue),window.removeEventListener("resize",Ue)}},[he]);const[Ae,we]=l8e(Ue=>{const Be=oe().filter(Mt=>!Mt.disabled),qe=Be.find(Mt=>Mt.ref.current===document.activeElement),ot=c8e(Be,Ue,qe);ot&&setTimeout(()=>ot.ref.current.focus())}),be=E.useCallback((Ue,Be,qe)=>{const ot=!pe.current&&!qe;(T.value!==void 0&&T.value===Be||ot)&&(G(Ue),ot&&(pe.current=!0))},[T.value]),_e=E.useCallback(()=>I==null?void 0:I.focus(),[I]),Je=E.useCallback((Ue,Be,qe)=>{const ot=!pe.current&&!qe;(T.value!==void 0&&T.value===Be||ot)&&ne(Ue)},[T.value]),Te=s==="popper"?ife:WOe,De=Te===ife?{side:i,sideOffset:u,align:p,alignOffset:x,arrowPadding:y,collisionBoundary:_,collisionPadding:b,sticky:S,hideWhenDetached:k,avoidCollisions:M}:{};return r.jsx(VOe,{scope:n,content:I,viewport:D,onViewportChange:U,itemRefCallback:be,selectedItem:W,onItemLeave:_e,itemTextRefCallback:Je,focusSelectedItem:fe,selectedItemText:J,position:s,isPositioned:ge,searchRef:Ae,children:r.jsx(eP,{as:Glt,allowPinchZoom:!0,children:r.jsx(QI,{asChild:!0,trapped:T.open,onMountAutoFocus:Ue=>{Ue.preventDefault()},onUnmountAutoFocus:un(a,Ue=>{var Be;(Be=T.trigger)==null||Be.focus({preventScroll:!0}),Ue.preventDefault()}),children:r.jsx(_v,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:o,onPointerDownOutside:l,onFocusOutside:Ue=>Ue.preventDefault(),onDismiss:()=>T.onOpenChange(!1),children:r.jsx(Te,{role:"listbox",id:T.contentId,"data-state":T.open?"open":"closed",dir:T.dir,onContextMenu:Ue=>Ue.preventDefault(),...P,...De,onPlaced:()=>ie(!0),ref:V,style:{display:"flex",flexDirection:"column",outline:"none",...P.style},onKeyDown:un(P.onKeyDown,Ue=>{const Be=Ue.ctrlKey||Ue.altKey||Ue.metaKey;if(Ue.key==="Tab"&&Ue.preventDefault(),!Be&&Ue.key.length===1&&we(Ue.key),["ArrowUp","ArrowDown","Home","End"].includes(Ue.key)){let ot=oe().filter(Mt=>!Mt.disabled).map(Mt=>Mt.ref.current);if(["ArrowUp","End"].includes(Ue.key)&&(ot=ot.slice().reverse()),["ArrowUp","ArrowDown"].includes(Ue.key)){const Mt=Ue.target,Oe=ot.indexOf(Mt);ot=ot.slice(Oe+1)}setTimeout(()=>se(ot)),Ue.preventDefault()}})})})})})})});HOe.displayName=Wlt;var Klt="SelectItemAlignedPosition",WOe=E.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:s,...a}=e,o=kv(ok,n),l=Nv(ok,n),[i,u]=E.useState(null),[p,x]=E.useState(null),y=la(t,V=>x(V)),_=Fse(n),b=E.useRef(!1),S=E.useRef(!0),{viewport:k,selectedItem:M,selectedItemText:P,focusSelectedItem:T}=l,I=E.useCallback(()=>{if(o.trigger&&o.valueNode&&i&&p&&k&&M&&P){const V=o.trigger.getBoundingClientRect(),W=p.getBoundingClientRect(),G=o.valueNode.getBoundingClientRect(),J=P.getBoundingClientRect();if(o.dir!=="rtl"){const Mt=J.left-W.left,Oe=G.left-Mt,at=V.left-Oe,le=V.width+at,Ve=Math.max(le,W.width),Qe=window.innerWidth-sm,st=IE(Oe,[sm,Math.max(sm,Qe-Ve)]);i.style.minWidth=le+"px",i.style.left=st+"px"}else{const Mt=W.right-J.right,Oe=window.innerWidth-G.right-Mt,at=window.innerWidth-V.right-Oe,le=V.width+at,Ve=Math.max(le,W.width),Qe=window.innerWidth-sm,st=IE(Oe,[sm,Math.max(sm,Qe-Ve)]);i.style.minWidth=le+"px",i.style.right=st+"px"}const ne=_(),oe=window.innerHeight-sm*2,ge=k.scrollHeight,ie=window.getComputedStyle(p),pe=parseInt(ie.borderTopWidth,10),se=parseInt(ie.paddingTop,10),fe=parseInt(ie.borderBottomWidth,10),he=parseInt(ie.paddingBottom,10),ye=pe+se+ge+he+fe,Ae=Math.min(M.offsetHeight*5,ye),we=window.getComputedStyle(k),be=parseInt(we.paddingTop,10),_e=parseInt(we.paddingBottom,10),Je=V.top+V.height/2-sm,Te=oe-Je,De=M.offsetHeight/2,Ue=M.offsetTop+De,Be=pe+se+Ue,qe=ye-Be;if(Be<=Je){const Mt=ne.length>0&&M===ne[ne.length-1].ref.current;i.style.bottom="0px";const Oe=p.clientHeight-k.offsetTop-k.offsetHeight,at=Math.max(Te,De+(Mt?_e:0)+Oe+fe),le=Be+at;i.style.height=le+"px"}else{const Mt=ne.length>0&&M===ne[0].ref.current;i.style.top="0px";const at=Math.max(Je,pe+k.offsetTop+(Mt?be:0)+De)+qe;i.style.height=at+"px",k.scrollTop=Be-Je+k.offsetTop}i.style.margin=`${sm}px 0`,i.style.minHeight=Ae+"px",i.style.maxHeight=oe+"px",s==null||s(),requestAnimationFrame(()=>b.current=!0)}},[_,o.trigger,o.valueNode,i,p,k,M,P,o.dir,s]);oc(()=>I(),[I]);const[z,D]=E.useState();oc(()=>{p&&D(window.getComputedStyle(p).zIndex)},[p]);const U=E.useCallback(V=>{V&&S.current===!0&&(I(),T==null||T(),S.current=!1)},[I,T]);return r.jsx(Ylt,{scope:n,contentWrapper:i,shouldExpandOnScrollRef:b,onScrollButtonChange:U,children:r.jsx("div",{ref:u,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:z},children:r.jsx(Fn.div,{...a,ref:y,style:{boxSizing:"border-box",maxHeight:"100%",...a.style}})})})});WOe.displayName=Klt;var Zlt="SelectPopperPosition",ife=E.forwardRef((e,t)=>{const{__scopeSelect:n,align:s="start",collisionPadding:a=sm,...o}=e,l=zse(n);return r.jsx(KI,{...l,...o,ref:t,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)"}})});ife.displayName=Zlt;var[Ylt,Xxe]=A3(ok,{}),ofe="SelectViewport",GOe=E.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:s,...a}=e,o=Nv(ofe,n),l=Xxe(ofe,n),i=la(t,o.onViewportChange),u=E.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(Rse.Slot,{scope:n,children:r.jsx(Fn.div,{"data-radix-select-viewport":"",role:"presentation",...a,ref:i,style:{position:"relative",flex:1,overflow:"hidden auto",...a.style},onScroll:un(a.onScroll,p=>{const x=p.currentTarget,{contentWrapper:y,shouldExpandOnScrollRef:_}=l;if(_!=null&&_.current&&y){const b=Math.abs(u.current-x.scrollTop);if(b>0){const S=window.innerHeight-sm*2,k=parseFloat(y.style.minHeight),M=parseFloat(y.style.height),P=Math.max(k,M);if(P0?z:0,y.style.justifyContent="flex-end")}}}u.current=x.scrollTop})})})]})});GOe.displayName=ofe;var KOe="SelectGroup",[Xlt,Qlt]=A3(KOe),Jlt=E.forwardRef((e,t)=>{const{__scopeSelect:n,...s}=e,a=fd();return r.jsx(Xlt,{scope:n,id:a,children:r.jsx(Fn.div,{role:"group","aria-labelledby":a,...s,ref:t})})});Jlt.displayName=KOe;var ZOe="SelectLabel",YOe=E.forwardRef((e,t)=>{const{__scopeSelect:n,...s}=e,a=Qlt(ZOe,n);return r.jsx(Fn.div,{id:a.id,...s,ref:t})});YOe.displayName=ZOe;var $te="SelectItem",[ect,XOe]=A3($te),QOe=E.forwardRef((e,t)=>{const{__scopeSelect:n,value:s,disabled:a=!1,textValue:o,...l}=e,i=kv($te,n),u=Nv($te,n),p=i.value===s,[x,y]=E.useState(o??""),[_,b]=E.useState(!1),S=la(t,T=>{var I;return(I=u.itemRefCallback)==null?void 0:I.call(u,T,s,a)}),k=fd(),M=E.useRef("touch"),P=()=>{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(ect,{scope:n,value:s,disabled:a,textId:k,isSelected:p,onItemTextChange:E.useCallback(T=>{y(I=>I||((T==null?void 0:T.textContent)??"").trim())},[]),children:r.jsx(Rse.ItemSlot,{scope:n,value:s,disabled:a,textValue:x,children:r.jsx(Fn.div,{role:"option","aria-labelledby":k,"data-highlighted":_?"":void 0,"aria-selected":p&&_,"data-state":p?"checked":"unchecked","aria-disabled":a||void 0,"data-disabled":a?"":void 0,tabIndex:a?void 0:-1,...l,ref:S,onFocus:un(l.onFocus,()=>b(!0)),onBlur:un(l.onBlur,()=>b(!1)),onClick:un(l.onClick,()=>{M.current!=="mouse"&&P()}),onPointerUp:un(l.onPointerUp,()=>{M.current==="mouse"&&P()}),onPointerDown:un(l.onPointerDown,T=>{M.current=T.pointerType}),onPointerMove:un(l.onPointerMove,T=>{var I;M.current=T.pointerType,a?(I=u.onItemLeave)==null||I.call(u):M.current==="mouse"&&T.currentTarget.focus({preventScroll:!0})}),onPointerLeave:un(l.onPointerLeave,T=>{var I;T.currentTarget===document.activeElement&&((I=u.onItemLeave)==null||I.call(u))}),onKeyDown:un(l.onKeyDown,T=>{var z;((z=u.searchRef)==null?void 0:z.current)!==""&&T.key===" "||(zlt.includes(T.key)&&P(),T.key===" "&&T.preventDefault())})})})})});QOe.displayName=$te;var PT="SelectItemText",JOe=E.forwardRef((e,t)=>{const{__scopeSelect:n,className:s,style:a,...o}=e,l=kv(PT,n),i=Nv(PT,n),u=XOe(PT,n),p=qlt(PT,n),[x,y]=E.useState(null),_=la(t,P=>y(P),u.onItemTextChange,P=>{var T;return(T=i.itemTextRefCallback)==null?void 0:T.call(i,P,u.value,u.disabled)}),b=x==null?void 0:x.textContent,S=E.useMemo(()=>r.jsx("option",{value:u.value,disabled:u.disabled,children:b},u.value),[u.disabled,u.value,b]),{onNativeOptionAdd:k,onNativeOptionRemove:M}=p;return oc(()=>(k(S),()=>M(S)),[k,M,S]),r.jsxs(r.Fragment,{children:[r.jsx(Fn.span,{id:u.textId,...o,ref:_}),u.isSelected&&l.valueNode&&!l.valueNodeHasChildren?kh.createPortal(o.children,l.valueNode):null]})});JOe.displayName=PT;var e8e="SelectItemIndicator",t8e=E.forwardRef((e,t)=>{const{__scopeSelect:n,...s}=e;return XOe(e8e,n).isSelected?r.jsx(Fn.span,{"aria-hidden":!0,...s,ref:t}):null});t8e.displayName=e8e;var lfe="SelectScrollUpButton",r8e=E.forwardRef((e,t)=>{const n=Nv(lfe,e.__scopeSelect),s=Xxe(lfe,e.__scopeSelect),[a,o]=E.useState(!1),l=la(t,s.onScrollButtonChange);return oc(()=>{if(n.viewport&&n.isPositioned){let i=function(){const p=u.scrollTop>0;o(p)};const u=n.viewport;return i(),u.addEventListener("scroll",i),()=>u.removeEventListener("scroll",i)}},[n.viewport,n.isPositioned]),a?r.jsx(s8e,{...e,ref:l,onAutoScroll:()=>{const{viewport:i,selectedItem:u}=n;i&&u&&(i.scrollTop=i.scrollTop-u.offsetHeight)}}):null});r8e.displayName=lfe;var cfe="SelectScrollDownButton",n8e=E.forwardRef((e,t)=>{const n=Nv(cfe,e.__scopeSelect),s=Xxe(cfe,e.__scopeSelect),[a,o]=E.useState(!1),l=la(t,s.onScrollButtonChange);return oc(()=>{if(n.viewport&&n.isPositioned){let i=function(){const p=u.scrollHeight-u.clientHeight,x=Math.ceil(u.scrollTop)u.removeEventListener("scroll",i)}},[n.viewport,n.isPositioned]),a?r.jsx(s8e,{...e,ref:l,onAutoScroll:()=>{const{viewport:i,selectedItem:u}=n;i&&u&&(i.scrollTop=i.scrollTop+u.offsetHeight)}}):null});n8e.displayName=cfe;var s8e=E.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:s,...a}=e,o=Nv("SelectScrollButton",n),l=E.useRef(null),i=Fse(n),u=E.useCallback(()=>{l.current!==null&&(window.clearInterval(l.current),l.current=null)},[]);return E.useEffect(()=>()=>u(),[u]),oc(()=>{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(Fn.div,{"aria-hidden":!0,...a,ref:t,style:{flexShrink:0,...a.style},onPointerDown:un(a.onPointerDown,()=>{l.current===null&&(l.current=window.setInterval(s,50))}),onPointerMove:un(a.onPointerMove,()=>{var p;(p=o.onItemLeave)==null||p.call(o),l.current===null&&(l.current=window.setInterval(s,50))}),onPointerLeave:un(a.onPointerLeave,()=>{u()})})}),tct="SelectSeparator",a8e=E.forwardRef((e,t)=>{const{__scopeSelect:n,...s}=e;return r.jsx(Fn.div,{"aria-hidden":!0,...s,ref:t})});a8e.displayName=tct;var dfe="SelectArrow",rct=E.forwardRef((e,t)=>{const{__scopeSelect:n,...s}=e,a=zse(n),o=kv(dfe,n),l=Nv(dfe,n);return o.open&&l.position==="popper"?r.jsx(ZI,{...a,...s,ref:t}):null});rct.displayName=dfe;var nct="SelectBubbleInput",i8e=E.forwardRef(({__scopeSelect:e,value:t,...n},s)=>{const a=E.useRef(null),o=la(s,a),l=aP(t);return E.useEffect(()=>{const i=a.current;if(!i)return;const u=window.HTMLSelectElement.prototype,x=Object.getOwnPropertyDescriptor(u,"value").set;if(l!==t&&x){const y=new Event("change",{bubbles:!0});x.call(i,t),i.dispatchEvent(y)}},[l,t]),r.jsx(Fn.select,{...n,style:{...nIe,...n.style},ref:o,defaultValue:t})});i8e.displayName=nct;function o8e(e){return e===""||e===void 0}function l8e(e){const t=sc(e),n=E.useRef(""),s=E.useRef(0),a=E.useCallback(l=>{const i=n.current+l;t(i),function u(p){n.current=p,window.clearTimeout(s.current),p!==""&&(s.current=window.setTimeout(()=>u(""),1e3))}(i)},[t]),o=E.useCallback(()=>{n.current="",window.clearTimeout(s.current)},[]);return E.useEffect(()=>()=>window.clearTimeout(s.current),[]),[n,a,o]}function c8e(e,t,n){const a=t.length>1&&Array.from(t).every(p=>p===t[0])?t[0]:t,o=n?e.indexOf(n):-1;let l=sct(e,Math.max(o,0));a.length===1&&(l=l.filter(p=>p!==n));const u=l.find(p=>p.textValue.toLowerCase().startsWith(a.toLowerCase()));return u!==n?u:void 0}function sct(e,t){return e.map((n,s)=>e[(t+s)%e.length])}var act=DOe,d8e=FOe,ict=BOe,oct=$Oe,lct=UOe,u8e=qOe,cct=GOe,h8e=YOe,f8e=QOe,dct=JOe,uct=t8e,p8e=r8e,m8e=n8e,g8e=a8e;const mn=act,yn=ict,fn=E.forwardRef(({className:e,children:t,...n},s)=>r.jsxs(d8e,{ref:s,className:Bt("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",e),...n,children:[t,r.jsx(oct,{asChild:!0,children:r.jsx(Dd,{className:"h-4 w-4 opacity-50"})})]}));fn.displayName=d8e.displayName;const x8e=E.forwardRef(({className:e,...t},n)=>r.jsx(p8e,{ref:n,className:Bt("flex cursor-default items-center justify-center py-1",e),...t,children:r.jsx(iy,{className:"h-4 w-4"})}));x8e.displayName=p8e.displayName;const y8e=E.forwardRef(({className:e,...t},n)=>r.jsx(m8e,{ref:n,className:Bt("flex cursor-default items-center justify-center py-1",e),...t,children:r.jsx(Dd,{className:"h-4 w-4"})}));y8e.displayName=m8e.displayName;const pn=E.forwardRef(({className:e,children:t,position:n="popper",...s},a)=>r.jsx(lct,{children:r.jsxs(u8e,{ref:a,className:Bt("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",e),position:n,...s,children:[r.jsx(x8e,{}),r.jsx(cct,{className:Bt("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:t}),r.jsx(y8e,{})]})}));pn.displayName=u8e.displayName;const hct=E.forwardRef(({className:e,...t},n)=>r.jsx(h8e,{ref:n,className:Bt("py-1.5 pl-8 pr-2 text-sm font-semibold",e),...t}));hct.displayName=h8e.displayName;const qt=E.forwardRef(({className:e,children:t,...n},s)=>r.jsxs(f8e,{ref:s,className:Bt("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",e),...n,children:[r.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:r.jsx(uct,{children:r.jsx(Ni,{className:"h-4 w-4"})})}),r.jsx(dct,{children:t})]}));qt.displayName=f8e.displayName;const fct=E.forwardRef(({className:e,...t},n)=>r.jsx(g8e,{ref:n,className:Bt("-mx-1 my-1 h-px bg-muted",e),...t}));fct.displayName=g8e.displayName;const pct=e=>Kt({queryKey:["public-listings",e],queryFn:async()=>{let t=Q.from("listings").select(` id, slug, agent_id, property_address, city, state, neighborhood, price, property_type, status, bedrooms, bathrooms, square_footage, lot_size, year_built, has_hoa, description, latitude, longitude, created_at, updated_at, photos:listing_photos(id, photo_url, is_primary), agent:profiles!listings_agent_id_fkey(id, name, email, brokerage:brokerages(name)) `).eq("is_approved",!0).eq("is_public",!0).order("created_at",{ascending:!1});e!=null&&e.status&&(t=t.eq("status",e.status)),e!=null&&e.propertyType&&(t=t.eq("property_type",e.propertyType)),e!=null&&e.city&&(t=t.ilike("city",`%${e.city}%`)),e!=null&&e.minPrice&&(t=t.gte("price",e.minPrice)),e!=null&&e.maxPrice&&(t=t.lte("price",e.maxPrice));const{data:n,error:s}=await t;if(s)throw s;return n}}),v8e=e=>Kt({queryKey:["public-listing",e],queryFn:async()=>{const t=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(e);let n=Q.from("listings").select(` id, slug, agent_id, property_address, city, state, neighborhood, price, property_type, status, bedrooms, bathrooms, square_footage, lot_size, year_built, has_hoa, description, agent_notes, agent_notes_public, mls_link, video_link, video_id, latitude, longitude, created_at, updated_at, photos:listing_photos(id, photo_url, is_primary, sort_order), agent:profiles!listings_agent_id_fkey(id, name, email, brokerage:brokerages(name)), video:agent_videos!listings_video_id_fkey(id, playback_url, thumbnail_url, title, duration_seconds, bunny_video_id) `).eq("is_approved",!0).eq("is_public",!0);t?n=n.eq("id",e):n=n.eq("slug",e);const{data:s,error:a}=await n.single();if(a)throw a;return s},enabled:!!e}),_8e=()=>ir({mutationFn:async({listingId:e,agentId:t,firstName:n,lastName:s,email:a,phone:o,shareToken:l})=>{let i=null,u=null;if(l){const{data:_}=await Q.from("listing_shares").select("id, sharing_agent_id").eq("share_token",l).eq("listing_id",e).maybeSingle();_&&(i=_.id,u=_.sharing_agent_id)}const{data:p,error:x}=await Q.from("listing_leads").insert({listing_id:e,agent_id:u||t,first_name:n,last_name:s,email:a,phone:o,share_id:i,referred_by_agent_id:u}).select().single();if(x)throw x;const{error:y}=await Q.functions.invoke("process-listing-lead",{body:{leadId:p.id}});return y&&console.error("Error processing lead:",y),p}}),mct=()=>ir({mutationFn:async e=>{const{error:t}=await Q.rpc("increment_listing_share_click",{p_share_token:e});if(t)throw t}}),gct={active:"bg-emerald-500",coming_soon:"bg-blue-600",price_improvement:"bg-orange-500",under_contract:"bg-purple-500",sold:"bg-gray-500"},Gke={active:"Active",coming_soon:"Coming Soon",price_improvement:"Price Improvement",under_contract:"Under Contract",sold:"Sold"},xct={single_family:"Single Family",condo:"Condo",townhouse:"Townhouse",land:"Land",multi_family:"Multi-Family",luxury:"Luxury",commercial:"Commercial",other:"Other"};function b8e(){const[e,t]=E.useState(""),[n,s]=E.useState(!1),[a,o]=E.useState({status:"",propertyType:"",minPrice:"",maxPrice:""}),{data:l,isLoading:i}=pct({city:e||void 0,status:a.status||void 0,propertyType:a.propertyType||void 0,minPrice:a.minPrice?Number(a.minPrice):void 0,maxPrice:a.maxPrice?Number(a.maxPrice):void 0}),u=y=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(y),p=()=>{o({status:"",propertyType:"",minPrice:"",maxPrice:""}),t("")},x=e||a.status||a.propertyType||a.minPrice||a.maxPrice;return r.jsxs(r.Fragment,{children:[r.jsxs($m,{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(oo,{to:"/public/listings",className:"flex items-center",children:r.jsx("img",{src:POe,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(${Llt})`},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(Sa,{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:e,onChange:y=>t(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(Sa,{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(jA,{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(mn,{value:a.status||"all",onValueChange:y=>o({...a,status:y==="all"?"":y}),children:[r.jsx(fn,{className:"bg-white",children:r.jsx(yn,{placeholder:"Any status"})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"all",children:"Any status"}),Object.entries(Gke).map(([y,_])=>r.jsx(qt,{value:y,children:_},y))]})]})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-gray-700 mb-1.5 block",children:"Property Type"}),r.jsxs(mn,{value:a.propertyType||"all",onValueChange:y=>o({...a,propertyType:y==="all"?"":y}),children:[r.jsx(fn,{className:"bg-white",children:r.jsx(yn,{placeholder:"Any type"})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"all",children:"Any type"}),Object.entries(xct).map(([y,_])=>r.jsx(qt,{value:y,children:_},y))]})]})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-gray-700 mb-1.5 block",children:"Min Price"}),r.jsx(dt,{type:"number",placeholder:"No min",value:a.minPrice,onChange:y=>o({...a,minPrice:y.target.value}),className:"bg-white"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium text-gray-700 mb-1.5 block",children:"Max Price"}),r.jsx(dt,{type:"number",placeholder:"No max",value:a.maxPrice,onChange:y=>o({...a,maxPrice:y.target.value}),className:"bg-white"})]})]}),x&&r.jsx("div",{className:"flex justify-end mt-4",children:r.jsxs(ee,{variant:"ghost",size:"sm",onClick:p,className:"gap-1 text-gray-500",children:[r.jsx(hs,{className:"h-4 w-4"}),"Clear all"]})})]})]})]})]}),l&&l.length>0&&r.jsx("section",{className:"py-8 bg-white border-b border-gray-200",children:r.jsxs("div",{className:"max-w-7xl mx-auto px-4",children:[r.jsx("h2",{className:"text-xl font-semibold text-gray-900 mb-4",children:"Explore on Map"}),r.jsx(Rlt,{listings:l,isLoading:i})]})}),r.jsx("section",{className:"py-8",children:r.jsx("div",{className:"max-w-7xl mx-auto px-4",children:i?r.jsx("div",{className:"grid sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-5",children:[...Array(8)].map((y,_)=>r.jsxs("div",{className:"bg-white rounded-lg overflow-hidden shadow-sm",children:[r.jsx(Lr,{className:"aspect-[4/3]"}),r.jsxs("div",{className:"p-4 space-y-3",children:[r.jsx(Lr,{className:"h-7 w-28"}),r.jsx(Lr,{className:"h-4 w-full"}),r.jsx(Lr,{className:"h-4 w-3/4"})]})]},_))}):l&&l.length>0?r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"flex items-center justify-between mb-6",children:r.jsxs("h2",{className:"text-xl font-semibold text-gray-900",children:[l.length," ",l.length===1?"Home":"Homes"," Available"]})}),r.jsx("div",{className:"grid sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-5",children:l.map(y=>{var k,M,P;const _=((k=y.photos)==null?void 0:k.find(T=>T.is_primary))||((M=y.photos)==null?void 0:M[0]),S=window.location.hostname==="listings.relevelup.com"||window.location.hostname.startsWith("listings.")?`/${y.slug||y.id}`:`/public/listing/${y.slug||y.id}`;return r.jsx(oo,{to:S,children:r.jsxs("div",{className:"bg-white rounded-lg overflow-hidden shadow-sm hover:shadow-lg transition-shadow cursor-pointer group border border-gray-100",children:[r.jsxs("div",{className:"aspect-[4/3] relative overflow-hidden bg-gray-100",children:[_?r.jsx("img",{src:_.photo_url,alt:y.property_address||y.city,className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-300"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center",children:r.jsx(xa,{className:"h-12 w-12 text-gray-300"})}),r.jsx(Pt,{className:`absolute top-2 left-2 ${gct[y.status]} text-white border-0 text-xs font-medium px-2 py-0.5`,children:Gke[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(xi,{className:"h-5 w-5 text-gray-600"})})]}),r.jsxs("div",{className:"p-4",children:[r.jsx("p",{className:"text-xl font-bold text-gray-900 mb-1",children:u(y.price)}),r.jsxs("div",{className:"flex items-center gap-1 text-sm text-gray-700 mb-2",children:[y.bedrooms&&r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"font-semibold",children:y.bedrooms}),r.jsx("span",{className:"text-gray-500",children:"bds"}),r.jsx("span",{className:"text-gray-300 mx-1",children:"|"})]}),y.bathrooms&&r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"font-semibold",children:y.bathrooms}),r.jsx("span",{className:"text-gray-500",children:"ba"}),r.jsx("span",{className:"text-gray-300 mx-1",children:"|"})]}),y.square_footage&&r.jsxs(r.Fragment,{children:[r.jsx("span",{className:"font-semibold",children:y.square_footage.toLocaleString()}),r.jsx("span",{className:"text-gray-500",children:"sqft"})]})]}),y.property_address&&r.jsx("p",{className:"text-sm text-gray-700 truncate",children:y.property_address}),r.jsxs("p",{className:"text-sm text-gray-500 truncate",children:[y.city,", ",y.state]}),y.agent&&r.jsxs("div",{className:"mt-3 pt-3 border-t border-gray-100",children:[r.jsx("p",{className:"text-xs text-gray-500 truncate",children:y.agent.name}),((P=y.agent.brokerage)==null?void 0:P.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(xa,{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:Yxe,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 Ze=E.forwardRef(({className:e,...t},n)=>r.jsx("div",{ref:n,className:Bt("rounded-lg border bg-card text-card-foreground shadow-sm",e),...t}));Ze.displayName="Card";const Wt=E.forwardRef(({className:e,...t},n)=>r.jsx("div",{ref:n,className:Bt("flex flex-col space-y-1.5 p-6",e),...t}));Wt.displayName="CardHeader";const Yt=E.forwardRef(({className:e,...t},n)=>r.jsx("h3",{ref:n,className:Bt("text-2xl font-semibold leading-none tracking-tight",e),...t}));Yt.displayName="CardTitle";const Sn=E.forwardRef(({className:e,...t},n)=>r.jsx("p",{ref:n,className:Bt("text-sm text-muted-foreground",e),...t}));Sn.displayName="CardDescription";const et=E.forwardRef(({className:e,...t},n)=>r.jsx("div",{ref:n,className:Bt("p-6 pt-0",e),...t}));et.displayName="CardContent";const PA=E.forwardRef(({className:e,...t},n)=>r.jsx("div",{ref:n,className:Bt("flex items-center p-6 pt-0",e),...t}));PA.displayName="CardFooter";var yct="Label",w8e=E.forwardRef((e,t)=>r.jsx(Fn.label,{...e,ref:t,onMouseDown:n=>{var a;n.target.closest("button, input, select, textarea")||((a=e.onMouseDown)==null||a.call(e,n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));w8e.displayName=yct;var j8e=w8e;const vct=g3("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),$e=E.forwardRef(({className:e,...t},n)=>r.jsx(j8e,{ref:n,className:Bt(vct(),e),...t}));$e.displayName=j8e.displayName;const Ute="/assets/levelup-logo-color-D3mY9gCJ.png";function _ct(){const e=Bm(),t=window.location.hostname;if(!(t==="listings.relevelup.com"||t.startsWith("listings.")))return null;const s=e.pathname.slice(1);return!s||s===""?r.jsx(b8e,{}):s.startsWith("public/")?null:r.jsx(bct,{slug:s})}function bct({slug:e}){return r.jsx(kct,{slug:e})}const wct={active:"bg-emerald-500",coming_soon:"bg-sky-500",price_improvement:"bg-orange-500",under_contract:"bg-purple-500",sold:"bg-gray-500"},jct={active:"Active",coming_soon:"Coming Soon",price_improvement:"Price Improvement",under_contract:"Under Contract",sold:"Sold"},Kke={single_family:"Single Family",condo:"Condo",townhouse:"Townhouse",land:"Land",multi_family:"Multi-Family",luxury:"Luxury",commercial:"Commercial",other:"Other"};function kct({slug:e}){var G,J;const{data:t,isLoading:n}=v8e(e),s=_8e(),[a,o]=E.useState(""),[l,i]=E.useState(""),[u,p]=E.useState(""),[x,y]=E.useState(""),[_,b]=E.useState(!1),[S,k]=E.useState(!1),[M,P]=E.useState(null),T=ne=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(ne),I=async ne=>{if(ne.preventDefault(),!(!a.trim()||!u.trim()||!t)){b(!0);try{await s.mutateAsync({listingId:t.id,agentId:t.agent_id,firstName:a.trim(),lastName:l.trim(),email:u.trim(),phone:x.trim()}),k(!0),Ie.success("Thanks! The agent will be in touch soon.")}catch(oe){console.error("Lead submission error:",oe),Ie.error(`Failed to submit: ${oe.message||"Please try again"}`)}finally{b(!1)}}},z=(t==null?void 0:t.photos)||[],D=z.find(ne=>ne.is_primary)||z[0],U=()=>{M!==null&&P(M===0?z.length-1:M-1)},V=()=>{M!==null&&P(M===z.length-1?0:M+1)};if(n)return r.jsxs("div",{className:"min-h-screen bg-background",children:[r.jsx("header",{className:"border-b bg-card",children:r.jsx("div",{className:"container mx-auto px-4 py-4",children:r.jsx(Lr,{className:"h-8 w-32"})})}),r.jsxs("div",{className:"container mx-auto px-4 py-8",children:[r.jsx(Lr,{className:"h-10 w-48 mb-6"}),r.jsx(Lr,{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(Lr,{className:"h-12 w-48"}),r.jsx(Lr,{className:"h-6 w-full"}),r.jsx(Lr,{className:"h-6 w-3/4"})]}),r.jsx(Lr,{className:"h-64"})]})]})]});if(!t)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:Ute,alt:"LevelUp",className:"h-8"})})})}),r.jsxs("div",{className:"container mx-auto px-4 py-16 text-center",children:[r.jsx(xa,{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 W=t.property_address?`${t.property_address} - ${t.city}, ${t.state}`:`${t.city}, ${t.state} Home for Sale`;return r.jsxs(r.Fragment,{children:[r.jsxs($m,{children:[r.jsxs("title",{children:[W," | LevelUp Listings"]}),r.jsx("meta",{name:"description",content:`${T(t.price)} - ${t.bedrooms||""}BD ${t.bathrooms||""}BA ${t.square_footage?t.square_footage.toLocaleString()+" sqft":""} ${Kke[t.property_type]} in ${t.city}, ${t.state}. ${((G=t.description)==null?void 0:G.slice(0,150))||""}`}),r.jsx("meta",{property:"og:title",content:W}),r.jsx("meta",{property:"og:description",content:`${T(t.price)} - ${t.bedrooms||""}BD ${t.bathrooms||""}BA in ${t.city}, ${t.state}`}),r.jsx("meta",{property:"og:type",content:"website"}),D&&r.jsx("meta",{property:"og:image",content:D.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:Ute,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(po,{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:()=>P(0),children:r.jsx("img",{src:D==null?void 0:D.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((ne,oe)=>r.jsxs("div",{className:"aspect-square rounded-lg overflow-hidden bg-muted cursor-pointer relative",onClick:()=>P(oe+1),children:[r.jsx("img",{src:ne.photo_url,alt:`Photo ${oe+2}`,className:"w-full h-full object-cover hover:scale-105 transition-transform duration-300"}),oe===3&&z.length>5&&r.jsxs("div",{className:"absolute inset-0 bg-black/60 flex items-center justify-center text-white font-semibold",children:["+",z.length-5," more"]})]},ne.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(Pt,{className:`${wct[t.status]} text-white border-0`,children:jct[t.status]})}),r.jsx("h1",{className:"text-4xl font-bold text-primary mb-2",children:T(t.price)}),t.property_address&&r.jsx("p",{className:"text-xl font-medium",children:t.property_address}),r.jsxs("p",{className:"text-muted-foreground flex items-center gap-1",children:[r.jsx(Po,{className:"h-4 w-4"}),t.city,", ",t.state,t.neighborhood&&` • ${t.neighborhood}`]})]}),r.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-4 py-4 border-y",children:[t.bedrooms&&r.jsxs("div",{className:"text-center",children:[r.jsx(z1,{className:"h-6 w-6 mx-auto mb-1 text-muted-foreground"}),r.jsx("p",{className:"text-xl font-semibold",children:t.bedrooms}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Beds"})]}),t.bathrooms&&r.jsxs("div",{className:"text-center",children:[r.jsx(F1,{className:"h-6 w-6 mx-auto mb-1 text-muted-foreground"}),r.jsx("p",{className:"text-xl font-semibold",children:t.bathrooms}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Baths"})]}),t.square_footage&&r.jsxs("div",{className:"text-center",children:[r.jsx(Fg,{className:"h-6 w-6 mx-auto mb-1 text-muted-foreground"}),r.jsx("p",{className:"text-xl font-semibold",children:t.square_footage.toLocaleString()}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Sq Ft"})]}),t.year_built&&r.jsxs("div",{className:"text-center",children:[r.jsx(Ss,{className:"h-6 w-6 mx-auto mb-1 text-muted-foreground"}),r.jsx("p",{className:"text-xl font-semibold",children:t.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(Pt,{variant:"secondary",children:[r.jsx(hi,{className:"h-3 w-3 mr-1"}),Kke[t.property_type]]}),t.lot_size&&r.jsxs(Pt,{variant:"secondary",children:["Lot: ",t.lot_size]}),t.has_hoa&&r.jsx(Pt,{variant:"secondary",children:"HOA"})]}),t.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:t.description})]}),t.agent_notes&&t.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:t.agent_notes})]}),t.mls_link&&r.jsx(ee,{variant:"outline",asChild:!0,children:r.jsxs("a",{href:t.mls_link,target:"_blank",rel:"noopener noreferrer",children:[r.jsx(As,{className:"h-4 w-4 mr-2"}),"View on MLS"]})})]})]}),r.jsxs("div",{className:"space-y-6",children:[t.agent&&r.jsxs(Ze,{children:[r.jsx(Wt,{children:r.jsxs(Yt,{className:"text-lg flex items-center gap-2",children:[r.jsx(ic,{className:"h-5 w-5"}),"Listing Agent"]})}),r.jsxs(et,{children:[r.jsx("p",{className:"font-semibold text-lg",children:t.agent.name}),((J=t.agent.brokerage)==null?void 0:J.name)&&r.jsx("p",{className:"text-sm text-muted-foreground",children:t.agent.brokerage.name})]})]}),r.jsxs(Ze,{className:"border-primary",children:[r.jsx(Wt,{children:r.jsx(Yt,{className:"text-lg",children:"Interested in this property?"})}),r.jsx(et,{children:S?r.jsxs("div",{className:"text-center py-4",children:[r.jsx("div",{className:"h-12 w-12 rounded-full bg-primary/10 flex items-center justify-center mx-auto mb-3",children:r.jsx(Ns,{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:I,className:"space-y-3",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsxs("div",{children:[r.jsx($e,{htmlFor:"firstName",children:"First Name *"}),r.jsx(dt,{id:"firstName",type:"text",placeholder:"John",value:a,onChange:ne=>o(ne.target.value),required:!0})]}),r.jsxs("div",{children:[r.jsx($e,{htmlFor:"lastName",children:"Last Name"}),r.jsx(dt,{id:"lastName",type:"text",placeholder:"Doe",value:l,onChange:ne=>i(ne.target.value)})]})]}),r.jsxs("div",{children:[r.jsx($e,{htmlFor:"email",children:"Email *"}),r.jsx(dt,{id:"email",type:"email",placeholder:"you@example.com",value:u,onChange:ne=>p(ne.target.value),required:!0})]}),r.jsxs("div",{children:[r.jsx($e,{htmlFor:"phone",children:"Phone"}),r.jsx(dt,{id:"phone",type:"tel",placeholder:"(555) 123-4567",value:x,onChange:ne=>y(ne.target.value)})]}),r.jsx(ee,{type:"submit",className:"w-full",disabled:_,children:_?"Submitting...":"Get More Info"}),r.jsx("p",{className:"text-xs text-muted-foreground text-center",children:"The listing agent will reach out to you directly."})]})})]})]})]})]}),r.jsx(Or,{open:M!==null,onOpenChange:()=>P(null),children:r.jsxs(Ir,{className:"max-w-5xl p-0 bg-black/95",children:[r.jsx($r,{className:"sr-only",children:r.jsx(Fr,{children:"Photo Gallery"})}),r.jsx("button",{onClick:()=>P(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(hs,{className:"h-5 w-5"})}),M!==null&&z[M]&&r.jsxs("div",{className:"relative",children:[r.jsx("img",{src:z[M].photo_url,alt:`Photo ${M+1}`,className:"w-full max-h-[80vh] object-contain"}),z.length>1&&r.jsxs(r.Fragment,{children:[r.jsx("button",{onClick:U,className:"absolute left-4 top-1/2 -translate-y-1/2 rounded-full bg-black/50 p-2 text-white hover:bg-black/70",children:r.jsx(kc,{className:"h-6 w-6"})}),r.jsx("button",{onClick:V,className:"absolute right-4 top-1/2 -translate-y-1/2 rounded-full bg-black/50 p-2 text-white hover:bg-black/70",children:r.jsx(Wi,{className:"h-6 w-6"})}),r.jsxs("div",{className:"absolute bottom-4 left-1/2 -translate-x-1/2 text-white bg-black/50 px-3 py-1 rounded-full text-sm",children:[M+1," / ",z.length]})]})]})]})}),r.jsx("footer",{className:"border-t py-8 mt-16",children:r.jsxs("div",{className:"container mx-auto px-4 text-center text-sm text-muted-foreground",children:[r.jsxs("p",{children:["© ",new Date().getFullYear()," LevelUp. All rights reserved."]}),r.jsx("p",{className:"mt-2",children:r.jsx("a",{href:"https://relevelup.com",target:"_blank",rel:"noopener noreferrer",className:"hover:text-foreground",children:"relevelup.com"})})]})})]})]})}function Bse({card:e,variant:t}){const n=e.brokerage_display_name||e.brokerage_logo_url,s=e.team_name||e.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]"}}[t];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:[e.brokerage_logo_url&&r.jsx("img",{src:e.brokerage_logo_url,alt:e.brokerage_display_name||"Brokerage",style:{height:`${e.brokerage_logo_size||56}px`},className:"max-w-[280px] object-contain"}),e.brokerage_display_name&&!e.brokerage_logo_url&&r.jsx("p",{className:`text-sm font-medium ${a.text}`,children:e.brokerage_display_name})]}),s&&r.jsxs("div",{className:`flex flex-col items-center gap-1.5 w-full ${n?"pt-3":""}`,children:[e.team_logo_url&&r.jsx("img",{src:e.team_logo_url,alt:e.team_name||"Team",style:{height:`${e.team_logo_size||56}px`},className:"max-w-[280px] object-contain"}),e.team_name&&!e.team_logo_url&&r.jsx("p",{className:`text-sm font-medium ${a.text}`,children:e.team_name})]})]})})}const k8e=e=>Kt({queryKey:["agent-card-public",e],queryFn:async()=>{if(!e)throw new Error("No slug provided");const{data:t,error:n}=await Q.from("agent_cards").select("*").eq("slug",e).eq("is_published",!0).single();if(n)throw n;const{data:s}=await Q.from("profiles").select("name, email, phone, brokerage_id").eq("id",t.user_id).single();let a=null;if(s!=null&&s.brokerage_id){const{data:l}=await Q.from("brokerages").select("name").eq("id",s.brokerage_id).single();a=(l==null?void 0:l.name)||null}let o=null;try{const{data:l}=await Q.from("profiles").select("avatar_url").eq("id",t.user_id).single();if(l!=null&&l.avatar_url)o=l.avatar_url;else{const{data:i}=await Q.storage.from("avatars").list(`${t.user_id}`);if(i&&i.length>0){const{data:u}=Q.storage.from("avatars").getPublicUrl(`${t.user_id}/${i[0].name}`);o=`${u.publicUrl}?t=${Date.now()}`}}}catch{}return{...t,social_links:t.social_links||[],profile:s||{name:null,email:null,phone:null,brokerage_id:null},brokerage_name:t.brokerage_display_name||a,avatar_url:o}},enabled:!!e}),Nct=()=>Kt({queryKey:["agent-cards-admin"],queryFn:async()=>{const{data:e,error:t}=await Q.from("agent_cards").select("*").order("created_at",{ascending:!1});if(t)throw t;return e}}),Sct=e=>Kt({queryKey:["agent-card",e],queryFn:async()=>{if(!e)return null;const{data:t,error:n}=await Q.from("agent_cards").select("*").eq("user_id",e).maybeSingle();if(n)throw n;return t},enabled:!!e}),N8e=()=>{const e=Hr();return ir({mutationFn:async t=>{const{data:n,error:s}=await Q.from("agent_cards").insert(t).select().single();if(s)throw s;return n},onSuccess:()=>{e.invalidateQueries({queryKey:["agent-cards-admin"]}),e.invalidateQueries({queryKey:["agent-card"]}),Ie.success("Agent card created")},onError:t=>Ie.error(t.message)})},S8e=()=>{const e=Hr();return ir({mutationFn:async({id:t,...n})=>{const{data:s,error:a}=await Q.from("agent_cards").update(n).eq("id",t).select().single();if(a)throw a;return s},onSuccess:(t,n)=>{e.invalidateQueries({queryKey:["agent-cards-admin"]}),e.invalidateQueries({queryKey:["agent-card"]}),Ie.success("Agent card updated")},onError:t=>Ie.error(t.message)})},zi=async(e,t,n,s)=>{const a=new URLSearchParams(window.location.search);await Q.from("agent_card_interactions").insert({card_id:e,interaction_type:t,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:{}})},Cct=async(e,t)=>{const{error:n}=await Q.from("agent_card_leads").insert({card_id:e,...t});if(n)throw n},C8e=e=>Kt({queryKey:["agent-card-analytics",e],queryFn:async()=>{if(!e)return null;const{data:t,error:n}=await Q.from("agent_card_interactions").select("interaction_type, interaction_detail, created_at").eq("card_id",e).order("created_at",{ascending:!1}).limit(500);if(n)throw n;const{data:s,error:a}=await Q.from("agent_card_leads").select("*").eq("card_id",e).order("created_at",{ascending:!1});if(a)throw a;const o=(t==null?void 0:t.filter(u=>u.interaction_type==="card_view").length)||0,l=(t==null?void 0:t.filter(u=>u.interaction_type==="button_click").length)||0,i=(t==null?void 0:t.filter(u=>u.interaction_type==="contact_saved").length)||0;return{views:o,clicks:l,saves:i,leads:s||[],interactions:t||[]}},enabled:!!e});function $se({open:e,onOpenChange:t,cardId:n,type:s,agentName:a}){const[o,l]=E.useState(""),[i,u]=E.useState(""),[p,x]=E.useState(""),[y,_]=E.useState(""),[b,S]=E.useState(""),[k,M]=E.useState(!1),P=async T=>{if(T.preventDefault(),!o.trim()){Ie.error("Please enter your name");return}M(!0);try{await Cct(n,{lead_type:s,name:o.trim(),email:i.trim()||void 0,phone:p.trim()||void 0,message:b.trim()||void 0,intent:y||void 0}),zi(n,"lead_submitted",s),Q.functions.invoke("card-lead-notify",{body:{cardId:n,leadType:s,name:o.trim(),email:i.trim()||void 0,phone:p.trim()||void 0,message:b.trim()||void 0,intent:y||void 0}}).catch(I=>console.error("Card lead notify failed:",I)),Ie.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."),t(!1),l(""),u(""),x(""),_(""),S("")}catch{Ie.error("Something went wrong. Please try again.")}finally{M(!1)}};return r.jsx(Or,{open:e,onOpenChange:t,children:r.jsxs(Ir,{className:"sm:max-w-md rounded-2xl",children:[r.jsxs($r,{children:[r.jsx(Fr,{children:s==="booking"?"Book a Call":s==="connect"?"Connect with Me":"Refer a Friend"}),r.jsx(Zn,{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:P,className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx($e,{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($e,{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($e,{htmlFor:"lead-email",children:"Email"}),r.jsx(dt,{id:"lead-email",type:"email",value:i,onChange:T=>u(T.target.value),placeholder:"you@example.com"})]}),s==="booking"&&r.jsxs("div",{children:[r.jsx($e,{htmlFor:"lead-intent",children:"I'm looking to..."}),r.jsxs(mn,{value:y,onValueChange:_,children:[r.jsx(fn,{children:r.jsx(yn,{placeholder:"Select one"})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"buy",children:"Buy a home"}),r.jsx(qt,{value:"sell",children:"Sell my home"}),r.jsx(qt,{value:"both",children:"Buy & Sell"}),r.jsx(qt,{value:"other",children:"Something else"})]})]})]}),s!=="connect"&&r.jsxs("div",{children:[r.jsx($e,{htmlFor:"lead-message",children:s==="referral"?"Tell us about them":"Message (optional)"}),r.jsx(dt,{id:"lead-message",value:b,onChange:T=>S(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:k,children:k?"Sending...":"Submit"})]})]})})}const Mct=e=>Kt({queryKey:["card-blocks",e],queryFn:async()=>{if(!e)return[];const{data:t,error:n}=await Q.from("card_blocks").select("*").eq("card_id",e).eq("is_visible",!0).order("sort_order",{ascending:!0});if(n)throw n;return t||[]},enabled:!!e}),Tct=e=>Kt({queryKey:["card-blocks-all",e],queryFn:async()=>{if(!e)return[];const{data:t,error:n}=await Q.from("card_blocks").select("*").eq("card_id",e).order("sort_order",{ascending:!0});if(n)throw n;return t||[]},enabled:!!e}),Act=()=>{const e=Hr();return ir({mutationFn:async t=>{const{data:n,error:s}=await Q.from("card_blocks").insert(t).select().single();if(s)throw s;return n},onSuccess:(t,n)=>{e.invalidateQueries({queryKey:["card-blocks",n.card_id]}),e.invalidateQueries({queryKey:["card-blocks-all",n.card_id]}),Ie.success("Block added")},onError:t=>Ie.error(t.message)})},Ect=()=>{const e=Hr();return ir({mutationFn:async({id:t,...n})=>{const{data:s,error:a}=await Q.from("card_blocks").update(n).eq("id",t).select().single();if(a)throw a;return s},onSuccess:()=>{e.invalidateQueries({queryKey:["card-blocks"]}),e.invalidateQueries({queryKey:["card-blocks-all"]}),Ie.success("Block updated")},onError:t=>Ie.error(t.message)})},Ict=()=>{const e=Hr();return ir({mutationFn:async t=>{const{error:n}=await Q.from("card_blocks").delete().eq("id",t);if(n)throw n},onSuccess:()=>{e.invalidateQueries({queryKey:["card-blocks"]}),e.invalidateQueries({queryKey:["card-blocks-all"]}),Ie.success("Block removed")},onError:t=>Ie.error(t.message)})};function Pct(e){const t=e.match(/(?:iframe\.mediadelivery\.net\/embed\/|video\.bunnycdn\.com\/play\/)(\d+)\/([a-f0-9-]+)/i);return t?`https://iframe.mediadelivery.net/embed/${t[1]}/${t[2]}?autoplay=false&responsive=true`:(e.includes("iframe.mediadelivery.net"),e)}function Lct(e){const t=e.match(/(?:youtube\.com\/watch\?v=|youtu\.be\/|youtube\.com\/embed\/)([a-zA-Z0-9_-]{11})/);return t?`https://www.youtube.com/embed/${t[1]}`:null}const Oct={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 Dct({block:e,variant:t}){const n=e.config;if(!n.video_url)return null;const s=n.video_url.includes("mediadelivery.net")||n.video_url.includes("bunnycdn.com"),a=Lct(n.video_url),o=s||!!a,l=s?Pct(n.video_url):a||n.video_url;return r.jsx("div",{className:Oct[t],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 Rct={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 Fct({block:e,variant:t}){const s=e.config.testimonials||[],[a,o]=E.useState(0);if(s.length===0)return null;const l=Rct[t],i=s[a];return r.jsxs("div",{className:l.container,children:[r.jsxs("div",{className:l.card,children:[r.jsx(xA,{className:"h-4 w-4 mb-2 opacity-30"}),r.jsxs("p",{className:`${l.quote} mb-3`,children:['"',i.quote,'"']}),r.jsxs("div",{children:[r.jsx("p",{className:l.name,children:i.name}),i.role&&r.jsx("p",{className:l.role,children:i.role})]})]}),s.length>1&&r.jsxs("div",{className:"flex items-center justify-center gap-3 mt-3",children:[r.jsx("button",{onClick:()=>o(u=>(u-1+s.length)%s.length),className:l.nav,children:r.jsx(kc,{className:"h-4 w-4"})}),r.jsx("div",{className:"flex gap-1.5",children:s.map((u,p)=>r.jsx("div",{className:`h-1.5 w-1.5 rounded-full transition-colors cursor-pointer ${p===a?l.dot:l.dotInactive}`,onClick:()=>o(p)},p))}),r.jsx("button",{onClick:()=>o(u=>(u+1)%s.length),className:l.nav,children:r.jsx(Wi,{className:"h-4 w-4"})})]})]})}const zct={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 Bct({block:e,variant:t}){const s=e.config.tags||[];if(s.length===0)return null;const a=zct[t];return r.jsx("div",{className:a.container,children:s.map((o,l)=>r.jsx("span",{className:a.tag,children:o},l))})}const $ct={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 Uct({block:e,cardId:t,variant:n}){const a=e.config.links||[];if(a.length===0)return null;const o=$ct[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:()=>zi(t,"button_click",`custom_link_${l.label}`),className:o.link,children:[r.jsx("span",{children:l.label}),r.jsx(As,{className:`h-4 w-4 ${o.icon}`})]},i))})}const ufe={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"},spotify:{label:"Spotify",icon:"M12 0C5.4 0 0 5.4 0 12s5.4 12 12 12 12-5.4 12-12S18.66 0 12 0zm5.521 17.34c-.24.359-.66.48-1.021.24-2.82-1.74-6.36-2.101-10.561-1.141-.418.122-.779-.179-.899-.539-.12-.421.18-.78.54-.9 4.56-1.021 8.52-.6 11.64 1.32.42.18.479.659.301 1.02zm1.44-3.3c-.301.42-.841.6-1.262.3-3.239-1.98-8.159-2.58-11.939-1.38-.479.12-1.02-.12-1.14-.6-.12-.48.12-1.021.6-1.141C9.6 9.9 15 10.561 18.72 12.84c.361.181.54.78.241 1.2zm.12-3.36C15.24 8.4 8.82 8.16 5.16 9.301c-.6.179-1.2-.181-1.38-.721-.18-.601.18-1.2.72-1.381 4.26-1.26 11.28-1.02 15.721 1.621.539.3.719 1.02.419 1.56-.299.421-1.02.599-1.559.3z",color:"#1DB954",hoverBg:"hover:bg-[#1DB954]/10"},apple_music:{label:"Apple Music",icon:"M23.994 6.124a9.23 9.23 0 00-.24-2.19c-.317-1.31-1.062-2.31-2.18-3.043A5.022 5.022 0 0019.7.198a10.7 10.7 0 00-1.564-.15C17.637.017 17.14 0 12.002 0h-.004C6.858 0 6.362.017 5.862.047 5.34.08 4.82.13 4.309.325a5.017 5.017 0 00-1.874.826C1.317 2.07.573 3.07.255 4.38A9.234 9.234 0 00.02 6.57C-.013 7.068-.03 7.564 0 12.002v.004c-.03 4.438.013 4.934.047 5.432.033.522.083 1.042.278 1.554a5.017 5.017 0 00.826 1.874c.92 1.118 1.92 1.862 3.23 2.18a9.23 9.23 0 002.19.24c.498.03.994.013 5.432.047h.004c4.438.034 4.934-.013 5.432-.047a9.23 9.23 0 002.19-.24c1.31-.317 2.31-1.062 3.043-2.18a5.022 5.022 0 00.627-1.874c.195-.492.245-1.012.278-1.534.03-.498.047-.994.047-5.432v-.004c.034-4.438-.013-4.934-.047-5.432zM17.42 16.41c0 .612-.15 1.21-.44 1.758a3.58 3.58 0 01-1.207 1.31c-.518.339-1.09.521-1.705.545-.13.005-.26 0-.39-.017a2.617 2.617 0 01-1.653-.772 2.305 2.305 0 01-.668-1.653c-.005-.13 0-.26.017-.39.07-.52.275-.986.602-1.39a2.998 2.998 0 011.218-.94 3.14 3.14 0 011.12-.282c.17-.009.336.002.502.034V9.472L10.2 10.637v7.093c0 .612-.15 1.21-.44 1.758a3.58 3.58 0 01-1.207 1.31c-.518.339-1.09.521-1.705.545-.13.005-.26 0-.39-.017a2.617 2.617 0 01-1.653-.772A2.305 2.305 0 014.137 18.9c-.005-.13 0-.26.017-.39.07-.52.275-.986.602-1.39a2.998 2.998 0 011.218-.94 3.14 3.14 0 011.12-.282c.17-.009.336.002.502.034V8.377c0-.453.066-.903.195-1.34a3.2 3.2 0 01.694-1.204 2.62 2.62 0 011.063-.738c.39-.14.793-.208 1.196-.196l4.84-1.01v10.52z",color:"#FA243C",hoverBg:"hover:bg-[#FA243C]/10"}};function qct({path:e,color:t,size:n=20}){return r.jsx("svg",{viewBox:"0 0 24 24",width:n,height:n,fill:t,children:r.jsx("path",{d:e})})}const Vct={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 Hct({block:e,cardId:t,variant:n}){const a=e.config.platforms||[],o=Vct[n];return a.length===0?null:r.jsxs("div",{className:o.container,children:[r.jsx("h3",{className:o.title,children:"Follow Me"}),r.jsx("div",{className:"flex flex-wrap gap-3 justify-center",children:a.map((l,i)=>{const u=ufe[l.platform.toLowerCase()];return!u||!l.url?null:r.jsx("a",{href:l.url,target:"_blank",rel:"noopener noreferrer",onClick:()=>zi(t,"button_click",`social_${l.platform}`),className:o.linkClass,title:u.label,children:r.jsx(qct,{path:u.icon,color:u.color})},i)})})]})}function Use({cardId:e,variant:t}){const{data:n}=Mct(e);if(!n||n.length===0)return null;const s=n.filter(l=>l.block_type==="social_media"&&l.is_visible),a=n.filter(l=>l.block_type!=="social_media"),o=s.length>0?{...s[0],config:{platforms:s.flatMap(l=>l.config.platforms||[])}}:null;return n.findIndex(l=>l.block_type==="social_media"),r.jsxs(r.Fragment,{children:[a.map(l=>{switch(l.block_type){case"video_intro":return r.jsx(Dct,{block:l,variant:t},l.id);case"testimonials":return r.jsx(Fct,{block:l,variant:t},l.id);case"specialties":return r.jsx(Bct,{block:l,variant:t},l.id);case"custom_links":return r.jsx(Uct,{block:l,cardId:e,variant:t},l.id);default:return null}}),o&&r.jsx(Hct,{block:o,cardId:e,variant:t})]})}async function Wct(e){try{const t=await fetch(e);if(!t.ok)return null;const n=await t.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 Gct(e){const t=e.trim().split(/\s+/);if(t.length<=1)return{first:t[0]||"",last:""};const n=t.pop();return{first:t.join(" "),last:n}}async function qse(e){const{first:t,last:n}=Gct(e.name),s=["BEGIN:VCARD","VERSION:3.0",`FN:${e.name}`,`N:${n};${t};;;`];if(e.phone&&s.push(`TEL;TYPE=CELL:${e.phone}`),e.email&&s.push(`EMAIL;TYPE=INTERNET:${e.email}`),e.brokerage&&s.push(`ORG:${e.brokerage}`),s.push(`URL:${e.cardUrl}`),e.avatarUrl){const i=await Wct(e.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=`${e.name.replace(/\s+/g,"_")}.vcf`,l.click(),URL.revokeObjectURL(o),Ie.success("Contact saved!")}function Kct({card:e}){var P;const[t,n]=E.useState(!1),[s,a]=E.useState("booking"),o=((P=e.profile)==null?void 0:P.name)||"Agent",l=o.split(" ").map(T=>T[0]).join("").toUpperCase().slice(0,2),i=(T,I)=>{zi(e.id,"button_click",T),I()},u=()=>i("call",()=>{var T;(T=e.profile)!=null&&T.phone?window.location.href=`tel:${e.profile.phone}`:Ie.error("Phone number not available")}),p=()=>i("text",()=>{var T;(T=e.profile)!=null&&T.phone?window.location.href=`sms:${e.profile.phone}`:Ie.error("Phone number not available")}),x=()=>i("email",()=>{var T;(T=e.profile)!=null&&T.email?window.location.href=`mailto:${e.profile.email}`:Ie.error("Email not available")}),y=()=>{e.booking_url?i("book",()=>window.open(e.booking_url,"_blank")):(a("booking"),n(!0),zi(e.id,"button_click","book"))},_=()=>{var T,I;zi(e.id,"contact_saved"),qse({name:o,phone:(T=e.profile)==null?void 0:T.phone,email:(I=e.profile)==null?void 0:I.email,brokerage:e.brokerage_name,avatarUrl:e.avatar_url,cardUrl:window.location.href})},b=async()=>{if(zi(e.id,"share_event"),navigator.share)try{await navigator.share({title:`${o} - Real Estate Agent`,text:e.positioning_statement||`Connect with ${o}`,url:window.location.href})}catch{}else await navigator.clipboard.writeText(window.location.href),Ie.success("Link copied!")},S=()=>{a("referral"),n(!0),zi(e.id,"button_click","refer")},k=()=>{a("connect"),n(!0),zi(e.id,"button_click","connect")},M={instagram:"📸",facebook:"📘",linkedin:"💼",twitter:"🐦",youtube:"🎬",tiktok:"🎵"};return r.jsxs("div",{className:"min-h-screen bg-gradient-to-b from-slate-50 via-white to-slate-50",children:[r.jsxs("div",{className:"max-w-md mx-auto px-5 py-10",children:[r.jsxs("div",{className:"text-center mb-8",children:[e.show_photo&&r.jsxs(Qs,{className:"h-28 w-28 mx-auto mb-4 ring-4 ring-white shadow-lg",children:[r.jsx(Si,{src:e.avatar_url||void 0,alt:o}),r.jsx(Js,{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}),e.title&&r.jsx("p",{className:"text-sm font-medium text-primary mb-1",children:e.title}),e.brokerage_name&&!e.brokerage_logo_url&&r.jsx("p",{className:"text-sm font-medium text-slate-500 mb-1",children:e.brokerage_name}),e.team_name&&!e.team_logo_url&&r.jsx("p",{className:"text-xs font-medium text-slate-400 mb-3",children:e.team_name}),e.positioning_statement&&r.jsxs("p",{className:"text-base text-slate-600 italic leading-relaxed max-w-xs mx-auto",children:['"',e.positioning_statement,'"']})]}),r.jsxs("div",{className:"grid grid-cols-3 gap-3 mb-4",children:[r.jsxs(ee,{onClick:u,className:"flex flex-col items-center gap-1.5 h-auto py-4 bg-primary hover:bg-primary/90 text-primary-foreground rounded-2xl shadow-sm",children:[r.jsx(Ti,{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(zo,{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(Ns,{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(Ss,{className:"h-5 w-5 mr-2"}),e.custom_cta_label||"Book a Call"]}),e.show_credentials&&e.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(js,{className:"h-4 w-4 text-amber-500 fill-amber-500"}),r.jsx("span",{className:"font-bold text-slate-900",children:"5.0"})]})}),e.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:['"',e.review_snippet,'"']})}),e.show_bio&&e.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:e.bio})]}),r.jsx(Bse,{card:e,variant:"standard"}),r.jsx(Use,{cardId:e.id,variant:"standard"}),r.jsxs("div",{className:"space-y-2 mb-6",children:[e.show_save_contact&&r.jsxs(ee,{variant:"ghost",onClick:_,className:"w-full justify-start h-12 rounded-2xl text-slate-700 hover:bg-slate-100",children:[r.jsx(io,{className:"h-4 w-4 mr-3 text-primary"}),"Save Contact"]}),e.show_leave_review&&e.review_source_url&&r.jsxs(ee,{variant:"ghost",onClick:()=>{zi(e.id,"button_click","review"),window.open(e.review_source_url,"_blank")},className:"w-full justify-start h-12 rounded-2xl text-slate-700 hover:bg-slate-100",children:[r.jsx(js,{className:"h-4 w-4 mr-3 text-amber-500"}),"Leave a Review"]}),e.show_refer_friend&&r.jsxs(ee,{variant:"ghost",onClick:S,className:"w-full justify-start h-12 rounded-2xl text-slate-700 hover:bg-slate-100",children:[r.jsx(Un,{className:"h-4 w-4 mr-3 text-primary"}),"Refer a Friend"]}),r.jsxs(ee,{variant:"ghost",onClick:k,className:"w-full justify-start h-12 rounded-2xl text-slate-700 hover:bg-slate-100",children:[r.jsx(vf,{className:"h-4 w-4 mr-3 text-primary"}),"Connect with Me"]}),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(Nc,{className:"h-4 w-4 mr-3 text-primary"}),"Share My Card"]})]}),e.show_social_links&&e.social_links&&e.social_links.length>0&&r.jsx("div",{className:"flex justify-center gap-4 mb-8",children:e.social_links.slice(0,3).map((T,I)=>r.jsx("a",{href:T.url,target:"_blank",rel:"noopener noreferrer",onClick:()=>zi(e.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:M[T.platform.toLowerCase()]||"🔗"},I))}),r.jsx("div",{className:"text-center",children:r.jsx("p",{className:"text-xs text-slate-400",children:"Powered by LevelUp"})})]}),r.jsx($se,{open:t,onOpenChange:n,cardId:e.id,type:s,agentName:o})]})}function Zct({card:e}){var P;const[t,n]=E.useState(!1),[s,a]=E.useState("booking"),o=((P=e.profile)==null?void 0:P.name)||"Agent",l=o.split(" ").map(T=>T[0]).join("").toUpperCase().slice(0,2),i=(T,I)=>{zi(e.id,"button_click",T),I()},u=()=>i("call",()=>{var T;(T=e.profile)!=null&&T.phone?window.location.href=`tel:${e.profile.phone}`:Ie.error("Phone number not available")}),p=()=>i("text",()=>{var T;(T=e.profile)!=null&&T.phone?window.location.href=`sms:${e.profile.phone}`:Ie.error("Phone number not available")}),x=()=>i("email",()=>{var T;(T=e.profile)!=null&&T.email?window.location.href=`mailto:${e.profile.email}`:Ie.error("Email not available")}),y=()=>{e.booking_url?i("book",()=>window.open(e.booking_url,"_blank")):(a("booking"),n(!0),zi(e.id,"button_click","book"))},_=()=>{var T,I;zi(e.id,"contact_saved"),qse({name:o,phone:(T=e.profile)==null?void 0:T.phone,email:(I=e.profile)==null?void 0:I.email,brokerage:e.brokerage_name,avatarUrl:e.avatar_url,cardUrl:window.location.href})},b=async()=>{if(zi(e.id,"share_event"),navigator.share)try{await navigator.share({title:`${o} - Real Estate Agent`,text:e.positioning_statement||`Connect with ${o}`,url:window.location.href})}catch{}else await navigator.clipboard.writeText(window.location.href),Ie.success("Link copied!")},S=()=>{a("referral"),n(!0),zi(e.id,"button_click","refer")},k=()=>{a("connect"),n(!0),zi(e.id,"button_click","connect")},M={instagram:"📸",facebook:"📘",linkedin:"💼",twitter:"🐦",youtube:"🎬",tiktok:"🎵"};return r.jsxs("div",{className:"min-h-screen bg-gradient-to-b from-[#0f1419] via-[#1a1f2e] to-[#0f1419]",children:[r.jsxs("div",{className:"max-w-md mx-auto px-5 py-10",children:[r.jsx("div",{className:"w-16 h-0.5 bg-gradient-to-r from-[#c9a84c] to-[#e8d48b] mx-auto mb-8"}),r.jsxs("div",{className:"text-center mb-8",children:[e.show_photo&&r.jsxs(Qs,{className:"h-32 w-32 mx-auto mb-5 ring-2 ring-[#c9a84c]/40 shadow-2xl",children:[r.jsx(Si,{src:e.avatar_url||void 0,alt:o}),r.jsx(Js,{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}),e.title&&r.jsx("p",{className:"text-sm font-medium text-[#e8d48b] mb-1",children:e.title}),e.brokerage_name&&!e.brokerage_logo_url&&r.jsx("p",{className:"text-sm font-medium text-[#c9a84c] tracking-widest uppercase mb-1",children:e.brokerage_name}),e.team_name&&!e.team_logo_url&&r.jsx("p",{className:"text-xs font-medium text-[#a0aec0] mb-3",children:e.team_name}),e.positioning_statement&&r.jsxs("p",{className:"text-base text-[#a0aec0] italic leading-relaxed max-w-xs mx-auto font-serif",children:['"',e.positioning_statement,'"']})]}),r.jsx("div",{className:"grid grid-cols-3 gap-3 mb-4",children:[{icon:Ti,label:"Call",handler:u},{icon:zo,label:"Text",handler:p},{icon:Ns,label:"Email",handler:x}].map(({icon:T,label:I,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:I})]},I))}),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(Ss,{className:"h-5 w-5"}),e.custom_cta_label||"Book a Call"]}),e.show_credentials&&e.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(js,{className:"h-4 w-4 text-[#c9a84c] fill-[#c9a84c]"}),r.jsx("span",{className:"font-bold text-white",children:"5.0"})]})}),e.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:['"',e.review_snippet,'"']})}),e.show_bio&&e.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:e.bio})]}),r.jsx(Bse,{card:e,variant:"luxury"}),r.jsx(Use,{cardId:e.id,variant:"luxury"}),r.jsxs("div",{className:"space-y-1 mb-6",children:[e.show_save_contact&&r.jsxs("button",{onClick:_,className:"w-full flex items-center gap-3 h-12 px-4 rounded-xl text-[#e2e8f0] hover:bg-[#1e2636] transition-colors text-sm",children:[r.jsx(io,{className:"h-4 w-4 text-[#c9a84c]"})," Save Contact"]}),e.show_leave_review&&e.review_source_url&&r.jsxs("button",{onClick:()=>{zi(e.id,"button_click","review"),window.open(e.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(js,{className:"h-4 w-4 text-[#c9a84c]"})," Leave a Review"]}),e.show_refer_friend&&r.jsxs("button",{onClick:S,className:"w-full flex items-center gap-3 h-12 px-4 rounded-xl text-[#e2e8f0] hover:bg-[#1e2636] transition-colors text-sm",children:[r.jsx(Un,{className:"h-4 w-4 text-[#c9a84c]"})," Refer a Friend"]}),r.jsxs("button",{onClick:k,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(vf,{className:"h-4 w-4 text-[#c9a84c]"})," Connect with Me"]}),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(Nc,{className:"h-4 w-4 text-[#c9a84c]"})," Share My Card"]})]}),e.show_social_links&&e.social_links&&e.social_links.length>0&&r.jsx("div",{className:"flex justify-center gap-4 mb-8",children:e.social_links.slice(0,3).map((T,I)=>r.jsx("a",{href:T.url,target:"_blank",rel:"noopener noreferrer",onClick:()=>zi(e.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:M[T.platform.toLowerCase()]||"🔗"},I))}),r.jsx("div",{className:"text-center",children:r.jsx("p",{className:"text-xs text-[#4a5568]",children:"Powered by LevelUp"})})]}),r.jsx($se,{open:t,onOpenChange:n,cardId:e.id,type:s,agentName:o})]})}function Yct({card:e}){var I,z,D,U;const[t,n]=E.useState(!1),[s,a]=E.useState("booking"),o=((I=e.profile)==null?void 0:I.name)||"Agent",l=o.split(" ").map(V=>V[0]).join("").toUpperCase().slice(0,2),i={accent:((z=e.bold_theme_colors)==null?void 0:z.accent)||"#ff5722",dark:((D=e.bold_theme_colors)==null?void 0:D.dark)||"#1a1a2e",button:((U=e.bold_theme_colors)==null?void 0:U.button)||"#ff5722"},u=(V,W)=>{const G=parseInt(V.replace("#",""),16),J=Math.max(0,(G>>16)-W),ne=Math.max(0,(G>>8&255)-W),oe=Math.max(0,(G&255)-W);return`#${(J<<16|ne<<8|oe).toString(16).padStart(6,"0")}`};u(i.accent,25),u(i.dark,-20),u(i.button,25);const p=(V,W)=>{zi(e.id,"button_click",V),W()},x=()=>p("call",()=>{var V;(V=e.profile)!=null&&V.phone?window.location.href=`tel:${e.profile.phone}`:Ie.error("Phone number not available")}),y=()=>p("text",()=>{var V;(V=e.profile)!=null&&V.phone?window.location.href=`sms:${e.profile.phone}`:Ie.error("Phone number not available")}),_=()=>p("email",()=>{var V;(V=e.profile)!=null&&V.email?window.location.href=`mailto:${e.profile.email}`:Ie.error("Email not available")}),b=()=>{e.booking_url?p("book",()=>window.open(e.booking_url,"_blank")):(a("booking"),n(!0),zi(e.id,"button_click","book"))},S=()=>{var V,W;zi(e.id,"contact_saved"),qse({name:o,phone:(V=e.profile)==null?void 0:V.phone,email:(W=e.profile)==null?void 0:W.email,brokerage:e.brokerage_name,avatarUrl:e.avatar_url,cardUrl:window.location.href})},k=async()=>{if(zi(e.id,"share_event"),navigator.share)try{await navigator.share({title:`${o}`,url:window.location.href})}catch{}else await navigator.clipboard.writeText(window.location.href),Ie.success("Link copied!")},M=()=>{a("referral"),n(!0),zi(e.id,"button_click","refer")},P=()=>{a("connect"),n(!0),zi(e.id,"button_click","connect")},T={instagram:"📸",facebook:"📘",linkedin:"💼",twitter:"🐦",youtube:"🎬",tiktok:"🎵"};return r.jsxs("div",{className:"min-h-screen",style:{backgroundColor:i.accent},children:[r.jsxs("div",{className:"px-5 pt-10 pb-14 text-center relative",style:{backgroundColor:i.dark},children:[e.show_photo&&r.jsxs(Qs,{className:"h-28 w-28 mx-auto mb-4 shadow-2xl",style:{boxShadow:`0 0 0 4px ${i.accent}`},children:[r.jsx(Si,{src:e.avatar_url||void 0,alt:o}),r.jsx(Js,{className:"text-2xl font-black text-white",style:{backgroundColor:i.accent},children:l})]}),r.jsx("h1",{className:"text-3xl font-black text-white tracking-tight mb-0.5",children:o}),e.title&&r.jsx("p",{className:"text-sm font-bold mb-1",style:{color:`${i.accent}cc`},children:e.title}),e.brokerage_name&&!e.brokerage_logo_url&&r.jsx("p",{className:"text-sm font-bold uppercase tracking-wider mb-1",style:{color:i.accent},children:e.brokerage_name}),e.team_name&&!e.team_logo_url&&r.jsx("p",{className:"text-xs font-bold text-white/60 uppercase tracking-wider",children:e.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:[e.positioning_statement&&r.jsx("p",{className:"text-center font-bold text-lg leading-snug mb-6 max-w-xs mx-auto",style:{color:i.dark},children:e.positioning_statement}),r.jsx("div",{className:"grid grid-cols-3 gap-3 mb-4",children:[{icon:Ti,label:"Call",handler:x},{icon:zo,label:"Text",handler:y},{icon:Ns,label:"Email",handler:_}].map(({icon:V,label:W,handler:G})=>r.jsxs("button",{onClick:G,className:"flex flex-col items-center gap-1.5 py-4 text-white rounded-2xl transition-opacity font-bold hover:opacity-85",style:{backgroundColor:i.dark},children:[r.jsx(V,{className:"h-5 w-5"}),r.jsx("span",{className:"text-xs",children:W})]},W))}),r.jsxs("button",{onClick:b,className:"w-full h-14 text-base font-black rounded-2xl mb-6 text-white transition-opacity hover:opacity-90 flex items-center justify-center gap-2 uppercase tracking-wide",style:{backgroundColor:i.button},children:[r.jsx(Ss,{className:"h-5 w-5"}),e.custom_cta_label||"Book a Call"]}),e.show_credentials&&e.review_snippet&&r.jsx("div",{className:"flex items-center justify-center gap-5 mb-6",children:e.review_snippet&&r.jsxs("div",{className:"text-center flex items-center gap-1",children:[r.jsx(js,{className:"h-5 w-5",style:{color:i.accent,fill:i.accent}}),r.jsx("span",{className:"font-black text-2xl",style:{color:i.dark},children:"5.0"})]})}),e.review_snippet&&r.jsx("div",{className:"rounded-2xl p-4 mb-6",style:{backgroundColor:`${i.accent}15`},children:r.jsxs("p",{className:"text-sm font-medium text-center",style:{color:i.dark},children:['"',e.review_snippet,'"']})}),e.show_bio&&e.bio&&r.jsxs("div",{className:"mb-6",children:[r.jsx("h2",{className:"text-xs font-black mb-2 uppercase tracking-wider",style:{color:i.accent},children:"About Me"}),r.jsx("p",{className:"text-sm text-gray-600 leading-relaxed",children:e.bio})]}),r.jsx(Bse,{card:e,variant:"bold"}),r.jsx(Use,{cardId:e.id,variant:"bold"}),r.jsxs("div",{className:"space-y-1 mb-6",children:[e.show_save_contact&&r.jsxs("button",{onClick:S,className:"w-full flex items-center gap-3 h-12 px-4 rounded-2xl hover:bg-gray-100 transition-colors text-sm font-bold",style:{color:i.dark},children:[r.jsx(io,{className:"h-4 w-4",style:{color:i.accent}})," Save Contact"]}),e.show_leave_review&&e.review_source_url&&r.jsxs("button",{onClick:()=>{zi(e.id,"button_click","review"),window.open(e.review_source_url,"_blank")},className:"w-full flex items-center gap-3 h-12 px-4 rounded-2xl hover:bg-gray-100 transition-colors text-sm font-bold",style:{color:i.dark},children:[r.jsx(js,{className:"h-4 w-4",style:{color:i.accent}})," Leave a Review"]}),e.show_refer_friend&&r.jsxs("button",{onClick:M,className:"w-full flex items-center gap-3 h-12 px-4 rounded-2xl hover:bg-gray-100 transition-colors text-sm font-bold",style:{color:i.dark},children:[r.jsx(Un,{className:"h-4 w-4",style:{color:i.accent}})," Refer a Friend"]}),r.jsxs("button",{onClick:P,className:"w-full flex items-center gap-3 h-12 px-4 rounded-2xl hover:bg-gray-100 transition-colors text-sm font-bold",style:{color:i.dark},children:[r.jsx(vf,{className:"h-4 w-4",style:{color:i.accent}})," Connect with Me"]}),r.jsxs("button",{onClick:k,className:"w-full flex items-center gap-3 h-12 px-4 rounded-2xl hover:bg-gray-100 transition-colors text-sm font-bold",style:{color:i.dark},children:[r.jsx(Nc,{className:"h-4 w-4",style:{color:i.accent}})," Share My Card"]})]}),e.show_social_links&&e.social_links&&e.social_links.length>0&&r.jsx("div",{className:"flex justify-center gap-4 mb-6",children:e.social_links.slice(0,3).map((V,W)=>r.jsx("a",{href:V.url,target:"_blank",rel:"noopener noreferrer",onClick:()=>zi(e.id,"button_click",`social_${V.platform}`),className:"h-10 w-10 rounded-full flex items-center justify-center text-lg transition-opacity hover:opacity-85",style:{backgroundColor:i.dark},children:T[V.platform.toLowerCase()]||"🔗"},W))})]}),r.jsx("div",{className:"text-center py-6",children:r.jsx("p",{className:"text-xs text-white/50",children:"Powered by LevelUp"})})]}),r.jsx($se,{open:t,onOpenChange:n,cardId:e.id,type:s,agentName:o})]})}function Xct({card:e}){var P;const[t,n]=E.useState(!1),[s,a]=E.useState("booking"),o=((P=e.profile)==null?void 0:P.name)||"Agent",l=o.split(" ").map(T=>T[0]).join("").toUpperCase().slice(0,2),i=(T,I)=>{zi(e.id,"button_click",T),I()},u=()=>i("call",()=>{var T;(T=e.profile)!=null&&T.phone?window.location.href=`tel:${e.profile.phone}`:Ie.error("Phone number not available")}),p=()=>i("text",()=>{var T;(T=e.profile)!=null&&T.phone?window.location.href=`sms:${e.profile.phone}`:Ie.error("Phone number not available")}),x=()=>i("email",()=>{var T;(T=e.profile)!=null&&T.email?window.location.href=`mailto:${e.profile.email}`:Ie.error("Email not available")}),y=()=>{e.booking_url?i("book",()=>window.open(e.booking_url,"_blank")):(a("booking"),n(!0),zi(e.id,"button_click","book"))},_=()=>{var T,I;zi(e.id,"contact_saved"),qse({name:o,phone:(T=e.profile)==null?void 0:T.phone,email:(I=e.profile)==null?void 0:I.email,brokerage:e.brokerage_name,avatarUrl:e.avatar_url,cardUrl:window.location.href})},b=async()=>{if(zi(e.id,"share_event"),navigator.share)try{await navigator.share({title:`${o}`,url:window.location.href})}catch{}else await navigator.clipboard.writeText(window.location.href),Ie.success("Link copied!")},S=()=>{a("referral"),n(!0),zi(e.id,"button_click","refer")},k=()=>{a("connect"),n(!0),zi(e.id,"button_click","connect")},M={instagram:"📸",facebook:"📘",linkedin:"💼",twitter:"🐦",youtube:"🎬",tiktok:"🎵"};return r.jsxs("div",{className:"min-h-screen bg-[#f5f1eb]",children:[r.jsx("div",{className:"bg-[#1b3a4b] h-2"}),r.jsxs("div",{className:"max-w-md mx-auto px-5 py-10",children:[r.jsxs("div",{className:"text-center mb-8",children:[e.show_photo&&r.jsxs(Qs,{className:"h-28 w-28 mx-auto mb-4 ring-4 ring-white shadow-lg",children:[r.jsx(Si,{src:e.avatar_url||void 0,alt:o}),r.jsx(Js,{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}),e.title&&r.jsx("p",{className:"text-sm font-medium text-[#5a7a6f] mb-1",children:e.title}),e.brokerage_name&&!e.brokerage_logo_url&&r.jsx("p",{className:"text-sm font-medium text-[#5a7a6f] mb-1",children:e.brokerage_name}),e.team_name&&!e.team_logo_url&&r.jsx("p",{className:"text-xs font-medium text-[#a0aec0] mb-3",children:e.team_name}),e.positioning_statement&&r.jsxs("p",{className:"text-base text-[#4a5568] italic leading-relaxed max-w-xs mx-auto font-serif",children:['"',e.positioning_statement,'"']})]}),r.jsx("div",{className:"grid grid-cols-3 gap-3 mb-4",children:[{icon:Ti,label:"Call",handler:u},{icon:zo,label:"Text",handler:p},{icon:Ns,label:"Email",handler:x}].map(({icon:T,label:I,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:I})]},I))}),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(Ss,{className:"h-5 w-5"}),e.custom_cta_label||"Book a Call"]}),e.show_credentials&&e.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(js,{className:"h-4 w-4 text-[#d4a843] fill-[#d4a843]"}),r.jsx("span",{className:"font-bold text-[#1b3a4b] font-serif",children:"5.0"})]})})}),e.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:['"',e.review_snippet,'"']})}),e.show_bio&&e.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:e.bio})]}),r.jsx(Bse,{card:e,variant:"classic"}),r.jsx(Use,{cardId:e.id,variant:"classic"}),r.jsxs("div",{className:"bg-white rounded-lg border border-[#d4cfc5] shadow-sm divide-y divide-[#e8e3db] mb-6",children:[e.show_save_contact&&r.jsxs("button",{onClick:_,className:"w-full flex items-center gap-3 h-12 px-4 text-[#1b3a4b] hover:bg-[#f5f1eb] transition-colors text-sm font-medium",children:[r.jsx(io,{className:"h-4 w-4 text-[#5a7a6f]"})," Save Contact"]}),e.show_leave_review&&e.review_source_url&&r.jsxs("button",{onClick:()=>{zi(e.id,"button_click","review"),window.open(e.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(js,{className:"h-4 w-4 text-[#d4a843]"})," Leave a Review"]}),e.show_refer_friend&&r.jsxs("button",{onClick:S,className:"w-full flex items-center gap-3 h-12 px-4 text-[#1b3a4b] hover:bg-[#f5f1eb] transition-colors text-sm font-medium",children:[r.jsx(Un,{className:"h-4 w-4 text-[#5a7a6f]"})," Refer a Friend"]}),r.jsxs("button",{onClick:k,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(vf,{className:"h-4 w-4 text-[#5a7a6f]"})," Connect with Me"]}),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(Nc,{className:"h-4 w-4 text-[#5a7a6f]"})," Share My Card"]})]}),e.show_social_links&&e.social_links&&e.social_links.length>0&&r.jsx("div",{className:"flex justify-center gap-4 mb-8",children:e.social_links.slice(0,3).map((T,I)=>r.jsx("a",{href:T.url,target:"_blank",rel:"noopener noreferrer",onClick:()=>zi(e.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:M[T.platform.toLowerCase()]||"🔗"},I))}),r.jsx("div",{className:"text-center",children:r.jsx("p",{className:"text-xs text-[#a0aec0]",children:"Powered by LevelUp"})})]}),r.jsx($se,{open:t,onOpenChange:n,cardId:e.id,type:s,agentName:o})]})}function Qxe({card:e}){switch(e.theme){case"luxury":return r.jsx(Zct,{card:e});case"bold":return r.jsx(Yct,{card:e});case"classic":return r.jsx(Xct,{card:e});case"standard":default:return r.jsx(Kct,{card:e})}}function Qct(){const e=Bm();E.useEffect(()=>(document.body.classList.add("agent-card-page"),()=>{document.body.classList.remove("agent-card-page")}),[]);const t=e.pathname.slice(1);return!t||t===""?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(Jct,{slug:t})}function Jct({slug:e}){return r.jsx(edt,{slug:e})}function edt({slug:e}){var o;const{data:t,isLoading:n,error:s}=k8e(e);if(E.useEffect(()=>{t!=null&&t.id&&zi(t.id,"card_view")},[t==null?void 0:t.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(Lr,{className:"h-28 w-28 rounded-full"}),r.jsx(Lr,{className:"h-6 w-48"}),r.jsx(Lr,{className:"h-4 w-36"})]}),r.jsx(Lr,{className:"h-12 w-full"}),r.jsx(Lr,{className:"h-12 w-full"})]})});if(s||!t)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=t.profile)==null?void 0:o.name)||"Agent";return r.jsxs(r.Fragment,{children:[r.jsxs($m,{children:[r.jsxs("title",{children:[a," | Real Estate Agent"]}),r.jsx("meta",{name:"description",content:t.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:t.positioning_statement||`Connect with ${a}`}),t.avatar_url&&r.jsx("meta",{property:"og:image",content:t.avatar_url})]}),r.jsx(Qxe,{card:t})]})}const hfe="levelup_affiliate_ref",tdt=30,rdt=()=>{const[e]=Gc();E.useEffect(()=>{const t=e.get("ref");if(t){const n={code:t.toUpperCase(),timestamp:Date.now()};localStorage.setItem(hfe,JSON.stringify(n)),console.log("[Affiliate] Stored referral code:",t)}},[e])},ndt=()=>{try{const e=localStorage.getItem(hfe);if(!e)return null;const t=JSON.parse(e),n=tdt*24*60*60*1e3;return Date.now()-t.timestamp>n?(localStorage.removeItem(hfe),console.log("[Affiliate] Referral code expired"),null):t.code}catch{return null}},qte="/assets/levelup-logo-header-_ZX7DvlA.png",sdt="/assets/scale-your-team-ku4MPatU.png";function adt({open:e,onOpenChange:t}){return r.jsx(Or,{open:e,onOpenChange:t,children:r.jsxs(Ir,{className:"max-w-3xl max-h-[90vh] overflow-hidden",children:[r.jsx($r,{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(hi,{className:"h-5 w-5 text-[#4a6b6d]"})}),r.jsxs("div",{children:[r.jsx(Fr,{children:"Schedule a Brokerage Interest Meeting"}),r.jsx(Zn,{children:"Learn how LevelUp can empower your entire team"})]})]})}),e&&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 Sd={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"]}},idt=[{icon:rp,title:"Academy Training",description:"Access a library of on-demand video training covering lead generation, marketing, technology, and more."},{icon:Uc,title:"300+ Templates",description:"Professional Canva templates for social media, flyers, postcards, and marketing materials."},{icon:Ss,title:"Live Events",description:"Weekly live training sessions, workshops, and Q&A events with industry experts."},{icon:Ul,title:"Agent Community",description:"Connect with fellow agents, share wins, ask questions, and network in our private community."},{icon:Ea,title:"Resource Kits",description:"Downloadable toolkits with scripts, checklists, guides, and everything you need to close more deals."},{icon:to,title:"Social Swag",description:"Fresh social media content and designs updated regularly to help you stand out online."}],odt=[{icon:Un,title:"Contact Management",description:"Organize your sphere into relationship tiers—Top 25, Past Clients, Referral Partners, and more."},{icon:Ls,title:"Smart Touchpoint Plans",description:"Automated action plans that tell you exactly who to contact and how, based on relationship type."},{icon:Ti,title:"One-Tap Actions",description:"Call, text, or email contacts directly with pre-written scripts tailored to each relationship."},{icon:hf,title:"Birthday & Anniversary Alerts",description:"Never miss an important date—get reminders for birthdays and home anniversaries."},{icon:Po,title:"Pop-by Map",description:"See all your contacts on a map and plan efficient pop-by routes in your area."},{icon:_c,title:"Momentum Tracking",description:"Track your touch streaks, weekly goals, and relationship health scores."},{icon:xi,title:"Relationship Health",description:"Visual dashboard showing which contacts need attention based on last touch date."},{icon:Bg,title:"Daily Action Cards",description:"Wake up to a prioritized list of exactly who to reach out to today."}],ldt=[{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."}],cdt=()=>{const{user:e,loading:t}=tn(),n=Gn(),[s]=Gc();E.useEffect(()=>{const V=window.location.host==="listings.relevelup.com",W=window.location.pathname==="/";if(V&&W){n("/public/listings",{replace:!0});return}},[n]);const[a,o]=E.useState(null),[l,i]=E.useState(null),[u,p]=E.useState(!1),[x,y]=E.useState(""),[_,b]=E.useState(""),[S,k]=E.useState(""),[M,P]=E.useState(!1),[T,I]=E.useState(!1),z=(V,W=!1)=>{i({tier:V,skipTrial:W}),p(!0)};rdt(),E.useEffect(()=>{const V=window.location.host==="listings.relevelup.com",W=location.pathname.startsWith("/public/");!t&&e&&!V&&!W&&n("/dashboard")},[e,t,n,location.pathname]),E.useEffect(()=>{s.get("canceled")==="true"&&Ie.error("Checkout was canceled. Feel free to try again when you're ready!")},[s]);const D=async(V,W=!1)=>{if(!x){Ie.error("Please enter your email address");return}if(!_.trim()){Ie.error("Please enter your full name");return}P(!0),o(V+(W?"_direct":""));const G=ndt();try{const{data:J,error:ne}=await Q.functions.invoke("create-checkout",{body:{tier:V,email:x,name:_.trim(),couponCode:S.trim()||void 0,skipTrial:W,referralCode:G}});if(ne)throw ne;if(J!=null&&J.url)window.open(J.url,"_blank","noopener,noreferrer"),Ie.success("Checkout opened in a new tab");else throw new Error("No checkout URL returned")}catch(J){console.error("Checkout error:",J),Ie.error(J.message||"Failed to start checkout. Please try again.")}finally{P(!1),o(null),p(!1),i(null)}},U=()=>{l&&D(l.tier,l.skipTrial)};return t?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:qte,alt:"LevelUp",className:"h-8 md:h-10"})}),r.jsxs("div",{className:"flex items-center gap-2 md:gap-4",children:[r.jsx(ee,{variant:"ghost",className:"text-white/90 hover:text-white hover:bg-white/10 hidden sm:inline-flex",onClick:()=>{var V;return(V=document.getElementById("features"))==null?void 0:V.scrollIntoView({behavior:"smooth"})},children:"Features"}),r.jsx(ee,{variant:"ghost",className:"text-white/90 hover:text-white hover:bg-white/10 hidden sm:inline-flex",onClick:()=>{var V;return(V=document.getElementById("pricing"))==null?void 0:V.scrollIntoView({behavior:"smooth"})},children:"Pricing"}),r.jsx(ee,{onClick:()=>n("/auth"),className:"bg-white text-[#4a6b6d] hover:bg-gray-100 font-medium shadow-md",children:"Sign In"})]})]})}),r.jsxs("section",{className:"relative pt-24 pb-20 bg-gradient-to-br from-[#1e3a4c] via-[#2a4f5f] to-[#3d6b6b] overflow-hidden",children:[r.jsx("div",{className:"absolute inset-0 opacity-10",children:r.jsx("div",{className:"absolute inset-0 bg-[url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNjAiIGhlaWdodD0iNjAiIHZpZXdCb3g9IjAgMCA2MCA2MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxnIGZpbGw9IiNmZmZmZmYiIGZpbGwtb3BhY2l0eT0iMC40Ij48cGF0aCBkPSJNMzYgMzRoLTJ2LTRoMnY0em0wLTZ2LTRoLTJ2NGgyem0tNiA2aC0ydi00aDJ2NHptMC02di00aC0ydjRoMnoiLz48L2c+PC9nPjwvc3ZnPg==')]"})}),r.jsx("div",{className:"container mx-auto px-4 relative",children:r.jsxs("div",{className:"max-w-5xl mx-auto text-center space-y-8",children:[r.jsx("div",{className:"flex justify-center mb-8",children:r.jsx("img",{alt:"LevelUp Consulting Group",className:"h-[136px] md:h-[164px] drop-shadow-lg",src:"/lovable-uploads/3a0c7ef9-9e79-411f-a9af-6f2a99e8bd7b.webp"})}),r.jsxs("p",{className:"text-lg text-white/80 max-w-3xl mx-auto leading-relaxed font-sans font-bold md:text-4xl",children:["The tools you need to get it done.",r.jsx("br",{}),r.jsx("em",{children:"The platform you need to keep it going."})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 justify-center items-center pt-4",children:[r.jsxs(ee,{size:"lg",onClick:()=>{var V;return(V=document.getElementById("free-trial"))==null?void 0:V.scrollIntoView({behavior:"smooth"})},className:"px-8 py-7 text-lg font-semibold bg-white text-[#1e3a4c] hover:bg-white/90 shadow-2xl transition-all hover:scale-105 group rounded-full",children:["Start Your Free Trial",r.jsx(Vo,{className:"ml-2 w-5 h-5 group-hover:translate-x-1 transition-transform"})]}),r.jsx(ee,{size:"lg",variant:"outline",onClick:()=>{var V;return(V=document.getElementById("features"))==null?void 0:V.scrollIntoView({behavior:"smooth"})},className:"px-8 py-7 text-lg font-semibold border-2 border-white text-white bg-transparent hover:bg-white hover:text-[#1e3a4c] rounded-full",children:"See What's Included"})]})]})})]}),r.jsx("section",{className:"py-20 bg-background",children:r.jsx("div",{className:"container mx-auto px-4",children:r.jsxs("div",{className:"max-w-4xl mx-auto text-center space-y-8",children:[r.jsx("h2",{className:"text-3xl md:text-5xl leading-tight font-sans font-semibold text-secondary",children:"We help brokerages and agents grow with training, tools, and built-in execution."}),r.jsxs("div",{className:"space-y-2 text-lg text-muted-foreground",children:[r.jsx("p",{children:"Agents get weekly coaching + plug-and-play marketing."}),r.jsx("p",{children:"Brokerages get higher adoption, consistency, and real engagement."})]}),r.jsx("p",{className:"text-2xl md:text-4xl text-[#4a6b6d] pt-4 font-sans font-bold",children:"LEVELUP EQUIPS BOTH TO THRIVE."}),r.jsx("p",{className:"text-lg text-muted-foreground",children:"Learn how we support agents and empower brokerages to grow—together."}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 justify-center pt-4",children:[r.jsxs(ee,{size:"lg",variant:"outline",onClick:()=>{var V;return(V=document.getElementById("brokerage"))==null?void 0:V.scrollIntoView({behavior:"smooth"})},className:"border-[#4a6b6d] text-[#4a6b6d] hover:bg-[#4a6b6d]/5",children:[r.jsx(hi,{className:"mr-2 h-5 w-5"}),"Brokerage Partnership"]}),r.jsxs(ee,{size:"lg",onClick:()=>{var V;return(V=document.getElementById("pricing"))==null?void 0:V.scrollIntoView({behavior:"smooth"})},className:"bg-[#4a6b6d] hover:bg-[#3d5a5c]",children:[r.jsx(ic,{className:"mr-2 h-5 w-5"}),"Individual Membership"]})]})]})})}),r.jsx("section",{id:"features",className:"py-20 bg-muted/30",children:r.jsxs("div",{className:"container mx-auto px-4",children:[r.jsxs("div",{className:"text-center max-w-3xl mx-auto mb-16",children:[r.jsx("h2",{className:"text-3xl md:text-4xl mb-6 font-sans font-bold",children:"What's inside our members only portal?"}),r.jsx("p",{className:"text-lg text-muted-foreground",children:"Everything you need to grow your business, all in one place."})]}),r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8 max-w-6xl mx-auto",children:idt.map((V,W)=>r.jsxs(Ze,{className:"group relative overflow-hidden border hover:border-[#4a6b6d]/50 transition-all duration-300 hover:shadow-lg bg-background",children:[r.jsxs(Wt,{children:[r.jsx("div",{className:"w-14 h-14 rounded-2xl bg-[#4a6b6d]/10 flex items-center justify-center mb-4",children:r.jsx(V.icon,{className:"w-7 h-7 text-[#4a6b6d]"})}),r.jsx(Yt,{className:"text-xl font-sans",children:V.title})]}),r.jsx(et,{children:r.jsx("p",{className:"text-muted-foreground leading-relaxed",children:V.description})})]},W))})]})}),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(Ls,{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:odt.map((V,W)=>r.jsxs(Ze,{className:"group relative overflow-hidden border-0 bg-white/10 backdrop-blur-sm hover:bg-white/20 transition-all duration-300",children:[r.jsxs(Wt,{className:"pb-3",children:[r.jsx("div",{className:"w-12 h-12 rounded-xl bg-white/20 flex items-center justify-center mb-3",children:r.jsx(V.icon,{className:"w-6 h-6 text-white"})}),r.jsx(Yt,{className:"text-lg font-semibold text-white",children:V.title})]}),r.jsx(et,{children:r.jsx("p",{className:"text-white/70 text-sm leading-relaxed",children:V.description})})]},W))}),r.jsx("div",{className:"text-center mt-12",children:r.jsxs(ee,{size:"lg",onClick:()=>{var V;return(V=document.getElementById("pricing"))==null?void 0:V.scrollIntoView({behavior:"smooth"})},className:"bg-white text-[#4a6b6d] hover:bg-white/90 shadow-xl transition-all hover:scale-105",children:["Get Agent OS with Your Membership",r.jsx(Vo,{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(hi,{className:"w-4 h-4"}),"For Brokerages"]}),r.jsxs("h2",{className:"text-3xl font-sans font-bold md:text-6xl",children:["Empower Your"," ",r.jsx("span",{className:"italic text-[#4a6b6d]",children:"Entire Team"})]}),r.jsx("p",{className:"text-lg text-muted-foreground",children:"Give every agent on your team access to world-class training and resources. Track performance, streamline onboarding, and watch your brokerage thrive."}),r.jsx("ul",{className:"space-y-4",children:["Dedicated brokerage manager dashboard","Invite and manage agents with one click","Exclusive brokerage-only resources","Team analytics and performance tracking","Simplified agent onboarding","Share resources across your team"].map((V,W)=>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(Ni,{className:"w-4 h-4 text-[#4a6b6d]"})}),r.jsx("span",{className:"text-foreground",children:V})]},W))}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 mt-4",children:[r.jsxs(ee,{size:"lg",onClick:()=>{var V;return(V=document.getElementById("pricing"))==null?void 0:V.scrollIntoView({behavior:"smooth"})},className:"bg-[#4a6b6d] hover:bg-[#3d5a5c]",children:["See Brokerage Plans",r.jsx(Wi,{className:"ml-2 w-5 h-5"})]}),r.jsxs(ee,{size:"lg",variant:"outline",onClick:()=>I(!0),className:"border-[#4a6b6d] text-[#4a6b6d] hover:bg-[#4a6b6d]/10",children:[r.jsx(Ss,{className:"mr-2 w-5 h-5"}),"Schedule Info Session"]})]})]}),r.jsx("div",{className:"relative hidden md:block",children:r.jsx("img",{src:sdt,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:ldt.map((V,W)=>r.jsx(Ze,{className:"bg-muted/30 border-0",children:r.jsxs(et,{className:"pt-8",children:[r.jsx("div",{className:"flex gap-1 mb-4",children:[1,2,3,4,5].map(G=>r.jsx(js,{className:"w-5 h-5 fill-yellow-400 text-yellow-400"},G))}),r.jsxs("p",{className:"text-lg mb-6 italic text-muted-foreground",children:['"',V.quote,'"']}),r.jsxs("div",{children:[r.jsx("p",{className:"font-semibold",children:V.name}),r.jsx("p",{className:"text-sm text-muted-foreground",children:V.role})]})]})},W))})]})}),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(Vo,{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(Ze,{className:"relative flex flex-col border hover:border-[#4a6b6d]/50 transition-all hover:shadow-xl bg-background",children:[r.jsxs(Wt,{className:"pb-4",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[r.jsx("div",{className:"w-10 h-10 rounded-xl bg-[#4a6b6d]/10 flex items-center justify-center",children:r.jsx(ic,{className:"w-5 h-5 text-[#4a6b6d]"})}),r.jsx(Yt,{className:"text-xl font-sans",children:Sd.individual_agent.name})]}),r.jsxs("div",{className:"flex items-baseline gap-1 mt-4",children:[r.jsx("span",{className:"text-5xl font-bold",children:Sd.individual_agent.price}),r.jsx("span",{className:"text-muted-foreground text-lg",children:Sd.individual_agent.period})]}),r.jsx(Sn,{className:"text-base mt-2",children:Sd.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"}),Sd.individual_agent.trial]})]}),r.jsx(et,{className:"flex-1 pt-0",children:r.jsx("ul",{className:"space-y-3",children:Sd.individual_agent.features.map((V,W)=>r.jsxs("li",{className:"flex items-center gap-3",children:[r.jsx(Ni,{className:"w-5 h-5 text-[#4a6b6d] flex-shrink-0"}),r.jsx("span",{children:V})]},W))})}),r.jsxs(PA,{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(Ze,{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(Wt,{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(hi,{className:"w-5 h-5 text-[#4a6b6d]"})}),r.jsxs("div",{children:[r.jsx(Yt,{className:"text-xl font-sans",children:Sd.brokerage_under_25.name}),r.jsx("span",{className:"text-sm text-muted-foreground",children:Sd.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:Sd.brokerage_under_25.price}),r.jsx("span",{className:"text-muted-foreground text-lg",children:Sd.brokerage_under_25.period})]}),r.jsx(Sn,{className:"text-base mt-2",children:Sd.brokerage_under_25.description})]}),r.jsx(et,{className:"flex-1 pt-0",children:r.jsx("ul",{className:"space-y-3",children:Sd.brokerage_under_25.features.map((V,W)=>r.jsxs("li",{className:"flex items-center gap-3",children:[r.jsx(Ni,{className:"w-5 h-5 text-[#4a6b6d] flex-shrink-0"}),r.jsx("span",{children:V})]},W))})}),r.jsx(PA,{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(Ze,{className:"relative flex flex-col border hover:border-[#4a6b6d]/50 transition-all hover:shadow-xl bg-background",children:[r.jsxs(Wt,{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(hi,{className:"w-5 h-5 text-[#4a6b6d]"})}),r.jsxs("div",{children:[r.jsx(Yt,{className:"text-xl font-sans",children:Sd.brokerage_over_25.name}),r.jsx("span",{className:"text-sm text-muted-foreground",children:Sd.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:Sd.brokerage_over_25.price}),r.jsx("span",{className:"text-muted-foreground text-lg",children:Sd.brokerage_over_25.period})]}),r.jsx(Sn,{className:"text-base mt-2",children:Sd.brokerage_over_25.description})]}),r.jsx(et,{className:"flex-1 pt-0",children:r.jsx("ul",{className:"space-y-3",children:Sd.brokerage_over_25.features.map((V,W)=>r.jsxs("li",{className:"flex items-center gap-3",children:[r.jsx(Ni,{className:"w-5 h-5 text-[#4a6b6d] flex-shrink-0"}),r.jsx("span",{children:V})]},W))})}),r.jsx(PA,{className:"pt-4",children:r.jsx(ee,{className:"w-full py-6 text-lg bg-[#4a6b6d] hover:bg-[#3d5a5c]",onClick:()=>z("brokerage_over_25"),children:"Get Started"})})]})]})]})}),r.jsxs("section",{className:"py-20 bg-gradient-to-br from-[#1e3a4c] via-[#2a4f5f] to-[#3d6b6b] relative overflow-hidden",children:[r.jsx("div",{className:"absolute inset-0 opacity-10",children:r.jsx("div",{className:"absolute inset-0 bg-[url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNjAiIGhlaWdodD0iNjAiIHZpZXdCb3g9IjAgMCA2MCA2MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxnIGZpbGw9IiNmZmZmZmYiIGZpbGwtb3BhY2l0eT0iMC40Ij48cGF0aCBkPSJNMzYgMzRoLTJ2LTRoMnY0em0wLTZ2LTRoLTJ2NGgyem0tNiA2aC0ydi00aDJ2NHptMC02di00aC0ydjRoMnoiLz48L2c+PC9nPjwvc3ZnPg==')]"})}),r.jsx("div",{className:"container mx-auto px-4 relative",children:r.jsxs("div",{className:"max-w-4xl mx-auto text-center space-y-8",children:[r.jsx("h2",{className:"text-3xl text-white font-sans md:text-5xl",children:"Ready to Level Up?"}),r.jsx("p",{className:"text-lg text-white/80 max-w-2xl mx-auto",children:"Join thousands of agents who are closing more deals, saving time, and growing their business with LevelUp."}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 justify-center",children:[r.jsxs(ee,{size:"lg",onClick:()=>{var V;return(V=document.getElementById("pricing"))==null?void 0:V.scrollIntoView({behavior:"smooth"})},className:"px-10 py-7 text-lg font-semibold bg-white text-[#4a6b6d] hover:bg-white/90 shadow-2xl transition-all hover:scale-105",children:["Start Your Free Trial",r.jsx(Vo,{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:qte,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(adt,{open:T,onOpenChange:I}),r.jsx(Or,{open:u,onOpenChange:p,children:r.jsxs(Ir,{className:"sm:max-w-md",children:[r.jsxs($r,{children:[r.jsx(Fr,{className:"text-xl font-sans font-semibold",children:"Enter your details to get started"}),r.jsx(Zn,{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($e,{htmlFor:"dialog-name",children:["Full Name ",r.jsx("span",{className:"text-red-500",children:"*"})]}),r.jsx(dt,{id:"dialog-name",type:"text",placeholder:"John Smith",value:_,onChange:V=>b(V.target.value),className:"mt-1",required:!0})]}),r.jsxs("div",{children:[r.jsxs($e,{htmlFor:"dialog-email",children:["Email Address ",r.jsx("span",{className:"text-red-500",children:"*"})]}),r.jsx(dt,{id:"dialog-email",type:"email",placeholder:"you@example.com",value:x,onChange:V=>y(V.target.value),className:"mt-1",required:!0})]}),r.jsxs("div",{children:[r.jsxs($e,{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:S,onChange:V=>k(V.target.value),className:"mt-1"})]})]}),r.jsx(ee,{className:"w-full py-6 text-lg bg-[#4a6b6d] hover:bg-[#3d5a5c]",onClick:U,disabled:M,children:M?"Loading...":"Continue to Checkout"})]})})]})},ddt=()=>r.jsxs(r.Fragment,{children:[r.jsxs($m,{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"})]})]})]})]})})]}),udt=()=>r.jsxs(r.Fragment,{children:[r.jsxs($m,{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"})]})]})]})]})})]}),hdt=()=>r.jsxs(r.Fragment,{children:[r.jsxs($m,{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 fo;(function(e){e.assertEqual=a=>{};function t(a){}e.assertIs=t;function n(a){throw new Error}e.assertNever=n,e.arrayToEnum=a=>{const o={};for(const l of a)o[l]=l;return o},e.getValidEnumValues=a=>{const o=e.objectKeys(a).filter(i=>typeof a[a[i]]!="number"),l={};for(const i of o)l[i]=a[i];return e.objectValues(l)},e.objectValues=a=>e.objectKeys(a).map(function(o){return a[o]}),e.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},e.find=(a,o)=>{for(const l of a)if(o(l))return l},e.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)}e.joinValues=s,e.jsonStringifyReplacer=(a,o)=>typeof o=="bigint"?o.toString():o})(fo||(fo={}));var Zke;(function(e){e.mergeShapes=(t,n)=>({...t,...n})})(Zke||(Zke={}));const Ps=fo.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Z0=e=>{switch(typeof e){case"undefined":return Ps.undefined;case"string":return Ps.string;case"number":return Number.isNaN(e)?Ps.nan:Ps.number;case"boolean":return Ps.boolean;case"function":return Ps.function;case"bigint":return Ps.bigint;case"symbol":return Ps.symbol;case"object":return Array.isArray(e)?Ps.array:e===null?Ps.null:e.then&&typeof e.then=="function"&&e.catch&&typeof e.catch=="function"?Ps.promise:typeof Map<"u"&&e instanceof Map?Ps.map:typeof Set<"u"&&e instanceof Set?Ps.set:typeof Date<"u"&&e instanceof Date?Ps.date:Ps.object;default:return Ps.unknown}},On=fo.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 Kg extends Error{get errors(){return this.issues}constructor(t){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=t}format(t){const n=t||function(o){return o.message},s={_errors:[]},a=o=>{for(const l of o.issues)if(l.code==="invalid_union")l.unionErrors.map(a);else if(l.code==="invalid_return_type")a(l.returnTypeError);else if(l.code==="invalid_arguments")a(l.argumentsError);else if(l.path.length===0)s._errors.push(n(l));else{let i=s,u=0;for(;un.message){const n={},s=[];for(const a of this.issues)if(a.path.length>0){const o=a.path[0];n[o]=n[o]||[],n[o].push(t(a))}else s.push(t(a));return{formErrors:s,fieldErrors:n}}get formErrors(){return this.flatten()}}Kg.create=e=>new Kg(e);const ffe=(e,t)=>{let n;switch(e.code){case On.invalid_type:e.received===Ps.undefined?n="Required":n=`Expected ${e.expected}, received ${e.received}`;break;case On.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(e.expected,fo.jsonStringifyReplacer)}`;break;case On.unrecognized_keys:n=`Unrecognized key(s) in object: ${fo.joinValues(e.keys,", ")}`;break;case On.invalid_union:n="Invalid input";break;case On.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${fo.joinValues(e.options)}`;break;case On.invalid_enum_value:n=`Invalid enum value. Expected ${fo.joinValues(e.options)}, received '${e.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 e.validation=="object"?"includes"in e.validation?(n=`Invalid input: must include "${e.validation.includes}"`,typeof e.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?n=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?n=`Invalid input: must end with "${e.validation.endsWith}"`:fo.assertNever(e.validation):e.validation!=="regex"?n=`Invalid ${e.validation}`:n="Invalid";break;case On.too_small:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="bigint"?n=`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:n="Invalid input";break;case On.too_big:e.type==="array"?n=`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:e.type==="string"?n=`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:e.type==="number"?n=`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="bigint"?n=`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:e.type==="date"?n=`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.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 ${e.multipleOf}`;break;case On.not_finite:n="Number must be finite";break;default:n=t.defaultError,fo.assertNever(e)}return{message:n}};let fdt=ffe;function pdt(){return fdt}const mdt=e=>{const{data:t,path:n,errorMaps:s,issueData:a}=e,o=[...n,...a.path||[]],l={...a,path:o};if(a.message!==void 0)return{...a,path:o,message:a.message};let i="";const u=s.filter(p=>!!p).slice().reverse();for(const p of u)i=p(l,{data:t,defaultError:i}).message;return{...a,path:o,message:i}};function ys(e,t){const n=pdt(),s=mdt({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,n,n===ffe?void 0:ffe].filter(a=>!!a)});e.common.issues.push(s)}class kf{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,n){const s=[];for(const a of n){if(a.status==="aborted")return ti;a.status==="dirty"&&t.dirty(),s.push(a.value)}return{status:t.value,value:s}}static async mergeObjectAsync(t,n){const s=[];for(const a of n){const o=await a.key,l=await a.value;s.push({key:o,value:l})}return kf.mergeObjectSync(t,s)}static mergeObjectSync(t,n){const s={};for(const a of n){const{key:o,value:l}=a;if(o.status==="aborted"||l.status==="aborted")return ti;o.status==="dirty"&&t.dirty(),l.status==="dirty"&&t.dirty(),o.value!=="__proto__"&&(typeof l.value<"u"||a.alwaysSet)&&(s[o.value]=l.value)}return{status:t.value,value:s}}}const ti=Object.freeze({status:"aborted"}),LT=e=>({status:"dirty",value:e}),bp=e=>({status:"valid",value:e}),Yke=e=>e.status==="aborted",Xke=e=>e.status==="dirty",TC=e=>e.status==="valid",Vte=e=>typeof Promise<"u"&&e instanceof Promise;var Vs;(function(e){e.errToObj=t=>typeof t=="string"?{message:t}:t||{},e.toString=t=>typeof t=="string"?t:t==null?void 0:t.message})(Vs||(Vs={}));class hv{constructor(t,n,s,a){this._cachedPath=[],this.parent=t,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 Qke=(e,t)=>{if(TC(t))return{success:!0,data:t.value};if(!e.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 Kg(e.common.issues);return this._error=n,this._error}}};function Ci(e){if(!e)return{};const{errorMap:t,invalid_type_error:n,required_error:s,description:a}=e;if(t&&(n||s))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:a}:{errorMap:(l,i)=>{const{message:u}=e;return l.code==="invalid_enum_value"?{message:u??i.defaultError}:typeof i.data>"u"?{message:u??s??i.defaultError}:l.code!=="invalid_type"?{message:i.defaultError}:{message:u??n??i.defaultError}},description:a}}class co{get description(){return this._def.description}_getType(t){return Z0(t.data)}_getOrReturnCtx(t,n){return n||{common:t.parent.common,data:t.data,parsedType:Z0(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new kf,ctx:{common:t.parent.common,data:t.data,parsedType:Z0(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const n=this._parse(t);if(Vte(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(t){const n=this._parse(t);return Promise.resolve(n)}parse(t,n){const s=this.safeParse(t,n);if(s.success)return s.data;throw s.error}safeParse(t,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:t,parsedType:Z0(t)},a=this._parseSync({data:t,path:s.path,parent:s});return Qke(s,a)}"~validate"(t){var s,a;const n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:Z0(t)};if(!this["~standard"].async)try{const o=this._parseSync({data:t,path:[],parent:n});return TC(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:t,path:[],parent:n}).then(o=>TC(o)?{value:o.value}:{issues:n.common.issues})}async parseAsync(t,n){const s=await this.safeParseAsync(t,n);if(s.success)return s.data;throw s.error}async safeParseAsync(t,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:t,parsedType:Z0(t)},a=this._parse({data:t,path:s.path,parent:s}),o=await(Vte(a)?a:Promise.resolve(a));return Qke(s,o)}refine(t,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=t(a),i=()=>o.addIssue({code:On.custom,...s(a)});return typeof Promise<"u"&&l instanceof Promise?l.then(u=>u?!0:(i(),!1)):l?!0:(i(),!1)})}refinement(t,n){return this._refinement((s,a)=>t(s)?!0:(a.addIssue(typeof n=="function"?n(s,a):n),!1))}_refinement(t){return new IC({schema:this,typeName:ri.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,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 J1.create(this,this._def)}nullable(){return PC.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Vg.create(this)}promise(){return Kte.create(this,this._def)}or(t){return Wte.create([this,t],this._def)}and(t){return Gte.create(this,t,this._def)}transform(t){return new IC({...Ci(this._def),schema:this,typeName:ri.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const n=typeof t=="function"?t:()=>t;return new xfe({...Ci(this._def),innerType:this,defaultValue:n,typeName:ri.ZodDefault})}brand(){return new Fdt({typeName:ri.ZodBranded,type:this,...Ci(this._def)})}catch(t){const n=typeof t=="function"?t:()=>t;return new yfe({...Ci(this._def),innerType:this,catchValue:n,typeName:ri.ZodCatch})}describe(t){const n=this.constructor;return new n({...this._def,description:t})}pipe(t){return Jxe.create(this,t)}readonly(){return vfe.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const gdt=/^c[^\s-]{8,}$/i,xdt=/^[0-9a-z]+$/,ydt=/^[0-9A-HJKMNP-TV-Z]{26}$/i,vdt=/^[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,_dt=/^[a-z0-9_-]{21}$/i,bdt=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,wdt=/^[-+]?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)?)??$/,jdt=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,kdt="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Bce;const Ndt=/^(?:(?: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])$/,Sdt=/^(?:(?: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])$/,Cdt=/^(([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]))$/,Mdt=/^(([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])$/,Tdt=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Adt=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,M8e="((\\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])))",Edt=new RegExp(`^${M8e}$`);function T8e(e){let t="[0-5]\\d";e.precision?t=`${t}\\.\\d{${e.precision}}`:e.precision==null&&(t=`${t}(\\.\\d+)?`);const n=e.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${n}`}function Idt(e){return new RegExp(`^${T8e(e)}$`)}function Pdt(e){let t=`${M8e}T${T8e(e)}`;const n=[];return n.push(e.local?"Z?":"Z"),e.offset&&n.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${n.join("|")})`,new RegExp(`^${t}$`)}function Ldt(e,t){return!!((t==="v4"||!t)&&Ndt.test(e)||(t==="v6"||!t)&&Cdt.test(e))}function Odt(e,t){if(!bdt.test(e))return!1;try{const[n]=e.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||t&&a.alg!==t)}catch{return!1}}function Ddt(e,t){return!!((t==="v4"||!t)&&Sdt.test(e)||(t==="v6"||!t)&&Mdt.test(e))}class N1 extends co{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==Ps.string){const o=this._getOrReturnCtx(t);return ys(o,{code:On.invalid_type,expected:Ps.string,received:o.parsedType}),ti}const s=new kf;let a;for(const o of this._def.checks)if(o.kind==="min")t.data.lengtho.value&&(a=this._getOrReturnCtx(t,a),ys(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=t.data.length>o.value,i=t.data.lengtht.test(a),{validation:n,code:On.invalid_string,...Vs.errToObj(s)})}_addCheck(t){return new N1({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...Vs.errToObj(t)})}url(t){return this._addCheck({kind:"url",...Vs.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...Vs.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...Vs.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...Vs.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...Vs.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...Vs.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...Vs.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...Vs.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...Vs.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...Vs.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...Vs.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...Vs.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,offset:(t==null?void 0:t.offset)??!1,local:(t==null?void 0:t.local)??!1,...Vs.errToObj(t==null?void 0:t.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,...Vs.errToObj(t==null?void 0:t.message)})}duration(t){return this._addCheck({kind:"duration",...Vs.errToObj(t)})}regex(t,n){return this._addCheck({kind:"regex",regex:t,...Vs.errToObj(n)})}includes(t,n){return this._addCheck({kind:"includes",value:t,position:n==null?void 0:n.position,...Vs.errToObj(n==null?void 0:n.message)})}startsWith(t,n){return this._addCheck({kind:"startsWith",value:t,...Vs.errToObj(n)})}endsWith(t,n){return this._addCheck({kind:"endsWith",value:t,...Vs.errToObj(n)})}min(t,n){return this._addCheck({kind:"min",value:t,...Vs.errToObj(n)})}max(t,n){return this._addCheck({kind:"max",value:t,...Vs.errToObj(n)})}length(t,n){return this._addCheck({kind:"length",value:t,...Vs.errToObj(n)})}nonempty(t){return this.min(1,Vs.errToObj(t))}trim(){return new N1({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new N1({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new N1({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxLength(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.valuenew N1({checks:[],typeName:ri.ZodString,coerce:(e==null?void 0:e.coerce)??!1,...Ci(e)});function Rdt(e,t){const n=(e.toString().split(".")[1]||"").length,s=(t.toString().split(".")[1]||"").length,a=n>s?n:s,o=Number.parseInt(e.toFixed(a).replace(".","")),l=Number.parseInt(t.toFixed(a).replace(".",""));return o%l/10**a}class AC extends co{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==Ps.number){const o=this._getOrReturnCtx(t);return ys(o,{code:On.invalid_type,expected:Ps.number,received:o.parsedType}),ti}let s;const a=new kf;for(const o of this._def.checks)o.kind==="int"?fo.isInteger(t.data)||(s=this._getOrReturnCtx(t,s),ys(s,{code:On.invalid_type,expected:"integer",received:"float",message:o.message}),a.dirty()):o.kind==="min"?(o.inclusive?t.datao.value:t.data>=o.value)&&(s=this._getOrReturnCtx(t,s),ys(s,{code:On.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),a.dirty()):o.kind==="multipleOf"?Rdt(t.data,o.value)!==0&&(s=this._getOrReturnCtx(t,s),ys(s,{code:On.not_multiple_of,multipleOf:o.value,message:o.message}),a.dirty()):o.kind==="finite"?Number.isFinite(t.data)||(s=this._getOrReturnCtx(t,s),ys(s,{code:On.not_finite,message:o.message}),a.dirty()):fo.assertNever(o);return{status:a.value,value:t.data}}gte(t,n){return this.setLimit("min",t,!0,Vs.toString(n))}gt(t,n){return this.setLimit("min",t,!1,Vs.toString(n))}lte(t,n){return this.setLimit("max",t,!0,Vs.toString(n))}lt(t,n){return this.setLimit("max",t,!1,Vs.toString(n))}setLimit(t,n,s,a){return new AC({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:s,message:Vs.toString(a)}]})}_addCheck(t){return new AC({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:Vs.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Vs.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Vs.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Vs.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Vs.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:Vs.toString(n)})}finite(t){return this._addCheck({kind:"finite",message:Vs.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Vs.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Vs.toString(t)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.valuet.kind==="int"||t.kind==="multipleOf"&&fo.isInteger(t.value))}get isFinite(){let t=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"&&(t===null||s.valuenew AC({checks:[],typeName:ri.ZodNumber,coerce:(e==null?void 0:e.coerce)||!1,...Ci(e)});class PE extends co{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==Ps.bigint)return this._getInvalidInput(t);let s;const a=new kf;for(const o of this._def.checks)o.kind==="min"?(o.inclusive?t.datao.value:t.data>=o.value)&&(s=this._getOrReturnCtx(t,s),ys(s,{code:On.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),a.dirty()):o.kind==="multipleOf"?t.data%o.value!==BigInt(0)&&(s=this._getOrReturnCtx(t,s),ys(s,{code:On.not_multiple_of,multipleOf:o.value,message:o.message}),a.dirty()):fo.assertNever(o);return{status:a.value,value:t.data}}_getInvalidInput(t){const n=this._getOrReturnCtx(t);return ys(n,{code:On.invalid_type,expected:Ps.bigint,received:n.parsedType}),ti}gte(t,n){return this.setLimit("min",t,!0,Vs.toString(n))}gt(t,n){return this.setLimit("min",t,!1,Vs.toString(n))}lte(t,n){return this.setLimit("max",t,!0,Vs.toString(n))}lt(t,n){return this.setLimit("max",t,!1,Vs.toString(n))}setLimit(t,n,s,a){return new PE({...this._def,checks:[...this._def.checks,{kind:t,value:n,inclusive:s,message:Vs.toString(a)}]})}_addCheck(t){return new PE({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Vs.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Vs.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Vs.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Vs.toString(t)})}multipleOf(t,n){return this._addCheck({kind:"multipleOf",value:t,message:Vs.toString(n)})}get minValue(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t}get maxValue(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.valuenew PE({checks:[],typeName:ri.ZodBigInt,coerce:(e==null?void 0:e.coerce)??!1,...Ci(e)});class pfe extends co{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==Ps.boolean){const s=this._getOrReturnCtx(t);return ys(s,{code:On.invalid_type,expected:Ps.boolean,received:s.parsedType}),ti}return bp(t.data)}}pfe.create=e=>new pfe({typeName:ri.ZodBoolean,coerce:(e==null?void 0:e.coerce)||!1,...Ci(e)});class Hte extends co{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==Ps.date){const o=this._getOrReturnCtx(t);return ys(o,{code:On.invalid_type,expected:Ps.date,received:o.parsedType}),ti}if(Number.isNaN(t.data.getTime())){const o=this._getOrReturnCtx(t);return ys(o,{code:On.invalid_date}),ti}const s=new kf;let a;for(const o of this._def.checks)o.kind==="min"?t.data.getTime()o.value&&(a=this._getOrReturnCtx(t,a),ys(a,{code:On.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),s.dirty()):fo.assertNever(o);return{status:s.value,value:new Date(t.data.getTime())}}_addCheck(t){return new Hte({...this._def,checks:[...this._def.checks,t]})}min(t,n){return this._addCheck({kind:"min",value:t.getTime(),message:Vs.toString(n)})}max(t,n){return this._addCheck({kind:"max",value:t.getTime(),message:Vs.toString(n)})}get minDate(){let t=null;for(const n of this._def.checks)n.kind==="min"&&(t===null||n.value>t)&&(t=n.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(const n of this._def.checks)n.kind==="max"&&(t===null||n.valuenew Hte({checks:[],coerce:(e==null?void 0:e.coerce)||!1,typeName:ri.ZodDate,...Ci(e)});class Jke extends co{_parse(t){if(this._getType(t)!==Ps.symbol){const s=this._getOrReturnCtx(t);return ys(s,{code:On.invalid_type,expected:Ps.symbol,received:s.parsedType}),ti}return bp(t.data)}}Jke.create=e=>new Jke({typeName:ri.ZodSymbol,...Ci(e)});class eNe extends co{_parse(t){if(this._getType(t)!==Ps.undefined){const s=this._getOrReturnCtx(t);return ys(s,{code:On.invalid_type,expected:Ps.undefined,received:s.parsedType}),ti}return bp(t.data)}}eNe.create=e=>new eNe({typeName:ri.ZodUndefined,...Ci(e)});class tNe extends co{_parse(t){if(this._getType(t)!==Ps.null){const s=this._getOrReturnCtx(t);return ys(s,{code:On.invalid_type,expected:Ps.null,received:s.parsedType}),ti}return bp(t.data)}}tNe.create=e=>new tNe({typeName:ri.ZodNull,...Ci(e)});class rNe extends co{constructor(){super(...arguments),this._any=!0}_parse(t){return bp(t.data)}}rNe.create=e=>new rNe({typeName:ri.ZodAny,...Ci(e)});class nNe extends co{constructor(){super(...arguments),this._unknown=!0}_parse(t){return bp(t.data)}}nNe.create=e=>new nNe({typeName:ri.ZodUnknown,...Ci(e)});class fv extends co{_parse(t){const n=this._getOrReturnCtx(t);return ys(n,{code:On.invalid_type,expected:Ps.never,received:n.parsedType}),ti}}fv.create=e=>new fv({typeName:ri.ZodNever,...Ci(e)});class sNe extends co{_parse(t){if(this._getType(t)!==Ps.undefined){const s=this._getOrReturnCtx(t);return ys(s,{code:On.invalid_type,expected:Ps.void,received:s.parsedType}),ti}return bp(t.data)}}sNe.create=e=>new sNe({typeName:ri.ZodVoid,...Ci(e)});class Vg extends co{_parse(t){const{ctx:n,status:s}=this._processInputParams(t),a=this._def;if(n.parsedType!==Ps.array)return ys(n,{code:On.invalid_type,expected:Ps.array,received:n.parsedType}),ti;if(a.exactLength!==null){const l=n.data.length>a.exactLength.value,i=n.data.lengtha.maxLength.value&&(ys(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 hv(n,l,n.path,i)))).then(l=>kf.mergeArray(s,l));const o=[...n.data].map((l,i)=>a.type._parseSync(new hv(n,l,n.path,i)));return kf.mergeArray(s,o)}get element(){return this._def.type}min(t,n){return new Vg({...this._def,minLength:{value:t,message:Vs.toString(n)}})}max(t,n){return new Vg({...this._def,maxLength:{value:t,message:Vs.toString(n)}})}length(t,n){return new Vg({...this._def,exactLength:{value:t,message:Vs.toString(n)}})}nonempty(t){return this.min(1,t)}}Vg.create=(e,t)=>new Vg({type:e,minLength:null,maxLength:null,exactLength:null,typeName:ri.ZodArray,...Ci(t)});function F4(e){if(e instanceof Fc){const t={};for(const n in e.shape){const s=e.shape[n];t[n]=J1.create(F4(s))}return new Fc({...e._def,shape:()=>t})}else return e instanceof Vg?new Vg({...e._def,type:F4(e.element)}):e instanceof J1?J1.create(F4(e.unwrap())):e instanceof PC?PC.create(F4(e.unwrap())):e instanceof lk?lk.create(e.items.map(t=>F4(t))):e}class Fc extends co{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const t=this._def.shape(),n=fo.objectKeys(t);return this._cached={shape:t,keys:n},this._cached}_parse(t){if(this._getType(t)!==Ps.object){const p=this._getOrReturnCtx(t);return ys(p,{code:On.invalid_type,expected:Ps.object,received:p.parsedType}),ti}const{status:s,ctx:a}=this._processInputParams(t),{shape:o,keys:l}=this._getCached(),i=[];if(!(this._def.catchall instanceof fv&&this._def.unknownKeys==="strip"))for(const p in a.data)l.includes(p)||i.push(p);const u=[];for(const p of l){const x=o[p],y=a.data[p];u.push({key:{status:"valid",value:p},value:x._parse(new hv(a,y,a.path,p)),alwaysSet:p in a.data})}if(this._def.catchall instanceof fv){const p=this._def.unknownKeys;if(p==="passthrough")for(const x of i)u.push({key:{status:"valid",value:x},value:{status:"valid",value:a.data[x]}});else if(p==="strict")i.length>0&&(ys(a,{code:On.unrecognized_keys,keys:i}),s.dirty());else if(p!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const p=this._def.catchall;for(const x of i){const y=a.data[x];u.push({key:{status:"valid",value:x},value:p._parse(new hv(a,y,a.path,x)),alwaysSet:x in a.data})}}return a.common.async?Promise.resolve().then(async()=>{const p=[];for(const x of u){const y=await x.key,_=await x.value;p.push({key:y,value:_,alwaysSet:x.alwaysSet})}return p}).then(p=>kf.mergeObjectSync(s,p)):kf.mergeObjectSync(s,u)}get shape(){return this._def.shape()}strict(t){return Vs.errToObj,new Fc({...this._def,unknownKeys:"strict",...t!==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:Vs.errToObj(t).message??a}:{message:a}}}:{}})}strip(){return new Fc({...this._def,unknownKeys:"strip"})}passthrough(){return new Fc({...this._def,unknownKeys:"passthrough"})}extend(t){return new Fc({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new Fc({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:ri.ZodObject})}setKey(t,n){return this.augment({[t]:n})}catchall(t){return new Fc({...this._def,catchall:t})}pick(t){const n={};for(const s of fo.objectKeys(t))t[s]&&this.shape[s]&&(n[s]=this.shape[s]);return new Fc({...this._def,shape:()=>n})}omit(t){const n={};for(const s of fo.objectKeys(this.shape))t[s]||(n[s]=this.shape[s]);return new Fc({...this._def,shape:()=>n})}deepPartial(){return F4(this)}partial(t){const n={};for(const s of fo.objectKeys(this.shape)){const a=this.shape[s];t&&!t[s]?n[s]=a:n[s]=a.optional()}return new Fc({...this._def,shape:()=>n})}required(t){const n={};for(const s of fo.objectKeys(this.shape))if(t&&!t[s])n[s]=this.shape[s];else{let o=this.shape[s];for(;o instanceof J1;)o=o._def.innerType;n[s]=o}return new Fc({...this._def,shape:()=>n})}keyof(){return A8e(fo.objectKeys(this.shape))}}Fc.create=(e,t)=>new Fc({shape:()=>e,unknownKeys:"strip",catchall:fv.create(),typeName:ri.ZodObject,...Ci(t)});Fc.strictCreate=(e,t)=>new Fc({shape:()=>e,unknownKeys:"strict",catchall:fv.create(),typeName:ri.ZodObject,...Ci(t)});Fc.lazycreate=(e,t)=>new Fc({shape:e,unknownKeys:"strip",catchall:fv.create(),typeName:ri.ZodObject,...Ci(t)});class Wte extends co{_parse(t){const{ctx:n}=this._processInputParams(t),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 Kg(i.ctx.common.issues));return ys(n,{code:On.invalid_union,unionErrors:l}),ti}if(n.common.async)return Promise.all(s.map(async o=>{const l={...n,common:{...n.common,issues:[]},parent:null};return{result:await o._parseAsync({data:n.data,path:n.path,parent:l}),ctx:l}})).then(a);{let o;const l=[];for(const u of s){const p={...n,common:{...n.common,issues:[]},parent:null},x=u._parseSync({data:n.data,path:n.path,parent:p});if(x.status==="valid")return x;x.status==="dirty"&&!o&&(o={result:x,ctx:p}),p.common.issues.length&&l.push(p.common.issues)}if(o)return n.common.issues.push(...o.ctx.common.issues),o.result;const i=l.map(u=>new Kg(u));return ys(n,{code:On.invalid_union,unionErrors:i}),ti}}get options(){return this._def.options}}Wte.create=(e,t)=>new Wte({options:e,typeName:ri.ZodUnion,...Ci(t)});function mfe(e,t){const n=Z0(e),s=Z0(t);if(e===t)return{valid:!0,data:e};if(n===Ps.object&&s===Ps.object){const a=fo.objectKeys(t),o=fo.objectKeys(e).filter(i=>a.indexOf(i)!==-1),l={...e,...t};for(const i of o){const u=mfe(e[i],t[i]);if(!u.valid)return{valid:!1};l[i]=u.data}return{valid:!0,data:l}}else if(n===Ps.array&&s===Ps.array){if(e.length!==t.length)return{valid:!1};const a=[];for(let o=0;o{if(Yke(o)||Yke(l))return ti;const i=mfe(o.value,l.value);return i.valid?((Xke(o)||Xke(l))&&n.dirty(),{status:n.value,value:i.data}):(ys(s,{code:On.invalid_intersection_types}),ti)};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}))}}Gte.create=(e,t,n)=>new Gte({left:e,right:t,typeName:ri.ZodIntersection,...Ci(n)});class lk extends co{_parse(t){const{status:n,ctx:s}=this._processInputParams(t);if(s.parsedType!==Ps.array)return ys(s,{code:On.invalid_type,expected:Ps.array,received:s.parsedType}),ti;if(s.data.lengththis._def.items.length&&(ys(s,{code:On.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const o=[...s.data].map((l,i)=>{const u=this._def.items[i]||this._def.rest;return u?u._parse(new hv(s,l,s.path,i)):null}).filter(l=>!!l);return s.common.async?Promise.all(o).then(l=>kf.mergeArray(n,l)):kf.mergeArray(n,o)}get items(){return this._def.items}rest(t){return new lk({...this._def,rest:t})}}lk.create=(e,t)=>{if(!Array.isArray(e))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new lk({items:e,typeName:ri.ZodTuple,rest:null,...Ci(t)})};class aNe extends co{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:n,ctx:s}=this._processInputParams(t);if(s.parsedType!==Ps.map)return ys(s,{code:On.invalid_type,expected:Ps.map,received:s.parsedType}),ti;const a=this._def.keyType,o=this._def.valueType,l=[...s.data.entries()].map(([i,u],p)=>({key:a._parse(new hv(s,i,s.path,[p,"key"])),value:o._parse(new hv(s,u,s.path,[p,"value"]))}));if(s.common.async){const i=new Map;return Promise.resolve().then(async()=>{for(const u of l){const p=await u.key,x=await u.value;if(p.status==="aborted"||x.status==="aborted")return ti;(p.status==="dirty"||x.status==="dirty")&&n.dirty(),i.set(p.value,x.value)}return{status:n.value,value:i}})}else{const i=new Map;for(const u of l){const p=u.key,x=u.value;if(p.status==="aborted"||x.status==="aborted")return ti;(p.status==="dirty"||x.status==="dirty")&&n.dirty(),i.set(p.value,x.value)}return{status:n.value,value:i}}}}aNe.create=(e,t,n)=>new aNe({valueType:t,keyType:e,typeName:ri.ZodMap,...Ci(n)});class LE extends co{_parse(t){const{status:n,ctx:s}=this._processInputParams(t);if(s.parsedType!==Ps.set)return ys(s,{code:On.invalid_type,expected:Ps.set,received:s.parsedType}),ti;const a=this._def;a.minSize!==null&&s.data.sizea.maxSize.value&&(ys(s,{code:On.too_big,maximum:a.maxSize.value,type:"set",inclusive:!0,exact:!1,message:a.maxSize.message}),n.dirty());const o=this._def.valueType;function l(u){const p=new Set;for(const x of u){if(x.status==="aborted")return ti;x.status==="dirty"&&n.dirty(),p.add(x.value)}return{status:n.value,value:p}}const i=[...s.data.values()].map((u,p)=>o._parse(new hv(s,u,s.path,p)));return s.common.async?Promise.all(i).then(u=>l(u)):l(i)}min(t,n){return new LE({...this._def,minSize:{value:t,message:Vs.toString(n)}})}max(t,n){return new LE({...this._def,maxSize:{value:t,message:Vs.toString(n)}})}size(t,n){return this.min(t,n).max(t,n)}nonempty(t){return this.min(1,t)}}LE.create=(e,t)=>new LE({valueType:e,minSize:null,maxSize:null,typeName:ri.ZodSet,...Ci(t)});class iNe extends co{get schema(){return this._def.getter()}_parse(t){const{ctx:n}=this._processInputParams(t);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}iNe.create=(e,t)=>new iNe({getter:e,typeName:ri.ZodLazy,...Ci(t)});class gfe extends co{_parse(t){if(t.data!==this._def.value){const n=this._getOrReturnCtx(t);return ys(n,{received:n.data,code:On.invalid_literal,expected:this._def.value}),ti}return{status:"valid",value:t.data}}get value(){return this._def.value}}gfe.create=(e,t)=>new gfe({value:e,typeName:ri.ZodLiteral,...Ci(t)});function A8e(e,t){return new EC({values:e,typeName:ri.ZodEnum,...Ci(t)})}class EC extends co{_parse(t){if(typeof t.data!="string"){const n=this._getOrReturnCtx(t),s=this._def.values;return ys(n,{expected:fo.joinValues(s),received:n.parsedType,code:On.invalid_type}),ti}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){const n=this._getOrReturnCtx(t),s=this._def.values;return ys(n,{received:n.data,code:On.invalid_enum_value,options:s}),ti}return bp(t.data)}get options(){return this._def.values}get enum(){const t={};for(const n of this._def.values)t[n]=n;return t}get Values(){const t={};for(const n of this._def.values)t[n]=n;return t}get Enum(){const t={};for(const n of this._def.values)t[n]=n;return t}extract(t,n=this._def){return EC.create(t,{...this._def,...n})}exclude(t,n=this._def){return EC.create(this.options.filter(s=>!t.includes(s)),{...this._def,...n})}}EC.create=A8e;class oNe extends co{_parse(t){const n=fo.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(t);if(s.parsedType!==Ps.string&&s.parsedType!==Ps.number){const a=fo.objectValues(n);return ys(s,{expected:fo.joinValues(a),received:s.parsedType,code:On.invalid_type}),ti}if(this._cache||(this._cache=new Set(fo.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){const a=fo.objectValues(n);return ys(s,{received:s.data,code:On.invalid_enum_value,options:a}),ti}return bp(t.data)}get enum(){return this._def.values}}oNe.create=(e,t)=>new oNe({values:e,typeName:ri.ZodNativeEnum,...Ci(t)});class Kte extends co{unwrap(){return this._def.type}_parse(t){const{ctx:n}=this._processInputParams(t);if(n.parsedType!==Ps.promise&&n.common.async===!1)return ys(n,{code:On.invalid_type,expected:Ps.promise,received:n.parsedType}),ti;const s=n.parsedType===Ps.promise?n.data:Promise.resolve(n.data);return bp(s.then(a=>this._def.type.parseAsync(a,{path:n.path,errorMap:n.common.contextualErrorMap})))}}Kte.create=(e,t)=>new Kte({type:e,typeName:ri.ZodPromise,...Ci(t)});class IC extends co{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ri.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:n,ctx:s}=this._processInputParams(t),a=this._def.effect||null,o={addIssue:l=>{ys(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 ti;const u=await this._def.schema._parseAsync({data:i,path:s.path,parent:s});return u.status==="aborted"?ti:u.status==="dirty"||n.value==="dirty"?LT(u.value):u});{if(n.value==="aborted")return ti;const i=this._def.schema._parseSync({data:l,path:s.path,parent:s});return i.status==="aborted"?ti:i.status==="dirty"||n.value==="dirty"?LT(i.value):i}}if(a.type==="refinement"){const l=i=>{const u=a.refinement(i,o);if(s.common.async)return Promise.resolve(u);if(u instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return i};if(s.common.async===!1){const i=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});return i.status==="aborted"?ti:(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"?ti:(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(!TC(l))return ti;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=>TC(l)?Promise.resolve(a.transform(l.value,o)).then(i=>({status:n.value,value:i})):ti);fo.assertNever(a)}}IC.create=(e,t,n)=>new IC({schema:e,typeName:ri.ZodEffects,effect:t,...Ci(n)});IC.createWithPreprocess=(e,t,n)=>new IC({schema:t,effect:{type:"preprocess",transform:e},typeName:ri.ZodEffects,...Ci(n)});class J1 extends co{_parse(t){return this._getType(t)===Ps.undefined?bp(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}J1.create=(e,t)=>new J1({innerType:e,typeName:ri.ZodOptional,...Ci(t)});class PC extends co{_parse(t){return this._getType(t)===Ps.null?bp(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}PC.create=(e,t)=>new PC({innerType:e,typeName:ri.ZodNullable,...Ci(t)});class xfe extends co{_parse(t){const{ctx:n}=this._processInputParams(t);let s=n.data;return n.parsedType===Ps.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}xfe.create=(e,t)=>new xfe({innerType:e,typeName:ri.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...Ci(t)});class yfe extends co{_parse(t){const{ctx:n}=this._processInputParams(t),s={...n,common:{...n.common,issues:[]}},a=this._def.innerType._parse({data:s.data,path:s.path,parent:{...s}});return Vte(a)?a.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new Kg(s.common.issues)},input:s.data})})):{status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new Kg(s.common.issues)},input:s.data})}}removeCatch(){return this._def.innerType}}yfe.create=(e,t)=>new yfe({innerType:e,typeName:ri.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...Ci(t)});class lNe extends co{_parse(t){if(this._getType(t)!==Ps.nan){const s=this._getOrReturnCtx(t);return ys(s,{code:On.invalid_type,expected:Ps.nan,received:s.parsedType}),ti}return{status:"valid",value:t.data}}}lNe.create=e=>new lNe({typeName:ri.ZodNaN,...Ci(e)});class Fdt extends co{_parse(t){const{ctx:n}=this._processInputParams(t),s=n.data;return this._def.type._parse({data:s,path:n.path,parent:n})}unwrap(){return this._def.type}}class Jxe extends co{_parse(t){const{status:n,ctx:s}=this._processInputParams(t);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"?ti:o.status==="dirty"?(n.dirty(),LT(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"?ti:a.status==="dirty"?(n.dirty(),{status:"dirty",value:a.value}):this._def.out._parseSync({data:a.value,path:s.path,parent:s})}}static create(t,n){return new Jxe({in:t,out:n,typeName:ri.ZodPipeline})}}class vfe extends co{_parse(t){const n=this._def.innerType._parse(t),s=a=>(TC(a)&&(a.value=Object.freeze(a.value)),a);return Vte(n)?n.then(a=>s(a)):s(n)}unwrap(){return this._def.innerType}}vfe.create=(e,t)=>new vfe({innerType:e,typeName:ri.ZodReadonly,...Ci(t)});var ri;(function(e){e.ZodString="ZodString",e.ZodNumber="ZodNumber",e.ZodNaN="ZodNaN",e.ZodBigInt="ZodBigInt",e.ZodBoolean="ZodBoolean",e.ZodDate="ZodDate",e.ZodSymbol="ZodSymbol",e.ZodUndefined="ZodUndefined",e.ZodNull="ZodNull",e.ZodAny="ZodAny",e.ZodUnknown="ZodUnknown",e.ZodNever="ZodNever",e.ZodVoid="ZodVoid",e.ZodArray="ZodArray",e.ZodObject="ZodObject",e.ZodUnion="ZodUnion",e.ZodDiscriminatedUnion="ZodDiscriminatedUnion",e.ZodIntersection="ZodIntersection",e.ZodTuple="ZodTuple",e.ZodRecord="ZodRecord",e.ZodMap="ZodMap",e.ZodSet="ZodSet",e.ZodFunction="ZodFunction",e.ZodLazy="ZodLazy",e.ZodLiteral="ZodLiteral",e.ZodEnum="ZodEnum",e.ZodEffects="ZodEffects",e.ZodNativeEnum="ZodNativeEnum",e.ZodOptional="ZodOptional",e.ZodNullable="ZodNullable",e.ZodDefault="ZodDefault",e.ZodCatch="ZodCatch",e.ZodPromise="ZodPromise",e.ZodBranded="ZodBranded",e.ZodPipeline="ZodPipeline",e.ZodReadonly="ZodReadonly"})(ri||(ri={}));const xc=N1.create,LA=AC.create,zdt=pfe.create;fv.create;Vg.create;const E3=Fc.create;Wte.create;Gte.create;lk.create;const cNe=gfe.create,E8e=EC.create;Kte.create;J1.create;PC.create;const Bdt=E3({email:xc().email("Invalid email address"),password:xc().min(6,"Password must be at least 6 characters")}),$dt=()=>{const{signIn:e,user:t}=tn(),n=Gn(),[s,a]=E.useState(!1),[o,l]=E.useState({}),[i,u]=E.useState(""),[p,x]=E.useState(!1),[y,_]=E.useState(!1);E.useEffect(()=>{t&&n("/dashboard")},[t,n]);const b=async k=>{k.preventDefault(),l({}),a(!0);const M=new FormData(k.currentTarget),P=M.get("email"),T=M.get("password");try{Bdt.parse({email:P,password:T}),await e(P,T)}catch(I){if(I instanceof Kg){const z={};I.errors.forEach(D=>{D.path[0]&&(z[D.path[0]]=D.message)}),l(z)}}finally{a(!1)}},S=async()=>{if(!i){Ie.error("Please enter your email address");return}x(!0);try{const{error:k}=await Q.functions.invoke("send-password-reset",{body:{email:i,redirectTo:"https://dashboard.relevelup.com/profile?reset=true"}});if(k)throw k;Ie.success("Password reset email sent! Check your inbox."),_(!1),u("")}catch(k){Ie.error(k.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(oo,{to:"/",className:"inline-flex items-center gap-2 text-sm text-white/80 hover:text-white transition-colors",children:[r.jsx(po,{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:POe,alt:"LevelUp",className:"h-12 w-auto"})})}),r.jsxs(Ze,{className:"border-0 shadow-2xl bg-white/95 backdrop-blur-sm",children:[r.jsxs(Wt,{className:"space-y-1 text-center pb-4",children:[r.jsx(Yt,{className:"text-3xl font-bold text-[#2a4347]",style:{fontFamily:"'Libre Baskerville', serif"},children:"Welcome Back"}),r.jsx(Sn,{className:"text-gray-600",children:"Sign in to access your dashboard"})]}),r.jsx(et,{children:r.jsxs("form",{onSubmit:b,className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{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($e,{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(Or,{open:y,onOpenChange:_,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(Ir,{className:"bg-white",children:[r.jsxs($r,{children:[r.jsx(Fr,{className:"text-[#2a4347]",style:{fontFamily:"'Libre Baskerville', serif"},children:"Reset Password"}),r.jsx(Zn,{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($e,{htmlFor:"reset-email",className:"text-gray-700",children:"Email"}),r.jsx(dt,{id:"reset-email",type:"email",placeholder:"your@email.com",value:i,onChange:k=>u(k.target.value),className:"border-gray-300 focus:border-[#4a6b6d] focus:ring-[#4a6b6d]"})]}),r.jsx(ee,{onClick:S,className:"w-full bg-[#4a6b6d] hover:bg-[#3d5a5c] text-white",disabled:p,children:p?"Sending...":"Send Reset Link"})]})]})]})]})})]}),r.jsxs("p",{className:"text-center text-white/70 text-sm mt-6",children:["Don't have an account?"," ",r.jsx(oo,{to:"/",className:"text-white hover:underline font-medium",children:"View Plans"})]})]})})]})]})},Udt=()=>{const[e]=Gc(),t=e.get("tier"),n=t==null?void 0:t.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(Ze,{className:"max-w-lg w-full",children:[r.jsxs(Wt,{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(di,{className:"w-10 h-10 text-green-500"})}),r.jsx(Yt,{className:"text-2xl",children:"Welcome to LevelUp!"}),r.jsx(Sn,{className:"text-lg",children:"Your subscription has been activated successfully."})]}),r.jsxs(et,{className:"space-y-6",children:[r.jsxs("div",{className:"p-4 rounded-lg bg-primary/10 border border-primary/20 space-y-2",children:[r.jsxs("div",{className:"flex items-center gap-2 text-primary",children:[r.jsx(Ns,{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."})})]})]})})},I8e=e=>{const[t,n]=E.useState(null),[s,a]=E.useState(!0);return E.useEffect(()=>{if(!e){a(!1);return}(async()=>{try{const{data:i}=await Q.storage.from("avatars").list(`${e}`);if(i&&i.length>0){const{data:u}=Q.storage.from("avatars").getPublicUrl(`${e}/${i[0].name}`);n(`${u.publicUrl}?t=${Date.now()}`)}else n(null)}catch(i){console.error("Error fetching avatar:",i),n(null)}finally{a(!1)}})()},[e]),{avatarUrl:t,loading:s,refreshAvatar:async()=>{if(e)try{const{data:l}=await Q.storage.from("avatars").list(`${e}`);if(l&&l.length>0){const{data:i}=Q.storage.from("avatars").getPublicUrl(`${e}/${l[0].name}`);n(`${i.publicUrl}?t=${Date.now()}`)}}catch(l){console.error("Error refreshing avatar:",l)}}}},P8e=async e=>{const t=new Map;return await Promise.all(e.map(async n=>{try{const{data:s}=await Q.storage.from("avatars").list(`${n}`);if(s&&s.length>0){const{data:a}=Q.storage.from("avatars").getPublicUrl(`${n}/${s[0].name}`);t.set(n,a.publicUrl)}}catch{}})),t},qdt=e=>{const[t,n]=E.useState({isTrial:!1,isExpired:!1,expiresAt:null,daysLeft:null,loading:!0});return E.useEffect(()=>{if(!e){n(a=>({...a,loading:!1}));return}(async()=>{try{const{data:a,error:o}=await Q.from("profiles").select("is_trial, trial_expires_at, subscription_status, subscription_end_date").eq("id",e).single();if(o){console.error("Error fetching trial status:",o),n(u=>({...u,loading:!1}));return}const l=(a==null?void 0:a.subscription_status)==="trialing"&&(a==null?void 0:a.subscription_end_date),i=(a==null?void 0:a.is_trial)&&(a==null?void 0:a.trial_expires_at);if(l){const u=new Date().getTime(),p=new Date(a.subscription_end_date).getTime(),x=Math.ceil((p-u)/(1e3*60*60*24)),y=x<=0;n({isTrial:!0,isExpired:y,expiresAt:a.subscription_end_date,daysLeft:y?0:x,loading:!1})}else if(i){const u=new Date().getTime(),p=new Date(a.trial_expires_at).getTime(),x=Math.ceil((p-u)/(1e3*60*60*24)),y=x<=0;n({isTrial:!0,isExpired:y,expiresAt:a.trial_expires_at,daysLeft:y?0:x,loading:!1})}else n({isTrial:!1,isExpired:!1,expiresAt:null,daysLeft:null,loading:!1})}catch(a){console.error("Error in useTrialStatus:",a),n(o=>({...o,loading:!1}))}})()},[e]),t},L8e=()=>{const{data:e,isLoading:t}=Kt({queryKey:["feature-flags"],queryFn:async()=>{const{data:s,error:a}=await Q.from("feature_flags").select("*");if(a)throw a;return s}}),n=s=>{if(!e)return!1;const a=e.find(o=>o.key===s);return(a==null?void 0:a.enabled)??!1};return{flags:e,isLoading:t,isFeatureEnabled:n,isAgentOSEnabled:n("agent_os_enabled"),isInnerCircleEnabled:n("innercircle_enabled"),isMarketplaceEnabled:n("marketplace")}},dNe="community_last_seen_post_at";function Vdt(){const{user:e}=tn(),t=Bm(),[n,s]=E.useState(0),[a,o]=E.useState(null);E.useEffect(()=>{if(!e)return;const i=localStorage.getItem(`${dNe}_${e.id}`);o(i)},[e]),E.useEffect(()=>{if(!e)return;(async()=>{let u=Q.from("community_posts").select("id",{count:"exact",head:!0});a&&(u=u.gt("created_at",a));const{data:p}=await Q.from("profiles").select("brokerage_id").eq("id",e.id).single(),{count:x,error:y}=await u;!y&&x!==null&&s(x)})()},[e,a]),E.useEffect(()=>{if(!e)return;const i=Q.channel("community-new-posts").on("postgres_changes",{event:"INSERT",schema:"public",table:"community_posts"},async u=>{const p=u.new;if(p.user_id===e.id)return;const x=t.pathname==="/community";x||s(S=>S+1);const{data:y}=await Q.from("profiles").select("name").eq("id",p.user_id).single(),_=(y==null?void 0:y.name)||"Someone",b=p.content.length>50?p.content.substring(0,50)+"...":p.content;x||Ie("New Community Post",{description:`${_}: ${b}`,action:{label:"View",onClick:()=>{window.location.href="/community"}}})}).subscribe();return()=>{Q.removeChannel(i)}},[e,t.pathname]);const l=E.useCallback(()=>{if(!e)return;const i=new Date().toISOString();localStorage.setItem(`${dNe}_${e.id}`,i),o(i),s(0)},[e]);return E.useEffect(()=>{t.pathname==="/community"&&n>0&&l()},[t.pathname,n,l]),{unreadCount:n,markAsRead:l}}function Hdt(){const{isAdmin:e}=tn(),{data:t=0}=Kt({queryKey:["wishlist-open-count"],queryFn:async()=>{const{count:n,error:s}=await Q.from("wishlist_items").select("*",{count:"exact",head:!0}).eq("status","open");if(s)throw s;return n||0},enabled:e,staleTime:6e4});return{openCount:e?t:0}}const Vse=Lse,eye=Zxe,Wdt=Ose,O8e=E.forwardRef(({className:e,...t},n)=>r.jsx(M3,{className:Bt("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",e),...t,ref:n}));O8e.displayName=M3.displayName;const Gdt=g3("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"}}),iP=E.forwardRef(({side:e="right",className:t,children:n,...s},a)=>r.jsxs(Wdt,{children:[r.jsx(O8e,{}),r.jsxs(T3,{ref:a,className:Bt(Gdt({side:e}),t),...s,children:[n,r.jsxs(Dse,{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(hs,{className:"h-4 w-4"}),r.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));iP.displayName=T3.displayName;const Hse=({className:e,...t})=>r.jsx("div",{className:Bt("flex flex-col space-y-2 text-center sm:text-left",e),...t});Hse.displayName="SheetHeader";const Wse=E.forwardRef(({className:e,...t},n)=>r.jsx(nP,{ref:n,className:Bt("text-lg font-semibold text-foreground",e),...t}));Wse.displayName=nP.displayName;const Kdt=E.forwardRef(({className:e,...t},n)=>r.jsx(sP,{ref:n,className:Bt("text-sm text-muted-foreground",e),...t}));Kdt.displayName=sP.displayName;function Zdt(e,t){return E.useReducer((n,s)=>t[n][s]??n,e)}var tye="ScrollArea",[D8e]=cc(tye),[Ydt,wp]=D8e(tye),R8e=E.forwardRef((e,t)=>{const{__scopeScrollArea:n,type:s="hover",dir:a,scrollHideDelay:o=600,...l}=e,[i,u]=E.useState(null),[p,x]=E.useState(null),[y,_]=E.useState(null),[b,S]=E.useState(null),[k,M]=E.useState(null),[P,T]=E.useState(0),[I,z]=E.useState(0),[D,U]=E.useState(!1),[V,W]=E.useState(!1),G=la(t,ne=>u(ne)),J=Sk(a);return r.jsx(Ydt,{scope:n,type:s,dir:J,scrollHideDelay:o,scrollArea:i,viewport:p,onViewportChange:x,content:y,onContentChange:_,scrollbarX:b,onScrollbarXChange:S,scrollbarXEnabled:D,onScrollbarXEnabledChange:U,scrollbarY:k,onScrollbarYChange:M,scrollbarYEnabled:V,onScrollbarYEnabledChange:W,onCornerWidthChange:T,onCornerHeightChange:z,children:r.jsx(Fn.div,{dir:J,...l,ref:G,style:{position:"relative","--radix-scroll-area-corner-width":P+"px","--radix-scroll-area-corner-height":I+"px",...e.style}})})});R8e.displayName=tye;var F8e="ScrollAreaViewport",z8e=E.forwardRef((e,t)=>{const{__scopeScrollArea:n,children:s,nonce:a,...o}=e,l=wp(F8e,n),i=E.useRef(null),u=la(t,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(Fn.div,{"data-radix-scroll-area-viewport":"",...o,ref:u,style:{overflowX:l.scrollbarXEnabled?"scroll":"hidden",overflowY:l.scrollbarYEnabled?"scroll":"hidden",...e.style},children:r.jsx("div",{ref:l.onContentChange,style:{minWidth:"100%",display:"table"},children:s})})]})});z8e.displayName=F8e;var nx="ScrollAreaScrollbar",rye=E.forwardRef((e,t)=>{const{forceMount:n,...s}=e,a=wp(nx,e.__scopeScrollArea),{onScrollbarXEnabledChange:o,onScrollbarYEnabledChange:l}=a,i=e.orientation==="horizontal";return E.useEffect(()=>(i?o(!0):l(!0),()=>{i?o(!1):l(!1)}),[i,o,l]),a.type==="hover"?r.jsx(Xdt,{...s,ref:t,forceMount:n}):a.type==="scroll"?r.jsx(Qdt,{...s,ref:t,forceMount:n}):a.type==="auto"?r.jsx(B8e,{...s,ref:t,forceMount:n}):a.type==="always"?r.jsx(nye,{...s,ref:t}):null});rye.displayName=nx;var Xdt=E.forwardRef((e,t)=>{const{forceMount:n,...s}=e,a=wp(nx,e.__scopeScrollArea),[o,l]=E.useState(!1);return E.useEffect(()=>{const i=a.scrollArea;let u=0;if(i){const p=()=>{window.clearTimeout(u),l(!0)},x=()=>{u=window.setTimeout(()=>l(!1),a.scrollHideDelay)};return i.addEventListener("pointerenter",p),i.addEventListener("pointerleave",x),()=>{window.clearTimeout(u),i.removeEventListener("pointerenter",p),i.removeEventListener("pointerleave",x)}}},[a.scrollArea,a.scrollHideDelay]),r.jsx(Tc,{present:n||o,children:r.jsx(B8e,{"data-state":o?"visible":"hidden",...s,ref:t})})}),Qdt=E.forwardRef((e,t)=>{const{forceMount:n,...s}=e,a=wp(nx,e.__scopeScrollArea),o=e.orientation==="horizontal",l=Kse(()=>u("SCROLL_END"),100),[i,u]=Zdt("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 E.useEffect(()=>{if(i==="idle"){const p=window.setTimeout(()=>u("HIDE"),a.scrollHideDelay);return()=>window.clearTimeout(p)}},[i,a.scrollHideDelay,u]),E.useEffect(()=>{const p=a.viewport,x=o?"scrollLeft":"scrollTop";if(p){let y=p[x];const _=()=>{const b=p[x];y!==b&&(u("SCROLL"),l()),y=b};return p.addEventListener("scroll",_),()=>p.removeEventListener("scroll",_)}},[a.viewport,o,u,l]),r.jsx(Tc,{present:n||i!=="hidden",children:r.jsx(nye,{"data-state":i==="hidden"?"hidden":"visible",...s,ref:t,onPointerEnter:un(e.onPointerEnter,()=>u("POINTER_ENTER")),onPointerLeave:un(e.onPointerLeave,()=>u("POINTER_LEAVE"))})})}),B8e=E.forwardRef((e,t)=>{const n=wp(nx,e.__scopeScrollArea),{forceMount:s,...a}=e,[o,l]=E.useState(!1),i=e.orientation==="horizontal",u=Kse(()=>{if(n.viewport){const p=n.viewport.offsetWidth{const{orientation:n="vertical",...s}=e,a=wp(nx,e.__scopeScrollArea),o=E.useRef(null),l=E.useRef(0),[i,u]=E.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),p=H8e(i.viewport,i.content),x={...s,sizes:i,onSizesChange:u,hasThumb:p>0&&p<1,onThumbChange:_=>o.current=_,onThumbPointerUp:()=>l.current=0,onThumbPointerDown:_=>l.current=_};function y(_,b){return sut(_,l.current,i,b)}return n==="horizontal"?r.jsx(Jdt,{...x,ref:t,onThumbPositionChange:()=>{if(a.viewport&&o.current){const _=a.viewport.scrollLeft,b=uNe(_,i,a.dir);o.current.style.transform=`translate3d(${b}px, 0, 0)`}},onWheelScroll:_=>{a.viewport&&(a.viewport.scrollLeft=_)},onDragScroll:_=>{a.viewport&&(a.viewport.scrollLeft=y(_,a.dir))}}):n==="vertical"?r.jsx(eut,{...x,ref:t,onThumbPositionChange:()=>{if(a.viewport&&o.current){const _=a.viewport.scrollTop,b=uNe(_,i);o.current.style.transform=`translate3d(0, ${b}px, 0)`}},onWheelScroll:_=>{a.viewport&&(a.viewport.scrollTop=_)},onDragScroll:_=>{a.viewport&&(a.viewport.scrollTop=y(_))}}):null}),Jdt=E.forwardRef((e,t)=>{const{sizes:n,onSizesChange:s,...a}=e,o=wp(nx,e.__scopeScrollArea),[l,i]=E.useState(),u=E.useRef(null),p=la(t,u,o.onScrollbarXChange);return E.useEffect(()=>{u.current&&i(getComputedStyle(u.current))},[u]),r.jsx(U8e,{"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":Gse(n)+"px",...e.style},onThumbPointerDown:x=>e.onThumbPointerDown(x.x),onDragScroll:x=>e.onDragScroll(x.x),onWheelScroll:(x,y)=>{if(o.viewport){const _=o.viewport.scrollLeft+x.deltaX;e.onWheelScroll(_),G8e(_,y)&&x.preventDefault()}},onResize:()=>{u.current&&o.viewport&&l&&s({content:o.viewport.scrollWidth,viewport:o.viewport.offsetWidth,scrollbar:{size:u.current.clientWidth,paddingStart:Yte(l.paddingLeft),paddingEnd:Yte(l.paddingRight)}})}})}),eut=E.forwardRef((e,t)=>{const{sizes:n,onSizesChange:s,...a}=e,o=wp(nx,e.__scopeScrollArea),[l,i]=E.useState(),u=E.useRef(null),p=la(t,u,o.onScrollbarYChange);return E.useEffect(()=>{u.current&&i(getComputedStyle(u.current))},[u]),r.jsx(U8e,{"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":Gse(n)+"px",...e.style},onThumbPointerDown:x=>e.onThumbPointerDown(x.y),onDragScroll:x=>e.onDragScroll(x.y),onWheelScroll:(x,y)=>{if(o.viewport){const _=o.viewport.scrollTop+x.deltaY;e.onWheelScroll(_),G8e(_,y)&&x.preventDefault()}},onResize:()=>{u.current&&o.viewport&&l&&s({content:o.viewport.scrollHeight,viewport:o.viewport.offsetHeight,scrollbar:{size:u.current.clientHeight,paddingStart:Yte(l.paddingTop),paddingEnd:Yte(l.paddingBottom)}})}})}),[tut,$8e]=D8e(nx),U8e=E.forwardRef((e,t)=>{const{__scopeScrollArea:n,sizes:s,hasThumb:a,onThumbChange:o,onThumbPointerUp:l,onThumbPointerDown:i,onThumbPositionChange:u,onDragScroll:p,onWheelScroll:x,onResize:y,..._}=e,b=wp(nx,n),[S,k]=E.useState(null),M=la(t,G=>k(G)),P=E.useRef(null),T=E.useRef(""),I=b.viewport,z=s.content-s.viewport,D=sc(x),U=sc(u),V=Kse(y,10);function W(G){if(P.current){const J=G.clientX-P.current.left,ne=G.clientY-P.current.top;p({x:J,y:ne})}}return E.useEffect(()=>{const G=J=>{const ne=J.target;(S==null?void 0:S.contains(ne))&&D(J,z)};return document.addEventListener("wheel",G,{passive:!1}),()=>document.removeEventListener("wheel",G,{passive:!1})},[I,S,z,D]),E.useEffect(U,[s,U]),LC(S,V),LC(b.content,V),r.jsx(tut,{scope:n,scrollbar:S,hasThumb:a,onThumbChange:sc(o),onThumbPointerUp:sc(l),onThumbPositionChange:U,onThumbPointerDown:sc(i),children:r.jsx(Fn.div,{..._,ref:M,style:{position:"absolute",..._.style},onPointerDown:un(e.onPointerDown,G=>{G.button===0&&(G.target.setPointerCapture(G.pointerId),P.current=S.getBoundingClientRect(),T.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",b.viewport&&(b.viewport.style.scrollBehavior="auto"),W(G))}),onPointerMove:un(e.onPointerMove,W),onPointerUp:un(e.onPointerUp,G=>{const J=G.target;J.hasPointerCapture(G.pointerId)&&J.releasePointerCapture(G.pointerId),document.body.style.webkitUserSelect=T.current,b.viewport&&(b.viewport.style.scrollBehavior=""),P.current=null})})})}),Zte="ScrollAreaThumb",q8e=E.forwardRef((e,t)=>{const{forceMount:n,...s}=e,a=$8e(Zte,e.__scopeScrollArea);return r.jsx(Tc,{present:n||a.hasThumb,children:r.jsx(rut,{ref:t,...s})})}),rut=E.forwardRef((e,t)=>{const{__scopeScrollArea:n,style:s,...a}=e,o=wp(Zte,n),l=$8e(Zte,n),{onThumbPositionChange:i}=l,u=la(t,y=>l.onThumbChange(y)),p=E.useRef(void 0),x=Kse(()=>{p.current&&(p.current(),p.current=void 0)},100);return E.useEffect(()=>{const y=o.viewport;if(y){const _=()=>{if(x(),!p.current){const b=aut(y,i);p.current=b,i()}};return i(),y.addEventListener("scroll",_),()=>y.removeEventListener("scroll",_)}},[o.viewport,x,i]),r.jsx(Fn.div,{"data-state":l.hasThumb?"visible":"hidden",...a,ref:u,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...s},onPointerDownCapture:un(e.onPointerDownCapture,y=>{const b=y.target.getBoundingClientRect(),S=y.clientX-b.left,k=y.clientY-b.top;l.onThumbPointerDown({x:S,y:k})}),onPointerUp:un(e.onPointerUp,l.onThumbPointerUp)})});q8e.displayName=Zte;var sye="ScrollAreaCorner",V8e=E.forwardRef((e,t)=>{const n=wp(sye,e.__scopeScrollArea),s=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&s?r.jsx(nut,{...e,ref:t}):null});V8e.displayName=sye;var nut=E.forwardRef((e,t)=>{const{__scopeScrollArea:n,...s}=e,a=wp(sye,n),[o,l]=E.useState(0),[i,u]=E.useState(0),p=!!(o&&i);return LC(a.scrollbarX,()=>{var y;const x=((y=a.scrollbarX)==null?void 0:y.offsetHeight)||0;a.onCornerHeightChange(x),u(x)}),LC(a.scrollbarY,()=>{var y;const x=((y=a.scrollbarY)==null?void 0:y.offsetWidth)||0;a.onCornerWidthChange(x),l(x)}),p?r.jsx(Fn.div,{...s,ref:t,style:{width:o,height:i,position:"absolute",right:a.dir==="ltr"?0:void 0,left:a.dir==="rtl"?0:void 0,bottom:0,...e.style}}):null});function Yte(e){return e?parseInt(e,10):0}function H8e(e,t){const n=e/t;return isNaN(n)?0:n}function Gse(e){const t=H8e(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,s=(e.scrollbar.size-n)*t;return Math.max(s,18)}function sut(e,t,n,s="ltr"){const a=Gse(n),o=a/2,l=t||o,i=a-l,u=n.scrollbar.paddingStart+l,p=n.scrollbar.size-n.scrollbar.paddingEnd-i,x=n.content-n.viewport,y=s==="ltr"?[0,x]:[x*-1,0];return W8e([u,p],y)(e)}function uNe(e,t,n="ltr"){const s=Gse(t),a=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,o=t.scrollbar.size-a,l=t.content-t.viewport,i=o-s,u=n==="ltr"?[0,l]:[l*-1,0],p=IE(e,u);return W8e([0,l],[0,i])(p)}function W8e(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const s=(t[1]-t[0])/(e[1]-e[0]);return t[0]+s*(n-e[0])}}function G8e(e,t){return e>0&&e{})=>{let n={left:e.scrollLeft,top:e.scrollTop},s=0;return function a(){const o={left:e.scrollLeft,top:e.scrollTop},l=n.left!==o.left,i=n.top!==o.top;(l||i)&&t(),n=o,s=window.requestAnimationFrame(a)}(),()=>window.cancelAnimationFrame(s)};function Kse(e,t){const n=sc(e),s=E.useRef(0);return E.useEffect(()=>()=>window.clearTimeout(s.current),[]),E.useCallback(()=>{window.clearTimeout(s.current),s.current=window.setTimeout(n,t)},[n,t])}function LC(e,t){const n=sc(t);oc(()=>{let s=0;if(e){const a=new ResizeObserver(()=>{cancelAnimationFrame(s),s=window.requestAnimationFrame(n)});return a.observe(e),()=>{window.cancelAnimationFrame(s),a.unobserve(e)}}},[e,n])}var K8e=R8e,iut=z8e,out=V8e;const Bo=E.forwardRef(({className:e,children:t,...n},s)=>r.jsxs(K8e,{ref:s,className:Bt("relative overflow-hidden",e),...n,children:[r.jsx(iut,{className:"h-full w-full rounded-[inherit]",children:t}),r.jsx(aye,{}),r.jsx(out,{})]}));Bo.displayName=K8e.displayName;const aye=E.forwardRef(({className:e,orientation:t="vertical",...n},s)=>r.jsx(rye,{ref:s,orientation:t,className:Bt("flex touch-none select-none transition-colors",t==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",t==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",e),...n,children:r.jsx(q8e,{className:"relative flex-1 rounded-full bg-border"})}));aye.displayName=rye.displayName;var Zse="Collapsible",[lut]=cc(Zse),[cut,iye]=lut(Zse),Z8e=E.forwardRef((e,t)=>{const{__scopeCollapsible:n,open:s,defaultOpen:a,disabled:o,onOpenChange:l,...i}=e,[u,p]=Ju({prop:s,defaultProp:a??!1,onChange:l,caller:Zse});return r.jsx(cut,{scope:n,disabled:o,contentId:fd(),open:u,onOpenToggle:E.useCallback(()=>p(x=>!x),[p]),children:r.jsx(Fn.div,{"data-state":lye(u),"data-disabled":o?"":void 0,...i,ref:t})})});Z8e.displayName=Zse;var Y8e="CollapsibleTrigger",X8e=E.forwardRef((e,t)=>{const{__scopeCollapsible:n,...s}=e,a=iye(Y8e,n);return r.jsx(Fn.button,{type:"button","aria-controls":a.contentId,"aria-expanded":a.open||!1,"data-state":lye(a.open),"data-disabled":a.disabled?"":void 0,disabled:a.disabled,...s,ref:t,onClick:un(e.onClick,a.onOpenToggle)})});X8e.displayName=Y8e;var oye="CollapsibleContent",Q8e=E.forwardRef((e,t)=>{const{forceMount:n,...s}=e,a=iye(oye,e.__scopeCollapsible);return r.jsx(Tc,{present:n||a.open,children:({present:o})=>r.jsx(dut,{...s,ref:t,present:o})})});Q8e.displayName=oye;var dut=E.forwardRef((e,t)=>{const{__scopeCollapsible:n,present:s,children:a,...o}=e,l=iye(oye,n),[i,u]=E.useState(s),p=E.useRef(null),x=la(t,p),y=E.useRef(0),_=y.current,b=E.useRef(0),S=b.current,k=l.open||i,M=E.useRef(k),P=E.useRef(void 0);return E.useEffect(()=>{const T=requestAnimationFrame(()=>M.current=!1);return()=>cancelAnimationFrame(T)},[]),oc(()=>{const T=p.current;if(T){P.current=P.current||{transitionDuration:T.style.transitionDuration,animationName:T.style.animationName},T.style.transitionDuration="0s",T.style.animationName="none";const I=T.getBoundingClientRect();y.current=I.height,b.current=I.width,M.current||(T.style.transitionDuration=P.current.transitionDuration,T.style.animationName=P.current.animationName),u(s)}},[l.open,s]),r.jsx(Fn.div,{"data-state":lye(l.open),"data-disabled":l.disabled?"":void 0,id:l.contentId,hidden:!k,...o,ref:x,style:{"--radix-collapsible-content-height":_?`${_}px`:void 0,"--radix-collapsible-content-width":S?`${S}px`:void 0,...e.style},children:k&&a})});function lye(e){return e?"open":"closed"}var uut=Z8e;const HS=uut,WS=X8e,GS=Q8e,hNe="/assets/levelup-logo-Eif24dqY.png",hut="/assets/levelup-logo-icon-C-7iromj.png";var oP=e=>e.type==="checkbox",sj=e=>e instanceof Date,Hu=e=>e==null;const J8e=e=>typeof e=="object";var Cc=e=>!Hu(e)&&!Array.isArray(e)&&J8e(e)&&!sj(e),eDe=e=>Cc(e)&&e.target?oP(e.target)?e.target.checked:e.target.value:e,fut=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,tDe=(e,t)=>e.has(fut(t)),put=e=>{const t=e.constructor&&e.constructor.prototype;return Cc(t)&&t.hasOwnProperty("isPrototypeOf")},cye=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function td(e){let t;const n=Array.isArray(e),s=typeof FileList<"u"?e instanceof FileList:!1;if(e instanceof Date)t=new Date(e);else if(!(cye&&(e instanceof Blob||s))&&(n||Cc(e)))if(t=n?[]:{},!n&&!put(e))t=e;else for(const a in e)e.hasOwnProperty(a)&&(t[a]=td(e[a]));else return e;return t}var Yse=e=>/^\w*$/.test(e),yc=e=>e===void 0,dye=e=>Array.isArray(e)?e.filter(Boolean):[],uye=e=>dye(e.replace(/["|']|\]/g,"").split(/\.|\[/)),Qn=(e,t,n)=>{if(!t||!Cc(e))return n;const s=(Yse(t)?[t]:uye(t)).reduce((a,o)=>Hu(a)?a:a[o],e);return yc(s)||s===e?yc(e[t])?n:e[t]:s},tf=e=>typeof e=="boolean",Co=(e,t,n)=>{let s=-1;const a=Yse(t)?[t]:uye(t),o=a.length,l=o-1;for(;++slt.useContext(hye),mut=e=>{const{children:t,...n}=e;return lt.createElement(hye.Provider,{value:n},t)};var rDe=(e,t,n,s=!0)=>{const a={defaultValues:t._defaultValues};for(const o in e)Object.defineProperty(a,o,{get:()=>{const l=o;return t._proxyFormState[l]!==mm.all&&(t._proxyFormState[l]=!s||mm.all),n&&(n[l]=!0),e[l]}});return a};const fye=typeof window<"u"?lt.useLayoutEffect:lt.useEffect;function gut(e){const t=Xse(),{control:n=t.control,disabled:s,name:a,exact:o}=e||{},[l,i]=lt.useState(n._formState),u=lt.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return fye(()=>n._subscribe({name:a,formState:u.current,exact:o,callback:p=>{!s&&i({...n._formState,...p})}}),[a,s,o]),lt.useEffect(()=>{u.current.isValid&&n._setValid(!0)},[n]),lt.useMemo(()=>rDe(l,n,u.current,!1),[l,n])}var Cg=e=>typeof e=="string",nDe=(e,t,n,s,a)=>Cg(e)?(s&&t.watch.add(e),Qn(n,e,a)):Array.isArray(e)?e.map(o=>(s&&t.watch.add(o),Qn(n,o))):(s&&(t.watchAll=!0),n),_fe=e=>Hu(e)||!J8e(e);function Zx(e,t,n=new WeakSet){if(_fe(e)||_fe(t))return e===t;if(sj(e)&&sj(t))return e.getTime()===t.getTime();const s=Object.keys(e),a=Object.keys(t);if(s.length!==a.length)return!1;if(n.has(e)||n.has(t))return!0;n.add(e),n.add(t);for(const o of s){const l=e[o];if(!a.includes(o))return!1;if(o!=="ref"){const i=t[o];if(sj(l)&&sj(i)||Cc(l)&&Cc(i)||Array.isArray(l)&&Array.isArray(i)?!Zx(l,i,n):l!==i)return!1}}return!0}function xut(e){const t=Xse(),{control:n=t.control,name:s,defaultValue:a,disabled:o,exact:l,compute:i}=e||{},u=lt.useRef(a),p=lt.useRef(i),x=lt.useRef(void 0);p.current=i;const y=lt.useMemo(()=>n._getWatch(s,u.current),[n,s]),[_,b]=lt.useState(p.current?p.current(y):y);return fye(()=>n._subscribe({name:s,formState:{values:!0},exact:l,callback:S=>{if(!o){const k=nDe(s,n._names,S.values||n._formValues,!1,u.current);if(p.current){const M=p.current(k);Zx(M,x.current)||(b(M),x.current=M)}else b(k)}}}),[n,o,s,l]),lt.useEffect(()=>n._removeUnmounted()),_}function yut(e){const t=Xse(),{name:n,disabled:s,control:a=t.control,shouldUnregister:o,defaultValue:l}=e,i=tDe(a._names.array,n),u=lt.useMemo(()=>Qn(a._formValues,n,Qn(a._defaultValues,n,l)),[a,n,l]),p=xut({control:a,name:n,defaultValue:u,exact:!0}),x=gut({control:a,name:n,exact:!0}),y=lt.useRef(e),_=lt.useRef(a.register(n,{...e.rules,value:p,...tf(e.disabled)?{disabled:e.disabled}:{}}));y.current=e;const b=lt.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!Qn(x.errors,n)},isDirty:{enumerable:!0,get:()=>!!Qn(x.dirtyFields,n)},isTouched:{enumerable:!0,get:()=>!!Qn(x.touchedFields,n)},isValidating:{enumerable:!0,get:()=>!!Qn(x.validatingFields,n)},error:{enumerable:!0,get:()=>Qn(x.errors,n)}}),[x,n]),S=lt.useCallback(T=>_.current.onChange({target:{value:eDe(T),name:n},type:Xte.CHANGE}),[n]),k=lt.useCallback(()=>_.current.onBlur({target:{value:Qn(a._formValues,n),name:n},type:Xte.BLUR}),[n,a._formValues]),M=lt.useCallback(T=>{const I=Qn(a._fields,n);I&&T&&(I._f.ref={focus:()=>T.focus&&T.focus(),select:()=>T.select&&T.select(),setCustomValidity:z=>T.setCustomValidity(z),reportValidity:()=>T.reportValidity()})},[a._fields,n]),P=lt.useMemo(()=>({name:n,value:p,...tf(s)||x.disabled?{disabled:x.disabled||s}:{},onChange:S,onBlur:k,ref:M}),[n,s,x.disabled,S,k,M,p]);return lt.useEffect(()=>{const T=a._options.shouldUnregister||o;a.register(n,{...y.current.rules,...tf(y.current.disabled)?{disabled:y.current.disabled}:{}});const I=(z,D)=>{const U=Qn(a._fields,z);U&&U._f&&(U._f.mount=D)};if(I(n,!0),T){const z=td(Qn(a._options.defaultValues,n));Co(a._defaultValues,n,z),yc(Qn(a._formValues,n))&&Co(a._formValues,n,z)}return!i&&a.register(n),()=>{(i?T&&!a._state.action:T)?a.unregister(n):I(n,!1)}},[n,a,i,o]),lt.useEffect(()=>{a._setDisabledField({disabled:s,name:n})},[s,n,a]),lt.useMemo(()=>({field:P,formState:x,fieldState:b}),[P,x,b])}const vut=e=>e.render(yut(e));var sDe=(e,t,n,s,a)=>t?{...n[e],types:{...n[e]&&n[e].types?n[e].types:{},[s]:a||!0}}:{},OA=e=>Array.isArray(e)?e:[e],fNe=()=>{let e=[];return{get observers(){return e},next:a=>{for(const o of e)o.next&&o.next(a)},subscribe:a=>(e.push(a),{unsubscribe:()=>{e=e.filter(o=>o!==a)}}),unsubscribe:()=>{e=[]}}},yh=e=>Cc(e)&&!Object.keys(e).length,pye=e=>e.type==="file",gm=e=>typeof e=="function",Qte=e=>{if(!cye)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},aDe=e=>e.type==="select-multiple",mye=e=>e.type==="radio",_ut=e=>mye(e)||oP(e),$ce=e=>Qte(e)&&e.isConnected;function but(e,t){const n=t.slice(0,-1).length;let s=0;for(;s{for(const t in e)if(gm(e[t]))return!0;return!1};function Jte(e,t={}){const n=Array.isArray(e);if(Cc(e)||n)for(const s in e)Array.isArray(e[s])||Cc(e[s])&&!iDe(e[s])?(t[s]=Array.isArray(e[s])?[]:{},Jte(e[s],t[s])):Hu(e[s])||(t[s]=!0);return t}function oDe(e,t,n){const s=Array.isArray(e);if(Cc(e)||s)for(const a in e)Array.isArray(e[a])||Cc(e[a])&&!iDe(e[a])?yc(t)||_fe(n[a])?n[a]=Array.isArray(e[a])?Jte(e[a],[]):{...Jte(e[a])}:oDe(e[a],Hu(t)?{}:t[a],n[a]):n[a]=!Zx(e[a],t[a]);return n}var sT=(e,t)=>oDe(e,t,Jte(t));const pNe={value:!1,isValid:!1},mNe={value:!0,isValid:!0};var lDe=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(n=>n&&n.checked&&!n.disabled).map(n=>n.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!yc(e[0].attributes.value)?yc(e[0].value)||e[0].value===""?mNe:{value:e[0].value,isValid:!0}:mNe:pNe}return pNe},cDe=(e,{valueAsNumber:t,valueAsDate:n,setValueAs:s})=>yc(e)?e:t?e===""?NaN:e&&+e:n&&Cg(e)?new Date(e):s?s(e):e;const gNe={isValid:!1,value:null};var dDe=e=>Array.isArray(e)?e.reduce((t,n)=>n&&n.checked&&!n.disabled?{isValid:!0,value:n.value}:t,gNe):gNe;function xNe(e){const t=e.ref;return pye(t)?t.files:mye(t)?dDe(e.refs).value:aDe(t)?[...t.selectedOptions].map(({value:n})=>n):oP(t)?lDe(e.refs).value:cDe(yc(t.value)?e.ref.value:t.value,e)}var jut=(e,t,n,s)=>{const a={};for(const o of e){const l=Qn(t,o);l&&Co(a,o,l._f)}return{criteriaMode:n,names:[...e],fields:a,shouldUseNativeValidation:s}},ere=e=>e instanceof RegExp,aT=e=>yc(e)?e:ere(e)?e.source:Cc(e)?ere(e.value)?e.value.source:e.value:e,yNe=e=>({isOnSubmit:!e||e===mm.onSubmit,isOnBlur:e===mm.onBlur,isOnChange:e===mm.onChange,isOnAll:e===mm.all,isOnTouch:e===mm.onTouched});const vNe="AsyncFunction";var kut=e=>!!e&&!!e.validate&&!!(gm(e.validate)&&e.validate.constructor.name===vNe||Cc(e.validate)&&Object.values(e.validate).find(t=>t.constructor.name===vNe)),Nut=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate),_Ne=(e,t,n)=>!n&&(t.watchAll||t.watch.has(e)||[...t.watch].some(s=>e.startsWith(s)&&/^\.\w+/.test(e.slice(s.length))));const DA=(e,t,n,s)=>{for(const a of n||Object.keys(e)){const o=Qn(e,a);if(o){const{_f:l,...i}=o;if(l){if(l.refs&&l.refs[0]&&t(l.refs[0],a)&&!s)return!0;if(l.ref&&t(l.ref,l.name)&&!s)return!0;if(DA(i,t))break}else if(Cc(i)&&DA(i,t))break}}};function bNe(e,t,n){const s=Qn(e,n);if(s||Yse(n))return{error:s,name:n};const a=n.split(".");for(;a.length;){const o=a.join("."),l=Qn(t,o),i=Qn(e,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 Sut=(e,t,n,s)=>{n(e);const{name:a,...o}=e;return yh(o)||Object.keys(o).length>=Object.keys(t).length||Object.keys(o).find(l=>t[l]===(!s||mm.all))},Cut=(e,t,n)=>!e||!t||e===t||OA(e).some(s=>s&&(n?s===t:s.startsWith(t)||t.startsWith(s))),Mut=(e,t,n,s,a)=>a.isOnAll?!1:!n&&a.isOnTouch?!(t||e):(n?s.isOnBlur:a.isOnBlur)?!e:(n?s.isOnChange:a.isOnChange)?e:!0,Tut=(e,t)=>!dye(Qn(e,t)).length&&Oc(e,t),Aut=(e,t,n)=>{const s=OA(Qn(e,n));return Co(s,"root",t[n]),Co(e,n,s),e},Uee=e=>Cg(e);function wNe(e,t,n="validate"){if(Uee(e)||Array.isArray(e)&&e.every(Uee)||tf(e)&&!e)return{type:n,message:Uee(e)?e:"",ref:t}}var N4=e=>Cc(e)&&!ere(e)?e:{value:e,message:""},jNe=async(e,t,n,s,a,o)=>{const{ref:l,refs:i,required:u,maxLength:p,minLength:x,min:y,max:_,pattern:b,validate:S,name:k,valueAsNumber:M,mount:P}=e._f,T=Qn(n,k);if(!P||t.has(k))return{};const I=i?i[0]:l,z=oe=>{a&&I.reportValidity&&(I.setCustomValidity(tf(oe)?"":oe||""),I.reportValidity())},D={},U=mye(l),V=oP(l),W=U||V,G=(M||pye(l))&&yc(l.value)&&yc(T)||Qte(l)&&l.value===""||T===""||Array.isArray(T)&&!T.length,J=sDe.bind(null,k,s,D),ne=(oe,ge,ie,pe=Ex.maxLength,se=Ex.minLength)=>{const fe=oe?ge:ie;D[k]={type:oe?pe:se,message:fe,ref:l,...J(oe?pe:se,fe)}};if(o?!Array.isArray(T)||!T.length:u&&(!W&&(G||Hu(T))||tf(T)&&!T||V&&!lDe(i).isValid||U&&!dDe(i).isValid)){const{value:oe,message:ge}=Uee(u)?{value:!!u,message:u}:N4(u);if(oe&&(D[k]={type:Ex.required,message:ge,ref:I,...J(Ex.required,ge)},!s))return z(ge),D}if(!G&&(!Hu(y)||!Hu(_))){let oe,ge;const ie=N4(_),pe=N4(y);if(!Hu(T)&&!isNaN(T)){const se=l.valueAsNumber||T&&+T;Hu(ie.value)||(oe=se>ie.value),Hu(pe.value)||(ge=senew Date(new Date().toDateString()+" "+Ae),he=l.type=="time",ye=l.type=="week";Cg(ie.value)&&T&&(oe=he?fe(T)>fe(ie.value):ye?T>ie.value:se>new Date(ie.value)),Cg(pe.value)&&T&&(ge=he?fe(T)+oe.value,pe=!Hu(ge.value)&&T.length<+ge.value;if((ie||pe)&&(ne(ie,oe.message,ge.message),!s))return z(D[k].message),D}if(b&&!G&&Cg(T)){const{value:oe,message:ge}=N4(b);if(ere(oe)&&!T.match(oe)&&(D[k]={type:Ex.pattern,message:ge,ref:l,...J(Ex.pattern,ge)},!s))return z(ge),D}if(S){if(gm(S)){const oe=await S(T,n),ge=wNe(oe,I);if(ge&&(D[k]={...ge,...J(Ex.validate,ge.message)},!s))return z(ge.message),D}else if(Cc(S)){let oe={};for(const ge in S){if(!yh(oe)&&!s)break;const ie=wNe(await S[ge](T,n),I,ge);ie&&(oe={...ie,...J(ge,ie.message)},z(ie.message),s&&(D[k]=oe))}if(!yh(oe)&&(D[k]={ref:I,...oe},!s))return D}}return z(!0),D};const Eut={mode:mm.onSubmit,reValidateMode:mm.onChange,shouldFocusError:!0};function Iut(e={}){let t={...Eut,...e},n={submitCount:0,isDirty:!1,isReady:!1,isLoading:gm(t.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1},s={},a=Cc(t.defaultValues)||Cc(t.values)?td(t.defaultValues||t.values)||{}:{},o=t.shouldUnregister?{}:td(a),l={action:!1,mount:!1,watch:!1},i={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},u,p=0;const x={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1};let y={...x};const _={array:fNe(),state:fNe()},b=t.criteriaMode===mm.all,S=Ce=>Me=>{clearTimeout(p),p=setTimeout(Ce,Me)},k=async Ce=>{if(!t.disabled&&(x.isValid||y.isValid||Ce)){const Me=t.resolver?yh((await V()).errors):await G(s,!0);Me!==n.isValid&&_.state.next({isValid:Me})}},M=(Ce,Me)=>{!t.disabled&&(x.isValidating||x.validatingFields||y.isValidating||y.validatingFields)&&((Ce||Array.from(i.mount)).forEach(Ge=>{Ge&&(Me?Co(n.validatingFields,Ge,Me):Oc(n.validatingFields,Ge))}),_.state.next({validatingFields:n.validatingFields,isValidating:!yh(n.validatingFields)}))},P=(Ce,Me=[],Ge,Ee,He=!0,nt=!0)=>{if(Ee&&Ge&&!t.disabled){if(l.action=!0,nt&&Array.isArray(Qn(s,Ce))){const yt=Ge(Qn(s,Ce),Ee.argA,Ee.argB);He&&Co(s,Ce,yt)}if(nt&&Array.isArray(Qn(n.errors,Ce))){const yt=Ge(Qn(n.errors,Ce),Ee.argA,Ee.argB);He&&Co(n.errors,Ce,yt),Tut(n.errors,Ce)}if((x.touchedFields||y.touchedFields)&&nt&&Array.isArray(Qn(n.touchedFields,Ce))){const yt=Ge(Qn(n.touchedFields,Ce),Ee.argA,Ee.argB);He&&Co(n.touchedFields,Ce,yt)}(x.dirtyFields||y.dirtyFields)&&(n.dirtyFields=sT(a,o)),_.state.next({name:Ce,isDirty:ne(Ce,Me),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else Co(o,Ce,Me)},T=(Ce,Me)=>{Co(n.errors,Ce,Me),_.state.next({errors:n.errors})},I=Ce=>{n.errors=Ce,_.state.next({errors:n.errors,isValid:!1})},z=(Ce,Me,Ge,Ee)=>{const He=Qn(s,Ce);if(He){const nt=Qn(o,Ce,yc(Ge)?Qn(a,Ce):Ge);yc(nt)||Ee&&Ee.defaultChecked||Me?Co(o,Ce,Me?nt:xNe(He._f)):ie(Ce,nt),l.mount&&k()}},D=(Ce,Me,Ge,Ee,He)=>{let nt=!1,yt=!1;const it={name:Ce};if(!t.disabled){if(!Ge||Ee){(x.isDirty||y.isDirty)&&(yt=n.isDirty,n.isDirty=it.isDirty=ne(),nt=yt!==it.isDirty);const zt=Zx(Qn(a,Ce),Me);yt=!!Qn(n.dirtyFields,Ce),zt?Oc(n.dirtyFields,Ce):Co(n.dirtyFields,Ce,!0),it.dirtyFields=n.dirtyFields,nt=nt||(x.dirtyFields||y.dirtyFields)&&yt!==!zt}if(Ge){const zt=Qn(n.touchedFields,Ce);zt||(Co(n.touchedFields,Ce,Ge),it.touchedFields=n.touchedFields,nt=nt||(x.touchedFields||y.touchedFields)&&zt!==Ge)}nt&&He&&_.state.next(it)}return nt?it:{}},U=(Ce,Me,Ge,Ee)=>{const He=Qn(n.errors,Ce),nt=(x.isValid||y.isValid)&&tf(Me)&&n.isValid!==Me;if(t.delayError&&Ge?(u=S(()=>T(Ce,Ge)),u(t.delayError)):(clearTimeout(p),u=null,Ge?Co(n.errors,Ce,Ge):Oc(n.errors,Ce)),(Ge?!Zx(He,Ge):He)||!yh(Ee)||nt){const yt={...Ee,...nt&&tf(Me)?{isValid:Me}:{},errors:n.errors,name:Ce};n={...n,...yt},_.state.next(yt)}},V=async Ce=>{M(Ce,!0);const Me=await t.resolver(o,t.context,jut(Ce||i.mount,s,t.criteriaMode,t.shouldUseNativeValidation));return M(Ce),Me},W=async Ce=>{const{errors:Me}=await V(Ce);if(Ce)for(const Ge of Ce){const Ee=Qn(Me,Ge);Ee?Co(n.errors,Ge,Ee):Oc(n.errors,Ge)}else n.errors=Me;return Me},G=async(Ce,Me,Ge={valid:!0})=>{for(const Ee in Ce){const He=Ce[Ee];if(He){const{_f:nt,...yt}=He;if(nt){const it=i.array.has(nt.name),zt=He._f&&kut(He._f);zt&&x.validatingFields&&M([Ee],!0);const dr=await jNe(He,i.disabled,o,b,t.shouldUseNativeValidation&&!Me,it);if(zt&&x.validatingFields&&M([Ee]),dr[nt.name]&&(Ge.valid=!1,Me))break;!Me&&(Qn(dr,nt.name)?it?Aut(n.errors,dr,nt.name):Co(n.errors,nt.name,dr[nt.name]):Oc(n.errors,nt.name))}!yh(yt)&&await G(yt,Me,Ge)}}return Ge.valid},J=()=>{for(const Ce of i.unMount){const Me=Qn(s,Ce);Me&&(Me._f.refs?Me._f.refs.every(Ge=>!$ce(Ge)):!$ce(Me._f.ref))&&Ue(Ce)}i.unMount=new Set},ne=(Ce,Me)=>!t.disabled&&(Ce&&Me&&Co(o,Ce,Me),!Zx(Ae(),a)),oe=(Ce,Me,Ge)=>nDe(Ce,i,{...l.mount?o:yc(Me)?a:Cg(Ce)?{[Ce]:Me}:Me},Ge,Me),ge=Ce=>dye(Qn(l.mount?o:a,Ce,t.shouldUnregister?Qn(a,Ce,[]):[])),ie=(Ce,Me,Ge={})=>{const Ee=Qn(s,Ce);let He=Me;if(Ee){const nt=Ee._f;nt&&(!nt.disabled&&Co(o,Ce,cDe(Me,nt)),He=Qte(nt.ref)&&Hu(Me)?"":Me,aDe(nt.ref)?[...nt.ref.options].forEach(yt=>yt.selected=He.includes(yt.value)):nt.refs?oP(nt.ref)?nt.refs.forEach(yt=>{(!yt.defaultChecked||!yt.disabled)&&(Array.isArray(He)?yt.checked=!!He.find(it=>it===yt.value):yt.checked=He===yt.value||!!He)}):nt.refs.forEach(yt=>yt.checked=yt.value===He):pye(nt.ref)?nt.ref.value="":(nt.ref.value=He,nt.ref.type||_.state.next({name:Ce,values:td(o)})))}(Ge.shouldDirty||Ge.shouldTouch)&&D(Ce,He,Ge.shouldTouch,Ge.shouldDirty,!0),Ge.shouldValidate&&ye(Ce)},pe=(Ce,Me,Ge)=>{for(const Ee in Me){if(!Me.hasOwnProperty(Ee))return;const He=Me[Ee],nt=Ce+"."+Ee,yt=Qn(s,nt);(i.array.has(Ce)||Cc(He)||yt&&!yt._f)&&!sj(He)?pe(nt,He,Ge):ie(nt,He,Ge)}},se=(Ce,Me,Ge={})=>{const Ee=Qn(s,Ce),He=i.array.has(Ce),nt=td(Me);Co(o,Ce,nt),He?(_.array.next({name:Ce,values:td(o)}),(x.isDirty||x.dirtyFields||y.isDirty||y.dirtyFields)&&Ge.shouldDirty&&_.state.next({name:Ce,dirtyFields:sT(a,o),isDirty:ne(Ce,nt)})):Ee&&!Ee._f&&!Hu(nt)?pe(Ce,nt,Ge):ie(Ce,nt,Ge),_Ne(Ce,i)&&_.state.next({...n,name:Ce}),_.state.next({name:l.mount?Ce:void 0,values:td(o)})},fe=async Ce=>{l.mount=!0;const Me=Ce.target;let Ge=Me.name,Ee=!0;const He=Qn(s,Ge),nt=zt=>{Ee=Number.isNaN(zt)||sj(zt)&&isNaN(zt.getTime())||Zx(zt,Qn(o,Ge,zt))},yt=yNe(t.mode),it=yNe(t.reValidateMode);if(He){let zt,dr;const Rr=Me.type?xNe(He._f):eDe(Ce),Gr=Ce.type===Xte.BLUR||Ce.type===Xte.FOCUS_OUT,Ur=!Nut(He._f)&&!t.resolver&&!Qn(n.errors,Ge)&&!He._f.deps||Mut(Gr,Qn(n.touchedFields,Ge),n.isSubmitted,it,yt),kn=_Ne(Ge,i,Gr);Co(o,Ge,Rr),Gr?(He._f.onBlur&&He._f.onBlur(Ce),u&&u(0)):He._f.onChange&&He._f.onChange(Ce);const _s=D(Ge,Rr,Gr),ur=!yh(_s)||kn;if(!Gr&&_.state.next({name:Ge,type:Ce.type,values:td(o)}),Ur)return(x.isValid||y.isValid)&&(t.mode==="onBlur"?Gr&&k():Gr||k()),ur&&_.state.next({name:Ge,...kn?{}:_s});if(!Gr&&kn&&_.state.next({...n}),t.resolver){const{errors:Rn}=await V([Ge]);if(nt(Rr),Ee){const ea=bNe(n.errors,s,Ge),ca=bNe(Rn,s,ea.name||Ge);zt=ca.error,Ge=ca.name,dr=yh(Rn)}}else M([Ge],!0),zt=(await jNe(He,i.disabled,o,b,t.shouldUseNativeValidation))[Ge],M([Ge]),nt(Rr),Ee&&(zt?dr=!1:(x.isValid||y.isValid)&&(dr=await G(s,!0)));Ee&&(He._f.deps&&ye(He._f.deps),U(Ge,dr,zt,_s))}},he=(Ce,Me)=>{if(Qn(n.errors,Me)&&Ce.focus)return Ce.focus(),1},ye=async(Ce,Me={})=>{let Ge,Ee;const He=OA(Ce);if(t.resolver){const nt=await W(yc(Ce)?Ce:He);Ge=yh(nt),Ee=Ce?!He.some(yt=>Qn(nt,yt)):Ge}else Ce?(Ee=(await Promise.all(He.map(async nt=>{const yt=Qn(s,nt);return await G(yt&&yt._f?{[nt]:yt}:yt)}))).every(Boolean),!(!Ee&&!n.isValid)&&k()):Ee=Ge=await G(s);return _.state.next({...!Cg(Ce)||(x.isValid||y.isValid)&&Ge!==n.isValid?{}:{name:Ce},...t.resolver||!Ce?{isValid:Ge}:{},errors:n.errors}),Me.shouldFocus&&!Ee&&DA(s,he,Ce?He:i.mount),Ee},Ae=Ce=>{const Me={...l.mount?o:a};return yc(Ce)?Me:Cg(Ce)?Qn(Me,Ce):Ce.map(Ge=>Qn(Me,Ge))},we=(Ce,Me)=>({invalid:!!Qn((Me||n).errors,Ce),isDirty:!!Qn((Me||n).dirtyFields,Ce),error:Qn((Me||n).errors,Ce),isValidating:!!Qn(n.validatingFields,Ce),isTouched:!!Qn((Me||n).touchedFields,Ce)}),be=Ce=>{Ce&&OA(Ce).forEach(Me=>Oc(n.errors,Me)),_.state.next({errors:Ce?n.errors:{}})},_e=(Ce,Me,Ge)=>{const Ee=(Qn(s,Ce,{_f:{}})._f||{}).ref,He=Qn(n.errors,Ce)||{},{ref:nt,message:yt,type:it,...zt}=He;Co(n.errors,Ce,{...zt,...Me,ref:Ee}),_.state.next({name:Ce,errors:n.errors,isValid:!1}),Ge&&Ge.shouldFocus&&Ee&&Ee.focus&&Ee.focus()},Je=(Ce,Me)=>gm(Ce)?_.state.subscribe({next:Ge=>"values"in Ge&&Ce(oe(void 0,Me),Ge)}):oe(Ce,Me,!0),Te=Ce=>_.state.subscribe({next:Me=>{Cut(Ce.name,Me.name,Ce.exact)&&Sut(Me,Ce.formState||x,st,Ce.reRenderRoot)&&Ce.callback({values:{...o},...n,...Me,defaultValues:a})}}).unsubscribe,De=Ce=>(l.mount=!0,y={...y,...Ce.formState},Te({...Ce,formState:y})),Ue=(Ce,Me={})=>{for(const Ge of Ce?OA(Ce):i.mount)i.mount.delete(Ge),i.array.delete(Ge),Me.keepValue||(Oc(s,Ge),Oc(o,Ge)),!Me.keepError&&Oc(n.errors,Ge),!Me.keepDirty&&Oc(n.dirtyFields,Ge),!Me.keepTouched&&Oc(n.touchedFields,Ge),!Me.keepIsValidating&&Oc(n.validatingFields,Ge),!t.shouldUnregister&&!Me.keepDefaultValue&&Oc(a,Ge);_.state.next({values:td(o)}),_.state.next({...n,...Me.keepDirty?{isDirty:ne()}:{}}),!Me.keepIsValid&&k()},Be=({disabled:Ce,name:Me})=>{(tf(Ce)&&l.mount||Ce||i.disabled.has(Me))&&(Ce?i.disabled.add(Me):i.disabled.delete(Me))},qe=(Ce,Me={})=>{let Ge=Qn(s,Ce);const Ee=tf(Me.disabled)||tf(t.disabled);return Co(s,Ce,{...Ge||{},_f:{...Ge&&Ge._f?Ge._f:{ref:{name:Ce}},name:Ce,mount:!0,...Me}}),i.mount.add(Ce),Ge?Be({disabled:tf(Me.disabled)?Me.disabled:t.disabled,name:Ce}):z(Ce,!0,Me.value),{...Ee?{disabled:Me.disabled||t.disabled}:{},...t.progressive?{required:!!Me.required,min:aT(Me.min),max:aT(Me.max),minLength:aT(Me.minLength),maxLength:aT(Me.maxLength),pattern:aT(Me.pattern)}:{},name:Ce,onChange:fe,onBlur:fe,ref:He=>{if(He){qe(Ce,Me),Ge=Qn(s,Ce);const nt=yc(He.value)&&He.querySelectorAll&&He.querySelectorAll("input,select,textarea")[0]||He,yt=_ut(nt),it=Ge._f.refs||[];if(yt?it.find(zt=>zt===nt):nt===Ge._f.ref)return;Co(s,Ce,{_f:{...Ge._f,...yt?{refs:[...it.filter($ce),nt,...Array.isArray(Qn(a,Ce))?[{}]:[]],ref:{type:nt.type,name:Ce}}:{ref:nt}}}),z(Ce,!1,void 0,nt)}else Ge=Qn(s,Ce,{}),Ge._f&&(Ge._f.mount=!1),(t.shouldUnregister||Me.shouldUnregister)&&!(tDe(i.array,Ce)&&l.action)&&i.unMount.add(Ce)}}},ot=()=>t.shouldFocusError&&DA(s,he,i.mount),Mt=Ce=>{tf(Ce)&&(_.state.next({disabled:Ce}),DA(s,(Me,Ge)=>{const Ee=Qn(s,Ge);Ee&&(Me.disabled=Ee._f.disabled||Ce,Array.isArray(Ee._f.refs)&&Ee._f.refs.forEach(He=>{He.disabled=Ee._f.disabled||Ce}))},0,!1))},Oe=(Ce,Me)=>async Ge=>{let Ee;Ge&&(Ge.preventDefault&&Ge.preventDefault(),Ge.persist&&Ge.persist());let He=td(o);if(_.state.next({isSubmitting:!0}),t.resolver){const{errors:nt,values:yt}=await V();n.errors=nt,He=td(yt)}else await G(s);if(i.disabled.size)for(const nt of i.disabled)Oc(He,nt);if(Oc(n.errors,"root"),yh(n.errors)){_.state.next({errors:{}});try{await Ce(He,Ge)}catch(nt){Ee=nt}}else Me&&await Me({...n.errors},Ge),ot(),setTimeout(ot);if(_.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:yh(n.errors)&&!Ee,submitCount:n.submitCount+1,errors:n.errors}),Ee)throw Ee},at=(Ce,Me={})=>{Qn(s,Ce)&&(yc(Me.defaultValue)?se(Ce,td(Qn(a,Ce))):(se(Ce,Me.defaultValue),Co(a,Ce,td(Me.defaultValue))),Me.keepTouched||Oc(n.touchedFields,Ce),Me.keepDirty||(Oc(n.dirtyFields,Ce),n.isDirty=Me.defaultValue?ne(Ce,td(Qn(a,Ce))):ne()),Me.keepError||(Oc(n.errors,Ce),x.isValid&&k()),_.state.next({...n}))},le=(Ce,Me={})=>{const Ge=Ce?td(Ce):a,Ee=td(Ge),He=yh(Ce),nt=He?a:Ee;if(Me.keepDefaultValues||(a=Ge),!Me.keepValues){if(Me.keepDirtyValues){const yt=new Set([...i.mount,...Object.keys(sT(a,o))]);for(const it of Array.from(yt))Qn(n.dirtyFields,it)?Co(nt,it,Qn(o,it)):se(it,Qn(nt,it))}else{if(cye&&yc(Ce))for(const yt of i.mount){const it=Qn(s,yt);if(it&&it._f){const zt=Array.isArray(it._f.refs)?it._f.refs[0]:it._f.ref;if(Qte(zt)){const dr=zt.closest("form");if(dr){dr.reset();break}}}}if(Me.keepFieldsRef)for(const yt of i.mount)se(yt,Qn(nt,yt));else s={}}o=t.shouldUnregister?Me.keepDefaultValues?td(a):{}:td(nt),_.array.next({values:{...nt}}),_.state.next({values:{...nt}})}i={mount:Me.keepDirtyValues?i.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},l.mount=!x.isValid||!!Me.keepIsValid||!!Me.keepDirtyValues,l.watch=!!t.shouldUnregister,_.state.next({submitCount:Me.keepSubmitCount?n.submitCount:0,isDirty:He?!1:Me.keepDirty?n.isDirty:!!(Me.keepDefaultValues&&!Zx(Ce,a)),isSubmitted:Me.keepIsSubmitted?n.isSubmitted:!1,dirtyFields:He?{}:Me.keepDirtyValues?Me.keepDefaultValues&&o?sT(a,o):n.dirtyFields:Me.keepDefaultValues&&Ce?sT(a,Ce):Me.keepDirty?n.dirtyFields:{},touchedFields:Me.keepTouched?n.touchedFields:{},errors:Me.keepErrors?n.errors:{},isSubmitSuccessful:Me.keepIsSubmitSuccessful?n.isSubmitSuccessful:!1,isSubmitting:!1})},Ve=(Ce,Me)=>le(gm(Ce)?Ce(o):Ce,Me),Qe=(Ce,Me={})=>{const Ge=Qn(s,Ce),Ee=Ge&&Ge._f;if(Ee){const He=Ee.refs?Ee.refs[0]:Ee.ref;He.focus&&(He.focus(),Me.shouldSelect&&gm(He.select)&&He.select())}},st=Ce=>{n={...n,...Ce}},ct={control:{register:qe,unregister:Ue,getFieldState:we,handleSubmit:Oe,setError:_e,_subscribe:Te,_runSchema:V,_focusError:ot,_getWatch:oe,_getDirty:ne,_setValid:k,_setFieldArray:P,_setDisabledField:Be,_setErrors:I,_getFieldArray:ge,_reset:le,_resetDefaultValues:()=>gm(t.defaultValues)&&t.defaultValues().then(Ce=>{Ve(Ce,t.resetOptions),_.state.next({isLoading:!1})}),_removeUnmounted:J,_disableForm:Mt,_subjects:_,_proxyFormState:x,get _fields(){return s},get _formValues(){return o},get _state(){return l},set _state(Ce){l=Ce},get _defaultValues(){return a},get _names(){return i},set _names(Ce){i=Ce},get _formState(){return n},get _options(){return t},set _options(Ce){t={...t,...Ce}}},subscribe:De,trigger:ye,register:qe,handleSubmit:Oe,watch:Je,setValue:se,getValues:Ae,reset:Ve,resetField:at,clearErrors:be,unregister:Ue,setError:_e,setFocus:Qe,getFieldState:we};return{...ct,formControl:ct}}function Qse(e={}){const t=lt.useRef(void 0),n=lt.useRef(void 0),[s,a]=lt.useState({isDirty:!1,isValidating:!1,isLoading:gm(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,isReady:!1,defaultValues:gm(e.defaultValues)?void 0:e.defaultValues});if(!t.current)if(e.formControl)t.current={...e.formControl,formState:s},e.defaultValues&&!gm(e.defaultValues)&&e.formControl.reset(e.defaultValues,e.resetOptions);else{const{formControl:l,...i}=Iut(e);t.current={...i,formState:s}}const o=t.current.control;return o._options=e,fye(()=>{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]),lt.useEffect(()=>o._disableForm(e.disabled),[o,e.disabled]),lt.useEffect(()=>{e.mode&&(o._options.mode=e.mode),e.reValidateMode&&(o._options.reValidateMode=e.reValidateMode)},[o,e.mode,e.reValidateMode]),lt.useEffect(()=>{e.errors&&(o._setErrors(e.errors),o._focusError())},[o,e.errors]),lt.useEffect(()=>{e.shouldUnregister&&o._subjects.state.next({values:o._getWatch()})},[o,e.shouldUnregister]),lt.useEffect(()=>{if(o._proxyFormState.isDirty){const l=o._getDirty();l!==s.isDirty&&o._subjects.state.next({isDirty:l})}},[o,s.isDirty]),lt.useEffect(()=>{e.values&&!Zx(e.values,n.current)?(o._reset(e.values,{keepFieldsRef:!0,...o._options.resetOptions}),n.current=e.values,a(l=>({...l}))):o._resetDefaultValues()},[o,e.values]),lt.useEffect(()=>{o._state.mount||(o._setValid(),o._state.mount=!0),o._state.watch&&(o._state.watch=!1,o._subjects.state.next({...o._formState})),o._removeUnmounted()}),t.current.formState=rDe(s,o),t.current}const kNe=(e,t,n)=>{if(e&&"reportValidity"in e){const s=Qn(n,t);e.setCustomValidity(s&&s.message||""),e.reportValidity()}},uDe=(e,t)=>{for(const n in t.fields){const s=t.fields[n];s&&s.ref&&"reportValidity"in s.ref?kNe(s.ref,n,e):s.refs&&s.refs.forEach(a=>kNe(a,n,e))}},Put=(e,t)=>{t.shouldUseNativeValidation&&uDe(e,t);const n={};for(const s in e){const a=Qn(t.fields,s),o=Object.assign(e[s]||{},{ref:a&&a.ref});if(Lut(t.names||Object.keys(e),s)){const l=Object.assign({},Qn(n,s));Co(l,"root",o),Co(n,s,l)}else Co(n,s,o)}return n},Lut=(e,t)=>e.some(n=>n.startsWith(t+"."));var Out=function(e,t){for(var n={};e.length;){var s=e[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 e.push(y)})}),t){var u=n[l].types,p=u&&u[s.code];n[l]=sDe(l,t,n,a,p?[].concat(p,s.message):s.message)}e.shift()}return n},Jse=function(e,t,n){return n===void 0&&(n={}),function(s,a,o){try{return Promise.resolve(function(l,i){try{var u=Promise.resolve(e[n.mode==="sync"?"parse":"parseAsync"](s,t)).then(function(p){return o.shouldUseNativeValidation&&uDe({},o),{errors:{},values:n.raw?s:p}})}catch(p){return i(p)}return u&&u.then?u.then(void 0,i):u}(0,function(l){if(function(i){return Array.isArray(i==null?void 0:i.errors)}(l))return{values:{},errors:Put(Out(l.errors,!o.shouldUseNativeValidation&&o.criteriaMode==="all"),o)};throw l}))}catch(l){return Promise.reject(l)}}};const eae=mut,hDe=E.createContext({}),Ll=({...e})=>r.jsx(hDe.Provider,{value:{name:e.name},children:r.jsx(vut,{...e})}),tae=()=>{const e=E.useContext(hDe),t=E.useContext(fDe),{getFieldState:n,formState:s}=Xse(),a=n(e.name,s);if(!e)throw new Error("useFormField should be used within ");const{id:o}=t;return{id:o,name:e.name,formItemId:`${o}-form-item`,formDescriptionId:`${o}-form-item-description`,formMessageId:`${o}-form-item-message`,...a}},fDe=E.createContext({}),Nl=E.forwardRef(({className:e,...t},n)=>{const s=E.useId();return r.jsx(fDe.Provider,{value:{id:s},children:r.jsx("div",{ref:n,className:Bt("space-y-2",e),...t})})});Nl.displayName="FormItem";const Sl=E.forwardRef(({className:e,...t},n)=>{const{error:s,formItemId:a}=tae();return r.jsx($e,{ref:n,className:Bt(s&&"text-destructive",e),htmlFor:a,...t})});Sl.displayName="FormLabel";const Cl=E.forwardRef(({...e},t)=>{const{error:n,formItemId:s,formDescriptionId:a,formMessageId:o}=tae();return r.jsx(Qge,{ref:t,id:s,"aria-describedby":n?`${a} ${o}`:`${a}`,"aria-invalid":!!n,...e})});Cl.displayName="FormControl";const qee=E.forwardRef(({className:e,...t},n)=>{const{formDescriptionId:s}=tae();return r.jsx("p",{ref:n,id:s,className:Bt("text-sm text-muted-foreground",e),...t})});qee.displayName="FormDescription";const Wu=E.forwardRef(({className:e,children:t,...n},s)=>{const{error:a,formMessageId:o}=tae(),l=a?String(a==null?void 0:a.message):t;return l?r.jsx("p",{ref:s,id:o,className:Bt("text-sm font-medium text-destructive",e),...n,children:l}):null});Wu.displayName="FormMessage";const Jn=E.forwardRef(({className:e,...t},n)=>r.jsx("textarea",{className:Bt("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",e),ref:n,...t}));Jn.displayName="Textarea";const Dut=E3({category:E8e(["general","technology","crm","marketing"]),subject:xc().min(5,"Subject must be at least 5 characters").max(200),description:xc().min(20,"Please provide more details (at least 20 characters)").max(2e3)}),Rut={general:"General Support",technology:"Technology Support",crm:"CRM Support",marketing:"Marketing Support"};function bfe({trigger:e}){const[t,n]=E.useState(!1),[s,a]=E.useState(!1),{user:o}=tn(),l=Qse({resolver:Jse(Dut),defaultValues:{category:"general",subject:"",description:""}}),i=async u=>{if(!o){Ie.error("You must be logged in to submit a ticket");return}a(!0);try{const{error:p}=await Q.from("support_tickets").insert({user_id:o.id,category:u.category,subject:u.subject,description:u.description});if(p)throw p;try{await Q.functions.invoke("support-ticket-notify",{body:{category:Rut[u.category],subject:u.subject}})}catch(x){console.log("Notification send attempted:",x)}Ie.success("Support ticket submitted successfully!"),l.reset(),n(!1)}catch(p){console.error("Error submitting ticket:",p),Ie.error("Failed to submit ticket. Please try again.")}finally{a(!1)}};return r.jsxs(Or,{open:t,onOpenChange:n,children:[r.jsx(Zo,{asChild:!0,children:e||r.jsxs(ee,{variant:"ghost",size:"icon",className:"relative",children:[r.jsx(dA,{className:"h-5 w-5"}),r.jsx("span",{className:"sr-only",children:"Support"})]})}),r.jsxs(Ir,{className:"sm:max-w-[500px]",children:[r.jsxs($r,{children:[r.jsx(Fr,{children:"Need Help?"}),r.jsx(Zn,{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(Ti,{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(eae,{...l,children:r.jsxs("form",{onSubmit:l.handleSubmit(i),className:"space-y-4",children:[r.jsx(Ll,{control:l.control,name:"category",render:({field:u})=>r.jsxs(Nl,{children:[r.jsx(Sl,{children:"Category"}),r.jsxs(mn,{onValueChange:u.onChange,defaultValue:u.value,children:[r.jsx(Cl,{children:r.jsx(fn,{children:r.jsx(yn,{placeholder:"Select a category"})})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"general",children:"General Support"}),r.jsx(qt,{value:"technology",children:"Technology Support"}),r.jsx(qt,{value:"crm",children:"CRM Support"}),r.jsx(qt,{value:"marketing",children:"Marketing Support"})]})]}),r.jsx(Wu,{})]})}),r.jsx(Ll,{control:l.control,name:"subject",render:({field:u})=>r.jsxs(Nl,{children:[r.jsx(Sl,{children:"Subject"}),r.jsx(Cl,{children:r.jsx(dt,{placeholder:"Brief description of your issue",...u})}),r.jsx(Wu,{})]})}),r.jsx(Ll,{control:l.control,name:"description",render:({field:u})=>r.jsxs(Nl,{children:[r.jsx(Sl,{children:"Description"}),r.jsx(Cl,{children:r.jsx(Jn,{placeholder:"Please describe your issue in detail...",className:"min-h-[120px]",...u})}),r.jsx(Wu,{})]})}),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 Ms(e){const t=Object.prototype.toString.call(e);return e instanceof Date||typeof e=="object"&&t==="[object Date]"?new e.constructor(+e):typeof e=="number"||t==="[object Number]"||typeof e=="string"||t==="[object String]"?new Date(e):new Date(NaN)}function To(e,t){return e instanceof Date?new e.constructor(t):new Date(t)}function Ql(e,t){const n=Ms(e);return isNaN(t)?To(e,NaN):(t&&n.setDate(n.getDate()+t),n)}function Ph(e,t){const n=Ms(e);if(isNaN(t))return To(e,NaN);if(!t)return n;const s=n.getDate(),a=To(e,n.getTime());a.setMonth(n.getMonth()+t+1,0);const o=a.getDate();return s>=o?a:(n.setFullYear(a.getFullYear(),a.getMonth(),s),n)}function pDe(e,t){const n=+Ms(e);return To(e,n+t)}const gye=6048e5,Fut=864e5,mDe=6e4,gDe=36e5,zut=1e3,sO=43200,NNe=1440;function SNe(e,t){return pDe(e,t*gDe)}let But={};function Sv(){return But}function Nf(e,t){var i,u,p,x;const n=Sv(),s=(t==null?void 0:t.weekStartsOn)??((u=(i=t==null?void 0:t.locale)==null?void 0:i.options)==null?void 0:u.weekStartsOn)??n.weekStartsOn??((x=(p=n.locale)==null?void 0:p.options)==null?void 0:x.weekStartsOn)??0,a=Ms(e),o=a.getDay(),l=(o=a.getTime()?n+1:t.getTime()>=l.getTime()?n:n-1}function Sf(e){const t=Ms(e);return t.setHours(0,0,0,0),t}function pv(e){const t=Ms(e),n=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return n.setUTCFullYear(t.getFullYear()),+e-+n}function bm(e,t){const n=Sf(e),s=Sf(t),a=+n-pv(n),o=+s-pv(s);return Math.round((a-o)/Fut)}function $ut(e){const t=xDe(e),n=To(e,0);return n.setFullYear(t,0,4),n.setHours(0,0,0,0),Ty(n)}function CNe(e,t){return pDe(e,t*mDe)}function aj(e,t){const n=t*7;return Ql(e,n)}function Uut(e,t){return Ph(e,t*12)}function qut(e){let t;return e.forEach(function(n){const s=Ms(n);(t===void 0||t{const s=Ms(n);(!t||t>s||isNaN(+s))&&(t=s)}),t||new Date(NaN)}function Vee(e,t){const n=Ms(e),s=Ms(t),a=n.getTime()-s.getTime();return a<0?-1:a>0?1:a}function Hut(e){return To(e,Date.now())}function ac(e,t){const n=Sf(e),s=Sf(t);return+n==+s}function xye(e){return e instanceof Date||typeof e=="object"&&Object.prototype.toString.call(e)==="[object Date]"}function wfe(e){if(!xye(e)&&typeof e!="number")return!1;const t=Ms(e);return!isNaN(Number(t))}function OC(e,t){const n=Ms(e),s=Ms(t),a=n.getFullYear()-s.getFullYear(),o=n.getMonth()-s.getMonth();return a*12+o}function Wut(e,t,n){const s=Nf(e,n),a=Nf(t,n),o=+s-pv(s),l=+a-pv(a);return Math.round((o-l)/gye)}function Ay(e,t){const n=Ms(e),s=Ms(t),a=MNe(n,s),o=Math.abs(bm(n,s));n.setDate(n.getDate()-a*o);const l=+(MNe(n,s)===-a),i=a*(o-l);return i===0?0:i}function MNe(e,t){const n=e.getFullYear()-t.getFullYear()||e.getMonth()-t.getMonth()||e.getDate()-t.getDate()||e.getHours()-t.getHours()||e.getMinutes()-t.getMinutes()||e.getSeconds()-t.getSeconds()||e.getMilliseconds()-t.getMilliseconds();return n<0?-1:n>0?1:n}function Gut(e){return t=>{const s=(e?Math[e]:Math.trunc)(t);return s===0?0:s}}function Kut(e,t){return+Ms(e)-+Ms(t)}function Zut(e){const t=Ms(e);return t.setHours(23,59,59,999),t}function rae(e){const t=Ms(e),n=t.getMonth();return t.setFullYear(t.getFullYear(),n+1,0),t.setHours(23,59,59,999),t}function Yut(e){const t=Ms(e);return+Zut(t)==+rae(t)}function Xut(e,t){const n=Ms(e),s=Ms(t),a=Vee(n,s),o=Math.abs(OC(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=Vee(n,s)===-a;Yut(Ms(e))&&o===1&&Vee(e,s)===1&&(i=!1),l=a*(o-Number(i))}return l===0?0:l}function Qut(e,t,n){const s=Kut(e,t)/1e3;return Gut(n==null?void 0:n.roundingMethod)(s)}function Eh(e){const t=Ms(e);return t.setDate(1),t.setHours(0,0,0,0),t}function yDe(e){const t=Ms(e),n=To(e,0);return n.setFullYear(t.getFullYear(),0,1),n.setHours(0,0,0,0),n}function yye(e,t){var i,u,p,x;const n=Sv(),s=(t==null?void 0:t.weekStartsOn)??((u=(i=t==null?void 0:t.locale)==null?void 0:i.options)==null?void 0:u.weekStartsOn)??n.weekStartsOn??((x=(p=n.locale)==null?void 0:p.options)==null?void 0:x.weekStartsOn)??0,a=Ms(e),o=a.getDay(),l=(o{let s;const a=Jut[e];return typeof a=="string"?s=a:t===1?s=a.one:s=a.other.replace("{{count}}",t.toString()),n!=null&&n.addSuffix?n.comparison&&n.comparison>0?"in "+s:s+" ago":s};function Uce(e){return(t={})=>{const n=t.width?String(t.width):e.defaultWidth;return e.formats[n]||e.formats[e.defaultWidth]}}const tht={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},rht={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},nht={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},sht={date:Uce({formats:tht,defaultWidth:"full"}),time:Uce({formats:rht,defaultWidth:"full"}),dateTime:Uce({formats:nht,defaultWidth:"full"})},aht={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},iht=(e,t,n,s)=>aht[e];function iT(e){return(t,n)=>{const s=n!=null&&n.context?String(n.context):"standalone";let a;if(s==="formatting"&&e.formattingValues){const l=e.defaultFormattingWidth||e.defaultWidth,i=n!=null&&n.width?String(n.width):l;a=e.formattingValues[i]||e.formattingValues[l]}else{const l=e.defaultWidth,i=n!=null&&n.width?String(n.width):e.defaultWidth;a=e.values[i]||e.values[l]}const o=e.argumentCallback?e.argumentCallback(t):t;return a[o]}}const oht={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},lht={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},cht={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"]},dht={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"]},uht={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"}},hht={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"}},fht=(e,t)=>{const n=Number(e),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"},pht={ordinalNumber:fht,era:iT({values:oht,defaultWidth:"wide"}),quarter:iT({values:lht,defaultWidth:"wide",argumentCallback:e=>e-1}),month:iT({values:cht,defaultWidth:"wide"}),day:iT({values:dht,defaultWidth:"wide"}),dayPeriod:iT({values:uht,defaultWidth:"wide",formattingValues:hht,defaultFormattingWidth:"wide"})};function oT(e){return(t,n={})=>{const s=n.width,a=s&&e.matchPatterns[s]||e.matchPatterns[e.defaultMatchWidth],o=t.match(a);if(!o)return null;const l=o[0],i=s&&e.parsePatterns[s]||e.parsePatterns[e.defaultParseWidth],u=Array.isArray(i)?ght(i,y=>y.test(l)):mht(i,y=>y.test(l));let p;p=e.valueCallback?e.valueCallback(u):u,p=n.valueCallback?n.valueCallback(p):p;const x=t.slice(l.length);return{value:p,rest:x}}}function mht(e,t){for(const n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&t(e[n]))return n}function ght(e,t){for(let n=0;n{const s=t.match(e.matchPattern);if(!s)return null;const a=s[0],o=t.match(e.parsePattern);if(!o)return null;let l=e.valueCallback?e.valueCallback(o[0]):o[0];l=n.valueCallback?n.valueCallback(l):l;const i=t.slice(a.length);return{value:l,rest:i}}}const yht=/^(\d+)(th|st|nd|rd)?/i,vht=/\d+/i,_ht={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},bht={any:[/^b/i,/^(a|c)/i]},wht={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},jht={any:[/1/i,/2/i,/3/i,/4/i]},kht={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},Nht={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]},Sht={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},Cht={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]},Mht={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},Tht={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}},Aht={ordinalNumber:xht({matchPattern:yht,parsePattern:vht,valueCallback:e=>parseInt(e,10)}),era:oT({matchPatterns:_ht,defaultMatchWidth:"wide",parsePatterns:bht,defaultParseWidth:"any"}),quarter:oT({matchPatterns:wht,defaultMatchWidth:"wide",parsePatterns:jht,defaultParseWidth:"any",valueCallback:e=>e+1}),month:oT({matchPatterns:kht,defaultMatchWidth:"wide",parsePatterns:Nht,defaultParseWidth:"any"}),day:oT({matchPatterns:Sht,defaultMatchWidth:"wide",parsePatterns:Cht,defaultParseWidth:"any"}),dayPeriod:oT({matchPatterns:Mht,defaultMatchWidth:"any",parsePatterns:Tht,defaultParseWidth:"any"})},nae={code:"en-US",formatDistance:eht,formatLong:sht,formatRelative:iht,localize:pht,match:Aht,options:{weekStartsOn:0,firstWeekContainsDate:1}};function Eht(e){const t=Ms(e);return bm(t,yDe(t))+1}function vye(e){const t=Ms(e),n=+Ty(t)-+$ut(t);return Math.round(n/gye)+1}function _ye(e,t){var x,y,_,b;const n=Ms(e),s=n.getFullYear(),a=Sv(),o=(t==null?void 0:t.firstWeekContainsDate)??((y=(x=t==null?void 0:t.locale)==null?void 0:x.options)==null?void 0:y.firstWeekContainsDate)??a.firstWeekContainsDate??((b=(_=a.locale)==null?void 0:_.options)==null?void 0:b.firstWeekContainsDate)??1,l=To(e,0);l.setFullYear(s+1,0,o),l.setHours(0,0,0,0);const i=Nf(l,t),u=To(e,0);u.setFullYear(s,0,o),u.setHours(0,0,0,0);const p=Nf(u,t);return n.getTime()>=i.getTime()?s+1:n.getTime()>=p.getTime()?s:s-1}function Iht(e,t){var i,u,p,x;const n=Sv(),s=(t==null?void 0:t.firstWeekContainsDate)??((u=(i=t==null?void 0:t.locale)==null?void 0:i.options)==null?void 0:u.firstWeekContainsDate)??n.firstWeekContainsDate??((x=(p=n.locale)==null?void 0:p.options)==null?void 0:x.firstWeekContainsDate)??1,a=_ye(e,t),o=To(e,0);return o.setFullYear(a,0,s),o.setHours(0,0,0,0),Nf(o,t)}function bye(e,t){const n=Ms(e),s=+Nf(n,t)-+Iht(n,t);return Math.round(s/gye)+1}function Mo(e,t){const n=e<0?"-":"",s=Math.abs(e).toString().padStart(t,"0");return n+s}const R0={y(e,t){const n=e.getFullYear(),s=n>0?n:1-n;return Mo(t==="yy"?s%100:s,t.length)},M(e,t){const n=e.getMonth();return t==="M"?String(n+1):Mo(n+1,2)},d(e,t){return Mo(e.getDate(),t.length)},a(e,t){const n=e.getHours()/12>=1?"pm":"am";switch(t){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(e,t){return Mo(e.getHours()%12||12,t.length)},H(e,t){return Mo(e.getHours(),t.length)},m(e,t){return Mo(e.getMinutes(),t.length)},s(e,t){return Mo(e.getSeconds(),t.length)},S(e,t){const n=t.length,s=e.getMilliseconds(),a=Math.trunc(s*Math.pow(10,n-3));return Mo(a,t.length)}},S4={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},TNe={G:function(e,t,n){const s=e.getFullYear()>0?1:0;switch(t){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(e,t,n){if(t==="yo"){const s=e.getFullYear(),a=s>0?s:1-s;return n.ordinalNumber(a,{unit:"year"})}return R0.y(e,t)},Y:function(e,t,n,s){const a=_ye(e,s),o=a>0?a:1-a;if(t==="YY"){const l=o%100;return Mo(l,2)}return t==="Yo"?n.ordinalNumber(o,{unit:"year"}):Mo(o,t.length)},R:function(e,t){const n=xDe(e);return Mo(n,t.length)},u:function(e,t){const n=e.getFullYear();return Mo(n,t.length)},Q:function(e,t,n){const s=Math.ceil((e.getMonth()+1)/3);switch(t){case"Q":return String(s);case"QQ":return Mo(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(e,t,n){const s=Math.ceil((e.getMonth()+1)/3);switch(t){case"q":return String(s);case"qq":return Mo(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(e,t,n){const s=e.getMonth();switch(t){case"M":case"MM":return R0.M(e,t);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(e,t,n){const s=e.getMonth();switch(t){case"L":return String(s+1);case"LL":return Mo(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(e,t,n,s){const a=bye(e,s);return t==="wo"?n.ordinalNumber(a,{unit:"week"}):Mo(a,t.length)},I:function(e,t,n){const s=vye(e);return t==="Io"?n.ordinalNumber(s,{unit:"week"}):Mo(s,t.length)},d:function(e,t,n){return t==="do"?n.ordinalNumber(e.getDate(),{unit:"date"}):R0.d(e,t)},D:function(e,t,n){const s=Eht(e);return t==="Do"?n.ordinalNumber(s,{unit:"dayOfYear"}):Mo(s,t.length)},E:function(e,t,n){const s=e.getDay();switch(t){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(e,t,n,s){const a=e.getDay(),o=(a-s.weekStartsOn+8)%7||7;switch(t){case"e":return String(o);case"ee":return Mo(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(e,t,n,s){const a=e.getDay(),o=(a-s.weekStartsOn+8)%7||7;switch(t){case"c":return String(o);case"cc":return Mo(o,t.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(e,t,n){const s=e.getDay(),a=s===0?7:s;switch(t){case"i":return String(a);case"ii":return Mo(a,t.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(e,t,n){const a=e.getHours()/12>=1?"pm":"am";switch(t){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(e,t,n){const s=e.getHours();let a;switch(s===12?a=S4.noon:s===0?a=S4.midnight:a=s/12>=1?"pm":"am",t){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(e,t,n){const s=e.getHours();let a;switch(s>=17?a=S4.evening:s>=12?a=S4.afternoon:s>=4?a=S4.morning:a=S4.night,t){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(e,t,n){if(t==="ho"){let s=e.getHours()%12;return s===0&&(s=12),n.ordinalNumber(s,{unit:"hour"})}return R0.h(e,t)},H:function(e,t,n){return t==="Ho"?n.ordinalNumber(e.getHours(),{unit:"hour"}):R0.H(e,t)},K:function(e,t,n){const s=e.getHours()%12;return t==="Ko"?n.ordinalNumber(s,{unit:"hour"}):Mo(s,t.length)},k:function(e,t,n){let s=e.getHours();return s===0&&(s=24),t==="ko"?n.ordinalNumber(s,{unit:"hour"}):Mo(s,t.length)},m:function(e,t,n){return t==="mo"?n.ordinalNumber(e.getMinutes(),{unit:"minute"}):R0.m(e,t)},s:function(e,t,n){return t==="so"?n.ordinalNumber(e.getSeconds(),{unit:"second"}):R0.s(e,t)},S:function(e,t){return R0.S(e,t)},X:function(e,t,n){const s=e.getTimezoneOffset();if(s===0)return"Z";switch(t){case"X":return ENe(s);case"XXXX":case"XX":return Hw(s);case"XXXXX":case"XXX":default:return Hw(s,":")}},x:function(e,t,n){const s=e.getTimezoneOffset();switch(t){case"x":return ENe(s);case"xxxx":case"xx":return Hw(s);case"xxxxx":case"xxx":default:return Hw(s,":")}},O:function(e,t,n){const s=e.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+ANe(s,":");case"OOOO":default:return"GMT"+Hw(s,":")}},z:function(e,t,n){const s=e.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+ANe(s,":");case"zzzz":default:return"GMT"+Hw(s,":")}},t:function(e,t,n){const s=Math.trunc(e.getTime()/1e3);return Mo(s,t.length)},T:function(e,t,n){const s=e.getTime();return Mo(s,t.length)}};function ANe(e,t=""){const n=e>0?"-":"+",s=Math.abs(e),a=Math.trunc(s/60),o=s%60;return o===0?n+String(a):n+String(a)+t+Mo(o,2)}function ENe(e,t){return e%60===0?(e>0?"-":"+")+Mo(Math.abs(e)/60,2):Hw(e,t)}function Hw(e,t=""){const n=e>0?"-":"+",s=Math.abs(e),a=Mo(Math.trunc(s/60),2),o=Mo(s%60,2);return n+a+t+o}const INe=(e,t)=>{switch(e){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});case"PPPP":default:return t.date({width:"full"})}},_De=(e,t)=>{switch(e){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});case"pppp":default:return t.time({width:"full"})}},Pht=(e,t)=>{const n=e.match(/(P+)(p+)?/)||[],s=n[1],a=n[2];if(!a)return INe(e,t);let o;switch(s){case"P":o=t.dateTime({width:"short"});break;case"PP":o=t.dateTime({width:"medium"});break;case"PPP":o=t.dateTime({width:"long"});break;case"PPPP":default:o=t.dateTime({width:"full"});break}return o.replace("{{date}}",INe(s,t)).replace("{{time}}",_De(a,t))},jfe={p:_De,P:Pht},Lht=/^D+$/,Oht=/^Y+$/,Dht=["D","DD","YY","YYYY"];function bDe(e){return Lht.test(e)}function wDe(e){return Oht.test(e)}function kfe(e,t,n){const s=Rht(e,t,n);if(console.warn(s),Dht.includes(e))throw new RangeError(s)}function Rht(e,t,n){const s=e[0]==="Y"?"years":"days of the month";return`Use \`${e.toLowerCase()}\` instead of \`${e}\` (in \`${t}\`) for formatting ${s} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const Fht=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,zht=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Bht=/^'([^]*?)'?$/,$ht=/''/g,Uht=/[a-zA-Z]/;function on(e,t,n){var x,y,_,b,S,k,M,P;const s=Sv(),a=(n==null?void 0:n.locale)??s.locale??nae,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??((b=(_=s.locale)==null?void 0:_.options)==null?void 0:b.firstWeekContainsDate)??1,l=(n==null?void 0:n.weekStartsOn)??((k=(S=n==null?void 0:n.locale)==null?void 0:S.options)==null?void 0:k.weekStartsOn)??s.weekStartsOn??((P=(M=s.locale)==null?void 0:M.options)==null?void 0:P.weekStartsOn)??0,i=Ms(e);if(!wfe(i))throw new RangeError("Invalid time value");let u=t.match(zht).map(T=>{const I=T[0];if(I==="p"||I==="P"){const z=jfe[I];return z(T,a.formatLong)}return T}).join("").match(Fht).map(T=>{if(T==="''")return{isToken:!1,value:"'"};const I=T[0];if(I==="'")return{isToken:!1,value:qht(T)};if(TNe[I])return{isToken:!0,value:T};if(I.match(Uht))throw new RangeError("Format string contains an unescaped latin alphabet character `"+I+"`");return{isToken:!1,value:T}});a.localize.preprocessor&&(u=a.localize.preprocessor(i,u));const p={firstWeekContainsDate:o,weekStartsOn:l,locale:a};return u.map(T=>{if(!T.isToken)return T.value;const I=T.value;(!(n!=null&&n.useAdditionalWeekYearTokens)&&wDe(I)||!(n!=null&&n.useAdditionalDayOfYearTokens)&&bDe(I))&&kfe(I,t,String(e));const z=TNe[I[0]];return z(i,I,a.localize,p)}).join("")}function qht(e){const t=e.match(Bht);return t?t[1].replace($ht,"'"):e}function Vht(e,t,n){const s=Sv(),a=(n==null?void 0:n.locale)??s.locale??nae,o=2520,l=Vee(e,t);if(isNaN(l))throw new RangeError("Invalid time value");const i=Object.assign({},n,{addSuffix:n==null?void 0:n.addSuffix,comparison:l});let u,p;l>0?(u=Ms(t),p=Ms(e)):(u=Ms(e),p=Ms(t));const x=Qut(p,u),y=(pv(p)-pv(u))/1e3,_=Math.round((x-y)/60);let b;if(_<2)return n!=null&&n.includeSeconds?x<5?a.formatDistance("lessThanXSeconds",5,i):x<10?a.formatDistance("lessThanXSeconds",10,i):x<20?a.formatDistance("lessThanXSeconds",20,i):x<40?a.formatDistance("halfAMinute",0,i):x<60?a.formatDistance("lessThanXMinutes",1,i):a.formatDistance("xMinutes",1,i):_===0?a.formatDistance("lessThanXMinutes",1,i):a.formatDistance("xMinutes",_,i);if(_<45)return a.formatDistance("xMinutes",_,i);if(_<90)return a.formatDistance("aboutXHours",1,i);if(_s.getTime()}function sae(e,t){const n=Ms(e),s=Ms(t);return+n<+s}function Xht(e){return+Ms(e)>Date.now()}function Qht(e,t){const n=t instanceof Date?To(t,0):new t(0);return n.setFullYear(e.getFullYear(),e.getMonth(),e.getDate()),n.setHours(e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()),n}const Jht=10;class jDe{constructor(){Xn(this,"subPriority",0)}validate(t,n){return!0}}class eft extends jDe{constructor(t,n,s,a,o){super(),this.value=t,this.validateValue=n,this.setValue=s,this.priority=a,o&&(this.subPriority=o)}validate(t,n){return this.validateValue(t,this.value,n)}set(t,n,s){return this.setValue(t,n,this.value,s)}}class tft extends jDe{constructor(){super(...arguments);Xn(this,"priority",Jht);Xn(this,"subPriority",-1)}set(n,s){return s.timestampIsSet?n:To(n,Qht(n,Date))}}class bo{run(t,n,s,a){const o=this.parse(t,n,s,a);return o?{setter:new eft(o.value,this.validate,this.set,this.priority,this.subPriority),rest:o.rest}:null}validate(t,n,s){return!0}}class rft extends bo{constructor(){super(...arguments);Xn(this,"priority",140);Xn(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 wc={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}/},kg={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 jc(e,t){return e&&{value:t(e.value),rest:e.rest}}function Fl(e,t){const n=t.match(e);return n?{value:parseInt(n[0],10),rest:t.slice(n[0].length)}:null}function Ng(e,t){const n=t.match(e);if(!n)return null;if(n[0]==="Z")return{value:0,rest:t.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*gDe+o*mDe+l*zut),rest:t.slice(n[0].length)}}function kDe(e){return Fl(wc.anyDigitsSigned,e)}function lc(e,t){switch(e){case 1:return Fl(wc.singleDigit,t);case 2:return Fl(wc.twoDigits,t);case 3:return Fl(wc.threeDigits,t);case 4:return Fl(wc.fourDigits,t);default:return Fl(new RegExp("^\\d{1,"+e+"}"),t)}}function rre(e,t){switch(e){case 1:return Fl(wc.singleDigitSigned,t);case 2:return Fl(wc.twoDigitsSigned,t);case 3:return Fl(wc.threeDigitsSigned,t);case 4:return Fl(wc.fourDigitsSigned,t);default:return Fl(new RegExp("^-?\\d{1,"+e+"}"),t)}}function wye(e){switch(e){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 NDe(e,t){const n=t>0,s=n?t:1-t;let a;if(s<=50)a=e||100;else{const o=s+50,l=Math.trunc(o/100)*100,i=e>=o%100;a=e+l-(i?100:0)}return n?a:1-a}function SDe(e){return e%400===0||e%4===0&&e%100!==0}class nft extends bo{constructor(){super(...arguments);Xn(this,"priority",130);Xn(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 jc(lc(4,n),o);case"yo":return jc(a.ordinalNumber(n,{unit:"year"}),o);default:return jc(lc(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=NDe(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 sft extends bo{constructor(){super(...arguments);Xn(this,"priority",130);Xn(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 jc(lc(4,n),o);case"Yo":return jc(a.ordinalNumber(n,{unit:"year"}),o);default:return jc(lc(s.length,n),o)}}validate(n,s){return s.isTwoDigitYear||s.year>0}set(n,s,a,o){const l=_ye(n,o);if(a.isTwoDigitYear){const u=NDe(a.year,l);return n.setFullYear(u,0,o.firstWeekContainsDate),n.setHours(0,0,0,0),Nf(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),Nf(n,o)}}class aft extends bo{constructor(){super(...arguments);Xn(this,"priority",130);Xn(this,"incompatibleTokens",["G","y","Y","u","Q","q","M","L","w","d","D","e","c","t","T"])}parse(n,s){return rre(s==="R"?4:s.length,n)}set(n,s,a){const o=To(n,0);return o.setFullYear(a,0,4),o.setHours(0,0,0,0),Ty(o)}}class ift extends bo{constructor(){super(...arguments);Xn(this,"priority",130);Xn(this,"incompatibleTokens",["G","y","Y","R","w","I","i","e","c","t","T"])}parse(n,s){return rre(s==="u"?4:s.length,n)}set(n,s,a){return n.setFullYear(a,0,1),n.setHours(0,0,0,0),n}}class oft extends bo{constructor(){super(...arguments);Xn(this,"priority",120);Xn(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 lc(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 lft extends bo{constructor(){super(...arguments);Xn(this,"priority",120);Xn(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 lc(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 cft extends bo{constructor(){super(...arguments);Xn(this,"incompatibleTokens",["Y","R","q","Q","L","w","I","D","i","e","c","t","T"]);Xn(this,"priority",110)}parse(n,s,a){const o=l=>l-1;switch(s){case"M":return jc(Fl(wc.month,n),o);case"MM":return jc(lc(2,n),o);case"Mo":return jc(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 dft extends bo{constructor(){super(...arguments);Xn(this,"priority",110);Xn(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 jc(Fl(wc.month,n),o);case"LL":return jc(lc(2,n),o);case"Lo":return jc(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 uft(e,t,n){const s=Ms(e),a=bye(s,n)-t;return s.setDate(s.getDate()-a*7),s}class hft extends bo{constructor(){super(...arguments);Xn(this,"priority",100);Xn(this,"incompatibleTokens",["y","R","u","q","Q","M","L","I","d","D","i","t","T"])}parse(n,s,a){switch(s){case"w":return Fl(wc.week,n);case"wo":return a.ordinalNumber(n,{unit:"week"});default:return lc(s.length,n)}}validate(n,s){return s>=1&&s<=53}set(n,s,a,o){return Nf(uft(n,a,o),o)}}function fft(e,t){const n=Ms(e),s=vye(n)-t;return n.setDate(n.getDate()-s*7),n}class pft extends bo{constructor(){super(...arguments);Xn(this,"priority",100);Xn(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 Fl(wc.week,n);case"Io":return a.ordinalNumber(n,{unit:"week"});default:return lc(s.length,n)}}validate(n,s){return s>=1&&s<=53}set(n,s,a){return Ty(fft(n,a))}}const mft=[31,28,31,30,31,30,31,31,30,31,30,31],gft=[31,29,31,30,31,30,31,31,30,31,30,31];class xft extends bo{constructor(){super(...arguments);Xn(this,"priority",90);Xn(this,"subPriority",1);Xn(this,"incompatibleTokens",["Y","R","q","Q","w","I","D","i","e","c","t","T"])}parse(n,s,a){switch(s){case"d":return Fl(wc.date,n);case"do":return a.ordinalNumber(n,{unit:"date"});default:return lc(s.length,n)}}validate(n,s){const a=n.getFullYear(),o=SDe(a),l=n.getMonth();return o?s>=1&&s<=gft[l]:s>=1&&s<=mft[l]}set(n,s,a){return n.setDate(a),n.setHours(0,0,0,0),n}}class yft extends bo{constructor(){super(...arguments);Xn(this,"priority",90);Xn(this,"subpriority",1);Xn(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 Fl(wc.dayOfYear,n);case"Do":return a.ordinalNumber(n,{unit:"date"});default:return lc(s.length,n)}}validate(n,s){const a=n.getFullYear();return SDe(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 jye(e,t,n){var y,_,b,S;const s=Sv(),a=(n==null?void 0:n.weekStartsOn)??((_=(y=n==null?void 0:n.locale)==null?void 0:y.options)==null?void 0:_.weekStartsOn)??s.weekStartsOn??((S=(b=s.locale)==null?void 0:b.options)==null?void 0:S.weekStartsOn)??0,o=Ms(e),l=o.getDay(),u=(t%7+7)%7,p=7-a,x=t<0||t>6?t-(l+p)%7:(u+p)%7-(l+p)%7;return Ql(o,x)}class vft extends bo{constructor(){super(...arguments);Xn(this,"priority",90);Xn(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=jye(n,a,o),n.setHours(0,0,0,0),n}}class _ft extends bo{constructor(){super(...arguments);Xn(this,"priority",90);Xn(this,"incompatibleTokens",["y","R","u","q","Q","M","L","I","d","D","E","i","c","t","T"])}parse(n,s,a,o){const l=i=>{const u=Math.floor((i-1)/7)*7;return(i+o.weekStartsOn+6)%7+u};switch(s){case"e":case"ee":return jc(lc(s.length,n),l);case"eo":return jc(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=jye(n,a,o),n.setHours(0,0,0,0),n}}class bft extends bo{constructor(){super(...arguments);Xn(this,"priority",90);Xn(this,"incompatibleTokens",["y","R","u","q","Q","M","L","I","d","D","E","i","e","t","T"])}parse(n,s,a,o){const l=i=>{const u=Math.floor((i-1)/7)*7;return(i+o.weekStartsOn+6)%7+u};switch(s){case"c":case"cc":return jc(lc(s.length,n),l);case"co":return jc(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=jye(n,a,o),n.setHours(0,0,0,0),n}}function wft(e,t){const n=Ms(e),s=Ght(n),a=t-s;return Ql(n,a)}class jft extends bo{constructor(){super(...arguments);Xn(this,"priority",90);Xn(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 lc(s.length,n);case"io":return a.ordinalNumber(n,{unit:"day"});case"iii":return jc(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 jc(a.day(n,{width:"narrow",context:"formatting"}),o);case"iiiiii":return jc(a.day(n,{width:"short",context:"formatting"})||a.day(n,{width:"narrow",context:"formatting"}),o);case"iiii":default:return jc(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=wft(n,a),n.setHours(0,0,0,0),n}}class kft extends bo{constructor(){super(...arguments);Xn(this,"priority",80);Xn(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(wye(a),0,0,0),n}}class Nft extends bo{constructor(){super(...arguments);Xn(this,"priority",80);Xn(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(wye(a),0,0,0),n}}class Sft extends bo{constructor(){super(...arguments);Xn(this,"priority",80);Xn(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(wye(a),0,0,0),n}}class Cft extends bo{constructor(){super(...arguments);Xn(this,"priority",70);Xn(this,"incompatibleTokens",["H","K","k","t","T"])}parse(n,s,a){switch(s){case"h":return Fl(wc.hour12h,n);case"ho":return a.ordinalNumber(n,{unit:"hour"});default:return lc(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 Mft extends bo{constructor(){super(...arguments);Xn(this,"priority",70);Xn(this,"incompatibleTokens",["a","b","h","K","k","t","T"])}parse(n,s,a){switch(s){case"H":return Fl(wc.hour23h,n);case"Ho":return a.ordinalNumber(n,{unit:"hour"});default:return lc(s.length,n)}}validate(n,s){return s>=0&&s<=23}set(n,s,a){return n.setHours(a,0,0,0),n}}class Tft extends bo{constructor(){super(...arguments);Xn(this,"priority",70);Xn(this,"incompatibleTokens",["h","H","k","t","T"])}parse(n,s,a){switch(s){case"K":return Fl(wc.hour11h,n);case"Ko":return a.ordinalNumber(n,{unit:"hour"});default:return lc(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 Aft extends bo{constructor(){super(...arguments);Xn(this,"priority",70);Xn(this,"incompatibleTokens",["a","b","h","H","K","t","T"])}parse(n,s,a){switch(s){case"k":return Fl(wc.hour24h,n);case"ko":return a.ordinalNumber(n,{unit:"hour"});default:return lc(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 Eft extends bo{constructor(){super(...arguments);Xn(this,"priority",60);Xn(this,"incompatibleTokens",["t","T"])}parse(n,s,a){switch(s){case"m":return Fl(wc.minute,n);case"mo":return a.ordinalNumber(n,{unit:"minute"});default:return lc(s.length,n)}}validate(n,s){return s>=0&&s<=59}set(n,s,a){return n.setMinutes(a,0,0),n}}class Ift extends bo{constructor(){super(...arguments);Xn(this,"priority",50);Xn(this,"incompatibleTokens",["t","T"])}parse(n,s,a){switch(s){case"s":return Fl(wc.second,n);case"so":return a.ordinalNumber(n,{unit:"second"});default:return lc(s.length,n)}}validate(n,s){return s>=0&&s<=59}set(n,s,a){return n.setSeconds(a,0),n}}class Pft extends bo{constructor(){super(...arguments);Xn(this,"priority",30);Xn(this,"incompatibleTokens",["t","T"])}parse(n,s){const a=o=>Math.trunc(o*Math.pow(10,-s.length+3));return jc(lc(s.length,n),a)}set(n,s,a){return n.setMilliseconds(a),n}}class Lft extends bo{constructor(){super(...arguments);Xn(this,"priority",10);Xn(this,"incompatibleTokens",["t","T","x"])}parse(n,s){switch(s){case"X":return Ng(kg.basicOptionalMinutes,n);case"XX":return Ng(kg.basic,n);case"XXXX":return Ng(kg.basicOptionalSeconds,n);case"XXXXX":return Ng(kg.extendedOptionalSeconds,n);case"XXX":default:return Ng(kg.extended,n)}}set(n,s,a){return s.timestampIsSet?n:To(n,n.getTime()-pv(n)-a)}}class Oft extends bo{constructor(){super(...arguments);Xn(this,"priority",10);Xn(this,"incompatibleTokens",["t","T","X"])}parse(n,s){switch(s){case"x":return Ng(kg.basicOptionalMinutes,n);case"xx":return Ng(kg.basic,n);case"xxxx":return Ng(kg.basicOptionalSeconds,n);case"xxxxx":return Ng(kg.extendedOptionalSeconds,n);case"xxx":default:return Ng(kg.extended,n)}}set(n,s,a){return s.timestampIsSet?n:To(n,n.getTime()-pv(n)-a)}}class Dft extends bo{constructor(){super(...arguments);Xn(this,"priority",40);Xn(this,"incompatibleTokens","*")}parse(n){return kDe(n)}set(n,s,a){return[To(n,a*1e3),{timestampIsSet:!0}]}}class Rft extends bo{constructor(){super(...arguments);Xn(this,"priority",20);Xn(this,"incompatibleTokens","*")}parse(n){return kDe(n)}set(n,s,a){return[To(n,a),{timestampIsSet:!0}]}}const Fft={G:new rft,y:new nft,Y:new sft,R:new aft,u:new ift,Q:new oft,q:new lft,M:new cft,L:new dft,w:new hft,I:new pft,d:new xft,D:new yft,E:new vft,e:new _ft,c:new bft,i:new jft,a:new kft,b:new Nft,B:new Sft,h:new Cft,H:new Mft,K:new Tft,k:new Aft,m:new Eft,s:new Ift,S:new Pft,X:new Lft,x:new Oft,t:new Dft,T:new Rft},zft=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Bft=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,$ft=/^'([^]*?)'?$/,Uft=/''/g,qft=/\S/,Vft=/[a-zA-Z]/;function kye(e,t,n,s){var k,M,P,T;const a=Wht(),o=a.locale??nae,l=a.firstWeekContainsDate??((M=(k=a.locale)==null?void 0:k.options)==null?void 0:M.firstWeekContainsDate)??1,i=a.weekStartsOn??((T=(P=a.locale)==null?void 0:P.options)==null?void 0:T.weekStartsOn)??0;if(t==="")return e===""?Ms(n):To(n,NaN);const u={firstWeekContainsDate:l,weekStartsOn:i,locale:o},p=[new tft],x=t.match(Bft).map(I=>{const z=I[0];if(z in jfe){const D=jfe[z];return D(I,o.formatLong)}return I}).join("").match(zft),y=[];for(let I of x){wDe(I)&&kfe(I,t,e),bDe(I)&&kfe(I,t,e);const z=I[0],D=Fft[z];if(D){const{incompatibleTokens:U}=D;if(Array.isArray(U)){const W=y.find(G=>U.includes(G.token)||G.token===z);if(W)throw new RangeError(`The format string mustn't contain \`${W.fullToken}\` and \`${I}\` at the same time`)}else if(D.incompatibleTokens==="*"&&y.length>0)throw new RangeError(`The format string mustn't contain \`${I}\` and any other token at the same time`);y.push({token:z,fullToken:I});const V=D.run(e,I,o.match,u);if(!V)return To(n,NaN);p.push(V.setter),e=V.rest}else{if(z.match(Vft))throw new RangeError("Format string contains an unescaped latin alphabet character `"+z+"`");if(I==="''"?I="'":z==="'"&&(I=Hft(I)),e.indexOf(I)===0)e=e.slice(I.length);else return To(n,NaN)}}if(e.length>0&&qft.test(e))return To(n,NaN);const _=p.map(I=>I.priority).sort((I,z)=>z-I).filter((I,z,D)=>D.indexOf(I)===z).map(I=>p.filter(z=>z.priority===I).sort((z,D)=>D.subPriority-z.subPriority)).map(I=>I[0]);let b=Ms(n);if(isNaN(b.getTime()))return To(n,NaN);const S={};for(const I of _){if(!I.validate(b,u))return To(n,NaN);const z=I.set(b,S,u);Array.isArray(z)?(b=z[0],Object.assign(S,z[1])):b=z}return To(n,b)}function Hft(e){return e.match($ft)[1].replace(Uft,"'")}function Wft(e){return+Ms(e)o-l);return n>=s&&n<=a}function qce(e,t){return Ql(e,-t)}function Vce(e,t){const n=Ms(e),s=n.getFullYear(),a=n.getDate(),o=To(e,0);o.setFullYear(s,t,15),o.setHours(0,0,0,0);const l=Hht(o);return n.setMonth(t,Math.min(a,l)),n}function CDe(e,t){const n=Ms(e);return n.setHours(t),n}function MDe(e,t){const n=Ms(e);return n.setMinutes(t),n}function ONe(e,t){const n=Ms(e);return isNaN(+n)?To(e,NaN):(n.setFullYear(t),n)}function Kft(e,t){return Ph(e,-12)}const Zft=()=>{const{user:e}=tn(),t=Gn(),[n,s]=E.useState([]),[a,o]=E.useState(0),[l,i]=E.useState(!1),[u,p]=E.useState(null);E.useEffect(()=>{if(!e)return;const S=`notification_last_read_${e.id}`;let k=u;if(!k){const T=localStorage.getItem(S);T&&(k=T,p(T))}(async()=>{const{data:T,error:I}=await Q.from("push_notifications").select("*").order("created_at",{ascending:!1}).limit(20);if(!I&&T){s(T);const z=k?new Date(k):null,D=T.filter(U=>z?new Date(U.created_at)>z:!0);o(D.length)}})();const P=Q.channel("push-notifications").on("postgres_changes",{event:"INSERT",schema:"public",table:"push_notifications"},T=>{const I=T.new;s(D=>[I,...D].slice(0,20));const z=k?new Date(k):null;(!z||new Date(I.created_at)>z)&&o(D=>D+1),Notification.permission==="granted"&&new Notification(I.title,{body:I.body,icon:"/favicon.ico"})}).subscribe();return()=>{Q.removeChannel(P)}},[e,u]);const x=S=>{const k=S.toLowerCase();return k.includes("community")||k.includes("post")?zo:k.includes("academy")||k.includes("video")?$a:k.includes("template")?Uc:k.includes("event")?Ss:k.includes("newsletter")?fy:k.includes("brokerage")?Ah:k.includes("swag")||k.includes("social")?to:k.includes("toolbox")||k.includes("tool")?gy:k.includes("brief")?Ls:zo},y=S=>{i(!1),S.url&&S.url!=="/"&&t(S.url)},_=()=>{if(!e)return;const S=new Date().toISOString(),k=`notification_last_read_${e.id}`;localStorage.setItem(k,S),p(S),o(0)},b=S=>{i(S),S&&a>0&&_()};return r.jsxs(Lh,{open:l,onOpenChange:b,children:[r.jsx(Oh,{asChild:!0,children:r.jsxs(ee,{variant:"ghost",size:"icon",className:"relative",children:[r.jsx(Lg,{className:"h-5 w-5"}),a>0&&r.jsx(Pt,{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(ah,{align:"end",className:"w-80",children:[r.jsxs("div",{className:"flex items-center justify-between px-3 py-2 border-b",children:[r.jsx("span",{className:"font-semibold",children:"Notifications"}),n.length>0&&r.jsx(ee,{variant:"ghost",size:"sm",className:"text-xs h-6",onClick:_,children:"Mark all read"})]}),r.jsx(Bo,{className:"h-[300px]",children:n.length===0?r.jsx("div",{className:"p-4 text-center text-muted-foreground text-sm",children:"No notifications yet"}):n.map(S=>{const k=x(S.title);return r.jsxs(ei,{className:"group flex items-start gap-3 p-3 cursor-pointer data-[highlighted]:bg-accent data-[highlighted]:text-accent-foreground",onClick:()=>y(S),children:[r.jsx("div",{className:"flex-shrink-0 mt-0.5",children:r.jsx(k,{className:"h-4 w-4 text-primary"})}),r.jsxs("div",{className:"flex flex-col gap-1 min-w-0",children:[r.jsx("span",{className:"font-medium text-sm",children:S.title}),r.jsx("span",{className:"text-xs text-muted-foreground line-clamp-2 group-data-[highlighted]:text-accent-foreground/80",children:S.body}),r.jsx("span",{className:"text-xs text-muted-foreground group-data-[highlighted]:text-accent-foreground/80",children:bu(new Date(S.created_at),{addSuffix:!0})})]})]},S.id)})})]})]})};var DNe=1,Yft=.9,Xft=.8,Qft=.17,Hce=.1,Wce=.999,Jft=.9999,ept=.99,tpt=/[\\\/_+.#"@\[\(\{&]/,rpt=/[\\\/_+.#"@\[\(\{&]/g,npt=/[\s-]/,TDe=/[\s-]/g;function Nfe(e,t,n,s,a,o,l){if(o===t.length)return a===e.length?DNe:ept;var i=`${a},${o}`;if(l[i]!==void 0)return l[i];for(var u=s.charAt(o),p=n.indexOf(u,a),x=0,y,_,b,S;p>=0;)y=Nfe(e,t,n,s,p+1,o+1,l),y>x&&(p===a?y*=DNe:tpt.test(e.charAt(p-1))?(y*=Xft,b=e.slice(a,p-1).match(rpt),b&&a>0&&(y*=Math.pow(Wce,b.length))):npt.test(e.charAt(p-1))?(y*=Yft,S=e.slice(a,p-1).match(TDe),S&&a>0&&(y*=Math.pow(Wce,S.length))):(y*=Qft,a>0&&(y*=Math.pow(Wce,p-a))),e.charAt(p)!==t.charAt(o)&&(y*=Jft)),(yy&&(y=_*Hce)),y>x&&(x=y),p=n.indexOf(u,p+1);return l[i]=x,x}function RNe(e){return e.toLowerCase().replace(TDe," ")}function spt(e,t,n){return e=n&&n.length>0?`${e+" "+n.join(" ")}`:e,Nfe(e,t,RNe(e),RNe(t),0,0,{})}var lT='[cmdk-group=""]',Gce='[cmdk-group-items=""]',apt='[cmdk-group-heading=""]',ADe='[cmdk-item=""]',FNe=`${ADe}:not([aria-disabled="true"])`,Sfe="cmdk-item-select",z4="data-value",ipt=(e,t,n)=>spt(e,t,n),EDe=E.createContext(void 0),lP=()=>E.useContext(EDe),IDe=E.createContext(void 0),Sye=()=>E.useContext(IDe),PDe=E.createContext(void 0),LDe=E.forwardRef((e,t)=>{let n=B4(()=>{var be,_e;return{search:"",value:(_e=(be=e.value)!=null?be:e.defaultValue)!=null?_e:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),s=B4(()=>new Set),a=B4(()=>new Map),o=B4(()=>new Map),l=B4(()=>new Set),i=ODe(e),{label:u,children:p,value:x,onValueChange:y,filter:_,shouldFilter:b,loop:S,disablePointerSelection:k=!1,vimBindings:M=!0,...P}=e,T=fd(),I=fd(),z=fd(),D=E.useRef(null),U=xpt();ck(()=>{if(x!==void 0){let be=x.trim();n.current.value=be,V.emit()}},[x]),ck(()=>{U(6,ge)},[]);let V=E.useMemo(()=>({subscribe:be=>(l.current.add(be),()=>l.current.delete(be)),snapshot:()=>n.current,setState:(be,_e,Je)=>{var Te,De,Ue,Be;if(!Object.is(n.current[be],_e)){if(n.current[be]=_e,be==="search")oe(),J(),U(1,ne);else if(be==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let qe=document.getElementById(z);qe?qe.focus():(Te=document.getElementById(T))==null||Te.focus()}if(U(7,()=>{var qe;n.current.selectedItemId=(qe=ie())==null?void 0:qe.id,V.emit()}),Je||U(5,ge),((De=i.current)==null?void 0:De.value)!==void 0){let qe=_e??"";(Be=(Ue=i.current).onValueChange)==null||Be.call(Ue,qe);return}}V.emit()}},emit:()=>{l.current.forEach(be=>be())}}),[]),W=E.useMemo(()=>({value:(be,_e,Je)=>{var Te;_e!==((Te=o.current.get(be))==null?void 0:Te.value)&&(o.current.set(be,{value:_e,keywords:Je}),n.current.filtered.items.set(be,G(_e,Je)),U(2,()=>{J(),V.emit()}))},item:(be,_e)=>(s.current.add(be),_e&&(a.current.has(_e)?a.current.get(_e).add(be):a.current.set(_e,new Set([be]))),U(3,()=>{oe(),J(),n.current.value||ne(),V.emit()}),()=>{o.current.delete(be),s.current.delete(be),n.current.filtered.items.delete(be);let Je=ie();U(4,()=>{oe(),(Je==null?void 0:Je.getAttribute("id"))===be&&ne(),V.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:u||e["aria-label"],getDisablePointerSelection:()=>i.current.disablePointerSelection,listId:T,inputId:z,labelId:I,listInnerRef:D}),[]);function G(be,_e){var Je,Te;let De=(Te=(Je=i.current)==null?void 0:Je.filter)!=null?Te:ipt;return be?De(be,n.current.search,_e):0}function J(){if(!n.current.search||i.current.shouldFilter===!1)return;let be=n.current.filtered.items,_e=[];n.current.filtered.groups.forEach(Te=>{let De=a.current.get(Te),Ue=0;De.forEach(Be=>{let qe=be.get(Be);Ue=Math.max(qe,Ue)}),_e.push([Te,Ue])});let Je=D.current;pe().sort((Te,De)=>{var Ue,Be;let qe=Te.getAttribute("id"),ot=De.getAttribute("id");return((Ue=be.get(ot))!=null?Ue:0)-((Be=be.get(qe))!=null?Be:0)}).forEach(Te=>{let De=Te.closest(Gce);De?De.appendChild(Te.parentElement===De?Te:Te.closest(`${Gce} > *`)):Je.appendChild(Te.parentElement===Je?Te:Te.closest(`${Gce} > *`))}),_e.sort((Te,De)=>De[1]-Te[1]).forEach(Te=>{var De;let Ue=(De=D.current)==null?void 0:De.querySelector(`${lT}[${z4}="${encodeURIComponent(Te[0])}"]`);Ue==null||Ue.parentElement.appendChild(Ue)})}function ne(){let be=pe().find(Je=>Je.getAttribute("aria-disabled")!=="true"),_e=be==null?void 0:be.getAttribute(z4);V.setState("value",_e||void 0)}function oe(){var be,_e,Je,Te;if(!n.current.search||i.current.shouldFilter===!1){n.current.filtered.count=s.current.size;return}n.current.filtered.groups=new Set;let De=0;for(let Ue of s.current){let Be=(_e=(be=o.current.get(Ue))==null?void 0:be.value)!=null?_e:"",qe=(Te=(Je=o.current.get(Ue))==null?void 0:Je.keywords)!=null?Te:[],ot=G(Be,qe);n.current.filtered.items.set(Ue,ot),ot>0&&De++}for(let[Ue,Be]of a.current)for(let qe of Be)if(n.current.filtered.items.get(qe)>0){n.current.filtered.groups.add(Ue);break}n.current.filtered.count=De}function ge(){var be,_e,Je;let Te=ie();Te&&(((be=Te.parentElement)==null?void 0:be.firstChild)===Te&&((Je=(_e=Te.closest(lT))==null?void 0:_e.querySelector(apt))==null||Je.scrollIntoView({block:"nearest"})),Te.scrollIntoView({block:"nearest"}))}function ie(){var be;return(be=D.current)==null?void 0:be.querySelector(`${ADe}[aria-selected="true"]`)}function pe(){var be;return Array.from(((be=D.current)==null?void 0:be.querySelectorAll(FNe))||[])}function se(be){let _e=pe()[be];_e&&V.setState("value",_e.getAttribute(z4))}function fe(be){var _e;let Je=ie(),Te=pe(),De=Te.findIndex(Be=>Be===Je),Ue=Te[De+be];(_e=i.current)!=null&&_e.loop&&(Ue=De+be<0?Te[Te.length-1]:De+be===Te.length?Te[0]:Te[De+be]),Ue&&V.setState("value",Ue.getAttribute(z4))}function he(be){let _e=ie(),Je=_e==null?void 0:_e.closest(lT),Te;for(;Je&&!Te;)Je=be>0?mpt(Je,lT):gpt(Je,lT),Te=Je==null?void 0:Je.querySelector(FNe);Te?V.setState("value",Te.getAttribute(z4)):fe(be)}let ye=()=>se(pe().length-1),Ae=be=>{be.preventDefault(),be.metaKey?ye():be.altKey?he(1):fe(1)},we=be=>{be.preventDefault(),be.metaKey?se(0):be.altKey?he(-1):fe(-1)};return E.createElement(Fn.div,{ref:t,tabIndex:-1,...P,"cmdk-root":"",onKeyDown:be=>{var _e;(_e=P.onKeyDown)==null||_e.call(P,be);let Je=be.nativeEvent.isComposing||be.keyCode===229;if(!(be.defaultPrevented||Je))switch(be.key){case"n":case"j":{M&&be.ctrlKey&&Ae(be);break}case"ArrowDown":{Ae(be);break}case"p":case"k":{M&&be.ctrlKey&&we(be);break}case"ArrowUp":{we(be);break}case"Home":{be.preventDefault(),se(0);break}case"End":{be.preventDefault(),ye();break}case"Enter":{be.preventDefault();let Te=ie();if(Te){let De=new Event(Sfe);Te.dispatchEvent(De)}}}}},E.createElement("label",{"cmdk-label":"",htmlFor:W.inputId,id:W.labelId,style:vpt},u),aae(e,be=>E.createElement(IDe.Provider,{value:V},E.createElement(EDe.Provider,{value:W},be))))}),opt=E.forwardRef((e,t)=>{var n,s;let a=fd(),o=E.useRef(null),l=E.useContext(PDe),i=lP(),u=ODe(e),p=(s=(n=u.current)==null?void 0:n.forceMount)!=null?s:l==null?void 0:l.forceMount;ck(()=>{if(!p)return i.item(a,l==null?void 0:l.id)},[p]);let x=DDe(a,o,[e.value,e.children,o],e.keywords),y=Sye(),_=mv(U=>U.value&&U.value===x.current),b=mv(U=>p||i.filter()===!1?!0:U.search?U.filtered.items.get(a)>0:!0);E.useEffect(()=>{let U=o.current;if(!(!U||e.disabled))return U.addEventListener(Sfe,S),()=>U.removeEventListener(Sfe,S)},[b,e.onSelect,e.disabled]);function S(){var U,V;k(),(V=(U=u.current).onSelect)==null||V.call(U,x.current)}function k(){y.setState("value",x.current,!0)}if(!b)return null;let{disabled:M,value:P,onSelect:T,forceMount:I,keywords:z,...D}=e;return E.createElement(Fn.div,{ref:Sy(o,t),...D,id:a,"cmdk-item":"",role:"option","aria-disabled":!!M,"aria-selected":!!_,"data-disabled":!!M,"data-selected":!!_,onPointerMove:M||i.getDisablePointerSelection()?void 0:k,onClick:M?void 0:S},e.children)}),lpt=E.forwardRef((e,t)=>{let{heading:n,children:s,forceMount:a,...o}=e,l=fd(),i=E.useRef(null),u=E.useRef(null),p=fd(),x=lP(),y=mv(b=>a||x.filter()===!1?!0:b.search?b.filtered.groups.has(l):!0);ck(()=>x.group(l),[]),DDe(l,i,[e.value,e.heading,u]);let _=E.useMemo(()=>({id:l,forceMount:a}),[a]);return E.createElement(Fn.div,{ref:Sy(i,t),...o,"cmdk-group":"",role:"presentation",hidden:y?void 0:!0},n&&E.createElement("div",{ref:u,"cmdk-group-heading":"","aria-hidden":!0,id:p},n),aae(e,b=>E.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?p:void 0},E.createElement(PDe.Provider,{value:_},b))))}),cpt=E.forwardRef((e,t)=>{let{alwaysRender:n,...s}=e,a=E.useRef(null),o=mv(l=>!l.search);return!n&&!o?null:E.createElement(Fn.div,{ref:Sy(a,t),...s,"cmdk-separator":"",role:"separator"})}),dpt=E.forwardRef((e,t)=>{let{onValueChange:n,...s}=e,a=e.value!=null,o=Sye(),l=mv(p=>p.search),i=mv(p=>p.selectedItemId),u=lP();return E.useEffect(()=>{e.value!=null&&o.setState("search",e.value)},[e.value]),E.createElement(Fn.input,{ref:t,...s,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":u.listId,"aria-labelledby":u.labelId,"aria-activedescendant":i,id:u.inputId,type:"text",value:a?e.value:l,onChange:p=>{a||o.setState("search",p.target.value),n==null||n(p.target.value)}})}),upt=E.forwardRef((e,t)=>{let{children:n,label:s="Suggestions",...a}=e,o=E.useRef(null),l=E.useRef(null),i=mv(p=>p.selectedItemId),u=lP();return E.useEffect(()=>{if(l.current&&o.current){let p=l.current,x=o.current,y,_=new ResizeObserver(()=>{y=requestAnimationFrame(()=>{let b=p.offsetHeight;x.style.setProperty("--cmdk-list-height",b.toFixed(1)+"px")})});return _.observe(p),()=>{cancelAnimationFrame(y),_.unobserve(p)}}},[]),E.createElement(Fn.div,{ref:Sy(o,t),...a,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":i,"aria-label":s,id:u.listId},aae(e,p=>E.createElement("div",{ref:Sy(l,u.listInnerRef),"cmdk-list-sizer":""},p)))}),hpt=E.forwardRef((e,t)=>{let{open:n,onOpenChange:s,overlayClassName:a,contentClassName:o,container:l,...i}=e;return E.createElement(Lse,{open:n,onOpenChange:s},E.createElement(Ose,{container:l},E.createElement(M3,{"cmdk-overlay":"",className:a}),E.createElement(T3,{"aria-label":e.label,"cmdk-dialog":"",className:o},E.createElement(LDe,{ref:t,...i}))))}),fpt=E.forwardRef((e,t)=>mv(n=>n.filtered.count===0)?E.createElement(Fn.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),ppt=E.forwardRef((e,t)=>{let{progress:n,children:s,label:a="Loading...",...o}=e;return E.createElement(Fn.div,{ref:t,...o,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":a},aae(e,l=>E.createElement("div",{"aria-hidden":!0},l)))}),Dh=Object.assign(LDe,{List:upt,Item:opt,Input:dpt,Group:lpt,Separator:cpt,Dialog:hpt,Empty:fpt,Loading:ppt});function mpt(e,t){let n=e.nextElementSibling;for(;n;){if(n.matches(t))return n;n=n.nextElementSibling}}function gpt(e,t){let n=e.previousElementSibling;for(;n;){if(n.matches(t))return n;n=n.previousElementSibling}}function ODe(e){let t=E.useRef(e);return ck(()=>{t.current=e}),t}var ck=typeof window>"u"?E.useEffect:E.useLayoutEffect;function B4(e){let t=E.useRef();return t.current===void 0&&(t.current=e()),t}function mv(e){let t=Sye(),n=()=>e(t.snapshot());return E.useSyncExternalStore(t.subscribe,n,n)}function DDe(e,t,n,s=[]){let a=E.useRef(),o=lP();return ck(()=>{var l;let i=(()=>{var p;for(let x of n){if(typeof x=="string")return x.trim();if(typeof x=="object"&&"current"in x)return x.current?(p=x.current.textContent)==null?void 0:p.trim():a.current}})(),u=s.map(p=>p.trim());o.value(e,i,u),(l=t.current)==null||l.setAttribute(z4,i),a.current=i}),a}var xpt=()=>{let[e,t]=E.useState(),n=B4(()=>new Map);return ck(()=>{n.current.forEach(s=>s()),n.current=new Map},[e]),(s,a)=>{n.current.set(s,a),t({})}};function ypt(e){let t=e.type;return typeof t=="function"?t(e.props):"render"in t?t.render(e.props):e}function aae({asChild:e,children:t},n){return e&&E.isValidElement(t)?E.cloneElement(ypt(t),{ref:t.ref},n(t.props.children)):n(t)}var vpt={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const Ey=E.forwardRef(({className:e,...t},n)=>r.jsx(Dh,{ref:n,className:Bt("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",e),...t}));Ey.displayName=Dh.displayName;const _pt=({children:e,...t})=>r.jsx(Or,{...t,children:r.jsx(Ir,{className:"overflow-hidden p-0 shadow-lg",children:r.jsx(Ey,{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:e})})}),Iy=E.forwardRef(({className:e,...t},n)=>r.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[r.jsx(Sa,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),r.jsx(Dh.Input,{ref:n,className:Bt("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",e),...t})]}));Iy.displayName=Dh.Input.displayName;const Py=E.forwardRef(({className:e,...t},n)=>r.jsx(Dh.List,{ref:n,className:Bt("max-h-[300px] overflow-y-auto overflow-x-hidden",e),...t}));Py.displayName=Dh.List.displayName;const Ly=E.forwardRef((e,t)=>r.jsx(Dh.Empty,{ref:t,className:"py-6 text-center text-sm",...e}));Ly.displayName=Dh.Empty.displayName;const Oy=E.forwardRef(({className:e,...t},n)=>r.jsx(Dh.Group,{ref:n,className:Bt("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",e),...t}));Oy.displayName=Dh.Group.displayName;const bpt=E.forwardRef(({className:e,...t},n)=>r.jsx(Dh.Separator,{ref:n,className:Bt("-mx-1 h-px bg-border",e),...t}));bpt.displayName=Dh.Separator.displayName;const Dy=E.forwardRef(({className:e,...t},n)=>r.jsx(Dh.Item,{ref:n,className:Bt("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",e),...t}));Dy.displayName=Dh.Item.displayName;const wpt={event:{label:"Events",icon:Cm,color:"bg-blue-500/10 text-blue-600"},template:{label:"Templates",icon:Uc,color:"bg-purple-500/10 text-purple-600"},academy:{label:"Academy",icon:H1,color:"bg-amber-500/10 text-amber-600"},toolbox:{label:"Toolbox",icon:gy,color:"bg-green-500/10 text-green-600"},"social-swag":{label:"Social Swag",icon:Ls,color:"bg-fuchsia-500/10 text-fuchsia-600"}},zNe=()=>{const[e,t]=E.useState(!1),[n,s]=E.useState(""),[a,o]=E.useState([]),[l,i]=E.useState(!1),u=Gn();E.useEffect(()=>{const _=b=>{b.key==="k"&&(b.metaKey||b.ctrlKey)&&(b.preventDefault(),t(S=>!S))};return document.addEventListener("keydown",_),()=>document.removeEventListener("keydown",_)},[]);const p=E.useCallback(async _=>{if(!_.trim()){o([]);return}i(!0);const b=`%${_}%`;try{const[S,k,M,P,T]=await Promise.all([Q.from("events").select("id, title, description, event_date").eq("is_published",!0).or(`title.ilike.${b},description.ilike.${b}`).limit(5),Q.from("canva_templates").select("id, name, description, publish_date").or(`name.ilike.${b},description.ilike.${b}`).limit(5),Q.from("academy_videos").select("id, title, description, publish_date").eq("is_published",!0).or(`title.ilike.${b},description.ilike.${b}`).limit(5),Q.from("resource_kits").select("id, name, description, publish_date").eq("is_published",!0).or(`name.ilike.${b},description.ilike.${b}`).limit(5),Q.from("social_swag").select("id, title, description, publish_date").eq("is_published",!0).or(`title.ilike.${b},description.ilike.${b}`).limit(5)]),I=[];S.data&&S.data.forEach(z=>{I.push({id:z.id,title:z.title,description:z.description,type:"event",date:z.event_date,path:`/event/${z.id}`})}),k.data&&k.data.forEach(z=>{I.push({id:z.id,title:z.name,description:z.description,type:"template",date:z.publish_date,path:`/templates/${z.id}`})}),M.data&&M.data.forEach(z=>{I.push({id:z.id,title:z.title,description:z.description,type:"academy",date:z.publish_date,path:`/academy/${z.id}`})}),P.data&&P.data.forEach(z=>{I.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=>{I.push({id:z.id,title:z.title,description:z.description,type:"social-swag",date:z.publish_date,path:`/social-swag/${z.id}`})}),o(I)}catch(S){console.error("Search error:",S)}finally{i(!1)}},[]);E.useEffect(()=>{const _=setTimeout(()=>{p(n)},300);return()=>clearTimeout(_)},[n,p]);const x=_=>{t(!1),s(""),u(_)},y=a.reduce((_,b)=>(_[b.type]||(_[b.type]=[]),_[b.type].push(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:()=>t(!0),children:[r.jsx(Sa,{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(_pt,{open:e,onOpenChange:t,children:[r.jsx(Iy,{placeholder:"Search events, templates, academy, toolbox, social swag...",value:n,onValueChange:s}),r.jsxs(Py,{children:[l&&r.jsx("div",{className:"py-6 text-center text-sm text-muted-foreground",children:"Searching..."}),!l&&n&&a.length===0&&r.jsxs(Ly,{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])=>{const S=wpt[_],k=S.icon;return r.jsx(Oy,{heading:S.label,children:b.map(M=>r.jsxs(Dy,{value:`${M.type}-${M.id}-${M.title}`,onSelect:()=>x(M.path),className:"flex items-start gap-3 py-3 cursor-pointer",children:[r.jsx("div",{className:`p-2 rounded-md ${S.color}`,children:r.jsx(k,{className:"h-4 w-4"})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("div",{className:"font-medium truncate",children:M.title}),M.description&&r.jsx("div",{className:"text-sm text-muted-foreground truncate group-data-[selected=true]:text-primary-foreground/80",children:M.description})]}),r.jsxs("div",{className:"flex flex-col items-end gap-1 shrink-0",children:[r.jsx(Pt,{variant:"secondary",className:"text-xs",children:S.label}),r.jsx("span",{className:"text-xs text-muted-foreground",children:bu(new Date(M.date),{addSuffix:!0})})]})]},`${M.type}-${M.id}`))},_)})]})]})]})},jpt=({expiresAt:e,className:t,showUpgradeButton:n=!0})=>{const[s,a]=E.useState(null),o=Gn();if(E.useEffect(()=>{const p=()=>{const y=new Date().getTime(),b=new Date(e).getTime()-y;if(b<=0){a({days:0,hours:0,minutes:0});return}const S=Math.floor(b/(1e3*60*60*24)),k=Math.floor(b%(1e3*60*60*24)/(1e3*60*60)),M=Math.floor(b%(1e3*60*60)/(1e3*60));a({days:S,hours:k,minutes:M})};p();const x=setInterval(p,6e4);return()=>clearInterval(x)},[e]),!s)return null;const l=s.days===0&&s.hours===0&&s.minutes===0,i=s.days<=1,u=s.days<=3&&!i;return l?r.jsxs("div",{className:Bt("flex items-center justify-between gap-3 px-4 py-2 rounded-lg bg-destructive/10 border border-destructive/20",t),children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(rf,{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(Ls,{className:"h-3 w-3 mr-1"}),"Upgrade Now"]})]}):r.jsxs("div",{className:Bt("flex items-center justify-between gap-3 px-4 py-2 rounded-lg border transition-colors",i?"bg-destructive/10 border-destructive/20":u?"bg-amber-500/10 border-amber-500/20":"bg-primary/10 border-primary/20",t),children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(Ya,{className:Bt("h-4 w-4",i?"text-destructive":u?"text-amber-500":"text-primary")}),r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx("span",{className:Bt("text-sm font-medium",i?"text-destructive":u?"text-amber-600":"text-primary"),children:"Free Trial:"}),r.jsxs("div",{className:"flex items-center gap-1",children:[s.days>0&&r.jsxs("span",{className:Bt("text-sm font-bold",i?"text-destructive":u?"text-amber-600":"text-primary"),children:[s.days,"d"]}),r.jsxs("span",{className:Bt("text-sm font-bold",i?"text-destructive":u?"text-amber-600":"text-primary"),children:[s.hours,"h"]}),r.jsxs("span",{className:Bt("text-sm font-bold",i?"text-destructive":u?"text-amber-600":"text-primary"),children:[s.minutes,"m"]}),r.jsx("span",{className:Bt("text-xs",i?"text-destructive/70":u?"text-amber-600/70":"text-primary/70"),children:"remaining"})]})]})]}),n&&r.jsxs(ee,{size:"sm",onClick:()=>o("/subscription"),variant:i?"destructive":u?"default":"outline",className:Bt("text-xs h-7 px-3",u&&"bg-amber-500 hover:bg-amber-600 text-white"),children:[r.jsx(Ls,{className:"h-3 w-3 mr-1"}),"Upgrade"]})]})},kpt=()=>{const e=Gn();return r.jsx("div",{className:"fixed inset-0 bg-background/95 backdrop-blur-sm z-50 flex items-center justify-center p-4 overflow-y-auto",children:r.jsxs(Ze,{className:"w-full max-w-2xl shadow-2xl border-destructive/20 my-8",children:[r.jsxs(Wt,{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(rf,{className:"h-8 w-8 text-destructive"})}),r.jsx(Yt,{className:"text-2xl",children:"Your Free Trial Has Ended"}),r.jsx(Sn,{className:"text-base",children:"Your 7-day free trial has expired. Upgrade now to continue accessing all the powerful tools and resources LevelUp has to offer!"})]}),r.jsxs(et,{className:"space-y-6",children:[r.jsxs("div",{className:"grid sm:grid-cols-2 gap-4",children:[r.jsx(Ze,{className:"border-2 border-primary/20 hover:border-primary/50 transition-colors cursor-pointer",onClick:()=>e("/subscription"),children:r.jsxs(et,{className:"p-5 text-center",children:[r.jsx("div",{className:"mx-auto mb-3 h-12 w-12 rounded-full bg-primary/10 flex items-center justify-center",children:r.jsx(Un,{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:t=>{t.stopPropagation(),e("/subscription")},children:[r.jsx(Ls,{className:"h-4 w-4 mr-2"}),"Choose Individual"]})]})}),r.jsx(Ze,{className:"border-2 border-amber-500/20 hover:border-amber-500/50 transition-colors cursor-pointer",onClick:()=>e("/subscription"),children:r.jsxs(et,{className:"p-5 text-center",children:[r.jsx("div",{className:"mx-auto mb-3 h-12 w-12 rounded-full bg-amber-500/10 flex items-center justify-center",children:r.jsx(hi,{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:t=>{t.stopPropagation(),e("/subscription")},children:[r.jsx(hi,{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(Ti,{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(Ns,{className:"h-4 w-4"}),r.jsx("span",{children:"support@relevelup.com"})]})]})]})]})]})})},Npt=({hasUnseenBrief:e,onClick:t,className:n})=>r.jsxs(Ug,{children:[r.jsx(qg,{asChild:!0,children:r.jsxs(ee,{variant:"ghost",size:"icon",onClick:t,className:Bt("relative transition-colors",e&&"text-primary hover:text-primary",n),children:[r.jsx(Am,{className:"h-5 w-5"}),e&&r.jsx("span",{className:"absolute top-1 right-1 h-2 w-2 rounded-full bg-primary animate-pulse"})]})}),r.jsx(Im,{children:r.jsx("p",{children:"The LevelUp Brief"})})]});var iae="Checkbox",[Spt]=cc(iae),[Cpt,Cye]=Spt(iae);function Mpt(e){const{__scopeCheckbox:t,checked:n,children:s,defaultChecked:a,disabled:o,form:l,name:i,onCheckedChange:u,required:p,value:x="on",internal_do_not_use_render:y}=e,[_,b]=Ju({prop:n,defaultProp:a??!1,onChange:u,caller:iae}),[S,k]=E.useState(null),[M,P]=E.useState(null),T=E.useRef(!1),I=S?!!l||!!S.closest("form"):!0,z={checked:_,disabled:o,setChecked:b,control:S,setControl:k,name:i,form:l,value:x,hasConsumerStoppedPropagationRef:T,required:p,defaultChecked:ev(a)?!1:a,isFormControl:I,bubbleInput:M,setBubbleInput:P};return r.jsx(Cpt,{scope:t,...z,children:Tpt(y)?y(z):s})}var RDe="CheckboxTrigger",FDe=E.forwardRef(({__scopeCheckbox:e,onKeyDown:t,onClick:n,...s},a)=>{const{control:o,value:l,disabled:i,checked:u,required:p,setControl:x,setChecked:y,hasConsumerStoppedPropagationRef:_,isFormControl:b,bubbleInput:S}=Cye(RDe,e),k=la(a,x),M=E.useRef(u);return E.useEffect(()=>{const P=o==null?void 0:o.form;if(P){const T=()=>y(M.current);return P.addEventListener("reset",T),()=>P.removeEventListener("reset",T)}},[o,y]),r.jsx(Fn.button,{type:"button",role:"checkbox","aria-checked":ev(u)?"mixed":u,"aria-required":p,"data-state":qDe(u),"data-disabled":i?"":void 0,disabled:i,value:l,...s,ref:k,onKeyDown:un(t,P=>{P.key==="Enter"&&P.preventDefault()}),onClick:un(n,P=>{y(T=>ev(T)?!0:!T),S&&b&&(_.current=P.isPropagationStopped(),_.current||P.stopPropagation())})})});FDe.displayName=RDe;var Mye=E.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:s,checked:a,defaultChecked:o,required:l,disabled:i,value:u,onCheckedChange:p,form:x,...y}=e;return r.jsx(Mpt,{__scopeCheckbox:n,checked:a,defaultChecked:o,disabled:i,required:l,onCheckedChange:p,name:s,form:x,value:u,internal_do_not_use_render:({isFormControl:_})=>r.jsxs(r.Fragment,{children:[r.jsx(FDe,{...y,ref:t,__scopeCheckbox:n}),_&&r.jsx(UDe,{__scopeCheckbox:n})]})})});Mye.displayName=iae;var zDe="CheckboxIndicator",BDe=E.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:s,...a}=e,o=Cye(zDe,n);return r.jsx(Tc,{present:s||ev(o.checked)||o.checked===!0,children:r.jsx(Fn.span,{"data-state":qDe(o.checked),"data-disabled":o.disabled?"":void 0,...a,ref:t,style:{pointerEvents:"none",...e.style}})})});BDe.displayName=zDe;var $De="CheckboxBubbleInput",UDe=E.forwardRef(({__scopeCheckbox:e,...t},n)=>{const{control:s,hasConsumerStoppedPropagationRef:a,checked:o,defaultChecked:l,required:i,disabled:u,name:p,value:x,form:y,bubbleInput:_,setBubbleInput:b}=Cye($De,e),S=la(n,b),k=aP(o),M=WI(s);E.useEffect(()=>{const T=_;if(!T)return;const I=window.HTMLInputElement.prototype,D=Object.getOwnPropertyDescriptor(I,"checked").set,U=!a.current;if(k!==o&&D){const V=new Event("click",{bubbles:U});T.indeterminate=ev(o),D.call(T,ev(o)?!1:o),T.dispatchEvent(V)}},[_,k,o,a]);const P=E.useRef(ev(o)?!1:o);return r.jsx(Fn.input,{type:"checkbox","aria-hidden":!0,defaultChecked:l??P.current,required:i,disabled:u,name:p,value:x,form:y,...t,tabIndex:-1,ref:S,style:{...t.style,...M,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});UDe.displayName=$De;function Tpt(e){return typeof e=="function"}function ev(e){return e==="indeterminate"}function qDe(e){return ev(e)?"indeterminate":e?"checked":"unchecked"}const Bl=E.forwardRef(({className:e,...t},n)=>r.jsx(Mye,{ref:n,className:Bt("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",e),...t,children:r.jsx(BDe,{className:Bt("flex items-center justify-center text-current"),children:r.jsx(Ni,{className:"h-4 w-4"})})}));Bl.displayName=Mye.displayName;var Tye="Radio",[Apt,VDe]=cc(Tye),[Ept,Ipt]=Apt(Tye),HDe=E.forwardRef((e,t)=>{const{__scopeRadio:n,name:s,checked:a=!1,required:o,disabled:l,value:i="on",onCheck:u,form:p,...x}=e,[y,_]=E.useState(null),b=la(t,M=>_(M)),S=E.useRef(!1),k=y?p||!!y.closest("form"):!0;return r.jsxs(Ept,{scope:n,checked:a,disabled:l,children:[r.jsx(Fn.button,{type:"button",role:"radio","aria-checked":a,"data-state":ZDe(a),"data-disabled":l?"":void 0,disabled:l,value:i,...x,ref:b,onClick:un(e.onClick,M=>{a||u==null||u(),k&&(S.current=M.isPropagationStopped(),S.current||M.stopPropagation())})}),k&&r.jsx(KDe,{control:y,bubbles:!S.current,name:s,value:i,checked:a,required:o,disabled:l,form:p,style:{transform:"translateX(-100%)"}})]})});HDe.displayName=Tye;var WDe="RadioIndicator",GDe=E.forwardRef((e,t)=>{const{__scopeRadio:n,forceMount:s,...a}=e,o=Ipt(WDe,n);return r.jsx(Tc,{present:s||o.checked,children:r.jsx(Fn.span,{"data-state":ZDe(o.checked),"data-disabled":o.disabled?"":void 0,...a,ref:t})})});GDe.displayName=WDe;var Ppt="RadioBubbleInput",KDe=E.forwardRef(({__scopeRadio:e,control:t,checked:n,bubbles:s=!0,...a},o)=>{const l=E.useRef(null),i=la(l,o),u=aP(n),p=WI(t);return E.useEffect(()=>{const x=l.current;if(!x)return;const y=window.HTMLInputElement.prototype,b=Object.getOwnPropertyDescriptor(y,"checked").set;if(u!==n&&b){const S=new Event("click",{bubbles:s});b.call(x,n),x.dispatchEvent(S)}},[u,n,s]),r.jsx(Fn.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}})});KDe.displayName=Ppt;function ZDe(e){return e?"checked":"unchecked"}var Lpt=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],oae="RadioGroup",[Opt]=cc(oae,[C3,VDe]),YDe=C3(),XDe=VDe(),[Dpt,Rpt]=Opt(oae),QDe=E.forwardRef((e,t)=>{const{__scopeRadioGroup:n,name:s,defaultValue:a,value:o,required:l=!1,disabled:i=!1,orientation:u,dir:p,loop:x=!0,onValueChange:y,..._}=e,b=YDe(n),S=Sk(p),[k,M]=Ju({prop:o,defaultProp:a??null,onChange:y,caller:oae});return r.jsx(Dpt,{scope:n,name:s,required:l,disabled:i,value:k,onValueChange:M,children:r.jsx(Dxe,{asChild:!0,...b,orientation:u,dir:S,loop:x,children:r.jsx(Fn.div,{role:"radiogroup","aria-required":l,"aria-orientation":u,"data-disabled":i?"":void 0,dir:S,..._,ref:t})})})});QDe.displayName=oae;var JDe="RadioGroupItem",eRe=E.forwardRef((e,t)=>{const{__scopeRadioGroup:n,disabled:s,...a}=e,o=Rpt(JDe,n),l=o.disabled||s,i=YDe(n),u=XDe(n),p=E.useRef(null),x=la(t,p),y=o.value===a.value,_=E.useRef(!1);return E.useEffect(()=>{const b=k=>{Lpt.includes(k.key)&&(_.current=!0)},S=()=>_.current=!1;return document.addEventListener("keydown",b),document.addEventListener("keyup",S),()=>{document.removeEventListener("keydown",b),document.removeEventListener("keyup",S)}},[]),r.jsx(Rxe,{asChild:!0,...i,focusable:!l,active:y,children:r.jsx(HDe,{disabled:l,required:o.required,checked:y,...u,...a,name:o.name,ref:x,onCheck:()=>o.onValueChange(a.value),onKeyDown:un(b=>{b.key==="Enter"&&b.preventDefault()}),onFocus:un(a.onFocus,()=>{var b;_.current&&((b=p.current)==null||b.click())})})})});eRe.displayName=JDe;var Fpt="RadioGroupIndicator",tRe=E.forwardRef((e,t)=>{const{__scopeRadioGroup:n,...s}=e,a=XDe(n);return r.jsx(GDe,{...a,...s,ref:t})});tRe.displayName=Fpt;var rRe=QDe,nRe=eRe,zpt=tRe;const sRe=E.forwardRef(({className:e,...t},n)=>r.jsx(rRe,{className:Bt("grid gap-2",e),...t,ref:n}));sRe.displayName=rRe.displayName;const aRe=E.forwardRef(({className:e,...t},n)=>r.jsx(nRe,{ref:n,className:Bt("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",e),...t,children:r.jsx(zpt,{className:"flex items-center justify-center",children:r.jsx(Qu,{className:"h-2.5 w-2.5 fill-current text-current"})})}));aRe.displayName=nRe.displayName;const Bpt=({brief:e,open:t,onClose:n,onDismiss:s})=>{const{user:a}=tn(),[o,l]=E.useState({}),[i,u]=E.useState({}),[p,x]=E.useState([]);E.useEffect(()=>{t&&a&&e.polls.length>0&&y()},[t,a,e.polls]);const y=async()=>{if(!a)return;const M=e.polls.map(T=>T.id),{data:P}=await Q.from("levelup_brief_poll_responses").select("poll_id, option_id").eq("user_id",a.id).in("poll_id",M);if(P){const T={};P.forEach(I=>{T[I.poll_id]||(T[I.poll_id]=[]),T[I.poll_id].push(I.option_id)}),u(T)}},_=(M,P)=>{l(T=>({...T,[M]:P}))},b=(M,P,T)=>{l(I=>{const z=I[M]||[];return T?{...I,[M]:[...z,P]}:{...I,[M]:z.filter(D=>D!==P)}})},S=async M=>{if(!a)return;const P=o[M];if(!P||Array.isArray(P)&&P.length===0){Ie.error("Please select an option");return}x(T=>[...T,M]);try{await Q.from("levelup_brief_poll_responses").delete().eq("poll_id",M).eq("user_id",a.id);const T=Array.isArray(P)?P:[P],I=T.map(D=>({poll_id:M,option_id:D,user_id:a.id})),{error:z}=await Q.from("levelup_brief_poll_responses").insert(I);if(z)throw z;u(D=>({...D,[M]:T})),Ie.success("Response submitted!")}catch(T){console.error("Error submitting poll response:",T),Ie.error("Failed to submit response")}finally{x(T=>T.filter(I=>I!==M))}},k=M=>(M.includes("mediadelivery.net")||M.includes("bunny"),M);return r.jsx(Or,{open:t,onOpenChange:M=>!M&&n(),children:r.jsxs(Ir,{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(hs,{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(Am,{className:"h-6 w-6"})}),r.jsxs("div",{children:[r.jsx(Pt,{variant:"secondary",className:"mb-1 bg-white/20 text-white border-0",children:"The LevelUp Brief"}),r.jsx(Fr,{className:"text-xl font-bold text-white",children:e.brief.title})]})]})]}),r.jsx(Bo,{className:"max-h-[calc(90vh-240px)]",children:r.jsxs("div",{className:"p-6 space-y-6",children:[e.brief.description&&r.jsx("div",{className:"text-muted-foreground prose prose-sm max-w-none",dangerouslySetInnerHTML:{__html:e.brief.description}}),e.brief.video_url&&r.jsx("div",{className:"relative w-full aspect-video rounded-lg overflow-hidden bg-muted",children:r.jsx("iframe",{src:k(e.brief.video_url),className:"absolute inset-0 w-full h-full",allow:"autoplay; fullscreen; picture-in-picture",allowFullScreen:!0})}),e.brief.graphic_url&&!e.brief.video_url&&r.jsx("div",{className:"rounded-lg overflow-hidden bg-muted",children:e.brief.graphic_link_url?r.jsx("a",{href:e.brief.graphic_link_url,target:"_blank",rel:"noopener noreferrer",className:"block",children:r.jsx("img",{src:e.brief.graphic_url,alt:"Brief graphic",className:"w-full object-contain cursor-pointer hover:opacity-90 transition-opacity"})}):r.jsx("img",{src:e.brief.graphic_url,alt:"Brief graphic",className:"w-full object-contain"})}),e.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:e.links.map(M=>r.jsxs(ee,{variant:"outline",size:"sm",onClick:()=>window.open(M.url,"_blank"),className:"gap-2",children:[r.jsx(As,{className:"h-4 w-4"}),M.title]},M.id))})]}),e.polls.map(M=>{var I,z;const P=((I=i[M.id])==null?void 0:I.length)>0,T=p.includes(M.id);return r.jsxs("div",{className:"space-y-3 p-4 bg-muted/50 rounded-lg border",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("h4",{className:"font-semibold text-foreground",children:M.question}),P&&r.jsxs(Pt,{variant:"secondary",className:"gap-1",children:[r.jsx(so,{className:"h-3 w-3"}),"Responded"]})]}),M.poll_type==="single"?r.jsx(sRe,{value:o[M.id]||((z=i[M.id])==null?void 0:z[0])||"",onValueChange:D=>_(M.id,D),className:"space-y-2",children:M.options.map(D=>r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(aRe,{value:D.id,id:D.id}),r.jsx($e,{htmlFor:D.id,className:"cursor-pointer",children:D.option_text})]},D.id))}):r.jsx("div",{className:"space-y-2",children:M.options.map(D=>{const V=(o[M.id]||i[M.id]||[]).includes(D.id);return r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(Bl,{id:D.id,checked:V,onCheckedChange:W=>b(M.id,D.id,W)}),r.jsx($e,{htmlFor:D.id,className:"cursor-pointer",children:D.option_text})]},D.id)})}),r.jsx(ee,{size:"sm",onClick:()=>S(M.id),disabled:T,children:T?"Submitting...":P?"Update Response":"Submit"})]},M.id)})]})}),r.jsxs("div",{className:"p-4 pb-[calc(1rem+env(safe-area-inset-bottom))] border-t bg-muted/30 flex flex-col items-center gap-2 sticky bottom-0 z-10",children:[r.jsx(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"})]})]})})},$pt=()=>{const{user:e}=tn(),[t,n]=E.useState(null),[s,a]=E.useState(!1),[o,l]=E.useState(!0),[i,u]=E.useState(!1),p=E.useCallback(async()=>{if(!e){l(!1);return}try{const{data:S,error:k}=await Q.from("levelup_briefs").select("*").eq("is_published",!0).lte("publish_date",new Date().toISOString()).order("publish_date",{ascending:!1}).limit(1).single();if(k||!S){l(!1);return}const{data:M}=await Q.from("levelup_brief_views").select("*").eq("brief_id",S.id).eq("user_id",e.id).maybeSingle(),[P,T]=await Promise.all([Q.from("levelup_brief_links").select("*").eq("brief_id",S.id).order("sort_order"),Q.from("levelup_brief_polls").select("*").eq("brief_id",S.id).order("sort_order")]),I=[];if(T.data)for(const V of T.data){const{data:W}=await Q.from("levelup_brief_poll_options").select("*").eq("poll_id",V.id).order("sort_order");I.push({...V,options:W||[]})}const z={brief:S,links:P.data||[],polls:I};n(z);const D=!!M,U=(M==null?void 0:M.dismissed_at)!==null;if(!D)a(!0),u(!0);else if(S.show_frequency==="every_login"&&!U)a(!0),u(!0);else if(S.show_frequency==="daily"){const V=new Date(M.viewed_at);(new Date().getTime()-V.getTime())/(1e3*60*60)>=24&&!U&&(a(!0),u(!0))}else u(!U)}catch(S){console.error("Error fetching brief:",S)}finally{l(!1)}},[e]);E.useEffect(()=>{p()},[p]);const x=async()=>{if(!(!e||!t))try{const{data:S}=await Q.from("levelup_brief_views").select("id").eq("brief_id",t.brief.id).eq("user_id",e.id).maybeSingle();S?await Q.from("levelup_brief_views").update({viewed_at:new Date().toISOString()}).eq("id",S.id):await Q.from("levelup_brief_views").insert({brief_id:t.brief.id,user_id:e.id})}catch(S){console.error("Error marking brief as viewed:",S)}};return{currentBrief:t,shouldShowPopup:s,hasUnseenBrief:i,loading:o,openBrief:()=>{a(!0)},closeBrief:()=>{a(!1),x()},dismissBrief:async()=>{if(!(!e||!t))try{const{data:S}=await Q.from("levelup_brief_views").select("id").eq("brief_id",t.brief.id).eq("user_id",e.id).maybeSingle();S?await Q.from("levelup_brief_views").update({dismissed_at:new Date().toISOString()}).eq("id",S.id):await Q.from("levelup_brief_views").insert({brief_id:t.brief.id,user_id:e.id,dismissed_at:new Date().toISOString()}),a(!1),u(!1)}catch(S){console.error("Error dismissing brief:",S)}},refetch:p}};function Upt(){const[e,t]=E.useState(!1),[n,s]=E.useState(!1),[a,o]=E.useState(null);E.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),t(!0);const _=b=>{b.preventDefault(),o(b)};return window.addEventListener("beforeinstallprompt",_),()=>{window.removeEventListener("beforeinstallprompt",_)}},[]);const l=()=>{localStorage.setItem("install-banner-dismissed","true"),t(!1)},i=async()=>{if(a){await a.prompt();const{outcome:u}=await a.userChoice;u==="accepted"&&l(),o(null)}};return e?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(io,{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(bA,{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(hs,{className:"h-4 w-4"})})]})]})}):null}const qpt=({children:e,onRefresh:t})=>{const[n,s]=E.useState(!1),[a,o]=E.useState(0),[l,i]=E.useState(!1),u=E.useRef(null),p=E.useRef(0),x=Hr(),y=80,_=120,b=E.useCallback(T=>{const I=u.current;I&&I.scrollTop<=0&&(p.current=T.touches[0].clientY,s(!0))},[]),S=E.useCallback(T=>{if(!n||l)return;const I=u.current;if(!I||I.scrollTop>0){s(!1),o(0);return}const D=T.touches[0].clientY-p.current;if(D>0){const V=Math.min(D*.5,_);o(V),V>10&&T.preventDefault()}},[n,l]),k=E.useCallback(async()=>{if(n)if(s(!1),a>=y&&!l){i(!0),o(y);try{t?await t():await x.invalidateQueries()}catch(T){console.error("Refresh failed:",T)}finally{i(!1),o(0)}}else o(0)},[n,a,l,t,x]),M=Math.min(a/y,1),P=M*180;return r.jsxs("div",{ref:u,className:"h-full overflow-auto",onTouchStart:b,onTouchMove:S,onTouchEnd:k,children:[r.jsx("div",{className:"flex justify-center items-center overflow-hidden transition-all duration-200 ease-out",style:{height:a>0?a:0,opacity:M},children:r.jsx("div",{className:`p-2 rounded-full bg-primary/10 ${l?"animate-spin":""}`,style:{transform:l?void 0:`rotate(${P}deg)`,transition:l?void 0:"transform 0.1s ease-out"},children:r.jsx(qo,{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:e})]})},iRe=()=>{const{user:e}=tn(),[t,n]=E.useState(!1),[s,a]=E.useState(!1),[o,l]=E.useState(0),[i,u]=E.useState(!0);E.useEffect(()=>{(async()=>{if(!e){u(!1);return}try{const{data:b}=await Q.from("membership_reviews").select("id").eq("user_id",e.id).maybeSingle();if(b){a(!0),n(!1),u(!1);return}const{data:S}=await Q.from("profiles").select("login_count").eq("id",e.id).single(),k=(S==null?void 0:S.login_count)||0;l(k);const M=sessionStorage.getItem("review-prompt-dismissed");n(k>=4&&!M)}catch(b){console.error("Error checking review eligibility:",b)}finally{u(!1)}})()},[e]);const p=E.useCallback(()=>{sessionStorage.setItem("review-prompt-dismissed","true"),n(!1)},[]),x=E.useCallback(async(_,b)=>{if(!e)return{success:!1,error:"Not authenticated"};try{const{error:S}=await Q.from("membership_reviews").insert({user_id:e.id,rating:_,review_text:b});if(S)throw S;return a(!0),n(!1),{success:!0,pointsAwarded:25}}catch(S){return console.error("Error submitting review:",S),{success:!1,error:S.message}}},[e]),y=E.useCallback(async()=>{if(e)try{await Q.from("membership_reviews").update({posted_to_google:!0}).eq("user_id",e.id)}catch(_){console.error("Error updating Google review status:",_)}},[e]);return{shouldShowPrompt:t,hasSubmittedReview:s,loginCount:o,isLoading:i,dismissPrompt:p,submitReview:x,markPostedToGoogle:y}},Vpt="https://search.google.com/local/writereview?placeid=ChIJM73ERQD1QogRPxupMFObuck&source=g.page.m.ia._&laa=nmx-review-solicitation-ia2",Hpt=()=>{const{shouldShowPrompt:e,isLoading:t,dismissPrompt:n,submitReview:s,markPostedToGoogle:a}=iRe(),[o,l]=E.useState(!1),[i,u]=E.useState("review"),[p,x]=E.useState(0),[y,_]=E.useState(0),[b,S]=E.useState(""),[k,M]=E.useState(!1),[P,T]=E.useState(!1);if(t||!e&&!P)return null;const I=async()=>{if(p===0){ka({title:"Please select a rating",variant:"destructive"});return}M(!0);const U=await s(p,b);M(!1),U.success?(T(!0),ka({title:"Thank you for your feedback!",description:"Your review helps us improve."}),u("google")):ka({title:"Error submitting review",description:U.error,variant:"destructive"})},z=async U=>{U&&(await navigator.clipboard.writeText(b||`${p} star rating for LevelUp!`),ka({title:"Review copied!",description:"Paste it on Google Reviews."}),await a(),window.open(Vpt,"_blank")),l(!1),n()},D=()=>{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(js,{className:"h-3.5 w-3.5 fill-current"}),r.jsx("span",{className:"hidden sm:inline",children:"Leave a Review"})]}),r.jsx(Or,{open:o,onOpenChange:D,children:r.jsx(Ir,{className:"sm:max-w-md",children:i==="review"?r.jsxs(r.Fragment,{children:[r.jsxs($r,{children:[r.jsx(Fr,{className:"text-center",children:"How are you enjoying LevelUp?"}),r.jsx(Zn,{className:"text-center",children:"Your feedback helps us improve the experience for all members."})]}),r.jsxs("div",{className:"space-y-6 py-4",children:[r.jsx("div",{className:"flex justify-center gap-1",children:[1,2,3,4,5].map(U=>r.jsx("button",{type:"button",onClick:()=>x(U),onMouseEnter:()=>_(U),onMouseLeave:()=>_(0),className:"p-1 transition-transform hover:scale-110",children:r.jsx(js,{className:Bt("h-8 w-8 transition-colors",(y||p)>=U?"fill-yellow-400 text-yellow-400":"text-muted-foreground")})},U))}),r.jsx(Jn,{placeholder:"Tell us about your experience (optional)",value:b,onChange:U=>S(U.target.value),rows:4,className:"resize-none"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(ee,{variant:"outline",onClick:D,className:"flex-1",children:"Maybe Later"}),r.jsx(ee,{onClick:I,disabled:k||p===0,className:"flex-1",children:k?"Submitting...":"Submit Review"})]})]})]}):r.jsxs(r.Fragment,{children:[r.jsxs($r,{children:[r.jsx(Fr,{className:"text-center",children:"🎉 Thank you!"}),r.jsx(Zn,{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 Wpt(e){const t="=".repeat((4-e.length%4)%4),n=(e+t).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 k="vapid_public_key";let M=localStorage.getItem(k);if(!M){const{data:I,error:z}=await Q.functions.invoke("get-vapid-public-key",{body:{}});if(z)throw z;if(M=(I==null?void 0:I.vapidPublicKey)??null,!M)throw new Error("Missing VAPID public key");localStorage.setItem(k,M)}x(M);const P=await navigator.serviceWorker.register("/push-sw.js");u(P),n(Notification.permission);const T=await P.pushManager.getSubscription();a(!!T)}catch(k){console.error("Error initializing push notifications:",k)}finally{l(!1)}})()},[y]);const _=E.useCallback(async()=>{if(!y||!i||!e)return console.error("Push notifications not supported or user not logged in"),!1;if(!p)return Ie.error("Push notifications are not ready yet. Please try again in a moment."),!1;try{l(!0);const S=await i.pushManager.getSubscription();if(S){try{await S.unsubscribe()}catch(z){console.warn("Failed to unsubscribe existing push subscription:",z)}const{error:I}=await Q.from("push_subscriptions").delete().eq("user_id",e.id);I&&console.warn("Failed to cleanup push_subscriptions rows:",I)}if(Notification.permission!=="granted"){const I=await Notification.requestPermission();if(n(I),I!=="granted")return I==="denied"?Ie.error("Notifications blocked. Please enable them in your browser settings (click the lock icon in the address bar)."):Ie.error("Notification permission was dismissed. Please try again."),!1}const k=Wpt(p);let M;try{M=await i.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:k})}catch(I){console.error("PushManager.subscribe() failed:",I);const z=(I==null?void 0:I.message)||String(I);return z.includes("permission")?Ie.error("Push permission denied. Check your browser notification settings."):z.includes("key")||z.includes("VAPID")?Ie.error("Push configuration error. Please contact support."):z.includes("AbortError")?Ie.error("Push subscription was cancelled. Please try again."):Ie.error(`Failed to subscribe: ${z}`),!1}const P=M.toJSON(),{error:T}=await Q.from("push_subscriptions").upsert({user_id:e.id,endpoint:P.endpoint,p256dh_key:P.keys.p256dh,auth_key:P.keys.auth},{onConflict:"user_id,endpoint"});if(T)throw console.error("Error saving subscription:",T),Ie.error("Failed to save notification preferences. Please try again."),T;return a(!0),Ie.success("Push notifications enabled!"),!0}catch(S){if(console.error("Error subscribing to push notifications:",S),!(S instanceof Error&&S.message.includes("toast"))){const k=S instanceof Error?S.message:"Unknown error";Ie.error("Failed to enable push notifications: "+k)}return!1}finally{l(!1)}},[y,i,e,p]),b=E.useCallback(async()=>{if(!i||!e)return!1;try{l(!0);const S=await i.pushManager.getSubscription();return S&&await S.unsubscribe(),await Q.from("push_subscriptions").delete().eq("user_id",e.id),a(!1),Ie.success("Push notifications disabled"),!0}catch(S){console.error("Error unsubscribing:",S);const k=S instanceof Error?S.message:"Unknown error";return Ie.error("Failed to disable push notifications: "+k),!1}finally{l(!1)}},[i,e]);return{isSupported:y,permission:t,isSubscribed:s,isLoading:o,vapidPublicKey:p,subscribe:_,unsubscribe:b}}const BNe="push_notification_prompt_dismissed",Gpt=()=>{const{user:e}=tn(),{isSupported:t,isSubscribed:n,isLoading:s,subscribe:a}=oRe(),[o,l]=E.useState(!1),[i,u]=E.useState(!1);E.useEffect(()=>{if(!e||!t||n||s||localStorage.getItem(`${BNe}_${e.id}`))return;const _=setTimeout(()=>{l(!0)},2e3);return()=>clearTimeout(_)},[e,t,n,s]);const p=async()=>{u(!0);const y=await a();u(!1),y&&l(!1)},x=()=>{e&&localStorage.setItem(`${BNe}_${e.id}`,"true"),l(!1)};return!t||n?null:r.jsx(Or,{open:o,onOpenChange:y=>!y&&x(),children:r.jsxs(Ir,{className:"sm:max-w-md",children:[r.jsxs($r,{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(Lg,{className:"h-6 w-6 text-primary"})}),r.jsx(Fr,{className:"text-center",children:"Stay in the Loop!"}),r.jsx(Zn,{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."})]})})},$Ne=e=>{let t;const n=new Set,s=(p,x)=>{const y=typeof p=="function"?p(t):p;if(!Object.is(y,t)){const _=t;t=x??(typeof y!="object"||y===null)?y:Object.assign({},t,y),n.forEach(b=>b(t,_))}},a=()=>t,i={setState:s,getState:a,getInitialState:()=>u,subscribe:p=>(n.add(p),()=>n.delete(p))},u=t=e(s,a,i);return i},Kpt=e=>e?$Ne(e):$Ne,Zpt=e=>e;function Ypt(e,t=Zpt){const n=lt.useSyncExternalStore(e.subscribe,lt.useCallback(()=>t(e.getState()),[e,t]),lt.useCallback(()=>t(e.getInitialState()),[e,t]));return lt.useDebugValue(n),n}const Xpt=e=>{const t=Kpt(e),n=s=>Ypt(t,s);return Object.assign(n,t),n},Qpt=e=>Xpt;function Jpt(e,t){let n;try{n=e()}catch{return}return{getItem:a=>{var o;const l=u=>u===null?null:JSON.parse(u,void 0),i=(o=n.getItem(a))!=null?o:null;return i instanceof Promise?i.then(l):l(i)},setItem:(a,o)=>n.setItem(a,JSON.stringify(o,void 0)),removeItem:a=>n.removeItem(a)}}const Cfe=e=>t=>{try{const n=e(t);return n instanceof Promise?n:{then(s){return Cfe(s)(n)},catch(s){return this}}}catch(n){return{then(s){return this},catch(s){return Cfe(s)(n)}}}},emt=(e,t)=>(n,s,a)=>{let o={storage:Jpt(()=>localStorage),partialize:k=>k,version:0,merge:(k,M)=>({...M,...k}),...t},l=!1;const i=new Set,u=new Set;let p=o.storage;if(!p)return e((...k)=>{console.warn(`[zustand persist middleware] Unable to update item '${o.name}', the given storage is currently unavailable.`),n(...k)},s,a);const x=()=>{const k=o.partialize({...s()});return p.setItem(o.name,{state:k,version:o.version})},y=a.setState;a.setState=(k,M)=>(y(k,M),x());const _=e((...k)=>(n(...k),x()),s,a);a.getInitialState=()=>_;let b;const S=()=>{var k,M;if(!p)return;l=!1,i.forEach(T=>{var I;return T((I=s())!=null?I:_)});const P=((M=o.onRehydrateStorage)==null?void 0:M.call(o,(k=s())!=null?k:_))||void 0;return Cfe(p.getItem.bind(p))(o.name).then(T=>{if(T)if(typeof T.version=="number"&&T.version!==o.version){if(o.migrate){const I=o.migrate(T.state,T.version);return I instanceof Promise?I.then(z=>[!0,z]):[!0,I]}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 I;const[z,D]=T;if(b=o.merge(D,(I=s())!=null?I:_),n(b,!0),z)return x()}).then(()=>{P==null||P(b,void 0),b=s(),l=!0,u.forEach(T=>T(b))}).catch(T=>{P==null||P(void 0,T)})};return a.persist={setOptions:k=>{o={...o,...k},k.storage&&(p=k.storage)},clearStorage:()=>{p==null||p.removeItem(o.name)},getOptions:()=>o,rehydrate:()=>S(),hasHydrated:()=>l,onHydrate:k=>(i.add(k),()=>{i.delete(k)}),onFinishHydration:k=>(u.add(k),()=>{u.delete(k)})},o.skipHydration||S(),b||_},tmt=emt,lae=Qpt()(tmt((e,t)=>({cartItems:[],addToCart:(n,s,a=1,o)=>{e(l=>{const i=l.cartItems.findIndex(u=>{var p;return u.product.id===n.id&&((p=u.variant)==null?void 0:p.id)===(s==null?void 0:s.id)});if(i>=0){const u=[...l.cartItems];return u[i].quantity+=a,o&&(u[i].artworkUrl=o),{cartItems:u}}return{cartItems:[...l.cartItems,{product:n,variant:s,quantity:a,artworkUrl:o}]}})},removeFromCart:(n,s)=>{e(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)=>{e(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)=>{e(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:()=>e({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}=t();return n.reduce((a,o)=>a+s(o)*o.quantity,0)},getShippingTotal:()=>{const{cartItems:n}=t();return n.reduce((s,a)=>s+Number(a.product.shipping_fee)*a.quantity,0)},getTotal:()=>{const{getSubtotal:n,getShippingTotal:s}=t();return n()+s()}}),{name:"marketplace-cart",partialize:e=>({cartItems:e.cartItems})})),lRe=E.createContext({onlineUsers:[],totalOnline:0}),rmt=async e=>{try{const{data:t}=await Q.storage.from("avatars").list(`${e}`);if(t&&t.length>0){const{data:n}=Q.storage.from("avatars").getPublicUrl(`${e}/${t[0].name}`);return n.publicUrl}}catch{}},nmt=({children:e})=>{const{user:t,brokerageId:n,isAdmin:s}=tn(),[a,o]=E.useState([]),[l,i]=E.useState(null);E.useEffect(()=>{if(!t)return;const p=Q.channel("app-presence",{config:{presence:{key:t.id}}});return p.on("presence",{event:"sync"},()=>{const x=p.presenceState(),y=[];Object.entries(x).forEach(([_,b])=>{if(b&&b.length>0){const S=b[0];y.push({id:_,name:S.name||"Unknown",avatarUrl:S.avatarUrl,brokerageId:S.brokerageId,onlineSince:S.onlineSince})}}),o(y)}).on("presence",{event:"join"},()=>{}).on("presence",{event:"leave"},()=>{}).subscribe(async x=>{var y;if(x==="SUBSCRIBED"){const{data:_}=await Q.from("profiles").select("name, brokerage_id").eq("id",t.id).single(),b=await rmt(t.id);await p.track({name:(_==null?void 0:_.name)||((y=t.email)==null?void 0:y.split("@")[0])||"User",avatarUrl:b,brokerageId:_==null?void 0:_.brokerage_id,onlineSince:new Date().toISOString()})}}),i(p),()=>{p.unsubscribe()}},[t]);const u=a.filter(p=>p.id===(t==null?void 0:t.id)?!1:!!(s||n&&p.brokerageId===n||!n&&!p.brokerageId));return r.jsx(lRe.Provider,{value:{onlineUsers:u,totalOnline:a.length},children:e})},cRe=()=>E.useContext(lRe),UNe="dashboard-sidebar-collapsed",Dr=({children:e,title:t})=>{var Je,Te,De;const{user:n,signOut:s,isAdmin:a,isBrokerageManager:o,brokerageId:l}=tn(),{isAssistant:i,actingAsAgent:u}=Lxe(),{isImpersonating:p}=Pxe(),y=(i&&!!u?40:0)+(p?40:0),{avatarUrl:_}=I8e(n==null?void 0:n.id),{isTrial:b,isExpired:S,expiresAt:k}=qdt(n==null?void 0:n.id),{isMarketplaceEnabled:M}=L8e(),{currentBrief:P,shouldShowPopup:T,hasUnseenBrief:I,openBrief:z,closeBrief:D,dismissBrief:U}=$pt(),{unreadCount:V}=Vdt(),{openCount:W}=Hdt(),J=lae(Ue=>Ue.cartItems).reduce((Ue,Be)=>Ue+Be.quantity,0),ne=Gn(),oe=Bm(),[ge,ie]=E.useState(()=>typeof window<"u"?localStorage.getItem(UNe)==="true":!1);E.useEffect(()=>{localStorage.setItem(UNe,String(ge))},[ge]);const[pe,se]=E.useState({agentos:!0,tools:!0,marketing:!0,learning:!0,community:!0,help:!1}),fe=Ue=>{se(Be=>({...Be,[Ue]:!Be[Ue]}))},he=Ue=>Ue.split(" ").map(Be=>Be[0]).join("").toUpperCase().slice(0,2),ye=Ue=>oe.pathname===Ue,Ae=Ue=>Ue.some(Be=>oe.pathname===Be),we=({path:Ue,icon:Be,label:qe,badgeCount:ot})=>{const Mt=r.jsxs(ee,{variant:"ghost",size:"sm",className:Bt("text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground relative",ye(Ue)&&"bg-sidebar-accent text-sidebar-accent-foreground",ge?"w-10 h-10 p-0 justify-center":"w-full justify-start gap-2"),onClick:()=>ne(Ue),children:[r.jsxs("div",{className:"relative",children:[r.jsx(Be,{className:"h-4 w-4 shrink-0"}),ge&&ot!=null&&ot>0&&r.jsx("span",{className:"absolute -top-1 -right-1 h-2 w-2 rounded-full bg-muted-foreground/40 border border-background"})]}),!ge&&qe,!ge&&ot!=null&&ot>0&&r.jsx("span",{className:"ml-auto flex h-5 w-5 items-center justify-center rounded-full bg-muted text-muted-foreground text-xs font-medium border border-muted-foreground/20",children:ot>9?"9+":ot})]});return ge?r.jsxs(Ug,{delayDuration:0,children:[r.jsx(qg,{asChild:!0,children:Mt}),r.jsxs(Im,{side:"right",className:"flex items-center gap-2",children:[qe,ot!=null&&ot>0&&r.jsx("span",{className:"flex h-5 w-5 items-center justify-center rounded-full bg-muted text-muted-foreground text-xs font-medium border border-muted-foreground/20",children:ot>9?"9+":ot})]})]}):Mt},be=({id:Ue,label:Be,icon:qe,children:ot,activePaths:Mt,showBetaBadge:Oe,defaultPath:at,badgeCount:le})=>{if(ge){const Ve=at||Mt[0];return r.jsxs(Ug,{delayDuration:0,children:[r.jsx(qg,{asChild:!0,children:r.jsx(ee,{variant:"ghost",size:"sm",className:Bt("w-10 h-10 p-0 justify-center text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground relative",Ae(Mt)&&"text-primary"),onClick:()=>ne(Ve),children:r.jsxs("div",{className:"relative",children:[r.jsx(qe,{className:"h-4 w-4"}),le!=null&&le>0&&r.jsx("span",{className:"absolute -top-1 -right-1 h-2 w-2 rounded-full bg-muted-foreground/40 border border-background"})]})})}),r.jsxs(Im,{side:"right",className:"flex items-center gap-2",children:[Be,Oe&&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"}),le!=null&&le>0&&r.jsx("span",{className:"flex h-5 w-5 items-center justify-center rounded-full bg-muted text-muted-foreground text-xs font-medium border border-muted-foreground/20",children:le>9?"9+":le})]})]})}return r.jsxs(HS,{open:pe[Ue],onOpenChange:()=>fe(Ue),children:[r.jsx(WS,{asChild:!0,children:r.jsxs(ee,{variant:"ghost",size:"sm",className:Bt("w-full justify-between gap-2 text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",Ae(Mt)&&"text-primary"),children:[r.jsxs("span",{className:"flex items-center gap-2 font-semibold text-[15px]",children:[r.jsx(qe,{className:"h-4 w-4"}),Be,Oe&&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:[le!=null&&le>0&&r.jsx("span",{className:"flex h-5 w-5 items-center justify-center rounded-full bg-muted text-muted-foreground text-xs font-medium border border-muted-foreground/20",children:le>9?"9+":le}),r.jsx(Dd,{className:Bt("h-4 w-4 transition-transform duration-200",pe[Ue]&&"rotate-180")})]})]})}),r.jsx(GS,{className:"pl-4 space-y-1 mt-1",children:ot})]})},_e=({isMobile:Ue=!1})=>{const Be=Ue?!1:ge;return r.jsxs("div",{className:"flex flex-col h-full",children:[r.jsxs("div",{className:Bt("p-3 border-b border-sidebar-border",Be?"flex flex-col items-center gap-2":"flex items-center justify-between"),children:[Be?r.jsx("img",{src:hut,alt:"LevelUp",className:"h-8 w-auto"}):r.jsx("img",{src:hNe,alt:"LevelUp",className:"h-8 w-auto"}),!Ue&&r.jsxs(Ug,{delayDuration:0,children:[r.jsx(qg,{asChild:!0,children:r.jsx(ee,{variant:"ghost",size:"icon",className:"h-8 w-8 shrink-0",onClick:()=>ie(!Be),children:r.jsx(kc,{className:Bt("h-4 w-4 transition-transform duration-300",Be&&"rotate-180")})})}),r.jsx(Im,{side:"right",children:Be?"Expand sidebar":"Collapse sidebar"})]})]}),r.jsx(Bo,{className:"flex-1",children:r.jsxs("nav",{className:Bt("p-3 space-y-1",Be&&"flex flex-col items-center"),children:[r.jsx(we,{path:"/dashboard",icon:Oj,label:"Dashboard"}),r.jsx(we,{path:"/events",icon:Cm,label:"Events"}),r.jsxs(be,{id:"agentos",label:"Agent OS",icon:_S,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(we,{path:"/mission-control",icon:xi,label:"Mission Control"}),r.jsx(we,{path:"/mission-control/contacts",icon:Un,label:"Contacts"}),r.jsx(we,{path:"/mission-control/plans",icon:Cm,label:"TouchPlans"}),r.jsx(we,{path:"/mission-control/pipeline",icon:uy,label:"Deal Pipeline"}),r.jsx(we,{path:"/mission-control/popbys",icon:to,label:"Popbys"}),r.jsx(we,{path:"/mission-control/video-library",icon:$a,label:"Video Library"}),r.jsx(we,{path:"/mission-control/scorecard",icon:_c,label:"Scorecard"}),r.jsx(we,{path:"/mission-control/listings",icon:hi,label:"Listing Exchange"})]}),r.jsxs(be,{id:"tools",label:"Tools",icon:Qh,activePaths:["/apps","/ai-toolkit","/mission-control/my-card"],defaultPath:"/apps",children:[r.jsx(we,{path:"/apps",icon:Qh,label:"Apps"}),!Be&&r.jsxs(ee,{variant:"ghost",size:"sm",className:Bt("w-full justify-start gap-2 text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",ye("/mission-control/my-card")&&"bg-sidebar-accent text-sidebar-accent-foreground"),onClick:()=>ne("/mission-control/my-card"),children:[r.jsx(Mm,{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"})]}),Be&&r.jsx(we,{path:"/mission-control/my-card",icon:Mm,label:"Digital Card"})]}),r.jsxs(be,{id:"marketing",label:"Marketing",icon:Am,activePaths:["/templates","/social-swag-2","/newsletters"],defaultPath:"/templates",children:[r.jsx(we,{path:"/templates",icon:Uc,label:"Templates"}),r.jsx(we,{path:"/social-swag-2",icon:py,label:"Social Swag"}),r.jsx(we,{path:"/newsletters",icon:fy,label:"Newsletters"})]}),r.jsxs(be,{id:"learning",label:"Learning",icon:QT,activePaths:["/academy","/toolbox"],defaultPath:"/academy",children:[r.jsx(we,{path:"/academy",icon:H1,label:"Academy"}),r.jsx(we,{path:"/toolbox",icon:gy,label:"Toolbox"})]}),r.jsxs(be,{id:"community",label:"Community",icon:zo,activePaths:["/community","/wishlist"],defaultPath:"/community",badgeCount:V,children:[r.jsx(we,{path:"/community",icon:Un,label:"Community",badgeCount:V}),r.jsx(we,{path:"/wishlist",icon:W1,label:"Wishlist",badgeCount:W}),!Be&&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(As,{className:"h-4 w-4"}),"Facebook Group"]})]}),r.jsxs(be,{id:"goods",label:"The Goods",icon:Nh,activePaths:["/marketplace","/reward-store"],defaultPath:"/reward-store",children:[M&&!Be&&r.jsxs(ee,{variant:"ghost",size:"sm",className:Bt("w-full justify-start gap-2 text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",oe.pathname.startsWith("/marketplace")&&"bg-sidebar-accent text-sidebar-accent-foreground"),onClick:()=>ne("/marketplace"),children:[r.jsx(Nh,{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"})]}),M&&Be&&r.jsx(we,{path:"/marketplace",icon:Nh,label:"Marketplace"}),r.jsx(we,{path:"/reward-store",icon:ro,label:"Reward Store"})]}),r.jsxs(be,{id:"help",label:"Help & Services",icon:Hx,activePaths:["/support","/additional-services"],defaultPath:"/support",children:[r.jsx(we,{path:"/support",icon:CS,label:"Support"}),r.jsx(we,{path:"/additional-services",icon:Ls,label:"Additional Services"})]}),a&&r.jsxs(r.Fragment,{children:[!Be&&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"})}),Be?r.jsx("div",{className:"pt-3 border-t border-sidebar-border mt-3 space-y-1",children:r.jsx(we,{path:"/admin",icon:hp,label:"Admin Dashboard"})}):r.jsxs(ee,{variant:"ghost",size:"sm",className:Bt("w-full justify-start gap-2 text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",oe.pathname==="/admin"&&"bg-sidebar-accent text-sidebar-accent-foreground"),onClick:()=>ne("/admin"),children:[r.jsx(hp,{className:"h-4 w-4"}),"Admin Dashboard"]})]}),(l||o)&&!a&&r.jsxs(r.Fragment,{children:[!Be&&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"})}),Be?r.jsxs("div",{className:"border-t border-sidebar-border mt-3 pt-3 space-y-1",children:[l&&r.jsx(we,{path:"/my-brokerage",icon:hi,label:"My Brokerage"}),o&&r.jsxs(r.Fragment,{children:[r.jsx(we,{path:"/brokerage/dashboard",icon:Fd,label:"Manage Brokerages"}),r.jsx(we,{path:"/brokerage-resources",icon:Ah,label:"Brokerage Resources"})]})]}):r.jsxs(r.Fragment,{children:[l&&r.jsxs(ee,{variant:"ghost",size:"sm",className:Bt("w-full justify-start gap-2 text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",ye("/my-brokerage")&&"bg-sidebar-accent text-sidebar-accent-foreground"),onClick:()=>ne("/my-brokerage"),children:[r.jsx(hi,{className:"h-4 w-4"}),"My Brokerage"]}),o&&r.jsxs(r.Fragment,{children:[r.jsxs(ee,{variant:"ghost",size:"sm",className:Bt("w-full justify-start gap-2 text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",ye("/brokerage/dashboard")&&"bg-sidebar-accent text-sidebar-accent-foreground"),onClick:()=>ne("/brokerage/dashboard"),children:[r.jsx(Fd,{className:"h-4 w-4"}),"Manage Brokerages"]}),r.jsxs(ee,{variant:"ghost",size:"sm",className:Bt("w-full justify-start gap-2 text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",ye("/brokerage-resources")&&"bg-sidebar-accent text-sidebar-accent-foreground"),onClick:()=>ne("/brokerage-resources"),children:[r.jsx(Ah,{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:Bt("w-full justify-start gap-2 text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",ye("/profile")&&"bg-sidebar-accent text-sidebar-accent-foreground"),onClick:()=>ne("/profile"),children:[r.jsx(ic,{className:"h-4 w-4"}),"Profile"]}),r.jsxs(ee,{variant:"ghost",size:"sm",className:"w-full justify-start gap-2 text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",onClick:s,children:[r.jsx(AS,{className:"h-4 w-4"}),"Sign Out"]})]})]})};return r.jsx(nmt,{children:r.jsx(YI,{children:r.jsxs("div",{className:"min-h-screen bg-background flex",children:[b&&S&&r.jsx(kpt,{}),typeof document<"u"&&kh.createPortal(r.jsx("aside",{className:Bt("hidden md:flex flex-col bg-card border-r border-border fixed left-0 z-[2147483647] isolate !pointer-events-auto transition-[width] duration-300",ge?"w-16":"w-52"),style:{top:`${y}px`,height:`calc(100vh - ${y}px)`},children:r.jsx(_e,{})}),document.body),r.jsxs("div",{className:Bt("flex-1 flex flex-col overflow-hidden transition-all duration-300",ge?"md:ml-16":"md:ml-52"),style:{height:`calc(100vh - ${y}px)`,marginTop:`${y}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(Vse,{children:[r.jsx(eye,{asChild:!0,children:r.jsx(ee,{variant:"ghost",size:"icon",className:"md:hidden",children:r.jsx(cA,{className:"h-5 w-5"})})}),r.jsx(iP,{side:"left",className:"w-52 p-0 bg-card",children:r.jsx(_e,{isMobile:!0})})]}),r.jsx("div",{className:"flex-1 md:hidden",children:r.jsx("img",{src:hNe,alt:"LevelUp",className:"h-8 w-auto"})}),r.jsx("div",{className:"hidden md:flex flex-1 justify-center",children:r.jsx(zNe,{})}),r.jsxs("div",{className:"flex items-center gap-3 ml-auto",children:[b&&!S&&k&&r.jsx(jpt,{expiresAt:k,className:"hidden lg:flex"}),r.jsx("div",{className:"md:hidden",children:r.jsx(zNe,{})}),P&&r.jsx(Npt,{hasUnseenBrief:I,onClick:z}),M&&r.jsxs(ee,{variant:"ghost",size:"icon",className:"relative",onClick:()=>ne("/marketplace/cart"),children:[r.jsx(Nh,{className:"h-5 w-5"}),J>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:J>99?"99+":J})]}),r.jsx(Zft,{}),r.jsx(bfe,{}),r.jsxs("span",{className:"hidden sm:block text-sm font-medium text-foreground",children:["Hello, ",((Te=(Je=n==null?void 0:n.user_metadata)==null?void 0:Je.name)==null?void 0:Te.split(" ")[0])||"User","!"]}),r.jsxs(Lh,{children:[r.jsx(Oh,{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(Qs,{className:"h-9 w-9 cursor-pointer hover:opacity-80 transition-opacity",children:[r.jsx(Si,{src:_||void 0}),r.jsx(Js,{className:"bg-primary text-primary-foreground font-medium text-sm",children:he(((De=n==null?void 0:n.user_metadata)==null?void 0:De.name)||(n==null?void 0:n.email)||"U")})]})})}),r.jsxs(ah,{align:"end",className:"w-48",children:[r.jsxs(ei,{onClick:()=>ne("/profile"),className:"cursor-pointer",children:[r.jsx(ic,{className:"h-4 w-4 mr-2"}),"Profile"]}),a&&r.jsxs(ei,{onClick:()=>ne("/mission-control/integrations"),className:"cursor-pointer",children:[r.jsx(mA,{className:"h-4 w-4 mr-2"}),"Integrations"]}),r.jsx(sk,{}),r.jsxs(ei,{onClick:s,className:"cursor-pointer text-destructive focus:text-destructive",children:[r.jsx(AS,{className:"h-4 w-4 mr-2"}),"Sign Out"]})]})]})]})]})}),r.jsx(qpt,{children:r.jsx("main",{className:"p-4 sm:p-6 lg:p-8 overflow-x-hidden",children:e})}),P&&r.jsx(Bpt,{brief:P,open:T,onClose:D,onDismiss:U}),r.jsx(Upt,{}),r.jsx(Hpt,{}),r.jsx(Gpt,{})]})]})})})},smt=()=>{const{user:e}=tn(),[t,n]=E.useState(!1),[s,a]=E.useState(null),[o,l]=E.useState(""),i=async y=>{var _;if(!(e!=null&&e.email)){Ie.error("Please sign in to upgrade");return}n(!0),a(y);try{const{data:b,error:S}=await Q.functions.invoke("create-checkout",{body:{tier:y,email:e.email,name:((_=e.user_metadata)==null?void 0:_.full_name)||e.email,couponCode:o.trim()||void 0,skipTrial:!0}});if(S)throw S;if(b!=null&&b.url)window.open(b.url,"_blank","noopener,noreferrer"),Ie.success("Checkout opened in a new tab");else throw new Error("No checkout URL returned")}catch(b){console.error("Checkout error:",b),Ie.error(b.message||"Failed to start checkout. Please try again.")}finally{n(!1),a(null)}},u=["Unlimited access to all marketing templates","Complete Academy training library","AI-powered tools and resources","Community forums and support","Exclusive member events and workshops","Deal pipeline & scorecard tracking","Listing exchange access","Social media content library"],p=["Everything in Individual plan","Up to 25 agent seats","Brokerage admin dashboard","Team performance analytics","Custom branding options","Priority support","Agent onboarding tools","Brokerage-wide announcements"],x=["Everything in Brokerage plan","Unlimited agent seats","Dedicated account manager","Advanced analytics & reporting","White-label options","API access","Custom integrations","Enterprise-level support"];return r.jsx(Dr,{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($e,{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(Ze,{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(Wt,{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(Un,{className:"h-7 w-7 text-primary"})}),r.jsx(Yt,{className:"text-xl",children:"Individual Agent"}),r.jsx(Sn,{children:"Perfect for solo agents ready to level up"})]}),r.jsxs(et,{className:"space-y-6",children:[r.jsxs("div",{className:"text-center",children:[r.jsx("span",{className:"text-4xl font-bold text-primary",children:"$39"}),r.jsx("span",{className:"text-muted-foreground",children:"/month"})]}),r.jsx("ul",{className:"space-y-2",children:u.map((y,_)=>r.jsxs("li",{className:"flex items-start gap-2 text-sm",children:[r.jsx(Ni,{className:"h-4 w-4 text-primary mt-0.5 shrink-0"}),r.jsx("span",{children:y})]},_))}),r.jsxs(ee,{className:"w-full",size:"lg",onClick:()=>i("individual_agent"),disabled:t,children:[t&&s==="individual_agent"?r.jsx(Zr,{className:"h-4 w-4 mr-2 animate-spin"}):r.jsx(Ls,{className:"h-4 w-4 mr-2"}),"Get Started"]})]})]}),r.jsxs(Ze,{className:"border-2 border-amber-500/20 hover:border-amber-500/50 transition-colors",children:[r.jsxs(Wt,{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(hi,{className:"h-7 w-7 text-amber-600"})}),r.jsx(Yt,{className:"text-xl",children:"Brokerage"}),r.jsx(Sn,{children:"For teams and brokerages up to 25 agents"})]}),r.jsxs(et,{className:"space-y-6",children:[r.jsxs("div",{className:"text-center",children:[r.jsx("span",{className:"text-4xl font-bold text-amber-600",children:"$299"}),r.jsx("span",{className:"text-muted-foreground",children:"/month"})]}),r.jsx("ul",{className:"space-y-2",children:p.map((y,_)=>r.jsxs("li",{className:"flex items-start gap-2 text-sm",children:[r.jsx(Ni,{className:"h-4 w-4 text-amber-600 mt-0.5 shrink-0"}),r.jsx("span",{children:y})]},_))}),r.jsxs(ee,{variant:"outline",className:"w-full border-amber-500 text-amber-600 hover:bg-amber-50",size:"lg",onClick:()=>i("brokerage_under_25"),disabled:t,children:[t&&s==="brokerage_under_25"?r.jsx(Zr,{className:"h-4 w-4 mr-2 animate-spin"}):r.jsx(hi,{className:"h-4 w-4 mr-2"}),"Get Started"]})]})]}),r.jsxs(Ze,{className:"border-2 border-purple-500/20 hover:border-purple-500/50 transition-colors",children:[r.jsxs(Wt,{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(hi,{className:"h-7 w-7 text-purple-600"})}),r.jsx(Yt,{className:"text-xl",children:"Brokerage 25+"}),r.jsx(Sn,{children:"For larger brokerages with 25+ agents"})]}),r.jsxs(et,{className:"space-y-6",children:[r.jsxs("div",{className:"text-center",children:[r.jsx("span",{className:"text-4xl font-bold text-purple-600",children:"$499"}),r.jsx("span",{className:"text-muted-foreground",children:"/month"})]}),r.jsx("ul",{className:"space-y-2",children:x.map((y,_)=>r.jsxs("li",{className:"flex items-start gap-2 text-sm",children:[r.jsx(Ni,{className:"h-4 w-4 text-purple-600 mt-0.5 shrink-0"}),r.jsx("span",{children:y})]},_))}),r.jsxs(ee,{variant:"outline",className:"w-full border-purple-500 text-purple-600 hover:bg-purple-50",size:"lg",onClick:()=>i("brokerage_over_25"),disabled:t,children:[t&&s==="brokerage_over_25"?r.jsx(Zr,{className:"h-4 w-4 mr-2 animate-spin"}):r.jsx(hi,{className:"h-4 w-4 mr-2"}),"Get Started"]})]})]})]}),r.jsx(Ze,{className:"bg-muted/50",children:r.jsxs(et,{className:"py-6",children:[r.jsx("p",{className:"text-center font-medium mb-4",children:"Questions? We're here to help!"}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 justify-center",children:[r.jsxs("a",{href:"tel:1-866-527-8668",className:"flex items-center justify-center gap-2 text-primary hover:underline",children:[r.jsx(Ti,{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(Ns,{className:"h-4 w-4"}),r.jsx("span",{children:"support@relevelup.com"})]})]})]})})]})})},amt=()=>{const{user:e,loading:t,isBrokerageManager:n,brokerageId:s}=tn(),a=Gn(),[o,l]=E.useState(""),[i,u]=E.useState(!1),[p,x]=E.useState(!1);E.useEffect(()=>{!t&&!e&&a("/auth")},[e,t,a]),E.useEffect(()=>{!t&&e&&s&&a("/profile?setup=true")},[e,t,s,a]);const y=async()=>{if(!o.trim()){Ie.error("Please enter a brokerage name");return}const{data:_}=await Q.auth.getSession(),b=_.session;if(!e||!b){Ie.error("Please sign in again to create your brokerage."),a("/auth");return}u(!0);try{console.log("[SetupBrokerage] Creating brokerage…",{hasUser:!!e,hasSession:!!b,userId:e==null?void 0:e.id});const{data:S,error:k}=await Q.functions.invoke("create-brokerage",{body:{name:o.trim()}});if(console.log("[SetupBrokerage] create-brokerage response",{data:S,error:k}),k)throw k;if(!(S!=null&&S.ok))throw new Error((S==null?void 0:S.error)||"Failed to create brokerage");u(!1),x(!0),Ie.success("Brokerage created! Setting up your account..."),setTimeout(()=>{a("/profile?setup=true")},2e3)}catch(S){console.error("Error creating brokerage:",S),Ie.error(S.message||"Failed to create brokerage"),u(!1)}};return t?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(Ze,{className:"max-w-lg w-full",children:[r.jsxs(Wt,{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(Zr,{className:"w-10 h-10 text-primary animate-spin"})}),r.jsx(Yt,{className:"text-2xl",children:"Setting Up Your Brokerage"}),r.jsx(Sn,{className:"text-lg",children:"We're assigning you as the brokerage manager and preparing your dashboard..."})]}),r.jsxs(et,{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-center gap-2 text-muted-foreground",children:[r.jsx(di,{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(Zr,{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(Ze,{className:"max-w-lg w-full",children:[r.jsxs(Wt,{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(hi,{className:"w-10 h-10 text-primary"})}),r.jsx(Yt,{className:"text-2xl",children:"Set Up Your Brokerage"}),r.jsx(Sn,{className:"text-lg",children:"Create your brokerage to start managing your team"})]}),r.jsxs(et,{className:"space-y-6",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{htmlFor:"brokerage-name",children:"Brokerage Name"}),r.jsx(dt,{id:"brokerage-name",placeholder:"Enter your brokerage name",value:o,onChange:_=>l(_.target.value),onKeyDown:_=>_.key==="Enter"&&y()}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"This is how your brokerage will appear to your agents"})]}),r.jsxs("div",{className:"p-4 rounded-lg bg-muted/50 space-y-3",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2",children:[r.jsx(Un,{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(di,{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(di,{className:"w-4 h-4 text-green-500"}),"Access exclusive brokerage resources"]}),r.jsxs("li",{className:"flex items-center gap-2",children:[r.jsx(di,{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(di,{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(Vo,{className:"w-4 h-4 ml-2"})]})]})]})})},qNe=()=>{const e=Gn(),[t,n]=E.useState("verifying"),[s,a]=E.useState("");E.useEffect(()=>{(async()=>{try{const{data:{session:i},error:u}=await Q.auth.getSession();if(u)throw u;if(i!=null&&i.user){const{data:p}=await Q.from("profiles").select("login_count").eq("id",i.user.id).single();if(((p==null?void 0:p.login_count)||0)>1){console.log("Account already claimed, redirecting to dashboard"),n("already_claimed");return}console.log("User logged in successfully:",i.user.email),n("success");try{await Q.functions.invoke("trial-claim-hook",{body:{userId:i.user.id}})}catch(x){console.log("Trial claim hook (non-critical):",x)}setTimeout(()=>{e("/profile?setup=true")},1500)}else setTimeout(()=>{n("already_claimed")},2e3)}catch(i){console.error("Claim error:",i),n("already_claimed")}})()},[e]);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(Ze,{className:"w-full max-w-md",children:[r.jsxs(Wt,{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:[t==="verifying"&&r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"}),t==="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"})}),t==="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"})}),t==="error"&&r.jsx("svg",{className:"h-8 w-8 text-destructive",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})]}),r.jsxs(Yt,{className:"text-2xl",children:[t==="verifying"&&"Claiming Your Account...",t==="success"&&"Account Claimed!",t==="already_claimed"&&"Account Already Claimed",t==="error"&&"Claim Failed"]}),r.jsxs(Sn,{children:[t==="verifying"&&"Please wait while we verify your account...",t==="success"&&"Redirecting you to complete your profile...",t==="already_claimed"&&"This account has already been set up. Please log in to access your dashboard.",t==="error"&&s]})]}),(t==="already_claimed"||t==="error")&&r.jsx(et,{children:r.jsx(ee,{onClick:o,className:"w-full",children:"Go to Login"})})]})})},imt=()=>{const e=Gn(),[t]=Gc(),[n,s]=E.useState(t.get("code")||""),[a,o]=E.useState(""),[l,i]=E.useState(""),[u,p]=E.useState(""),[x,y]=E.useState(!1),[_,b]=E.useState(!1),[S,k]=E.useState(!1),[M,P]=E.useState(!1),[T,I]=E.useState(null),[z,D]=E.useState(null),[U,V]=E.useState(null),[W,G]=E.useState(null);E.useEffect(()=>{const ge=t.get("code");ge&&(s(ge),J(ge))},[t]);const J=async ge=>{k(!0);const{data:ie,error:pe}=await Q.from("invite_codes").select("id, code, max_uses, uses_count, expires_at, is_active, brokerage_id, trial_days").eq("code",ge.toUpperCase().trim()).single();if(pe||!ie){Ie.error("Invalid invite code"),k(!1);return}if(!ie.is_active){Ie.error("This invite code is no longer active"),k(!1);return}if(ie.max_uses&&ie.uses_count>=ie.max_uses){Ie.error("This invite code has reached its maximum uses"),k(!1);return}if(ie.expires_at&&new Date(ie.expires_at){ge.preventDefault(),J(n)},oe=async ge=>{var ie;if(ge.preventDefault(),!u.trim()){Ie.error("Please enter your name");return}if(l.length<6){Ie.error("Password must be at least 6 characters");return}b(!0);try{const pe=`${window.location.origin}/`,{data:se,error:fe}=await Q.auth.signUp({email:a.trim(),password:l,options:{emailRedirectTo:pe,data:{name:u.trim()}}});if(fe){fe.message.includes("already registered")?Ie.error("This email is already registered. Please sign in instead."):Ie.error(fe.message);return}se.user&&(await Q.rpc("add_default_signup_tag",{user_id:se.user.id}),z?await Q.functions.invoke("assign-brokerage",{body:{userId:se.user.id,brokerageId:z}}):W?await Q.functions.invoke("assign-brokerage",{body:{userId:se.user.id,trialDays:W}}):await Q.functions.invoke("assign-brokerage",{body:{userId:se.user.id,grandfathered:!0}}),T&&await Q.from("invite_codes").update({uses_count:((ie=(await Q.from("invite_codes").select("uses_count").eq("id",T).single()).data)==null?void 0:ie.uses_count)+1}).eq("id",T),Ie.success("Account created! You can now access the dashboard."),e("/dashboard"))}catch(pe){console.error("Signup error:",pe),Ie.error("An unexpected error occurred")}finally{b(!1)}};return r.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background p-4",children:r.jsxs(Ze,{className:"w-full max-w-md",children:[r.jsxs(Wt,{className:"text-center",children:[r.jsx(Yt,{className:"text-2xl font-bold text-primary",children:U?`Join ${U}`:"Join LevelUp"}),r.jsx(Sn,{children:M?U?`Create your account to join ${U}`:"Create your account to get started":"Enter your invite code to continue"})]}),r.jsx(et,{children:M?r.jsxs("form",{onSubmit:oe,className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{htmlFor:"name",children:"Full Name"}),r.jsx(dt,{id:"name",type:"text",placeholder:"John Doe",value:u,onChange:ge=>p(ge.target.value),required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{htmlFor:"email",children:"Email"}),r.jsx(dt,{id:"email",type:"email",placeholder:"you@example.com",value:a,onChange:ge=>o(ge.target.value),required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{htmlFor:"password",children:"Password"}),r.jsxs("div",{className:"relative",children:[r.jsx(dt,{id:"password",type:x?"text":"password",placeholder:"••••••••",value:l,onChange:ge=>i(ge.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($1,{className:"h-4 w-4"}):r.jsx(Ko,{className:"h-4 w-4"})})]})]}),r.jsx(ee,{type:"submit",className:"w-full",disabled:_,children:_?r.jsxs(r.Fragment,{children:[r.jsx(Zr,{className:"mr-2 h-4 w-4 animate-spin"}),"Creating Account..."]}):"Create Account"})]}):r.jsxs("form",{onSubmit:ne,className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{htmlFor:"inviteCode",children:"Invite Code"}),r.jsx(dt,{id:"inviteCode",type:"text",placeholder:"Enter your invite code",value:n,onChange:ge=>s(ge.target.value),required:!0,autoFocus:!0})]}),r.jsx(ee,{type:"submit",className:"w-full",disabled:S,children:S?r.jsxs(r.Fragment,{children:[r.jsx(Zr,{className:"mr-2 h-4 w-4 animate-spin"}),"Verifying..."]}):"Verify Code"})]})})]})})},omt="/assets/testimonial-avatar-1-BsCQFauB.jpg",lmt="/assets/testimonial-avatar-2-B6VPVc2t.jpg",cmt="/assets/testimonial-avatar-3-GuEFwYUE.jpg",dmt="/assets/testimonial-avatar-4-98iKMtkB.jpg",umt="/assets/testimonial-avatar-5-ZsZfyxMX.jpg",hmt=[omt,lmt,cmt,dmt,umt],fmt=E3({name:xc().trim().min(2,"Name must be at least 2 characters").max(100),email:xc().trim().email("Please enter a valid email address").max(255),phone:xc().trim().min(10,"Please enter a valid phone number").max(20).optional().or(cNe("")),brokerage:xc().trim().max(200).optional().or(cNe(""))}),pmt=[{icon:rp,title:"Academy Training",description:"Access a library of on-demand video training covering lead generation, marketing, technology, and more."},{icon:Uc,title:"300+ Templates",description:"Professional Canva templates for social media, flyers, postcards, and marketing materials."},{icon:Ss,title:"Live Events",description:"Weekly live training sessions, workshops, and Q&A events with industry experts."},{icon:Ul,title:"Agent Community",description:"Connect with fellow agents, share wins, ask questions, and network in our private community."},{icon:Ea,title:"Resource Kits",description:"Downloadable toolkits with scripts, checklists, guides, and everything you need to close more deals."},{icon:to,title:"Social Swag",description:"Fresh social media content and designs updated regularly to help you stand out online."}],mmt=[{icon:Un,title:"Contact Management",description:"Organize your sphere into relationship tiers—Top 25, Past Clients, Referral Partners, and more."},{icon:Ls,title:"Smart TouchPlans",description:"Automated action plans that tell you exactly who to contact and how, based on relationship type."},{icon:Ti,title:"One-Tap Actions",description:"Call, text, or email contacts directly with pre-written scripts tailored to each relationship."},{icon:hf,title:"Birthday Alerts",description:"Never miss an important date—get reminders for birthdays and home anniversaries."},{icon:Po,title:"Pop-by Map",description:"See all your contacts on a map and plan efficient pop-by routes in your area."},{icon:_c,title:"Momentum Tracking",description:"Track your touch streaks, weekly goals, and relationship health scores."},{icon:xi,title:"Relationship Health",description:"Visual dashboard showing which contacts need attention based on last touch date."},{icon:Bg,title:"Daily Action Cards",description:"Wake up to a prioritized list of exactly who to reach out to today."}],gmt=[{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."}],xmt=()=>{const e=Gn(),[t,n]=E.useState(!1),[s,a]=E.useState({name:"",email:"",phone:"",brokerage:""}),[o,l]=E.useState({}),i=async u=>{var x,y;u.preventDefault(),l({});const p=fmt.safeParse(s);if(!p.success){const _={};p.error.errors.forEach(b=>{b.path[0]&&(_[b.path[0]]=b.message)}),l(_);return}n(!0);try{const{data:_,error:b}=await Q.functions.invoke("create-trial-signup",{body:{name:s.name.trim(),email:s.email.trim().toLowerCase(),phone:((x=s.phone)==null?void 0:x.trim())||void 0,brokerage:((y=s.brokerage)==null?void 0:y.trim())||void 0}});if(b){console.error("Trial signup error:",b),Ie.error(b.message||"Something went wrong. Please try again.");return}if(_!=null&&_.error){Ie.error(_.error);return}Ie.success("🎉 Welcome aboard! Check your email to claim your account."),e("/trial/success")}catch(_){console.error("Trial signup error:",_),Ie.error("Something went wrong. Please try again.")}finally{n(!1)}};return r.jsxs(r.Fragment,{children:[r.jsxs($m,{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:qte,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 u;return(u=document.getElementById("features"))==null?void 0:u.scrollIntoView({behavior:"smooth"})},children:"Features"}),r.jsx(ee,{onClick:()=>e("/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(Ls,{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(so,{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(so,{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:hmt.map((u,p)=>r.jsx("img",{src:u,alt:`Agent ${p+1}`,className:"w-10 h-10 rounded-full border-2 border-white/20 object-cover"},p))}),r.jsxs("div",{children:[r.jsx("div",{className:"flex gap-0.5",children:[1,2,3,4,5].map(u=>r.jsx(js,{className:"h-4 w-4 fill-yellow-400 text-yellow-400"},u))}),r.jsx("p",{className:"text-sm text-white/60",children:"Trusted by 3,000+ agents"})]})]})]}),r.jsx("div",{className:"lg:pl-8",children:r.jsx(Ze,{className:"bg-white shadow-2xl border-0",children:r.jsxs(et,{className:"p-8",children:[r.jsxs("div",{className:"text-center mb-8",children:[r.jsx("div",{className:"inline-flex items-center justify-center w-16 h-16 rounded-full bg-[#4a6b6d] mb-4",children:r.jsx(Dg,{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($e,{htmlFor:"name",children:"Full Name *"}),r.jsx(dt,{id:"name",type:"text",placeholder:"John Smith",value:s.name,onChange:u=>a({...s,name:u.target.value}),required:!0}),o.name&&r.jsx("p",{className:"text-sm text-destructive",children:o.name})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{htmlFor:"email",children:"Email Address *"}),r.jsx(dt,{id:"email",type:"email",placeholder:"john@example.com",value:s.email,onChange:u=>a({...s,email:u.target.value}),required:!0}),o.email&&r.jsx("p",{className:"text-sm text-destructive",children:o.email})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{htmlFor:"phone",children:"Phone Number"}),r.jsx(dt,{id:"phone",type:"tel",placeholder:"(555) 123-4567",value:s.phone,onChange:u=>a({...s,phone:u.target.value})}),o.phone&&r.jsx("p",{className:"text-sm text-destructive",children:o.phone})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{htmlFor:"brokerage",children:"Brokerage Name"}),r.jsx(dt,{id:"brokerage",type:"text",placeholder:"Your brokerage or team name",value:s.brokerage,onChange:u=>a({...s,brokerage:u.target.value})}),o.brokerage&&r.jsx("p",{className:"text-sm text-destructive",children:o.brokerage})]}),r.jsx(ee,{type:"submit",className:"w-full h-12 text-lg font-semibold bg-[#4a6b6d] hover:bg-[#3d5a5c]",disabled:t,children:t?r.jsxs(r.Fragment,{children:[r.jsx(Zr,{className:"mr-2 h-5 w-5 animate-spin"}),"Creating Your Account..."]}):r.jsxs(r.Fragment,{children:["Start My Free Trial",r.jsx(Vo,{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:pmt.map((u,p)=>r.jsxs(Ze,{className:"group relative overflow-hidden border hover:border-[#4a6b6d]/50 transition-all duration-300 hover:shadow-lg bg-background",children:[r.jsxs(Wt,{children:[r.jsx("div",{className:"w-14 h-14 rounded-2xl bg-[#4a6b6d]/10 flex items-center justify-center mb-4",children:r.jsx(u.icon,{className:"w-7 h-7 text-[#4a6b6d]"})}),r.jsx(Yt,{className:"text-xl font-sans",children:u.title})]}),r.jsx(et,{children:r.jsx("p",{className:"text-muted-foreground leading-relaxed",children:u.description})})]},p))})]})}),r.jsxs("section",{className:"py-20 bg-gradient-to-br from-[#4a6b6d] to-[#3d5a5c] relative overflow-hidden",children:[r.jsx("div",{className:"absolute inset-0 opacity-10",children:r.jsx("div",{className:"absolute inset-0 bg-[url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNjAiIGhlaWdodD0iNjAiIHZpZXdCb3g9IjAgMCA2MCA2MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxnIGZpbGw9IiNmZmZmZmYiIGZpbGwtb3BhY2l0eT0iMC40Ij48cGF0aCBkPSJNMzYgMzRoLTJ2LTRoMnY0em0wLTZ2LTRoLTJ2NGgyem0tNiA2aC0ydi00aDJ2NHptMC02di00aC0ydjRoMnoiLz48L2c+PC9nPjwvc3ZnPg==')]"})}),r.jsxs("div",{className:"container mx-auto px-4 relative",children:[r.jsxs("div",{className:"text-center max-w-3xl mx-auto mb-16",children:[r.jsxs("div",{className:"inline-flex items-center gap-2 px-4 py-2 rounded-full bg-white/10 text-white text-sm font-medium mb-6",children:[r.jsx(Ls,{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:mmt.map((u,p)=>r.jsxs(Ze,{className:"group relative overflow-hidden border-0 bg-white/10 backdrop-blur-sm hover:bg-white/20 transition-all duration-300",children:[r.jsxs(Wt,{className:"pb-3",children:[r.jsx("div",{className:"w-12 h-12 rounded-xl bg-white/20 flex items-center justify-center mb-3",children:r.jsx(u.icon,{className:"w-6 h-6 text-white"})}),r.jsx(Yt,{className:"text-lg font-semibold text-white",children:u.title})]}),r.jsx(et,{children:r.jsx("p",{className:"text-white/70 text-sm leading-relaxed",children:u.description})})]},p))})]})]}),r.jsx("section",{className:"py-20 bg-background",children:r.jsxs("div",{className:"container mx-auto px-4",children:[r.jsxs("div",{className:"text-center mb-16",children:[r.jsx("h2",{className:"text-3xl md:text-4xl font-bold mb-4 font-sans",children:"Loved by Top Producers"}),r.jsx("p",{className:"text-lg text-muted-foreground",children:"See what agents are saying about LevelUp"})]}),r.jsx("div",{className:"grid md:grid-cols-3 gap-8 max-w-5xl mx-auto",children:gmt.map((u,p)=>r.jsx(Ze,{className:"border hover:shadow-lg transition-shadow",children:r.jsxs(et,{className:"p-6",children:[r.jsx("div",{className:"flex gap-1 mb-4",children:[1,2,3,4,5].map(x=>r.jsx(js,{className:"h-4 w-4 fill-yellow-400 text-yellow-400"},x))}),r.jsxs("p",{className:"text-muted-foreground mb-4 italic",children:['"',u.quote,'"']}),r.jsxs("div",{children:[r.jsx("p",{className:"font-semibold",children:u.name}),r.jsx("p",{className:"text-sm text-muted-foreground",children:u.role})]})]})},p))})]})}),r.jsx("section",{className:"py-16 bg-muted/30",children:r.jsx("div",{className:"container mx-auto px-4",children:r.jsxs("div",{className:"flex flex-wrap justify-center gap-8 md:gap-16",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"w-12 h-12 rounded-full bg-[#4a6b6d]/10 flex items-center justify-center",children:r.jsx(yf,{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(Bg,{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(Un,{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(Ze,{className:"bg-gradient-to-br from-[#1e3a4c] via-[#2a4f5f] to-[#3d6b6b] border-0 shadow-2xl overflow-hidden relative",children:[r.jsx("div",{className:"absolute inset-0 opacity-10",children:r.jsx("div",{className:"absolute inset-0 bg-[url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNjAiIGhlaWdodD0iNjAiIHZpZXdCb3g9IjAgMCA2MCA2MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxnIGZpbGw9IiNmZmZmZmYiIGZpbGwtb3BhY2l0eT0iMC40Ij48cGF0aCBkPSJNMzYgMzRoLTJ2LTRoMnY0em0wLTZ2LTRoLTJ2NGgyem0tNiA2aC0ydi00aDJ2NHptMC02di00aC0ydjRoMnoiLz48L2c+PC9nPjwvc3ZnPg==')]"})}),r.jsxs(et,{className:"p-12 text-center relative",children:[r.jsx("h2",{className:"text-3xl md:text-4xl font-bold text-white mb-4 font-sans",children:"Ready to Level Up Your Business?"}),r.jsx("p",{className:"text-xl text-white/80 mb-8 max-w-2xl mx-auto",children:"Join thousands of successful agents. Start your free 7-day trial today."}),r.jsxs(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(Vo,{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:Yxe,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."})]})})})]})]})},ymt=()=>{const e=Gn();return r.jsxs(r.Fragment,{children:[r.jsx($m,{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:qte,alt:"LevelUp",className:"h-8 md:h-10"})}),r.jsx(ee,{onClick:()=>e("/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(Ze,{className:"max-w-lg w-full bg-white shadow-2xl border-0",children:r.jsxs(et,{className:"p-8 md:p-12 text-center",children:[r.jsxs("div",{className:"relative inline-block mb-8",children:[r.jsx("div",{className:"w-24 h-24 rounded-full bg-gradient-to-br from-[#4a6b6d] to-[#3d5a5c] flex items-center justify-center",children:r.jsx(so,{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(qc,{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(Ns,{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:()=>e("/trial"),className:"text-[#4a6b6d] hover:underline font-medium",children:"try again"})]}),r.jsxs(ee,{onClick:()=>e("/auth"),className:"bg-[#4a6b6d] hover:bg-[#3d5a5c]",children:["Go to Sign In",r.jsx(Vo,{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:Yxe,alt:"LevelUp",className:"h-8"}),r.jsxs("p",{className:"text-sm text-white/40",children:["© ",new Date().getFullYear()," LevelUp Consulting Group. All rights reserved."]})]})})})]})]})},vmt=E3({viewerName:xc().min(1,"Name is required").max(100,"Name must be less than 100 characters"),viewerEmail:xc().email("Please enter a valid email").max(255,"Email must be less than 255 characters"),viewerPhone:xc().max(20,"Phone must be less than 20 characters").optional(),message:xc().min(1,"Message is required").max(1e3,"Message must be less than 1000 characters")});function _mt({shareToken:e,agentName:t,hasContact:n}){const[s,a]=E.useState(!1),[o,l]=E.useState(!1),[i,u]=E.useState(null),p=Qse({resolver:Jse(vmt),defaultValues:{viewerName:"",viewerEmail:"",viewerPhone:"",message:""}}),x=async y=>{a(!0),u(null);try{const{data:_,error:b}=await Q.functions.invoke("video-reply-notify",{body:{shareToken:e,viewerName:y.viewerName,viewerEmail:y.viewerEmail,viewerPhone:y.viewerPhone||void 0,message:y.message}});if(b)throw new Error(b.message);if(!(_!=null&&_.success))throw new Error((_==null?void 0:_.error)||"Failed to send reply");l(!0)}catch(_){console.error("Failed to submit reply:",_),u(_.message||"Something went wrong. Please try again.")}finally{a(!1)}};return o?r.jsx(Ze,{className:"border-2 border-primary/20 bg-gradient-to-br from-primary/5 to-primary/10",children:r.jsxs(et,{className:"py-8 text-center",children:[r.jsx("div",{className:"inline-flex items-center justify-center w-16 h-16 rounded-full bg-primary/20 mb-4",children:r.jsx(so,{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:[t?`${t} will`:"They'll"," get back to you soon."]})]})}):r.jsxs(Ze,{children:[r.jsxs(Wt,{className:"pb-4",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[r.jsx(Ul,{className:"h-5 w-5 text-primary"}),r.jsx(Yt,{className:"text-lg",children:"Reply to this video"})]}),r.jsx(Sn,{children:n?`Have a question or want to connect? Send ${t||"them"} a message.`:`Interested? Share your info and ${t||"your agent"} will be in touch.`})]}),r.jsx(et,{children:r.jsx(eae,{...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(Ll,{control:p.control,name:"viewerName",render:({field:y})=>r.jsxs(Nl,{children:[r.jsx(Sl,{children:"Your Name *"}),r.jsx(Cl,{children:r.jsx(dt,{placeholder:"John Smith",...y})}),r.jsx(Wu,{})]})}),r.jsx(Ll,{control:p.control,name:"viewerEmail",render:({field:y})=>r.jsxs(Nl,{children:[r.jsx(Sl,{children:"Email *"}),r.jsx(Cl,{children:r.jsx(dt,{type:"email",placeholder:"john@example.com",...y})}),r.jsx(Wu,{})]})})]}),!n&&r.jsx(Ll,{control:p.control,name:"viewerPhone",render:({field:y})=>r.jsxs(Nl,{children:[r.jsx(Sl,{children:"Phone (optional)"}),r.jsx(Cl,{children:r.jsx(dt,{type:"tel",placeholder:"(555) 123-4567",...y})}),r.jsx(Wu,{})]})}),r.jsx(Ll,{control:p.control,name:"message",render:({field:y})=>r.jsxs(Nl,{children:[r.jsx(Sl,{children:"Message *"}),r.jsx(Cl,{children:r.jsx(Jn,{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(Wu,{})]})}),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(Zr,{className:"h-4 w-4 animate-spin"}),"Sending..."]}):r.jsxs(r.Fragment,{children:[r.jsx(lo,{className:"h-4 w-4"}),"Send Message"]})})]})})})]})}const bmt=()=>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(js,{className:"absolute top-[5%] left-[8%] w-6 h-6 text-blue-600/30 fill-blue-600/20"}),r.jsx(js,{className:"absolute top-[15%] left-[20%] w-4 h-4 text-blue-600/25 fill-blue-600/15"}),r.jsx(js,{className:"absolute top-[8%] left-[28%] w-5 h-5 text-blue-600/30 fill-blue-600/20"}),r.jsx(js,{className:"absolute top-[25%] left-[12%] w-4 h-4 text-blue-600/20 fill-blue-600/10"}),r.jsx(js,{className:"absolute top-[20%] right-[15%] w-5 h-5 text-red-500/25 fill-red-500/15 animate-pulse"}),r.jsx(ly,{className:"absolute bottom-[20%] right-[10%] w-12 h-12 text-blue-600/15 rotate-12"})]}),wmt=()=>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(Ls,{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(js,{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(Ls,{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(js,{className:"absolute bottom-[25%] left-[10%] w-6 h-6 text-blue-500/25 fill-blue-500/15 animate-pulse"}),r.jsx(js,{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(ly,{className:"absolute top-[8%] left-[5%] w-10 h-10 text-red-500/20 rotate-12"})]}),jmt=()=>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(vm,{className:"w-20 h-20 text-pink-400 rotate-12"})}),r.jsx("div",{className:"absolute top-[2%] right-[8%] opacity-15",children:r.jsx(vm,{className:"w-16 h-16 text-rose-400 -rotate-12"})}),r.jsx("div",{className:"absolute bottom-[15%] left-[8%] opacity-15",children:r.jsx(vm,{className:"w-14 h-14 text-purple-400 rotate-45"})}),r.jsx("div",{className:"absolute bottom-[20%] right-[5%] opacity-20",children:r.jsx(vm,{className:"w-16 h-16 text-pink-300 -rotate-6"})}),r.jsx(xi,{className:"absolute top-[15%] left-[30%] w-5 h-5 text-rose-300/40 fill-rose-300/20 animate-pulse"}),r.jsx(xi,{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(xi,{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"})]}),kmt=()=>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(zl,{className:"absolute top-[8%] left-[12%] w-12 h-12 text-blue-600/15"}),r.jsx(js,{className:"absolute top-[15%] left-[22%] w-5 h-5 text-amber-500/25 fill-amber-500/15"}),r.jsx(zl,{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(js,{className:"absolute bottom-[25%] left-[15%] w-6 h-6 text-blue-500/20 fill-blue-500/10 animate-pulse"}),r.jsx(js,{className:"absolute top-[20%] right-[22%] w-5 h-5 text-indigo-400/20 fill-indigo-400/10 animate-pulse",style:{animationDelay:"0.5s"}})]}),Nmt=()=>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(vm,{className:"absolute top-[20%] left-[32%] w-7 h-7 text-purple-400/30"}),r.jsx(vm,{className:"absolute top-[12%] right-[28%] w-6 h-6 text-pink-400/30"}),r.jsx(bS,{className:"absolute top-[18%] left-[52%] w-5 h-5 text-sky-400/35"})]}),Smt=()=>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(Ls,{className:"absolute top-[8%] left-[55%] w-6 h-6 text-purple-400/35 animate-pulse"}),r.jsx(Ls,{className:"absolute bottom-[28%] right-[25%] w-5 h-5 text-orange-400/30 animate-pulse",style:{animationDelay:"0.5s"}})]}),Cmt=()=>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(Y1,{className:"absolute bottom-[8%] left-[5%] w-20 h-20 text-green-600/18"}),r.jsx(Y1,{className:"absolute bottom-[12%] right-[8%] w-16 h-16 text-emerald-600/15"}),r.jsx(Y1,{className:"absolute bottom-[10%] left-[28%] w-12 h-12 text-green-500/12"}),r.jsx(j1,{className:"absolute top-[5%] left-[15%] w-10 h-10 text-sky-300/30 animate-pulse"}),r.jsx(j1,{className:"absolute top-[10%] right-[20%] w-8 h-8 text-blue-300/25 animate-pulse",style:{animationDelay:"0.3s"}}),r.jsx(j1,{className:"absolute top-[18%] left-[45%] w-6 h-6 text-sky-200/25 animate-pulse",style:{animationDelay:"0.6s"}}),r.jsx(j1,{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(js,{className:"absolute top-[3%] left-[50%] -translate-x-1/2 w-10 h-10 text-amber-400/35 fill-amber-400/25"})]}),Mmt=()=>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(xi,{className:"absolute top-[8%] left-[55%] w-6 h-6 text-red-400/22 fill-red-400/12"}),r.jsx(xi,{className:"absolute top-[20%] right-[25%] w-5 h-5 text-orange-400/22 fill-orange-400/12"})]}),Tmt=()=>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(js,{className:"absolute top-[5%] left-[15%] w-12 h-12 text-yellow-400/35 fill-yellow-400/25 animate-pulse"}),r.jsx(js,{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(js,{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(js,{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(Ls,{className:"absolute top-[3%] left-[50%] w-10 h-10 text-yellow-400/40"}),r.jsx(qc,{className:"absolute bottom-[18%] left-[10%] w-12 h-12 text-purple-400/18 rotate-12"}),r.jsx(qc,{className:"absolute bottom-[20%] right-[12%] w-10 h-10 text-amber-400/15 -rotate-12"})]}),Amt=()=>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(js,{className:"absolute top-[8%] left-[50%] -translate-x-1/2 w-14 h-14 text-yellow-400/28 fill-yellow-400/18"}),r.jsx(Ls,{className:"absolute top-[5%] left-[20%] w-7 h-7 text-blue-400/35"}),r.jsx(Ls,{className:"absolute top-[10%] right-[18%] w-6 h-6 text-sky-400/30"})]}),Emt=()=>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(Jx,{className:"absolute top-[5%] left-[10%] w-16 h-16 text-green-500/25"}),r.jsx(Jx,{className:"absolute top-[8%] right-[12%] w-12 h-12 text-emerald-500/20"}),r.jsx(Jx,{className:"absolute bottom-[18%] left-[12%] w-14 h-14 text-green-400/22"}),r.jsx(Jx,{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"})]})]})]}),Imt=()=>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(js,{className:"absolute top-[5%] left-[42%] w-10 h-10 text-amber-400/30 fill-amber-400/20"}),r.jsx(js,{className:"absolute top-[15%] right-[25%] w-7 h-7 text-yellow-400/25 fill-yellow-400/15"}),r.jsx(zl,{className:"absolute bottom-[20%] right-[12%] w-12 h-12 text-blue-500/18"}),r.jsx(zl,{className:"absolute top-[18%] left-[28%] w-8 h-8 text-indigo-400/15"}),r.jsx(ly,{className:"absolute top-[8%] left-[60%] w-10 h-10 text-indigo-400/18"})]}),Pmt=()=>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(hf,{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(qc,{className:"absolute top-[8%] left-[45%] w-10 h-10 text-purple-400/22 rotate-12"}),r.jsx(to,{className:"absolute bottom-[18%] right-[15%] w-12 h-12 text-rose-400/18"})]}),Lmt=()=>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(xi,{className:"absolute top-[5%] left-[10%] w-16 h-16 text-rose-400/28 fill-rose-400/18"}),r.jsx(xi,{className:"absolute top-[8%] right-[12%] w-14 h-14 text-pink-400/25 fill-pink-400/15"}),r.jsx(xi,{className:"absolute bottom-[15%] left-[12%] w-12 h-12 text-red-400/22 fill-red-400/12"}),r.jsx(xi,{className:"absolute bottom-[18%] right-[10%] w-13 h-13 text-rose-300/25 fill-rose-300/15"}),r.jsx(xi,{className:"absolute top-[15%] left-[30%] w-6 h-6 text-pink-300/35 fill-pink-300/20 animate-pulse"}),r.jsx(xi,{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(xi,{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(xi,{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"})]}),Omt=()=>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(Z1,{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(Z1,{className:"absolute top-[15%] left-[18%] w-10 h-10 text-yellow-400/30"}),r.jsx(Ls,{className:"absolute top-[10%] left-[42%] w-7 h-7 text-amber-400/35"}),r.jsx(Z1,{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"})]}),Dmt=()=>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(xa,{className:"absolute top-[8%] left-[10%] w-14 h-14 text-teal-500/22"}),r.jsx(xa,{className:"absolute bottom-[15%] right-[8%] w-16 h-16 text-emerald-500/18"}),r.jsx(pf,{className:"absolute top-[12%] right-[18%] w-10 h-10 text-amber-400/25"}),r.jsx(pf,{className:"absolute bottom-[22%] left-[22%] w-8 h-8 text-yellow-400/22"}),r.jsx(xi,{className:"absolute top-[18%] left-[40%] w-6 h-6 text-rose-400/22 fill-rose-400/12"}),r.jsx(xi,{className:"absolute top-[22%] right-[35%] w-5 h-5 text-teal-400/20 fill-teal-400/10"}),r.jsx(Ls,{className:"absolute top-[5%] left-[55%] w-8 h-8 text-teal-400/30"}),r.jsx(qc,{className:"absolute bottom-[20%] left-[48%] w-10 h-10 text-cyan-400/18 rotate-12"})]}),Rmt=()=>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(qc,{className:"absolute top-[5%] left-[12%] w-14 h-14 text-emerald-400/25 rotate-12"}),r.jsx(qc,{className:"absolute top-[8%] right-[10%] w-12 h-12 text-teal-400/22 -rotate-12"}),r.jsx(pf,{className:"absolute bottom-[18%] left-[18%] w-12 h-12 text-amber-400/25"}),r.jsx(xa,{className:"absolute bottom-[15%] right-[12%] w-14 h-14 text-teal-500/18"}),r.jsx(Ls,{className:"absolute top-[15%] left-[42%] w-10 h-10 text-emerald-400/35"}),r.jsx(Ls,{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"})]}),Fmt=()=>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(pf,{className:"absolute bottom-[12%] left-[50%] -translate-x-1/2 w-24 h-24 text-amber-400/25 rotate-45"}),r.jsx(pf,{className:"absolute top-[10%] left-[12%] w-10 h-10 text-yellow-400/30"}),r.jsx(pf,{className:"absolute top-[12%] right-[15%] w-9 h-9 text-amber-300/25"}),r.jsx(xa,{className:"absolute top-[8%] left-[42%] w-12 h-12 text-teal-500/18"}),r.jsx(qc,{className:"absolute bottom-[22%] right-[18%] w-12 h-12 text-orange-400/18 rotate-12"}),r.jsx(Ls,{className:"absolute top-[5%] right-[35%] w-8 h-8 text-yellow-400/35"}),r.jsx(js,{className:"absolute top-[18%] left-[28%] w-6 h-6 text-amber-400/25 fill-amber-400/15"})]}),zmt=()=>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(xa,{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(pf,{className:"absolute top-[10%] right-[12%] w-10 h-10 text-amber-400/28"}),r.jsx(xi,{className:"absolute top-[8%] left-[18%] w-8 h-8 text-rose-400/25 fill-rose-400/15"}),r.jsx(Ls,{className:"absolute top-[12%] left-[45%] w-8 h-8 text-teal-400/30"}),r.jsx(Ej,{className:"absolute top-[15%] right-[28%] w-10 h-10 text-emerald-400/20"})]}),VNe=()=>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"})]}),Bmt=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx(xi,{className:"absolute top-6 left-[12%] w-4 h-4 text-rose-300/50 fill-rose-300/30 animate-pulse"}),r.jsx(xi,{className:"absolute top-10 right-[18%] w-3 h-3 text-pink-300/50 fill-pink-300/30 animate-pulse delay-150"}),r.jsx(xi,{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(xi,{className:"absolute top-14 right-[35%] w-3.5 h-3.5 text-pink-300/40 fill-pink-300/20 animate-pulse delay-200"})]}),$mt=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx(Ej,{className:"absolute top-5 left-[10%] w-4 h-4 text-blue-400/50 animate-pulse"}),r.jsx(Ls,{className:"absolute top-10 right-[15%] w-3 h-3 text-amber-400/50 animate-pulse delay-100"}),r.jsx(xa,{className:"absolute top-8 left-[38%] w-3 h-3 text-teal-300/40 animate-pulse delay-200"})]}),Umt=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx(Aj,{className:"absolute top-5 left-[12%] w-4 h-4 text-amber-500/50 animate-pulse"}),r.jsx(ES,{className:"absolute top-10 right-[15%] w-3 h-3 text-rose-400/50 animate-pulse delay-100"}),r.jsx(Aj,{className:"absolute top-8 left-[40%] w-3 h-3 text-amber-400/40 animate-pulse delay-200"})]}),cT=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx(Ls,{className:"absolute top-5 left-[10%] w-4 h-4 text-emerald-400/50 animate-pulse"}),r.jsx(qc,{className:"absolute top-10 right-[12%] w-5 h-5 text-amber-400/50 animate-pulse delay-150"}),r.jsx(Ls,{className:"absolute top-8 left-[45%] w-3 h-3 text-sky-400/40 animate-pulse delay-300"})]}),HNe=()=>r.jsxs("div",{className:"absolute inset-0 overflow-hidden pointer-events-none",children:[r.jsx(xa,{className:"absolute top-6 left-[12%] w-4 h-4 text-teal-400/40 animate-pulse"}),r.jsx(Ls,{className:"absolute top-10 right-[15%] w-3 h-3 text-emerald-400/50 animate-pulse delay-100"}),r.jsx(xa,{className:"absolute top-4 right-[40%] w-3 h-3 text-cyan-400/30 animate-pulse delay-200"})]}),Mfe=[{id:"default",name:"Classic",description:"Clean, professional look for any occasion",icon:r.jsx(Ls,{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(xi,{className:"h-5 w-5"}),category:"general",headerText:e=>e?`Thank You, ${e}!`:"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(Bmt,{})},{id:"thinking_of_you",name:"Thinking of You",description:"Let them know they're on your mind",icon:r.jsx(eA,{className:"h-5 w-5"}),category:"general",headerText:e=>e?`Thinking of You, ${e}`:"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(cT,{})},{id:"check_in",name:"Check-in",description:"Touch base with your contacts",icon:r.jsx(Aj,{className:"h-5 w-5"}),category:"general",headerText:e=>e?`Hey ${e}!`:"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(Umt,{})},{id:"market_update",name:"Market Update",description:"Share real estate market insights",icon:r.jsx(_c,{className:"h-5 w-5"}),category:"general",headerText:e=>e?`Market Update for ${e}`:"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(Un,{className:"h-5 w-5"}),category:"general",headerText:e=>e?`Thank You for the Referral, ${e}!`:"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(cT,{})},{id:"congratulations",name:"Congratulations",description:"Celebrate their achievements",icon:r.jsx(zl,{className:"h-5 w-5"}),category:"general",headerText:e=>e?`Congratulations, ${e}!`:"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(VNe,{})},{id:"welcome_neighborhood",name:"Welcome to the Neighborhood",description:"Greet new neighbors",icon:r.jsx(Po,{className:"h-5 w-5"}),category:"general",headerText:e=>e?`Welcome to the Neighborhood, ${e}!`:"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(HNe,{})},{id:"just_because",name:"Just Because",description:"No reason needed to connect",icon:r.jsx(ES,{className:"h-5 w-5"}),category:"general",headerText:e=>e?`Hey ${e}!`:"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(cT,{})},{id:"birthday",name:"Birthday",description:"Celebrate their special day",icon:r.jsx(hf,{className:"h-5 w-5"}),category:"holidays",headerText:e=>e?`Happy Birthday, ${e}!`:"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(Pmt,{})},{id:"valentines_day",name:"Valentine's Day",description:"Show appreciation on this special day",icon:r.jsx(xi,{className:"h-5 w-5"}),category:"holidays",headerText:e=>e?`Happy Valentine's Day, ${e}!`:"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(Lmt,{})},{id:"groundhog_day",name:"Groundhog Day",description:"A fun seasonal greeting",icon:r.jsx(Z1,{className:"h-5 w-5"}),category:"holidays",headerText:e=>e?`Happy Groundhog Day, ${e}!`:"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(Omt,{})},{id:"new_years",name:"New Year's Day",description:"Ring in the new year",icon:r.jsx(js,{className:"h-5 w-5"}),category:"holidays",headerText:e=>e?`Happy New Year, ${e}!`:"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(Tmt,{})},{id:"easter",name:"Easter",description:"Celebrate the spring season",icon:r.jsx(bS,{className:"h-5 w-5"}),category:"holidays",headerText:e=>e?`Happy Easter, ${e}!`:"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(Nmt,{})},{id:"mothers_day",name:"Mother's Day",description:"Celebrate the amazing moms",icon:r.jsx(vm,{className:"h-5 w-5"}),category:"holidays",headerText:e=>e?`Happy Mother's Day, ${e}!`:"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(jmt,{})},{id:"fathers_day",name:"Father's Day",description:"Celebrate the amazing dads",icon:r.jsx(zl,{className:"h-5 w-5"}),category:"holidays",headerText:e=>e?`Happy Father's Day, ${e}!`:"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(kmt,{})},{id:"memorial_day",name:"Memorial Day",description:"Honor those who served",icon:r.jsx(ly,{className:"h-5 w-5"}),category:"holidays",headerText:e=>e?`Happy Memorial Day, ${e}`:"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(bmt,{})},{id:"independence_day",name:"4th of July",description:"Celebrate Independence Day",icon:r.jsx(ff,{className:"h-5 w-5"}),category:"holidays",headerText:e=>e?`Happy 4th of July, ${e}!`:"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(wmt,{})},{id:"labor_day",name:"Labor Day",description:"Celebrate the workers",icon:r.jsx(zl,{className:"h-5 w-5"}),category:"holidays",headerText:e=>e?`Happy Labor Day, ${e}!`:"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(Imt,{})},{id:"halloween",name:"Halloween",description:"Spooky seasonal greetings",icon:r.jsx(Pj,{className:"h-5 w-5"}),category:"holidays",headerText:e=>e?`Happy Halloween, ${e}!`:"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(Smt,{})},{id:"thanksgiving",name:"Thanksgiving",description:"Express gratitude this season",icon:r.jsx(xi,{className:"h-5 w-5"}),category:"holidays",headerText:e=>e?`Happy Thanksgiving, ${e}!`:"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(Mmt,{})},{id:"christmas",name:"Christmas",description:"Spread holiday cheer",icon:r.jsx(Y1,{className:"h-5 w-5"}),category:"holidays",headerText:e=>e?`Merry Christmas, ${e}!`:"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(Cmt,{})},{id:"hanukkah",name:"Hanukkah",description:"Celebrate the Festival of Lights",icon:r.jsx(Ls,{className:"h-5 w-5"}),category:"holidays",headerText:e=>e?`Happy Hanukkah, ${e}!`:"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(Amt,{})},{id:"st_patricks_day",name:"St. Patrick's Day",description:"Celebrate the luck of the Irish",icon:r.jsx(Jx,{className:"h-5 w-5"}),category:"holidays",headerText:e=>e?`Happy St. Patrick's Day, ${e}!`:"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(Emt,{})},{id:"home_anniversary",name:"Home Anniversary",description:"Celebrate their home ownership milestone",icon:r.jsx(xa,{className:"h-5 w-5"}),category:"transactional",headerText:e=>e?`Happy Home Anniversary, ${e}!`:"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(Dmt,{})},{id:"under_contract",name:"Under Contract",description:"Celebrate this exciting milestone",icon:r.jsx(qc,{className:"h-5 w-5"}),category:"transactional",headerText:e=>e?`Congratulations, ${e}!`:"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(Rmt,{})},{id:"just_listed",name:"Just Listed",description:"Announce a new listing",icon:r.jsx(Ss,{className:"h-5 w-5"}),category:"transactional",headerText:e=>e?`Exciting News, ${e}!`:"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(HNe,{})},{id:"just_sold",name:"Just Sold",description:"Celebrate a successful sale",icon:r.jsx(Rd,{className:"h-5 w-5"}),category:"transactional",headerText:e=>e?`Congratulations, ${e}!`:"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(cT,{})},{id:"price_reduction",name:"Price Reduction",description:"Notify about a price change",icon:r.jsx($j,{className:"h-5 w-5"}),category:"transactional",headerText:e=>e?`Great News, ${e}!`:"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(Ej,{className:"h-5 w-5"}),category:"transactional",headerText:e=>e?`You're Invited, ${e}!`:"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($mt,{})},{id:"closing_day",name:"Closing Day",description:"Celebrate their closing day",icon:r.jsx(pf,{className:"h-5 w-5"}),category:"transactional",headerText:e=>e?`Congratulations, ${e}!`:"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(Fmt,{})},{id:"move_in_day",name:"Move-in Day",description:"Welcome them to their new home",icon:r.jsx(xa,{className:"h-5 w-5"}),category:"transactional",headerText:e=>e?`Welcome Home, ${e}!`:"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(zmt,{})},{id:"offer_accepted",name:"Offer Accepted",description:"Celebrate their accepted offer",icon:r.jsx(zd,{className:"h-5 w-5"}),category:"transactional",headerText:e=>e?`Amazing News, ${e}!`:"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(cT,{})},{id:"pre_approval",name:"Pre-Approval Congrats",description:"Congratulate on pre-approval",icon:r.jsx(zl,{className:"h-5 w-5"}),category:"transactional",headerText:e=>e?`Congratulations, ${e}!`:"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(VNe,{})}],qmt=[{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 Vmt(e){return Mfe.filter(t=>t.category===e)}function KS(e){return Mfe.find(t=>t.id===e)||Mfe[0]}function Hmt(){const{shareToken:e}=md(),[t,n]=E.useState(null),[s,a]=E.useState(null),[o,l]=E.useState(null),[i,u]=E.useState(!0),[p,x]=E.useState(null),[y,_]=E.useState(!0);E.useEffect(()=>{const U=()=>{['[id*="lc_text_widget"]','[class*="lc-text-widget"]','[id*="chat-widget"]','[class*="chat-widget"]','iframe[src*="widgets.leadconnectorhq"]','iframe[src*="msgsndr"]',"[data-chat-widget]"].forEach(J=>{document.querySelectorAll(J).forEach(ne=>{ne.style.display="none"})})};U();const V=[setTimeout(U,500),setTimeout(U,1500),setTimeout(U,3e3)],W=new MutationObserver(U);return W.observe(document.body,{childList:!0,subtree:!0}),()=>{V.forEach(clearTimeout),W.disconnect()}},[]),E.useEffect(()=>{(async()=>{if(!e){x("Invalid share link"),u(!1);return}const{data:V,error:W}=await Q.from("agent_videos").select("id, title, playback_url, thumbnail_url, preview_url, duration_seconds, share_token, owner_user_id, contact_id, page_template, recipient_name").eq("share_token",e).eq("is_deleted",!1).single();if(W||!V){x("Video not found or has been removed"),u(!1);return}n(V);try{await Q.rpc("log_video_view",{p_video_id:V.id,p_user_agent:navigator.userAgent,p_referrer:document.referrer||null})}catch(G){console.warn("Failed to log video view:",G)}if(V.owner_user_id){const{data:G}=await Q.from("profiles").select("id, name, email, phone").eq("id",V.owner_user_id).single();if(G){a(G);try{const{data:J}=await Q.storage.from("avatars").list(`${V.owner_user_id}`);if(J&&J.length>0){const{data:ne}=Q.storage.from("avatars").getPublicUrl(`${V.owner_user_id}/${J[0].name}`);l(ne.publicUrl)}}catch{}}}u(!1)})()},[e]);const b=U=>{if(!U)return"0:00";const V=Math.floor(U/60),W=U%60;return`${V}:${W.toString().padStart(2,"0")}`},S=U=>U.includes("iframe.mediadelivery.net/play/")?U.replace("/play/","/embed/")+"?autoplay=true&responsive=true":U,k=U=>{if(!U)return"?";const V=U.split(" ");return V.length>=2?`${V[0][0]}${V[1][0]}`.toUpperCase():U.substring(0,2).toUpperCase()},M=KS((t==null?void 0:t.page_template)||"default"),P=(t==null?void 0:t.recipient_name)||null,T=M.headerText(P),z=`https://dashboard.relevelup.com/share/video/${e}`;if(i)return r.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center",children:r.jsx(Zr,{className:"h-8 w-8 animate-spin text-primary"})});if(p||!t)return r.jsx("div",{className:"min-h-screen bg-background flex items-center justify-center p-4",children:r.jsx(Ze,{className:"max-w-md w-full",children:r.jsxs(et,{className:"py-12 text-center",children:[r.jsx($a,{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 D=M.id!=="default";return r.jsxs(r.Fragment,{children:[r.jsxs($m,{children:[r.jsx("title",{children:T}),r.jsx("meta",{name:"description",content:M.subText}),r.jsx("meta",{property:"og:title",content:T}),r.jsx("meta",{property:"og:description",content:M.subText}),r.jsx("meta",{property:"og:type",content:"video.other"}),r.jsx("meta",{property:"og:url",content:z}),t.preview_url&&r.jsx("meta",{property:"og:image",content:t.preview_url}),!t.preview_url&&t.thumbnail_url&&r.jsx("meta",{property:"og:image",content:t.thumbnail_url}),t.playback_url&&r.jsxs(r.Fragment,{children:[r.jsx("meta",{property:"og:video",content:t.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:M.subText}),t.preview_url&&r.jsx("meta",{name:"twitter:image",content:t.preview_url}),t.playback_url&&r.jsxs(r.Fragment,{children:[r.jsx("meta",{name:"twitter:player",content:t.playback_url}),r.jsx("meta",{name:"twitter:player:width",content:"1280"}),r.jsx("meta",{name:"twitter:player:height",content:"720"})]})]}),r.jsxs("div",{className:Bt("min-h-screen flex items-center justify-center p-4 bg-gradient-to-b relative",M.gradientClasses),children:[D&&M.decorativeElement,r.jsxs("div",{className:"max-w-2xl w-full space-y-6 relative z-10",children:[D&&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:Bt("w-14 h-14 rounded-full flex items-center justify-center shadow-sm",M.accentColor==="primary"&&"bg-primary/10 text-primary",M.accentColor==="amber"&&"bg-amber-100 text-amber-600 dark:bg-amber-900/50 dark:text-amber-400",M.accentColor==="teal"&&"bg-teal-100 text-teal-600 dark:bg-teal-900/50 dark:text-teal-400",M.accentColor==="rose"&&"bg-rose-100 text-rose-600 dark:bg-rose-900/50 dark:text-rose-400",M.accentColor==="emerald"&&"bg-emerald-100 text-emerald-600 dark:bg-emerald-900/50 dark:text-emerald-400",M.accentColor==="yellow"&&"bg-yellow-100 text-yellow-600 dark:bg-yellow-900/50 dark:text-yellow-400",M.accentColor==="pink"&&"bg-pink-100 text-pink-600 dark:bg-pink-900/50 dark:text-pink-400",M.accentColor==="blue"&&"bg-blue-100 text-blue-600 dark:bg-blue-900/50 dark:text-blue-400",M.accentColor==="red"&&"bg-red-100 text-red-600 dark:bg-red-900/50 dark:text-red-400",M.accentColor==="orange"&&"bg-orange-100 text-orange-600 dark:bg-orange-900/50 dark:text-orange-400",M.accentColor==="green"&&"bg-green-100 text-green-600 dark:bg-green-900/50 dark:text-green-400",M.accentColor==="violet"&&"bg-violet-100 text-violet-600 dark:bg-violet-900/50 dark:text-violet-400",M.accentColor==="sky"&&"bg-sky-100 text-sky-600 dark:bg-sky-900/50 dark:text-sky-400"),children:r.jsx("div",{className:"scale-150",children:M.icon})})}),r.jsx("h1",{className:"text-2xl sm:text-3xl font-bold mb-2",children:T}),r.jsx("p",{className:"text-muted-foreground",children:M.subText})]}),s&&r.jsxs("div",{className:"flex items-center gap-4 p-4 bg-card/90 backdrop-blur-sm rounded-lg border shadow-sm",children:[r.jsxs(Qs,{className:"h-14 w-14 border-2 border-primary/20",children:[r.jsx(Si,{src:o||void 0,alt:s.name||"Agent"}),r.jsx(Js,{className:"bg-primary/10 text-primary font-semibold",children:k(s.name)})]}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:D?"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(Ti,{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(Ns,{className:"h-4 w-4"})})})]})]}),r.jsx(Ze,{className:"overflow-hidden shadow-lg",children:y&&t.playback_url?r.jsx("div",{className:"relative w-full",style:{paddingBottom:"56.25%"},children:r.jsx("iframe",{src:S(t.playback_url),title:t.title||"Video message",className:"absolute top-0 left-0 w-full h-full",style:{border:0},allow:"accelerometer; gyroscope; autoplay; encrypted-media; picture-in-picture",allowFullScreen:!0})}):r.jsxs("div",{className:"relative aspect-video bg-muted cursor-pointer group",onClick:()=>_(!0),children:[t.preview_url||t.thumbnail_url?r.jsx("img",{src:t.preview_url||t.thumbnail_url||"",alt:t.title?`${t.title} video preview`:"Video message preview",className:"w-full h-full object-cover",onError:U=>{var W;U.currentTarget.style.display="none";const V=(W=U.currentTarget.parentElement)==null?void 0:W.querySelector(".video-fallback");V&&(V.style.display="flex")}}):null,r.jsx("div",{className:"video-fallback w-full h-full items-center justify-center bg-gradient-to-br from-primary/20 to-primary/5",style:{display:t.preview_url||t.thumbnail_url?"none":"flex"},children:r.jsx($a,{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(Vl,{className:"h-10 w-10 text-primary ml-1"})})}),t.duration_seconds&&r.jsx("div",{className:"absolute bottom-3 right-3 bg-black/70 text-white text-sm px-2 py-1 rounded",children:b(t.duration_seconds)})]})}),!D&&r.jsxs("div",{className:"text-center",children:[r.jsx("h1",{className:"text-2xl font-bold",children:t.title||"Video Message"}),r.jsx("p",{className:"text-muted-foreground mt-2",children:y?"Enjoy the video!":"Click to play the video"})]}),!y&&r.jsx("div",{className:"flex justify-center",children:r.jsxs(ee,{size:"lg",onClick:()=>_(!0),className:"gap-2",children:[r.jsx(Vl,{className:"h-5 w-5"}),"Watch Video"]})}),r.jsx(_mt,{shareToken:e,agentName:(s==null?void 0:s.name)||null,hasContact:!!t.contact_id})]})]})]})}function Wmt(){return E.useEffect(()=>(document.body.classList.add("video-landing-page"),()=>{document.body.classList.remove("video-landing-page")}),[]),r.jsx(brt,{})}function Gmt(){const{token:e}=md();return E.useEffect(()=>{if(!e)return;const t=`https://relzejiswnotikjgvjhz.supabase.co/functions/v1/video-og-image?token=${e}`;window.location.replace(t)},[e]),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(Zr,{className:"h-5 w-5 animate-spin"}),r.jsx("span",{children:"Loading video preview…"})]})})}const Kmt={active:"bg-emerald-500",coming_soon:"bg-sky-500",price_improvement:"bg-orange-500",under_contract:"bg-purple-500",sold:"bg-gray-500"},Zmt={active:"Active",coming_soon:"Coming Soon",price_improvement:"Price Improvement",under_contract:"Under Contract",sold:"Sold"},C4={single_family:"Single Family",condo:"Condo",townhouse:"Townhouse",land:"Land",multi_family:"Multi-Family",luxury:"Luxury",commercial:"Commercial",other:"Other"};function Ymt(){var ie,pe,se,fe;const{slugOrId:e}=md(),[t]=Gc(),{data:n,isLoading:s}=v8e(e||""),a=_8e(),o=mct(),l=t.get("ref"),[i,u]=E.useState(""),[p,x]=E.useState(""),[y,_]=E.useState(""),[b,S]=E.useState(""),[k,M]=E.useState(!1),[P,T]=E.useState(!1),[I,z]=E.useState(null),[D,U]=E.useState(!1);E.useEffect(()=>{l&&o.mutate(l)},[l]);const V=he=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(he),W=async he=>{if(he.preventDefault(),!(!i.trim()||!y.trim()||!n)){M(!0);try{await a.mutateAsync({listingId:n.id,agentId:n.agent_id,firstName:i.trim(),lastName:p.trim(),email:y.trim(),phone:b.trim(),shareToken:l}),T(!0),Ie.success("Thanks! The agent will be in touch soon.")}catch(ye){console.error("Lead submission error:",ye),Ie.error(`Failed to submit: ${ye.message||"Please try again"}`)}finally{M(!1)}}},G=(n==null?void 0:n.photos)||[],J=G.find(he=>he.is_primary)||G[0],ne=()=>{I!==null&&z(I===0?G.length-1:I-1)},oe=()=>{I!==null&&z(I===G.length-1?0:I+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(Lr,{className:"h-8 w-32"})})}),r.jsxs("div",{className:"container mx-auto px-4 py-8",children:[r.jsx(Lr,{className:"h-10 w-48 mb-6"}),r.jsx(Lr,{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(Lr,{className:"h-12 w-48"}),r.jsx(Lr,{className:"h-6 w-full"}),r.jsx(Lr,{className:"h-6 w-3/4"})]}),r.jsx(Lr,{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(oo,{to:"/public/listings",className:"flex items-center gap-2",children:r.jsx("img",{src:Ute,alt:"LevelUp",className:"h-8"})})})}),r.jsxs("div",{className:"container mx-auto px-4 py-16 text-center",children:[r.jsx(xa,{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(oo,{to:"/public/listings",children:"Browse All Listings"})})]})]});const ge=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($m,{children:[r.jsxs("title",{children:[ge," | LevelUp Listings"]}),r.jsx("meta",{name:"description",content:`${V(n.price)} - ${n.bedrooms||""}BD ${n.bathrooms||""}BA ${n.square_footage?n.square_footage.toLocaleString()+" sqft":""} ${C4[n.property_type]} in ${n.city}, ${n.state}. ${((ie=n.description)==null?void 0:ie.slice(0,150))||""}`}),r.jsx("link",{rel:"canonical",href:`https://listings.relevelup.com/${n.slug||n.id}`}),r.jsx("meta",{property:"og:title",content:ge}),r.jsx("meta",{property:"og:description",content:`${V(n.price)} - ${n.bedrooms||""}BD ${n.bathrooms||""}BA ${C4[n.property_type]} in ${n.city}, ${n.state}. View photos, details, and contact the listing agent.`}),r.jsx("meta",{property:"og:type",content:"website"}),r.jsx("meta",{property:"og:url",content:`https://listings.relevelup.com/${n.slug||n.id}`}),J&&r.jsx("meta",{property:"og:image",content:J.photo_url}),J&&r.jsx("meta",{property:"og:image:alt",content:`${n.property_address||n.city} - ${C4[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:ge}),r.jsx("meta",{name:"twitter:description",content:`${V(n.price)} - ${n.bedrooms||""}BD ${n.bathrooms||""}BA in ${n.city}, ${n.state}`}),J&&r.jsx("meta",{name:"twitter:image",content:J.photo_url}),r.jsx("meta",{name:"robots",content:"index, follow"}),r.jsx("meta",{name:"geo.region",content:`US-${n.state}`}),r.jsx("meta",{name:"geo.placename",content:n.city}),r.jsx("script",{type:"application/ld+json",children:JSON.stringify({"@context":"https://schema.org","@type":"RealEstateListing",name:n.property_address||`${n.city}, ${n.state} Home`,description:n.description||`${C4[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(he=>he.photo_url),address:{"@type":"PostalAddress",streetAddress:n.property_address||void 0,addressLocality:n.city,addressRegion:n.state,addressCountry:"US"},geo:n.neighborhood?{"@type":"GeoCoordinates",name:n.neighborhood}:void 0,offers:{"@type":"Offer",price:n.price,priceCurrency:"USD",availability:n.status==="sold"?"https://schema.org/SoldOut":n.status==="under_contract"?"https://schema.org/LimitedAvailability":"https://schema.org/InStock"},numberOfRooms:n.bedrooms||void 0,numberOfBathroomsTotal:n.bathrooms||void 0,floorSize:n.square_footage?{"@type":"QuantitativeValue",value:n.square_footage,unitCode:"FTK"}:void 0,yearBuilt:n.year_built||void 0,broker:n.agent?{"@type":"RealEstateAgent",name:n.agent.name,email:n.agent.email,worksFor:(pe=n.agent.brokerage)!=null&&pe.name?{"@type":"RealEstateAgent",name:n.agent.brokerage.name}:void 0}:void 0})})]}),r.jsxs("div",{className:"min-h-screen bg-background",children:[r.jsx("header",{className:"border-b bg-card sticky top-0 z-50",children:r.jsx("div",{className:"container mx-auto px-4 py-4",children:r.jsx("div",{className:"flex items-center justify-between",children:r.jsx(oo,{to:"/public/listings",className:"flex items-center gap-2",children:r.jsx("img",{src:Ute,alt:"LevelUp",className:"h-8"})})})})}),r.jsxs("div",{className:"container mx-auto px-4 py-6",children:[r.jsxs(oo,{to:"/public/listings",className:"inline-flex items-center text-muted-foreground hover:text-foreground mb-6",children:[r.jsx(po,{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:J==null?void 0:J.photo_url,alt:`${n.property_address||n.city+", "+n.state} - ${C4[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((he,ye)=>r.jsxs("div",{className:"aspect-square rounded-lg overflow-hidden bg-muted cursor-pointer relative",onClick:()=>z(ye+1),children:[r.jsx("img",{src:he.photo_url,alt:`${n.property_address||n.city} - Photo ${ye+2} of ${G.length}`,className:"w-full h-full object-cover hover:scale-105 transition-transform duration-300"}),ye===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"]})]},he.id))})]}),r.jsxs("div",{className:"grid md:grid-cols-3 gap-8",children:[r.jsxs("div",{className:"md:col-span-2 space-y-6",children:[r.jsxs("div",{children:[r.jsx("div",{className:"flex items-center gap-2 mb-3",children:r.jsx(Pt,{className:`${Kmt[n.status]} text-white border-0`,children:Zmt[n.status]})}),r.jsx("h1",{className:"text-4xl font-bold text-primary mb-2",children:V(n.price)}),n.property_address&&r.jsx("p",{className:"text-xl font-medium",children:n.property_address}),r.jsxs("p",{className:"text-muted-foreground flex items-center gap-1",children:[r.jsx(Po,{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(z1,{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(F1,{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(Fg,{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(Ss,{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(Pt,{variant:"secondary",children:[r.jsx(hi,{className:"h-3 w-3 mr-1"}),C4[n.property_type]]}),n.lot_size&&r.jsxs(Pt,{variant:"secondary",children:["Lot: ",n.lot_size]}),n.has_hoa&&r.jsx(Pt,{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(As,{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(Ze,{className:"overflow-hidden bg-gradient-to-br from-primary/5 to-primary/10 border-primary/20",children:r.jsxs(et,{className:"p-0",children:[r.jsxs("div",{className:"relative aspect-video bg-muted cursor-pointer group",onClick:()=>U(!0),children:[n.video.thumbnail_url?r.jsx("img",{src:n.video.thumbnail_url,alt:"Video thumbnail",className:"w-full h-full object-cover"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center bg-gradient-to-br from-primary/20 to-primary/30",children:r.jsx($a,{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(Vl,{className:"h-8 w-8 text-primary fill-primary ml-1"})})})]}),r.jsxs("div",{className:"p-4",children:[r.jsxs(ee,{onClick:()=>U(!0),className:"w-full gap-2",size:"lg",children:[r.jsx(Vl,{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(Ze,{children:[r.jsx(Wt,{children:r.jsxs(Yt,{className:"text-lg flex items-center gap-2",children:[r.jsx(ic,{className:"h-5 w-5"}),"Listing Agent"]})}),r.jsxs(et,{children:[r.jsx("p",{className:"font-semibold text-lg",children:n.agent.name}),((se=n.agent.brokerage)==null?void 0:se.name)&&r.jsx("p",{className:"text-sm text-muted-foreground",children:n.agent.brokerage.name})]})]}),r.jsxs(Ze,{className:"border-primary",children:[r.jsx(Wt,{children:r.jsx(Yt,{className:"text-lg",children:"Interested in this property?"})}),r.jsx(et,{children:P?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(Ns,{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:W,className:"space-y-3",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsxs("div",{children:[r.jsx($e,{htmlFor:"firstName",children:"First Name *"}),r.jsx(dt,{id:"firstName",type:"text",placeholder:"John",value:i,onChange:he=>u(he.target.value),required:!0})]}),r.jsxs("div",{children:[r.jsx($e,{htmlFor:"lastName",children:"Last Name"}),r.jsx(dt,{id:"lastName",type:"text",placeholder:"Doe",value:p,onChange:he=>x(he.target.value)})]})]}),r.jsxs("div",{children:[r.jsx($e,{htmlFor:"email",children:"Email *"}),r.jsx(dt,{id:"email",type:"email",placeholder:"you@example.com",value:y,onChange:he=>_(he.target.value),required:!0})]}),r.jsxs("div",{children:[r.jsx($e,{htmlFor:"phone",children:"Phone"}),r.jsx(dt,{id:"phone",type:"tel",placeholder:"(555) 123-4567",value:b,onChange:he=>S(he.target.value)})]}),r.jsx(ee,{type:"submit",className:"w-full",disabled:k,children:k?"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(Or,{open:I!==null,onOpenChange:()=>z(null),children:r.jsxs(Ir,{className:"max-w-5xl p-0 bg-black/95",children:[r.jsx($r,{className:"sr-only",children:r.jsx(Fr,{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(hs,{className:"h-5 w-5"})}),I!==null&&G[I]&&r.jsxs("div",{className:"relative",children:[r.jsx("img",{src:G[I].photo_url,alt:`Photo ${I+1}`,className:"w-full max-h-[80vh] object-contain"}),G.length>1&&r.jsxs(r.Fragment,{children:[r.jsx("button",{onClick:ne,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(kc,{className:"h-6 w-6"})}),r.jsx("button",{onClick:oe,className:"absolute right-4 top-1/2 -translate-y-1/2 rounded-full bg-black/50 p-2 text-white hover:bg-black/70",children:r.jsx(Wi,{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:[I+1," / ",G.length]})]})]})]})}),r.jsx(Or,{open:D,onOpenChange:U,children:r.jsxs(Ir,{className:"max-w-4xl p-0 bg-black overflow-hidden",children:[r.jsx($r,{className:"sr-only",children:r.jsx(Fr,{children:"Video Tour"})}),r.jsx("button",{onClick:()=>U(!1),className:"absolute right-4 top-4 z-50 rounded-full bg-black/50 p-2 text-white hover:bg-black/70",children:r.jsx(hs,{className:"h-5 w-5"})}),((fe=n==null?void 0:n.video)==null?void 0:fe.playback_url)&&r.jsx("div",{className:"aspect-video w-full",children:r.jsx("iframe",{src:n.video.playback_url,className:"w-full h-full",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0})})]})}),r.jsx("footer",{className:"border-t py-8 mt-16",children:r.jsxs("div",{className:"container mx-auto px-4 text-center text-sm text-muted-foreground",children:[r.jsxs("p",{children:["© ",new Date().getFullYear()," LevelUp. All rights reserved."]}),r.jsx("p",{className:"mt-2",children:r.jsx("a",{href:"https://relevelup.com",target:"_blank",rel:"noopener noreferrer",className:"hover:text-foreground",children:"relevelup.com"})})]})})]})]})}function Xmt(){var o;const{slug:e}=md(),{data:t,isLoading:n,error:s}=k8e(e);if(E.useEffect(()=>(document.body.classList.add("agent-card-page"),()=>{document.body.classList.remove("agent-card-page")}),[]),E.useEffect(()=>{t!=null&&t.id&&zi(t.id,"card_view")},[t==null?void 0:t.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(Lr,{className:"h-28 w-28 rounded-full"}),r.jsx(Lr,{className:"h-6 w-48"}),r.jsx(Lr,{className:"h-4 w-36"})]}),r.jsx(Lr,{className:"h-12 w-full"}),r.jsx(Lr,{className:"h-12 w-full"})]})});if(s||!t)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=t.profile)==null?void 0:o.name)||"Agent";return r.jsxs(r.Fragment,{children:[r.jsxs($m,{children:[r.jsxs("title",{children:[a," | Real Estate Agent"]}),r.jsx("meta",{name:"description",content:t.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:t.positioning_statement||`Connect with ${a}`}),t.avatar_url&&r.jsx("meta",{property:"og:image",content:t.avatar_url})]}),r.jsx(Qxe,{card:t})]})}function dT({banners:e,autoPlayInterval:t=5e3,className:n}){const[s,a]=E.useState(0),[o,l]=E.useState(!1),i=E.useCallback(()=>{a(y=>(y+1)%e.length)},[e.length]),u=E.useCallback(()=>{a(y=>(y-1+e.length)%e.length)},[e.length]),p=E.useCallback(y=>{a(y)},[]);if(E.useEffect(()=>{if(e.length<=1||o)return;const y=setInterval(i,t);return()=>clearInterval(y)},[e.length,o,t,i]),!e||e.length===0)return null;const x=e[s];return r.jsxs("div",{className:Bt("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"})})]}),e.length>1&&r.jsxs(r.Fragment,{children:[r.jsx(ee,{variant:"ghost",size:"icon",className:Bt("absolute left-2 top-1/2 -translate-y-1/2 bg-black/30 hover:bg-black/50 text-white rounded-full","opacity-0 transition-opacity",o&&"opacity-100"),onClick:u,children:r.jsx(kc,{className:"h-6 w-6"})}),r.jsx(ee,{variant:"ghost",size:"icon",className:Bt("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(Wi,{className:"h-6 w-6"})})]})]}),e.length>1&&r.jsx("div",{className:"absolute bottom-3 left-1/2 -translate-x-1/2 flex gap-2",children:e.map((y,_)=>r.jsx("button",{onClick:()=>p(_),className:Bt("w-2 h-2 rounded-full transition-all duration-300",_===s?"bg-white w-6":"bg-white/50 hover:bg-white/70"),"aria-label":`Go to slide ${_+1}`},_))})]})}function Qmt(e){return"EST"}function OE(e){const n=new Intl.DateTimeFormat("en-US",{hour:"numeric",minute:"2-digit",hour12:!0,timeZone:"America/New_York"}).format(e),s=Qmt();return`${n} ${s}`}function ZS(e){const t=new Date,n=new Date(e),s=CNe(n,-15),a=CNe(n,30);return t>a?"ended":LNe(t,{start:n,end:a})?"live":LNe(t,{start:s,end:n})?"starting_soon":"upcoming"}function Aye(e){const t=ZS(e);return t==="starting_soon"||t==="live"}const WNe=Aye,Jmt=({events:e,registrations:t,onNavigateToEvents:n})=>{const[s,a]=E.useState(new Date);E.useEffect(()=>{const b=setInterval(()=>{a(new Date)},3e4);return()=>clearInterval(b)},[]);const o=e.filter(b=>Aye(b.event_date));if(o.length===0)return null;const l=o[0],i=ZS(l.event_date),u=t.find(b=>b.event_id===l.id),p=(u==null?void 0:u.zoom_join_url)||l.zoom_link,x=!!u,y=i==="live",_=y?{container:"from-red-500/10 via-red-500/5 to-primary/10 border-red-500/30",pulse:"from-red-500/5",indicator:"bg-red-500",text:"text-red-500",button:"bg-red-500 hover:bg-red-600",outlineButton:"border-red-500/50 text-red-500 hover:bg-red-500/10"}:{container:"from-amber-500/10 via-amber-500/5 to-primary/10 border-amber-500/30",pulse:"from-amber-500/5",indicator:"bg-amber-500",text:"text-amber-500",button:"bg-amber-500 hover:bg-amber-600",outlineButton:"border-amber-500/50 text-amber-500 hover:bg-amber-500/10"};return r.jsxs("div",{className:`relative mb-8 overflow-hidden rounded-xl bg-gradient-to-r ${_.container} border`,children:[r.jsx("div",{className:`absolute inset-0 bg-gradient-to-r ${_.pulse} to-transparent animate-pulse`}),r.jsx("div",{className:"relative p-4 sm:p-6",children:r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center gap-4",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsxs("div",{className:"relative flex items-center justify-center",children:[r.jsx("span",{className:`absolute inline-flex h-full w-full animate-ping rounded-full ${_.indicator} opacity-75`}),r.jsx("span",{className:`relative flex h-3 w-3 rounded-full ${_.indicator}`})]}),r.jsx("div",{className:`flex items-center gap-2 ${_.text} font-bold text-sm uppercase tracking-wider`,children:y?r.jsxs(r.Fragment,{children:[r.jsx(Bj,{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 ${OE(new Date(l.event_date))}`:`Starts at ${OE(new Date(l.event_date))}`})]}),r.jsx("div",{className:"flex items-center gap-2",children:x?r.jsxs(ee,{onClick:()=>window.open(p,"_blank"),className:`${_.button} text-white gap-2`,children:[r.jsx(As,{className:"h-4 w-4"}),y?"Join Now":"Join When Live"]}):r.jsxs(ee,{variant:"outline",onClick:n,className:`${_.outlineButton} gap-2`,children:[r.jsx(Un,{className:"h-4 w-4"}),"Register & Join"]})})]})})]})};var Eye="Progress",Iye=100,[egt]=cc(Eye),[tgt,rgt]=egt(Eye),dRe=E.forwardRef((e,t)=>{const{__scopeProgress:n,value:s=null,max:a,getValueLabel:o=ngt,...l}=e;(a||a===0)&&!GNe(a)&&console.error(sgt(`${a}`,"Progress"));const i=GNe(a)?a:Iye;s!==null&&!KNe(s,i)&&console.error(agt(`${s}`,"Progress"));const u=KNe(s,i)?s:null,p=nre(u)?o(u,i):void 0;return r.jsx(tgt,{scope:n,value:u,max:i,children:r.jsx(Fn.div,{"aria-valuemax":i,"aria-valuemin":0,"aria-valuenow":nre(u)?u:void 0,"aria-valuetext":p,role:"progressbar","data-state":fRe(u,i),"data-value":u??void 0,"data-max":i,...l,ref:t})})});dRe.displayName=Eye;var uRe="ProgressIndicator",hRe=E.forwardRef((e,t)=>{const{__scopeProgress:n,...s}=e,a=rgt(uRe,n);return r.jsx(Fn.div,{"data-state":fRe(a.value,a.max),"data-value":a.value??void 0,"data-max":a.max,...s,ref:t})});hRe.displayName=uRe;function ngt(e,t){return`${Math.round(e/t*100)}%`}function fRe(e,t){return e==null?"indeterminate":e===t?"complete":"loading"}function nre(e){return typeof e=="number"}function GNe(e){return nre(e)&&!isNaN(e)&&e>0}function KNe(e,t){return nre(e)&&!isNaN(e)&&e<=t&&e>=0}function sgt(e,t){return`Invalid prop \`max\` of value \`${e}\` supplied to \`${t}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${Iye}\`.`}function agt(e,t){return`Invalid prop \`value\` of value \`${e}\` supplied to \`${t}\`. The \`value\` prop must be: - a positive number - less than the value passed to \`max\` (or ${Iye} if no \`max\` prop is set) - \`null\` or \`undefined\` if the progress is indeterminate. Defaulting to \`null\`.`}var pRe=dRe,igt=hRe;const pd=E.forwardRef(({className:e,value:t,...n},s)=>r.jsx(pRe,{ref:s,className:Bt("relative h-4 w-full overflow-hidden rounded-full bg-secondary",e),...n,children:r.jsx(igt,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(t||0)}%)`}})}));pd.displayName=pRe.displayName;function ogt(){const{user:e,isBrokerageManager:t}=tn(),[n,s]=E.useState([]),[a,o]=E.useState([]),[l,i]=E.useState(!1),[u,p]=E.useState(!0),x=t?"brokerage_manager":"agent";E.useEffect(()=>{if(!(e!=null&&e.id)){p(!1);return}y()},[e==null?void 0:e.id,x]);const y=async()=>{if(e!=null&&e.id)try{const{data:z,error:D}=await Q.from("onboarding_checklist_items").select("*").eq("target_role",x).eq("is_active",!0).order("sort_order");if(D)throw D;const{data:U,error:V}=await Q.from("onboarding_checklist_progress").select("item_id, completed_at").eq("user_id",e.id);if(V)throw V;const{data:W,error:G}=await Q.from("onboarding_checklist_dismissed").select("id").eq("user_id",e.id).maybeSingle();if(G)throw G;s(z||[]),o(U||[]),i(!!W),z&&z.length>0&&await _(z,U||[])}catch(z){console.error("Error fetching checklist data:",z)}finally{p(!1)}},_=async(z,D)=>{var Be,qe;if(!(e!=null&&e.id))return;const U=D.map(ot=>ot.item_id),V=z.filter(ot=>!U.includes(ot.id));if(V.length===0)return;const[W,G,J,ne,oe,ge,ie,pe,se,fe,he,ye,Ae,we,be]=await Promise.all([Q.from("profiles").select("brokerage_id").eq("id",e.id).maybeSingle(),Q.from("resource_shares").select("id",{count:"exact",head:!0}).eq("sender_id",e.id),Q.from("community_posts").select("id",{count:"exact",head:!0}).eq("user_id",e.id),Q.from("event_registrations").select("id",{count:"exact",head:!0}).eq("user_id",e.id),Q.from("content_engagement_logs").select("id",{count:"exact",head:!0}).eq("user_id",e.id).eq("resource_type","template"),Q.from("content_engagement_logs").select("id",{count:"exact",head:!0}).eq("user_id",e.id).eq("resource_type","academy_video"),Q.from("content_engagement_logs").select("id",{count:"exact",head:!0}).eq("user_id",e.id).eq("resource_type","toolbox"),Q.from("activity_logs").select("id",{count:"exact",head:!0}).eq("user_id",e.id),Q.from("innercircle_contacts").select("id",{count:"exact",head:!0}).eq("owner_user_id",e.id),Q.from("agent_videos").select("id",{count:"exact",head:!0}).eq("owner_user_id",e.id),Q.from("contact_touch_logs").select("id",{count:"exact",head:!0}).eq("owner_user_id",e.id),Q.from("scorecard_transactions").select("id",{count:"exact",head:!0}).eq("owner_user_id",e.id),Q.from("listings").select("id",{count:"exact",head:!0}).eq("agent_id",e.id),Q.from("innercircle_contacts").select("id").eq("owner_user_id",e.id),Q.from("deal_pipeline").select("id",{count:"exact",head:!0}).eq("owner_user_id",e.id)]),_e={},Je=(Be=W.data)==null?void 0:Be.brokerage_id;_e.share_resource=(G.count||0)>0,_e.post_community=(J.count||0)>0,_e.register_event=(ne.count||0)>0,_e.view_template=(oe.count||0)>0,_e.watch_academy=(ge.count||0)>0,_e.use_toolbox=(ie.count||0)>0,_e.launch_app=(pe.count||0)>0,_e.add_contact=(se.count||0)>0,_e.create_video=(fe.count||0)>0,_e.complete_touch=(he.count||0)>0,_e.add_transaction=(ye.count||0)>0,_e.add_listing=(Ae.count||0)>0,_e.add_deal=(be.count||0)>0;const Te=((qe=we.data)==null?void 0:qe.map(ot=>ot.id))||[],De=[];Je?De.push(Q.from("profiles").select("id").eq("brokerage_id",Je).neq("id",e.id).then(ot=>{var Mt;_e.add_agent=(((Mt=ot.data)==null?void 0:Mt.length)||0)>0})):_e.add_agent=!1,Te.length>0?(De.push(Q.from("contact_plan_cycles").select("id",{count:"exact",head:!0}).in("contact_id",Te).then(ot=>{_e.add_plan=(ot.count||0)>0})),De.push(Q.from("contact_popby_settings").select("id",{count:"exact",head:!0}).in("contact_id",Te).then(ot=>{_e.schedule_popby=(ot.count||0)>0}))):(_e.add_plan=!1,_e.schedule_popby=!1),await Promise.all(De);const Ue=V.filter(ot=>_e[ot.action_type]);if(Ue.length>0){const ot=Ue.map(Oe=>({user_id:e.id,item_id:Oe.id})),{error:Mt}=await Q.from("onboarding_checklist_progress").upsert(ot,{onConflict:"user_id,item_id",ignoreDuplicates:!0});if(!Mt){const Oe=Ue.map(at=>({item_id:at.id,completed_at:new Date().toISOString()}));o(at=>[...at,...Oe])}}},b=async z=>{if(e!=null&&e.id)try{const{error:D}=await Q.from("onboarding_checklist_progress").insert({user_id:e.id,item_id:z});if(D)throw D;o(U=>[...U,{item_id:z,completed_at:new Date().toISOString()}])}catch(D){console.error("Error marking item complete:",D)}},S=async()=>{if(e!=null&&e.id)try{const{error:z}=await Q.from("onboarding_checklist_dismissed").insert({user_id:e.id});if(z)throw z;i(!0)}catch(z){console.error("Error dismissing checklist:",z)}},k=a.length,M=n.length,P=M>0&&k>=M,T=M>0?k/M*100:0;return{items:n,progress:a,isDismissed:l,loading:u,completedCount:k,totalCount:M,isComplete:P,progressPercentage:T,isItemComplete:z=>a.some(D=>D.item_id===z),markComplete:b,dismiss:S,refetch:y}}const lgt={add_agent:r.jsx(Un,{className:"h-4 w-4"}),share_resource:r.jsx(Nc,{className:"h-4 w-4"}),post_community:r.jsx(zo,{className:"h-4 w-4"}),register_event:r.jsx(Ss,{className:"h-4 w-4"}),view_template:r.jsx(H0,{className:"h-4 w-4"}),watch_academy:r.jsx(H1,{className:"h-4 w-4"}),use_toolbox:r.jsx(gy,{className:"h-4 w-4"}),launch_app:r.jsx(XT,{className:"h-4 w-4"}),add_deal:r.jsx(uy,{className:"h-4 w-4"}),add_listing:r.jsx(xa,{className:"h-4 w-4"})},cgt={add_deal:"/mission-control/pipeline",add_listing:"/mission-control/listings/new",post_community:"/community",add_contact:"/mission-control/contacts"};function dgt(){const{items:e,isDismissed:t,loading:n,completedCount:s,totalCount:a,isComplete:o,progressPercentage:l,isItemComplete:i,markComplete:u,dismiss:p}=ogt(),x=Gn(),[y,_]=E.useState(!0);return n||t||a===0||o?null:r.jsxs(Ze,{className:"mb-6 border-primary/20 bg-gradient-to-r from-primary/5 to-transparent",children:[r.jsxs(Wt,{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(Dg,{className:"h-5 w-5 text-primary"})}),r.jsxs("div",{children:[r.jsx(Yt,{className:"text-lg",children:"Get Started with LevelUp"}),r.jsx("p",{className:"text-sm text-muted-foreground mt-0.5",children:"Complete these steps to make the most of your membership"})]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>_(!y),className:"h-8 w-8 p-0",children:y?r.jsx(iy,{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(hs,{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(pd,{value:l,className:"h-2"})]})]}),y&&r.jsx(et,{className:"pt-0",children:r.jsx("div",{className:"space-y-3",children:e.map(b=>{const S=i(b.id);return r.jsxs("div",{className:Bt("flex items-start gap-3 p-3 rounded-lg transition-colors",S?"bg-muted/50":"bg-background hover:bg-muted/30 cursor-pointer"),onClick:()=>{if(S)return;const k=cgt[b.action_type];k?x(k):u(b.id)},children:[r.jsx("div",{className:"mt-0.5",children:S?r.jsx(so,{className:"h-5 w-5 text-primary"}):r.jsx(Qu,{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:lgt[b.action_type]||r.jsx(Qu,{className:"h-4 w-4"})}),r.jsx("span",{className:Bt("font-medium",S&&"line-through text-muted-foreground"),children:b.title})]}),b.description&&r.jsx("p",{className:Bt("text-sm text-muted-foreground mt-1",S&&"line-through"),children:b.description})]})]},b.id)})})})]})}const qm=()=>Kt({queryKey:["relationship-types"],queryFn:async()=>{const{data:e,error:t}=await Q.from("relationship_types").select("*").order("sort_order");if(t)throw t;return e}}),jp=e=>{const t=Kc(),n=1e3,s=async a=>{const o=[];let l=0;for(;;){const{data:i,error:u}=await a.range(l,l+n-1);if(u)throw u;const p=i??[];if(o.push(...p),p.length{let a=Q.from("innercircle_contacts").select(` *, tags:innercircle_contact_tags( id, contact_id, relationship_type_id, relationship_type:relationship_types(*) ) `).order("created_at",{ascending:!1}).order("first_name");return await s(a)},enabled:!!t})},ugt=e=>Kt({queryKey:["innercircle-contact",e],queryFn:async()=>{const{data:t,error:n}=await Q.from("innercircle_contacts").select(` *, tags:innercircle_contact_tags( id, contact_id, relationship_type_id, relationship_type:relationship_types(*) ) `).eq("id",e).maybeSingle();if(n)throw n;return t},enabled:!!e}),mRe=()=>{const e=Kc();return Kt({queryKey:["innercircle-contact-counts",e],queryFn:async()=>{const{data:t,error:n}=await Q.from("innercircle_contacts").select(` id, tags:innercircle_contact_tags(relationship_type_id) `);if(n)throw n;const s={};return t==null||t.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:!!e})},Pye=()=>{const e=Hr(),t=Kc();return ir({mutationFn:async n=>{const{tagIds:s,...a}=n,o={...a,birthday:a.birthday||null,home_anniversary:a.home_anniversary||null,owner_user_id:t},{data:l,error:i}=await Q.from("innercircle_contacts").insert(o).select().single();if(i)throw i;if(s&&s.length>0){const{error:u}=await Q.from("innercircle_contact_tags").insert(s.map(p=>({contact_id:l.id,relationship_type_id:p})));if(u)throw u}return l},onSuccess:()=>{e.invalidateQueries({queryKey:["innercircle-contacts"]}),e.invalidateQueries({queryKey:["innercircle-contact-counts"]}),ka({title:"Contact created successfully"})},onError:n=>{ka({title:"Error creating contact",description:n.message,variant:"destructive"})}})},gRe=()=>{const e=Hr();return ir({mutationFn:async({id:t,...n})=>{const{tagIds:s,tags:a,...o}=n,l={...o,birthday:o.birthday||null,home_anniversary:o.home_anniversary||null},{data:i,error:u}=await Q.from("innercircle_contacts").update(l).eq("id",t).select().single();if(u)throw u;if(s!==void 0&&(await Q.from("innercircle_contact_tags").delete().eq("contact_id",t),s.length>0)){const{error:p}=await Q.from("innercircle_contact_tags").insert(s.map(x=>({contact_id:t,relationship_type_id:x})));if(p)throw p}return i},onSuccess:()=>{e.invalidateQueries({queryKey:["innercircle-contacts"]}),e.invalidateQueries({queryKey:["innercircle-contact"]}),e.invalidateQueries({queryKey:["innercircle-contact-counts"]}),ka({title:"Contact updated successfully"})},onError:t=>{ka({title:"Error updating contact",description:t.message,variant:"destructive"})}})},Lye=()=>{const e=Hr();return ir({mutationFn:async t=>{const{error:n}=await Q.from("innercircle_contacts").delete().eq("id",t);if(n)throw n},onSuccess:()=>{e.invalidateQueries({queryKey:["innercircle-contacts"]}),e.invalidateQueries({queryKey:["innercircle-contact-counts"]}),ka({title:"Contact deleted successfully"})},onError:t=>{ka({title:"Error deleting contact",description:t.message,variant:"destructive"})}})},Oye=()=>Kt({queryKey:["action-types"],queryFn:async()=>{const{data:e,error:t}=await Q.from("action_types").select("*").order("sort_order");if(t)throw t;return e}}),hgt=e=>Kt({queryKey:["action-scripts",e],queryFn:async()=>{let t=Q.from("action_scripts").select("*, action_type:action_types(*)");const{data:n,error:s}=await t;if(s)throw s;return n}}),fgt=()=>Kt({queryKey:["touchpoint-plans"],queryFn:async()=>{const{data:e,error:t}=await Q.from("touchpoint_plans").select(` *, items:touchpoint_plan_items( *, action_type:action_types(*), default_script:action_scripts(*) ) `).order("name");if(t)throw t;return e}}),pgt=()=>{const e=Hr(),t=Kc();return ir({mutationFn:async({name:n,description:s})=>{const{data:a,error:o}=await Q.from("touchpoint_plans").insert({name:n,description:s,owner_user_id:t,active:!0,is_template:!1}).select().single();if(o)throw o;return a},onSuccess:()=>{e.invalidateQueries({queryKey:["touchpoint-plans"]}),ka({title:"Plan created successfully"})},onError:n=>{ka({title:"Error creating plan",description:n.message,variant:"destructive"})}})},mgt=()=>{const e=Hr(),t=Kc();return ir({mutationFn:async({sourcePlanId:n,newName:s})=>{const{data:a,error:o}=await Q.from("touchpoint_plans").select(` *, items:touchpoint_plan_items(*) `).eq("id",n).single();if(o)throw o;if(!a)throw new Error("Source plan not found");const{data:l,error:i}=await Q.from("touchpoint_plans").insert({name:s,description:a.description,owner_user_id:t,active:!0,is_template:!1}).select().single();if(i)throw i;if(a.items&&a.items.length>0){const u=a.items.map(x=>({plan_id:l.id,month_number:x.month_number,action_type_id:x.action_type_id,default_script_id:x.default_script_id,notes:x.notes})),{error:p}=await Q.from("touchpoint_plan_items").insert(u);if(p)throw p}return l},onSuccess:()=>{e.invalidateQueries({queryKey:["touchpoint-plans"]}),ka({title:"Plan duplicated successfully",description:"You can now edit your copy of this plan."})},onError:n=>{ka({title:"Error duplicating plan",description:n.message,variant:"destructive"})}})},ggt=()=>{const e=Hr();return ir({mutationFn:async({id:t,name:n,description:s})=>{const{data:a,error:o}=await Q.from("touchpoint_plans").update({name:n,description:s}).eq("id",t).select().single();if(o)throw o;return a},onSuccess:()=>{e.invalidateQueries({queryKey:["touchpoint-plans"]}),ka({title:"Plan updated successfully"})}})},xgt=()=>{const e=Hr();return ir({mutationFn:async t=>{const{error:n}=await Q.from("touchpoint_plans").delete().eq("id",t);if(n)throw n},onSuccess:()=>{e.invalidateQueries({queryKey:["touchpoint-plans"]}),ka({title:"Plan deleted successfully"})}})},ygt=()=>{const e=Hr();return ir({mutationFn:async({planId:t,items:n})=>{if(await Q.from("touchpoint_plan_items").delete().eq("plan_id",t),n.length>0){const{error:s}=await Q.from("touchpoint_plan_items").insert(n.map(a=>({plan_id:t,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:()=>{e.invalidateQueries({queryKey:["touchpoint-plans"]}),ka({title:"Plan schedule updated"})}})},vgt=()=>{const e=Hr();return ir({mutationFn:async({actionTypeId:t,title:n,scriptBody:s,emailSubject:a,tone:o})=>{const{data:{user:l}}=await Q.auth.getUser(),{data:i,error:u}=await Q.from("action_scripts").insert({action_type_id:t,title:n,script_body:s,email_subject:a||null,tone:o||null,active:!0,user_id:l==null?void 0:l.id}).select().single();if(u)throw u;return i},onSuccess:()=>{e.invalidateQueries({queryKey:["action-scripts"]}),ka({title:"Script created successfully"})},onError:t=>{ka({title:"Error creating script",description:t.message,variant:"destructive"})}})},_gt=()=>{const e=Kc();return Kt({queryKey:["user-plan-enrollments",e],queryFn:async()=>{const{data:t,error:n}=await Q.from("user_plan_enrollments").select(` *, plan:touchpoint_plans(*), relationship_type:relationship_types(*) `);if(n)throw n;return t},enabled:!!e})},bgt=()=>{const e=Hr(),t=Kc();return ir({mutationFn:async({planId:n,relationshipTypeId:s,active:a})=>{const{data:o}=await Q.from("user_plan_enrollments").select("id").eq("plan_id",n).eq("relationship_type_id",s).maybeSingle();if(o){const{error:l}=await Q.from("user_plan_enrollments").update({active:a}).eq("id",o.id);if(l)throw l}else if(a){const{error:l}=await Q.from("user_plan_enrollments").insert({owner_user_id:t,plan_id:n,relationship_type_id:s,active:!0,start_date:new Date().toISOString().split("T")[0]});if(l)throw l}},onSuccess:()=>{e.invalidateQueries({queryKey:["user-plan-enrollments"]}),ka({title:"Plan enrollment updated"})}})},cae=(e=7)=>{const t=Kc();return Kt({queryKey:["contact-touch-logs",t,e],queryFn:async()=>{const n=new Date;n.setDate(n.getDate()-e);const{data:s,error:a}=await Q.from("contact_touch_logs").select(` *, contact:innercircle_contacts(*), action_type:action_types(*) `).gte("completed_at",n.toISOString()).order("completed_at",{ascending:!1});if(a)throw a;return s},enabled:!!t})},xRe=()=>{const e=Kc();return Kt({queryKey:["contacts-last-touch",e],queryFn:async()=>{const{data:t,error:n}=await Q.from("contact_touch_logs").select("contact_id, completed_at").order("completed_at",{ascending:!1});if(n)throw n;const s={};return t==null||t.forEach(a=>{s[a.contact_id]||(s[a.contact_id]=a.completed_at)}),s},enabled:!!e})},wgt=(e=90)=>{const{data:t}=jp(),{data:n}=xRe();if(!t||!n)return{contacts:[],count:0};const s=new Date;s.setDate(s.getDate()-e);const a=t.filter(o=>{const l=n[o.id];return l?new Date(l){const e=Hr(),t=Kc();return ir({mutationFn:async({contactId:n,actionTypeId:s,scriptUsedId:a,notes:o})=>{const{data:l,error:i}=await Q.from("contact_touch_logs").insert({owner_user_id:t,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:()=>{e.invalidateQueries({queryKey:["contact-touch-logs"]}),e.invalidateQueries({queryKey:["contacts-last-touch"]}),e.invalidateQueries({queryKey:["today-actions"]}),ka({title:"Action completed!"})}})},vRe="agentos_weekly_touch_goal",ZNe=20,sre=()=>{if(typeof window>"u")return ZNe;const e=localStorage.getItem(vRe);if(e){const t=parseInt(e,10);if(!isNaN(t)&&t>0)return t}return ZNe},_Re=e=>{localStorage.setItem(vRe,e.toString())},bRe=()=>{const{data:e}=cae(7),t=new Date;t.setHours(0,0,0,0);const n=new Date(t);n.setDate(t.getDate()-t.getDay());const s=(e==null?void 0:e.filter(l=>new Date(l.completed_at)>=n).length)||0;let a=0;if(e&&e.length>0){const l=new Set(e.map(u=>new Date(u.completed_at).toDateString()));let i=new Date(t);for(;l.has(i.toDateString());)a++,i.setDate(i.getDate()-1)}const o=sre();return{actionsThisWeek:s,weeklyGoal:o,streak:a,progress:Math.min(s/o*100,100)}},jgt=()=>{const e=Kc();return Kt({queryKey:["contact-plan-cycles",e],queryFn:async()=>{const{data:t,error:n}=await Q.from("contact_plan_cycles").select(` *, contact:innercircle_contacts(*), plan:touchpoint_plans( *, items:touchpoint_plan_items( *, action_type:action_types(*), default_script:action_scripts(*) ) ) `);if(n)throw n;return t},enabled:!!e})},kgt=()=>{const e=Hr();return Kc(),ir({mutationFn:async()=>{const{data:t}=await Q.from("user_plan_enrollments").select("*").eq("active",!0);if(!t||t.length===0)return;const{data:n}=await Q.from("innercircle_contacts").select(` id, tags:innercircle_contact_tags(relationship_type_id) `);if(!n)return;const{data:s}=await Q.from("contact_plan_cycles").select("contact_id, plan_id"),a=new Set((s==null?void 0:s.map(l=>`${l.contact_id}-${l.plan_id}`))||[]),o=[];for(const l of n)for(const i of l.tags||[]){const u=t.find(p=>p.relationship_type_id===i.relationship_type_id);u&&!a.has(`${l.id}-${u.plan_id}`)&&o.push({contact_id:l.id,plan_id:u.plan_id,relationship_type_id:i.relationship_type_id})}if(o.length>0){const{error:l}=await Q.from("contact_plan_cycles").insert(o);if(l)throw l}return o.length},onSuccess:t=>{e.invalidateQueries({queryKey:["contact-plan-cycles"]}),t&&t>0&&ka({title:`${t} contact(s) enrolled in plans`})}})},wRe=()=>{const e=Kc(),{data:t}=jgt(),{data:n}=cae(30);return Kt({queryKey:["today-actions",e,t==null?void 0:t.length,n==null?void 0:n.length],queryFn:async()=>{var S;if(!t||t.length===0)return[];const{data:s}=await Q.from("contact_snoozes").select("contact_id").gte("snoozed_until",new Date().toISOString()),a=new Set((s==null?void 0:s.map(k=>k.contact_id))||[]),o=new Date,l=[],i=new Date(o.getFullYear(),o.getMonth(),1),u=new Set((n==null?void 0:n.filter(k=>new Date(k.completed_at)>=i).map(k=>`${k.contact_id}-${k.action_type_id}`))||[]);for(const k of t){if(!((S=k.plan)!=null&&S.items)||k.plan.items.length===0||!k.contact||a.has(k.contact_id))continue;const M=new Date(k.cycle_start_date),T=Math.floor((o.getTime()-M.getTime())/(30.44*24*60*60*1e3))%12+1,I=k.plan.items.find(z=>z.month_number===T);if(I&&I.action_type){const z=`${k.contact_id}-${I.action_type_id}`;if(!u.has(z)){const{data:D}=await Q.from("relationship_types").select("name").eq("id",k.relationship_type_id).single();l.push({contact:k.contact,actionType:I.action_type,script:I.default_script||void 0,planName:k.plan.name,relationshipTypeName:(D==null?void 0:D.name)||"",monthNumber:T})}}}const p=5,x=o.getDate(),y=l.sort((k,M)=>k.contact.first_name.localeCompare(M.contact.first_name)),_=(x-1)%Math.max(1,y.length);return[...y.slice(_),...y.slice(0,_)].slice(0,p)},enabled:!!e&&!!t})};function Ngt(){const e=Gn(),{data:t,isLoading:n}=wRe(),{data:s}=jp(),a=bRe(),[o,l]=E.useState(sre()),[i,u]=E.useState(""),[p,x]=E.useState(!1);E.useEffect(()=>{l(sre())},[]);const y=()=>{const U=parseInt(i,10);if(isNaN(U)||U<1){ka({title:"Invalid goal",description:"Please enter a number greater than 0",variant:"destructive"});return}l(U),_Re(U),x(!1),ka({title:"Goal updated",description:`Weekly touch goal set to ${U}`})},_=()=>{u(o.toString()),x(!0)},b=Sf(new Date),S=Ql(b,7),k=U=>{if(!U)return null;const V=U.split(/[-/T]/);if(V.length<3)return null;const W=parseInt(V[1],10)-1,G=parseInt(V[2],10);return isNaN(W)||isNaN(G)?null:new Date(b.getFullYear(),W,G)},M=(s==null?void 0:s.map(U=>{const V=k(U.birthday),W=k(U.home_anniversary),G=[];return V&&V>=b&&V<=S&&G.push({contact:U,type:"birthday",date:V,isToday:ac(V,b)}),W&&W>=b&&W<=S&&G.push({contact:U,type:"anniversary",date:W,isToday:ac(W,b)}),G}).flat().sort((U,V)=>U.date.getTime()-V.date.getTime()).slice(0,3))||[],P=(s==null?void 0:s.filter(U=>{const V=k(U.birthday),W=k(U.home_anniversary);return V&&ac(V,b)||W&&ac(W,b)}).length)||0,T=(t==null?void 0:t.length)||0,I=P+T,z=(a==null?void 0:a.actionsThisWeek)||0,D=(a==null?void 0:a.streak)||0;return n?r.jsx(Ze,{className:"bg-gradient-to-br from-primary/5 via-primary/10 to-primary/5 border-primary/20",children:r.jsx(et,{className:"p-4",children:r.jsxs("div",{className:"animate-pulse flex items-center gap-4",children:[r.jsx("div",{className:"h-12 w-12 bg-primary/20 rounded-lg"}),r.jsxs("div",{className:"flex-1 space-y-2",children:[r.jsx("div",{className:"h-4 bg-primary/20 rounded w-1/3"}),r.jsx("div",{className:"h-3 bg-primary/10 rounded w-1/2"})]})]})})}):r.jsxs(Ze,{className:"bg-gradient-to-br from-primary/5 via-primary/10 to-primary/5 border-primary/20",children:[r.jsxs(Wt,{className:"pb-2",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs(Yt,{className:"text-lg flex items-center gap-2",children:[r.jsx(Un,{className:"h-5 w-5 text-primary"}),"Agent OS"]}),r.jsx("div",{className:"flex items-center gap-2",children:D>0&&r.jsxs(Pt,{variant:"secondary",className:"gap-1 bg-orange-500/10 text-orange-600 border-orange-200",children:[r.jsx(ff,{className:"h-3 w-3"}),D," day streak"]})})]}),r.jsxs("p",{className:"text-sm text-muted-foreground",children:[I>0?r.jsxs(r.Fragment,{children:[r.jsxs("span",{className:"text-primary font-medium",children:[I," tasks"]})," for today"]}):"No tasks for today",z>0&&r.jsxs("span",{className:"ml-2",children:["• ",r.jsx("span",{className:"text-emerald-600 font-medium",children:z})," touches this week"]})]})]}),r.jsxs(et,{className:"space-y-4",children:[r.jsxs("div",{className:"flex flex-wrap gap-2",children:[r.jsxs(ee,{size:"sm",variant:"outline",className:"gap-1.5",onClick:U=>{U.stopPropagation(),e("/mission-control/contacts?new=true")},children:[r.jsx(vf,{className:"h-3.5 w-3.5"}),"Add Contact"]}),r.jsxs(ee,{size:"sm",variant:"outline",className:"gap-1.5",onClick:U=>{U.stopPropagation(),e("/mission-control")},children:[r.jsx(Ti,{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:U=>{U.stopPropagation(),e("/mission-control/video/record")},children:[r.jsx($a,{className:"h-3.5 w-3.5"}),"Quick Video"]}),r.jsxs(ee,{size:"sm",variant:"outline",className:"gap-1.5",onClick:U=>{U.stopPropagation(),e("/mission-control/popbys")},children:[r.jsx(Po,{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:U=>{U.stopPropagation(),e("/mission-control/pipeline")},children:[r.jsx(uy,{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(my,{className:"h-4 w-4 text-primary"}),r.jsx("span",{className:"text-sm font-medium",children:"Weekly Goal"}),r.jsxs(Or,{open:p,onOpenChange:x,children:[r.jsx(Zo,{asChild:!0,children:r.jsx("button",{onClick:_,className:"p-0.5 rounded hover:bg-muted transition-colors","aria-label":"Edit weekly goal",children:r.jsx(Fd,{className:"h-3.5 w-3.5 text-muted-foreground hover:text-primary"})})}),r.jsxs(Ir,{className:"sm:max-w-[360px]",children:[r.jsxs($r,{children:[r.jsx(Fr,{children:"Set Weekly Goal"}),r.jsx(Zn,{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($e,{htmlFor:"weekly-goal",children:"Weekly touch goal"}),r.jsx(dt,{id:"weekly-goal",type:"number",min:"1",value:i,onChange:U=>u(U.target.value),placeholder:"20",onKeyDown:U=>{U.key==="Enter"&&y()}})]}),r.jsx(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(pd,{value:Math.min(z/o*100,100),className:"h-2 bg-muted [&>div]:bg-primary"}),z>=o&&r.jsxs("p",{className:"text-xs text-emerald-600 mt-1.5 flex items-center gap-1",children:[r.jsx("span",{children:"🎉"})," Goal achieved! Keep the momentum going."]}),z0&&r.jsxs("p",{className:"text-xs text-muted-foreground mt-1.5",children:[o-z," more to hit your weekly goal"]})]}),M.length>0&&r.jsxs("div",{className:"pt-3 border-t border-border/50",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[r.jsx(hf,{className:"h-4 w-4 text-pink-500"}),r.jsx("span",{className:"text-sm font-medium",children:"Upcoming Milestones"})]}),r.jsx("div",{className:"space-y-2",children:M.map((U,V)=>r.jsxs("div",{className:`flex items-center justify-between p-2 rounded-lg cursor-pointer transition-colors ${U.isToday?"bg-pink-500/10 hover:bg-pink-500/15":"bg-muted/50 hover:bg-muted"}`,onClick:W=>{W.stopPropagation(),e(`/mission-control/contacts/${U.contact.id}`)},children:[r.jsxs("div",{className:"flex items-center gap-2",children:[U.type==="birthday"?r.jsx(hf,{className:"h-3.5 w-3.5 text-pink-500"}):r.jsx(xa,{className:"h-3.5 w-3.5 text-blue-500"}),r.jsxs("span",{className:"text-sm",children:[U.contact.first_name," ",U.contact.last_name]}),U.isToday&&r.jsx(Pt,{variant:"secondary",className:"text-[10px] px-1.5 py-0 bg-pink-500/20 text-pink-600",children:"Today!"})]}),r.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[r.jsx("span",{children:U.isToday?U.type==="birthday"?"🎂":"🏠":on(U.date,"EEE, MMM d")}),r.jsx(Wi,{className:"h-3 w-3"})]})]},`${U.contact.id}-${U.type}-${V}`))})]}),r.jsxs(ee,{variant:"ghost",size:"sm",className:"w-full gap-1 text-muted-foreground hover:text-primary",onClick:()=>e("/mission-control"),children:["Open Agent OS",r.jsx(Vo,{className:"h-4 w-4"})]})]})]})}const jRe=()=>Kt({queryKey:["listing-exchange-enabled"],queryFn:async()=>{const{data:e,error:t}=await Q.from("feature_flags").select("enabled").eq("key","listing_exchange_enabled").maybeSingle();if(t)throw t;return(e==null?void 0:e.enabled)??!1}}),kRe=e=>{const{user:t,brokerageId:n}=tn();return Kt({queryKey:["listings",e,n],queryFn:async()=>{let s=Q.from("listings").select(` *, photos:listing_photos(*), agent:profiles!listings_agent_id_fkey(id, name, email, brokerage_id, brokerage:brokerages(name)) `).eq("is_approved",!0).eq("is_public",!0);e!=null&&e.status&&(s=s.eq("status",e.status)),e!=null&&e.propertyType&&(s=s.eq("property_type",e.propertyType)),e!=null&&e.city&&(s=s.ilike("city",`%${e.city}%`)),e!=null&&e.minPrice&&(s=s.gte("price",e.minPrice)),e!=null&&e.maxPrice&&(s=s.lte("price",e.maxPrice)),e!=null&&e.openToReferrals&&(s=s.eq("open_to_referrals",!0));const{data:a,error:o}=await s;if(o)throw o;let l=a||[];if(n){const{data:i}=await Q.from("profiles").select("id").eq("brokerage_id",n);if(i&&i.length>0){const u=i.map(y=>y.id);let p=Q.from("listings").select(` *, photos:listing_photos(*), agent:profiles!listings_agent_id_fkey(id, name, email, brokerage_id, brokerage:brokerages(name)) `).eq("is_approved",!0).eq("share_with_brokerage",!0).eq("is_public",!1).in("agent_id",u);e!=null&&e.status&&(p=p.eq("status",e.status)),e!=null&&e.propertyType&&(p=p.eq("property_type",e.propertyType)),e!=null&&e.city&&(p=p.ilike("city",`%${e.city}%`)),e!=null&&e.minPrice&&(p=p.gte("price",e.minPrice)),e!=null&&e.maxPrice&&(p=p.lte("price",e.maxPrice)),e!=null&&e.openToReferrals&&(p=p.eq("open_to_referrals",!0));const{data:x}=await p;if(x){const y=new Set(l.map(b=>b.id)),_=x.filter(b=>!y.has(b.id));l=[...l,..._]}}}switch(e==null?void 0:e.sortBy){case"updated":l.sort((i,u)=>new Date(u.updated_at).getTime()-new Date(i.updated_at).getTime());break;case"price_asc":l.sort((i,u)=>i.price-u.price);break;case"price_desc":l.sort((i,u)=>u.price-i.price);break;default:l.sort((i,u)=>new Date(u.created_at).getTime()-new Date(i.created_at).getTime())}return l}})},NRe=()=>{const{user:e}=tn();return Kt({queryKey:["my-listings",e==null?void 0:e.id],queryFn:async()=>{if(!e)return[];const{data:t,error:n}=await Q.from("listings").select(` *, photos:listing_photos(*) `).eq("agent_id",e.id).order("created_at",{ascending:!1});if(n)throw n;return t},enabled:!!e})},SRe=e=>{const{user:t}=tn();return Kt({queryKey:["listing",e],queryFn:async()=>{const{data:n,error:s}=await Q.from("listings").select(` *, photos:listing_photos(*), agent:profiles!listings_agent_id_fkey(id, name, email, brokerage_id, brokerage:brokerages(name)), video:agent_videos!listings_video_id_fkey(id, playback_url, thumbnail_url, title, duration_seconds) `).eq("id",e).single();if(s)throw s;return t&&await Q.from("listing_views").insert({listing_id:e,viewer_id:t.id}),n},enabled:!!e})},Sgt=()=>{const e=Hr(),{user:t}=tn();return ir({mutationFn:async n=>{if(!t)throw new Error("Not authenticated");const{data:s,error:a}=await Q.from("listings").insert({...n,agent_id:t.id}).select().single();if(a)throw a;return s},onSuccess:()=>{e.invalidateQueries({queryKey:["listings"]}),e.invalidateQueries({queryKey:["my-listings"]})}})},Cgt=()=>{const e=Hr();return ir({mutationFn:async({agentId:t,...n})=>{const{data:s,error:a}=await Q.from("listings").insert({...n,agent_id:t}).select().single();if(a)throw a;return s},onSuccess:()=>{e.invalidateQueries({queryKey:["listings"]}),e.invalidateQueries({queryKey:["my-listings"]}),e.invalidateQueries({queryKey:["brokerage-listings"]})}})},Mgt=()=>{const e=Hr();return ir({mutationFn:async({id:t,...n})=>{const{data:s,error:a}=await Q.from("listings").update(n).eq("id",t).select().single();if(a)throw a;return s},onSuccess:t=>{e.invalidateQueries({queryKey:["listings"]}),e.invalidateQueries({queryKey:["my-listings"]}),e.invalidateQueries({queryKey:["listing",t.id]})}})},CRe=()=>{const e=Hr();return ir({mutationFn:async t=>{const{error:n}=await Q.from("listings").delete().eq("id",t);if(n)throw n},onSuccess:()=>{e.invalidateQueries({queryKey:["listings"]}),e.invalidateQueries({queryKey:["my-listings"]})}})},Tgt=()=>{const e=Hr();return ir({mutationFn:async({listingId:t,photoUrl:n,isPrimary:s=!1})=>{const{data:a,error:o}=await Q.from("listing_photos").insert({listing_id:t,photo_url:n,is_primary:s}).select().single();if(o)throw o;return a},onSuccess:t=>{e.invalidateQueries({queryKey:["listing",t.listing_id]}),e.invalidateQueries({queryKey:["my-listings"]})}})},Agt=()=>{const e=Hr();return ir({mutationFn:async({photoId:t,listingId:n})=>{const{error:s}=await Q.from("listing_photos").delete().eq("id",t);if(s)throw s;return n},onSuccess:t=>{e.invalidateQueries({queryKey:["listing",t]}),e.invalidateQueries({queryKey:["my-listings"]})}})},Egt=()=>{const{user:e}=tn();return Kt({queryKey:["saved-listings",e==null?void 0:e.id],queryFn:async()=>{if(!e)return[];const{data:t,error:n}=await Q.from("listing_saves").select(` *, listing:listings( *, photos:listing_photos(*), agent:profiles!listings_agent_id_fkey(id, name, email, brokerage_id) ) `).eq("agent_id",e.id);if(n)throw n;return t},enabled:!!e})},MRe=()=>{const e=Hr(),{user:t}=tn();return ir({mutationFn:async n=>{if(!t)throw new Error("Not authenticated");const{data:s}=await Q.from("listing_saves").select("id").eq("listing_id",n).eq("agent_id",t.id).maybeSingle();return s?(await Q.from("listing_saves").delete().eq("id",s.id),{saved:!1}):(await Q.from("listing_saves").insert({listing_id:n,agent_id:t.id}),{saved:!0})},onSuccess:()=>{e.invalidateQueries({queryKey:["saved-listings"]}),e.invalidateQueries({queryKey:["listings"]})}})},TRe=e=>{const{user:t}=tn();return Kt({queryKey:["listing-saved",e,t==null?void 0:t.id],queryFn:async()=>{if(!t)return!1;const{data:n}=await Q.from("listing_saves").select("id").eq("listing_id",e).eq("agent_id",t.id).maybeSingle();return!!n},enabled:!!t&&!!e})},Igt=()=>{const e=Hr(),{user:t}=tn();return ir({mutationFn:async n=>{if(!t)throw new Error("Not authenticated");const{data:s}=await Q.from("listing_follows").select("id").eq("listing_id",n).eq("agent_id",t.id).maybeSingle();return s?(await Q.from("listing_follows").delete().eq("id",s.id),{following:!1}):(await Q.from("listing_follows").insert({listing_id:n,agent_id:t.id}),{following:!0})},onSuccess:()=>{e.invalidateQueries({queryKey:["listing-following"]})}})},Pgt=e=>{const{user:t}=tn();return Kt({queryKey:["listing-following",e,t==null?void 0:t.id],queryFn:async()=>{if(!t)return!1;const{data:n}=await Q.from("listing_follows").select("id").eq("listing_id",e).eq("agent_id",t.id).maybeSingle();return!!n},enabled:!!t&&!!e})},Lgt=()=>{const{user:e}=tn();return ir({mutationFn:async({listingId:t,shareType:n})=>{if(!e)throw new Error("Not authenticated");const{error:s}=await Q.from("listing_shares").insert({listing_id:t,sharing_agent_id:e.id,share_type:n});if(s)throw s}})},Ogt=()=>{const{user:e}=tn();return Kt({queryKey:["my-referrals",e==null?void 0:e.id],queryFn:async()=>{if(!e)return{sent:[],received:[]};const[t,n]=await Promise.all([Q.from("listing_referrals").select(` *, listing:listings(*,photos:listing_photos(*)) `).eq("sender_agent_id",e.id).order("created_at",{ascending:!1}),Q.from("listing_referrals").select(` *, sender:profiles!listing_referrals_sender_agent_id_fkey(id, name, email), listing:listings(*,photos:listing_photos(*)) `).eq("listing_agent_id",e.id).order("created_at",{ascending:!1})]);return{sent:t.data||[],received:n.data||[]}},enabled:!!e})},Dgt=()=>{const e=Hr(),{user:t}=tn();return ir({mutationFn:async({listingId:n,listingAgentId:s,buyerName:a,buyerType:o,notes:l})=>{if(!t)throw new Error("Not authenticated");const{data:i,error:u}=await Q.from("listing_referrals").insert({listing_id:n,sender_agent_id:t.id,listing_agent_id:s,buyer_name:a,buyer_type:o,notes:l}).select().single();if(u)throw u;return i},onSuccess:()=>{e.invalidateQueries({queryKey:["my-referrals"]})}})},Rgt=()=>Kt({queryKey:["listing-leaderboard"],queryFn:async()=>{const{data:e}=await Q.from("listing_shares").select("sharing_agent_id, profiles!listing_shares_agent_id_fkey(name)").order("created_at",{ascending:!1}),t=new Map;e==null||e.forEach(l=>{var p;const i=l.sharing_agent_id;if(!i)return;const u=t.get(i);u?u.count++:t.set(i,{name:((p=l.profiles)==null?void 0:p.name)||"Unknown",count:1})});const n=Array.from(t.entries()).map(([l,i])=>({agentId:l,...i})).sort((l,i)=>i.count-l.count).slice(0,10),{data:s}=await Q.from("listings").select("agent_id, agent:profiles!listings_agent_id_fkey(name)").eq("is_approved",!0),a=new Map;s==null||s.forEach(l=>{var u;const i=a.get(l.agent_id);i?i.count++:a.set(l.agent_id,{name:((u=l.agent)==null?void 0:u.name)||"Unknown",count:1})});const o=Array.from(a.entries()).map(([l,i])=>({agentId:l,...i})).sort((l,i)=>i.count-l.count).slice(0,10);return{topSharers:n,topListers:o}}}),Fgt=()=>{const{user:e,brokerageId:t}=tn();return Kt({queryKey:["brokerage-listings",t],queryFn:async()=>{if(!e||!t)return[];const{data:n}=await Q.from("profiles").select("id").eq("brokerage_id",t);if(!n||n.length===0)return[];const s=n.map(l=>l.id),{data:a,error:o}=await Q.from("listings").select(` *, photos:listing_photos(*), agent:profiles!listings_agent_id_fkey(id, name, email, brokerage_id, brokerage:brokerages(name)) `).in("agent_id",s).eq("is_approved",!0).order("created_at",{ascending:!1});if(o)throw o;return a},enabled:!!e&&!!t})},zgt=({className:e,variant:t="default"})=>r.jsx(Pt,{variant:"outline",className:Bt("text-[10px] font-semibold uppercase tracking-wide px-1.5 py-0 h-4",t==="default"?"border-amber-500 text-amber-600 dark:text-amber-400 bg-amber-500/10":"border-muted-foreground/30 text-muted-foreground",e),children:"Beta"}),Bgt={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"},$gt={coming_soon:"Coming Soon",active:"Active",under_contract:"Under Contract",sold:"Sold",withdrawn:"Withdrawn"};function Ugt(e){return e>=1e6?`$${(e/1e6).toFixed(1)}M`:`$${(e/1e3).toFixed(0)}K`}function qgt(){const e=Gn(),{data:t,isLoading:n}=jRe(),{data:s,isLoading:a}=kRe({status:void 0,propertyType:void 0,sortBy:"newest"}),o=(s==null?void 0:s.filter(x=>x.is_approved&&x.is_public))||[],l=o.filter(x=>x.is_featured),i=o.filter(x=>!x.is_featured),u=[...l,...i].slice(0,6),p=n||a;return!p&&!t?null:p?r.jsx(Ze,{className:"bg-gradient-to-br from-emerald-500/5 via-emerald-500/10 to-emerald-500/5 border-emerald-500/20",children:r.jsx(et,{className:"p-4",children:r.jsxs("div",{className:"animate-pulse flex items-center gap-4",children:[r.jsx("div",{className:"h-12 w-12 bg-emerald-500/20 rounded-lg"}),r.jsxs("div",{className:"flex-1 space-y-2",children:[r.jsx("div",{className:"h-4 bg-emerald-500/20 rounded w-1/3"}),r.jsx("div",{className:"h-3 bg-emerald-500/10 rounded w-1/2"})]})]})})}):r.jsxs("section",{className:"mb-10",children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("h3",{className:"text-lg font-semibold text-foreground",children:"Listing Exchange"}),r.jsx(zgt,{})]}),r.jsxs(ee,{variant:"ghost",size:"sm",onClick:()=>e("/mission-control/listings"),className:"gap-1 text-muted-foreground hover:text-foreground",children:["View All ",r.jsx(Vo,{className:"h-4 w-4"})]})]}),u.length===0?r.jsx(Ze,{className:"bg-muted/30 border-dashed",children:r.jsx(et,{className:"flex items-center justify-center py-8",children:r.jsxs("div",{className:"text-center",children:[r.jsx(xa,{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:()=>e("/mission-control/listings/new"),className:"mt-2",children:"Add the first listing"})]})})}):r.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-6 gap-3",children:u.map(x=>{var _,b;const y=((_=x.photos)==null?void 0:_.find(S=>S.is_primary))||((b=x.photos)==null?void 0:b[0]);return r.jsxs("div",{onClick:()=>e(`/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(xa,{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(Pt,{className:"gap-1 bg-amber-500 text-white border-0 text-[10px] px-1.5 py-0.5",children:[r.jsx(js,{className:"h-2.5 w-2.5 fill-current"}),"Featured"]})}),r.jsx("div",{className:"absolute top-1.5 right-1.5",children:r.jsx(Pt,{className:`text-[10px] px-1.5 py-0.5 ${Bgt[x.status]}`,children:$gt[x.status]})})]}),r.jsxs("div",{className:"p-2",children:[r.jsx("p",{className:"font-bold text-sm text-foreground",children:Ugt(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 ARe(e=10,t){return Kt({queryKey:["event-leaderboard",e,t],queryFn:async()=>{const{data:n}=await Q.from("user_roles").select("user_id").eq("role","admin"),s=new Set((n==null?void 0:n.map(_=>_.user_id))||[]);let a=null;if(t){const{data:_}=await Q.from("profiles").select("id").eq("brokerage_id",t);a=new Set((_==null?void 0:_.map(b=>b.id))||[])}const{data:o,error:l}=await Q.from("agent_attendance_stats").select("user_id, total_points, total_events_attended, current_streak").order("total_points",{ascending:!1}).limit(e+s.size+50);if(l)throw l;if(!o||o.length===0)return[];let i=o.filter(_=>!s.has(_.user_id));a&&(i=i.filter(_=>a.has(_.user_id)));const u=i.slice(0,e),p=u.map(_=>_.user_id),{data:x}=await Q.from("profiles").select("id, name").in("id",p),y=new Map((x==null?void 0:x.map(_=>[_.id,{name:_.name}]))||[]);return u.map(_=>({user_id:_.user_id,total_points:_.total_points,total_events_attended:_.total_events_attended,current_streak:_.current_streak,profile:y.get(_.user_id)||null}))}})}function ERe(e){return Kt({queryKey:["user-attendance-stats",e],queryFn:async()=>{if(!e)return null;const{data:t,error:n}=await Q.from("agent_attendance_stats").select("*").eq("user_id",e).single();if(n&&n.code!=="PGRST116")throw n;return t},enabled:!!e})}function IRe(e){return Kt({queryKey:["user-badges",e],queryFn:async()=>{if(!e)return[];const{data:t,error:n}=await Q.from("agent_badges").select("*").eq("user_id",e).order("earned_at",{ascending:!1});if(n)throw n;return t},enabled:!!e})}function PRe(e,t){return Kt({queryKey:["user-rank",e,t],queryFn:async()=>{if(!e)return null;const{data:n}=await Q.from("agent_attendance_stats").select("total_points").eq("user_id",e).single();if(!n)return null;const{data:s}=await Q.from("user_roles").select("user_id").eq("role","admin"),a=new Set((s==null?void 0:s.map(u=>u.user_id))||[]),{data:o,error:l}=await Q.from("agent_attendance_stats").select("user_id, total_points").gt("total_points",n.total_points);if(l)throw l;let i=(o==null?void 0:o.filter(u=>!a.has(u.user_id)))||[];if(t){const{data:u}=await Q.from("profiles").select("id").eq("brokerage_id",t),p=new Set((u==null?void 0:u.map(x=>x.id))||[]);i=i.filter(x=>p.has(x.user_id))}return i.length+1},enabled:!!e})}function Vgt(){const{user:e,brokerageId:t,isAdmin:n}=tn();Gn();const s=!!t,[a,o]=E.useState("brokerage"),l=()=>{if(n)return null;if(s)return a==="global"?null:t},{data:i,isLoading:u}=ARe(5,l()),{data:p}=ERe(e==null?void 0:e.id),{data:x}=PRe(e==null?void 0:e.id,l()),{data:y}=IRe(e==null?void 0:e.id),_=n||s,b=()=>n?"Agent Leaderboard":s?a==="global"?"All LevelUp":"My Brokerage":"My Points";if(u)return r.jsxs(Ze,{children:[r.jsx(Wt,{className:"pb-2",children:r.jsxs(Yt,{className:"text-base flex items-center gap-2",children:[r.jsx(ro,{className:"h-4 w-4 text-yellow-500"}),b()]})}),r.jsx(et,{children:r.jsx("div",{className:"space-y-2",children:[...Array(_?5:3)].map((k,M)=>r.jsx(Lr,{className:"h-10 w-full"},M))})})]});const S=k=>k===0?r.jsx(ro,{className:"h-4 w-4 text-yellow-500 mx-auto"}):k===1?r.jsx("span",{className:"text-sm font-medium text-gray-400",children:"2"}):k===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:k+1});if(_){const k=(i==null?void 0:i.slice(0,5))||[];return r.jsxs(Ze,{children:[r.jsxs(Wt,{className:"pb-2",children:[r.jsxs(Yt,{className:"text-base flex items-center gap-2",children:[r.jsx(ro,{className:"h-4 w-4 text-yellow-500"}),b()]}),!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(et,{children:[!n&&p&&r.jsx("div",{className:"mb-3 p-2 rounded-lg bg-primary/5 border border-primary/10",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-sm text-muted-foreground",children:"Your Rank:"}),r.jsxs("span",{className:"font-bold text-primary",children:["#",x||"-"]})]}),r.jsxs("div",{className:"flex items-center gap-3 text-sm",children:[r.jsxs("span",{children:[r.jsx("strong",{className:"text-primary",children:p.total_points})," pts"]}),r.jsxs("span",{children:[r.jsx("strong",{children:p.total_events_attended})," events"]})]})]})}),r.jsxs("div",{className:"space-y-2",children:[k.map((M,P)=>{var T,I,z;return r.jsxs("div",{className:`flex items-center gap-2 p-2 rounded-lg ${M.user_id===(e==null?void 0:e.id)?"bg-primary/10 border border-primary/20":P===0?"bg-yellow-500/10":""}`,children:[r.jsx("div",{className:"w-5 text-center",children:S(P)}),r.jsx(Qs,{className:"h-6 w-6",children:r.jsx(Js,{className:"text-xs",children:((I=(T=M.profile)==null?void 0:T.name)==null?void 0:I.charAt(0))||"?"})}),r.jsx("span",{className:"flex-1 text-sm font-medium truncate",children:((z=M.profile)==null?void 0:z.name)||"Unknown"}),r.jsx("span",{className:"text-sm font-bold text-primary",children:M.total_points})]},M.user_id)}),k.length===0&&r.jsx("div",{className:"text-center text-muted-foreground py-2 text-sm",children:"No data yet"})]}),r.jsxs(oo,{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(to,{className:"h-4 w-4"}),"Spend Points in Reward Store",r.jsx(Wi,{className:"h-4 w-4"})]})]})]})}return r.jsxs(Ze,{children:[r.jsx(Wt,{className:"pb-2",children:r.jsxs(Yt,{className:"text-base flex items-center gap-2",children:[r.jsx(ro,{className:"h-4 w-4 text-yellow-500"}),"My Points"]})}),r.jsx(et,{children:p?r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[r.jsxs("div",{className:"p-3 rounded-lg bg-primary/5 border border-primary/10 text-center",children:[r.jsx("div",{className:"text-2xl font-bold text-primary",children:p.total_points}),r.jsx("div",{className:"text-xs text-muted-foreground",children:"Total Points"})]}),r.jsxs("div",{className:"p-3 rounded-lg bg-muted/50 text-center",children:[r.jsx("div",{className:"text-2xl font-bold",children:p.total_events_attended}),r.jsx("div",{className:"text-xs text-muted-foreground",children:"Events Attended"})]})]}),r.jsxs("div",{className:"flex items-center justify-between p-2 rounded-lg bg-orange-500/10 border border-orange-500/20",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(ff,{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(zl,{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(k=>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:k.badge_name},k.id)),y.length>4&&r.jsxs("span",{className:"text-xs text-muted-foreground px-2 py-1",children:["+",y.length-4," more"]})]})]}),r.jsxs(oo,{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(to,{className:"h-4 w-4"}),"Spend Points in Reward Store",r.jsx(Wi,{className:"h-4 w-4"})]})]}):r.jsxs("div",{className:"text-center text-muted-foreground py-4 text-sm",children:[r.jsx(js,{className:"h-8 w-8 mx-auto mb-2 text-muted-foreground/50"}),r.jsx("p",{children:"Attend events to earn points!"}),r.jsxs(oo,{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(to,{className:"h-4 w-4"}),"Visit Reward Store",r.jsx(Wi,{className:"h-4 w-4"})]})]})})]})}const dae=()=>Kt({queryKey:["lead-sources"],queryFn:async()=>{const{data:e,error:t}=await Q.from("lead_sources").select("*").eq("is_active",!0).order("sort_order");if(t)throw t;return e}}),Hgt=()=>{const e=Hr(),{user:t}=tn();return ir({mutationFn:async n=>{const{data:s,error:a}=await Q.from("lead_sources").insert({name:n,owner_user_id:t==null?void 0:t.id,sort_order:100}).select().single();if(a)throw a;return s},onSuccess:()=>{e.invalidateQueries({queryKey:["lead-sources"]}),Ie.success("Lead source added")},onError:n=>{Ie.error("Failed to add lead source"),console.error(n)}})},Dye=(e,t)=>{const{user:n,isAdmin:s}=tn(),a=s&&t?t:n==null?void 0:n.id;return Kt({queryKey:["scorecard-transactions",e,a],queryFn:async()=>{let o=Q.from("scorecard_transactions").select(` *, lead_source:lead_sources(id, name), client_type:relationship_types(id, name), contact:innercircle_contacts(id, first_name, last_name) `).eq("owner_user_id",a).order("close_date",{ascending:!1});e&&(o=o.gte("close_date",`${e}-01-01`).lte("close_date",`${e}-12-31`));const{data:l,error:i}=await o;if(i)throw i;return l},enabled:!!a})},LRe=e=>{const{user:t,isAdmin:n}=tn(),s=n&&e?e:t==null?void 0:t.id;return Kt({queryKey:["scorecard-transactions-all",s],queryFn:async()=>{const{data:a,error:o}=await Q.from("scorecard_transactions").select(` *, lead_source:lead_sources(id, name), client_type:relationship_types(id, name), contact:innercircle_contacts(id, first_name, last_name) `).eq("owner_user_id",s).order("close_date",{ascending:!1});if(o)throw o;return a},enabled:!!s})},uae=()=>{const e=Hr(),{user:t}=tn();return ir({mutationFn:async n=>{const{data:s,error:a}=await Q.from("scorecard_transactions").insert({...n,owner_user_id:t.id}).select().single();if(a)throw a;return s},onSuccess:()=>{e.invalidateQueries({queryKey:["scorecard-transactions"]}),e.invalidateQueries({queryKey:["scorecard-transactions-all"]}),Ie.success("Transaction added")},onError:n=>{Ie.error("Failed to add transaction"),console.error(n)}})},Wgt=()=>{const e=Hr();return ir({mutationFn:async({id:t,...n})=>{const{data:s,error:a}=await Q.from("scorecard_transactions").update(n).eq("id",t).select().single();if(a)throw a;return s},onSuccess:()=>{e.invalidateQueries({queryKey:["scorecard-transactions"]}),e.invalidateQueries({queryKey:["scorecard-transactions-all"]}),Ie.success("Transaction updated")},onError:t=>{Ie.error("Failed to update transaction"),console.error(t)}})},Ggt=()=>{const e=Hr();return ir({mutationFn:async t=>{const{error:n}=await Q.from("scorecard_transactions").delete().eq("id",t);if(n)throw n},onSuccess:()=>{e.invalidateQueries({queryKey:["scorecard-transactions"]}),e.invalidateQueries({queryKey:["scorecard-transactions-all"]}),Ie.success("Transaction deleted")},onError:t=>{Ie.error("Failed to delete transaction"),console.error(t)}})},ORe=(e,t)=>{const{user:n,isAdmin:s}=tn(),a=s&&t?t:n==null?void 0:n.id;return Kt({queryKey:["scorecard-goals",e,a],queryFn:async()=>{const{data:o,error:l}=await Q.from("scorecard_goals").select("*").eq("owner_user_id",a).eq("year",e).maybeSingle();if(l)throw l;return o},enabled:!!a})},Kgt=()=>{const e=Hr(),{user:t}=tn();return ir({mutationFn:async n=>{const{data:s,error:a}=await Q.from("scorecard_goals").upsert({...n,owner_user_id:t.id},{onConflict:"owner_user_id,year"}).select().single();if(a)throw a;return s},onSuccess:(n,s)=>{e.invalidateQueries({queryKey:["scorecard-goals",s.year]}),Ie.success("Goals saved")},onError:n=>{Ie.error("Failed to save goals"),console.error(n)}})},hae=()=>{const{user:e}=tn();return Kt({queryKey:["scorecard-settings",e==null?void 0:e.id],queryFn:async()=>{const{data:t,error:n}=await Q.from("scorecard_settings").select("*").eq("user_id",e.id).maybeSingle();if(n)throw n;return t},enabled:!!(e!=null&&e.id)})},Zgt=()=>{const e=Hr(),{user:t}=tn();return ir({mutationFn:async n=>{const{data:s,error:a}=await Q.from("scorecard_settings").upsert({...n,user_id:t.id},{onConflict:"user_id"}).select().single();if(a)throw a;return s},onSuccess:()=>{e.invalidateQueries({queryKey:["scorecard-settings"]}),Ie.success("Settings saved")},onError:n=>{Ie.error("Failed to save settings"),console.error(n)}})},DRe=(e,t)=>{const{data:n,isLoading:s}=Dye(e,t),{data:a,isLoading:o}=LRe(t),{data:l}=hae(),i=(l==null?void 0:l.show_commission)??!0,u=p=>{if(!p||p.length===0)return{totalTransactions:0,buyerCount:0,sellerCount:0,totalVolume:0,averagePrice:0,totalCommission:0,topLeadSource:null,transactionsByMonth:[],leadSourceBreakdown:[]};const x=p.filter(z=>z.transaction_type==="buyer").length,y=p.filter(z=>z.transaction_type==="seller").length,_=p.reduce((z,D)=>z+Number(D.sale_price),0),b=p.reduce((z,D)=>z+(Number(D.commission_amount)||0),0),S={};p.forEach(z=>{var U;const D=((U=z.lead_source)==null?void 0:U.name)||"Unknown";S[D]=(S[D]||0)+1});const k=Object.entries(S).map(([z,D])=>({name:z,count:D})).sort((z,D)=>D.count-z.count),M=k[0]||null,P={};p.forEach(z=>{const D=new Date(z.close_date).toLocaleString("default",{month:"short"});P[D]=(P[D]||0)+1});const I=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"].map(z=>({month:z,count:P[z]||0}));return{totalTransactions:p.length,buyerCount:x,sellerCount:y,totalVolume:_,averagePrice:p.length>0?_/p.length:0,totalCommission:i?b:0,topLeadSource:M,transactionsByMonth:I,leadSourceBreakdown:k}};return{yearStats:u(n),lifetimeStats:u(a),isLoading:s||o,showCommission:i}},Ygt=()=>{const{isAdmin:e}=tn();return Kt({queryKey:["agents-with-transactions"],queryFn:async()=>{const{data:t,error:n}=await Q.from("scorecard_transactions").select("owner_user_id").order("owner_user_id");if(n)throw n;const s=[...new Set(t.map(l=>l.owner_user_id))],{data:a,error:o}=await Q.from("profiles").select("id, name, email").in("id",s);if(o)throw o;return a},enabled:e})},Y0={recency:40,touchpoints:30,transactions:20},YNe={warm:70,cooling:40};function Xgt(e){return e===null?0:e<=14?Y0.recency:e<=30?Y0.recency*.85:e<=60?Y0.recency*.65:e<=90?Y0.recency*.4:e<=180?Y0.recency*.2:Y0.recency*.05}function Qgt(e){const t=Math.min(e/12,1);return Math.round(Y0.touchpoints*t)}function Jgt(e){return e?Y0.transactions:0}function ext(){return 0}function txt(e){return e>=YNe.warm?"warm":e>=YNe.cooling?"cooling":"at-risk"}function Rye(){const{data:e,isLoading:t}=jp(),{data:n}=xRe(),{data:s}=cae(365),{data:a}=LRe(),o=E.useMemo(()=>{if(!e)return[];const i=new Date,u=Kft(i),p={};s==null||s.forEach(y=>{new Date(y.completed_at)>=u&&(p[y.contact_id]=(p[y.contact_id]||0)+1)});const x=new Set((a==null?void 0:a.filter(y=>y.contact_id).map(y=>y.contact_id))||[]);return e.map(y=>{const _=(n==null?void 0:n[y.id])||null,b=_?Ay(i,new Date(_)):null,S=p[y.id]||0,k=x.has(y.id),M=Xgt(b),P=Qgt(S),T=Jgt(k),I=ext(),z=Math.round(M+P+T+I),D={score:z,status:txt(z),breakdown:{recency:Math.round(M),touchpoints:Math.round(P),transactions:Math.round(T),referrals:Math.round(I)},lastTouchDate:_,daysSinceTouch:b,touchCountLast12Months:S,hasTransaction:k};return{...y,relationshipScore:D}})},[e,n,s,a]),l=E.useMemo(()=>{const i=o.filter(_=>_.relationshipScore.status==="warm").length,u=o.filter(_=>_.relationshipScore.status==="cooling").length,p=o.filter(_=>_.relationshipScore.status==="at-risk").length,x=o.length,y=x>0?Math.round(o.reduce((_,b)=>_+b.relationshipScore.score,0)/x):0;return{warm:i,cooling:u,atRisk:p,total:x,averageScore:y}},[o]);return{contactsWithScores:o,stats:l,isLoading:t}}function RRe(){const e=Gn(),{stats:t,contactsWithScores:n,isLoading:s}=Rye();if(s)return r.jsxs(Ze,{children:[r.jsx(Wt,{className:"pb-2",children:r.jsx(Lr,{className:"h-5 w-40"})}),r.jsxs(et,{className:"space-y-4",children:[r.jsx(Lr,{className:"h-20 w-full"}),r.jsx(Lr,{className:"h-16 w-full"})]})]});if(t.total===0)return r.jsxs(Ze,{children:[r.jsx(Wt,{className:"pb-2",children:r.jsxs(Yt,{className:"text-lg flex items-center gap-2",children:[r.jsx(Un,{className:"h-5 w-5"}),"Relationship Health"]})}),r.jsxs(et,{children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Add contacts to see your relationship health scores."}),r.jsx(ee,{variant:"outline",size:"sm",className:"mt-3",onClick:()=>e("/mission-control/contacts?new=true"),children:"Add Your First Contact"})]})]});const a=Math.round(t.warm/t.total*100),o=Math.round(t.cooling/t.total*100),l=Math.round(t.atRisk/t.total*100),i=n.filter(u=>u.relationshipScore.status==="at-risk").sort((u,p)=>u.relationshipScore.score-p.relationshipScore.score).slice(0,3);return r.jsxs(Ze,{children:[r.jsxs(Wt,{className:"pb-2",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs(Yt,{className:"text-lg flex items-center gap-2",children:[r.jsx(fp,{className:"h-5 w-5 text-emerald-500"}),"Relationship Health"]}),r.jsx("span",{className:"text-2xl font-bold",children:t.averageScore})]}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Average score across ",t.total," contacts"]})]}),r.jsxs(et,{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsxs("div",{className:"flex items-center justify-between text-sm",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"h-2.5 w-2.5 rounded-full bg-emerald-500"}),r.jsx("span",{children:"Warm"})]}),r.jsxs("span",{className:"font-medium",children:[t.warm," (",a,"%)"]})]}),r.jsx(pd,{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:[t.cooling," (",o,"%)"]})]}),r.jsx(pd,{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:[t.atRisk," (",l,"%)"]})]}),r.jsx(pd,{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($j,{className:"h-4 w-4 text-red-500"}),r.jsx("span",{className:"text-sm font-medium",children:"Needs Attention"})]}),r.jsx("div",{className:"space-y-2",children:i.map(u=>r.jsxs("div",{className:"flex items-center justify-between p-2 rounded-lg bg-red-500/5 hover:bg-red-500/10 cursor-pointer transition-colors",onClick:()=>e(`/mission-control/contacts/${u.id}`),children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"h-2 w-2 rounded-full bg-red-500"}),r.jsxs("span",{className:"text-sm",children:[u.first_name," ",u.last_name]})]}),r.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[r.jsx("span",{children:u.relationshipScore.daysSinceTouch===null?"Never":`${u.relationshipScore.daysSinceTouch}d`}),r.jsx(Wi,{className:"h-3 w-3"})]})]},u.id))})]}),r.jsxs(ee,{variant:"outline",size:"sm",className:"w-full",onClick:()=>e("/mission-control/contacts?filter=at-risk"),children:["View All At-Risk Contacts",r.jsx(Wi,{className:"h-4 w-4 ml-1"})]})]})]})}const rxt=()=>{var ie,pe;const{user:e,isAdmin:t}=tn(),n=Gn(),[s,a]=E.useState([]),[o,l]=E.useState([]),[i,u]=E.useState([]),[p,x]=E.useState([]),[y,_]=E.useState([]),[b,S]=E.useState([]),[k,M]=E.useState(new Set),[P,T]=E.useState([]),[I,z]=E.useState([]),[D,U]=E.useState([]),[V,W]=E.useState(!0);E.useEffect(()=>{G()},[e]);const G=async()=>{var se,fe,he,ye;try{const[Ae,we,be,_e,Je,Te,De,Ue,Be,qe]=await Promise.all([Q.from("user_tags").select("tag").eq("user_id",e==null?void 0:e.id),Q.from("app_tiles").select("*").order("name"),Q.from("user_favorites").select("app_id").eq("user_id",e==null?void 0:e.id),Q.from("events").select("*").order("event_date",{ascending:!0}),Q.from("event_registrations").select("event_id, zoom_join_url").eq("user_id",e==null?void 0:e.id),Q.from("canva_templates").select("id, name, preview_image_url, publish_date").order("publish_date",{ascending:!1}).limit(4),Q.from("resource_kits").select("id, name, description, featured_image_url, publish_date").eq("is_published",!0).order("publish_date",{ascending:!1}).limit(4),Q.from("academy_videos").select("id, title, description, thumbnail_url, duration, publish_date").eq("is_published",!0).order("publish_date",{ascending:!1}).limit(4),Q.from("additional_services").select("id, name, description, preview_image_url, signup_link_url, publish_date").eq("is_published",!0).order("publish_date",{ascending:!1}).limit(4),Q.from("dashboard_banners").select("id, title, description, image_url, link_url, link_text, placement, section_after").eq("is_active",!0).order("sort_order")]),ot=((se=Ae.data)==null?void 0:se.map(Qe=>Qe.tag))||[],Mt=new Set(((fe=be.data)==null?void 0:fe.map(Qe=>Qe.app_id))||[]);M(Mt);const at=(((he=we.data)==null?void 0:he.filter(Qe=>!Qe.required_tags||Qe.required_tags.length===0?!0:Qe.required_tags.some(st=>ot.includes(st))))||[]).sort((Qe,st)=>Qe.name==="LevelUp Members Portal"?-1:st.name==="LevelUp Members Portal"?1:0);a(at.slice(0,6));const le=((ye=_e.data)==null?void 0:ye.filter(Qe=>ZS(Qe.event_date)!=="ended"))||[];l(le.slice(0,4)),T(Je.data||[]),u(Te.data||[]),x(De.data||[]),_(Ue.data||[]),S(Be.data||[]);const Ve=qe.data||[];z(Ve.filter(Qe=>Qe.placement==="top")),U(Ve.filter(Qe=>Qe.placement==="between"))}catch(Ae){console.error("Error loading dashboard:",Ae),Ie.error("Failed to load dashboard data")}finally{W(!1)}},J=async se=>{var he;const fe=window.open("about:blank","_blank");try{await Q.from("activity_logs").insert({user_id:e==null?void 0:e.id,app_id:se.app_id,app_name:se.name,user_agent:navigator.userAgent});const{data:ye,error:Ae}=await Q.functions.invoke("sso-launch",{body:{app_id:se.app_id}});if(Ae)throw Ae;ye!=null&&ye.redirect_url?fe&&!fe.closed?(fe.location.href=ye.redirect_url,(he=fe.focus)==null||he.call(fe)):window.location.assign(ye.redirect_url):(fe==null||fe.close(),Ie.error("Launch link unavailable"))}catch(ye){fe==null||fe.close(),console.error("Error launching app:",ye),Ie.error("Failed to launch app")}},ne=se=>P==null?void 0:P.some(fe=>fe.event_id===se),oe=se=>{const fe=P==null?void 0:P.find(he=>he.event_id===se);return fe==null?void 0:fe.zoom_join_url};if(V)return r.jsx(Dr,{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 ge=se=>D.filter(fe=>fe.section_after===se);return r.jsxs(Dr,{title:"Dashboard",children:[r.jsx(Jmt,{events:o,registrations:P,onNavigateToEvents:()=>n("/events")}),I.length>0&&r.jsx("div",{className:"mb-8",children:r.jsx(dT,{banners:I})}),r.jsx(dgt,{}),r.jsxs("div",{className:"mb-6",children:[r.jsxs("h2",{className:"text-2xl font-bold text-foreground",children:["Welcome back, ",((pe=(ie=e==null?void 0:e.user_metadata)==null?void 0:ie.name)==null?void 0:pe.split(" ")[0])||"there","!"]}),r.jsx("p",{className:"text-muted-foreground mt-1",children:"Are you ready to LevelUp today?"})]}),r.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-4 mb-8",children:[r.jsx(Ngt,{}),r.jsx(RRe,{}),r.jsx(Vgt,{})]}),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(Vo,{className:"h-4 w-4"})]})]}),o.length===0?r.jsx(Ze,{className:"bg-muted/30 border-dashed",children:r.jsx(et,{className:"flex items-center justify-center py-8",children:r.jsxs("div",{className:"text-center",children:[r.jsx(Ss,{className:"h-8 w-8 text-muted-foreground/50 mx-auto mb-2"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"No upcoming events"})]})})}):r.jsx("div",{className:"bg-card rounded-xl border border-border overflow-hidden divide-y divide-border max-w-full",children:o.map(se=>{const fe=ne(se.id),he=oe(se.id)||se.zoom_link;return r.jsxs("div",{className:`flex items-start gap-3 sm:gap-4 p-3 sm:p-4 hover:bg-muted/50 transition-colors cursor-pointer group ${WNe(se.event_date)?"bg-red-500/5 border-l-2 border-l-red-500":""}`,onClick:()=>n("/events"),children:[WNe(se.event_date)?r.jsxs("div",{className:"flex-shrink-0 w-12 h-12 sm:w-14 sm:h-14 rounded-lg bg-red-500/10 flex flex-col items-center justify-center relative",children:[r.jsx("span",{className:"absolute inline-flex h-3 w-3 top-1 right-1 animate-ping rounded-full bg-red-500 opacity-75"}),r.jsx(Bj,{className:"h-5 w-5 text-red-500"}),r.jsx("span",{className:"text-[10px] font-bold text-red-500 uppercase mt-0.5",children:"Live"})]}):r.jsxs("div",{className:"flex-shrink-0 w-12 h-12 sm:w-14 sm:h-14 rounded-lg bg-primary/10 flex flex-col items-center justify-center",children:[r.jsx("span",{className:"text-[10px] sm:text-xs font-medium text-primary uppercase",children:new Intl.DateTimeFormat("en-US",{month:"short",timeZone:"America/New_York"}).format(new Date(se.event_date))}),r.jsx("span",{className:"text-lg sm:text-xl font-bold text-primary",children:new Intl.DateTimeFormat("en-US",{day:"numeric",timeZone:"America/New_York"}).format(new Date(se.event_date))})]}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("h4",{className:"font-medium text-sm sm:text-base text-foreground group-hover:text-primary transition-colors line-clamp-2 sm:truncate",children:se.title}),r.jsxs("p",{className:"text-xs sm:text-sm text-muted-foreground mt-0.5",children:[new Intl.DateTimeFormat("en-US",{weekday:"long",timeZone:"America/New_York"}).format(new Date(se.event_date))," at ",OE(new Date(se.event_date))]})]}),r.jsx("div",{className:"hidden sm:flex flex-shrink-0",children:fe?r.jsxs(ee,{size:"sm",variant:"default",className:"gap-1",onClick:ye=>{ye.stopPropagation(),window.open(he,"_blank")},children:[r.jsx(As,{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(Wi,{className:"h-4 w-4"})]})})]},se.id)})})]}),ge("events").length>0&&r.jsx("div",{className:"mb-10",children:r.jsx(dT,{banners:ge("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(Vo,{className:"h-4 w-4"})]})]}),y.length===0?r.jsx(Ze,{className:"bg-muted/30 border-dashed",children:r.jsx(et,{className:"flex items-center justify-center py-8",children:r.jsxs("div",{className:"text-center",children:[r.jsx(rp,{className:"h-8 w-8 text-muted-foreground/50 mx-auto mb-2"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"No academy videos available"})]})})}):r.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:y.map(se=>r.jsxs("div",{onClick:()=>n(`/academy/${se.id}`),className:"group cursor-pointer bg-card rounded-xl border border-border overflow-hidden transition-all duration-200 hover:shadow-lg hover:border-primary/30",children:[r.jsxs("div",{className:"aspect-[3/2] bg-muted/50 overflow-hidden relative",children:[se.thumbnail_url?r.jsx("img",{src:se.thumbnail_url,alt:se.title,className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-300"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center",children:r.jsx(rp,{className:"h-8 w-8 text-muted-foreground/50"})}),se.duration&&r.jsx("span",{className:"absolute bottom-2 right-2 bg-black/70 text-white text-xs px-1.5 py-0.5 rounded",children:se.duration})]}),r.jsx("div",{className:"p-3",children:r.jsx("h4",{className:"font-medium text-sm text-foreground line-clamp-2 group-hover:text-primary transition-colors",children:se.title})})]},se.id))})]}),ge("academy").length>0&&r.jsx("div",{className:"mb-10",children:r.jsx(dT,{banners:ge("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(Vo,{className:"h-4 w-4"})]})]}),p.length===0?r.jsx(Ze,{className:"bg-muted/30 border-dashed",children:r.jsx(et,{className:"flex items-center justify-center py-8",children:r.jsxs("div",{className:"text-center",children:[r.jsx(Tm,{className:"h-8 w-8 text-muted-foreground/50 mx-auto mb-2"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"No resource kits available"})]})})}):r.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:p.map(se=>r.jsxs("div",{onClick:()=>n(`/toolbox/${se.id}`),className:"group cursor-pointer bg-card rounded-xl border border-border overflow-hidden transition-all duration-200 hover:shadow-lg hover:border-primary/30",children:[r.jsx("div",{className:"aspect-[3/2] bg-muted/50 overflow-hidden",children:se.featured_image_url?r.jsx("img",{src:se.featured_image_url,alt:se.name,className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-300"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center",children:r.jsx(Tm,{className:"h-8 w-8 text-muted-foreground/50"})})}),r.jsx("div",{className:"p-3",children:r.jsx("h4",{className:"font-medium text-sm text-foreground truncate group-hover:text-primary transition-colors",children:se.name})})]},se.id))})]}),ge("toolbox").length>0&&r.jsx("div",{className:"mb-10",children:r.jsx(dT,{banners:ge("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(Vo,{className:"h-4 w-4"})]})]}),i.length===0?r.jsx(Ze,{className:"bg-muted/30 border-dashed",children:r.jsx(et,{className:"flex items-center justify-center py-8",children:r.jsxs("div",{className:"text-center",children:[r.jsx(U1,{className:"h-8 w-8 text-muted-foreground/50 mx-auto mb-2"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"No templates available"})]})})}):r.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:i.map(se=>r.jsxs("div",{onClick:()=>n("/templates"),className:"group cursor-pointer bg-card rounded-xl border border-border overflow-hidden transition-all duration-200 hover:shadow-lg hover:border-primary/30",children:[r.jsx("div",{className:"aspect-[3/2] bg-muted/50 overflow-hidden",children:se.preview_image_url?r.jsx("img",{src:se.preview_image_url,alt:se.name,className:"w-full h-full object-contain group-hover:scale-105 transition-transform duration-300"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center",children:r.jsx(U1,{className:"h-8 w-8 text-muted-foreground/50"})})}),r.jsx("div",{className:"p-3",children:r.jsx("h4",{className:"font-medium text-sm text-foreground truncate group-hover:text-primary transition-colors",children:se.name})})]},se.id))})]}),ge("templates").length>0&&r.jsx("div",{className:"mb-10",children:r.jsx(dT,{banners:ge("templates")})}),r.jsx("div",{className:"mb-10",children:r.jsx(qgt,{})}),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(Vo,{className:"h-4 w-4"})]})]}),s.length===0?r.jsx(Ze,{className:"bg-muted/30 border-dashed",children:r.jsx(et,{className:"flex items-center justify-center py-12",children:r.jsxs("div",{className:"text-center",children:[r.jsx(Sm,{className:"h-8 w-8 text-muted-foreground/50 mx-auto mb-2"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"No apps available"})]})})}):r.jsx("div",{className:"grid gap-4 md:grid-cols-2 xl:grid-cols-3",children:s.map(se=>{const fe=k.has(se.id);return r.jsxs("div",{onClick:()=>J(se),className:"group flex items-start gap-4 p-5 bg-card rounded-xl border border-border cursor-pointer transition-all duration-200 hover:shadow-lg hover:border-primary/30",children:[r.jsx("div",{className:"flex-shrink-0 w-14 h-14 rounded-xl bg-primary/10 flex items-center justify-center text-3xl",children:se.icon}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("h3",{className:"font-semibold text-foreground group-hover:text-primary transition-colors truncate",children:se.name}),r.jsx("p",{className:"text-sm text-muted-foreground mt-1 line-clamp-2",children:se.description})]}),fe&&r.jsx(Sm,{className:"h-5 w-5 text-primary fill-current flex-shrink-0"})]},se.id)})})]}),r.jsxs("section",{className:"mt-10",children:[r.jsxs("div",{className:"flex items-center justify-between mb-4",children:[r.jsx("h3",{className:"text-lg font-semibold text-foreground",children:"Additional Services"}),r.jsxs(ee,{variant:"ghost",size:"sm",onClick:()=>n("/additional-services"),className:"gap-1 text-muted-foreground hover:text-foreground",children:["View All ",r.jsx(Vo,{className:"h-4 w-4"})]})]}),b.length===0?r.jsx(Ze,{className:"bg-muted/30 border-dashed",children:r.jsx(et,{className:"flex items-center justify-center py-8",children:r.jsxs("div",{className:"text-center",children:[r.jsx(Ls,{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:b.map(se=>r.jsxs("div",{onClick:()=>window.open(se.signup_link_url,"_blank"),className:"group cursor-pointer bg-card rounded-xl border border-border overflow-hidden transition-all duration-200 hover:shadow-lg hover:border-primary/30",children:[r.jsx("div",{className:"aspect-[4/3] bg-muted/50 overflow-hidden",children:se.preview_image_url?r.jsx("img",{src:se.preview_image_url,alt:se.name,className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-300"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center",children:r.jsx(Ls,{className:"h-8 w-8 text-muted-foreground/50"})})}),r.jsxs("div",{className:"p-3",children:[r.jsx("h4",{className:"font-medium text-sm text-foreground truncate group-hover:text-primary transition-colors",children:se.name}),se.description&&r.jsx("p",{className:"text-xs text-muted-foreground mt-1 line-clamp-2",children:se.description})]})]},se.id))})]})]})};var fae="Switch",[nxt]=cc(fae),[sxt,axt]=nxt(fae),FRe=E.forwardRef((e,t)=>{const{__scopeSwitch:n,name:s,checked:a,defaultChecked:o,required:l,disabled:i,value:u="on",onCheckedChange:p,form:x,...y}=e,[_,b]=E.useState(null),S=la(t,I=>b(I)),k=E.useRef(!1),M=_?x||!!_.closest("form"):!0,[P,T]=Ju({prop:a,defaultProp:o??!1,onChange:p,caller:fae});return r.jsxs(sxt,{scope:n,checked:P,disabled:i,children:[r.jsx(Fn.button,{type:"button",role:"switch","aria-checked":P,"aria-required":l,"data-state":URe(P),"data-disabled":i?"":void 0,disabled:i,value:u,...y,ref:S,onClick:un(e.onClick,I=>{T(z=>!z),M&&(k.current=I.isPropagationStopped(),k.current||I.stopPropagation())})}),M&&r.jsx($Re,{control:_,bubbles:!k.current,name:s,value:u,checked:P,required:l,disabled:i,form:x,style:{transform:"translateX(-100%)"}})]})});FRe.displayName=fae;var zRe="SwitchThumb",BRe=E.forwardRef((e,t)=>{const{__scopeSwitch:n,...s}=e,a=axt(zRe,n);return r.jsx(Fn.span,{"data-state":URe(a.checked),"data-disabled":a.disabled?"":void 0,...s,ref:t})});BRe.displayName=zRe;var ixt="SwitchBubbleInput",$Re=E.forwardRef(({__scopeSwitch:e,control:t,checked:n,bubbles:s=!0,...a},o)=>{const l=E.useRef(null),i=la(l,o),u=aP(n),p=WI(t);return E.useEffect(()=>{const x=l.current;if(!x)return;const y=window.HTMLInputElement.prototype,b=Object.getOwnPropertyDescriptor(y,"checked").set;if(u!==n&&b){const S=new Event("click",{bubbles:s});b.call(x,n),x.dispatchEvent(S)}},[u,n,s]),r.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...a,tabIndex:-1,ref:i,style:{...a.style,...p,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});$Re.displayName=ixt;function URe(e){return e?"checked":"unchecked"}var qRe=FRe,oxt=BRe;const Ts=E.forwardRef(({className:e,...t},n)=>r.jsx(qRe,{className:Bt("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",e),...t,ref:n,children:r.jsx(oxt,{className:Bt("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")})}));Ts.displayName=qRe.displayName;var VRe="AlertDialog",[lxt]=cc(VRe,[gOe]),Uy=gOe(),HRe=e=>{const{__scopeAlertDialog:t,...n}=e,s=Uy(t);return r.jsx(Lse,{...s,...n,modal:!0})};HRe.displayName=VRe;var cxt="AlertDialogTrigger",WRe=E.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,a=Uy(n);return r.jsx(Zxe,{...a,...s,ref:t})});WRe.displayName=cxt;var dxt="AlertDialogPortal",GRe=e=>{const{__scopeAlertDialog:t,...n}=e,s=Uy(t);return r.jsx(Ose,{...s,...n})};GRe.displayName=dxt;var uxt="AlertDialogOverlay",KRe=E.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,a=Uy(n);return r.jsx(M3,{...a,...s,ref:t})});KRe.displayName=uxt;var YS="AlertDialogContent",[hxt,fxt]=lxt(YS),pxt=JEe("AlertDialogContent"),ZRe=E.forwardRef((e,t)=>{const{__scopeAlertDialog:n,children:s,...a}=e,o=Uy(n),l=E.useRef(null),i=la(t,l),u=E.useRef(null);return r.jsx(Clt,{contentName:YS,titleName:YRe,docsSlug:"alert-dialog",children:r.jsx(hxt,{scope:n,cancelRef:u,children:r.jsxs(T3,{role:"alertdialog",...o,...a,ref:i,onOpenAutoFocus:un(a.onOpenAutoFocus,p=>{var x;p.preventDefault(),(x=u.current)==null||x.focus({preventScroll:!0})}),onPointerDownOutside:p=>p.preventDefault(),onInteractOutside:p=>p.preventDefault(),children:[r.jsx(pxt,{children:s}),r.jsx(gxt,{contentRef:l})]})})})});ZRe.displayName=YS;var YRe="AlertDialogTitle",XRe=E.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,a=Uy(n);return r.jsx(nP,{...a,...s,ref:t})});XRe.displayName=YRe;var QRe="AlertDialogDescription",JRe=E.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,a=Uy(n);return r.jsx(sP,{...a,...s,ref:t})});JRe.displayName=QRe;var mxt="AlertDialogAction",eFe=E.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,a=Uy(n);return r.jsx(Dse,{...a,...s,ref:t})});eFe.displayName=mxt;var tFe="AlertDialogCancel",rFe=E.forwardRef((e,t)=>{const{__scopeAlertDialog:n,...s}=e,{cancelRef:a}=fxt(tFe,n),o=Uy(n),l=la(t,a);return r.jsx(Dse,{...o,...s,ref:l})});rFe.displayName=tFe;var gxt=({contentRef:e})=>{const t=`\`${YS}\` requires a description for the component to be accessible for screen reader users. You can add a description to the \`${YS}\` by passing a \`${QRe}\` 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 \`${YS}\`. 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 E.useEffect(()=>{var s;document.getElementById((s=e.current)==null?void 0:s.getAttribute("aria-describedby"))||console.warn(t)},[t,e]),null},xxt=HRe,yxt=WRe,vxt=GRe,nFe=KRe,sFe=ZRe,aFe=eFe,iFe=rFe,oFe=XRe,lFe=JRe;const Id=xxt,wm=yxt,_xt=vxt,cFe=E.forwardRef(({className:e,...t},n)=>r.jsx(nFe,{className:Bt("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",e),...t,ref:n}));cFe.displayName=nFe.displayName;const id=E.forwardRef(({className:e,...t},n)=>r.jsxs(_xt,{children:[r.jsx(cFe,{}),r.jsx(sFe,{ref:n,className:Bt("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",e),...t})]}));id.displayName=sFe.displayName;const od=({className:e,...t})=>r.jsx("div",{className:Bt("flex flex-col space-y-2 text-center sm:text-left",e),...t});od.displayName="AlertDialogHeader";const ld=({className:e,...t})=>r.jsx("div",{className:Bt("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});ld.displayName="AlertDialogFooter";const cd=E.forwardRef(({className:e,...t},n)=>r.jsx(oFe,{ref:n,className:Bt("text-lg font-semibold",e),...t}));cd.displayName=oFe.displayName;const dd=E.forwardRef(({className:e,...t},n)=>r.jsx(lFe,{ref:n,className:Bt("text-sm text-muted-foreground",e),...t}));dd.displayName=lFe.displayName;const Bc=E.forwardRef(({className:e,...t},n)=>r.jsx(aFe,{ref:n,className:Bt(TE(),e),...t}));Bc.displayName=aFe.displayName;const ud=E.forwardRef(({className:e,...t},n)=>r.jsx(iFe,{ref:n,className:Bt(TE({variant:"outline"}),"mt-2 sm:mt-0",e),...t}));ud.displayName=iFe.displayName;const bxt=[{key:"contacts",label:"Contacts",icon:Ti,description:"View, add, and edit contacts"},{key:"pipeline",label:"Deal Pipeline",icon:Oj,description:"View, add, and move deals"},{key:"videos",label:"Videos",icon:$a,description:"View and upload videos"},{key:"listings",label:"Listings",icon:xa,description:"View, create, and edit listings"},{key:"scorecard",label:"Scorecard",icon:nA,description:"View and add transactions"},{key:"popbys",label:"Pop-bys",icon:Po,description:"View and log pop-bys"}];function wxt(){var D;const{user:e}=tn(),[t,n]=E.useState([]),[s,a]=E.useState(!0),[o,l]=E.useState(!1),[i,u]=E.useState(!1),[p,x]=E.useState(null),[y,_]=E.useState({email:"",name:"",password:""}),[b,S]=E.useState(!1),[k,M]=E.useState(null);E.useEffect(()=>{e&&P()},[e]);const P=async()=>{if(e){a(!0);try{const{data:U,error:V}=await Q.from("agent_assistant_assignments").select("id, assistant_id, permissions, created_at").eq("agent_id",e.id);if(V)throw V;if(U&&U.length>0){const W=U.map(ne=>ne.assistant_id),{data:G}=await Q.from("profiles").select("id, name, email").in("id",W),J=U.map(ne=>{const oe=G==null?void 0:G.find(ge=>ge.id===ne.assistant_id);return{...ne,permissions:ne.permissions,assistant_profile:oe?{name:oe.name||"",email:oe.email||""}:void 0}});n(J)}else n([])}catch(U){console.error("Error loading assistants:",U)}finally{a(!1)}}},T=async()=>{if(!e||!y.email.trim()||!y.name.trim()||!y.password.trim()){Ie.error("Please fill in all fields");return}if(y.password.length<6){Ie.error("Password must be at least 6 characters");return}if(t.length>=1){Ie.error("You can only have 1 assistant");return}S(!0);try{const{data:{session:U}}=await Q.auth.getSession();if(!U)throw new Error("Not authenticated");const V=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/create-user",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${U.access_token}`},body:JSON.stringify({email:y.email.trim(),password:y.password,name:y.name.trim(),purpose:"assistant"})}),W=await V.json();if(!V.ok)throw new Error(W.error||"Failed to create assistant account");const G=W.userId||W.id;if(!G)throw new Error("No user ID returned");const J=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/manage-user-roles",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${U.access_token}`},body:JSON.stringify({userId:G,role:"assistant",action:"add",agentId:e.id})}),ne=await J.json();if(!J.ok)throw new Error(ne.error||"Failed to assign assistant role");const{error:oe}=await Q.from("agent_assistant_assignments").insert({agent_id:e.id,assistant_id:G,permissions:{contacts:!0,pipeline:!0,videos:!1,listings:!1,scorecard:!1,popbys:!1}});if(oe)throw oe;Ie.success(`Assistant account created for ${y.name.trim()}`),l(!1),_({email:"",name:"",password:""}),P()}catch(U){console.error("Error adding assistant:",U),Ie.error(U.message||"Failed to add assistant")}finally{S(!1)}},I=async()=>{if(!(!p||!e))try{const{data:{session:U}}=await Q.auth.getSession();if(!U)throw new Error("Not authenticated");const{error:V}=await Q.from("agent_assistant_assignments").delete().eq("id",p.id);if(V)throw V;const{data:W}=await Q.from("agent_assistant_assignments").select("id").eq("assistant_id",p.assistant_id);(!W||W.length===0)&&await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/manage-user-roles",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${U.access_token}`},body:JSON.stringify({userId:p.assistant_id,role:"assistant",action:"remove"})}),Ie.success("Assistant removed"),u(!1),x(null),P()}catch(U){console.error("Error removing assistant:",U),Ie.error(U.message||"Failed to remove assistant")}},z=async(U,V,W)=>{M(U);try{const G=t.find(oe=>oe.id===U);if(!G)return;const J={...G.permissions,[V]:W},{error:ne}=await Q.from("agent_assistant_assignments").update({permissions:J}).eq("id",U);if(ne)throw ne;n(oe=>oe.map(ge=>ge.id===U?{...ge,permissions:J}:ge))}catch(G){console.error("Error updating permissions:",G),Ie.error("Failed to update permissions")}finally{M(null)}};return s?r.jsxs(Ze,{children:[r.jsx(Wt,{children:r.jsxs(Yt,{className:"flex items-center gap-2",children:[r.jsx(Un,{className:"h-5 w-5"}),"My Assistant"]})}),r.jsx(et,{children:r.jsx("div",{className:"flex items-center justify-center py-4",children:r.jsx(Zr,{className:"h-6 w-6 animate-spin text-muted-foreground"})})})]}):r.jsxs(r.Fragment,{children:[r.jsxs(Ze,{children:[r.jsx(Wt,{children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsxs(Yt,{className:"flex items-center gap-2",children:[r.jsx(Un,{className:"h-5 w-5"}),"My Assistant"]}),r.jsx(Sn,{children:"Add an assistant to help manage your Agent OS"})]}),t.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(et,{children:t.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:t.map(U=>{var V,W,G,J;return r.jsxs("div",{className:"border rounded-lg p-4 space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(Qs,{className:"h-10 w-10",children:r.jsx(Js,{children:((W=(V=U.assistant_profile)==null?void 0:V.name)==null?void 0:W.split(" ").map(ne=>ne[0]).join("").toUpperCase())||"A"})}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:((G=U.assistant_profile)==null?void 0:G.name)||"Unknown"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:((J=U.assistant_profile)==null?void 0:J.email)||""})]}),r.jsxs(Pt,{variant:"secondary",className:"ml-2",children:[r.jsx(yf,{className:"h-3 w-3 mr-1"}),"Assistant"]})]}),r.jsx(ee,{variant:"ghost",size:"sm",className:"text-destructive hover:text-destructive",onClick:()=>{x(U),u(!0)},children:r.jsx(Bn,{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:bxt.map(ne=>{const oe=ne.icon;return r.jsxs("div",{className:"flex items-center justify-between p-2 rounded-md border",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(oe,{className:"h-4 w-4 text-muted-foreground"}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm font-medium",children:ne.label}),r.jsx("p",{className:"text-xs text-muted-foreground",children:ne.description})]})]}),r.jsx(Ts,{checked:U.permissions[ne.key]||!1,onCheckedChange:ge=>z(U.id,ne.key,ge),disabled:k===U.id})]},ne.key)})})]})]},U.id)})})})]}),r.jsx(Or,{open:o,onOpenChange:l,children:r.jsxs(Ir,{children:[r.jsxs($r,{children:[r.jsx(Fr,{children:"Add Assistant"}),r.jsx(Zn,{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($e,{htmlFor:"assistant-name",children:"Name"}),r.jsx(dt,{id:"assistant-name",value:y.name,onChange:U=>_({...y,name:U.target.value}),placeholder:"Assistant's full name"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{htmlFor:"assistant-email",children:"Email"}),r.jsx(dt,{id:"assistant-email",type:"email",value:y.email,onChange:U=>_({...y,email:U.target.value}),placeholder:"assistant@email.com"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{htmlFor:"assistant-password",children:"Temporary Password"}),r.jsx(dt,{id:"assistant-password",type:"password",value:y.password,onChange:U=>_({...y,password:U.target.value}),placeholder:"Min 6 characters"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Your assistant can change this after their first login."})]})]}),r.jsxs(Bs,{children:[r.jsx(ee,{variant:"outline",onClick:()=>l(!1),children:"Cancel"}),r.jsxs(ee,{onClick:T,disabled:b,children:[b&&r.jsx(Zr,{className:"h-4 w-4 mr-2 animate-spin"}),"Create Assistant"]})]})]})}),r.jsx(Id,{open:i,onOpenChange:u,children:r.jsxs(id,{children:[r.jsxs(od,{children:[r.jsx(cd,{children:"Remove Assistant?"}),r.jsxs(dd,{children:["This will remove ",(D=p==null?void 0:p.assistant_profile)==null?void 0:D.name,"'s access to your Agent OS. Their account will remain active but they won't be able to manage your data."]})]}),r.jsxs(ld,{children:[r.jsx(ud,{children:"Cancel"}),r.jsx(Bc,{onClick:I,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Remove"})]})]})})]})}function Jd(e){this.content=e}Jd.prototype={constructor:Jd,find:function(e){for(var t=0;t>1}};Jd.from=function(e){if(e instanceof Jd)return e;var t=[];if(e)for(var n in e)t.push(n,e[n]);return new Jd(t)};function dFe(e,t,n){for(let s=0;;s++){if(s==e.childCount||s==t.childCount)return e.childCount==t.childCount?null:n;let a=e.child(s),o=t.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=dFe(a.content,o.content,n+1);if(l!=null)return l}n+=a.nodeSize}}function uFe(e,t,n,s){for(let a=e.childCount,o=t.childCount;;){if(a==0||o==0)return a==o?null:{a:n,b:s};let l=e.child(--a),i=t.child(--o),u=l.nodeSize;if(l==i){n-=u,s-=u;continue}if(!l.sameMarkup(i))return{a:n,b:s};if(l.isText&&l.text!=i.text){let p=0,x=Math.min(l.text.length,i.text.length);for(;pt&&s(u,a+i,o||null,l)!==!1&&u.content.size){let x=i+1;u.nodesBetween(Math.max(0,t-x),Math.min(u.content.size,n-x),s,a+x)}i=p}}descendants(t){this.nodesBetween(0,this.size,t)}textBetween(t,n,s,a){let o="",l=!0;return this.nodesBetween(t,n,(i,u)=>{let p=i.isText?i.text.slice(Math.max(t,u)-u,n-u):i.isLeaf?a?typeof a=="function"?a(i):a:i.type.spec.leafText?i.type.spec.leafText(i):"":"";i.isBlock&&(i.isLeaf&&p||i.isTextblock)&&s&&(l?l=!1:o+=s),o+=p},0),o}append(t){if(!t.size)return this;if(!this.size)return t;let n=this.lastChild,s=t.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);ot)for(let o=0,l=0;lt&&((ln)&&(i.isText?i=i.cut(Math.max(0,t-l),Math.min(i.text.length,n-l)):i=i.cut(Math.max(0,t-l-1),Math.min(i.content.size,n-l-1))),s.push(i),a+=i.nodeSize),l=u}return new dn(s,a)}cutByIndex(t,n){return t==n?dn.empty:t==0&&n==this.content.length?this:new dn(this.content.slice(t,n))}replaceChild(t,n){let s=this.content[t];if(s==n)return this;let a=this.content.slice(),o=this.size+n.nodeSize-s.nodeSize;return a[t]=n,new dn(a,o)}addToStart(t){return new dn([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new dn(this.content.concat(t),this.size+t.nodeSize)}eq(t){if(this.content.length!=t.content.length)return!1;for(let n=0;nthis.size||t<0)throw new RangeError(`Position ${t} outside of fragment (${this})`);for(let n=0,s=0;;n++){let a=this.child(n),o=s+a.nodeSize;if(o>=t)return o==t?aO(n+1,o):aO(n,s);s=o}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(t=>t.toJSON()):null}static fromJSON(t,n){if(!n)return dn.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new dn(n.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return dn.empty;let n,s=0;for(let a=0;athis.type.rank&&(n||(n=t.slice(0,a)),n.push(this),s=!0),n&&n.push(o)}}return n||(n=t.slice()),s||n.push(this),n}removeFromSet(t){for(let n=0;ns.type.rank-a.type.rank),n}};Ho.none=[];class ire extends Error{}class Kn{constructor(t,n,s){this.content=t,this.openStart=n,this.openEnd=s}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(t,n){let s=fFe(this.content,t+this.openStart,n);return s&&new Kn(s,this.openStart,this.openEnd)}removeBetween(t,n){return new Kn(hFe(this.content,t+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(t){return this.content.eq(t.content)&&this.openStart==t.openStart&&this.openEnd==t.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let t={content:this.content.toJSON()};return this.openStart>0&&(t.openStart=this.openStart),this.openEnd>0&&(t.openEnd=this.openEnd),t}static fromJSON(t,n){if(!n)return Kn.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 Kn(dn.fromJSON(t,n.content),s,a)}static maxOpen(t,n=!0){let s=0,a=0;for(let o=t.firstChild;o&&!o.isLeaf&&(n||!o.type.spec.isolating);o=o.firstChild)s++;for(let o=t.lastChild;o&&!o.isLeaf&&(n||!o.type.spec.isolating);o=o.lastChild)a++;return new Kn(t,s,a)}}Kn.empty=new Kn(dn.empty,0,0);function hFe(e,t,n){let{index:s,offset:a}=e.findIndex(t),o=e.maybeChild(s),{index:l,offset:i}=e.findIndex(n);if(a==t||o.isText){if(i!=n&&!e.child(l).isText)throw new RangeError("Removing non-flat range");return e.cut(0,t).append(e.cut(n))}if(s!=l)throw new RangeError("Removing non-flat range");return e.replaceChild(s,o.copy(hFe(o.content,t-a-1,n-a-1)))}function fFe(e,t,n,s){let{index:a,offset:o}=e.findIndex(t),l=e.maybeChild(a);if(o==t||l.isText)return s&&!s.canReplace(a,a,n)?null:e.cut(0,t).append(n).append(e.cut(t));let i=fFe(l.content,t-o-1,n,l);return i&&e.replaceChild(a,l.copy(i))}function jxt(e,t,n){if(n.openStart>e.depth)throw new ire("Inserted content deeper than insertion position");if(e.depth-n.openStart!=t.depth-n.openEnd)throw new ire("Inconsistent open depths");return pFe(e,t,n,0)}function pFe(e,t,n,s){let a=e.index(s),o=e.node(s);if(a==t.index(s)&&s=0&&e.isText&&e.sameMarkup(t[n])?t[n]=e.withText(t[n].text+e.text):t.push(e)}function RA(e,t,n,s){let a=(t||e).node(n),o=0,l=t?t.index(n):a.childCount;e&&(o=e.index(n),e.depth>n?o++:e.textOffset&&(qj(e.nodeAfter,s),o++));for(let i=o;ia&&Afe(e,t,a+1),l=s.depth>a&&Afe(n,s,a+1),i=[];return RA(null,e,a,i),o&&l&&t.index(a)==n.index(a)?(mFe(o,l),qj(Vj(o,gFe(e,t,n,s,a+1)),i)):(o&&qj(Vj(o,ore(e,t,a+1)),i),RA(t,n,a,i),l&&qj(Vj(l,ore(n,s,a+1)),i)),RA(s,null,a,i),new dn(i)}function ore(e,t,n){let s=[];if(RA(null,e,n,s),e.depth>n){let a=Afe(e,t,n+1);qj(Vj(a,ore(e,t,n+1)),s)}return RA(t,null,n,s),new dn(s)}function kxt(e,t){let n=t.depth-e.openStart,a=t.node(n).copy(e.content);for(let o=n-1;o>=0;o--)a=t.node(o).copy(dn.from(a));return{start:a.resolveNoCache(e.openStart+n),end:a.resolveNoCache(a.content.size-e.openEnd-n)}}class DE{constructor(t,n,s){this.pos=t,this.path=n,this.parentOffset=s,this.depth=n.length/3-1}resolveDepth(t){return t==null?this.depth:t<0?this.depth+t:t}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(t){return this.path[this.resolveDepth(t)*3]}index(t){return this.path[this.resolveDepth(t)*3+1]}indexAfter(t){return t=this.resolveDepth(t),this.index(t)+(t==this.depth&&!this.textOffset?0:1)}start(t){return t=this.resolveDepth(t),t==0?0:this.path[t*3-1]+1}end(t){return t=this.resolveDepth(t),this.start(t)+this.node(t).content.size}before(t){if(t=this.resolveDepth(t),!t)throw new RangeError("There is no position before the top-level node");return t==this.depth+1?this.pos:this.path[t*3-1]}after(t){if(t=this.resolveDepth(t),!t)throw new RangeError("There is no position after the top-level node");return t==this.depth+1?this.pos:this.path[t*3-1]+this.path[t*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let t=this.parent,n=this.index(this.depth);if(n==t.childCount)return null;let s=this.pos-this.path[this.path.length-1],a=t.child(n);return s?t.child(n).cut(s):a}get nodeBefore(){let t=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(t).cut(0,n):t==0?null:this.parent.child(t-1)}posAtIndex(t,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)<=t&&this.end(n)>=t)return n;return 0}blockRange(t=this,n){if(t.pos=0;s--)if(t.pos<=this.end(s)&&(!n||n(this.node(s))))return new lre(this,t,s);return null}sameParent(t){return this.pos-this.parentOffset==t.pos-t.parentOffset}max(t){return t.pos>this.pos?t:this}min(t){return t.pos=0&&n<=t.content.size))throw new RangeError("Position "+n+" out of range");let s=[],a=0,o=n;for(let l=t;;){let{index:i,offset:u}=l.content.findIndex(o),p=o-u;if(s.push(l,i,a+u),!p||(l=l.child(i),l.isText))break;o=p-1,a+=u+1}return new DE(n,s,o)}static resolveCached(t,n){let s=XNe.get(t);if(s)for(let o=0;ot&&this.nodesBetween(t,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 t=this.type.name;return this.content.size&&(t+="("+this.content.toStringInner()+")"),xFe(this.marks,t)}contentMatchAt(t){let n=this.type.contentMatch.matchFragment(this.content,0,t);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(t,n,s=dn.empty,a=0,o=s.childCount){let l=this.contentMatchAt(t).matchFragment(s,a,o),i=l&&l.matchFragment(this.content,n);if(!i||!i.validEnd)return!1;for(let u=a;un.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let t={type:this.type.name};for(let n in this.attrs){t.attrs=this.attrs;break}return this.content.size&&(t.content=this.content.toJSON()),this.marks.length&&(t.marks=this.marks.map(n=>n.toJSON())),t}static fromJSON(t,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(t.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return t.text(n.text,s)}let a=dn.fromJSON(t,n.content),o=t.nodeType(n.type).create(n.attrs,a,s);return o.type.checkAttrs(o.attrs),o}};tv.prototype.text=void 0;class cre extends tv{constructor(t,n,s,a){if(super(t,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):xFe(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(t,n){return this.text.slice(t,n)}get nodeSize(){return this.text.length}mark(t){return t==this.marks?this:new cre(this.type,this.attrs,this.text,t)}withText(t){return t==this.text?this:new cre(this.type,this.attrs,t,this.marks)}cut(t=0,n=this.text.length){return t==0&&n==this.text.length?this:this.withText(this.text.slice(t,n))}eq(t){return this.sameMarkup(t)&&this.text==t.text}toJSON(){let t=super.toJSON();return t.text=this.text,t}}function xFe(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+"("+t+")";return t}class dk{constructor(t){this.validEnd=t,this.next=[],this.wrapCache=[]}static parse(t,n){let s=new Mxt(t,n);if(s.next==null)return dk.empty;let a=yFe(s);s.next&&s.err("Unexpected trailing text");let o=Oxt(Lxt(a));return Dxt(o,s),o}matchType(t){for(let n=0;np.createAndFill()));for(let p=0;p=this.next.length)throw new RangeError(`There's no ${t}th edge in this content match`);return this.next[t]}toString(){let t=[];function n(s){t.push(s);for(let a=0;a{let o=a+(s.validEnd?"*":" ")+" ";for(let l=0;l"+t.indexOf(s.next[l].next);return o}).join(` `)}}dk.empty=new dk(!0);class Mxt{constructor(t,n){this.string=t,this.nodeTypes=n,this.inline=null,this.pos=0,this.tokens=t.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(t){return this.next==t&&(this.pos++||!0)}err(t){throw new SyntaxError(t+" (in content expression '"+this.string+"')")}}function yFe(e){let t=[];do t.push(Txt(e));while(e.eat("|"));return t.length==1?t[0]:{type:"choice",exprs:t}}function Txt(e){let t=[];do t.push(Axt(e));while(e.next&&e.next!=")"&&e.next!="|");return t.length==1?t[0]:{type:"seq",exprs:t}}function Axt(e){let t=Pxt(e);for(;;)if(e.eat("+"))t={type:"plus",expr:t};else if(e.eat("*"))t={type:"star",expr:t};else if(e.eat("?"))t={type:"opt",expr:t};else if(e.eat("{"))t=Ext(e,t);else break;return t}function QNe(e){/\D/.test(e.next)&&e.err("Expected number, got '"+e.next+"'");let t=Number(e.next);return e.pos++,t}function Ext(e,t){let n=QNe(e),s=n;return e.eat(",")&&(e.next!="}"?s=QNe(e):s=-1),e.eat("}")||e.err("Unclosed braced range"),{type:"range",min:n,max:s,expr:t}}function Ixt(e,t){let n=e.nodeTypes,s=n[t];if(s)return[s];let a=[];for(let o in n){let l=n[o];l.isInGroup(t)&&a.push(l)}return a.length==0&&e.err("No node type or group '"+t+"' found"),a}function Pxt(e){if(e.eat("(")){let t=yFe(e);return e.eat(")")||e.err("Missing closing paren"),t}else if(/\W/.test(e.next))e.err("Unexpected token '"+e.next+"'");else{let t=Ixt(e,e.next).map(n=>(e.inline==null?e.inline=n.isInline:e.inline!=n.isInline&&e.err("Mixing inline and block content"),{type:"name",value:n}));return e.pos++,t.length==1?t[0]:{type:"choice",exprs:t}}}function Lxt(e){let t=[[]];return a(o(e,0),n()),t;function n(){return t.push([])-1}function s(l,i,u){let p={term:u,to:i};return t[l].push(p),p}function a(l,i){l.forEach(u=>u.to=i)}function o(l,i){if(l.type=="choice")return l.exprs.reduce((u,p)=>u.concat(o(p,i)),[]);if(l.type=="seq")for(let u=0;;u++){let p=o(l.exprs[u],i);if(u==l.exprs.length-1)return p;a(p,i=n())}else if(l.type=="star"){let u=n();return s(i,u),a(o(l.expr,u),u),[s(u)]}else if(l.type=="plus"){let u=n();return a(o(l.expr,i),u),a(o(l.expr,u),u),[s(u)]}else{if(l.type=="opt")return[s(i)].concat(o(l.expr,i));if(l.type=="range"){let u=i;for(let p=0;p{e[l].forEach(({term:i,to:u})=>{if(!i)return;let p;for(let x=0;x{p||a.push([i,p=[]]),p.indexOf(x)==-1&&p.push(x)})})});let o=t[s.join(",")]=new dk(s.indexOf(e.length-1)>-1);for(let l=0;l-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let t in this.attrs)if(this.attrs[t].isRequired)return!0;return!1}compatibleContent(t){return this==t||this.contentMatch.compatible(t.contentMatch)}computeAttrs(t){return!t&&this.defaultAttrs?this.defaultAttrs:bFe(this.attrs,t)}create(t=null,n,s){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new tv(this,this.computeAttrs(t),dn.from(n),Ho.setFrom(s))}createChecked(t=null,n,s){return n=dn.from(n),this.checkContent(n),new tv(this,this.computeAttrs(t),n,Ho.setFrom(s))}createAndFill(t=null,n,s){if(t=this.computeAttrs(t),n=dn.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(dn.empty,!0);return o?new tv(this,t,n.append(o),Ho.setFrom(s)):null}validContent(t){let n=this.contentMatch.matchFragment(t);if(!n||!n.validEnd)return!1;for(let s=0;s-1}allowsMarks(t){if(this.markSet==null)return!0;for(let n=0;ns[o]=new kFe(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 Rxt(e,t,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 ${t} on type ${e}, got ${o}`)}}class Fxt{constructor(t,n,s){this.hasDefault=Object.prototype.hasOwnProperty.call(s,"default"),this.default=s.default,this.validate=typeof s.validate=="string"?Rxt(t,n,s.validate):s.validate}get isRequired(){return!this.hasDefault}}class pae{constructor(t,n,s,a){this.name=t,this.rank=n,this.schema=s,this.spec=a,this.attrs=jFe(t,a.attrs),this.excluded=null;let o=_Fe(this.attrs);this.instance=o?new Ho(this,o):null}create(t=null){return!t&&this.instance?this.instance:new Ho(this,bFe(this.attrs,t))}static compile(t,n){let s=Object.create(null),a=0;return t.forEach((o,l)=>s[o]=new pae(o,a++,n,l)),s}removeFromSet(t){for(var n=0;n-1}}class NFe{constructor(t){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let a in t)n[a]=t[a];n.nodes=Jd.from(t.nodes),n.marks=Jd.from(t.marks||{}),this.nodes=e4e.compile(this.spec.nodes,this),this.marks=pae.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]=dk.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?t4e(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==""?[]:t4e(this,l.split(" "))}this.nodeFromJSON=a=>tv.fromJSON(this,a),this.markFromJSON=a=>Ho.fromJSON(this,a),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(t,n=null,s,a){if(typeof t=="string")t=this.nodeType(t);else if(t instanceof e4e){if(t.schema!=this)throw new RangeError("Node type from different schema used ("+t.name+")")}else throw new RangeError("Invalid node type: "+t);return t.createChecked(n,s,a)}text(t,n){let s=this.nodes.text;return new cre(s,s.defaultAttrs,t,Ho.setFrom(n))}mark(t,n){return typeof t=="string"&&(t=this.marks[t]),t.create(n)}nodeType(t){let n=this.nodes[t];if(!n)throw new RangeError("Unknown node type: "+t);return n}}function t4e(e,t){let n=[];for(let s=0;s-1)&&n.push(l=u)}if(!l)throw new SyntaxError("Unknown mark type: '"+t[s]+"'")}return n}function zxt(e){return e.tag!=null}function Bxt(e){return e.style!=null}let FA=class Ife{constructor(t,n){this.schema=t,this.rules=n,this.tags=[],this.styles=[];let s=this.matchedStyles=[];n.forEach(a=>{if(zxt(a))this.tags.push(a);else if(Bxt(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=t.nodes[a.node];return o.contentMatch.matchType(o)})}parse(t,n={}){let s=new n4e(this,n,!1);return s.addAll(t,Ho.none,n.from,n.to),s.finish()}parseSlice(t,n={}){let s=new n4e(this,n,!0);return s.addAll(t,Ho.none,n.from,n.to),Kn.maxOpen(s.finish())}matchTag(t,n,s){for(let a=s?this.tags.indexOf(s)+1:0;at.length&&(i.charCodeAt(t.length)!=61||i.slice(t.length+1)!=n))){if(l.getAttrs){let u=l.getAttrs(n);if(u===!1)continue;l.attrs=u||void 0}return l}}}static schemaRules(t){let n=[];function s(a){let o=a.priority==null?50:a.priority,l=0;for(;l{s(l=s4e(l)),l.mark||l.ignore||l.clearMark||(l.mark=a)})}for(let a in t.nodes){let o=t.nodes[a].spec.parseDOM;o&&o.forEach(l=>{s(l=s4e(l)),l.node||l.ignore||l.mark||(l.node=a)})}return n}static fromSchema(t){return t.cached.domParser||(t.cached.domParser=new Ife(t,Ife.schemaRules(t)))}};const SFe={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},$xt={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},CFe={ol:!0,ul:!0},RE=1,Pfe=2,zA=4;function r4e(e,t,n){return t!=null?(t?RE:0)|(t==="full"?Pfe:0):e&&e.whitespace=="pre"?RE|Pfe:n&~zA}class iO{constructor(t,n,s,a,o,l){this.type=t,this.attrs=n,this.marks=s,this.solid=a,this.options=l,this.content=[],this.activeMarks=Ho.none,this.match=o||(l&zA?null:t.contentMatch)}findWrapping(t){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(dn.from(t));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let s=this.type.contentMatch,a;return(a=s.findWrapping(t.type))?(this.match=s,a):null}}return this.match.findWrapping(t.type)}finish(t){if(!(this.options&RE)){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=dn.from(this.content);return!t&&this.match&&(n=n.append(this.match.fillBefore(dn.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}inlineContext(t){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:t.parentNode&&!SFe.hasOwnProperty(t.parentNode.nodeName.toLowerCase())}}class n4e{constructor(t,n,s){this.parser=t,this.options=n,this.isOpen=s,this.open=0,this.localPreserveWS=!1;let a=n.topNode,o,l=r4e(null,n.preserveWhitespace,0)|(s?zA:0);a?o=new iO(a.type,a.attrs,Ho.none,!0,n.topMatch||a.type.contentMatch,l):s?o=new iO(null,null,Ho.none,!0,null,l):o=new iO(t.schema.topNodeType,null,Ho.none,!0,null,l),this.nodes=[o],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(t,n){t.nodeType==3?this.addTextNode(t,n):t.nodeType==1&&this.addElement(t,n)}addTextNode(t,n){let s=t.nodeValue,a=this.top,o=a.options&Pfe?"full":this.localPreserveWS||(a.options&RE)>0,{schema:l}=this.parser;if(o==="full"||a.inlineContext(t)||/[^ \t\r\n\u000c]/.test(s)){if(o)if(o==="full")s=s.replace(/\r\n?/g,` `);else if(l.linebreakReplacement&&/[\r\n]/.test(s)&&this.top.findWrapping(l.linebreakReplacement.create())){let i=s.split(/\r?\n|\r/);for(let u=0;u!u.clearMark(p)):n=n.concat(this.parser.schema.marks[u.mark].create(u.attrs)),u.consuming===!1)i=u;else break}}return n}addElementByRule(t,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,t.nodeName=="BR")||this.leafFallback(t,s);else{let u=this.enter(l,n.attrs||null,s,n.preserveWhitespace);u&&(o=!0,s=u)}else{let u=this.parser.schema.marks[n.mark];s=s.concat(u.create(n.attrs))}let i=this.top;if(l&&l.isLeaf)this.findInside(t);else if(a)this.addElement(t,s,a);else if(n.getContent)this.findInside(t),n.getContent(t,this.parser.schema).forEach(u=>this.insertNode(u,s,!1));else{let u=t;typeof n.contentElement=="string"?u=t.querySelector(n.contentElement):typeof n.contentElement=="function"?u=n.contentElement(t):n.contentElement&&(u=n.contentElement),this.findAround(t,u,!0),this.addAll(u,s),this.findAround(t,u,!1)}o&&this.sync(i)&&this.open--}addAll(t,n,s,a){let o=s||0;for(let l=s?t.childNodes[s]:t.firstChild,i=a==null?null:t.childNodes[a];l!=i;l=l.nextSibling,++o)this.findAtPoint(t,o),this.addDOM(l,n);this.findAtPoint(t,o)}findPlace(t,n,s){let a,o;for(let l=this.open,i=0;l>=0;l--){let u=this.nodes[l],p=u.findWrapping(t);if(p&&(!a||a.length>p.length+i)&&(a=p,o=u,!p.length))break;if(u.solid){if(s)break;i+=2}}if(!a)return null;this.sync(o);for(let l=0;l(l.type?l.type.allowsMarkType(p.type):a4e(p.type,t))?(u=p.addToSet(u),!1):!0),this.nodes.push(new iO(t,n,u,a,null,i)),this.open++,s}closeExtra(t=!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(t));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(t){for(let n=this.open;n>=0;n--){if(this.nodes[n]==t)return this.open=n,!0;this.localPreserveWS&&(this.nodes[n].options|=RE)}return!1}get currentPos(){this.closeExtra();let t=0;for(let n=this.open;n>=0;n--){let s=this.nodes[n].content;for(let a=s.length-1;a>=0;a--)t+=s[a].nodeSize;n&&t++}return t}findAtPoint(t,n){if(this.find)for(let s=0;s-1)return t.split(/\s*\|\s*/).some(this.matchesContext,this);let n=t.split("/"),s=this.options.context,a=!this.isOpen&&(!s||s.parent.type==this.nodes[0].type),o=-(s?s.depth+1:0)+(a?0:1),l=(i,u)=>{for(;i>=0;i--){let p=n[i];if(p==""){if(i==n.length-1||i==0)continue;for(;u>=o;u--)if(l(i-1,u))return!0;return!1}else{let x=u>0||u==0&&a?this.nodes[u].type:s&&u>=o?s.node(u-o).type:null;if(!x||x.name!=p&&!x.isInGroup(p))return!1;u--}}return!0};return l(n.length-1,this.open)}textblockFromContext(){let t=this.options.context;if(t)for(let n=t.depth;n>=0;n--){let s=t.node(n).contentMatchAt(t.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 Uxt(e){for(let t=e.firstChild,n=null;t;t=t.nextSibling){let s=t.nodeType==1?t.nodeName.toLowerCase():null;s&&CFe.hasOwnProperty(s)&&n?(n.appendChild(t),t=n):s=="li"?n=t:s&&(n=null)}}function qxt(e,t){return(e.matches||e.msMatchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector).call(e,t)}function s4e(e){let t={};for(let n in e)t[n]=e[n];return t}function a4e(e,t){let n=t.schema.nodes;for(let s in n){let a=n[s];if(!a.allowsMarkType(e))continue;let o=[],l=i=>{o.push(i);for(let u=0;u{if(o.length||l.marks.length){let i=0,u=0;for(;i=0;a--){let o=this.serializeMark(t.marks[a],t.isInline,n);o&&((o.contentDOM||o.dom).appendChild(s),s=o.dom)}return s}serializeMark(t,n,s={}){let a=this.marks[t.type.name];return a&&Hee(Zce(s),a(t,n),null,t.attrs)}static renderSpec(t,n,s=null,a){return Hee(t,n,s,a)}static fromSchema(t){return t.cached.domSerializer||(t.cached.domSerializer=new Tk(this.nodesFromSchema(t),this.marksFromSchema(t)))}static nodesFromSchema(t){let n=i4e(t.nodes);return n.text||(n.text=s=>s.text),n}static marksFromSchema(t){return i4e(t.marks)}}function i4e(e){let t={};for(let n in e){let s=e[n].spec.toDOM;s&&(t[n]=s)}return t}function Zce(e){return e.document||window.document}const o4e=new WeakMap;function Vxt(e){let t=o4e.get(e);return t===void 0&&o4e.set(e,t=Hxt(e)),t}function Hxt(e){let t=null;function n(s){if(s&&typeof s=="object")if(Array.isArray(s))if(typeof s[0]=="string")t||(t=[]),t.push(s);else for(let a=0;a-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let l=a.indexOf(" ");l>0&&(n=a.slice(0,l),a=a.slice(l+1));let i,u=n?e.createElementNS(n,a):e.createElement(a),p=t[1],x=1;if(p&&typeof p=="object"&&p.nodeType==null&&!Array.isArray(p)){x=2;for(let y in p)if(p[y]!=null){let _=y.indexOf(" ");_>0?u.setAttributeNS(y.slice(0,_),y.slice(_+1),p[y]):y=="style"&&u.style?u.style.cssText=p[y]:u.setAttribute(y,p[y])}}for(let y=x;yx)throw new RangeError("Content hole must be the only child of its parent node");return{dom:u,contentDOM:u}}else{let{dom:b,contentDOM:S}=Hee(e,_,n,s);if(u.appendChild(b),S){if(i)throw new RangeError("Multiple content holes");i=S}}}return{dom:u,contentDOM:i}}const MFe=65535,TFe=Math.pow(2,16);function Wxt(e,t){return e+t*TFe}function l4e(e){return e&MFe}function Gxt(e){return(e-(e&MFe))/TFe}const AFe=1,EFe=2,Wee=4,IFe=8;class Lfe{constructor(t,n,s){this.pos=t,this.delInfo=n,this.recover=s}get deleted(){return(this.delInfo&IFe)>0}get deletedBefore(){return(this.delInfo&(AFe|Wee))>0}get deletedAfter(){return(this.delInfo&(EFe|Wee))>0}get deletedAcross(){return(this.delInfo&Wee)>0}}class of{constructor(t,n=!1){if(this.ranges=t,this.inverted=n,!t.length&&of.empty)return of.empty}recover(t){let n=0,s=l4e(t);if(!this.inverted)for(let a=0;at)break;let p=this.ranges[i+o],x=this.ranges[i+l],y=u+p;if(t<=y){let _=p?t==u?-1:t==y?1:n:n,b=u+a+(_<0?0:x);if(s)return b;let S=t==(n<0?u:y)?null:Wxt(i/3,t-u),k=t==u?EFe:t==y?AFe:Wee;return(n<0?t!=u:t!=y)&&(k|=IFe),new Lfe(b,k,S)}a+=x-p}return s?t+a:new Lfe(t+a,0,null)}touches(t,n){let s=0,a=l4e(n),o=this.inverted?2:1,l=this.inverted?1:2;for(let i=0;it)break;let p=this.ranges[i+o],x=u+p;if(t<=x&&i==a*3)return!0;s+=this.ranges[i+l]-p}return!1}forEach(t){let n=this.inverted?2:1,s=this.inverted?1:2;for(let a=0,o=0;a=0;n--){let a=t.getMirror(n);this.appendMap(t._maps[n].invert(),a!=null&&a>n?s-a-1:void 0)}}invert(){let t=new FE;return t.appendMappingInverted(this),t}map(t,n=1){if(this.mirror)return this._map(t,n,!0);for(let s=this.from;so&&u!l.isAtom||!i.type.allowsMarkType(this.mark.type)?l:l.mark(this.mark.addToSet(l.marks)),a),n.openStart,n.openEnd);return $c.fromReplace(t,this.from,this.to,o)}invert(){return new Mg(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),s=t.mapResult(this.to,-1);return n.deleted&&s.deleted||n.pos>=s.pos?null:new S1(n.pos,s.pos,this.mark)}merge(t){return t instanceof S1&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new S1(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new S1(n.from,n.to,t.markFromJSON(n.mark))}}Nu.jsonID("addMark",S1);class Mg extends Nu{constructor(t,n,s){super(),this.from=t,this.to=n,this.mark=s}apply(t){let n=t.slice(this.from,this.to),s=new Kn(Fye(n.content,a=>a.mark(this.mark.removeFromSet(a.marks)),t),n.openStart,n.openEnd);return $c.fromReplace(t,this.from,this.to,s)}invert(){return new S1(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),s=t.mapResult(this.to,-1);return n.deleted&&s.deleted||n.pos>=s.pos?null:new Mg(n.pos,s.pos,this.mark)}merge(t){return t instanceof Mg&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new Mg(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new Mg(n.from,n.to,t.markFromJSON(n.mark))}}Nu.jsonID("removeMark",Mg);class C1 extends Nu{constructor(t,n){super(),this.pos=t,this.mark=n}apply(t){let n=t.nodeAt(this.pos);if(!n)return $c.fail("No node at mark step's position");let s=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return $c.fromReplace(t,this.pos,this.pos+1,new Kn(dn.from(s),0,n.isLeaf?0:1))}invert(t){let n=t.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 Bd(n.pos,s.pos,a,o,this.slice,this.insert,this.structure)}toJSON(){let t={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(t.slice=this.slice.toJSON()),this.structure&&(t.structure=!0),t}static fromJSON(t,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 Bd(n.from,n.to,n.gapFrom,n.gapTo,Kn.fromJSON(t,n.slice),n.insert,!!n.structure)}}Nu.jsonID("replaceAround",Bd);function Ofe(e,t,n){let s=e.resolve(t),a=n-t,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 Kxt(e,t,n,s){let a=[],o=[],l,i;e.doc.nodesBetween(t,n,(u,p,x)=>{if(!u.isInline)return;let y=u.marks;if(!s.isInSet(y)&&x.type.allowsMarkType(s.type)){let _=Math.max(p,t),b=Math.min(p+u.nodeSize,n),S=s.addToSet(y);for(let k=0;ke.step(u)),o.forEach(u=>e.step(u))}function Zxt(e,t,n,s){let a=[],o=0;e.doc.nodesBetween(t,n,(l,i)=>{if(!l.isInline)return;o++;let u=null;if(s instanceof pae){let p=l.marks,x;for(;x=s.isInSet(p);)(u||(u=[])).push(x),p=x.removeFromSet(p)}else s?s.isInSet(l.marks)&&(u=[s]):u=l.marks;if(u&&u.length){let p=Math.min(i+l.nodeSize,n);for(let x=0;xe.step(new Mg(l.from,l.to,l.style)))}function zye(e,t,n,s=n.contentMatch,a=!0){let o=e.doc.nodeAt(t),l=[],i=t+1;for(let u=0;u=0;u--)e.step(l[u])}function Yxt(e,t,n){return(t==0||e.canReplace(t,e.childCount))&&(n==e.childCount||e.canReplace(0,n))}function I3(e){let n=e.parent.content.cutByIndex(e.startIndex,e.endIndex);for(let s=e.depth,a=0,o=0;;--s){let l=e.$from.node(s),i=e.$from.index(s)+a,u=e.$to.indexAfter(s)-o;if(sn;S--)k||s.index(S)>0?(k=!0,x=dn.from(s.node(S).copy(x)),y++):u--;let _=dn.empty,b=0;for(let S=o,k=!1;S>n;S--)k||a.after(S+1)=0;l--){if(s.size){let i=n[l].type.contentMatch.matchFragment(s);if(!i||!i.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}s=dn.from(n[l].type.create(n[l].attrs,s))}let a=t.start,o=t.end;e.step(new Bd(a,o,a,o,new Kn(s,0,0),n.length,!0))}function tyt(e,t,n,s,a){if(!s.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let o=e.steps.length;e.doc.nodesBetween(t,n,(l,i)=>{let u=typeof a=="function"?a(l):a;if(l.isTextblock&&!l.hasMarkup(s,u)&&ryt(e.doc,e.mapping.slice(o).map(i),s)){let p=null;if(s.schema.linebreakReplacement){let b=s.whitespace=="pre",S=!!s.contentMatch.matchType(s.schema.linebreakReplacement);b&&!S?p=!1:!b&&S&&(p=!0)}p===!1&&LFe(e,l,i,o),zye(e,e.mapping.slice(o).map(i,1),s,void 0,p===null);let x=e.mapping.slice(o),y=x.map(i,1),_=x.map(i+l.nodeSize,1);return e.step(new Bd(y,_,y+1,_-1,new Kn(dn.from(s.create(u,null,l.marks)),0,0),1,!0)),p===!0&&PFe(e,l,i,o),!1}})}function PFe(e,t,n,s){t.forEach((a,o)=>{if(a.isText){let l,i=/\r?\n|\r/g;for(;l=i.exec(a.text);){let u=e.mapping.slice(s).map(n+1+o+l.index);e.replaceWith(u,u+1,t.type.schema.linebreakReplacement.create())}}})}function LFe(e,t,n,s){t.forEach((a,o)=>{if(a.type==a.type.schema.linebreakReplacement){let l=e.mapping.slice(s).map(n+1+o);e.replaceWith(l,l+1,t.type.schema.text(` `))}})}function ryt(e,t,n){let s=e.resolve(t),a=s.index();return s.parent.canReplaceWith(a,a+1,n)}function nyt(e,t,n,s,a){let o=e.doc.nodeAt(t);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 e.replaceWith(t,t+o.nodeSize,l);if(!n.validContent(o.content))throw new RangeError("Invalid content for node type "+n.name);e.step(new Bd(t,t+o.nodeSize,t+1,t+o.nodeSize-1,new Kn(dn.from(l),0,0),1,!0))}function xy(e,t,n=1,s){let a=e.resolve(t),o=a.depth-n,l=s&&s[s.length-1]||a.parent;if(o<0||a.parent.type.spec.isolating||!a.parent.canReplace(a.index(),a.parent.childCount)||!l.type.validContent(a.parent.content.cutByIndex(a.index(),a.parent.childCount)))return!1;for(let p=a.depth-1,x=n-2;p>o;p--,x--){let y=a.node(p),_=a.index(p);if(y.type.spec.isolating)return!1;let b=y.content.cutByIndex(_,y.childCount),S=s&&s[x+1];S&&(b=b.replaceChild(0,S.type.create(S.attrs)));let k=s&&s[x]||y;if(!y.canReplace(_+1,y.childCount)||!k.type.validContent(b))return!1}let i=a.indexAfter(o),u=s&&s[0];return a.node(o).canReplaceWith(i,i,u?u.type:a.node(o+1).type)}function syt(e,t,n=1,s){let a=e.doc.resolve(t),o=dn.empty,l=dn.empty;for(let i=a.depth,u=a.depth-n,p=n-1;i>u;i--,p--){o=dn.from(a.node(i).copy(o));let x=s&&s[p];l=dn.from(x?x.type.create(x.attrs,l):a.node(i).copy(l))}e.step(new Ad(t,t,new Kn(o.append(l),n,n),!0))}function Cv(e,t){let n=e.resolve(t),s=n.index();return OFe(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(s,s+1)}function ayt(e,t){t.content.size||e.type.compatibleContent(t.type);let n=e.contentMatchAt(e.childCount),{linebreakReplacement:s}=e.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&&OFe(o,l)&&s.node(a).canReplace(i,i+1))return t;if(a==0)break;t=n<0?s.before(a):s.after(a)}}function iyt(e,t,n){let s=null,{linebreakReplacement:a}=e.doc.type.schema,o=e.doc.resolve(t-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=e.steps.length;if(s===!1){let x=e.doc.resolve(t+n);LFe(e,x.node(),x.before(),i)}l.inlineContent&&zye(e,t+n-1,l,o.node().contentMatchAt(o.index()),s==null);let u=e.mapping.slice(i),p=u.map(t-n);if(e.step(new Ad(p,u.map(t+n,-1),Kn.empty,!0)),s===!0){let x=e.doc.resolve(p);PFe(e,x.node(),x.before(),e.steps.length)}return e}function oyt(e,t,n){let s=e.resolve(t);if(s.parent.canReplaceWith(s.index(),s.index(),n))return t;if(s.parentOffset==0)for(let a=s.depth-1;a>=0;a--){let o=s.index(a);if(s.node(a).canReplaceWith(o,o,n))return s.before(a+1);if(o>0)return null}if(s.parentOffset==s.parent.content.size)for(let a=s.depth-1;a>=0;a--){let o=s.indexAfter(a);if(s.node(a).canReplaceWith(o,o,n))return s.after(a+1);if(o=0;l--){let i=l==s.depth?0:s.pos<=(s.start(l+1)+s.end(l+1))/2?-1:1,u=s.index(l)+(i>0?1:0),p=s.node(l),x=!1;if(o==1)x=p.canReplace(u,u,a);else{let y=p.contentMatchAt(u).findWrapping(a.firstChild.type);x=y&&p.canReplaceWith(u,u,y[0])}if(x)return i==0?s.pos:i<0?s.before(l+1):s.after(l+1)}return null}function gae(e,t,n=t,s=Kn.empty){if(t==n&&!s.size)return null;let a=e.resolve(t),o=e.resolve(n);return RFe(a,o,s)?new Ad(t,n,s):new lyt(a,o,s).fit()}function RFe(e,t,n){return!n.openStart&&!n.openEnd&&e.start()==t.start()&&e.parent.canReplace(e.index(),t.index(),n.content)}class lyt{constructor(t,n,s){this.$from=t,this.$to=n,this.unplaced=s,this.frontier=[],this.placed=dn.empty;for(let a=0;a<=t.depth;a++){let o=t.node(a);this.frontier.push({type:o.type,match:o.contentMatchAt(t.indexAfter(a))})}for(let a=t.depth;a>0;a--)this.placed=dn.from(t.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 t=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,s=this.$from,a=this.close(t<0?this.$to:s.doc.resolve(t));if(!a)return null;let o=this.placed,l=s.depth,i=a.depth;for(;l&&i&&o.childCount==1;)o=o.firstChild.content,l--,i--;let u=new Kn(o,l,i);return t>-1?new Bd(s.pos,t,this.$to.pos,this.$to.end(),u,n):u.size||s.pos!=this.$to.pos?new Ad(s.pos,a.pos,u):null}findFittable(){let t=this.unplaced.openStart;for(let n=this.unplaced.content,s=0,a=this.unplaced.openEnd;s1&&(a=0),o.type.spec.isolating&&a<=s){t=s;break}n=o.content}for(let n=1;n<=2;n++)for(let s=n==1?t:this.unplaced.openStart;s>=0;s--){let a,o=null;s?(o=Xce(this.unplaced.content,s-1).firstChild,a=o.content):a=this.unplaced.content;let l=a.firstChild;for(let i=this.depth;i>=0;i--){let{type:u,match:p}=this.frontier[i],x,y=null;if(n==1&&(l?p.matchType(l.type)||(y=p.fillBefore(dn.from(l),!1)):o&&u.compatibleContent(o.type)))return{sliceDepth:s,frontierDepth:i,parent:o,inject:y};if(n==2&&l&&(x=p.findWrapping(l.type)))return{sliceDepth:s,frontierDepth:i,parent:o,wrap:x};if(o&&p.matchType(o.type))break}}}openMore(){let{content:t,openStart:n,openEnd:s}=this.unplaced,a=Xce(t,n);return!a.childCount||a.firstChild.isLeaf?!1:(this.unplaced=new Kn(t,n+1,Math.max(s,a.size+n>=t.size-s?n+1:0)),!0)}dropNode(){let{content:t,openStart:n,openEnd:s}=this.unplaced,a=Xce(t,n);if(a.childCount<=1&&n>0){let o=t.size-n<=n+a.size;this.unplaced=new Kn(OT(t,n-1,1),n-1,o?n-1:s)}else this.unplaced=new Kn(OT(t,n,1),n,s)}placeNodes({sliceDepth:t,frontierDepth:n,parent:s,inject:a,wrap:o}){for(;this.depth>n;)this.closeFrontierNode();if(o)for(let k=0;k1||u==0||k.content.size)&&(y=M,x.push(FFe(k.mark(_.allowedMarks(k.marks)),p==1?u:0,p==i.childCount?b:-1)))}let S=p==i.childCount;S||(b=-1),this.placed=DT(this.placed,n,dn.from(x)),this.frontier[n].match=y,S&&b<0&&s&&s.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let k=0,M=i;k1&&a==this.$to.end(--s);)++a;return a}findCloseLevel(t){e:for(let n=Math.min(this.depth,t.depth);n>=0;n--){let{match:s,type:a}=this.frontier[n],o=n=0;i--){let{match:u,type:p}=this.frontier[i],x=Qce(t,i,p,u,!0);if(!x||x.childCount)continue e}return{depth:n,fit:l,move:o?t.doc.resolve(t.after(n+1)):t}}}}close(t){let n=this.findCloseLevel(t);if(!n)return null;for(;this.depth>n.depth;)this.closeFrontierNode();n.fit.childCount&&(this.placed=DT(this.placed,n.depth,n.fit)),t=n.move;for(let s=n.depth+1;s<=t.depth;s++){let a=t.node(s),o=a.type.contentMatch.fillBefore(a.content,!0,t.index(s));this.openFrontierNode(a.type,a.attrs,o)}return t}openFrontierNode(t,n=null,s){let a=this.frontier[this.depth];a.match=a.match.matchType(t),this.placed=DT(this.placed,this.depth,dn.from(t.create(n,s))),this.frontier.push({type:t,match:t.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(dn.empty,!0);n.childCount&&(this.placed=DT(this.placed,this.frontier.length,n))}}function OT(e,t,n){return t==0?e.cutByIndex(n,e.childCount):e.replaceChild(0,e.firstChild.copy(OT(e.firstChild.content,t-1,n)))}function DT(e,t,n){return t==0?e.append(n):e.replaceChild(e.childCount-1,e.lastChild.copy(DT(e.lastChild.content,t-1,n)))}function Xce(e,t){for(let n=0;n1&&(s=s.replaceChild(0,FFe(s.firstChild,t-1,s.childCount==1?n-1:0))),t>0&&(s=e.type.contentMatch.fillBefore(s).append(s),n<=0&&(s=s.append(e.type.contentMatch.matchFragment(s).fillBefore(dn.empty,!0)))),e.copy(s)}function Qce(e,t,n,s,a){let o=e.node(t),l=a?e.indexAfter(t):e.index(t);if(l==o.childCount&&!n.compatibleContent(o.type))return null;let i=s.fillBefore(o.content,!0,l);return i&&!cyt(n,o.content,l)?i:null}function cyt(e,t,n){for(let s=n;s0;_--,b--){let S=a.node(_).type.spec;if(S.defining||S.definingAsContext||S.isolating)break;l.indexOf(_)>-1?i=_:a.before(_)==b&&l.splice(1,0,-_)}let u=l.indexOf(i),p=[],x=s.openStart;for(let _=s.content,b=0;;b++){let S=_.firstChild;if(p.push(S),b==s.openStart)break;_=S.content}for(let _=x-1;_>=0;_--){let b=p[_],S=dyt(b.type);if(S&&!b.sameMarkup(a.node(Math.abs(i)-1)))x=_;else if(S||!b.type.isTextblock)break}for(let _=s.openStart;_>=0;_--){let b=(_+x+1)%(s.openStart+1),S=p[b];if(S)for(let k=0;k=0&&(e.replace(t,n,s),!(e.steps.length>y));_--){let b=l[_];b<0||(t=a.before(b),n=o.after(b))}}function zFe(e,t,n,s,a){if(ts){let o=a.contentMatchAt(0),l=o.fillBefore(e).append(e);e=l.append(o.matchFragment(l).fillBefore(dn.empty,!0))}return e}function hyt(e,t,n,s){if(!s.isInline&&t==n&&e.doc.resolve(t).parent.content.size){let a=oyt(e.doc,t,s.type);a!=null&&(t=n=a)}e.replaceRange(t,n,new Kn(dn.from(s),0,0))}function fyt(e,t,n){let s=e.doc.resolve(t),a=e.doc.resolve(n),o=BFe(s,a);for(let l=0;l0&&(u||s.node(i-1).canReplace(s.index(i-1),a.indexAfter(i-1))))return e.delete(s.before(i),a.after(i))}for(let l=1;l<=s.depth&&l<=a.depth;l++)if(t-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 e.delete(s.before(l),n);e.delete(t,n)}function BFe(e,t){let n=[],s=Math.min(e.depth,t.depth);for(let a=s;a>=0;a--){let o=e.start(a);if(ot.pos+(t.depth-a)||e.node(a).type.spec.isolating||t.node(a).type.spec.isolating)break;(o==t.start(a)||a==e.depth&&a==t.depth&&e.parent.inlineContent&&t.parent.inlineContent&&a&&t.start(a-1)==o-1)&&n.push(a)}return n}class XS extends Nu{constructor(t,n,s){super(),this.pos=t,this.attr=n,this.value=s}apply(t){let n=t.nodeAt(this.pos);if(!n)return $c.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 $c.fromReplace(t,this.pos,this.pos+1,new Kn(dn.from(a),0,n.isLeaf?0:1))}getMap(){return of.empty}invert(t){return new XS(this.pos,this.attr,t.nodeAt(this.pos).attrs[this.attr])}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new XS(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(t,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new XS(n.pos,n.attr,n.value)}}Nu.jsonID("attr",XS);class zE extends Nu{constructor(t,n){super(),this.attr=t,this.value=n}apply(t){let n=Object.create(null);for(let a in t.attrs)n[a]=t.attrs[a];n[this.attr]=this.value;let s=t.type.create(n,t.content,t.marks);return $c.ok(s)}getMap(){return of.empty}invert(t){return new zE(this.attr,t.attrs[this.attr])}map(t){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(t,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new zE(n.attr,n.value)}}Nu.jsonID("docAttr",zE);let DC=class extends Error{};DC=function e(t){let n=Error.call(this,t);return n.__proto__=e.prototype,n};DC.prototype=Object.create(Error.prototype);DC.prototype.constructor=DC;DC.prototype.name="TransformError";class $ye{constructor(t){this.doc=t,this.steps=[],this.docs=[],this.mapping=new FE}get before(){return this.docs.length?this.docs[0]:this.doc}step(t){let n=this.maybeStep(t);if(n.failed)throw new DC(n.failed);return this}maybeStep(t){let n=t.apply(this.doc);return n.failed||this.addStep(t,n.doc),n}get docChanged(){return this.steps.length>0}addStep(t,n){this.docs.push(this.doc),this.steps.push(t),this.mapping.appendMap(t.getMap()),this.doc=n}replace(t,n=t,s=Kn.empty){let a=gae(this.doc,t,n,s);return a&&this.step(a),this}replaceWith(t,n,s){return this.replace(t,n,new Kn(dn.from(s),0,0))}delete(t,n){return this.replace(t,n,Kn.empty)}insert(t,n){return this.replaceWith(t,t,n)}replaceRange(t,n,s){return uyt(this,t,n,s),this}replaceRangeWith(t,n,s){return hyt(this,t,n,s),this}deleteRange(t,n){return fyt(this,t,n),this}lift(t,n){return Xxt(this,t,n),this}join(t,n=1){return iyt(this,t,n),this}wrap(t,n){return eyt(this,t,n),this}setBlockType(t,n=t,s,a=null){return tyt(this,t,n,s,a),this}setNodeMarkup(t,n,s=null,a){return nyt(this,t,n,s,a),this}setNodeAttribute(t,n,s){return this.step(new XS(t,n,s)),this}setDocAttribute(t,n){return this.step(new zE(t,n)),this}addNodeMark(t,n){return this.step(new C1(t,n)),this}removeNodeMark(t,n){let s=this.doc.nodeAt(t);if(!s)throw new RangeError("No node at position "+t);if(n instanceof Ho)n.isInSet(s.marks)&&this.step(new uk(t,n));else{let a=s.marks,o,l=[];for(;o=n.isInSet(a);)l.push(new uk(t,o)),a=o.removeFromSet(a);for(let i=l.length-1;i>=0;i--)this.step(l[i])}return this}split(t,n=1,s){return syt(this,t,n,s),this}addMark(t,n,s){return Kxt(this,t,n,s),this}removeMark(t,n,s){return Zxt(this,t,n,s),this}clearIncompatible(t,n,s){return zye(this,t,n,s),this}}const Jce=Object.create(null);class La{constructor(t,n,s){this.$anchor=t,this.$head=n,this.ranges=s||[new $Fe(t.min(n),t.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 t=this.ranges;for(let n=0;n=0;o--){let l=n<0?$4(t.node(0),t.node(o),t.before(o+1),t.index(o),n,s):$4(t.node(0),t.node(o),t.after(o+1),t.index(o)+1,n,s);if(l)return l}return null}static near(t,n=1){return this.findFrom(t,n)||this.findFrom(t,-n)||new bf(t.node(0))}static atStart(t){return $4(t,t,0,0,1)||new bf(t)}static atEnd(t){return $4(t,t,t.content.size,t.childCount,-1)||new bf(t)}static fromJSON(t,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let s=Jce[n.type];if(!s)throw new RangeError(`No selection type ${n.type} defined`);return s.fromJSON(t,n)}static jsonID(t,n){if(t in Jce)throw new RangeError("Duplicate use of selection JSON ID "+t);return Jce[t]=n,n.prototype.jsonID=t,n}getBookmark(){return ya.between(this.$anchor,this.$head).getBookmark()}}La.prototype.visible=!0;class $Fe{constructor(t,n){this.$from=t,this.$to=n}}let d4e=!1;function u4e(e){!d4e&&!e.parent.inlineContent&&(d4e=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+e.parent.type.name+")"))}class ya extends La{constructor(t,n=t){u4e(t),u4e(n),super(t,n)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(t,n){let s=t.resolve(n.map(this.head));if(!s.parent.inlineContent)return La.near(s);let a=t.resolve(n.map(this.anchor));return new ya(a.parent.inlineContent?a:s,s)}replace(t,n=Kn.empty){if(super.replace(t,n),n==Kn.empty){let s=this.$from.marksAcross(this.$to);s&&t.ensureMarks(s)}}eq(t){return t instanceof ya&&t.anchor==this.anchor&&t.head==this.head}getBookmark(){return new xae(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(t,n){if(typeof n.anchor!="number"||typeof n.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new ya(t.resolve(n.anchor),t.resolve(n.head))}static create(t,n,s=n){let a=t.resolve(n);return new this(a,s==n?a:t.resolve(s))}static between(t,n,s){let a=t.pos-n.pos;if((!s||a)&&(s=a>=0?1:-1),!n.parent.inlineContent){let o=La.findFrom(n,s,!0)||La.findFrom(n,-s,!0);if(o)n=o.$head;else return La.near(n,s)}return t.parent.inlineContent||(a==0?t=n:(t=(La.findFrom(t,-s,!0)||La.findFrom(t,s,!0)).$anchor,t.pos0?0:1);a>0?l=0;l+=a){let i=t.child(l);if(i.isAtom){if(!o&&ua.isSelectable(i))return ua.create(e,n-(a<0?i.nodeSize:0))}else{let u=$4(e,i,n+a,a<0?i.childCount:0,a,o);if(u)return u}n+=i.nodeSize*a}return null}function h4e(e,t,n){let s=e.steps.length-1;if(s{l==null&&(l=x)}),e.setSelection(La.near(e.doc.resolve(l),n))}const f4e=1,oO=2,p4e=4;class myt extends $ye{constructor(t){super(t.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=t.selection,this.storedMarks=t.storedMarks}get selection(){return this.curSelectionFor0}setStoredMarks(t){return this.storedMarks=t,this.updated|=oO,this}ensureMarks(t){return Ho.sameSet(this.storedMarks||this.selection.$from.marks(),t)||this.setStoredMarks(t),this}addStoredMark(t){return this.ensureMarks(t.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(t){return this.ensureMarks(t.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&oO)>0}addStep(t,n){super.addStep(t,n),this.updated=this.updated&~oO,this.storedMarks=null}setTime(t){return this.time=t,this}replaceSelection(t){return this.selection.replace(this,t),this}replaceSelectionWith(t,n=!0){let s=this.selection;return n&&(t=t.mark(this.storedMarks||(s.empty?s.$from.marks():s.$from.marksAcross(s.$to)||Ho.none))),s.replaceWith(this,t),this}deleteSelection(){return this.selection.replace(this),this}insertText(t,n,s){let a=this.doc.type.schema;if(n==null)return t?this.replaceSelectionWith(a.text(t),!0):this.deleteSelection();{if(s==null&&(s=n),!t)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(t,o)),!this.selection.empty&&this.selection.to==n+t.length&&this.setSelection(La.near(this.selection.$to)),this}}setMeta(t,n){return this.meta[typeof t=="string"?t:t.key]=n,this}getMeta(t){return this.meta[typeof t=="string"?t:t.key]}get isGeneric(){for(let t in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=p4e,this}get scrolledIntoView(){return(this.updated&p4e)>0}}function m4e(e,t){return!t||!e?e:e.bind(t)}class RT{constructor(t,n,s){this.name=t,this.init=m4e(n.init,s),this.apply=m4e(n.apply,s)}}const gyt=[new RT("doc",{init(e){return e.doc||e.schema.topNodeType.createAndFill()},apply(e){return e.doc}}),new RT("selection",{init(e,t){return e.selection||La.atStart(t.doc)},apply(e){return e.selection}}),new RT("storedMarks",{init(e){return e.storedMarks||null},apply(e,t,n,s){return s.selection.$cursor?e.storedMarks:null}}),new RT("scrollToSelection",{init(){return 0},apply(e,t){return e.scrolledIntoView?t+1:t}})];class ede{constructor(t,n){this.schema=t,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=gyt.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 RT(s.key,s.spec.state,s))})}}class rS{constructor(t){this.config=t}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(t){return this.applyTransaction(t).state}filterTransaction(t,n=-1){for(let s=0;ss.toJSON())),t&&typeof t=="object")for(let s in t){if(s=="doc"||s=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let a=t[s],o=a.spec.state;o&&o.toJSON&&(n[s]=o.toJSON.call(a,this[a.key]))}return n}static fromJSON(t,n,s){if(!n)throw new RangeError("Invalid input for EditorState.fromJSON");if(!t.schema)throw new RangeError("Required config field 'schema' missing");let a=new ede(t.schema,t.plugins),o=new rS(a);return a.fields.forEach(l=>{if(l.name=="doc")o.doc=tv.fromJSON(t.schema,n.doc);else if(l.name=="selection")o.selection=La.fromJSON(o.doc,n.selection);else if(l.name=="storedMarks")n.storedMarks&&(o.storedMarks=n.storedMarks.map(t.schema.markFromJSON));else{if(s)for(let i in s){let u=s[i],p=u.spec.state;if(u.key==l.name&&p&&p.fromJSON&&Object.prototype.hasOwnProperty.call(n,i)){o[l.name]=p.fromJSON.call(u,t,n[i],o);return}}o[l.name]=l.init(t,o)}}),o}}function UFe(e,t,n){for(let s in e){let a=e[s];a instanceof Function?a=a.bind(t):s=="handleDOMEvents"&&(a=UFe(a,t,{})),n[s]=a}return n}class gd{constructor(t){this.spec=t,this.props={},t.props&&UFe(t.props,this,this.props),this.key=t.key?t.key.key:qFe("plugin")}getState(t){return t[this.key]}}const tde=Object.create(null);function qFe(e){return e in tde?e+"$"+ ++tde[e]:(tde[e]=0,e+"$")}class Su{constructor(t="key"){this.key=qFe(t)}get(t){return t.config.pluginsByKey[this.key]}getState(t){return t[this.key]}}const ru=function(e){for(var t=0;;t++)if(e=e.previousSibling,!e)return t},RC=function(e){let t=e.assignedSlot||e.parentNode;return t&&t.nodeType==11?t.host:t};let Dfe=null;const Ux=function(e,t,n){let s=Dfe||(Dfe=document.createRange());return s.setEnd(e,n??e.nodeValue.length),s.setStart(e,t||0),s},xyt=function(){Dfe=null},hk=function(e,t,n,s){return n&&(g4e(e,t,n,s,-1)||g4e(e,t,n,s,1))},yyt=/^(img|br|input|textarea|hr)$/i;function g4e(e,t,n,s,a){for(var o;;){if(e==n&&t==s)return!0;if(t==(a<0?0:sp(e))){let l=e.parentNode;if(!l||l.nodeType!=1||cP(e)||yyt.test(e.nodeName)||e.contentEditable=="false")return!1;t=ru(e)+(a<0?0:1),e=l}else if(e.nodeType==1){let l=e.childNodes[t+(a<0?-1:0)];if(l.nodeType==1&&l.contentEditable=="false")if(!((o=l.pmViewDesc)===null||o===void 0)&&o.ignoreForSelection)t+=a;else return!1;else e=l,t=a<0?sp(e):0}else return!1}}function sp(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function vyt(e,t){for(;;){if(e.nodeType==3&&t)return e;if(e.nodeType==1&&t>0){if(e.contentEditable=="false")return null;e=e.childNodes[t-1],t=sp(e)}else if(e.parentNode&&!cP(e))t=ru(e),e=e.parentNode;else return null}}function _yt(e,t){for(;;){if(e.nodeType==3&&t2),Qf=FC||(Zg?/Mac/.test(Zg.platform):!1),WFe=Zg?/Win/.test(Zg.platform):!1,ey=/Android \d/.test(Mv),dP=!!x4e&&"webkitFontSmoothing"in x4e.documentElement.style,kyt=dP?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function Nyt(e){let t=e.defaultView&&e.defaultView.visualViewport;return t?{left:0,right:t.width,top:0,bottom:t.height}:{left:0,right:e.documentElement.clientWidth,top:0,bottom:e.documentElement.clientHeight}}function Ix(e,t){return typeof e=="number"?e:e[t]}function Syt(e){let t=e.getBoundingClientRect(),n=t.width/e.offsetWidth||1,s=t.height/e.offsetHeight||1;return{left:t.left,right:t.left+e.clientWidth*n,top:t.top,bottom:t.top+e.clientHeight*s}}function y4e(e,t,n){let s=e.someProp("scrollThreshold")||0,a=e.someProp("scrollMargin")||5,o=e.dom.ownerDocument;for(let l=n||e.dom;l;){if(l.nodeType!=1){l=RC(l);continue}let i=l,u=i==o.body,p=u?Nyt(o):Syt(i),x=0,y=0;if(t.topp.bottom-Ix(s,"bottom")&&(y=t.bottom-t.top>p.bottom-p.top?t.top+Ix(a,"top")-p.top:t.bottom-p.bottom+Ix(a,"bottom")),t.leftp.right-Ix(s,"right")&&(x=t.right-p.right+Ix(a,"right")),x||y)if(u)o.defaultView.scrollBy(x,y);else{let b=i.scrollLeft,S=i.scrollTop;y&&(i.scrollTop+=y),x&&(i.scrollLeft+=x);let k=i.scrollLeft-b,M=i.scrollTop-S;t={left:t.left-k,top:t.top-M,right:t.right-k,bottom:t.bottom-M}}let _=u?"fixed":getComputedStyle(l).position;if(/^(fixed|sticky)$/.test(_))break;l=_=="absolute"?l.offsetParent:RC(l)}}function Cyt(e){let t=e.dom.getBoundingClientRect(),n=Math.max(0,t.top),s,a;for(let o=(t.left+t.right)/2,l=n+1;l=n-20){s=i,a=u.top;break}}return{refDOM:s,refTop:a,stack:GFe(e.dom)}}function GFe(e){let t=[],n=e.ownerDocument;for(let s=e;s&&(t.push({dom:s,top:s.scrollTop,left:s.scrollLeft}),e!=n);s=RC(s));return t}function Myt({refDOM:e,refTop:t,stack:n}){let s=e?e.getBoundingClientRect().top:0;KFe(n,s==0?0:s-t)}function KFe(e,t){for(let n=0;n=i){l=Math.max(S.bottom,l),i=Math.min(S.top,i);let k=S.left>t.left?S.left-t.left:S.right=(S.left+S.right)/2?1:0));continue}}else S.top>t.top&&!u&&S.left<=t.left&&S.right>=t.left&&(u=x,p={left:Math.max(S.left,Math.min(S.right,t.left)),top:S.top});!n&&(t.left>=S.right&&t.top>=S.top||t.left>=S.left&&t.top>=S.bottom)&&(o=y+1)}}return!n&&u&&(n=u,a=p,s=0),n&&n.nodeType==3?Ayt(n,a):!n||s&&n.nodeType==1?{node:e,offset:o}:ZFe(n,a)}function Ayt(e,t){let n=e.nodeValue.length,s=document.createRange(),a;for(let o=0;o=(l.left+l.right)/2?1:0)};break}}return s.detach(),a||{node:e,offset:0}}function qye(e,t){return e.left>=t.left-1&&e.left<=t.right+1&&e.top>=t.top-1&&e.top<=t.bottom+1}function Eyt(e,t){let n=e.parentNode;return n&&/^li$/i.test(n.nodeName)&&t.left(l.left+l.right)/2?1:-1}return e.docView.posFromDOM(s,a,o)}function Pyt(e,t,n,s){let a=-1;for(let o=t,l=!1;o!=e.dom;){let i=e.docView.nearestDesc(o,!0),u;if(!i)return null;if(i.dom.nodeType==1&&(i.node.isBlock&&i.parent||!i.contentDOM)&&((u=i.dom.getBoundingClientRect()).width||u.height)&&(i.node.isBlock&&i.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(i.dom.nodeName)&&(!l&&u.left>s.left||u.top>s.top?a=i.posBefore:(!l&&u.right-1?a:e.docView.posFromDOM(t,n,-1)}function YFe(e,t,n){let s=e.childNodes.length;if(s&&n.topt.top&&a++}let p;dP&&a&&s.nodeType==1&&(p=s.childNodes[a-1]).nodeType==1&&p.contentEditable=="false"&&p.getBoundingClientRect().top>=t.top&&a--,s==e.dom&&a==s.childNodes.length-1&&s.lastChild.nodeType==1&&t.top>s.lastChild.getBoundingClientRect().bottom?i=e.state.doc.content.size:(a==0||s.nodeType!=1||s.childNodes[a-1].nodeName!="BR")&&(i=Pyt(e,s,a,t))}i==null&&(i=Iyt(e,l,t));let u=e.docView.nearestDesc(l,!0);return{pos:i,inside:u?u.posAtStart-u.border:-1}}function v4e(e){return e.top=0&&a==s.nodeValue.length?(u--,x=1):n<0?u--:p++,uT($0(Ux(s,u,p),x),x<0)}if(!e.state.doc.resolve(t-(o||0)).parent.inlineContent){if(o==null&&a&&(n<0||a==sp(s))){let u=s.childNodes[a-1];if(u.nodeType==1)return rde(u.getBoundingClientRect(),!1)}if(o==null&&a=0)}if(o==null&&a&&(n<0||a==sp(s))){let u=s.childNodes[a-1],p=u.nodeType==3?Ux(u,sp(u)-(l?0:1)):u.nodeType==1&&(u.nodeName!="BR"||!u.nextSibling)?u:null;if(p)return uT($0(p,1),!1)}if(o==null&&a=0)}function uT(e,t){if(e.width==0)return e;let n=t?e.left:e.right;return{top:e.top,bottom:e.bottom,left:n,right:n}}function rde(e,t){if(e.height==0)return e;let n=t?e.top:e.bottom;return{top:n,bottom:n,left:e.left,right:e.right}}function QFe(e,t,n){let s=e.state,a=e.root.activeElement;s!=t&&e.updateState(t),a!=e.dom&&e.focus();try{return n()}finally{s!=t&&e.updateState(s),a!=e.dom&&a&&a.focus()}}function Dyt(e,t,n){let s=t.selection,a=n=="up"?s.$from:s.$to;return QFe(e,t,()=>{let{node:o}=e.docView.domFromPos(a.pos,n=="up"?-1:1);for(;;){let i=e.docView.nearestDesc(o,!0);if(!i)break;if(i.node.isBlock){o=i.contentDOM||i.dom;break}o=i.dom.parentNode}let l=XFe(e,a.pos,1);for(let i=o.firstChild;i;i=i.nextSibling){let u;if(i.nodeType==1)u=i.getClientRects();else if(i.nodeType==3)u=Ux(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 Ryt=/[\u0590-\u08ac]/;function Fyt(e,t,n){let{$head:s}=t.selection;if(!s.parent.isTextblock)return!1;let a=s.parentOffset,o=!a,l=a==s.parent.content.size,i=e.domSelection();return i?!Ryt.test(s.parent.textContent)||!i.modify?n=="left"||n=="backward"?o:l:QFe(e,t,()=>{let{focusNode:u,focusOffset:p,anchorNode:x,anchorOffset:y}=e.domSelectionRange(),_=i.caretBidiLevel;i.modify("move",n,"character");let b=s.depth?e.docView.domAfterPos(s.before()):e.dom,{focusNode:S,focusOffset:k}=e.domSelectionRange(),M=S&&!b.contains(S.nodeType==1?S:S.parentNode)||u==S&&p==k;try{i.collapse(x,y),u&&(u!=x||p!=y)&&i.extend&&i.extend(u,p)}catch{}return _!=null&&(i.caretBidiLevel=_),M}):s.pos==s.start()||s.pos==s.end()}let _4e=null,b4e=null,w4e=!1;function zyt(e,t,n){return _4e==t&&b4e==n?w4e:(_4e=t,b4e=n,w4e=n=="up"||n=="down"?Dyt(e,t,n):Fyt(e,t,n))}const gp=0,j4e=1,ij=2,Yg=3;class uP{constructor(t,n,s,a){this.parent=t,this.children=n,this.dom=s,this.contentDOM=a,this.dirty=gp,s.pmViewDesc=this}matchesWidget(t){return!1}matchesMark(t){return!1}matchesNode(t,n,s){return!1}matchesHack(t){return!1}parseRule(){return null}stopEvent(t){return!1}get size(){let t=0;for(let n=0;nru(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))a=t.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(n==0)for(let o=t;;o=o.parentNode){if(o==this.dom){a=!1;break}if(o.previousSibling)break}if(a==null&&n==t.childNodes.length)for(let o=t;;o=o.parentNode){if(o==this.dom){a=!0;break}if(o.nextSibling)break}}return a??s>0?this.posAtEnd:this.posAtStart}nearestDesc(t,n=!1){for(let s=!0,a=t;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(t.nodeType==1?t:t.parentNode):l==t))s=!1;else return o}}getDesc(t){let n=t.pmViewDesc;for(let s=n;s;s=s.parent)if(s==this)return n}posFromDOM(t,n,s){for(let a=t;a;a=a.parentNode){let o=this.getDesc(a);if(o)return o.localPosFromDOM(t,n,s)}return-1}descAt(t){for(let n=0,s=0;nt||l instanceof eze){a=t-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 JFe&&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?ru(o.dom)+1:0}}else{let o,l=!0;for(;o=s=x&&n<=p-u.border&&u.node&&u.contentDOM&&this.contentDOM.contains(u.contentDOM))return u.parseRange(t,n,x);t=l;for(let y=i;y>0;y--){let _=this.children[y-1];if(_.size&&_.dom.parentNode==this.contentDOM&&!_.emptyChildAt(1)){a=ru(_.dom)+1;break}t-=_.size}a==-1&&(a=0)}if(a>-1&&(p>n||i==this.children.length-1)){n=p;for(let x=i+1;xS&&ln){let S=i;i=u,u=S}let b=document.createRange();b.setEnd(u.node,u.offset),b.setStart(i.node,i.offset),p.removeAllRanges(),p.addRange(b)}}ignoreMutation(t){return!this.contentDOM&&t.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(t,n){for(let s=0,a=0;a=s:ts){let i=s+o.border,u=l-o.border;if(t>=i&&n<=u){this.dirty=t==s||n==l?ij:j4e,t==i&&n==u&&(o.contentLost||o.dom.parentNode!=this.contentDOM)?o.dirty=Yg:o.markDirty(t-i,n-i);return}else o.dirty=o.dom==o.contentDOM&&o.dom.parentNode==this.contentDOM&&!o.children.length?ij:Yg}s=l}this.dirty=ij}markParentsDirty(){let t=1;for(let n=this.parent;n;n=n.parent,t++){let s=t==1?ij:j4e;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(t,[],l,null),this.widget=n,this.widget=n,o=this}matchesWidget(t){return this.dirty==gp&&t.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(t){let n=this.widget.spec.stopEvent;return n?n(t):!1}ignoreMutation(t){return t.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 Byt extends uP{constructor(t,n,s,a){super(t,[],n,null),this.textDOM=s,this.text=a}get size(){return this.text.length}localPosFromDOM(t,n){return t!=this.textDOM?this.posAtStart+(n?this.size:0):this.posAtStart+n}domFromPos(t){return{node:this.textDOM,offset:t}}ignoreMutation(t){return t.type==="characterData"&&t.target.nodeValue==t.oldValue}}class fk extends uP{constructor(t,n,s,a,o){super(t,[],s,a),this.mark=n,this.spec=o}static create(t,n,s,a){let o=a.nodeViews[n.type.name],l=o&&o(n,a,s);return(!l||!l.dom)&&(l=Tk.renderSpec(document,n.type.spec.toDOM(n,s),null,n.attrs)),new fk(t,n,l.dom,l.contentDOM||l.dom,l)}parseRule(){return this.dirty&Yg||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(t){return this.dirty!=Yg&&this.mark.eq(t)}markDirty(t,n){if(super.markDirty(t,n),this.dirty!=gp){let s=this.parent;for(;!s.node;)s=s.parent;s.dirty0&&(o=$fe(o,0,t,s));for(let i=0;i{if(!u)return l;if(u.parent)return u.parent.posBeforeChild(u)},s,a),x=p&&p.dom,y=p&&p.contentDOM;if(n.isText){if(!x)x=document.createTextNode(n.text);else if(x.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else x||({dom:x,contentDOM:y}=Tk.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!y&&!n.isText&&x.nodeName!="BR"&&(x.hasAttribute("contenteditable")||(x.contentEditable="false"),n.type.spec.draggable&&(x.draggable=!0));let _=x;return x=nze(x,s,n),p?u=new $yt(t,n,s,a,x,y||null,_,p,o,l+1):n.isText?new vae(t,n,s,a,x,_,o):new nv(t,n,s,a,x,y||null,_,o,l+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let t={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(t.preserveWhitespace="full"),!this.contentDOM)t.getContent=()=>this.node.content;else if(!this.contentLost)t.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)){t.contentElement=s.dom.parentNode;break}}t.contentElement||(t.getContent=()=>dn.empty)}return t}matchesNode(t,n,s){return this.dirty==gp&&t.eq(this.node)&&dre(n,this.outerDeco)&&s.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(t,n){let s=this.node.inlineContent,a=n,o=t.composing?this.localCompositionInfo(t,n):null,l=o&&o.pos>-1?o:null,i=o&&o.pos<0,u=new qyt(this,l&&l.node,t);Wyt(this.node,this.innerDeco,(p,x,y)=>{p.spec.marks?u.syncToMarks(p.spec.marks,s,t):p.type.side>=0&&!y&&u.syncToMarks(x==this.node.childCount?Ho.none:this.node.child(x).marks,s,t),u.placeWidget(p,t,a)},(p,x,y,_)=>{u.syncToMarks(p.marks,s,t);let b;u.findNodeMatch(p,x,y,_)||i&&t.state.selection.from>a&&t.state.selection.to-1&&u.updateNodeAt(p,x,y,b,t)||u.updateNextNode(p,x,y,t,_,a)||u.addNode(p,x,y,t,a),a+=p.nodeSize}),u.syncToMarks([],s,t),this.node.isTextblock&&u.addTextblockHacks(),u.destroyRest(),(u.changed||this.dirty==ij)&&(l&&this.protectLocalComposition(t,l),tze(this.contentDOM,this.children,t),FC&&Gyt(this.dom))}localCompositionInfo(t,n){let{from:s,to:a}=t.state.selection;if(!(t.state.selection instanceof ya)||sn+this.node.content.size)return null;let o=t.input.compositionNode;if(!o||!this.dom.contains(o.parentNode))return null;if(this.node.inlineContent){let l=o.nodeValue,i=Kyt(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(t,{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 Byt(this,o,n,a);t.input.compositionNodes.push(l),this.children=$fe(this.children,s,s+a.length,t,l)}update(t,n,s,a){return this.dirty==Yg||!t.sameMarkup(this.node)?!1:(this.updateInner(t,n,s,a),!0)}updateInner(t,n,s,a){this.updateOuterDeco(n),this.node=t,this.innerDeco=s,this.contentDOM&&this.updateChildren(a,this.posAtStart),this.dirty=gp}updateOuterDeco(t){if(dre(t,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,s=this.dom;this.dom=rze(this.dom,this.nodeDOM,Bfe(this.outerDeco,this.node,n),Bfe(t,this.node,n)),this.dom!=s&&(s.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=t}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 k4e(e,t,n,s,a){nze(s,t,e);let o=new nv(void 0,e,t,n,s,s,s,a,0);return o.contentDOM&&o.updateChildren(a,0),o}class vae extends nv{constructor(t,n,s,a,o,l,i){super(t,n,s,a,o,null,l,i,0)}parseRule(){let t=this.nodeDOM.parentNode;for(;t&&t!=this.dom&&!t.pmIsDeco;)t=t.parentNode;return{skip:t||!0}}update(t,n,s,a){return this.dirty==Yg||this.dirty!=gp&&!this.inParent()||!t.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=gp||t.text!=this.node.text)&&t.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=t.text,a.trackWrites==this.nodeDOM&&(a.trackWrites=null)),this.node=t,this.dirty=gp,!0)}inParent(){let t=this.parent.contentDOM;for(let n=this.nodeDOM;n;n=n.parentNode)if(n==t)return!0;return!1}domFromPos(t){return{node:this.nodeDOM,offset:t}}localPosFromDOM(t,n,s){return t==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):super.localPosFromDOM(t,n,s)}ignoreMutation(t){return t.type!="characterData"&&t.type!="selection"}slice(t,n,s){let a=this.node.cut(t,n),o=document.createTextNode(a.text);return new vae(this.parent,a,this.outerDeco,this.innerDeco,o,o,s)}markDirty(t,n){super.markDirty(t,n),this.dom!=this.nodeDOM&&(t==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=Yg)}get domAtom(){return!1}isText(t){return this.node.text==t}}class eze extends uP{parseRule(){return{ignore:!0}}matchesHack(t){return this.dirty==gp&&this.dom.nodeName==t}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class $yt extends nv{constructor(t,n,s,a,o,l,i,u,p,x){super(t,n,s,a,o,l,i,p,x),this.spec=u}update(t,n,s,a){if(this.dirty==Yg)return!1;if(this.spec.update&&(this.node.type==t.type||this.spec.multiType)){let o=this.spec.update(t,n,s);return o&&this.updateInner(t,n,s,a),o}else return!this.contentDOM&&!t.isLeaf?!1:super.update(t,n,s,a)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(t,n,s,a){this.spec.setSelection?this.spec.setSelection(t,n,s.root):super.setSelection(t,n,s,a)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(t){return this.spec.stopEvent?this.spec.stopEvent(t):!1}ignoreMutation(t){return this.spec.ignoreMutation?this.spec.ignoreMutation(t):super.ignoreMutation(t)}}function tze(e,t,n){let s=e.firstChild,a=!1;for(let o=0;o>1,l=Math.min(o,t.length);for(;a-1)i>this.index&&(this.changed=!0,this.destroyBetween(this.index,i)),this.top=this.top.children[this.index];else{let u=fk.create(this.top,t[o],n,s);this.top.children.splice(this.index,0,u),this.top=u,this.changed=!0}this.index=0,o++}}findNodeMatch(t,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(t,n,s))o=this.top.children.indexOf(l,this.index);else for(let i=this.index,u=Math.min(this.top.children.length,i+5);i0;){let i;for(;;)if(s){let p=n.children[s-1];if(p instanceof fk)n=p,s=p.children.length;else{i=p,s--;break}}else{if(n==t)break e;s=n.parent.children.indexOf(n),n=n.parent}let u=i.node;if(u){if(u!=e.child(a-1))break;--a,o.set(i,a),l.push(i)}}return{index:a,matched:o,matches:l.reverse()}}function Hyt(e,t){return e.type.side-t.type.side}function Wyt(e,t,n,s){let a=t.locals(e),o=0;if(a.length==0){for(let p=0;po;)i.push(a[l++]);let S=o+_.nodeSize;if(_.isText){let M=S;l!M.inline):i.slice();s(_,k,t.forChild(o,_),b),o=S}}function Gyt(e){if(e.nodeName=="UL"||e.nodeName=="OL"){let t=e.style.cssText;e.style.cssText=t+"; list-style: square !important",window.getComputedStyle(e).listStyle,e.style.cssText=t}}function Kyt(e,t,n,s){for(let a=0,o=0;a=n){if(o>=s&&u.slice(s-t.length-i,s-i)==t)return s-t.length;let p=i=0&&p+t.length+i>=n)return i+p;if(n==s&&u.length>=s+t.length-i&&u.slice(s-i,s-i+t.length)==t)return s}}return-1}function $fe(e,t,n,s,a){let o=[];for(let l=0,i=0;l=n||x<=t?o.push(u):(pn&&o.push(u.slice(n-p,u.size,s)))}return o}function Vye(e,t=null){let n=e.domSelectionRange(),s=e.state.doc;if(!n.focusNode)return null;let a=e.docView.nearestDesc(n.focusNode),o=a&&a.size==0,l=e.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(l<0)return null;let i=s.resolve(l),u,p;if(yae(n)){for(u=l;a&&!a.node;)a=a.parent;let y=a.node;if(a&&y.isAtom&&ua.isSelectable(y)&&a.parent&&!(y.isInline&&byt(n.focusNode,n.focusOffset,a.dom))){let _=a.posBefore;p=new ua(l==_?i:s.resolve(_))}}else{if(n instanceof e.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let y=l,_=l;for(let b=0;b{(n.anchorNode!=s||n.anchorOffset!=a)&&(t.removeEventListener("selectionchange",e.input.hideSelectionGuard),setTimeout(()=>{(!sze(e)||e.state.selection.visible)&&e.dom.classList.remove("ProseMirror-hideselection")},20))})}function Yyt(e){let t=e.domSelection();if(!t)return;let n=e.cursorWrapper.dom,s=n.nodeName=="IMG";s?t.collapse(n.parentNode,ru(n)+1):t.collapse(n,0),!s&&!e.state.selection.visible&&Ih&&rv<=11&&(n.disabled=!0,n.disabled=!1)}function aze(e,t){if(t instanceof ua){let n=e.docView.descAt(t.from);n!=e.lastSelectedViewDesc&&(T4e(e),n&&n.selectNode(),e.lastSelectedViewDesc=n)}else T4e(e)}function T4e(e){e.lastSelectedViewDesc&&(e.lastSelectedViewDesc.parent&&e.lastSelectedViewDesc.deselectNode(),e.lastSelectedViewDesc=void 0)}function Hye(e,t,n,s){return e.someProp("createSelectionBetween",a=>a(e,t,n))||ya.between(t,n,s)}function A4e(e){return e.editable&&!e.hasFocus()?!1:ize(e)}function ize(e){let t=e.domSelectionRange();if(!t.anchorNode)return!1;try{return e.dom.contains(t.anchorNode.nodeType==3?t.anchorNode.parentNode:t.anchorNode)&&(e.editable||e.dom.contains(t.focusNode.nodeType==3?t.focusNode.parentNode:t.focusNode))}catch{return!1}}function Xyt(e){let t=e.docView.domFromPos(e.state.selection.anchor,0),n=e.domSelectionRange();return hk(t.node,t.offset,n.anchorNode,n.anchorOffset)}function Ufe(e,t){let{$anchor:n,$head:s}=e.selection,a=t>0?n.max(s):n.min(s),o=a.parent.inlineContent?a.depth?e.doc.resolve(t>0?a.after():a.before()):null:a;return o&&La.findFrom(o,t)}function X0(e,t){return e.dispatch(e.state.tr.setSelection(t).scrollIntoView()),!0}function E4e(e,t,n){let s=e.state.selection;if(s instanceof ya)if(n.indexOf("s")>-1){let{$head:a}=s,o=a.textOffset?null:t<0?a.nodeBefore:a.nodeAfter;if(!o||o.isText||!o.isLeaf)return!1;let l=e.state.doc.resolve(a.pos+o.nodeSize*(t<0?-1:1));return X0(e,new ya(s.$anchor,l))}else if(s.empty){if(e.endOfTextblock(t>0?"forward":"backward")){let a=Ufe(e.state,t);return a&&a instanceof ua?X0(e,a):!1}else if(!(Qf&&n.indexOf("m")>-1)){let a=s.$head,o=a.textOffset?null:t<0?a.nodeBefore:a.nodeAfter,l;if(!o||o.isText)return!1;let i=t<0?a.pos-o.nodeSize:a.pos;return o.isAtom||(l=e.docView.descAt(i))&&!l.contentDOM?ua.isSelectable(o)?X0(e,new ua(t<0?e.state.doc.resolve(a.pos-o.nodeSize):a)):dP?X0(e,new ya(e.state.doc.resolve(t<0?i:i+o.nodeSize))):!1:!1}}else return!1;else{if(s instanceof ua&&s.node.isInline)return X0(e,new ya(t>0?s.$to:s.$from));{let a=Ufe(e.state,t);return a?X0(e,a):!1}}}function ure(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function $A(e,t){let n=e.pmViewDesc;return n&&n.size==0&&(t<0||e.nextSibling||e.nodeName!="BR")}function T4(e,t){return t<0?Qyt(e):Jyt(e)}function Qyt(e){let t=e.domSelectionRange(),n=t.focusNode,s=t.focusOffset;if(!n)return;let a,o,l=!1;for(mp&&n.nodeType==1&&s0){if(n.nodeType!=1)break;{let i=n.childNodes[s-1];if($A(i,-1))a=n,o=--s;else if(i.nodeType==3)n=i,s=n.nodeValue.length;else break}}else{if(oze(n))break;{let i=n.previousSibling;for(;i&&$A(i,-1);)a=n.parentNode,o=ru(i),i=i.previousSibling;if(i)n=i,s=ure(n);else{if(n=n.parentNode,n==e.dom)break;s=0}}}l?qfe(e,n,s):a&&qfe(e,a,o)}function Jyt(e){let t=e.domSelectionRange(),n=t.focusNode,s=t.focusOffset;if(!n)return;let a=ure(n),o,l;for(;;)if(s{e.state==a&&yy(e)},50)}function I4e(e,t){let n=e.state.doc.resolve(t);if(!(Pd||WFe)&&n.parent.inlineContent){let a=e.coordsAtPos(t);if(t>n.start()){let o=e.coordsAtPos(t-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(e.dom).direction=="rtl"?"rtl":"ltr"}function P4e(e,t,n){let s=e.state.selection;if(s instanceof ya&&!s.empty||n.indexOf("s")>-1||Qf&&n.indexOf("m")>-1)return!1;let{$from:a,$to:o}=s;if(!a.parent.inlineContent||e.endOfTextblock(t<0?"up":"down")){let l=Ufe(e.state,t);if(l&&l instanceof ua)return X0(e,l)}if(!a.parent.inlineContent){let l=t<0?a:o,i=s instanceof bf?La.near(l,t):La.findFrom(l,t);return i?X0(e,i):!1}return!1}function L4e(e,t){if(!(e.state.selection instanceof ya))return!0;let{$head:n,$anchor:s,empty:a}=e.state.selection;if(!n.sameParent(s))return!0;if(!a)return!1;if(e.endOfTextblock(t>0?"forward":"backward"))return!0;let o=!n.textOffset&&(t<0?n.nodeBefore:n.nodeAfter);if(o&&!o.isText){let l=e.state.tr;return t<0?l.delete(n.pos-o.nodeSize,n.pos):l.delete(n.pos,n.pos+o.nodeSize),e.dispatch(l),!0}return!1}function O4e(e,t,n){e.domObserver.stop(),t.contentEditable=n,e.domObserver.start()}function r0t(e){if(!ju||e.state.selection.$head.parentOffset>0)return!1;let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(t&&t.nodeType==1&&n==0&&t.firstChild&&t.firstChild.contentEditable=="false"){let s=t.firstChild;O4e(e,s,"true"),setTimeout(()=>O4e(e,s,"false"),20)}return!1}function n0t(e){let t="";return e.ctrlKey&&(t+="c"),e.metaKey&&(t+="m"),e.altKey&&(t+="a"),e.shiftKey&&(t+="s"),t}function s0t(e,t){let n=t.keyCode,s=n0t(t);if(n==8||Qf&&n==72&&s=="c")return L4e(e,-1)||T4(e,-1);if(n==46&&!t.shiftKey||Qf&&n==68&&s=="c")return L4e(e,1)||T4(e,1);if(n==13||n==27)return!0;if(n==37||Qf&&n==66&&s=="c"){let a=n==37?I4e(e,e.state.selection.from)=="ltr"?-1:1:-1;return E4e(e,a,s)||T4(e,a)}else if(n==39||Qf&&n==70&&s=="c"){let a=n==39?I4e(e,e.state.selection.from)=="ltr"?1:-1:1;return E4e(e,a,s)||T4(e,a)}else{if(n==38||Qf&&n==80&&s=="c")return P4e(e,-1,s)||T4(e,-1);if(n==40||Qf&&n==78&&s=="c")return r0t(e)||P4e(e,1,s)||T4(e,1);if(s==(Qf?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function Wye(e,t){e.someProp("transformCopied",b=>{t=b(t,e)});let n=[],{content:s,openStart:a,openEnd:o}=t;for(;a>1&&o>1&&s.childCount==1&&s.firstChild.childCount==1;){a--,o--;let b=s.firstChild;n.push(b.type.name,b.attrs!=b.type.defaultAttrs?b.attrs:null),s=b.content}let l=e.someProp("clipboardSerializer")||Tk.fromSchema(e.state.schema),i=fze(),u=i.createElement("div");u.appendChild(l.serializeFragment(s,{document:i}));let p=u.firstChild,x,y=0;for(;p&&p.nodeType==1&&(x=hze[p.nodeName.toLowerCase()]);){for(let b=x.length-1;b>=0;b--){let S=i.createElement(x[b]);for(;u.firstChild;)S.appendChild(u.firstChild);u.appendChild(S),y++}p=u.firstChild}p&&p.nodeType==1&&p.setAttribute("data-pm-slice",`${a} ${o}${y?` -${y}`:""} ${JSON.stringify(n)}`);let _=e.someProp("clipboardTextSerializer",b=>b(t,e))||t.content.textBetween(0,t.content.size,` `);return{dom:u,text:_,slice:t}}function lze(e,t,n,s,a){let o=a.parent.type.spec.code,l,i;if(!n&&!t)return null;let u=!!t&&(s||o||!n);if(u){if(e.someProp("transformPastedText",_=>{t=_(t,o||s,e)}),o)return i=new Kn(dn.from(e.state.schema.text(t.replace(/\r\n?/g,` `))),0,0),e.someProp("transformPasted",_=>{i=_(i,e,!0)}),i;let y=e.someProp("clipboardTextParser",_=>_(t,a,s,e));if(y)i=y;else{let _=a.marks(),{schema:b}=e.state,S=Tk.fromSchema(b);l=document.createElement("div"),t.split(/(?:\r\n?|\n)+/).forEach(k=>{let M=l.appendChild(document.createElement("p"));k&&M.appendChild(S.serializeNode(b.text(k,_)))})}}else e.someProp("transformPastedHTML",y=>{n=y(n,e)}),l=l0t(n),dP&&c0t(l);let p=l&&l.querySelector("[data-pm-slice]"),x=p&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(p.getAttribute("data-pm-slice")||"");if(x&&x[3])for(let y=+x[3];y>0;y--){let _=l.firstChild;for(;_&&_.nodeType!=1;)_=_.nextSibling;if(!_)break;l=_}if(i||(i=(e.someProp("clipboardParser")||e.someProp("domParser")||FA.fromSchema(e.state.schema)).parseSlice(l,{preserveWhitespace:!!(u||x),context:a,ruleFromNode(_){return _.nodeName=="BR"&&!_.nextSibling&&_.parentNode&&!a0t.test(_.parentNode.nodeName)?{ignore:!0}:null}})),x)i=d0t(D4e(i,+x[1],+x[2]),x[4]);else if(i=Kn.maxOpen(i0t(i.content,a),!0),i.openStart||i.openEnd){let y=0,_=0;for(let b=i.content.firstChild;y{i=y(i,e,u)}),i}const a0t=/^(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 i0t(e,t){if(e.childCount<2)return e;for(let n=t.depth;n>=0;n--){let a=t.node(n).contentMatchAt(t.index(n)),o,l=[];if(e.forEach(i=>{if(!l)return;let u=a.findWrapping(i.type),p;if(!u)return l=null;if(p=l.length&&o.length&&dze(u,o,i,l[l.length-1],0))l[l.length-1]=p;else{l.length&&(l[l.length-1]=uze(l[l.length-1],o.length));let x=cze(i,u);l.push(x),a=a.matchType(x.type),o=u}}),l)return dn.from(l)}return e}function cze(e,t,n=0){for(let s=t.length-1;s>=n;s--)e=t[s].create(null,dn.from(e));return e}function dze(e,t,n,s,a){if(a1&&(o=0),a=n&&(i=t<0?l.contentMatchAt(0).fillBefore(i,o<=a).append(i):i.append(l.contentMatchAt(l.childCount).fillBefore(dn.empty,!0))),e.replaceChild(t<0?0:e.childCount-1,l.copy(i))}function D4e(e,t,n){return tn})),sde.createHTML(e)):e}function l0t(e){let t=/^(\s*]*>)*/.exec(e);t&&(e=e.slice(t[0].length));let n=fze().createElement("div"),s=/<([a-z][^>\s]+)/i.exec(e),a;if((a=s&&hze[s[1].toLowerCase()])&&(e=a.map(o=>"<"+o+">").join("")+e+a.map(o=>"").reverse().join("")),n.innerHTML=o0t(e),a)for(let o=0;o=0;i-=2){let u=n.nodes[s[i]];if(!u||u.hasRequiredAttrs())break;a=dn.from(u.create(s[i+1],a)),o++,l++}return new Kn(a,o,l)}const eh={},th={},u0t={touchstart:!0,touchmove:!0};class h0t{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 f0t(e){for(let t in eh){let n=eh[t];e.dom.addEventListener(t,e.input.eventHandlers[t]=s=>{m0t(e,s)&&!Gye(e,s)&&(e.editable||!(s.type in th))&&n(e,s)},u0t[t]?{passive:!0}:void 0)}ju&&e.dom.addEventListener("input",()=>null),Hfe(e)}function M1(e,t){e.input.lastSelectionOrigin=t,e.input.lastSelectionTime=Date.now()}function p0t(e){e.domObserver.stop();for(let t in e.input.eventHandlers)e.dom.removeEventListener(t,e.input.eventHandlers[t]);clearTimeout(e.input.composingTimeout),clearTimeout(e.input.lastIOSEnterFallbackTimeout)}function Hfe(e){e.someProp("handleDOMEvents",t=>{for(let n in t)e.input.eventHandlers[n]||e.dom.addEventListener(n,e.input.eventHandlers[n]=s=>Gye(e,s))})}function Gye(e,t){return e.someProp("handleDOMEvents",n=>{let s=n[t.type];return s?s(e,t)||t.defaultPrevented:!1})}function m0t(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let n=t.target;n!=e.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(t))return!1;return!0}function g0t(e,t){!Gye(e,t)&&eh[t.type]&&(e.editable||!(t.type in th))&&eh[t.type](e,t)}th.keydown=(e,t)=>{let n=t;if(e.input.shiftKey=n.keyCode==16||n.shiftKey,!mze(e,n)&&(e.input.lastKeyCode=n.keyCode,e.input.lastKeyCodeTime=Date.now(),!(ey&&Pd&&n.keyCode==13)))if(n.keyCode!=229&&e.domObserver.forceFlush(),FC&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let s=Date.now();e.input.lastIOSEnter=s,e.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{e.input.lastIOSEnter==s&&(e.someProp("handleKeyDown",a=>a(e,Xw(13,"Enter"))),e.input.lastIOSEnter=0)},200)}else e.someProp("handleKeyDown",s=>s(e,n))||s0t(e,n)?n.preventDefault():M1(e,"key")};th.keyup=(e,t)=>{t.keyCode==16&&(e.input.shiftKey=!1)};th.keypress=(e,t)=>{let n=t;if(mze(e,n)||!n.charCode||n.ctrlKey&&!n.altKey||Qf&&n.metaKey)return;if(e.someProp("handleKeyPress",a=>a(e,n))){n.preventDefault();return}let s=e.state.selection;if(!(s instanceof ya)||!s.$from.sameParent(s.$to)){let a=String.fromCharCode(n.charCode),o=()=>e.state.tr.insertText(a).scrollIntoView();!/[\r\n]/.test(a)&&!e.someProp("handleTextInput",l=>l(e,s.$from.pos,s.$to.pos,a,o))&&e.dispatch(o()),n.preventDefault()}};function _ae(e){return{left:e.clientX,top:e.clientY}}function x0t(e,t){let n=t.x-e.clientX,s=t.y-e.clientY;return n*n+s*s<100}function Kye(e,t,n,s,a){if(s==-1)return!1;let o=e.state.doc.resolve(s);for(let l=o.depth+1;l>0;l--)if(e.someProp(t,i=>l>o.depth?i(e,n,o.nodeAfter,o.before(l),a,!0):i(e,n,o.node(l),o.before(l),a,!1)))return!0;return!1}function QS(e,t,n){if(e.focused||e.focus(),e.state.selection.eq(t))return;let s=e.state.tr.setSelection(t);s.setMeta("pointer",!0),e.dispatch(s)}function y0t(e,t){if(t==-1)return!1;let n=e.state.doc.resolve(t),s=n.nodeAfter;return s&&s.isAtom&&ua.isSelectable(s)?(QS(e,new ua(n)),!0):!1}function v0t(e,t){if(t==-1)return!1;let n=e.state.selection,s,a;n instanceof ua&&(s=n.node);let o=e.state.doc.resolve(t);for(let l=o.depth+1;l>0;l--){let i=l>o.depth?o.nodeAfter:o.node(l);if(ua.isSelectable(i)){s&&n.$from.depth>0&&l>=n.$from.depth&&o.before(n.$from.depth+1)==n.$from.pos?a=o.before(n.$from.depth):a=o.before(l);break}}return a!=null?(QS(e,ua.create(e.state.doc,a)),!0):!1}function _0t(e,t,n,s,a){return Kye(e,"handleClickOn",t,n,s)||e.someProp("handleClick",o=>o(e,t,s))||(a?v0t(e,n):y0t(e,n))}function b0t(e,t,n,s){return Kye(e,"handleDoubleClickOn",t,n,s)||e.someProp("handleDoubleClick",a=>a(e,t,s))}function w0t(e,t,n,s){return Kye(e,"handleTripleClickOn",t,n,s)||e.someProp("handleTripleClick",a=>a(e,t,s))||j0t(e,n,s)}function j0t(e,t,n){if(n.button!=0)return!1;let s=e.state.doc;if(t==-1)return s.inlineContent?(QS(e,ya.create(s,0,s.content.size)),!0):!1;let a=s.resolve(t);for(let o=a.depth+1;o>0;o--){let l=o>a.depth?a.nodeAfter:a.node(o),i=a.before(o);if(l.inlineContent)QS(e,ya.create(s,i+1,i+1+l.content.size));else if(ua.isSelectable(l))QS(e,ua.create(s,i));else continue;return!0}}function Zye(e){return hre(e)}const pze=Qf?"metaKey":"ctrlKey";eh.mousedown=(e,t)=>{let n=t;e.input.shiftKey=n.shiftKey;let s=Zye(e),a=Date.now(),o="singleClick";a-e.input.lastClick.time<500&&x0t(n,e.input.lastClick)&&!n[pze]&&e.input.lastClick.button==n.button&&(e.input.lastClick.type=="singleClick"?o="doubleClick":e.input.lastClick.type=="doubleClick"&&(o="tripleClick")),e.input.lastClick={time:a,x:n.clientX,y:n.clientY,type:o,button:n.button};let l=e.posAtCoords(_ae(n));l&&(o=="singleClick"?(e.input.mouseDown&&e.input.mouseDown.done(),e.input.mouseDown=new k0t(e,l,n,!!s)):(o=="doubleClick"?b0t:w0t)(e,l.pos,l.inside,n)?n.preventDefault():M1(e,"pointer"))};class k0t{constructor(t,n,s,a){this.view=t,this.pos=n,this.event=s,this.flushed=a,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=t.state.doc,this.selectNode=!!s[pze],this.allowDefault=s.shiftKey;let o,l;if(n.inside>-1)o=t.state.doc.nodeAt(n.inside),l=n.inside;else{let x=t.state.doc.resolve(n.pos);o=x.parent,l=x.depth?x.before():0}const i=a?null:s.target,u=i?t.docView.nearestDesc(i,!0):null;this.target=u&&u.nodeDOM.nodeType==1?u.nodeDOM:null;let{selection:p}=t.state;(s.button==0&&o.type.spec.draggable&&o.type.spec.selectable!==!1||p instanceof ua&&p.from<=l&&p.to>l)&&(this.mightDrag={node:o,pos:l,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&mp&&!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()),t.root.addEventListener("mouseup",this.up=this.up.bind(this)),t.root.addEventListener("mousemove",this.move=this.move.bind(this)),M1(t,"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(()=>yy(this.view)),this.view.input.mouseDown=null}up(t){if(this.done(),!this.view.dom.contains(t.target))return;let n=this.pos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords(_ae(t))),this.updateAllowDefault(t),this.allowDefault||!n?M1(this.view,"pointer"):_0t(this.view,n.pos,n.inside,t,this.selectNode)?t.preventDefault():t.button==0&&(this.flushed||ju&&this.mightDrag&&!this.mightDrag.node.isAtom||Pd&&!this.view.state.selection.visible&&Math.min(Math.abs(n.pos-this.view.state.selection.from),Math.abs(n.pos-this.view.state.selection.to))<=2)?(QS(this.view,La.near(this.view.state.doc.resolve(n.pos))),t.preventDefault()):M1(this.view,"pointer")}move(t){this.updateAllowDefault(t),M1(this.view,"pointer"),t.buttons==0&&this.done()}updateAllowDefault(t){!this.allowDefault&&(Math.abs(this.event.x-t.clientX)>4||Math.abs(this.event.y-t.clientY)>4)&&(this.allowDefault=!0)}}eh.touchstart=e=>{e.input.lastTouch=Date.now(),Zye(e),M1(e,"pointer")};eh.touchmove=e=>{e.input.lastTouch=Date.now(),M1(e,"pointer")};eh.contextmenu=e=>Zye(e);function mze(e,t){return e.composing?!0:ju&&Math.abs(t.timeStamp-e.input.compositionEndedAt)<500?(e.input.compositionEndedAt=-2e8,!0):!1}const N0t=ey?5e3:-1;th.compositionstart=th.compositionupdate=e=>{if(!e.composing){e.domObserver.flush();let{state:t}=e,n=t.selection.$to;if(t.selection instanceof ya&&(t.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(s=>s.type.spec.inclusive===!1)||Pd&&WFe&&S0t(e)))e.markCursor=e.state.storedMarks||n.marks(),hre(e,!0),e.markCursor=null;else if(hre(e,!t.selection.empty),mp&&t.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let s=e.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=e.domSelection();i&&i.collapse(l,l.nodeValue.length);break}else a=l,o=-1}}e.input.composing=!0}gze(e,N0t)};function S0t(e){let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(!t||t.nodeType!=1||n>=t.childNodes.length)return!1;let s=t.childNodes[n];return s.nodeType==1&&s.contentEditable=="false"}th.compositionend=(e,t)=>{e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=t.timeStamp,e.input.compositionPendingChanges=e.domObserver.pendingRecords().length?e.input.compositionID:0,e.input.compositionNode=null,e.input.compositionPendingChanges&&Promise.resolve().then(()=>e.domObserver.flush()),e.input.compositionID++,gze(e,20))};function gze(e,t){clearTimeout(e.input.composingTimeout),t>-1&&(e.input.composingTimeout=setTimeout(()=>hre(e),t))}function xze(e){for(e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=M0t());e.input.compositionNodes.length>0;)e.input.compositionNodes.pop().markParentsDirty()}function C0t(e){let t=e.domSelectionRange();if(!t.focusNode)return null;let n=vyt(t.focusNode,t.focusOffset),s=_yt(t.focusNode,t.focusOffset);if(n&&s&&n!=s){let a=s.pmViewDesc,o=e.domObserver.lastChangedTextNode;if(n==o||s==o)return o;if(!a||!a.isText(s.nodeValue))return s;if(e.input.compositionNode==s){let l=n.pmViewDesc;if(!(!l||!l.isText(n.nodeValue)))return s}}return n||s}function M0t(){let e=document.createEvent("Event");return e.initEvent("event",!0,!0),e.timeStamp}function hre(e,t=!1){if(!(ey&&e.domObserver.flushingSoon>=0)){if(e.domObserver.forceFlush(),xze(e),t||e.docView&&e.docView.dirty){let n=Vye(e),s=e.state.selection;return n&&!n.eq(s)?e.dispatch(e.state.tr.setSelection(n)):(e.markCursor||t)&&!s.$from.node(s.$from.sharedDepth(s.to)).inlineContent?e.dispatch(e.state.tr.deleteSelection()):e.updateState(e.state),!0}return!1}}function T0t(e,t){if(!e.dom.parentNode)return;let n=e.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(t),n.style.cssText="position: fixed; left: -10000px; top: 10px";let s=getSelection(),a=document.createRange();a.selectNodeContents(t),e.dom.blur(),s.removeAllRanges(),s.addRange(a),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),e.focus()},50)}const BE=Ih&&rv<15||FC&&kyt<604;eh.copy=th.cut=(e,t)=>{let n=t,s=e.state.selection,a=n.type=="cut";if(s.empty)return;let o=BE?null:n.clipboardData,l=s.content(),{dom:i,text:u}=Wye(e,l);o?(n.preventDefault(),o.clearData(),o.setData("text/html",i.innerHTML),o.setData("text/plain",u)):T0t(e,i),a&&e.dispatch(e.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function A0t(e){return e.openStart==0&&e.openEnd==0&&e.content.childCount==1?e.content.firstChild:null}function E0t(e,t){if(!e.dom.parentNode)return;let n=e.input.shiftKey||e.state.selection.$from.parent.type.spec.code,s=e.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=e.input.shiftKey&&e.input.lastKeyCode!=45;setTimeout(()=>{e.focus(),s.parentNode&&s.parentNode.removeChild(s),n?$E(e,s.value,null,a,t):$E(e,s.textContent,s.innerHTML,a,t)},50)}function $E(e,t,n,s,a){let o=lze(e,t,n,s,e.state.selection.$from);if(e.someProp("handlePaste",u=>u(e,a,o||Kn.empty)))return!0;if(!o)return!1;let l=A0t(o),i=l?e.state.tr.replaceSelectionWith(l,s):e.state.tr.replaceSelection(o);return e.dispatch(i.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function yze(e){let t=e.getData("text/plain")||e.getData("Text");if(t)return t;let n=e.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}th.paste=(e,t)=>{let n=t;if(e.composing&&!ey)return;let s=BE?null:n.clipboardData,a=e.input.shiftKey&&e.input.lastKeyCode!=45;s&&$E(e,yze(s),s.getData("text/html"),a,n)?n.preventDefault():E0t(e,n)};class vze{constructor(t,n,s){this.slice=t,this.move=n,this.node=s}}const I0t=Qf?"altKey":"ctrlKey";function _ze(e,t){let n=e.someProp("dragCopies",s=>!s(t));return n??!t[I0t]}eh.dragstart=(e,t)=>{let n=t,s=e.input.mouseDown;if(s&&s.done(),!n.dataTransfer)return;let a=e.state.selection,o=a.empty?null:e.posAtCoords(_ae(n)),l;if(!(o&&o.pos>=a.from&&o.pos<=(a instanceof ua?a.to-1:a.to))){if(s&&s.mightDrag)l=ua.create(e.state.doc,s.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let y=e.docView.nearestDesc(n.target,!0);y&&y.node.type.spec.draggable&&y!=e.docView&&(l=ua.create(e.state.doc,y.posBefore))}}let i=(l||e.state.selection).content(),{dom:u,text:p,slice:x}=Wye(e,i);(!n.dataTransfer.files.length||!Pd||HFe>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(BE?"Text":"text/html",u.innerHTML),n.dataTransfer.effectAllowed="copyMove",BE||n.dataTransfer.setData("text/plain",p),e.dragging=new vze(x,_ze(e,n),l)};eh.dragend=e=>{let t=e.dragging;window.setTimeout(()=>{e.dragging==t&&(e.dragging=null)},50)};th.dragover=th.dragenter=(e,t)=>t.preventDefault();th.drop=(e,t)=>{try{P0t(e,t,e.dragging)}finally{e.dragging=null}};function P0t(e,t,n){if(!t.dataTransfer)return;let s=e.posAtCoords(_ae(t));if(!s)return;let a=e.state.doc.resolve(s.pos),o=n&&n.slice;o?e.someProp("transformPasted",b=>{o=b(o,e,!1)}):o=lze(e,yze(t.dataTransfer),BE?null:t.dataTransfer.getData("text/html"),!1,a);let l=!!(n&&_ze(e,t));if(e.someProp("handleDrop",b=>b(e,t,o||Kn.empty,l))){t.preventDefault();return}if(!o)return;t.preventDefault();let i=o?DFe(e.state.doc,a.pos,o):a.pos;i==null&&(i=a.pos);let u=e.state.tr;if(l){let{node:b}=n;b?b.replace(u):u.deleteSelection()}let p=u.mapping.map(i),x=o.openStart==0&&o.openEnd==0&&o.content.childCount==1,y=u.doc;if(x?u.replaceRangeWith(p,p,o.content.firstChild):u.replaceRange(p,p,o),u.doc.eq(y))return;let _=u.doc.resolve(p);if(x&&ua.isSelectable(o.content.firstChild)&&_.nodeAfter&&_.nodeAfter.sameMarkup(o.content.firstChild))u.setSelection(new ua(_));else{let b=u.mapping.map(i);u.mapping.maps[u.mapping.maps.length-1].forEach((S,k,M,P)=>b=P),u.setSelection(Hye(e,_,u.doc.resolve(b)))}e.focus(),e.dispatch(u.setMeta("uiEvent","drop"))}eh.focus=e=>{e.input.lastFocus=Date.now(),e.focused||(e.domObserver.stop(),e.dom.classList.add("ProseMirror-focused"),e.domObserver.start(),e.focused=!0,setTimeout(()=>{e.docView&&e.hasFocus()&&!e.domObserver.currentSelection.eq(e.domSelectionRange())&&yy(e)},20))};eh.blur=(e,t)=>{let n=t;e.focused&&(e.domObserver.stop(),e.dom.classList.remove("ProseMirror-focused"),e.domObserver.start(),n.relatedTarget&&e.dom.contains(n.relatedTarget)&&e.domObserver.currentSelection.clear(),e.focused=!1)};eh.beforeinput=(e,t)=>{if(Pd&&ey&&t.inputType=="deleteContentBackward"){e.domObserver.flushSoon();let{domChangeCount:s}=e.input;setTimeout(()=>{if(e.input.domChangeCount!=s||(e.dom.blur(),e.focus(),e.someProp("handleKeyDown",o=>o(e,Xw(8,"Backspace")))))return;let{$cursor:a}=e.state.selection;a&&a.pos>0&&e.dispatch(e.state.tr.delete(a.pos-1,a.pos).scrollIntoView())},50)}};for(let e in th)eh[e]=th[e];function UE(e,t){if(e==t)return!0;for(let n in e)if(e[n]!==t[n])return!1;for(let n in t)if(!(n in e))return!1;return!0}class fre{constructor(t,n){this.toDOM=t,this.spec=n||Hj,this.side=this.spec.side||0}map(t,n,s,a){let{pos:o,deleted:l}=t.mapResult(n.from+a,this.side<0?-1:1);return l?null:new Gu(o-s,o-s,this)}valid(){return!0}eq(t){return this==t||t instanceof fre&&(this.spec.key&&this.spec.key==t.spec.key||this.toDOM==t.toDOM&&UE(this.spec,t.spec))}destroy(t){this.spec.destroy&&this.spec.destroy(t)}}class sv{constructor(t,n){this.attrs=t,this.spec=n||Hj}map(t,n,s,a){let o=t.map(n.from+a,this.spec.inclusiveStart?-1:1)-s,l=t.map(n.to+a,this.spec.inclusiveEnd?1:-1)-s;return o>=l?null:new Gu(o,l,this)}valid(t,n){return n.from=t&&(!o||o(i.spec))&&s.push(i.copy(i.from+a,i.to+a))}for(let l=0;lt){let i=this.children[l]+1;this.children[l+2].findInner(t-i,n-i,s,a+i,o)}}map(t,n,s){return this==mu||t.maps.length==0?this:this.mapInner(t,n,0,0,s||Hj)}mapInner(t,n,s,a,o){let l;for(let i=0;i{let p=u+s,x;if(x=wze(n,i,p)){for(a||(a=this.children.slice());oi&&y.to=t){this.children[i]==t&&(s=this.children[i+2]);break}let o=t+1,l=o+n.content.size;for(let i=0;io&&u.type instanceof sv){let p=Math.max(o,u.from)-o,x=Math.min(l,u.to)-o;pa.map(t,n,Hj));return o1.from(s)}forChild(t,n){if(n.isLeaf)return ec.empty;let s=[];for(let a=0;an instanceof ec)?t:t.reduce((n,s)=>n.concat(s instanceof ec?s:s.members),[]))}}forEachSet(t){for(let n=0;n{let M=k-S-(b-_);for(let P=0;PT+x-y)continue;let I=i[P]+x-y;b>=I?i[P+1]=_<=I?-2:-1:_>=x&&M&&(i[P]+=M,i[P+1]+=M)}y+=M}),x=n.maps[p].map(x,-1)}let u=!1;for(let p=0;p=s.content.size){u=!0;continue}let _=n.map(e[p+1]+o,-1),b=_-a,{index:S,offset:k}=s.content.findIndex(y),M=s.maybeChild(S);if(M&&k==y&&k+M.nodeSize==b){let P=i[p+2].mapInner(n,M,x+1,e[p]+o+1,l);P!=mu?(i[p]=y,i[p+1]=b,i[p+2]=P):(i[p+1]=-2,u=!0)}else u=!0}if(u){let p=O0t(i,e,t,n,a,o,l),x=pre(p,s,0,l);t=x.local;for(let y=0;yn&&l.to{let p=wze(e,i,u+n);if(p){o=!0;let x=pre(p,i,n+u+1,s);x!=mu&&a.push(u,u+i.nodeSize,x)}});let l=bze(o?jze(e):e,-n).sort(Wj);for(let i=0;i0;)t++;e.splice(t,0,n)}function ade(e){let t=[];return e.someProp("decorations",n=>{let s=n(e.state);s&&s!=mu&&t.push(s)}),e.cursorWrapper&&t.push(ec.create(e.state.doc,[e.cursorWrapper.deco])),o1.from(t)}const D0t={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},R0t=Ih&&rv<=11;class F0t{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(t){this.anchorNode=t.anchorNode,this.anchorOffset=t.anchorOffset,this.focusNode=t.focusNode,this.focusOffset=t.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(t){return t.anchorNode==this.anchorNode&&t.anchorOffset==this.anchorOffset&&t.focusNode==this.focusNode&&t.focusOffset==this.focusOffset}}class z0t{constructor(t,n){this.view=t,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new F0t,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()}),R0t&&(this.onCharData=s=>{this.queue.push({target:s.target,type:"characterData",oldValue:s.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,D0t)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let t=this.observer.takeRecords();if(t.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(A4e(this.view)){if(this.suppressingSelectionUpdates)return yy(this.view);if(Ih&&rv<=11&&!this.view.state.selection.empty){let t=this.view.domSelectionRange();if(t.focusNode&&hk(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(t){if(!t.focusNode)return!0;let n=new Set,s;for(let o=t.focusNode;o;o=RC(o))n.add(o);for(let o=t.anchorNode;o;o=RC(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 t of this.observer.takeRecords())this.queue.push(t);return this.queue}flush(){let{view:t}=this;if(!t.docView||this.flushingSoon>-1)return;let n=this.pendingRecords();n.length&&(this.queue=[]);let s=t.domSelectionRange(),a=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(s)&&A4e(t)&&!this.ignoreSelectionChange(s),o=-1,l=-1,i=!1,u=[];if(t.editable)for(let x=0;xy.nodeName=="BR");if(x.length==2){let[y,_]=x;y.parentNode&&y.parentNode.parentNode==_.parentNode?_.remove():y.remove()}else{let{focusNode:y}=this.currentSelection;for(let _ of x){let b=_.parentNode;b&&b.nodeName=="LI"&&(!y||U0t(t,y)!=b)&&_.remove()}}}else if((Pd||ju)&&u.some(x=>x.nodeName=="BR")&&(t.input.lastKeyCode==8||t.input.lastKeyCode==46)){for(let x of u)if(x.nodeName=="BR"&&x.parentNode){let y=x.nextSibling;y&&y.nodeType==1&&y.contentEditable=="false"&&x.parentNode.removeChild(x)}}let p=null;o<0&&a&&t.input.lastFocus>Date.now()-200&&Math.max(t.input.lastTouch,t.input.lastClick.time)-1||a)&&(o>-1&&(t.docView.markDirty(o,l),B0t(t)),this.handleDOMChange(o,l,i,u),t.docView&&t.docView.dirty?t.updateState(t.state):this.currentSelection.eq(s)||yy(t),this.currentSelection.set(s))}registerMutation(t,n){if(n.indexOf(t.target)>-1)return null;let s=this.view.docView.nearestDesc(t.target);if(t.type=="attributes"&&(s==this.view.docView||t.attributeName=="contenteditable"||t.attributeName=="style"&&!t.oldValue&&!t.target.getAttribute("style"))||!s||s.ignoreMutation(t))return null;if(t.type=="childList"){for(let x=0;xa;M--){let P=s.childNodes[M-1],T=P.pmViewDesc;if(P.nodeName=="BR"&&!T){o=M;break}if(!T||T.size)break}let y=e.state.doc,_=e.someProp("domParser")||FA.fromSchema(e.state.schema),b=y.resolve(l),S=null,k=_.parse(s,{topNode:b.parent,topMatch:b.parent.contentMatchAt(b.index()),topOpen:!0,from:a,to:o,preserveWhitespace:b.parent.type.whitespace=="pre"?"full":!0,findPositions:p,ruleFromNode:V0t,context:b});if(p&&p[0].pos!=null){let M=p[0].pos,P=p[1]&&p[1].pos;P==null&&(P=M),S={anchor:M+l,head:P+l}}return{doc:k,sel:S,from:l,to:i}}function V0t(e){let t=e.pmViewDesc;if(t)return t.parseRule();if(e.nodeName=="BR"&&e.parentNode){if(ju&&/^(ul|ol)$/i.test(e.parentNode.nodeName)){let n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}else if(e.parentNode.lastChild==e||ju&&/^(tr|table)$/i.test(e.parentNode.nodeName))return{ignore:!0}}else if(e.nodeName=="IMG"&&e.getAttribute("mark-placeholder"))return{ignore:!0};return null}const H0t=/^(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 W0t(e,t,n,s,a){let o=e.input.compositionPendingChanges||(e.composing?e.input.compositionID:0);if(e.input.compositionPendingChanges=0,t<0){let V=e.input.lastSelectionTime>Date.now()-50?e.input.lastSelectionOrigin:null,W=Vye(e,V);if(W&&!e.state.selection.eq(W)){if(Pd&&ey&&e.input.lastKeyCode===13&&Date.now()-100J(e,Xw(13,"Enter"))))return;let G=e.state.tr.setSelection(W);V=="pointer"?G.setMeta("pointer",!0):V=="key"&&G.scrollIntoView(),o&&G.setMeta("composition",o),e.dispatch(G)}return}let l=e.state.doc.resolve(t),i=l.sharedDepth(n);t=l.before(i+1),n=e.state.doc.resolve(n).after(i+1);let u=e.state.selection,p=q0t(e,t,n),x=e.state.doc,y=x.slice(p.from,p.to),_,b;e.input.lastKeyCode===8&&Date.now()-100Date.now()-225||ey)&&a.some(V=>V.nodeType==1&&!H0t.test(V.nodeName))&&(!S||S.endA>=S.endB)&&e.someProp("handleKeyDown",V=>V(e,Xw(13,"Enter")))){e.input.lastIOSEnter=0;return}if(!S)if(s&&u instanceof ya&&!u.empty&&u.$head.sameParent(u.$anchor)&&!e.composing&&!(p.sel&&p.sel.anchor!=p.sel.head))S={start:u.from,endA:u.to,endB:u.to};else{if(p.sel){let V=U4e(e,e.state.doc,p.sel);if(V&&!V.eq(e.state.selection)){let W=e.state.tr.setSelection(V);o&&W.setMeta("composition",o),e.dispatch(W)}}return}e.state.selection.frome.state.selection.from&&S.start<=e.state.selection.from+2&&e.state.selection.from>=p.from?S.start=e.state.selection.from:S.endA=e.state.selection.to-2&&e.state.selection.to<=p.to&&(S.endB+=e.state.selection.to-S.endA,S.endA=e.state.selection.to)),Ih&&rv<=11&&S.endB==S.start+1&&S.endA==S.start&&S.start>p.from&&p.doc.textBetween(S.start-p.from-1,S.start-p.from+1)=="  "&&(S.start--,S.endA--,S.endB--);let k=p.doc.resolveNoCache(S.start-p.from),M=p.doc.resolveNoCache(S.endB-p.from),P=x.resolve(S.start),T=k.sameParent(M)&&k.parent.inlineContent&&P.end()>=S.endA;if((FC&&e.input.lastIOSEnter>Date.now()-225&&(!T||a.some(V=>V.nodeName=="DIV"||V.nodeName=="P"))||!T&&k.posV(e,Xw(13,"Enter")))){e.input.lastIOSEnter=0;return}if(e.state.selection.anchor>S.start&&K0t(x,S.start,S.endA,k,M)&&e.someProp("handleKeyDown",V=>V(e,Xw(8,"Backspace")))){ey&&Pd&&e.domObserver.suppressSelectionUpdates();return}Pd&&S.endB==S.start&&(e.input.lastChromeDelete=Date.now()),ey&&!T&&k.start()!=M.start()&&M.parentOffset==0&&k.depth==M.depth&&p.sel&&p.sel.anchor==p.sel.head&&p.sel.head==S.endA&&(S.endB-=2,M=p.doc.resolveNoCache(S.endB-p.from),setTimeout(()=>{e.someProp("handleKeyDown",function(V){return V(e,Xw(13,"Enter"))})},20));let I=S.start,z=S.endA,D=V=>{let W=V||e.state.tr.replace(I,z,p.doc.slice(S.start-p.from,S.endB-p.from));if(p.sel){let G=U4e(e,W.doc,p.sel);G&&!(Pd&&e.composing&&G.empty&&(S.start!=S.endB||e.input.lastChromeDeleteyy(e),20));let V=D(e.state.tr.delete(I,z)),W=x.resolve(S.start).marksAcross(x.resolve(S.endA));W&&V.ensureMarks(W),e.dispatch(V)}else if(S.endA==S.endB&&(U=G0t(k.parent.content.cut(k.parentOffset,M.parentOffset),P.parent.content.cut(P.parentOffset,S.endA-P.start())))){let V=D(e.state.tr);U.type=="add"?V.addMark(I,z,U.mark):V.removeMark(I,z,U.mark),e.dispatch(V)}else if(k.parent.child(k.index()).isText&&k.index()==M.index()-(M.textOffset?0:1)){let V=k.parent.textBetween(k.parentOffset,M.parentOffset),W=()=>D(e.state.tr.insertText(V,I,z));e.someProp("handleTextInput",G=>G(e,I,z,V,W))||e.dispatch(W())}else e.dispatch(D());else e.dispatch(D())}function U4e(e,t,n){return Math.max(n.anchor,n.head)>t.content.size?null:Hye(e,t.resolve(n.anchor),t.resolve(n.head))}function G0t(e,t){let n=e.firstChild.marks,s=t.firstChild.marks,a=n,o=s,l,i,u;for(let x=0;xx.mark(i.addToSet(x.marks));else if(a.length==0&&o.length==1)i=o[0],l="remove",u=x=>x.mark(i.removeFromSet(x.marks));else return null;let p=[];for(let x=0;xn||ide(l,!0,!1)0&&(t||e.indexAfter(s)==e.node(s).childCount);)s--,a++,t=!1;if(n){let o=e.node(s).maybeChild(e.indexAfter(s));for(;o&&!o.isLeaf;)o=o.firstChild,a++}return a}function Z0t(e,t,n,s,a){let o=e.findDiffStart(t,n);if(o==null)return null;let{a:l,b:i}=e.findDiffEnd(t,n+e.size,n+t.size);if(a=="end"){let u=Math.max(0,o-Math.min(l,i));s-=l+u-o}if(l=l?o-s:0;o-=u,o&&o=i?o-s:0;o-=u,o&&o=56320&&t<=57343&&n>=55296&&n<=56319}class kze{constructor(t,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 h0t,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(K4e),this.dispatch=this.dispatch.bind(this),this.dom=t&&t.mount||document.createElement("div"),t&&(t.appendChild?t.appendChild(this.dom):typeof t=="function"?t(this.dom):t.mount&&(this.mounted=!0)),this.editable=W4e(this),H4e(this),this.nodeViews=G4e(this),this.docView=k4e(this.state.doc,V4e(this),ade(this),this.dom,this),this.domObserver=new z0t(this,(s,a,o,l)=>W0t(this,s,a,o,l)),this.domObserver.start(),f0t(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let t=this._props;this._props={};for(let n in t)this._props[n]=t[n];this._props.state=this.state}return this._props}update(t){t.handleDOMEvents!=this._props.handleDOMEvents&&Hfe(this);let n=this._props;this._props=t,t.plugins&&(t.plugins.forEach(K4e),this.directPlugins=t.plugins),this.updateStateInner(t.state,n)}setProps(t){let n={};for(let s in this._props)n[s]=this._props[s];n.state=this.state;for(let s in t)n[s]=t[s];this.update(n)}updateState(t){this.updateStateInner(t,this._props)}updateStateInner(t,n){var s;let a=this.state,o=!1,l=!1;t.storedMarks&&this.composing&&(xze(this),l=!0),this.state=t;let i=a.plugins!=t.plugins||this._props.plugins!=n.plugins;if(i||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let b=G4e(this);X0t(b,this.nodeViews)&&(this.nodeViews=b,o=!0)}(i||n.handleDOMEvents!=this._props.handleDOMEvents)&&Hfe(this),this.editable=W4e(this),H4e(this);let u=ade(this),p=V4e(this),x=a.plugins!=t.plugins&&!a.doc.eq(t.doc)?"reset":t.scrollToSelection>a.scrollToSelection?"to selection":"preserve",y=o||!this.docView.matchesNode(t.doc,p,u);(y||!t.selection.eq(a.selection))&&(l=!0);let _=x=="preserve"&&l&&this.dom.style.overflowAnchor==null&&Cyt(this);if(l){this.domObserver.stop();let b=y&&(Ih||Pd)&&!this.composing&&!a.selection.empty&&!t.selection.empty&&Y0t(a.selection,t.selection);if(y){let S=Pd?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=C0t(this)),(o||!this.docView.update(t.doc,p,u,this))&&(this.docView.updateOuterDeco(p),this.docView.destroy(),this.docView=k4e(t.doc,p,u,this.dom,this)),S&&!this.trackWrites&&(b=!0)}b||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&Xyt(this))?yy(this,b):(aze(this,t.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(a),!((s=this.dragging)===null||s===void 0)&&s.node&&!a.doc.eq(t.doc)&&this.updateDraggedNode(this.dragging,a),x=="reset"?this.dom.scrollTop=0:x=="to selection"?this.scrollToSelection():_&&Myt(_)}scrollToSelection(){let t=this.domSelectionRange().focusNode;if(!(!t||!this.dom.contains(t.nodeType==1?t:t.parentNode))){if(!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof ua){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&y4e(this,n.getBoundingClientRect(),t)}else y4e(this,this.coordsAtPos(this.state.selection.head,1),t)}}destroyPluginViews(){let t;for(;t=this.pluginViews.pop();)t.destroy&&t.destroy()}updatePluginViews(t){if(!t||t.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 vze(t.slice,t.move,a<0?void 0:ua.create(this.state.doc,a))}someProp(t,n){let s=this._props&&this._props[t],a;if(s!=null&&(a=n?n(s):s))return a;for(let l=0;ln.ownerDocument.getSelection()),this._root=n}return t||document}updateRoot(){this._root=null}posAtCoords(t){return Lyt(this,t)}coordsAtPos(t,n=1){return XFe(this,t,n)}domAtPos(t,n=0){return this.docView.domFromPos(t,n)}nodeDOM(t){let n=this.docView.descAt(t);return n?n.nodeDOM:null}posAtDOM(t,n,s=-1){let a=this.docView.posFromDOM(t,n,s);if(a==null)throw new RangeError("DOM position not inside the editor");return a}endOfTextblock(t,n){return zyt(this,n||this.state,t)}pasteHTML(t,n){return $E(this,"",t,!1,n||new ClipboardEvent("paste"))}pasteText(t,n){return $E(this,t,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(t){return Wye(this,t)}destroy(){this.docView&&(p0t(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],ade(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,xyt())}get isDestroyed(){return this.docView==null}dispatchEvent(t){return g0t(this,t)}domSelectionRange(){let t=this.domSelection();return t?ju&&this.root.nodeType===11&&wyt(this.dom.ownerDocument)==this.dom&&$0t(this,t)||t:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}kze.prototype.dispatch=function(e){let t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))};function V4e(e){let t=Object.create(null);return t.class="ProseMirror",t.contenteditable=String(e.editable),e.someProp("attributes",n=>{if(typeof n=="function"&&(n=n(e.state)),n)for(let s in n)s=="class"?t.class+=" "+n[s]:s=="style"?t.style=(t.style?t.style+";":"")+n[s]:!t[s]&&s!="contenteditable"&&s!="nodeName"&&(t[s]=String(n[s]))}),t.translate||(t.translate="no"),[Gu.node(0,e.state.doc.content.size,t)]}function H4e(e){if(e.markCursor){let t=document.createElement("img");t.className="ProseMirror-separator",t.setAttribute("mark-placeholder","true"),t.setAttribute("alt",""),e.cursorWrapper={dom:t,deco:Gu.widget(e.state.selection.from,t,{raw:!0,marks:e.markCursor})}}else e.cursorWrapper=null}function W4e(e){return!e.someProp("editable",t=>t(e.state)===!1)}function Y0t(e,t){let n=Math.min(e.$anchor.sharedDepth(e.head),t.$anchor.sharedDepth(t.head));return e.$anchor.start(n)!=t.$anchor.start(n)}function G4e(e){let t=Object.create(null);function n(s){for(let a in s)Object.prototype.hasOwnProperty.call(t,a)||(t[a]=s[a])}return e.someProp("nodeViews",n),e.someProp("markViews",n),t}function X0t(e,t){let n=0,s=0;for(let a in e){if(e[a]!=t[a])return!0;n++}for(let a in t)s++;return n!=s}function K4e(e){if(e.spec.state||e.spec.filterTransaction||e.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var gv={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:"'"},mre={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Q0t=typeof navigator<"u"&&/Mac/.test(navigator.platform),J0t=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var nu=0;nu<10;nu++)gv[48+nu]=gv[96+nu]=String(nu);for(var nu=1;nu<=24;nu++)gv[nu+111]="F"+nu;for(var nu=65;nu<=90;nu++)gv[nu]=String.fromCharCode(nu+32),mre[nu]=String.fromCharCode(nu);for(var ode in gv)mre.hasOwnProperty(ode)||(mre[ode]=gv[ode]);function e1t(e){var t=Q0t&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||J0t&&e.shiftKey&&e.key&&e.key.length==1||e.key=="Unidentified",n=!t&&e.key||(e.shiftKey?mre:gv)[e.keyCode]||e.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 t1t=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),r1t=typeof navigator<"u"&&/Win/.test(navigator.platform);function n1t(e){let t=e.split(/-(?!$)/),n=t[t.length-1];n=="Space"&&(n=" ");let s,a,o,l;for(let i=0;ie.selection.empty?!1:(t&&t(e.tr.deleteSelection().scrollIntoView()),!0);function Nze(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock("backward",e):n.parentOffset>0)?null:n}const Sze=(e,t,n)=>{let s=Nze(e,n);if(!s)return!1;let a=e0e(s);if(!a){let l=s.blockRange(),i=l&&I3(l);return i==null?!1:(t&&t(e.tr.lift(l,i).scrollIntoView()),!0)}let o=a.nodeBefore;if(Oze(e,a,t,-1))return!0;if(s.parent.content.size==0&&(zC(o,"end")||ua.isSelectable(o)))for(let l=s.depth;;l--){let i=gae(e.doc,s.before(l),s.after(l),Kn.empty);if(i&&i.slice.size1)break}return o.isAtom&&a.depth==s.depth-1?(t&&t(e.tr.delete(a.pos-o.nodeSize,a.pos).scrollIntoView()),!0):!1},i1t=(e,t,n)=>{let s=Nze(e,n);if(!s)return!1;let a=e0e(s);return a?Cze(e,a,t):!1},o1t=(e,t,n)=>{let s=Tze(e,n);if(!s)return!1;let a=t0e(s);return a?Cze(e,a,t):!1};function Cze(e,t,n){let s=t.nodeBefore,a=s,o=t.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=t.nodeAfter,i=l,u=t.pos+1;for(;!i.isTextblock;u++){if(i.type.spec.isolating)return!1;let x=i.firstChild;if(!x)return!1;i=x}let p=gae(e.doc,o,u,Kn.empty);if(!p||p.from!=o||p instanceof Ad&&p.slice.size>=u-o)return!1;if(n){let x=e.tr.step(p);x.setSelection(ya.create(x.doc,o)),n(x.scrollIntoView())}return!0}function zC(e,t,n=!1){for(let s=e;s;s=t=="start"?s.firstChild:s.lastChild){if(s.isTextblock)return!0;if(n&&s.childCount!=1)return!1}return!1}const Mze=(e,t,n)=>{let{$head:s,empty:a}=e.selection,o=s;if(!a)return!1;if(s.parent.isTextblock){if(n?!n.endOfTextblock("backward",e):s.parentOffset>0)return!1;o=e0e(s)}let l=o&&o.nodeBefore;return!l||!ua.isSelectable(l)?!1:(t&&t(e.tr.setSelection(ua.create(e.doc,o.pos-l.nodeSize)).scrollIntoView()),!0)};function e0e(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){if(e.index(t)>0)return e.doc.resolve(e.before(t+1));if(e.node(t).type.spec.isolating)break}return null}function Tze(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock("forward",e):n.parentOffset{let s=Tze(e,n);if(!s)return!1;let a=t0e(s);if(!a)return!1;let o=a.nodeAfter;if(Oze(e,a,t,1))return!0;if(s.parent.content.size==0&&(zC(o,"start")||ua.isSelectable(o))){let l=gae(e.doc,s.before(),s.after(),Kn.empty);if(l&&l.slice.size{let{$head:s,empty:a}=e.selection,o=s;if(!a)return!1;if(s.parent.isTextblock){if(n?!n.endOfTextblock("forward",e):s.parentOffset=0;t--){let n=e.node(t);if(e.index(t)+1{let n=e.selection,s=n instanceof ua,a;if(s){if(n.node.isTextblock||!Cv(e.doc,n.from))return!1;a=n.from}else if(a=mae(e.doc,n.from,-1),a==null)return!1;if(t){let o=e.tr.join(a);s&&o.setSelection(ua.create(o.doc,a-e.doc.resolve(a).nodeBefore.nodeSize)),t(o.scrollIntoView())}return!0},c1t=(e,t)=>{let n=e.selection,s;if(n instanceof ua){if(n.node.isTextblock||!Cv(e.doc,n.to))return!1;s=n.to}else if(s=mae(e.doc,n.to,1),s==null)return!1;return t&&t(e.tr.join(s).scrollIntoView()),!0},d1t=(e,t)=>{let{$from:n,$to:s}=e.selection,a=n.blockRange(s),o=a&&I3(a);return o==null?!1:(t&&t(e.tr.lift(a,o).scrollIntoView()),!0)},Ize=(e,t)=>{let{$head:n,$anchor:s}=e.selection;return!n.parent.type.spec.code||!n.sameParent(s)?!1:(t&&t(e.tr.insertText(` `).scrollIntoView()),!0)};function r0e(e){for(let t=0;t{let{$head:n,$anchor:s}=e.selection;if(!n.parent.type.spec.code||!n.sameParent(s))return!1;let a=n.node(-1),o=n.indexAfter(-1),l=r0e(a.contentMatchAt(o));if(!l||!a.canReplaceWith(o,o,l))return!1;if(t){let i=n.after(),u=e.tr.replaceWith(i,i,l.createAndFill());u.setSelection(La.near(u.doc.resolve(i),1)),t(u.scrollIntoView())}return!0},Pze=(e,t)=>{let n=e.selection,{$from:s,$to:a}=n;if(n instanceof bf||s.parent.inlineContent||a.parent.inlineContent)return!1;let o=r0e(a.parent.contentMatchAt(a.indexAfter()));if(!o||!o.isTextblock)return!1;if(t){let l=(!s.parentOffset&&a.index(){let{$cursor:n}=e.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let o=n.before();if(xy(e.doc,o))return t&&t(e.tr.split(o).scrollIntoView()),!0}let s=n.blockRange(),a=s&&I3(s);return a==null?!1:(t&&t(e.tr.lift(s,a).scrollIntoView()),!0)};function h1t(e){return(t,n)=>{let{$from:s,$to:a}=t.selection;if(t.selection instanceof ua&&t.selection.node.isBlock)return!s.parentOffset||!xy(t.doc,s.pos)?!1:(n&&n(t.tr.split(s.pos).scrollIntoView()),!0);if(!s.depth)return!1;let o=[],l,i,u=!1,p=!1;for(let b=s.depth;;b--)if(s.node(b).isBlock){u=s.end(b)==s.pos+(s.depth-b),p=s.start(b)==s.pos-(s.depth-b),i=r0e(s.node(b-1).contentMatchAt(s.indexAfter(b-1))),o.unshift(u&&i?{type:i}:null),l=b;break}else{if(b==1)return!1;o.unshift(null)}let x=t.tr;(t.selection instanceof ya||t.selection instanceof bf)&&x.deleteSelection();let y=x.mapping.map(s.pos),_=xy(x.doc,y,o.length,o);if(_||(o[0]=i?{type:i}:null,_=xy(x.doc,y,o.length,o)),!_)return!1;if(x.split(y,o.length,o),!u&&p&&s.node(l).type!=i){let b=x.mapping.map(s.before(l)),S=x.doc.resolve(b);i&&s.node(l-1).canReplaceWith(S.index(),S.index()+1,i)&&x.setNodeMarkup(x.mapping.map(s.before(l)),i)}return n&&n(x.scrollIntoView()),!0}}const f1t=h1t(),p1t=(e,t)=>{let{$from:n,to:s}=e.selection,a,o=n.sharedDepth(s);return o==0?!1:(a=n.before(o),t&&t(e.tr.setSelection(ua.create(e.doc,a))),!0)};function m1t(e,t,n){let s=t.nodeBefore,a=t.nodeAfter,o=t.index();return!s||!a||!s.type.compatibleContent(a.type)?!1:!s.content.size&&t.parent.canReplace(o-1,o)?(n&&n(e.tr.delete(t.pos-s.nodeSize,t.pos).scrollIntoView()),!0):!t.parent.canReplace(o,o+1)||!(a.isTextblock||Cv(e.doc,t.pos))?!1:(n&&n(e.tr.join(t.pos).scrollIntoView()),!0)}function Oze(e,t,n,s){let a=t.nodeBefore,o=t.nodeAfter,l,i,u=a.type.spec.isolating||o.type.spec.isolating;if(!u&&m1t(e,t,n))return!0;let p=!u&&t.parent.canReplace(t.index(),t.index()+1);if(p&&(l=(i=a.contentMatchAt(a.childCount)).findWrapping(o.type))&&i.matchType(l[0]||o.type).validEnd){if(n){let b=t.pos+o.nodeSize,S=dn.empty;for(let P=l.length-1;P>=0;P--)S=dn.from(l[P].create(null,S));S=dn.from(a.copy(S));let k=e.tr.step(new Bd(t.pos-1,b,t.pos,b,new Kn(S,1,0),l.length,!0)),M=k.doc.resolve(b+2*l.length);M.nodeAfter&&M.nodeAfter.type==a.type&&Cv(k.doc,M.pos)&&k.join(M.pos),n(k.scrollIntoView())}return!0}let x=o.type.spec.isolating||s>0&&u?null:La.findFrom(t,1),y=x&&x.$from.blockRange(x.$to),_=y&&I3(y);if(_!=null&&_>=t.depth)return n&&n(e.tr.lift(y,_).scrollIntoView()),!0;if(p&&zC(o,"start",!0)&&zC(a,"end")){let b=a,S=[];for(;S.push(b),!b.isTextblock;)b=b.lastChild;let k=o,M=1;for(;!k.isTextblock;k=k.firstChild)M++;if(b.canReplace(b.childCount,b.childCount,k.content)){if(n){let P=dn.empty;for(let I=S.length-1;I>=0;I--)P=dn.from(S[I].copy(P));let T=e.tr.step(new Bd(t.pos-S.length,t.pos+o.nodeSize,t.pos+M,t.pos+o.nodeSize-M,new Kn(P,S.length,0),0,!0));n(T.scrollIntoView())}return!0}}return!1}function Dze(e){return function(t,n){let s=t.selection,a=e<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(t.tr.setSelection(ya.create(t.doc,e<0?a.start(o):a.end(o)))),!0):!1}}const g1t=Dze(-1),x1t=Dze(1);function y1t(e,t=null){return function(n,s){let{$from:a,$to:o}=n.selection,l=a.blockRange(o),i=l&&Bye(l,e,t);return i?(s&&s(n.tr.wrap(l,i).scrollIntoView()),!0):!1}}function Z4e(e,t=null){return function(n,s){let a=!1;for(let o=0;o{if(a)return!1;if(!(!u.isTextblock||u.hasMarkup(e,t)))if(u.type==e)a=!0;else{let x=n.doc.resolve(p),y=x.index();a=x.parent.canReplaceWith(y,y+1,e)}})}if(!a)return!1;if(s){let o=n.tr;for(let l=0;l=2&&t.$from.node(t.depth-1).type.compatibleContent(n)&&t.startIndex==0){if(t.$from.index(t.depth-1)==0)return!1;let u=l.resolve(t.start-2);o=new lre(u,u,t.depth),t.endIndex=0;x--)o=dn.from(n[x].type.create(n[x].attrs,o));e.step(new Bd(t.start-(s?2:0),t.end,t.start,t.end,new Kn(o,0,0),n.length,!0));let l=0;for(let x=0;xl.childCount>0&&l.firstChild.type==e);return o?n?s.node(o.depth-1).type==e?j1t(t,n,e,o):k1t(t,n,o):!0:!1}}function j1t(e,t,n,s){let a=e.tr,o=s.end,l=s.$to.end(s.depth);ok;S--)b-=a.child(S).nodeSize,s.delete(b-1,b+1);let o=s.doc.resolve(n.start),l=o.nodeAfter;if(s.mapping.map(n.end)!=n.start+o.nodeAfter.nodeSize)return!1;let i=n.startIndex==0,u=n.endIndex==a.childCount,p=o.node(-1),x=o.index(-1);if(!p.canReplace(x+(i?0:1),x+1,l.content.append(u?dn.empty:dn.from(a))))return!1;let y=o.pos,_=y+l.nodeSize;return s.step(new Bd(y-(i?1:0),_+(u?1:0),y+1,_-1,new Kn((i?dn.empty:dn.from(a.copy(dn.empty))).append(u?dn.empty:dn.from(a.copy(dn.empty))),i?0:1,u?0:1),i?0:1)),t(s.scrollIntoView()),!0}function N1t(e){return function(t,n){let{$from:s,$to:a}=t.selection,o=s.blockRange(a,p=>p.childCount>0&&p.firstChild.type==e);if(!o)return!1;let l=o.startIndex;if(l==0)return!1;let i=o.parent,u=i.child(l-1);if(u.type!=e)return!1;if(n){let p=u.lastChild&&u.lastChild.type==i.type,x=dn.from(p?e.create():null),y=new Kn(dn.from(e.create(null,dn.from(i.type.create(null,x)))),p?3:1,0),_=o.start,b=o.end;n(t.tr.step(new Bd(_-(p?3:1),b,_,b,y,1,!0)).scrollIntoView())}return!0}}function bae(e){const{state:t,transaction:n}=e;let{selection:s}=n,{doc:a}=n,{storedMarks:o}=n;return{...t,apply:t.apply.bind(t),applyTransaction:t.applyTransaction.bind(t),plugins:t.plugins,schema:t.schema,reconfigure:t.reconfigure.bind(t),toJSON:t.toJSON.bind(t),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 wae{constructor(t){this.editor=t.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=t.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:t,editor:n,state:s}=this,{view:a}=n,{tr:o}=s,l=this.buildProps(o);return Object.fromEntries(Object.entries(t).map(([i,u])=>[i,(...x)=>{const y=u(...x)(l);return!o.getMeta("preventDispatch")&&!this.hasCustomState&&a.dispatch(o),y}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(t,n=!0){const{rawCommands:s,editor:a,state:o}=this,{view:l}=a,i=[],u=!!t,p=t||o.tr,x=()=>(!u&&n&&!p.getMeta("preventDispatch")&&!this.hasCustomState&&l.dispatch(p),i.every(_=>_===!0)),y={...Object.fromEntries(Object.entries(s).map(([_,b])=>[_,(...k)=>{const M=this.buildProps(p,n),P=b(...k)(M);return i.push(P),y}])),run:x};return y}createCan(t){const{rawCommands:n,state:s}=this,a=!1,o=t||s.tr,l=this.buildProps(o,a);return{...Object.fromEntries(Object.entries(n).map(([u,p])=>[u,(...x)=>p(...x)({...l,dispatch:void 0})])),chain:()=>this.createChain(o,a)}}buildProps(t,n=!0){const{rawCommands:s,editor:a,state:o}=this,{view:l}=a,i={tr:t,editor:a,view:l,state:bae({state:o,transaction:t}),dispatch:n?()=>{}:void 0,chain:()=>this.createChain(t,n),can:()=>this.createCan(t),get commands(){return Object.fromEntries(Object.entries(s).map(([u,p])=>[u,(...x)=>p(...x)(i)]))}};return i}}let S1t=class{constructor(){this.callbacks={}}on(t,n){return this.callbacks[t]||(this.callbacks[t]=[]),this.callbacks[t].push(n),this}emit(t,...n){const s=this.callbacks[t];return s&&s.forEach(a=>a.apply(this,n)),this}off(t,n){const s=this.callbacks[t];return s&&(n?this.callbacks[t]=s.filter(a=>a!==n):delete this.callbacks[t]),this}once(t,n){const s=(...a)=>{this.off(t,s),n.apply(this,a)};return this.on(t,s)}removeAllListeners(){this.callbacks={}}};function Cs(e,t,n){return e.config[t]===void 0&&e.parent?Cs(e.parent,t,n):typeof e.config[t]=="function"?e.config[t].bind({...n,parent:e.parent?Cs(e.parent,t,n):null}):e.config[t]}function jae(e){const t=e.filter(a=>a.type==="extension"),n=e.filter(a=>a.type==="node"),s=e.filter(a=>a.type==="mark");return{baseExtensions:t,nodeExtensions:n,markExtensions:s}}function Rze(e){const t=[],{nodeExtensions:n,markExtensions:s}=jae(e),a=[...n,...s],o={default:null,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return e.forEach(l=>{const i={name:l.name,options:l.options,storage:l.storage,extensions:a},u=Cs(l,"addGlobalAttributes",i);if(!u)return;u().forEach(x=>{x.types.forEach(y=>{Object.entries(x.attributes).forEach(([_,b])=>{t.push({type:y,name:_,attribute:{...o,...b}})})})})}),a.forEach(l=>{const i={name:l.name,options:l.options,storage:l.storage},u=Cs(l,"addAttributes",i);if(!u)return;const p=u();Object.entries(p).forEach(([x,y])=>{const _={...o,...y};typeof(_==null?void 0:_.default)=="function"&&(_.default=_.default()),_!=null&&_.isRequired&&(_==null?void 0:_.default)===void 0&&delete _.default,t.push({type:l.name,name:x,attribute:_})})}),t}function Ud(e,t){if(typeof e=="string"){if(!t.nodes[e])throw Error(`There is no node type named '${e}'. Maybe you forgot to add the extension?`);return t.nodes[e]}return e}function Wl(...e){return e.filter(t=>!!t).reduce((t,n)=>{const s={...t};return Object.entries(n).forEach(([a,o])=>{if(!s[a]){s[a]=o;return}if(a==="class"){const i=o?String(o).split(" "):[],u=s[a]?s[a].split(" "):[],p=i.filter(x=>!u.includes(x));s[a]=[...u,...p].join(" ")}else if(a==="style"){const i=o?o.split(";").map(x=>x.trim()).filter(Boolean):[],u=s[a]?s[a].split(";").map(x=>x.trim()).filter(Boolean):[],p=new Map;u.forEach(x=>{const[y,_]=x.split(":").map(b=>b.trim());p.set(y,_)}),i.forEach(x=>{const[y,_]=x.split(":").map(b=>b.trim());p.set(y,_)}),s[a]=Array.from(p.entries()).map(([x,y])=>`${x}: ${y}`).join("; ")}else s[a]=o}),s},{})}function Wfe(e,t){return t.filter(n=>n.type===e.type.name).filter(n=>n.attribute.rendered).map(n=>n.attribute.renderHTML?n.attribute.renderHTML(e.attrs)||{}:{[n.name]:e.attrs[n.name]}).reduce((n,s)=>Wl(n,s),{})}function Fze(e){return typeof e=="function"}function gi(e,t=void 0,...n){return Fze(e)?t?e.bind(t)(...n):e(...n):e}function C1t(e={}){return Object.keys(e).length===0&&e.constructor===Object}function M1t(e){return typeof e!="string"?e:e.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(e):e==="true"?!0:e==="false"?!1:e}function Y4e(e,t){return"style"in e?e:{...e,getAttrs:n=>{const s=e.getAttrs?e.getAttrs(n):e.attrs;if(s===!1)return!1;const a=t.reduce((o,l)=>{const i=l.attribute.parseHTML?l.attribute.parseHTML(n):M1t(n.getAttribute(l.name));return i==null?o:{...o,[l.name]:i}},{});return{...s,...a}}}}function X4e(e){return Object.fromEntries(Object.entries(e).filter(([t,n])=>t==="attrs"&&C1t(n)?!1:n!=null))}function T1t(e,t){var n;const s=Rze(e),{nodeExtensions:a,markExtensions:o}=jae(e),l=(n=a.find(p=>Cs(p,"topNode")))===null||n===void 0?void 0:n.name,i=Object.fromEntries(a.map(p=>{const x=s.filter(P=>P.type===p.name),y={name:p.name,options:p.options,storage:p.storage,editor:t},_=e.reduce((P,T)=>{const I=Cs(T,"extendNodeSchema",y);return{...P,...I?I(p):{}}},{}),b=X4e({..._,content:gi(Cs(p,"content",y)),marks:gi(Cs(p,"marks",y)),group:gi(Cs(p,"group",y)),inline:gi(Cs(p,"inline",y)),atom:gi(Cs(p,"atom",y)),selectable:gi(Cs(p,"selectable",y)),draggable:gi(Cs(p,"draggable",y)),code:gi(Cs(p,"code",y)),whitespace:gi(Cs(p,"whitespace",y)),linebreakReplacement:gi(Cs(p,"linebreakReplacement",y)),defining:gi(Cs(p,"defining",y)),isolating:gi(Cs(p,"isolating",y)),attrs:Object.fromEntries(x.map(P=>{var T;return[P.name,{default:(T=P==null?void 0:P.attribute)===null||T===void 0?void 0:T.default}]}))}),S=gi(Cs(p,"parseHTML",y));S&&(b.parseDOM=S.map(P=>Y4e(P,x)));const k=Cs(p,"renderHTML",y);k&&(b.toDOM=P=>k({node:P,HTMLAttributes:Wfe(P,x)}));const M=Cs(p,"renderText",y);return M&&(b.toText=M),[p.name,b]})),u=Object.fromEntries(o.map(p=>{const x=s.filter(M=>M.type===p.name),y={name:p.name,options:p.options,storage:p.storage,editor:t},_=e.reduce((M,P)=>{const T=Cs(P,"extendMarkSchema",y);return{...M,...T?T(p):{}}},{}),b=X4e({..._,inclusive:gi(Cs(p,"inclusive",y)),excludes:gi(Cs(p,"excludes",y)),group:gi(Cs(p,"group",y)),spanning:gi(Cs(p,"spanning",y)),code:gi(Cs(p,"code",y)),attrs:Object.fromEntries(x.map(M=>{var P;return[M.name,{default:(P=M==null?void 0:M.attribute)===null||P===void 0?void 0:P.default}]}))}),S=gi(Cs(p,"parseHTML",y));S&&(b.parseDOM=S.map(M=>Y4e(M,x)));const k=Cs(p,"renderHTML",y);return k&&(b.toDOM=M=>k({mark:M,HTMLAttributes:Wfe(M,x)})),[p.name,b]}));return new NFe({topNode:l,nodes:i,marks:u})}function cde(e,t){return t.nodes[e]||t.marks[e]||null}function Q4e(e,t){return Array.isArray(t)?t.some(n=>(typeof n=="string"?n:n.name)===e.name):t}function s0e(e,t){const n=Tk.fromSchema(t).serializeFragment(e),a=document.implementation.createHTMLDocument().createElement("div");return a.appendChild(n),a.innerHTML}const A1t=(e,t=500)=>{let n="";const s=e.parentOffset;return e.parent.nodesBetween(Math.max(0,s-t),s,(a,o,l,i)=>{var u,p;const x=((p=(u=a.type.spec).toText)===null||p===void 0?void 0:p.call(u,{node:a,pos:o,parent:l,index:i}))||a.textContent||"%leaf%";n+=a.isAtom&&!a.isText?x:x.slice(0,Math.max(0,s-o))}),n};function a0e(e){return Object.prototype.toString.call(e)==="[object RegExp]"}class kae{constructor(t){this.find=t.find,this.handler=t.handler}}const E1t=(e,t)=>{if(a0e(t))return t.exec(e);const n=t(e);if(!n)return null;const s=[n.text];return s.index=n.index,s.input=e,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 lO(e){var t;const{editor:n,from:s,to:a,text:o,rules:l,plugin:i}=e,{view:u}=n;if(u.composing)return!1;const p=u.state.doc.resolve(s);if(p.parent.type.spec.code||!((t=p.nodeBefore||p.nodeAfter)===null||t===void 0)&&t.marks.find(_=>_.type.spec.code))return!1;let x=!1;const y=A1t(p)+o;return l.forEach(_=>{if(x)return;const b=E1t(y,_.find);if(!b)return;const S=u.state.tr,k=bae({state:u.state,transaction:S}),M={from:s-(b[0].length-o.length),to:a},{commands:P,chain:T,can:I}=new wae({editor:n,state:k});_.handler({state:k,range:M,match:b,commands:P,chain:T,can:I})===null||!S.steps.length||(S.setMeta(i,{transform:S,from:s,to:a,text:o}),u.dispatch(S),x=!0)}),x}function I1t(e){const{editor:t,rules:n}=e,s=new gd({state:{init(){return null},apply(a,o,l){const i=a.getMeta(s);if(i)return i;const u=a.getMeta("applyInputRules");return!!u&&setTimeout(()=>{let{text:x}=u;typeof x=="string"?x=x:x=s0e(dn.from(x),l.schema);const{from:y}=u,_=y+x.length;lO({editor:t,from:y,to:_,text:x,rules:n,plugin:s})}),a.selectionSet||a.docChanged?null:o}},props:{handleTextInput(a,o,l,i){return lO({editor:t,from:o,to:l,text:i,rules:n,plugin:s})},handleDOMEvents:{compositionend:a=>(setTimeout(()=>{const{$cursor:o}=a.state.selection;o&&lO({editor:t,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?lO({editor:t,from:l.pos,to:l.pos,text:` `,rules:n,plugin:s}):!1}},isInputRules:!0});return s}function P1t(e){return Object.prototype.toString.call(e).slice(8,-1)}function cO(e){return P1t(e)!=="Object"?!1:e.constructor===Object&&Object.getPrototypeOf(e)===Object.prototype}function Nae(e,t){const n={...e};return cO(e)&&cO(t)&&Object.keys(t).forEach(s=>{cO(t[s])&&cO(e[s])?n[s]=Nae(e[s],t[s]):n[s]=t[s]}),n}class Xg{constructor(t={}){this.type="mark",this.name="mark",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...t},this.name=this.config.name,t.defaultOptions&&Object.keys(t.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=gi(Cs(this,"addOptions",{name:this.name}))),this.storage=gi(Cs(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(t={}){return new Xg(t)}configure(t={}){const n=this.extend({...this.config,addOptions:()=>Nae(this.options,t)});return n.name=this.name,n.parent=this.parent,n}extend(t={}){const n=new Xg(t);return n.parent=this,this.child=n,n.name=t.name?t.name:n.parent.name,t.defaultOptions&&Object.keys(t.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`),n.options=gi(Cs(n,"addOptions",{name:n.name})),n.storage=gi(Cs(n,"addStorage",{name:n.name,options:n.options})),n}static handleExit({editor:t,mark:n}){const{tr:s}=t.state,a=t.state.selection.$from;if(a.pos===a.end()){const l=a.marks();if(!!!l.find(p=>(p==null?void 0:p.type.name)===n.name))return!1;const u=l.find(p=>(p==null?void 0:p.type.name)===n.name);return u&&s.removeStoredMark(u),s.insertText(" ",a.pos),t.view.dispatch(s),!0}return!1}}function L1t(e){return typeof e=="number"}class O1t{constructor(t){this.find=t.find,this.handler=t.handler}}const D1t=(e,t,n)=>{if(a0e(t))return[...e.matchAll(t)];const s=t(e,n);return s?s.map(a=>{const o=[a.text];return o.index=a.index,o.input=e,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 R1t(e){const{editor:t,state:n,from:s,to:a,rule:o,pasteEvent:l,dropEvent:i}=e,{commands:u,chain:p,can:x}=new wae({editor:t,state:n}),y=[];return n.doc.nodesBetween(s,a,(b,S)=>{if(!b.isTextblock||b.type.spec.code)return;const k=Math.max(s,S),M=Math.min(a,S+b.content.size),P=b.textBetween(k-S,M-S,void 0,"");D1t(P,o.find,l).forEach(I=>{if(I.index===void 0)return;const z=k+I.index+1,D=z+I[0].length,U={from:n.tr.mapping.map(z),to:n.tr.mapping.map(D)},V=o.handler({state:n,range:U,match:I,commands:u,chain:p,can:x,pasteEvent:l,dropEvent:i});y.push(V)})}),y.every(b=>b!==null)}let dO=null;const F1t=e=>{var t;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(t=n.clipboardData)===null||t===void 0||t.setData("text/html",e),n};function z1t(e){const{editor:t,rules:n}=e;let s=null,a=!1,o=!1,l=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,i;try{i=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{i=null}const u=({state:x,from:y,to:_,rule:b,pasteEvt:S})=>{const k=x.tr,M=bae({state:x,transaction:k});if(!(!R1t({editor:t,state:M,from:Math.max(y-1,0),to:_.b-1,rule:b,pasteEvent:S,dropEvent:i})||!k.steps.length)){try{i=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{i=null}return l=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,k}};return n.map(x=>new gd({view(y){const _=S=>{var k;s=!((k=y.dom.parentElement)===null||k===void 0)&&k.contains(S.target)?y.dom.parentElement:null,s&&(dO=t)},b=()=>{dO&&(dO=null)};return window.addEventListener("dragstart",_),window.addEventListener("dragend",b),{destroy(){window.removeEventListener("dragstart",_),window.removeEventListener("dragend",b)}}},props:{handleDOMEvents:{drop:(y,_)=>{if(o=s===y.dom.parentElement,i=_,!o){const b=dO;b!=null&&b.isEditable&&setTimeout(()=>{const S=b.state.selection;S&&b.commands.deleteRange({from:S.from,to:S.to})},10)}return!1},paste:(y,_)=>{var b;const S=(b=_.clipboardData)===null||b===void 0?void 0:b.getData("text/html");return l=_,a=!!(S!=null&&S.includes("data-pm-slice")),!1}}},appendTransaction:(y,_,b)=>{const S=y[0],k=S.getMeta("uiEvent")==="paste"&&!a,M=S.getMeta("uiEvent")==="drop"&&!o,P=S.getMeta("applyPasteRules"),T=!!P;if(!k&&!M&&!T)return;if(T){let{text:D}=P;typeof D=="string"?D=D:D=s0e(dn.from(D),b.schema);const{from:U}=P,V=U+D.length,W=F1t(D);return u({rule:x,state:b,from:U,to:{b:V},pasteEvt:W})}const I=_.doc.content.findDiffStart(b.doc.content),z=_.doc.content.findDiffEnd(b.doc.content);if(!(!L1t(I)||!z||I===z.b))return u({rule:x,state:b,from:I,to:z,pasteEvt:l})}}))}function B1t(e){const t=e.filter((n,s)=>e.indexOf(n)!==s);return Array.from(new Set(t))}class nS{constructor(t,n){this.splittableMarks=[],this.editor=n,this.extensions=nS.resolve(t),this.schema=T1t(this.extensions,n),this.setupExtensions()}static resolve(t){const n=nS.sort(nS.flatten(t)),s=B1t(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(t){return t.map(n=>{const s={name:n.name,options:n.options,storage:n.storage},a=Cs(n,"addExtensions",s);return a?[n,...this.flatten(a())]:n}).flat(10)}static sort(t){return t.sort((s,a)=>{const o=Cs(s,"priority")||100,l=Cs(a,"priority")||100;return o>l?-1:o{const s={name:n.name,options:n.options,storage:n.storage,editor:this.editor,type:cde(n.name,this.schema)},a=Cs(n,"addCommands",s);return a?{...t,...a()}:t},{})}get plugins(){const{editor:t}=this,n=nS.sort([...this.extensions].reverse()),s=[],a=[],o=n.map(l=>{const i={name:l.name,options:l.options,storage:l.storage,editor:t,type:cde(l.name,this.schema)},u=[],p=Cs(l,"addKeyboardShortcuts",i);let x={};if(l.type==="mark"&&Cs(l,"exitable",i)&&(x.ArrowRight=()=>Xg.handleExit({editor:t,mark:l})),p){const k=Object.fromEntries(Object.entries(p()).map(([M,P])=>[M,()=>P({editor:t})]));x={...x,...k}}const y=a1t(x);u.push(y);const _=Cs(l,"addInputRules",i);Q4e(l,t.options.enableInputRules)&&_&&s.push(..._());const b=Cs(l,"addPasteRules",i);Q4e(l,t.options.enablePasteRules)&&b&&a.push(...b());const S=Cs(l,"addProseMirrorPlugins",i);if(S){const k=S();u.push(...k)}return u}).flat();return[I1t({editor:t,rules:s}),...z1t({editor:t,rules:a}),...o]}get attributes(){return Rze(this.extensions)}get nodeViews(){const{editor:t}=this,{nodeExtensions:n}=jae(this.extensions);return Object.fromEntries(n.filter(s=>!!Cs(s,"addNodeView")).map(s=>{const a=this.attributes.filter(u=>u.type===s.name),o={name:s.name,options:s.options,storage:s.storage,editor:t,type:Ud(s.name,this.schema)},l=Cs(s,"addNodeView",o);if(!l)return[];const i=(u,p,x,y,_)=>{const b=Wfe(u,a);return l()({node:u,view:p,getPos:x,decorations:y,innerDecorations:_,editor:t,extension:s,HTMLAttributes:b})};return[s.name,i]}))}setupExtensions(){this.extensions.forEach(t=>{var n;this.editor.extensionStorage[t.name]=t.storage;const s={name:t.name,options:t.options,storage:t.storage,editor:this.editor,type:cde(t.name,this.schema)};t.type==="mark"&&(!((n=gi(Cs(t,"keepOnSplit",s)))!==null&&n!==void 0)||n)&&this.splittableMarks.push(t.name);const a=Cs(t,"onBeforeCreate",s),o=Cs(t,"onCreate",s),l=Cs(t,"onUpdate",s),i=Cs(t,"onSelectionUpdate",s),u=Cs(t,"onTransaction",s),p=Cs(t,"onFocus",s),x=Cs(t,"onBlur",s),y=Cs(t,"onDestroy",s);a&&this.editor.on("beforeCreate",a),o&&this.editor.on("create",o),l&&this.editor.on("update",l),i&&this.editor.on("selectionUpdate",i),u&&this.editor.on("transaction",u),p&&this.editor.on("focus",p),x&&this.editor.on("blur",x),y&&this.editor.on("destroy",y)})}}class ou{constructor(t={}){this.type="extension",this.name="extension",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...t},this.name=this.config.name,t.defaultOptions&&Object.keys(t.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=gi(Cs(this,"addOptions",{name:this.name}))),this.storage=gi(Cs(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(t={}){return new ou(t)}configure(t={}){const n=this.extend({...this.config,addOptions:()=>Nae(this.options,t)});return n.name=this.name,n.parent=this.parent,n}extend(t={}){const n=new ou({...this.config,...t});return n.parent=this,this.child=n,n.name=t.name?t.name:n.parent.name,t.defaultOptions&&Object.keys(t.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`),n.options=gi(Cs(n,"addOptions",{name:n.name})),n.storage=gi(Cs(n,"addStorage",{name:n.name,options:n.options})),n}}function zze(e,t,n){const{from:s,to:a}=t,{blockSeparator:o=` `,textSerializers:l={}}=n||{};let i="";return e.nodesBetween(s,a,(u,p,x,y)=>{var _;u.isBlock&&p>s&&(i+=o);const b=l==null?void 0:l[u.type.name];if(b)return x&&(i+=b({node:u,pos:p,parent:x,index:y,range:t})),!1;u.isText&&(i+=(_=u==null?void 0:u.text)===null||_===void 0?void 0:_.slice(Math.max(s,p)-p,a-p))}),i}function Bze(e){return Object.fromEntries(Object.entries(e.nodes).filter(([,t])=>t.spec.toText).map(([t,n])=>[t,n.spec.toText]))}const $1t=ou.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new gd({key:new Su("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:e}=this,{state:t,schema:n}=e,{doc:s,selection:a}=t,{ranges:o}=a,l=Math.min(...o.map(x=>x.$from.pos)),i=Math.max(...o.map(x=>x.$to.pos)),u=Bze(n);return zze(s,{from:l,to:i},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:u})}}})]}}),U1t=()=>({editor:e,view:t})=>(requestAnimationFrame(()=>{var n;e.isDestroyed||(t.dom.blur(),(n=window==null?void 0:window.getSelection())===null||n===void 0||n.removeAllRanges())}),!0),q1t=(e=!1)=>({commands:t})=>t.setContent("",e),V1t=()=>({state:e,tr:t,dispatch:n})=>{const{selection:s}=t,{ranges:a}=s;return n&&a.forEach(({$from:o,$to:l})=>{e.doc.nodesBetween(o.pos,l.pos,(i,u)=>{if(i.type.isText)return;const{doc:p,mapping:x}=t,y=p.resolve(x.map(u)),_=p.resolve(x.map(u+i.nodeSize)),b=y.blockRange(_);if(!b)return;const S=I3(b);if(i.type.isTextblock){const{defaultType:k}=y.parent.contentMatchAt(y.index());t.setNodeMarkup(b.start,k)}(S||S===0)&&t.lift(b,S)})}),!0},H1t=e=>t=>e(t),W1t=()=>({state:e,dispatch:t})=>Pze(e,t),G1t=(e,t)=>({editor:n,tr:s})=>{const{state:a}=n,o=a.doc.slice(e.from,e.to);s.deleteRange(e.from,e.to);const l=s.mapping.map(t);return s.insert(l,o.content),s.setSelection(new ya(s.doc.resolve(Math.max(l-1,0)))),!0},K1t=()=>({tr:e,dispatch:t})=>{const{selection:n}=e,s=n.$anchor.node();if(s.content.size>0)return!1;const a=e.selection.$anchor;for(let o=a.depth;o>0;o-=1)if(a.node(o).type===s.type){if(t){const i=a.before(o),u=a.after(o);e.delete(i,u).scrollIntoView()}return!0}return!1},Z1t=e=>({tr:t,state:n,dispatch:s})=>{const a=Ud(e,n.schema),o=t.selection.$anchor;for(let l=o.depth;l>0;l-=1)if(o.node(l).type===a){if(s){const u=o.before(l),p=o.after(l);t.delete(u,p).scrollIntoView()}return!0}return!1},Y1t=e=>({tr:t,dispatch:n})=>{const{from:s,to:a}=e;return n&&t.delete(s,a),!0},X1t=()=>({state:e,dispatch:t})=>Jye(e,t),Q1t=()=>({commands:e})=>e.keyboardShortcut("Enter"),J1t=()=>({state:e,dispatch:t})=>u1t(e,t);function gre(e,t,n={strict:!0}){const s=Object.keys(t);return s.length?s.every(a=>n.strict?t[a]===e[a]:a0e(t[a])?t[a].test(e[a]):t[a]===e[a]):!0}function $ze(e,t,n={}){return e.find(s=>s.type===t&&gre(Object.fromEntries(Object.keys(n).map(a=>[a,s.attrs[a]])),n))}function J4e(e,t,n={}){return!!$ze(e,t,n)}function i0e(e,t,n){var s;if(!e||!t)return;let a=e.parent.childAfter(e.parentOffset);if((!a.node||!a.node.marks.some(x=>x.type===t))&&(a=e.parent.childBefore(e.parentOffset)),!a.node||!a.node.marks.some(x=>x.type===t)||(n=n||((s=a.node.marks[0])===null||s===void 0?void 0:s.attrs),!$ze([...a.node.marks],t,n)))return;let l=a.index,i=e.start()+a.offset,u=l+1,p=i+a.node.nodeSize;for(;l>0&&J4e([...e.parent.child(l-1).marks],t,n);)l-=1,i-=e.parent.child(l).nodeSize;for(;u({tr:n,state:s,dispatch:a})=>{const o=Tv(e,s.schema),{doc:l,selection:i}=n,{$from:u,from:p,to:x}=i;if(a){const y=i0e(u,o,t);if(y&&y.from<=p&&y.to>=x){const _=ya.create(l,y.from,y.to);n.setSelection(_)}}return!0},tvt=e=>t=>{const n=typeof e=="function"?e(t):e;for(let s=0;s({editor:n,view:s,tr:a,dispatch:o})=>{t={scrollIntoView:!0,...t};const l=()=>{(o0e()||rvt())&&s.dom.focus(),requestAnimationFrame(()=>{n.isDestroyed||(s.focus(),t!=null&&t.scrollIntoView&&n.commands.scrollIntoView())})};if(s.hasFocus()&&e===null||e===!1)return!0;if(o&&e===null&&!Uze(n.state.selection))return l(),!0;const i=qze(a.doc,e)||n.state.selection,u=n.state.selection.eq(i);return o&&(u||a.setSelection(i),u&&a.storedMarks&&a.setStoredMarks(a.storedMarks),l()),!0},svt=(e,t)=>n=>e.every((s,a)=>t(s,{...n,index:a})),avt=(e,t)=>({tr:n,commands:s})=>s.insertContentAt({from:n.selection.from,to:n.selection.to},e,t),Vze=e=>{const t=e.childNodes;for(let n=t.length-1;n>=0;n-=1){const s=t[n];s.nodeType===3&&s.nodeValue&&/^(\n\s\s|\n)$/.test(s.nodeValue)?e.removeChild(s):s.nodeType===1&&Vze(s)}return e};function uO(e){const t=`${e}`,n=new window.DOMParser().parseFromString(t,"text/html").body;return Vze(n)}function qE(e,t,n){if(e instanceof tv||e instanceof dn)return e;n={slice:!0,parseOptions:{},...n};const s=typeof e=="object"&&e!==null,a=typeof e=="string";if(s)try{if(Array.isArray(e)&&e.length>0)return dn.fromArray(e.map(i=>t.nodeFromJSON(i)));const l=t.nodeFromJSON(e);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:",e,"Error:",o),qE("",t,n)}if(a){if(n.errorOnInvalidContent){let l=!1,i="";const u=new NFe({topNode:t.spec.topNode,marks:t.spec.marks,nodes:t.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?FA.fromSchema(u).parseSlice(uO(e),n.parseOptions):FA.fromSchema(u).parse(uO(e),n.parseOptions),n.errorOnInvalidContent&&l)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${i}`)})}const o=FA.fromSchema(t);return n.slice?o.parseSlice(uO(e),n.parseOptions).content:o.parse(uO(e),n.parseOptions)}return qE("",t,n)}function ivt(e,t,n){const s=e.steps.length-1;if(s{l===0&&(l=x)}),e.setSelection(La.near(e.doc.resolve(l),n))}const ovt=e=>!("type"in e),lvt=(e,t,n)=>({tr:s,dispatch:a,editor:o})=>{var l;if(a){n={parseOptions:o.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let i;const u=M=>{o.emit("contentError",{editor:o,error:M,disableCollaboration:()=>{o.storage.collaboration&&(o.storage.collaboration.isDisabled=!0)}})},p={preserveWhitespace:"full",...n.parseOptions};if(!n.errorOnInvalidContent&&!o.options.enableContentCheck&&o.options.emitContentError)try{qE(t,o.schema,{parseOptions:p,errorOnInvalidContent:!0})}catch(M){u(M)}try{i=qE(t,o.schema,{parseOptions:p,errorOnInvalidContent:(l=n.errorOnInvalidContent)!==null&&l!==void 0?l:o.options.enableContentCheck})}catch(M){return u(M),!1}let{from:x,to:y}=typeof e=="number"?{from:e,to:e}:{from:e.from,to:e.to},_=!0,b=!0;if((ovt(i)?i:[i]).forEach(M=>{M.check(),_=_?M.isText&&M.marks.length===0:!1,b=b?M.isBlock:!1}),x===y&&b){const{parent:M}=s.doc.resolve(x);M.isTextblock&&!M.type.spec.code&&!M.childCount&&(x-=1,y+=1)}let k;if(_){if(Array.isArray(t))k=t.map(M=>M.text||"").join("");else if(t instanceof dn){let M="";t.forEach(P=>{P.text&&(M+=P.text)}),k=M}else typeof t=="object"&&t&&t.text?k=t.text:k=t;s.insertText(k,x,y)}else k=i,s.replaceWith(x,y,k);n.updateSelection&&ivt(s,s.steps.length-1,-1),n.applyInputRules&&s.setMeta("applyInputRules",{from:x,text:k}),n.applyPasteRules&&s.setMeta("applyPasteRules",{from:x,text:k})}return!0},cvt=()=>({state:e,dispatch:t})=>l1t(e,t),dvt=()=>({state:e,dispatch:t})=>c1t(e,t),uvt=()=>({state:e,dispatch:t})=>Sze(e,t),hvt=()=>({state:e,dispatch:t})=>Aze(e,t),fvt=()=>({state:e,dispatch:t,tr:n})=>{try{const s=mae(e.doc,e.selection.$from.pos,-1);return s==null?!1:(n.join(s,2),t&&t(n),!0)}catch{return!1}},pvt=()=>({state:e,dispatch:t,tr:n})=>{try{const s=mae(e.doc,e.selection.$from.pos,1);return s==null?!1:(n.join(s,2),t&&t(n),!0)}catch{return!1}},mvt=()=>({state:e,dispatch:t})=>i1t(e,t),gvt=()=>({state:e,dispatch:t})=>o1t(e,t);function Hze(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function xvt(e){const t=e.split(/-(?!$)/);let n=t[t.length-1];n==="Space"&&(n=" ");let s,a,o,l;for(let i=0;i({editor:t,view:n,tr:s,dispatch:a})=>{const o=xvt(e).split(/-(?!$)/),l=o.find(p=>!["Alt","Ctrl","Meta","Shift"].includes(p)),i=new KeyboardEvent("keydown",{key:l==="Space"?" ":l,altKey:o.includes("Alt"),ctrlKey:o.includes("Ctrl"),metaKey:o.includes("Meta"),shiftKey:o.includes("Shift"),bubbles:!0,cancelable:!0}),u=t.captureTransaction(()=>{n.someProp("handleKeyDown",p=>p(n,i))});return u==null||u.steps.forEach(p=>{const x=p.map(s.mapping);x&&a&&s.maybeStep(x)}),!0};function VE(e,t,n={}){const{from:s,to:a,empty:o}=e.selection,l=t?Ud(t,e.schema):null,i=[];e.doc.nodesBetween(s,a,(y,_)=>{if(y.isText)return;const b=Math.max(s,_),S=Math.min(a,_+y.nodeSize);i.push({node:y,from:b,to:S})});const u=a-s,p=i.filter(y=>l?l.name===y.node.type.name:!0).filter(y=>gre(y.node.attrs,n,{strict:!1}));return o?!!p.length:p.reduce((y,_)=>y+_.to-_.from,0)>=u}const vvt=(e,t={})=>({state:n,dispatch:s})=>{const a=Ud(e,n.schema);return VE(n,a,t)?d1t(n,s):!1},_vt=()=>({state:e,dispatch:t})=>Lze(e,t),bvt=e=>({state:t,dispatch:n})=>{const s=Ud(e,t.schema);return w1t(s)(t,n)},wvt=()=>({state:e,dispatch:t})=>Ize(e,t);function Sae(e,t){return t.nodes[e]?"node":t.marks[e]?"mark":null}function eSe(e,t){const n=typeof t=="string"?[t]:t;return Object.keys(e).reduce((s,a)=>(n.includes(a)||(s[a]=e[a]),s),{})}const jvt=(e,t)=>({tr:n,state:s,dispatch:a})=>{let o=null,l=null;const i=Sae(typeof e=="string"?e:e.name,s.schema);return i?(i==="node"&&(o=Ud(e,s.schema)),i==="mark"&&(l=Tv(e,s.schema)),a&&n.selection.ranges.forEach(u=>{s.doc.nodesBetween(u.$from.pos,u.$to.pos,(p,x)=>{o&&o===p.type&&n.setNodeMarkup(x,void 0,eSe(p.attrs,t)),l&&p.marks.length&&p.marks.forEach(y=>{l===y.type&&n.addMark(x,x+p.nodeSize,l.create(eSe(y.attrs,t)))})})}),!0):!1},kvt=()=>({tr:e,dispatch:t})=>(t&&e.scrollIntoView(),!0),Nvt=()=>({tr:e,dispatch:t})=>{if(t){const n=new bf(e.doc);e.setSelection(n)}return!0},Svt=()=>({state:e,dispatch:t})=>Mze(e,t),Cvt=()=>({state:e,dispatch:t})=>Eze(e,t),Mvt=()=>({state:e,dispatch:t})=>p1t(e,t),Tvt=()=>({state:e,dispatch:t})=>x1t(e,t),Avt=()=>({state:e,dispatch:t})=>g1t(e,t);function Gfe(e,t,n={},s={}){return qE(e,t,{slice:!1,parseOptions:n,errorOnInvalidContent:s.errorOnInvalidContent})}const Evt=(e,t=!1,n={},s={})=>({editor:a,tr:o,dispatch:l,commands:i})=>{var u,p;const{doc:x}=o;if(n.preserveWhitespace!=="full"){const y=Gfe(e,a.schema,n,{errorOnInvalidContent:(u=s.errorOnInvalidContent)!==null&&u!==void 0?u:a.options.enableContentCheck});return l&&o.replaceWith(0,x.content.size,y).setMeta("preventUpdate",!t),!0}return l&&o.setMeta("preventUpdate",!t),i.insertContentAt({from:0,to:x.content.size},e,{parseOptions:n,errorOnInvalidContent:(p=s.errorOnInvalidContent)!==null&&p!==void 0?p:a.options.enableContentCheck})};function Wze(e,t){const n=Tv(t,e.schema),{from:s,to:a,empty:o}=e.selection,l=[];o?(e.storedMarks&&l.push(...e.storedMarks),l.push(...e.selection.$head.marks())):e.doc.nodesBetween(s,a,u=>{l.push(...u.marks)});const i=l.find(u=>u.type.name===n.name);return i?{...i.attrs}:{}}function Ivt(e,t){const n=new $ye(e);return t.forEach(s=>{s.steps.forEach(a=>{n.step(a)})}),n}function Pvt(e){for(let t=0;t{n(a)&&s.push({node:a,pos:o})}),s}function Gze(e,t){for(let n=e.depth;n>0;n-=1){const s=e.node(n);if(t(s))return{pos:n>0?e.before(n):0,start:e.start(n),depth:n,node:s}}}function l0e(e){return t=>Gze(t.$from,e)}function Ovt(e,t){const n={from:0,to:e.content.size};return zze(e,n,t)}function Dvt(e,t){const n=Ud(t,e.schema),{from:s,to:a}=e.selection,o=[];e.doc.nodesBetween(s,a,i=>{o.push(i)});const l=o.reverse().find(i=>i.type.name===n.name);return l?{...l.attrs}:{}}function Kze(e,t){const n=Sae(typeof t=="string"?t:t.name,e.schema);return n==="node"?Dvt(e,t):n==="mark"?Wze(e,t):{}}function Rvt(e,t=JSON.stringify){const n={};return e.filter(s=>{const a=t(s);return Object.prototype.hasOwnProperty.call(n,a)?!1:n[a]=!0})}function Fvt(e){const t=Rvt(e);return t.length===1?t:t.filter((n,s)=>!t.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 zvt(e){const{mapping:t,steps:n}=e,s=[];return t.maps.forEach((a,o)=>{const l=[];if(a.ranges.length)a.forEach((i,u)=>{l.push({from:i,to:u})});else{const{from:i,to:u}=n[o];if(i===void 0||u===void 0)return;l.push({from:i,to:u})}l.forEach(({from:i,to:u})=>{const p=t.slice(o).map(i,-1),x=t.slice(o).map(u),y=t.invert().map(p,-1),_=t.invert().map(x);s.push({oldRange:{from:y,to:_},newRange:{from:p,to:x}})})}),Fvt(s)}function c0e(e,t,n){const s=[];return e===t?n.resolve(e).marks().forEach(a=>{const o=n.resolve(e),l=i0e(o,a.type);l&&s.push({mark:a,...l})}):n.nodesBetween(e,t,(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 Gee(e,t,n){return Object.fromEntries(Object.entries(n).filter(([s])=>{const a=e.find(o=>o.type===t&&o.name===s);return a?a.attribute.keepOnSplit:!1}))}function Kfe(e,t,n={}){const{empty:s,ranges:a}=e.selection,o=t?Tv(t,e.schema):null;if(s)return!!(e.storedMarks||e.selection.$from.marks()).filter(y=>o?o.name===y.type.name:!0).find(y=>gre(y.attrs,n,{strict:!1}));let l=0;const i=[];if(a.forEach(({$from:y,$to:_})=>{const b=y.pos,S=_.pos;e.doc.nodesBetween(b,S,(k,M)=>{if(!k.isText&&!k.marks.length)return;const P=Math.max(b,M),T=Math.min(S,M+k.nodeSize),I=T-P;l+=I,i.push(...k.marks.map(z=>({mark:z,from:P,to:T})))})}),l===0)return!1;const u=i.filter(y=>o?o.name===y.mark.type.name:!0).filter(y=>gre(y.mark.attrs,n,{strict:!1})).reduce((y,_)=>y+_.to-_.from,0),p=i.filter(y=>o?y.mark.type!==o&&y.mark.type.excludes(o):!0).reduce((y,_)=>y+_.to-_.from,0);return(u>0?u+p:u)>=l}function Bvt(e,t,n={}){if(!t)return VE(e,null,n)||Kfe(e,null,n);const s=Sae(t,e.schema);return s==="node"?VE(e,t,n):s==="mark"?Kfe(e,t,n):!1}function tSe(e,t){const{nodeExtensions:n}=jae(t),s=n.find(l=>l.name===e);if(!s)return!1;const a={name:s.name,options:s.options,storage:s.storage},o=gi(Cs(s,"group",a));return typeof o!="string"?!1:o.split(" ").includes("list")}function d0e(e,{checkChildren:t=!0,ignoreWhitespace:n=!1}={}){var s;if(n){if(e.type.name==="hardBreak")return!0;if(e.isText)return/^\s*$/m.test((s=e.text)!==null&&s!==void 0?s:"")}if(e.isText)return!e.text;if(e.isAtom||e.isLeaf)return!1;if(e.content.childCount===0)return!0;if(t){let a=!0;return e.content.forEach(o=>{a!==!1&&(d0e(o,{ignoreWhitespace:n,checkChildren:t})||(a=!1))}),a}return!1}function $vt(e){return e instanceof ua}function Uvt(e,t,n){var s;const{selection:a}=t;let o=null;if(Uze(a)&&(o=a.$cursor),o){const i=(s=e.storedMarks)!==null&&s!==void 0?s:o.marks();return!!n.isInSet(i)||!i.some(u=>u.type.excludes(n))}const{ranges:l}=a;return l.some(({$from:i,$to:u})=>{let p=i.depth===0?e.doc.inlineContent&&e.doc.type.allowsMarkType(n):!1;return e.doc.nodesBetween(i.pos,u.pos,(x,y,_)=>{if(p)return!1;if(x.isInline){const b=!_||_.type.allowsMarkType(n),S=!!n.isInSet(x.marks)||!x.marks.some(k=>k.type.excludes(n));p=b&&S}return!p}),p})}const qvt=(e,t={})=>({tr:n,state:s,dispatch:a})=>{const{selection:o}=n,{empty:l,ranges:i}=o,u=Tv(e,s.schema);if(a)if(l){const p=Wze(s,u);n.addStoredMark(u.create({...p,...t}))}else i.forEach(p=>{const x=p.$from.pos,y=p.$to.pos;s.doc.nodesBetween(x,y,(_,b)=>{const S=Math.max(b,x),k=Math.min(b+_.nodeSize,y);_.marks.find(P=>P.type===u)?_.marks.forEach(P=>{u===P.type&&n.addMark(S,k,u.create({...P.attrs,...t}))}):n.addMark(S,k,u.create(t))})});return Uvt(s,n,u)},Vvt=(e,t)=>({tr:n})=>(n.setMeta(e,t),!0),Hvt=(e,t={})=>({state:n,dispatch:s,chain:a})=>{const o=Ud(e,n.schema);let l;return n.selection.$anchor.sameParent(n.selection.$head)&&(l=n.selection.$anchor.parent.attrs),o.isTextblock?a().command(({commands:i})=>Z4e(o,{...l,...t})(n)?!0:i.clearNodes()).command(({state:i})=>Z4e(o,{...l,...t})(i,s)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},Wvt=e=>({tr:t,dispatch:n})=>{if(n){const{doc:s}=t,a=lj(e,0,s.content.size),o=ua.create(s,a);t.setSelection(o)}return!0},Gvt=e=>({tr:t,dispatch:n})=>{if(n){const{doc:s}=t,{from:a,to:o}=typeof e=="number"?{from:e,to:e}:e,l=ya.atStart(s).from,i=ya.atEnd(s).to,u=lj(a,l,i),p=lj(o,l,i),x=ya.create(s,u,p);t.setSelection(x)}return!0},Kvt=e=>({state:t,dispatch:n})=>{const s=Ud(e,t.schema);return N1t(s)(t,n)};function rSe(e,t){const n=e.storedMarks||e.selection.$to.parentOffset&&e.selection.$from.marks();if(n){const s=n.filter(a=>t==null?void 0:t.includes(a.type.name));e.tr.ensureMarks(s)}}const Zvt=({keepMarks:e=!0}={})=>({tr:t,state:n,dispatch:s,editor:a})=>{const{selection:o,doc:l}=t,{$from:i,$to:u}=o,p=a.extensionManager.attributes,x=Gee(p,i.node().type.name,i.node().attrs);if(o instanceof ua&&o.node.isBlock)return!i.parentOffset||!xy(l,i.pos)?!1:(s&&(e&&rSe(n,a.extensionManager.splittableMarks),t.split(i.pos).scrollIntoView()),!0);if(!i.parent.isBlock)return!1;const y=u.parentOffset===u.parent.content.size,_=i.depth===0?void 0:Pvt(i.node(-1).contentMatchAt(i.indexAfter(-1)));let b=y&&_?[{type:_,attrs:x}]:void 0,S=xy(t.doc,t.mapping.map(i.pos),1,b);if(!b&&!S&&xy(t.doc,t.mapping.map(i.pos),1,_?[{type:_}]:void 0)&&(S=!0,b=_?[{type:_,attrs:x}]:void 0),s){if(S&&(o instanceof ya&&t.deleteSelection(),t.split(t.mapping.map(i.pos),1,b),_&&!y&&!i.parentOffset&&i.parent.type!==_)){const k=t.mapping.map(i.before()),M=t.doc.resolve(k);i.node(-1).canReplaceWith(M.index(),M.index()+1,_)&&t.setNodeMarkup(t.mapping.map(i.before()),_)}e&&rSe(n,a.extensionManager.splittableMarks),t.scrollIntoView()}return S},Yvt=(e,t={})=>({tr:n,state:s,dispatch:a,editor:o})=>{var l;const i=Ud(e,s.schema),{$from:u,$to:p}=s.selection,x=s.selection.node;if(x&&x.isBlock||u.depth<2||!u.sameParent(p))return!1;const y=u.node(-1);if(y.type!==i)return!1;const _=o.extensionManager.attributes;if(u.parent.content.size===0&&u.node(-1).childCount===u.indexAfter(-1)){if(u.depth===2||u.node(-3).type!==i||u.index(-2)!==u.node(-2).childCount-1)return!1;if(a){let P=dn.empty;const T=u.index(-1)?1:u.index(-2)?2:3;for(let W=u.depth-T;W>=u.depth-3;W-=1)P=dn.from(u.node(W).copy(P));const I=u.indexAfter(-1){if(V>-1)return!1;W.isTextblock&&W.content.size===0&&(V=G+1)}),V>-1&&n.setSelection(ya.near(n.doc.resolve(V))),n.scrollIntoView()}return!0}const b=p.pos===u.end()?y.contentMatchAt(0).defaultType:null,S={...Gee(_,y.type.name,y.attrs),...t},k={...Gee(_,u.node().type.name,u.node().attrs),...t};n.delete(u.pos,p.pos);const M=b?[{type:i,attrs:S},{type:b,attrs:k}]:[{type:i,attrs:S}];if(!xy(n.doc,u.pos,2))return!1;if(a){const{selection:P,storedMarks:T}=s,{splittableMarks:I}=o.extensionManager,z=T||P.$to.parentOffset&&P.$from.marks();if(n.split(u.pos,2,M).scrollIntoView(),!z||!a)return!0;const D=z.filter(U=>I.includes(U.type.name));n.ensureMarks(D)}return!0},dde=(e,t)=>{const n=l0e(l=>l.type===t)(e.selection);if(!n)return!0;const s=e.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(s===void 0)return!0;const a=e.doc.nodeAt(s);return n.node.type===(a==null?void 0:a.type)&&Cv(e.doc,n.pos)&&e.join(n.pos),!0},ude=(e,t)=>{const n=l0e(l=>l.type===t)(e.selection);if(!n)return!0;const s=e.doc.resolve(n.start).after(n.depth);if(s===void 0)return!0;const a=e.doc.nodeAt(s);return n.node.type===(a==null?void 0:a.type)&&Cv(e.doc,s)&&e.join(s),!0},Xvt=(e,t,n,s={})=>({editor:a,tr:o,state:l,dispatch:i,chain:u,commands:p,can:x})=>{const{extensions:y,splittableMarks:_}=a.extensionManager,b=Ud(e,l.schema),S=Ud(t,l.schema),{selection:k,storedMarks:M}=l,{$from:P,$to:T}=k,I=P.blockRange(T),z=M||k.$to.parentOffset&&k.$from.marks();if(!I)return!1;const D=l0e(U=>tSe(U.type.name,y))(k);if(I.depth>=1&&D&&I.depth-D.depth<=1){if(D.node.type===b)return p.liftListItem(S);if(tSe(D.node.type.name,y)&&b.validContent(D.node.content)&&i)return u().command(()=>(o.setNodeMarkup(D.pos,b),!0)).command(()=>dde(o,b)).command(()=>ude(o,b)).run()}return!n||!z||!i?u().command(()=>x().wrapInList(b,s)?!0:p.clearNodes()).wrapInList(b,s).command(()=>dde(o,b)).command(()=>ude(o,b)).run():u().command(()=>{const U=x().wrapInList(b,s),V=z.filter(W=>_.includes(W.type.name));return o.ensureMarks(V),U?!0:p.clearNodes()}).wrapInList(b,s).command(()=>dde(o,b)).command(()=>ude(o,b)).run()},Qvt=(e,t={},n={})=>({state:s,commands:a})=>{const{extendEmptyMarkRange:o=!1}=n,l=Tv(e,s.schema);return Kfe(s,l,t)?a.unsetMark(l,{extendEmptyMarkRange:o}):a.setMark(l,t)},Jvt=(e,t,n={})=>({state:s,commands:a})=>{const o=Ud(e,s.schema),l=Ud(t,s.schema),i=VE(s,o,n);let u;return s.selection.$anchor.sameParent(s.selection.$head)&&(u=s.selection.$anchor.parent.attrs),i?a.setNode(l,u):a.setNode(o,{...u,...n})},e_t=(e,t={})=>({state:n,commands:s})=>{const a=Ud(e,n.schema);return VE(n,a,t)?s.lift(a):s.wrapIn(a,t)},t_t=()=>({state:e,dispatch:t})=>{const n=e.plugins;for(let s=0;s=0;u-=1)l.step(i.steps[u].invert(i.docs[u]));if(o.text){const u=l.doc.resolve(o.from).marks();l.replaceWith(o.from,o.to,e.schema.text(o.text,u))}else l.delete(o.from,o.to)}return!0}}return!1},r_t=()=>({tr:e,dispatch:t})=>{const{selection:n}=e,{empty:s,ranges:a}=n;return s||t&&a.forEach(o=>{e.removeMark(o.$from.pos,o.$to.pos)}),!0},n_t=(e,t={})=>({tr:n,state:s,dispatch:a})=>{var o;const{extendEmptyMarkRange:l=!1}=t,{selection:i}=n,u=Tv(e,s.schema),{$from:p,empty:x,ranges:y}=i;if(!a)return!0;if(x&&l){let{from:_,to:b}=i;const S=(o=p.marks().find(M=>M.type===u))===null||o===void 0?void 0:o.attrs,k=i0e(p,u,S);k&&(_=k.from,b=k.to),n.removeMark(_,b,u)}else y.forEach(_=>{n.removeMark(_.$from.pos,_.$to.pos,u)});return n.removeStoredMark(u),!0},s_t=(e,t={})=>({tr:n,state:s,dispatch:a})=>{let o=null,l=null;const i=Sae(typeof e=="string"?e:e.name,s.schema);return i?(i==="node"&&(o=Ud(e,s.schema)),i==="mark"&&(l=Tv(e,s.schema)),a&&n.selection.ranges.forEach(u=>{const p=u.$from.pos,x=u.$to.pos;let y,_,b,S;n.selection.empty?s.doc.nodesBetween(p,x,(k,M)=>{o&&o===k.type&&(b=Math.max(M,p),S=Math.min(M+k.nodeSize,x),y=M,_=k)}):s.doc.nodesBetween(p,x,(k,M)=>{M=p&&M<=x&&(o&&o===k.type&&n.setNodeMarkup(M,void 0,{...k.attrs,...t}),l&&k.marks.length&&k.marks.forEach(P=>{if(l===P.type){const T=Math.max(M,p),I=Math.min(M+k.nodeSize,x);n.addMark(T,I,l.create({...P.attrs,...t}))}}))}),_&&(y!==void 0&&n.setNodeMarkup(y,void 0,{..._.attrs,...t}),l&&_.marks.length&&_.marks.forEach(k=>{l===k.type&&n.addMark(b,S,l.create({...k.attrs,...t}))}))}),!0):!1},a_t=(e,t={})=>({state:n,dispatch:s})=>{const a=Ud(e,n.schema);return y1t(a,t)(n,s)},i_t=(e,t={})=>({state:n,dispatch:s})=>{const a=Ud(e,n.schema);return v1t(a,t)(n,s)};var o_t=Object.freeze({__proto__:null,blur:U1t,clearContent:q1t,clearNodes:V1t,command:H1t,createParagraphNear:W1t,cut:G1t,deleteCurrentNode:K1t,deleteNode:Z1t,deleteRange:Y1t,deleteSelection:X1t,enter:Q1t,exitCode:J1t,extendMarkRange:evt,first:tvt,focus:nvt,forEach:svt,insertContent:avt,insertContentAt:lvt,joinBackward:uvt,joinDown:dvt,joinForward:hvt,joinItemBackward:fvt,joinItemForward:pvt,joinTextblockBackward:mvt,joinTextblockForward:gvt,joinUp:cvt,keyboardShortcut:yvt,lift:vvt,liftEmptyBlock:_vt,liftListItem:bvt,newlineInCode:wvt,resetAttributes:jvt,scrollIntoView:kvt,selectAll:Nvt,selectNodeBackward:Svt,selectNodeForward:Cvt,selectParentNode:Mvt,selectTextblockEnd:Tvt,selectTextblockStart:Avt,setContent:Evt,setMark:qvt,setMeta:Vvt,setNode:Hvt,setNodeSelection:Wvt,setTextSelection:Gvt,sinkListItem:Kvt,splitBlock:Zvt,splitListItem:Yvt,toggleList:Xvt,toggleMark:Qvt,toggleNode:Jvt,toggleWrap:e_t,undoInputRule:t_t,unsetAllMarks:r_t,unsetMark:n_t,updateAttributes:s_t,wrapIn:a_t,wrapInList:i_t});const l_t=ou.create({name:"commands",addCommands(){return{...o_t}}}),c_t=ou.create({name:"drop",addProseMirrorPlugins(){return[new gd({key:new Su("tiptapDrop"),props:{handleDrop:(e,t,n,s)=>{this.editor.emit("drop",{editor:this.editor,event:t,slice:n,moved:s})}}})]}}),d_t=ou.create({name:"editable",addProseMirrorPlugins(){return[new gd({key:new Su("editable"),props:{editable:()=>this.editor.options.editable}})]}}),u_t=new Su("focusEvents"),h_t=ou.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:e}=this;return[new gd({key:u_t,props:{handleDOMEvents:{focus:(t,n)=>{e.isFocused=!0;const s=e.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return t.dispatch(s),!1},blur:(t,n)=>{e.isFocused=!1;const s=e.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return t.dispatch(s),!1}}}})]}}),f_t=ou.create({name:"keymap",addKeyboardShortcuts(){const e=()=>this.editor.commands.first(({commands:l})=>[()=>l.undoInputRule(),()=>l.command(({tr:i})=>{const{selection:u,doc:p}=i,{empty:x,$anchor:y}=u,{pos:_,parent:b}=y,S=y.parent.isTextblock&&_>0?i.doc.resolve(_-1):y,k=S.parent.type.spec.isolating,M=y.pos-y.parentOffset,P=k&&S.parent.childCount===1?M===y.pos:La.atStart(p).from===_;return!x||!b.type.isTextblock||b.textContent.length||!P||P&&y.parent.type.name==="paragraph"?!1:l.clearNodes()}),()=>l.deleteSelection(),()=>l.joinBackward(),()=>l.selectNodeBackward()]),t=()=>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:e,"Mod-Backspace":e,"Shift-Backspace":e,Delete:t,"Mod-Delete":t,"Mod-a":()=>this.editor.commands.selectAll()},a={...s},o={...s,"Ctrl-h":e,"Alt-Backspace":e,"Ctrl-d":t,"Ctrl-Alt-Backspace":t,"Alt-Delete":t,"Alt-d":t,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return o0e()||Hze()?o:a},addProseMirrorPlugins(){return[new gd({key:new Su("clearDocument"),appendTransaction:(e,t,n)=>{if(e.some(k=>k.getMeta("composition")))return;const s=e.some(k=>k.docChanged)&&!t.doc.eq(n.doc),a=e.some(k=>k.getMeta("preventClearDocument"));if(!s||a)return;const{empty:o,from:l,to:i}=t.selection,u=La.atStart(t.doc).from,p=La.atEnd(t.doc).to;if(o||!(l===u&&i===p)||!d0e(n.doc))return;const _=n.tr,b=bae({state:n,transaction:_}),{commands:S}=new wae({editor:this.editor,state:b});if(S.clearNodes(),!!_.steps.length)return _}})]}}),p_t=ou.create({name:"paste",addProseMirrorPlugins(){return[new gd({key:new Su("tiptapPaste"),props:{handlePaste:(e,t,n)=>{this.editor.emit("paste",{editor:this.editor,event:t,slice:n})}}})]}}),m_t=ou.create({name:"tabindex",addProseMirrorPlugins(){return[new gd({key:new Su("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}});class Qw{get name(){return this.node.type.name}constructor(t,n,s=!1,a=null){this.currentNode=null,this.actualDepth=null,this.isBlock=s,this.resolvedPos=t,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 t;return(t=this.actualDepth)!==null&&t!==void 0?t:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(t){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},t)}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 t=this.resolvedPos.start(this.resolvedPos.depth-1),n=this.resolvedPos.doc.resolve(t);return new Qw(n,this.editor)}get before(){let t=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.from-3)),new Qw(t,this.editor)}get after(){let t=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.to+3)),new Qw(t,this.editor)}get children(){const t=[];return this.node.content.forEach((n,s)=>{const a=n.isBlock&&!n.isTextblock,o=n.isAtom&&!n.isText,l=this.pos+s+(o?0:1);if(l<0||l>this.resolvedPos.doc.nodeSize-2)return;const i=this.resolvedPos.doc.resolve(l);if(!a&&i.depth<=this.depth)return;const u=new Qw(i,this.editor,a,a?n:null);a&&(u.actualDepth=this.depth+1),t.push(new Qw(i,this.editor,a,a?n:null))}),t}get firstChild(){return this.children[0]||null}get lastChild(){const t=this.children;return t[t.length-1]||null}closest(t,n={}){let s=null,a=this.parent;for(;a&&!s;){if(a.node.type.name===t)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===t&&o.every(u=>n[u]===l.node.attrs[u])&&a.push(l),!(s&&a.length>0)&&(a=a.concat(l.querySelectorAll(t,n,s))))}),a}setAttribute(t){const{tr:n}=this.editor.state;n.setNodeMarkup(this.from,void 0,{...this.node.attrs,...t}),this.editor.view.dispatch(n)}}const g_t=`.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 x_t(e,t,n){const s=document.querySelector("style[data-tiptap-style]");if(s!==null)return s;const a=document.createElement("style");return t&&a.setAttribute("nonce",t),a.setAttribute("data-tiptap-style",""),a.innerHTML=e,document.getElementsByTagName("head")[0].appendChild(a),a}class y_t extends S1t{constructor(t={}){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(t),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=x_t(g_t,this.options.injectNonce))}setOptions(t={}){this.options={...this.options,...t},!(!this.view||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(t,n=!0){this.setOptions({editable:t}),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(t,n){const s=Fze(n)?n(t,[...this.state.plugins]):[...this.state.plugins,t],a=this.state.reconfigure({plugins:s});return this.view.updateState(a),a}unregisterPlugin(t){if(this.isDestroyed)return;const n=this.state.plugins;let s=n;if([].concat(t).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 t,n;const a=[...this.options.enableCoreExtensions?[d_t,$1t.configure({blockSeparator:(n=(t=this.options.coreExtensionOptions)===null||t===void 0?void 0:t.clipboardTextSerializer)===null||n===void 0?void 0:n.blockSeparator}),l_t,h_t,f_t,m_t,c_t,p_t].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 nS(a,this)}createCommandManager(){this.commandManager=new wae({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createView(){var t;let n;try{n=Gfe(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=Gfe(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}const s=qze(n,this.options.autofocus);this.view=new kze(this.options.element,{...this.options.editorProps,attributes:{role:"textbox",...(t=this.options.editorProps)===null||t===void 0?void 0:t.attributes},dispatchTransaction:this.dispatchTransaction.bind(this),state:rS.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(t){this.isCapturingTransaction=!0,t(),this.isCapturingTransaction=!1;const n=this.capturedTransaction;return this.capturedTransaction=null,n}dispatchTransaction(t){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=t;return}t.steps.forEach(l=>{var i;return(i=this.capturedTransaction)===null||i===void 0?void 0:i.step(l)});return}const n=this.state.apply(t),s=!this.state.selection.eq(n.selection);this.emit("beforeTransaction",{editor:this,transaction:t,nextState:n}),this.view.updateState(n),this.emit("transaction",{editor:this,transaction:t}),s&&this.emit("selectionUpdate",{editor:this,transaction:t});const a=t.getMeta("focus"),o=t.getMeta("blur");a&&this.emit("focus",{editor:this,event:a.event,transaction:t}),o&&this.emit("blur",{editor:this,event:o.event,transaction:t}),!(!t.docChanged||t.getMeta("preventUpdate"))&&this.emit("update",{editor:this,transaction:t})}getAttributes(t){return Kze(this.state,t)}isActive(t,n){const s=typeof t=="string"?t:null,a=typeof t=="string"?n:t;return Bvt(this.state,s,a)}getJSON(){return this.state.doc.toJSON()}getHTML(){return s0e(this.state.doc.content,this.schema)}getText(t){const{blockSeparator:n=` `,textSerializers:s={}}=t||{};return Ovt(this.state.doc,{blockSeparator:n,textSerializers:{...Bze(this.schema),...s}})}get isEmpty(){return d0e(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 t=this.view.dom;t&&t.editor&&delete t.editor,this.view.destroy()}this.removeAllListeners()}get isDestroyed(){var t;return!(!((t=this.view)===null||t===void 0)&&t.docView)}$node(t,n){var s;return((s=this.$doc)===null||s===void 0?void 0:s.querySelector(t,n))||null}$nodes(t,n){var s;return((s=this.$doc)===null||s===void 0?void 0:s.querySelectorAll(t,n))||null}$pos(t){const n=this.state.doc.resolve(t);return new Qw(n,this)}get $doc(){return this.$pos(0)}}function BC(e){return new kae({find:e.find,handler:({state:t,range:n,match:s})=>{const a=gi(e.getAttributes,void 0,s);if(a===!1||a===null)return null;const{tr:o}=t,l=s[s.length-1],i=s[0];if(l){const u=i.search(/\S/),p=n.from+i.indexOf(l),x=p+l.length;if(c0e(n.from,n.to,t.doc).filter(b=>b.mark.type.excluded.find(k=>k===e.type&&k!==b.mark.type)).filter(b=>b.to>p).length)return null;xn.from&&o.delete(n.from+u,p);const _=n.from+u+l.length;o.addMark(n.from+u,_,e.type.create(a||{})),o.removeStoredMark(e.type)}}})}function Zze(e){return new kae({find:e.find,handler:({state:t,range:n,match:s})=>{const a=gi(e.getAttributes,void 0,s)||{},{tr:o}=t,l=n.from;let i=n.to;const u=e.type.create(a);if(s[1]){const p=s[0].lastIndexOf(s[1]);let x=l+p;x>i?x=i:i=x+s[1].length;const y=s[0][s[0].length-1];o.insertText(y,l+s[0].length-1),o.replaceWith(x,i,u)}else if(s[0]){const p=e.type.isInline?l:l-1;o.insert(p,e.type.create(a)).delete(o.mapping.map(l),o.mapping.map(i))}o.scrollIntoView()}})}function Zfe(e){return new kae({find:e.find,handler:({state:t,range:n,match:s})=>{const a=t.doc.resolve(n.from),o=gi(e.getAttributes,void 0,s)||{};if(!a.node(-1).canReplaceWith(a.index(-1),a.indexAfter(-1),e.type))return null;t.tr.delete(n.from,n.to).setBlockType(n.from,n.from,e.type,o)}})}function HE(e){return new kae({find:e.find,handler:({state:t,range:n,match:s,chain:a})=>{const o=gi(e.getAttributes,void 0,s)||{},l=t.tr.delete(n.from,n.to),u=l.doc.resolve(n.from).blockRange(),p=u&&Bye(u,e.type,o);if(!p)return null;if(l.wrap(u,p),e.keepMarks&&e.editor){const{selection:y,storedMarks:_}=t,{splittableMarks:b}=e.editor.extensionManager,S=_||y.$to.parentOffset&&y.$from.marks();if(S){const k=S.filter(M=>b.includes(M.type.name));l.ensureMarks(k)}}if(e.keepAttributes){const y=e.type.name==="bulletList"||e.type.name==="orderedList"?"listItem":"taskList";a().updateAttributes(y,o).run()}const x=l.doc.resolve(n.from-1).nodeBefore;x&&x.type===e.type&&Cv(l.doc,n.from-1)&&(!e.joinPredicate||e.joinPredicate(s,x))&&l.join(n.from-1)}})}let Cu=class Yfe{constructor(t={}){this.type="node",this.name="node",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...t},this.name=this.config.name,t.defaultOptions&&Object.keys(t.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=gi(Cs(this,"addOptions",{name:this.name}))),this.storage=gi(Cs(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(t={}){return new Yfe(t)}configure(t={}){const n=this.extend({...this.config,addOptions:()=>Nae(this.options,t)});return n.name=this.name,n.parent=this.parent,n}extend(t={}){const n=new Yfe(t);return n.parent=this,this.child=n,n.name=t.name?t.name:n.parent.name,t.defaultOptions&&Object.keys(t.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`),n.options=gi(Cs(n,"addOptions",{name:n.name})),n.storage=gi(Cs(n,"addStorage",{name:n.name,options:n.options})),n}};function pk(e){return new O1t({find:e.find,handler:({state:t,range:n,match:s,pasteEvent:a})=>{const o=gi(e.getAttributes,void 0,s,a);if(o===!1||o===null)return null;const{tr:l}=t,i=s[s.length-1],u=s[0];let p=n.to;if(i){const x=u.search(/\S/),y=n.from+u.indexOf(i),_=y+i.length;if(c0e(n.from,n.to,t.doc).filter(S=>S.mark.type.excluded.find(M=>M===e.type&&M!==S.mark.type)).filter(S=>S.to>y).length)return null;_n.from&&l.delete(n.from+x,y),p=n.from+x+i.length,l.addMark(n.from+x,p,e.type.create(o||{})),l.removeStoredMark(e.type)}}})}function v_t(e,t){const{selection:n}=e,{$from:s}=n;if(n instanceof ua){const o=s.index();return s.parent.canReplaceWith(o,o+1,t)}let a=s.depth;for(;a>=0;){const o=s.index(a);if(s.node(a).contentMatchAt(o).matchType(t))return!0;a-=1}return!1}function __t(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Yze={exports:{}},hde={};/** * @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 nSe;function b_t(){if(nSe)return hde;nSe=1;var e=lt;function t(y,_){return y===_&&(y!==0||1/y===1/_)||y!==y&&_!==_}var n=typeof Object.is=="function"?Object.is:t,s=e.useState,a=e.useEffect,o=e.useLayoutEffect,l=e.useDebugValue;function i(y,_){var b=_(),S=s({inst:{value:b,getSnapshot:_}}),k=S[0].inst,M=S[1];return o(function(){k.value=b,k.getSnapshot=_,u(k)&&M({inst:k})},[y,b,_]),a(function(){return u(k)&&M({inst:k}),y(function(){u(k)&&M({inst:k})})},[y]),l(b),b}function u(y){var _=y.getSnapshot;y=y.value;try{var b=_();return!n(y,b)}catch{return!0}}function p(y,_){return _()}var x=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?p:i;return hde.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:x,hde}Yze.exports=b_t();var u0e=Yze.exports;const w_t=(...e)=>t=>{e.forEach(n=>{typeof n=="function"?n(t):n&&(n.current=t)})},j_t=({contentComponent:e})=>{const t=u0e.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getServerSnapshot);return lt.createElement(lt.Fragment,null,Object.values(t))};function k_t(){const e=new Set;let t={};return{subscribe(n){return e.add(n),()=>{e.delete(n)}},getSnapshot(){return t},getServerSnapshot(){return t},setRenderer(n,s){t={...t,[n]:Xge.createPortal(s.reactElement,s.element,n)},e.forEach(a=>a())},removeRenderer(n){const s={...t};delete s[n],t=s,e.forEach(a=>a())}}}class N_t extends lt.Component{constructor(t){var n;super(t),this.editorContentRef=lt.createRef(),this.initialized=!1,this.state={hasContentComponentInitialized:!!(!((n=t.editor)===null||n===void 0)&&n.contentComponent)}}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){const t=this.props.editor;if(t&&!t.isDestroyed&&t.options.element){if(t.contentComponent)return;const n=this.editorContentRef.current;n.append(...t.options.element.childNodes),t.setOptions({element:n}),t.contentComponent=k_t(),this.state.hasContentComponentInitialized||(this.unsubscribeToContentComponent=t.contentComponent.subscribe(()=>{this.setState(s=>s.hasContentComponentInitialized?s:{hasContentComponentInitialized:!0}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent()})),t.createNodeViews(),this.initialized=!0}}componentWillUnmount(){const t=this.props.editor;if(!t||(this.initialized=!1,t.isDestroyed||t.view.setProps({nodeViews:{}}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent(),t.contentComponent=null,!t.options.element.firstChild))return;const n=document.createElement("div");n.append(...t.options.element.childNodes),t.setOptions({element:n})}render(){const{editor:t,innerRef:n,...s}=this.props;return lt.createElement(lt.Fragment,null,lt.createElement("div",{ref:w_t(n,this.editorContentRef),...s}),(t==null?void 0:t.contentComponent)&<.createElement(j_t,{contentComponent:t.contentComponent}))}}const S_t=E.forwardRef((e,t)=>{const n=lt.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[e.editor]);return lt.createElement(N_t,{key:n,innerRef:t,...e})}),Xze=lt.memo(S_t);var C_t=function e(t,n){if(t===n)return!0;if(t&&n&&typeof t=="object"&&typeof n=="object"){if(t.constructor!==n.constructor)return!1;var s,a,o;if(Array.isArray(t)){if(s=t.length,s!=n.length)return!1;for(a=s;a--!==0;)if(!e(t[a],n[a]))return!1;return!0}if(t instanceof Map&&n instanceof Map){if(t.size!==n.size)return!1;for(a of t.entries())if(!n.has(a[0]))return!1;for(a of t.entries())if(!e(a[1],n.get(a[0])))return!1;return!0}if(t instanceof Set&&n instanceof Set){if(t.size!==n.size)return!1;for(a of t.entries())if(!n.has(a[0]))return!1;return!0}if(ArrayBuffer.isView(t)&&ArrayBuffer.isView(n)){if(s=t.length,s!=n.length)return!1;for(a=s;a--!==0;)if(t[a]!==n[a])return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if(o=Object.keys(t),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"&&t.$$typeof)&&!e(t[l],n[l]))return!1}return!0}return t!==t&&n!==n},M_t=__t(C_t),Qze={exports:{}},fde={};/** * @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 sSe;function T_t(){if(sSe)return fde;sSe=1;var e=lt,t=u0e;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=t.useSyncExternalStore,o=e.useRef,l=e.useEffect,i=e.useMemo,u=e.useDebugValue;return fde.useSyncExternalStoreWithSelector=function(p,x,y,_,b){var S=o(null);if(S.current===null){var k={hasValue:!1,value:null};S.current=k}else k=S.current;S=i(function(){function P(U){if(!T){if(T=!0,I=U,U=_(U),b!==void 0&&k.hasValue){var V=k.value;if(b(V,U))return z=V}return z=U}if(V=z,s(I,U))return V;var W=_(U);return b!==void 0&&b(V,W)?V:(I=U,z=W)}var T=!1,I,z,D=y===void 0?null:y;return[function(){return P(x())},D===null?void 0:function(){return P(D())}]},[x,y,_,b]);var M=a(p,S[0],S[1]);return l(function(){k.hasValue=!0,k.value=M},[M]),u(M),M},fde}Qze.exports=T_t();var A_t=Qze.exports;const E_t=typeof window<"u"?E.useLayoutEffect:E.useEffect;class I_t{constructor(t){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=t,this.lastSnapshot={editor:t,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(t){return this.subscribers.add(t),()=>{this.subscribers.delete(t)}}watch(t){if(this.editor=t,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 P_t(e){var t;const[n]=E.useState(()=>new I_t(e.editor)),s=A_t.useSyncExternalStoreWithSelector(n.subscribe,n.getSnapshot,n.getServerSnapshot,e.selector,(t=e.equalityFn)!==null&&t!==void 0?t:M_t);return E_t(()=>n.watch(e.editor),[e.editor,n]),E.useDebugValue(s),s}const L_t=!1,Xfe=typeof window>"u",O_t=Xfe||!!(typeof window<"u"&&window.next);class h0e{constructor(t){this.editor=null,this.subscriptions=new Set,this.isComponentMounted=!1,this.previousDeps=null,this.instanceId="",this.options=t,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(t){this.editor=t,this.instanceId=Math.random().toString(36).slice(2,9),this.subscriptions.forEach(n=>n())}getInitialEditor(){return this.options.current.immediatelyRender===void 0?Xfe||O_t?null:this.createEditor():(this.options.current.immediatelyRender,this.options.current.immediatelyRender?this.createEditor():null)}createEditor(){const t={...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 y_t(t)}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(t){return this.subscriptions.add(t),()=>{this.subscriptions.delete(t)}}static compareOptions(t,n){return Object.keys(t).every(s=>["onCreate","onBeforeCreate","onDestroy","onUpdate","onTransaction","onFocus","onBlur","onSelectionUpdate","onContentError","onDrop","onPaste"].includes(s)?!0:s==="extensions"&&t.extensions&&n.extensions?t.extensions.length!==n.extensions.length?!1:t.extensions.every((a,o)=>{var l;return a===((l=n.extensions)===null||l===void 0?void 0:l[o])}):t[s]===n[s])}onRender(t){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&t.length===0?h0e.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(t),()=>{this.isComponentMounted=!1,this.scheduleDestroy()})}refreshEditorInstance(t){if(this.editor&&!this.editor.isDestroyed){if(this.previousDeps===null){this.previousDeps=t;return}if(this.previousDeps.length===t.length&&this.previousDeps.every((s,a)=>s===t[a]))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=t}scheduleDestroy(){const t=this.instanceId,n=this.editor;this.scheduledDestructionTimeout=setTimeout(()=>{if(this.isComponentMounted&&this.instanceId===t){n&&n.setOptions(this.options.current);return}n&&!n.isDestroyed&&(n.destroy(),this.instanceId===t&&this.setEditor(null))},1)}}function Jze(e={},t=[]){const n=E.useRef(e);n.current=e;const[s]=E.useState(()=>new h0e(n)),a=u0e.useSyncExternalStore(s.subscribe,s.getEditor,s.getServerSnapshot);return E.useDebugValue(a),E.useEffect(s.onRender(t)),P_t({editor:a,selector:({transactionNumber:o})=>e.shouldRerenderOnTransaction===!1?null:e.immediatelyRender&&o===0?0:o+1}),a}const D_t=E.createContext({editor:null});D_t.Consumer;const R_t=E.createContext({onDragStart:void 0}),F_t=()=>E.useContext(R_t);lt.forwardRef((e,t)=>{const{onDragStart:n}=F_t(),s=e.as||"div";return lt.createElement(s,{...e,ref:t,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...e.style}})});const z_t=/^\s*>\s$/,B_t=Cu.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:e}){return["blockquote",Wl(this.options.HTMLAttributes,e),0]},addCommands(){return{setBlockquote:()=>({commands:e})=>e.wrapIn(this.name),toggleBlockquote:()=>({commands:e})=>e.toggleWrap(this.name),unsetBlockquote:()=>({commands:e})=>e.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[HE({find:z_t,type:this.type})]}}),$_t=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,U_t=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,q_t=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,V_t=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,H_t=Xg.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:e=>e.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:e=>e.type.name===this.name},{style:"font-weight",getAttrs:e=>/^(bold(er)?|[5-9]\d{2,})$/.test(e)&&null}]},renderHTML({HTMLAttributes:e}){return["strong",Wl(this.options.HTMLAttributes,e),0]},addCommands(){return{setBold:()=>({commands:e})=>e.setMark(this.name),toggleBold:()=>({commands:e})=>e.toggleMark(this.name),unsetBold:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[BC({find:$_t,type:this.type}),BC({find:q_t,type:this.type})]},addPasteRules(){return[pk({find:U_t,type:this.type}),pk({find:V_t,type:this.type})]}}),W_t="listItem",aSe="textStyle",iSe=/^\s*([-+*])\s$/,G_t=Cu.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:e}){return["ul",Wl(this.options.HTMLAttributes,e),0]},addCommands(){return{toggleBulletList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(W_t,this.editor.getAttributes(aSe)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let e=HE({find:iSe,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(e=HE({find:iSe,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(aSe),editor:this.editor})),[e]}}),K_t=/(^|[^`])`([^`]+)`(?!`)/,Z_t=/(^|[^`])`([^`]+)`(?!`)/g,Y_t=Xg.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:e}){return["code",Wl(this.options.HTMLAttributes,e),0]},addCommands(){return{setCode:()=>({commands:e})=>e.setMark(this.name),toggleCode:()=>({commands:e})=>e.toggleMark(this.name),unsetCode:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[BC({find:K_t,type:this.type})]},addPasteRules(){return[pk({find:Z_t,type:this.type})]}}),X_t=/^```([a-z]+)?[\s\n]$/,Q_t=/^~~~([a-z]+)?[\s\n]$/,J_t=Cu.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:e=>{var t;const{languageClassPrefix:n}=this.options,o=[...((t=e.firstElementChild)===null||t===void 0?void 0:t.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:e,HTMLAttributes:t}){return["pre",Wl(this.options.HTMLAttributes,t),["code",{class:e.attrs.language?this.options.languageClassPrefix+e.attrs.language:null},0]]},addCommands(){return{setCodeBlock:e=>({commands:t})=>t.setNode(this.name,e),toggleCodeBlock:e=>({commands:t})=>t.toggleNode(this.name,"paragraph",e)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:e,$anchor:t}=this.editor.state.selection,n=t.pos===1;return!e||t.parent.type.name!==this.name?!1:n||!t.parent.textContent.length?this.editor.commands.clearNodes():!1},Enter:({editor:e})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:t}=e,{selection:n}=t,{$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:e.chain().command(({tr:i})=>(i.delete(s.pos-2,s.pos),!0)).exitCode().run()},ArrowDown:({editor:e})=>{if(!this.options.exitOnArrowDown)return!1;const{state:t}=e,{selection:n,doc:s}=t,{$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)?e.commands.command(({tr:p})=>(p.setSelection(La.near(s.resolve(i))),!0)):e.commands.exitCode()}}},addInputRules(){return[Zfe({find:X_t,type:this.type,getAttributes:e=>({language:e[1]})}),Zfe({find:Q_t,type:this.type,getAttributes:e=>({language:e[1]})})]},addProseMirrorPlugins(){return[new gd({key:new Su("codeBlockVSCodeHandler"),props:{handlePaste:(e,t)=>{if(!t.clipboardData||this.editor.isActive(this.type.name))return!1;const n=t.clipboardData.getData("text/plain"),s=t.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}=e.state,u=i.text(n.replace(/\r\n?/g,` `));return l.replaceSelectionWith(this.type.create({language:o},u)),l.selection.$from.parent.type!==this.type&&l.setSelection(ya.near(l.doc.resolve(Math.max(0,l.selection.from-2)))),l.setMeta("paste",!0),e.dispatch(l),!0}}})]}}),ebt=Cu.create({name:"doc",topNode:!0,content:"block+"});function tbt(e={}){return new gd({view(t){return new rbt(t,e)}})}class rbt{constructor(t,n){var s;this.editorView=t,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 t.dom.addEventListener(a,o),{name:a,handler:o}})}destroy(){this.handlers.forEach(({name:t,handler:n})=>this.editorView.dom.removeEventListener(t,n))}update(t,n){this.cursorPos!=null&&n.doc!=t.state.doc&&(this.cursorPos>t.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(t){t!=this.cursorPos&&(this.cursorPos=t,t==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let t=this.editorView.state.doc.resolve(this.cursorPos),n=!t.parent.inlineContent,s,a=this.editorView.dom,o=a.getBoundingClientRect(),l=o.width/a.offsetWidth,i=o.height/a.offsetHeight;if(n){let y=t.nodeBefore,_=t.nodeAfter;if(y||_){let b=this.editorView.nodeDOM(this.cursorPos-(y?y.nodeSize:0));if(b){let S=b.getBoundingClientRect(),k=y?S.bottom:S.top;y&&_&&(k=(k+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let M=this.width/2*i;s={left:S.left,right:S.right,top:k-M,bottom:k+M}}}}if(!s){let y=this.editorView.coordsAtPos(this.cursorPos),_=this.width/2*l;s={left:y.left-_,right:y.left+_,top:y.top,bottom:y.bottom}}let u=this.editorView.dom.offsetParent;this.element||(this.element=u.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n);let p,x;if(!u||u==document.body&&getComputedStyle(u).position=="static")p=-pageXOffset,x=-pageYOffset;else{let y=u.getBoundingClientRect(),_=y.width/u.offsetWidth,b=y.height/u.offsetHeight;p=y.left-u.scrollLeft*_,x=y.top-u.scrollTop*b}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(t){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),t)}dragover(t){if(!this.editorView.editable)return;let n=this.editorView.posAtCoords({left:t.clientX,top:t.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,t):a;if(n&&!o){let l=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let i=DFe(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(t){this.editorView.dom.contains(t.relatedTarget)||this.setCursor(null)}}const nbt=ou.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[tbt(this.options)]}});class tc extends La{constructor(t){super(t,t)}map(t,n){let s=t.resolve(n.map(this.head));return tc.valid(s)?new tc(s):La.near(s)}content(){return Kn.empty}eq(t){return t instanceof tc&&t.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(t,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new tc(t.resolve(n.pos))}getBookmark(){return new f0e(this.anchor)}static valid(t){let n=t.parent;if(n.isTextblock||!sbt(t)||!abt(t))return!1;let s=n.type.spec.allowGapCursor;if(s!=null)return s;let a=n.contentMatchAt(t.index()).defaultType;return a&&a.isTextblock}static findGapCursorFrom(t,n,s=!1){e:for(;;){if(!s&&tc.valid(t))return t;let a=t.pos,o=null;for(let l=t.depth;;l--){let i=t.node(l);if(n>0?t.indexAfter(l)0){o=i.child(n>0?t.indexAfter(l):t.index(l)-1);break}else if(l==0)return null;a+=n;let u=t.doc.resolve(a);if(tc.valid(u))return u}for(;;){let l=n>0?o.firstChild:o.lastChild;if(!l){if(o.isAtom&&!o.isText&&!ua.isSelectable(o)){t=t.doc.resolve(a+o.nodeSize*n),s=!1;continue e}break}o=l,a+=n;let i=t.doc.resolve(a);if(tc.valid(i))return i}return null}}}tc.prototype.visible=!1;tc.findFrom=tc.findGapCursorFrom;La.jsonID("gapcursor",tc);class f0e{constructor(t){this.pos=t}map(t){return new f0e(t.map(this.pos))}resolve(t){let n=t.resolve(this.pos);return tc.valid(n)?new tc(n):La.near(n)}}function e7e(e){return e.isAtom||e.spec.isolating||e.spec.createGapCursor}function sbt(e){for(let t=e.depth;t>=0;t--){let n=e.index(t),s=e.node(t);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||e7e(a.type))return!0;if(a.inlineContent)return!1}}return!0}function abt(e){for(let t=e.depth;t>=0;t--){let n=e.indexAfter(t),s=e.node(t);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||e7e(a.type))return!0;if(a.inlineContent)return!1}}return!0}function ibt(){return new gd({props:{decorations:dbt,createSelectionBetween(e,t,n){return t.pos==n.pos&&tc.valid(n)?new tc(n):null},handleClick:lbt,handleKeyDown:obt,handleDOMEvents:{beforeinput:cbt}}})}const obt=Qye({ArrowLeft:hO("horiz",-1),ArrowRight:hO("horiz",1),ArrowUp:hO("vert",-1),ArrowDown:hO("vert",1)});function hO(e,t){const n=e=="vert"?t>0?"down":"up":t>0?"right":"left";return function(s,a,o){let l=s.selection,i=t>0?l.$to:l.$from,u=l.empty;if(l instanceof ya){if(!o.endOfTextblock(n)||i.depth==0)return!1;u=!1,i=s.doc.resolve(t>0?i.after():i.before())}let p=tc.findGapCursorFrom(i,t,u);return p?(a&&a(s.tr.setSelection(new tc(p))),!0):!1}}function lbt(e,t,n){if(!e||!e.editable)return!1;let s=e.state.doc.resolve(t);if(!tc.valid(s))return!1;let a=e.posAtCoords({left:n.clientX,top:n.clientY});return a&&a.inside>-1&&ua.isSelectable(e.state.doc.nodeAt(a.inside))?!1:(e.dispatch(e.state.tr.setSelection(new tc(s))),!0)}function cbt(e,t){if(t.inputType!="insertCompositionText"||!(e.state.selection instanceof tc))return!1;let{$from:n}=e.state.selection,s=n.parent.contentMatchAt(n.index()).findWrapping(e.state.schema.nodes.text);if(!s)return!1;let a=dn.empty;for(let l=s.length-1;l>=0;l--)a=dn.from(s[l].createAndFill(null,a));let o=e.state.tr.replace(n.pos,n.pos,new Kn(a,0,0));return o.setSelection(ya.near(o.doc.resolve(n.pos+1))),e.dispatch(o),!1}function dbt(e){if(!(e.selection instanceof tc))return null;let t=document.createElement("div");return t.className="ProseMirror-gapcursor",ec.create(e.doc,[Gu.widget(e.selection.head,t,{key:"gapcursor"})])}const ubt=ou.create({name:"gapCursor",addProseMirrorPlugins(){return[ibt()]},extendNodeSchema(e){var t;const n={name:e.name,options:e.options,storage:e.storage};return{allowGapCursor:(t=gi(Cs(e,"allowGapCursor",n)))!==null&&t!==void 0?t:null}}}),hbt=Cu.create({name:"hardBreak",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:e}){return["br",Wl(this.options.HTMLAttributes,e)]},renderText(){return` `},addCommands(){return{setHardBreak:()=>({commands:e,chain:t,state:n,editor:s})=>e.first([()=>e.exitCode(),()=>e.command(()=>{const{selection:a,storedMarks:o}=n;if(a.$from.parent.type.spec.isolating)return!1;const{keepMarks:l}=this.options,{splittableMarks:i}=s.extensionManager,u=o||a.$to.parentOffset&&a.$from.marks();return t().insertContent({type:this.name}).command(({tr:p,dispatch:x})=>{if(x&&u&&l){const y=u.filter(_=>i.includes(_.type.name));p.ensureMarks(y)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),fbt=Cu.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(e=>({tag:`h${e}`,attrs:{level:e}}))},renderHTML({node:e,HTMLAttributes:t}){return[`h${this.options.levels.includes(e.attrs.level)?e.attrs.level:this.options.levels[0]}`,Wl(this.options.HTMLAttributes,t),0]},addCommands(){return{setHeading:e=>({commands:t})=>this.options.levels.includes(e.level)?t.setNode(this.name,e):!1,toggleHeading:e=>({commands:t})=>this.options.levels.includes(e.level)?t.toggleNode(this.name,"paragraph",e):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((e,t)=>({...e,[`Mod-Alt-${t}`]:()=>this.editor.commands.toggleHeading({level:t})}),{})},addInputRules(){return this.options.levels.map(e=>Zfe({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${e}})\\s$`),type:this.type,getAttributes:{level:e}}))}});var xre=200,$d=function(){};$d.prototype.append=function(t){return t.length?(t=$d.from(t),!this.length&&t||t.length=n?$d.empty:this.sliceInner(Math.max(0,t),Math.min(this.length,n))};$d.prototype.get=function(t){if(!(t<0||t>=this.length))return this.getInner(t)};$d.prototype.forEach=function(t,n,s){n===void 0&&(n=0),s===void 0&&(s=this.length),n<=s?this.forEachInner(t,n,s,0):this.forEachInvertedInner(t,n,s,0)};$d.prototype.map=function(t,n,s){n===void 0&&(n=0),s===void 0&&(s=this.length);var a=[];return this.forEach(function(o,l){return a.push(t(o,l))},n,s),a};$d.from=function(t){return t instanceof $d?t:t&&t.length?new t7e(t):$d.empty};var t7e=function(e){function t(s){e.call(this),this.values=s}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={length:{configurable:!0},depth:{configurable:!0}};return t.prototype.flatten=function(){return this.values},t.prototype.sliceInner=function(a,o){return a==0&&o==this.length?this:new t(this.values.slice(a,o))},t.prototype.getInner=function(a){return this.values[a]},t.prototype.forEachInner=function(a,o,l,i){for(var u=o;u=l;u--)if(a(this.values[u],i+u)===!1)return!1},t.prototype.leafAppend=function(a){if(this.length+a.length<=xre)return new t(this.values.concat(a.flatten()))},t.prototype.leafPrepend=function(a){if(this.length+a.length<=xre)return new t(a.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(t.prototype,n),t}($d);$d.empty=new t7e([]);var pbt=function(e){function t(n,s){e.call(this),this.left=n,this.right=s,this.length=n.length+s.length,this.depth=Math.max(n.depth,s.depth)+1}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},t.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},t.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))},t.prototype.leafAppend=function(s){var a=this.right.leafAppend(s);if(a)return new t(this.left,a)},t.prototype.leafPrepend=function(s){var a=this.left.leafPrepend(s);if(a)return new t(a,this.right)},t.prototype.appendInner=function(s){return this.left.depth>=Math.max(this.right.depth,s.depth)+1?new t(this.left,new t(this.right,s)):new t(this,s)},t}($d);const mbt=500;class xm{constructor(t,n){this.items=t,this.eventCount=n}popEvent(t,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=t.tr,i,u,p=[],x=[];return this.items.forEach((y,_)=>{if(!y.step){a||(a=this.remapping(s,_+1),o=a.maps.length),o--,x.push(y);return}if(a){x.push(new gg(y.map));let b=y.step.map(a.slice(o)),S;b&&l.maybeStep(b).doc&&(S=l.mapping.maps[l.mapping.maps.length-1],p.push(new gg(S,void 0,void 0,p.length+x.length))),o--,S&&a.appendMap(S,o)}else l.maybeStep(y.step);if(y.selection)return i=a?y.selection.map(a.slice(o)):y.selection,u=new xm(this.items.slice(0,s).append(x.reverse().concat(p)),this.eventCount-1),!1},this.items.length,0),{remaining:u,transform:l,selection:i}}addTransform(t,n,s,a){let o=[],l=this.eventCount,i=this.items,u=!a&&i.length?i.get(i.length-1):null;for(let x=0;xxbt&&(i=gbt(i,p),l-=p),new xm(i.append(o),l)}remapping(t,n){let s=new FE;return this.items.forEach((a,o)=>{let l=a.mirrorOffset!=null&&o-a.mirrorOffset>=t?s.maps.length-a.mirrorOffset:void 0;s.appendMap(a.map,l)},t,n),s}addMaps(t){return this.eventCount==0?this:new xm(this.items.append(t.map(n=>new gg(n))),this.eventCount)}rebased(t,n){if(!this.eventCount)return this;let s=[],a=Math.max(0,this.items.length-n),o=t.mapping,l=t.steps.length,i=this.eventCount;this.items.forEach(_=>{_.selection&&i--},a);let u=n;this.items.forEach(_=>{let b=o.getMirror(--u);if(b==null)return;l=Math.min(l,b);let S=o.maps[b];if(_.step){let k=t.steps[b].invert(t.docs[b]),M=_.selection&&_.selection.map(o.slice(u+1,b));M&&i++,s.push(new gg(S,k,M))}else s.push(new gg(S))},a);let p=[];for(let _=n;_mbt&&(y=y.compress(this.items.length-s.length)),y}emptyItemCount(){let t=0;return this.items.forEach(n=>{n.step||t++}),t}compress(t=this.items.length){let n=this.remapping(0,t),s=n.maps.length,a=[],o=0;return this.items.forEach((l,i)=>{if(i>=t)a.push(l),l.selection&&o++;else if(l.step){let u=l.step.map(n.slice(s)),p=u&&u.getMap();if(s--,p&&n.appendMap(p,s),u){let x=l.selection&&l.selection.map(n.slice(s));x&&o++;let y=new gg(p.invert(),u,x),_,b=a.length-1;(_=a.length&&a[b].merge(y))?a[b]=_:a.push(y)}}else l.map&&s--},this.items.length,0),new xm($d.from(a.reverse()),o)}}xm.empty=new xm($d.empty,0);function gbt(e,t){let n;return e.forEach((s,a)=>{if(s.selection&&t--==0)return n=a,!1}),e.slice(n)}class gg{constructor(t,n,s,a){this.map=t,this.step=n,this.selection=s,this.mirrorOffset=a}merge(t){if(this.step&&t.step&&!t.selection){let n=t.step.merge(this.step);if(n)return new gg(n.getMap().invert(),n,this.selection)}}}class Q0{constructor(t,n,s,a,o){this.done=t,this.undone=n,this.prevRanges=s,this.prevTime=a,this.prevComposition=o}}const xbt=20;function ybt(e,t,n,s){let a=n.getMeta(Gj),o;if(a)return a.historyState;n.getMeta(bbt)&&(e=new Q0(e.done,e.undone,null,0,-1));let l=n.getMeta("appendedTransaction");if(n.steps.length==0)return e;if(l&&l.getMeta(Gj))return l.getMeta(Gj).redo?new Q0(e.done.addTransform(n,void 0,s,Kee(t)),e.undone,oSe(n.mapping.maps),e.prevTime,e.prevComposition):new Q0(e.done,e.undone.addTransform(n,void 0,s,Kee(t)),null,e.prevTime,e.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(l&&l.getMeta("addToHistory")===!1)){let i=n.getMeta("composition"),u=e.prevTime==0||!l&&e.prevComposition!=i&&(e.prevTime<(n.time||0)-s.newGroupDelay||!vbt(n,e.prevRanges)),p=l?pde(e.prevRanges,n.mapping):oSe(n.mapping.maps);return new Q0(e.done.addTransform(n,u?t.selection.getBookmark():void 0,s,Kee(t)),xm.empty,p,n.time,i??e.prevComposition)}else return(o=n.getMeta("rebased"))?new Q0(e.done.rebased(n,o),e.undone.rebased(n,o),pde(e.prevRanges,n.mapping),e.prevTime,e.prevComposition):new Q0(e.done.addMaps(n.mapping.maps),e.undone.addMaps(n.mapping.maps),pde(e.prevRanges,n.mapping),e.prevTime,e.prevComposition)}function vbt(e,t){if(!t)return!1;if(!e.docChanged)return!0;let n=!1;return e.mapping.maps[0].forEach((s,a)=>{for(let o=0;o=t[o]&&(n=!0)}),n}function oSe(e){let t=[];for(let n=e.length-1;n>=0&&t.length==0;n--)e[n].forEach((s,a,o,l)=>t.push(o,l));return t}function pde(e,t){if(!e)return null;let n=[];for(let s=0;s{let a=Gj.getState(n);if(!a||(e?a.undone:a.done).eventCount==0)return!1;if(s){let o=_bt(a,n,e);o&&s(t?o.scrollIntoView():o)}return!0}}const n7e=r7e(!1,!0),s7e=r7e(!0,!0),jbt=ou.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:e,dispatch:t})=>n7e(e,t),redo:()=>({state:e,dispatch:t})=>s7e(e,t)}},addProseMirrorPlugins(){return[wbt(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()}}}),kbt=Cu.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{}}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:e}){return["hr",Wl(this.options.HTMLAttributes,e)]},addCommands(){return{setHorizontalRule:()=>({chain:e,state:t})=>{if(!v_t(t,t.schema.nodes[this.name]))return!1;const{selection:n}=t,{$from:s,$to:a}=n,o=e();return s.parentOffset===0?o.insertContentAt({from:Math.max(s.pos-1,0),to:a.pos},{type:this.name}):$vt(n)?o.insertContentAt(a.pos,{type:this.name}):o.insertContent({type:this.name}),o.command(({tr:l,dispatch:i})=>{var u;if(i){const{$to:p}=l.selection,x=p.end();if(p.nodeAfter)p.nodeAfter.isTextblock?l.setSelection(ya.create(l.doc,p.pos+1)):p.nodeAfter.isBlock?l.setSelection(ua.create(l.doc,p.pos)):l.setSelection(ya.create(l.doc,p.pos));else{const y=(u=p.parent.type.contentMatch.defaultType)===null||u===void 0?void 0:u.create();y&&(l.insert(x,y),l.setSelection(ya.create(l.doc,x+1)))}l.scrollIntoView()}return!0}).run()}}},addInputRules(){return[Zze({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),Nbt=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,Sbt=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,Cbt=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,Mbt=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,Tbt=Xg.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:e=>e.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:e=>e.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:e}){return["em",Wl(this.options.HTMLAttributes,e),0]},addCommands(){return{setItalic:()=>({commands:e})=>e.setMark(this.name),toggleItalic:()=>({commands:e})=>e.toggleMark(this.name),unsetItalic:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[BC({find:Nbt,type:this.type}),BC({find:Cbt,type:this.type})]},addPasteRules(){return[pk({find:Sbt,type:this.type}),pk({find:Mbt,type:this.type})]}}),Abt=Cu.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:e}){return["li",Wl(this.options.HTMLAttributes,e),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)}}}),Ebt="listItem",cSe="textStyle",dSe=/^(\d+)\.\s$/,Ibt=Cu.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:e=>e.hasAttribute("start")?parseInt(e.getAttribute("start")||"",10):1},type:{default:null,parseHTML:e=>e.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:e}){const{start:t,...n}=e;return t===1?["ol",Wl(this.options.HTMLAttributes,n),0]:["ol",Wl(this.options.HTMLAttributes,e),0]},addCommands(){return{toggleOrderedList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(Ebt,this.editor.getAttributes(cSe)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let e=HE({find:dSe,type:this.type,getAttributes:t=>({start:+t[1]}),joinPredicate:(t,n)=>n.childCount+n.attrs.start===+t[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(e=HE({find:dSe,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:t=>({start:+t[1],...this.editor.getAttributes(cSe)}),joinPredicate:(t,n)=>n.childCount+n.attrs.start===+t[1],editor:this.editor})),[e]}}),Pbt=Cu.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:e}){return["p",Wl(this.options.HTMLAttributes,e),0]},addCommands(){return{setParagraph:()=>({commands:e})=>e.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),Lbt=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,Obt=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,Dbt=Xg.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:e=>e.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:e}){return["s",Wl(this.options.HTMLAttributes,e),0]},addCommands(){return{setStrike:()=>({commands:e})=>e.setMark(this.name),toggleStrike:()=>({commands:e})=>e.toggleMark(this.name),unsetStrike:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[BC({find:Lbt,type:this.type})]},addPasteRules(){return[pk({find:Obt,type:this.type})]}}),Rbt=Cu.create({name:"text",group:"inline"}),a7e=ou.create({name:"starterKit",addExtensions(){const e=[];return this.options.bold!==!1&&e.push(H_t.configure(this.options.bold)),this.options.blockquote!==!1&&e.push(B_t.configure(this.options.blockquote)),this.options.bulletList!==!1&&e.push(G_t.configure(this.options.bulletList)),this.options.code!==!1&&e.push(Y_t.configure(this.options.code)),this.options.codeBlock!==!1&&e.push(J_t.configure(this.options.codeBlock)),this.options.document!==!1&&e.push(ebt.configure(this.options.document)),this.options.dropcursor!==!1&&e.push(nbt.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&e.push(ubt.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&e.push(hbt.configure(this.options.hardBreak)),this.options.heading!==!1&&e.push(fbt.configure(this.options.heading)),this.options.history!==!1&&e.push(jbt.configure(this.options.history)),this.options.horizontalRule!==!1&&e.push(kbt.configure(this.options.horizontalRule)),this.options.italic!==!1&&e.push(Tbt.configure(this.options.italic)),this.options.listItem!==!1&&e.push(Abt.configure(this.options.listItem)),this.options.orderedList!==!1&&e.push(Ibt.configure(this.options.orderedList)),this.options.paragraph!==!1&&e.push(Pbt.configure(this.options.paragraph)),this.options.strike!==!1&&e.push(Dbt.configure(this.options.strike)),this.options.text!==!1&&e.push(Rbt.configure(this.options.text)),e}}),Fbt="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",zbt="ελ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",Qfe="numeric",Jfe="ascii",epe="alpha",UA="asciinumeric",FT="alphanumeric",tpe="domain",i7e="emoji",Bbt="scheme",$bt="slashscheme",gde="whitespace";function Ubt(e,t){return e in t||(t[e]=[]),t[e]}function cj(e,t,n){t[Qfe]&&(t[UA]=!0,t[FT]=!0),t[Jfe]&&(t[UA]=!0,t[epe]=!0),t[UA]&&(t[FT]=!0),t[epe]&&(t[FT]=!0),t[FT]&&(t[tpe]=!0),t[i7e]&&(t[tpe]=!0);for(const s in t){const a=Ubt(s,n);a.indexOf(e)<0&&a.push(e)}}function qbt(e,t){const n={};for(const s in t)t[s].indexOf(e)>=0&&(n[s]=!0);return n}function wh(e=null){this.j={},this.jr=[],this.jd=null,this.t=e}wh.groups={};wh.prototype={accepts(){return!!this.t},go(e){const t=this,n=t.j[e];if(n)return n;for(let s=0;se.ta(t,n,s,a),Kl=(e,t,n,s,a)=>e.tr(t,n,s,a),uSe=(e,t,n,s,a)=>e.ts(t,n,s,a),Tn=(e,t,n,s,a)=>e.tt(t,n,s,a),Fx="WORD",rpe="UWORD",o7e="ASCIINUMERICAL",l7e="ALPHANUMERICAL",WE="LOCALHOST",npe="TLD",spe="UTLD",Zee="SCHEME",q4="SLASH_SCHEME",p0e="NUM",ape="WS",m0e="NL",qA="OPENBRACE",VA="CLOSEBRACE",yre="OPENBRACKET",vre="CLOSEBRACKET",_re="OPENPAREN",bre="CLOSEPAREN",wre="OPENANGLEBRACKET",jre="CLOSEANGLEBRACKET",kre="FULLWIDTHLEFTPAREN",Nre="FULLWIDTHRIGHTPAREN",Sre="LEFTCORNERBRACKET",Cre="RIGHTCORNERBRACKET",Mre="LEFTWHITECORNERBRACKET",Tre="RIGHTWHITECORNERBRACKET",Are="FULLWIDTHLESSTHAN",Ere="FULLWIDTHGREATERTHAN",Ire="AMPERSAND",Pre="APOSTROPHE",Lre="ASTERISK",J0="AT",Ore="BACKSLASH",Dre="BACKTICK",Rre="CARET",l1="COLON",g0e="COMMA",Fre="DOLLAR",xg="DOT",zre="EQUALS",x0e="EXCLAMATION",Kf="HYPHEN",HA="PERCENT",Bre="PIPE",$re="PLUS",Ure="POUND",WA="QUERY",y0e="QUOTE",c7e="FULLWIDTHMIDDLEDOT",v0e="SEMI",yg="SLASH",GA="TILDE",qre="UNDERSCORE",d7e="EMOJI",Vre="SYM";var u7e=Object.freeze({__proto__:null,ALPHANUMERICAL:l7e,AMPERSAND:Ire,APOSTROPHE:Pre,ASCIINUMERICAL:o7e,ASTERISK:Lre,AT:J0,BACKSLASH:Ore,BACKTICK:Dre,CARET:Rre,CLOSEANGLEBRACKET:jre,CLOSEBRACE:VA,CLOSEBRACKET:vre,CLOSEPAREN:bre,COLON:l1,COMMA:g0e,DOLLAR:Fre,DOT:xg,EMOJI:d7e,EQUALS:zre,EXCLAMATION:x0e,FULLWIDTHGREATERTHAN:Ere,FULLWIDTHLEFTPAREN:kre,FULLWIDTHLESSTHAN:Are,FULLWIDTHMIDDLEDOT:c7e,FULLWIDTHRIGHTPAREN:Nre,HYPHEN:Kf,LEFTCORNERBRACKET:Sre,LEFTWHITECORNERBRACKET:Mre,LOCALHOST:WE,NL:m0e,NUM:p0e,OPENANGLEBRACKET:wre,OPENBRACE:qA,OPENBRACKET:yre,OPENPAREN:_re,PERCENT:HA,PIPE:Bre,PLUS:$re,POUND:Ure,QUERY:WA,QUOTE:y0e,RIGHTCORNERBRACKET:Cre,RIGHTWHITECORNERBRACKET:Tre,SCHEME:Zee,SEMI:v0e,SLASH:yg,SLASH_SCHEME:q4,SYM:Vre,TILDE:GA,TLD:npe,UNDERSCORE:qre,UTLD:spe,UWORD:rpe,WORD:Fx,WS:ape});const Px=/[a-z]/,hT=new RegExp("\\p{L}","u"),xde=new RegExp("\\p{Emoji}","u"),Lx=/\d/,yde=/\s/,hSe="\r",vde=` `,Vbt="️",Hbt="‍",_de="";let fO=null,pO=null;function Wbt(e=[]){const t={};wh.groups=t;const n=new wh;fO==null&&(fO=fSe(Fbt)),pO==null&&(pO=fSe(zbt)),Tn(n,"'",Pre),Tn(n,"{",qA),Tn(n,"}",VA),Tn(n,"[",yre),Tn(n,"]",vre),Tn(n,"(",_re),Tn(n,")",bre),Tn(n,"<",wre),Tn(n,">",jre),Tn(n,"(",kre),Tn(n,")",Nre),Tn(n,"「",Sre),Tn(n,"」",Cre),Tn(n,"『",Mre),Tn(n,"』",Tre),Tn(n,"<",Are),Tn(n,">",Ere),Tn(n,"&",Ire),Tn(n,"*",Lre),Tn(n,"@",J0),Tn(n,"`",Dre),Tn(n,"^",Rre),Tn(n,":",l1),Tn(n,",",g0e),Tn(n,"$",Fre),Tn(n,".",xg),Tn(n,"=",zre),Tn(n,"!",x0e),Tn(n,"-",Kf),Tn(n,"%",HA),Tn(n,"|",Bre),Tn(n,"+",$re),Tn(n,"#",Ure),Tn(n,"?",WA),Tn(n,'"',y0e),Tn(n,"/",yg),Tn(n,";",v0e),Tn(n,"~",GA),Tn(n,"_",qre),Tn(n,"\\",Ore),Tn(n,"・",c7e);const s=Kl(n,Lx,p0e,{[Qfe]:!0});Kl(s,Lx,s);const a=Kl(s,Px,o7e,{[UA]:!0}),o=Kl(s,hT,l7e,{[FT]:!0}),l=Kl(n,Px,Fx,{[Jfe]:!0});Kl(l,Lx,a),Kl(l,Px,l),Kl(a,Lx,a),Kl(a,Px,a);const i=Kl(n,hT,rpe,{[epe]:!0});Kl(i,Px),Kl(i,Lx,o),Kl(i,hT,i),Kl(o,Lx,o),Kl(o,Px),Kl(o,hT,o);const u=Tn(n,vde,m0e,{[gde]:!0}),p=Tn(n,hSe,ape,{[gde]:!0}),x=Kl(n,yde,ape,{[gde]:!0});Tn(n,_de,x),Tn(p,vde,u),Tn(p,_de,x),Kl(p,yde,x),Tn(x,hSe),Tn(x,vde),Kl(x,yde,x),Tn(x,_de,x);const y=Kl(n,xde,d7e,{[i7e]:!0});Tn(y,"#"),Kl(y,xde,y),Tn(y,Vbt,y);const _=Tn(y,Hbt);Tn(_,"#"),Kl(_,xde,y);const b=[[Px,l],[Lx,a]],S=[[Px,null],[hT,i],[Lx,o]];for(let k=0;kk[0]>M[0]?1:-1);for(let k=0;k=0?T[tpe]=!0:Px.test(M)?Lx.test(M)?T[UA]=!0:T[Jfe]=!0:T[Qfe]=!0,uSe(n,M,M,T)}return uSe(n,"localhost",WE,{ascii:!0}),n.jd=new wh(Vre),{start:n,tokens:Object.assign({groups:t},u7e)}}function h7e(e,t){const n=Gbt(t.replace(/[A-Z]/g,i=>i.toLowerCase())),s=n.length,a=[];let o=0,l=0;for(;l=0&&(y+=n[l].length,_++),p+=n[l].length,o+=n[l].length,l++;o-=y,l-=_,p-=y,a.push({t:x.t,v:t.slice(o-p,o),s:o-p,e:o})}return a}function Gbt(e){const t=[],n=e.length;let s=0;for(;s56319||s+1===n||(o=e.charCodeAt(s+1))<56320||o>57343?e[s]:e.slice(s,s+2);t.push(l),s+=l.length}return t}function F0(e,t,n,s,a){let o;const l=t.length;for(let i=0;i=0;)o++;if(o>0){t.push(n.join(""));for(let l=parseInt(e.substring(s,s+o),10);l>0;l--)n.pop();s+=o}else n.push(e[s]),s++}return t}const GE={defaultProtocol:"http",events:null,format:pSe,formatHref:pSe,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function _0e(e,t=null){let n=Object.assign({},GE);e&&(n=Object.assign(n,e instanceof _0e?e.o:e));const s=n.ignoreTags,a=[];for(let o=0;on?s.substring(0,n)+"…":s},toFormattedHref(e){return e.get("formatHref",this.toHref(e.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(e=GE.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(e),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(e){return{type:this.t,value:this.toFormattedString(e),isLink:this.isLink,href:this.toFormattedHref(e),start:this.startIndex(),end:this.endIndex()}},validate(e){return e.get("validate",this.toString(),this)},render(e){const t=this,n=this.toHref(e.get("defaultProtocol")),s=e.get("formatHref",n,this),a=e.get("tagName",n,t),o=this.toFormattedString(e),l={},i=e.get("className",n,t),u=e.get("target",n,t),p=e.get("rel",n,t),x=e.getObj("attributes",n,t),y=e.getObj("events",n,t);return l.href=s,i&&(l.class=i),u&&(l.target=u),p&&(l.rel=p),x&&Object.assign(l,x),{tagName:a,attributes:l,content:o,eventListeners:y}}};function Cae(e,t){class n extends f7e{constructor(a,o){super(a,o),this.t=e}}for(const s in t)n.prototype[s]=t[s];return n.t=e,n}const mSe=Cae("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),gSe=Cae("text"),Kbt=Cae("nl"),mO=Cae("url",{isLink:!0,toHref(e=GE.defaultProtocol){return this.hasProtocol()?this.v:`${e}://${this.v}`},hasProtocol(){const e=this.tk;return e.length>=2&&e[0].t!==WE&&e[1].t===l1}}),Vf=e=>new wh(e);function Zbt({groups:e}){const t=e.domain.concat([Ire,Lre,J0,Ore,Dre,Rre,Fre,zre,Kf,p0e,HA,Bre,$re,Ure,yg,Vre,GA,qre]),n=[Pre,l1,g0e,xg,x0e,HA,WA,y0e,v0e,wre,jre,qA,VA,vre,yre,_re,bre,kre,Nre,Sre,Cre,Mre,Tre,Are,Ere],s=[Ire,Pre,Lre,Ore,Dre,Rre,Fre,zre,Kf,qA,VA,HA,Bre,$re,Ure,WA,yg,Vre,GA,qre],a=Vf(),o=Tn(a,GA);mi(o,s,o),mi(o,e.domain,o);const l=Vf(),i=Vf(),u=Vf();mi(a,e.domain,l),mi(a,e.scheme,i),mi(a,e.slashscheme,u),mi(l,s,o),mi(l,e.domain,l);const p=Tn(l,J0);Tn(o,J0,p),Tn(i,J0,p),Tn(u,J0,p);const x=Tn(o,xg);mi(x,s,o),mi(x,e.domain,o);const y=Vf();mi(p,e.domain,y),mi(y,e.domain,y);const _=Tn(y,xg);mi(_,e.domain,y);const b=Vf(mSe);mi(_,e.tld,b),mi(_,e.utld,b),Tn(p,WE,b);const S=Tn(y,Kf);Tn(S,Kf,S),mi(S,e.domain,y),mi(b,e.domain,y),Tn(b,xg,_),Tn(b,Kf,S);const k=Tn(b,l1);mi(k,e.numeric,mSe);const M=Tn(l,Kf),P=Tn(l,xg);Tn(M,Kf,M),mi(M,e.domain,l),mi(P,s,o),mi(P,e.domain,l);const T=Vf(mO);mi(P,e.tld,T),mi(P,e.utld,T),mi(T,e.domain,l),mi(T,s,o),Tn(T,xg,P),Tn(T,Kf,M),Tn(T,J0,p);const I=Tn(T,l1),z=Vf(mO);mi(I,e.numeric,z);const D=Vf(mO),U=Vf();mi(D,t,D),mi(D,n,U),mi(U,t,D),mi(U,n,U),Tn(T,yg,D),Tn(z,yg,D);const V=Tn(i,l1),W=Tn(u,l1),G=Tn(W,yg),J=Tn(G,yg);mi(i,e.domain,l),Tn(i,xg,P),Tn(i,Kf,M),mi(u,e.domain,l),Tn(u,xg,P),Tn(u,Kf,M),mi(V,e.domain,D),Tn(V,yg,D),Tn(V,WA,D),mi(J,e.domain,D),mi(J,t,D),Tn(J,yg,D);const ne=[[qA,VA],[yre,vre],[_re,bre],[wre,jre],[kre,Nre],[Sre,Cre],[Mre,Tre],[Are,Ere]];for(let oe=0;oe=0&&_++,a++,x++;if(_<0)a-=x,a0&&(o.push(bde(gSe,t,l)),l=[]),a-=_,x-=_;const b=y.t,S=n.slice(a-x,a);o.push(bde(b,t,S))}}return l.length>0&&o.push(bde(gSe,t,l)),o}function bde(e,t,n){const s=n[0].s,a=n[n.length-1].e,o=t.slice(s,a);return new e(o,n)}const Xbt=typeof console<"u"&&console&&console.warn||(()=>{}),Qbt="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",gl={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function Jbt(){return wh.groups={},gl.scanner=null,gl.parser=null,gl.tokenQueue=[],gl.pluginQueue=[],gl.customSchemes=[],gl.initialized=!1,gl}function xSe(e,t=!1){if(gl.initialized&&Xbt(`linkifyjs: already initialized - will not register custom scheme "${e}" ${Qbt}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(e))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`);gl.customSchemes.push([e,t])}function e2t(){gl.scanner=Wbt(gl.customSchemes);for(let e=0;e{const a=t.some(p=>p.docChanged)&&!n.doc.eq(s.doc),o=t.some(p=>p.getMeta("preventAutolink"));if(!a||o)return;const{tr:l}=s,i=Ivt(n.doc,[...t]);if(zvt(i).forEach(({newRange:p})=>{const x=Lvt(s.doc,p,b=>b.isTextblock);let y,_;if(x.length>1)y=x[0],_=s.doc.textBetween(y.pos,y.pos+y.node.nodeSize,void 0," ");else if(x.length){const b=s.doc.textBetween(p.from,p.to," "," ");if(!r2t.test(b))return;y=x[0],_=s.doc.textBetween(y.pos,p.to,void 0," ")}if(y&&_){const b=_.split(t2t).filter(Boolean);if(b.length<=0)return!1;const S=b[b.length-1],k=y.pos+_.lastIndexOf(S);if(!S)return!1;const M=b0e(S).map(P=>P.toObject(e.defaultProtocol));if(!s2t(M))return!1;M.filter(P=>P.isLink).map(P=>({...P,from:k+P.start+1,to:k+P.end+1})).filter(P=>s.schema.marks.code?!s.doc.rangeHasMark(P.from,P.to,s.schema.marks.code):!0).filter(P=>e.validate(P.value)).filter(P=>e.shouldAutoLink(P.value)).forEach(P=>{c0e(P.from,P.to,s.doc).some(T=>T.mark.type===e.type)||l.addMark(P.from,P.to,e.type.create({href:P.href}))})}}),!!l.steps.length)return l}})}function i2t(e){return new gd({key:new Su("handleClickLink"),props:{handleClick:(t,n,s)=>{var a,o;if(s.button!==0||!t.editable)return!1;let l=s.target;const i=[];for(;l.nodeName!=="DIV";)i.push(l),l=l.parentNode;if(!i.find(_=>_.nodeName==="A"))return!1;const u=Kze(t.state,e.type.name),p=s.target,x=(a=p==null?void 0:p.href)!==null&&a!==void 0?a:u.href,y=(o=p==null?void 0:p.target)!==null&&o!==void 0?o:u.target;return p&&x?(window.open(x,y),!0):!1}}})}function o2t(e){return new gd({key:new Su("handlePasteLink"),props:{handlePaste:(t,n,s)=>{const{state:a}=t,{selection:o}=a,{empty:l}=o;if(l)return!1;let i="";s.content.forEach(p=>{i+=p.textContent});const u=p7e(i,{defaultProtocol:e.defaultProtocol}).find(p=>p.isLink&&p.value===i);return!i||!u?!1:e.editor.commands.setMark(e.type,{href:u.href})}}})}function S_(e,t){const n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return t&&t.forEach(s=>{const a=typeof s=="string"?s:s.scheme;a&&n.push(a)}),!e||e.replace(n2t,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}const m7e=Xg.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(e=>{if(typeof e=="string"){xSe(e);return}xSe(e.scheme,e.optionalSlashes)})},onDestroy(){Jbt()},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:(e,t)=>!!S_(e,t.protocols),validate:e=>!!e,shouldAutoLink:e=>!!e}},addAttributes(){return{href:{default:null,parseHTML(e){return e.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:e=>{const t=e.getAttribute("href");return!t||!this.options.isAllowedUri(t,{defaultValidate:n=>!!S_(n,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:e}){return this.options.isAllowedUri(e.href,{defaultValidate:t=>!!S_(t,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",Wl(this.options.HTMLAttributes,e),0]:["a",Wl(this.options.HTMLAttributes,{...e,href:""}),0]},addCommands(){return{setLink:e=>({chain:t})=>{const{href:n}=e;return this.options.isAllowedUri(n,{defaultValidate:s=>!!S_(s,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?t().setMark(this.name,e).setMeta("preventAutolink",!0).run():!1},toggleLink:e=>({chain:t})=>{const{href:n}=e;return this.options.isAllowedUri(n,{defaultValidate:s=>!!S_(s,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?t().toggleMark(this.name,e,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run():!1},unsetLink:()=>({chain:e})=>e().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[pk({find:e=>{const t=[];if(e){const{protocols:n,defaultProtocol:s}=this.options,a=p7e(e).filter(o=>o.isLink&&this.options.isAllowedUri(o.value,{defaultValidate:l=>!!S_(l,n),protocols:n,defaultProtocol:s}));a.length&&a.forEach(o=>t.push({text:o.value,data:{href:o.href},index:o.start}))}return t},type:this.type,getAttributes:e=>{var t;return{href:(t=e.data)===null||t===void 0?void 0:t.href}}})]},addProseMirrorPlugins(){const e=[],{protocols:t,defaultProtocol:n}=this.options;return this.options.autolink&&e.push(a2t({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:s=>this.options.isAllowedUri(s,{defaultValidate:a=>!!S_(a,t),protocols:t,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),this.options.openOnClick===!0&&e.push(i2t({type:this.type})),this.options.linkOnPaste&&e.push(o2t({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),e}}),g7e=ou.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:e=>{const t=e.style.textAlign;return this.options.alignments.includes(t)?t:this.options.defaultAlignment},renderHTML:e=>e.textAlign?{style:`text-align: ${e.textAlign}`}:{}}}}]},addCommands(){return{setTextAlign:e=>({commands:t})=>this.options.alignments.includes(e)?this.options.types.map(n=>t.updateAttributes(n,{textAlign:e})).every(n=>n):!1,unsetTextAlign:()=>({commands:e})=>this.options.types.map(t=>e.resetAttributes(t,"textAlign")).every(t=>t),toggleTextAlign:e=>({editor:t,commands:n})=>this.options.alignments.includes(e)?t.isActive({textAlign:e})?n.unsetTextAlign():n.setTextAlign(e):!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")}}}),l2t=e=>{if(!e.children.length)return;const t=e.querySelectorAll("span");t&&t.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}`)})},x7e=Xg.create({name:"textStyle",priority:101,addOptions(){return{HTMLAttributes:{},mergeNestedSpanStyles:!1}},parseHTML(){return[{tag:"span",getAttrs:e=>e.hasAttribute("style")?(this.options.mergeNestedSpanStyles&&l2t(e),{}):!1}]},renderHTML({HTMLAttributes:e}){return["span",Wl(this.options.HTMLAttributes,e),0]},addCommands(){return{removeEmptyTextStyle:()=>({tr:e})=>{const{selection:t}=e;return e.doc.nodesBetween(t.from,t.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))||e.removeMark(s,s+n.nodeSize,this.type)}),!0}}}}),c2t=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,d2t=Cu.create({name:"image",addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{}}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null}}},parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:e}){return["img",Wl(this.options.HTMLAttributes,e)]},addCommands(){return{setImage:e=>({commands:t})=>t.insertContent({type:this.name,attrs:e})}},addInputRules(){return[Zze({find:c2t,type:this.type,getAttributes:e=>{const[,,t,n,s]=e;return{src:n,alt:t,title:s}}})]}});let ipe,ope;if(typeof WeakMap<"u"){let e=new WeakMap;ipe=t=>e.get(t),ope=(t,n)=>(e.set(t,n),n)}else{const e=[];let n=0;ipe=s=>{for(let a=0;a(n==10&&(n=0),e[n++]=s,e[n++]=a)}var nc=class{constructor(e,t,n,s){this.width=e,this.height=t,this.map=n,this.problems=s}findCell(e){for(let t=0;t=n){(o||(o=[])).push({type:"overlong_rowspan",pos:x,n:P-I});break}const z=a+I*t;for(let D=0;Ds&&(o+=p.attrs.colspan)}}for(let l=0;l1&&(n=!0)}t==-1?t=o:t!=o&&(t=Math.max(t,o))}return t}function f2t(e,t,n){e.problems||(e.problems=[]);const s={};for(let a=0;a0;t--)if(e.node(t).type.spec.tableRole=="row")return e.node(0).resolve(e.before(t+1));return null}function m2t(e){for(let t=e.depth;t>0;t--){const n=e.node(t).type.spec.tableRole;if(n==="cell"||n==="header_cell")return e.node(t)}return null}function Vm(e){const t=e.selection.$head;for(let n=t.depth;n>0;n--)if(t.node(n).type.spec.tableRole=="row")return!0;return!1}function Mae(e){const t=e.selection;if("$anchorCell"in t&&t.$anchorCell)return t.$anchorCell.pos>t.$headCell.pos?t.$anchorCell:t.$headCell;if("node"in t&&t.node&&t.node.type.spec.tableRole=="cell")return t.$anchor;const n=P3(t.$head)||g2t(t.$head);if(n)return n;throw new RangeError(`No cell found around position ${t.head}`)}function g2t(e){for(let t=e.nodeAfter,n=e.pos;t;t=t.firstChild,n++){const s=t.type.spec.tableRole;if(s=="cell"||s=="header_cell")return e.doc.resolve(n)}for(let t=e.nodeBefore,n=e.pos;t;t=t.lastChild,n--){const s=t.type.spec.tableRole;if(s=="cell"||s=="header_cell")return e.doc.resolve(n-t.nodeSize)}}function lpe(e){return e.parent.type.spec.tableRole=="row"&&!!e.nodeAfter}function x2t(e){return e.node(0).resolve(e.pos+e.nodeAfter.nodeSize)}function j0e(e,t){return e.depth==t.depth&&e.pos>=t.start(-1)&&e.pos<=t.end(-1)}function y7e(e,t,n){const s=e.node(-1),a=nc.get(s),o=e.start(-1),l=a.nextCell(e.pos-o,t,n);return l==null?null:e.node(0).resolve(o+l)}function mk(e,t,n=1){const s={...e,colspan:e.colspan-n};return s.colwidth&&(s.colwidth=s.colwidth.slice(),s.colwidth.splice(t,n),s.colwidth.some(a=>a>0)||(s.colwidth=null)),s}function v7e(e,t,n=1){const s={...e,colspan:e.colspan+n};if(s.colwidth){s.colwidth=s.colwidth.slice();for(let a=0;ax!=n.pos-o);u.unshift(n.pos-o);const p=u.map(x=>{const y=s.nodeAt(x);if(!y)throw new RangeError(`No cell with offset ${x} found`);const _=o+x+1;return new $Fe(i.resolve(_),i.resolve(_+y.content.size))});super(p[0].$from,p[0].$to,p),this.$anchorCell=t,this.$headCell=n}map(t,n){const s=t.resolve(n.map(this.$anchorCell.pos)),a=t.resolve(n.map(this.$headCell.pos));if(lpe(s)&&lpe(a)&&j0e(s,a)){const o=this.$anchorCell.node(-1)!=s.node(-1);return o&&this.isRowSelection()?zx.rowSelection(s,a):o&&this.isColSelection()?zx.colSelection(s,a):new zx(s,a)}return ya.between(s,a)}content(){const t=this.$anchorCell.node(-1),n=nc.get(t),s=this.$anchorCell.start(-1),a=n.rectBetween(this.$anchorCell.pos-s,this.$headCell.pos-s),o={},l=[];for(let u=a.top;u0||M>0){let P=S.attrs;if(k>0&&(P=mk(P,0,k)),M>0&&(P=mk(P,P.colspan-M,M)),b.lefta.bottom){const P={...S.attrs,rowspan:Math.min(b.bottom,a.bottom)-Math.max(b.top,a.top)};b.top0)return!1;const s=t+this.$anchorCell.nodeAfter.attrs.rowspan,a=n+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(s,a)==this.$headCell.node(-1).childCount}static colSelection(t,n=t){const s=t.node(-1),a=nc.get(s),o=t.start(-1),l=a.findCell(t.pos-o),i=a.findCell(n.pos-o),u=t.node(0);return l.top<=i.top?(l.top>0&&(t=u.resolve(o+a.map[l.left])),i.bottom0&&(n=u.resolve(o+a.map[i.left])),l.bottom0)return!1;const l=a+this.$anchorCell.nodeAfter.attrs.colspan,i=o+this.$headCell.nodeAfter.attrs.colspan;return Math.max(l,i)==n.width}eq(t){return t instanceof zx&&t.$anchorCell.pos==this.$anchorCell.pos&&t.$headCell.pos==this.$headCell.pos}static rowSelection(t,n=t){const s=t.node(-1),a=nc.get(s),o=t.start(-1),l=a.findCell(t.pos-o),i=a.findCell(n.pos-o),u=t.node(0);return l.left<=i.left?(l.left>0&&(t=u.resolve(o+a.map[l.top*a.width])),i.right0&&(n=u.resolve(o+a.map[i.top*a.width])),l.right{t.push(Gu.node(s,s+n.nodeSize,{class:"selectedCell"}))}),ec.create(e.doc,t)}function b2t({$from:e,$to:t}){if(e.pos==t.pos||e.pos=0&&!(e.after(a+1)=0&&!(t.before(o+1)>t.start(o));o--,s--);return n==s&&/row|table/.test(e.node(a).type.spec.tableRole)}function w2t({$from:e,$to:t}){let n,s;for(let a=e.depth;a>0;a--){const o=e.node(a);if(o.type.spec.tableRole==="cell"||o.type.spec.tableRole==="header_cell"){n=o;break}}for(let a=t.depth;a>0;a--){const o=t.node(a);if(o.type.spec.tableRole==="cell"||o.type.spec.tableRole==="header_cell"){s=o;break}}return n!==s&&t.parentOffset===0}function j2t(e,t,n){const s=(t||e).selection,a=(t||e).doc;let o,l;if(s instanceof ua&&(l=s.node.type.spec.tableRole)){if(l=="cell"||l=="header_cell")o=ll.create(a,s.from);else if(l=="row"){const i=a.resolve(s.from+1);o=ll.rowSelection(i,i)}else if(!n){const i=nc.get(s.node),u=s.from+1,p=u+i.map[i.width*i.height-1];o=ll.create(a,u+1,p)}}else s instanceof ya&&b2t(s)?o=ya.create(a,s.from):s instanceof ya&&w2t(s)&&(o=ya.create(a,s.$from.start(),s.$from.end()));return o&&(t||(t=e.tr)).setSelection(o),t}const k2t=new Su("fix-tables");function b7e(e,t,n,s){const a=e.childCount,o=t.childCount;e:for(let l=0,i=0;l{a.type.spec.tableRole=="table"&&(n=N2t(e,a,o,n))};return t?t.doc!=e.doc&&b7e(t.doc,e.doc,0,s):e.doc.descendants(s),n}function N2t(e,t,n,s){const a=nc.get(t);if(!a.problems)return s;s||(s=e.tr);const o=[];for(let u=0;u0){let b="cell";x.firstChild&&(b=x.firstChild.type.spec.tableRole);const S=[];for(let M=0;M<_;M++){const P=ku(e.schema)[b].createAndFill();P&&S.push(P)}const k=(u==0||l==u-1)&&i==u?p+1:y-1;s.insert(s.mapping.map(k),S)}p=y}return s.setMeta(k2t,{fixTables:!0})}function sx(e){const t=e.selection,n=Mae(e),s=n.node(-1),a=n.start(-1),o=nc.get(s);return{...t instanceof ll?o.rectBetween(t.$anchorCell.pos-a,t.$headCell.pos-a):o.findCell(n.pos-a),tableStart:a,map:o,table:s}}function j7e(e,{map:t,tableStart:n,table:s},a){let o=a>0?-1:0;y2t(t,s,a+o)&&(o=a==0||a==t.width?null:0);for(let l=0;l0&&a0&&t.map[i-1]==u||a0?-1:0;A2t(t,s,a+i)&&(i=a==0||a==t.height?null:0);for(let p=0,x=t.width*a;p0&&a0&&y==t.map[x-t.width]){const _=n.nodeAt(y).attrs;e.setNodeMarkup(e.mapping.slice(i).map(y+s),null,{..._,rowspan:_.rowspan-1}),p+=_.colspan-1}else if(a0&&n[o]==n[o-1]||s.right0&&n[a]==n[a-e]||s.bottom0){const x=u+1+p.content.size,y=ySe(p)?u+1:x;o.replaceWith(y+s.tableStart,x+s.tableStart,i)}o.setSelection(new ll(o.doc.resolve(u+s.tableStart))),t(o)}return!0}function _Se(e,t){const n=ku(e.schema);return D2t(({node:s})=>n[s.type.spec.tableRole])(e,t)}function D2t(e){return(t,n)=>{const s=t.selection;let a,o;if(s instanceof ll){if(s.$anchorCell.pos!=s.$headCell.pos)return!1;a=s.$anchorCell.nodeAfter,o=s.$anchorCell.pos}else{var l;if(a=m2t(s.$from),!a)return!1;o=(l=P3(s.$from))===null||l===void 0?void 0:l.pos}if(a==null||o==null||a.attrs.colspan==1&&a.attrs.rowspan==1)return!1;if(n){let i=a.attrs;const u=[],p=i.colwidth;i.rowspan>1&&(i={...i,rowspan:1}),i.colspan>1&&(i={...i,colspan:1});const x=sx(t),y=t.tr;for(let b=0;b{l.attrs[e]!==t&&o.setNodeMarkup(i,null,{...l.attrs,[e]:t})}):o.setNodeMarkup(a.pos,null,{...a.nodeAfter.attrs,[e]:t}),s(o)}return!0}}function F2t(e){return function(t,n){if(!Vm(t))return!1;if(n){const s=ku(t.schema),a=sx(t),o=t.tr,l=a.map.cellsInRect(e=="column"?{left:a.left,top:0,right:a.right,bottom:a.map.height}:e=="row"?{left:0,top:a.top,right:a.map.width,bottom:a.bottom}:a),i=l.map(u=>a.table.nodeAt(u));for(let u=0;u{const b=_+o.tableStart,S=l.doc.nodeAt(b);S&&l.setNodeMarkup(b,y,S.attrs)}),s(l)}return!0}}KE("row",{useDeprecatedLogic:!0});KE("column",{useDeprecatedLogic:!0});const z2t=KE("cell",{useDeprecatedLogic:!0});function B2t(e,t){if(t<0){const n=e.nodeBefore;if(n)return e.pos-n.nodeSize;for(let s=e.index(-1)-1,a=e.before();s>=0;s--){const o=e.node(-1).child(s),l=o.lastChild;if(l)return a-1-l.nodeSize;a-=o.nodeSize}}else{if(e.index()0;s--)if(n.node(s).type.spec.tableRole=="table")return t&&t(e.tr.delete(n.before(s),n.after(s)).scrollIntoView()),!0;return!1}function gO(e,t){const n=e.selection;if(!(n instanceof ll))return!1;if(t){const s=e.tr,a=ku(e.schema).cell.createAndFill().content;n.forEachCell((o,l)=>{o.content.eq(a)||s.replace(s.mapping.map(l+1),s.mapping.map(l+o.nodeSize-1),new Kn(a,0,0))}),s.docChanged&&t(s)}return!0}function U2t(e){if(e.size===0)return null;let{content:t,openStart:n,openEnd:s}=e;for(;t.childCount==1&&(n>0&&s>0||t.child(0).type.spec.tableRole=="table");)n--,s--,t=t.child(0).content;const a=t.child(0),o=a.type.spec.tableRole,l=a.type.schema,i=[];if(o=="row")for(let u=0;u=0;l--){const{rowspan:i,colspan:u}=o.child(l).attrs;for(let p=a;p=t.length&&t.push(dn.empty),n[a]s&&(_=_.type.createChecked(mk(_.attrs,_.attrs.colspan,x+_.attrs.colspan-s),_.content)),p.push(_),x+=_.attrs.colspan;for(let b=1;b<_.attrs.rowspan;b++)o[i+b]=(o[i+b]||0)+_.attrs.colspan}l.push(dn.from(p))}n=l,e=s}if(t!=a){const o=[];for(let l=0,i=0;la&&(y=y.type.create({...y.attrs,rowspan:Math.max(1,a-y.attrs.rowspan)},y.content)),u.push(y)}o.push(dn.from(u))}n=o,t=a}return{width:e,height:t,rows:n}}function H2t(e,t,n,s,a,o,l){const i=e.doc.type.schema,u=ku(i);let p,x;if(a>t.width)for(let y=0,_=0;yt.height){const y=[];for(let S=0,k=(t.height-1)*t.width;S=t.width?!1:n.nodeAt(t.map[k+S]).type==u.header_cell;y.push(M?x||(x=u.header_cell.createAndFill()):p||(p=u.cell.createAndFill()))}const _=u.row.create(null,dn.from(y)),b=[];for(let S=t.height;S{if(!a)return!1;const o=n.selection;if(o instanceof ll)return Yee(n,s,La.near(o.$headCell,t));if(e!="horiz"&&!o.empty)return!1;const l=N7e(a,e,t);if(l==null)return!1;if(e=="horiz")return Yee(n,s,La.near(n.doc.resolve(o.head+t),t));{const i=n.doc.resolve(l),u=y7e(i,e,t);let p;return u?p=La.near(u,1):t<0?p=La.near(n.doc.resolve(i.before(-1)),-1):p=La.near(n.doc.resolve(i.after(-1)),1),Yee(n,s,p)}}}function yO(e,t){return(n,s,a)=>{if(!a)return!1;const o=n.selection;let l;if(o instanceof ll)l=o;else{const u=N7e(a,e,t);if(u==null)return!1;l=new ll(n.doc.resolve(u))}const i=y7e(l.$headCell,e,t);return i?Yee(n,s,new ll(l.$anchorCell,i)):!1}}function G2t(e,t){const n=e.state.doc,s=P3(n.resolve(t));return s?(e.dispatch(e.state.tr.setSelection(new ll(s))),!0):!1}function K2t(e,t,n){if(!Vm(e.state))return!1;let s=U2t(n);const a=e.state.selection;if(a instanceof ll){s||(s={width:1,height:1,rows:[dn.from(cpe(ku(e.state.schema).cell,n))]});const o=a.$anchorCell.node(-1),l=a.$anchorCell.start(-1),i=nc.get(o).rectBetween(a.$anchorCell.pos-l,a.$headCell.pos-l);return s=V2t(s,i.right-i.left,i.bottom-i.top),NSe(e.state,e.dispatch,l,i,s),!0}else if(s){const o=Mae(e.state),l=o.start(-1);return NSe(e.state,e.dispatch,l,nc.get(o.node(-1)).findCell(o.pos-l),s),!0}else return!1}function Z2t(e,t){var n;if(t.ctrlKey||t.metaKey)return;const s=SSe(e,t.target);let a;if(t.shiftKey&&e.state.selection instanceof ll)o(e.state.selection.$anchorCell,t),t.preventDefault();else if(t.shiftKey&&s&&(a=P3(e.state.selection.$anchor))!=null&&((n=wde(e,t))===null||n===void 0?void 0:n.pos)!=a.pos)o(a,t),t.preventDefault();else if(!s)return;function o(u,p){let x=wde(e,p);const y=c1.getState(e.state)==null;if(!x||!j0e(u,x))if(y)x=u;else return;const _=new ll(u,x);if(y||!e.state.selection.eq(_)){const b=e.state.tr.setSelection(_);y&&b.setMeta(c1,u.pos),e.dispatch(b)}}function l(){e.root.removeEventListener("mouseup",l),e.root.removeEventListener("dragstart",l),e.root.removeEventListener("mousemove",i),c1.getState(e.state)!=null&&e.dispatch(e.state.tr.setMeta(c1,-1))}function i(u){const p=u,x=c1.getState(e.state);let y;if(x!=null)y=e.state.doc.resolve(x);else if(SSe(e,p.target)!=s&&(y=wde(e,t),!y))return l();y&&o(y,p)}e.root.addEventListener("mouseup",l),e.root.addEventListener("dragstart",l),e.root.addEventListener("mousemove",i)}function N7e(e,t,n){if(!(e.state.selection instanceof ya))return null;const{$head:s}=e.state.selection;for(let a=s.depth-1;a>=0;a--){const o=s.node(a);if((n<0?s.index(a):s.indexAfter(a))!=(n<0?0:o.childCount))return null;if(o.type.spec.tableRole=="cell"||o.type.spec.tableRole=="header_cell"){const l=s.before(a),i=t=="vert"?n>0?"down":"up":n>0?"right":"left";return e.endOfTextblock(i)?l:null}}return null}function SSe(e,t){for(;t&&t!=e.dom;t=t.parentNode)if(t.nodeName=="TD"||t.nodeName=="TH")return t;return null}function wde(e,t){const n=e.posAtCoords({left:t.clientX,top:t.clientY});if(!n)return null;const s=n.inside>=0?n.inside:n.pos;return P3(e.state.doc.resolve(s))}var Y2t=class{constructor(t,n){this.node=t,this.defaultCellMinWidth=n,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.table.style.setProperty("--default-cell-min-width",`${n}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),dpe(t,this.colgroup,this.table,n),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(t){return t.type!=this.node.type?!1:(this.node=t,dpe(t,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(t){return t.type=="attributes"&&(t.target==this.table||this.colgroup.contains(t.target))}};function dpe(e,t,n,s,a,o){let l=0,i=!0,u=t.firstChild;const p=e.firstChild;if(p){for(let y=0,_=0;ynew s(y,n,_)),new Q2t(-1,!1)},apply(l,i){return i.apply(l)}},props:{attributes:l=>{const i=lf.getState(l);return i&&i.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(l,i)=>{J2t(l,i,e,a)},mouseleave:l=>{ewt(l)},mousedown:(l,i)=>{twt(l,i,t,n)}},decorations:l=>{const i=lf.getState(l);if(i&&i.activeHandle>-1)return iwt(l,i.activeHandle)},nodeViews:{}}});return o}var Q2t=class Xee{constructor(t,n){this.activeHandle=t,this.dragging=n}apply(t){const n=this,s=t.getMeta(lf);if(s&&s.setHandle!=null)return new Xee(s.setHandle,!1);if(s&&s.setDragging!==void 0)return new Xee(n.activeHandle,s.setDragging);if(n.activeHandle>-1&&t.docChanged){let a=t.mapping.map(n.activeHandle,-1);return lpe(t.doc.resolve(a))||(a=-1),new Xee(a,n.dragging)}return n}};function J2t(e,t,n,s){if(!e.editable)return;const a=lf.getState(e.state);if(a&&!a.dragging){const o=nwt(t.target);let l=-1;if(o){const{left:i,right:u}=o.getBoundingClientRect();t.clientX-i<=n?l=CSe(e,t,"left",n):u-t.clientX<=n&&(l=CSe(e,t,"right",n))}if(l!=a.activeHandle){if(!s&&l!==-1){const i=e.state.doc.resolve(l),u=i.node(-1),p=nc.get(u),x=i.start(-1);if(p.colCount(i.pos-x)+i.nodeAfter.attrs.colspan-1==p.width-1)return}S7e(e,l)}}}function ewt(e){if(!e.editable)return;const t=lf.getState(e.state);t&&t.activeHandle>-1&&!t.dragging&&S7e(e,-1)}function twt(e,t,n,s){var a;if(!e.editable)return!1;const o=(a=e.dom.ownerDocument.defaultView)!==null&&a!==void 0?a:window,l=lf.getState(e.state);if(!l||l.activeHandle==-1||l.dragging)return!1;const i=e.state.doc.nodeAt(l.activeHandle),u=rwt(e,l.activeHandle,i.attrs);e.dispatch(e.state.tr.setMeta(lf,{setDragging:{startX:t.clientX,startWidth:u}}));function p(y){o.removeEventListener("mouseup",p),o.removeEventListener("mousemove",x);const _=lf.getState(e.state);_!=null&&_.dragging&&(swt(e,_.activeHandle,MSe(_.dragging,y,n)),e.dispatch(e.state.tr.setMeta(lf,{setDragging:null})))}function x(y){if(!y.which)return p(y);const _=lf.getState(e.state);if(_&&_.dragging){const b=MSe(_.dragging,y,n);TSe(e,_.activeHandle,b,s)}}return TSe(e,l.activeHandle,u,s),o.addEventListener("mouseup",p),o.addEventListener("mousemove",x),t.preventDefault(),!0}function rwt(e,t,{colspan:n,colwidth:s}){const a=s&&s[s.length-1];if(a)return a;const o=e.domAtPos(t);let l=o.node.childNodes[o.offset].offsetWidth,i=n;if(s)for(let u=0;u{const s=e.nodes[n];s.spec.tableRole&&(t[s.spec.tableRole]=s)}),e.cached.tableNodeTypes=t,t}function uwt(e,t,n,s,a){const o=dwt(e),l=[],i=[];for(let p=0;p{const{selection:t}=e.state;if(!hwt(t))return!1;let n=0;const s=Gze(t.ranges[0].$from,o=>o.type.name==="table");return s==null||s.node.descendants(o=>{if(o.type.name==="table")return!1;["tableCell","tableHeader"].includes(o.type.name)&&(n+=1)}),n===t.ranges.length?(e.commands.deleteTable(),!0):!1},fwt=Cu.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,renderWrapper:!1,handleWidth:5,cellMinWidth:25,View:lwt,lastColumnResizable:!0,allowTableNodeSelection:!1}},content:"tableRow+",tableRole:"table",isolating:!0,group:"block",parseHTML(){return[{tag:"table"}]},renderHTML({node:e,HTMLAttributes:t}){const{colgroup:n,tableWidth:s,tableMinWidth:a}=cwt(e,this.options.cellMinWidth),o=["table",Wl(this.options.HTMLAttributes,t,{style:s?`width: ${s}`:`min-width: ${a}`}),n,["tbody",0]];return this.options.renderWrapper?["div",{class:"tableWrapper"},o]:o},addCommands(){return{insertTable:({rows:e=3,cols:t=3,withHeaderRow:n=!0}={})=>({tr:s,dispatch:a,editor:o})=>{const l=uwt(o.schema,e,t,n);if(a){const i=s.selection.from+1;s.replaceSelectionWith(l).scrollIntoView().setSelection(ya.near(s.doc.resolve(i)))}return!0},addColumnBefore:()=>({state:e,dispatch:t})=>S2t(e,t),addColumnAfter:()=>({state:e,dispatch:t})=>C2t(e,t),deleteColumn:()=>({state:e,dispatch:t})=>T2t(e,t),addRowBefore:()=>({state:e,dispatch:t})=>E2t(e,t),addRowAfter:()=>({state:e,dispatch:t})=>I2t(e,t),deleteRow:()=>({state:e,dispatch:t})=>L2t(e,t),deleteTable:()=>({state:e,dispatch:t})=>$2t(e,t),mergeCells:()=>({state:e,dispatch:t})=>vSe(e,t),splitCell:()=>({state:e,dispatch:t})=>_Se(e,t),toggleHeaderColumn:()=>({state:e,dispatch:t})=>KE("column")(e,t),toggleHeaderRow:()=>({state:e,dispatch:t})=>KE("row")(e,t),toggleHeaderCell:()=>({state:e,dispatch:t})=>z2t(e,t),mergeOrSplit:()=>({state:e,dispatch:t})=>vSe(e,t)?!0:_Se(e,t),setCellAttribute:(e,t)=>({state:n,dispatch:s})=>R2t(e,t)(n,s),goToNextCell:()=>({state:e,dispatch:t})=>wSe(1)(e,t),goToPreviousCell:()=>({state:e,dispatch:t})=>wSe(-1)(e,t),fixTables:()=>({state:e,dispatch:t})=>(t&&w7e(e),!0),setCellSelection:e=>({tr:t,dispatch:n})=>{if(n){const s=ll.create(t.doc,e.anchorCell,e.headCell);t.setSelection(s)}return!0}}},addKeyboardShortcuts(){return{Tab:()=>this.editor.commands.goToNextCell()?!0:this.editor.can().addRowAfter()?this.editor.chain().addRowAfter().goToNextCell().run():!1,"Shift-Tab":()=>this.editor.commands.goToPreviousCell(),Backspace:vO,"Mod-Backspace":vO,Delete:vO,"Mod-Delete":vO}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[X2t({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],owt({allowTableNodeSelection:this.options.allowTableNodeSelection})]},extendNodeSchema(e){const t={name:e.name,options:e.options,storage:e.storage};return{tableRole:gi(Cs(e,"tableRole",t))}}}),pwt=Cu.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:e}){return["tr",Wl(this.options.HTMLAttributes,e),0]}}),mwt=Cu.create({name:"tableCell",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:e=>{const t=e.getAttribute("colwidth");return t?t.split(",").map(s=>parseInt(s,10)):null}}}},tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td"}]},renderHTML({HTMLAttributes:e}){return["td",Wl(this.options.HTMLAttributes,e),0]}}),gwt=Cu.create({name:"tableHeader",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:e=>{const t=e.getAttribute("colwidth");return t?t.split(",").map(s=>parseInt(s,10)):null}}}},tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th"}]},renderHTML({HTMLAttributes:e}){return["th",Wl(this.options.HTMLAttributes,e),0]}});function ax({content:e,onChange:t,placeholder:n="Enter content...",minHeight:s="150px",compact:a=!1}){const[o,l]=E.useState(!1),[i,u]=E.useState(""),[p,x]=E.useState(!0),y=Jze({extensions:[a7e,m7e.configure({openOnClick:!1,HTMLAttributes:{class:"text-primary underline"}}),g7e.configure({types:["heading","paragraph"]}),x7e,d2t.extend({addAttributes(){var k;return{...(k=this.parent)==null?void 0:k.call(this),width:{default:null},height:{default:null},style:{default:null}}}}).configure({inline:!0,allowBase64:!0}),fwt.extend({addAttributes(){var k;return{...(k=this.parent)==null?void 0:k.call(this),style:{default:null},width:{default:null},cellpadding:{default:null},cellspacing:{default:null},border:{default:null}}}}).configure({resizable:!1}),pwt.extend({addAttributes(){var k;return{...(k=this.parent)==null?void 0:k.call(this),style:{default:null}}}}),mwt.extend({addAttributes(){var k;return{...(k=this.parent)==null?void 0:k.call(this),style:{default:null},width:{default:null},colspan:{default:1},rowspan:{default:1},valign:{default:null}}}}),gwt.extend({addAttributes(){var k;return{...(k=this.parent)==null?void 0:k.call(this),style:{default:null},width:{default:null},colspan:{default:1},rowspan:{default:1}}}})],content:e,onUpdate:({editor:k})=>{t(k.getHTML())},editorProps:{attributes:{class:"outline-none","data-placeholder":n},handlePaste:(k,M)=>{var T;const P=(T=M.clipboardData)==null?void 0:T.items;if(!P)return!1;for(const I of Array.from(P))if(I.type.startsWith("image/")){M.preventDefault();const z=I.getAsFile();if(!z)continue;const D=new FileReader;return D.onload=U=>{var W;const V=(W=U.target)==null?void 0:W.result;k.dispatch(k.state.tr.replaceSelectionWith(k.state.schema.nodes.image.create({src:V})))},D.readAsDataURL(z),!0}return!1}}});E.useEffect(()=>{y&&e!==y.getHTML()&&y.commands.setContent(e)},[e,y]);const _=()=>{if(!y)return;const k=y.getAttributes("link").href||"",M=y.getAttributes("link").target;u(k),x(M==="_blank"),l(!0)},b=()=>{y&&(i===""?y.chain().focus().extendMarkRange("link").unsetLink().run():y.chain().focus().extendMarkRange("link").setLink({href:i,target:p?"_blank":null,rel:p?"noopener noreferrer nofollow":null}).run(),l(!1),u(""))},S=()=>{y&&y.chain().focus().extendMarkRange("link").unsetLink().run()};return y?r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"border rounded-lg overflow-hidden",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-0.5 p-2 border-b bg-muted/30",children:[r.jsx(ee,{type:"button",variant:"ghost",size:"sm",onClick:()=>y.chain().focus().toggleHeading({level:1}).run(),className:y.isActive("heading",{level:1})?"bg-muted":"",title:"Heading 1",children:r.jsx(aA,{className:"h-4 w-4"})}),r.jsx(ee,{type:"button",variant:"ghost",size:"sm",onClick:()=>y.chain().focus().toggleHeading({level:2}).run(),className:y.isActive("heading",{level:2})?"bg-muted":"",title:"Heading 2",children:r.jsx(iA,{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.chain().focus().toggleBold().run(),className:y.isActive("bold")?"bg-muted":"",title:"Bold",children:r.jsx(vS,{className:"h-4 w-4"})}),r.jsx(ee,{type:"button",variant:"ghost",size:"sm",onClick:()=>y.chain().focus().toggleItalic().run(),className:y.isActive("italic")?"bg-muted":"",title:"Italic",children:r.jsx(NS,{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.chain().focus().toggleBulletList().run(),className:y.isActive("bulletList")?"bg-muted":"",title:"Bullet List",children:r.jsx(up,{className:"h-4 w-4"})}),r.jsx(ee,{type:"button",variant:"ghost",size:"sm",onClick:()=>y.chain().focus().toggleOrderedList().run(),className:y.isActive("orderedList")?"bg-muted":"",title:"Numbered List",children:r.jsx(MS,{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.chain().focus().setTextAlign("left").run(),className:y.isActive({textAlign:"left"})?"bg-muted":"",title:"Align Left",children:r.jsx(xS,{className:"h-4 w-4"})}),r.jsx(ee,{type:"button",variant:"ghost",size:"sm",onClick:()=>y.chain().focus().setTextAlign("center").run(),className:y.isActive({textAlign:"center"})?"bg-muted":"",title:"Align Center",children:r.jsx(gS,{className:"h-4 w-4"})}),r.jsx(ee,{type:"button",variant:"ghost",size:"sm",onClick:()=>y.chain().focus().setTextAlign("right").run(),className:y.isActive({textAlign:"right"})?"bg-muted":"",title:"Align Right",children:r.jsx(yS,{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:_,className:y.isActive("link")?"bg-muted":"",title:"Add Link",children:r.jsx(Io,{className:"h-4 w-4"})}),y.isActive("link")&&r.jsx(ee,{type:"button",variant:"ghost",size:"sm",onClick:S,title:"Remove Link",children:r.jsx(Io,{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.chain().focus().undo().run(),disabled:!y.can().undo(),title:"Undo",children:r.jsx(DS,{className:"h-4 w-4"})}),r.jsx(ee,{type:"button",variant:"ghost",size:"sm",onClick:()=>y.chain().focus().redo().run(),disabled:!y.can().redo(),title:"Redo",children:r.jsx(PS,{className:"h-4 w-4"})})]}),r.jsx(Xze,{editor:y,className:"prose prose-sm max-w-none p-3 focus:outline-none [&_.ProseMirror]:outline-none [&_.ProseMirror_img]:max-w-none [&_.ProseMirror_table]:border-none [&_.ProseMirror_table]:border-collapse [&_.ProseMirror_td]:border-none [&_.ProseMirror_td]:p-0 [&_.ProseMirror_td]:align-top [&_.ProseMirror_th]:border-none [&_.ProseMirror_th]:p-0 [&_.ProseMirror_tr]:border-none",style:{minHeight:s}})]}),r.jsx(Or,{open:o,onOpenChange:l,children:r.jsxs(Ir,{className:"sm:max-w-md",children:[r.jsx($r,{children:r.jsx(Fr,{children:"Insert Link"})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{htmlFor:"link-url",children:"URL"}),r.jsx(dt,{id:"link-url",value:i,onChange:k=>u(k.target.value),placeholder:"https://example.com"})]}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(Ts,{id:"link-new-tab",checked:p,onCheckedChange:x}),r.jsx($e,{htmlFor:"link-new-tab",children:"Open in new tab"})]})]}),r.jsxs(Bs,{children:[r.jsx(ee,{type:"button",variant:"outline",onClick:()=>l(!1),children:"Cancel"}),r.jsx(ee,{type:"button",onClick:b,children:i?"Apply Link":"Remove Link"})]})]})})]}):null}var xwt=Object.defineProperty,ywt=(e,t,n)=>t in e?xwt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,kl=(e,t,n)=>ywt(e,typeof t!="symbol"?t+"":t,n);const Hre={x:0,y:0,width:0,height:0,unit:"px"},A4=(e,t,n)=>Math.min(Math.max(e,t),n),vwt=(...e)=>e.filter(t=>t&&typeof t=="string").join(" "),ISe=(e,t)=>e===t||e.width===t.width&&e.height===t.height&&e.x===t.x&&e.y===t.y&&e.unit===t.unit;function _wt(e,t,n,s){const a=vg(e,n,s);return e.width&&(a.height=a.width/t),e.height&&(a.width=a.height*t),a.y+a.height>s&&(a.height=s-a.y,a.width=a.height*t),a.x+a.width>n&&(a.width=n-a.x,a.height=a.width/t),e.unit==="%"?e1(a,n,s):a}function bwt(e,t,n){const s=vg(e,t,n);return s.x=(t-s.width)/2,s.y=(n-s.height)/2,e.unit==="%"?e1(s,t,n):s}function e1(e,t,n){return e.unit==="%"?{...Hre,...e,unit:"%"}:{unit:"%",x:e.x?e.x/t*100:0,y:e.y?e.y/n*100:0,width:e.width?e.width/t*100:0,height:e.height?e.height/n*100:0}}function vg(e,t,n){return e.unit?e.unit==="px"?{...Hre,...e,unit:"px"}:{unit:"px",x:e.x?e.x*t/100:0,y:e.y?e.y*n/100:0,width:e.width?e.width*t/100:0,height:e.height?e.height*n/100:0}:{...Hre,...e,unit:"px"}}function PSe(e,t,n,s,a,o=0,l=0,i=s,u=a){const p={...e};let x=Math.min(o,s),y=Math.min(l,a),_=Math.min(i,s),b=Math.min(u,a);t&&(t>1?(x=l?l*t:x,y=x/t,_=i*t):(y=o?o/t:y,x=y*t,b=u/t)),p.y<0&&(p.height=Math.max(p.height+p.y,y),p.y=0),p.x<0&&(p.width=Math.max(p.width+p.x,x),p.x=0);const S=s-(p.x+p.width);S<0&&(p.x=Math.min(p.x,s-x),p.width+=S);const k=a-(p.y+p.height);if(k<0&&(p.y=Math.min(p.y,a-y),p.height+=k),p.width_&&((n==="sw"||n=="nw")&&(p.x-=_-p.width),p.width=_),p.height>b&&((n==="nw"||n=="ne")&&(p.y-=b-p.height),p.height=b),t){const M=p.width/p.height;if(Mt){const P=Math.max(p.height*t,x);(n==="sw"||n=="nw")&&(p.x-=P-p.width),p.width=P}}return p}function wwt(e,t,n,s){const a={...e};return t==="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):t==="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)),t==="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):t==="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 E4={capture:!0,passive:!1};let jwt=0;const U0=class nm extends E.PureComponent{constructor(){super(...arguments),kl(this,"docMoveBound",!1),kl(this,"mouseDownOnCrop",!1),kl(this,"dragStarted",!1),kl(this,"evData",{startClientX:0,startClientY:0,startCropX:0,startCropY:0,clientX:0,clientY:0,isResize:!0}),kl(this,"componentRef",E.createRef()),kl(this,"mediaRef",E.createRef()),kl(this,"resizeObserver"),kl(this,"initChangeCalled",!1),kl(this,"instanceId",`rc-${jwt++}`),kl(this,"state",{cropIsActive:!1,newCropIsBeingDrawn:!1}),kl(this,"onCropPointerDown",t=>{const{crop:n,disabled:s}=this.props,a=this.getBox();if(!n)return;const o=vg(n,a.width,a.height);if(s)return;t.cancelable&&t.preventDefault(),this.bindDocMove(),this.componentRef.current.focus({preventScroll:!0});const l=t.target.dataset.ord,i=!!l;let u=t.clientX,p=t.clientY,x=o.x,y=o.y;if(l){const _=t.clientX-a.x,b=t.clientY-a.y;let S=0,k=0;l==="ne"||l=="e"?(S=_-(o.x+o.width),k=b-o.y,x=o.x,y=o.y+o.height):l==="se"||l==="s"?(S=_-(o.x+o.width),k=b-(o.y+o.height),x=o.x,y=o.y):l==="sw"||l=="w"?(S=_-o.x,k=b-(o.y+o.height),x=o.x+o.width,y=o.y):(l==="nw"||l=="n")&&(S=_-o.x,k=b-o.y,x=o.x+o.width,y=o.y+o.height),u=x+a.x+S,p=y+a.y+k}this.evData={startClientX:u,startClientY:p,startCropX:x,startCropY:y,clientX:t.clientX,clientY:t.clientY,isResize:i,ord:l},this.mouseDownOnCrop=!0,this.setState({cropIsActive:!0})}),kl(this,"onComponentPointerDown",t=>{const{crop:n,disabled:s,locked:a,keepSelection:o,onChange:l}=this.props,i=this.getBox();if(s||a||o&&n)return;t.cancelable&&t.preventDefault(),this.bindDocMove(),this.componentRef.current.focus({preventScroll:!0});const u=t.clientX-i.x,p=t.clientY-i.y,x={unit:"px",x:u,y:p,width:0,height:0};this.evData={startClientX:t.clientX,startClientY:t.clientY,startCropX:u,startCropY:p,clientX:t.clientX,clientY:t.clientY,isResize:!0},this.mouseDownOnCrop=!0,l(vg(x,i.width,i.height),e1(x,i.width,i.height)),this.setState({cropIsActive:!0,newCropIsBeingDrawn:!0})}),kl(this,"onDocPointerMove",t=>{const{crop:n,disabled:s,onChange:a,onDragStart:o}=this.props,l=this.getBox();if(s||!n||!this.mouseDownOnCrop)return;t.cancelable&&t.preventDefault(),this.dragStarted||(this.dragStarted=!0,o&&o(t));const{evData:i}=this;i.clientX=t.clientX,i.clientY=t.clientY;let u;i.isResize?u=this.resizeCrop():u=this.dragCrop(),ISe(n,u)||a(vg(u,l.width,l.height),e1(u,l.width,l.height))}),kl(this,"onComponentKeyDown",t=>{const{crop:n,disabled:s,onChange:a,onComplete:o}=this.props;if(s)return;const l=t.key;let i=!1;if(!n)return;const u=this.getBox(),p=this.makePixelCrop(u),x=(navigator.platform.match("Mac")?t.metaKey:t.ctrlKey)?nm.nudgeStepLarge:t.shiftKey?nm.nudgeStepMedium:nm.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){t.cancelable&&t.preventDefault(),p.x=A4(p.x,0,u.width-p.width),p.y=A4(p.y,0,u.height-p.height);const y=vg(p,u.width,u.height),_=e1(p,u.width,u.height);a(y,_),o&&o(y,_)}}),kl(this,"onHandlerKeyDown",(t,n)=>{const{aspect:s=0,crop:a,disabled:o,minWidth:l=0,minHeight:i=0,maxWidth:u,maxHeight:p,onChange:x,onComplete:y}=this.props,_=this.getBox();if(o||!a)return;if(t.key==="ArrowUp"||t.key==="ArrowDown"||t.key==="ArrowLeft"||t.key==="ArrowRight")t.stopPropagation(),t.preventDefault();else return;const b=(navigator.platform.match("Mac")?t.metaKey:t.ctrlKey)?nm.nudgeStepLarge:t.shiftKey?nm.nudgeStepMedium:nm.nudgeStep,S=vg(a,_.width,_.height),k=wwt(S,t.key,b,n),M=PSe(k,s,n,_.width,_.height,l,i,u,p);if(!ISe(a,M)){const P=e1(M,_.width,_.height);x(M,P),y&&y(M,P)}}),kl(this,"onDocPointerDone",t=>{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(t),a&&a(vg(n,l.width,l.height),e1(n,l.width,l.height)),this.setState({cropIsActive:!1,newCropIsBeingDrawn:!1}))}),kl(this,"onDragFocus",()=>{var t;(t=this.componentRef.current)==null||t.scrollTo(0,0)})}get document(){return document}getBox(){const t=this.mediaRef.current;if(!t)return{x:0,y:0,width:0,height:0};const{x:n,y:s,width:a,height:o}=t.getBoundingClientRect();return{x:n,y:s,width:a,height:o}}componentDidUpdate(t){const{crop:n,onComplete:s}=this.props;if(s&&!t.crop&&n){const{width:a,height:o}=this.getBox();a&&o&&s(vg(n,a,o),e1(n,a,o))}}componentWillUnmount(){this.resizeObserver&&this.resizeObserver.disconnect(),this.unbindDocMove()}bindDocMove(){this.docMoveBound||(this.document.addEventListener("pointermove",this.onDocPointerMove,E4),this.document.addEventListener("pointerup",this.onDocPointerDone,E4),this.document.addEventListener("pointercancel",this.onDocPointerDone,E4),this.docMoveBound=!0)}unbindDocMove(){this.docMoveBound&&(this.document.removeEventListener("pointermove",this.onDocPointerMove,E4),this.document.removeEventListener("pointerup",this.onDocPointerDone,E4),this.document.removeEventListener("pointercancel",this.onDocPointerDone,E4),this.docMoveBound=!1)}getCropStyle(){const{crop:t}=this.props;if(t)return{top:`${t.y}${t.unit}`,left:`${t.x}${t.unit}`,width:`${t.width}${t.unit}`,height:`${t.height}${t.unit}`}}dragCrop(){const{evData:t}=this,n=this.getBox(),s=this.makePixelCrop(n),a=t.clientX-t.startClientX,o=t.clientY-t.startClientY;return s.x=A4(t.startCropX+a,0,n.width-s.width),s.y=A4(t.startCropY+o,0,n.height-s.height),s}getPointRegion(t,n,s,a){const{evData:o}=this,l=o.clientX-t.x,i=o.clientY-t.y;let u;a&&n?u=n==="nw"||n==="n"||n==="ne":u=i1?o?[o,o/n]:[l*n,l]:l?[l*n,l]:[o,o/n]}resizeCrop(){const{evData:t}=this,{aspect:n=0,maxWidth:s,maxHeight:a}=this.props,o=this.getBox(),[l,i]=this.resolveMinDimensions(o,n,this.props.minWidth,this.props.minHeight);let u=this.makePixelCrop(o);const p=this.getPointRegion(o,t.ord,l,i),x=t.ord||p;let y=t.clientX-t.startClientX,_=t.clientY-t.startClientY;(l&&x==="nw"||x==="w"||x==="sw")&&(y=Math.min(y,-l)),(i&&x==="nw"||x==="n"||x==="ne")&&(_=Math.min(_,-i));const b={unit:"px",x:0,y:0,width:0,height:0};p==="ne"?(b.x=t.startCropX,b.width=y,n?(b.height=b.width/n,b.y=t.startCropY-b.height):(b.height=Math.abs(_),b.y=t.startCropY-b.height)):p==="se"?(b.x=t.startCropX,b.y=t.startCropY,b.width=y,n?b.height=b.width/n:b.height=_):p==="sw"?(b.x=t.startCropX+y,b.y=t.startCropY,b.width=Math.abs(y),n?b.height=b.width/n:b.height=_):p==="nw"&&(b.x=t.startCropX+y,b.width=Math.abs(y),n?(b.height=b.width/n,b.y=t.startCropY-b.height):(b.height=Math.abs(_),b.y=t.startCropY+_));const S=PSe(b,n,p,o.width,o.height,l,i,s,a);return n||nm.xyOrds.indexOf(x)>-1?u=S:nm.xOrds.indexOf(x)>-1?(u.x=S.x,u.width=S.width):nm.yOrds.indexOf(x)>-1&&(u.y=S.y,u.height=S.height),u.x=A4(u.x,0,o.width-u.width),u.y=A4(u.y,0,o.height-u.height),u}renderCropSelection(){const{ariaLabels:t=nm.defaultProps.ariaLabels,disabled:n,locked:s,renderSelectionAddon:a,ruleOfThirds:o,crop:l}=this.props,i=this.getCropStyle();if(l)return lt.createElement("div",{style:i,className:"ReactCrop__crop-selection",onPointerDown:this.onCropPointerDown,"aria-label":t.cropArea,tabIndex:0,onKeyDown:this.onComponentKeyDown,role:"group"},!n&&!s&<.createElement("div",{className:"ReactCrop__drag-elements",onFocus:this.onDragFocus},lt.createElement("div",{className:"ReactCrop__drag-bar ord-n","data-ord":"n"}),lt.createElement("div",{className:"ReactCrop__drag-bar ord-e","data-ord":"e"}),lt.createElement("div",{className:"ReactCrop__drag-bar ord-s","data-ord":"s"}),lt.createElement("div",{className:"ReactCrop__drag-bar ord-w","data-ord":"w"}),lt.createElement("div",{className:"ReactCrop__drag-handle ord-nw","data-ord":"nw",tabIndex:0,"aria-label":t.nwDragHandle,onKeyDown:u=>this.onHandlerKeyDown(u,"nw"),role:"button"}),lt.createElement("div",{className:"ReactCrop__drag-handle ord-n","data-ord":"n",tabIndex:0,"aria-label":t.nDragHandle,onKeyDown:u=>this.onHandlerKeyDown(u,"n"),role:"button"}),lt.createElement("div",{className:"ReactCrop__drag-handle ord-ne","data-ord":"ne",tabIndex:0,"aria-label":t.neDragHandle,onKeyDown:u=>this.onHandlerKeyDown(u,"ne"),role:"button"}),lt.createElement("div",{className:"ReactCrop__drag-handle ord-e","data-ord":"e",tabIndex:0,"aria-label":t.eDragHandle,onKeyDown:u=>this.onHandlerKeyDown(u,"e"),role:"button"}),lt.createElement("div",{className:"ReactCrop__drag-handle ord-se","data-ord":"se",tabIndex:0,"aria-label":t.seDragHandle,onKeyDown:u=>this.onHandlerKeyDown(u,"se"),role:"button"}),lt.createElement("div",{className:"ReactCrop__drag-handle ord-s","data-ord":"s",tabIndex:0,"aria-label":t.sDragHandle,onKeyDown:u=>this.onHandlerKeyDown(u,"s"),role:"button"}),lt.createElement("div",{className:"ReactCrop__drag-handle ord-sw","data-ord":"sw",tabIndex:0,"aria-label":t.swDragHandle,onKeyDown:u=>this.onHandlerKeyDown(u,"sw"),role:"button"}),lt.createElement("div",{className:"ReactCrop__drag-handle ord-w","data-ord":"w",tabIndex:0,"aria-label":t.wDragHandle,onKeyDown:u=>this.onHandlerKeyDown(u,"w"),role:"button"})),a&<.createElement("div",{className:"ReactCrop__selection-addon",onPointerDown:u=>u.stopPropagation()},a(this.state)),o&<.createElement(lt.Fragment,null,lt.createElement("div",{className:"ReactCrop__rule-of-thirds-hz"}),lt.createElement("div",{className:"ReactCrop__rule-of-thirds-vt"})))}makePixelCrop(t){const n={...Hre,...this.props.crop||{}};return vg(n,t.width,t.height)}render(){const{aspect:t,children:n,circularCrop:s,className:a,crop:o,disabled:l,locked:i,style:u,ruleOfThirds:p}=this.props,{cropIsActive:x,newCropIsBeingDrawn:y}=this.state,_=o?this.renderCropSelection():null,b=vwt("ReactCrop",a,x&&"ReactCrop--active",l&&"ReactCrop--disabled",i&&"ReactCrop--locked",y&&"ReactCrop--new-crop",o&&t&&"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 lt.createElement("div",{ref:this.componentRef,className:b,style:u},lt.createElement("div",{ref:this.mediaRef,className:"ReactCrop__child-wrapper",onPointerDown:this.onComponentPointerDown},n),o?lt.createElement("svg",{className:"ReactCrop__crop-mask",width:"100%",height:"100%"},lt.createElement("defs",null,lt.createElement("mask",{id:`hole-${this.instanceId}`},lt.createElement("rect",{width:"100%",height:"100%",fill:"white"}),s?lt.createElement("ellipse",{cx:`${o.x+o.width/2}${o.unit}`,cy:`${o.y+o.height/2}${o.unit}`,rx:`${o.width/2}${o.unit}`,ry:`${o.height/2}${o.unit}`,fill:"black"}):lt.createElement("rect",{x:`${o.x}${o.unit}`,y:`${o.y}${o.unit}`,width:`${o.width}${o.unit}`,height:`${o.height}${o.unit}`,fill:"black"}))),lt.createElement("rect",{fill:"black",fillOpacity:.5,width:"100%",height:"100%",mask:`url(#hole-${this.instanceId})`})):void 0,_)}};kl(U0,"xOrds",["e","w"]),kl(U0,"yOrds",["n","s"]),kl(U0,"xyOrds",["nw","ne","se","sw"]),kl(U0,"nudgeStep",1),kl(U0,"nudgeStepMedium",10),kl(U0,"nudgeStepLarge",100),kl(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 kwt=U0;var C7e=["PageUp","PageDown"],M7e=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],T7e={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},L3="Slider",[hpe,Nwt,Swt]=qI(L3),[A7e]=cc(L3,[Swt]),[Cwt,Tae]=A7e(L3),E7e=E.forwardRef((e,t)=>{const{name:n,min:s=0,max:a=100,step:o=1,orientation:l="horizontal",disabled:i=!1,minStepsBetweenThumbs:u=0,defaultValue:p=[s],value:x,onValueChange:y=()=>{},onValueCommit:_=()=>{},inverted:b=!1,form:S,...k}=e,M=E.useRef(new Set),P=E.useRef(0),I=l==="horizontal"?Mwt:Twt,[z=[],D]=Ju({prop:x,defaultProp:p,onChange:ne=>{var ge;(ge=[...M.current][P.current])==null||ge.focus(),y(ne)}}),U=E.useRef(z);function V(ne){const oe=Lwt(z,ne);J(ne,oe)}function W(ne){J(ne,P.current)}function G(){const ne=U.current[P.current];z[P.current]!==ne&&_(z)}function J(ne,oe,{commit:ge}={commit:!1}){const ie=Fwt(o),pe=zwt(Math.round((ne-s)/o)*o+s,ie),se=IE(pe,[s,a]);D((fe=[])=>{const he=Iwt(fe,se,oe);if(Rwt(he,u*o)){P.current=he.indexOf(se);const ye=String(he)!==String(fe);return ye&&ge&&_(he),ye?he:fe}else return fe})}return r.jsx(Cwt,{scope:e.__scopeSlider,name:n,disabled:i,min:s,max:a,valueIndexToChangeRef:P,thumbs:M.current,values:z,orientation:l,form:S,children:r.jsx(hpe.Provider,{scope:e.__scopeSlider,children:r.jsx(hpe.Slot,{scope:e.__scopeSlider,children:r.jsx(I,{"aria-disabled":i,"data-disabled":i?"":void 0,...k,ref:t,onPointerDown:un(k.onPointerDown,()=>{i||(U.current=z)}),min:s,max:a,inverted:b,onSlideStart:i?void 0:V,onSlideMove:i?void 0:W,onSlideEnd:i?void 0:G,onHomeKeyDown:()=>!i&&J(s,0,{commit:!0}),onEndKeyDown:()=>!i&&J(a,z.length-1,{commit:!0}),onStepKeyDown:({event:ne,direction:oe})=>{if(!i){const pe=C7e.includes(ne.key)||ne.shiftKey&&M7e.includes(ne.key)?10:1,se=P.current,fe=z[se],he=o*pe*oe;J(fe+he,se,{commit:!0})}}})})})})});E7e.displayName=L3;var[I7e,P7e]=A7e(L3,{startEdge:"left",endEdge:"right",size:"width",direction:1}),Mwt=E.forwardRef((e,t)=>{const{min:n,max:s,dir:a,inverted:o,onSlideStart:l,onSlideMove:i,onSlideEnd:u,onStepKeyDown:p,...x}=e,[y,_]=E.useState(null),b=la(t,I=>_(I)),S=E.useRef(void 0),k=Sk(a),M=k==="ltr",P=M&&!o||!M&&o;function T(I){const z=S.current||y.getBoundingClientRect(),D=[0,z.width],V=k0e(D,P?[n,s]:[s,n]);return S.current=z,V(I-z.left)}return r.jsx(I7e,{scope:e.__scopeSlider,startEdge:P?"left":"right",endEdge:P?"right":"left",direction:P?1:-1,size:"width",children:r.jsx(L7e,{dir:k,"data-orientation":"horizontal",...x,ref:b,style:{...x.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:I=>{const z=T(I.clientX);l==null||l(z)},onSlideMove:I=>{const z=T(I.clientX);i==null||i(z)},onSlideEnd:()=>{S.current=void 0,u==null||u()},onStepKeyDown:I=>{const D=T7e[P?"from-left":"from-right"].includes(I.key);p==null||p({event:I,direction:D?-1:1})}})})}),Twt=E.forwardRef((e,t)=>{const{min:n,max:s,inverted:a,onSlideStart:o,onSlideMove:l,onSlideEnd:i,onStepKeyDown:u,...p}=e,x=E.useRef(null),y=la(t,x),_=E.useRef(void 0),b=!a;function S(k){const M=_.current||x.current.getBoundingClientRect(),P=[0,M.height],I=k0e(P,b?[s,n]:[n,s]);return _.current=M,I(k-M.top)}return r.jsx(I7e,{scope:e.__scopeSlider,startEdge:b?"bottom":"top",endEdge:b?"top":"bottom",size:"height",direction:b?1:-1,children:r.jsx(L7e,{"data-orientation":"vertical",...p,ref:y,style:{...p.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:k=>{const M=S(k.clientY);o==null||o(M)},onSlideMove:k=>{const M=S(k.clientY);l==null||l(M)},onSlideEnd:()=>{_.current=void 0,i==null||i()},onStepKeyDown:k=>{const P=T7e[b?"from-bottom":"from-top"].includes(k.key);u==null||u({event:k,direction:P?-1:1})}})})}),L7e=E.forwardRef((e,t)=>{const{__scopeSlider:n,onSlideStart:s,onSlideMove:a,onSlideEnd:o,onHomeKeyDown:l,onEndKeyDown:i,onStepKeyDown:u,...p}=e,x=Tae(L3,n);return r.jsx(Fn.span,{...p,ref:t,onKeyDown:un(e.onKeyDown,y=>{y.key==="Home"?(l(y),y.preventDefault()):y.key==="End"?(i(y),y.preventDefault()):C7e.concat(M7e).includes(y.key)&&(u(y),y.preventDefault())}),onPointerDown:un(e.onPointerDown,y=>{const _=y.target;_.setPointerCapture(y.pointerId),y.preventDefault(),x.thumbs.has(_)?_.focus():s(y)}),onPointerMove:un(e.onPointerMove,y=>{y.target.hasPointerCapture(y.pointerId)&&a(y)}),onPointerUp:un(e.onPointerUp,y=>{const _=y.target;_.hasPointerCapture(y.pointerId)&&(_.releasePointerCapture(y.pointerId),o(y))})})}),O7e="SliderTrack",D7e=E.forwardRef((e,t)=>{const{__scopeSlider:n,...s}=e,a=Tae(O7e,n);return r.jsx(Fn.span,{"data-disabled":a.disabled?"":void 0,"data-orientation":a.orientation,...s,ref:t})});D7e.displayName=O7e;var fpe="SliderRange",R7e=E.forwardRef((e,t)=>{const{__scopeSlider:n,...s}=e,a=Tae(fpe,n),o=P7e(fpe,n),l=E.useRef(null),i=la(t,l),u=a.values.length,p=a.values.map(_=>B7e(_,a.min,a.max)),x=u>1?Math.min(...p):0,y=100-Math.max(...p);return r.jsx(Fn.span,{"data-orientation":a.orientation,"data-disabled":a.disabled?"":void 0,...s,ref:i,style:{...e.style,[o.startEdge]:x+"%",[o.endEdge]:y+"%"}})});R7e.displayName=fpe;var ppe="SliderThumb",F7e=E.forwardRef((e,t)=>{const n=Nwt(e.__scopeSlider),[s,a]=E.useState(null),o=la(t,i=>a(i)),l=E.useMemo(()=>s?n().findIndex(i=>i.ref.current===s):-1,[n,s]);return r.jsx(Awt,{...e,ref:o,index:l})}),Awt=E.forwardRef((e,t)=>{const{__scopeSlider:n,index:s,name:a,...o}=e,l=Tae(ppe,n),i=P7e(ppe,n),[u,p]=E.useState(null),x=la(t,T=>p(T)),y=u?l.form||!!u.closest("form"):!0,_=WI(u),b=l.values[s],S=b===void 0?0:B7e(b,l.min,l.max),k=Pwt(s,l.values.length),M=_==null?void 0:_[i.size],P=M?Owt(M,S,i.direction):0;return E.useEffect(()=>{if(u)return l.thumbs.add(u),()=>{l.thumbs.delete(u)}},[u,l.thumbs]),r.jsxs("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[i.startEdge]:`calc(${S}% + ${P}px)`},children:[r.jsx(hpe.ItemSlot,{scope:e.__scopeSlider,children:r.jsx(Fn.span,{role:"slider","aria-label":e["aria-label"]||k,"aria-valuemin":l.min,"aria-valuenow":b,"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:b===void 0?{display:"none"}:e.style,onFocus:un(e.onFocus,()=>{l.valueIndexToChangeRef.current=s})})}),y&&r.jsx(z7e,{name:a??(l.name?l.name+(l.values.length>1?"[]":""):void 0),form:l.form,value:b},s)]})});F7e.displayName=ppe;var Ewt="RadioBubbleInput",z7e=E.forwardRef(({__scopeSlider:e,value:t,...n},s)=>{const a=E.useRef(null),o=la(a,s),l=aP(t);return E.useEffect(()=>{const i=a.current;if(!i)return;const u=window.HTMLInputElement.prototype,x=Object.getOwnPropertyDescriptor(u,"value").set;if(l!==t&&x){const y=new Event("input",{bubbles:!0});x.call(i,t),i.dispatchEvent(y)}},[l,t]),r.jsx(Fn.input,{style:{display:"none"},...n,ref:o,defaultValue:t})});z7e.displayName=Ewt;function Iwt(e=[],t,n){const s=[...e];return s[n]=t,s.sort((a,o)=>a-o)}function B7e(e,t,n){const o=100/(n-t)*(e-t);return IE(o,[0,100])}function Pwt(e,t){return t>2?`Value ${e+1} of ${t}`:t===2?["Minimum","Maximum"][e]:void 0}function Lwt(e,t){if(e.length===1)return 0;const n=e.map(a=>Math.abs(a-t)),s=Math.min(...n);return n.indexOf(s)}function Owt(e,t,n){const s=e/2,o=k0e([0,50],[0,s]);return(s-o(t)*n)*n}function Dwt(e){return e.slice(0,-1).map((t,n)=>e[n+1]-t)}function Rwt(e,t){if(t>0){const n=Dwt(e);return Math.min(...n)>=t}return!0}function k0e(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];const s=(t[1]-t[0])/(e[1]-e[0]);return t[0]+s*(n-e[0])}}function Fwt(e){return(String(e).split(".")[1]||"").length}function zwt(e,t){const n=Math.pow(10,t);return Math.round(e*n)/n}var $7e=E7e,Bwt=D7e,$wt=R7e,Uwt=F7e;const jm=E.forwardRef(({className:e,...t},n)=>r.jsxs($7e,{ref:n,className:Bt("relative flex w-full touch-none select-none items-center",e),...t,children:[r.jsx(Bwt,{className:"relative h-2 w-full grow overflow-hidden rounded-full bg-secondary",children:r.jsx($wt,{className:"absolute h-full bg-primary"})}),r.jsx(Uwt,{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"})]}));jm.displayName=$7e.displayName;function qwt(e,t,n){return bwt(_wt({unit:"%",width:90},n,e,t),e,t)}const N0e=({open:e,onClose:t,imageSrc:n,onCropComplete:s,aspectRatio:a=1})=>{const o=E.useRef(null),[l,i]=E.useState(),[u,p]=E.useState(),[x,y]=E.useState(1),[_,b]=E.useState(0),S=E.useCallback(P=>{const{width:T,height:I}=P.currentTarget;i(qwt(T,I,a))},[a]),k=E.useCallback(async()=>{const P=o.current;if(!P||!u)return;const T=document.createElement("canvas"),I=T.getContext("2d");if(!I)return;const z=P.naturalWidth/P.width,D=P.naturalHeight/P.height,U=400;T.width=U,T.height=U,I.imageSmoothingQuality="high";const V=u.x*z,W=u.y*D,G=u.width*z,J=u.height*D,ne=_*Math.PI/180,oe=T.width/2,ge=T.height/2;return I.save(),I.translate(oe,ge),I.rotate(ne),I.scale(x,x),I.translate(-oe,-ge),I.drawImage(P,V,W,G,J,0,0,U,U),I.restore(),new Promise((ie,pe)=>{T.toBlob(se=>{se?ie(se):pe(new Error("Canvas is empty"))},"image/jpeg",.95)})},[u,x,_]),M=async()=>{try{const P=await k();P&&(s(P),t())}catch(P){console.error("Error cropping image:",P)}};return r.jsx(Or,{open:e,onOpenChange:t,children:r.jsxs(Ir,{className:"max-w-lg",children:[r.jsx($r,{children:r.jsx(Fr,{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(kwt,{crop:l,onChange:(P,T)=>i(T),onComplete:P=>p(P),aspect:a,circularCrop:!0,className:"max-h-[400px]",children:r.jsx("img",{ref:o,src:n,alt:"Crop preview",style:{transform:`scale(${x}) rotate(${_}deg)`,maxHeight:"400px",width:"auto"},onLoad:S})})}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(FS,{className:"h-4 w-4 text-muted-foreground"}),r.jsx(jm,{value:[x],min:.5,max:3,step:.1,onValueChange:([P])=>y(P),className:"flex-1"}),r.jsx(RS,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(_A,{className:"h-4 w-4 text-muted-foreground"}),r.jsx(jm,{value:[_],min:-180,max:180,step:1,onValueChange:([P])=>b(P),className:"flex-1"}),r.jsxs("span",{className:"text-sm text-muted-foreground w-12",children:[_,"°"]})]})]})]}),r.jsxs(Bs,{children:[r.jsx(ee,{variant:"outline",onClick:t,children:"Cancel"}),r.jsx(ee,{onClick:M,children:"Save Photo"})]})]})})},Vwt=()=>{const{user:e}=tn(),{toast:t}=_i(),[n,s]=E.useState(!1),[a,o]=E.useState(!1),[l,i]=E.useState(null);E.useEffect(()=>{e&&u()},[e]);const u=async()=>{s(!0);try{const{data:y}=await Q.from("profiles").select("subscription_status, subscription_product_id, subscription_end_date, is_grandfathered").eq("id",e==null?void 0:e.id).single();y&&i({status:y.subscription_status||"none",productId:y.subscription_product_id,endDate:y.subscription_end_date,isGrandfathered:y.is_grandfathered||!1})}catch(y){console.error("Error loading subscription:",y)}finally{s(!1)}},p=async()=>{o(!0);try{const{data:{session:y}}=await Q.auth.getSession();if(!y)throw new Error("Not authenticated");const{data:_,error:b}=await Q.functions.invoke("customer-portal",{headers:{Authorization:`Bearer ${y.access_token}`}});if(b)throw b;_!=null&&_.url&&window.open(_.url,"_blank")}catch(y){console.error("Error opening customer portal:",y),t({title:"Error",description:y.message||"Failed to open billing portal",variant:"destructive"})}finally{o(!1)}},x=()=>{if(l!=null&&l.isGrandfathered)return r.jsx(Pt,{className:"bg-amber-500",children:"Grandfathered"});switch(l==null?void 0:l.status){case"active":return r.jsx(Pt,{className:"bg-green-500",children:"Active"});case"trialing":return r.jsx(Pt,{className:"bg-blue-500",children:"Trial"});case"past_due":return r.jsx(Pt,{variant:"destructive",children:"Past Due"});case"canceled":return r.jsx(Pt,{variant:"secondary",children:"Canceled"});default:return r.jsx(Pt,{variant:"outline",children:"No Subscription"})}};return n?r.jsxs(Ze,{children:[r.jsx(Wt,{children:r.jsxs(Yt,{className:"flex items-center gap-2",children:[r.jsx(Mm,{className:"h-5 w-5"}),"Subscription"]})}),r.jsx(et,{children:r.jsx("div",{className:"flex items-center justify-center py-4",children:r.jsx(Zr,{className:"h-6 w-6 animate-spin text-muted-foreground"})})})]}):r.jsxs(Ze,{children:[r.jsxs(Wt,{children:[r.jsxs(Yt,{className:"flex items-center gap-2",children:[r.jsx(Mm,{className:"h-5 w-5"}),"Subscription"]}),r.jsx(Sn,{children:"Manage your subscription and billing"})]}),r.jsxs(et,{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:"Status"}),r.jsx("div",{className:"mt-1",children:x()})]}),(l==null?void 0:l.endDate)&&l.status==="active"&&r.jsxs("div",{className:"text-right",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Next billing date"}),r.jsx("p",{className:"font-medium",children:new Date(l.endDate).toLocaleDateString()})]})]}),l!=null&&l.isGrandfathered?r.jsx("p",{className:"text-sm text-muted-foreground",children:"Your account was upgraded from LevelUp 1.0. To update/manage your subscription please reach out to support."}):(l==null?void 0:l.status)==="active"||(l==null?void 0:l.status)==="trialing"?r.jsxs(r.Fragment,{children:[(l==null?void 0:l.status)==="trialing"&&(l==null?void 0:l.endDate)&&r.jsxs("p",{className:"text-sm text-muted-foreground mb-3",children:["Your trial ends on ",new Date(l.endDate).toLocaleDateString(),". After the trial, you'll be charged automatically."]}),r.jsxs(ee,{onClick:p,variant:"outline",disabled:a,children:[a?r.jsx(Zr,{className:"mr-2 h-4 w-4 animate-spin"}):r.jsx(As,{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."})]})]})},Hwt=()=>{const{user:e}=tn(),t=Gn(),{toast:n}=_i(),[s]=Gc(),a=s.get("setup")==="true",o=s.get("reset")==="true",{isSupported:l,isSubscribed:i,isLoading:u,subscribe:p,unsubscribe:x}=oRe(),[y,_]=E.useState(!1),[b,S]=E.useState(""),[k,M]=E.useState(!1),[P,T]=E.useState(!1),[I,z]=E.useState(""),[D,U]=E.useState({name:"",email:"",title:"",bio:"",areas_served:"",years_experience:"",instagram_url:"",facebook_url:"",linkedin_url:"",email_signature:"",use_email_signature:!1}),[V,W]=E.useState(!1),[G,J]=E.useState(!1),[ne,oe]=E.useState({newPassword:"",confirmPassword:""});E.useEffect(()=>{e&&ge()},[e]),E.useEffect(()=>{o&&e&&setTimeout(()=>{var he;(he=document.getElementById("change-password-section"))==null||he.scrollIntoView({behavior:"smooth",block:"center"})},500)},[o,e]);const ge=async()=>{var he,ye,Ae;if(!(e!=null&&e.id)){console.log("No user ID available yet");return}try{console.log("Loading profile for user:",e.id);const{data:we,error:be}=await Q.from("profiles").select("name, email, digest_opt_out, title, bio, areas_served, years_experience, instagram_url, facebook_url, linkedin_url, email_signature, use_email_signature").eq("id",e.id).maybeSingle();if(be)throw console.error("Profile query error:",be),be;we?(console.log("Profile loaded successfully:",we),U({name:we.name||"",email:we.email||"",title:we.title||"",bio:we.bio||"",areas_served:we.areas_served||"",years_experience:((he=we.years_experience)==null?void 0:he.toString())||"",instagram_url:we.instagram_url||"",facebook_url:we.facebook_url||"",linkedin_url:we.linkedin_url||"",email_signature:we.email_signature||"",use_email_signature:we.use_email_signature||!1}),W(we.digest_opt_out||!1)):(console.warn("No profile found for user"),U({name:((ye=e.user_metadata)==null?void 0:ye.name)||((Ae=e.email)==null?void 0:Ae.split("@")[0])||"",email:e.email||"",title:"",bio:"",areas_served:"",years_experience:"",instagram_url:"",facebook_url:"",linkedin_url:"",email_signature:"",use_email_signature:!1}));const{data:_e}=await Q.storage.from("avatars").list(`${e.id}`);if(_e&&_e.length>0){const{data:Je}=Q.storage.from("avatars").getPublicUrl(`${e.id}/${_e[0].name}`);S(Je.publicUrl)}}catch(we){console.error("Error loading profile:",we),n({title:"Error",description:we.message||"Failed to load profile",variant:"destructive"})}},ie=he=>{var we;const ye=(we=he.target.files)==null?void 0:we[0];if(!ye)return;const Ae=new FileReader;Ae.onloadend=()=>{z(Ae.result),T(!0)},Ae.readAsDataURL(ye),he.target.value=""},pe=async he=>{if(e){M(!0);try{const{data:ye}=await Q.storage.from("avatars").list(`${e.id}`);ye&&ye.length>0&&await Q.storage.from("avatars").remove(ye.map(Je=>`${e.id}/${Je.name}`));const we=`${e.id}/avatar.jpg`,{error:be}=await Q.storage.from("avatars").upload(we,he,{upsert:!0,contentType:"image/jpeg"});if(be)throw be;const{data:_e}=Q.storage.from("avatars").getPublicUrl(we);S(`${_e.publicUrl}?t=${Date.now()}`),n({title:"Success",description:"Profile photo updated successfully"})}catch(ye){console.error("Error uploading avatar:",ye),n({title:"Error",description:ye.message||"Failed to upload photo",variant:"destructive"})}finally{M(!1)}}},se=async()=>{if(!D.name.trim()||!D.email.trim()){n({title:"Error",description:"Name and email are required",variant:"destructive"});return}_(!0);try{const{error:he}=await Q.from("profiles").update({name:D.name.trim(),email:D.email.trim(),title:D.title.trim()||null,bio:D.bio.trim()||null,areas_served:D.areas_served.trim()||null,years_experience:D.years_experience?parseInt(D.years_experience):null,instagram_url:D.instagram_url.trim()||null,facebook_url:D.facebook_url.trim()||null,linkedin_url:D.linkedin_url.trim()||null,email_signature:D.email_signature||"",use_email_signature:D.use_email_signature}).eq("id",e==null?void 0:e.id);if(he)throw he;n({title:"Success",description:"Profile updated successfully"})}catch(he){console.error("Error updating profile:",he),n({title:"Error",description:he.message||"Failed to update profile",variant:"destructive"})}finally{_(!1)}},fe=async()=>{if(!ne.newPassword){n({title:"Error",description:"Please enter a new password",variant:"destructive"});return}if(ne.newPassword.length<6){n({title:"Error",description:"Password must be at least 6 characters",variant:"destructive"});return}if(ne.newPassword!==ne.confirmPassword){n({title:"Error",description:"Passwords do not match",variant:"destructive"});return}_(!0);try{const{error:he}=await Q.auth.updateUser({password:ne.newPassword});if(he)throw he;n({title:"Success",description:"Password updated successfully"}),oe({newPassword:"",confirmPassword:""}),a&&setTimeout(()=>t("/dashboard"),1e3)}catch(he){console.error("Error updating password:",he),n({title:"Error",description:he.message||"Failed to update password",variant:"destructive"})}finally{_(!1)}};return r.jsx(Dr,{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 he;(he=document.getElementById("change-password-section"))==null||he.scrollIntoView({behavior:"smooth",block:"center"})},className:"gap-2",children:[r.jsx(Lj,{className:"h-4 w-4"}),"Change Password"]})}),r.jsxs("div",{className:"space-y-6",children:[r.jsxs(Ze,{children:[r.jsxs(Wt,{children:[r.jsx(Yt,{children:"Profile Photo"}),r.jsx(Sn,{children:"Upload a professional photo for your profile"})]}),r.jsxs(et,{className:"flex items-center gap-6",children:[r.jsxs(Qs,{className:"h-24 w-24",children:[r.jsx(Si,{src:b}),r.jsx(Js,{className:"text-2xl",children:D.name.split(" ").map(he=>he[0]).join("").toUpperCase()||"U"})]}),r.jsxs("div",{className:"flex-1",children:[r.jsx("input",{type:"file",id:"avatar-upload",accept:"image/*",className:"hidden",onChange:ie,disabled:k}),r.jsxs(ee,{variant:"outline",onClick:()=>{var he;return(he=document.getElementById("avatar-upload"))==null?void 0:he.click()},disabled:k,children:[r.jsx(_o,{className:"mr-2 h-4 w-4"}),k?"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(Ze,{children:[r.jsxs(Wt,{children:[r.jsx(Yt,{children:"Personal Information"}),r.jsx(Sn,{children:"Update your profile details"})]}),r.jsxs(et,{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{htmlFor:"name",children:"Name"}),r.jsx(dt,{id:"name",value:D.name,onChange:he=>U({...D,name:he.target.value}),maxLength:100})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{htmlFor:"email",children:"Email"}),r.jsx(dt,{id:"email",type:"email",value:D.email,onChange:he=>U({...D,email:he.target.value}),maxLength:255})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{htmlFor:"title",children:"Job Title"}),r.jsx(dt,{id:"title",value:D.title,onChange:he=>U({...D,title:he.target.value}),placeholder:"e.g., Broker Associate, Team Lead",maxLength:100})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{htmlFor:"bio",children:"Bio"}),r.jsx(Jn,{id:"bio",value:D.bio,onChange:he=>U({...D,bio:he.target.value}),placeholder:"A short description about yourself",maxLength:500,className:"min-h-[120px] resize-y"})]}),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($e,{htmlFor:"areas_served",children:"Areas Served"}),r.jsx(dt,{id:"areas_served",value:D.areas_served,onChange:he=>U({...D,areas_served:he.target.value}),placeholder:"e.g., Downtown, Suburbs"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{htmlFor:"years_experience",children:"Years Experience"}),r.jsx(dt,{id:"years_experience",type:"number",min:"0",value:D.years_experience,onChange:he=>U({...D,years_experience:he.target.value}),placeholder:"e.g., 5"})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{children:"Social Links"}),r.jsxs("div",{className:"grid grid-cols-1 gap-3",children:[r.jsx(dt,{value:D.linkedin_url,onChange:he=>U({...D,linkedin_url:he.target.value}),placeholder:"LinkedIn URL"}),r.jsx(dt,{value:D.instagram_url,onChange:he=>U({...D,instagram_url:he.target.value}),placeholder:"Instagram URL"}),r.jsx(dt,{value:D.facebook_url,onChange:he=>U({...D,facebook_url:he.target.value}),placeholder:"Facebook URL"})]})]}),r.jsxs(ee,{onClick:se,disabled:y,children:[r.jsx(Em,{className:"mr-2 h-4 w-4"}),"Save Changes"]})]})]}),r.jsxs(Ze,{children:[r.jsxs(Wt,{children:[r.jsxs(Yt,{className:"flex items-center gap-2",children:[r.jsx(W0,{className:"h-5 w-5"}),"Email Signature"]}),r.jsx(Sn,{children:"Add a signature that will be appended to emails sent via Gmail"})]}),r.jsxs(et,{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:"Use email signature in all emails"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:D.use_email_signature?"Your signature will be added to every email sent via Gmail":"Signature is currently disabled"})]}),r.jsx(Ts,{checked:D.use_email_signature,onCheckedChange:he=>U({...D,use_email_signature:he})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{children:"Signature"}),r.jsx(ax,{content:D.email_signature,onChange:he=>U({...D,email_signature:he}),placeholder:"Paste your Gmail signature here or create one...",minHeight:"120px",compact:!0}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Tip: Copy your signature from Gmail Settings and paste it here — images and formatting will be preserved."})]}),r.jsxs(ee,{onClick:se,disabled:y,children:[r.jsx(Em,{className:"mr-2 h-4 w-4"}),"Save Signature"]})]})]}),r.jsxs(Ze,{id:"change-password-section",children:[r.jsxs(Wt,{children:[r.jsx(Yt,{children:a?"Set Your Password":"Change Password"}),r.jsx(Sn,{children:a?"Create a secure password for your account":"Update your password to keep your account secure"})]}),r.jsxs(et,{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{htmlFor:"newPassword",children:"New Password"}),r.jsx(dt,{id:"newPassword",type:"password",value:ne.newPassword,onChange:he=>oe({...ne,newPassword:he.target.value}),placeholder:"Min 6 characters"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{htmlFor:"confirmPassword",children:"Confirm Password"}),r.jsx(dt,{id:"confirmPassword",type:"password",value:ne.confirmPassword,onChange:he=>oe({...ne,confirmPassword:he.target.value}),placeholder:"Re-enter your new password"})]}),r.jsxs(ee,{onClick:fe,disabled:y,children:[r.jsx(Em,{className:"mr-2 h-4 w-4"}),a?"Complete Setup":"Update Password"]}),a&&r.jsx(ee,{variant:"outline",onClick:()=>t("/dashboard"),className:"ml-2",children:"Skip for Now"})]})]}),r.jsxs(Ze,{children:[r.jsxs(Wt,{children:[r.jsxs(Yt,{className:"flex items-center gap-2",children:[i?r.jsx(Lg,{className:"h-5 w-5"}):r.jsx(Sj,{className:"h-5 w-5"}),"Push Notifications"]}),r.jsx(Sn,{children:"Receive browser notifications when new content is added"})]}),r.jsx(et,{children:l?r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:i?"Notifications enabled":"Notifications disabled"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:i?"You'll receive notifications about new templates, videos, and events":"Enable to get notified about new content"})]}),r.jsx(Ts,{checked:i,onCheckedChange:he=>{he?p():x()},disabled:u})]}):r.jsxs("div",{className:"text-sm text-muted-foreground space-y-2",children:[r.jsx("p",{children:"Push notifications are not supported in this browser."}),r.jsxs("p",{className:"text-xs",children:[r.jsx("strong",{children:"Desktop:"})," Use Chrome, Firefox, or Edge.",r.jsx("br",{}),r.jsx("strong",{children:"iPhone/iPad:"}),' Open this site in Safari, tap the Share button, then "Add to Home Screen". Push notifications will work from the installed app.']})]})})]}),r.jsxs(Ze,{children:[r.jsxs(Wt,{children:[r.jsxs(Yt,{className:"flex items-center gap-2",children:[V?r.jsx(lA,{className:"h-5 w-5"}):r.jsx(Ns,{className:"h-5 w-5"}),"Email Preferences"]}),r.jsx(Sn,{children:"Manage your email subscription settings"})]}),r.jsx(et,{children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:"Weekly Digest"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:V?"You won't receive weekly digest emails":"Receive a weekly summary of new content, events, and your progress"})]}),r.jsx(Ts,{checked:!V,onCheckedChange:async he=>{J(!0);try{const{error:ye}=await Q.from("profiles").update({digest_opt_out:!he}).eq("id",e==null?void 0:e.id);if(ye)throw ye;W(!he),n({title:he?"Subscribed":"Unsubscribed",description:he?"You will now receive weekly digest emails":"You will no longer receive weekly digest emails"})}catch(ye){n({title:"Error",description:ye.message||"Failed to update preference",variant:"destructive"})}finally{J(!1)}},disabled:G})]})})]}),r.jsx(wxt,{}),r.jsx(Vwt,{})]}),r.jsx(N0e,{open:P,onClose:()=>T(!1),imageSrc:I,onCropComplete:pe,aspectRatio:1})]})})};var Wwt="AspectRatio",U7e=E.forwardRef((e,t)=>{const{ratio:n=1/1,style:s,...a}=e;return r.jsx("div",{style:{position:"relative",width:"100%",paddingBottom:`${100/n}%`},"data-radix-aspect-ratio-wrapper":"",children:r.jsx(Fn.div,{...a,ref:t,style:{...s,position:"absolute",top:0,right:0,bottom:0,left:0}})})});U7e.displayName=Wwt;var Gwt=U7e;const Kwt=Gwt;function Zwt(){const{user:e}=tn(),t=Hr(),[n,s]=E.useState(!1),[a,o]=E.useState(!1),{data:l,isLoading:i}=Kt({queryKey:["calendar-token",e==null?void 0:e.id],queryFn:async()=>{const{data:S,error:k}=await Q.from("profiles").select("calendar_token").eq("id",e==null?void 0:e.id).single();if(k)throw k;return S},enabled:!!e&&a}),u=ir({mutationFn:async()=>{const S=new Uint8Array(12);crypto.getRandomValues(S);const k=btoa(String.fromCharCode(...S)).replace(/\+/g,"x").replace(/\//g,"y").replace(/=/g,"").substring(0,16),{error:M}=await Q.from("profiles").update({calendar_token:k}).eq("id",e==null?void 0:e.id);if(M)throw M;return k},onSuccess:()=>{t.invalidateQueries({queryKey:["calendar-token",e==null?void 0:e.id]}),Ie.success("Calendar subscription URL generated!")},onError:S=>{Ie.error("Failed to generate calendar URL: "+S.message)}}),p=l!=null&&l.calendar_token?`https://dashboard.relevelup.com/api/calendar/${l.calendar_token}.ics`:null,x=async()=>{p&&(await navigator.clipboard.writeText(p),s(!0),Ie.success("Calendar URL copied to clipboard!"),setTimeout(()=>s(!1),2e3))},y=()=>{p&&(window.location.href=p.replace("https://","webcal://"))},_=()=>{if(p){const S=p.replace("https://","webcal://"),k=`https://calendar.google.com/calendar/r?cid=${encodeURIComponent(S)}`;window.open(k,"_blank")}},b=()=>{if(p){const S=`https://outlook.live.com/calendar/0/addfromweb?url=${encodeURIComponent(p)}&name=Level%20Up%20Events`;window.open(S,"_blank")}};return r.jsxs(Or,{open:a,onOpenChange:o,children:[r.jsx(Zo,{asChild:!0,children:r.jsxs(ee,{variant:"outline",className:"gap-2",children:[r.jsx(Ss,{className:"h-4 w-4"}),"Subscribe to Calendar"]})}),r.jsxs(Ir,{className:"sm:max-w-md",children:[r.jsxs($r,{children:[r.jsxs(Fr,{className:"flex items-center gap-2",children:[r.jsx(Ss,{className:"h-5 w-5 text-primary"}),"Subscribe to Events Calendar"]}),r.jsx(Zn,{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(Zr,{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(Ni,{className:"h-4 w-4 text-green-500"}):r.jsx(Wo,{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(As,{className:"h-3 w-3 ml-auto opacity-50"})]}),r.jsxs(ee,{variant:"outline",className:"w-full justify-start gap-2",onClick:_,children:[r.jsxs("svg",{className:"h-4 w-4",viewBox:"0 0 24 24",fill:"currentColor",children:[r.jsx("path",{d:"M19.5 22h-15A2.5 2.5 0 0 1 2 19.5v-15A2.5 2.5 0 0 1 4.5 2H9v2H4.5a.5.5 0 0 0-.5.5v15a.5.5 0 0 0 .5.5h15a.5.5 0 0 0 .5-.5V15h2v4.5a2.5 2.5 0 0 1-2.5 2.5z"}),r.jsx("path",{d:"M12 2v8.5a1.5 1.5 0 0 0 1.5 1.5H22V2h-10z",fill:"#4285F4"}),r.jsx("path",{d:"M12 12V2H4.5A2.5 2.5 0 0 0 2 4.5V12h10z",fill:"#34A853"}),r.jsx("path",{d:"M2 12v7.5A2.5 2.5 0 0 0 4.5 22H12v-10H2z",fill:"#FBBC05"}),r.jsx("path",{d:"M12 22h7.5a2.5 2.5 0 0 0 2.5-2.5V12h-10v10z",fill:"#EA4335"})]}),"Add to Google Calendar",r.jsx(As,{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.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(As,{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:()=>u.mutate(),disabled:u.isPending,className:"w-full",children:u.isPending?r.jsxs(r.Fragment,{children:[r.jsx(Zr,{className:"h-4 w-4 mr-2 animate-spin"}),"Generating..."]}):r.jsxs(r.Fragment,{children:[r.jsx(Ss,{className:"h-4 w-4 mr-2"}),"Generate Calendar URL"]})})]})})]})]})}var Aae="Tabs",[Ywt]=cc(Aae,[C3]),q7e=C3(),[Xwt,S0e]=Ywt(Aae),V7e=E.forwardRef((e,t)=>{const{__scopeTabs:n,value:s,onValueChange:a,defaultValue:o,orientation:l="horizontal",dir:i,activationMode:u="automatic",...p}=e,x=Sk(i),[y,_]=Ju({prop:s,onChange:a,defaultProp:o??"",caller:Aae});return r.jsx(Xwt,{scope:n,baseId:fd(),value:y,onValueChange:_,orientation:l,dir:x,activationMode:u,children:r.jsx(Fn.div,{dir:x,"data-orientation":l,...p,ref:t})})});V7e.displayName=Aae;var H7e="TabsList",W7e=E.forwardRef((e,t)=>{const{__scopeTabs:n,loop:s=!0,...a}=e,o=S0e(H7e,n),l=q7e(n);return r.jsx(Dxe,{asChild:!0,...l,orientation:o.orientation,dir:o.dir,loop:s,children:r.jsx(Fn.div,{role:"tablist","aria-orientation":o.orientation,...a,ref:t})})});W7e.displayName=H7e;var G7e="TabsTrigger",K7e=E.forwardRef((e,t)=>{const{__scopeTabs:n,value:s,disabled:a=!1,...o}=e,l=S0e(G7e,n),i=q7e(n),u=X7e(l.baseId,s),p=Q7e(l.baseId,s),x=s===l.value;return r.jsx(Rxe,{asChild:!0,...i,focusable:!a,active:x,children:r.jsx(Fn.button,{type:"button",role:"tab","aria-selected":x,"aria-controls":p,"data-state":x?"active":"inactive","data-disabled":a?"":void 0,disabled:a,id:u,...o,ref:t,onMouseDown:un(e.onMouseDown,y=>{!a&&y.button===0&&y.ctrlKey===!1?l.onValueChange(s):y.preventDefault()}),onKeyDown:un(e.onKeyDown,y=>{[" ","Enter"].includes(y.key)&&l.onValueChange(s)}),onFocus:un(e.onFocus,()=>{const y=l.activationMode!=="manual";!x&&!a&&y&&l.onValueChange(s)})})})});K7e.displayName=G7e;var Z7e="TabsContent",Y7e=E.forwardRef((e,t)=>{const{__scopeTabs:n,value:s,forceMount:a,children:o,...l}=e,i=S0e(Z7e,n),u=X7e(i.baseId,s),p=Q7e(i.baseId,s),x=s===i.value,y=E.useRef(x);return E.useEffect(()=>{const _=requestAnimationFrame(()=>y.current=!1);return()=>cancelAnimationFrame(_)},[]),r.jsx(Tc,{present:a||x,children:({present:_})=>r.jsx(Fn.div,{"data-state":x?"active":"inactive","data-orientation":i.orientation,role:"tabpanel","aria-labelledby":u,hidden:!_,id:p,tabIndex:0,...l,ref:t,style:{...e.style,animationDuration:y.current?"0s":void 0},children:_&&o})})});Y7e.displayName=Z7e;function X7e(e,t){return`${e}-trigger-${t}`}function Q7e(e,t){return`${e}-content-${t}`}var Qwt=V7e,J7e=W7e,e9e=K7e,t9e=Y7e;const Ai=Qwt,vi=E.forwardRef(({className:e,...t},n)=>r.jsx(J7e,{ref:n,className:Bt("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",e),...t}));vi.displayName=J7e.displayName;const sn=E.forwardRef(({className:e,...t},n)=>r.jsx(e9e,{ref:n,className:Bt("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",e),...t}));sn.displayName=e9e.displayName;const Mn=E.forwardRef(({className:e,...t},n)=>r.jsx(t9e,{ref:n,className:Bt("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...t}));Mn.displayName=t9e.displayName;const Jwt={first_timer:js,regular:hy,dedicated:zl,veteran:ro,streak_master:ff,century:ro},ejt={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 LSe(e){return e===1?r.jsx(ro,{className:"h-5 w-5 text-yellow-500"}):e===2?r.jsx(hy,{className:"h-5 w-5 text-gray-400"}):e===3?r.jsx(zl,{className:"h-5 w-5 text-amber-600"}):r.jsx("span",{className:"w-5 text-center text-sm font-medium text-muted-foreground",children:e})}function r9e({showUserStats:e=!0,compact:t=!1,brokerageId:n,title:s="Event Leaderboard"}){const{user:a}=tn(),{data:o,isLoading:l}=ARe(t?5:10,n),{data:i}=ERe(a==null?void 0:a.id),{data:u}=PRe(a==null?void 0:a.id),{data:p}=IRe(a==null?void 0:a.id);return l?r.jsxs(Ze,{children:[r.jsx(Wt,{children:r.jsxs(Yt,{className:"flex items-center gap-2",children:[r.jsx(ro,{className:"h-5 w-5 text-yellow-500"}),s]})}),r.jsx(et,{children:r.jsx("div",{className:"space-y-3",children:[...Array(5)].map((x,y)=>r.jsx(Lr,{className:"h-12 w-full"},y))})})]}):r.jsxs(Ze,{children:[r.jsx(Wt,{className:"pb-3",children:r.jsxs(Yt,{className:"flex items-center gap-2",children:[r.jsx(ro,{className:"h-5 w-5 text-yellow-500"}),s]})}),r.jsxs(et,{children:[e&&i&&r.jsxs("div",{className:"mb-4 p-3 rounded-lg bg-primary/5 border border-primary/10",children:[r.jsxs("div",{className:"flex items-center justify-between mb-2",children:[r.jsx("span",{className:"text-sm font-medium",children:"Your Stats"}),u&&r.jsxs(Pt,{variant:"secondary",className:"text-xs",children:["Rank #",u]})]}),r.jsxs("div",{className:"grid grid-cols-3 gap-2 text-center",children:[r.jsxs("div",{children:[r.jsx("div",{className:"text-lg font-bold text-primary",children:i.total_points}),r.jsx("div",{className:"text-xs text-muted-foreground",children:"Points"})]}),r.jsxs("div",{children:[r.jsx("div",{className:"text-lg font-bold",children:i.total_events_attended}),r.jsx("div",{className:"text-xs text-muted-foreground",children:"Events"})]}),r.jsxs("div",{className:"flex items-center justify-center gap-1",children:[r.jsx(ff,{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=Jwt[x.badge_type]||js;return r.jsxs(Pt,{variant:"outline",className:`text-xs ${ejt[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(Pt,{variant:"outline",className:"text-xs",children:["+",p.length-4," more"]})]})]}),r.jsxs(Ai,{defaultValue:"points",className:"w-full",children:[r.jsxs(vi,{className:"w-full mb-3",children:[r.jsx(sn,{value:"points",className:"flex-1",children:"By Points"}),r.jsx(sn,{value:"events",className:"flex-1",children:"By Events"})]}),r.jsx(Mn,{value:"points",className:"mt-0",children:r.jsxs("div",{className:"space-y-2",children:[o==null?void 0:o.map((x,y)=>{var _,b,S;return r.jsxs("div",{className:`flex items-center gap-3 p-2 rounded-lg ${x.user_id===(a==null?void 0:a.id)?"bg-primary/5 border border-primary/10":""} ${y===0?"bg-yellow-500/5":""}`,children:[r.jsx("div",{className:"w-6 flex justify-center",children:LSe(y+1)}),r.jsx(Qs,{className:"h-8 w-8",children:r.jsx(Js,{className:"text-xs",children:((b=(_=x.profile)==null?void 0:_.name)==null?void 0:b.charAt(0))||"?"})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"font-medium text-sm truncate",children:[((S=x.profile)==null?void 0:S.name)||"Unknown",x.user_id===(a==null?void 0:a.id)&&r.jsx("span",{className:"text-xs text-muted-foreground ml-1",children:"(You)"})]}),r.jsxs("div",{className:"text-xs text-muted-foreground",children:[x.total_events_attended," events"]})]}),r.jsxs("div",{className:"text-right",children:[r.jsx("div",{className:"font-bold text-primary",children:x.total_points}),r.jsx("div",{className:"text-xs text-muted-foreground",children:"pts"})]})]},x.user_id)}),(!o||o.length===0)&&r.jsx("div",{className:"text-center text-muted-foreground py-4 text-sm",children:"No attendance data yet. Attend an event to get on the leaderboard!"})]})}),r.jsx(Mn,{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,S;return r.jsxs("div",{className:`flex items-center gap-3 p-2 rounded-lg ${x.user_id===(a==null?void 0:a.id)?"bg-primary/5 border border-primary/10":""} ${y===0?"bg-yellow-500/5":""}`,children:[r.jsx("div",{className:"w-6 flex justify-center",children:LSe(y+1)}),r.jsx(Qs,{className:"h-8 w-8",children:r.jsx(Js,{className:"text-xs",children:((b=(_=x.profile)==null?void 0:_.name)==null?void 0:b.charAt(0))||"?"})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"font-medium text-sm truncate",children:[((S=x.profile)==null?void 0:S.name)||"Unknown",x.user_id===(a==null?void 0:a.id)&&r.jsx("span",{className:"text-xs text-muted-foreground ml-1",children:"(You)"})]}),r.jsxs("div",{className:"text-xs text-muted-foreground",children:[x.total_points," points"]})]}),r.jsxs("div",{className:"text-right",children:[r.jsx("div",{className:"font-bold",children:x.total_events_attended}),r.jsx("div",{className:"text-xs text-muted-foreground",children:"events"})]})]},x.user_id)})})})]})]})]})}function tjt(){const e=Gn(),{user:t,isAdmin:n}=tn(),s=Hr(),{data:a,isLoading:o}=Kt({queryKey:["public-events"],queryFn:async()=>{const{data:k,error:M}=await Q.from("events").select("*").order("event_date",{ascending:!0});if(M)throw M;return k}}),{data:l}=Kt({queryKey:["my-registrations"],queryFn:async()=>{if(!t)return[];const{data:k,error:M}=await Q.from("event_registrations").select("event_id, zoom_join_url").eq("user_id",t.id);if(M)throw M;return k},enabled:!!t}),{data:i}=Kt({queryKey:["event-registration-counts"],queryFn:async()=>{const{data:k,error:M}=await Q.from("event_registrations").select("event_id");if(M)throw M;const P={};return k.forEach(T=>{P[T.event_id]=(P[T.event_id]||0)+1}),P}}),u=ir({mutationFn:async k=>{const{data:M,error:P}=await Q.functions.invoke("zoom-register",{body:{event_id:k}});if(P)throw P;if(M!=null&&M.error)throw new Error(M.error);return M},onSuccess:k=>{s.invalidateQueries({queryKey:["my-registrations"]}),s.invalidateQueries({queryKey:["event-registration-counts"]}),k!=null&&k.join_url?Ie.success("Successfully registered! You'll receive a Zoom confirmation email."):Ie.success("Successfully registered for the event!")},onError:k=>{Ie.error("Failed to register: "+k.message)}}),p=ir({mutationFn:async k=>{const{data:M,error:P}=await Q.functions.invoke("zoom-unregister",{body:{event_id:k}});if(P)throw P;if(M!=null&&M.error)throw new Error(M.error);return M},onSuccess:()=>{s.invalidateQueries({queryKey:["my-registrations"]}),s.invalidateQueries({queryKey:["event-registration-counts"]}),Ie.success("Registration cancelled and removed from Zoom")},onError:k=>{Ie.error("Failed to cancel: "+k.message)}}),x=k=>l==null?void 0:l.some(M=>M.event_id===k),y=k=>{const M=l==null?void 0:l.find(P=>P.event_id===k);return M==null?void 0:M.zoom_join_url},_=k=>k.capacity?((i==null?void 0:i[k.id])||0)>=k.capacity:!1,b=(a==null?void 0:a.filter(k=>ZS(k.event_date)!=="ended"))||[],S=(a==null?void 0:a.filter(k=>ZS(k.event_date)==="ended"))||[];return r.jsx(Dr,{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(Zwt,{}),n&&r.jsx(ee,{variant:"outline",onClick:()=>e("/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..."}):b.length===0?r.jsx(Ze,{className:"text-center py-12",children:r.jsx(et,{children:r.jsx("p",{className:"text-muted-foreground",children:"No upcoming events at the moment. Check back soon!"})})}):r.jsx("div",{className:"grid gap-6 md:grid-cols-2",children:b.map(k=>{const M=ZS(k.event_date),P=Aye(k.event_date),T=M==="live",I=M==="starting_soon";return r.jsxs(Ze,{className:`flex flex-col overflow-hidden cursor-pointer hover:shadow-lg transition-all ${T?"border-red-500 ring-2 ring-red-500/20":I?"border-amber-500 ring-2 ring-amber-500/20":"hover:border-primary/50"}`,onClick:()=>e(`/events/${k.id}`),children:[P&&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(Bj,{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"]})]}),k.image_url&&r.jsx(Kwt,{ratio:3/2,className:"overflow-hidden",children:r.jsx("img",{src:k.image_url,alt:k.title,className:"w-full h-full object-cover group-hover:scale-105 transition-transform"})}),r.jsxs(Wt,{children:[r.jsx(Yt,{className:"line-clamp-2",children:k.title}),k.description&&r.jsx(Sn,{className:"line-clamp-2",children:k.description.replace(/<[^>]*>/g,"")})]}),r.jsxs(et,{className:"flex-1 space-y-2",children:[r.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[r.jsx(Ss,{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(k.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"}),OE(new Date(k.event_date))]}),r.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[r.jsx(Un,{className:"h-4 w-4"}),(i==null?void 0:i[k.id])||0," registered",k.capacity&&` / ${k.capacity} spots`]})]}),r.jsx(PA,{className:"flex gap-2",onClick:z=>z.stopPropagation(),children:x(k.id)?r.jsxs(r.Fragment,{children:[r.jsxs(ee,{variant:"outline",className:"flex-1",onClick:()=>p.mutate(k.id),disabled:p.isPending,children:[r.jsx(hs,{className:"h-4 w-4 mr-2"}),"Cancel"]}),r.jsxs(ee,{className:"flex-1",onClick:()=>window.open(y(k.id)||k.zoom_link,"_blank"),children:[r.jsx(As,{className:"h-4 w-4 mr-2"}),"Join Zoom"]})]}):r.jsx(ee,{className:"w-full",onClick:()=>u.mutate(k.id),disabled:u.isPending||_(k),children:_(k)?"Event Full":r.jsxs(r.Fragment,{children:[r.jsx(Ni,{className:"h-4 w-4 mr-2"}),"Register"]})})})]},k.id)})}),S.length>0&&r.jsxs("div",{className:"mt-12",children:[r.jsx("h3",{className:"text-xl font-semibold mb-4 text-muted-foreground",children:"Past Events"}),r.jsx("div",{className:"grid gap-4 md:grid-cols-2",children:S.map(k=>r.jsx(Ze,{className:"opacity-60 cursor-pointer hover:opacity-80 transition-opacity",onClick:()=>e(`/events/${k.id}`),children:r.jsxs(Wt,{children:[r.jsx(Yt,{className:"text-base line-clamp-1",children:k.title}),r.jsx(Sn,{children:new Intl.DateTimeFormat("en-US",{year:"numeric",month:"long",day:"numeric",timeZone:"America/New_York"}).format(new Date(k.event_date))})]})},k.id))})]})]}),n&&r.jsx("div",{className:"lg:col-span-1",children:r.jsx(r9e,{showUserStats:!0})})]})]})})}const jde=[{value:"all",label:"All Roles",icon:Un},{value:"brokerage_manager",label:"Brokerage Managers",icon:MA},{value:"admin",label:"Admins",icon:yf}];function rjt({open:e,onOpenChange:t,resourceType:n,resourceId:s,resourceTitle:a}){var ot,Mt;const{user:o,isAdmin:l,isBrokerageManager:i}=tn(),[u,p]=E.useState([]),[x,y]=E.useState([]),[_,b]=E.useState([]),[S,k]=E.useState([]),[M,P]=E.useState(""),[T,I]=E.useState(""),[z,D]=E.useState(""),[U,V]=E.useState(!1),[W,G]=E.useState(!1),[J,ne]=E.useState("agents"),[oe,ge]=E.useState("all"),[ie,pe]=E.useState({}),se=l||i;E.useEffect(()=>{e&&o&&(l?fe():he())},[e,o,l]),E.useEffect(()=>{e||(b([]),k([]),P(""),I(""),D(""),ne("agents"),ge("all"))},[e]);const fe=async()=>{if(o){V(!0);try{const{data:Oe,error:at}=await Q.from("brokerages").select("id, name").order("name");if(at)throw at;const le=1e3,Ve={};let Qe=0,st=!0;for(;st;){const{data:Ce,error:Me}=await Q.from("profiles").select("brokerage_id").range(Qe*le,(Qe+1)*le-1);if(Me)throw Me;Ce==null||Ce.forEach(Ge=>{Ge.brokerage_id&&(Ve[Ge.brokerage_id]=(Ve[Ge.brokerage_id]||0)+1)}),st=(Ce==null?void 0:Ce.length)===le,Qe++}y((Oe==null?void 0:Oe.map(Ce=>({...Ce,agent_count:Ve[Ce.id]||0})))||[]);const ke=[];for(Qe=0,st=!0;st;){const{data:Ce,error:Me}=await Q.from("profiles").select("id, name, email, brokerage_id, brokerages(name)").neq("id",o.id).order("name").range(Qe*le,(Qe+1)*le-1);if(Me)throw Me;Ce&&ke.push(...Ce),st=(Ce==null?void 0:Ce.length)===le,Qe++}const ct={};for(Qe=0,st=!0;st;){const{data:Ce,error:Me}=await Q.from("user_roles").select("user_id, role").range(Qe*le,(Qe+1)*le-1);if(Me)throw Me;Ce==null||Ce.forEach(Ge=>{ct[Ge.user_id]||(ct[Ge.user_id]=[]),ct[Ge.user_id].push(Ge.role)}),st=(Ce==null?void 0:Ce.length)===le,Qe++}pe(ct),p(ke.map(Ce=>{var Me;return{id:Ce.id,name:Ce.name,email:Ce.email,brokerage_name:((Me=Ce.brokerages)==null?void 0:Me.name)||"No Brokerage",roles:ct[Ce.id]||[]}}))}catch(Oe){console.error("Error loading data:",Oe),Ie.error("Failed to load agents and brokerages")}finally{V(!1)}}},he=async()=>{if(o){V(!0);try{const{data:Oe}=await Q.from("profiles").select("brokerage_id").eq("id",o.id).single();if(!(Oe!=null&&Oe.brokerage_id)){Ie.error("You must be part of a brokerage to share resources"),t(!1);return}const{data:at,error:le}=await Q.from("profiles").select("id, name, email").eq("brokerage_id",Oe.brokerage_id).neq("id",o.id).order("name");if(le)throw le;p(at||[])}catch(Oe){console.error("Error loading agents:",Oe),Ie.error("Failed to load agents")}finally{V(!1)}}},ye=u.filter(Oe=>{var le;const at=Oe.name.toLowerCase().includes(M.toLowerCase())||Oe.email.toLowerCase().includes(M.toLowerCase())||((le=Oe.brokerage_name)==null?void 0:le.toLowerCase().includes(M.toLowerCase()));if(l&&oe!=="all"){const Ve=ie[Oe.id]||[];return at&&Ve.includes(oe)}return at}),Ae=x.filter(Oe=>Oe.name.toLowerCase().includes(T.toLowerCase())),we=()=>{_.length===ye.length?b([]):b(ye.map(Oe=>Oe.id))},be=()=>{S.length===Ae.length?k([]):k(Ae.map(Oe=>Oe.id))},_e=Oe=>{if(!se){b([Oe]);return}b(at=>at.includes(Oe)?at.filter(le=>le!==Oe):[...at,Oe])},Je=Oe=>{k(at=>at.includes(Oe)?at.filter(le=>le!==Oe):[...at,Oe])},Te=async()=>{if(!(_.length>0||S.length>0)){Ie.error("Please select at least one agent or brokerage to share with");return}G(!0);try{const{data:at,error:le}=await Q.functions.invoke("send-share-notification",{body:{recipientIds:_,brokerageIds:S,resourceType:n,resourceId:s,resourceTitle:a,message:z.trim()||void 0}});if(le)throw le;const Ve=(at==null?void 0:at.sharesCreated)||_.length;Ie.success(`Shared with ${Ve} agent${Ve!==1?"s":""}`),t(!1)}catch(at){console.error("Error sharing resource:",at),Ie.error("Failed to share resource")}finally{G(!1)}},De=Oe=>Oe.split(" ").map(at=>at[0]).join("").toUpperCase().slice(0,2),Ue=Oe=>{const at=ie[Oe]||[];return at.includes("admin")?r.jsx(Pt,{variant:"secondary",className:"text-[10px] px-1.5 py-0",children:"Admin"}):at.includes("brokerage_manager")?r.jsx(Pt,{variant:"outline",className:"text-[10px] px-1.5 py-0",children:"Manager"}):null},Be=_.length+S.length,qe=oe!=="all"?ye.length:null;return r.jsx(Or,{open:e,onOpenChange:t,children:r.jsxs(Ir,{className:"sm:max-w-lg max-h-[90vh] overflow-hidden flex flex-col",children:[r.jsxs($r,{className:"flex-shrink-0",children:[r.jsxs(Fr,{className:"flex items-center gap-2",children:[r.jsx(lo,{className:"h-5 w-5 text-primary"}),"Share Resource"]}),r.jsxs(Zn,{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(Ai,{value:J,onValueChange:ne,className:"flex-1 flex flex-col overflow-hidden",children:[r.jsxs(vi,{className:"grid w-full grid-cols-2 flex-shrink-0",children:[r.jsxs(sn,{value:"agents",className:"flex items-center gap-2",children:[r.jsx(Un,{className:"h-4 w-4"}),r.jsx("span",{children:"Agents"}),_.length>0&&r.jsx(Pt,{variant:"default",className:"h-5 min-w-5 px-1.5 text-xs",children:_.length})]}),r.jsxs(sn,{value:"brokerages",className:"flex items-center gap-2",children:[r.jsx(hi,{className:"h-4 w-4"}),r.jsx("span",{children:"Brokerages"}),S.length>0&&r.jsx(Pt,{variant:"default",className:"h-5 min-w-5 px-1.5 text-xs",children:S.length})]})]}),r.jsxs(Mn,{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(Sa,{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:M,onChange:Oe=>P(Oe.target.value),className:"pl-9"})]}),r.jsxs(mn,{value:oe,onValueChange:ge,children:[r.jsxs(fn,{className:"w-[180px]",children:[r.jsx(V1,{className:"h-4 w-4 mr-2 text-muted-foreground"}),r.jsx(yn,{placeholder:"Filter by role"})]}),r.jsx(pn,{children:jde.map(Oe=>r.jsx(qt,{value:Oe.value,children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Oe.icon,{className:"h-4 w-4"}),r.jsx("span",{children:Oe.label})]})},Oe.value))})]})]}),r.jsxs("div",{className:"flex items-center justify-between px-1 flex-shrink-0",children:[r.jsxs(ee,{variant:"ghost",size:"sm",onClick:we,className:"text-xs h-8",disabled:ye.length===0,children:[r.jsx(Un,{className:"h-3.5 w-3.5 mr-1.5"}),_.length===ye.length&&ye.length>0?"Deselect All":"Select All"]}),r.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[qe!==null&&r.jsxs("span",{className:"text-primary font-medium",children:[qe," ",(ot=jde.find(Oe=>Oe.value===oe))==null?void 0:ot.label]}),r.jsxs("span",{className:"font-medium",children:[_.length," selected"]})]})]}),r.jsx(Bo,{className:"h-[300px] border rounded-lg",children:U?r.jsx("div",{className:"flex items-center justify-center h-[200px]",children:r.jsx(Zr,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):ye.length===0?r.jsxs("div",{className:"flex flex-col items-center justify-center h-[200px] text-muted-foreground",children:[r.jsx(Un,{className:"h-8 w-8 mb-2 opacity-50"}),r.jsx("p",{className:"text-sm",children:oe!=="all"?`No ${(Mt=jde.find(Oe=>Oe.value===oe))==null?void 0:Mt.label.toLowerCase()} found`:"No agents found"})]}):r.jsx("div",{className:"p-2 space-y-1",children:ye.map(Oe=>r.jsxs("div",{className:`flex items-center gap-3 p-2.5 rounded-lg cursor-pointer hover:bg-accent/50 transition-colors ${_.includes(Oe.id)?"bg-accent":""}`,onClick:()=>_e(Oe.id),children:[r.jsx(Bl,{checked:_.includes(Oe.id),onCheckedChange:()=>_e(Oe.id),className:"flex-shrink-0"}),r.jsx(Qs,{className:"h-9 w-9 flex-shrink-0",children:r.jsx(Js,{className:"text-xs bg-primary/10 text-primary",children:De(Oe.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:Oe.name}),Ue(Oe.id)]}),r.jsxs("p",{className:"text-xs text-muted-foreground truncate",children:[Oe.email,Oe.brokerage_name&&r.jsxs("span",{className:"ml-1 opacity-75",children:["• ",Oe.brokerage_name]})]})]})]},Oe.id))})})]}),r.jsxs(Mn,{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(Sa,{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:Oe=>I(Oe.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(hi,{className:"h-3.5 w-3.5 mr-1.5"}),S.length===Ae.length&&Ae.length>0?"Deselect All":"Select All"]}),r.jsxs("span",{className:"text-xs text-muted-foreground font-medium",children:[S.length," selected"]})]}),r.jsx("p",{className:"text-xs text-muted-foreground px-1 flex-shrink-0",children:"Selecting a brokerage will send to all agents in that brokerage."}),r.jsx(Bo,{className:"h-[250px] border rounded-lg",children:U?r.jsx("div",{className:"flex items-center justify-center h-[180px]",children:r.jsx(Zr,{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(hi,{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(Oe=>r.jsxs("div",{className:`flex items-center gap-3 p-2.5 rounded-lg cursor-pointer hover:bg-accent/50 transition-colors ${S.includes(Oe.id)?"bg-accent":""}`,onClick:()=>Je(Oe.id),children:[r.jsx(Bl,{checked:S.includes(Oe.id),onCheckedChange:()=>Je(Oe.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(hi,{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:Oe.name}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[Oe.agent_count," agent",Oe.agent_count!==1?"s":""]})]})]},Oe.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(Sa,{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:M,onChange:Oe=>P(Oe.target.value),className:"pl-9"})]}),se&&r.jsxs("div",{className:"flex items-center justify-between px-1 flex-shrink-0",children:[r.jsxs(ee,{variant:"ghost",size:"sm",onClick:we,className:"text-xs h-8",disabled:ye.length===0,children:[r.jsx(Un,{className:"h-3.5 w-3.5 mr-1.5"}),_.length===ye.length&&ye.length>0?"Deselect All":"Select All"]}),r.jsxs("span",{className:"text-xs text-muted-foreground font-medium",children:[_.length," selected"]})]}),r.jsx(Bo,{className:"h-[300px] border rounded-lg",children:U?r.jsx("div",{className:"flex items-center justify-center h-[200px]",children:r.jsx(Zr,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):ye.length===0?r.jsxs("div",{className:"flex flex-col items-center justify-center h-[200px] text-muted-foreground",children:[r.jsx(Un,{className:"h-8 w-8 mb-2 opacity-50"}),r.jsx("p",{className:"text-sm",children:"No agents found"})]}):r.jsx("div",{className:"p-2 space-y-1",children:ye.map(Oe=>r.jsxs("div",{className:`flex items-center gap-3 p-2.5 rounded-lg cursor-pointer hover:bg-accent/50 transition-colors ${_.includes(Oe.id)?"bg-accent":""}`,onClick:()=>_e(Oe.id),children:[r.jsx(Bl,{checked:_.includes(Oe.id),onCheckedChange:()=>_e(Oe.id),className:"flex-shrink-0"}),r.jsx(Qs,{className:"h-9 w-9 flex-shrink-0",children:r.jsx(Js,{className:"text-xs bg-primary/10 text-primary",children:De(Oe.name)})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"text-sm font-medium truncate",children:Oe.name}),r.jsx("p",{className:"text-xs text-muted-foreground truncate",children:Oe.email})]})]},Oe.id))})})]}),r.jsxs("div",{className:"space-y-2 flex-shrink-0",children:[r.jsx($e,{htmlFor:"message",className:"text-sm font-medium",children:"Add a message (optional)"}),r.jsx(Jn,{id:"message",placeholder:"I thought you might find this useful...",value:z,onChange:Oe=>D(Oe.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:()=>t(!1),children:"Cancel"}),r.jsx(ee,{onClick:Te,disabled:Be===0||W,children:W?r.jsxs(r.Fragment,{children:[r.jsx(Zr,{className:"h-4 w-4 mr-2 animate-spin"}),"Sharing..."]}):r.jsxs(r.Fragment,{children:[r.jsx(lo,{className:"h-4 w-4 mr-2"}),"Share"]})})]})]})]})})}function O3({resourceType:e,resourceId:t,resourceTitle:n,variant:s="outline",size:a="sm",className:o=""}){const[l,i]=E.useState(!1),{user:u}=tn();return u?r.jsxs(r.Fragment,{children:[r.jsxs(ee,{variant:s,size:a,onClick:()=>i(!0),className:o,children:[r.jsx(Nc,{className:"h-4 w-4 mr-2"}),"Share"]}),r.jsx(rjt,{open:l,onOpenChange:i,resourceType:e,resourceId:t,resourceTitle:n})]}):null}function njt(){const{eventId:e}=md(),t=Gn(),{user:n}=tn(),[s,a]=E.useState(null),[o,l]=E.useState(null),[i,u]=E.useState(0),[p,x]=E.useState(!0),[y,_]=E.useState(!1);E.useEffect(()=>{e&&b()},[e,n]);const b=async()=>{try{const{data:I,error:z}=await Q.from("events").select("*").eq("id",e).single();if(z)throw z;a(I);const{count:D}=await Q.from("event_registrations").select("*",{count:"exact",head:!0}).eq("event_id",e);if(u(D||0),n){const{data:U}=await Q.from("event_registrations").select("id, zoom_join_url").eq("event_id",e).eq("user_id",n.id).maybeSingle();l(U)}}catch(I){console.error("Error loading event:",I),Ie.error("Failed to load event"),t("/events")}finally{x(!1)}},S=async()=>{if(!(!n||!s)){_(!0);try{if(o){const{error:I}=await Q.functions.invoke("zoom-unregister",{body:{event_id:s.id}});if(I)throw I;Ie.success("Successfully cancelled registration"),l(null),u(z=>z-1)}else{const{data:I,error:z}=await Q.functions.invoke("zoom-register",{body:{event_id:s.id}});if(z)throw z;Ie.success("Successfully registered for event!"),l({id:I.registration_id,zoom_join_url:I.zoom_join_url}),u(D=>D+1)}}catch(I){console.error("Registration error:",I),Ie.error(o?"Failed to cancel registration":"Failed to register for event")}finally{_(!1)}}},k=I=>{var z,D,U;if(I.includes("iframe.mediadelivery.net")||I.includes("video.bunnycdn.com")){const V=I.match(/embed\/(\d+)\/([a-f0-9-]+)/);if(V)return`https://iframe.mediadelivery.net/embed/${V[1]}/${V[2]}?autoplay=false&preload=true`}if(I.includes("youtube.com")||I.includes("youtu.be")){const V=I.includes("youtu.be")?(z=I.split("youtu.be/")[1])==null?void 0:z.split("?")[0]:(D=I.split("v=")[1])==null?void 0:D.split("&")[0];if(V)return`https://www.youtube.com/embed/${V}`}if(I.includes("vimeo.com")){const V=(U=I.split("vimeo.com/")[1])==null?void 0:U.split("?")[0];if(V)return`https://player.vimeo.com/video/${V}`}return I};if(p)return r.jsx(Dr,{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(Dr,{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:()=>t("/events"),className:"mt-4",children:"Back to Events"})]})});const M=Wft(new Date(s.event_date)),P=s.capacity&&i>=s.capacity,T=(o==null?void 0:o.zoom_join_url)||s.zoom_link;return r.jsx(Dr,{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:()=>t("/events"),children:[r.jsx(po,{className:"h-4 w-4"}),"Back to Events"]}),s.image_url&&r.jsxs("div",{className:"relative aspect-video rounded-xl overflow-hidden mb-6",children:[r.jsx("img",{src:s.image_url,alt:s.title,className:"w-full h-full object-cover"}),M&&r.jsx("div",{className:"absolute inset-0 bg-black/50 flex items-center justify-center",children:r.jsx(Pt,{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(O3,{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(rp,{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:k(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(Ze,{children:r.jsxs(et,{className:"p-6 space-y-4",children:[r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx(Ss,{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:OE(new Date(s.event_date))})]})]}),s.capacity&&r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx(Un,{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(di,{className:"h-5 w-5 text-green-600"}),r.jsx("span",{className:"text-sm font-medium text-green-700",children:"You're registered!"})]}),r.jsxs("div",{className:"space-y-2 pt-2",children:[!M&&r.jsx(r.Fragment,{children:o?r.jsxs(r.Fragment,{children:[r.jsxs(ee,{className:"w-full gap-2",onClick:()=>window.open(T,"_blank"),children:[r.jsx(As,{className:"h-4 w-4"}),"Join Event"]}),r.jsxs(ee,{variant:"outline",className:"w-full",onClick:S,disabled:y,children:[y?r.jsx(Zr,{className:"h-4 w-4 animate-spin mr-2"}):null,"Cancel Registration"]})]}):r.jsx(ee,{className:"w-full gap-2",onClick:S,disabled:y||(P??!1),children:y?r.jsx(Zr,{className:"h-4 w-4 animate-spin"}):P?"Event Full":"Register Now"})}),M&&o&&r.jsxs(ee,{variant:"outline",className:"w-full gap-2",onClick:()=>window.open(s.zoom_link,"_blank"),children:[r.jsx(As,{className:"h-4 w-4"}),"View Recording"]})]})]})})})]})]})})}const sjt=()=>{const{user:e,isAdmin:t}=tn(),n=Gn(),[s,a]=E.useState([]),[o,l]=E.useState(!0),[i,u]=E.useState(""),[p,x]=E.useState("all"),[y,_]=E.useState(new Set);E.useEffect(()=>{b()},[e]);const b=async()=>{try{const{data:T}=await Q.from("user_tags").select("tag").eq("user_id",e==null?void 0:e.id),I=(T==null?void 0:T.map(J=>J.tag))||[],{data:z,error:D}=await Q.from("app_tiles").select("*").order("name");if(D)throw D;const{data:U}=await Q.from("user_favorites").select("app_id").eq("user_id",e==null?void 0:e.id),V=new Set((U==null?void 0:U.map(J=>J.app_id))||[]);_(V);const G=((z==null?void 0:z.filter(J=>!J.required_tags||J.required_tags.length===0?!0:J.required_tags.some(ne=>I.includes(ne))))||[]).sort((J,ne)=>J.name==="LevelUp Members Portal"?-1:ne.name==="LevelUp Members Portal"?1:0);a(G)}catch(T){console.error("Error loading apps:",T),Ie.error("Failed to load apps")}finally{l(!1)}},S=async T=>{var z;const I=window.open("about:blank","_blank");try{const{data:D,error:U}=await Q.auth.getSession();if(U||!D.session){I==null||I.close(),Ie.error("Session expired. Please refresh the page and try again.");return}const V=D.session.access_token;await Q.from("activity_logs").insert({user_id:e==null?void 0:e.id,app_id:T.app_id,app_name:T.name,user_agent:navigator.userAgent});const{data:W,error:G}=await Q.functions.invoke("sso-launch",{body:{app_id:T.app_id},headers:{Authorization:`Bearer ${V}`}});if(G)throw G;W!=null&&W.redirect_url?I&&!I.closed?(I.location.href=W.redirect_url,(z=I.focus)==null||z.call(I)):window.location.assign(W.redirect_url):(I==null||I.close(),Ie.error("Launch link unavailable"))}catch(D){I==null||I.close(),console.error("Error launching app:",D),Ie.error("Failed to launch app. Please try again.")}},k=async(T,I)=>{T.stopPropagation();const z=y.has(I);try{if(z){const{error:D}=await Q.from("user_favorites").delete().eq("user_id",e==null?void 0:e.id).eq("app_id",I);if(D)throw D;_(U=>{const V=new Set(U);return V.delete(I),V}),Ie.success("Removed from favorites")}else{const{error:D}=await Q.from("user_favorites").insert({user_id:e==null?void 0:e.id,app_id:I});if(D)throw D;_(U=>new Set(U).add(I)),Ie.success("Added to favorites")}}catch(D){console.error("Error toggling favorite:",D),Ie.error("Failed to update favorites")}},M=s.filter(T=>{var z;const I=T.name.toLowerCase().includes(i.toLowerCase())||((z=T.description)==null?void 0:z.toLowerCase().includes(i.toLowerCase()));return p==="favorites"?I&&y.has(T.id):I}),P=[{id:"all",label:"All"},{id:"favorites",label:"Favorites"}];return o?r.jsx(Dr,{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(Dr,{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(Sa,{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=>u(T.target.value)})]})]}),r.jsx("div",{className:"flex gap-6 border-b border-border mb-8",children:P.map(T=>r.jsxs("button",{onClick:()=>x(T.id),className:Bt("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))}),M.length===0?r.jsx("div",{className:"flex flex-col items-center justify-center py-16 bg-card rounded-xl border border-border",children:p==="favorites"?r.jsxs(r.Fragment,{children:[r.jsx(Sm,{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(hp,{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:t?"Get started by adding apps in the admin panel":"Contact your administrator to get access to apps"}),t&&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:M.map(T=>{const I=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:()=>S(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:Bt("flex-shrink-0 p-1 transition-colors",I?"text-primary":"text-muted-foreground/50 hover:text-primary"),onClick:D=>k(D,T.id),children:r.jsx(Sm,{className:Bt("h-5 w-5",I&&"fill-current")})})]}),z&&r.jsx("a",{href:"https://forms.gle/vXnrzgSnPbw7CKPV6",target:"_blank",rel:"noopener noreferrer",onClick:D=>D.stopPropagation(),className:"mt-3 text-sm text-primary hover:underline flex items-center gap-1",children:"Create your account with this link →"})]},T.id)})})]})},ajt=()=>{const e=Gn(),[t,n]=E.useState(""),[s,a]=E.useState("all"),[o,l]=E.useState("all"),[i,u]=E.useState("grid"),{data:p=[]}=Kt({queryKey:["template-categories"],queryFn:async()=>{const{data:P,error:T}=await Q.from("template_categories").select("*").order("name");if(T)throw T;return P}}),{data:x=[]}=Kt({queryKey:["template-types"],queryFn:async()=>{const{data:P,error:T}=await Q.from("template_types").select("*").order("name");if(T)throw T;return P}}),{data:y=[],isLoading:_}=Kt({queryKey:["canva-templates"],queryFn:async()=>{const{data:P,error:T}=await Q.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:I,error:z}=await Q.from("template_links").select("*").order("sort_order");if(z)throw z;const{data:D}=await Q.from("template_likes").select("template_id"),{data:U}=await Q.from("template_comments").select("template_id"),V=new Map;D==null||D.forEach(J=>{V.set(J.template_id,(V.get(J.template_id)||0)+1)});const W=new Map;return U==null||U.forEach(J=>{W.set(J.template_id,(W.get(J.template_id)||0)+1)}),(P||[]).map(J=>({...J,links:(I||[]).filter(ne=>ne.template_id===J.id)||[],likesCount:V.get(J.id)||0,commentsCount:W.get(J.id)||0}))}}),b=y.filter(P=>{var D;const T=P.name.toLowerCase().includes(t.toLowerCase())||((D=P.description)==null?void 0:D.toLowerCase().includes(t.toLowerCase())),I=s==="all"||P.category_id===s,z=o==="all"||P.type_id===o;return T&&I&&z}),S=()=>{n(""),a("all"),l("all")},k=t||s!=="all"||o!=="all",M=P=>{e(`/templates/${P}`)};return r.jsx(Dr,{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(Sa,{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:t,onChange:P=>n(P.target.value),className:"pl-9"})]}),r.jsxs(mn,{value:s,onValueChange:a,children:[r.jsx(fn,{className:"w-full sm:w-48",children:r.jsx(yn,{placeholder:"All Categories"})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"all",children:"All Categories"}),p.map(P=>r.jsx(qt,{value:P.id,children:P.name},P.id))]})]}),r.jsxs(mn,{value:o,onValueChange:l,children:[r.jsx(fn,{className:"w-full sm:w-48",children:r.jsx(yn,{placeholder:"All Types"})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"all",children:"All Types"}),x.map(P=>r.jsx(qt,{value:P.id,children:P.name},P.id))]})]}),r.jsxs("div",{className:"flex gap-2",children:[k&&r.jsx(ee,{variant:"outline",size:"sm",onClick:S,children:"Clear Filters"}),r.jsxs("div",{className:"flex gap-1",children:[r.jsx(ee,{variant:i==="grid"?"secondary":"outline",size:"icon",onClick:()=>u("grid"),className:"rounded-full",children:r.jsx(dp,{className:"h-4 w-4"})}),r.jsx(ee,{variant:i==="list"?"secondary":"outline",size:"icon",onClick:()=>u("list"),className:"rounded-full",children:r.jsx(up,{className:"h-4 w-4"})})]})]})]}),r.jsxs("div",{className:"text-sm text-muted-foreground",children:[b.length," template",b.length!==1?"s":""," found"]}),_&&r.jsx("div",{className:i==="grid"?"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6":"space-y-4",children:[...Array(8)].map((P,T)=>r.jsx(Ze,{children:r.jsxs(et,{className:"p-4",children:[r.jsx(Lr,{className:"aspect-[4/3] w-full rounded-lg mb-4"}),r.jsx(Lr,{className:"h-5 w-3/4 mb-2"}),r.jsx(Lr,{className:"h-4 w-full mb-4"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(Lr,{className:"h-5 w-16"}),r.jsx(Lr,{className:"h-5 w-20"})]})]})},T))}),!_&&b.length===0&&r.jsxs("div",{className:"text-center py-12",children:[r.jsx("div",{className:"text-muted-foreground mb-4",children:k?"No templates match your filters":"No templates available yet"}),k&&r.jsx(ee,{variant:"outline",onClick:S,children:"Clear Filters"})]}),!_&&b.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:b.map(P=>r.jsxs(Ze,{className:`group overflow-hidden hover:shadow-lg transition-all duration-200 cursor-pointer ${i==="list"?"flex flex-row":""}`,onClick:()=>M(P.id),children:[r.jsxs("div",{className:`relative overflow-hidden bg-muted ${i==="list"?"w-48 shrink-0":"aspect-[3/2]"}`,children:[P.preview_image_url?r.jsx("img",{src:P.preview_image_url,alt:P.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"}),P.links.length>1&&r.jsx("div",{className:"absolute top-2 right-2",children:r.jsxs(Pt,{variant:"secondary",className:"gap-1 bg-background/90 backdrop-blur-sm !text-secondary",children:[r.jsx(Io,{className:"h-3 w-3"}),P.links.length]})})]}),r.jsxs(et,{className:`p-4 flex flex-col ${i==="list"?"flex-1":""}`,children:[r.jsx("h3",{className:"font-semibold text-foreground line-clamp-1 mb-1",children:P.name}),P.description&&r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 mb-3 flex-1",children:xse(P.description)}),r.jsxs("div",{className:"flex flex-wrap gap-2 mb-3",children:[P.category&&r.jsx(Pt,{variant:"secondary",className:"text-xs",children:P.category.name}),P.type&&r.jsx(Pt,{variant:"outline",className:"text-xs",children:P.type.name})]}),r.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground mb-3",children:[r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(zd,{className:"h-3.5 w-3.5"}),P.likesCount]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Ul,{className:"h-3.5 w-3.5"}),P.commentsCount]})]}),r.jsxs(ee,{size:"sm",className:"w-full gap-2",onClick:T=>{T.stopPropagation(),M(P.id)},children:[r.jsx(As,{className:"h-4 w-4"}),"View Template"]})]})]},P.id))})]})})};var ijt="Separator",OSe="horizontal",ojt=["horizontal","vertical"],n9e=E.forwardRef((e,t)=>{const{decorative:n,orientation:s=OSe,...a}=e,o=ljt(s)?s:OSe,i=n?{role:"none"}:{"aria-orientation":o==="vertical"?o:void 0,role:"separator"};return r.jsx(Fn.div,{"data-orientation":o,...i,...a,ref:t})});n9e.displayName=ijt;function ljt(e){return ojt.includes(e)}var s9e=n9e;const Ld=E.forwardRef(({className:e,orientation:t="horizontal",decorative:n=!0,...s},a)=>r.jsx(s9e,{ref:a,decorative:n,orientation:t,className:Bt("shrink-0 bg-border",t==="horizontal"?"h-[1px] w-full":"h-full w-[1px]",e),...s}));Ld.displayName=s9e.displayName;const hP=()=>({trackEngagement:E.useCallback(async(t,n,s,a="view")=>{try{const{data:{user:o}}=await Q.auth.getUser();if(!o)return;await Q.from("content_engagement_logs").insert({user_id:o.id,resource_type:t,resource_id:n,resource_title:s,action_type:a})}catch(o){console.error("Error tracking engagement:",o)}},[])}),cjt=()=>{const{templateId:e}=md(),{user:t,isAdmin:n}=tn(),{toast:s}=_i(),a=Hr(),{trackEngagement:o}=hP(),[l,i]=E.useState(""),{data:u,isLoading:p}=Kt({queryKey:["template-detail",e],queryFn:async()=>{const{data:T,error:I}=await Q.from("canva_templates").select(` *, category:template_categories(id, name), type:template_types(id, name) `).eq("id",e).single();if(I)throw I;const{data:z}=await Q.from("template_links").select("*").eq("template_id",e).order("sort_order"),{data:D}=await Q.from("template_guides").select("*").eq("template_id",e).order("sort_order");return{...T,links:z||[],guides:D||[]}},enabled:!!e});E.useEffect(()=>{u&&o("template",u.id,u.name,"view")},[u==null?void 0:u.id]);const{data:x=[]}=Kt({queryKey:["template-likes",e],queryFn:async()=>{const{data:T,error:I}=await Q.from("template_likes").select("*").eq("template_id",e);if(I)throw I;return T},enabled:!!e}),{data:y=[]}=Kt({queryKey:["template-comments",e],queryFn:async()=>{const{data:T,error:I}=await Q.from("template_comments").select("*").eq("template_id",e).order("created_at",{ascending:!1});if(I)throw I;const z=[...new Set(T.map(V=>V.user_id))],{data:D}=await Q.from("profiles").select("id, name").in("id",z),U=new Map((D==null?void 0:D.map(V=>[V.id,V.name]))||[]);return T.map(V=>({...V,user_name:U.get(V.user_id)||"Unknown User"}))},enabled:!!e}),_=ir({mutationFn:async T=>{const{error:I}=await Q.from("template_comments").insert({template_id:e,user_id:t.id,content:T});if(I)throw I},onSuccess:()=>{a.invalidateQueries({queryKey:["template-comments",e]}),i(""),s({title:"Comment added!"})},onError:T=>{s({title:"Error adding comment",description:T.message,variant:"destructive"})}}),b=ir({mutationFn:async T=>{const{error:I}=await Q.from("template_comments").delete().eq("id",T);if(I)throw I},onSuccess:()=>{a.invalidateQueries({queryKey:["template-comments",e]}),s({title:"Comment deleted"})}}),S=ir({mutationFn:async()=>{const T=x.find(I=>I.user_id===(t==null?void 0:t.id));if(T){const{error:I}=await Q.from("template_likes").delete().eq("id",T.id);if(I)throw I}else{const{error:I}=await Q.from("template_likes").insert({template_id:e,user_id:t.id});if(I)throw I}},onSuccess:()=>{a.invalidateQueries({queryKey:["template-likes",e]})}}),k=x.some(T=>T.user_id===(t==null?void 0:t.id)),M=T=>T.split(" ").map(I=>I[0]).join("").toUpperCase().slice(0,2),P=T=>{T.preventDefault(),!(!l.trim()||!t)&&_.mutate(l.trim())};return p?r.jsx(Dr,{title:"Templates",children:r.jsx("div",{className:"flex justify-center py-12",children:r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})})}):u?r.jsx(Dr,{title:u.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(oo,{to:"/templates",children:[r.jsx(po,{className:"h-4 w-4"}),"Back to Templates"]})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx("h1",{className:"text-2xl font-bold text-foreground",children:u.name}),r.jsxs("div",{className:"flex flex-wrap gap-2",children:[u.category&&r.jsx(Pt,{variant:"secondary",children:u.category.name}),u.type&&r.jsx(Pt,{variant:"outline",children:u.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(oo,{to:`/admin/templates?edit=${u.id}`,children:[r.jsx(ni,{className:"h-4 w-4"}),r.jsx("span",{children:"Edit"})]})}),r.jsx(O3,{resourceType:"template",resourceId:u.id,resourceTitle:u.name,size:"default",className:"rounded-full"}),r.jsxs(ee,{variant:k?"default":"outline",className:"gap-2 rounded-full",onClick:()=>S.mutate(),disabled:!t||S.isPending,children:[r.jsx(zd,{className:`h-4 w-4 ${k?"fill-current":""}`}),x.length," ",x.length===1?"Like":"Likes"]})]})]}),u.description&&r.jsx("div",{className:"text-muted-foreground prose prose-sm max-w-none dark:prose-invert [&>p]:mb-4 [&>p:last-child]:mb-0 whitespace-pre-line",dangerouslySetInnerHTML:{__html:u.description}})]}),r.jsx(Ze,{children:r.jsxs(et,{className:"pt-6",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 mb-4",children:[r.jsx(Io,{className:"h-4 w-4"}),u.links.length===1?"Template Link":"Template Links"]}),r.jsx("div",{className:"grid gap-2",children:u.links.map(T=>r.jsxs(ee,{variant:"outline",className:"w-full justify-between gap-2 h-auto py-3",onClick:()=>{o("template",u.id,u.name,"click_canva"),window.open(T.canva_share_link,"_blank")},children:[r.jsx("span",{className:"font-medium",children:T.title}),r.jsx(As,{className:"h-4 w-4 text-muted-foreground"})]},T.id))})]})}),u.video_url&&r.jsx(Ze,{children:r.jsx(et,{className:"pt-6",children:r.jsx("div",{className:"aspect-video w-full rounded-lg overflow-hidden",children:r.jsx("iframe",{src:u.video_url,className:"w-full h-full",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0})})})}),u.guides&&u.guides.length>0&&r.jsx(Ze,{children:r.jsxs(et,{className:"pt-6",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 mb-4",children:[r.jsx(Ea,{className:"h-4 w-4"}),"Guide Files"]}),r.jsx("div",{className:"grid gap-2",children:u.guides.map(T=>r.jsxs(ee,{variant:"outline",className:"w-full justify-between gap-2 h-auto py-3",onClick:()=>{o("template",u.id,u.name,"click_pdf"),window.open(T.file_url,"_blank")},children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ea,{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(io,{className:"h-4 w-4 text-muted-foreground"})]},T.id))})]})}),r.jsx(Ld,{}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 text-lg",children:[r.jsx(Ul,{className:"h-5 w-5"}),"Comments (",y.length,")"]}),t?r.jsxs("form",{onSubmit:P,className:"flex gap-2",children:[r.jsx(Jn,{placeholder:"Add a comment...",value:l,onChange:T=>i(T.target.value),className:"min-h-[80px] resize-none flex-1"}),r.jsx(ee,{type:"submit",size:"icon",className:"h-10 w-10",disabled:!l.trim()||_.isPending,children:r.jsx(lo,{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(Ze,{children:r.jsx(et,{className:"py-8 text-center",children:r.jsx("p",{className:"text-muted-foreground",children:"No comments yet. Be the first to share your thoughts!"})})}):y.map(T=>r.jsx(Ze,{children:r.jsx(et,{className:"pt-4 pb-4",children:r.jsxs("div",{className:"flex gap-3",children:[r.jsx(Qs,{className:"h-10 w-10 flex-shrink-0",children:r.jsx(Js,{className:"text-sm",children:M(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:bu(new Date(T.created_at),{addSuffix:!0})}),T.user_id===(t==null?void 0:t.id)&&r.jsx(ee,{variant:"ghost",size:"icon",className:"h-6 w-6 ml-auto",onClick:()=>b.mutate(T.id),children:r.jsx(Bn,{className:"h-3 w-3 text-muted-foreground"})})]}),r.jsx("p",{className:"text-sm whitespace-pre-wrap",children:T.content})]})]})})},T.id))})]})]})}):r.jsx(Dr,{title:"Templates",children:r.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[r.jsx(Io,{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(oo,{to:"/templates",children:"Back to Templates"})})]})})},djt=()=>{const{user:e}=tn(),[t,n]=E.useState(""),[s,a]=E.useState("all"),{data:o=[]}=Kt({queryKey:["academy-categories"],queryFn:async()=>{const{data:_,error:b}=await Q.from("academy_categories").select("*").order("sort_order",{ascending:!0});if(b)throw b;return _}}),{data:l=[],isLoading:i}=Kt({queryKey:["academy-videos"],queryFn:async()=>{const{data:_,error:b}=await Q.from("academy_videos").select(` *, category:academy_categories(id, name) `).eq("is_published",!0).order("publish_date",{ascending:!1});if(b)throw b;const{data:S,error:k}=await Q.from("academy_resources").select("*").order("sort_order");if(k)throw k;return _.map(P=>({...P,resources:(S==null?void 0:S.filter(T=>T.video_id===P.id))||[]}))}}),{data:u=[]}=Kt({queryKey:["academy-video-likes"],queryFn:async()=>{const{data:_,error:b}=await Q.from("academy_video_likes").select("video_id, user_id");if(b)throw b;return _}}),p=l.filter(_=>{var k;const b=t===""||_.title.toLowerCase().includes(t.toLowerCase())||((k=_.description)==null?void 0:k.toLowerCase().includes(t.toLowerCase())),S=s==="all"||_.category_id===s;return b&&S}),x=_=>u.filter(b=>b.video_id===_).length,y=_=>u.some(b=>b.video_id===_&&b.user_id===(e==null?void 0:e.id));return r.jsx(Dr,{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(Sa,{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:t,onChange:_=>n(_.target.value),className:"pl-10"})]})}),r.jsx(Ai,{value:s,onValueChange:a,children:r.jsxs(vi,{className:"w-full justify-start flex-wrap h-auto gap-2 bg-transparent p-0",children:[r.jsx(sn,{value:"all",className:"data-[state=active]:bg-primary data-[state=active]:text-primary-foreground",children:"All Videos"}),o.map(_=>r.jsx(sn,{value:_.id,className:"data-[state=active]:bg-primary data-[state=active]:text-primary-foreground",children:_.name},_.id))]})}),i?r.jsx("div",{className:"flex justify-center py-12",children:r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})}):p.length===0?r.jsx(Ze,{children:r.jsxs(et,{className:"flex flex-col items-center justify-center py-12 text-center",children:[r.jsx($a,{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:t?"Try adjusting your search terms":"Check back soon for new content"})]})}):r.jsx("div",{className:"grid gap-6 sm:grid-cols-2 lg:grid-cols-3",children:p.map(_=>r.jsx(oo,{to:`/academy/${_.id}`,children:r.jsxs(Ze,{className:"overflow-hidden cursor-pointer hover:shadow-lg transition-shadow group h-full",children:[r.jsxs("div",{className:"relative aspect-video bg-muted",children:[_.thumbnail_url?r.jsx("img",{src:_.thumbnail_url,alt:_.title,className:"w-full h-full object-cover"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center",children:r.jsx($a,{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(Vl,{className:"h-8 w-8 text-primary-foreground ml-1"})})}),_.duration&&r.jsxs("div",{className:"absolute bottom-2 right-2 bg-black/70 text-white text-xs px-2 py-1 rounded flex items-center gap-1",children:[r.jsx(Ya,{className:"h-3 w-3"}),_.duration]})]}),r.jsxs(Wt,{className:"pb-2",children:[r.jsx("div",{className:"flex items-start justify-between gap-2",children:r.jsx(Yt,{className:"text-lg line-clamp-2",children:_.title})}),_.category&&r.jsx(Pt,{variant:"secondary",className:"w-fit",children:_.category.name})]}),r.jsxs(et,{className:"pt-0",children:[_.description&&r.jsx(Sn,{className:"line-clamp-2",children:_.description.replace(/<[^>]*>/g,"")}),r.jsxs("div",{className:"flex items-center gap-4 mt-3 text-sm text-muted-foreground",children:[r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(zd,{className:`h-4 w-4 ${y(_.id)?"fill-primary text-primary":""}`}),x(_.id)]}),_.resources&&_.resources.length>0&&r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Ea,{className:"h-4 w-4"}),_.resources.length]})]})]})]})},_.id))})]})})};function a9e({resourceType:e,resourceId:t}){const{data:n=[]}=Kt({queryKey:["linked-templates",e,t],queryFn:async()=>{if(e==="academy_video"){const{data:s,error:a}=await Q.from("academy_video_templates").select("template_id, canva_templates:template_id(id, name, preview_image_url)").eq("video_id",t);if(a)throw a;return(s||[]).map(o=>o.canva_templates).filter(Boolean)}else{const{data:s,error:a}=await Q.from("resource_kit_templates").select("template_id, canva_templates:template_id(id, name, preview_image_url)").eq("kit_id",t);if(a)throw a;return(s||[]).map(o=>o.canva_templates).filter(Boolean)}},enabled:!!t});return n.length===0?null:r.jsxs("div",{className:"space-y-2",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 text-sm",children:[r.jsx(Uc,{className:"h-4 w-4"}),"Related Templates"]}),r.jsx("div",{className:"flex flex-wrap gap-2",children:n.map(s=>r.jsx(oo,{to:`/templates/${s.id}`,children:r.jsxs(Pt,{variant:"secondary",className:"cursor-pointer hover:bg-secondary/80 transition-colors gap-1.5 px-3 py-1.5 text-xs font-medium rounded-full",children:[r.jsx(Uc,{className:"h-3 w-3"}),s.name]})},s.id))})]})}const ujt=(e,t)=>{if(t==="bunny_stream"){let n=e.replace("iframe.mediadelivery.net","player.mediadelivery.net");return n.includes("?")||(n+="?autoplay=false&loop=false&muted=false&preload=true&responsive=true"),n}if(t==="youtube"){const n=/(?:youtube\.com\/(?:watch\?v=|embed\/)|youtu\.be\/)([a-zA-Z0-9_-]{11})/,s=e.match(n);if(s)return`https://www.youtube.com/embed/${s[1]}`}if(t==="vimeo"){const n=/vimeo\.com\/(?:video\/)?(\d+)/,s=e.match(n);if(s)return`https://player.vimeo.com/video/${s[1]}`}if(t==="loom"){const n=/loom\.com\/share\/([a-zA-Z0-9]+)/,s=e.match(n);if(s)return`https://www.loom.com/embed/${s[1]}`}return e},hjt=()=>{const{videoId:e}=md();Gn();const{user:t,isAdmin:n}=tn(),{toast:s}=_i(),a=Hr(),{trackEngagement:o}=hP(),[l,i]=E.useState(""),{data:u,isLoading:p}=Kt({queryKey:["academy-video",e],queryFn:async()=>{const{data:I,error:z}=await Q.from("academy_videos").select(` *, category:academy_categories(id, name) `).eq("id",e).eq("is_published",!0).single();if(z)throw z;const{data:D}=await Q.from("academy_resources").select("*").eq("video_id",e).order("sort_order");return{...I,resources:D||[]}},enabled:!!e});E.useEffect(()=>{u&&o("academy_video",u.id,u.title,"view")},[u==null?void 0:u.id]);const{data:x=[]}=Kt({queryKey:["academy-video-likes",e],queryFn:async()=>{const{data:I,error:z}=await Q.from("academy_video_likes").select("*").eq("video_id",e);if(z)throw z;return I},enabled:!!e}),{data:y=[]}=Kt({queryKey:["academy-video-comments",e],queryFn:async()=>{const{data:I,error:z}=await Q.from("academy_video_comments").select("*").eq("video_id",e).order("created_at",{ascending:!1});if(z)throw z;const D=[...new Set(I.map(W=>W.user_id))],{data:U}=await Q.from("profiles").select("id, name").in("id",D),V=new Map((U==null?void 0:U.map(W=>[W.id,W.name]))||[]);return I.map(W=>({...W,user_name:V.get(W.user_id)||"Unknown User"}))},enabled:!!e}),_=ir({mutationFn:async I=>{const{error:z}=await Q.from("academy_video_comments").insert({video_id:e,user_id:t.id,content:I});if(z)throw z},onSuccess:()=>{a.invalidateQueries({queryKey:["academy-video-comments",e]}),i(""),s({title:"Comment added!"})},onError:I=>{s({title:"Error adding comment",description:I.message,variant:"destructive"})}}),b=ir({mutationFn:async I=>{const{error:z}=await Q.from("academy_video_comments").delete().eq("id",I);if(z)throw z},onSuccess:()=>{a.invalidateQueries({queryKey:["academy-video-comments",e]}),s({title:"Comment deleted"})}}),S=ir({mutationFn:async()=>{const I=x.find(z=>z.user_id===(t==null?void 0:t.id));if(I){const{error:z}=await Q.from("academy_video_likes").delete().eq("id",I.id);if(z)throw z}else{const{error:z}=await Q.from("academy_video_likes").insert({video_id:e,user_id:t.id});if(z)throw z}},onSuccess:()=>{a.invalidateQueries({queryKey:["academy-video-likes",e]})}}),k=x.some(I=>I.user_id===(t==null?void 0:t.id)),M=I=>{switch(I==null?void 0:I.toLowerCase()){case"pdf":return"📄";case"pptx":case"ppt":return"📊";case"xlsx":case"xls":return"📈";case"docx":case"doc":return"📝";case"zip":return"📦";default:return"📁"}},P=I=>I.split(" ").map(z=>z[0]).join("").toUpperCase().slice(0,2),T=I=>{I.preventDefault(),!(!l.trim()||!t)&&_.mutate(l.trim())};return p?r.jsx(Dr,{title:"Academy",children:r.jsx("div",{className:"flex justify-center py-12",children:r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})})}):u?r.jsx(Dr,{title:u.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(oo,{to:"/academy",children:[r.jsx(po,{className:"h-4 w-4"}),"Back to Academy"]})}),r.jsx("div",{className:"relative w-full rounded-lg overflow-hidden bg-black",style:{paddingTop:"56.25%"},children:["youtube","vimeo","loom","bunny_stream"].includes(u.video_type)?r.jsx("iframe",{src:ujt(u.video_url,u.video_type),loading:"lazy",style:{border:0,position:"absolute",top:0,left:0,height:"100%",width:"100%"},allow:"accelerometer; gyroscope; autoplay; encrypted-media; picture-in-picture",allowFullScreen:!0}):r.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center text-white gap-4",children:[r.jsx($a,{className:"h-16 w-16 opacity-50"}),r.jsx(ee,{variant:"secondary",asChild:!0,children:r.jsxs("a",{href:u.video_url,target:"_blank",rel:"noopener noreferrer",className:"gap-2",children:[r.jsx(As,{className:"h-4 w-4"}),"Open Video"]})})]})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx("h1",{className:"text-2xl font-bold text-foreground",children:u.title}),u.category&&r.jsx(Pt,{variant:"secondary",children:u.category.name})]}),r.jsxs("div",{className:"flex gap-2",children:[n&&r.jsx(ee,{variant:"outline",className:"gap-2 rounded-full",asChild:!0,children:r.jsxs(oo,{to:`/admin/academy?edit=${u.id}`,children:[r.jsx(ni,{className:"h-4 w-4"}),r.jsx("span",{children:"Edit"})]})}),r.jsx(O3,{resourceType:"academy_video",resourceId:u.id,resourceTitle:u.title}),r.jsxs(ee,{variant:k?"default":"outline",className:"gap-2 w-fit",onClick:()=>S.mutate(),disabled:!t||S.isPending,children:[r.jsx(zd,{className:`h-4 w-4 ${k?"fill-current":""}`}),x.length," ",x.length===1?"Like":"Likes"]})]})]}),u.description&&r.jsx("div",{className:"text-muted-foreground prose prose-sm max-w-none dark:prose-invert",dangerouslySetInnerHTML:{__html:u.description}})]}),u.resources&&u.resources.length>0&&r.jsx(Ze,{children:r.jsxs(et,{className:"pt-6",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 mb-4",children:[r.jsx(Ea,{className:"h-4 w-4"}),"Resources"]}),r.jsx("div",{className:"grid gap-2",children:u.resources.map(I=>r.jsxs("a",{href:I.file_url,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-3 p-3 rounded-lg border hover:bg-muted transition-colors",children:[r.jsx("span",{className:"text-2xl",children:M(I.file_type)}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"font-medium truncate",children:I.title}),r.jsx("p",{className:"text-xs text-muted-foreground uppercase",children:I.file_type})]}),r.jsx(io,{className:"h-4 w-4 text-muted-foreground"})]},I.id))})]})}),r.jsx(a9e,{resourceType:"academy_video",resourceId:u.id}),r.jsx(Ld,{}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 text-lg",children:[r.jsx(Ul,{className:"h-5 w-5"}),"Comments (",y.length,")"]}),t?r.jsxs("form",{onSubmit:T,className:"flex gap-2",children:[r.jsx(Jn,{placeholder:"Add a comment...",value:l,onChange:I=>i(I.target.value),className:"min-h-[80px] resize-none flex-1"}),r.jsx(ee,{type:"submit",size:"icon",className:"h-10 w-10",disabled:!l.trim()||_.isPending,children:r.jsx(lo,{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(Ze,{children:r.jsx(et,{className:"py-8 text-center",children:r.jsx("p",{className:"text-muted-foreground",children:"No comments yet. Be the first to share your thoughts!"})})}):y.map(I=>r.jsx(Ze,{children:r.jsx(et,{className:"pt-4 pb-4",children:r.jsxs("div",{className:"flex gap-3",children:[r.jsx(Qs,{className:"h-10 w-10 flex-shrink-0",children:r.jsx(Js,{className:"text-sm",children:P(I.user_name||"U")})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[r.jsx("span",{className:"font-medium",children:I.user_name}),r.jsx("span",{className:"text-sm text-muted-foreground",children:bu(new Date(I.created_at),{addSuffix:!0})}),I.user_id===(t==null?void 0:t.id)&&r.jsx(ee,{variant:"ghost",size:"icon",className:"h-6 w-6 ml-auto",onClick:()=>b.mutate(I.id),children:r.jsx(Bn,{className:"h-3 w-3 text-muted-foreground"})})]}),r.jsx("p",{className:"text-sm whitespace-pre-wrap",children:I.content})]})]})})},I.id))})]})]})}):r.jsx(Dr,{title:"Academy",children:r.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[r.jsx($a,{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(oo,{to:"/academy",children:"Back to Academy"})})]})})};function fjt(){const e=Gn(),[t,n]=E.useState(""),{data:s,isLoading:a}=Kt({queryKey:["resource-kits-published"],queryFn:async()=>{const{data:b,error:S}=await Q.from("resource_kits").select("*").eq("is_published",!0).order("publish_date",{ascending:!1});if(S)throw S;return b}}),{data:o}=Kt({queryKey:["resource-kit-files-all"],queryFn:async()=>{const{data:b,error:S}=await Q.from("resource_kit_files").select("*").order("sort_order",{ascending:!0});if(S)throw S;return b}}),{data:l}=Kt({queryKey:["resource-kit-likes-all"],queryFn:async()=>{const{data:b,error:S}=await Q.from("resource_kit_likes").select("kit_id");if(S)throw S;return b}}),{data:i}=Kt({queryKey:["resource-kit-comments-all"],queryFn:async()=>{const{data:b,error:S}=await Q.from("resource_kit_comments").select("kit_id");if(S)throw S;return b}}),u=s==null?void 0:s.filter(b=>{var S;return b.name.toLowerCase().includes(t.toLowerCase())||((S=b.description)==null?void 0:S.toLowerCase().includes(t.toLowerCase()))}),p=b=>(o==null?void 0:o.filter(S=>S.kit_id===b))||[],x=b=>(l==null?void 0:l.filter(S=>S.kit_id===b).length)||0,y=b=>(i==null?void 0:i.filter(S=>S.kit_id===b).length)||0,_=b=>{e(`/toolbox/${b}`)};return r.jsx(Dr,{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(Sa,{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:t,onChange:b=>n(b.target.value),className:"pl-10"})]}),!a&&r.jsxs("p",{className:"text-sm text-muted-foreground",children:[(u==null?void 0:u.length)||0," resource kit",(u==null?void 0:u.length)!==1?"s":""," available"]}),a?r.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6",children:[...Array(8)].map((b,S)=>r.jsx(Ze,{children:r.jsxs(et,{className:"p-4",children:[r.jsx(Lr,{className:"aspect-[4/3] w-full rounded-lg mb-4"}),r.jsx(Lr,{className:"h-5 w-3/4 mb-2"}),r.jsx(Lr,{className:"h-4 w-full mb-4"}),r.jsx(Lr,{className:"h-4 w-2/3"})]})},S))}):(u==null?void 0:u.length)===0?r.jsxs(Ze,{className:"p-12 text-center",children:[r.jsx(ql,{className:"h-12 w-12 mx-auto text-muted-foreground mb-4"}),r.jsx("h3",{className:"text-lg font-medium mb-2",children:"No resource kits found"}),r.jsx("p",{className:"text-muted-foreground",children:t?"Try adjusting your search terms":"Check back later for new resources"})]}):r.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6",children:u==null?void 0:u.map(b=>{const S=p(b.id).length,k=x(b.id),M=y(b.id);return r.jsxs(Ze,{className:"group overflow-hidden cursor-pointer hover:shadow-lg transition-all duration-200",onClick:()=>_(b.id),children:[r.jsx("div",{className:"relative overflow-hidden bg-muted aspect-[3/2]",children:b.featured_image_url?r.jsx("img",{src:b.featured_image_url,alt:b.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(ql,{className:"h-16 w-16 text-muted-foreground"})})}),r.jsxs(et,{className:"p-4",children:[r.jsx("h3",{className:"font-semibold text-foreground line-clamp-1 mb-1",children:b.name}),b.description&&r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 mb-3",children:xse(b.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(Ea,{className:"h-4 w-4"}),S," file",S!==1?"s":""]}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(zd,{className:"h-3.5 w-3.5"}),k]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Ul,{className:"h-3.5 w-3.5"}),M]})]})]})]})]},b.id)})})]})})}const pjt=()=>{const{kitId:e}=md(),{user:t,isAdmin:n}=tn(),{toast:s}=_i(),a=Hr(),{trackEngagement:o}=hP(),[l,i]=E.useState(""),{data:u,isLoading:p}=Kt({queryKey:["resource-kit-detail",e],queryFn:async()=>{const{data:I,error:z}=await Q.from("resource_kits").select("*").eq("id",e).eq("is_published",!0).single();if(z)throw z;const{data:D}=await Q.from("resource_kit_files").select("*").eq("kit_id",e).order("sort_order"),{data:U}=await Q.from("resource_kit_links").select("*").eq("kit_id",e).order("sort_order");return{...I,files:D||[],links:U||[]}},enabled:!!e});E.useEffect(()=>{u&&o("toolbox",u.id,u.name,"view")},[u==null?void 0:u.id]);const{data:x=[]}=Kt({queryKey:["resource-kit-likes",e],queryFn:async()=>{const{data:I,error:z}=await Q.from("resource_kit_likes").select("*").eq("kit_id",e);if(z)throw z;return I},enabled:!!e}),{data:y=[]}=Kt({queryKey:["resource-kit-comments",e],queryFn:async()=>{const{data:I,error:z}=await Q.from("resource_kit_comments").select("*").eq("kit_id",e).order("created_at",{ascending:!1});if(z)throw z;const D=[...new Set(I.map(W=>W.user_id))],{data:U}=await Q.from("profiles").select("id, name").in("id",D),V=new Map((U==null?void 0:U.map(W=>[W.id,W.name]))||[]);return I.map(W=>({...W,user_name:V.get(W.user_id)||"Unknown User"}))},enabled:!!e}),_=ir({mutationFn:async I=>{const{error:z}=await Q.from("resource_kit_comments").insert({kit_id:e,user_id:t.id,content:I});if(z)throw z},onSuccess:()=>{a.invalidateQueries({queryKey:["resource-kit-comments",e]}),i(""),s({title:"Comment added!"})},onError:I=>{s({title:"Error adding comment",description:I.message,variant:"destructive"})}}),b=ir({mutationFn:async I=>{const{error:z}=await Q.from("resource_kit_comments").delete().eq("id",I);if(z)throw z},onSuccess:()=>{a.invalidateQueries({queryKey:["resource-kit-comments",e]}),s({title:"Comment deleted"})}}),S=ir({mutationFn:async()=>{const I=x.find(z=>z.user_id===(t==null?void 0:t.id));if(I){const{error:z}=await Q.from("resource_kit_likes").delete().eq("id",I.id);if(z)throw z}else{const{error:z}=await Q.from("resource_kit_likes").insert({kit_id:e,user_id:t.id});if(z)throw z}},onSuccess:()=>{a.invalidateQueries({queryKey:["resource-kit-likes",e]})}}),k=x.some(I=>I.user_id===(t==null?void 0:t.id)),M=I=>I.split(" ").map(z=>z[0]).join("").toUpperCase().slice(0,2),P=I=>I?I<1024?I+" B":I<1024*1024?(I/1024).toFixed(1)+" KB":(I/(1024*1024)).toFixed(1)+" MB":"",T=I=>{I.preventDefault(),!(!l.trim()||!t)&&_.mutate(l.trim())};return p?r.jsx(Dr,{title:"Toolbox",children:r.jsx("div",{className:"flex justify-center py-12",children:r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})})}):u?r.jsx(Dr,{title:u.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(oo,{to:"/toolbox",children:[r.jsx(po,{className:"h-4 w-4"}),"Back to Toolbox"]})}),u.featured_image_url&&r.jsx("div",{className:"relative w-full rounded-lg overflow-hidden bg-muted",children:r.jsx("img",{src:u.featured_image_url,alt:u.name,className:"w-full max-h-[400px] object-cover"})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-start sm:justify-between gap-4",children:[r.jsx("div",{className:"space-y-2",children:r.jsx("h1",{className:"text-2xl font-bold text-foreground",children:u.name})}),r.jsxs("div",{className:"flex items-center gap-2",children:[n&&r.jsx(ee,{variant:"outline",className:"gap-2 rounded-full",asChild:!0,children:r.jsxs(oo,{to:`/admin/toolbox?edit=${u.id}`,children:[r.jsx(ni,{className:"h-4 w-4"}),r.jsx("span",{children:"Edit"})]})}),r.jsx(O3,{resourceType:"resource_kit",resourceId:u.id,resourceTitle:u.name,size:"default",className:"rounded-full"}),r.jsxs(ee,{variant:k?"default":"outline",className:"gap-2 rounded-full",onClick:()=>S.mutate(),disabled:!t||S.isPending,children:[r.jsx(zd,{className:`h-4 w-4 ${k?"fill-current":""}`}),x.length," ",x.length===1?"Like":"Likes"]})]})]}),u.description&&r.jsx("div",{className:"text-muted-foreground prose prose-sm max-w-none dark:prose-invert",dangerouslySetInnerHTML:{__html:u.description}})]}),u.files&&u.files.length>0&&r.jsx(Ze,{children:r.jsxs(et,{className:"pt-6",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 mb-4",children:[r.jsx(Ea,{className:"h-4 w-4"}),"Included Resources (",u.files.length,")"]}),r.jsx("div",{className:"grid gap-2",children:u.files.map(I=>r.jsxs("a",{href:I.file_url,target:"_blank",rel:"noopener noreferrer",onClick:()=>o("toolbox",u.id,u.name,"click_pdf"),className:"flex items-center justify-between p-3 rounded-lg border hover:bg-muted transition-colors group",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"p-2 rounded-md bg-primary/10",children:r.jsx(Ea,{className:"h-4 w-4 text-primary"})}),r.jsxs("div",{children:[r.jsx("div",{className:"font-medium text-sm",children:I.name}),I.file_size&&r.jsx("div",{className:"text-xs text-muted-foreground",children:P(I.file_size)})]})]}),r.jsx(io,{className:"h-4 w-4 text-muted-foreground group-hover:text-primary transition-colors"})]},I.id))})]})}),u.links&&u.links.length>0&&r.jsx(Ze,{children:r.jsxs(et,{className:"pt-6",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 mb-4",children:[r.jsx(As,{className:"h-4 w-4"}),"Canva Templates (",u.links.length,")"]}),r.jsx("div",{className:"grid gap-2",children:u.links.map(I=>r.jsxs("a",{href:I.canva_share_link,target:"_blank",rel:"noopener noreferrer",onClick:()=>o("toolbox",u.id,u.name,"click_canva"),className:"flex items-center justify-between p-3 rounded-lg border hover:bg-muted transition-colors group",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"p-2 rounded-md bg-purple-500/10",children:r.jsx(As,{className:"h-4 w-4 text-purple-600"})}),r.jsx("div",{className:"font-medium text-sm",children:I.title})]}),r.jsx("span",{className:"text-xs text-muted-foreground group-hover:text-primary transition-colors",children:"Open in Canva"})]},I.id))})]})}),r.jsx(a9e,{resourceType:"resource_kit",resourceId:u.id}),r.jsx(Ld,{}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 text-lg",children:[r.jsx(Ul,{className:"h-5 w-5"}),"Comments (",y.length,")"]}),t?r.jsxs("form",{onSubmit:T,className:"flex gap-2",children:[r.jsx(Jn,{placeholder:"Add a comment...",value:l,onChange:I=>i(I.target.value),className:"min-h-[80px] resize-none flex-1"}),r.jsx(ee,{type:"submit",size:"icon",className:"h-10 w-10",disabled:!l.trim()||_.isPending,children:r.jsx(lo,{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(Ze,{children:r.jsx(et,{className:"py-8 text-center",children:r.jsx("p",{className:"text-muted-foreground",children:"No comments yet. Be the first to share your thoughts!"})})}):y.map(I=>r.jsx(Ze,{children:r.jsx(et,{className:"pt-4 pb-4",children:r.jsxs("div",{className:"flex gap-3",children:[r.jsx(Qs,{className:"h-10 w-10 flex-shrink-0",children:r.jsx(Js,{className:"text-sm",children:M(I.user_name||"U")})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[r.jsx("span",{className:"font-medium",children:I.user_name}),r.jsx("span",{className:"text-sm text-muted-foreground",children:bu(new Date(I.created_at),{addSuffix:!0})}),I.user_id===(t==null?void 0:t.id)&&r.jsx(ee,{variant:"ghost",size:"icon",className:"h-6 w-6 ml-auto",onClick:()=>b.mutate(I.id),children:r.jsx(Bn,{className:"h-3 w-3 text-muted-foreground"})})]}),r.jsx("p",{className:"text-sm whitespace-pre-wrap",children:I.content})]})]})})},I.id))})]})]})}):r.jsx(Dr,{title:"Toolbox",children:r.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[r.jsx(ql,{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(oo,{to:"/toolbox",children:"Back to Toolbox"})})]})})},mjt=()=>{const e=Gn(),[t,n]=E.useState(""),[s,a]=E.useState("grid"),{data:o=[],isLoading:l}=Kt({queryKey:["social-swag"],queryFn:async()=>{const{data:p,error:x}=await Q.from("social_swag").select("*").eq("is_published",!0).order("publish_date",{ascending:!1});if(x)throw x;const{data:y,error:_}=await Q.from("social_swag_links").select("*").order("sort_order");if(_)throw _;const{data:b}=await Q.from("social_swag_likes").select("swag_id"),{data:S}=await Q.from("social_swag_comments").select("swag_id"),k=new Map;b==null||b.forEach(T=>{k.set(T.swag_id,(k.get(T.swag_id)||0)+1)});const M=new Map;return S==null||S.forEach(T=>{M.set(T.swag_id,(M.get(T.swag_id)||0)+1)}),(p||[]).map(T=>({...T,links:(y||[]).filter(I=>I.swag_id===T.id)||[],likesCount:k.get(T.id)||0,commentsCount:M.get(T.id)||0}))}}),i=o.filter(p=>{var y;return p.title.toLowerCase().includes(t.toLowerCase())||((y=p.description)==null?void 0:y.toLowerCase().includes(t.toLowerCase()))}),u=p=>{e(`/social-swag/${p}`)};return r.jsx(Dr,{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(Sa,{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:t,onChange:p=>n(p.target.value),className:"pl-9"})]}),r.jsxs("div",{className:"flex gap-2",children:[t&&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(dp,{className:"h-4 w-4"})}),r.jsx(ee,{variant:s==="list"?"secondary":"outline",size:"icon",onClick:()=>a("list"),className:"rounded-full",children:r.jsx(up,{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(Ze,{children:r.jsxs(et,{className:"p-4",children:[r.jsx(Lr,{className:"aspect-[4/3] w-full rounded-lg mb-4"}),r.jsx(Lr,{className:"h-5 w-3/4 mb-2"}),r.jsx(Lr,{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:t?"No items match your search":"No social swag available yet"}),t&&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(Ze,{className:`group overflow-hidden hover:shadow-lg transition-all duration-200 cursor-pointer ${s==="list"?"flex flex-row":""}`,onClick:()=>u(p.id),children:[r.jsxs("div",{className:`relative overflow-hidden bg-muted ${s==="list"?"w-48 shrink-0":"aspect-[3/2]"}`,children:[p.preview_image_url?r.jsx("img",{src:p.preview_image_url,alt:p.title,className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-300"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center text-muted-foreground",children:"No Preview"}),p.links.length>1&&r.jsx("div",{className:"absolute top-2 right-2",children:r.jsxs(Pt,{variant:"secondary",className:"gap-1 bg-background/90 backdrop-blur-sm",children:[r.jsx(Io,{className:"h-3 w-3"}),p.links.length]})})]}),r.jsxs(et,{className:`p-4 flex flex-col ${s==="list"?"flex-1":""}`,children:[r.jsx("h3",{className:"font-semibold text-foreground line-clamp-1 mb-1",children:p.title}),p.description&&r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 mb-3 flex-1",children:p.description.replace(/<[^>]*>/g,"")}),r.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground mb-3",children:[r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(zd,{className:"h-3.5 w-3.5"}),p.likesCount]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Ul,{className:"h-3.5 w-3.5"}),p.commentsCount]})]}),r.jsxs(ee,{size:"sm",className:"w-full gap-2",onClick:x=>{x.stopPropagation(),u(p.id)},children:[r.jsx(As,{className:"h-4 w-4"}),"View Details"]})]})]},p.id))})]})})};var za=function(){return za=Object.assign||function(t){for(var n,s=1,a=arguments.length;s1&&(u||!p),y=t>1&&(p||!u),_=function(){s&&o(s)},b=function(){a&&o(a)};return r.jsx(Kjt,{displayMonth:e.displayMonth,hideNext:x,hidePrevious:y,nextMonth:a,previousMonth:s,onPreviousClick:_,onNextClick:b})}function Zjt(e){var t,n=cl(),s=n.classNames,a=n.disableNavigation,o=n.styles,l=n.captionLayout,i=n.components,u=(t=i==null?void 0:i.CaptionLabel)!==null&&t!==void 0?t:l9e,p;return a?p=r.jsx(u,{id:e.id,displayMonth:e.displayMonth}):l==="dropdown"?p=r.jsx(DSe,{displayMonth:e.displayMonth,id:e.id}):l==="dropdown-buttons"?p=r.jsxs(r.Fragment,{children:[r.jsx(DSe,{displayMonth:e.displayMonth,displayIndex:e.displayIndex,id:e.id}),r.jsx(RSe,{displayMonth:e.displayMonth,displayIndex:e.displayIndex,id:e.id})]}):p=r.jsxs(r.Fragment,{children:[r.jsx(u,{id:e.id,displayMonth:e.displayMonth,displayIndex:e.displayIndex}),r.jsx(RSe,{displayMonth:e.displayMonth,id:e.id})]}),r.jsx("div",{className:s.caption,style:o.caption,children:p})}function Yjt(e){var t=cl(),n=t.footer,s=t.styles,a=t.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 Xjt(e,t,n){for(var s=n?Ty(new Date):Nf(new Date,{locale:e,weekStartsOn:t}),a=[],o=0;o<7;o++){var l=Ql(s,o);a.push(l)}return a}function Qjt(){var e=cl(),t=e.classNames,n=e.styles,s=e.showWeekNumber,a=e.locale,o=e.weekStartsOn,l=e.ISOWeek,i=e.formatters.formatWeekdayName,u=e.labels.labelWeekday,p=Xjt(a,o,l);return r.jsxs("tr",{style:n.head_row,className:t.head_row,children:[s&&r.jsx("td",{style:n.head_cell,className:t.head_cell}),p.map(function(x,y){return r.jsx("th",{scope:"col",className:t.head_cell,style:n.head_cell,"aria-label":u(x,{locale:a}),children:i(x,{locale:a})},y)})]})}function Jjt(){var e,t=cl(),n=t.classNames,s=t.styles,a=t.components,o=(e=a==null?void 0:a.HeadRow)!==null&&e!==void 0?e:Qjt;return r.jsx("thead",{style:s.head,className:n.head,children:r.jsx(o,{})})}function ekt(e){var t=cl(),n=t.locale,s=t.formatters.formatDay;return r.jsx(r.Fragment,{children:s(e.date,{locale:n})})}var C0e=E.createContext(void 0);function tkt(e){if(!fP(e.initialProps)){var t={selected:void 0,modifiers:{disabled:[]}};return r.jsx(C0e.Provider,{value:t,children:e.children})}return r.jsx(rkt,{initialProps:e.initialProps,children:e.children})}function rkt(e){var t=e.initialProps,n=e.children,s=t.selected,a=t.min,o=t.max,l=function(p,x,y){var _,b;(_=t.onDayClick)===null||_===void 0||_.call(t,p,x,y);var S=!!(x.selected&&a&&(s==null?void 0:s.length)===a);if(!S){var k=!!(!x.selected&&o&&(s==null?void 0:s.length)===o);if(!k){var M=s?i9e([],s):[];if(x.selected){var P=M.findIndex(function(T){return ac(p,T)});M.splice(P,1)}else M.push(p);(b=t.onSelect)===null||b===void 0||b.call(t,M,p,x,y)}}},i={disabled:[]};s&&i.disabled.push(function(p){var x=o&&s.length>o-1,y=s.some(function(_){return ac(_,p)});return!!(x&&!y)});var u={selected:s,onDayClick:l,modifiers:i};return r.jsx(C0e.Provider,{value:u,children:n})}function M0e(){var e=E.useContext(C0e);if(!e)throw new Error("useSelectMultiple must be used within a SelectMultipleProvider");return e}function nkt(e,t){var n=t||{},s=n.from,a=n.to;return s&&a?ac(a,e)&&ac(s,e)?void 0:ac(a,e)?{from:a,to:void 0}:ac(s,e)?void 0:tre(s,e)?{from:e,to:a}:{from:s,to:e}:a?tre(e,a)?{from:a,to:e}:{from:e,to:a}:s?sae(e,s)?{from:e,to:s}:{from:s,to:e}:{from:e,to:void 0}}var T0e=E.createContext(void 0);function skt(e){if(!pP(e.initialProps)){var t={selected:void 0,modifiers:{range_start:[],range_end:[],range_middle:[],disabled:[]}};return r.jsx(T0e.Provider,{value:t,children:e.children})}return r.jsx(akt,{initialProps:e.initialProps,children:e.children})}function akt(e){var t=e.initialProps,n=e.children,s=t.selected,a=s||{},o=a.from,l=a.to,i=t.min,u=t.max,p=function(b,S,k){var M,P;(M=t.onDayClick)===null||M===void 0||M.call(t,b,S,k);var T=nkt(b,s);(P=t.onSelect)===null||P===void 0||P.call(t,T,b,S,k)},x={range_start:[],range_end:[],range_middle:[],disabled:[]};if(o?(x.range_start=[o],l?(x.range_end=[l],ac(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:qce(o,i-1),before:Ql(o,i-1)}),o&&l&&x.disabled.push({after:o,before:Ql(o,i-1)}),!o&&l&&x.disabled.push({after:qce(l,i-1),before:Ql(l,i-1)})),u){if(o&&!l&&(x.disabled.push({before:Ql(o,-u+1)}),x.disabled.push({after:Ql(o,u-1)})),o&&l){var y=bm(l,o)+1,_=u-y;x.disabled.push({before:qce(o,_)}),x.disabled.push({after:Ql(l,_)})}!o&&l&&(x.disabled.push({before:Ql(l,-u+1)}),x.disabled.push({after:Ql(l,u-1)}))}return r.jsx(T0e.Provider,{value:{selected:s,onDayClick:p,modifiers:x},children:n})}function A0e(){var e=E.useContext(T0e);if(!e)throw new Error("useSelectRange must be used within a SelectRangeProvider");return e}function Qee(e){return Array.isArray(e)?i9e([],e):e!==void 0?[e]:[]}function ikt(e){var t={};return Object.entries(e).forEach(function(n){var s=n[0],a=n[1];t[s]=Qee(a)}),t}var Fm;(function(e){e.Outside="outside",e.Disabled="disabled",e.Selected="selected",e.Hidden="hidden",e.Today="today",e.RangeStart="range_start",e.RangeEnd="range_end",e.RangeMiddle="range_middle"})(Fm||(Fm={}));var okt=Fm.Selected,Ox=Fm.Disabled,lkt=Fm.Hidden,ckt=Fm.Today,kde=Fm.RangeEnd,Nde=Fm.RangeMiddle,Sde=Fm.RangeStart,dkt=Fm.Outside;function ukt(e,t,n){var s,a=(s={},s[okt]=Qee(e.selected),s[Ox]=Qee(e.disabled),s[lkt]=Qee(e.hidden),s[ckt]=[e.today],s[kde]=[],s[Nde]=[],s[Sde]=[],s[dkt]=[],s);return e.fromDate&&a[Ox].push({before:e.fromDate}),e.toDate&&a[Ox].push({after:e.toDate}),fP(e)?a[Ox]=a[Ox].concat(t.modifiers[Ox]):pP(e)&&(a[Ox]=a[Ox].concat(n.modifiers[Ox]),a[Sde]=n.modifiers[Sde],a[Nde]=n.modifiers[Nde],a[kde]=n.modifiers[kde]),a}var u9e=E.createContext(void 0);function hkt(e){var t=cl(),n=M0e(),s=A0e(),a=ukt(t,n,s),o=ikt(t.modifiers),l=za(za({},a),o);return r.jsx(u9e.Provider,{value:l,children:e.children})}function h9e(){var e=E.useContext(u9e);if(!e)throw new Error("useModifiers must be used within a ModifiersProvider");return e}function fkt(e){return!!(e&&typeof e=="object"&&"before"in e&&"after"in e)}function pkt(e){return!!(e&&typeof e=="object"&&"from"in e)}function mkt(e){return!!(e&&typeof e=="object"&&"after"in e)}function gkt(e){return!!(e&&typeof e=="object"&&"before"in e)}function xkt(e){return!!(e&&typeof e=="object"&&"dayOfWeek"in e)}function ykt(e,t){var n,s=t.from,a=t.to;if(s&&a){var o=bm(a,s)<0;o&&(n=[a,s],s=n[0],a=n[1]);var l=bm(e,s)>=0&&bm(a,e)>=0;return l}return a?ac(a,e):s?ac(s,e):!1}function vkt(e){return xye(e)}function _kt(e){return Array.isArray(e)&&e.every(xye)}function bkt(e,t){return t.some(function(n){if(typeof n=="boolean")return n;if(vkt(n))return ac(e,n);if(_kt(n))return n.includes(e);if(pkt(n))return ykt(e,n);if(xkt(n))return n.dayOfWeek.includes(e.getDay());if(fkt(n)){var s=bm(n.before,e),a=bm(n.after,e),o=s>0,l=a<0,i=tre(n.before,n.after);return i?l&&o:o||l}return mkt(n)?bm(e,n.after)>0:gkt(n)?bm(n.before,e)>0:typeof n=="function"?n(e):!1})}function E0e(e,t,n){var s=Object.keys(t).reduce(function(o,l){var i=t[l];return bkt(e,i)&&o.push(l),o},[]),a={};return s.forEach(function(o){return a[o]=!0}),n&&!Nye(e,n)&&(a.outside=!0),a}function wkt(e,t){for(var n=Eh(e[0]),s=rae(e[e.length-1]),a,o,l=n;l<=s;){var i=E0e(l,t),u=!i.disabled&&!i.hidden;if(!u){l=Ql(l,1);continue}if(i.selected)return l;i.today&&!o&&(o=l),a||(a=l),l=Ql(l,1)}return o||a}var jkt=365;function f9e(e,t){var n=t.moveBy,s=t.direction,a=t.context,o=t.modifiers,l=t.retry,i=l===void 0?{count:0,lastFocused:e}:l,u=a.weekStartsOn,p=a.fromDate,x=a.toDate,y=a.locale,_={day:Ql,week:aj,month:Ph,year:Uut,startOfWeek:function(M){return a.ISOWeek?Ty(M):Nf(M,{locale:y,weekStartsOn:u})},endOfWeek:function(M){return a.ISOWeek?vDe(M):yye(M,{locale:y,weekStartsOn:u})}},b=_[n](e,s==="after"?1:-1);s==="before"&&p?b=qut([p,b]):s==="after"&&x&&(b=Vut([x,b]));var S=!0;if(o){var k=E0e(b,o);S=!k.disabled&&!k.hidden}return S?b:i.count>jkt?i.lastFocused:f9e(b,{moveBy:n,direction:s,context:a,modifiers:o,retry:za(za({},i),{count:i.count+1})})}var p9e=E.createContext(void 0);function kkt(e){var t=mP(),n=h9e(),s=E.useState(),a=s[0],o=s[1],l=E.useState(),i=l[0],u=l[1],p=wkt(t.displayMonths,n),x=a??(i&&t.isDateDisplayed(i))?i:p,y=function(){u(a),o(void 0)},_=function(M){o(M)},b=cl(),S=function(M,P){if(a){var T=f9e(a,{moveBy:M,direction:P,context:b,modifiers:n});ac(a,T)||(t.goToDate(T,a),_(T))}},k={focusedDay:a,focusTarget:x,blur:y,focus:_,focusDayAfter:function(){return S("day","after")},focusDayBefore:function(){return S("day","before")},focusWeekAfter:function(){return S("week","after")},focusWeekBefore:function(){return S("week","before")},focusMonthBefore:function(){return S("month","before")},focusMonthAfter:function(){return S("month","after")},focusYearBefore:function(){return S("year","before")},focusYearAfter:function(){return S("year","after")},focusStartOfWeek:function(){return S("startOfWeek","before")},focusEndOfWeek:function(){return S("endOfWeek","after")}};return r.jsx(p9e.Provider,{value:k,children:e.children})}function I0e(){var e=E.useContext(p9e);if(!e)throw new Error("useFocusContext must be used within a FocusProvider");return e}function Nkt(e,t){var n=h9e(),s=E0e(e,n,t);return s}var P0e=E.createContext(void 0);function Skt(e){if(!Eae(e.initialProps)){var t={selected:void 0};return r.jsx(P0e.Provider,{value:t,children:e.children})}return r.jsx(Ckt,{initialProps:e.initialProps,children:e.children})}function Ckt(e){var t=e.initialProps,n=e.children,s=function(o,l,i){var u,p,x;if((u=t.onDayClick)===null||u===void 0||u.call(t,o,l,i),l.selected&&!t.required){(p=t.onSelect)===null||p===void 0||p.call(t,void 0,o,l,i);return}(x=t.onSelect)===null||x===void 0||x.call(t,o,o,l,i)},a={selected:t.selected,onDayClick:s};return r.jsx(P0e.Provider,{value:a,children:n})}function m9e(){var e=E.useContext(P0e);if(!e)throw new Error("useSelectSingle must be used within a SelectSingleProvider");return e}function Mkt(e,t){var n=cl(),s=m9e(),a=M0e(),o=A0e(),l=I0e(),i=l.focusDayAfter,u=l.focusDayBefore,p=l.focusWeekAfter,x=l.focusWeekBefore,y=l.blur,_=l.focus,b=l.focusMonthBefore,S=l.focusMonthAfter,k=l.focusYearBefore,M=l.focusYearAfter,P=l.focusStartOfWeek,T=l.focusEndOfWeek,I=function(fe){var he,ye,Ae,we;Eae(n)?(he=s.onDayClick)===null||he===void 0||he.call(s,e,t,fe):fP(n)?(ye=a.onDayClick)===null||ye===void 0||ye.call(a,e,t,fe):pP(n)?(Ae=o.onDayClick)===null||Ae===void 0||Ae.call(o,e,t,fe):(we=n.onDayClick)===null||we===void 0||we.call(n,e,t,fe)},z=function(fe){var he;_(e),(he=n.onDayFocus)===null||he===void 0||he.call(n,e,t,fe)},D=function(fe){var he;y(),(he=n.onDayBlur)===null||he===void 0||he.call(n,e,t,fe)},U=function(fe){var he;(he=n.onDayMouseEnter)===null||he===void 0||he.call(n,e,t,fe)},V=function(fe){var he;(he=n.onDayMouseLeave)===null||he===void 0||he.call(n,e,t,fe)},W=function(fe){var he;(he=n.onDayPointerEnter)===null||he===void 0||he.call(n,e,t,fe)},G=function(fe){var he;(he=n.onDayPointerLeave)===null||he===void 0||he.call(n,e,t,fe)},J=function(fe){var he;(he=n.onDayTouchCancel)===null||he===void 0||he.call(n,e,t,fe)},ne=function(fe){var he;(he=n.onDayTouchEnd)===null||he===void 0||he.call(n,e,t,fe)},oe=function(fe){var he;(he=n.onDayTouchMove)===null||he===void 0||he.call(n,e,t,fe)},ge=function(fe){var he;(he=n.onDayTouchStart)===null||he===void 0||he.call(n,e,t,fe)},ie=function(fe){var he;(he=n.onDayKeyUp)===null||he===void 0||he.call(n,e,t,fe)},pe=function(fe){var he;switch(fe.key){case"ArrowLeft":fe.preventDefault(),fe.stopPropagation(),n.dir==="rtl"?i():u();break;case"ArrowRight":fe.preventDefault(),fe.stopPropagation(),n.dir==="rtl"?u():i();break;case"ArrowDown":fe.preventDefault(),fe.stopPropagation(),p();break;case"ArrowUp":fe.preventDefault(),fe.stopPropagation(),x();break;case"PageUp":fe.preventDefault(),fe.stopPropagation(),fe.shiftKey?k():b();break;case"PageDown":fe.preventDefault(),fe.stopPropagation(),fe.shiftKey?M():S();break;case"Home":fe.preventDefault(),fe.stopPropagation(),P();break;case"End":fe.preventDefault(),fe.stopPropagation(),T();break}(he=n.onDayKeyDown)===null||he===void 0||he.call(n,e,t,fe)},se={onClick:I,onFocus:z,onBlur:D,onKeyDown:pe,onKeyUp:ie,onMouseEnter:U,onMouseLeave:V,onPointerEnter:W,onPointerLeave:G,onTouchCancel:J,onTouchEnd:ne,onTouchMove:oe,onTouchStart:ge};return se}function Tkt(){var e=cl(),t=m9e(),n=M0e(),s=A0e(),a=Eae(e)?t.selected:fP(e)?n.selected:pP(e)?s.selected:void 0;return a}function Akt(e){return Object.values(Fm).includes(e)}function Ekt(e,t){var n=[e.classNames.day];return Object.keys(t).forEach(function(s){var a=e.modifiersClassNames[s];if(a)n.push(a);else if(Akt(s)){var o=e.classNames["day_".concat(s)];o&&n.push(o)}}),n}function Ikt(e,t){var n=za({},e.styles.day);return Object.keys(t).forEach(function(s){var a;n=za(za({},n),(a=e.modifiersStyles)===null||a===void 0?void 0:a[s])}),n}function Pkt(e,t,n){var s,a,o,l=cl(),i=I0e(),u=Nkt(e,t),p=Mkt(e,u),x=Tkt(),y=!!(l.onDayClick||l.mode!=="default");E.useEffect(function(){var U;u.outside||i.focusedDay&&y&&ac(i.focusedDay,e)&&((U=n.current)===null||U===void 0||U.focus())},[i.focusedDay,e,n,y,u.outside]);var _=Ekt(l,u).join(" "),b=Ikt(l,u),S=!!(u.outside&&!l.showOutsideDays||u.hidden),k=(o=(a=l.components)===null||a===void 0?void 0:a.DayContent)!==null&&o!==void 0?o:ekt,M=r.jsx(k,{date:e,displayMonth:t,activeModifiers:u}),P={style:b,className:_,children:M,role:"gridcell"},T=i.focusTarget&&ac(i.focusTarget,e)&&!u.outside,I=i.focusedDay&&ac(i.focusedDay,e),z=za(za(za({},P),(s={disabled:u.disabled,role:"gridcell"},s["aria-selected"]=u.selected,s.tabIndex=I||T?0:-1,s)),p),D={isButton:y,isHidden:S,activeModifiers:u,selectedDays:x,buttonProps:z,divProps:P};return D}function Lkt(e){var t=E.useRef(null),n=Pkt(e.date,e.displayMonth,t);return n.isHidden?r.jsx("div",{role:"gridcell"}):n.isButton?r.jsx(Wre,za({name:"day",ref:t},n.buttonProps)):r.jsx("div",za({},n.divProps))}function Okt(e){var t=e.number,n=e.dates,s=cl(),a=s.onWeekNumberClick,o=s.styles,l=s.classNames,i=s.locale,u=s.labels.labelWeekNumber,p=s.formatters.formatWeekNumber,x=p(Number(t),{locale:i});if(!a)return r.jsx("span",{className:l.weeknumber,style:o.weeknumber,children:x});var y=u(Number(t),{locale:i}),_=function(b){a(t,n,b)};return r.jsx(Wre,{name:"week-number","aria-label":y,className:l.weeknumber,style:o.weeknumber,onClick:_,children:x})}function Dkt(e){var t,n,s=cl(),a=s.styles,o=s.classNames,l=s.showWeekNumber,i=s.components,u=(t=i==null?void 0:i.Day)!==null&&t!==void 0?t:Lkt,p=(n=i==null?void 0:i.WeekNumber)!==null&&n!==void 0?n:Okt,x;return l&&(x=r.jsx("td",{className:o.cell,style:a.cell,children:r.jsx(p,{number:e.weekNumber,dates:e.dates})})),r.jsxs("tr",{className:o.row,style:a.row,children:[x,e.dates.map(function(y){return r.jsx("td",{className:o.cell,style:a.cell,role:"presentation",children:r.jsx(u,{displayMonth:e.displayMonth,date:y})},Kht(y))})]})}function FSe(e,t,n){for(var s=n!=null&&n.ISOWeek?vDe(t):yye(t,n),a=n!=null&&n.ISOWeek?Ty(e):Nf(e,n),o=bm(s,a),l=[],i=0;i<=o;i++)l.push(Ql(a,i));var u=l.reduce(function(p,x){var y=n!=null&&n.ISOWeek?vye(x):bye(x,n),_=p.find(function(b){return b.weekNumber===y});return _?(_.dates.push(x),p):(p.push({weekNumber:y,dates:[x]}),p)},[]);return u}function Rkt(e,t){var n=FSe(Eh(e),rae(e),t);if(t!=null&&t.useFixedWeeks){var s=Yht(e,t);if(s<6){var a=n[n.length-1],o=a.dates[a.dates.length-1],l=aj(o,6-s),i=FSe(aj(o,1),l,t);n.push.apply(n,i)}}return n}function Fkt(e){var t,n,s,a=cl(),o=a.locale,l=a.classNames,i=a.styles,u=a.hideHead,p=a.fixedWeeks,x=a.components,y=a.weekStartsOn,_=a.firstWeekContainsDate,b=a.ISOWeek,S=Rkt(e.displayMonth,{useFixedWeeks:!!p,ISOWeek:b,locale:o,weekStartsOn:y,firstWeekContainsDate:_}),k=(t=x==null?void 0:x.Head)!==null&&t!==void 0?t:Jjt,M=(n=x==null?void 0:x.Row)!==null&&n!==void 0?n:Dkt,P=(s=x==null?void 0:x.Footer)!==null&&s!==void 0?s:Yjt;return r.jsxs("table",{id:e.id,className:l.table,style:i.table,role:"grid","aria-labelledby":e["aria-labelledby"],children:[!u&&r.jsx(k,{}),r.jsx("tbody",{className:l.tbody,style:i.tbody,children:S.map(function(T){return r.jsx(M,{displayMonth:e.displayMonth,dates:T.dates,weekNumber:T.weekNumber},T.weekNumber)})}),r.jsx(P,{displayMonth:e.displayMonth})]})}function zkt(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}var Bkt=zkt()?E.useLayoutEffect:E.useEffect,Cde=!1,$kt=0;function zSe(){return"react-day-picker-".concat(++$kt)}function Ukt(e){var t,n=e??(Cde?zSe():null),s=E.useState(n),a=s[0],o=s[1];return Bkt(function(){a===null&&o(zSe())},[]),E.useEffect(function(){Cde===!1&&(Cde=!0)},[]),(t=e??a)!==null&&t!==void 0?t:void 0}function qkt(e){var t,n,s=cl(),a=s.dir,o=s.classNames,l=s.styles,i=s.components,u=mP().displayMonths,p=Ukt(s.id?"".concat(s.id,"-").concat(e.displayIndex):void 0),x=s.id?"".concat(s.id,"-grid-").concat(e.displayIndex):void 0,y=[o.month],_=l.month,b=e.displayIndex===0,S=e.displayIndex===u.length-1,k=!b&&!S;a==="rtl"&&(t=[b,S],S=t[0],b=t[1]),b&&(y.push(o.caption_start),_=za(za({},_),l.caption_start)),S&&(y.push(o.caption_end),_=za(za({},_),l.caption_end)),k&&(y.push(o.caption_between),_=za(za({},_),l.caption_between));var M=(n=i==null?void 0:i.Caption)!==null&&n!==void 0?n:Zjt;return r.jsxs("div",{className:y.join(" "),style:_,children:[r.jsx(M,{id:p,displayMonth:e.displayMonth,displayIndex:e.displayIndex}),r.jsx(Fkt,{id:x,"aria-labelledby":p,displayMonth:e.displayMonth})]},e.displayIndex)}function Vkt(e){var t=cl(),n=t.classNames,s=t.styles;return r.jsx("div",{className:n.months,style:s.months,children:e.children})}function Hkt(e){var t,n,s=e.initialProps,a=cl(),o=I0e(),l=mP(),i=E.useState(!1),u=i[0],p=i[1];E.useEffect(function(){a.initialFocus&&o.focusTarget&&(u||(o.focus(o.focusTarget),p(!0)))},[a.initialFocus,u,o.focus,o.focusTarget,o]);var x=[a.classNames.root,a.className];a.numberOfMonths>1&&x.push(a.classNames.multiple_months),a.showWeekNumber&&x.push(a.classNames.with_weeknumber);var y=za(za({},a.styles.root),a.style),_=Object.keys(s).filter(function(S){return S.startsWith("data-")}).reduce(function(S,k){var M;return za(za({},S),(M={},M[k]=s[k],M))},{}),b=(n=(t=s.components)===null||t===void 0?void 0:t.Months)!==null&&n!==void 0?n:Vkt;return r.jsx("div",za({className:x.join(" "),style:y,dir:a.dir,id:a.id,nonce:s.nonce,title:s.title,lang:s.lang},_,{children:r.jsx(b,{children:l.displayMonths.map(function(S,k){return r.jsx(qkt,{displayIndex:k,displayMonth:S},k)})})}))}function Wkt(e){var t=e.children,n=gjt(e,["children"]);return r.jsx(Ojt,{initialProps:n,children:r.jsx(Hjt,{children:r.jsx(Skt,{initialProps:n,children:r.jsx(tkt,{initialProps:n,children:r.jsx(skt,{initialProps:n,children:r.jsx(hkt,{children:r.jsx(kkt,{children:t})})})})})})})}function Gkt(e){return r.jsx(Wkt,za({},e,{children:r.jsx(Hkt,{initialProps:e})}))}function Pm({className:e,classNames:t,showOutsideDays:n=!0,...s}){return r.jsx(Gkt,{showOutsideDays:n,className:Bt("p-3",e),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:Bt(TE({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:Bt(TE({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",...t},components:{IconLeft:({...a})=>r.jsx(kc,{className:"h-4 w-4"}),IconRight:({...a})=>r.jsx(Wi,{className:"h-4 w-4"})},...s})}Pm.displayName="Calendar";var Iae="Popover",[g9e]=cc(Iae,[tx]),gP=tx(),[Kkt,Av]=g9e(Iae),x9e=e=>{const{__scopePopover:t,children:n,open:s,defaultOpen:a,onOpenChange:o,modal:l=!1}=e,i=gP(t),u=E.useRef(null),[p,x]=E.useState(!1),[y,_]=Ju({prop:s,defaultProp:a??!1,onChange:o,caller:Iae});return r.jsx(GI,{...i,children:r.jsx(Kkt,{scope:t,contentId:fd(),triggerRef:u,open:y,onOpenChange:_,onOpenToggle:E.useCallback(()=>_(b=>!b),[_]),hasCustomAnchor:p,onCustomAnchorAdd:E.useCallback(()=>x(!0),[]),onCustomAnchorRemove:E.useCallback(()=>x(!1),[]),modal:l,children:n})})};x9e.displayName=Iae;var y9e="PopoverAnchor",Zkt=E.forwardRef((e,t)=>{const{__scopePopover:n,...s}=e,a=Av(y9e,n),o=gP(n),{onCustomAnchorAdd:l,onCustomAnchorRemove:i}=a;return E.useEffect(()=>(l(),()=>i()),[l,i]),r.jsx(_3,{...o,...s,ref:t})});Zkt.displayName=y9e;var v9e="PopoverTrigger",_9e=E.forwardRef((e,t)=>{const{__scopePopover:n,...s}=e,a=Av(v9e,n),o=gP(n),l=la(t,a.triggerRef),i=r.jsx(Fn.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.contentId,"data-state":N9e(a.open),...s,ref:l,onClick:un(e.onClick,a.onOpenToggle)});return a.hasCustomAnchor?i:r.jsx(_3,{asChild:!0,...o,children:i})});_9e.displayName=v9e;var L0e="PopoverPortal",[Ykt,Xkt]=g9e(L0e,{forceMount:void 0}),b9e=e=>{const{__scopePopover:t,forceMount:n,children:s,container:a}=e,o=Av(L0e,t);return r.jsx(Ykt,{scope:t,forceMount:n,children:r.jsx(Tc,{present:n||o.open,children:r.jsx(m3,{asChild:!0,container:a,children:s})})})};b9e.displayName=L0e;var $C="PopoverContent",w9e=E.forwardRef((e,t)=>{const n=Xkt($C,e.__scopePopover),{forceMount:s=n.forceMount,...a}=e,o=Av($C,e.__scopePopover);return r.jsx(Tc,{present:s||o.open,children:o.modal?r.jsx(Jkt,{...a,ref:t}):r.jsx(eNt,{...a,ref:t})})});w9e.displayName=$C;var Qkt=cv("PopoverContent.RemoveScroll"),Jkt=E.forwardRef((e,t)=>{const n=Av($C,e.__scopePopover),s=E.useRef(null),a=la(t,s),o=E.useRef(!1);return E.useEffect(()=>{const l=s.current;if(l)return Mse(l)},[]),r.jsx(eP,{as:Qkt,allowPinchZoom:!0,children:r.jsx(j9e,{...e,ref:a,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:un(e.onCloseAutoFocus,l=>{var i;l.preventDefault(),o.current||(i=n.triggerRef.current)==null||i.focus()}),onPointerDownOutside:un(e.onPointerDownOutside,l=>{const i=l.detail.originalEvent,u=i.button===0&&i.ctrlKey===!0,p=i.button===2||u;o.current=p},{checkForDefaultPrevented:!1}),onFocusOutside:un(e.onFocusOutside,l=>l.preventDefault(),{checkForDefaultPrevented:!1})})})}),eNt=E.forwardRef((e,t)=>{const n=Av($C,e.__scopePopover),s=E.useRef(!1),a=E.useRef(!1);return r.jsx(j9e,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:o=>{var l,i;(l=e.onCloseAutoFocus)==null||l.call(e,o),o.defaultPrevented||(s.current||(i=n.triggerRef.current)==null||i.focus(),o.preventDefault()),s.current=!1,a.current=!1},onInteractOutside:o=>{var u,p;(u=e.onInteractOutside)==null||u.call(e,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()}})}),j9e=E.forwardRef((e,t)=>{const{__scopePopover:n,trapFocus:s,onOpenAutoFocus:a,onCloseAutoFocus:o,disableOutsidePointerEvents:l,onEscapeKeyDown:i,onPointerDownOutside:u,onFocusOutside:p,onInteractOutside:x,...y}=e,_=Av($C,n),b=gP(n);return Cse(),r.jsx(QI,{asChild:!0,loop:!0,trapped:s,onMountAutoFocus:a,onUnmountAutoFocus:o,children:r.jsx(_v,{asChild:!0,disableOutsidePointerEvents:l,onInteractOutside:x,onEscapeKeyDown:i,onPointerDownOutside:u,onFocusOutside:p,onDismiss:()=>_.onOpenChange(!1),children:r.jsx(KI,{"data-state":N9e(_.open),role:"dialog",id:_.contentId,...b,...y,ref:t,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)"}})})})}),k9e="PopoverClose",tNt=E.forwardRef((e,t)=>{const{__scopePopover:n,...s}=e,a=Av(k9e,n);return r.jsx(Fn.button,{type:"button",...s,ref:t,onClick:un(e.onClick,()=>a.onOpenChange(!1))})});tNt.displayName=k9e;var rNt="PopoverArrow",nNt=E.forwardRef((e,t)=>{const{__scopePopover:n,...s}=e,a=gP(n);return r.jsx(ZI,{...a,...s,ref:t})});nNt.displayName=rNt;function N9e(e){return e?"open":"closed"}var sNt=x9e,aNt=_9e,iNt=b9e,S9e=w9e;const Vc=sNt,Hc=aNt,Mc=E.forwardRef(({className:e,align:t="center",sideOffset:n=4,...s},a)=>r.jsx(iNt,{children:r.jsx(S9e,{ref:a,align:t,sideOffset:n,className:Bt("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",e),...s})}));Mc.displayName=S9e.displayName;const oNt=g3("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"}}),O0e=E.forwardRef(({className:e,variant:t,...n},s)=>r.jsx("div",{ref:s,role:"alert",className:Bt(oNt({variant:t}),e),...n}));O0e.displayName="Alert";const lNt=E.forwardRef(({className:e,...t},n)=>r.jsx("h5",{ref:n,className:Bt("mb-1 font-medium leading-none tracking-tight",e),...t}));lNt.displayName="AlertTitle";const D0e=E.forwardRef(({className:e,...t},n)=>r.jsx("div",{ref:n,className:Bt("text-sm [&_p]:leading-relaxed",e),...t}));D0e.displayName="AlertDescription";function cNt({open:e,onOpenChange:t,imageUrl:n,imageId:s,defaultCaption:a="",swagItemId:o,reelId:l}){const i=Hr(),[u,p]=E.useState(a),[x,y]=E.useState([]),[_,b]=E.useState(null),[S,k]=E.useState("now"),[M,P]=E.useState(SNe(PNe(new Date),1)),[T,I]=E.useState("12"),[z,D]=E.useState("00"),[U,V]=E.useState("PM");E.useEffect(()=>{if(e){p(a),k("now"),y([]);const _e=SNe(PNe(new Date),1);P(_e);const Je=_e.getHours();I(String(Je>12?Je-12:Je===0?12:Je)),D("00"),V(Je>=12?"PM":"AM")}},[e,a]);const W=()=>{if(!M)return null;let _e=parseInt(T);const Je=parseInt(z);return U==="PM"&&_e!==12&&(_e+=12),U==="AM"&&_e===12&&(_e=0),MDe(CDe(M,_e),Je)},{data:G,isLoading:J}=Kt({queryKey:["social-accounts-for-post"],queryFn:async()=>{const{data:{user:_e}}=await Q.auth.getUser();if(!_e)return[];const{data:Je,error:Te}=await Q.from("social_accounts").select("*").eq("user_id",_e.id).eq("is_active",!0).order("platform",{ascending:!0});if(Te)throw Te;return console.log("Fetched social accounts for posting:",Je),Je},enabled:e,staleTime:0}),ne=ir({mutationFn:async({accountId:_e,platform:Je})=>{b(_e);const{data:Te,error:De}=await Q.functions.invoke("social-post",{body:{platform:Je,accountId:_e,imageUrl:n,caption:u}});if(De)throw De;if(Te!=null&&Te.error)throw new Error(Te.error);return Te},onSuccess:_e=>{const Je=_e.platform==="facebook"?"Facebook":_e.platform==="instagram"?"Instagram":_e.platform==="linkedin"?"LinkedIn":"Google Business";Ie.success(`Posted to ${Je}!`)},onError:_e=>{Ie.error(`Failed to post: ${_e.message}`)},onSettled:()=>{b(null)}}),oe=ir({mutationFn:async({accountId:_e,platform:Je,scheduledFor:Te})=>{const{data:{user:De}}=await Q.auth.getUser();if(!De)throw new Error("Not authenticated");const{error:Ue}=await Q.from("scheduled_posts").insert({user_id:De.id,social_account_id:_e,platform:Je,image_url:n,caption:u,swag_item_id:o||null,reel_id:l||null,scheduled_for:Te.toISOString(),status:"scheduled"});if(Ue)throw Ue;return{platform:Je}},onSuccess:_e=>{const Je=_e.platform==="facebook"?"Facebook":_e.platform==="instagram"?"Instagram":"LinkedIn";Ie.success(`Post scheduled for ${Je}!`)},onError:_e=>{Ie.error(`Failed to schedule: ${_e.message}`)}}),ge=async()=>{if(x.length===0){Ie.error("Please select at least one account");return}if(S==="schedule"){const _e=W();if(!_e||_e<=new Date){Ie.error("Please select a future date and time");return}for(const Je of x){const Te=G==null?void 0:G.find(De=>De.id===Je);Te&&await oe.mutateAsync({accountId:Je,platform:Te.platform,scheduledFor:_e})}i.invalidateQueries({queryKey:["scheduled-posts"]}),Ie.success(`${x.length} post(s) scheduled for ${on(_e,"PPp")}`)}else for(const _e of x){const Je=G==null?void 0:G.find(Te=>Te.id===_e);Je&&await ne.mutateAsync({accountId:_e,platform:Je.platform})}i.invalidateQueries({queryKey:["scheduled-posts"]}),p(""),y([]),t(!1)},ie=_e=>{y(Je=>Je.includes(_e)?Je.filter(Te=>Te!==_e):[...Je,_e])},pe=(G==null?void 0:G.filter(_e=>_e.platform==="facebook"))||[],se=(G==null?void 0:G.filter(_e=>_e.platform==="instagram"))||[],fe=(G==null?void 0:G.filter(_e=>_e.platform==="linkedin"))||[],he=(G==null?void 0:G.filter(_e=>_e.platform==="google_business"))||[],ye=((G==null?void 0:G.length)||0)>0,Ae=ne.isPending||oe.isPending,we=Array.from({length:12},(_e,Je)=>String(Je+1)),be=["00","15","30","45"];return r.jsx(Or,{open:e,onOpenChange:t,children:r.jsxs(Ir,{className:"sm:max-w-lg max-h-[90vh] overflow-y-auto",children:[r.jsxs($r,{children:[r.jsx(Fr,{children:"Create Social Post"}),r.jsx(Zn,{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($e,{htmlFor:"caption",children:"Caption"}),r.jsx(Jn,{id:"caption",placeholder:"Write a caption for your post...",value:u,onChange:_e=>p(_e.target.value),rows:3}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[u.length,"/2200 characters"]})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsx($e,{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:()=>k("now"),className:Bt("flex-1 px-4 py-2 rounded-md text-sm font-medium transition-all",S==="now"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"Post Now"}),r.jsx("button",{type:"button",onClick:()=>k("schedule"),className:Bt("flex-1 px-4 py-2 rounded-md text-sm font-medium transition-all",S==="schedule"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"Schedule"})]})]}),S==="schedule"&&r.jsxs("div",{className:"space-y-3 p-4 border rounded-lg bg-muted/30",children:[r.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium",children:[r.jsx(Ya,{className:"h-4 w-4"}),"Schedule for"]}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[r.jsxs(Vc,{children:[r.jsx(Hc,{asChild:!0,children:r.jsxs(ee,{variant:"outline",className:Bt("justify-start text-left font-normal flex-1",!M&&"text-muted-foreground"),children:[r.jsx(Ss,{className:"mr-2 h-4 w-4"}),M?on(M,"PPP"):r.jsx("span",{children:"Pick a date"})]})}),r.jsx(Mc,{className:"w-auto p-0",align:"start",children:r.jsx(Pm,{mode:"single",selected:M,onSelect:P,disabled:_e=>_er.jsx(qt,{value:_e,children:_e},_e))})]}),r.jsx("span",{className:"text-muted-foreground",children:":"}),r.jsxs(mn,{value:z,onValueChange:D,children:[r.jsx(fn,{className:"w-[70px]",children:r.jsx(yn,{})}),r.jsx(pn,{children:be.map(_e=>r.jsx(qt,{value:_e,children:_e},_e))})]}),r.jsxs(mn,{value:U,onValueChange:_e=>V(_e),children:[r.jsx(fn,{className:"w-[70px]",children:r.jsx(yn,{})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"AM",children:"AM"}),r.jsx(qt,{value:"PM",children:"PM"})]})]})]})]}),M&&r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Post will be published on ",on(W()||new Date,"PPP 'at' p")]})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsx($e,{children:"Post to"}),J&&r.jsx("div",{className:"flex items-center justify-center py-4",children:r.jsx(Zr,{className:"h-6 w-6 animate-spin"})}),!J&&!ye&&r.jsxs(O0e,{children:[r.jsx(yl,{className:"h-4 w-4"}),r.jsxs(D0e,{className:"flex flex-col gap-2",children:[r.jsx("span",{children:"No social accounts connected yet."}),r.jsxs(oo,{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"]})]})]}),pe.length>0&&r.jsxs("div",{className:"space-y-2",children:[r.jsxs("p",{className:"text-sm font-medium text-muted-foreground flex items-center gap-2",children:[r.jsx(au,{className:"h-4 w-4 text-blue-600"})," Facebook"]}),pe.map(_e=>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(Bl,{checked:x.includes(_e.id),onCheckedChange:()=>ie(_e.id),disabled:_===_e.id}),r.jsxs(Qs,{className:"h-8 w-8",children:[r.jsx(Si,{src:_e.profile_picture_url||""}),r.jsx(Js,{children:r.jsx(au,{className:"h-4 w-4"})})]}),r.jsx("span",{className:"flex-1 text-sm font-medium",children:_e.page_name||_e.platform_username}),_===_e.id&&r.jsx(Zr,{className:"h-4 w-4 animate-spin"})]},_e.id))]}),se.length>0&&r.jsxs("div",{className:"space-y-2",children:[r.jsxs("p",{className:"text-sm font-medium text-muted-foreground flex items-center gap-2",children:[r.jsx(_u,{className:"h-4 w-4 text-pink-600"})," Instagram"]}),se.map(_e=>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(Bl,{checked:x.includes(_e.id),onCheckedChange:()=>ie(_e.id),disabled:_===_e.id}),r.jsxs(Qs,{className:"h-8 w-8",children:[r.jsx(Si,{src:_e.profile_picture_url||""}),r.jsx(Js,{children:r.jsx(_u,{className:"h-4 w-4"})})]}),r.jsxs("span",{className:"flex-1 text-sm font-medium",children:["@",_e.platform_username]}),_===_e.id&&r.jsx(Zr,{className:"h-4 w-4 animate-spin"})]},_e.id))]}),fe.length>0&&r.jsxs("div",{className:"space-y-2",children:[r.jsxs("p",{className:"text-sm font-medium text-muted-foreground flex items-center gap-2",children:[r.jsx(gf,{className:"h-4 w-4 text-blue-700"})," LinkedIn"]}),fe.map(_e=>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(Bl,{checked:x.includes(_e.id),onCheckedChange:()=>ie(_e.id),disabled:_===_e.id}),r.jsxs(Qs,{className:"h-8 w-8",children:[r.jsx(Si,{src:_e.profile_picture_url||""}),r.jsx(Js,{children:r.jsx(gf,{className:"h-4 w-4"})})]}),r.jsx("span",{className:"flex-1 text-sm font-medium",children:_e.platform_username}),_===_e.id&&r.jsx(Zr,{className:"h-4 w-4 animate-spin"})]},_e.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(Po,{className:"h-4 w-4 text-red-600"})," Google Business"]}),he.map(_e=>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(Bl,{checked:x.includes(_e.id),onCheckedChange:()=>ie(_e.id),disabled:_===_e.id}),r.jsxs(Qs,{className:"h-8 w-8",children:[r.jsx(Si,{src:_e.profile_picture_url||""}),r.jsx(Js,{children:r.jsx(Po,{className:"h-4 w-4"})})]}),r.jsx("span",{className:"flex-1 text-sm font-medium",children:_e.page_name||_e.platform_username}),_===_e.id&&r.jsx(Zr,{className:"h-4 w-4 animate-spin"})]},_e.id))]})]})]}),r.jsxs(Bs,{children:[r.jsx(ee,{variant:"outline",onClick:()=>t(!1),children:"Cancel"}),r.jsxs(ee,{onClick:ge,disabled:x.length===0||Ae,className:"gap-2",children:[Ae?r.jsx(Zr,{className:"h-4 w-4 animate-spin"}):S==="schedule"?r.jsx(Ss,{className:"h-4 w-4"}):r.jsx(lo,{className:"h-4 w-4"}),S==="schedule"?`Schedule ${x.length} post${x.length!==1?"s":""}`:`Post to ${x.length} account${x.length!==1?"s":""}`]})]})]})})}function dNt(){const e=Hr(),[t,n]=E.useState(void 0),[s,a]=E.useState("all"),[o,l]=E.useState(null),[i,u]=E.useState(""),[p,x]=E.useState(void 0),[y,_]=E.useState("12"),[b,S]=E.useState("00"),[k,M]=E.useState("PM"),{data:P=[],isLoading:T}=Kt({queryKey:["scheduled-posts"],queryFn:async()=>{const{data:he,error:ye}=await Q.from("scheduled_posts").select(` *, social_accounts ( page_name, platform_username, profile_picture_url ) `).order("scheduled_for",{ascending:!1});if(ye)throw ye;return he}}),I=P.filter(he=>{if(s!=="all"&&he.status!==s)return!1;if(t&&he.scheduled_for){const ye=new Date(he.scheduled_for);if(!ac(ye,t))return!1}return!0}),z=P.filter(he=>he.scheduled_for).map(he=>Sf(new Date(he.scheduled_for))),D=ir({mutationFn:async he=>{const{error:ye}=await Q.from("scheduled_posts").update({caption:he.caption,scheduled_for:he.scheduled_for}).eq("id",he.id);if(ye)throw ye},onSuccess:()=>{Ie.success("Post updated!"),e.invalidateQueries({queryKey:["scheduled-posts"]}),l(null)},onError:he=>{Ie.error(`Failed to update: ${he.message}`)}}),U=ir({mutationFn:async he=>{const{error:ye}=await Q.from("scheduled_posts").update({status:"cancelled"}).eq("id",he);if(ye)throw ye},onSuccess:()=>{Ie.success("Post cancelled"),e.invalidateQueries({queryKey:["scheduled-posts"]})},onError:he=>{Ie.error(`Failed to cancel: ${he.message}`)}}),V=ir({mutationFn:async he=>{const{error:ye}=await Q.from("scheduled_posts").delete().eq("id",he);if(ye)throw ye},onSuccess:()=>{Ie.success("Post deleted"),e.invalidateQueries({queryKey:["scheduled-posts"]})},onError:he=>{Ie.error(`Failed to delete: ${he.message}`)}}),W=ir({mutationFn:async he=>{const{data:ye,error:Ae}=await Q.functions.invoke("social-post",{body:{platform:he.platform,accountId:he.social_account_id,imageUrl:he.image_url,caption:he.caption}});if(Ae)throw Ae;if(ye!=null&&ye.error)throw new Error(ye.error);return await Q.from("scheduled_posts").update({status:"posted",posted_at:new Date().toISOString(),post_id:ye.postId}).eq("id",he.id),ye},onSuccess:he=>{const ye=he.platform==="facebook"?"Facebook":he.platform==="instagram"?"Instagram":"LinkedIn";Ie.success(`Posted to ${ye}!`),e.invalidateQueries({queryKey:["scheduled-posts"]})},onError:he=>{Ie.error(`Failed to post: ${he.message}`)}}),G=he=>{if(l(he),u(he.caption||""),he.scheduled_for){const ye=new Date(he.scheduled_for);x(ye);const Ae=ye.getHours();_(String(Ae>12?Ae-12:Ae===0?12:Ae)),S(String(ye.getMinutes()).padStart(2,"0")),M(Ae>=12?"PM":"AM")}},J=()=>{if(!o||!p)return;let he=parseInt(y);const ye=parseInt(b);k==="PM"&&he!==12&&(he+=12),k==="AM"&&he===12&&(he=0);const Ae=MDe(CDe(p,he),ye);D.mutate({id:o.id,caption:i,scheduled_for:Ae.toISOString()})},ne=he=>{switch(he){case"facebook":return r.jsx(au,{className:"h-4 w-4 text-blue-600"});case"instagram":return r.jsx(_u,{className:"h-4 w-4 text-pink-600"});case"linkedin":return r.jsx(gf,{className:"h-4 w-4 text-blue-700"});default:return null}},oe=he=>{switch(he){case"scheduled":return r.jsxs(Pt,{variant:"secondary",className:"gap-1",children:[r.jsx(Ya,{className:"h-3 w-3"}),"Scheduled"]});case"posted":return r.jsxs(Pt,{variant:"default",className:"gap-1 bg-green-600",children:[r.jsx(di,{className:"h-3 w-3"}),"Posted"]});case"failed":return r.jsxs(Pt,{variant:"destructive",className:"gap-1",children:[r.jsx(bc,{className:"h-3 w-3"}),"Failed"]});case"cancelled":return r.jsxs(Pt,{variant:"outline",className:"gap-1 text-muted-foreground",children:[r.jsx(yl,{className:"h-3 w-3"}),"Cancelled"]});default:return r.jsx(Pt,{variant:"outline",children:he})}},ge=Array.from({length:12},(he,ye)=>String(ye+1)),ie=["00","15","30","45"],pe=P.filter(he=>he.status==="scheduled").length,se=P.filter(he=>he.status==="posted").length,fe=P.filter(he=>he.status==="scheduled"&&he.scheduled_for&&Xht(new Date(he.scheduled_for))).length;return r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[r.jsxs(Ze,{className:"p-4",children:[r.jsx("div",{className:"text-2xl font-bold",children:pe}),r.jsx("div",{className:"text-sm text-muted-foreground",children:"Scheduled"})]}),r.jsxs(Ze,{className:"p-4",children:[r.jsx("div",{className:"text-2xl font-bold",children:fe}),r.jsx("div",{className:"text-sm text-muted-foreground",children:"Upcoming"})]}),r.jsxs(Ze,{className:"p-4",children:[r.jsx("div",{className:"text-2xl font-bold",children:se}),r.jsx("div",{className:"text-sm text-muted-foreground",children:"Posted"})]}),r.jsxs(Ze,{className:"p-4",children:[r.jsx("div",{className:"text-2xl font-bold",children:P.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(Ze,{className:"p-4",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-4",children:[r.jsx(Cm,{className:"h-5 w-5"}),r.jsx("h3",{className:"font-semibold",children:"Calendar"})]}),r.jsx(Pm,{mode:"single",selected:t,onSelect:n,className:Bt("pointer-events-auto"),modifiers:{hasPost:z},modifiersStyles:{hasPost:{fontWeight:"bold",backgroundColor:"hsl(var(--primary) / 0.1)",borderRadius:"50%"}}}),t&&r.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>n(void 0),className:"w-full mt-2",children:"Clear date filter"})]}),r.jsxs("div",{className:"flex-1 space-y-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(V1,{className:"h-4 w-4 text-muted-foreground"}),r.jsx("div",{className:"flex flex-wrap gap-1",children:["all","scheduled","posted","failed","cancelled"].map(he=>r.jsx(ee,{variant:s===he?"default":"outline",size:"sm",onClick:()=>a(he),className:"capitalize",children:he},he))})]}),T&&r.jsx("div",{className:"flex items-center justify-center py-12",children:r.jsx(Zr,{className:"h-8 w-8 animate-spin text-muted-foreground"})}),!T&&I.length===0&&r.jsxs(Ze,{className:"p-8 text-center",children:[r.jsx(Ss,{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:t?`No posts scheduled for ${on(t,"PPP")}`:"Schedule a post from Social Swag to get started!"})]}),r.jsx("div",{className:"space-y-4",children:I.map(he=>{var ye,Ae;return r.jsx(Ze,{className:"overflow-hidden",children:r.jsxs("div",{className:"flex flex-col sm:flex-row",children:[r.jsx("div",{className:"sm:w-32 h-32 sm:h-auto bg-muted flex-shrink-0",children:r.jsx("img",{src:he.image_url,alt:"Post preview",className:"w-full h-full object-cover"})}),r.jsxs(et,{className:"flex-1 p-4",children:[r.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-2 mb-2",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[ne(he.platform),r.jsx("span",{className:"font-medium",children:((ye=he.social_accounts)==null?void 0:ye.page_name)||((Ae=he.social_accounts)==null?void 0:Ae.platform_username)||"Unknown"}),oe(he.status)]}),r.jsxs("div",{className:"flex items-center gap-1",children:[he.status==="scheduled"&&r.jsxs(YI,{children:[r.jsxs(Ug,{children:[r.jsx(qg,{asChild:!0,children:r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>G(he),children:r.jsx(ni,{className:"h-4 w-4"})})}),r.jsx(Im,{children:"Edit post"})]}),r.jsxs(Ug,{children:[r.jsx(qg,{asChild:!0,children:r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>W.mutate(he),disabled:W.isPending,children:W.isPending?r.jsx(Zr,{className:"h-4 w-4 animate-spin"}):r.jsx(lo,{className:"h-4 w-4"})})}),r.jsx(Im,{children:"Post now"})]}),r.jsxs(Id,{children:[r.jsx(wm,{asChild:!0,children:r.jsx(ee,{variant:"ghost",size:"icon",className:"text-destructive",children:r.jsx(Bn,{className:"h-4 w-4"})})}),r.jsxs(id,{children:[r.jsxs(od,{children:[r.jsx(cd,{children:"Cancel this scheduled post?"}),r.jsx(dd,{children:"This will cancel the post. You can delete it entirely or keep it in your history."})]}),r.jsxs(ld,{children:[r.jsx(ud,{children:"Keep"}),r.jsx(Bc,{onClick:()=>U.mutate(he.id),className:"bg-amber-600 hover:bg-amber-700",children:"Cancel Post"}),r.jsx(Bc,{onClick:()=>V.mutate(he.id),className:"bg-destructive hover:bg-destructive/90",children:"Delete"})]})]})]})]}),(he.status==="posted"||he.status==="cancelled"||he.status==="failed")&&r.jsxs(Id,{children:[r.jsx(wm,{asChild:!0,children:r.jsx(ee,{variant:"ghost",size:"icon",className:"text-destructive",children:r.jsx(Bn,{className:"h-4 w-4"})})}),r.jsxs(id,{children:[r.jsxs(od,{children:[r.jsx(cd,{children:"Delete this post?"}),r.jsx(dd,{children:"This will permanently remove this post from your history."})]}),r.jsxs(ld,{children:[r.jsx(ud,{children:"Cancel"}),r.jsx(Bc,{onClick:()=>V.mutate(he.id),className:"bg-destructive hover:bg-destructive/90",children:"Delete"})]})]})]})]})]}),he.caption&&r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 mb-2",children:he.caption}),r.jsxs("div",{className:"text-xs text-muted-foreground flex items-center gap-1",children:[r.jsx(Ya,{className:"h-3 w-3"}),he.status==="posted"&&he.posted_at?`Posted ${on(new Date(he.posted_at),"PPp")}`:he.scheduled_for?`Scheduled for ${on(new Date(he.scheduled_for),"PPp")}`:"Not scheduled"]}),he.status==="failed"&&he.error_message&&r.jsxs("p",{className:"text-xs text-destructive mt-2",children:["Error: ",he.error_message]})]})]})},he.id)})})]})]}),r.jsx(Or,{open:!!o,onOpenChange:he=>!he&&l(null),children:r.jsxs(Ir,{className:"max-w-lg",children:[r.jsxs($r,{children:[r.jsx(Fr,{children:"Edit Scheduled Post"}),r.jsx(Zn,{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($e,{children:"Caption"}),r.jsx(Jn,{value:i,onChange:he=>u(he.target.value),rows:3})]}),r.jsxs("div",{className:"space-y-3 p-4 border rounded-lg",children:[r.jsx($e,{children:"Schedule for"}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[r.jsxs(Vc,{children:[r.jsx(Hc,{asChild:!0,children:r.jsxs(ee,{variant:"outline",className:Bt("justify-start text-left font-normal flex-1",!p&&"text-muted-foreground"),children:[r.jsx(Ss,{className:"mr-2 h-4 w-4"}),p?on(p,"PPP"):"Pick a date"]})}),r.jsx(Mc,{className:"w-auto p-0",align:"start",children:r.jsx(Pm,{mode:"single",selected:p,onSelect:x,disabled:he=>her.jsx(qt,{value:he,children:he},he))})]}),r.jsx("span",{className:"text-muted-foreground",children:":"}),r.jsxs(mn,{value:b,onValueChange:S,children:[r.jsx(fn,{className:"w-[70px]",children:r.jsx(yn,{})}),r.jsx(pn,{children:ie.map(he=>r.jsx(qt,{value:he,children:he},he))})]}),r.jsxs(mn,{value:k,onValueChange:he=>M(he),children:[r.jsx(fn,{className:"w-[70px]",children:r.jsx(yn,{})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"AM",children:"AM"}),r.jsx(qt,{value:"PM",children:"PM"})]})]})]})]})]})]}),r.jsxs(Bs,{children:[r.jsx(ee,{variant:"outline",onClick:()=>l(null),children:"Cancel"}),r.jsxs(ee,{onClick:J,disabled:D.isPending,children:[D.isPending?r.jsx(Zr,{className:"h-4 w-4 animate-spin mr-2"}):null,"Save Changes"]})]})]})})]})}function _O(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var C9e={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(e,t){(function(n){e.exports=n()})(function(){return function n(s,a,o){function l(p,x){if(!a[p]){if(!s[p]){var y=typeof _O=="function"&&_O;if(!x&&y)return y(p,!0);if(i)return i(p,!0);var _=new Error("Cannot find module '"+p+"'");throw _.code="MODULE_NOT_FOUND",_}var b=a[p]={exports:{}};s[p][0].call(b.exports,function(S){var k=s[p][1][S];return l(k||S)},b,b.exports,n,s,a,o)}return a[p].exports}for(var i=typeof _O=="function"&&_O,u=0;u>2,b=(3&p)<<4|x>>4,S=1>6:64,k=2>4,x=(15&_)<<4|(b=i.indexOf(u.charAt(k++)))>>2,y=(3&b)<<6|(S=i.indexOf(u.charAt(k++))),T[M++]=p,b!==64&&(T[M++]=x),S!==64&&(T[M++]=y);return T}},{"./support":30,"./utils":32}],2:[function(n,s,a){var o=n("./external"),l=n("./stream/DataWorker"),i=n("./stream/Crc32Probe"),u=n("./stream/DataLengthProbe");function p(x,y,_,b,S){this.compressedSize=x,this.uncompressedSize=y,this.crc32=_,this.compression=b,this.compressedContent=S}p.prototype={getContentWorker:function(){var x=new l(o.Promise.resolve(this.compressedContent)).pipe(this.compression.uncompressWorker()).pipe(new u("data_length")),y=this;return x.on("end",function(){if(this.streamInfo.data_length!==y.uncompressedSize)throw new Error("Bug : uncompressed data size mismatch")}),x},getCompressedWorker:function(){return new l(o.Promise.resolve(this.compressedContent)).withStreamInfo("compressedSize",this.compressedSize).withStreamInfo("uncompressedSize",this.uncompressedSize).withStreamInfo("crc32",this.crc32).withStreamInfo("compression",this.compression)}},p.createWorkerFrom=function(x,y,_){return x.pipe(new i).pipe(new u("uncompressedSize")).pipe(y.compressWorker(_)).pipe(new u("compressedSize")).withStreamInfo("compression",y)},s.exports=p},{"./external":6,"./stream/Crc32Probe":25,"./stream/DataLengthProbe":26,"./stream/DataWorker":27}],3:[function(n,s,a){var o=n("./stream/GenericWorker");a.STORE={magic:"\0\0",compressWorker:function(){return new o("STORE compression")},uncompressWorker:function(){return new o("STORE decompression")}},a.DEFLATE=n("./flate")},{"./flate":7,"./stream/GenericWorker":28}],4:[function(n,s,a){var o=n("./utils"),l=function(){for(var i,u=[],p=0;p<256;p++){i=p;for(var x=0;x<8;x++)i=1&i?3988292384^i>>>1:i>>>1;u[p]=i}return u}();s.exports=function(i,u){return i!==void 0&&i.length?o.getTypeOf(i)!=="string"?function(p,x,y,_){var b=l,S=_+y;p^=-1;for(var k=_;k>>8^b[255&(p^x[k])];return-1^p}(0|u,i,i.length,0):function(p,x,y,_){var b=l,S=_+y;p^=-1;for(var k=_;k>>8^b[255&(p^x.charCodeAt(k))];return-1^p}(0|u,i,i.length,0):0}},{"./utils":32}],5:[function(n,s,a){a.base64=!1,a.binary=!1,a.dir=!1,a.createFolders=!0,a.date=null,a.compression=null,a.compressionOptions=null,a.comment=null,a.unixPermissions=null,a.dosPermissions=null},{}],6:[function(n,s,a){var o=null;o=typeof Promise<"u"?Promise:n("lie"),s.exports={Promise:o}},{lie:37}],7:[function(n,s,a){var o=typeof Uint8Array<"u"&&typeof Uint16Array<"u"&&typeof Uint32Array<"u",l=n("pako"),i=n("./utils"),u=n("./stream/GenericWorker"),p=o?"uint8array":"array";function x(y,_){u.call(this,"FlateWorker/"+y),this._pako=null,this._pakoAction=y,this._pakoOptions=_,this.meta={}}a.magic="\b\0",i.inherits(x,u),x.prototype.processChunk=function(y){this.meta=y.meta,this._pako===null&&this._createPako(),this._pako.push(i.transformTo(p,y.data),!1)},x.prototype.flush=function(){u.prototype.flush.call(this),this._pako===null&&this._createPako(),this._pako.push([],!0)},x.prototype.cleanUp=function(){u.prototype.cleanUp.call(this),this._pako=null},x.prototype._createPako=function(){this._pako=new l[this._pakoAction]({raw:!0,level:this._pakoOptions.level||-1});var y=this;this._pako.onData=function(_){y.push({data:_,meta:y.meta})}},a.compressWorker=function(y){return new x("Deflate",y)},a.uncompressWorker=function(){return new x("Inflate",{})}},{"./stream/GenericWorker":28,"./utils":32,pako:38}],8:[function(n,s,a){function o(b,S){var k,M="";for(k=0;k>>=8;return M}function l(b,S,k,M,P,T){var I,z,D=b.file,U=b.compression,V=T!==p.utf8encode,W=i.transformTo("string",T(D.name)),G=i.transformTo("string",p.utf8encode(D.name)),J=D.comment,ne=i.transformTo("string",T(J)),oe=i.transformTo("string",p.utf8encode(J)),ge=G.length!==D.name.length,ie=oe.length!==J.length,pe="",se="",fe="",he=D.dir,ye=D.date,Ae={crc32:0,compressedSize:0,uncompressedSize:0};S&&!k||(Ae.crc32=b.crc32,Ae.compressedSize=b.compressedSize,Ae.uncompressedSize=b.uncompressedSize);var we=0;S&&(we|=8),V||!ge&&!ie||(we|=2048);var be=0,_e=0;he&&(be|=16),P==="UNIX"?(_e=798,be|=function(Te,De){var Ue=Te;return Te||(Ue=De?16893:33204),(65535&Ue)<<16}(D.unixPermissions,he)):(_e=20,be|=function(Te){return 63&(Te||0)}(D.dosPermissions)),I=ye.getUTCHours(),I<<=6,I|=ye.getUTCMinutes(),I<<=5,I|=ye.getUTCSeconds()/2,z=ye.getUTCFullYear()-1980,z<<=4,z|=ye.getUTCMonth()+1,z<<=5,z|=ye.getUTCDate(),ge&&(se=o(1,1)+o(x(W),4)+G,pe+="up"+o(se.length,2)+se),ie&&(fe=o(1,1)+o(x(ne),4)+oe,pe+="uc"+o(fe.length,2)+fe);var Je="";return Je+=` \0`,Je+=o(we,2),Je+=U.magic,Je+=o(I,2),Je+=o(z,2),Je+=o(Ae.crc32,4),Je+=o(Ae.compressedSize,4),Je+=o(Ae.uncompressedSize,4),Je+=o(W.length,2),Je+=o(pe.length,2),{fileRecord:y.LOCAL_FILE_HEADER+Je+W+pe,dirRecord:y.CENTRAL_FILE_HEADER+o(_e,2)+Je+o(ne.length,2)+"\0\0\0\0"+o(be,4)+o(M,4)+W+pe+ne}}var i=n("../utils"),u=n("../stream/GenericWorker"),p=n("../utf8"),x=n("../crc32"),y=n("../signature");function _(b,S,k,M){u.call(this,"ZipFileWorker"),this.bytesWritten=0,this.zipComment=S,this.zipPlatform=k,this.encodeFileName=M,this.streamFiles=b,this.accumulate=!1,this.contentBuffer=[],this.dirRecords=[],this.currentSourceOffset=0,this.entriesCount=0,this.currentFile=null,this._sources=[]}i.inherits(_,u),_.prototype.push=function(b){var S=b.meta.percent||0,k=this.entriesCount,M=this._sources.length;this.accumulate?this.contentBuffer.push(b):(this.bytesWritten+=b.data.length,u.prototype.push.call(this,{data:b.data,meta:{currentFile:this.currentFile,percent:k?(S+100*(k-M-1))/k:100}}))},_.prototype.openedSource=function(b){this.currentSourceOffset=this.bytesWritten,this.currentFile=b.file.name;var S=this.streamFiles&&!b.file.dir;if(S){var k=l(b,S,!1,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);this.push({data:k.fileRecord,meta:{percent:0}})}else this.accumulate=!0},_.prototype.closedSource=function(b){this.accumulate=!1;var S=this.streamFiles&&!b.file.dir,k=l(b,S,!0,this.currentSourceOffset,this.zipPlatform,this.encodeFileName);if(this.dirRecords.push(k.dirRecord),S)this.push({data:function(M){return y.DATA_DESCRIPTOR+o(M.crc32,4)+o(M.compressedSize,4)+o(M.uncompressedSize,4)}(b),meta:{percent:100}});else for(this.push({data:k.fileRecord,meta:{percent:0}});this.contentBuffer.length;)this.push(this.contentBuffer.shift());this.currentFile=null},_.prototype.flush=function(){for(var b=this.bytesWritten,S=0;S=this.index;u--)p=(p<<8)+this.byteAt(u);return this.index+=i,p},readString:function(i){return o.transformTo("string",this.readData(i))},readData:function(){},lastIndexOfSignature:function(){},readAndCheckSignature:function(){},readDate:function(){var i=this.readInt(4);return new Date(Date.UTC(1980+(i>>25&127),(i>>21&15)-1,i>>16&31,i>>11&31,i>>5&63,(31&i)<<1))}},s.exports=l},{"../utils":32}],19:[function(n,s,a){var o=n("./Uint8ArrayReader");function l(i){o.call(this,i)}n("../utils").inherits(l,o),l.prototype.readData=function(i){this.checkOffset(i);var u=this.data.slice(this.zero+this.index,this.zero+this.index+i);return this.index+=i,u},s.exports=l},{"../utils":32,"./Uint8ArrayReader":21}],20:[function(n,s,a){var o=n("./DataReader");function l(i){o.call(this,i)}n("../utils").inherits(l,o),l.prototype.byteAt=function(i){return this.data.charCodeAt(this.zero+i)},l.prototype.lastIndexOfSignature=function(i){return this.data.lastIndexOf(i)-this.zero},l.prototype.readAndCheckSignature=function(i){return i===this.readData(4)},l.prototype.readData=function(i){this.checkOffset(i);var u=this.data.slice(this.zero+this.index,this.zero+this.index+i);return this.index+=i,u},s.exports=l},{"../utils":32,"./DataReader":18}],21:[function(n,s,a){var o=n("./ArrayReader");function l(i){o.call(this,i)}n("../utils").inherits(l,o),l.prototype.readData=function(i){if(this.checkOffset(i),i===0)return new Uint8Array(0);var u=this.data.subarray(this.zero+this.index,this.zero+this.index+i);return this.index+=i,u},s.exports=l},{"../utils":32,"./ArrayReader":17}],22:[function(n,s,a){var o=n("../utils"),l=n("../support"),i=n("./ArrayReader"),u=n("./StringReader"),p=n("./NodeBufferReader"),x=n("./Uint8ArrayReader");s.exports=function(y){var _=o.getTypeOf(y);return o.checkSupport(_),_!=="string"||l.uint8array?_==="nodebuffer"?new p(y):l.uint8array?new x(o.transformTo("uint8array",y)):new i(o.transformTo("array",y)):new u(y)}},{"../support":30,"../utils":32,"./ArrayReader":17,"./NodeBufferReader":19,"./StringReader":20,"./Uint8ArrayReader":21}],23:[function(n,s,a){a.LOCAL_FILE_HEADER="PK",a.CENTRAL_FILE_HEADER="PK",a.CENTRAL_DIRECTORY_END="PK",a.ZIP64_CENTRAL_DIRECTORY_LOCATOR="PK\x07",a.ZIP64_CENTRAL_DIRECTORY_END="PK",a.DATA_DESCRIPTOR="PK\x07\b"},{}],24:[function(n,s,a){var o=n("./GenericWorker"),l=n("../utils");function i(u){o.call(this,"ConvertWorker to "+u),this.destType=u}l.inherits(i,o),i.prototype.processChunk=function(u){this.push({data:l.transformTo(this.destType,u.data),meta:u.meta})},s.exports=i},{"../utils":32,"./GenericWorker":28}],25:[function(n,s,a){var o=n("./GenericWorker"),l=n("../crc32");function i(){o.call(this,"Crc32Probe"),this.withStreamInfo("crc32",0)}n("../utils").inherits(i,o),i.prototype.processChunk=function(u){this.streamInfo.crc32=l(u.data,this.streamInfo.crc32||0),this.push(u)},s.exports=i},{"../crc32":4,"../utils":32,"./GenericWorker":28}],26:[function(n,s,a){var o=n("../utils"),l=n("./GenericWorker");function i(u){l.call(this,"DataLengthProbe for "+u),this.propName=u,this.withStreamInfo(u,0)}o.inherits(i,l),i.prototype.processChunk=function(u){if(u){var p=this.streamInfo[this.propName]||0;this.streamInfo[this.propName]=p+u.data.length}l.prototype.processChunk.call(this,u)},s.exports=i},{"../utils":32,"./GenericWorker":28}],27:[function(n,s,a){var o=n("../utils"),l=n("./GenericWorker");function i(u){l.call(this,"DataWorker");var p=this;this.dataIsReady=!1,this.index=0,this.max=0,this.data=null,this.type="",this._tickScheduled=!1,u.then(function(x){p.dataIsReady=!0,p.data=x,p.max=x&&x.length||0,p.type=o.getTypeOf(x),p.isPaused||p._tickAndRepeat()},function(x){p.error(x)})}o.inherits(i,l),i.prototype.cleanUp=function(){l.prototype.cleanUp.call(this),this.data=null},i.prototype.resume=function(){return!!l.prototype.resume.call(this)&&(!this._tickScheduled&&this.dataIsReady&&(this._tickScheduled=!0,o.delay(this._tickAndRepeat,[],this)),!0)},i.prototype._tickAndRepeat=function(){this._tickScheduled=!1,this.isPaused||this.isFinished||(this._tick(),this.isFinished||(o.delay(this._tickAndRepeat,[],this),this._tickScheduled=!0))},i.prototype._tick=function(){if(this.isPaused||this.isFinished)return!1;var u=null,p=Math.min(this.max,this.index+16384);if(this.index>=this.max)return this.end();switch(this.type){case"string":u=this.data.substring(this.index,p);break;case"uint8array":u=this.data.subarray(this.index,p);break;case"array":case"nodebuffer":u=this.data.slice(this.index,p)}return this.index=p,this.push({data:u,meta:{percent:this.max?this.index/this.max*100:0}})},s.exports=i},{"../utils":32,"./GenericWorker":28}],28:[function(n,s,a){function o(l){this.name=l||"default",this.streamInfo={},this.generatedError=null,this.extraStreamInfo={},this.isPaused=!0,this.isFinished=!1,this.isLocked=!1,this._listeners={data:[],end:[],error:[]},this.previous=null}o.prototype={push:function(l){this.emit("data",l)},end:function(){if(this.isFinished)return!1;this.flush();try{this.emit("end"),this.cleanUp(),this.isFinished=!0}catch(l){this.emit("error",l)}return!0},error:function(l){return!this.isFinished&&(this.isPaused?this.generatedError=l:(this.isFinished=!0,this.emit("error",l),this.previous&&this.previous.error(l),this.cleanUp()),!0)},on:function(l,i){return this._listeners[l].push(i),this},cleanUp:function(){this.streamInfo=this.generatedError=this.extraStreamInfo=null,this._listeners=[]},emit:function(l,i){if(this._listeners[l])for(var u=0;u "+l:l}},s.exports=o},{}],29:[function(n,s,a){var o=n("../utils"),l=n("./ConvertWorker"),i=n("./GenericWorker"),u=n("../base64"),p=n("../support"),x=n("../external"),y=null;if(p.nodestream)try{y=n("../nodejs/NodejsStreamOutputAdapter")}catch{}function _(S,k){return new x.Promise(function(M,P){var T=[],I=S._internalType,z=S._outputType,D=S._mimeType;S.on("data",function(U,V){T.push(U),k&&k(V)}).on("error",function(U){T=[],P(U)}).on("end",function(){try{var U=function(V,W,G){switch(V){case"blob":return o.newBlob(o.transformTo("arraybuffer",W),G);case"base64":return u.encode(W);default:return o.transformTo(V,W)}}(z,function(V,W){var G,J=0,ne=null,oe=0;for(G=0;G"u")a.blob=!1;else{var o=new ArrayBuffer(0);try{a.blob=new Blob([o],{type:"application/zip"}).size===0}catch{try{var l=new(self.BlobBuilder||self.WebKitBlobBuilder||self.MozBlobBuilder||self.MSBlobBuilder);l.append(o),a.blob=l.getBlob("application/zip").size===0}catch{a.blob=!1}}}try{a.nodestream=!!n("readable-stream").Readable}catch{a.nodestream=!1}},{"readable-stream":16}],31:[function(n,s,a){for(var o=n("./utils"),l=n("./support"),i=n("./nodejsUtils"),u=n("./stream/GenericWorker"),p=new Array(256),x=0;x<256;x++)p[x]=252<=x?6:248<=x?5:240<=x?4:224<=x?3:192<=x?2:1;p[254]=p[254]=1;function y(){u.call(this,"utf-8 decode"),this.leftOver=null}function _(){u.call(this,"utf-8 encode")}a.utf8encode=function(b){return l.nodebuffer?i.newBufferFrom(b,"utf-8"):function(S){var k,M,P,T,I,z=S.length,D=0;for(T=0;T>>6:(M<65536?k[I++]=224|M>>>12:(k[I++]=240|M>>>18,k[I++]=128|M>>>12&63),k[I++]=128|M>>>6&63),k[I++]=128|63&M);return k}(b)},a.utf8decode=function(b){return l.nodebuffer?o.transformTo("nodebuffer",b).toString("utf-8"):function(S){var k,M,P,T,I=S.length,z=new Array(2*I);for(k=M=0;k>10&1023,z[M++]=56320|1023&P)}return z.length!==M&&(z.subarray?z=z.subarray(0,M):z.length=M),o.applyFromCharCode(z)}(b=o.transformTo(l.uint8array?"uint8array":"array",b))},o.inherits(y,u),y.prototype.processChunk=function(b){var S=o.transformTo(l.uint8array?"uint8array":"array",b.data);if(this.leftOver&&this.leftOver.length){if(l.uint8array){var k=S;(S=new Uint8Array(k.length+this.leftOver.length)).set(this.leftOver,0),S.set(k,this.leftOver.length)}else S=this.leftOver.concat(S);this.leftOver=null}var M=function(T,I){var z;for((I=I||T.length)>T.length&&(I=T.length),z=I-1;0<=z&&(192&T[z])==128;)z--;return z<0||z===0?I:z+p[T[z]]>I?z:I}(S),P=S;M!==S.length&&(l.uint8array?(P=S.subarray(0,M),this.leftOver=S.subarray(M,S.length)):(P=S.slice(0,M),this.leftOver=S.slice(M,S.length))),this.push({data:a.utf8decode(P),meta:b.meta})},y.prototype.flush=function(){this.leftOver&&this.leftOver.length&&(this.push({data:a.utf8decode(this.leftOver),meta:{}}),this.leftOver=null)},a.Utf8DecodeWorker=y,o.inherits(_,u),_.prototype.processChunk=function(b){this.push({data:a.utf8encode(b.data),meta:b.meta})},a.Utf8EncodeWorker=_},{"./nodejsUtils":14,"./stream/GenericWorker":28,"./support":30,"./utils":32}],32:[function(n,s,a){var o=n("./support"),l=n("./base64"),i=n("./nodejsUtils"),u=n("./external");function p(k){return k}function x(k,M){for(var P=0;P>8;this.dir=!!(16&this.externalFileAttributes),b==0&&(this.dosPermissions=63&this.externalFileAttributes),b==3&&(this.unixPermissions=this.externalFileAttributes>>16&65535),this.dir||this.fileNameStr.slice(-1)!=="/"||(this.dir=!0)},parseZIP64ExtraField:function(){if(this.extraFields[1]){var b=o(this.extraFields[1].value);this.uncompressedSize===l.MAX_VALUE_32BITS&&(this.uncompressedSize=b.readInt(8)),this.compressedSize===l.MAX_VALUE_32BITS&&(this.compressedSize=b.readInt(8)),this.localHeaderOffset===l.MAX_VALUE_32BITS&&(this.localHeaderOffset=b.readInt(8)),this.diskNumberStart===l.MAX_VALUE_32BITS&&(this.diskNumberStart=b.readInt(4))}},readExtraFields:function(b){var S,k,M,P=b.index+this.extraFieldsLength;for(this.extraFields||(this.extraFields={});b.index+4>>6:(b<65536?_[M++]=224|b>>>12:(_[M++]=240|b>>>18,_[M++]=128|b>>>12&63),_[M++]=128|b>>>6&63),_[M++]=128|63&b);return _},a.buf2binstring=function(y){return x(y,y.length)},a.binstring2buf=function(y){for(var _=new o.Buf8(y.length),b=0,S=_.length;b>10&1023,T[S++]=56320|1023&k)}return x(T,S)},a.utf8border=function(y,_){var b;for((_=_||y.length)>y.length&&(_=y.length),b=_-1;0<=b&&(192&y[b])==128;)b--;return b<0||b===0?_:b+u[y[b]]>_?b:_}},{"./common":41}],43:[function(n,s,a){s.exports=function(o,l,i,u){for(var p=65535&o|0,x=o>>>16&65535|0,y=0;i!==0;){for(i-=y=2e3>>1:l>>>1;i[u]=l}return i}();s.exports=function(l,i,u,p){var x=o,y=p+u;l^=-1;for(var _=p;_>>8^x[255&(l^i[_])];return-1^l}},{}],46:[function(n,s,a){var o,l=n("../utils/common"),i=n("./trees"),u=n("./adler32"),p=n("./crc32"),x=n("./messages"),y=0,_=4,b=0,S=-2,k=-1,M=4,P=2,T=8,I=9,z=286,D=30,U=19,V=2*z+1,W=15,G=3,J=258,ne=J+G+1,oe=42,ge=113,ie=1,pe=2,se=3,fe=4;function he(le,Ve){return le.msg=x[Ve],Ve}function ye(le){return(le<<1)-(4le.avail_out&&(Qe=le.avail_out),Qe!==0&&(l.arraySet(le.output,Ve.pending_buf,Ve.pending_out,Qe,le.next_out),le.next_out+=Qe,Ve.pending_out+=Qe,le.total_out+=Qe,le.avail_out-=Qe,Ve.pending-=Qe,Ve.pending===0&&(Ve.pending_out=0))}function be(le,Ve){i._tr_flush_block(le,0<=le.block_start?le.block_start:-1,le.strstart-le.block_start,Ve),le.block_start=le.strstart,we(le.strm)}function _e(le,Ve){le.pending_buf[le.pending++]=Ve}function Je(le,Ve){le.pending_buf[le.pending++]=Ve>>>8&255,le.pending_buf[le.pending++]=255&Ve}function Te(le,Ve){var Qe,st,ke=le.max_chain_length,ct=le.strstart,Ce=le.prev_length,Me=le.nice_match,Ge=le.strstart>le.w_size-ne?le.strstart-(le.w_size-ne):0,Ee=le.window,He=le.w_mask,nt=le.prev,yt=le.strstart+J,it=Ee[ct+Ce-1],zt=Ee[ct+Ce];le.prev_length>=le.good_match&&(ke>>=2),Me>le.lookahead&&(Me=le.lookahead);do if(Ee[(Qe=Ve)+Ce]===zt&&Ee[Qe+Ce-1]===it&&Ee[Qe]===Ee[ct]&&Ee[++Qe]===Ee[ct+1]){ct+=2,Qe++;do;while(Ee[++ct]===Ee[++Qe]&&Ee[++ct]===Ee[++Qe]&&Ee[++ct]===Ee[++Qe]&&Ee[++ct]===Ee[++Qe]&&Ee[++ct]===Ee[++Qe]&&Ee[++ct]===Ee[++Qe]&&Ee[++ct]===Ee[++Qe]&&Ee[++ct]===Ee[++Qe]&&ctGe&&--ke!=0);return Ce<=le.lookahead?Ce:le.lookahead}function De(le){var Ve,Qe,st,ke,ct,Ce,Me,Ge,Ee,He,nt=le.w_size;do{if(ke=le.window_size-le.lookahead-le.strstart,le.strstart>=nt+(nt-ne)){for(l.arraySet(le.window,le.window,nt,nt,0),le.match_start-=nt,le.strstart-=nt,le.block_start-=nt,Ve=Qe=le.hash_size;st=le.head[--Ve],le.head[Ve]=nt<=st?st-nt:0,--Qe;);for(Ve=Qe=nt;st=le.prev[--Ve],le.prev[Ve]=nt<=st?st-nt:0,--Qe;);ke+=nt}if(le.strm.avail_in===0)break;if(Ce=le.strm,Me=le.window,Ge=le.strstart+le.lookahead,Ee=ke,He=void 0,He=Ce.avail_in,Ee=G)for(ct=le.strstart-le.insert,le.ins_h=le.window[ct],le.ins_h=(le.ins_h<=G&&(le.ins_h=(le.ins_h<=G)if(st=i._tr_tally(le,le.strstart-le.match_start,le.match_length-G),le.lookahead-=le.match_length,le.match_length<=le.max_lazy_match&&le.lookahead>=G){for(le.match_length--;le.strstart++,le.ins_h=(le.ins_h<=G&&(le.ins_h=(le.ins_h<=G&&le.match_length<=le.prev_length){for(ke=le.strstart+le.lookahead-G,st=i._tr_tally(le,le.strstart-1-le.prev_match,le.prev_length-G),le.lookahead-=le.prev_length-1,le.prev_length-=2;++le.strstart<=ke&&(le.ins_h=(le.ins_h<le.pending_buf_size-5&&(Qe=le.pending_buf_size-5);;){if(le.lookahead<=1){if(De(le),le.lookahead===0&&Ve===y)return ie;if(le.lookahead===0)break}le.strstart+=le.lookahead,le.lookahead=0;var st=le.block_start+Qe;if((le.strstart===0||le.strstart>=st)&&(le.lookahead=le.strstart-st,le.strstart=st,be(le,!1),le.strm.avail_out===0)||le.strstart-le.block_start>=le.w_size-ne&&(be(le,!1),le.strm.avail_out===0))return ie}return le.insert=0,Ve===_?(be(le,!0),le.strm.avail_out===0?se:fe):(le.strstart>le.block_start&&(be(le,!1),le.strm.avail_out),ie)}),new qe(4,4,8,4,Ue),new qe(4,5,16,8,Ue),new qe(4,6,32,32,Ue),new qe(4,4,16,16,Be),new qe(8,16,32,32,Be),new qe(8,16,128,128,Be),new qe(8,32,128,256,Be),new qe(32,128,258,1024,Be),new qe(32,258,258,4096,Be)],a.deflateInit=function(le,Ve){return at(le,Ve,T,15,8,0)},a.deflateInit2=at,a.deflateReset=Oe,a.deflateResetKeep=Mt,a.deflateSetHeader=function(le,Ve){return le&&le.state?le.state.wrap!==2?S:(le.state.gzhead=Ve,b):S},a.deflate=function(le,Ve){var Qe,st,ke,ct;if(!le||!le.state||5>8&255),_e(st,st.gzhead.time>>16&255),_e(st,st.gzhead.time>>24&255),_e(st,st.level===9?2:2<=st.strategy||st.level<2?4:0),_e(st,255&st.gzhead.os),st.gzhead.extra&&st.gzhead.extra.length&&(_e(st,255&st.gzhead.extra.length),_e(st,st.gzhead.extra.length>>8&255)),st.gzhead.hcrc&&(le.adler=p(le.adler,st.pending_buf,st.pending,0)),st.gzindex=0,st.status=69):(_e(st,0),_e(st,0),_e(st,0),_e(st,0),_e(st,0),_e(st,st.level===9?2:2<=st.strategy||st.level<2?4:0),_e(st,3),st.status=ge);else{var Ce=T+(st.w_bits-8<<4)<<8;Ce|=(2<=st.strategy||st.level<2?0:st.level<6?1:st.level===6?2:3)<<6,st.strstart!==0&&(Ce|=32),Ce+=31-Ce%31,st.status=ge,Je(st,Ce),st.strstart!==0&&(Je(st,le.adler>>>16),Je(st,65535&le.adler)),le.adler=1}if(st.status===69)if(st.gzhead.extra){for(ke=st.pending;st.gzindex<(65535&st.gzhead.extra.length)&&(st.pending!==st.pending_buf_size||(st.gzhead.hcrc&&st.pending>ke&&(le.adler=p(le.adler,st.pending_buf,st.pending-ke,ke)),we(le),ke=st.pending,st.pending!==st.pending_buf_size));)_e(st,255&st.gzhead.extra[st.gzindex]),st.gzindex++;st.gzhead.hcrc&&st.pending>ke&&(le.adler=p(le.adler,st.pending_buf,st.pending-ke,ke)),st.gzindex===st.gzhead.extra.length&&(st.gzindex=0,st.status=73)}else st.status=73;if(st.status===73)if(st.gzhead.name){ke=st.pending;do{if(st.pending===st.pending_buf_size&&(st.gzhead.hcrc&&st.pending>ke&&(le.adler=p(le.adler,st.pending_buf,st.pending-ke,ke)),we(le),ke=st.pending,st.pending===st.pending_buf_size)){ct=1;break}ct=st.gzindexke&&(le.adler=p(le.adler,st.pending_buf,st.pending-ke,ke)),ct===0&&(st.gzindex=0,st.status=91)}else st.status=91;if(st.status===91)if(st.gzhead.comment){ke=st.pending;do{if(st.pending===st.pending_buf_size&&(st.gzhead.hcrc&&st.pending>ke&&(le.adler=p(le.adler,st.pending_buf,st.pending-ke,ke)),we(le),ke=st.pending,st.pending===st.pending_buf_size)){ct=1;break}ct=st.gzindexke&&(le.adler=p(le.adler,st.pending_buf,st.pending-ke,ke)),ct===0&&(st.status=103)}else st.status=103;if(st.status===103&&(st.gzhead.hcrc?(st.pending+2>st.pending_buf_size&&we(le),st.pending+2<=st.pending_buf_size&&(_e(st,255&le.adler),_e(st,le.adler>>8&255),le.adler=0,st.status=ge)):st.status=ge),st.pending!==0){if(we(le),le.avail_out===0)return st.last_flush=-1,b}else if(le.avail_in===0&&ye(Ve)<=ye(Qe)&&Ve!==_)return he(le,-5);if(st.status===666&&le.avail_in!==0)return he(le,-5);if(le.avail_in!==0||st.lookahead!==0||Ve!==y&&st.status!==666){var Me=st.strategy===2?function(Ge,Ee){for(var He;;){if(Ge.lookahead===0&&(De(Ge),Ge.lookahead===0)){if(Ee===y)return ie;break}if(Ge.match_length=0,He=i._tr_tally(Ge,0,Ge.window[Ge.strstart]),Ge.lookahead--,Ge.strstart++,He&&(be(Ge,!1),Ge.strm.avail_out===0))return ie}return Ge.insert=0,Ee===_?(be(Ge,!0),Ge.strm.avail_out===0?se:fe):Ge.last_lit&&(be(Ge,!1),Ge.strm.avail_out===0)?ie:pe}(st,Ve):st.strategy===3?function(Ge,Ee){for(var He,nt,yt,it,zt=Ge.window;;){if(Ge.lookahead<=J){if(De(Ge),Ge.lookahead<=J&&Ee===y)return ie;if(Ge.lookahead===0)break}if(Ge.match_length=0,Ge.lookahead>=G&&0Ge.lookahead&&(Ge.match_length=Ge.lookahead)}if(Ge.match_length>=G?(He=i._tr_tally(Ge,1,Ge.match_length-G),Ge.lookahead-=Ge.match_length,Ge.strstart+=Ge.match_length,Ge.match_length=0):(He=i._tr_tally(Ge,0,Ge.window[Ge.strstart]),Ge.lookahead--,Ge.strstart++),He&&(be(Ge,!1),Ge.strm.avail_out===0))return ie}return Ge.insert=0,Ee===_?(be(Ge,!0),Ge.strm.avail_out===0?se:fe):Ge.last_lit&&(be(Ge,!1),Ge.strm.avail_out===0)?ie:pe}(st,Ve):o[st.level].func(st,Ve);if(Me!==se&&Me!==fe||(st.status=666),Me===ie||Me===se)return le.avail_out===0&&(st.last_flush=-1),b;if(Me===pe&&(Ve===1?i._tr_align(st):Ve!==5&&(i._tr_stored_block(st,0,0,!1),Ve===3&&(Ae(st.head),st.lookahead===0&&(st.strstart=0,st.block_start=0,st.insert=0))),we(le),le.avail_out===0))return st.last_flush=-1,b}return Ve!==_?b:st.wrap<=0?1:(st.wrap===2?(_e(st,255&le.adler),_e(st,le.adler>>8&255),_e(st,le.adler>>16&255),_e(st,le.adler>>24&255),_e(st,255&le.total_in),_e(st,le.total_in>>8&255),_e(st,le.total_in>>16&255),_e(st,le.total_in>>24&255)):(Je(st,le.adler>>>16),Je(st,65535&le.adler)),we(le),0=Qe.w_size&&(ct===0&&(Ae(Qe.head),Qe.strstart=0,Qe.block_start=0,Qe.insert=0),Ee=new l.Buf8(Qe.w_size),l.arraySet(Ee,Ve,He-Qe.w_size,Qe.w_size,0),Ve=Ee,He=Qe.w_size),Ce=le.avail_in,Me=le.next_in,Ge=le.input,le.avail_in=He,le.next_in=0,le.input=Ve,De(Qe);Qe.lookahead>=G;){for(st=Qe.strstart,ke=Qe.lookahead-(G-1);Qe.ins_h=(Qe.ins_h<>>=G=W>>>24,I-=G,(G=W>>>16&255)===0)pe[x++]=65535&W;else{if(!(16&G)){if(!(64&G)){W=z[(65535&W)+(T&(1<>>=G,I-=G),I<15&&(T+=ie[u++]<>>=G=W>>>24,I-=G,!(16&(G=W>>>16&255))){if(!(64&G)){W=D[(65535&W)+(T&(1<>>=G,I-=G,(G=x-y)>3,T&=(1<<(I-=J<<3))-1,o.next_in=u,o.next_out=x,o.avail_in=u>>24&255)+(oe>>>8&65280)+((65280&oe)<<8)+((255&oe)<<24)}function 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 I(oe){var ge;return oe&&oe.state?(ge=oe.state,oe.total_in=oe.total_out=ge.total=0,oe.msg="",ge.wrap&&(oe.adler=1&ge.wrap),ge.mode=S,ge.last=0,ge.havedict=0,ge.dmax=32768,ge.head=null,ge.hold=0,ge.bits=0,ge.lencode=ge.lendyn=new o.Buf32(k),ge.distcode=ge.distdyn=new o.Buf32(M),ge.sane=1,ge.back=-1,_):b}function z(oe){var ge;return oe&&oe.state?((ge=oe.state).wsize=0,ge.whave=0,ge.wnext=0,I(oe)):b}function D(oe,ge){var ie,pe;return oe&&oe.state?(pe=oe.state,ge<0?(ie=0,ge=-ge):(ie=1+(ge>>4),ge<48&&(ge&=15)),ge&&(ge<8||15=fe.wsize?(o.arraySet(fe.window,ge,ie-fe.wsize,fe.wsize,0),fe.wnext=0,fe.whave=fe.wsize):(pe<(se=fe.wsize-fe.wnext)&&(se=pe),o.arraySet(fe.window,ge,ie-pe,se,fe.wnext),(pe-=se)?(o.arraySet(fe.window,ge,ie-pe,pe,0),fe.wnext=pe,fe.whave=fe.wsize):(fe.wnext+=se,fe.wnext===fe.wsize&&(fe.wnext=0),fe.whave>>8&255,ie.check=i(ie.check,ct,2,0),be=we=0,ie.mode=2;break}if(ie.flags=0,ie.head&&(ie.head.done=!1),!(1&ie.wrap)||(((255&we)<<8)+(we>>8))%31){oe.msg="incorrect header check",ie.mode=30;break}if((15&we)!=8){oe.msg="unknown compression method",ie.mode=30;break}if(be-=4,le=8+(15&(we>>>=4)),ie.wbits===0)ie.wbits=le;else if(le>ie.wbits){oe.msg="invalid window size",ie.mode=30;break}ie.dmax=1<>8&1),512&ie.flags&&(ct[0]=255&we,ct[1]=we>>>8&255,ie.check=i(ie.check,ct,2,0)),be=we=0,ie.mode=3;case 3:for(;be<32;){if(ye===0)break e;ye--,we+=pe[fe++]<>>8&255,ct[2]=we>>>16&255,ct[3]=we>>>24&255,ie.check=i(ie.check,ct,4,0)),be=we=0,ie.mode=4;case 4:for(;be<16;){if(ye===0)break e;ye--,we+=pe[fe++]<>8),512&ie.flags&&(ct[0]=255&we,ct[1]=we>>>8&255,ie.check=i(ie.check,ct,2,0)),be=we=0,ie.mode=5;case 5:if(1024&ie.flags){for(;be<16;){if(ye===0)break e;ye--,we+=pe[fe++]<>>8&255,ie.check=i(ie.check,ct,2,0)),be=we=0}else ie.head&&(ie.head.extra=null);ie.mode=6;case 6:if(1024&ie.flags&&(ye<(Te=ie.length)&&(Te=ye),Te&&(ie.head&&(le=ie.head.extra_len-ie.length,ie.head.extra||(ie.head.extra=new Array(ie.head.extra_len)),o.arraySet(ie.head.extra,pe,fe,Te,le)),512&ie.flags&&(ie.check=i(ie.check,pe,Te,fe)),ye-=Te,fe+=Te,ie.length-=Te),ie.length))break e;ie.length=0,ie.mode=7;case 7:if(2048&ie.flags){if(ye===0)break e;for(Te=0;le=pe[fe+Te++],ie.head&&le&&ie.length<65536&&(ie.head.name+=String.fromCharCode(le)),le&&Te>9&1,ie.head.done=!0),oe.adler=ie.check=0,ie.mode=12;break;case 10:for(;be<32;){if(ye===0)break e;ye--,we+=pe[fe++]<>>=7&be,be-=7&be,ie.mode=27;break}for(;be<3;){if(ye===0)break e;ye--,we+=pe[fe++]<>>=1)){case 0:ie.mode=14;break;case 1:if(J(ie),ie.mode=20,ge!==6)break;we>>>=2,be-=2;break e;case 2:ie.mode=17;break;case 3:oe.msg="invalid block type",ie.mode=30}we>>>=2,be-=2;break;case 14:for(we>>>=7&be,be-=7&be;be<32;){if(ye===0)break e;ye--,we+=pe[fe++]<>>16^65535)){oe.msg="invalid stored block lengths",ie.mode=30;break}if(ie.length=65535&we,be=we=0,ie.mode=15,ge===6)break e;case 15:ie.mode=16;case 16:if(Te=ie.length){if(ye>>=5,be-=5,ie.ndist=1+(31&we),we>>>=5,be-=5,ie.ncode=4+(15&we),we>>>=4,be-=4,286>>=3,be-=3}for(;ie.have<19;)ie.lens[Ce[ie.have++]]=0;if(ie.lencode=ie.lendyn,ie.lenbits=7,Qe={bits:ie.lenbits},Ve=p(0,ie.lens,0,19,ie.lencode,0,ie.work,Qe),ie.lenbits=Qe.bits,Ve){oe.msg="invalid code lengths set",ie.mode=30;break}ie.have=0,ie.mode=19;case 19:for(;ie.have>>16&255,ot=65535&ke,!((Be=ke>>>24)<=be);){if(ye===0)break e;ye--,we+=pe[fe++]<>>=Be,be-=Be,ie.lens[ie.have++]=ot;else{if(ot===16){for(st=Be+2;be>>=Be,be-=Be,ie.have===0){oe.msg="invalid bit length repeat",ie.mode=30;break}le=ie.lens[ie.have-1],Te=3+(3&we),we>>>=2,be-=2}else if(ot===17){for(st=Be+3;be>>=Be)),we>>>=3,be-=3}else{for(st=Be+7;be>>=Be)),we>>>=7,be-=7}if(ie.have+Te>ie.nlen+ie.ndist){oe.msg="invalid bit length repeat",ie.mode=30;break}for(;Te--;)ie.lens[ie.have++]=le}}if(ie.mode===30)break;if(ie.lens[256]===0){oe.msg="invalid code -- missing end-of-block",ie.mode=30;break}if(ie.lenbits=9,Qe={bits:ie.lenbits},Ve=p(x,ie.lens,0,ie.nlen,ie.lencode,0,ie.work,Qe),ie.lenbits=Qe.bits,Ve){oe.msg="invalid literal/lengths set",ie.mode=30;break}if(ie.distbits=6,ie.distcode=ie.distdyn,Qe={bits:ie.distbits},Ve=p(y,ie.lens,ie.nlen,ie.ndist,ie.distcode,0,ie.work,Qe),ie.distbits=Qe.bits,Ve){oe.msg="invalid distances set",ie.mode=30;break}if(ie.mode=20,ge===6)break e;case 20:ie.mode=21;case 21:if(6<=ye&&258<=Ae){oe.next_out=he,oe.avail_out=Ae,oe.next_in=fe,oe.avail_in=ye,ie.hold=we,ie.bits=be,u(oe,Je),he=oe.next_out,se=oe.output,Ae=oe.avail_out,fe=oe.next_in,pe=oe.input,ye=oe.avail_in,we=ie.hold,be=ie.bits,ie.mode===12&&(ie.back=-1);break}for(ie.back=0;qe=(ke=ie.lencode[we&(1<>>16&255,ot=65535&ke,!((Be=ke>>>24)<=be);){if(ye===0)break e;ye--,we+=pe[fe++]<>Mt)])>>>16&255,ot=65535&ke,!(Mt+(Be=ke>>>24)<=be);){if(ye===0)break e;ye--,we+=pe[fe++]<>>=Mt,be-=Mt,ie.back+=Mt}if(we>>>=Be,be-=Be,ie.back+=Be,ie.length=ot,qe===0){ie.mode=26;break}if(32&qe){ie.back=-1,ie.mode=12;break}if(64&qe){oe.msg="invalid literal/length code",ie.mode=30;break}ie.extra=15&qe,ie.mode=22;case 22:if(ie.extra){for(st=ie.extra;be>>=ie.extra,be-=ie.extra,ie.back+=ie.extra}ie.was=ie.length,ie.mode=23;case 23:for(;qe=(ke=ie.distcode[we&(1<>>16&255,ot=65535&ke,!((Be=ke>>>24)<=be);){if(ye===0)break e;ye--,we+=pe[fe++]<>Mt)])>>>16&255,ot=65535&ke,!(Mt+(Be=ke>>>24)<=be);){if(ye===0)break e;ye--,we+=pe[fe++]<>>=Mt,be-=Mt,ie.back+=Mt}if(we>>>=Be,be-=Be,ie.back+=Be,64&qe){oe.msg="invalid distance code",ie.mode=30;break}ie.offset=ot,ie.extra=15&qe,ie.mode=24;case 24:if(ie.extra){for(st=ie.extra;be>>=ie.extra,be-=ie.extra,ie.back+=ie.extra}if(ie.offset>ie.dmax){oe.msg="invalid distance too far back",ie.mode=30;break}ie.mode=25;case 25:if(Ae===0)break e;if(Te=Je-Ae,ie.offset>Te){if((Te=ie.offset-Te)>ie.whave&&ie.sane){oe.msg="invalid distance too far back",ie.mode=30;break}De=Te>ie.wnext?(Te-=ie.wnext,ie.wsize-Te):ie.wnext-Te,Te>ie.length&&(Te=ie.length),Ue=ie.window}else Ue=se,De=he-ie.offset,Te=ie.length;for(AeV?(G=De[Ue+M[ge]],be[_e+M[ge]]):(G=96,0),T=1<>he)+(I-=T)]=W<<24|G<<16|J|0,I!==0;);for(T=1<>=1;if(T!==0?(we&=T-1,we+=T):we=0,ge++,--Je[oe]==0){if(oe===pe)break;oe=y[_+M[ge]]}if(se>>7)]}function _e(ke,ct){ke.pending_buf[ke.pending++]=255&ct,ke.pending_buf[ke.pending++]=ct>>>8&255}function Je(ke,ct,Ce){ke.bi_valid>P-Ce?(ke.bi_buf|=ct<>P-ke.bi_valid,ke.bi_valid+=Ce-P):(ke.bi_buf|=ct<>>=1,Ce<<=1,0<--ct;);return Ce>>>1}function Ue(ke,ct,Ce){var Me,Ge,Ee=new Array(M+1),He=0;for(Me=1;Me<=M;Me++)Ee[Me]=He=He+Ce[Me-1]<<1;for(Ge=0;Ge<=ct;Ge++){var nt=ke[2*Ge+1];nt!==0&&(ke[2*Ge]=De(Ee[nt]++,nt))}}function Be(ke){var ct;for(ct=0;ct<_;ct++)ke.dyn_ltree[2*ct]=0;for(ct=0;ct>1;1<=Ce;Ce--)Mt(ke,Ee,Ce);for(Ge=yt;Ce=ke.heap[1],ke.heap[1]=ke.heap[ke.heap_len--],Mt(ke,Ee,1),Me=ke.heap[1],ke.heap[--ke.heap_max]=Ce,ke.heap[--ke.heap_max]=Me,Ee[2*Ge]=Ee[2*Ce]+Ee[2*Me],ke.depth[Ge]=(ke.depth[Ce]>=ke.depth[Me]?ke.depth[Ce]:ke.depth[Me])+1,Ee[2*Ce+1]=Ee[2*Me+1]=Ge,ke.heap[1]=Ge++,Mt(ke,Ee,1),2<=ke.heap_len;);ke.heap[--ke.heap_max]=ke.heap[1],function(zt,dr){var Rr,Gr,Ur,kn,_s,ur,Rn=dr.dyn_tree,ea=dr.max_code,ca=dr.stat_desc.static_tree,Ei=dr.stat_desc.has_stree,Ii=dr.stat_desc.extra_bits,$o=dr.stat_desc.extra_base,Va=dr.stat_desc.max_length,cs=0;for(kn=0;kn<=M;kn++)zt.bl_count[kn]=0;for(Rn[2*zt.heap[zt.heap_max]+1]=0,Rr=zt.heap_max+1;Rr>=7;Ge>>=1)if(1&it&&nt.dyn_ltree[2*yt]!==0)return l;if(nt.dyn_ltree[18]!==0||nt.dyn_ltree[20]!==0||nt.dyn_ltree[26]!==0)return i;for(yt=32;yt>>3,(Ee=ke.static_len+3+7>>>3)<=Ge&&(Ge=Ee)):Ge=Ee=Ce+5,Ce+4<=Ge&&ct!==-1?st(ke,ct,Ce,Me):ke.strategy===4||Ee===Ge?(Je(ke,2+(Me?1:0),3),Oe(ke,ne,oe)):(Je(ke,4+(Me?1:0),3),function(nt,yt,it,zt){var dr;for(Je(nt,yt-257,5),Je(nt,it-1,5),Je(nt,zt-4,4),dr=0;dr>>8&255,ke.pending_buf[ke.d_buf+2*ke.last_lit+1]=255&ct,ke.pending_buf[ke.l_buf+ke.last_lit]=255&Ce,ke.last_lit++,ct===0?ke.dyn_ltree[2*Ce]++:(ke.matches++,ct--,ke.dyn_ltree[2*(ie[Ce]+y+1)]++,ke.dyn_dtree[2*be(ct)]++),ke.last_lit===ke.lit_bufsize-1},a._tr_align=function(ke){Je(ke,2,3),Te(ke,I,ne),function(ct){ct.bi_valid===16?(_e(ct,ct.bi_buf),ct.bi_buf=0,ct.bi_valid=0):8<=ct.bi_valid&&(ct.pending_buf[ct.pending++]=255&ct.bi_buf,ct.bi_buf>>=8,ct.bi_valid-=8)}(ke)}},{"../utils/common":41}],53:[function(n,s,a){s.exports=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}},{}],54:[function(n,s,a){(function(o){(function(l,i){if(!l.setImmediate){var u,p,x,y,_=1,b={},S=!1,k=l.document,M=Object.getPrototypeOf&&Object.getPrototypeOf(l);M=M&&M.setTimeout?M:l,u={}.toString.call(l.process)==="[object process]"?function(z){process.nextTick(function(){T(z)})}:function(){if(l.postMessage&&!l.importScripts){var z=!0,D=l.onmessage;return l.onmessage=function(){z=!1},l.postMessage("","*"),l.onmessage=D,z}}()?(y="setImmediate$"+Math.random()+"$",l.addEventListener?l.addEventListener("message",I,!1):l.attachEvent("onmessage",I),function(z){l.postMessage(y+z,"*")}):l.MessageChannel?((x=new MessageChannel).port1.onmessage=function(z){T(z.data)},function(z){x.port2.postMessage(z)}):k&&"onreadystatechange"in k.createElement("script")?(p=k.documentElement,function(z){var D=k.createElement("script");D.onreadystatechange=function(){T(z),D.onreadystatechange=null,p.removeChild(D),D=null},p.appendChild(D)}):function(z){setTimeout(T,0,z)},M.setImmediate=function(z){typeof z!="function"&&(z=new Function(""+z));for(var D=new Array(arguments.length-1),U=0;U"u"?o===void 0?this:o:self)}).call(this,typeof Yx<"u"?Yx:typeof self<"u"?self:typeof window<"u"?window:{})},{}]},{},[10])(10)})})(C9e);var uNt=C9e.exports;const hNt=Qi(uNt);function Mde(e,t=400,n=75){return e&&`${e.replace("/storage/v1/object/public/","/storage/v1/render/image/public/")}?width=${t}&quality=${n}&resize=contain`}const fNt=()=>{const{isAdmin:e}=tn(),[t,n]=E.useState(null),[s,a]=E.useState(null),[o,l]=E.useState("all"),[i,u]=E.useState(new Set),[p,x]=E.useState(!1),[y,_]=E.useState(!1),[b,S]=E.useState("images"),[k,M]=E.useState(null),{data:P=[],isLoading:T}=Kt({queryKey:["social-swag-2"],queryFn:async()=>{const{data:ye,error:Ae}=await Q.from("social_swag_2").select("*").order("month",{ascending:!1}).order("sort_order");if(Ae)throw Ae;return ye}}),{data:I=[]}=Kt({queryKey:["social-swag-2-months"],queryFn:async()=>{const{data:ye,error:Ae}=await Q.from("social_swag_2_months").select("*").order("month",{ascending:!1});if(Ae)throw Ae;return ye}}),{data:z=[]}=Kt({queryKey:["social-swag-2-reels"],queryFn:async()=>{const{data:ye,error:Ae}=await Q.from("social_swag_2_reels").select("*").order("month",{ascending:!1});if(Ae)throw Ae;return ye}}),{data:D=[]}=Kt({queryKey:["my-social-accounts-count"],queryFn:async()=>{const{data:ye,error:Ae}=await Q.from("social_accounts").select("id, platform").eq("is_active",!0);if(Ae)throw Ae;return ye||[]}}),U=D.length>0,V=E.useMemo(()=>o==="all"?null:z.find(ye=>ye.month===o)||null,[o,z]),W=E.useMemo(()=>[...new Set(P.map(Ae=>Ae.month))].sort((Ae,we)=>we.localeCompare(Ae)),[P]);E.useEffect(()=>{W.length>0&&o==="all"&&l(W[0])},[W,o]);const G=ye=>{try{const Ae=kye(ye,"yyyy-MM",new Date);return on(Ae,"MMMM yyyy")}catch{return ye}},J=E.useMemo(()=>o==="all"?P:P.filter(ye=>ye.month===o),[o,P]),ne=E.useMemo(()=>{var ye;return o==="all"?null:((ye=I.find(Ae=>Ae.month===o))==null?void 0:ye.canva_link)||null},[o,I]),oe=async ye=>{try{await navigator.clipboard.writeText(ye),Ie.success("Caption copied to clipboard!")}catch{Ie.error("Failed to copy caption")}},ge=async(ye,Ae)=>{try{const be=await(await fetch(ye)).blob(),_e=/iPhone|iPad|iPod|Android/i.test(navigator.userAgent),Je=navigator.canShare&&navigator.canShare({files:[new File([be],"test.jpg",{type:"image/jpeg"})]});if(_e&&Je){const Te=new File([be],`social-swag-${Ae}.jpg`,{type:"image/jpeg"});await navigator.share({files:[Te],title:"Social Swag Image"}),Ie.success("Image ready to save!")}else{const Te=window.URL.createObjectURL(be),De=document.createElement("a");De.href=Te,De.download=`social-swag-${Ae}.jpg`,document.body.appendChild(De),De.click(),document.body.removeChild(De),window.URL.revokeObjectURL(Te),Ie.success("Image downloaded!")}}catch(we){we.name!=="AbortError"&&Ie.error("Failed to download image")}},ie=ye=>{u(Ae=>{const we=new Set(Ae);return we.has(ye)?we.delete(ye):we.add(ye),we})},pe=()=>{u(new Set(J.map(ye=>ye.id)))},se=()=>{u(new Set),x(!1)},fe=async()=>{const ye=J.filter(Ae=>i.has(Ae.id));if(ye.length===0){Ie.error("No images selected");return}_(!0),Ie.info(`Preparing ${ye.length} images for download...`);try{const Ae=new hNt,we=[...ye].sort((De,Ue)=>De.sort_order-Ue.sort_order);for(let De=0;De{p?ie(ye.id):n(ye)};return r.jsx(Dr,{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(Pt,{variant:"secondary",className:"bg-white/20 text-white border-0 backdrop-blur-sm",children:[r.jsx(Ls,{className:"h-3 w-3 mr-1"}),"New content monthly"]}),r.jsxs(Pt,{variant:"secondary",className:"bg-white/20 text-white border-0 backdrop-blur-sm",children:[r.jsx(Rl,{className:"h-3 w-3 mr-1"}),P.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!"})]})]}),e?r.jsxs(Ai,{defaultValue:"gallery",className:"space-y-6",children:[r.jsxs(vi,{className:"grid w-full max-w-md grid-cols-2",children:[r.jsxs(sn,{value:"gallery",className:"gap-2",children:[r.jsx(Rl,{className:"h-4 w-4"}),"Gallery"]}),r.jsxs(sn,{value:"scheduled",className:"gap-2",children:[r.jsx(Cm,{className:"h-4 w-4"}),"Scheduled"]})]}),r.jsxs(Mn,{value:"gallery",className:"space-y-6",children:[e?U?r.jsx(Ze,{className:"border rounded-xl",children:r.jsx(et,{className:"p-6",children:r.jsxs("div",{className:"flex items-start gap-4",children:[r.jsx("div",{className:"p-3 rounded-full bg-muted text-2xl",children:"📸"}),r.jsxs("div",{className:"flex-1",children:[r.jsx("h3",{className:"font-semibold text-foreground mb-1",children:"Ready to post!"}),r.jsx("p",{className:"text-muted-foreground",children:'Click any image and use "Create Post" to share directly to your connected accounts.'})]}),r.jsx(ee,{variant:"outline",size:"sm",asChild:!0,className:"gap-2",children:r.jsx(oo,{to:"/social-connections",children:"Manage Accounts"})})]})})}):r.jsx(Ze,{className:"border-2 border-dashed border-primary/30 bg-gradient-to-r from-pink-500/5 via-purple-500/5 to-blue-500/5 rounded-xl",children:r.jsx(et,{className:"p-6",children:r.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:"p-2 rounded-full bg-blue-500/10",children:r.jsx(au,{className:"h-5 w-5 text-blue-600"})}),r.jsx("div",{className:"p-2 rounded-full bg-pink-500/10",children:r.jsx(_u,{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(oo,{to:"/social-connections",children:[r.jsx(mf,{className:"h-4 w-4"}),"Connect Accounts"]})})]})})}):r.jsx(Ze,{className:"border-2 border-dashed border-muted-foreground/20 bg-muted/30 rounded-xl",children:r.jsx(et,{className:"p-6",children:r.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:"p-2 rounded-full bg-muted",children:r.jsx(Ya,{className:"h-5 w-5 text-muted-foreground"})}),r.jsx("div",{className:"p-2 rounded-full bg-blue-500/10",children:r.jsx(au,{className:"h-5 w-5 text-blue-400"})}),r.jsx("div",{className:"p-2 rounded-full bg-pink-500/10",children:r.jsx(_u,{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(Pt,{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:W.map(ye=>r.jsx("button",{onClick:()=>l(ye),className:Bt("px-4 py-2 rounded-full text-sm font-medium transition-all",o===ye?"bg-primary text-primary-foreground shadow-sm":"bg-muted text-muted-foreground hover:text-foreground"),children:G(ye)},ye))}),o!=="all"&&(ne?r.jsxs("a",{href:ne,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:()=>{S("images"),se()},className:Bt("flex items-center gap-2 px-4 py-2 rounded-full text-sm font-medium transition-all",b==="images"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:[r.jsx(Rl,{className:"h-4 w-4"}),"Images"]}),r.jsxs("button",{onClick:()=>{S("reels"),se()},className:Bt("flex items-center gap-2 px-4 py-2 rounded-full text-sm font-medium transition-all",b==="reels"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:[r.jsx(eu,{className:"h-4 w-4"}),"Reels"]})]}),b==="images"&&r.jsx("div",{className:"flex flex-wrap items-center gap-3",children:p?r.jsxs(r.Fragment,{children:[r.jsxs(ee,{variant:"outline",size:"sm",onClick:pe,className:"gap-2",children:["Select All (",J.length,")"]}),r.jsxs(ee,{variant:"outline",size:"sm",onClick:se,className:"gap-2",children:[r.jsx(hs,{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:fe,disabled:y,className:"gap-2",children:[r.jsx(io,{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(Ni,{className:"h-4 w-4"}),"Select Images"]})})]}),T&&r.jsx("div",{className:"text-center py-12 text-muted-foreground",children:"Loading..."}),!T&&b==="images"&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4",children:J.map(ye=>{const Ae=i.has(ye.id);return r.jsx(Ze,{className:Bt("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:()=>he(ye),children:r.jsxs("div",{className:"relative aspect-[4/5] overflow-hidden",children:[r.jsx("img",{src:Mde(ye.image_url,400,75),alt:"Social swag",className:"w-full h-full object-cover transition-transform duration-300 group-hover:scale-110",loading:"lazy",decoding:"async"}),ye.post_date&&!p&&r.jsx("div",{className:"absolute top-0 left-0 w-24 h-24 overflow-hidden pointer-events-none",children:r.jsx("div",{className:"absolute flex items-center justify-center text-white font-bold text-[10px] tracking-wider uppercase",style:{top:"20px",left:"-34px",width:"136px",transform:"rotate(-45deg)",backgroundColor:"#2d5052",padding:"5px 0",boxShadow:"0 2px 4px rgba(0,0,0,0.25)"},children:on(new Date(ye.post_date+"T00:00:00"),"MMM d")})}),p&&r.jsx("div",{className:Bt("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(Ni,{className:"h-4 w-4"})}),!p&&r.jsx("div",{className:"absolute inset-0 bg-black/0 group-hover:bg-black/40 transition-colors duration-300 flex items-center justify-center",children:r.jsx("span",{className:"text-white font-medium opacity-0 group-hover:opacity-100 transition-opacity duration-300 bg-primary px-4 py-2 rounded-full text-sm",children:"View Details"})})]})},ye.id)})}),J.length===0&&r.jsxs("div",{className:"text-center py-12",children:[r.jsx(Rl,{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&&b==="reels"&&r.jsx(r.Fragment,{children:V?r.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 xl:grid-cols-6 gap-4",children:r.jsx(Ze,{className:"group overflow-hidden rounded-2xl cursor-pointer transition-all duration-300 hover:shadow-xl hover:scale-[1.02]",onClick:()=>a(V),children:r.jsxs("div",{className:"relative aspect-[9/16] overflow-hidden",children:[r.jsx("img",{src:Mde(V.image_url,400,75),alt:"Reel preview",className:"w-full h-full object-cover transition-transform duration-300 group-hover:scale-105",loading:"lazy",decoding:"async"}),r.jsx("div",{className:"absolute top-2 left-2",children:r.jsxs(Pt,{variant:"secondary",className:"bg-black/50 text-white border-0 backdrop-blur-sm text-xs",children:[r.jsx(eu,{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(eu,{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(Or,{open:!!t,onOpenChange:()=>n(null),children:r.jsx(Ir,{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:t&&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:Mde(t.image_url,900,85),alt:"Social swag",className:"w-full h-full object-cover",decoding:"async"})})}),r.jsxs("div",{className:"md:w-1/2 p-6 flex flex-col",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-3 text-sm text-muted-foreground mb-4",children:[r.jsxs("span",{className:"flex items-center gap-1.5",children:[r.jsx(Ss,{className:"h-4 w-4"}),on(new Date(t.created_at),"MMMM d, yyyy")]}),t.post_date&&r.jsxs("span",{className:"inline-flex items-center gap-1.5 font-medium rounded-full px-3 py-1 text-xs text-white",style:{background:"#406E71"},children:[r.jsx(Ss,{className:"h-3.5 w-3.5"}),"Post on ",on(new Date(t.post_date+"T00:00:00"),"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:t.caption})})]}),r.jsxs("div",{className:"flex flex-col gap-3 mt-6",children:[e&&r.jsxs(ee,{onClick:()=>{M({imageUrl:t.image_url,imageId:t.id,caption:t.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(lo,{className:"h-4 w-4"}),"Create Post"]}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-3",children:[r.jsxs(ee,{variant:"outline",onClick:()=>oe(t.caption),className:"flex-1 gap-2",children:[r.jsx(Wo,{className:"h-4 w-4"}),"Copy Caption"]}),r.jsxs(ee,{variant:"outline",onClick:()=>ge(t.image_url,t.id),className:"flex-1 gap-2",children:[r.jsx(io,{className:"h-4 w-4"}),"Download"]})]})]})]})]})})})}),r.jsx(Or,{open:!!s,onOpenChange:()=>a(null),children:r.jsx(Ir,{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(eu,{className:"h-4 w-4"}),"Monthly Reel"]}),s.caption&&r.jsxs("div",{className:"flex-1 min-h-0",children:[r.jsx("h4",{className:"text-sm font-medium text-foreground mb-2",children:"Caption"}),r.jsx("div",{className:"bg-muted/50 rounded-lg p-4 max-h-64 overflow-y-auto",children:r.jsx("p",{className:"text-sm text-foreground whitespace-pre-wrap",children:s.caption})})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 mt-6",children:[s.caption&&r.jsxs(ee,{onClick:()=>oe(s.caption||""),className:"flex-1 gap-2",children:[r.jsx(Wo,{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(As,{className:"h-4 w-4"}),"Open in Canva"]})]})]})]})})})}),r.jsx(cNt,{open:!!k,onOpenChange:ye=>!ye&&M(null),imageUrl:(k==null?void 0:k.imageUrl)||"",imageId:(k==null?void 0:k.imageId)||"",defaultCaption:(k==null?void 0:k.caption)||"",swagItemId:k==null?void 0:k.imageId})]}),r.jsx(Mn,{value:"scheduled",children:r.jsx(dNt,{})})]}):r.jsxs("div",{className:"space-y-6",children:[r.jsx(Ze,{className:"border-2 border-dashed border-muted-foreground/20 bg-muted/30 rounded-xl",children:r.jsx(et,{className:"p-6",children:r.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:"p-2 rounded-full bg-muted",children:r.jsx(Ya,{className:"h-5 w-5 text-muted-foreground"})}),r.jsx("div",{className:"p-2 rounded-full bg-blue-500/10",children:r.jsx(au,{className:"h-5 w-5 text-blue-400"})}),r.jsx("div",{className:"p-2 rounded-full bg-pink-500/10",children:r.jsx(_u,{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(Pt,{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:W.map(ye=>r.jsx("button",{onClick:()=>l(ye),className:Bt("px-4 py-2 rounded-full text-sm font-medium transition-all",o===ye?"bg-primary text-primary-foreground shadow-sm":"bg-muted text-muted-foreground hover:text-foreground"),children:G(ye)},ye))}),o!=="all"&&(ne?r.jsxs("a",{href:ne,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:()=>{S("images"),se()},className:Bt("flex items-center gap-2 px-4 py-2 rounded-full text-sm font-medium transition-all",b==="images"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:[r.jsx(Rl,{className:"h-4 w-4"}),"Images"]}),r.jsxs("button",{onClick:()=>{S("reels"),se()},className:Bt("flex items-center gap-2 px-4 py-2 rounded-full text-sm font-medium transition-all",b==="reels"?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:[r.jsx(eu,{className:"h-4 w-4"}),"Reels"]})]}),b==="images"&&r.jsx("div",{className:"flex flex-wrap items-center gap-3",children:p?r.jsxs(r.Fragment,{children:[r.jsxs(ee,{variant:"outline",size:"sm",onClick:pe,className:"gap-2",children:["Select All (",J.length,")"]}),r.jsxs(ee,{variant:"outline",size:"sm",onClick:se,className:"gap-2",children:[r.jsx(hs,{className:"h-4 w-4"}),"Cancel"]}),i.size>0&&r.jsxs(ee,{size:"sm",onClick:fe,disabled:y,className:"gap-2",children:[r.jsx(io,{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(Ni,{className:"h-4 w-4"}),"Select Images"]})})]}),T&&r.jsx("div",{className:"text-center py-12 text-muted-foreground",children:"Loading..."}),!T&&b==="images"&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4",children:J.map(ye=>{const Ae=i.has(ye.id);return r.jsx(Ze,{className:Bt("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:()=>he(ye),children:r.jsxs("div",{className:"relative aspect-[4/5] overflow-hidden",children:[r.jsx("img",{src:ye.image_url,alt:"Social swag",className:"w-full h-full object-cover transition-transform duration-300 group-hover:scale-110"}),p&&r.jsx("div",{className:Bt("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(Ni,{className:"h-4 w-4"})}),!p&&r.jsx("div",{className:"absolute inset-0 bg-black/0 group-hover:bg-black/40 transition-colors duration-300 flex items-center justify-center",children:r.jsx("span",{className:"text-white font-medium opacity-0 group-hover:opacity-100 transition-opacity duration-300 bg-primary px-4 py-2 rounded-full text-sm",children:"View Details"})})]})},ye.id)})}),J.length===0&&r.jsxs("div",{className:"text-center py-12",children:[r.jsx(Rl,{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&&b==="reels"&&r.jsx(r.Fragment,{children:V?r.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 lg:grid-cols-5 xl:grid-cols-6 gap-4",children:r.jsx(Ze,{className:"group overflow-hidden rounded-2xl cursor-pointer transition-all duration-300 hover:shadow-xl hover:scale-[1.02]",onClick:()=>a(V),children:r.jsxs("div",{className:"relative aspect-[9/16] overflow-hidden",children:[r.jsx("img",{src:V.image_url,alt:"Reel preview",className:"w-full h-full object-cover transition-transform duration-300 group-hover:scale-105"}),r.jsx("div",{className:"absolute top-2 left-2",children:r.jsxs(Pt,{variant:"secondary",className:"bg-black/50 text-white border-0 backdrop-blur-sm text-xs",children:[r.jsx(eu,{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(eu,{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(Or,{open:!!t,onOpenChange:()=>n(null),children:r.jsx(Ir,{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:t&&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:t.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(Ss,{className:"h-4 w-4"}),on(new Date(t.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:t.caption})})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 mt-6",children:[r.jsxs(ee,{variant:"outline",onClick:()=>oe(t.caption),className:"flex-1 gap-2",children:[r.jsx(Wo,{className:"h-4 w-4"}),"Copy Caption"]}),r.jsxs(ee,{variant:"outline",onClick:()=>ge(t.image_url,t.id),className:"flex-1 gap-2",children:[r.jsx(io,{className:"h-4 w-4"}),"Download"]})]})]})]})})})}),r.jsx(Or,{open:!!s,onOpenChange:()=>a(null),children:r.jsx(Ir,{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(eu,{className:"h-4 w-4"}),"Monthly Reel"]}),s.caption&&r.jsxs("div",{className:"flex-1 min-h-0",children:[r.jsx("h4",{className:"text-sm font-medium text-foreground mb-2",children:"Caption"}),r.jsx("div",{className:"bg-muted/50 rounded-lg p-4 max-h-64 overflow-y-auto",children:r.jsx("p",{className:"text-sm text-foreground whitespace-pre-wrap",children:s.caption})})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 mt-6",children:[s.caption&&r.jsxs(ee,{onClick:()=>oe(s.caption||""),className:"flex-1 gap-2",children:[r.jsx(Wo,{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(As,{className:"h-4 w-4"}),"Open in Canva"]})]})]})]})})})})]})]})})},pNt=()=>{const{swagId:e}=md(),{user:t}=tn(),{toast:n}=_i(),s=Hr(),{trackEngagement:a}=hP(),[o,l]=E.useState(""),{data:i,isLoading:u}=Kt({queryKey:["social-swag-detail",e],queryFn:async()=>{const{data:P,error:T}=await Q.from("social_swag").select("*").eq("id",e).single();if(T)throw T;const{data:I}=await Q.from("social_swag_links").select("*").eq("swag_id",e).order("sort_order");return{...P,links:I||[]}},enabled:!!e});E.useEffect(()=>{i&&a("social_swag",i.id,i.title,"view")},[i==null?void 0:i.id]);const{data:p=[]}=Kt({queryKey:["social-swag-likes",e],queryFn:async()=>{const{data:P,error:T}=await Q.from("social_swag_likes").select("*").eq("swag_id",e);if(T)throw T;return P},enabled:!!e}),{data:x=[]}=Kt({queryKey:["social-swag-comments",e],queryFn:async()=>{const{data:P,error:T}=await Q.from("social_swag_comments").select("*").eq("swag_id",e).order("created_at",{ascending:!1});if(T)throw T;const I=[...new Set(P.map(U=>U.user_id))],{data:z}=await Q.from("profiles").select("id, name").in("id",I),D=new Map((z==null?void 0:z.map(U=>[U.id,U.name]))||[]);return P.map(U=>({...U,user_name:D.get(U.user_id)||"Unknown User"}))},enabled:!!e}),y=ir({mutationFn:async P=>{const{error:T}=await Q.from("social_swag_comments").insert({swag_id:e,user_id:t.id,content:P});if(T)throw T},onSuccess:()=>{s.invalidateQueries({queryKey:["social-swag-comments",e]}),l(""),n({title:"Comment added!"})},onError:P=>{n({title:"Error adding comment",description:P.message,variant:"destructive"})}}),_=ir({mutationFn:async P=>{const{error:T}=await Q.from("social_swag_comments").delete().eq("id",P);if(T)throw T},onSuccess:()=>{s.invalidateQueries({queryKey:["social-swag-comments",e]}),n({title:"Comment deleted"})}}),b=ir({mutationFn:async()=>{const P=p.find(T=>T.user_id===(t==null?void 0:t.id));if(P){const{error:T}=await Q.from("social_swag_likes").delete().eq("id",P.id);if(T)throw T}else{const{error:T}=await Q.from("social_swag_likes").insert({swag_id:e,user_id:t.id});if(T)throw T}},onSuccess:()=>{s.invalidateQueries({queryKey:["social-swag-likes",e]})}}),S=p.some(P=>P.user_id===(t==null?void 0:t.id)),k=P=>P.split(" ").map(T=>T[0]).join("").toUpperCase().slice(0,2),M=P=>{P.preventDefault(),!(!o.trim()||!t)&&y.mutate(o.trim())};return u?r.jsx(Dr,{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(Dr,{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(oo,{to:"/social-swag",children:[r.jsx(po,{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(O3,{resourceType:"social_swag",resourceId:i.id,resourceTitle:i.title}),r.jsxs(ee,{variant:S?"default":"outline",className:"gap-2 w-fit",onClick:()=>b.mutate(),disabled:!t||b.isPending,children:[r.jsx(zd,{className:`h-4 w-4 ${S?"fill-current":""}`}),p.length," ",p.length===1?"Like":"Likes"]})]})]}),i.description&&r.jsx("div",{className:"text-muted-foreground prose prose-sm max-w-none dark:prose-invert",dangerouslySetInnerHTML:{__html:i.description}})]}),i.links.length>0&&r.jsx(Ze,{children:r.jsxs(et,{className:"pt-6",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 mb-4",children:[r.jsx(Io,{className:"h-4 w-4"}),i.links.length===1?"Canva Link":"Canva Links"]}),r.jsx("div",{className:"grid gap-2",children:i.links.map(P=>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(P.canva_share_link,"_blank")},children:[r.jsx("span",{className:"font-medium",children:P.title}),r.jsx(As,{className:"h-4 w-4 text-muted-foreground"})]},P.id))})]})}),r.jsx(Ld,{}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 text-lg",children:[r.jsx(Ul,{className:"h-5 w-5"}),"Comments (",x.length,")"]}),t?r.jsxs("form",{onSubmit:M,className:"flex gap-2",children:[r.jsx(Jn,{placeholder:"Add a comment...",value:o,onChange:P=>l(P.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(lo,{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(Ze,{children:r.jsx(et,{className:"py-8 text-center",children:r.jsx("p",{className:"text-muted-foreground",children:"No comments yet. Be the first to share your thoughts!"})})}):x.map(P=>r.jsx(Ze,{children:r.jsx(et,{className:"pt-4 pb-4",children:r.jsxs("div",{className:"flex gap-3",children:[r.jsx(Qs,{className:"h-10 w-10 flex-shrink-0",children:r.jsx(Js,{className:"text-sm",children:k(P.user_name||"U")})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[r.jsx("span",{className:"font-medium",children:P.user_name}),r.jsx("span",{className:"text-sm text-muted-foreground",children:bu(new Date(P.created_at),{addSuffix:!0})}),P.user_id===(t==null?void 0:t.id)&&r.jsx(ee,{variant:"ghost",size:"icon",className:"h-6 w-6 ml-auto",onClick:()=>_.mutate(P.id),children:r.jsx(Bn,{className:"h-3 w-3 text-muted-foreground"})})]}),r.jsx("p",{className:"text-sm whitespace-pre-wrap",children:P.content})]})]})})},P.id))})]})]})}):r.jsx(Dr,{title:"Social Swag",children:r.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[r.jsx(Io,{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(oo,{to:"/social-swag",children:"Back to Social Swag"})})]})})},mNt=({categories:e,privateGroups:t,selectedFilter:n,onFilterChange:s,onlineUsers:a})=>{const[o,l]=E.useState(!0),[i,u]=E.useState(!0),[p,x]=E.useState(!0),y=_=>_.split(" ").map(b=>b[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(wS,{className:"h-4 w-4 mr-2"}),"All Posts"]}),r.jsxs(HS,{open:o,onOpenChange:l,children:[r.jsx(WS,{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(Wi,{className:"h-4 w-4"})]})}),r.jsx(GS,{className:"space-y-1 pl-2",children:e.map(_=>r.jsxs(ee,{variant:n===_.id?"secondary":"ghost",size:"sm",className:"w-full justify-start h-9",onClick:()=>s(_.id),children:[r.jsx("span",{className:"mr-2",children:_.icon||"📂"}),r.jsx("span",{className:"truncate",children:_.name})]},_.id))})]}),t.length>0&&r.jsxs(HS,{open:i,onOpenChange:u,children:[r.jsx(WS,{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(hp,{className:"h-3 w-3"}),"Your Groups"]}),i?r.jsx(Dd,{className:"h-4 w-4"}):r.jsx(Wi,{className:"h-4 w-4"})]})}),r.jsx(GS,{className:"space-y-1 pl-2",children:t.map(_=>r.jsxs(ee,{variant:n===`group:${_.id}`?"secondary":"ghost",size:"sm",className:"w-full justify-start h-9",onClick:()=>s(`group:${_.id}`),children:[r.jsx("span",{className:"mr-2",children:_.icon||"🔒"}),r.jsx("span",{className:"truncate",children:_.name})]},_.id))})]}),r.jsxs(HS,{open:p,onOpenChange:x,children:[r.jsx(WS,{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(Un,{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(Wi,{className:"h-4 w-4"})]})}),r.jsx(GS,{className:"pl-2 space-y-1",children:a.length===0?r.jsx("p",{className:"text-sm text-muted-foreground py-2 px-2",children:"No one else online right now"}):a.map(_=>r.jsxs("div",{className:"flex items-center gap-2 py-1.5 px-2 rounded-md hover:bg-muted transition-colors",children:[r.jsxs("div",{className:"relative",children:[r.jsxs(Qs,{className:"h-7 w-7",children:[r.jsx(Si,{src:_.avatarUrl}),r.jsx(Js,{className:"text-xs",children:y(_.name)})]}),r.jsx(Qu,{className:"h-2.5 w-2.5 fill-green-500 text-green-500 absolute -bottom-0.5 -right-0.5"})]}),r.jsx("span",{className:"text-sm truncate",children:_.name})]},_.id))})]})]})})})},gNt=({categories:e,privateGroups:t,selectedFilter:n,onFilterChange:s,onlineUsers:a})=>{const[o,l]=E.useState(!1),i=p=>p.split(" ").map(x=>x[0]).join("").toUpperCase().slice(0,2),u=()=>{if(n==="all")return"All Posts";if(n.startsWith("group:")){const x=n.replace("group:",""),y=t.find(_=>_.id===x);return y?`🔒 ${y.name}`:"Private Group"}const p=e.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(Lh,{children:[r.jsx(Oh,{asChild:!0,children:r.jsxs(ee,{variant:"outline",className:"flex-1 justify-between",children:[r.jsx("span",{className:"truncate",children:u()}),r.jsx(Dd,{className:"h-4 w-4 ml-2 shrink-0"})]})}),r.jsxs(ah,{className:"w-56 bg-background border",children:[r.jsxs(ei,{onClick:()=>s("all"),children:[r.jsx(wS,{className:"h-4 w-4 mr-2"}),"All Posts"]}),r.jsx(sk,{}),r.jsx(afe,{className:"text-xs text-muted-foreground",children:"Categories"}),e.map(p=>r.jsxs(ei,{onClick:()=>s(p.id),children:[r.jsx("span",{className:"mr-2",children:p.icon||"📂"}),p.name]},p.id)),t.length>0&&r.jsxs(r.Fragment,{children:[r.jsx(sk,{}),r.jsxs(afe,{className:"text-xs text-muted-foreground flex items-center gap-1",children:[r.jsx(hp,{className:"h-3 w-3"}),"Your Groups"]}),t.map(p=>r.jsxs(ei,{onClick:()=>s(`group:${p.id}`),children:[r.jsx("span",{className:"mr-2",children:p.icon||"🔒"}),p.name]},p.id))]})]})]}),r.jsxs(Vse,{open:o,onOpenChange:l,children:[r.jsx(eye,{asChild:!0,children:r.jsxs(ee,{variant:"outline",size:"icon",className:"relative",children:[r.jsx(Un,{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(iP,{children:[r.jsx(Hse,{children:r.jsxs(Wse,{className:"flex items-center gap-2",children:[r.jsx(Un,{className:"h-5 w-5"}),"Online Now (",a.length,")"]})}),r.jsx(Bo,{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(Qs,{className:"h-10 w-10",children:[r.jsx(Si,{src:p.avatarUrl}),r.jsx(Js,{children:i(p.name)})]}),r.jsx(Qu,{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 Tde,Pae="HoverCard",[M9e]=cc(Pae,[tx]),Lae=tx(),[xNt,R0e]=M9e(Pae),T9e=e=>{const{__scopeHoverCard:t,children:n,open:s,defaultOpen:a,onOpenChange:o,openDelay:l=700,closeDelay:i=300}=e,u=Lae(t),p=E.useRef(0),x=E.useRef(0),y=E.useRef(!1),_=E.useRef(!1),[b,S]=Ju({prop:s,defaultProp:a??!1,onChange:o,caller:Pae}),k=E.useCallback(()=>{clearTimeout(x.current),p.current=window.setTimeout(()=>S(!0),l)},[l,S]),M=E.useCallback(()=>{clearTimeout(p.current),!y.current&&!_.current&&(x.current=window.setTimeout(()=>S(!1),i))},[i,S]),P=E.useCallback(()=>S(!1),[S]);return E.useEffect(()=>()=>{clearTimeout(p.current),clearTimeout(x.current)},[]),r.jsx(xNt,{scope:t,open:b,onOpenChange:S,onOpen:k,onClose:M,onDismiss:P,hasSelectionRef:y,isPointerDownOnContentRef:_,children:r.jsx(GI,{...u,children:n})})};T9e.displayName=Pae;var A9e="HoverCardTrigger",E9e=E.forwardRef((e,t)=>{const{__scopeHoverCard:n,...s}=e,a=R0e(A9e,n),o=Lae(n);return r.jsx(_3,{asChild:!0,...o,children:r.jsx(Fn.a,{"data-state":a.open?"open":"closed",...s,ref:t,onPointerEnter:un(e.onPointerEnter,Kre(a.onOpen)),onPointerLeave:un(e.onPointerLeave,Kre(a.onClose)),onFocus:un(e.onFocus,a.onOpen),onBlur:un(e.onBlur,a.onClose),onTouchStart:un(e.onTouchStart,l=>l.preventDefault())})})});E9e.displayName=A9e;var yNt="HoverCardPortal",[Der,vNt]=M9e(yNt,{forceMount:void 0}),Gre="HoverCardContent",I9e=E.forwardRef((e,t)=>{const n=vNt(Gre,e.__scopeHoverCard),{forceMount:s=n.forceMount,...a}=e,o=R0e(Gre,e.__scopeHoverCard);return r.jsx(Tc,{present:s||o.open,children:r.jsx(_Nt,{"data-state":o.open?"open":"closed",...a,onPointerEnter:un(e.onPointerEnter,Kre(o.onOpen)),onPointerLeave:un(e.onPointerLeave,Kre(o.onClose)),ref:t})})});I9e.displayName=Gre;var _Nt=E.forwardRef((e,t)=>{const{__scopeHoverCard:n,onEscapeKeyDown:s,onPointerDownOutside:a,onFocusOutside:o,onInteractOutside:l,...i}=e,u=R0e(Gre,n),p=Lae(n),x=E.useRef(null),y=la(t,x),[_,b]=E.useState(!1);return E.useEffect(()=>{if(_){const S=document.body;return Tde=S.style.userSelect||S.style.webkitUserSelect,S.style.userSelect="none",S.style.webkitUserSelect="none",()=>{S.style.userSelect=Tde,S.style.webkitUserSelect=Tde}}},[_]),E.useEffect(()=>{if(x.current){const S=()=>{b(!1),u.isPointerDownOnContentRef.current=!1,setTimeout(()=>{var M;((M=document.getSelection())==null?void 0:M.toString())!==""&&(u.hasSelectionRef.current=!0)})};return document.addEventListener("pointerup",S),()=>{document.removeEventListener("pointerup",S),u.hasSelectionRef.current=!1,u.isPointerDownOnContentRef.current=!1}}},[u.isPointerDownOnContentRef,u.hasSelectionRef]),E.useEffect(()=>{x.current&&jNt(x.current).forEach(k=>k.setAttribute("tabindex","-1"))}),r.jsx(_v,{asChild:!0,disableOutsidePointerEvents:!1,onInteractOutside:l,onEscapeKeyDown:s,onPointerDownOutside:a,onFocusOutside:un(o,S=>{S.preventDefault()}),onDismiss:u.onDismiss,children:r.jsx(KI,{...p,...i,onPointerDown:un(i.onPointerDown,S=>{S.currentTarget.contains(S.target)&&b(!0),u.hasSelectionRef.current=!1,u.isPointerDownOnContentRef.current=!0}),ref:y,style:{...i.style,userSelect:_?"text":void 0,WebkitUserSelect:_?"text":void 0,"--radix-hover-card-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-hover-card-content-available-width":"var(--radix-popper-available-width)","--radix-hover-card-content-available-height":"var(--radix-popper-available-height)","--radix-hover-card-trigger-width":"var(--radix-popper-anchor-width)","--radix-hover-card-trigger-height":"var(--radix-popper-anchor-height)"}})})}),bNt="HoverCardArrow",wNt=E.forwardRef((e,t)=>{const{__scopeHoverCard:n,...s}=e,a=Lae(n);return r.jsx(ZI,{...a,...s,ref:t})});wNt.displayName=bNt;function Kre(e){return t=>t.pointerType==="touch"?void 0:e()}function jNt(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:s=>s.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP});for(;n.nextNode();)t.push(n.currentNode);return t}var kNt=T9e,NNt=E9e,P9e=I9e;const SNt=kNt,CNt=NNt,L9e=E.forwardRef(({className:e,align:t="center",sideOffset:n=4,...s},a)=>r.jsx(P9e,{ref:a,align:t,sideOffset:n,className:Bt("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",e),...s}));L9e.displayName=P9e.displayName;const MNt=[{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"}],TNt=e=>e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2),O9e=({reactions:e,children:t})=>{if(e.length===0)return r.jsx(r.Fragment,{children:t});const n={};return e.forEach(s=>{n[s.reaction_type]||(n[s.reaction_type]=[]),n[s.reaction_type].push(s)}),r.jsxs(SNt,{openDelay:200,closeDelay:100,children:[r.jsx(CNt,{asChild:!0,children:r.jsx("div",{className:"cursor-pointer",children:t})}),r.jsx(L9e,{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=MNt.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(Qs,{className:"h-6 w-6",children:[r.jsx(Si,{src:l.user_avatar||void 0}),r.jsx(Js,{className:"text-[10px]",children:TNt(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 ANt({images:e,initialIndex:t=0,open:n,onOpenChange:s}){const[a,o]=E.useState(t),[l,i]=E.useState(!1);E.useEffect(()=>{n&&(o(t),i(!1))},[n,t]);const u=()=>{o(_=>_>0?_-1:e.length-1),i(!1)},p=()=>{o(_=>_{n&&(_.key==="ArrowLeft"&&u(),_.key==="ArrowRight"&&p(),_.key==="Escape"&&s(!1))},[n,e.length]);E.useEffect(()=>(window.addEventListener("keydown",x),()=>window.removeEventListener("keydown",x)),[x]);const y=e[a];return r.jsx(Or,{open:n,onOpenChange:s,children:r.jsxs(Ir,{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(hs,{className:"h-6 w-6"})}),e.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:u,children:r.jsx(kc,{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(Wi,{className:"h-8 w-8"})})]}),e.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," / ",e.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(FS,{className:"h-5 w-5"}):r.jsx(RS,{className:"h-5 w-5"})}),r.jsx("div",{className:Bt("flex items-center justify-center w-full h-full min-h-[50vh] p-4",l?"cursor-zoom-out overflow-auto":"cursor-zoom-in"),onClick:()=>(y==null?void 0:y.type)==="image"&&i(!l),children:(y==null?void 0:y.type)==="video"?r.jsx("video",{src:y.url,controls:!0,autoPlay:!0,className:"max-w-full max-h-[85vh] object-contain",onClick:_=>_.stopPropagation()}):r.jsx("img",{src:y==null?void 0:y.url,alt:"",className:Bt("object-contain transition-transform duration-200",l?"max-w-none max-h-none scale-150":"max-w-full max-h-[85vh]")})}),e.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:e.map((_,b)=>r.jsx("button",{onClick:()=>{o(b),i(!1)},className:Bt("w-12 h-12 rounded overflow-hidden flex-shrink-0 border-2 transition-all",a===b?"border-white":"border-transparent opacity-60 hover:opacity-100"),children:_.type==="video"?r.jsx("video",{src:_.url,className:"w-full h-full object-cover"}):r.jsx("img",{src:_.url,alt:"",className:"w-full h-full object-cover"})},b))})]})})}const bO=[{type:"like",emoji:"👍",label:"Like"},{type:"love",emoji:"❤️",label:"Love"}],ENt=({commentId:e,reactions:t,currentUserId:n})=>{var p,x;const s=Hr(),[a,o]=E.useState(!1),l=t.find(y=>y.user_id===n),i=ir({mutationFn:async y=>{l?l.reaction_type===y?await Q.from("community_comment_reactions").delete().eq("id",l.id):await Q.from("community_comment_reactions").update({reaction_type:y}).eq("id",l.id):await Q.from("community_comment_reactions").insert({comment_id:e,user_id:n,reaction_type:y})},onSuccess:()=>{s.invalidateQueries({queryKey:["community-posts"]}),o(!1)}}),u={};return t.forEach(y=>{u[y.reaction_type]=(u[y.reaction_type]||0)+1}),r.jsxs("div",{className:"flex items-center gap-2",children:[t.length>0&&r.jsx(O9e,{reactions:t,children:r.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors",children:[r.jsx("div",{className:"flex -space-x-0.5",children:Object.keys(u).slice(0,2).map(y=>{var _;return r.jsx("span",{className:"text-sm",children:(_=bO.find(b=>b.type===y))==null?void 0:_.emoji},y)})}),r.jsx("span",{children:t.length})]})}),n&&r.jsxs(Vc,{open:a,onOpenChange:o,children:[r.jsx(Hc,{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=bO.find(y=>y.type===l.reaction_type))==null?void 0:p.emoji," ",(x=bO.find(y=>y.type===l.reaction_type))==null?void 0:x.label]}):r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(xi,{className:"h-3 w-3"}),"Like"]})})}),r.jsx(Mc,{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:bO.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 F0e({content:e,className:t}){const n=/([@#])\[([^\]]+)\]\(([^)]+)\)|(https?:\/\/[^\s<>]+)/g,s=[];let a=0,o,l=0;for(;(o=n.exec(e))!==null;){if(o.index>a&&s.push(e.substring(a,o.index)),o[1]){const i=o[1],u=o[2],p=o[3],x=i==="#";s.push(r.jsx(oo,{to:x?`/templates/${p}`:`/profile?user=${p}`,className:Bt("font-medium hover:underline",x?"text-white bg-[#2a4c64] px-1.5 py-0.5 rounded":"text-primary"),onClick:y=>y.stopPropagation(),children:x?u:`@${u}`},`mention-${l++}`))}else if(o[4]){const i=o[4],u=i.replace(/[.,;:!?)]+$/,""),p=i.slice(u.length);let x;try{const y=new URL(u);x=y.hostname+(y.pathname!=="/"?y.pathname.slice(0,20)+(y.pathname.length>20?"...":""):"")}catch{x=u.length>40?u.slice(0,40)+"...":u}s.push(r.jsx("a",{href:u,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline break-all",onClick:y=>y.stopPropagation(),children:x},`url-${l++}`)),p&&s.push(p)}a=o.index+o[0].length}return ar.jsx(E.Fragment,{children:i},u))})}function Zre({value:e,onChange:t,placeholder:n="What's on your mind? Use @ to mention someone",className:s,minHeight:a="80px",onMentionsChange:o,onTemplatesChange:l,onKeyDown:i,mentionFormat:u="encoded",enableTemplateMentions:p=!1}){const x=E.useRef(null),y=E.useRef(null),[_,b]=E.useState(!1),[S,k]=E.useState("user"),[M,P]=E.useState(""),[T,I]=E.useState(null),[z,D]=E.useState(0),[U,V]=E.useState({top:0,left:0,width:0}),W=E.useRef(new Map),G=E.useRef(new Map),J=be=>{if(u==="plain"){const De=[];return W.current.forEach((Be,qe)=>{be.includes(`@${qe}`)&&De.push(Be)}),[...new Set(De)]}const _e=/@\[([^\]]+)\]\(([^)]+)\)/g,Je=[];let Te;for(;(Te=_e.exec(be))!==null;)Je.push(Te[2]);return[...new Set(Je)]},ne=be=>{if(u==="plain"){const De=[];return G.current.forEach((Be,qe)=>{be.includes(`#${qe}`)&&De.push(Be)}),[...new Set(De)]}const _e=/#\[([^\]]+)\]\(([^)]+)\)/g,Je=[];let Te;for(;(Te=_e.exec(be))!==null;)Je.push(Te[2]);return[...new Set(Je)]};E.useEffect(()=>{if(o){const be=J(e);o(be)}if(l){const be=ne(e);l(be)}},[e,o,l,u]);const{data:oe=[],isLoading:ge}=Kt({queryKey:["mention-users",M],queryFn:async()=>{const be=Q.from("profiles").select("id, name").limit(8),_e=M.length>=1?be.ilike("name",`%${M}%`):be.order("name"),{data:Je,error:Te}=await _e;if(Te)throw Te;const De=Je.map(Be=>Be.id),Ue=await P8e(De);return Je.map(Be=>({id:Be.id,name:Be.name||"Unknown",avatar_url:Ue.get(Be.id)}))},enabled:_&&S==="user",staleTime:3e4}),{data:ie=[],isLoading:pe}=Kt({queryKey:["mention-templates",M],queryFn:async()=>{let be=Q.from("canva_templates").select("id, name, preview_image_url").lte("publish_date",new Date().toISOString()).order("publish_date",{ascending:!1}).limit(8);M.length>=1&&(be=be.ilike("name",`%${M}%`));const{data:_e,error:Je}=await be;if(Je)throw Je;return _e||[]},enabled:_&&S==="template"&&p,staleTime:3e4}),se=S==="user"?ge:pe,fe=S==="user"?oe:ie,he=be=>be.split(" ").map(_e=>_e[0]).join("").toUpperCase().slice(0,2),ye=be=>{const _e=be.target.value,Je=be.target.selectionStart;t(_e);const Te=_e.substring(0,Je),De=Te.lastIndexOf("@"),Ue=p?Te.lastIndexOf("#"):-1;let Be=-1,qe="user";if(De>Ue?(Be=De,qe="user"):Ue>De&&p&&(Be=Ue,qe="template"),Be!==-1){const ot=Te.substring(Be+1),Mt=ot.includes(" "),Oe=ot.includes(` `);if(!Mt&&!Oe&&ot.length<=30){I(Be),P(ot),k(qe),b(!0),D(0);return}}b(!1),I(null)},Ae=be=>{if(T===null)return;const _e=e.substring(0,T),Je=e.substring(T+M.length+1),Te=S==="user"?"@":"#",De=u==="plain"?`${Te}${be.name} `:`${Te}[${be.name}](${be.id}) `;u==="plain"&&(S==="user"?W.current.set(be.name,be.id):G.current.set(be.name,be.id));const Ue=_e+De+Je;t(Ue),b(!1),I(null),P(""),setTimeout(()=>{if(x.current){const Be=_e.length+De.length;x.current.focus(),x.current.setSelectionRange(Be,Be)}},0)},we=be=>{if(!(!_||fe.length===0))switch(be.key){case"ArrowDown":be.preventDefault(),D(_e=>(_e+1)%fe.length);break;case"ArrowUp":be.preventDefault(),D(_e=>(_e-1+fe.length)%fe.length);break;case"Enter":fe[z]&&(be.preventDefault(),Ae(fe[z]));break;case"Escape":be.preventDefault(),b(!1);break;case"Tab":fe[z]&&(be.preventDefault(),Ae(fe[z]));break}};return E.useEffect(()=>{const be=_e=>{y.current&&!y.current.contains(_e.target)&&x.current&&!x.current.contains(_e.target)&&b(!1)};return document.addEventListener("mousedown",be),()=>document.removeEventListener("mousedown",be)},[]),E.useEffect(()=>{if(!_)return;const be=()=>{const _e=x.current;if(!_e)return;const Je=_e.getBoundingClientRect();V({top:Je.bottom+4,left:Je.left,width:Je.width})};return be(),window.addEventListener("resize",be),window.addEventListener("scroll",be,!0),()=>{window.removeEventListener("resize",be),window.removeEventListener("scroll",be,!0)}},[_,e]),r.jsxs("div",{className:"relative flex-1",children:[r.jsx(Jn,{ref:x,value:e,onChange:ye,onKeyDown:be=>{we(be),be.defaultPrevented||i==null||i(be)},placeholder:n,className:Bt("resize-none",s),style:{minHeight:a}}),_&&kh.createPortal(r.jsxs("div",{ref:y,className:"fixed z-[1000] max-h-[220px] overflow-hidden rounded-lg border bg-popover shadow-lg",style:{top:U.top,left:U.left,width:U.width,maxWidth:"320px"},children:[r.jsx("div",{className:"px-3 py-1.5 text-xs font-medium text-muted-foreground border-b bg-muted/30",children:S==="user"?"👤 Mention a person":"📋 Link a template"}),se?r.jsx("div",{className:"px-3 py-2 text-sm text-muted-foreground",children:"Searching..."}):fe.length===0?r.jsx("div",{className:"px-3 py-2 text-sm text-muted-foreground",children:M.length<1?`Type to search ${S==="user"?"people":"templates"}...`:`No ${S==="user"?"users":"templates"} found`}):r.jsx("ul",{className:"py-1 max-h-[180px] overflow-y-auto",children:fe.map((be,_e)=>r.jsx("li",{className:Bt("flex items-center gap-2 px-3 py-2 cursor-pointer transition-colors",_e===z?"bg-accent":"hover:bg-accent/50"),onClick:()=>Ae(be),onMouseEnter:()=>D(_e),children:S==="user"?r.jsxs(r.Fragment,{children:[r.jsxs(Qs,{className:"h-6 w-6",children:[r.jsx(Si,{src:be.avatar_url}),r.jsx(Js,{className:"text-xs",children:he(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(Uc,{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 INt(e){const t=/#\[([^\]]+)\]\(([^)]+)\)/g,n=[];let s;for(;(s=t.exec(e))!==null;)n.push(s[2]);return[...new Set(n)]}const BSe=e=>e.split(" ").map(t=>t[0]).join("").toUpperCase().slice(0,2);function D9e({comment:e,postId:t,currentUserId:n,currentUserAvatar:s,currentUserEmail:a,canModerate:o,depth:l=0}){const i=Hr(),[u,p]=E.useState(!1),[x,y]=E.useState(""),[_,b]=E.useState([]),S=ir({mutationFn:async({content:T,parentCommentId:I})=>{const{data:z,error:D}=await Q.from("community_comments").insert({post_id:t,user_id:n,content:T,parent_comment_id:I}).select("id").single();if(D)throw D;const U=_;if(U.length>0&&z){const V=U.filter(W=>W!==n).map(W=>({comment_id:z.id,mentioned_user_id:W,mentioned_by_user_id:n}));V.length>0&&await Q.from("community_comment_mentions").insert(V)}},onSuccess:()=>{i.invalidateQueries({queryKey:["community-posts"]}),y(""),b([]),p(!1)}}),k=ir({mutationFn:async T=>{const{error:I}=await Q.from("community_comments").delete().eq("id",T);if(I)throw I},onSuccess:()=>i.invalidateQueries({queryKey:["community-posts"]})}),M=()=>{x.trim()&&S.mutate({content:x,parentCommentId:e.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(Qs,{className:"h-8 w-8 shrink-0",children:[r.jsx(Si,{src:e.user_avatar||void 0}),r.jsx(Js,{className:"text-xs",children:BSe(e.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:e.user_name}),r.jsx(F0e,{content:e.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:bu(new Date(e.created_at),{addSuffix:!0})}),r.jsx(ENt,{commentId:e.id,reactions:e.reactions,currentUserId:n}),n&&l<2&&r.jsxs("button",{onClick:()=>p(!u),className:"hover:text-primary flex items-center gap-1",children:[r.jsx(vA,{className:"h-3 w-3"}),"Reply"]}),(e.user_id===n||o)&&r.jsx("button",{onClick:()=>k.mutate(e.id),className:"hover:text-destructive",children:e.user_id!==n?"Remove":"Delete"})]}),u&&n&&r.jsxs("div",{className:"flex gap-2 mt-2",children:[r.jsxs(Qs,{className:"h-6 w-6 shrink-0 mt-1",children:[r.jsx(Si,{src:s||void 0}),r.jsx(Js,{className:"text-xs",children:BSe((a==null?void 0:a.split("@")[0])||"U")})]}),r.jsxs("div",{className:"flex-1 flex gap-2 items-start",children:[r.jsx(Zre,{placeholder:`Reply to ${e.user_name}...`,value:x,onChange:y,onMentionsChange:b,mentionFormat:"plain",className:"text-sm min-h-0 py-1.5",minHeight:"32px"}),r.jsx(ee,{size:"sm",variant:"ghost",onClick:M,disabled:!x.trim()||S.isPending,className:"h-8 px-2 mt-0.5",children:r.jsx(lo,{className:"h-3 w-3"})})]})]})]})]}),e.replies&&e.replies.length>0&&r.jsx("div",{className:"mt-2 space-y-2",children:e.replies.map(T=>r.jsx(D9e,{comment:T,postId:t,currentUserId:n,currentUserAvatar:s,currentUserEmail:a,canModerate:o,depth:l+1},T.id))})]})}const wO=[{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"}],PNt=()=>{const{user:e,isBrokerageManager:t,managedBrokerages:n,isAdmin:s}=tn(),{avatarUrl:a}=I8e(e==null?void 0:e.id),{onlineUsers:o}=cRe(),{toast:l}=_i(),i=Hr(),u=E.useRef(null),[p,x]=E.useState("all"),[y,_]=E.useState(""),[b,S]=E.useState(""),[k,M]=E.useState(""),[P,T]=E.useState([]),[I,z]=E.useState([]),[D,U]=E.useState(""),[V,W]=E.useState(!1),[G,J]=E.useState(null),[ne,oe]=E.useState(""),[ge,ie]=E.useState(new Set),[pe,se]=E.useState({}),[fe,he]=E.useState({}),[ye,Ae]=E.useState([]),[we,be]=E.useState([]),[_e,Je]=E.useState({open:!1,images:[],index:0});E.useEffect(()=>{if(p.startsWith("group:")){const it=p.replace("group:","");M(it),S("")}else p!=="all"?(S(p),M("")):(S(""),M(""))},[p]);const{data:Te=[]}=Kt({queryKey:["community-categories"],queryFn:async()=>{const{data:it,error:zt}=await Q.from("community_categories").select("*").order("sort_order");if(zt)throw zt;return it}}),{data:De=[]}=Kt({queryKey:["community-private-groups"],queryFn:async()=>{const{data:it,error:zt}=await Q.from("community_private_groups").select("id, name, description, icon, brokerage_id, sort_order").order("sort_order");if(zt)throw zt;return it}}),Ue=20,{data:Be,isLoading:qe,hasNextPage:ot,fetchNextPage:Mt,isFetchingNextPage:Oe}=Ttt({queryKey:["community-posts",p],initialPageParam:0,queryFn:async({pageParam:it})=>{var Pe;const zt=it*Ue,dr=zt+Ue;let Rr=Q.from("community_posts").select("*").order("is_pinned",{ascending:!1}).order("pinned_at",{ascending:!1,nullsFirst:!1}).order("created_at",{ascending:!1}).range(zt,dr);if(p.startsWith("group:")){const Ye=p.replace("group:","");Rr=Rr.eq("private_group_id",Ye)}else p==="all"||(Rr=Rr.eq("category_id",p).is("private_group_id",null));const{data:Gr,error:Ur}=await Rr;if(Ur)throw Ur;const kn=((Gr==null?void 0:Gr.length)||0)>Ue,_s=(Gr||[]).slice(0,Ue);if(_s.length===0)return{posts:[],hasMore:!1,nextPage:it+1};const ur=_s.map(Ye=>Ye.id),Rn=[...new Set(_s.filter(Ye=>Ye.category_id).map(Ye=>Ye.category_id))].filter(Boolean),[ea,ca,Ei,Ii,$o]=await Promise.all([Rn.length?Q.from("community_categories").select("*").in("id",Rn):Promise.resolve({data:[]}),Q.from("community_post_media").select("*").in("post_id",ur).order("sort_order"),Q.from("community_reactions").select("*").in("post_id",ur),Q.from("community_comments").select("*").in("post_id",ur).order("created_at",{ascending:!0}),Q.from("community_post_resources").select("*").in("post_id",ur)]),Va=ea==null?void 0:ea.data,cs=ca==null?void 0:ca.data,ta=Ei==null?void 0:Ei.data,ds=Ii==null?void 0:Ii.data,Hs=$o==null?void 0:$o.data,Os=(ds||[]).map(Ye=>Ye.id),[bi,sr]=await Promise.all([Os.length?Q.from("community_comment_reactions").select("*").in("comment_id",Os):Promise.resolve({data:[]}),(()=>{const Ye=(Hs||[]).filter(Nt=>Nt.resource_type==="template").map(Nt=>Nt.resource_id);return Ye.length===0?Promise.resolve({data:[]}):Q.from("canva_templates").select("id, name, preview_image_url").in("id",Ye)})()]),Ia=(bi==null?void 0:bi.data)||[],no=(sr==null?void 0:sr.data)||[],yi=new Map(no.map(Ye=>[Ye.id,{name:Ye.name,preview_image_url:Ye.preview_image_url}])),qn=Array.from(new Set([..._s.map(Ye=>Ye.user_id),...(ta||[]).map(Ye=>Ye.user_id),...(ds||[]).map(Ye=>Ye.user_id),...Ia.map(Ye=>Ye.user_id)])),[Gi,dc]=await Promise.all([qn.length?Q.from("profiles").select("id, name").in("id",qn):Promise.resolve({data:[]}),P8e(qn)]),go=new Map(((Pe=Gi==null?void 0:Gi.data)==null?void 0:Pe.map(Ye=>[Ye.id,Ye.name]))||[]),uc=new Map((Va||[]).map(Ye=>[Ye.id,Ye])),tt=Ye=>{const Nt=new Map,_t=[];return Ye.forEach(At=>{Nt.set(At.id,{...At,user_name:go.get(At.user_id)||"Unknown User",user_avatar:dc.get(At.user_id),reactions:Ia.filter($t=>$t.comment_id===At.id).map($t=>({...$t,user_name:go.get($t.user_id)||"Unknown User",user_avatar:dc.get($t.user_id)})),replies:[]})}),Ye.forEach(At=>{const $t=Nt.get(At.id);if(At.parent_comment_id&&Nt.has(At.parent_comment_id)){const Lt=Nt.get(At.parent_comment_id);Lt.replies=Lt.replies||[],Lt.replies.push($t)}else _t.push($t)}),_t};return{posts:_s.map(Ye=>{const Nt=(Hs||[]).filter(_t=>_t.post_id===Ye.id).map(_t=>{let At="",$t=null;if(_t.resource_type==="template"){const Lt=yi.get(_t.resource_id);At=(Lt==null?void 0:Lt.name)||"Unknown Template",$t=(Lt==null?void 0:Lt.preview_image_url)||null}return{id:_t.id,resource_type:_t.resource_type,resource_id:_t.resource_id,resource_name:At,resource_preview_url:$t}});return{...Ye,user_name:go.get(Ye.user_id)||"Unknown User",user_avatar:dc.get(Ye.user_id),category:Ye.category_id?uc.get(Ye.category_id):null,media:(cs||[]).filter(_t=>_t.post_id===Ye.id),reactions:((ta||[]).filter(_t=>_t.post_id===Ye.id)||[]).map(_t=>({..._t,user_name:go.get(_t.user_id)||"Unknown User",user_avatar:dc.get(_t.user_id)})),comments:tt((ds||[]).filter(_t=>_t.post_id===Ye.id)),resources:Nt}}),hasMore:kn,nextPage:it+1}},getNextPageParam:it=>it.hasMore?it.nextPage:void 0}),at=E.useMemo(()=>(Be==null?void 0:Be.pages.flatMap(it=>it.posts))??[],[Be]),le=ir({mutationFn:async()=>{W(!0);const{data:it,error:zt}=await Q.from("community_posts").insert({user_id:e.id,category_id:k?null:b||null,private_group_id:k||null,content:y,link_url:D||null}).select().single();if(zt)throw zt;for(let Rr=0;Rr0){const Rr=ye.filter(Gr=>Gr!==e.id).map(Gr=>({post_id:it.id,mentioned_user_id:Gr,mentioned_by_user_id:e.id}));Rr.length>0&&await Q.from("community_post_mentions").insert(Rr)}const dr=INt(y);if(dr.length>0){const Rr=dr.map(Gr=>({post_id:it.id,resource_type:"template",resource_id:Gr}));await Q.from("community_post_resources").insert(Rr)}return it},onSuccess:async it=>{var zt;i.invalidateQueries({queryKey:["community-posts"]}),_(""),Ae([]),be([]),S(""),M(""),T([]),z([]),U(""),l({title:"Post created!"});try{const dr=((zt=e==null?void 0:e.user_metadata)==null?void 0:zt.name)||"Someone",Rr=y.length>50?y.substring(0,50)+"...":y;await Q.functions.invoke("send-push-notification",{body:{title:"New Community Post",body:`${dr}: ${Rr}`,url:"/community"}})}catch(dr){console.error("Failed to send push notification:",dr)}},onError:it=>{l({title:"Error creating post",description:it.message,variant:"destructive"})},onSettled:()=>W(!1)}),Ve=ir({mutationFn:async({postId:it,content:zt})=>{const{error:dr}=await Q.from("community_posts").update({content:zt}).eq("id",it);if(dr)throw dr},onSuccess:()=>{i.invalidateQueries({queryKey:["community-posts"]}),J(null),oe(""),l({title:"Post updated!"})}}),Qe=ir({mutationFn:async it=>{const{error:zt}=await Q.from("community_posts").delete().eq("id",it);if(zt)throw zt},onSuccess:()=>{i.invalidateQueries({queryKey:["community-posts"]}),l({title:"Post deleted"})}}),st=ir({mutationFn:async({postId:it,isPinned:zt})=>{const{error:dr}=await Q.from("community_posts").update({is_pinned:!zt,pinned_at:zt?null:new Date().toISOString(),pinned_by:zt?null:e==null?void 0:e.id}).eq("id",it);if(dr)throw dr},onSuccess:(it,{isPinned:zt})=>{i.invalidateQueries({queryKey:["community-posts"]}),l({title:zt?"Post unpinned":"Post pinned to top"})}}),ke=ir({mutationFn:async({postId:it,reactionType:zt})=>{var Rr;const dr=(Rr=at.find(Gr=>Gr.id===it))==null?void 0:Rr.reactions.find(Gr=>Gr.user_id===(e==null?void 0:e.id));dr?dr.reaction_type===zt?await Q.from("community_reactions").delete().eq("id",dr.id):await Q.from("community_reactions").update({reaction_type:zt}).eq("id",dr.id):await Q.from("community_reactions").insert({post_id:it,user_id:e.id,reaction_type:zt})},onSuccess:()=>i.invalidateQueries({queryKey:["community-posts"]})}),ct=ir({mutationFn:async({postId:it,content:zt})=>{const{data:dr,error:Rr}=await Q.from("community_comments").insert({post_id:it,user_id:e.id,content:zt}).select("id").single();if(Rr)throw Rr;const Gr=fe[it]||[];if(Gr.length>0&&dr){const Ur=Gr.filter(kn=>kn!==e.id).map(kn=>({comment_id:dr.id,mentioned_user_id:kn,mentioned_by_user_id:e.id}));Ur.length>0&&await Q.from("community_comment_mentions").insert(Ur)}},onSuccess:(it,{postId:zt})=>{i.invalidateQueries({queryKey:["community-posts"]}),se(dr=>({...dr,[zt]:""})),he(dr=>({...dr,[zt]:[]}))}});ir({mutationFn:async it=>{const{error:zt}=await Q.from("community_comments").delete().eq("id",it);if(zt)throw zt},onSuccess:()=>i.invalidateQueries({queryKey:["community-posts"]})});const Ce=it=>{const zt=Array.from(it.target.files||[]);if(zt.length+P.length>10){l({title:"Maximum 10 files allowed",variant:"destructive"});return}T(dr=>[...dr,...zt]),zt.forEach(dr=>{const Rr=new FileReader;Rr.onloadend=()=>{z(Gr=>[...Gr,Rr.result])},Rr.readAsDataURL(dr)})},Me=it=>{T(zt=>zt.filter((dr,Rr)=>Rr!==it)),z(zt=>zt.filter((dr,Rr)=>Rr!==it))},Ge=it=>it.split(" ").map(zt=>zt[0]).join("").toUpperCase().slice(0,2),Ee=it=>{const zt={};return it.forEach(dr=>{zt[dr.reaction_type]=(zt[dr.reaction_type]||0)+1}),zt},He=it=>{var zt;return(zt=it.find(dr=>dr.user_id===(e==null?void 0:e.id)))==null?void 0:zt.reaction_type},nt=it=>it.reduce((zt,dr)=>zt+1+(dr.replies?nt(dr.replies):0),0),yt=it=>{if(s)return!0;if(!t||!it.private_group_id)return!1;const zt=De.find(dr=>dr.id===it.private_group_id);return zt!=null&&zt.brokerage_id?n.some(dr=>dr.id===zt.brokerage_id):!1};return r.jsx(Dr,{title:"Community",children:r.jsxs("div",{className:"flex gap-6 w-full isolate z-0",children:[r.jsx(mNt,{categories:Te,privateGroups:De,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(gNt,{categories:Te,privateGroups:De,selectedFilter:p,onFilterChange:x,onlineUsers:o}),r.jsx(Ze,{children:r.jsx(et,{className:"pt-6",children:r.jsxs("div",{className:"flex gap-3",children:[r.jsxs(Qs,{className:"h-10 w-10",children:[r.jsx(Si,{src:a||void 0}),r.jsx(Js,{children:e!=null&&e.email?Ge(e.email.split("@")[0]):"U"})]}),r.jsxs("div",{className:"flex-1 space-y-3",children:[r.jsx(Zre,{placeholder:s?"What's on your mind? Use @ to mention someone, # to link a template":"What's on your mind? Use @ to mention someone",value:y,onChange:_,onMentionsChange:Ae,onTemplatesChange:be,mentionFormat:"encoded",minHeight:"80px",enableTemplateMentions:s}),I.length>0&&r.jsx("div",{className:"grid grid-cols-3 gap-2",children:I.map((it,zt)=>{var dr;return r.jsxs("div",{className:"relative aspect-square rounded-lg overflow-hidden bg-muted",children:[(dr=P[zt])!=null&&dr.type.startsWith("video/")?r.jsx("video",{src:it,className:"w-full h-full object-cover"}):r.jsx("img",{src:it,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:()=>Me(zt),children:r.jsx(hs,{className:"h-3 w-3"})})]},zt)})}),D&&r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Io,{className:"h-4 w-4 text-muted-foreground"}),r.jsx(dt,{value:D,onChange:it=>U(it.target.value),placeholder:"https://...",className:"flex-1"}),r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>U(""),children:r.jsx(hs,{className:"h-4 w-4"})})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center justify-between gap-3",children:[r.jsxs("div",{className:"flex gap-1 flex-wrap",children:[r.jsx("input",{type:"file",ref:u,onChange:Ce,accept:"image/*,video/*",multiple:!0,className:"hidden"}),r.jsxs(ee,{variant:"ghost",size:"sm",onClick:()=>{var it;return(it=u.current)==null?void 0:it.click()},children:[r.jsx(Rl,{className:"h-4 w-4 mr-1"}),"Photo"]}),r.jsxs(ee,{variant:"ghost",size:"sm",onClick:()=>{var it;return(it=u.current)==null?void 0:it.click()},children:[r.jsx($a,{className:"h-4 w-4 mr-1"}),"Video"]}),r.jsxs(ee,{variant:"ghost",size:"sm",onClick:()=>U("https://"),children:[r.jsx(Io,{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:[De.length>0?r.jsxs(mn,{value:k||b||"none",onValueChange:it=>{it==="none"?(S(""),M("")):it.startsWith("group:")?(M(it.replace("group:","")),S("")):(S(it),M(""))},children:[r.jsx(fn,{className:"w-[130px] sm:w-[160px] h-8 text-xs sm:text-sm",children:r.jsx(yn,{placeholder:"Select..."})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"none",children:"No category"}),Te.map(it=>r.jsxs(qt,{value:it.id,children:[it.icon," ",it.name]},it.id)),De.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"}),De.map(it=>r.jsxs(qt,{value:`group:${it.id}`,children:[it.icon||"🔒"," ",it.name]},it.id))]})]})]}):r.jsxs(mn,{value:b,onValueChange:S,children:[r.jsx(fn,{className:"w-[110px] sm:w-[140px] h-8 text-xs sm:text-sm",children:r.jsx(yn,{placeholder:"Category"})}),r.jsx(pn,{children:Te.map(it=>r.jsxs(qt,{value:it.id,children:[it.icon," ",it.name]},it.id))})]}),r.jsxs(ee,{size:"sm",onClick:()=>le.mutate(),disabled:!y.trim()||V,children:[r.jsx(lo,{className:"h-4 w-4 mr-1"}),"Post"]})]})]})]})]})})}),qe?r.jsx("div",{className:"space-y-4",children:[...Array(3)].map((it,zt)=>r.jsx(Ze,{children:r.jsx(et,{className:"pt-6",children:r.jsxs("div",{className:"flex gap-3",children:[r.jsx(Lr,{className:"h-10 w-10 rounded-full"}),r.jsxs("div",{className:"flex-1 space-y-2",children:[r.jsx(Lr,{className:"h-4 w-32"}),r.jsx(Lr,{className:"h-4 w-full"}),r.jsx(Lr,{className:"h-4 w-3/4"})]})]})})},zt))}):at.length===0?r.jsx(Ze,{children:r.jsxs(et,{className:"py-12 text-center",children:[r.jsx(Ul,{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:[at.map(it=>{var zt,dr,Rr,Gr;return r.jsx(Ze,{children:r.jsxs(et,{className:"pt-6",children:[r.jsxs("div",{className:"flex items-start justify-between mb-3",children:[r.jsxs("div",{className:"flex gap-3 min-w-0",children:[r.jsxs(Qs,{className:"h-10 w-10",children:[r.jsx(Si,{src:it.user_avatar||void 0}),r.jsx(Js,{children:Ge(it.user_name||"U")})]}),r.jsxs("div",{className:"min-w-0",children:[r.jsx("div",{className:"font-semibold break-words",children:it.user_name}),r.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-sm text-muted-foreground",children:[r.jsx("span",{children:bu(new Date(it.created_at),{addSuffix:!0})}),it.category&&r.jsxs(r.Fragment,{children:[r.jsx("span",{children:"•"}),r.jsxs(Pt,{variant:"secondary",className:"text-xs",children:[it.category.icon," ",it.category.name]})]})]})]})]}),(it.user_id===(e==null?void 0:e.id)||yt(it))&&r.jsxs(Lh,{children:[r.jsx(Oh,{asChild:!0,children:r.jsx(ee,{variant:"ghost",size:"icon",className:"h-8 w-8",children:r.jsx(pm,{className:"h-4 w-4"})})}),r.jsxs(ah,{align:"end",children:[yt(it)&&it.private_group_id&&r.jsx(ei,{onClick:()=>st.mutate({postId:it.id,isPinned:it.is_pinned}),children:it.is_pinned?r.jsxs(r.Fragment,{children:[r.jsx(pA,{className:"h-4 w-4 mr-2"}),"Unpin Post"]}):r.jsxs(r.Fragment,{children:[r.jsx(K1,{className:"h-4 w-4 mr-2"}),"Pin to Top"]})}),it.user_id===(e==null?void 0:e.id)&&r.jsxs(ei,{onClick:()=>{J(it),oe(it.content)},children:[r.jsx(ni,{className:"h-4 w-4 mr-2"}),"Edit"]}),r.jsxs(ei,{className:"text-destructive",onClick:()=>Qe.mutate(it.id),children:[r.jsx(Bn,{className:"h-4 w-4 mr-2"}),it.user_id!==(e==null?void 0:e.id)?"Remove (Moderate)":"Delete"]})]})]})]}),it.is_pinned&&r.jsxs("div",{className:"flex items-center gap-2 mb-2 text-sm text-primary",children:[r.jsx(K1,{className:"h-4 w-4"}),r.jsx("span",{className:"font-medium",children:"Pinned"})]}),r.jsx("div",{className:"mb-3",children:r.jsx(F0e,{content:it.content})}),it.media.length>0&&r.jsx("div",{className:`grid gap-2 mb-3 ${it.media.length===1?"grid-cols-1":it.media.length===2?"grid-cols-2":it.media.length===3?"grid-cols-3":"grid-cols-2"}`,children:it.media.slice(0,4).map((Ur,kn)=>{const _s=kn===3&&it.media.length>4,ur=it.media.length-4;return r.jsxs("div",{className:`relative rounded-lg overflow-hidden bg-muted cursor-pointer group ${it.media.length===1?"max-h-[500px]":it.media.length===2?"aspect-[4/3]":"aspect-square"}`,onClick:()=>Je({open:!0,images:it.media.map(Rn=>({url:Rn.media_url,type:Rn.media_type==="video"?"video":"image"})),index:kn}),children:[Ur.media_type==="video"?r.jsx("video",{src:Ur.media_url,className:"w-full h-full object-cover transition-transform group-hover:scale-105"}):r.jsx("img",{src:Ur.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"})})})}),_s&&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:["+",ur]})})]},Ur.id)})}),it.link_url&&r.jsxs("a",{href:it.link_url,target:"_blank",rel:"noopener noreferrer",className:"block rounded-lg border hover:bg-muted transition-colors mb-3 overflow-hidden",children:[it.link_image&&r.jsx("div",{className:"aspect-video bg-muted",children:r.jsx("img",{src:it.link_image,alt:it.link_title||"Link preview",className:"w-full h-full object-cover",onError:Ur=>{Ur.currentTarget.style.display="none"}})}),r.jsx("div",{className:"p-3",children:it.link_title?r.jsxs(r.Fragment,{children:[r.jsx("p",{className:"font-medium text-foreground line-clamp-2",children:it.link_title}),it.link_description&&r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 mt-1",children:it.link_description}),r.jsx("p",{className:"text-xs text-muted-foreground mt-2 truncate",children:new URL(it.link_url).hostname})]}):r.jsxs("div",{className:"flex items-center gap-2 text-sm text-primary",children:[r.jsx(Io,{className:"h-4 w-4 flex-shrink-0"}),r.jsx("span",{className:"truncate",children:it.link_url})]})})]}),it.reactions.length>0&&r.jsx(O9e,{reactions:it.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(Ee(it.reactions)).slice(0,3).map(([Ur])=>{var kn;return r.jsx("span",{className:"text-base",children:(kn=wO.find(_s=>_s.type===Ur))==null?void 0:kn.emoji},Ur)})}),r.jsx("span",{children:it.reactions.length})]})}),r.jsxs("div",{className:"flex items-center gap-1 border-t border-b py-1 my-2",children:[r.jsxs(Vc,{children:[r.jsx(Hc,{asChild:!0,children:r.jsxs(ee,{variant:"ghost",size:"sm",className:"flex-1",children:[He(it.reactions)?r.jsx("span",{className:"mr-1",children:(zt=wO.find(Ur=>Ur.type===He(it.reactions)))==null?void 0:zt.emoji}):r.jsx(zd,{className:"h-4 w-4 mr-1"}),He(it.reactions)?(dr=wO.find(Ur=>Ur.type===He(it.reactions)))==null?void 0:dr.label:"Like"]})}),r.jsx(Mc,{className:"w-auto p-2",side:"top",children:r.jsx("div",{className:"flex gap-1",children:wO.map(Ur=>r.jsx("button",{onClick:()=>ke.mutate({postId:it.id,reactionType:Ur.type}),className:"text-2xl hover:scale-125 transition-transform p-1",title:Ur.label,children:Ur.emoji},Ur.type))})})]}),r.jsxs(ee,{variant:"ghost",size:"sm",className:"flex-1",onClick:()=>ie(Ur=>{const kn=new Set(Ur);return kn.has(it.id)?kn.delete(it.id):kn.add(it.id),kn}),children:[r.jsx(Ul,{className:"h-4 w-4 mr-1"}),(()=>{const Ur=nt(it.comments);return Ur>0?`Comment (${Ur})`:"Comment"})()]})]}),ge.has(it.id)&&r.jsxs("div",{className:"space-y-3 mt-3",children:[it.comments.map(Ur=>r.jsx(D9e,{comment:Ur,postId:it.id,currentUserId:e==null?void 0:e.id,currentUserAvatar:a,currentUserEmail:e==null?void 0:e.email,canModerate:yt(it)},Ur.id)),e&&r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(Qs,{className:"h-8 w-8",children:[r.jsx(Si,{src:a||void 0}),r.jsx(Js,{className:"text-xs",children:Ge(((Rr=e.email)==null?void 0:Rr.split("@")[0])||"U")})]}),r.jsxs("div",{className:"flex-1 flex gap-2",children:[r.jsx(Zre,{placeholder:"Write a comment... (use @ to mention)",value:pe[it.id]||"",onChange:Ur=>se(kn=>({...kn,[it.id]:Ur})),onMentionsChange:Ur=>he(kn=>({...kn,[it.id]:Ur})),mentionFormat:"plain",onKeyDown:Ur=>{var kn;Ur.defaultPrevented||Ur.key==="Enter"&&!Ur.shiftKey&&((kn=pe[it.id])!=null&&kn.trim())&&(Ur.preventDefault(),ct.mutate({postId:it.id,content:pe[it.id]}))},className:"text-sm min-h-0 py-1.5",minHeight:"32px"}),r.jsx(ee,{size:"sm",variant:"ghost",onClick:()=>{var Ur;(Ur=pe[it.id])!=null&&Ur.trim()&&ct.mutate({postId:it.id,content:pe[it.id]})},disabled:!((Gr=pe[it.id])!=null&&Gr.trim()),className:"h-8 px-2 mt-0.5",children:r.jsx(lo,{className:"h-4 w-4"})})]})]})]})]})},it.id)}),ot&&r.jsx("div",{className:"flex justify-center pt-2",children:r.jsx(ee,{variant:"outline",onClick:()=>Mt(),disabled:Oe,children:Oe?"Loading…":"Load more posts"})})]}),r.jsx(Or,{open:!!G,onOpenChange:()=>J(null),children:r.jsxs(Ir,{children:[r.jsx($r,{children:r.jsx(Fr,{children:"Edit Post"})}),r.jsx(Jn,{value:ne,onChange:it=>oe(it.target.value),className:"min-h-[120px]"}),r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(ee,{variant:"outline",onClick:()=>J(null),children:"Cancel"}),r.jsx(ee,{onClick:()=>{G&&Ve.mutate({postId:G.id,content:ne})},disabled:!ne.trim(),children:"Save Changes"})]})]})}),r.jsx(ANt,{images:_e.images,initialIndex:_e.index,open:_e.open,onOpenChange:it=>Je(zt=>({...zt,open:it}))})]})]})})},I4={open:{label:"Open",icon:Ya,color:"bg-yellow-500"},in_progress:{label:"In Progress",icon:Ul,color:"bg-blue-500"},resolved:{label:"Resolved",icon:di,color:"bg-green-500"},closed:{label:"Closed",icon:bc,color:"bg-muted-foreground"}},$Se={general:"General Support",technology:"Technology Support",crm:"CRM Support",marketing:"Marketing Support"};function LNt(){const{user:e}=tn(),t=Hr(),[n,s]=E.useState(null),[a,o]=E.useState(""),{data:l=[],isLoading:i}=Kt({queryKey:["support-tickets"],queryFn:async()=>{const{data:y,error:_}=await Q.from("support_tickets").select("*").eq("user_id",e==null?void 0:e.id).order("created_at",{ascending:!1});if(_)throw _;return y},enabled:!!e}),{data:u=[]}=Kt({queryKey:["ticket-replies",n==null?void 0:n.id],queryFn:async()=>{if(!n)return[];const{data:y,error:_}=await Q.from("support_ticket_replies").select("*, profiles(name)").eq("ticket_id",n.id).order("created_at",{ascending:!0});if(_)throw _;return y},enabled:!!n}),p=ir({mutationFn:async y=>{if(!n||!e)throw new Error("Missing data");const{error:_}=await Q.from("support_ticket_replies").insert({ticket_id:n.id,user_id:e.id,content:y,is_admin_reply:!1});if(_)throw _},onSuccess:()=>{t.invalidateQueries({queryKey:["ticket-replies",n==null?void 0:n.id]}),o(""),Ie.success("Reply sent!")},onError:()=>{Ie.error("Failed to send reply")}}),x=()=>{a.trim()&&p.mutate(a)};if(n){const y=I4[n.status].icon;return r.jsx(Dr,{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(po,{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(Pt,{variant:"secondary",children:$Se[n.category]}),r.jsxs(Pt,{className:I4[n.status].color,children:[r.jsx(y,{className:"h-3 w-3 mr-1"}),I4[n.status].label]})]})]})]}),r.jsxs(Ze,{children:[r.jsx(Wt,{children:r.jsxs(Sn,{children:["Created on ",on(new Date(n.created_at),"MMM d, yyyy 'at' h:mm a")]})}),r.jsx(et,{children:r.jsx("p",{className:"text-muted-foreground whitespace-pre-wrap",children:n.description})})]}),r.jsxs(Ze,{children:[r.jsx(Wt,{children:r.jsx(Yt,{className:"text-lg",children:"Conversation"})}),r.jsxs(et,{children:[r.jsx(Bo,{className:"h-[300px] pr-4",children:u.length===0?r.jsx("p",{className:"text-muted-foreground text-center py-8",children:"No replies yet"}):r.jsx("div",{className:"space-y-4",children:u.map(_=>{var b;return r.jsxs("div",{className:`p-4 rounded-lg ${_.is_admin_reply?"bg-primary/10 ml-4":"bg-muted mr-4"}`,children:[r.jsxs("div",{className:"flex justify-between items-start mb-2",children:[r.jsx("span",{className:"font-medium text-sm",children:_.is_admin_reply?"Support Team":((b=_.profiles)==null?void 0:b.name)||"You"}),r.jsx("span",{className:"text-xs text-muted-foreground",children:on(new Date(_.created_at),"MMM d, h:mm a")})]}),r.jsx("p",{className:"text-sm whitespace-pre-wrap",children:_.content})]},_.id)})})}),n.status!=="closed"&&r.jsxs(r.Fragment,{children:[r.jsx(Ld,{className:"my-4"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(Jn,{placeholder:"Type your reply...",value:a,onChange:_=>o(_.target.value),className:"min-h-[80px]"}),r.jsx(ee,{onClick:x,disabled:!a.trim()||p.isPending,className:"self-end",children:r.jsx(lo,{className:"h-4 w-4"})})]})]})]})]})]})})}return r.jsx(Dr,{children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Ze,{className:"bg-gradient-to-br from-primary/10 via-primary/5 to-background border-primary/20",children:r.jsx(et,{className:"p-6 sm:p-8",children:r.jsxs("div",{className:"flex flex-col sm:flex-row items-start sm:items-center gap-6",children:[r.jsx("div",{className:"p-4 bg-primary/20 rounded-full",children:r.jsx(Hx,{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(bfe,{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(Ti,{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(bfe,{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(Ze,{className:"border-dashed",children:r.jsxs(et,{className:"text-center py-12",children:[r.jsx(Ul,{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 _=I4[y.status].icon;return r.jsx(Ze,{className:"cursor-pointer hover:bg-muted/50 transition-colors",onClick:()=>s(y),children:r.jsx(et,{className:"p-4",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("h3",{className:"font-medium truncate",children:y.subject}),r.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[r.jsx(Pt,{variant:"outline",className:"text-xs",children:$Se[y.category]}),r.jsx("span",{className:"text-xs text-muted-foreground",children:on(new Date(y.created_at),"MMM d, yyyy")})]})]}),r.jsxs(Pt,{className:I4[y.status].color,children:[r.jsx(_,{className:"h-3 w-3 mr-1"}),I4[y.status].label]})]})})},y.id)})})]})})}function ONt({open:e,onOpenChange:t}){return r.jsx(Or,{open:e,onOpenChange:t,children:r.jsxs(Ir,{className:"max-w-3xl max-h-[90vh] overflow-hidden",children:[r.jsx($r,{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(Ss,{className:"h-5 w-5 text-primary"})}),r.jsxs("div",{children:[r.jsx(Fr,{children:"Schedule Agent Onboarding"}),r.jsx(Zn,{children:"Book a one-on-one onboarding session with LevelUp"})]})]})}),e&&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 DNt({open:e,onOpenChange:t}){const{brokerageId:n}=tn(),[s,a]=E.useState(""),[o,l]=E.useState([]),[i,u]=E.useState(!1),{data:p,isLoading:x}=Kt({queryKey:["brokerage-agents-for-onboarding",n],queryFn:async()=>{if(!n)return[];const{data:k,error:M}=await Q.from("profiles").select("id, name, email").eq("brokerage_id",n).order("name",{ascending:!0});if(M)throw M;return k},enabled:e&&!!n}),y=p==null?void 0:p.filter(k=>k.name.toLowerCase().includes(s.toLowerCase())||k.email.toLowerCase().includes(s.toLowerCase())),_=k=>{l(M=>M.includes(k)?M.filter(P=>P!==k):[...M,k])},b=async()=>{if(o.length===0){Ie.error("Please select at least one agent");return}u(!0);try{const{data:k,error:M}=await Q.functions.invoke("send-onboarding-link",{body:{agentIds:o}});if(M)throw M;Ie.success(`Onboarding link sent to ${o.length} agent${o.length>1?"s":""}`),l([]),t(!1)}catch(k){console.error("Error sending onboarding link:",k),Ie.error(k.message||"Failed to send onboarding link")}finally{u(!1)}},S=k=>{k||(l([]),a("")),t(k)};return r.jsx(Or,{open:e,onOpenChange:S,children:r.jsxs(Ir,{className:"max-w-md",children:[r.jsx($r,{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(lo,{className:"h-5 w-5 text-primary"})}),r.jsxs("div",{children:[r.jsx(Fr,{children:"Send Onboarding Link"}),r.jsx(Zn,{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(Sa,{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:k=>a(k.target.value),className:"pl-10"})]}),x?r.jsx("div",{className:"flex items-center justify-center py-8",children:r.jsx(Zr,{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(Un,{className:"h-8 w-8 mx-auto mb-2 opacity-50"}),r.jsx("p",{children:"No agents found"})]}):r.jsx(Bo,{className:"h-[300px] border rounded-lg",children:r.jsx("div",{className:"p-2 space-y-1",children:y==null?void 0:y.map(k=>r.jsxs("div",{className:"flex items-center gap-3 p-2 rounded-lg hover:bg-muted cursor-pointer",onClick:()=>_(k.id),children:[r.jsx(Bl,{checked:o.includes(k.id),onCheckedChange:()=>_(k.id)}),r.jsx(Qs,{className:"h-8 w-8",children:r.jsx(Js,{className:"text-xs",children:k.name.split(" ").map(M=>M[0]).join("").toUpperCase()})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"text-sm font-medium truncate",children:k.name}),r.jsx("p",{className:"text-xs text-muted-foreground truncate",children:k.email})]})]},k.id))})}),o.length>0&&r.jsxs("p",{className:"text-sm text-muted-foreground",children:[o.length," agent",o.length>1?"s":""," selected"]})]}),r.jsxs(Bs,{children:[r.jsx(ee,{variant:"outline",onClick:()=>S(!1),children:"Cancel"}),r.jsx(ee,{onClick:b,disabled:o.length===0||i,children:i?r.jsxs(r.Fragment,{children:[r.jsx(Zr,{className:"h-4 w-4 mr-2 animate-spin"}),"Sending..."]}):r.jsxs(r.Fragment,{children:[r.jsx(lo,{className:"h-4 w-4 mr-2"}),"Send Link"]})})]})]})})}function RNt(){const[e,t]=E.useState(!1),[n,s]=E.useState(!1);return r.jsxs(r.Fragment,{children:[r.jsxs(Ze,{className:"mb-8",children:[r.jsx(Wt,{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(Un,{className:"h-6 w-6 text-primary"})}),r.jsxs("div",{children:[r.jsx(Yt,{children:"Agent Onboarding"}),r.jsx(Sn,{children:"Schedule onboarding sessions for yourself or your agents"})]})]})}),r.jsx(et,{children:r.jsxs("div",{className:"flex flex-wrap gap-4",children:[r.jsxs(ee,{onClick:()=>t(!0),className:"flex items-center gap-2",children:[r.jsx(Ss,{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(lo,{className:"h-4 w-4"}),"Send New Agent Onboarding Link"]})]})})]}),r.jsx(ONt,{open:e,onOpenChange:t}),r.jsx(DNt,{open:n,onOpenChange:s})]})}function FNt({open:e,onOpenChange:t}){return r.jsx(Or,{open:e,onOpenChange:t,children:r.jsxs(Ir,{className:"max-w-3xl max-h-[90vh] overflow-hidden",children:[r.jsx($r,{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(Dg,{className:"h-5 w-5 text-primary"})}),r.jsxs("div",{children:[r.jsx(Fr,{children:"Schedule Launch Meeting"}),r.jsx(Zn,{children:"Book a private LevelUp information session for your brokerage"})]})]})}),e&&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 zNt(){const[e,t]=E.useState(!1);return r.jsxs(r.Fragment,{children:[r.jsxs(Ze,{className:"mb-8",children:[r.jsx(Wt,{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(Dg,{className:"h-6 w-6 text-primary"})}),r.jsxs("div",{children:[r.jsx(Yt,{children:"Launch or ReLaunch Meeting"}),r.jsx(Sn,{children:"Schedule a private LevelUp information session for your brokerage. Have one of our staff host a meeting to help your team get the most out of all our trainings, tools, and resources."})]})]})}),r.jsx(et,{children:r.jsxs(ee,{onClick:()=>t(!0),className:"flex items-center gap-2",children:[r.jsx(Dg,{className:"h-4 w-4"}),"Schedule Launch Meeting"]})})]}),r.jsx(FNt,{open:e,onOpenChange:t})]})}function BNt(){const e=Gn(),[t,n]=E.useState(""),[s,a]=E.useState(null),{data:o,isLoading:l}=Kt({queryKey:["brokerage-resources-published"],queryFn:async()=>{const{data:k,error:M}=await Q.from("brokerage_resources").select("*").eq("is_published",!0).order("publish_date",{ascending:!1});if(M)throw M;return k}}),{data:i}=Kt({queryKey:["brokerage-resource-categories"],queryFn:async()=>{const{data:k,error:M}=await Q.from("brokerage_resource_categories").select("*").order("sort_order",{ascending:!0});if(M)throw M;return k}}),{data:u}=Kt({queryKey:["brokerage-resource-pdfs-all"],queryFn:async()=>{const{data:k,error:M}=await Q.from("brokerage_resource_pdfs").select("resource_id");if(M)throw M;return k}}),{data:p}=Kt({queryKey:["brokerage-resource-videos-all"],queryFn:async()=>{const{data:k,error:M}=await Q.from("brokerage_resource_videos").select("resource_id");if(M)throw M;return k}}),{data:x}=Kt({queryKey:["brokerage-resource-links-all"],queryFn:async()=>{const{data:k,error:M}=await Q.from("brokerage_resource_links").select("resource_id");if(M)throw M;return k}}),y=o==null?void 0:o.filter(k=>{var T;const M=k.title.toLowerCase().includes(t.toLowerCase())||((T=k.description)==null?void 0:T.toLowerCase().includes(t.toLowerCase())),P=!s||k.category_id===s;return M&&P}),_=i==null?void 0:i.filter(k=>o==null?void 0:o.some(M=>M.category_id===k.id)),b=k=>{const M=(u==null?void 0:u.filter(I=>I.resource_id===k).length)||0,P=(p==null?void 0:p.filter(I=>I.resource_id===k).length)||0,T=(x==null?void 0:x.filter(I=>I.resource_id===k).length)||0;return{pdfCount:M,videoCount:P,linkCount:T}},S=k=>{e(`/brokerage-resources/${k}`)};return r.jsx(Dr,{title:"Brokerage Resources",description:"Access exclusive resources for brokerage managers",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(RNt,{}),r.jsx(zNt,{}),r.jsxs("div",{className:"relative max-w-md",children:[r.jsx(Sa,{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:t,onChange:k=>n(k.target.value),className:"pl-10"})]}),_&&_.length>0&&r.jsxs("div",{className:"flex flex-wrap gap-2",children:[r.jsx(Pt,{variant:s===null?"default":"outline",className:"cursor-pointer",onClick:()=>a(null),children:"All"}),_.map(k=>r.jsx(Pt,{variant:s===k.id?"default":"outline",className:"cursor-pointer",onClick:()=>a(k.id),children:k.name},k.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((k,M)=>r.jsxs(Ze,{children:[r.jsx(Lr,{className:"h-40 w-full"}),r.jsx(Wt,{children:r.jsx(Lr,{className:"h-5 w-3/4"})}),r.jsxs(et,{children:[r.jsx(Lr,{className:"h-4 w-full mb-2"}),r.jsx(Lr,{className:"h-4 w-2/3"})]})]},M))}):(y==null?void 0:y.length)===0?r.jsxs(Ze,{className:"p-12 text-center",children:[r.jsx(Ah,{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:t||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(k=>{const{pdfCount:M,videoCount:P,linkCount:T}=b(k.id),I=i==null?void 0:i.find(z=>z.id===k.category_id);return r.jsxs(Ze,{className:"overflow-hidden cursor-pointer hover:shadow-lg transition-shadow",onClick:()=>S(k.id),children:[k.preview_image_url?r.jsx("img",{src:k.preview_image_url,alt:k.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(Ah,{className:"h-16 w-16 text-muted-foreground"})}),r.jsx(Wt,{className:"pb-2",children:r.jsxs("div",{className:"flex items-start justify-between gap-2",children:[r.jsx(Yt,{className:"text-lg line-clamp-1",children:k.title}),I&&r.jsx(Pt,{variant:"secondary",className:"shrink-0 text-xs",children:I.name})]})}),r.jsxs(et,{children:[k.description&&r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 mb-3",children:k.description}),r.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[M>0&&r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Ea,{className:"h-4 w-4"}),M]}),P>0&&r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx($a,{className:"h-4 w-4"}),P]}),T>0&&r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Io,{className:"h-4 w-4"}),T]})]})]})]},k.id)})})]})})}const $Nt=()=>{const{resourceId:e}=md(),{data:t,isLoading:n}=Kt({queryKey:["brokerage-resource-detail",e],queryFn:async()=>{const{data:a,error:o}=await Q.from("brokerage_resources").select("*").eq("id",e).eq("is_published",!0).single();if(o)throw o;const{data:l}=await Q.from("brokerage_resource_pdfs").select("*").eq("resource_id",e).order("sort_order"),{data:i}=await Q.from("brokerage_resource_videos").select("*").eq("resource_id",e).order("sort_order"),{data:u}=await Q.from("brokerage_resource_links").select("*").eq("resource_id",e).order("sort_order");return{...a,pdfs:l||[],videos:i||[],links:u||[]}},enabled:!!e}),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(Dr,{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"})})}):t?r.jsx(Dr,{title:t.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(oo,{to:"/brokerage-resources",children:[r.jsx(po,{className:"h-4 w-4"}),"Back to Resources"]})}),t.preview_image_url&&r.jsx("div",{className:"relative w-full rounded-lg overflow-hidden bg-muted",children:r.jsx("img",{src:t.preview_image_url,alt:t.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:t.title}),t.description&&r.jsx("div",{className:"text-muted-foreground prose prose-sm max-w-none dark:prose-invert",dangerouslySetInnerHTML:{__html:t.description}})]}),t.videos&&t.videos.length>0&&r.jsx(Ze,{children:r.jsxs(et,{className:"pt-6",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 mb-4",children:[r.jsx($a,{className:"h-4 w-4"}),"Videos (",t.videos.length,")"]}),r.jsx("div",{className:"space-y-4",children:t.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))})]})}),t.pdfs&&t.pdfs.length>0&&r.jsx(Ze,{children:r.jsxs(et,{className:"pt-6",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 mb-4",children:[r.jsx(Ea,{className:"h-4 w-4"}),"Documents (",t.pdfs.length,")"]}),r.jsx("div",{className:"grid gap-2",children:t.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(Ea,{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(io,{className:"h-4 w-4 text-muted-foreground group-hover:text-primary transition-colors"})]},a.id))})]})}),t.links&&t.links.length>0&&r.jsx(Ze,{children:r.jsxs(et,{className:"pt-6",children:[r.jsxs("h3",{className:"font-semibold flex items-center gap-2 mb-4",children:[r.jsx(As,{className:"h-4 w-4"}),"Canva Templates (",t.links.length,")"]}),r.jsx("div",{className:"grid gap-2",children:t.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(As,{className:"h-4 w-4 text-primary"})}),r.jsx("div",{className:"font-medium text-sm",children:a.title})]}),r.jsx(As,{className:"h-4 w-4 text-muted-foreground group-hover:text-primary transition-colors"})]},a.id))})]})})]})}):r.jsx(Dr,{title:"Brokerage Resources",children:r.jsxs("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[r.jsx(Ah,{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(oo,{to:"/brokerage-resources",children:"Back to Resources"})})]})})};function UNt(){const{onlineUsers:e,totalOnline:t}=cRe();return r.jsxs(Ze,{children:[r.jsx(Wt,{className:"pb-3",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs(Yt,{className:"text-base flex items-center gap-2",children:[r.jsx(Un,{className:"h-4 w-4"}),"Online Now"]}),r.jsxs(Pt,{variant:"secondary",className:"bg-green-100 text-green-700",children:[r.jsx(Qu,{className:"h-2 w-2 fill-green-500 text-green-500 mr-1"}),t," online"]})]})}),r.jsx(et,{children:e.length===0?r.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:"No other users online right now"}):r.jsx(Bo,{className:"h-[300px] pr-4",children:r.jsx("div",{className:"space-y-3",children:e.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(Qs,{className:"h-9 w-9",children:[r.jsx(Si,{src:n.avatarUrl,alt:n.name}),r.jsx(Js,{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 ",bu(new Date(n.onlineSince),{addSuffix:!1})]})]})]},n.id)})})})})]})}const USe={users:{label:"Users & Access",sections:[{title:"Members",description:"Manage users, roles, and brokerage assignments",icon:Un,path:"/admin/members",color:"bg-blue-500/10 text-blue-600"},{title:"Invite Codes",description:"Create and manage signup invite codes",icon:NA,path:"/admin/invite-codes",color:"bg-amber-500/10 text-amber-600"},{title:"Subscriptions",description:"Track and manage user subscriptions",icon:Mm,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:zg,path:"/admin/discounts",color:"bg-red-500/10 text-red-600"},{title:"Referral Program",description:"Track brokerage referrals and discounts",icon:Nc,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:Uc,path:"/admin/templates",color:"bg-pink-500/10 text-pink-600"},{title:"Manage Academy",description:"Upload videos and training content",icon:H1,path:"/admin/academy",color:"bg-indigo-500/10 text-indigo-600"},{title:"Manage Toolbox",description:"Create and manage resource kits",icon:gy,path:"/admin/toolbox",color:"bg-orange-500/10 text-orange-600"},{title:"Social Swag",description:"Manage social media content and links",icon:Ls,path:"/admin/social-swag",color:"bg-fuchsia-500/10 text-fuchsia-600"},{title:"Social Swag 2.0",description:"New monthly social media images",icon:Ls,path:"/admin/social-swag-2",color:"bg-cyan-500/10 text-cyan-600"},{title:"Newsletters",description:"Manage monthly newsletter templates",icon:fy,path:"/admin/newsletters",color:"bg-violet-500/10 text-violet-600"},{title:"Manage Events",description:"Create and publish events with Zoom integration",icon:Cm,path:"/admin/events",color:"bg-green-500/10 text-green-600"},{title:"Additional Services",description:"Manage additional service offerings",icon:Ah,path:"/admin/additional-services",color:"bg-lime-500/10 text-lime-600"},{title:"Brokerage Resources",description:"Manage resources for brokerage managers",icon:Ah,path:"/admin/brokerage-resources",color:"bg-slate-500/10 text-slate-600"},{title:"Agent Email Templates",description:"Manage curated email templates for agents",icon:Ns,path:"/admin/agent-email-templates",color:"bg-rose-500/10 text-rose-600"}]},platform:{label:"Platform",sections:[{title:"Dashboard Management",description:"Configure banners and dashboard modules",icon:Oj,path:"/admin/dashboard-management",color:"bg-teal-500/10 text-teal-600"},{title:"Manage Apps",description:"Configure app tiles and access requirements",icon:Qh,path:"/admin/apps",color:"bg-purple-500/10 text-purple-600"},{title:"Email Templates",description:"Customize system email templates",icon:Ns,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:Am,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:rA,path:"/admin/onboarding-checklist",color:"bg-emerald-500/10 text-emerald-600"},{title:"Marketplace",description:"Manage store categories, products, and orders",icon:Rg,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:to,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:ro,path:"/admin/agent-points",color:"bg-amber-500/10 text-amber-600"},{title:"Integrations",description:"Connect Canva, Facebook & Instagram for platform-level features",icon:mf,path:"/admin/integrations",color:"bg-blue-500/10 text-blue-600"},{title:"Agent Cards",description:"Manage digital business cards for agents",icon:Un,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:Am,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:zo,path:"/admin/community",color:"bg-cyan-500/10 text-cyan-600"},{title:"Support Tickets",description:"View and respond to agent support requests",icon:CS,path:"/admin/support-tickets",color:"bg-rose-500/10 text-rose-600"},{title:"Wishlist",description:"Review and manage community feature requests",icon:W1,path:"/admin/wishlist",color:"bg-yellow-500/10 text-yellow-600"},{title:"Membership Reviews",description:"View member feedback and ratings",icon:js,path:"/admin/membership-reviews",color:"bg-amber-500/10 text-amber-600"},{title:"Weekly Digest",description:"Configure automated weekly email digests",icon:Ns,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:_c,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:xi,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:xa,path:"/admin/listing-exchange",color:"bg-gradient-to-br from-blue-500/20 to-sky-500/10 text-blue-600"}]}};function qNt(){const e=Gn();return r.jsx(Dr,{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(UNt,{})})]}),r.jsxs(Ai,{defaultValue:"users",className:"w-full",children:[r.jsx(vi,{className:"w-full justify-start flex-wrap h-auto gap-1 bg-muted/50 p-1",children:Object.entries(USe).map(([t,n])=>r.jsx(sn,{value:t,className:"data-[state=active]:bg-background",children:n.label},t))}),Object.entries(USe).map(([t,n])=>r.jsx(Mn,{value:t,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(Ze,{className:"cursor-pointer hover:shadow-md transition-all hover:border-primary/50 group",onClick:()=>e(s.path),children:[r.jsxs(Wt,{className:"pb-3",children:[r.jsx("div",{className:`w-10 h-10 rounded-lg flex items-center justify-center ${s.color} mb-2 group-hover:scale-110 transition-transform`,children:r.jsx(s.icon,{className:"h-5 w-5"})}),r.jsx(Yt,{className:"text-base",children:s.title})]}),r.jsx(et,{className:"pt-0",children:r.jsx(Sn,{className:"text-sm",children:s.description})})]},s.path))})},t))]})]})})}const Ks=E.forwardRef(({className:e,...t},n)=>r.jsx("div",{className:"relative w-full overflow-auto",children:r.jsx("table",{ref:n,className:Bt("w-full caption-bottom text-sm",e),...t})}));Ks.displayName="Table";const Zs=E.forwardRef(({className:e,...t},n)=>r.jsx("thead",{ref:n,className:Bt("[&_tr]:border-b",e),...t}));Zs.displayName="TableHeader";const Ys=E.forwardRef(({className:e,...t},n)=>r.jsx("tbody",{ref:n,className:Bt("[&_tr:last-child]:border-0",e),...t}));Ys.displayName="TableBody";const VNt=E.forwardRef(({className:e,...t},n)=>r.jsx("tfoot",{ref:n,className:Bt("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0",e),...t}));VNt.displayName="TableFooter";const Mr=E.forwardRef(({className:e,...t},n)=>r.jsx("tr",{ref:n,className:Bt("border-b transition-colors data-[state=selected]:bg-muted hover:bg-muted/50",e),...t}));Mr.displayName="TableRow";const It=E.forwardRef(({className:e,...t},n)=>r.jsx("th",{ref:n,className:Bt("h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0",e),...t}));It.displayName="TableHead";const kt=E.forwardRef(({className:e,...t},n)=>r.jsx("td",{ref:n,className:Bt("p-4 align-middle [&:has([role=checkbox])]:pr-0",e),...t}));kt.displayName="TableCell";const HNt=E.forwardRef(({className:e,...t},n)=>r.jsx("caption",{ref:n,className:Bt("mt-4 text-sm text-muted-foreground",e),...t}));HNt.displayName="TableCaption";const WNt=()=>{const{isAdmin:e}=tn(),t=Gn(),[n,s]=E.useState([]),[a,o]=E.useState(!0),[l,i]=E.useState(!1),[u,p]=E.useState(null);E.useEffect(()=>{if(!e){t("/dashboard");return}x()},[e]);const x=async()=>{try{const{data:k,error:M}=await Q.from("app_tiles").select("*").order("name");if(M)throw M;s(k||[])}catch(k){console.error("Error loading apps:",k),Ie.error("Failed to load apps")}finally{o(!1)}},y=async k=>{k.preventDefault();const M=new FormData(k.currentTarget),P={name:M.get("name"),description:M.get("description"),icon:M.get("icon"),app_id:M.get("app_id"),target_url:M.get("target_url"),required_tags:M.get("required_tags").split(",").map(T=>T.trim()).filter(Boolean)};try{if(u){const{error:T}=await Q.from("app_tiles").update(P).eq("id",u.id);if(T)throw T;Ie.success("App updated successfully")}else{const{error:T}=await Q.from("app_tiles").insert([P]);if(T)throw T;Ie.success("App created successfully")}i(!1),p(null),x()}catch(T){console.error("Error saving app:",T),Ie.error("Failed to save app")}},_=async k=>{if(confirm("Are you sure you want to delete this app?"))try{const{error:M}=await Q.from("app_tiles").delete().eq("id",k);if(M)throw M;Ie.success("App deleted successfully"),x()}catch(M){console.error("Error deleting app:",M),Ie.error("Failed to delete app")}},b=k=>{p(k),i(!0)},S=()=>{p(null),i(!0)};return a?r.jsx("div",{className:"flex items-center justify-center min-h-screen",children:"Loading..."}):r.jsxs("div",{className:"min-h-screen bg-background",children:[r.jsx("header",{className:"border-b bg-card",children:r.jsx("div",{className:"container mx-auto px-4 py-4",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsxs(ee,{variant:"ghost",size:"sm",onClick:()=>t("/dashboard"),children:[r.jsx(po,{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(Or,{open:l,onOpenChange:i,children:[r.jsx(Zo,{asChild:!0,children:r.jsxs(ee,{onClick:S,children:[r.jsx(bn,{className:"mr-2 h-4 w-4"}),"Add App"]})}),r.jsxs(Ir,{className:"max-w-2xl",children:[r.jsxs($r,{children:[r.jsx(Fr,{children:u?"Edit App":"Create New App"}),r.jsx(Zn,{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($e,{htmlFor:"name",children:"App Name"}),r.jsx(dt,{id:"name",name:"name",defaultValue:u==null?void 0:u.name,required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{htmlFor:"app_id",children:"App ID"}),r.jsx(dt,{id:"app_id",name:"app_id",defaultValue:u==null?void 0:u.app_id,placeholder:"agent_connect",required:!0})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{htmlFor:"description",children:"Description"}),r.jsx(Jn,{id:"description",name:"description",defaultValue:u==null?void 0:u.description})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{htmlFor:"icon",children:"Icon (emoji)"}),r.jsx(dt,{id:"icon",name:"icon",defaultValue:u==null?void 0:u.icon,placeholder:"🚀",required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{htmlFor:"target_url",children:"Target URL"}),r.jsx(dt,{id:"target_url",name:"target_url",type:"url",defaultValue:u==null?void 0:u.target_url,required:!0})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{htmlFor:"required_tags",children:"Required Tags (comma-separated)"}),r.jsx(dt,{id:"required_tags",name:"required_tags",defaultValue:u==null?void 0:u.required_tags.join(", "),placeholder:"levelup-member, agent-connect"})]}),r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(ee,{type:"button",variant:"outline",onClick:()=>i(!1),children:"Cancel"}),r.jsx(ee,{type:"submit",children:u?"Update":"Create"})]})]})]})]})]})})}),r.jsx("div",{className:"container mx-auto px-4 py-8",children:r.jsxs(Ze,{children:[r.jsxs(Wt,{children:[r.jsx(Yt,{children:"Application Tiles"}),r.jsx(Sn,{children:"Manage the apps that appear on the member dashboard"})]}),r.jsx(et,{children:n.length===0?r.jsxs("div",{className:"text-center py-12",children:[r.jsx("p",{className:"text-muted-foreground mb-4",children:"No apps configured yet"}),r.jsxs(ee,{onClick:S,children:[r.jsx(bn,{className:"mr-2 h-4 w-4"}),"Create First App"]})]}):r.jsxs(Ks,{children:[r.jsx(Zs,{children:r.jsxs(Mr,{children:[r.jsx(It,{children:"Icon"}),r.jsx(It,{children:"Name"}),r.jsx(It,{children:"App ID"}),r.jsx(It,{children:"Target URL"}),r.jsx(It,{children:"Tags"}),r.jsx(It,{className:"text-right",children:"Actions"})]})}),r.jsx(Ys,{children:n.map(k=>r.jsxs(Mr,{children:[r.jsx(kt,{className:"text-2xl",children:k.icon}),r.jsx(kt,{className:"font-medium",children:k.name}),r.jsx(kt,{className:"font-mono text-sm",children:k.app_id}),r.jsx(kt,{className:"text-sm text-muted-foreground max-w-xs truncate",children:k.target_url}),r.jsx(kt,{children:r.jsx("div",{className:"flex flex-wrap gap-1",children:k.required_tags.map(M=>r.jsx("span",{className:"text-xs bg-secondary text-secondary-foreground px-2 py-1 rounded",children:M},M))})}),r.jsx(kt,{className:"text-right",children:r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(ee,{size:"sm",variant:"ghost",onClick:()=>b(k),children:r.jsx(ni,{className:"h-4 w-4"})}),r.jsx(ee,{size:"sm",variant:"ghost",onClick:()=>_(k.id),children:r.jsx(Bn,{className:"h-4 w-4"})})]})})]},k.id))})]})})]})})]})};function Mu({title:e,description:t,children:n}){return r.jsxs("div",{className:"space-y-4",children:[r.jsx(oo,{to:"/admin",children:r.jsxs(ee,{variant:"ghost",size:"sm",className:"gap-2 text-muted-foreground hover:text-foreground",children:[r.jsx(po,{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:e}),t&&r.jsx("p",{className:"text-muted-foreground",children:t})]}),n]})]})}const qSe=({expiresAt:e,className:t})=>{const n=new Date().getTime(),s=new Date(e).getTime(),a=Math.ceil((s-n)/(1e3*60*60*24));return a<=0?r.jsxs(Pt,{variant:"destructive",className:Bt("gap-1",t),children:[r.jsx(rf,{className:"h-3 w-3"}),"Trial Expired"]}):a<=1?r.jsxs(Pt,{variant:"destructive",className:Bt("gap-1",t),children:[r.jsx(Ya,{className:"h-3 w-3"}),"Trial: <1 day left"]}):a<=3?r.jsxs(Pt,{className:Bt("gap-1 bg-amber-500 hover:bg-amber-600",t),children:[r.jsx(Ya,{className:"h-3 w-3"}),"Trial: ",a," days left"]}):r.jsxs(Pt,{variant:"secondary",className:Bt("gap-1",t),children:[r.jsx(Ya,{className:"h-3 w-3"}),"Trial: ",a," days left"]})},R9e=({open:e,onOpenChange:t,brokerages:n,fixedBrokerageId:s,onSuccess:a})=>{const{toast:o}=_i(),l=E.useRef(null),[i,u]=E.useState([]),[p,x]=E.useState(""),[y,_]=E.useState(!1),[b,S]=E.useState("upload"),[k,M]=E.useState(null),P=()=>{u([]),x(""),S("upload"),M(null),l.current&&(l.current.value="")},T=()=>{P(),t(!1)},I=W=>{const G=W.split(` `).map(ie=>ie.trim()).filter(ie=>ie);if(G.length===0)return[];const J=G[0].toLowerCase(),oe=J.includes("first")||J.includes("last")||J.includes("email")||J.includes("name")||J.includes("phone")||J.includes("sms")||J.includes("consent")?G.slice(1):G,ge=[];for(const ie of oe){const se=(ie.includes(" ")?ie.split(" "):ie.split(",")).map(fe=>fe.trim().replace(/^["']|["']$/g,""));if(se.length>=2){let fe="",he="",ye="",Ae="",we;if(se.length===2){const Je=se[0].split(" ");fe=Je[0]||"",he=Je.slice(1).join(" ")||"",ye=se[1]}else if(se.length===3)fe=se[0],he=se[1],ye=se[2];else if(se.length===4)fe=se[0],he=se[1],ye=se[2],Ae=se[3];else if(se.length>=5){fe=se[0],he=se[1],ye=se[2],Ae=se[3];const Je=se[4].toLowerCase();we=Je==="true"||Je==="yes"||Je==="1"||Je==="y"}const _e=/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(ye);ge.push({firstName:fe.trim(),lastName:he.trim(),email:ye.trim().toLowerCase(),phone:Ae.trim()||void 0,smsConsent:we,isValid:_e&&fe.trim().length>0,error:_e?fe.trim()?void 0:"Missing name":"Invalid email"})}}return ge},z=W=>{var ne;const G=(ne=W.target.files)==null?void 0:ne[0];if(!G)return;const J=new FileReader;J.onload=oe=>{var pe;const ge=(pe=oe.target)==null?void 0:pe.result,ie=I(ge);if(ie.length===0){o({title:"No data found",description:"The CSV file appears to be empty or in an unsupported format.",variant:"destructive"});return}u(ie),S("preview")},J.readAsText(G)},D=async()=>{const W=i.filter(J=>J.isValid);if(W.length===0){o({title:"No valid users",description:"There are no valid users to import.",variant:"destructive"});return}const G=s||p||null;_(!0);try{const{data:{session:J}}=await Q.auth.getSession(),ne=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/bulk-create-users",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${J==null?void 0:J.access_token}`},body:JSON.stringify({users:W.map(ge=>({firstName:ge.firstName,lastName:ge.lastName,email:ge.email,phone:ge.phone,smsConsent:ge.smsConsent})),brokerageId:G})}),oe=await ne.json();if(!ne.ok)throw new Error(oe.error||"Failed to import users");M(oe),S("result"),oe.created>0&&a(),o({title:"Import Complete",description:`${oe.created} user(s) created successfully.${oe.failed>0?` ${oe.failed} failed.`:""}`})}catch(J){console.error("Import error:",J),o({title:"Import Failed",description:J.message||"Failed to import users",variant:"destructive"})}finally{_(!1)}},U=i.filter(W=>W.isValid).length,V=i.filter(W=>!W.isValid).length;return r.jsx(Or,{open:e,onOpenChange:T,children:r.jsxs(Ir,{className:"max-w-2xl max-h-[85vh] overflow-hidden flex flex-col",children:[r.jsxs($r,{children:[r.jsxs(Fr,{className:"flex items-center gap-2",children:[r.jsx(q1,{className:"h-5 w-5"}),"Import Agents from CSV"]}),r.jsx(Zn,{children:"Upload a CSV file with agent information. Each row should contain First Name, Last Name, and Email."})]}),b==="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(_o,{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 W;return(W=l.current)==null?void 0:W.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."})]})]}),b==="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($e,{children:"Assign to Brokerage (optional)"}),r.jsxs(mn,{value:p||"none",onValueChange:W=>x(W==="none"?"":W),children:[r.jsx(fn,{children:r.jsx(yn,{placeholder:"Select a brokerage..."})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"none",children:"No brokerage"}),n.map(W=>r.jsx(qt,{value:W.id,children:W.name},W.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(so,{className:"h-4 w-4 text-green-500"}),r.jsxs("span",{children:[U," valid"]})]}),V>0&&r.jsxs("div",{className:"flex items-center gap-2 text-destructive",children:[r.jsx(yl,{className:"h-4 w-4"}),r.jsxs("span",{children:[V," invalid"]})]})]}),r.jsxs("div",{className:"flex-1 overflow-auto border rounded-lg",children:[r.jsxs(Ks,{children:[r.jsx(Zs,{children:r.jsxs(Mr,{className:"bg-muted/30",children:[r.jsx(It,{children:"First Name"}),r.jsx(It,{children:"Last Name"}),r.jsx(It,{children:"Email"}),r.jsx(It,{children:"Phone"}),r.jsx(It,{children:"SMS"}),r.jsx(It,{children:"Status"})]})}),r.jsx(Ys,{children:i.slice(0,100).map((W,G)=>r.jsxs(Mr,{children:[r.jsx(kt,{children:W.firstName}),r.jsx(kt,{children:W.lastName}),r.jsx(kt,{children:W.email}),r.jsx(kt,{className:"text-muted-foreground",children:W.phone||"-"}),r.jsx(kt,{className:"text-muted-foreground",children:W.smsConsent===!0?"✓":W.smsConsent===!1?"✗":"-"}),r.jsx(kt,{children:W.isValid?r.jsx(Pt,{variant:"default",className:"bg-green-500/10 text-green-600",children:"Valid"}):r.jsx(Pt,{variant:"destructive",children:W.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"]})]})]}),b==="result"&&k&&r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{className:"text-center",children:[r.jsx(so,{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:[k.created," agent(s) created and invited"]}),k.failed>0&&r.jsxs("p",{className:"text-destructive mt-1",children:[k.failed," failed to create"]})]}),k.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:[k.errors.slice(0,10).map((W,G)=>r.jsxs("li",{children:["• ",W]},G)),k.errors.length>10&&r.jsxs("li",{children:["...and ",k.errors.length-10," more"]})]})]})]}),r.jsxs(Bs,{children:[b==="upload"&&r.jsx(ee,{variant:"outline",onClick:T,children:"Cancel"}),b==="preview"&&r.jsxs(r.Fragment,{children:[r.jsx(ee,{variant:"outline",onClick:P,children:"Back"}),r.jsx(ee,{onClick:D,disabled:y||U===0,children:y?r.jsxs(r.Fragment,{children:[r.jsx(Zr,{className:"mr-2 h-4 w-4 animate-spin"}),"Importing..."]}):`Import ${U} Agent${U!==1?"s":""}`})]}),b==="result"&&r.jsx(ee,{onClick:T,children:"Done"})]})]})})},GNt=[{type:"custom",title:"Great job!",message:"Keep up the amazing work!",icon:js},{type:"custom",title:"You're on fire!",message:"Your dedication is inspiring!",icon:ro},{type:"custom",title:"Congratulations!",message:"You earned this celebration!",icon:qc}];function F9e({open:e,onOpenChange:t,userId:n,userName:s}){const[a,o]=E.useState("custom"),[l,i]=E.useState(""),[u,p]=E.useState(""),x=_lt(),y=b=>{o(b.type),i(b.title),p(b.message)},_=async b=>{if(b.preventDefault(),!l.trim()){ka({title:"Title required",description:"Please enter a celebration title",variant:"destructive"});return}try{await x.mutateAsync({user_id:n,celebration_type:a,title:l.trim(),message:u.trim()||void 0}),ka({title:"Celebration sent! 🎉",description:`${s} will see confetti on their next visit!`}),t(!1),i(""),p(""),o("custom")}catch{ka({title:"Error",description:"Failed to send celebration",variant:"destructive"})}};return r.jsx(Or,{open:e,onOpenChange:t,children:r.jsxs(Ir,{className:"sm:max-w-md",children:[r.jsxs($r,{children:[r.jsxs(Fr,{className:"flex items-center gap-2",children:[r.jsx(qc,{className:"h-5 w-5 text-primary"}),"Send Celebration to ",s]}),r.jsx(Zn,{children:"They'll see confetti and this message next time they log in!"})]}),r.jsxs("div",{className:"mb-4",children:[r.jsx($e,{className:"text-sm text-muted-foreground mb-2 block",children:"Quick presets:"}),r.jsx("div",{className:"flex gap-2 flex-wrap",children:GNt.map((b,S)=>r.jsxs(ee,{variant:"outline",size:"sm",onClick:()=>y(b),className:"text-xs",children:[r.jsx(b.icon,{className:"h-3 w-3 mr-1"}),b.title]},S))})]}),r.jsxs("form",{onSubmit:_,className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx($e,{htmlFor:"type",children:"Celebration Type"}),r.jsxs(mn,{value:a,onValueChange:b=>o(b),children:[r.jsx(fn,{children:r.jsx(yn,{})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"custom",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(js,{className:"h-4 w-4"})," Custom"]})}),r.jsx(qt,{value:"points_earned",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(ro,{className:"h-4 w-4"})," Points Earned"]})}),r.jsx(qt,{value:"listing_created",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(xa,{className:"h-4 w-4"})," Listing Created"]})}),r.jsx(qt,{value:"deal_closed",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Rd,{className:"h-4 w-4"})," Deal Closed"]})})]})]})]}),r.jsxs("div",{children:[r.jsx($e,{htmlFor:"title",children:"Title *"}),r.jsx(dt,{id:"title",value:l,onChange:b=>i(b.target.value),placeholder:"e.g., Congratulations!",maxLength:100})]}),r.jsxs("div",{children:[r.jsx($e,{htmlFor:"message",children:"Message (optional)"}),r.jsx(Jn,{id:"message",value:u,onChange:b=>p(b.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:()=>t(!1),children:"Cancel"}),r.jsxs(ee,{type:"submit",disabled:x.isPending,children:[r.jsx(qc,{className:"h-4 w-4 mr-2"}),x.isPending?"Sending...":"Send Celebration"]})]})]})]})})}const Ade={points_earned:{label:"Points Earned",icon:ro,color:"bg-yellow-500"},listing_created:{label:"Listing Created",icon:xa,color:"bg-blue-500"},deal_closed:{label:"Deal Closed",icon:Rd,color:"bg-green-500"},custom:{label:"Custom",icon:Ls,color:"bg-purple-500"}};function KNt(){const[e,t]=E.useState(""),[n,s]=E.useState("all"),[a,o]=E.useState("all"),{data:l=[],isLoading:i}=Kt({queryKey:["admin-celebrations"],queryFn:async()=>{const{data:x,error:y}=await Q.from("celebration_queue").select("*").order("created_at",{ascending:!1}).limit(500);if(y)throw y;const _=[...new Set([...x.map(k=>k.user_id),...x.map(k=>k.created_by).filter(Boolean)])],{data:b}=await Q.from("profiles").select("id, name, email").in("id",_),S=new Map((b==null?void 0:b.map(k=>[k.id,k]))||[]);return x.map(k=>{var M,P,T;return{...k,user_name:((M=S.get(k.user_id))==null?void 0:M.name)||"Unknown",user_email:((P=S.get(k.user_id))==null?void 0:P.email)||"",creator_name:k.created_by?((T=S.get(k.created_by))==null?void 0:T.name)||"System":"Auto-triggered"}})}}),u=l.filter(x=>{var S,k;const y=((S=x.user_name)==null?void 0:S.toLowerCase().includes(e.toLowerCase()))||((k=x.user_email)==null?void 0:k.toLowerCase().includes(e.toLowerCase()))||x.title.toLowerCase().includes(e.toLowerCase()),_=n==="all"||x.celebration_type===n,b=a==="all"||a==="seen"&&x.seen_at||a==="unseen"&&!x.seen_at;return y&&_&&b}),p={total:l.length,seen:l.filter(x=>x.seen_at).length,unseen:l.filter(x=>!x.seen_at).length,byType:Object.keys(Ade).reduce((x,y)=>(x[y]=l.filter(_=>_.celebration_type===y).length,x),{})};return i?r.jsx("div",{className:"flex items-center justify-center py-12",children:r.jsx(Zr,{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(Ze,{children:[r.jsx(Wt,{className:"pb-2",children:r.jsx(Yt,{className:"text-sm font-medium",children:"Total Celebrations"})}),r.jsx(et,{children:r.jsx("div",{className:"text-2xl font-bold",children:p.total})})]}),r.jsxs(Ze,{children:[r.jsx(Wt,{className:"pb-2",children:r.jsx(Yt,{className:"text-sm font-medium text-green-600",children:"Seen"})}),r.jsx(et,{children:r.jsx("div",{className:"text-2xl font-bold text-green-600",children:p.seen})})]}),r.jsxs(Ze,{children:[r.jsx(Wt,{className:"pb-2",children:r.jsx(Yt,{className:"text-sm font-medium text-orange-600",children:"Pending"})}),r.jsx(et,{children:r.jsx("div",{className:"text-2xl font-bold text-orange-600",children:p.unseen})})]}),r.jsxs(Ze,{children:[r.jsx(Wt,{className:"pb-2",children:r.jsx(Yt,{className:"text-sm font-medium text-purple-600",children:"Custom Sent"})}),r.jsx(et,{children:r.jsx("div",{className:"text-2xl font-bold text-purple-600",children:p.byType.custom||0})})]})]}),r.jsxs(Ze,{children:[r.jsxs(Wt,{children:[r.jsxs(Yt,{className:"flex items-center gap-2",children:[r.jsx(qc,{className:"h-5 w-5"}),"Celebration History"]}),r.jsx(Sn,{children:"View all celebrations awarded to agents"})]}),r.jsxs(et,{className:"space-y-4",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[r.jsxs("div",{className:"relative flex-1",children:[r.jsx(Sa,{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:e,onChange:x=>t(x.target.value),className:"pl-9"})]}),r.jsxs(mn,{value:n,onValueChange:s,children:[r.jsx(fn,{className:"w-[180px]",children:r.jsx(yn,{placeholder:"Filter by type"})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"all",children:"All Types"}),Object.entries(Ade).map(([x,y])=>r.jsx(qt,{value:x,children:y.label},x))]})]}),r.jsxs(mn,{value:a,onValueChange:o,children:[r.jsx(fn,{className:"w-[140px]",children:r.jsx(yn,{placeholder:"Status"})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"all",children:"All Status"}),r.jsx(qt,{value:"seen",children:"Seen"}),r.jsx(qt,{value:"unseen",children:"Pending"})]})]})]}),r.jsx("div",{className:"rounded-md border",children:r.jsxs(Ks,{children:[r.jsx(Zs,{children:r.jsxs(Mr,{children:[r.jsx(It,{children:"Type"}),r.jsx(It,{children:"Agent"}),r.jsx(It,{children:"Title"}),r.jsx(It,{children:"Points"}),r.jsx(It,{children:"Created By"}),r.jsx(It,{children:"Created"}),r.jsx(It,{children:"Status"})]})}),r.jsx(Ys,{children:u.length===0?r.jsx(Mr,{children:r.jsx(kt,{colSpan:7,className:"text-center py-8 text-muted-foreground",children:"No celebrations found"})}):u.map(x=>{const y=Ade[x.celebration_type],_=y.icon;return r.jsxs(Mr,{children:[r.jsx(kt,{children:r.jsxs(Pt,{variant:"outline",className:"gap-1",children:[r.jsx(_,{className:"h-3 w-3"}),y.label]})}),r.jsx(kt,{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(kt,{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(kt,{children:x.points_amount?r.jsxs(Pt,{variant:"secondary",children:["+",x.points_amount]}):r.jsx("span",{className:"text-muted-foreground",children:"-"})}),r.jsx(kt,{children:r.jsx("span",{className:"text-sm text-muted-foreground",children:x.creator_name})}),r.jsx(kt,{children:r.jsx("span",{className:"text-sm text-muted-foreground",children:on(new Date(x.created_at),"MMM d, yyyy h:mm a")})}),r.jsx(kt,{children:x.seen_at?r.jsx(Pt,{variant:"outline",className:"bg-green-50 text-green-700 border-green-200",children:"Seen"}):r.jsx(Pt,{variant:"outline",className:"bg-orange-50 text-orange-700 border-orange-200",children:"Pending"})})]},x.id)})})]})}),u.length>0&&r.jsxs("p",{className:"text-sm text-muted-foreground text-right",children:["Showing ",u.length," of ",l.length," celebrations"]})]})]})]})}const ZNt=()=>{const e=Gn(),{user:t,isAdmin:n}=tn(),{startImpersonation:s,isLoading:a}=Pxe(),{toast:o}=_i(),[l,i]=E.useState([]),[u,p]=E.useState([]),[x,y]=E.useState([]),[_,b]=E.useState({}),[S,k]=E.useState(!0),[M,P]=E.useState({}),[T,I]=E.useState(!1),[z,D]=E.useState({email:"",name:"",password:"",brokerage_id:"",role:"user",phone:"",trial_days:""}),[U,V]=E.useState(!1),[W,G]=E.useState(""),[J,ne]=E.useState(1),[oe,ge]=E.useState(50),[ie,pe]=E.useState("all"),[se,fe]=E.useState("all"),[he,ye]=E.useState("all"),[Ae,we]=E.useState("all"),[be,_e]=E.useState(!1),[Je,Te]=E.useState(!1),[De,Ue]=E.useState(null),[Be,qe]=E.useState(null),[ot,Mt]=E.useState(!1),[Oe,at]=E.useState({name:"",email:"",brokerage_id:"",phone:""}),[le,Ve]=E.useState(null),[Qe,st]=E.useState(!1),[ke,ct]=E.useState(""),[Ce,Me]=E.useState(!1),[Ge,Ee]=E.useState(!1),[He,nt]=E.useState(null),[yt,it]=E.useState(""),[zt,dr]=E.useState(!1),[Rr,Gr]=E.useState(!1),[Ur,kn]=E.useState(null),[_s,ur]=E.useState(!1),[Rn,ea]=E.useState(!1),[ca,Ei]=E.useState(null),[Ii,$o]=E.useState(""),[Va,cs]=E.useState(!1),[ta,ds]=E.useState({email:"",name:"",password:"",phone:""}),[Hs,Os]=E.useState(!1),[bi,sr]=E.useState(!1),[Ia,no]=E.useState(""),[yi,qn]=E.useState(!1),[Gi,dc]=E.useState(!1),[go,uc]=E.useState(""),[tt,xe]=E.useState(new Set),[Pe,Ye]=E.useState(!1),[Nt,_t]=E.useState(!1),[At,$t]=E.useState(null),[Lt,Vt]=E.useState(!1),[pr,or]=E.useState(null),[Yr,jn]=E.useState([]),[Wr,as]=E.useState([]),[is,es]=E.useState(!1),[$s,$i]=E.useState({});E.useEffect(()=>{!t||!n||(va(),No())},[t,n]);const wo=async()=>{try{const{data:jt,error:mr}=await Q.from("brokerage_manager_assignments").select("user_id, brokerage_id");if(mr)throw mr;const Er={};for(const rs of jt??[])Er[rs.brokerage_id]||(Er[rs.brokerage_id]=[]),Er[rs.brokerage_id].push(rs.user_id);b(Er)}catch(jt){console.error("Error loading brokerage manager assignments:",jt)}},va=async()=>{try{k(!0);const{data:jt,error:mr}=await Q.functions.invoke("get-user-details");if(mr)throw mr;const Er=jt.users||[];i(Er),y(jt.brokerages||[]),await wo();const rs=Er.filter(ns=>ns.roles.includes("assistant"));if(rs.length>0){const ns=rs.map(Is=>Is.id),{data:na}=await Q.from("agent_assistant_assignments").select("agent_id, assistant_id").in("assistant_id",ns);if(na&&na.length>0){const Is=[...new Set(na.map(cu=>cu.agent_id))],{data:_a}=await Q.from("profiles").select("id, name, email").in("id",Is),$h={};for(const cu of na){const El=_a==null?void 0:_a.find(ba=>ba.id===cu.agent_id);El&&($h[cu.assistant_id]={agent_name:El.name||"",agent_email:El.email||""})}$i($h)}}}catch(jt){console.error("Error loading members:",jt),o({title:"Error",description:"Failed to load members",variant:"destructive"})}finally{k(!1)}},No=async()=>{try{const{data:jt,error:mr}=await Q.from("app_tiles").select("id, name, icon, app_id, required_tags").order("name");if(mr)throw mr;p(jt||[])}catch(jt){console.error("Error loading apps:",jt),o({title:"Error",description:"Failed to load apps",variant:"destructive"})}},Pi=async jt=>{if(!Oe.name.trim()||!Oe.email.trim()){o({title:"Error",description:"Name and email are required",variant:"destructive"});return}if(!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(Oe.email)){o({title:"Error",description:"Please enter a valid email address",variant:"destructive"});return}try{const{error:Er}=await Q.from("profiles").update({name:Oe.name.trim(),email:Oe.email.trim(),brokerage_id:Oe.brokerage_id||null,phone:Oe.phone.trim()||null}).eq("id",jt);if(Er)throw Er;o({title:"Success",description:"Member details updated successfully"}),Ue(null),va()}catch(Er){console.error("Error updating member:",Er),o({title:"Error",description:Er.message||"Failed to update member",variant:"destructive"})}},ra=async jt=>{try{const{data:{session:mr}}=await Q.auth.getSession(),Er=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/resend-welcome-email",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${mr==null?void 0:mr.access_token}`},body:JSON.stringify({userId:jt})}),rs=await Er.json();if(!Er.ok)throw new Error(rs.error||"Failed to resend welcome email");o({title:"Success",description:"Welcome email sent successfully"})}catch(mr){console.error("Error resending welcome email:",mr),o({title:"Error",description:mr.message||"Failed to resend welcome email",variant:"destructive"})}},Li=async(jt,mr)=>{try{const{error:Er}=await Q.functions.invoke("send-password-reset",{body:{email:jt,redirectTo:window.location.origin}});if(Er)throw Er;o({title:"Password Reset Sent",description:`Password reset email sent to ${mr}`})}catch(Er){console.error("Error sending password reset:",Er),o({title:"Error",description:Er.message||"Failed to send password reset email",variant:"destructive"})}},Ha=async(jt,mr)=>{if(confirm(`Are you sure you want to delete ${mr}? This action cannot be undone.`))try{const{data:{session:Er}}=await Q.auth.getSession(),rs=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/delete-user",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${Er==null?void 0:Er.access_token}`},body:JSON.stringify({userId:jt})}),ns=await rs.json();if(!rs.ok)throw new Error(ns.error||"Failed to delete user");o({title:"Success",description:"User deleted successfully"}),va()}catch(Er){console.error("Error deleting user:",Er),o({title:"Error",description:Er.message||"Failed to delete user",variant:"destructive"})}},Es=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}I(!0);try{const{data:{session:jt}}=await Q.auth.getSession(),mr=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)}),Er=await mr.json();if(!mr.ok)throw new Error(Er.error||"Failed to create user");if(z.role&&z.role!=="user"&&Er.userId){const rs=z.role==="brokerage_manager"?z.brokerage_id:void 0;await Oi(Er.userId,z.role,"add",rs)}o({title:"Success",description:`User ${z.email} created successfully`}),D({email:"",name:"",password:"",brokerage_id:"",role:"user",phone:"",trial_days:""}),V(!1),va()}catch(jt){console.error("Error creating user:",jt),o({title:"Error",description:jt.message||"Failed to create user",variant:"destructive"})}finally{I(!1)}},Oi=async(jt,mr,Er,rs)=>{try{const{data:{session:ns}}=await Q.auth.getSession(),na={userId:jt,role:mr,action:Er};if(mr==="brokerage_manager"){if(!rs){o({title:"Error",description:"Please choose a brokerage for this manager assignment",variant:"destructive"});return}na.brokerageId=rs}const Is=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/manage-user-roles",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${ns==null?void 0:ns.access_token}`},body:JSON.stringify(na)}),_a=await Is.json();if(!Is.ok)throw new Error(_a.error||"Failed to manage user role");o({title:"Success",description:`Role ${Er==="add"?"added":"removed"} successfully`}),va()}catch(ns){console.error("Error managing user role:",ns),o({title:"Error",description:ns.message||"Failed to manage user role",variant:"destructive"})}},_l=(jt,mr)=>mr.length===0?!0:mr.some(Er=>jt.includes(Er)),Al=async(jt,mr,Er)=>{const rs=`${jt}-${mr.id}`;Ve(rs);try{if(Er){const ns=l.find(Is=>Is.id===jt),na=mr.required_tags.filter(Is=>ns==null?void 0:ns.tags.includes(Is));for(const Is of na){const{error:_a}=await Q.from("user_tags").delete().eq("user_id",jt).eq("tag",Is);if(_a)throw _a}o({title:"Access Removed",description:`Removed access to ${mr.name}`})}else if(mr.required_tags.length>0){const{error:ns}=await Q.from("user_tags").insert({user_id:jt,tag:mr.required_tags[0]});if(ns)throw ns;o({title:"Access Granted",description:`Granted access to ${mr.name}`})}await va()}catch(ns){console.error("Error toggling access:",ns),o({title:"Error",description:ns.message||"Failed to update access",variant:"destructive"})}finally{Ve(null)}},Zc=async()=>{const jt=ke.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(Er=>Er.name.toLowerCase()===jt.toLowerCase())){o({title:"Error",description:"A brokerage with this name already exists",variant:"destructive"});return}Me(!0);try{const{error:Er}=await Q.from("brokerages").insert({name:jt});if(Er)throw Er;o({title:"Success",description:`Brokerage "${jt}" created successfully`}),ct(""),st(!1),va()}catch(Er){console.error("Error creating brokerage:",Er),o({title:"Error",description:Er.message||"Failed to create brokerage",variant:"destructive"})}finally{Me(!1)}},Tf=jt=>{nt(jt),it(jt.name),Ee(!0)},Yo=()=>{nt(null),it(""),Ee(!1)},Vd=async()=>{if(!He)return;const jt=yt.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}dr(!0);try{const{error:mr}=await Q.from("brokerages").update({name:jt}).eq("id",He.id);if(mr)throw mr;o({title:"Success",description:"Brokerage updated successfully"}),Yo(),va()}catch(mr){console.error("Error updating brokerage:",mr),o({title:"Error",description:mr.message||"Failed to update brokerage",variant:"destructive"})}finally{dr(!1)}},hc=async(jt,mr)=>{var Er;if(!mr||typeof mr!="string"){o({title:"Error",description:"Please select a brokerage first",variant:"destructive"});return}try{const rs={userId:jt,role:"brokerage_manager",action:"add",brokerageId:mr};console.debug("[assignManagerToBrokerage] payload",rs);const{data:{session:ns}}=await Q.auth.getSession(),na=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/manage-user-roles",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${ns==null?void 0:ns.access_token}`},body:JSON.stringify(rs)}),Is=await na.json();if(!na.ok&&!((Er=Is.error)!=null&&Er.includes("duplicate")))throw new Error(Is.error||"Failed to add role");o({title:"Success",description:"Manager assigned to brokerage"}),await va()}catch(rs){console.error("Error assigning manager:",rs),o({title:"Error",description:rs.message||"Failed to assign manager",variant:"destructive"})}},ih=jt=>{kn(jt),Gr(!0)},Xo=async()=>{if(Ur){ur(!0);try{const jt=l.filter(rs=>rs.brokerage_id===Ur.id),{data:{session:mr}}=await Q.auth.getSession();for(const rs of jt){const ns=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/delete-user",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${mr==null?void 0:mr.access_token}`},body:JSON.stringify({userId:rs.id})});if(!ns.ok){const na=await ns.json();console.error(`Failed to delete user ${rs.email}:`,na.error)}}const{error:Er}=await Q.from("brokerages").delete().eq("id",Ur.id);if(Er)throw Er;o({title:"Success",description:`Brokerage "${Ur.name}" and ${jt.length} member(s) deleted`}),Gr(!1),kn(null),va()}catch(jt){console.error("Error deleting brokerage:",jt),o({title:"Error",description:jt.message||"Failed to delete brokerage",variant:"destructive"})}finally{ur(!1)}}},Sp=jt=>{Ei(jt),$o(""),ea(!0)},Wm=()=>{Ei(null),$o(""),ea(!1)},Gy=async jt=>{try{const{error:mr}=await Q.from("profiles").update({brokerage_id:null}).eq("id",jt);if(mr)throw mr;o({title:"Success",description:"User removed from brokerage"}),va()}catch(mr){console.error("Error removing user from brokerage:",mr),o({title:"Error",description:mr.message||"Failed to remove user",variant:"destructive"})}},Ky=async(jt,mr)=>{try{const{error:Er}=await Q.from("profiles").update({brokerage_id:mr}).eq("id",jt);if(Er)throw Er;o({title:"Success",description:"User added to brokerage"}),va()}catch(Er){console.error("Error adding user to brokerage:",Er),o({title:"Error",description:Er.message||"Failed to add user",variant:"destructive"})}},Zy=async()=>{if(!ca||!ta.email||!ta.name||!ta.password){o({title:"Error",description:"Please fill in all fields",variant:"destructive"});return}Os(!0);try{const{data:{session:jt}}=await Q.auth.getSession(),mr=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({...ta,brokerage_id:ca.id,role:"user"})}),Er=await mr.json();if(!mr.ok)throw new Error(Er.error||"Failed to create agent");o({title:"Success",description:`Agent ${ta.email} created successfully`}),ds({email:"",name:"",password:"",phone:""}),cs(!1),va()}catch(jt){console.error("Error creating agent:",jt),o({title:"Error",description:jt.message||"Failed to create agent",variant:"destructive"})}finally{Os(!1)}},zh=jt=>l.filter(mr=>mr.brokerage_id===jt),Tu=jt=>{const mr=zh(jt);if(!Ii)return mr;const Er=Ii.toLowerCase();return mr.filter(rs=>rs.name.toLowerCase().includes(Er)||rs.email.toLowerCase().includes(Er))},Yc=jt=>l.filter(mr=>mr.brokerage_id!==jt),lu=l.filter(jt=>{var mr;if(W){const Er=W.toLowerCase();if(!(jt.name.toLowerCase().includes(Er)||jt.email.toLowerCase().includes(Er)||((mr=jt.brokerage_name)==null?void 0:mr.toLowerCase().includes(Er))))return!1}return!(ie==="claimed"&&!jt.claimed||ie==="unclaimed"&&jt.claimed||se!=="all"&&!jt.roles.includes(se)||he==="trial"&&!jt.is_trial||he==="non-trial"&&jt.is_trial||Ae==="none"&&jt.brokerage_id||Ae!=="all"&&Ae!=="none"&&jt.brokerage_id!==Ae)}),fc=lu.length,Xc=oe===0,Uo=Xc?1:Math.ceil(fc/oe),Au=Xc?0:(J-1)*oe,Bh=Xc?fc:Au+oe,Hd=lu.slice(Au,Bh),Cp=jt=>{G(jt),ne(1)},Yy=jt=>{ge(jt),ne(1)},lx=(jt,mr)=>{jt(mr),ne(1)},Mp=async(jt,mr)=>{_e(!0);try{const Er=l.find(Is=>Is.id===jt);if(!Er)return;const rs=Er.trial_expires_at?new Date(Er.trial_expires_at):new Date,ns=new Date(rs.getTime()+mr*24*60*60*1e3),{error:na}=await Q.from("profiles").update({trial_expires_at:ns.toISOString()}).eq("id",jt);if(na)throw na;o({title:"Trial Extended",description:`Trial extended by ${mr} days`}),va()}catch(Er){console.error("Error extending trial:",Er),o({title:"Error",description:Er.message||"Failed to extend trial",variant:"destructive"})}finally{_e(!1)}},yd=async jt=>{Te(!0);try{const{error:mr}=await Q.from("profiles").update({is_trial:!1,trial_expires_at:null,trial_started_at:null,trial_claimed_at:null}).eq("id",jt);if(mr)throw mr;o({title:"Account Converted",description:"User has been converted to a full account"}),va(),Eu()}catch(mr){console.error("Error converting trial:",mr),o({title:"Error",description:mr.message||"Failed to convert account",variant:"destructive"})}finally{Te(!1)}},Xy=async jt=>{es(!0);try{const{data:mr}=await Q.from("agent_assistant_assignments").select("id, assistant_id, permissions").eq("agent_id",jt);if(mr&&mr.length>0){const rs=mr.map(na=>na.assistant_id),{data:ns}=await Q.from("profiles").select("id, name, email").in("id",rs);jn(mr.map(na=>{const Is=ns==null?void 0:ns.find(_a=>_a.id===na.assistant_id);return{id:na.id,assistant_id:na.assistant_id,assistant_name:(Is==null?void 0:Is.name)||"Unknown",assistant_email:(Is==null?void 0:Is.email)||"",permissions:na.permissions||{}}}))}else jn([]);const{data:Er}=await Q.from("agent_assistant_assignments").select("id, agent_id, permissions").eq("assistant_id",jt);if(Er&&Er.length>0){const rs=Er.map(na=>na.agent_id),{data:ns}=await Q.from("profiles").select("id, name, email").in("id",rs);as(Er.map(na=>{const Is=ns==null?void 0:ns.find(_a=>_a.id===na.agent_id);return{id:na.id,agent_id:na.agent_id,agent_name:(Is==null?void 0:Is.name)||"Unknown",agent_email:(Is==null?void 0:Is.email)||"",permissions:na.permissions||{}}}))}else as([])}catch(mr){console.error("Error loading assistant data:",mr)}finally{es(!1)}},Af=jt=>{qe(jt),at({name:jt.name,email:jt.email,brokerage_id:jt.brokerage_id||"",phone:jt.phone||""}),Mt(!0),Xy(jt.id)},Eu=()=>{qe(null),Mt(!1),at({name:"",email:"",brokerage_id:"",phone:""})},J3=async()=>{Be&&(await Pi(Be.id),Eu())},Ok=jt=>{xe(mr=>{const Er=new Set(mr);return Er.has(jt)?Er.delete(jt):Er.add(jt),Er})},cx=()=>{if(tt.size===Hd.length&&Hd.every(jt=>tt.has(jt.id))){const jt=new Set(tt);Hd.forEach(mr=>jt.delete(mr.id)),xe(jt)}else{const jt=new Set(tt);Hd.forEach(mr=>jt.add(mr.id)),xe(jt)}},Ws=()=>{xe(new Set)},Qy=async()=>{if(tt.size===0)return;Ye(!0);let jt=0,mr=0;try{const{data:{session:Er}}=await Q.auth.getSession();for(const rs of tt)try{(await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/resend-welcome-email",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${Er==null?void 0:Er.access_token}`},body:JSON.stringify({userId:rs})})).ok?jt++:mr++}catch{mr++}o({title:"Bulk Email Complete",description:`Sent ${jt} emails${mr>0?`, ${mr} failed`:""}`}),Ws()}catch(Er){o({title:"Error",description:Er.message||"Failed to send emails",variant:"destructive"})}finally{Ye(!1)}},Ov=async()=>{if(tt.size===0)return;Ye(!0);let jt=0,mr=0;try{const{data:{session:Er}}=await Q.auth.getSession();for(const rs of tt)try{(await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/send-password-reset",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${Er==null?void 0:Er.access_token}`},body:JSON.stringify({userId:rs})})).ok?jt++:mr++}catch{mr++}o({title:"Bulk Password Reset Complete",description:`Sent ${jt} reset emails${mr>0?`, ${mr} failed`:""}`}),Ws()}catch(Er){o({title:"Error",description:Er.message||"Failed to send password reset emails",variant:"destructive"})}finally{Ye(!1)}},Dk=async()=>{if(tt.size===0)return;const jt=l.filter(ns=>tt.has(ns.id)).map(ns=>ns.name).slice(0,5).join(", "),mr=tt.size>5?` and ${tt.size-5} more`:"";if(!confirm(`Are you sure you want to delete ${tt.size} users (${jt}${mr})? This action cannot be undone.`))return;Ye(!0);let Er=0,rs=0;try{const{data:{session:ns}}=await Q.auth.getSession();for(const na of tt)try{(await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/delete-user",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${ns==null?void 0:ns.access_token}`},body:JSON.stringify({userId:na})})).ok?Er++:rs++}catch{rs++}o({title:"Bulk Delete Complete",description:`Deleted ${Er} users${rs>0?`, ${rs} failed`:""}`}),Ws(),va()}catch(ns){o({title:"Error",description:ns.message||"Failed to delete users",variant:"destructive"})}finally{Ye(!1)}},Rk=async()=>{_t(!0);try{const{data:{session:jt}}=await Q.auth.getSession(),mr=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(!mr.ok){const rs=await mr.json();throw new Error(rs.error||"Failed to sync phones")}const Er=await mr.json();o({title:"Phone Sync Complete",description:`Pulled ${Er.summary.pulledFromGHL} from GHL, pushed ${Er.summary.pushedToGHL} to GHL, ${Er.summary.alreadySynced} already synced`}),va()}catch(jt){o({title:"Error",description:jt.message||"Failed to sync phones with GHL",variant:"destructive"})}finally{_t(!1)}},Ef=async(jt,mr)=>{$t(jt);try{const{data:{session:Er}}=await Q.auth.getSession(),{data:rs}=await Q.from("profiles").select("phone").eq("id",jt).single(),ns=(rs==null?void 0:rs.phone)||"",na=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/ghl-tag-sync",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${Er==null?void 0:Er.access_token}`},body:JSON.stringify({email:mr,action:"update",phone:ns||void 0})});if(!na.ok){const _a=await na.json();throw new Error(_a.error||"Failed to sync with GHL")}const Is=await fetch(`https://services.leadconnectorhq.com/contacts/lookup?locationId=&email=${encodeURIComponent(mr)}`,{method:"GET",headers:{"Content-Type":"application/json"}});o({title:"Phone Synced",description:ns?`Phone ${ns} synced to GHL`:"Sync attempted - run bulk sync to pull phone from GHL"}),va()}catch(Er){o({title:"Error",description:Er.message||"Failed to sync phone",variant:"destructive"})}finally{$t(null)}},Gm=async jt=>{await s(jt)},dx=()=>{if(tt.size===0){o({title:"No members selected",description:"Please select members to export",variant:"destructive"});return}const jt=l.filter(_a=>tt.has(_a.id)),mr=["Name","Email","Phone","Brokerage","Roles","Status","Created At"],Er=jt.map(_a=>[_a.name,_a.email,_a.phone||"",_a.brokerage_name||"",_a.roles.join("; "),_a.claimed?"Claimed":"Unclaimed",new Date(_a.created_at).toLocaleDateString()]),rs=[mr.join(","),...Er.map(_a=>_a.map($h=>`"${($h||"").replace(/"/g,'""')}"`).join(","))].join(` `),ns=new Blob([rs],{type:"text/csv"}),na=URL.createObjectURL(ns),Is=document.createElement("a");Is.href=na,Is.download=`members-export-${new Date().toISOString().split("T")[0]}.csv`,Is.click(),URL.revokeObjectURL(na),o({title:"Export complete",description:`Exported ${jt.length} member(s)`})};return S?r.jsx(Dr,{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(Dr,{title:"Members",children:[r.jsxs("div",{className:"space-y-6",children:[r.jsx(Mu,{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:Rk,disabled:Nt,children:[Nt?r.jsx(Zr,{className:"mr-2 h-4 w-4 animate-spin"}):r.jsx(Ti,{className:"mr-2 h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline",children:Nt?"Syncing...":"Sync Phones with GHL"}),r.jsx("span",{className:"sm:hidden",children:Nt?"Syncing...":"Sync GHL"})]}),r.jsxs(ee,{size:"sm",variant:"outline",onClick:()=>sr(!0),children:[r.jsx(q1,{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(Or,{open:U,onOpenChange:V,children:[r.jsx(Zo,{asChild:!0,children:r.jsxs(ee,{size:"sm",children:[r.jsx(vf,{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(Ir,{children:[r.jsxs($r,{children:[r.jsx(Fr,{children:"Create New User"}),r.jsx(Zn,{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($e,{htmlFor:"name",children:"Name"}),r.jsx(dt,{id:"name",placeholder:"John Doe",value:z.name,onChange:jt=>D({...z,name:jt.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{htmlFor:"email",children:"Email"}),r.jsx(dt,{id:"email",type:"email",placeholder:"john@example.com",value:z.email,onChange:jt=>D({...z,email:jt.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{htmlFor:"password",children:"Password"}),r.jsx(dt,{id:"password",type:"password",placeholder:"Min 6 characters",value:z.password,onChange:jt=>D({...z,password:jt.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{htmlFor:"phone",children:"Phone (optional)"}),r.jsx(dt,{id:"phone",type:"tel",placeholder:"555-123-4567",value:z.phone,onChange:jt=>D({...z,phone:jt.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs($e,{htmlFor:"brokerage",children:["Brokerage",z.role==="brokerage_manager"?" (required)":""]}),r.jsxs(mn,{value:z.brokerage_id||"none",onValueChange:jt=>D({...z,brokerage_id:jt==="none"?"":jt}),children:[r.jsx(fn,{id:"brokerage",children:r.jsx(yn,{placeholder:z.role==="brokerage_manager"?"Select brokerage":"Select brokerage (optional)"})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"none",children:"None"}),x.map(jt=>r.jsx(qt,{value:jt.id,children:jt.name},jt.id))]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{htmlFor:"role",children:"Role"}),r.jsxs(mn,{value:z.role,onValueChange:jt=>D({...z,role:jt}),children:[r.jsx(fn,{id:"role",children:r.jsx(yn,{placeholder:"Select role"})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"user",children:"User"}),r.jsx(qt,{value:"moderator",children:"Moderator"}),r.jsx(qt,{value:"brokerage_manager",children:"Brokerage Manager"}),r.jsx(qt,{value:"admin",children:"Admin"})]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{htmlFor:"trial_days",children:"Trial Period (optional)"}),r.jsxs(mn,{value:z.trial_days||"none",onValueChange:jt=>D({...z,trial_days:jt==="none"?"":jt}),children:[r.jsx(fn,{id:"trial_days",children:r.jsx(yn,{placeholder:"No trial (full access)"})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"none",children:"No trial (full access)"}),r.jsx(qt,{value:"7",children:"7-day trial"}),r.jsx(qt,{value:"30",children:"30-day trial"}),r.jsx(qt,{value:"60",children:"60-day trial"}),r.jsx(qt,{value:"90",children:"90-day trial"}),r.jsx(qt,{value:"365",children:"1-year trial"})]})]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Trial accounts don't require a credit card. Access expires after the trial period."})]})]}),r.jsxs(Bs,{children:[r.jsx(ee,{variant:"outline",onClick:()=>V(!1),children:"Cancel"}),r.jsx(ee,{onClick:Es,disabled:T,children:T?"Creating...":"Create User"})]})]})]})]})]}),r.jsxs(Ai,{defaultValue:"members",className:"space-y-6",children:[r.jsxs(vi,{children:[r.jsx(sn,{value:"members",children:"Members"}),r.jsx(sn,{value:"brokerages",children:"Brokerages"}),r.jsx(sn,{value:"access",children:"Access Matrix"}),r.jsx(sn,{value:"celebrations",children:"Celebrations"})]}),r.jsxs(Mn,{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(Sa,{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:W,onChange:jt=>Cp(jt.target.value),className:"pl-10 h-9"})]}),r.jsxs(mn,{value:ie,onValueChange:jt=>lx(pe,jt),children:[r.jsx(fn,{className:"w-[130px] h-9",children:r.jsx(yn,{})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"all",children:"All Status"}),r.jsx(qt,{value:"claimed",children:"Active"}),r.jsx(qt,{value:"unclaimed",children:"Pending"})]})]}),r.jsxs(mn,{value:se,onValueChange:jt=>lx(fe,jt),children:[r.jsx(fn,{className:"w-[130px] h-9",children:r.jsx(yn,{})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"all",children:"All Roles"}),r.jsx(qt,{value:"admin",children:"Admin"}),r.jsx(qt,{value:"brokerage_manager",children:"Manager"}),r.jsx(qt,{value:"assistant",children:"Assistant"}),r.jsx(qt,{value:"user",children:"User"})]})]}),r.jsxs(mn,{value:he,onValueChange:jt=>lx(ye,jt),children:[r.jsx(fn,{className:"w-[130px] h-9",children:r.jsx(yn,{})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"all",children:"All Users"}),r.jsx(qt,{value:"trial",children:"Trial Only"}),r.jsx(qt,{value:"non-trial",children:"Full Only"})]})]}),r.jsxs(mn,{value:Ae,onValueChange:jt=>lx(we,jt),children:[r.jsx(fn,{className:"w-[150px] h-9",children:r.jsx(yn,{})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"all",children:"All Brokerages"}),r.jsx(qt,{value:"none",children:"No Brokerage"}),x.map(jt=>r.jsx(qt,{value:jt.id,children:jt.name},jt.id))]})]}),(W||ie!=="all"||se!=="all"||he!=="all"||Ae!=="all")&&r.jsxs(ee,{variant:"ghost",size:"sm",className:"h-9",onClick:()=>{G(""),pe("all"),fe("all"),ye("all"),we("all"),ne(1)},children:[r.jsx(hs,{className:"h-4 w-4 mr-1"}),"Clear"]}),r.jsxs("div",{className:"flex items-center gap-2 ml-auto",children:[r.jsx("span",{className:"text-sm text-muted-foreground",children:Xc?`Showing all ${fc} members`:`Showing ${Au+1}-${Math.min(Bh,fc)} of ${fc} members`}),r.jsxs(mn,{value:oe.toString(),onValueChange:jt=>Yy(Number(jt)),children:[r.jsx(fn,{className:"h-9 w-[110px]",children:r.jsx(yn,{})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"50",children:"50 / page"}),r.jsx(qt,{value:"100",children:"100 / page"}),r.jsx(qt,{value:"250",children:"250 / page"}),r.jsx(qt,{value:"0",children:"All"})]})]})]})]}),tt.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(K0,{className:"h-4 w-4 text-primary"}),r.jsxs("span",{className:"text-sm font-medium",children:[tt.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:Qy,disabled:Pe,children:[Pe?r.jsx(Zr,{className:"h-4 w-4 animate-spin mr-1"}):r.jsx(Ns,{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:Ov,disabled:Pe,children:[Pe?r.jsx(Zr,{className:"h-4 w-4 animate-spin mr-1"}):r.jsx(pf,{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:dx,children:[r.jsx(io,{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:Dk,disabled:Pe,children:[Pe?r.jsx(Zr,{className:"h-4 w-4 animate-spin mr-1"}):r.jsx(Bn,{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:Ws,disabled:Pe,children:r.jsx(hs,{className:"h-4 w-4"})})]})]}),r.jsx("div",{className:"border rounded-lg bg-card overflow-hidden",children:r.jsxs(Ks,{children:[r.jsx(Zs,{children:r.jsxs(Mr,{className:"bg-muted/30 hover:bg-muted/30",children:[r.jsx(It,{className:"w-[50px]",children:r.jsx(Bl,{checked:Hd.length>0&&Hd.every(jt=>tt.has(jt.id)),onCheckedChange:cx,"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(Ys,{children:Hd.length===0?r.jsx(Mr,{children:r.jsx(kt,{colSpan:7,className:"text-center py-12 text-muted-foreground",children:"No members found"})}):Hd.map(jt=>r.jsxs(Mr,{className:`hover:bg-muted/30 ${tt.has(jt.id)?"bg-primary/5":""}`,children:[r.jsx(kt,{children:r.jsx(Bl,{checked:tt.has(jt.id),onCheckedChange:()=>Ok(jt.id),"aria-label":`Select ${jt.name}`})}),r.jsx(kt,{children:r.jsxs("div",{children:[r.jsx("button",{onClick:()=>Af(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(kt,{className:"text-muted-foreground",children:jt.brokerage_name||"—"}),r.jsx(kt,{children:r.jsxs("div",{className:"flex flex-col gap-1",children:[r.jsx(Pt,{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(qSe,{expiresAt:jt.trial_expires_at,className:"w-fit"})]})}),r.jsx(kt,{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(Pt,{variant:"outline",className:"text-[10px] ml-1",children:["Asst",$s[jt.id]?` → ${$s[jt.id].agent_name||$s[jt.id].agent_email}`:""]})]})}),r.jsx(kt,{className:"text-muted-foreground",children:jt.last_sign_in_at?new Date(jt.last_sign_in_at).toLocaleDateString():"—"}),r.jsx(kt,{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:()=>{or(jt),Vt(!0)},title:"Send celebration",children:r.jsx(qc,{className:"h-4 w-4"})}),r.jsx(ee,{size:"icon",variant:"ghost",className:"h-8 w-8",onClick:()=>Af(jt),title:"Edit member",children:r.jsx(ni,{className:"h-4 w-4"})}),r.jsx(ee,{size:"icon",variant:"ghost",className:"h-8 w-8",onClick:()=>Ef(jt.id,jt.email),disabled:At===jt.id,title:"Sync phone with GHL",children:At===jt.id?r.jsx(Zr,{className:"h-4 w-4 animate-spin"}):r.jsx(Ti,{className:"h-4 w-4"})}),r.jsx(ee,{size:"icon",variant:"ghost",className:"h-8 w-8",onClick:()=>ra(jt.id),title:"Resend welcome email",children:r.jsx(Ns,{className:"h-4 w-4"})}),r.jsx(ee,{size:"icon",variant:"ghost",className:"h-8 w-8",onClick:()=>Li(jt.email,jt.name),title:"Send password reset",children:r.jsx(Lj,{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:()=>Gm(jt.id),disabled:a||jt.id===(t==null?void 0:t.id),title:jt.id===(t==null?void 0:t.id)?"Cannot impersonate yourself":`Login as ${jt.name}`,children:a?r.jsx(Zr,{className:"h-4 w-4 animate-spin"}):r.jsx(TS,{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:()=>Ha(jt.id,jt.name),title:"Delete user",children:r.jsx(Bn,{className:"h-4 w-4"})})]})})]},jt.id))})]})}),Uo>1&&r.jsxs("div",{className:"flex items-center justify-between px-2 py-4",children:[r.jsxs("div",{className:"text-sm text-muted-foreground",children:["Page ",J," of ",Uo]}),r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(ee,{variant:"outline",size:"sm",onClick:()=>ne(1),disabled:J===1,children:"First"}),r.jsx(ee,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>ne(jt=>Math.max(1,jt-1)),disabled:J===1,children:r.jsx(kc,{className:"h-4 w-4"})}),r.jsx("div",{className:"flex items-center gap-1",children:Array.from({length:Math.min(5,Uo)},(jt,mr)=>{let Er;return Uo<=5||J<=3?Er=mr+1:J>=Uo-2?Er=Uo-4+mr:Er=J-2+mr,r.jsx(ee,{variant:J===Er?"default":"outline",size:"sm",className:"h-8 w-8 p-0",onClick:()=>ne(Er),children:Er},Er)})}),r.jsx(ee,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>ne(jt=>Math.min(Uo,jt+1)),disabled:J===Uo,children:r.jsx(Wi,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"outline",size:"sm",onClick:()=>ne(Uo),disabled:J===Uo,children:"Last"})]})]})]}),r.jsx(Or,{open:ot,onOpenChange:Mt,children:r.jsxs(Ir,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsxs($r,{children:[r.jsx(Fr,{children:"Edit Member"}),r.jsx(Zn,{children:"Update member details, roles, and app access"})]}),Be&&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($e,{htmlFor:"edit-name",children:"Name"}),r.jsx(dt,{id:"edit-name",value:Oe.name,onChange:jt=>at({...Oe,name:jt.target.value}),maxLength:100})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{htmlFor:"edit-email",children:"Email"}),r.jsx(dt,{id:"edit-email",type:"email",value:Oe.email,onChange:jt=>at({...Oe,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($e,{htmlFor:"edit-phone",children:"Phone"}),r.jsx(dt,{id:"edit-phone",type:"tel",value:Oe.phone,onChange:jt=>at({...Oe,phone:jt.target.value}),placeholder:"555-123-4567"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{htmlFor:"edit-brokerage",children:"Brokerage"}),r.jsxs(mn,{value:Oe.brokerage_id||"none",onValueChange:jt=>at({...Oe,brokerage_id:jt==="none"?"":jt}),children:[r.jsx(fn,{id:"edit-brokerage",children:r.jsx(yn,{placeholder:"Select brokerage"})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"none",children:"None"}),x.map(jt=>r.jsx(qt,{value:jt.id,children:jt.name},jt.id))]})]})]})]})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsx("h3",{className:"text-sm font-semibold",children:"Roles"}),r.jsxs("div",{className:"flex flex-wrap gap-2",children:[Be.roles.map(jt=>r.jsxs(Pt,{variant:"default",className:"gap-1",children:[r.jsx(yf,{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:()=>Oi(Be.id,jt,"remove"),className:"ml-1 rounded-full hover:bg-destructive/20",title:"Remove role",children:r.jsx(hs,{className:"h-3 w-3"})})]},jt)),Be.roles.length===0&&r.jsx("span",{className:"text-sm text-muted-foreground",children:"No roles assigned"})]}),r.jsxs(mn,{onValueChange:jt=>Oi(Be.id,jt,"add"),children:[r.jsx(fn,{className:"w-[200px]",children:r.jsx(yn,{placeholder:"Add role..."})}),r.jsxs(pn,{children:[!Be.roles.includes("admin")&&r.jsx(qt,{value:"admin",children:"Admin"}),!Be.roles.includes("user")&&r.jsx(qt,{value:"user",children:"User"})]})]}),!Be.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"})]}),(Yr.length>0||Wr.length>0||Be.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(Un,{className:"h-4 w-4"}),"Assistant Relationships"]}),is?r.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[r.jsx(Zr,{className:"h-4 w-4 animate-spin"}),"Loading..."]}):r.jsxs("div",{className:"space-y-3",children:[Yr.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:"}),Yr.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(Pt,{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(([,mr])=>mr).map(([mr])=>r.jsx(Pt,{variant:"secondary",className:"text-[10px] capitalize",children:mr},mr))})]},jt.id))]}),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:"Assists agents:"}),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.agent_name}),r.jsx(Pt,{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(([,mr])=>mr).map(([mr])=>r.jsx(Pt,{variant:"secondary",className:"text-[10px] capitalize",children:mr},mr))})]},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:u.map(jt=>{const mr=_l(Be.tags,jt.required_tags),Er=`${Be.id}-${jt.id}`,rs=le===Er,ns=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}),ns&&r.jsx("span",{className:"text-xs text-muted-foreground",children:"Available to all members"})]})]}),r.jsx("div",{className:"flex items-center gap-2",children:rs?r.jsx(Zr,{className:"h-4 w-4 animate-spin text-muted-foreground"}):ns?r.jsx(Pt,{variant:"secondary",className:"text-xs",children:"Always On"}):r.jsx(Ts,{checked:mr,onCheckedChange:()=>Al(Be.id,jt,mr)})})]},jt.id)})})]}),Be.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:Be.trial_expires_at&&r.jsx(qSe,{expiresAt:Be.trial_expires_at})}),Be.trial_expires_at&&r.jsxs("span",{className:"text-sm text-muted-foreground",children:["Expires: ",new Date(Be.trial_expires_at).toLocaleDateString()]})]}),r.jsxs("div",{className:"flex flex-wrap gap-2",children:[r.jsxs(ee,{size:"sm",variant:"outline",onClick:()=>Mp(Be.id,7),disabled:be,children:[r.jsx(Mj,{className:"h-4 w-4 mr-1"}),"+7 Days"]}),r.jsxs(ee,{size:"sm",variant:"outline",onClick:()=>Mp(Be.id,14),disabled:be,children:[r.jsx(Mj,{className:"h-4 w-4 mr-1"}),"+14 Days"]}),r.jsxs(ee,{size:"sm",variant:"outline",onClick:()=>Mp(Be.id,30),disabled:be,children:[r.jsx(Mj,{className:"h-4 w-4 mr-1"}),"+30 Days"]}),r.jsxs(ee,{size:"sm",variant:"default",onClick:()=>yd(Be.id),disabled:Je,className:"bg-green-600 hover:bg-green-700",children:[r.jsx(Uj,{className:"h-4 w-4 mr-1"}),"Convert to Full Account"]})]}),Be.trial_started_at&&r.jsxs("div",{className:"mt-3 text-xs text-muted-foreground",children:["Trial started: ",new Date(Be.trial_started_at).toLocaleDateString(),Be.trial_claimed_at&&r.jsxs("span",{children:[" • Claimed: ",new Date(Be.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:[Be.email_confirmed_at&&r.jsxs("div",{children:["Claimed: ",new Date(Be.email_confirmed_at).toLocaleString()]}),Be.last_sign_in_at&&r.jsxs("div",{children:["Last login: ",new Date(Be.last_sign_in_at).toLocaleString()]}),r.jsxs("div",{children:["Created: ",new Date(Be.created_at).toLocaleString()]})]})]})]}),r.jsxs(Bs,{children:[r.jsx(ee,{variant:"outline",onClick:Eu,children:"Cancel"}),r.jsx(ee,{onClick:J3,children:"Save Changes"})]})]})}),r.jsxs(Mn,{value:"access",children:[u.length===0?r.jsx(Ze,{children:r.jsxs(et,{className:"py-12 text-center",children:[r.jsx("p",{className:"text-muted-foreground mb-4",children:"No apps configured yet"}),r.jsx(ee,{onClick:()=>e("/admin/apps"),children:"Configure Apps"})]})}):r.jsxs(Ze,{children:[r.jsxs(Wt,{children:[r.jsx(Yt,{children:"Member Access Matrix"}),r.jsx(Sn,{children:"Toggle switches to grant or revoke app access for each member"})]}),r.jsxs(et,{children:[r.jsx("div",{className:"overflow-x-auto",children:r.jsxs("table",{className:"w-full",children:[r.jsx("thead",{children:r.jsxs("tr",{className:"border-b",children:[r.jsx("th",{className:"text-left p-4 font-semibold sticky left-0 bg-card z-10",children:"Member"}),u.map(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:[Hd.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})]})}),u.map(mr=>{const Er=_l(jt.tags,mr.required_tags),rs=`${jt.id}-${mr.id}`,ns=le===rs;return r.jsx("td",{className:"p-4 text-center",children:r.jsx("div",{className:"flex items-center justify-center",children:ns?r.jsx(Zr,{className:"h-5 w-5 animate-spin text-muted-foreground"}):r.jsx(Ts,{checked:Er,onCheckedChange:()=>Al(jt.id,mr,Er),disabled:mr.required_tags.length===0})})},mr.id)})]},jt.id)),Hd.length===0&&r.jsx("tr",{children:r.jsx("td",{colSpan:u.length+1,className:"p-8 text-center text-muted-foreground",children:"No members found"})})]})]})}),Uo>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 ",Au+1,"-",Math.min(Bh,fc)," of ",fc," • Page ",J," of ",Uo]}),r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(ee,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>ne(jt=>Math.max(1,jt-1)),disabled:J===1,children:r.jsx(kc,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>ne(jt=>Math.min(Uo,jt+1)),disabled:J===Uo,children:r.jsx(Wi,{className:"h-4 w-4"})})]})]})]})]}),r.jsx("div",{className:"mt-6",children:r.jsx(ee,{variant:"outline",onClick:()=>e("/admin/apps"),children:"Manage Apps"})})]}),r.jsxs(Mn,{value:"brokerages",className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between gap-4",children:[r.jsxs("div",{className:"flex items-center gap-3 flex-1",children:[r.jsxs("div",{className:"relative flex-1 max-w-sm",children:[r.jsx(Sa,{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:Ia,onChange:jt=>no(jt.target.value),className:"pl-10"})]}),r.jsxs("span",{className:"text-sm text-muted-foreground whitespace-nowrap",children:[x.filter(jt=>jt.name.toLowerCase().includes(Ia.toLowerCase())).length," of ",x.length," brokerages"]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs(ee,{size:"sm",variant:"outline",onClick:()=>{const jt=[];for(const Is of x){const _a=_[Is.id]??[];for(const $h of _a){const cu=l.find(El=>El.id===$h);if(cu){const El=(cu.name||"").trim().split(/\s+/),ba=El[0]||"",Fk=El.slice(1).join(" ")||"";jt.push({firstName:ba,lastName:Fk,email:cu.email,brokerageName:Is.name})}}}if(jt.length===0){o({title:"No managers found to export"});return}const Er=[["First Name","Last Name","Email","Brokerage Name"].join(","),...jt.map(Is=>[Is.firstName,Is.lastName,Is.email,Is.brokerageName].map(_a=>`"${(_a||"").replace(/"/g,'""')}"`).join(","))].join(` `),rs=new Blob([Er],{type:"text/csv"}),ns=URL.createObjectURL(rs),na=document.createElement("a");na.href=ns,na.download=`brokerage-managers-${new Date().toISOString().slice(0,10)}.csv`,na.click(),URL.revokeObjectURL(ns),o({title:`Exported ${jt.length} managers`})},children:[r.jsx(io,{className:"mr-2 h-4 w-4"}),"Export Managers"]}),r.jsxs(Or,{open:Qe,onOpenChange:st,children:[r.jsx(Zo,{asChild:!0,children:r.jsxs(ee,{size:"sm",children:[r.jsx(hi,{className:"mr-2 h-4 w-4"}),"Add Brokerage"]})}),r.jsxs(Ir,{children:[r.jsxs($r,{children:[r.jsx(Fr,{children:"Create New Brokerage"}),r.jsx(Zn,{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($e,{htmlFor:"brokerage-name",children:"Brokerage Name"}),r.jsx(dt,{id:"brokerage-name",placeholder:"Enter brokerage name",value:ke,onChange:jt=>ct(jt.target.value),maxLength:100})]})}),r.jsxs(Bs,{children:[r.jsx(ee,{variant:"outline",onClick:()=>st(!1),children:"Cancel"}),r.jsx(ee,{onClick:Zc,disabled:Ce,children:Ce?"Creating...":"Create Brokerage"})]})]})]})]})]}),r.jsx("div",{className:"border rounded-lg bg-card overflow-hidden",children:r.jsxs(Ks,{children:[r.jsx(Zs,{children:r.jsxs(Mr,{className:"bg-muted/30 hover:bg-muted/30",children:[r.jsx(It,{className:"font-semibold",children:"Brokerage Name"}),r.jsx(It,{className:"font-semibold",children:"Manager(s)"}),r.jsx(It,{className:"font-semibold",children:"Agents"}),r.jsx(It,{className:"w-[150px]"})]})}),r.jsx(Ys,{children:(()=>{const jt=x.filter(mr=>mr.name.toLowerCase().includes(Ia.toLowerCase()));return jt.length===0?r.jsx(Mr,{children:r.jsx(kt,{colSpan:4,className:"text-center py-12 text-muted-foreground",children:Ia?"No brokerages match your search":"No brokerages found"})}):jt.map(mr=>{const Er=l.filter(Is=>Is.brokerage_id===mr.id),ns=(_[mr.id]??[]).map(Is=>l.find(_a=>_a.id===Is)).filter(Boolean),na=Er.length;return r.jsxs(Mr,{className:"hover:bg-muted/30",children:[r.jsx(kt,{children:r.jsx("button",{onClick:()=>Tf(mr),className:"text-primary hover:underline font-medium",children:mr.name})}),r.jsx(kt,{children:ns.length>0?r.jsx("div",{className:"flex flex-wrap gap-1",children:ns.map(Is=>r.jsx(Pt,{variant:"secondary",className:"text-xs",children:Is.name},Is.id))}):r.jsx("span",{className:"text-muted-foreground text-sm",children:"No manager"})}),r.jsxs(kt,{children:[na," member",na!==1?"s":""]}),r.jsx(kt,{children:r.jsxs("div",{className:"flex gap-1 justify-end",children:[r.jsxs(ee,{size:"sm",variant:"outline",className:"h-8",onClick:()=>Sp(mr),children:[r.jsx(Un,{className:"h-4 w-4 mr-1"}),"Manage"]}),r.jsx(ee,{size:"icon",variant:"ghost",className:"h-8 w-8",onClick:()=>Tf(mr),title:"Edit brokerage",children:r.jsx(ni,{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:()=>ih(mr),title:"Delete brokerage",children:r.jsx(Bn,{className:"h-4 w-4"})})]})})]},mr.id)})})()})]})}),r.jsx(Or,{open:Ge,onOpenChange:Ee,children:r.jsxs(Ir,{className:"max-w-lg",children:[r.jsxs($r,{children:[r.jsx(Fr,{children:"Edit Brokerage"}),r.jsx(Zn,{children:"Update brokerage details and manage managers"})]}),He&&r.jsxs("div",{className:"space-y-6 py-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{htmlFor:"edit-brokerage-name",children:"Brokerage Name"}),r.jsx(dt,{id:"edit-brokerage-name",value:yt,onChange:jt=>it(jt.target.value),maxLength:100})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsx($e,{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 mr=(_[He.id]??[]).map(Er=>l.find(rs=>rs.id===Er)).filter(Boolean);return mr.length===0?r.jsx("span",{className:"text-sm text-muted-foreground",children:"No managers assigned"}):mr.map(Er=>r.jsxs(Pt,{variant:"default",className:"gap-1",children:[r.jsx(yf,{className:"h-3 w-3"}),Er.name,r.jsx("button",{onClick:()=>Oi(Er.id,"brokerage_manager","remove",He.id),className:"ml-1 rounded-full hover:bg-destructive/20",title:"Remove manager from this brokerage",children:r.jsx(hs,{className:"h-3 w-3"})})]},Er.id))})()}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{className:"text-sm text-muted-foreground",children:"Assign manager from existing members:"}),r.jsxs(Vc,{open:yi,onOpenChange:qn,children:[r.jsx(Hc,{asChild:!0,children:r.jsxs(ee,{variant:"outline",role:"combobox","aria-expanded":yi,className:"w-full justify-between",children:["Search for a member...",r.jsx(Sa,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),r.jsx(Mc,{className:"w-full p-0",align:"start",children:r.jsxs(Ey,{children:[r.jsx(Iy,{placeholder:"Search by name or email..."}),r.jsxs(Py,{className:"max-h-[200px]",children:[r.jsx(Ly,{children:"No members found."}),r.jsx(Oy,{children:(()=>{const jt=new Set(_[He.id]??[]);return l.filter(mr=>!jt.has(mr.id)&&(n||mr.brokerage_id===He.id)).map(mr=>r.jsxs(Dy,{value:`${mr.name} ${mr.email}`,onSelect:()=>{hc(mr.id,He.id),qn(!1)},children:[mr.name," (",mr.email,")"]},mr.id))})()})]})]})})]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{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===He.id).length===0?r.jsx("span",{className:"text-sm text-muted-foreground",children:"No members"}):l.filter(jt=>jt.brokerage_id===He.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(Pt,{variant:"outline",className:"text-xs",children:"Manager"})]},jt.id))})]})]}),r.jsxs(Bs,{children:[r.jsx(ee,{variant:"outline",onClick:Yo,children:"Cancel"}),r.jsx(ee,{onClick:Vd,disabled:zt,children:zt?"Saving...":"Save Changes"})]})]})}),r.jsx(Or,{open:Rr,onOpenChange:Gr,children:r.jsxs(Ir,{children:[r.jsxs($r,{children:[r.jsx(Fr,{className:"text-destructive",children:"Delete Brokerage"}),r.jsxs(Zn,{children:['Are you sure you want to delete "',Ur==null?void 0:Ur.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 "',Ur==null?void 0:Ur.name,'"']}),r.jsxs("li",{children:["All ",l.filter(jt=>jt.brokerage_id===(Ur==null?void 0:Ur.id)).length," member(s) assigned to this brokerage"]}),r.jsx("li",{children:"All their data, roles, and access"})]})]})}),r.jsxs(Bs,{children:[r.jsx(ee,{variant:"outline",onClick:()=>Gr(!1),children:"Cancel"}),r.jsx(ee,{variant:"destructive",onClick:Xo,disabled:_s,children:_s?"Deleting...":"Yes, Delete Brokerage"})]})]})}),r.jsx(Or,{open:Rn,onOpenChange:ea,children:r.jsxs(Ir,{className:"max-w-4xl max-h-[85vh] overflow-hidden flex flex-col",children:[r.jsxs($r,{children:[r.jsxs(Fr,{className:"flex items-center gap-2",children:[r.jsx(hi,{className:"h-5 w-5"}),"Manage ",ca==null?void 0:ca.name]}),r.jsx(Zn,{children:"Add, remove, or manage users in this brokerage"})]}),ca&&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(Sa,{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:Ii,onChange:jt=>$o(jt.target.value),className:"pl-10 h-9"})]}),r.jsxs(Or,{open:Va,onOpenChange:cs,children:[r.jsx(Zo,{asChild:!0,children:r.jsxs(ee,{size:"sm",children:[r.jsx(vf,{className:"h-4 w-4 mr-1"}),"Add New Agent"]})}),r.jsxs(Ir,{children:[r.jsxs($r,{children:[r.jsx(Fr,{children:"Add New Agent"}),r.jsxs(Zn,{children:["Create a new agent for ",ca.name]})]}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{htmlFor:"agent-name",children:"Name"}),r.jsx(dt,{id:"agent-name",placeholder:"John Doe",value:ta.name,onChange:jt=>ds({...ta,name:jt.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{htmlFor:"agent-email",children:"Email"}),r.jsx(dt,{id:"agent-email",type:"email",placeholder:"john@example.com",value:ta.email,onChange:jt=>ds({...ta,email:jt.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{htmlFor:"agent-password",children:"Password"}),r.jsx(dt,{id:"agent-password",type:"password",placeholder:"Min 6 characters",value:ta.password,onChange:jt=>ds({...ta,password:jt.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{htmlFor:"agent-phone",children:"Phone (optional)"}),r.jsx(dt,{id:"agent-phone",type:"tel",placeholder:"555-123-4567",value:ta.phone,onChange:jt=>ds({...ta,phone:jt.target.value})})]})]}),r.jsxs(Bs,{children:[r.jsx(ee,{variant:"outline",onClick:()=>cs(!1),children:"Cancel"}),r.jsx(ee,{onClick:Zy,disabled:Hs,children:Hs?"Creating...":"Create Agent"})]})]})]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx($e,{className:"text-sm text-muted-foreground whitespace-nowrap",children:"Add existing user:"}),r.jsxs(Vc,{open:Gi,onOpenChange:dc,children:[r.jsx(Hc,{asChild:!0,children:r.jsxs(ee,{variant:"outline",role:"combobox","aria-expanded":Gi,className:"w-[300px] justify-between",children:["Select a user to add...",r.jsx(Sa,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),r.jsx(Mc,{className:"w-[300px] p-0",align:"start",children:r.jsxs(Ey,{children:[r.jsx(Iy,{placeholder:"Search users...",value:go,onValueChange:uc}),r.jsxs(Py,{children:[r.jsx(Ly,{children:"No users found."}),r.jsx(Oy,{children:Yc(ca.id).filter(jt=>go===""||jt.name.toLowerCase().includes(go.toLowerCase())||jt.email.toLowerCase().includes(go.toLowerCase())).map(jt=>r.jsxs(Dy,{value:`${jt.name} ${jt.email}`,onSelect:()=>{Ky(jt.id,ca.id),dc(!1),uc("")},children:[jt.name," (",jt.email,")"]},jt.id))})]})]})})]})]}),r.jsx("div",{className:"flex-1 overflow-auto border rounded-lg",children:r.jsxs(Ks,{children:[r.jsx(Zs,{children:r.jsxs(Mr,{className:"bg-muted/30 hover:bg-muted/30",children:[r.jsx(It,{className:"font-semibold",children:"Name"}),r.jsx(It,{className:"font-semibold",children:"Email"}),r.jsx(It,{className:"font-semibold",children:"Status"}),r.jsx(It,{className:"font-semibold",children:"Role"}),r.jsx(It,{className:"w-[120px]"})]})}),r.jsx(Ys,{children:Tu(ca.id).length===0?r.jsx(Mr,{children:r.jsx(kt,{colSpan:5,className:"text-center py-8 text-muted-foreground",children:Ii?"No matching members found":"No members in this brokerage"})}):Tu(ca.id).map(jt=>r.jsxs(Mr,{className:"hover:bg-muted/30",children:[r.jsx(kt,{className:"font-medium",children:jt.name}),r.jsx(kt,{className:"text-muted-foreground",children:jt.email}),r.jsx(kt,{children:jt.claimed?r.jsx(Pt,{variant:"default",className:"bg-green-500/10 text-green-600 hover:bg-green-500/20",children:"Active"}):r.jsx(Pt,{variant:"secondary",children:"Pending"})}),r.jsx(kt,{children:jt.roles.includes("brokerage_manager")?r.jsxs(Pt,{variant:"outline",className:"gap-1",children:[r.jsx(yf,{className:"h-3 w-3"}),"Manager"]}):r.jsx("span",{className:"text-muted-foreground text-sm",children:"Agent"})}),r.jsx(kt,{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:()=>ra(jt.id),title:"Resend welcome email",children:r.jsx(Ns,{className:"h-4 w-4"})}),r.jsx(ee,{size:"icon",variant:"ghost",className:"h-8 w-8",onClick:()=>Gy(jt.id),title:"Remove from brokerage",children:r.jsx(hs,{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:()=>Gm(jt.id),disabled:a||jt.id===(t==null?void 0:t.id),title:jt.id===(t==null?void 0:t.id)?"Cannot impersonate yourself":`Login as ${jt.name}`,children:a?r.jsx(Zr,{className:"h-4 w-4 animate-spin"}):r.jsx(TS,{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:()=>Ha(jt.id,jt.name),title:"Delete user",children:r.jsx(Bn,{className:"h-4 w-4"})})]})})]},jt.id))})]})}),r.jsxs("div",{className:"text-sm text-muted-foreground",children:[zh(ca.id).length," total member",zh(ca.id).length!==1?"s":""," •",zh(ca.id).filter(jt=>jt.roles.includes("brokerage_manager")).length," manager",zh(ca.id).filter(jt=>jt.roles.includes("brokerage_manager")).length!==1?"s":""]})]}),r.jsx(Bs,{children:r.jsx(ee,{variant:"outline",onClick:Wm,children:"Close"})})]})})]}),r.jsx(Mn,{value:"celebrations",children:r.jsx(KNt,{})})]})]}),r.jsx(R9e,{open:bi,onOpenChange:sr,brokerages:x,onSuccess:va}),pr&&r.jsx(F9e,{open:Lt,onOpenChange:jt=>{Vt(jt),jt||or(null)},userId:pr.id,userName:pr.name})]})},YNt=()=>{const[e,t]=E.useState([]),[n,s]=E.useState(!0),[a,o]=E.useState(!1),[l,i]=E.useState(""),[u,p]=E.useState(""),[x,y]=E.useState(""),[_,b]=E.useState("");E.useEffect(()=>{S()},[]);const S=async()=>{const{data:D,error:U}=await Q.from("invite_codes").select("*").order("created_at",{ascending:!1});U?(Ie.error("Failed to load invite codes"),console.error(U)):t(D||[]),s(!1)},k=async D=>{if(D.preventDefault(),!l.trim()){Ie.error("Please enter a code");return}o(!0);const{error:U}=await Q.from("invite_codes").insert({code:l.trim().toUpperCase(),description:u.trim()||null,max_uses:x?parseInt(x):null,trial_days:_?parseInt(_):null});U?U.code==="23505"?Ie.error("This code already exists"):(Ie.error("Failed to create invite code"),console.error(U)):(Ie.success("Invite code created"),i(""),p(""),y(""),b(""),S()),o(!1)},M=async(D,U)=>{const{error:V}=await Q.from("invite_codes").update({is_active:!U}).eq("id",D);V?Ie.error("Failed to update code"):t(e.map(W=>W.id===D?{...W,is_active:!U}:W))},P=async D=>{const{error:U}=await Q.from("invite_codes").delete().eq("id",D);U?Ie.error("Failed to delete code"):(Ie.success("Code deleted"),t(e.filter(V=>V.id!==D)))},T="https://dashboard.relevelup.com",I=D=>{const U=`${T}/join?code=${D}`;navigator.clipboard.writeText(U),Ie.success("Link copied to clipboard")},z=`${T}/join`;return r.jsx(Dr,{title:"Invite Codes",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Mu,{title:"Invite Codes",description:"Manage signup invite codes"}),r.jsxs(Ze,{children:[r.jsxs(Wt,{children:[r.jsx(Yt,{children:"Create New Code"}),r.jsxs(Sn,{children:["Share link: ",r.jsx("code",{className:"bg-muted px-2 py-1 rounded text-sm",children:z})]})]}),r.jsx(et,{children:r.jsxs("form",{onSubmit:k,className:"flex flex-wrap gap-4 items-end",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{htmlFor:"code",children:"Code"}),r.jsx(dt,{id:"code",placeholder:"WELCOME2024",value:l,onChange:D=>i(D.target.value),className:"w-40"})]}),r.jsxs("div",{className:"space-y-2 flex-1 min-w-[200px]",children:[r.jsx($e,{htmlFor:"description",children:"Description (optional)"}),r.jsx(dt,{id:"description",placeholder:"For marketing campaign",value:u,onChange:D=>p(D.target.value)})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{htmlFor:"maxUses",children:"Max Uses"}),r.jsx(dt,{id:"maxUses",type:"number",placeholder:"Unlimited",value:x,onChange:D=>y(D.target.value),className:"w-28"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{htmlFor:"trialDays",children:"Trial Days"}),r.jsx(dt,{id:"trialDays",type:"number",placeholder:"None",value:_,onChange:D=>b(D.target.value),className:"w-28"})]}),r.jsxs(ee,{type:"submit",disabled:a,children:[a?r.jsx(Zr,{className:"h-4 w-4 animate-spin"}):r.jsx(bn,{className:"h-4 w-4 mr-2"}),"Create"]})]})})]}),r.jsxs(Ze,{children:[r.jsx(Wt,{children:r.jsx(Yt,{children:"Active Codes"})}),r.jsx(et,{children:n?r.jsx("div",{className:"flex justify-center py-8",children:r.jsx(Zr,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):e.length===0?r.jsx("p",{className:"text-center py-8 text-muted-foreground",children:"No invite codes yet"}):r.jsxs(Ks,{children:[r.jsx(Zs,{children:r.jsxs(Mr,{children:[r.jsx(It,{children:"Code"}),r.jsx(It,{children:"Description"}),r.jsx(It,{children:"Uses"}),r.jsx(It,{children:"Trial"}),r.jsx(It,{children:"Created"}),r.jsx(It,{children:"Active"}),r.jsx(It,{className:"w-24",children:"Actions"})]})}),r.jsx(Ys,{children:e.map(D=>r.jsxs(Mr,{children:[r.jsx(kt,{className:"font-mono font-medium",children:D.code}),r.jsx(kt,{className:"text-muted-foreground",children:D.description||"—"}),r.jsxs(kt,{children:[D.uses_count,D.max_uses&&` / ${D.max_uses}`]}),r.jsx(kt,{children:D.trial_days?r.jsxs("span",{className:"text-amber-600 dark:text-amber-400 font-medium",children:[D.trial_days," days"]}):r.jsx("span",{className:"text-muted-foreground",children:"—"})}),r.jsx(kt,{className:"text-muted-foreground",children:on(new Date(D.created_at),"MMM d, yyyy")}),r.jsx(kt,{children:r.jsx(Ts,{checked:D.is_active,onCheckedChange:()=>M(D.id,D.is_active)})}),r.jsx(kt,{children:r.jsxs("div",{className:"flex gap-1",children:[r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>I(D.code),title:"Copy invite link",children:r.jsx(Wo,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>P(D.id),className:"text-destructive hover:text-destructive",title:"Delete code",children:r.jsx(Bn,{className:"h-4 w-4"})})]})})]},D.id))})]})})]})]})})},Oae=async e=>{try{const{data:t,error:n}=await Q.from("push_notification_settings").select("is_enabled").eq("setting_key",e).maybeSingle();return n?(console.error("Error checking notification setting:",n),!0):(t==null?void 0:t.is_enabled)??!0}catch(t){return console.error("Error checking notification setting:",t),!0}},xP=async e=>{try{const{data:t,error:n}=await Q.functions.invoke("send-push-notification",{body:e});return n?(console.error("Error sending notification:",n),{success:!1,error:n}):(console.log("Notification sent:",t),{success:!0,data:t})}catch(t){return console.error("Error sending notification:",t),{success:!1,error:t}}},XNt=async(e,t)=>await Oae("new_templates")?xP({title:"New Template Available",body:`Check out the new template: ${e}`,url:`/templates/${t}`}):(console.log("New template notifications are disabled"),{success:!1,skipped:!0}),QNt=async(e,t)=>xP({title:"New Academy Video",body:`New video added: ${e}`,url:`/academy/${t}`}),JNt=async(e,t)=>await Oae("new_events")?xP({title:"New Event",body:`New event: ${e}`,url:`/events/${t}`}):(console.log("New event notifications are disabled"),{success:!1,skipped:!0}),e4t=async(e,t)=>await Oae("new_toolbox")?xP({title:"New Resource Kit",body:`New resource kit available: ${e}`,url:`/toolbox/${t}`}):(console.log("New toolbox notifications are disabled"),{success:!1,skipped:!0}),mpe=async(e,t)=>await Oae("new_social_swag")?xP({title:"New Social Swag",body:`New social swag available: ${e}`,url:`/social-swag/${t}`}):(console.log("New social swag notifications are disabled"),{success:!1,skipped:!0}),jO={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 t4t(){const e=Gn(),t=Hr(),[n,s]=E.useState(!1),[a,o]=E.useState(null),[l,i]=E.useState(jO),[u,p]=E.useState(null),[x,y]=E.useState(null),[_,b]=E.useState(!1),S=E.useRef(null),[k,M]=E.useState(!1),[P,T]=E.useState(null),[I,z]=E.useState(!1),[D,U]=E.useState(null),[V,W]=E.useState(null),[G,J]=E.useState(!0),[ne,oe]=E.useState(""),{data:ge,isLoading:ie}=Kt({queryKey:["admin-events"],queryFn:async()=>{const{data:ke,error:ct}=await Q.from("events").select("*").order("event_date",{ascending:!0});if(ct)throw ct;return ke}}),{data:pe}=Kt({queryKey:["event-registrations-count"],queryFn:async()=>{const{data:ke,error:ct}=await Q.from("event_registrations").select("event_id");if(ct)throw ct;const Ce={};return ke.forEach(Me=>{Ce[Me.event_id]=(Ce[Me.event_id]||0)+1}),Ce}}),{data:se,isLoading:fe}=Kt({queryKey:["event-registrations-details",P==null?void 0:P.id],queryFn:async()=>{if(!P)return[];const{data:ke,error:ct}=await Q.from("event_registrations").select("id, user_id, registered_at, zoom_join_url, zoom_name, zoom_email").eq("event_id",P.id).order("registered_at",{ascending:!1});if(ct)throw ct;if(!ke||ke.length===0)return[];const Ce=ke.map(Ee=>Ee.user_id).filter(Boolean);let Me=[];if(Ce.length>0){const{data:Ee,error:He}=await Q.from("profiles").select("id, name, email").in("id",Ce);if(He)throw He;Me=Ee||[]}const Ge=new Map((Me==null?void 0:Me.map(Ee=>[Ee.id,Ee]))||[]);return ke.map(Ee=>({...Ee,profiles:Ee.user_id&&Ge.get(Ee.user_id)||null}))},enabled:!!P}),{data:he,isLoading:ye}=Kt({queryKey:["event-attendees-details",P==null?void 0:P.id],queryFn:async()=>{if(!P)return[];const{data:ke,error:ct}=await Q.from("event_attendees").select("id, user_id, zoom_email, zoom_name, join_time, leave_time, duration_minutes, manually_added, created_at").eq("event_id",P.id).order("created_at",{ascending:!1});if(ct)throw ct;if(!ke||ke.length===0)return[];const Ce=ke.map(nt=>nt.user_id).filter(Boolean);let Me=[];if(Ce.length>0){const{data:nt,error:yt}=await Q.from("profiles").select("id, name, email").in("id",Ce);if(yt)throw yt;Me=nt||[]}const{data:Ge}=await Q.from("agent_points").select("user_id").eq("event_id",P.id),Ee=new Set((Ge==null?void 0:Ge.map(nt=>nt.user_id))||[]),He=new Map((Me==null?void 0:Me.map(nt=>[nt.id,nt]))||[]);return ke.map(nt=>({...nt,profiles:nt.user_id&&He.get(nt.user_id)||null,points_awarded:nt.user_id?Ee.has(nt.user_id):!1}))},enabled:!!P}),Ae=ke=>{T(ke),M(!0)},we=ir({mutationFn:async ke=>{const{data:{session:ct}}=await Q.auth.getSession();if(!ct)throw new Error("Not authenticated");const Ce=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/zoom-sync-registrations",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${ct.access_token}`},body:JSON.stringify({event_id:ke})}),Me=await Ce.json();if(!Ce.ok)throw new Error(Me.error||"Failed to sync");return Me},onSuccess:ke=>{t.invalidateQueries({queryKey:["event-registrations-details",P==null?void 0:P.id]}),t.invalidateQueries({queryKey:["event-registrations-count"]}),Ie.success(ke.message)},onError:ke=>{Ie.error("Failed to sync: "+ke.message)}}),be=ir({mutationFn:async ke=>{const{data:{session:ct}}=await Q.auth.getSession();if(!ct)throw new Error("Not authenticated");const Ce=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/zoom-sync-attendees",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${ct.access_token}`},body:JSON.stringify({event_id:ke})}),Me=await Ce.json();if(!Ce.ok)throw new Error(Me.error||"Failed to sync attendees");return Me},onSuccess:ke=>{t.invalidateQueries({queryKey:["event-attendees-details",P==null?void 0:P.id]}),t.invalidateQueries({queryKey:["event-leaderboard"]}),t.invalidateQueries({queryKey:["admin-agent-points"]}),ke!=null&&ke.message?Ie.success(ke.message):Ie.success(`Synced ${ke.synced||0} attendees. ${ke.points_awarded||0} points awarded!`)},onError:ke=>{Ie.error("Failed to sync attendees: "+ke.message)}}),_e=ir({mutationFn:async({eventId:ke,testMode:ct})=>{const{data:{session:Ce}}=await Q.auth.getSession();if(!Ce)throw new Error("Not authenticated");const Me=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/send-event-reminder",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${Ce.access_token}`},body:JSON.stringify({event_id:ke,test_mode:ct})}),Ge=await Me.json();if(!Me.ok)throw new Error(Ge.error||"Failed to send reminders");return Ge},onSuccess:ke=>{ke.test?Ie.success(ke.message||"Test email sent!"):Ie.success(ke.message||`Reminder emails sent to ${ke.sent} registrants!`)},onError:ke=>{Ie.error("Failed to send reminders: "+ke.message)}}),{data:Je}=Kt({queryKey:["all-profiles-for-linking"],queryFn:async()=>{let ke=[],ct=0;const Ce=1e3;for(;;){const{data:Me,error:Ge}=await Q.from("profiles").select("id, name, email").order("name",{ascending:!0}).range(ct,ct+Ce-1);if(Ge)throw Ge;if(!Me||Me.length===0||(ke=[...ke,...Me],Me.length{const{error:Ge}=await Q.from("event_attendees").update({user_id:ct}).eq("id",ke);if(Ge)throw Ge;if(Me&&Ce){const{error:He}=await Q.from("zoom_email_aliases").upsert({user_id:ct,zoom_email:Ce.toLowerCase()},{onConflict:"zoom_email"});He&&console.error("Failed to save alias:",He)}const Ee=P==null?void 0:P.id;if(Ee){const{data:He}=await Q.from("user_roles").select("id").eq("user_id",ct).eq("role","admin").single();if(!He){const{data:nt}=await Q.from("agent_points").select("id").eq("user_id",ct).eq("event_id",Ee).single();nt||(await Q.rpc("award_attendance_points",{p_user_id:ct,p_event_id:Ee,p_points:10,p_reason:"Event Attendance (Manual Link)"}),await Q.rpc("check_and_award_badges",{p_user_id:ct}))}}return{userId:ct,zoomEmail:Ce,shouldSaveAlias:Me}},onSuccess:ke=>{t.invalidateQueries({queryKey:["event-attendees-details",P==null?void 0:P.id]}),t.invalidateQueries({queryKey:["event-leaderboard"]}),t.invalidateQueries({queryKey:["admin-agent-points"]});let ct="Attendee linked and points awarded!";ke.shouldSaveAlias&&ke.zoomEmail&&(ct+=` Email "${ke.zoomEmail}" will be auto-matched in the future.`),Ie.success(ct),z(!1),U(null),W(null),oe("")},onError:ke=>{Ie.error("Failed to link attendee: "+ke.message)}}),De=ke=>{U(ke),W(null),J(!0),oe(""),z(!0)},Ue=()=>{!D||!V||Te.mutate({attendeeId:D.id,userId:V,zoomEmail:D.zoom_email,shouldSaveAlias:G})},Be=(Je==null?void 0:Je.filter(ke=>{var Ce,Me;if(!ne)return!0;const ct=ne.toLowerCase();return((Ce=ke.name)==null?void 0:Ce.toLowerCase().includes(ct))||((Me=ke.email)==null?void 0:Me.toLowerCase().includes(ct))}))||[],qe=async ke=>{const ct=ke.name.split(".").pop(),Me=`${`${crypto.randomUUID()}.${ct}`}`,{error:Ge}=await Q.storage.from("event-images").upload(Me,ke);if(Ge)throw Ge;const{data:{publicUrl:Ee}}=Q.storage.from("event-images").getPublicUrl(Me);return Ee},ot=ke=>{var Ce;const ct=(Ce=ke.target.files)==null?void 0:Ce[0];if(ct){if(ct.size>5*1024*1024){Ie.error("Image must be less than 5MB");return}p(ct),y(URL.createObjectURL(ct))}},Mt=()=>{p(null),y(null),i({...l,image_url:""}),S.current&&(S.current.value="")},Oe=ir({mutationFn:async ke=>{b(!0);let ct=ke.image_url;u&&(ct=await qe(u)||"");const Ce=new Date(ke.event_date),[Me,Ge]=ke.event_time.split(":");Ce.setHours(parseInt(Me),parseInt(Ge));const Ee=[new Date(Ce)];if(ke.is_recurring&&ke.recurrence_end_date){let it=new Date(Ce);for(;ke.recurrence_pattern==="weekly"?it=aj(it,1):ke.recurrence_pattern==="biweekly"?it=aj(it,2):it=Ph(it,1),!(it>ke.recurrence_end_date);)Ee.push(new Date(it))}const He=Ee.map(it=>({title:ke.title,description:ke.description||null,image_url:ct||null,video_url:ke.video_url||null,event_date:it.toISOString(),zoom_link:ke.zoom_link,zoom_meeting_id:ke.zoom_meeting_id||null,capacity:ke.capacity?parseInt(ke.capacity):null,is_published:ke.is_published})),{data:nt,error:yt}=await Q.from("events").insert(He).select();if(yt)throw yt;return nt&&nt.length>0&&JNt(ke.title,nt[0].id),Ee.length},onSuccess:ke=>{t.invalidateQueries({queryKey:["admin-events"]}),Ie.success(ke>1?`${ke} recurring events created successfully`:"Event created successfully"),s(!1),i(jO),p(null),y(null),b(!1)},onError:ke=>{Ie.error("Failed to create event: "+ke.message),b(!1)}}),at=ir({mutationFn:async({id:ke,data:ct})=>{b(!0);let Ce=ct.image_url;u&&(Ce=await qe(u)||"");const Me=new Date(ct.event_date),[Ge,Ee]=ct.event_time.split(":");Me.setHours(parseInt(Ge),parseInt(Ee));const{error:He}=await Q.from("events").update({title:ct.title,description:ct.description||null,image_url:Ce||null,video_url:ct.video_url||null,event_date:Me.toISOString(),zoom_link:ct.zoom_link,zoom_meeting_id:ct.zoom_meeting_id||null,capacity:ct.capacity?parseInt(ct.capacity):null,is_published:ct.is_published}).eq("id",ke);if(He)throw He},onSuccess:()=>{t.invalidateQueries({queryKey:["admin-events"]}),Ie.success("Event updated successfully"),s(!1),o(null),i(jO),p(null),y(null),b(!1)},onError:ke=>{Ie.error("Failed to update event: "+ke.message),b(!1)}}),le=ir({mutationFn:async ke=>{const{error:ct}=await Q.from("events").delete().eq("id",ke);if(ct)throw ct},onSuccess:()=>{t.invalidateQueries({queryKey:["admin-events"]}),Ie.success("Event deleted successfully")},onError:ke=>{Ie.error("Failed to delete event: "+ke.message)}}),Ve=ke=>{var Ce;const ct=new Date(ke.event_date);o(ke),i({title:ke.title,description:ke.description||"",image_url:ke.image_url||"",video_url:ke.video_url||"",event_date:ct,event_time:on(ct,"HH:mm"),zoom_link:ke.zoom_link,zoom_meeting_id:ke.zoom_meeting_id||"",capacity:((Ce=ke.capacity)==null?void 0:Ce.toString())||"",is_published:ke.is_published,is_recurring:!1,recurrence_pattern:"weekly",recurrence_end_date:void 0}),y(ke.image_url||null),p(null),s(!0)},Qe=ke=>{if(ke.preventDefault(),!l.event_date){Ie.error("Please select a date");return}if(l.is_recurring&&!l.recurrence_end_date){Ie.error("Please select an end date for recurring events");return}a?at.mutate({id:a.id,data:l}):Oe.mutate(l)},st=()=>{s(!1),o(null),i(jO),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:()=>e("/dashboard"),children:r.jsx(po,{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(Ze,{className:"mb-6",children:[r.jsxs(Wt,{className:"flex flex-row items-center justify-between",children:[r.jsx(Yt,{children:"All Events"}),r.jsxs(Or,{open:n,onOpenChange:ke=>!ke&&st(),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(Ir,{className:"max-w-lg max-h-[90vh] overflow-y-auto",children:[r.jsx($r,{children:r.jsx(Fr,{children:a?"Edit Event":"Create New Event"})}),r.jsxs("form",{onSubmit:Qe,className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{htmlFor:"title",children:"Title *"}),r.jsx(dt,{id:"title",value:l.title,onChange:ke=>i({...l,title:ke.target.value}),placeholder:"Event title",required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{children:"Description"}),r.jsx(ax,{content:l.description,onChange:ke=>i({...l,description:ke}),placeholder:"Event description",minHeight:"120px"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{children:"Event Image"}),r.jsx("input",{type:"file",ref:S,accept:"image/*",onChange:ot,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:Mt,children:r.jsx(hs,{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 ke;return(ke=S.current)==null?void 0:ke.click()},children:[r.jsx(_o,{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($e,{children:"Date *"}),r.jsxs(Vc,{children:[r.jsx(Hc,{asChild:!0,children:r.jsxs(ee,{variant:"outline",className:Bt("w-full justify-start text-left font-normal",!l.event_date&&"text-muted-foreground"),children:[r.jsx(Ss,{className:"mr-2 h-4 w-4"}),l.event_date?on(l.event_date,"PPP"):"Pick a date"]})}),r.jsx(Mc,{className:"w-auto p-0",align:"start",children:r.jsx(Pm,{mode:"single",selected:l.event_date,onSelect:ke=>i({...l,event_date:ke}),initialFocus:!0,className:"p-3 pointer-events-auto"})})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{htmlFor:"time",children:"Time *"}),r.jsx(dt,{id:"time",type:"time",value:l.event_time,onChange:ke=>i({...l,event_time:ke.target.value}),required:!0})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{htmlFor:"zoom_link",children:"Zoom Link *"}),r.jsx(dt,{id:"zoom_link",value:l.zoom_link,onChange:ke=>i({...l,zoom_link:ke.target.value}),placeholder:"https://zoom.us/j/...",required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{htmlFor:"zoom_meeting_id",children:"Zoom Meeting ID (for API registration)"}),r.jsx(dt,{id:"zoom_meeting_id",value:l.zoom_meeting_id,onChange:ke=>i({...l,zoom_meeting_id:ke.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($e,{htmlFor:"video_url",children:"Promo Video URL (optional)"}),r.jsx(dt,{id:"video_url",value:l.video_url,onChange:ke=>i({...l,video_url:ke.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($e,{htmlFor:"capacity",children:"Capacity (optional)"}),r.jsx(dt,{id:"capacity",type:"number",value:l.capacity,onChange:ke=>i({...l,capacity:ke.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(yA,{className:"h-4 w-4 text-muted-foreground"}),r.jsx($e,{htmlFor:"is_recurring",children:"Recurring Event"})]}),r.jsx(Ts,{id:"is_recurring",checked:l.is_recurring,onCheckedChange:ke=>i({...l,is_recurring:ke})})]}),l.is_recurring&&r.jsxs("div",{className:"space-y-3 pt-1",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{children:"Frequency"}),r.jsxs(mn,{value:l.recurrence_pattern,onValueChange:ke=>i({...l,recurrence_pattern:ke}),children:[r.jsx(fn,{children:r.jsx(yn,{})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"weekly",children:"Weekly"}),r.jsx(qt,{value:"biweekly",children:"Every 2 Weeks"}),r.jsx(qt,{value:"monthly",children:"Monthly"})]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{children:"Repeat Until"}),r.jsxs(Vc,{children:[r.jsx(Hc,{asChild:!0,children:r.jsxs(ee,{variant:"outline",className:Bt("w-full justify-start text-left font-normal",!l.recurrence_end_date&&"text-muted-foreground"),children:[r.jsx(Ss,{className:"mr-2 h-4 w-4"}),l.recurrence_end_date?on(l.recurrence_end_date,"PPP"):"Pick end date"]})}),r.jsx(Mc,{className:"w-auto p-0",align:"start",children:r.jsx(Pm,{mode:"single",selected:l.recurrence_end_date,onSelect:ke=>i({...l,recurrence_end_date:ke}),disabled:ke=>ke<(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 ke=1,ct=new Date(l.event_date);for(;ct=l.recurrence_pattern==="weekly"?aj(ct,1):l.recurrence_pattern==="biweekly"?aj(ct,2):Ph(ct,1),!(ct>l.recurrence_end_date);)ke++;return ke})()," events with the same Zoom link"]})]})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx($e,{htmlFor:"is_published",children:"Published"}),r.jsx(Ts,{id:"is_published",checked:l.is_published,onCheckedChange:ke=>i({...l,is_published:ke})})]}),r.jsxs("div",{className:"flex gap-2 pt-4",children:[r.jsx(ee,{type:"button",variant:"outline",onClick:st,className:"flex-1",children:"Cancel"}),r.jsx(ee,{type:"submit",className:"flex-1",disabled:Oe.isPending||at.isPending||_,children:_?"Uploading...":a?"Update Event":l.is_recurring&&l.event_date&&l.recurrence_end_date?"Create Recurring Events":"Create Event"})]})]})]})]})]}),r.jsx(et,{children:ie?r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"Loading events..."}):(ge==null?void 0:ge.length)===0?r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"No events yet. Create your first event!"}):r.jsxs(Ks,{children:[r.jsx(Zs,{children:r.jsxs(Mr,{children:[r.jsx(It,{children:"Title"}),r.jsx(It,{children:"Date & Time"}),r.jsx(It,{children:"Registrations"}),r.jsx(It,{children:"Status"}),r.jsx(It,{className:"text-right",children:"Actions"})]})}),r.jsx(Ys,{children:ge==null?void 0:ge.map(ke=>r.jsxs(Mr,{children:[r.jsx(kt,{className:"font-medium",children:ke.title}),r.jsx(kt,{children:on(new Date(ke.event_date),"PPP p")}),r.jsx(kt,{children:r.jsxs(ee,{variant:"ghost",size:"sm",className:"gap-1",onClick:()=>Ae(ke),children:[r.jsx(Un,{className:"h-4 w-4"}),(pe==null?void 0:pe[ke.id])||0,ke.capacity&&` / ${ke.capacity}`]})}),r.jsx(kt,{children:r.jsx("span",{className:Bt("px-2 py-1 rounded-full text-xs font-medium",ke.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:ke.is_published?"Published":"Draft"})}),r.jsx(kt,{className:"text-right",children:r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>window.open(ke.zoom_link,"_blank"),title:"Open Zoom Link",children:r.jsx(As,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>Ve(ke),children:r.jsx(ni,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>{confirm("Are you sure you want to delete this event?")&&le.mutate(ke.id)},children:r.jsx(Bn,{className:"h-4 w-4 text-destructive"})})]})})]},ke.id))})]})})]}),r.jsx(Or,{open:k,onOpenChange:M,children:r.jsxs(Ir,{className:"max-w-3xl max-h-[80vh] overflow-y-auto",children:[r.jsxs($r,{children:[r.jsxs(Fr,{className:"flex items-center gap-2",children:[r.jsx(Un,{className:"h-5 w-5"}),P==null?void 0:P.title]}),r.jsx(Zn,{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:()=>_e.mutate({eventId:P.id,testMode:!0}),disabled:_e.isPending,children:[r.jsx(Ns,{className:Bt("h-4 w-4 mr-2",_e.isPending&&"animate-spin")}),"Send Test to Me"]}),r.jsxs(ee,{variant:"outline",size:"sm",onClick:()=>_e.mutate({eventId:P.id}),disabled:_e.isPending||!(se!=null&&se.length),children:[r.jsx(Ns,{className:Bt("h-4 w-4 mr-2",_e.isPending&&"animate-spin")}),_e.isPending?"Sending...":"Send Reminder to All"]}),(P==null?void 0:P.zoom_meeting_id)&&r.jsxs(r.Fragment,{children:[r.jsxs(ee,{variant:"outline",size:"sm",onClick:()=>we.mutate(P.id),disabled:we.isPending,children:[r.jsx(qo,{className:Bt("h-4 w-4 mr-2",we.isPending&&"animate-spin")}),we.isPending?"Syncing...":"Sync Registrations"]}),r.jsxs(ee,{variant:"default",size:"sm",onClick:()=>be.mutate(P.id),disabled:be.isPending,children:[r.jsx(ro,{className:Bt("h-4 w-4 mr-2",be.isPending&&"animate-spin")}),be.isPending?"Syncing...":"Sync Attendees & Award Points"]})]})]}),r.jsxs(Ai,{defaultValue:"registrations",className:"w-full",children:[r.jsxs(vi,{className:"grid w-full grid-cols-2",children:[r.jsxs(sn,{value:"registrations",className:"gap-2",children:[r.jsx(Un,{className:"h-4 w-4"}),"Registrations (",(se==null?void 0:se.length)||0,")"]}),r.jsxs(sn,{value:"attendees",className:"gap-2",children:[r.jsx(so,{className:"h-4 w-4"}),"Attendees (",(he==null?void 0:he.length)||0,")"]})]}),r.jsx(Mn,{value:"registrations",className:"mt-4",children:fe?r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"Loading registrations..."}):(se==null?void 0:se.length)===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx("p",{children:"No registrations yet for this event."}),(P==null?void 0:P.zoom_meeting_id)&&r.jsx("p",{className:"text-xs mt-2",children:'Click "Sync Registrations" to import from Zoom.'})]}):r.jsxs(Ks,{children:[r.jsx(Zs,{children:r.jsxs(Mr,{children:[r.jsx(It,{children:"Name"}),r.jsx(It,{children:"Email"}),r.jsx(It,{children:"Registered"}),r.jsx(It,{children:"Status"})]})}),r.jsx(Ys,{children:se==null?void 0:se.map(ke=>{var Ge,Ee;const ct=((Ge=ke.profiles)==null?void 0:Ge.name)||ke.zoom_name||"Unknown",Ce=((Ee=ke.profiles)==null?void 0:Ee.email)||ke.zoom_email||null,Me=!ke.user_id;return r.jsxs(Mr,{children:[r.jsx(kt,{className:"font-medium",children:r.jsxs("div",{className:"flex items-center gap-2",children:[ct,Me&&r.jsx("span",{className:"text-xs px-1.5 py-0.5 rounded bg-muted text-muted-foreground",children:"External"})]})}),r.jsx(kt,{children:Ce?r.jsxs("a",{href:`mailto:${Ce}`,className:"flex items-center gap-1 text-primary hover:underline",children:[r.jsx(Ns,{className:"h-3 w-3"}),Ce]}):r.jsx("span",{className:"text-muted-foreground",children:"No email"})}),r.jsx(kt,{className:"text-muted-foreground text-sm",children:on(new Date(ke.registered_at),"MMM d, yyyy h:mm a")}),r.jsx(kt,{children:ke.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"})})]},ke.id)})})]})}),r.jsx(Mn,{value:"attendees",className:"mt-4",children:ye?r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"Loading attendees..."}):(he==null?void 0:he.length)===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx("p",{children:"No attendees recorded yet."}),(P==null?void 0:P.zoom_meeting_id)&&r.jsx("p",{className:"text-xs mt-2",children:'Click "Sync Attendees & Award Points" after the event ends to import actual participants from Zoom.'})]}):r.jsxs(r.Fragment,{children:[(he==null?void 0:he.filter(ke=>!ke.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(yl,{className:"h-4 w-4 text-amber-600 dark:text-amber-400"}),r.jsxs("h4",{className:"font-medium text-amber-800 dark:text-amber-200",children:["Unmatched Attendees (",he==null?void 0:he.filter(ke=>!ke.user_id).length,")"]})]}),r.jsx("p",{className:"text-xs text-amber-700 dark:text-amber-300 mb-3",children:"These attendees couldn't be matched to a profile. Link them to award points."}),r.jsx("div",{className:"space-y-2",children:he==null?void 0:he.filter(ke=>!ke.user_id).map(ke=>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:ke.zoom_name||"Unknown"}),r.jsx("span",{className:"text-xs text-muted-foreground",children:ke.zoom_email||"No email"})]}),r.jsxs(ee,{variant:"outline",size:"sm",onClick:()=>De(ke),className:"gap-1",children:[r.jsx(mf,{className:"h-3 w-3"}),"Link to Profile"]})]},ke.id))})]}),r.jsxs(Ks,{children:[r.jsx(Zs,{children:r.jsxs(Mr,{children:[r.jsx(It,{children:"Name"}),r.jsx(It,{children:"Email"}),r.jsx(It,{children:"Duration"}),r.jsx(It,{children:"Points"})]})}),r.jsx(Ys,{children:he==null?void 0:he.filter(ke=>ke.user_id).map(ke=>{var Me,Ge;const ct=((Me=ke.profiles)==null?void 0:Me.name)||ke.zoom_name||"Unknown",Ce=((Ge=ke.profiles)==null?void 0:Ge.email)||ke.zoom_email||null;return r.jsxs(Mr,{children:[r.jsx(kt,{className:"font-medium",children:r.jsxs("div",{className:"flex items-center gap-2",children:[ct,ke.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(kt,{children:Ce?r.jsxs("a",{href:`mailto:${Ce}`,className:"flex items-center gap-1 text-primary hover:underline",children:[r.jsx(Ns,{className:"h-3 w-3"}),Ce]}):r.jsx("span",{className:"text-muted-foreground",children:"No email"})}),r.jsx(kt,{children:ke.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"}),ke.duration_minutes," min"]}):r.jsx("span",{className:"text-muted-foreground text-sm",children:"—"})}),r.jsx(kt,{children:ke.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(ro,{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"})})]},ke.id)})})]})]})})]})]})}),r.jsx(Or,{open:I,onOpenChange:z,children:r.jsxs(Ir,{className:"max-w-md",children:[r.jsxs($r,{children:[r.jsxs(Fr,{className:"flex items-center gap-2",children:[r.jsx(mf,{className:"h-5 w-5"}),"Link Attendee to Profile"]}),r.jsx(Zn,{children:"Link this Zoom attendee to an existing member profile to award them points."})]}),D&&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:D.zoom_name||"Unknown"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:D.zoom_email||"No email"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{children:"Search for a profile"}),r.jsxs("div",{className:"relative",children:[r.jsx(Sa,{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:ne,onChange:ke=>oe(ke.target.value),className:"pl-9"})]})]}),r.jsx("div",{className:"max-h-48 overflow-y-auto border rounded-md",children:Be.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:Be.slice(0,20).map(ke=>r.jsxs("button",{type:"button",onClick:()=>W(ke.id),className:Bt("w-full p-3 text-left hover:bg-muted/50 transition-colors",V===ke.id&&"bg-primary/10 border-l-2 border-primary"),children:[r.jsx("p",{className:"text-sm font-medium",children:ke.name||"Unnamed"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:ke.email})]},ke.id))})}),D.zoom_email&&r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(Bl,{id:"save-alias",checked:G,onCheckedChange:ke=>J(ke)}),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:Ue,disabled:!V||Te.isPending,children:Te.isPending?"Linking...":"Link & Award Points"})]})]})]})})]})})}const r4t=()=>{const{user:e}=tn(),{toast:t}=_i(),n=Hr(),[s,a]=Gc(),[o,l]=E.useState(!1),[i,u]=E.useState(null),[p,x]=E.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,_]=E.useState(null),[b,S]=E.useState(0),[k,M]=E.useState(!1),[P,T]=E.useState(null),[I,z]=E.useState(""),[D,U]=E.useState(""),[V,W]=E.useState(""),[G,J]=E.useState(!1),[ne,oe]=E.useState(!1),{data:ge=[]}=Kt({queryKey:["template-categories"],queryFn:async()=>{const{data:at,error:le}=await Q.from("template_categories").select("*").order("name");if(le)throw le;return at}}),{data:ie=[]}=Kt({queryKey:["template-types"],queryFn:async()=>{const{data:at,error:le}=await Q.from("template_types").select("*").order("name");if(le)throw le;return at}}),{data:pe=[],isLoading:se}=Kt({queryKey:["canva-templates-admin"],queryFn:async()=>{const{data:at,error:le}=await Q.from("canva_templates").select(` *, category:template_categories(id, name), type:template_types(id, name) `).order("publish_date",{ascending:!1});if(le)throw le;const{data:Ve,error:Qe}=await Q.from("template_links").select("*").order("sort_order");if(Qe)throw Qe;const{data:st,error:ke}=await Q.from("template_guides").select("*").order("sort_order");if(ke)throw ke;return at.map(Ce=>({...Ce,links:(Ve==null?void 0:Ve.filter(Me=>Me.template_id===Ce.id))||[],guides:(st==null?void 0:st.filter(Me=>Me.template_id===Ce.id))||[]}))}});E.useEffect(()=>{const at=s.get("edit");if(at&&pe.length>0){const le=pe.find(Ve=>Ve.id===at);le&&(be(le),a({},{replace:!0}))}},[pe,s]);const fe=ir({mutationFn:async at=>{const{data:le,error:Ve}=await Q.from("template_categories").insert({name:at}).select().single();if(Ve)throw Ve;return le},onSuccess:at=>{n.invalidateQueries({queryKey:["template-categories"]}),x({...p,category_id:at.id}),U(""),J(!1),t({title:"Category added"})},onError:at=>{t({title:"Error adding category",description:at.message,variant:"destructive"})}}),he=ir({mutationFn:async at=>{const{data:le,error:Ve}=await Q.from("template_types").insert({name:at}).select().single();if(Ve)throw Ve;return le},onSuccess:at=>{n.invalidateQueries({queryKey:["template-types"]}),x({...p,type_id:at.id}),W(""),oe(!1),t({title:"Type added"})},onError:at=>{t({title:"Error adding type",description:at.message,variant:"destructive"})}}),ye=ir({mutationFn:async at=>{var ke;let le=at.existingImageUrl;if(at.image){const ct=at.image.name.split(".").pop(),Ce=`${Date.now()}-${Math.random().toString(36).substring(7)}.${ct}`,{error:Me}=await Q.storage.from("template-previews").upload(Ce,at.image);if(Me)throw Me;const{data:Ge}=Q.storage.from("template-previews").getPublicUrl(Ce);le=Ge.publicUrl}const Ve={name:at.template.name,description:at.template.description||null,category_id:at.template.category_id||null,type_id:at.template.type_id||null,preview_image_url:le,video_url:at.videoUrl||null,publish_date:at.template.publish_date?new Date(at.template.publish_date).toISOString():new Date().toISOString(),created_by:e==null?void 0:e.id};let Qe=at.templateId;if(Qe){const{error:ct}=await Q.from("canva_templates").update(Ve).eq("id",Qe);if(ct)throw ct;const{error:Ce}=await Q.from("template_links").delete().eq("template_id",Qe);if(Ce)throw Ce;const Me=((ke=at.existingGuides)==null?void 0:ke.map(He=>He.id).filter(Boolean))||[],Ge=at.template.guides.map(He=>He.id).filter(Boolean),Ee=Me.filter(He=>!Ge.includes(He));Ee.length>0&&await Q.from("template_guides").delete().in("id",Ee)}else{const{data:ct,error:Ce}=await Q.from("canva_templates").insert(Ve).select().single();if(Ce)throw Ce;Qe=ct.id,XNt(at.template.name,ct.id)}const st=at.template.links.filter(ct=>ct.title.trim()&&ct.canva_share_link.trim());if(st.length>0){const ct=st.map((Me,Ge)=>({template_id:Qe,title:Me.title.trim(),canva_share_link:Me.canva_share_link.trim(),sort_order:Ge})),{error:Ce}=await Q.from("template_links").insert(ct);if(Ce)throw Ce}for(let ct=0;ct{n.invalidateQueries({queryKey:["canva-templates-admin"]}),n.invalidateQueries({queryKey:["canva-templates"]}),we(),l(!1),t({title:i?"Template updated":"Template created"})},onError:at=>{t({title:"Error saving template",description:at.message,variant:"destructive"})}}),Ae=ir({mutationFn:async at=>{const{error:le}=await Q.from("canva_templates").delete().eq("id",at);if(le)throw le},onSuccess:()=>{n.invalidateQueries({queryKey:["canva-templates-admin"]}),n.invalidateQueries({queryKey:["canva-templates"]}),t({title:"Template deleted"})},onError:at=>{t({title:"Error deleting template",description:at.message,variant:"destructive"})}}),we=()=>{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(""),u(null),J(!1),oe(!1),U(""),W(""),_(null),S(0),M(!1)},be=at=>{var le;u(at),x({name:at.name,description:at.description||"",category_id:at.category_id||"",type_id:at.type_id||"",publish_date:at.publish_date?new Date(at.publish_date).toISOString().split("T")[0]:new Date().toISOString().split("T")[0],links:at.links&&at.links.length>0?at.links.map(Ve=>({id:Ve.id,title:Ve.title,canva_share_link:Ve.canva_share_link,sort_order:Ve.sort_order})):[{title:"",canva_share_link:"",sort_order:0}],guides:((le=at.guides)==null?void 0:le.map(Ve=>({id:Ve.id,name:Ve.name,file_url:Ve.file_url,file_type:Ve.file_type,file_size:Ve.file_size,sort_order:Ve.sort_order})))||[],video_url:at.video_url||""}),z(at.preview_image_url||""),_(null),l(!0)},_e=at=>{var Ve;const le=(Ve=at.target.files)==null?void 0:Ve[0];le&&(T(le),z(URL.createObjectURL(le)))},Je=()=>{x({...p,links:[...p.links,{title:"",canva_share_link:"",sort_order:p.links.length}]})},Te=at=>{if(p.links.length<=1)return;const le=p.links.filter((Ve,Qe)=>Qe!==at);x({...p,links:le})},De=(at,le,Ve)=>{const Qe=[...p.links];Qe[at]={...Qe[at],[le]:Ve},x({...p,links:Qe})},Ue=at=>{const le=at.target.files;if(!le)return;const Ve=Array.from(le).map((Qe,st)=>({name:Qe.name.replace(/\.[^/.]+$/,""),file_url:"",file_type:Qe.type,file_size:Qe.size,sort_order:p.guides.length+st,file:Qe}));x({...p,guides:[...p.guides,...Ve]}),at.target.value=""},Be=at=>{const le=p.guides.filter((Ve,Qe)=>Qe!==at);x({...p,guides:le})},qe=(at,le)=>{const Ve=[...p.guides];Ve[at]={...Ve[at],name:le},x({...p,guides:Ve})},ot=async()=>{if(!y)return null;M(!0),S(0);try{const{data:at,error:le}=await Q.functions.invoke("bunny-upload",{body:{action:"create",title:p.name||y.name}});if(le)throw new Error(le.message);const{videoId:Ve,libraryId:Qe}=at,{data:st,error:ke}=await Q.functions.invoke("bunny-upload",{body:{action:"upload-url",videoId:Ve}});if(ke)throw new Error(ke.message);const ct=new XMLHttpRequest;return await new Promise((Me,Ge)=>{ct.upload.addEventListener("progress",Ee=>{if(Ee.lengthComputable){const He=Math.round(Ee.loaded/Ee.total*100);S(He)}}),ct.addEventListener("load",()=>{ct.status>=200&&ct.status<300?Me():Ge(new Error(`Upload failed with status ${ct.status}`))}),ct.addEventListener("error",()=>Ge(new Error("Upload failed"))),ct.open("PUT",st.uploadUrl),ct.setRequestHeader("AccessKey",st.apiKey),ct.send(y)}),`https://player.mediadelivery.net/embed/${Qe}/${Ve}`}catch(at){return console.error("Bunny upload error:",at),t({title:"Video upload failed",description:at instanceof Error?at.message:"Unknown error",variant:"destructive"}),null}finally{M(!1)}},Mt=at=>{var Ve;const le=(Ve=at.target.files)==null?void 0:Ve[0];le&&_(le),at.target.value=""},Oe=async at=>{if(at.preventDefault(),!p.name.trim()){t({title:"Please enter a template name",variant:"destructive"});return}if(p.links.filter(Qe=>Qe.title.trim()&&Qe.canva_share_link.trim()).length===0){t({title:"Please add at least one Canva link",variant:"destructive"});return}let Ve=p.video_url;if(y){const Qe=await ot();if(!Qe)return;Ve=Qe}ye.mutate({template:p,image:P,existingImageUrl:(i==null?void 0:i.preview_image_url)||null,templateId:i==null?void 0:i.id,existingGuides:i==null?void 0:i.guides,videoUrl:Ve})};return r.jsx(Dr,{title:"Manage Templates",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Mu,{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(Ze,{children:[r.jsx(Wt,{className:"pb-2",children:r.jsx(Yt,{className:"text-sm font-medium text-muted-foreground",children:"Total Templates"})}),r.jsx(et,{children:r.jsx("div",{className:"text-2xl font-bold",children:pe.length})})]}),r.jsxs(Ze,{children:[r.jsx(Wt,{className:"pb-2",children:r.jsx(Yt,{className:"text-sm font-medium text-muted-foreground",children:"Categories"})}),r.jsx(et,{children:r.jsx("div",{className:"text-2xl font-bold",children:ge.length})})]}),r.jsxs(Ze,{children:[r.jsx(Wt,{className:"pb-2",children:r.jsx(Yt,{className:"text-sm font-medium text-muted-foreground",children:"Template Types"})}),r.jsx(et,{children:r.jsx("div",{className:"text-2xl font-bold",children:ie.length})})]})]}),r.jsxs(Or,{open:o,onOpenChange:at=>{l(at),at||we()},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(Ir,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsx($r,{children:r.jsx(Fr,{children:i?"Edit Template":"Add New Template"})}),r.jsxs("form",{onSubmit:Oe,className:"space-y-6 pt-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{htmlFor:"name",children:"Name *"}),r.jsx(dt,{id:"name",value:p.name,onChange:at=>x({...p,name:at.target.value}),placeholder:"Template name",required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{children:"Description"}),r.jsx(ax,{content:p.description,onChange:at=>x({...p,description:at}),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($e,{children:"Canva Links *"}),r.jsxs(ee,{type:"button",variant:"outline",size:"sm",onClick:Je,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((at,le)=>r.jsxs("div",{className:"flex gap-2 items-start p-3 border rounded-lg bg-muted/30",children:[r.jsxs("div",{className:"flex-1 space-y-2",children:[r.jsx(dt,{value:at.title,onChange:Ve=>De(le,"title",Ve.target.value),placeholder:"Link title (e.g., Instagram Post, Story)"}),r.jsx(dt,{value:at.canva_share_link,onChange:Ve=>De(le,"canva_share_link",Ve.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:()=>Te(le),children:r.jsx(hs,{className:"h-4 w-4"})})]},le))})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{children:"Category"}),G?r.jsxs("div",{className:"flex gap-2",children:[r.jsx(dt,{value:D,onChange:at=>U(at.target.value),placeholder:"New category name",className:"flex-1"}),r.jsx(ee,{type:"button",size:"sm",onClick:()=>D.trim()&&fe.mutate(D.trim()),disabled:fe.isPending,children:"Add"}),r.jsx(ee,{type:"button",size:"sm",variant:"ghost",onClick:()=>{J(!1),U("")},children:r.jsx(hs,{className:"h-4 w-4"})})]}):r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(mn,{value:p.category_id,onValueChange:at=>x({...p,category_id:at}),children:[r.jsx(fn,{className:"flex-1",children:r.jsx(yn,{placeholder:"Select category"})}),r.jsx(pn,{children:ge.map(at=>r.jsx(qt,{value:at.id,children:at.name},at.id))})]}),r.jsx(ee,{type:"button",variant:"outline",size:"icon",onClick:()=>J(!0),children:r.jsx(bn,{className:"h-4 w-4"})})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{children:"Template Type"}),ne?r.jsxs("div",{className:"flex gap-2",children:[r.jsx(dt,{value:V,onChange:at=>W(at.target.value),placeholder:"New type name",className:"flex-1"}),r.jsx(ee,{type:"button",size:"sm",onClick:()=>V.trim()&&he.mutate(V.trim()),disabled:he.isPending,children:"Add"}),r.jsx(ee,{type:"button",size:"sm",variant:"ghost",onClick:()=>{oe(!1),W("")},children:r.jsx(hs,{className:"h-4 w-4"})})]}):r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(mn,{value:p.type_id,onValueChange:at=>x({...p,type_id:at}),children:[r.jsx(fn,{className:"flex-1",children:r.jsx(yn,{placeholder:"Select type"})}),r.jsx(pn,{children:ie.map(at=>r.jsx(qt,{value:at.id,children:at.name},at.id))})]}),r.jsx(ee,{type:"button",variant:"outline",size:"icon",onClick:()=>oe(!0),children:r.jsx(bn,{className:"h-4 w-4"})})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{htmlFor:"publish_date",children:"Publish Date"}),r.jsx(dt,{id:"publish_date",type:"date",value:p.publish_date,onChange:at=>x({...p,publish_date:at.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($e,{children:"Preview Image"}),r.jsxs("div",{className:"flex items-start gap-4",children:[I?r.jsxs("div",{className:"relative w-32 h-24 rounded-lg overflow-hidden border bg-muted",children:[r.jsx("img",{src:I,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(hs,{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(Rl,{className:"h-8 w-8 text-muted-foreground/50"})}),r.jsxs("div",{className:"flex-1",children:[r.jsx(dt,{type:"file",accept:"image/*",onChange:_e,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($e,{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($a,{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})})]}):k?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(Zr,{className:"h-4 w-4 animate-spin"}),r.jsxs("span",{className:"text-sm",children:["Uploading video... ",b,"%"]})]}),r.jsx(pd,{value:b,className:"h-2"})]}):y?r.jsxs("div",{className:"flex items-center gap-2 p-3 border rounded-lg bg-muted/30",children:[r.jsx($a,{className:"h-5 w-5 text-muted-foreground shrink-0"}),r.jsx("span",{className:"text-sm flex-1 truncate",children:y.name}),r.jsxs("span",{className:"text-xs text-muted-foreground shrink-0",children:[(y.size/1024/1024).toFixed(1)," MB"]}),r.jsx(ee,{type:"button",variant:"ghost",size:"icon",className:"shrink-0 text-muted-foreground hover:text-destructive h-8 w-8",onClick:()=>_(null),children:r.jsx(hs,{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:Mt,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($a,{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($e,{children:"Guide Files (PDFs)"}),r.jsxs("label",{className:"cursor-pointer",children:[r.jsx(dt,{type:"file",accept:".pdf,.doc,.docx",multiple:!0,onChange:Ue,className:"hidden"}),r.jsx(ee,{type:"button",variant:"outline",size:"sm",className:"gap-1",asChild:!0,children:r.jsxs("span",{children:[r.jsx(_o,{className:"h-3 w-3"}),"Add Files"]})})]})]}),p.guides.length>0?r.jsx("div",{className:"space-y-2",children:p.guides.map((at,le)=>r.jsxs("div",{className:"flex gap-2 items-center p-3 border rounded-lg bg-muted/30",children:[r.jsx(Ea,{className:"h-5 w-5 text-muted-foreground shrink-0"}),r.jsx(dt,{value:at.name,onChange:Ve=>qe(le,Ve.target.value),placeholder:"Guide name",className:"flex-1"}),at.file_size&&r.jsxs("span",{className:"text-xs text-muted-foreground shrink-0",children:[(at.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:()=>Be(le),children:r.jsx(hs,{className:"h-4 w-4"})})]},at.id||le))}):r.jsx("p",{className:"text-sm text-muted-foreground",children:"No guide files added. Upload PDFs to help agents understand how to use this template."})]}),r.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[r.jsx(ee,{type:"button",variant:"outline",onClick:()=>{l(!1),we()},children:"Cancel"}),r.jsx(ee,{type:"submit",disabled:ye.isPending,children:ye.isPending?"Saving...":i?"Update":"Create"})]})]})]})]})]}),r.jsx(Ze,{children:r.jsx(et,{className:"p-0",children:se?r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"Loading..."}):pe.length===0?r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"No templates yet. Add your first template!"}):r.jsxs(Ks,{children:[r.jsx(Zs,{children:r.jsxs(Mr,{children:[r.jsx(It,{children:"Preview"}),r.jsx(It,{children:"Name"}),r.jsx(It,{children:"Links"}),r.jsx(It,{children:"Category"}),r.jsx(It,{children:"Type"}),r.jsx(It,{children:"Publish Date"}),r.jsx(It,{className:"text-right",children:"Actions"})]})}),r.jsx(Ys,{children:pe.map(at=>{var le,Ve,Qe,st,ke;return r.jsxs(Mr,{children:[r.jsx(kt,{children:r.jsx("div",{className:"w-16 h-12 rounded overflow-hidden bg-muted",children:at.preview_image_url?r.jsx("img",{src:at.preview_image_url,alt:at.name,className:"w-full h-full object-cover"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center",children:r.jsx(Rl,{className:"h-4 w-4 text-muted-foreground"})})})}),r.jsx(kt,{className:"font-medium",children:at.name}),r.jsx(kt,{children:r.jsxs("div",{className:"flex flex-col gap-1",children:[r.jsxs(Pt,{variant:"secondary",children:[((le=at.links)==null?void 0:le.length)||0," link",(((Ve=at.links)==null?void 0:Ve.length)||0)!==1?"s":""]}),(((Qe=at.guides)==null?void 0:Qe.length)||0)>0&&r.jsxs(Pt,{variant:"outline",className:"gap-1",children:[r.jsx(Ea,{className:"h-3 w-3"}),(st=at.guides)==null?void 0:st.length," guide",(((ke=at.guides)==null?void 0:ke.length)||0)!==1?"s":""]})]})}),r.jsx(kt,{children:at.category?r.jsx(Pt,{variant:"secondary",children:at.category.name}):r.jsx("span",{className:"text-muted-foreground",children:"-"})}),r.jsx(kt,{children:at.type?r.jsx(Pt,{variant:"outline",children:at.type.name}):r.jsx("span",{className:"text-muted-foreground",children:"-"})}),r.jsx(kt,{className:"text-muted-foreground",children:new Date(at.publish_date).toLocaleDateString()}),r.jsx(kt,{className:"text-right",children:r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(ee,{size:"icon",variant:"ghost",onClick:()=>be(at),children:r.jsx(ni,{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(at.id)},children:r.jsx(Bn,{className:"h-4 w-4"})})]})})]},at.id)})})]})})})]})})};function z9e({selectedTemplateIds:e,onChange:t}){const[n,s]=E.useState(""),[a,o]=E.useState(!1),{data:l=[]}=Kt({queryKey:["all-canva-templates-picker"],queryFn:async()=>{const{data:y,error:_}=await Q.from("canva_templates").select("id, name, preview_image_url").order("name");if(_)throw _;return y}}),i=l.filter(y=>e.includes(y.id)),u=l.filter(y=>!e.includes(y.id)&&y.name.toLowerCase().includes(n.toLowerCase())),p=y=>{t([...e,y])},x=y=>{t(e.filter(_=>_!==y))};return r.jsxs("div",{className:"space-y-2",children:[r.jsxs($e,{className:"flex items-center gap-2",children:[r.jsx(Dj,{className:"h-4 w-4"}),"Linked Templates"]}),i.length>0&&r.jsx("div",{className:"flex flex-wrap gap-1.5",children:i.map(y=>r.jsxs(Pt,{variant:"secondary",className:"gap-1 pr-1",children:[y.name,r.jsx("button",{type:"button",onClick:()=>x(y.id),className:"ml-1 rounded-full hover:bg-muted-foreground/20 p-0.5",children:r.jsx(hs,{className:"h-3 w-3"})})]},y.id))}),r.jsxs(Vc,{open:a,onOpenChange:o,children:[r.jsx(Hc,{asChild:!0,children:r.jsxs(ee,{type:"button",variant:"outline",size:"sm",className:"gap-1",children:[r.jsx(Dj,{className:"h-3.5 w-3.5"}),"Add Template"]})}),r.jsxs(Mc,{className:"w-80 p-2",align:"start",children:[r.jsxs("div",{className:"relative mb-2",children:[r.jsx(Sa,{className:"absolute left-2 top-2.5 h-3.5 w-3.5 text-muted-foreground"}),r.jsx(dt,{placeholder:"Search templates...",value:n,onChange:y=>s(y.target.value),className:"pl-7 h-8 text-sm"})]}),r.jsx("div",{className:"max-h-48 overflow-y-auto space-y-0.5",children:u.length===0?r.jsx("p",{className:"text-xs text-muted-foreground text-center py-3",children:n?"No templates found":"All templates selected"}):u.map(y=>r.jsxs("button",{type:"button",onClick:()=>{p(y.id),s("")},className:"w-full flex items-center gap-2 px-2 py-1.5 rounded-md hover:bg-muted text-left text-sm transition-colors",children:[y.preview_image_url?r.jsx("img",{src:y.preview_image_url,alt:"",className:"w-8 h-8 rounded object-cover flex-shrink-0"}):r.jsx("div",{className:"w-8 h-8 rounded bg-muted flex items-center justify-center flex-shrink-0",children:r.jsx(Dj,{className:"h-3.5 w-3.5 text-muted-foreground"})}),r.jsx("span",{className:"truncate",children:y.name})]},y.id))})]})]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Link templates that agents can use alongside this content."})]})}const n4t=[{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"}],s4t=()=>{const{user:e}=tn(),[t,n]=Gc(),{toast:s}=_i(),a=Hr(),[o,l]=E.useState(!1),[i,u]=E.useState(null),[p,x]=E.useState({title:"",description:"",video_url:"",video_type:"youtube",duration:"",category_id:"",publish_date:new Date().toISOString().split("T")[0],is_published:!1}),[y,_]=E.useState(null),[b,S]=E.useState(""),[k,M]=E.useState([]),[P,T]=E.useState([]),[I,z]=E.useState([]),[D,U]=E.useState([]),[V,W]=E.useState(""),[G,J]=E.useState(!1),[ne,oe]=E.useState(null),[ge,ie]=E.useState(0),[pe,se]=E.useState(!1),[fe,he]=E.useState(null),{data:ye=[]}=Kt({queryKey:["academy-categories"],queryFn:async()=>{const{data:le,error:Ve}=await Q.from("academy_categories").select("*").order("sort_order",{ascending:!0});if(Ve)throw Ve;return le}}),{data:Ae=[],isLoading:we}=Kt({queryKey:["academy-videos-admin"],queryFn:async()=>{const{data:le,error:Ve}=await Q.from("academy_videos").select(` *, category:academy_categories(id, name) `).order("publish_date",{ascending:!1});if(Ve)throw Ve;const{data:Qe,error:st}=await Q.from("academy_resources").select("*").order("sort_order");if(st)throw st;return le.map(ct=>({...ct,resources:(Qe==null?void 0:Qe.filter(Ce=>Ce.video_id===ct.id))||[]}))}});E.useEffect(()=>{const le=t.get("edit");if(le&&Ae.length>0){const Ve=Ae.find(Qe=>Qe.id===le);Ve&&(Ue(Ve),n({},{replace:!0}))}},[Ae,t]);const be=ir({mutationFn:async le=>{const{data:Ve,error:Qe}=await Q.from("academy_categories").insert({name:le,sort_order:ye.length}).select().single();if(Qe)throw Qe;return Ve},onSuccess:le=>{a.invalidateQueries({queryKey:["academy-categories"]}),x({...p,category_id:le.id}),W(""),J(!1),s({title:"Category added"})},onError:le=>{s({title:"Error adding category",description:le.message,variant:"destructive"})}}),_e=ir({mutationFn:async le=>{let Ve=le.existingThumbnailUrl;if(le.thumbnail){const ke=le.thumbnail.name.split(".").pop(),ct=`thumbnails/${Date.now()}-${Math.random().toString(36).substring(7)}.${ke}`,{error:Ce}=await Q.storage.from("academy-resources").upload(ct,le.thumbnail);if(Ce)throw Ce;const{data:Me}=Q.storage.from("academy-resources").getPublicUrl(ct);Ve=Me.publicUrl}const Qe={title:le.video.title,description:le.video.description||null,video_url:le.video.video_url,video_type:le.video.video_type,duration:le.video.duration||null,thumbnail_url:Ve,category_id:le.video.category_id||null,publish_date:le.video.publish_date?new Date(le.video.publish_date).toISOString():new Date().toISOString(),is_published:le.video.is_published,created_by:e==null?void 0:e.id};let st=le.videoId;if(st){const{error:ke}=await Q.from("academy_videos").update(Qe).eq("id",st);if(ke)throw ke}else{const{data:ke,error:ct}=await Q.from("academy_videos").insert(Qe).select().single();if(ct)throw ct;st=ke.id,QNt(le.video.title,ke.id)}if(le.resourcesToDelete.length>0){const{error:ke}=await Q.from("academy_resources").delete().in("id",le.resourcesToDelete);if(ke)throw ke}for(let ke=0;ke0){const{error:ke}=await Q.from("academy_video_templates").insert(D.map(ct=>({video_id:st,template_id:ct})));if(ke)throw ke}},onSuccess:()=>{a.invalidateQueries({queryKey:["academy-videos-admin"]}),a.invalidateQueries({queryKey:["academy-videos"]}),De(),l(!1),s({title:i?"Video updated":"Video created"})},onError:le=>{s({title:"Error saving video",description:le.message,variant:"destructive"})}}),Je=ir({mutationFn:async le=>{const{error:Ve}=await Q.from("academy_videos").delete().eq("id",le);if(Ve)throw Ve},onSuccess:()=>{a.invalidateQueries({queryKey:["academy-videos-admin"]}),a.invalidateQueries({queryKey:["academy-videos"]}),s({title:"Video deleted"})},onError:le=>{s({title:"Error deleting video",description:le.message,variant:"destructive"})}}),Te=ir({mutationFn:async({id:le,is_published:Ve})=>{const{error:Qe}=await Q.from("academy_videos").update({is_published:Ve}).eq("id",le);if(Qe)throw Qe},onSuccess:()=>{a.invalidateQueries({queryKey:["academy-videos-admin"]}),a.invalidateQueries({queryKey:["academy-videos"]})},onError:le=>{s({title:"Error updating video",description:le.message,variant:"destructive"})}}),De=()=>{x({title:"",description:"",video_url:"",video_type:"bunny_stream",duration:"",category_id:"",publish_date:new Date().toISOString().split("T")[0],is_published:!1}),_(null),S(""),M([]),T([]),z([]),u(null),U([]),W(""),oe(null),ie(0),se(!1),he(null)},Ue=async le=>{u(le),x({title:le.title,description:le.description||"",video_url:le.video_url,video_type:le.video_type,duration:le.duration||"",category_id:le.category_id||"",publish_date:le.publish_date?new Date(le.publish_date).toISOString().split("T")[0]:new Date().toISOString().split("T")[0],is_published:le.is_published}),S(le.thumbnail_url||""),T(le.resources||[]),M([]),z([]);const{data:Ve}=await Q.from("academy_video_templates").select("template_id").eq("video_id",le.id);U((Ve||[]).map(Qe=>Qe.template_id)),l(!0)},Be=le=>{var Qe;const Ve=(Qe=le.target.files)==null?void 0:Qe[0];Ve&&(_(Ve),S(URL.createObjectURL(Ve)))},qe=le=>{const Ve=le.target.files;if(Ve){const Qe=Array.from(Ve).map(st=>({file:st,title:st.name.replace(/\.[^/.]+$/,"")}));M([...k,...Qe])}le.target.value=""},ot=le=>{M(k.filter((Ve,Qe)=>Qe!==le))},Mt=le=>{z([...I,le]),T(P.filter(Ve=>Ve.id!==le))},Oe=async()=>{if(!ne)return null;se(!0),ie(0);try{const{data:le,error:Ve}=await Q.functions.invoke("bunny-upload",{body:{action:"create",title:p.title||ne.name}});if(Ve)throw new Error(Ve.message);const{videoId:Qe,libraryId:st}=le;he(Qe);const{data:ke,error:ct}=await Q.functions.invoke("bunny-upload",{body:{action:"upload-url",videoId:Qe}});if(ct)throw new Error(ct.message);const Ce=new XMLHttpRequest;return await new Promise((Ge,Ee)=>{Ce.upload.addEventListener("progress",He=>{if(He.lengthComputable){const nt=Math.round(He.loaded/He.total*100);ie(nt)}}),Ce.addEventListener("load",()=>{Ce.status>=200&&Ce.status<300?Ge():Ee(new Error(`Upload failed with status ${Ce.status}`))}),Ce.addEventListener("error",()=>Ee(new Error("Upload failed"))),Ce.open("PUT",ke.uploadUrl),Ce.setRequestHeader("AccessKey",ke.apiKey),Ce.send(ne)}),`https://player.mediadelivery.net/embed/${st}/${Qe}`}catch(le){return console.error("Bunny upload error:",le),s({title:"Video upload failed",description:le instanceof Error?le.message:"Unknown error",variant:"destructive"}),null}finally{se(!1)}},at=async le=>{if(le.preventDefault(),!p.title.trim()){s({title:"Please enter a video title",variant:"destructive"});return}let Ve=p.video_url;if(p.video_type==="bunny_stream"&&ne&&!i){const Qe=await Oe();if(!Qe)return;Ve=Qe}else if(!p.video_url.trim()&&p.video_type!=="bunny_stream"){s({title:"Please enter a video URL",variant:"destructive"});return}else if(p.video_type==="bunny_stream"&&!ne&&!p.video_url&&!i){s({title:"Please select a video file to upload",variant:"destructive"});return}_e.mutate({video:{...p,video_url:Ve},thumbnail:y,existingThumbnailUrl:(i==null?void 0:i.thumbnail_url)||null,videoId:i==null?void 0:i.id,newResources:k,resourcesToDelete:I})};return r.jsx(Dr,{title:"Manage Academy",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Mu,{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(Ze,{children:[r.jsx(Wt,{className:"pb-2",children:r.jsx(Yt,{className:"text-sm font-medium text-muted-foreground",children:"Total Videos"})}),r.jsx(et,{children:r.jsx("div",{className:"text-2xl font-bold",children:Ae.length})})]}),r.jsxs(Ze,{children:[r.jsx(Wt,{className:"pb-2",children:r.jsx(Yt,{className:"text-sm font-medium text-muted-foreground",children:"Published"})}),r.jsx(et,{children:r.jsx("div",{className:"text-2xl font-bold",children:Ae.filter(le=>le.is_published).length})})]})]}),r.jsxs(Or,{open:o,onOpenChange:le=>{l(le),le||De()},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(Ir,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsx($r,{children:r.jsx(Fr,{children:i?"Edit Video":"Add New Video"})}),r.jsxs("form",{onSubmit:at,className:"space-y-6 pt-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{htmlFor:"title",children:"Title *"}),r.jsx(dt,{id:"title",value:p.title,onChange:le=>x({...p,title:le.target.value}),placeholder:"Video title",required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{children:"Description"}),r.jsx(ax,{content:p.description,onChange:le=>x({...p,description:le}),placeholder:"Brief description of the video",minHeight:"120px"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{children:"Video Type"}),r.jsxs(mn,{value:p.video_type,onValueChange:le=>{x({...p,video_type:le,video_url:""}),oe(null)},disabled:pe,children:[r.jsx(fn,{children:r.jsx(yn,{})}),r.jsx(pn,{children:n4t.map(le=>r.jsx(qt,{value:le.value,children:le.label},le.value))})]})]}),p.video_type==="bunny_stream"?r.jsxs("div",{className:"space-y-3",children:[r.jsxs($e,{children:["Upload Video File ",!i&&"*"]}),i&&p.video_url&&r.jsxs("p",{className:"text-sm text-muted-foreground",children:["Current video: ",r.jsx("a",{href:p.video_url,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"View"})]}),!i&&r.jsxs(r.Fragment,{children:[r.jsx(dt,{type:"file",accept:"video/*",onChange:le=>{var Qe;const Ve=(Qe=le.target.files)==null?void 0:Qe[0];Ve&&oe(Ve)},disabled:pe}),ne&&r.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[r.jsx($a,{className:"h-4 w-4"}),ne.name," (",(ne.size/(1024*1024)).toFixed(1)," MB)"]}),pe&&r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Zr,{className:"h-4 w-4 animate-spin"}),r.jsx("span",{className:"text-sm",children:"Uploading to Bunny.net..."})]}),r.jsx(pd,{value:ge,className:"h-2"}),r.jsxs("p",{className:"text-xs text-muted-foreground text-right",children:[ge,"%"]})]})]})]}):r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{htmlFor:"video_url",children:"Video URL *"}),r.jsx(dt,{id:"video_url",value:p.video_url,onChange:le=>x({...p,video_url:le.target.value}),placeholder:"https://...",required:!0})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{htmlFor:"duration",children:"Duration"}),r.jsx(dt,{id:"duration",value:p.duration,onChange:le=>x({...p,duration:le.target.value}),placeholder:"e.g., 45:30"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{htmlFor:"publish_date",children:"Publish Date"}),r.jsx(dt,{id:"publish_date",type:"date",value:p.publish_date,onChange:le=>x({...p,publish_date:le.target.value})})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{children:"Category"}),G?r.jsxs("div",{className:"flex gap-2",children:[r.jsx(dt,{value:V,onChange:le=>W(le.target.value),placeholder:"New category name",className:"flex-1"}),r.jsx(ee,{type:"button",size:"sm",onClick:()=>V.trim()&&be.mutate(V.trim()),disabled:be.isPending,children:"Add"}),r.jsx(ee,{type:"button",size:"sm",variant:"ghost",onClick:()=>{J(!1),W("")},children:r.jsx(hs,{className:"h-4 w-4"})})]}):r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(mn,{value:p.category_id,onValueChange:le=>x({...p,category_id:le}),children:[r.jsx(fn,{className:"flex-1",children:r.jsx(yn,{placeholder:"Select category"})}),r.jsx(pn,{children:ye.map(le=>r.jsx(qt,{value:le.id,children:le.name},le.id))})]}),r.jsx(ee,{type:"button",variant:"outline",size:"sm",onClick:()=>J(!0),children:r.jsx(bn,{className:"h-4 w-4"})})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{children:"Thumbnail Image"}),r.jsxs("div",{className:"flex items-start gap-4",children:[b&&r.jsx("img",{src:b,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:Be,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($e,{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(_o,{className:"h-3 w-3"}),"Add Files",r.jsx("input",{type:"file",multiple:!0,accept:".pdf,.pptx,.ppt,.xlsx,.xls,.docx,.doc,.zip",onChange:qe,className:"hidden"})]})})]}),(P.length>0||k.length>0)&&r.jsxs("div",{className:"space-y-2 mt-2",children:[P.map(le=>r.jsxs("div",{className:"flex items-center gap-2 p-2 border rounded-md bg-muted/30",children:[r.jsx(Ea,{className:"h-4 w-4 text-muted-foreground"}),r.jsx("span",{className:"flex-1 text-sm truncate",children:le.title}),r.jsx(Pt,{variant:"outline",className:"text-xs",children:le.file_type}),r.jsx(ee,{type:"button",variant:"ghost",size:"sm",onClick:()=>Mt(le.id),className:"text-destructive hover:text-destructive",children:r.jsx(hs,{className:"h-4 w-4"})})]},le.id)),k.map((le,Ve)=>r.jsxs("div",{className:"flex items-center gap-2 p-2 border rounded-md bg-muted/30",children:[r.jsx(Ea,{className:"h-4 w-4 text-muted-foreground"}),r.jsx(dt,{value:le.title,onChange:Qe=>{const st=[...k];st[Ve].title=Qe.target.value,M(st)},className:"flex-1 h-8",placeholder:"Resource title"}),r.jsx(Pt,{variant:"secondary",className:"text-xs",children:"New"}),r.jsx(ee,{type:"button",variant:"ghost",size:"sm",onClick:()=>ot(Ve),className:"text-destructive hover:text-destructive",children:r.jsx(hs,{className:"h-4 w-4"})})]},Ve))]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Supported: PDF, PowerPoint, Excel, Word, ZIP"})]}),r.jsx(z9e,{selectedTemplateIds:D,onChange:U}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ts,{id:"is_published",checked:p.is_published,onCheckedChange:le=>x({...p,is_published:le})}),r.jsx($e,{htmlFor:"is_published",children:"Published"})]}),r.jsxs(Bs,{children:[r.jsx(ee,{type:"button",variant:"outline",onClick:()=>l(!1),disabled:pe,children:"Cancel"}),r.jsx(ee,{type:"submit",disabled:_e.isPending||pe,children:pe?r.jsxs(r.Fragment,{children:[r.jsx(Zr,{className:"h-4 w-4 mr-2 animate-spin"}),"Uploading..."]}):_e.isPending?"Saving...":i?"Update Video":"Add Video"})]})]})]})]})]}),r.jsx(Ze,{children:r.jsx(et,{className:"p-0",children:we?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($a,{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(Ks,{children:[r.jsx(Zs,{children:r.jsxs(Mr,{children:[r.jsx(It,{children:"Title"}),r.jsx(It,{children:"Category"}),r.jsx(It,{children:"Duration"}),r.jsx(It,{children:"Resources"}),r.jsx(It,{children:"Publish Date"}),r.jsx(It,{children:"Status"}),r.jsx(It,{className:"w-[120px]",children:"Actions"})]})}),r.jsx(Ys,{children:Ae.map(le=>r.jsxs(Mr,{children:[r.jsx(kt,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[le.thumbnail_url?r.jsx("img",{src:le.thumbnail_url,alt:"",className:"w-16 h-10 object-cover rounded"}):r.jsx("div",{className:"w-16 h-10 bg-muted rounded flex items-center justify-center",children:r.jsx($a,{className:"h-4 w-4 text-muted-foreground"})}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:le.title}),r.jsx("p",{className:"text-xs text-muted-foreground capitalize",children:le.video_type.replace("_"," ")})]})]})}),r.jsx(kt,{children:le.category?r.jsx(Pt,{variant:"outline",children:le.category.name}):r.jsx("span",{className:"text-muted-foreground text-sm",children:"-"})}),r.jsx(kt,{children:le.duration||"-"}),r.jsx(kt,{children:le.resources&&le.resources.length>0?r.jsxs(Pt,{variant:"secondary",children:[le.resources.length," file(s)"]}):r.jsx("span",{className:"text-muted-foreground text-sm",children:"-"})}),r.jsx(kt,{children:new Date(le.publish_date).toLocaleDateString()}),r.jsx(kt,{children:r.jsx(Ts,{checked:le.is_published,onCheckedChange:Ve=>Te.mutate({id:le.id,is_published:Ve})})}),r.jsx(kt,{children:r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>Ue(le),children:r.jsx(ni,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>Je.mutate(le.id),className:"text-destructive hover:text-destructive",children:r.jsx(Bn,{className:"h-4 w-4"})})]})})]},le.id))})]})})})]})})};function a4t(){var _e,Je,Te;const e=Hr(),[t,n]=Gc(),[s,a]=E.useState(!1),[o,l]=E.useState(null),[i,u]=E.useState({name:"",description:"",publish_date:new Date().toISOString().split("T")[0],is_published:!1}),[p,x]=E.useState(null),[y,_]=E.useState(""),[b,S]=E.useState([]),[k,M]=E.useState([]),[P,T]=E.useState([]),[I,z]=E.useState(null),{data:D,isLoading:U}=Kt({queryKey:["resource-kits"],queryFn:async()=>{const{data:De,error:Ue}=await Q.from("resource_kits").select("*").order("publish_date",{ascending:!1});if(Ue)throw Ue;return De}}),{data:V}=Kt({queryKey:["resource-kit-files"],queryFn:async()=>{const{data:De,error:Ue}=await Q.from("resource_kit_files").select("*").order("sort_order",{ascending:!0});if(Ue)throw Ue;return De}}),{data:W}=Kt({queryKey:["resource-kit-links"],queryFn:async()=>{const{data:De,error:Ue}=await Q.from("resource_kit_links").select("*").order("sort_order",{ascending:!0});if(Ue)throw Ue;return De}});E.useEffect(()=>{const De=t.get("edit");if(De&&D&&D.length>0&&V&&W){const Ue=D.find(Be=>Be.id===De);Ue&&(J(Ue),n({},{replace:!0}))}},[D,V,W,t]);const G=()=>{u({name:"",description:"",publish_date:new Date().toISOString().split("T")[0],is_published:!1}),x(null),_(""),S([]),M([]),T([]),l(null)},J=async De=>{l(De),u({name:De.name,description:De.description||"",publish_date:De.publish_date.split("T")[0],is_published:De.is_published}),_(De.featured_image_url||"");const Ue=(V==null?void 0:V.filter(ot=>ot.kit_id===De.id))||[];S(Ue.map(ot=>({id:ot.id,name:ot.name,file_url:ot.file_url,file_type:ot.file_type,file_size:ot.file_size,sort_order:ot.sort_order})));const Be=(W==null?void 0:W.filter(ot=>ot.kit_id===De.id))||[];M(Be.map(ot=>({id:ot.id,title:ot.title,canva_share_link:ot.canva_share_link,sort_order:ot.sort_order})));const{data:qe}=await Q.from("resource_kit_templates").select("template_id").eq("kit_id",De.id);T((qe||[]).map(ot=>ot.template_id)),a(!0)},ne=De=>{var Be;const Ue=(Be=De.target.files)==null?void 0:Be[0];Ue&&(x(Ue),_(URL.createObjectURL(Ue)))},oe=()=>{S([...b,{name:"",file_url:"",sort_order:b.length}])},ge=De=>{S(b.filter((Ue,Be)=>Be!==De))},ie=(De,Ue,Be)=>{const qe=[...b];qe[De]={...qe[De],[Ue]:Be},S(qe)},pe=()=>{M([...k,{title:"",canva_share_link:"",sort_order:k.length}])},se=De=>{M(k.filter((Ue,Be)=>Be!==De))},fe=(De,Ue,Be)=>{const qe=[...k];qe[De]={...qe[De],[Ue]:Be},M(qe)},he=(De,Ue)=>{var qe;const Be=(qe=Ue.target.files)==null?void 0:qe[0];if(Be){const ot=[...b],Mt=Be.name.replace(/\.[^/.]+$/,"");ot[De]={...ot[De],file:Be,file_type:Be.type,file_size:Be.size,name:ot[De].name||Mt},S(ot)}},ye=ir({mutationFn:async()=>{let De=(o==null?void 0:o.featured_image_url)||null;if(p){const Mt=p.name.split(".").pop(),Oe=`${Date.now()}.${Mt}`,{error:at}=await Q.storage.from("resource-kits").upload(`featured/${Oe}`,p);if(at)throw at;const{data:le}=Q.storage.from("resource-kits").getPublicUrl(`featured/${Oe}`);De=le.publicUrl}const Ue={name:i.name,description:i.description||null,featured_image_url:De,publish_date:i.publish_date,is_published:i.is_published};let Be;const qe=!o,ot=(o==null?void 0:o.is_published)||!1;if(o){const{error:Mt}=await Q.from("resource_kits").update(Ue).eq("id",o.id);if(Mt)throw Mt;Be=o.id;const Oe=(V==null?void 0:V.filter(ke=>ke.kit_id===o.id).map(ke=>ke.id))||[],at=b.filter(ke=>ke.id).map(ke=>ke.id),le=Oe.filter(ke=>!at.includes(ke));le.length>0&&await Q.from("resource_kit_files").delete().in("id",le);const Ve=(W==null?void 0:W.filter(ke=>ke.kit_id===o.id).map(ke=>ke.id))||[],Qe=k.filter(ke=>ke.id).map(ke=>ke.id),st=Ve.filter(ke=>!Qe.includes(ke));st.length>0&&await Q.from("resource_kit_links").delete().in("id",st)}else{const{data:Mt,error:Oe}=await Q.from("resource_kits").insert(Ue).select().single();if(Oe)throw Oe;Be=Mt.id}for(let Mt=0;Mt0){const{error:Mt}=await Q.from("resource_kit_templates").insert(P.map(Oe=>({kit_id:Be,template_id:Oe})));if(Mt)throw Mt}return{kitId:Be,kitName:i.name,isNewKit:qe,wasPublished:ot,isPublished:i.is_published}},onSuccess:De=>{e.invalidateQueries({queryKey:["resource-kits"]}),e.invalidateQueries({queryKey:["resource-kit-files"]}),e.invalidateQueries({queryKey:["resource-kit-links"]}),Ie.success(o?"Resource kit updated":"Resource kit created"),De.isPublished&&(De.isNewKit||!De.wasPublished)&&e4t(De.kitName,De.kitId),a(!1),G()},onError:De=>{Ie.error("Failed to save resource kit: "+De.message)}}),Ae=ir({mutationFn:async De=>{const{error:Ue}=await Q.from("resource_kits").delete().eq("id",De);if(Ue)throw Ue},onSuccess:()=>{e.invalidateQueries({queryKey:["resource-kits"]}),e.invalidateQueries({queryKey:["resource-kit-files"]}),Ie.success("Resource kit deleted")},onError:De=>{Ie.error("Failed to delete: "+De.message)}}),we=De=>{if(De.preventDefault(),!i.name){Ie.error("Please enter a name");return}ye.mutate()},be=De=>(V==null?void 0:V.filter(Ue=>Ue.kit_id===De).length)||0;return r.jsx(Dr,{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(Ze,{children:[r.jsx(Wt,{className:"pb-2",children:r.jsx(Yt,{className:"text-sm font-medium text-muted-foreground",children:"Total Kits"})}),r.jsx(et,{children:r.jsx("div",{className:"text-2xl font-bold",children:(D==null?void 0:D.length)||0})})]}),r.jsxs(Ze,{children:[r.jsx(Wt,{className:"pb-2",children:r.jsx(Yt,{className:"text-sm font-medium text-muted-foreground",children:"Published"})}),r.jsx(et,{children:r.jsx("div",{className:"text-2xl font-bold",children:(D==null?void 0:D.filter(De=>De.is_published).length)||0})})]})]}),r.jsxs(ee,{onClick:()=>{G(),a(!0)},children:[r.jsx(bn,{className:"h-4 w-4 mr-2"}),"Add Resource Kit"]})]}),r.jsx(Ze,{children:r.jsx(et,{className:"p-0",children:r.jsxs(Ks,{children:[r.jsx(Zs,{children:r.jsxs(Mr,{children:[r.jsx(It,{children:"Name"}),r.jsx(It,{children:"Files"}),r.jsx(It,{children:"Publish Date"}),r.jsx(It,{children:"Status"}),r.jsx(It,{className:"text-right",children:"Actions"})]})}),r.jsx(Ys,{children:U?r.jsx(Mr,{children:r.jsx(kt,{colSpan:5,className:"text-center py-8",children:"Loading..."})}):(D==null?void 0:D.length)===0?r.jsx(Mr,{children:r.jsx(kt,{colSpan:5,className:"text-center py-8 text-muted-foreground",children:"No resource kits yet. Create your first one!"})}):D==null?void 0:D.map(De=>r.jsxs(Mr,{children:[r.jsx(kt,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[De.featured_image_url?r.jsx("img",{src:De.featured_image_url,alt:De.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(ql,{className:"h-5 w-5 text-muted-foreground"})}),r.jsxs("div",{children:[r.jsx("div",{className:"font-medium",children:De.name}),De.description&&r.jsx("div",{className:"text-sm text-muted-foreground line-clamp-1",children:De.description})]})]})}),r.jsx(kt,{children:r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(Ea,{className:"h-4 w-4 text-muted-foreground"}),be(De.id)]})}),r.jsx(kt,{children:on(new Date(De.publish_date),"MMM d, yyyy")}),r.jsx(kt,{children:r.jsx("span",{className:`inline-flex items-center px-2 py-1 rounded-full text-xs font-medium ${De.is_published?"bg-green-100 text-green-800":"bg-yellow-100 text-yellow-800"}`,children:De.is_published?"Published":"Draft"})}),r.jsx(kt,{className:"text-right",children:r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>{const Ue=(V==null?void 0:V.filter(qe=>qe.kit_id===De.id))||[],Be=(W==null?void 0:W.filter(qe=>qe.kit_id===De.id))||[];z({...De,files:Ue,links:Be})},children:r.jsx(Ko,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>J(De),children:r.jsx(ni,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>{confirm("Delete this resource kit?")&&Ae.mutate(De.id)},children:r.jsx(Bn,{className:"h-4 w-4 text-destructive"})})]})})]},De.id))})]})})}),r.jsx(Or,{open:s,onOpenChange:a,children:r.jsxs(Ir,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsx($r,{children:r.jsx(Fr,{children:o?"Edit Resource Kit":"Add Resource Kit"})}),r.jsxs("form",{onSubmit:we,className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{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(ql,{className:"h-8 w-8 text-muted-foreground"})}),r.jsx(dt,{type:"file",accept:"image/*",onChange:ne})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{htmlFor:"name",children:"Name *"}),r.jsx(dt,{id:"name",value:i.name,onChange:De=>u({...i,name:De.target.value}),placeholder:"Resource Kit Name"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{children:"Description"}),r.jsx(ax,{content:i.description,onChange:De=>u({...i,description:De}),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($e,{htmlFor:"publish_date",children:"Publish Date"}),r.jsx(dt,{id:"publish_date",type:"date",value:i.publish_date,onChange:De=>u({...i,publish_date:De.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{children:"Published"}),r.jsxs("div",{className:"flex items-center space-x-2 pt-2",children:[r.jsx(Ts,{checked:i.is_published,onCheckedChange:De=>u({...i,is_published:De})}),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($e,{children:"Resource Files"}),r.jsxs(ee,{type:"button",variant:"outline",size:"sm",onClick:oe,children:[r.jsx(bn,{className:"h-4 w-4 mr-1"}),"Add File"]})]}),b.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:b.map((De,Ue)=>r.jsxs("div",{className:"border rounded-md p-3 space-y-2",children:[r.jsxs("div",{className:"flex justify-between items-start",children:[r.jsxs("span",{className:"text-sm font-medium",children:["File ",Ue+1]}),r.jsx(ee,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>ge(Ue),children:r.jsx(hs,{className:"h-4 w-4"})})]}),r.jsx(dt,{placeholder:"File name (e.g., Getting Started Guide)",value:De.name,onChange:Be=>ie(Ue,"name",Be.target.value)}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(dt,{type:"file",onChange:Be=>he(Ue,Be),className:"flex-1"}),De.file_url&&!De.file&&r.jsx("a",{href:De.file_url,target:"_blank",rel:"noopener noreferrer",className:"text-sm text-primary hover:underline whitespace-nowrap",children:"Current file"}),De.file&&r.jsx("span",{className:"text-sm text-green-600 whitespace-nowrap",children:"New file selected"})]})]},Ue))})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsx($e,{children:"Canva Links"}),r.jsxs(ee,{type:"button",variant:"outline",size:"sm",onClick:pe,children:[r.jsx(bn,{className:"h-4 w-4 mr-1"}),"Add Canva Link"]})]}),k.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:k.map((De,Ue)=>r.jsxs("div",{className:"border rounded-md p-3 space-y-2",children:[r.jsxs("div",{className:"flex justify-between items-start",children:[r.jsxs("span",{className:"text-sm font-medium",children:["Canva Link ",Ue+1]}),r.jsx(ee,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>se(Ue),children:r.jsx(hs,{className:"h-4 w-4"})})]}),r.jsx(dt,{placeholder:"Link title (e.g., Social Media Post Template)",value:De.title,onChange:Be=>fe(Ue,"title",Be.target.value)}),r.jsx(dt,{placeholder:"Canva share link (e.g., https://www.canva.com/design/...)",value:De.canva_share_link,onChange:Be=>fe(Ue,"canva_share_link",Be.target.value)})]},Ue))})]}),r.jsx(z9e,{selectedTemplateIds:P,onChange:T}),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:ye.isPending,children:ye.isPending?"Saving...":o?"Update":"Create"})]})]})]})}),r.jsx(Or,{open:!!I,onOpenChange:()=>z(null),children:r.jsxs(Ir,{className:"max-w-lg",children:[r.jsx($r,{children:r.jsx(Fr,{children:I==null?void 0:I.name})}),r.jsxs("div",{className:"space-y-4",children:[(I==null?void 0:I.featured_image_url)&&r.jsx("img",{src:I.featured_image_url,alt:I.name,className:"w-full h-48 object-cover rounded-lg"}),(I==null?void 0:I.description)&&r.jsx("p",{className:"text-muted-foreground",children:I.description}),r.jsxs("div",{children:[r.jsxs("h4",{className:"font-medium mb-2",children:["Resource Files (",((_e=I==null?void 0:I.files)==null?void 0:_e.length)||0,")"]}),((Je=I==null?void 0:I.files)==null?void 0:Je.length)===0?r.jsx("p",{className:"text-sm text-muted-foreground",children:"No files in this kit"}):r.jsx("div",{className:"space-y-2",children:(Te=I==null?void 0:I.files)==null?void 0:Te.map(De=>r.jsxs("a",{href:De.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(Ea,{className:"h-4 w-4 text-primary"}),r.jsx("span",{className:"text-sm",children:De.name})]},De.id))})]}),(I==null?void 0:I.links)&&I.links.length>0&&r.jsxs("div",{children:[r.jsxs("h4",{className:"font-medium mb-2",children:["Canva Links (",I.links.length,")"]}),r.jsx("div",{className:"space-y-2",children:I.links.map(De=>r.jsxs("a",{href:De.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(Io,{className:"h-4 w-4 text-primary"}),r.jsx("span",{className:"text-sm",children:De.title})]},De.id))})]})]})]})})]})})}const i4t=()=>{const{user:e}=tn(),{toast:t}=_i(),n=Hr(),[s,a]=E.useState(!1),[o,l]=E.useState(null),[i,u]=E.useState({title:"",description:"",publish_date:new Date().toISOString().split("T")[0],is_published:!1,links:[{title:"",canva_share_link:"",sort_order:0}]}),[p,x]=E.useState(null),[y,_]=E.useState(""),{data:b=[],isLoading:S}=Kt({queryKey:["social-swag-admin"],queryFn:async()=>{const{data:W,error:G}=await Q.from("social_swag").select("*").order("publish_date",{ascending:!1});if(G)throw G;const{data:J,error:ne}=await Q.from("social_swag_links").select("*").order("sort_order");if(ne)throw ne;return W.map(ge=>({...ge,links:(J==null?void 0:J.filter(ie=>ie.swag_id===ge.id))||[]}))}}),k=ir({mutationFn:async W=>{let G=W.existingImageUrl;if(W.image){const pe=W.image.name.split(".").pop(),se=`${Date.now()}-${Math.random().toString(36).substring(7)}.${pe}`,{error:fe}=await Q.storage.from("template-previews").upload(se,W.image);if(fe)throw fe;const{data:he}=Q.storage.from("template-previews").getPublicUrl(se);G=he.publicUrl}const J={title:W.item.title,description:W.item.description||null,preview_image_url:G,publish_date:W.item.publish_date?new Date(W.item.publish_date).toISOString():new Date().toISOString(),is_published:W.item.is_published,created_by:e==null?void 0:e.id};let ne=W.itemId;const oe=!ne,ge=(o==null?void 0:o.is_published)||!1;if(ne){const{error:pe}=await Q.from("social_swag").update(J).eq("id",ne);if(pe)throw pe;await Q.from("social_swag_links").delete().eq("swag_id",ne)}else{const{data:pe,error:se}=await Q.from("social_swag").insert(J).select().single();if(se)throw se;ne=pe.id}const ie=W.item.links.filter(pe=>pe.title.trim()&&pe.canva_share_link.trim());if(ie.length>0){const pe=ie.map((fe,he)=>({swag_id:ne,title:fe.title.trim(),canva_share_link:fe.canva_share_link.trim(),sort_order:he})),{error:se}=await Q.from("social_swag_links").insert(pe);if(se)throw se}return{itemId:ne,itemTitle:W.item.title,isNewItem:oe,wasPublished:ge,isPublished:W.item.is_published}},onSuccess:W=>{n.invalidateQueries({queryKey:["social-swag-admin"]}),n.invalidateQueries({queryKey:["social-swag"]}),t({title:o?"Item updated":"Item created"}),W.isPublished&&(W.isNewItem||!W.wasPublished)&&mpe(W.itemTitle,W.itemId),a(!1),P()},onError:W=>{t({title:"Error saving item",description:W.message,variant:"destructive"})}}),M=ir({mutationFn:async W=>{const{error:G}=await Q.from("social_swag").delete().eq("id",W);if(G)throw G},onSuccess:()=>{n.invalidateQueries({queryKey:["social-swag-admin"]}),n.invalidateQueries({queryKey:["social-swag"]}),t({title:"Item deleted"})},onError:W=>{t({title:"Error deleting item",description:W.message,variant:"destructive"})}}),P=()=>{u({title:"",description:"",publish_date:new Date().toISOString().split("T")[0],is_published:!1,links:[{title:"",canva_share_link:"",sort_order:0}]}),x(null),_(""),l(null)},T=W=>{l(W),u({title:W.title,description:W.description||"",publish_date:W.publish_date?new Date(W.publish_date).toISOString().split("T")[0]:new Date().toISOString().split("T")[0],is_published:W.is_published,links:W.links&&W.links.length>0?W.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}]}),_(W.preview_image_url||""),a(!0)},I=W=>{var J;const G=(J=W.target.files)==null?void 0:J[0];G&&(x(G),_(URL.createObjectURL(G)))},z=()=>{u({...i,links:[...i.links,{title:"",canva_share_link:"",sort_order:i.links.length}]})},D=W=>{if(i.links.length<=1)return;const G=i.links.filter((J,ne)=>ne!==W);u({...i,links:G})},U=(W,G,J)=>{const ne=[...i.links];ne[W]={...ne[W],[G]:J},u({...i,links:ne})},V=W=>{if(W.preventDefault(),!i.title.trim()){t({title:"Title is required",variant:"destructive"});return}k.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(Dr,{title:"Manage Social Swag",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Mu,{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(Ze,{children:[r.jsx(Wt,{className:"pb-2",children:r.jsx(Yt,{className:"text-sm font-medium text-muted-foreground",children:"Total Items"})}),r.jsx(et,{children:r.jsx("div",{className:"text-2xl font-bold",children:b.length})})]}),r.jsxs(Ze,{children:[r.jsx(Wt,{className:"pb-2",children:r.jsx(Yt,{className:"text-sm font-medium text-muted-foreground",children:"Published"})}),r.jsx(et,{children:r.jsx("div",{className:"text-2xl font-bold",children:b.filter(W=>W.is_published).length})})]})]}),r.jsxs(Or,{open:s,onOpenChange:W=>{a(W),W||P()},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(Ir,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsx($r,{children:r.jsx(Fr,{children:o?"Edit Item":"Add New Item"})}),r.jsxs("form",{onSubmit:V,className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{htmlFor:"title",children:"Title *"}),r.jsx(dt,{id:"title",value:i.title,onChange:W=>u({...i,title:W.target.value}),placeholder:"Enter title"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{children:"Description"}),r.jsx(ax,{content:i.description,onChange:W=>u({...i,description:W}),placeholder:"Enter description",minHeight:"120px"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{htmlFor:"publish_date",children:"Publish Date"}),r.jsx(dt,{id:"publish_date",type:"date",value:i.publish_date,onChange:W=>u({...i,publish_date:W.target.value})})]}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(Ts,{id:"is_published",checked:i.is_published,onCheckedChange:W=>u({...i,is_published:W})}),r.jsx($e,{htmlFor:"is_published",children:"Published"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{children:"Preview Image"}),y?r.jsxs("div",{className:"relative",children:[r.jsx("img",{src:y,alt:"Preview",className:"w-full max-h-48 object-contain rounded-lg border"}),r.jsx(ee,{type:"button",variant:"destructive",size:"icon",className:"absolute top-2 right-2 h-6 w-6",onClick:()=>{x(null),_("")},children:r.jsx(hs,{className:"h-3 w-3"})})]}):r.jsxs("div",{className:"border-2 border-dashed rounded-lg p-4 text-center",children:[r.jsx(Rl,{className:"h-8 w-8 mx-auto text-muted-foreground mb-2"}),r.jsx(dt,{type:"file",accept:"image/*",onChange:I,className:"cursor-pointer"})]})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx($e,{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((W,G)=>r.jsx(Ze,{children:r.jsxs(et,{className:"pt-4 pb-4 space-y-3",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs("span",{className:"text-sm font-medium text-muted-foreground",children:["Link ",G+1]}),i.links.length>1&&r.jsx(ee,{type:"button",variant:"ghost",size:"icon",className:"h-6 w-6 ml-auto",onClick:()=>D(G),children:r.jsx(hs,{className:"h-3 w-3"})})]}),r.jsx(dt,{placeholder:"Link title (e.g., Instagram Post)",value:W.title,onChange:J=>U(G,"title",J.target.value)}),r.jsx(dt,{placeholder:"Canva share link",value:W.canva_share_link,onChange:J=>U(G,"canva_share_link",J.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:k.isPending,children:k.isPending?"Saving...":o?"Update":"Create"})]})]})]})]})]}),r.jsx(Ze,{children:r.jsx(et,{className:"p-0",children:S?r.jsx("div",{className:"flex justify-center py-8",children:r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})}):b.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(Ks,{children:[r.jsx(Zs,{children:r.jsxs(Mr,{children:[r.jsx(It,{className:"w-16",children:"Preview"}),r.jsx(It,{children:"Title"}),r.jsx(It,{children:"Links"}),r.jsx(It,{children:"Publish Date"}),r.jsx(It,{children:"Status"}),r.jsx(It,{className:"text-right",children:"Actions"})]})}),r.jsx(Ys,{children:b.map(W=>{var G;return r.jsxs(Mr,{children:[r.jsx(kt,{children:W.preview_image_url?r.jsx("img",{src:W.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(Rl,{className:"h-4 w-4 text-muted-foreground"})})}),r.jsx(kt,{className:"font-medium",children:W.title}),r.jsxs(kt,{children:[((G=W.links)==null?void 0:G.length)||0," links"]}),r.jsx(kt,{children:new Date(W.publish_date).toLocaleDateString()}),r.jsx(kt,{children:r.jsx(Pt,{variant:W.is_published?"default":"secondary",children:W.is_published?"Published":"Draft"})}),r.jsx(kt,{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/${W.id}`,"_blank"),children:r.jsx(Ko,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>T(W),children:r.jsx(ni,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>{confirm("Are you sure you want to delete this item?")&&M.mutate(W.id)},children:r.jsx(Bn,{className:"h-4 w-4"})})]})})]},W.id)})})]})})})]})})};function o4t(){for(var e=arguments.length,t=new Array(e),n=0;ns=>{t.forEach(a=>a(s))},t)}const Dae=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function D3(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function z0e(e){return"nodeType"in e}function Rh(e){var t,n;return e?D3(e)?e:z0e(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function B0e(e){const{Document:t}=Rh(e);return e instanceof t}function yP(e){return D3(e)?!1:e instanceof Rh(e).HTMLElement}function B9e(e){return e instanceof Rh(e).SVGElement}function R3(e){return e?D3(e)?e.document:z0e(e)?B0e(e)?e:yP(e)||B9e(e)?e.ownerDocument:document:document:document}const Qg=Dae?E.useLayoutEffect:E.useEffect;function $0e(e){const t=E.useRef(e);return Qg(()=>{t.current=e}),E.useCallback(function(){for(var n=arguments.length,s=new Array(n),a=0;a{e.current=setInterval(s,a)},[]),n=E.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function ZE(e,t){t===void 0&&(t=[e]);const n=E.useRef(e);return Qg(()=>{n.current!==e&&(n.current=e)},t),n}function vP(e,t){const n=E.useRef();return E.useMemo(()=>{const s=e(n.current);return n.current=s,s},[...t])}function Yre(e){const t=$0e(e),n=E.useRef(null),s=E.useCallback(a=>{a!==n.current&&(t==null||t(a,n.current)),n.current=a},[]);return[n,s]}function gpe(e){const t=E.useRef();return E.useEffect(()=>{t.current=e},[e]),t.current}let Ede={};function _P(e,t){return E.useMemo(()=>{if(t)return t;const n=Ede[e]==null?0:Ede[e]+1;return Ede[e]=n,e+"-"+n},[e,t])}function $9e(e){return function(t){for(var n=arguments.length,s=new Array(n>1?n-1:0),a=1;a{const i=Object.entries(l);for(const[u,p]of i){const x=o[u];x!=null&&(o[u]=x+e*p)}return o},{...t})}}const JS=$9e(1),YE=$9e(-1);function c4t(e){return"clientX"in e&&"clientY"in e}function U0e(e){if(!e)return!1;const{KeyboardEvent:t}=Rh(e.target);return t&&e instanceof t}function d4t(e){if(!e)return!1;const{TouchEvent:t}=Rh(e.target);return t&&e instanceof t}function xpe(e){if(d4t(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return c4t(e)?{x:e.clientX,y:e.clientY}:null}const XE=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[XE.Translate.toString(e),XE.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:s}=e;return t+" "+n+"ms "+s}}}),VSe="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function u4t(e){return e.matches(VSe)?e:e.querySelector(VSe)}const h4t={display:"none"};function f4t(e){let{id:t,value:n}=e;return lt.createElement("div",{id:t,style:h4t},n)}function p4t(e){let{id:t,announcement:n,ariaLiveType:s="assertive"}=e;const a={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return lt.createElement("div",{id:t,style:a,role:"status","aria-live":s,"aria-atomic":!0},n)}function m4t(){const[e,t]=E.useState("");return{announce:E.useCallback(s=>{s!=null&&t(s)},[]),announcement:e}}const U9e=E.createContext(null);function g4t(e){const t=E.useContext(U9e);E.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of ");return t(e)},[e,t])}function x4t(){const[e]=E.useState(()=>new Set),t=E.useCallback(s=>(e.add(s),()=>e.delete(s)),[e]);return[E.useCallback(s=>{let{type:a,event:o}=s;e.forEach(l=>{var i;return(i=l[a])==null?void 0:i.call(l,o)})},[e]),t]}const y4t={draggable:` To pick up a draggable item, press the space bar. While dragging, use the arrow keys to move the item. Press space again to drop the item in its new position, or press escape to cancel. `},v4t={onDragStart(e){let{active:t}=e;return"Picked up draggable item "+t.id+"."},onDragOver(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was moved over droppable area "+n.id+".":"Draggable item "+t.id+" is no longer over a droppable area."},onDragEnd(e){let{active:t,over:n}=e;return n?"Draggable item "+t.id+" was dropped over droppable area "+n.id:"Draggable item "+t.id+" was dropped."},onDragCancel(e){let{active:t}=e;return"Dragging was cancelled. Draggable item "+t.id+" was dropped."}};function _4t(e){let{announcements:t=v4t,container:n,hiddenTextDescribedById:s,screenReaderInstructions:a=y4t}=e;const{announce:o,announcement:l}=m4t(),i=_P("DndLiveRegion"),[u,p]=E.useState(!1);if(E.useEffect(()=>{p(!0)},[]),g4t(E.useMemo(()=>({onDragStart(y){let{active:_}=y;o(t.onDragStart({active:_}))},onDragMove(y){let{active:_,over:b}=y;t.onDragMove&&o(t.onDragMove({active:_,over:b}))},onDragOver(y){let{active:_,over:b}=y;o(t.onDragOver({active:_,over:b}))},onDragEnd(y){let{active:_,over:b}=y;o(t.onDragEnd({active:_,over:b}))},onDragCancel(y){let{active:_,over:b}=y;o(t.onDragCancel({active:_,over:b}))}}),[o,t])),!u)return null;const x=lt.createElement(lt.Fragment,null,lt.createElement(f4t,{id:s,value:a.draggable}),lt.createElement(p4t,{id:i,announcement:l}));return n?kh.createPortal(x,n):x}var nd;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(nd||(nd={}));function Xre(){}function HSe(e,t){return E.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function b4t(){for(var e=arguments.length,t=new Array(e),n=0;n[...t].filter(s=>s!=null),[...t])}const zm=Object.freeze({x:0,y:0});function q9e(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function V9e(e,t){let{data:{value:n}}=e,{data:{value:s}}=t;return n-s}function w4t(e,t){let{data:{value:n}}=e,{data:{value:s}}=t;return s-n}function WSe(e){let{left:t,top:n,height:s,width:a}=e;return[{x:t,y:n},{x:t+a,y:n},{x:t,y:n+s},{x:t+a,y:n+s}]}function H9e(e,t){if(!e||e.length===0)return null;const[n]=e;return n[t]}function GSe(e,t,n){return t===void 0&&(t=e.left),n===void 0&&(n=e.top),{x:t+e.width*.5,y:n+e.height*.5}}const j4t=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:s}=e;const a=GSe(t,t.left,t.top),o=[];for(const l of s){const{id:i}=l,u=n.get(i);if(u){const p=q9e(GSe(u),a);o.push({id:i,data:{droppableContainer:l,value:p}})}}return o.sort(V9e)},k4t=e=>{let{collisionRect:t,droppableRects:n,droppableContainers:s}=e;const a=WSe(t),o=[];for(const l of s){const{id:i}=l,u=n.get(i);if(u){const p=WSe(u),x=a.reduce((_,b,S)=>_+q9e(p[S],b),0),y=Number((x/4).toFixed(4));o.push({id:i,data:{droppableContainer:l,value:y}})}}return o.sort(V9e)};function N4t(e,t){const n=Math.max(t.top,e.top),s=Math.max(t.left,e.left),a=Math.min(t.left+t.width,e.left+e.width),o=Math.min(t.top+t.height,e.top+e.height),l=a-s,i=o-n;if(s{let{collisionRect:t,droppableRects:n,droppableContainers:s}=e;const a=[];for(const o of s){const{id:l}=o,i=n.get(l);if(i){const u=N4t(i,t);u>0&&a.push({id:l,data:{droppableContainer:o,value:u}})}}return a.sort(w4t)};function C4t(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function W9e(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:zm}function M4t(e){return function(n){for(var s=arguments.length,a=new Array(s>1?s-1:0),o=1;o({...l,top:l.top+e*i.y,bottom:l.bottom+e*i.y,left:l.left+e*i.x,right:l.right+e*i.x}),{...n})}}const T4t=M4t(1);function A4t(e){if(e.startsWith("matrix3d(")){const t=e.slice(9,-1).split(/, /);return{x:+t[12],y:+t[13],scaleX:+t[0],scaleY:+t[5]}}else if(e.startsWith("matrix(")){const t=e.slice(7,-1).split(/, /);return{x:+t[4],y:+t[5],scaleX:+t[0],scaleY:+t[3]}}return null}function E4t(e,t,n){const s=A4t(t);if(!s)return e;const{scaleX:a,scaleY:o,x:l,y:i}=s,u=e.left-l-(1-a)*parseFloat(n),p=e.top-i-(1-o)*parseFloat(n.slice(n.indexOf(" ")+1)),x=a?e.width/a:e.width,y=o?e.height/o:e.height;return{width:x,height:y,top:p,right:u+x,bottom:p+y,left:u}}const I4t={ignoreTransform:!1};function F3(e,t){t===void 0&&(t=I4t);let n=e.getBoundingClientRect();if(t.ignoreTransform){const{transform:p,transformOrigin:x}=Rh(e).getComputedStyle(e);p&&(n=E4t(n,p,x))}const{top:s,left:a,width:o,height:l,bottom:i,right:u}=n;return{top:s,left:a,width:o,height:l,bottom:i,right:u}}function KSe(e){return F3(e,{ignoreTransform:!0})}function P4t(e){const t=e.innerWidth,n=e.innerHeight;return{top:0,left:0,right:t,bottom:n,width:t,height:n}}function L4t(e,t){return t===void 0&&(t=Rh(e).getComputedStyle(e)),t.position==="fixed"}function O4t(e,t){t===void 0&&(t=Rh(e).getComputedStyle(e));const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].some(a=>{const o=t[a];return typeof o=="string"?n.test(o):!1})}function Rae(e,t){const n=[];function s(a){if(t!=null&&n.length>=t||!a)return n;if(B0e(a)&&a.scrollingElement!=null&&!n.includes(a.scrollingElement))return n.push(a.scrollingElement),n;if(!yP(a)||B9e(a)||n.includes(a))return n;const o=Rh(e).getComputedStyle(a);return a!==e&&O4t(a,o)&&n.push(a),L4t(a,o)?n:s(a.parentNode)}return e?s(e):n}function G9e(e){const[t]=Rae(e,1);return t??null}function Ide(e){return!Dae||!e?null:D3(e)?e:z0e(e)?B0e(e)||e===R3(e).scrollingElement?window:yP(e)?e:null:null}function K9e(e){return D3(e)?e.scrollX:e.scrollLeft}function Z9e(e){return D3(e)?e.scrollY:e.scrollTop}function ype(e){return{x:K9e(e),y:Z9e(e)}}var Td;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(Td||(Td={}));function Y9e(e){return!Dae||!e?!1:e===document.scrollingElement}function X9e(e){const t={x:0,y:0},n=Y9e(e)?{height:window.innerHeight,width:window.innerWidth}:{height:e.clientHeight,width:e.clientWidth},s={x:e.scrollWidth-n.width,y:e.scrollHeight-n.height},a=e.scrollTop<=t.y,o=e.scrollLeft<=t.x,l=e.scrollTop>=s.y,i=e.scrollLeft>=s.x;return{isTop:a,isLeft:o,isBottom:l,isRight:i,maxScroll:s,minScroll:t}}const D4t={x:.2,y:.2};function R4t(e,t,n,s,a){let{top:o,left:l,right:i,bottom:u}=n;s===void 0&&(s=10),a===void 0&&(a=D4t);const{isTop:p,isBottom:x,isLeft:y,isRight:_}=X9e(e),b={x:0,y:0},S={x:0,y:0},k={height:t.height*a.y,width:t.width*a.x};return!p&&o<=t.top+k.height?(b.y=Td.Backward,S.y=s*Math.abs((t.top+k.height-o)/k.height)):!x&&u>=t.bottom-k.height&&(b.y=Td.Forward,S.y=s*Math.abs((t.bottom-k.height-u)/k.height)),!_&&i>=t.right-k.width?(b.x=Td.Forward,S.x=s*Math.abs((t.right-k.width-i)/k.width)):!y&&l<=t.left+k.width&&(b.x=Td.Backward,S.x=s*Math.abs((t.left+k.width-l)/k.width)),{direction:b,speed:S}}function F4t(e){if(e===document.scrollingElement){const{innerWidth:o,innerHeight:l}=window;return{top:0,left:0,right:o,bottom:l,width:o,height:l}}const{top:t,left:n,right:s,bottom:a}=e.getBoundingClientRect();return{top:t,left:n,right:s,bottom:a,width:e.clientWidth,height:e.clientHeight}}function Q9e(e){return e.reduce((t,n)=>JS(t,ype(n)),zm)}function z4t(e){return e.reduce((t,n)=>t+K9e(n),0)}function B4t(e){return e.reduce((t,n)=>t+Z9e(n),0)}function $4t(e,t){if(t===void 0&&(t=F3),!e)return;const{top:n,left:s,bottom:a,right:o}=t(e);G9e(e)&&(a<=0||o<=0||n>=window.innerHeight||s>=window.innerWidth)&&e.scrollIntoView({block:"center",inline:"center"})}const U4t=[["x",["left","right"],z4t],["y",["top","bottom"],B4t]];class q0e{constructor(t,n){this.rect=void 0,this.width=void 0,this.height=void 0,this.top=void 0,this.bottom=void 0,this.right=void 0,this.left=void 0;const s=Rae(n),a=Q9e(s);this.rect={...t},this.width=t.width,this.height=t.height;for(const[o,l,i]of U4t)for(const u of l)Object.defineProperty(this,u,{get:()=>{const p=i(s),x=a[o]-p;return this.rect[u]+x},enumerable:!0});Object.defineProperty(this,"rect",{enumerable:!1})}}class KA{constructor(t){this.target=void 0,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var s;return(s=this.target)==null?void 0:s.removeEventListener(...n)})},this.target=t}add(t,n,s){var a;(a=this.target)==null||a.addEventListener(t,n,s),this.listeners.push([t,n,s])}}function q4t(e){const{EventTarget:t}=Rh(e);return e instanceof t?e:R3(e)}function Pde(e,t){const n=Math.abs(e.x),s=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+s**2)>t:"x"in t&&"y"in t?n>t.x&&s>t.y:"x"in t?n>t.x:"y"in t?s>t.y:!1}var Jf;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(Jf||(Jf={}));function ZSe(e){e.preventDefault()}function V4t(e){e.stopPropagation()}var Xi;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter",e.Tab="Tab"})(Xi||(Xi={}));const J9e={start:[Xi.Space,Xi.Enter],cancel:[Xi.Esc],end:[Xi.Space,Xi.Enter,Xi.Tab]},H4t=(e,t)=>{let{currentCoordinates:n}=t;switch(e.code){case Xi.Right:return{...n,x:n.x+25};case Xi.Left:return{...n,x:n.x-25};case Xi.Down:return{...n,y:n.y+25};case Xi.Up:return{...n,y:n.y-25}}};class V0e{constructor(t){this.props=void 0,this.autoScrollEnabled=!1,this.referenceCoordinates=void 0,this.listeners=void 0,this.windowListeners=void 0,this.props=t;const{event:{target:n}}=t;this.props=t,this.listeners=new KA(R3(n)),this.windowListeners=new KA(Rh(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Jf.Resize,this.handleCancel),this.windowListeners.add(Jf.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Jf.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props,s=t.node.current;s&&$4t(s),n(zm)}handleKeyDown(t){if(U0e(t)){const{active:n,context:s,options:a}=this.props,{keyboardCodes:o=J9e,coordinateGetter:l=H4t,scrollBehavior:i="smooth"}=a,{code:u}=t;if(o.end.includes(u)){this.handleEnd(t);return}if(o.cancel.includes(u)){this.handleCancel(t);return}const{collisionRect:p}=s.current,x=p?{x:p.left,y:p.top}:zm;this.referenceCoordinates||(this.referenceCoordinates=x);const y=l(t,{active:n,context:s.current,currentCoordinates:x});if(y){const _=YE(y,x),b={x:0,y:0},{scrollableAncestors:S}=s.current;for(const k of S){const M=t.code,{isTop:P,isRight:T,isLeft:I,isBottom:z,maxScroll:D,minScroll:U}=X9e(k),V=F4t(k),W={x:Math.min(M===Xi.Right?V.right-V.width/2:V.right,Math.max(M===Xi.Right?V.left:V.left+V.width/2,y.x)),y:Math.min(M===Xi.Down?V.bottom-V.height/2:V.bottom,Math.max(M===Xi.Down?V.top:V.top+V.height/2,y.y))},G=M===Xi.Right&&!T||M===Xi.Left&&!I,J=M===Xi.Down&&!z||M===Xi.Up&&!P;if(G&&W.x!==y.x){const ne=k.scrollLeft+_.x,oe=M===Xi.Right&&ne<=D.x||M===Xi.Left&&ne>=U.x;if(oe&&!_.y){k.scrollTo({left:ne,behavior:i});return}oe?b.x=k.scrollLeft-ne:b.x=M===Xi.Right?k.scrollLeft-D.x:k.scrollLeft-U.x,b.x&&k.scrollBy({left:-b.x,behavior:i});break}else if(J&&W.y!==y.y){const ne=k.scrollTop+_.y,oe=M===Xi.Down&&ne<=D.y||M===Xi.Up&&ne>=U.y;if(oe&&!_.x){k.scrollTo({top:ne,behavior:i});return}oe?b.y=k.scrollTop-ne:b.y=M===Xi.Down?k.scrollTop-D.y:k.scrollTop-U.y,b.y&&k.scrollBy({top:-b.y,behavior:i});break}}this.handleMove(t,JS(YE(y,this.referenceCoordinates),b))}}}handleMove(t,n){const{onMove:s}=this.props;t.preventDefault(),s(n)}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}V0e.activators=[{eventName:"onKeyDown",handler:(e,t,n)=>{let{keyboardCodes:s=J9e,onActivation:a}=t,{active:o}=n;const{code:l}=e.nativeEvent;if(s.start.includes(l)){const i=o.activatorNode.current;return i&&e.target!==i?!1:(e.preventDefault(),a==null||a({event:e.nativeEvent}),!0)}return!1}}];function YSe(e){return!!(e&&"distance"in e)}function XSe(e){return!!(e&&"delay"in e)}class H0e{constructor(t,n,s){var a;s===void 0&&(s=q4t(t.event.target)),this.props=void 0,this.events=void 0,this.autoScrollEnabled=!0,this.document=void 0,this.activated=!1,this.initialCoordinates=void 0,this.timeoutId=null,this.listeners=void 0,this.documentListeners=void 0,this.windowListeners=void 0,this.props=t,this.events=n;const{event:o}=t,{target:l}=o;this.props=t,this.events=n,this.document=R3(l),this.documentListeners=new KA(this.document),this.listeners=new KA(s),this.windowListeners=new KA(Rh(l)),this.initialCoordinates=(a=xpe(o))!=null?a:zm,this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:n,bypassActivationConstraint:s}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),t.cancel&&this.listeners.add(t.cancel.name,this.handleCancel),this.windowListeners.add(Jf.Resize,this.handleCancel),this.windowListeners.add(Jf.DragStart,ZSe),this.windowListeners.add(Jf.VisibilityChange,this.handleCancel),this.windowListeners.add(Jf.ContextMenu,ZSe),this.documentListeners.add(Jf.Keydown,this.handleKeydown),n){if(s!=null&&s({event:this.props.event,activeNode:this.props.activeNode,options:this.props.options}))return this.handleStart();if(XSe(n)){this.timeoutId=setTimeout(this.handleStart,n.delay),this.handlePending(n);return}if(YSe(n)){this.handlePending(n);return}}this.handleStart()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll(),setTimeout(this.documentListeners.removeAll,50),this.timeoutId!==null&&(clearTimeout(this.timeoutId),this.timeoutId=null)}handlePending(t,n){const{active:s,onPending:a}=this.props;a(s,t,this.initialCoordinates,n)}handleStart(){const{initialCoordinates:t}=this,{onStart:n}=this.props;t&&(this.activated=!0,this.documentListeners.add(Jf.Click,V4t,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Jf.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){var n;const{activated:s,initialCoordinates:a,props:o}=this,{onMove:l,options:{activationConstraint:i}}=o;if(!a)return;const u=(n=xpe(t))!=null?n:zm,p=YE(a,u);if(!s&&i){if(YSe(i)){if(i.tolerance!=null&&Pde(p,i.tolerance))return this.handleCancel();if(Pde(p,i.distance))return this.handleStart()}if(XSe(i)&&Pde(p,i.tolerance))return this.handleCancel();this.handlePending(i,p);return}t.cancelable&&t.preventDefault(),l(u)}handleEnd(){const{onAbort:t,onEnd:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleCancel(){const{onAbort:t,onCancel:n}=this.props;this.detach(),this.activated||t(this.props.active),n()}handleKeydown(t){t.code===Xi.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const W4t={cancel:{name:"pointercancel"},move:{name:"pointermove"},end:{name:"pointerup"}};class W0e extends H0e{constructor(t){const{event:n}=t,s=R3(n.target);super(t,W4t,s)}}W0e.activators=[{eventName:"onPointerDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:s}=t;return!n.isPrimary||n.button!==0?!1:(s==null||s({event:n}),!0)}}];const G4t={move:{name:"mousemove"},end:{name:"mouseup"}};var vpe;(function(e){e[e.RightClick=2]="RightClick"})(vpe||(vpe={}));class K4t extends H0e{constructor(t){super(t,G4t,R3(t.event.target))}}K4t.activators=[{eventName:"onMouseDown",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:s}=t;return n.button===vpe.RightClick?!1:(s==null||s({event:n}),!0)}}];const Lde={cancel:{name:"touchcancel"},move:{name:"touchmove"},end:{name:"touchend"}};class Z4t extends H0e{constructor(t){super(t,Lde)}static setup(){return window.addEventListener(Lde.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(Lde.move.name,t)};function t(){}}}Z4t.activators=[{eventName:"onTouchStart",handler:(e,t)=>{let{nativeEvent:n}=e,{onActivation:s}=t;const{touches:a}=n;return a.length>1?!1:(s==null||s({event:n}),!0)}}];var ZA;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(ZA||(ZA={}));var Qre;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(Qre||(Qre={}));function Y4t(e){let{acceleration:t,activator:n=ZA.Pointer,canScroll:s,draggingRect:a,enabled:o,interval:l=5,order:i=Qre.TreeOrder,pointerCoordinates:u,scrollableAncestors:p,scrollableAncestorRects:x,delta:y,threshold:_}=e;const b=Q4t({delta:y,disabled:!o}),[S,k]=l4t(),M=E.useRef({x:0,y:0}),P=E.useRef({x:0,y:0}),T=E.useMemo(()=>{switch(n){case ZA.Pointer:return u?{top:u.y,bottom:u.y,left:u.x,right:u.x}:null;case ZA.DraggableRect:return a}},[n,a,u]),I=E.useRef(null),z=E.useCallback(()=>{const U=I.current;if(!U)return;const V=M.current.x*P.current.x,W=M.current.y*P.current.y;U.scrollBy(V,W)},[]),D=E.useMemo(()=>i===Qre.TreeOrder?[...p].reverse():p,[i,p]);E.useEffect(()=>{if(!o||!p.length||!T){k();return}for(const U of D){if((s==null?void 0:s(U))===!1)continue;const V=p.indexOf(U),W=x[V];if(!W)continue;const{direction:G,speed:J}=R4t(U,W,T,t,_);for(const ne of["x","y"])b[ne][G[ne]]||(J[ne]=0,G[ne]=0);if(J.x>0||J.y>0){k(),I.current=U,S(z,l),M.current=J,P.current=G;return}}M.current={x:0,y:0},P.current={x:0,y:0},k()},[t,z,s,k,o,l,JSON.stringify(T),JSON.stringify(b),S,p,D,x,JSON.stringify(_)])}const X4t={x:{[Td.Backward]:!1,[Td.Forward]:!1},y:{[Td.Backward]:!1,[Td.Forward]:!1}};function Q4t(e){let{delta:t,disabled:n}=e;const s=gpe(t);return vP(a=>{if(n||!s||!a)return X4t;const o={x:Math.sign(t.x-s.x),y:Math.sign(t.y-s.y)};return{x:{[Td.Backward]:a.x[Td.Backward]||o.x===-1,[Td.Forward]:a.x[Td.Forward]||o.x===1},y:{[Td.Backward]:a.y[Td.Backward]||o.y===-1,[Td.Forward]:a.y[Td.Forward]||o.y===1}}},[n,t,s])}function J4t(e,t){const n=t!=null?e.get(t):void 0,s=n?n.node.current:null;return vP(a=>{var o;return t==null?null:(o=s??a)!=null?o:null},[s,t])}function eSt(e,t){return E.useMemo(()=>e.reduce((n,s)=>{const{sensor:a}=s,o=a.activators.map(l=>({eventName:l.eventName,handler:t(l.handler,s)}));return[...n,...o]},[]),[e,t])}var QE;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(QE||(QE={}));var _pe;(function(e){e.Optimized="optimized"})(_pe||(_pe={}));const QSe=new Map;function tSt(e,t){let{dragging:n,dependencies:s,config:a}=t;const[o,l]=E.useState(null),{frequency:i,measure:u,strategy:p}=a,x=E.useRef(e),y=M(),_=ZE(y),b=E.useCallback(function(P){P===void 0&&(P=[]),!_.current&&l(T=>T===null?P:T.concat(P.filter(I=>!T.includes(I))))},[_]),S=E.useRef(null),k=vP(P=>{if(y&&!n)return QSe;if(!P||P===QSe||x.current!==e||o!=null){const T=new Map;for(let I of e){if(!I)continue;if(o&&o.length>0&&!o.includes(I.id)&&I.rect.current){T.set(I.id,I.rect.current);continue}const z=I.node.current,D=z?new q0e(u(z),z):null;I.rect.current=D,D&&T.set(I.id,D)}return T}return P},[e,o,n,y,u]);return E.useEffect(()=>{x.current=e},[e]),E.useEffect(()=>{y||b()},[n,y]),E.useEffect(()=>{o&&o.length>0&&l(null)},[JSON.stringify(o)]),E.useEffect(()=>{y||typeof i!="number"||S.current!==null||(S.current=setTimeout(()=>{b(),S.current=null},i))},[i,y,b,...s]),{droppableRects:k,measureDroppableContainers:b,measuringScheduled:o!=null};function M(){switch(p){case QE.Always:return!1;case QE.BeforeDragging:return n;default:return!n}}}function eBe(e,t){return vP(n=>e?n||(typeof t=="function"?t(e):e):null,[t,e])}function rSt(e,t){return eBe(e,t)}function nSt(e){let{callback:t,disabled:n}=e;const s=$0e(t),a=E.useMemo(()=>{if(n||typeof window>"u"||typeof window.MutationObserver>"u")return;const{MutationObserver:o}=window;return new o(s)},[s,n]);return E.useEffect(()=>()=>a==null?void 0:a.disconnect(),[a]),a}function Fae(e){let{callback:t,disabled:n}=e;const s=$0e(t),a=E.useMemo(()=>{if(n||typeof window>"u"||typeof window.ResizeObserver>"u")return;const{ResizeObserver:o}=window;return new o(s)},[n]);return E.useEffect(()=>()=>a==null?void 0:a.disconnect(),[a]),a}function sSt(e){return new q0e(F3(e),e)}function JSe(e,t,n){t===void 0&&(t=sSt);const[s,a]=E.useState(null);function o(){a(u=>{if(!e)return null;if(e.isConnected===!1){var p;return(p=u??n)!=null?p:null}const x=t(e);return JSON.stringify(u)===JSON.stringify(x)?u:x})}const l=nSt({callback(u){if(e)for(const p of u){const{type:x,target:y}=p;if(x==="childList"&&y instanceof HTMLElement&&y.contains(e)){o();break}}}}),i=Fae({callback:o});return Qg(()=>{o(),e?(i==null||i.observe(e),l==null||l.observe(document.body,{childList:!0,subtree:!0})):(i==null||i.disconnect(),l==null||l.disconnect())},[e]),s}function aSt(e){const t=eBe(e);return W9e(e,t)}const eCe=[];function iSt(e){const t=E.useRef(e),n=vP(s=>e?s&&s!==eCe&&e&&t.current&&e.parentNode===t.current.parentNode?s:Rae(e):eCe,[e]);return E.useEffect(()=>{t.current=e},[e]),n}function oSt(e){const[t,n]=E.useState(null),s=E.useRef(e),a=E.useCallback(o=>{const l=Ide(o.target);l&&n(i=>i?(i.set(l,ype(l)),new Map(i)):null)},[]);return E.useEffect(()=>{const o=s.current;if(e!==o){l(o);const i=e.map(u=>{const p=Ide(u);return p?(p.addEventListener("scroll",a,{passive:!0}),[p,ype(p)]):null}).filter(u=>u!=null);n(i.length?new Map(i):null),s.current=e}return()=>{l(e),l(o)};function l(i){i.forEach(u=>{const p=Ide(u);p==null||p.removeEventListener("scroll",a)})}},[a,e]),E.useMemo(()=>e.length?t?Array.from(t.values()).reduce((o,l)=>JS(o,l),zm):Q9e(e):zm,[e,t])}function tCe(e,t){t===void 0&&(t=[]);const n=E.useRef(null);return E.useEffect(()=>{n.current=null},t),E.useEffect(()=>{const s=e!==zm;s&&!n.current&&(n.current=e),!s&&n.current&&(n.current=null)},[e]),n.current?YE(e,n.current):zm}function lSt(e){E.useEffect(()=>{if(!Dae)return;const t=e.map(n=>{let{sensor:s}=n;return s.setup==null?void 0:s.setup()});return()=>{for(const n of t)n==null||n()}},e.map(t=>{let{sensor:n}=t;return n}))}function cSt(e,t){return E.useMemo(()=>e.reduce((n,s)=>{let{eventName:a,handler:o}=s;return n[a]=l=>{o(l,t)},n},{}),[e,t])}function tBe(e){return E.useMemo(()=>e?P4t(e):null,[e])}const rCe=[];function dSt(e,t){t===void 0&&(t=F3);const[n]=e,s=tBe(n?Rh(n):null),[a,o]=E.useState(rCe);function l(){o(()=>e.length?e.map(u=>Y9e(u)?s:new q0e(t(u),u)):rCe)}const i=Fae({callback:l});return Qg(()=>{i==null||i.disconnect(),l(),e.forEach(u=>i==null?void 0:i.observe(u))},[e]),a}function uSt(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return yP(t)?t:e}function hSt(e){let{measure:t}=e;const[n,s]=E.useState(null),a=E.useCallback(p=>{for(const{target:x}of p)if(yP(x)){s(y=>{const _=t(x);return y?{...y,width:_.width,height:_.height}:_});break}},[t]),o=Fae({callback:a}),l=E.useCallback(p=>{const x=uSt(p);o==null||o.disconnect(),x&&(o==null||o.observe(x)),s(x?t(x):null)},[t,o]),[i,u]=Yre(l);return E.useMemo(()=>({nodeRef:i,rect:n,setRef:u}),[n,i,u])}const fSt=[{sensor:W0e,options:{}},{sensor:V0e,options:{}}],pSt={current:{}},Jee={draggable:{measure:KSe},droppable:{measure:KSe,strategy:QE.WhileDragging,frequency:_pe.Optimized},dragOverlay:{measure:F3}};class YA extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(t=>{let{disabled:n}=t;return!n})}getNodeFor(t){var n,s;return(n=(s=this.get(t))==null?void 0:s.node.current)!=null?n:void 0}}const mSt={activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,collisions:null,containerNodeRect:null,draggableNodes:new Map,droppableRects:new Map,droppableContainers:new YA,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:Xre},scrollableAncestors:[],scrollableAncestorRects:[],measuringConfiguration:Jee,measureDroppableContainers:Xre,windowRect:null,measuringScheduled:!1},gSt={activatorEvent:null,activators:[],active:null,activeNodeRect:null,ariaDescribedById:{draggable:""},dispatch:Xre,draggableNodes:new Map,over:null,measureDroppableContainers:Xre},zae=E.createContext(gSt),rBe=E.createContext(mSt);function xSt(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:new Map,translate:{x:0,y:0}},droppable:{containers:new YA}}}function ySt(e,t){switch(t.type){case nd.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case nd.DragMove:return e.draggable.active==null?e:{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}};case nd.DragEnd:case nd.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case nd.RegisterDroppable:{const{element:n}=t,{id:s}=n,a=new YA(e.droppable.containers);return a.set(s,n),{...e,droppable:{...e.droppable,containers:a}}}case nd.SetDroppableDisabled:{const{id:n,key:s,disabled:a}=t,o=e.droppable.containers.get(n);if(!o||s!==o.key)return e;const l=new YA(e.droppable.containers);return l.set(n,{...o,disabled:a}),{...e,droppable:{...e.droppable,containers:l}}}case nd.UnregisterDroppable:{const{id:n,key:s}=t,a=e.droppable.containers.get(n);if(!a||s!==a.key)return e;const o=new YA(e.droppable.containers);return o.delete(n),{...e,droppable:{...e.droppable,containers:o}}}default:return e}}function vSt(e){let{disabled:t}=e;const{active:n,activatorEvent:s,draggableNodes:a}=E.useContext(zae),o=gpe(s),l=gpe(n==null?void 0:n.id);return E.useEffect(()=>{if(!t&&!s&&o&&l!=null){if(!U0e(o)||document.activeElement===o.target)return;const i=a.get(l);if(!i)return;const{activatorNode:u,node:p}=i;if(!u.current&&!p.current)return;requestAnimationFrame(()=>{for(const x of[u.current,p.current]){if(!x)continue;const y=u4t(x);if(y){y.focus();break}}})}},[s,t,a,l,o]),null}function _St(e,t){let{transform:n,...s}=t;return e!=null&&e.length?e.reduce((a,o)=>o({transform:a,...s}),n):n}function bSt(e){return E.useMemo(()=>({draggable:{...Jee.draggable,...e==null?void 0:e.draggable},droppable:{...Jee.droppable,...e==null?void 0:e.droppable},dragOverlay:{...Jee.dragOverlay,...e==null?void 0:e.dragOverlay}}),[e==null?void 0:e.draggable,e==null?void 0:e.droppable,e==null?void 0:e.dragOverlay])}function wSt(e){let{activeNode:t,measure:n,initialRect:s,config:a=!0}=e;const o=E.useRef(!1),{x:l,y:i}=typeof a=="boolean"?{x:a,y:a}:a;Qg(()=>{if(!l&&!i||!t){o.current=!1;return}if(o.current||!s)return;const p=t==null?void 0:t.node.current;if(!p||p.isConnected===!1)return;const x=n(p),y=W9e(x,s);if(l||(y.x=0),i||(y.y=0),o.current=!0,Math.abs(y.x)>0||Math.abs(y.y)>0){const _=G9e(p);_&&_.scrollBy({top:y.y,left:y.x})}},[t,l,i,s,n])}const nBe=E.createContext({...zm,scaleX:1,scaleY:1});var t1;(function(e){e[e.Uninitialized=0]="Uninitialized",e[e.Initializing=1]="Initializing",e[e.Initialized=2]="Initialized"})(t1||(t1={}));const jSt=E.memo(function(t){var n,s,a,o;let{id:l,accessibility:i,autoScroll:u=!0,children:p,sensors:x=fSt,collisionDetection:y=S4t,measuring:_,modifiers:b,...S}=t;const k=E.useReducer(ySt,void 0,xSt),[M,P]=k,[T,I]=x4t(),[z,D]=E.useState(t1.Uninitialized),U=z===t1.Initialized,{draggable:{active:V,nodes:W,translate:G},droppable:{containers:J}}=M,ne=V!=null?W.get(V):null,oe=E.useRef({initial:null,translated:null}),ge=E.useMemo(()=>{var Va;return V!=null?{id:V,data:(Va=ne==null?void 0:ne.data)!=null?Va:pSt,rect:oe}:null},[V,ne]),ie=E.useRef(null),[pe,se]=E.useState(null),[fe,he]=E.useState(null),ye=ZE(S,Object.values(S)),Ae=_P("DndDescribedBy",l),we=E.useMemo(()=>J.getEnabled(),[J]),be=bSt(_),{droppableRects:_e,measureDroppableContainers:Je,measuringScheduled:Te}=tSt(we,{dragging:U,dependencies:[G.x,G.y],config:be.droppable}),De=J4t(W,V),Ue=E.useMemo(()=>fe?xpe(fe):null,[fe]),Be=$o(),qe=rSt(De,be.draggable.measure);wSt({activeNode:V!=null?W.get(V):null,config:Be.layoutShiftCompensation,initialRect:qe,measure:be.draggable.measure});const ot=JSe(De,be.draggable.measure,qe),Mt=JSe(De?De.parentElement:null),Oe=E.useRef({activatorEvent:null,active:null,activeNode:De,collisionRect:null,collisions:null,droppableRects:_e,draggableNodes:W,draggingNode:null,draggingNodeRect:null,droppableContainers:J,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null}),at=J.getNodeFor((n=Oe.current.over)==null?void 0:n.id),le=hSt({measure:be.dragOverlay.measure}),Ve=(s=le.nodeRef.current)!=null?s:De,Qe=U?(a=le.rect)!=null?a:ot:null,st=!!(le.nodeRef.current&&le.rect),ke=aSt(st?null:ot),ct=tBe(Ve?Rh(Ve):null),Ce=iSt(U?at??De:null),Me=dSt(Ce),Ge=_St(b,{transform:{x:G.x-ke.x,y:G.y-ke.y,scaleX:1,scaleY:1},activatorEvent:fe,active:ge,activeNodeRect:ot,containerNodeRect:Mt,draggingNodeRect:Qe,over:Oe.current.over,overlayNodeRect:le.rect,scrollableAncestors:Ce,scrollableAncestorRects:Me,windowRect:ct}),Ee=Ue?JS(Ue,G):null,He=oSt(Ce),nt=tCe(He),yt=tCe(He,[ot]),it=JS(Ge,nt),zt=Qe?T4t(Qe,Ge):null,dr=ge&&zt?y({active:ge,collisionRect:zt,droppableRects:_e,droppableContainers:we,pointerCoordinates:Ee}):null,Rr=H9e(dr,"id"),[Gr,Ur]=E.useState(null),kn=st?Ge:JS(Ge,yt),_s=C4t(kn,(o=Gr==null?void 0:Gr.rect)!=null?o:null,ot),ur=E.useRef(null),Rn=E.useCallback((Va,cs)=>{let{sensor:ta,options:ds}=cs;if(ie.current==null)return;const Hs=W.get(ie.current);if(!Hs)return;const Os=Va.nativeEvent,bi=new ta({active:ie.current,activeNode:Hs,event:Os,options:ds,context:Oe,onAbort(Ia){if(!W.get(Ia))return;const{onDragAbort:yi}=ye.current,qn={id:Ia};yi==null||yi(qn),T({type:"onDragAbort",event:qn})},onPending(Ia,no,yi,qn){if(!W.get(Ia))return;const{onDragPending:dc}=ye.current,go={id:Ia,constraint:no,initialCoordinates:yi,offset:qn};dc==null||dc(go),T({type:"onDragPending",event:go})},onStart(Ia){const no=ie.current;if(no==null)return;const yi=W.get(no);if(!yi)return;const{onDragStart:qn}=ye.current,Gi={activatorEvent:Os,active:{id:no,data:yi.data,rect:oe}};kh.unstable_batchedUpdates(()=>{qn==null||qn(Gi),D(t1.Initializing),P({type:nd.DragStart,initialCoordinates:Ia,active:no}),T({type:"onDragStart",event:Gi}),se(ur.current),he(Os)})},onMove(Ia){P({type:nd.DragMove,coordinates:Ia})},onEnd:sr(nd.DragEnd),onCancel:sr(nd.DragCancel)});ur.current=bi;function sr(Ia){return async function(){const{active:yi,collisions:qn,over:Gi,scrollAdjustedTranslate:dc}=Oe.current;let go=null;if(yi&&dc){const{cancelDrop:uc}=ye.current;go={activatorEvent:Os,active:yi,collisions:qn,delta:dc,over:Gi},Ia===nd.DragEnd&&typeof uc=="function"&&await Promise.resolve(uc(go))&&(Ia=nd.DragCancel)}ie.current=null,kh.unstable_batchedUpdates(()=>{P({type:Ia}),D(t1.Uninitialized),Ur(null),se(null),he(null),ur.current=null;const uc=Ia===nd.DragEnd?"onDragEnd":"onDragCancel";if(go){const tt=ye.current[uc];tt==null||tt(go),T({type:uc,event:go})}})}}},[W]),ea=E.useCallback((Va,cs)=>(ta,ds)=>{const Hs=ta.nativeEvent,Os=W.get(ds);if(ie.current!==null||!Os||Hs.dndKit||Hs.defaultPrevented)return;const bi={active:Os};Va(ta,cs.options,bi)===!0&&(Hs.dndKit={capturedBy:cs.sensor},ie.current=ds,Rn(ta,cs))},[W,Rn]),ca=eSt(x,ea);lSt(x),Qg(()=>{ot&&z===t1.Initializing&&D(t1.Initialized)},[ot,z]),E.useEffect(()=>{const{onDragMove:Va}=ye.current,{active:cs,activatorEvent:ta,collisions:ds,over:Hs}=Oe.current;if(!cs||!ta)return;const Os={active:cs,activatorEvent:ta,collisions:ds,delta:{x:it.x,y:it.y},over:Hs};kh.unstable_batchedUpdates(()=>{Va==null||Va(Os),T({type:"onDragMove",event:Os})})},[it.x,it.y]),E.useEffect(()=>{const{active:Va,activatorEvent:cs,collisions:ta,droppableContainers:ds,scrollAdjustedTranslate:Hs}=Oe.current;if(!Va||ie.current==null||!cs||!Hs)return;const{onDragOver:Os}=ye.current,bi=ds.get(Rr),sr=bi&&bi.rect.current?{id:bi.id,rect:bi.rect.current,data:bi.data,disabled:bi.disabled}:null,Ia={active:Va,activatorEvent:cs,collisions:ta,delta:{x:Hs.x,y:Hs.y},over:sr};kh.unstable_batchedUpdates(()=>{Ur(sr),Os==null||Os(Ia),T({type:"onDragOver",event:Ia})})},[Rr]),Qg(()=>{Oe.current={activatorEvent:fe,active:ge,activeNode:De,collisionRect:zt,collisions:dr,droppableRects:_e,draggableNodes:W,draggingNode:Ve,draggingNodeRect:Qe,droppableContainers:J,over:Gr,scrollableAncestors:Ce,scrollAdjustedTranslate:it},oe.current={initial:Qe,translated:zt}},[ge,De,dr,zt,W,Ve,Qe,_e,J,Gr,Ce,it]),Y4t({...Be,delta:G,draggingRect:zt,pointerCoordinates:Ee,scrollableAncestors:Ce,scrollableAncestorRects:Me});const Ei=E.useMemo(()=>({active:ge,activeNode:De,activeNodeRect:ot,activatorEvent:fe,collisions:dr,containerNodeRect:Mt,dragOverlay:le,draggableNodes:W,droppableContainers:J,droppableRects:_e,over:Gr,measureDroppableContainers:Je,scrollableAncestors:Ce,scrollableAncestorRects:Me,measuringConfiguration:be,measuringScheduled:Te,windowRect:ct}),[ge,De,ot,fe,dr,Mt,le,W,J,_e,Gr,Je,Ce,Me,be,Te,ct]),Ii=E.useMemo(()=>({activatorEvent:fe,activators:ca,active:ge,activeNodeRect:ot,ariaDescribedById:{draggable:Ae},dispatch:P,draggableNodes:W,over:Gr,measureDroppableContainers:Je}),[fe,ca,ge,ot,P,Ae,W,Gr,Je]);return lt.createElement(U9e.Provider,{value:I},lt.createElement(zae.Provider,{value:Ii},lt.createElement(rBe.Provider,{value:Ei},lt.createElement(nBe.Provider,{value:_s},p)),lt.createElement(vSt,{disabled:(i==null?void 0:i.restoreFocus)===!1})),lt.createElement(_4t,{...i,hiddenTextDescribedById:Ae}));function $o(){const Va=(pe==null?void 0:pe.autoScrollEnabled)===!1,cs=typeof u=="object"?u.enabled===!1:u===!1,ta=U&&!Va&&!cs;return typeof u=="object"?{...u,enabled:ta}:{enabled:ta}}}),kSt=E.createContext(null),nCe="button",NSt="Draggable";function SSt(e){let{id:t,data:n,disabled:s=!1,attributes:a}=e;const o=_P(NSt),{activators:l,activatorEvent:i,active:u,activeNodeRect:p,ariaDescribedById:x,draggableNodes:y,over:_}=E.useContext(zae),{role:b=nCe,roleDescription:S="draggable",tabIndex:k=0}=a??{},M=(u==null?void 0:u.id)===t,P=E.useContext(M?nBe:kSt),[T,I]=Yre(),[z,D]=Yre(),U=cSt(l,t),V=ZE(n);Qg(()=>(y.set(t,{id:t,key:o,node:T,activatorNode:z,data:V}),()=>{const G=y.get(t);G&&G.key===o&&y.delete(t)}),[y,t]);const W=E.useMemo(()=>({role:b,tabIndex:k,"aria-disabled":s,"aria-pressed":M&&b===nCe?!0:void 0,"aria-roledescription":S,"aria-describedby":x.draggable}),[s,b,k,M,S,x.draggable]);return{active:u,activatorEvent:i,activeNodeRect:p,attributes:W,isDragging:M,listeners:s?void 0:U,node:T,over:_,setNodeRef:I,setActivatorNodeRef:D,transform:P}}function CSt(){return E.useContext(rBe)}const MSt="Droppable",TSt={timeout:25};function ASt(e){let{data:t,disabled:n=!1,id:s,resizeObserverConfig:a}=e;const o=_P(MSt),{active:l,dispatch:i,over:u,measureDroppableContainers:p}=E.useContext(zae),x=E.useRef({disabled:n}),y=E.useRef(!1),_=E.useRef(null),b=E.useRef(null),{disabled:S,updateMeasurementsFor:k,timeout:M}={...TSt,...a},P=ZE(k??s),T=E.useCallback(()=>{if(!y.current){y.current=!0;return}b.current!=null&&clearTimeout(b.current),b.current=setTimeout(()=>{p(Array.isArray(P.current)?P.current:[P.current]),b.current=null},M)},[M]),I=Fae({callback:T,disabled:S||!l}),z=E.useCallback((W,G)=>{I&&(G&&(I.unobserve(G),y.current=!1),W&&I.observe(W))},[I]),[D,U]=Yre(z),V=ZE(t);return E.useEffect(()=>{!I||!D.current||(I.disconnect(),y.current=!1,I.observe(D.current))},[D,I]),E.useEffect(()=>(i({type:nd.RegisterDroppable,element:{id:s,key:o,disabled:n,node:D,rect:_,data:V}}),()=>i({type:nd.UnregisterDroppable,key:o,id:s})),[s]),E.useEffect(()=>{n!==x.current.disabled&&(i({type:nd.SetDroppableDisabled,id:s,key:o,disabled:n}),x.current.disabled=n)},[s,o,n,i]),{active:l,rect:_,isOver:(u==null?void 0:u.id)===s,node:D,over:u,setNodeRef:U}}function G0e(e,t,n){const s=e.slice();return s.splice(n<0?s.length+n:n,0,s.splice(t,1)[0]),s}function ESt(e,t){return e.reduce((n,s,a)=>{const o=t.get(s);return o&&(n[a]=o),n},Array(e.length))}function kO(e){return e!==null&&e>=0}function ISt(e,t){if(e===t)return!0;if(e.length!==t.length)return!1;for(let n=0;n{let{rects:t,activeIndex:n,overIndex:s,index:a}=e;const o=G0e(t,s,n),l=t[a],i=o[a];return!i||!l?null:{x:i.left-l.left,y:i.top-l.top,scaleX:i.width/l.width,scaleY:i.height/l.height}},sBe="Sortable",aBe=lt.createContext({activeIndex:-1,containerId:sBe,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:K0e,disabled:{draggable:!1,droppable:!1}});function LSt(e){let{children:t,id:n,items:s,strategy:a=K0e,disabled:o=!1}=e;const{active:l,dragOverlay:i,droppableRects:u,over:p,measureDroppableContainers:x}=CSt(),y=_P(sBe,n),_=i.rect!==null,b=E.useMemo(()=>s.map(U=>typeof U=="object"&&"id"in U?U.id:U),[s]),S=l!=null,k=l?b.indexOf(l.id):-1,M=p?b.indexOf(p.id):-1,P=E.useRef(b),T=!ISt(b,P.current),I=M!==-1&&k===-1||T,z=PSt(o);Qg(()=>{T&&S&&x(b)},[T,b,S,x]),E.useEffect(()=>{P.current=b},[b]);const D=E.useMemo(()=>({activeIndex:k,containerId:y,disabled:z,disableTransforms:I,items:b,overIndex:M,useDragOverlay:_,sortedRects:ESt(b,u),strategy:a}),[k,y,z.draggable,z.droppable,I,b,M,u,_,a]);return lt.createElement(aBe.Provider,{value:D},t)}const OSt=e=>{let{id:t,items:n,activeIndex:s,overIndex:a}=e;return G0e(n,s,a).indexOf(t)},DSt=e=>{let{containerId:t,isSorting:n,wasDragging:s,index:a,items:o,newIndex:l,previousItems:i,previousContainerId:u,transition:p}=e;return!p||!s||i!==o&&a===l?!1:n?!0:l!==a&&t===u},RSt={duration:200,easing:"ease"},iBe="transform",FSt=XE.Transition.toString({property:iBe,duration:0,easing:"linear"}),zSt={roleDescription:"sortable"};function BSt(e){let{disabled:t,index:n,node:s,rect:a}=e;const[o,l]=E.useState(null),i=E.useRef(n);return Qg(()=>{if(!t&&n!==i.current&&s.current){const u=a.current;if(u){const p=F3(s.current,{ignoreTransform:!0}),x={x:u.left-p.left,y:u.top-p.top,scaleX:u.width/p.width,scaleY:u.height/p.height};(x.x||x.y)&&l(x)}}n!==i.current&&(i.current=n)},[t,n,s,a]),E.useEffect(()=>{o&&l(null)},[o]),o}function $St(e){let{animateLayoutChanges:t=DSt,attributes:n,disabled:s,data:a,getNewIndex:o=OSt,id:l,strategy:i,resizeObserverConfig:u,transition:p=RSt}=e;const{items:x,containerId:y,activeIndex:_,disabled:b,disableTransforms:S,sortedRects:k,overIndex:M,useDragOverlay:P,strategy:T}=E.useContext(aBe),I=USt(s,b),z=x.indexOf(l),D=E.useMemo(()=>({sortable:{containerId:y,index:z,items:x},...a}),[y,a,z,x]),U=E.useMemo(()=>x.slice(x.indexOf(l)),[x,l]),{rect:V,node:W,isOver:G,setNodeRef:J}=ASt({id:l,data:D,disabled:I.droppable,resizeObserverConfig:{updateMeasurementsFor:U,...u}}),{active:ne,activatorEvent:oe,activeNodeRect:ge,attributes:ie,setNodeRef:pe,listeners:se,isDragging:fe,over:he,setActivatorNodeRef:ye,transform:Ae}=SSt({id:l,data:D,attributes:{...zSt,...n},disabled:I.draggable}),we=o4t(J,pe),be=!!ne,_e=be&&!S&&kO(_)&&kO(M),Je=!P&&fe,Te=Je&&_e?Ae:null,Ue=_e?Te??(i??T)({rects:k,activeNodeRect:ge,activeIndex:_,overIndex:M,index:z}):null,Be=kO(_)&&kO(M)?o({id:l,items:x,activeIndex:_,overIndex:M}):z,qe=ne==null?void 0:ne.id,ot=E.useRef({activeId:qe,items:x,newIndex:Be,containerId:y}),Mt=x!==ot.current.items,Oe=t({active:ne,containerId:y,isDragging:fe,isSorting:be,id:l,index:z,items:x,newIndex:ot.current.newIndex,previousItems:ot.current.items,previousContainerId:ot.current.containerId,transition:p,wasDragging:ot.current.activeId!=null}),at=BSt({disabled:!Oe,index:z,node:W,rect:V});return E.useEffect(()=>{be&&ot.current.newIndex!==Be&&(ot.current.newIndex=Be),y!==ot.current.containerId&&(ot.current.containerId=y),x!==ot.current.items&&(ot.current.items=x)},[be,Be,y,x]),E.useEffect(()=>{if(qe===ot.current.activeId)return;if(qe!=null&&ot.current.activeId==null){ot.current.activeId=qe;return}const Ve=setTimeout(()=>{ot.current.activeId=qe},50);return()=>clearTimeout(Ve)},[qe]),{active:ne,activeIndex:_,attributes:ie,data:D,rect:V,index:z,newIndex:Be,items:x,isOver:G,isSorting:be,isDragging:fe,listeners:se,node:W,overIndex:M,over:he,setNodeRef:we,setActivatorNodeRef:ye,setDroppableNodeRef:J,setDraggableNodeRef:pe,transform:at??Ue,transition:le()};function le(){if(at||Mt&&ot.current.newIndex===z)return FSt;if(!(Je&&!U0e(oe)||!p)&&(be||Oe))return XE.Transition.toString({...p,property:iBe})}}function USt(e,t){var n,s;return typeof e=="boolean"?{draggable:e,droppable:!1}:{draggable:(n=e==null?void 0:e.draggable)!=null?n:t.draggable,droppable:(s=e==null?void 0:e.droppable)!=null?s:t.droppable}}function Jre(e){if(!e)return!1;const t=e.data.current;return!!(t&&"sortable"in t&&typeof t.sortable=="object"&&"containerId"in t.sortable&&"items"in t.sortable&&"index"in t.sortable)}const qSt=[Xi.Down,Xi.Right,Xi.Up,Xi.Left],VSt=(e,t)=>{let{context:{active:n,collisionRect:s,droppableRects:a,droppableContainers:o,over:l,scrollableAncestors:i}}=t;if(qSt.includes(e.code)){if(e.preventDefault(),!n||!s)return;const u=[];o.getEnabled().forEach(y=>{if(!y||y!=null&&y.disabled)return;const _=a.get(y.id);if(_)switch(e.code){case Xi.Down:s.top<_.top&&u.push(y);break;case Xi.Up:s.top>_.top&&u.push(y);break;case Xi.Left:s.left>_.left&&u.push(y);break;case Xi.Right:s.left<_.left&&u.push(y);break}});const p=k4t({collisionRect:s,droppableRects:a,droppableContainers:u});let x=H9e(p,"id");if(x===(l==null?void 0:l.id)&&p.length>1&&(x=p[1].id),x!=null){const y=o.get(n.id),_=o.get(x),b=_?a.get(_.id):null,S=_==null?void 0:_.node.current;if(S&&b&&y&&_){const M=Rae(S).some((U,V)=>i[V]!==U),P=oBe(y,_),T=HSt(y,_),I=M||!P?{x:0,y:0}:{x:T?s.width-b.width:0,y:T?s.height-b.height:0},z={x:b.left,y:b.top};return I.x&&I.y?z:YE(z,I)}}}};function oBe(e,t){return!Jre(e)||!Jre(t)?!1:e.data.current.sortable.containerId===t.data.current.sortable.containerId}function HSt(e,t){return!Jre(e)||!Jre(t)||!oBe(e,t)?!1:e.data.current.sortable.indext(e),children:r.jsx(ni,{className:"h-3.5 w-3.5"})}),r.jsx(ee,{variant:"destructive",size:"icon",className:"h-7 w-7",onClick:()=>n(e),children:r.jsx(Bn,{className:"h-3.5 w-3.5"})})]}),e.post_date&&r.jsx("div",{className:"absolute bottom-2 left-2",children:r.jsxs(Pt,{className:"bg-primary/90 text-primary-foreground text-[10px] gap-1 backdrop-blur-sm px-1.5 py-0.5",children:[r.jsx(Ss,{className:"h-2.5 w-2.5"}),on(new Date(e.post_date+"T00:00:00"),"MMM d")]})})]}),r.jsxs(et,{className:"p-3 space-y-2",children:[r.jsx("p",{className:"text-xs text-muted-foreground line-clamp-3",children:e.caption}),r.jsxs(Vc,{children:[r.jsx(Hc,{asChild:!0,children:r.jsxs(ee,{variant:"outline",size:"sm",className:Bt("w-full h-7 text-[11px] gap-1 justify-start font-normal",!e.post_date&&"text-muted-foreground"),children:[r.jsx(Ss,{className:"h-3 w-3"}),e.post_date?on(new Date(e.post_date+"T00:00:00"),"MMM d, yyyy"):"Set post date"]})}),r.jsxs(Mc,{className:"w-auto p-0",align:"start",children:[r.jsx(Pm,{mode:"single",selected:e.post_date?new Date(e.post_date+"T00:00:00"):void 0,onSelect:y=>s(e.id,y?on(y,"yyyy-MM-dd"):null),className:"p-3 pointer-events-auto"}),e.post_date&&r.jsx("div",{className:"p-2 border-t",children:r.jsx(ee,{variant:"ghost",size:"sm",className:"w-full text-xs text-muted-foreground",onClick:()=>s(e.id,null),children:"Clear date"})})]})]})]})]})})}const GSt=()=>{const e=Hr(),[t,n]=E.useState("all"),[s,a]=E.useState(!1),[o,l]=E.useState(on(new Date,"yyyy-MM")),[i,u]=E.useState([]),[p,x]=E.useState(!1),[y,_]=E.useState(null),[b,S]=E.useState(null),[k,M]=E.useState(""),[P,T]=E.useState(null),[I,z]=E.useState(!1),[D,U]=E.useState(!1),[V,W]=E.useState(on(new Date,"yyyy-MM")),[G,J]=E.useState(null),[ne,oe]=E.useState(""),[ge,ie]=E.useState(""),[pe,se]=E.useState(""),[fe,he]=E.useState(!1),ye=b4t(HSe(W0e,{activationConstraint:{distance:5}}),HSe(V0e,{coordinateGetter:VSt})),{data:Ae=[],isLoading:we}=Kt({queryKey:["admin-social-swag-2"],queryFn:async()=>{const{data:Ee,error:He}=await Q.from("social_swag_2").select("*").order("month",{ascending:!1}).order("sort_order");if(He)throw He;return Ee}}),{data:be=[]}=Kt({queryKey:["admin-social-swag-2-months"],queryFn:async()=>{const{data:Ee,error:He}=await Q.from("social_swag_2_months").select("*").order("month",{ascending:!1});if(He)throw He;return Ee}}),{data:_e=[]}=Kt({queryKey:["admin-social-swag-2-reels"],queryFn:async()=>{const{data:Ee,error:He}=await Q.from("social_swag_2_reels").select("*").order("month",{ascending:!1});if(He)throw He;return Ee}}),Je=[...new Set(Ae.map(Ee=>Ee.month))].sort((Ee,He)=>He.localeCompare(Ee)),Te=t==="all"?Ae:Ae.filter(Ee=>Ee.month===t),De=Ee=>{const He=kye(Ee,"yyyy-MM",new Date);return on(He,"MMMM yyyy")},Ue=Ee=>{S(Ee),M(Ee.caption),T(Ee.post_date)},Be=async()=>{if(b){z(!0);try{const{error:Ee}=await Q.from("social_swag_2").update({caption:k,post_date:P}).eq("id",b.id);if(Ee)throw Ee;Ie.success("Image updated"),S(null),e.invalidateQueries({queryKey:["admin-social-swag-2"]}),e.invalidateQueries({queryKey:["social-swag-2"]})}catch{Ie.error("Failed to update image")}finally{z(!1)}}},qe=async Ee=>{const{active:He,over:nt}=Ee;if(!nt||He.id===nt.id)return;const yt=Te,it=yt.findIndex(Rr=>Rr.id===He.id),zt=yt.findIndex(Rr=>Rr.id===nt.id);if(it===-1||zt===-1)return;const dr=G0e(yt,it,zt);e.setQueryData(["admin-social-swag-2"],Rr=>{if(!Rr)return Rr;const Gr={};return dr.forEach((Ur,kn)=>{Gr[Ur.id]=kn}),Rr.map(Ur=>Gr[Ur.id]!==void 0?{...Ur,sort_order:Gr[Ur.id]}:Ur).sort((Ur,kn)=>Ur.month!==kn.month?kn.month.localeCompare(Ur.month):Ur.sort_order-kn.sort_order)});try{await Promise.all(dr.map((Rr,Gr)=>Q.from("social_swag_2").update({sort_order:Gr}).eq("id",Rr.id)))}catch{Ie.error("Failed to save order"),e.invalidateQueries({queryKey:["admin-social-swag-2"]})}},ot=Ee=>{const nt=Array.from(Ee.target.files||[]).slice(0,16-i.length).map(yt=>({file:yt,preview:URL.createObjectURL(yt),caption:""}));u(yt=>[...yt,...nt].slice(0,16))},Mt=Ee=>{u(He=>{const nt=[...He];return URL.revokeObjectURL(nt[Ee].preview),nt.splice(Ee,1),nt})},Oe=(Ee,He)=>{u(nt=>{const yt=[...nt];return yt[Ee]={...yt[Ee],caption:He},yt})},at=async()=>{if(i.length===0){Ie.error("Please add at least one image");return}if(i.filter(He=>!He.caption.trim()).length>0){Ie.error("Please add captions to all images");return}x(!0);try{for(let He=0;He{const He=Ee.image_url.split("/social-swag-2/");He[1]&&await Q.storage.from("social-swag-2").remove([He[1]]);const{error:nt}=await Q.from("social_swag_2").delete().eq("id",Ee.id);if(nt)throw nt},onSuccess:()=>{Ie.success("Image deleted"),e.invalidateQueries({queryKey:["admin-social-swag-2"]})},onError:()=>Ie.error("Failed to delete image")}),Ve=ir({mutationFn:async({id:Ee,postDate:He})=>{const{error:nt}=await Q.from("social_swag_2").update({post_date:He}).eq("id",Ee);if(nt)throw nt},onSuccess:()=>{Ie.success("Post date updated"),e.invalidateQueries({queryKey:["admin-social-swag-2"]}),e.invalidateQueries({queryKey:["social-swag-2"]})},onError:()=>Ie.error("Failed to update post date")}),Qe=ir({mutationFn:async({month:Ee,link:He})=>{const{error:nt}=await Q.from("social_swag_2_months").upsert({month:Ee,canva_link:He||null},{onConflict:"month"});if(nt)throw nt},onSuccess:()=>{Ie.success("Canva link updated"),_(null),e.invalidateQueries({queryKey:["admin-social-swag-2-months"]})},onError:()=>Ie.error("Failed to update Canva link")}),st=Ee=>{var He;return((He=be.find(nt=>nt.month===Ee))==null?void 0:He.canva_link)||""},ke=Ee=>_e.find(He=>He.month===Ee)||null,ct=Ee=>{var nt;const He=(nt=Ee.target.files)==null?void 0:nt[0];He&&(J(He),oe(URL.createObjectURL(He)))},Ce=()=>{ne&&URL.revokeObjectURL(ne),J(null),oe(""),ie(""),se("")},Me=async()=>{if(!G){Ie.error("Please select an image");return}he(!0);try{const Ee=G.name.split(".").pop(),He=`reels/${V}-${Date.now()}.${Ee}`,{error:nt}=await Q.storage.from("social-swag-2").upload(He,G);if(nt)throw nt;const{data:{publicUrl:yt}}=Q.storage.from("social-swag-2").getPublicUrl(He),{error:it}=await Q.from("social_swag_2_reels").upsert({month:V,image_url:yt,canva_link:pe||null,caption:ge||null},{onConflict:"month"});if(it)throw it;Ie.success("Reel uploaded successfully!"),mpe(`${De(V)} Reel`,"social-swag-2"),Ce(),U(!1),e.invalidateQueries({queryKey:["admin-social-swag-2-reels"]})}catch(Ee){console.error("Reel upload error:",Ee),Ie.error("Failed to upload reel")}finally{he(!1)}},Ge=ir({mutationFn:async Ee=>{const He=Ee.image_url.split("/social-swag-2/");He[1]&&await Q.storage.from("social-swag-2").remove([He[1]]);const{error:nt}=await Q.from("social_swag_2_reels").delete().eq("id",Ee.id);if(nt)throw nt},onSuccess:()=>{Ie.success("Reel deleted"),e.invalidateQueries({queryKey:["admin-social-swag-2-reels"]})},onError:()=>Ie.error("Failed to delete reel")});return r.jsxs(Dr,{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("div",{className:"flex gap-2",children:[r.jsxs(Or,{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(Ir,{className:"max-w-4xl max-h-[90vh] overflow-y-auto",children:[r.jsx($r,{children:r.jsx(Fr,{children:"Upload Social Swag Images"})}),r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{children:"Month"}),r.jsx(dt,{type:"month",value:o,onChange:Ee=>l(Ee.target.value)})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs($e,{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:ot,className:"hidden",id:"swag-upload",disabled:i.length>=16}),r.jsxs("label",{htmlFor:"swag-upload",className:"cursor-pointer",children:[r.jsx(_o,{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((Ee,He)=>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:Ee.preview,alt:`Upload ${He+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:()=>Mt(He),children:r.jsx(hs,{className:"h-3 w-3"})})]}),r.jsx(Jn,{placeholder:"Caption...",value:Ee.caption,onChange:nt=>Oe(He,nt.target.value),className:"text-xs h-20"})]},He))}),r.jsx(ee,{onClick:at,disabled:p||i.length===0,className:"w-full gap-2",children:p?r.jsxs(r.Fragment,{children:[r.jsx(Zr,{className:"h-4 w-4 animate-spin"}),"Uploading..."]}):r.jsxs(r.Fragment,{children:[r.jsx(_o,{className:"h-4 w-4"}),"Upload ",i.length," Images"]})})]})]})]}),r.jsxs(Or,{open:D,onOpenChange:Ee=>{U(Ee),Ee||Ce()},children:[r.jsx(Zo,{asChild:!0,children:r.jsxs(ee,{variant:"outline",className:"gap-2",children:[r.jsx(eu,{className:"h-4 w-4"}),"Upload Reel"]})}),r.jsxs(Ir,{className:"max-w-lg max-h-[85vh] overflow-y-auto",children:[r.jsx($r,{children:r.jsx(Fr,{children:"Upload Monthly Reel"})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{children:"Month"}),r.jsx(dt,{type:"month",value:V,onChange:Ee=>W(Ee.target.value)})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{children:"Reel Preview Image"}),ne?r.jsxs("div",{className:"relative aspect-[9/16] max-w-[120px] mx-auto rounded-lg overflow-hidden bg-muted",children:[r.jsx("img",{src:ne,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(ne),J(null),oe("")},children:r.jsx(hs,{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:ct,className:"hidden",id:"reel-upload"}),r.jsxs("label",{htmlFor:"reel-upload",className:"cursor-pointer",children:[r.jsx(eu,{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($e,{children:"Canva Download Link"}),r.jsx(dt,{value:pe,onChange:Ee=>se(Ee.target.value),placeholder:"https://www.canva.com/..."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{children:"Caption"}),r.jsx(Jn,{value:ge,onChange:Ee=>ie(Ee.target.value),placeholder:"Enter caption for this reel...",className:"h-24"})]}),r.jsx(ee,{onClick:Me,disabled:fe||!G,className:"w-full gap-2",children:fe?r.jsxs(r.Fragment,{children:[r.jsx(Zr,{className:"h-4 w-4 animate-spin"}),"Uploading..."]}):r.jsxs(r.Fragment,{children:[r.jsx(_o,{className:"h-4 w-4"}),"Upload Reel"]})})]})]})]})]})]}),r.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[r.jsx(Ze,{children:r.jsxs(et,{className:"p-4",children:[r.jsx("div",{className:"text-2xl font-bold",children:Ae.length}),r.jsx("div",{className:"text-sm text-muted-foreground",children:"Total Images"})]})}),r.jsx(Ze,{children:r.jsxs(et,{className:"p-4",children:[r.jsx("div",{className:"text-2xl font-bold",children:Je.length}),r.jsx("div",{className:"text-sm text-muted-foreground",children:"Months"})]})})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsx(Ai,{value:t,onValueChange:n,children:r.jsxs(vi,{children:[r.jsx(sn,{value:"all",children:"All"}),Je.map(Ee=>r.jsx(sn,{value:Ee,children:De(Ee)},Ee))]})}),t!=="all"&&r.jsx(Ze,{children:r.jsx(et,{className:"p-4",children:r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx(Io,{className:"h-4 w-4 text-muted-foreground"}),r.jsxs("div",{className:"flex-1",children:[r.jsxs($e,{className:"text-sm text-muted-foreground",children:["Canva Edit Link for ",De(t)]}),(y==null?void 0:y.month)===t?r.jsxs("div",{className:"flex gap-2 mt-1",children:[r.jsx(dt,{value:y.link,onChange:Ee=>_({...y,link:Ee.target.value}),placeholder:"https://www.canva.com/..."}),r.jsx(ee,{size:"sm",onClick:()=>Qe.mutate(y),children:"Save"}),r.jsx(ee,{size:"sm",variant:"outline",onClick:()=>_(null),children:"Cancel"})]}):r.jsxs("div",{className:"flex items-center gap-2 mt-1",children:[r.jsx("span",{className:"text-sm",children:st(t)||"No link set"}),r.jsx(ee,{size:"sm",variant:"outline",onClick:()=>_({month:t,link:st(t)}),children:"Edit"})]})]})]})})}),t!=="all"&&r.jsx(Ze,{children:r.jsx(et,{className:"p-4",children:r.jsxs("div",{className:"flex items-start gap-4",children:[r.jsx(eu,{className:"h-4 w-4 text-muted-foreground mt-1"}),r.jsxs("div",{className:"flex-1",children:[r.jsxs($e,{className:"text-sm text-muted-foreground",children:["Reel for ",De(t)]}),(()=>{const Ee=ke(t);return Ee?r.jsxs("div",{className:"flex items-center gap-4 mt-2",children:[r.jsx("img",{src:Ee.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:Ee.caption||"No caption"}),Ee.canva_link&&r.jsx("a",{href:Ee.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:()=>Ge.mutate(Ee),children:r.jsx(Bn,{className:"h-4 w-4"})})]}):r.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"No reel uploaded for this month"})})()]})]})})})]}),we?r.jsx("div",{className:"text-center py-12 text-muted-foreground",children:"Loading..."}):Te.length===0?r.jsxs("div",{className:"text-center py-12",children:[r.jsx(Rl,{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(jSt,{sensors:ye,collisionDetection:j4t,onDragEnd:qe,children:r.jsx(LSt,{items:Te.map(Ee=>Ee.id),strategy:K0e,children:r.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 lg:grid-cols-6 gap-4",children:Te.map(Ee=>r.jsx(WSt,{item:Ee,onEdit:Ue,onDelete:He=>le.mutate(He),onDateChange:(He,nt)=>Ve.mutate({id:He,postDate:nt})},Ee.id))})})})]}),r.jsx(Or,{open:!!b,onOpenChange:Ee=>{Ee||S(null)},children:r.jsxs(Ir,{className:"max-w-md",children:[r.jsx($r,{children:r.jsx(Fr,{children:"Edit Image"})}),b&&r.jsxs("div",{className:"space-y-4",children:[r.jsx("div",{className:"aspect-[4/5] max-h-48 w-full rounded-lg overflow-hidden bg-muted",children:r.jsx("img",{src:b.image_url,alt:"Preview",className:"w-full h-full object-cover"})}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{children:"Caption"}),r.jsx(Jn,{value:k,onChange:Ee=>M(Ee.target.value),placeholder:"Enter caption...",className:"h-28"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{children:"Post Date"}),r.jsxs("div",{className:"flex gap-2 items-center",children:[r.jsxs(Vc,{children:[r.jsx(Hc,{asChild:!0,children:r.jsxs(ee,{variant:"outline",className:Bt("flex-1 justify-start gap-2 font-normal",!P&&"text-muted-foreground"),children:[r.jsx(Ss,{className:"h-4 w-4"}),P?on(new Date(P+"T00:00:00"),"MMM d, yyyy"):"Pick a date"]})}),r.jsx(Mc,{className:"w-auto p-0",align:"start",children:r.jsx(Pm,{mode:"single",selected:P?new Date(P+"T00:00:00"):void 0,onSelect:Ee=>T(Ee?on(Ee,"yyyy-MM-dd"):null),className:"p-3 pointer-events-auto"})})]}),P&&r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>T(null),children:r.jsx(hs,{className:"h-4 w-4"})})]})]})]}),r.jsxs(Bs,{children:[r.jsx(ee,{variant:"outline",onClick:()=>S(null),children:"Cancel"}),r.jsx(ee,{onClick:Be,disabled:I,className:"gap-2",children:I?r.jsxs(r.Fragment,{children:[r.jsx(Zr,{className:"h-4 w-4 animate-spin"}),"Saving..."]}):"Save Changes"})]})]})})]})},KSt=()=>{const{toast:e}=_i(),t=Hr(),[n,s]=E.useState("categories"),[a,o]=E.useState(!1),[l,i]=E.useState(null),[u,p]=E.useState({name:"",description:"",icon:""}),[x,y]=E.useState(!1),[_,b]=E.useState(null),[S,k]=E.useState({name:"",description:"",icon:""}),[M,P]=E.useState(!1),[T,I]=E.useState(null),[z,D]=E.useState(""),{data:U=[],isLoading:V}=Kt({queryKey:["admin-community-categories"],queryFn:async()=>{const{data:qe,error:ot}=await Q.from("community_categories").select("*").order("sort_order");if(ot)throw ot;return qe}}),{data:W=[],isLoading:G}=Kt({queryKey:["admin-private-groups"],queryFn:async()=>{const{data:qe,error:ot}=await Q.from("community_private_groups").select("*").order("sort_order");if(ot)throw ot;return qe}}),{data:J=[]}=Kt({queryKey:["admin-group-members",T==null?void 0:T.id],queryFn:async()=>{if(!T)return[];const{data:qe,error:ot}=await Q.from("community_private_group_members").select("*").eq("group_id",T.id);if(ot)throw ot;return qe},enabled:!!T}),{data:ne=[]}=Kt({queryKey:["admin-all-profiles"],queryFn:async()=>{let ot=[],Mt=0,Oe=!0;for(;Oe;){const{data:at,error:le}=await Q.from("profiles").select("id, name, email, brokerage_id").order("name").range(Mt,Mt+1e3-1);if(le)throw le;at&&at.length>0?(ot=[...ot,...at],Mt+=1e3,Oe=at.length===1e3):Oe=!1}return ot}}),{data:oe=[]}=Kt({queryKey:["admin-all-brokerages"],queryFn:async()=>{const{data:qe,error:ot}=await Q.from("brokerages").select("*").order("name");if(ot)throw ot;return qe}}),ge=ir({mutationFn:async qe=>{if(qe.id){const{error:ot}=await Q.from("community_categories").update({name:qe.name,description:qe.description||null,icon:qe.icon||null}).eq("id",qe.id);if(ot)throw ot}else{const ot=Math.max(...U.map(Oe=>Oe.sort_order),0),{error:Mt}=await Q.from("community_categories").insert({name:qe.name,description:qe.description||null,icon:qe.icon||null,sort_order:ot+1});if(Mt)throw Mt}},onSuccess:()=>{t.invalidateQueries({queryKey:["admin-community-categories"]}),o(!1),i(null),p({name:"",description:"",icon:""}),e({title:l?"Category updated!":"Category created!"})},onError:qe=>{e({title:"Error",description:qe.message,variant:"destructive"})}}),ie=ir({mutationFn:async qe=>{const{error:ot}=await Q.from("community_categories").delete().eq("id",qe);if(ot)throw ot},onSuccess:()=>{t.invalidateQueries({queryKey:["admin-community-categories"]}),e({title:"Category deleted"})}}),pe=ir({mutationFn:async({id:qe,direction:ot})=>{const Mt=U.findIndex(Oe=>Oe.id===qe);if(ot==="up"&&Mt>0){const Oe=U[Mt-1],at=U[Mt];await Q.from("community_categories").update({sort_order:at.sort_order}).eq("id",Oe.id),await Q.from("community_categories").update({sort_order:Oe.sort_order}).eq("id",at.id)}else if(ot==="down"&&Mtt.invalidateQueries({queryKey:["admin-community-categories"]})}),se=ir({mutationFn:async qe=>{if(qe.id){const{error:ot}=await Q.from("community_private_groups").update({name:qe.name,description:qe.description||null,icon:qe.icon||null}).eq("id",qe.id);if(ot)throw ot}else{const ot=Math.max(...W.map(Oe=>Oe.sort_order),0),{error:Mt}=await Q.from("community_private_groups").insert({name:qe.name,description:qe.description||null,icon:qe.icon||null,sort_order:ot+1});if(Mt)throw Mt}},onSuccess:()=>{t.invalidateQueries({queryKey:["admin-private-groups"]}),y(!1),b(null),k({name:"",description:"",icon:""}),e({title:_?"Private group updated!":"Private group created!"})},onError:qe=>{e({title:"Error",description:qe.message,variant:"destructive"})}}),fe=ir({mutationFn:async qe=>{const{error:ot}=await Q.from("community_private_groups").delete().eq("id",qe);if(ot)throw ot},onSuccess:()=>{t.invalidateQueries({queryKey:["admin-private-groups"]}),e({title:"Private group deleted"})}}),he=ir({mutationFn:async({id:qe,direction:ot})=>{const Mt=W.findIndex(Oe=>Oe.id===qe);if(ot==="up"&&Mt>0){const Oe=W[Mt-1],at=W[Mt];await Q.from("community_private_groups").update({sort_order:at.sort_order}).eq("id",Oe.id),await Q.from("community_private_groups").update({sort_order:Oe.sort_order}).eq("id",at.id)}else if(ot==="down"&&Mtt.invalidateQueries({queryKey:["admin-private-groups"]})}),ye=ir({mutationFn:async({groupId:qe,userId:ot,isMember:Mt})=>{if(Mt){const{error:Oe}=await Q.from("community_private_group_members").delete().eq("group_id",qe).eq("user_id",ot);if(Oe)throw Oe}else{const{error:Oe}=await Q.from("community_private_group_members").insert({group_id:qe,user_id:ot});if(Oe)throw Oe}},onSuccess:()=>{t.invalidateQueries({queryKey:["admin-group-members",T==null?void 0:T.id]})}}),Ae=ir({mutationFn:async({groupId:qe,brokerageId:ot,isMember:Mt})=>{if(Mt){const{error:Oe}=await Q.from("community_private_group_members").delete().eq("group_id",qe).eq("brokerage_id",ot);if(Oe)throw Oe}else{const{error:Oe}=await Q.from("community_private_group_members").insert({group_id:qe,brokerage_id:ot});if(Oe)throw Oe}},onSuccess:()=>{t.invalidateQueries({queryKey:["admin-group-members",T==null?void 0:T.id]})}}),we=qe=>{i(qe),p({name:qe.name,description:qe.description||"",icon:qe.icon||""}),o(!0)},be=()=>{i(null),p({name:"",description:"",icon:""}),o(!0)},_e=qe=>{b(qe),k({name:qe.name,description:qe.description||"",icon:qe.icon||""}),y(!0)},Je=()=>{b(null),k({name:"",description:"",icon:""}),y(!0)},Te=qe=>{I(qe),D(""),P(!0)},De=qe=>J.some(ot=>ot.user_id===qe),Ue=qe=>J.some(ot=>ot.brokerage_id===qe),Be=ne.filter(qe=>qe.name.toLowerCase().includes(z.toLowerCase())||qe.email.toLowerCase().includes(z.toLowerCase()));return r.jsx(Dr,{title:"Community Management",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Mu,{title:"Community Management",description:"Manage categories and private groups for community discussions"}),r.jsxs(Ai,{value:n,onValueChange:s,children:[r.jsxs(vi,{children:[r.jsx(sn,{value:"categories",children:"Public Categories"}),r.jsxs(sn,{value:"private-groups",children:[r.jsx(hp,{className:"h-4 w-4 mr-1"}),"Private Groups"]})]}),r.jsxs(Mn,{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(Ze,{children:r.jsx(et,{className:"pt-6",children:r.jsxs(Ks,{children:[r.jsx(Zs,{children:r.jsxs(Mr,{children:[r.jsx(It,{className:"w-[50px]",children:"Order"}),r.jsx(It,{className:"w-[80px]",children:"Icon"}),r.jsx(It,{children:"Name"}),r.jsx(It,{children:"Description"}),r.jsx(It,{className:"w-[100px]",children:"Actions"})]})}),r.jsx(Ys,{children:V?r.jsx(Mr,{children:r.jsx(kt,{colSpan:5,className:"text-center py-8",children:"Loading..."})}):U.length===0?r.jsx(Mr,{children:r.jsx(kt,{colSpan:5,className:"text-center py-8 text-muted-foreground",children:"No categories yet. Create your first one!"})}):U.map((qe,ot)=>r.jsxs(Mr,{children:[r.jsx(kt,{children:r.jsxs("div",{className:"flex flex-col gap-1",children:[r.jsx(ee,{variant:"ghost",size:"icon",className:"h-6 w-6",disabled:ot===0,onClick:()=>pe.mutate({id:qe.id,direction:"up"}),children:"↑"}),r.jsx(ee,{variant:"ghost",size:"icon",className:"h-6 w-6",disabled:ot===U.length-1,onClick:()=>pe.mutate({id:qe.id,direction:"down"}),children:"↓"})]})}),r.jsx(kt,{className:"text-2xl",children:qe.icon||"📁"}),r.jsx(kt,{className:"font-medium",children:qe.name}),r.jsx(kt,{className:"text-muted-foreground",children:qe.description||"—"}),r.jsx(kt,{children:r.jsxs("div",{className:"flex gap-1",children:[r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>we(qe),children:r.jsx(ni,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"icon",className:"text-destructive",onClick:()=>{confirm("Delete this category? Posts will be uncategorized.")&&ie.mutate(qe.id)},children:r.jsx(Bn,{className:"h-4 w-4"})})]})})]},qe.id))})]})})})]}),r.jsxs(Mn,{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(hi,{className:"h-3 w-3"}),"Brokerage groups are created automatically and sync with brokerage names"]})]}),r.jsxs(ee,{onClick:Je,children:[r.jsx(bn,{className:"h-4 w-4 mr-2"}),"Add Private Group"]})]}),r.jsx(Ze,{children:r.jsx(et,{className:"pt-6",children:r.jsxs(Ks,{children:[r.jsx(Zs,{children:r.jsxs(Mr,{children:[r.jsx(It,{className:"w-[50px]",children:"Order"}),r.jsx(It,{className:"w-[80px]",children:"Icon"}),r.jsx(It,{children:"Name"}),r.jsx(It,{children:"Description"}),r.jsx(It,{className:"w-[120px]",children:"Members"}),r.jsx(It,{className:"w-[140px]",children:"Actions"})]})}),r.jsx(Ys,{children:G?r.jsx(Mr,{children:r.jsx(kt,{colSpan:6,className:"text-center py-8",children:"Loading..."})}):W.length===0?r.jsx(Mr,{children:r.jsx(kt,{colSpan:6,className:"text-center py-8 text-muted-foreground",children:"No private groups yet. Create your first one!"})}):W.map((qe,ot)=>r.jsxs(Mr,{children:[r.jsx(kt,{children:r.jsxs("div",{className:"flex flex-col gap-1",children:[r.jsx(ee,{variant:"ghost",size:"icon",className:"h-6 w-6",disabled:ot===0,onClick:()=>he.mutate({id:qe.id,direction:"up"}),children:"↑"}),r.jsx(ee,{variant:"ghost",size:"icon",className:"h-6 w-6",disabled:ot===W.length-1,onClick:()=>he.mutate({id:qe.id,direction:"down"}),children:"↓"})]})}),r.jsx(kt,{className:"text-2xl",children:qe.icon||"🔒"}),r.jsx(kt,{className:"font-medium",children:r.jsxs("div",{className:"flex items-center gap-2",children:[qe.name,qe.brokerage_id?r.jsxs(Pt,{variant:"outline",className:"text-xs bg-blue-50 text-blue-700 border-blue-200",children:[r.jsx(hi,{className:"h-3 w-3 mr-1"}),"Auto-managed"]}):r.jsxs(Pt,{variant:"secondary",className:"text-xs",children:[r.jsx(hp,{className:"h-3 w-3 mr-1"}),"Private"]})]})}),r.jsx(kt,{className:"text-muted-foreground",children:qe.description||"—"}),r.jsx(kt,{children:r.jsxs(ee,{variant:"outline",size:"sm",onClick:()=>Te(qe),children:[r.jsx(Un,{className:"h-4 w-4 mr-1"}),"Manage"]})}),r.jsx(kt,{children:r.jsxs("div",{className:"flex gap-1",children:[!qe.brokerage_id&&r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>_e(qe),children:r.jsx(ni,{className:"h-4 w-4"})}),!qe.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.")&&fe.mutate(qe.id)},children:r.jsx(Bn,{className:"h-4 w-4"})}),qe.brokerage_id&&r.jsx("span",{className:"text-xs text-muted-foreground italic",children:"Managed via brokerage"})]})})]},qe.id))})]})})})]})]}),r.jsx(Or,{open:a,onOpenChange:o,children:r.jsxs(Ir,{children:[r.jsx($r,{children:r.jsx(Fr,{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:u.icon,onChange:qe=>p(ot=>({...ot,icon:qe.target.value})),placeholder:"💬",className:"mt-1"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium",children:"Name *"}),r.jsx(dt,{value:u.name,onChange:qe=>p(ot=>({...ot,name:qe.target.value})),placeholder:"Category name",className:"mt-1"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium",children:"Description"}),r.jsx(Jn,{value:u.description,onChange:qe=>p(ot=>({...ot,description:qe.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:()=>ge.mutate({...u,id:l==null?void 0:l.id}),disabled:!u.name.trim(),children:l?"Save Changes":"Create Category"})]})]})]})}),r.jsx(Or,{open:x,onOpenChange:y,children:r.jsxs(Ir,{children:[r.jsx($r,{children:r.jsx(Fr,{children:_?"Edit Private Group":"Create Private Group"})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium",children:"Icon (emoji)"}),r.jsx(dt,{value:S.icon,onChange:qe=>k(ot=>({...ot,icon:qe.target.value})),placeholder:"🔒",className:"mt-1"})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium",children:"Name *"}),r.jsx(dt,{value:S.name,onChange:qe=>k(ot=>({...ot,name:qe.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(Jn,{value:S.description,onChange:qe=>k(ot=>({...ot,description:qe.target.value})),placeholder:"Brief description of this private group",className:"mt-1"})]}),r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(ee,{variant:"outline",onClick:()=>y(!1),children:"Cancel"}),r.jsx(ee,{onClick:()=>se.mutate({...S,id:_==null?void 0:_.id}),disabled:!S.name.trim(),children:_?"Save Changes":"Create Private Group"})]})]})]})}),r.jsx(Or,{open:M,onOpenChange:P,children:r.jsxs(Ir,{className:"max-w-2xl",children:[r.jsx($r,{children:r.jsxs(Fr,{children:["Manage Members: ",T==null?void 0:T.name]})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs(Ai,{defaultValue:"brokerages",children:[r.jsxs(vi,{className:"w-full",children:[r.jsx(sn,{value:"brokerages",className:"flex-1",children:"By Brokerage"}),r.jsx(sn,{value:"users",className:"flex-1",children:"Individual Users"})]}),r.jsxs(Mn,{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(Bo,{className:"h-[300px] border rounded-md p-4",children:r.jsxs("div",{className:"space-y-2",children:[oe.map(qe=>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(Bl,{checked:Ue(qe.id),onCheckedChange:()=>{T&&Ae.mutate({groupId:T.id,brokerageId:qe.id,isMember:Ue(qe.id)})}}),r.jsx("span",{className:"font-medium",children:qe.name})]}),r.jsxs(Pt,{variant:"secondary",children:[ne.filter(ot=>ot.brokerage_id===qe.id).length," agents"]})]},qe.id)),oe.length===0&&r.jsx("p",{className:"text-center text-muted-foreground py-4",children:"No brokerages found"})]})})]}),r.jsxs(Mn,{value:"users",className:"space-y-4",children:[r.jsxs("div",{className:"relative",children:[r.jsx(Sa,{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:qe=>D(qe.target.value),className:"pl-9"})]}),r.jsx(Bo,{className:"h-[300px] border rounded-md p-4",children:r.jsxs("div",{className:"space-y-2",children:[Be.map(qe=>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(Bl,{checked:De(qe.id),onCheckedChange:()=>{T&&ye.mutate({groupId:T.id,userId:qe.id,isMember:De(qe.id)})}}),r.jsxs("div",{children:[r.jsx("div",{className:"font-medium",children:qe.name}),r.jsx("div",{className:"text-sm text-muted-foreground",children:qe.email})]})]})},qe.id)),Be.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:()=>P(!1),children:"Done"})})]})]})})]})})},sCe=e=>{switch(e){case"academy_video":return r.jsx(Vl,{className:"h-3 w-3"});case"template":return r.jsx(Ea,{className:"h-3 w-3"});case"toolbox":return r.jsx(ql,{className:"h-3 w-3"});case"newsletter":return r.jsx(fy,{className:"h-3 w-3"});case"social_swag":return r.jsx(Ls,{className:"h-3 w-3"});default:return r.jsx(As,{className:"h-3 w-3"})}},ZSt=e=>{switch(e){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 e}},YSt=e=>{switch(e){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 e}},XSt=()=>{const{toast:e}=_i(),[t,n]=E.useState([]),[s,a]=E.useState([]),[o,l]=E.useState([]),[i,u]=E.useState(!0),[p,x]=E.useState(""),[y,_]=E.useState(null),[b,S]=E.useState([]),[k,M]=E.useState([]);E.useEffect(()=>{P()},[]);const P=async()=>{try{u(!0);const{data:D,error:U}=await Q.from("activity_logs").select(` id, user_id, app_name, launched_at, profiles ( name, email, brokerages ( name ) ) `).order("launched_at",{ascending:!1}).limit(5e3);if(U)throw U;const{data:V,error:W}=await Q.from("content_engagement_logs").select(` id, user_id, resource_type, resource_id, resource_title, action_type, created_at `).order("created_at",{ascending:!1}).limit(5e3);if(W)throw W;const G=[...new Set((V==null?void 0:V.map(se=>se.user_id))||[])],{data:J}=await Q.from("profiles").select(` id, name, email, brokerages ( name ) `).in("id",G),ne=new Map((J==null?void 0:J.map(se=>[se.id,se]))||[]),oe=(D==null?void 0:D.map(se=>{var fe,he,ye,Ae;return{id:se.id,user_id:se.user_id,app_name:se.app_name,launched_at:se.launched_at,user_name:((fe=se.profiles)==null?void 0:fe.name)||"Unknown",user_email:((he=se.profiles)==null?void 0:he.email)||"Unknown",brokerage_name:((Ae=(ye=se.profiles)==null?void 0:ye.brokerages)==null?void 0:Ae.name)||null}}))||[],ge=(V==null?void 0:V.map(se=>{var he;const fe=ne.get(se.user_id);return{id:se.id,user_id:se.user_id,resource_type:se.resource_type,resource_id:se.resource_id,resource_title:se.resource_title,action_type:se.action_type,created_at:se.created_at,user_name:(fe==null?void 0:fe.name)||"Unknown",user_email:(fe==null?void 0:fe.email)||"Unknown",brokerage_name:((he=fe==null?void 0:fe.brokerages)==null?void 0:he.name)||null}}))||[];n(oe),a(ge);const ie=new Map;oe.forEach(se=>{if(!ie.has(se.user_id))ie.set(se.user_id,{user_id:se.user_id,user_name:se.user_name,user_email:se.user_email,brokerage_name:se.brokerage_name,last_activity_type:"app",last_activity_name:se.app_name,last_activity_at:se.launched_at,total_app_launches:1,total_content_views:0});else{const fe=ie.get(se.user_id);fe.total_app_launches++,new Date(se.launched_at)>new Date(fe.last_activity_at)&&(fe.last_activity_type="app",fe.last_activity_name=se.app_name,fe.last_activity_at=se.launched_at)}}),ge.forEach(se=>{if(!ie.has(se.user_id))ie.set(se.user_id,{user_id:se.user_id,user_name:se.user_name,user_email:se.user_email,brokerage_name:se.brokerage_name,last_activity_type:se.resource_type,last_activity_name:se.resource_title,last_activity_at:se.created_at,total_app_launches:0,total_content_views:1});else{const fe=ie.get(se.user_id);fe.total_content_views++,new Date(se.created_at)>new Date(fe.last_activity_at)&&(fe.last_activity_type=se.resource_type,fe.last_activity_name=se.resource_title,fe.last_activity_at=se.created_at)}});const pe=Array.from(ie.values()).sort((se,fe)=>new Date(fe.last_activity_at).getTime()-new Date(se.last_activity_at).getTime());l(pe)}catch(D){console.error("Error loading activity:",D),e({title:"Error",description:"Failed to load activity logs",variant:"destructive"})}finally{u(!1)}},T=D=>{_({id:D.user_id,name:D.user_name,email:D.user_email});const U=t.filter(W=>W.user_id===D.user_id),V=s.filter(W=>W.user_id===D.user_id);S(U),M(V)},I=()=>{_(null),S([]),M([])},z=o.filter(D=>{var V;if(!p)return!0;const U=p.toLowerCase();return D.user_name.toLowerCase().includes(U)||D.user_email.toLowerCase().includes(U)||((V=D.brokerage_name)==null?void 0:V.toLowerCase().includes(U))});return i?r.jsx(Ze,{children:r.jsx(et,{className:"flex items-center justify-center py-8",children:r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})})}):r.jsxs(r.Fragment,{children:[r.jsxs(Ze,{children:[r.jsxs(Wt,{children:[r.jsx(Yt,{children:"User Activity"}),r.jsx(Sn,{children:"App launches and content engagement - click to see full history"})]}),r.jsxs(et,{children:[r.jsx("div",{className:"mb-4",children:r.jsxs("div",{className:"relative",children:[r.jsx(Sa,{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:D=>x(D.target.value),className:"pl-9"})]})}),r.jsx("div",{className:"rounded-md border",children:r.jsxs(Ks,{children:[r.jsx(Zs,{children:r.jsxs(Mr,{children:[r.jsx(It,{children:"User"}),r.jsx(It,{children:"Brokerage"}),r.jsx(It,{children:"Last Activity"}),r.jsx(It,{children:"Last Active"}),r.jsx(It,{className:"text-right",children:"Apps"}),r.jsx(It,{className:"text-right",children:"Content"})]})}),r.jsx(Ys,{children:z.length===0?r.jsx(Mr,{children:r.jsx(kt,{colSpan:6,className:"text-center text-muted-foreground",children:"No activity found"})}):z.map(D=>r.jsxs(Mr,{className:"cursor-pointer hover:bg-muted/50 transition-colors",onClick:()=>T(D),children:[r.jsx(kt,{children:r.jsxs("div",{children:[r.jsx("div",{className:"font-medium",children:D.user_name}),r.jsx("div",{className:"text-sm text-muted-foreground",children:D.user_email})]})}),r.jsx(kt,{children:D.brokerage_name?r.jsx(Pt,{variant:"outline",children:D.brokerage_name}):r.jsx("span",{className:"text-muted-foreground text-sm",children:"-"})}),r.jsx(kt,{children:r.jsx("div",{className:"flex items-center gap-2",children:D.last_activity_type==="app"?r.jsxs(Pt,{variant:"secondary",children:[r.jsx(As,{className:"h-3 w-3 mr-1"}),D.last_activity_name]}):r.jsxs(Pt,{variant:"outline",className:"flex items-center gap-1",children:[sCe(D.last_activity_type),r.jsx("span",{className:"max-w-32 truncate",children:D.last_activity_name})]})})}),r.jsx(kt,{className:"text-sm text-muted-foreground",children:bu(new Date(D.last_activity_at),{addSuffix:!0})}),r.jsx(kt,{className:"text-right",children:r.jsx(Pt,{variant:"outline",children:D.total_app_launches})}),r.jsx(kt,{className:"text-right",children:r.jsx(Pt,{variant:"outline",children:D.total_content_views})})]},D.user_id))})]})})]})]}),r.jsx(Or,{open:!!y,onOpenChange:D=>!D&&I(),children:r.jsxs(Ir,{className:"max-w-3xl max-h-[80vh] overflow-hidden flex flex-col",children:[r.jsxs($r,{children:[r.jsxs(Fr,{children:[y==null?void 0:y.name,"'s Activity"]}),r.jsx(Zn,{children:y==null?void 0:y.email})]}),r.jsxs(Ai,{defaultValue:"content",className:"flex-1 overflow-hidden flex flex-col",children:[r.jsxs(vi,{className:"grid w-full grid-cols-2",children:[r.jsxs(sn,{value:"content",children:["Content (",k.length,")"]}),r.jsxs(sn,{value:"apps",children:["App Launches (",b.length,")"]})]}),r.jsx(Mn,{value:"content",className:"flex-1 overflow-auto mt-4",children:r.jsx("div",{className:"rounded-md border",children:r.jsxs(Ks,{children:[r.jsx(Zs,{children:r.jsxs(Mr,{children:[r.jsx(It,{children:"Type"}),r.jsx(It,{children:"Resource"}),r.jsx(It,{children:"Action"}),r.jsx(It,{children:"Time"})]})}),r.jsx(Ys,{children:k.length===0?r.jsx(Mr,{children:r.jsx(kt,{colSpan:4,className:"text-center text-muted-foreground",children:"No content engagement"})}):k.map(D=>r.jsxs(Mr,{children:[r.jsx(kt,{children:r.jsxs(Pt,{variant:"outline",className:"flex items-center gap-1 w-fit",children:[sCe(D.resource_type),ZSt(D.resource_type)]})}),r.jsx(kt,{className:"max-w-48",children:r.jsx("span",{className:"truncate block",children:D.resource_title})}),r.jsx(kt,{children:r.jsx(Pt,{variant:"secondary",children:YSt(D.action_type)})}),r.jsx(kt,{className:"text-sm text-muted-foreground",children:bu(new Date(D.created_at),{addSuffix:!0})})]},D.id))})]})})}),r.jsx(Mn,{value:"apps",className:"flex-1 overflow-auto mt-4",children:r.jsx("div",{className:"rounded-md border",children:r.jsxs(Ks,{children:[r.jsx(Zs,{children:r.jsxs(Mr,{children:[r.jsx(It,{children:"App"}),r.jsx(It,{children:"Time"})]})}),r.jsx(Ys,{children:b.length===0?r.jsx(Mr,{children:r.jsx(kt,{colSpan:2,className:"text-center text-muted-foreground",children:"No app launches"})}):b.map(D=>r.jsxs(Mr,{children:[r.jsx(kt,{children:r.jsx(Pt,{variant:"secondary",children:D.app_name})}),r.jsx(kt,{className:"text-sm text-muted-foreground",children:bu(new Date(D.launched_at),{addSuffix:!0})})]},D.id))})]})})})]})]})})]})},QSt=()=>{const{toast:e}=_i(),[t,n]=E.useState({totalUsers:0,activeUsers:0,pendingUsers:0,totalBrokerages:0,totalLaunches:0,launchesThisWeek:0,launchesThisMonth:0,uniqueActiveThisWeek:0}),[s,a]=E.useState(!0);E.useEffect(()=>{o()},[]);const o=async()=>{try{a(!0);const{count:l}=await Q.from("profiles").select("*",{count:"exact",head:!0}),{count:i}=await Q.from("profiles").select("*",{count:"exact",head:!0}).not("last_login","is",null),u=(l||0)-(i||0),{count:p}=await Q.from("brokerages").select("*",{count:"exact",head:!0}),{count:x}=await Q.from("activity_logs").select("*",{count:"exact",head:!0}),y=new Date;y.setDate(y.getDate()-7);const{count:_}=await Q.from("activity_logs").select("*",{count:"exact",head:!0}).gte("launched_at",y.toISOString()),b=new Date;b.setMonth(b.getMonth()-1);const{count:S}=await Q.from("activity_logs").select("*",{count:"exact",head:!0}).gte("launched_at",b.toISOString()),{data:k}=await Q.from("activity_logs").select("user_id").gte("launched_at",y.toISOString()),M=new Set(k==null?void 0:k.map(P=>P.user_id)).size;n({totalUsers:l||0,activeUsers:i||0,pendingUsers:u,totalBrokerages:p||0,totalLaunches:x||0,launchesThisWeek:_||0,launchesThisMonth:S||0,uniqueActiveThisWeek:M})}catch(l){console.error("Error loading analytics:",l),e({title:"Error",description:"Failed to load analytics",variant:"destructive"})}finally{a(!1)}};return s?r.jsx(Ze,{children:r.jsx(et,{className:"flex items-center justify-center py-8",children:r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})})}):r.jsxs("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-4",children:[r.jsxs(Ze,{children:[r.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Yt,{className:"text-sm font-medium",children:"Total Users"}),r.jsx(Un,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(et,{children:[r.jsx("div",{className:"text-2xl font-bold",children:t.totalUsers}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[t.activeUsers," active, ",t.pendingUsers," pending"]})]})]}),r.jsxs(Ze,{children:[r.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Yt,{className:"text-sm font-medium",children:"Active Users"}),r.jsx(di,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(et,{children:[r.jsx("div",{className:"text-2xl font-bold",children:t.activeUsers}),r.jsx("p",{className:"text-xs text-muted-foreground",children:t.totalUsers>0?`${Math.round(t.activeUsers/t.totalUsers*100)}% of total`:"0% of total"})]})]}),r.jsxs(Ze,{children:[r.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Yt,{className:"text-sm font-medium",children:"Pending Invites"}),r.jsx(Ya,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(et,{children:[r.jsx("div",{className:"text-2xl font-bold",children:t.pendingUsers}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Awaiting setup"})]})]}),r.jsxs(Ze,{children:[r.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Yt,{className:"text-sm font-medium",children:"Brokerages"}),r.jsx(hi,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(et,{children:[r.jsx("div",{className:"text-2xl font-bold",children:t.totalBrokerages}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Total brokerages"})]})]}),r.jsxs(Ze,{children:[r.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Yt,{className:"text-sm font-medium",children:"Total App Launches"}),r.jsx(Ig,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(et,{children:[r.jsx("div",{className:"text-2xl font-bold",children:t.totalLaunches}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"All time"})]})]}),r.jsxs(Ze,{children:[r.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Yt,{className:"text-sm font-medium",children:"Launches This Week"}),r.jsx(Ig,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(et,{children:[r.jsx("div",{className:"text-2xl font-bold",children:t.launchesThisWeek}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Last 7 days"})]})]}),r.jsxs(Ze,{children:[r.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Yt,{className:"text-sm font-medium",children:"Launches This Month"}),r.jsx(Ig,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(et,{children:[r.jsx("div",{className:"text-2xl font-bold",children:t.launchesThisMonth}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Last 30 days"})]})]}),r.jsxs(Ze,{children:[r.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Yt,{className:"text-sm font-medium",children:"Active This Week"}),r.jsx(fp,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(et,{children:[r.jsx("div",{className:"text-2xl font-bold",children:t.uniqueActiveThisWeek}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Unique users"})]})]})]})},aCe={event:"Event",template:"Template",academy_video:"Academy Video",resource_kit:"Resource Kit",newsletter:"Newsletter",social_swag:"Social Swag"},iCe={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 lBe({brokerageOnly:e=!1,brokerageId:t}){const[n,s]=E.useState([]),[a,o]=E.useState(!0),[l,i]=E.useState(""),[u,p]=E.useState("all");E.useEffect(()=>{x()},[t]);const x=async()=>{o(!0);try{let P=[];if(e&&t){const{data:G}=await Q.from("profiles").select("id").eq("brokerage_id",t);if(P=(G==null?void 0:G.map(J=>J.id))||[],P.length===0){s([]),o(!1);return}}let T=Q.from("resource_shares").select("*").order("created_at",{ascending:!1});e&&P.length>0&&(T=T.or(`sender_id.in.(${P.join(",")}),recipient_id.in.(${P.join(",")})`));const{data:I,error:z}=await T;if(z)throw z;const D=new Set;I==null||I.forEach(G=>{D.add(G.sender_id),D.add(G.recipient_id)});const{data:U}=await Q.from("profiles").select("id, name, email").in("id",Array.from(D)),V=new Map((U==null?void 0:U.map(G=>[G.id,G]))||[]),W=(I==null?void 0:I.map(G=>({...G,sender:V.get(G.sender_id),recipient:V.get(G.recipient_id)})))||[];s(W)}catch(P){console.error("Error loading shares:",P)}finally{o(!1)}},y=n.filter(P=>{var z,D;const T=l===""||P.resource_title.toLowerCase().includes(l.toLowerCase())||((z=P.sender)==null?void 0:z.name.toLowerCase().includes(l.toLowerCase()))||((D=P.recipient)==null?void 0:D.name.toLowerCase().includes(l.toLowerCase())),I=u==="all"||P.resource_type===u;return T&&I}),_=n.length,b=new Set(n.map(P=>P.sender_id)).size,S=new Set(n.map(P=>P.recipient_id)).size,k=n.length>0?Math.round(n.filter(P=>P.is_read).length/n.length*100):0,M=n.reduce((P,T)=>(P[T.resource_type]=(P[T.resource_type]||0)+1,P),{});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((P,T)=>r.jsxs(Ze,{children:[r.jsx(Wt,{className:"pb-2",children:r.jsx(Lr,{className:"h-4 w-20"})}),r.jsx(et,{children:r.jsx(Lr,{className:"h-8 w-16"})})]},T))}),r.jsx(Ze,{children:r.jsx(et,{className:"p-6",children:r.jsx(Lr,{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(Ze,{children:[r.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Yt,{className:"text-sm font-medium",children:"Total Shares"}),r.jsx(Nc,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsx(et,{children:r.jsx("div",{className:"text-2xl font-bold",children:_})})]}),r.jsxs(Ze,{children:[r.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Yt,{className:"text-sm font-medium",children:"Active Sharers"}),r.jsx(Un,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsx(et,{children:r.jsx("div",{className:"text-2xl font-bold",children:b})})]}),r.jsxs(Ze,{children:[r.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Yt,{className:"text-sm font-medium",children:"Recipients Reached"}),r.jsx(fp,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsx(et,{children:r.jsx("div",{className:"text-2xl font-bold",children:S})})]}),r.jsxs(Ze,{children:[r.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Yt,{className:"text-sm font-medium",children:"Read Rate"}),r.jsx(Ea,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsx(et,{children:r.jsxs("div",{className:"text-2xl font-bold",children:[k,"%"]})})]})]}),r.jsxs(Ze,{children:[r.jsx(Wt,{children:r.jsx(Yt,{className:"text-sm font-medium",children:"Shares by Resource Type"})}),r.jsx(et,{children:r.jsxs("div",{className:"flex flex-wrap gap-2",children:[Object.entries(M).map(([P,T])=>r.jsxs(Pt,{variant:"secondary",className:iCe[P],children:[aCe[P],": ",T]},P)),Object.keys(M).length===0&&r.jsx("span",{className:"text-muted-foreground text-sm",children:"No shares yet"})]})})]}),r.jsxs(Ze,{children:[r.jsxs(Wt,{children:[r.jsx(Yt,{children:"Share History"}),r.jsxs(Sn,{children:["All resource shares ",e?"in your brokerage":"across the platform"]})]}),r.jsxs(et,{children:[r.jsxs("div",{className:"flex flex-col sm:flex-row gap-4 mb-4",children:[r.jsxs("div",{className:"relative flex-1",children:[r.jsx(Sa,{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:P=>i(P.target.value),className:"pl-9"})]}),r.jsxs(mn,{value:u,onValueChange:p,children:[r.jsx(fn,{className:"w-[180px]",children:r.jsx(yn,{placeholder:"Resource type"})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"all",children:"All Types"}),r.jsx(qt,{value:"event",children:"Events"}),r.jsx(qt,{value:"template",children:"Templates"}),r.jsx(qt,{value:"academy_video",children:"Academy Videos"}),r.jsx(qt,{value:"resource_kit",children:"Resource Kits"}),r.jsx(qt,{value:"newsletter",children:"Newsletters"}),r.jsx(qt,{value:"social_swag",children:"Social Swag"})]})]})]}),r.jsx(Bo,{className:"h-[400px]",children:r.jsxs(Ks,{children:[r.jsx(Zs,{children:r.jsxs(Mr,{children:[r.jsx(It,{children:"Resource"}),r.jsx(It,{children:"Type"}),r.jsx(It,{children:"Sender"}),r.jsx(It,{children:"Recipient"}),r.jsx(It,{children:"Status"}),r.jsx(It,{children:"Date"})]})}),r.jsx(Ys,{children:y.length===0?r.jsx(Mr,{children:r.jsx(kt,{colSpan:6,className:"text-center text-muted-foreground py-8",children:"No shares found"})}):y.map(P=>{var T,I;return r.jsxs(Mr,{children:[r.jsx(kt,{className:"font-medium max-w-[200px] truncate",children:P.resource_title}),r.jsx(kt,{children:r.jsx(Pt,{variant:"secondary",className:iCe[P.resource_type],children:aCe[P.resource_type]})}),r.jsx(kt,{children:((T=P.sender)==null?void 0:T.name)||"Unknown"}),r.jsx(kt,{children:((I=P.recipient)==null?void 0:I.name)||"Unknown"}),r.jsx(kt,{children:r.jsx(Pt,{variant:P.is_read?"default":"outline",children:P.is_read?"Read":"Unread"})}),r.jsx(kt,{className:"text-muted-foreground",children:on(new Date(P.created_at),"MMM d, yyyy")})]},P.id)})})]})})]})]})]})}const JSt=()=>r.jsx(Dr,{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(Ai,{defaultValue:"analytics",className:"space-y-4",children:[r.jsxs(vi,{children:[r.jsx(sn,{value:"analytics",children:"Analytics"}),r.jsx(sn,{value:"activity",children:"Activity"}),r.jsx(sn,{value:"shares",children:"Shares"})]}),r.jsx(Mn,{value:"analytics",className:"space-y-4",children:r.jsx(QSt,{})}),r.jsx(Mn,{value:"activity",className:"space-y-4",children:r.jsx(XSt,{})}),r.jsx(Mn,{value:"shares",className:"space-y-4",children:r.jsx(lBe,{})})]})]})});function eCt(){const e=Hr(),[t,n]=E.useState(!1),[s,a]=E.useState(null),[o,l]=E.useState({title:"",description:"",publish_date:new Date().toISOString().split("T")[0],is_published:!1,category_id:""}),[i,u]=E.useState(null),[p,x]=E.useState(""),[y,_]=E.useState([]),[b,S]=E.useState([]),[k,M]=E.useState([]),[P,T]=E.useState(!1),[I,z]=E.useState(null),[D,U]=E.useState(""),{data:V,isLoading:W}=Kt({queryKey:["brokerage-resources"],queryFn:async()=>{const{data:Oe,error:at}=await Q.from("brokerage_resources").select("*").order("publish_date",{ascending:!1});if(at)throw at;return Oe}}),{data:G}=Kt({queryKey:["brokerage-resource-pdfs"],queryFn:async()=>{const{data:Oe,error:at}=await Q.from("brokerage_resource_pdfs").select("*").order("sort_order",{ascending:!0});if(at)throw at;return Oe}}),{data:J}=Kt({queryKey:["brokerage-resource-videos"],queryFn:async()=>{const{data:Oe,error:at}=await Q.from("brokerage_resource_videos").select("*").order("sort_order",{ascending:!0});if(at)throw at;return Oe}}),{data:ne}=Kt({queryKey:["brokerage-resource-links"],queryFn:async()=>{const{data:Oe,error:at}=await Q.from("brokerage_resource_links").select("*").order("sort_order",{ascending:!0});if(at)throw at;return Oe}}),{data:oe,isLoading:ge}=Kt({queryKey:["brokerage-resource-categories"],queryFn:async()=>{const{data:Oe,error:at}=await Q.from("brokerage_resource_categories").select("*").order("sort_order",{ascending:!0});if(at)throw at;return Oe}}),ie=()=>{l({title:"",description:"",publish_date:new Date().toISOString().split("T")[0],is_published:!1,category_id:""}),u(null),x(""),_([]),S([]),M([]),a(null),U("")},pe=Oe=>{a(Oe),l({title:Oe.title,description:Oe.description||"",publish_date:Oe.publish_date.split("T")[0],is_published:Oe.is_published,category_id:Oe.category_id||""}),x(Oe.preview_image_url||""),U("");const at=(G==null?void 0:G.filter(Qe=>Qe.resource_id===Oe.id))||[];_(at.map(Qe=>({id:Qe.id,name:Qe.name,file_url:Qe.file_url,file_size:Qe.file_size,sort_order:Qe.sort_order})));const le=(J==null?void 0:J.filter(Qe=>Qe.resource_id===Oe.id))||[];S(le.map(Qe=>({id:Qe.id,title:Qe.title,video_url:Qe.video_url,sort_order:Qe.sort_order})));const Ve=(ne==null?void 0:ne.filter(Qe=>Qe.resource_id===Oe.id))||[];M(Ve.map(Qe=>({id:Qe.id,title:Qe.title,canva_share_link:Qe.canva_share_link,sort_order:Qe.sort_order}))),n(!0)},se=Oe=>{var le;const at=(le=Oe.target.files)==null?void 0:le[0];at&&(u(at),x(URL.createObjectURL(at)))},fe=()=>{_([...y,{name:"",file_url:"",sort_order:y.length}])},he=Oe=>{_(y.filter((at,le)=>le!==Oe))},ye=(Oe,at,le)=>{const Ve=[...y];if(at==="file"&&le instanceof File){const Qe=le.name.replace(/\.[^/.]+$/,"");Ve[Oe]={...Ve[Oe],file:le,file_size:le.size,name:Ve[Oe].name||Qe}}else Ve[Oe]={...Ve[Oe],[at]:le};_(Ve)},Ae=()=>{S([...b,{title:"",video_url:"",sort_order:b.length}])},we=Oe=>{S(b.filter((at,le)=>le!==Oe))},be=(Oe,at,le)=>{const Ve=[...b];at==="file"&&le instanceof File?Ve[Oe]={...Ve[Oe],file:le}:Ve[Oe]={...Ve[Oe],[at]:le},S(Ve)},_e=()=>{M([...k,{title:"",canva_share_link:"",sort_order:k.length}])},Je=Oe=>{M(k.filter((at,le)=>le!==Oe))},Te=(Oe,at,le)=>{const Ve=[...k];Ve[Oe]={...Ve[Oe],[at]:le},M(Ve)},De=async(Oe,at)=>{try{const le=await Q.functions.invoke("bunny-upload",{body:{action:"create",title:Oe.name}});if(le.error)throw le.error;const{videoId:Ve,uploadUrl:Qe,libraryId:st}=le.data,ke=await Q.functions.invoke("bunny-upload",{body:{action:"upload-url",videoId:Ve,libraryId:st}});if(ke.error)throw ke.error;const{uploadUrl:ct,apiKey:Ce}=ke.data,Me=new XMLHttpRequest;return Me.open("PUT",ct,!0),Me.setRequestHeader("AccessKey",Ce),Me.upload.onprogress=Ge=>{if(Ge.lengthComputable){const Ee=Math.round(Ge.loaded/Ge.total*100),He=[...b];He[at]={...He[at],uploadProgress:Ee},S(He)}},await new Promise((Ge,Ee)=>{Me.onload=()=>Me.status>=200&&Me.status<300?Ge():Ee(new Error("Upload failed")),Me.onerror=()=>Ee(new Error("Upload failed")),Me.send(Oe)}),`https://iframe.mediadelivery.net/embed/${st}/${Ve}`}catch(le){throw console.error("Bunny upload error:",le),le}},Ue=ir({mutationFn:async Oe=>{const{data:at,error:le}=await Q.from("brokerage_resource_categories").insert({name:Oe,sort_order:(oe==null?void 0:oe.length)||0}).select().single();if(le)throw le;return at},onSuccess:Oe=>{e.invalidateQueries({queryKey:["brokerage-resource-categories"]}),l({...o,category_id:Oe.id}),U(""),Ie.success("Category created")},onError:Oe=>{Ie.error("Failed to create category: "+Oe.message)}}),Be=ir({mutationFn:async()=>{T(!0);let Oe=(s==null?void 0:s.preview_image_url)||null;if(i){const Ve=i.name.split(".").pop(),Qe=`${Date.now()}.${Ve}`,{error:st}=await Q.storage.from("brokerage-resources").upload(`previews/${Qe}`,i);if(st)throw st;const{data:ke}=Q.storage.from("brokerage-resources").getPublicUrl(`previews/${Qe}`);Oe=ke.publicUrl}const at={title:o.title,description:o.description||null,preview_image_url:Oe,publish_date:o.publish_date,is_published:o.is_published,category_id:o.category_id||null};let le;if(s){const{error:Ve}=await Q.from("brokerage_resources").update(at).eq("id",s.id);if(Ve)throw Ve;le=s.id;const Qe=(G==null?void 0:G.filter(nt=>nt.resource_id===s.id).map(nt=>nt.id))||[],st=y.filter(nt=>nt.id).map(nt=>nt.id),ke=Qe.filter(nt=>!st.includes(nt));ke.length>0&&await Q.from("brokerage_resource_pdfs").delete().in("id",ke);const ct=(J==null?void 0:J.filter(nt=>nt.resource_id===s.id).map(nt=>nt.id))||[],Ce=b.filter(nt=>nt.id).map(nt=>nt.id),Me=ct.filter(nt=>!Ce.includes(nt));Me.length>0&&await Q.from("brokerage_resource_videos").delete().in("id",Me);const Ge=(ne==null?void 0:ne.filter(nt=>nt.resource_id===s.id).map(nt=>nt.id))||[],Ee=k.filter(nt=>nt.id).map(nt=>nt.id),He=Ge.filter(nt=>!Ee.includes(nt));He.length>0&&await Q.from("brokerage_resource_links").delete().in("id",He)}else{const{data:Ve,error:Qe}=await Q.from("brokerage_resources").insert(at).select().single();if(Qe)throw Qe;le=Ve.id}for(let Ve=0;Ve{e.invalidateQueries({queryKey:["brokerage-resources"]}),e.invalidateQueries({queryKey:["brokerage-resource-pdfs"]}),e.invalidateQueries({queryKey:["brokerage-resource-videos"]}),e.invalidateQueries({queryKey:["brokerage-resource-links"]}),Ie.success(s?"Resource updated":"Resource created"),n(!1),ie(),T(!1)},onError:Oe=>{Ie.error("Failed to save resource: "+Oe.message),T(!1)}}),qe=ir({mutationFn:async Oe=>{const{error:at}=await Q.from("brokerage_resources").delete().eq("id",Oe);if(at)throw at},onSuccess:()=>{e.invalidateQueries({queryKey:["brokerage-resources"]}),e.invalidateQueries({queryKey:["brokerage-resource-pdfs"]}),e.invalidateQueries({queryKey:["brokerage-resource-videos"]}),e.invalidateQueries({queryKey:["brokerage-resource-links"]}),Ie.success("Resource deleted")},onError:Oe=>{Ie.error("Failed to delete: "+Oe.message)}}),ot=Oe=>{if(Oe.preventDefault(),!o.title){Ie.error("Please enter a title");return}Be.mutate()},Mt=Oe=>{const at=(G==null?void 0:G.filter(Qe=>Qe.resource_id===Oe).length)||0,le=(J==null?void 0:J.filter(Qe=>Qe.resource_id===Oe).length)||0,Ve=(ne==null?void 0:ne.filter(Qe=>Qe.resource_id===Oe).length)||0;return{pdfCount:at,videoCount:le,linkCount:Ve}};return r.jsx(Dr,{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(Ze,{children:[r.jsx(Wt,{className:"pb-2",children:r.jsx(Yt,{className:"text-sm font-medium text-muted-foreground",children:"Total Resources"})}),r.jsx(et,{children:r.jsx("div",{className:"text-2xl font-bold",children:(V==null?void 0:V.length)||0})})]}),r.jsxs(Ze,{children:[r.jsx(Wt,{className:"pb-2",children:r.jsx(Yt,{className:"text-sm font-medium text-muted-foreground",children:"Published"})}),r.jsx(et,{children:r.jsx("div",{className:"text-2xl font-bold",children:(V==null?void 0:V.filter(Oe=>Oe.is_published).length)||0})})]})]}),r.jsxs(ee,{onClick:()=>{ie(),n(!0)},children:[r.jsx(bn,{className:"h-4 w-4 mr-2"}),"Add Resource"]})]}),r.jsx(Ze,{children:r.jsx(et,{className:"p-0",children:r.jsxs(Ks,{children:[r.jsx(Zs,{children:r.jsxs(Mr,{children:[r.jsx(It,{children:"Title"}),r.jsx(It,{children:"Category"}),r.jsx(It,{children:"Content"}),r.jsx(It,{children:"Publish Date"}),r.jsx(It,{children:"Status"}),r.jsx(It,{className:"text-right",children:"Actions"})]})}),r.jsx(Ys,{children:W?r.jsx(Mr,{children:r.jsx(kt,{colSpan:6,className:"text-center py-8",children:"Loading..."})}):(V==null?void 0:V.length)===0?r.jsx(Mr,{children:r.jsx(kt,{colSpan:6,className:"text-center py-8 text-muted-foreground",children:"No brokerage resources yet. Create your first one!"})}):V==null?void 0:V.map(Oe=>{const{pdfCount:at,videoCount:le,linkCount:Ve}=Mt(Oe.id),Qe=oe==null?void 0:oe.find(st=>st.id===Oe.category_id);return r.jsxs(Mr,{children:[r.jsx(kt,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[Oe.preview_image_url?r.jsx("img",{src:Oe.preview_image_url,alt:Oe.title,className:"w-10 h-10 rounded object-cover"}):r.jsx("div",{className:"w-10 h-10 rounded bg-muted flex items-center justify-center",children:r.jsx(Ah,{className:"h-5 w-5 text-muted-foreground"})}),r.jsxs("div",{children:[r.jsx("div",{className:"font-medium",children:Oe.title}),Oe.description&&r.jsx("div",{className:"text-sm text-muted-foreground line-clamp-1",children:Oe.description})]})]})}),r.jsx(kt,{children:Qe?r.jsx("span",{className:"inline-flex items-center px-2 py-1 rounded-full text-xs font-medium bg-muted",children:Qe.name}):r.jsx("span",{className:"text-muted-foreground text-sm",children:"—"})}),r.jsx(kt,{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(Ea,{className:"h-3.5 w-3.5"}),at]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx($a,{className:"h-3.5 w-3.5"}),le]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Io,{className:"h-3.5 w-3.5"}),Ve]})]})}),r.jsx(kt,{children:on(new Date(Oe.publish_date),"MMM d, yyyy")}),r.jsx(kt,{children:r.jsx("span",{className:`inline-flex items-center px-2 py-1 rounded-full text-xs font-medium ${Oe.is_published?"bg-green-100 text-green-800":"bg-yellow-100 text-yellow-800"}`,children:Oe.is_published?"Published":"Draft"})}),r.jsx(kt,{className:"text-right",children:r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>{const st=(G==null?void 0:G.filter(Ce=>Ce.resource_id===Oe.id))||[],ke=(J==null?void 0:J.filter(Ce=>Ce.resource_id===Oe.id))||[],ct=(ne==null?void 0:ne.filter(Ce=>Ce.resource_id===Oe.id))||[];z({...Oe,pdfs:st,videos:ke,links:ct})},children:r.jsx(Ko,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>pe(Oe),children:r.jsx(ni,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>{confirm("Delete this resource?")&&qe.mutate(Oe.id)},children:r.jsx(Bn,{className:"h-4 w-4 text-destructive"})})]})})]},Oe.id)})})]})})}),r.jsx(Or,{open:t,onOpenChange:n,children:r.jsxs(Ir,{className:"max-w-3xl max-h-[90vh] overflow-y-auto",children:[r.jsx($r,{children:r.jsx(Fr,{children:s?"Edit Brokerage Resource":"Add Brokerage Resource"})}),r.jsxs("form",{onSubmit:ot,className:"space-y-6",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{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(Ah,{className:"h-8 w-8 text-muted-foreground"})}),r.jsx(dt,{type:"file",accept:"image/*",onChange:se})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{htmlFor:"title",children:"Title *"}),r.jsx(dt,{id:"title",value:o.title,onChange:Oe=>l({...o,title:Oe.target.value}),placeholder:"Resource Title"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs($e,{className:"flex items-center gap-2",children:[r.jsx(zg,{className:"h-4 w-4"}),"Category"]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(mn,{value:o.category_id,onValueChange:Oe=>l({...o,category_id:Oe}),children:[r.jsx(fn,{className:"flex-1",children:r.jsx(yn,{placeholder:"Select a category"})}),r.jsx(pn,{children:oe==null?void 0:oe.map(Oe=>r.jsx(qt,{value:Oe.id,children:Oe.name},Oe.id))})]}),o.category_id&&r.jsx(ee,{type:"button",variant:"ghost",size:"icon",onClick:()=>l({...o,category_id:""}),children:r.jsx(hs,{className:"h-4 w-4"})})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(dt,{placeholder:"Or create new category...",value:D,onChange:Oe=>U(Oe.target.value),className:"flex-1"}),r.jsxs(ee,{type:"button",variant:"outline",size:"sm",disabled:!D.trim()||Ue.isPending,onClick:()=>Ue.mutate(D.trim()),children:[r.jsx(bn,{className:"h-4 w-4 mr-1"}),"Add"]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{children:"Description"}),r.jsx(ax,{content:o.description,onChange:Oe=>l({...o,description:Oe}),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($e,{htmlFor:"publish_date",children:"Publish Date"}),r.jsx(dt,{id:"publish_date",type:"date",value:o.publish_date,onChange:Oe=>l({...o,publish_date:Oe.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{children:"Published"}),r.jsxs("div",{className:"flex items-center space-x-2 pt-2",children:[r.jsx(Ts,{checked:o.is_published,onCheckedChange:Oe=>l({...o,is_published:Oe})}),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($e,{className:"flex items-center gap-2",children:[r.jsx(Ea,{className:"h-4 w-4"}),"PDF Documents (",y.length,")"]}),r.jsxs(ee,{type:"button",variant:"outline",size:"sm",onClick:fe,children:[r.jsx(bn,{className:"h-4 w-4 mr-1"}),"Add PDF"]})]}),y.map((Oe,at)=>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:Oe.name,onChange:le=>ye(at,"name",le.target.value),className:"flex-1"}),r.jsx(dt,{type:"file",accept:".pdf",onChange:le=>{var Qe;const Ve=(Qe=le.target.files)==null?void 0:Qe[0];Ve&&ye(at,"file",Ve)},className:"flex-1"}),Oe.file_url&&!Oe.file&&r.jsx("span",{className:"text-xs text-muted-foreground",children:"Uploaded"}),r.jsx(ee,{type:"button",variant:"ghost",size:"icon",onClick:()=>he(at),children:r.jsx(hs,{className:"h-4 w-4"})})]},at))]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs($e,{className:"flex items-center gap-2",children:[r.jsx($a,{className:"h-4 w-4"}),"Videos (",b.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"]})]}),b.map((Oe,at)=>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:Oe.title,onChange:le=>be(at,"title",le.target.value),className:"flex-1"}),r.jsx(ee,{type:"button",variant:"ghost",size:"icon",onClick:()=>we(at),children:r.jsx(hs,{className:"h-4 w-4"})})]}),r.jsx(dt,{type:"file",accept:"video/*",onChange:le=>{var Qe;const Ve=(Qe=le.target.files)==null?void 0:Qe[0];Ve&&be(at,"file",Ve)}}),Oe.uploadProgress!==void 0&&Oe.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:`${Oe.uploadProgress}%`}})}),Oe.video_url&&!Oe.file&&r.jsx("span",{className:"text-xs text-muted-foreground",children:"Video uploaded"})]},at))]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs($e,{className:"flex items-center gap-2",children:[r.jsx(Io,{className:"h-4 w-4"}),"Canva Links (",k.length,")"]}),r.jsxs(ee,{type:"button",variant:"outline",size:"sm",onClick:_e,children:[r.jsx(bn,{className:"h-4 w-4 mr-1"}),"Add Link"]})]}),k.map((Oe,at)=>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:Oe.title,onChange:le=>Te(at,"title",le.target.value),className:"flex-1"}),r.jsx(dt,{placeholder:"Canva Share Link",value:Oe.canva_share_link,onChange:le=>Te(at,"canva_share_link",le.target.value),className:"flex-1"}),r.jsx(ee,{type:"button",variant:"ghost",size:"icon",onClick:()=>Je(at),children:r.jsx(hs,{className:"h-4 w-4"})})]},at))]}),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:Be.isPending||P,children:Be.isPending||P?"Saving...":s?"Update":"Create"})]})]})]})}),r.jsx(Or,{open:!!I,onOpenChange:()=>z(null),children:r.jsxs(Ir,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsx($r,{children:r.jsx(Fr,{children:I==null?void 0:I.title})}),I&&r.jsxs("div",{className:"space-y-4",children:[I.preview_image_url&&r.jsx("img",{src:I.preview_image_url,alt:I.title,className:"w-full h-48 object-cover rounded-lg"}),I.description&&r.jsx("p",{className:"text-muted-foreground",children:I.description}),I.pdfs&&I.pdfs.length>0&&r.jsxs("div",{children:[r.jsxs("h4",{className:"font-medium mb-2 flex items-center gap-2",children:[r.jsx(Ea,{className:"h-4 w-4"}),"PDF Documents (",I.pdfs.length,")"]}),r.jsx("div",{className:"space-y-1",children:I.pdfs.map(Oe=>r.jsx("a",{href:Oe.file_url,target:"_blank",rel:"noopener noreferrer",className:"block p-2 border rounded hover:bg-muted",children:Oe.name},Oe.id))})]}),I.videos&&I.videos.length>0&&r.jsxs("div",{children:[r.jsxs("h4",{className:"font-medium mb-2 flex items-center gap-2",children:[r.jsx($a,{className:"h-4 w-4"}),"Videos (",I.videos.length,")"]}),r.jsx("div",{className:"space-y-2",children:I.videos.map(Oe=>r.jsx("div",{className:"p-2 border rounded",children:r.jsx("p",{className:"font-medium text-sm",children:Oe.title})},Oe.id))})]}),I.links&&I.links.length>0&&r.jsxs("div",{children:[r.jsxs("h4",{className:"font-medium mb-2 flex items-center gap-2",children:[r.jsx(Io,{className:"h-4 w-4"}),"Canva Links (",I.links.length,")"]}),r.jsx("div",{className:"space-y-1",children:I.links.map(Oe=>r.jsx("a",{href:Oe.canva_share_link,target:"_blank",rel:"noopener noreferrer",className:"block p-2 border rounded hover:bg-muted",children:Oe.title},Oe.id))})]})]})]})})]})})}const cBe=[{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 tCt(){const[e,t]=E.useState([]),[n,s]=E.useState(!0),[a,o]=E.useState(!1),[l,i]=E.useState(!1),[u,p]=E.useState(null),[x,y]=E.useState(!1),[_,b]=E.useState(!1),[S,k]=E.useState(""),[M,P]=E.useState(""),[T,I]=E.useState(""),[z,D]=E.useState(""),[U,V]=E.useState("Learn More"),[W,G]=E.useState("top"),[J,ne]=E.useState(""),[oe,ge]=E.useState(!0),[ie,pe]=E.useState(""),[se,fe]=E.useState("");E.useEffect(()=>{he()},[]);const he=async()=>{try{const{data:Ue,error:Be}=await Q.from("dashboard_banners").select("*").order("placement").order("sort_order");if(Be)throw Be;t(Ue||[])}catch(Ue){Ie.error("Failed to load banners: "+Ue.message)}finally{s(!1)}},ye=()=>{k(""),P(""),I(""),D(""),V("Learn More"),G("top"),ne(""),ge(!0),pe(""),fe(""),p(null)},Ae=Ue=>{p(Ue),k(Ue.title),P(Ue.description||""),I(Ue.image_url),D(Ue.link_url||""),V(Ue.link_text||"Learn More"),G(Ue.placement),ne(Ue.section_after||""),ge(Ue.is_active),pe(Ue.start_date?on(new Date(Ue.start_date),"yyyy-MM-dd'T'HH:mm"):""),fe(Ue.end_date?on(new Date(Ue.end_date),"yyyy-MM-dd'T'HH:mm"):""),o(!0)},we=async Ue=>{var qe;const Be=(qe=Ue.target.files)==null?void 0:qe[0];if(Be){y(!0);try{const ot=Be.name.split(".").pop(),Mt=`${Date.now()}.${ot}`,{error:Oe}=await Q.storage.from("banner-images").upload(Mt,Be);if(Oe)throw Oe;const{data:{publicUrl:at}}=Q.storage.from("banner-images").getPublicUrl(Mt);I(at),Ie.success("Image uploaded successfully")}catch(ot){Ie.error("Failed to upload image: "+ot.message)}finally{y(!1)}}},be=async()=>{if(!S.trim()||!T){Ie.error("Please fill in required fields (title and image)");return}b(!0);try{const Ue={title:S.trim(),description:M.trim()||null,image_url:T,link_url:z.trim()||null,link_text:U.trim()||"Learn More",placement:W,section_after:W==="between"?J:null,is_active:oe,start_date:ie?new Date(ie).toISOString():null,end_date:se?new Date(se).toISOString():null};if(u){const{error:Be}=await Q.from("dashboard_banners").update(Ue).eq("id",u.id);if(Be)throw Be;Ie.success("Banner updated successfully")}else{const Be=e.filter(ot=>ot.placement===W).length,{error:qe}=await Q.from("dashboard_banners").insert({...Ue,sort_order:Be});if(qe)throw qe;Ie.success("Banner created successfully")}o(!1),ye(),he()}catch(Ue){Ie.error("Failed to save banner: "+Ue.message)}finally{b(!1)}},_e=async()=>{if(u)try{const{error:Ue}=await Q.from("dashboard_banners").delete().eq("id",u.id);if(Ue)throw Ue;Ie.success("Banner deleted successfully"),i(!1),p(null),he()}catch(Ue){Ie.error("Failed to delete banner: "+Ue.message)}},Je=async Ue=>{try{const{error:Be}=await Q.from("dashboard_banners").update({is_active:!Ue.is_active}).eq("id",Ue.id);if(Be)throw Be;Ie.success(Ue.is_active?"Banner deactivated":"Banner activated"),he()}catch(Be){Ie.error("Failed to update banner: "+Be.message)}},Te=e.filter(Ue=>Ue.placement==="top"),De=e.filter(Ue=>Ue.placement==="between");return n?r.jsx(Dr,{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(Dr,{title:"Dashboard Management",description:"Configure dashboard modules and banners",children:[r.jsxs("div",{className:"space-y-8",children:[r.jsxs(Ze,{children:[r.jsxs(Wt,{className:"flex flex-row items-center justify-between",children:[r.jsxs("div",{children:[r.jsxs(Yt,{className:"flex items-center gap-2",children:[r.jsx(Rl,{className:"h-5 w-5"}),"Hero Banners (Top of Dashboard)"]}),r.jsx(Sn,{children:"These banners appear in a rotating carousel at the top of the dashboard"})]}),r.jsxs(Or,{open:a&&W==="top",onOpenChange:Ue=>{Ue||ye(),o(Ue),Ue&&G("top")},children:[r.jsx(Zo,{asChild:!0,children:r.jsxs(ee,{onClick:()=>{ye(),G("top")},children:[r.jsx(bn,{className:"mr-2 h-4 w-4"}),"Add Hero Banner"]})}),r.jsxs(Ir,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsxs($r,{children:[r.jsxs(Fr,{children:[u?"Edit":"Create"," Banner"]}),r.jsx(Zn,{children:"Configure the banner's content and display settings"})]}),r.jsx(oCe,{title:S,setTitle:k,description:M,setDescription:P,imageUrl:T,linkUrl:z,setLinkUrl:D,linkText:U,setLinkText:V,placement:W,setPlacement:G,sectionAfter:J,setSectionAfter:ne,isActive:oe,setIsActive:ge,startDate:ie,setStartDate:pe,endDate:se,setEndDate:fe,handleImageUpload:we,uploading:x,showPlacementOptions:!1}),r.jsxs(Bs,{children:[r.jsx(ee,{variant:"outline",onClick:()=>{o(!1),ye()},children:"Cancel"}),r.jsx(ee,{onClick:be,disabled:_,children:_?"Saving...":u?"Update Banner":"Create Banner"})]})]})]})]}),r.jsx(et,{children:Te.length===0?r.jsx("p",{className:"text-muted-foreground text-center py-8",children:"No hero banners yet. Add your first banner above."}):r.jsx("div",{className:"space-y-3",children:Te.map(Ue=>r.jsx(lCe,{banner:Ue,onEdit:()=>Ae(Ue),onDelete:()=>{p(Ue),i(!0)},onToggleActive:()=>Je(Ue)},Ue.id))})})]}),r.jsxs(Ze,{children:[r.jsxs(Wt,{className:"flex flex-row items-center justify-between",children:[r.jsxs("div",{children:[r.jsxs(Yt,{className:"flex items-center gap-2",children:[r.jsx(Rl,{className:"h-5 w-5"}),"Section Banners"]}),r.jsx(Sn,{children:"These banners appear between dashboard content sections"})]}),r.jsxs(Or,{open:a&&W==="between",onOpenChange:Ue=>{Ue||ye(),o(Ue),Ue&&G("between")},children:[r.jsx(Zo,{asChild:!0,children:r.jsxs(ee,{onClick:()=>{ye(),G("between")},children:[r.jsx(bn,{className:"mr-2 h-4 w-4"}),"Add Section Banner"]})}),r.jsxs(Ir,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsxs($r,{children:[r.jsxs(Fr,{children:[u?"Edit":"Create"," Section Banner"]}),r.jsx(Zn,{children:"Configure where this banner appears between sections"})]}),r.jsx(oCe,{title:S,setTitle:k,description:M,setDescription:P,imageUrl:T,linkUrl:z,setLinkUrl:D,linkText:U,setLinkText:V,placement:W,setPlacement:G,sectionAfter:J,setSectionAfter:ne,isActive:oe,setIsActive:ge,startDate:ie,setStartDate:pe,endDate:se,setEndDate:fe,handleImageUpload:we,uploading:x,showPlacementOptions:!0}),r.jsxs(Bs,{children:[r.jsx(ee,{variant:"outline",onClick:()=>{o(!1),ye()},children:"Cancel"}),r.jsx(ee,{onClick:be,disabled:_,children:_?"Saving...":u?"Update Banner":"Create Banner"})]})]})]})]}),r.jsx(et,{children:De.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:De.map(Ue=>r.jsx(lCe,{banner:Ue,onEdit:()=>Ae(Ue),onDelete:()=>{p(Ue),i(!0)},onToggleActive:()=>Je(Ue),showSection:!0},Ue.id))})})]})]}),r.jsx(Or,{open:l,onOpenChange:i,children:r.jsxs(Ir,{children:[r.jsxs($r,{children:[r.jsx(Fr,{children:"Delete Banner"}),r.jsxs(Zn,{children:['Are you sure you want to delete "',u==null?void 0:u.title,'"? This action cannot be undone.']})]}),r.jsxs(Bs,{children:[r.jsx(ee,{variant:"outline",onClick:()=>i(!1),children:"Cancel"}),r.jsx(ee,{variant:"destructive",onClick:_e,children:"Delete"})]})]})})]})}function oCe({title:e,setTitle:t,description:n,setDescription:s,imageUrl:a,linkUrl:o,setLinkUrl:l,linkText:i,setLinkText:u,placement:p,setPlacement:x,sectionAfter:y,setSectionAfter:_,isActive:b,setIsActive:S,startDate:k,setStartDate:M,endDate:P,setEndDate:T,handleImageUpload:I,uploading:z,showPlacementOptions:D}){return r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{htmlFor:"title",children:"Title *"}),r.jsx(dt,{id:"title",placeholder:"Banner headline...",value:e,onChange:U=>t(U.target.value)})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{htmlFor:"description",children:"Description"}),r.jsx(Jn,{id:"description",placeholder:"Optional banner description...",value:n,onChange:U=>s(U.target.value),rows:2})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{children:"Banner Image *"}),r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx(dt,{type:"file",accept:"image/*",onChange:I,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($e,{htmlFor:"linkUrl",children:"Link URL (optional)"}),r.jsx(dt,{id:"linkUrl",placeholder:"https://...",value:o,onChange:U=>l(U.target.value)})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{htmlFor:"linkText",children:"Button Text"}),r.jsx(dt,{id:"linkText",placeholder:"Learn More",value:i,onChange:U=>u(U.target.value)})]})]}),D&&r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{children:"Placement"}),r.jsxs(mn,{value:y,onValueChange:_,children:[r.jsx(fn,{children:r.jsx(yn,{placeholder:"Select section placement..."})}),r.jsx(pn,{children:cBe.map(U=>r.jsx(qt,{value:U.value,children:U.label},U.value))})]})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsxs($e,{htmlFor:"startDate",className:"flex items-center gap-2",children:[r.jsx(Ss,{className:"h-4 w-4"}),"Start Date (optional)"]}),r.jsx(dt,{id:"startDate",type:"datetime-local",value:k,onChange:U=>M(U.target.value)})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs($e,{htmlFor:"endDate",className:"flex items-center gap-2",children:[r.jsx(Ss,{className:"h-4 w-4"}),"End Date (optional)"]}),r.jsx(dt,{id:"endDate",type:"datetime-local",value:P,onChange:U=>T(U.target.value)})]})]}),r.jsx("div",{className:"flex items-center justify-between pt-2",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ts,{id:"isActive",checked:b,onCheckedChange:S}),r.jsx($e,{htmlFor:"isActive",children:"Active"})]})})]})}function lCe({banner:e,onEdit:t,onDelete:n,onToggleActive:s,showSection:a=!1}){var l;const o=(l=cBe.find(i=>i.value===e.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(dy,{className:"h-5 w-5 text-muted-foreground cursor-grab"}),r.jsx("img",{src:e.image_url,alt:e.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:e.title}),!e.is_active&&r.jsx(Pt,{variant:"secondary",children:"Inactive"}),e.start_date&&new Date(e.start_date)>new Date&&r.jsx(Pt,{variant:"outline",children:"Scheduled"})]}),e.description&&r.jsx("p",{className:"text-sm text-muted-foreground truncate",children:e.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:[e.link_url&&r.jsx("a",{href:e.link_url,target:"_blank",rel:"noopener noreferrer",children:r.jsx(ee,{variant:"ghost",size:"icon",children:r.jsx(As,{className:"h-4 w-4"})})}),r.jsx(ee,{variant:"ghost",size:"icon",onClick:s,children:e.is_active?r.jsx(Ko,{className:"h-4 w-4"}):r.jsx($1,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"icon",onClick:t,children:r.jsx(ni,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"icon",onClick:n,children:r.jsx(Bn,{className:"h-4 w-4 text-destructive"})})]})]})}const NO={open:{label:"Open",icon:Ya,color:"bg-yellow-500"},in_progress:{label:"In Progress",icon:Ul,color:"bg-blue-500"},resolved:{label:"Resolved",icon:di,color:"bg-green-500"},closed:{label:"Closed",icon:bc,color:"bg-muted-foreground"}},cCe={general:"General Support",technology:"Technology Support",crm:"CRM Support",marketing:"Marketing Support"};function rCt(){var U,V;const{user:e}=tn(),t=Hr(),[n,s]=E.useState(null),[a,o]=E.useState(""),[l,i]=E.useState("all"),[u,p]=E.useState("all"),[x,y]=E.useState(!1),{data:_=[],isLoading:b}=Kt({queryKey:["admin-support-tickets",l,u],queryFn:async()=>{let W=Q.from("support_tickets").select("*, profiles!support_tickets_user_id_fkey(name, email)").order("created_at",{ascending:!1});l!=="all"&&(W=W.eq("status",l)),u!=="all"&&(W=W.eq("category",u));const{data:G,error:J}=await W;if(J)throw J;return G}}),{data:S=[]}=Kt({queryKey:["admin-users-notifications"],queryFn:async()=>{const{data:W,error:G}=await Q.from("user_roles").select("user_id").eq("role","admin");if(G)throw G;const J=W.map(se=>se.user_id),{data:ne,error:oe}=await Q.from("profiles").select("id, name, email").in("id",J);if(oe)throw oe;const{data:ge,error:ie}=await Q.from("support_notification_settings").select("user_id, receive_notifications");if(ie)throw ie;const pe=new Map((ge==null?void 0:ge.map(se=>[se.user_id,se.receive_notifications]))||[]);return ne.map(se=>({...se,receives_notifications:pe.get(se.id)||!1}))}}),{data:k=[]}=Kt({queryKey:["admin-ticket-replies",n==null?void 0:n.id],queryFn:async()=>{if(!n)return[];const{data:W,error:G}=await Q.from("support_ticket_replies").select("*, profiles(name)").eq("ticket_id",n.id).order("created_at",{ascending:!0});if(G)throw G;return W},enabled:!!n}),M=ir({mutationFn:async({userId:W,enabled:G})=>{const{data:J}=await Q.from("support_notification_settings").select("id").eq("user_id",W).maybeSingle();if(J){const{error:ne}=await Q.from("support_notification_settings").update({receive_notifications:G}).eq("user_id",W);if(ne)throw ne}else{const{error:ne}=await Q.from("support_notification_settings").insert({user_id:W,receive_notifications:G});if(ne)throw ne}},onSuccess:()=>{t.invalidateQueries({queryKey:["admin-users-notifications"]}),Ie.success("Notification settings updated")},onError:()=>{Ie.error("Failed to update settings")}}),P=ir({mutationFn:async({ticketId:W,status:G})=>{const{error:J}=await Q.from("support_tickets").update({status:G}).eq("id",W);if(J)throw J},onSuccess:()=>{t.invalidateQueries({queryKey:["admin-support-tickets"]}),n&&s({...n,status:n.status}),Ie.success("Status updated")},onError:()=>{Ie.error("Failed to update status")}}),T=ir({mutationFn:async({ticketId:W,assignedTo:G})=>{const{error:J}=await Q.from("support_tickets").update({assigned_to:G}).eq("id",W);if(J)throw J},onSuccess:()=>{t.invalidateQueries({queryKey:["admin-support-tickets"]}),Ie.success("Ticket assigned")},onError:()=>{Ie.error("Failed to assign ticket")}}),I=ir({mutationFn:async W=>{var J,ne;if(!n||!e)throw new Error("Missing data");const{error:G}=await Q.from("support_ticket_replies").insert({ticket_id:n.id,user_id:e.id,content:W,is_admin_reply:!0});if(G)throw G;try{await Q.functions.invoke("support-reply-notify",{body:{ticketId:n.id,ticketSubject:n.subject,replyContent:W,userEmail:(J=n.profiles)==null?void 0:J.email,userName:(ne=n.profiles)==null?void 0:ne.name}})}catch(oe){console.error("Failed to send reply notification:",oe)}},onSuccess:()=>{t.invalidateQueries({queryKey:["admin-ticket-replies",n==null?void 0:n.id]}),o(""),Ie.success("Reply sent!")},onError:()=>{Ie.error("Failed to send reply")}}),z=()=>{a.trim()&&I.mutate(a)};E.useEffect(()=>{const W=Q.channel("admin-tickets").on("postgres_changes",{event:"*",schema:"public",table:"support_tickets"},()=>{t.invalidateQueries({queryKey:["admin-support-tickets"]})}).subscribe();return()=>{Q.removeChannel(W)}},[t]);const D=_.filter(W=>W.status==="open").length;return n?(NO[n.status].icon,r.jsx(Dr,{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(po,{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(Pt,{variant:"secondary",children:cCe[n.category]}),r.jsxs("span",{className:"text-sm text-muted-foreground",children:["from ",((U=n.profiles)==null?void 0:U.name)||"Unknown"," (",(V=n.profiles)==null?void 0:V.email,")"]})]})]})]}),r.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[r.jsxs(Ze,{children:[r.jsx(Wt,{className:"pb-2",children:r.jsx(Yt,{className:"text-sm",children:"Status"})}),r.jsx(et,{children:r.jsxs(mn,{value:n.status,onValueChange:W=>{P.mutate({ticketId:n.id,status:W}),s({...n,status:W})},children:[r.jsx(fn,{children:r.jsx(yn,{})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"open",children:"Open"}),r.jsx(qt,{value:"in_progress",children:"In Progress"}),r.jsx(qt,{value:"resolved",children:"Resolved"}),r.jsx(qt,{value:"closed",children:"Closed"})]})]})})]}),r.jsxs(Ze,{children:[r.jsx(Wt,{className:"pb-2",children:r.jsx(Yt,{className:"text-sm",children:"Assigned To"})}),r.jsx(et,{children:r.jsxs(mn,{value:n.assigned_to||"unassigned",onValueChange:W=>{const G=W==="unassigned"?null:W;T.mutate({ticketId:n.id,assignedTo:G}),s({...n,assigned_to:G})},children:[r.jsx(fn,{children:r.jsx(yn,{placeholder:"Unassigned"})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"unassigned",children:"Unassigned"}),S.map(W=>r.jsx(qt,{value:W.id,children:W.name},W.id))]})]})})]})]}),r.jsxs(Ze,{children:[r.jsx(Wt,{children:r.jsxs(Sn,{children:["Created on ",on(new Date(n.created_at),"MMM d, yyyy 'at' h:mm a")]})}),r.jsx(et,{children:r.jsx("p",{className:"text-muted-foreground whitespace-pre-wrap",children:n.description})})]}),r.jsxs(Ze,{children:[r.jsx(Wt,{children:r.jsx(Yt,{className:"text-lg",children:"Conversation"})}),r.jsxs(et,{children:[r.jsx(Bo,{className:"h-[300px] pr-4",children:k.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:k.map(W=>{var G,J;return r.jsxs("div",{className:`p-4 rounded-lg ${W.is_admin_reply?"bg-primary/10 ml-4":"bg-muted mr-4"}`,children:[r.jsxs("div",{className:"flex justify-between items-start mb-2",children:[r.jsx("span",{className:"font-medium text-sm",children:W.is_admin_reply?`${((G=W.profiles)==null?void 0:G.name)||"Admin"} (Support)`:((J=W.profiles)==null?void 0:J.name)||"User"}),r.jsx("span",{className:"text-xs text-muted-foreground",children:on(new Date(W.created_at),"MMM d, h:mm a")})]}),r.jsx("p",{className:"text-sm whitespace-pre-wrap",children:W.content})]},W.id)})})}),r.jsx(Ld,{className:"my-4"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(Jn,{placeholder:"Type your reply...",value:a,onChange:W=>o(W.target.value),className:"min-h-[80px]"}),r.jsx(ee,{onClick:z,disabled:!a.trim()||I.isPending,className:"self-end",children:r.jsx(lo,{className:"h-4 w-4"})})]})]})]})]})})):r.jsx(Dr,{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",D>0&&r.jsxs(Pt,{variant:"destructive",className:"ml-2",children:[D," open"]})]})]}),r.jsxs(Or,{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(Ir,{children:[r.jsxs($r,{children:[r.jsx(Fr,{children:"Email Notification Settings"}),r.jsx(Zn,{children:"Choose which admins receive email notifications for new support tickets."})]}),r.jsx("div",{className:"space-y-4 mt-4",children:S.map(W=>r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(ic,{className:"h-4 w-4 text-muted-foreground"}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:W.name}),r.jsx("p",{className:"text-sm text-muted-foreground",children:W.email})]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[W.receives_notifications?r.jsx(Lg,{className:"h-4 w-4 text-primary"}):r.jsx(Sj,{className:"h-4 w-4 text-muted-foreground"}),r.jsx(Ts,{checked:W.receives_notifications,onCheckedChange:G=>M.mutate({userId:W.id,enabled:G})})]})]},W.id))})]})]})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex flex-wrap gap-4 items-center",children:[r.jsx(Ai,{value:l,onValueChange:i,className:"w-auto",children:r.jsxs(vi,{children:[r.jsx(sn,{value:"all",children:"All"}),r.jsx(sn,{value:"open",children:"Open"}),r.jsx(sn,{value:"in_progress",children:"In Progress"}),r.jsx(sn,{value:"resolved",children:"Resolved"}),r.jsx(sn,{value:"closed",children:"Closed"})]})}),r.jsxs(mn,{value:u,onValueChange:p,children:[r.jsx(fn,{className:"w-[180px]",children:r.jsx(yn,{placeholder:"All Categories"})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"all",children:"All Categories"}),r.jsx(qt,{value:"general",children:"General Support"}),r.jsx(qt,{value:"technology",children:"Technology Support"}),r.jsx(qt,{value:"crm",children:"CRM Support"}),r.jsx(qt,{value:"marketing",children:"Marketing Support"})]})]})]}),r.jsx("div",{className:"mt-4",children:b?r.jsx("div",{className:"text-center py-12 text-muted-foreground",children:"Loading tickets..."}):_.length===0?r.jsx(Ze,{children:r.jsxs(et,{className:"text-center py-12",children:[r.jsx(Ul,{className:"h-12 w-12 mx-auto text-muted-foreground mb-4"}),r.jsx("h3",{className:"text-lg font-medium mb-2",children:"No tickets found"}),r.jsx("p",{className:"text-muted-foreground",children:"No support tickets match the current filters."})]})}):r.jsx("div",{className:"space-y-3",children:_.map(W=>{var J,ne;const G=NO[W.status].icon;return r.jsx(Ze,{className:"cursor-pointer hover:bg-muted/50 transition-colors",onClick:()=>s(W),children:r.jsx(et,{className:"p-4",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("h3",{className:"font-medium truncate",children:W.subject}),r.jsxs("div",{className:"flex items-center gap-2 mt-1 flex-wrap",children:[r.jsx(Pt,{variant:"outline",className:"text-xs",children:cCe[W.category]}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:[(J=W.profiles)==null?void 0:J.name," • ",on(new Date(W.created_at),"MMM d, yyyy")]}),W.assigned_to&&r.jsxs(Pt,{variant:"secondary",className:"text-xs gap-1",children:[r.jsx(ic,{className:"h-3 w-3"}),((ne=S.find(oe=>oe.id===W.assigned_to))==null?void 0:ne.name)||"Assigned"]})]})]}),r.jsxs(Pt,{className:NO[W.status].color,children:[r.jsx(G,{className:"h-3 w-3 mr-1"}),NO[W.status].label]})]})})},W.id)})})})]})]})})}const nCt=ou.create({name:"color",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{color:{default:null,parseHTML:e=>{var t;return(t=e.style.color)===null||t===void 0?void 0:t.replace(/['"]+/g,"")},renderHTML:e=>e.color?{style:`color: ${e.color}`}:{}}}}]},addCommands(){return{setColor:e=>({chain:t})=>t().setMark("textStyle",{color:e}).run(),unsetColor:()=>({chain:e})=>e().setMark("textStyle",{color:null}).removeEmptyTextStyle().run()}}});function sCt({content:e,onChange:t,variables:n}){const s=Jze({extensions:[a7e,m7e.configure({openOnClick:!1,HTMLAttributes:{class:"text-primary underline"}}),g7e.configure({types:["heading","paragraph"]}),x7e,nCt],content:e,onUpdate:({editor:l})=>{t(l.getHTML())}});E.useEffect(()=>{s&&e!==s.getHTML()&&s.commands.setContent(e)},[e,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(vS,{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(NS,{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(up,{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(MS,{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(xS,{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(gS,{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(yS,{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(Io,{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(Tj,{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(DS,{className:"h-4 w-4"})}),r.jsx(ee,{type:"button",variant:"ghost",size:"sm",onClick:()=>s.chain().focus().redo().run(),disabled:!s.can().redo(),children:r.jsx(PS,{className:"h-4 w-4"})}),r.jsx("div",{className:"flex-1"}),n.length>0&&r.jsxs(Lh,{children:[r.jsx(Oh,{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(ah,{align:"end",className:"w-64",children:n.map(l=>r.jsxs(ei,{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(Xze,{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(Pt,{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 aCt(){const e=Hr(),[t,n]=E.useState(null),[s,a]=E.useState(null),[o,l]=E.useState(""),[i,u]=E.useState(""),[p,x]=E.useState(""),[y,_]=E.useState(!0),[b,S]=E.useState("visual"),{data:k,isLoading:M}=Kt({queryKey:["email-templates"],queryFn:async()=>{const{data:D,error:U}=await Q.from("email_templates").select("*").order("name");if(U)throw U;return D.map(V=>({...V,available_variables:V.available_variables||[]}))}}),P=ir({mutationFn:async D=>{const{error:U}=await Q.from("email_templates").update({subject:D.subject,body_html:D.body_html,description:D.description,is_active:D.is_active}).eq("id",D.id);if(U)throw U},onSuccess:()=>{e.invalidateQueries({queryKey:["email-templates"]}),Ie.success("Email template updated successfully"),n(null)},onError:D=>{Ie.error("Failed to update template: "+D.message)}}),T=D=>{n(D),l(D.subject),u(D.body_html),x(D.description||""),_(D.is_active),S("visual")},I=()=>{t&&P.mutate({id:t.id,subject:o,body_html:i,description:p,is_active:y})},z=(D,U)=>{let V=D;return U.forEach(W=>{const G=`{{${W.key}}}`,J=`[${W.label}]`;V=V.replace(new RegExp(G.replace(/[{}]/g,"\\$&"),"g"),J)}),V};return t?r.jsxs(Dr,{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(po,{className:"h-4 w-4 mr-2"}),"Back to Templates"]}),r.jsx("div",{className:"flex-1"}),r.jsxs(ee,{variant:"outline",onClick:()=>a(t),children:[r.jsx(Ko,{className:"h-4 w-4 mr-2"}),"Preview"]}),r.jsxs(ee,{onClick:I,disabled:P.isPending,children:[r.jsx(Em,{className:"h-4 w-4 mr-2"}),P.isPending?"Saving...":"Save Changes"]})]}),r.jsxs(Ze,{children:[r.jsx(Wt,{children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsxs(Yt,{className:"flex items-center gap-2",children:[r.jsx(Ns,{className:"h-5 w-5"}),t.name]}),r.jsxs(Sn,{className:"mt-1",children:["Template slug: ",r.jsx("code",{className:"bg-muted px-1 rounded",children:t.slug})]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx($e,{htmlFor:"active-toggle",children:"Active"}),r.jsx(Ts,{id:"active-toggle",checked:y,onCheckedChange:_})]})]})}),r.jsxs(et,{className:"space-y-6",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{htmlFor:"description",children:"Description"}),r.jsx(Jn,{id:"description",value:p,onChange:D=>x(D.target.value),placeholder:"Brief description of when this email is sent",rows:2})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{htmlFor:"subject",children:"Email Subject"}),r.jsx(dt,{id:"subject",value:o,onChange:D=>l(D.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($e,{children:"Email Body"}),r.jsx(Ai,{value:b,onValueChange:D=>S(D),children:r.jsxs(vi,{className:"h-8",children:[r.jsxs(sn,{value:"visual",className:"text-xs px-3 h-6",children:[r.jsx(Rj,{className:"h-3 w-3 mr-1"}),"Visual"]}),r.jsxs(sn,{value:"html",className:"text-xs px-3 h-6",children:[r.jsx(Tj,{className:"h-3 w-3 mr-1"}),"HTML"]})]})})]}),b==="visual"?r.jsx(sCt,{content:i,onChange:u,variables:t.available_variables}):r.jsx(Jn,{value:i,onChange:D=>u(D.target.value),className:"font-mono text-sm min-h-[400px]",placeholder:"HTML email body"})]})]})]})]}),r.jsx(Or,{open:!!s,onOpenChange:()=>a(null),children:r.jsxs(Ir,{className:"max-w-3xl max-h-[90vh] overflow-auto",children:[r.jsxs($r,{children:[r.jsx(Fr,{children:"Email Preview"}),r.jsxs(Zn,{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,t.available_variables)}})})]})})]}):r.jsx(Dr,{title:"Email Templates",children:r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold",children:"Email Templates"}),r.jsx("p",{className:"text-muted-foreground mt-1",children:"Manage and customize system email templates"})]}),M?r.jsx("div",{className:"grid gap-4",children:[...Array(4)].map((D,U)=>r.jsx(Ze,{children:r.jsxs(Wt,{children:[r.jsx(Lr,{className:"h-5 w-48"}),r.jsx(Lr,{className:"h-4 w-96"})]})},U))}):r.jsx("div",{className:"grid gap-4",children:k==null?void 0:k.map(D=>r.jsxs(Ze,{className:"hover:shadow-md transition-shadow",children:[r.jsx(Wt,{children:r.jsxs("div",{className:"flex items-start justify-between",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsxs(Yt,{className:"flex items-center gap-2 text-lg",children:[r.jsx(Ns,{className:"h-5 w-5 text-muted-foreground"}),D.name,!D.is_active&&r.jsx(Pt,{variant:"secondary",children:"Inactive"})]}),r.jsx(Sn,{children:D.description})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs(ee,{variant:"outline",size:"sm",onClick:()=>a(D),children:[r.jsx(Ko,{className:"h-4 w-4 mr-2"}),"Preview"]}),r.jsxs(ee,{size:"sm",onClick:()=>T(D),children:[r.jsx(gc,{className:"h-4 w-4 mr-2"}),"Edit"]})]})]})}),r.jsx(et,{children:r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[r.jsx("span",{className:"text-muted-foreground",children:"Subject:"}),r.jsx("code",{className:"bg-muted px-2 py-0.5 rounded text-sm",children:D.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:D.available_variables.map(U=>r.jsx(Pt,{variant:"outline",className:"font-mono text-xs",children:`{{${U.key}}}`},U.key))})]})]})})]},D.id))}),r.jsx(Or,{open:!!s&&!t,onOpenChange:()=>a(null),children:r.jsxs(Ir,{className:"max-w-3xl max-h-[90vh] overflow-auto",children:[r.jsxs($r,{children:[r.jsxs(Fr,{children:["Email Preview: ",s==null?void 0:s.name]}),r.jsxs(Zn,{children:["Subject: ",s==null?void 0:s.subject.replace(/\{\{(\w+)\}\}/g,"[$1]")]})]}),s&&r.jsx("div",{className:"border rounded-lg p-4 bg-white",children:r.jsx("div",{dangerouslySetInnerHTML:{__html:z(s.body_html,s.available_variables)}})})]})})]})})}function iCt(){const e=Hr(),[t,n]=E.useState("templates"),[s,a]=E.useState(null),[o,l]=E.useState(null),[i,u]=E.useState(!1),[p,x]=E.useState(!1),[y,_]=E.useState({title:"",subject:"",body:"",description:"",tone:"",category_id:"",is_active:!0}),[b,S]=E.useState({name:"",description:"",icon:"📧"}),{data:k=[]}=Kt({queryKey:["agent-email-template-categories"],queryFn:async()=>{const{data:J,error:ne}=await Q.from("email_template_categories").select("*").order("sort_order");if(ne)throw ne;return J}}),{data:M=[],isLoading:P}=Kt({queryKey:["agent-email-templates-admin"],queryFn:async()=>{const{data:J,error:ne}=await Q.from("agent_email_templates").select("*, category:email_template_categories(*)").order("sort_order");if(ne)throw ne;return J}}),T=ir({mutationFn:async J=>{const ne={title:J.title,subject:J.subject,body:J.body,description:J.description||null,tone:J.tone||null,category_id:J.category_id||null,is_active:J.is_active};if(J.id){const{error:oe}=await Q.from("agent_email_templates").update(ne).eq("id",J.id);if(oe)throw oe}else{const{error:oe}=await Q.from("agent_email_templates").insert(ne);if(oe)throw oe}},onSuccess:()=>{e.invalidateQueries({queryKey:["agent-email-templates-admin"]}),u(!1),Ie.success(s?"Template updated":"Template created")},onError:()=>Ie.error("Failed to save template")}),I=ir({mutationFn:async J=>{const{error:ne}=await Q.from("agent_email_templates").delete().eq("id",J);if(ne)throw ne},onSuccess:()=>{e.invalidateQueries({queryKey:["agent-email-templates-admin"]}),Ie.success("Template deleted")}}),z=ir({mutationFn:async J=>{const ne={name:J.name,description:J.description||null,icon:J.icon};if(J.id){const{error:oe}=await Q.from("email_template_categories").update(ne).eq("id",J.id);if(oe)throw oe}else{const oe=k.length>0?Math.max(...k.map(ie=>ie.sort_order))+1:0,{error:ge}=await Q.from("email_template_categories").insert({...ne,sort_order:oe});if(ge)throw ge}},onSuccess:()=>{e.invalidateQueries({queryKey:["agent-email-template-categories"]}),x(!1),Ie.success(o?"Category updated":"Category created")},onError:()=>Ie.error("Failed to save category")}),D=ir({mutationFn:async J=>{const{error:ne}=await Q.from("email_template_categories").delete().eq("id",J);if(ne)throw ne},onSuccess:()=>{e.invalidateQueries({queryKey:["agent-email-template-categories"]}),Ie.success("Category deleted")}}),U=()=>{a(null),_({title:"",subject:"",body:"",description:"",tone:"",category_id:"",is_active:!0}),u(!0)},V=J=>{a(J),_({title:J.title,subject:J.subject,body:J.body,description:J.description||"",tone:J.tone||"",category_id:J.category_id||"",is_active:J.is_active}),u(!0)},W=()=>{l(null),S({name:"",description:"",icon:"📧"}),x(!0)},G=J=>{l(J),S({name:J.name,description:J.description||"",icon:J.icon}),x(!0)};return r.jsx(Dr,{children:r.jsxs("div",{className:"space-y-6 animate-fade-in",children:[r.jsx(Mu,{title:"Agent Email Templates",description:"Manage email templates that agents use when composing emails from Mission Control."}),r.jsxs(Ai,{value:t,onValueChange:n,children:[r.jsxs(vi,{children:[r.jsxs(sn,{value:"templates",className:"gap-2",children:[r.jsx(Ns,{className:"h-4 w-4"})," Templates"]}),r.jsxs(sn,{value:"categories",className:"gap-2",children:[r.jsx(Tm,{className:"h-4 w-4"})," Categories"]})]}),r.jsxs(Mn,{value:"templates",className:"space-y-4",children:[r.jsx("div",{className:"flex justify-end",children:r.jsxs(ee,{onClick:U,className:"gap-2",children:[r.jsx(bn,{className:"h-4 w-4"})," Add Template"]})}),r.jsx(Ze,{children:r.jsx(et,{className:"p-0",children:r.jsxs(Ks,{children:[r.jsx(Zs,{children:r.jsxs(Mr,{children:[r.jsx(It,{children:"Template"}),r.jsx(It,{className:"hidden md:table-cell",children:"Category"}),r.jsx(It,{className:"hidden md:table-cell",children:"Tone"}),r.jsx(It,{children:"Status"}),r.jsx(It,{className:"text-right",children:"Actions"})]})}),r.jsx(Ys,{children:P?r.jsx(Mr,{children:r.jsx(kt,{colSpan:5,className:"text-center py-8",children:r.jsx(Zr,{className:"h-6 w-6 animate-spin mx-auto"})})}):M.length===0?r.jsx(Mr,{children:r.jsx(kt,{colSpan:5,className:"text-center py-8 text-muted-foreground",children:"No templates yet. Create your first one!"})}):M.map(J=>r.jsxs(Mr,{children:[r.jsx(kt,{children:r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:J.title}),r.jsx("p",{className:"text-xs text-muted-foreground truncate max-w-[300px]",children:J.subject})]})}),r.jsx(kt,{className:"hidden md:table-cell",children:J.category?r.jsxs(Pt,{variant:"outline",className:"gap-1",children:[J.category.icon," ",J.category.name]}):r.jsx("span",{className:"text-muted-foreground text-sm",children:"—"})}),r.jsx(kt,{className:"hidden md:table-cell",children:J.tone?r.jsx(Pt,{variant:"secondary",children:J.tone}):"—"}),r.jsx(kt,{children:r.jsx(Pt,{variant:J.is_active?"default":"secondary",children:J.is_active?"Active":"Inactive"})}),r.jsx(kt,{className:"text-right",children:r.jsxs("div",{className:"flex justify-end gap-1",children:[r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>V(J),children:r.jsx(ni,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"icon",className:"text-destructive hover:text-destructive",onClick:()=>{confirm("Delete this template?")&&I.mutate(J.id)},children:r.jsx(Bn,{className:"h-4 w-4"})})]})})]},J.id))})]})})})]}),r.jsxs(Mn,{value:"categories",className:"space-y-4",children:[r.jsx("div",{className:"flex justify-end",children:r.jsxs(ee,{onClick:W,className:"gap-2",children:[r.jsx(bn,{className:"h-4 w-4"})," Add Category"]})}),r.jsx("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3",children:k.map(J=>r.jsxs(Ze,{children:[r.jsx(Wt,{className:"pb-2",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs(Yt,{className:"text-base flex items-center gap-2",children:[r.jsx("span",{className:"text-lg",children:J.icon})," ",J.name]}),r.jsxs("div",{className:"flex gap-1",children:[r.jsx(ee,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>G(J),children:r.jsx(ni,{className:"h-3.5 w-3.5"})}),r.jsx(ee,{variant:"ghost",size:"icon",className:"h-8 w-8 text-destructive",onClick:()=>{confirm("Delete this category?")&&D.mutate(J.id)},children:r.jsx(Bn,{className:"h-3.5 w-3.5"})})]})]})}),r.jsxs(et,{children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:J.description||"No description"}),r.jsxs("p",{className:"text-xs text-muted-foreground mt-2",children:[M.filter(ne=>ne.category_id===J.id).length," templates"]})]})]},J.id))})]})]}),r.jsx(Or,{open:i,onOpenChange:u,children:r.jsxs(Ir,{className:"sm:max-w-[700px] max-h-[90vh] overflow-y-auto",children:[r.jsx($r,{children:r.jsx(Fr,{children:s?"Edit Template":"New Template"})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-1.5",children:[r.jsx($e,{children:"Title"}),r.jsx(dt,{value:y.title,onChange:J=>_(ne=>({...ne,title:J.target.value})),placeholder:"e.g. Quick Check-in"})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx($e,{children:"Category"}),r.jsxs(mn,{value:y.category_id,onValueChange:J=>_(ne=>({...ne,category_id:J})),children:[r.jsx(fn,{children:r.jsx(yn,{placeholder:"Select category"})}),r.jsx(pn,{children:k.map(J=>r.jsxs(qt,{value:J.id,children:[J.icon," ",J.name]},J.id))})]})]})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx($e,{children:"Subject Line"}),r.jsx(dt,{value:y.subject,onChange:J=>_(ne=>({...ne,subject:J.target.value})),placeholder:"e.g. Hey {{first_name}}, just checking in!"}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Use ","{{first_name}}",", ","{{last_name}}",", ","{{full_name}}"," for merge variables"]})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx($e,{children:"Email Body"}),r.jsx(Jn,{value:y.body,onChange:J=>_(ne=>({...ne,body:J.target.value})),rows:12,placeholder:"Write your email template...",className:"resize-y"})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-1.5",children:[r.jsx($e,{children:"Description (internal)"}),r.jsx(dt,{value:y.description,onChange:J=>_(ne=>({...ne,description:J.target.value})),placeholder:"Short description for admin reference"})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx($e,{children:"Tone"}),r.jsx(dt,{value:y.tone,onChange:J=>_(ne=>({...ne,tone:J.target.value})),placeholder:"e.g. Warm & Casual"})]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ts,{checked:y.is_active,onCheckedChange:J=>_(ne=>({...ne,is_active:J}))}),r.jsx($e,{children:"Active"})]})]}),r.jsxs(Bs,{children:[r.jsx(ee,{variant:"outline",onClick:()=>u(!1),children:"Cancel"}),r.jsxs(ee,{onClick:()=>T.mutate({...y,id:s==null?void 0:s.id}),disabled:T.isPending||!y.title||!y.subject||!y.body,children:[T.isPending&&r.jsx(Zr,{className:"h-4 w-4 mr-2 animate-spin"}),s?"Save Changes":"Create Template"]})]})]})}),r.jsx(Or,{open:p,onOpenChange:x,children:r.jsxs(Ir,{className:"sm:max-w-[450px]",children:[r.jsx($r,{children:r.jsx(Fr,{children:o?"Edit Category":"New Category"})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"grid grid-cols-[60px_1fr] gap-3",children:[r.jsxs("div",{className:"space-y-1.5",children:[r.jsx($e,{children:"Icon"}),r.jsx(dt,{value:b.icon,onChange:J=>S(ne=>({...ne,icon:J.target.value})),className:"text-center text-lg"})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx($e,{children:"Name"}),r.jsx(dt,{value:b.name,onChange:J=>S(ne=>({...ne,name:J.target.value})),placeholder:"e.g. Check-in & Stay in Touch"})]})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx($e,{children:"Description"}),r.jsx(dt,{value:b.description,onChange:J=>S(ne=>({...ne,description:J.target.value})),placeholder:"Brief description of this category"})]})]}),r.jsxs(Bs,{children:[r.jsx(ee,{variant:"outline",onClick:()=>x(!1),children:"Cancel"}),r.jsxs(ee,{onClick:()=>z.mutate({...b,id:o==null?void 0:o.id}),disabled:z.isPending||!b.name,children:[z.isPending&&r.jsx(Zr,{className:"h-4 w-4 mr-2 animate-spin"}),o?"Save Changes":"Create Category"]})]})]})})]})})}const oCt=({brokerageId:e})=>{var go,uc;const{toast:t}=_i(),[n,s]=E.useState([]),[a,o]=E.useState(!0),[l,i]=E.useState(""),[u,p]=E.useState("all"),[x,y]=E.useState(new Set),[_,b]=E.useState(!1),[S,k]=E.useState({}),[M,P]=E.useState(!1),[T,I]=E.useState(!1),[z,D]=E.useState({email:"",name:"",password:"",phone:""}),[U,V]=E.useState(!1),[W,G]=E.useState(null),[J,ne]=E.useState(!1),[oe,ge]=E.useState(!1),[ie,pe]=E.useState(!1),[se,fe]=E.useState(""),[he,ye]=E.useState(!1),[Ae,we]=E.useState([]),[be,_e]=E.useState(!1),[Je,Te]=E.useState(!1),[De,Ue]=E.useState(null),[Be,qe]=E.useState({name:"",phone:"",email:""}),[ot,Mt]=E.useState(!1),[Oe,at]=E.useState(!1),[le,Ve]=E.useState(null),[Qe,st]=E.useState("asc"),[ke,ct]=E.useState(!1),[Ce,Me]=E.useState(null),[Ge,Ee]=E.useState(!1),[He,nt]=E.useState(null),[yt,it]=E.useState(""),[zt,dr]=E.useState(!1),[Rr,Gr]=E.useState(null);E.useEffect(()=>{kn(),Ur()},[e]);const Ur=async()=>{try{const{data:tt,error:xe}=await Q.from("brokerage_manager_assignments").select("user_id").eq("brokerage_id",e);if(xe)throw xe;we((tt==null?void 0:tt.map(Pe=>Pe.user_id))||[])}catch(tt){console.error("Error loading brokerage managers:",tt)}},kn=async()=>{try{o(!0);const{data:tt,error:xe}=await Q.functions.invoke("get-brokerage-agents",{body:{brokerageId:e}});if(xe)throw xe;const Pe=tt.agents||[];if(s(Pe),Pe.length>0){const Ye=Pe.map(_t=>_t.id),{data:Nt}=await Q.from("agent_assistant_assignments").select("agent_id, assistant_id").in("agent_id",Ye);if(Nt&&Nt.length>0){const _t=Nt.map(Lt=>Lt.assistant_id),{data:At}=await Q.from("profiles").select("id, name, email").in("id",_t),$t={};for(const Lt of Nt){const Vt=At==null?void 0:At.find(pr=>pr.id===Lt.assistant_id);Vt&&($t[Lt.agent_id]={name:Vt.name||"",email:Vt.email||""})}k($t)}else k({})}}catch(tt){console.error("Error loading agents:",tt),t({title:"Error",description:"Failed to load agents",variant:"destructive"})}finally{o(!1)}},_s=async()=>{if(!z.email||!z.name||!z.password){t({title:"Error",description:"Please fill in all fields",variant:"destructive"});return}I(!0);try{const{data:{session:tt}}=await Q.auth.getSession(),xe=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/create-user",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${tt==null?void 0:tt.access_token}`},body:JSON.stringify({...z,brokerageId:e})}),Pe=await xe.json();if(!xe.ok)throw new Error(Pe.error||"Failed to create agent");t({title:"Success",description:`Agent ${z.email} created successfully`}),D({email:"",name:"",password:"",phone:""}),P(!1),kn()}catch(tt){console.error("Error creating agent:",tt),t({title:"Error",description:tt.message||"Failed to create agent",variant:"destructive"})}finally{I(!1)}},ur=async tt=>{try{const{data:{session:xe}}=await Q.auth.getSession(),Pe=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:tt})}),Ye=await Pe.json();if(!Pe.ok)throw new Error(Ye.error||"Failed to resend welcome email");t({title:"Success",description:"Welcome email sent successfully"})}catch(xe){console.error("Error resending welcome email:",xe),t({title:"Error",description:xe.message||"Failed to resend welcome email",variant:"destructive"})}},Rn=async(tt,xe)=>{try{const{error:Pe}=await Q.functions.invoke("send-password-reset",{body:{email:tt,redirectTo:window.location.origin}});if(Pe)throw Pe;t({title:"Password Reset Sent",description:`Password reset email sent to ${xe}`})}catch(Pe){console.error("Error sending password reset:",Pe),t({title:"Error",description:Pe.message||"Failed to send password reset email",variant:"destructive"})}},ea=tt=>{G(tt),V(!0)},ca=tt=>{Ue(tt),qe({name:tt.name,phone:tt.phone||"",email:tt.email}),Te(!0)},Ei=async()=>{if(!De)return;if(!Be.name.trim()){t({title:"Error",description:"Name is required",variant:"destructive"});return}const tt=Be.email.trim().toLowerCase()!==De.email.toLowerCase();Mt(!0);try{if(tt){if(!Be.email.trim())throw new Error("Email is required");at(!0);const{data:{session:Pe}}=await Q.auth.getSession(),Ye=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/update-agent-email",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${Pe==null?void 0:Pe.access_token}`},body:JSON.stringify({agentId:De.id,newEmail:Be.email.trim(),brokerageId:e})}),Nt=await Ye.json();if(at(!1),!Ye.ok)throw new Error(Nt.error||"Failed to update email")}const{error:xe}=await Q.from("profiles").update({name:Be.name.trim(),phone:Be.phone.trim()||null}).eq("id",De.id);if(xe)throw xe;t({title:"Success",description:"Agent profile updated successfully"}),Te(!1),Ue(null),kn()}catch(xe){console.error("Error updating agent:",xe),t({title:"Error",description:xe.message||"Failed to update agent",variant:"destructive"})}finally{Mt(!1),at(!1)}},Ii=async()=>{if(!se){t({title:"Error",description:"Please select an agent to promote",variant:"destructive"});return}ye(!0);try{const{data:{session:tt}}=await Q.auth.getSession(),xe=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/manage-user-roles",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${tt==null?void 0:tt.access_token}`},body:JSON.stringify({userId:se,role:"brokerage_manager",action:"add",brokerageId:e})}),Pe=await xe.json();if(!xe.ok)throw new Error(Pe.error||"Failed to add brokerage manager");t({title:"Success",description:"Brokerage manager added successfully"}),pe(!1),fe(""),Ur()}catch(tt){console.error("Error adding brokerage manager:",tt),t({title:"Error",description:tt.message||"Failed to add brokerage manager",variant:"destructive"})}finally{ye(!1)}},$o=async tt=>{try{const{data:{session:xe}}=await Q.auth.getSession(),Pe=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:tt,role:"brokerage_manager",action:"remove",brokerageId:e})}),Ye=await Pe.json();if(!Pe.ok)throw new Error(Ye.error||"Failed to remove brokerage manager");t({title:"Success",description:"Brokerage manager role removed"}),Ur()}catch(xe){console.error("Error removing brokerage manager:",xe),t({title:"Error",description:xe.message||"Failed to remove brokerage manager",variant:"destructive"})}},Va=tt=>Ae.includes(tt),cs=tt=>{nt(tt),it(""),Ee(!0)},ta=async()=>{if(!(!He||!yt)){if(yt.length<6){t({title:"Error",description:"Password must be at least 6 characters",variant:"destructive"});return}dr(!0);try{const{data:{session:tt}}=await Q.auth.getSession(),xe=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/update-agent-email",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${tt==null?void 0:tt.access_token}`},body:JSON.stringify({agentId:He.id,brokerageId:e,action:"set_password",newPassword:yt})}),Pe=await xe.json();if(!xe.ok)throw new Error(Pe.error||"Failed to set password");t({title:"Success",description:`Password set for ${He.name}`}),Ee(!1),nt(null),it("")}catch(tt){console.error("Error setting password:",tt),t({title:"Error",description:tt.message||"Failed to set password",variant:"destructive"})}finally{dr(!1)}}},ds=async tt=>{Gr(tt.id);try{const{data:{session:xe}}=await Q.auth.getSession(),Pe=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:tt.id,brokerageId:e,action:"claim_account"})}),Ye=await Pe.json();if(!Pe.ok)throw new Error(Ye.error||"Failed to claim account");t({title:"Success",description:`Account claimed for ${tt.name}`}),kn()}catch(xe){console.error("Error claiming account:",xe),t({title:"Error",description:xe.message||"Failed to claim account",variant:"destructive"})}finally{Gr(null)}},Hs=async()=>{if(W){ne(!0);try{const{data:{session:tt}}=await Q.auth.getSession(),xe=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/remove-agent",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${tt==null?void 0:tt.access_token}`},body:JSON.stringify({userId:W.id,brokerageId:e})}),Pe=await xe.json();if(!xe.ok)throw new Error(Pe.error||"Failed to remove agent");t({title:"Success",description:`${W.name} has been removed from your brokerage`}),V(!1),G(null),kn()}catch(tt){console.error("Error removing agent:",tt),t({title:"Error",description:tt.message||"Failed to remove agent",variant:"destructive"})}finally{ne(!1)}}},Os=tt=>{const xe=tt.trim().split(" ");return xe.length>1?xe[xe.length-1].toLowerCase():tt.toLowerCase()},bi=tt=>{le===tt?st(Qe==="asc"?"desc":"asc"):(Ve(tt),st("asc"))},sr=tt=>le!==tt?r.jsx(Pg,{className:"ml-1 h-4 w-4"}):Qe==="asc"?r.jsx(cp,{className:"ml-1 h-4 w-4"}):r.jsx(ay,{className:"ml-1 h-4 w-4"}),Ia=n.filter(tt=>{if(u==="active"&&!tt.claimed||u==="pending"&&tt.claimed)return!1;if(!l)return!0;const xe=l.toLowerCase();return tt.name.toLowerCase().includes(xe)||tt.email.toLowerCase().includes(xe)}),no=[...Ia].sort((tt,xe)=>{if(!le)return 0;let Pe=0;return le==="name"?Pe=Os(tt.name).localeCompare(Os(xe.name)):le==="status"&&(Pe=tt.claimed===xe.claimed?0:tt.claimed?-1:1),Qe==="asc"?Pe:-Pe});Ia.filter(tt=>tt.claimed&&!Va(tt.id));const yi=tt=>{y(xe=>{const Pe=new Set(xe);return Pe.has(tt)?Pe.delete(tt):Pe.add(tt),Pe})},qn=()=>{x.size===no.length?y(new Set):y(new Set(no.map(tt=>tt.id)))},Gi=()=>{y(new Set)},dc=async()=>{const tt=Array.from(x);if(tt.length===0)return;b(!0);let xe=0,Pe=0;try{const{data:{session:Ye}}=await Q.auth.getSession();for(const Nt of tt)try{(await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/resend-welcome-email",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${Ye==null?void 0:Ye.access_token}`},body:JSON.stringify({userId:Nt})})).ok?xe++:Pe++}catch{Pe++}xe>0?t({title:"Success",description:`Welcome emails sent to ${xe} agent${xe>1?"s":""}${Pe>0?` (${Pe} failed)`:""}`}):t({title:"Error",description:"Failed to send welcome emails",variant:"destructive"}),Gi()}catch(Ye){console.error("Error bulk sending welcome emails:",Ye),t({title:"Error",description:Ye.message||"Failed to send welcome emails",variant:"destructive"})}finally{b(!1)}};return a?r.jsx(Ze,{children:r.jsx(et,{className:"flex items-center justify-center py-8",children:r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})})}):r.jsxs(r.Fragment,{children:[r.jsxs(Ze,{children:[r.jsx(Wt,{children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Yt,{children:"Agents"}),r.jsx(Sn,{children:"Manage your brokerage's agents"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs(ee,{variant:"outline",onClick:()=>pe(!0),children:[r.jsx(yf,{className:"mr-2 h-4 w-4"}),"Add Brokerage Manager"]}),r.jsxs(ee,{variant:"outline",onClick:()=>ge(!0),children:[r.jsx(q1,{className:"mr-2 h-4 w-4"}),"Import CSV"]}),r.jsxs(ee,{onClick:()=>P(!0),children:[r.jsx(vf,{className:"mr-2 h-4 w-4"}),"Add Agent"]})]})]})}),r.jsxs(et,{children:[r.jsxs("div",{className:"mb-4 flex flex-col gap-4 sm:flex-row sm:items-center",children:[r.jsxs("div",{className:"relative flex-1",children:[r.jsx(Sa,{className:"absolute left-3 top-3 h-4 w-4 text-muted-foreground"}),r.jsx(dt,{placeholder:"Search agents...",value:l,onChange:tt=>i(tt.target.value),className:"pl-9"})]}),r.jsxs(mn,{value:u,onValueChange:tt=>p(tt),children:[r.jsx(fn,{className:"w-[160px]",children:r.jsx(yn,{placeholder:"Filter by status"})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"all",children:"All Agents"}),r.jsx(qt,{value:"active",children:"Active"}),r.jsx(qt,{value:"pending",children:"Pending"})]})]})]}),x.size>0&&r.jsxs("div",{className:"mb-4 flex items-center gap-3 rounded-lg border bg-muted/50 p-3",children:[r.jsxs("span",{className:"text-sm font-medium",children:[x.size," agent",x.size>1?"s":""," selected"]}),r.jsx("div",{className:"flex-1"}),r.jsxs(ee,{size:"sm",variant:"outline",onClick:dc,disabled:_,children:[r.jsx(Ns,{className:"mr-2 h-4 w-4"}),_?"Sending...":"Resend Welcome Email"]}),r.jsx(ee,{size:"sm",variant:"ghost",onClick:Gi,children:"Clear"})]}),r.jsx("div",{className:"rounded-md border",children:r.jsxs(Ks,{children:[r.jsx(Zs,{children:r.jsxs(Mr,{children:[r.jsx(It,{className:"w-[40px]",children:r.jsx(Bl,{checked:no.length>0&&x.size===no.length,onCheckedChange:qn,"aria-label":"Select all"})}),r.jsx(It,{children:r.jsxs(ee,{variant:"ghost",size:"sm",className:"-ml-3 h-8 hover:bg-transparent",onClick:()=>bi("name"),children:["Name (Last)",sr("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:()=>bi("status"),children:["Status",sr("status")]})}),r.jsx(It,{children:"Actions"})]})}),r.jsx(Ys,{children:no.length===0?r.jsx(Mr,{children:r.jsx(kt,{colSpan:5,className:"text-center text-muted-foreground",children:"No agents found"})}):no.map(tt=>r.jsxs(Mr,{children:[r.jsx(kt,{children:r.jsx(Bl,{checked:x.has(tt.id),onCheckedChange:()=>yi(tt.id),"aria-label":`Select ${tt.name}`})}),r.jsx(kt,{className:"font-medium",children:tt.name}),r.jsx(kt,{children:tt.email}),r.jsx(kt,{children:r.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[tt.claimed?r.jsx(Pt,{variant:"default",children:"Active"}):r.jsx(Pt,{variant:"secondary",children:"Pending"}),Va(tt.id)&&r.jsxs(Pt,{variant:"outline",className:"border-primary text-primary",children:[r.jsx(wA,{className:"mr-1 h-3 w-3"}),"Manager"]}),S[tt.id]&&r.jsxs(Pt,{variant:"outline",className:"text-xs",children:[r.jsx(Un,{className:"mr-1 h-3 w-3"}),"Asst: ",S[tt.id].name||S[tt.id].email]})]})}),r.jsx(kt,{children:r.jsxs("div",{className:"flex items-center gap-1 flex-wrap",children:[r.jsx(ee,{size:"sm",variant:"ghost",onClick:()=>{Me(tt),ct(!0)},title:"Send celebration",className:"text-yellow-500 hover:text-yellow-600 hover:bg-yellow-50",children:r.jsx(qc,{className:"h-4 w-4"})}),r.jsx(ee,{size:"sm",variant:"ghost",onClick:()=>ca(tt),title:"Edit agent",children:r.jsx(ni,{className:"h-4 w-4"})}),!tt.claimed&&r.jsxs(r.Fragment,{children:[r.jsx(ee,{size:"sm",variant:"ghost",onClick:()=>ur(tt.id),title:"Resend welcome email",children:r.jsx(Ns,{className:"h-4 w-4"})}),r.jsx(ee,{size:"sm",variant:"ghost",onClick:()=>ds(tt),title:"Claim account for agent",disabled:Rr===tt.id,className:"text-green-600 hover:text-green-700 hover:bg-green-50",children:r.jsx(Uj,{className:"h-4 w-4"})})]}),r.jsx(ee,{size:"sm",variant:"ghost",onClick:()=>cs(tt),title:"Set password",className:"text-blue-600 hover:text-blue-700 hover:bg-blue-50",children:r.jsx(hp,{className:"h-4 w-4"})}),r.jsx(ee,{size:"sm",variant:"ghost",onClick:()=>Rn(tt.email,tt.name),title:"Send password reset email",children:r.jsx(Lj,{className:"h-4 w-4"})}),Va(tt.id)&&r.jsx(ee,{size:"sm",variant:"ghost",onClick:()=>$o(tt.id),title:"Remove manager role",className:"text-orange-500 hover:text-orange-600",children:r.jsx(yf,{className:"h-4 w-4"})}),r.jsx(ee,{size:"sm",variant:"ghost",onClick:()=>ea(tt),className:"text-destructive hover:text-destructive",title:"Remove agent",children:r.jsx(Bn,{className:"h-4 w-4"})})]})})]},tt.id))})]})})]})]}),r.jsx(Or,{open:M,onOpenChange:P,children:r.jsxs(Ir,{children:[r.jsxs($r,{children:[r.jsx(Fr,{children:"Add New Agent"}),r.jsx(Zn,{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($e,{htmlFor:"name",children:"Name"}),r.jsx(dt,{id:"name",value:z.name,onChange:tt=>D({...z,name:tt.target.value}),placeholder:"John Doe"})]}),r.jsxs("div",{children:[r.jsx($e,{htmlFor:"email",children:"Email"}),r.jsx(dt,{id:"email",type:"email",value:z.email,onChange:tt=>D({...z,email:tt.target.value}),placeholder:"john@example.com"})]}),r.jsxs("div",{children:[r.jsx($e,{htmlFor:"phone",children:"Phone (optional)"}),r.jsx(dt,{id:"phone",type:"tel",value:z.phone,onChange:tt=>D({...z,phone:tt.target.value}),placeholder:"555-123-4567"})]}),r.jsxs("div",{children:[r.jsx($e,{htmlFor:"password",children:"Temporary Password"}),r.jsx(dt,{id:"password",type:"password",value:z.password,onChange:tt=>D({...z,password:tt.target.value}),placeholder:"Temporary password"})]})]}),r.jsxs(Bs,{children:[r.jsx(ee,{variant:"outline",onClick:()=>P(!1),children:"Cancel"}),r.jsx(ee,{onClick:_s,disabled:T,children:T?"Creating...":"Create Agent"})]})]})}),r.jsx(Or,{open:U,onOpenChange:V,children:r.jsxs(Ir,{children:[r.jsxs($r,{children:[r.jsx(Fr,{children:"Remove Agent"}),r.jsxs(Zn,{children:["Are you sure you want to remove ",r.jsx("strong",{children:W==null?void 0:W.name})," from your brokerage? This will revoke their access to the dashboard."]})]}),r.jsxs(Bs,{children:[r.jsx(ee,{variant:"outline",onClick:()=>V(!1),children:"Cancel"}),r.jsx(ee,{variant:"destructive",onClick:Hs,disabled:J,children:J?"Removing...":"Remove Agent"})]})]})}),r.jsx(R9e,{open:oe,onOpenChange:ge,fixedBrokerageId:e,onSuccess:kn}),r.jsx(Or,{open:ie,onOpenChange:pe,children:r.jsxs(Ir,{children:[r.jsxs($r,{children:[r.jsx(Fr,{children:"Add Brokerage Manager"}),r.jsx(Zn,{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($e,{children:"Select Agent"}),r.jsxs(Vc,{open:be,onOpenChange:_e,children:[r.jsx(Hc,{asChild:!0,children:r.jsxs(ee,{variant:"outline",role:"combobox","aria-expanded":be,className:"w-full justify-between",children:[se?((go=n.find(tt=>tt.id===se))==null?void 0:go.name)+" ("+((uc=n.find(tt=>tt.id===se))==null?void 0:uc.email)+")":"Select an agent to promote...",r.jsx(oy,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),r.jsx(Mc,{className:"w-full p-0",align:"start",children:r.jsxs(Ey,{children:[r.jsx(Iy,{placeholder:"Search by name or email..."}),r.jsxs(Py,{className:"max-h-[200px]",children:[r.jsx(Ly,{children:"No eligible agents found."}),r.jsx(Oy,{children:n.filter(tt=>!Va(tt.id)).map(tt=>r.jsxs(Dy,{value:`${tt.name} ${tt.email}`,onSelect:()=>{fe(tt.id),_e(!1)},children:[r.jsx(Ni,{className:`mr-2 h-4 w-4 ${se===tt.id?"opacity-100":"opacity-0"}`}),tt.name," (",tt.email,")"]},tt.id))})]})]})})]}),n.filter(tt=>!Va(tt.id)).length===0&&r.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:"All agents are already brokerage managers."})]})}),r.jsxs(Bs,{children:[r.jsx(ee,{variant:"outline",onClick:()=>pe(!1),children:"Cancel"}),r.jsx(ee,{onClick:Ii,disabled:he||!se,children:he?"Adding...":"Add as Manager"})]})]})}),r.jsx(Or,{open:Je,onOpenChange:Te,children:r.jsxs(Ir,{children:[r.jsxs($r,{children:[r.jsx(Fr,{children:"Edit Agent"}),r.jsxs(Zn,{children:["Update profile information for ",De==null?void 0:De.name]})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx($e,{htmlFor:"edit-name",children:"Name"}),r.jsx(dt,{id:"edit-name",value:Be.name,onChange:tt=>qe({...Be,name:tt.target.value}),placeholder:"Agent name"})]}),r.jsxs("div",{children:[r.jsx($e,{htmlFor:"edit-email",children:"Email"}),r.jsx(dt,{id:"edit-email",type:"email",value:Be.email,onChange:tt=>qe({...Be,email:tt.target.value}),placeholder:"agent@example.com"}),Be.email.trim().toLowerCase()!==(De==null?void 0:De.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($e,{htmlFor:"edit-phone",children:"Phone"}),r.jsx(dt,{id:"edit-phone",type:"tel",value:Be.phone,onChange:tt=>qe({...Be,phone:tt.target.value}),placeholder:"555-123-4567"})]})]}),r.jsxs(Bs,{children:[r.jsx(ee,{variant:"outline",onClick:()=>Te(!1),children:"Cancel"}),r.jsx(ee,{onClick:Ei,disabled:ot||Oe,children:Oe?"Updating email...":ot?"Saving...":"Save Changes"})]})]})}),Ce&&r.jsx(F9e,{open:ke,onOpenChange:tt=>{ct(tt),tt||Me(null)},userId:Ce.id,userName:Ce.name}),r.jsx(Or,{open:Ge,onOpenChange:Ee,children:r.jsxs(Ir,{children:[r.jsxs($r,{children:[r.jsx(Fr,{children:"Set Password"}),r.jsxs(Zn,{children:["Set a new password for ",He==null?void 0:He.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($e,{htmlFor:"new-password",children:"New Password"}),r.jsx(dt,{id:"new-password",type:"password",value:yt,onChange:tt=>it(tt.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(Bs,{children:[r.jsx(ee,{variant:"outline",onClick:()=>Ee(!1),children:"Cancel"}),r.jsx(ee,{onClick:ta,disabled:zt||!yt||yt.length<6,children:zt?"Setting...":"Set Password"})]})]})})]})},lCt={academy_video:"Academy Video",template:"Template",toolbox:"Toolbox Resource",newsletter:"Newsletter",social_swag:"Social Swag",event:"Event"},cCt={view:"Viewed",click_canva:"Opened Canva",click_pdf:"Downloaded PDF",click_video:"Watched Video",click_link:"Clicked Link",register:"Registered"},dCt=e=>{switch(e){case"academy_video":return r.jsx($a,{className:"h-4 w-4"});case"template":return r.jsx(Ea,{className:"h-4 w-4"});case"toolbox":return r.jsx(Ea,{className:"h-4 w-4"});case"newsletter":return r.jsx(fy,{className:"h-4 w-4"});case"social_swag":return r.jsx(Ls,{className:"h-4 w-4"});case"event":return r.jsx(Ss,{className:"h-4 w-4"});default:return r.jsx(As,{className:"h-4 w-4"})}},uCt=({brokerageId:e})=>{const{toast:t}=_i(),[n,s]=E.useState([]),[a,o]=E.useState([]),[l,i]=E.useState([]),[u,p]=E.useState(!0),[x,y]=E.useState(null);E.useEffect(()=>{_()},[e]);const _=async()=>{try{p(!0);const{data:k,error:M}=await Q.from("profiles").select("id, name, email").eq("brokerage_id",e);if(M)throw M;const P=k.map(ne=>ne.id),T=new Map(k.map(ne=>[ne.id,ne]));if(P.length===0){s([]),o([]),i([]);return}const{data:I,error:z}=await Q.from("activity_logs").select("*").in("user_id",P).order("launched_at",{ascending:!1});if(z)throw z;const D=I.map(ne=>{var oe,ge;return{id:ne.id,user_id:ne.user_id,app_name:ne.app_name,launched_at:ne.launched_at,user_name:((oe=T.get(ne.user_id))==null?void 0:oe.name)||"Unknown",user_email:((ge=T.get(ne.user_id))==null?void 0:ge.email)||"Unknown"}});s(D);const{data:U,error:V}=await Q.from("content_engagement_logs").select("*").in("user_id",P).order("created_at",{ascending:!1});if(V)throw V;const W=(U||[]).map(ne=>{var oe,ge;return{id:ne.id,user_id:ne.user_id,resource_type:ne.resource_type,resource_id:ne.resource_id,resource_title:ne.resource_title,action_type:ne.action_type,created_at:ne.created_at,user_name:((oe=T.get(ne.user_id))==null?void 0:oe.name)||"Unknown",user_email:((ge=T.get(ne.user_id))==null?void 0:ge.email)||"Unknown"}});o(W);const G=new Map;k.forEach(ne=>{G.set(ne.id,{user_id:ne.id,user_name:ne.name,user_email:ne.email,app_launches:0,content_views:0,last_activity:""})}),D.forEach(ne=>{const oe=G.get(ne.user_id);oe&&(oe.app_launches++,(!oe.last_activity||new Date(ne.launched_at)>new Date(oe.last_activity))&&(oe.last_activity=ne.launched_at))}),W.forEach(ne=>{const oe=G.get(ne.user_id);oe&&(oe.content_views++,(!oe.last_activity||new Date(ne.created_at)>new Date(oe.last_activity))&&(oe.last_activity=ne.created_at))});const J=Array.from(G.values()).filter(ne=>ne.app_launches>0||ne.content_views>0).sort((ne,oe)=>new Date(oe.last_activity).getTime()-new Date(ne.last_activity).getTime());i(J)}catch(k){console.error("Error loading activity:",k),t({title:"Error",description:"Failed to load activity logs",variant:"destructive"})}finally{p(!1)}},b=k=>n.filter(M=>M.user_id===k),S=k=>a.filter(M=>M.user_id===k);return u?r.jsx(Ze,{children:r.jsx(et,{className:"flex items-center justify-center py-8",children:r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})})}):r.jsxs(r.Fragment,{children:[r.jsxs(Ze,{children:[r.jsxs(Wt,{children:[r.jsx(Yt,{children:"Agent Activity"}),r.jsx(Sn,{children:"Track app usage and content engagement - click an agent for details"})]}),r.jsx(et,{children:r.jsx("div",{className:"rounded-md border",children:r.jsxs(Ks,{children:[r.jsx(Zs,{children:r.jsxs(Mr,{children:[r.jsx(It,{children:"Agent"}),r.jsx(It,{className:"text-center",children:"App Launches"}),r.jsx(It,{className:"text-center",children:"Content Views"}),r.jsx(It,{children:"Last Active"})]})}),r.jsx(Ys,{children:l.length===0?r.jsx(Mr,{children:r.jsx(kt,{colSpan:4,className:"text-center text-muted-foreground",children:"No activity yet"})}):l.map(k=>r.jsxs(Mr,{className:"cursor-pointer hover:bg-muted/50 transition-colors",onClick:()=>y({id:k.user_id,name:k.user_name,email:k.user_email}),children:[r.jsx(kt,{children:r.jsxs("div",{children:[r.jsx("div",{className:"font-medium",children:k.user_name}),r.jsx("div",{className:"text-sm text-muted-foreground",children:k.user_email})]})}),r.jsx(kt,{className:"text-center",children:r.jsxs(Pt,{variant:"outline",className:"gap-1",children:[r.jsx(Vl,{className:"h-3 w-3"}),k.app_launches]})}),r.jsx(kt,{className:"text-center",children:r.jsxs(Pt,{variant:"secondary",className:"gap-1",children:[r.jsx(Ea,{className:"h-3 w-3"}),k.content_views]})}),r.jsx(kt,{className:"text-sm text-muted-foreground",children:k.last_activity&&bu(new Date(k.last_activity),{addSuffix:!0})})]},k.user_id))})]})})})]}),r.jsx(Or,{open:!!x,onOpenChange:k=>!k&&y(null),children:r.jsxs(Ir,{className:"max-w-3xl max-h-[80vh] overflow-hidden flex flex-col",children:[r.jsxs($r,{children:[r.jsxs(Fr,{children:[x==null?void 0:x.name,"'s Activity"]}),r.jsx(Zn,{children:x==null?void 0:x.email})]}),r.jsxs(Ai,{defaultValue:"content",className:"flex-1 overflow-hidden flex flex-col",children:[r.jsxs(vi,{className:"grid w-full grid-cols-2",children:[r.jsx(sn,{value:"content",children:"Content Engagement"}),r.jsx(sn,{value:"apps",children:"App Launches"})]}),r.jsx(Mn,{value:"content",className:"flex-1 overflow-auto",children:r.jsx("div",{className:"rounded-md border",children:r.jsxs(Ks,{children:[r.jsx(Zs,{children:r.jsxs(Mr,{children:[r.jsx(It,{children:"Resource"}),r.jsx(It,{children:"Type"}),r.jsx(It,{children:"Action"}),r.jsx(It,{children:"Time"})]})}),r.jsx(Ys,{children:x&&S(x.id).length===0?r.jsx(Mr,{children:r.jsx(kt,{colSpan:4,className:"text-center text-muted-foreground",children:"No content engagement yet"})}):x&&S(x.id).map(k=>r.jsxs(Mr,{children:[r.jsx(kt,{className:"max-w-[200px] truncate font-medium",children:k.resource_title}),r.jsx(kt,{children:r.jsxs(Pt,{variant:"outline",className:"gap-1",children:[dCt(k.resource_type),lCt[k.resource_type]||k.resource_type]})}),r.jsx(kt,{children:r.jsx("span",{className:"text-sm text-muted-foreground",children:cCt[k.action_type]||k.action_type})}),r.jsx(kt,{className:"text-sm text-muted-foreground",children:bu(new Date(k.created_at),{addSuffix:!0})})]},k.id))})]})})}),r.jsx(Mn,{value:"apps",className:"flex-1 overflow-auto",children:r.jsx("div",{className:"rounded-md border",children:r.jsxs(Ks,{children:[r.jsx(Zs,{children:r.jsxs(Mr,{children:[r.jsx(It,{children:"App"}),r.jsx(It,{children:"Time"})]})}),r.jsx(Ys,{children:x&&b(x.id).length===0?r.jsx(Mr,{children:r.jsx(kt,{colSpan:2,className:"text-center text-muted-foreground",children:"No app launches yet"})}):x&&b(x.id).map(k=>r.jsxs(Mr,{children:[r.jsx(kt,{children:r.jsx(Pt,{variant:"outline",children:k.app_name})}),r.jsx(kt,{className:"text-sm text-muted-foreground",children:bu(new Date(k.launched_at),{addSuffix:!0})})]},k.id))})]})})})]})]})})]})},hCt=({brokerageId:e})=>{const{toast:t}=_i(),[n,s]=E.useState({totalAgents:0,activeAgents:0,pendingAgents:0,totalLaunches:0,launchesThisWeek:0,launchesThisMonth:0}),[a,o]=E.useState(!0);E.useEffect(()=>{l()},[e]);const l=async()=>{try{o(!0);const{data:i,error:u}=await Q.from("profiles").select("id").eq("brokerage_id",e);if(u)throw u;const p=i.map(D=>D.id),x=p.length;if(p.length===0){o(!1);return}const{data:y,error:_}=await Q.from("profiles").select("id, email").in("id",p);if(_)throw _;const{count:b}=await Q.from("profiles").select("*",{count:"exact",head:!0}).eq("brokerage_id",e).not("last_login","is",null),S=b||0,k=x-S,{count:M}=await Q.from("activity_logs").select("*",{count:"exact",head:!0}).in("user_id",p),P=new Date;P.setDate(P.getDate()-7);const{count:T}=await Q.from("activity_logs").select("*",{count:"exact",head:!0}).in("user_id",p).gte("launched_at",P.toISOString()),I=new Date;I.setMonth(I.getMonth()-1);const{count:z}=await Q.from("activity_logs").select("*",{count:"exact",head:!0}).in("user_id",p).gte("launched_at",I.toISOString());s({totalAgents:x,activeAgents:S,pendingAgents:k,totalLaunches:M||0,launchesThisWeek:T||0,launchesThisMonth:z||0})}catch(i){console.error("Error loading analytics:",i),t({title:"Error",description:"Failed to load analytics",variant:"destructive"})}finally{o(!1)}};return a?r.jsx(Ze,{children:r.jsx(et,{className:"flex items-center justify-center py-8",children:r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})})}):r.jsxs("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:[r.jsxs(Ze,{children:[r.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Yt,{className:"text-sm font-medium",children:"Total Agents"}),r.jsx(Un,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(et,{children:[r.jsx("div",{className:"text-2xl font-bold",children:n.totalAgents}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[n.activeAgents," active, ",n.pendingAgents," pending"]})]})]}),r.jsxs(Ze,{children:[r.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Yt,{className:"text-sm font-medium",children:"Active Agents"}),r.jsx(di,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(et,{children:[r.jsx("div",{className:"text-2xl font-bold",children:n.activeAgents}),r.jsx("p",{className:"text-xs text-muted-foreground",children:n.totalAgents>0?`${Math.round(n.activeAgents/n.totalAgents*100)}% of total`:"0% of total"})]})]}),r.jsxs(Ze,{children:[r.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Yt,{className:"text-sm font-medium",children:"Pending Invites"}),r.jsx(Ya,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(et,{children:[r.jsx("div",{className:"text-2xl font-bold",children:n.pendingAgents}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Awaiting setup"})]})]}),r.jsxs(Ze,{children:[r.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Yt,{className:"text-sm font-medium",children:"Total App Launches"}),r.jsx(Ig,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(et,{children:[r.jsx("div",{className:"text-2xl font-bold",children:n.totalLaunches}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"All time"})]})]}),r.jsxs(Ze,{children:[r.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Yt,{className:"text-sm font-medium",children:"This Week"}),r.jsx(Ig,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(et,{children:[r.jsx("div",{className:"text-2xl font-bold",children:n.launchesThisWeek}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Last 7 days"})]})]}),r.jsxs(Ze,{children:[r.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-2",children:[r.jsx(Yt,{className:"text-sm font-medium",children:"This Month"}),r.jsx(Ig,{className:"h-4 w-4 text-muted-foreground"})]}),r.jsxs(et,{children:[r.jsx("div",{className:"text-2xl font-bold",children:n.launchesThisMonth}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Last 30 days"})]})]})]})},fCt=({brokerageId:e})=>{const[t,n]=E.useState([]),[s,a]=E.useState(!0),[o,l]=E.useState(!1),[i,u]=E.useState(!1),[p,x]=E.useState({description:"",maxUses:""});E.useEffect(()=>{y()},[e]);const y=async()=>{try{const{data:P,error:T}=await Q.from("invite_codes").select("*").eq("brokerage_id",e).order("created_at",{ascending:!1});if(T)throw T;n(P||[])}catch(P){console.error("Error loading invite codes:",P),Ie.error("Failed to load invite links")}finally{a(!1)}},_=()=>Math.random().toString(36).substring(2,8).toUpperCase(),b=async()=>{l(!0);try{const P=_(),{error:T}=await Q.from("invite_codes").insert({code:P,description:p.description||null,max_uses:p.maxUses?parseInt(p.maxUses):null,brokerage_id:e,is_active:!0});if(T)throw T;Ie.success("Invite link created!"),u(!1),x({description:"",maxUses:""}),y()}catch(P){console.error("Error creating invite code:",P),Ie.error("Failed to create invite link")}finally{l(!1)}},S=async P=>{try{const{error:T}=await Q.from("invite_codes").delete().eq("id",P);if(T)throw T;Ie.success("Invite link deleted"),n(t.filter(I=>I.id!==P))}catch(T){console.error("Error deleting invite code:",T),Ie.error("Failed to delete invite link")}},k=async(P,T)=>{try{const{error:I}=await Q.from("invite_codes").update({is_active:!T}).eq("id",P);if(I)throw I;n(t.map(z=>z.id===P?{...z,is_active:!T}:z)),Ie.success(`Invite link ${T?"deactivated":"activated"}`)}catch(I){console.error("Error toggling invite code:",I),Ie.error("Failed to update invite link")}},M=P=>{const T=`${window.location.origin}/join?code=${P}`;navigator.clipboard.writeText(T),Ie.success("Link copied to clipboard!")};return s?r.jsx(Ze,{children:r.jsx(et,{className:"flex items-center justify-center py-8",children:r.jsx(Zr,{className:"h-6 w-6 animate-spin text-muted-foreground"})})}):r.jsxs(Ze,{children:[r.jsxs(Wt,{className:"flex flex-row items-center justify-between",children:[r.jsxs("div",{children:[r.jsxs(Yt,{className:"flex items-center gap-2",children:[r.jsx(Io,{className:"h-5 w-5"}),"Agent Invite Links"]}),r.jsx(Sn,{children:"Create shareable links for agents to join your brokerage"})]}),r.jsxs(Or,{open:i,onOpenChange:u,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(Ir,{children:[r.jsxs($r,{children:[r.jsx(Fr,{children:"Create Invite Link"}),r.jsx(Zn,{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($e,{htmlFor:"description",children:"Description (optional)"}),r.jsx(dt,{id:"description",placeholder:"e.g., New agent recruiting campaign",value:p.description,onChange:P=>x({...p,description:P.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{htmlFor:"maxUses",children:"Max Uses (optional)"}),r.jsx(dt,{id:"maxUses",type:"number",placeholder:"Leave empty for unlimited",value:p.maxUses,onChange:P=>x({...p,maxUses:P.target.value})})]}),r.jsx(ee,{onClick:b,disabled:o,className:"w-full",children:o?r.jsxs(r.Fragment,{children:[r.jsx(Zr,{className:"mr-2 h-4 w-4 animate-spin"}),"Creating..."]}):"Create Invite Link"})]})]})]})]}),r.jsx(et,{children:t.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(Io,{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:t.map(P=>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:P.code}),r.jsx(Pt,{variant:P.is_active?"default":"secondary",children:P.is_active?"Active":"Inactive"})]}),P.description&&r.jsx("p",{className:"text-sm text-muted-foreground mt-1 truncate",children:P.description}),r.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:[P.uses_count," uses",P.max_uses&&` / ${P.max_uses} max`]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>M(P.code),title:"Copy link",children:r.jsx(Wo,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>k(P.id,P.is_active),title:P.is_active?"Deactivate":"Activate",children:P.is_active?"Disable":"Enable"}),r.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>S(P.id),className:"text-destructive hover:text-destructive",title:"Delete",children:r.jsx(Bn,{className:"h-4 w-4"})})]})]},P.id))})})]})},pCt=({open:e,onOpenChange:t,referralCode:n,brokerageId:s,senderName:a,brokerageName:o,onInvitesSent:l})=>{const[i,u]=E.useState(""),[p,x]=E.useState([]),[y,_]=E.useState(""),[b,S]=E.useState(!1),k=z=>/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(z),M=()=>{const z=i.trim().toLowerCase();if(z&&k(z)&&!p.includes(z)){if(p.length>=10){Ie.error("Maximum 10 emails per invite");return}x([...p,z]),u("")}else z&&!k(z)?Ie.error("Please enter a valid email address"):p.includes(z)&&Ie.error("Email already added")},P=z=>{x(p.filter(D=>D!==z))},T=z=>{(z.key==="Enter"||z.key===",")&&(z.preventDefault(),M())},I=async()=>{if(p.length===0){Ie.error("Please add at least one email address");return}S(!0);try{const{data:z,error:D}=await Q.functions.invoke("send-referral-invite",{body:{emails:p,personalMessage:y.trim()||void 0,referralCode:n,brokerageId:s,senderName:a,brokerageName:o}});if(D)throw D;z.successCount===z.totalCount?Ie.success(`${z.successCount} invite${z.successCount>1?"s":""} sent successfully!`):Ie.warning(`${z.successCount} of ${z.totalCount} invites sent. Some failed.`),x([]),_(""),t(!1),l==null||l()}catch(z){console.error("Error sending invites:",z),Ie.error("Failed to send invites. Please try again.")}finally{S(!1)}};return r.jsx(Or,{open:e,onOpenChange:t,children:r.jsxs(Ir,{className:"sm:max-w-[550px]",children:[r.jsxs($r,{children:[r.jsxs(Fr,{className:"flex items-center gap-2",children:[r.jsx(Ns,{className:"h-5 w-5 text-primary"}),"Invite Broker Friends"]}),r.jsx(Zn,{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(to,{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($e,{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=>u(z.target.value),onKeyDown:T,onBlur:M}),r.jsx(ee,{type:"button",variant:"secondary",onClick:M,children:"Add"})]}),p.length>0&&r.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:p.map(z=>r.jsxs(Pt,{variant:"secondary",className:"flex items-center gap-1 pr-1",children:[z,r.jsx("button",{type:"button",onClick:()=>P(z),className:"ml-1 rounded-full p-0.5 hover:bg-muted",children:r.jsx(hs,{className:"h-3 w-3"})})]},z))})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{htmlFor:"message",children:"Personal Message (optional)"}),r.jsx(Jn,{id:"message",placeholder:"Add a personal note that will appear at the top of the email...",value:y,onChange:z=>_(z.target.value),rows:3,maxLength:500}),r.jsxs("p",{className:"text-xs text-muted-foreground text-right",children:[y.length,"/500 characters"]})]}),r.jsxs("div",{className:"bg-muted/50 rounded-lg p-4 space-y-2",children:[r.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium",children:[r.jsx(Ls,{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:()=>t(!1),children:"Cancel"}),r.jsx(ee,{onClick:I,disabled:p.length===0||b,children:b?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(lo,{className:"h-4 w-4 mr-2"}),"Send ",p.length>0&&`(${p.length})`," Invite",p.length!==1?"s":""]})})]})]})})},mCt=({brokerageId:e,refreshTrigger:t})=>{const[n,s]=E.useState([]),[a,o]=E.useState(!0);E.useEffect(()=>{l()},[e,t]);const l=async()=>{try{const{data:u,error:p}=await Q.from("referral_invites").select("*").eq("referrer_brokerage_id",e).order("sent_at",{ascending:!1}).limit(20);if(p)throw p;s(u||[])}catch(u){console.error("Error fetching invites:",u)}finally{o(!1)}},i=u=>{switch(u){case"signed_up":return r.jsxs(Pt,{className:"bg-green-100 text-green-800 gap-1",children:[r.jsx(di,{className:"h-3 w-3"}),"Signed Up"]});case"expired":return r.jsxs(Pt,{variant:"outline",className:"text-muted-foreground gap-1",children:[r.jsx(bc,{className:"h-3 w-3"}),"Expired"]});default:return r.jsxs(Pt,{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(Ns,{className:"h-8 w-8 mx-auto mb-2 opacity-50"}),r.jsx("p",{className:"text-sm",children:"No invites sent yet"}),r.jsx("p",{className:"text-xs",children:"Start inviting broker friends to earn rewards!"})]}):r.jsxs("div",{className:"space-y-2",children:[r.jsx("p",{className:"text-sm font-medium mb-3",children:"Recent Invites"}),n.map(u=>r.jsxs("div",{className:"flex items-center justify-between p-2.5 bg-muted/30 rounded-lg",children:[r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("p",{className:"text-sm font-medium truncate",children:u.recipient_email}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Sent ",on(new Date(u.sent_at),"MMM d, yyyy")]})]}),i(u.status)]},u.id))]})},gCt=()=>{const{brokerageId:e,user:t}=tn(),[n,s]=E.useState(null),[a,o]=E.useState(""),[l,i]=E.useState(""),[u,p]=E.useState([]),[x,y]=E.useState(!0),[_,b]=E.useState(!1),[S,k]=E.useState(0);E.useEffect(()=>{e&&M()},[e]);const M=async()=>{try{const[U,V]=await Promise.all([Q.from("brokerages").select("name").eq("id",e).single(),t?Q.from("profiles").select("name").eq("id",t.id).single():Promise.resolve({data:null})]);U.data&&o(U.data.name),V.data&&i(V.data.name||"A LevelUp Member");const{data:W}=await Q.from("referral_codes").select("code").eq("brokerage_id",e).single();if(W)s(W.code);else{const J=`REF${e==null?void 0:e.slice(0,8).toUpperCase()}`;await Q.from("referral_codes").insert({brokerage_id:e,code:J}),s(J)}const{data:G}=await Q.from("referrals").select(` *, referred_user:profiles!referred_user_id(name, email), referred_brokerage:brokerages!referred_brokerage_id(name) `).eq("referrer_brokerage_id",e).order("created_at",{ascending:!1});p(G||[])}catch(U){console.error("Error fetching referral data:",U)}finally{y(!1)}},P=()=>{const U=`https://dashboard.relevelup.com/?ref=${n}`;navigator.clipboard.writeText(U),Ie.success("Referral link copied to clipboard!")},T=u.filter(U=>U.status==="qualified").length,I=u.filter(U=>U.status==="pending").length,z=T*25,D=Math.max(0,Math.ceil((299-z)/25));return x?null:r.jsxs(r.Fragment,{children:[r.jsxs(Ze,{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(to,{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(di,{className:"h-4 w-4"}),r.jsx("span",{className:"text-sm font-medium",children:"Active"})]})]}),D>0&&z<299&&r.jsxs("div",{className:"text-right",children:[r.jsxs("p",{className:"text-sm font-medium",children:["Refer ",D," 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(Ls,{className:"h-5 w-5"}),r.jsx("span",{className:"font-bold",children:"FREE Membership Unlocked!"})]})]})})]})}),r.jsxs(et,{className:"pt-6 space-y-6",children:[r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[r.jsxs(ee,{onClick:()=>b(!0),className:"w-full",size:"lg",children:[r.jsx(Ns,{className:"h-4 w-4 mr-2"}),"Invite Broker Friends"]}),r.jsxs(ee,{onClick:P,variant:"outline",className:"w-full",size:"lg",children:[r.jsx(Wo,{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(Rd,{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(Un,{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:I}),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(mCt,{brokerageId:e,refreshTrigger:S}),u.length>0&&r.jsxs("div",{className:"space-y-2",children:[r.jsx("p",{className:"text-sm font-medium",children:"Your Referrals"}),u.slice(0,5).map(U=>{var V,W;return r.jsxs("div",{className:"flex items-center justify-between p-2.5 bg-muted/30 rounded-lg",children:[r.jsx("span",{className:"text-sm truncate",children:((V=U.referred_brokerage)==null?void 0:V.name)||((W=U.referred_user)==null?void 0:W.email)||"Pending setup"}),r.jsxs(Pt,{variant:U.status==="qualified"?"default":U.status==="pending"?"secondary":"destructive",className:U.status==="qualified"?"bg-green-600":"",children:[U.status==="qualified"&&r.jsx(di,{className:"h-3 w-3 mr-1"}),U.status]})]},U.id)})]})]})]}),r.jsx(pCt,{open:_,onOpenChange:b,referralCode:n||"",brokerageId:e||"",senderName:l||"A LevelUp Member",brokerageName:a,onInvitesSent:()=>k(U=>U+1)})]})},xCt=()=>{const{user:e,isBrokerageManager:t,brokerageId:n,isAdmin:s,managedBrokerages:a,selectedBrokerageId:o,setSelectedBrokerageId:l}=tn(),i=Gn(),{toast:u}=_i(),[p,x]=E.useState(""),[y,_]=E.useState(!0),b=o||(a.length>0?a[0].id:n);E.useEffect(()=>{if(!e||!t&&!s){i("/dashboard");return}!o&&a.length>0&&l(a[0].id),b?S():a.length===0&&!n&&_(!1)},[e,t,s,b,i,a,o]);const S=async()=>{if(!b){_(!1);return}try{const{data:k,error:M}=await Q.from("brokerages").select("name").eq("id",b).single();if(M)throw M;x(k.name)}catch(k){console.error("Error loading brokerage info:",k),u({title:"Error",description:"Failed to load brokerage information",variant:"destructive"})}finally{_(!1)}};return y?r.jsx(Dr,{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"})})}):b?r.jsx(Dr,{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(mn,{value:o||"",onValueChange:l,children:[r.jsxs(fn,{className:"w-[280px]",children:[r.jsx(hi,{className:"mr-2 h-4 w-4"}),r.jsx(yn,{placeholder:"Select brokerage"})]}),r.jsx(pn,{children:a.map(k=>r.jsx(qt,{value:k.id,children:k.name},k.id))})]})]}),r.jsxs(Ai,{defaultValue:"agents",className:"space-y-4",children:[r.jsxs(vi,{className:"grid w-full grid-cols-3 md:grid-cols-7",children:[r.jsx(sn,{value:"agents",children:"Agents"}),r.jsx(sn,{value:"invite",children:"Invite Links"}),r.jsx(sn,{value:"referrals",children:"Referrals"}),r.jsx(sn,{value:"leaderboard",children:"Leaderboard"}),r.jsx(sn,{value:"activity",children:"Activity"}),r.jsx(sn,{value:"analytics",children:"Analytics"}),r.jsx(sn,{value:"shares",children:"Shares"})]}),r.jsx(Mn,{value:"agents",className:"space-y-4",children:r.jsx(oCt,{brokerageId:b})}),r.jsx(Mn,{value:"invite",className:"space-y-4",children:r.jsx(fCt,{brokerageId:b})}),r.jsx(Mn,{value:"referrals",className:"space-y-4",children:r.jsx(gCt,{})}),r.jsx(Mn,{value:"leaderboard",className:"space-y-4",children:r.jsx(r9e,{brokerageId:b,title:`${p} Event Leaderboard`,showUserStats:!1})}),r.jsx(Mn,{value:"activity",className:"space-y-4",children:r.jsx(uCt,{brokerageId:b})}),r.jsx(Mn,{value:"analytics",className:"space-y-4",children:r.jsx(hCt,{brokerageId:b})}),r.jsx(Mn,{value:"shares",className:"space-y-4",children:r.jsx(lBe,{brokerageOnly:!0,brokerageId:b})})]})]})}):r.jsx(Dr,{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(hi,{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 yCt({brokerageId:e,canManage:t}){const{user:n}=tn(),[s,a]=E.useState([]),[o,l]=E.useState(!0),[i,u]=E.useState(!1),[p,x]=E.useState(null),[y,_]=E.useState(null),[b,S]=E.useState(!1),[k,M]=E.useState(""),[P,T]=E.useState(""),[I,z]=E.useState(!1),D=async()=>{try{const{data:J,error:ne}=await Q.from("brokerage_announcements").select("*").eq("brokerage_id",e).order("is_pinned",{ascending:!1}).order("pinned_at",{ascending:!1,nullsFirst:!1}).order("created_at",{ascending:!1});if(ne)throw ne;const oe=J;if(oe&&oe.length>0){const ge=[...new Set(oe.map(fe=>fe.created_by))],{data:ie}=await Q.from("profiles").select("id, name, avatar_url").in("id",ge),pe=new Map((ie==null?void 0:ie.map(fe=>[fe.id,fe]))||[]),se=oe.map(fe=>({...fe,author:pe.get(fe.created_by)||{name:"Unknown",avatar_url:null}}));a(se)}else a([])}catch(J){console.error("Error fetching announcements:",J)}finally{l(!1)}};E.useEffect(()=>{D()},[e]);const U=()=>{M(""),T(""),z(!1),x(null)},V=J=>{J?(x(J),M(J.title),T(J.content),z(J.is_pinned)):U(),u(!0)},W=async()=>{if(!k.trim()||!P.trim()){Ie.error("Please fill in all fields");return}S(!0);try{if(p){const{error:J}=await Q.from("brokerage_announcements").update({title:k.trim(),content:P.trim(),is_pinned:I,pinned_at:I?new Date().toISOString():null}).eq("id",p.id);if(J)throw J;Ie.success("Announcement updated")}else{const{error:J}=await Q.from("brokerage_announcements").insert({brokerage_id:e,created_by:n==null?void 0:n.id,title:k.trim(),content:P.trim(),is_pinned:I,pinned_at:I?new Date().toISOString():null});if(J)throw J;Ie.success("Announcement created")}u(!1),U(),D()}catch(J){console.error("Error saving announcement:",J),Ie.error("Failed to save announcement")}finally{S(!1)}},G=async()=>{if(y)try{const{error:J}=await Q.from("brokerage_announcements").delete().eq("id",y);if(J)throw J;Ie.success("Announcement deleted"),D()}catch(J){console.error("Error deleting announcement:",J),Ie.error("Failed to delete announcement")}finally{_(null)}};return o?r.jsxs(Ze,{children:[r.jsx(Wt,{children:r.jsxs(Yt,{className:"flex items-center gap-2",children:[r.jsx(Am,{className:"h-5 w-5"}),"Announcements"]})}),r.jsx(et,{children:r.jsx("div",{className:"animate-pulse space-y-3",children:r.jsx("div",{className:"h-20 bg-muted rounded"})})})]}):r.jsxs(r.Fragment,{children:[r.jsxs(Ze,{children:[r.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-4",children:[r.jsxs(Yt,{className:"flex items-center gap-2",children:[r.jsx(Am,{className:"h-5 w-5 text-primary"}),"Announcements"]}),t&&r.jsxs(ee,{size:"sm",onClick:()=>V(),className:"gap-1",children:[r.jsx(bn,{className:"h-4 w-4"}),"New"]})]}),r.jsx(et,{children:s.length===0?r.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:"No announcements yet"}):r.jsx("div",{className:"space-y-4",children:s.map(J=>{var ne,oe,ge,ie;return r.jsx("div",{className:`p-4 rounded-lg border ${J.is_pinned?"bg-primary/5 border-primary/20":"bg-muted/30"}`,children:r.jsxs("div",{className:"flex items-start justify-between gap-2",children:[r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[J.is_pinned&&r.jsx(K1,{className:"h-3.5 w-3.5 text-primary shrink-0"}),r.jsx("h4",{className:"font-semibold truncate",children:J.title})]}),r.jsx("p",{className:"text-sm text-muted-foreground whitespace-pre-wrap",children:J.content}),r.jsxs("div",{className:"flex items-center gap-2 mt-3 text-xs text-muted-foreground",children:[r.jsxs(Qs,{className:"h-5 w-5",children:[r.jsx(Si,{src:((ne=J.author)==null?void 0:ne.avatar_url)||void 0}),r.jsx(Js,{className:"text-[10px]",children:((ge=(oe=J.author)==null?void 0:oe.name)==null?void 0:ge.charAt(0))||"?"})]}),r.jsx("span",{children:(ie=J.author)==null?void 0:ie.name}),r.jsx("span",{children:"•"}),r.jsx("span",{children:on(new Date(J.created_at),"MMM d, yyyy")})]})]}),t&&r.jsxs("div",{className:"flex items-center gap-1 shrink-0",children:[r.jsx(ee,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>V(J),children:r.jsx(ni,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"icon",className:"h-8 w-8 text-destructive hover:text-destructive",onClick:()=>_(J.id),children:r.jsx(Bn,{className:"h-4 w-4"})})]})]})},J.id)})})})]}),r.jsx(Or,{open:i,onOpenChange:u,children:r.jsxs(Ir,{children:[r.jsx($r,{children:r.jsx(Fr,{children:p?"Edit Announcement":"New Announcement"})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{htmlFor:"title",children:"Title"}),r.jsx(dt,{id:"title",value:k,onChange:J=>M(J.target.value),placeholder:"Announcement title..."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{htmlFor:"content",children:"Content"}),r.jsx(Jn,{id:"content",value:P,onChange:J=>T(J.target.value),placeholder:"Write your announcement...",rows:4})]}),r.jsx("div",{className:"flex items-center justify-between",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ts,{id:"pinned",checked:I,onCheckedChange:z}),r.jsxs($e,{htmlFor:"pinned",className:"flex items-center gap-1 cursor-pointer",children:[r.jsx(K1,{className:"h-4 w-4"}),"Pin to top"]})]})}),r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(ee,{variant:"outline",onClick:()=>u(!1),children:"Cancel"}),r.jsx(ee,{onClick:W,disabled:b,children:b?"Saving...":p?"Update":"Create"})]})]})]})}),r.jsx(Id,{open:!!y,onOpenChange:()=>_(null),children:r.jsxs(id,{children:[r.jsxs(od,{children:[r.jsx(cd,{children:"Delete Announcement"}),r.jsx(dd,{children:"Are you sure you want to delete this announcement? This action cannot be undone."})]}),r.jsxs(ld,{children:[r.jsx(ud,{children:"Cancel"}),r.jsx(Bc,{onClick:G,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})})]})}function vCt({brokerageId:e}){const[t,n]=E.useState([]),[s,a]=E.useState(!0),[o,l]=E.useState(""),[i,u]=E.useState(new Set);E.useEffect(()=>{(async()=>{try{const{data:y,error:_}=await Q.from("profiles").select("id, name, email, phone, avatar_url, title, bio, areas_served, years_experience, instagram_url, facebook_url, linkedin_url").eq("brokerage_id",e).order("name");if(_)throw _;if(n(y||[]),y&&y.length>0){const b=y.map(k=>k.id),{data:S}=await Q.from("agent_assistant_assignments").select("agent_id").in("agent_id",b);S&&u(new Set(S.map(k=>k.agent_id)))}}catch(y){console.error("Error fetching agents:",y)}finally{a(!1)}})()},[e]);const p=t.filter(x=>{var y,_;return x.name.toLowerCase().includes(o.toLowerCase())||x.email.toLowerCase().includes(o.toLowerCase())||((y=x.title)==null?void 0:y.toLowerCase().includes(o.toLowerCase()))||((_=x.areas_served)==null?void 0:_.toLowerCase().includes(o.toLowerCase()))});return s?r.jsxs(Ze,{children:[r.jsx(Wt,{children:r.jsxs(Yt,{className:"flex items-center gap-2",children:[r.jsx(Un,{className:"h-5 w-5"}),"Agent Roster"]})}),r.jsx(et,{children:r.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4",children:[1,2,3,4].map(x=>r.jsx("div",{className:"animate-pulse",children:r.jsx("div",{className:"h-48 bg-muted rounded-lg"})},x))})})]}):r.jsxs(Ze,{children:[r.jsxs(Wt,{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4 space-y-0",children:[r.jsxs(Yt,{className:"flex items-center gap-2",children:[r.jsx(Un,{className:"h-5 w-5 text-primary"}),"Agent Roster",r.jsxs("span",{className:"text-sm font-normal text-muted-foreground",children:["(",t.length,")"]})]}),r.jsxs("div",{className:"relative w-full sm:w-64",children:[r.jsx(Sa,{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(et,{children:p.length===0?r.jsx("p",{className:"text-sm text-muted-foreground text-center py-8",children:o?"No agents match your search":"No agents in this brokerage yet"}):r.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4",children:p.map(x=>r.jsx(_Ct,{agent:x,hasAssistant:i.has(x.id)},x.id))})})]})}function _Ct({agent:e,hasAssistant:t}){const n=e.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(Qs,{className:"h-20 w-20 mb-3 ring-2 ring-background shadow-md",children:[r.jsx(Si,{src:e.avatar_url||void 0,alt:e.name}),r.jsx(Js,{className:"text-lg bg-primary/10 text-primary",children:n})]}),r.jsx("h3",{className:"font-semibold text-sm leading-tight",children:e.name}),e.title&&r.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:e.title}),t&&r.jsx(Pt,{variant:"outline",className:"text-[10px] mt-1",children:"Has Assistant"})]}),e.bio&&r.jsx("p",{className:"text-xs text-muted-foreground text-center line-clamp-2 mb-3",children:e.bio}),r.jsxs("div",{className:"space-y-1.5 mb-3",children:[e.areas_served&&r.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[r.jsx(Po,{className:"h-3 w-3 shrink-0"}),r.jsx("span",{className:"truncate",children:e.areas_served})]}),e.years_experience&&r.jsxs("p",{className:"text-xs text-muted-foreground text-center",children:[e.years_experience," ",e.years_experience===1?"year":"years"," experience"]})]}),r.jsxs("div",{className:"flex items-center justify-center gap-2",children:[e.phone&&r.jsx(ee,{variant:"outline",size:"icon",className:"h-8 w-8",asChild:!0,children:r.jsx("a",{href:`tel:${e.phone}`,title:`Call ${e.name}`,children:r.jsx(Ti,{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:${e.email}`,title:`Email ${e.name}`,children:r.jsx(Ns,{className:"h-4 w-4"})})}),e.linkedin_url&&r.jsx(ee,{variant:"outline",size:"icon",className:"h-8 w-8",asChild:!0,children:r.jsx("a",{href:e.linkedin_url,target:"_blank",rel:"noopener noreferrer",title:"LinkedIn",children:r.jsx(gf,{className:"h-4 w-4"})})}),e.instagram_url&&r.jsx(ee,{variant:"outline",size:"icon",className:"h-8 w-8",asChild:!0,children:r.jsx("a",{href:e.instagram_url,target:"_blank",rel:"noopener noreferrer",title:"Instagram",children:r.jsx(_u,{className:"h-4 w-4"})})})]})]})}function bCt({brokerageId:e}){const[t,n]=E.useState([]),[s,a]=E.useState(!0);if(E.useEffect(()=>{(async()=>{try{const{data:u,error:p}=await Q.from("profiles").select("id, name, avatar_url").eq("brokerage_id",e);if(p)throw p;if(!u||u.length===0){n([]),a(!1);return}const x=u.map(k=>k.id),{data:y,error:_}=await Q.from("agent_attendance_stats").select("user_id, total_points").in("user_id",x).order("total_points",{ascending:!1});if(_)throw _;const b=new Map(u.map(k=>[k.id,k])),S=(y||[]).filter(k=>k.total_points>0).map(k=>{const M=b.get(k.user_id);return{user_id:k.user_id,total_points:k.total_points,name:(M==null?void 0:M.name)||"Unknown",avatar_url:(M==null?void 0:M.avatar_url)||null}});n(S)}catch(u){console.error("Error fetching leaderboard:",u)}finally{a(!1)}})()},[e]),s)return r.jsxs(Ze,{children:[r.jsx(Wt,{children:r.jsxs(Yt,{className:"flex items-center gap-2",children:[r.jsx(ro,{className:"h-5 w-5"}),"Team Leaderboard"]})}),r.jsx(et,{children:r.jsx("div",{className:"animate-pulse space-y-3",children:[1,2,3].map(i=>r.jsx("div",{className:"h-12 bg-muted rounded"},i))})})]});const o=i=>i===1?"text-yellow-500":i===2?"text-gray-400":i===3?"text-amber-600":"text-muted-foreground",l=i=>i<=3?r.jsx(hy,{className:Bt("h-5 w-5",o(i))}):r.jsx("span",{className:"w-5 text-center text-sm text-muted-foreground",children:i});return r.jsxs(Ze,{children:[r.jsx(Wt,{children:r.jsxs(Yt,{className:"flex items-center gap-2",children:[r.jsx(ro,{className:"h-5 w-5 text-primary"}),"Team Leaderboard"]})}),r.jsx(et,{children:t.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:t.slice(0,10).map((i,u)=>{const p=i.name.split(" ").map(y=>y[0]).join("").toUpperCase().slice(0,2),x=u+1;return r.jsxs("div",{className:Bt("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(Qs,{className:"h-8 w-8",children:[r.jsx(Si,{src:i.avatar_url||void 0}),r.jsx(Js,{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 wCt({brokerageId:e}){const t=Gn(),[n,s]=E.useState([]),[a,o]=E.useState(!0);E.useEffect(()=>{(async()=>{try{const{data:u,error:p}=await Q.from("profiles").select("id, name, avatar_url").eq("brokerage_id",e);if(p)throw p;if(!u||u.length===0){s([]),o(!1);return}const x=u.map(k=>k.id),y=new Map(u.map(k=>[k.id,k])),{data:_,error:b}=await Q.from("listings").select(` id, slug, property_address, city, price, property_type, agent_id, listing_photos(photo_url) `).in("agent_id",x).eq("status","active").order("created_at",{ascending:!1}).limit(6);if(b)throw b;const S=(_||[]).map(k=>({id:k.id,slug:k.slug,property_address:k.property_address,city:k.city,price:k.price,property_type:k.property_type,agent_id:k.agent_id,agent:y.get(k.agent_id)||null,photos:k.listing_photos||[]}));s(S)}catch(u){console.error("Error fetching listings:",u)}finally{o(!1)}})()},[e]);const l=i=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(i);return a?r.jsxs(Ze,{children:[r.jsx(Wt,{children:r.jsxs(Yt,{className:"flex items-center gap-2",children:[r.jsx(xa,{className:"h-5 w-5"}),"Brokerage Listings"]})}),r.jsx(et,{children:r.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[1,2].map(i=>r.jsx("div",{className:"animate-pulse",children:r.jsx("div",{className:"h-32 bg-muted rounded-lg"})},i))})})]}):r.jsxs(Ze,{children:[r.jsxs(Wt,{className:"flex flex-row items-center justify-between space-y-0 pb-4",children:[r.jsxs(Yt,{className:"flex items-center gap-2",children:[r.jsx(xa,{className:"h-5 w-5 text-primary"}),"Brokerage Listings"]}),r.jsxs(ee,{size:"sm",variant:"outline",onClick:()=>t("/mission-control/listings"),className:"gap-1",children:[r.jsx(bn,{className:"h-4 w-4"}),"Add Listing"]})]}),r.jsxs(et,{children:[n.length===0?r.jsxs("div",{className:"text-center py-8",children:[r.jsx(xa,{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:()=>t("/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(xa,{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:()=>t("/mission-control/listings"),children:["View All Listings",r.jsx(As,{className:"h-3 w-3 ml-1"})]})]})]})}function jCt(){const{user:e,isAdmin:t,isBrokerageManager:n}=tn(),s=Gn(),[a,o]=E.useState(!0),[l,i]=E.useState(null),[u,p]=E.useState(""),[x,y]=E.useState(0),[_,b]=E.useState(!1),[S,k]=E.useState(!1);return E.useEffect(()=>{(async()=>{if(e)try{const{data:P}=await Q.from("profiles").select("brokerage_id").eq("id",e.id).maybeSingle();if(!(P!=null&&P.brokerage_id)){o(!1);return}i(P.brokerage_id);const{data:T}=await Q.from("brokerages").select("name").eq("id",P.brokerage_id).maybeSingle();T&&p(T.name);const{count:I}=await Q.from("profiles").select("id",{count:"exact",head:!0}).eq("brokerage_id",P.brokerage_id);if(y(I||0),t)b(!0),k(!0);else if(n){const{data:z}=await Q.from("brokerage_manager_assignments").select("id").eq("user_id",e.id).eq("brokerage_id",P.brokerage_id).maybeSingle();b(!!z),k(!!z)}}catch(P){console.error("Error fetching brokerage info:",P)}finally{o(!1)}})()},[e,t,n]),a?r.jsx(Dr,{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(Dr,{title:u||"My Brokerage",description:"Team Hub",children:r.jsxs("div",{className:"space-y-8",children:[r.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-4",children:[r.jsxs("div",{className:"flex items-center gap-2 bg-muted/50 rounded-lg px-4 py-2",children:[r.jsx(Un,{className:"h-5 w-5 text-primary"}),r.jsxs("span",{className:"font-medium",children:[x," ",x===1?"Agent":"Agents"]})]}),S&&r.jsxs(ee,{onClick:()=>s(`/mission-control/listings/new?brokerage=${l}`),children:[r.jsx(xa,{className:"h-4 w-4 mr-2"}),"Add Listing"]})]}),r.jsx(yCt,{brokerageId:l,canManage:_}),r.jsx(vCt,{brokerageId:l}),r.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-8",children:[r.jsx(bCt,{brokerageId:l}),r.jsx(wCt,{brokerageId:l})]})]})}):r.jsx(Dr,{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(hi,{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 kCt(){const e=Gn(),[t,n]=E.useState(""),[s,a]=E.useState("grid"),{data:o,isLoading:l}=Kt({queryKey:["newsletters"],queryFn:async()=>{const{data:I,error:z}=await Q.from("newsletter_content").select("*").eq("is_published",!0).order("publish_date",{ascending:!1});if(z)throw z;return I}}),{data:i}=Kt({queryKey:["newsletter-likes-all"],queryFn:async()=>{const{data:I}=await Q.from("newsletter_likes").select("newsletter_id");return I||[]}}),{data:u}=Kt({queryKey:["newsletter-comments-all"],queryFn:async()=>{const{data:I}=await Q.from("newsletter_comments").select("newsletter_id");return I||[]}}),{data:p}=Kt({queryKey:["newsletter-resource-counts"],queryFn:async()=>{const[I,z,D,U]=await Promise.all([Q.from("newsletter_canva_links").select("newsletter_id"),Q.from("newsletter_pdfs").select("newsletter_id"),Q.from("newsletter_videos").select("newsletter_id"),Q.from("newsletter_drive_links").select("newsletter_id")]);return{canva:I.data||[],pdfs:z.data||[],videos:D.data||[],drives:U.data||[]}}}),x=I=>(i==null?void 0:i.filter(z=>z.newsletter_id===I).length)||0,y=I=>(u==null?void 0:u.filter(z=>z.newsletter_id===I).length)||0,_=I=>{var z;return((z=p==null?void 0:p.canva)==null?void 0:z.filter(D=>D.newsletter_id===I).length)||0},b=I=>{var z;return((z=p==null?void 0:p.pdfs)==null?void 0:z.filter(D=>D.newsletter_id===I).length)||0},S=I=>{var z;return((z=p==null?void 0:p.videos)==null?void 0:z.filter(D=>D.newsletter_id===I).length)||0},k=I=>{var z;return((z=p==null?void 0:p.drives)==null?void 0:z.filter(D=>D.newsletter_id===I).length)||0},M=I=>_(I)+b(I)+S(I)+k(I),P=o==null?void 0:o.filter(I=>{var z;return I.title.toLowerCase().includes(t.toLowerCase())||((z=I.description)==null?void 0:z.toLowerCase().includes(t.toLowerCase()))}),T=I=>{e(`/newsletters/${I}`)};return r.jsx(Dr,{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(Sa,{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:t,onChange:I=>n(I.target.value),className:"pl-9"})]}),r.jsxs("div",{className:"flex gap-2",children:[t&&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(dp,{className:"h-4 w-4"})}),r.jsx(ee,{variant:s==="list"?"secondary":"outline",size:"icon",onClick:()=>a("list"),className:"rounded-full",children:r.jsx(up,{className:"h-4 w-4"})})]})]})]}),r.jsxs("div",{className:"text-sm text-muted-foreground",children:[(P==null?void 0:P.length)||0," item",(P==null?void 0:P.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((I,z)=>r.jsx(Ze,{children:r.jsxs(et,{className:"p-0",children:[r.jsx(Lr,{className:"aspect-[3/2] w-full"}),r.jsxs("div",{className:"p-4 space-y-2",children:[r.jsx(Lr,{className:"h-5 w-3/4"}),r.jsx(Lr,{className:"h-4 w-full"})]})]})},z))}),!l&&(P==null?void 0:P.length)===0&&r.jsxs("div",{className:"text-center py-12",children:[r.jsx(Ea,{className:"h-12 w-12 mx-auto text-muted-foreground mb-4"}),r.jsx("div",{className:"text-muted-foreground mb-4",children:t?"No newsletters match your search":"No newsletters available yet"}),t&&r.jsx(ee,{variant:"outline",onClick:()=>n(""),children:"Clear Search"})]}),!l&&P&&P.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:P.map(I=>{const z=M(I.id),D=_(I.id),U=b(I.id),V=S(I.id);return s==="grid"?r.jsxs(Ze,{className:"group overflow-hidden hover:shadow-lg transition-all duration-200 cursor-pointer border-border/50",onClick:()=>T(I.id),children:[r.jsx("div",{className:"relative overflow-hidden bg-muted aspect-[3/2]",children:I.preview_image_url?r.jsx("img",{src:I.preview_image_url,alt:I.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(Ea,{className:"h-16 w-16"})})}),r.jsxs(et,{className:"p-4 space-y-3",children:[r.jsxs("div",{children:[r.jsx("h3",{className:"font-semibold text-foreground line-clamp-1",children:I.title}),r.jsxs("div",{className:"flex items-center gap-1.5 mt-1 text-xs text-muted-foreground",children:[r.jsx(Ss,{className:"h-3 w-3"}),on(new Date(I.publish_date),"MMM d, yyyy")]})]}),I.description&&r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2",children:I.description.replace(/<[^>]*>/g,"")}),z>0&&r.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[D>0&&r.jsxs(Pt,{variant:"secondary",className:"text-xs gap-1 font-normal",children:[r.jsx(Uc,{className:"h-3 w-3"})," ",D," Template",D>1?"s":""]}),U>0&&r.jsxs(Pt,{variant:"secondary",className:"text-xs gap-1 font-normal",children:[r.jsx(io,{className:"h-3 w-3"})," ",U," PDF",U>1?"s":""]}),V>0&&r.jsxs(Pt,{variant:"secondary",className:"text-xs gap-1 font-normal",children:[r.jsx(Vl,{className:"h-3 w-3"})," ",V," Video",V>1?"s":""]})]}),r.jsxs("div",{className:"flex items-center gap-4 text-xs text-muted-foreground pt-1 border-t border-border/50",children:[r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(zd,{className:"h-3 w-3"})," ",x(I.id)]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Ul,{className:"h-3 w-3"})," ",y(I.id)]})]})]})]},I.id):r.jsx(Ze,{className:"group overflow-hidden hover:shadow-md transition-all duration-200 cursor-pointer border-border/50",onClick:()=>T(I.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:I.preview_image_url?r.jsx("img",{src:I.preview_image_url,alt:I.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(Ea,{className:"h-10 w-10"})})}),r.jsxs(et,{className:"p-4 flex-1 flex flex-col justify-center gap-2",children:[r.jsxs("div",{children:[r.jsx("h3",{className:"font-semibold text-foreground line-clamp-1",children:I.title}),r.jsxs("div",{className:"flex items-center gap-1.5 mt-0.5 text-xs text-muted-foreground",children:[r.jsx(Ss,{className:"h-3 w-3"}),on(new Date(I.publish_date),"MMM d, yyyy")]})]}),I.description&&r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-1",children:I.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(zd,{className:"h-3 w-3"})," ",x(I.id)]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Ul,{className:"h-3 w-3"})," ",y(I.id)]})]})]})]})},I.id)})})]})})}function NCt({rows:e}){if(!e||e.length===0)return null;const t=e.filter(n=>n.columns.some(s=>s.title||s.description||s.image_url));return t.length===0?null:r.jsx("div",{className:"space-y-6",children:t.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(Ze,{className:"overflow-hidden border-border/50",children:[o.image_url&&r.jsx("img",{src:o.image_url,alt:o.title||"",className:"w-full h-40 object-cover"}),r.jsxs(et,{className:"p-4 space-y-2",children:[o.title&&r.jsx("h4",{className:"font-semibold text-foreground",children:o.title}),o.description&&r.jsx("p",{className:"text-sm text-muted-foreground",children:o.description})]})]},l))},s)})})}function SCt(){const{id:e}=md(),t=Gn(),{user:n}=tn(),{toast:s}=_i(),a=Hr(),{trackEngagement:o}=hP(),[l,i]=E.useState(""),{data:u,isLoading:p}=Kt({queryKey:["newsletter",e],queryFn:async()=>{const{data:D,error:U}=await Q.from("newsletter_content").select("*").eq("id",e).single();if(U)throw U;return D},enabled:!!e});E.useEffect(()=>{u&&o("newsletter",u.id,u.title,"view")},[u==null?void 0:u.id]);const{data:x}=Kt({queryKey:["newsletter-drives",e],queryFn:async()=>{const{data:D}=await Q.from("newsletter_drive_links").select("*").eq("newsletter_id",e).order("sort_order");return D||[]},enabled:!!e}),{data:y}=Kt({queryKey:["newsletter-pdfs",e],queryFn:async()=>{const{data:D}=await Q.from("newsletter_pdfs").select("*").eq("newsletter_id",e).order("sort_order");return D||[]},enabled:!!e}),{data:_}=Kt({queryKey:["newsletter-videos",e],queryFn:async()=>{const{data:D}=await Q.from("newsletter_videos").select("*").eq("newsletter_id",e).order("sort_order");return D||[]},enabled:!!e}),{data:b}=Kt({queryKey:["newsletter-canva-links",e],queryFn:async()=>{const{data:D}=await Q.from("newsletter_canva_links").select("*").eq("newsletter_id",e).order("sort_order");return D||[]},enabled:!!e}),{data:S}=Kt({queryKey:["newsletter-likes",e],queryFn:async()=>{const{data:D}=await Q.from("newsletter_likes").select("*").eq("newsletter_id",e);return D||[]},enabled:!!e}),{data:k}=Kt({queryKey:["newsletter-comments",e],queryFn:async()=>{const{data:D}=await Q.from("newsletter_comments").select("*, profiles:user_id(name)").eq("newsletter_id",e).order("created_at",{ascending:!1});return D||[]},enabled:!!e}),M=S==null?void 0:S.some(D=>D.user_id===(n==null?void 0:n.id)),P=ir({mutationFn:async()=>{M?await Q.from("newsletter_likes").delete().eq("newsletter_id",e).eq("user_id",n==null?void 0:n.id):await Q.from("newsletter_likes").insert({newsletter_id:e,user_id:n==null?void 0:n.id})},onSuccess:()=>{a.invalidateQueries({queryKey:["newsletter-likes",e]})}}),T=ir({mutationFn:async D=>{const{error:U}=await Q.from("newsletter_comments").insert({newsletter_id:e,user_id:n==null?void 0:n.id,content:D});if(U)throw U},onSuccess:()=>{a.invalidateQueries({queryKey:["newsletter-comments",e]}),i(""),s({title:"Comment added"})}}),I=ir({mutationFn:async D=>{const{error:U}=await Q.from("newsletter_comments").delete().eq("id",D);if(U)throw U},onSuccess:()=>{a.invalidateQueries({queryKey:["newsletter-comments",e]}),s({title:"Comment deleted"})}}),z=D=>{if(D.includes("player.mediadelivery.net")||D.includes("iframe.mediadelivery.net")){const U=D.match(/embed\/(\d+)\/([a-f0-9-]+)/);if(U)return r.jsx("div",{className:"relative w-full pt-[56.25%]",children:r.jsx("iframe",{src:`https://iframe.mediadelivery.net/embed/${U[1]}/${U[2]}?autoplay=false`,className:"absolute inset-0 w-full h-full rounded-lg",allow:"accelerometer; gyroscope; autoplay; encrypted-media; picture-in-picture",allowFullScreen:!0})})}if(D.includes("youtube.com")||D.includes("youtu.be")){const U=D.match(/(?:youtube\.com\/(?:watch\?v=|embed\/)|youtu\.be\/)([^&\s]+)/);if(U)return r.jsx("div",{className:"relative w-full pt-[56.25%]",children:r.jsx("iframe",{src:`https://www.youtube.com/embed/${U[1]}`,className:"absolute inset-0 w-full h-full rounded-lg",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowFullScreen:!0})})}return r.jsxs("a",{href:D,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 text-primary hover:underline",children:[r.jsx(Vl,{className:"h-4 w-4"})," Watch Video"]})};return p?r.jsx(Dr,{title:"",description:"",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Lr,{className:"h-8 w-32"}),r.jsx(Lr,{className:"h-64 w-full"}),r.jsx(Lr,{className:"h-32 w-full"})]})}):u?r.jsx(Dr,{title:"",description:"",children:r.jsxs("div",{className:"max-w-4xl mx-auto space-y-6",children:[r.jsxs(ee,{variant:"ghost",onClick:()=>t("/newsletters"),className:"mb-4",children:[r.jsx(po,{className:"mr-2 h-4 w-4"})," Back to Newsletters"]}),u.preview_image_url&&r.jsx("img",{src:u.preview_image_url,alt:u.title,className:"w-full h-64 md:h-80 object-cover rounded-lg"}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-3xl font-bold",children:u.title}),r.jsx("p",{className:"text-muted-foreground mt-1",children:on(new Date(u.publish_date),"MMMM d, yyyy")})]}),u.description&&r.jsx("div",{className:"text-lg text-muted-foreground prose prose-sm max-w-none dark:prose-invert [&_p]:mb-4 [&_p:last-child]:mb-0 whitespace-pre-line",dangerouslySetInnerHTML:{__html:u.description}}),r.jsx(NCt,{rows:u.content_blocks||[]}),r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx(O3,{resourceType:"newsletter",resourceId:u.id,resourceTitle:u.title}),r.jsxs(ee,{variant:M?"default":"outline",size:"sm",onClick:()=>P.mutate(),children:[r.jsx(xi,{className:`h-4 w-4 mr-1 ${M?"fill-current":""}`}),(S==null?void 0:S.length)||0," ",(S==null?void 0:S.length)===1?"Like":"Likes"]})]}),b&&b.length>0&&r.jsxs(Ze,{children:[r.jsx(Wt,{children:r.jsx(Yt,{className:"text-lg",children:"Canva Templates"})}),r.jsx(et,{className:"space-y-2",children:b.map(D=>r.jsxs("a",{href:D.canva_share_link,target:"_blank",rel:"noopener noreferrer",onClick:()=>o("newsletter",u.id,u.title,"click_canva"),className:"flex items-center gap-3 p-3 rounded-lg hover:bg-muted transition-colors",children:[r.jsx(Uc,{className:"h-5 w-5 text-purple-500"}),r.jsx("span",{className:"font-medium",children:D.title}),r.jsx(As,{className:"h-4 w-4 text-muted-foreground ml-auto"})]},D.id))})]}),x&&x.length>0&&r.jsxs(Ze,{children:[r.jsx(Wt,{children:r.jsx(Yt,{className:"text-lg",children:"Google Drive Files"})}),r.jsx(et,{className:"space-y-2",children:x.map(D=>r.jsxs("a",{href:D.drive_url,target:"_blank",rel:"noopener noreferrer",onClick:()=>o("newsletter",u.id,u.title,"click_link"),className:"flex items-center gap-3 p-3 rounded-lg hover:bg-muted transition-colors",children:[r.jsx(As,{className:"h-5 w-5 text-primary"}),r.jsx("span",{className:"font-medium",children:D.title})]},D.id))})]}),y&&y.length>0&&r.jsxs(Ze,{children:[r.jsx(Wt,{children:r.jsx(Yt,{className:"text-lg",children:"PDF Downloads"})}),r.jsx(et,{className:"space-y-2",children:y.map(D=>r.jsxs("a",{href:D.file_url,target:"_blank",rel:"noopener noreferrer",onClick:()=>o("newsletter",u.id,u.title,"click_pdf"),className:"flex items-center gap-3 p-3 rounded-lg hover:bg-muted transition-colors",children:[r.jsx(Ea,{className:"h-5 w-5 text-red-500"}),r.jsx("span",{className:"font-medium flex-1",children:D.name}),r.jsx(io,{className:"h-4 w-4 text-muted-foreground"})]},D.id))})]}),_&&_.length>0&&r.jsxs(Ze,{children:[r.jsx(Wt,{children:r.jsx(Yt,{className:"text-lg",children:"Videos"})}),r.jsx(et,{className:"space-y-6",children:_.map(D=>r.jsxs("div",{className:"space-y-2",children:[r.jsx("h4",{className:"font-medium",children:D.title}),z(D.video_url)]},D.id))})]}),r.jsxs(Ze,{children:[r.jsx(Wt,{children:r.jsxs(Yt,{className:"text-lg",children:["Comments (",(k==null?void 0:k.length)||0,")"]})}),r.jsxs(et,{className:"space-y-4",children:[r.jsxs("div",{className:"flex gap-3",children:[r.jsx(Jn,{placeholder:"Write a comment...",value:l,onChange:D=>i(D.target.value),className:"flex-1"}),r.jsx(ee,{onClick:()=>l.trim()&&T.mutate(l),disabled:!l.trim()||T.isPending,children:r.jsx(lo,{className:"h-4 w-4"})})]}),r.jsx("div",{className:"space-y-4",children:k==null?void 0:k.map(D=>{var U,V,W;return r.jsxs("div",{className:"flex gap-3",children:[r.jsx(Qs,{className:"h-8 w-8",children:r.jsx(Js,{children:((V=(U=D.profiles)==null?void 0:U.name)==null?void 0:V[0])||"U"})}),r.jsxs("div",{className:"flex-1",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{className:"font-medium text-sm",children:((W=D.profiles)==null?void 0:W.name)||"User"}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"text-xs text-muted-foreground",children:on(new Date(D.created_at),"MMM d, yyyy")}),D.user_id===(n==null?void 0:n.id)&&r.jsx(ee,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>I.mutate(D.id),children:r.jsx(Bn,{className:"h-3 w-3"})})]})]}),r.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:D.content})]})]},D.id)})})]})]})]})}):r.jsx(Dr,{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:()=>t("/newsletters"),children:"Back to Newsletters"})]})})}function CCt({rows:e,onChange:t}){const[n,s]=E.useState(null),a=()=>{t([...e,{columns:[{title:"",description:""},{title:"",description:""},{title:"",description:""}]}])},o=p=>{t(e.filter((x,y)=>y!==p))},l=(p,x,y,_)=>{const b=[...e];b[p]={...b[p],columns:b[p].columns.map((S,k)=>k===x?{...S,[y]:_}:S)},t(b)},i=async(p,x,y)=>{var S;const _=(S=y.target.files)==null?void 0:S[0];if(!_)return;const b=`${p}-${x}`;s(b);try{const k=`content-blocks/${Date.now()}-${_.name}`,{error:M}=await Q.storage.from("newsletter-content").upload(k,_);if(!M){const{data:P}=Q.storage.from("newsletter-content").getPublicUrl(k);l(p,x,"image_url",P.publicUrl)}}finally{s(null)}},u=(p,x)=>{l(p,x,"image_url","")};return r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx($e,{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"]})]}),e.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."}),e.map((p,x)=>r.jsxs(Ze,{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(hs,{className:"h-4 w-4"})}),r.jsxs(et,{className:"p-4 pt-3",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[r.jsx(dy,{className:"h-4 w-4 text-muted-foreground"}),r.jsxs("span",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wider",children:["Row ",x+1]})]}),r.jsx("div",{className:"grid grid-cols-3 gap-3",children:p.columns.map((y,_)=>{const b=`${x}-${_}`;return r.jsxs("div",{className:"space-y-2 border border-border/50 rounded-md p-3 bg-muted/20",children:[r.jsxs("span",{className:"text-xs text-muted-foreground font-medium",children:["Column ",_+1]}),y.image_url?r.jsxs("div",{className:"relative group",children:[r.jsx("img",{src:y.image_url,alt:"",className:"w-full h-20 object-cover rounded"}),r.jsx(ee,{type:"button",variant:"destructive",size:"icon",className:"absolute top-1 right-1 h-5 w-5 opacity-0 group-hover:opacity-100 transition-opacity",onClick:()=>u(x,_),children:r.jsx(hs,{className:"h-3 w-3"})})]}):r.jsxs("div",{children:[r.jsx(dt,{type:"file",accept:"image/*",className:"hidden",id:`block-img-${b}`,onChange:S=>i(x,_,S)}),r.jsx(ee,{type:"button",variant:"outline",size:"sm",className:"w-full text-xs h-8",disabled:n===b,asChild:!0,children:r.jsx("label",{htmlFor:`block-img-${b}`,className:"cursor-pointer",children:n===b?"Uploading...":r.jsxs(r.Fragment,{children:[r.jsx(Rl,{className:"h-3 w-3 mr-1"})," Image"]})})})]}),r.jsx(dt,{placeholder:"Title",value:y.title,onChange:S=>l(x,_,"title",S.target.value),className:"h-8 text-sm"}),r.jsx(Jn,{placeholder:"Description",value:y.description,onChange:S=>l(x,_,"description",S.target.value),className:"text-sm min-h-[60px] resize-none"})]},_)})})]})]},x))]})}function MCt(){const{toast:e}=_i(),t=Hr(),[n,s]=E.useState(!1),[a,o]=E.useState(null),[l,i]=E.useState({title:"",description:"",publish_date:on(new Date,"yyyy-MM-dd'T'HH:mm"),is_published:!1}),[u,p]=E.useState(null),[x,y]=E.useState(null),[_,b]=E.useState([]),[S,k]=E.useState([]),[M,P]=E.useState([]),[T,I]=E.useState([]),[z,D]=E.useState([]),[U,V]=E.useState([]),[W,G]=E.useState(!1),{data:J,isLoading:ne}=Kt({queryKey:["admin-newsletters"],queryFn:async()=>{const{data:Te,error:De}=await Q.from("newsletter_content").select("*").order("publish_date",{ascending:!1});if(De)throw De;return Te}}),oe=ir({mutationFn:async Te=>{const{data:De,error:Ue}=await Q.from("newsletter_content").insert({title:Te.title,description:Te.description||null,preview_image_url:Te.preview_image_url,publish_date:Te.publish_date,is_published:Te.is_published,content_blocks:Te.content_blocks}).select().single();if(Ue)throw Ue;return De},onSuccess:async Te=>{await pe(Te.id),t.invalidateQueries({queryKey:["admin-newsletters"]}),e({title:"Newsletter created successfully"}),he()},onError:Te=>{e({title:"Error creating newsletter",description:Te.message,variant:"destructive"})}}),ge=ir({mutationFn:async Te=>{const{error:De}=await Q.from("newsletter_content").update({title:Te.title,description:Te.description||null,preview_image_url:Te.preview_image_url,publish_date:Te.publish_date,is_published:Te.is_published,content_blocks:Te.content_blocks}).eq("id",Te.id);if(De)throw De;return Te.id},onSuccess:async Te=>{await pe(Te),t.invalidateQueries({queryKey:["admin-newsletters"]}),e({title:"Newsletter updated successfully"}),he()},onError:Te=>{e({title:"Error updating newsletter",description:Te.message,variant:"destructive"})}}),ie=ir({mutationFn:async Te=>{const{error:De}=await Q.from("newsletter_content").delete().eq("id",Te);if(De)throw De},onSuccess:()=>{t.invalidateQueries({queryKey:["admin-newsletters"]}),e({title:"Newsletter deleted successfully"})},onError:Te=>{e({title:"Error deleting newsletter",description:Te.message,variant:"destructive"})}}),pe=async Te=>{await Q.from("newsletter_drive_links").delete().eq("newsletter_id",Te),await Q.from("newsletter_pdfs").delete().eq("newsletter_id",Te),await Q.from("newsletter_videos").delete().eq("newsletter_id",Te),await Q.from("newsletter_canva_links").delete().eq("newsletter_id",Te);for(const De of U){const Ue=`${Te}/${Date.now()}-${De.file.name}`,{error:Be}=await Q.storage.from("newsletter-content").upload(Ue,De.file);if(!Be){const{data:qe}=Q.storage.from("newsletter-content").getPublicUrl(Ue);S.push({name:De.name,file_url:qe.publicUrl,file_size:De.file.size,sort_order:S.length})}}_.length>0&&await Q.from("newsletter_drive_links").insert(_.map((De,Ue)=>({newsletter_id:Te,title:De.title,drive_url:De.drive_url,sort_order:Ue}))),S.length>0&&await Q.from("newsletter_pdfs").insert(S.map((De,Ue)=>({newsletter_id:Te,name:De.name,file_url:De.file_url,file_size:De.file_size||null,sort_order:Ue}))),M.length>0&&await Q.from("newsletter_videos").insert(M.map((De,Ue)=>({newsletter_id:Te,title:De.title,video_url:De.video_url,sort_order:Ue}))),T.length>0&&await Q.from("newsletter_canva_links").insert(T.map((De,Ue)=>({newsletter_id:Te,title:De.title,canva_share_link:De.canva_share_link,sort_order:Ue})))},se=async Te=>{o(Te),i({title:Te.title,description:Te.description||"",publish_date:on(new Date(Te.publish_date),"yyyy-MM-dd'T'HH:mm"),is_published:Te.is_published}),y(Te.preview_image_url),D(Te.content_blocks||[]);const[De,Ue,Be,qe]=await Promise.all([Q.from("newsletter_drive_links").select("*").eq("newsletter_id",Te.id).order("sort_order"),Q.from("newsletter_pdfs").select("*").eq("newsletter_id",Te.id).order("sort_order"),Q.from("newsletter_videos").select("*").eq("newsletter_id",Te.id).order("sort_order"),Q.from("newsletter_canva_links").select("*").eq("newsletter_id",Te.id).order("sort_order")]);b(De.data||[]),k(Ue.data||[]),P(Be.data||[]),I(qe.data||[]),V([]),s(!0)},fe=async Te=>{const[De,Ue,Be,qe]=await Promise.all([Q.from("newsletter_drive_links").select("*").eq("newsletter_id",Te.id).order("sort_order"),Q.from("newsletter_pdfs").select("*").eq("newsletter_id",Te.id).order("sort_order"),Q.from("newsletter_videos").select("*").eq("newsletter_id",Te.id).order("sort_order"),Q.from("newsletter_canva_links").select("*").eq("newsletter_id",Te.id).order("sort_order")]);o(null),i({title:`${Te.title} (Copy)`,description:Te.description||"",publish_date:on(new Date,"yyyy-MM-dd'T'HH:mm"),is_published:!1}),y(Te.preview_image_url),D(Te.content_blocks||[]),b((De.data||[]).map(({id:ot,...Mt})=>Mt)),k((Ue.data||[]).map(({id:ot,...Mt})=>Mt)),P((Be.data||[]).map(({id:ot,...Mt})=>Mt)),I((qe.data||[]).map(({id:ot,...Mt})=>Mt)),V([]),s(!0)},he=()=>{s(!1),o(null),i({title:"",description:"",publish_date:on(new Date,"yyyy-MM-dd'T'HH:mm"),is_published:!1}),p(null),y(null),b([]),k([]),P([]),I([]),D([]),V([])},ye=async Te=>{var Ue;const De=(Ue=Te.target.files)==null?void 0:Ue[0];De&&(p(De),y(URL.createObjectURL(De)))},Ae=async()=>{if(!l.title){e({title:"Title is required",variant:"destructive"});return}G(!0);let Te=x;if(u){const De=`previews/${Date.now()}-${u.name}`,{error:Ue}=await Q.storage.from("newsletter-content").upload(De,u);if(!Ue){const{data:Be}=Q.storage.from("newsletter-content").getPublicUrl(De);Te=Be.publicUrl}}a?ge.mutate({id:a.id,...l,preview_image_url:Te,content_blocks:z}):oe.mutate({...l,preview_image_url:Te,content_blocks:z}),G(!1)},we=()=>b([..._,{title:"",drive_url:"",sort_order:_.length}]),be=()=>P([...M,{title:"",video_url:"",sort_order:M.length}]),_e=()=>I([...T,{title:"",canva_share_link:"",sort_order:T.length}]),Je=Te=>{const De=Te.target.files;if(!De)return;const Ue=Array.from(De).map(Be=>({file:Be,name:Be.name.replace(/\.[^/.]+$/,"")}));V([...U,...Ue])};return r.jsx(Dr,{title:"Newsletter Content",description:"Manage monthly newsletter templates and resources",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Mu,{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(Ze,{children:[r.jsx(Wt,{className:"pb-2",children:r.jsx(Yt,{className:"text-sm font-medium text-muted-foreground",children:"Total"})}),r.jsx(et,{children:r.jsx("div",{className:"text-2xl font-bold",children:(J==null?void 0:J.length)||0})})]}),r.jsxs(Ze,{children:[r.jsx(Wt,{className:"pb-2",children:r.jsx(Yt,{className:"text-sm font-medium text-muted-foreground",children:"Published"})}),r.jsx(et,{children:r.jsx("div",{className:"text-2xl font-bold",children:(J==null?void 0:J.filter(Te=>Te.is_published).length)||0})})]})]}),r.jsxs(Or,{open:n,onOpenChange:Te=>!Te&&he(),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(Ir,{className:"max-w-4xl max-h-[90vh] overflow-y-auto",children:[r.jsx($r,{children:r.jsx(Fr,{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($e,{children:"Title *"}),r.jsx(dt,{value:l.title,onChange:Te=>i({...l,title:Te.target.value}),placeholder:"Newsletter title"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{children:"Publish Date"}),r.jsx(dt,{type:"datetime-local",value:l.publish_date,onChange:Te=>i({...l,publish_date:Te.target.value})})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{children:"Description"}),r.jsx(ax,{content:l.description,onChange:Te=>i({...l,description:Te}),placeholder:"Newsletter description",minHeight:"120px"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{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(hs,{className:"h-3 w-3"})})]}),r.jsxs("div",{children:[r.jsx(dt,{type:"file",accept:"image/*",onChange:ye,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(_o,{className:"mr-2 h-4 w-4"})," Upload Image"]})})]})]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ts,{checked:l.is_published,onCheckedChange:Te=>i({...l,is_published:Te})}),r.jsx($e,{children:"Published"})]}),r.jsx(CCt,{rows:z,onChange:D}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx($e,{className:"text-base font-medium",children:"Canva Links"}),r.jsxs(ee,{type:"button",variant:"outline",size:"sm",onClick:_e,children:[r.jsx(bn,{className:"mr-1 h-3 w-3"})," Add Canva Link"]})]}),T.map((Te,De)=>r.jsxs("div",{className:"flex gap-2 items-center",children:[r.jsx(dt,{placeholder:"Link title",value:Te.title,onChange:Ue=>{const Be=[...T];Be[De].title=Ue.target.value,I(Be)},className:"w-1/3"}),r.jsx(dt,{placeholder:"Canva share link",value:Te.canva_share_link,onChange:Ue=>{const Be=[...T];Be[De].canva_share_link=Ue.target.value,I(Be)},className:"flex-1"}),r.jsx(ee,{type:"button",variant:"ghost",size:"icon",onClick:()=>I(T.filter((Ue,Be)=>Be!==De)),children:r.jsx(hs,{className:"h-4 w-4"})})]},De))]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx($e,{className:"text-base font-medium",children:"Google Drive Links"}),r.jsxs(ee,{type:"button",variant:"outline",size:"sm",onClick:we,children:[r.jsx(bn,{className:"mr-1 h-3 w-3"})," Add Link"]})]}),_.map((Te,De)=>r.jsxs("div",{className:"flex gap-2 items-center",children:[r.jsx(dt,{placeholder:"Link title",value:Te.title,onChange:Ue=>{const Be=[..._];Be[De].title=Ue.target.value,b(Be)},className:"w-1/3"}),r.jsx(dt,{placeholder:"Google Drive URL",value:Te.drive_url,onChange:Ue=>{const Be=[..._];Be[De].drive_url=Ue.target.value,b(Be)},className:"flex-1"}),r.jsx(ee,{type:"button",variant:"ghost",size:"icon",onClick:()=>b(_.filter((Ue,Be)=>Be!==De)),children:r.jsx(hs,{className:"h-4 w-4"})})]},De))]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx($e,{className:"text-base font-medium",children:"PDF Files"}),r.jsxs("div",{children:[r.jsx(dt,{type:"file",accept:".pdf",multiple:!0,onChange:Je,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(_o,{className:"mr-1 h-3 w-3"})," Upload PDF"]})})]})]}),S.map((Te,De)=>r.jsxs("div",{className:"flex gap-2 items-center bg-muted/50 p-2 rounded",children:[r.jsx(Ea,{className:"h-4 w-4 text-muted-foreground"}),r.jsx("span",{className:"flex-1 text-sm",children:Te.name}),r.jsx(ee,{type:"button",variant:"ghost",size:"icon",onClick:()=>k(S.filter((Ue,Be)=>Be!==De)),children:r.jsx(hs,{className:"h-4 w-4"})})]},`existing-${De}`)),U.map((Te,De)=>r.jsxs("div",{className:"flex gap-2 items-center bg-muted/50 p-2 rounded",children:[r.jsx(Ea,{className:"h-4 w-4 text-muted-foreground"}),r.jsx(dt,{value:Te.name,onChange:Ue=>{const Be=[...U];Be[De].name=Ue.target.value,V(Be)},className:"flex-1 h-8",placeholder:"PDF name"}),r.jsx("span",{className:"text-xs text-muted-foreground",children:"(new)"}),r.jsx(ee,{type:"button",variant:"ghost",size:"icon",onClick:()=>V(U.filter((Ue,Be)=>Be!==De)),children:r.jsx(hs,{className:"h-4 w-4"})})]},`pending-${De}`))]}),r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx($e,{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"]})]}),M.map((Te,De)=>r.jsxs("div",{className:"flex gap-2 items-center",children:[r.jsx(dt,{placeholder:"Video title",value:Te.title,onChange:Ue=>{const Be=[...M];Be[De].title=Ue.target.value,P(Be)},className:"w-1/3"}),r.jsx(dt,{placeholder:"Video URL",value:Te.video_url,onChange:Ue=>{const Be=[...M];Be[De].video_url=Ue.target.value,P(Be)},className:"flex-1"}),r.jsx(ee,{type:"button",variant:"ghost",size:"icon",onClick:()=>P(M.filter((Ue,Be)=>Be!==De)),children:r.jsx(hs,{className:"h-4 w-4"})})]},De))]}),r.jsxs("div",{className:"flex justify-end gap-2 pt-4 border-t",children:[r.jsx(ee,{variant:"outline",onClick:he,children:"Cancel"}),r.jsx(ee,{onClick:Ae,disabled:W||oe.isPending||ge.isPending,children:W?"Uploading...":a?"Update":"Create"})]})]})]})]})]}),r.jsx(Ze,{children:r.jsx(et,{className:"p-0",children:r.jsxs(Ks,{children:[r.jsx(Zs,{children:r.jsxs(Mr,{children:[r.jsx(It,{children:"Name"}),r.jsx(It,{children:"Publish Date"}),r.jsx(It,{children:"Status"}),r.jsx(It,{className:"text-right",children:"Actions"})]})}),r.jsx(Ys,{children:ne?r.jsx(Mr,{children:r.jsx(kt,{colSpan:4,className:"text-center py-8",children:"Loading..."})}):(J==null?void 0:J.length)===0?r.jsx(Mr,{children:r.jsx(kt,{colSpan:4,className:"text-center py-8 text-muted-foreground",children:"No newsletters yet. Create your first one!"})}):J==null?void 0:J.map(Te=>r.jsxs(Mr,{children:[r.jsx(kt,{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(Ea,{className:"h-5 w-5 text-muted-foreground"})}),r.jsxs("div",{children:[r.jsx("div",{className:"font-medium",children:Te.title}),Te.description&&r.jsx("div",{className:"text-sm text-muted-foreground line-clamp-1",children:Te.description.replace(/<[^>]*>/g,"")})]})]})}),r.jsx(kt,{children:on(new Date(Te.publish_date),"MMM d, yyyy")}),r.jsx(kt,{children:r.jsx("span",{className:`inline-flex items-center px-2 py-1 rounded-full text-xs font-medium ${Te.is_published?"bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-400":"bg-yellow-100 text-yellow-800 dark:bg-yellow-900/30 dark:text-yellow-400"}`,children:Te.is_published?"Published":"Draft"})}),r.jsx(kt,{className:"text-right",children:r.jsxs("div",{className:"flex justify-end gap-1",children:[r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>se(Te),title:"Edit",children:r.jsx(ni,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>fe(Te),title:"Duplicate",children:r.jsx(Wo,{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?")&&ie.mutate(Te.id)},children:r.jsx(Bn,{className:"h-4 w-4"})})]})})]},Te.id))})]})})})]})})}const dCe={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 TCt(){const{user:e}=tn(),{toast:t}=_i(),n=Gn(),s=Hr(),[a,o]=E.useState(""),[l,i]=E.useState("popular"),[u,p]=E.useState(!1),[x,y]=E.useState(""),[_,b]=E.useState(""),[S,k]=E.useState(!1),{data:M=[],isLoading:P}=Kt({queryKey:["wishlist-items",l,S],queryFn:async()=>{let U=Q.from("wishlist_items").select("*");S&&e&&(U=U.eq("user_id",e.id)),l==="latest"?U=U.order("created_at",{ascending:!1}):l==="popular"?U=U.order("vote_count",{ascending:!1}):l==="trending"&&(U=U.order("vote_count",{ascending:!1}));const{data:V,error:W}=await U;if(W)throw W;const G=[...new Set((V==null?void 0:V.map(se=>se.user_id))||[])],{data:J}=await Q.from("profiles").select("id, name").in("id",G),ne=new Map((J==null?void 0:J.map(se=>[se.id,se]))||[]);let oe=[];if(e){const{data:se}=await Q.from("wishlist_votes").select("item_id").eq("user_id",e.id);oe=(se==null?void 0:se.map(fe=>fe.item_id))||[]}const ge=(V==null?void 0:V.map(se=>se.id))||[],{data:ie}=await Q.from("wishlist_comments").select("item_id").in("item_id",ge),pe=new Map;return ie==null||ie.forEach(se=>{pe.set(se.item_id,(pe.get(se.item_id)||0)+1)}),V==null?void 0:V.map(se=>{const fe=ne.get(se.user_id),he=(fe==null?void 0:fe.name)||"Unknown";return{...se,user_name:he,user_initials:he.split(" ").map(ye=>ye[0]).join("").toUpperCase().slice(0,2),has_voted:oe.includes(se.id),comment_count:pe.get(se.id)||0}})}}),T=ir({mutationFn:async({title:U,description:V})=>{const{error:W}=await Q.from("wishlist_items").insert({user_id:e.id,title:U,description:V});if(W)throw W},onSuccess:()=>{s.invalidateQueries({queryKey:["wishlist-items"]}),p(!1),y(""),b(""),t({title:"Idea submitted!",description:"Your idea has been added to the wishlist."})},onError:U=>{t({title:"Error",description:U.message,variant:"destructive"})}}),I=ir({mutationFn:async({itemId:U,hasVoted:V})=>{if(V){const{error:W}=await Q.from("wishlist_votes").delete().eq("item_id",U).eq("user_id",e.id);if(W)throw W;return{itemId:U,wasAdded:!1}}else{const{error:W}=await Q.from("wishlist_votes").insert({item_id:U,user_id:e.id});if(W)throw W;return{itemId:U,wasAdded:!0}}},onSuccess:async U=>{if(s.invalidateQueries({queryKey:["wishlist-items"]}),U!=null&&U.wasAdded){const V=M.find(G=>G.id===U.itemId),W=((V==null?void 0:V.vote_count)||0)+1;Q.functions.invoke("wishlist-notify",{body:{itemId:U.itemId,voteCount:W}}).catch(console.error)}},onError:U=>{t({title:"Error",description:U.message,variant:"destructive"})}}),z=M.filter(U=>U.title.toLowerCase().includes(a.toLowerCase())||U.description.toLowerCase().includes(a.toLowerCase())),D=()=>{if(!x.trim()||!_.trim()){t({title:"Error",description:"Please fill in both title and description.",variant:"destructive"});return}T.mutate({title:x.trim(),description:_.trim()})};return r.jsx(Dr,{title:"Wishlist",children:r.jsxs("div",{className:"max-w-4xl mx-auto",children:[r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center justify-between gap-4 mb-6",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"p-2 bg-primary/10 rounded-lg",children:r.jsx(W1,{className:"h-6 w-6 text-primary"})}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-5xl font-bold",children:"Wishlist"}),r.jsx("p",{className:"text-muted-foreground text-sm",children:"Share ideas and vote on what we build next"})]})]}),r.jsxs(Or,{open:u,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(Ir,{children:[r.jsx($r,{children:r.jsx(Fr,{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($e,{htmlFor:"title",children:"Title"}),r.jsx(dt,{id:"title",placeholder:"Give your idea a clear title...",value:x,onChange:U=>y(U.target.value)})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{htmlFor:"description",children:"Description"}),r.jsx(Jn,{id:"description",placeholder:"Describe your idea in detail. What problem does it solve? How would it help agents?",value:_,onChange:U=>b(U.target.value),rows:4})]}),r.jsx(ee,{onClick:D,className:"w-full",disabled:T.isPending,children:T.isPending?r.jsxs(r.Fragment,{children:[r.jsx(Zr,{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(Sa,{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:U=>o(U.target.value),className:"pl-10"})]}),r.jsx("div",{className:"flex gap-2",children:r.jsx(Ai,{value:l,onValueChange:U=>i(U),children:r.jsxs(vi,{children:[r.jsx(sn,{value:"popular",children:"Most Popular"}),r.jsx(sn,{value:"latest",children:"Latest"}),r.jsx(sn,{value:"trending",children:"Trending"})]})})})]}),r.jsx("div",{className:"flex items-center gap-2 mb-4",children:r.jsx(ee,{variant:S?"default":"outline",size:"sm",onClick:()=>k(!S),children:S?"Show All Ideas":"My Ideas"})}),P?r.jsx("div",{className:"flex items-center justify-center py-12",children:r.jsx(Zr,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):z.length===0?r.jsxs("div",{className:"text-center py-12 bg-muted/30 rounded-lg",children:[r.jsx(W1,{className:"h-12 w-12 text-muted-foreground mx-auto mb-4"}),r.jsx("h3",{className:"text-lg font-medium mb-2",children:"No ideas yet"}),r.jsx("p",{className:"text-muted-foreground mb-4",children:"Be the first to submit an idea!"}),r.jsxs(ee,{onClick:()=>p(!0),children:[r.jsx(bn,{className:"h-4 w-4 mr-2"}),"Add Idea"]})]}):r.jsx("div",{className:"space-y-3",children:z.map(U=>r.jsx("div",{className:"bg-card border rounded-lg p-4 hover:shadow-md transition-shadow cursor-pointer",onClick:()=>n(`/wishlist/${U.id}`),children:r.jsxs("div",{className:"flex items-start gap-4",children:[r.jsxs("button",{onClick:V=>{V.stopPropagation(),I.mutate({itemId:U.id,hasVoted:U.has_voted||!1})},className:Bt("flex flex-col items-center justify-center min-w-[50px] py-2 px-3 rounded-lg border transition-colors",U.has_voted?"bg-primary/10 border-primary text-primary":"bg-muted/50 border-border hover:bg-muted"),children:[r.jsx(cp,{className:Bt("h-4 w-4",U.has_voted&&"fill-current")}),r.jsx("span",{className:"text-sm font-semibold",children:U.vote_count})]}),r.jsx(Qs,{className:"h-10 w-10 bg-primary/20",children:r.jsx(Js,{className:"bg-primary/20 text-primary text-sm font-medium",children:U.user_initials})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[r.jsx("h3",{className:"font-semibold text-foreground",children:U.title}),r.jsx(Pt,{className:Bt("text-xs",dCe[U.status].color),children:dCe[U.status].label})]}),r.jsx("p",{className:"text-muted-foreground text-sm line-clamp-2",children:U.description}),r.jsxs("div",{className:"flex items-center gap-3 mt-2 text-xs text-muted-foreground",children:[r.jsx("span",{children:U.user_name}),r.jsx("span",{children:"•"}),r.jsx("span",{children:new Date(U.created_at).toLocaleDateString()})]})]}),r.jsxs("div",{className:"flex items-center gap-1 text-muted-foreground",children:[r.jsx(zo,{className:"h-4 w-4"}),r.jsx("span",{className:"text-sm",children:U.comment_count})]})]})},U.id))})]})})}const uCe={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 ACt(){const{itemId:e}=md(),t=Gn(),{user:n}=tn(),{toast:s}=_i(),a=Hr(),[o,l]=E.useState(""),{data:i=!1}=Kt({queryKey:["user-is-admin",n==null?void 0:n.id],queryFn:async()=>{if(!n)return!1;const{data:M,error:P}=await Q.from("user_roles").select("role").eq("user_id",n.id).eq("role","admin").maybeSingle();return!P&&!!M},enabled:!!n}),{data:u,isLoading:p}=Kt({queryKey:["wishlist-item",e],queryFn:async()=>{const{data:M,error:P}=await Q.from("wishlist_items").select("*").eq("id",e).single();if(P)throw P;const{data:T}=await Q.from("profiles").select("name").eq("id",M.user_id).single();let I=!1;if(n){const{data:z}=await Q.from("wishlist_votes").select("id").eq("item_id",e).eq("user_id",n.id).maybeSingle();I=!!z}return{...M,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:I}}}),{data:x=[],isLoading:y}=Kt({queryKey:["wishlist-comments",e],queryFn:async()=>{const{data:M,error:P}=await Q.from("wishlist_comments").select("*").eq("item_id",e).order("created_at",{ascending:!0});if(P)throw P;const T=[...new Set((M==null?void 0:M.map(D=>D.user_id))||[])],{data:I}=await Q.from("profiles").select("id, name").in("id",T),z=new Map((I==null?void 0:I.map(D=>[D.id,D]))||[]);return M==null?void 0:M.map(D=>{const U=z.get(D.user_id),V=(U==null?void 0:U.name)||"Unknown";return{...D,user_name:V,user_initials:V.split(" ").map(W=>W[0]).join("").toUpperCase().slice(0,2)}})}}),_=ir({mutationFn:async M=>{if(M){const{error:P}=await Q.from("wishlist_votes").delete().eq("item_id",e).eq("user_id",n.id);if(P)throw P;return{wasAdded:!1}}else{const{error:P}=await Q.from("wishlist_votes").insert({item_id:e,user_id:n.id});if(P)throw P;return{wasAdded:!0}}},onSuccess:async M=>{if(a.invalidateQueries({queryKey:["wishlist-item",e]}),a.invalidateQueries({queryKey:["wishlist-items"]}),M!=null&&M.wasAdded&&u){const P=(u.vote_count||0)+1;Q.functions.invoke("wishlist-notify",{body:{itemId:e,voteCount:P}}).catch(console.error)}},onError:M=>{s({title:"Error",description:M.message,variant:"destructive"})}}),b=ir({mutationFn:async M=>{const{error:P}=await Q.from("wishlist_comments").insert({item_id:e,user_id:n.id,content:M});if(P)throw P},onSuccess:()=>{a.invalidateQueries({queryKey:["wishlist-comments",e]}),l(""),s({title:"Comment added!"})},onError:M=>{s({title:"Error",description:M.message,variant:"destructive"})}}),S=ir({mutationFn:async M=>{const{error:P}=await Q.from("wishlist_comments").delete().eq("id",M);if(P)throw P},onSuccess:()=>{a.invalidateQueries({queryKey:["wishlist-comments",e]}),s({title:"Comment deleted"})},onError:M=>{s({title:"Error",description:M.message,variant:"destructive"})}}),k=()=>{o.trim()&&b.mutate(o.trim())};return p?r.jsx(Dr,{title:"Wishlist",children:r.jsxs("div",{className:"max-w-3xl mx-auto",children:[r.jsx(Lr,{className:"h-8 w-32 mb-6"}),r.jsx(Lr,{className:"h-48 w-full mb-6"}),r.jsx(Lr,{className:"h-32 w-full"})]})}):u?r.jsx(Dr,{title:"Wishlist",children:r.jsxs("div",{className:"max-w-3xl mx-auto",children:[r.jsxs(ee,{variant:"ghost",size:"sm",onClick:()=>t("/wishlist"),className:"mb-4",children:[r.jsx(po,{className:"h-4 w-4 mr-2"}),"Back to Wishlist"]}),r.jsx("div",{className:"bg-card border rounded-lg p-6 mb-6",children:r.jsxs("div",{className:"flex items-start gap-4",children:[r.jsxs("button",{onClick:()=>_.mutate(u.has_voted),className:Bt("flex flex-col items-center justify-center min-w-[60px] py-3 px-4 rounded-lg border transition-colors",u.has_voted?"bg-primary/10 border-primary text-primary":"bg-muted/50 border-border hover:bg-muted"),children:[r.jsx(cp,{className:Bt("h-5 w-5",u.has_voted&&"fill-current")}),r.jsx("span",{className:"text-lg font-bold",children:u.vote_count}),r.jsx("span",{className:"text-xs",children:"votes"})]}),r.jsxs("div",{className:"flex-1",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[r.jsx("h1",{className:"text-xl font-bold",children:u.title}),r.jsx(Pt,{className:Bt("text-xs",uCe[u.status].color),children:uCe[u.status].label})]}),r.jsx("p",{className:"text-muted-foreground whitespace-pre-wrap mb-4",children:u.description}),r.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[r.jsx(Qs,{className:"h-6 w-6",children:r.jsx(Js,{className:"bg-primary/20 text-primary text-xs",children:u.user_initials})}),r.jsx("span",{children:u.user_name}),r.jsx("span",{children:"•"}),r.jsx("span",{children:new Date(u.created_at).toLocaleDateString()})]})]})]})}),r.jsxs("div",{className:"bg-card border rounded-lg p-6",children:[r.jsxs("h2",{className:"text-lg font-semibold mb-4",children:["Comments (",x.length,")"]}),r.jsxs("div",{className:"flex gap-3 mb-6",children:[r.jsx(Zre,{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:k,disabled:!o.trim()||b.isPending,size:"icon",className:"h-auto",children:b.isPending?r.jsx(Zr,{className:"h-4 w-4 animate-spin"}):r.jsx(lo,{className:"h-4 w-4"})})]}),y?r.jsx("div",{className:"space-y-4",children:[1,2].map(M=>r.jsx(Lr,{className:"h-20 w-full"},M))}):x.length===0?r.jsx("p",{className:"text-center text-muted-foreground py-8",children:"No comments yet. Be the first to share your thoughts!"}):r.jsx("div",{className:"space-y-4",children:x.map(M=>r.jsxs("div",{className:"flex gap-3 p-3 bg-muted/30 rounded-lg",children:[r.jsx(Qs,{className:"h-8 w-8",children:r.jsx(Js,{className:"bg-primary/20 text-primary text-xs",children:M.user_initials})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[r.jsx("span",{className:"font-medium text-sm",children:M.user_name}),r.jsx("span",{className:"text-xs text-muted-foreground",children:new Date(M.created_at).toLocaleDateString()})]}),r.jsx(F0e,{content:M.content,className:"text-sm text-foreground"})]}),(n==null?void 0:n.id)===M.user_id&&r.jsx(ee,{variant:"ghost",size:"icon",className:"h-8 w-8 text-muted-foreground hover:text-destructive",onClick:()=>S.mutate(M.id),children:r.jsx(Bn,{className:"h-4 w-4"})})]},M.id))})]})]})}):r.jsx(Dr,{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:()=>t("/wishlist"),children:"Go back to Wishlist"})]})})}const hCe={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"}},fCe=["open","under_review","planned","in_progress","launched","declined"];function ECt(){const{toast:e}=_i(),t=Gn(),n=Hr(),[s,a]=E.useState(""),[o,l]=E.useState("all"),[i,u]=E.useState(!1),[p,x]=E.useState(null),{data:y=[],isLoading:_}=Kt({queryKey:["admin-wishlist-items"],queryFn:async()=>{const{data:P,error:T}=await Q.from("wishlist_items").select("*").order("vote_count",{ascending:!1});if(T)throw T;const I=[...new Set((P==null?void 0:P.map(G=>G.user_id))||[])],{data:z}=await Q.from("profiles").select("id, name, email").in("id",I),D=new Map((z==null?void 0:z.map(G=>[G.id,G]))||[]),U=(P==null?void 0:P.map(G=>G.id))||[],{data:V}=await Q.from("wishlist_comments").select("item_id").in("item_id",U),W=new Map;return V==null||V.forEach(G=>{W.set(G.item_id,(W.get(G.item_id)||0)+1)}),P==null?void 0:P.map(G=>{const J=D.get(G.user_id);return{...G,user_name:(J==null?void 0:J.name)||"Unknown",user_email:(J==null?void 0:J.email)||"",comment_count:W.get(G.id)||0}})}}),b=ir({mutationFn:async({itemId:P,status:T})=>{const{error:I}=await Q.from("wishlist_items").update({status:T}).eq("id",P);if(I)throw I},onSuccess:()=>{n.invalidateQueries({queryKey:["admin-wishlist-items"]}),e({title:"Status updated!"})},onError:P=>{e({title:"Error",description:P.message,variant:"destructive"})}}),S=ir({mutationFn:async P=>{const{error:T}=await Q.from("wishlist_items").delete().eq("id",P);if(T)throw T},onSuccess:()=>{n.invalidateQueries({queryKey:["admin-wishlist-items"]}),u(!1),x(null),e({title:"Item deleted!"})},onError:P=>{e({title:"Error",description:P.message,variant:"destructive"})}}),k=y.filter(P=>{const T=P.title.toLowerCase().includes(s.toLowerCase())||P.description.toLowerCase().includes(s.toLowerCase())||P.user_name.toLowerCase().includes(s.toLowerCase()),I=o==="all"||P.status===o;return T&&I}),M={total:y.length,open:y.filter(P=>P.status==="open").length,inProgress:y.filter(P=>P.status==="in_progress").length,launched:y.filter(P=>P.status==="launched").length,highVotes:y.filter(P=>P.vote_count>=10).length};return r.jsx(Dr,{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:()=>t("/admin"),children:r.jsx(po,{className:"h-5 w-5"})}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold",children:"Wishlist Management"}),r.jsx("p",{className:"text-muted-foreground",children:"Review and manage community ideas"})]})]}),r.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-5 gap-4",children:[r.jsxs("div",{className:"bg-card border rounded-lg p-4",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Total Ideas"}),r.jsx("p",{className:"text-2xl font-bold",children:M.total})]}),r.jsxs("div",{className:"bg-card border rounded-lg p-4",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Open"}),r.jsx("p",{className:"text-2xl font-bold text-blue-600",children:M.open})]}),r.jsxs("div",{className:"bg-card border rounded-lg p-4",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"In Progress"}),r.jsx("p",{className:"text-2xl font-bold text-orange-600",children:M.inProgress})]}),r.jsxs("div",{className:"bg-card border rounded-lg p-4",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Launched"}),r.jsx("p",{className:"text-2xl font-bold text-green-600",children:M.launched})]}),r.jsxs("div",{className:"bg-card border rounded-lg p-4",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"10+ Votes"}),r.jsx("p",{className:"text-2xl font-bold text-primary",children:M.highVotes})]})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[r.jsxs("div",{className:"relative flex-1",children:[r.jsx(Sa,{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:P=>a(P.target.value),className:"pl-10"})]}),r.jsxs(mn,{value:o,onValueChange:P=>l(P),children:[r.jsx(fn,{className:"w-[180px]",children:r.jsx(yn,{placeholder:"Filter by status"})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"all",children:"All Statuses"}),fCe.map(P=>r.jsx(qt,{value:P,children:hCe[P].label},P))]})]})]}),_?r.jsx("div",{className:"space-y-2",children:[1,2,3,4,5].map(P=>r.jsx(Lr,{className:"h-16 w-full"},P))}):r.jsx("div",{className:"bg-card border rounded-lg overflow-hidden",children:r.jsxs(Ks,{children:[r.jsx(Zs,{children:r.jsxs(Mr,{children:[r.jsx(It,{className:"w-[60px]",children:"Votes"}),r.jsx(It,{children:"Title"}),r.jsx(It,{className:"hidden md:table-cell",children:"Submitted By"}),r.jsx(It,{className:"hidden sm:table-cell",children:"Comments"}),r.jsx(It,{children:"Status"}),r.jsx(It,{className:"w-[100px]",children:"Actions"})]})}),r.jsx(Ys,{children:k.length===0?r.jsx(Mr,{children:r.jsx(kt,{colSpan:6,className:"text-center py-8 text-muted-foreground",children:"No items found"})}):k.map(P=>r.jsxs(Mr,{className:Bt(P.vote_count>=10&&"bg-primary/5"),children:[r.jsx(kt,{children:r.jsx(Pt,{variant:P.vote_count>=10?"default":"secondary",children:P.vote_count})}),r.jsx(kt,{children:r.jsxs("div",{children:[r.jsx("p",{className:"font-medium line-clamp-1",children:P.title}),r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-1",children:P.description})]})}),r.jsx(kt,{className:"hidden md:table-cell",children:r.jsxs("div",{children:[r.jsx("p",{className:"text-sm",children:P.user_name}),r.jsx("p",{className:"text-xs text-muted-foreground",children:P.user_email})]})}),r.jsx(kt,{className:"hidden sm:table-cell",children:P.comment_count}),r.jsx(kt,{children:r.jsxs(mn,{value:P.status,onValueChange:T=>b.mutate({itemId:P.id,status:T}),children:[r.jsx(fn,{className:"w-[140px] h-8",children:r.jsx(yn,{})}),r.jsx(pn,{children:fCe.map(T=>r.jsx(qt,{value:T,children:hCe[T].label},T))})]})}),r.jsx(kt,{children:r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>window.open(`/wishlist/${P.id}`,"_blank"),children:r.jsx(As,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"icon",className:"text-destructive",onClick:()=>{x(P.id),u(!0)},children:r.jsx(Bn,{className:"h-4 w-4"})})]})})]},P.id))})]})}),r.jsx(Or,{open:i,onOpenChange:u,children:r.jsxs(Ir,{children:[r.jsx($r,{children:r.jsx(Fr,{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:()=>u(!1),children:"Cancel"}),r.jsx(ee,{variant:"destructive",onClick:()=>p&&S.mutate(p),disabled:S.isPending,children:S.isPending?r.jsxs(r.Fragment,{children:[r.jsx(Zr,{className:"h-4 w-4 mr-2 animate-spin"}),"Deleting..."]}):"Delete"})]})]})})]})})}function ICt(){const{user:e}=tn(),[t,n]=E.useState([]),[s,a]=E.useState(!0),[o,l]=E.useState(!1),[i,u]=E.useState(null),[p,x]=E.useState(!1),[y,_]=E.useState(null),[b,S]=E.useState(""),[k,M]=E.useState(""),[P,T]=E.useState(""),[I,z]=E.useState(""),[D,U]=E.useState(""),[V,W]=E.useState(!1),[G,J]=E.useState(""),[ne,oe]=E.useState("once"),[ge,ie]=E.useState([]),[pe,se]=E.useState([]),[fe,he]=E.useState(!1),[ye,Ae]=E.useState(!1),[we,be]=E.useState([]),[_e,Je]=E.useState({total:0,dismissed:0});E.useEffect(()=>{Te()},[]);const Te=async()=>{const{data:Ee,error:He}=await Q.from("levelup_briefs").select("*").order("created_at",{ascending:!1});He?(Ie.error("Failed to fetch briefs"),console.error(He)):n(Ee||[]),a(!1)},De=()=>{S(""),M(""),T(""),z(""),U(""),W(!1),J(new Date().toISOString().slice(0,16)),oe("once"),ie([]),se([]),u(null)},Ue=()=>{De(),l(!0)},Be=async Ee=>{u(Ee),S(Ee.title),M(Ee.description||""),T(Ee.video_url||""),z(Ee.graphic_url||""),U(Ee.graphic_link_url||""),W(Ee.is_published),J(Ee.publish_date.slice(0,16)),oe(Ee.show_frequency);const{data:He}=await Q.from("levelup_brief_links").select("*").eq("brief_id",Ee.id).order("sort_order");ie((He==null?void 0:He.map(yt=>({title:yt.title,url:yt.url})))||[]);const{data:nt}=await Q.from("levelup_brief_polls").select("*").eq("brief_id",Ee.id).order("sort_order");if(nt){const yt=[];for(const it of nt){const{data:zt}=await Q.from("levelup_brief_poll_options").select("*").eq("poll_id",it.id).order("sort_order");yt.push({question:it.question,poll_type:it.poll_type,options:(zt==null?void 0:zt.map(dr=>dr.option_text))||[]})}se(yt)}l(!0)},qe=async Ee=>{var nt;const He=(nt=Ee.target.files)==null?void 0:nt[0];if(He){he(!0);try{const yt=await Q.functions.invoke("bunny-upload",{body:{action:"create",title:He.name.replace(/\.[^/.]+$/,"")}});if(yt.error)throw yt.error;const{videoId:it,libraryId:zt}=yt.data,dr=await Q.functions.invoke("bunny-upload",{body:{action:"upload-url",videoId:it}});if(dr.error)throw dr.error;const{uploadUrl:Rr,apiKey:Gr}=dr.data,Ur=new XMLHttpRequest;await new Promise((_s,ur)=>{Ur.upload.addEventListener("progress",Rn=>{if(Rn.lengthComputable){const ea=Math.round(Rn.loaded/Rn.total*100);console.log("Upload progress:",ea)}}),Ur.addEventListener("load",()=>{Ur.status>=200&&Ur.status<300?_s():ur(new Error(`Upload failed with status ${Ur.status}`))}),Ur.addEventListener("error",()=>ur(new Error("Upload failed"))),Ur.open("PUT",Rr),Ur.setRequestHeader("AccessKey",Gr),Ur.send(He)});const kn=`https://player.mediadelivery.net/embed/${zt}/${it}`;T(kn),Ie.success("Video uploaded successfully! It may take a few minutes to process.")}catch(yt){console.error("Upload error:",yt),Ie.error("Failed to upload video")}finally{he(!1)}}},ot=async()=>{if(!b.trim()){Ie.error("Title is required");return}try{let Ee;if(i){const{error:He}=await Q.from("levelup_briefs").update({title:b,description:k||null,video_url:P||null,graphic_url:I||null,graphic_link_url:D||null,is_published:V,publish_date:G,show_frequency:ne}).eq("id",i.id);if(He)throw He;Ee=i.id,await Q.from("levelup_brief_links").delete().eq("brief_id",Ee);const{data:nt}=await Q.from("levelup_brief_polls").select("id").eq("brief_id",Ee);if(nt)for(const yt of nt)await Q.from("levelup_brief_poll_options").delete().eq("poll_id",yt.id);await Q.from("levelup_brief_polls").delete().eq("brief_id",Ee)}else{const{data:He,error:nt}=await Q.from("levelup_briefs").insert({title:b,description:k||null,video_url:P||null,graphic_url:I||null,graphic_link_url:D||null,is_published:V,publish_date:G,show_frequency:ne,created_by:e==null?void 0:e.id}).select().single();if(nt)throw nt;Ee=He.id}if(ge.length>0){const He=ge.map((nt,yt)=>({brief_id:Ee,title:nt.title,url:nt.url,sort_order:yt}));await Q.from("levelup_brief_links").insert(He)}for(let He=0;He0){const zt=nt.options.map((dr,Rr)=>({poll_id:yt.id,option_text:dr,sort_order:Rr}));await Q.from("levelup_brief_poll_options").insert(zt)}}Ie.success(i?"Brief updated":"Brief created"),l(!1),De(),Te()}catch(Ee){console.error("Error saving brief:",Ee),Ie.error("Failed to save brief")}},Mt=async Ee=>{if(confirm("Are you sure you want to delete this brief?"))try{const{error:He}=await Q.from("levelup_briefs").delete().eq("id",Ee);if(He)throw He;Ie.success("Brief deleted"),Te()}catch(He){console.error("Error deleting brief:",He),Ie.error("Failed to delete brief")}},Oe=async Ee=>{_(Ee);const{count:He}=await Q.from("levelup_brief_views").select("*",{count:"exact",head:!0}).eq("brief_id",Ee.id),{count:nt}=await Q.from("levelup_brief_views").select("*",{count:"exact",head:!0}).eq("brief_id",Ee.id).not("dismissed_at","is",null);Je({total:He||0,dismissed:nt||0});const{data:yt}=await Q.from("levelup_brief_polls").select("*").eq("brief_id",Ee.id).order("sort_order");if(yt){const it=[];for(const zt of yt){const{data:dr}=await Q.from("levelup_brief_poll_options").select("*").eq("poll_id",zt.id).order("sort_order"),{data:Rr}=await Q.from("levelup_brief_poll_responses").select("option_id, user_id").eq("poll_id",zt.id),Gr=[...new Set((Rr==null?void 0:Rr.map(Rn=>Rn.user_id))||[])];let Ur={};if(Gr.length>0){const{data:Rn}=await Q.from("profiles").select("id, name, email").in("id",Gr);Rn&&Rn.forEach(ea=>{Ur[ea.id]=ea.name||ea.email||"Unknown"})}const kn=(Rr||[]).map(Rn=>({optionId:Rn.option_id,userName:Ur[Rn.user_id]||"Unknown",userId:Rn.user_id})),_s={};let ur=0;dr&&dr.forEach(Rn=>{const ea=(Rr==null?void 0:Rr.filter(ca=>ca.option_id===Rn.id).length)||0;_s[Rn.id]=ea,ur+=ea}),it.push({...zt,options:dr||[],results:_s,respondents:kn,totalResponses:zt.poll_type==="single"?new Set(Rr==null?void 0:Rr.map(Rn=>Rn.user_id)).size:ur})}be(it)}x(!0)},at=()=>{ie([...ge,{title:"",url:""}])},le=(Ee,He,nt)=>{const yt=[...ge];yt[Ee][He]=nt,ie(yt)},Ve=Ee=>{ie(ge.filter((He,nt)=>nt!==Ee))},Qe=()=>{se([...pe,{question:"",poll_type:"single",options:["",""]}])},st=(Ee,He)=>{const nt=[...pe];nt[Ee].question=He,se(nt)},ke=(Ee,He)=>{const nt=[...pe];nt[Ee].poll_type=He,se(nt)},ct=Ee=>{const He=[...pe];He[Ee].options.push(""),se(He)},Ce=(Ee,He,nt)=>{const yt=[...pe];yt[Ee].options[He]=nt,se(yt)},Me=(Ee,He)=>{const nt=[...pe];nt[Ee].options=nt[Ee].options.filter((yt,it)=>it!==He),se(nt)},Ge=Ee=>{se(pe.filter((He,nt)=>nt!==Ee))};return r.jsxs(Dr,{title:"The LevelUp Brief",children:[r.jsxs("div",{className:"space-y-6",children:[r.jsx(Mu,{title:"The LevelUp Brief",description:"Create engaging popup briefs for your agents",children:r.jsxs(ee,{onClick:Ue,children:[r.jsx(bn,{className:"h-4 w-4 mr-2"}),"Create Brief"]})}),r.jsx(Ze,{children:r.jsx(et,{className:"p-0",children:r.jsxs(Ks,{children:[r.jsx(Zs,{children:r.jsxs(Mr,{children:[r.jsx(It,{children:"Title"}),r.jsx(It,{children:"Status"}),r.jsx(It,{children:"Frequency"}),r.jsx(It,{children:"Publish Date"}),r.jsx(It,{className:"text-right",children:"Actions"})]})}),r.jsx(Ys,{children:s?r.jsx(Mr,{children:r.jsx(kt,{colSpan:5,className:"text-center py-8",children:"Loading..."})}):t.length===0?r.jsx(Mr,{children:r.jsx(kt,{colSpan:5,className:"text-center py-8 text-muted-foreground",children:"No briefs created yet"})}):t.map(Ee=>r.jsxs(Mr,{children:[r.jsx(kt,{className:"font-medium",children:Ee.title}),r.jsx(kt,{children:r.jsx(Pt,{variant:Ee.is_published?"default":"secondary",children:Ee.is_published?"Published":"Draft"})}),r.jsx(kt,{className:"capitalize",children:Ee.show_frequency.replace("_"," ")}),r.jsx(kt,{children:on(new Date(Ee.publish_date),"MMM d, yyyy h:mm a")}),r.jsx(kt,{className:"text-right",children:r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>Oe(Ee),children:r.jsx(_c,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>Be(Ee),children:r.jsx(gc,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>Mt(Ee.id),children:r.jsx(Bn,{className:"h-4 w-4 text-destructive"})})]})})]},Ee.id))})]})})})]}),r.jsx(Or,{open:o,onOpenChange:l,children:r.jsxs(Ir,{className:"max-w-3xl max-h-[90vh] overflow-y-auto",children:[r.jsx($r,{children:r.jsx(Fr,{children:i?"Edit Brief":"Create New Brief"})}),r.jsxs(Ai,{defaultValue:"content",className:"w-full",children:[r.jsxs(vi,{className:"grid w-full grid-cols-4",children:[r.jsx(sn,{value:"content",children:"Content"}),r.jsx(sn,{value:"media",children:"Media"}),r.jsx(sn,{value:"links",children:"Links"}),r.jsx(sn,{value:"polls",children:"Polls"})]}),r.jsxs(Mn,{value:"content",className:"space-y-4 mt-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{children:"Title *"}),r.jsx(dt,{value:b,onChange:Ee=>S(Ee.target.value),placeholder:"What's happening at LevelUp..."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{children:"Description"}),r.jsx(ax,{content:k,onChange:Ee=>M(Ee),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($e,{children:"Publish Date"}),r.jsx(dt,{type:"datetime-local",value:G,onChange:Ee=>J(Ee.target.value)})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{children:"Show Frequency"}),r.jsxs(mn,{value:ne,onValueChange:oe,children:[r.jsx(fn,{children:r.jsx(yn,{})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"once",children:"Once (until dismissed)"}),r.jsx(qt,{value:"every_login",children:"Every login"}),r.jsx(qt,{value:"daily",children:"Daily"})]})]})]})]}),r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(Ts,{checked:V,onCheckedChange:W}),r.jsx($e,{children:"Publish immediately"})]})]}),r.jsxs(Mn,{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($e,{children:"Upload Video to Bunny.net"}),r.jsx("div",{className:"flex gap-2",children:r.jsx(dt,{type:"file",accept:"video/*",onChange:qe,disabled:fe})}),fe&&r.jsx("p",{className:"text-sm text-muted-foreground",children:"Uploading..."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{children:"Or paste embed URL"}),r.jsx(dt,{value:P,onChange:Ee=>T(Ee.target.value),placeholder:"https://iframe.mediadelivery.net/embed/..."})]}),P&&r.jsx("div",{className:"aspect-video rounded-lg overflow-hidden bg-muted",children:r.jsx("iframe",{src:P,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($e,{children:"Upload Image"}),r.jsx("div",{className:"flex gap-2",children:r.jsx(dt,{type:"file",accept:"image/*",onChange:async Ee=>{var nt;const He=(nt=Ee.target.files)==null?void 0:nt[0];if(He){Ae(!0);try{const yt=He.name.split(".").pop(),it=`brief-graphics/${Date.now()}.${yt}`,{error:zt}=await Q.storage.from("banner-images").upload(it,He,{upsert:!0});if(zt)throw zt;const{data:dr}=Q.storage.from("banner-images").getPublicUrl(it);z(dr.publicUrl),Ie.success("Image uploaded!")}catch(yt){console.error(yt),Ie.error("Failed to upload image")}finally{Ae(!1)}}},disabled:ye})}),ye&&r.jsx("p",{className:"text-sm text-muted-foreground",children:"Uploading..."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{children:"Or paste Image URL"}),r.jsx(dt,{value:I,onChange:Ee=>z(Ee.target.value),placeholder:"https://example.com/image.png"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{children:"Click-through Link (optional)"}),r.jsx(dt,{value:D,onChange:Ee=>U(Ee.target.value),placeholder:"https://example.com/landing-page"})]}),I&&r.jsx("div",{className:"rounded-lg overflow-hidden bg-muted border",children:r.jsx("img",{src:I,alt:"Brief graphic preview",className:"w-full object-contain max-h-64"})})]})]}),r.jsxs(Mn,{value:"links",className:"space-y-4 mt-4",children:[r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsx($e,{children:"Quick Links"}),r.jsxs(ee,{variant:"outline",size:"sm",onClick:at,children:[r.jsx(bn,{className:"h-4 w-4 mr-1"}),"Add Link"]})]}),ge.map((Ee,He)=>r.jsxs("div",{className:"flex gap-2 items-start",children:[r.jsx(dt,{value:Ee.title,onChange:nt=>le(He,"title",nt.target.value),placeholder:"Link title",className:"flex-1"}),r.jsx(dt,{value:Ee.url,onChange:nt=>le(He,"url",nt.target.value),placeholder:"https://...",className:"flex-[2]"}),r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>Ve(He),children:r.jsx(Bn,{className:"h-4 w-4 text-destructive"})})]},He)),ge.length===0&&r.jsx("p",{className:"text-muted-foreground text-center py-4",children:"No links added yet"})]}),r.jsxs(Mn,{value:"polls",className:"space-y-4 mt-4",children:[r.jsxs("div",{className:"flex justify-between items-center",children:[r.jsx($e,{children:"Polls"}),r.jsxs(ee,{variant:"outline",size:"sm",onClick:Qe,children:[r.jsx(bn,{className:"h-4 w-4 mr-1"}),"Add Poll"]})]}),pe.map((Ee,He)=>r.jsx(Ze,{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:Ee.question,onChange:nt=>st(He,nt.target.value),placeholder:"Poll question...",className:"flex-1 mr-2"}),r.jsxs(mn,{value:Ee.poll_type,onValueChange:nt=>ke(He,nt),children:[r.jsx(fn,{className:"w-32",children:r.jsx(yn,{})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"single",children:"Single"}),r.jsx(qt,{value:"multi",children:"Multi-select"})]})]}),r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>Ge(He),children:r.jsx(Bn,{className:"h-4 w-4 text-destructive"})})]}),r.jsxs("div",{className:"space-y-2 pl-4",children:[Ee.options.map((nt,yt)=>r.jsxs("div",{className:"flex gap-2",children:[r.jsx(dt,{value:nt,onChange:it=>Ce(He,yt,it.target.value),placeholder:`Option ${yt+1}`}),Ee.options.length>2&&r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>Me(He,yt),children:r.jsx(Bn,{className:"h-4 w-4 text-muted-foreground"})})]},yt)),r.jsxs(ee,{variant:"ghost",size:"sm",onClick:()=>ct(He),children:[r.jsx(bn,{className:"h-4 w-4 mr-1"}),"Add Option"]})]})]})},He)),pe.length===0&&r.jsx("p",{className:"text-muted-foreground text-center py-4",children:"No polls added yet"})]})]}),r.jsxs("div",{className:"flex justify-end gap-2 mt-4",children:[r.jsx(ee,{variant:"outline",onClick:()=>l(!1),children:"Cancel"}),r.jsx(ee,{onClick:ot,children:i?"Update Brief":"Create Brief"})]})]})}),r.jsx(Or,{open:p,onOpenChange:x,children:r.jsxs(Ir,{className:"max-w-2xl",children:[r.jsx($r,{children:r.jsxs(Fr,{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(Ze,{children:[r.jsx(Wt,{className:"pb-2",children:r.jsx(Yt,{className:"text-sm font-medium text-muted-foreground",children:"Total Views"})}),r.jsx(et,{children:r.jsx("p",{className:"text-2xl font-bold",children:_e.total})})]}),r.jsxs(Ze,{children:[r.jsx(Wt,{className:"pb-2",children:r.jsx(Yt,{className:"text-sm font-medium text-muted-foreground",children:"Dismissed"})}),r.jsx(et,{children:r.jsx("p",{className:"text-2xl font-bold",children:_e.dismissed})})]})]}),we.length>0?r.jsxs("div",{className:"space-y-4",children:[r.jsx("h3",{className:"font-semibold",children:"Poll Results"}),we.map(Ee=>r.jsxs(Ze,{className:"p-4",children:[r.jsx("h4",{className:"font-medium mb-3",children:Ee.question}),r.jsx("div",{className:"space-y-2",children:Ee.options.map(He=>{const nt=Ee.results[He.id]||0,yt=Ee.totalResponses>0?Math.round(nt/Ee.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:He.option_text}),r.jsxs("span",{className:"text-muted-foreground",children:[nt," (",yt,"%)"]})]}),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:`${yt}%`}})}),nt>0&&r.jsx("div",{className:"flex flex-wrap gap-1 pt-1",children:(Ee.respondents||[]).filter(it=>it.optionId===He.id).map((it,zt)=>r.jsx(Pt,{variant:"secondary",className:"text-xs font-normal",children:it.userName},zt))})]},He.id)})})]},Ee.id))]}):r.jsx("p",{className:"text-muted-foreground text-center py-4",children:"No polls in this brief"})]})]})})]})}const PCt=()=>{const{user:e}=tn(),{toast:t}=_i(),n=Hr(),[s,a]=E.useState(!1),[o,l]=E.useState(null),[i,u]=E.useState({name:"",description:"",signup_link_url:"",publish_date:new Date().toISOString().split("T")[0],is_published:!1}),[p,x]=E.useState(null),[y,_]=E.useState(""),{data:b=[],isLoading:S}=Kt({queryKey:["additional-services-admin"],queryFn:async()=>{const{data:D,error:U}=await Q.from("additional_services").select("*").order("publish_date",{ascending:!1});if(U)throw U;return D}}),k=ir({mutationFn:async D=>{let U=D.existingImageUrl;if(D.image){const W=D.image.name.split(".").pop(),G=`${Date.now()}-${Math.random().toString(36).substring(7)}.${W}`,{error:J}=await Q.storage.from("service-images").upload(G,D.image);if(J)throw J;const{data:ne}=Q.storage.from("service-images").getPublicUrl(G);U=ne.publicUrl}const V={name:D.item.name,description:D.item.description||null,preview_image_url:U,signup_link_url:D.item.signup_link_url,publish_date:D.item.publish_date?new Date(D.item.publish_date).toISOString():new Date().toISOString(),is_published:D.item.is_published,created_by:e==null?void 0:e.id};if(D.itemId){const{error:W}=await Q.from("additional_services").update(V).eq("id",D.itemId);if(W)throw W}else{const{error:W}=await Q.from("additional_services").insert(V);if(W)throw W}},onSuccess:()=>{n.invalidateQueries({queryKey:["additional-services-admin"]}),n.invalidateQueries({queryKey:["additional-services"]}),t({title:o?"Service updated":"Service created"}),a(!1),P()},onError:D=>{t({title:"Error saving service",description:D.message,variant:"destructive"})}}),M=ir({mutationFn:async D=>{const{error:U}=await Q.from("additional_services").delete().eq("id",D);if(U)throw U},onSuccess:()=>{n.invalidateQueries({queryKey:["additional-services-admin"]}),n.invalidateQueries({queryKey:["additional-services"]}),t({title:"Service deleted"})},onError:D=>{t({title:"Error deleting service",description:D.message,variant:"destructive"})}}),P=()=>{u({name:"",description:"",signup_link_url:"",publish_date:new Date().toISOString().split("T")[0],is_published:!1}),x(null),_(""),l(null)},T=D=>{l(D),u({name:D.name,description:D.description||"",signup_link_url:D.signup_link_url,publish_date:D.publish_date?new Date(D.publish_date).toISOString().split("T")[0]:new Date().toISOString().split("T")[0],is_published:D.is_published}),_(D.preview_image_url||""),a(!0)},I=D=>{var V;const U=(V=D.target.files)==null?void 0:V[0];U&&(x(U),_(URL.createObjectURL(U)))},z=D=>{if(D.preventDefault(),!i.name.trim()){t({title:"Name is required",variant:"destructive"});return}if(!i.signup_link_url.trim()){t({title:"Signup link URL is required",variant:"destructive"});return}k.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(Dr,{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(Ze,{children:[r.jsx(Wt,{className:"pb-2",children:r.jsx(Yt,{className:"text-sm font-medium text-muted-foreground",children:"Total Services"})}),r.jsx(et,{children:r.jsx("div",{className:"text-2xl font-bold",children:b.length})})]}),r.jsxs(Ze,{children:[r.jsx(Wt,{className:"pb-2",children:r.jsx(Yt,{className:"text-sm font-medium text-muted-foreground",children:"Published"})}),r.jsx(et,{children:r.jsx("div",{className:"text-2xl font-bold",children:b.filter(D=>D.is_published).length})})]})]}),r.jsxs(Or,{open:s,onOpenChange:D=>{a(D),D||P()},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(Ir,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsx($r,{children:r.jsx(Fr,{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($e,{htmlFor:"name",children:"Name *"}),r.jsx(dt,{id:"name",value:i.name,onChange:D=>u({...i,name:D.target.value}),placeholder:"Enter service name"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{children:"Description"}),r.jsx(ax,{content:i.description,onChange:D=>u({...i,description:D}),placeholder:"Enter description",minHeight:"120px"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{htmlFor:"signup_link_url",children:"Signup Link URL *"}),r.jsx(dt,{id:"signup_link_url",type:"url",value:i.signup_link_url,onChange:D=>u({...i,signup_link_url:D.target.value}),placeholder:"https://example.com/signup"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{htmlFor:"publish_date",children:"Publish Date"}),r.jsx(dt,{id:"publish_date",type:"date",value:i.publish_date,onChange:D=>u({...i,publish_date:D.target.value})})]}),r.jsxs("div",{className:"flex items-center space-x-2",children:[r.jsx(Ts,{id:"is_published",checked:i.is_published,onCheckedChange:D=>u({...i,is_published:D})}),r.jsx($e,{htmlFor:"is_published",children:"Published"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{children:"Preview Image"}),y?r.jsxs("div",{className:"relative",children:[r.jsx("img",{src:y,alt:"Preview",className:"w-full max-h-48 object-contain rounded-lg border"}),r.jsx(ee,{type:"button",variant:"destructive",size:"icon",className:"absolute top-2 right-2 h-6 w-6",onClick:()=>{x(null),_("")},children:r.jsx(hs,{className:"h-3 w-3"})})]}):r.jsxs("div",{className:"border-2 border-dashed rounded-lg p-4 text-center",children:[r.jsx(Rl,{className:"h-8 w-8 mx-auto text-muted-foreground mb-2"}),r.jsx(dt,{type:"file",accept:"image/*",onChange:I,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:k.isPending,children:k.isPending?"Saving...":o?"Update":"Create"})]})]})]})]})]}),r.jsx(Ze,{children:r.jsx(et,{className:"p-0",children:S?r.jsx("div",{className:"flex justify-center py-8",children:r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})}):b.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(Ks,{children:[r.jsx(Zs,{children:r.jsxs(Mr,{children:[r.jsx(It,{className:"w-16",children:"Preview"}),r.jsx(It,{children:"Name"}),r.jsx(It,{children:"Signup Link"}),r.jsx(It,{children:"Publish Date"}),r.jsx(It,{children:"Status"}),r.jsx(It,{className:"text-right",children:"Actions"})]})}),r.jsx(Ys,{children:b.map(D=>r.jsxs(Mr,{children:[r.jsx(kt,{children:D.preview_image_url?r.jsx("img",{src:D.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(Rl,{className:"h-5 w-5 text-muted-foreground"})})}),r.jsx(kt,{className:"font-medium",children:D.name}),r.jsx(kt,{children:r.jsxs("a",{href:D.signup_link_url,target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline flex items-center gap-1",children:[r.jsx(As,{className:"h-3 w-3"}),"Link"]})}),r.jsx(kt,{children:new Date(D.publish_date).toLocaleDateString()}),r.jsx(kt,{children:r.jsx(Pt,{variant:D.is_published?"default":"secondary",children:D.is_published?"Published":"Draft"})}),r.jsx(kt,{className:"text-right",children:r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>T(D),children:r.jsx(ni,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>{confirm("Are you sure you want to delete this service?")&&M.mutate(D.id)},children:r.jsx(Bn,{className:"h-4 w-4 text-destructive"})})]})})]},D.id))})]})})})]})})};function LCt(){const{toast:e}=_i(),[t,n]=E.useState([]),[s,a]=E.useState(!0),[o,l]=E.useState(!1),[i,u]=E.useState(!1),[p,x]=E.useState({name:"",promotionCode:"",discountType:"percent",percentOff:"",amountOff:"",duration:"once",durationInMonths:""});E.useEffect(()=>{y()},[]);const y=async()=>{try{const{data:M,error:P}=await Q.functions.invoke("stripe-manage-coupons",{body:{action:"list"}});if(P)throw P;n(M.coupons||[])}catch(M){console.error("Error fetching coupons:",M),e({title:"Error",description:"Failed to load coupons",variant:"destructive"})}finally{a(!1)}},_=async()=>{if(!p.name){e({title:"Error",description:"Please enter a coupon name",variant:"destructive"});return}if(p.discountType==="percent"&&!p.percentOff){e({title:"Error",description:"Please enter a percent off value",variant:"destructive"});return}if(p.discountType==="amount"&&!p.amountOff){e({title:"Error",description:"Please enter an amount off value",variant:"destructive"});return}if(p.duration==="repeating"&&!p.durationInMonths){e({title:"Error",description:"Please enter duration in months",variant:"destructive"});return}l(!0);try{const M={action:"create",name:p.name,duration:p.duration,promotion_code:p.promotionCode.trim()||void 0};p.discountType==="percent"?M.percent_off=parseFloat(p.percentOff):(M.amount_off=Math.round(parseFloat(p.amountOff)*100),M.currency="usd"),p.duration==="repeating"&&(M.duration_in_months=parseInt(p.durationInMonths));const{data:P,error:T}=await Q.functions.invoke("stripe-manage-coupons",{body:M});if(T)throw T;e({title:"Success",description:"Coupon created successfully"}),u(!1),x({name:"",promotionCode:"",discountType:"percent",percentOff:"",amountOff:"",duration:"once",durationInMonths:""}),y()}catch(M){console.error("Error creating coupon:",M),e({title:"Error",description:M.message||"Failed to create coupon",variant:"destructive"})}finally{l(!1)}},b=async M=>{if(confirm("Are you sure you want to delete this coupon?"))try{const{error:P}=await Q.functions.invoke("stripe-manage-coupons",{body:{action:"delete",couponId:M}});if(P)throw P;e({title:"Success",description:"Coupon deleted successfully"}),y()}catch(P){console.error("Error deleting coupon:",P),e({title:"Error",description:P.message||"Failed to delete coupon",variant:"destructive"})}},S=M=>M.percent_off?`${M.percent_off}% off`:M.amount_off?`$${(M.amount_off/100).toFixed(2)} off`:"N/A",k=M=>{switch(M.duration){case"once":return"Once";case"forever":return"Forever";case"repeating":return`${M.duration_in_months} months`;default:return M.duration}};return r.jsx(Dr,{title:"Subscription Discounts",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Mu,{title:"Subscription Discounts",description:"Create and manage discount coupons for subscriptions",children:r.jsxs(Or,{open:i,onOpenChange:u,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(Ir,{children:[r.jsxs($r,{children:[r.jsx(Fr,{children:"Create New Coupon"}),r.jsx(Zn,{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($e,{children:"Promotion Code (what users will type)"}),r.jsx(dt,{placeholder:"e.g., BROKERAGE50",value:p.promotionCode,onChange:M=>x({...p,promotionCode:M.target.value.toUpperCase().replace(/[^A-Z0-9]/g,"")}),className:"font-mono uppercase"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Letters and numbers only. This is the code users enter at checkout."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{children:"Coupon Name (internal label)"}),r.jsx(dt,{placeholder:"e.g., 50% Off Brokerage Launch",value:p.name,onChange:M=>x({...p,name:M.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{children:"Discount Type"}),r.jsxs(mn,{value:p.discountType,onValueChange:M=>{const P=M==="amount"&&p.duration==="forever"?"once":p.duration;x({...p,discountType:M,duration:P})},children:[r.jsx(fn,{children:r.jsx(yn,{})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"percent",children:r.jsxs("span",{className:"flex items-center",children:[r.jsx(IS,{className:"mr-2 h-4 w-4"}),"Percentage Off"]})}),r.jsx(qt,{value:"amount",children:r.jsxs("span",{className:"flex items-center",children:[r.jsx(Rd,{className:"mr-2 h-4 w-4"}),"Fixed Amount Off"]})})]})]})]}),p.discountType==="percent"?r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{children:"Percent Off"}),r.jsxs("div",{className:"relative",children:[r.jsx(dt,{type:"number",min:"1",max:"100",placeholder:"20",value:p.percentOff,onChange:M=>x({...p,percentOff:M.target.value})}),r.jsx("span",{className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground",children:"%"})]})]}):r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{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:M=>x({...p,amountOff:M.target.value})})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{children:"Duration"}),r.jsxs(mn,{value:p.duration,onValueChange:M=>x({...p,duration:M}),children:[r.jsx(fn,{children:r.jsx(yn,{})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"once",children:"Once (first payment only)"}),r.jsx(qt,{value:"repeating",children:"Multiple months"}),r.jsxs(qt,{value:"forever",disabled:p.discountType==="amount",children:["Forever ",p.discountType==="amount"&&"(% discounts only)"]})]})]}),p.discountType==="amount"&&r.jsx("p",{className:"text-xs text-muted-foreground",children:'Note: "Forever" duration is only available for percentage-based discounts.'})]}),p.duration==="repeating"&&r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{children:"Number of Months"}),r.jsx(dt,{type:"number",min:"1",placeholder:"3",value:p.durationInMonths,onChange:M=>x({...p,durationInMonths:M.target.value})})]}),r.jsx(ee,{onClick:_,disabled:o,className:"w-full",children:o?r.jsxs(r.Fragment,{children:[r.jsx(Zr,{className:"mr-2 h-4 w-4 animate-spin"}),"Creating..."]}):"Create Coupon"})]})]})]})}),r.jsxs(Ze,{children:[r.jsxs(Wt,{children:[r.jsx(Yt,{children:"Active Coupons"}),r.jsx(Sn,{children:"Share coupon codes with users to give them discounts on subscriptions"})]}),r.jsx(et,{children:s?r.jsx("div",{className:"flex items-center justify-center py-8",children:r.jsx(Zr,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):t.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(Ks,{children:[r.jsx(Zs,{children:r.jsxs(Mr,{children:[r.jsx(It,{children:"Promo Code"}),r.jsx(It,{children:"Name"}),r.jsx(It,{children:"Discount"}),r.jsx(It,{children:"Duration"}),r.jsx(It,{children:"Redemptions"}),r.jsx(It,{children:"Status"}),r.jsx(It,{className:"text-right",children:"Actions"})]})}),r.jsx(Ys,{children:t.map(M=>{var P;return r.jsxs(Mr,{children:[r.jsx(kt,{className:"font-mono font-medium",children:((P=M.promotion_codes)==null?void 0:P.length)>0?M.promotion_codes.join(", "):r.jsx("span",{className:"text-muted-foreground text-xs",children:"No promo code"})}),r.jsx(kt,{children:M.name||"-"}),r.jsx(kt,{children:S(M)}),r.jsx(kt,{children:k(M)}),r.jsx(kt,{children:M.times_redeemed}),r.jsx(kt,{children:r.jsx(Pt,{variant:M.valid?"default":"secondary",children:M.valid?"Active":"Inactive"})}),r.jsx(kt,{className:"text-right",children:r.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>b(M.id),children:r.jsx(Bn,{className:"h-4 w-4 text-destructive"})})})]},M.id)})})]})})]}),r.jsxs(Ze,{children:[r.jsx(Wt,{children:r.jsx(Yt,{children:"How to Use Coupons"})}),r.jsxs(et,{className:"text-sm text-muted-foreground space-y-2",children:[r.jsx("p",{children:"1. Create a coupon above with your desired discount."}),r.jsx("p",{children:'2. Share the coupon code (shown in the "Code" column) with users.'}),r.jsx("p",{children:"3. Users can enter the code during checkout to receive the discount."}),r.jsx("p",{children:"4. Alternatively, you can create a promotion code in Stripe dashboard for public-facing promotions."})]})]})]})})}const Ode={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 OCt(){const[e,t]=E.useState(""),[n,s]=E.useState("all"),[a,o]=E.useState(null),{data:l,isLoading:i,refetch:u}=Kt({queryKey:["admin-subscriptions"],queryFn:async()=>{const{data:S,error:k}=await Q.from("profiles").select(` *, brokerages:brokerage_id (id, name) `).order("created_at",{ascending:!1});if(k)throw k;return S}}),{data:p}=Kt({queryKey:["admin-brokerages-subscriptions"],queryFn:async()=>{const{data:S,error:k}=await Q.from("brokerages").select("*").order("name");if(k)throw k;return await Promise.all((S||[]).map(async P=>{const{data:T}=await Q.from("profiles").select("id, name, email, subscription_status, subscription_product_id").eq("brokerage_id",P.id),{data:I}=await Q.from("user_roles").select("user_id").eq("role","brokerage_manager"),z=(I==null?void 0:I.map(V=>V.user_id))||[],D=(T==null?void 0:T.filter(V=>z.includes(V.id)))||[],U=(T==null?void 0:T.length)||0;return{...P,managers:D,agentCount:U}}))}}),x=S=>{if(S.is_grandfathered)return{status:"Grandfathered",badge:"Legacy",variant:"secondary"};if(S.brokerage_id&&!S.subscription_product_id)return{status:"Brokerage",badge:"Team Member",variant:"outline"};if(S.is_trial&&S.trial_expires_at)return new Date(S.trial_expires_at)>new Date?{status:"Trial",badge:"Active Trial",variant:"default"}:{status:"Trial Expired",badge:"Expired",variant:"destructive"};if(S.subscription_status==="active"||S.subscription_status==="trialing"){const k=Ode[S.subscription_product_id];return{status:(k==null?void 0:k.name)||"Active",badge:S.subscription_status==="trialing"?"Trial":"Active",variant:"default"}}return S.subscription_status==="canceled"||S.subscription_status==="past_due"?{status:"Canceled",badge:"Inactive",variant:"destructive"}:{status:"None",badge:"No Subscription",variant:"outline"}},y=l==null?void 0:l.filter(S=>{var M,P;if(!(((M=S.name)==null?void 0:M.toLowerCase().includes(e.toLowerCase()))||((P=S.email)==null?void 0:P.toLowerCase().includes(e.toLowerCase()))))return!1;switch(x(S),n){case"active":return S.subscription_status==="active";case"trialing":return S.subscription_status==="trialing"||S.is_trial&&new Date(S.trial_expires_at)>new Date;case"grandfathered":return S.is_grandfathered;case"brokerage":return S.brokerage_id&&!S.subscription_product_id&&!S.is_grandfathered;case"expired":return S.subscription_status==="canceled"||S.subscription_status==="past_due"||S.is_trial&&new Date(S.trial_expires_at)<=new Date;case"none":return!S.subscription_status||S.subscription_status==="none";default:return!0}}),_={totalUsers:(l==null?void 0:l.length)||0,activeSubscriptions:(l==null?void 0:l.filter(S=>S.subscription_status==="active").length)||0,trials:(l==null?void 0:l.filter(S=>S.subscription_status==="trialing"||S.is_trial&&new Date(S.trial_expires_at)>new Date).length)||0,grandfathered:(l==null?void 0:l.filter(S=>S.is_grandfathered).length)||0,brokerageMembers:(l==null?void 0:l.filter(S=>S.brokerage_id&&!S.subscription_product_id&&!S.is_grandfathered).length)||0,individualSubscribers:(l==null?void 0:l.filter(S=>S.subscription_status==="active"&&S.subscription_product_id==="prod_Tc07cYplXUGNkm").length)||0,brokerageSubscribers:(l==null?void 0:l.filter(S=>S.subscription_status==="active"&&(S.subscription_product_id==="prod_Tc08MupgoVySDG"||S.subscription_product_id==="prod_Tc09N1tJ4RrAFn")).length)||0},b=S=>{window.open(`https://dashboard.stripe.com/customers/${S}`,"_blank")};return r.jsx(Dr,{title:"Subscription Management",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Mu,{title:"Subscription Management",description:"Track and manage all subscriptions",children:r.jsxs(ee,{onClick:()=>u(),variant:"outline",size:"sm",children:[r.jsx(qo,{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(Ze,{children:r.jsxs(et,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Un,{className:"h-4 w-4 text-muted-foreground"}),r.jsx("span",{className:"text-sm text-muted-foreground",children:"Total Users"})]}),r.jsx("p",{className:"text-2xl font-bold mt-1",children:_.totalUsers})]})}),r.jsx(Ze,{className:"border-green-500/50",children:r.jsxs(et,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Mm,{className:"h-4 w-4 text-green-500"}),r.jsx("span",{className:"text-sm text-muted-foreground",children:"Active Paid"})]}),r.jsx("p",{className:"text-2xl font-bold mt-1 text-green-600",children:_.activeSubscriptions})]})}),r.jsx(Ze,{className:"border-blue-500/50",children:r.jsxs(et,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ya,{className:"h-4 w-4 text-blue-500"}),r.jsx("span",{className:"text-sm text-muted-foreground",children:"Trials"})]}),r.jsx("p",{className:"text-2xl font-bold mt-1 text-blue-600",children:_.trials})]})}),r.jsx(Ze,{className:"border-purple-500/50",children:r.jsxs(et,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(B1,{className:"h-4 w-4 text-purple-500"}),r.jsx("span",{className:"text-sm text-muted-foreground",children:"Grandfathered"})]}),r.jsx("p",{className:"text-2xl font-bold mt-1 text-purple-600",children:_.grandfathered})]})}),r.jsx(Ze,{className:"border-orange-500/50",children:r.jsxs(et,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(hi,{className:"h-4 w-4 text-orange-500"}),r.jsx("span",{className:"text-sm text-muted-foreground",children:"Brokerage Members"})]}),r.jsx("p",{className:"text-2xl font-bold mt-1 text-orange-600",children:_.brokerageMembers})]})}),r.jsx(Ze,{children:r.jsxs(et,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Uj,{className:"h-4 w-4 text-muted-foreground"}),r.jsx("span",{className:"text-sm text-muted-foreground",children:"Individual"})]}),r.jsx("p",{className:"text-2xl font-bold mt-1",children:_.individualSubscribers})]})}),r.jsx(Ze,{children:r.jsxs(et,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(hi,{className:"h-4 w-4 text-muted-foreground"}),r.jsx("span",{className:"text-sm text-muted-foreground",children:"Brokerage Subs"})]}),r.jsx("p",{className:"text-2xl font-bold mt-1",children:_.brokerageSubscribers})]})})]}),r.jsxs(Ai,{defaultValue:"users",className:"space-y-4",children:[r.jsxs(vi,{children:[r.jsx(sn,{value:"users",children:"All Users"}),r.jsx(sn,{value:"brokerages",children:"Brokerages"})]}),r.jsxs(Mn,{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(Sa,{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:S=>t(S.target.value),className:"pl-9"})]}),r.jsxs(mn,{value:n,onValueChange:S=>s(S),children:[r.jsx(fn,{className:"w-[200px]",children:r.jsx(yn,{placeholder:"Filter by status"})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"all",children:"All Users"}),r.jsx(qt,{value:"active",children:"Active Subscriptions"}),r.jsx(qt,{value:"trialing",children:"Trials"}),r.jsx(qt,{value:"grandfathered",children:"Grandfathered"}),r.jsx(qt,{value:"brokerage",children:"Brokerage Members"}),r.jsx(qt,{value:"expired",children:"Expired/Canceled"}),r.jsx(qt,{value:"none",children:"No Subscription"})]})]})]}),r.jsx(Ze,{children:r.jsx(et,{className:"p-0",children:r.jsxs(Ks,{children:[r.jsx(Zs,{children:r.jsxs(Mr,{children:[r.jsx(It,{children:"User"}),r.jsx(It,{children:"Status"}),r.jsx(It,{children:"Plan"}),r.jsx(It,{children:"Brokerage"}),r.jsx(It,{children:"End Date"}),r.jsx(It,{className:"text-right",children:"Actions"})]})}),r.jsx(Ys,{children:i?r.jsx(Mr,{children:r.jsx(kt,{colSpan:6,className:"text-center py-8",children:"Loading subscriptions..."})}):(y==null?void 0:y.length)===0?r.jsx(Mr,{children:r.jsx(kt,{colSpan:6,className:"text-center py-8 text-muted-foreground",children:"No users found"})}):y==null?void 0:y.map(S=>{var P,T;const k=x(S),M=Ode[S.subscription_product_id];return r.jsxs(Mr,{children:[r.jsx(kt,{children:r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:S.name}),r.jsx("p",{className:"text-sm text-muted-foreground",children:S.email})]})}),r.jsx(kt,{children:r.jsx(Pt,{variant:k.variant,children:k.badge})}),r.jsx(kt,{children:r.jsx("span",{className:"text-sm",children:S.is_grandfathered?"Legacy Access":S.brokerage_id&&!S.subscription_product_id?"Brokerage Subscription":(M==null?void 0:M.name)||k.status})}),r.jsx(kt,{children:(P=S.brokerages)!=null&&P.name?r.jsx("span",{className:"text-sm",children:S.brokerages.name}):r.jsx("span",{className:"text-sm text-muted-foreground",children:"—"})}),r.jsx(kt,{children:S.subscription_end_date?r.jsx("span",{className:"text-sm",children:on(new Date(S.subscription_end_date),"MMM d, yyyy")}):S.trial_expires_at?r.jsxs("span",{className:"text-sm text-blue-600",children:["Trial: ",on(new Date(S.trial_expires_at),"MMM d, yyyy")]}):r.jsx("span",{className:"text-sm text-muted-foreground",children:"—"})}),r.jsx(kt,{className:"text-right",children:r.jsxs("div",{className:"flex items-center justify-end gap-2",children:[S.stripe_customer_id&&r.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>b(S.stripe_customer_id),children:r.jsx(As,{className:"h-4 w-4"})}),r.jsxs(Or,{children:[r.jsx(Zo,{asChild:!0,children:r.jsx(ee,{variant:"outline",size:"sm",onClick:()=>o(S),children:"Details"})}),r.jsxs(Ir,{children:[r.jsxs($r,{children:[r.jsx(Fr,{children:"Subscription Details"}),r.jsxs(Zn,{children:[S.name," (",S.email,")"]})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Status"}),r.jsx(Pt,{variant:k.variant,className:"mt-1",children:k.badge})]}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Plan"}),r.jsx("p",{className:"font-medium",children:S.is_grandfathered?"Grandfathered (Legacy)":S.brokerage_id&&!S.subscription_product_id?"Brokerage Subscription":(M==null?void 0:M.name)||"None"})]}),S.brokerage_id&&r.jsxs("div",{children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Brokerage"}),r.jsx("p",{className:"font-medium",children:((T=S.brokerages)==null?void 0:T.name)||"Unknown"})]}),S.subscription_end_date&&r.jsxs("div",{children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Current Period End"}),r.jsx("p",{className:"font-medium",children:on(new Date(S.subscription_end_date),"MMMM d, yyyy")})]}),S.trial_expires_at&&r.jsxs("div",{children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Trial Expires"}),r.jsx("p",{className:"font-medium",children:on(new Date(S.trial_expires_at),"MMMM d, yyyy")})]}),S.stripe_customer_id&&r.jsxs("div",{className:"col-span-2",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Stripe Customer ID"}),r.jsx("p",{className:"font-mono text-sm",children:S.stripe_customer_id})]})]}),S.stripe_customer_id&&r.jsxs(ee,{className:"w-full",onClick:()=>b(S.stripe_customer_id),children:[r.jsx(As,{className:"h-4 w-4 mr-2"}),"View in Stripe Dashboard"]})]})]})]})]})})]},S.id)})})]})})})]}),r.jsx(Mn,{value:"brokerages",className:"space-y-4",children:r.jsx("div",{className:"grid gap-4",children:p==null?void 0:p.map(S=>{var M,P;const k=(M=S.managers)==null?void 0:M.some(T=>T.subscription_status==="active"&&(T.subscription_product_id==="prod_Tc08MupgoVySDG"||T.subscription_product_id==="prod_Tc09N1tJ4RrAFn"));return r.jsxs(Ze,{children:[r.jsx(Wt,{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(hi,{className:"h-5 w-5 text-primary"})}),r.jsxs("div",{children:[r.jsx(Yt,{className:"text-lg",children:S.name}),r.jsxs(Sn,{children:[S.agentCount," agents"]})]})]}),r.jsx(Pt,{variant:k?"default":"outline",children:k?"Active Subscription":"No Active Subscription"})]})}),r.jsx(et,{children:((P=S.managers)==null?void 0:P.length)>0?r.jsxs("div",{className:"space-y-2",children:[r.jsx("p",{className:"text-sm font-medium text-muted-foreground",children:"Managers:"}),S.managers.map(T=>{const I=Ode[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:I?r.jsxs("div",{children:[r.jsx(Pt,{variant:"default",children:I.name}),r.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:I.price})]}):r.jsx(Pt,{variant:"outline",children:"No Subscription"})})]},T.id)})]}):r.jsx("p",{className:"text-sm text-muted-foreground",children:"No managers assigned"})})]},S.id)})})})]})]})})}function DCt(){const[e,t]=E.useState([]),[n,s]=E.useState(!0),[a,o]=E.useState(""),[l,i]=E.useState("all"),[u,p]=E.useState({total:0,qualified:0,pending:0,cancelled:0,totalDiscounts:0});E.useEffect(()=>{x()},[]);const x=async()=>{try{const{data:S,error:k}=await Q.from("referrals").select(` *, referrer_brokerage:brokerages!referrer_brokerage_id(name), referred_brokerage:brokerages!referred_brokerage_id(name), referred_user:profiles!referred_user_id(name, email) `).order("created_at",{ascending:!1});if(k)throw k;t(S||[]);const M=(S==null?void 0:S.filter(I=>I.status==="qualified").length)||0,P=(S==null?void 0:S.filter(I=>I.status==="pending").length)||0,T=(S==null?void 0:S.filter(I=>I.status==="cancelled").length)||0;p({total:(S==null?void 0:S.length)||0,qualified:M,pending:P,cancelled:T,totalDiscounts:M*25})}catch(S){console.error("Error fetching referrals:",S),Ie.error("Failed to load referrals")}finally{s(!1)}},y=async()=>{try{Ie.loading("Processing qualifications...");const{error:S}=await Q.functions.invoke("process-referral-qualifications");if(S)throw S;Ie.dismiss(),Ie.success("Qualifications processed successfully"),x()}catch(S){Ie.dismiss(),console.error("Error processing qualifications:",S),Ie.error("Failed to process qualifications")}},_=e.filter(S=>{var P,T,I,z,D,U;const k=((T=(P=S.referrer_brokerage)==null?void 0:P.name)==null?void 0:T.toLowerCase().includes(a.toLowerCase()))||((z=(I=S.referred_brokerage)==null?void 0:I.name)==null?void 0:z.toLowerCase().includes(a.toLowerCase()))||((U=(D=S.referred_user)==null?void 0:D.email)==null?void 0:U.toLowerCase().includes(a.toLowerCase())),M=l==="all"||S.status===l;return k&&M}),b=S=>{switch(S){case"qualified":return r.jsxs(Pt,{className:"bg-green-100 text-green-800",children:[r.jsx(di,{className:"h-3 w-3 mr-1"}),"Qualified"]});case"pending":return r.jsxs(Pt,{variant:"secondary",children:[r.jsx(Ya,{className:"h-3 w-3 mr-1"}),"Pending"]});case"cancelled":return r.jsxs(Pt,{variant:"destructive",children:[r.jsx(bc,{className:"h-3 w-3 mr-1"}),"Cancelled"]});default:return r.jsx(Pt,{children:S})}};return r.jsx(Dr,{title:"Referral Program",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Mu,{title:"Referral Program",description:"Track and manage brokerage referrals",children:r.jsxs(ee,{onClick:y,variant:"outline",children:[r.jsx(qo,{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(Ze,{children:r.jsx(et,{className:"pt-6",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Un,{className:"h-5 w-5 text-muted-foreground"}),r.jsxs("div",{children:[r.jsx("p",{className:"text-2xl font-bold",children:u.total}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Total Referrals"})]})]})})}),r.jsx(Ze,{children:r.jsx(et,{className:"pt-6",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(di,{className:"h-5 w-5 text-green-600"}),r.jsxs("div",{children:[r.jsx("p",{className:"text-2xl font-bold",children:u.qualified}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Qualified"})]})]})})}),r.jsx(Ze,{children:r.jsx(et,{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:u.pending}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Pending"})]})]})})}),r.jsx(Ze,{children:r.jsx(et,{className:"pt-6",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(bc,{className:"h-5 w-5 text-red-600"}),r.jsxs("div",{children:[r.jsx("p",{className:"text-2xl font-bold",children:u.cancelled}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Cancelled"})]})]})})}),r.jsx(Ze,{children:r.jsx(et,{className:"pt-6",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Rd,{className:"h-5 w-5 text-green-600"}),r.jsxs("div",{children:[r.jsxs("p",{className:"text-2xl font-bold",children:["$",u.totalDiscounts]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Monthly Discounts"})]})]})})})]}),r.jsxs(Ze,{children:[r.jsxs(Wt,{children:[r.jsx(Yt,{children:"All Referrals"}),r.jsx(Sn,{children:"View and manage all referral relationships"})]}),r.jsxs(et,{children:[r.jsxs("div",{className:"flex gap-4 mb-4",children:[r.jsxs("div",{className:"relative flex-1",children:[r.jsx(Sa,{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:S=>o(S.target.value),className:"pl-10"})]}),r.jsxs(mn,{value:l,onValueChange:i,children:[r.jsx(fn,{className:"w-[180px]",children:r.jsx(yn,{placeholder:"Filter by status"})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"all",children:"All Statuses"}),r.jsx(qt,{value:"pending",children:"Pending"}),r.jsx(qt,{value:"qualified",children:"Qualified"}),r.jsx(qt,{value:"cancelled",children:"Cancelled"})]})]})]}),n?r.jsx("div",{className:"flex justify-center py-8",children:r.jsx("div",{className:"h-8 w-8 animate-spin rounded-full border-4 border-primary border-t-transparent"})}):r.jsxs(Ks,{children:[r.jsx(Zs,{children:r.jsxs(Mr,{children:[r.jsx(It,{children:"Referrer"}),r.jsx(It,{children:"Referred"}),r.jsx(It,{children:"Signup Date"}),r.jsx(It,{children:"Status"}),r.jsx(It,{children:"Qualified Date"}),r.jsx(It,{children:"Discount"})]})}),r.jsx(Ys,{children:_.length===0?r.jsx(Mr,{children:r.jsx(kt,{colSpan:6,className:"text-center text-muted-foreground py-8",children:"No referrals found"})}):_.map(S=>{var k,M,P,T;return r.jsxs(Mr,{children:[r.jsx(kt,{className:"font-medium",children:((k=S.referrer_brokerage)==null?void 0:k.name)||"Unknown"}),r.jsx(kt,{children:r.jsxs("div",{children:[r.jsx("p",{children:((M=S.referred_brokerage)==null?void 0:M.name)||((P=S.referred_user)==null?void 0:P.name)||"Pending setup"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:(T=S.referred_user)==null?void 0:T.email})]})}),r.jsx(kt,{children:on(new Date(S.signup_date),"MMM d, yyyy")}),r.jsx(kt,{children:b(S.status)}),r.jsx(kt,{children:S.qualified_date?on(new Date(S.qualified_date),"MMM d, yyyy"):"-"}),r.jsx(kt,{children:S.discount_applied?r.jsx(Pt,{variant:"outline",className:"text-green-600",children:"$25/mo applied"}):r.jsx("span",{className:"text-muted-foreground",children:"-"})})]},S.id)})})]})]})]})]})})}const Dde=[{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"}],RCt=[{value:"brokerage_manager",label:"Brokerage Manager"},{value:"agent",label:"Agent"}];function FCt(){const[e,t]=E.useState([]),[n,s]=E.useState(!0),[a,o]=E.useState(!1),[l,i]=E.useState(null),[u,p]=E.useState({title:"",description:"",action_type:"view_template",target_role:"agent",is_active:!0});E.useEffect(()=>{x()},[]);const x=async()=>{try{const{data:T,error:I}=await Q.from("onboarding_checklist_items").select("*").order("target_role").order("sort_order");if(I)throw I;t(T||[])}catch(T){console.error("Error fetching checklist items:",T),Ie.error("Failed to load checklist items")}finally{s(!1)}},y=()=>{i(null),p({title:"",description:"",action_type:"view_template",target_role:"agent",is_active:!0}),o(!0)},_=T=>{i(T),p({title:T.title,description:T.description||"",action_type:T.action_type,target_role:T.target_role,is_active:T.is_active}),o(!0)},b=async()=>{if(!u.title.trim()){Ie.error("Title is required");return}try{if(l){const{error:T}=await Q.from("onboarding_checklist_items").update({title:u.title,description:u.description||null,action_type:u.action_type,target_role:u.target_role,is_active:u.is_active}).eq("id",l.id);if(T)throw T;Ie.success("Checklist item updated")}else{const T=e.filter(z=>z.target_role===u.target_role).reduce((z,D)=>Math.max(z,D.sort_order),-1),{error:I}=await Q.from("onboarding_checklist_items").insert({title:u.title,description:u.description||null,action_type:u.action_type,target_role:u.target_role,is_active:u.is_active,sort_order:T+1});if(I)throw I;Ie.success("Checklist item created")}o(!1),x()}catch(T){console.error("Error saving checklist item:",T),Ie.error("Failed to save checklist item")}},S=async T=>{if(confirm("Are you sure you want to delete this checklist item?"))try{const{error:I}=await Q.from("onboarding_checklist_items").delete().eq("id",T);if(I)throw I;Ie.success("Checklist item deleted"),x()}catch(I){console.error("Error deleting checklist item:",I),Ie.error("Failed to delete checklist item")}},k=async T=>{try{const{error:I}=await Q.from("onboarding_checklist_items").update({is_active:!T.is_active}).eq("id",T.id);if(I)throw I;Ie.success(T.is_active?"Item deactivated":"Item activated"),x()}catch(I){console.error("Error toggling item:",I),Ie.error("Failed to update item")}},M=e.filter(T=>T.target_role==="brokerage_manager"),P=e.filter(T=>T.target_role==="agent");return r.jsxs(Dr,{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(Ze,{children:[r.jsx(Wt,{children:r.jsxs(Yt,{className:"flex items-center gap-2",children:[r.jsx(Pt,{variant:"secondary",children:"Brokerage Manager"}),"Checklist Items"]})}),r.jsx(et,{children:M.length===0?r.jsx("p",{className:"text-muted-foreground text-center py-4",children:"No checklist items for brokerage managers"}):r.jsxs(Ks,{children:[r.jsx(Zs,{children:r.jsxs(Mr,{children:[r.jsx(It,{className:"w-12",children:"#"}),r.jsx(It,{children:"Title"}),r.jsx(It,{children:"Action Type"}),r.jsx(It,{children:"Status"}),r.jsx(It,{className:"text-right",children:"Actions"})]})}),r.jsx(Ys,{children:M.map((T,I)=>{var z;return r.jsxs(Mr,{children:[r.jsx(kt,{className:"text-muted-foreground",children:I+1}),r.jsx(kt,{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(kt,{children:r.jsx(Pt,{variant:"outline",children:((z=Dde.find(D=>D.value===T.action_type))==null?void 0:z.label)||T.action_type})}),r.jsx(kt,{children:r.jsx(Ts,{checked:T.is_active,onCheckedChange:()=>k(T)})}),r.jsx(kt,{className:"text-right",children:r.jsxs("div",{className:"flex items-center justify-end gap-2",children:[r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>_(T),children:r.jsx(ni,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>S(T.id),children:r.jsx(Bn,{className:"h-4 w-4 text-destructive"})})]})})]},T.id)})})]})})]}),r.jsxs(Ze,{children:[r.jsx(Wt,{children:r.jsxs(Yt,{className:"flex items-center gap-2",children:[r.jsx(Pt,{variant:"secondary",children:"Agent"}),"Checklist Items"]})}),r.jsx(et,{children:P.length===0?r.jsx("p",{className:"text-muted-foreground text-center py-4",children:"No checklist items for agents"}):r.jsxs(Ks,{children:[r.jsx(Zs,{children:r.jsxs(Mr,{children:[r.jsx(It,{className:"w-12",children:"#"}),r.jsx(It,{children:"Title"}),r.jsx(It,{children:"Action Type"}),r.jsx(It,{children:"Status"}),r.jsx(It,{className:"text-right",children:"Actions"})]})}),r.jsx(Ys,{children:P.map((T,I)=>{var z;return r.jsxs(Mr,{children:[r.jsx(kt,{className:"text-muted-foreground",children:I+1}),r.jsx(kt,{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(kt,{children:r.jsx(Pt,{variant:"outline",children:((z=Dde.find(D=>D.value===T.action_type))==null?void 0:z.label)||T.action_type})}),r.jsx(kt,{children:r.jsx(Ts,{checked:T.is_active,onCheckedChange:()=>k(T)})}),r.jsx(kt,{className:"text-right",children:r.jsxs("div",{className:"flex items-center justify-end gap-2",children:[r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>_(T),children:r.jsx(ni,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>S(T.id),children:r.jsx(Bn,{className:"h-4 w-4 text-destructive"})})]})})]},T.id)})})]})})]})]}),r.jsx(Or,{open:a,onOpenChange:o,children:r.jsxs(Ir,{children:[r.jsx($r,{children:r.jsx(Fr,{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($e,{htmlFor:"title",children:"Title *"}),r.jsx(dt,{id:"title",value:u.title,onChange:T=>p({...u,title:T.target.value}),placeholder:"e.g., Watch your first academy video"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{htmlFor:"description",children:"Description"}),r.jsx(Jn,{id:"description",value:u.description,onChange:T=>p({...u,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($e,{children:"Target Role"}),r.jsxs(mn,{value:u.target_role,onValueChange:T=>p({...u,target_role:T}),children:[r.jsx(fn,{children:r.jsx(yn,{})}),r.jsx(pn,{children:RCt.map(T=>r.jsx(qt,{value:T.value,children:T.label},T.value))})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{children:"Action Type"}),r.jsxs(mn,{value:u.action_type,onValueChange:T=>p({...u,action_type:T}),children:[r.jsx(fn,{children:r.jsx(yn,{})}),r.jsx(pn,{children:Dde.map(T=>r.jsx(qt,{value:T.value,children:T.label},T.value))})]})]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ts,{id:"is_active",checked:u.is_active,onCheckedChange:T=>p({...u,is_active:T})}),r.jsx($e,{htmlFor:"is_active",children:"Active"})]})]}),r.jsxs(Bs,{children:[r.jsx(ee,{variant:"outline",onClick:()=>o(!1),children:"Cancel"}),r.jsx(ee,{onClick:b,children:l?"Save Changes":"Create Item"})]})]})})]})}function zCt(){const[e,t]=E.useState(""),[n,s]=E.useState("all"),[a,o]=E.useState("name"),[l,i]=E.useState("asc"),[u,p]=E.useState(""),[x,y]=E.useState(""),[_,b]=E.useState(""),[S,k]=E.useState(""),{data:M}=Kt({queryKey:["admin-brokerages"],queryFn:async()=>{const{data:G,error:J}=await Q.from("brokerages").select("id, name").order("name");if(J)throw J;return G}}),P=async G=>{let ne=[],oe=0,ge=!0;for(;ge;){const{data:ie,error:pe}=await G(oe,oe+1e3-1);if(pe)throw pe;ie&&ie.length>0?(ne=[...ne,...ie],oe+=1e3,ge=ie.length===1e3):ge=!1}return ne},{data:T,isLoading:I}=Kt({queryKey:["admin-agent-os-user-stats"],queryFn:async()=>{const G=await P((_e,Je)=>Q.from("profiles").select("id, name, email, brokerage_id, created_at").range(_e,Je)),{data:J}=await Q.from("brokerages").select("id, name"),ne=new Map((J==null?void 0:J.map(_e=>[_e.id,_e.name]))||[]),{data:oe}=await Q.rpc("get_admin_contact_counts"),ge=new Map;oe==null||oe.forEach(_e=>{ge.set(_e.owner_user_id,_e.contact_count)});const{data:ie}=await Q.rpc("get_admin_video_counts"),pe=new Map;ie==null||ie.forEach(_e=>{pe.set(_e.owner_user_id,_e.video_count)});const{data:se}=await Q.rpc("get_admin_popby_counts"),fe=new Map;se==null||se.forEach(_e=>{fe.set(_e.owner_user_id,_e.popby_count)});const{data:he}=await Q.rpc("get_admin_listing_counts"),ye=new Map;he==null||he.forEach(_e=>{ye.set(_e.agent_id,_e.listing_count)});const{data:Ae}=await Q.rpc("get_admin_deal_counts"),we=new Map;return Ae==null||Ae.forEach(_e=>{we.set(_e.owner_user_id,_e.deal_count)}),G.map(_e=>({id:_e.id,name:_e.name||"Unknown",email:_e.email||"",brokerage_id:_e.brokerage_id,brokerage_name:_e.brokerage_id&&ne.get(_e.brokerage_id)||null,contact_count:ge.get(_e.id)||0,video_count:pe.get(_e.id)||0,popby_count:fe.get(_e.id)||0,listing_count:ye.get(_e.id)||0,deal_count:we.get(_e.id)||0,created_at:_e.created_at}))}}),z=E.useMemo(()=>{if(!T)return[];let G=T.filter(J=>{const ne=e.toLowerCase(),oe=!e||J.name.toLowerCase().includes(ne)||J.email.toLowerCase().includes(ne),ge=n==="all"||n==="none"&&!J.brokerage_id||J.brokerage_id===n,ie=parseInt(u)||0,pe=parseInt(x)||0,se=parseInt(_)||0,fe=parseInt(S)||0,he=J.contact_count>=ie&&J.video_count>=pe&&J.popby_count>=se&&J.listing_count>=fe;return oe&&ge&&he});return G.sort((J,ne)=>{let oe=0;return a==="name"?oe=J.name.localeCompare(ne.name):oe=J[a]-ne[a],l==="asc"?oe:-oe}),G},[T,e,n,a,l,u,x,_,S]),D=G=>{a===G?i(l==="asc"?"desc":"asc"):(o(G),i("desc"))},U=()=>{const G=["Name","Email","Brokerage","Contacts","Videos","Popbys","Listings","Deals"],J=z.map(pe=>[pe.name,pe.email,pe.brokerage_name||"None",pe.contact_count,pe.video_count,pe.popby_count,pe.listing_count,pe.deal_count]),ne=[G.join(","),...J.map(pe=>pe.map(se=>`"${se}"`).join(","))].join(` `),oe=new Blob([ne],{type:"text/csv"}),ge=URL.createObjectURL(oe),ie=document.createElement("a");ie.href=ge,ie.download=`agent-os-user-stats-${new Date().toISOString().split("T")[0]}.csv`,ie.click(),URL.revokeObjectURL(ge)},V=E.useMemo(()=>z.length?z.reduce((G,J)=>({contacts:G.contacts+J.contact_count,videos:G.videos+J.video_count,popbys:G.popbys+J.popby_count,listings:G.listings+J.listing_count,deals:G.deals+J.deal_count}),{contacts:0,videos:0,popbys:0,listings:0,deals:0}):{contacts:0,videos:0,popbys:0,listings:0,deals:0},[z]),W=({field:G,children:J})=>r.jsx(It,{className:"cursor-pointer hover:bg-muted/50 select-none",onClick:()=>D(G),children:r.jsxs("div",{className:"flex items-center gap-1",children:[J,r.jsx(Pg,{className:`h-3 w-3 ${a===G?"text-primary":"text-muted-foreground"}`})]})});return r.jsxs(Ze,{children:[r.jsx(Wt,{children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsxs(Yt,{className:"flex items-center gap-2",children:[r.jsx(Un,{className:"h-5 w-5"}),"User Activity Analytics"]}),r.jsx(Sn,{children:"View all users and their Agent OS usage metrics"})]}),r.jsxs(ee,{variant:"outline",size:"sm",onClick:U,children:[r.jsx(io,{className:"h-4 w-4 mr-2"}),"Export CSV"]})]})}),r.jsxs(et,{className:"space-y-4",children:[r.jsxs("div",{className:"grid gap-4 md:grid-cols-6",children:[r.jsx("div",{className:"md:col-span-2",children:r.jsxs("div",{className:"relative",children:[r.jsx(Sa,{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:G=>t(G.target.value),className:"pl-9"})]})}),r.jsx("div",{children:r.jsxs(mn,{value:n,onValueChange:s,children:[r.jsxs(fn,{children:[r.jsx(hi,{className:"h-4 w-4 mr-2 text-muted-foreground"}),r.jsx(yn,{placeholder:"Brokerage"})]}),r.jsxs(pn,{children:[r.jsx(qt,{value:"all",children:"All Brokerages"}),r.jsx(qt,{value:"none",children:"No Brokerage"}),M==null?void 0:M.map(G=>r.jsx(qt,{value:G.id,children:G.name},G.id))]})]})}),r.jsx("div",{children:r.jsx(dt,{type:"number",placeholder:"Min contacts",value:u,onChange:G=>p(G.target.value),min:"0"})}),r.jsx("div",{children:r.jsx(dt,{type:"number",placeholder:"Min videos",value:x,onChange:G=>y(G.target.value),min:"0"})}),r.jsx("div",{children:r.jsx(dt,{type:"number",placeholder:"Min popbys",value:_,onChange:G=>b(G.target.value),min:"0"})})]}),r.jsxs("div",{className:"grid gap-4 md:grid-cols-6 text-sm",children:[r.jsxs("div",{className:"bg-muted/50 rounded-lg p-3 text-center",children:[r.jsx("div",{className:"text-2xl font-bold",children:z.length}),r.jsx("div",{className:"text-muted-foreground",children:"Users"})]}),r.jsxs("div",{className:"bg-muted/50 rounded-lg p-3 text-center",children:[r.jsx("div",{className:"text-2xl font-bold",children:V.contacts.toLocaleString()}),r.jsx("div",{className:"text-muted-foreground",children:"Total Contacts"})]}),r.jsxs("div",{className:"bg-muted/50 rounded-lg p-3 text-center",children:[r.jsx("div",{className:"text-2xl font-bold",children:V.videos.toLocaleString()}),r.jsx("div",{className:"text-muted-foreground",children:"Total Videos"})]}),r.jsxs("div",{className:"bg-muted/50 rounded-lg p-3 text-center",children:[r.jsx("div",{className:"text-2xl font-bold",children:V.popbys.toLocaleString()}),r.jsx("div",{className:"text-muted-foreground",children:"Total Popbys"})]}),r.jsxs("div",{className:"bg-muted/50 rounded-lg p-3 text-center",children:[r.jsx("div",{className:"text-2xl font-bold",children:V.listings.toLocaleString()}),r.jsx("div",{className:"text-muted-foreground",children:"Total Listings"})]}),r.jsxs("div",{className:"bg-muted/50 rounded-lg p-3 text-center",children:[r.jsx("div",{className:"text-2xl font-bold",children:V.deals.toLocaleString()}),r.jsx("div",{className:"text-muted-foreground",children:"Total Deals"})]})]}),I?r.jsx("div",{className:"flex justify-center py-12",children:r.jsx(Zr,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):r.jsx("div",{className:"rounded-md border",children:r.jsxs(Ks,{children:[r.jsx(Zs,{children:r.jsxs(Mr,{children:[r.jsx(W,{field:"name",children:"Name"}),r.jsx(It,{children:"Email"}),r.jsx(It,{children:"Brokerage"}),r.jsx(W,{field:"contact_count",children:"Contacts"}),r.jsx(W,{field:"video_count",children:"Videos"}),r.jsx(W,{field:"popby_count",children:"Popbys"}),r.jsx(W,{field:"listing_count",children:"Listings"}),r.jsx(W,{field:"deal_count",children:"Deals"})]})}),r.jsx(Ys,{children:z.length===0?r.jsx(Mr,{children:r.jsx(kt,{colSpan:8,className:"text-center py-8 text-muted-foreground",children:"No users found matching your filters"})}):z.map(G=>r.jsxs(Mr,{children:[r.jsx(kt,{className:"font-medium",children:G.name}),r.jsx(kt,{className:"text-muted-foreground",children:G.email}),r.jsx(kt,{children:G.brokerage_name?r.jsx(Pt,{variant:"secondary",children:G.brokerage_name}):r.jsx("span",{className:"text-muted-foreground",children:"—"})}),r.jsx(kt,{children:r.jsx(Pt,{variant:G.contact_count>0?"default":"outline",children:G.contact_count})}),r.jsx(kt,{children:r.jsx(Pt,{variant:G.video_count>0?"default":"outline",children:G.video_count})}),r.jsx(kt,{children:r.jsx(Pt,{variant:G.popby_count>0?"default":"outline",children:G.popby_count})}),r.jsx(kt,{children:r.jsx(Pt,{variant:G.listing_count>0?"default":"outline",children:G.listing_count})}),r.jsx(kt,{children:r.jsx(Pt,{variant:G.deal_count>0?"default":"outline",children:G.deal_count})})]},G.id))})]})})]})]})}function BCt(){_i(),Hr();const[e,t]=E.useState("user-analytics"),{data:n}=Kt({queryKey:["admin-feature-flags"],queryFn:async()=>{const{data:b,error:S}=await Q.from("feature_flags").select("*").order("key");if(S)throw S;return b}}),{data:s,isLoading:a}=Kt({queryKey:["admin-relationship-types"],queryFn:async()=>{const{data:b,error:S}=await Q.from("relationship_types").select("*").order("sort_order");if(S)throw S;return b}}),{data:o,isLoading:l}=Kt({queryKey:["admin-action-types"],queryFn:async()=>{const{data:b,error:S}=await Q.from("action_types").select("*").order("sort_order");if(S)throw S;return b}}),{data:i,isLoading:u}=Kt({queryKey:["admin-action-scripts"],queryFn:async()=>{const{data:b,error:S}=await Q.from("action_scripts").select("*, action_type:action_types(*)");if(S)throw S;return b}}),{data:p,isLoading:x}=Kt({queryKey:["admin-touchpoint-plans"],queryFn:async()=>{const{data:b,error:S}=await Q.from("touchpoint_plans").select("*").order("name");if(S)throw S;return b}}),{data:y,isLoading:_}=Kt({queryKey:["admin-popby-items"],queryFn:async()=>{const{data:b,error:S}=await Q.from("popby_items").select("*").is("owner_user_id",null).order("name");if(S)throw S;return b}});return r.jsx(Dr,{title:"Agent OS Control Center",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Mu,{title:"Agent OS Control Center",description:"Manage InnerCircle settings, scripts, and touchpoint plans"}),r.jsxs(Ai,{value:e,onValueChange:t,children:[r.jsxs(vi,{className:"grid w-full grid-cols-9",children:[r.jsxs(sn,{value:"user-analytics",className:"gap-2",children:[r.jsx(_c,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline",children:"Users"})]}),r.jsxs(sn,{value:"relationship-types",className:"gap-2",children:[r.jsx(Un,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline",children:"Relationships"})]}),r.jsxs(sn,{value:"action-types",className:"gap-2",children:[r.jsx(Ti,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline",children:"Actions"})]}),r.jsxs(sn,{value:"scripts",className:"gap-2",children:[r.jsx(Ea,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline",children:"Scripts"})]}),r.jsxs(sn,{value:"video-scripts",className:"gap-2",children:[r.jsx(eu,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline",children:"Video Scripts"})]}),r.jsxs(sn,{value:"plans",className:"gap-2",children:[r.jsx(Ss,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline",children:"Plans"})]}),r.jsxs(sn,{value:"popbys",className:"gap-2",children:[r.jsx(to,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline",children:"Popbys"})]}),r.jsxs(sn,{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(sn,{value:"feature-flags",className:"gap-2",children:[r.jsx(ly,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline",children:"Flags"})]})]}),r.jsx(Mn,{value:"user-analytics",className:"mt-6",children:r.jsx(zCt,{})}),r.jsx(Mn,{value:"relationship-types",className:"mt-6",children:r.jsx($Ct,{types:s||[],isLoading:a})}),r.jsx(Mn,{value:"action-types",className:"mt-6",children:r.jsx(UCt,{types:o||[],isLoading:l})}),r.jsx(Mn,{value:"scripts",className:"mt-6",children:r.jsx(qCt,{scripts:i||[],actionTypes:o||[],isLoading:u})}),r.jsx(Mn,{value:"video-scripts",className:"mt-6",children:r.jsx(GCt,{})}),r.jsx(Mn,{value:"plans",className:"mt-6",children:r.jsx(VCt,{plans:p||[],actionTypes:o||[],scripts:i||[],isLoading:x})}),r.jsx(Mn,{value:"popbys",className:"mt-6",children:r.jsx(WCt,{items:y||[],isLoading:_})}),r.jsx(Mn,{value:"settings",className:"mt-6",children:r.jsx(KCt,{})}),r.jsx(Mn,{value:"feature-flags",className:"mt-6",children:r.jsx(HCt,{flags:n||[]})})]})]})})}function $Ct({types:e,isLoading:t}){const{toast:n}=_i(),s=Hr(),[a,o]=E.useState(null),[l,i]=E.useState(!1),u=ir({mutationFn:async x=>{if(x.id){const{error:y}=await Q.from("relationship_types").update({name:x.name,description:x.description,icon:x.icon}).eq("id",x.id);if(y)throw y}else{const{error:y}=await Q.from("relationship_types").insert([{name:x.name,description:x.description,icon:x.icon,sort_order:e.length}]);if(y)throw y}},onSuccess:()=>{s.invalidateQueries({queryKey:["admin-relationship-types"]}),i(!1),o(null),n({title:"Saved successfully"})},onError:x=>{n({title:"Error",description:x.message,variant:"destructive"})}}),p=async x=>{await Q.from("relationship_types").update({active:!x.active}).eq("id",x.id),s.invalidateQueries({queryKey:["admin-relationship-types"]})};return r.jsxs(Ze,{children:[r.jsxs(Wt,{className:"flex flex-row items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Yt,{children:"Relationship Types"}),r.jsx(Sn,{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(et,{children:t?r.jsx("div",{className:"flex justify-center py-8",children:r.jsx(Zr,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):r.jsxs(Ks,{children:[r.jsx(Zs,{children:r.jsxs(Mr,{children:[r.jsx(It,{className:"w-12"}),r.jsx(It,{children:"Name"}),r.jsx(It,{children:"Description"}),r.jsx(It,{children:"Status"}),r.jsx(It,{className:"w-24",children:"Actions"})]})}),r.jsx(Ys,{children:e.map(x=>r.jsxs(Mr,{children:[r.jsx(kt,{children:r.jsx(dy,{className:"h-4 w-4 text-muted-foreground cursor-grab"})}),r.jsx(kt,{className:"font-medium",children:x.name}),r.jsx(kt,{className:"text-muted-foreground",children:x.description}),r.jsx(kt,{children:r.jsx(Ts,{checked:x.active,onCheckedChange:()=>p(x)})}),r.jsx(kt,{children:r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>{o(x),i(!0)},children:r.jsx(ni,{className:"h-4 w-4"})})})]},x.id))})]})}),r.jsx(Or,{open:l,onOpenChange:i,children:r.jsxs(Ir,{children:[r.jsx($r,{children:r.jsxs(Fr,{children:[a?"Edit":"Add"," Relationship Type"]})}),r.jsxs("form",{onSubmit:x=>{x.preventDefault();const y=new FormData(x.currentTarget);u.mutate({id:a==null?void 0:a.id,name:y.get("name"),description:y.get("description"),icon:y.get("icon")})},children:[r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx($e,{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($e,{htmlFor:"description",children:"Description"}),r.jsx(Jn,{id:"description",name:"description",defaultValue:(a==null?void 0:a.description)||""})]}),r.jsxs("div",{children:[r.jsx($e,{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(Bs,{className:"mt-4",children:[r.jsx(ee,{type:"button",variant:"outline",onClick:()=>i(!1),children:"Cancel"}),r.jsxs(ee,{type:"submit",disabled:u.isPending,children:[u.isPending&&r.jsx(Zr,{className:"h-4 w-4 mr-2 animate-spin"}),"Save"]})]})]})]})})]})}function UCt({types:e,isLoading:t}){const{toast:n}=_i(),s=Hr(),[a,o]=E.useState(null),[l,i]=E.useState(!1),u=ir({mutationFn:async x=>{if(x.id){const{error:y}=await Q.from("action_types").update({name:x.name,description:x.description,icon:x.icon,color:x.color}).eq("id",x.id);if(y)throw y}else{const{error:y}=await Q.from("action_types").insert([{name:x.name,description:x.description,icon:x.icon,color:x.color,sort_order:e.length}]);if(y)throw y}},onSuccess:()=>{s.invalidateQueries({queryKey:["admin-action-types"]}),i(!1),o(null),n({title:"Saved successfully"})},onError:x=>{n({title:"Error",description:x.message,variant:"destructive"})}}),p=async x=>{await Q.from("action_types").update({active:!x.active}).eq("id",x.id),s.invalidateQueries({queryKey:["admin-action-types"]})};return r.jsxs(Ze,{children:[r.jsxs(Wt,{className:"flex flex-row items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Yt,{children:"Action Types"}),r.jsx(Sn,{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(et,{children:t?r.jsx("div",{className:"flex justify-center py-8",children:r.jsx(Zr,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):r.jsxs(Ks,{children:[r.jsx(Zs,{children:r.jsxs(Mr,{children:[r.jsx(It,{children:"Name"}),r.jsx(It,{children:"Description"}),r.jsx(It,{children:"Color"}),r.jsx(It,{children:"Status"}),r.jsx(It,{className:"w-24",children:"Actions"})]})}),r.jsx(Ys,{children:e.map(x=>r.jsxs(Mr,{children:[r.jsx(kt,{className:"font-medium",children:x.name}),r.jsx(kt,{className:"text-muted-foreground",children:x.description}),r.jsx(kt,{children:x.color&&r.jsx("div",{className:"w-6 h-6 rounded",style:{backgroundColor:x.color}})}),r.jsx(kt,{children:r.jsx(Ts,{checked:x.active,onCheckedChange:()=>p(x)})}),r.jsx(kt,{children:r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>{o(x),i(!0)},children:r.jsx(ni,{className:"h-4 w-4"})})})]},x.id))})]})}),r.jsx(Or,{open:l,onOpenChange:i,children:r.jsxs(Ir,{children:[r.jsx($r,{children:r.jsxs(Fr,{children:[a?"Edit":"Add"," Action Type"]})}),r.jsxs("form",{onSubmit:x=>{x.preventDefault();const y=new FormData(x.currentTarget);u.mutate({id:a==null?void 0:a.id,name:y.get("name"),description:y.get("description"),icon:y.get("icon"),color:y.get("color")})},children:[r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx($e,{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($e,{htmlFor:"description",children:"Description"}),r.jsx(Jn,{id:"description",name:"description",defaultValue:(a==null?void 0:a.description)||""})]}),r.jsxs("div",{children:[r.jsx($e,{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($e,{htmlFor:"color",children:"Color"}),r.jsx(dt,{id:"color",name:"color",type:"color",defaultValue:(a==null?void 0:a.color)||"#6366f1"})]})]}),r.jsxs(Bs,{className:"mt-4",children:[r.jsx(ee,{type:"button",variant:"outline",onClick:()=>i(!1),children:"Cancel"}),r.jsxs(ee,{type:"submit",disabled:u.isPending,children:[u.isPending&&r.jsx(Zr,{className:"h-4 w-4 mr-2 animate-spin"}),"Save"]})]})]})]})})]})}function qCt({scripts:e,actionTypes:t,isLoading:n}){const{toast:s}=_i(),a=Hr(),[o,l]=E.useState(null),[i,u]=E.useState(!1),p=ir({mutationFn:async y=>{if(y.id){const{error:_}=await Q.from("action_scripts").update({title:y.title,action_type_id:y.action_type_id,tone:y.tone,script_body:y.script_body,active:y.active}).eq("id",y.id);if(_)throw _}else{const{error:_}=await Q.from("action_scripts").insert([{title:y.title,action_type_id:y.action_type_id,tone:y.tone,script_body:y.script_body,active:!0}]);if(_)throw _}},onSuccess:()=>{a.invalidateQueries({queryKey:["admin-action-scripts"]}),u(!1),l(null),s({title:"Saved successfully"})},onError:y=>{s({title:"Error",description:y.message,variant:"destructive"})}}),x=ir({mutationFn:async y=>{const{error:_}=await Q.from("action_scripts").delete().eq("id",y);if(_)throw _},onSuccess:()=>{a.invalidateQueries({queryKey:["admin-action-scripts"]}),s({title:"Deleted successfully"})}});return r.jsxs(Ze,{children:[r.jsxs(Wt,{className:"flex flex-row items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Yt,{children:"Script Library"}),r.jsx(Sn,{children:"Create and manage scripts for each action type"})]}),r.jsxs(ee,{onClick:()=>{l(null),u(!0)},children:[r.jsx(bn,{className:"h-4 w-4 mr-2"}),"Add Script"]})]}),r.jsx(et,{children:n?r.jsx("div",{className:"flex justify-center py-8",children:r.jsx(Zr,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):r.jsxs(Ks,{children:[r.jsx(Zs,{children:r.jsxs(Mr,{children:[r.jsx(It,{children:"Title"}),r.jsx(It,{children:"Action Type"}),r.jsx(It,{children:"Tone"}),r.jsx(It,{children:"Status"}),r.jsx(It,{className:"w-24",children:"Actions"})]})}),r.jsx(Ys,{children:e.map(y=>{var _;return r.jsxs(Mr,{children:[r.jsx(kt,{className:"font-medium",children:y.title}),r.jsx(kt,{children:r.jsx(Pt,{variant:"outline",children:((_=y.action_type)==null?void 0:_.name)||"Unknown"})}),r.jsx(kt,{className:"text-muted-foreground",children:y.tone}),r.jsx(kt,{children:r.jsx(Pt,{variant:y.active?"default":"secondary",children:y.active?"Active":"Inactive"})}),r.jsxs(kt,{className:"flex gap-1",children:[r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>{l(y),u(!0)},children:r.jsx(ni,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>x.mutate(y.id),children:r.jsx(Bn,{className:"h-4 w-4 text-destructive"})})]})]},y.id)})})]})}),r.jsx(Or,{open:i,onOpenChange:u,children:r.jsxs(Ir,{className:"max-w-2xl",children:[r.jsx($r,{children:r.jsxs(Fr,{children:[o?"Edit":"Add"," Script"]})}),r.jsxs("form",{onSubmit:y=>{y.preventDefault();const _=new FormData(y.currentTarget);p.mutate({id:o==null?void 0:o.id,title:_.get("title"),action_type_id:_.get("action_type_id"),tone:_.get("tone"),script_body:_.get("script_body"),active:!0})},children:[r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx($e,{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($e,{htmlFor:"action_type_id",children:"Action Type"}),r.jsxs(mn,{name:"action_type_id",defaultValue:o==null?void 0:o.action_type_id,children:[r.jsx(fn,{children:r.jsx(yn,{placeholder:"Select action type"})}),r.jsx(pn,{children:t.map(y=>r.jsx(qt,{value:y.id,children:y.name},y.id))})]})]})]}),r.jsxs("div",{children:[r.jsx($e,{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($e,{htmlFor:"script_body",children:"Script Body"}),r.jsx(Jn,{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(Bs,{className:"mt-4",children:[r.jsx(ee,{type:"button",variant:"outline",onClick:()=>u(!1),children:"Cancel"}),r.jsxs(ee,{type:"submit",disabled:p.isPending,children:[p.isPending&&r.jsx(Zr,{className:"h-4 w-4 mr-2 animate-spin"}),"Save"]})]})]})]})})]})}function VCt({plans:e,actionTypes:t,scripts:n,isLoading:s}){const{toast:a}=_i(),o=Hr(),[l,i]=E.useState(null),[u,p]=E.useState(!1),[x,y]=E.useState(null),[_,b]=E.useState(!1),[S,k]=E.useState(null),[M,P]=E.useState(null),{data:T}=Kt({queryKey:["plan-items",x],queryFn:async()=>{if(!x)return[];const{data:G,error:J}=await Q.from("touchpoint_plan_items").select("*").eq("plan_id",x).order("month_number");if(J)throw J;return G},enabled:!!x}),I=ir({mutationFn:async G=>{if(G.id){const{error:J}=await Q.from("touchpoint_plans").update({name:G.name,description:G.description,active:G.active}).eq("id",G.id);if(J)throw J}else{const{error:J}=await Q.from("touchpoint_plans").insert([{name:G.name,description:G.description,active:!0}]);if(J)throw J}},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=ir({mutationFn:async G=>{if(G.id){const{error:J}=await Q.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(J)throw J}else{const{error:J}=await Q.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(J)throw J}},onSuccess:()=>{o.invalidateQueries({queryKey:["plan-items",x]}),a({title:"Item saved"})}}),D=ir({mutationFn:async G=>{const{error:J}=await Q.from("touchpoint_plan_items").delete().eq("id",G);if(J)throw J},onSuccess:()=>{o.invalidateQueries({queryKey:["plan-items",x]})}}),U=ir({mutationFn:async G=>{const{data:J,error:ne}=await Q.from("action_scripts").insert([{...G,active:!0}]).select().single();if(ne)throw ne;return J},onSuccess:async G=>{o.invalidateQueries({queryKey:["admin-action-scripts"]}),S&&await z.mutateAsync({id:S.itemId,plan_id:x,month_number:S.month,action_type_id:S.actionTypeId,default_script_id:G.id}),b(!1),k(null),a({title:"Script created and assigned"})},onError:G=>{a({title:"Error",description:G.message,variant:"destructive"})}}),V=(G,J,ne)=>{k({month:G,actionTypeId:J,itemId:ne}),b(!0)},W=G=>n.find(J=>J.id===G);return r.jsxs("div",{className:"space-y-6",children:[r.jsxs(Ze,{children:[r.jsxs(Wt,{className:"flex flex-row items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Yt,{children:"Touchpoint Plans"}),r.jsx(Sn,{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(et,{children:s?r.jsx("div",{className:"flex justify-center py-8",children:r.jsx(Zr,{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:e.map(G=>r.jsxs(Ze,{className:`cursor-pointer transition-colors ${x===G.id?"border-primary":""}`,onClick:()=>y(G.id),children:[r.jsx(Wt,{className:"pb-2",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx(Yt,{className:"text-base",children:G.name}),r.jsx(ee,{variant:"ghost",size:"icon",onClick:J=>{J.stopPropagation(),i(G),p(!0)},children:r.jsx(ni,{className:"h-4 w-4"})})]})}),r.jsxs(et,{children:[r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2",children:G.description}),r.jsx(Pt,{variant:G.active?"default":"secondary",className:"mt-2",children:G.active?"Active":"Inactive"})]})]},G.id))})})]}),x&&r.jsxs(Ze,{children:[r.jsxs(Wt,{children:[r.jsx(Yt,{children:"Plan Schedule"}),r.jsx(Sn,{children:"Configure the monthly touchpoint schedule. Select an action type for each month, then assign or create a script."})]}),r.jsx(et,{children:r.jsx("div",{className:"grid gap-3",children:Array.from({length:12},(G,J)=>J+1).map(G=>{const J=T==null?void 0:T.find(ge=>ge.month_number===G),ne=J!=null&&J.default_script_id?W(J.default_script_id):null,oe=n.filter(ge=>ge.action_type_id===(J==null?void 0:J.action_type_id)&&ge.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(mn,{value:(J==null?void 0:J.action_type_id)||"none",onValueChange:ge=>{ge==="none"&&J?D.mutate(J.id):ge!=="none"&&z.mutate({id:J==null?void 0:J.id,plan_id:x,month_number:G,action_type_id:ge,default_script_id:null})},children:[r.jsx(fn,{className:"w-40",children:r.jsx(yn,{placeholder:"No action"})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"none",children:"No action"}),t.filter(ge=>ge.active).map(ge=>r.jsx(qt,{value:ge.id,children:r.jsxs("span",{className:"flex items-center gap-2",children:[ge.color&&r.jsx("span",{className:"w-3 h-3 rounded-full",style:{backgroundColor:ge.color}}),ge.name]})},ge.id))]})]}),J&&r.jsxs(r.Fragment,{children:[r.jsxs(mn,{value:J.default_script_id||"none",onValueChange:ge=>{P(null),z.mutate({id:J.id,default_script_id:ge==="none"?null:ge})},children:[r.jsx(fn,{className:"w-56",children:r.jsx(yn,{placeholder:"Select script"})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"none",children:"No default script"}),oe.map(ge=>r.jsxs(qt,{value:ge.id,children:[ge.title," ",ge.tone&&`(${ge.tone})`]},ge.id))]})]}),r.jsxs(ee,{variant:"outline",size:"sm",onClick:()=>V(G,J.action_type_id,J.id),children:[r.jsx(bn,{className:"h-3 w-3 mr-1"}),"New Script"]}),ne&&r.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>P((M==null?void 0:M.id)===ne.id?null:ne),children:(M==null?void 0:M.id)===ne.id?"Hide":"Preview"})]})]}),M&&(J==null?void 0:J.default_script_id)===M.id&&r.jsxs("div",{className:"ml-24 p-3 bg-muted rounded-lg text-sm",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[r.jsx(Pt,{variant:"outline",children:M.title}),M.tone&&r.jsx(Pt,{variant:"secondary",children:M.tone})]}),r.jsx("p",{className:"text-muted-foreground whitespace-pre-wrap",children:M.script_body})]})]},G)})})})]}),r.jsx(Or,{open:u,onOpenChange:p,children:r.jsxs(Ir,{children:[r.jsx($r,{children:r.jsxs(Fr,{children:[l?"Edit":"Add"," Touchpoint Plan"]})}),r.jsxs("form",{onSubmit:G=>{G.preventDefault();const J=new FormData(G.currentTarget);I.mutate({id:l==null?void 0:l.id,name:J.get("name"),description:J.get("description"),active:!0})},children:[r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx($e,{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($e,{htmlFor:"description",children:"Description"}),r.jsx(Jn,{id:"description",name:"description",defaultValue:(l==null?void 0:l.description)||"",rows:3})]})]}),r.jsxs(Bs,{className:"mt-4",children:[r.jsx(ee,{type:"button",variant:"outline",onClick:()=>p(!1),children:"Cancel"}),r.jsxs(ee,{type:"submit",disabled:I.isPending,children:[I.isPending&&r.jsx(Zr,{className:"h-4 w-4 mr-2 animate-spin"}),"Save"]})]})]})]})}),r.jsx(Or,{open:_,onOpenChange:b,children:r.jsxs(Ir,{className:"max-w-2xl",children:[r.jsxs($r,{children:[r.jsx(Fr,{children:"Create New Script"}),r.jsxs(Zn,{children:["Create a script for Month ",S==null?void 0:S.month,". Use ","{{FirstName}}",", ","{{LastName}}",", and ","{{AgentName}}"," as placeholders."]})]}),r.jsxs("form",{onSubmit:G=>{G.preventDefault();const J=new FormData(G.currentTarget);U.mutate({title:J.get("title"),action_type_id:S.actionTypeId,tone:J.get("tone"),script_body:J.get("script_body")})},children:[r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx($e,{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($e,{htmlFor:"script_tone",children:"Tone"}),r.jsx(dt,{id:"script_tone",name:"tone",placeholder:"e.g., Friendly, Professional"})]})]}),r.jsxs("div",{children:[r.jsx($e,{htmlFor:"script_body",children:"Script Body"}),r.jsx(Jn,{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(Bs,{className:"mt-4",children:[r.jsx(ee,{type:"button",variant:"outline",onClick:()=>b(!1),children:"Cancel"}),r.jsxs(ee,{type:"submit",disabled:U.isPending,children:[U.isPending&&r.jsx(Zr,{className:"h-4 w-4 mr-2 animate-spin"}),"Create & Assign"]})]})]})]})})]})}function HCt({flags:e}){const{toast:t}=_i(),n=Hr(),s=async(a,o)=>{const{error:l}=await Q.from("feature_flags").update({...o,updated_at:new Date().toISOString()}).eq("id",a.id);l?t({title:"Error",description:l.message,variant:"destructive"}):(n.invalidateQueries({queryKey:["admin-feature-flags"]}),t({title:"Flag updated"}))};return r.jsxs(Ze,{children:[r.jsxs(Wt,{children:[r.jsx(Yt,{children:"Feature Flags"}),r.jsx(Sn,{children:"Control which features are enabled for members"})]}),r.jsx(et,{children:r.jsxs(Ks,{children:[r.jsx(Zs,{children:r.jsxs(Mr,{children:[r.jsx(It,{children:"Flag"}),r.jsx(It,{children:"Status"}),r.jsx(It,{children:"Notes"}),r.jsx(It,{children:"Last Updated"})]})}),r.jsx(Ys,{children:e.map(a=>r.jsxs(Mr,{children:[r.jsx(kt,{className:"font-mono text-sm",children:a.key}),r.jsx(kt,{children:r.jsx(Ts,{checked:a.enabled,onCheckedChange:o=>s(a,{enabled:o})})}),r.jsx(kt,{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(kt,{className:"text-muted-foreground text-sm",children:new Date(a.updated_at).toLocaleDateString()})]},a.id))})]})})]})}function WCt({items:e,isLoading:t}){const{toast:n}=_i(),s=Hr(),[a,o]=E.useState(null),[l,i]=E.useState(!1),u=ir({mutationFn:async y=>{if(y.id){const{error:_}=await Q.from("popby_items").update({name:y.name,description:y.description}).eq("id",y.id);if(_)throw _}else{const{error:_}=await Q.from("popby_items").insert([{name:y.name,description:y.description,owner_user_id:null}]);if(_)throw _}},onSuccess:()=>{s.invalidateQueries({queryKey:["admin-popby-items"]}),s.invalidateQueries({queryKey:["popby-items"]}),i(!1),o(null),n({title:"Saved successfully"})},onError:y=>{n({title:"Error",description:y.message,variant:"destructive"})}}),p=async y=>{await Q.from("popby_items").update({is_active:!y.is_active}).eq("id",y.id),s.invalidateQueries({queryKey:["admin-popby-items"]}),s.invalidateQueries({queryKey:["popby-items"]})},x=async y=>{await Q.from("popby_items").delete().eq("id",y),s.invalidateQueries({queryKey:["admin-popby-items"]}),s.invalidateQueries({queryKey:["popby-items"]}),n({title:"Deleted successfully"})};return r.jsxs(Ze,{children:[r.jsxs(Wt,{className:"flex flex-row items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Yt,{children:"Popby Ideas"}),r.jsx(Sn,{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(et,{children:t?r.jsx("div",{className:"flex justify-center py-8",children:r.jsx(Zr,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):e.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(to,{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(Ks,{children:[r.jsx(Zs,{children:r.jsxs(Mr,{children:[r.jsx(It,{children:"Name"}),r.jsx(It,{children:"Description"}),r.jsx(It,{children:"Status"}),r.jsx(It,{className:"w-24",children:"Actions"})]})}),r.jsx(Ys,{children:e.map(y=>r.jsxs(Mr,{children:[r.jsx(kt,{className:"font-medium",children:y.name}),r.jsx(kt,{className:"text-muted-foreground",children:y.description}),r.jsx(kt,{children:r.jsx(Ts,{checked:y.is_active,onCheckedChange:()=>p(y)})}),r.jsx(kt,{children:r.jsxs("div",{className:"flex gap-1",children:[r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>{o(y),i(!0)},children:r.jsx(ni,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>x(y.id),children:r.jsx(Bn,{className:"h-4 w-4 text-destructive"})})]})})]},y.id))})]})}),r.jsx(Or,{open:l,onOpenChange:i,children:r.jsxs(Ir,{children:[r.jsx($r,{children:r.jsxs(Fr,{children:[a?"Edit":"Add"," Popby Idea"]})}),r.jsxs("form",{onSubmit:y=>{y.preventDefault();const _=new FormData(y.currentTarget);u.mutate({id:a==null?void 0:a.id,name:_.get("name"),description:_.get("description")})},children:[r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx($e,{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($e,{htmlFor:"description",children:"Description"}),r.jsx(Jn,{id:"description",name:"description",defaultValue:(a==null?void 0:a.description)||"",placeholder:"Brief description of the popby idea..."})]})]}),r.jsxs(Bs,{className:"mt-4",children:[r.jsx(ee,{type:"button",variant:"outline",onClick:()=>i(!1),children:"Cancel"}),r.jsxs(ee,{type:"submit",disabled:u.isPending,children:[u.isPending&&r.jsx(Zr,{className:"h-4 w-4 mr-2 animate-spin"}),"Save"]})]})]})]})})]})}function GCt(){var b;const{toast:e}=_i(),t=Hr(),[n,s]=E.useState(null),[a,o]=E.useState(!1),{data:l,isLoading:i}=Kt({queryKey:["admin-video-script-categories"],queryFn:async()=>{const{data:S,error:k}=await Q.from("video_script_categories").select("*").order("sort_order");if(k)throw k;return S}}),{data:u,isLoading:p}=Kt({queryKey:["admin-video-scripts"],queryFn:async()=>{const{data:S,error:k}=await Q.from("video_scripts").select("*, category:video_script_categories(*)").order("title");if(k)throw k;return S}}),x=ir({mutationFn:async S=>{var k,M;if(S.id){const{error:P}=await Q.from("video_scripts").update({title:S.title,script_text:S.script_text,category_id:S.category_id,tags:((k=S.tags)==null?void 0:k.split(",").map(T=>T.trim()).filter(Boolean))||[]}).eq("id",S.id);if(P)throw P}else{const{error:P}=await Q.from("video_scripts").insert([{title:S.title,script_text:S.script_text,category_id:S.category_id||null,tags:((M=S.tags)==null?void 0:M.split(",").map(T=>T.trim()).filter(Boolean))||[]}]);if(P)throw P}},onSuccess:()=>{t.invalidateQueries({queryKey:["admin-video-scripts"]}),o(!1),s(null),e({title:"Video script saved!"})},onError:S=>e({title:"Error",description:S.message,variant:"destructive"})}),y=async S=>{await Q.from("video_scripts").update({is_active:!S.is_active}).eq("id",S.id),t.invalidateQueries({queryKey:["admin-video-scripts"]})},_=async S=>{confirm("Delete this video script?")&&(await Q.from("video_scripts").delete().eq("id",S),t.invalidateQueries({queryKey:["admin-video-scripts"]}),e({title:"Script deleted"}))};return r.jsxs(Ze,{children:[r.jsxs(Wt,{className:"flex flex-row items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Yt,{children:"Video Scripts"}),r.jsx(Sn,{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(et,{children:p?r.jsx("div",{className:"flex justify-center py-8",children:r.jsx(Zr,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):r.jsxs(Ks,{children:[r.jsx(Zs,{children:r.jsxs(Mr,{children:[r.jsx(It,{children:"Title"}),r.jsx(It,{children:"Category"}),r.jsx(It,{children:"Status"}),r.jsx(It,{className:"w-24",children:"Actions"})]})}),r.jsx(Ys,{children:u==null?void 0:u.map(S=>{var k;return r.jsxs(Mr,{children:[r.jsx(kt,{className:"font-medium",children:S.title}),r.jsx(kt,{className:"text-muted-foreground",children:((k=S.category)==null?void 0:k.name)||"Uncategorized"}),r.jsx(kt,{children:r.jsx(Ts,{checked:S.is_active,onCheckedChange:()=>y(S)})}),r.jsxs(kt,{className:"flex gap-1",children:[r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>{s(S),o(!0)},children:r.jsx(ni,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>_(S.id),children:r.jsx(Bn,{className:"h-4 w-4"})})]})]},S.id)})})]})}),r.jsx(Or,{open:a,onOpenChange:o,children:r.jsxs(Ir,{className:"max-w-2xl",children:[r.jsx($r,{children:r.jsxs(Fr,{children:[n?"Edit":"Add"," Video Script"]})}),r.jsxs("form",{onSubmit:S=>{S.preventDefault();const k=new FormData(S.currentTarget);x.mutate({id:n==null?void 0:n.id,title:k.get("title"),script_text:k.get("script_text"),category_id:k.get("category_id")||null,tags:k.get("tags")})},children:[r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx($e,{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($e,{htmlFor:"category_id",children:"Category"}),r.jsxs(mn,{name:"category_id",defaultValue:(n==null?void 0:n.category_id)||"",children:[r.jsx(fn,{children:r.jsx(yn,{placeholder:"Select category"})}),r.jsx(pn,{children:l==null?void 0:l.map(S=>r.jsx(qt,{value:S.id,children:S.name},S.id))})]})]}),r.jsxs("div",{children:[r.jsx($e,{htmlFor:"script_text",children:"Script Text"}),r.jsx(Jn,{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($e,{htmlFor:"tags",children:"Tags (comma-separated)"}),r.jsx(dt,{id:"tags",name:"tags",defaultValue:((b=n==null?void 0:n.tags)==null?void 0:b.join(", "))||"",placeholder:"birthday, follow-up, thank-you"})]})]}),r.jsxs(Bs,{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(Zr,{className:"h-4 w-4 mr-2 animate-spin"}),"Save"]})]})]})]})})]})}function KCt(){const{toast:e}=_i(),[t,n]=E.useState(""),[s,a]=E.useState(!0),[o,l]=E.useState(!1);E.useEffect(()=>{(async()=>{a(!0);try{const{data:p}=await Q.from("settings").select("value").eq("key","mapbox_public_token").maybeSingle();p!=null&&p.value&&n(p.value)}catch(p){console.error("Error fetching settings:",p)}a(!1)})()},[]);const i=async()=>{l(!0);try{await Q.from("settings").upsert({key:"mapbox_public_token",value:t.trim()}),e({title:"Mapbox token saved!"})}catch{e({title:"Error saving token",variant:"destructive"})}l(!1)};return s?r.jsx(Ze,{children:r.jsx(et,{className:"flex justify-center py-8",children:r.jsx(Zr,{className:"h-8 w-8 animate-spin text-muted-foreground"})})}):r.jsx("div",{className:"space-y-6",children:r.jsxs(Ze,{children:[r.jsxs(Wt,{children:[r.jsxs(Yt,{className:"flex items-center gap-2",children:[r.jsx(Po,{className:"h-5 w-5"}),"Popby Map Settings"]}),r.jsx(Sn,{children:"Configure the map feature for popbys"})]}),r.jsxs(et,{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{htmlFor:"mapbox-token",children:"Mapbox Public Token"}),r.jsx(dt,{id:"mapbox-token",placeholder:"pk.eyJ1I...",value:t,onChange:u=>n(u.target.value)}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Get your token at"," ",r.jsx("a",{href:"https://mapbox.com/",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"mapbox.com"}),". This token will be used by all agents for the popby map feature."]})]}),r.jsxs(ee,{onClick:i,disabled:o,children:[o&&r.jsx(Zr,{className:"h-4 w-4 mr-2 animate-spin"}),"Save Token"]}),t&&r.jsx(Pt,{variant:"secondary",className:"ml-2",children:"Token configured"})]})]})})}const ZCt=()=>{const[e,t]=E.useState(""),[n,s]=E.useState("grid"),a=Gn(),{data:o=[],isLoading:l}=Kt({queryKey:["additional-services"],queryFn:async()=>{const{data:u,error:p}=await Q.from("additional_services").select("*").eq("is_published",!0).order("publish_date",{ascending:!1});if(p)throw p;return u}}),i=o.filter(u=>{var x;return u.name.toLowerCase().includes(e.toLowerCase())||((x=u.description)==null?void 0:x.toLowerCase().includes(e.toLowerCase()))});return r.jsx(Dr,{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(Sa,{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:e,onChange:u=>t(u.target.value),className:"pl-9"})]}),r.jsxs("div",{className:"flex gap-2",children:[e&&r.jsx(ee,{variant:"outline",size:"sm",onClick:()=>t(""),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(dp,{className:"h-4 w-4"})}),r.jsx(ee,{variant:n==="list"?"secondary":"outline",size:"icon",onClick:()=>s("list"),className:"rounded-full",children:r.jsx(up,{className:"h-4 w-4"})})]})]})]}),r.jsxs("div",{className:"text-sm text-muted-foreground",children:[i.length," service",i.length!==1?"s":""," found"]}),l&&r.jsx("div",{className:n==="grid"?"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6":"space-y-4",children:[...Array(4)].map((u,p)=>r.jsx(Ze,{children:r.jsxs(et,{className:"p-4",children:[r.jsx(Lr,{className:"aspect-[3/2] w-full rounded-lg mb-4"}),r.jsx(Lr,{className:"h-5 w-3/4 mb-2"}),r.jsx(Lr,{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:e?"No services match your search":"No additional services available yet"}),e&&r.jsx(ee,{variant:"outline",onClick:()=>t(""),children:"Clear Search"})]}),!l&&i.length>0&&r.jsx("div",{className:n==="grid"?"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6":"space-y-4",children:i.map(u=>r.jsxs(Ze,{className:`group overflow-hidden hover:shadow-lg transition-all duration-200 cursor-pointer ${n==="list"?"flex flex-row":""}`,onClick:()=>a(`/additional-services/${u.id}`),children:[r.jsx("div",{className:`relative overflow-hidden bg-muted ${n==="list"?"w-48 shrink-0":"aspect-[3/2]"}`,children:u.preview_image_url?r.jsx("img",{src:u.preview_image_url,alt:u.name,className:"w-full h-full object-contain group-hover:scale-105 transition-transform duration-300"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center text-muted-foreground",children:r.jsx(Ls,{className:"h-8 w-8"})})}),r.jsxs(et,{className:`p-4 flex flex-col ${n==="list"?"flex-1":""}`,children:[r.jsx("h3",{className:"font-semibold text-foreground line-clamp-1 mb-1",children:u.name}),u.description&&r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 flex-1",children:xse(u.description)})]})]},u.id))})]})})},YCt=()=>{const{serviceId:e}=md(),t=Gn(),{data:n,isLoading:s}=Kt({queryKey:["additional-service",e],queryFn:async()=>{const{data:a,error:o}=await Q.from("additional_services").select("*").eq("id",e).eq("is_published",!0).single();if(o)throw o;return a},enabled:!!e});return s?r.jsx(Dr,{title:"Loading...",children:r.jsxs("div",{className:"max-w-4xl mx-auto space-y-6",children:[r.jsx(Lr,{className:"h-8 w-48"}),r.jsx(Lr,{className:"h-64 w-full rounded-lg"}),r.jsx(Lr,{className:"h-24 w-full"})]})}):n?r.jsx(Dr,{title:n.name,children:r.jsxs("div",{className:"max-w-4xl mx-auto space-y-6",children:[r.jsxs(ee,{variant:"ghost",onClick:()=>t("/additional-services"),className:"gap-2",children:[r.jsx(po,{className:"h-4 w-4"}),"Back to Services"]}),r.jsx(Ze,{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(Ls,{className:"h-16 w-16"})})})}),r.jsx(Ze,{children:r.jsxs(et,{className:"p-6 space-y-6",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold text-foreground mb-2",children:n.name}),r.jsxs("div",{className:"flex items-center text-sm text-muted-foreground",children:[r.jsx(Ss,{className:"h-4 w-4 mr-1"}),"Published ",on(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(As,{className:"h-5 w-5"}),"Sign Up Now"]})})]})})]})}):r.jsx(Dr,{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:()=>t("/additional-services"),children:[r.jsx(po,{className:"h-4 w-4 mr-2"}),"Back to Services"]})]})})},fT=[{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 XCt(){const[e,t]=E.useState(fT[0].id),n=fT.find(s=>s.id===e)||fT[0];return r.jsx(Dr,{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(_S,{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(mn,{value:e,onValueChange:t,children:[r.jsx(fn,{className:"w-full",children:r.jsx(yn,{placeholder:"Select a tool"})}),r.jsx(pn,{children:fT.map(s=>r.jsx(qt,{value:s.id,children:s.name},s.id))})]})}),r.jsx("div",{className:"hidden md:block",children:r.jsx(Ai,{value:e,onValueChange:t,className:"w-full",children:r.jsx(vi,{className:"w-full flex-wrap h-auto gap-1 bg-muted p-1",children:fT.map(s=>r.jsx(sn,{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 pCe="agent-os-onboarding-completed",SO=[{icon:Dg,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:Bg,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:Un,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:Cm,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:to,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:_c,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"]}],QCt=()=>{const[e,t]=E.useState(!1),[n,s]=E.useState(0),[a,o]=E.useState(!1);E.useEffect(()=>{if(!localStorage.getItem(pCe)){const S=setTimeout(()=>t(!0),500);return()=>clearTimeout(S)}},[]);const l=()=>{n{s(n+1),o(!1)},150)):u()},i=()=>{u()},u=()=>{localStorage.setItem(pCe,"true"),t(!1)},p=SO[n],x=p.icon,y=n===SO.length-1,_=b=>{b||u(),t(b)};return r.jsx(Or,{open:e,onOpenChange:_,children:r.jsxs(Ir,{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(Ls,{className:"h-3 w-3"}),"Beta"]})]}),r.jsxs("div",{className:"p-6 pt-4",children:[r.jsxs($r,{className:"text-center sm:text-center pb-2",children:[r.jsx(Fr,{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(Zn,{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((b,S)=>r.jsxs("div",{className:"flex items-center gap-3 group",style:{transitionDelay:`${150+S*50}ms`},children:[r.jsx("div",{className:`flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-gradient-to-br ${p.bgGradient} shadow-sm`,children:r.jsx(Ni,{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:b})]},S))}),r.jsx("div",{className:"flex justify-center gap-2 py-4",children:SO.map((b,S)=>r.jsx("button",{onClick:()=>{S!==n&&(o(!0),setTimeout(()=>{s(S),o(!1)},150))},className:`h-2 rounded-full transition-all duration-300 ${S===n?"w-8 bg-gradient-to-r "+p.bgGradient:S{const{user:e}=tn();return Kt({queryKey:["contact-snoozes",e==null?void 0:e.id],queryFn:async()=>{const{data:t,error:n}=await Q.from("contact_snoozes").select("*").gte("snoozed_until",new Date().toISOString());if(n)throw n;return t},enabled:!!e})},e3t=()=>{const e=Hr(),{user:t}=tn();return ir({mutationFn:async({contactId:n,days:s})=>{if(!(t!=null&&t.id))throw new Error("Not authenticated");const a=Ql(new Date,s);await Q.from("contact_snoozes").delete().eq("contact_id",n);const{error:o}=await Q.from("contact_snoozes").insert({contact_id:n,owner_user_id:t.id,snoozed_until:a.toISOString()});if(o)throw o},onSuccess:()=>{e.invalidateQueries({queryKey:["contact-snoozes"]}),e.invalidateQueries({queryKey:["today-actions"]}),e.invalidateQueries({queryKey:["popby-logs"]}),ka({title:"Touch snoozed!",description:"Contact has been snoozed."})},onError:n=>{ka({title:"Error snoozing contact",description:n.message,variant:"destructive"})}})},t3t=()=>{const e=Hr();return ir({mutationFn:async t=>{const{error:n}=await Q.from("contact_snoozes").delete().eq("contact_id",t);if(n)throw n},onSuccess:()=>{e.invalidateQueries({queryKey:["contact-snoozes"]}),ka({title:"Snooze cancelled"})},onError:t=>{ka({title:"Error cancelling snooze",description:t.message,variant:"destructive"})}})},r3t=[{label:"1 week",days:7},{label:"2 weeks",days:14},{label:"1 month",days:30}];function Bae({open:e,onOpenChange:t,contactId:n,contactName:s}){const[a,o]=E.useState(null),l=e3t(),i=async()=>{a&&(await l.mutateAsync({contactId:n,days:a}),o(null),t(!1))},u=p=>on(Ql(new Date,p),"MMM d, yyyy");return r.jsx(Or,{open:e,onOpenChange:t,children:r.jsxs(Ir,{className:"sm:max-w-md",children:[r.jsxs($r,{children:[r.jsxs(Fr,{className:"flex items-center gap-2",children:[r.jsx(Ya,{className:"h-5 w-5"}),"Snooze Touch"]}),r.jsxs(Zn,{children:["Postpone the next scheduled touch for ",s,". Select how long to snooze."]})]}),r.jsx("div",{className:"space-y-3 py-4",children:r3t.map(p=>r.jsxs("button",{type:"button",onClick:()=>o(p.days),className:Bt("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(Ss,{className:"h-3.5 w-3.5"}),"Until ",u(p.days)]})]},p.days))}),r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(ee,{variant:"outline",onClick:()=>t(!1),children:"Cancel"}),r.jsx(ee,{onClick:i,disabled:!a||l.isPending,children:l.isPending?"Snoozing...":"Snooze Touch"})]})]})})}const n3t={Crown:B1,FileText:Ea,Users:Un,Globe:cy,Star:js,Phone:Ti,MessageSquare:zo,PenTool:zj,Video:$a,Gift:to};function s3t({actions:e,onMarkComplete:t,onViewScript:n,isLoading:s,buildSmsLink:a,buildEmailLink:o,onGmailCompose:l}){const i=Gn(),[u,p]=E.useState("name"),[x,y]=E.useState("asc"),[_,b]=E.useState(null),[S,k]=E.useState(""),M=D=>{u===D?y(U=>U==="asc"?"desc":"asc"):(p(D),y("asc"))},P=E.useMemo(()=>[...e].sort((D,U)=>{var W,G;let V=0;switch(u){case"name":{const J=`${D.contact.first_name} ${D.contact.last_name||""}`.toLowerCase(),ne=`${U.contact.first_name} ${U.contact.last_name||""}`.toLowerCase();V=J.localeCompare(ne);break}case"relationship_type":V=(D.relationshipTypeName||"").localeCompare(U.relationshipTypeName||"");break;case"action_type":V=(((W=D.actionType)==null?void 0:W.name)||"").localeCompare(((G=U.actionType)==null?void 0:G.name)||"");break;case"last_touch":V=(D.monthNumber||0)-(U.monthNumber||0);break}return x==="asc"?V:-V}),[e,u,x]),T=D=>n3t[D||"Phone"]||Ti,I=({field:D,children:U})=>r.jsxs(ee,{variant:"ghost",size:"sm",className:"h-8 -ml-3 font-medium",onClick:()=>M(D),children:[U,u===D?x==="asc"?r.jsx(cp,{className:"ml-2 h-4 w-4"}):r.jsx(ay,{className:"ml-2 h-4 w-4"}):r.jsx(Pg,{className:"ml-2 h-4 w-4 opacity-50"})]}),z=(D,U,V)=>{b(D),k(`${U} ${V||""}`.trim())};return e.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(Ks,{children:[r.jsx(Zs,{children:r.jsxs(Mr,{className:"bg-muted/50",children:[r.jsx(It,{className:"w-[180px]",children:r.jsx(I,{field:"name",children:"Contact"})}),r.jsx(It,{className:"w-[130px]",children:r.jsx(I,{field:"relationship_type",children:"Type"})}),r.jsx(It,{className:"w-[120px]",children:r.jsx(I,{field:"action_type",children:"Action"})}),r.jsx(It,{className:"w-[130px]",children:"Phone"}),r.jsx(It,{className:"w-[200px]",children:"Quick Actions"})]})}),r.jsx(Ys,{children:P.map((D,U)=>{var oe,ge,ie,pe,se,fe;const V=D.isSpecialDate,W=D.specialDateType,G=V?W==="birthday"?hf:xa:T(((oe=D.actionType)==null?void 0:oe.icon)||null),J=D.contact.phone,ne=D.contact.email;return r.jsxs(Mr,{className:Bt("hover:bg-muted/50 transition-colors",V&&W==="birthday"&&"bg-pink-50/50 dark:bg-pink-950/20",V&&W==="anniversary"&&"bg-purple-50/50 dark:bg-purple-950/20"),children:[r.jsx(kt,{className:"font-medium",children:r.jsx("div",{children:r.jsxs("button",{onClick:()=>i(`/mission-control/contacts/${D.contact.id}`),className:"truncate max-w-[160px] text-left hover:text-primary hover:underline transition-colors",children:[D.contact.first_name," ",D.contact.last_name]})})}),r.jsx(kt,{children:D.relationshipTypeName?r.jsx(Pt,{variant:"secondary",className:"text-xs",children:D.relationshipTypeName}):r.jsx("span",{className:"text-muted-foreground text-sm",children:"—"})}),r.jsx(kt,{children:r.jsx("div",{className:"flex items-center gap-1.5",children:V?r.jsx(Pt,{className:Bt("gap-1",W==="birthday"&&"bg-pink-500 hover:bg-pink-600",W==="anniversary"&&"bg-purple-500 hover:bg-purple-600"),children:W==="birthday"?r.jsxs(r.Fragment,{children:[r.jsx(hf,{className:"h-3 w-3"})," Birthday"]}):r.jsxs(r.Fragment,{children:[r.jsx(xa,{className:"h-3 w-3"})," Anniversary"]})}):r.jsxs(Pt,{variant:"outline",className:"gap-1",children:[r.jsx(G,{className:"h-3 w-3"}),(ge=D.actionType)==null?void 0:ge.name]})})}),r.jsx(kt,{children:J?r.jsx("span",{className:"text-sm font-mono",children:D.contact.phone}):r.jsx("span",{className:"text-muted-foreground text-sm",children:"—"})}),r.jsx(kt,{children:r.jsxs("div",{className:"flex items-center gap-1",children:[J&&r.jsx("a",{href:`tel:${D.contact.phone}`,className:"p-1.5 rounded bg-primary/10 hover:bg-primary/20 text-primary transition-colors",title:"Call",children:r.jsx(Ti,{className:"h-3.5 w-3.5"})}),J&&r.jsx("a",{href:a(D.contact.phone,(ie=D.script)==null?void 0:ie.script_body,D.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(zo,{className:"h-3.5 w-3.5"})}),ne&&(l?r.jsx("button",{onClick:()=>l({id:D.contact.id,first_name:D.contact.first_name,last_name:D.contact.last_name,email:D.contact.email}),className:"p-1.5 rounded bg-sky-500/10 hover:bg-sky-500/20 text-sky-600 dark:text-sky-400 transition-colors",title:"Compose Email",children:r.jsx(Ns,{className:"h-3.5 w-3.5"})}):r.jsx("a",{href:o(D.contact.email,(pe=D.script)==null?void 0:pe.script_body,(se=D.script)==null?void 0:se.email_subject,(fe=D.actionType)==null?void 0:fe.name,D.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(Ns,{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:()=>z(D.contact.id,D.contact.first_name,D.contact.last_name),title:"Snooze",children:r.jsx(xf,{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 t(D.contact.id,D.actionType.id,(he=D.script)==null?void 0:he.id)},disabled:s,children:[r.jsx(so,{className:"h-3.5 w-3.5 mr-1"}),"Done"]})]})})]},`${D.contact.id}-${U}`)})})]})}),r.jsx(Bae,{open:!!_,onOpenChange:D=>!D&&b(null),contactId:_||"",contactName:S})]})}function $ae(){const{isAdmin:e}=tn(),{data:t,isLoading:n}=Kt({queryKey:["gmail-integration"],queryFn:async()=>{const{data:o,error:l}=await Q.from("gmail_integrations").select("*").maybeSingle();if(l)throw l;return o},enabled:e}),s=e&&!!(t!=null&&t.is_active),a=(t==null?void 0:t.gmail_email)||null;return{isGmailConnected:s,gmailEmail:a,isLoading:n}}function a3t({onSelect:e}){const[t,n]=E.useState(null),{data:s=[],isLoading:a}=Kt({queryKey:["agent-email-template-categories"],queryFn:async()=>{const{data:u,error:p}=await Q.from("email_template_categories").select("*").order("sort_order");if(p)throw p;return u}}),{data:o=[],isLoading:l}=Kt({queryKey:["agent-email-templates",t],queryFn:async()=>{let u=Q.from("agent_email_templates").select("*").eq("is_active",!0).order("sort_order");t&&(u=u.eq("category_id",t));const{data:p,error:x}=await u;if(x)throw x;return p}}),i=s.find(u=>u.id===t);return a?r.jsx("div",{className:"flex items-center justify-center py-6",children:r.jsx(Zr,{className:"h-5 w-5 animate-spin text-muted-foreground"})}):t?r.jsxs("div",{className:"space-y-2",children:[r.jsxs("button",{onClick:()=>n(null),className:"flex items-center gap-1 text-sm text-muted-foreground hover:text-foreground transition-colors",children:[r.jsx(kc,{className:"h-3.5 w-3.5"}),"Back to categories"]}),r.jsxs("p",{className:"text-xs font-medium flex items-center gap-1.5",children:[r.jsx("span",{children:i==null?void 0:i.icon})," ",i==null?void 0:i.name]}),l?r.jsx("div",{className:"flex items-center justify-center py-6",children:r.jsx(Zr,{className:"h-5 w-5 animate-spin text-muted-foreground"})}):o.length===0?r.jsx("p",{className:"text-sm text-muted-foreground py-4 text-center",children:"No templates in this category"}):r.jsx(Bo,{className:"max-h-[280px]",children:r.jsx("div",{className:"space-y-1",children:o.map(u=>r.jsxs("button",{onClick:()=>e(u),className:"w-full p-2.5 rounded-lg border hover:bg-accent transition-colors text-left",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("p",{className:"font-medium text-sm",children:u.title}),u.tone&&r.jsx(Pt,{variant:"secondary",className:"text-[10px] shrink-0",children:u.tone})]}),r.jsx("p",{className:"text-xs text-muted-foreground mt-0.5 line-clamp-1",children:u.subject})]},u.id))})})]}):r.jsxs("div",{className:"space-y-1",children:[r.jsx("p",{className:"text-xs font-medium text-muted-foreground px-1 mb-2",children:"Select a category"}),r.jsx(Bo,{className:"max-h-[280px]",children:r.jsx("div",{className:"space-y-1",children:s.map(u=>r.jsxs("button",{onClick:()=>n(u.id),className:"w-full flex items-center justify-between p-2.5 rounded-lg border hover:bg-accent transition-colors text-left",children:[r.jsxs("div",{className:"flex items-center gap-2.5",children:[r.jsx("span",{className:"text-lg",children:u.icon}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium text-sm",children:u.name}),u.description&&r.jsx("p",{className:"text-xs text-muted-foreground line-clamp-1",children:u.description})]})]}),r.jsx(Wi,{className:"h-4 w-4 text-muted-foreground shrink-0"})]},u.id))})})]})}function pT(e,t){return e.replace(/\{\{first_name\}\}/gi,t.first_name).replace(/\{\{last_name\}\}/gi,t.last_name||"").replace(/\{\{full_name\}\}/gi,`${t.first_name} ${t.last_name||""}`.trim())}function Z0e({open:e,onOpenChange:t,contact:n,bulkContacts:s,defaultSubject:a="",defaultBody:o="",gmailEmail:l,onSendComplete:i}){const u=!!s&&s.length>0,p=u?s:n?[n]:[],x=p[0],[y,_]=E.useState((x==null?void 0:x.email)||""),[b,S]=E.useState(a),[k,M]=E.useState(o),[P,T]=E.useState(!1),[I,z]=E.useState(!1);E.useEffect(()=>{e&&(_((x==null?void 0:x.email)||""),S(pT(a,x||{first_name:""})),M(pT(o,x||{first_name:""})),z(!a&&!o))},[e,x,a,o]);const D=G=>{S(pT(G.subject,x||{first_name:""})),M(pT(G.body,x||{first_name:""})),z(!1)},U=G=>G.split(/\n\n+/).map(J=>`

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

`).join(""),V=async G=>{if(!b||!k)return Ie.error("Please fill in subject and message"),!1;const J=pT(k,G),ne=U(J);try{const{data:oe,error:ge}=await Q.functions.invoke("gmail-send",{body:{to:G.email,subject:b,body:ne,contactId:G.id}});if(ge)throw ge;if(!(oe!=null&&oe.success))throw new Error((oe==null?void 0:oe.error)||"Failed to send");return!0}catch(oe){return console.error("Gmail send error:",oe),Ie.error("Failed to send to "+G.first_name+": "+(oe instanceof Error?oe.message:"Unknown error")),!1}},W=async()=>{if(!b||!k){Ie.error("Please fill in subject and message");return}if(u&&p.length>50){Ie.error("Maximum 50 recipients per bulk send");return}T(!0);try{if(u){let G=0;for(const J of p)await V(J)&&G++,await new Promise(oe=>setTimeout(oe,100));Ie.success(`Sent ${G} of ${p.length} emails`)}else await V(x)&&Ie.success("Email sent successfully!");t(!1),i==null||i()}catch(G){console.error("Bulk send error:",G),Ie.error("Error sending emails")}finally{T(!1)}};return r.jsx(Or,{open:e,onOpenChange:t,children:r.jsxs(Ir,{className:"sm:max-w-[600px] max-h-[90vh] overflow-y-auto",children:[r.jsxs($r,{children:[r.jsxs(Fr,{className:"flex items-center gap-2",children:[r.jsx(Ns,{className:"h-5 w-5 text-red-500"}),u?`Send to ${p.length} Contacts`:"Compose Email"]}),l&&r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Sending from ",r.jsx("span",{className:"font-medium",children:l})]})]}),r.jsxs("div",{className:"space-y-4",children:[I?r.jsxs("div",{className:"border rounded-lg p-3 bg-muted/30",children:[r.jsxs("div",{className:"flex items-center justify-between mb-2",children:[r.jsxs("p",{className:"text-sm font-medium flex items-center gap-1.5",children:[r.jsx(Ea,{className:"h-4 w-4"})," Choose a Template"]}),r.jsxs(ee,{variant:"ghost",size:"sm",onClick:()=>z(!1),className:"h-7 px-2 text-xs",children:[r.jsx(hs,{className:"h-3 w-3 mr-1"})," Write from scratch"]})]}),r.jsx(a3t,{onSelect:D})]}):r.jsxs(ee,{variant:"outline",size:"sm",className:"gap-2",onClick:()=>z(!0),children:[r.jsx(Ea,{className:"h-4 w-4"}),"Browse Templates"]}),r.jsx(Ld,{}),r.jsx("div",{className:"space-y-1.5",children:u?r.jsxs(r.Fragment,{children:[r.jsx($e,{children:"Recipients"}),r.jsx("div",{className:"bg-muted p-3 rounded-md space-y-1 max-h-24 overflow-y-auto text-muted-foreground",children:p.map(G=>r.jsxs("div",{className:"text-sm",children:[G.first_name," ",G.last_name," — ",G.email]},G.id))})]}):r.jsxs(r.Fragment,{children:[r.jsx($e,{htmlFor:"gmail-to",children:"To"}),r.jsx(dt,{id:"gmail-to",value:y,onChange:G=>_(G.target.value),placeholder:"recipient@example.com"})]})}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx($e,{htmlFor:"gmail-subject",children:"Subject"}),r.jsx(dt,{id:"gmail-subject",value:b,onChange:G=>S(G.target.value),placeholder:"Enter subject..."})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx($e,{htmlFor:"gmail-body",children:"Message"}),r.jsxs("div",{className:"flex gap-1",children:[r.jsx(Pt,{variant:"outline",className:"text-[10px] cursor-pointer hover:bg-accent",onClick:()=>M(G=>G+"{{first_name}}"),children:"{{first_name}}"}),r.jsx(Pt,{variant:"outline",className:"text-[10px] cursor-pointer hover:bg-accent",onClick:()=>M(G=>G+"{{last_name}}"),children:"{{last_name}}"})]})]}),r.jsx(Jn,{id:"gmail-body",value:k,onChange:G=>M(G.target.value),placeholder:"Write your message...",rows:10,className:"resize-y"})]}),r.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[r.jsx(ee,{variant:"outline",onClick:()=>t(!1),disabled:P,children:"Cancel"}),r.jsxs(ee,{onClick:W,disabled:P||!b||!k,className:"gap-2",children:[P?r.jsx(Zr,{className:"h-4 w-4 animate-spin"}):r.jsx(lo,{className:"h-4 w-4"}),P?"Sending...":u?`Send to ${p.length}`:"Send Email"]})]})]})]})})}const mCe={Crown:B1,FileText:Ea,Users:Un,Globe:cy,Star:js,Phone:Ti,MessageSquare:zo,PenTool:zj,Video:$a,Gift:to},i3t={"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 o3t(){const e=Gn(),{user:t}=tn(),{data:n}=qm(),{data:s}=mRe(),{data:a}=jp(),{data:o}=Oye(),{data:l}=wRe(),i=kgt(),u=bRe(),p=wgt(90),x=yRe(),[y,_]=E.useState(null),[b,S]=E.useState(null),[k,M]=E.useState(!1),[P,T]=E.useState(""),[I,z]=E.useState(!1),[D,U]=E.useState(""),[V,W]=E.useState(sre()),[G,J]=E.useState("cards"),[ne,oe]=E.useState(!1),[ge,ie]=E.useState(null),[pe,se]=E.useState(null),[fe,he]=E.useState(""),{isGmailConnected:ye,gmailEmail:Ae}=$ae(),we=()=>{const Ce=parseInt(D,10);if(isNaN(Ce)||Ce<1){ka({title:"Invalid goal",description:"Please enter a number greater than 0",variant:"destructive"});return}W(Ce),_Re(Ce),z(!1),ka({title:"Goal updated",description:`Weekly touch goal set to ${Ce}`})},be=()=>{U(V.toString()),z(!0)};E.useEffect(()=>{(async()=>{if(!(t!=null&&t.id))return;const{data:Me}=await Q.from("profiles").select("name").eq("id",t.id).single();Me!=null&&Me.name&&T(Me.name.split(" ")[0])})()},[t==null?void 0:t.id]),E.useEffect(()=>{i.mutate()},[]);const _e=Sf(new Date),Je=Ql(_e,7),Te=Ce=>{if(!Ce)return null;const Me=new Date(Ce);return new Date(_e.getFullYear(),Me.getMonth(),Me.getDate())},De=(a==null?void 0:a.filter(Ce=>{const Me=Te(Ce.birthday),Ge=Te(Ce.home_anniversary);return Me&&ac(Me,_e)||Ge&&ac(Ge,_e)}))||[],Ue=(a==null?void 0:a.filter(Ce=>{if(!Ce.birthday&&!Ce.home_anniversary)return!1;const Me=Ge=>{if(!Ge)return!1;const Ee=Te(Ge);return Ee?tre(Ee,_e)&&sae(Ee,Je):!1};return Me(Ce.birthday)||Me(Ce.home_anniversary)}).slice(0,5))||[],Be=De.map(Ce=>{var He,nt,yt;const Me=Te(Ce.birthday),Ge=Me&&ac(Me,_e),Ee=(o==null?void 0:o.find(it=>it.name==="Call"))||(o==null?void 0:o[0]);return{contact:Ce,actionType:Ee||{id:"special-date",name:Ge?"Birthday Call":"Anniversary Call",icon:Ge?"Cake":"Home",color:Ge?"#EC4899":"#8B5CF6",description:Ge?"Wish them happy birthday!":"Celebrate their home anniversary!",active:!0,sort_order:0,created_at:"",updated_at:""},planName:Ge?"🎂 Birthday Today!":"🏠 Home Anniversary!",relationshipTypeName:((yt=(nt=(He=Ce.tags)==null?void 0:He[0])==null?void 0:nt.relationship_type)==null?void 0:yt.name)||"",monthNumber:0,isSpecialDate:!0,specialDateType:Ge?"birthday":"anniversary"}}),ot=l!==void 0?l||[]:(a==null?void 0:a.slice(0,5).map((Ce,Me)=>{var Ee,He,nt;const Ge=o==null?void 0:o[Me%((o==null?void 0:o.length)||1)];return Ge?{contact:Ce,actionType:Ge,planName:"Quick Touch",relationshipTypeName:((nt=(He=(Ee=Ce.tags)==null?void 0:Ee[0])==null?void 0:He.relationship_type)==null?void 0:nt.name)||"",monthNumber:0}:null}).filter(Boolean))||[],Mt=[...Be,...ot],Oe=async(Ce,Me,Ge)=>{await x.mutateAsync({contactId:Ce,actionTypeId:Me,scriptUsedId:Ge}),M(!1),S(null)},at=Ce=>{Ce.script?(S(Ce),M(!0)):Oe(Ce.contact.id,Ce.actionType.id)},le=Ce=>mCe[Ce||"Phone"]||Ti,Ve=Ce=>mCe[Ce||"Users"]||Un,Qe=(Ce,Me)=>Ce.replace(/\{\{FirstName\}\}/g,Me.first_name).replace(/\{\{LastName\}\}/g,Me.last_name||"").replace(/\{\{AgentName\}\}/g,P||"there"),st=(Ce,Me)=>({Call:`Thinking of you, ${Me}!`,Text:`Quick hello, ${Me}`,Email:`Checking in, ${Me}`,"Handwritten Note":`A note for ${Me}`,Video:`Video message for ${Me}`,Gift:`Something special for you, ${Me}`})[Ce]||`Hello ${Me}!`,ke=(Ce,Me,Ge)=>{const Ee=`sms:${Ce}`;if(Me&&Ge){const He=Qe(Me,Ge);return`${Ee}?body=${encodeURIComponent(He)}`}return Ee},ct=(Ce,Me,Ge,Ee,He)=>{const nt=`mailto:${Ce}`,yt=[];if(He){const it=Ge||st(Ee||"Email",He.first_name);if(yt.push(`subject=${encodeURIComponent(it)}`),Me){const zt=Qe(Me,He);yt.push(`body=${encodeURIComponent(zt)}`)}}return yt.length>0?`${nt}?${yt.join("&")}`:nt};return r.jsxs(r.Fragment,{children:[r.jsxs(Dr,{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(Ce=>Ce.active).map(Ce=>{const Me=Ve(Ce.icon),Ge=(s==null?void 0:s[Ce.id])||0,Ee=y===Ce.id,He=i3t[Ce.name]||"bg-secondary text-secondary-foreground";return r.jsxs("button",{onClick:()=>{Ee?(_(null),e("/mission-control/contacts")):(_(Ce.id),e(`/mission-control/contacts?type=${Ce.id}`))},className:` flex items-center gap-2 px-4 py-3 rounded-lg border transition-all ${Ee?He:"bg-card hover:bg-accent"} `,children:[r.jsx(Me,{className:"h-5 w-5"}),r.jsxs("div",{className:"text-left",children:[r.jsx("div",{className:"font-medium",children:Ce.name}),r.jsxs("div",{className:`text-sm ${Ee?"opacity-90":"text-muted-foreground"}`,children:[Ge," Contacts"]})]})]},Ce.id)})})]}),r.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3",children:[r.jsxs(ee,{onClick:()=>e("/mission-control/video/record"),className:"w-full bg-gradient-to-r from-primary to-primary/80",children:[r.jsx(eu,{className:"h-4 w-4 mr-1"}),"Quick Video"]}),r.jsxs(ee,{onClick:()=>e("/mission-control/contacts"),className:"w-full",variant:"outline",children:["View Contacts",r.jsx(Wi,{className:"h-4 w-4 ml-1"})]}),r.jsx(ee,{variant:"outline",onClick:()=>e("/mission-control/video-library"),className:"w-full",children:"Video Library"}),r.jsx(ee,{variant:"outline",onClick:()=>e("/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(Pt,{variant:"outline",className:"gap-1",children:[r.jsx(Ls,{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:()=>J("cards"),title:"Card view",children:r.jsx(dp,{className:"h-4 w-4"})}),r.jsx(ee,{variant:G==="table"?"secondary":"ghost",size:"sm",className:"h-7 px-2",onClick:()=>J("table"),title:"Table view",children:r.jsx(up,{className:"h-4 w-4"})})]})]}),r.jsx(Ze,{children:r.jsx(et,{className:"p-4",children:Mt.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:()=>e("/mission-control/plans"),children:"Manage Plans"})]}):G==="table"?r.jsx(s3t,{actions:Mt,onMarkComplete:Oe,onViewScript:at,isLoading:x.isPending,buildSmsLink:ke,buildEmailLink:ct,onGmailCompose:ye?Ce=>{ie(Ce),oe(!0)}:void 0}):r.jsxs("div",{className:"flex gap-3 overflow-x-auto pb-2",children:[Mt.map((Ce,Me)=>{var dr,Rr,Gr,Ur,kn,_s,ur;const Ge=Ce.isSpecialDate,Ee=Ce.specialDateType,He=Ge?Ee==="birthday"?hf:xa:le(((dr=Ce.actionType)==null?void 0:dr.icon)||null),nt=Ce.contact.phone,yt=Ce.contact.email,it=Ge?Ee==="birthday"?"#EC4899":"#8B5CF6":((Rr=Ce.actionType)==null?void 0:Rr.color)||"#3B82F6",zt=Ge?Ee==="birthday"?"🎂 Birthday Today!":"🏠 Home Anniversary!":(Gr=Ce.actionType)==null?void 0:Gr.name;return r.jsxs("div",{className:`flex-shrink-0 w-[260px] border rounded-lg overflow-hidden ${Ge?"ring-2 ring-offset-2":""}`,style:Ge?{"--tw-ring-color":it}:void 0,children:[r.jsxs("div",{className:"p-3 text-white flex items-center gap-2",style:{backgroundColor:it},children:[r.jsx(He,{className:"h-4 w-4"}),r.jsx("span",{className:"font-medium text-sm",children:zt})]}),r.jsxs("div",{className:"p-3 space-y-2",children:[r.jsxs("button",{onClick:()=>e(`/mission-control/contacts/${Ce.contact.id}`),className:"font-medium text-sm hover:text-primary hover:underline transition-colors text-left",children:[Ce.contact.first_name," ",Ce.contact.last_name]}),r.jsxs("div",{className:"flex gap-1.5",children:[nt&&r.jsxs(r.Fragment,{children:[r.jsxs("a",{href:`tel:${Ce.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(Ti,{className:"h-3 w-3"}),"Call"]}),r.jsxs("a",{href:ke(Ce.contact.phone,(Ur=Ce.script)==null?void 0:Ur.script_body,Ce.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(zo,{className:"h-3 w-3"}),"Text"]})]}),yt&&(ye?r.jsxs("button",{onClick:()=>{ie({id:Ce.contact.id,first_name:Ce.contact.first_name,last_name:Ce.contact.last_name,email:Ce.contact.email}),oe(!0)},className:"flex-1 flex items-center justify-center gap-1 px-2 py-1.5 bg-sky-500/10 hover:bg-sky-500/20 text-sky-600 dark:text-sky-400 rounded text-xs font-medium transition-colors",title:"Compose Email",children:[r.jsx(Ns,{className:"h-3 w-3"}),"Email"]}):r.jsxs("a",{href:ct(Ce.contact.email,(kn=Ce.script)==null?void 0:kn.script_body,(_s=Ce.script)==null?void 0:_s.email_subject,(ur=Ce.actionType)==null?void 0:ur.name,Ce.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(Ns,{className:"h-3 w-3"}),"Email"]}))]}),!nt&&!yt&&r.jsx("p",{className:"text-xs text-muted-foreground italic",children:"No contact info"}),r.jsxs("div",{className:"flex gap-1 flex-wrap",children:[Ce.relationshipTypeName&&r.jsx(Pt,{variant:"secondary",className:"text-xs",children:Ce.relationshipTypeName}),Ce.monthNumber>0&&r.jsxs(Pt,{variant:"outline",className:"text-xs",children:["Month ",Ce.monthNumber]})]}),Ce.script&&r.jsx(ee,{size:"sm",variant:"outline",className:"w-full",onClick:()=>at(Ce),children:"View Script"}),r.jsxs("div",{className:"flex gap-1.5",children:[r.jsxs(ee,{size:"sm",variant:"outline",className:"flex-1 gap-1",onClick:()=>{se(Ce.contact.id),he(`${Ce.contact.first_name} ${Ce.contact.last_name||""}`.trim())},children:[r.jsx(xf,{className:"h-3.5 w-3.5"}),"Snooze"]}),r.jsx(ee,{size:"sm",className:"flex-1",onClick:()=>{var Rn;return Oe(Ce.contact.id,Ce.actionType.id,(Rn=Ce.script)==null?void 0:Rn.id)},disabled:x.isPending,children:"Mark Complete"})]})]})]},Ce.contact.id+Me)}),r.jsx("div",{className:"flex-shrink-0 w-[100px] border rounded-lg flex items-center justify-center",children:r.jsxs(Lh,{children:[r.jsx(Oh,{asChild:!0,children:r.jsxs(ee,{variant:"ghost",className:"h-full w-full",children:[r.jsx(pm,{className:"h-5 w-5 mr-2"}),"More"]})}),r.jsx(ah,{children:r.jsx(ei,{onClick:()=>e("/mission-control/contacts"),children:"View all contacts"})})]})})]})})})]}),r.jsxs("div",{className:"grid md:grid-cols-3 gap-6",children:[r.jsxs(Ze,{className:"md:col-span-2",children:[r.jsx(Wt,{className:"pb-2",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Yt,{className:"text-lg",children:"Momentum"}),r.jsxs(Or,{open:I,onOpenChange:z,children:[r.jsx(Zo,{asChild:!0,children:r.jsx("button",{onClick:be,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(Ir,{className:"sm:max-w-[360px]",children:[r.jsxs($r,{children:[r.jsx(Fr,{children:"Set Weekly Goal"}),r.jsx(Zn,{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($e,{htmlFor:"weekly-goal-ic",children:"Weekly touch goal"}),r.jsx(dt,{id:"weekly-goal-ic",type:"number",min:"1",value:D,onChange:Ce=>U(Ce.target.value),placeholder:"20",onKeyDown:Ce=>{Ce.key==="Enter"&&we()}})]}),r.jsx(ee,{onClick:we,className:"w-full",children:"Save Goal"})]})]})]})]})}),r.jsxs(et,{className:"space-y-4",children:[r.jsx(pd,{value:Math.min(u.actionsThisWeek/V*100,100),className:"h-3 w-full max-w-full"}),r.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[r.jsx(ff,{className:"h-5 w-5 text-orange-500"}),r.jsxs("span",{className:"font-medium",children:[u.actionsThisWeek," / ",V]}),r.jsx("span",{className:"text-muted-foreground",children:"Actions Completed This Week"})]}),u.streak>0&&r.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[r.jsx("span",{className:"text-lg",children:"🔥"}),r.jsx("span",{className:"font-medium",children:"Great Job!"}),r.jsxs("span",{className:"text-muted-foreground",children:["Keep Your Streak Going! (",u.streak," days)"]})]})]})]}),r.jsxs(Ze,{children:[r.jsx(Wt,{className:"pb-2",children:r.jsx(Yt,{className:"text-lg",children:"Upcoming Reminders"})}),r.jsxs(et,{className:"space-y-3",children:[Ue.length>0?Ue.map(Ce=>{const Me=Ce.birthday,Ge=Ce.home_anniversary;return r.jsxs("div",{className:"flex items-start gap-2 text-sm",children:[Me?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:[Ce.first_name,"'s"]}),r.jsxs("span",{className:"text-muted-foreground",children:[" ",Me?"Birthday":"Home Anniversary"]}),r.jsxs("div",{className:"text-xs text-muted-foreground",children:[Me&&Ce.birthday&&(()=>{const Ee=Ce.birthday.split(/[-/T]/);return on(new Date(new Date().getFullYear(),parseInt(Ee[1],10)-1,parseInt(Ee[2],10)),"MMM d")})(),Me&&Ge&&" · ",Ge&&Ce.home_anniversary&&(()=>{const Ee=Ce.home_anniversary.split(/[-/T]/);return on(new Date(new Date().getFullYear(),parseInt(Ee[1],10)-1,parseInt(Ee[2],10)),"MMM d")})()]})]})]},Ce.id)}):r.jsx("p",{className:"text-sm text-muted-foreground",children:"No upcoming reminders"}),p.count>0&&r.jsxs("button",{onClick:()=>e("/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(Wi,{className:"h-4 w-4 text-muted-foreground ml-auto mt-0.5"})]})]})]}),r.jsx(RRe,{})]})]}),r.jsx(Or,{open:k,onOpenChange:M,children:r.jsxs(Ir,{className:"max-w-md",children:[r.jsx($r,{children:r.jsx(Fr,{className:"flex items-center gap-2",children:b&&r.jsxs(r.Fragment,{children:[r.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:b.actionType.color||"#3B82F6"}}),b.actionType.name," Script"]})})}),b&&b.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:[b.contact.first_name," ",b.contact.last_name]})]}),r.jsx("div",{className:"bg-muted p-4 rounded-lg",children:r.jsx("p",{className:"whitespace-pre-wrap",children:Qe(b.script.script_body,b.contact)})}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(ee,{variant:"outline",className:"flex-1",onClick:()=>M(!1),children:"Close"}),r.jsx(ee,{className:"flex-1",onClick:()=>{var Ce;return Oe(b.contact.id,b.actionType.id,(Ce=b.script)==null?void 0:Ce.id)},disabled:x.isPending,children:"Mark Complete"})]})]})]})}),r.jsx(QCt,{})]}),ye&&ge&&r.jsx(Z0e,{open:ne,onOpenChange:oe,contact:ge,gmailEmail:Ae}),r.jsx(Bae,{open:!!pe,onOpenChange:Ce=>!Ce&&se(null),contactId:pe||"",contactName:fe})]})}const dBe=()=>{const{user:e}=tn();return Kt({queryKey:["popby-items",e==null?void 0:e.id],queryFn:async()=>{const{data:t,error:n}=await Q.from("popby_items").select("*").or(`owner_user_id.is.null,owner_user_id.eq.${e==null?void 0:e.id}`).eq("is_active",!0).order("name");if(n)throw n;return t},enabled:!!e})},Uae=e=>{const{user:t}=tn();return Kt({queryKey:["popby-logs",t==null?void 0:t.id,e],queryFn:async()=>{let n=Q.from("popby_logs").select("*").order("completed_at",{ascending:!1});if(e){const o=new Date;o.setDate(o.getDate()-e),n=n.gte("completed_at",o.toISOString())}const{data:s,error:a}=await n;if(a)throw a;return s},enabled:!!t})},Y0e=()=>{const{user:e}=tn();return Kt({queryKey:["relationship-type-popby-defaults",e==null?void 0:e.id],queryFn:async()=>{const{data:t,error:n}=await Q.from("relationship_type_popby_defaults").select("*");if(n)throw n;return t},enabled:!!e})},uBe=()=>{const{user:e}=tn();return Kt({queryKey:["contact-popby-settings",e==null?void 0:e.id],queryFn:async()=>{const{data:t,error:n}=await Q.from("contact_popby_settings").select("*");if(n)throw n;return t},enabled:!!e})},hBe=()=>{const{data:e}=jp(),{data:t}=qm(),{data:n}=Uae(),{data:s}=uBe(),{data:a}=Y0e(),o=new Map;n==null||n.forEach(x=>{const y=o.get(x.contact_id);(!y||new Date(x.completed_at)>new Date(y))&&o.set(x.contact_id,x.completed_at)});const l=new Map;a==null||a.forEach(x=>l.set(x.relationship_type_id,x.frequency_days));const i=new Map;s==null||s.filter(x=>x.is_active).forEach(x=>{i.set(x.contact_id,x.frequency_days)});const u=Sf(new Date);return(e||[]).map(x=>{let y=90;if(i.has(x.id))y=i.get(x.id);else if(x.tags&&x.tags.length>0){const M=x.tags.map(P=>l.get(P.relationship_type_id)).filter(P=>P!==void 0);M.length>0&&(y=Math.min(...M))}const _=o.get(x.id)||null,b=_?Ay(u,Sf(new Date(_))):null,S=b===null||b>=y,k=S&&b!==null?b-y:0;return{...x,lastPopby:_,daysSinceLastPopby:b,frequencyDays:y,isDue:S,daysOverdue:k}}).sort((x,y)=>y.daysOverdue-x.daysOverdue)},fBe=()=>hBe().filter(t=>t.isDue),l3t=()=>{const e=Hr(),{user:t}=tn();return ir({mutationFn:async n=>{const{error:s}=await Q.from("popby_items").insert({...n,owner_user_id:t==null?void 0:t.id});if(s)throw s},onSuccess:()=>{e.invalidateQueries({queryKey:["popby-items"]}),ka({title:"Popby item created!"})},onError:n=>{ka({title:"Error creating popby item",description:n.message,variant:"destructive"})}})},pBe=()=>{const e=Hr(),{user:t}=tn();return ir({mutationFn:async n=>{const{error:s}=await Q.from("popby_logs").insert({...n,owner_user_id:t==null?void 0:t.id});if(s)throw s},onSuccess:()=>{e.invalidateQueries({queryKey:["popby-logs"]}),ka({title:"Popby logged!"})},onError:n=>{ka({title:"Error logging popby",description:n.message,variant:"destructive"})}})},c3t=()=>{const e=Hr(),{user:t}=tn();return ir({mutationFn:async n=>{const{error:s}=await Q.from("relationship_type_popby_defaults").upsert({...n,owner_user_id:t==null?void 0:t.id},{onConflict:"relationship_type_id,owner_user_id"});if(s)throw s},onSuccess:()=>{e.invalidateQueries({queryKey:["relationship-type-popby-defaults"]}),ka({title:"Frequency updated!"})},onError:n=>{ka({title:"Error updating frequency",description:n.message,variant:"destructive"})}})},d3t=()=>{const{data:e}=Uae(30),t=fBe(),n=new Date;n.setDate(n.getDate()-7);const s=(e==null?void 0:e.filter(o=>new Date(o.completed_at)>=n).length)||0,a=(e==null?void 0:e.length)||0;return{thisWeekCount:s,thisMonthCount:a,dueCount:t.length}};function u3t(){const{user:e}=tn();return Kt({queryKey:["contact-touch-logs",e==null?void 0:e.id],queryFn:async()=>{const{data:t,error:n}=await Q.from("contact_touch_logs").select("*").order("completed_at",{ascending:!1});if(n)throw n;return t},enabled:!!e})}function mBe(e){const{data:t}=u3t(),{data:n}=uBe(),{data:s}=Y0e(),{data:a}=JCt();return E.useMemo(()=>{const o=a==null?void 0:a.find(M=>M.contact_id===e.id),l=o?new Date(o.snoozed_until):null,i=Sf(new Date);if(l&&!sae(l,i))return{nextTouchDate:l,daysUntil:Ay(l,i),status:"snoozed",frequencyDays:90,lastTouchDate:null,snoozedUntil:l};const p=((t==null?void 0:t.filter(M=>M.contact_id===e.id))||[]).sort((M,P)=>new Date(P.completed_at).getTime()-new Date(M.completed_at).getTime())[0],x=p?new Date(p.completed_at):null;let y=90;const _=n==null?void 0:n.find(M=>M.contact_id===e.id&&M.is_active);if(_)y=_.frequency_days;else if(e.tags&&e.tags.length>0){const M=e.tags.map(P=>{const T=s==null?void 0:s.find(I=>I.relationship_type_id===P.relationship_type_id);return T==null?void 0:T.frequency_days}).filter(P=>P!==void 0);M.length>0&&(y=Math.min(...M))}if(!x)return{nextTouchDate:null,daysUntil:null,status:"never-touched",frequencyDays:y,lastTouchDate:null,snoozedUntil:null};const b=Ql(Sf(x),y),S=Ay(b,i);let k;return S<0?k="overdue":S<=7?k="due-soon":k="on-track",{nextTouchDate:b,daysUntil:S,status:k,frequencyDays:y,lastTouchDate:x,snoozedUntil:null}},[e,t,n,s,a])}function bpe({contact:e}){const t=mBe(e),s=(()=>{switch(t.status){case"overdue":return{variant:"destructive",icon:yl,text:`${Math.abs(t.daysUntil)} days overdue`,className:""};case"due-soon":return{variant:"secondary",icon:Ya,text:t.daysUntil===0?"Due today":`Due in ${t.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:so,text:`Next touch in ${t.daysUntil} days`,className:"bg-emerald-100 text-emerald-800 dark:bg-emerald-900/30 dark:text-emerald-400"};case"snoozed":return{variant:"secondary",icon:xf,text:`Snoozed until ${on(t.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:Ss,text:"Never touched",className:"border-dashed"}}})(),a=s.icon;return r.jsxs(Pt,{variant:s.variant,className:Bt("gap-1",s.className),children:[r.jsx(a,{className:"h-3 w-3"}),s.text]})}function h3t({contact:e,onLogTouch:t,onSnooze:n}){const s=mBe(e),a=t3t(),[o,l]=E.useState(!1),i=()=>{switch(s.status){case"overdue":return"text-destructive";case"due-soon":return"text-amber-600 dark:text-amber-400";case"on-track":return"text-emerald-600 dark:text-emerald-400";case"snoozed":return"text-slate-600 dark:text-slate-400";case"never-touched":return"text-muted-foreground"}},u=()=>{switch(s.status){case"overdue":return r.jsx(yl,{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(so,{className:"h-5 w-5 text-emerald-600 dark:text-emerald-400"});case"snoozed":return r.jsx(xf,{className:"h-5 w-5 text-slate-600 dark:text-slate-400"});case"never-touched":return r.jsx(Ss,{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(e.id)};return r.jsxs(r.Fragment,{children:[r.jsxs(Ze,{children:[r.jsx(Wt,{className:"pb-2",children:r.jsxs(Yt,{className:"text-sm font-medium flex items-center gap-2",children:[r.jsx(Ss,{className:"h-4 w-4"}),"Next Touch"]})}),r.jsxs(et,{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[u(),r.jsx("span",{className:Bt("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:"})," ",on(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:"})," ",on(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:"})," ",on(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(hs,{className:"h-4 w-4 mr-1"}),"Cancel Snooze"]}),t&&r.jsx(ee,{size:"sm",className:"flex-1",onClick:t,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(xf,{className:"h-4 w-4 mr-1"}),"Snooze"]}),(s.status==="overdue"||s.status==="due-soon"||s.status==="never-touched")&&t&&r.jsx(ee,{size:"sm",className:"flex-1",variant:s.status==="overdue"?"default":"outline",onClick:t,children:"Log Touch"})]})]})]}),r.jsx(Bae,{open:o,onOpenChange:l,contactId:e.id,contactName:`${e.first_name} ${e.last_name||""}`.trim()})]})}const Rde=768;function z3(){const[e,t]=E.useState(void 0);return E.useEffect(()=>{const n=window.matchMedia(`(max-width: ${Rde-1}px)`),s=()=>{t(window.innerWidthn.removeEventListener("change",s)},[]),!!e}const f3t={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"}},p3t={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 Fde({score:e,showScore:t=!1,showTooltip:n=!0,size:s="sm",className:a}){const o=f3t[e.status],l=p3t[s],i=r.jsxs("div",{className:Bt("inline-flex items-center rounded-full font-medium",o.bgLightClass,o.textClass,l.badge,l.text,a),children:[r.jsx("span",{className:Bt("rounded-full",o.bgClass,l.dot)}),t?r.jsx("span",{children:e.score}):r.jsx("span",{children:o.label})]});return n?r.jsx(YI,{children:r.jsxs(Ug,{children:[r.jsx(qg,{asChild:!0,children:i}),r.jsx(Im,{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:Bt("font-bold",o.textClass),children:[e.score,"/100"]})]}),r.jsx(pd,{value:e.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:[e.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:[e.breakdown.touchpoints,"/30"]})]}),r.jsxs("div",{className:"flex justify-between",children:[r.jsx("span",{className:"text-muted-foreground",children:"Transactions"}),r.jsxs("span",{children:[e.breakdown.transactions,"/20"]})]}),r.jsxs("div",{className:"flex justify-between",children:[r.jsx("span",{className:"text-muted-foreground",children:"Referrals"}),r.jsxs("span",{children:[e.breakdown.referrals,"/10"]})]})]}),e.daysSinceTouch!==null&&r.jsxs("p",{className:"text-xs text-muted-foreground pt-1 border-t",children:["Last contact: ",e.daysSinceTouch===0?"Today":`${e.daysSinceTouch} days ago`]}),e.daysSinceTouch===null&&r.jsx("p",{className:"text-xs text-muted-foreground pt-1 border-t italic",children:"Never contacted"})]})})]})}):i}const m3t=[{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}],g3t=({open:e,onOpenChange:t,relationshipTypes:n,onSuccess:s})=>{const{user:a}=tn(),{toast:o}=_i(),l=E.useRef(null),[i,u]=E.useState("upload"),[p,x]=E.useState([]),[y,_]=E.useState([]),[b,S]=E.useState({}),[k,M]=E.useState([]),[P,T]=E.useState([]),[I,z]=E.useState(!1),[D,U]=E.useState(null),V=()=>{u("upload"),x([]),_([]),S({}),M([]),T([]),U(null),l.current&&(l.current.value="")},W=()=>{V(),t(!1)},G=fe=>{const he=fe.split(` `).map(be=>be.trim()).filter(be=>be);if(he.length===0)return{headers:[],data:[]};const ye=be=>{const _e=[];let Je="",Te=!1;for(let De=0;De{var Ae;const he=(Ae=fe.target.files)==null?void 0:Ae[0];if(!he)return;const ye=new FileReader;ye.onload=we=>{var De;const be=(De=we.target)==null?void 0:De.result,{headers:_e,data:Je}=G(be);if(_e.length===0){o({title:"No data found",description:"The CSV file appears to be empty.",variant:"destructive"});return}x(_e),_(Je);const Te={};_e.forEach(Ue=>{const Be=Ue.toLowerCase().replace(/[_\s-]/g,"");Be.includes("firstname")||Be==="first"?Te.first_name=Ue:Be.includes("lastname")||Be==="last"?Te.last_name=Ue:Be.includes("email")?Te.email=Ue:Be.includes("phone")||Be.includes("mobile")||Be.includes("cell")?Te.phone=Ue:Be.includes("address")||Be.includes("street")?Te.address=Ue:Be==="city"?Te.city=Ue:Be==="state"||Be==="province"?Te.state=Ue:Be==="zip"||Be==="zipcode"||Be==="postalcode"?Te.zip=Ue:Be.includes("spouse")&&Be.includes("email")?Te.spouse_email=Ue:Be.includes("spouse")||Be.includes("partner")?Te.spouse_name=Ue:Be.includes("company")||Be.includes("organization")||Be.includes("business")?Te.company_name=Ue:Be.includes("jobtitle")||Be.includes("title")||Be.includes("position")?Te.job_title=Ue:Be.includes("birthday")||Be.includes("dob")||Be.includes("birthdate")?Te.birthday=Ue:Be.includes("anniversary")||Be.includes("homeanniversary")?Te.home_anniversary=Ue:(Be.includes("notes")||Be.includes("comment"))&&(Te.notes=Ue)}),S(Te),u("mapping")},ye.readAsText(he)},ne=(fe,he)=>{S(ye=>{if(he==="none"){const{[fe]:Ae,...we}=ye;return we}return{...ye,[fe]:he}})},oe=fe=>{M(he=>he.includes(fe)?he.filter(ye=>ye!==fe):[...he,fe])},ge=()=>{const fe=y.map(he=>{const ye=be=>{const _e=b[be];if(!_e)return"";const Je=p.indexOf(_e);return Je>=0?(he[Je]||"").trim():""},Ae=ye("first_name"),we=Ae.length>0;return{first_name:Ae,last_name:ye("last_name"),email:ye("email"),phone:ye("phone"),address:ye("address"),city:ye("city"),state:ye("state"),zip:ye("zip"),spouse_name:ye("spouse_name"),spouse_email:ye("spouse_email"),company_name:ye("company_name"),job_title:ye("job_title"),birthday:ye("birthday"),home_anniversary:ye("home_anniversary"),notes:ye("notes"),isValid:we,error:we?void 0:"First name is required"}});T(fe),u("preview")},ie=async()=>{if(!(a!=null&&a.id))return;const fe=P.filter(we=>we.isValid);if(fe.length===0){o({title:"No valid contacts",description:"There are no valid contacts to import.",variant:"destructive"});return}z(!0);let he=0,ye=0,Ae=0;try{for(const we of fe)try{let be=null;if(we.email){const{data:Je}=await Q.from("innercircle_contacts").select("id").eq("owner_user_id",a.id).eq("email",we.email).maybeSingle();be=Je}if(!be&&we.phone){const{data:Je}=await Q.from("innercircle_contacts").select("id").eq("owner_user_id",a.id).eq("phone",we.phone).maybeSingle();be=Je}const _e={owner_user_id:a.id,first_name:we.first_name,last_name:we.last_name||null,email:we.email||null,phone:we.phone||null,address:we.address||null,city:we.city||null,state:we.state||null,zip:we.zip||null,spouse_name:we.spouse_name||null,spouse_email:we.spouse_email||null,company_name:we.company_name||null,job_title:we.job_title||null,birthday:we.birthday||null,home_anniversary:we.home_anniversary||null,notes:we.notes||null};if(be)await Q.from("innercircle_contacts").update(_e).eq("id",be.id),ye++;else{const{data:Je}=await Q.from("innercircle_contacts").insert(_e).select("id").single();Je&&k.length>0&&await Q.from("innercircle_contact_tags").insert(k.map(Te=>({contact_id:Je.id,relationship_type_id:Te}))),he++}}catch(be){console.error("Error importing contact:",be),Ae++}U({created:he,updated:ye,failed:Ae}),u("result"),(he>0||ye>0)&&s(),o({title:"Import Complete",description:`${he} created, ${ye} updated${Ae>0?`, ${Ae} failed`:""}.`})}catch(we){console.error("Import error:",we),o({title:"Import Failed",description:we.message||"Failed to import contacts",variant:"destructive"})}finally{z(!1)}},pe=P.filter(fe=>fe.isValid).length,se=P.filter(fe=>!fe.isValid).length;return r.jsx(Or,{open:e,onOpenChange:W,children:r.jsxs(Ir,{className:"max-w-3xl max-h-[85vh] overflow-hidden flex flex-col",children:[r.jsxs($r,{children:[r.jsxs(Fr,{className:"flex items-center gap-2",children:[r.jsx(q1,{className:"h-5 w-5"}),"Import Contacts from CSV"]}),r.jsx(Zn,{children:"Upload a CSV file with your contacts. You can map columns and select relationship types."})]}),i==="upload"&&r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{className:"border-2 border-dashed rounded-lg p-8 text-center",children:[r.jsx("input",{type:"file",accept:".csv,.txt",ref:l,onChange:J,className:"hidden"}),r.jsx(_o,{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 fe;return(fe=l.current)==null?void 0:fe.click()},children:"Select CSV File"})]}),r.jsxs("div",{className:"bg-muted/50 rounded-lg p-4 text-sm",children:[r.jsx("p",{className:"font-medium mb-2",children:"Supported Fields:"}),r.jsx("p",{className:"text-muted-foreground text-xs mb-3",children:"First Name, Last Name, Email, Phone, Street Address, City, State, Zip, Spouse Name, Company, Job Title, Birthday, Home Anniversary, Notes"}),r.jsxs(ee,{variant:"outline",size:"sm",onClick:()=>{const fe=`First Name,Last Name,Email,Phone,Street Address,City,State,Zip,Spouse Name,Company,Job Title,Birthday,Home Anniversary,Notes John,Doe,john@example.com,555-123-4567,123 Main St,Austin,TX,78701,Jane Doe,ABC Realty,Real Estate Agent,1985-06-15,2020-03-22,Met at open house`,he=new Blob([fe],{type:"text/csv"}),ye=URL.createObjectURL(he),Ae=document.createElement("a");Ae.href=ye,Ae.download="contact_import_template.csv",Ae.click(),URL.revokeObjectURL(ye)},children:[r.jsx(io,{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($e,{className:"text-base font-medium",children:"Map CSV Columns to Contact Fields"}),r.jsx("div",{className:"grid gap-3",children:m3t.map(fe=>r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsxs($e,{className:"w-40 text-sm",children:[fe.label,fe.required&&r.jsx("span",{className:"text-destructive ml-1",children:"*"})]}),r.jsxs(mn,{value:b[fe.key]||"none",onValueChange:he=>ne(fe.key,he),children:[r.jsx(fn,{className:"w-48",children:r.jsx(yn,{placeholder:"Select column..."})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"none",children:"-- Not mapped --"}),p.map(he=>r.jsx(qt,{value:he,children:he},he))]})]})]},fe.key))})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsx($e,{className:"text-base font-medium",children:"Apply Relationship Types (optional)"}),r.jsx("div",{className:"flex flex-wrap gap-2",children:n.map(fe=>r.jsx(Pt,{variant:k.includes(fe.id)?"default":"outline",className:"cursor-pointer",onClick:()=>oe(fe.id),children:fe.name},fe.id))})]}),r.jsx("div",{className:"bg-muted/50 rounded-lg p-3 text-sm",children:r.jsxs("p",{className:"text-muted-foreground",children:["Preview: ",y.length," row(s) found in CSV"]})})]}),i==="preview"&&r.jsxs("div",{className:"flex-1 overflow-hidden flex flex-col space-y-4",children:[r.jsxs("div",{className:"flex items-center gap-4 text-sm",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(so,{className:"h-4 w-4 text-green-500"}),r.jsxs("span",{children:[pe," valid"]})]}),se>0&&r.jsxs("div",{className:"flex items-center gap-2 text-destructive",children:[r.jsx(yl,{className:"h-4 w-4"}),r.jsxs("span",{children:[se," invalid"]})]})]}),r.jsxs("div",{className:"flex-1 overflow-auto border rounded-lg",children:[r.jsxs(Ks,{children:[r.jsx(Zs,{children:r.jsxs(Mr,{className:"bg-muted/30",children:[r.jsx(It,{children:"First Name"}),r.jsx(It,{children:"Last Name"}),r.jsx(It,{children:"Email"}),r.jsx(It,{children:"Phone"}),r.jsx(It,{children:"Status"})]})}),r.jsx(Ys,{children:P.slice(0,100).map((fe,he)=>r.jsxs(Mr,{children:[r.jsx(kt,{children:fe.first_name}),r.jsx(kt,{children:fe.last_name}),r.jsx(kt,{children:fe.email}),r.jsx(kt,{children:fe.phone}),r.jsx(kt,{children:fe.isValid?r.jsx(Pt,{variant:"default",className:"bg-green-500/10 text-green-600",children:"Valid"}):r.jsx(Pt,{variant:"destructive",children:fe.error||"Invalid"})})]},he))})]}),P.length>100&&r.jsxs("p",{className:"text-sm text-muted-foreground text-center py-2",children:["Showing first 100 of ",P.length," contacts"]})]})]}),i==="result"&&D&&r.jsxs("div",{className:"space-y-4 py-4 text-center",children:[r.jsx(so,{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:[D.created," contact(s) created, ",D.updated," updated"]}),D.failed>0&&r.jsxs("p",{className:"text-destructive",children:[D.failed," failed to import"]})]}),r.jsxs(Bs,{children:[i==="upload"&&r.jsx(ee,{variant:"outline",onClick:W,children:"Cancel"}),i==="mapping"&&r.jsxs(r.Fragment,{children:[r.jsx(ee,{variant:"outline",onClick:V,children:"Back"}),r.jsx(ee,{onClick:ge,disabled:!b.first_name,children:"Continue"})]}),i==="preview"&&r.jsxs(r.Fragment,{children:[r.jsx(ee,{variant:"outline",onClick:()=>u("mapping"),children:"Back"}),r.jsx(ee,{onClick:ie,disabled:I||pe===0,children:I?r.jsxs(r.Fragment,{children:[r.jsx(Zr,{className:"mr-2 h-4 w-4 animate-spin"}),"Importing..."]}):`Import ${pe} Contact${pe!==1?"s":""}`})]}),i==="result"&&r.jsx(ee,{onClick:W,children:"Done"})]})]})})};function x3t(){return"contacts"in navigator&&"ContactsManager"in window}function y3t(e){const t=[],n=e.split("BEGIN:VCARD").filter(s=>s.trim());for(const s of n){const a=s.split(/\r?\n/);let o="",l="",i="",u="",p="";for(const x of a){const y=x.replace(/^\s+/,"");if(y.startsWith("N:")||y.startsWith("N;")){const b=y.substring(y.indexOf(":")+1).split(";");l=(b[0]||"").trim(),o=(b[1]||"").trim()}if((y.startsWith("FN:")||y.startsWith("FN;"))&&!o){const b=y.substring(y.indexOf(":")+1).trim().split(" ");o=b[0]||"",l=b.slice(1).join(" ")}(y.startsWith("EMAIL")||y.match(/^item\d+\.EMAIL/i))&&!i&&(i=y.substring(y.indexOf(":")+1).trim()),(y.startsWith("TEL")||y.match(/^item\d+\.TEL/i))&&!u&&(u=y.substring(y.indexOf(":")+1).trim()),(y.startsWith("ADR")||y.match(/^item\d+\.ADR/i))&&!p&&(p=y.substring(y.indexOf(":")+1).split(";").map(S=>S.trim()).filter(Boolean).join(", "))}(o||l)&&t.push({first_name:o,last_name:l,email:i,phone:u,address:p})}return t}function v3t({open:e,onOpenChange:t,onComplete:n}){const{user:s}=tn(),{data:a}=jp(),o=Pye(),l=E.useRef(null),[i,u]=E.useState("choose"),[p,x]=E.useState([]),[y,_]=E.useState(new Set),[b,S]=E.useState(0),[k,M]=E.useState(0),P=x3t(),T=E.useCallback(ne=>{if(!a)return ne;const oe=new Set(a.filter(ie=>ie.email).map(ie=>ie.email.toLowerCase())),ge=new Set(a.filter(ie=>ie.phone).map(ie=>ie.phone.replace(/\D/g,"")));return ne.map(ie=>{var fe,he;const pe=(fe=ie.email)==null?void 0:fe.toLowerCase(),se=(he=ie.phone)==null?void 0:he.replace(/\D/g,"");return pe&&oe.has(pe)?{...ie,isDuplicate:!0,duplicateField:"email"}:se&&se.length>=7&&ge.has(se)?{...ie,isDuplicate:!0,duplicateField:"phone"}:ie})},[a]),I=async()=>{try{const ne=["name","email","tel","address"],oe=await navigator.contacts.select(ne,{multiple:!0});if(!oe||oe.length===0)return;const ge=oe.map(se=>{var ye,Ae,we,be;const he=(((ye=se.name)==null?void 0:ye[0])||"").split(" ");return{first_name:he[0]||"",last_name:he.slice(1).join(" "),email:((Ae=se.email)==null?void 0:Ae[0])||"",phone:((we=se.tel)==null?void 0:we[0])||"",address:(be=se.address)!=null&&be[0]?[se.address[0].streetAddress,se.address[0].city,se.address[0].region,se.address[0].postalCode].filter(Boolean).join(", "):""}}),ie=T(ge);x(ie);const pe=new Set;ie.forEach((se,fe)=>{se.isDuplicate||pe.add(fe)}),_(pe),u("preview")}catch(ne){console.error("Contact Picker error:",ne),ka({title:"Could not access contacts",description:"Please try the file upload option instead.",variant:"destructive"})}},z=ne=>{var ie;const oe=(ie=ne.target.files)==null?void 0:ie[0];if(!oe)return;const ge=new FileReader;ge.onload=pe=>{var Ae;const se=(Ae=pe.target)==null?void 0:Ae.result,fe=y3t(se);if(fe.length===0){ka({title:"No contacts found",description:"The file didn't contain any valid contacts.",variant:"destructive"});return}const he=T(fe);x(he);const ye=new Set;he.forEach((we,be)=>{we.isDuplicate||ye.add(be)}),_(ye),u("preview")},ge.readAsText(oe),l.current&&(l.current.value="")},D=async()=>{const ne=p.filter((ge,ie)=>y.has(ie));if(ne.length===0)return;u("importing");let oe=0;for(const ge of ne)try{await o.mutateAsync({first_name:ge.first_name,last_name:ge.last_name||void 0,email:ge.email||void 0,phone:ge.phone||void 0,address:ge.address||void 0}),oe++,M(Math.round(oe/ne.length*100))}catch(ie){console.error(`Failed to import ${ge.first_name} ${ge.last_name}:`,ie)}S(oe),u("done")},U=ne=>{_(oe=>{const ge=new Set(oe);return ge.has(ne)?ge.delete(ne):ge.add(ne),ge})},V=()=>{y.size===p.length?_(new Set):_(new Set(p.map((ne,oe)=>oe)))},W=ne=>{ne||(u("choose"),x([]),_(new Set),S(0),M(0),i==="done"&&n()),t(ne)},G=p.filter(ne=>ne.isDuplicate).length,J=y.size;return r.jsx(Or,{open:e,onOpenChange:W,children:r.jsxs(Ir,{className:"sm:max-w-lg max-h-[90vh]",children:[r.jsxs($r,{children:[r.jsxs(Fr,{className:"flex items-center gap-2",children:[r.jsx(py,{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(Zn,{children:"Add contacts from your phone directly into Agent OS."})]}),i==="choose"&&r.jsxs("div",{className:"space-y-4 pt-2",children:[P&&r.jsxs(ee,{onClick:I,className:"w-full h-auto py-4 flex flex-col items-center gap-2",children:[r.jsx(py,{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:[P&&r.jsx("div",{className:"absolute inset-0 flex items-center",children:r.jsx("span",{className:"w-full border-t"})}),P&&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:P?"outline":"default",onClick:()=>{var ne;return(ne=l.current)==null?void 0:ne.click()},className:"w-full h-auto py-4 flex flex-col items-center gap-2",children:[r.jsx(_o,{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:P?"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"}),!P&&r.jsxs("div",{className:"rounded-lg bg-muted p-3 text-sm text-muted-foreground space-y-2",children:[r.jsx("p",{className:"font-medium",children:"How to export contacts:"}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium text-xs",children:"iPhone:"}),r.jsx("p",{className:"text-xs",children:'Open Contacts → select contacts → Share → choose "Export vCard"'})]}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium text-xs",children:"Android:"}),r.jsx("p",{className:"text-xs",children:"Open Contacts → Menu → Export → save as .vcf file"})]})]})]}),i==="preview"&&r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between text-sm",children:[r.jsxs("span",{children:[p.length," contact",p.length!==1?"s":""," found",G>0&&r.jsxs("span",{className:"text-amber-600 ml-1",children:["(",G," already exist)"]})]}),r.jsx(ee,{variant:"ghost",size:"sm",onClick:V,children:y.size===p.length?"Deselect All":"Select All"})]}),r.jsx(Bo,{className:"h-[350px] rounded-md border",children:r.jsx("div",{className:"divide-y",children:p.map((ne,oe)=>r.jsxs("div",{className:`flex items-start gap-3 p-3 cursor-pointer hover:bg-accent/50 transition-colors ${ne.isDuplicate?"opacity-60":""}`,onClick:()=>U(oe),children:[r.jsx(Bl,{checked:y.has(oe),onCheckedChange:()=>U(oe),className:"mt-0.5"}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs("span",{className:"font-medium text-sm truncate",children:[ne.first_name," ",ne.last_name]}),ne.isDuplicate&&r.jsxs(Pt,{variant:"secondary",className:"text-[10px] px-1.5 py-0 bg-amber-500/10 text-amber-600 border-amber-200",children:["Exists (",ne.duplicateField,")"]})]}),r.jsxs("div",{className:"text-xs text-muted-foreground space-y-0.5 mt-0.5",children:[ne.phone&&r.jsx("div",{children:ne.phone}),ne.email&&r.jsx("div",{className:"truncate",children:ne.email})]})]})]},oe))})}),r.jsxs("div",{className:"flex items-center justify-between pt-2",children:[r.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>u("choose"),children:"Back"}),r.jsxs(ee,{onClick:D,disabled:J===0,children:["Import ",J," Contact",J!==1?"s":""]})]})]}),i==="importing"&&r.jsxs("div",{className:"flex flex-col items-center gap-4 py-8",children:[r.jsx(Zr,{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:[k,"% 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:`${k}%`}})})]}),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(Ni,{className:"h-6 w-6 text-emerald-600"})}),r.jsxs("div",{className:"text-center",children:[r.jsxs("p",{className:"font-semibold text-lg",children:[b," contact",b!==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:()=>W(!1),className:"mt-2",children:"Done"})]})]})})}function _3t({selectedIds:e,contacts:t,onClearSelection:n}){const{data:s}=qm(),a=Lye(),o=Hr(),{isGmailConnected:l}=$ae(),[i,u]=E.useState(!1),[p,x]=E.useState(!1),y=e.size;if(y===0)return null;const _=async k=>{u(!0);try{const P=Array.from(e).map(I=>({contact_id:I,relationship_type_id:k})),{error:T}=await Q.from("innercircle_contact_tags").upsert(P,{onConflict:"contact_id,relationship_type_id",ignoreDuplicates:!0});if(T)throw T;o.invalidateQueries({queryKey:["innercircle-contacts"]}),o.invalidateQueries({queryKey:["innercircle-contact-counts"]}),ka({title:`Assigned type to ${y} contacts`}),n()}catch(M){ka({title:"Error assigning type",description:M.message,variant:"destructive"})}finally{u(!1)}},b=()=>{const k=t.filter(U=>e.has(U.id)),M=["First Name","Last Name","Email","Phone","Address","Birthday","Home Anniversary","Notes","Relationship Types"],P=k.map(U=>{var V;return[U.first_name,U.last_name||"",U.email||"",U.phone||"",U.address||"",U.birthday||"",U.home_anniversary||"",U.notes||"",((V=U.tags)==null?void 0:V.map(W=>{var G;return(G=W.relationship_type)==null?void 0:G.name}).join("; "))||""]}),T=[M.join(","),...P.map(U=>U.map(V=>`"${(V||"").replace(/"/g,'""')}"`).join(","))].join(` `),I=new Blob([T],{type:"text/csv"}),z=URL.createObjectURL(I),D=document.createElement("a");D.href=z,D.download=`contacts-export-${new Date().toISOString().slice(0,10)}.csv`,D.click(),URL.revokeObjectURL(z),ka({title:`Exported ${y} contacts`})},S=async()=>{if(confirm(`Are you sure you want to delete ${y} contacts? This cannot be undone.`)){u(!0);try{const k=Array.from(e);for(const M of k)await a.mutateAsync(M);n()}catch(k){ka({title:"Error deleting contacts",description:k.message,variant:"destructive"})}finally{u(!1)}}};return r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"flex items-center gap-3 p-3 bg-primary/5 border border-primary/20 rounded-lg",children:[r.jsxs(Pt,{variant:"secondary",className:"font-semibold",children:[y," selected"]}),r.jsxs(mn,{onValueChange:_,disabled:i,children:[r.jsx(fn,{className:"w-[180px] h-8",children:r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx(zg,{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(k=>k.active).map(k=>r.jsx(qt,{value:k.id,children:k.name},k.id))})]}),l&&r.jsxs(ee,{variant:"outline",size:"sm",onClick:()=>x(!0),disabled:i,children:[r.jsx(Ns,{className:"h-3.5 w-3.5 mr-1"}),"Email"]}),r.jsxs(ee,{variant:"outline",size:"sm",onClick:b,disabled:i,children:[r.jsx(io,{className:"h-3.5 w-3.5 mr-1"}),"Export"]}),r.jsxs(ee,{variant:"outline",size:"sm",onClick:S,disabled:i,className:"text-destructive hover:text-destructive",children:[r.jsx(Bn,{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(hs,{className:"h-3.5 w-3.5 mr-1"}),"Clear"]})]}),r.jsx(Z0e,{open:p,onOpenChange:x,bulkContacts:Array.from(e).map(k=>{const M=t.find(P=>P.id===k);return M?{id:M.id,first_name:M.first_name,last_name:M.last_name,email:M.email||""}:null}).filter(k=>k!==null&&k.email!==""),onSendComplete:()=>{x(!1),n()}})]})}function gCe({contact:e,onEdit:t,onDelete:n,onSnooze:s}){const a=Gn(),o=`${e.first_name} ${e.last_name||""}`.trim();return r.jsxs(Lh,{children:[r.jsx(Oh,{asChild:!0,children:r.jsx(ee,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:l=>l.stopPropagation(),children:r.jsx(pm,{className:"h-4 w-4"})})}),r.jsxs(ah,{align:"end",onClick:l=>l.stopPropagation(),children:[r.jsxs(ei,{onClick:()=>a(`/mission-control/contacts/${e.id}?tab=activity&action=log`),children:[r.jsx(Ti,{className:"h-4 w-4 mr-2"}),"Log Touch"]}),r.jsxs(ei,{onClick:()=>a(`/mission-control/video?contactId=${e.id}`),children:[r.jsx($a,{className:"h-4 w-4 mr-2"}),"Send Video"]}),r.jsxs(ei,{onClick:()=>a(`/mission-control/popbys?contactId=${e.id}`),children:[r.jsx(Po,{className:"h-4 w-4 mr-2"}),"Schedule Pop-by"]}),r.jsxs(ei,{onClick:()=>s(e.id,o),children:[r.jsx(xf,{className:"h-4 w-4 mr-2"}),"Snooze"]}),r.jsxs(ei,{onClick:()=>t(e),children:[r.jsx(ni,{className:"h-4 w-4 mr-2"}),"Edit"]}),r.jsxs(ei,{onClick:()=>n(e.id),className:"text-destructive focus:text-destructive",children:[r.jsx(Bn,{className:"h-4 w-4 mr-2"}),"Delete"]})]})]})}function b3t(){const{user:e}=tn();return Kt({queryKey:["contact-smart-lists",e==null?void 0:e.id],queryFn:async()=>{const{data:t,error:n}=await Q.from("contact_smart_lists").select("*").order("created_at",{ascending:!1});if(n)throw n;return t},enabled:!!e})}function w3t(){const e=Hr(),{user:t}=tn();return ir({mutationFn:async({name:n,filters:s,sort_by:a})=>{const{data:o,error:l}=await Q.from("contact_smart_lists").insert({owner_user_id:t.id,name:n,filters:s,sort_by:a}).select().single();if(l)throw l;return o},onSuccess:()=>{e.invalidateQueries({queryKey:["contact-smart-lists"]}),ka({title:"Smart list saved"})},onError:n=>{ka({title:"Error saving smart list",description:n.message,variant:"destructive"})}})}function j3t(){const e=Hr();return ir({mutationFn:async t=>{const{error:n}=await Q.from("contact_smart_lists").delete().eq("id",t);if(n)throw n},onSuccess:()=>{e.invalidateQueries({queryKey:["contact-smart-lists"]}),ka({title:"Smart list deleted"})}})}function k3t({currentFilters:e,currentSortBy:t,onApplySmartList:n}){const{data:s}=b3t(),a=w3t(),o=j3t(),[l,i]=E.useState(!1),[u,p]=E.useState(""),x=e.search||e.type&&e.type!=="all"||e.status&&e.status!=="all",y=async()=>{u.trim()&&(await a.mutateAsync({name:u.trim(),filters:e,sort_by:t}),p(""),i(!1))};return r.jsxs(r.Fragment,{children:[r.jsxs(Lh,{children:[r.jsx(Oh,{asChild:!0,children:r.jsxs(ee,{variant:"outline",size:"sm",className:"gap-1.5",children:[r.jsx(V1,{className:"h-3.5 w-3.5"}),"Smart Lists",s&&s.length>0&&r.jsx(Pt,{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(ah,{align:"start",className:"w-56",children:[s&&s.length>0?r.jsxs(r.Fragment,{children:[s.map(_=>r.jsxs(ei,{className:"flex items-center justify-between group",children:[r.jsx("span",{className:"flex-1 cursor-pointer",onClick:()=>n(_.filters,_.sort_by),children:_.name}),r.jsx(ee,{variant:"ghost",size:"sm",className:"h-6 w-6 p-0 opacity-0 group-hover:opacity-100",onClick:b=>{b.stopPropagation(),o.mutate(_.id)},children:r.jsx(Bn,{className:"h-3 w-3 text-destructive"})})]},_.id)),r.jsx(sk,{})]}):r.jsx(ei,{disabled:!0,className:"text-muted-foreground text-xs",children:"No saved lists yet"}),x&&r.jsxs(ei,{onClick:()=>i(!0),children:[r.jsx(JT,{className:"h-4 w-4 mr-2"}),"Save Current Filters"]})]})]}),r.jsx(Or,{open:l,onOpenChange:i,children:r.jsxs(Ir,{className:"max-w-sm",children:[r.jsx($r,{children:r.jsx(Fr,{children:"Save Smart List"})}),r.jsxs("div",{className:"space-y-4",children:[r.jsx(dt,{placeholder:"e.g. Buyers in 40205",value:u,onChange:_=>p(_.target.value),onKeyDown:_=>_.key==="Enter"&&y(),autoFocus:!0}),r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(ee,{variant:"outline",onClick:()=>i(!1),children:"Cancel"}),r.jsx(ee,{onClick:y,disabled:!u.trim()||a.isPending,children:"Save"})]})]})]})})]})}function zT(e){if(!e)return null;try{const t=e.split(/[-/T]/);if(t.length<3)return null;const n=parseInt(t[1],10)-1,s=parseInt(t[2],10);if(isNaN(n)||isNaN(s))return null;const a=new Date;a.setHours(0,0,0,0);let o=new Date(a.getFullYear(),n,s);return o.setHours(0,0,0,0),on)return null;const a=t==="birthday"?"🎂":"🏡",o=s===0?t==="birthday"?"Birthday today!":"Anniversary today!":s===1?t==="birthday"?"Birthday tomorrow":"Anniversary tomorrow":`${a} in ${s}d`;return{emoji:a,label:o,daysUntil:s}}function yCe({birthday:e,homeAnniversary:t,className:n}){const s=xCe(e,"birthday",7),a=xCe(t,"anniversary",7);return!s&&!a?null:r.jsxs("div",{className:Bt("flex flex-wrap gap-1",n),children:[s&&r.jsx(Pt,{variant:"secondary",className:Bt("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(Pt,{variant:"secondary",className:Bt("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 vCe({deal:e}){if(!e||!e.stage)return null;const{stage:t}=e;return r.jsxs(Pt,{variant:"outline",className:"text-[10px] gap-1 font-medium whitespace-nowrap",style:{borderColor:t.color,color:t.color,backgroundColor:`${t.color}10`},children:[r.jsx("span",{className:"h-1.5 w-1.5 rounded-full inline-block",style:{backgroundColor:t.color}}),t.name]})}function N3t(){const e=Kc();return Kt({queryKey:["contact-deals-map",e],queryFn:async()=>{const{data:t,error:n}=await Q.from("deal_pipeline").select(` id, deal_name, contact_id, stage:deal_pipeline_stages(id, name, color, icon, is_won_stage, is_lost_stage) `).not("contact_id","is",null);if(n)throw n;const s={};return(t||[]).forEach(a=>{a.contact_id&&!s[a.contact_id]&&(s[a.contact_id]=a)}),s},enabled:!!e})}function S3t(){const e=Gn(),[t]=Gc(),{user:n}=tn(),s=z3(),a=Hr(),o=t.get("type"),l=t.get("filter")??t.get("status"),i=t.get("new")==="true",{contactsWithScores:u,isLoading:p}=Rye(),{data:x}=qm(),{data:y}=N3t(),_=Pye(),b=gRe(),S=Lye(),[k,M]=E.useState(""),[P,T]=E.useState(o||"all"),[I,z]=E.useState(l||"all"),[D,U]=E.useState("name"),[V,W]=E.useState(i),[G,J]=E.useState(null),[ne,oe]=E.useState(!1),[ge,ie]=E.useState(!1),[pe,se]=E.useState(null),[fe,he]=E.useState(""),[ye,Ae]=E.useState(new Set),[we,be]=E.useState(!1),[_e,Je]=E.useState(1),[Te,De]=E.useState(50),Ue=E.useCallback(Me=>{be(!1),Ae(Ge=>{const Ee=new Set(Ge);return Ee.has(Me)?Ee.delete(Me):Ee.add(Me),Ee})},[]);E.useEffect(()=>{if(!(n!=null&&n.id))return;const Me=Q.channel(`innercircle_contacts_inserts_${n.id}`).on("postgres_changes",{event:"INSERT",schema:"public",table:"innercircle_contacts",filter:`owner_user_id=eq.${n.id}`},()=>{a.invalidateQueries({queryKey:["innercircle-contacts"]}),a.invalidateQueries({queryKey:["innercircle-contact-counts"]})}).subscribe();return()=>{Q.removeChannel(Me)}},[a,n==null?void 0:n.id]),E.useEffect(()=>{l&&z(l)},[l]);const[Be,qe]=E.useState({first_name:"",last_name:"",email:"",phone:"",address:"",city:"",state:"",zip_code:"",birthday:"",home_anniversary:"",spouse_name:"",spouse_email:"",notes:"",tagIds:[]});E.useEffect(()=>{i&&W(!0)},[i]),E.useEffect(()=>{var Me;G&&qe({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:((Me=G.tags)==null?void 0:Me.map(Ge=>Ge.relationship_type_id))||[]})},[G]);const ot=E.useMemo(()=>{if(!u)return[];let Me=u.filter(Ge=>{var nt,yt,it;const Ee=k===""||`${Ge.first_name} ${Ge.last_name}`.toLowerCase().includes(k.toLowerCase())||((nt=Ge.email)==null?void 0:nt.toLowerCase().includes(k.toLowerCase()))||((yt=Ge.phone)==null?void 0:yt.includes(k)),He=P==="all"||((it=Ge.tags)==null?void 0:it.some(zt=>zt.relationship_type_id===P));return Ee&&He});return I==="not-touched-90"?Me=Me.filter(Ge=>{const Ee=Ge.relationshipScore.daysSinceTouch;return Ee===null||Ee>90}):I==="at-risk"?Me=Me.filter(Ge=>Ge.relationshipScore.status==="at-risk"):I==="cooling"?Me=Me.filter(Ge=>Ge.relationshipScore.status==="cooling"):I==="warm"&&(Me=Me.filter(Ge=>Ge.relationshipScore.status==="warm")),Me=[...Me].sort((Ge,Ee)=>{switch(D){case"important-dates":{const He=zT(Ge.birthday),nt=zT(Ee.birthday),yt=zT(Ge.home_anniversary),it=zT(Ee.home_anniversary),zt=[He,yt].filter(Rr=>Rr!==null).sort((Rr,Gr)=>(Rr??1/0)-(Gr??1/0))[0]??1/0,dr=[nt,it].filter(Rr=>Rr!==null).sort((Rr,Gr)=>(Rr??1/0)-(Gr??1/0))[0]??1/0;return zt-dr}case"last-touched":{const He=Ge.relationshipScore.lastTouchDate,nt=Ee.relationshipScore.lastTouchDate;return!He&&!nt?0:He?nt?new Date(He).getTime()-new Date(nt).getTime():1:-1}case"next-touch":{const He=Ge.relationshipScore.daysSinceTouch,nt=Ee.relationshipScore.daysSinceTouch;return He===null&&nt===null?0:He===null?-1:nt===null?1:nt-He}case"score":return Ge.relationshipScore.score-Ee.relationshipScore.score;case"date-added":{const He=Ge.created_at,nt=Ee.created_at;return!He&&!nt?0:He?nt?new Date(nt).getTime()-new Date(He).getTime():-1:1}case"name":default:{const He=`${Ge.first_name||""} ${Ge.last_name||""}`.toLowerCase(),nt=`${Ee.first_name||""} ${Ee.last_name||""}`.toLowerCase();return He.localeCompare(nt)}}}),Me},[u,k,P,I,D]),Mt=ot.length,Oe=Math.max(1,Math.ceil(Mt/Te)),at=Math.min(_e,Oe),le=E.useMemo(()=>{const Me=(at-1)*Te;return ot.slice(Me,Me+Te)},[ot,at,Te]);E.useEffect(()=>{Je(1)},[k,P,I,D]);const Ve=E.useCallback(()=>{be(!1),Ae(Me=>Me.size>0?new Set:new Set(le.map(Ge=>Ge.id)))},[le]),Qe=E.useCallback(()=>{be(!0),Ae(new Set(ot.map(Me=>Me.id)))},[ot]),st=E.useCallback((Me,Ge)=>{M(Me.search||""),T(Me.type||"all"),z(Me.status||"all"),U(Ge||"name")},[]),ke=()=>{qe({first_name:"",last_name:"",email:"",phone:"",address:"",city:"",state:"",zip_code:"",birthday:"",home_anniversary:"",spouse_name:"",spouse_email:"",notes:"",tagIds:[]})},ct=async Me=>{Me.preventDefault(),G?(await b.mutateAsync({id:G.id,...Be}),J(null)):(await _.mutateAsync(Be),W(!1)),ke()},Ce=async Me=>{confirm("Are you sure you want to delete this contact?")&&await S.mutateAsync(Me)};return r.jsx(Dr,{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:()=>e("/mission-control"),children:[r.jsx(kc,{className:"h-4 w-4 mr-1"}),"Back"]})}),r.jsx(Ze,{children:r.jsx(et,{className:"p-4",children:r.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[r.jsxs("div",{className:"relative flex-1",children:[r.jsx(Sa,{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:k,onChange:Me=>M(Me.target.value),className:"pl-9"})]}),r.jsxs(mn,{value:P,onValueChange:T,children:[r.jsx(fn,{className:"w-[160px]",children:r.jsx(yn,{placeholder:"Filter by type"})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"all",children:"All Types"}),x==null?void 0:x.filter(Me=>Me.active).map(Me=>r.jsx(qt,{value:Me.id,children:Me.name},Me.id))]})]}),r.jsxs(mn,{value:I,onValueChange:z,children:[r.jsx(fn,{className:"w-[160px]",children:r.jsx(yn,{placeholder:"Filter by status"})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"all",children:"All Status"}),r.jsx(qt,{value:"warm",children:"🟢 Warm"}),r.jsx(qt,{value:"cooling",children:"🟡 Cooling Off"}),r.jsx(qt,{value:"at-risk",children:"🔴 At Risk"})]})]}),r.jsxs(mn,{value:D,onValueChange:U,children:[r.jsx(fn,{className:"w-[180px]",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Pg,{className:"h-4 w-4 text-muted-foreground"}),r.jsx(yn,{placeholder:"Sort by"})]})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"name",children:"Name (A-Z)"}),r.jsx(qt,{value:"important-dates",children:"Important Dates"}),r.jsx(qt,{value:"last-touched",children:"Last Touched"}),r.jsx(qt,{value:"next-touch",children:"Next Touch Due"}),r.jsx(qt,{value:"score",children:"Relationship Score"}),r.jsx(qt,{value:"date-added",children:"Date Added"})]})]}),r.jsx(k3t,{currentFilters:{search:k,type:P,status:I},currentSortBy:D,onApplySmartList:st}),r.jsxs(ee,{onClick:()=>W(!0),children:[r.jsx(bn,{className:"h-4 w-4 mr-1"}),"Add Contact"]}),r.jsxs(ee,{variant:"outline",onClick:()=>oe(!0),children:[r.jsx(_o,{className:"h-4 w-4 mr-1"}),"Import CSV"]}),r.jsxs(ee,{variant:"outline",onClick:()=>ie(!0),children:[r.jsx(py,{className:"h-4 w-4 mr-1"}),"Import from Phone"]})]})})}),r.jsx(_3t,{selectedIds:ye,contacts:ot,onClearSelection:()=>{Ae(new Set),be(!1)}}),ye.size>0&&ye.size===le.length&&!we&&Mt>Te&&r.jsxs("div",{className:"flex items-center justify-center gap-2 p-2 bg-primary/5 border border-primary/20 rounded-lg text-sm",children:[r.jsxs("span",{children:["All ",le.length," contacts on this page are selected."]}),r.jsxs(ee,{variant:"link",size:"sm",className:"h-auto p-0 font-semibold",onClick:Qe,children:["Select all ",Mt.toLocaleString()," matching contacts"]})]}),we&&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 ",Mt.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(Ze,{className:"p-6 text-center text-muted-foreground",children:"Loading contacts..."}):ot.length===0?r.jsx(Ze,{className:"p-6 text-center text-muted-foreground",children:k||P!=="all"||I!=="all"?"No contacts match your search":"No contacts yet. Add your first contact!"}):le.map(Me=>{var Ee;const{relationshipScore:Ge}=Me;return r.jsx(Ze,{className:"cursor-pointer hover:bg-accent/50 transition-colors",onClick:()=>{const He=new URLSearchParams;k&&He.set("search",k),P!=="all"&&He.set("type",P),I!=="all"&&He.set("filter",I);const nt=He.toString();e(`/mission-control/contacts/${Me.id}${nt?`?${nt}`:""}`)},children:r.jsx(et,{className:"p-4",children:r.jsxs("div",{className:"flex items-start justify-between",children:[r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[r.jsxs("h3",{className:"font-semibold text-base truncate",children:[Me.first_name," ",Me.last_name]}),r.jsx(Wi,{className:"h-4 w-4 text-muted-foreground shrink-0"})]}),r.jsxs("div",{className:"space-y-1 text-sm mb-3",children:[Me.email&&r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[r.jsx(Ns,{className:"h-3.5 w-3.5 shrink-0"}),r.jsx("span",{className:"truncate",children:Me.email})]}),Me.phone&&r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[r.jsx(Ti,{className:"h-3.5 w-3.5 shrink-0"}),r.jsx("span",{children:Me.phone})]})]}),r.jsxs("div",{className:"flex flex-wrap items-center gap-1 mb-2",children:[r.jsx(Fde,{score:Ge,size:"sm"}),r.jsx(bpe,{contact:Me}),(Ee=Me.tags)==null?void 0:Ee.map(He=>{var nt;return r.jsx(Pt,{variant:"secondary",className:"text-xs",children:(nt=He.relationship_type)==null?void 0:nt.name},He.id)}),r.jsx(vCe,{deal:y==null?void 0:y[Me.id]})]}),r.jsx(yCe,{birthday:Me.birthday,homeAnniversary:Me.home_anniversary,className:"mb-2"}),r.jsxs("div",{className:"flex flex-wrap items-center gap-3 text-xs text-muted-foreground",children:[Ge.lastTouchDate?r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(Ya,{className:"h-3 w-3"}),on(new Date(Ge.lastTouchDate),"MMM d")]}):r.jsx("span",{className:"italic",children:"Never contacted"}),Me.birthday&&r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(Ss,{className:"h-3 w-3"}),on(new Date(Me.birthday),"MMM d")]}),Me.home_anniversary&&r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(xa,{className:"h-3 w-3"}),on(new Date(Me.home_anniversary),"MMM d")]})]})]}),r.jsx("div",{className:"ml-2",onClick:He=>He.stopPropagation(),children:r.jsx(gCe,{contact:Me,onEdit:J,onDelete:Ce,onSnooze:(He,nt)=>{se(He),he(nt)}})})]})})},Me.id)})}):r.jsx(Ze,{children:r.jsx(et,{className:"p-0 overflow-x-auto",children:r.jsxs(Ks,{className:"min-w-[800px]",children:[r.jsx(Zs,{children:r.jsxs(Mr,{children:[r.jsx(It,{className:"w-[40px]",children:r.jsx(Bl,{checked:le.length>0&&le.every(Me=>ye.has(Me.id)),onCheckedChange:()=>Ve()})}),r.jsx(It,{children:"Name"}),r.jsx(It,{children:"Status"}),r.jsx(It,{children:"Score"}),r.jsx(It,{children:"Contact Info"}),r.jsx(It,{children:"Types / Pipeline"}),r.jsx(It,{children:"Last Contact"}),r.jsx(It,{children:"Important Dates"}),r.jsx(It,{className:"w-[50px]",children:"Actions"})]})}),r.jsx(Ys,{children:p?r.jsx(Mr,{children:r.jsx(kt,{colSpan:9,className:"text-center py-8",children:"Loading contacts..."})}):ot.length===0?r.jsx(Mr,{children:r.jsx(kt,{colSpan:9,className:"text-center py-8 text-muted-foreground",children:k||P!=="all"||I!=="all"?"No contacts match your search":"No contacts yet. Add your first contact!"})}):le.map(Me=>{var He;const{relationshipScore:Ge}=Me,Ee=y==null?void 0:y[Me.id];return r.jsxs(Mr,{className:`cursor-pointer hover:bg-accent/50 ${ye.has(Me.id)?"bg-accent/30":""}`,onClick:()=>{const nt=new URLSearchParams;k&&nt.set("search",k),P!=="all"&&nt.set("type",P),I!=="all"&&nt.set("status",I);const yt=nt.toString();e(`/mission-control/contacts/${Me.id}${yt?`?${yt}`:""}`)},children:[r.jsx(kt,{onClick:nt=>nt.stopPropagation(),children:r.jsx(Bl,{checked:ye.has(Me.id),onCheckedChange:()=>Ue(Me.id)})}),r.jsxs(kt,{className:"font-medium",children:[Me.first_name," ",Me.last_name]}),r.jsx(kt,{children:r.jsxs("div",{className:"flex flex-col gap-1",children:[r.jsx(Fde,{score:Ge,size:"sm"}),r.jsx(bpe,{contact:Me})]})}),r.jsx(kt,{children:r.jsx(Fde,{score:Ge,size:"sm",showScore:!0})}),r.jsx(kt,{children:r.jsxs("div",{className:"space-y-1 text-sm",children:[Me.email&&r.jsxs("div",{className:"flex items-center gap-1 text-muted-foreground",children:[r.jsx(Ns,{className:"h-3 w-3"}),Me.email]}),Me.phone&&r.jsxs("div",{className:"flex items-center gap-1 text-muted-foreground",children:[r.jsx(Ti,{className:"h-3 w-3"}),Me.phone]})]})}),r.jsx(kt,{children:r.jsxs("div",{className:"flex flex-wrap gap-1",children:[(He=Me.tags)==null?void 0:He.map(nt=>{var yt;return r.jsx(Pt,{variant:"secondary",className:"text-xs",children:(yt=nt.relationship_type)==null?void 0:yt.name},nt.id)}),r.jsx(vCe,{deal:Ee})]})}),r.jsx(kt,{children:r.jsx("div",{className:"text-sm",children:Ge.lastTouchDate?r.jsxs("div",{className:"flex items-center gap-1 text-muted-foreground",children:[r.jsx(Ya,{className:"h-3 w-3"}),on(new Date(Ge.lastTouchDate),"MMM d, yyyy")]}):r.jsx("span",{className:"text-muted-foreground text-xs italic",children:"Never contacted"})})}),r.jsx(kt,{children:r.jsxs("div",{className:"space-y-1",children:[r.jsx(yCe,{birthday:Me.birthday,homeAnniversary:Me.home_anniversary}),r.jsxs("div",{className:"text-sm text-muted-foreground",children:[Me.birthday&&r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(Ss,{className:"h-3 w-3"}),on(new Date(Me.birthday),"MMM d")]}),Me.home_anniversary&&r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(xa,{className:"h-3 w-3"}),on(new Date(Me.home_anniversary),"MMM d")]})]})]})}),r.jsx(kt,{children:r.jsx(gCe,{contact:Me,onEdit:J,onDelete:Ce,onSnooze:(nt,yt)=>{se(nt),he(yt)}})})]},Me.id)})})]})})}),Mt>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 ",(at-1)*Te+1,"–",Math.min(at*Te,Mt)," of ",Mt.toLocaleString()," contacts"]}),r.jsxs(mn,{value:String(Te),onValueChange:Me=>{De(Number(Me)),Je(1)},children:[r.jsx(fn,{className:"w-[80px] h-8",children:r.jsx(yn,{})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"50",children:"50"}),r.jsx(qt,{value:"100",children:"100"}),r.jsx(qt,{value:"250",children:"250"})]})]}),r.jsx("span",{className:"text-xs",children:"per page"})]}),r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(ee,{variant:"outline",size:"sm",disabled:at<=1,onClick:()=>Je(1),children:"First"}),r.jsx(ee,{variant:"outline",size:"sm",disabled:at<=1,onClick:()=>Je(Me=>Me-1),children:r.jsx(kc,{className:"h-4 w-4"})}),r.jsxs("span",{className:"px-3 text-sm font-medium",children:["Page ",at," of ",Oe]}),r.jsx(ee,{variant:"outline",size:"sm",disabled:at>=Oe,onClick:()=>Je(Me=>Me+1),children:r.jsx(Wi,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"outline",size:"sm",disabled:at>=Oe,onClick:()=>Je(Oe),children:"Last"})]})]}),r.jsx(Or,{open:V||!!G,onOpenChange:Me=>{Me||(W(!1),J(null),ke())},children:r.jsxs(Ir,{className:"max-w-lg max-h-[90vh] overflow-y-auto",children:[r.jsx($r,{children:r.jsx(Fr,{children:G?"Edit Contact":"Add Contact"})}),r.jsxs("form",{onSubmit:ct,className:"space-y-4",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx($e,{htmlFor:"first_name",children:"First Name *"}),r.jsx(dt,{id:"first_name",value:Be.first_name,onChange:Me=>qe({...Be,first_name:Me.target.value}),required:!0})]}),r.jsxs("div",{children:[r.jsx($e,{htmlFor:"last_name",children:"Last Name"}),r.jsx(dt,{id:"last_name",value:Be.last_name,onChange:Me=>qe({...Be,last_name:Me.target.value})})]})]}),r.jsxs("div",{children:[r.jsx($e,{htmlFor:"email",children:"Email"}),r.jsx(dt,{id:"email",type:"email",value:Be.email,onChange:Me=>qe({...Be,email:Me.target.value})})]}),r.jsxs("div",{children:[r.jsx($e,{htmlFor:"phone",children:"Phone"}),r.jsx(dt,{id:"phone",value:Be.phone,onChange:Me=>qe({...Be,phone:Me.target.value})})]}),r.jsxs("div",{children:[r.jsx($e,{htmlFor:"address",children:"Address"}),r.jsx(dt,{id:"address",value:Be.address,onChange:Me=>qe({...Be,address:Me.target.value}),placeholder:"Street address"})]}),r.jsxs("div",{className:"grid grid-cols-3 gap-4",children:[r.jsxs("div",{children:[r.jsx($e,{htmlFor:"city",children:"City"}),r.jsx(dt,{id:"city",value:Be.city,onChange:Me=>qe({...Be,city:Me.target.value})})]}),r.jsxs("div",{children:[r.jsx($e,{htmlFor:"state",children:"State"}),r.jsx(dt,{id:"state",value:Be.state,onChange:Me=>qe({...Be,state:Me.target.value})})]}),r.jsxs("div",{children:[r.jsx($e,{htmlFor:"zip_code",children:"Zip"}),r.jsx(dt,{id:"zip_code",value:Be.zip_code,onChange:Me=>qe({...Be,zip_code:Me.target.value})})]})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx($e,{htmlFor:"birthday",children:"Birthday"}),r.jsx(dt,{id:"birthday",type:"date",value:Be.birthday,onChange:Me=>qe({...Be,birthday:Me.target.value})})]}),r.jsxs("div",{children:[r.jsx($e,{htmlFor:"home_anniversary",children:"Home Anniversary"}),r.jsx(dt,{id:"home_anniversary",type:"date",value:Be.home_anniversary,onChange:Me=>qe({...Be,home_anniversary:Me.target.value})})]})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx($e,{htmlFor:"spouse_name",children:"Spouse/Partner Name"}),r.jsx(dt,{id:"spouse_name",value:Be.spouse_name,onChange:Me=>qe({...Be,spouse_name:Me.target.value}),placeholder:"Spouse/partner name"})]}),r.jsxs("div",{children:[r.jsx($e,{htmlFor:"spouse_email",children:"Spouse/Partner Email"}),r.jsx(dt,{id:"spouse_email",type:"email",value:Be.spouse_email,onChange:Me=>qe({...Be,spouse_email:Me.target.value}),placeholder:"Spouse/partner email"})]})]}),r.jsxs("div",{children:[r.jsx($e,{children:"Relationship Types"}),r.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:x==null?void 0:x.filter(Me=>Me.active).map(Me=>r.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[r.jsx(Bl,{checked:Be.tagIds.includes(Me.id),onCheckedChange:Ge=>{qe(Ge?{...Be,tagIds:[...Be.tagIds,Me.id]}:{...Be,tagIds:Be.tagIds.filter(Ee=>Ee!==Me.id)})}}),r.jsx("span",{className:"text-sm",children:Me.name})]},Me.id))})]}),r.jsxs("div",{children:[r.jsx($e,{htmlFor:"notes",children:"Notes"}),r.jsx(Jn,{id:"notes",value:Be.notes,onChange:Me=>qe({...Be,notes:Me.target.value}),rows:3})]}),r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(ee,{type:"button",variant:"outline",onClick:()=>{W(!1),J(null),ke()},children:"Cancel"}),r.jsxs(ee,{type:"submit",disabled:_.isPending||b.isPending,children:[G?"Update":"Create"," Contact"]})]})]})]})}),r.jsx(g3t,{open:ne,onOpenChange:oe,relationshipTypes:(x==null?void 0:x.filter(Me=>Me.active))||[],onSuccess:()=>{oe(!1)}}),r.jsx(v3t,{open:ge,onOpenChange:ie,onComplete:()=>ie(!1)}),r.jsx(Bae,{open:!!pe,onOpenChange:Me=>{Me||se(null)},contactId:pe||"",contactName:fe})]})})}function C3t(){return Kt({queryKey:["video-script-categories"],queryFn:async()=>{const{data:e,error:t}=await Q.from("video_script_categories").select("*").order("sort_order");if(t)throw t;return e}})}function M3t(e){return Kt({queryKey:["video-scripts",e],queryFn:async()=>{let t=Q.from("video_scripts").select("*, category:video_script_categories(*)").eq("is_active",!0).order("title");const{data:n,error:s}=await t;if(s)throw s;return n}})}function T3t(){const{user:e}=tn();return Kt({queryKey:["user-video-scripts",e==null?void 0:e.id],queryFn:async()=>{if(!(e!=null&&e.id))return[];const{data:t,error:n}=await Q.from("user_video_scripts").select("*, category:video_script_categories(*)").eq("owner_user_id",e.id).order("title");if(n)throw n;return t},enabled:!!(e!=null&&e.id)})}function A3t(){const{user:e}=tn(),t=Hr();return ir({mutationFn:async n=>{if(!(e!=null&&e.id))throw new Error("Not authenticated");const{data:s,error:a}=await Q.from("user_video_scripts").insert([{owner_user_id:e.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:()=>{t.invalidateQueries({queryKey:["user-video-scripts"]})}})}function E3t(e){const{user:t}=tn();return Kt({queryKey:["agent-videos",t==null?void 0:t.id,e],queryFn:async()=>{if(!(t!=null&&t.id))return[];let n=Q.from("agent_videos").select("*, contact:innercircle_contacts(id, first_name, last_name)").eq("owner_user_id",t.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:!!(t!=null&&t.id)})}function I3t(e){return Kt({queryKey:["agent-video",e],queryFn:async()=>{const{data:t,error:n}=await Q.from("agent_videos").select("*, contact:innercircle_contacts(id, first_name, last_name)").eq("id",e).single();if(n)throw n;return t},enabled:!!e})}function gBe(){const{user:e}=tn(),t=Hr();return ir({mutationFn:async n=>{if(!(e!=null&&e.id))throw new Error("Not authenticated");const{data:s,error:a}=await Q.from("agent_videos").insert([{owner_user_id:e.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:()=>{t.invalidateQueries({queryKey:["agent-videos"]}),t.invalidateQueries({queryKey:["storage-usage"]})}})}function P3t(){const e=Hr();return ir({mutationFn:async({id:t,...n})=>{const{data:s,error:a}=await Q.from("agent_videos").update(n).eq("id",t).select().single();if(a)throw a;return s},onSuccess:t=>{e.invalidateQueries({queryKey:["agent-videos"]}),e.invalidateQueries({queryKey:["agent-video",t.id]})}})}function L3t(){const e=Hr();return ir({mutationFn:async({id:t,bunnyVideoId:n,hardDelete:s=!1})=>{if(console.log("Deleting video:",{id:t,bunnyVideoId:n,hardDelete:s}),n){console.log("Calling bunny-upload delete for videoId:",n);const{data:a,error:o}=await Q.functions.invoke("bunny-upload",{body:{action:"delete",videoId:n,isAgentVideo:!0}});o?console.error("Failed to delete from Bunny:",o):console.log("Bunny delete response:",a)}else console.warn("No bunnyVideoId provided, skipping Bunny.net deletion");if(s){console.log("Hard deleting from database:",t);const{error:a}=await Q.from("agent_videos").delete().eq("id",t);if(a)throw a}else{console.log("Soft deleting from database:",t);const{error:a}=await Q.from("agent_videos").update({is_deleted:!0}).eq("id",t);if(a)throw a}console.log("Video deletion complete")},onSuccess:()=>{e.invalidateQueries({queryKey:["agent-videos"]}),e.invalidateQueries({queryKey:["storage-usage"]})}})}function X0e(){const{user:e}=tn();return Kt({queryKey:["storage-usage",e==null?void 0:e.id],queryFn:async()=>{if(!(e!=null&&e.id))return null;const{data:t,error:n}=await Q.from("agent_storage_usage").select("*").eq("user_id",e.id).maybeSingle();if(n)throw n;return t||{user_id:e.id,total_storage_mb:0,storage_tier:"basic",max_storage_mb:1024}},enabled:!!(e!=null&&e.id)})}function O3t(){const{data:e,isLoading:t}=X0e(),n=e?e.total_storage_mb0?e.total_storage_mb/e.max_storage_mb*100:0,o=a>=80;return{canRecord:n,remainingMb:s,usagePercent:a,isNearLimit:o,storage:e,isLoading:t}}async function D3t(e){const{data:t,error:n}=await Q.functions.invoke("bunny-upload",{body:{action:"create",title:e,isAgentVideo:!0}});if(n)throw n;return t}async function R3t(e){const{data:t,error:n}=await Q.functions.invoke("bunny-upload",{body:{action:"upload-url",videoId:e,isAgentVideo:!0}});if(n)throw n;return t}async function F3t(e){const{data:t,error:n}=await Q.functions.invoke("bunny-upload",{body:{action:"status",videoId:e,isAgentVideo:!0}});if(n)throw n;return t}function z3t(){const{user:e}=tn(),t=Hr();return ir({mutationFn:async({contactId:n,videoId:s,notes:a})=>{if(!(e!=null&&e.id))throw new Error("Not authenticated");const{data:o}=await Q.from("action_types").select("id").eq("name","Video").single();if(!o)throw new Error("Video action type not found");const{data:l,error:i}=await Q.from("contact_touch_logs").insert([{owner_user_id:e.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:()=>{t.invalidateQueries({queryKey:["contact-touch-logs"]}),t.invalidateQueries({queryKey:["contacts"]})}})}function B3t(e){return Kt({queryKey:["contact-video-replies",e],queryFn:async()=>{if(!e)return[];const{data:t,error:n}=await Q.from("video_replies").select(` *, video:agent_videos(id, title, thumbnail_url, playback_url) `).eq("contact_id",e).order("created_at",{ascending:!1});if(n)throw n;return t},enabled:!!e})}function $3t({videoId:e}){var l;const{data:t,isLoading:n,error:s}=I3t(e);if(n)return r.jsxs("div",{className:"space-y-4",children:[r.jsx(Lr,{className:"w-full aspect-video rounded-lg"}),r.jsx(Lr,{className:"h-4 w-1/3"})]});if(s||!t||t.is_deleted)return r.jsxs("div",{className:"flex flex-col items-center justify-center py-8 text-center",children:[r.jsx(rf,{className:"h-12 w-12 text-muted-foreground mb-4"}),r.jsx("h3",{className:"font-medium",children:"Video Unavailable"}),r.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"This video has been deleted or is no longer available."})]});const a=i=>{let u=i;return u.includes("iframe.mediadelivery.net/play/")&&(u=u.replace("/play/","/embed/"),u+=(u.includes("?")?"&":"?")+"autoplay=true&responsive=true"),u},o=(l=t.playback_url)==null?void 0:l.includes("iframe.mediadelivery.net");return r.jsxs("div",{className:"space-y-4",children:[t.playback_url?r.jsx("div",{className:"relative w-full aspect-video bg-black rounded-lg overflow-hidden",children:o?r.jsx("iframe",{src:a(t.playback_url),title:t.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:t.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..."})}),t.title&&r.jsxs("div",{children:[r.jsx("h4",{className:"font-medium",children:t.title}),t.notes&&r.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:t.notes})]})]})}function U3t(){var at,le;const{contactId:e}=md(),t=Gn(),[n]=Gc(),s=n.get("search")||"",a=n.get("type")||"all",o=n.get("status")||"all",{data:l,isLoading:i}=ugt(e||""),{data:u}=qm(),{data:p}=Oye(),{data:x}=cae(365),{data:y}=Uae(365),{data:_}=B3t(e),{contactsWithScores:b}=Rye(),S=gRe(),k=Lye(),M=yRe(),[P,T]=E.useState(!1),[I,z]=E.useState({}),[D,U]=E.useState(!1),[V,W]=E.useState(null),[G,J]=E.useState(""),[ne,oe]=E.useState(null),[ge,ie]=E.useState(!1),[pe,se]=E.useState(null),{isGmailConnected:fe,gmailEmail:he}=$ae(),{data:ye}=Kt({queryKey:["gmail-sent-emails",e],queryFn:async()=>{const{data:Ve,error:Qe}=await Q.from("gmail_sent_emails").select("*").eq("contact_id",e).order("sent_at",{ascending:!1});if(Qe)throw Qe;return Ve},enabled:!!e}),Ae=Ve=>{if(!Ve)return null;const Qe=Ve.match(/Video ID:\s*([a-f0-9-]+)/i);return Qe?Qe[1]:null},we=E.useMemo(()=>{if(!b)return[];let Ve=b.filter(Qe=>{var ct,Ce,Me;const st=s===""||`${Qe.first_name} ${Qe.last_name}`.toLowerCase().includes(s.toLowerCase())||((ct=Qe.email)==null?void 0:ct.toLowerCase().includes(s.toLowerCase()))||((Ce=Qe.phone)==null?void 0:Ce.includes(s)),ke=a==="all"||((Me=Qe.tags)==null?void 0:Me.some(Ge=>Ge.relationship_type_id===a));return st&&ke});return o==="not-touched-90"?Ve=Ve.filter(Qe=>{const st=Qe.relationshipScore.daysSinceTouch;return st===null||st>90}):o==="at-risk"?Ve=Ve.filter(Qe=>Qe.relationshipScore.status==="at-risk"):o==="cooling"?Ve=Ve.filter(Qe=>Qe.relationshipScore.status==="cooling"):o==="warm"&&(Ve=Ve.filter(Qe=>Qe.relationshipScore.status==="warm")),Ve.map(Qe=>Qe.id)},[b,s,a,o]),be=we.indexOf(e||""),_e=be>0?we[be-1]:null,Je=be1&&be!==-1,De=Ve=>{const Qe=new URLSearchParams;s&&Qe.set("search",s),a!=="all"&&Qe.set("type",a),o!=="all"&&Qe.set("status",o);const st=Qe.toString();return`/mission-control/contacts/${Ve}${st?`?${st}`:""}`},Ue=E.useMemo(()=>{const Ve=((x==null?void 0:x.filter(st=>st.contact_id===e))||[]).map(st=>{var ct,Ce;const ke=Ae(st.notes);return{id:st.id,type:"touch",completed_at:st.completed_at,name:((ct=st.action_type)==null?void 0:ct.name)||"Touch",color:((Ce=st.action_type)==null?void 0:Ce.color)||"#3B82F6",notes:st.notes,videoId:ke}}),Qe=((y==null?void 0:y.filter(st=>st.contact_id===e))||[]).map(st=>({id:st.id,type:"popby",completed_at:st.completed_at,name:"Pop-by",color:"#F97316",notes:st.notes,videoId:null}));return[...Ve,...Qe].sort((st,ke)=>new Date(ke.completed_at).getTime()-new Date(st.completed_at).getTime())},[x,y,e]),Be=()=>{var Ve;l&&(z({first_name:l.first_name||"",last_name:l.last_name||"",email:l.email||"",phone:l.phone||"",address:l.address||"",city:l.city||"",state:l.state||"",zip_code:l.zip_code||"",birthday:l.birthday||"",home_anniversary:l.home_anniversary||"",spouse_name:l.spouse_name||"",spouse_email:l.spouse_email||"",company_name:l.company_name||"",job_title:l.job_title||"",notes:l.notes||"",tagIds:((Ve=l.tags)==null?void 0:Ve.map(Qe=>Qe.relationship_type_id))||[]}),T(!0))},qe=async()=>{await S.mutateAsync({id:e,...I}),T(!1)},ot=async()=>{confirm("Are you sure you want to delete this contact?")&&(await k.mutateAsync(e),t("/mission-control/contacts"))},Mt=async()=>{V&&(await M.mutateAsync({contactId:e,actionTypeId:V,notes:G}),U(!1),W(null),J(""))},Oe=(Ve,Qe)=>{fe&&l?(se({email:Ve,name:Qe||`${l.first_name} ${l.last_name||""}`.trim()}),ie(!0)):window.location.href=`mailto:${Ve}`};return i?r.jsx(Dr,{title:"Contact Details",children:r.jsx("div",{className:"flex items-center justify-center py-12",children:r.jsx("div",{className:"animate-spin h-8 w-8 border-4 border-primary border-t-transparent rounded-full"})})}):l?r.jsxs(r.Fragment,{children:[r.jsx(Dr,{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:()=>t("/mission-control/contacts"),children:[r.jsx(kc,{className:"h-4 w-4 mr-1"}),"Back to Contacts"]}),Te&&r.jsxs("div",{className:"flex items-center gap-1 ml-2 border-l pl-2",children:[r.jsxs(ee,{variant:"ghost",size:"sm",onClick:()=>_e&&t(De(_e)),disabled:!_e,className:"px-2",children:[r.jsx(kc,{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:[be+1," of ",we.length]}),r.jsxs(ee,{variant:"ghost",size:"sm",onClick:()=>Je&&t(De(Je)),disabled:!Je,className:"px-2",children:[r.jsx("span",{className:"sr-only sm:not-sr-only sm:mr-1",children:"Next"}),r.jsx(Wi,{className:"h-4 w-4"})]})]})]}),r.jsxs("div",{className:"flex items-center gap-2 w-full sm:w-auto justify-end flex-wrap",children:[l.email&&r.jsxs(ee,{variant:"outline",onClick:()=>Oe(l.email,`${l.first_name} ${l.last_name||""}`.trim()),children:[r.jsx(Ns,{className:"h-4 w-4 mr-1"}),"Email"]}),r.jsxs(ee,{variant:"default",onClick:()=>t(`/mission-control/video/record?contact_id=${e}`),className:"bg-gradient-to-r from-primary to-primary/80",children:[r.jsx($a,{className:"h-4 w-4 mr-1"}),"Quick Video Touch"]}),r.jsxs(Or,{open:D,onOpenChange:U,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(Ir,{children:[r.jsx($r,{children:r.jsx(Fr,{children:"Log an Action"})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx($e,{children:"Action Type"}),r.jsx("div",{className:"grid grid-cols-2 gap-2 mt-2",children:p==null?void 0:p.filter(Ve=>Ve.active).map(Ve=>r.jsxs("button",{onClick:()=>W(Ve.id),className:` p-3 rounded-lg border text-left transition-all ${V===Ve.id?"border-primary bg-primary/10":"hover:bg-accent"} `,children:[r.jsx("div",{className:"font-medium",children:Ve.name}),r.jsx("div",{className:"text-xs text-muted-foreground",children:Ve.description})]},Ve.id))})]}),r.jsxs("div",{children:[r.jsx($e,{htmlFor:"action-notes",children:"Notes (optional)"}),r.jsx(Jn,{id:"action-notes",value:G,onChange:Ve=>J(Ve.target.value),placeholder:"Add any notes about this interaction...",rows:3})]}),r.jsxs(ee,{onClick:Mt,disabled:!V||M.isPending,className:"w-full",children:[r.jsx(Ni,{className:"h-4 w-4 mr-1"}),"Complete Action"]})]})]})]}),r.jsxs(ee,{variant:"outline",onClick:Be,children:[r.jsx(gc,{className:"h-4 w-4 mr-1"}),"Edit"]}),r.jsx(ee,{variant:"destructive",size:"icon",onClick:ot,children:r.jsx(Bn,{className:"h-4 w-4"})})]})]}),r.jsx("div",{className:"bg-card border rounded-lg p-4 sm:p-6",children:r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center gap-4",children:[r.jsxs("div",{className:"flex-1",children:[r.jsxs("h1",{className:"text-2xl sm:text-3xl font-bold",children:[l.first_name," ",l.last_name||""]}),r.jsxs("div",{className:"flex flex-wrap items-center gap-3 mt-2 text-muted-foreground",children:[l.email&&r.jsxs("button",{onClick:()=>Oe(l.email),className:"flex items-center gap-1 hover:text-primary transition-colors",children:[r.jsx(Ns,{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(Ti,{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(bpe,{contact:l}),(at=l.tags)==null?void 0:at.map(Ve=>{const Qe=u==null?void 0:u.find(st=>st.id===Ve.relationship_type_id);return Qe?r.jsx(Pt,{variant:"secondary",className:"text-xs",children:Qe.name},Ve.id):null})]})]})}),r.jsxs("div",{className:"grid md:grid-cols-3 gap-6",children:[r.jsxs(Ze,{className:"md:col-span-2",children:[r.jsx(Wt,{children:r.jsx(Yt,{children:"Contact Information"})}),r.jsx(et,{children:P?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($e,{htmlFor:"first_name",children:"First Name"}),r.jsx(dt,{id:"first_name",value:I.first_name,onChange:Ve=>z({...I,first_name:Ve.target.value})})]}),r.jsxs("div",{children:[r.jsx($e,{htmlFor:"last_name",children:"Last Name"}),r.jsx(dt,{id:"last_name",value:I.last_name,onChange:Ve=>z({...I,last_name:Ve.target.value})})]})]}),r.jsxs("div",{children:[r.jsx($e,{htmlFor:"email",children:"Email"}),r.jsx(dt,{id:"email",type:"email",value:I.email,onChange:Ve=>z({...I,email:Ve.target.value})})]}),r.jsxs("div",{children:[r.jsx($e,{htmlFor:"phone",children:"Phone"}),r.jsx(dt,{id:"phone",value:I.phone,onChange:Ve=>z({...I,phone:Ve.target.value})})]}),r.jsxs("div",{children:[r.jsx($e,{htmlFor:"address",children:"Street Address"}),r.jsx(dt,{id:"address",value:I.address,onChange:Ve=>z({...I,address:Ve.target.value}),placeholder:"123 Main St"})]}),r.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-4",children:[r.jsxs("div",{className:"col-span-2",children:[r.jsx($e,{htmlFor:"city",children:"City"}),r.jsx(dt,{id:"city",value:I.city,onChange:Ve=>z({...I,city:Ve.target.value}),placeholder:"City"})]}),r.jsxs("div",{children:[r.jsx($e,{htmlFor:"state",children:"State"}),r.jsx(dt,{id:"state",value:I.state,onChange:Ve=>z({...I,state:Ve.target.value}),placeholder:"TX",maxLength:2})]}),r.jsxs("div",{children:[r.jsx($e,{htmlFor:"zip_code",children:"Zip Code"}),r.jsx(dt,{id:"zip_code",value:I.zip_code,onChange:Ve=>z({...I,zip_code:Ve.target.value}),placeholder:"12345"})]})]}),r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx($e,{htmlFor:"birthday",children:"Birthday"}),r.jsx(dt,{id:"birthday",type:"date",value:I.birthday,onChange:Ve=>z({...I,birthday:Ve.target.value})})]}),r.jsxs("div",{children:[r.jsx($e,{htmlFor:"home_anniversary",children:"Home Anniversary"}),r.jsx(dt,{id:"home_anniversary",type:"date",value:I.home_anniversary,onChange:Ve=>z({...I,home_anniversary:Ve.target.value})})]})]}),r.jsx(Ld,{}),r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx($e,{htmlFor:"spouse_name",children:"Spouse/Partner Name"}),r.jsx(dt,{id:"spouse_name",value:I.spouse_name,onChange:Ve=>z({...I,spouse_name:Ve.target.value}),placeholder:"Enter spouse name"})]}),r.jsxs("div",{children:[r.jsx($e,{htmlFor:"spouse_email",children:"Spouse/Partner Email"}),r.jsx(dt,{id:"spouse_email",type:"email",value:I.spouse_email,onChange:Ve=>z({...I,spouse_email:Ve.target.value}),placeholder:"Enter spouse email"})]})]}),r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[r.jsxs("div",{children:[r.jsx($e,{htmlFor:"company_name",children:"Company"}),r.jsx(dt,{id:"company_name",value:I.company_name,onChange:Ve=>z({...I,company_name:Ve.target.value}),placeholder:"Enter company name"})]}),r.jsxs("div",{children:[r.jsx($e,{htmlFor:"job_title",children:"Job Title"}),r.jsx(dt,{id:"job_title",value:I.job_title,onChange:Ve=>z({...I,job_title:Ve.target.value}),placeholder:"Enter job title"})]})]}),r.jsxs("div",{children:[r.jsx($e,{children:"Relationship Types"}),r.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:u==null?void 0:u.filter(Ve=>Ve.active).map(Ve=>{var Qe;return r.jsxs("label",{className:"flex items-center gap-2 cursor-pointer",children:[r.jsx(Bl,{checked:(Qe=I.tagIds)==null?void 0:Qe.includes(Ve.id),onCheckedChange:st=>{var ke;z(st?{...I,tagIds:[...I.tagIds||[],Ve.id]}:{...I,tagIds:(ke=I.tagIds)==null?void 0:ke.filter(ct=>ct!==Ve.id)})}}),r.jsx("span",{className:"text-sm",children:Ve.name})]},Ve.id)})})]}),r.jsxs("div",{children:[r.jsx($e,{htmlFor:"notes",children:"Notes"}),r.jsx(Jn,{id:"notes",value:I.notes,onChange:Ve=>z({...I,notes:Ve.target.value}),rows:4})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(ee,{onClick:qe,disabled:S.isPending,children:"Save Changes"}),r.jsx(ee,{variant:"outline",onClick:()=>T(!1),children:"Cancel"})]})]}):r.jsxs("div",{className:"space-y-4",children:[Ue.length>0&&r.jsxs("div",{className:"bg-muted/50 rounded-lg p-3 flex items-center gap-2",children:[r.jsx(Ss,{className:"h-4 w-4 text-primary"}),r.jsxs("span",{className:"text-sm",children:[r.jsx("span",{className:"font-medium",children:"Last Contacted:"})," ",on(new Date(Ue[0].completed_at),"MMM d, yyyy")," ","(",Ue[0].name,")"]})]}),r.jsxs("div",{className:"flex flex-col sm:flex-row sm:gap-6 gap-2",children:[l.email&&r.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[r.jsx(Ns,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),r.jsx("button",{onClick:()=>Oe(l.email),className:"text-primary hover:underline truncate text-left",children:l.email})]}),l.phone&&r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ti,{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(Po,{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(Ss,{className:"h-4 w-4 text-muted-foreground"}),r.jsxs("span",{children:["Birthday: ",on(new Date(l.birthday),"MMMM d")]})]}),l.home_anniversary&&r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(xa,{className:"h-4 w-4 text-muted-foreground"}),r.jsxs("span",{children:["Home Anniversary: ",on(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(Ld,{}),r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[(l.spouse_name||l.spouse_email)&&r.jsxs("div",{className:"space-y-1",children:[l.spouse_name&&r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(ic,{className:"h-4 w-4 text-muted-foreground"}),r.jsxs("span",{children:["Spouse: ",l.spouse_name]})]}),l.spouse_email&&r.jsxs("div",{className:"flex items-center gap-2 ml-6",children:[r.jsx(Ns,{className:"h-4 w-4 text-muted-foreground"}),r.jsx("button",{onClick:()=>Oe(l.spouse_email,l.spouse_name||void 0),className:"text-primary hover:underline text-left",children:l.spouse_email})]})]}),(l.company_name||l.job_title)&&r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(hi,{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(Ld,{}),r.jsxs("div",{children:[r.jsx("h4",{className:"font-medium mb-2",children:"Relationship Types"}),r.jsx("div",{className:"flex flex-wrap gap-2",children:(le=l.tags)!=null&&le.length?l.tags.map(Ve=>{var Qe;return r.jsx(Pt,{variant:"secondary",children:(Qe=Ve.relationship_type)==null?void 0:Qe.name},Ve.id)}):r.jsx("span",{className:"text-sm text-muted-foreground",children:"No relationship types assigned"})})]}),l.notes&&r.jsxs(r.Fragment,{children:[r.jsx(Ld,{}),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(h3t,{contact:l,onLogTouch:()=>U(!0)}),r.jsxs(Ze,{children:[r.jsx(Wt,{children:r.jsx(Yt,{children:"Activity Log"})}),r.jsx(et,{children:Ue.length>0?r.jsx("div",{className:"space-y-4",children:Ue.map(Ve=>{var Qe;return r.jsxs("div",{className:"flex items-start gap-3 pb-3 border-b last:border-0",children:[r.jsx("div",{className:"h-8 w-8 rounded-full flex items-center justify-center text-white text-xs",style:{backgroundColor:Ve.color},children:Ve.type==="popby"?r.jsx(to,{className:"h-4 w-4"}):(Qe=Ve.name)==null?void 0:Qe.charAt(0)}),r.jsxs("div",{className:"flex-1",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"font-medium text-sm",children:Ve.name}),Ve.videoId&&r.jsxs(ee,{variant:"ghost",size:"sm",className:"h-6 px-2 text-xs",onClick:()=>oe(Ve.videoId),children:[r.jsx(Vl,{className:"h-3 w-3 mr-1"}),"Preview"]})]}),r.jsx("div",{className:"text-xs text-muted-foreground",children:on(new Date(Ve.completed_at),"MMM d, yyyy h:mm a")}),Ve.notes&&!Ve.videoId&&r.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:Ve.notes})]})]},Ve.id)})}):r.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:"No activity logged yet"})})]}),_&&_.length>0&&r.jsxs(Ze,{children:[r.jsx(Wt,{children:r.jsxs(Yt,{className:"flex items-center gap-2",children:[r.jsx(zo,{className:"h-5 w-5 text-primary"}),"Video Replies"]})}),r.jsx(et,{children:r.jsx("div",{className:"space-y-4",children:_.map(Ve=>{var Qe,st;return r.jsxs("div",{className:"flex items-start gap-3 pb-3 border-b last:border-0",children:[(Qe=Ve.video)!=null&&Qe.thumbnail_url?r.jsx("img",{src:Ve.video.thumbnail_url,alt:Ve.video.title||"Video",className:"h-12 w-16 object-cover rounded cursor-pointer hover:opacity-80 transition-opacity",onClick:()=>oe(Ve.video_id)}):r.jsx("div",{className:"h-12 w-16 bg-muted rounded flex items-center justify-center cursor-pointer hover:bg-muted/80 transition-colors",onClick:()=>oe(Ve.video_id),children:r.jsx($a,{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: ",((st=Ve.video)==null?void 0:st.title)||"Untitled Video"]}),r.jsxs(ee,{variant:"ghost",size:"sm",className:"h-6 px-2 text-xs flex-shrink-0",onClick:()=>oe(Ve.video_id),children:[r.jsx(Vl,{className:"h-3 w-3 mr-1"}),"Watch"]})]}),r.jsx("div",{className:"text-xs text-muted-foreground",children:on(new Date(Ve.created_at),"MMM d, yyyy h:mm a")}),Ve.message&&r.jsxs("p",{className:"text-sm text-muted-foreground mt-1 line-clamp-2",children:['"',Ve.message,'"']})]})]},Ve.id)})})})]}),ye&&ye.length>0&&r.jsxs(Ze,{children:[r.jsx(Wt,{children:r.jsxs(Yt,{className:"flex items-center gap-2",children:[r.jsx(lo,{className:"h-5 w-5 text-sky-500"}),"Sent Emails"]})}),r.jsx(et,{children:r.jsx("div",{className:"space-y-4",children:ye.map(Ve=>r.jsxs("details",{className:"group pb-3 border-b last:border-0",children:[r.jsxs("summary",{className:"flex items-start gap-3 cursor-pointer list-none",children:[r.jsx("div",{className:"h-8 w-8 rounded-full bg-sky-500/10 flex items-center justify-center text-sky-600 flex-shrink-0",children:r.jsx(Ns,{className:"h-4 w-4"})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"font-medium text-sm truncate",children:Ve.subject}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:["To: ",Ve.to_email," · ",on(new Date(Ve.sent_at),"MMM d, yyyy h:mm a")]})]})]}),r.jsx("div",{className:"mt-2 ml-11 p-3 bg-muted/30 rounded-lg text-sm whitespace-pre-wrap",children:Ve.body})]},Ve.id))})})]})]}),r.jsx(Or,{open:!!ne,onOpenChange:Ve=>!Ve&&oe(null),children:r.jsxs(Ir,{className:"max-w-2xl",children:[r.jsx($r,{children:r.jsx(Fr,{children:"Video Preview"})}),ne&&r.jsx($3t,{videoId:ne})]})})]})]})}),fe&&l&&pe&&r.jsx(Z0e,{open:ge,onOpenChange:ie,contact:{id:l.id,first_name:l.first_name,last_name:l.last_name,email:pe.email},gmailEmail:he})]}):r.jsx(Dr,{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:()=>t("/mission-control/contacts"),children:"Back to Contacts"})]})})}const _Ce={Crown:B1,FileText:Ea,Users:Un,Globe:cy,Star:js,Phone:Ti,MessageSquare:zo,PenTool:zj,Video:$a,Gift:to},zde=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function q3t(){var He,nt;const e=Gn(),{user:t}=tn(),{data:n}=qm(),{data:s}=fgt(),{data:a}=_gt(),{data:o}=mRe(),{data:l}=Oye(),{data:i}=hgt(),u=bgt(),p=pgt(),x=ggt(),y=xgt(),_=ygt(),b=vgt(),S=mgt(),[k,M]=E.useState(null),[P,T]=E.useState(!1),[I,z]=E.useState(null),[D,U]=E.useState(""),[V,W]=E.useState(""),[G,J]=E.useState([]),[ne,oe]=E.useState(null),[ge,ie]=E.useState(null),[pe,se]=E.useState(!1),[fe,he]=E.useState(""),[ye,Ae]=E.useState(""),[we,be]=E.useState(""),[_e,Je]=E.useState(""),Te=(yt,it)=>a==null?void 0:a.some(zt=>zt.plan_id===yt&&zt.relationship_type_id===it&&zt.active),De=yt=>a==null?void 0:a.find(it=>it.relationship_type_id===yt&&it.active),Ue=async(yt,it)=>{const zt=Te(yt,it);await u.mutateAsync({planId:yt,relationshipTypeId:it,active:!zt})},Be=(s==null?void 0:s.filter(yt=>yt.active&&!yt.owner_user_id))||[],qe=(s==null?void 0:s.filter(yt=>yt.owner_user_id===(t==null?void 0:t.id)))||[],ot=n==null?void 0:n.find(yt=>yt.id===k),Mt=k?De(k):null,Oe=s==null?void 0:s.find(yt=>yt.id===(Mt==null?void 0:Mt.plan_id)),at=async()=>{if(!D.trim())return;const yt=await p.mutateAsync({name:D,description:V});yt&&G.length>0&&await _.mutateAsync({planId:yt.id,items:G}),Qe()},le=async()=>{!D.trim()||!I||(await x.mutateAsync({id:I,name:D,description:V}),await _.mutateAsync({planId:I,items:G}),Qe())},Ve=yt=>{var it;z(yt.id),U(yt.name),W(yt.description||""),J(((it=yt.items)==null?void 0:it.map(zt=>({month_number:zt.month_number,action_type_id:zt.action_type_id,default_script_id:zt.default_script_id||void 0,notes:zt.notes||void 0})))||[]),T(!0)},Qe=()=>{T(!1),z(null),U(""),W(""),J([])},st=(yt,it)=>{ie(it)},ke=(yt,it,zt)=>{J(dr=>[...dr.filter(Gr=>Gr.month_number!==yt),{month_number:yt,action_type_id:it,default_script_id:zt}]),oe(null),ie(null)},ct=yt=>{J(it=>it.filter(zt=>zt.month_number!==yt))},Ce=async()=>{if(!fe.trim()||!ye.trim()||!ge)return;const yt=await b.mutateAsync({actionTypeId:ge,title:fe,scriptBody:ye,emailSubject:we||void 0,tone:_e||void 0});yt&&ne!==null&&ke(ne,ge,yt.id),se(!1),he(""),Ae(""),be(""),Je("")},Me=ge?i==null?void 0:i.filter(yt=>yt.action_type_id===ge&&yt.active):[],Ge=yt=>_Ce[yt||"Phone"]||Ti,Ee=yt=>_Ce[yt||"Users"]||Un;return r.jsxs(Dr,{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:()=>e("/mission-control"),children:[r.jsx(kc,{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(yt=>yt.active).map(yt=>{const it=Ee(yt.icon),zt=(o==null?void 0:o[yt.id])||0,dr=De(yt.id),Rr=s==null?void 0:s.find(Ur=>Ur.id===(dr==null?void 0:dr.plan_id)),Gr=k===yt.id;return r.jsxs("button",{onClick:()=>M(yt.id),className:` w-full flex items-center gap-3 p-4 rounded-lg border text-left transition-all ${Gr?"border-primary bg-primary/5 ring-2 ring-primary":"hover:bg-accent"} `,children:[r.jsx(it,{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:yt.name}),r.jsxs("div",{className:"text-sm text-muted-foreground",children:[zt," contacts"]})]}),Rr?r.jsxs(Pt,{variant:"secondary",className:"text-xs",children:[r.jsx(di,{className:"h-3 w-3 mr-1"}),Rr.name.split(" ")[0]]}):r.jsx(Pt,{variant:"outline",className:"text-xs text-muted-foreground",children:"No plan"})]},yt.id)})]}),r.jsx("div",{className:"lg:col-span-2",children:k&&ot?r.jsxs(Ze,{children:[r.jsxs(Wt,{children:[r.jsxs(Yt,{className:"flex items-center gap-2",children:[(()=>{const yt=Ee(ot.icon);return r.jsx(yt,{className:"h-5 w-5"})})(),ot.name," Touchpoint Plan"]}),r.jsxs(Sn,{children:["Choose a plan for your ",ot.name," contacts"]})]}),r.jsxs(et,{className:"space-y-6",children:[Oe&&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(di,{className:"h-4 w-4 text-green-500"}),"Currently using: ",Oe.name]}),Oe.description&&r.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:Oe.description})]}),r.jsx(ee,{variant:"outline",size:"sm",onClick:()=>Ue(Oe.id,k),children:"Disable"})]}),Oe.items&&Oe.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(Ss,{className:"h-4 w-4"}),"12-Month Schedule"]}),r.jsx("div",{className:"grid grid-cols-4 sm:grid-cols-6 gap-2",children:zde.map((yt,it)=>{var Gr,Ur;const zt=((Gr=Oe.items)==null?void 0:Gr.filter(kn=>kn.month_number===it+1))||[],dr=(Ur=zt[0])==null?void 0:Ur.action_type,Rr=dr?Ge(dr.icon):null;return r.jsxs("div",{className:` p-2 rounded border text-center ${zt.length>0?"bg-primary/10 border-primary":"bg-muted"} `,children:[r.jsx("div",{className:"text-xs text-muted-foreground",children:yt}),Rr&&r.jsx(Rr,{className:"h-4 w-4 mx-auto mt-1",style:{color:(dr==null?void 0:dr.color)||"#3B82F6"}})]},it)})})]})]}),r.jsxs("div",{children:[r.jsx("h4",{className:"font-medium mb-3",children:Oe?"Switch to a Different Plan":"Choose a Plan"}),Be.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"}),Be.map(yt=>{var zt;const it=(Oe==null?void 0:Oe.id)===yt.id;return r.jsxs("div",{className:` flex items-center justify-between p-3 rounded-lg border ${it?"opacity-50":"hover:bg-accent"} `,children:[r.jsxs("div",{children:[r.jsx("div",{className:"font-medium",children:yt.name}),r.jsxs("div",{className:"text-sm text-muted-foreground",children:[((zt=yt.items)==null?void 0:zt.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:S.isPending,onClick:()=>{const dr=`${yt.name} (Copy)`;S.mutate({sourcePlanId:yt.id,newName:dr})},children:r.jsx(Wo,{className:"h-4 w-4"})}),r.jsx(ee,{size:"sm",variant:it?"outline":"default",disabled:it||u.isPending,onClick:()=>Ue(yt.id,k),children:it?"Active":"Use This"})]})]},yt.id)})]}),qe.length>0&&r.jsxs("div",{className:"space-y-2",children:[r.jsx("div",{className:"text-sm text-muted-foreground",children:"My Custom Plans"}),qe.map(yt=>{var zt;const it=(Oe==null?void 0:Oe.id)===yt.id;return r.jsxs("div",{className:` flex items-center justify-between p-3 rounded-lg border ${it?"opacity-50":"hover:bg-accent"} `,children:[r.jsxs("div",{children:[r.jsx("div",{className:"font-medium",children:yt.name}),r.jsxs("div",{className:"text-sm text-muted-foreground",children:[((zt=yt.items)==null?void 0:zt.length)||0," touchpoints/year"]})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(ee,{size:"sm",variant:"ghost",title:"Edit plan",onClick:()=>Ve(yt),children:r.jsx(G0,{className:"h-4 w-4"})}),r.jsx(ee,{size:"sm",variant:"ghost",title:"Delete plan",onClick:()=>y.mutate(yt.id),children:r.jsx(Bn,{className:"h-4 w-4 text-destructive"})}),r.jsx(ee,{size:"sm",variant:it?"outline":"default",disabled:it||u.isPending,onClick:()=>Ue(yt.id,k),children:it?"Active":"Use This"})]})]},yt.id)})]}),Be.length===0&&qe.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(Ze,{children:r.jsxs(et,{className:"py-12 text-center text-muted-foreground",children:[r.jsx(Ss,{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(Ze,{className:"bg-muted/50",children:r.jsx(et,{className:"py-4",children:r.jsxs("p",{className:"text-sm text-muted-foreground",children:[r.jsx("strong",{children:"How it works:"})," When you assign a plan to a contact group, those contacts will appear in your daily suggested actions based on the plan's schedule."]})})})]}),r.jsx(Or,{open:P,onOpenChange:yt=>{yt?T(!0):Qe()},children:r.jsxs(Ir,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsx($r,{children:r.jsx(Fr,{children:I?"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($e,{htmlFor:"plan-name",children:"Plan Name"}),r.jsx(dt,{id:"plan-name",value:D,onChange:yt=>U(yt.target.value),placeholder:"e.g., My VIP Plan"})]}),r.jsxs("div",{children:[r.jsx($e,{htmlFor:"plan-description",children:"Description (optional)"}),r.jsx(Jn,{id:"plan-description",value:V,onChange:yt=>W(yt.target.value),placeholder:"Describe your plan...",rows:2})]})]}),r.jsxs("div",{children:[r.jsx($e,{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:zde.map((yt,it)=>{const zt=it+1,dr=G.find(Ur=>Ur.month_number===zt),Rr=dr?l==null?void 0:l.find(Ur=>Ur.id===dr.action_type_id):null,Gr=Rr?Ge(Rr.icon):null;return r.jsxs("div",{className:"relative",children:[r.jsxs("button",{type:"button",onClick:()=>oe(ne===zt?null:zt),className:` w-full p-3 rounded-lg border text-center transition-all ${dr?"bg-primary/10 border-primary":"bg-muted hover:bg-accent"} ${ne===zt?"ring-2 ring-primary":""} `,children:[r.jsx("div",{className:"text-xs text-muted-foreground font-medium",children:yt}),Gr?r.jsx(Gr,{className:"h-5 w-5 mx-auto mt-1",style:{color:(Rr==null?void 0:Rr.color)||"#3B82F6"}}):r.jsx(bn,{className:"h-5 w-5 mx-auto mt-1 text-muted-foreground/50"})]}),dr&&r.jsx("button",{type:"button",onClick:Ur=>{Ur.stopPropagation(),ct(zt)},className:"absolute -top-1 -right-1 p-1 bg-destructive text-destructive-foreground rounded-full",children:r.jsx(hs,{className:"h-3 w-3"})})]},it)})}),ne!==null&&!ge&&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 ",zde[ne-1],":"]}),r.jsx("div",{className:"flex flex-wrap gap-2",children:l==null?void 0:l.filter(yt=>yt.active).map(yt=>{const it=Ge(yt.icon);return r.jsxs("button",{type:"button",onClick:()=>st(ne,yt.id),className:"flex items-center gap-2 px-3 py-2 rounded-lg border bg-background hover:bg-accent transition-colors",children:[r.jsx(it,{className:"h-4 w-4",style:{color:yt.color||"#3B82F6"}}),r.jsx("span",{className:"text-sm",children:yt.name})]},yt.id)})})]}),ne!==null&&ge&&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:()=>ie(null),children:[r.jsx(kc,{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:()=>ke(ne,ge),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"})]})}),Me==null?void 0:Me.map(yt=>r.jsx("button",{type:"button",onClick:()=>ke(ne,ge,yt.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:yt.title}),yt.tone&&r.jsx(Pt,{variant:"secondary",className:"text-xs mt-1",children:yt.tone}),r.jsxs("div",{className:"text-xs text-muted-foreground mt-1 line-clamp-2",children:[yt.script_body.substring(0,100),"..."]})]})},yt.id)),r.jsxs("button",{type:"button",onClick:()=>se(!0),className:"w-full flex items-center gap-3 p-3 rounded-lg border border-dashed bg-background hover:bg-accent transition-colors text-left",children:[r.jsx(bn,{className:"h-5 w-5 text-muted-foreground"}),r.jsxs("div",{className:"flex-1",children:[r.jsx("div",{className:"font-medium text-sm",children:"Create Custom Script"}),r.jsx("div",{className:"text-xs text-muted-foreground",children:"Write your own script for this action"})]})]})]})]})]}),G.length>0&&r.jsxs("div",{className:"text-sm text-muted-foreground",children:[G.length," touchpoint",G.length!==1?"s":""," per year"]})]}),r.jsxs(Bs,{children:[r.jsx(ee,{variant:"outline",onClick:Qe,children:"Cancel"}),r.jsxs(ee,{onClick:I?le:at,disabled:!D.trim()||p.isPending||x.isPending,children:[r.jsx(Em,{className:"h-4 w-4 mr-2"}),I?"Save Changes":"Create Plan"]})]})]})}),r.jsx(Or,{open:pe,onOpenChange:se,children:r.jsxs(Ir,{className:"max-w-lg",children:[r.jsx($r,{children:r.jsx(Fr,{children:"Create Custom Script"})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx($e,{htmlFor:"script-title",children:"Script Title"}),r.jsx(dt,{id:"script-title",value:fe,onChange:yt=>he(yt.target.value),placeholder:"e.g., Friendly Check-in Call"})]}),r.jsxs("div",{children:[r.jsx($e,{htmlFor:"script-tone",children:"Tone (optional)"}),r.jsxs(mn,{value:_e,onValueChange:Je,children:[r.jsx(fn,{children:r.jsx(yn,{placeholder:"Select tone..."})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"friendly",children:"Friendly"}),r.jsx(qt,{value:"professional",children:"Professional"}),r.jsx(qt,{value:"casual",children:"Casual"}),r.jsx(qt,{value:"formal",children:"Formal"})]})]})]}),((nt=(He=l==null?void 0:l.find(yt=>yt.id===ge))==null?void 0:He.name)==null?void 0:nt.toLowerCase().includes("email"))&&r.jsxs("div",{children:[r.jsx($e,{htmlFor:"script-email-subject",children:"Email Subject"}),r.jsx(dt,{id:"script-email-subject",value:we,onChange:yt=>be(yt.target.value),placeholder:"e.g., Quick Hello!"})]}),r.jsxs("div",{children:[r.jsx($e,{htmlFor:"script-body",children:"Script Content"}),r.jsx(Jn,{id:"script-body",value:ye,onChange:yt=>Ae(yt.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(Bs,{children:[r.jsx(ee,{variant:"outline",onClick:()=>se(!1),children:"Cancel"}),r.jsxs(ee,{onClick:Ce,disabled:!fe.trim()||!ye.trim()||b.isPending,children:[r.jsx(Em,{className:"h-4 w-4 mr-2"}),"Create & Use Script"]})]})]})})]})}const V3t="0dde5abb-0005-4c8c-a471-30d0cbc9e280",H3t=[{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 W3t(){const e=Gn(),t=fBe(),{data:n}=dBe(),{data:s}=qm(),{data:a}=Y0e(),{data:o}=Uae(90),{data:l}=jp(),i=d3t(),u=pBe(),p=l3t(),x=c3t(),{data:y=[],isLoading:_}=Kt({queryKey:["popby-templates"],queryFn:async()=>{const{data:pe,error:se}=await Q.from("canva_templates").select(` *, category:template_categories(id, name), type:template_types(id, name) `).eq("category_id",V3t).order("publish_date",{ascending:!1});if(se)throw se;const{data:fe}=await Q.from("template_likes").select("template_id"),{data:he}=await Q.from("template_comments").select("template_id"),ye=new Map;fe==null||fe.forEach(we=>{ye.set(we.template_id,(ye.get(we.template_id)||0)+1)});const Ae=new Map;return he==null||he.forEach(we=>{Ae.set(we.template_id,(Ae.get(we.template_id)||0)+1)}),(pe||[]).map(we=>({...we,likesCount:ye.get(we.id)||0,commentsCount:Ae.get(we.id)||0}))}}),b=pe=>{const se=l==null?void 0:l.find(fe=>fe.id===pe);return se?`${se.first_name} ${se.last_name||""}`.trim():"Unknown"},S=pe=>{if(!pe)return null;const se=n==null?void 0:n.find(fe=>fe.id===pe);return(se==null?void 0:se.name)||null},[k,M]=E.useState(null),[P,T]=E.useState(!1),[I,z]=E.useState(!1),[D,U]=E.useState(!1),[V,W]=E.useState({popby_item_id:"",notes:""}),[G,J]=E.useState({name:"",description:""}),ne=async()=>{k&&(await u.mutateAsync({contact_id:k.id,popby_item_id:V.popby_item_id||void 0,notes:V.notes||void 0}),T(!1),M(null),W({popby_item_id:"",notes:""}))},oe=async()=>{G.name.trim()&&(await p.mutateAsync({name:G.name.trim(),description:G.description.trim()||void 0}),U(!1),J({name:"",description:""}))},ge=async(pe,se)=>{await x.mutateAsync({relationship_type_id:pe,frequency_days:parseInt(se)})},ie=pe=>{var fe;const se=a==null?void 0:a.find(he=>he.relationship_type_id===pe);return((fe=se==null?void 0:se.frequency_days)==null?void 0:fe.toString())||"90"};return r.jsx(Dr,{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(Ze,{children:r.jsxs(et,{className:"p-4 text-center",children:[r.jsx("div",{className:"text-3xl font-bold text-primary",children:i.thisWeekCount}),r.jsx("div",{className:"text-sm text-muted-foreground",children:"This Week"})]})}),r.jsx(Ze,{children:r.jsxs(et,{className:"p-4 text-center",children:[r.jsx("div",{className:"text-3xl font-bold text-emerald-500",children:i.thisMonthCount}),r.jsx("div",{className:"text-sm text-muted-foreground",children:"This Month"})]})}),r.jsx(Ze,{children:r.jsxs(et,{className:"p-4 text-center",children:[r.jsx("div",{className:"text-3xl font-bold text-amber-500",children:i.dueCount}),r.jsx("div",{className:"text-sm text-muted-foreground",children:"Due Now"})]})})]}),r.jsxs("div",{className:"flex gap-2 flex-wrap",children:[r.jsxs(ee,{onClick:()=>e("/mission-control/popbys/map"),children:[r.jsx(Po,{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:()=>U(!0),children:[r.jsx(bn,{className:"h-4 w-4 mr-2"}),"Add Popby Idea"]})]}),r.jsxs(Ai,{defaultValue:"due",children:[r.jsxs(vi,{children:[r.jsx(sn,{value:"due",children:"Due for Popby"}),r.jsx(sn,{value:"activity",children:"Recent Activity"}),r.jsx(sn,{value:"library",children:"Popby Library"}),r.jsx(sn,{value:"templates",children:"Popby Templates"})]}),r.jsx(Mn,{value:"due",className:"space-y-4 mt-4",children:!t||t.length===0?r.jsx(Ze,{children:r.jsxs(et,{className:"p-8 text-center text-muted-foreground",children:[r.jsx(to,{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:t.map(pe=>r.jsx(Ze,{className:"hover:shadow-md transition-shadow",children:r.jsx(et,{className:"p-4",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex-1",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs("span",{className:"font-medium",children:[pe.first_name," ",pe.last_name]}),pe.daysOverdue>0&&r.jsxs(Pt,{variant:"destructive",className:"text-xs",children:[pe.daysOverdue,"+ days overdue"]}),pe.daysSinceLastPopby===null&&r.jsx(Pt,{variant:"outline",className:"text-xs",children:"Never visited"})]}),r.jsxs("div",{className:"flex items-center gap-4 mt-1 text-sm text-muted-foreground",children:[pe.address&&r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Po,{className:"h-3 w-3"}),pe.city||pe.address]}),pe.tags&&pe.tags.length>0&&r.jsx("span",{children:pe.tags.map(se=>{var fe;return(fe=se.relationship_type)==null?void 0:fe.name}).join(", ")})]}),pe.lastPopby&&r.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["Last popby: ",on(new Date(pe.lastPopby),"MMM d, yyyy")]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[pe.phone&&r.jsx(ee,{size:"sm",variant:"ghost",asChild:!0,children:r.jsx("a",{href:`tel:${pe.phone}`,children:r.jsx(Ti,{className:"h-4 w-4"})})}),r.jsxs(ee,{size:"sm",onClick:()=>{M(pe),T(!0)},children:[r.jsx(di,{className:"h-4 w-4 mr-1"}),"Log Popby"]})]})]})})},pe.id))})}),r.jsx(Mn,{value:"activity",className:"space-y-4 mt-4",children:!o||o.length===0?r.jsx(Ze,{children:r.jsxs(et,{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(Ze,{children:[r.jsx(Wt,{children:r.jsx(Yt,{className:"text-lg",children:"Recent Popby Log"})}),r.jsx(et,{className:"space-y-3",children:o.map(pe=>r.jsxs("div",{className:"flex items-start gap-3 pb-3 border-b last:border-0 last:pb-0",children:[r.jsx("div",{className:"h-10 w-10 rounded-full bg-orange-500/10 flex items-center justify-center",children:r.jsx(to,{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:b(pe.contact_id)}),S(pe.popby_item_id)&&r.jsx(Pt,{variant:"secondary",className:"text-xs",children:S(pe.popby_item_id)})]}),r.jsx("div",{className:"text-sm text-muted-foreground",children:on(new Date(pe.completed_at),"MMM d, yyyy h:mm a")}),pe.notes&&r.jsx("p",{className:"text-sm text-muted-foreground mt-1 line-clamp-2",children:pe.notes})]})]},pe.id))})]})}),r.jsx(Mn,{value:"library",className:"space-y-4 mt-4",children:r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[n==null?void 0:n.map(pe=>r.jsx(Ze,{children:r.jsx(et,{className:"p-4",children:r.jsxs("div",{className:"flex items-start gap-3",children:[r.jsx("div",{className:"p-2 bg-primary/10 rounded-lg",children:r.jsx(to,{className:"h-5 w-5 text-primary"})}),r.jsxs("div",{className:"flex-1",children:[r.jsx("h3",{className:"font-medium",children:pe.name}),pe.description&&r.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:pe.description}),!pe.owner_user_id&&r.jsx(Pt,{variant:"secondary",className:"mt-2 text-xs",children:"Shared"})]})]})})},pe.id)),r.jsx(Ze,{className:"border-dashed cursor-pointer hover:bg-muted/50 transition-colors",onClick:()=>U(!0),children:r.jsx(et,{className:"p-4 flex items-center justify-center h-full min-h-[100px]",children:r.jsxs("div",{className:"text-center text-muted-foreground",children:[r.jsx(bn,{className:"h-8 w-8 mx-auto mb-2"}),r.jsx("p",{children:"Add New Popby Idea"})]})})})]})}),r.jsxs(Mn,{value:"templates",className:"space-y-4 mt-4",children:[r.jsxs("div",{className:"text-sm text-muted-foreground",children:[y.length," template",y.length!==1?"s":""," found"]}),_&&r.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6",children:[...Array(4)].map((pe,se)=>r.jsx(Ze,{children:r.jsxs(et,{className:"p-4",children:[r.jsx(Lr,{className:"aspect-[3/2] w-full rounded-lg mb-4"}),r.jsx(Lr,{className:"h-5 w-3/4 mb-2"}),r.jsx(Lr,{className:"h-4 w-full mb-4"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(Lr,{className:"h-5 w-16"}),r.jsx(Lr,{className:"h-5 w-20"})]})]})},se))}),!_&&y.length===0&&r.jsx(Ze,{children:r.jsxs(et,{className:"p-8 text-center text-muted-foreground",children:[r.jsx(ql,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),r.jsx("p",{children:"No popby templates available yet!"}),r.jsx("p",{className:"text-sm mt-1",children:"Check back soon for new templates."})]})}),!_&&y.length>0&&r.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6",children:y.map(pe=>r.jsxs(Ze,{className:"group overflow-hidden hover:shadow-lg transition-all duration-200 cursor-pointer",onClick:()=>e(`/templates/${pe.id}`),children:[r.jsx("div",{className:"relative overflow-hidden bg-muted aspect-[3/2]",children:pe.preview_image_url?r.jsx("img",{src:pe.preview_image_url,alt:pe.name,className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-300"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center text-muted-foreground",children:"No Preview"})}),r.jsxs(et,{className:"p-4 flex flex-col",children:[r.jsx("h3",{className:"font-semibold text-foreground line-clamp-1 mb-1",children:pe.name}),pe.description&&r.jsx("p",{className:"text-sm text-muted-foreground line-clamp-2 mb-3 flex-1",children:xse(pe.description)}),r.jsx("div",{className:"flex flex-wrap gap-2 mb-3",children:r.jsx(Pt,{variant:"secondary",className:"text-xs",children:"PopBys"})}),r.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground mb-3",children:[r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(zd,{className:"h-3.5 w-3.5"}),pe.likesCount]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Ul,{className:"h-3.5 w-3.5"}),pe.commentsCount]})]}),r.jsxs(ee,{size:"sm",className:"w-full gap-2",onClick:se=>{se.stopPropagation(),e(`/templates/${pe.id}`)},children:[r.jsx(As,{className:"h-4 w-4"}),"View Template"]})]})]},pe.id))})]})]}),r.jsx(Or,{open:P,onOpenChange:T,children:r.jsxs(Ir,{children:[r.jsx($r,{children:r.jsxs(Fr,{children:["Log Popby for ",k==null?void 0:k.first_name," ",k==null?void 0:k.last_name]})}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{children:"Popby Item (optional)"}),r.jsxs(mn,{value:V.popby_item_id,onValueChange:pe=>W(se=>({...se,popby_item_id:pe})),children:[r.jsx(fn,{children:r.jsx(yn,{placeholder:"Select a popby item..."})}),r.jsx(pn,{children:n==null?void 0:n.map(pe=>r.jsx(qt,{value:pe.id,children:pe.name},pe.id))})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{children:"Notes (optional)"}),r.jsx(Jn,{placeholder:"Any notes about this popby...",value:V.notes,onChange:pe=>W(se=>({...se,notes:pe.target.value}))})]})]}),r.jsxs(Bs,{children:[r.jsx(ee,{variant:"outline",onClick:()=>T(!1),children:"Cancel"}),r.jsx(ee,{onClick:ne,disabled:u.isPending,children:"Log Popby"})]})]})}),r.jsx(Or,{open:I,onOpenChange:z,children:r.jsxs(Ir,{className:"max-w-md",children:[r.jsx($r,{children:r.jsx(Fr,{children:"Popby Frequency Settings"})}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Set default popby frequency for each relationship type. You can override these per-contact."}),s==null?void 0:s.map(pe=>r.jsxs("div",{className:"flex items-center justify-between gap-4",children:[r.jsx($e,{className:"font-medium",children:pe.name}),r.jsxs(mn,{value:ie(pe.id),onValueChange:se=>ge(pe.id,se),children:[r.jsx(fn,{className:"w-[180px]",children:r.jsx(yn,{})}),r.jsx(pn,{children:H3t.map(se=>r.jsx(qt,{value:se.value,children:se.label},se.value))})]})]},pe.id))]}),r.jsx(Bs,{children:r.jsx(ee,{onClick:()=>z(!1),children:"Done"})})]})}),r.jsx(Or,{open:D,onOpenChange:U,children:r.jsxs(Ir,{children:[r.jsx($r,{children:r.jsx(Fr,{children:"Add Popby Idea"})}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{children:"Name *"}),r.jsx(dt,{placeholder:"e.g., Homemade cookies",value:G.name,onChange:pe=>J(se=>({...se,name:pe.target.value}))})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{children:"Description"}),r.jsx(Jn,{placeholder:"Optional description...",value:G.description,onChange:pe=>J(se=>({...se,description:pe.target.value}))})]})]}),r.jsxs(Bs,{children:[r.jsx(ee,{variant:"outline",onClick:()=>U(!1),children:"Cancel"}),r.jsx(ee,{onClick:oe,disabled:!G.name.trim()||p.isPending,children:"Add Item"})]})]})})]})})}function G3t(){const e=Gn(),{isAdmin:t}=tn(),n=E.useRef(null),s=E.useRef(null),a=E.useRef([]),o=hBe(),{data:l}=dBe(),i=pBe(),[u,p]=E.useState(""),[x,y]=E.useState(""),[_,b]=E.useState(!0),[S,k]=E.useState(null),[M,P]=E.useState(null),[T,I]=E.useState(!1),[z,D]=E.useState({popby_item_id:"",notes:""}),U=o.filter(J=>J.address||J.city&&J.state);E.useEffect(()=>{(async()=>{b(!0);try{const{data:ne}=await Q.from("settings").select("value").eq("key","mapbox_public_token").maybeSingle();ne!=null&&ne.value&&p(ne.value)}catch(ne){console.error("Error fetching mapbox token:",ne)}b(!1)})()},[]),E.useEffect(()=>{"geolocation"in navigator&&navigator.geolocation.getCurrentPosition(J=>{k([J.coords.longitude,J.coords.latitude])},J=>{console.log("Could not get location:",J)})},[]),E.useEffect(()=>{if(!(!n.current||!u||s.current))return rc.accessToken=u,s.current=new rc.Map({container:n.current,style:"mapbox://styles/mapbox/streets-v12",zoom:S?12:4,center:S||[-98.5795,39.8283]}),s.current.addControl(new rc.NavigationControl,"top-right"),()=>{var J;(J=s.current)==null||J.remove(),s.current=null}},[u,S]),E.useEffect(()=>{!s.current||!u||(a.current.forEach(J=>J.remove()),a.current=[],U.forEach(async J=>{var oe;const ne=[J.address,J.city,J.state,J.zip].filter(Boolean).join(", ");if(ne)try{const ie=await(await fetch(`https://api.mapbox.com/geocoding/v5/mapbox.places/${encodeURIComponent(ne)}.json?access_token=${u}`)).json();if(ie.features&&ie.features.length>0){const[pe,se]=ie.features[0].center,fe=document.createElement("div");fe.className="cursor-pointer",fe.innerHTML=`
${J.first_name[0]}${((oe=J.last_name)==null?void 0:oe[0])||""}
${J.isDue?'
':""}
`;const he=new rc.Marker(fe).setLngLat([pe,se]).addTo(s.current);fe.addEventListener("click",()=>{P(J)}),a.current.push(he)}}catch(ge){console.error("Geocoding error for",J.first_name,ge)}}))},[U,u]);const V=()=>{S&&s.current?s.current.flyTo({center:S,zoom:13}):ka({title:"Location not available",description:"Please enable location services",variant:"destructive"})},W=async()=>{M&&(await i.mutateAsync({contact_id:M.id,popby_item_id:z.popby_item_id||void 0,notes:z.notes||void 0,latitude:S==null?void 0:S[1],longitude:S==null?void 0:S[0]}),I(!1),P(null),D({popby_item_id:"",notes:""}))},G=async()=>{if(x.trim())try{await Q.from("settings").upsert({key:"mapbox_public_token",value:x.trim()}),p(x.trim()),ka({title:"Mapbox token saved!"})}catch{ka({title:"Error saving token",variant:"destructive"})}};return _?r.jsx(Dr,{title:"Popby Map",children:r.jsx("div",{className:"flex items-center justify-center h-[60vh]",children:r.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary"})})}):u?r.jsx(Dr,{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:()=>e("/mission-control/popbys"),children:[r.jsx(po,{className:"h-4 w-4 mr-2"}),"Back to Popbys"]}),r.jsxs(ee,{onClick:V,children:[r.jsx(oA,{className:"h-4 w-4 mr-2"}),"My Location"]})]}),r.jsxs("div",{className:"flex gap-4 text-sm",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:"w-4 h-4 rounded-full bg-primary"}),r.jsx("span",{children:"Up to date"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:"w-4 h-4 rounded-full bg-amber-500"}),r.jsx("span",{children:"Due for popby"})]})]}),r.jsxs("div",{className:"relative",children:[r.jsx("div",{ref:n,className:"w-full h-[60vh] rounded-lg shadow-lg"}),U.length===0&&r.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-background/80 rounded-lg",children:r.jsxs("div",{className:"text-center p-6",children:[r.jsx(yl,{className:"h-12 w-12 mx-auto text-muted-foreground mb-2"}),r.jsx("p",{className:"font-medium",children:"No contacts with addresses"}),r.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Add addresses to your contacts to see them on the map."})]})})]}),M&&r.jsx(Ze,{className:"fixed bottom-4 left-4 right-4 md:left-auto md:right-4 md:w-96 z-50 shadow-xl",children:r.jsxs(et,{className:"p-4",children:[r.jsxs("div",{className:"flex items-start justify-between mb-3",children:[r.jsxs("div",{children:[r.jsxs("h3",{className:"font-semibold",children:[M.first_name," ",M.last_name]}),M.address&&r.jsxs("p",{className:"text-sm text-muted-foreground",children:[M.city,", ",M.state]})]}),r.jsx(ee,{size:"sm",variant:"ghost",onClick:()=>P(null),children:"×"})]}),r.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[M.isDue?r.jsxs(Pt,{variant:"destructive",children:[M.daysOverdue,"+ days overdue"]}):r.jsx(Pt,{variant:"secondary",children:"Up to date"}),M.lastPopby&&r.jsxs("span",{className:"text-xs text-muted-foreground",children:["Last: ",on(new Date(M.lastPopby),"MMM d")]})]}),r.jsxs("div",{className:"flex gap-2",children:[M.phone&&r.jsx(ee,{size:"sm",variant:"outline",asChild:!0,className:"flex-1",children:r.jsxs("a",{href:`tel:${M.phone}`,children:[r.jsx(Ti,{className:"h-4 w-4 mr-1"}),"Call"]})}),M.address&&r.jsxs(ee,{size:"sm",variant:"outline",className:"flex-1",onClick:()=>{const J=[M.address,M.city,M.state,M.zip].filter(Boolean).join(", ");window.open(`https://maps.google.com/maps?daddr=${encodeURIComponent(J)}`,"_blank")},children:[r.jsx(fA,{className:"h-4 w-4 mr-1"}),"Navigate"]}),r.jsxs(ee,{size:"sm",className:"flex-1",onClick:()=>I(!0),children:[r.jsx(to,{className:"h-4 w-4 mr-1"}),"Log Popby"]})]})]})}),r.jsx(Or,{open:T,onOpenChange:I,children:r.jsxs(Ir,{children:[r.jsx($r,{children:r.jsxs(Fr,{children:["Log Popby for ",M==null?void 0:M.first_name," ",M==null?void 0:M.last_name]})}),r.jsxs("div",{className:"space-y-4 py-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{children:"Popby Item (optional)"}),r.jsxs(mn,{value:z.popby_item_id,onValueChange:J=>D(ne=>({...ne,popby_item_id:J})),children:[r.jsx(fn,{children:r.jsx(yn,{placeholder:"Select a popby item..."})}),r.jsx(pn,{children:l==null?void 0:l.map(J=>r.jsx(qt,{value:J.id,children:J.name},J.id))})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{children:"Notes (optional)"}),r.jsx(Jn,{placeholder:"Any notes about this popby...",value:z.notes,onChange:J=>D(ne=>({...ne,notes:J.target.value}))})]}),S&&r.jsxs("p",{className:"text-xs text-muted-foreground flex items-center gap-1",children:[r.jsx(Po,{className:"h-3 w-3"}),"Your current location will be recorded"]})]}),r.jsxs(Bs,{children:[r.jsx(ee,{variant:"outline",onClick:()=>I(!1),children:"Cancel"}),r.jsxs(ee,{onClick:W,disabled:i.isPending,children:[r.jsx(di,{className:"h-4 w-4 mr-1"}),"Log Popby"]})]})]})})]})}):t?r.jsx(Dr,{title:"Popby Map",children:r.jsx("div",{className:"max-w-md mx-auto mt-8",children:r.jsx(Ze,{children:r.jsxs(et,{className:"p-6 space-y-4",children:[r.jsxs("div",{className:"text-center mb-4",children:[r.jsx(Po,{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($e,{children:"Mapbox Public Token"}),r.jsx(dt,{placeholder:"pk.eyJ1I...",value:x,onChange:J=>y(J.target.value)}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Get your token at"," ",r.jsx("a",{href:"https://mapbox.com/",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"mapbox.com"})]})]}),r.jsx(ee,{onClick:G,className:"w-full",children:"Save Token"}),r.jsxs(ee,{variant:"outline",className:"w-full",onClick:()=>e("/mission-control/popbys"),children:[r.jsx(po,{className:"h-4 w-4 mr-2"}),"Back to Popbys"]})]})})})}):r.jsx(Dr,{title:"Popby Map",children:r.jsx("div",{className:"max-w-md mx-auto mt-8",children:r.jsx(Ze,{children:r.jsxs(et,{className:"p-6 space-y-4",children:[r.jsxs("div",{className:"text-center",children:[r.jsx(yl,{className:"h-12 w-12 mx-auto text-muted-foreground mb-2"}),r.jsx("h2",{className:"text-lg font-semibold",children:"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:()=>e("/mission-control/popbys"),children:[r.jsx(po,{className:"h-4 w-4 mr-2"}),"Back to Popbys"]})]})})})})}const K3t=E3({property_address:xc().min(1,"Property address is required"),city:xc().optional(),state:xc().optional(),zip:xc().optional(),transaction_type:E8e(["buyer","seller"]),close_date:xc().min(1,"Close date is required"),sale_price:LA().min(0,"Sale price must be positive"),commission_amount:LA().optional(),lead_source_id:xc().optional(),client_type_id:xc().optional(),contact_id:xc().optional(),notes:xc().optional(),is_win:zdt()});function xBe({open:e,onOpenChange:t,transaction:n}){const[s,a]=E.useState(!1),[o,l]=E.useState(""),[i,u]=E.useState(!1),[p,x]=E.useState(""),y=uae(),_=Wgt(),{data:b}=dae(),{data:S}=qm(),{data:k}=jp(),M=Pye(),P=Hgt(),{data:T}=hae(),I=(T==null?void 0:T.show_commission)??!0,z=Qse({resolver:Jse(K3t),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}});E.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 D=async G=>{const J={property_address:G.property_address,transaction_type:G.transaction_type,close_date:G.close_date,sale_price:G.sale_price,is_win:G.is_win,commission_amount:G.commission_amount||null,lead_source_id:G.lead_source_id||null,client_type_id:G.client_type_id||null,contact_id:G.contact_id||null,city:G.city||null,state:G.state||null,zip:G.zip||null,notes:G.notes||null};n?await _.mutateAsync({id:n.id,...J}):await y.mutateAsync(J),t(!1)},U=async()=>{if(!o.trim())return;const[G,...J]=o.trim().split(" "),ne=J.join(" ")||null,oe=await M.mutateAsync({first_name:G,last_name:ne,tagIds:[]});oe&&(z.setValue("contact_id",oe.id),l(""),u(!1),a(!1))},V=async()=>{if(!p.trim())return;const G=await P.mutateAsync(p.trim());G&&(z.setValue("lead_source_id",G.id),x(""))},W=k==null?void 0:k.find(G=>G.id===z.watch("contact_id"));return r.jsx(Or,{open:e,onOpenChange:t,children:r.jsxs(Ir,{className:"max-w-lg max-h-[90vh]",children:[r.jsx($r,{children:r.jsx(Fr,{children:n?"Edit Transaction":"Add Transaction"})}),r.jsx(Bo,{className:"max-h-[70vh] pr-4",children:r.jsx(eae,{...z,children:r.jsxs("form",{onSubmit:z.handleSubmit(D),className:"space-y-4",children:[r.jsx(Ll,{control:z.control,name:"property_address",render:({field:G})=>r.jsxs(Nl,{children:[r.jsx(Sl,{children:"Property Address *"}),r.jsx(Cl,{children:r.jsx(dt,{placeholder:"123 Main St",...G})}),r.jsx(Wu,{})]})}),r.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[r.jsx(Ll,{control:z.control,name:"city",render:({field:G})=>r.jsxs(Nl,{children:[r.jsx(Sl,{children:"City"}),r.jsx(Cl,{children:r.jsx(dt,{placeholder:"City",...G})})]})}),r.jsx(Ll,{control:z.control,name:"state",render:({field:G})=>r.jsxs(Nl,{children:[r.jsx(Sl,{children:"State"}),r.jsx(Cl,{children:r.jsx(dt,{placeholder:"TX",...G})})]})}),r.jsx(Ll,{control:z.control,name:"zip",render:({field:G})=>r.jsxs(Nl,{children:[r.jsx(Sl,{children:"Zip"}),r.jsx(Cl,{children:r.jsx(dt,{placeholder:"75001",...G})})]})})]}),r.jsx(Ll,{control:z.control,name:"transaction_type",render:({field:G})=>r.jsxs(Nl,{children:[r.jsx(Sl,{children:"Transaction Type *"}),r.jsxs(mn,{onValueChange:G.onChange,value:G.value,children:[r.jsx(Cl,{children:r.jsx(fn,{children:r.jsx(yn,{placeholder:"Select type"})})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"buyer",children:"Buyer"}),r.jsx(qt,{value:"seller",children:"Seller"})]})]}),r.jsx(Wu,{})]})}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsx(Ll,{control:z.control,name:"close_date",render:({field:G})=>r.jsxs(Nl,{children:[r.jsx(Sl,{children:"Close Date *"}),r.jsx(Cl,{children:r.jsx(dt,{type:"date",...G})}),r.jsx(Wu,{})]})}),r.jsx(Ll,{control:z.control,name:"sale_price",render:({field:G})=>r.jsxs(Nl,{children:[r.jsx(Sl,{children:"Sale Price *"}),r.jsx(Cl,{children:r.jsx(dt,{type:"number",placeholder:"0",...G,onChange:J=>G.onChange(Number(J.target.value))})}),r.jsx(Wu,{})]})})]}),I&&r.jsx(Ll,{control:z.control,name:"commission_amount",render:({field:G})=>r.jsxs(Nl,{children:[r.jsx(Sl,{children:"Commission"}),r.jsx(Cl,{children:r.jsx(dt,{type:"number",placeholder:"0",...G,value:G.value??"",onChange:J=>G.onChange(J.target.value?Number(J.target.value):void 0)})})]})}),r.jsx(Ll,{control:z.control,name:"lead_source_id",render:({field:G})=>r.jsxs(Nl,{children:[r.jsx(Sl,{children:"Lead Source"}),r.jsxs(mn,{onValueChange:G.onChange,value:G.value||"",children:[r.jsx(Cl,{children:r.jsx(fn,{children:r.jsx(yn,{placeholder:"Select source"})})}),r.jsx(pn,{children:b==null?void 0:b.map(J=>r.jsx(qt,{value:J.id,children:J.name},J.id))})]})]})}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(dt,{placeholder:"Add custom source...",value:p,onChange:G=>x(G.target.value),className:"flex-1"}),r.jsx(ee,{type:"button",variant:"outline",size:"icon",onClick:V,disabled:!p.trim(),children:r.jsx(bn,{className:"h-4 w-4"})})]}),r.jsx(Ll,{control:z.control,name:"client_type_id",render:({field:G})=>r.jsxs(Nl,{children:[r.jsx(Sl,{children:"Client Type"}),r.jsxs(mn,{onValueChange:G.onChange,value:G.value||"",children:[r.jsx(Cl,{children:r.jsx(fn,{children:r.jsx(yn,{placeholder:"Select client type"})})}),r.jsx(pn,{children:S==null?void 0:S.map(J=>r.jsx(qt,{value:J.id,children:J.name},J.id))})]})]})}),r.jsx(Ll,{control:z.control,name:"contact_id",render:({field:G})=>r.jsxs(Nl,{children:[r.jsx(Sl,{children:"Client Contact"}),r.jsxs(Vc,{open:s,onOpenChange:a,children:[r.jsx(Hc,{asChild:!0,children:r.jsx(Cl,{children:r.jsxs(ee,{variant:"outline",role:"combobox",className:Bt("w-full justify-between",!G.value&&"text-muted-foreground"),children:[W?`${W.first_name} ${W.last_name||""}`.trim():"Select contact",r.jsx(oy,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})})}),r.jsxs(Mc,{className:"w-full p-0",align:"start",children:[r.jsxs(Ey,{children:[r.jsx(Iy,{placeholder:"Search contacts..."}),r.jsxs(Py,{children:[r.jsx(Ly,{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:()=>u(!0),children:[r.jsx(bn,{className:"h-4 w-4 mr-2"}),"Add New Contact"]})]})}),r.jsx(Oy,{children:k==null?void 0:k.map(J=>r.jsxs(Dy,{value:`${J.first_name} ${J.last_name||""}`,onSelect:()=>{G.onChange(J.id),a(!1)},children:[r.jsx(Ni,{className:Bt("mr-2 h-4 w-4",J.id===G.value?"opacity-100":"opacity-0")}),J.first_name," ",J.last_name||""]},J.id))})]})]}),i&&r.jsxs("div",{className:"p-2 border-t space-y-2",children:[r.jsx(dt,{placeholder:"Enter contact name...",value:o,onChange:J=>l(J.target.value)}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(ee,{size:"sm",onClick:U,disabled:!o.trim()||M.isPending,children:"Add Contact"}),r.jsx(ee,{size:"sm",variant:"outline",onClick:()=>{u(!1),l("")},children:"Cancel"})]})]})]})]})]})}),r.jsx(Ll,{control:z.control,name:"notes",render:({field:G})=>r.jsxs(Nl,{children:[r.jsx(Sl,{children:"Notes"}),r.jsx(Cl,{children:r.jsx(Jn,{placeholder:"Any notes about this transaction...",...G})})]})}),r.jsx(Ll,{control:z.control,name:"is_win",render:({field:G})=>r.jsxs(Nl,{className:"flex items-center justify-between rounded-lg border p-3",children:[r.jsxs("div",{className:"space-y-0.5",children:[r.jsx(Sl,{children:"Mark as Win 🏆"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Highlight this as a notable success"})]}),r.jsx(Cl,{children:r.jsx(Ts,{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:()=>t(!1),children:"Cancel"}),r.jsxs(ee,{type:"submit",disabled:y.isPending||_.isPending,children:[n?"Update":"Add"," Transaction"]})]})]})})})]})})}function yBe({transactions:e,showCommission:t,isLoading:n}){const[s,a]=E.useState(null),[o,l]=E.useState(null),[i,u]=E.useState(""),[p,x]=E.useState("all"),[y,_]=E.useState("all"),[b,S]=E.useState("all"),[k,M]=E.useState(!1),P=Ggt(),T=uae(),{data:I}=dae(),{data:z}=qm(),D=z3(),U=G=>{const{id:J,created_at:ne,updated_at:oe,lead_source:ge,client_type:ie,contact:pe,...se}=G;T.mutate(se)},V=()=>{o&&(P.mutate(o),l(null))},W=e.filter(G=>{var pe,se,fe,he;const J=i===""||G.property_address.toLowerCase().includes(i.toLowerCase())||((se=(pe=G.contact)==null?void 0:pe.first_name)==null?void 0:se.toLowerCase().includes(i.toLowerCase()))||((he=(fe=G.contact)==null?void 0:fe.last_name)==null?void 0:he.toLowerCase().includes(i.toLowerCase())),ne=p==="all"||G.transaction_type===p,oe=y==="all"||G.lead_source_id===y,ge=b==="all"||G.client_type_id===b,ie=!k||G.is_win;return J&&ne&&oe&&ge&&ie});return n?r.jsx(Ze,{children:r.jsx(et,{className:"p-6 space-y-4",children:[1,2,3].map(G=>r.jsx(Lr,{className:"h-16 w-full"},G))})}):r.jsxs(r.Fragment,{children:[r.jsxs(Ze,{children:[r.jsx(Wt,{className:"pb-3",children:r.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-4",children:[r.jsxs(Yt,{children:["Transactions (",W.length,")"]}),r.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[r.jsxs("div",{className:"relative",children:[r.jsx(Sa,{className:"absolute left-2.5 top-2.5 h-4 w-4 text-muted-foreground"}),r.jsx(dt,{placeholder:"Search...",value:i,onChange:G=>u(G.target.value),className:"pl-8 w-[150px]"})]}),r.jsxs(mn,{value:p,onValueChange:x,children:[r.jsx(fn,{className:"w-[100px]",children:r.jsx(yn,{placeholder:"Type"})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"all",children:"All Types"}),r.jsx(qt,{value:"buyer",children:"Buyer"}),r.jsx(qt,{value:"seller",children:"Seller"})]})]}),r.jsxs(mn,{value:y,onValueChange:_,children:[r.jsx(fn,{className:"w-[130px]",children:r.jsx(yn,{placeholder:"Lead Source"})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"all",children:"All Sources"}),I==null?void 0:I.map(G=>r.jsx(qt,{value:G.id,children:G.name},G.id))]})]}),r.jsxs(ee,{variant:k?"default":"outline",size:"sm",onClick:()=>M(!k),children:[r.jsx(zl,{className:"h-4 w-4 mr-1"}),"Wins"]})]})]})}),r.jsx(et,{children:W.length===0?r.jsx("p",{className:"text-center text-muted-foreground py-8",children:"No transactions found"}):D?r.jsx("div",{className:"space-y-3",children:W.map(G=>r.jsxs(Ze,{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(zl,{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(Pt,{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: "}),jje(G.close_date)]}),r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground",children:"Price: "}),tu(G.sale_price)]}),t&&G.commission_amount&&r.jsxs("div",{children:[r.jsx("span",{className:"text-muted-foreground",children:"Commission: "}),tu(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(gc,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>U(G),children:r.jsx(Wo,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>l(G.id),children:r.jsx(Bn,{className:"h-4 w-4 text-destructive"})})]})]},G.id))}):r.jsx("div",{className:"overflow-x-auto",children:r.jsxs(Ks,{children:[r.jsx(Zs,{children:r.jsxs(Mr,{children:[r.jsx(It,{children:"Property"}),r.jsx(It,{children:"Type"}),r.jsx(It,{children:"Close Date"}),r.jsx(It,{children:"Sale Price"}),t&&r.jsx(It,{children:"Commission"}),r.jsx(It,{children:"Lead Source"}),r.jsx(It,{children:"Client"}),r.jsx(It,{className:"w-[50px]"})]})}),r.jsx(Ys,{children:W.map(G=>{var J;return r.jsxs(Mr,{children:[r.jsx(kt,{children:r.jsxs("div",{className:"flex items-center gap-2",children:[G.is_win&&r.jsx(zl,{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(kt,{children:r.jsx(Pt,{variant:G.transaction_type==="buyer"?"default":"secondary",children:G.transaction_type})}),r.jsx(kt,{children:jje(G.close_date)}),r.jsx(kt,{children:tu(G.sale_price)}),t&&r.jsx(kt,{children:G.commission_amount?tu(G.commission_amount):"-"}),r.jsx(kt,{children:((J=G.lead_source)==null?void 0:J.name)||"-"}),r.jsx(kt,{children:G.contact?`${G.contact.first_name} ${G.contact.last_name||""}`.trim():"-"}),r.jsx(kt,{children:r.jsxs(Lh,{children:[r.jsx(Oh,{asChild:!0,children:r.jsx(ee,{variant:"ghost",size:"icon",children:r.jsx(Wx,{className:"h-4 w-4"})})}),r.jsxs(ah,{align:"end",children:[r.jsxs(ei,{onClick:()=>a(G),children:[r.jsx(gc,{className:"h-4 w-4 mr-2"}),"Edit"]}),r.jsxs(ei,{onClick:()=>U(G),children:[r.jsx(Wo,{className:"h-4 w-4 mr-2"}),"Duplicate"]}),r.jsxs(ei,{onClick:()=>l(G.id),className:"text-destructive",children:[r.jsx(Bn,{className:"h-4 w-4 mr-2"}),"Delete"]})]})]})})]},G.id)})})]})})})]}),r.jsx(xBe,{open:!!s,onOpenChange:G=>!G&&a(null),transaction:s||void 0}),r.jsx(Id,{open:!!o,onOpenChange:G=>!G&&l(null),children:r.jsxs(id,{children:[r.jsxs(od,{children:[r.jsx(cd,{children:"Delete Transaction?"}),r.jsx(dd,{children:"This action cannot be undone. This will permanently delete this transaction."})]}),r.jsxs(ld,{children:[r.jsx(ud,{children:"Cancel"}),r.jsx(Bc,{onClick:V,className:"bg-destructive text-destructive-foreground",children:"Delete"})]})]})})]})}function vBe({goals:e,stats:t,year:n,showCommission:s}){const a=new Date().getMonth()+1,o=new Date().getFullYear()===n?a:12,l=12-o,i=(_,b)=>{if(!b||b===0)return null;const S=Math.min(_/b*100,100),k=Math.max(b-_,0),M=l>0?k/l:0,P=o/12*100,T=S>=P?"ahead":S>=P*.8?"on-track":"behind";return{percent:S,remaining:k,pace:M,status:T}},u=i(t.totalTransactions,e.transactions_goal),p=i(t.totalVolume,e.volume_goal),x=s?i(t.totalCommission,e.gci_goal):null,y=_=>{switch(_){case"ahead":return r.jsxs(Pt,{className:"bg-green-500 text-white",children:[r.jsx(fp,{className:"h-3 w-3 mr-1"}),"Ahead"]});case"on-track":return r.jsxs(Pt,{variant:"secondary",children:[r.jsx(G1,{className:"h-3 w-3 mr-1"}),"On Track"]});case"behind":return r.jsxs(Pt,{variant:"destructive",children:[r.jsx($j,{className:"h-3 w-3 mr-1"}),"Behind"]});default:return null}};return!e.transactions_goal&&!e.volume_goal&&!e.gci_goal?null:r.jsxs(Ze,{children:[r.jsx(Wt,{className:"pb-3",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(my,{className:"h-5 w-5 text-primary"}),r.jsxs(Yt,{children:[n," Goals Progress"]})]})}),r.jsx(et,{children:r.jsxs("div",{className:"grid md:grid-cols-3 gap-6",children:[e.transactions_goal&&u&&r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("span",{className:"text-sm font-medium",children:"Transactions"}),y(u.status)]}),r.jsx(pd,{value:u.percent,className:"h-2"}),r.jsxs("div",{className:"flex justify-between text-sm text-muted-foreground",children:[r.jsxs("span",{children:[t.totalTransactions," of ",e.transactions_goal]}),r.jsxs("span",{children:[Math.round(u.percent),"%"]})]}),u.remaining>0&&l>0&&r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Need ",Math.ceil(u.pace),"/month to hit goal"]})]}),e.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(pd,{value:p.percent,className:"h-2"}),r.jsxs("div",{className:"flex justify-between text-sm text-muted-foreground",children:[r.jsxs("span",{children:[tu(t.totalVolume,!0)," of ",tu(e.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 ",tu(p.pace,!0),"/month"]})]}),s&&e.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(pd,{value:x.percent,className:"h-2"}),r.jsxs("div",{className:"flex justify-between text-sm text-muted-foreground",children:[r.jsxs("span",{children:[tu(t.totalCommission,!0)," of ",tu(e.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 ",tu(x.pace,!0),"/month"]})]})]})})]})}var Z3t=Array.isArray,Fh=Z3t,Y3t=typeof Yx=="object"&&Yx&&Yx.Object===Object&&Yx,_Be=Y3t,X3t=_Be,Q3t=typeof self=="object"&&self&&self.Object===Object&&self,J3t=X3t||Q3t||Function("return this")(),ix=J3t,e5t=ix,t5t=e5t.Symbol,bP=t5t,bCe=bP,bBe=Object.prototype,r5t=bBe.hasOwnProperty,n5t=bBe.toString,mT=bCe?bCe.toStringTag:void 0;function s5t(e){var t=r5t.call(e,mT),n=e[mT];try{e[mT]=void 0;var s=!0}catch{}var a=n5t.call(e);return s&&(t?e[mT]=n:delete e[mT]),a}var a5t=s5t,i5t=Object.prototype,o5t=i5t.toString;function l5t(e){return o5t.call(e)}var c5t=l5t,wCe=bP,d5t=a5t,u5t=c5t,h5t="[object Null]",f5t="[object Undefined]",jCe=wCe?wCe.toStringTag:void 0;function p5t(e){return e==null?e===void 0?f5t:h5t:jCe&&jCe in Object(e)?d5t(e):u5t(e)}var qy=p5t;function m5t(e){return e!=null&&typeof e=="object"}var Vy=m5t,g5t=qy,x5t=Vy,y5t="[object Symbol]";function v5t(e){return typeof e=="symbol"||x5t(e)&&g5t(e)==y5t}var B3=v5t,_5t=Fh,b5t=B3,w5t=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,j5t=/^\w*$/;function k5t(e,t){if(_5t(e))return!1;var n=typeof e;return n=="number"||n=="symbol"||n=="boolean"||e==null||b5t(e)?!0:j5t.test(e)||!w5t.test(e)||t!=null&&e in Object(t)}var Q0e=k5t;function N5t(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var Ev=N5t;const $3=Qi(Ev);var S5t=qy,C5t=Ev,M5t="[object AsyncFunction]",T5t="[object Function]",A5t="[object GeneratorFunction]",E5t="[object Proxy]";function I5t(e){if(!C5t(e))return!1;var t=S5t(e);return t==T5t||t==A5t||t==M5t||t==E5t}var J0e=I5t;const Ka=Qi(J0e);var P5t=ix,L5t=P5t["__core-js_shared__"],O5t=L5t,Bde=O5t,kCe=function(){var e=/[^.]+$/.exec(Bde&&Bde.keys&&Bde.keys.IE_PROTO||"");return e?"Symbol(src)_1."+e:""}();function D5t(e){return!!kCe&&kCe in e}var R5t=D5t,F5t=Function.prototype,z5t=F5t.toString;function B5t(e){if(e!=null){try{return z5t.call(e)}catch{}try{return e+""}catch{}}return""}var wBe=B5t,$5t=J0e,U5t=R5t,q5t=Ev,V5t=wBe,H5t=/[\\^$.*+?()[\]{}|]/g,W5t=/^\[object .+?Constructor\]$/,G5t=Function.prototype,K5t=Object.prototype,Z5t=G5t.toString,Y5t=K5t.hasOwnProperty,X5t=RegExp("^"+Z5t.call(Y5t).replace(H5t,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Q5t(e){if(!q5t(e)||U5t(e))return!1;var t=$5t(e)?X5t:W5t;return t.test(V5t(e))}var J5t=Q5t;function eMt(e,t){return e==null?void 0:e[t]}var tMt=eMt,rMt=J5t,nMt=tMt;function sMt(e,t){var n=nMt(e,t);return rMt(n)?n:void 0}var Ak=sMt,aMt=Ak,iMt=aMt(Object,"create"),qae=iMt,NCe=qae;function oMt(){this.__data__=NCe?NCe(null):{},this.size=0}var lMt=oMt;function cMt(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=t?1:0,t}var dMt=cMt,uMt=qae,hMt="__lodash_hash_undefined__",fMt=Object.prototype,pMt=fMt.hasOwnProperty;function mMt(e){var t=this.__data__;if(uMt){var n=t[e];return n===hMt?void 0:n}return pMt.call(t,e)?t[e]:void 0}var gMt=mMt,xMt=qae,yMt=Object.prototype,vMt=yMt.hasOwnProperty;function _Mt(e){var t=this.__data__;return xMt?t[e]!==void 0:vMt.call(t,e)}var bMt=_Mt,wMt=qae,jMt="__lodash_hash_undefined__";function kMt(e,t){var n=this.__data__;return this.size+=this.has(e)?0:1,n[e]=wMt&&t===void 0?jMt:t,this}var NMt=kMt,SMt=lMt,CMt=dMt,MMt=gMt,TMt=bMt,AMt=NMt;function U3(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t-1}var GMt=WMt,KMt=Vae;function ZMt(e,t){var n=this.__data__,s=KMt(n,e);return s<0?(++this.size,n.push([e,t])):n[s][1]=t,this}var YMt=ZMt,XMt=PMt,QMt=$Mt,JMt=VMt,eTt=GMt,tTt=YMt;function q3(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t0?1:-1},dj=function(t){return gk(t)&&t.indexOf("%")===t.length-1},Dn=function(t){return bAt(t)&&!wP(t)},NAt=function(t){return Mi(t)},hd=function(t){return Dn(t)||gk(t)},SAt=0,jP=function(t){var n=++SAt;return"".concat(t||"").concat(n)},Zu=function(t,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(t)&&!gk(t))return s;var o;if(dj(t)){var l=t.indexOf("%");o=n*parseFloat(t.slice(0,l))/100}else o=+t;return wP(o)&&(o=s),a&&o>n&&(o=n),o},d1=function(t){if(!t)return null;var n=Object.keys(t);return n&&n.length?t[n[0]]:null},CAt=function(t){if(!Array.isArray(t))return!1;for(var n=t.length,s={},a=0;a=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(n[s]=e[s])}return n}function LAt(e,t){if(e==null)return{};var n={};for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){if(t.indexOf(s)>=0)continue;n[s]=e[s]}return n}var ICe={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"},vy=function(t){return typeof t=="string"?t:t?t.displayName||t.name||"Component":""},PCe=null,Ude=null,c1e=function e(t){if(t===PCe&&Array.isArray(Ude))return Ude;var n=[];return E.Children.forEach(t,function(s){Mi(s)||(gAt.isFragment(s)?n=n.concat(e(s.props.children)):n.push(s))}),Ude=n,PCe=t,n};function xp(e,t){var n=[],s=[];return Array.isArray(t)?s=t.map(function(a){return vy(a)}):s=[vy(t)],c1e(e).forEach(function(a){var o=wf(a,"type.displayName")||wf(a,"type.name");s.indexOf(o)!==-1&&n.push(a)}),n}function ef(e,t){var n=xp(e,t);return n&&n[0]}var LCe=function(t){if(!t||!t.props)return!1;var n=t.props,s=n.width,a=n.height;return!(!Dn(s)||s<=0||!Dn(a)||a<=0)},OAt=["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"],DAt=function(t){return t&&t.type&&gk(t.type)&&OAt.indexOf(t.type)>=0},RAt=function(t,n,s,a){var o,l=(o=$de==null?void 0:$de[a])!==null&&o!==void 0?o:[];return n.startsWith("data-")||!Ka(t)&&(a&&l.includes(n)||AAt.includes(n))||s&&l1e.includes(n)},Ba=function(t,n,s){if(!t||typeof t=="function"||typeof t=="boolean")return null;var a=t;if(E.isValidElement(t)&&(a=t.props),!$3(a))return null;var o={};return Object.keys(a).forEach(function(l){var i;RAt((i=a)===null||i===void 0?void 0:i[l],l,n,s)&&(o[l]=a[l])}),o},kpe=function e(t,n){if(t===n)return!0;var s=E.Children.count(t);if(s!==E.Children.count(n))return!1;if(s===0)return!0;if(s===1)return OCe(Array.isArray(t)?t[0]:t,Array.isArray(n)?n[0]:n);for(var a=0;a=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(n[s]=e[s])}return n}function UAt(e,t){if(e==null)return{};var n={};for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){if(t.indexOf(s)>=0)continue;n[s]=e[s]}return n}function Spe(e){var t=e.children,n=e.width,s=e.height,a=e.viewBox,o=e.className,l=e.style,i=e.title,u=e.desc,p=$At(e,BAt),x=a||{width:n,height:s,x:0,y:0},y=ui("recharts-surface",o);return lt.createElement("svg",Npe({},Ba(p,!0,"svg"),{className:y,width:n,height:s,style:l,viewBox:"".concat(x.x," ").concat(x.y," ").concat(x.width," ").concat(x.height)}),lt.createElement("title",null,i),lt.createElement("desc",null,u),t)}var qAt=["children","className"];function Cpe(){return Cpe=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(n[s]=e[s])}return n}function HAt(e,t){if(e==null)return{};var n={};for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){if(t.indexOf(s)>=0)continue;n[s]=e[s]}return n}var Ao=lt.forwardRef(function(e,t){var n=e.children,s=e.className,a=VAt(e,qAt),o=ui("recharts-layer",s);return lt.createElement("g",Cpe({className:o},Ba(a,!0),{ref:t}),n)}),Lm=function(t,n){for(var s=arguments.length,a=new Array(s>2?s-2:0),o=2;oa?0:a+t),n=n>a?a:n,n<0&&(n+=a),a=t>n?0:n-t>>>0,t>>>=0;for(var o=Array(a);++s=s?e:KAt(e,t,n)}var YAt=ZAt,XAt="\\ud800-\\udfff",QAt="\\u0300-\\u036f",JAt="\\ufe20-\\ufe2f",eEt="\\u20d0-\\u20ff",tEt=QAt+JAt+eEt,rEt="\\ufe0e\\ufe0f",nEt="\\u200d",sEt=RegExp("["+nEt+XAt+tEt+rEt+"]");function aEt(e){return sEt.test(e)}var IBe=aEt;function iEt(e){return e.split("")}var oEt=iEt,PBe="\\ud800-\\udfff",lEt="\\u0300-\\u036f",cEt="\\ufe20-\\ufe2f",dEt="\\u20d0-\\u20ff",uEt=lEt+cEt+dEt,hEt="\\ufe0e\\ufe0f",fEt="["+PBe+"]",Mpe="["+uEt+"]",Tpe="\\ud83c[\\udffb-\\udfff]",pEt="(?:"+Mpe+"|"+Tpe+")",LBe="[^"+PBe+"]",OBe="(?:\\ud83c[\\udde6-\\uddff]){2}",DBe="[\\ud800-\\udbff][\\udc00-\\udfff]",mEt="\\u200d",RBe=pEt+"?",FBe="["+hEt+"]?",gEt="(?:"+mEt+"(?:"+[LBe,OBe,DBe].join("|")+")"+FBe+RBe+")*",xEt=FBe+RBe+gEt,yEt="(?:"+[LBe+Mpe+"?",Mpe,OBe,DBe,fEt].join("|")+")",vEt=RegExp(Tpe+"(?="+Tpe+")|"+yEt+xEt,"g");function _Et(e){return e.match(vEt)||[]}var bEt=_Et,wEt=oEt,jEt=IBe,kEt=bEt;function NEt(e){return jEt(e)?kEt(e):wEt(e)}var SEt=NEt,CEt=YAt,MEt=IBe,TEt=SEt,AEt=SBe;function EEt(e){return function(t){t=AEt(t);var n=MEt(t)?TEt(t):void 0,s=n?n[0]:t.charAt(0),a=n?CEt(n,1).join(""):t.slice(1);return s[e]()+a}}var IEt=EEt,PEt=IEt,LEt=PEt("toUpperCase"),OEt=LEt;const sie=Qi(OEt);function al(e){return function(){return e}}const zBe=Math.cos,tne=Math.sin,Hm=Math.sqrt,rne=Math.PI,aie=2*rne,Ape=Math.PI,Epe=2*Ape,Ww=1e-6,DEt=Epe-Ww;function BBe(e){this._+=e[0];for(let t=1,n=e.length;t=0))throw new Error(`invalid digits: ${e}`);if(t>15)return BBe;const n=10**t;return function(s){this._+=s[0];for(let a=1,o=s.length;aWw)if(!(Math.abs(y*u-p*x)>Ww)||!o)this._append`L${this._x1=t},${this._y1=n}`;else{let b=s-l,S=a-i,k=u*u+p*p,M=b*b+S*S,P=Math.sqrt(k),T=Math.sqrt(_),I=o*Math.tan((Ape-Math.acos((k+_-M)/(2*P*T)))/2),z=I/T,D=I/P;Math.abs(z-1)>Ww&&this._append`L${t+z*x},${n+z*y}`,this._append`A${o},${o},0,0,${+(y*b>x*S)},${this._x1=t+D*u},${this._y1=n+D*p}`}}arc(t,n,s,a,o,l){if(t=+t,n=+n,s=+s,l=!!l,s<0)throw new Error(`negative radius: ${s}`);let i=s*Math.cos(a),u=s*Math.sin(a),p=t+i,x=n+u,y=1^l,_=l?a-o:o-a;this._x1===null?this._append`M${p},${x}`:(Math.abs(this._x1-p)>Ww||Math.abs(this._y1-x)>Ww)&&this._append`L${p},${x}`,s&&(_<0&&(_=_%Epe+Epe),_>DEt?this._append`A${s},${s},0,1,${y},${t-i},${n-u}A${s},${s},0,1,${y},${this._x1=p},${this._y1=x}`:_>Ww&&this._append`A${s},${s},0,${+(_>=Ape)},${y},${this._x1=t+s*Math.cos(o)},${this._y1=n+s*Math.sin(o)}`)}rect(t,n,s,a){this._append`M${this._x0=this._x1=+t},${this._y0=this._y1=+n}h${s=+s}v${+a}h${-s}Z`}toString(){return this._}}function d1e(e){let t=3;return e.digits=function(n){if(!arguments.length)return t;if(n==null)t=null;else{const s=Math.floor(n);if(!(s>=0))throw new RangeError(`invalid digits: ${n}`);t=s}return e},()=>new FEt(t)}function u1e(e){return typeof e=="object"&&"length"in e?e:Array.from(e)}function $Be(e){this._context=e}$Be.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(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:this._context.lineTo(e,t);break}}};function iie(e){return new $Be(e)}function UBe(e){return e[0]}function qBe(e){return e[1]}function VBe(e,t){var n=al(!0),s=null,a=iie,o=null,l=d1e(i);e=typeof e=="function"?e:e===void 0?UBe:al(e),t=typeof t=="function"?t:t===void 0?qBe:al(t);function i(u){var p,x=(u=u1e(u)).length,y,_=!1,b;for(s==null&&(o=a(b=l())),p=0;p<=x;++p)!(p=b;--S)i.point(I[S],z[S]);i.lineEnd(),i.areaEnd()}P&&(I[_]=+e(M,_,y),z[_]=+t(M,_,y),i.point(s?+s(M,_,y):I[_],n?+n(M,_,y):z[_]))}if(T)return i=null,T+""||null}function x(){return VBe().defined(a).curve(l).context(o)}return p.x=function(y){return arguments.length?(e=typeof y=="function"?y:al(+y),s=null,p):e},p.x0=function(y){return arguments.length?(e=typeof y=="function"?y:al(+y),p):e},p.x1=function(y){return arguments.length?(s=y==null?null:typeof y=="function"?y:al(+y),p):s},p.y=function(y){return arguments.length?(t=typeof y=="function"?y:al(+y),n=null,p):t},p.y0=function(y){return arguments.length?(t=typeof y=="function"?y:al(+y),p):t},p.y1=function(y){return arguments.length?(n=y==null?null:typeof y=="function"?y:al(+y),p):n},p.lineX0=p.lineY0=function(){return x().x(e).y(t)},p.lineY1=function(){return x().x(e).y(n)},p.lineX1=function(){return x().x(s).y(t)},p.defined=function(y){return arguments.length?(a=typeof y=="function"?y:al(!!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 HBe{constructor(t,n){this._context=t,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(t,n){switch(t=+t,n=+n,this._point){case 0:{this._point=1,this._line?this._context.lineTo(t,n):this._context.moveTo(t,n);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+t)/2,this._y0,this._x0,n,t,n):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+n)/2,t,this._y0,t,n);break}}this._x0=t,this._y0=n}}function zEt(e){return new HBe(e,!0)}function BEt(e){return new HBe(e,!1)}const h1e={draw(e,t){const n=Hm(t/rne);e.moveTo(n,0),e.arc(0,0,n,0,aie)}},$Et={draw(e,t){const n=Hm(t/5)/2;e.moveTo(-3*n,-n),e.lineTo(-n,-n),e.lineTo(-n,-3*n),e.lineTo(n,-3*n),e.lineTo(n,-n),e.lineTo(3*n,-n),e.lineTo(3*n,n),e.lineTo(n,n),e.lineTo(n,3*n),e.lineTo(-n,3*n),e.lineTo(-n,n),e.lineTo(-3*n,n),e.closePath()}},WBe=Hm(1/3),UEt=WBe*2,qEt={draw(e,t){const n=Hm(t/UEt),s=n*WBe;e.moveTo(0,-n),e.lineTo(s,0),e.lineTo(0,n),e.lineTo(-s,0),e.closePath()}},VEt={draw(e,t){const n=Hm(t),s=-n/2;e.rect(s,s,n,n)}},HEt=.8908130915292852,GBe=tne(rne/10)/tne(7*rne/10),WEt=tne(aie/10)*GBe,GEt=-zBe(aie/10)*GBe,KEt={draw(e,t){const n=Hm(t*HEt),s=WEt*n,a=GEt*n;e.moveTo(0,-n),e.lineTo(s,a);for(let o=1;o<5;++o){const l=aie*o/5,i=zBe(l),u=tne(l);e.lineTo(u*n,-i*n),e.lineTo(i*s-u*a,u*s+i*a)}e.closePath()}},qde=Hm(3),ZEt={draw(e,t){const n=-Hm(t/(qde*3));e.moveTo(0,n*2),e.lineTo(-qde*n,-n),e.lineTo(qde*n,-n),e.closePath()}},Hf=-.5,Wf=Hm(3)/2,Ipe=1/Hm(12),YEt=(Ipe/2+1)*3,XEt={draw(e,t){const n=Hm(t/YEt),s=n/2,a=n*Ipe,o=s,l=n*Ipe+n,i=-o,u=l;e.moveTo(s,a),e.lineTo(o,l),e.lineTo(i,u),e.lineTo(Hf*s-Wf*a,Wf*s+Hf*a),e.lineTo(Hf*o-Wf*l,Wf*o+Hf*l),e.lineTo(Hf*i-Wf*u,Wf*i+Hf*u),e.lineTo(Hf*s+Wf*a,Hf*a-Wf*s),e.lineTo(Hf*o+Wf*l,Hf*l-Wf*o),e.lineTo(Hf*i+Wf*u,Hf*u-Wf*i),e.closePath()}};function QEt(e,t){let n=null,s=d1e(a);e=typeof e=="function"?e:al(e||h1e),t=typeof t=="function"?t:al(t===void 0?64:+t);function a(){let o;if(n||(n=o=s()),e.apply(this,arguments).draw(n,+t.apply(this,arguments)),o)return n=null,o+""||null}return a.type=function(o){return arguments.length?(e=typeof o=="function"?o:al(o),a):e},a.size=function(o){return arguments.length?(t=typeof o=="function"?o:al(+o),a):t},a.context=function(o){return arguments.length?(n=o??null,a):n},a}function nne(){}function sne(e,t,n){e._context.bezierCurveTo((2*e._x0+e._x1)/3,(2*e._y0+e._y1)/3,(e._x0+2*e._x1)/3,(e._y0+2*e._y1)/3,(e._x0+4*e._x1+t)/6,(e._y0+4*e._y1+n)/6)}function KBe(e){this._context=e}KBe.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:sne(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(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);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:sne(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function JEt(e){return new KBe(e)}function ZBe(e){this._context=e}ZBe.prototype={areaStart:nne,areaEnd:nne,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(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._x2=e,this._y2=t;break;case 1:this._point=2,this._x3=e,this._y3=t;break;case 2:this._point=3,this._x4=e,this._y4=t,this._context.moveTo((this._x0+4*this._x1+e)/6,(this._y0+4*this._y1+t)/6);break;default:sne(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function eIt(e){return new ZBe(e)}function YBe(e){this._context=e}YBe.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(e,t){switch(e=+e,t=+t,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+e)/6,s=(this._y0+4*this._y1+t)/6;this._line?this._context.lineTo(n,s):this._context.moveTo(n,s);break;case 3:this._point=4;default:sne(this,e,t);break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t}};function tIt(e){return new YBe(e)}function XBe(e){this._context=e}XBe.prototype={areaStart:nne,areaEnd:nne,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(e,t){e=+e,t=+t,this._point?this._context.lineTo(e,t):(this._point=1,this._context.moveTo(e,t))}};function rIt(e){return new XBe(e)}function RCe(e){return e<0?-1:1}function FCe(e,t,n){var s=e._x1-e._x0,a=t-e._x1,o=(e._y1-e._y0)/(s||a<0&&-0),l=(n-e._y1)/(a||s<0&&-0),i=(o*a+l*s)/(s+a);return(RCe(o)+RCe(l))*Math.min(Math.abs(o),Math.abs(l),.5*Math.abs(i))||0}function zCe(e,t){var n=e._x1-e._x0;return n?(3*(e._y1-e._y0)/n-t)/2:t}function Vde(e,t,n){var s=e._x0,a=e._y0,o=e._x1,l=e._y1,i=(o-s)/3;e._context.bezierCurveTo(s+i,a+i*t,o-i,l-i*n,o,l)}function ane(e){this._context=e}ane.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:Vde(this,this._t0,zCe(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(e,t){var n=NaN;if(e=+e,t=+t,!(e===this._x1&&t===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;break;case 2:this._point=3,Vde(this,zCe(this,n=FCe(this,e,t)),n);break;default:Vde(this,this._t0,n=FCe(this,e,t));break}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=t,this._t0=n}}};function QBe(e){this._context=new JBe(e)}(QBe.prototype=Object.create(ane.prototype)).point=function(e,t){ane.prototype.point.call(this,t,e)};function JBe(e){this._context=e}JBe.prototype={moveTo:function(e,t){this._context.moveTo(t,e)},closePath:function(){this._context.closePath()},lineTo:function(e,t){this._context.lineTo(t,e)},bezierCurveTo:function(e,t,n,s,a,o){this._context.bezierCurveTo(t,e,s,n,o,a)}};function nIt(e){return new ane(e)}function sIt(e){return new QBe(e)}function e$e(e){this._context=e}e$e.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var e=this._x,t=this._y,n=e.length;if(n)if(this._line?this._context.lineTo(e[0],t[0]):this._context.moveTo(e[0],t[0]),n===2)this._context.lineTo(e[1],t[1]);else for(var s=BCe(e),a=BCe(t),o=0,l=1;l=0;--t)a[t]=(l[t]-a[t+1])/o[t];for(o[n-1]=(e[n]+a[n-1])/2,t=0;t=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(e,t){switch(e=+e,t=+t,this._point){case 0:this._point=1,this._line?this._context.lineTo(e,t):this._context.moveTo(e,t);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,t),this._context.lineTo(e,t);else{var n=this._x*(1-this._t)+e*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,t)}break}}this._x=e,this._y=t}};function iIt(e){return new oie(e,.5)}function oIt(e){return new oie(e,0)}function lIt(e){return new oie(e,1)}function UC(e,t){if((l=e.length)>1)for(var n=1,s,a,o=e[t[0]],l,i=o.length;n=0;)n[t]=t;return n}function cIt(e,t){return e[t]}function dIt(e){const t=[];return t.key=e,t}function uIt(){var e=al([]),t=Ppe,n=UC,s=cIt;function a(o){var l=Array.from(e.apply(this,arguments),dIt),i,u=l.length,p=-1,x;for(const y of o)for(i=0,++p;i0){for(var n,s,a=0,o=e[0].length,l;a0){for(var n=0,s=e[t[0]],a,o=s.length;n0)||!((o=(a=e[t[0]]).length)>0))){for(var n=0,s=1,a,o,l;s=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(n[s]=e[s])}return n}function _It(e,t){if(e==null)return{};var n={};for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){if(t.indexOf(s)>=0)continue;n[s]=e[s]}return n}var t$e={symbolCircle:h1e,symbolCross:$Et,symbolDiamond:qEt,symbolSquare:VEt,symbolStar:KEt,symbolTriangle:ZEt,symbolWye:XEt},bIt=Math.PI/180,wIt=function(t){var n="symbol".concat(sie(t));return t$e[n]||h1e},jIt=function(t,n,s){if(n==="area")return t;switch(s){case"cross":return 5*t*t/9;case"diamond":return .5*t*t/Math.sqrt(3);case"square":return t*t;case"star":{var a=18*bIt;return 1.25*t*t*(Math.tan(a)-Math.tan(a*2)*Math.pow(Math.tan(a),2))}case"triangle":return Math.sqrt(3)*t*t/4;case"wye":return(21-10*Math.sqrt(3))*t*t/8;default:return Math.PI*t*t/4}},kIt=function(t,n){t$e["symbol".concat(sie(t))]=n},f1e=function(t){var n=t.type,s=n===void 0?"circle":n,a=t.size,o=a===void 0?64:a,l=t.sizeType,i=l===void 0?"area":l,u=vIt(t,mIt),p=UCe(UCe({},u),{},{type:s,size:o,sizeType:i}),x=function(){var M=wIt(s),P=QEt().type(M).size(jIt(o,i,s));return P()},y=p.className,_=p.cx,b=p.cy,S=Ba(p,!0);return _===+_&&b===+b&&o===+o?lt.createElement("path",Lpe({},S,{className:ui("recharts-symbols",y),transform:"translate(".concat(_,", ").concat(b,")"),d:x()})):null};f1e.registerSymbol=kIt;function qC(e){"@babel/helpers - typeof";return qC=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},qC(e)}function Ope(){return Ope=Object.assign?Object.assign.bind():function(e){for(var t=1;t`);var T=b.inactive?p:b.color;return lt.createElement("li",Ope({className:M,style:y,key:"legend-item-".concat(S)},xk(s.props,b,S)),lt.createElement(Spe,{width:l,height:l,viewBox:x,style:_},s.renderIcon(b)),lt.createElement("span",{className:"recharts-legend-item-text",style:{color:T}},k?k(P,b,S):P))})}},{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 lt.createElement("ul",{className:"recharts-default-legend",style:i},this.renderItems())}}])}(E.PureComponent);eI(p1e,"displayName","Legend");eI(p1e,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"middle",inactiveColor:"#ccc"});var LIt=Hae;function OIt(){this.__data__=new LIt,this.size=0}var DIt=OIt;function RIt(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}var FIt=RIt;function zIt(e){return this.__data__.get(e)}var BIt=zIt;function $It(e){return this.__data__.has(e)}var UIt=$It,qIt=Hae,VIt=t1e,HIt=r1e,WIt=200;function GIt(e,t){var n=this.__data__;if(n instanceof qIt){var s=n.__data__;if(!VIt||s.lengthi))return!1;var p=o.get(e),x=o.get(t);if(p&&x)return p==t&&x==e;var y=-1,_=!0,b=n&mPt?new uPt:void 0;for(o.set(e,t),o.set(t,e);++y-1&&e%1==0&&e-1&&e%1==0&&e<=v6t}var y1e=_6t,b6t=qy,w6t=y1e,j6t=Vy,k6t="[object Arguments]",N6t="[object Array]",S6t="[object Boolean]",C6t="[object Date]",M6t="[object Error]",T6t="[object Function]",A6t="[object Map]",E6t="[object Number]",I6t="[object Object]",P6t="[object RegExp]",L6t="[object Set]",O6t="[object String]",D6t="[object WeakMap]",R6t="[object ArrayBuffer]",F6t="[object DataView]",z6t="[object Float32Array]",B6t="[object Float64Array]",$6t="[object Int8Array]",U6t="[object Int16Array]",q6t="[object Int32Array]",V6t="[object Uint8Array]",H6t="[object Uint8ClampedArray]",W6t="[object Uint16Array]",G6t="[object Uint32Array]",ml={};ml[z6t]=ml[B6t]=ml[$6t]=ml[U6t]=ml[q6t]=ml[V6t]=ml[H6t]=ml[W6t]=ml[G6t]=!0;ml[k6t]=ml[N6t]=ml[R6t]=ml[S6t]=ml[F6t]=ml[C6t]=ml[M6t]=ml[T6t]=ml[A6t]=ml[E6t]=ml[I6t]=ml[P6t]=ml[L6t]=ml[O6t]=ml[D6t]=!1;function K6t(e){return j6t(e)&&w6t(e.length)&&!!ml[b6t(e)]}var Z6t=K6t;function Y6t(e){return function(t){return e(t)}}var h$e=Y6t,cne={exports:{}};cne.exports;(function(e,t){var n=_Be,s=t&&!t.nodeType&&t,a=s&&!0&&e&&!e.nodeType&&e,o=a&&a.exports===s,l=o&&n.process,i=function(){try{var u=a&&a.require&&a.require("util").types;return u||l&&l.binding&&l.binding("util")}catch{}}();e.exports=i})(cne,cne.exports);var X6t=cne.exports,Q6t=Z6t,J6t=h$e,ZCe=X6t,YCe=ZCe&&ZCe.isTypedArray,eLt=YCe?J6t(YCe):Q6t,f$e=eLt,tLt=s6t,rLt=g1e,nLt=Fh,sLt=u$e,aLt=x1e,iLt=f$e,oLt=Object.prototype,lLt=oLt.hasOwnProperty;function cLt(e,t){var n=nLt(e),s=!n&&rLt(e),a=!n&&!s&&sLt(e),o=!n&&!s&&!a&&iLt(e),l=n||s||a||o,i=l?tLt(e.length,String):[],u=i.length;for(var p in e)(t||lLt.call(e,p))&&!(l&&(p=="length"||a&&(p=="offset"||p=="parent")||o&&(p=="buffer"||p=="byteLength"||p=="byteOffset")||aLt(p,u)))&&i.push(p);return i}var dLt=cLt,uLt=Object.prototype;function hLt(e){var t=e&&e.constructor,n=typeof t=="function"&&t.prototype||uLt;return e===n}var fLt=hLt;function pLt(e,t){return function(n){return e(t(n))}}var p$e=pLt,mLt=p$e,gLt=mLt(Object.keys,Object),xLt=gLt,yLt=fLt,vLt=xLt,_Lt=Object.prototype,bLt=_Lt.hasOwnProperty;function wLt(e){if(!yLt(e))return vLt(e);var t=[];for(var n in Object(e))bLt.call(e,n)&&n!="constructor"&&t.push(n);return t}var jLt=wLt,kLt=J0e,NLt=y1e;function SLt(e){return e!=null&&NLt(e.length)&&!kLt(e)}var kP=SLt,CLt=dLt,MLt=jLt,TLt=kP;function ALt(e){return TLt(e)?CLt(e):MLt(e)}var lie=ALt,ELt=WPt,ILt=r6t,PLt=lie;function LLt(e){return ELt(e,PLt,ILt)}var OLt=LLt,XCe=OLt,DLt=1,RLt=Object.prototype,FLt=RLt.hasOwnProperty;function zLt(e,t,n,s,a,o){var l=n&DLt,i=XCe(e),u=i.length,p=XCe(t),x=p.length;if(u!=x&&!l)return!1;for(var y=u;y--;){var _=i[y];if(!(l?_ in t:FLt.call(t,_)))return!1}var b=o.get(e),S=o.get(t);if(b&&S)return b==t&&S==e;var k=!0;o.set(e,t),o.set(t,e);for(var M=l;++y-1}var R8t=D8t;function F8t(e,t,n){for(var s=-1,a=e==null?0:e.length;++s=J8t){var p=t?null:X8t(e);if(p)return Q8t(p);l=!1,a=Y8t,u=new G8t}else u=t?[]:i;e:for(;++s=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(n[s]=e[s])}return n}function mDt(e,t){if(e==null)return{};var n={};for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){if(t.indexOf(s)>=0)continue;n[s]=e[s]}return n}function gDt(e){return e.value}function xDt(e,t){if(lt.isValidElement(e))return lt.cloneElement(e,t);if(typeof e=="function")return lt.createElement(e,t);t.ref;var n=pDt(t,iDt);return lt.createElement(p1e,n)}var f3e=1,tC=function(e){function t(){var n;oDt(this,t);for(var s=arguments.length,a=new Array(s),o=0;of3e||Math.abs(a.height-this.lastBoundingBox.height)>f3e)&&(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?Dx({},this.lastBoundingBox):{width:0,height:0}}},{key:"getDefaultPosition",value:function(s){var a=this.props,o=a.layout,l=a.align,i=a.verticalAlign,u=a.margin,p=a.chartWidth,x=a.chartHeight,y,_;if(!s||(s.left===void 0||s.left===null)&&(s.right===void 0||s.right===null))if(l==="center"&&o==="vertical"){var b=this.getBBoxSnapshot();y={left:((p||0)-b.width)/2}}else y=l==="right"?{right:u&&u.right||0}:{left:u&&u.left||0};if(!s||(s.top===void 0||s.top===null)&&(s.bottom===void 0||s.bottom===null))if(i==="middle"){var S=this.getBBoxSnapshot();_={top:((x||0)-S.height)/2}}else _=i==="bottom"?{bottom:u&&u.bottom||0}:{top:u&&u.top||0};return Dx(Dx({},y),_)}},{key:"render",value:function(){var s=this,a=this.props,o=a.content,l=a.width,i=a.height,u=a.wrapperStyle,p=a.payloadUniqBy,x=a.payload,y=Dx(Dx({position:"absolute",width:l||"auto",height:i||"auto"},this.getDefaultPosition(u)),u);return lt.createElement("div",{className:"recharts-legend-wrapper",style:y,ref:function(b){s.wrapperNode=b}},xDt(o,Dx(Dx({},this.props),{},{payload:b$e(x,p,gDt)})))}}],[{key:"getWithHeight",value:function(s,a){var o=Dx(Dx({},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}}])}(E.PureComponent);cie(tC,"displayName","Legend");cie(tC,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"bottom"});var p3e=bP,yDt=g1e,vDt=Fh,m3e=p3e?p3e.isConcatSpreadable:void 0;function _Dt(e){return vDt(e)||yDt(e)||!!(m3e&&e&&e[m3e])}var bDt=_Dt,wDt=c$e,jDt=bDt;function k$e(e,t,n,s,a){var o=-1,l=e.length;for(n||(n=jDt),a||(a=[]);++o0&&n(i)?t>1?k$e(i,t-1,n,s,a):wDt(a,i):s||(a[a.length]=i)}return a}var N$e=k$e;function kDt(e){return function(t,n,s){for(var a=-1,o=Object(t),l=s(t),i=l.length;i--;){var u=l[e?i:++a];if(n(o[u],u,o)===!1)break}return t}}var NDt=kDt,SDt=NDt,CDt=SDt(),MDt=CDt,TDt=MDt,ADt=lie;function EDt(e,t){return e&&TDt(e,t,ADt)}var S$e=EDt,IDt=kP;function PDt(e,t){return function(n,s){if(n==null)return n;if(!IDt(n))return e(n,s);for(var a=n.length,o=t?a:-1,l=Object(n);(t?o--:++ot||o&&l&&u&&!i&&!p||s&&l&&u||!n&&u||!a)return 1;if(!s&&!o&&!p&&e=i)return u;var p=n[s];return u*(p=="desc"?-1:1)}}return e.index-t.index}var GDt=WDt,Kde=s1e,KDt=a1e,ZDt=ox,YDt=C$e,XDt=UDt,QDt=h$e,JDt=GDt,eRt=G3,tRt=Fh;function rRt(e,t,n){t.length?t=Kde(t,function(o){return tRt(o)?function(l){return KDt(l,o.length===1?o[0]:o)}:o}):t=[eRt];var s=-1;t=Kde(t,QDt(ZDt));var a=YDt(e,function(o,l,i){var u=Kde(t,function(p){return p(o)});return{criteria:u,index:++s,value:o}});return XDt(a,function(o,l){return JDt(o,l,n)})}var nRt=rRt;function sRt(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}var aRt=sRt,iRt=aRt,x3e=Math.max;function oRt(e,t,n){return t=x3e(t===void 0?e.length-1:t,0),function(){for(var s=arguments,a=-1,o=x3e(s.length-t,0),l=Array(o);++a0){if(++t>=xRt)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}var bRt=_Rt,wRt=gRt,jRt=bRt,kRt=jRt(wRt),NRt=kRt,SRt=G3,CRt=lRt,MRt=NRt;function TRt(e,t){return MRt(CRt(e,t,SRt),e+"")}var ARt=TRt,ERt=e1e,IRt=kP,PRt=x1e,LRt=Ev;function ORt(e,t,n){if(!LRt(n))return!1;var s=typeof t;return(s=="number"?IRt(n)&&PRt(t,n.length):s=="string"&&t in n)?ERt(n[t],e):!1}var die=ORt,DRt=N$e,RRt=nRt,FRt=ARt,v3e=die,zRt=FRt(function(e,t){if(e==null)return[];var n=t.length;return n>1&&v3e(e,t[0],t[1])?t=[]:n>2&&v3e(t[0],t[1],t[2])&&(t=[t[0]]),RRt(e,DRt(t,1),[])}),BRt=zRt;const b1e=Qi(BRt);function tI(e){"@babel/helpers - typeof";return tI=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},tI(e)}function qpe(){return qpe=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,s=new Array(t);n=t.x),"".concat(gT,"-left"),Dn(n)&&t&&Dn(t.x)&&n=t.y),"".concat(gT,"-top"),Dn(s)&&t&&Dn(t.y)&&sk?Math.max(x,u[s]):Math.max(y,u[s])}function tFt(e){var t=e.translateX,n=e.translateY,s=e.useTranslate3d;return{transform:s?"translate3d(".concat(t,"px, ").concat(n,"px, 0)"):"translate(".concat(t,"px, ").concat(n,"px)")}}function rFt(e){var t=e.allowEscapeViewBox,n=e.coordinate,s=e.offsetTopLeft,a=e.position,o=e.reverseDirection,l=e.tooltipBox,i=e.useTranslate3d,u=e.viewBox,p,x,y;return l.height>0&&l.width>0&&n?(x=w3e({allowEscapeViewBox:t,coordinate:n,key:"x",offsetTopLeft:s,position:a,reverseDirection:o,tooltipDimension:l.width,viewBox:u,viewBoxDimension:u.width}),y=w3e({allowEscapeViewBox:t,coordinate:n,key:"y",offsetTopLeft:s,position:a,reverseDirection:o,tooltipDimension:l.height,viewBox:u,viewBoxDimension:u.height}),p=tFt({translateX:x,translateY:y,useTranslate3d:i})):p=JRt,{cssProperties:p,cssClasses:eFt({translateX:x,translateY:y,coordinate:n})}}function HC(e){"@babel/helpers - typeof";return HC=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},HC(e)}function j3e(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,s)}return n}function k3e(e){for(var t=1;tN3e||Math.abs(s.height-this.state.lastBoundingBox.height)>N3e)&&this.setState({lastBoundingBox:{width:s.width,height:s.height}})}else(this.state.lastBoundingBox.width!==-1||this.state.lastBoundingBox.height!==-1)&&this.setState({lastBoundingBox:{width:-1,height:-1}})}},{key:"componentDidMount",value:function(){document.addEventListener("keydown",this.handleKeyDown),this.updateBBox()}},{key:"componentWillUnmount",value:function(){document.removeEventListener("keydown",this.handleKeyDown)}},{key:"componentDidUpdate",value:function(){var s,a;this.props.active&&this.updateBBox(),this.state.dismissed&&(((s=this.props.coordinate)===null||s===void 0?void 0:s.x)!==this.state.dismissedAtCoordinate.x||((a=this.props.coordinate)===null||a===void 0?void 0:a.y)!==this.state.dismissedAtCoordinate.y)&&(this.state.dismissed=!1)}},{key:"render",value:function(){var s=this,a=this.props,o=a.active,l=a.allowEscapeViewBox,i=a.animationDuration,u=a.animationEasing,p=a.children,x=a.coordinate,y=a.hasPayload,_=a.isAnimationActive,b=a.offset,S=a.position,k=a.reverseDirection,M=a.useTranslate3d,P=a.viewBox,T=a.wrapperStyle,I=rFt({allowEscapeViewBox:l,coordinate:x,offsetTopLeft:b,position:S,reverseDirection:k,tooltipBox:this.state.lastBoundingBox,useTranslate3d:M,viewBox:P}),z=I.cssClasses,D=I.cssProperties,U=k3e(k3e({transition:_&&o?"transform ".concat(i,"ms ").concat(u):void 0},D),{},{pointerEvents:"none",visibility:!this.state.dismissed&&o&&y?"visible":"hidden",position:"absolute",top:0,left:0},T);return lt.createElement("div",{tabIndex:-1,className:z,style:U,ref:function(W){s.wrapperNode=W}},p)}}])}(E.PureComponent),hFt=function(){return!(typeof window<"u"&&window.document&&window.document.createElement&&window.setTimeout)},K3={isSsr:hFt()};function WC(e){"@babel/helpers - typeof";return WC=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},WC(e)}function S3e(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,s)}return n}function C3e(e){for(var t=1;t0;return lt.createElement(uFt,{allowEscapeViewBox:l,animationDuration:i,animationEasing:u,isAnimationActive:_,active:o,coordinate:x,hasPayload:U,offset:b,position:M,reverseDirection:P,useTranslate3d:T,viewBox:I,wrapperStyle:z},wFt(p,C3e(C3e({},this.props),{},{payload:D})))}}])}(E.PureComponent);w1e(um,"displayName","Tooltip");w1e(um,"defaultProps",{accessibilityLayer:!1,allowEscapeViewBox:{x:!1,y:!1},animationDuration:400,animationEasing:"ease",contentStyle:{},coordinate:{x:0,y:0},cursor:!0,cursorStyle:{},filterNull:!0,isAnimationActive:!K3.isSsr,itemStyle:{},labelStyle:{},offset:10,reverseDirection:{x:!1,y:!1},separator:" : ",trigger:"hover",useTranslate3d:!1,viewBox:{x:0,y:0,height:0,width:0},wrapperStyle:{}});var jFt=ix,kFt=function(){return jFt.Date.now()},NFt=kFt,SFt=/\s/;function CFt(e){for(var t=e.length;t--&&SFt.test(e.charAt(t)););return t}var MFt=CFt,TFt=MFt,AFt=/^\s+/;function EFt(e){return e&&e.slice(0,TFt(e)+1).replace(AFt,"")}var IFt=EFt,PFt=IFt,M3e=Ev,LFt=B3,T3e=NaN,OFt=/^[-+]0x[0-9a-f]+$/i,DFt=/^0b[01]+$/i,RFt=/^0o[0-7]+$/i,FFt=parseInt;function zFt(e){if(typeof e=="number")return e;if(LFt(e))return T3e;if(M3e(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=M3e(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=PFt(e);var n=DFt.test(e);return n||RFt.test(e)?FFt(e.slice(2),n?2:8):OFt.test(e)?T3e:+e}var P$e=zFt,BFt=Ev,Yde=NFt,A3e=P$e,$Ft="Expected a function",UFt=Math.max,qFt=Math.min;function VFt(e,t,n){var s,a,o,l,i,u,p=0,x=!1,y=!1,_=!0;if(typeof e!="function")throw new TypeError($Ft);t=A3e(t)||0,BFt(n)&&(x=!!n.leading,y="maxWait"in n,o=y?UFt(A3e(n.maxWait)||0,t):o,_="trailing"in n?!!n.trailing:_);function b(U){var V=s,W=a;return s=a=void 0,p=U,l=e.apply(W,V),l}function S(U){return p=U,i=setTimeout(P,t),x?b(U):l}function k(U){var V=U-u,W=U-p,G=t-V;return y?qFt(G,o-W):G}function M(U){var V=U-u,W=U-p;return u===void 0||V>=t||V<0||y&&W>=o}function P(){var U=Yde();if(M(U))return T(U);i=setTimeout(P,k(U))}function T(U){return i=void 0,_&&s?b(U):(s=a=void 0,l)}function I(){i!==void 0&&clearTimeout(i),p=0,s=u=a=i=void 0}function z(){return i===void 0?l:T(Yde())}function D(){var U=Yde(),V=M(U);if(s=arguments,a=this,u=U,V){if(i===void 0)return S(u);if(y)return clearTimeout(i),i=setTimeout(P,t),b(u)}return i===void 0&&(i=setTimeout(P,t)),l}return D.cancel=I,D.flush=z,D}var HFt=VFt,WFt=HFt,GFt=Ev,KFt="Expected a function";function ZFt(e,t,n){var s=!0,a=!0;if(typeof e!="function")throw new TypeError(KFt);return GFt(n)&&(s="leading"in n?!!n.leading:s,a="trailing"in n?!!n.trailing:a),WFt(e,t,{leading:s,maxWait:t,trailing:a})}var YFt=ZFt;const L$e=Qi(YFt);function nI(e){"@babel/helpers - typeof";return nI=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},nI(e)}function E3e(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,s)}return n}function AO(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,s=new Array(t);n0&&(ge=L$e(ge,k,{trailing:!0,leading:!1}));var ie=new ResizeObserver(ge),pe=D.current.getBoundingClientRect(),se=pe.width,fe=pe.height;return ne(se,fe),ie.observe(D.current),function(){ie.disconnect()}},[ne,k]);var oe=E.useMemo(function(){var ge=G.containerWidth,ie=G.containerHeight;if(ge<0||ie<0)return null;Lm(dj(l)||dj(u),`The width(%s) and height(%s) are both fixed numbers, maybe you don't need to use a ResponsiveContainer.`,l,u),Lm(!n||n>0,"The aspect(%s) must be greater than zero.",n);var pe=dj(l)?ge:l,se=dj(u)?ie:u;n&&n>0&&(pe?se=pe/n:se&&(pe=se*n),_&&se>_&&(se=_)),Lm(pe>0||se>0,`The width(%s) and height(%s) of chart should be greater than 0, please check the style of container, or the props width(%s) and height(%s), or add a minWidth(%s) or minHeight(%s) or use aspect(%s) to control the height and width.`,pe,se,l,u,x,y,n);var fe=!Array.isArray(b)&&vy(b.type).endsWith("Chart");return lt.Children.map(b,function(he){return lt.isValidElement(he)?E.cloneElement(he,AO({width:pe,height:se},fe?{style:AO({height:"100%",width:"100%",maxHeight:se,maxWidth:pe},he.props.style)}:{})):he})},[n,b,u,_,y,x,G,l]);return lt.createElement("div",{id:M?"".concat(M):void 0,className:ui("recharts-responsive-container",P),style:AO(AO({},z),{},{width:l,height:u,minWidth:x,minHeight:y,maxHeight:_}),ref:D},oe)}),uie=function(t){return null};uie.displayName="Cell";function sI(e){"@babel/helpers - typeof";return sI=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},sI(e)}function P3e(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,s)}return n}function Kpe(e){for(var t=1;t1&&arguments[1]!==void 0?arguments[1]:{};if(t==null||K3.isSsr)return{width:0,height:0};var s=dzt(n),a=JSON.stringify({text:t,copyStyle:s});if(P4.widthCache[a])return P4.widthCache[a];try{var o=document.getElementById(L3e);o||(o=document.createElement("span"),o.setAttribute("id",L3e),o.setAttribute("aria-hidden","true"),document.body.appendChild(o));var l=Kpe(Kpe({},czt),s);Object.assign(o.style,l),o.textContent="".concat(t);var i=o.getBoundingClientRect(),u={width:i.width,height:i.height};return P4.widthCache[a]=u,++P4.cacheCount>lzt&&(P4.cacheCount=0,P4.widthCache={}),u}catch{return{width:0,height:0}}},uzt=function(t){return{top:t.top+window.scrollY-document.documentElement.clientTop,left:t.left+window.scrollX-document.documentElement.clientLeft}};function aI(e){"@babel/helpers - typeof";return aI=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},aI(e)}function fne(e,t){return mzt(e)||pzt(e,t)||fzt(e,t)||hzt()}function hzt(){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 fzt(e,t){if(e){if(typeof e=="string")return O3e(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return O3e(e,t)}}function O3e(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,s=new Array(t);n=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(n[s]=e[s])}return n}function Tzt(e,t){if(e==null)return{};var n={};for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){if(t.indexOf(s)>=0)continue;n[s]=e[s]}return n}function $3e(e,t){return Pzt(e)||Izt(e,t)||Ezt(e,t)||Azt()}function Azt(){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 Ezt(e,t){if(e){if(typeof e=="string")return U3e(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return U3e(e,t)}}function U3e(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,s=new Array(t);n0&&arguments[0]!==void 0?arguments[0]:[];return pe.reduce(function(se,fe){var he=fe.word,ye=fe.width,Ae=se[se.length-1];if(Ae&&(a==null||o||Ae.width+ye+sfe.width?se:fe})};if(!x)return b;for(var k="…",M=function(pe){var se=y.slice(0,pe),fe=F$e({breakAll:p,style:u,children:se+k}).wordsWithComputedWidth,he=_(fe),ye=he.length>l||S(he).width>Number(a);return[ye,he]},P=0,T=y.length-1,I=0,z;P<=T&&I<=y.length-1;){var D=Math.floor((P+T)/2),U=D-1,V=M(U),W=$3e(V,2),G=W[0],J=W[1],ne=M(D),oe=$3e(ne,1),ge=oe[0];if(!G&&!ge&&(P=D+1),G&&ge&&(T=D-1),!G&&ge){z=J;break}I++}return z||b},q3e=function(t){var n=Mi(t)?[]:t.toString().split(R$e);return[{words:n}]},Ozt=function(t){var n=t.width,s=t.scaleToFit,a=t.children,o=t.style,l=t.breakAll,i=t.maxLines;if((n||s)&&!K3.isSsr){var u,p,x=F$e({breakAll:l,children:a,style:o});if(x){var y=x.wordsWithComputedWidth,_=x.spaceWidth;u=y,p=_}else return q3e(a);return Lzt({breakAll:l,children:a,maxLines:i,style:o},u,p,n,s)}return q3e(a)},V3e="#808080",yk=function(t){var n=t.x,s=n===void 0?0:n,a=t.y,o=a===void 0?0:a,l=t.lineHeight,i=l===void 0?"1em":l,u=t.capHeight,p=u===void 0?"0.71em":u,x=t.scaleToFit,y=x===void 0?!1:x,_=t.textAnchor,b=_===void 0?"start":_,S=t.verticalAnchor,k=S===void 0?"end":S,M=t.fill,P=M===void 0?V3e:M,T=B3e(t,Czt),I=E.useMemo(function(){return Ozt({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,D=T.dy,U=T.angle,V=T.className,W=T.breakAll,G=B3e(T,Mzt);if(!hd(s)||!hd(o))return null;var J=s+(Dn(z)?z:0),ne=o+(Dn(D)?D:0),oe;switch(k){case"start":oe=Xde("calc(".concat(p,")"));break;case"middle":oe=Xde("calc(".concat((I.length-1)/2," * -").concat(i," + (").concat(p," / 2))"));break;default:oe=Xde("calc(".concat(I.length-1," * -").concat(i,")"));break}var ge=[];if(y){var ie=I[0].width,pe=T.width;ge.push("scale(".concat((Dn(pe)?pe/ie:1)/ie,")"))}return U&&ge.push("rotate(".concat(U,", ").concat(J,", ").concat(ne,")")),ge.length&&(G.transform=ge.join(" ")),lt.createElement("text",Zpe({},Ba(G,!0),{x:J,y:ne,className:ui("recharts-text",V),textAnchor:b,fill:P.includes("url")?V3e:P}),I.map(function(se,fe){var he=se.words.join(W?"":" ");return lt.createElement("tspan",{x:J,dy:fe===0?oe:i,key:"".concat(he,"-").concat(fe)},he)}))};function av(e,t){return e==null||t==null?NaN:et?1:e>=t?0:NaN}function Dzt(e,t){return e==null||t==null?NaN:te?1:t>=e?0:NaN}function j1e(e){let t,n,s;e.length!==2?(t=av,n=(i,u)=>av(e(i),u),s=(i,u)=>e(i)-u):(t=e===av||e===Dzt?e:Rzt,n=e,s=e);function a(i,u,p=0,x=i.length){if(p>>1;n(i[y],u)<0?p=y+1:x=y}while(p>>1;n(i[y],u)<=0?p=y+1:x=y}while(pp&&s(i[y-1],u)>-s(i[y],u)?y-1:y}return{left:a,center:l,right:o}}function Rzt(){return 0}function z$e(e){return e===null?NaN:+e}function*Fzt(e,t){for(let n of e)n!=null&&(n=+n)>=n&&(yield n)}const zzt=j1e(av),NP=zzt.right;j1e(z$e).center;class H3e extends Map{constructor(t,n=Uzt){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),t!=null)for(const[s,a]of t)this.set(s,a)}get(t){return super.get(W3e(this,t))}has(t){return super.has(W3e(this,t))}set(t,n){return super.set(Bzt(this,t),n)}delete(t){return super.delete($zt(this,t))}}function W3e({_intern:e,_key:t},n){const s=t(n);return e.has(s)?e.get(s):n}function Bzt({_intern:e,_key:t},n){const s=t(n);return e.has(s)?e.get(s):(e.set(s,n),n)}function $zt({_intern:e,_key:t},n){const s=t(n);return e.has(s)&&(n=e.get(s),e.delete(s)),n}function Uzt(e){return e!==null&&typeof e=="object"?e.valueOf():e}function qzt(e=av){if(e===av)return B$e;if(typeof e!="function")throw new TypeError("compare is not a function");return(t,n)=>{const s=e(t,n);return s||s===0?s:(e(n,n)===0)-(e(t,t)===0)}}function B$e(e,t){return(e==null||!(e>=e))-(t==null||!(t>=t))||(et?1:0)}const Vzt=Math.sqrt(50),Hzt=Math.sqrt(10),Wzt=Math.sqrt(2);function pne(e,t,n){const s=(t-e)/Math.max(0,n),a=Math.floor(Math.log10(s)),o=s/Math.pow(10,a),l=o>=Vzt?10:o>=Hzt?5:o>=Wzt?2:1;let i,u,p;return a<0?(p=Math.pow(10,-a)/l,i=Math.round(e*p),u=Math.round(t*p),i/pt&&--u,p=-p):(p=Math.pow(10,a)*l,i=Math.round(e/p),u=Math.round(t/p),i*pt&&--u),u0))return[];if(e===t)return[e];const s=t=a))return[];const i=o-a+1,u=new Array(i);if(s)if(l<0)for(let p=0;p=s)&&(n=s);return n}function K3e(e,t){let n;for(const s of e)s!=null&&(n>s||n===void 0&&s>=s)&&(n=s);return n}function $$e(e,t,n=0,s=1/0,a){if(t=Math.floor(t),n=Math.floor(Math.max(0,n)),s=Math.floor(Math.min(e.length-1,s)),!(n<=t&&t<=s))return e;for(a=a===void 0?B$e:qzt(a);s>n;){if(s-n>600){const u=s-n+1,p=t-n+1,x=Math.log(u),y=.5*Math.exp(2*x/3),_=.5*Math.sqrt(x*y*(u-y)/u)*(p-u/2<0?-1:1),b=Math.max(n,Math.floor(t-p*y/u+_)),S=Math.min(s,Math.floor(t+(u-p)*y/u+_));$$e(e,t,b,S,a)}const o=e[t];let l=n,i=s;for(xT(e,n,t),a(e[s],o)>0&&xT(e,n,s);l0;)--i}a(e[n],o)===0?xT(e,n,i):(++i,xT(e,i,s)),i<=t&&(n=i+1),t<=i&&(s=i-1)}return e}function xT(e,t,n){const s=e[t];e[t]=e[n],e[n]=s}function Gzt(e,t,n){if(e=Float64Array.from(Fzt(e)),!(!(s=e.length)||isNaN(t=+t))){if(t<=0||s<2)return K3e(e);if(t>=1)return G3e(e);var s,a=(s-1)*t,o=Math.floor(a),l=G3e($$e(e,o).subarray(0,o+1)),i=K3e(e.subarray(o+1));return l+(i-l)*(a-o)}}function Kzt(e,t,n=z$e){if(!(!(s=e.length)||isNaN(t=+t))){if(t<=0||s<2)return+n(e[0],0,e);if(t>=1)return+n(e[s-1],s-1,e);var s,a=(s-1)*t,o=Math.floor(a),l=+n(e[o],o,e),i=+n(e[o+1],o+1,e);return l+(i-l)*(a-o)}}function Zzt(e,t,n){e=+e,t=+t,n=(a=arguments.length)<2?(t=e,e=0,1):a<3?1:+n;for(var s=-1,a=Math.max(0,Math.ceil((t-e)/n))|0,o=new Array(a);++s>8&15|t>>4&240,t>>4&15|t&240,(t&15)<<4|t&15,1):n===8?IO(t>>24&255,t>>16&255,t>>8&255,(t&255)/255):n===4?IO(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|t&240,((t&15)<<4|t&15)/255):null):(t=Xzt.exec(e))?new Sh(t[1],t[2],t[3],1):(t=Qzt.exec(e))?new Sh(t[1]*255/100,t[2]*255/100,t[3]*255/100,1):(t=Jzt.exec(e))?IO(t[1],t[2],t[3],t[4]):(t=e7t.exec(e))?IO(t[1]*255/100,t[2]*255/100,t[3]*255/100,t[4]):(t=t7t.exec(e))?t5e(t[1],t[2]/100,t[3]/100,1):(t=r7t.exec(e))?t5e(t[1],t[2]/100,t[3]/100,t[4]):Z3e.hasOwnProperty(e)?Q3e(Z3e[e]):e==="transparent"?new Sh(NaN,NaN,NaN,0):null}function Q3e(e){return new Sh(e>>16&255,e>>8&255,e&255,1)}function IO(e,t,n,s){return s<=0&&(e=t=n=NaN),new Sh(e,t,n,s)}function a7t(e){return e instanceof SP||(e=cI(e)),e?(e=e.rgb(),new Sh(e.r,e.g,e.b,e.opacity)):new Sh}function eme(e,t,n,s){return arguments.length===1?a7t(e):new Sh(e,t,n,s??1)}function Sh(e,t,n,s){this.r=+e,this.g=+t,this.b=+n,this.opacity=+s}N1e(Sh,eme,q$e(SP,{brighter(e){return e=e==null?mne:Math.pow(mne,e),new Sh(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=e==null?oI:Math.pow(oI,e),new Sh(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new Sh(Kj(this.r),Kj(this.g),Kj(this.b),gne(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:J3e,formatHex:J3e,formatHex8:i7t,formatRgb:e5e,toString:e5e}));function J3e(){return`#${uj(this.r)}${uj(this.g)}${uj(this.b)}`}function i7t(){return`#${uj(this.r)}${uj(this.g)}${uj(this.b)}${uj((isNaN(this.opacity)?1:this.opacity)*255)}`}function e5e(){const e=gne(this.opacity);return`${e===1?"rgb(":"rgba("}${Kj(this.r)}, ${Kj(this.g)}, ${Kj(this.b)}${e===1?")":`, ${e})`}`}function gne(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function Kj(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function uj(e){return e=Kj(e),(e<16?"0":"")+e.toString(16)}function t5e(e,t,n,s){return s<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new ym(e,t,n,s)}function V$e(e){if(e instanceof ym)return new ym(e.h,e.s,e.l,e.opacity);if(e instanceof SP||(e=cI(e)),!e)return new ym;if(e instanceof ym)return e;e=e.rgb();var t=e.r/255,n=e.g/255,s=e.b/255,a=Math.min(t,n,s),o=Math.max(t,n,s),l=NaN,i=o-a,u=(o+a)/2;return i?(t===o?l=(n-s)/i+(n0&&u<1?0:l,new ym(l,i,u,e.opacity)}function o7t(e,t,n,s){return arguments.length===1?V$e(e):new ym(e,t,n,s??1)}function ym(e,t,n,s){this.h=+e,this.s=+t,this.l=+n,this.opacity=+s}N1e(ym,o7t,q$e(SP,{brighter(e){return e=e==null?mne:Math.pow(mne,e),new ym(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=e==null?oI:Math.pow(oI,e),new ym(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,s=n+(n<.5?n:1-n)*t,a=2*n-s;return new Sh(Qde(e>=240?e-240:e+120,a,s),Qde(e,a,s),Qde(e<120?e+240:e-120,a,s),this.opacity)},clamp(){return new ym(r5e(this.h),PO(this.s),PO(this.l),gne(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 e=gne(this.opacity);return`${e===1?"hsl(":"hsla("}${r5e(this.h)}, ${PO(this.s)*100}%, ${PO(this.l)*100}%${e===1?")":`, ${e})`}`}}));function r5e(e){return e=(e||0)%360,e<0?e+360:e}function PO(e){return Math.max(0,Math.min(1,e||0))}function Qde(e,t,n){return(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)*255}const S1e=e=>()=>e;function l7t(e,t){return function(n){return e+n*t}}function c7t(e,t,n){return e=Math.pow(e,n),t=Math.pow(t,n)-e,n=1/n,function(s){return Math.pow(e+s*t,n)}}function d7t(e){return(e=+e)==1?H$e:function(t,n){return n-t?c7t(t,n,e):S1e(isNaN(t)?n:t)}}function H$e(e,t){var n=t-e;return n?l7t(e,n):S1e(isNaN(e)?t:e)}const n5e=function e(t){var n=d7t(t);function s(a,o){var l=n((a=eme(a)).r,(o=eme(o)).r),i=n(a.g,o.g),u=n(a.b,o.b),p=H$e(a.opacity,o.opacity);return function(x){return a.r=l(x),a.g=i(x),a.b=u(x),a.opacity=p(x),a+""}}return s.gamma=e,s}(1);function u7t(e,t){t||(t=[]);var n=e?Math.min(t.length,e.length):0,s=t.slice(),a;return function(o){for(a=0;an&&(o=t.slice(n,o),i[l]?i[l]+=o:i[++l]=o),(s=s[0])===(a=a[0])?i[l]?i[l]+=a:i[++l]=a:(i[++l]=null,u.push({i:l,x:xne(s,a)})),n=Jde.lastIndex;return nt&&(n=e,e=t,t=n),function(s){return Math.max(e,Math.min(t,s))}}function w7t(e,t,n){var s=e[0],a=e[1],o=t[0],l=t[1];return a2?j7t:w7t,u=p=null,y}function y(_){return _==null||isNaN(_=+_)?o:(u||(u=i(e.map(s),t,n)))(s(l(_)))}return y.invert=function(_){return l(a((p||(p=i(t,e.map(s),xne)))(_)))},y.domain=function(_){return arguments.length?(e=Array.from(_,yne),x()):e.slice()},y.range=function(_){return arguments.length?(t=Array.from(_),x()):t.slice()},y.rangeRound=function(_){return t=Array.from(_),n=C1e,x()},y.clamp=function(_){return arguments.length?(l=_?!0:Yu,x()):l!==Yu},y.interpolate=function(_){return arguments.length?(n=_,x()):n},y.unknown=function(_){return arguments.length?(o=_,y):o},function(_,b){return s=_,a=b,x()}}function M1e(){return hie()(Yu,Yu)}function k7t(e){return Math.abs(e=Math.round(e))>=1e21?e.toLocaleString("en").replace(/,/g,""):e.toString(10)}function vne(e,t){if((n=(e=t?e.toExponential(t-1):e.toExponential()).indexOf("e"))<0)return null;var n,s=e.slice(0,n);return[s.length>1?s[0]+s.slice(2):s,+e.slice(n+1)]}function GC(e){return e=vne(Math.abs(e)),e?e[1]:NaN}function N7t(e,t){return function(n,s){for(var a=n.length,o=[],l=0,i=e[0],u=0;a>0&&i>0&&(u+i+1>s&&(i=Math.max(1,s-u)),o.push(n.substring(a-=i,a+i)),!((u+=i+1)>s));)i=e[l=(l+1)%e.length];return o.reverse().join(t)}}function S7t(e){return function(t){return t.replace(/[0-9]/g,function(n){return e[+n]})}}var C7t=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function dI(e){if(!(t=C7t.exec(e)))throw new Error("invalid format: "+e);var t;return new T1e({fill:t[1],align:t[2],sign:t[3],symbol:t[4],zero:t[5],width:t[6],comma:t[7],precision:t[8]&&t[8].slice(1),trim:t[9],type:t[10]})}dI.prototype=T1e.prototype;function T1e(e){this.fill=e.fill===void 0?" ":e.fill+"",this.align=e.align===void 0?">":e.align+"",this.sign=e.sign===void 0?"-":e.sign+"",this.symbol=e.symbol===void 0?"":e.symbol+"",this.zero=!!e.zero,this.width=e.width===void 0?void 0:+e.width,this.comma=!!e.comma,this.precision=e.precision===void 0?void 0:+e.precision,this.trim=!!e.trim,this.type=e.type===void 0?"":e.type+""}T1e.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 M7t(e){e:for(var t=e.length,n=1,s=-1,a;n0&&(s=0);break}return s>0?e.slice(0,s)+e.slice(a+1):e}var W$e;function T7t(e,t){var n=vne(e,t);if(!n)return e+"";var s=n[0],a=n[1],o=a-(W$e=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")+vne(e,Math.max(0,t+o-1))[0]}function a5e(e,t){var n=vne(e,t);if(!n)return e+"";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 i5e={"%":(e,t)=>(e*100).toFixed(t),b:e=>Math.round(e).toString(2),c:e=>e+"",d:k7t,e:(e,t)=>e.toExponential(t),f:(e,t)=>e.toFixed(t),g:(e,t)=>e.toPrecision(t),o:e=>Math.round(e).toString(8),p:(e,t)=>a5e(e*100,t),r:a5e,s:T7t,X:e=>Math.round(e).toString(16).toUpperCase(),x:e=>Math.round(e).toString(16)};function o5e(e){return e}var l5e=Array.prototype.map,c5e=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function A7t(e){var t=e.grouping===void 0||e.thousands===void 0?o5e:N7t(l5e.call(e.grouping,Number),e.thousands+""),n=e.currency===void 0?"":e.currency[0]+"",s=e.currency===void 0?"":e.currency[1]+"",a=e.decimal===void 0?".":e.decimal+"",o=e.numerals===void 0?o5e:S7t(l5e.call(e.numerals,String)),l=e.percent===void 0?"%":e.percent+"",i=e.minus===void 0?"−":e.minus+"",u=e.nan===void 0?"NaN":e.nan+"";function p(y){y=dI(y);var _=y.fill,b=y.align,S=y.sign,k=y.symbol,M=y.zero,P=y.width,T=y.comma,I=y.precision,z=y.trim,D=y.type;D==="n"?(T=!0,D="g"):i5e[D]||(I===void 0&&(I=12),z=!0,D="g"),(M||_==="0"&&b==="=")&&(M=!0,_="0",b="=");var U=k==="$"?n:k==="#"&&/[boxX]/.test(D)?"0"+D.toLowerCase():"",V=k==="$"?s:/[%p]/.test(D)?l:"",W=i5e[D],G=/[defgprs%]/.test(D);I=I===void 0?6:/[gprs]/.test(D)?Math.max(1,Math.min(21,I)):Math.max(0,Math.min(20,I));function J(ne){var oe=U,ge=V,ie,pe,se;if(D==="c")ge=W(ne)+ge,ne="";else{ne=+ne;var fe=ne<0||1/ne<0;if(ne=isNaN(ne)?u:W(Math.abs(ne),I),z&&(ne=M7t(ne)),fe&&+ne==0&&S!=="+"&&(fe=!1),oe=(fe?S==="("?S:i:S==="-"||S==="("?"":S)+oe,ge=(D==="s"?c5e[8+W$e/3]:"")+ge+(fe&&S==="("?")":""),G){for(ie=-1,pe=ne.length;++iese||se>57){ge=(se===46?a+ne.slice(ie+1):ne.slice(ie))+ge,ne=ne.slice(0,ie);break}}}T&&!M&&(ne=t(ne,1/0));var he=oe.length+ne.length+ge.length,ye=he>1)+oe+ne+ge+ye.slice(he);break;default:ne=ye+oe+ne+ge;break}return o(ne)}return J.toString=function(){return y+""},J}function x(y,_){var b=p((y=dI(y),y.type="f",y)),S=Math.max(-8,Math.min(8,Math.floor(GC(_)/3)))*3,k=Math.pow(10,-S),M=c5e[8+S/3];return function(P){return b(k*P)+M}}return{format:p,formatPrefix:x}}var LO,A1e,G$e;E7t({thousands:",",grouping:[3],currency:["$",""]});function E7t(e){return LO=A7t(e),A1e=LO.format,G$e=LO.formatPrefix,LO}function I7t(e){return Math.max(0,-GC(Math.abs(e)))}function P7t(e,t){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(GC(t)/3)))*3-GC(Math.abs(e)))}function L7t(e,t){return e=Math.abs(e),t=Math.abs(t)-e,Math.max(0,GC(t)-GC(e))+1}function K$e(e,t,n,s){var a=Qpe(e,t,n),o;switch(s=dI(s??",f"),s.type){case"s":{var l=Math.max(Math.abs(e),Math.abs(t));return s.precision==null&&!isNaN(o=P7t(a,l))&&(s.precision=o),G$e(s,l)}case"":case"e":case"g":case"p":case"r":{s.precision==null&&!isNaN(o=L7t(a,Math.max(Math.abs(e),Math.abs(t))))&&(s.precision=o-(s.type==="e"));break}case"f":case"%":{s.precision==null&&!isNaN(o=I7t(a))&&(s.precision=o-(s.type==="%")*2);break}}return A1e(s)}function Iv(e){var t=e.domain;return e.ticks=function(n){var s=t();return Ype(s[0],s[s.length-1],n??10)},e.tickFormat=function(n,s){var a=t();return K$e(a[0],a[a.length-1],n??10,s)},e.nice=function(n){n==null&&(n=10);var s=t(),a=0,o=s.length-1,l=s[a],i=s[o],u,p,x=10;for(i0;){if(p=Xpe(l,i,n),p===u)return s[a]=l,s[o]=i,t(s);if(p>0)l=Math.floor(l/p)*p,i=Math.ceil(i/p)*p;else if(p<0)l=Math.ceil(l*p)/p,i=Math.floor(i*p)/p;else break;u=p}return e},e}function _ne(){var e=M1e();return e.copy=function(){return CP(e,_ne())},Np.apply(e,arguments),Iv(e)}function Z$e(e){var t;function n(s){return s==null||isNaN(s=+s)?t:s}return n.invert=n,n.domain=n.range=function(s){return arguments.length?(e=Array.from(s,yne),n):e.slice()},n.unknown=function(s){return arguments.length?(t=s,n):t},n.copy=function(){return Z$e(e).unknown(t)},e=arguments.length?Array.from(e,yne):[0,1],Iv(n)}function Y$e(e,t){e=e.slice();var n=0,s=e.length-1,a=e[n],o=e[s],l;return oMath.pow(e,t)}function z7t(e){return e===Math.E?Math.log:e===10&&Math.log10||e===2&&Math.log2||(e=Math.log(e),t=>Math.log(t)/e)}function h5e(e){return(t,n)=>-e(-t,n)}function E1e(e){const t=e(d5e,u5e),n=t.domain;let s=10,a,o;function l(){return a=z7t(s),o=F7t(s),n()[0]<0?(a=h5e(a),o=h5e(o),e(O7t,D7t)):e(d5e,u5e),t}return t.base=function(i){return arguments.length?(s=+i,l()):s},t.domain=function(i){return arguments.length?(n(i),l()):n()},t.ticks=i=>{const u=n();let p=u[0],x=u[u.length-1];const y=x0){for(;_<=b;++_)for(S=1;Sx)break;P.push(k)}}else for(;_<=b;++_)for(S=s-1;S>=1;--S)if(k=_>0?S/o(-_):S*o(_),!(kx)break;P.push(k)}P.length*2{if(i==null&&(i=10),u==null&&(u=s===10?"s":","),typeof u!="function"&&(!(s%1)&&(u=dI(u)).precision==null&&(u.trim=!0),u=A1e(u)),i===1/0)return u;const p=Math.max(1,s*i/t.ticks().length);return x=>{let y=x/o(Math.round(a(x)));return y*sn(Y$e(n(),{floor:i=>o(Math.floor(a(i))),ceil:i=>o(Math.ceil(a(i)))})),t}function X$e(){const e=E1e(hie()).domain([1,10]);return e.copy=()=>CP(e,X$e()).base(e.base()),Np.apply(e,arguments),e}function f5e(e){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/e))}}function p5e(e){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*e}}function I1e(e){var t=1,n=e(f5e(t),p5e(t));return n.constant=function(s){return arguments.length?e(f5e(t=+s),p5e(t)):t},Iv(n)}function Q$e(){var e=I1e(hie());return e.copy=function(){return CP(e,Q$e()).constant(e.constant())},Np.apply(e,arguments)}function m5e(e){return function(t){return t<0?-Math.pow(-t,e):Math.pow(t,e)}}function B7t(e){return e<0?-Math.sqrt(-e):Math.sqrt(e)}function $7t(e){return e<0?-e*e:e*e}function P1e(e){var t=e(Yu,Yu),n=1;function s(){return n===1?e(Yu,Yu):n===.5?e(B7t,$7t):e(m5e(n),m5e(1/n))}return t.exponent=function(a){return arguments.length?(n=+a,s()):n},Iv(t)}function L1e(){var e=P1e(hie());return e.copy=function(){return CP(e,L1e()).exponent(e.exponent())},Np.apply(e,arguments),e}function U7t(){return L1e.apply(null,arguments).exponent(.5)}function g5e(e){return Math.sign(e)*e*e}function q7t(e){return Math.sign(e)*Math.sqrt(Math.abs(e))}function J$e(){var e=M1e(),t=[0,1],n=!1,s;function a(o){var l=q7t(e(o));return isNaN(l)?s:n?Math.round(l):l}return a.invert=function(o){return e.invert(g5e(o))},a.domain=function(o){return arguments.length?(e.domain(o),a):e.domain()},a.range=function(o){return arguments.length?(e.range((t=Array.from(o,yne)).map(g5e)),a):t.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?(e.clamp(o),a):e.clamp()},a.unknown=function(o){return arguments.length?(s=o,a):s},a.copy=function(){return J$e(e.domain(),t).round(n).clamp(e.clamp()).unknown(s)},Np.apply(a,arguments),Iv(a)}function eUe(){var e=[],t=[],n=[],s;function a(){var l=0,i=Math.max(1,t.length);for(n=new Array(i-1);++l0?n[i-1]:e[0],i=n?[s[n-1],t]:[s[p-1],s[p]]},l.unknown=function(u){return arguments.length&&(o=u),l},l.thresholds=function(){return s.slice()},l.copy=function(){return tUe().domain([e,t]).range(a).unknown(o)},Np.apply(Iv(l),arguments)}function rUe(){var e=[.5],t=[0,1],n,s=1;function a(o){return o!=null&&o<=o?t[NP(e,o,0,s)]:n}return a.domain=function(o){return arguments.length?(e=Array.from(o),s=Math.min(e.length,t.length-1),a):e.slice()},a.range=function(o){return arguments.length?(t=Array.from(o),s=Math.min(e.length,t.length-1),a):t.slice()},a.invertExtent=function(o){var l=t.indexOf(o);return[e[l-1],e[l]]},a.unknown=function(o){return arguments.length?(n=o,a):n},a.copy=function(){return rUe().domain(e).range(t).unknown(n)},Np.apply(a,arguments)}const eue=new Date,tue=new Date;function xd(e,t,n,s){function a(o){return e(o=arguments.length===0?new Date:new Date(+o)),o}return a.floor=o=>(e(o=new Date(+o)),o),a.ceil=o=>(e(o=new Date(o-1)),t(o,1),e(o),o),a.round=o=>{const l=a(o),i=a.ceil(o);return o-l(t(o=new Date(+o),l==null?1:Math.floor(l)),o),a.range=(o,l,i)=>{const u=[];if(o=a.ceil(o),i=i==null?1:Math.floor(i),!(o0))return u;let p;do u.push(p=new Date(+o)),t(o,i),e(o);while(pxd(l=>{if(l>=l)for(;e(l),!o(l);)l.setTime(l-1)},(l,i)=>{if(l>=l)if(i<0)for(;++i<=0;)for(;t(l,-1),!o(l););else for(;--i>=0;)for(;t(l,1),!o(l););}),n&&(a.count=(o,l)=>(eue.setTime(+o),tue.setTime(+l),e(eue),e(tue),Math.floor(n(eue,tue))),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 bne=xd(()=>{},(e,t)=>{e.setTime(+e+t)},(e,t)=>t-e);bne.every=e=>(e=Math.floor(e),!isFinite(e)||!(e>0)?null:e>1?xd(t=>{t.setTime(Math.floor(t/e)*e)},(t,n)=>{t.setTime(+t+n*e)},(t,n)=>(n-t)/e):bne);bne.range;const ty=1e3,op=ty*60,ry=op*60,Ry=ry*24,O1e=Ry*7,x5e=Ry*30,rue=Ry*365,hj=xd(e=>{e.setTime(e-e.getMilliseconds())},(e,t)=>{e.setTime(+e+t*ty)},(e,t)=>(t-e)/ty,e=>e.getUTCSeconds());hj.range;const D1e=xd(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*ty)},(e,t)=>{e.setTime(+e+t*op)},(e,t)=>(t-e)/op,e=>e.getMinutes());D1e.range;const R1e=xd(e=>{e.setUTCSeconds(0,0)},(e,t)=>{e.setTime(+e+t*op)},(e,t)=>(t-e)/op,e=>e.getUTCMinutes());R1e.range;const F1e=xd(e=>{e.setTime(e-e.getMilliseconds()-e.getSeconds()*ty-e.getMinutes()*op)},(e,t)=>{e.setTime(+e+t*ry)},(e,t)=>(t-e)/ry,e=>e.getHours());F1e.range;const z1e=xd(e=>{e.setUTCMinutes(0,0,0)},(e,t)=>{e.setTime(+e+t*ry)},(e,t)=>(t-e)/ry,e=>e.getUTCHours());z1e.range;const MP=xd(e=>e.setHours(0,0,0,0),(e,t)=>e.setDate(e.getDate()+t),(e,t)=>(t-e-(t.getTimezoneOffset()-e.getTimezoneOffset())*op)/Ry,e=>e.getDate()-1);MP.range;const fie=xd(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/Ry,e=>e.getUTCDate()-1);fie.range;const nUe=xd(e=>{e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCDate(e.getUTCDate()+t)},(e,t)=>(t-e)/Ry,e=>Math.floor(e/Ry));nUe.range;function Ek(e){return xd(t=>{t.setDate(t.getDate()-(t.getDay()+7-e)%7),t.setHours(0,0,0,0)},(t,n)=>{t.setDate(t.getDate()+n*7)},(t,n)=>(n-t-(n.getTimezoneOffset()-t.getTimezoneOffset())*op)/O1e)}const pie=Ek(0),wne=Ek(1),V7t=Ek(2),H7t=Ek(3),KC=Ek(4),W7t=Ek(5),G7t=Ek(6);pie.range;wne.range;V7t.range;H7t.range;KC.range;W7t.range;G7t.range;function Ik(e){return xd(t=>{t.setUTCDate(t.getUTCDate()-(t.getUTCDay()+7-e)%7),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCDate(t.getUTCDate()+n*7)},(t,n)=>(n-t)/O1e)}const mie=Ik(0),jne=Ik(1),K7t=Ik(2),Z7t=Ik(3),ZC=Ik(4),Y7t=Ik(5),X7t=Ik(6);mie.range;jne.range;K7t.range;Z7t.range;ZC.range;Y7t.range;X7t.range;const B1e=xd(e=>{e.setDate(1),e.setHours(0,0,0,0)},(e,t)=>{e.setMonth(e.getMonth()+t)},(e,t)=>t.getMonth()-e.getMonth()+(t.getFullYear()-e.getFullYear())*12,e=>e.getMonth());B1e.range;const $1e=xd(e=>{e.setUTCDate(1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCMonth(e.getUTCMonth()+t)},(e,t)=>t.getUTCMonth()-e.getUTCMonth()+(t.getUTCFullYear()-e.getUTCFullYear())*12,e=>e.getUTCMonth());$1e.range;const Fy=xd(e=>{e.setMonth(0,1),e.setHours(0,0,0,0)},(e,t)=>{e.setFullYear(e.getFullYear()+t)},(e,t)=>t.getFullYear()-e.getFullYear(),e=>e.getFullYear());Fy.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:xd(t=>{t.setFullYear(Math.floor(t.getFullYear()/e)*e),t.setMonth(0,1),t.setHours(0,0,0,0)},(t,n)=>{t.setFullYear(t.getFullYear()+n*e)});Fy.range;const zy=xd(e=>{e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,t)=>{e.setUTCFullYear(e.getUTCFullYear()+t)},(e,t)=>t.getUTCFullYear()-e.getUTCFullYear(),e=>e.getUTCFullYear());zy.every=e=>!isFinite(e=Math.floor(e))||!(e>0)?null:xd(t=>{t.setUTCFullYear(Math.floor(t.getUTCFullYear()/e)*e),t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,n)=>{t.setUTCFullYear(t.getUTCFullYear()+n*e)});zy.range;function sUe(e,t,n,s,a,o){const l=[[hj,1,ty],[hj,5,5*ty],[hj,15,15*ty],[hj,30,30*ty],[o,1,op],[o,5,5*op],[o,15,15*op],[o,30,30*op],[a,1,ry],[a,3,3*ry],[a,6,6*ry],[a,12,12*ry],[s,1,Ry],[s,2,2*Ry],[n,1,O1e],[t,1,x5e],[t,3,3*x5e],[e,1,rue]];function i(p,x,y){const _=xM).right(l,_);if(b===l.length)return e.every(Qpe(p/rue,x/rue,y));if(b===0)return bne.every(Math.max(Qpe(p,x,y),1));const[S,k]=l[_/l[b-1][2]53)return null;"w"in Oe||(Oe.w=1),"Z"in Oe?(le=sue(yT(Oe.y,0,1)),Ve=le.getUTCDay(),le=Ve>4||Ve===0?jne.ceil(le):jne(le),le=fie.offset(le,(Oe.V-1)*7),Oe.y=le.getUTCFullYear(),Oe.m=le.getUTCMonth(),Oe.d=le.getUTCDate()+(Oe.w+6)%7):(le=nue(yT(Oe.y,0,1)),Ve=le.getDay(),le=Ve>4||Ve===0?wne.ceil(le):wne(le),le=MP.offset(le,(Oe.V-1)*7),Oe.y=le.getFullYear(),Oe.m=le.getMonth(),Oe.d=le.getDate()+(Oe.w+6)%7)}else("W"in Oe||"U"in Oe)&&("w"in Oe||(Oe.w="u"in Oe?Oe.u%7:"W"in Oe?1:0),Ve="Z"in Oe?sue(yT(Oe.y,0,1)).getUTCDay():nue(yT(Oe.y,0,1)).getDay(),Oe.m=0,Oe.d="W"in Oe?(Oe.w+6)%7+Oe.W*7-(Ve+5)%7:Oe.w+Oe.U*7-(Ve+6)%7);return"Z"in Oe?(Oe.H+=Oe.Z/100|0,Oe.M+=Oe.Z%100,sue(Oe)):nue(Oe)}}function W(qe,ot,Mt,Oe){for(var at=0,le=ot.length,Ve=Mt.length,Qe,st;at=Ve)return-1;if(Qe=ot.charCodeAt(at++),Qe===37){if(Qe=ot.charAt(at++),st=D[Qe in y5e?ot.charAt(at++):Qe],!st||(Oe=st(qe,Mt,Oe))<0)return-1}else if(Qe!=Mt.charCodeAt(Oe++))return-1}return Oe}function G(qe,ot,Mt){var Oe=p.exec(ot.slice(Mt));return Oe?(qe.p=x.get(Oe[0].toLowerCase()),Mt+Oe[0].length):-1}function J(qe,ot,Mt){var Oe=b.exec(ot.slice(Mt));return Oe?(qe.w=S.get(Oe[0].toLowerCase()),Mt+Oe[0].length):-1}function ne(qe,ot,Mt){var Oe=y.exec(ot.slice(Mt));return Oe?(qe.w=_.get(Oe[0].toLowerCase()),Mt+Oe[0].length):-1}function oe(qe,ot,Mt){var Oe=P.exec(ot.slice(Mt));return Oe?(qe.m=T.get(Oe[0].toLowerCase()),Mt+Oe[0].length):-1}function ge(qe,ot,Mt){var Oe=k.exec(ot.slice(Mt));return Oe?(qe.m=M.get(Oe[0].toLowerCase()),Mt+Oe[0].length):-1}function ie(qe,ot,Mt){return W(qe,t,ot,Mt)}function pe(qe,ot,Mt){return W(qe,n,ot,Mt)}function se(qe,ot,Mt){return W(qe,s,ot,Mt)}function fe(qe){return l[qe.getDay()]}function he(qe){return o[qe.getDay()]}function ye(qe){return u[qe.getMonth()]}function Ae(qe){return i[qe.getMonth()]}function we(qe){return a[+(qe.getHours()>=12)]}function be(qe){return 1+~~(qe.getMonth()/3)}function _e(qe){return l[qe.getUTCDay()]}function Je(qe){return o[qe.getUTCDay()]}function Te(qe){return u[qe.getUTCMonth()]}function De(qe){return i[qe.getUTCMonth()]}function Ue(qe){return a[+(qe.getUTCHours()>=12)]}function Be(qe){return 1+~~(qe.getUTCMonth()/3)}return{format:function(qe){var ot=U(qe+="",I);return ot.toString=function(){return qe},ot},parse:function(qe){var ot=V(qe+="",!1);return ot.toString=function(){return qe},ot},utcFormat:function(qe){var ot=U(qe+="",z);return ot.toString=function(){return qe},ot},utcParse:function(qe){var ot=V(qe+="",!0);return ot.toString=function(){return qe},ot}}}var y5e={"-":"",_:" ",0:"0"},qd=/^\s*\d+/,n9t=/^%/,s9t=/[\\^$*+?|[\]().{}]/g;function mo(e,t,n){var s=e<0?"-":"",a=(s?-e:e)+"",o=a.length;return s+(o[t.toLowerCase(),n]))}function i9t(e,t,n){var s=qd.exec(t.slice(n,n+1));return s?(e.w=+s[0],n+s[0].length):-1}function o9t(e,t,n){var s=qd.exec(t.slice(n,n+1));return s?(e.u=+s[0],n+s[0].length):-1}function l9t(e,t,n){var s=qd.exec(t.slice(n,n+2));return s?(e.U=+s[0],n+s[0].length):-1}function c9t(e,t,n){var s=qd.exec(t.slice(n,n+2));return s?(e.V=+s[0],n+s[0].length):-1}function d9t(e,t,n){var s=qd.exec(t.slice(n,n+2));return s?(e.W=+s[0],n+s[0].length):-1}function v5e(e,t,n){var s=qd.exec(t.slice(n,n+4));return s?(e.y=+s[0],n+s[0].length):-1}function _5e(e,t,n){var s=qd.exec(t.slice(n,n+2));return s?(e.y=+s[0]+(+s[0]>68?1900:2e3),n+s[0].length):-1}function u9t(e,t,n){var s=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(t.slice(n,n+6));return s?(e.Z=s[1]?0:-(s[2]+(s[3]||"00")),n+s[0].length):-1}function h9t(e,t,n){var s=qd.exec(t.slice(n,n+1));return s?(e.q=s[0]*3-3,n+s[0].length):-1}function f9t(e,t,n){var s=qd.exec(t.slice(n,n+2));return s?(e.m=s[0]-1,n+s[0].length):-1}function b5e(e,t,n){var s=qd.exec(t.slice(n,n+2));return s?(e.d=+s[0],n+s[0].length):-1}function p9t(e,t,n){var s=qd.exec(t.slice(n,n+3));return s?(e.m=0,e.d=+s[0],n+s[0].length):-1}function w5e(e,t,n){var s=qd.exec(t.slice(n,n+2));return s?(e.H=+s[0],n+s[0].length):-1}function m9t(e,t,n){var s=qd.exec(t.slice(n,n+2));return s?(e.M=+s[0],n+s[0].length):-1}function g9t(e,t,n){var s=qd.exec(t.slice(n,n+2));return s?(e.S=+s[0],n+s[0].length):-1}function x9t(e,t,n){var s=qd.exec(t.slice(n,n+3));return s?(e.L=+s[0],n+s[0].length):-1}function y9t(e,t,n){var s=qd.exec(t.slice(n,n+6));return s?(e.L=Math.floor(s[0]/1e3),n+s[0].length):-1}function v9t(e,t,n){var s=n9t.exec(t.slice(n,n+1));return s?n+s[0].length:-1}function _9t(e,t,n){var s=qd.exec(t.slice(n));return s?(e.Q=+s[0],n+s[0].length):-1}function b9t(e,t,n){var s=qd.exec(t.slice(n));return s?(e.s=+s[0],n+s[0].length):-1}function j5e(e,t){return mo(e.getDate(),t,2)}function w9t(e,t){return mo(e.getHours(),t,2)}function j9t(e,t){return mo(e.getHours()%12||12,t,2)}function k9t(e,t){return mo(1+MP.count(Fy(e),e),t,3)}function aUe(e,t){return mo(e.getMilliseconds(),t,3)}function N9t(e,t){return aUe(e,t)+"000"}function S9t(e,t){return mo(e.getMonth()+1,t,2)}function C9t(e,t){return mo(e.getMinutes(),t,2)}function M9t(e,t){return mo(e.getSeconds(),t,2)}function T9t(e){var t=e.getDay();return t===0?7:t}function A9t(e,t){return mo(pie.count(Fy(e)-1,e),t,2)}function iUe(e){var t=e.getDay();return t>=4||t===0?KC(e):KC.ceil(e)}function E9t(e,t){return e=iUe(e),mo(KC.count(Fy(e),e)+(Fy(e).getDay()===4),t,2)}function I9t(e){return e.getDay()}function P9t(e,t){return mo(wne.count(Fy(e)-1,e),t,2)}function L9t(e,t){return mo(e.getFullYear()%100,t,2)}function O9t(e,t){return e=iUe(e),mo(e.getFullYear()%100,t,2)}function D9t(e,t){return mo(e.getFullYear()%1e4,t,4)}function R9t(e,t){var n=e.getDay();return e=n>=4||n===0?KC(e):KC.ceil(e),mo(e.getFullYear()%1e4,t,4)}function F9t(e){var t=e.getTimezoneOffset();return(t>0?"-":(t*=-1,"+"))+mo(t/60|0,"0",2)+mo(t%60,"0",2)}function k5e(e,t){return mo(e.getUTCDate(),t,2)}function z9t(e,t){return mo(e.getUTCHours(),t,2)}function B9t(e,t){return mo(e.getUTCHours()%12||12,t,2)}function $9t(e,t){return mo(1+fie.count(zy(e),e),t,3)}function oUe(e,t){return mo(e.getUTCMilliseconds(),t,3)}function U9t(e,t){return oUe(e,t)+"000"}function q9t(e,t){return mo(e.getUTCMonth()+1,t,2)}function V9t(e,t){return mo(e.getUTCMinutes(),t,2)}function H9t(e,t){return mo(e.getUTCSeconds(),t,2)}function W9t(e){var t=e.getUTCDay();return t===0?7:t}function G9t(e,t){return mo(mie.count(zy(e)-1,e),t,2)}function lUe(e){var t=e.getUTCDay();return t>=4||t===0?ZC(e):ZC.ceil(e)}function K9t(e,t){return e=lUe(e),mo(ZC.count(zy(e),e)+(zy(e).getUTCDay()===4),t,2)}function Z9t(e){return e.getUTCDay()}function Y9t(e,t){return mo(jne.count(zy(e)-1,e),t,2)}function X9t(e,t){return mo(e.getUTCFullYear()%100,t,2)}function Q9t(e,t){return e=lUe(e),mo(e.getUTCFullYear()%100,t,2)}function J9t(e,t){return mo(e.getUTCFullYear()%1e4,t,4)}function eBt(e,t){var n=e.getUTCDay();return e=n>=4||n===0?ZC(e):ZC.ceil(e),mo(e.getUTCFullYear()%1e4,t,4)}function tBt(){return"+0000"}function N5e(){return"%"}function S5e(e){return+e}function C5e(e){return Math.floor(+e/1e3)}var L4,cUe,dUe;rBt({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 rBt(e){return L4=r9t(e),cUe=L4.format,L4.parse,dUe=L4.utcFormat,L4.utcParse,L4}function nBt(e){return new Date(e)}function sBt(e){return e instanceof Date?+e:+new Date(+e)}function U1e(e,t,n,s,a,o,l,i,u,p){var x=M1e(),y=x.invert,_=x.domain,b=p(".%L"),S=p(":%S"),k=p("%I:%M"),M=p("%I %p"),P=p("%a %d"),T=p("%b %d"),I=p("%B"),z=p("%Y");function D(U){return(u(U)t(a/(e.length-1)))},n.quantiles=function(s){return Array.from({length:s+1},(a,o)=>Gzt(e,o/s))},n.copy=function(){return pUe(t).domain(e)},Hy.apply(n,arguments)}function xie(){var e=0,t=.5,n=1,s=1,a,o,l,i,u,p=Yu,x,y=!1,_;function b(k){return isNaN(k=+k)?_:(k=.5+((k=+x(k))-o)*(s*kt}var yUe=uBt,hBt=yie,fBt=yUe,pBt=G3;function mBt(e){return e&&e.length?hBt(e,pBt,fBt):void 0}var gBt=mBt;const vie=Qi(gBt);function xBt(e,t){return ee.e^o.s<0?1:-1;for(s=o.d.length,a=e.d.length,t=0,n=se.d[t]^o.s<0?1:-1;return s===a?0:s>a^o.s<0?1:-1};ks.decimalPlaces=ks.dp=function(){var e=this,t=e.d.length-1,n=(t-e.e)*xl;if(t=e.d[t],t)for(;t%10==0;t/=10)n--;return n<0?0:n};ks.dividedBy=ks.div=function(e){return _y(this,new this.constructor(e))};ks.dividedToIntegerBy=ks.idiv=function(e){var t=this,n=t.constructor;return Go(_y(t,new n(e),0,1),n.precision)};ks.equals=ks.eq=function(e){return!this.cmp(e)};ks.exponent=function(){return Wc(this)};ks.greaterThan=ks.gt=function(e){return this.cmp(e)>0};ks.greaterThanOrEqualTo=ks.gte=function(e){return this.cmp(e)>=0};ks.isInteger=ks.isint=function(){return this.e>this.d.length-2};ks.isNegative=ks.isneg=function(){return this.s<0};ks.isPositive=ks.ispos=function(){return this.s>0};ks.isZero=function(){return this.s===0};ks.lessThan=ks.lt=function(e){return this.cmp(e)<0};ks.lessThanOrEqualTo=ks.lte=function(e){return this.cmp(e)<1};ks.logarithm=ks.log=function(e){var t,n=this,s=n.constructor,a=s.precision,o=a+5;if(e===void 0)e=new s(10);else if(e=new s(e),e.s<1||e.eq(cf))throw Error(_p+"NaN");if(n.s<1)throw Error(_p+(n.s?"NaN":"-Infinity"));return n.eq(cf)?new s(0):(Tl=!1,t=_y(uI(n,o),uI(e,o),o),Tl=!0,Go(t,a))};ks.minus=ks.sub=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?jUe(t,e):bUe(t,(e.s=-e.s,e))};ks.modulo=ks.mod=function(e){var t,n=this,s=n.constructor,a=s.precision;if(e=new s(e),!e.s)throw Error(_p+"NaN");return n.s?(Tl=!1,t=_y(n,e,0,1).times(e),Tl=!0,n.minus(t)):Go(new s(n),a)};ks.naturalExponential=ks.exp=function(){return wUe(this)};ks.naturalLogarithm=ks.ln=function(){return uI(this)};ks.negated=ks.neg=function(){var e=new this.constructor(this);return e.s=-e.s||0,e};ks.plus=ks.add=function(e){var t=this;return e=new t.constructor(e),t.s==e.s?bUe(t,e):jUe(t,(e.s=-e.s,e))};ks.precision=ks.sd=function(e){var t,n,s,a=this;if(e!==void 0&&e!==!!e&&e!==1&&e!==0)throw Error(Zj+e);if(t=Wc(a)+1,s=a.d.length-1,n=s*xl+1,s=a.d[s],s){for(;s%10==0;s/=10)n--;for(s=a.d[0];s>=10;s/=10)n++}return e&&t>n?t:n};ks.squareRoot=ks.sqrt=function(){var e,t,n,s,a,o,l,i=this,u=i.constructor;if(i.s<1){if(!i.s)return new u(0);throw Error(_p+"NaN")}for(e=Wc(i),Tl=!1,a=Math.sqrt(+i),a==0||a==1/0?(t=Tg(i.d),(t.length+e)%2==0&&(t+="0"),a=Math.sqrt(t),e=X3((e+1)/2)-(e<0||e%2),a==1/0?t="5e"+e:(t=a.toExponential(),t=t.slice(0,t.indexOf("e")+1)+e),s=new u(t)):s=new u(a.toString()),n=u.precision,a=l=n+3;;)if(o=s,s=o.plus(_y(i,o,l+2)).times(.5),Tg(o.d).slice(0,l)===(t=Tg(s.d)).slice(0,l)){if(t=t.slice(l-3,l+1),a==l&&t=="4999"){if(Go(o,n+1,0),o.times(o).eq(i)){s=o;break}}else if(t!="9999")break;l+=4}return Tl=!0,Go(s,n)};ks.times=ks.mul=function(e){var t,n,s,a,o,l,i,u,p,x=this,y=x.constructor,_=x.d,b=(e=new y(e)).d;if(!x.s||!e.s)return new y(0);for(e.s*=x.s,n=x.e+e.e,u=_.length,p=b.length,u=0;){for(t=0,a=u+s;a>s;)i=o[a]+b[s]*_[a-s-1]+t,o[a--]=i%Cd|0,t=i/Cd|0;o[a]=(o[a]+t)%Cd|0}for(;!o[--l];)o.pop();return t?++n:o.shift(),e.d=o,e.e=n,Tl?Go(e,y.precision):e};ks.toDecimalPlaces=ks.todp=function(e,t){var n=this,s=n.constructor;return n=new s(n),e===void 0?n:(Jg(e,0,Y3),t===void 0?t=s.rounding:Jg(t,0,8),Go(n,e+Wc(n)+1,t))};ks.toExponential=function(e,t){var n,s=this,a=s.constructor;return e===void 0?n=vk(s,!0):(Jg(e,0,Y3),t===void 0?t=a.rounding:Jg(t,0,8),s=Go(new a(s),e+1,t),n=vk(s,!0,e+1)),n};ks.toFixed=function(e,t){var n,s,a=this,o=a.constructor;return e===void 0?vk(a):(Jg(e,0,Y3),t===void 0?t=o.rounding:Jg(t,0,8),s=Go(new o(a),e+Wc(a)+1,t),n=vk(s.abs(),!1,e+Wc(s)+1),a.isneg()&&!a.isZero()?"-"+n:n)};ks.toInteger=ks.toint=function(){var e=this,t=e.constructor;return Go(new t(e),Wc(e)+1,t.rounding)};ks.toNumber=function(){return+this};ks.toPower=ks.pow=function(e){var t,n,s,a,o,l,i=this,u=i.constructor,p=12,x=+(e=new u(e));if(!e.s)return new u(cf);if(i=new u(i),!i.s){if(e.s<1)throw Error(_p+"Infinity");return i}if(i.eq(cf))return i;if(s=u.precision,e.eq(cf))return Go(i,s);if(t=e.e,n=e.d.length-1,l=t>=n,o=i.s,l){if((n=x<0?-x:x)<=_Ue){for(a=new u(cf),t=Math.ceil(s/xl+4),Tl=!1;n%2&&(a=a.times(i),A5e(a.d,t)),n=X3(n/2),n!==0;)i=i.times(i),A5e(i.d,t);return Tl=!0,e.s<0?new u(cf).div(a):Go(a,s)}}else if(o<0)throw Error(_p+"NaN");return o=o<0&&e.d[Math.max(t,n)]&1?-1:1,i.s=1,Tl=!1,a=e.times(uI(i,s+p)),Tl=!0,a=wUe(a),a.s=o,a};ks.toPrecision=function(e,t){var n,s,a=this,o=a.constructor;return e===void 0?(n=Wc(a),s=vk(a,n<=o.toExpNeg||n>=o.toExpPos)):(Jg(e,1,Y3),t===void 0?t=o.rounding:Jg(t,0,8),a=Go(new o(a),e,t),n=Wc(a),s=vk(a,e<=n||n<=o.toExpNeg,e)),s};ks.toSignificantDigits=ks.tosd=function(e,t){var n=this,s=n.constructor;return e===void 0?(e=s.precision,t=s.rounding):(Jg(e,1,Y3),t===void 0?t=s.rounding:Jg(t,0,8)),Go(new s(n),e,t)};ks.toString=ks.valueOf=ks.val=ks.toJSON=ks[Symbol.for("nodejs.util.inspect.custom")]=function(){var e=this,t=Wc(e),n=e.constructor;return vk(e,t<=n.toExpNeg||t>=n.toExpPos)};function bUe(e,t){var n,s,a,o,l,i,u,p,x=e.constructor,y=x.precision;if(!e.s||!t.s)return t.s||(t=new x(e)),Tl?Go(t,y):t;if(u=e.d,p=t.d,l=e.e,a=t.e,u=u.slice(),o=l-a,o){for(o<0?(s=u,o=-o,i=p.length):(s=p,a=l,i=u.length),l=Math.ceil(y/xl),i=l>i?l+1:i+1,o>i&&(o=i,s.length=1),s.reverse();o--;)s.push(0);s.reverse()}for(i=u.length,o=p.length,i-o<0&&(o=i,s=p,p=u,u=s),n=0;o;)n=(u[--o]=u[o]+p[o]+n)/Cd|0,u[o]%=Cd;for(n&&(u.unshift(n),++a),i=u.length;u[--i]==0;)u.pop();return t.d=u,t.e=a,Tl?Go(t,y):t}function Jg(e,t,n){if(e!==~~e||en)throw Error(Zj+e)}function Tg(e){var t,n,s,a=e.length-1,o="",l=e[0];if(a>0){for(o+=l,t=1;tl?1:-1;else for(i=u=0;ia[i]?1:-1;break}return u}function n(s,a,o){for(var l=0;o--;)s[o]-=l,l=s[o]1;)s.shift()}return function(s,a,o,l){var i,u,p,x,y,_,b,S,k,M,P,T,I,z,D,U,V,W,G=s.constructor,J=s.s==a.s?1:-1,ne=s.d,oe=a.d;if(!s.s)return new G(s);if(!a.s)throw Error(_p+"Division by zero");for(u=s.e-a.e,V=oe.length,D=ne.length,b=new G(J),S=b.d=[],p=0;oe[p]==(ne[p]||0);)++p;if(oe[p]>(ne[p]||0)&&--u,o==null?T=o=G.precision:l?T=o+(Wc(s)-Wc(a))+1:T=o,T<0)return new G(0);if(T=T/xl+2|0,p=0,V==1)for(x=0,oe=oe[0],T++;(p1&&(oe=e(oe,x),ne=e(ne,x),V=oe.length,D=ne.length),z=V,k=ne.slice(0,V),M=k.length;M=Cd/2&&++U;do x=0,i=t(oe,k,V,M),i<0?(P=k[0],V!=M&&(P=P*Cd+(k[1]||0)),x=P/U|0,x>1?(x>=Cd&&(x=Cd-1),y=e(oe,x),_=y.length,M=k.length,i=t(y,k,_,M),i==1&&(x--,n(y,V<_?W:oe,_))):(x==0&&(i=x=1),y=oe.slice()),_=y.length,_16)throw Error(H1e+Wc(e));if(!e.s)return new x(cf);for(Tl=!1,i=y,l=new x(.03125);e.abs().gte(.1);)e=e.times(l),p+=5;for(s=Math.log(Kw(2,p))/Math.LN10*2+5|0,i+=s,n=a=o=new x(cf),x.precision=i;;){if(a=Go(a.times(e),i),n=n.times(++u),l=o.plus(_y(a,n,i)),Tg(l.d).slice(0,i)===Tg(o.d).slice(0,i)){for(;p--;)o=Go(o.times(o),i);return x.precision=y,t==null?(Tl=!0,Go(o,y)):o}o=l}}function Wc(e){for(var t=e.e*xl,n=e.d[0];n>=10;n/=10)t++;return t}function aue(e,t,n){if(t>e.LN10.sd())throw Tl=!0,n&&(e.precision=n),Error(_p+"LN10 precision limit exceeded");return Go(new e(e.LN10),t)}function n1(e){for(var t="";e--;)t+="0";return t}function uI(e,t){var n,s,a,o,l,i,u,p,x,y=1,_=10,b=e,S=b.d,k=b.constructor,M=k.precision;if(b.s<1)throw Error(_p+(b.s?"NaN":"-Infinity"));if(b.eq(cf))return new k(0);if(t==null?(Tl=!1,p=M):p=t,b.eq(10))return t==null&&(Tl=!0),aue(k,p);if(p+=_,k.precision=p,n=Tg(S),s=n.charAt(0),o=Wc(b),Math.abs(o)<15e14){for(;s<7&&s!=1||s==1&&n.charAt(1)>3;)b=b.times(e),n=Tg(b.d),s=n.charAt(0),y++;o=Wc(b),s>1?(b=new k("0."+n),o++):b=new k(s+"."+n.slice(1))}else return u=aue(k,p+2,M).times(o+""),b=uI(new k(s+"."+n.slice(1)),p-_).plus(u),k.precision=M,t==null?(Tl=!0,Go(b,M)):b;for(i=l=b=_y(b.minus(cf),b.plus(cf),p),x=Go(b.times(b),p),a=3;;){if(l=Go(l.times(x),p),u=i.plus(_y(l,new k(a),p)),Tg(u.d).slice(0,p)===Tg(i.d).slice(0,p))return i=i.times(2),o!==0&&(i=i.plus(aue(k,p+2,M).times(o+""))),i=_y(i,new k(y),p),k.precision=M,t==null?(Tl=!0,Go(i,M)):i;i=u,a+=2}}function T5e(e,t){var n,s,a;for((n=t.indexOf("."))>-1&&(t=t.replace(".","")),(s=t.search(/e/i))>0?(n<0&&(n=s),n+=+t.slice(s+1),t=t.substring(0,s)):n<0&&(n=t.length),s=0;t.charCodeAt(s)===48;)++s;for(a=t.length;t.charCodeAt(a-1)===48;)--a;if(t=t.slice(s,a),t){if(a-=s,n=n-s-1,e.e=X3(n/xl),e.d=[],s=(n+1)%xl,n<0&&(s+=xl),skne||e.e<-kne))throw Error(H1e+n)}else e.s=0,e.e=0,e.d=[0];return e}function Go(e,t,n){var s,a,o,l,i,u,p,x,y=e.d;for(l=1,o=y[0];o>=10;o/=10)l++;if(s=t-l,s<0)s+=xl,a=t,p=y[x=0];else{if(x=Math.ceil((s+1)/xl),o=y.length,x>=o)return e;for(p=o=y[x],l=1;o>=10;o/=10)l++;s%=xl,a=s-xl+l}if(n!==void 0&&(o=Kw(10,l-a-1),i=p/o%10|0,u=t<0||y[x+1]!==void 0||p%o,u=n<4?(i||u)&&(n==0||n==(e.s<0?3:2)):i>5||i==5&&(n==4||u||n==6&&(s>0?a>0?p/Kw(10,l-a):0:y[x-1])%10&1||n==(e.s<0?8:7))),t<1||!y[0])return u?(o=Wc(e),y.length=1,t=t-o-1,y[0]=Kw(10,(xl-t%xl)%xl),e.e=X3(-t/xl)||0):(y.length=1,y[0]=e.e=e.s=0),e;if(s==0?(y.length=x,o=1,x--):(y.length=x+1,o=Kw(10,xl-s),y[x]=a>0?(p/Kw(10,l-a)%Kw(10,a)|0)*o:0),u)for(;;)if(x==0){(y[0]+=o)==Cd&&(y[0]=1,++e.e);break}else{if(y[x]+=o,y[x]!=Cd)break;y[x--]=0,o=1}for(s=y.length;y[--s]===0;)y.pop();if(Tl&&(e.e>kne||e.e<-kne))throw Error(H1e+Wc(e));return e}function jUe(e,t){var n,s,a,o,l,i,u,p,x,y,_=e.constructor,b=_.precision;if(!e.s||!t.s)return t.s?t.s=-t.s:t=new _(e),Tl?Go(t,b):t;if(u=e.d,y=t.d,s=t.e,p=e.e,u=u.slice(),l=p-s,l){for(x=l<0,x?(n=u,l=-l,i=y.length):(n=y,s=p,i=u.length),a=Math.max(Math.ceil(b/xl),i)+2,l>a&&(l=a,n.length=1),n.reverse(),a=l;a--;)n.push(0);n.reverse()}else{for(a=u.length,i=y.length,x=a0;--a)u[i++]=0;for(a=y.length;a>l;){if(u[--a]0?o=o.charAt(0)+"."+o.slice(1)+n1(s):l>1&&(o=o.charAt(0)+"."+o.slice(1)),o=o+(a<0?"e":"e+")+a):a<0?(o="0."+n1(-a-1)+o,n&&(s=n-l)>0&&(o+=n1(s))):a>=l?(o+=n1(a+1-l),n&&(s=n-a-1)>0&&(o=o+"."+n1(s))):((s=a+1)0&&(a+1===l&&(o+="."),o+=n1(s))),e.s<0?"-"+o:o}function A5e(e,t){if(e.length>t)return e.length=t,!0}function kUe(e){var t,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(Zj+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 T5e(l,o.toString())}else if(typeof o!="string")throw Error(Zj+o);if(o.charCodeAt(0)===45?(o=o.slice(1),l.s=-1):l.s=1,FBt.test(o))T5e(l,o);else throw Error(Zj+o)}if(a.prototype=ks,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=kUe,a.config=a.set=zBt,e===void 0&&(e={}),e)for(s=["precision","rounding","toExpNeg","toExpPos","LN10"],t=0;t=a[t+1]&&s<=a[t+2])this[n]=s;else throw Error(Zj+n+": "+s);if((s=e[n="LN10"])!==void 0)if(s==Math.LN10)this[n]=new this(s);else throw Error(Zj+n+": "+s);return this}var W1e=kUe(RBt);cf=new W1e(1);const Fo=W1e;function BBt(e){return VBt(e)||qBt(e)||UBt(e)||$Bt()}function $Bt(){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 UBt(e,t){if(e){if(typeof e=="string")return nme(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return nme(e,t)}}function qBt(e){if(typeof Symbol<"u"&&Symbol.iterator in Object(e))return Array.from(e)}function VBt(e){if(Array.isArray(e))return nme(e)}function nme(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,s=new Array(t);n=t?n.apply(void 0,a):e(t-l,E5e(function(){for(var i=arguments.length,u=new Array(i),p=0;pe.length)&&(t=e.length);for(var n=0,s=new Array(t);n"u"||!(Symbol.iterator in Object(e)))){var n=[],s=!0,a=!1,o=void 0;try{for(var l=e[Symbol.iterator](),i;!(s=(i=l.next()).done)&&(n.push(i.value),!(t&&n.length===t));s=!0);}catch(u){a=!0,o=u}finally{try{!s&&l.return!=null&&l.return()}finally{if(a)throw o}}return n}}function a$t(e){if(Array.isArray(e))return e}function TUe(e){var t=hI(e,2),n=t[0],s=t[1],a=n,o=s;return n>s&&(a=s,o=n),[a,o]}function AUe(e,t,n){if(e.lte(0))return new Fo(0);var s=jie.getDigitCount(e.toNumber()),a=new Fo(10).pow(s),o=e.div(a),l=s!==1?.05:.1,i=new Fo(Math.ceil(o.div(l).toNumber())).add(n).mul(l),u=i.mul(a);return t?u:new Fo(Math.ceil(u))}function i$t(e,t,n){var s=1,a=new Fo(e);if(!a.isint()&&n){var o=Math.abs(e);o<1?(s=new Fo(10).pow(jie.getDigitCount(e)-1),a=new Fo(Math.floor(a.div(s).toNumber())).mul(s)):o>1&&(a=new Fo(Math.floor(e)))}else e===0?a=new Fo(Math.floor((t-1)/2)):n||(a=new Fo(Math.floor(e)));var l=Math.floor((t-1)/2),i=KBt(GBt(function(u){return a.add(new Fo(u-l).mul(s)).toNumber()}),sme);return i(0,t)}function EUe(e,t,n,s){var a=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0;if(!Number.isFinite((t-e)/(n-1)))return{step:new Fo(0),tickMin:new Fo(0),tickMax:new Fo(0)};var o=AUe(new Fo(t).sub(e).div(n-1),s,a),l;e<=0&&t>=0?l=new Fo(0):(l=new Fo(e).add(t).div(2),l=l.sub(new Fo(l).mod(o)));var i=Math.ceil(l.sub(e).div(o).toNumber()),u=Math.ceil(new Fo(t).sub(l).div(o).toNumber()),p=i+u+1;return p>n?EUe(e,t,n,s,a+1):(p0?u+(n-p):u,i=t>0?i:i+(n-p)),{step:o,tickMin:l.sub(new Fo(i).mul(o)),tickMax:l.add(new Fo(u).mul(o))})}function o$t(e){var t=hI(e,2),n=t[0],s=t[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=TUe([n,s]),u=hI(i,2),p=u[0],x=u[1];if(p===-1/0||x===1/0){var y=x===1/0?[p].concat(ime(sme(0,a-1).map(function(){return 1/0}))):[].concat(ime(sme(0,a-1).map(function(){return-1/0})),[x]);return n>s?ame(y):y}if(p===x)return i$t(p,a,o);var _=EUe(p,x,l,o),b=_.step,S=_.tickMin,k=_.tickMax,M=jie.rangeStep(S,k.add(new Fo(.1).mul(b)),b);return n>s?ame(M):M}function l$t(e,t){var n=hI(e,2),s=n[0],a=n[1],o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,l=TUe([s,a]),i=hI(l,2),u=i[0],p=i[1];if(u===-1/0||p===1/0)return[s,a];if(u===p)return[u];var x=Math.max(t,2),y=AUe(new Fo(p).sub(u).div(x-1),o,0),_=[].concat(ime(jie.rangeStep(new Fo(u),new Fo(p).sub(new Fo(.99).mul(y)),y)),[p]);return s>a?ame(_):_}var c$t=CUe(o$t),d$t=CUe(l$t),u$t="Invariant failed";function _k(e,t){throw new Error(u$t)}var h$t=["offset","layout","width","dataKey","data","dataPointFormatter","xAxis","yAxis"];function YC(e){"@babel/helpers - typeof";return YC=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},YC(e)}function Nne(){return Nne=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,s=new Array(t);n=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(n[s]=e[s])}return n}function v$t(e,t){if(e==null)return{};var n={};for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){if(t.indexOf(s)>=0)continue;n[s]=e[s]}return n}function _$t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function b$t(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,s=new Array(t);n1&&arguments[1]!==void 0?arguments[1]:[],a=arguments.length>2?arguments[2]:void 0,o=arguments.length>3?arguments[3]:void 0,l=-1,i=(n=s==null?void 0:s.length)!==null&&n!==void 0?n:0;if(i<=1)return 0;if(o&&o.axisType==="angleAxis"&&Math.abs(Math.abs(o.range[1]-o.range[0])-360)<=1e-6)for(var u=o.range,p=0;p0?a[p-1].coordinate:a[i-1].coordinate,y=a[p].coordinate,_=p>=i-1?a[0].coordinate:a[p+1].coordinate,b=void 0;if(Ku(y-x)!==Ku(_-y)){var S=[];if(Ku(_-y)===Ku(u[1]-u[0])){b=_;var k=y+u[1]-u[0];S[0]=Math.min(k,(k+x)/2),S[1]=Math.max(k,(k+x)/2)}else{b=x;var M=_+u[1]-u[0];S[0]=Math.min(y,(M+y)/2),S[1]=Math.max(y,(M+y)/2)}var P=[Math.min(y,(b+y)/2),Math.max(y,(b+y)/2)];if(t>P[0]&&t<=P[1]||t>=S[0]&&t<=S[1]){l=a[p].index;break}}else{var T=Math.min(x,_),I=Math.max(x,_);if(t>(T+y)/2&&t<=(I+y)/2){l=a[p].index;break}}}else for(var z=0;z0&&z(s[z].coordinate+s[z-1].coordinate)/2&&t<=(s[z].coordinate+s[z+1].coordinate)/2||z===i-1&&t>(s[z].coordinate+s[z-1].coordinate)/2){l=s[z].index;break}return l},G1e=function(t){var n,s=t,a=s.type.displayName,o=(n=t.type)!==null&&n!==void 0&&n.defaultProps?Jl(Jl({},t.type.defaultProps),t.props):t.props,l=o.stroke,i=o.fill,u;switch(a){case"Line":u=l;break;case"Area":case"Radar":u=l&&l!=="none"?l:i;break;default:u=i;break}return u},F$t=function(t){var n=t.barSize,s=t.totalSize,a=t.stackGroups,o=a===void 0?{}:a;if(!o)return{};for(var l={},i=Object.keys(o),u=0,p=i.length;u=0});if(P&&P.length){var T=P[0].type.defaultProps,I=T!==void 0?Jl(Jl({},T),P[0].props):P[0].props,z=I.barSize,D=I[M];l[D]||(l[D]=[]);var U=Mi(z)?n:z;l[D].push({item:P[0],stackList:P.slice(1),barSize:Mi(U)?void 0:Zu(U,s,0)})}}return l},z$t=function(t){var n=t.barGap,s=t.barCategoryGap,a=t.bandSize,o=t.sizeList,l=o===void 0?[]:o,i=t.maxBarSize,u=l.length;if(u<1)return null;var p=Zu(n,a,0,!0),x,y=[];if(l[0].barSize===+l[0].barSize){var _=!1,b=a/u,S=l.reduce(function(z,D){return z+D.barSize||0},0);S+=(u-1)*p,S>=a&&(S-=(u-1)*p,p=0),S>=a&&b>0&&(_=!0,b*=.9,S=u*b);var k=(a-S)/2>>0,M={offset:k-p,size:0};x=l.reduce(function(z,D){var U={item:D.item,position:{offset:M.offset+M.size+p,size:_?b:D.barSize}},V=[].concat(L5e(z),[U]);return M=V[V.length-1].position,D.stackList&&D.stackList.length&&D.stackList.forEach(function(W){V.push({item:W,position:M})}),V},y)}else{var P=Zu(s,a,0,!0);a-2*P-(u-1)*p<=0&&(p=0);var T=(a-2*P-(u-1)*p)/u;T>1&&(T>>=0);var I=i===+i?Math.min(T,i):T;x=l.reduce(function(z,D,U){var V=[].concat(L5e(z),[{item:D.item,position:{offset:P+(T+p)*U+(T-I)/2,size:I}}]);return D.stackList&&D.stackList.length&&D.stackList.forEach(function(W){V.push({item:W,position:V[V.length-1].position})}),V},y)}return x},B$t=function(t,n,s,a){var o=s.children,l=s.width,i=s.margin,u=l-(i.left||0)-(i.right||0),p=OUe({children:o,legendWidth:u});if(p){var x=a||{},y=x.width,_=x.height,b=p.align,S=p.verticalAlign,k=p.layout;if((k==="vertical"||k==="horizontal"&&S==="middle")&&b!=="center"&&Dn(t[b]))return Jl(Jl({},t),{},nC({},b,t[b]+(y||0)));if((k==="horizontal"||k==="vertical"&&b==="center")&&S!=="middle"&&Dn(t[S]))return Jl(Jl({},t),{},nC({},S,t[S]+(_||0)))}return t},$$t=function(t,n,s){return Mi(n)?!0:t==="horizontal"?n==="yAxis":t==="vertical"||s==="x"?n==="xAxis":s==="y"?n==="yAxis":!0},DUe=function(t,n,s,a,o){var l=n.props.children,i=xp(l,kie).filter(function(p){return $$t(a,o,p.props.direction)});if(i&&i.length){var u=i.map(function(p){return p.props.dataKey});return t.reduce(function(p,x){var y=vu(x,s);if(Mi(y))return p;var _=Array.isArray(y)?[_ie(y),vie(y)]:[y,y],b=u.reduce(function(S,k){var M=vu(x,k,0),P=_[0]-Math.abs(Array.isArray(M)?M[0]:M),T=_[1]+Math.abs(Array.isArray(M)?M[1]:M);return[Math.min(P,S[0]),Math.max(T,S[1])]},[1/0,-1/0]);return[Math.min(b[0],p[0]),Math.max(b[1],p[1])]},[1/0,-1/0])}return null},U$t=function(t,n,s,a,o){var l=n.map(function(i){return DUe(t,i,s,o,a)}).filter(function(i){return!Mi(i)});return l&&l.length?l.reduce(function(i,u){return[Math.min(i[0],u[0]),Math.max(i[1],u[1])]},[1/0,-1/0]):null},RUe=function(t,n,s,a,o){var l=n.map(function(u){var p=u.props.dataKey;return s==="number"&&p&&DUe(t,u,p,a)||JA(t,p,s,o)});if(s==="number")return l.reduce(function(u,p){return[Math.min(u[0],p[0]),Math.max(u[1],p[1])]},[1/0,-1/0]);var i={};return l.reduce(function(u,p){for(var x=0,y=p.length;x=2?Ku(i[0]-i[1])*2*p:p,n&&(t.ticks||t.niceTicks)){var x=(t.ticks||t.niceTicks).map(function(y){var _=o?o.indexOf(y):y;return{coordinate:a(_)+p,value:y,offset:p}});return x.filter(function(y){return!wP(y.coordinate)})}return t.isCategorical&&t.categoricalDomain?t.categoricalDomain.map(function(y,_){return{coordinate:a(y)+p,value:y,index:_,offset:p}}):a.ticks&&!s?a.ticks(t.tickCount).map(function(y){return{coordinate:a(y)+p,value:y,offset:p}}):a.domain().map(function(y,_){return{coordinate:a(y)+p,value:o?o[y]:y,index:_,offset:p}})},iue=new WeakMap,OO=function(t,n){if(typeof n!="function")return t;iue.has(t)||iue.set(t,new WeakMap);var s=iue.get(t);if(s.has(n))return s.get(n);var a=function(){t.apply(void 0,arguments),n.apply(void 0,arguments)};return s.set(n,a),a},BUe=function(t,n,s){var a=t.scale,o=t.type,l=t.layout,i=t.axisType;if(a==="auto")return l==="radial"&&i==="radiusAxis"?{scale:iI(),realScaleType:"band"}:l==="radial"&&i==="angleAxis"?{scale:_ne(),realScaleType:"linear"}:o==="category"&&n&&(n.indexOf("LineChart")>=0||n.indexOf("AreaChart")>=0||n.indexOf("ComposedChart")>=0&&!s)?{scale:QA(),realScaleType:"point"}:o==="category"?{scale:iI(),realScaleType:"band"}:{scale:_ne(),realScaleType:"linear"};if(gk(a)){var u="scale".concat(sie(a));return{scale:(M5e[u]||QA)(),realScaleType:M5e[u]?u:"point"}}return Ka(a)?{scale:a}:{scale:QA(),realScaleType:"point"}},D5e=1e-4,$Ue=function(t){var n=t.domain();if(!(!n||n.length<=2)){var s=n.length,a=t.range(),o=Math.min(a[0],a[1])-D5e,l=Math.max(a[0],a[1])+D5e,i=t(n[0]),u=t(n[s-1]);(il||ul)&&t.domain([n[0],n[s-1]])}},q$t=function(t,n){if(!t)return null;for(var s=0,a=t.length;sa)&&(o[1]=a),o[0]>a&&(o[0]=a),o[1]=0?(t[i][s][0]=o,t[i][s][1]=o+u,o=t[i][s][1]):(t[i][s][0]=l,t[i][s][1]=l+u,l=t[i][s][1])}},W$t=function(t){var n=t.length;if(!(n<=0))for(var s=0,a=t[0].length;s=0?(t[l][s][0]=o,t[l][s][1]=o+i,o=t[l][s][1]):(t[l][s][0]=0,t[l][s][1]=0)}},G$t={sign:H$t,expand:hIt,none:UC,silhouette:fIt,wiggle:pIt,positive:W$t},K$t=function(t,n,s){var a=n.map(function(i){return i.props.dataKey}),o=G$t[s],l=uIt().keys(a).value(function(i,u){return+vu(i,u,0)}).order(Ppe).offset(o);return l(t)},Z$t=function(t,n,s,a,o,l){if(!t)return null;var i=l?n.reverse():n,u={},p=i.reduce(function(y,_){var b,S=(b=_.type)!==null&&b!==void 0&&b.defaultProps?Jl(Jl({},_.type.defaultProps),_.props):_.props,k=S.stackId,M=S.hide;if(M)return y;var P=S[s],T=y[P]||{hasStack:!1,stackGroups:{}};if(hd(k)){var I=T.stackGroups[k]||{numericAxisId:s,cateAxisId:a,items:[]};I.items.push(_),T.hasStack=!0,T.stackGroups[k]=I}else T.stackGroups[jP("_stackId_")]={numericAxisId:s,cateAxisId:a,items:[_]};return Jl(Jl({},y),{},nC({},P,T))},u),x={};return Object.keys(p).reduce(function(y,_){var b=p[_];if(b.hasStack){var S={};b.stackGroups=Object.keys(b.stackGroups).reduce(function(k,M){var P=b.stackGroups[M];return Jl(Jl({},k),{},nC({},M,{numericAxisId:s,cateAxisId:a,items:P.items,stackedData:K$t(t,P.items,o)}))},S)}return Jl(Jl({},y),{},nC({},_,b))},x)},UUe=function(t,n){var s=n.realScaleType,a=n.type,o=n.tickCount,l=n.originalDomain,i=n.allowDecimals,u=s||n.scale;if(u!=="auto"&&u!=="linear")return null;if(o&&a==="number"&&l&&(l[0]==="auto"||l[1]==="auto")){var p=t.domain();if(!p.length)return null;var x=c$t(p,o,i);return t.domain([_ie(x),vie(x)]),{niceTicks:x}}if(o&&a==="number"){var y=t.domain(),_=d$t(y,o,i);return{niceTicks:_}}return null},R5e=function(t){var n=t.axis,s=t.ticks,a=t.offset,o=t.bandSize,l=t.entry,i=t.index;if(n.type==="category")return s[i]?s[i].coordinate+a:null;var u=vu(l,n.dataKey,n.domain[i]);return Mi(u)?null:n.scale(u)-o/2+a},Y$t=function(t){var n=t.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]},X$t=function(t,n){var s,a=(s=t.type)!==null&&s!==void 0&&s.defaultProps?Jl(Jl({},t.type.defaultProps),t.props):t.props,o=a.stackId;if(hd(o)){var l=n[o];if(l){var i=l.items.indexOf(t);return i>=0?l.stackedData[i]:null}}return null},Q$t=function(t){return t.reduce(function(n,s){return[_ie(s.concat([n[0]]).filter(Dn)),vie(s.concat([n[1]]).filter(Dn))]},[1/0,-1/0])},qUe=function(t,n,s){return Object.keys(t).reduce(function(a,o){var l=t[o],i=l.stackedData,u=i.reduce(function(p,x){var y=Q$t(x.slice(n,s+1));return[Math.min(p[0],y[0]),Math.max(p[1],y[1])]},[1/0,-1/0]);return[Math.min(u[0],a[0]),Math.max(u[1],a[1])]},[1/0,-1/0]).map(function(a){return a===1/0||a===-1/0?0:a})},F5e=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,z5e=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,dme=function(t,n,s){if(Ka(t))return t(n,s);if(!Array.isArray(t))return n;var a=[];if(Dn(t[0]))a[0]=s?t[0]:Math.min(t[0],n[0]);else if(F5e.test(t[0])){var o=+F5e.exec(t[0])[1];a[0]=n[0]-o}else Ka(t[0])?a[0]=t[0](n[0]):a[0]=n[0];if(Dn(t[1]))a[1]=s?t[1]:Math.max(t[1],n[1]);else if(z5e.test(t[1])){var l=+z5e.exec(t[1])[1];a[1]=n[1]+l}else Ka(t[1])?a[1]=t[1](n[1]):a[1]=n[1];return a},Cne=function(t,n,s){if(t&&t.scale&&t.scale.bandwidth){var a=t.scale.bandwidth();if(!s||a>0)return a}if(t&&n&&n.length>=2){for(var o=b1e(n,function(y){return y.coordinate}),l=1/0,i=1,u=o.length;ie.length)&&(t=e.length);for(var n=0,s=new Array(t);n2&&arguments[2]!==void 0?arguments[2]:{top:0,right:0,bottom:0,left:0};return Math.min(Math.abs(t-(s.left||0)-(s.right||0)),Math.abs(n-(s.top||0)-(s.bottom||0)))/2},oUt=function(t,n,s,a,o){var l=t.width,i=t.height,u=t.startAngle,p=t.endAngle,x=Zu(t.cx,l,l/2),y=Zu(t.cy,i,i/2),_=WUe(l,i,s),b=Zu(t.innerRadius,_,0),S=Zu(t.outerRadius,_,_*.8),k=Object.keys(n);return k.reduce(function(M,P){var T=n[P],I=T.domain,z=T.reversed,D;if(Mi(T.range))a==="angleAxis"?D=[u,p]:a==="radiusAxis"&&(D=[b,S]),z&&(D=[D[1],D[0]]);else{D=T.range;var U=D,V=tUt(U,2);u=V[0],p=V[1]}var W=BUe(T,o),G=W.realScaleType,J=W.scale;J.domain(I).range(D),$Ue(J);var ne=UUe(J,qx(qx({},T),{},{realScaleType:G})),oe=qx(qx(qx({},T),ne),{},{range:D,radius:S,realScaleType:G,scale:J,cx:x,cy:y,innerRadius:b,outerRadius:S,startAngle:u,endAngle:p});return qx(qx({},M),{},HUe({},P,oe))},{})},lUt=function(t,n){var s=t.x,a=t.y,o=n.x,l=n.y;return Math.sqrt(Math.pow(s-o,2)+Math.pow(a-l,2))},cUt=function(t,n){var s=t.x,a=t.y,o=n.cx,l=n.cy,i=lUt({x:s,y:a},{x:o,y:l});if(i<=0)return{radius:i};var u=(s-o)/i,p=Math.acos(u);return a>l&&(p=2*Math.PI-p),{radius:i,angle:iUt(p),angleInRadian:p}},dUt=function(t){var n=t.startAngle,s=t.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}},uUt=function(t,n){var s=n.startAngle,a=n.endAngle,o=Math.floor(s/360),l=Math.floor(a/360),i=Math.min(o,l);return t+i*360},q5e=function(t,n){var s=t.x,a=t.y,o=cUt({x:s,y:a},n),l=o.radius,i=o.angle,u=n.innerRadius,p=n.outerRadius;if(lp)return!1;if(l===0)return!0;var x=dUt(n),y=x.startAngle,_=x.endAngle,b=i,S;if(y<=_){for(;b>_;)b-=360;for(;b=y&&b<=_}else{for(;b>y;)b-=360;for(;b<_;)b+=360;S=b>=_&&b<=y}return S?qx(qx({},n),{},{radius:l,angle:uUt(b,n)}):null},GUe=function(t){return!E.isValidElement(t)&&!Ka(t)&&typeof t!="boolean"?t.className:""};function gI(e){"@babel/helpers - typeof";return gI=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},gI(e)}var hUt=["offset"];function fUt(e){return xUt(e)||gUt(e)||mUt(e)||pUt()}function pUt(){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 mUt(e,t){if(e){if(typeof e=="string")return ume(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return ume(e,t)}}function gUt(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function xUt(e){if(Array.isArray(e))return ume(e)}function ume(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,s=new Array(t);n=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(n[s]=e[s])}return n}function vUt(e,t){if(e==null)return{};var n={};for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){if(t.indexOf(s)>=0)continue;n[s]=e[s]}return n}function V5e(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,s)}return n}function Jc(e){for(var t=1;t=0?1:-1,I,z;a==="insideStart"?(I=b+T*l,z=k):a==="insideEnd"?(I=S-T*l,z=!k):a==="end"&&(I=S+T*l,z=k),z=P<=0?z:!z;var D=ol(p,x,M,I),U=ol(p,x,M,I+(z?1:-1)*359),V="M".concat(D.x,",").concat(D.y,` A`).concat(M,",").concat(M,",0,1,").concat(z?0:1,`, `).concat(U.x,",").concat(U.y),W=Mi(t.id)?jP("recharts-radial-line-"):t.id;return lt.createElement("text",xI({},s,{dominantBaseline:"central",className:ui("recharts-radial-bar-label",i)}),lt.createElement("defs",null,lt.createElement("path",{id:W,d:V})),lt.createElement("textPath",{xlinkHref:"#".concat(W)},n))},SUt=function(t){var n=t.viewBox,s=t.offset,a=t.position,o=n,l=o.cx,i=o.cy,u=o.innerRadius,p=o.outerRadius,x=o.startAngle,y=o.endAngle,_=(x+y)/2;if(a==="outside"){var b=ol(l,i,p+s,_),S=b.x,k=b.y;return{x:S,y:k,textAnchor:S>=l?"start":"end",verticalAnchor:"middle"}}if(a==="center")return{x:l,y:i,textAnchor:"middle",verticalAnchor:"middle"};if(a==="centerTop")return{x:l,y:i,textAnchor:"middle",verticalAnchor:"start"};if(a==="centerBottom")return{x:l,y:i,textAnchor:"middle",verticalAnchor:"end"};var M=(u+p)/2,P=ol(l,i,M,_),T=P.x,I=P.y;return{x:T,y:I,textAnchor:"middle",verticalAnchor:"middle"}},CUt=function(t){var n=t.viewBox,s=t.parentViewBox,a=t.offset,o=t.position,l=n,i=l.x,u=l.y,p=l.width,x=l.height,y=x>=0?1:-1,_=y*a,b=y>0?"end":"start",S=y>0?"start":"end",k=p>=0?1:-1,M=k*a,P=k>0?"end":"start",T=k>0?"start":"end";if(o==="top"){var I={x:i+p/2,y:u-y*a,textAnchor:"middle",verticalAnchor:b};return Jc(Jc({},I),s?{height:Math.max(u-s.y,0),width:p}:{})}if(o==="bottom"){var z={x:i+p/2,y:u+x+_,textAnchor:"middle",verticalAnchor:S};return Jc(Jc({},z),s?{height:Math.max(s.y+s.height-(u+x),0),width:p}:{})}if(o==="left"){var D={x:i-M,y:u+x/2,textAnchor:P,verticalAnchor:"middle"};return Jc(Jc({},D),s?{width:Math.max(D.x-s.x,0),height:x}:{})}if(o==="right"){var U={x:i+p+M,y:u+x/2,textAnchor:T,verticalAnchor:"middle"};return Jc(Jc({},U),s?{width:Math.max(s.x+s.width-U.x,0),height:x}:{})}var V=s?{width:p,height:x}:{};return o==="insideLeft"?Jc({x:i+M,y:u+x/2,textAnchor:T,verticalAnchor:"middle"},V):o==="insideRight"?Jc({x:i+p-M,y:u+x/2,textAnchor:P,verticalAnchor:"middle"},V):o==="insideTop"?Jc({x:i+p/2,y:u+_,textAnchor:"middle",verticalAnchor:S},V):o==="insideBottom"?Jc({x:i+p/2,y:u+x-_,textAnchor:"middle",verticalAnchor:b},V):o==="insideTopLeft"?Jc({x:i+M,y:u+_,textAnchor:T,verticalAnchor:S},V):o==="insideTopRight"?Jc({x:i+p-M,y:u+_,textAnchor:P,verticalAnchor:S},V):o==="insideBottomLeft"?Jc({x:i+M,y:u+x-_,textAnchor:T,verticalAnchor:b},V):o==="insideBottomRight"?Jc({x:i+p-M,y:u+x-_,textAnchor:P,verticalAnchor:b},V):$3(o)&&(Dn(o.x)||dj(o.x))&&(Dn(o.y)||dj(o.y))?Jc({x:i+Zu(o.x,p),y:u+Zu(o.y,x),textAnchor:"end",verticalAnchor:"end"},V):Jc({x:i+p/2,y:u+x/2,textAnchor:"middle",verticalAnchor:"middle"},V)},MUt=function(t){return"cx"in t&&Dn(t.cx)};function Ed(e){var t=e.offset,n=t===void 0?5:t,s=yUt(e,hUt),a=Jc({offset:n},s),o=a.viewBox,l=a.position,i=a.value,u=a.children,p=a.content,x=a.className,y=x===void 0?"":x,_=a.textBreakAll;if(!o||Mi(i)&&Mi(u)&&!E.isValidElement(p)&&!Ka(p))return null;if(E.isValidElement(p))return E.cloneElement(p,a);var b;if(Ka(p)){if(b=E.createElement(p,a),E.isValidElement(b))return b}else b=jUt(a);var S=MUt(o),k=Ba(a,!0);if(S&&(l==="insideStart"||l==="insideEnd"||l==="end"))return NUt(a,b,k);var M=S?SUt(a):CUt(a);return lt.createElement(yk,xI({className:ui("recharts-label",y)},k,M,{breakAll:_}),b)}Ed.displayName="Label";var KUe=function(t){var n=t.cx,s=t.cy,a=t.angle,o=t.startAngle,l=t.endAngle,i=t.r,u=t.radius,p=t.innerRadius,x=t.outerRadius,y=t.x,_=t.y,b=t.top,S=t.left,k=t.width,M=t.height,P=t.clockWise,T=t.labelViewBox;if(T)return T;if(Dn(k)&&Dn(M)){if(Dn(y)&&Dn(_))return{x:y,y:_,width:k,height:M};if(Dn(b)&&Dn(S))return{x:b,y:S,width:k,height:M}}return Dn(y)&&Dn(_)?{x:y,y:_,width:0,height:0}:Dn(n)&&Dn(s)?{cx:n,cy:s,startAngle:o||a||0,endAngle:l||a||0,innerRadius:p||0,outerRadius:x||u||i||0,clockWise:P}:t.viewBox?t.viewBox:{}},TUt=function(t,n){return t?t===!0?lt.createElement(Ed,{key:"label-implicit",viewBox:n}):hd(t)?lt.createElement(Ed,{key:"label-implicit",viewBox:n,value:t}):E.isValidElement(t)?t.type===Ed?E.cloneElement(t,{key:"label-implicit",viewBox:n}):lt.createElement(Ed,{key:"label-implicit",content:t,viewBox:n}):Ka(t)?lt.createElement(Ed,{key:"label-implicit",content:t,viewBox:n}):$3(t)?lt.createElement(Ed,xI({viewBox:n},t,{key:"label-implicit"})):null:null},AUt=function(t,n){var s=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!t||!t.children&&s&&!t.label)return null;var a=t.children,o=KUe(t),l=xp(a,Ed).map(function(u,p){return E.cloneElement(u,{viewBox:n||o,key:"label-".concat(p)})});if(!s)return l;var i=TUt(t.label,n||o);return[i].concat(fUt(l))};Ed.parseViewBox=KUe;Ed.renderCallByParent=AUt;function EUt(e){var t=e==null?0:e.length;return t?e[t-1]:void 0}var IUt=EUt;const PUt=Qi(IUt);function yI(e){"@babel/helpers - typeof";return yI=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},yI(e)}var LUt=["valueAccessor"],OUt=["data","dataKey","clockWise","id","textBreakAll"];function DUt(e){return BUt(e)||zUt(e)||FUt(e)||RUt()}function RUt(){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 FUt(e,t){if(e){if(typeof e=="string")return hme(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return hme(e,t)}}function zUt(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function BUt(e){if(Array.isArray(e))return hme(e)}function hme(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,s=new Array(t);n=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(n[s]=e[s])}return n}function VUt(e,t){if(e==null)return{};var n={};for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){if(t.indexOf(s)>=0)continue;n[s]=e[s]}return n}var HUt=function(t){return Array.isArray(t.value)?PUt(t.value):t.value};function iv(e){var t=e.valueAccessor,n=t===void 0?HUt:t,s=G5e(e,LUt),a=s.data,o=s.dataKey,l=s.clockWise,i=s.id,u=s.textBreakAll,p=G5e(s,OUt);return!a||!a.length?null:lt.createElement(Ao,{className:"recharts-label-list"},a.map(function(x,y){var _=Mi(o)?n(x,y):vu(x&&x.payload,o),b=Mi(i)?{}:{id:"".concat(i,"-").concat(y)};return lt.createElement(Ed,Tne({},Ba(x,!0),p,b,{parentViewBox:x.parentViewBox,value:_,textBreakAll:u,viewBox:Ed.parseViewBox(Mi(l)?x:W5e(W5e({},x),{},{clockWise:l})),key:"label-".concat(y),index:y}))}))}iv.displayName="LabelList";function WUt(e,t){return e?e===!0?lt.createElement(iv,{key:"labelList-implicit",data:t}):lt.isValidElement(e)||Ka(e)?lt.createElement(iv,{key:"labelList-implicit",data:t,content:e}):$3(e)?lt.createElement(iv,Tne({data:t},e,{key:"labelList-implicit"})):null:null}function GUt(e,t){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!e||!e.children&&n&&!e.label)return null;var s=e.children,a=xp(s,iv).map(function(l,i){return E.cloneElement(l,{data:t,key:"labelList-".concat(i)})});if(!n)return a;var o=WUt(e.label,t);return[o].concat(DUt(a))}iv.renderCallByParent=GUt;function vI(e){"@babel/helpers - typeof";return vI=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},vI(e)}function fme(){return fme=Object.assign?Object.assign.bind():function(e){for(var t=1;t180),",").concat(+(l>p),`, `).concat(y.x,",").concat(y.y,` `);if(a>0){var b=ol(n,s,a,l),S=ol(n,s,a,p);_+="L ".concat(S.x,",").concat(S.y,` A `).concat(a,",").concat(a,`,0, `).concat(+(Math.abs(u)>180),",").concat(+(l<=p),`, `).concat(b.x,",").concat(b.y," Z")}else _+="L ".concat(n,",").concat(s," Z");return _},QUt=function(t){var n=t.cx,s=t.cy,a=t.innerRadius,o=t.outerRadius,l=t.cornerRadius,i=t.forceCornerRadius,u=t.cornerIsExternal,p=t.startAngle,x=t.endAngle,y=Ku(x-p),_=DO({cx:n,cy:s,radius:o,angle:p,sign:y,cornerRadius:l,cornerIsExternal:u}),b=_.circleTangency,S=_.lineTangency,k=_.theta,M=DO({cx:n,cy:s,radius:o,angle:x,sign:-y,cornerRadius:l,cornerIsExternal:u}),P=M.circleTangency,T=M.lineTangency,I=M.theta,z=u?Math.abs(p-x):Math.abs(p-x)-k-I;if(z<0)return i?"M ".concat(S.x,",").concat(S.y,` a`).concat(l,",").concat(l,",0,0,1,").concat(l*2,`,0 a`).concat(l,",").concat(l,",0,0,1,").concat(-l*2,`,0 `):ZUe({cx:n,cy:s,innerRadius:a,outerRadius:o,startAngle:p,endAngle:x});var D="M ".concat(S.x,",").concat(S.y,` A`).concat(l,",").concat(l,",0,0,").concat(+(y<0),",").concat(b.x,",").concat(b.y,` A`).concat(o,",").concat(o,",0,").concat(+(z>180),",").concat(+(y<0),",").concat(P.x,",").concat(P.y,` A`).concat(l,",").concat(l,",0,0,").concat(+(y<0),",").concat(T.x,",").concat(T.y,` `);if(a>0){var U=DO({cx:n,cy:s,radius:a,angle:p,sign:y,isExternal:!0,cornerRadius:l,cornerIsExternal:u}),V=U.circleTangency,W=U.lineTangency,G=U.theta,J=DO({cx:n,cy:s,radius:a,angle:x,sign:-y,isExternal:!0,cornerRadius:l,cornerIsExternal:u}),ne=J.circleTangency,oe=J.lineTangency,ge=J.theta,ie=u?Math.abs(p-x):Math.abs(p-x)-G-ge;if(ie<0&&l===0)return"".concat(D,"L").concat(n,",").concat(s,"Z");D+="L".concat(oe.x,",").concat(oe.y,` A`).concat(l,",").concat(l,",0,0,").concat(+(y<0),",").concat(ne.x,",").concat(ne.y,` A`).concat(a,",").concat(a,",0,").concat(+(ie>180),",").concat(+(y>0),",").concat(V.x,",").concat(V.y,` A`).concat(l,",").concat(l,",0,0,").concat(+(y<0),",").concat(W.x,",").concat(W.y,"Z")}else D+="L".concat(n,",").concat(s,"Z");return D},JUt={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},YUe=function(t){var n=Z5e(Z5e({},JUt),t),s=n.cx,a=n.cy,o=n.innerRadius,l=n.outerRadius,i=n.cornerRadius,u=n.forceCornerRadius,p=n.cornerIsExternal,x=n.startAngle,y=n.endAngle,_=n.className;if(l0&&Math.abs(x-y)<360?M=QUt({cx:s,cy:a,innerRadius:o,outerRadius:l,cornerRadius:Math.min(k,S/2),forceCornerRadius:u,cornerIsExternal:p,startAngle:x,endAngle:y}):M=ZUe({cx:s,cy:a,innerRadius:o,outerRadius:l,startAngle:x,endAngle:y}),lt.createElement("path",fme({},Ba(n,!0),{className:b,d:M,role:"img"}))};function _I(e){"@babel/helpers - typeof";return _I=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},_I(e)}function pme(){return pme=Object.assign?Object.assign.bind():function(e){for(var t=1;t0;)if(!n.equals(e[s],t[s],s,s,e,t,n))return!1;return!0}function yqt(e,t){return Pk(e.getTime(),t.getTime())}function vqt(e,t){return e.name===t.name&&e.message===t.message&&e.cause===t.cause&&e.stack===t.stack}function _qt(e,t){return e===t}function nMe(e,t,n){var s=e.size;if(s!==t.size)return!1;if(!s)return!0;for(var a=new Array(s),o=e.entries(),l,i,u=0;(l=o.next())&&!l.done;){for(var p=t.entries(),x=!1,y=0;(i=p.next())&&!i.done;){if(a[y]){y++;continue}var _=l.value,b=i.value;if(n.equals(_[0],b[0],u,y,e,t,n)&&n.equals(_[1],b[1],_[0],b[0],e,t,n)){x=a[y]=!0;break}y++}if(!x)return!1;u++}return!0}var bqt=Pk;function wqt(e,t,n){var s=rMe(e),a=s.length;if(rMe(t).length!==a)return!1;for(;a-- >0;)if(!eqe(e,t,n,s[a]))return!1;return!0}function jT(e,t,n){var s=eMe(e),a=s.length;if(eMe(t).length!==a)return!1;for(var o,l,i;a-- >0;)if(o=s[a],!eqe(e,t,n,o)||(l=tMe(e,o),i=tMe(t,o),(l||i)&&(!l||!i||l.configurable!==i.configurable||l.enumerable!==i.enumerable||l.writable!==i.writable)))return!1;return!0}function jqt(e,t){return Pk(e.valueOf(),t.valueOf())}function kqt(e,t){return e.source===t.source&&e.flags===t.flags}function sMe(e,t,n){var s=e.size;if(s!==t.size)return!1;if(!s)return!0;for(var a=new Array(s),o=e.values(),l,i;(l=o.next())&&!l.done;){for(var u=t.values(),p=!1,x=0;(i=u.next())&&!i.done;){if(!a[x]&&n.equals(l.value,i.value,l.value,i.value,e,t,n)){p=a[x]=!0;break}x++}if(!p)return!1}return!0}function Nqt(e,t){var n=e.length;if(t.length!==n)return!1;for(;n-- >0;)if(e[n]!==t[n])return!1;return!0}function Sqt(e,t){return e.hostname===t.hostname&&e.pathname===t.pathname&&e.protocol===t.protocol&&e.port===t.port&&e.hash===t.hash&&e.username===t.username&&e.password===t.password}function eqe(e,t,n,s){return(s===gqt||s===mqt||s===pqt)&&(e.$$typeof||t.$$typeof)?!0:fqt(t,s)&&n.equals(e[s],t[s],s,s,e,t,n)}var Cqt="[object Arguments]",Mqt="[object Boolean]",Tqt="[object Date]",Aqt="[object Error]",Eqt="[object Map]",Iqt="[object Number]",Pqt="[object Object]",Lqt="[object RegExp]",Oqt="[object Set]",Dqt="[object String]",Rqt="[object URL]",Fqt=Array.isArray,aMe=typeof ArrayBuffer=="function"&&ArrayBuffer.isView?ArrayBuffer.isView:null,iMe=Object.assign,zqt=Object.prototype.toString.call.bind(Object.prototype.toString);function Bqt(e){var t=e.areArraysEqual,n=e.areDatesEqual,s=e.areErrorsEqual,a=e.areFunctionsEqual,o=e.areMapsEqual,l=e.areNumbersEqual,i=e.areObjectsEqual,u=e.arePrimitiveWrappersEqual,p=e.areRegExpsEqual,x=e.areSetsEqual,y=e.areTypedArraysEqual,_=e.areUrlsEqual;return function(S,k,M){if(S===k)return!0;if(S==null||k==null)return!1;var P=typeof S;if(P!==typeof k)return!1;if(P!=="object")return P==="number"?l(S,k,M):P==="function"?a(S,k,M):!1;var T=S.constructor;if(T!==k.constructor)return!1;if(T===Object)return i(S,k,M);if(Fqt(S))return t(S,k,M);if(aMe!=null&&aMe(S))return y(S,k,M);if(T===Date)return n(S,k,M);if(T===RegExp)return p(S,k,M);if(T===Map)return o(S,k,M);if(T===Set)return x(S,k,M);var I=zqt(S);return I===Tqt?n(S,k,M):I===Lqt?p(S,k,M):I===Eqt?o(S,k,M):I===Oqt?x(S,k,M):I===Pqt?typeof S.then!="function"&&typeof k.then!="function"&&i(S,k,M):I===Rqt?_(S,k,M):I===Aqt?s(S,k,M):I===Cqt?i(S,k,M):I===Mqt||I===Iqt||I===Dqt?u(S,k,M):!1}}function $qt(e){var t=e.circular,n=e.createCustomConfig,s=e.strict,a={areArraysEqual:s?jT:xqt,areDatesEqual:yqt,areErrorsEqual:vqt,areFunctionsEqual:_qt,areMapsEqual:s?J5e(nMe,jT):nMe,areNumbersEqual:bqt,areObjectsEqual:s?jT:wqt,arePrimitiveWrappersEqual:jqt,areRegExpsEqual:kqt,areSetsEqual:s?J5e(sMe,jT):sMe,areTypedArraysEqual:s?jT:Nqt,areUrlsEqual:Sqt};if(n&&(a=iMe({},a,n(a))),t){var o=FO(a.areArraysEqual),l=FO(a.areMapsEqual),i=FO(a.areObjectsEqual),u=FO(a.areSetsEqual);a=iMe({},a,{areArraysEqual:o,areMapsEqual:l,areObjectsEqual:i,areSetsEqual:u})}return a}function Uqt(e){return function(t,n,s,a,o,l,i){return e(t,n,i)}}function qqt(e){var t=e.circular,n=e.comparator,s=e.createState,a=e.equals,o=e.strict;if(s)return function(u,p){var x=s(),y=x.cache,_=y===void 0?t?new WeakMap:void 0:y,b=x.meta;return n(u,p,{cache:_,equals:a,meta:b,strict:o})};if(t)return function(u,p){return n(u,p,{cache:new WeakMap,equals:a,meta:void 0,strict:o})};var l={cache:void 0,equals:a,meta:void 0,strict:o};return function(u,p){return n(u,p,l)}}var Vqt=Lv();Lv({strict:!0});Lv({circular:!0});Lv({circular:!0,strict:!0});Lv({createInternalComparator:function(){return Pk}});Lv({strict:!0,createInternalComparator:function(){return Pk}});Lv({circular:!0,createInternalComparator:function(){return Pk}});Lv({circular:!0,createInternalComparator:function(){return Pk},strict:!0});function Lv(e){e===void 0&&(e={});var t=e.circular,n=t===void 0?!1:t,s=e.createInternalComparator,a=e.createState,o=e.strict,l=o===void 0?!1:o,i=$qt(e),u=Bqt(i),p=s?s(u):Uqt(u);return qqt({circular:n,comparator:u,createState:a,equals:p,strict:l})}function Hqt(e){typeof requestAnimationFrame<"u"&&requestAnimationFrame(e)}function oMe(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=-1,s=function a(o){n<0&&(n=o),o-n>t?(e(o),n=-1):Hqt(a)};requestAnimationFrame(s)}function gme(e){"@babel/helpers - typeof";return gme=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},gme(e)}function Wqt(e){return Yqt(e)||Zqt(e)||Kqt(e)||Gqt()}function Gqt(){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 Kqt(e,t){if(e){if(typeof e=="string")return lMe(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return lMe(e,t)}}function lMe(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,s=new Array(t);ne.length)&&(t=e.length);for(var n=0,s=new Array(t);n1?1:P<0?0:P},k=function(P){for(var T=P>1?1:P,I=T,z=0;z<8;++z){var D=y(I)-T,U=b(I);if(Math.abs(D-T)0&&arguments[0]!==void 0?arguments[0]:{},n=t.stiff,s=n===void 0?100:n,a=t.damping,o=a===void 0?8:a,l=t.dt,i=l===void 0?17:l,u=function(x,y,_){var b=-(x-y)*s,S=_*o,k=_+(b-S)*i/1e3,M=_*i/1e3+x;return Math.abs(M-y)e.length)&&(t=e.length);for(var n=0,s=new Array(t);n=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(n[s]=e[s])}return n}function CVt(e,t){if(e==null)return{};var n={},s=Object.keys(e),a,o;for(o=0;o=0)&&(n[a]=e[a]);return n}function oue(e){return EVt(e)||AVt(e)||TVt(e)||MVt()}function MVt(){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 TVt(e,t){if(e){if(typeof e=="string")return bme(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return bme(e,t)}}function AVt(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function EVt(e){if(Array.isArray(e))return bme(e)}function bme(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,s=new Array(t);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 Ine(e){return Ine=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},Ine(e)}var By=function(e){DVt(n,e);var t=RVt(n);function n(s,a){var o;IVt(this,n),o=t.call(this,s,a);var l=o.props,i=l.isActive,u=l.attributeName,p=l.from,x=l.to,y=l.steps,_=l.children,b=l.duration;if(o.handleStyleChange=o.handleStyleChange.bind(kme(o)),o.changeStyle=o.changeStyle.bind(kme(o)),!i||b<=0)return o.state={style:{}},typeof _=="function"&&(o.state={style:x}),jme(o);if(y&&y.length)o.state={style:y[0].style};else if(p){if(typeof _=="function")return o.state={style:p},jme(o);o.state={style:u?BT({},u,p):p}}else o.state={style:{}};return o}return LVt(n,[{key:"componentDidMount",value:function(){var a=this.props,o=a.isActive,l=a.canBegin;this.mounted=!0,!(!o||!l)&&this.runAnimation(this.props)}},{key:"componentDidUpdate",value:function(a){var o=this.props,l=o.isActive,i=o.canBegin,u=o.attributeName,p=o.shouldReAnimate,x=o.to,y=o.from,_=this.state.style;if(i){if(!l){var b={style:u?BT({},u,x):x};this.state&&_&&(u&&_[u]!==x||!u&&_!==x)&&this.setState(b);return}if(!(Vqt(a.to,x)&&a.canBegin&&a.isActive)){var S=!a.canBegin||!a.isActive;this.manager&&this.manager.stop(),this.stopJSAnimation&&this.stopJSAnimation();var k=S||p?y:a.to;if(this.state&&_){var M={style:u?BT({},u,k):k};(u&&_[u]!==k||!u&&_!==k)&&this.setState(M)}this.runAnimation(em(em({},this.props),{},{from:k,begin:0}))}}}},{key:"componentWillUnmount",value:function(){this.mounted=!1;var a=this.props.onAnimationEnd;this.unSubscribe&&this.unSubscribe(),this.manager&&(this.manager.stop(),this.manager=null),this.stopJSAnimation&&this.stopJSAnimation(),a&&a()}},{key:"handleStyleChange",value:function(a){this.changeStyle(a)}},{key:"changeStyle",value:function(a){this.mounted&&this.setState({style:a})}},{key:"runJSAnimation",value:function(a){var o=this,l=a.from,i=a.to,u=a.duration,p=a.easing,x=a.begin,y=a.onAnimationEnd,_=a.onAnimationStart,b=kVt(l,i,fVt(p),u,this.changeStyle),S=function(){o.stopJSAnimation=b()};this.manager.start([_,x,S,u,y])}},{key:"runStepAnimation",value:function(a){var o=this,l=a.steps,i=a.begin,u=a.onAnimationStart,p=l[0],x=p.style,y=p.duration,_=y===void 0?0:y,b=function(k,M,P){if(P===0)return k;var T=M.duration,I=M.easing,z=I===void 0?"ease":I,D=M.style,U=M.properties,V=M.onAnimationEnd,W=P>0?l[P-1]:M,G=U||Object.keys(D);if(typeof z=="function"||z==="spring")return[].concat(oue(k),[o.runJSAnimation.bind(o,{from:W.style,to:D,duration:T,easing:z}),T]);var J=uMe(G,T,z),ne=em(em(em({},W.style),D),{},{transition:J});return[].concat(oue(k),[ne,T,V]).filter(tVt)};return this.manager.start([u].concat(oue(l.reduce(b,[x,Math.max(_,i)])),[a.onAnimationEnd]))}},{key:"runAnimation",value:function(a){this.manager||(this.manager=Xqt());var o=a.begin,l=a.duration,i=a.attributeName,u=a.to,p=a.easing,x=a.onAnimationStart,y=a.onAnimationEnd,_=a.steps,b=a.children,S=this.manager;if(this.unSubscribe=S.subscribe(this.handleStyleChange),typeof p=="function"||typeof b=="function"||p==="spring"){this.runJSAnimation(a);return}if(_.length>1){this.runStepAnimation(a);return}var k=i?BT({},i,u):u,M=uMe(Object.keys(k),l,p);S.start([x,o,em(em({},k),{},{transition:M}),l,y])}},{key:"render",value:function(){var a=this.props,o=a.children;a.begin;var l=a.duration;a.attributeName,a.easing;var i=a.isActive;a.steps,a.from,a.to,a.canBegin,a.onAnimationEnd,a.shouldReAnimate,a.onAnimationReStart;var u=SVt(a,NVt),p=E.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(b){var S=b.props,k=S.style,M=k===void 0?{}:k,P=S.className,T=E.cloneElement(b,em(em({},u),{},{style:em(em({},M),x),className:P}));return T};return p===1?y(E.Children.only(o)):lt.createElement("div",null,E.Children.map(o,function(_){return y(_)}))}}]),n}(E.PureComponent);By.displayName="Animate";By.defaultProps={begin:0,duration:1e3,from:"",to:"",attributeName:"",easing:"ease",isActive:!0,canBegin:!0,steps:[],onAnimationEnd:function(){},onAnimationStart:function(){}};By.propTypes={from:jo.oneOfType([jo.object,jo.string]),to:jo.oneOfType([jo.object,jo.string]),attributeName:jo.string,duration:jo.number,begin:jo.number,easing:jo.oneOfType([jo.string,jo.func]),steps:jo.arrayOf(jo.shape({duration:jo.number.isRequired,style:jo.object.isRequired,easing:jo.oneOfType([jo.oneOf(["ease","ease-in","ease-out","ease-in-out","linear"]),jo.func]),properties:jo.arrayOf("string"),onAnimationEnd:jo.func})),children:jo.oneOfType([jo.node,jo.func]),isActive:jo.bool,canBegin:jo.bool,onAnimationEnd:jo.func,shouldReAnimate:jo.bool,onAnimationStart:jo.func,onAnimationReStart:jo.func};function jI(e){"@babel/helpers - typeof";return jI=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},jI(e)}function Pne(){return Pne=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,s=new Array(t);n=0?1:-1,u=s>=0?1:-1,p=a>=0&&s>=0||a<0&&s<0?1:0,x;if(l>0&&o instanceof Array){for(var y=[0,0,0,0],_=0,b=4;_l?l:o[_];x="M".concat(t,",").concat(n+i*y[0]),y[0]>0&&(x+="A ".concat(y[0],",").concat(y[0],",0,0,").concat(p,",").concat(t+u*y[0],",").concat(n)),x+="L ".concat(t+s-u*y[1],",").concat(n),y[1]>0&&(x+="A ".concat(y[1],",").concat(y[1],",0,0,").concat(p,`, `).concat(t+s,",").concat(n+i*y[1])),x+="L ".concat(t+s,",").concat(n+a-i*y[2]),y[2]>0&&(x+="A ".concat(y[2],",").concat(y[2],",0,0,").concat(p,`, `).concat(t+s-u*y[2],",").concat(n+a)),x+="L ".concat(t+u*y[3],",").concat(n+a),y[3]>0&&(x+="A ".concat(y[3],",").concat(y[3],",0,0,").concat(p,`, `).concat(t,",").concat(n+a-i*y[3])),x+="Z"}else if(l>0&&o===+o&&o>0){var S=Math.min(l,o);x="M ".concat(t,",").concat(n+i*S,` A `).concat(S,",").concat(S,",0,0,").concat(p,",").concat(t+u*S,",").concat(n,` L `).concat(t+s-u*S,",").concat(n,` A `).concat(S,",").concat(S,",0,0,").concat(p,",").concat(t+s,",").concat(n+i*S,` L `).concat(t+s,",").concat(n+a-i*S,` A `).concat(S,",").concat(S,",0,0,").concat(p,",").concat(t+s-u*S,",").concat(n+a,` L `).concat(t+u*S,",").concat(n+a,` A `).concat(S,",").concat(S,",0,0,").concat(p,",").concat(t,",").concat(n+a-i*S," Z")}else x="M ".concat(t,",").concat(n," h ").concat(s," v ").concat(a," h ").concat(-s," Z");return x},GVt=function(t,n){if(!t||!n)return!1;var s=t.x,a=t.y,o=n.x,l=n.y,i=n.width,u=n.height;if(Math.abs(i)>0&&Math.abs(u)>0){var p=Math.min(o,o+i),x=Math.max(o,o+i),y=Math.min(l,l+u),_=Math.max(l,l+u);return s>=p&&s<=x&&a>=y&&a<=_}return!1},KVt={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},K1e=function(t){var n=vMe(vMe({},KVt),t),s=E.useRef(),a=E.useState(-1),o=zVt(a,2),l=o[0],i=o[1];E.useEffect(function(){if(s.current&&s.current.getTotalLength)try{var z=s.current.getTotalLength();z&&i(z)}catch{}},[]);var u=n.x,p=n.y,x=n.width,y=n.height,_=n.radius,b=n.className,S=n.animationEasing,k=n.animationDuration,M=n.animationBegin,P=n.isAnimationActive,T=n.isUpdateAnimationActive;if(u!==+u||p!==+p||x!==+x||y!==+y||x===0||y===0)return null;var I=ui("recharts-rectangle",b);return T?lt.createElement(By,{canBegin:l>0,from:{width:x,height:y,x:u,y:p},to:{width:x,height:y,x:u,y:p},duration:k,animationEasing:S,isActive:T},function(z){var D=z.width,U=z.height,V=z.x,W=z.y;return lt.createElement(By,{canBegin:l>0,from:"0px ".concat(l===-1?1:l,"px"),to:"".concat(l,"px 0px"),attributeName:"strokeDasharray",begin:M,duration:k,isActive:P,easing:S},lt.createElement("path",Pne({},Ba(n,!0),{className:I,d:_Me(V,W,D,U,_),ref:s})))}):lt.createElement("path",Pne({},Ba(n,!0),{className:I,d:_Me(u,p,x,y,_)}))},ZVt=["points","className","baseLinePoints","connectNulls"];function aS(){return aS=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(n[s]=e[s])}return n}function XVt(e,t){if(e==null)return{};var n={};for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){if(t.indexOf(s)>=0)continue;n[s]=e[s]}return n}function bMe(e){return tHt(e)||eHt(e)||JVt(e)||QVt()}function QVt(){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 JVt(e,t){if(e){if(typeof e=="string")return Nme(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if(n==="Object"&&e.constructor&&(n=e.constructor.name),n==="Map"||n==="Set")return Array.from(e);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Nme(e,t)}}function eHt(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function tHt(e){if(Array.isArray(e))return Nme(e)}function Nme(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,s=new Array(t);n0&&arguments[0]!==void 0?arguments[0]:[],n=[[]];return t.forEach(function(s){wMe(s)?n[n.length-1].push(s):n[n.length-1].length>0&&n.push([])}),wMe(t[0])&&n[n.length-1].push(t[0]),n[n.length-1].length<=0&&(n=n.slice(0,-1)),n},tE=function(t,n){var s=rHt(t);n&&(s=[s.reduce(function(o,l){return[].concat(bMe(o),bMe(l))},[])]);var a=s.map(function(o){return o.reduce(function(l,i,u){return"".concat(l).concat(u===0?"M":"L").concat(i.x,",").concat(i.y)},"")}).join("");return s.length===1?"".concat(a,"Z"):a},nHt=function(t,n,s){var a=tE(t,s);return"".concat(a.slice(-1)==="Z"?a.slice(0,-1):a,"L").concat(tE(n.reverse(),s).slice(1))},sHt=function(t){var n=t.points,s=t.className,a=t.baseLinePoints,o=t.connectNulls,l=YVt(t,ZVt);if(!n||!n.length)return null;var i=ui("recharts-polygon",s);if(a&&a.length){var u=l.stroke&&l.stroke!=="none",p=nHt(n,a,o);return lt.createElement("g",{className:i},lt.createElement("path",aS({},Ba(l,!0),{fill:p.slice(-1)==="Z"?l.fill:"none",stroke:"none",d:p})),u?lt.createElement("path",aS({},Ba(l,!0),{fill:"none",d:tE(n,o)})):null,u?lt.createElement("path",aS({},Ba(l,!0),{fill:"none",d:tE(a,o)})):null)}var x=tE(n,o);return lt.createElement("path",aS({},Ba(l,!0),{fill:x.slice(-1)==="Z"?l.fill:"none",className:i,d:x}))};function Sme(){return Sme=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(n[s]=e[s])}return n}function uHt(e,t){if(e==null)return{};var n={};for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){if(t.indexOf(s)>=0)continue;n[s]=e[s]}return n}var hHt=function(t,n,s,a,o,l){return"M".concat(t,",").concat(o,"v").concat(a,"M").concat(l,",").concat(n,"h").concat(s)},fHt=function(t){var n=t.x,s=n===void 0?0:n,a=t.y,o=a===void 0?0:a,l=t.top,i=l===void 0?0:l,u=t.left,p=u===void 0?0:u,x=t.width,y=x===void 0?0:x,_=t.height,b=_===void 0?0:_,S=t.className,k=dHt(t,aHt),M=iHt({x:s,y:o,top:i,left:p,width:y,height:b},k);return!Dn(s)||!Dn(o)||!Dn(y)||!Dn(b)||!Dn(i)||!Dn(p)?null:lt.createElement("path",Cme({},Ba(M,!0),{className:ui("recharts-cross",S),d:hHt(s,o,y,b,i,p)}))},pHt=yie,mHt=yUe,gHt=ox;function xHt(e,t){return e&&e.length?pHt(e,gHt(t),mHt):void 0}var yHt=xHt;const vHt=Qi(yHt);var _Ht=yie,bHt=ox,wHt=vUe;function jHt(e,t){return e&&e.length?_Ht(e,bHt(t),wHt):void 0}var kHt=jHt;const NHt=Qi(kHt);var SHt=["cx","cy","angle","ticks","axisLine"],CHt=["ticks","tick","angle","tickFormatter","stroke"];function QC(e){"@babel/helpers - typeof";return QC=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},QC(e)}function rE(){return rE=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(n[s]=e[s])}return n}function MHt(e,t){if(e==null)return{};var n={};for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){if(t.indexOf(s)>=0)continue;n[s]=e[s]}return n}function THt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function SMe(e,t){for(var n=0;nTMe?l=a==="outer"?"start":"end":o<-TMe?l=a==="outer"?"end":"start":l="middle",l}},{key:"renderAxisLine",value:function(){var s=this.props,a=s.cx,o=s.cy,l=s.radius,i=s.axisLine,u=s.axisLineType,p=T_(T_({},Ba(this.props,!1)),{},{fill:"none"},Ba(i,!1));if(u==="circle")return lt.createElement(Z1e,Jw({className:"recharts-polar-angle-axis-line"},p,{cx:a,cy:o,r:l}));var x=this.props.ticks,y=x.map(function(_){return ol(a,o,l,_.coordinate)});return lt.createElement(sHt,Jw({className:"recharts-polar-angle-axis-line"},p,{points:y}))}},{key:"renderTicks",value:function(){var s=this,a=this.props,o=a.ticks,l=a.tick,i=a.tickLine,u=a.tickFormatter,p=a.stroke,x=Ba(this.props,!1),y=Ba(l,!1),_=T_(T_({},x),{},{fill:"none"},Ba(i,!1)),b=o.map(function(S,k){var M=s.getTickLineCoord(S),P=s.getTickTextAnchor(S),T=T_(T_(T_({textAnchor:P},x),{},{stroke:"none",fill:p},y),{},{index:k,payload:S,x:M.x2,y:M.y2});return lt.createElement(Ao,Jw({className:ui("recharts-polar-angle-axis-tick",GUe(l)),key:"tick-".concat(S.coordinate)},xk(s.props,S,k)),i&<.createElement("line",Jw({className:"recharts-polar-angle-axis-tick-line"},_,M)),l&&t.renderTickItem(l,T,u?u(S.value,k):S.value))});return lt.createElement(Ao,{className:"recharts-polar-angle-axis-ticks"},b)}},{key:"render",value:function(){var s=this.props,a=s.ticks,o=s.radius,l=s.axisLine;return o<=0||!a||!a.length?null:lt.createElement(Ao,{className:ui("recharts-polar-angle-axis",this.props.className)},l&&this.renderAxisLine(),this.renderTicks())}}],[{key:"renderTickItem",value:function(s,a,o){var l;return lt.isValidElement(s)?l=lt.cloneElement(s,a):Ka(s)?l=s(a):l=lt.createElement(yk,Jw({},a,{className:"recharts-polar-angle-axis-tick-value"}),o),l}}])}(E.PureComponent);Cie(Mie,"displayName","PolarAngleAxis");Cie(Mie,"axisType","angleAxis");Cie(Mie,"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 VHt=p$e,HHt=VHt(Object.getPrototypeOf,Object),WHt=HHt,GHt=qy,KHt=WHt,ZHt=Vy,YHt="[object Object]",XHt=Function.prototype,QHt=Object.prototype,uqe=XHt.toString,JHt=QHt.hasOwnProperty,eWt=uqe.call(Object);function tWt(e){if(!ZHt(e)||GHt(e)!=YHt)return!1;var t=KHt(e);if(t===null)return!0;var n=JHt.call(t,"constructor")&&t.constructor;return typeof n=="function"&&n instanceof n&&uqe.call(n)==eWt}var rWt=tWt;const nWt=Qi(rWt);var sWt=qy,aWt=Vy,iWt="[object Boolean]";function oWt(e){return e===!0||e===!1||aWt(e)&&sWt(e)==iWt}var lWt=oWt;const cWt=Qi(lWt);function NI(e){"@babel/helpers - typeof";return NI=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},NI(e)}function Dne(){return Dne=Object.assign?Object.assign.bind():function(e){for(var t=1;te.length)&&(t=e.length);for(var n=0,s=new Array(t);n0,from:{upperWidth:0,lowerWidth:0,height:_,x:u,y:p},to:{upperWidth:x,lowerWidth:y,height:_,x:u,y:p},duration:k,animationEasing:S,isActive:P},function(I){var z=I.upperWidth,D=I.lowerWidth,U=I.height,V=I.x,W=I.y;return lt.createElement(By,{canBegin:l>0,from:"0px ".concat(l===-1?1:l,"px"),to:"".concat(l,"px 0px"),attributeName:"strokeDasharray",begin:M,duration:k,easing:S},lt.createElement("path",Dne({},Ba(n,!0),{className:T,d:PMe(V,W,z,D,U),ref:s})))}):lt.createElement("g",null,lt.createElement("path",Dne({},Ba(n,!0),{className:T,d:PMe(u,p,x,y,_)})))},_Wt=["option","shapeType","propTransformer","activeClassName","isActive"];function SI(e){"@babel/helpers - typeof";return SI=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},SI(e)}function bWt(e,t){if(e==null)return{};var n=wWt(e,t),s,a;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(n[s]=e[s])}return n}function wWt(e,t){if(e==null)return{};var n={};for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){if(t.indexOf(s)>=0)continue;n[s]=e[s]}return n}function LMe(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,s)}return n}function Rne(e){for(var t=1;t0?wf(I,"paddingAngle",0):0;if(D){var V=r1(D.endAngle-D.startAngle,I.endAngle-I.startAngle),W=sl(sl({},I),{},{startAngle:T+U,endAngle:T+V(k)+U});M.push(W),T=W.endAngle}else{var G=I.endAngle,J=I.startAngle,ne=r1(0,G-J),oe=ne(k),ge=sl(sl({},I),{},{startAngle:T+U,endAngle:T+oe+U});M.push(ge),T=ge.endAngle}}),lt.createElement(Ao,null,s.renderSectorsStatically(M))})}},{key:"attachKeyboardHandlers",value:function(s){var a=this;s.onkeydown=function(o){if(!o.altKey)switch(o.key){case"ArrowLeft":{var l=++a.state.sectorToFocus%a.sectorRefs.length;a.sectorRefs[l].focus(),a.setState({sectorToFocus:l});break}case"ArrowRight":{var i=--a.state.sectorToFocus<0?a.sectorRefs.length-1:a.state.sectorToFocus%a.sectorRefs.length;a.sectorRefs[i].focus(),a.setState({sectorToFocus:i});break}case"Escape":{a.sectorRefs[a.state.sectorToFocus].blur(),a.setState({sectorToFocus:0});break}}}}},{key:"renderSectors",value:function(){var s=this.props,a=s.sectors,o=s.isAnimationActive,l=this.state.prevSectors;return o&&a&&a.length&&(!l||!bie(l,a))?this.renderSectorsWithAnimation():this.renderSectorsStatically(a)}},{key:"componentDidMount",value:function(){this.pieRef&&this.attachKeyboardHandlers(this.pieRef)}},{key:"render",value:function(){var s=this,a=this.props,o=a.hide,l=a.sectors,i=a.className,u=a.label,p=a.cx,x=a.cy,y=a.innerRadius,_=a.outerRadius,b=a.isAnimationActive,S=this.state.isAnimationFinished;if(o||!l||!l.length||!Dn(p)||!Dn(x)||!Dn(y)||!Dn(_))return null;var k=ui("recharts-pie",i);return lt.createElement(Ao,{tabIndex:this.props.rootTabIndex,className:k,ref:function(P){s.pieRef=P}},this.renderSectors(),u&&this.renderLabels(l),Ed.renderCallByParent(this.props,null,!1),(!b||S)&&iv.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)*u,z=M-T*b-I,D=a.reduce(function(W,G){var J=vu(G,P,0);return W+(Dn(J)?J:0)},0),U;if(D>0){var V;U=a.map(function(W,G){var J=vu(W,P,0),ne=vu(W,x,G),oe=(Dn(J)?J:0)/D,ge;G?ge=V.endAngle+Ku(k)*u*(J!==0?1:0):ge=l;var ie=ge+Ku(k)*((J!==0?b:0)+oe*z),pe=(ge+ie)/2,se=(S.innerRadius+S.outerRadius)/2,fe=[{name:ne,value:J,payload:W,dataKey:P,type:_}],he=ol(S.cx,S.cy,se,pe);return V=sl(sl(sl({percent:oe,cornerRadius:o,name:ne,tooltipPayload:fe,midAngle:pe,middleRadius:se,tooltipPosition:he},W),S),{},{value:vu(W,P),startAngle:ge,endAngle:ie,payload:W,paddingAngle:Ku(k)*u}),V})}return sl(sl({},S),{},{sectors:U,data:a})});var qWt=Math.ceil,VWt=Math.max;function HWt(e,t,n,s){for(var a=-1,o=VWt(qWt((t-e)/(n||1)),0),l=Array(o);o--;)l[s?o:++a]=e,e+=n;return l}var WWt=HWt,GWt=P$e,FMe=1/0,KWt=17976931348623157e292;function ZWt(e){if(!e)return e===0?e:0;if(e=GWt(e),e===FMe||e===-FMe){var t=e<0?-1:1;return t*KWt}return e===e?e:0}var mqe=ZWt,YWt=WWt,XWt=die,lue=mqe;function QWt(e){return function(t,n,s){return s&&typeof s!="number"&&XWt(t,n,s)&&(n=s=void 0),t=lue(t),n===void 0?(n=t,t=0):n=lue(n),s=s===void 0?t0&&s.handleDrag(a.changedTouches[0])}),Xh(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()}),Xh(s,"handleLeaveWrapper",function(){(s.state.isTravellerMoving||s.state.isSlideMoving)&&(s.leaveTimer=window.setTimeout(s.handleDragEnd,s.props.leaveTimeOut))}),Xh(s,"handleEnterSlideOrTraveller",function(){s.setState({isTextActive:!0})}),Xh(s,"handleLeaveSlideOrTraveller",function(){s.setState({isTextActive:!1})}),Xh(s,"handleSlideDragStart",function(a){var o=qMe(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 hGt(t,e),lGt(t,[{key:"componentWillUnmount",value:function(){this.leaveTimer&&(clearTimeout(this.leaveTimer),this.leaveTimer=null),this.detachDragEndListener()}},{key:"getIndex",value:function(s){var a=s.startX,o=s.endX,l=this.state.scaleValues,i=this.props,u=i.gap,p=i.data,x=p.length-1,y=Math.min(a,o),_=Math.max(a,o),b=t.getIndexInRange(l,y),S=t.getIndexInRange(l,_);return{startIndex:b-b%u,endIndex:S===x?x:S-S%u}}},{key:"getTextOfTick",value:function(s){var a=this.props,o=a.data,l=a.tickFormatter,i=a.dataKey,u=vu(o[s],i,s);return Ka(l)?l(u,s):u}},{key:"attachDragEndListener",value:function(){window.addEventListener("mouseup",this.handleDragEnd,!0),window.addEventListener("touchend",this.handleDragEnd,!0),window.addEventListener("mousemove",this.handleDrag,!0)}},{key:"detachDragEndListener",value:function(){window.removeEventListener("mouseup",this.handleDragEnd,!0),window.removeEventListener("touchend",this.handleDragEnd,!0),window.removeEventListener("mousemove",this.handleDrag,!0)}},{key:"handleSlideDrag",value:function(s){var a=this.state,o=a.slideMoveStartX,l=a.startX,i=a.endX,u=this.props,p=u.x,x=u.width,y=u.travellerWidth,_=u.startIndex,b=u.endIndex,S=u.onChange,k=s.pageX-o;k>0?k=Math.min(k,p+x-y-i,p+x-y-l):k<0&&(k=Math.max(k,p-l,p-i));var M=this.getIndex({startX:l+k,endX:i+k});(M.startIndex!==_||M.endIndex!==b)&&S&&S(M),this.setState({startX:l+k,endX:i+k,slideMoveStartX:s.pageX})}},{key:"handleTravellerDragStart",value:function(s,a){var o=qMe(a)?a.changedTouches[0]:a;this.setState({isSlideMoving:!1,isTravellerMoving:!0,movingTravellerId:s,brushMoveStartX:o.pageX}),this.attachDragEndListener()}},{key:"handleTravellerMove",value:function(s){var a=this.state,o=a.brushMoveStartX,l=a.movingTravellerId,i=a.endX,u=a.startX,p=this.state[l],x=this.props,y=x.x,_=x.width,b=x.travellerWidth,S=x.onChange,k=x.gap,M=x.data,P={startX:this.state.startX,endX:this.state.endX},T=s.pageX-o;T>0?T=Math.min(T,y+_-b-p):T<0&&(T=Math.max(T,y-p)),P[l]=p+T;var I=this.getIndex(P),z=I.startIndex,D=I.endIndex,U=function(){var W=M.length-1;return l==="startX"&&(i>u?z%k===0:D%k===0)||iu?D%k===0:z%k===0)||i>u&&D===W};this.setState(Xh(Xh({},l,p+T),"brushMoveStartX",s.pageX),function(){S&&U()&&S(I)})}},{key:"handleTravellerMoveKeyboard",value:function(s,a){var o=this,l=this.state,i=l.scaleValues,u=l.startX,p=l.endX,x=this.state[a],y=i.indexOf(x);if(y!==-1){var _=y+s;if(!(_===-1||_>=i.length)){var b=i[_];a==="startX"&&b>=p||a==="endX"&&b<=u||this.setState(Xh({},a,b),function(){o.props.onChange(o.getIndex({startX:o.state.startX,endX:o.state.endX}))})}}}},{key:"renderBackground",value:function(){var s=this.props,a=s.x,o=s.y,l=s.width,i=s.height,u=s.fill,p=s.stroke;return lt.createElement("rect",{stroke:p,fill:u,x:a,y:o,width:l,height:i})}},{key:"renderPanorama",value:function(){var s=this.props,a=s.x,o=s.y,l=s.width,i=s.height,u=s.data,p=s.children,x=s.padding,y=E.Children.only(p);return y?lt.cloneElement(y,{x:a,y:o,width:l,height:i,margin:x,compact:!0,data:u}):null}},{key:"renderTravellerLayer",value:function(s,a){var o,l,i=this,u=this.props,p=u.y,x=u.travellerWidth,y=u.height,_=u.traveller,b=u.ariaLabel,S=u.data,k=u.startIndex,M=u.endIndex,P=Math.max(s,this.props.x),T=cue(cue({},Ba(this.props,!1)),{},{x:P,y:p,width:x,height:y}),I=b||"Min value: ".concat((o=S[k])===null||o===void 0?void 0:o.name,", Max value: ").concat((l=S[M])===null||l===void 0?void 0:l.name);return lt.createElement(Ao,{tabIndex:0,role:"slider","aria-label":I,"aria-valuenow":s,className:"recharts-brush-traveller",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.travellerDragStartHandlers[a],onTouchStart:this.travellerDragStartHandlers[a],onKeyDown:function(D){["ArrowLeft","ArrowRight"].includes(D.key)&&(D.preventDefault(),D.stopPropagation(),i.handleTravellerMoveKeyboard(D.key==="ArrowRight"?1:-1,a))},onFocus:function(){i.setState({isTravellerFocused:!0})},onBlur:function(){i.setState({isTravellerFocused:!1})},style:{cursor:"col-resize"}},t.renderTraveller(_,T))}},{key:"renderSlide",value:function(s,a){var o=this.props,l=o.y,i=o.height,u=o.stroke,p=o.travellerWidth,x=Math.min(s,a)+p,y=Math.max(Math.abs(a-s)-p,0);return lt.createElement("rect",{className:"recharts-brush-slide",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.handleSlideDragStart,onTouchStart:this.handleSlideDragStart,style:{cursor:"move"},stroke:"none",fill:u,fillOpacity:.2,x,y:l,width:y,height:i})}},{key:"renderText",value:function(){var s=this.props,a=s.startIndex,o=s.endIndex,l=s.y,i=s.height,u=s.travellerWidth,p=s.stroke,x=this.state,y=x.startX,_=x.endX,b=5,S={pointerEvents:"none",fill:p};return lt.createElement(Ao,{className:"recharts-brush-texts"},lt.createElement(yk,Bne({textAnchor:"end",verticalAnchor:"middle",x:Math.min(y,_)-b,y:l+i/2},S),this.getTextOfTick(a)),lt.createElement(yk,Bne({textAnchor:"start",verticalAnchor:"middle",x:Math.max(y,_)+u+b,y:l+i/2},S),this.getTextOfTick(o)))}},{key:"render",value:function(){var s=this.props,a=s.data,o=s.className,l=s.children,i=s.x,u=s.y,p=s.width,x=s.height,y=s.alwaysShowText,_=this.state,b=_.startX,S=_.endX,k=_.isTextActive,M=_.isSlideMoving,P=_.isTravellerMoving,T=_.isTravellerFocused;if(!a||!a.length||!Dn(i)||!Dn(u)||!Dn(p)||!Dn(x)||p<=0||x<=0)return null;var I=ui("recharts-brush",o),z=lt.Children.count(l)===1,D=iGt("userSelect","none");return lt.createElement(Ao,{className:I,onMouseLeave:this.handleLeaveWrapper,onTouchMove:this.handleTouchMove,style:D},this.renderBackground(),z&&this.renderPanorama(),this.renderSlide(b,S),this.renderTravellerLayer(b,"startX"),this.renderTravellerLayer(S,"endX"),(k||M||P||T||y)&&this.renderText())}}],[{key:"renderDefaultTraveller",value:function(s){var a=s.x,o=s.y,l=s.width,i=s.height,u=s.stroke,p=Math.floor(o+i/2)-1;return lt.createElement(lt.Fragment,null,lt.createElement("rect",{x:a,y:o,width:l,height:i,fill:u,stroke:"none"}),lt.createElement("line",{x1:a+1,y1:p,x2:a+l-1,y2:p,fill:"none",stroke:"#fff"}),lt.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 lt.isValidElement(s)?o=lt.cloneElement(s,a):Ka(s)?o=s(a):o=t.renderDefaultTraveller(a),o}},{key:"getDerivedStateFromProps",value:function(s,a){var o=s.data,l=s.width,i=s.x,u=s.travellerWidth,p=s.updateId,x=s.startIndex,y=s.endIndex;if(o!==a.prevData||p!==a.prevUpdateId)return cue({prevData:o,prevTravellerWidth:u,prevUpdateId:p,prevX:i,prevWidth:l},o&&o.length?pGt({data:o,width:l,x:i,travellerWidth:u,startIndex:x,endIndex:y}):{scale:null,scaleValues:null});if(a.scale&&(l!==a.prevWidth||i!==a.prevX||u!==a.prevTravellerWidth)){a.scale.range([i,i+l-u]);var _=a.scale.domain().map(function(b){return a.scale(b)});return{prevData:o,prevTravellerWidth:u,prevUpdateId:p,prevX:i,prevWidth:l,startX:a.scale(s.startIndex),endX:a.scale(s.endIndex),scaleValues:_}}return null}},{key:"getIndexInRange",value:function(s,a){for(var o=s.length,l=0,i=o-1;i-l>1;){var u=Math.floor((l+i)/2);s[u]>a?i=u:l=u}return a>=s[i]?i:l}}])}(E.PureComponent);Xh(r3,"displayName","Brush");Xh(r3,"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 mGt=_1e;function gGt(e,t){var n;return mGt(e,function(s,a,o){return n=t(s,a,o),!n}),!!n}var xGt=gGt,yGt=i$e,vGt=ox,_Gt=xGt,bGt=Fh,wGt=die;function jGt(e,t,n){var s=bGt(e)?yGt:_Gt;return n&&wGt(e,t,n)&&(t=void 0),s(e,vGt(t))}var kGt=jGt;const NGt=Qi(kGt);var Wg=function(t,n){var s=t.alwaysShow,a=t.ifOverflow;return s&&(a="extendDomain"),a===n},VMe=M$e;function SGt(e,t,n){t=="__proto__"&&VMe?VMe(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}var CGt=SGt,MGt=CGt,TGt=S$e,AGt=ox;function EGt(e,t){var n={};return t=AGt(t),TGt(e,function(s,a,o){MGt(n,a,t(s,a,o))}),n}var IGt=EGt;const PGt=Qi(IGt);function LGt(e,t){for(var n=-1,s=e==null?0:e.length;++n=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(n[s]=e[s])}return n}function XGt(e,t){if(e==null)return{};var n={};for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){if(t.indexOf(s)>=0)continue;n[s]=e[s]}return n}function QGt(e,t){var n=e.x,s=e.y,a=YGt(e,WGt),o="".concat(n),l=parseInt(o,10),i="".concat(s),u=parseInt(i,10),p="".concat(t.height||a.height),x=parseInt(p,10),y="".concat(t.width||a.width),_=parseInt(y,10);return kT(kT(kT(kT(kT({},t),a),l?{x:l}:{}),u?{y:u}:{}),{},{height:x,width:_,name:t.name,radius:t.radius})}function WMe(e){return lt.createElement(hqe,Ime({shapeType:"rectangle",propTransformer:QGt,activeClassName:"recharts-active-bar"},e))}var JGt=function(t){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return function(s,a){if(typeof t=="number")return t;var o=Dn(s)||NAt(s);return o?t(s,a):(o||_k(),n)}},eKt=["value","background"],_qe;function n3(e){"@babel/helpers - typeof";return n3=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n3(e)}function tKt(e,t){if(e==null)return{};var n=rKt(e,t),s,a;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(a=0;a=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(n[s]=e[s])}return n}function rKt(e,t){if(e==null)return{};var n={};for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){if(t.indexOf(s)>=0)continue;n[s]=e[s]}return n}function Une(){return Une=Object.assign?Object.assign.bind():function(e){for(var t=1;t0&&Math.abs(pe)0&&Math.abs(ie)0&&(ge=Math.min((Je||0)-(ie[Te-1]||0),ge))}),Number.isFinite(ge)){var pe=ge/oe,se=k.layout==="vertical"?s.height:s.width;if(k.padding==="gap"&&(V=pe*se/2),k.padding==="no-gap"){var fe=Zu(t.barCategoryGap,pe*se),he=pe*se/2;V=he-fe-(he-fe)/se*fe}}}a==="xAxis"?W=[s.left+(I.left||0)+(V||0),s.left+s.width-(I.right||0)-(V||0)]:a==="yAxis"?W=u==="horizontal"?[s.top+s.height-(I.bottom||0),s.top+(I.top||0)]:[s.top+(I.top||0)+(V||0),s.top+s.height-(I.bottom||0)-(V||0)]:W=k.range,D&&(W=[W[1],W[0]]);var ye=BUe(k,o,_),Ae=ye.scale,we=ye.realScaleType;Ae.domain(P).range(W),$Ue(Ae);var be=UUe(Ae,hm(hm({},k),{},{realScaleType:we}));a==="xAxis"?(ne=M==="top"&&!z||M==="bottom"&&z,G=s.left,J=y[U]-ne*k.height):a==="yAxis"&&(ne=M==="left"&&!z||M==="right"&&z,G=y[U]-ne*k.width,J=s.top);var _e=hm(hm(hm({},k),be),{},{realScaleType:we,x:G,y:J,scale:Ae,width:a==="xAxis"?s.width:k.width,height:a==="yAxis"?s.height:k.height});return _e.bandSize=Cne(_e,be),!k.hide&&a==="xAxis"?y[U]+=(ne?-1:1)*_e.height:k.hide||(y[U]+=(ne?-1:1)*_e.width),hm(hm({},b),{},Eie({},S,_e))},{})},kqe=function(t,n){var s=t.x,a=t.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)}},pKt=function(t){var n=t.x1,s=t.y1,a=t.x2,o=t.y2;return kqe({x:n,y:s},{x:a,y:o})},Nqe=function(){function e(t){dKt(this,e),this.scale=t}return uKt(e,[{key:"domain",get:function(){return this.scale.domain}},{key:"range",get:function(){return this.scale.range}},{key:"rangeMin",get:function(){return this.range()[0]}},{key:"rangeMax",get:function(){return this.range()[1]}},{key:"bandwidth",get:function(){return this.scale.bandwidth}},{key:"apply",value:function(n){var s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},a=s.bandAware,o=s.position;if(n!==void 0){if(o)switch(o){case"start":return this.scale(n);case"middle":{var l=this.bandwidth?this.bandwidth()/2:0;return this.scale(n)+l}case"end":{var i=this.bandwidth?this.bandwidth():0;return this.scale(n)+i}default:return this.scale(n)}if(a){var u=this.bandwidth?this.bandwidth()/2:0;return this.scale(n)+u}return this.scale(n)}}},{key:"isInRange",value:function(n){var s=this.range(),a=s[0],o=s[s.length-1];return a<=o?n>=a&&n<=o:n>=o&&n<=a}}],[{key:"create",value:function(n){return new e(n)}}])}();Eie(Nqe,"EPS",1e-4);var Y1e=function(t){var n=Object.keys(t).reduce(function(s,a){return hm(hm({},s),{},Eie({},a,Nqe.create(t[a])))},{});return hm(hm({},n),{},{apply:function(a){var o=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},l=o.bandAware,i=o.position;return PGt(a,function(u,p){return n[p].apply(u,{bandAware:l,position:i})})},isInRange:function(a){return vqe(a,function(o,l){return n[l].isInRange(o)})}})};function mKt(e){return(e%180+180)%180}var gKt=function(t){var n=t.width,s=t.height,a=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,o=mKt(a),l=o*Math.PI/180,i=Math.atan(s/n),u=l>i&&l-1?a[o?t[l]:l]:void 0}}var bKt=_Kt,wKt=mqe;function jKt(e){var t=wKt(e),n=t%1;return t===t?n?t-n:t:0}var kKt=jKt,NKt=_$e,SKt=ox,CKt=kKt,MKt=Math.max;function TKt(e,t,n){var s=e==null?0:e.length;if(!s)return-1;var a=n==null?0:CKt(n);return a<0&&(a=MKt(s+a,0)),NKt(e,SKt(t),a)}var AKt=TKt,EKt=bKt,IKt=AKt,PKt=EKt(IKt),LKt=PKt;const OKt=Qi(LKt);var DKt=ETt(function(e){return{x:e.left,y:e.top,width:e.width,height:e.height}},function(e){return["l",e.left,"t",e.top,"w",e.width,"h",e.height].join("")}),X1e=E.createContext(void 0),Q1e=E.createContext(void 0),Sqe=E.createContext(void 0),Cqe=E.createContext({}),Mqe=E.createContext(void 0),Tqe=E.createContext(0),Aqe=E.createContext(0),XMe=function(t){var n=t.state,s=n.xAxisMap,a=n.yAxisMap,o=n.offset,l=t.clipPathId,i=t.children,u=t.width,p=t.height,x=DKt(o);return lt.createElement(X1e.Provider,{value:s},lt.createElement(Q1e.Provider,{value:a},lt.createElement(Cqe.Provider,{value:o},lt.createElement(Sqe.Provider,{value:x},lt.createElement(Mqe.Provider,{value:l},lt.createElement(Tqe.Provider,{value:p},lt.createElement(Aqe.Provider,{value:u},i)))))))},RKt=function(){return E.useContext(Mqe)},Eqe=function(t){var n=E.useContext(X1e);n==null&&_k();var s=n[t];return s==null&&_k(),s},FKt=function(){var t=E.useContext(X1e);return d1(t)},zKt=function(){var t=E.useContext(Q1e),n=OKt(t,function(s){return vqe(s.domain,Number.isFinite)});return n||d1(t)},Iqe=function(t){var n=E.useContext(Q1e);n==null&&_k();var s=n[t];return s==null&&_k(),s},BKt=function(){var t=E.useContext(Sqe);return t},$Kt=function(){return E.useContext(Cqe)},J1e=function(){return E.useContext(Aqe)},eve=function(){return E.useContext(Tqe)};function s3(e){"@babel/helpers - typeof";return s3=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},s3(e)}function UKt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function qKt(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,s=new Array(t);ne*a)return!1;var o=n();return e*(t-e*o/2-s)>=0&&e*(t+e*o/2-a)<=0}function kZt(e,t){return zqe(e,t+1)}function NZt(e,t,n,s,a){for(var o=(s||[]).slice(),l=t.start,i=t.end,u=0,p=1,x=l,y=function(){var S=s==null?void 0:s[u];if(S===void 0)return{v:zqe(s,p)};var k=u,M,P=function(){return M===void 0&&(M=n(S,k)),M},T=S.coordinate,I=u===0||Gne(e,T,P,x,i);I||(u=0,x=l,p+=1),I&&(x=T+e*(P()/2+a),u+=p)},_;p<=o.length;)if(_=y(),_)return _.v;return[]}function EI(e){"@babel/helpers - typeof";return EI=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},EI(e)}function aTe(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,s)}return n}function gu(e){for(var t=1;t0?b.coordinate-M*e:b.coordinate})}else o[_]=b=gu(gu({},b),{},{tickCoord:b.coordinate});var P=Gne(e,b.tickCoord,k,i,u);P&&(u=b.tickCoord-e*(k()/2+a),o[_]=gu(gu({},b),{},{isShow:!0}))},x=l-1;x>=0;x--)p(x);return o}function AZt(e,t,n,s,a,o){var l=(s||[]).slice(),i=l.length,u=t.start,p=t.end;if(o){var x=s[i-1],y=n(x,i-1),_=e*(x.coordinate+e*y/2-p);l[i-1]=x=gu(gu({},x),{},{tickCoord:_>0?x.coordinate-_*e:x.coordinate});var b=Gne(e,x.tickCoord,function(){return y},u,p);b&&(p=x.tickCoord-e*(y/2+a),l[i-1]=gu(gu({},x),{},{isShow:!0}))}for(var S=o?i-1:i,k=function(T){var I=l[T],z,D=function(){return z===void 0&&(z=n(I,T)),z};if(T===0){var U=e*(I.coordinate-e*D()/2-u);l[T]=I=gu(gu({},I),{},{tickCoord:U<0?I.coordinate-U*e:I.coordinate})}else l[T]=I=gu(gu({},I),{},{tickCoord:I.coordinate});var V=Gne(e,I.tickCoord,D,u,p);V&&(u=I.tickCoord+e*(D()/2+a),l[T]=gu(gu({},I),{},{isShow:!0}))},M=0;M=2?Ku(a[1].coordinate-a[0].coordinate):1,P=jZt(o,M,b);return u==="equidistantPreserveStart"?NZt(M,P,k,a,l):(u==="preserveStart"||u==="preserveStartEnd"?_=AZt(M,P,k,a,l,u==="preserveStartEnd"):_=TZt(M,P,k,a,l),_.filter(function(T){return T.isShow}))}var EZt=["viewBox"],IZt=["viewBox"],PZt=["ticks"];function o3(e){"@babel/helpers - typeof";return o3=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},o3(e)}function oS(){return oS=Object.assign?Object.assign.bind():function(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(n[s]=e[s])}return n}function LZt(e,t){if(e==null)return{};var n={};for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){if(t.indexOf(s)>=0)continue;n[s]=e[s]}return n}function OZt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function oTe(e,t){for(var n=0;n0?u(this.props):u(b)),l<=0||i<=0||!S||!S.length?null:lt.createElement(Ao,{className:ui("recharts-cartesian-axis",p),ref:function(M){s.layerReference=M}},o&&this.renderAxisLine(),this.renderTicks(S,this.state.fontSize,this.state.letterSpacing),Ed.renderCallByParent(this.props))}}],[{key:"renderTickItem",value:function(s,a,o){var l,i=ui(a.className,"recharts-cartesian-axis-tick-value");return lt.isValidElement(s)?l=lt.cloneElement(s,Qc(Qc({},a),{},{className:i})):Ka(s)?l=s(Qc(Qc({},a),{},{className:i})):l=lt.createElement(yk,oS({},a,{className:"recharts-cartesian-axis-tick-value"}),o),l}}])}(E.Component);sve(Q3,"displayName","CartesianAxis");sve(Q3,"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 UZt=["x1","y1","x2","y2","key"],qZt=["offset"];function bk(e){"@babel/helpers - typeof";return bk=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},bk(e)}function lTe(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(a){return Object.getOwnPropertyDescriptor(e,a).enumerable})),n.push.apply(n,s)}return n}function yu(e){for(var t=1;t=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(n[s]=e[s])}return n}function GZt(e,t){if(e==null)return{};var n={};for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){if(t.indexOf(s)>=0)continue;n[s]=e[s]}return n}var KZt=function(t){var n=t.fill;if(!n||n==="none")return null;var s=t.fillOpacity,a=t.x,o=t.y,l=t.width,i=t.height,u=t.ry;return lt.createElement("rect",{x:a,y:o,ry:u,width:l,height:i,stroke:"none",fill:n,fillOpacity:s,className:"recharts-cartesian-grid-bg"})};function Uqe(e,t){var n;if(lt.isValidElement(e))n=lt.cloneElement(e,t);else if(Ka(e))n=e(t);else{var s=t.x1,a=t.y1,o=t.x2,l=t.y2,i=t.key,u=cTe(t,UZt),p=Ba(u,!1);p.offset;var x=cTe(p,qZt);n=lt.createElement("line",fj({},x,{x1:s,y1:a,x2:o,y2:l,fill:"none",key:i}))}return n}function ZZt(e){var t=e.x,n=e.width,s=e.horizontal,a=s===void 0?!0:s,o=e.horizontalPoints;if(!a||!o||!o.length)return null;var l=o.map(function(i,u){var p=yu(yu({},e),{},{x1:t,y1:i,x2:t+n,y2:i,key:"line-".concat(u),index:u});return Uqe(a,p)});return lt.createElement("g",{className:"recharts-cartesian-grid-horizontal"},l)}function YZt(e){var t=e.y,n=e.height,s=e.vertical,a=s===void 0?!0:s,o=e.verticalPoints;if(!a||!o||!o.length)return null;var l=o.map(function(i,u){var p=yu(yu({},e),{},{x1:i,y1:t,x2:i,y2:t+n,key:"line-".concat(u),index:u});return Uqe(a,p)});return lt.createElement("g",{className:"recharts-cartesian-grid-vertical"},l)}function XZt(e){var t=e.horizontalFill,n=e.fillOpacity,s=e.x,a=e.y,o=e.width,l=e.height,i=e.horizontalPoints,u=e.horizontal,p=u===void 0?!0:u;if(!p||!t||!t.length)return null;var x=i.map(function(_){return Math.round(_+a-a)}).sort(function(_,b){return _-b});a!==x[0]&&x.unshift(0);var y=x.map(function(_,b){var S=!x[b+1],k=S?a+l-_:x[b+1]-_;if(k<=0)return null;var M=b%t.length;return lt.createElement("rect",{key:"react-".concat(b),y:_,x:s,height:k,width:o,stroke:"none",fill:t[M],fillOpacity:n,className:"recharts-cartesian-grid-bg"})});return lt.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},y)}function QZt(e){var t=e.vertical,n=t===void 0?!0:t,s=e.verticalFill,a=e.fillOpacity,o=e.x,l=e.y,i=e.width,u=e.height,p=e.verticalPoints;if(!n||!s||!s.length)return null;var x=p.map(function(_){return Math.round(_+o-o)}).sort(function(_,b){return _-b});o!==x[0]&&x.unshift(0);var y=x.map(function(_,b){var S=!x[b+1],k=S?o+i-_:x[b+1]-_;if(k<=0)return null;var M=b%s.length;return lt.createElement("rect",{key:"react-".concat(b),x:_,y:l,width:k,height:u,stroke:"none",fill:s[M],fillOpacity:a,className:"recharts-cartesian-grid-bg"})});return lt.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},y)}var JZt=function(t,n){var s=t.xAxis,a=t.width,o=t.height,l=t.offset;return zUe(nve(yu(yu(yu({},Q3.defaultProps),s),{},{ticks:ny(s,!0),viewBox:{x:0,y:0,width:a,height:o}})),l.left,l.left+l.width,n)},eYt=function(t,n){var s=t.yAxis,a=t.width,o=t.height,l=t.offset;return zUe(nve(yu(yu(yu({},Q3.defaultProps),s),{},{ticks:ny(s,!0),viewBox:{x:0,y:0,width:a,height:o}})),l.top,l.top+l.height,n)},O4={horizontal:!0,vertical:!0,stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[]};function qqe(e){var t,n,s,a,o,l,i=J1e(),u=eve(),p=$Kt(),x=yu(yu({},e),{},{stroke:(t=e.stroke)!==null&&t!==void 0?t:O4.stroke,fill:(n=e.fill)!==null&&n!==void 0?n:O4.fill,horizontal:(s=e.horizontal)!==null&&s!==void 0?s:O4.horizontal,horizontalFill:(a=e.horizontalFill)!==null&&a!==void 0?a:O4.horizontalFill,vertical:(o=e.vertical)!==null&&o!==void 0?o:O4.vertical,verticalFill:(l=e.verticalFill)!==null&&l!==void 0?l:O4.verticalFill,x:Dn(e.x)?e.x:p.left,y:Dn(e.y)?e.y:p.top,width:Dn(e.width)?e.width:p.width,height:Dn(e.height)?e.height:p.height}),y=x.x,_=x.y,b=x.width,S=x.height,k=x.syncWithTicks,M=x.horizontalValues,P=x.verticalValues,T=FKt(),I=zKt();if(!Dn(b)||b<=0||!Dn(S)||S<=0||!Dn(y)||y!==+y||!Dn(_)||_!==+_)return null;var z=x.verticalCoordinatesGenerator||JZt,D=x.horizontalCoordinatesGenerator||eYt,U=x.horizontalPoints,V=x.verticalPoints;if((!U||!U.length)&&Ka(D)){var W=M&&M.length,G=D({yAxis:I?yu(yu({},I),{},{ticks:W?M:I.ticks}):void 0,width:i,height:u,offset:p},W?!0:k);Lm(Array.isArray(G),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(bk(G),"]")),Array.isArray(G)&&(U=G)}if((!V||!V.length)&&Ka(z)){var J=P&&P.length,ne=z({xAxis:T?yu(yu({},T),{},{ticks:J?P:T.ticks}):void 0,width:i,height:u,offset:p},J?!0:k);Lm(Array.isArray(ne),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(bk(ne),"]")),Array.isArray(ne)&&(V=ne)}return lt.createElement("g",{className:"recharts-cartesian-grid"},lt.createElement(KZt,{fill:x.fill,fillOpacity:x.fillOpacity,x:x.x,y:x.y,width:x.width,height:x.height,ry:x.ry}),lt.createElement(ZZt,fj({},x,{offset:p,horizontalPoints:U,xAxis:T,yAxis:I})),lt.createElement(YZt,fj({},x,{offset:p,verticalPoints:V,xAxis:T,yAxis:I})),lt.createElement(XZt,fj({},x,{horizontalPoints:U})),lt.createElement(QZt,fj({},x,{verticalPoints:V})))}qqe.displayName="CartesianGrid";function l3(e){"@babel/helpers - typeof";return l3=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},l3(e)}function tYt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function rYt(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,s=new Array(t);n=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(n[s]=e[s])}return n}function UYt(e,t){if(e==null)return{};var n={};for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)){if(t.indexOf(s)>=0)continue;n[s]=e[s]}return n}function qYt(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function VYt(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,s=new Array(t);n0?l:t&&t.length&&Dn(a)&&Dn(o)?t.slice(a,o+1):[]};function nVe(e){return e==="number"?[0,"auto"]:void 0}var Zme=function(t,n,s,a){var o=t.graphicalItems,l=t.tooltipAxis,i=Fie(n,t);return s<0||!o||!o.length||s>=i.length?null:o.reduce(function(u,p){var x,y=(x=p.props.data)!==null&&x!==void 0?x:n;y&&t.dataStartIndex+t.dataEndIndex!==0&&t.dataEndIndex-t.dataStartIndex>=s&&(y=y.slice(t.dataStartIndex,t.dataEndIndex+1));var _;if(l.dataKey&&!l.allowDuplicatedCategory){var b=y===void 0?i:y;_=wpe(b,l.dataKey,a)}else _=y&&y[s]||i[s];return _?[].concat(u3(u),[VUe(p,_)]):u},[])},mTe=function(t,n,s,a){var o=a||{x:t.chartX,y:t.chartY},l=rXt(o,s),i=t.orderedTooltipTicks,u=t.tooltipAxis,p=t.tooltipTicks,x=R$t(l,i,p,u);if(x>=0&&p){var y=p[x]&&p[x].value,_=Zme(t,n,x,y),b=nXt(s,i,x,o);return{activeTooltipIndex:x,activeLabel:y,activePayload:_,activeCoordinate:b}}return null},sXt=function(t,n){var s=n.axes,a=n.graphicalItems,o=n.axisType,l=n.axisIdKey,i=n.stackGroups,u=n.dataStartIndex,p=n.dataEndIndex,x=t.layout,y=t.children,_=t.stackOffset,b=FUe(x,o);return s.reduce(function(S,k){var M,P=k.type.defaultProps!==void 0?Jr(Jr({},k.type.defaultProps),k.props):k.props,T=P.type,I=P.dataKey,z=P.allowDataOverflow,D=P.allowDuplicatedCategory,U=P.scale,V=P.ticks,W=P.includeHidden,G=P[l];if(S[G])return S;var J=Fie(t.data,{graphicalItems:a.filter(function(be){var _e,Je=l in be.props?be.props[l]:(_e=be.type.defaultProps)===null||_e===void 0?void 0:_e[l];return Je===G}),dataStartIndex:u,dataEndIndex:p}),ne=J.length,oe,ge,ie;AYt(P.domain,z,T)&&(oe=dme(P.domain,null,z),b&&(T==="number"||U!=="auto")&&(ie=JA(J,I,"category")));var pe=nVe(T);if(!oe||oe.length===0){var se,fe=(se=P.domain)!==null&&se!==void 0?se:pe;if(I){if(oe=JA(J,I,T),T==="category"&&b){var he=CAt(oe);D&&he?(ge=oe,oe=zne(0,ne)):D||(oe=B5e(fe,oe,k).reduce(function(be,_e){return be.indexOf(_e)>=0?be:[].concat(u3(be),[_e])},[]))}else if(T==="category")D?oe=oe.filter(function(be){return be!==""&&!Mi(be)}):oe=B5e(fe,oe,k).reduce(function(be,_e){return be.indexOf(_e)>=0||_e===""||Mi(_e)?be:[].concat(u3(be),[_e])},[]);else if(T==="number"){var ye=U$t(J,a.filter(function(be){var _e,Je,Te=l in be.props?be.props[l]:(_e=be.type.defaultProps)===null||_e===void 0?void 0:_e[l],De="hide"in be.props?be.props.hide:(Je=be.type.defaultProps)===null||Je===void 0?void 0:Je.hide;return Te===G&&(W||!De)}),I,o,x);ye&&(oe=ye)}b&&(T==="number"||U!=="auto")&&(ie=JA(J,I,"category"))}else b?oe=zne(0,ne):i&&i[G]&&i[G].hasStack&&T==="number"?oe=_==="expand"?[0,1]:qUe(i[G].stackGroups,u,p):oe=RUe(J,a.filter(function(be){var _e=l in be.props?be.props[l]:be.type.defaultProps[l],Je="hide"in be.props?be.props.hide:be.type.defaultProps.hide;return _e===G&&(W||!Je)}),T,x,!0);if(T==="number")oe=Wme(y,oe,G,o,V),fe&&(oe=dme(fe,oe,z));else if(T==="category"&&fe){var Ae=fe,we=oe.every(function(be){return Ae.indexOf(be)>=0});we&&(oe=Ae)}}return Jr(Jr({},S),{},Aa({},G,Jr(Jr({},P),{},{axisType:o,domain:oe,categoricalDomain:ie,duplicateDomain:ge,originalDomain:(M=P.domain)!==null&&M!==void 0?M:pe,isCategorical:b,layout:x})))},{})},aXt=function(t,n){var s=n.graphicalItems,a=n.Axis,o=n.axisType,l=n.axisIdKey,i=n.stackGroups,u=n.dataStartIndex,p=n.dataEndIndex,x=t.layout,y=t.children,_=Fie(t.data,{graphicalItems:s,dataStartIndex:u,dataEndIndex:p}),b=_.length,S=FUe(x,o),k=-1;return s.reduce(function(M,P){var T=P.type.defaultProps!==void 0?Jr(Jr({},P.type.defaultProps),P.props):P.props,I=T[l],z=nVe("number");if(!M[I]){k++;var D;return S?D=zne(0,b):i&&i[I]&&i[I].hasStack?(D=qUe(i[I].stackGroups,u,p),D=Wme(y,D,I,o)):(D=dme(z,RUe(_,s.filter(function(U){var V,W,G=l in U.props?U.props[l]:(V=U.type.defaultProps)===null||V===void 0?void 0:V[l],J="hide"in U.props?U.props.hide:(W=U.type.defaultProps)===null||W===void 0?void 0:W.hide;return G===I&&!J}),"number",x),a.defaultProps.allowDataOverflow),D=Wme(y,D,I,o)),Jr(Jr({},M),{},Aa({},I,Jr(Jr({axisType:o},a.defaultProps),{},{hide:!0,orientation:wf(eXt,"".concat(o,".").concat(k%2),null),domain:D,originalDomain:z,isCategorical:S,layout:x})))}return M},{})},iXt=function(t,n){var s=n.axisType,a=s===void 0?"xAxis":s,o=n.AxisComp,l=n.graphicalItems,i=n.stackGroups,u=n.dataStartIndex,p=n.dataEndIndex,x=t.children,y="".concat(a,"Id"),_=xp(x,o),b={};return _&&_.length?b=sXt(t,{axes:_,graphicalItems:l,axisType:a,axisIdKey:y,stackGroups:i,dataStartIndex:u,dataEndIndex:p}):l&&l.length&&(b=aXt(t,{Axis:o,graphicalItems:l,axisType:a,axisIdKey:y,stackGroups:i,dataStartIndex:u,dataEndIndex:p})),b},oXt=function(t){var n=d1(t),s=ny(n,!1,!0);return{tooltipTicks:s,orderedTooltipTicks:b1e(s,function(a){return a.coordinate}),tooltipAxis:n,tooltipAxisBandSize:Cne(n,s)}},gTe=function(t){var n=t.children,s=t.defaultShowTooltip,a=ef(n,r3),o=0,l=0;return t.data&&t.data.length!==0&&(l=t.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}},lXt=function(t){return!t||!t.length?!1:t.some(function(n){var s=vy(n&&n.type);return s&&s.indexOf("Bar")>=0})},xTe=function(t){return t==="horizontal"?{numericAxisName:"yAxis",cateAxisName:"xAxis"}:t==="vertical"?{numericAxisName:"xAxis",cateAxisName:"yAxis"}:t==="centric"?{numericAxisName:"radiusAxis",cateAxisName:"angleAxis"}:{numericAxisName:"angleAxis",cateAxisName:"radiusAxis"}},cXt=function(t,n){var s=t.props,a=t.graphicalItems,o=t.xAxisMap,l=o===void 0?{}:o,i=t.yAxisMap,u=i===void 0?{}:i,p=s.width,x=s.height,y=s.children,_=s.margin||{},b=ef(y,r3),S=ef(y,tC),k=Object.keys(u).reduce(function(D,U){var V=u[U],W=V.orientation;return!V.mirror&&!V.hide?Jr(Jr({},D),{},Aa({},W,D[W]+V.width)):D},{left:_.left||0,right:_.right||0}),M=Object.keys(l).reduce(function(D,U){var V=l[U],W=V.orientation;return!V.mirror&&!V.hide?Jr(Jr({},D),{},Aa({},W,wf(D,"".concat(W))+V.height)):D},{top:_.top||0,bottom:_.bottom||0}),P=Jr(Jr({},M),k),T=P.bottom;b&&(P.bottom+=b.props.height||r3.defaultProps.height),S&&n&&(P=B$t(P,a,s,n));var I=p-P.left-P.right,z=x-P.top-P.bottom;return Jr(Jr({brushBottom:T},P),{},{width:Math.max(I,0),height:Math.max(z,0)})},dXt=function(t,n){if(n==="xAxis")return t[n].width;if(n==="yAxis")return t[n].height},sVe=function(t){var n=t.chartName,s=t.GraphicalChild,a=t.defaultTooltipEventType,o=a===void 0?"axis":a,l=t.validateTooltipEventTypes,i=l===void 0?["axis"]:l,u=t.axisComponents,p=t.legendContent,x=t.formatAxisMap,y=t.defaultProps,_=function(P,T){var I=T.graphicalItems,z=T.stackGroups,D=T.offset,U=T.updateId,V=T.dataStartIndex,W=T.dataEndIndex,G=P.barSize,J=P.layout,ne=P.barGap,oe=P.barCategoryGap,ge=P.maxBarSize,ie=xTe(J),pe=ie.numericAxisName,se=ie.cateAxisName,fe=lXt(I),he=[];return I.forEach(function(ye,Ae){var we=Fie(P.data,{graphicalItems:[ye],dataStartIndex:V,dataEndIndex:W}),be=ye.type.defaultProps!==void 0?Jr(Jr({},ye.type.defaultProps),ye.props):ye.props,_e=be.dataKey,Je=be.maxBarSize,Te=be["".concat(pe,"Id")],De=be["".concat(se,"Id")],Ue={},Be=u.reduce(function(Me,Ge){var Ee=T["".concat(Ge.axisType,"Map")],He=be["".concat(Ge.axisType,"Id")];Ee&&Ee[He]||Ge.axisType==="zAxis"||_k();var nt=Ee[He];return Jr(Jr({},Me),{},Aa(Aa({},Ge.axisType,nt),"".concat(Ge.axisType,"Ticks"),ny(nt)))},Ue),qe=Be[se],ot=Be["".concat(se,"Ticks")],Mt=z&&z[Te]&&z[Te].hasStack&&X$t(ye,z[Te].stackGroups),Oe=vy(ye.type).indexOf("Bar")>=0,at=Cne(qe,ot),le=[],Ve=fe&&F$t({barSize:G,stackGroups:z,totalSize:dXt(Be,se)});if(Oe){var Qe,st,ke=Mi(Je)?ge:Je,ct=(Qe=(st=Cne(qe,ot,!0))!==null&&st!==void 0?st:ke)!==null&&Qe!==void 0?Qe:0;le=z$t({barGap:ne,barCategoryGap:oe,bandSize:ct!==at?ct:at,sizeList:Ve[De],maxBarSize:ke}),ct!==at&&(le=le.map(function(Me){return Jr(Jr({},Me),{},{position:Jr(Jr({},Me.position),{},{offset:Me.position.offset-ct/2})})}))}var Ce=ye&&ye.type&&ye.type.getComposedData;Ce&&he.push({props:Jr(Jr({},Ce(Jr(Jr({},Be),{},{displayedData:we,props:P,dataKey:_e,item:ye,bandSize:at,barPosition:le,offset:D,stackedData:Mt,layout:J,dataStartIndex:V,dataEndIndex:W}))),{},Aa(Aa(Aa({key:ye.key||"item-".concat(Ae)},pe,Be[pe]),se,Be[se]),"animationId",U)),childIndex:zAt(ye,P.children),item:ye})}),he},b=function(P,T){var I=P.props,z=P.dataStartIndex,D=P.dataEndIndex,U=P.updateId;if(!LCe({props:I}))return null;var V=I.children,W=I.layout,G=I.stackOffset,J=I.data,ne=I.reverseStackOrder,oe=xTe(W),ge=oe.numericAxisName,ie=oe.cateAxisName,pe=xp(V,s),se=Z$t(J,pe,"".concat(ge,"Id"),"".concat(ie,"Id"),G,ne),fe=u.reduce(function(be,_e){var Je="".concat(_e.axisType,"Map");return Jr(Jr({},be),{},Aa({},Je,iXt(I,Jr(Jr({},_e),{},{graphicalItems:pe,stackGroups:_e.axisType===ge&&se,dataStartIndex:z,dataEndIndex:D}))))},{}),he=cXt(Jr(Jr({},fe),{},{props:I,graphicalItems:pe}),T==null?void 0:T.legendBBox);Object.keys(fe).forEach(function(be){fe[be]=x(I,fe[be],he,be.replace("Map",""),n)});var ye=fe["".concat(ie,"Map")],Ae=oXt(ye),we=_(I,Jr(Jr({},fe),{},{dataStartIndex:z,dataEndIndex:D,updateId:U,graphicalItems:pe,stackGroups:se,offset:he}));return Jr(Jr({formattedGraphicalItems:we,graphicalItems:pe,offset:he,stackGroups:se},Ae),fe)},S=function(M){function P(T){var I,z,D;return qYt(this,P),D=WYt(this,P,[T]),Aa(D,"eventEmitterSymbol",Symbol("rechartsEventEmitter")),Aa(D,"accessibilityManager",new TYt),Aa(D,"handleLegendBBoxUpdate",function(U){if(U){var V=D.state,W=V.dataStartIndex,G=V.dataEndIndex,J=V.updateId;D.setState(Jr({legendBBox:U},b({props:D.props,dataStartIndex:W,dataEndIndex:G,updateId:J},Jr(Jr({},D.state),{},{legendBBox:U}))))}}),Aa(D,"handleReceiveSyncEvent",function(U,V,W){if(D.props.syncId===U){if(W===D.eventEmitterSymbol&&typeof D.props.syncMethod!="function")return;D.applySyncEvent(V)}}),Aa(D,"handleBrushChange",function(U){var V=U.startIndex,W=U.endIndex;if(V!==D.state.dataStartIndex||W!==D.state.dataEndIndex){var G=D.state.updateId;D.setState(function(){return Jr({dataStartIndex:V,dataEndIndex:W},b({props:D.props,dataStartIndex:V,dataEndIndex:W,updateId:G},D.state))}),D.triggerSyncEvent({dataStartIndex:V,dataEndIndex:W})}}),Aa(D,"handleMouseEnter",function(U){var V=D.getMouseInfo(U);if(V){var W=Jr(Jr({},V),{},{isTooltipActive:!0});D.setState(W),D.triggerSyncEvent(W);var G=D.props.onMouseEnter;Ka(G)&&G(W,U)}}),Aa(D,"triggeredAfterMouseMove",function(U){var V=D.getMouseInfo(U),W=V?Jr(Jr({},V),{},{isTooltipActive:!0}):{isTooltipActive:!1};D.setState(W),D.triggerSyncEvent(W);var G=D.props.onMouseMove;Ka(G)&&G(W,U)}),Aa(D,"handleItemMouseEnter",function(U){D.setState(function(){return{isTooltipActive:!0,activeItem:U,activePayload:U.tooltipPayload,activeCoordinate:U.tooltipPosition||{x:U.cx,y:U.cy}}})}),Aa(D,"handleItemMouseLeave",function(){D.setState(function(){return{isTooltipActive:!1}})}),Aa(D,"handleMouseMove",function(U){U.persist(),D.throttleTriggeredAfterMouseMove(U)}),Aa(D,"handleMouseLeave",function(U){D.throttleTriggeredAfterMouseMove.cancel();var V={isTooltipActive:!1};D.setState(V),D.triggerSyncEvent(V);var W=D.props.onMouseLeave;Ka(W)&&W(V,U)}),Aa(D,"handleOuterEvent",function(U){var V=FAt(U),W=wf(D.props,"".concat(V));if(V&&Ka(W)){var G,J;/.*touch.*/i.test(V)?J=D.getMouseInfo(U.changedTouches[0]):J=D.getMouseInfo(U),W((G=J)!==null&&G!==void 0?G:{},U)}}),Aa(D,"handleClick",function(U){var V=D.getMouseInfo(U);if(V){var W=Jr(Jr({},V),{},{isTooltipActive:!0});D.setState(W),D.triggerSyncEvent(W);var G=D.props.onClick;Ka(G)&&G(W,U)}}),Aa(D,"handleMouseDown",function(U){var V=D.props.onMouseDown;if(Ka(V)){var W=D.getMouseInfo(U);V(W,U)}}),Aa(D,"handleMouseUp",function(U){var V=D.props.onMouseUp;if(Ka(V)){var W=D.getMouseInfo(U);V(W,U)}}),Aa(D,"handleTouchMove",function(U){U.changedTouches!=null&&U.changedTouches.length>0&&D.throttleTriggeredAfterMouseMove(U.changedTouches[0])}),Aa(D,"handleTouchStart",function(U){U.changedTouches!=null&&U.changedTouches.length>0&&D.handleMouseDown(U.changedTouches[0])}),Aa(D,"handleTouchEnd",function(U){U.changedTouches!=null&&U.changedTouches.length>0&&D.handleMouseUp(U.changedTouches[0])}),Aa(D,"handleDoubleClick",function(U){var V=D.props.onDoubleClick;if(Ka(V)){var W=D.getMouseInfo(U);V(W,U)}}),Aa(D,"handleContextMenu",function(U){var V=D.props.onContextMenu;if(Ka(V)){var W=D.getMouseInfo(U);V(W,U)}}),Aa(D,"triggerSyncEvent",function(U){D.props.syncId!==void 0&&uue.emit(hue,D.props.syncId,U,D.eventEmitterSymbol)}),Aa(D,"applySyncEvent",function(U){var V=D.props,W=V.layout,G=V.syncMethod,J=D.state.updateId,ne=U.dataStartIndex,oe=U.dataEndIndex;if(U.dataStartIndex!==void 0||U.dataEndIndex!==void 0)D.setState(Jr({dataStartIndex:ne,dataEndIndex:oe},b({props:D.props,dataStartIndex:ne,dataEndIndex:oe,updateId:J},D.state)));else if(U.activeTooltipIndex!==void 0){var ge=U.chartX,ie=U.chartY,pe=U.activeTooltipIndex,se=D.state,fe=se.offset,he=se.tooltipTicks;if(!fe)return;if(typeof G=="function")pe=G(he,U);else if(G==="value"){pe=-1;for(var ye=0;ye=0){var Mt,Oe;if(ge.dataKey&&!ge.allowDuplicatedCategory){var at=typeof ge.dataKey=="function"?ot:"payload.".concat(ge.dataKey.toString());Mt=wpe(ye,at,pe),Oe=Ae&&we&&wpe(we,at,pe)}else Mt=ye==null?void 0:ye[ie],Oe=Ae&&we&&we[ie];if(De||Te){var le=U.props.activeIndex!==void 0?U.props.activeIndex:ie;return[E.cloneElement(U,Jr(Jr(Jr({},G.props),Be),{},{activeIndex:le})),null,null]}if(!Mi(Mt))return[qe].concat(u3(D.renderActivePoints({item:G,activePoint:Mt,basePoint:Oe,childIndex:ie,isRange:Ae})))}else{var Ve,Qe=(Ve=D.getItemByXY(D.state.activeCoordinate))!==null&&Ve!==void 0?Ve:{graphicalItem:qe},st=Qe.graphicalItem,ke=st.item,ct=ke===void 0?U:ke,Ce=st.childIndex,Me=Jr(Jr(Jr({},G.props),Be),{},{activeIndex:Ce});return[E.cloneElement(ct,Me),null,null]}return Ae?[qe,null,null]:[qe,null]}),Aa(D,"renderCustomized",function(U,V,W){return E.cloneElement(U,Jr(Jr({key:"recharts-customized-".concat(W)},D.props),D.state))}),Aa(D,"renderMap",{CartesianGrid:{handler:BO,once:!0},ReferenceArea:{handler:D.renderReferenceElement},ReferenceLine:{handler:BO},ReferenceDot:{handler:D.renderReferenceElement},XAxis:{handler:BO},YAxis:{handler:BO},Brush:{handler:D.renderBrush,once:!0},Bar:{handler:D.renderGraphicChild},Line:{handler:D.renderGraphicChild},Area:{handler:D.renderGraphicChild},Radar:{handler:D.renderGraphicChild},RadialBar:{handler:D.renderGraphicChild},Scatter:{handler:D.renderGraphicChild},Pie:{handler:D.renderGraphicChild},Funnel:{handler:D.renderGraphicChild},Tooltip:{handler:D.renderCursor,once:!0},PolarGrid:{handler:D.renderPolarGrid,once:!0},PolarAngleAxis:{handler:D.renderPolarAxis},PolarRadiusAxis:{handler:D.renderPolarAxis},Customized:{handler:D.renderCustomized}}),D.clipPathId="".concat((I=T.id)!==null&&I!==void 0?I:jP("recharts"),"-clip"),D.throttleTriggeredAfterMouseMove=L$e(D.triggeredAfterMouseMove,(z=T.throttleDelay)!==null&&z!==void 0?z:1e3/60),D.state={},D}return ZYt(P,M),HYt(P,[{key:"componentDidMount",value:function(){var I,z;this.addListener(),this.accessibilityManager.setDetails({container:this.container,offset:{left:(I=this.props.margin.left)!==null&&I!==void 0?I: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 I=this.props,z=I.children,D=I.data,U=I.height,V=I.layout,W=ef(z,um);if(W){var G=W.props.defaultIndex;if(!(typeof G!="number"||G<0||G>this.state.tooltipTicks.length-1)){var J=this.state.tooltipTicks[G]&&this.state.tooltipTicks[G].value,ne=Zme(this.state,D,G,J),oe=this.state.tooltipTicks[G].coordinate,ge=(this.state.offset.top+U)/2,ie=V==="horizontal",pe=ie?{x:oe,y:ge}:{y:oe,x:ge},se=this.state.formattedGraphicalItems.find(function(he){var ye=he.item;return ye.type.name==="Scatter"});se&&(pe=Jr(Jr({},pe),se.props.points[G].tooltipPosition),ne=se.props.points[G].tooltipPayload);var fe={activeTooltipIndex:G,isTooltipActive:!0,activeLabel:J,activePayload:ne,activeCoordinate:pe};this.setState(fe),this.renderCursor(W),this.accessibilityManager.setIndex(G)}}}},{key:"getSnapshotBeforeUpdate",value:function(I,z){if(!this.props.accessibilityLayer)return null;if(this.state.tooltipTicks!==z.tooltipTicks&&this.accessibilityManager.setDetails({coordinateList:this.state.tooltipTicks}),this.props.layout!==I.layout&&this.accessibilityManager.setDetails({layout:this.props.layout}),this.props.margin!==I.margin){var D,U;this.accessibilityManager.setDetails({offset:{left:(D=this.props.margin.left)!==null&&D!==void 0?D:0,top:(U=this.props.margin.top)!==null&&U!==void 0?U:0}})}return null}},{key:"componentDidUpdate",value:function(I){kpe([ef(I.children,um)],[ef(this.props.children,um)])||this.displayDefaultTooltip()}},{key:"componentWillUnmount",value:function(){this.removeListener(),this.throttleTriggeredAfterMouseMove.cancel()}},{key:"getTooltipEventType",value:function(){var I=ef(this.props.children,um);if(I&&typeof I.props.shared=="boolean"){var z=I.props.shared?"axis":"item";return i.indexOf(z)>=0?z:o}return o}},{key:"getMouseInfo",value:function(I){if(!this.container)return null;var z=this.container,D=z.getBoundingClientRect(),U=uzt(D),V={chartX:Math.round(I.pageX-U.left),chartY:Math.round(I.pageY-U.top)},W=D.width/z.offsetWidth||1,G=this.inRange(V.chartX,V.chartY,W);if(!G)return null;var J=this.state,ne=J.xAxisMap,oe=J.yAxisMap,ge=this.getTooltipEventType(),ie=mTe(this.state,this.props.data,this.props.layout,G);if(ge!=="axis"&&ne&&oe){var pe=d1(ne).scale,se=d1(oe).scale,fe=pe&&pe.invert?pe.invert(V.chartX):null,he=se&&se.invert?se.invert(V.chartY):null;return Jr(Jr({},V),{},{xValue:fe,yValue:he},ie)}return ie?Jr(Jr({},V),ie):null}},{key:"inRange",value:function(I,z){var D=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,U=this.props.layout,V=I/D,W=z/D;if(U==="horizontal"||U==="vertical"){var G=this.state.offset,J=V>=G.left&&V<=G.left+G.width&&W>=G.top&&W<=G.top+G.height;return J?{x:V,y:W}:null}var ne=this.state,oe=ne.angleAxisMap,ge=ne.radiusAxisMap;if(oe&&ge){var ie=d1(oe);return q5e({x:V,y:W},ie)}return null}},{key:"parseEventsOfWrapper",value:function(){var I=this.props.children,z=this.getTooltipEventType(),D=ef(I,um),U={};D&&z==="axis"&&(D.props.trigger==="click"?U={onClick:this.handleClick}:U={onMouseEnter:this.handleMouseEnter,onDoubleClick:this.handleDoubleClick,onMouseMove:this.handleMouseMove,onMouseLeave:this.handleMouseLeave,onTouchMove:this.handleTouchMove,onTouchStart:this.handleTouchStart,onTouchEnd:this.handleTouchEnd,onContextMenu:this.handleContextMenu});var V=ene(this.props,this.handleOuterEvent);return Jr(Jr({},V),U)}},{key:"addListener",value:function(){uue.on(hue,this.handleReceiveSyncEvent)}},{key:"removeListener",value:function(){uue.removeListener(hue,this.handleReceiveSyncEvent)}},{key:"filterFormatItem",value:function(I,z,D){for(var U=this.state.formattedGraphicalItems,V=0,W=U.length;V");return e}const oVe=E.forwardRef(({id:e,className:t,children:n,config:s,...a},o)=>{const l=E.useId(),i=`chart-${e||l.replace(/:/g,"")}`;return r.jsx(aVe.Provider,{value:{config:s},children:r.jsxs("div",{"data-chart":i,ref:o,className:Bt("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",t),...a,children:[r.jsx(pXt,{id:i,config:s}),r.jsx(Gpe,{children:n})]})})});oVe.displayName="Chart";const pXt=({id:e,config:t})=>{const n=Object.entries(t).filter(([s,a])=>a.theme||a.color);return n.length?r.jsx("style",{dangerouslySetInnerHTML:{__html:Object.entries(fXt).map(([s,a])=>` ${a} [data-chart=${e}] { ${n.map(([o,l])=>{var u;const i=((u=l.theme)==null?void 0:u[s])||l.color;return i?` --color-${o}: ${i};`:null}).join(` `)} } `).join(` `)}}):null},lVe=E.forwardRef(({active:e,payload:t,className:n,indicator:s="dot",hideLabel:a=!1,hideIndicator:o=!1,label:l,labelFormatter:i,labelClassName:u,formatter:p,color:x,nameKey:y,labelKey:_},b)=>{const{config:S}=iVe(),k=E.useMemo(()=>{var D;if(a||!(t!=null&&t.length))return null;const[P]=t,T=`${_||P.dataKey||P.name||"value"}`,I=Yme(S,P,T),z=!_&&typeof l=="string"?((D=S[l])==null?void 0:D.label)||l:I==null?void 0:I.label;return i?r.jsx("div",{className:Bt("font-medium",u),children:i(z,t)}):z?r.jsx("div",{className:Bt("font-medium",u),children:z}):null},[l,i,t,a,u,S,_]);if(!e||!(t!=null&&t.length))return null;const M=t.length===1&&s!=="dot";return r.jsxs("div",{ref:b,className:Bt("grid min-w-[8rem] items-start gap-1.5 rounded-lg border border-border/50 bg-background px-2.5 py-1.5 text-xs shadow-xl",n),children:[M?null:k,r.jsx("div",{className:"grid gap-1.5",children:t.map((P,T)=>{const I=`${y||P.name||P.dataKey||"value"}`,z=Yme(S,P,I),D=x||P.payload.fill||P.color;return r.jsx("div",{className:Bt("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&&(P==null?void 0:P.value)!==void 0&&P.name?p(P.value,P.name,P,T,P.payload):r.jsxs(r.Fragment,{children:[z!=null&&z.icon?r.jsx(z.icon,{}):!o&&r.jsx("div",{className:Bt("shrink-0 rounded-[2px] border-[--color-border] bg-[--color-bg]",{"h-2.5 w-2.5":s==="dot","w-1":s==="line","w-0 border-[1.5px] border-dashed bg-transparent":s==="dashed","my-0.5":M&&s==="dashed"}),style:{"--color-bg":D,"--color-border":D}}),r.jsxs("div",{className:Bt("flex flex-1 justify-between leading-none",M?"items-end":"items-center"),children:[r.jsxs("div",{className:"grid gap-1.5",children:[M?k:null,r.jsx("span",{className:"text-muted-foreground",children:(z==null?void 0:z.label)||P.name})]}),P.value&&r.jsx("span",{className:"font-mono font-medium tabular-nums text-foreground",children:P.value.toLocaleString()})]})]})},P.dataKey)})})]})});lVe.displayName="ChartTooltip";const mXt=E.forwardRef(({className:e,hideIcon:t=!1,payload:n,verticalAlign:s="bottom",nameKey:a},o)=>{const{config:l}=iVe();return n!=null&&n.length?r.jsx("div",{ref:o,className:Bt("flex items-center justify-center gap-4",s==="top"?"pb-3":"pt-3",e),children:n.map(i=>{const u=`${a||i.dataKey||"value"}`,p=Yme(l,i,u);return r.jsxs("div",{className:Bt("flex items-center gap-1.5 [&>svg]:h-3 [&>svg]:w-3 [&>svg]:text-muted-foreground"),children:[p!=null&&p.icon&&!t?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});mXt.displayName="ChartLegend";function Yme(e,t,n){if(typeof t!="object"||t===null)return;const s="payload"in t&&typeof t.payload=="object"&&t.payload!==null?t.payload:void 0;let a=n;return n in t&&typeof t[n]=="string"?a=t[n]:s&&n in s&&typeof s[n]=="string"&&(a=s[n]),a in e?e[a]:e[n]}const $O=["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 cVe({stats:e,year:t}){const n=e.transactionsByMonth.some(a=>a.count>0),s=e.leadSourceBreakdown.length>0;return!n&&!s?r.jsx(Ze,{children:r.jsx(et,{className:"py-12 text-center text-muted-foreground",children:"Add transactions to see your performance charts"})}):r.jsxs("div",{className:"grid gap-6",children:[n&&r.jsxs(Ze,{className:"overflow-hidden",children:[r.jsx(Wt,{children:r.jsx(Yt,{className:"text-base",children:"Transactions by Month"})}),r.jsx(et,{className:"overflow-hidden",children:r.jsx(oVe,{config:{count:{label:"Transactions",color:"hsl(var(--primary))"}},className:"h-[250px]",children:r.jsx(Gpe,{width:"100%",height:"100%",children:r.jsxs(uXt,{data:e.transactionsByMonth,margin:{top:5,right:10,left:0,bottom:5},children:[r.jsx(qqe,{strokeDasharray:"3 3",className:"stroke-muted"}),r.jsx(Die,{dataKey:"month",tick:{fontSize:11},className:"fill-muted-foreground",interval:0}),r.jsx(Rie,{allowDecimals:!1,tick:{fontSize:12},className:"fill-muted-foreground",width:30}),r.jsx(um,{content:r.jsx(lVe,{})}),r.jsx(Lk,{dataKey:"count",fill:"hsl(var(--primary))",radius:[4,4,0,0],name:"Transactions"})]})})})})]}),s&&r.jsxs(Ze,{children:[r.jsx(Wt,{children:r.jsx(Yt,{className:"text-base",children:"Lead Sources"})}),r.jsxs(et,{children:[r.jsx("div",{className:"h-[250px]",children:r.jsx(Gpe,{width:"100%",height:"100%",children:r.jsxs(hXt,{children:[r.jsx(Wy,{data:e.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:e.leadSourceBreakdown.map((a,o)=>r.jsx(uie,{fill:$O[o%$O.length]},`cell-${o}`))}),r.jsx(um,{formatter:(a,o)=>[`${a} deals`,o]})]})})}),r.jsx("div",{className:"flex flex-wrap gap-2 mt-2 justify-center",children:e.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:$O[o%$O.length]}}),r.jsx("span",{className:"text-muted-foreground",children:a.name})]},a.name))})]})]})]})}function gXt(e){if(!e||!e.trim())return null;const t=e.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=kye(t,s,new Date);if(wfe(a))return on(a,"yyyy-MM-dd")}catch{}try{const s=new Date(t);if(wfe(s))return on(s,"yyyy-MM-dd")}catch{}return null}const xXt=["property_address","city","state","zip","transaction_type","close_date","sale_price","commission_amount","lead_source","client_type","is_win","notes"];function yXt({open:e,onOpenChange:t}){const[n,s]=E.useState([]),[a,o]=E.useState(!1),[l,i]=E.useState(0),{data:u}=dae(),{data:p}=qm(),x=uae(),y=()=>{const P=xXt.join(","),T=["123 Main St","Dallas","TX","75001","buyer","2024-06-15","450000","13500","Referral","Past Client","yes","Great transaction!"].join(","),I=`${P} ${T}`,z=new Blob([I],{type:"text/csv"}),D=URL.createObjectURL(z),U=document.createElement("a");U.href=D,U.download="transaction-import-template.csv",U.click(),URL.revokeObjectURL(D)},_=P=>{const T=P.split(` `).filter(z=>z.trim());if(T.length<2)return[];const I=T[0].split(",").map(z=>z.trim().toLowerCase().replace(/['"]/g,""));return T.slice(1).map((z,D)=>{var fe,he,ye,Ae;const U=[];let V="",W=!1;for(const we of z)we==='"'?W=!W:we===","&&!W?(U.push(V.trim()),V=""):V+=we;U.push(V.trim());const G=we=>{var _e;const be=I.indexOf(we);return be>=0?(_e=U[be])==null?void 0:_e.replace(/^["']|["']$/g,"").trim():""},J=(fe=G("transaction_type"))==null?void 0:fe.toLowerCase(),ne=(he=G("sale_price"))==null?void 0:he.replace(/[$,]/g,""),oe=(ye=G("commission_amount"))==null?void 0:ye.replace(/[$,]/g,""),ge=(Ae=G("is_win"))==null?void 0:Ae.toLowerCase(),ie=G("close_date"),pe=gXt(ie);let se;return G("property_address")?["buyer","seller"].includes(J)?pe?(!ne||isNaN(Number(ne)))&&(se="Invalid sale price"):se=`Invalid date format: "${ie}" - use MM/DD/YYYY or YYYY-MM-DD`:se='Transaction type must be "buyer" or "seller"':se="Missing property address",{property_address:G("property_address"),city:G("city"),state:G("state"),zip:G("zip"),transaction_type:J==="seller"?"seller":"buyer",close_date:pe||"",sale_price:Number(ne)||0,commission_amount:oe?Number(oe):null,lead_source_name:G("lead_source"),client_type_name:G("client_type"),is_win:["yes","true","1"].includes(ge),notes:G("notes"),error:se}})},b=P=>{var z;const T=(z=P.target.files)==null?void 0:z[0];if(!T)return;const I=new FileReader;I.onload=D=>{var W;const U=(W=D.target)==null?void 0:W.result,V=_(U);s(V)},I.readAsText(T)},S=async()=>{const P=n.filter(z=>!z.error);if(P.length===0){Ie.error("No valid transactions to import");return}o(!0),i(0);let T=0,I=0;for(let z=0;zW.name.toLowerCase()===D.lead_source_name.toLowerCase()),V=p==null?void 0:p.find(W=>W.name.toLowerCase()===D.client_type_name.toLowerCase());await x.mutateAsync({property_address:D.property_address,city:D.city||null,state:D.state||null,zip:D.zip||null,transaction_type:D.transaction_type,close_date:D.close_date,sale_price:D.sale_price,commission_amount:D.commission_amount,lead_source_id:(U==null?void 0:U.id)||null,client_type_id:(V==null?void 0:V.id)||null,contact_id:null,notes:D.notes||null,is_win:D.is_win}),T++}catch(U){I++,console.error("Failed to import transaction:",U)}i(Math.round((z+1)/P.length*100))}o(!1),T>0&&Ie.success(`Imported ${T} transaction${T>1?"s":""}`),I>0&&Ie.error(`Failed to import ${I} transaction${I>1?"s":""}`),s([]),t(!1)},k=n.filter(P=>!P.error).length,M=n.filter(P=>P.error).length;return r.jsx(Or,{open:e,onOpenChange:t,children:r.jsxs(Ir,{className:"max-w-2xl max-h-[90vh]",children:[r.jsxs($r,{children:[r.jsx(Fr,{children:"Import Transactions"}),r.jsx(Zn,{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(io,{className:"h-4 w-4 mr-2"}),"Template"]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{htmlFor:"csv-file",children:"Upload CSV File"}),r.jsx(dt,{id:"csv-file",type:"file",accept:".csv",onChange:b})]}),n.length>0&&r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsxs(Pt,{variant:"outline",children:[n.length," rows found"]}),k>0&&r.jsxs(Pt,{className:"bg-green-500 text-white",children:[r.jsx(Ni,{className:"h-3 w-3 mr-1"}),k," valid"]}),M>0&&r.jsxs(Pt,{variant:"destructive",children:[r.jsx(yl,{className:"h-3 w-3 mr-1"}),M," errors"]})]}),r.jsx(Bo,{className:"h-[200px] border rounded-lg",children:r.jsxs("div",{className:"p-2 space-y-2",children:[n.slice(0,10).map((P,T)=>r.jsxs("div",{className:`p-2 rounded text-sm ${P.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:P.property_address||"(no address)"}),r.jsx(Pt,{variant:P.transaction_type==="buyer"?"default":"secondary",children:P.transaction_type})]}),r.jsxs("div",{className:"text-muted-foreground",children:[P.close_date," • $",P.sale_price.toLocaleString()]}),P.error&&r.jsx(O0e,{variant:"destructive",className:"mt-1 py-1",children:r.jsx(D0e,{className:"text-xs",children:P.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:()=>t(!1),children:"Cancel"}),r.jsxs(ee,{onClick:S,disabled:k===0||a,children:[r.jsx(_o,{className:"h-4 w-4 mr-2"}),"Import ",k," Transaction",k!==1?"s":""]})]})]})]})})}const vXt=E3({transactions_goal:LA().min(0).optional(),volume_goal:LA().min(0).optional(),gci_goal:LA().min(0).optional()});function _Xt({open:e,onOpenChange:t,year:n,existingGoals:s}){const a=Kgt(),{data:o}=hae(),l=(o==null?void 0:o.show_commission)??!0,i=Qse({resolver:Jse(vXt),defaultValues:{transactions_goal:void 0,volume_goal:void 0,gci_goal:void 0}});E.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,e]);const u=async p=>{await a.mutateAsync({year:n,transactions_goal:p.transactions_goal??null,volume_goal:p.volume_goal??null,gci_goal:l?p.gci_goal??null:null}),t(!1)};return r.jsx(Or,{open:e,onOpenChange:t,children:r.jsxs(Ir,{className:"max-w-md",children:[r.jsxs($r,{children:[r.jsxs(Fr,{children:[n," Goals"]}),r.jsx(Zn,{children:"Set your annual targets to track your progress throughout the year."})]}),r.jsx(eae,{...i,children:r.jsxs("form",{onSubmit:i.handleSubmit(u),className:"space-y-4",children:[r.jsx(Ll,{control:i.control,name:"transactions_goal",render:({field:p})=>r.jsxs(Nl,{children:[r.jsx(Sl,{children:"Transactions Goal"}),r.jsx(Cl,{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(qee,{children:"Total number of deals you want to close"}),r.jsx(Wu,{})]})}),r.jsx(Ll,{control:i.control,name:"volume_goal",render:({field:p})=>r.jsxs(Nl,{children:[r.jsx(Sl,{children:"Volume Goal ($)"}),r.jsx(Cl,{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(qee,{children:"Total sales volume you want to achieve"}),r.jsx(Wu,{})]})}),l&&r.jsx(Ll,{control:i.control,name:"gci_goal",render:({field:p})=>r.jsxs(Nl,{children:[r.jsx(Sl,{children:"GCI Goal ($)"}),r.jsx(Cl,{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(qee,{children:"Gross commission income target"}),r.jsx(Wu,{})]})}),r.jsxs("div",{className:"flex justify-end gap-2 pt-4",children:[r.jsx(ee,{type:"button",variant:"outline",onClick:()=>t(!1),children:"Cancel"}),r.jsx(ee,{type:"submit",disabled:a.isPending,children:"Save Goals"})]})]})})]})})}function dVe({transactions:e,isLoading:t}){const n=E.useRef(null),s=E.useRef(null),a=E.useRef([]),o=E.useRef(null),{isAdmin:l}=tn(),[i,u]=E.useState(""),[p,x]=E.useState(!0),[y,_]=E.useState(0),[b,S]=E.useState(!1),k=e.filter(P=>P.latitude!=null&&P.longitude!=null),M=e.filter(P=>P.latitude==null||P.longitude==null);return E.useEffect(()=>{(async()=>{x(!0);try{const{data:T}=await Q.from("settings").select("value").eq("key","mapbox_public_token").maybeSingle();T!=null&&T.value&&u(T.value)}catch(T){console.error("Error fetching mapbox token:",T)}x(!1)})()},[]),E.useEffect(()=>{if(!i||M.length===0||b)return;(async()=>{var I;S(!0);let T=0;for(const z of M){const D=[z.property_address,z.city,z.state,z.zip].filter(Boolean).join(", ");if(D)try{const V=await(await fetch(`https://api.mapbox.com/geocoding/v5/mapbox.places/${encodeURIComponent(D)}.json?access_token=${i}&limit=1`)).json();if((I=V.features)!=null&&I[0]){const[W,G]=V.features[0].center;await Q.from("scorecard_transactions").update({latitude:G,longitude:W}).eq("id",z.id),z.latitude=G,z.longitude=W,T++}}catch(U){console.error("Geocode error:",U)}}_(T),S(!1)})()},[i,e]),E.useEffect(()=>{if(!n.current||!i||s.current)return;rc.accessToken=i;const P=e.filter(z=>z.latitude!=null&&z.longitude!=null);let T=[-98.5795,39.8283],I=4;if(P.length>0){const z=P.reduce((U,V)=>U+V.longitude,0)/P.length,D=P.reduce((U,V)=>U+V.latitude,0)/P.length;T=[z,D],I=P.length===1?12:10}return s.current=new rc.Map({container:n.current,style:"mapbox://styles/mapbox/light-v11",zoom:I,center:T}),s.current.addControl(new rc.NavigationControl,"top-right"),()=>{var z;(z=s.current)==null||z.remove(),s.current=null}},[i]),E.useEffect(()=>{var T;if(!s.current||!i)return;a.current.forEach(I=>I.remove()),a.current=[],(T=o.current)==null||T.remove();const P=e.filter(I=>I.latitude!=null&&I.longitude!=null);if(P.forEach(I=>{var G;const z=I.transaction_type==="buyer",D=z?"#3B82F6":"#10B981",U=document.createElement("div");U.className="cursor-pointer",U.innerHTML=`
${z?'':''}
`;const V=new rc.Popup({offset:25,closeButton:!0}).setHTML(`
${I.property_address}
${I.city?`
${I.city}${I.state?", "+I.state:""} ${I.zip||""}
`:""}
${z?"Buyer":"Seller"} $${Number(I.sale_price).toLocaleString()}
Closed: ${new Date(I.close_date).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})} ${(G=I.lead_source)!=null&&G.name?" · "+I.lead_source.name:""}
${I.contact?`
Client: ${I.contact.first_name} ${I.contact.last_name||""}
`:""}
`),W=new rc.Marker(U).setLngLat([I.longitude,I.latitude]).setPopup(V).addTo(s.current);a.current.push(W)}),P.length>1){const I=new rc.LngLatBounds;P.forEach(z=>I.extend([z.longitude,z.latitude])),s.current.fitBounds(I,{padding:60,maxZoom:13})}else P.length===1&&s.current.flyTo({center:[P[0].longitude,P[0].latitude],zoom:12})},[e,i,b]),p||t?r.jsx(Ze,{children:r.jsx(et,{className:"flex items-center justify-center h-[50vh]",children:r.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary"})})}):i?e.length===0?r.jsx(Ze,{children:r.jsxs(et,{className:"flex flex-col items-center justify-center h-[50vh] text-center gap-3",children:[r.jsx(Po,{className:"h-12 w-12 text-muted-foreground"}),r.jsxs("div",{children:[r.jsx("p",{className:"font-semibold",children:"No Transactions Yet"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Add transactions to see them plotted on the map."})]})]})}):r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-4 text-sm",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-white shadow",style:{background:"#3B82F6"}}),r.jsx("span",{children:"Buyer"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:"w-4 h-4 rounded-full border-2 border-white shadow",style:{background:"#10B981"}}),r.jsx("span",{children:"Seller"})]}),r.jsxs("span",{className:"text-muted-foreground ml-auto text-xs",children:[k.length," of ",e.length," mapped",b&&" · Geocoding..."]})]}),r.jsx("div",{ref:n,className:"w-full h-[55vh] rounded-lg shadow-lg border"})]}):r.jsx(Ze,{children:r.jsxs(et,{className:"flex flex-col items-center justify-center h-[50vh] text-center gap-3",children:[r.jsx(yl,{className:"h-12 w-12 text-muted-foreground"}),r.jsxs("div",{children:[r.jsx("p",{className:"font-semibold",children:"Map Not Configured"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:l?"Set up your Mapbox token in the Popby Map to enable maps across the platform.":"The map feature has not been configured yet. Please contact your administrator."})]})]})})}const uVe=new Date().getFullYear(),bXt=Array.from({length:10},(e,t)=>uVe-t);function wXt(){var D;const[e,t]=E.useState(uVe),[n,s]=E.useState(!1),[a,o]=E.useState(!1),[l,i]=E.useState(!1),[u,p]=E.useState(!1),{data:x,isLoading:y}=Dye(e),{yearStats:_,lifetimeStats:b,showCommission:S}=DRe(e),{data:k,isLoading:M}=ORe(e),{data:P}=hae(),T=Zgt(),I=()=>{if(!x||x.length===0)return;const U=["Property Address","City","State","Zip","Transaction Type","Close Date","Sale Price",...S?["Commission"]:[],"Lead Source","Client Type","Contact Name","Is Win","Notes"],V=x.map(oe=>{var ge,ie;return[oe.property_address,oe.city||"",oe.state||"",oe.zip||"",oe.transaction_type,oe.close_date,oe.sale_price,...S?[oe.commission_amount||""]:[],((ge=oe.lead_source)==null?void 0:ge.name)||"",((ie=oe.client_type)==null?void 0:ie.name)||"",oe.contact?`${oe.contact.first_name} ${oe.contact.last_name||""}`.trim():"",oe.is_win?"Yes":"No",oe.notes||""]}),W=[U,...V].map(oe=>oe.map(ge=>`"${String(ge).replace(/"/g,'""')}"`).join(",")).join(` `),G=new Blob([W],{type:"text/csv"}),J=URL.createObjectURL(G),ne=document.createElement("a");ne.href=J,ne.download=`transactions-${e}.csv`,ne.click(),URL.revokeObjectURL(J)},z=!x||x.length===0;return r.jsxs(Dr,{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(mn,{value:String(e),onValueChange:U=>t(Number(U)),children:[r.jsx(fn,{className:"w-[120px]",children:r.jsx(yn,{})}),r.jsx(pn,{children:bXt.map(U=>r.jsx(qt,{value:String(U),children:U},U))})]}),r.jsx(ee,{variant:"outline",size:"icon",onClick:()=>p(!u),children:r.jsx(Fd,{className:"h-4 w-4"})})]})]}),u&&r.jsxs(Ze,{children:[r.jsx(Wt,{className:"pb-3",children:r.jsx(Yt,{className:"text-lg",children:"Settings"})}),r.jsx(et,{children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"space-y-0.5",children:[r.jsx($e,{children:"Show Commission"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Display commission fields and include in stats"})]}),r.jsx(Ts,{checked:(P==null?void 0:P.show_commission)??!0,onCheckedChange:U=>T.mutate({show_commission:U})})]})})]}),z&&!y?r.jsx(Ze,{className:"py-12",children:r.jsxs(et,{className:"text-center space-y-4",children:[r.jsx("div",{className:"w-16 h-16 mx-auto rounded-full bg-primary/10 flex items-center justify-center",children:r.jsx(_c,{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(_o,{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(io,{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(my,{className:"h-4 w-4 mr-2"}),"Set Goals"]}),r.jsxs(ee,{variant:"outline",onClick:()=>o(!0),children:[r.jsx(_o,{className:"h-4 w-4 mr-2"}),"Import"]}),r.jsxs(ee,{variant:"outline",onClick:I,disabled:z,children:[r.jsx(io,{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(io,{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(Ze,{children:r.jsxs(et,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(xa,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs font-medium",children:"Transactions"})]}),r.jsx("p",{className:"text-2xl font-bold",children:_.totalTransactions}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[b.totalTransactions," lifetime"]})]})}),r.jsx(Ze,{children:r.jsxs(et,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(Un,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs font-medium",children:"Buyer/Seller"})]}),r.jsxs("p",{className:"text-2xl font-bold",children:[_.buyerCount,"/",_.sellerCount]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"B/S split"})]})}),r.jsx(Ze,{children:r.jsxs(et,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(Rd,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs font-medium",children:"Volume"})]}),r.jsx("p",{className:"text-2xl font-bold",children:tu(_.totalVolume,!0)}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[tu(b.totalVolume,!0)," lifetime"]})]})}),r.jsx(Ze,{children:r.jsxs(et,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(fp,{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:tu(_.averagePrice,!0)})]})}),r.jsx(Ze,{children:r.jsxs(et,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(zl,{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:((D=_.topLeadSource)==null?void 0:D.name)||"-"}),_.topLeadSource&&r.jsxs("p",{className:"text-xs text-muted-foreground",children:[_.topLeadSource.count," deals"]})]})}),S&&r.jsx(Ze,{children:r.jsxs(et,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(Rd,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs font-medium",children:"Commission"})]}),r.jsx("p",{className:"text-2xl font-bold",children:tu(_.totalCommission,!0)}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[tu(b.totalCommission,!0)," lifetime"]})]})})]}),k&&r.jsx(vBe,{goals:k,stats:_,year:e,showCommission:S}),r.jsxs(Ai,{defaultValue:"transactions",className:"space-y-4",children:[r.jsxs(vi,{children:[r.jsx(sn,{value:"transactions",children:"Transactions"}),r.jsx(sn,{value:"charts",children:"Charts"}),r.jsxs(sn,{value:"map",children:[r.jsx(Po,{className:"h-4 w-4 mr-1"}),"Map"]})]}),r.jsx(Mn,{value:"transactions",children:r.jsx(yBe,{transactions:x||[],showCommission:S,isLoading:y})}),r.jsx(Mn,{value:"charts",children:r.jsx(cVe,{stats:_,year:e})}),r.jsx(Mn,{value:"map",children:r.jsx(dVe,{transactions:x||[],isLoading:y})})]})]})]}),r.jsx(xBe,{open:n,onOpenChange:s}),r.jsx(yXt,{open:a,onOpenChange:o}),r.jsx(_Xt,{open:l,onOpenChange:i,year:e,existingGoals:k})]})}function hVe({open:e,onOpenChange:t,listingId:n,listingSlug:s,listingTitle:a}){const{user:o}=tn(),[l,i]=E.useState(null),[u,p]=E.useState(!1),[x,y]=E.useState(!1);E.useEffect(()=>{(async()=>{if(!(!e||!o)){p(!0);try{const{data:M,error:P}=await Q.from("listing_shares").select("id, share_token, click_count, lead_count").eq("listing_id",n).eq("sharing_agent_id",o.id).order("created_at",{ascending:!1}).limit(1).maybeSingle();if(P)throw P;if(M&&M.share_token)i(M);else if(M&&!M.share_token){const{data:T,error:I}=await Q.from("listing_shares").update({share_type:"referral_link"}).eq("id",M.id).select("id, share_token, click_count, lead_count").single();if(I)throw I;i(T)}else{const{data:T,error:I}=await Q.from("listing_shares").insert({listing_id:n,sharing_agent_id:o.id,share_type:"referral_link"}).select("id, share_token, click_count, lead_count").single();if(I)throw I;i(T)}}catch(M){console.error("Error creating share link:",M),Ie.error("Failed to generate share link")}finally{p(!1)}}})()},[e,o,n]);const _=l!=null&&l.share_token?`https://listings.relevelup.com/${s||n}?ref=${l.share_token}`:"",b=async()=>{try{await navigator.clipboard.writeText(_),y(!0),Ie.success("Link copied to clipboard!"),setTimeout(()=>y(!1),2e3)}catch{Ie.error("Failed to copy link")}},S=k=>{const M=encodeURIComponent(_),P=encodeURIComponent(`Check out this listing: ${a}`);switch(k){case"email":window.open(`mailto:?subject=${P}&body=${M}`);break;case"text":window.open(`sms:?body=${P}%20${M}`);break;case"facebook":window.open(`https://www.facebook.com/sharer/sharer.php?u=${M}`,"_blank");break}};return r.jsx(Or,{open:e,onOpenChange:t,children:r.jsxs(Ir,{className:"sm:max-w-md",children:[r.jsxs($r,{children:[r.jsxs(Fr,{className:"flex items-center gap-2",children:[r.jsx(Ls,{className:"h-5 w-5 text-amber-500"}),"Share & Earn Leads"]}),r.jsx(Zn,{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($e,{children:"Your Referral Link"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(dt,{value:u?"Generating...":_,readOnly:!0,className:"font-mono text-sm"}),r.jsx(ee,{onClick:b,disabled:u||!_,variant:x?"default":"outline",children:x?r.jsx(Ni,{className:"h-4 w-4"}):r.jsx(Wo,{className:"h-4 w-4"})})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{children:"Share via"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(ee,{variant:"outline",className:"flex-1",onClick:()=>S("email"),disabled:u,children:[r.jsx(Ns,{className:"h-4 w-4 mr-2"}),"Email"]}),r.jsxs(ee,{variant:"outline",className:"flex-1",onClick:()=>S("text"),disabled:u,children:[r.jsx(zo,{className:"h-4 w-4 mr-2"}),"Text"]}),r.jsxs(ee,{variant:"outline",className:"flex-1",onClick:()=>S("facebook"),disabled:u,children:[r.jsx(au,{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($e,{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(Ko,{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(Un,{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 jXt={active:"bg-emerald-500",coming_soon:"bg-sky-500",price_improvement:"bg-orange-500",under_contract:"bg-purple-500",sold:"bg-gray-500"},kXt={active:"Active",coming_soon:"Coming Soon",price_improvement:"Price Improvement",under_contract:"Under Contract",sold:"Sold"},NXt={single_family:"Single Family",condo:"Condo",townhouse:"Townhouse",land:"Land",multi_family:"Multi-Family",luxury:"Luxury",commercial:"Commercial",other:"Other"};function UO({listing:e,onClick:t,onEdit:n,onDelete:s,showActions:a}){var k,M;const{user:o}=tn(),{data:l}=TRe(e.id),i=MRe(),[u,p]=E.useState(!1),x=P=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(P),y=((k=e.photos)==null?void 0:k.find(P=>P.is_primary))||((M=e.photos)==null?void 0:M[0]),_=(o==null?void 0:o.id)===e.agent_id,b=async P=>{P.stopPropagation();try{const T=await i.mutateAsync(e.id);Ie.success(T.saved?"Listing saved!":"Listing removed from saved")}catch{Ie.error("Failed to save listing")}},S=P=>{if(P.stopPropagation(),o)p(!0);else{const T=`https://listings.relevelup.com/${e.slug||e.id}`;navigator.clipboard.writeText(T),Ie.success("Link copied to clipboard!")}};return r.jsxs(Ze,{className:"overflow-hidden hover:shadow-lg transition-shadow cursor-pointer group",onClick:t,children:[r.jsxs("div",{className:"relative aspect-[4/3] bg-muted",children:[y?r.jsx("img",{src:y.photo_url,alt:e.property_address||e.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(Fg,{className:"h-12 w-12"})}),r.jsx(Pt,{className:`absolute top-2 left-2 ${jXt[e.status]} text-white border-0`,children:kXt[e.status]}),e.is_featured&&r.jsx("div",{className:"absolute top-2 right-2 p-1.5 bg-amber-500 rounded-full",children:r.jsx(js,{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:b,children:r.jsx(xi,{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:S,title:_?"Copy link":"Share & earn leads",children:_?r.jsx(Nc,{className:"h-4 w-4"}):r.jsx(Ls,{className:"h-4 w-4 text-amber-500"})})]})]}),r.jsx(hVe,{open:u,onOpenChange:p,listingId:e.id,listingSlug:e.slug||null,listingTitle:e.property_address||`${e.city}, ${e.state}`}),r.jsxs(et,{className:"p-4 space-y-3",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx("p",{className:"text-xl font-bold text-primary",children:x(e.price)}),e.open_to_referrals&&r.jsxs(Pt,{variant:"outline",className:"text-xs",children:[r.jsx(Un,{className:"h-3 w-3 mr-1"}),"Referrals"]})]}),r.jsxs("div",{children:[e.property_address&&r.jsx("p",{className:"font-medium truncate",children:e.property_address}),r.jsxs("p",{className:"text-sm text-muted-foreground flex items-center gap-1",children:[r.jsx(Po,{className:"h-3 w-3"}),e.city,", ",e.state,e.neighborhood&&` • ${e.neighborhood}`]})]}),r.jsxs("div",{className:"flex items-center gap-4 text-sm text-muted-foreground",children:[e.bedrooms&&r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(z1,{className:"h-4 w-4"}),e.bedrooms," bd"]}),e.bathrooms&&r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(F1,{className:"h-4 w-4"}),e.bathrooms," ba"]}),e.square_footage&&r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Fg,{className:"h-4 w-4"}),e.square_footage.toLocaleString()," sqft"]})]}),r.jsxs("div",{className:"flex items-center justify-between pt-2 border-t",children:[r.jsx(Pt,{variant:"secondary",className:"text-xs",children:NXt[e.property_type]}),e.agent&&r.jsx("p",{className:"text-xs text-muted-foreground truncate max-w-[120px]",children:e.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(Ko,{className:"h-3 w-3"}),e.view_count]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Nc,{className:"h-3 w-3"}),e.share_count]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(xi,{className:"h-3 w-3"}),e.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:P=>{P.stopPropagation(),n()},children:[r.jsx(gc,{className:"h-4 w-4 mr-2"}),"Edit"]}),s&&r.jsx(ee,{variant:"destructive",size:"sm",onClick:P=>{P.stopPropagation(),s()},children:r.jsx(Bn,{className:"h-4 w-4"})})]})]})]})}const SXt=[{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"}],CXt=[{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 MXt({filters:e,onFiltersChange:t,onClose:n}){const s=()=>{t({sortBy:"newest"})};return r.jsxs(Ze,{children:[r.jsxs(Wt,{className:"flex flex-row items-center justify-between pb-3",children:[r.jsx(Yt,{className:"text-lg",children:"Filters"}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(ee,{variant:"ghost",size:"sm",onClick:s,children:"Clear All"}),r.jsx(ee,{variant:"ghost",size:"icon",onClick:n,children:r.jsx(hs,{className:"h-4 w-4"})})]})]}),r.jsxs(et,{children:[r.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{children:"Status"}),r.jsxs(mn,{value:e.status||"all",onValueChange:a=>t({...e,status:a==="all"?void 0:a}),children:[r.jsx(fn,{children:r.jsx(yn,{placeholder:"All statuses"})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"all",children:"All Statuses"}),SXt.map(a=>r.jsx(qt,{value:a.value,children:a.label},a.value))]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{children:"Property Type"}),r.jsxs(mn,{value:e.propertyType||"all",onValueChange:a=>t({...e,propertyType:a==="all"?void 0:a}),children:[r.jsx(fn,{children:r.jsx(yn,{placeholder:"All types"})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"all",children:"All Types"}),CXt.map(a=>r.jsx(qt,{value:a.value,children:a.label},a.value))]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{children:"Min Price"}),r.jsx(dt,{type:"number",placeholder:"No minimum",value:e.minPrice||"",onChange:a=>t({...e,minPrice:a.target.value?Number(a.target.value):void 0})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{children:"Max Price"}),r.jsx(dt,{type:"number",placeholder:"No maximum",value:e.maxPrice||"",onChange:a=>t({...e,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($e,{children:"Open to Referrals Only"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Show only listings accepting buyer referrals"})]}),r.jsx(Ts,{checked:e.openToReferrals||!1,onCheckedChange:a=>t({...e,openToReferrals:a||void 0})})]})]})]})}function TXt({leaderboard:e}){const t=s=>{switch(s){case 0:return r.jsx(ro,{className:"h-5 w-5 text-amber-500"});case 1:return r.jsx(hy,{className:"h-5 w-5 text-gray-400"});case 2:return r.jsx(zl,{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:t(l)}),r.jsx("div",{className:"flex-1 min-w-0",children:r.jsx("p",{className:"font-medium truncate",children:o.name})}),r.jsxs(Pt,{variant:l===0?"default":"secondary",children:[o.count," ",a]})]},o.agentId))});return r.jsxs("div",{className:"space-y-6",children:[r.jsxs(Ze,{children:[r.jsx(Wt,{children:r.jsxs(Yt,{className:"flex items-center gap-2",children:[r.jsx(ro,{className:"h-5 w-5 text-amber-500"}),"Community Badges"]})}),r.jsx(et,{children:r.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[r.jsxs("div",{className:"text-center p-4 rounded-lg bg-gradient-to-br from-emerald-500/10 to-emerald-500/5 border border-emerald-500/20",children:[r.jsx("div",{className:"w-12 h-12 mx-auto mb-2 rounded-full bg-emerald-500/20 flex items-center justify-center",children:r.jsx(Nc,{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(xa,{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(hy,{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(ro,{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(Ze,{children:[r.jsx(Wt,{children:r.jsx(Yt,{children:"Community Leaderboard"})}),r.jsx(et,{children:r.jsxs(Ai,{defaultValue:"sharers",children:[r.jsxs(vi,{className:"w-full",children:[r.jsxs(sn,{value:"sharers",className:"flex-1",children:[r.jsx(Nc,{className:"h-4 w-4 mr-2"}),"Top Sharers"]}),r.jsxs(sn,{value:"listers",className:"flex-1",children:[r.jsx(xa,{className:"h-4 w-4 mr-2"}),"Top Contributors"]})]}),r.jsx(Mn,{value:"sharers",className:"mt-4",children:n(e==null?void 0:e.topSharers,"shares")}),r.jsx(Mn,{value:"listers",className:"mt-4",children:n(e==null?void 0:e.topListers,"listings")})]})})]})]})}const yTe={coming_soon:"#F59E0B",active:"#10B981",price_improvement:"#8B5CF6",under_contract:"#3B82F6",sold:"#A855F7"},vTe={coming_soon:"Coming Soon",active:"Active",price_improvement:"Price Improvement",under_contract:"Under Contract",sold:"Sold"};function AXt(e){return e>=1e6?`$${(e/1e6).toFixed(1)}M`:`$${(e/1e3).toFixed(0)}K`}function EXt({listings:e,isLoading:t}){const n=Gn(),s=E.useRef(null),a=E.useRef(null),o=E.useRef([]),{isAdmin:l}=tn(),[i,u]=E.useState(""),[p,x]=E.useState(!0),[y,_]=E.useState(!1),b=e.filter(k=>k.latitude!=null&&k.longitude!=null),S=e.filter(k=>(k.latitude==null||k.longitude==null)&&(k.property_address||k.city));return E.useEffect(()=>{(async()=>{x(!0);try{const{data:M}=await Q.from("settings").select("value").eq("key","mapbox_public_token").maybeSingle();M!=null&&M.value&&u(M.value)}catch(M){console.error("Error fetching mapbox token:",M)}x(!1)})()},[]),E.useEffect(()=>{if(!i||S.length===0||y)return;(async()=>{var M;_(!0);for(const P of S){const T=[P.property_address,P.city,P.state].filter(Boolean).join(", ");if(T)try{const z=await(await fetch(`https://api.mapbox.com/geocoding/v5/mapbox.places/${encodeURIComponent(T)}.json?access_token=${i}&limit=1`)).json();if((M=z.features)!=null&&M[0]){const[D,U]=z.features[0].center;await Q.from("listings").update({latitude:U,longitude:D}).eq("id",P.id),P.latitude=U,P.longitude=D}}catch(I){console.error("Geocode error:",I)}}_(!1)})()},[i,e]),E.useEffect(()=>{if(!s.current||!i||a.current)return;rc.accessToken=i;const k=e.filter(T=>T.latitude!=null&&T.longitude!=null);let M=[-98.5795,39.8283],P=4;if(k.length>0){const T=k.reduce((z,D)=>z+D.longitude,0)/k.length,I=k.reduce((z,D)=>z+D.latitude,0)/k.length;M=[T,I],P=k.length===1?12:10}return a.current=new rc.Map({container:s.current,style:"mapbox://styles/mapbox/light-v11",zoom:P,center:M}),a.current.addControl(new rc.NavigationControl,"top-right"),()=>{var T;(T=a.current)==null||T.remove(),a.current=null}},[i]),E.useEffect(()=>{if(!a.current||!i)return;o.current.forEach(M=>M.remove()),o.current=[];const k=e.filter(M=>M.latitude!=null&&M.longitude!=null);if(k.forEach(M=>{var U,V,W;const P=yTe[M.status]||"#10B981",T=((U=M.photos)==null?void 0:U.find(G=>G.is_primary))||((V=M.photos)==null?void 0:V[0]),I=document.createElement("div");I.className="cursor-pointer",I.innerHTML=`
`;const z=new rc.Popup({offset:25,closeButton:!0,maxWidth:"280px"}).setHTML(`
${T!=null&&T.photo_url?``:""}
${AXt(M.price)}
${M.property_address||""}
${M.city}, ${M.state}
${vTe[M.status]||M.status} ${M.bedrooms?`${M.bedrooms} bed`:""} ${M.bathrooms?`${M.bathrooms} bath`:""}
${(W=M.agent)!=null&&W.name?`
Listed by ${M.agent.name}
`:""}
Click to view details →
`),D=new rc.Marker(I).setLngLat([M.longitude,M.latitude]).setPopup(z).addTo(a.current);o.current.push(D)}),k.length>1){const M=new rc.LngLatBounds;k.forEach(P=>M.extend([P.longitude,P.latitude])),a.current.fitBounds(M,{padding:60,maxZoom:13})}else k.length===1&&a.current.flyTo({center:[k[0].longitude,k[0].latitude],zoom:12})},[e,i,y]),E.useEffect(()=>(window.__navigateToListing__=k=>{n(`/mission-control/listings/${k}`)},()=>{delete window.__navigateToListing__}),[n]),p||t?r.jsx(Ze,{children:r.jsx(et,{className:"flex items-center justify-center h-[60vh]",children:r.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-primary"})})}):i?e.length===0?r.jsx(Ze,{children:r.jsxs(et,{className:"flex flex-col items-center justify-center h-[60vh] text-center gap-3",children:[r.jsx(Po,{className:"h-12 w-12 text-muted-foreground"}),r.jsxs("div",{children:[r.jsx("p",{className:"font-semibold",children:"No Listings Yet"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Add listings to see them on the map."})]})]})}):r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex flex-wrap items-center gap-3 text-sm",children:[Object.entries(yTe).map(([k,M])=>r.jsxs("div",{className:"flex items-center gap-1.5",children:[r.jsx("div",{className:"w-3 h-3 rounded-full border-2 border-white shadow",style:{background:M}}),r.jsx("span",{className:"text-xs",children:vTe[k]})]},k)),r.jsxs("span",{className:"text-muted-foreground ml-auto text-xs",children:[b.length," of ",e.length," mapped",y&&" · Geocoding..."]})]}),r.jsx("div",{ref:s,className:"w-full h-[60vh] rounded-lg shadow-lg border"})]}):r.jsx(Ze,{children:r.jsxs(et,{className:"flex flex-col items-center justify-center h-[60vh] text-center gap-3",children:[r.jsx(yl,{className:"h-12 w-12 text-muted-foreground"}),r.jsxs("div",{children:[r.jsx("p",{className:"font-semibold",children:"Map Not Configured"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:l?"Set up your Mapbox token in Settings to enable maps.":"The map feature has not been configured yet. Please contact your administrator."})]})]})})}function IXt(){var G,J,ne,oe,ge,ie,pe,se;const e=Gn(),{brokerageId:t}=tn(),{data:n,isLoading:s}=jRe(),[a,o]=E.useState("feed"),[l,i]=E.useState(!1),[u,p]=E.useState(""),[x,y]=E.useState({sortBy:"newest"}),{data:_,isLoading:b}=kRe({...x,city:u||x.city}),{data:S,isLoading:k}=Egt(),{data:M,isLoading:P}=NRe(),{data:T,isLoading:I}=Ogt(),{data:z,isLoading:D}=Fgt(),{data:U}=Rgt(),V=CRe(),W=async fe=>{if(confirm("Are you sure you want to delete this listing? This action cannot be undone."))try{await V.mutateAsync(fe),Ie.success("Listing deleted successfully")}catch{Ie.error("Failed to delete listing")}};return s?r.jsx(Dr,{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(Dr,{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:()=>e("/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(Ze,{children:r.jsxs(et,{className:"p-4 flex items-center gap-3",children:[r.jsx("div",{className:"p-2 bg-primary/10 rounded-lg",children:r.jsx(xa,{className:"h-5 w-5 text-primary"})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-2xl font-bold",children:(_==null?void 0:_.length)||0}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Active Listings"})]})]})}),r.jsx(Ze,{children:r.jsxs(et,{className:"p-4 flex items-center gap-3",children:[r.jsx("div",{className:"p-2 bg-pink-500/10 rounded-lg",children:r.jsx(xi,{className:"h-5 w-5 text-pink-500"})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-2xl font-bold",children:(S==null?void 0:S.length)||0}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Saved"})]})]})}),r.jsx(Ze,{children:r.jsxs(et,{className:"p-4 flex items-center gap-3",children:[r.jsx("div",{className:"p-2 bg-emerald-500/10 rounded-lg",children:r.jsx(Cj,{className:"h-5 w-5 text-emerald-500"})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-2xl font-bold",children:(M==null?void 0:M.length)||0}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"My Listings"})]})]})}),r.jsx(Ze,{children:r.jsxs(et,{className:"p-4 flex items-center gap-3",children:[r.jsx("div",{className:"p-2 bg-sky-500/10 rounded-lg",children:r.jsx(Un,{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)+(((J=T==null?void 0:T.received)==null?void 0:J.length)||0)}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Referrals"})]})]})})]}),r.jsxs(Ai,{value:a,onValueChange:o,children:[r.jsxs(vi,{className:"w-full justify-start overflow-x-auto",children:[r.jsx(sn,{value:"feed",children:"Community Feed"}),t&&r.jsx(sn,{value:"brokerage",children:"Brokerage"}),r.jsx(sn,{value:"my-listings",children:"My Listings"}),r.jsx(sn,{value:"saved",children:"Saved"}),r.jsx(sn,{value:"referrals",children:"Referrals"}),r.jsx(sn,{value:"map",children:"Map"}),r.jsx(sn,{value:"leaderboard",children:"Leaderboard"})]}),r.jsxs(Mn,{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(Sa,{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:u,onChange:fe=>p(fe.target.value),className:"pl-9"})]}),r.jsxs(mn,{value:x.sortBy,onValueChange:fe=>y({...x,sortBy:fe}),children:[r.jsx(fn,{className:"w-[180px]",children:r.jsx(yn,{placeholder:"Sort by"})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"newest",children:"Newest First"}),r.jsx(qt,{value:"updated",children:"Recently Updated"}),r.jsx(qt,{value:"price_asc",children:"Price: Low to High"}),r.jsx(qt,{value:"price_desc",children:"Price: High to Low"})]})]}),r.jsxs(ee,{variant:"outline",onClick:()=>i(!l),children:[r.jsx(V1,{className:"h-4 w-4 mr-2"}),"Filters"]})]}),l&&r.jsx(MXt,{filters:x,onFiltersChange:y,onClose:()=>i(!1)}),b?r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[...Array(6)].map((fe,he)=>r.jsxs(Ze,{children:[r.jsx(Lr,{className:"h-48 w-full"}),r.jsxs(et,{className:"p-4 space-y-2",children:[r.jsx(Lr,{className:"h-5 w-3/4"}),r.jsx(Lr,{className:"h-4 w-1/2"}),r.jsx(Lr,{className:"h-4 w-1/4"})]})]},he))}):(_==null?void 0:_.length)===0?r.jsx(Ze,{children:r.jsxs(et,{className:"py-12 text-center",children:[r.jsx(xa,{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:()=>e("/mission-control/listings/new"),children:[r.jsx(bn,{className:"h-4 w-4 mr-2"}),"Add Listing"]})]})}):r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:_==null?void 0:_.map(fe=>r.jsx(UO,{listing:fe,onClick:()=>e(`/mission-control/listings/${fe.id}`)},fe.id))})]}),r.jsx(Mn,{value:"my-listings",className:"space-y-4",children:P?r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[...Array(3)].map((fe,he)=>r.jsxs(Ze,{children:[r.jsx(Lr,{className:"h-48 w-full"}),r.jsxs(et,{className:"p-4 space-y-2",children:[r.jsx(Lr,{className:"h-5 w-3/4"}),r.jsx(Lr,{className:"h-4 w-1/2"})]})]},he))}):(M==null?void 0:M.length)===0?r.jsx(Ze,{children:r.jsxs(et,{className:"py-12 text-center",children:[r.jsx(Cj,{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:()=>e("/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:M==null?void 0:M.map(fe=>r.jsx(UO,{listing:fe,showActions:!0,onClick:()=>e(`/mission-control/listings/${fe.id}`),onEdit:()=>e(`/mission-control/listings/${fe.id}/edit`),onDelete:()=>W(fe.id)},fe.id))})}),r.jsx(Mn,{value:"saved",className:"space-y-4",children:k?r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[...Array(3)].map((fe,he)=>r.jsxs(Ze,{children:[r.jsx(Lr,{className:"h-48 w-full"}),r.jsxs(et,{className:"p-4 space-y-2",children:[r.jsx(Lr,{className:"h-5 w-3/4"}),r.jsx(Lr,{className:"h-4 w-1/2"})]})]},he))}):(S==null?void 0:S.length)===0?r.jsx(Ze,{children:r.jsxs(et,{className:"py-12 text-center",children:[r.jsx(xi,{className:"h-12 w-12 mx-auto text-muted-foreground mb-4"}),r.jsx("h3",{className:"text-lg font-medium mb-2",children:"No saved listings"}),r.jsx("p",{className:"text-muted-foreground",children:"Save listings to quickly access them later"})]})}):r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:S==null?void 0:S.map(fe=>r.jsx(UO,{listing:fe.listing,onClick:()=>e(`/mission-control/listings/${fe.listing.id}`)},fe.id))})}),r.jsx(Mn,{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(Nc,{className:"h-4 w-4"}),"Referrals Sent (",((ne=T==null?void 0:T.sent)==null?void 0:ne.length)||0,")"]}),((oe=T==null?void 0:T.sent)==null?void 0:oe.length)===0?r.jsx(Ze,{children:r.jsx(et,{className:"py-8 text-center text-muted-foreground",children:"No referrals sent yet"})}):r.jsx("div",{className:"space-y-3",children:(ge=T==null?void 0:T.sent)==null?void 0:ge.map(fe=>{var he,ye;return r.jsx(Ze,{children:r.jsx(et,{className:"p-4",children:r.jsxs("div",{className:"flex justify-between items-start mb-2",children:[r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:fe.buyer_name}),r.jsx("p",{className:"text-sm text-muted-foreground",children:((he=fe.listing)==null?void 0:he.property_address)||((ye=fe.listing)==null?void 0:ye.city)})]}),r.jsx(Pt,{variant:fe.status==="closed"?"default":"secondary",children:fe.status.replace("_"," ")})]})})},fe.id)})})]}),r.jsxs("div",{children:[r.jsxs("h3",{className:"font-semibold mb-3 flex items-center gap-2",children:[r.jsx(Un,{className:"h-4 w-4"}),"Referrals Received (",((ie=T==null?void 0:T.received)==null?void 0:ie.length)||0,")"]}),((pe=T==null?void 0:T.received)==null?void 0:pe.length)===0?r.jsx(Ze,{children:r.jsx(et,{className:"py-8 text-center text-muted-foreground",children:"No referrals received yet"})}):r.jsx("div",{className:"space-y-3",children:(se=T==null?void 0:T.received)==null?void 0:se.map(fe=>{var he;return r.jsx(Ze,{children:r.jsxs(et,{className:"p-4",children:[r.jsxs("div",{className:"flex justify-between items-start mb-2",children:[r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:fe.buyer_name}),r.jsxs("p",{className:"text-sm text-muted-foreground",children:["From: ",(he=fe.sender)==null?void 0:he.name]})]}),r.jsx(Pt,{variant:fe.status==="closed"?"default":"secondary",children:fe.status.replace("_"," ")})]}),r.jsx(ee,{size:"sm",variant:"outline",className:"w-full mt-2",onClick:()=>e(`/mission-control/listings/${fe.listing_id}`),children:"View Listing"})]})},fe.id)})})]})]})}),t&&r.jsx(Mn,{value:"brokerage",className:"space-y-4",children:D?r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:[...Array(3)].map((fe,he)=>r.jsxs(Ze,{children:[r.jsx(Lr,{className:"h-48 w-full"}),r.jsxs(et,{className:"p-4 space-y-2",children:[r.jsx(Lr,{className:"h-5 w-3/4"}),r.jsx(Lr,{className:"h-4 w-1/2"})]})]},he))}):(z==null?void 0:z.length)===0?r.jsx(Ze,{children:r.jsxs(et,{className:"py-12 text-center",children:[r.jsx(Cj,{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:()=>e("/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(fe=>r.jsx(UO,{listing:fe,onClick:()=>e(`/mission-control/listings/${fe.id}`)},fe.id))})}),r.jsx(Mn,{value:"map",children:r.jsx(EXt,{listings:_||[],isLoading:b})}),r.jsx(Mn,{value:"leaderboard",children:r.jsx(TXt,{leaderboard:U})})]})]})}):r.jsx(Dr,{title:"Listing Exchange",description:"Community-powered listing collaboration",children:r.jsx(Ze,{children:r.jsxs(et,{className:"py-12 text-center",children:[r.jsx(xa,{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 ave(){const e=Kc();return Kt({queryKey:["deal-pipeline-stages",e],queryFn:async()=>{if(!e)return[];const{data:t,error:n}=await Q.from("deal_pipeline_stages").select("*").eq("owner_user_id",e).order("sort_order",{ascending:!0});if(n)throw n;return t},enabled:!!e})}function fVe(){const e=Kc(),t=Hr();return ir({mutationFn:async()=>{if(!e)throw new Error("Not authenticated");const{error:n}=await Q.rpc("initialize_deal_pipeline_stages",{p_user_id:e});if(n)throw n},onSuccess:()=>{t.invalidateQueries({queryKey:["deal-pipeline-stages"]})}})}function pVe(){const e=Kc();return Kt({queryKey:["deal-pipeline-deals",e],queryFn:async()=>{if(!e)return[];const{data:t,error:n}=await Q.from("deal_pipeline").select(` *, contact:innercircle_contacts(id, first_name, last_name, email, phone), listing:listings(id, property_address, city, state, price, status, created_at) `).eq("owner_user_id",e).order("updated_at",{ascending:!1});if(n)throw n;return t},enabled:!!e})}function mVe(){const e=Kc(),t=Hr();return ir({mutationFn:async n=>{if(!e)throw new Error("Not authenticated");const{data:s,error:a}=await Q.from("deal_pipeline").insert({deal_name:n.deal_name,deal_type:n.deal_type,stage_id:n.stage_id||null,contact_id:n.contact_id||null,listing_id:n.listing_id||null,property_address:n.property_address||null,city:n.city||null,state:n.state||null,zip_code:n.zip_code||null,expected_price:n.expected_price||null,expected_commission:n.expected_commission||null,commission_percentage:n.commission_percentage||3,target_close_date:n.target_close_date||null,contract_date:n.contract_date||null,listing_date:n.listing_date||null,priority:n.priority||"medium",probability:n.probability||50,notes:n.notes||null,owner_user_id:e}).select().single();if(a)throw a;return await Q.from("deal_activities").insert([{deal_id:s.id,activity_type:"system",title:"Deal created",description:`Deal "${n.deal_name}" was created`}]),s},onSuccess:()=>{t.invalidateQueries({queryKey:["deal-pipeline-deals"]}),t.invalidateQueries({queryKey:["deal-pipeline-stats"]})}})}function gVe(){const e=Hr();return ir({mutationFn:async({id:t,...n})=>{const{data:s,error:a}=await Q.from("deal_pipeline").update(n).eq("id",t).select().single();if(a)throw a;return s},onSuccess:()=>{e.invalidateQueries({queryKey:["deal-pipeline-deals"]}),e.invalidateQueries({queryKey:["deal-pipeline-stats"]})}})}function PXt(){const e=Hr();return ir({mutationFn:async({dealId:t,stageId:n,stageName:s})=>{const{data:a,error:o}=await Q.from("deal_pipeline").update({stage_id:n}).eq("id",t).select().single();if(o)throw o;return await Q.from("deal_activities").insert({deal_id:t,activity_type:"stage_change",title:`Moved to ${s}`,metadata:{new_stage_id:n,new_stage_name:s}}),a},onSuccess:()=>{e.invalidateQueries({queryKey:["deal-pipeline-deals"]}),e.invalidateQueries({queryKey:["deal-activities"]})}})}function LXt(){const e=Hr();return ir({mutationFn:async t=>{const{error:n}=await Q.from("deal_pipeline").delete().eq("id",t);if(n)throw n},onSuccess:()=>{e.invalidateQueries({queryKey:["deal-pipeline-deals"]}),e.invalidateQueries({queryKey:["deal-pipeline-stats"]})}})}function OXt(e){return Kt({queryKey:["deal-activities",e],queryFn:async()=>{const{data:t,error:n}=await Q.from("deal_activities").select("*").eq("deal_id",e).order("created_at",{ascending:!1});if(n)throw n;return t},enabled:!!e})}function DXt(){const e=Hr();return ir({mutationFn:async t=>{const{data:n,error:s}=await Q.from("deal_activities").insert([{deal_id:t.deal_id,activity_type:t.activity_type,title:t.title,description:t.description||null}]).select().single();if(s)throw s;return n},onSuccess:(t,n)=>{e.invalidateQueries({queryKey:["deal-activities",n.deal_id]})}})}function RXt(e){return Kt({queryKey:["deal-checklist",e],queryFn:async()=>{const{data:t,error:n}=await Q.from("deal_checklist_items").select("*").eq("deal_id",e).order("sort_order",{ascending:!0});if(n)throw n;return t},enabled:!!e})}function FXt(){const e=Hr();return ir({mutationFn:async({id:t,is_completed:n,deal_id:s})=>{const{data:a,error:o}=await Q.from("deal_checklist_items").update({is_completed:n,completed_at:n?new Date().toISOString():null}).eq("id",t).select().single();if(o)throw o;return a},onSuccess:(t,n)=>{e.invalidateQueries({queryKey:["deal-checklist",n.deal_id]})}})}function zXt(){const e=Hr();return ir({mutationFn:async t=>{const{data:n,error:s}=await Q.from("deal_checklist_items").insert([{deal_id:t.deal_id,title:t.title,description:t.description||null,due_date:t.due_date||null,sort_order:t.sort_order||0}]).select().single();if(s)throw s;return n},onSuccess:(t,n)=>{e.invalidateQueries({queryKey:["deal-checklist",n.deal_id]})}})}function BXt(){const e=Kc();return Kt({queryKey:["deal-pipeline-stats",e],queryFn:async()=>{if(!e)return null;const{data:t,error:n}=await Q.from("deal_pipeline").select("expected_price, expected_commission, stage_id, deal_pipeline_stages(is_won_stage, is_lost_stage)").eq("owner_user_id",e);if(n)throw n;const s=(t==null?void 0:t.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=(t==null?void 0:t.filter(o=>{var l;return(l=o.deal_pipeline_stages)==null?void 0:l.is_won_stage}))||[];return{totalDeals:(t==null?void 0:t.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:!!e})}function $Xt(e){const t=Kc();return Kt({queryKey:["deal-by-listing",e,t],queryFn:async()=>{if(!t||!e)return null;const{data:n,error:s}=await Q.from("deal_pipeline").select(` *, deal_pipeline_stages(id, name, color) `).eq("owner_user_id",t).eq("listing_id",e).maybeSingle();if(s)throw s;return n},enabled:!!t&&!!e})}function UXt(){const e=Hr();return ir({mutationFn:async({dealId:t,listingId:n})=>{const{data:s,error:a}=await Q.from("deal_pipeline").update({listing_id:n}).eq("id",t).select().single();if(a)throw a;return await Q.from("deal_activities").insert({deal_id:t,activity_type:"system",title:"Linked to Listing Exchange",description:"This deal is now synced with Listing Exchange",metadata:{listing_id:n}}),s},onSuccess:(t,n)=>{e.invalidateQueries({queryKey:["deal-pipeline-deals"]}),e.invalidateQueries({queryKey:["deal-by-listing",n.listingId]})}})}function qXt(){const e=Hr();return ir({mutationFn:async({dealId:t,listingId:n})=>{const{data:s,error:a}=await Q.from("deal_pipeline").update({listing_id:null}).eq("id",t).select().single();if(a)throw a;return{data:s,listingId:n}},onSuccess:t=>{e.invalidateQueries({queryKey:["deal-pipeline-deals"]}),e.invalidateQueries({queryKey:["deal-by-listing",t.listingId]})}})}function VXt({listing:e}){const t=Gn(),[n,s]=E.useState(""),[a,o]=E.useState(!1),{data:l,isLoading:i}=$Xt(e.id),{data:u,isLoading:p}=ave(),{data:x,isLoading:y}=pVe(),_=fVe(),b=UXt(),S=qXt(),k=mVe(),M=(x==null?void 0:x.filter(D=>!D.listing_id))||[],P=D=>{if(!(u!=null&&u.length))return null;switch(D){case"coming_soon":case"active":case"price_improvement":return u.find(U=>U.name==="Active");case"under_contract":return u.find(U=>U.name==="Under Contract");case"sold":return u.find(U=>U.is_won_stage);default:return u.find(U=>U.name==="Active")}},T=async()=>{o(!0);try{u!=null&&u.length||await _.mutateAsync();const D=P(e.status);await k.mutateAsync({deal_name:e.property_address?`${e.property_address}, ${e.city}`:`${e.city}, ${e.state}`,deal_type:"seller",stage_id:(D==null?void 0:D.id)||null,listing_id:e.id,property_address:e.property_address,city:e.city,state:e.state,expected_price:e.price,expected_commission:e.price*.03,commission_percentage:3,priority:"medium",probability:50}),Ie.success("Deal created and linked to listing!")}catch(D){console.error("Failed to create deal:",D),Ie.error("Failed to create deal")}finally{o(!1)}},I=async()=>{if(!n){Ie.error("Please select a deal");return}try{await b.mutateAsync({dealId:n,listingId:e.id}),Ie.success("Listing linked to deal!"),s("")}catch{Ie.error("Failed to link listing")}},z=async()=>{if(l)try{await S.mutateAsync({dealId:l.id,listingId:e.id}),Ie.success("Listing unlinked from deal")}catch{Ie.error("Failed to unlink listing")}};return i||p?r.jsxs(Ze,{children:[r.jsx(Wt,{children:r.jsxs(Yt,{className:"flex items-center gap-2 text-base",children:[r.jsx(uy,{className:"h-4 w-4"}),"Deal Pipeline"]})}),r.jsx(et,{children:r.jsx("div",{className:"flex items-center justify-center py-4",children:r.jsx(Zr,{className:"h-5 w-5 animate-spin text-muted-foreground"})})})]}):l?r.jsxs(Ze,{className:"border-primary/20 bg-primary/5",children:[r.jsx(Wt,{className:"pb-2",children:r.jsxs(Yt,{className:"flex items-center gap-2 text-base",children:[r.jsx(mf,{className:"h-4 w-4 text-primary"}),"Linked to Pipeline"]})}),r.jsxs(et,{className:"space-y-3",children:[r.jsx("div",{className:"flex items-center justify-between",children:r.jsxs("div",{children:[r.jsx("p",{className:"font-medium text-sm",children:l.deal_name}),r.jsx("div",{className:"flex items-center gap-2 mt-1",children:l.deal_pipeline_stages&&r.jsx(Pt,{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:()=>t("/mission-control/pipeline"),children:["View Pipeline",r.jsx(Vo,{className:"h-3 w-3 ml-1"})]}),r.jsx(ee,{variant:"ghost",size:"sm",onClick:z,disabled:S.isPending,children:S.isPending?r.jsx(Zr,{className:"h-4 w-4 animate-spin"}):r.jsx(CA,{className:"h-4 w-4"})})]})]})]}):r.jsxs(Ze,{children:[r.jsx(Wt,{className:"pb-2",children:r.jsxs(Yt,{className:"flex items-center gap-2 text-base",children:[r.jsx(uy,{className:"h-4 w-4"}),"Deal Pipeline"]})}),r.jsxs(et,{className:"space-y-4",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Link this listing to your pipeline to track the deal and sync status changes."}),r.jsxs(ee,{onClick:T,disabled:a||k.isPending,className:"w-full",size:"sm",children:[a||k.isPending?r.jsx(Zr,{className:"h-4 w-4 mr-2 animate-spin"}):r.jsx(bn,{className:"h-4 w-4 mr-2"}),"Create New Deal"]}),M.length>0&&r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"relative",children:[r.jsx("div",{className:"absolute inset-0 flex items-center",children:r.jsx("span",{className:"w-full border-t"})}),r.jsx("div",{className:"relative flex justify-center text-xs uppercase",children:r.jsx("span",{className:"bg-card px-2 text-muted-foreground",children:"or"})})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(mn,{value:n,onValueChange:s,children:[r.jsx(fn,{className:"flex-1 text-sm",children:r.jsx(yn,{placeholder:"Link to existing deal..."})}),r.jsx(pn,{children:M.map(D=>r.jsx(qt,{value:D.id,children:D.deal_name},D.id))})]}),r.jsx(ee,{variant:"secondary",size:"icon",onClick:I,disabled:!n||b.isPending,children:b.isPending?r.jsx(Zr,{className:"h-4 w-4 animate-spin"}):r.jsx(mf,{className:"h-4 w-4"})})]})]})]})]})}const HXt={active:"bg-emerald-500",coming_soon:"bg-sky-500",price_improvement:"bg-orange-500",under_contract:"bg-purple-500",sold:"bg-gray-500"},WXt={active:"Active",coming_soon:"Coming Soon",price_improvement:"Price Improvement",under_contract:"Under Contract",sold:"Sold"},_Te={single_family:"Single Family",condo:"Condo",townhouse:"Townhouse",land:"Land",multi_family:"Multi-Family",luxury:"Luxury",commercial:"Commercial",other:"Other"};function GXt(){var ge,ie,pe,se,fe,he,ye,Ae,we;const{listingId:e}=md(),t=Gn(),{user:n}=tn(),{data:s,isLoading:a}=SRe(e||""),{data:o}=TRe(e||""),{data:l}=Pgt(e||""),i=MRe(),u=Igt(),p=Lgt(),x=CRe(),y=Dgt(),[_,b]=E.useState(!1),[S,k]=E.useState(!1),[M,P]=E.useState(!1),[T,I]=E.useState(null),[z,D]=E.useState({buyerName:"",buyerType:"",notes:""}),U=(n==null?void 0:n.id)===(s==null?void 0:s.agent_id),V=be=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(be),W=async be=>{const _e=`https://listings.relevelup.com/${(s==null?void 0:s.slug)||(s==null?void 0:s.id)}`,Je=`Check out this listing: ${(s==null?void 0:s.property_address)||(s==null?void 0:s.city)}`;p.mutate({listingId:s.id,shareType:be});try{switch(be){case"facebook":window.open(`https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(_e)}`,"_blank");break;case"copy":await navigator.clipboard.writeText(_e),Ie.success("Link copied to clipboard!");break;case"text":window.open(`sms:?body=${encodeURIComponent(`${Je} ${_e}`)}`);break;case"email":window.open(`mailto:?subject=${encodeURIComponent(Je)}&body=${encodeURIComponent(`Check out this listing: ${_e}`)}`);break}}catch(Te){console.error("Share error:",Te),Ie.error("Failed to share")}},G=async()=>{try{await x.mutateAsync(s.id),Ie.success("Listing deleted"),t("/mission-control/listings")}catch{Ie.error("Failed to delete listing")}},J=async()=>{if(!z.buyerName.trim()){Ie.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}),Ie.success("Referral sent successfully!"),k(!1),D({buyerName:"",buyerType:"",notes:""})}catch{Ie.error("Failed to send referral")}},ne=be=>{var qe,ot;const _e=(s==null?void 0:s.property_address)||`${s==null?void 0:s.city}, ${s==null?void 0:s.state}`,Je=V((s==null?void 0:s.price)||0),Te=s!=null&&s.bedrooms?`${s.bedrooms}BD`:"",De=s!=null&&s.bathrooms?`${s.bathrooms}BA`:"",Ue=s!=null&&s.square_footage?`${s.square_footage.toLocaleString()}SF`:"",Be=[Te,De,Ue].filter(Boolean).join(" | ");switch(be){case"just_listed":return`🏡 JUST LISTED! ${_e} ${Je} ${Be} ${(s==null?void 0:s.description)||"Schedule your showing today!"} #JustListed #RealEstate #HomeForSale #${(qe=s==null?void 0:s.city)==null?void 0:qe.replace(/\s/g,"")}`;case"price_improvement":return`📣 PRICE IMPROVEMENT! ${_e} Now ${Je}! ${Be} Don't miss this opportunity! #PriceReduced #RealEstate #HomeForSale`;case"teaser":return`Looking for a ${_Te[(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! ${Be} DM me for details! 📩 #ComingSoon #RealEstate #${(ot=s==null?void 0:s.city)==null?void 0:ot.replace(/\s/g,"")}`;default:return""}};if(a)return r.jsx(Dr,{title:"Listing",description:"",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Lr,{className:"h-10 w-32"}),r.jsx(Lr,{className:"h-[400px] w-full"}),r.jsxs("div",{className:"grid md:grid-cols-3 gap-6",children:[r.jsx(Lr,{className:"h-48"}),r.jsx(Lr,{className:"h-48"}),r.jsx(Lr,{className:"h-48"})]})]})});if(!s)return r.jsx(Dr,{title:"Listing Not Found",description:"",children:r.jsx(Ze,{children:r.jsxs(et,{className:"py-12 text-center",children:[r.jsx("p",{className:"text-muted-foreground mb-4",children:"This listing could not be found."}),r.jsx(ee,{onClick:()=>t("/mission-control/listings"),children:"Back to Listings"})]})})});const oe=((ge=s.photos)==null?void 0:ge.find(be=>be.is_primary))||((ie=s.photos)==null?void 0:ie[0]);return r.jsxs(Dr,{title:"",description:"",children:[r.jsxs("div",{className:"space-y-6",children:[r.jsxs(ee,{variant:"ghost",onClick:()=>t("/mission-control/listings"),children:[r.jsx(po,{className:"h-4 w-4 mr-2"}),"Back to Listings"]}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[r.jsx("div",{className:"md:col-span-2",children:r.jsx("div",{className:"aspect-[16/10] rounded-lg overflow-hidden bg-muted cursor-pointer",onClick:()=>oe&&I(oe.photo_url),children:oe?r.jsx("img",{src:oe.photo_url,alt:"Primary",className:"w-full h-full object-cover"}):r.jsx("div",{className:"w-full h-full flex items-center justify-center text-muted-foreground",children:"No photos"})})}),r.jsx("div",{className:"grid grid-cols-2 gap-2",children:(pe=s.photos)==null?void 0:pe.slice(1,5).map((be,_e)=>r.jsx("div",{className:"aspect-square rounded-lg overflow-hidden bg-muted cursor-pointer",onClick:()=>I(be.photo_url),children:r.jsx("img",{src:be.photo_url,alt:`Photo ${_e+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(Ze,{children:r.jsxs(et,{className:"p-6",children:[r.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-4 mb-6",children:[r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[r.jsx(Pt,{className:`${HXt[s.status]} text-white border-0`,children:WXt[s.status]}),s.is_featured&&r.jsxs(Pt,{variant:"outline",className:"border-amber-500 text-amber-500",children:[r.jsx(js,{className:"h-3 w-3 mr-1 fill-amber-500"}),"Featured"]}),s.open_to_referrals&&r.jsxs(Pt,{variant:"outline",children:[r.jsx(Un,{className:"h-3 w-3 mr-1"}),"Open to Referrals"]})]}),r.jsx("h1",{className:"text-3xl font-bold text-primary mb-2",children:V(s.price)}),s.property_address&&r.jsx("p",{className:"text-xl font-medium",children:s.property_address}),r.jsxs("p",{className:"text-muted-foreground flex items-center gap-1",children:[r.jsx(Po,{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(xi,{className:`h-4 w-4 ${o?"fill-pink-500 text-pink-500":""}`})}),r.jsx(ee,{variant:"outline",size:"icon",onClick:()=>u.mutate(s.id),children:l?r.jsx(Sj,{className:"h-4 w-4"}):r.jsx(Lg,{className:"h-4 w-4"})}),!U&&r.jsxs(ee,{variant:"outline",className:"border-amber-500 text-amber-600 hover:bg-amber-50",onClick:()=>P(!0),children:[r.jsx(Ls,{className:"h-4 w-4 mr-2"}),"Share & Earn Leads"]}),r.jsxs(Lh,{children:[r.jsx(Oh,{asChild:!0,children:r.jsxs(ee,{variant:"outline",children:[r.jsx(Nc,{className:"h-4 w-4 mr-2"}),"Share"]})}),r.jsxs(ah,{children:[r.jsxs(ei,{onClick:()=>W("copy"),children:[r.jsx(Wo,{className:"h-4 w-4 mr-2"}),"Copy Link"]}),r.jsxs(ei,{onClick:()=>W("facebook"),children:[r.jsx(au,{className:"h-4 w-4 mr-2"}),"Facebook"]}),r.jsxs(ei,{onClick:()=>W("text"),children:[r.jsx(zo,{className:"h-4 w-4 mr-2"}),"Text"]}),r.jsxs(ei,{onClick:()=>W("email"),children:[r.jsx(Ns,{className:"h-4 w-4 mr-2"}),"Email"]})]})]}),U&&r.jsxs(r.Fragment,{children:[r.jsxs(ee,{variant:"outline",onClick:()=>t(`/mission-control/listings/${s.id}/edit`),children:[r.jsx(gc,{className:"h-4 w-4 mr-2"}),"Edit"]}),r.jsx(ee,{variant:"destructive",size:"icon",onClick:()=>b(!0),children:r.jsx(Bn,{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(z1,{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(F1,{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(Fg,{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(Ss,{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(Pt,{variant:"secondary",children:[r.jsx(hi,{className:"h-3 w-3 mr-1"}),_Te[s.property_type]]}),s.lot_size&&r.jsxs(Pt,{variant:"secondary",children:["Lot: ",s.lot_size]}),s.has_hoa&&r.jsx(Pt,{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(As,{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(Ko,{className:"h-4 w-4"}),s.view_count," views"]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(Nc,{className:"h-4 w-4"}),s.share_count," shares"]}),r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(xi,{className:"h-4 w-4"}),s.save_count," saves"]})]})]})}),s.allow_sharing&&r.jsxs(Ze,{children:[r.jsx(Wt,{children:r.jsx(Yt,{className:"text-lg",children:"Share Content"})}),r.jsx(et,{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(ne(be)),Ie.success("Caption copied!")},children:r.jsx(Wo,{className:"h-3 w-3"})})]}),r.jsx("p",{className:"text-xs text-muted-foreground whitespace-pre-wrap",children:ne(be)})]},be))})]})]}),r.jsxs("div",{className:"space-y-6",children:[r.jsxs(Ze,{children:[r.jsx(Wt,{children:r.jsx(Yt,{className:"text-lg",children:"Listing Agent"})}),r.jsxs(et,{children:[r.jsxs("div",{className:"flex items-center gap-3 mb-4",children:[r.jsx("div",{className:"w-12 h-12 rounded-full bg-primary/10 flex items-center justify-center",children:r.jsx("span",{className:"text-lg font-semibold text-primary",children:((fe=(se=s.agent)==null?void 0:se.name)==null?void 0:fe.charAt(0))||"?"})}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:((he=s.agent)==null?void 0:he.name)||"Unknown"}),((Ae=(ye=s.agent)==null?void 0:ye.brokerage)==null?void 0:Ae.name)&&r.jsx("p",{className:"text-sm text-muted-foreground",children:s.agent.brokerage.name})]})]}),!U&&r.jsx("div",{className:"space-y-2",children:((we=s.agent)==null?void 0:we.email)&&r.jsx(ee,{variant:"outline",className:"w-full",asChild:!0,children:r.jsxs("a",{href:`mailto:${s.agent.email}`,children:[r.jsx(Ns,{className:"h-4 w-4 mr-2"}),"Email Agent"]})})})]})]}),U&&r.jsx(VXt,{listing:s}),!U&&s.open_to_referrals&&r.jsxs(Ze,{children:[r.jsx(Wt,{children:r.jsxs(Yt,{className:"text-lg flex items-center gap-2",children:[r.jsx(Un,{className:"h-5 w-5"}),"Send a Buyer"]})}),r.jsxs(et,{children:[r.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"Have a buyer interested in this property? Send a referral to the listing agent."}),r.jsx(ee,{className:"w-full",onClick:()=>k(!0),children:"Send Referral"})]})]})]})]})]}),r.jsx(Or,{open:!!T,onOpenChange:()=>I(null),children:r.jsx(Ir,{className:"max-w-4xl",children:r.jsx("img",{src:T||"",alt:"Full size",className:"w-full h-auto"})})}),r.jsx(Or,{open:_,onOpenChange:b,children:r.jsxs(Ir,{children:[r.jsxs($r,{children:[r.jsx(Fr,{children:"Delete Listing"}),r.jsx(Zn,{children:"Are you sure you want to delete this listing? This action cannot be undone."})]}),r.jsxs(Bs,{children:[r.jsx(ee,{variant:"outline",onClick:()=>b(!1),children:"Cancel"}),r.jsx(ee,{variant:"destructive",onClick:G,disabled:x.isPending,children:x.isPending?"Deleting...":"Delete"})]})]})}),r.jsx(Or,{open:S,onOpenChange:k,children:r.jsxs(Ir,{children:[r.jsxs($r,{children:[r.jsx(Fr,{children:"Send Buyer Referral"}),r.jsx(Zn,{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($e,{children:"Buyer Name *"}),r.jsx(dt,{value:z.buyerName,onChange:be=>D({...z,buyerName:be.target.value}),placeholder:"Enter buyer's name"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{children:"Buyer Type"}),r.jsxs(mn,{value:z.buyerType,onValueChange:be=>D({...z,buyerType:be}),children:[r.jsx(fn,{children:r.jsx(yn,{placeholder:"Select type"})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"first_time",children:"First-Time Buyer"}),r.jsx(qt,{value:"investor",children:"Investor"}),r.jsx(qt,{value:"relocating",children:"Relocating"}),r.jsx(qt,{value:"upgrade",children:"Upgrading"}),r.jsx(qt,{value:"downsize",children:"Downsizing"})]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{children:"Notes"}),r.jsx(Jn,{value:z.notes,onChange:be=>D({...z,notes:be.target.value}),placeholder:"Any additional information..."})]})]}),r.jsxs(Bs,{children:[r.jsx(ee,{variant:"outline",onClick:()=>k(!1),children:"Cancel"}),r.jsx(ee,{onClick:J,disabled:y.isPending,children:y.isPending?"Sending...":"Send Referral"})]})]})}),r.jsx(hVe,{open:M,onOpenChange:P,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 KXt({selectedVideoId:e,onVideoSelect:t,listingId:n}){const s=Gn(),{user:a}=tn(),[o,l]=E.useState(!1),[i,u]=E.useState([]),[p,x]=E.useState(!1),[y,_]=E.useState(null),[b,S]=E.useState({});E.useEffect(()=>{e&&a?k():_(null)},[e,a]);const k=async()=>{if(!e)return;const{data:G,error:J}=await Q.from("agent_videos").select("id, bunny_video_id, title, thumbnail_url, preview_url, playback_url, duration_seconds, status, created_at").eq("id",e).eq("is_deleted",!1).single();!J&&G&&(_(G),M(G))},M=async G=>{try{const{data:J,error:ne}=await Q.functions.invoke("bunny-upload",{body:{action:"asset-urls",videoId:G.bunny_video_id,isAgentVideo:!0}});!ne&&(J!=null&&J.thumbnailUrl)&&S(oe=>({...oe,[G.id]:{thumbnailUrl:J.thumbnailUrl}}))}catch(J){console.warn("Failed to get signed URL",J)}},P=async()=>{if(a){x(!0);try{const{data:G,error:J}=await Q.from("agent_videos").select("id, bunny_video_id, title, thumbnail_url, preview_url, playback_url, duration_seconds, status, created_at").eq("owner_user_id",a.id).eq("is_deleted",!1).eq("status","ready").order("created_at",{ascending:!1});if(J)throw J;u(G||[]),G!=null&&G.length&&T(G)}catch(G){console.error("Error fetching videos:",G),Ie.error("Failed to load videos")}finally{x(!1)}}},T=async G=>{var J;try{const ne=G.map(se=>se.bunny_video_id),{data:oe,error:ge}=await Q.functions.invoke("bunny-upload",{body:{action:"bulk-asset-urls",videoIds:ne,isAgentVideo:!0}});if(ge)throw ge;const ie=(oe==null?void 0:oe.assets)||{},pe={};for(const se of G)(J=ie[se.bunny_video_id])!=null&&J.thumbnailUrl&&(pe[se.id]={thumbnailUrl:ie[se.bunny_video_id].thumbnailUrl});S(se=>({...se,...pe}))}catch(ne){console.warn("Failed to bulk-fetch signed URLs",ne)}},I=()=>{l(!0),P()},z=G=>{t(G.id),_(G),l(!1),Ie.success("Video selected")},D=()=>{t(null),_(null)},U=()=>{const G=n?`/mission-control/listings/${n}/edit`:"/mission-control/listings/new";s(`/mission-control/video?returnUrl=${encodeURIComponent(G)}`)},V=G=>{if(!G)return"0:00";const J=Math.floor(G/60),ne=G%60;return`${J}:${ne.toString().padStart(2,"0")}`},W=G=>{var J;return((J=b[G.id])==null?void 0:J.thumbnailUrl)||G.thumbnail_url};return r.jsxs("div",{className:"space-y-3",children:[y?r.jsx(Ze,{className:"overflow-hidden",children:r.jsx(et,{className:"p-0",children:r.jsxs("div",{className:"flex items-start gap-4 p-4",children:[r.jsxs("div",{className:"relative w-32 h-20 bg-muted rounded-lg overflow-hidden flex-shrink-0",children:[W(y)?r.jsx("img",{src:W(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($a,{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(Vl,{className:"h-6 w-6 text-white fill-white"})}),y.duration_seconds&&r.jsx("div",{className:"absolute bottom-1 right-1 bg-black/70 text-white text-[10px] px-1.5 py-0.5 rounded",children:V(y.duration_seconds)})]}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"font-medium text-sm truncate",children:y.title||"Untitled Video"}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Property Video Tour"})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(ee,{type:"button",variant:"outline",size:"sm",onClick:I,children:"Change"}),r.jsx(ee,{type:"button",variant:"ghost",size:"sm",onClick:D,className:"text-destructive hover:text-destructive",children:r.jsx(hs,{className:"h-4 w-4"})})]})]})})}):r.jsx(Ze,{className:"border-dashed",children:r.jsx(et,{className:"p-6",children:r.jsxs("div",{className:"text-center",children:[r.jsx($a,{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:I,className:"gap-2",children:[r.jsx(SS,{className:"h-4 w-4"}),"Select from Library"]}),r.jsxs(ee,{type:"button",variant:"outline",onClick:U,className:"gap-2",children:[r.jsx(Og,{className:"h-4 w-4"}),"Record New Video"]})]})]})})}),r.jsx(Or,{open:o,onOpenChange:l,children:r.jsxs(Ir,{className:"max-w-2xl max-h-[80vh] overflow-hidden flex flex-col",children:[r.jsx($r,{children:r.jsxs(Fr,{className:"flex items-center gap-2",children:[r.jsx(SS,{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(Zr,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):i.length===0?r.jsxs("div",{className:"text-center py-12",children:[r.jsx($a,{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:U,className:"gap-2",children:[r.jsx(Og,{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 ${e===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:[W(G)?r.jsx("img",{src:W(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($a,{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(Vl,{className:"h-8 w-8 text-white opacity-0 group-hover:opacity-100 transition-opacity"})}),G.duration_seconds&&r.jsx("div",{className:"absolute bottom-1 right-1 bg-black/70 text-white text-[10px] px-1.5 py-0.5 rounded",children:V(G.duration_seconds)})]}),r.jsx("div",{className:"p-2 bg-card",children:r.jsx("p",{className:"text-xs font-medium truncate",children:G.title||"Untitled Video"})})]},G.id))})}),r.jsxs("div",{className:"flex justify-between items-center pt-4 border-t",children:[r.jsxs(ee,{type:"button",variant:"ghost",onClick:U,className:"gap-2",children:[r.jsx(Og,{className:"h-4 w-4"}),"Record New Video"]}),r.jsx(ee,{type:"button",variant:"outline",onClick:()=>l(!1),children:"Cancel"})]})]})})]})}const ZXt=[{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"}],YXt=[{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 bTe(){var pe;const{listingId:e}=md(),[t]=Gc(),n=t.get("brokerage"),s=Gn(),{user:a}=tn(),o=!!e&&e!=="new",l=!!n&&!o,{data:i,isLoading:u}=SRe(o?e:""),p=Sgt(),x=Cgt(),y=Mgt(),_=Tgt(),b=Agt(),{data:S=[]}=Kt({queryKey:["brokerage-agents",n],queryFn:async()=>{if(!n)return[];const{data:se,error:fe}=await Q.from("profiles").select("id, name, email").eq("brokerage_id",n).order("name");if(fe)throw fe;return se||[]},enabled:l}),[k,M]=E.useState(""),[P,T]=E.useState(!1),[I,z]=E.useState([]),[D,U]=E.useState([]),[V,W]=E.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});E.useEffect(()=>{var se,fe,he,ye,Ae;i&&o&&W({property_address:i.property_address||"",city:i.city||"",state:i.state||"",neighborhood:i.neighborhood||"",price:((se=i.price)==null?void 0:se.toString())||"",property_type:i.property_type,status:i.status,bedrooms:((fe=i.bedrooms)==null?void 0:fe.toString())||"",bathrooms:((he=i.bathrooms)==null?void 0:he.toString())||"",square_footage:((ye=i.square_footage)==null?void 0:ye.toString())||"",lot_size:i.lot_size||"",year_built:((Ae=i.year_built)==null?void 0:Ae.toString())||"",has_hoa:i.has_hoa,description:i.description||"",agent_notes:i.agent_notes||"",agent_notes_public:i.agent_notes_public,mls_link:i.mls_link||"",video_link:i.video_link||"",video_id:i.video_id||null,allow_sharing:i.allow_sharing,open_to_referrals:i.open_to_referrals,open_to_social_promotion:i.open_to_social_promotion,share_with_brokerage:i.share_with_brokerage??!1,is_public:i.is_public})},[i,o]);const G=se=>{if(!se)return;const fe=Array.from(se);z(ye=>[...ye,...fe]);const he=fe.map(ye=>URL.createObjectURL(ye));U(ye=>[...ye,...he])},J=se=>{URL.revokeObjectURL(D[se]),z(fe=>fe.filter((he,ye)=>ye!==se)),U(fe=>fe.filter((he,ye)=>ye!==se))},ne=async se=>{var fe;if(!(!se||!i)){T(!0);try{for(const he of Array.from(se)){const ye=he.name.split(".").pop(),Ae=`${a==null?void 0:a.id}/${i.id}/${Date.now()}.${ye}`,{error:we}=await Q.storage.from("listing-photos").upload(Ae,he);if(we)throw we;const{data:{publicUrl:be}}=Q.storage.from("listing-photos").getPublicUrl(Ae);await _.mutateAsync({listingId:i.id,photoUrl:be,isPrimary:!((fe=i.photos)!=null&&fe.length)})}Ie.success("Photos uploaded!")}catch(he){console.error("Upload error:",he),Ie.error("Failed to upload photos")}finally{T(!1)}}},oe=async se=>{for(let fe=0;fe{if(i)try{await b.mutateAsync({photoId:se,listingId:i.id}),Ie.success("Photo removed")}catch{Ie.error("Failed to remove photo")}},ie=async se=>{if(se.preventDefault(),!V.city.trim()||!V.state.trim()||!V.price){Ie.error("Please fill in required fields (City, State, Price)");return}if(l&&!k){Ie.error("Please select an agent to assign this listing to");return}try{const fe={property_address:V.property_address||null,city:V.city,state:V.state,neighborhood:V.neighborhood||null,price:Number(V.price),property_type:V.property_type,status:V.status,bedrooms:V.bedrooms?Number(V.bedrooms):null,bathrooms:V.bathrooms?Number(V.bathrooms):null,square_footage:V.square_footage?Number(V.square_footage):null,lot_size:V.lot_size||null,year_built:V.year_built?Number(V.year_built):null,has_hoa:V.has_hoa,description:V.description||null,agent_notes:V.agent_notes||null,agent_notes_public:V.agent_notes_public,mls_link:V.mls_link||null,video_link:V.video_link||null,video_id:V.video_id||null,allow_sharing:V.allow_sharing,open_to_referrals:V.open_to_referrals,open_to_social_promotion:V.open_to_social_promotion,share_with_brokerage:V.share_with_brokerage,is_public:V.is_public};if(o)await y.mutateAsync({id:e,...fe}),Ie.success("Listing updated!"),s(`/mission-control/listings/${e}`);else{T(!0);let he;if(l&&k?he=await x.mutateAsync({agentId:k,...fe}):he=await p.mutateAsync(fe),I.length>0)try{await oe(he.id),D.forEach(ye=>URL.revokeObjectURL(ye)),z([]),U([])}catch(ye){console.error("Photo upload error:",ye),Ie.error("Listing created but some photos failed to upload")}T(!1),Ie.success("Listing created!"),s(l?"/my-brokerage":`/mission-control/listings/${he.id}`)}}catch(fe){console.error("Save error:",fe),Ie.error("Failed to save listing"),T(!1)}};return o&&u?r.jsx(Dr,{title:"Loading...",description:"",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Lr,{className:"h-10 w-32"}),r.jsx(Lr,{className:"h-[600px] w-full"})]})}):r.jsx(Dr,{title:o?"Edit Listing":l?"Add Listing for Agent":"Add Listing",description:"",children:r.jsxs("form",{onSubmit:ie,className:"space-y-6",children:[r.jsxs(ee,{type:"button",variant:"ghost",onClick:()=>s(l?"/my-brokerage":"/mission-control/listings"),children:[r.jsx(po,{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(Ze,{children:[r.jsx(Wt,{children:r.jsx(Yt,{children:"Assign to Agent *"})}),r.jsxs(et,{children:[r.jsxs(mn,{value:k,onValueChange:M,children:[r.jsx(fn,{children:r.jsx(yn,{placeholder:"Select an agent..."})}),r.jsx(pn,{children:S.map(se=>r.jsx(qt,{value:se.id,children:se.name||se.email},se.id))})]}),r.jsx("p",{className:"text-sm text-muted-foreground mt-2",children:"This listing will appear on the selected agent's Listing Exchange."})]})]}),r.jsxs(Ze,{children:[r.jsx(Wt,{children:r.jsx(Yt,{children:"Property Details"})}),r.jsx(et,{className:"space-y-4",children:r.jsxs("div",{className:"grid sm:grid-cols-2 gap-4",children:[r.jsxs("div",{className:"sm:col-span-2 space-y-2",children:[r.jsx($e,{children:"Property Address"}),r.jsx(dt,{value:V.property_address,onChange:se=>W({...V,property_address:se.target.value}),placeholder:"123 Main St"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{children:"City *"}),r.jsx(dt,{value:V.city,onChange:se=>W({...V,city:se.target.value}),placeholder:"City",required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{children:"State *"}),r.jsx(dt,{value:V.state,onChange:se=>W({...V,state:se.target.value}),placeholder:"State",required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{children:"Neighborhood"}),r.jsx(dt,{value:V.neighborhood,onChange:se=>W({...V,neighborhood:se.target.value}),placeholder:"Neighborhood"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{children:"Price *"}),r.jsx(dt,{type:"number",value:V.price,onChange:se=>W({...V,price:se.target.value}),placeholder:"500000",required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{children:"Property Type"}),r.jsxs(mn,{value:V.property_type,onValueChange:se=>W({...V,property_type:se}),children:[r.jsx(fn,{children:r.jsx(yn,{})}),r.jsx(pn,{children:YXt.map(se=>r.jsx(qt,{value:se.value,children:se.label},se.value))})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{children:"Status"}),r.jsxs(mn,{value:V.status,onValueChange:se=>W({...V,status:se}),children:[r.jsx(fn,{children:r.jsx(yn,{})}),r.jsx(pn,{children:ZXt.map(se=>r.jsx(qt,{value:se.value,children:se.label},se.value))})]})]})]})})]}),r.jsxs(Ze,{children:[r.jsx(Wt,{children:r.jsx(Yt,{children:"Property Specs (Optional)"})}),r.jsx(et,{children:r.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{children:"Bedrooms"}),r.jsx(dt,{type:"number",value:V.bedrooms,onChange:se=>W({...V,bedrooms:se.target.value}),placeholder:"3"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{children:"Bathrooms"}),r.jsx(dt,{type:"number",step:"0.5",value:V.bathrooms,onChange:se=>W({...V,bathrooms:se.target.value}),placeholder:"2"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{children:"Sq Ft"}),r.jsx(dt,{type:"number",value:V.square_footage,onChange:se=>W({...V,square_footage:se.target.value}),placeholder:"2000"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{children:"Lot Size"}),r.jsx(dt,{value:V.lot_size,onChange:se=>W({...V,lot_size:se.target.value}),placeholder:"0.25 acres"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{children:"Year Built"}),r.jsx(dt,{type:"number",value:V.year_built,onChange:se=>W({...V,year_built:se.target.value}),placeholder:"2005"})]}),r.jsxs("div",{className:"flex items-center gap-2 pt-6",children:[r.jsx(Ts,{checked:V.has_hoa,onCheckedChange:se=>W({...V,has_hoa:se})}),r.jsx($e,{children:"Has HOA"})]})]})})]}),r.jsxs(Ze,{children:[r.jsx(Wt,{children:r.jsx(Yt,{children:"Description & Links"})}),r.jsxs(et,{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{children:"Description"}),r.jsx(Jn,{value:V.description,onChange:se=>W({...V,description:se.target.value}),placeholder:"Tell the story of this property...",rows:4})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{children:"Agent Notes"}),r.jsx(Jn,{value:V.agent_notes,onChange:se=>W({...V,agent_notes:se.target.value}),placeholder:"Notes for other agents...",rows:2}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ts,{checked:V.agent_notes_public,onCheckedChange:se=>W({...V,agent_notes_public:se})}),r.jsx($e,{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($e,{children:"MLS Link"}),r.jsx(dt,{value:V.mls_link,onChange:se=>W({...V,mls_link:se.target.value}),placeholder:"https://..."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{children:"Video Link"}),r.jsx(dt,{value:V.video_link,onChange:se=>W({...V,video_link:se.target.value}),placeholder:"YouTube or Vimeo URL"})]})]})]})]}),r.jsxs(Ze,{children:[r.jsx(Wt,{children:r.jsxs(Yt,{className:"flex items-center gap-2",children:[r.jsx($a,{className:"h-5 w-5"}),"Property Video"]})}),r.jsx(et,{children:r.jsx(KXt,{selectedVideoId:V.video_id,onVideoSelect:se=>W({...V,video_id:se}),listingId:o?e:void 0})})]}),r.jsxs(Ze,{children:[r.jsx(Wt,{children:r.jsx(Yt,{children:"Photos"})}),r.jsxs(et,{children:[r.jsxs("div",{className:"grid grid-cols-3 sm:grid-cols-4 gap-4",children:[o&&((pe=i==null?void 0:i.photos)==null?void 0:pe.map(se=>r.jsxs("div",{className:"relative aspect-square rounded-lg overflow-hidden bg-muted",children:[r.jsx("img",{src:se.photo_url,alt:"",className:"w-full h-full object-cover"}),r.jsx("button",{type:"button",onClick:()=>ge(se.id),className:"absolute top-1 right-1 p-1 bg-destructive text-destructive-foreground rounded-full hover:bg-destructive/90",children:r.jsx(hs,{className:"h-3 w-3"})}),se.is_primary&&r.jsx("span",{className:"absolute bottom-1 left-1 text-[10px] bg-primary text-primary-foreground px-1.5 py-0.5 rounded",children:"Primary"})]},se.id))),!o&&D.map((se,fe)=>r.jsxs("div",{className:"relative aspect-square rounded-lg overflow-hidden bg-muted",children:[r.jsx("img",{src:se,alt:"",className:"w-full h-full object-cover"}),r.jsx("button",{type:"button",onClick:()=>J(fe),className:"absolute top-1 right-1 p-1 bg-destructive text-destructive-foreground rounded-full hover:bg-destructive/90",children:r.jsx(hs,{className:"h-3 w-3"})}),fe===0&&r.jsx("span",{className:"absolute bottom-1 left-1 text-[10px] bg-primary text-primary-foreground px-1.5 py-0.5 rounded",children:"Primary"})]},fe)),r.jsxs("label",{className:"aspect-square rounded-lg border-2 border-dashed border-muted-foreground/25 hover:border-muted-foreground/50 cursor-pointer flex flex-col items-center justify-center gap-2 text-muted-foreground",children:[P?r.jsx(Zr,{className:"h-8 w-8 animate-spin"}):r.jsxs(r.Fragment,{children:[r.jsx(_o,{className:"h-8 w-8"}),r.jsx("span",{className:"text-xs",children:"Upload"})]}),r.jsx("input",{type:"file",accept:"image/*",multiple:!0,className:"hidden",onChange:se=>o?ne(se.target.files):G(se.target.files),disabled:P})]})]}),!o&&I.length>0&&r.jsxs("p",{className:"text-sm text-muted-foreground mt-4",children:[I.length," photo",I.length!==1?"s":""," will be uploaded when you save."]})]})]})]}),r.jsxs("div",{className:"space-y-6",children:[r.jsxs(Ze,{children:[r.jsx(Wt,{children:r.jsx(Yt,{children:"Sharing & Collaboration"})}),r.jsxs(et,{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx($e,{children:"Allow Sharing"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Other agents can share this listing"})]}),r.jsx(Ts,{checked:V.allow_sharing,onCheckedChange:se=>W({...V,allow_sharing:se})})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx($e,{children:"Open to Referrals"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Accept buyer referrals"})]}),r.jsx(Ts,{checked:V.open_to_referrals,onCheckedChange:se=>W({...V,open_to_referrals:se})})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx($e,{children:"Social Promotion"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Can be promoted on social media"})]}),r.jsx(Ts,{checked:V.open_to_social_promotion,onCheckedChange:se=>W({...V,open_to_social_promotion:se})})]}),r.jsxs("div",{className:"flex items-center justify-between pt-2 border-t",children:[r.jsxs("div",{children:[r.jsx($e,{children:"Share with Brokerage"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Visible to agents in your brokerage"})]}),r.jsx(Ts,{checked:V.share_with_brokerage,onCheckedChange:se=>W({...V,share_with_brokerage:se})})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx($e,{children:"Make Public"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Publish on listings.relevelup.com to get leads"})]}),r.jsx(Ts,{checked:V.is_public,onCheckedChange:se=>W({...V,is_public:se})})]})]})]}),r.jsx(ee,{type:"submit",className:"w-full",size:"lg",disabled:p.isPending||y.isPending,children:p.isPending||y.isPending?r.jsxs(r.Fragment,{children:[r.jsx(Zr,{className:"h-4 w-4 mr-2 animate-spin"}),"Saving..."]}):o?"Update Listing":"Create Listing"})]})]})]})})}function XXt({maxDurationSeconds:e=30,onRecordingComplete:t,onError:n,onRecordingStateChange:s,className:a,teleprompterContent:o}){const l=E.useRef(null),i=E.useRef(null),u=E.useRef(null),p=E.useRef([]),x=E.useRef(null),y=E.useRef(null),_=E.useRef(null),b=E.useRef(null),S=z3(),[k,M]=E.useState(!0),[P,T]=E.useState(!0),[I,z]=E.useState(null),[D,U]=E.useState(!1),[V,W]=E.useState(!1),[G,J]=E.useState(null),[ne,oe]=E.useState(null),[ge,ie]=E.useState(0),[pe,se]=E.useState("user"),[fe,he]=E.useState(0),[ye,Ae]=E.useState(!1),[we,be]=E.useState(!0),[_e,Je]=E.useState(null),[Te,De]=E.useState(!1),Ue=E.useCallback(Me=>{M(Me)},[]),Be=E.useRef(k),qe=E.useCallback(async()=>{var Ge;T(!0),Je(null);const Me=S&&k;console.log("[VideoRecorder] initCamera start",{isMobile:S,usePortraitMode:k,shouldBePortrait:Me,facingMode:pe});try{if(!navigator.mediaDevices||!navigator.mediaDevices.getUserMedia)throw new Error("Camera not available in this browser or context. Try opening in a new tab.");u.current&&(console.log("[VideoRecorder] stopping existing stream"),u.current.getTracks().forEach(it=>it.stop()));const Ee=S&&Me?{facingMode:{ideal:pe},width:{ideal:720},height:{ideal:1280}}:{facingMode:{ideal:pe},width:{ideal:1280},height:{ideal:720}};console.log("[VideoRecorder] requesting getUserMedia",Ee);const He=await navigator.mediaDevices.getUserMedia({video:Ee,audio:{echoCancellation:!0,noiseSuppression:!0}});if(console.log("[VideoRecorder] getUserMedia success"),He.getVideoTracks().length===0)throw new Error("Camera stream started but no video track was provided.");u.current=He,z(!0);const yt=He.getVideoTracks()[0].getSettings();if(console.log("[VideoRecorder] Camera initialized with dimensions:",yt.width,"x",yt.height),l.current){const it=l.current;it.srcObject=He,it.muted=!0,it.playsInline=!0,it.autoplay=!0,it.setAttribute("muted",""),it.setAttribute("playsinline",""),it.setAttribute("autoplay","");try{(Ge=it.load)==null||Ge.call(it)}catch(dr){console.warn("[VideoRecorder] videoEl.load failed",dr)}const zt=async()=>{try{return await it.play(),console.log("[VideoRecorder] preview play ok"),De(!1),setTimeout(()=>{console.debug("[VideoRecorder] preview metrics",{readyState:it.readyState,videoWidth:it.videoWidth,videoHeight:it.videoHeight})},300),!0}catch(dr){return console.warn("[VideoRecorder] preview play blocked",dr),De(!0),!1}};await new Promise(dr=>{let Rr=!1;const Gr=()=>{Rr||(Rr=!0,dr())},Ur=()=>{zt().finally(Gr)};it.onloadedmetadata=Ur,it.onloadeddata=Ur,setTimeout(Gr,1500)})}try{y.current=new AudioContext;const it=y.current.createMediaStreamSource(He);_.current=y.current.createAnalyser(),_.current.fftSize=256,it.connect(_.current);const zt=()=>{if(_.current){const dr=new Uint8Array(_.current.frequencyBinCount);_.current.getByteFrequencyData(dr);const Rr=dr.reduce((Gr,Ur)=>Gr+Ur)/dr.length;he(Math.min(100,Rr/128*100))}b.current=requestAnimationFrame(zt)};zt()}catch(it){console.warn("Audio context not available:",it)}}catch(Ee){console.error("Camera initialization error:",Ee),z(!1);let He="Failed to access camera or microphone.";Ee.name==="NotAllowedError"?He="Camera permission denied. Please allow camera access in your browser settings.":Ee.name==="NotFoundError"?He="No camera found. Please connect a camera and try again.":Ee.name==="NotReadableError"?He="Camera is in use by another application. Please close other apps using the camera.":Ee.message&&(He=Ee.message),Je(He),n==null||n(He)}finally{T(!1)}},[pe,n,S,k]);E.useEffect(()=>{Be.current!==k&&I&&!D&&!ne&&(Be.current=k,qe())},[k,I,D,ne,qe]),E.useEffect(()=>(qe(),()=>{u.current&&u.current.getTracks().forEach(Me=>Me.stop()),x.current&&clearInterval(x.current),b.current&&cancelAnimationFrame(b.current),y.current&&y.current.close(),ne&&URL.revokeObjectURL(ne)}),[qe,ne]),E.useEffect(()=>{if(P||I!==!0||ne)return;const Me=u.current,Ge=l.current;!Me||!Ge||(Ge.srcObject!==Me&&(Ge.srcObject=Me,Ge.muted=!0,Ge.playsInline=!0,Ge.autoplay=!0,Ge.setAttribute("muted",""),Ge.setAttribute("playsinline",""),Ge.setAttribute("autoplay","")),Ge.play().then(()=>De(!1)).catch(Ee=>{De(!0),console.warn("Live preview play blocked on mount:",Ee)}))},[I,P,ne]),E.useEffect(()=>{s==null||s(D)},[D,s]);const ot=E.useCallback(async()=>{if(ne)return;const Me=l.current;if(Me)try{await Me.play(),De(!1)}catch(Ge){De(!0),console.warn("Live preview still blocked (needs user gesture):",Ge)}},[ne]),Mt=E.useCallback(()=>{i.current&&i.current.state!=="inactive"&&i.current.stop(),x.current&&(clearInterval(x.current),x.current=null),U(!1),W(!1)},[]),Oe=E.useCallback(()=>{if(!u.current)return;ot(),p.current=[],ie(0);const Ge=["video/webm;codecs=vp9,opus","video/webm;codecs=vp8,opus","video/webm;codecs=vp9","video/webm;codecs=vp8","video/webm","video/mp4"].find(He=>MediaRecorder.isTypeSupported(He)),Ee=new MediaRecorder(u.current,Ge?{mimeType:Ge,videoBitsPerSecond:25e5}:{videoBitsPerSecond:25e5});Ee.ondataavailable=He=>{He.data.size>0&&p.current.push(He.data)},Ee.onstop=()=>{var it;const He=Ee.mimeType||Ge||((it=p.current[0])==null?void 0:it.type)||"video/webm",nt=new Blob(p.current,{type:He});J(nt);const yt=URL.createObjectURL(nt);oe(yt)},i.current=Ee,Ee.start(100),U(!0),x.current=setInterval(()=>{ie(He=>He>=e-1?(Mt(),e):He+1)},1e3)},[ot,e,Mt]),at=E.useCallback(()=>{i.current&&i.current.state==="recording"&&(i.current.pause(),W(!0),x.current&&clearInterval(x.current))},[]),le=E.useCallback(()=>{i.current&&i.current.state==="paused"&&(i.current.resume(),W(!1),x.current=setInterval(()=>{ie(Me=>Me>=e-1?(Mt(),e):Me+1)},1e3))},[e,Mt]),Ve=E.useCallback(()=>{ne&&URL.revokeObjectURL(ne),J(null),oe(null),ie(0),Ae(!1),be(!0),l.current&&u.current&&(l.current.srcObject=u.current,l.current.muted=!0,ot())},[ot,ne]),Qe=E.useCallback(()=>{se(Me=>Me==="user"?"environment":"user")},[]),st=E.useCallback(()=>{G&&t(G,ge)},[G,ge,t]),ke=E.useCallback(()=>{l.current&&ne&&(ye?l.current.pause():(be(!1),l.current.muted=!1,l.current.play()),Ae(!ye))},[ne,ye]);E.useEffect(()=>{if(!ne)return;const Me=l.current;if(!Me)return;be(!1),Me.pause(),Me.removeAttribute("src"),Me.srcObject=null,Me.load(),Me.src=ne,Me.currentTime=0,Me.playsInline=!0,Me.muted=!1,Me.onended=()=>Ae(!1);const Ge=()=>{const Ee=Me.error,He=Ee?`Recorded video failed to play (code ${Ee.code}). Likely unsupported format/codec in this browser.`:"Recorded video failed to play.";console.warn("[VideoRecorder] recorded playback error",Ee),n==null||n(He)};return Me.addEventListener("error",Ge),Me.load(),()=>{Me.removeEventListener("error",Ge)}},[n,ne]);const ct=Me=>{const Ge=Math.floor(Me/60),Ee=Me%60;return`${Ge}:${Ee.toString().padStart(2,"0")}`},Ce=S&&k?"aspect-[9/16]":"aspect-video";return P?r.jsx("div",{className:Bt("flex items-center justify-center bg-black rounded-lg",Ce,a),children:r.jsxs("div",{className:"text-center text-white",children:[r.jsx(Zr,{className:"h-12 w-12 animate-spin mx-auto mb-4"}),r.jsx("p",{children:"Initializing camera..."})]})}):I===!1?r.jsx("div",{className:Bt("flex items-center justify-center bg-black rounded-lg",Ce,a),children:r.jsxs("div",{className:"text-center text-white p-8 max-w-md",children:[r.jsx(yl,{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:_e||"Please allow camera and microphone access to record videos."}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs(ee,{onClick:()=>qe(),variant:"secondary",className:"w-full",children:[r.jsx(qo,{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:Bt("flex flex-col gap-2",a),children:[S&&!D&&!ne&&r.jsxs("div",{className:"flex items-center justify-center gap-3 py-2 bg-muted/50 rounded-lg",children:[r.jsx(Rj,{className:Bt("h-4 w-4",k?"text-muted-foreground":"text-primary")}),r.jsx($e,{htmlFor:"orientation-toggle",className:"text-sm text-muted-foreground",children:"Landscape"}),r.jsx(Ts,{id:"orientation-toggle",checked:k,onCheckedChange:Ue}),r.jsx($e,{htmlFor:"orientation-toggle",className:"text-sm text-muted-foreground",children:"Portrait"}),r.jsx(py,{className:Bt("h-4 w-4",k?"text-primary":"text-muted-foreground")})]}),r.jsxs("div",{className:Bt("relative bg-black rounded-lg overflow-hidden"),onPointerDown:()=>{ot()},children:[r.jsx("video",{ref:l,src:ne??void 0,className:Bt("w-full bg-black",k&&!ne?"object-contain":"object-cover",Ce,pe==="user"&&!ne&&"scale-x-[-1]"),playsInline:!0,controls:!!ne,muted:ne?we:!0,autoPlay:!ne},ne??"live"),!ne&&Te&&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 ot(),className:"bg-white/20 hover:bg-white/30 text-white",children:"Tap to enable preview"})}),o&&!ne&&r.jsx("div",{className:"absolute inset-0 pointer-events-none",children:o}),D&&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:Bt("w-3 h-3 rounded-full",V?"bg-yellow-500":"bg-red-500 animate-pulse")}),r.jsxs("span",{className:"text-white text-sm font-medium",children:[ct(ge)," / ",ct(e)]})]}),D&&r.jsx("div",{className:"absolute top-0 left-0 right-0",children:r.jsx(pd,{value:ge/e*100,className:"h-1 rounded-none"})}),!ne&&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(hA,{className:"h-4 w-4 text-white"}),r.jsx("div",{className:"w-20 h-2 bg-white/20 rounded-full overflow-hidden",children:r.jsx("div",{className:"h-full bg-green-500 transition-all duration-75",style:{width:`${fe}%`}})})]}),r.jsx("div",{className:"absolute bottom-4 left-0 right-0 flex justify-center gap-3 px-4",children:ne?r.jsxs(r.Fragment,{children:[r.jsxs(ee,{variant:"secondary",size:"lg",className:"bg-white/20 hover:bg-white/30 text-white",onClick:Ve,children:[r.jsx(qo,{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:ke,children:ye?r.jsx(xf,{className:"h-5 w-5"}):r.jsx(Vl,{className:"h-5 w-5"})}),r.jsxs(ee,{size:"lg",className:"bg-green-500 hover:bg-green-600 text-white",onClick:st,children:[r.jsx(Ni,{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:Qe,disabled:D,children:r.jsx(LS,{className:"h-5 w-5"})}),D?r.jsxs(r.Fragment,{children:[r.jsx(ee,{size:"icon",className:"h-12 w-12 rounded-full bg-white/20 hover:bg-white/30 text-white",onClick:V?le:at,children:V?r.jsx(Vl,{className:"h-5 w-5"}):r.jsx(xf,{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:Mt,children:r.jsx(Fg,{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:Oe,children:r.jsx($a,{className:"h-6 w-6"})}),r.jsx("div",{className:"h-12 w-12"})]})})]})]})}const xVe="teleprompter_settings",pue={scrollSpeed:30,fontSize:24,lineHeight:1.6,opacity:.85,position:"top",isMirrored:!1};function QXt(){try{const e=localStorage.getItem(xVe);return e?{...pue,...JSON.parse(e)}:pue}catch{return pue}}function JXt(e){try{localStorage.setItem(xVe,JSON.stringify(e))}catch{}}function eQt({text:e,isVisible:t,onToggleVisibility:n,isRecording:s=!1,startCountdown:a=!1,onCountdownComplete:o,className:l}){const i=E.useRef(null),u=E.useRef(null),p=E.useRef(0),x=E.useRef(0),[y,_]=E.useState(QXt),{scrollSpeed:b,fontSize:S,lineHeight:k,opacity:M,position:P,isMirrored:T}=y,I=E.useCallback((oe,ge)=>{_(ie=>{const pe={...ie,[oe]:ge};return JXt(pe),pe})},[]),[z,D]=E.useState(!1),[U,V]=E.useState(null),W=E.useCallback(oe=>{if(!i.current)return;p.current===0&&(p.current=oe);const ge=oe-p.current;p.current=oe,x.current+=b*ge/1e3;const ie=Math.floor(x.current);ie>0&&(i.current.scrollTop+=ie,x.current-=ie);const{scrollTop:pe,scrollHeight:se,clientHeight:fe}=i.current;if(pe+fe>=se){D(!1);return}u.current=requestAnimationFrame(W)},[b]);E.useEffect(()=>(z?(p.current=0,x.current=0,u.current=requestAnimationFrame(W)):u.current&&cancelAnimationFrame(u.current),()=>{u.current&&cancelAnimationFrame(u.current)}),[z,W]),E.useEffect(()=>{if(s&&t)if(i.current&&(i.current.scrollTop=0),a){V(3);let oe=3;const ge=setInterval(()=>{oe-=1,oe<=0?(clearInterval(ge),V(null),o==null||o(),D(!0)):V(oe)},1e3);return()=>clearInterval(ge)}else setTimeout(()=>D(!0),100);else s||(D(!1),V(null))},[s,t,a,o]);const G=E.useCallback(()=>{i.current&&(i.current.scrollTop=0),D(!1)},[]),J=E.useCallback(()=>{D(oe=>!oe)},[]);if(!t)return r.jsx("div",{className:Bt("absolute top-4 right-4 pointer-events-auto z-10",l),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(Ko,{className:"h-4 w-4 mr-2"}),"Show Script"]})});const ne={top:"top-0 pt-16",center:"top-1/2 -translate-y-1/2",bottom:"bottom-0 pb-24"};return r.jsxs("div",{className:Bt("absolute inset-0 pointer-events-none",l),children:[U!==null&&r.jsx("div",{className:"absolute inset-0 flex items-center justify-center z-20 pointer-events-none",children:r.jsxs("div",{className:"flex flex-col items-center gap-2",children:[r.jsx("div",{className:"text-white font-bold drop-shadow-lg animate-scale-in",style:{fontSize:"96px",lineHeight:1,textShadow:"0 4px 16px rgba(0,0,0,0.8)"},children:U},U),r.jsx("p",{className:"text-white/80 text-lg font-medium drop-shadow-md",children:"Get ready…"})]})}),r.jsx("div",{className:Bt("absolute left-0 right-0 h-[60%] overflow-hidden pointer-events-auto",ne[P],U!==null&&"opacity-30"),style:{opacity:U!==null?.3:M},children:r.jsxs("div",{ref:i,className:Bt("mx-auto max-w-2xl px-6 overflow-y-auto scrollbar-hide h-full",T&&"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("div",{className:"h-full",style:{minHeight:"100%"}}),r.jsx("p",{className:"text-white text-center font-medium drop-shadow-lg",style:{fontSize:`${S}px`,lineHeight:k,textShadow:"0 2px 4px rgba(0,0,0,0.8)"},children:e}),r.jsx("div",{className:"h-full"})]})}),r.jsxs("div",{className:"absolute top-4 right-4 flex items-center gap-2 pointer-events-auto",children:[r.jsxs(Vc,{children:[r.jsx(Hc,{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(Mc,{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.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx($e,{className:"text-xs",children:"Scroll Speed"}),r.jsx("span",{className:"text-xs text-muted-foreground",children:b})]}),r.jsx(jm,{value:[b],onValueChange:([oe])=>I("scrollSpeed",oe),min:1,max:100,step:1})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx($e,{className:"text-xs",children:"Font Size"}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:[S,"px"]})]}),r.jsx(jm,{value:[S],onValueChange:([oe])=>I("fontSize",oe),min:16,max:48,step:2})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx($e,{className:"text-xs",children:"Line Spacing"}),r.jsx("span",{className:"text-xs text-muted-foreground",children:k.toFixed(1)})]}),r.jsx(jm,{value:[k*10],onValueChange:([oe])=>I("lineHeight",oe/10),min:12,max:24,step:1})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx($e,{className:"text-xs",children:"Opacity"}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:[Math.round(M*100),"%"]})]}),r.jsx(jm,{value:[M*100],onValueChange:([oe])=>I("opacity",oe/100),min:30,max:100,step:5})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{className:"text-xs",children:"Position"}),r.jsxs("div",{className:"flex gap-1",children:[r.jsx(ee,{variant:P==="top"?"default":"outline",size:"sm",onClick:()=>I("position","top"),children:r.jsx(iy,{className:"h-4 w-4"})}),r.jsx(ee,{variant:P==="center"?"default":"outline",size:"sm",onClick:()=>I("position","center"),children:r.jsx(G1,{className:"h-4 w-4"})}),r.jsx(ee,{variant:P==="bottom"?"default":"outline",size:"sm",onClick:()=>I("position","bottom"),children:r.jsx(Dd,{className:"h-4 w-4"})})]})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx($e,{className:"text-xs",children:"Mirror Mode"}),r.jsx(Ts,{checked:T,onCheckedChange:oe=>I("isMirrored",oe)})]})]})})]}),r.jsx(ee,{variant:"secondary",size:"icon",onClick:J,className:"h-9 w-9 bg-black/50 hover:bg-black/70 text-white border-0",children:z?r.jsx(xf,{className:"h-4 w-4"}):r.jsx(Vl,{className:"h-4 w-4"})}),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:r.jsx(LS,{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($1,{className:"h-4 w-4 mr-2"}),"Hide"]})]})]})}function tQt({onSelectScript:e,onCreateNew:t,selectedScriptId:n,className:s}){const{toast:a}=_i(),[o,l]=E.useState(""),[i,u]=E.useState(null),[p,x]=E.useState("levelup"),{data:y,isLoading:_}=C3t(),{data:b,isLoading:S}=M3t(),{data:k,isLoading:M}=T3t(),P=A3t(),T=E.useMemo(()=>b?b.filter(V=>{const W=!o||V.title.toLowerCase().includes(o.toLowerCase())||V.script_text.toLowerCase().includes(o.toLowerCase())||V.tags.some(J=>J.toLowerCase().includes(o.toLowerCase())),G=!i||V.category_id===i;return W&&G}):[],[b,o,i]),I=E.useMemo(()=>k?k.filter(V=>!o||V.title.toLowerCase().includes(o.toLowerCase())||V.script_text.toLowerCase().includes(o.toLowerCase())):[],[k,o]),z=V=>{e({title:V.title,text:V.script_text})},D=async V=>{try{await P.mutateAsync(V),a({title:"Script saved to My Scripts"})}catch{a({title:"Failed to save script",variant:"destructive"})}},U=_||S||M;return r.jsxs("div",{className:Bt("flex flex-col h-full",s),children:[r.jsx("div",{className:"p-4 border-b",children:r.jsxs("div",{className:"relative",children:[r.jsx(Sa,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(dt,{placeholder:"Search scripts...",value:o,onChange:V=>l(V.target.value),className:"pl-9"})]})}),r.jsxs(Ai,{value:p,onValueChange:V=>x(V),className:"flex-1 flex flex-col",children:[r.jsxs(vi,{className:"mx-4 mt-4 grid grid-cols-2",children:[r.jsxs(sn,{value:"levelup",children:[r.jsx(Ea,{className:"h-4 w-4 mr-2"}),"LevelUp Scripts"]}),r.jsxs(sn,{value:"my-scripts",children:[r.jsx(Sm,{className:"h-4 w-4 mr-2"}),"My Scripts"]})]}),r.jsxs(Mn,{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(Pt,{variant:i?"outline":"default",className:"cursor-pointer",onClick:()=>u(null),children:"All"}),y==null?void 0:y.map(V=>r.jsx(Pt,{variant:i===V.id?"default":"outline",className:"cursor-pointer",onClick:()=>u(V.id),children:V.name},V.id))]}),r.jsx(Bo,{className:"flex-1 max-h-[50vh]",children:U?r.jsx("div",{className:"flex items-center justify-center py-8",children:r.jsx(Zr,{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(Ea,{className:"h-12 w-12 mx-auto mb-2 opacity-50"}),r.jsx("p",{children:"No scripts found"})]}):r.jsx("div",{className:"space-y-2",children:T.map(V=>r.jsxs(Ze,{className:Bt("cursor-pointer hover:bg-accent/50 transition-colors",n===V.id&&"ring-2 ring-primary"),onClick:()=>z(V),children:[r.jsx(Wt,{className:"p-3",children:r.jsxs("div",{className:"flex items-start justify-between",children:[r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx(Yt,{className:"text-sm font-medium truncate",children:V.title}),V.category&&r.jsx(Pt,{variant:"secondary",className:"mt-1 text-xs",children:V.category.name})]}),r.jsxs("div",{className:"flex items-center gap-1 ml-2",children:[r.jsx(ee,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:W=>{W.stopPropagation(),D(V)},children:r.jsx(Sm,{className:"h-4 w-4"})}),r.jsx(Wi,{className:"h-4 w-4 text-muted-foreground"})]})]})}),r.jsx(et,{className:"p-3 pt-0",children:r.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",children:V.script_text})})]},V.id))})})]}),r.jsxs(Mn,{value:"my-scripts",className:"flex-1 flex flex-col mt-0 p-4",children:[t&&r.jsxs(ee,{variant:"outline",className:"mb-4",onClick:t,children:[r.jsx(bn,{className:"h-4 w-4 mr-2"}),"Create New Script"]}),r.jsx(Bo,{className:"flex-1 max-h-[50vh]",children:M?r.jsx("div",{className:"flex items-center justify-center py-8",children:r.jsx(Zr,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):I.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(Sm,{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:I.map(V=>r.jsxs(Ze,{className:Bt("cursor-pointer hover:bg-accent/50 transition-colors",n===V.id&&"ring-2 ring-primary"),onClick:()=>z(V),children:[r.jsx(Wt,{className:"p-3",children:r.jsxs("div",{className:"flex items-start justify-between",children:[r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx(Yt,{className:"text-sm font-medium truncate",children:V.title}),r.jsx("div",{className:"flex items-center gap-2 mt-1",children:V.is_custom?r.jsx(Pt,{variant:"outline",className:"text-xs",children:"Custom"}):r.jsx(Pt,{variant:"secondary",className:"text-xs",children:"Saved"})})]}),r.jsx(Wi,{className:"h-4 w-4 text-muted-foreground ml-2"})]})}),r.jsx(et,{className:"p-3 pt-0",children:r.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2",children:V.script_text})})]},V.id))})})]})]})]})}function rQt({selectedTemplate:e,onSelect:t,contactName:n,saving:s=!1}){const[a,o]=E.useState(()=>{const i=KS(e);return new Set([i.category])}),l=i=>{o(u=>{const p=new Set(u);return p.has(i)?p.delete(i):p.add(i),p})};return r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx($e,{className:"text-sm font-medium",children:"Share Page Template"}),s&&r.jsx(Zr,{className:"h-3 w-3 animate-spin text-muted-foreground"})]}),r.jsx("div",{className:"space-y-3",children:qmt.map(i=>{const u=Vmt(i.id),p=a.has(i.id),x=u.some(y=>y.id===e);return r.jsxs(HS,{open:p,onOpenChange:()=>l(i.id),children:[r.jsxs(WS,{className:"flex items-center justify-between w-full p-2.5 rounded-lg bg-muted/50 hover:bg-muted transition-colors",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{className:"font-medium text-sm",children:i.name}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",u.length,")"]}),x&&!p&&r.jsx("span",{className:"text-xs bg-primary/10 text-primary px-1.5 py-0.5 rounded-full",children:"✓"})]}),r.jsx(Dd,{className:Bt("h-4 w-4 text-muted-foreground transition-transform",p&&"rotate-180")})]}),r.jsx(GS,{className:"pt-2",children:r.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-2",children:u.map(y=>{const _=e===y.id;return r.jsxs("button",{type:"button",onClick:()=>t(y.id),disabled:s,className:Bt("relative rounded-lg border-2 p-2.5 text-left transition-all hover:shadow-sm disabled:opacity-50 disabled:cursor-not-allowed",_?"border-primary ring-1 ring-primary/20 bg-primary/5":"border-muted hover:border-muted-foreground/30"),children:[_&&r.jsx("div",{className:"absolute top-1 right-1 w-4 h-4 rounded-full bg-primary flex items-center justify-center",children:r.jsx(Ni,{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&&e!=="default"&&r.jsxs("p",{className:"text-xs text-muted-foreground",children:['Will show: "',KS(e).headerText(n),'"']})]})}function yVe({open:e,onOpenChange:t,video:n,contactName:s,onTemplateUpdated:a}){const[o,l]=E.useState(n.page_template||"default"),[i,u]=E.useState(!1),[p,x]=E.useState(!1),[y,_]=E.useState(n.page_template||"default"),[b,S]=E.useState([]),[k,M]=E.useState(n.contact_id&&s?{id:n.contact_id,name:s,email:null}:null),[P,T]=E.useState(!1),[I,z]=E.useState(!1),D=n.share_token?`https://video.relevelup.com/${n.share_token}`:"";E.useEffect(()=>{e&&b.length===0&&U()},[e]);const U=async()=>{z(!0);try{const{data:pe,error:se}=await Q.from("innercircle_contacts").select("id, first_name, last_name, email").order("first_name",{ascending:!0}).limit(500);if(se)throw se;const fe=(pe||[]).map(he=>({id:he.id,name:[he.first_name,he.last_name].filter(Boolean).join(" ")||"Unnamed",email:he.email||null}));S(fe)}catch(pe){console.error("Failed to fetch contacts:",pe)}finally{z(!1)}},V=async pe=>{M(pe),T(!1),u(!0);try{const{error:se}=await Q.from("agent_videos").update({contact_id:(pe==null?void 0:pe.id)||null,recipient_name:(pe==null?void 0:pe.name)||null}).eq("id",n.id);if(se)throw se;Ie.success(pe?`Assigned to ${pe.name}`:"Contact removed"),a==null||a()}catch(se){console.error("Failed to update contact:",se),Ie.error("Failed to update contact")}finally{u(!1)}},W=async pe=>{l(pe),u(!0);try{const{error:se}=await Q.from("agent_videos").update({page_template:pe}).eq("id",n.id);if(se)throw se;_(pe),Ie.success("Template saved!"),a==null||a()}catch(se){console.error("Failed to save template:",se),Ie.error("Failed to save template"),l(y)}finally{u(!1)}},G=(k==null?void 0:k.name)||null,J=()=>{const pe=n.title||"Video Message",se=n.share_token?`https://video.relevelup.com/thumb/${n.share_token}`:n.thumbnail_url||"";return`
`},ne=async()=>{if(!n.thumbnail_url){Ie.error("Video thumbnail not available yet");return}const pe=J(),se=`Watch: ${n.title||"Video Message"} ${D}`;try{const fe=new Blob([pe],{type:"text/html"}),he=new Blob([se],{type:"text/plain"}),ye=new ClipboardItem({"text/html":fe,"text/plain":he});await navigator.clipboard.write([ye]),Ie.success("Copied! Paste into Gmail - the thumbnail will appear after sending.")}catch{await navigator.clipboard.writeText(se+` `+pe),Ie.success("Copied! Paste into your email.")}},oe=async()=>{await navigator.clipboard.writeText(D),x(!0),Ie.success("Share link copied!"),setTimeout(()=>x(!1),2e3)},ge=()=>{const se=KS(o).headerText(G),fe=o==="default"?`Check out this video: ${D}`:`${se} Check out this special video: ${D}`;window.open(`sms:?body=${encodeURIComponent(fe)}`,"_self")},ie=()=>{const pe=KS(o),se=pe.headerText(G),fe=o==="default"?n.title||"Video Message":se,he=`${pe.subText} Watch the video: ${D}`,ye=k!=null&&k.email?encodeURIComponent(k.email):"";window.open(`mailto:${ye}?subject=${encodeURIComponent(fe)}&body=${encodeURIComponent(he)}`,"_self")};return r.jsx(Or,{open:e,onOpenChange:t,children:r.jsxs(Ir,{className:"max-w-lg max-h-[90vh] overflow-y-auto",children:[r.jsxs($r,{children:[r.jsxs(Fr,{className:"flex items-center gap-2",children:[r.jsx(Io,{className:"h-5 w-5"}),"Share Video"]}),r.jsx(Zn,{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($e,{className:"text-sm font-medium",children:"Personalize for Contact (Optional)"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(Vc,{open:P,onOpenChange:T,children:[r.jsx(Hc,{asChild:!0,children:r.jsxs(ee,{variant:"outline",role:"combobox","aria-expanded":P,className:"flex-1 justify-between",disabled:i,children:[k?r.jsxs("span",{className:"flex items-center gap-2",children:[r.jsx(ic,{className:"h-4 w-4 text-muted-foreground"}),k.name]}):r.jsx("span",{className:"text-muted-foreground",children:"Select a contact..."}),r.jsx(oy,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),r.jsx(Mc,{className:"w-[300px] p-0",align:"start",children:r.jsxs(Ey,{children:[r.jsx(Iy,{placeholder:"Search contacts..."}),r.jsxs(Py,{children:[r.jsx(Ly,{children:I?"Loading...":"No contacts found."}),r.jsx(Oy,{children:b.map(pe=>r.jsxs(Dy,{value:pe.name,onSelect:()=>V(pe),children:[r.jsx(Ni,{className:Bt("mr-2 h-4 w-4",(k==null?void 0:k.id)===pe.id?"opacity-100":"opacity-0")}),pe.name]},pe.id))})]})]})})]}),k&&r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>V(null),disabled:i,className:"shrink-0",children:r.jsx(hs,{className:"h-4 w-4"})})]}),k&&o!=="default"&&r.jsxs("p",{className:"text-xs text-muted-foreground",children:['Page will show: "',KS(o).headerText(k.name),'"']})]}),r.jsx(rQt,{selectedTemplate:o,onSelect:W,contactName:G,saving:i}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{children:"Share Link"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(dt,{value:D,readOnly:!0,className:"font-mono text-sm"}),r.jsx(ee,{onClick:oe,variant:p?"default":"outline",className:"shrink-0 gap-2",children:p?r.jsxs(r.Fragment,{children:[r.jsx(Ni,{className:"h-4 w-4"}),"Copied"]}):r.jsxs(r.Fragment,{children:[r.jsx(Wo,{className:"h-4 w-4"}),"Copy"]})})]})]}),n.thumbnail_url&&r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{children:"Share for Email"}),r.jsxs(ee,{variant:"outline",className:"w-full gap-2",onClick:ne,children:[r.jsx(Rl,{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($e,{children:"Quick Share"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(ee,{variant:"outline",className:"flex-1 gap-2",onClick:ge,children:[r.jsx(zo,{className:"h-4 w-4"}),"Text"]}),r.jsxs(ee,{variant:"outline",className:"flex-1 gap-2",onClick:ie,children:[r.jsx(Ns,{className:"h-4 w-4"}),"Email"]})]})]})]}),r.jsx(Bs,{children:r.jsx(ee,{variant:"outline",onClick:()=>t(!1),children:"Done"})})]})})}function nQt(){var st;const e=Gn(),[t]=Gc(),{toast:n}=_i(),s=t.get("contact_id"),a=t.get("task_id"),{canRecord:o,remainingMb:l,usagePercent:i,isNearLimit:u}=O3t(),{data:p}=jp(),x=gBe(),y=z3t(),[_,b]=E.useState("record"),[S,k]=E.useState(""),[M,P]=E.useState(!1),[T,I]=E.useState(!1),[z,D]=E.useState(!1),[U,V]=E.useState(null),[W,G]=E.useState(0),[J,ne]=E.useState(0),[oe,ge]=E.useState(null),[ie,pe]=E.useState(null),[se,fe]=E.useState(s||""),[he,ye]=E.useState(""),[Ae,we]=E.useState(""),[be,_e]=E.useState(null),[Je,Te]=E.useState(null),[De,Ue]=E.useState(null),[Be,qe]=E.useState(!1),ot=E.useCallback(async(ke,ct)=>{V(ke),b("uploading");try{const{videoId:Ce,uploadUrl:Me}=await D3t(he||"Quick Video Touch");ge(Ce);const{apiKey:Ge}=await R3t(Ce),Ee=new XMLHttpRequest;Ee.upload.onprogress=it=>{it.lengthComputable&&G(it.loaded/it.total*100)},await new Promise((it,zt)=>{Ee.onload=()=>{Ee.status>=200&&Ee.status<300?it():zt(new Error(`Upload failed: ${Ee.status}`))},Ee.onerror=()=>zt(new Error("Upload failed")),Ee.open("PUT",Me),Ee.setRequestHeader("AccessKey",Ge),Ee.send(ke)}),b("processing");let He=0;const nt=Date.now(),yt=90*1e3;for(;He<4;){if(await new Promise(zt=>setTimeout(zt,3e3)),Date.now()-nt>yt){const zt=ke.size/1048576,dr=`https://iframe.mediadelivery.net/play/${Ce}/${Ce}`;await x.mutateAsync({bunny_video_id:Ce,playback_url:dr,file_size_mb:zt,title:he||"Quick Video Touch",notes:Ae||void 0,contact_id:se&&se!=="none"?se:void 0,status:"processing",touch_type:"video_touch"}),n({title:"Video saved — still processing",description:'Your video has been saved and will appear in your library with a "processing" badge. It will be ready to share once encoding completes (usually within a few minutes).',duration:8e3}),e("/mission-control/video-library");return}const it=await F3t(Ce);if(He=it.status,ne(it.encodeProgress||0),He===4)pe({playbackUrl:it.directPlayUrl,thumbnailUrl:it.thumbnailUrl,previewUrl:it.previewUrl||null,duration:it.length||ct,fileSizeMb:(it.storageSize||ke.size)/(1024*1024)});else if(He===5||He===6)throw new Error("Video processing failed")}b("details")}catch(Ce){console.error("Upload error:",Ce),n({title:"Upload failed",description:"Please try recording again.",variant:"destructive"}),b("record")}},[he,n]),Mt=async()=>{if(!(!oe||!ie))try{const ke=se&&se!=="none"?se:null,ct=await x.mutateAsync({bunny_video_id:oe,contact_id:ke,playback_url:ie.playbackUrl,thumbnail_url:ie.thumbnailUrl,preview_url:ie.previewUrl,duration_seconds:ie.duration,file_size_mb:ie.fileSizeMb,title:he||"Quick Video Touch",notes:Ae,task_id:a||null,status:"ready"});_e(ct.id),Te(ct.share_token||null),ke&&await y.mutateAsync({contactId:ke,videoId:ct.id,notes:Ae}),n({title:"Video saved successfully!"}),b("share")}catch(ke){console.error("Save video error:",ke),n({title:"Failed to save video",description:(ke==null?void 0:ke.message)||"Please try again.",variant:"destructive"})}},Oe=(ke,ct)=>{navigator.clipboard.writeText(ct),Ue(ke),setTimeout(()=>Ue(null),2e3),n({title:"Copied to clipboard!"})},at=()=>Je?`https://video.relevelup.com/${Je}`:(ie==null?void 0:ie.playbackUrl)||"",le=()=>{const ke=p==null?void 0:p.find(Ee=>Ee.id===se),ct=ke?`${ke.first_name}`:"",Ce=(ke==null?void 0:ke.phone)||"",Me=(ke==null?void 0:ke.email)||"",Ge=at();return{text:`Hey${ct?` ${ct}`:""}! I recorded a quick video for you: ${Ge}`,link:Ge,contactPhone:Ce,contactEmail:Me}},Ve=()=>{const{text:ke,contactPhone:ct}=le(),Ce=ct?`sms:${ct}?body=${encodeURIComponent(ke)}`:`sms:?body=${encodeURIComponent(ke)}`;window.open(Ce,"_self")},Qe=()=>{const{link:ke,contactEmail:ct}=le(),Ce="Check out this video",Me=`I recorded a quick video for you: ${ke}`,Ge=ct?`mailto:${ct}?subject=${encodeURIComponent(Ce)}&body=${encodeURIComponent(Me)}`:`mailto:?subject=${encodeURIComponent(Ce)}&body=${encodeURIComponent(Me)}`;window.open(Ge,"_self")};return o?r.jsx(Dr,{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:()=>e(-1),children:r.jsx(po,{className:"h-5 w-5"})}),r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold",children:"Quick Video Touch"}),r.jsx("p",{className:"text-muted-foreground",children:"Record a personal video message"})]})]}),u&&r.jsxs("div",{className:"text-right",children:[r.jsxs("p",{className:"text-sm text-warning",children:["Storage: ",i.toFixed(0),"% used"]}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[l.toFixed(0)," MB remaining"]})]})]}),_==="record"&&r.jsxs("div",{className:"grid gap-6 lg:grid-cols-3",children:[r.jsxs("div",{className:"lg:col-span-2",children:[r.jsx(XXt,{maxDurationSeconds:30,onRecordingComplete:ot,onRecordingStateChange:D,className:"w-full",teleprompterContent:M&&S&&r.jsx(eQt,{text:S,isVisible:M,onToggleVisibility:()=>P(!1),isRecording:z,startCountdown:!0})}),!M&&S&&r.jsxs(ee,{variant:"outline",className:"mt-4",onClick:()=>P(!0),children:[r.jsx(Ea,{className:"h-4 w-4 mr-2"}),"Show Teleprompter"]})]}),r.jsxs(Ze,{className:"lg:col-span-1",children:[r.jsx(Wt,{className:"pb-2",children:r.jsx(Yt,{className:"text-lg",children:"Teleprompter Script"})}),r.jsxs(et,{className:"space-y-4",children:[r.jsx(Jn,{placeholder:"Type or paste your script here...",value:S,onChange:ke=>k(ke.target.value),rows:6}),r.jsxs(Vse,{open:T,onOpenChange:I,children:[r.jsx(eye,{asChild:!0,children:r.jsxs(ee,{variant:"outline",className:"w-full",children:[r.jsx(Ea,{className:"h-4 w-4 mr-2"}),"Browse Scripts"]})}),r.jsxs(iP,{side:"right",className:"w-[400px] sm:w-[540px] p-0",children:[r.jsx(Hse,{className:"p-4 border-b",children:r.jsx(Wse,{children:"Select a Script"})}),r.jsx(tQt,{onSelectScript:ke=>{k(ke.text),I(!1),P(!0)},className:"h-[calc(100vh-80px)]"})]})]}),S&&r.jsx(ee,{className:"w-full",onClick:()=>P(!0),children:"Use Script"})]})]})]}),_==="uploading"&&r.jsx(Ze,{className:"max-w-md mx-auto",children:r.jsxs(et,{className:"pt-6 text-center",children:[r.jsx(_o,{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(pd,{value:W,className:"mb-2"}),r.jsxs("p",{className:"text-sm text-muted-foreground",children:[W.toFixed(0),"%"]})]})}),_==="processing"&&r.jsx(Ze,{className:"max-w-md mx-auto",children:r.jsxs(et,{className:"pt-6 text-center space-y-4",children:[r.jsx(Zr,{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(pd,{value:J,className:"mb-2"}),r.jsxs("p",{className:"text-sm text-muted-foreground",children:[J.toFixed(0),"%"]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:`This usually takes 30-60 seconds. If it takes longer, we'll auto-save your video and you can find it in your Video Library — look for the "processing" badge.`})]})}),_==="details"&&r.jsxs(Ze,{className:"max-w-lg mx-auto",children:[r.jsx(Wt,{children:r.jsx(Yt,{children:"Video Details"})}),r.jsxs(et,{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx($e,{children:"Title"}),r.jsx(dt,{value:he,onChange:ke=>ye(ke.target.value),placeholder:"Quick Video Touch"})]}),r.jsxs("div",{children:[r.jsx($e,{children:"Attach to Contact (Optional)"}),r.jsxs(mn,{value:se,onValueChange:fe,children:[r.jsx(fn,{children:r.jsx(yn,{placeholder:"No contact - use anywhere"})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"none",children:r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[r.jsx(Io,{className:"h-4 w-4"}),"No contact - use anywhere"]})}),p==null?void 0:p.map(ke=>r.jsx(qt,{value:ke.id,children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(ic,{className:"h-4 w-4"}),ke.first_name," ",ke.last_name]})},ke.id))]})]})]}),r.jsxs("div",{children:[r.jsx($e,{children:"Notes"}),r.jsx(Jn,{value:Ae,onChange:ke=>we(ke.target.value),placeholder:"Add notes about this video...",rows:3})]}),r.jsxs(ee,{className:"w-full",onClick:Mt,disabled:x.isPending,children:[x.isPending&&r.jsx(Zr,{className:"h-4 w-4 mr-2 animate-spin"}),"Save Video"]})]})]}),_==="share"&&r.jsxs(Ze,{className:"max-w-lg mx-auto",children:[r.jsx(Wt,{children:r.jsxs(Yt,{className:"flex items-center gap-2",children:[r.jsx(Ni,{className:"h-5 w-5 text-green-500"}),"Video Saved!"]})}),r.jsxs(et,{className:"space-y-4",children:[r.jsx("p",{className:"text-muted-foreground",children:"Share your video with one click:"}),r.jsxs("div",{className:"grid gap-3",children:[r.jsxs(ee,{variant:"outline",className:"justify-start",onClick:Ve,children:[r.jsx(zo,{className:"h-4 w-4 mr-2"}),"Text Contact Video"]}),r.jsxs(ee,{variant:"outline",className:"justify-start",onClick:Qe,children:[r.jsx(Ns,{className:"h-4 w-4 mr-2"}),"Email Contact Video"]}),r.jsxs(ee,{variant:"outline",className:"justify-start",onClick:()=>Oe("link",le().link),children:[r.jsx(Io,{className:"h-4 w-4 mr-2"}),"Copy Video Link",De==="link"&&r.jsx(Ni,{className:"h-4 w-4 ml-auto text-green-500"})]}),r.jsxs(ee,{variant:"outline",className:"justify-start",onClick:()=>qe(!0),children:[r.jsx(Uc,{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:()=>e("/mission-control/video-library"),children:"View Library"}),r.jsx(ee,{onClick:()=>{b("record"),V(null),ge(null),pe(null)},children:"Record Another"})]})]})]}),be&&Je&&r.jsx(yVe,{open:Be,onOpenChange:qe,video:{id:be,share_token:Je,title:he||null,contact_id:se||null,thumbnail_url:(ie==null?void 0:ie.thumbnailUrl)||null},contactName:((st=p==null?void 0:p.find(ke=>ke.id===se))==null?void 0:st.first_name)||null})]})}):r.jsx(Dr,{title:"Quick Video Touch",children:r.jsxs("div",{className:"max-w-2xl mx-auto text-center py-12",children:[r.jsx(rf,{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:()=>e("/mission-control/video-library"),children:"Open Video Library"})]})})}function sQt({open:e,onOpenChange:t}){const{data:n}=jp(),{data:s}=X0e(),a=gBe(),o=E.useRef(null),[l,i]=E.useState(null),[u,p]=E.useState(""),[x,y]=E.useState(""),[_,b]=E.useState(""),[S,k]=E.useState(!1),[M,P]=E.useState(0),[T,I]=E.useState("idle"),z=(s==null?void 0:s.total_storage_mb)||0,U=((s==null?void 0:s.max_storage_mb)||1024)-z,V=ne=>{var ie;const oe=(ie=ne.target.files)==null?void 0:ie[0];if(!oe)return;if(!oe.type.startsWith("video/")){Ie.error("Please select a video file");return}const ge=oe.size/(1024*1024);if(ge>500){Ie.error("Video file must be less than 500MB");return}if(ge>U){Ie.error(`Not enough storage. You have ${U.toFixed(1)} MB remaining.`);return}i(oe),u||p(oe.name.replace(/\.[^/.]+$/,""))},W=async()=>{if(!l){Ie.error("Please select a video file");return}k(!0),P(0),I("creating");try{const{data:ne,error:oe}=await Q.functions.invoke("bunny-upload",{body:{action:"create",title:u||l.name,isAgentVideo:!0}});if(oe)throw new Error(oe.message);const{videoId:ge,libraryId:ie}=ne;I("uploading");const{data:pe,error:se}=await Q.functions.invoke("bunny-upload",{body:{action:"upload-url",videoId:ge,isAgentVideo:!0}});if(se)throw new Error(se.message);await new Promise((ye,Ae)=>{const we=new XMLHttpRequest;we.upload.addEventListener("progress",be=>{if(be.lengthComputable){const _e=Math.round(be.loaded/be.total*100);P(_e)}}),we.addEventListener("load",()=>{we.status>=200&&we.status<300?ye():Ae(new Error(`Upload failed with status ${we.status}`))}),we.addEventListener("error",()=>Ae(new Error("Upload failed"))),we.open("PUT",pe.uploadUrl),we.setRequestHeader("AccessKey",pe.apiKey),we.send(l)}),I("processing");const fe=l.size/(1024*1024),he=`https://iframe.mediadelivery.net/embed/${ie}/${ge}`;await a.mutateAsync({bunny_video_id:ge,playback_url:he,file_size_mb:fe,title:u||l.name,notes:x||void 0,contact_id:_||void 0,status:"processing",touch_type:"video_upload"}),Ie.success("Video uploaded successfully! Processing may take a few minutes."),G()}catch(ne){console.error("Upload error:",ne),Ie.error(ne instanceof Error?ne.message:"Failed to upload video")}finally{k(!1),I("idle")}},G=()=>{S||(i(null),p(""),y(""),b(""),P(0),I("idle"),t(!1))},J=()=>{switch(T){case"creating":return"Preparing upload...";case"uploading":return`Uploading... ${M}%`;case"processing":return"Saving video...";default:return""}};return r.jsx(Or,{open:e,onOpenChange:G,children:r.jsxs(Ir,{className:"sm:max-w-md",children:[r.jsxs($r,{children:[r.jsx(Fr,{children:"Upload Video"}),r.jsx(Zn,{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($e,{children:"Video File"}),l?r.jsxs("div",{className:"flex items-center gap-3 p-3 bg-muted rounded-lg",children:[r.jsx($a,{className:"h-8 w-8 text-primary flex-shrink-0"}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"text-sm font-medium truncate",children:l.name}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[(l.size/(1024*1024)).toFixed(1)," MB"]})]}),!S&&r.jsx(ee,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:ne=>{ne.stopPropagation(),i(null)},children:r.jsx(hs,{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 ne;return(ne=o.current)==null?void 0:ne.click()},children:[r.jsx(_o,{className:"h-8 w-8 mx-auto text-muted-foreground mb-2"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Click to select a video file"}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"MP4, MOV, WebM (max 500MB)"})]}),r.jsx("input",{ref:o,type:"file",accept:"video/*",className:"hidden",onChange:V,disabled:S})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{htmlFor:"title",children:"Title"}),r.jsx(dt,{id:"title",value:u,onChange:ne=>p(ne.target.value),placeholder:"Enter video title",disabled:S})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{children:"Associate with Contact (optional)"}),r.jsxs(mn,{value:_||"__none__",onValueChange:ne=>b(ne==="__none__"?"":ne),disabled:S,children:[r.jsx(fn,{children:r.jsx(yn,{placeholder:"Select a contact"})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"__none__",children:"No contact"}),n==null?void 0:n.map(ne=>r.jsxs(qt,{value:ne.id,children:[ne.first_name," ",ne.last_name||""]},ne.id))]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{htmlFor:"notes",children:"Notes (optional)"}),r.jsx(Jn,{id:"notes",value:x,onChange:ne=>y(ne.target.value),placeholder:"Add any notes about this video",rows:2,disabled:S})]}),S&&r.jsxs("div",{className:"space-y-2",children:[r.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[r.jsx(Zr,{className:"h-4 w-4 animate-spin"}),r.jsx("span",{children:J()})]}),r.jsx(pd,{value:T==="uploading"?M:T==="processing"?100:10})]})]}),r.jsxs(Bs,{children:[r.jsx(ee,{variant:"outline",onClick:G,disabled:S,children:"Cancel"}),r.jsx(ee,{onClick:W,disabled:!l||S,children:S?r.jsxs(r.Fragment,{children:[r.jsx(Zr,{className:"h-4 w-4 mr-2 animate-spin"}),"Uploading..."]}):r.jsxs(r.Fragment,{children:[r.jsx(_o,{className:"h-4 w-4 mr-2"}),"Upload Video"]})})]})]})})}function aQt({open:e,onOpenChange:t,video:n,gmailEmail:s,signedThumbnailUrl:a,onSendComplete:o}){const[l,i]=E.useState([]),[u,p]=E.useState(null),[x,y]=E.useState(!1),[_,b]=E.useState(!1),[S,k]=E.useState(""),[M,P]=E.useState(""),[T,I]=E.useState(""),[z,D]=E.useState(!1),U=n.share_token?`https://video.relevelup.com/${n.share_token}`:"",V=n.share_token?`https://video.relevelup.com/thumb/${n.share_token}`:a||n.thumbnail_url||"",W=n.title||"Video Message";E.useEffect(()=>{e&&l.length===0&&G()},[e]),E.useEffect(()=>{if(e&&(P(`I recorded a video for you — ${W}`),I("Hey! I recorded a quick video just for you. Click below to watch it:"),p(null),k(""),n.contact_id)){const pe=l.find(se=>se.id===n.contact_id);pe&&(p(pe),k(pe.email||""))}},[e,n.contact_id,l]);const G=async()=>{b(!0);try{const{data:pe,error:se}=await Q.from("innercircle_contacts").select("id, first_name, last_name, email").order("first_name",{ascending:!0}).limit(500);if(se)throw se;i(pe||[])}catch{console.error("Failed to fetch contacts")}finally{b(!1)}},J=pe=>{p(pe),y(!1),k(pe.email||""),I(`Hey ${pe.first_name}! I recorded a quick video just for you. Click below to watch it:`),P(`I recorded a video for you — ${W}`)},ne=()=>{p(null),k(""),I("Hey! I recorded a quick video just for you. Click below to watch it:")},oe=pe=>`${pe.first_name} ${pe.last_name||""}`.trim(),ge=()=>`
${T.split(/\n\n+/).map(se=>`

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

`).join("")}

▶ Watch Video

`,ie=async()=>{if(!S){Ie.error("Please enter a recipient email");return}if(!U){Ie.error("Video does not have a share link");return}D(!0);try{const pe=ge(),{data:se,error:fe}=await Q.functions.invoke("gmail-send",{body:{to:S,subject:M,body:pe,contactId:(u==null?void 0:u.id)||null}});if(fe)throw fe;if(!(se!=null&&se.success))throw new Error((se==null?void 0:se.error)||"Failed to send");Ie.success("Video email sent!"),t(!1),o==null||o()}catch(pe){console.error("Gmail send error:",pe),Ie.error("Failed to send: "+(pe instanceof Error?pe.message:"Unknown error"))}finally{D(!1)}};return r.jsx(Or,{open:e,onOpenChange:t,children:r.jsxs(Ir,{className:"sm:max-w-[560px] max-h-[90vh] overflow-y-auto",children:[r.jsxs($r,{children:[r.jsxs(Fr,{className:"flex items-center gap-2",children:[r.jsx(Ns,{className:"h-5 w-5 text-red-500"}),"Send Video via Gmail"]}),s&&r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Sending from ",r.jsx("span",{className:"font-medium",children:s})]})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-1.5",children:[r.jsx($e,{children:"Send to Contact"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsxs(Vc,{open:x,onOpenChange:y,children:[r.jsx(Hc,{asChild:!0,children:r.jsxs(ee,{variant:"outline",role:"combobox",className:"flex-1 justify-between",children:[u?r.jsxs("span",{className:"flex items-center gap-2",children:[r.jsx(ic,{className:"h-4 w-4 text-muted-foreground"}),oe(u),u.email&&r.jsxs("span",{className:"text-muted-foreground text-xs",children:["(",u.email,")"]})]}):r.jsx("span",{className:"text-muted-foreground",children:"Select a contact..."}),r.jsx(oy,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),r.jsx(Mc,{className:"w-[350px] p-0",align:"start",children:r.jsxs(Ey,{children:[r.jsx(Iy,{placeholder:"Search contacts..."}),r.jsxs(Py,{children:[r.jsx(Ly,{children:_?"Loading...":"No contacts found."}),r.jsx(Oy,{children:l.filter(pe=>pe.email).map(pe=>r.jsxs(Dy,{value:`${pe.first_name} ${pe.last_name||""} ${pe.email||""}`,onSelect:()=>J(pe),children:[r.jsx(Ni,{className:Bt("mr-2 h-4 w-4",(u==null?void 0:u.id)===pe.id?"opacity-100":"opacity-0")}),r.jsxs("div",{children:[r.jsx("div",{className:"font-medium",children:oe(pe)}),r.jsx("div",{className:"text-xs text-muted-foreground",children:pe.email})]})]},pe.id))})]})]})})]}),u&&r.jsx(ee,{variant:"ghost",size:"icon",onClick:ne,className:"shrink-0",children:r.jsx(hs,{className:"h-4 w-4"})})]})]}),!u&&r.jsxs("div",{className:"space-y-1.5",children:[r.jsx($e,{htmlFor:"video-to",children:"Or type email address"}),r.jsx(dt,{id:"video-to",value:S,onChange:pe=>k(pe.target.value),placeholder:"recipient@example.com",type:"email"})]}),r.jsx(Ld,{}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx($e,{htmlFor:"video-subject",children:"Subject"}),r.jsx(dt,{id:"video-subject",value:M,onChange:pe=>P(pe.target.value)})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx($e,{htmlFor:"video-message",children:"Personal Message"}),r.jsx(Jn,{id:"video-message",value:T,onChange:pe=>I(pe.target.value),rows:4,className:"resize-y"})]}),r.jsxs("div",{className:"rounded-lg border bg-muted/30 p-3 space-y-2",children:[r.jsx($e,{className:"text-xs text-muted-foreground",children:"Video Preview (embedded in email)"}),r.jsxs("div",{className:"relative rounded-lg overflow-hidden bg-black",style:{maxWidth:320},children:[V?r.jsx("img",{src:V,alt:W,className:"w-full aspect-video object-cover"}):r.jsx("div",{className:"w-full aspect-video flex items-center justify-center bg-muted",children:r.jsx(Vl,{className:"h-8 w-8 text-muted-foreground"})}),r.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:r.jsx("div",{className:"w-10 h-10 rounded-full bg-white/80 flex items-center justify-center shadow",children:r.jsx(Vl,{className:"h-5 w-5 text-primary ml-0.5"})})})]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Recipients will see the thumbnail with a play button. Clicking opens the video page."})]}),r.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[r.jsx(ee,{variant:"outline",onClick:()=>t(!1),disabled:z,children:"Cancel"}),r.jsxs(ee,{onClick:ie,disabled:z||!S||!M,className:"gap-2",children:[z?r.jsx(Zr,{className:"h-4 w-4 animate-spin"}):r.jsx(lo,{className:"h-4 w-4"}),z?"Sending...":"Send Video Email"]})]})]})]})})}function iQt({previewSrc:e,thumbnailSrc:t,alt:n,isHovered:s}){const[a,o]=E.useState(!1),[l,i]=E.useState(!1),u=s&&e&&!a,p=t&&!l;return!p&&!u?r.jsx("div",{className:"w-full h-full flex items-center justify-center absolute inset-0 bg-muted",children:r.jsx($a,{className:"h-12 w-12 text-muted-foreground"})}):r.jsxs(r.Fragment,{children:[p&&r.jsx("img",{src:t,alt:n,loading:"lazy",className:`w-full h-full object-cover absolute inset-0 transition-opacity duration-200 ${u?"opacity-0":"opacity-100"}`,onError:()=>i(!0)}),u&&r.jsx("img",{src:e,alt:n,className:"w-full h-full object-cover absolute inset-0",onError:()=>o(!0)})]})}function oQt({video:e,previewSrc:t,thumbnailSrc:n,onOpen:s,onDelete:a,onRename:o,onNavigateToContact:l,onGetEmbedCode:i,onCopyEmailHtml:u,onEmbedToCrm:p,onShareWithTemplate:x,onSendViaGmail:y,isGmailConnected:_,getContactName:b,getShareUrl:S,copyToClipboard:k,formatDuration:M}){const[P,T]=E.useState(!1);return r.jsxs(Ze,{className:"overflow-hidden group cursor-pointer",onClick:s,onMouseEnter:()=>T(!0),onMouseLeave:()=>T(!1),children:[r.jsxs("div",{className:"relative aspect-video bg-muted overflow-hidden",children:[r.jsx(iQt,{previewSrc:t,thumbnailSrc:n,alt:e.title||"Video preview",isHovered:P}),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(Vl,{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:M(e.duration_seconds)}),e.status!=="ready"&&r.jsx(Pt,{variant:e.status==="processing"?"secondary":"destructive",className:"absolute top-2 left-2",children:e.status})]}),r.jsx(et,{className:"p-3",children:r.jsxs("div",{className:"flex items-start justify-between gap-2",children:[r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsx("h3",{className:"font-medium truncate",children:e.title||"Untitled Video"}),r.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground mt-1",children:[r.jsx(ic,{className:"h-3 w-3"}),r.jsx("span",{className:"truncate",children:b(e.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:on(new Date(e.created_at),"MMM d, yyyy")})]}),(e.view_count??0)>0&&r.jsxs("div",{className:"flex items-center gap-1 text-primary",children:[r.jsx(Ko,{className:"h-3 w-3"}),r.jsxs("span",{children:[e.view_count," ",e.view_count===1?"view":"views"]})]})]}),_&&e.share_token&&r.jsxs(ee,{variant:"outline",size:"sm",className:"mt-2 gap-1.5 text-xs h-7",onClick:I=>{I.stopPropagation(),y==null||y()},children:[r.jsx(Ns,{className:"h-3 w-3"}),"Send via Gmail"]}),r.jsx("h3",{className:"font-medium truncate",children:e.title||"Untitled Video"}),r.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground mt-1",children:[r.jsx(ic,{className:"h-3 w-3"}),r.jsx("span",{className:"truncate",children:b(e.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:on(new Date(e.created_at),"MMM d, yyyy")})]}),(e.view_count??0)>0&&r.jsxs("div",{className:"flex items-center gap-1 text-primary",children:[r.jsx(Ko,{className:"h-3 w-3"}),r.jsxs("span",{children:[e.view_count," ",e.view_count===1?"view":"views"]})]})]})]}),r.jsxs(Lh,{children:[r.jsx(Oh,{asChild:!0,children:r.jsx(ee,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:I=>I.stopPropagation(),children:r.jsx(Wx,{className:"h-4 w-4"})})}),r.jsxs(ah,{align:"end",className:"bg-popover",children:[r.jsxs(ei,{onClick:I=>{I.stopPropagation(),s()},children:[r.jsx(Ko,{className:"h-4 w-4 mr-2"}),"Watch"]}),r.jsx(sk,{}),r.jsxs(ei,{onClick:I=>{I.stopPropagation(),x()},children:[r.jsx(Uc,{className:"h-4 w-4 mr-2"}),"Share with Template"]}),r.jsxs(ei,{onClick:I=>{I.stopPropagation(),k(S(e),"Share link")},children:[r.jsx(Io,{className:"h-4 w-4 mr-2"}),"Copy Share Link"]}),r.jsxs(ei,{onClick:I=>{I.stopPropagation(),i()},children:[r.jsx(Tj,{className:"h-4 w-4 mr-2"}),"Get Embed Code"]}),r.jsxs(ei,{onClick:I=>{I.stopPropagation(),u()},children:[r.jsx(Ns,{className:"h-4 w-4 mr-2"}),"Copy HTML for Email"]}),r.jsxs(ei,{onClick:I=>{I.stopPropagation(),p()},children:[r.jsx(As,{className:"h-4 w-4 mr-2"}),"Embed to CRM"]}),_&&e.share_token&&r.jsxs(ei,{onClick:I=>{I.stopPropagation(),y==null||y()},children:[r.jsx(lo,{className:"h-4 w-4 mr-2"}),"Send via Gmail"]}),r.jsxs(ei,{onClick:I=>{I.stopPropagation(),o()},children:[r.jsx(ni,{className:"h-4 w-4 mr-2"}),"Rename"]}),r.jsx(sk,{}),e.contact_id&&r.jsxs(ei,{onClick:I=>{I.stopPropagation(),l()},children:[r.jsx(ic,{className:"h-4 w-4 mr-2"}),"View Contact"]}),r.jsxs(ei,{onClick:I=>{I.stopPropagation(),a()},className:"text-destructive",children:[r.jsx(Bn,{className:"h-4 w-4 mr-2"}),"Delete"]})]})]})]})})]})}function lQt(){var Ge;const e=Gn(),{data:t,isLoading:n,refetch:s}=E3t(),{data:a}=X0e(),{data:o}=jp(),l=L3t(),i=P3t(),{isGmailConnected:u,gmailEmail:p}=$ae(),[x,y]=E.useState(""),[_,b]=E.useState(null),[S,k]=E.useState(!1),[M,P]=E.useState(!1),[T,I]=E.useState(!1),[z,D]=E.useState(!1),[U,V]=E.useState(!1),[W,G]=E.useState(""),[J,ne]=E.useState(!1),[oe,ge]=E.useState(!1),[ie,pe]=E.useState(!1),[se,fe]=E.useState(!1),[he,ye]=E.useState(""),[Ae,we]=E.useState({}),be=Ee=>{if(!Ee)return"Unassigned";const He=o==null?void 0:o.find(nt=>nt.id===Ee);return He?`${He.first_name} ${He.last_name||""}`.trim():"Unknown"},_e=Ee=>{if(!Ee)return"0:00";const He=Math.floor(Ee/60),nt=Ee%60;return`${He}:${nt.toString().padStart(2,"0")}`},Je=t==null?void 0:t.filter(Ee=>{if(!x)return!0;const He=be(Ee.contact_id).toLowerCase(),nt=(Ee.title||"").toLowerCase(),yt=(Ee.notes||"").toLowerCase();return He.includes(x.toLowerCase())||nt.includes(x.toLowerCase())||yt.includes(x.toLowerCase())}),[Te,De]=E.useState(!1);E.useEffect(()=>{if(Te)return;(async()=>{if(!(t!=null&&t.length))return;const He=t.filter(yt=>yt.status==="processing"&&yt.bunny_video_id);if(!He.length)return;let nt=!1;for(const yt of He)try{const{data:it,error:zt}=await Q.functions.invoke("bunny-upload",{body:{action:"status",videoId:yt.bunny_video_id,isAgentVideo:!0}});if(zt||!it)continue;it.status===4&&(await Q.from("agent_videos").update({status:"ready",playback_url:it.directPlayUrl,thumbnail_url:it.thumbnailUrl,preview_url:it.previewUrl,duration_seconds:it.length||yt.duration_seconds,updated_at:new Date().toISOString()}).eq("id",yt.id),nt=!0)}catch(it){console.warn("Reconcile check failed for video",yt.id,it)}De(!0),nt&&s()})()},[t,Te,s]),E.useEffect(()=>{(async()=>{if(!(t!=null&&t.length))return;const He=t.filter(dr=>(dr==null?void 0:dr.bunny_video_id)&&!Ae[dr.id]);if(!He.length)return;const nt=He.map(dr=>dr.bunny_video_id),{data:yt,error:it}=await Q.functions.invoke("bunny-upload",{body:{action:"bulk-asset-urls",videoIds:nt,isAgentVideo:!0}});if(it)throw it;const zt=(yt==null?void 0:yt.assets)||{};we(dr=>{const Rr={...dr};for(const Gr of He)zt[Gr.bunny_video_id]&&(Rr[Gr.id]={previewUrl:zt[Gr.bunny_video_id].previewUrl,thumbnailUrl:zt[Gr.bunny_video_id].thumbnailUrl});return Rr})})().catch(He=>console.warn("Failed to load signed Bunny asset URLs",He))},[t,Ae]);const Ue=(a==null?void 0:a.total_storage_mb)||0,Be=(a==null?void 0:a.max_storage_mb)||1024,qe=Ue/Be*100,ot=qe>=80,Mt=qe>=100,Oe=async(Ee,He)=>{await navigator.clipboard.writeText(Ee),Ie.success(`${He} copied to clipboard`)},at=Ee=>Ee.share_token?`https://video.relevelup.com/${Ee.share_token}`:Ee.playback_url||"",le=Ee=>{const He=at(Ee),nt=o==null?void 0:o.find(Gr=>Gr.id===Ee.contact_id),yt=be(Ee.contact_id),it=yt!=="Unassigned"?yt.split(" ")[0]:"",zt=(nt==null?void 0:nt.phone)||"",dr=`Hey${it?` ${it}`:""}! I recorded a quick video message for you. Check it out: ${He}`,Rr=zt?`sms:${zt}?body=${encodeURIComponent(dr)}`:`sms:?body=${encodeURIComponent(dr)}`;window.open(Rr,"_self")},Ve=Ee=>{const He=o==null?void 0:o.find(Rr=>Rr.id===Ee.contact_id),nt=(He==null?void 0:He.email)||"",yt=at(Ee),it="Check out this video",zt=`I recorded a quick video for you: ${yt}`,dr=nt?`mailto:${nt}?subject=${encodeURIComponent(it)}&body=${encodeURIComponent(zt)}`:`mailto:?subject=${encodeURIComponent(it)}&body=${encodeURIComponent(zt)}`;window.open(dr,"_self")},Qe=Ee=>{var it;const He=at(Ee),nt=Ee.title||"Video Message",yt=Ee.share_token?`https://video.relevelup.com/thumb/${Ee.share_token}`:((it=Ae[Ee.id])==null?void 0:it.thumbnailUrl)||Ee.thumbnail_url||"";return``},st=async Ee=>{if(!Ee.thumbnail_url&&!Ee.share_token){Ie.error("Video thumbnail not available yet");return}const He=Qe(Ee),nt=at(Ee),yt=`Watch: ${Ee.title||"Video Message"} ${nt}`;try{const it=new Blob([He],{type:"text/html"}),zt=new Blob([yt],{type:"text/plain"}),dr=new ClipboardItem({"text/html":it,"text/plain":zt});await navigator.clipboard.write([dr]),Ie.success("Copied! Paste into Gmail - the thumbnail will appear after sending.")}catch{await navigator.clipboard.writeText(yt+` `+He),Ie.success("Copied! Paste into your email.")}},ke=async Ee=>{try{Ie.loading("Preparing download...",{id:"download"});const{data:He,error:nt}=await Q.functions.invoke("bunny-upload",{body:{action:"download-url",videoId:Ee.bunny_video_id,isAgentVideo:!0}});if(nt||!(He!=null&&He.downloadUrl))throw new Error((nt==null?void 0:nt.message)||"Failed to get download URL");const it=`${((Ee.title||"video").toString().trim()||"video").replace(/[\\/:*?"<>|]+/g,"-")}.mp4`,zt=await fetch(He.downloadUrl);if(!zt.ok)throw new Error("Failed to fetch video file");const dr=await zt.blob(),Rr=URL.createObjectURL(dr),Gr=document.createElement("a");Gr.href=Rr,Gr.download=it,Gr.rel="noreferrer",document.body.appendChild(Gr),Gr.click(),Gr.remove(),URL.revokeObjectURL(Rr),Ie.success("Download started",{id:"download"})}catch(He){console.error("Download error:",He),Ie.error("Could not force download (your browser may block it).",{id:"download"})}},ct=async Ee=>{b(Ee),ne(!0),G(""),V(!0);try{const{data:He,error:nt}=await Q.functions.invoke("bunny-upload",{body:{action:"crm-embed",videoId:Ee.bunny_video_id,title:Ee.title,isAgentVideo:!0,shareToken:Ee.share_token}});if(nt||!(He!=null&&He.html))throw new Error("Failed to generate CRM embed code");G(He.html)}catch(He){console.error("CRM embed error:",He),Ie.error("Failed to generate CRM embed code"),V(!1)}finally{ne(!1)}},Ce=Ee=>{b(Ee),k(!0)},Me=async()=>{if(_)try{await l.mutateAsync({id:_.id,bunnyVideoId:_.bunny_video_id,hardDelete:!0}),P(!1),b(null),Ie.success("Video deleted successfully")}catch{Ie.error("Failed to delete video")}};return r.jsx(Dr,{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:()=>I(!0),children:[r.jsx(_o,{className:"h-4 w-4 mr-2"}),"Upload Video"]}),r.jsxs(ee,{onClick:()=>e("/mission-control/video/record"),children:[r.jsx(bn,{className:"h-4 w-4 mr-2"}),"Record New Video"]})]})]}),r.jsx(Ze,{className:ot?"border-amber-500":Mt?"border-destructive":"",children:r.jsxs(et,{className:"py-4",children:[r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx(sA,{className:`h-5 w-5 ${Mt?"text-destructive":ot?"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:[Ue.toFixed(1)," MB / ",Be>=1024?`${(Be/1024).toFixed(0)} GB`:`${Be} MB`]})]}),r.jsx(pd,{value:Math.min(qe,100),className:`h-2 ${Mt?"[&>div]:bg-destructive":ot?"[&>div]:bg-amber-500":""}`})]}),ot&&!Mt&&r.jsxs(Pt,{variant:"outline",className:"border-amber-500 text-amber-600",children:[r.jsx(yl,{className:"h-3 w-3 mr-1"}),"Near Limit"]}),Mt&&r.jsxs(Pt,{variant:"destructive",children:[r.jsx(yl,{className:"h-3 w-3 mr-1"}),"At Limit"]})]}),Mt&&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(Sa,{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:x,onChange:Ee=>y(Ee.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"})}):(Je==null?void 0:Je.length)===0?r.jsx(Ze,{children:r.jsxs(et,{className:"py-12 text-center",children:[r.jsx($a,{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:()=>e("/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:Je==null?void 0:Je.map(Ee=>{var He,nt;return r.jsx(oQt,{video:Ee,previewSrc:(He=Ae[Ee.id])==null?void 0:He.previewUrl,thumbnailSrc:(nt=Ae[Ee.id])==null?void 0:nt.thumbnailUrl,onOpen:()=>Ce(Ee),onDelete:()=>{b(Ee),P(!0)},onRename:()=>{b(Ee),ye(Ee.title||""),fe(!0)},onNavigateToContact:()=>e(`/mission-control/contacts/${Ee.contact_id}`),onGetEmbedCode:()=>{b(Ee),D(!0)},onCopyEmailHtml:()=>st(Ee),onEmbedToCrm:()=>ct(Ee),onShareWithTemplate:()=>{b(Ee),ge(!0)},onSendViaGmail:()=>{b(Ee),pe(!0)},isGmailConnected:u,getContactName:be,getShareUrl:at,copyToClipboard:Oe,formatDuration:_e},Ee.id)})}),r.jsx(Or,{open:S,onOpenChange:k,children:r.jsxs(Ir,{className:"max-w-2xl",children:[r.jsxs($r,{children:[r.jsx(Fr,{children:(_==null?void 0:_.title)||"Video Preview"}),r.jsx(Zn,{children:(_==null?void 0:_.contact_id)&&r.jsxs("span",{className:"flex items-center gap-1",children:[r.jsx(ic,{className:"h-3 w-3"}),be(_.contact_id)]})})]}),_&&r.jsxs("div",{className:"space-y-4",children:[_.status==="processing"?r.jsxs("div",{className:"flex flex-col items-center justify-center py-12 px-6 bg-muted/50 rounded-lg border border-dashed border-border text-center space-y-4",children:[r.jsx("div",{className:"relative",children:r.jsx("div",{className:"h-16 w-16 rounded-full bg-primary/10 flex items-center justify-center",children:r.jsx(Zr,{className:"h-8 w-8 text-primary animate-spin"})})}),r.jsxs("div",{className:"space-y-1",children:[r.jsx("h3",{className:"font-semibold text-lg",children:"Video is still processing"}),r.jsx("p",{className:"text-muted-foreground text-sm max-w-sm",children:"Your video is being encoded and will be ready shortly. This usually takes 1–3 minutes. Check back soon!"})]}),r.jsxs(ee,{variant:"outline",size:"sm",onClick:()=>{k(!1),s()},children:[r.jsx(qo,{className:"h-4 w-4 mr-2"}),"Refresh Library"]})]}):r.jsx("div",{className:"relative w-full",style:{paddingBottom:"56.25%"},children:_.playback_url?(()=>{let Ee=_.playback_url;return Ee.includes("iframe.mediadelivery.net/play/")&&(Ee=Ee.replace("/play/","/embed/"),Ee+=(Ee.includes("?")?"&":"?")+"autoplay=false&responsive=true"),Ee.includes("iframe.mediadelivery.net")?r.jsx("iframe",{src:Ee,title:_.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:_.playback_url,controls:!0,playsInline:!0,preload:"metadata",poster:_.thumbnail_url||void 0,className:"absolute top-0 left-0 w-full h-full rounded-lg object-cover",onError:()=>Ie.error("Video preview failed to load")},_.playback_url)})():r.jsxs("div",{className:"absolute inset-0 flex items-center justify-center bg-muted rounded-lg",children:[r.jsx($a,{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:()=>le(_),children:[r.jsx(zo,{className:"h-4 w-4 mr-2"}),"Text Contact Video"]}),!u&&r.jsxs(ee,{variant:"outline",onClick:()=>Ve(_),children:[r.jsx(Ns,{className:"h-4 w-4 mr-2"}),"Email Contact Video"]}),r.jsxs(ee,{variant:"outline",onClick:()=>Oe(at(_),"Share link"),children:[r.jsx(Wo,{className:"h-4 w-4 mr-2"}),"Copy Share Link"]}),r.jsxs(ee,{variant:"outline",onClick:()=>st(_),children:[r.jsx(Ns,{className:"h-4 w-4 mr-2"}),"Copy HTML for Email"]}),r.jsxs(ee,{variant:"outline",onClick:()=>ke(_),children:[r.jsx(io,{className:"h-4 w-4 mr-2"}),"Download Video"]}),r.jsxs(ee,{variant:"outline",onClick:()=>{k(!1),ct(_)},children:[r.jsx(As,{className:"h-4 w-4 mr-2"}),"Embed to CRM"]}),r.jsxs(ee,{variant:"outline",onClick:()=>{k(!1),ge(!0)},children:[r.jsx(Uc,{className:"h-4 w-4 mr-2"}),"Send with Page Template"]}),u&&(_==null?void 0:_.share_token)&&r.jsxs(ee,{variant:"outline",onClick:()=>{k(!1),pe(!0)},children:[r.jsx(lo,{className:"h-4 w-4 mr-2"}),"Send via Gmail"]})]}),r.jsx("div",{className:"flex justify-end pt-2 border-t",children:r.jsxs(ee,{variant:"destructive",onClick:()=>{k(!1),P(!0)},children:[r.jsx(Bn,{className:"h-4 w-4 mr-2"}),"Delete Video"]})})]})]})}),r.jsx(Or,{open:M,onOpenChange:P,children:r.jsxs(Ir,{children:[r.jsxs($r,{children:[r.jsx(Fr,{children:"Delete Video"}),r.jsx(Zn,{children:"Are you sure you want to delete this video? This action cannot be undone."})]}),r.jsxs(Bs,{children:[r.jsx(ee,{variant:"outline",onClick:()=>P(!1),children:"Cancel"}),r.jsx(ee,{variant:"destructive",onClick:Me,disabled:l.isPending,children:l.isPending?"Deleting...":"Delete"})]})]})}),r.jsx(sQt,{open:T,onOpenChange:I}),r.jsx(Or,{open:z,onOpenChange:D,children:r.jsxs(Ir,{className:"sm:max-w-lg",children:[r.jsxs($r,{children:[r.jsx(Fr,{children:"Embed Video"}),r.jsx(Zn,{children:"Copy this code to embed the video on your website."})]}),_&&r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{children:"Embed Code"}),r.jsx(Jn,{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 Ee=``;Oe(Ee,"Embed code")},children:[r.jsx(Wo,{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."})]})]})}),_&&r.jsx(yVe,{open:oe,onOpenChange:ge,video:_,contactName:be(_.contact_id)}),_&&r.jsx(aQt,{open:ie,onOpenChange:pe,video:_,gmailEmail:p,signedThumbnailUrl:(Ge=Ae[_.id])==null?void 0:Ge.thumbnailUrl}),r.jsx(Or,{open:se,onOpenChange:fe,children:r.jsxs(Ir,{className:"max-w-sm",children:[r.jsxs($r,{children:[r.jsx(Fr,{children:"Rename Video"}),r.jsx(Zn,{children:"Enter a new title for this video."})]}),r.jsx(dt,{value:he,onChange:Ee=>ye(Ee.target.value),placeholder:"Video title",autoFocus:!0,onKeyDown:Ee=>{Ee.key==="Enter"&&he.trim()&&i.mutate({id:_.id,title:he.trim()},{onSuccess:()=>{Ie.success("Video renamed"),fe(!1)}})}}),r.jsxs(Bs,{children:[r.jsx(ee,{variant:"outline",onClick:()=>fe(!1),children:"Cancel"}),r.jsx(ee,{disabled:!he.trim()||i.isPending,onClick:()=>{i.mutate({id:_.id,title:he.trim()},{onSuccess:()=>{Ie.success("Video renamed"),fe(!1)}})},children:i.isPending?"Saving...":"Save"})]})]})}),r.jsx(Or,{open:U,onOpenChange:V,children:r.jsxs(Ir,{className:"sm:max-w-lg",children:[r.jsxs($r,{children:[r.jsxs(Fr,{className:"flex items-center gap-2",children:[r.jsx(As,{className:"h-5 w-5"}),"Embed to CRM"]}),r.jsx(Zn,{children:"Copy this HTML code and paste it into your CRM's email editor. It uses a simple image + link format that works in all CRM email programs."})]}),J?r.jsx("div",{className:"flex items-center justify-center py-8",children:r.jsx(Zr,{className:"h-8 w-8 animate-spin text-muted-foreground"})}):W?r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{children:"CRM Email HTML"}),r.jsx(Jn,{readOnly:!0,rows:12,value:W,className:"font-mono text-xs"})]}),r.jsxs(ee,{className:"w-full",onClick:()=>{Oe(W,"CRM embed code")},children:[r.jsx(Wo,{className:"h-4 w-4 mr-2"}),"Copy CRM Embed Code"]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Paste this into your CRM's email HTML editor. The recipient will see the video thumbnail and can click to watch. Works with Follow Up Boss, KvCORE, BoomTown, Sierra, and more."})]}):null]})})]})})}function vVe({stages:e,currentStageId:t,onStageSelect:n,disabled:s}){const[a,o]=E.useState(!1),l=e.find(u=>u.id===t),i=u=>{u.id!==t&&n(u.id,u.name),o(!1)};return r.jsxs(Lh,{open:a,onOpenChange:o,children:[r.jsx(Oh,{asChild:!0,children:r.jsxs(ee,{variant:"outline",size:"sm",className:"h-7 text-xs gap-1.5",disabled:s,onClick:u=>u.stopPropagation(),children:[l&&r.jsx("div",{className:"w-2 h-2 rounded-full shrink-0",style:{backgroundColor:l.color}}),r.jsx("span",{className:"max-w-[80px] truncate",children:(l==null?void 0:l.name)||"Move"}),r.jsx(Wi,{className:"h-3 w-3 shrink-0"})]})}),r.jsx(ah,{align:"end",className:"w-48 z-50 bg-popover",onClick:u=>u.stopPropagation(),children:e.map(u=>{const p=u.icon&&SIe[u.icon]||Qu,x=u.id===t;return r.jsxs(ei,{onClick:()=>i(u),className:Bt("flex items-center gap-2 cursor-pointer",x&&"bg-accent"),children:[r.jsx("div",{className:"w-5 h-5 rounded flex items-center justify-center shrink-0",style:{backgroundColor:`${u.color}20`},children:r.jsx(p,{className:"h-3 w-3",style:{color:u.color}})}),r.jsx("span",{className:"flex-1",children:u.name}),x&&r.jsx(Ni,{className:"h-4 w-4 text-primary"})]},u.id)})})]})}const cQt={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"}},dQt={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 _Ve({deal:e,onClick:t,isDragging:n,stages:s,onStageChange:a,showStagePicker:o=!1,isWonStage:l=!1}){var P,T;const i=z3(),u=cQt[e.deal_type],p=dQt[e.priority],x=E.useMemo(()=>e.target_close_date?Ay(new Date(e.target_close_date),new Date):null,[e.target_close_date]),y=x!==null&&x<0,_=x!==null&&x<=7&&x>=0,b=E.useMemo(()=>{var D;if(e.deal_type!=="seller"&&e.deal_type!=="dual")return null;const I=((D=e.listing)==null?void 0:D.created_at)||e.listing_date;if(!I)return null;const z=e.contract_date?new Date(e.contract_date):new Date;return Ay(z,new Date(I))},[e]),S=l&&!e.scorecard_transaction_id,k=!!e.scorecard_transaction_id,M=I=>I?new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(I):null;return r.jsx(Ze,{className:Bt("cursor-pointer transition-all duration-200 hover:shadow-md hover:border-primary/30 group",n&&"opacity-50 rotate-2 shadow-xl",y&&"border-red-200 bg-red-50/30",S&&"border-amber-300 bg-amber-50/30 dark:bg-amber-950/20"),onClick:t,children:r.jsxs(et,{className:"p-3 space-y-2.5",children:[r.jsxs("div",{className:"flex items-start justify-between gap-2",children:[r.jsx("div",{className:"flex-1 min-w-0",children:r.jsx("h4",{className:"font-medium text-sm leading-tight line-clamp-2 group-hover:text-primary transition-colors",children:e.deal_name})}),r.jsx(Pt,{variant:"outline",className:Bt("text-[10px] px-1.5 py-0 shrink-0",u.color),children:u.label})]}),e.contact&&r.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[r.jsx(Qs,{className:"h-5 w-5",children:r.jsxs(Js,{className:"text-[10px] bg-primary/10 text-primary",children:[(P=e.contact.first_name)==null?void 0:P[0],(T=e.contact.last_name)==null?void 0:T[0]]})}),r.jsxs("span",{className:"truncate",children:[e.contact.first_name," ",e.contact.last_name]})]}),e.listing&&r.jsxs("div",{className:"flex items-center gap-1.5 text-xs",children:[r.jsx(mf,{className:"h-3 w-3 text-primary shrink-0"}),r.jsx("span",{className:"text-primary truncate",children:"Linked to Listing Exchange"})]}),S&&r.jsxs("div",{className:"flex items-center gap-1.5 text-xs bg-amber-100 dark:bg-amber-900/30 text-amber-700 dark:text-amber-400 px-2 py-1 rounded",children:[r.jsx(ro,{className:"h-3 w-3 shrink-0"}),r.jsx("span",{className:"truncate font-medium",children:"Add to Scorecard"})]}),k&&l&&r.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-green-600 dark:text-green-400",children:[r.jsx(so,{className:"h-3 w-3 shrink-0"}),r.jsx("span",{className:"truncate",children:"Synced to Scorecard"})]}),b!==null&&r.jsxs("div",{className:"flex items-center gap-1.5 text-xs",children:[r.jsx(tA,{className:"h-3 w-3 text-muted-foreground shrink-0"}),r.jsxs("span",{className:Bt("font-medium",b>90?"text-red-600":b>60?"text-amber-600":"text-muted-foreground"),children:[b," DOM"]}),e.contract_date&&r.jsx("span",{className:"text-muted-foreground",children:"(final)"})]}),!e.listing&&(e.property_address||e.city)&&r.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[r.jsx(xa,{className:"h-3 w-3 shrink-0"}),r.jsx("span",{className:"truncate",children:e.property_address||`${e.city}, ${e.state}`})]}),e.expected_price&&r.jsxs("div",{className:"flex items-center gap-1.5 text-xs",children:[r.jsx(Rd,{className:"h-3 w-3 text-emerald-500 shrink-0"}),r.jsx("span",{className:"font-semibold text-foreground",children:M(e.expected_price)}),e.expected_commission&&r.jsxs("span",{className:"text-muted-foreground",children:["• ",M(e.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:Bt("flex items-center gap-1 px-1.5 py-0.5 rounded text-[10px]",p.color),children:[r.jsx("div",{className:Bt("w-1.5 h-1.5 rounded-full",p.dot)}),r.jsx("span",{className:"capitalize",children:e.priority})]}),r.jsxs("span",{className:"text-[10px] text-muted-foreground",children:[e.probability,"%"]})]}),o&&i&&s&&a?r.jsx(vVe,{stages:s,currentStageId:e.stage_id||"",onStageSelect:(I,z)=>a(e.id,I,z)}):e.target_close_date?r.jsxs("div",{className:Bt("flex items-center gap-1 text-[10px]",y&&"text-red-600",_&&!y&&"text-amber-600",!y&&!_&&"text-muted-foreground"),children:[y?r.jsx(yl,{className:"h-3 w-3"}):r.jsx(Ss,{className:"h-3 w-3"}),r.jsx("span",{children:y?`${Math.abs(x)}d overdue`:_?`${x}d left`:on(new Date(e.target_close_date),"MMM d")})]}):null]})]})})}function uQt({stage:e,deals:t,onDealClick:n,onAddDeal:s,onDragStart:a,onDragOver:o,onDrop:l,isDragOver:i,isWonStage:u=!1}){const p=E.useRef(null),x=t.reduce((S,k)=>S+(k.expected_price||0),0),y=t.reduce((S,k)=>S+(k.expected_commission||0),0),_=S=>S>=1e6?`$${(S/1e6).toFixed(1)}M`:S>=1e3?`$${(S/1e3).toFixed(0)}K`:`$${S.toFixed(0)}`,b=e.icon&&SIe[e.icon]||Qu;return r.jsxs("div",{ref:p,className:Bt("flex flex-col h-full min-w-[280px] max-w-[320px] bg-muted/30 rounded-xl border border-border/50 transition-all duration-200",i&&"border-primary/50 bg-primary/5 ring-2 ring-primary/20"),onDragOver:S=>o(S,e.id),onDrop:S=>l(S,e.id),children:[r.jsxs("div",{className:"p-3 border-b border-border/50 shrink-0",style:{borderTopColor:e.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:`${e.color}20`},children:r.jsx(b,{className:"h-4 w-4",style:{color:e.color}})}),r.jsx("div",{children:r.jsx("h3",{className:"font-semibold text-sm",children:e.name})})]}),r.jsx(Pt,{variant:"secondary",className:"text-xs font-medium px-2",children:t.length})]}),x>0&&r.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[r.jsx("span",{className:"font-medium text-foreground",children:_(x)}),r.jsx("span",{children:"•"}),r.jsxs("span",{children:[_(y)," GCI"]})]})]}),r.jsx(Bo,{className:"flex-1 p-2",children:r.jsxs("div",{className:"space-y-2",children:[t.map(S=>r.jsx("div",{draggable:!0,onDragStart:k=>{k.dataTransfer.effectAllowed="move",a(S.id,e.id)},children:r.jsx(_Ve,{deal:S,onClick:()=>n(S),isWonStage:u})},S.id)),t.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(e.id),children:[r.jsx(bn,{className:"h-4 w-4 mr-2"}),"Add Deal"]})})]})}function hQt({stats:e,isLoading:t}){const n=a=>a>=1e6?`$${(a/1e6).toFixed(1)}M`:a>=1e3?`$${(a/1e3).toFixed(0)}K`:`$${a.toLocaleString()}`,s=[{label:"Active Deals",value:(e==null?void 0:e.activeDeals)||0,icon:my,color:"text-blue-500",bgColor:"bg-blue-500/10"},{label:"Pipeline Value",value:n((e==null?void 0:e.pipelineValue)||0),icon:_c,color:"text-purple-500",bgColor:"bg-purple-500/10"},{label:"Expected GCI",value:n((e==null?void 0:e.expectedCommission)||0),icon:Rd,color:"text-emerald-500",bgColor:"bg-emerald-500/10"},{label:"Won Deals",value:(e==null?void 0:e.wonDeals)||0,icon:ro,color:"text-amber-500",bgColor:"bg-amber-500/10"}];return t?r.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:[1,2,3,4].map(a=>r.jsx(Ze,{className:"animate-pulse",children:r.jsx(et,{className:"p-4",children:r.jsx("div",{className:"h-10 bg-muted rounded"})})},a))}):r.jsx("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-3",children:s.map(a=>r.jsx(Ze,{className:"border-border/50 hover:shadow-sm transition-shadow",children:r.jsx(et,{className:"p-4",children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:Bt("p-2 rounded-lg",a.bgColor),children:r.jsx(a.icon,{className:Bt("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 fQt=[{value:"buyer",label:"Buyer"},{value:"seller",label:"Seller"},{value:"dual",label:"Dual Agency"},{value:"referral",label:"Referral"},{value:"lease",label:"Lease"}],pQt=[{value:"low",label:"Low"},{value:"medium",label:"Medium"},{value:"high",label:"High"},{value:"urgent",label:"Urgent"}];function mQt({open:e,onOpenChange:t,deal:n,defaultStageId:s}){const{data:a}=ave(),{data:o}=jp(),{data:l}=NRe(),i=mVe(),u=gVe(),[p,x]=E.useState(""),[y,_]=E.useState(!1),b=(l==null?void 0:l.filter(z=>((n==null?void 0:n.listing_id)===z.id,!0)))||[],[S,k]=E.useState({deal_name:"",deal_type:"buyer",stage_id:"",contact_id:"",listing_id:"",property_address:"",city:"",state:"",zip_code:"",expected_price:"",commission_percentage:"3",target_close_date:void 0,contract_date:void 0,listing_date:void 0,priority:"medium",probability:"50",notes:""});E.useEffect(()=>{var z,D,U;e&&(n?(k({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:((D=n.commission_percentage)==null?void 0:D.toString())||"3",target_close_date:n.target_close_date?new Date(n.target_close_date):void 0,contract_date:n.contract_date?new Date(n.contract_date):void 0,listing_date:n.listing_date?new Date(n.listing_date):void 0,priority:n.priority,probability:n.probability.toString(),notes:n.notes||""}),n.contact&&x(`${n.contact.first_name} ${n.contact.last_name}`)):(k({deal_name:"",deal_type:"buyer",stage_id:s||((U=a==null?void 0:a[0])==null?void 0:U.id)||"",contact_id:"",listing_id:"",property_address:"",city:"",state:"",zip_code:"",expected_price:"",commission_percentage:"3",target_close_date:void 0,contract_date:void 0,listing_date:void 0,priority:"medium",probability:"50",notes:""}),x("")))},[e,n,s,a]);const M=o==null?void 0:o.filter(z=>{var U,V,W;const D=p.toLowerCase();return((U=z.first_name)==null?void 0:U.toLowerCase().includes(D))||((V=z.last_name)==null?void 0:V.toLowerCase().includes(D))||((W=z.email)==null?void 0:W.toLowerCase().includes(D))}).slice(0,5),P=()=>{const z=parseFloat(S.expected_price)||0,D=parseFloat(S.commission_percentage)||0;return z*(D/100)},T=async z=>{var D,U,V;if(z.preventDefault(),!S.deal_name.trim()){Ie.error("Please enter a deal name");return}try{const W={deal_name:S.deal_name,deal_type:S.deal_type,stage_id:S.stage_id||null,contact_id:S.contact_id||null,listing_id:S.listing_id||null,property_address:S.property_address||null,city:S.city||null,state:S.state||null,zip_code:S.zip_code||null,expected_price:S.expected_price?parseFloat(S.expected_price):null,expected_commission:P()||null,commission_percentage:S.commission_percentage?parseFloat(S.commission_percentage):3,target_close_date:((D=S.target_close_date)==null?void 0:D.toISOString().split("T")[0])||null,contract_date:((U=S.contract_date)==null?void 0:U.toISOString().split("T")[0])||null,listing_date:((V=S.listing_date)==null?void 0:V.toISOString().split("T")[0])||null,priority:S.priority,probability:parseInt(S.probability)||50,notes:S.notes||null};n?(await u.mutateAsync({id:n.id,...W}),Ie.success("Deal updated successfully")):(await i.mutateAsync(W),Ie.success("Deal created successfully")),t(!1)}catch{Ie.error("Failed to save deal")}},I=i.isPending||u.isPending;return r.jsx(Or,{open:e,onOpenChange:t,children:r.jsxs(Ir,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsxs($r,{children:[r.jsx(Fr,{children:n?"Edit Deal":"Add New Deal"}),r.jsx(Zn,{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($e,{htmlFor:"deal_name",children:"Deal Name *"}),r.jsx(dt,{id:"deal_name",value:S.deal_name,onChange:z=>k(D=>({...D,deal_name:z.target.value})),placeholder:"e.g., Smith Family - 123 Main St"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{children:"Deal Type"}),r.jsxs(mn,{value:S.deal_type,onValueChange:z=>k(D=>({...D,deal_type:z})),children:[r.jsx(fn,{children:r.jsx(yn,{})}),r.jsx(pn,{children:fQt.map(z=>r.jsx(qt,{value:z.value,children:z.label},z.value))})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{children:"Stage"}),r.jsxs(mn,{value:S.stage_id,onValueChange:z=>k(D=>({...D,stage_id:z})),children:[r.jsx(fn,{children:r.jsx(yn,{placeholder:"Select stage"})}),r.jsx(pn,{children:a==null?void 0:a.map(z=>r.jsx(qt,{value:z.id,children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:"w-2 h-2 rounded-full",style:{backgroundColor:z.color}}),z.name]})},z.id))})]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{children:"Link to Contact"}),r.jsxs("div",{className:"relative",children:[r.jsx(Sa,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),r.jsx(dt,{value:p,onChange:z=>{x(z.target.value),_(!0),z.target.value||k(D=>({...D,contact_id:""}))},onFocus:()=>_(!0),placeholder:"Search contacts...",className:"pl-9"}),y&&p&&M&&M.length>0&&r.jsx("div",{className:"absolute z-10 w-full mt-1 bg-background border rounded-lg shadow-lg max-h-48 overflow-y-auto",children:M.map(z=>r.jsxs("button",{type:"button",className:"w-full px-3 py-2 text-left hover:bg-muted flex items-center gap-2",onClick:()=>{k(D=>({...D,contact_id:z.id})),x(`${z.first_name} ${z.last_name}`),_(!1)},children:[r.jsx(ic,{className:"h-4 w-4 text-muted-foreground"}),r.jsxs("span",{children:[z.first_name," ",z.last_name]}),z.email&&r.jsx("span",{className:"text-xs text-muted-foreground ml-auto",children:z.email})]},z.id))})]})]}),b.length>0&&r.jsxs("div",{className:"space-y-2",children:[r.jsxs($e,{className:"flex items-center gap-2",children:[r.jsx(mf,{className:"h-4 w-4"}),"Link to Listing Exchange"]}),r.jsxs(mn,{value:S.listing_id,onValueChange:z=>{const D=b.find(U=>U.id===z);k(D?U=>{var V;return{...U,listing_id:z,deal_type:"seller",property_address:D.property_address||U.property_address,city:D.city||U.city,state:D.state||U.state,expected_price:((V=D.price)==null?void 0:V.toString())||U.expected_price}}:U=>({...U,listing_id:z}))},children:[r.jsx(fn,{children:r.jsx(yn,{placeholder:"Select a listing to sync status..."})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"",children:"None"}),b.map(z=>r.jsx(qt,{value:z.id,children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("span",{children:z.property_address||`${z.city}, ${z.state}`}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:["$",(z.price/1e3).toFixed(0),"K"]})]})},z.id))]})]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Status changes will sync automatically between the deal and listing."})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsx("h4",{className:"font-medium text-sm",children:"Property Details"}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"col-span-2 space-y-2",children:[r.jsx($e,{htmlFor:"property_address",children:"Address"}),r.jsx(dt,{id:"property_address",value:S.property_address,onChange:z=>k(D=>({...D,property_address:z.target.value})),placeholder:"123 Main Street"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{htmlFor:"city",children:"City"}),r.jsx(dt,{id:"city",value:S.city,onChange:z=>k(D=>({...D,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($e,{htmlFor:"state",children:"State"}),r.jsx(dt,{id:"state",value:S.state,onChange:z=>k(D=>({...D,state:z.target.value})),maxLength:2,placeholder:"TX"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{htmlFor:"zip_code",children:"ZIP"}),r.jsx(dt,{id:"zip_code",value:S.zip_code,onChange:z=>k(D=>({...D,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($e,{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:S.expected_price,onChange:z=>k(D=>({...D,expected_price:z.target.value})),className:"pl-7",placeholder:"500000"})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{htmlFor:"commission_percentage",children:"Commission %"}),r.jsxs("div",{className:"relative",children:[r.jsx(dt,{id:"commission_percentage",type:"number",step:"0.1",value:S.commission_percentage,onChange:z=>k(D=>({...D,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($e,{children:"Expected GCI"}),r.jsx(dt,{value:P()?`$${P().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($e,{children:"Target Close Date"}),r.jsxs(Vc,{children:[r.jsx(Hc,{asChild:!0,children:r.jsxs(ee,{variant:"outline",className:Bt("w-full justify-start text-left font-normal",!S.target_close_date&&"text-muted-foreground"),children:[r.jsx(Ss,{className:"mr-2 h-4 w-4"}),S.target_close_date?on(S.target_close_date,"PPP"):"Pick a date"]})}),r.jsx(Mc,{className:"w-auto p-0",align:"start",children:r.jsx(Pm,{mode:"single",selected:S.target_close_date,onSelect:z=>k(D=>({...D,target_close_date:z})),initialFocus:!0,className:"pointer-events-auto"})})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{children:"Contract Date"}),r.jsxs(Vc,{children:[r.jsx(Hc,{asChild:!0,children:r.jsxs(ee,{variant:"outline",className:Bt("w-full justify-start text-left font-normal",!S.contract_date&&"text-muted-foreground"),children:[r.jsx(Ss,{className:"mr-2 h-4 w-4"}),S.contract_date?on(S.contract_date,"PPP"):"Pick a date"]})}),r.jsx(Mc,{className:"w-auto p-0",align:"start",children:r.jsx(Pm,{mode:"single",selected:S.contract_date,onSelect:z=>k(D=>({...D,contract_date:z})),initialFocus:!0,className:"pointer-events-auto"})})]})]}),(S.deal_type==="seller"||S.deal_type==="dual")&&!S.listing_id&&r.jsxs("div",{className:"space-y-2 col-span-2",children:[r.jsx($e,{children:"Listing Date (for Days on Market)"}),r.jsxs(Vc,{children:[r.jsx(Hc,{asChild:!0,children:r.jsxs(ee,{variant:"outline",className:Bt("w-full justify-start text-left font-normal",!S.listing_date&&"text-muted-foreground"),children:[r.jsx(Ss,{className:"mr-2 h-4 w-4"}),S.listing_date?on(S.listing_date,"PPP"):"Pick a date"]})}),r.jsx(Mc,{className:"w-auto p-0",align:"start",children:r.jsx(Pm,{mode:"single",selected:S.listing_date,onSelect:z=>k(D=>({...D,listing_date:z})),initialFocus:!0,className:"pointer-events-auto"})})]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Used to calculate Days on Market. Auto-filled for linked listings."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{children:"Priority"}),r.jsxs(mn,{value:S.priority,onValueChange:z=>k(D=>({...D,priority:z})),children:[r.jsx(fn,{children:r.jsx(yn,{})}),r.jsx(pn,{children:pQt.map(z=>r.jsx(qt,{value:z.value,children:z.label},z.value))})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{children:"Win Probability"}),r.jsxs("div",{className:"relative",children:[r.jsx(dt,{type:"number",min:"0",max:"100",value:S.probability,onChange:z=>k(D=>({...D,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($e,{htmlFor:"notes",children:"Notes"}),r.jsx(Jn,{id:"notes",value:S.notes,onChange:z=>k(D=>({...D,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:()=>t(!1),children:"Cancel"}),r.jsxs(ee,{type:"submit",disabled:I,children:[I&&r.jsx(Zr,{className:"h-4 w-4 mr-2 animate-spin"}),n?"Update Deal":"Create Deal"]})]})]})]})})}const gQt={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"}},xQt={note:zo,call:Ti,email:Ns,meeting:Ss,stage_change:As,task_completed:so,document:xa,system:Ya};function yQt({deal:e,open:t,onOpenChange:n,onEdit:s,onAddToScorecard:a,isWonStage:o}){var ge,ie;const{data:l,isLoading:i}=OXt((e==null?void 0:e.id)||""),{data:u,isLoading:p}=RXt((e==null?void 0:e.id)||""),x=DXt(),y=zXt(),_=FXt(),b=LXt(),[S,k]=E.useState(""),[M,P]=E.useState(""),[T,I]=E.useState(!1);if(!e)return null;const z=gQt[e.deal_type],D=(()=>{var fe;if(e.deal_type!=="seller"&&e.deal_type!=="dual")return null;const pe=((fe=e.listing)==null?void 0:fe.created_at)||e.listing_date;if(!pe)return null;const se=e.contract_date?new Date(e.contract_date):new Date;return Ay(se,new Date(pe))})(),U=pe=>pe?new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(pe):"-",V=async()=>{if(S.trim())try{await x.mutateAsync({deal_id:e.id,activity_type:"note",title:"Note added",description:S}),k(""),Ie.success("Note added")}catch{Ie.error("Failed to add note")}},W=async()=>{if(M.trim())try{await y.mutateAsync({deal_id:e.id,title:M,sort_order:((u==null?void 0:u.length)||0)+1}),P(""),Ie.success("Task added")}catch{Ie.error("Failed to add task")}},G=async(pe,se)=>{try{await _.mutateAsync({id:pe,is_completed:se,deal_id:e.id})}catch{Ie.error("Failed to update task")}},J=async()=>{try{await b.mutateAsync(e.id),Ie.success("Deal deleted"),n(!1)}catch{Ie.error("Failed to delete deal")}},ne=(u==null?void 0:u.filter(pe=>pe.is_completed).length)||0,oe=(u==null?void 0:u.length)||0;return r.jsxs(r.Fragment,{children:[r.jsx(Vse,{open:t,onOpenChange:n,children:r.jsxs(iP,{className:"w-full sm:max-w-xl p-0 flex flex-col",children:[r.jsx(Hse,{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(Pt,{variant:"outline",className:Bt("text-xs",z.color),children:z.label}),r.jsxs(Pt,{variant:"secondary",className:"text-xs capitalize",children:[e.priority," priority"]})]}),r.jsx(Wse,{className:"text-xl",children:e.deal_name})]}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(ee,{variant:"outline",size:"icon",onClick:()=>s(e),children:r.jsx(gc,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"outline",size:"icon",className:"text-destructive hover:bg-destructive/10",onClick:()=>I(!0),children:r.jsx(Bn,{className:"h-4 w-4"})})]})]})}),r.jsx(Bo,{className:"flex-1",children:r.jsxs("div",{className:"p-6 space-y-6",children:[e.contact&&r.jsxs("div",{className:"flex items-center gap-3 p-3 bg-muted/50 rounded-lg",children:[r.jsx(Qs,{className:"h-10 w-10",children:r.jsxs(Js,{className:"bg-primary/10 text-primary",children:[(ge=e.contact.first_name)==null?void 0:ge[0],(ie=e.contact.last_name)==null?void 0:ie[0]]})}),r.jsxs("div",{className:"flex-1",children:[r.jsxs("p",{className:"font-medium",children:[e.contact.first_name," ",e.contact.last_name]}),e.contact.email&&r.jsx("p",{className:"text-sm text-muted-foreground",children:e.contact.email})]}),r.jsxs("div",{className:"flex gap-2",children:[e.contact.phone&&r.jsx(ee,{variant:"outline",size:"icon",asChild:!0,children:r.jsx("a",{href:`tel:${e.contact.phone}`,children:r.jsx(Ti,{className:"h-4 w-4"})})}),e.contact.email&&r.jsx(ee,{variant:"outline",size:"icon",asChild:!0,children:r.jsx("a",{href:`mailto:${e.contact.email}`,children:r.jsx(Ns,{className:"h-4 w-4"})})})]})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[(e.property_address||e.city)&&r.jsxs("div",{className:"col-span-2 flex items-start gap-2 text-sm",children:[r.jsx(xa,{className:"h-4 w-4 text-muted-foreground mt-0.5"}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:e.property_address||"Address TBD"}),r.jsx("p",{className:"text-muted-foreground",children:[e.city,e.state,e.zip_code].filter(Boolean).join(", ")})]})]}),r.jsxs("div",{className:"bg-muted/50 rounded-lg p-3",children:[r.jsx("p",{className:"text-xs text-muted-foreground mb-1",children:"Expected Price"}),r.jsx("p",{className:"text-lg font-bold",children:U(e.expected_price)})]}),r.jsxs("div",{className:"bg-emerald-500/10 rounded-lg p-3",children:[r.jsx("p",{className:"text-xs text-muted-foreground mb-1",children:"Expected GCI"}),r.jsx("p",{className:"text-lg font-bold text-emerald-600",children:U(e.expected_commission)})]}),o&&!e.scorecard_transaction_id&&a&&r.jsxs(ee,{onClick:()=>a(e),className:"w-full bg-green-600 hover:bg-green-700",children:[r.jsx(ro,{className:"h-4 w-4 mr-2"}),"Add to Scorecard"]}),e.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(so,{className:"h-4 w-4 text-green-600"}),r.jsx("span",{children:"Synced to Scorecard"})]}),D!==null&&r.jsxs("div",{className:"bg-muted/50 rounded-lg p-3 col-span-2",children:[r.jsx("p",{className:"text-xs text-muted-foreground mb-1",children:"Days on Market"}),r.jsxs("p",{className:Bt("text-lg font-bold",D>90?"text-red-600":D>60?"text-amber-600":"text-foreground"),children:[D," ",e.contract_date?"(final)":"days"]})]}),e.target_close_date&&r.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[r.jsx(Ss,{className:"h-4 w-4 text-muted-foreground"}),r.jsxs("span",{children:["Close: ",on(new Date(e.target_close_date),"MMM d, yyyy")]})]}),r.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[r.jsx(Rd,{className:"h-4 w-4 text-muted-foreground"}),r.jsxs("span",{children:[e.probability,"% probability"]})]})]}),e.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:e.notes})]}),r.jsxs(Ai,{defaultValue:"tasks",className:"w-full",children:[r.jsxs(vi,{className:"w-full grid grid-cols-2",children:[r.jsxs(sn,{value:"tasks",className:"gap-1",children:[r.jsx(so,{className:"h-4 w-4"}),"Tasks ",oe>0&&`(${ne}/${oe})`]}),r.jsxs(sn,{value:"activity",className:"gap-1",children:[r.jsx(Ya,{className:"h-4 w-4"}),"Activity"]})]}),r.jsxs(Mn,{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:M,onChange:pe=>P(pe.target.value),onKeyDown:pe=>pe.key==="Enter"&&W()}),r.jsx(ee,{onClick:W,disabled:!M.trim(),children:r.jsx(bn,{className:"h-4 w-4"})})]}),r.jsxs("div",{className:"space-y-2",children:[u==null?void 0:u.map(pe=>r.jsxs("div",{className:Bt("flex items-center gap-3 p-3 rounded-lg border transition-colors",pe.is_completed?"bg-muted/50 border-border":"bg-background"),children:[r.jsx(Bl,{checked:pe.is_completed,onCheckedChange:se=>G(pe.id,!!se)}),r.jsx("span",{className:Bt("flex-1 text-sm",pe.is_completed&&"line-through text-muted-foreground"),children:pe.title}),pe.due_date&&r.jsx("span",{className:"text-xs text-muted-foreground",children:on(new Date(pe.due_date),"MMM d")})]},pe.id)),(u==null?void 0:u.length)===0&&r.jsx("p",{className:"text-center text-muted-foreground text-sm py-4",children:"No tasks yet. Add one above!"})]})]}),r.jsxs(Mn,{value:"activity",className:"mt-4 space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx(Jn,{placeholder:"Add a note...",value:S,onChange:pe=>k(pe.target.value),rows:2}),r.jsxs(ee,{onClick:V,disabled:!S.trim(),size:"sm",className:"w-full",children:[r.jsx(lo,{className:"h-4 w-4 mr-2"}),"Add Note"]})]}),r.jsxs("div",{className:"space-y-3",children:[l==null?void 0:l.map(pe=>{const se=xQt[pe.activity_type]||Ya;return r.jsxs("div",{className:"flex gap-3",children:[r.jsx("div",{className:"w-8 h-8 rounded-full bg-muted flex items-center justify-center shrink-0",children:r.jsx(se,{className:"h-4 w-4 text-muted-foreground"})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"text-sm font-medium",children:pe.title}),pe.description&&r.jsx("p",{className:"text-sm text-muted-foreground mt-0.5",children:pe.description}),r.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:bu(new Date(pe.created_at),{addSuffix:!0})})]})]},pe.id)}),(l==null?void 0:l.length)===0&&r.jsx("p",{className:"text-center text-muted-foreground text-sm py-4",children:"No activity yet"})]})]})]})]})})]})}),r.jsx(Id,{open:T,onOpenChange:I,children:r.jsxs(id,{children:[r.jsxs(od,{children:[r.jsx(cd,{children:"Delete Deal?"}),r.jsxs(dd,{children:['This will permanently delete "',e.deal_name,'" and all associated data. This action cannot be undone.']})]}),r.jsxs(ld,{children:[r.jsx(ud,{children:"Cancel"}),r.jsx(Bc,{onClick:J,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})})]})}function vQt({open:e,onOpenChange:t,deal:n,onComplete:s}){const a=uae(),o=gVe(),{data:l}=dae(),{data:i}=qm(),[u,p]=E.useState({property_address:"",city:"",state:"",zip:"",transaction_type:"buyer",close_date:on(new Date,"yyyy-MM-dd"),sale_price:0,commission_amount:0,lead_source_id:"",client_type_id:"",notes:""});E.useEffect(()=>{if(n&&e){const _=n.deal_type==="seller"?"seller":"buyer",b=n.expected_price||0,S=n.commission_percentage||3,k=n.expected_commission||b*S/100;p({property_address:n.property_address||n.deal_name||"",city:n.city||"",state:n.state||"",zip:n.zip_code||"",transaction_type:_,close_date:n.actual_close_date||n.target_close_date||on(new Date,"yyyy-MM-dd"),sale_price:b,commission_amount:k,lead_source_id:"",client_type_id:"",notes:n.notes||""})}},[n,e]);const x=async _=>{if(_.preventDefault(),!!n)try{const b=await a.mutateAsync({property_address:u.property_address,city:u.city||null,state:u.state||null,zip:u.zip||null,transaction_type:u.transaction_type,close_date:u.close_date,sale_price:u.sale_price,commission_amount:u.commission_amount||null,lead_source_id:u.lead_source_id||null,client_type_id:u.client_type_id||null,contact_id:n.contact_id||null,notes:u.notes||null,is_win:!0});await o.mutateAsync({id:n.id,scorecard_transaction_id:b.id,actual_close_date:u.close_date}),Ie.success("Deal added to Scorecard! 🎉"),t(!1),s==null||s()}catch(b){console.error("Error syncing to scorecard:",b),Ie.error("Failed to add to scorecard")}},y=_=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:0,maximumFractionDigits:0}).format(_);return r.jsx(Or,{open:e,onOpenChange:t,children:r.jsxs(Ir,{className:"sm:max-w-[550px] max-h-[90vh] overflow-y-auto",children:[r.jsxs($r,{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(ro,{className:"h-6 w-6 text-green-600 dark:text-green-400"})}),r.jsx(Fr,{className:"text-center text-xl",children:"Congratulations on Closing! 🎉"}),r.jsx(Zn,{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($e,{htmlFor:"property_address",className:"flex items-center gap-2",children:[r.jsx(xa,{className:"h-4 w-4 text-muted-foreground"}),"Property Address *"]}),r.jsx(dt,{id:"property_address",value:u.property_address,onChange:_=>p(b=>({...b,property_address:_.target.value})),placeholder:"123 Main St",required:!0})]}),r.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{htmlFor:"city",children:"City"}),r.jsx(dt,{id:"city",value:u.city,onChange:_=>p(b=>({...b,city:_.target.value})),placeholder:"City"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{htmlFor:"state",children:"State"}),r.jsx(dt,{id:"state",value:u.state,onChange:_=>p(b=>({...b,state:_.target.value})),placeholder:"TX",maxLength:2})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{htmlFor:"zip",children:"Zip"}),r.jsx(dt,{id:"zip",value:u.zip,onChange:_=>p(b=>({...b,zip:_.target.value})),placeholder:"75001"})]})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{children:"Transaction Type *"}),r.jsxs(mn,{value:u.transaction_type,onValueChange:_=>p(b=>({...b,transaction_type:_})),children:[r.jsx(fn,{children:r.jsx(yn,{})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"buyer",children:"Buyer"}),r.jsx(qt,{value:"seller",children:"Seller"})]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs($e,{htmlFor:"close_date",className:"flex items-center gap-2",children:[r.jsx(Ss,{className:"h-4 w-4 text-muted-foreground"}),"Close Date *"]}),r.jsx(dt,{id:"close_date",type:"date",value:u.close_date,onChange:_=>p(b=>({...b,close_date:_.target.value})),required:!0})]})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsxs($e,{htmlFor:"sale_price",className:"flex items-center gap-2",children:[r.jsx(Rd,{className:"h-4 w-4 text-muted-foreground"}),"Sale Price *"]}),r.jsx(dt,{id:"sale_price",type:"number",value:u.sale_price||"",onChange:_=>p(b=>({...b,sale_price:Number(_.target.value)})),placeholder:"450000",required:!0,min:0}),u.sale_price>0&&r.jsx("p",{className:"text-xs text-muted-foreground",children:y(u.sale_price)})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsxs($e,{htmlFor:"commission_amount",className:"flex items-center gap-2",children:[r.jsx(IS,{className:"h-4 w-4 text-muted-foreground"}),"GCI (Commission)"]}),r.jsx(dt,{id:"commission_amount",type:"number",value:u.commission_amount||"",onChange:_=>p(b=>({...b,commission_amount:Number(_.target.value)})),placeholder:"13500",min:0}),u.commission_amount>0&&r.jsx("p",{className:"text-xs text-muted-foreground",children:y(u.commission_amount)})]})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{children:"Lead Source"}),r.jsxs(mn,{value:u.lead_source_id,onValueChange:_=>p(b=>({...b,lead_source_id:_})),children:[r.jsx(fn,{children:r.jsx(yn,{placeholder:"Select source"})}),r.jsx(pn,{children:l==null?void 0:l.map(_=>r.jsx(qt,{value:_.id,children:_.name},_.id))})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{children:"Client Type"}),r.jsxs(mn,{value:u.client_type_id,onValueChange:_=>p(b=>({...b,client_type_id:_})),children:[r.jsx(fn,{children:r.jsx(yn,{placeholder:"Select type"})}),r.jsx(pn,{children:i==null?void 0:i.map(_=>r.jsx(qt,{value:_.id,children:_.name},_.id))})]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{htmlFor:"notes",children:"Notes"}),r.jsx(Jn,{id:"notes",value:u.notes,onChange:_=>p(b=>({...b,notes:_.target.value})),placeholder:"Any additional notes about this transaction...",rows:2})]}),r.jsxs(Bs,{className:"gap-2 sm:gap-0 pt-4",children:[r.jsx(ee,{type:"button",variant:"outline",onClick:()=>t(!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(Vo,{className:"ml-2 h-4 w-4"})]})})]})]})]})})}const _Qt={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"}},wTe={urgent:0,high:1,medium:2,low:3};function bQt({deals:e,stages:t,onDealClick:n,onStageChange:s}){const[a,o]=E.useState("target_close_date"),[l,i]=E.useState("asc"),u=b=>{a===b?i(S=>S==="asc"?"desc":"asc"):(o(b),i("asc"))},p=E.useMemo(()=>[...e].sort((b,S)=>{var M,P;let k=0;switch(a){case"deal_name":k=b.deal_name.localeCompare(S.deal_name);break;case"stage":{const T=((M=t.find(z=>z.id===b.stage_id))==null?void 0:M.sort_order)||0,I=((P=t.find(z=>z.id===S.stage_id))==null?void 0:P.sort_order)||0;k=T-I;break}case"expected_price":k=(b.expected_price||0)-(S.expected_price||0);break;case"expected_commission":k=(b.expected_commission||0)-(S.expected_commission||0);break;case"target_close_date":{const T=b.target_close_date?new Date(b.target_close_date).getTime():1/0,I=S.target_close_date?new Date(S.target_close_date).getTime():1/0;k=T-I;break}case"priority":k=wTe[b.priority]-wTe[S.priority];break}return l==="asc"?k:-k}),[e,t,a,l]),x=b=>b?new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(b):"—",y=b=>b?t.find(S=>S.id===b):null,_=({field:b,children:S})=>r.jsxs(ee,{variant:"ghost",size:"sm",className:"h-8 -ml-3 font-medium",onClick:()=>u(b),children:[S,a===b?l==="asc"?r.jsx(cp,{className:"ml-2 h-4 w-4"}):r.jsx(ay,{className:"ml-2 h-4 w-4"}):r.jsx(Pg,{className:"ml-2 h-4 w-4 opacity-50"})]});return e.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(Ks,{children:[r.jsx(Zs,{children:r.jsxs(Mr,{className:"bg-muted/50",children:[r.jsx(It,{className:"w-[250px]",children:r.jsx(_,{field:"deal_name",children:"Deal Name"})}),r.jsx(It,{className:"w-[150px]",children:r.jsx(_,{field:"stage",children:"Stage"})}),r.jsx(It,{className:"w-[100px]",children:"Type"}),r.jsx(It,{className:"w-[120px]",children:r.jsx(_,{field:"expected_price",children:"Price"})}),r.jsx(It,{className:"w-[120px]",children:r.jsx(_,{field:"expected_commission",children:"GCI"})}),r.jsx(It,{className:"w-[130px]",children:r.jsx(_,{field:"target_close_date",children:"Close Date"})}),r.jsx(It,{className:"w-[100px]",children:r.jsx(_,{field:"priority",children:"Priority"})})]})}),r.jsx(Ys,{children:p.map(b=>{y(b.stage_id);const S=_Qt[b.deal_type],k=b.target_close_date?Ay(new Date(b.target_close_date),new Date):null,M=k!==null&&k<0,P=k!==null&&k<=7&&k>=0;return r.jsxs(Mr,{className:Bt("cursor-pointer hover:bg-muted/50 transition-colors",M&&"bg-red-50/50"),onClick:()=>n(b),children:[r.jsx(kt,{className:"font-medium",children:r.jsxs("div",{children:[r.jsx("p",{className:"truncate max-w-[230px]",children:b.deal_name}),b.contact&&r.jsxs("p",{className:"text-xs text-muted-foreground truncate",children:[b.contact.first_name," ",b.contact.last_name]})]})}),r.jsx(kt,{onClick:T=>T.stopPropagation(),children:r.jsx(vVe,{stages:t,currentStageId:b.stage_id||"",onStageSelect:(T,I)=>s(b.id,T,I)})}),r.jsx(kt,{children:r.jsx(Pt,{variant:"outline",className:Bt("text-xs",S.color),children:S.label})}),r.jsx(kt,{children:r.jsx("span",{className:"font-medium",children:x(b.expected_price)})}),r.jsx(kt,{children:r.jsx("span",{className:"text-emerald-600",children:x(b.expected_commission)})}),r.jsx(kt,{children:b.target_close_date?r.jsxs("div",{className:Bt("flex items-center gap-1 text-sm",M&&"text-red-600",P&&!M&&"text-amber-600"),children:[M&&r.jsx(yl,{className:"h-3.5 w-3.5"}),r.jsx("span",{children:on(new Date(b.target_close_date),"MMM d, yyyy")})]}):r.jsx("span",{className:"text-muted-foreground",children:"—"})}),r.jsx(kt,{children:r.jsx(Pt,{variant:"outline",className:Bt("text-xs capitalize",b.priority==="urgent"&&"border-red-200 bg-red-50 text-red-700",b.priority==="high"&&"border-orange-200 bg-orange-50 text-orange-700",b.priority==="medium"&&"border-amber-200 bg-amber-50 text-amber-700",b.priority==="low"&&"border-slate-200 bg-slate-50 text-slate-600"),children:b.priority})})]},b.id)})})]})})}function wQt(){var be;const e=z3(),{data:t,isLoading:n}=ave(),{data:s,isLoading:a,refetch:o}=pVe(),{data:l,isLoading:i}=BXt(),u=fVe(),p=PXt(),[x,y]=E.useState("board"),[_,b]=E.useState(!1),[S,k]=E.useState(!1),[M,P]=E.useState(null),[T,I]=E.useState(null),[z,D]=E.useState(null),[U,V]=E.useState(null),[W,G]=E.useState(!1),[J,ne]=E.useState(null);E.useEffect(()=>{!n&&t&&t.length===0&&u.mutate()},[n,t]);const oe=_e=>{P(_e),k(!0)},ge=_e=>{I(_e||null),P(null),b(!0)},ie=_e=>{P(_e),k(!1),b(!0)},pe=(_e,Je)=>{D(_e)},se=(_e,Je)=>{_e.preventDefault(),_e.dataTransfer.dropEffect="move",V(Je)},fe=async(_e,Je)=>{if(_e.preventDefault(),V(null),!z)return;const Te=s==null?void 0:s.find(Ue=>Ue.id===z),De=t==null?void 0:t.find(Ue=>Ue.id===Je);if(!Te||!De||Te.stage_id===Je){D(null);return}try{if(await p.mutateAsync({dealId:z,stageId:Je,stageName:De.name}),Ie.success(`Moved to ${De.name}`),De.is_won_stage&&!Te.scorecard_transaction_id){const Ue={...Te,stage_id:Je};ne(Ue),G(!0)}}catch{Ie.error("Failed to move deal")}D(null)},he=E.useCallback(async(_e,Je,Te)=>{const De=s==null?void 0:s.find(Be=>Be.id===_e),Ue=t==null?void 0:t.find(Be=>Be.id===Je);if(!(!De||!Ue||De.stage_id===Je))try{if(await p.mutateAsync({dealId:_e,stageId:Je,stageName:Te}),Ie.success(`Moved to ${Te}`),Ue.is_won_stage&&!De.scorecard_transaction_id){const Be={...De,stage_id:Je};ne(Be),G(!0)}}catch{Ie.error("Failed to move deal")}},[s,t,p]),ye=_e=>(s==null?void 0:s.filter(Je=>Je.stage_id===_e))||[],Ae=n||a,we=e?"list":x;return r.jsxs(Dr,{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(qo,{className:"h-4 w-4"})}),!e&&r.jsx(YI,{children:r.jsxs("div",{className:"flex bg-muted rounded-lg p-1 gap-0.5",children:[r.jsxs(Ug,{children:[r.jsx(qg,{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(dp,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline text-xs",children:"Board"})]})}),r.jsx(Im,{children:"Kanban board view"})]}),r.jsxs(Ug,{children:[r.jsx(qg,{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(up,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline text-xs",children:"List"})]})}),r.jsx(Im,{children:"Grouped list view"})]}),r.jsxs(Ug,{children:[r.jsx(qg,{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(OS,{className:"h-4 w-4"}),r.jsx("span",{className:"hidden sm:inline text-xs",children:"Table"})]})}),r.jsx(Im,{children:"Sortable table view"})]})]})}),r.jsxs(ee,{onClick:()=>ge(),children:[r.jsx(bn,{className:"h-4 w-4 mr-2"}),"Add Deal"]})]})]}),r.jsx(hQt,{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(_e=>r.jsx("div",{className:"min-w-[280px] max-w-[320px] flex-shrink-0",children:r.jsx(Lr,{className:"h-full rounded-xl"})},_e))}):we==="board"?r.jsxs(Bo,{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:t==null?void 0:t.map(_e=>r.jsx(uQt,{stage:_e,deals:ye(_e.id),onDealClick:oe,onAddDeal:ge,onDragStart:pe,onDragOver:se,onDrop:fe,isDragOver:U===_e.id,isWonStage:_e.is_won_stage},_e.id))}),r.jsx(aye,{orientation:"horizontal"})]}):we==="table"?r.jsx(Bo,{className:"h-full",children:r.jsx(bQt,{deals:s||[],stages:t||[],onDealClick:oe,onStageChange:he})}):r.jsx(Bo,{className:"h-full",children:r.jsxs("div",{className:"space-y-6",children:[t==null?void 0:t.map(_e=>{const Je=ye(_e.id);return Je.length===0?null:r.jsxs("div",{children:[r.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[r.jsx("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:_e.color}}),r.jsx("h3",{className:"font-semibold",children:_e.name}),r.jsxs("span",{className:"text-muted-foreground text-sm",children:["(",Je.length,")"]})]}),r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-3",children:Je.map(Te=>r.jsx(_Ve,{deal:Te,onClick:()=>oe(Te),stages:t,onStageChange:he,showStagePicker:!0,isWonStage:_e.is_won_stage},Te.id))})]},_e.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(dp,{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:()=>ge(),children:[r.jsx(bn,{className:"h-4 w-4 mr-2"}),"Add Your First Deal"]})]})]})})})]}),r.jsx(mQt,{open:_,onOpenChange:b,deal:M,defaultStageId:T}),r.jsx(yQt,{deal:M,open:S,onOpenChange:k,onEdit:ie,isWonStage:M?(be=t==null?void 0:t.find(_e=>_e.id===M.stage_id))==null?void 0:be.is_won_stage:!1,onAddToScorecard:_e=>{ne(_e),G(!0),k(!1)}}),r.jsx(vQt,{open:W,onOpenChange:G,deal:J,onComplete:()=>{o(),ne(null)}})]})}const Xme=[{value:"video_intro",label:"Video Intro",icon:$a,description:"Add an intro video"},{value:"testimonials",label:"Testimonials",icon:uA,description:"Client testimonials carousel"},{value:"specialties",label:"Specialties",icon:zg,description:"Tags for your specialties"},{value:"custom_links",label:"Custom Links",icon:mf,description:"Custom CTA buttons"},{value:"social_media",label:"Social Media",icon:Nc,description:"Links to your social profiles"}],jQt=["First-Time Buyers","Luxury Homes","Investment Properties","Relocation","New Construction","Condos & Townhomes","Waterfront","Commercial","Land & Lots","Senior Living","Military/VA","Short Sales & Foreclosures"],kQt={video_intro:{video_url:""},testimonials:{testimonials:[{name:"",quote:"",role:""}]},specialties:{tags:[]},custom_links:{links:[{label:"",url:""}]},social_media:{platforms:[]}};function bVe({cardId:e}){const{data:t,isLoading:n}=Tct(e),s=Act(),a=Ect(),o=Ict(),[l,i]=E.useState(!1),[u,p]=E.useState(""),[x,y]=E.useState(null);if(n)return r.jsxs("div",{className:"space-y-3",children:[r.jsx(Lr,{className:"h-16 w-full"}),r.jsx(Lr,{className:"h-16 w-full"})]});const _=()=>{u&&s.mutate({card_id:e,block_type:u,sort_order:(t==null?void 0:t.length)||0,config:kQt[u]||{}},{onSuccess:()=>{i(!1),p("")}})},b=T=>{a.mutate({id:T.id,is_visible:!T.is_visible})},S=(T,I)=>{if(!t)return;const z=t.findIndex(V=>V.id===T.id),D=I==="up"?z-1:z+1;if(D<0||D>=t.length)return;const U=t[D];a.mutate({id:T.id,sort_order:U.sort_order}),a.mutate({id:U.id,sort_order:T.sort_order})},k=T=>{confirm("Remove this block from this card?")&&o.mutate(T.id)},M=(T,I)=>{a.mutate({id:T.id,config:I},{onSuccess:()=>y(null)})},P=T=>Xme.find(I=>I.value===T);return r.jsxs("div",{className:"space-y-3",children:[!t||t.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:[t.map((T,I)=>{const z=P(T.block_type),D=(z==null?void 0:z.icon)||zg;return r.jsx(Ze,{className:T.is_visible?"":"opacity-50",children:r.jsx(et,{className:"p-3",children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(dy,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),r.jsx(D,{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:NQt(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:()=>S(T,"up"),disabled:I===0,children:r.jsx(cp,{className:"h-3 w-3"})}),r.jsx(ee,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>S(T,"down"),disabled:I===t.length-1,children:r.jsx(ay,{className:"h-3 w-3"})}),r.jsx(ee,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>b(T),children:T.is_visible?r.jsx(Ko,{className:"h-3 w-3"}):r.jsx($1,{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:()=>k(T),children:r.jsx(Bn,{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(Or,{open:l,onOpenChange:i,children:r.jsxs(Ir,{children:[r.jsx($r,{children:r.jsx(Fr,{children:"Add Block"})}),r.jsx("div",{className:"grid gap-3",children:Xme.map(T=>{const I=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 ${u===T.value?"border-primary bg-primary/5":"border-border hover:bg-muted"}`,children:[r.jsx(I,{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(Bs,{children:[r.jsx(ee,{variant:"outline",onClick:()=>i(!1),children:"Cancel"}),r.jsx(ee,{onClick:_,disabled:!u||s.isPending,children:"Add Block"})]})]})}),x&&r.jsx(SQt,{block:x,onSave:T=>M(x,T),onClose:()=>y(null)})]})}function NQt(e){var n;const t=e.config;switch(e.block_type){case"video_intro":return t.video_url?"Video configured":"No video set";case"testimonials":{const s=((n=t.testimonials)==null?void 0:n.length)||0;return`${s} testimonial${s!==1?"s":""}`}case"specialties":{const s=t.tags||[];return s.length?s.slice(0,3).join(", ")+(s.length>3?"...":""):"No tags"}case"custom_links":{const s=t.links||[];return`${s.length} link${s.length!==1?"s":""}`}case"social_media":{const s=t.platforms||[];return s.length?s.map(a=>a.platform).join(", "):"No platforms"}default:return""}}function SQt({block:e,onSave:t,onClose:n}){const[s,a]=E.useState(e.config),o=Xme.find(l=>l.value===e.block_type);return r.jsx(Or,{open:!0,onOpenChange:n,children:r.jsxs(Ir,{className:"max-w-lg max-h-[80vh] overflow-y-auto",children:[r.jsx($r,{children:r.jsxs(Fr,{children:["Edit ",o==null?void 0:o.label]})}),e.block_type==="video_intro"&&r.jsx(CQt,{config:s,onChange:a,cardId:e.card_id}),e.block_type==="testimonials"&&r.jsx(MQt,{config:s,onChange:a}),e.block_type==="specialties"&&r.jsx(TQt,{config:s,onChange:a}),e.block_type==="custom_links"&&r.jsx(AQt,{config:s,onChange:a}),e.block_type==="social_media"&&r.jsx(EQt,{config:s,onChange:a}),r.jsxs(Bs,{children:[r.jsx(ee,{variant:"outline",onClick:n,children:"Cancel"}),r.jsx(ee,{onClick:()=>t(s),children:"Save"})]})]})})}function CQt({config:e,onChange:t,cardId:n}){var b,S;const[s,a]=E.useState(""),[o,l]=E.useState((b=e.video_url)!=null&&b.includes("youtube")||(S=e.video_url)!=null&&S.includes("youtu.be")?"youtube":"library"),{data:i}=Kt({queryKey:["card-owner",n],queryFn:async()=>{const{data:k}=await Q.from("agent_cards").select("user_id").eq("id",n).single();return k==null?void 0:k.user_id},enabled:!!n}),{data:u,isLoading:p}=Kt({queryKey:["agent-videos-library",i],queryFn:async()=>{const{data:k,error:M}=await Q.from("agent_videos").select("id, title, bunny_video_id, thumbnail_url, playback_url, created_at").eq("owner_user_id",i).eq("is_deleted",!1).eq("status","ready").order("created_at",{ascending:!1});if(M)throw M;return k||[]},enabled:!!i}),x=(u==null?void 0:u.filter(k=>!s||(k.title||"").toLowerCase().includes(s.toLowerCase())))||[],y=e.bunny_video_id,_=k=>{var I;const M=(I=k.playback_url)==null?void 0:I.match(/\/(?:play|embed)\/(\d+)\//),T=`https://iframe.mediadelivery.net/embed/${M?M[1]:"570924"}/${k.bunny_video_id}?autoplay=false&responsive=true`;t({...e,video_url:T,bunny_video_id:k.bunny_video_id,video_source:"library"})};return r.jsx("div",{className:"space-y-4",children:r.jsxs(Ai,{value:o,onValueChange:l,children:[r.jsxs(vi,{className:"w-full",children:[r.jsx(sn,{value:"library",className:"flex-1",children:"Video Library"}),r.jsx(sn,{value:"youtube",className:"flex-1",children:"YouTube URL"})]}),r.jsxs(Mn,{value:"library",className:"space-y-3 mt-3",children:[r.jsxs("div",{className:"relative",children:[r.jsx(Sa,{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:k=>a(k.target.value),className:"pl-9"})]}),r.jsx(Bo,{className:"h-[240px]",children:p?r.jsxs("div",{className:"space-y-2",children:[r.jsx(Lr,{className:"h-14 w-full"}),r.jsx(Lr,{className:"h-14 w-full"})]}):x.length===0?r.jsx("p",{className:"text-sm text-muted-foreground text-center py-8",children:(u==null?void 0:u.length)===0?"No videos in library yet":"No matching videos"}):r.jsx("div",{className:"space-y-1.5 pr-3",children:x.map(k=>r.jsxs("button",{onClick:()=>_(k),className:`w-full flex items-center gap-3 p-2 rounded-lg border text-left transition-colors ${y===k.bunny_video_id?"border-primary bg-primary/5":"border-border hover:bg-muted"}`,children:[k.thumbnail_url?r.jsx("img",{src:k.thumbnail_url,alt:"",className:"h-10 w-16 rounded object-cover flex-shrink-0 bg-muted",onError:M=>{var P;M.currentTarget.style.display="none",(P=M.currentTarget.nextElementSibling)==null||P.classList.remove("hidden")}}):null,r.jsx("div",{className:`h-10 w-16 rounded bg-muted flex items-center justify-center flex-shrink-0 ${k.thumbnail_url?"hidden":""}`,children:r.jsx($a,{className:"h-4 w-4 text-muted-foreground"})}),r.jsx("span",{className:"text-sm font-medium truncate flex-1",children:k.title||"Untitled Video"}),y===k.bunny_video_id&&r.jsx(Ni,{className:"h-4 w-4 text-primary flex-shrink-0"})]},k.id))})})]}),r.jsx(Mn,{value:"youtube",className:"space-y-3 mt-3",children:r.jsxs("div",{children:[r.jsx($e,{children:"YouTube URL"}),r.jsx(dt,{placeholder:"https://www.youtube.com/watch?v=...",value:e.video_source==="youtube"&&e.video_url||"",onChange:k=>t({...e,video_url:k.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 MQt({config:e,onChange:t}){const n=e.testimonials||[],s=(l,i,u)=>{const p=[...n];p[l]={...p[l],[i]:u},t({...e,testimonials:p})},a=()=>t({...e,testimonials:[...n,{name:"",quote:"",role:""}]}),o=l=>t({...e,testimonials:n.filter((i,u)=>u!==l)});return r.jsxs("div",{className:"space-y-4",children:[n.map((l,i)=>r.jsx(Ze,{children:r.jsxs(et,{className:"p-3 space-y-2",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs($e,{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(Bn,{className:"h-3 w-3"})})]}),r.jsx(dt,{placeholder:"Client name",value:l.name,onChange:u=>s(i,"name",u.target.value)}),r.jsx(dt,{placeholder:"Role/title (optional)",value:l.role||"",onChange:u=>s(i,"role",u.target.value)}),r.jsx("textarea",{className:"w-full min-h-[60px] rounded-md border border-input bg-background px-3 py-2 text-sm",placeholder:"Their testimonial quote...",value:l.quote,onChange:u=>s(i,"quote",u.target.value)})]})},i)),r.jsxs(ee,{variant:"outline",size:"sm",onClick:a,className:"w-full",children:[r.jsx(bn,{className:"h-4 w-4 mr-1"})," Add Testimonial"]})]})}function TQt({config:e,onChange:t}){const n=e.tags||[],[s,a]=E.useState(""),o=i=>{t({...e,tags:n.includes(i)?n.filter(u=>u!==i):[...n,i]})},l=()=>{s.trim()&&!n.includes(s.trim())&&(t({...e,tags:[...n,s.trim()]}),a(""))};return r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx($e,{className:"text-sm mb-2 block",children:"Preset Specialties"}),r.jsx("div",{className:"flex flex-wrap gap-2",children:jQt.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($e,{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($e,{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 AQt({config:e,onChange:t}){const n=e.links||[],s=(l,i,u)=>{const p=[...n];p[l]={...p[l],[i]:u},t({...e,links:p})},a=()=>t({...e,links:[...n,{label:"",url:""}]}),o=l=>t({...e,links:n.filter((i,u)=>u!==l)});return r.jsxs("div",{className:"space-y-3",children:[n.map((l,i)=>r.jsxs("div",{className:"flex items-start gap-2",children:[r.jsxs("div",{className:"flex-1 space-y-2",children:[r.jsx(dt,{placeholder:"Button label",value:l.label,onChange:u=>s(i,"label",u.target.value)}),r.jsx(dt,{placeholder:"https://...",value:l.url,onChange:u=>s(i,"url",u.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(Bn,{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 jTe=[{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"},{value:"spotify",label:"Spotify"},{value:"apple_music",label:"Apple Music"}];function EQt({config:e,onChange:t}){const n=e.platforms||[],s=u=>{n.find(p=>p.platform===u)||t({...e,platforms:[...n,{platform:u,url:""}]})},a=(u,p)=>{const x=[...n];x[u]={...x[u],url:p},t({...e,platforms:x})},o=u=>{t({...e,platforms:n.filter((p,x)=>x!==u)})},l=jTe.filter(u=>!n.find(p=>p.platform===u.value)),i=u=>{const p=ufe[u],x=jTe.find(y=>y.value===u);return{label:(x==null?void 0:x.label)||u,color:(p==null?void 0:p.color)||"#666",iconPath:p==null?void 0:p.icon}};return r.jsxs("div",{className:"space-y-4",children:[n.length>0&&r.jsx("div",{className:"space-y-3",children:n.map((u,p)=>{const x=i(u.platform);return r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:"h-9 w-9 rounded-lg flex items-center justify-center flex-shrink-0 border",style:{borderColor:x.color+"30",backgroundColor:x.color+"10"},children:x.iconPath&&r.jsx("svg",{viewBox:"0 0 24 24",width:16,height:16,fill:x.color,children:r.jsx("path",{d:x.iconPath})})}),r.jsx("div",{className:"flex-1",children:r.jsx(dt,{placeholder:`Your ${x.label} profile URL`,value:u.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(Bn,{className:"h-3.5 w-3.5"})})]},p)})}),l.length>0&&r.jsxs("div",{children:[r.jsx($e,{className:"text-xs text-muted-foreground mb-2 block",children:"Add a platform"}),r.jsx("div",{className:"flex flex-wrap gap-2",children:l.map(u=>{const p=ufe[u.value];return r.jsxs("button",{onClick:()=>s(u.value),className:"inline-flex items-center gap-1.5 px-3 py-1.5 text-xs rounded-full border border-border bg-muted hover:bg-muted/80 transition-colors",children:[(p==null?void 0:p.icon)&&r.jsx("svg",{viewBox:"0 0 24 24",width:12,height:12,fill:p.color,children:r.jsx("path",{d:p.icon})}),u.label]},u.value)})})]}),n.length===0&&r.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:"Tap a platform above to add your social media profile."})]})}var IQt=Object.defineProperty,Qne=Object.getOwnPropertySymbols,wVe=Object.prototype.hasOwnProperty,jVe=Object.prototype.propertyIsEnumerable,kTe=(e,t,n)=>t in e?IQt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Qme=(e,t)=>{for(var n in t||(t={}))wVe.call(t,n)&&kTe(e,n,t[n]);if(Qne)for(var n of Qne(t))jVe.call(t,n)&&kTe(e,n,t[n]);return e},Jme=(e,t)=>{var n={};for(var s in e)wVe.call(e,s)&&t.indexOf(s)<0&&(n[s]=e[s]);if(e!=null&&Qne)for(var s of Qne(e))t.indexOf(s)<0&&jVe.call(e,s)&&(n[s]=e[s]);return n};/** * @license QR Code generator library (TypeScript) * Copyright (c) Project Nayuki. * SPDX-License-Identifier: MIT */var wk;(e=>{const t=class Fi{constructor(u,p,x,y){if(this.version=u,this.errorCorrectionLevel=p,this.modules=[],this.isFunction=[],uFi.MAX_VERSION)throw new RangeError("Version value out of range");if(y<-1||y>7)throw new RangeError("Mask value out of range");this.size=u*4+17;let _=[];for(let S=0;S7)throw new RangeError("Invalid value");let S,k;for(S=x;;S++){const I=Fi.getNumDataCodewords(S,p)*8,z=l.getTotalBits(u,S);if(z<=I){k=z;break}if(S>=y)throw new RangeError("Data too long")}for(const I of[Fi.Ecc.MEDIUM,Fi.Ecc.QUARTILE,Fi.Ecc.HIGH])b&&k<=Fi.getNumDataCodewords(S,I)*8&&(p=I);let M=[];for(const I of u){n(I.mode.modeBits,4,M),n(I.numChars,I.mode.numCharCountBits(S),M);for(const z of I.getData())M.push(z)}a(M.length==k);const P=Fi.getNumDataCodewords(S,p)*8;a(M.length<=P),n(0,Math.min(4,P-M.length),M),n(0,(8-M.length%8)%8,M),a(M.length%8==0);for(let I=236;M.lengthT[z>>>3]|=I<<7-(z&7)),new Fi(S,p,T,_)}getModule(u,p){return 0<=u&&u>>9)*1335;const y=(p<<10|x)^21522;a(y>>>15==0);for(let _=0;_<=5;_++)this.setFunctionModule(8,_,s(y,_));this.setFunctionModule(8,7,s(y,6)),this.setFunctionModule(8,8,s(y,7)),this.setFunctionModule(7,8,s(y,8));for(let _=9;_<15;_++)this.setFunctionModule(14-_,8,s(y,_));for(let _=0;_<8;_++)this.setFunctionModule(this.size-1-_,8,s(y,_));for(let _=8;_<15;_++)this.setFunctionModule(8,this.size-15+_,s(y,_));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let u=this.version;for(let x=0;x<12;x++)u=u<<1^(u>>>11)*7973;const p=this.version<<12|u;a(p>>>18==0);for(let x=0;x<18;x++){const y=s(p,x),_=this.size-11+x%3,b=Math.floor(x/3);this.setFunctionModule(_,b,y),this.setFunctionModule(b,_,y)}}drawFinderPattern(u,p){for(let x=-4;x<=4;x++)for(let y=-4;y<=4;y++){const _=Math.max(Math.abs(y),Math.abs(x)),b=u+y,S=p+x;0<=b&&b{(I!=k-_||D>=S)&&T.push(z[I])});return a(T.length==b),T}drawCodewords(u){if(u.length!=Math.floor(Fi.getNumRawDataModules(this.version)/8))throw new RangeError("Invalid argument");let p=0;for(let x=this.size-1;x>=1;x-=2){x==6&&(x=5);for(let y=0;y>>3],7-(p&7)),p++)}}a(p==u.length*8)}applyMask(u){if(u<0||u>7)throw new RangeError("Mask value out of range");for(let p=0;p5&&u++):(this.finderPenaltyAddHistory(S,k),b||(u+=this.finderPenaltyCountPatterns(k)*Fi.PENALTY_N3),b=this.modules[_][M],S=1);u+=this.finderPenaltyTerminateAndCount(b,S,k)*Fi.PENALTY_N3}for(let _=0;_5&&u++):(this.finderPenaltyAddHistory(S,k),b||(u+=this.finderPenaltyCountPatterns(k)*Fi.PENALTY_N3),b=this.modules[M][_],S=1);u+=this.finderPenaltyTerminateAndCount(b,S,k)*Fi.PENALTY_N3}for(let _=0;_b+(S?1:0),p);const x=this.size*this.size,y=Math.ceil(Math.abs(p*20-x*10)/x)-1;return a(0<=y&&y<=9),u+=y*Fi.PENALTY_N4,a(0<=u&&u<=2568888),u}getAlignmentPatternPositions(){if(this.version==1)return[];{const u=Math.floor(this.version/7)+2,p=this.version==32?26:Math.ceil((this.version*4+4)/(u*2-2))*2;let x=[6];for(let y=this.size-7;x.lengthFi.MAX_VERSION)throw new RangeError("Version number out of range");let p=(16*u+128)*u+64;if(u>=2){const x=Math.floor(u/7)+2;p-=(25*x-10)*x-55,u>=7&&(p-=36)}return a(208<=p&&p<=29648),p}static getNumDataCodewords(u,p){return Math.floor(Fi.getNumRawDataModules(u)/8)-Fi.ECC_CODEWORDS_PER_BLOCK[p.ordinal][u]*Fi.NUM_ERROR_CORRECTION_BLOCKS[p.ordinal][u]}static reedSolomonComputeDivisor(u){if(u<1||u>255)throw new RangeError("Degree out of range");let p=[];for(let y=0;y0);for(const y of u){const _=y^x.shift();x.push(0),p.forEach((b,S)=>x[S]^=Fi.reedSolomonMultiply(b,_))}return x}static reedSolomonMultiply(u,p){if(u>>>8||p>>>8)throw new RangeError("Byte out of range");let x=0;for(let y=7;y>=0;y--)x=x<<1^(x>>>7)*285,x^=(p>>>y&1)*u;return a(x>>>8==0),x}finderPenaltyCountPatterns(u){const p=u[1];a(p<=this.size*3);const x=p>0&&u[2]==p&&u[3]==p*3&&u[4]==p&&u[5]==p;return(x&&u[0]>=p*4&&u[6]>=p?1:0)+(x&&u[6]>=p*4&&u[0]>=p?1:0)}finderPenaltyTerminateAndCount(u,p,x){return u&&(this.finderPenaltyAddHistory(p,x),p=0),p+=this.size,this.finderPenaltyAddHistory(p,x),this.finderPenaltyCountPatterns(x)}finderPenaltyAddHistory(u,p){p[0]==0&&(u+=this.size),p.pop(),p.unshift(u)}};t.MIN_VERSION=1,t.MAX_VERSION=40,t.PENALTY_N1=3,t.PENALTY_N2=3,t.PENALTY_N3=40,t.PENALTY_N4=10,t.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]],t.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]],e.QrCode=t;function n(i,u,p){if(u<0||u>31||i>>>u)throw new RangeError("Value out of range");for(let x=u-1;x>=0;x--)p.push(i>>>x&1)}function s(i,u){return(i>>>u&1)!=0}function a(i){if(!i)throw new Error("Assertion error")}const o=class Zl{constructor(u,p,x){if(this.mode=u,this.numChars=p,this.bitData=x,p<0)throw new RangeError("Invalid argument");this.bitData=x.slice()}static makeBytes(u){let p=[];for(const x of u)n(x,8,p);return new Zl(Zl.Mode.BYTE,u.length,p)}static makeNumeric(u){if(!Zl.isNumeric(u))throw new RangeError("String contains non-numeric characters");let p=[];for(let x=0;x=1<<_)return 1/0;x+=4+_+y.bitData.length}return x}static toUtf8ByteArray(u){u=encodeURI(u);let p=[];for(let x=0;x{(t=>{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),t.Ecc=n})(e.QrCode||(e.QrCode={}))})(wk||(wk={}));(e=>{(t=>{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]),t.Mode=n})(e.QrSegment||(e.QrSegment={}))})(wk||(wk={}));var cS=wk;/** * @license qrcode.react * Copyright (c) Paul O'Shannessy * SPDX-License-Identifier: ISC */var PQt={L:cS.QrCode.Ecc.LOW,M:cS.QrCode.Ecc.MEDIUM,Q:cS.QrCode.Ecc.QUARTILE,H:cS.QrCode.Ecc.HIGH},kVe=128,NVe="L",SVe="#FFFFFF",CVe="#000000",MVe=!1,TVe=1,LQt=4,OQt=0,DQt=.1;function AVe(e,t=0){const n=[];return e.forEach(function(s,a){let o=null;s.forEach(function(l,i){if(!l&&o!==null){n.push(`M${o+t} ${a+t}h${i-o}v1H${o+t}z`),o=null;return}if(i===s.length-1){if(!l)return;o===null?n.push(`M${i+t},${a+t} h1v1H${i+t}z`):n.push(`M${o+t},${a+t} h${i+1-o}v1H${o+t}z`);return}l&&o===null&&(o=i)})}),n.join("")}function EVe(e,t){return e.slice().map((n,s)=>s=t.y+t.h?n:n.map((a,o)=>o=t.x+t.w?a:!1))}function RQt(e,t,n,s){if(s==null)return null;const a=e.length+n*2,o=Math.floor(t*DQt),l=a/t,i=(s.width||o)*l,u=(s.height||o)*l,p=s.x==null?e.length/2-i/2:s.x*l,x=s.y==null?e.length/2-u/2:s.y*l,y=s.opacity==null?1:s.opacity;let _=null;if(s.excavate){let S=Math.floor(p),k=Math.floor(x),M=Math.ceil(i+p-S),P=Math.ceil(u+x-k);_={x:S,y:k,w:M,h:P}}const b=s.crossOrigin;return{x:p,y:x,h:u,w:i,excavation:_,opacity:y,crossOrigin:b}}function FQt(e,t){return t!=null?Math.max(Math.floor(t),0):e?LQt:OQt}function IVe({value:e,level:t,minVersion:n,includeMargin:s,marginSize:a,imageSettings:o,size:l,boostLevel:i}){let u=lt.useMemo(()=>{const S=(Array.isArray(e)?e:[e]).reduce((k,M)=>(k.push(...cS.QrSegment.makeSegments(M)),k),[]);return cS.QrCode.encodeSegments(S,PQt[t],n,void 0,void 0,i)},[e,t,n,i]);const{cells:p,margin:x,numCells:y,calculatedImageSettings:_}=lt.useMemo(()=>{let b=u.getModules();const S=FQt(s,a),k=b.length+S*2,M=RQt(b,l,S,o);return{cells:b,margin:S,numCells:k,calculatedImageSettings:M}},[u,l,o,s,a]);return{qrcode:u,margin:x,cells:p,numCells:y,calculatedImageSettings:_}}var zQt=function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0}(),BQt=lt.forwardRef(function(t,n){const s=t,{value:a,size:o=kVe,level:l=NVe,bgColor:i=SVe,fgColor:u=CVe,includeMargin:p=MVe,minVersion:x=TVe,boostLevel:y,marginSize:_,imageSettings:b}=s,k=Jme(s,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","marginSize","imageSettings"]),{style:M}=k,P=Jme(k,["style"]),T=b==null?void 0:b.src,I=lt.useRef(null),z=lt.useRef(null),D=lt.useCallback(ie=>{I.current=ie,typeof n=="function"?n(ie):n&&(n.current=ie)},[n]),[U,V]=lt.useState(!1),{margin:W,cells:G,numCells:J,calculatedImageSettings:ne}=IVe({value:a,level:l,minVersion:x,boostLevel:y,includeMargin:p,marginSize:_,imageSettings:b,size:o});lt.useEffect(()=>{if(I.current!=null){const ie=I.current,pe=ie.getContext("2d");if(!pe)return;let se=G;const fe=z.current,he=ne!=null&&fe!==null&&fe.complete&&fe.naturalHeight!==0&&fe.naturalWidth!==0;he&&ne.excavation!=null&&(se=EVe(G,ne.excavation));const ye=window.devicePixelRatio||1;ie.height=ie.width=o*ye;const Ae=o/J*ye;pe.scale(Ae,Ae),pe.fillStyle=i,pe.fillRect(0,0,J,J),pe.fillStyle=u,zQt?pe.fill(new Path2D(AVe(se,W))):G.forEach(function(we,be){we.forEach(function(_e,Je){_e&&pe.fillRect(Je+W,be+W,1,1)})}),ne&&(pe.globalAlpha=ne.opacity),he&&pe.drawImage(fe,ne.x+W,ne.y+W,ne.w,ne.h)}}),lt.useEffect(()=>{V(!1)},[T]);const oe=Qme({height:o,width:o},M);let ge=null;return T!=null&&(ge=lt.createElement("img",{src:T,key:T,style:{display:"none"},onLoad:()=>{V(!0)},ref:z,crossOrigin:ne==null?void 0:ne.crossOrigin})),lt.createElement(lt.Fragment,null,lt.createElement("canvas",Qme({style:oe,height:o,width:o,ref:D,role:"img"},P)),ge)});BQt.displayName="QRCodeCanvas";var PVe=lt.forwardRef(function(t,n){const s=t,{value:a,size:o=kVe,level:l=NVe,bgColor:i=SVe,fgColor:u=CVe,includeMargin:p=MVe,minVersion:x=TVe,boostLevel:y,title:_,marginSize:b,imageSettings:S}=s,k=Jme(s,["value","size","level","bgColor","fgColor","includeMargin","minVersion","boostLevel","title","marginSize","imageSettings"]),{margin:M,cells:P,numCells:T,calculatedImageSettings:I}=IVe({value:a,level:l,minVersion:x,boostLevel:y,includeMargin:p,marginSize:b,imageSettings:S,size:o});let z=P,D=null;S!=null&&I!=null&&(I.excavation!=null&&(z=EVe(P,I.excavation)),D=lt.createElement("image",{href:S.src,height:I.h,width:I.w,x:I.x+M,y:I.y+M,preserveAspectRatio:"none",opacity:I.opacity,crossOrigin:I.crossOrigin}));const U=AVe(z,M);return lt.createElement("svg",Qme({height:o,width:o,viewBox:`0 0 ${T} ${T}`,ref:n,role:"img"},k),!!_&<.createElement("title",null,_),lt.createElement("path",{fill:i,d:`M0,0 h${T}v${T}H0z`,shapeRendering:"crispEdges"}),lt.createElement("path",{fill:u,d:U,shapeRendering:"crispEdges"}),D)});PVe.displayName="QRCodeSVG";function $Qt({slug:e,agentName:t}){const n=E.useRef(null),s=`https://cards.relevelup.com/${e}`,a=E.useCallback(()=>{var y;const o=(y=n.current)==null?void 0:y.querySelector("svg");if(!o)return;const l=document.createElement("canvas"),i=1024;l.width=i,l.height=i;const u=l.getContext("2d");if(!u)return;const p=new XMLSerializer().serializeToString(o),x=new Image;x.onload=()=>{u.fillStyle="#ffffff",u.fillRect(0,0,i,i),u.drawImage(x,0,0,i,i);const _=document.createElement("a");_.download=`${e}-qr-code.png`,_.href=l.toDataURL("image/png"),_.click(),Ie.success("QR code downloaded!")},x.src="data:image/svg+xml;base64,"+btoa(unescape(encodeURIComponent(p)))},[e]);return r.jsxs("div",{className:"space-y-3",children:[r.jsx($e,{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(PVe,{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(io,{className:"h-3.5 w-3.5"}),"Download PNG"]})]})]})]})}function mue(e){return{is_published:e.is_published,theme:e.theme,title:e.title||"",positioning_statement:e.positioning_statement||"",bio:e.bio||"",review_snippet:e.review_snippet||"",review_source_url:e.review_source_url||"",booking_url:e.booking_url||"",custom_cta_label:e.custom_cta_label||"",show_photo:e.show_photo,show_bio:e.show_bio,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||"",brokerage_logo_url:e.brokerage_logo_url||"",brokerage_logo_size:e.brokerage_logo_size||56,team_name:e.team_name||"",team_logo_url:e.team_logo_url||"",team_logo_size:e.team_logo_size||56,bold_theme_colors:e.bold_theme_colors||null}}function UQt(){const{user:e}=tn(),{data:t,isLoading:n}=Sct(e==null?void 0:e.id),s=z3(),[a,o]=E.useState(null),l=E.useMemo(()=>a||(t?mue(t):null),[a,t]);if(n)return r.jsx(Dr,{children:r.jsxs("div",{className:"max-w-2xl mx-auto p-4 space-y-4",children:[r.jsx(Lr,{className:"h-8 w-48"}),r.jsx(Lr,{className:"h-32 w-full"}),r.jsx(Lr,{className:"h-32 w-full"})]})});if(!t)return r.jsx(Dr,{children:r.jsx(VQt,{userId:e==null?void 0:e.id})});const i=l||mue(t),u=p=>{o(x=>{const y=x||mue(t);return typeof p=="function"?p(y):p})};return r.jsx(Dr,{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(HQt,{card:t}),r.jsx(ZQt,{card:t,form:i,setForm:u})]}),!s&&r.jsx("div",{className:"w-[400px] shrink-0 sticky top-4 self-start",children:r.jsxs("div",{className:"rounded-xl border bg-muted/30 overflow-hidden",children:[r.jsxs("div",{className:"flex items-center gap-2 px-4 py-2.5 border-b bg-card",children:[r.jsx(Rj,{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(qQt,{card:t,form:i})})]})})]})})}function qQt({card:e,form:t}){const{data:n}=Kt({queryKey:["card-preview-profile",e.user_id],queryFn:async()=>{const{data:a}=await Q.from("profiles").select("name, email, phone, avatar_url, brokerage_id").eq("id",e.user_id).single();let o=(a==null?void 0:a.avatar_url)||null;if(!o){const{data:l}=await Q.storage.from("avatars").list(`${e.user_id}`);if(l&&l.length>0){const{data:i}=Q.storage.from("avatars").getPublicUrl(`${e.user_id}/${l[0].name}`);o=`${i.publicUrl}?t=${Date.now()}`}}return{...a,avatar_url:o}}}),s=E.useMemo(()=>({...e,is_published:t.is_published,theme:t.theme,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:e.custom_cta_url,show_photo:t.show_photo,show_bio:t.show_bio,show_video:e.show_video,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||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,bold_theme_colors:t.bold_theme_colors||null,social_links:e.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:t.brokerage_display_name||null,avatar_url:(n==null?void 0:n.avatar_url)||null}),[e,t,n]);return r.jsx("div",{className:"transform scale-[0.85] origin-top",children:r.jsx(Qxe,{card:s})})}function VQt({userId:e}){var u;const[t,n]=E.useState(""),s=N8e(),{data:a}=Kt({queryKey:["my-profile-for-card",e],queryFn:async()=>{if(!e)return null;const{data:p}=await Q.from("profiles").select("name").eq("id",e).single();return p},enabled:!!e}),o=((u=a==null?void 0:a.name)==null?void 0:u.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/(^-|-$)/g,""))||"",l=()=>{if(!e)return;const p=(t.trim()||o).toLowerCase().replace(/[^a-z0-9-]/g,"-");if(!p){Ie.error("Please enter a URL slug for your card");return}s.mutate({user_id:e,slug:p,is_published:!0},{onSuccess:()=>Ie.success("Your digital card has been created!")})},i=[{icon:cy,title:"Shareable Link",desc:"One link that works everywhere"},{icon:Bg,title:"Lead Capture",desc:"Collect leads automatically"},{icon:yf,title:"Always Up-to-Date",desc:"Edit anytime, changes are instant"},{icon:Uc,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(Ls,{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(Ze,{className:"shadow-lg border-2",children:[r.jsxs(Wt,{className:"text-center pb-2",children:[r.jsx(Yt,{className:"text-xl",children:"Set Up Your Card"}),r.jsx(Sn,{children:"Choose a URL slug — this is the link you'll share with clients"})]}),r.jsxs(et,{className:"p-6 pt-2 space-y-5",children:[r.jsxs("div",{children:[r.jsx($e,{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:t||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(Ls,{className:"h-4 w-4 mr-2"}),s.isPending?"Creating...":"Create My Card"]})]})]})]})}function HQt({card:e}){const n=`https://cards.relevelup.com/${e.slug}`,s=()=>{navigator.clipboard.writeText(n),Ie.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(Pt,{variant:e.is_published?"default":"secondary",className:"text-[10px] uppercase tracking-wider",children:e.is_published?"Live":"Draft"})]}),r.jsxs("p",{className:"text-sm text-muted-foreground flex items-center gap-1",children:[r.jsx(cy,{className:"h-3.5 w-3.5"}),"cards.relevelup.com/",e.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(Wo,{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(As,{className:"h-3.5 w-3.5"})," Preview"]})})]})]})})}function WQt({userId:e}){const t=Hr(),n=E.useRef(null),[s,a]=E.useState(!1),[o,l]=E.useState(""),{data:i,isLoading:u}=Kt({queryKey:["card-editor-profile",e],queryFn:async()=>{const{data:ne}=await Q.from("profiles").select("name, email, phone, avatar_url").eq("id",e).single();let oe=(ne==null?void 0:ne.avatar_url)||null;if(!oe){const{data:ge}=await Q.storage.from("avatars").list(`${e}`);if(ge&&ge.length>0){const{data:ie}=Q.storage.from("avatars").getPublicUrl(`${e}/${ge[0].name}`);oe=`${ie.publicUrl}?t=${Date.now()}`,await Q.from("profiles").update({avatar_url:oe}).eq("id",e)}}return{...ne,avatar_url:oe}}}),[p,x]=E.useState(null),[y,_]=E.useState(null),[b,S]=E.useState(null),[k,M]=E.useState(!1),P=p??(i==null?void 0:i.name)??"",T=y??(i==null?void 0:i.phone)??"",I=b??(i==null?void 0:i.email)??"",z=i==null?void 0:i.avatar_url,D=((i==null?void 0:i.name)||"A").split(" ").map(ne=>ne[0]).join("").toUpperCase().slice(0,2),U=!(i!=null&&i.avatar_url)||!(i!=null&&i.phone),V=ir({mutationFn:async ne=>{const{error:oe}=await Q.from("profiles").update(ne).eq("id",e);if(oe)throw oe},onSuccess:()=>{t.invalidateQueries({queryKey:["card-editor-profile",e]}),t.invalidateQueries({queryKey:["card-preview-profile",e]}),t.invalidateQueries({queryKey:["agent-card-user"]}),Ie.success("Profile updated!")},onError:()=>Ie.error("Failed to update profile")}),W=()=>{const ne={};if(p!==null&&p!==(i==null?void 0:i.name)&&(ne.name=p),y!==null&&y!==(i==null?void 0:i.phone)&&(ne.phone=y||null),b!==null&&b!==(i==null?void 0:i.email)&&(ne.email=b),Object.keys(ne).length===0){Ie.info("No changes to save");return}V.mutate(ne)},G=ne=>{var ie;const oe=(ie=ne.target.files)==null?void 0:ie[0];if(!oe)return;if(!oe.type.startsWith("image/")){Ie.error("Please select an image file");return}const ge=new FileReader;ge.onloadend=()=>{l(ge.result),a(!0)},ge.readAsDataURL(oe),ne.target.value=""},J=async ne=>{M(!0);try{const{data:oe}=await Q.storage.from("avatars").list(`${e}`);oe&&oe.length>0&&await Q.storage.from("avatars").remove(oe.map(fe=>`${e}/${fe.name}`));const ge=`${e}/avatar.jpg`,{error:ie}=await Q.storage.from("avatars").upload(ge,ne,{upsert:!0,contentType:"image/jpeg"});if(ie)throw ie;const{data:pe}=Q.storage.from("avatars").getPublicUrl(ge),se=pe.publicUrl+"?t="+Date.now();await Q.from("profiles").update({avatar_url:se}).eq("id",e),t.invalidateQueries({queryKey:["card-editor-profile",e]}),t.invalidateQueries({queryKey:["card-preview-profile",e]}),t.invalidateQueries({queryKey:["agent-card-user"]}),Ie.success("Photo updated!")}catch{Ie.error("Failed to upload photo")}finally{M(!1)}};return u?r.jsx(Lr,{className:"h-32 w-full rounded-xl"}):r.jsxs(r.Fragment,{children:[r.jsx(Ze,{className:U?"border-amber-300 dark:border-amber-700":"",children:r.jsxs(et,{className:"p-5 space-y-4",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[r.jsx($e,{className:"text-sm font-semibold",children:"Profile Info"}),U&&r.jsxs("span",{className:"inline-flex items-center gap-1 text-xs text-amber-600 dark:text-amber-400 font-medium",children:[r.jsx(yl,{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 ne;return(ne=n.current)==null?void 0:ne.click()},children:[r.jsxs(Qs,{className:"h-16 w-16 ring-2 ring-muted",children:[r.jsx(Si,{src:z||void 0,alt:P}),r.jsx(Js,{className:"text-lg font-semibold bg-primary/10 text-primary",children:D})]}),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(Og,{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:k?"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($e,{className:"text-xs font-medium text-muted-foreground",children:"Full Name"}),r.jsx(dt,{value:P,onChange:ne=>x(ne.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($e,{className:"text-xs font-medium text-muted-foreground",children:"Phone Number"}),r.jsx(dt,{value:T,onChange:ne=>_(ne.target.value),placeholder:"(555) 123-4567",className:"h-10",type:"tel"})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx($e,{className:"text-xs font-medium text-muted-foreground",children:"Email"}),r.jsx(dt,{value:I,onChange:ne=>S(ne.target.value),placeholder:"you@example.com",className:"h-10",type:"email"})]})]})]}),r.jsx(ee,{variant:"outline",size:"sm",onClick:W,disabled:V.isPending,className:"w-full",children:V.isPending?"Saving...":"Update Profile Info"})]})}),r.jsx(N0e,{open:s,onClose:()=>a(!1),imageSrc:o,onCropComplete:J,aspectRatio:1})]})}function GQt({form:e,setForm:t,userId:n}){const[s,a]=E.useState(null),[o,l]=E.useState(e.brokerage_logo_url?"logo":"name"),[i,u]=E.useState(e.team_logo_url?"logo":"name"),p=b=>{l(b),t(b==="name"?S=>({...S,brokerage_logo_url:""}):S=>({...S,brokerage_display_name:""}))},x=b=>{u(b),t(b==="name"?S=>({...S,team_logo_url:""}):S=>({...S,team_name:""}))},y=async(b,S)=>{var M;const k=(M=b.target.files)==null?void 0:M[0];if(k){if(!k.type.startsWith("image/")){Ie.error("Please select an image file");return}a(S);try{const P=k.name.split(".").pop()||"png",I=`${n}/${S==="brokerage_logo_url"?"brokerage-logo":"team-logo"}.${P}`,{error:z}=await Q.storage.from("card-logos").upload(I,k,{upsert:!0});if(z)throw z;const{data:D}=Q.storage.from("card-logos").getPublicUrl(I),U=D.publicUrl+"?t="+Date.now();t(S==="brokerage_logo_url"?V=>({...V,[S]:U,brokerage_display_name:""}):V=>({...V,[S]:U,team_name:""})),Ie.success("Logo uploaded!")}catch{Ie.error("Failed to upload logo")}finally{a(null),b.target.value=""}}},_=b=>{t(S=>({...S,[b]:""}))};return r.jsx(Ze,{children:r.jsxs(et,{className:"p-5 space-y-5",children:[r.jsxs("div",{children:[r.jsx($e,{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($e,{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($e,{className:"text-xs font-medium text-muted-foreground",children:"Brokerage Name"}),r.jsx(dt,{value:e.brokerage_display_name,onChange:b=>t(S=>({...S,brokerage_display_name:b.target.value})),placeholder:"e.g. Keller Williams Realty",className:"h-10"})]}):r.jsxs("div",{className:"space-y-3",children:[r.jsx($e,{className:"text-xs font-medium text-muted-foreground",children:"Brokerage Logo"}),r.jsxs("div",{className:"flex items-center gap-3",children:[e.brokerage_logo_url?r.jsxs("div",{className:"relative group",children:[r.jsx("img",{src:e.brokerage_logo_url,alt:"Brokerage logo",style:{height:`${e.brokerage_logo_size||56}px`},className:"max-w-[200px] object-contain rounded border bg-white p-1"}),r.jsx("button",{onClick:()=>_("brokerage_logo_url"),className:"absolute -top-1.5 -right-1.5 h-5 w-5 rounded-full bg-destructive text-destructive-foreground text-xs flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity",children:"×"})]}):null,r.jsxs("label",{className:"cursor-pointer",children:[r.jsxs("span",{className:"inline-flex items-center gap-1.5 px-3 py-1.5 rounded-md border text-xs font-medium hover:bg-muted transition-colors",children:[r.jsx(Og,{className:"h-3.5 w-3.5"}),s==="brokerage_logo_url"?"Uploading...":e.brokerage_logo_url?"Change":"Upload Logo"]}),r.jsx("input",{type:"file",accept:"image/*",className:"hidden",onChange:b=>y(b,"brokerage_logo_url"),disabled:s!==null})]})]}),e.brokerage_logo_url&&r.jsxs("div",{className:"space-y-1.5",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx($e,{className:"text-xs font-medium text-muted-foreground",children:"Logo Size"}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:[e.brokerage_logo_size||56,"px"]})]}),r.jsx(jm,{value:[e.brokerage_logo_size||56],onValueChange:([b])=>t(S=>({...S,brokerage_logo_size:b})),min:24,max:120,step:4})]})]})]}),r.jsxs("div",{className:"space-y-3 p-3 rounded-lg bg-muted/30 border",children:[r.jsx($e,{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($e,{className:"text-xs font-medium text-muted-foreground",children:"Team Name"}),r.jsx(dt,{value:e.team_name,onChange:b=>t(S=>({...S,team_name:b.target.value})),placeholder:"e.g. The Smith Group",className:"h-10"})]}):r.jsxs("div",{className:"space-y-3",children:[r.jsx($e,{className:"text-xs font-medium text-muted-foreground",children:"Team Logo"}),r.jsxs("div",{className:"flex items-center gap-3",children:[e.team_logo_url?r.jsxs("div",{className:"relative group",children:[r.jsx("img",{src:e.team_logo_url,alt:"Team logo",style:{height:`${e.team_logo_size||56}px`},className:"max-w-[200px] object-contain rounded border bg-white p-1"}),r.jsx("button",{onClick:()=>_("team_logo_url"),className:"absolute -top-1.5 -right-1.5 h-5 w-5 rounded-full bg-destructive text-destructive-foreground text-xs flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity",children:"×"})]}):null,r.jsxs("label",{className:"cursor-pointer",children:[r.jsxs("span",{className:"inline-flex items-center gap-1.5 px-3 py-1.5 rounded-md border text-xs font-medium hover:bg-muted transition-colors",children:[r.jsx(Og,{className:"h-3.5 w-3.5"}),s==="team_logo_url"?"Uploading...":e.team_logo_url?"Change":"Upload Logo"]}),r.jsx("input",{type:"file",accept:"image/*",className:"hidden",onChange:b=>y(b,"team_logo_url"),disabled:s!==null})]})]}),e.team_logo_url&&r.jsxs("div",{className:"space-y-1.5",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx($e,{className:"text-xs font-medium text-muted-foreground",children:"Logo Size"}),r.jsxs("span",{className:"text-xs text-muted-foreground",children:[e.team_logo_size||56,"px"]})]}),r.jsx(jm,{value:[e.team_logo_size||56],onValueChange:([b])=>t(S=>({...S,team_logo_size:b})),min:24,max:120,step:4})]})]})]})]})})}function KQt({form:e,setForm:t}){const n={accent:"#ff5722",dark:"#1a1a2e",button:"#ff5722"},s=e.bold_theme_colors||n,a=(i,u)=>{t(p=>({...p,bold_theme_colors:{...n,...p.bold_theme_colors,[i]:u}}))},o=()=>{t(i=>({...i,bold_theme_colors:null}))},l=[{key:"accent",label:"Accent Color",desc:"Page background, icons, highlights"},{key:"dark",label:"Dark Color",desc:"Header background, action buttons, social icons"},{key:"button",label:"CTA Button Color",desc:"Main call-to-action button"}];return r.jsxs("div",{className:"space-y-3 p-4 rounded-xl border bg-muted/30",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsxs($e,{className:"text-sm font-semibold flex items-center gap-1.5",children:[r.jsx(Uc,{className:"h-4 w-4"})," Brand Colors"]}),r.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:"Customize colors to match your brand"})]}),r.jsx(ee,{variant:"ghost",size:"sm",className:"text-xs h-7",onClick:o,children:"Reset to Default"})]}),r.jsx("div",{className:"grid gap-3",children:l.map(({key:i,label:u,desc:p})=>r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsxs("label",{className:"relative shrink-0",children:[r.jsx("input",{type:"color",value:s[i],onChange:x=>a(i,x.target.value),className:"sr-only"}),r.jsx("div",{className:"h-10 w-10 rounded-lg border-2 border-border cursor-pointer shadow-sm hover:scale-105 transition-transform",style:{backgroundColor:s[i]}})]}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"text-sm font-medium",children:u}),r.jsx("p",{className:"text-xs text-muted-foreground",children:p})]}),r.jsx(dt,{value:s[i],onChange:x=>{const y=x.target.value;/^#[0-9a-fA-F]{0,6}$/.test(y)&&a(i,y)},className:"w-24 h-8 text-xs font-mono",placeholder:"#ff5722"})]},i))}),r.jsxs("div",{className:"flex items-center gap-2 pt-2",children:[r.jsx("span",{className:"text-xs text-muted-foreground",children:"Preview:"}),r.jsxs("div",{className:"flex gap-1",children:[r.jsx("div",{className:"h-6 w-12 rounded",style:{backgroundColor:s.accent}}),r.jsx("div",{className:"h-6 w-12 rounded",style:{backgroundColor:s.dark}}),r.jsx("div",{className:"h-6 w-12 rounded",style:{backgroundColor:s.button}})]})]})]})}function ZQt({card:e,form:t,setForm:n}){var _;const s=S8e(),a=Hr(),{data:o}=C8e(e.id),[l,i]=E.useState(e.slug),[u,p]=E.useState(!1),x=async()=>{const b=l.trim().toLowerCase().replace(/[^a-z0-9-]/g,"-").replace(/-+/g,"-").replace(/(^-|-$)/g,"");if(!b){Ie.error("Please enter a valid URL");return}if(b===e.slug){Ie.info("No changes to save");return}p(!0);try{const{data:S}=await Q.from("agent_cards").select("id").eq("slug",b).neq("id",e.id).maybeSingle();if(S){Ie.error("This URL is already taken. Try another one.");return}const{error:k}=await Q.from("agent_cards").update({slug:b}).eq("id",e.id);if(k)throw k;i(b),a.invalidateQueries({queryKey:["agent-card"]}),Ie.success("Card address updated!")}catch{Ie.error("Failed to update card address")}finally{p(!1)}},y=()=>{s.mutate({id:e.id,...t,is_published:!0,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,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,bold_theme_colors:t.bold_theme_colors||null},{onSuccess:()=>Ie.success("Card saved!")})};return r.jsxs("div",{className:"space-y-4",children:[r.jsxs(Ai,{defaultValue:"content",children:[r.jsxs(vi,{className:"w-full h-11 p-1",children:[r.jsxs(sn,{value:"content",className:"flex-1 gap-1.5 data-[state=active]:shadow-sm",children:[r.jsx(Mm,{className:"h-3.5 w-3.5 hidden sm:inline"}),"Content"]}),r.jsxs(sn,{value:"sections",className:"flex-1 gap-1.5 data-[state=active]:shadow-sm",children:[r.jsx(Ko,{className:"h-3.5 w-3.5 hidden sm:inline"}),"Sections"]}),r.jsxs(sn,{value:"blocks",className:"flex-1 gap-1.5 data-[state=active]:shadow-sm",children:[r.jsx(Bg,{className:"h-3.5 w-3.5 hidden sm:inline"}),"Blocks"]}),r.jsxs(sn,{value:"qrcode",className:"flex-1 gap-1.5 data-[state=active]:shadow-sm",children:[r.jsx(gA,{className:"h-3.5 w-3.5 hidden sm:inline"}),"QR Code"]}),r.jsxs(sn,{value:"analytics",className:"flex-1 gap-1.5 data-[state=active]:shadow-sm",children:[r.jsx(Fj,{className:"h-3.5 w-3.5 hidden sm:inline"}),"Analytics"]})]}),r.jsxs(Mn,{value:"content",className:"mt-4 space-y-4",children:[r.jsx(WQt,{userId:e.user_id}),r.jsx(GQt,{form:t,setForm:n,userId:e.user_id}),r.jsx(Ze,{children:r.jsxs(et,{className:"p-5 space-y-5",children:[r.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg bg-muted/50",children:[r.jsxs("div",{children:[r.jsx($e,{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(Ts,{checked:t.is_published,onCheckedChange:b=>n(S=>({...S,is_published:b}))})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx($e,{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:b=>i(b.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:u||l===e.slug,className:"shrink-0",children:u?"Saving...":"Update"})]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"This is your unique card URL. Only letters, numbers, and dashes allowed."})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx($e,{className:"text-sm font-medium",children:"Theme"}),r.jsxs(mn,{value:t.theme,onValueChange:b=>n(S=>({...S,theme:b})),children:[r.jsx(fn,{className:"h-11",children:r.jsx(yn,{})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"standard",children:"✨ Standard — Modern & Clean"}),r.jsx(qt,{value:"luxury",children:"🌙 Luxury — Dark & Gold"}),r.jsx(qt,{value:"bold",children:"🔥 Bold — Vibrant & Punchy"}),r.jsx(qt,{value:"classic",children:"📋 Classic — Professional"})]})]})]}),t.theme==="bold"&&r.jsx(KQt,{form:t,setForm:n}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx($e,{className:"text-sm font-medium",children:"Title / Tagline"}),r.jsx(dt,{value:t.title,onChange:b=>n(S=>({...S,title:b.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($e,{className:"text-sm font-medium",children:"Positioning Statement"}),r.jsx(dt,{value:t.positioning_statement,onChange:b=>n(S=>({...S,positioning_statement:b.target.value})),placeholder:"Your home journey, handled with care.",className:"h-11"})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx($e,{className:"text-sm font-medium",children:"Bio"}),r.jsx(Jn,{value:t.bio,onChange:b=>n(S=>({...S,bio:b.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($e,{className:"text-sm font-medium",children:"Review Snippet"}),r.jsx(dt,{value:t.review_snippet,onChange:b=>n(S=>({...S,review_snippet:b.target.value})),placeholder:"Best agent we've ever worked with...",className:"h-11"})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx($e,{className:"text-sm font-medium",children:"Review Source URL"}),r.jsx(dt,{value:t.review_source_url,onChange:b=>n(S=>({...S,review_source_url:b.target.value})),placeholder:"https://g.page/your-business/review",className:"h-11"})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx($e,{className:"text-sm font-medium",children:"Booking URL"}),r.jsx(dt,{value:t.booking_url,onChange:b=>n(S=>({...S,booking_url:b.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($e,{className:"text-sm font-medium",children:"Custom CTA Label"}),r.jsx(dt,{value:t.custom_cta_label,onChange:b=>n(S=>({...S,custom_cta_label:b.target.value})),placeholder:"Book a Call",className:"h-11"})]})]})})]}),r.jsx(Mn,{value:"sections",className:"mt-4",children:r.jsx(Ze,{children:r.jsx(et,{className:"p-5 divide-y",children:[{key:"show_photo",label:"Photo",desc:"Uses the photo from your Profile Info above"},{key:"show_bio",label:"Bio Section",desc:"Display your bio on the card"},{key:"show_credentials",label:"Credentials",desc:"Show star rating and reviews"},{key:"show_social_links",label:"Social Links",desc:"Display your social media links"},{key:"show_save_contact",label:"Save Contact",desc:"Let visitors save you as a contact"},{key:"show_leave_review",label:"Leave Review",desc:"Link to your review page"},{key:"show_refer_friend",label:"Refer a Friend",desc:"Enable referral submissions"}].map(({key:b,label:S,desc:k})=>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($e,{className:"text-sm font-medium",children:S}),r.jsx("p",{className:"text-xs text-muted-foreground",children:k})]}),r.jsx(Ts,{checked:t[b],onCheckedChange:M=>n(P=>({...P,[b]:M}))})]},b))})})}),r.jsx(Mn,{value:"blocks",className:"mt-4",children:r.jsx(bVe,{cardId:e.id})}),r.jsx(Mn,{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:Ko,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:Fj,color:"text-amber-600 bg-amber-100 dark:text-amber-400 dark:bg-amber-900/30"},{label:"Leads",value:((_=o==null?void 0:o.leads)==null?void 0:_.length)??0,icon:vf,color:"text-emerald-600 bg-emerald-100 dark:text-emerald-400 dark:bg-emerald-900/30"}].map(b=>r.jsx(Ze,{className:"overflow-hidden",children:r.jsxs(et,{className:"p-4",children:[r.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[r.jsx("div",{className:`p-1.5 rounded-md ${b.color}`,children:r.jsx(b.icon,{className:"h-3.5 w-3.5"})}),r.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:b.label})]}),r.jsx("div",{className:"text-2xl font-bold",children:b.value})]})},b.label))}),o&&o.leads.length>0&&r.jsxs(Ze,{children:[r.jsx(Wt,{className:"pb-3",children:r.jsx(Yt,{className:"text-base",children:"Recent Leads"})}),r.jsx(et,{className:"pt-0 space-y-2",children:o.leads.slice(0,5).map(b=>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:b.name}),b.phone&&r.jsx("span",{className:"text-muted-foreground ml-2",children:b.phone})]}),b.intent&&r.jsx(Pt,{variant:"secondary",className:"text-xs",children:b.intent})]},b.id))})]}),(!o||o.leads.length===0)&&r.jsx(Ze,{children:r.jsxs(et,{className:"p-8 text-center",children:[r.jsx(Fj,{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(Mn,{value:"qrcode",className:"mt-4 space-y-4",children:r.jsx(Ze,{children:r.jsx(et,{className:"p-6",children:r.jsx($Qt,{slug:e.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"})]})}function YQt(){const e=Hr(),[t,n]=E.useState(!1),[s,a]=E.useState(!1),[o,l]=E.useState(!1),{data:i,isLoading:u}=Kt({queryKey:["gmail-integration"],queryFn:async()=>{const{data:I,error:z}=await Q.from("gmail_integrations").select("*").maybeSingle();if(z)throw z;return I}}),{data:p}=Kt({queryKey:["social-accounts"],queryFn:async()=>{const{data:{user:I}}=await Q.auth.getUser();if(!I)return[];const{data:z,error:D}=await Q.from("social_accounts").select("*").eq("user_id",I.id).order("created_at",{ascending:!1});if(D)throw D;return z}}),x=async()=>{n(!0);try{const{data:I,error:z}=await Q.functions.invoke("gmail-oauth",{body:{action:"get_auth_url"}});if(z)throw z;if(I!=null&&I.authUrl)window.location.href=I.authUrl;else throw new Error("Failed to get authorization URL")}catch(I){console.error("Gmail OAuth error:",I),Ie.error("Failed to start Gmail connection"),n(!1)}},y=async()=>{a(!0);try{const{data:I,error:z}=await Q.functions.invoke("meta-oauth",{body:{action:"get_auth_url",callbackPath:"/social-connections/callback"}});if(z)throw z;if(I!=null&&I.authUrl)window.location.href=I.authUrl;else throw new Error("Failed to get authorization URL")}catch(I){console.error("Meta OAuth error:",I),Ie.error("Failed to start connection. Make sure Meta App credentials are configured."),a(!1)}},_=async()=>{l(!0);try{const{data:I,error:z}=await Q.functions.invoke("linkedin-oauth",{body:{action:"get_auth_url",callbackPath:"/social-connections/linkedin-callback"}});if(z)throw z;if(I!=null&&I.authUrl)window.location.href=I.authUrl;else throw new Error("Failed to get LinkedIn authorization URL")}catch(I){console.error("LinkedIn OAuth error:",I),Ie.error("Failed to start LinkedIn connection. Please try again."),l(!1)}},b=ir({mutationFn:async I=>{const{error:z}=await Q.from("gmail_integrations").delete().eq("id",I);if(z)throw z},onSuccess:()=>{e.invalidateQueries({queryKey:["gmail-integration"]}),Ie.success("Gmail disconnected")},onError:()=>{Ie.error("Failed to disconnect Gmail")}}),S=ir({mutationFn:async I=>{const{error:z}=await Q.from("social_accounts").delete().eq("id",I);if(z)throw z},onSuccess:()=>{e.invalidateQueries({queryKey:["social-accounts"]}),Ie.success("Account disconnected")},onError:()=>{Ie.error("Failed to disconnect account")}}),k=!!(i!=null&&i.is_active),M=(p==null?void 0:p.filter(I=>I.platform==="facebook"))||[],P=(p==null?void 0:p.filter(I=>I.platform==="instagram"))||[],T=(p==null?void 0:p.filter(I=>I.platform==="linkedin"))||[];return r.jsx(Dr,{children:r.jsxs("div",{className:"max-w-3xl mx-auto space-y-6 animate-fade-in",children:[r.jsxs("div",{children:[r.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:"Integrations"}),r.jsx("p",{className:"text-muted-foreground",children:"Connect third-party services to supercharge your Agent OS workflow."})]}),r.jsxs(Ze,{children:[r.jsx(Wt,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"h-10 w-10 rounded-lg bg-destructive/10 flex items-center justify-center",children:r.jsx(Ns,{className:"h-5 w-5 text-destructive"})}),r.jsxs("div",{children:[r.jsxs(Yt,{className:"text-lg flex items-center gap-2",children:["Gmail",k&&r.jsx(Pt,{variant:"default",className:"text-xs bg-green-600",children:"Connected"})]}),r.jsx(Sn,{children:"Send emails directly from your contact pages and auto-log them as touchpoints."})]})]})}),r.jsx(et,{children:r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-start gap-2 text-sm text-muted-foreground",children:[r.jsx(di,{className:"h-4 w-4 mt-0.5 text-green-500 shrink-0"}),r.jsx("span",{children:"Send personalized emails from your Gmail account"})]}),r.jsxs("div",{className:"flex items-start gap-2 text-sm text-muted-foreground",children:[r.jsx(di,{className:"h-4 w-4 mt-0.5 text-green-500 shrink-0"}),r.jsx("span",{children:"Automatically log emails as activity touchpoints"})]}),r.jsxs("div",{className:"flex items-start gap-2 text-sm text-muted-foreground",children:[r.jsx(di,{className:"h-4 w-4 mt-0.5 text-green-500 shrink-0"}),r.jsx("span",{children:"Quick compose from any contact detail page"})]}),k?r.jsxs("div",{className:"flex items-center justify-between mt-4 p-3 rounded-lg border",children:[r.jsxs("div",{children:[r.jsx("p",{className:"font-medium text-sm",children:i.gmail_email}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Connected Gmail account"})]}),r.jsxs(Id,{children:[r.jsx(wm,{asChild:!0,children:r.jsx(ee,{variant:"ghost",size:"icon",className:"text-destructive hover:text-destructive",children:r.jsx(Bn,{className:"h-4 w-4"})})}),r.jsxs(id,{children:[r.jsxs(od,{children:[r.jsx(cd,{children:"Disconnect Gmail?"}),r.jsx(dd,{children:"This will remove your Gmail connection. You'll need to reconnect to send emails."})]}),r.jsxs(ld,{children:[r.jsx(ud,{children:"Cancel"}),r.jsx(Bc,{onClick:()=>b.mutate(i.id),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Disconnect"})]})]})]})]}):r.jsxs(ee,{className:"mt-4",onClick:x,disabled:t||u,children:[t?r.jsx(qo,{className:"h-4 w-4 mr-2 animate-spin"}):r.jsx(Ns,{className:"h-4 w-4 mr-2"}),"Connect Gmail",r.jsx(Vo,{className:"h-4 w-4 ml-2"})]})]})})]}),r.jsxs(Ze,{children:[r.jsx(Wt,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"h-10 w-10 rounded-lg bg-blue-500/10 flex items-center justify-center",children:r.jsx(au,{className:"h-5 w-5 text-blue-600"})}),r.jsxs("div",{children:[r.jsxs(Yt,{className:"text-lg flex items-center gap-2",children:["Facebook",M.length>0&&r.jsx(Pt,{variant:"default",className:"text-xs bg-green-600",children:"Connected"})]}),r.jsx(Sn,{children:"Connect Facebook Pages to post content and reach your audience."})]})]})}),r.jsxs(et,{className:"space-y-3",children:[M.length>0&&r.jsx("div",{className:"space-y-2",children:M.map(I=>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(Qs,{className:"h-8 w-8",children:[r.jsx(Si,{src:I.profile_picture_url||""}),r.jsx(Js,{children:r.jsx(au,{className:"h-4 w-4"})})]}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium text-sm",children:I.page_name||I.platform_username||"Facebook Page"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Connected Facebook Page"})]})]}),r.jsxs(Id,{children:[r.jsx(wm,{asChild:!0,children:r.jsx(ee,{variant:"ghost",size:"icon",className:"text-destructive hover:text-destructive",children:r.jsx(Bn,{className:"h-4 w-4"})})}),r.jsxs(id,{children:[r.jsxs(od,{children:[r.jsx(cd,{children:"Disconnect Facebook?"}),r.jsx(dd,{children:"This will remove the connection. You'll need to reconnect to post content."})]}),r.jsxs(ld,{children:[r.jsx(ud,{children:"Cancel"}),r.jsx(Bc,{onClick:()=>S.mutate(I.id),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Disconnect"})]})]})]})]},I.id))}),r.jsxs(ee,{onClick:y,disabled:s,variant:"outline",className:"gap-2",children:[s?r.jsx(qo,{className:"h-4 w-4 animate-spin"}):r.jsx(bn,{className:"h-4 w-4"}),"Connect Facebook Page"]})]})]}),r.jsxs(Ze,{children:[r.jsx(Wt,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"h-10 w-10 rounded-lg bg-pink-500/10 flex items-center justify-center",children:r.jsx(_u,{className:"h-5 w-5 text-pink-600"})}),r.jsxs("div",{children:[r.jsxs(Yt,{className:"text-lg flex items-center gap-2",children:["Instagram",P.length>0&&r.jsx(Pt,{variant:"default",className:"text-xs bg-green-600",children:"Connected"})]}),r.jsx(Sn,{children:"Connect Instagram Business accounts to schedule and publish posts."})]})]})}),r.jsxs(et,{className:"space-y-3",children:[P.length>0&&r.jsx("div",{className:"space-y-2",children:P.map(I=>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(Qs,{className:"h-8 w-8",children:[r.jsx(Si,{src:I.profile_picture_url||""}),r.jsx(Js,{children:r.jsx(_u,{className:"h-4 w-4"})})]}),r.jsxs("div",{children:[r.jsxs("p",{className:"font-medium text-sm",children:["@",I.platform_username||"Instagram Account"]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Connected Instagram account"})]})]}),r.jsxs(Id,{children:[r.jsx(wm,{asChild:!0,children:r.jsx(ee,{variant:"ghost",size:"icon",className:"text-destructive hover:text-destructive",children:r.jsx(Bn,{className:"h-4 w-4"})})}),r.jsxs(id,{children:[r.jsxs(od,{children:[r.jsx(cd,{children:"Disconnect Instagram?"}),r.jsx(dd,{children:"This will remove the connection. You'll need to reconnect to post content."})]}),r.jsxs(ld,{children:[r.jsx(ud,{children:"Cancel"}),r.jsx(Bc,{onClick:()=>S.mutate(I.id),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Disconnect"})]})]})]})]},I.id))}),r.jsxs(ee,{onClick:y,disabled:s,variant:"outline",className:"gap-2",children:[s?r.jsx(qo,{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:"Instagram Business accounts must be connected to a Facebook Page."})]})]}),r.jsxs(Ze,{children:[r.jsx(Wt,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"h-10 w-10 rounded-lg bg-blue-700/10 flex items-center justify-center",children:r.jsx(gf,{className:"h-5 w-5 text-blue-700"})}),r.jsxs("div",{children:[r.jsxs(Yt,{className:"text-lg flex items-center gap-2",children:["LinkedIn",T.length>0&&r.jsx(Pt,{variant:"default",className:"text-xs bg-green-600",children:"Connected"})]}),r.jsx(Sn,{children:"Connect your LinkedIn profile to share content and grow your professional network."})]})]})}),r.jsxs(et,{className:"space-y-3",children:[T.length>0&&r.jsx("div",{className:"space-y-2",children:T.map(I=>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(Qs,{className:"h-8 w-8",children:[r.jsx(Si,{src:I.profile_picture_url||""}),r.jsx(Js,{children:r.jsx(gf,{className:"h-4 w-4"})})]}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium text-sm",children:I.platform_username||"LinkedIn Account"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Connected LinkedIn profile"})]})]}),r.jsxs(Id,{children:[r.jsx(wm,{asChild:!0,children:r.jsx(ee,{variant:"ghost",size:"icon",className:"text-destructive hover:text-destructive",children:r.jsx(Bn,{className:"h-4 w-4"})})}),r.jsxs(id,{children:[r.jsxs(od,{children:[r.jsx(cd,{children:"Disconnect LinkedIn?"}),r.jsx(dd,{children:"This will remove your LinkedIn connection. You'll need to reconnect to post content."})]}),r.jsxs(ld,{children:[r.jsx(ud,{children:"Cancel"}),r.jsx(Bc,{onClick:()=>S.mutate(I.id),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Disconnect"})]})]})]})]},I.id))}),r.jsxs(ee,{onClick:_,disabled:o,variant:"outline",className:"gap-2",children:[o?r.jsx(qo,{className:"h-4 w-4 animate-spin"}):r.jsx(bn,{className:"h-4 w-4"}),"Connect LinkedIn"]})]})]})]})})}function XQt(){const[e]=Gc(),t=Gn(),[n,s]=E.useState("loading"),[a,o]=E.useState("Connecting your Gmail account...");return E.useEffect(()=>{(async()=>{const i=e.get("code"),u=e.get("error"),p=e.get("error_description"),x=e.get("state");if(u){s("error"),o(p||"Authorization was denied"),Ie.error("Connection failed: "+(p||u));return}if(!i){s("error"),o("No authorization code received"),Ie.error("No authorization code received");return}try{const{data:y,error:_}=await Q.functions.invoke("gmail-oauth",{body:{action:"exchange_code",code:i,state:x}});if(_)throw _;if(y!=null&&y.success)s("success"),o(y.message||"Gmail connected successfully!"),Ie.success("Gmail connected!");else throw new Error((y==null?void 0:y.error)||"Unknown error")}catch(y){console.error("Gmail OAuth callback error:",y),s("error"),o(y instanceof Error?y.message:"Failed to connect Gmail"),Ie.error("Failed to connect: "+(y instanceof Error?y.message:"Unknown error"))}})()},[e]),r.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background p-4",children:r.jsxs(Ze,{className:"w-full max-w-md",children:[r.jsxs(Wt,{className:"text-center",children:[n==="loading"&&r.jsx(Zr,{className:"h-12 w-12 animate-spin mx-auto text-primary"}),n==="success"&&r.jsx(di,{className:"h-12 w-12 mx-auto text-green-500"}),n==="error"&&r.jsx(bc,{className:"h-12 w-12 mx-auto text-destructive"}),r.jsxs(Yt,{className:"mt-4",children:[n==="loading"&&"Connecting...",n==="success"&&"Connected!",n==="error"&&"Connection Failed"]}),r.jsx(Sn,{children:a})]}),r.jsx(et,{className:"flex justify-center",children:n!=="loading"&&r.jsx(ee,{onClick:()=>t("/mission-control/integrations"),children:n==="success"?"Back to Integrations":"Try Again"})})]})})}function QQt(){const e=Gn();return E.useEffect(()=>{const t=setTimeout(()=>{e("/mission-control/integrations",{replace:!0})},1500);return()=>clearTimeout(t)},[e]),r.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background",children:r.jsxs("div",{className:"text-center space-y-4",children:[r.jsx("div",{className:"h-10 w-10 animate-spin rounded-full border-4 border-primary border-t-transparent mx-auto"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Finishing Canva connection…"})]})})}function JQt(){const[e]=Gc(),t=Gn(),[n,s]=E.useState("loading"),[a,o]=E.useState("Processing your connection...");return E.useEffect(()=>{(async()=>{var y;const i=e.get("code"),u=e.get("error"),p=e.get("error_description"),x=e.get("state");if(u){s("error"),o(p||"Authorization was denied"),Ie.error("Connection failed: "+(p||u));return}if(!i){s("error"),o("No authorization code received"),Ie.error("No authorization code received");return}try{const{data:_,error:b}=await Q.functions.invoke("meta-oauth",{body:{action:"exchange_code",code:i,state:x,callbackPath:"/mission-control/integrations/meta/callback"}});if(b)throw b;if(_!=null&&_.success)s("success"),o(`Successfully connected ${((y=_.accounts)==null?void 0:y.length)||0} account(s)!`),Ie.success("Social accounts connected successfully!");else throw new Error((_==null?void 0:_.error)||"Unknown error")}catch(_){console.error("OAuth callback error:",_),s("error"),o(_ instanceof Error?_.message:"Failed to connect accounts"),Ie.error("Failed to connect: "+(_ instanceof Error?_.message:"Unknown error"))}})()},[e]),r.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background p-4",children:r.jsxs(Ze,{className:"w-full max-w-md",children:[r.jsxs(Wt,{className:"text-center",children:[n==="loading"&&r.jsx(Zr,{className:"h-12 w-12 animate-spin mx-auto text-primary"}),n==="success"&&r.jsx(di,{className:"h-12 w-12 mx-auto text-green-500"}),n==="error"&&r.jsx(bc,{className:"h-12 w-12 mx-auto text-destructive"}),r.jsxs(Yt,{className:"mt-4",children:[n==="loading"&&"Connecting...",n==="success"&&"Connected!",n==="error"&&"Connection Failed"]}),r.jsx(Sn,{children:a})]}),r.jsx(et,{className:"flex justify-center",children:n!=="loading"&&r.jsx(ee,{onClick:()=>t("/mission-control/integrations"),children:n==="success"?"View Integrations":"Try Again"})})]})})}const LVe=new Date().getFullYear(),eJt=Array.from({length:5},(e,t)=>LVe-t);function tJt(){const[e,t]=E.useState(LVe),n=Gn(),{data:s,isLoading:a}=Ygt();return a?r.jsx(Dr,{title:"Scorecard Admin",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Lr,{className:"h-8 w-64"}),r.jsx("div",{className:"grid grid-cols-4 gap-4",children:[1,2,3,4].map(o=>r.jsx(Lr,{className:"h-24"},o))}),r.jsx(Lr,{className:"h-96"})]})}):r.jsx(Dr,{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(mn,{value:String(e),onValueChange:o=>t(Number(o)),children:[r.jsx(fn,{className:"w-[120px]",children:r.jsx(yn,{})}),r.jsx(pn,{children:eJt.map(o=>r.jsx(qt,{value:String(o),children:o},o))})]})]}),r.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 gap-4",children:[r.jsx(Ze,{children:r.jsxs(et,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(Un,{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(Ze,{children:r.jsxs(et,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(_c,{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(Ze,{children:[r.jsxs(Wt,{children:[r.jsx(Yt,{children:"Agents with Scorecards"}),r.jsx(Sn,{children:"Click to view individual agent scorecards"})]}),r.jsx(et,{children:!s||s.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(_c,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),r.jsx("p",{children:"No agents have added transactions yet"})]}):r.jsxs(Ks,{children:[r.jsx(Zs,{children:r.jsxs(Mr,{children:[r.jsx(It,{children:"Agent"}),r.jsx(It,{children:"Email"}),r.jsx(It,{className:"text-right",children:"Actions"})]})}),r.jsx(Ys,{children:s.map(o=>r.jsxs(Mr,{children:[r.jsx(kt,{className:"font-medium",children:o.name}),r.jsx(kt,{className:"text-muted-foreground",children:o.email}),r.jsx(kt,{className:"text-right",children:r.jsxs(ee,{variant:"ghost",size:"sm",onClick:()=>n(`/admin/scorecard/${o.id}`),children:[r.jsx(Ko,{className:"h-4 w-4 mr-2"}),"View Scorecard"]})})]},o.id))})]})})]})]})})}const OVe=new Date().getFullYear(),rJt=Array.from({length:10},(e,t)=>OVe-t);function nJt(){var _;const{userId:e}=md(),t=Gn(),[n,s]=E.useState(OVe),{data:a,isLoading:o}=Kt({queryKey:["agent-profile",e],queryFn:async()=>{const{data:b,error:S}=await Q.from("profiles").select("id, name, email").eq("id",e).single();if(S)throw S;return b},enabled:!!e}),{data:l,isLoading:i}=Dye(n,e),{yearStats:u,lifetimeStats:p,showCommission:x}=DRe(n,e),{data:y}=ORe(n,e);return o?r.jsx(Dr,{title:"Agent Scorecard",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Lr,{className:"h-8 w-64"}),r.jsx("div",{className:"grid grid-cols-4 gap-4",children:[1,2,3,4].map(b=>r.jsx(Lr,{className:"h-24"},b))})]})}):r.jsx(Dr,{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:()=>t("/admin/scorecard"),children:r.jsx(po,{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(mn,{value:String(n),onValueChange:b=>s(Number(b)),children:[r.jsx(fn,{className:"w-[120px]",children:r.jsx(yn,{})}),r.jsx(pn,{children:rJt.map(b=>r.jsx(qt,{value:String(b),children:b},b))})]})]}),r.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-4 lg:grid-cols-5 gap-4",children:[r.jsx(Ze,{children:r.jsxs(et,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(xa,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs font-medium",children:"Transactions"})]}),r.jsx("p",{className:"text-2xl font-bold",children:u.totalTransactions}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[p.totalTransactions," lifetime"]})]})}),r.jsx(Ze,{children:r.jsxs(et,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(Un,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs font-medium",children:"Buyer/Seller"})]}),r.jsxs("p",{className:"text-2xl font-bold",children:[u.buyerCount,"/",u.sellerCount]})]})}),r.jsx(Ze,{children:r.jsxs(et,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(Rd,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs font-medium",children:"Volume"})]}),r.jsx("p",{className:"text-2xl font-bold",children:tu(u.totalVolume,!0)})]})}),r.jsx(Ze,{children:r.jsxs(et,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(fp,{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:tu(u.averagePrice,!0)})]})}),r.jsx(Ze,{children:r.jsxs(et,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(zl,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs font-medium",children:"Top Source"})]}),r.jsx("p",{className:"text-lg font-bold truncate",children:((_=u.topLeadSource)==null?void 0:_.name)||"-"})]})})]}),y&&r.jsx(vBe,{goals:y,stats:u,year:n,showCommission:x}),r.jsxs(Ai,{defaultValue:"transactions",className:"space-y-4",children:[r.jsxs(vi,{children:[r.jsx(sn,{value:"transactions",children:"Transactions"}),r.jsx(sn,{value:"charts",children:"Charts"}),r.jsxs(sn,{value:"map",children:[r.jsx(Po,{className:"h-4 w-4 mr-1"}),"Map"]})]}),r.jsx(Mn,{value:"transactions",children:r.jsx(yBe,{transactions:l||[],showCommission:x,isLoading:i})}),r.jsx(Mn,{value:"charts",children:r.jsx(cVe,{stats:u,year:n})}),r.jsx(Mn,{value:"map",children:r.jsx(dVe,{transactions:l||[],isLoading:i})})]})]})})}function sJt(){const e=Hr(),[t,n]=E.useState(""),[s,a]=E.useState("all");L8e();const{data:o,refetch:l}=Kt({queryKey:["listing-exchange-flag"],queryFn:async()=>{const{data:T}=await Q.from("feature_flags").select("enabled").eq("key","listing_exchange_enabled").single();return(T==null?void 0:T.enabled)??!1}}),{data:i,isLoading:u}=Kt({queryKey:["admin-listings"],queryFn:async()=>{const{data:T,error:I}=await Q.from("listings").select(` *, agent:profiles!listings_agent_id_fkey(id, name, email), photos:listing_photos(id, photo_url, is_primary) `).order("created_at",{ascending:!1});if(I)throw I;return T}}),{data:p}=Kt({queryKey:["admin-listing-stats"],queryFn:async()=>{const{data:T}=await Q.from("listings").select("id, is_approved, status"),{data:I}=await Q.from("listing_shares").select("id"),{data:z}=await Q.from("listing_views").select("id");return{total:(T==null?void 0:T.length)||0,pending:(T==null?void 0:T.filter(D=>!D.is_approved).length)||0,active:(T==null?void 0:T.filter(D=>D.status==="active").length)||0,totalShares:(I==null?void 0:I.length)||0,totalViews:(z==null?void 0:z.length)||0}}}),x=ir({mutationFn:async({id:T,approved:I})=>{const{error:z}=await Q.from("listings").update({is_approved:I}).eq("id",T);if(z)throw z},onSuccess:(T,{approved:I})=>{e.invalidateQueries({queryKey:["admin-listings"]}),e.invalidateQueries({queryKey:["admin-listing-stats"]}),Ie.success(I?"Listing approved":"Listing unapproved")}}),y=ir({mutationFn:async({id:T,featured:I})=>{const{error:z}=await Q.from("listings").update({is_featured:I}).eq("id",T);if(z)throw z},onSuccess:(T,{featured:I})=>{e.invalidateQueries({queryKey:["admin-listings"]}),Ie.success(I?"Listing featured":"Listing unfeatured")}}),_=ir({mutationFn:async T=>{const{error:I}=await Q.from("listings").delete().eq("id",T);if(I)throw I},onSuccess:()=>{e.invalidateQueries({queryKey:["admin-listings"]}),e.invalidateQueries({queryKey:["admin-listing-stats"]}),Ie.success("Listing deleted")}}),b=ir({mutationFn:async T=>{const{error:I}=await Q.from("feature_flags").update({enabled:T}).eq("key","listing_exchange_enabled");if(I)throw I},onSuccess:()=>{l(),Ie.success("Feature flag updated")}}),S=o??!1,k=i==null?void 0:i.filter(T=>{var D,U,V,W;const I=((D=T.city)==null?void 0:D.toLowerCase().includes(t.toLowerCase()))||((V=(U=T.agent)==null?void 0:U.name)==null?void 0:V.toLowerCase().includes(t.toLowerCase()))||((W=T.property_address)==null?void 0:W.toLowerCase().includes(t.toLowerCase())),z=s==="all"||s==="pending"&&!T.is_approved||s==="approved"&&T.is_approved;return I&&z}),M=T=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",maximumFractionDigits:0}).format(T),P=T=>{const I={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 I[T]||I.active};return r.jsx(Dr,{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(Ts,{checked:S,onCheckedChange:T=>b.mutate(T)})]})]}),r.jsxs("div",{className:"grid grid-cols-2 md:grid-cols-5 gap-4",children:[r.jsx(Ze,{children:r.jsxs(et,{className:"p-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(hi,{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(Ze,{children:r.jsxs(et,{className:"p-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(fp,{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(Ze,{children:r.jsxs(et,{className:"p-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Un,{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(Ze,{children:r.jsxs(et,{className:"p-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ko,{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(Ze,{children:r.jsxs(et,{className:"p-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Nc,{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(Ze,{children:r.jsx(et,{className:"p-4",children:r.jsxs("div",{className:"flex flex-col sm:flex-row gap-4",children:[r.jsxs("div",{className:"relative flex-1",children:[r.jsx(Sa,{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:t,onChange:T=>n(T.target.value),className:"pl-9"})]}),r.jsx(Ai,{value:s,onValueChange:T=>a(T),children:r.jsxs(vi,{children:[r.jsx(sn,{value:"all",children:"All"}),r.jsx(sn,{value:"pending",children:"Pending"}),r.jsx(sn,{value:"approved",children:"Approved"})]})})]})})}),r.jsxs(Ze,{children:[r.jsx(Wt,{children:r.jsxs(Yt,{children:["Listings (",(k==null?void 0:k.length)||0,")"]})}),r.jsx(et,{children:r.jsx("div",{className:"overflow-x-auto",children:r.jsxs(Ks,{children:[r.jsx(Zs,{children:r.jsxs(Mr,{children:[r.jsx(It,{children:"Property"}),r.jsx(It,{children:"Agent"}),r.jsx(It,{children:"Price"}),r.jsx(It,{children:"Status"}),r.jsx(It,{className:"text-center",children:"Approved"}),r.jsx(It,{className:"text-center",children:"Featured"}),r.jsx(It,{children:"Views"}),r.jsx(It,{children:"Shares"}),r.jsx(It,{children:"Date"}),r.jsx(It,{})]})}),r.jsx(Ys,{children:u?r.jsx(Mr,{children:r.jsx(kt,{colSpan:10,className:"text-center py-8 text-muted-foreground",children:"Loading..."})}):(k==null?void 0:k.length)===0?r.jsx(Mr,{children:r.jsx(kt,{colSpan:10,className:"text-center py-8 text-muted-foreground",children:"No listings found"})}):k==null?void 0:k.map(T=>{var I,z,D,U,V;return r.jsxs(Mr,{children:[r.jsx(kt,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[(z=(I=T.photos)==null?void 0:I[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(hi,{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:(D=T.property_type)==null?void 0:D.replace("_"," ")})]})]})}),r.jsx(kt,{children:r.jsx("p",{className:"text-sm",children:((U=T.agent)==null?void 0:U.name)||"Unknown"})}),r.jsx(kt,{className:"font-medium",children:M(T.price)}),r.jsx(kt,{children:r.jsx(Pt,{variant:"outline",className:P(T.status),children:(V=T.status)==null?void 0:V.replace("_"," ")})}),r.jsx(kt,{className:"text-center",children:r.jsx(Ts,{checked:T.is_approved??!1,onCheckedChange:W=>x.mutate({id:T.id,approved:W})})}),r.jsx(kt,{className:"text-center",children:r.jsx(Ts,{checked:T.is_featured??!1,onCheckedChange:W=>y.mutate({id:T.id,featured:W})})}),r.jsx(kt,{children:T.view_count||0}),r.jsx(kt,{children:T.share_count||0}),r.jsx(kt,{className:"text-sm text-muted-foreground",children:on(new Date(T.created_at),"MMM d, yyyy")}),r.jsx(kt,{children:r.jsxs(Lh,{children:[r.jsx(Oh,{asChild:!0,children:r.jsx(ee,{variant:"ghost",size:"icon",children:r.jsx(pm,{className:"h-4 w-4"})})}),r.jsxs(ah,{align:"end",children:[r.jsxs(ei,{onClick:()=>window.open(`/mission-control/listings/${T.id}`,"_blank"),children:[r.jsx(Ko,{className:"h-4 w-4 mr-2"}),"View Listing"]}),r.jsxs(ei,{onClick:()=>y.mutate({id:T.id,featured:!T.is_featured}),children:[r.jsx(js,{className:"h-4 w-4 mr-2"}),T.is_featured?"Unfeature":"Feature"]}),r.jsxs(ei,{className:"text-destructive",onClick:()=>{confirm("Are you sure you want to delete this listing?")&&_.mutate(T.id)},children:[r.jsx(hs,{className:"h-4 w-4 mr-2"}),"Delete"]})]})]})})]},T.id)})})]})})})]})]})})}const aJt=()=>{var y,_;const[e,t]=E.useState(""),[n,s]=E.useState(null),{data:a,isLoading:o}=Kt({queryKey:["membership-reviews"],queryFn:async()=>{const{data:b,error:S}=await Q.from("membership_reviews").select("*").order("created_at",{ascending:!1});if(S)throw S;const k=(b==null?void 0:b.map(T=>T.user_id))||[],{data:M}=await Q.from("profiles").select("id, name, email").in("id",k);return b==null?void 0:b.map(T=>({...T,profiles:(M==null?void 0:M.find(I=>I.id===T.user_id))||null}))}}),l=a==null?void 0:a.filter(b=>{var k,M,P,T,I;const S=e.toLowerCase();return((M=(k=b.profiles)==null?void 0:k.name)==null?void 0:M.toLowerCase().includes(S))||((T=(P=b.profiles)==null?void 0:P.email)==null?void 0:T.toLowerCase().includes(S))||((I=b.review_text)==null?void 0:I.toLowerCase().includes(S))}),i=a!=null&&a.length?(a.reduce((b,S)=>b+S.rating,0)/a.length).toFixed(1):"0.0",u=a==null?void 0:a.reduce((b,S)=>(b[S.rating]=(b[S.rating]||0)+1,b),{}),p=(a==null?void 0:a.filter(b=>b.posted_to_google).length)||0,x=b=>r.jsx("div",{className:"flex gap-0.5",children:[1,2,3,4,5].map(S=>r.jsx(js,{className:Bt("h-4 w-4",b>=S?"fill-yellow-400 text-yellow-400":"text-muted-foreground")},S))});return r.jsx(Dr,{children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Mu,{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(Ze,{children:r.jsxs(Wt,{className:"pb-2",children:[r.jsx(Sn,{children:"Total Reviews"}),r.jsx(Yt,{className:"text-3xl",children:(a==null?void 0:a.length)||0})]})}),r.jsx(Ze,{children:r.jsxs(Wt,{className:"pb-2",children:[r.jsx(Sn,{children:"Average Rating"}),r.jsxs(Yt,{className:"flex items-center gap-2 text-3xl",children:[i,r.jsx(js,{className:"h-6 w-6 fill-yellow-400 text-yellow-400"})]})]})}),r.jsx(Ze,{children:r.jsxs(Wt,{className:"pb-2",children:[r.jsx(Sn,{children:"5-Star Reviews"}),r.jsx(Yt,{className:"text-3xl",children:(u==null?void 0:u[5])||0})]})}),r.jsx(Ze,{children:r.jsxs(Wt,{className:"pb-2",children:[r.jsx(Sn,{children:"Posted to Google"}),r.jsxs(Yt,{className:"flex items-center gap-2 text-3xl",children:[p,r.jsx(As,{className:"h-5 w-5 text-muted-foreground"})]})]})})]}),r.jsxs("div",{className:"relative max-w-sm",children:[r.jsx(Sa,{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:e,onChange:b=>t(b.target.value),className:"pl-9"})]}),r.jsx(Ze,{children:r.jsx(et,{className:"p-0",children:r.jsxs(Ks,{children:[r.jsx(Zs,{children:r.jsxs(Mr,{children:[r.jsx(It,{children:"Member"}),r.jsx(It,{children:"Rating"}),r.jsx(It,{className:"hidden md:table-cell",children:"Review"}),r.jsx(It,{children:"Google"}),r.jsx(It,{children:"Date"})]})}),r.jsx(Ys,{children:o?r.jsx(Mr,{children:r.jsx(kt,{colSpan:5,className:"text-center py-8",children:"Loading reviews..."})}):(l==null?void 0:l.length)===0?r.jsx(Mr,{children:r.jsx(kt,{colSpan:5,className:"text-center py-8 text-muted-foreground",children:"No reviews found"})}):l==null?void 0:l.map(b=>{var S,k;return r.jsxs(Mr,{className:"cursor-pointer hover:bg-muted/50",onClick:()=>s(b),children:[r.jsx(kt,{children:r.jsxs("div",{children:[r.jsx("div",{className:"font-medium",children:((S=b.profiles)==null?void 0:S.name)||"Unknown"}),r.jsx("div",{className:"text-sm text-muted-foreground",children:(k=b.profiles)==null?void 0:k.email})]})}),r.jsx(kt,{children:x(b.rating)}),r.jsx(kt,{className:"hidden md:table-cell max-w-xs",children:r.jsx("p",{className:"truncate text-sm text-muted-foreground",children:b.review_text||"-"})}),r.jsx(kt,{children:b.posted_to_google?r.jsx(Pt,{variant:"secondary",className:"bg-green-100 text-green-800",children:"Posted"}):r.jsx(Pt,{variant:"outline",children:"No"})}),r.jsx(kt,{className:"text-sm text-muted-foreground",children:on(new Date(b.created_at),"MMM d, yyyy")})]},b.id)})})]})})}),r.jsx(Or,{open:!!n,onOpenChange:()=>s(null),children:r.jsxs(Ir,{className:"max-w-lg",children:[r.jsx($r,{children:r.jsx(Fr,{children:"Review Details"})}),n&&r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-start gap-4 p-4 bg-muted/50 rounded-lg",children:[r.jsxs("div",{className:"flex-1",children:[r.jsx("h3",{className:"font-semibold text-lg",children:((y=n.profiles)==null?void 0:y.name)||"Unknown Member"}),((_=n.profiles)==null?void 0:_.email)&&r.jsxs("a",{href:`mailto:${n.profiles.email}`,className:"flex items-center gap-1 text-sm text-muted-foreground hover:text-primary",children:[r.jsx(Ns,{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(Ss,{className:"h-4 w-4"}),on(new Date(n.created_at),"MMMM d, yyyy 'at' h:mm a")]}),n.posted_to_google?r.jsxs(Pt,{variant:"secondary",className:"bg-green-100 text-green-800",children:[r.jsx(As,{className:"h-3 w-3 mr-1"}),"Posted to Google"]}):r.jsx(Pt,{variant:"outline",children:"Not posted to Google"})]})]})]})})]})})},iJt=[{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"}],oJt=Array.from({length:24},(e,t)=>({value:String(t),label:t===0?"12:00 AM":t<12?`${t}:00 AM`:t===12?"12:00 PM":`${t-12}:00 PM`}));function lJt(){const e=Hr(),{user:t}=tn(),[n,s]=E.useState(!1),[a,o]=E.useState(!1),[l,i]=E.useState(!1),{data:u,isLoading:p}=Kt({queryKey:["weekly-digest-settings"],queryFn:async()=>{const{data:W,error:G}=await Q.from("weekly_digest_settings").select("*").single();if(G)throw G;return W}}),{data:x,isLoading:y}=Kt({queryKey:["weekly-digest-logs"],queryFn:async()=>{const{data:W,error:G}=await Q.from("weekly_digest_logs").select("*").order("sent_at",{ascending:!1}).limit(100);if(G)throw G;return W}}),{data:_}=Kt({queryKey:["digest-subscriber-count"],queryFn:async()=>{const{count:W,error:G}=await Q.from("profiles").select("id",{count:"exact",head:!0}).eq("digest_opt_out",!1).not("email","is",null);if(G)throw G;return W||0}}),{data:b,refetch:S}=Kt({queryKey:["digest-queue-status"],queryFn:async()=>{const W=new Date;W.setUTCHours(0,0,0,0);const[G,J,ne,oe]=await Promise.all([Q.from("weekly_digest_send_queue").select("id",{count:"exact",head:!0}).eq("status","pending").gte("created_at",W.toISOString()),Q.from("weekly_digest_send_queue").select("id",{count:"exact",head:!0}).eq("status","processing").gte("created_at",W.toISOString()),Q.from("weekly_digest_send_queue").select("id",{count:"exact",head:!0}).eq("status","sent").gte("created_at",W.toISOString()),Q.from("weekly_digest_send_queue").select("id",{count:"exact",head:!0}).eq("status","failed").gte("created_at",W.toISOString())]);return{pending:G.count||0,processing:J.count||0,sent:ne.count||0,failed:oe.count||0,total:(G.count||0)+(J.count||0)+(ne.count||0)+(oe.count||0)}},refetchInterval:5e3});E.useEffect(()=>{if(b&&(b.pending>0||b.processing>0)){const W=setInterval(()=>{S(),e.invalidateQueries({queryKey:["weekly-digest-logs"]}),e.invalidateQueries({queryKey:["digest-today-failed-count"]}),e.invalidateQueries({queryKey:["digest-today-missing-count"]})},5e3);return()=>clearInterval(W)}},[b,S,e]);const{data:k=0}=Kt({queryKey:["digest-today-failed-count"],queryFn:async()=>{const W=new Date;W.setUTCHours(0,0,0,0);const{count:G,error:J}=await Q.from("weekly_digest_logs").select("id",{count:"exact",head:!0}).eq("delivery_status","failed").gte("sent_at",W.toISOString());if(J)throw J;return G||0}}),M=ir({mutationFn:async W=>{const{error:G}=await Q.from("weekly_digest_settings").update(W).eq("id",u==null?void 0:u.id);if(G)throw G},onSuccess:()=>{e.invalidateQueries({queryKey:["weekly-digest-settings"]}),Ie.success("Settings updated")},onError:W=>{Ie.error("Failed to update settings: "+W.message)}}),P=async()=>{s(!0);try{const{data:W,error:G}=await Q.functions.invoke("send-weekly-digest",{body:{manual:!0}});if(G)throw G;W.queued?Ie.success(`${W.queued.toLocaleString()} emails queued! They'll be sent automatically (~80/minute).`):W.sent!==void 0&&Ie.success(`Digest sent! ${W.sent} emails delivered, ${W.failed} failed`),S(),e.invalidateQueries({queryKey:["weekly-digest-logs"]})}catch(W){Ie.error("Failed to send digest: "+W.message)}finally{s(!1)}},T=async()=>{var W,G,J,ne,oe,ge;if(!(t!=null&&t.email)){Ie.error("No email found for your account");return}o(!0);try{const{data:ie,error:pe}=await Q.functions.invoke("send-weekly-digest",{body:{preview:!0,previewEmail:t.email}});if(pe)throw pe;const se=ie==null?void 0:ie.resendId,fe=ie==null?void 0:ie.resendDetails,he=fe==null?void 0:fe.status,ye=((W=fe==null?void 0:fe.body)==null?void 0:W.status)||((J=(G=fe==null?void 0:fe.body)==null?void 0:G.data)==null?void 0:J.status),Ae=((oe=(ne=fe==null?void 0:fe.body)==null?void 0:ne.error)==null?void 0:oe.message)||((ge=fe==null?void 0:fe.body)==null?void 0:ge.message);Ie.success(se?`Preview accepted by email provider (id: ${se})${he?`, status check: ${he}`:""}${ye?`, provider: ${ye}`:""}${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(ie){Ie.error("Failed to send preview: "+ie.message)}finally{o(!1)}},I=async()=>{i(!0);try{const{data:W,error:G}=await Q.functions.invoke("send-weekly-digest",{body:{retryFailed:!0}});if(G)throw G;W.queued===0||W.sent===0&&W.failed===0&&!W.queued?Ie.info("No failed emails to retry"):W.queued?Ie.success(`${W.queued} emails queued for retry!`):Ie.success(`Retry complete! ${W.sent} emails delivered, ${W.failed} failed`),S(),e.invalidateQueries({queryKey:["weekly-digest-logs"]}),e.invalidateQueries({queryKey:["digest-today-failed-count"]}),e.invalidateQueries({queryKey:["digest-today-missing-count"]})}catch(W){Ie.error("Failed to retry: "+W.message)}finally{i(!1)}},z=b!=null&&b.total?Math.round((b.sent+b.failed)/b.total*100):0,D=((b==null?void 0:b.pending)||0)>0||((b==null?void 0:b.processing)||0)>0,{data:U}=Kt({queryKey:["digest-delivery-stats"],queryFn:async()=>{var ge,ie;const W=new Date;W.setUTCHours(0,0,0,0);const[G,J,ne,oe]=await Promise.all([Q.from("weekly_digest_logs").select("id",{count:"exact",head:!0}).eq("delivery_status","sent").gte("sent_at",W.toISOString()),Q.from("weekly_digest_logs").select("id",{count:"exact",head:!0}).eq("delivery_status","failed").gte("sent_at",W.toISOString()),Q.from("weekly_digest_logs").select("id",{count:"exact",head:!0}).eq("has_agent_os_activity",!0).gte("sent_at",W.toISOString()),Q.from("weekly_digest_logs").select("sent_at").order("sent_at",{ascending:!1}).limit(1)]);return{totalSent:G.count||0,totalFailed:J.count||0,agentOsEngaged:ne.count||0,lastSent:((ie=(ge=oe.data)==null?void 0:ge[0])==null?void 0:ie.sent_at)||null}},refetchInterval:D?5e3:!1}),V={totalSent:(U==null?void 0:U.totalSent)||0,totalFailed:(U==null?void 0:U.totalFailed)||0,lastSent:U==null?void 0:U.lastSent,agentOsEngaged:(U==null?void 0:U.agentOsEngaged)||0};return p?r.jsx(Dr,{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(Dr,{title:"Weekly Digest",description:"Configure and manage automated weekly email digests for members",children:r.jsxs(Ai,{defaultValue:"settings",className:"space-y-6",children:[r.jsxs(vi,{children:[r.jsxs(sn,{value:"settings",className:"flex items-center gap-2",children:[r.jsx(Fd,{className:"h-4 w-4"}),"Settings"]}),r.jsxs(sn,{value:"stats",className:"flex items-center gap-2",children:[r.jsx(_c,{className:"h-4 w-4"}),"Delivery Stats"]})]}),r.jsxs(Mn,{value:"settings",className:"space-y-6",children:[D&&b&&r.jsx(Ze,{className:"border-primary/50 bg-primary/5",children:r.jsxs(et,{className:"pt-6",children:[r.jsxs("div",{className:"flex items-center gap-4 mb-4",children:[r.jsx(Zr,{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:[b.sent.toLocaleString()," sent, ",b.pending.toLocaleString()," pending",b.failed>0&&`, ${b.failed} failed`]})]}),r.jsxs("span",{className:"text-sm font-medium",children:[z,"%"]})]}),r.jsx(pd,{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(b.pending/80)," min"]})]})}),r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-4 gap-4",children:[r.jsx(Ze,{children:r.jsx(et,{className:"pt-6",children:r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx("div",{className:"p-3 rounded-full bg-primary/10",children:r.jsx(Un,{className:"h-5 w-5 text-primary"})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-2xl font-bold",children:_}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Subscribers"})]})]})})}),r.jsx(Ze,{children:r.jsx(et,{className:"pt-6",children:r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx("div",{className:"p-3 rounded-full bg-emerald-500/10",children:r.jsx(so,{className:"h-5 w-5 text-emerald-500"})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-2xl font-bold",children:V.totalSent}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Delivered"})]})]})})}),r.jsx(Ze,{children:r.jsx(et,{className:"pt-6",children:r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx("div",{className:"p-3 rounded-full bg-destructive/10",children:r.jsx(bc,{className:"h-5 w-5 text-destructive"})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-2xl font-bold",children:V.totalFailed}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Failed"})]})]})})}),r.jsx(Ze,{children:r.jsx(et,{className:"pt-6",children:r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx("div",{className:"p-3 rounded-full bg-primary/10",children:r.jsx(Ya,{className:"h-5 w-5 text-primary"})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-2xl font-bold",children:V.lastSent?on(new Date(V.lastSent),"MMM d"):"Never"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Last Sent"})]})]})})})]}),r.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[r.jsxs(Ze,{children:[r.jsxs(Wt,{children:[r.jsxs(Yt,{className:"flex items-center gap-2",children:[r.jsx(Ya,{className:"h-5 w-5"}),"Schedule"]}),r.jsx(Sn,{children:"Configure when the digest is sent"})]}),r.jsxs(et,{className:"space-y-6",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{children:[r.jsx($e,{children:"Enable Weekly Digest"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Send automated weekly emails to members"})]}),r.jsx(Ts,{checked:u==null?void 0:u.is_enabled,onCheckedChange:W=>M.mutate({is_enabled:W})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{children:"Cron Frequency"}),r.jsxs(mn,{value:(u==null?void 0:u.cron_frequency)||"daily",onValueChange:W=>M.mutate({cron_frequency:W}),children:[r.jsx(fn,{children:r.jsx(yn,{})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"daily",children:"Daily (runs once at selected time)"}),r.jsx(qt,{value:"hourly",children:"Hourly (checks every hour)"})]})]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:(u==null?void 0:u.cron_frequency)==="hourly"?"Cron runs every hour; digest sends when day & hour match.":"Cron runs once daily at the selected hour (UTC)."})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{children:"Day of Week"}),r.jsxs(mn,{value:String(u==null?void 0:u.send_day),onValueChange:W=>M.mutate({send_day:parseInt(W)}),children:[r.jsx(fn,{children:r.jsx(yn,{})}),r.jsx(pn,{children:iJt.map(W=>r.jsx(qt,{value:W.value,children:W.label},W.value))})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{children:"Time (UTC)"}),r.jsxs(mn,{value:String(u==null?void 0:u.send_hour),onValueChange:W=>M.mutate({send_hour:parseInt(W)}),disabled:(u==null?void 0:u.cron_frequency)==="daily",children:[r.jsx(fn,{children:r.jsx(yn,{})}),r.jsx(pn,{children:oJt.map(W=>r.jsx(qt,{value:W.value,children:W.label},W.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(Ko,{className:"h-4 w-4 mr-2"}),a?"Sending...":"Send Preview to Me"]}),r.jsxs(ee,{onClick:P,disabled:n,className:"flex-1",children:[r.jsx(lo,{className:"h-4 w-4 mr-2"}),n?"Sending...":"Send to All"]})]}),k>0&&r.jsxs(ee,{onClick:I,disabled:l,variant:"outline",className:"w-full",children:[r.jsx(qo,{className:`h-4 w-4 mr-2 ${l?"animate-spin":""}`}),l?"Retrying...":`Retry ${k} Failed`]})]})]})]}),r.jsxs(Ze,{children:[r.jsxs(Wt,{children:[r.jsxs(Yt,{className:"flex items-center gap-2",children:[r.jsx(Ea,{className:"h-5 w-5"}),"Content Sections"]}),r.jsx(Sn,{children:"Choose what to include in the digest"})]}),r.jsxs(et,{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ea,{className:"h-4 w-4 text-muted-foreground"}),r.jsx($e,{children:"New Resources"})]}),r.jsx(Ts,{checked:u==null?void 0:u.include_new_resources,onCheckedChange:W=>M.mutate({include_new_resources:W})})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Un,{className:"h-4 w-4 text-muted-foreground"}),r.jsx($e,{children:"Community Highlights"})]}),r.jsx(Ts,{checked:u==null?void 0:u.include_community_posts,onCheckedChange:W=>M.mutate({include_community_posts:W})})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(_c,{className:"h-4 w-4 text-muted-foreground"}),r.jsx($e,{children:"Agent OS Stats"})]}),r.jsx(Ts,{checked:u==null?void 0:u.include_agent_os_stats,onCheckedChange:W=>M.mutate({include_agent_os_stats:W})})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ss,{className:"h-4 w-4 text-muted-foreground"}),r.jsx($e,{children:"Upcoming Events"})]}),r.jsx(Ts,{checked:u==null?void 0:u.include_upcoming_events,onCheckedChange:W=>M.mutate({include_upcoming_events:W})})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(my,{className:"h-4 w-4 text-muted-foreground"}),r.jsx($e,{children:"Goals Progress"})]}),r.jsx(Ts,{checked:u==null?void 0:u.include_goals_progress,onCheckedChange:W=>M.mutate({include_goals_progress:W})})]})]})]})]}),r.jsxs(Ze,{children:[r.jsxs(Wt,{children:[r.jsx(Yt,{children:"Custom Introduction"}),r.jsx(Sn,{children:"Personalize the intro message (optional)"})]}),r.jsx(et,{children:r.jsx(Jn,{placeholder:"Here's what's new this week to help you grow your business...",value:(u==null?void 0:u.custom_intro_text)||"",onChange:W=>M.mutate({custom_intro_text:W.target.value||null}),rows:3})})]})]}),r.jsx(Mn,{value:"stats",children:r.jsxs(Ze,{children:[r.jsxs(Wt,{children:[r.jsxs(Yt,{className:"flex items-center gap-2",children:[r.jsx(Ns,{className:"h-5 w-5"}),"Delivery History"]}),r.jsx(Sn,{children:"Recent digest emails sent to members"})]}),r.jsx(et,{children:y?r.jsx("div",{className:"animate-pulse space-y-2",children:[1,2,3,4,5].map(W=>r.jsx("div",{className:"h-12 bg-muted rounded"},W))}):x&&x.length>0?r.jsxs(Ks,{children:[r.jsx(Zs,{children:r.jsxs(Mr,{children:[r.jsx(It,{children:"Email"}),r.jsx(It,{children:"Sent At"}),r.jsx(It,{children:"Status"}),r.jsx(It,{children:"Resources"}),r.jsx(It,{children:"Agent OS"})]})}),r.jsx(Ys,{children:x.map(W=>r.jsxs(Mr,{children:[r.jsx(kt,{className:"font-medium",children:W.email_sent_to}),r.jsx(kt,{children:on(new Date(W.sent_at),"MMM d, yyyy h:mm a")}),r.jsx(kt,{children:r.jsx(Pt,{variant:W.delivery_status==="sent"?"default":"destructive",children:W.delivery_status})}),r.jsx(kt,{children:W.resources_count}),r.jsx(kt,{children:W.has_agent_os_activity?r.jsx(Pt,{variant:"secondary",children:"Active"}):r.jsx(Pt,{variant:"outline",children:"Not Started"})})]},W.id))})]}):r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(Ns,{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 cJt={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 dJt(){var be,_e,Je;const e=Hr(),[t,n]=E.useState(""),[s,a]=E.useState(null),[o,l]=E.useState(!1),[i,u]=E.useState(!1),[p,x]=E.useState(""),[y,_]=E.useState(""),[b,S]=E.useState(!0),[k,M]=E.useState(!1),[P,T]=E.useState(""),[I,z]=E.useState(null),{data:D,isLoading:U}=Kt({queryKey:["admin-agent-points"],queryFn:async()=>{const{data:Te,error:De}=await Q.from("agent_attendance_stats").select("*").order("total_points",{ascending:!1});if(De)throw De;const Ue=(Te==null?void 0:Te.map(ot=>ot.user_id))||[],{data:Be}=await Q.from("profiles").select("id, name, email").in("id",Ue),qe=new Map((Be==null?void 0:Be.map(ot=>[ot.id,{name:ot.name,email:ot.email}]))||[]);return Te==null?void 0:Te.map(ot=>({...ot,profile:qe.get(ot.user_id)||null}))}}),{data:V}=Kt({queryKey:["all-profiles-for-points",D],queryFn:async()=>{const{data:Te,error:De}=await Q.from("profiles").select("id, name, email").order("name");if(De)throw De;return Te}}),G=((V==null?void 0:V.filter(Te=>!(D!=null&&D.some(De=>De.user_id===Te.id))))||[]).filter(Te=>{var Ue,Be;if(!P)return!0;const De=P.toLowerCase();return((Ue=Te.name)==null?void 0:Ue.toLowerCase().includes(De))||((Be=Te.email)==null?void 0:Be.toLowerCase().includes(De))}),{data:J,isLoading:ne}=Kt({queryKey:["agent-point-history",s==null?void 0:s.user_id],queryFn:async()=>{if(!(s!=null&&s.user_id))return[];const{data:Te,error:De}=await Q.from("agent_points").select("*").eq("user_id",s.user_id).order("created_at",{ascending:!1});if(De)throw De;return Te},enabled:!!(s!=null&&s.user_id)&&i}),{data:oe}=Kt({queryKey:["agent-badges",s==null?void 0:s.user_id],queryFn:async()=>{if(!(s!=null&&s.user_id))return[];const{data:Te,error:De}=await Q.from("agent_badges").select("*").eq("user_id",s.user_id).order("earned_at",{ascending:!1});if(De)throw De;return Te},enabled:!!(s!=null&&s.user_id)}),ge=ir({mutationFn:async({userId:Te,points:De,reason:Ue})=>{const{error:Be}=await Q.from("agent_points").insert({user_id:Te,points:De,reason:Ue});if(Be)throw Be;const{data:qe}=await Q.from("agent_attendance_stats").select("total_points, spendable_points").eq("user_id",Te).maybeSingle(),ot=((qe==null?void 0:qe.total_points)||0)+De,Mt=((qe==null?void 0:qe.spendable_points)||0)+De,{error:Oe}=await Q.from("agent_attendance_stats").upsert({user_id:Te,total_points:Math.max(0,ot),spendable_points:Math.max(0,Mt),updated_at:new Date().toISOString()},{onConflict:"user_id"});if(Oe)throw Oe},onSuccess:()=>{e.invalidateQueries({queryKey:["admin-agent-points"]}),e.invalidateQueries({queryKey:["agent-point-history"]}),l(!1),x(""),_(""),Ie.success(b?"Points awarded successfully!":"Points deducted successfully!")},onError:Te=>{console.error("Error modifying points:",Te),Ie.error("Failed to modify points")}}),ie=()=>{if(!s||!p||!y){Ie.error("Please fill in all fields");return}const Te=parseInt(p);if(isNaN(Te)||Te<=0){Ie.error("Please enter a valid positive number");return}ge.mutate({userId:s.user_id,points:b?Te:-Te,reason:y})},pe=()=>{if(!I||!p||!y){Ie.error("Please fill in all fields");return}const Te=parseInt(p);if(isNaN(Te)||Te<=0){Ie.error("Please enter a valid positive number");return}ge.mutate({userId:I.id,points:Te,reason:y},{onSuccess:()=>{M(!1),z(null),T("")}})},se=(Te,De)=>{a(Te),S(De),l(!0)},fe=Te=>{a(Te),u(!0)},he=D==null?void 0:D.filter(Te=>{var qe,ot,Mt,Oe;const De=((ot=(qe=Te.profile)==null?void 0:qe.name)==null?void 0:ot.toLowerCase())||"",Ue=((Oe=(Mt=Te.profile)==null?void 0:Mt.email)==null?void 0:Oe.toLowerCase())||"",Be=t.toLowerCase();return De.includes(Be)||Ue.includes(Be)}),ye=(D==null?void 0:D.reduce((Te,De)=>Te+De.total_points,0))||0,Ae=(D==null?void 0:D.length)||0,we=Ae>0?Math.round(ye/Ae):0;return U?r.jsx(Dr,{title:"Agent Points",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Lr,{className:"h-8 w-64"}),r.jsx("div",{className:"grid grid-cols-3 gap-4",children:[1,2,3].map(Te=>r.jsx(Lr,{className:"h-24"},Te))}),r.jsx(Lr,{className:"h-96"})]})}):r.jsx(Dr,{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(Ze,{children:r.jsxs(et,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(Un,{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(Ze,{children:r.jsxs(et,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(ro,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs font-medium",children:"Total Points"})]}),r.jsx("p",{className:"text-2xl font-bold",children:ye.toLocaleString()}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"awarded across all agents"})]})}),r.jsx(Ze,{children:r.jsxs(et,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(fp,{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:we}),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(Sa,{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:t,onChange:Te=>n(Te.target.value),className:"pl-10"})]}),r.jsxs(ee,{onClick:()=>M(!0),children:[r.jsx(bn,{className:"h-4 w-4 mr-2"}),"Award Points to New Agent"]})]}),r.jsxs(Ze,{children:[r.jsxs(Wt,{children:[r.jsx(Yt,{children:"Agent Leaderboard"}),r.jsx(Sn,{children:"All agents with their points, events, and streaks"})]}),r.jsx(et,{children:!he||he.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(ro,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),r.jsx("p",{children:"No agents with points yet"})]}):r.jsxs(Ks,{children:[r.jsx(Zs,{children:r.jsxs(Mr,{children:[r.jsx(It,{className:"w-12",children:"#"}),r.jsx(It,{children:"Agent"}),r.jsx(It,{className:"text-center",children:"Total Points"}),r.jsx(It,{className:"text-center",children:"Spendable"}),r.jsx(It,{className:"text-center",children:"Events"}),r.jsx(It,{className:"text-center",children:"Streak"}),r.jsx(It,{className:"text-right",children:"Actions"})]})}),r.jsx(Ys,{children:he.map((Te,De)=>{var Ue,Be,qe,ot;return r.jsxs(Mr,{children:[r.jsx(kt,{className:"font-medium",children:De<3?r.jsx("div",{className:`w-6 h-6 rounded-full flex items-center justify-center ${De===0?"bg-yellow-100 text-yellow-700":De===1?"bg-gray-100 text-gray-600":"bg-amber-100 text-amber-700"}`,children:De+1}):r.jsx("span",{className:"text-muted-foreground",children:De+1})}),r.jsx(kt,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx(Qs,{className:"h-8 w-8",children:r.jsx(Js,{children:((Be=(Ue=Te.profile)==null?void 0:Ue.name)==null?void 0:Be.charAt(0))||"?"})}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:((qe=Te.profile)==null?void 0:qe.name)||"Unknown"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:(ot=Te.profile)==null?void 0:ot.email})]})]})}),r.jsx(kt,{className:"text-center",children:r.jsxs(Pt,{variant:"secondary",className:"font-bold",children:[r.jsx(js,{className:"h-3 w-3 mr-1"}),Te.total_points]})}),r.jsx(kt,{className:"text-center",children:r.jsxs(Pt,{variant:"outline",className:"font-bold text-primary",children:[r.jsx(to,{className:"h-3 w-3 mr-1"}),Te.spendable_points||0]})}),r.jsx(kt,{className:"text-center",children:r.jsxs("div",{className:"flex items-center justify-center gap-1",children:[r.jsx(Ss,{className:"h-3 w-3 text-muted-foreground"}),Te.total_events_attended]})}),r.jsx(kt,{className:"text-center",children:r.jsxs("div",{className:"flex items-center justify-center gap-1",children:[r.jsx(ff,{className:"h-3 w-3 text-orange-500"}),Te.current_streak]})}),r.jsx(kt,{className:"text-right",children:r.jsxs("div",{className:"flex items-center justify-end gap-1",children:[r.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>se(Te,!0),title:"Award points",children:r.jsx(bn,{className:"h-4 w-4 text-green-600"})}),r.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>se(Te,!1),title:"Deduct points",children:r.jsx(G1,{className:"h-4 w-4 text-red-600"})}),r.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>fe(Te),title:"View history",children:r.jsx(jS,{className:"h-4 w-4"})})]})})]},Te.user_id)})})]})})]}),r.jsx(Or,{open:o,onOpenChange:l,children:r.jsxs(Ir,{children:[r.jsxs($r,{children:[r.jsx(Fr,{children:b?"Award Points":"Deduct Points"}),r.jsxs(Zn,{children:[b?"Award":"Deduct"," points ",b?"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($e,{htmlFor:"points",children:"Points Amount"}),r.jsx(dt,{id:"points",type:"number",min:"1",placeholder:"Enter points...",value:p,onChange:Te=>x(Te.target.value)})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{htmlFor:"reason",children:"Reason"}),r.jsx(Jn,{id:"reason",placeholder:"Enter reason for this adjustment...",value:y,onChange:Te=>_(Te.target.value)})]})]}),r.jsxs(Bs,{children:[r.jsx(ee,{variant:"outline",onClick:()=>l(!1),children:"Cancel"}),r.jsx(ee,{onClick:ie,disabled:ge.isPending,className:b?"bg-green-600 hover:bg-green-700":"bg-red-600 hover:bg-red-700",children:ge.isPending?"Saving...":b?"Award Points":"Deduct Points"})]})]})}),r.jsx(Or,{open:i,onOpenChange:u,children:r.jsxs(Ir,{className:"max-w-2xl",children:[r.jsxs($r,{children:[r.jsxs(Fr,{children:["Point History: ",(_e=s==null?void 0:s.profile)==null?void 0:_e.name]}),r.jsx(Zn,{children:"View all point transactions and badges for this agent"})]}),r.jsxs(Ai,{defaultValue:"history",className:"w-full",children:[r.jsxs(vi,{className:"grid w-full grid-cols-2",children:[r.jsx(sn,{value:"history",children:"Point History"}),r.jsx(sn,{value:"badges",children:"Badges"})]}),r.jsx(Mn,{value:"history",className:"mt-4",children:ne?r.jsx("div",{className:"space-y-2",children:[1,2,3].map(Te=>r.jsx(Lr,{className:"h-12"},Te))}):!J||J.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(jS,{className:"h-8 w-8 mx-auto mb-2 opacity-50"}),r.jsx("p",{children:"No point history yet"})]}):r.jsx("div",{className:"max-h-80 overflow-y-auto space-y-2",children:J.map(Te=>r.jsxs("div",{className:"flex items-center justify-between p-3 border rounded-lg",children:[r.jsxs("div",{className:"flex-1",children:[r.jsx("p",{className:"font-medium",children:Te.reason}),r.jsx("p",{className:"text-xs text-muted-foreground",children:on(new Date(Te.created_at),"MMM d, yyyy h:mm a")})]}),r.jsxs(Pt,{variant:Te.points>=0?"default":"destructive",className:Te.points>=0?"bg-green-100 text-green-800":"",children:[Te.points>=0?"+":"",Te.points]})]},Te.id))})}),r.jsx(Mn,{value:"badges",className:"mt-4",children:!oe||oe.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(zl,{className:"h-8 w-8 mx-auto mb-2 opacity-50"}),r.jsx("p",{children:"No badges earned yet"})]}):r.jsx("div",{className:"grid grid-cols-2 gap-3",children:oe.map(Te=>r.jsxs("div",{className:`p-3 rounded-lg ${cJt[Te.badge_type]||"bg-gray-100"}`,children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(zl,{className:"h-5 w-5"}),r.jsx("span",{className:"font-medium",children:Te.badge_name})]}),Te.badge_description&&r.jsx("p",{className:"text-xs mt-1 opacity-80",children:Te.badge_description}),r.jsxs("p",{className:"text-xs mt-1 opacity-60",children:["Earned ",on(new Date(Te.earned_at),"MMM d, yyyy")]})]},Te.id))})})]})]})}),r.jsx(Or,{open:k,onOpenChange:Te=>{M(Te),Te||(z(null),T(""),x(""),_(""))},children:r.jsxs(Ir,{className:"max-w-md",children:[r.jsxs($r,{children:[r.jsx(Fr,{children:"Award Points to New Agent"}),r.jsx(Zn,{children:"Select an agent who doesn't have points yet and award them points"})]}),r.jsx("div",{className:"space-y-4 py-4",children:I?r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"flex items-center gap-3 p-3 bg-muted/50 rounded-lg",children:[r.jsx(Qs,{className:"h-10 w-10",children:r.jsx(Js,{children:((Je=I.name)==null?void 0:Je.charAt(0))||"?"})}),r.jsxs("div",{className:"flex-1",children:[r.jsx("p",{className:"font-medium",children:I.name||"Unknown"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:I.email})]}),r.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>z(null),children:"Change"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{htmlFor:"new-points",children:"Points Amount"}),r.jsx(dt,{id:"new-points",type:"number",min:"1",placeholder:"Enter points...",value:p,onChange:Te=>x(Te.target.value)})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{htmlFor:"new-reason",children:"Reason"}),r.jsx(Jn,{id:"new-reason",placeholder:"Enter reason for awarding points...",value:y,onChange:Te=>_(Te.target.value)})]})]}):r.jsxs(r.Fragment,{children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{children:"Search Agent"}),r.jsxs("div",{className:"relative",children:[r.jsx(Sa,{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:P,onChange:Te=>T(Te.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(Un,{className:"h-6 w-6 mx-auto mb-2 opacity-50"}),r.jsx("p",{className:"text-sm",children:P?"No matching agents found":"All agents already have points"})]}):G.slice(0,20).map(Te=>{var De;return r.jsxs("button",{onClick:()=>z(Te),className:"w-full flex items-center gap-3 p-3 hover:bg-muted/50 transition-colors border-b last:border-b-0 text-left",children:[r.jsx(Qs,{className:"h-8 w-8",children:r.jsx(Js,{children:((De=Te.name)==null?void 0:De.charAt(0))||"?"})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"font-medium truncate",children:Te.name||"Unknown"}),r.jsx("p",{className:"text-xs text-muted-foreground truncate",children:Te.email})]})]},Te.id)})})]})}),r.jsxs(Bs,{children:[r.jsx(ee,{variant:"outline",onClick:()=>M(!1),children:"Cancel"}),I&&r.jsxs(ee,{onClick:pe,disabled:ge.isPending,className:"bg-green-600 hover:bg-green-700",children:[r.jsx(bn,{className:"h-4 w-4 mr-2"}),"Award Points"]})]})]})})]})})}function uJt(){const{data:e,isLoading:t}=Nct(),[n,s]=E.useState(null),[a,o]=E.useState(!1),[l,i]=E.useState(""),[u,p]=E.useState("all"),[x,y]=E.useState("newest"),[_,b]=E.useState("table"),S=E.useMemo(()=>(e==null?void 0:e.map(I=>I.user_id))||[],[e]),k=E.useMemo(()=>(e==null?void 0:e.map(I=>I.id))||[],[e]),{data:M}=Kt({queryKey:["card-profiles-lookup",S],queryFn:async()=>{if(S.length===0)return{};const{data:I}=await Q.from("profiles").select("id, name, email").in("id",S),z={};return I==null||I.forEach(D=>{z[D.id]={name:D.name||"",email:D.email||""}}),z},enabled:S.length>0}),{data:P}=Kt({queryKey:["card-stats-all",k],queryFn:async()=>{if(k.length===0)return{};const I={};k.forEach(U=>{I[U]={views:0,leads:0}});const{data:z}=await Q.from("agent_card_interactions").select("card_id").in("card_id",k).eq("interaction_type","card_view");z==null||z.forEach(U=>{I[U.card_id]&&I[U.card_id].views++});const{data:D}=await Q.from("agent_card_leads").select("card_id").in("card_id",k);return D==null||D.forEach(U=>{I[U.card_id]&&I[U.card_id].leads++}),I},enabled:k.length>0}),T=E.useMemo(()=>{if(!e)return[];let I=[...e];if(u==="live"?I=I.filter(z=>z.is_published):u==="draft"&&(I=I.filter(z=>!z.is_published)),l.trim()){const z=l.toLowerCase();I=I.filter(D=>{var V,W;const U=M==null?void 0:M[D.user_id];return D.slug.toLowerCase().includes(z)||((V=U==null?void 0:U.name)==null?void 0:V.toLowerCase().includes(z))||((W=U==null?void 0:U.email)==null?void 0:W.toLowerCase().includes(z))})}return x==="newest"?I.sort((z,D)=>new Date(D.created_at).getTime()-new Date(z.created_at).getTime()):x==="oldest"?I.sort((z,D)=>new Date(z.created_at).getTime()-new Date(D.created_at).getTime()):x==="name"?I.sort((z,D)=>{var U,V;return(((U=M==null?void 0:M[z.user_id])==null?void 0:U.name)||"").localeCompare(((V=M==null?void 0:M[D.user_id])==null?void 0:V.name)||"")}):x==="slug"?I.sort((z,D)=>z.slug.localeCompare(D.slug)):x==="views_desc"?I.sort((z,D)=>{var U,V;return(((U=P==null?void 0:P[D.id])==null?void 0:U.views)||0)-(((V=P==null?void 0:P[z.id])==null?void 0:V.views)||0)}):x==="views_asc"?I.sort((z,D)=>{var U,V;return(((U=P==null?void 0:P[z.id])==null?void 0:U.views)||0)-(((V=P==null?void 0:P[D.id])==null?void 0:V.views)||0)}):x==="leads_desc"?I.sort((z,D)=>{var U,V;return(((U=P==null?void 0:P[D.id])==null?void 0:U.leads)||0)-(((V=P==null?void 0:P[z.id])==null?void 0:V.leads)||0)}):x==="leads_asc"&&I.sort((z,D)=>{var U,V;return(((U=P==null?void 0:P[z.id])==null?void 0:U.leads)||0)-(((V=P==null?void 0:P[D.id])==null?void 0:V.leads)||0)}),I},[e,u,l,x,M]);return r.jsxs(Dr,{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(Sa,{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:I=>i(I.target.value),className:"pl-9"})]}),r.jsxs(mn,{value:u,onValueChange:p,children:[r.jsx(fn,{className:"w-full sm:w-36",children:r.jsx(yn,{placeholder:"Status"})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"all",children:"All Status"}),r.jsx(qt,{value:"live",children:"Live"}),r.jsx(qt,{value:"draft",children:"Draft"})]})]}),r.jsxs(mn,{value:x,onValueChange:y,children:[r.jsx(fn,{className:"w-full sm:w-44",children:r.jsx(yn,{placeholder:"Sort by"})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"newest",children:"Newest First"}),r.jsx(qt,{value:"oldest",children:"Oldest First"}),r.jsx(qt,{value:"name",children:"Name A–Z"}),r.jsx(qt,{value:"slug",children:"Slug A–Z"}),r.jsx(qt,{value:"views_desc",children:"Most Views"}),r.jsx(qt,{value:"views_asc",children:"Fewest Views"}),r.jsx(qt,{value:"leads_desc",children:"Most Leads"}),r.jsx(qt,{value:"leads_asc",children:"Fewest Leads"})]})]}),r.jsxs("div",{className:"flex border rounded-md",children:[r.jsx(ee,{variant:_==="table"?"default":"ghost",size:"sm",onClick:()=>b("table"),className:"rounded-r-none",children:r.jsx(OS,{className:"h-4 w-4"})}),r.jsx(ee,{variant:_==="grid"?"default":"ghost",size:"sm",onClick:()=>b("grid"),className:"rounded-l-none",children:r.jsx(dp,{className:"h-4 w-4"})})]})]}),!t&&e&&e.length>0&&r.jsxs("p",{className:"text-sm text-muted-foreground",children:["Showing ",T.length," of ",e.length," cards"]}),t?r.jsx("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:[1,2,3].map(I=>r.jsx(Lr,{className:"h-48"},I))}):T.length>0?_==="table"?r.jsx(hJt,{cards:T,cardProfiles:M,cardStats:P,onEdit:s,sortBy:x,setSortBy:y}):r.jsx("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:T.map(I=>r.jsx(fJt,{card:I,onEdit:()=>s(I),stats:P==null?void 0:P[I.id]},I.id))}):e&&e.length>0?r.jsx(Ze,{children:r.jsxs(et,{className:"flex flex-col items-center justify-center py-12",children:[r.jsx(Sa,{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(Ze,{children:r.jsxs(et,{className:"flex flex-col items-center justify-center py-12",children:[r.jsx(Un,{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(pJt,{open:a,onOpenChange:o}),n&&r.jsx(mJt,{card:n,open:!!n,onOpenChange:I=>!I&&s(null)})]})}function hJt({cards:e,cardProfiles:t,cardStats:n,onEdit:s,sortBy:a,setSortBy:o}){const l=u=>{a===`${u}_desc`?o(`${u}_asc`):o(`${u}_desc`)},i=({field:u})=>a===`${u}_desc`?r.jsx(ay,{className:"h-3 w-3"}):a===`${u}_asc`?r.jsx(cp,{className:"h-3 w-3"}):r.jsx(Pg,{className:"h-3 w-3 opacity-40"});return r.jsx(Ze,{children:r.jsx("div",{className:"overflow-x-auto",children:r.jsxs("table",{className:"w-full text-sm",children:[r.jsx("thead",{children:r.jsxs("tr",{className:"border-b bg-muted/50",children:[r.jsx("th",{className:"text-left p-3 font-medium",children:r.jsxs("button",{onClick:()=>{o(a==="name"?"newest":"name")},className:"flex items-center gap-1 hover:text-foreground text-muted-foreground",children:["Agent ",a==="name"&&r.jsx(cp,{className:"h-3 w-3"})]})}),r.jsx("th",{className:"text-left p-3 font-medium text-muted-foreground hidden md:table-cell",children:"Slug"}),r.jsx("th",{className:"text-center p-3 font-medium text-muted-foreground",children:"Status"}),r.jsx("th",{className:"text-right p-3 font-medium",children:r.jsxs("button",{onClick:()=>l("views"),className:"flex items-center gap-1 ml-auto hover:text-foreground text-muted-foreground",children:["Views ",r.jsx(i,{field:"views"})]})}),r.jsx("th",{className:"text-right p-3 font-medium",children:r.jsxs("button",{onClick:()=>l("leads"),className:"flex items-center gap-1 ml-auto hover:text-foreground text-muted-foreground",children:["Leads ",r.jsx(i,{field:"leads"})]})}),r.jsx("th",{className:"text-right p-3 font-medium text-muted-foreground",children:"Actions"})]})}),r.jsx("tbody",{children:e.map(u=>{const p=t==null?void 0:t[u.user_id],x=n==null?void 0:n[u.id],y=`https://cards.relevelup.com/${u.slug}`;return r.jsxs("tr",{className:"border-b last:border-0 hover:bg-muted/30 transition-colors",children:[r.jsx("td",{className:"p-3",children:r.jsxs("div",{children:[r.jsx("span",{className:"font-medium",children:(p==null?void 0:p.name)||"Unknown"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:(p==null?void 0:p.email)||""})]})}),r.jsx("td",{className:"p-3 hidden md:table-cell",children:r.jsxs("span",{className:"text-xs text-muted-foreground font-mono",children:["/",u.slug]})}),r.jsx("td",{className:"p-3 text-center",children:r.jsx(Pt,{variant:u.is_published?"default":"secondary",className:"text-xs",children:u.is_published?"Live":"Draft"})}),r.jsx("td",{className:"p-3 text-right tabular-nums font-medium",children:(x==null?void 0:x.views)??0}),r.jsx("td",{className:"p-3 text-right tabular-nums font-medium",children:(x==null?void 0:x.leads)??0}),r.jsx("td",{className:"p-3",children:r.jsxs("div",{className:"flex items-center justify-end gap-1",children:[r.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>s(u),className:"h-8 w-8 p-0",children:r.jsx(ni,{className:"h-3.5 w-3.5"})}),r.jsx(ee,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:()=>{navigator.clipboard.writeText(y),Ie.success("Link copied!")},children:r.jsx(Wo,{className:"h-3.5 w-3.5"})}),r.jsx(ee,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",asChild:!0,children:r.jsx("a",{href:y,target:"_blank",rel:"noopener noreferrer",children:r.jsx(As,{className:"h-3.5 w-3.5"})})})]})})]},u.id)})})]})})})}function fJt({card:e,onEdit:t,stats:n}){const[s,a]=E.useState(null);E.useEffect(()=>{(async()=>{const{data:u}=await Q.from("profiles").select("name").eq("id",e.user_id).single();let p=null;try{const{data:x}=await Q.storage.from("avatars").list(`${e.user_id}`);if(x&&x.length>0){const{data:y}=Q.storage.from("avatars").getPublicUrl(`${e.user_id}/${x[0].name}`);p=y.publicUrl}}catch{}a({name:(u==null?void 0:u.name)||"Unknown",avatar_url:p})})()},[e.user_id]);const o=`https://cards.relevelup.com/${e.slug}`,l=()=>{navigator.clipboard.writeText(o),Ie.success("Link copied!")};return r.jsx(Ze,{children:r.jsxs(et,{className:"p-4",children:[r.jsxs("div",{className:"flex items-start gap-3 mb-3",children:[r.jsxs(Qs,{className:"h-10 w-10",children:[r.jsx(Si,{src:(s==null?void 0:s.avatar_url)||void 0}),r.jsx(Js,{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/",e.slug]})]}),r.jsx(Pt,{variant:e.is_published?"default":"secondary",children:e.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(Ko,{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(Un,{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:t,className:"flex-1",children:[r.jsx(ni,{className:"h-3 w-3 mr-1"}),"Edit"]}),r.jsx(ee,{variant:"outline",size:"sm",onClick:l,children:r.jsx(Wo,{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(As,{className:"h-3 w-3"})})})]})]})})}function pJt({open:e,onOpenChange:t}){const[n,s]=E.useState(""),[a,o]=E.useState(""),[l,i]=E.useState(""),[u,p]=E.useState(!1),x=N8e(),y=l.trim(),{data:_}=Kt({queryKey:["profiles-search-for-cards",y],queryFn:async()=>{let T=Q.from("profiles").select("id, name, email").order("name").limit(50);y.length>=2&&(T=T.or(`name.ilike.%${y}%,email.ilike.%${y}%`));const{data:I}=await T;return I||[]},enabled:e}),[b,S]=E.useState(null),k=(_==null?void 0:_.find(T=>T.id===n))||b,M=()=>{if(!n||!a.trim()){Ie.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:()=>{t(!1),s(""),o(""),i("")}})},P=T=>{var z;s(T),p(!1);const I=_==null?void 0:_.find(D=>D.id===T);I&&(S(I),o(((z=I.name)==null?void 0:z.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/(^-|-$)/g,""))||""))};return r.jsx(Or,{open:e,onOpenChange:t,children:r.jsxs(Ir,{children:[r.jsxs($r,{children:[r.jsx(Fr,{children:"Create Agent Card"}),r.jsx(Zn,{children:"Select an agent and set their card URL slug."})]}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{children:[r.jsx($e,{children:"Agent"}),r.jsxs(Vc,{open:u,onOpenChange:p,children:[r.jsx(Hc,{asChild:!0,children:r.jsxs(ee,{variant:"outline",role:"combobox","aria-expanded":u,className:"w-full justify-between font-normal",children:[k?`${k.name} (${k.email})`:"Search for an agent...",r.jsx(oy,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),r.jsx(Mc,{className:"w-[--radix-popover-trigger-width] p-0",align:"start",children:r.jsxs(Ey,{shouldFilter:!1,children:[r.jsx(Iy,{placeholder:"Search by name or email...",value:l,onValueChange:i}),r.jsxs(Py,{children:[r.jsx(Ly,{children:"No agents found."}),r.jsx(Oy,{children:(_||[]).map(T=>r.jsxs(Dy,{value:T.id,onSelect:P,children:[r.jsx(Ni,{className:Bt("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($e,{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:M,disabled:x.isPending,className:"w-full",children:x.isPending?"Creating...":"Create Card"})]})]})})}function mJt({card:e,open:t,onOpenChange:n}){const s=S8e(),{data:a}=C8e(e.id),o=Hr(),[l,i]=E.useState(null),[u,p]=E.useState(!1),[x,y]=E.useState(!1),[_,b]=E.useState(""),[S,k]=E.useState(e.slug),[M,P]=E.useState(!1),[T,I]=E.useState({is_published:e.is_published,theme:e.theme,title:e.title||"",positioning_statement:e.positioning_statement||"",bio:e.bio||"",review_snippet:e.review_snippet||"",review_source_url:e.review_source_url||"",booking_url:e.booking_url||"",custom_cta_label:e.custom_cta_label||"",custom_cta_url:e.custom_cta_url||"",show_photo:e.show_photo,show_bio:e.show_bio,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||"",brokerage_logo_url:e.brokerage_logo_url||"",brokerage_logo_size:e.brokerage_logo_size||56,team_name:e.team_name||"",team_logo_url:e.team_logo_url||"",team_logo_size:e.team_logo_size||56});E.useEffect(()=>{t&&(async()=>{try{const{data:J}=await Q.storage.from("avatars").list(`${e.user_id}`);if(J&&J.length>0){const{data:ne}=Q.storage.from("avatars").getPublicUrl(`${e.user_id}/${J[0].name}`);i(`${ne.publicUrl}?t=${Date.now()}`)}}catch{}})()},[e.user_id,t]);const z=G=>{var oe;const J=(oe=G.target.files)==null?void 0:oe[0];if(!J)return;if(!J.type.startsWith("image/")){Ie.error("Please select an image file");return}if(J.size>5*1024*1024){Ie.error("Image must be under 5MB");return}const ne=new FileReader;ne.onloadend=()=>{b(ne.result),y(!0)},ne.readAsDataURL(J),G.target.value=""},D=async G=>{p(!0);try{const{data:J}=await Q.storage.from("avatars").list(`${e.user_id}`);J&&J.length>0&&await Q.storage.from("avatars").remove(J.map(pe=>`${e.user_id}/${pe.name}`));const ne=`${e.user_id}/avatar.jpg`,{error:oe}=await Q.storage.from("avatars").upload(ne,G,{upsert:!0,contentType:"image/jpeg"});if(oe)throw oe;const{data:ge}=Q.storage.from("avatars").getPublicUrl(ne),ie=`${ge.publicUrl}?t=${Date.now()}`;i(ie),await Q.from("profiles").update({avatar_url:ie}).eq("id",e.user_id),o.invalidateQueries({queryKey:["agent-card-public"]}),Ie.success("Photo updated!")}catch(J){Ie.error(J.message||"Upload failed")}finally{p(!1)}},U=async()=>{const G=S.trim().toLowerCase().replace(/[^a-z0-9-]/g,"-").replace(/-+/g,"-").replace(/(^-|-$)/g,"");if(!G){Ie.error("Please enter a valid URL");return}if(G===e.slug){Ie.info("No changes to save");return}P(!0);try{const{data:J}=await Q.from("agent_cards").select("id").eq("slug",G).neq("id",e.id).maybeSingle();if(J){Ie.error("This URL is already taken. Try another one.");return}const{error:ne}=await Q.from("agent_cards").update({slug:G}).eq("id",e.id);if(ne)throw ne;k(G),o.invalidateQueries({queryKey:["agent-cards-admin"]}),Ie.success("Card address updated!")}catch{Ie.error("Failed to update card address")}finally{P(!1)}},V=async(G,J)=>{var oe;const ne=(oe=G.target.files)==null?void 0:oe[0];if(ne){if(!ne.type.startsWith("image/")){Ie.error("Please select an image file");return}try{const ge=ne.name.split(".").pop()||"png",ie=J==="brokerage_logo_url"?"brokerage-logo":"team-logo",pe=`${e.user_id}/${ie}.${ge}`,{error:se}=await Q.storage.from("card-logos").upload(pe,ne,{upsert:!0});if(se)throw se;const{data:fe}=Q.storage.from("card-logos").getPublicUrl(pe),he=fe.publicUrl+"?t="+Date.now();I(J==="brokerage_logo_url"?ye=>({...ye,[J]:he,brokerage_display_name:""}):ye=>({...ye,[J]:he,team_name:""})),Ie.success("Logo uploaded!")}catch{Ie.error("Failed to upload logo")}finally{G.target.value=""}}},W=()=>{s.mutate({id:e.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(Or,{open:t,onOpenChange:n,children:r.jsxs(Ir,{className:"max-w-2xl max-h-[85vh] overflow-y-auto",children:[r.jsxs($r,{children:[r.jsx(Fr,{children:"Edit Agent Card"}),r.jsxs(Zn,{children:["/card/",e.slug]})]}),r.jsxs(Ai,{defaultValue:"content",children:[r.jsxs(vi,{className:"w-full",children:[r.jsx(sn,{value:"content",className:"flex-1",children:"Content"}),r.jsx(sn,{value:"sections",className:"flex-1",children:"Sections"}),r.jsx(sn,{value:"blocks",className:"flex-1",children:"Blocks"}),r.jsx(sn,{value:"analytics",className:"flex-1",children:"Analytics"})]}),r.jsxs(Mn,{value:"content",className:"space-y-4 mt-4",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx($e,{children:"Published"}),r.jsx(Ts,{checked:T.is_published,onCheckedChange:G=>I(J=>({...J,is_published:G}))})]}),r.jsxs("div",{children:[r.jsx($e,{children:"Agent Photo"}),r.jsxs("div",{className:"flex items-center gap-4 mt-1",children:[r.jsxs(Qs,{className:"h-16 w-16",children:[r.jsx(Si,{src:l||void 0}),r.jsx(Js,{children:"?"})]}),r.jsxs("label",{className:"cursor-pointer",children:[r.jsx("input",{type:"file",accept:"image/*",className:"hidden",onChange:z,disabled:u}),r.jsx(ee,{variant:"outline",size:"sm",asChild:!0,disabled:u,children:r.jsx("span",{children:u?r.jsxs(r.Fragment,{children:[r.jsx(Zr,{className:"h-3 w-3 mr-1 animate-spin"}),"Uploading..."]}):r.jsxs(r.Fragment,{children:[r.jsx(_o,{className:"h-3 w-3 mr-1"}),"Change Photo"]})})})]})]})]}),r.jsxs("div",{children:[r.jsx($e,{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:S,onChange:G=>k(G.target.value.toLowerCase().replace(/[^a-z0-9-]/g,"-")),placeholder:"agent-name",className:"rounded-l-none"})]}),r.jsx(ee,{variant:"outline",size:"sm",onClick:U,disabled:M||S===e.slug,className:"shrink-0",children:M?"Saving...":"Update"})]})]}),r.jsxs("div",{children:[r.jsx($e,{children:"Theme"}),r.jsxs(mn,{value:T.theme,onValueChange:G=>I(J=>({...J,theme:G})),children:[r.jsx(fn,{children:r.jsx(yn,{})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"standard",children:"✨ Standard (Modern Clean)"}),r.jsx(qt,{value:"luxury",children:"🌙 Luxury (Dark & Gold)"}),r.jsx(qt,{value:"bold",children:"🔥 Bold (Vibrant & Punchy)"}),r.jsx(qt,{value:"classic",children:"📋 Classic (Professional)"})]})]})]}),r.jsxs("div",{children:[r.jsx($e,{children:"Title / Tagline"}),r.jsx(dt,{value:T.title,onChange:G=>I(J=>({...J,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($e,{children:"Positioning Statement"}),r.jsx(dt,{value:T.positioning_statement,onChange:G=>I(J=>({...J,positioning_statement:G.target.value})),placeholder:"Your home journey, handled with care."})]}),r.jsxs("div",{children:[r.jsx($e,{children:"Bio"}),r.jsx(Jn,{value:T.bio,onChange:G=>I(J=>({...J,bio:G.target.value})),placeholder:"Short about me...",rows:3})]}),r.jsxs("div",{children:[r.jsx($e,{children:"Review Snippet"}),r.jsx(dt,{value:T.review_snippet,onChange:G=>I(J=>({...J,review_snippet:G.target.value})),placeholder:"Best agent we've ever worked with..."})]}),r.jsxs("div",{children:[r.jsx($e,{children:"Review Source URL"}),r.jsx(dt,{value:T.review_source_url,onChange:G=>I(J=>({...J,review_source_url:G.target.value})),placeholder:"https://g.page/your-business/review"})]}),r.jsxs("div",{children:[r.jsx($e,{children:"Booking URL (optional — if empty, shows lead form)"}),r.jsx(dt,{value:T.booking_url,onChange:G=>I(J=>({...J,booking_url:G.target.value})),placeholder:"https://calendly.com/your-link"})]}),r.jsxs("div",{children:[r.jsx($e,{children:"Custom CTA Label (optional)"}),r.jsx(dt,{value:T.custom_cta_label,onChange:G=>I(J=>({...J,custom_cta_label:G.target.value})),placeholder:"Book a Call"})]}),r.jsxs("div",{children:[r.jsx($e,{children:"Custom CTA URL (optional)"}),r.jsx(dt,{value:T.custom_cta_url,onChange:G=>I(J=>({...J,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($e,{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=>I(J=>({...J,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:()=>I(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(_o,{className:"h-3.5 w-3.5"}),T.brokerage_logo_url?"Change Logo":"Upload Logo"]}),r.jsx("input",{type:"file",accept:"image/*",className:"hidden",onChange:G=>V(G,"brokerage_logo_url")})]})]}),T.brokerage_logo_url&&r.jsxs("div",{className:"space-y-1.5",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx($e,{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(jm,{value:[T.brokerage_logo_size||56],onValueChange:([G])=>I(J=>({...J,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($e,{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=>I(J=>({...J,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:()=>I(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(_o,{className:"h-3.5 w-3.5"}),T.team_logo_url?"Change Logo":"Upload Logo"]}),r.jsx("input",{type:"file",accept:"image/*",className:"hidden",onChange:G=>V(G,"team_logo_url")})]})]}),T.team_logo_url&&r.jsxs("div",{className:"space-y-1.5",children:[r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsx($e,{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(jm,{value:[T.team_logo_size||56],onValueChange:([G])=>I(J=>({...J,team_logo_size:G})),min:24,max:120,step:4})]})]})]})]}),r.jsx(Mn,{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:J,hint:ne})=>r.jsxs("div",{className:"flex items-center justify-between py-2",children:[r.jsxs("div",{children:[r.jsx($e,{children:J}),ne&&r.jsxs("p",{className:"text-xs text-muted-foreground mt-0.5",children:[ne," ",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(Ts,{checked:T[G],onCheckedChange:oe=>I(ge=>({...ge,[G]:oe}))})]},G))}),r.jsx(Mn,{value:"blocks",className:"mt-4",children:r.jsx(bVe,{cardId:e.id})}),r.jsx(Mn,{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(Ze,{children:r.jsxs(et,{className:"p-4 text-center",children:[r.jsx("div",{className:"text-2xl font-bold",children:a.views}),r.jsx("div",{className:"text-xs text-muted-foreground",children:"Views"})]})}),r.jsx(Ze,{children:r.jsxs(et,{className:"p-4 text-center",children:[r.jsx("div",{className:"text-2xl font-bold",children:a.clicks}),r.jsx("div",{className:"text-xs text-muted-foreground",children:"Clicks"})]})}),r.jsx(Ze,{children:r.jsxs(et,{className:"p-4 text-center",children:[r.jsx("div",{className:"text-2xl font-bold",children:a.leads.length}),r.jsx("div",{className:"text-xs text-muted-foreground",children:"Leads"})]})})]}),a.leads.length>0&&r.jsxs("div",{children:[r.jsx("h3",{className:"font-semibold mb-2",children:"Recent Leads"}),r.jsx("div",{className:"space-y-2",children:a.leads.slice(0,5).map(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(Pt,{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:W,disabled:s.isPending,className:"w-full mt-4",children:s.isPending?"Saving...":"Save Changes"})]})}),r.jsx(N0e,{open:x,onClose:()=>y(!1),imageSrc:_,onCropComplete:D,aspectRatio:1})]})}const sC={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"},ive={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 ove(e=!0){return Kt({queryKey:["marketplace-categories",e],queryFn:async()=>{let t=Q.from("marketplace_categories").select("*").order("sort_order",{ascending:!0});e&&(t=t.eq("is_active",!0));const{data:n,error:s}=await t;if(s)throw s;return n}})}function gJt(){const e=Hr();return ir({mutationFn:async t=>{const{data:n,error:s}=await Q.from("marketplace_categories").insert([t]).select().single();if(s)throw s;return n},onSuccess:()=>{e.invalidateQueries({queryKey:["marketplace-categories"]}),Ie.success("Category created successfully")},onError:t=>{Ie.error("Failed to create category: "+t.message)}})}function xJt(){const e=Hr();return ir({mutationFn:async({id:t,...n})=>{const{data:s,error:a}=await Q.from("marketplace_categories").update(n).eq("id",t).select().single();if(a)throw a;return s},onSuccess:()=>{e.invalidateQueries({queryKey:["marketplace-categories"]}),Ie.success("Category updated successfully")},onError:t=>{Ie.error("Failed to update category: "+t.message)}})}function yJt(){const e=Hr();return ir({mutationFn:async t=>{const{error:n}=await Q.from("marketplace_categories").delete().eq("id",t);if(n)throw n},onSuccess:()=>{e.invalidateQueries({queryKey:["marketplace-categories"]}),Ie.success("Category deleted successfully")},onError:t=>{Ie.error("Failed to delete category: "+t.message)}})}function DVe(e,t=!0){return Kt({queryKey:["marketplace-products",e,t],queryFn:async()=>{let n=Q.from("marketplace_products").select(` *, category:marketplace_categories(*), images:marketplace_product_images(*), video:marketplace_product_videos(*), variants:marketplace_product_variants(*) `).order("sort_order",{ascending:!0});e&&(n=n.eq("category_id",e)),t&&(n=n.eq("is_active",!0));const{data:s,error:a}=await n;if(a)throw a;return s}})}function vJt(e){return Kt({queryKey:["marketplace-product",e],queryFn:async()=>{const{data:t,error:n}=await Q.from("marketplace_products").select(` *, category:marketplace_categories(*), images:marketplace_product_images(*), video:marketplace_product_videos(*), variants:marketplace_product_variants(*) `).eq("id",e).single();if(n)throw n;return t},enabled:!!e})}function _Jt(){const e=Hr();return ir({mutationFn:async t=>{const{data:n,error:s}=await Q.from("marketplace_products").insert([t]).select().single();if(s)throw s;return n},onSuccess:()=>{e.invalidateQueries({queryKey:["marketplace-products"]}),Ie.success("Product created successfully")},onError:t=>{Ie.error("Failed to create product: "+t.message)}})}function bJt(){const e=Hr();return ir({mutationFn:async({id:t,...n})=>{const{data:s,error:a}=await Q.from("marketplace_products").update(n).eq("id",t).select().single();if(a)throw a;return s},onSuccess:(t,n)=>{e.invalidateQueries({queryKey:["marketplace-products"]}),e.invalidateQueries({queryKey:["marketplace-product",n.id]}),Ie.success("Product updated successfully")},onError:t=>{Ie.error("Failed to update product: "+t.message)}})}function wJt(){const e=Hr();return ir({mutationFn:async t=>{const{error:n}=await Q.from("marketplace_products").delete().eq("id",t);if(n)throw n},onSuccess:()=>{e.invalidateQueries({queryKey:["marketplace-products"]}),Ie.success("Product deleted successfully")},onError:t=>{Ie.error("Failed to delete product: "+t.message)}})}function jJt(){const e=Hr();return ir({mutationFn:async t=>{const{data:n,error:s}=await Q.from("marketplace_product_images").insert([t]).select().single();if(s)throw s;return n},onSuccess:(t,n)=>{e.invalidateQueries({queryKey:["marketplace-products"]}),e.invalidateQueries({queryKey:["marketplace-product",n.product_id]})}})}function kJt(){const e=Hr();return ir({mutationFn:async({id:t,productId:n})=>{const{error:s}=await Q.from("marketplace_product_images").delete().eq("id",t);if(s)throw s;return n},onSuccess:t=>{e.invalidateQueries({queryKey:["marketplace-products"]}),e.invalidateQueries({queryKey:["marketplace-product",t]}),Ie.success("Image deleted successfully")},onError:t=>{Ie.error("Failed to delete image: "+t.message)}})}function NJt(){const e=Hr();return ir({mutationFn:async({imageId:t,productId:n})=>{const{error:s}=await Q.from("marketplace_product_images").update({is_primary:!1}).eq("product_id",n);if(s)throw s;const{error:a}=await Q.from("marketplace_product_images").update({is_primary:!0}).eq("id",t);if(a)throw a;return n},onSuccess:t=>{e.invalidateQueries({queryKey:["marketplace-products"]}),e.invalidateQueries({queryKey:["marketplace-product",t]}),Ie.success("Primary image updated")},onError:t=>{Ie.error("Failed to set primary image: "+t.message)}})}function SJt(){const e=Hr();return ir({mutationFn:async t=>{const{data:n,error:s}=await Q.from("marketplace_product_variants").insert([t]).select().single();if(s)throw s;return n},onSuccess:(t,n)=>{e.invalidateQueries({queryKey:["marketplace-products"]}),e.invalidateQueries({queryKey:["marketplace-product",n.product_id]}),Ie.success("Variant added successfully")}})}function CJt(){const e=Hr();return ir({mutationFn:async({id:t,productId:n})=>{const{error:s}=await Q.from("marketplace_product_variants").delete().eq("id",t);if(s)throw s;return n},onSuccess:t=>{e.invalidateQueries({queryKey:["marketplace-products"]}),e.invalidateQueries({queryKey:["marketplace-product",t]}),Ie.success("Variant deleted successfully")}})}function MJt(){const e=Hr();return ir({mutationFn:async({productId:t,videoUrl:n})=>{await Q.from("marketplace_product_videos").delete().eq("product_id",t);const{data:s,error:a}=await Q.from("marketplace_product_videos").insert({product_id:t,video_url:n}).select().single();if(a)throw a;return s},onSuccess:(t,n)=>{e.invalidateQueries({queryKey:["marketplace-products"]}),e.invalidateQueries({queryKey:["marketplace-product",n.productId]}),Ie.success("Video updated successfully")}})}function TJt(e){const{isAdmin:t}=tn();return Kt({queryKey:["marketplace-orders",e,t],queryFn:async()=>{let n=Q.from("marketplace_orders").select(` *, items:marketplace_order_items(*), status_history:marketplace_order_status_history(*) `).order("created_at",{ascending:!1});const{data:s,error:a}=await n;if(a)throw a;if(t&&s){const o=[...new Set(s.map(u=>u.user_id))],{data:l}=await Q.from("profiles").select("id, name, email").in("id",o),i=new Map((l==null?void 0:l.map(u=>[u.id,u]))||[]);return s.map(u=>({...u,user:i.get(u.user_id)}))}return s}})}function AJt(){const{user:e}=tn();return Kt({queryKey:["my-marketplace-orders",e==null?void 0:e.id],queryFn:async()=>{const{data:t,error:n}=await Q.from("marketplace_orders").select(` *, items:marketplace_order_items(*), status_history:marketplace_order_status_history(*) `).eq("user_id",e.id).order("created_at",{ascending:!1});if(n)throw n;return t},enabled:!!(e!=null&&e.id)})}function EJt(e){return Kt({queryKey:["marketplace-order",e],queryFn:async()=>{const{data:t,error:n}=await Q.from("marketplace_orders").select(` *, items:marketplace_order_items(*), status_history:marketplace_order_status_history(*) `).eq("id",e).single();if(n)throw n;return t},enabled:!!e})}function IJt(){const e=Hr(),{user:t}=tn();return ir({mutationFn:async({orderId:n,status:s,notes:a,trackingNumber:o,trackingUrl:l,previousStatus:i})=>{const u={status:s};o!==void 0&&(u.tracking_number=o),l!==void 0&&(u.tracking_url=l);const{error:p}=await Q.from("marketplace_orders").update(u).eq("id",n);if(p)throw p;const{error:x}=await Q.from("marketplace_order_status_history").insert({order_id:n,status:s,notes:a,created_by:t==null?void 0:t.id});if(x)throw x;if(["shipped","in_production","processing","completed"].includes(s)&&s!==i)try{await Q.functions.invoke("marketplace-order-notify",{body:{orderId:n,notificationType:s==="shipped"?"shipped":"status_update",newStatus:s,trackingNumber:o,trackingUrl:l}})}catch(_){console.error("Failed to send notification email:",_)}},onSuccess:(n,s)=>{e.invalidateQueries({queryKey:["marketplace-orders"]}),e.invalidateQueries({queryKey:["marketplace-order",s.orderId]}),e.invalidateQueries({queryKey:["my-marketplace-orders"]}),Ie.success("Order status updated")},onError:n=>{Ie.error("Failed to update order: "+n.message)}})}function PJt(){const e=Hr();return ir({mutationFn:async({itemId:t,proofUrl:n,proofNotes:s,orderId:a})=>{const{error:o}=await Q.from("marketplace_order_items").update({proof_url:n,proof_notes:s,proof_status:"pending"}).eq("id",t);if(o)throw o;await Q.from("marketplace_orders").update({status:"awaiting_proof_approval"}).eq("id",a);try{await Q.functions.invoke("marketplace-order-notify",{body:{orderId:a,notificationType:"proof_ready"}})}catch(l){console.error("Failed to send proof notification:",l)}return a},onSuccess:t=>{e.invalidateQueries({queryKey:["marketplace-orders"]}),e.invalidateQueries({queryKey:["marketplace-order",t]}),e.invalidateQueries({queryKey:["my-marketplace-orders"]}),Ie.success("Proof uploaded & customer notified")}})}function LJt(){const e=Hr();return ir({mutationFn:async({itemId:t,orderId:n})=>{const{error:s}=await Q.from("marketplace_order_items").update({proof_status:"approved"}).eq("id",t);if(s)throw s;return n},onSuccess:t=>{e.invalidateQueries({queryKey:["marketplace-orders"]}),e.invalidateQueries({queryKey:["marketplace-order",t]}),e.invalidateQueries({queryKey:["my-marketplace-orders"]}),Ie.success("Proof approved")}})}function OJt(){const e=Hr();return ir({mutationFn:async({itemId:t,orderId:n,reason:s})=>{const{error:a}=await Q.from("marketplace_order_items").update({proof_status:"rejected",proof_notes:s}).eq("id",t);if(a)throw a;return n},onSuccess:t=>{e.invalidateQueries({queryKey:["marketplace-orders"]}),e.invalidateQueries({queryKey:["marketplace-order",t]}),e.invalidateQueries({queryKey:["my-marketplace-orders"]}),Ie.success("Proof rejected - please upload a new proof")}})}function DJt(){const{data:e,isLoading:t}=ove(!1),n=gJt(),s=xJt(),a=yJt(),[o,l]=E.useState(!1),[i,u]=E.useState(null),[p,x]=E.useState({name:"",description:"",image_url:"",sort_order:0,is_active:!0}),y=()=>{x({name:"",description:"",image_url:"",sort_order:0,is_active:!0}),u(null)},_=k=>{u(k),x({name:k.name,description:k.description||"",image_url:k.image_url||"",sort_order:k.sort_order,is_active:k.is_active}),l(!0)},b=async k=>{k.preventDefault(),i?await s.mutateAsync({id:i.id,...p}):await n.mutateAsync(p),l(!1),y()},S=async k=>{confirm("Are you sure you want to delete this category?")&&await a.mutateAsync(k)};return t?r.jsxs(Ze,{children:[r.jsx(Wt,{children:r.jsx(Lr,{className:"h-8 w-48"})}),r.jsx(et,{children:r.jsx("div",{className:"space-y-4",children:[1,2,3].map(k=>r.jsx(Lr,{className:"h-12 w-full"},k))})})]}):r.jsxs(Ze,{children:[r.jsxs(Wt,{className:"flex flex-row items-center justify-between",children:[r.jsx(Yt,{children:"Categories"}),r.jsxs(Or,{open:o,onOpenChange:k=>{l(k),k||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(Ir,{children:[r.jsx($r,{children:r.jsx(Fr,{children:i?"Edit Category":"Add Category"})}),r.jsxs("form",{onSubmit:b,className:"space-y-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{htmlFor:"name",children:"Name"}),r.jsx(dt,{id:"name",value:p.name,onChange:k=>x({...p,name:k.target.value}),required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{htmlFor:"description",children:"Description"}),r.jsx(Jn,{id:"description",value:p.description,onChange:k=>x({...p,description:k.target.value})})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{htmlFor:"image_url",children:"Image URL"}),r.jsx(dt,{id:"image_url",value:p.image_url,onChange:k=>x({...p,image_url:k.target.value}),placeholder:"https://..."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{htmlFor:"sort_order",children:"Sort Order"}),r.jsx(dt,{id:"sort_order",type:"number",value:p.sort_order,onChange:k=>x({...p,sort_order:parseInt(k.target.value)||0})})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ts,{id:"is_active",checked:p.is_active,onCheckedChange:k=>x({...p,is_active:k})}),r.jsx($e,{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(et,{children:e&&e.length>0?r.jsxs(Ks,{children:[r.jsx(Zs,{children:r.jsxs(Mr,{children:[r.jsx(It,{children:"Name"}),r.jsx(It,{children:"Description"}),r.jsx(It,{children:"Sort Order"}),r.jsx(It,{children:"Status"}),r.jsx(It,{className:"text-right",children:"Actions"})]})}),r.jsx(Ys,{children:e.map(k=>r.jsxs(Mr,{children:[r.jsx(kt,{className:"font-medium",children:k.name}),r.jsx(kt,{className:"max-w-xs truncate",children:k.description}),r.jsx(kt,{children:k.sort_order}),r.jsx(kt,{children:r.jsx("span",{className:`px-2 py-1 rounded-full text-xs ${k.is_active?"bg-green-100 text-green-800":"bg-gray-100 text-gray-800"}`,children:k.is_active?"Active":"Inactive"})}),r.jsx(kt,{className:"text-right",children:r.jsxs("div",{className:"flex justify-end gap-2",children:[r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>_(k),children:r.jsx(ni,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>S(k.id),disabled:a.isPending,children:r.jsx(Bn,{className:"h-4 w-4 text-destructive"})})]})})]},k.id))})]}):r.jsx("div",{className:"text-center py-8 text-muted-foreground",children:"No categories yet. Create your first category to get started."})})]})}function RJt(){var we,be;const{data:e,isLoading:t}=DVe(void 0,!1),{data:n}=ove(!1),s=_Jt(),a=bJt(),o=wJt(),l=jJt(),i=kJt(),u=NJt(),p=SJt(),x=CJt(),y=MJt(),[_,b]=E.useState(!1),[S,k]=E.useState(!1),[M,P]=E.useState(!1),[T,I]=E.useState(null),[z,D]=E.useState(null),[U,V]=E.useState(!1),[W,G]=E.useState({name:"",description:"",base_price:0,shipping_fee:0,category_id:"",allow_artwork_upload:!1,requires_proof_approval:!1,is_active:!0,sort_order:0}),[J,ne]=E.useState({name:"",price_adjustment:0}),[oe,ge]=E.useState(""),ie=()=>{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}),I(null)},pe=_e=>{I(_e),G({name:_e.name,description:_e.description||"",base_price:Number(_e.base_price),shipping_fee:Number(_e.shipping_fee),category_id:_e.category_id||"",allow_artwork_upload:_e.allow_artwork_upload,requires_proof_approval:_e.requires_proof_approval,is_active:_e.is_active,sort_order:_e.sort_order}),b(!0)},se=async _e=>{_e.preventDefault();const Je={...W,category_id:W.category_id||null};T?await a.mutateAsync({id:T.id,...Je}):await s.mutateAsync(Je),b(!1),ie()},fe=async _e=>{confirm("Are you sure you want to delete this product?")&&await o.mutateAsync(_e)},he=async _e=>{if(!z||!_e.target.files||_e.target.files.length===0)return;V(!0);const Je=_e.target.files[0],Te=Je.name.split(".").pop(),De=`products/${z.id}/${Date.now()}.${Te}`;try{const{error:Ue}=await Q.storage.from("marketplace").upload(De,Je);if(Ue)throw Ue;const{data:{publicUrl:Be}}=Q.storage.from("marketplace").getPublicUrl(De);await l.mutateAsync({product_id:z.id,image_url:Be,is_primary:!z.images||z.images.length===0}),Ie.success("Image uploaded successfully")}catch(Ue){Ie.error("Failed to upload image: "+Ue.message)}finally{V(!1)}},ye=async _e=>{_e.preventDefault(),z&&(await p.mutateAsync({product_id:z.id,name:J.name,price_adjustment:J.price_adjustment}),ne({name:"",price_adjustment:0}))},Ae=async()=>{!z||!oe||(await y.mutateAsync({productId:z.id,videoUrl:oe}),ge(""))};return t?r.jsxs(Ze,{children:[r.jsx(Wt,{children:r.jsx(Lr,{className:"h-8 w-48"})}),r.jsx(et,{children:r.jsx("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:[1,2,3].map(_e=>r.jsx(Lr,{className:"h-64 w-full"},_e))})})]}):r.jsxs(r.Fragment,{children:[r.jsxs(Ze,{children:[r.jsxs(Wt,{className:"flex flex-row items-center justify-between",children:[r.jsx(Yt,{children:"Products"}),r.jsxs(Or,{open:_,onOpenChange:_e=>{b(_e),_e||ie()},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(Ir,{className:"max-w-2xl max-h-[90vh] overflow-y-auto",children:[r.jsx($r,{children:r.jsx(Fr,{children:T?"Edit Product":"Add Product"})}),r.jsxs("form",{onSubmit:se,className:"space-y-4",children:[r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{htmlFor:"name",children:"Product Name"}),r.jsx(dt,{id:"name",value:W.name,onChange:_e=>G({...W,name:_e.target.value}),required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{htmlFor:"category",children:"Category"}),r.jsxs(mn,{value:W.category_id,onValueChange:_e=>G({...W,category_id:_e}),children:[r.jsx(fn,{children:r.jsx(yn,{placeholder:"Select category"})}),r.jsx(pn,{children:n==null?void 0:n.map(_e=>r.jsx(qt,{value:_e.id,children:_e.name},_e.id))})]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{htmlFor:"description",children:"Description"}),r.jsx(Jn,{id:"description",value:W.description,onChange:_e=>G({...W,description:_e.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($e,{htmlFor:"base_price",children:"Base Price ($)"}),r.jsx(dt,{id:"base_price",type:"number",step:"0.01",min:"0",value:W.base_price,onChange:_e=>G({...W,base_price:parseFloat(_e.target.value)||0}),required:!0})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{htmlFor:"shipping_fee",children:"Shipping Fee ($)"}),r.jsx(dt,{id:"shipping_fee",type:"number",step:"0.01",min:"0",value:W.shipping_fee,onChange:_e=>G({...W,shipping_fee:parseFloat(_e.target.value)||0})})]})]}),r.jsx("div",{className:"grid grid-cols-2 gap-4",children:r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{htmlFor:"sort_order",children:"Sort Order"}),r.jsx(dt,{id:"sort_order",type:"number",value:W.sort_order,onChange:_e=>G({...W,sort_order:parseInt(_e.target.value)||0})})]})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ts,{id:"allow_artwork_upload",checked:W.allow_artwork_upload,onCheckedChange:_e=>G({...W,allow_artwork_upload:_e})}),r.jsx($e,{htmlFor:"allow_artwork_upload",children:"Allow customer to upload artwork"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ts,{id:"requires_proof_approval",checked:W.requires_proof_approval,onCheckedChange:_e=>G({...W,requires_proof_approval:_e})}),r.jsx($e,{htmlFor:"requires_proof_approval",children:"Requires proof approval"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ts,{id:"is_active",checked:W.is_active,onCheckedChange:_e=>G({...W,is_active:_e})}),r.jsx($e,{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(et,{children:e&&e.length>0?r.jsx("div",{className:"grid gap-4 md:grid-cols-2 lg:grid-cols-3",children:e.map(_e=>{var Je,Te;return r.jsxs(Ze,{className:"overflow-hidden",children:[r.jsxs("div",{className:"aspect-video bg-muted relative",children:[_e.images&&_e.images.length>0?r.jsx("img",{src:((Je=_e.images.find(De=>De.is_primary))==null?void 0:Je.image_url)||_e.images[0].image_url,alt:_e.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"}),!_e.is_active&&r.jsx(Pt,{variant:"secondary",className:"absolute top-2 right-2",children:"Inactive"})]}),r.jsxs(et,{className:"p-4",children:[r.jsx("h3",{className:"font-semibold mb-1",children:_e.name}),r.jsx("p",{className:"text-sm text-muted-foreground mb-2",children:((Te=_e.category)==null?void 0:Te.name)||"No category"}),r.jsxs("div",{className:"flex items-center justify-between mb-3",children:[r.jsxs("span",{className:"font-bold",children:["$",Number(_e.base_price).toFixed(2)]}),Number(_e.shipping_fee)>0&&r.jsxs("span",{className:"text-sm text-muted-foreground",children:["+$",Number(_e.shipping_fee).toFixed(2)," shipping"]})]}),r.jsxs("div",{className:"flex flex-wrap gap-1 mb-3",children:[_e.allow_artwork_upload&&r.jsx(Pt,{variant:"outline",className:"text-xs",children:"Artwork Upload"}),_e.requires_proof_approval&&r.jsx(Pt,{variant:"outline",className:"text-xs",children:"Proof Required"}),_e.variants&&_e.variants.length>0&&r.jsxs(Pt,{variant:"outline",className:"text-xs",children:[_e.variants.length," Variants"]})]}),r.jsxs("div",{className:"flex gap-2 flex-wrap",children:[r.jsxs(ee,{variant:"outline",size:"sm",onClick:()=>pe(_e),children:[r.jsx(ni,{className:"h-3 w-3 mr-1"}),"Edit"]}),r.jsxs(ee,{variant:"outline",size:"sm",onClick:()=>{D(_e),k(!0)},children:[r.jsx(kS,{className:"h-3 w-3 mr-1"}),"Images"]}),r.jsxs(ee,{variant:"outline",size:"sm",onClick:()=>{D(_e),P(!0)},children:[r.jsx(zg,{className:"h-3 w-3 mr-1"}),"Variants"]}),r.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>fe(_e.id),children:r.jsx(Bn,{className:"h-3 w-3 text-destructive"})})]})]})]},_e.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(Or,{open:S,onOpenChange:k,children:r.jsxs(Ir,{className:"max-w-2xl",children:[r.jsx($r,{children:r.jsxs(Fr,{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:(we=z==null?void 0:z.images)==null?void 0:we.map(_e=>r.jsxs("div",{className:"relative group",children:[r.jsx("img",{src:_e.image_url,alt:"",className:"w-full aspect-square object-cover rounded-lg"}),_e.is_primary&&r.jsx(Pt,{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:[!_e.is_primary&&r.jsx(ee,{variant:"secondary",size:"icon",onClick:async()=>{var Je;await u.mutateAsync({imageId:_e.id,productId:z.id}),D({...z,images:(Je=z.images)==null?void 0:Je.map(Te=>({...Te,is_primary:Te.id===_e.id}))})},disabled:u.isPending,title:"Set as primary",children:r.jsx(js,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"destructive",size:"icon",onClick:async()=>{var Te;await i.mutateAsync({id:_e.id,productId:z.id});const Je=e==null?void 0:e.find(De=>De.id===z.id);Je&&D({...Je,images:(Te=Je.images)==null?void 0:Te.filter(De=>De.id!==_e.id)})},disabled:i.isPending,children:r.jsx(Bn,{className:"h-4 w-4"})})]})]},_e.id))}),r.jsxs("div",{className:"border-2 border-dashed rounded-lg p-6 text-center",children:[r.jsx("input",{type:"file",accept:"image/*",onChange:he,className:"hidden",id:"image-upload",disabled:U}),r.jsxs("label",{htmlFor:"image-upload",className:"cursor-pointer",children:[r.jsx(kS,{className:"h-8 w-8 mx-auto mb-2 text-muted-foreground"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:U?"Uploading...":"Click to upload an image"})]})]}),r.jsxs("div",{className:"border-t pt-4 mt-4",children:[r.jsx($e,{children:"Product Video (optional)"}),r.jsxs("div",{className:"flex gap-2 mt-2",children:[r.jsx(dt,{placeholder:"Enter video URL (YouTube, Vimeo, etc.)",value:oe,onChange:_e=>ge(_e.target.value)}),r.jsxs(ee,{onClick:Ae,disabled:!oe,children:[r.jsx($a,{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(Or,{open:M,onOpenChange:P,children:r.jsxs(Ir,{children:[r.jsx($r,{children:r.jsxs(Fr,{children:["Manage Variants - ",z==null?void 0:z.name]})}),r.jsxs("div",{className:"space-y-4",children:[r.jsxs("form",{onSubmit:ye,className:"flex gap-2",children:[r.jsx(dt,{placeholder:"Variant name (e.g., 500 count)",value:J.name,onChange:_e=>ne({...J,name:_e.target.value}),required:!0}),r.jsx(dt,{type:"number",step:"0.01",placeholder:"Price adj.",value:J.price_adjustment,onChange:_e=>ne({...J,price_adjustment:parseFloat(_e.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(_e=>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:_e.name}),r.jsxs("span",{className:"text-sm text-muted-foreground ml-2",children:[Number(_e.price_adjustment)>=0?"+":"","$",Number(_e.price_adjustment).toFixed(2)]})]}),r.jsx(ee,{variant:"ghost",size:"icon",onClick:()=>x.mutateAsync({id:_e.id,productId:z.id}),children:r.jsx(Bn,{className:"h-4 w-4 text-destructive"})})]},_e.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 FJt=["pending_payment","order_submitted","awaiting_proof_approval","proof_approved","processing","in_production","shipped","completed","cancelled","refunded"];function zJt(){var k,M,P;const{data:e,isLoading:t}=TJt(),n=IJt(),s=PJt(),[a,o]=E.useState(null),[l,i]=E.useState(!1),[u,p]=E.useState({status:"",notes:"",trackingNumber:"",trackingUrl:""}),[x,y]=E.useState(!1),_=T=>{o(T),p({status:T.status,notes:"",trackingNumber:T.tracking_number||"",trackingUrl:T.tracking_url||""}),i(!0)},b=async()=>{a&&(await n.mutateAsync({orderId:a.id,status:u.status,notes:u.notes,trackingNumber:u.trackingNumber,trackingUrl:u.trackingUrl,previousStatus:a.status}),i(!1))},S=async(T,I)=>{if(!a||!T.target.files||T.target.files.length===0)return;y(!0);const z=T.target.files[0],D=z.name.split(".").pop(),U=`proofs/${a.id}/${I}/${Date.now()}.${D}`;try{const{error:V}=await Q.storage.from("marketplace").upload(U,z);if(V)throw V;const{data:{publicUrl:W}}=Q.storage.from("marketplace").getPublicUrl(U);await s.mutateAsync({itemId:I,proofUrl:W,orderId:a.id}),Ie.success("Proof uploaded successfully")}catch(V){Ie.error("Failed to upload proof: "+V.message)}finally{y(!1)}};return t?r.jsxs(Ze,{children:[r.jsx(Wt,{children:r.jsx(Lr,{className:"h-8 w-48"})}),r.jsx(et,{children:r.jsx("div",{className:"space-y-4",children:[1,2,3].map(T=>r.jsx(Lr,{className:"h-16 w-full"},T))})})]}):r.jsxs(r.Fragment,{children:[r.jsxs(Ze,{children:[r.jsx(Wt,{children:r.jsx(Yt,{children:"Orders"})}),r.jsx(et,{children:e&&e.length>0?r.jsxs(Ks,{children:[r.jsx(Zs,{children:r.jsxs(Mr,{children:[r.jsx(It,{children:"Order #"}),r.jsx(It,{children:"Customer"}),r.jsx(It,{children:"Date"}),r.jsx(It,{children:"Total"}),r.jsx(It,{children:"Status"}),r.jsx(It,{className:"text-right",children:"Actions"})]})}),r.jsx(Ys,{children:e.map(T=>{var I,z;return r.jsxs(Mr,{children:[r.jsx(kt,{className:"font-mono",children:T.order_number}),r.jsx(kt,{children:r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:((I=T.user)==null?void 0:I.name)||"Unknown"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:(z=T.user)==null?void 0:z.email})]})}),r.jsx(kt,{children:on(new Date(T.created_at),"MMM d, yyyy")}),r.jsxs(kt,{className:"font-bold",children:["$",Number(T.total).toFixed(2)]}),r.jsx(kt,{children:r.jsx(Pt,{className:ive[T.status],children:sC[T.status]})}),r.jsx(kt,{className:"text-right",children:r.jsxs(ee,{variant:"ghost",size:"sm",onClick:()=>_(T),children:[r.jsx(Ko,{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(Or,{open:l,onOpenChange:i,children:r.jsxs(Ir,{className:"max-w-3xl max-h-[90vh] overflow-y-auto",children:[r.jsx($r,{children:r.jsxs(Fr,{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:(k=a.user)==null?void 0:k.name}),r.jsx("p",{className:"text-sm text-muted-foreground",children:(M=a.user)==null?void 0:M.email})]}),r.jsxs("div",{children:[r.jsx("h4",{className:"font-medium mb-2",children:"Shipping Address"}),r.jsx("p",{children:a.shipping_name}),r.jsxs("p",{className:"text-sm text-muted-foreground",children:[a.shipping_address,r.jsx("br",{}),a.shipping_city,", ",a.shipping_state," ",a.shipping_zip]})]})]}),r.jsxs("div",{children:[r.jsx("h4",{className:"font-medium mb-2",children:"Order Items"}),r.jsx("div",{className:"space-y-3",children:(P=a.items)==null?void 0:P.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(Pt,{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:I=>S(I,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(_o,{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($e,{children:"Status"}),r.jsxs(mn,{value:u.status,onValueChange:T=>p({...u,status:T}),children:[r.jsx(fn,{children:r.jsx(yn,{})}),r.jsx(pn,{children:FJt.map(T=>r.jsx(qt,{value:T,children:sC[T]},T))})]})]}),r.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{children:"Tracking Number"}),r.jsx(dt,{value:u.trackingNumber,onChange:T=>p({...u,trackingNumber:T.target.value}),placeholder:"Enter tracking number"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{children:"Tracking URL"}),r.jsx(dt,{value:u.trackingUrl,onChange:T=>p({...u,trackingUrl:T.target.value}),placeholder:"https://..."})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{children:"Notes (optional)"}),r.jsx(Jn,{value:u.notes,onChange:T=>p({...u,notes:T.target.value}),placeholder:"Add a note about this status change..."})]}),r.jsxs(ee,{onClick:b,disabled:n.isPending,className:"w-full",children:[r.jsx(ql,{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(Pt,{variant:"outline",children:sC[T.status]}),T.notes&&r.jsx("p",{className:"text-muted-foreground mt-1",children:T.notes})]}),r.jsx("span",{className:"text-muted-foreground",children:on(new Date(T.created_at),"MMM d, h:mm a")})]},T.id))})]})]})]})})]})}function BJt(){const[e,t]=E.useState("products"),n=Gn();return r.jsx(Dr,{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(As,{className:"h-4 w-4 mr-2"}),"View Store"]})]}),r.jsxs(Ai,{value:e,onValueChange:t,children:[r.jsxs(vi,{className:"grid w-full grid-cols-3",children:[r.jsxs(sn,{value:"products",className:"flex items-center gap-2",children:[r.jsx(ql,{className:"h-4 w-4"}),"Products"]}),r.jsxs(sn,{value:"categories",className:"flex items-center gap-2",children:[r.jsx(Tm,{className:"h-4 w-4"}),"Categories"]}),r.jsxs(sn,{value:"orders",className:"flex items-center gap-2",children:[r.jsx(Nh,{className:"h-4 w-4"}),"Orders"]})]}),r.jsx(Mn,{value:"products",children:r.jsx(RJt,{})}),r.jsx(Mn,{value:"categories",children:r.jsx(DJt,{})}),r.jsx(Mn,{value:"orders",children:r.jsx(zJt,{})})]})]})})}function RVe(){return Kt({queryKey:["reward-categories"],queryFn:async()=>{const{data:e,error:t}=await Q.from("reward_store_categories").select("*").order("sort_order",{ascending:!0});if(t)throw t;return e}})}function $Jt(e){return Kt({queryKey:["reward-items",e],queryFn:async()=>{let t=Q.from("reward_store_items").select(` *, category:reward_store_categories(*) `).order("created_at",{ascending:!1});const{data:n,error:s}=await t;if(s)throw s;return n}})}function UJt(e){return Kt({queryKey:["active-reward-items",e],queryFn:async()=>{let t=Q.from("reward_store_items").select(` *, category:reward_store_categories(*) `).eq("is_active",!0).order("created_at",{ascending:!1});e&&(t=t.eq("category_id",e));const{data:n,error:s}=await t;if(s)throw s;return n}})}function qJt(e){return Kt({queryKey:["user-purchases",e],queryFn:async()=>{if(!e)return[];const{data:t,error:n}=await Q.from("reward_store_purchases").select(` *, item:reward_store_items(*) `).eq("user_id",e).order("purchased_at",{ascending:!1});if(n)throw n;return t},enabled:!!e})}function VJt(){return Kt({queryKey:["all-reward-purchases"],queryFn:async()=>{const{data:e,error:t}=await Q.from("reward_store_purchases").select(` *, item:reward_store_items(*) `).order("purchased_at",{ascending:!1});if(t)throw t;if(!e||e.length===0)return[];const n=[...new Set(e.map(l=>l.user_id))],{data:s,error:a}=await Q.from("profiles").select("id, name, email").in("id",n);if(a)throw a;const o=new Map((s==null?void 0:s.map(l=>[l.id,l]))||[]);return e.map(l=>({...l,user:o.get(l.user_id)||null}))}})}function HJt(e){return Kt({queryKey:["spendable-points",e],queryFn:async()=>{if(!e)return 0;const{data:t,error:n}=await Q.from("agent_attendance_stats").select("spendable_points").eq("user_id",e).single();if(n&&n.code!=="PGRST116")throw n;return(t==null?void 0:t.spendable_points)||0},enabled:!!e})}function WJt(){const e=Hr();return ir({mutationFn:async t=>{const{data:n,error:s}=await Q.rpc("purchase_reward_item",{p_item_id:t});if(s)throw s;const a=n;if(!a.success)throw new Error(a.error||"Purchase failed");return a},onSuccess:()=>{e.invalidateQueries({queryKey:["user-purchases"]}),e.invalidateQueries({queryKey:["spendable-points"]}),e.invalidateQueries({queryKey:["active-reward-items"]}),e.invalidateQueries({queryKey:["reward-items"]})}})}function GJt(){const e=Hr();return ir({mutationFn:async t=>{const{data:n,error:s}=await Q.from("reward_store_categories").insert([t]).select().single();if(s)throw s;return n},onSuccess:()=>{e.invalidateQueries({queryKey:["reward-categories"]})}})}function KJt(){const e=Hr();return ir({mutationFn:async({id:t,...n})=>{const{data:s,error:a}=await Q.from("reward_store_categories").update(n).eq("id",t).select().single();if(a)throw a;return s},onSuccess:()=>{e.invalidateQueries({queryKey:["reward-categories"]})}})}function ZJt(){const e=Hr();return ir({mutationFn:async t=>{const{error:n}=await Q.from("reward_store_categories").delete().eq("id",t);if(n)throw n},onSuccess:()=>{e.invalidateQueries({queryKey:["reward-categories"]})}})}function YJt(){const e=Hr();return ir({mutationFn:async t=>{const{data:n,error:s}=await Q.from("reward_store_items").insert([t]).select().single();if(s)throw s;return n},onSuccess:()=>{e.invalidateQueries({queryKey:["reward-items"]}),e.invalidateQueries({queryKey:["active-reward-items"]})}})}function XJt(){const e=Hr();return ir({mutationFn:async({id:t,...n})=>{const{data:s,error:a}=await Q.from("reward_store_items").update(n).eq("id",t).select().single();if(a)throw a;return s},onSuccess:()=>{e.invalidateQueries({queryKey:["reward-items"]}),e.invalidateQueries({queryKey:["active-reward-items"]})}})}function QJt(){const e=Hr();return ir({mutationFn:async t=>{const{error:n}=await Q.from("reward_store_items").delete().eq("id",t);if(n)throw n},onSuccess:()=>{e.invalidateQueries({queryKey:["reward-items"]}),e.invalidateQueries({queryKey:["active-reward-items"]})}})}function JJt(e){const t=e.match(/\/storage\/v1\/object\/public\/([^/]+)\/(.+)$/);return t?{bucket:t[1],path:t[2]}:null}async function gue(e,t){const n=JJt(e);if(n)try{const{data:s,error:a}=await Q.storage.from(n.bucket).download(n.path);if(a){console.error("Error downloading file:",a),Ie.error("Failed to download file");return}const o=URL.createObjectURL(s),l=document.createElement("a");l.href=o,l.download=t||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),Ie.error("Failed to download file")}else try{const a=await(await fetch(e)).blob(),o=URL.createObjectURL(a),l=document.createElement("a");l.href=o,l.download=t||e.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),Ie.error("Failed to download file")}}function FVe(){return Kt({queryKey:["point-reward-settings"],queryFn:async()=>{const{data:e,error:t}=await Q.from("point_reward_settings").select("*").order("action_name");if(t)throw t;return e}})}function eer(){const e=Hr();return ir({mutationFn:async({id:t,points:n,is_active:s})=>{const a={points:n};s!==void 0&&(a.is_active=s);const{data:o,error:l}=await Q.from("point_reward_settings").update(a).eq("id",t).select().single();if(l)throw l;return o},onSuccess:()=>{e.invalidateQueries({queryKey:["point-reward-settings"]})}})}function ter(){const{user:e}=tn(),[t,n]=E.useState("items"),[s,a]=E.useState(!1),[o,l]=E.useState(null),[i,u]=E.useState(""),[p,x]=E.useState(""),[y,_]=E.useState(""),[b,S]=E.useState(null),[k,M]=E.useState(!1),[P,T]=E.useState(null),[I,z]=E.useState(""),[D,U]=E.useState(""),[V,W]=E.useState(null),[G,J]=E.useState(""),[ne,oe]=E.useState("file"),[ge,ie]=E.useState(""),[pe,se]=E.useState(""),[fe,he]=E.useState(""),[ye,Ae]=E.useState(!0),[we,be]=E.useState(null),[_e,Je]=E.useState(!1),[Te,De]=E.useState(!1),Ue=E.useRef(null),Be=E.useRef(null),{data:qe,isLoading:ot}=RVe(),{data:Mt,isLoading:Oe}=$Jt(),{data:at,isLoading:le}=VJt(),{data:Ve,isLoading:Qe}=FVe(),st=GJt(),ke=KJt(),ct=ZJt(),Ce=YJt(),Me=XJt(),Ge=QJt(),Ee=eer(),[He,nt]=E.useState({}),yt=ur=>{ur?(l(ur),u(ur.name),x(ur.description||""),_(ur.icon||"")):(l(null),u(""),x(""),_("")),a(!0)},it=async()=>{if(!i.trim()){Ie.error("Please enter a category name");return}try{o?(await ke.mutateAsync({id:o.id,name:i,description:p||null,icon:y||null}),Ie.success("Category updated successfully")):(await st.mutateAsync({name:i,description:p||null,icon:y||null,sort_order:((qe==null?void 0:qe.length)||0)+1}),Ie.success("Category created successfully")),a(!1)}catch(ur){console.error("Error saving category:",ur),Ie.error("Failed to save category")}},zt=async()=>{if(b)try{await ct.mutateAsync(b),Ie.success("Category deleted successfully"),S(null)}catch(ur){console.error("Error deleting category:",ur),Ie.error("Failed to delete category")}},dr=ur=>{var Rn;ur?(T(ur),z(ur.name),U(ur.description||""),W(ur.category_id),J(ur.points_cost.toString()),oe(ur.item_type),ie(ur.file_url||""),se(ur.preview_image_url||""),he(((Rn=ur.max_quantity)==null?void 0:Rn.toString())||""),Ae(ur.is_active)):(T(null),z(""),U(""),W(null),J(""),oe("file"),ie(""),se(""),he(""),Ae(!0)),M(!0)},Rr=async(ur,Rn)=>{Rn==="file"?Je(!0):De(!0);try{const ea=ur.name.split(".").pop(),ca=`${Date.now()}-${Math.random().toString(36).substring(7)}.${ea}`,Ei=`${Rn==="file"?"items":"previews"}/${ca}`,{error:Ii}=await Q.storage.from("reward-store").upload(Ei,ur);if(Ii)throw Ii;const{data:{publicUrl:$o}}=Q.storage.from("reward-store").getPublicUrl(Ei);Rn==="file"?ie($o):se($o),Ie.success("File uploaded successfully")}catch(ea){console.error("Error uploading file:",ea),Ie.error("Failed to upload file")}finally{Rn==="file"?Je(!1):De(!1)}},Gr=async()=>{if(!I.trim()){Ie.error("Please enter an item name");return}if(!G||parseInt(G)<0){Ie.error("Please enter a valid points cost");return}try{const ur={name:I,description:D||null,category_id:V,points_cost:parseInt(G),item_type:ne,file_url:ge||null,preview_image_url:pe||null,max_quantity:fe?parseInt(fe):null,current_quantity:fe?parseInt(fe):null,is_active:ye,created_by:e==null?void 0:e.id};P?(await Me.mutateAsync({id:P.id,...ur,current_quantity:P.max_quantity!==(fe?parseInt(fe):null)?fe?parseInt(fe):null:P.current_quantity}),Ie.success("Item updated successfully")):(await Ce.mutateAsync(ur),Ie.success("Item created successfully")),M(!1)}catch(ur){console.error("Error saving item:",ur),Ie.error("Failed to save item")}},Ur=async()=>{if(we)try{await Ge.mutateAsync(we),Ie.success("Item deleted successfully"),be(null)}catch(ur){console.error("Error deleting item:",ur),Ie.error("Failed to delete item")}},kn=async(ur,Rn)=>{const ea=He[ur];if(ea===void 0||ea===Rn.toString())return;const ca=parseInt(ea);if(isNaN(ca)||ca<0){Ie.error("Please enter a valid positive number");return}try{await Ee.mutateAsync({id:ur,points:ca}),Ie.success("Points updated successfully"),nt(Ei=>{const Ii={...Ei};return delete Ii[ur],Ii})}catch(Ei){console.error("Error updating points:",Ei),Ie.error("Failed to update points")}};return ot||Oe||le||Qe?r.jsx(Dr,{title:"Reward Store",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Lr,{className:"h-8 w-64"}),r.jsx(Lr,{className:"h-96"})]})}):r.jsxs(Dr,{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(Ze,{children:r.jsxs(et,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(ql,{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:(Mt==null?void 0:Mt.length)||0}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[(Mt==null?void 0:Mt.filter(ur=>ur.is_active).length)||0," active"]})]})}),r.jsx(Ze,{children:r.jsxs(et,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(Tm,{className:"h-4 w-4"}),r.jsx("span",{className:"text-xs font-medium",children:"Categories"})]}),r.jsx("p",{className:"text-2xl font-bold",children:(qe==null?void 0:qe.length)||0})]})}),r.jsx(Ze,{children:r.jsxs(et,{className:"pt-4",children:[r.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[r.jsx(js,{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:[Mt&&Mt.length>0?Math.round(Mt.reduce((ur,Rn)=>ur+Rn.points_cost,0)/Mt.length):0," pts"]})]})})]}),r.jsxs(Ai,{value:t,onValueChange:n,children:[r.jsxs(vi,{children:[r.jsx(sn,{value:"items",children:"Items"}),r.jsx(sn,{value:"categories",children:"Categories"}),r.jsx(sn,{value:"purchases",children:"Purchases"}),r.jsx(sn,{value:"point-settings",children:"Point Settings"})]}),r.jsx(Mn,{value:"items",className:"mt-4",children:r.jsxs(Ze,{children:[r.jsxs(Wt,{className:"flex flex-row items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Yt,{children:"Store Items"}),r.jsx(Sn,{children:"Manage rewards that agents can purchase"})]}),r.jsxs(ee,{onClick:()=>dr(),children:[r.jsx(bn,{className:"h-4 w-4 mr-2"}),"Add Item"]})]}),r.jsx(et,{children:!Mt||Mt.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(to,{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(Ks,{children:[r.jsx(Zs,{children:r.jsxs(Mr,{children:[r.jsx(It,{children:"Item"}),r.jsx(It,{children:"Category"}),r.jsx(It,{className:"text-center",children:"Cost"}),r.jsx(It,{className:"text-center",children:"Type"}),r.jsx(It,{className:"text-center",children:"Quantity"}),r.jsx(It,{className:"text-center",children:"Status"}),r.jsx(It,{className:"text-right",children:"Actions"})]})}),r.jsx(Ys,{children:Mt.map(ur=>r.jsxs(Mr,{children:[r.jsx(kt,{children:r.jsxs("div",{className:"flex items-center gap-3",children:[ur.preview_image_url?r.jsx("img",{src:ur.preview_image_url,alt:ur.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(to,{className:"h-5 w-5 text-muted-foreground"})}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:ur.name}),r.jsx("p",{className:"text-xs text-muted-foreground line-clamp-1",children:ur.description||"No description"})]})]})}),r.jsx(kt,{children:ur.category?r.jsx(Pt,{variant:"outline",children:ur.category.name}):r.jsx("span",{className:"text-muted-foreground",children:"—"})}),r.jsx(kt,{className:"text-center",children:r.jsxs(Pt,{variant:"secondary",className:"font-bold",children:[r.jsx(js,{className:"h-3 w-3 mr-1"}),ur.points_cost]})}),r.jsx(kt,{className:"text-center",children:r.jsxs("div",{className:"flex items-center justify-center gap-1",children:[ur.item_type==="file"?r.jsx(Ea,{className:"h-4 w-4 text-muted-foreground"}):r.jsx(Io,{className:"h-4 w-4 text-muted-foreground"}),r.jsx("span",{className:"text-xs capitalize",children:ur.item_type})]})}),r.jsx(kt,{className:"text-center",children:ur.max_quantity!==null?r.jsxs("span",{className:ur.current_quantity===0?"text-red-500":"",children:[ur.current_quantity,"/",ur.max_quantity]}):r.jsx("span",{className:"text-muted-foreground",children:"Unlimited"})}),r.jsx(kt,{className:"text-center",children:r.jsx(Pt,{variant:ur.is_active?"default":"secondary",children:ur.is_active?"Active":"Inactive"})}),r.jsx(kt,{className:"text-right",children:r.jsxs("div",{className:"flex items-center justify-end gap-1",children:[r.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>dr(ur),children:r.jsx(ni,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>be(ur.id),children:r.jsx(Bn,{className:"h-4 w-4 text-destructive"})})]})})]},ur.id))})]})})]})}),r.jsx(Mn,{value:"categories",className:"mt-4",children:r.jsxs(Ze,{children:[r.jsxs(Wt,{className:"flex flex-row items-center justify-between",children:[r.jsxs("div",{children:[r.jsx(Yt,{children:"Categories"}),r.jsx(Sn,{children:"Organize your store items into categories"})]}),r.jsxs(ee,{onClick:()=>yt(),children:[r.jsx(bn,{className:"h-4 w-4 mr-2"}),"Add Category"]})]}),r.jsx(et,{children:!qe||qe.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(Tm,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),r.jsx("p",{children:"No categories yet. Add your first category!"})]}):r.jsxs(Ks,{children:[r.jsx(Zs,{children:r.jsxs(Mr,{children:[r.jsx(It,{children:"Name"}),r.jsx(It,{children:"Description"}),r.jsx(It,{className:"text-center",children:"Items"}),r.jsx(It,{className:"text-right",children:"Actions"})]})}),r.jsx(Ys,{children:qe.map(ur=>r.jsxs(Mr,{children:[r.jsxs(kt,{className:"font-medium",children:[ur.icon&&r.jsx("span",{className:"mr-2",children:ur.icon}),ur.name]}),r.jsx(kt,{className:"text-muted-foreground",children:ur.description||"—"}),r.jsx(kt,{className:"text-center",children:(Mt==null?void 0:Mt.filter(Rn=>Rn.category_id===ur.id).length)||0}),r.jsx(kt,{className:"text-right",children:r.jsxs("div",{className:"flex items-center justify-end gap-1",children:[r.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>yt(ur),children:r.jsx(ni,{className:"h-4 w-4"})}),r.jsx(ee,{variant:"ghost",size:"sm",onClick:()=>S(ur.id),children:r.jsx(Bn,{className:"h-4 w-4 text-destructive"})})]})})]},ur.id))})]})})]})}),r.jsx(Mn,{value:"purchases",className:"mt-4",children:r.jsxs(Ze,{children:[r.jsxs(Wt,{children:[r.jsxs(Yt,{className:"flex items-center gap-2",children:[r.jsx(Nh,{className:"h-5 w-5"}),"Purchase History"]}),r.jsx(Sn,{children:"View all reward redemptions by agents"})]}),r.jsx(et,{children:!at||at.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(Nh,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),r.jsx("p",{children:"No purchases yet."})]}):r.jsxs(Ks,{children:[r.jsx(Zs,{children:r.jsxs(Mr,{children:[r.jsx(It,{children:"Date"}),r.jsx(It,{children:"Agent"}),r.jsx(It,{children:"Item"}),r.jsx(It,{className:"text-center",children:"Points Spent"})]})}),r.jsx(Ys,{children:at.map(ur=>{var Rn,ea,ca,Ei;return r.jsxs(Mr,{children:[r.jsx(kt,{className:"text-muted-foreground",children:on(new Date(ur.purchased_at),"MMM d, yyyy 'at' h:mm a")}),r.jsx(kt,{children:r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx("div",{className:"h-8 w-8 rounded-full bg-muted flex items-center justify-center",children:r.jsx(ic,{className:"h-4 w-4 text-muted-foreground"})}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:((Rn=ur.user)==null?void 0:Rn.name)||"Unknown"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:((ea=ur.user)==null?void 0:ea.email)||"—"})]})]})}),r.jsx(kt,{children:r.jsxs("div",{className:"flex items-center gap-2",children:[(ca=ur.item)!=null&&ca.preview_image_url?r.jsx("img",{src:ur.item.preview_image_url,alt:ur.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(to,{className:"h-4 w-4 text-muted-foreground"})}),r.jsx("span",{children:((Ei=ur.item)==null?void 0:Ei.name)||"Deleted item"})]})}),r.jsx(kt,{className:"text-center",children:r.jsxs(Pt,{variant:"secondary",className:"font-bold",children:[r.jsx(js,{className:"h-3 w-3 mr-1"}),ur.points_spent]})})]},ur.id)})})]})})]})})]})]}),r.jsx(Or,{open:s,onOpenChange:a,children:r.jsxs(Ir,{children:[r.jsxs($r,{children:[r.jsx(Fr,{children:o?"Edit Category":"Add Category"}),r.jsx(Zn,{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($e,{htmlFor:"categoryName",children:"Name"}),r.jsx(dt,{id:"categoryName",value:i,onChange:ur=>u(ur.target.value),placeholder:"e.g., Templates, Resources"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{htmlFor:"categoryDescription",children:"Description"}),r.jsx(Jn,{id:"categoryDescription",value:p,onChange:ur=>x(ur.target.value),placeholder:"Optional description..."})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{htmlFor:"categoryIcon",children:"Icon (emoji)"}),r.jsx(dt,{id:"categoryIcon",value:y,onChange:ur=>_(ur.target.value),placeholder:"e.g., 📄, 🎁"})]})]}),r.jsxs(Bs,{children:[r.jsx(ee,{variant:"outline",onClick:()=>a(!1),children:"Cancel"}),r.jsx(ee,{onClick:it,disabled:st.isPending||ke.isPending,children:st.isPending||ke.isPending?"Saving...":"Save"})]})]})}),r.jsx(Or,{open:k,onOpenChange:M,children:r.jsxs(Ir,{className:"max-w-lg max-h-[90vh] overflow-y-auto",children:[r.jsxs($r,{children:[r.jsx(Fr,{children:P?"Edit Item":"Add Item"}),r.jsx(Zn,{children:P?"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($e,{htmlFor:"itemName",children:"Name *"}),r.jsx(dt,{id:"itemName",value:I,onChange:ur=>z(ur.target.value),placeholder:"e.g., Premium Template Pack"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{htmlFor:"itemDescription",children:"Description"}),r.jsx(Jn,{id:"itemDescription",value:D,onChange:ur=>U(ur.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($e,{htmlFor:"itemCategory",children:"Category"}),r.jsxs(mn,{value:V||"none",onValueChange:ur=>W(ur==="none"?null:ur),children:[r.jsx(fn,{children:r.jsx(yn,{placeholder:"Select category"})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"none",children:"No category"}),qe==null?void 0:qe.map(ur=>r.jsxs(qt,{value:ur.id,children:[ur.icon&&`${ur.icon} `,ur.name]},ur.id))]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{htmlFor:"itemPointsCost",children:"Points Cost *"}),r.jsx(dt,{id:"itemPointsCost",type:"number",min:"0",value:G,onChange:ur=>J(ur.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($e,{htmlFor:"itemType",children:"Type"}),r.jsxs(mn,{value:ne,onValueChange:oe,children:[r.jsx(fn,{children:r.jsx(yn,{})}),r.jsxs(pn,{children:[r.jsx(qt,{value:"file",children:"File Download"}),r.jsx(qt,{value:"link",children:"External Link"})]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{htmlFor:"itemMaxQuantity",children:"Max Quantity"}),r.jsx(dt,{id:"itemMaxQuantity",type:"number",min:"1",value:fe,onChange:ur=>he(ur.target.value),placeholder:"Leave empty for unlimited"})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{children:"File / Link URL"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(dt,{value:ge,onChange:ur=>ie(ur.target.value),placeholder:ne==="file"?"Upload a file or paste URL":"Paste external link"}),ne==="file"&&r.jsxs(r.Fragment,{children:[r.jsx(ee,{type:"button",variant:"outline",size:"icon",onClick:()=>{var ur;return(ur=Ue.current)==null?void 0:ur.click()},disabled:_e,children:r.jsx(_o,{className:"h-4 w-4"})}),r.jsx("input",{ref:Ue,type:"file",className:"hidden",onChange:ur=>{var ea;const Rn=(ea=ur.target.files)==null?void 0:ea[0];Rn&&Rr(Rn,"file")}})]})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{children:"Preview Image"}),r.jsxs("div",{className:"flex gap-2",children:[r.jsx(dt,{value:pe,onChange:ur=>se(ur.target.value),placeholder:"Upload an image or paste URL"}),r.jsx(ee,{type:"button",variant:"outline",size:"icon",onClick:()=>{var ur;return(ur=Be.current)==null?void 0:ur.click()},disabled:Te,children:r.jsx(Rl,{className:"h-4 w-4"})}),r.jsx("input",{ref:Be,type:"file",accept:"image/*",className:"hidden",onChange:ur=>{var ea;const Rn=(ea=ur.target.files)==null?void 0:ea[0];Rn&&Rr(Rn,"preview")}})]}),pe&&r.jsx("img",{src:pe,alt:"Preview",className:"mt-2 h-24 rounded object-cover"})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Ts,{id:"itemIsActive",checked:ye,onCheckedChange:Ae}),r.jsx($e,{htmlFor:"itemIsActive",children:"Active (visible to agents)"})]})]}),r.jsxs(Bs,{children:[r.jsx(ee,{variant:"outline",onClick:()=>M(!1),children:"Cancel"}),r.jsx(ee,{onClick:Gr,disabled:Ce.isPending||Me.isPending,children:Ce.isPending||Me.isPending?"Saving...":"Save"})]})]})}),r.jsx(Id,{open:!!b,onOpenChange:()=>S(null),children:r.jsxs(id,{children:[r.jsxs(od,{children:[r.jsx(cd,{children:"Delete Category"}),r.jsx(dd,{children:"Are you sure you want to delete this category? Items in this category will become uncategorized."})]}),r.jsxs(ld,{children:[r.jsx(ud,{children:"Cancel"}),r.jsx(Bc,{onClick:zt,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})}),r.jsx(Id,{open:!!we,onOpenChange:()=>be(null),children:r.jsxs(id,{children:[r.jsxs(od,{children:[r.jsx(cd,{children:"Delete Item"}),r.jsx(dd,{children:"Are you sure you want to delete this item? This action cannot be undone."})]}),r.jsxs(ld,{children:[r.jsx(ud,{children:"Cancel"}),r.jsx(Bc,{onClick:Ur,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})}),t==="point-settings"&&r.jsxs(Ze,{className:"mt-4",children:[r.jsx(Wt,{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(Yt,{children:"Point Reward Settings"}),r.jsx(Sn,{children:"Configure how many points agents earn for various actions. Adjust these values to run double-points promotions."})]})]})}),r.jsx(et,{children:!Ve||Ve.length===0?r.jsxs("div",{className:"text-center py-8 text-muted-foreground",children:[r.jsx(Fd,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),r.jsx("p",{children:"No point settings configured."})]}):r.jsxs(Ks,{children:[r.jsx(Zs,{children:r.jsxs(Mr,{children:[r.jsx(It,{children:"Action"}),r.jsx(It,{children:"Description"}),r.jsx(It,{className:"text-center w-32",children:"Points"}),r.jsx(It,{className:"text-right w-24",children:"Save"})]})}),r.jsx(Ys,{children:Ve.map(ur=>r.jsxs(Mr,{children:[r.jsx(kt,{children:r.jsx("p",{className:"font-medium",children:ur.action_name})}),r.jsx(kt,{children:r.jsx("p",{className:"text-sm text-muted-foreground",children:ur.description})}),r.jsx(kt,{className:"text-center",children:r.jsx(dt,{type:"number",min:"0",className:"w-20 mx-auto text-center",value:He[ur.id]??ur.points.toString(),onChange:Rn=>nt(ea=>({...ea,[ur.id]:Rn.target.value}))})}),r.jsx(kt,{className:"text-right",children:r.jsx(ee,{size:"sm",variant:"outline",disabled:He[ur.id]===void 0||He[ur.id]===ur.points.toString()||Ee.isPending,onClick:()=>kn(ur.id,ur.points),children:r.jsx(Em,{className:"h-4 w-4"})})})]},ur.id))})]})})]})]})}const NTe=()=>r.jsxs("svg",{viewBox:"0 0 100 100",className:"h-5 w-5",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[r.jsx("rect",{width:"100",height:"100",rx:"20",fill:"#7D2AE8"}),r.jsx("path",{d:"M50 20C33.43 20 20 33.43 20 50C20 66.57 33.43 80 50 80C66.57 80 80 66.57 80 50C80 33.43 66.57 20 50 20ZM63.5 63.5C58.3 68.7 50 70.6 43.1 67.6C36.2 64.6 32 57.6 32 50C32 42.4 36.2 35.4 43.1 32.4C50 29.4 58.3 31.3 63.5 36.5L59.3 40.7C55.8 37.2 50.7 35.8 46 37.3C41.3 38.8 37.7 42.8 36.6 47.6C35.5 52.4 37 57.4 40.4 60.8C43.8 64.2 48.8 65.7 53.6 64.6C58.4 63.5 62.4 59.9 63.9 55.2L68.7 56.7C66.9 61.3 65.5 61.5 63.5 63.5Z",fill:"white"})]}),STe=[{value:"template",label:"Templates"},{value:"brand",label:"Brand Assets"},{value:"listing",label:"Listing Assets"},{value:"social",label:"Social Media"},{value:"general",label:"General"}];function rer(){const e=Hr(),[t,n]=E.useState(!1),[s,a]=E.useState(!1),[o,l]=E.useState(!1),[i,u]=E.useState({brokerage_id:"",folder_id:"",folder_name:"",folder_type:"template",description:""}),{data:p,isLoading:x}=Kt({queryKey:["canva-integration"],queryFn:async()=>{const{data:T,error:I}=await Q.from("canva_integration").select("*").eq("is_active",!0).maybeSingle();if(I)throw I;return T}}),{data:y}=Kt({queryKey:["brokerages-list"],queryFn:async()=>{const{data:T,error:I}=await Q.from("brokerages").select("id, name").order("name");if(I)throw I;return T}}),{data:_}=Kt({queryKey:["canva-brokerage-folders"],queryFn:async()=>{const{data:T,error:I}=await Q.from("canva_brokerage_folders").select("*, brokerages(name)").order("sort_order");if(I)throw I;return T}}),b=async()=>{var T;n(!0);try{const{data:I}=await Q.auth.getSession(),z=(T=I==null?void 0:I.session)==null?void 0:T.access_token;if(!z)throw new Error("Not authenticated");const V=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/canva-oauth",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${z}`,apikey:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InJlbHplamlzd25vdGlramd2amh6Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3NjE5NTAzNDQsImV4cCI6MjA3NzUyNjM0NH0.dzIkIr_oFSbFE3oWS0ktIr83iKHHkZxt40Gc7SpC_mM"},body:JSON.stringify({action:"get_auth_url"})}),W=await V.json();if(!V.ok||W!=null&&W.error)throw new Error((W==null?void 0:W.error)||"Failed to get authorization URL");if(W!=null&&W.authUrl){localStorage.setItem("canva_code_verifier",W.codeVerifier),localStorage.setItem("canva_oauth_state",W.state);const G=window.open(W.authUrl,"canva-oauth","width=600,height=700,scrollbars=yes,resizable=yes");if(!G){Ie.error("Popup was blocked. Please allow popups for this site and try again."),n(!1);return}const J=oe=>{var ge,ie;oe.origin===window.location.origin&&(((ge=oe.data)==null?void 0:ge.type)==="canva-oauth-success"?(window.removeEventListener("message",J),Ie.success("Canva connected successfully!"),e.invalidateQueries({queryKey:["canva-integration"]}),n(!1)):((ie=oe.data)==null?void 0:ie.type)==="canva-oauth-error"&&(window.removeEventListener("message",J),Ie.error("Canva connection failed: "+(oe.data.error||"Unknown error")),n(!1)))};window.addEventListener("message",J);const ne=setInterval(()=>{G.closed&&(clearInterval(ne),window.removeEventListener("message",J),e.invalidateQueries({queryKey:["canva-integration"]}),n(!1))},500)}else throw new Error("Failed to get authorization URL")}catch(I){console.error("Canva connect error:",I);const z=(I==null?void 0:I.message)||"";z.includes("CANVA_CLIENT_ID")?Ie.error("Canva app credentials not configured yet."):Ie.error(z||"Failed to start Canva connection"),n(!1)}},S=ir({mutationFn:async T=>{var G;const{data:I}=await Q.auth.getSession(),z=(G=I==null?void 0:I.session)==null?void 0:G.access_token;if(!z)throw new Error("Not authenticated");const V=await fetch("https://relzejiswnotikjgvjhz.supabase.co/functions/v1/canva-oauth",{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${z}`,apikey:"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InJlbHplamlzd25vdGlramd2amh6Iiwicm9sZSI6ImFub24iLCJpYXQiOjE3NjE5NTAzNDQsImV4cCI6MjA3NzUyNjM0NH0.dzIkIr_oFSbFE3oWS0ktIr83iKHHkZxt40Gc7SpC_mM"},body:JSON.stringify({action:"disconnect",integrationId:T})}),W=await V.json();if(!V.ok||W!=null&&W.error)throw new Error((W==null?void 0:W.error)||"Failed to disconnect")},onSuccess:()=>{e.invalidateQueries({queryKey:["canva-integration"]}),Ie.success("Canva disconnected")},onError:T=>{Ie.error(T.message||"Failed to disconnect Canva")}}),k=ir({mutationFn:async T=>{const{error:I}=await Q.from("canva_brokerage_folders").insert({brokerage_id:T.brokerage_id,folder_id:T.folder_id.trim(),folder_name:T.folder_name.trim(),folder_type:T.folder_type,description:T.description.trim()||null,sort_order:(_==null?void 0:_.length)||0});if(I)throw I},onSuccess:()=>{e.invalidateQueries({queryKey:["canva-brokerage-folders"]}),Ie.success("Folder added"),l(!1),u({brokerage_id:"",folder_id:"",folder_name:"",folder_type:"template",description:""})},onError:()=>Ie.error("Failed to add folder")}),M=ir({mutationFn:async T=>{const{error:I}=await Q.from("canva_brokerage_folders").delete().eq("id",T);if(I)throw I},onSuccess:()=>{e.invalidateQueries({queryKey:["canva-brokerage-folders"]}),Ie.success("Folder removed")},onError:()=>Ie.error("Failed to remove folder")}),P=!!p;return r.jsxs(r.Fragment,{children:[r.jsxs(Ze,{children:[r.jsx(Wt,{children:r.jsx("div",{className:"flex items-center justify-between",children:r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("div",{className:"h-10 w-10 rounded-lg bg-accent flex items-center justify-center",children:r.jsx(NTe,{})}),r.jsxs("div",{children:[r.jsxs(Yt,{className:"text-lg flex items-center gap-2",children:["Canva Connect",P&&r.jsx(Pt,{variant:"default",className:"text-xs",children:"Connected"}),r.jsx(Pt,{variant:"outline",className:"text-xs",children:"Admin Only"})]}),r.jsx(Sn,{children:"Auto-share brokerage asset folders with agents when they connect their Canva accounts."})]})]})})}),r.jsx(et,{children:r.jsxs("div",{className:"space-y-3",children:[r.jsxs("div",{className:"flex items-start gap-2 text-sm text-muted-foreground",children:[r.jsx(di,{className:"h-4 w-4 mt-0.5 text-primary shrink-0"}),r.jsx("span",{children:"OAuth 2.0 + PKCE for secure authorization"})]}),r.jsxs("div",{className:"flex items-start gap-2 text-sm text-muted-foreground",children:[r.jsx(di,{className:"h-4 w-4 mt-0.5 text-primary shrink-0"}),r.jsx("span",{children:"Map brokerage folders to auto-share with agents on connection"})]}),r.jsxs("div",{className:"flex items-start gap-2 text-sm text-muted-foreground",children:[r.jsx(di,{className:"h-4 w-4 mt-0.5 text-primary shrink-0"}),r.jsx("span",{children:"Multiple folders per brokerage (templates, brand assets, listings)"})]}),r.jsxs("div",{className:"mt-4 p-3 rounded-lg bg-muted border border-dashed",children:[r.jsx("p",{className:"text-xs font-medium text-foreground mb-1",children:"Canva App Redirect URL"}),r.jsx("code",{className:"text-xs text-muted-foreground break-all select-all",children:"https://dashboard.relevelup.com/canva-callback.html"})]}),P?r.jsxs("div",{className:"space-y-3 mt-4",children:[r.jsxs("div",{className:"flex items-center justify-between p-3 rounded-lg border",children:[r.jsxs("div",{children:[r.jsx("p",{className:"font-medium text-sm",children:p.canva_team_id?`Team: ${p.canva_team_id}`:"Canva Account"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:p.expires_at?`Token expires ${new Date(p.expires_at).toLocaleDateString()}`:"Platform integration active"})]}),r.jsxs(Id,{children:[r.jsx(wm,{asChild:!0,children:r.jsx(ee,{variant:"ghost",size:"icon",className:"text-destructive hover:text-destructive",children:r.jsx(Bn,{className:"h-4 w-4"})})}),r.jsxs(id,{children:[r.jsxs(od,{children:[r.jsx(cd,{children:"Disconnect Canva?"}),r.jsx(dd,{children:"This will remove the Canva platform integration. Agents who have already connected will not be affected, but new folder sharing will stop."})]}),r.jsxs(ld,{children:[r.jsx(ud,{children:"Cancel"}),r.jsx(Bc,{onClick:()=>S.mutate(p.id),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Disconnect"})]})]})]})]}),r.jsxs("div",{className:"border rounded-lg overflow-hidden",children:[r.jsxs("button",{onClick:()=>a(!s),className:"w-full flex items-center justify-between p-3 text-sm font-medium hover:bg-muted transition-colors",children:[r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(Tm,{className:"h-4 w-4 text-primary"}),"Brokerage Folder Mappings",_&&_.length>0&&r.jsx(Pt,{variant:"secondary",className:"text-xs",children:_.length})]}),s?r.jsx(iy,{className:"h-4 w-4"}):r.jsx(Dd,{className:"h-4 w-4"})]}),s&&r.jsxs("div",{className:"border-t p-3 space-y-2",children:[_&&_.length>0?_.map(T=>{var I,z;return r.jsxs("div",{className:"flex items-center justify-between p-2 rounded-md bg-muted/50 text-sm",children:[r.jsxs("div",{className:"min-w-0 flex-1",children:[r.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[r.jsx("span",{className:"font-medium truncate",children:T.folder_name}),r.jsx(Pt,{variant:"outline",className:"text-xs shrink-0",children:((I=STe.find(D=>D.value===T.folder_type))==null?void 0:I.label)||T.folder_type})]}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:[(z=T.brokerages)==null?void 0:z.name," · ID: ",r.jsx("span",{className:"font-mono",children:T.folder_id})]})]}),r.jsx(ee,{variant:"ghost",size:"icon",className:"h-7 w-7 text-muted-foreground hover:text-destructive shrink-0 ml-2",onClick:()=>M.mutate(T.id),children:r.jsx(hs,{className:"h-3.5 w-3.5"})})]},T.id)}):r.jsx("p",{className:"text-sm text-muted-foreground text-center py-2",children:"No folders mapped yet"}),r.jsxs(ee,{variant:"outline",size:"sm",className:"w-full gap-1.5 mt-1",onClick:()=>l(!0),children:[r.jsx(bn,{className:"h-3.5 w-3.5"}),"Add Folder Mapping"]})]})]})]}):r.jsxs(ee,{className:"mt-4",onClick:b,disabled:t||x,children:[t?r.jsx(qo,{className:"h-4 w-4 mr-2 animate-spin"}):r.jsx("div",{className:"mr-2",children:r.jsx(NTe,{})}),"Connect Canva",r.jsx(Vo,{className:"h-4 w-4 ml-2"})]})]})})]}),r.jsx(Or,{open:o,onOpenChange:l,children:r.jsxs(Ir,{children:[r.jsx($r,{children:r.jsx(Fr,{children:"Add Brokerage Folder Mapping"})}),r.jsxs("div",{className:"space-y-4 py-2",children:[r.jsxs("div",{className:"space-y-1.5",children:[r.jsx($e,{children:"Brokerage"}),r.jsxs(mn,{value:i.brokerage_id,onValueChange:T=>u(I=>({...I,brokerage_id:T})),children:[r.jsx(fn,{children:r.jsx(yn,{placeholder:"Select a brokerage…"})}),r.jsx(pn,{children:y==null?void 0:y.map(T=>r.jsx(qt,{value:T.id,children:T.name},T.id))})]})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx($e,{children:"Canva Folder ID"}),r.jsx(dt,{placeholder:"e.g. FABCdef123456",value:i.folder_id,onChange:T=>u(I=>({...I,folder_id:T.target.value}))}),r.jsxs("p",{className:"text-xs text-muted-foreground",children:["Found in the Canva folder URL: canva.com/folder/",r.jsx("strong",{children:"FOLDER_ID"})]})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx($e,{children:"Folder Display Name"}),r.jsx(dt,{placeholder:"e.g. Brand Templates 2024",value:i.folder_name,onChange:T=>u(I=>({...I,folder_name:T.target.value}))})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsx($e,{children:"Folder Type"}),r.jsxs(mn,{value:i.folder_type,onValueChange:T=>u(I=>({...I,folder_type:T})),children:[r.jsx(fn,{children:r.jsx(yn,{})}),r.jsx(pn,{children:STe.map(T=>r.jsx(qt,{value:T.value,children:T.label},T.value))})]})]}),r.jsxs("div",{className:"space-y-1.5",children:[r.jsxs($e,{children:["Description ",r.jsx("span",{className:"text-muted-foreground",children:"(optional)"})]}),r.jsx(dt,{placeholder:"What's in this folder?",value:i.description,onChange:T=>u(I=>({...I,description:T.target.value}))})]})]}),r.jsxs(Bs,{children:[r.jsx(ee,{variant:"outline",onClick:()=>l(!1),children:"Cancel"}),r.jsxs(ee,{onClick:()=>k.mutate(i),disabled:!i.brokerage_id||!i.folder_id||!i.folder_name||k.isPending,children:[k.isPending?r.jsx(qo,{className:"h-4 w-4 mr-2 animate-spin"}):null,"Add Folder"]})]})]})})]})}function ner(){return r.jsx(Dr,{children:r.jsxs("div",{className:"space-y-6 p-4 md:p-8",children:[r.jsx(Mu,{title:"Integrations",description:"Manage platform-level service connections"}),r.jsx(rer,{})]})})}const ser={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 NT(e,t=18,n=10){return e.length<=t+n+3?e:`${e.slice(0,t)}…${e.slice(-n)}`}function aer(){var ne,oe,ge,ie,pe;const e=Hr(),[t,n]=E.useState("Test Push"),[s,a]=E.useState("Testing web push notification"),[o,l]=E.useState("/community"),[i,u]=E.useState(!1),[p,x]=E.useState(!1),[y,_]=E.useState({isSupported:typeof window<"u"&&"serviceWorker"in navigator&&"PushManager"in window}),[b,S]=E.useState(null),[k,M]=E.useState(null),{data:P,isLoading:T}=Kt({queryKey:["push-notification-settings"],queryFn:async()=>{const{data:se,error:fe}=await Q.from("push_notification_settings").select("*").order("setting_key");if(fe)throw fe;return se}}),{data:I,isLoading:z}=Kt({queryKey:["push-subscription-stats"],queryFn:async()=>{const{count:se,error:fe}=await Q.from("push_subscriptions").select("*",{count:"exact",head:!0});if(fe)throw fe;return{totalSubscriptions:se||0}}}),D=ir({mutationFn:async({settingKey:se,isEnabled:fe})=>{const{error:he}=await Q.from("push_notification_settings").update({is_enabled:fe}).eq("setting_key",se);if(he)throw he},onSuccess:()=>{e.invalidateQueries({queryKey:["push-notification-settings"]}),Ie.success("Notification setting updated")},onError:se=>{Ie.error("Failed to update setting: "+se.message)}}),U=E.useMemo(()=>{var se,fe;return y.isSupported?`perm=${y.permission??"unknown"} · controller=${y.controllerPresent?"yes":"no"} · sw=${((se=y.serviceWorker)==null?void 0:se.activeState)??"unknown"} · sub=${(fe=y.subscription)!=null&&fe.endpoint?"yes":"no"}`:"Push not supported in this browser."},[y]);E.useEffect(()=>{let se=!0;const fe=async()=>{var we,be,_e,Je,Te,De,Ue;const ye="serviceWorker"in navigator&&"PushManager"in window,Ae={isSupported:ye,permission:typeof Notification<"u"?Notification.permission:void 0,controllerPresent:!!((we=navigator.serviceWorker)!=null&&we.controller)};if(!ye){se&&_(Ae);return}try{const{data:Be,error:qe}=await Q.functions.invoke("get-vapid-public-key",{body:{}});if(qe)throw qe;Ae.vapidPublicKey=Be==null?void 0:Be.vapidPublicKey;const Mt=(await navigator.serviceWorker.getRegistrations()).find(Oe=>{var le,Ve,Qe;return(((le=Oe.active)==null?void 0:le.scriptURL)||((Ve=Oe.waiting)==null?void 0:Ve.scriptURL)||((Qe=Oe.installing)==null?void 0:Qe.scriptURL)||"").includes("/sw.js")});if(Mt){Ae.pushWorkerScriptUrl=((be=Mt.active)==null?void 0:be.scriptURL)||((_e=Mt.waiting)==null?void 0:_e.scriptURL)||((Je=Mt.installing)==null?void 0:Je.scriptURL),Ae.serviceWorker={scope:Mt.scope,activeState:(Te=Mt.active)==null?void 0:Te.state};const Oe=await Mt.pushManager.getSubscription();if(Oe){const at=Oe.toJSON();Ae.subscription={endpoint:at.endpoint,p256dh:(De=at.keys)==null?void 0:De.p256dh,auth:(Ue=at.keys)==null?void 0:Ue.auth}}}}catch(Be){Ae.error=(Be==null?void 0:Be.message)||String(Be)}se&&_(Ae)};fe();const he=window.setInterval(fe,4e3);return()=>{se=!1,window.clearInterval(he)}},[]);const V=async()=>{if(typeof Notification>"u"){Ie.error("Notifications API not available in this browser.");return}try{if(Notification.permission!=="granted"&&await Notification.requestPermission()!=="granted"){Ie.error("Notification permission not granted.");return}new Notification("Local notification test",{body:"If you see this, OS/browser notifications can display."}),Ie.success("Triggered a local notification (not push).")}catch(se){Ie.error(`Local notification failed: ${(se==null?void 0:se.message)||String(se)}`)}},W=async()=>{u(!0),S(null);try{const{data:se,error:fe}=await Q.functions.invoke("send-push-notification",{body:{title:t,body:s,url:o}});if(fe)throw fe;S({sent:se==null?void 0:se.sent,failed:se==null?void 0:se.failed,expiredCleaned:se==null?void 0:se.expiredCleaned,vapidPublicKey:se==null?void 0:se.vapidPublicKey}),(se==null?void 0:se.sent)>0?Ie.success(`Test notification sent to ${se.sent} subscriber(s)`):(se==null?void 0:se.failed)>0?Ie.warning(`Notification failed for ${se.failed} subscriber(s). ${se.expired||0} expired subscriptions cleaned up.`):Ie.info("No active subscriptions to send to")}catch(se){console.error("Error sending test notification:",se),S({error:(se==null?void 0:se.message)||String(se)}),Ie.error("Failed to send test notification: "+(se.message||"Unknown error"))}finally{u(!1)}},G=async()=>{x(!0),M(null);try{const{data:se,error:fe}=await Q.functions.invoke("generate-vapid-keys",{body:{}});if(fe)throw fe;const he=se==null?void 0:se.publicKey,ye=se==null?void 0:se.privateKey;if(!he||!ye)throw new Error("generate-vapid-keys did not return keys");M({publicKey:he,privateKey:ye}),Ie.success("Generated new VAPID keys. Update backend secrets, then clear + re-subscribe.")}catch(se){console.error("Error generating VAPID keys:",se),Ie.error("Failed to generate VAPID keys: "+((se==null?void 0:se.message)||"Unknown error"))}finally{x(!1)}},J=ir({mutationFn:async()=>{const{error:se}=await Q.from("push_subscriptions").delete().neq("id","00000000-0000-0000-0000-000000000000");if(se)throw se},onSuccess:()=>{Ie.success("All subscriptions cleared. Users will need to re-enable notifications."),e.invalidateQueries({queryKey:["push-subscription-stats"]})},onError:se=>{Ie.error("Failed to clear subscriptions: "+se.message)}});return r.jsx(Dr,{title:"Notification Settings",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Mu,{title:"Notification Settings",description:"Manage push notifications and test the notification system"}),r.jsxs(Ze,{children:[r.jsxs(Wt,{children:[r.jsxs(Yt,{className:"flex items-center gap-2",children:[r.jsx(Un,{className:"h-5 w-5"}),"Push Notification Subscribers"]}),r.jsx(Sn,{children:"Current active push notification subscriptions"})]}),r.jsx(et,{children:r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx("div",{className:"text-4xl font-bold",children:z?"...":(I==null?void 0:I.totalSubscriptions)||0}),r.jsx("div",{className:"text-sm text-muted-foreground",children:"active subscriptions"})]})})]}),r.jsxs(Ze,{children:[r.jsxs(Wt,{children:[r.jsxs(Yt,{className:"flex items-center gap-2",children:[r.jsx(Fd,{className:"h-5 w-5"}),"Notification Types"]}),r.jsx(Sn,{children:"Control which types of push notifications are sent to users"})]}),r.jsx(et,{children:T?r.jsx("div",{className:"text-sm text-muted-foreground",children:"Loading settings..."}):r.jsx("div",{className:"space-y-4",children:P==null?void 0:P.map(se=>{const fe=ser[se.setting_key]||{label:se.setting_key,icon:"🔔"};return r.jsxs("div",{className:"flex items-center justify-between rounded-lg border p-4",children:[r.jsxs("div",{className:"flex items-center gap-3",children:[r.jsx("span",{className:"text-2xl",children:fe.icon}),r.jsxs("div",{children:[r.jsx("div",{className:"font-medium",children:fe.label}),r.jsx("div",{className:"text-sm text-muted-foreground",children:se.description})]})]}),r.jsx(Ts,{checked:se.is_enabled,onCheckedChange:he=>D.mutate({settingKey:se.setting_key,isEnabled:he}),disabled:D.isPending})]},se.id)})})})]}),r.jsxs(Ze,{children:[r.jsxs(Wt,{children:[r.jsxs(Yt,{className:"flex items-center gap-2",children:[r.jsx(Lg,{className:"h-5 w-5"}),"Send Test Notification"]}),r.jsx(Sn,{children:"Send a test push notification to all subscribed users"})]}),r.jsxs(et,{className:"space-y-4",children:[r.jsxs("div",{className:"rounded-md border bg-muted/30 p-3 text-sm",children:[r.jsx("div",{className:"font-medium",children:"Client push debug"}),r.jsx("div",{className:"mt-1 text-muted-foreground",children:U}),y.error&&r.jsx("div",{className:"mt-2 text-destructive",children:y.error}),r.jsxs("div",{className:"mt-2 grid gap-2 sm:grid-cols-2",children:[r.jsxs("div",{className:"space-y-1",children:[r.jsx("div",{className:"text-xs font-medium text-muted-foreground",children:"Backend VAPID public key"}),r.jsx("div",{className:"break-all rounded-md border bg-background p-2 font-mono text-xs",children:y.vapidPublicKey?NT(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: ",(ne=y.serviceWorker)!=null&&ne.scope?NT(y.serviceWorker.scope,24,8):"none"]}),r.jsxs("div",{children:["active: ",((oe=y.serviceWorker)==null?void 0:oe.activeState)??"none"]})]})]}),r.jsxs("div",{className:"space-y-1 sm:col-span-2",children:[r.jsx("div",{className:"text-xs font-medium text-muted-foreground",children:"Current browser subscription"}),r.jsxs("div",{className:"rounded-md border bg-background p-2 font-mono text-xs",children:[r.jsxs("div",{children:["endpoint: ",(ge=y.subscription)!=null&&ge.endpoint?NT(y.subscription.endpoint,40,12):"none"]}),r.jsxs("div",{children:["p256dh: ",(ie=y.subscription)!=null&&ie.p256dh?NT(y.subscription.p256dh,22,10):"none"]}),r.jsxs("div",{children:["auth: ",(pe=y.subscription)!=null&&pe.auth?NT(y.subscription.auth,22,10):"none"]})]})]})]}),r.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[r.jsx(ee,{variant:"outline",onClick:V,children:"Local notification test"}),r.jsx(ee,{variant:"outline",onClick:()=>window.location.reload(),children:"Reload page"})]})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{htmlFor:"test-title",children:"Notification Title"}),r.jsx(dt,{id:"test-title",value:t,onChange:se=>n(se.target.value),placeholder:"Enter notification title"})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{htmlFor:"test-body",children:"Notification Body"}),r.jsx(Jn,{id:"test-body",value:s,onChange:se=>a(se.target.value),placeholder:"Enter notification message",rows:3})]}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{htmlFor:"test-url",children:"Click URL (optional)"}),r.jsx(dt,{id:"test-url",value:o,onChange:se=>l(se.target.value),placeholder:"/community or full URL"}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Where users will be taken when they click the notification"})]}),r.jsxs(ee,{onClick:W,disabled:i||!t||!s,className:"w-full sm:w-auto",children:[r.jsx(lo,{className:"h-4 w-4 mr-2"}),i?"Sending...":"Send Test Notification"]}),b&&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"}),b.error?r.jsxs("div",{className:"mt-1 text-destructive",children:["Error: ",b.error]}):r.jsxs("div",{className:"mt-1 space-y-1 text-muted-foreground",children:[r.jsxs("div",{children:["Result: ",b.sent??0," sent, ",b.failed??0," failed, ",b.expiredCleaned??0," expired cleaned"]}),b.vapidPublicKey?r.jsxs("div",{className:"break-all",children:["Backend VAPID public key: ",r.jsx("span",{className:"font-mono",children:b.vapidPublicKey})]}):r.jsx("div",{children:"Backend VAPID public key: (not returned)"})]})]})]})]}),r.jsxs(Ze,{children:[r.jsxs(Wt,{children:[r.jsxs(Yt,{className:"flex items-center gap-2 text-destructive",children:[r.jsx(Bn,{className:"h-5 w-5"}),"Subscription Maintenance"]}),r.jsx(Sn,{children:"Clear all push subscriptions if VAPID keys were changed or subscriptions are invalid"})]}),r.jsxs(et,{className:"space-y-4",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"If you've recently updated the VAPID keys, existing subscriptions will no longer work. Use this to clear all subscriptions so users can re-subscribe with the new keys."}),r.jsxs(ee,{variant:"destructive",onClick:()=>J.mutate(),disabled:J.isPending,children:[r.jsx(Bn,{className:"h-4 w-4 mr-2"}),J.isPending?"Clearing...":"Clear All Subscriptions"]}),r.jsxs("div",{className:"rounded-md border bg-muted/30 p-3 text-sm",children:[r.jsx("div",{className:"font-medium",children:"VAPID key rotation helper"}),r.jsx("div",{className:"mt-1 text-muted-foreground",children:"If you suspect the backend public/private keys don’t match, generate a fresh pair, update backend secrets, then clear subscriptions and have users re-enable push."}),r.jsx("div",{className:"mt-3 flex flex-wrap gap-2",children:r.jsx(ee,{variant:"outline",onClick:G,disabled:p,children:p?"Generating…":"Generate VAPID keys"})}),k&&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:k.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:k.privateKey})]})]})]})]})]})]})})}function ier(){const[e]=Gc(),t=Gn(),[n,s]=E.useState("loading"),[a,o]=E.useState("Processing connection...");return E.useEffect(()=>{(async()=>{const i=e.get("code"),u=e.get("error"),p=e.get("error_description"),x=e.get("state");if(u){s("error"),o(p||"Authorization was denied"),Ie.error("Failed to connect: "+(p||u));return}if(!i){s("error"),o("No authorization code received"),Ie.error("Failed to connect: No authorization code");return}try{const{data:y,error:_}=await Q.functions.invoke("meta-oauth",{body:{action:"exchange_code",code:i,state:x}});if(_)throw _;if(y!=null&&y.success)s("success"),o(y.message||"Accounts connected successfully!"),Ie.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"),Ie.error(y.message||"Failed to connect accounts")}})()},[e]),r.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background p-4",children:r.jsxs(Ze,{className:"w-full max-w-md",children:[r.jsxs(Wt,{className:"text-center",children:[r.jsxs("div",{className:"mx-auto mb-4",children:[n==="loading"&&r.jsx(Zr,{className:"h-12 w-12 animate-spin text-primary"}),n==="success"&&r.jsx(di,{className:"h-12 w-12 text-green-500"}),n==="error"&&r.jsx(bc,{className:"h-12 w-12 text-destructive"})]}),r.jsxs(Yt,{children:[n==="loading"&&"Connecting...",n==="success"&&"Connected!",n==="error"&&"Connection Failed"]}),r.jsx(Sn,{children:a})]}),r.jsx(et,{className:"flex justify-center",children:r.jsx(ee,{onClick:()=>t("/admin/integrations"),children:n==="success"?"View Integrations":"Back to Integrations"})})]})})}function oer(){const e=Gn(),t=Hr(),{isAdmin:n}=tn(),[s,a]=E.useState(!1),[o,l]=E.useState(null),[i,u]=E.useState(null),{data:p,isLoading:x}=Kt({queryKey:["my-social-accounts"],queryFn:async()=>{const{data:{user:D},error:U}=await Q.auth.getUser();if(U)throw U;if(!D)return[];const{data:V,error:W}=await Q.from("social_accounts").select("*").eq("user_id",D.id).order("created_at",{ascending:!1});if(W)throw W;return V}}),y=ir({mutationFn:async D=>{const{data:{user:U},error:V}=await Q.auth.getUser();if(V)throw V;if(!U)throw new Error("Not authenticated");const{error:W}=await Q.from("social_accounts").delete().eq("id",D).eq("user_id",U.id);if(W)throw W},onSuccess:()=>{t.invalidateQueries({queryKey:["my-social-accounts"]}),t.invalidateQueries({queryKey:["social-accounts-for-post"]}),Ie.success("Account disconnected successfully")},onError:()=>{Ie.error("Failed to disconnect account")}}),_=async()=>{a(!0);try{const{data:D,error:U}=await Q.functions.invoke("meta-oauth",{body:{action:"get_auth_url",callbackPath:"/social-connections/callback"}});if(U)throw U;if(D!=null&&D.authUrl)window.location.href=D.authUrl;else throw new Error("Failed to get authorization URL")}catch(D){console.error("Meta OAuth error:",D),Ie.error("Failed to start connection. Please try again."),a(!1)}},b=async()=>{a(!0);try{const{data:D,error:U}=await Q.functions.invoke("linkedin-oauth",{body:{action:"get_auth_url",callbackPath:"/social-connections/linkedin-callback"}});if(U)throw U;if(D!=null&&D.authUrl)window.location.href=D.authUrl;else throw new Error("Failed to get LinkedIn authorization URL")}catch(D){console.error("LinkedIn OAuth error:",D),Ie.error("Failed to start LinkedIn connection. Please try again."),a(!1)}},S=async()=>{a(!0);try{const{data:D,error:U}=await Q.functions.invoke("google-business-oauth",{body:{action:"get_auth_url"}});if(U)throw U;if(D!=null&&D.authUrl)window.location.href=D.authUrl;else throw new Error("Failed to get Google authorization URL")}catch(D){console.error("Google OAuth error:",D),Ie.error("Failed to start Google connection. Please try again."),a(!1)}},k=(p==null?void 0:p.filter(D=>D.platform==="facebook"))||[],M=(p==null?void 0:p.filter(D=>D.platform==="instagram"))||[],P=(p==null?void 0:p.filter(D=>D.platform==="linkedin"))||[],T=(p==null?void 0:p.filter(D=>D.platform==="google_business"))||[],I=((p==null?void 0:p.length)||0)>0,z=async(D,U)=>{l(D),u(null);try{const{data:V,error:W}=await Q.functions.invoke("meta-api-test",{body:{testType:"all",accountId:D}});if(W)throw W;u(V.results||[]),Ie.success(V.summary||"API tests completed")}catch(V){console.error("Meta API test error:",V),Ie.error("Failed to run API tests")}finally{l(null)}};return r.jsx(Dr,{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(Pt,{variant:"secondary",className:"bg-white/20 text-white border-0 backdrop-blur-sm",children:[r.jsx(Ls,{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:()=>e("/social-swag-2"),className:"gap-2",children:[r.jsx(po,{className:"h-4 w-4"}),"Back to Social Swag"]}),!n&&r.jsx(Ze,{className:"border-amber-200 bg-amber-50 dark:bg-amber-950/20 dark:border-amber-800",children:r.jsxs(et,{className:"flex flex-col items-center justify-center py-12 text-center",children:[r.jsx("div",{className:"rounded-full bg-amber-100 dark:bg-amber-900/30 p-4 mb-4",children:r.jsx(Ya,{className:"h-10 w-10 text-amber-600 dark:text-amber-400"})}),r.jsx(Pt,{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:[I&&r.jsx(Ze,{className:"border-green-200 bg-green-50 dark:bg-green-950/20 dark:border-green-900",children:r.jsxs(et,{className:"flex items-center gap-4 p-4",children:[r.jsx("div",{className:"rounded-full bg-green-500 p-2",children:r.jsx(di,{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(Ze,{children:[r.jsx(Wt,{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(au,{className:"h-6 w-6 text-blue-600"})}),r.jsxs("div",{children:[r.jsx(Yt,{className:"text-lg",children:"Facebook"}),r.jsx(Sn,{children:"Connect your Facebook Pages"})]})]})}),r.jsxs(et,{className:"space-y-4",children:[x?r.jsx("div",{className:"flex items-center justify-center py-8",children:r.jsx(qo,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):k.length>0?r.jsx("div",{className:"space-y-3",children:k.map(D=>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(Qs,{className:"h-10 w-10",children:[r.jsx(Si,{src:D.profile_picture_url||""}),r.jsx(Js,{children:r.jsx(au,{className:"h-5 w-5"})})]}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:D.page_name||D.platform_username||"Facebook Page"}),r.jsx(Pt,{variant:D.is_active?"default":"secondary",className:"text-xs",children:D.is_active?"Connected":"Inactive"})]})]}),r.jsxs(Id,{children:[r.jsx(wm,{asChild:!0,children:r.jsx(ee,{variant:"ghost",size:"icon",className:"text-destructive hover:text-destructive",children:r.jsx(Bn,{className:"h-4 w-4"})})}),r.jsxs(id,{children:[r.jsxs(od,{children:[r.jsx(cd,{children:"Disconnect Facebook?"}),r.jsx(dd,{children:"This will remove the connection. You'll need to reconnect to post content."})]}),r.jsxs(ld,{children:[r.jsx(ud,{children:"Cancel"}),r.jsx(Bc,{onClick:()=>y.mutate(D.id),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Disconnect"})]})]})]})]},D.id))}):r.jsx("p",{className:"text-sm text-muted-foreground py-4 text-center",children:"No Facebook pages connected yet"}),r.jsxs(ee,{onClick:_,disabled:s,className:"w-full gap-2",variant:k.length>0?"outline":"default",children:[s?r.jsx(qo,{className:"h-4 w-4 animate-spin"}):r.jsx(bn,{className:"h-4 w-4"}),k.length>0?"Connect Another Page":"Connect Facebook Page"]})]})]}),r.jsxs(Ze,{children:[r.jsx(Wt,{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(_u,{className:"h-6 w-6 text-pink-600"})}),r.jsxs("div",{children:[r.jsx(Yt,{className:"text-lg",children:"Instagram"}),r.jsx(Sn,{children:"Connect Instagram Business accounts"})]})]})}),r.jsxs(et,{className:"space-y-4",children:[x?r.jsx("div",{className:"flex items-center justify-center py-8",children:r.jsx(qo,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):M.length>0?r.jsx("div",{className:"space-y-3",children:M.map(D=>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(Qs,{className:"h-10 w-10",children:[r.jsx(Si,{src:D.profile_picture_url||""}),r.jsx(Js,{children:r.jsx(_u,{className:"h-5 w-5"})})]}),r.jsxs("div",{children:[r.jsxs("p",{className:"font-medium",children:["@",D.platform_username||"Instagram Account"]}),r.jsx(Pt,{variant:D.is_active?"default":"secondary",className:"text-xs",children:D.is_active?"Connected":"Inactive"})]})]}),r.jsxs(Id,{children:[r.jsx(wm,{asChild:!0,children:r.jsx(ee,{variant:"ghost",size:"icon",className:"text-destructive hover:text-destructive",children:r.jsx(Bn,{className:"h-4 w-4"})})}),r.jsxs(id,{children:[r.jsxs(od,{children:[r.jsx(cd,{children:"Disconnect Instagram?"}),r.jsx(dd,{children:"This will remove the connection. You'll need to reconnect to post content."})]}),r.jsxs(ld,{children:[r.jsx(ud,{children:"Cancel"}),r.jsx(Bc,{onClick:()=>y.mutate(D.id),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Disconnect"})]})]})]})]},D.id))}):r.jsx("p",{className:"text-sm text-muted-foreground py-4 text-center",children:"No Instagram accounts connected yet"}),r.jsxs(ee,{onClick:_,disabled:s,className:"w-full gap-2",variant:M.length>0?"outline":"default",children:[s?r.jsx(qo,{className:"h-4 w-4 animate-spin"}):r.jsx(bn,{className:"h-4 w-4"}),M.length>0?"Connect Another Account":"Connect Instagram"]}),r.jsx("p",{className:"text-xs text-muted-foreground text-center",children:"Instagram Business accounts must be connected to a Facebook Page"})]})]}),r.jsxs(Ze,{children:[r.jsx(Wt,{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(gf,{className:"h-6 w-6 text-blue-700"})}),r.jsxs("div",{children:[r.jsx(Yt,{className:"text-lg",children:"LinkedIn"}),r.jsx(Sn,{children:"Connect your LinkedIn profile"})]})]})}),r.jsxs(et,{className:"space-y-4",children:[x?r.jsx("div",{className:"flex items-center justify-center py-8",children:r.jsx(qo,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):P.length>0?r.jsx("div",{className:"space-y-3",children:P.map(D=>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(Qs,{className:"h-10 w-10",children:[r.jsx(Si,{src:D.profile_picture_url||""}),r.jsx(Js,{children:r.jsx(gf,{className:"h-5 w-5"})})]}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:D.platform_username||"LinkedIn Account"}),r.jsx(Pt,{variant:D.is_active?"default":"secondary",className:"text-xs",children:D.is_active?"Connected":"Inactive"})]})]}),r.jsxs(Id,{children:[r.jsx(wm,{asChild:!0,children:r.jsx(ee,{variant:"ghost",size:"icon",className:"text-destructive hover:text-destructive",children:r.jsx(Bn,{className:"h-4 w-4"})})}),r.jsxs(id,{children:[r.jsxs(od,{children:[r.jsx(cd,{children:"Disconnect LinkedIn?"}),r.jsx(dd,{children:"This will remove the connection. You'll need to reconnect to post content."})]}),r.jsxs(ld,{children:[r.jsx(ud,{children:"Cancel"}),r.jsx(Bc,{onClick:()=>y.mutate(D.id),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Disconnect"})]})]})]})]},D.id))}):r.jsx("p",{className:"text-sm text-muted-foreground py-4 text-center",children:"No LinkedIn account connected yet"}),r.jsxs(ee,{onClick:b,disabled:s,className:"w-full gap-2",variant:P.length>0?"outline":"default",children:[s?r.jsx(qo,{className:"h-4 w-4 animate-spin"}):r.jsx(bn,{className:"h-4 w-4"}),P.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(Ze,{className:`relative overflow-hidden ${n?"":"opacity-75"}`,children:[!n&&r.jsx("div",{className:"absolute top-3 right-3 z-10",children:r.jsx(Pt,{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(Pt,{variant:"secondary",className:"bg-green-100 text-green-800 dark:bg-green-900/30 dark:text-green-400",children:"Admin Testing"})}),r.jsx(Wt,{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(Po,{className:"h-6 w-6 text-red-600"})}),r.jsxs("div",{children:[r.jsx(Yt,{className:"text-lg",children:"Google Business"}),r.jsx(Sn,{children:"Connect your Google Business Profile"})]})]})}),r.jsxs(et,{className:"space-y-4",children:[x?r.jsx("div",{className:"flex items-center justify-center py-8",children:r.jsx(qo,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):T.length>0?r.jsx("div",{className:"space-y-3",children:T.map(D=>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(Qs,{className:"h-10 w-10",children:[r.jsx(Si,{src:D.profile_picture_url||""}),r.jsx(Js,{children:r.jsx(Po,{className:"h-5 w-5"})})]}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:D.page_name||D.platform_username||"Google Business"}),r.jsx(Pt,{variant:D.is_active?"default":"secondary",className:"text-xs",children:D.is_active?"Connected":"Inactive"})]})]}),r.jsxs(Id,{children:[r.jsx(wm,{asChild:!0,children:r.jsx(ee,{variant:"ghost",size:"icon",className:"text-destructive hover:text-destructive",children:r.jsx(Bn,{className:"h-4 w-4"})})}),r.jsxs(id,{children:[r.jsxs(od,{children:[r.jsx(cd,{children:"Disconnect Google Business?"}),r.jsx(dd,{children:"This will remove the connection. You'll need to reconnect to post content."})]}),r.jsxs(ld,{children:[r.jsx(ud,{children:"Cancel"}),r.jsx(Bc,{onClick:()=>y.mutate(D.id),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Disconnect"})]})]})]})]},D.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?S:void 0,disabled:!n||s,className:"w-full gap-2",variant:T.length>0?"outline":"default",children:[s?r.jsx(qo,{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&&(k.length>0||M.length>0)&&r.jsxs(Ze,{className:"border-amber-200 bg-amber-50 dark:bg-amber-950/20 dark:border-amber-900",children:[r.jsx(Wt,{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(Ij,{className:"h-6 w-6 text-amber-600"})}),r.jsxs("div",{children:[r.jsx(Yt,{className:"text-lg",children:"Meta API Testing (Admin Only)"}),r.jsx(Sn,{children:"Run API tests to trigger all required permissions for Meta App Review"})]})]})}),r.jsxs(et,{className:"space-y-4",children:[r.jsxs("p",{className:"text-sm text-muted-foreground",children:['Click "Run Tests" on an account to trigger API calls for: ',r.jsx("strong",{children:"public_profile"}),", ",r.jsx("strong",{children:"pages_show_list"}),", ",r.jsx("strong",{children:"pages_read_engagement"}),", ",r.jsx("strong",{children:"instagram_basic"}),", ",r.jsx("strong",{children:"pages_manage_posts"}),", and ",r.jsx("strong",{children:"instagram_content_publish"}),"."]}),r.jsxs("div",{className:"space-y-3",children:[k.map(D=>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(au,{className:"h-5 w-5 text-blue-600"}),r.jsx("span",{className:"font-medium",children:D.page_name||"Facebook Page"})]}),r.jsx(ee,{size:"sm",variant:"outline",onClick:()=>z(D.id),disabled:o===D.id,children:o===D.id?r.jsxs(r.Fragment,{children:[r.jsx(Zr,{className:"h-4 w-4 mr-2 animate-spin"}),"Testing..."]}):r.jsxs(r.Fragment,{children:[r.jsx(Ij,{className:"h-4 w-4 mr-2"}),"Run Tests"]})})]},`test-fb-${D.id}`)),M.map(D=>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(_u,{className:"h-5 w-5 text-pink-600"}),r.jsxs("span",{className:"font-medium",children:["@",D.platform_username||"Instagram"]})]}),r.jsx(ee,{size:"sm",variant:"outline",onClick:()=>z(D.id),disabled:o===D.id,children:o===D.id?r.jsxs(r.Fragment,{children:[r.jsx(Zr,{className:"h-4 w-4 mr-2 animate-spin"}),"Testing..."]}):r.jsxs(r.Fragment,{children:[r.jsx(Ij,{className:"h-4 w-4 mr-2"}),"Run Tests"]})})]},`test-ig-${D.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((D,U)=>r.jsxs("div",{className:"flex items-start gap-2 text-sm",children:[D.status==="success"?r.jsx(so,{className:"h-4 w-4 text-green-600 mt-0.5 shrink-0"}):D.status==="pending"?r.jsx(Zr,{className:"h-4 w-4 text-amber-600 mt-0.5 shrink-0"}):r.jsx(bc,{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:D.test}),r.jsx("span",{className:"ml-2 text-muted-foreground",children:D.details})]})]},U))})]}),r.jsx("p",{className:"text-xs text-muted-foreground",children:"Note: Facebook posts are auto-deleted. Instagram posts will remain and should be manually deleted. Allow up to 24 hours for Meta to register the API calls."})]})]}),r.jsxs(Ze,{children:[r.jsx(Wt,{children:r.jsx(Yt,{className:"text-lg",children:"How it works"})}),r.jsx(et,{children:r.jsxs("div",{className:"grid gap-4 md:grid-cols-3",children:[r.jsxs("div",{className:"flex gap-3",children:[r.jsx("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-primary text-primary-foreground text-sm font-medium",children:"1"}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:"Connect your accounts"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Link your Facebook, Instagram, or LinkedIn account"})]})]}),r.jsxs("div",{className:"flex gap-3",children:[r.jsx("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-primary text-primary-foreground text-sm font-medium",children:"2"}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:"Browse Social Swag"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:"Find the perfect image and caption for your post"})]})]}),r.jsxs("div",{className:"flex gap-3",children:[r.jsx("div",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-primary text-primary-foreground text-sm font-medium",children:"3"}),r.jsxs("div",{children:[r.jsx("p",{className:"font-medium",children:"Post with one click"}),r.jsx("p",{className:"text-sm text-muted-foreground",children:'Click "Create Post" to share directly to your accounts'})]})]})]})})]})]})]})})}function ler(){const[e]=Gc(),t=Gn(),[n,s]=E.useState("loading"),[a,o]=E.useState("Processing your connection...");return E.useEffect(()=>{(async()=>{var y;const i=e.get("code"),u=e.get("error"),p=e.get("error_description"),x=e.get("state");if(u){s("error"),o(p||"Authorization was denied"),Ie.error("Connection failed: "+(p||u));return}if(!i){s("error"),o("No authorization code received"),Ie.error("No authorization code received");return}try{const{data:_,error:b}=await Q.functions.invoke("meta-oauth",{body:{action:"exchange_code",code:i,state:x,callbackPath:"/social-connections/callback"}});if(b)throw b;if(_!=null&&_.success)s("success"),o(`Successfully connected ${((y=_.accounts)==null?void 0:y.length)||0} account(s)!`),Ie.success("Social accounts connected successfully!");else throw new Error((_==null?void 0:_.error)||"Unknown error")}catch(_){console.error("OAuth callback error:",_),s("error"),o(_ instanceof Error?_.message:"Failed to connect accounts"),Ie.error("Failed to connect: "+(_ instanceof Error?_.message:"Unknown error"))}})()},[e]),r.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background p-4",children:r.jsxs(Ze,{className:"w-full max-w-md",children:[r.jsxs(Wt,{className:"text-center",children:[n==="loading"&&r.jsx(Zr,{className:"h-12 w-12 animate-spin mx-auto text-primary"}),n==="success"&&r.jsx(di,{className:"h-12 w-12 mx-auto text-green-500"}),n==="error"&&r.jsx(bc,{className:"h-12 w-12 mx-auto text-destructive"}),r.jsxs(Yt,{className:"mt-4",children:[n==="loading"&&"Connecting...",n==="success"&&"Connected!",n==="error"&&"Connection Failed"]}),r.jsx(Sn,{children:a})]}),r.jsx(et,{className:"flex justify-center",children:n!=="loading"&&r.jsx(ee,{onClick:()=>t("/mission-control/integrations"),children:n==="success"?"View Connected Accounts":"Try Again"})})]})})}function cer(){const[e]=Gc(),t=Gn(),[n,s]=E.useState("loading"),[a,o]=E.useState("Connecting your Google Business Profile...");return E.useEffect(()=>{(async()=>{const i=e.get("code"),u=e.get("error"),p=e.get("error_description"),x=e.get("state");if(u){s("error"),o(p||"Authorization was denied"),Ie.error("Connection failed: "+(p||u));return}if(!i){s("error"),o("No authorization code received"),Ie.error("No authorization code received");return}try{const{data:y,error:_}=await Q.functions.invoke("google-business-oauth",{body:{action:"exchange_code",code:i,state:x}});if(_)throw _;if(y!=null&&y.success)s("success"),o(y.message||"Successfully connected Google Business Profile!"),Ie.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"),Ie.error("Failed to connect: "+(y instanceof Error?y.message:"Unknown error"))}})()},[e]),r.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background p-4",children:r.jsxs(Ze,{className:"w-full max-w-md",children:[r.jsxs(Wt,{className:"text-center",children:[n==="loading"&&r.jsx(Zr,{className:"h-12 w-12 animate-spin mx-auto text-primary"}),n==="success"&&r.jsx(di,{className:"h-12 w-12 mx-auto text-green-500"}),n==="error"&&r.jsx(bc,{className:"h-12 w-12 mx-auto text-destructive"}),r.jsxs(Yt,{className:"mt-4",children:[n==="loading"&&"Connecting...",n==="success"&&"Connected!",n==="error"&&"Connection Failed"]}),r.jsx(Sn,{children:a})]}),r.jsx(et,{className:"flex justify-center",children:n!=="loading"&&r.jsx(ee,{onClick:()=>t("/social-connections"),children:n==="success"?"View Connected Accounts":"Try Again"})})]})})}function der(){const[e]=Gc(),t=Gn(),[n,s]=E.useState("loading"),[a,o]=E.useState("Connecting your LinkedIn account...");return E.useEffect(()=>{(async()=>{var y;const i=e.get("code"),u=e.get("state"),p=e.get("error"),x=e.get("error_description");if(p){console.error("LinkedIn OAuth error:",p,x),s("error"),o(x||"Failed to connect LinkedIn account"),Ie.error(x||"Failed to connect LinkedIn");return}if(!i){s("error"),o("No authorization code received"),Ie.error("No authorization code received");return}try{const{data:_,error:b}=await Q.functions.invoke("linkedin-oauth",{body:{action:"exchange_code",code:i,state:u,callbackPath:"/social-connections/linkedin-callback"}});if(b)throw b;if(_!=null&&_.success)s("success"),o(`Successfully connected ${((y=_.accounts)==null?void 0:y.length)||1} LinkedIn account`),Ie.success("LinkedIn connected successfully!");else throw new Error((_==null?void 0:_.error)||"Failed to connect LinkedIn account")}catch(_){console.error("LinkedIn callback error:",_),s("error"),o(_ instanceof Error?_.message:"Failed to connect LinkedIn account"),Ie.error("Failed to connect LinkedIn")}})()},[e]),r.jsx("div",{className:"min-h-screen flex items-center justify-center p-4 bg-background",children:r.jsxs(Ze,{className:"w-full max-w-md",children:[r.jsxs(Wt,{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(Zr,{className:"h-8 w-8 animate-spin text-blue-600"}),n==="success"&&r.jsx(di,{className:"h-8 w-8 text-green-600"}),n==="error"&&r.jsx(bc,{className:"h-8 w-8 text-red-600"})]}),r.jsxs(Yt,{className:"flex items-center justify-center gap-2",children:[r.jsx(gf,{className:"h-5 w-5 text-blue-600"}),n==="loading"&&"Connecting...",n==="success"&&"Connected!",n==="error"&&"Connection Failed"]}),r.jsx(Sn,{children:a})]}),r.jsx(et,{className:"flex justify-center",children:r.jsx(ee,{onClick:()=>t("/social-connections"),disabled:n==="loading",children:n==="success"?"Continue":"Back to Connections"})})]})})}function uer(){const e=Gn(),[t,n]=E.useState(null),{data:s,isLoading:a}=DVe(t||void 0,!0),{data:o,isLoading:l}=ove(!0),{cartItems:i}=lae(),u=i.reduce((x,y)=>x+y.quantity,0),p=x=>{e(`/marketplace/${x.id}`)};return a||l?r.jsx(Dr,{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(Lr,{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(Lr,{className:"h-72 w-full"},x))})]})}):r.jsx(Dr,{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:()=>e("/marketplace/cart"),className:"relative",children:[r.jsx(Nh,{className:"h-4 w-4 mr-2"}),"Cart",u>0&&r.jsx(Pt,{className:"absolute -top-2 -right-2 h-5 w-5 flex items-center justify-center p-0 text-xs",children:u})]})]}),o&&o.length>0&&r.jsxs("div",{className:"flex gap-2 overflow-x-auto pb-2",children:[r.jsx(ee,{variant:t===null?"default":"outline",size:"sm",onClick:()=>n(null),children:"All"}),o.map(x=>r.jsx(ee,{variant:t===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(Ze,{className:"overflow-hidden cursor-pointer hover:shadow-lg transition-shadow",onClick:()=>p(x),children:[r.jsxs("div",{className:"aspect-square bg-muted relative",children:[x.images&&x.images.length>0?r.jsx("img",{src:((y=x.images.find(_=>_.is_primary))==null?void 0:y.image_url)||x.images[0].image_url,alt:x.name,className:"w-full h-full object-cover"}):r.jsx("div",{className:"flex items-center justify-center h-full",children:r.jsx(ql,{className:"h-12 w-12 text-muted-foreground"})}),x.category&&r.jsx(Pt,{className:"absolute top-2 left-2",variant:"secondary",children:x.category.name})]}),r.jsxs(et,{className:"p-4",children:[r.jsx("h3",{className:"font-semibold mb-1 line-clamp-1",children:x.name}),x.description&&r.jsx("p",{className:"text-sm text-muted-foreground mb-2 line-clamp-2",children:x.description}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("span",{className:"font-bold text-lg",children:["$",Number(x.base_price).toFixed(2)]}),x.variants&&x.variants.length>0&&r.jsxs("span",{className:"text-xs text-muted-foreground",children:[x.variants.length," options"]})]})]})]},x.id)})}):r.jsxs("div",{className:"text-center py-12",children:[r.jsx(ql,{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 zVe=E.forwardRef(({...e},t)=>r.jsx("nav",{ref:t,"aria-label":"breadcrumb",...e}));zVe.displayName="Breadcrumb";const BVe=E.forwardRef(({className:e,...t},n)=>r.jsx("ol",{ref:n,className:Bt("flex flex-wrap items-center gap-1.5 break-words text-sm text-muted-foreground sm:gap-2.5",e),...t}));BVe.displayName="BreadcrumbList";const tte=E.forwardRef(({className:e,...t},n)=>r.jsx("li",{ref:n,className:Bt("inline-flex items-center gap-1.5",e),...t}));tte.displayName="BreadcrumbItem";const ege=E.forwardRef(({asChild:e,className:t,...n},s)=>{const a=e?Qge:"a";return r.jsx(a,{ref:s,className:Bt("transition-colors hover:text-foreground",t),...n})});ege.displayName="BreadcrumbLink";const $Ve=E.forwardRef(({className:e,...t},n)=>r.jsx("span",{ref:n,role:"link","aria-disabled":"true","aria-current":"page",className:Bt("font-normal text-foreground",e),...t}));$Ve.displayName="BreadcrumbPage";const tge=({children:e,className:t,...n})=>r.jsx("li",{role:"presentation","aria-hidden":"true",className:Bt("[&>svg]:size-3.5",t),...n,children:e??r.jsx(Wi,{})});tge.displayName="BreadcrumbSeparator";function her(){var ge,ie;const{productId:e}=md(),t=Gn(),{data:n,isLoading:s}=vJt(e||""),{addToCart:a,cartItems:o}=lae(),[l,i]=E.useState(null),[u,p]=E.useState(1),[x,y]=E.useState(0),[_,b]=E.useState(null),[S,k]=E.useState(!1),[M,P]=E.useState(!1),T=(ge=n==null?void 0:n.variants)==null?void 0:ge.find(pe=>pe.id===l),I=((ie=n==null?void 0:n.variants)==null?void 0:ie.filter(pe=>pe.is_active))||[],z=Number((n==null?void 0:n.base_price)||0),D=T?Number(T.price_adjustment):0,U=z+D,V=Number((n==null?void 0:n.shipping_fee)||0),W=o.reduce((pe,se)=>pe+se.quantity,0),G=async pe=>{if(!pe.target.files||pe.target.files.length===0)return;k(!0);const se=pe.target.files[0],fe=se.name.split(".").pop(),he=`artwork/${Date.now()}-${Math.random().toString(36).substring(7)}.${fe}`;try{const{error:ye}=await Q.storage.from("marketplace").upload(he,se);if(ye)throw ye;const{data:{publicUrl:Ae}}=Q.storage.from("marketplace").getPublicUrl(he);b(Ae),Ie.success("Artwork uploaded successfully")}catch(ye){Ie.error("Failed to upload artwork: "+ye.message)}finally{k(!1)}},J=()=>{if(n){if(I.length>0&&!l){Ie.error("Please select an option");return}a(n,T||void 0,u,_||void 0),P(!0),Ie.success("Added to cart!"),setTimeout(()=>P(!1),2e3)}},ne=()=>{n!=null&&n.images&&y(pe=>(pe+1)%n.images.length)},oe=()=>{n!=null&&n.images&&y(pe=>(pe-1+n.images.length)%n.images.length)};return s?r.jsx(Dr,{title:"Product",children:r.jsxs("div",{className:"grid gap-8 lg:grid-cols-2",children:[r.jsx(Lr,{className:"aspect-square w-full"}),r.jsxs("div",{className:"space-y-4",children:[r.jsx(Lr,{className:"h-8 w-3/4"}),r.jsx(Lr,{className:"h-6 w-1/4"}),r.jsx(Lr,{className:"h-24 w-full"}),r.jsx(Lr,{className:"h-12 w-full"})]})]})}):n?r.jsxs(Dr,{title:n.name,children:[r.jsx(zVe,{className:"mb-6",children:r.jsxs(BVe,{children:[r.jsx(tte,{children:r.jsx(ege,{asChild:!0,children:r.jsx(oo,{to:"/marketplace",children:"Marketplace"})})}),n.category&&r.jsxs(r.Fragment,{children:[r.jsx(tge,{}),r.jsx(tte,{children:r.jsx(ege,{asChild:!0,children:r.jsx(oo,{to:`/marketplace?category=${n.category.id}`,children:n.category.name})})})]}),r.jsx(tge,{}),r.jsx(tte,{children:r.jsx($Ve,{children:n.name})})]})}),r.jsxs("div",{className:"grid gap-8 lg:grid-cols-2",children:[r.jsxs("div",{className:"space-y-4",children:[r.jsx("div",{className:"relative aspect-square bg-muted rounded-lg overflow-hidden flex items-center justify-center",children:n.images&&n.images.length>0?r.jsxs(r.Fragment,{children:[r.jsx("img",{src:n.images[x].image_url,alt:n.name,className:"max-w-full max-h-full object-contain"}),n.images.length>1&&r.jsxs(r.Fragment,{children:[r.jsx(ee,{variant:"ghost",size:"icon",className:"absolute left-2 top-1/2 -translate-y-1/2 bg-background/80 hover:bg-background",onClick:oe,children:r.jsx(kc,{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:ne,children:r.jsx(Wi,{className:"h-6 w-6"})})]})]}):r.jsx("div",{className:"flex items-center justify-center h-full",children:r.jsx(ql,{className:"h-24 w-24 text-muted-foreground"})})}),n.images&&n.images.length>1&&r.jsx("div",{className:"flex gap-2 overflow-x-auto pb-2",children:n.images.map((pe,se)=>r.jsx("button",{onClick:()=>y(se),className:`w-16 h-16 flex-shrink-0 rounded-md overflow-hidden border-2 ${se===x?"border-primary":"border-transparent"}`,children:r.jsx("img",{src:pe.image_url,alt:"",className:"w-full h-full object-cover"})},pe.id))}),n.video&&r.jsx(Ze,{children:r.jsxs(et,{className:"p-4",children:[r.jsx("h4",{className:"font-medium mb-2",children:"Product Video"}),r.jsx("div",{className:"aspect-video",children:r.jsx("iframe",{src:n.video.video_url,className:"w-full h-full rounded-lg",allowFullScreen:!0})})]})})]}),r.jsxs("div",{className:"space-y-6",children:[r.jsxs("div",{children:[n.category&&r.jsx(Pt,{variant:"secondary",className:"mb-2",children:n.category.name}),r.jsx("h1",{className:"text-3xl font-bold mb-2",children:n.name}),r.jsxs("div",{className:"flex items-baseline gap-2",children:[r.jsxs("span",{className:"text-3xl font-bold",children:["$",U.toFixed(2)]}),V>0&&r.jsxs("span",{className:"text-muted-foreground",children:["+ $",V.toFixed(2)," shipping"]})]})]}),n.description&&r.jsx("div",{className:"prose prose-sm max-w-none",children:r.jsx("p",{className:"text-muted-foreground whitespace-pre-wrap",children:n.description})}),I.length>0&&r.jsxs("div",{className:"space-y-3",children:[r.jsx($e,{children:"Select Option"}),r.jsx("div",{className:"flex flex-wrap gap-2",children:I.map(pe=>r.jsxs(ee,{variant:l===pe.id?"default":"outline",onClick:()=>i(pe.id),children:[pe.name,Number(pe.price_adjustment)!==0&&r.jsxs("span",{className:"ml-1 opacity-70",children:["(",Number(pe.price_adjustment)>0?"+":"","$",Number(pe.price_adjustment).toFixed(2),")"]})]},pe.id))})]}),n.allow_artwork_upload&&r.jsxs("div",{className:"space-y-3",children:[r.jsx($e,{children:"Upload Your Artwork (Optional)"}),_?r.jsxs("div",{className:"relative inline-block",children:[r.jsx("img",{src:_,alt:"Your artwork",className:"h-24 w-auto rounded-lg border"}),r.jsx(ee,{variant:"ghost",size:"sm",className:"absolute -top-2 -right-2",onClick:()=>b(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:S}),r.jsxs("label",{htmlFor:"artwork-upload",className:"flex flex-col items-center cursor-pointer",children:[r.jsx(_o,{className:"h-8 w-8 text-muted-foreground mb-2"}),r.jsx("span",{className:"text-sm text-muted-foreground",children:S?"Uploading...":"Click to upload artwork"}),r.jsx("span",{className:"text-xs text-muted-foreground mt-1",children:"Supported: JPG, PNG, PDF, AI, EPS"})]})]})]}),r.jsxs("div",{className:"space-y-3",children:[r.jsx($e,{children:"Quantity"}),r.jsxs("div",{className:"flex items-center gap-2",children:[r.jsx(ee,{variant:"outline",size:"icon",onClick:()=>p(pe=>Math.max(1,pe-1)),children:"-"}),r.jsx(dt,{type:"number",value:u,onChange:pe=>p(Math.max(1,parseInt(pe.target.value)||1)),className:"w-20 text-center",min:"1"}),r.jsx(ee,{variant:"outline",size:"icon",onClick:()=>p(pe=>pe+1),children:"+"})]})]}),r.jsxs("div",{className:"flex gap-4",children:[r.jsx(ee,{size:"lg",className:"flex-1",onClick:J,disabled:M,children:M?r.jsxs(r.Fragment,{children:[r.jsx(Ni,{className:"h-5 w-5 mr-2"}),"Added!"]}):r.jsxs(r.Fragment,{children:[r.jsx(Nh,{className:"h-5 w-5 mr-2"}),"Add to Cart"]})}),r.jsxs(ee,{variant:"outline",size:"lg",onClick:()=>t("/marketplace/cart"),className:"relative",children:[r.jsx(Nh,{className:"h-5 w-5"}),W>0&&r.jsx(Pt,{className:"absolute -top-2 -right-2 h-5 w-5 flex items-center justify-center p-0 text-xs",children:W})]})]}),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(Dr,{title:"Product Not Found",children:r.jsxs("div",{className:"text-center py-12",children:[r.jsx(ql,{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:()=>t("/marketplace"),children:"Back to Marketplace"})]})})}function fer(){const e=Gn(),{cartItems:t,removeFromCart:n,updateQuantity:s,getItemPrice:a,getSubtotal:o,getShippingTotal:l,getTotal:i,clearCart:u}=lae(),[p,x]=E.useState(!1),[y,_]=E.useState(""),b=async()=>{if(t.length===0){Ie.error("Your cart is empty");return}x(!0);try{const{data:S,error:k}=await Q.functions.invoke("marketplace-checkout",{body:{items:t.map(M=>{var P;return{product_id:M.product.id,variant_id:((P=M.variant)==null?void 0:P.id)||null,quantity:M.quantity,artwork_url:M.artworkUrl||null}}),notes:y.trim()||null}});if(k)throw k;if(S!=null&&S.url)u(),window.open(S.url,"_blank");else throw new Error("No checkout URL received")}catch(S){Ie.error("Checkout failed: "+S.message)}finally{x(!1)}};return t.length===0?r.jsx(Dr,{title:"Shopping Cart",children:r.jsxs("div",{className:"text-center py-12",children:[r.jsx(Rg,{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:()=>e("/marketplace"),children:"Browse Marketplace"})]})}):r.jsx(Dr,{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:[t.map(S=>{var k,M;return r.jsx(Ze,{children:r.jsx(et,{className:"p-4",children:r.jsxs("div",{className:"flex gap-4",children:[r.jsx("div",{className:"w-24 h-24 flex-shrink-0 bg-muted rounded-lg overflow-hidden",children:S.product.images&&S.product.images.length>0?r.jsx("img",{src:((k=S.product.images.find(P=>P.is_primary))==null?void 0:k.image_url)||S.product.images[0].image_url,alt:S.product.name,className:"w-full h-full object-cover"}):r.jsx("div",{className:"flex items-center justify-center h-full",children:r.jsx(Rg,{className:"h-8 w-8 text-muted-foreground"})})}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("h3",{className:"font-semibold line-clamp-1",children:S.product.name}),S.variant&&r.jsx("p",{className:"text-sm text-muted-foreground",children:S.variant.name}),r.jsxs("p",{className:"font-medium mt-1",children:["$",a(S).toFixed(2),Number(S.product.shipping_fee)>0&&r.jsxs("span",{className:"text-sm text-muted-foreground ml-2",children:["+ $",Number(S.product.shipping_fee).toFixed(2)," shipping"]})]}),S.artworkUrl&&r.jsx("div",{className:"mt-2",children:r.jsx("span",{className:"text-xs text-muted-foreground",children:"Artwork uploaded ✓"})})]}),r.jsxs("div",{className:"flex flex-col items-end gap-2",children:[r.jsx(ee,{variant:"ghost",size:"icon",className:"h-8 w-8",onClick:()=>{var P;return n(S.product.id,(P=S.variant)==null?void 0:P.id)},children:r.jsx(Bn,{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 P;return s(S.product.id,(P=S.variant)==null?void 0:P.id,S.quantity-1)},disabled:S.quantity<=1,children:r.jsx(G1,{className:"h-3 w-3"})}),r.jsx(dt,{type:"number",value:S.quantity,onChange:P=>{var T;return s(S.product.id,(T=S.variant)==null?void 0:T.id,parseInt(P.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 P;return s(S.product.id,(P=S.variant)==null?void 0:P.id,S.quantity+1)},children:r.jsx(bn,{className:"h-3 w-3"})})]})]})]})})},`${S.product.id}-${((M=S.variant)==null?void 0:M.id)||"base"}`)}),r.jsx(ee,{variant:"ghost",className:"text-destructive",onClick:u,children:"Clear Cart"})]}),r.jsx("div",{children:r.jsxs(Ze,{className:"sticky top-4",children:[r.jsx(Wt,{children:r.jsx(Yt,{children:"Order Summary"})}),r.jsxs(et,{className:"space-y-4",children:[r.jsxs("div",{className:"flex justify-between text-sm",children:[r.jsxs("span",{children:["Subtotal (",t.reduce((S,k)=>S+k.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(Ld,{}),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(Ld,{}),r.jsxs("div",{className:"space-y-2",children:[r.jsx($e,{htmlFor:"orderNotes",children:"Order Notes (Optional)"}),r.jsx(Jn,{id:"orderNotes",placeholder:"Add any special instructions, design notes, or comments for your order...",value:y,onChange:S=>_(S.target.value),rows:3,className:"resize-none"})]}),r.jsx(ee,{className:"w-full",size:"lg",onClick:b,disabled:p,children:p?r.jsxs(r.Fragment,{children:[r.jsx(Zr,{className:"h-5 w-5 mr-2 animate-spin"}),"Processing..."]}):r.jsxs(r.Fragment,{children:["Checkout",r.jsx(Vo,{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 per(){const e=Gn(),{data:t,isLoading:n}=AJt();return n?r.jsx(Dr,{title:"My Orders",children:r.jsx("div",{className:"space-y-4",children:[1,2,3].map(s=>r.jsx(Lr,{className:"h-32 w-full"},s))})}):!t||t.length===0?r.jsx(Dr,{title:"My Orders",children:r.jsxs("div",{className:"text-center py-12",children:[r.jsx(ql,{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:()=>e("/marketplace"),children:"Browse Marketplace"})]})}):r.jsx(Dr,{title:"My Orders",children:r.jsx("div",{className:"space-y-4",children:t.map(s=>{var a,o,l;return r.jsx(Ze,{className:"cursor-pointer hover:shadow-md transition-shadow",onClick:()=>e(`/marketplace/orders/${s.id}`),children:r.jsxs(et,{className:"p-4",children:[r.jsxs("div",{className:"flex items-center justify-between mb-3",children:[r.jsxs("div",{children:[r.jsx("span",{className:"font-semibold",children:s.order_number}),r.jsx("span",{className:"text-muted-foreground text-sm ml-2",children:on(new Date(s.created_at),"MMM d, yyyy")})]}),r.jsx(Pt,{className:ive[s.status],children:sC[s.status]})]}),r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsxs("div",{className:"flex -space-x-2",children:[(a=s.items)==null?void 0:a.slice(0,3).map((i,u)=>r.jsxs("div",{className:"w-10 h-10 bg-muted rounded border-2 border-background flex items-center justify-center text-xs font-medium",style:{zIndex:3-u},children:[i.quantity,"×"]},i.id)),s.items&&s.items.length>3&&r.jsxs("div",{className:"w-10 h-10 bg-muted rounded border-2 border-background flex items-center justify-center text-xs font-medium",children:["+",s.items.length-3]})]}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm",children:((o=s.items)==null?void 0:o.length)===1?s.items[0].product_name:`${(l=s.items)==null?void 0:l.length} items`}),r.jsxs("p",{className:"font-semibold",children:["$",Number(s.total).toFixed(2)]})]})]}),r.jsxs("div",{className:"flex items-center gap-2",children:[s.tracking_url&&r.jsxs(ee,{variant:"outline",size:"sm",onClick:i=>{i.stopPropagation(),window.open(s.tracking_url,"_blank")},children:[r.jsx(As,{className:"h-4 w-4 mr-1"}),"Track"]}),r.jsx(Wi,{className:"h-5 w-5 text-muted-foreground"})]})]})]})},s.id)})})})}const CTe=["order_submitted","awaiting_proof_approval","proof_approved","processing","in_production","shipped","completed"];function mer({currentStatus:e,statusHistory:t}){const n=CTe.indexOf(e);return r.jsx("div",{className:"space-y-3",children:CTe.map((s,a)=>{const o=t==null?void 0:t.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(so,{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 ${u?"text-muted-foreground":""}`,children:sC[s]}),o&&r.jsxs("p",{className:"text-xs text-muted-foreground",children:[on(new Date(o.created_at),"MMM d, yyyy h:mm a"),o.notes&&` — ${o.notes}`]})]})]},s)})})}function ger(){var P;const{orderId:e}=md(),t=Gn(),{data:n,isLoading:s,refetch:a}=EJt(e||""),o=LJt(),l=OJt(),[i,u]=E.useState(!1),[p,x]=E.useState(null),[y,_]=E.useState(""),[b,S]=E.useState(null),k=async T=>{S(T);try{await o.mutateAsync({orderId:e,itemId:T}),Ie.success("Proof approved!"),a()}catch{Ie.error("Failed to approve proof")}finally{S(null)}},M=async()=>{if(p){S(p);try{await l.mutateAsync({orderId:e,itemId:p,reason:y}),Ie.success("Revision requested"),u(!1),_(""),x(null),a()}catch{Ie.error("Failed to request revision")}finally{S(null)}}};return s?r.jsx(Dr,{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(Lr,{className:"h-64 w-full"}),r.jsx(Lr,{className:"h-48 w-full"})]}),r.jsx(Lr,{className:"h-96 w-full"})]})}):n?r.jsxs(Dr,{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(Ze,{children:[r.jsxs(Wt,{className:"flex flex-row items-center justify-between",children:[r.jsx(Yt,{children:"Order Status"}),r.jsx(Pt,{className:ive[n.status],children:sC[n.status]})]}),r.jsx(et,{children:r.jsx(mer,{currentStatus:n.status,statusHistory:n.status_history})})]}),r.jsxs(Ze,{children:[r.jsx(Wt,{children:r.jsx(Yt,{children:"Items"})}),r.jsx(et,{className:"space-y-4",children:(P=n.items)==null?void 0:P.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(U1,{className:"h-4 w-4"}),"View Artwork",r.jsx(As,{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(U1,{className:"h-4 w-4"}),"View Proof",r.jsx(As,{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:()=>k(T.id),disabled:b===T.id,children:[b===T.id?r.jsx(Zr,{className:"h-4 w-4 mr-1 animate-spin"}):r.jsx(zd,{className:"h-4 w-4 mr-1"}),"Approve"]}),r.jsxs(ee,{size:"sm",variant:"outline",onClick:()=>{x(T.id),u(!0)},disabled:b===T.id,children:[r.jsx(kA,{className:"h-4 w-4 mr-1"}),"Request Changes"]})]}),T.proof_status==="approved"&&r.jsxs(Pt,{className:"bg-green-100 text-green-800",children:[r.jsx(so,{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(Pt,{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(Ze,{children:[r.jsx(Wt,{children:r.jsxs(Yt,{className:"flex items-center gap-2",children:[r.jsx(SA,{className:"h-5 w-5"}),"Shipping"]})}),r.jsxs(et,{children:[r.jsx("p",{className:"font-medium",children:n.shipping_name}),r.jsxs("p",{className:"text-muted-foreground",children:[n.shipping_address,r.jsx("br",{}),n.shipping_city,", ",n.shipping_state," ",n.shipping_zip]}),n.tracking_number&&r.jsxs("div",{className:"mt-4 p-3 bg-muted rounded-lg",children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Tracking Number:"}),r.jsx("p",{className:"font-mono font-medium",children:n.tracking_number}),n.tracking_url&&r.jsxs(ee,{variant:"link",className:"p-0 h-auto mt-1",onClick:()=>window.open(n.tracking_url,"_blank"),children:["Track Package",r.jsx(As,{className:"h-3 w-3 ml-1"})]})]})]})]})]}),r.jsx("div",{children:r.jsxs(Ze,{className:"sticky top-4",children:[r.jsx(Wt,{children:r.jsx(Yt,{children:"Order Summary"})}),r.jsxs(et,{className:"space-y-4",children:[r.jsxs("div",{className:"text-sm text-muted-foreground",children:["Placed on ",on(new Date(n.created_at),"MMMM d, yyyy")]}),r.jsx(Ld,{}),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(Ld,{}),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(Ld,{}),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(Or,{open:i,onOpenChange:u,children:r.jsxs(Ir,{children:[r.jsxs($r,{children:[r.jsx(Fr,{children:"Request Changes"}),r.jsx(Zn,{children:"Please describe what changes you'd like made to the proof."})]}),r.jsx(Jn,{placeholder:"Describe the changes needed...",value:y,onChange:T=>_(T.target.value),rows:4}),r.jsxs(Bs,{children:[r.jsx(ee,{variant:"outline",onClick:()=>u(!1),children:"Cancel"}),r.jsxs(ee,{onClick:M,disabled:!y.trim()||b!==null,children:[b?r.jsx(Zr,{className:"h-4 w-4 mr-2 animate-spin"}):null,"Submit Request"]})]})]})})]}):r.jsx(Dr,{title:"Order Not Found",children:r.jsxs("div",{className:"text-center py-12",children:[r.jsx(ql,{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:()=>t("/marketplace/orders"),children:"View All Orders"})]})})}function xer(){const e=Gn(),[t]=Gc();return t.get("session_id"),E.useEffect(()=>{localStorage.removeItem("marketplace-cart")},[]),r.jsx(Dr,{title:"Order Confirmed",children:r.jsx("div",{className:"max-w-lg mx-auto text-center py-8",children:r.jsx(Ze,{children:r.jsxs(et,{className:"pt-8 pb-6",children:[r.jsx("div",{className:"w-16 h-16 bg-green-100 rounded-full flex items-center justify-center mx-auto mb-6",children:r.jsx(so,{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(ql,{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:()=>e("/marketplace/orders"),children:["View My Orders",r.jsx(Vo,{className:"h-4 w-4 ml-2"})]}),r.jsx(ee,{variant:"outline",className:"flex-1",onClick:()=>e("/marketplace"),children:"Continue Shopping"})]})]})})})})}function yer(){const{user:e}=tn(),[t,n]=E.useState("store"),[s,a]=E.useState(null),[o,l]=E.useState(null),[i,u]=E.useState(!1),[p,x]=E.useState(5),[y,_]=E.useState(""),[b,S]=E.useState(!1),[k,M]=E.useState(!1),[P,T]=E.useState(""),[I,z]=E.useState(null),[D,U]=E.useState(!1),{hasSubmittedReview:V,submitReview:W,markPostedToGoogle:G}=iRe(),{data:J}=FVe(),{data:ne,isLoading:oe}=RVe(),{data:ge,isLoading:ie}=UJt(s),{data:pe,isLoading:se}=qJt(e==null?void 0:e.id),{data:fe=0}=HJt(e==null?void 0:e.id),he=WJt(),ye=new Set((pe==null?void 0:pe.map(De=>De.item_id))||[]),Ae=async()=>{if(o)try{await he.mutateAsync(o.id),Ie.success(`Successfully purchased "${o.name}"!`),l(null)}catch(De){Ie.error(De.message||"Failed to purchase item")}},we=async()=>{if(!y.trim()){Ie.error("Please write a review");return}S(!0);const De=await W(p,y);S(!1),De.success?(Ie.success("Thank you for your review! You earned 25 points!"),T(y),M(!0),_(""),x(5)):Ie.error(De.error||"Failed to submit review")},be=()=>{navigator.clipboard.writeText(P),Ie.success("Review copied to clipboard!")},_e=()=>{G(),window.open("https://g.page/r/CT8bqTBTm7nJEBM/review","_blank")},Je=()=>{M(!1),u(!1),T("")};return oe||ie||se?r.jsx(Dr,{title:"Reward Store",children:r.jsxs("div",{className:"space-y-6",children:[r.jsx(Lr,{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(De=>r.jsx(Lr,{className:"h-64"},De))})]})}):r.jsxs(Dr,{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(Ze,{className:"bg-gradient-to-r from-primary/10 to-primary/5 border-primary/20",children:r.jsx(et,{className:"pt-6",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx("div",{className:"h-12 w-12 rounded-full bg-primary/20 flex items-center justify-center",children:r.jsx(js,{className:"h-6 w-6 text-primary"})}),r.jsxs("div",{children:[r.jsx("p",{className:"text-sm text-muted-foreground",children:"Your Spendable Points"}),r.jsx("p",{className:"text-3xl font-bold text-primary",children:fe.toLocaleString()})]})]}),r.jsxs("div",{className:"flex items-center gap-6 text-sm text-muted-foreground",children:[r.jsxs("div",{className:"flex items-center gap-1",children:[r.jsx(ro,{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(ff,{className:"h-4 w-4 text-orange-500"}),r.jsx("span",{children:"Streak bonuses add extra points!"})]})]})]})})}),r.jsx(HS,{open:D,onOpenChange:U,children:r.jsxs(Ze,{className:"border-primary/20",children:[r.jsx(WS,{asChild:!0,children:r.jsx(Wt,{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(ro,{className:"h-5 w-5 text-primary"})}),r.jsxs("div",{children:[r.jsx(Yt,{className:"text-base",children:"How to Earn Points"}),r.jsx(Sn,{children:"See all the ways you can earn spendable points"})]})]}),D?r.jsx(iy,{className:"h-5 w-5 text-muted-foreground"}):r.jsx(Dd,{className:"h-5 w-5 text-muted-foreground"})]})})}),r.jsx(GS,{children:r.jsx(et,{className:"pt-0",children:r.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-3",children:[J==null?void 0:J.filter(De=>De.is_active).map(De=>{const Ue=Be=>{switch(Be){case"event_attendance":return r.jsx(Ss,{className:"h-5 w-5"});case"leave_review":return r.jsx(js,{className:"h-5 w-5"});case"add_listing":return r.jsx(xa,{className:"h-5 w-5"});case"first_contact":return r.jsx(Un,{className:"h-5 w-5"});case"first_video":return r.jsx($a,{className:"h-5 w-5"});case"first_community_post":return r.jsx(zo,{className:"h-5 w-5"});default:return r.jsx(to,{className:"h-5 w-5"})}};return r.jsxs("div",{className:"flex items-center gap-3 p-3 rounded-lg bg-muted/50 border",children:[r.jsx("div",{className:"h-10 w-10 rounded-full bg-primary/10 flex items-center justify-center text-primary shrink-0",children:Ue(De.action_key)}),r.jsxs("div",{className:"flex-1 min-w-0",children:[r.jsx("p",{className:"font-medium text-sm",children:De.action_name}),De.description&&r.jsx("p",{className:"text-xs text-muted-foreground truncate",children:De.description})]}),r.jsxs(Pt,{variant:"secondary",className:"font-bold shrink-0",children:["+",De.points]})]},De.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(ff,{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(Pt,{variant:"outline",className:"font-bold shrink-0 border-orange-500/50 text-orange-600",children:"+Bonus"})]})]})})})]})}),!V&&r.jsx(Ze,{className:"bg-gradient-to-r from-yellow-500/10 to-orange-500/10 border-yellow-500/20",children:r.jsx(et,{className:"pt-6",children:r.jsxs("div",{className:"flex items-center justify-between",children:[r.jsxs("div",{className:"flex items-center gap-4",children:[r.jsx("div",{className:"h-12 w-12 rounded-full bg-yellow-500/20 flex items-center justify-center",children:r.jsx(zo,{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:()=>u(!0),className:"bg-yellow-600 hover:bg-yellow-700",children:[r.jsx(js,{className:"h-4 w-4 mr-2"}),"Leave Review"]})]})})}),r.jsxs(Ai,{value:t,onValueChange:n,children:[r.jsxs(vi,{children:[r.jsxs(sn,{value:"store",className:"flex items-center gap-2",children:[r.jsx(Rg,{className:"h-4 w-4"}),"Store"]}),r.jsxs(sn,{value:"my-rewards",className:"flex items-center gap-2",children:[r.jsx(ql,{className:"h-4 w-4"}),"My Rewards",pe&&pe.length>0&&r.jsx(Pt,{variant:"secondary",className:"ml-1",children:pe.length})]})]}),r.jsxs(Mn,{value:"store",className:"mt-6",children:[ne&&ne.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"}),ne.map(De=>r.jsxs(ee,{variant:s===De.id?"default":"outline",size:"sm",onClick:()=>a(De.id),children:[De.icon&&`${De.icon} `,De.name]},De.id))]}),!ge||ge.length===0?r.jsx(Ze,{children:r.jsx(et,{className:"py-12",children:r.jsxs("div",{className:"text-center text-muted-foreground",children:[r.jsx(to,{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:ge.map(De=>{const Ue=ye.has(De.id),Be=De.max_quantity!==null&&De.current_quantity===0,qe=fe>=De.points_cost;return r.jsxs(Ze,{className:`overflow-hidden transition-all cursor-pointer hover:shadow-lg ${Ue?"ring-2 ring-green-500/50 bg-green-500/5":""}`,onClick:()=>z(De),children:[De.preview_image_url?r.jsxs("div",{className:"aspect-video relative overflow-hidden bg-muted",children:[r.jsx("img",{src:De.preview_image_url,alt:De.name,className:"w-full h-full object-cover"}),Ue&&r.jsx("div",{className:"absolute top-2 right-2",children:r.jsxs(Pt,{className:"bg-green-500 text-white",children:[r.jsx(so,{className:"h-3 w-3 mr-1"}),"Owned"]})}),Be&&!Ue&&r.jsx("div",{className:"absolute inset-0 bg-black/50 flex items-center justify-center",children:r.jsx(Pt,{variant:"destructive",children:"Sold Out"})})]}):r.jsxs("div",{className:"aspect-video bg-muted flex items-center justify-center relative",children:[r.jsx(to,{className:"h-12 w-12 text-muted-foreground/50"}),Ue&&r.jsx("div",{className:"absolute top-2 right-2",children:r.jsxs(Pt,{className:"bg-green-500 text-white",children:[r.jsx(so,{className:"h-3 w-3 mr-1"}),"Owned"]})})]}),r.jsxs(Wt,{className:"pb-2",children:[r.jsxs("div",{className:"flex items-start justify-between",children:[r.jsx(Yt,{className:"text-lg",children:De.name}),r.jsxs(Pt,{variant:"secondary",className:"font-bold shrink-0",children:[r.jsx(js,{className:"h-3 w-3 mr-1"}),De.points_cost]})]}),De.category&&r.jsxs(Pt,{variant:"outline",className:"w-fit",children:[De.category.icon&&`${De.category.icon} `,De.category.name]})]}),r.jsxs(et,{children:[r.jsx(Sn,{className:"mb-4 line-clamp-2",children:De.description||"No description available"}),De.max_quantity!==null&&!Ue&&r.jsxs("p",{className:"text-xs text-muted-foreground mb-3",children:[De.current_quantity," of ",De.max_quantity," remaining"]}),Ue?r.jsx(ee,{className:"w-full",onClick:ot=>{ot.stopPropagation(),De.file_url&&gue(De.file_url,De.name)},disabled:!De.file_url,children:De.item_type==="file"?r.jsxs(r.Fragment,{children:[r.jsx(io,{className:"h-4 w-4 mr-2"}),"Download"]}):r.jsxs(r.Fragment,{children:[r.jsx(As,{className:"h-4 w-4 mr-2"}),"Access"]})}):r.jsx(ee,{className:"w-full",onClick:ot=>{ot.stopPropagation(),l(De)},disabled:Be||!qe,children:Be?"Sold Out":qe?r.jsxs(r.Fragment,{children:[r.jsx(Rg,{className:"h-4 w-4 mr-2"}),"Purchase"]}):`Need ${De.points_cost-fe} more pts`})]})]},De.id)})})]}),r.jsx(Mn,{value:"my-rewards",className:"mt-6",children:!pe||pe.length===0?r.jsx(Ze,{children:r.jsx(et,{className:"py-12",children:r.jsxs("div",{className:"text-center text-muted-foreground",children:[r.jsx(ql,{className:"h-12 w-12 mx-auto mb-4 opacity-50"}),r.jsx("p",{className:"font-medium",children:"No rewards yet"}),r.jsx("p",{className:"text-sm",children:"Purchase items from the store to see them here!"})]})})}):r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4",children:pe.map(De=>{var Ue,Be,qe,ot,Mt;return r.jsxs(Ze,{className:"overflow-hidden",children:[(Ue=De.item)!=null&&Ue.preview_image_url?r.jsx("div",{className:"aspect-video relative overflow-hidden bg-muted",children:r.jsx("img",{src:De.item.preview_image_url,alt:((Be=De.item)==null?void 0:Be.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(to,{className:"h-12 w-12 text-muted-foreground/50"})}),r.jsxs(Wt,{className:"pb-2",children:[r.jsx(Yt,{className:"text-lg",children:((qe=De.item)==null?void 0:qe.name)||"Unknown Item"}),r.jsxs(Sn,{className:"text-xs",children:["Purchased for ",De.points_spent," points • ",new Date(De.purchased_at).toLocaleDateString()]})]}),r.jsx(et,{children:r.jsx(ee,{className:"w-full",onClick:()=>{var Oe,at;(Oe=De.item)!=null&&Oe.file_url&&gue(De.item.file_url,(at=De.item)==null?void 0:at.name)},disabled:!((ot=De.item)!=null&&ot.file_url),children:((Mt=De.item)==null?void 0:Mt.item_type)==="file"?r.jsxs(r.Fragment,{children:[r.jsx(io,{className:"h-4 w-4 mr-2"}),"Download"]}):r.jsxs(r.Fragment,{children:[r.jsx(As,{className:"h-4 w-4 mr-2"}),"Access"]})})})]},De.id)})})})]})]}),r.jsx(Id,{open:!!o,onOpenChange:()=>l(null),children:r.jsxs(id,{children:[r.jsxs(od,{children:[r.jsx(cd,{children:"Confirm Purchase"}),r.jsxs(dd,{children:['Are you sure you want to purchase "',o==null?void 0:o.name,'" for ',o==null?void 0:o.points_cost," points?",r.jsx("br",{}),r.jsx("br",{}),"You currently have ",r.jsxs("strong",{children:[fe," points"]}),". After this purchase, you'll have"," ",r.jsxs("strong",{children:[fe-((o==null?void 0:o.points_cost)||0)," points"]})," remaining."]})]}),r.jsxs(ld,{children:[r.jsx(ud,{children:"Cancel"}),r.jsx(Bc,{onClick:Ae,disabled:he.isPending,children:he.isPending?"Purchasing...":"Confirm Purchase"})]})]})}),r.jsx(Or,{open:i,onOpenChange:De=>{!De&&k?Je():u(De)},children:r.jsx(Ir,{children:k?r.jsxs(r.Fragment,{children:[r.jsxs($r,{children:[r.jsxs(Fr,{className:"flex items-center gap-2",children:[r.jsx(so,{className:"h-5 w-5 text-green-500"}),"Thank You for Your Review!"]}),r.jsx(Zn,{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:['"',P,'"']})]}),r.jsxs(ee,{variant:"outline",className:"w-full",onClick:be,children:[r.jsx(Wo,{className:"h-4 w-4 mr-2"}),"Copy Review to Clipboard"]})]}),r.jsxs(Bs,{className:"flex-col sm:flex-row gap-2",children:[r.jsx(ee,{variant:"outline",onClick:Je,children:"Maybe Later"}),r.jsxs(ee,{onClick:_e,className:"bg-blue-600 hover:bg-blue-700",children:[r.jsx(As,{className:"h-4 w-4 mr-2"}),"Leave Google Review"]})]})]}):r.jsxs(r.Fragment,{children:[r.jsxs($r,{children:[r.jsx(Fr,{children:"Leave a Review"}),r.jsx(Zn,{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(De=>r.jsx("button",{type:"button",onClick:()=>x(De),className:"focus:outline-none",children:r.jsx(js,{className:`h-8 w-8 transition-colors ${p>=De?"fill-yellow-400 text-yellow-400":"text-muted-foreground hover:text-yellow-400"}`})},De))})]}),r.jsxs("div",{children:[r.jsx("label",{className:"text-sm font-medium mb-2 block",children:"Your Review"}),r.jsx(Jn,{placeholder:"What do you love about LevelUp? How has it helped your business?",value:y,onChange:De=>_(De.target.value),rows:4})]})]}),r.jsxs(Bs,{children:[r.jsx(ee,{variant:"outline",onClick:()=>u(!1),children:"Cancel"}),r.jsx(ee,{onClick:we,disabled:b,className:"bg-yellow-600 hover:bg-yellow-700",children:b?"Submitting...":"Submit & Earn 25 Points"})]})]})})}),r.jsx(Or,{open:!!I,onOpenChange:()=>z(null),children:r.jsxs(Ir,{className:"max-w-lg",children:[r.jsxs($r,{children:[r.jsxs(Fr,{className:"flex items-center gap-2",children:[I==null?void 0:I.name,r.jsxs(Pt,{variant:"secondary",className:"font-bold",children:[r.jsx(js,{className:"h-3 w-3 mr-1"}),I==null?void 0:I.points_cost]})]}),(I==null?void 0:I.category)&&r.jsxs(Pt,{variant:"outline",className:"w-fit",children:[I.category.icon&&`${I.category.icon} `,I.category.name]})]}),(I==null?void 0:I.preview_image_url)&&r.jsx("div",{className:"aspect-video relative overflow-hidden bg-muted rounded-lg",children:r.jsx("img",{src:I.preview_image_url,alt:I.name,className:"w-full h-full object-cover"})}),r.jsxs("div",{className:"space-y-4",children:[r.jsx("p",{className:"text-muted-foreground",children:(I==null?void 0:I.description)||"No description available"}),(I==null?void 0:I.max_quantity)!==null&&!ye.has((I==null?void 0:I.id)||"")&&r.jsxs("p",{className:"text-sm text-muted-foreground",children:[I==null?void 0:I.current_quantity," of ",I==null?void 0:I.max_quantity," remaining"]})]}),r.jsx(Bs,{children:I&&ye.has(I.id)?r.jsx(ee,{className:"w-full",onClick:()=>{I.file_url&&gue(I.file_url,I.name)},disabled:!I.file_url,children:I.item_type==="file"?r.jsxs(r.Fragment,{children:[r.jsx(io,{className:"h-4 w-4 mr-2"}),"Download"]}):r.jsxs(r.Fragment,{children:[r.jsx(As,{className:"h-4 w-4 mr-2"}),"Access"]})}):I&&r.jsx(ee,{className:"w-full",onClick:()=>{z(null),l(I)},disabled:I.max_quantity!==null&&I.current_quantity===0||fe{const e=Bm();return E.useEffect(()=>{console.error("404 Error: User attempted to access non-existent route:",e.pathname)},[e.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"})]})})},_er=new ftt,ber=()=>{const e=window.location.hostname;return e==="listings.relevelup.com"||e.startsWith("listings.")},wer=()=>{const e=window.location.hostname;return e==="cards.relevelup.com"||e.startsWith("cards.")},jer=()=>r.jsx(ytt,{client:_er,children:r.jsx(VPe,{children:r.jsxs(YI,{children:[r.jsx(EQe,{}),r.jsx(cJe,{}),r.jsx(Ert,{children:r.jsx(Dat,{children:r.jsx(Rat,{children:r.jsxs(zat,{children:[r.jsx(Fat,{}),r.jsx(xlt,{}),r.jsx(Plt,{}),wer()?r.jsx(Qct,{}):ber()?r.jsx(_ct,{}):r.jsxs(jrt,{children:[r.jsx(nn,{path:"/",element:r.jsx(cdt,{})}),r.jsx(nn,{path:"/privacy-policy",element:r.jsx(ddt,{})}),r.jsx(nn,{path:"/terms-of-service",element:r.jsx(udt,{})}),r.jsx(nn,{path:"/data-deletion",element:r.jsx(hdt,{})}),r.jsx(nn,{path:"/public/listings",element:r.jsx(b8e,{})}),r.jsx(nn,{path:"/public/listing/:slugOrId",element:r.jsx(Ymt,{})}),r.jsx(nn,{path:"/card/:slug",element:r.jsx(Xmt,{})}),r.jsx(nn,{path:"/auth",element:r.jsx($dt,{})}),r.jsx(nn,{path:"/subscription-success",element:r.jsx(Udt,{})}),r.jsx(nn,{path:"/subscription",element:r.jsx(Nn,{children:r.jsx(smt,{})})}),r.jsx(nn,{path:"/share/video",element:r.jsx(Wmt,{}),children:r.jsx(nn,{path:":shareToken",element:r.jsx(Hmt,{})})}),r.jsx(nn,{path:"/og/video/:token",element:r.jsx(Gmt,{})}),r.jsx(nn,{path:"/setup-brokerage",element:r.jsx(Nn,{children:r.jsx(amt,{})})}),r.jsx(nn,{path:"/claim-account",element:r.jsx(qNe,{})}),r.jsx(nn,{path:"/claim",element:r.jsx(qNe,{})}),r.jsx(nn,{path:"/join",element:r.jsx(imt,{})}),r.jsx(nn,{path:"/trial",element:r.jsx(xmt,{})}),r.jsx(nn,{path:"/trial/success",element:r.jsx(ymt,{})}),r.jsx(nn,{path:"/dashboard",element:r.jsx(Nn,{children:r.jsx(rxt,{})})}),r.jsx(nn,{path:"/profile",element:r.jsx(Nn,{children:r.jsx(Hwt,{})})}),r.jsx(nn,{path:"/apps",element:r.jsx(Nn,{children:r.jsx(sjt,{})})}),r.jsx(nn,{path:"/admin",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(qNt,{})})}),r.jsx(nn,{path:"/admin/apps",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(WNt,{})})}),r.jsx(nn,{path:"/admin/members",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(ZNt,{})})}),r.jsx(nn,{path:"/admin/invite-codes",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(YNt,{})})}),r.jsx(nn,{path:"/admin/events",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(t4t,{})})}),r.jsx(nn,{path:"/events",element:r.jsx(Nn,{children:r.jsx(tjt,{})})}),r.jsx(nn,{path:"/events/:eventId",element:r.jsx(Nn,{children:r.jsx(njt,{})})}),r.jsx(nn,{path:"/templates",element:r.jsx(Nn,{children:r.jsx(ajt,{})})}),r.jsx(nn,{path:"/templates/:templateId",element:r.jsx(Nn,{children:r.jsx(cjt,{})})}),r.jsx(nn,{path:"/admin/templates",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(r4t,{})})}),r.jsx(nn,{path:"/academy",element:r.jsx(Nn,{children:r.jsx(djt,{})})}),r.jsx(nn,{path:"/academy/:videoId",element:r.jsx(Nn,{children:r.jsx(hjt,{})})}),r.jsx(nn,{path:"/admin/academy",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(s4t,{})})}),r.jsx(nn,{path:"/toolbox",element:r.jsx(Nn,{children:r.jsx(fjt,{})})}),r.jsx(nn,{path:"/toolbox/:kitId",element:r.jsx(Nn,{children:r.jsx(pjt,{})})}),r.jsx(nn,{path:"/admin/toolbox",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(a4t,{})})}),r.jsx(nn,{path:"/social-swag",element:r.jsx(Nn,{children:r.jsx(mjt,{})})}),r.jsx(nn,{path:"/social-swag-2",element:r.jsx(Nn,{children:r.jsx(fNt,{})})}),r.jsx(nn,{path:"/social-swag/:swagId",element:r.jsx(Nn,{children:r.jsx(pNt,{})})}),r.jsx(nn,{path:"/social-connections",element:r.jsx(Nn,{children:r.jsx(oer,{})})}),r.jsx(nn,{path:"/social-connections/callback",element:r.jsx(Nn,{children:r.jsx(ler,{})})}),r.jsx(nn,{path:"/social-connections/linkedin-callback",element:r.jsx(Nn,{children:r.jsx(der,{})})}),r.jsx(nn,{path:"/social-connections/google-callback",element:r.jsx(Nn,{children:r.jsx(cer,{})})}),r.jsx(nn,{path:"/admin/social-swag",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(i4t,{})})}),r.jsx(nn,{path:"/admin/social-swag-2",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(GSt,{})})}),r.jsx(nn,{path:"/community",element:r.jsx(Nn,{children:r.jsx(PNt,{})})}),r.jsx(nn,{path:"/support",element:r.jsx(Nn,{children:r.jsx(LNt,{})})}),r.jsx(nn,{path:"/admin/community",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(KSt,{})})}),r.jsx(nn,{path:"/admin/support-tickets",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(rCt,{})})}),r.jsx(nn,{path:"/admin/email-templates",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(aCt,{})})}),r.jsx(nn,{path:"/admin/agent-email-templates",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(iCt,{})})}),r.jsx(nn,{path:"/admin/analytics",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(JSt,{})})}),r.jsx(nn,{path:"/admin/brokerage-resources",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(eCt,{})})}),r.jsx(nn,{path:"/admin/dashboard-management",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(tCt,{})})}),r.jsx(nn,{path:"/brokerage/dashboard",element:r.jsx(Nn,{requireBrokerageManager:!0,children:r.jsx(xCt,{})})}),r.jsx(nn,{path:"/my-brokerage",element:r.jsx(Nn,{children:r.jsx(jCt,{})})}),r.jsx(nn,{path:"/brokerage-resources",element:r.jsx(Nn,{requireBrokerageManager:!0,children:r.jsx(BNt,{})})}),r.jsx(nn,{path:"/brokerage-resources/:resourceId",element:r.jsx(Nn,{requireBrokerageManager:!0,children:r.jsx($Nt,{})})}),r.jsx(nn,{path:"/newsletters",element:r.jsx(Nn,{children:r.jsx(kCt,{})})}),r.jsx(nn,{path:"/newsletters/:id",element:r.jsx(Nn,{children:r.jsx(SCt,{})})}),r.jsx(nn,{path:"/wishlist",element:r.jsx(Nn,{children:r.jsx(TCt,{})})}),r.jsx(nn,{path:"/wishlist/:itemId",element:r.jsx(Nn,{children:r.jsx(ACt,{})})}),r.jsx(nn,{path:"/admin/wishlist",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(ECt,{})})}),r.jsx(nn,{path:"/admin/levelup-brief",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(ICt,{})})}),r.jsx(nn,{path:"/admin/newsletters",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(MCt,{})})}),r.jsx(nn,{path:"/admin/additional-services",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(PCt,{})})}),r.jsx(nn,{path:"/admin/discounts",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(LCt,{})})}),r.jsx(nn,{path:"/admin/subscriptions",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(OCt,{})})}),r.jsx(nn,{path:"/admin/referrals",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(DCt,{})})}),r.jsx(nn,{path:"/admin/onboarding-checklist",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(FCt,{})})}),r.jsx(nn,{path:"/admin/marketplace",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(BJt,{})})}),r.jsx(nn,{path:"/admin/agent-points",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(dJt,{})})}),r.jsx(nn,{path:"/admin/reward-store",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(ter,{})})}),r.jsx(nn,{path:"/admin/integrations",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(ner,{})})}),r.jsx(nn,{path:"/admin/integrations/callback",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(ier,{})})}),r.jsx(nn,{path:"/reward-store",element:r.jsx(Nn,{children:r.jsx(yer,{})})}),r.jsx(nn,{path:"/additional-services",element:r.jsx(Nn,{children:r.jsx(ZCt,{})})}),r.jsx(nn,{path:"/additional-services/:serviceId",element:r.jsx(Nn,{children:r.jsx(YCt,{})})}),r.jsx(nn,{path:"/ai-toolkit",element:r.jsx(Nn,{children:r.jsx(XCt,{})})}),r.jsx(nn,{path:"/mission-control",element:r.jsx(Nn,{children:r.jsx(o3t,{})})}),r.jsx(nn,{path:"/mission-control/contacts",element:r.jsx(Nn,{children:r.jsx(S3t,{})})}),r.jsx(nn,{path:"/mission-control/contacts/:contactId",element:r.jsx(Nn,{children:r.jsx(U3t,{})})}),r.jsx(nn,{path:"/mission-control/plans",element:r.jsx(Nn,{children:r.jsx(q3t,{})})}),r.jsx(nn,{path:"/mission-control/popbys",element:r.jsx(Nn,{children:r.jsx(W3t,{})})}),r.jsx(nn,{path:"/mission-control/popbys/map",element:r.jsx(Nn,{children:r.jsx(G3t,{})})}),r.jsx(nn,{path:"/admin/notification-settings",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(aer,{})})}),r.jsx(nn,{path:"/admin/agent-os",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(BCt,{})})}),r.jsx(nn,{path:"/mission-control/listings",element:r.jsx(Nn,{children:r.jsx(IXt,{})})}),r.jsx(nn,{path:"/mission-control/listings/new",element:r.jsx(Nn,{children:r.jsx(bTe,{})})}),r.jsx(nn,{path:"/mission-control/listings/:listingId",element:r.jsx(Nn,{children:r.jsx(GXt,{})})}),r.jsx(nn,{path:"/mission-control/listings/:listingId/edit",element:r.jsx(Nn,{children:r.jsx(bTe,{})})}),r.jsx(nn,{path:"/admin/listing-exchange",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(sJt,{})})}),r.jsx(nn,{path:"/mission-control/pipeline",element:r.jsx(Nn,{children:r.jsx(wQt,{})})}),r.jsx(nn,{path:"/mission-control/my-card",element:r.jsx(Nn,{children:r.jsx(UQt,{})})}),r.jsx(nn,{path:"/mission-control/integrations",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(YQt,{})})}),r.jsx(nn,{path:"/mission-control/integrations/gmail/callback",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(XQt,{})})}),r.jsx(nn,{path:"/mission-control/integrations/canva/callback",element:r.jsx(QQt,{})}),r.jsx(nn,{path:"/mission-control/integrations/meta/callback",element:r.jsx(Nn,{children:r.jsx(JQt,{})})}),r.jsx(nn,{path:"/mission-control/scorecard",element:r.jsx(Nn,{children:r.jsx(wXt,{})})}),r.jsx(nn,{path:"/admin/scorecard",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(tJt,{})})}),r.jsx(nn,{path:"/admin/scorecard/:userId",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(nJt,{})})}),r.jsx(nn,{path:"/admin/membership-reviews",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(aJt,{})})}),r.jsx(nn,{path:"/admin/weekly-digest",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(lJt,{})})}),r.jsx(nn,{path:"/mission-control/video/record",element:r.jsx(Nn,{children:r.jsx(nQt,{})})}),r.jsx(nn,{path:"/mission-control/video-library",element:r.jsx(Nn,{children:r.jsx(lQt,{})})}),r.jsx(nn,{path:"/marketplace",element:r.jsx(Nn,{children:r.jsx(uer,{})})}),r.jsx(nn,{path:"/marketplace/:productId",element:r.jsx(Nn,{children:r.jsx(her,{})})}),r.jsx(nn,{path:"/marketplace/cart",element:r.jsx(Nn,{children:r.jsx(fer,{})})}),r.jsx(nn,{path:"/marketplace/orders",element:r.jsx(Nn,{children:r.jsx(per,{})})}),r.jsx(nn,{path:"/marketplace/orders/:orderId",element:r.jsx(Nn,{children:r.jsx(ger,{})})}),r.jsx(nn,{path:"/marketplace/success",element:r.jsx(Nn,{children:r.jsx(xer,{})})}),r.jsx(nn,{path:"/admin/agent-cards",element:r.jsx(Nn,{requireAdmin:!0,children:r.jsx(uJt,{})})}),r.jsx(nn,{path:"*",element:r.jsx(ver,{})})]}),")"]})})})})]})})});XEe(document.getElementById("root")).render(r.jsx(jer,{}));